diff --git a/lean/OAI/InformationTheory/Entanglement/MatrixMeasure.lean b/lean/OAI/InformationTheory/Entanglement/MatrixMeasure.lean new file mode 100644 index 0000000000000000000000000000000000000000..2e2260a825d44be7ed259c84c301b64b7650a15c --- /dev/null +++ b/lean/OAI/InformationTheory/Entanglement/MatrixMeasure.lean @@ -0,0 +1,72 @@ +import OAI.InformationTheory.Entanglement.DensityGap + +namespace OAI + +noncomputable section +open scoped BigOperators ComplexOrder MatrixOrder ENNReal MeasureTheory Matrix.Norms.L2Operator +open Matrix MeasureTheory +namespace SecretKey +open ChannelCompletion +variable {Ω : Type*} [MeasurableSpace Ω] {μ : Measure Ω} + +lemma complex_setIntegral_rnDeriv (c : ComplexMeasure Ω) [SigmaFinite μ] + (hc : c ≪ᵥ μ.toENNRealVectorMeasure) {s : Set Ω} (hs : MeasurableSet s) : + (∫ x in s, c.rnDeriv μ x ∂μ)=c s := by + have h := (ComplexMeasure.absolutelyContinuous_ennreal_iff c _).mp hc + have hr := congrArg (fun v : SignedMeasure Ω => v s) + (SignedMeasure.withDensityᵥ_rnDeriv_eq c.re μ h.1) + have hi := congrArg (fun v : SignedMeasure Ω => v s) + (SignedMeasure.withDensityᵥ_rnDeriv_eq c.im μ h.2) + rw [withDensityᵥ_apply (SignedMeasure.integrable_rnDeriv _ _) hs] at hr hi + apply Complex.ext + · exact (integral_re (c.integrable_rnDeriv μ).integrableOn).symm.trans hr + · exact (integral_im (c.integrable_rnDeriv μ).integrableOn).symm.trans hi + +lemma measurable_complex_rnDeriv (c : ComplexMeasure Ω) : Measurable (c.rnDeriv μ) := by + have he : c.rnDeriv μ = fun x => ((c.re.rnDeriv μ x : ℝ) : ℂ) + + ((c.im.rnDeriv μ x : ℝ) : ℂ)*Complex.I := by funext x; exact (Complex.re_add_im (c.rnDeriv μ x)).symm + rw [he] + exact (SignedMeasure.measurable_rnDeriv c.re μ).complex_ofReal.add + ((SignedMeasure.measurable_rnDeriv c.im μ).complex_ofReal.mul_const _) + +variable {n : Type} [Fintype n] + +structure PositiveMatrixMeasure (Ω : Type*) [MeasurableSpace Ω] (n : Type) [Fintype n] where + entry : Matrix n n (ComplexMeasure Ω) + positive : ∀ s, MeasurableSet s → Matrix.PosSemidef (fun i j => entry i j s) +namespace PositiveMatrixMeasure +variable (W : PositiveMatrixMeasure Ω n) +def value (s : Set Ω) : Mat n := fun i j => W.entry i j s +def density (μ : Measure Ω) (x : Ω) : Mat n := fun i j => (W.entry i j).rnDeriv μ x +lemma density_integrable (i j : n) : Integrable (fun x => W.density μ x i j) μ := + (W.entry i j).integrable_rnDeriv μ +lemma density_measurable : Measurable (W.density μ) := by + change @Measurable Ω (n → n → ℂ) _ (borel _) _ + rw [← @BorelSpace.measurable_eq (n → n → ℂ) _ MeasurableSpace.pi _] + exact Measurable.of_eval fun row => Measurable.of_eval fun column => + measurable_complex_rnDeriv (W.entry row column) +lemma entry_absolutelyContinuous + (hdom : ∀ s, MeasurableSet s → μ s=0 → (Matrix.trace (W.value s)).re=0) (i j : n) : + W.entry i j ≪ᵥ μ.toENNRealVectorMeasure := by + intro s hs + by_cases hsm : MeasurableSet s + · have hz : μ s=0 := by simpa only [Measure.toENNRealVectorMeasure_apply,ite_eq_left hsm] using hs + have hp := W.positive s hsm + have ht : Matrix.trace (W.value s)=0 := by + apply Complex.ext + · exact hdom s hsm hz + · exact (Complex.nonneg_iff.mp hp.trace_nonneg).2.symm + have hm : W.value s=0 := hp.trace_eq_zero_iff.mp ht + exact congrArg (fun M : Mat n => M i j) hm + · exact (W.entry i j).not_measurable hsm +lemma density_setIntegral [SigmaFinite μ] + (hdom : ∀ s, MeasurableSet s → μ s=0 → (Matrix.trace (W.value s)).re=0) + {s : Set Ω} (hs : MeasurableSet s) (i j : n) : + (∫ x in s, W.density μ x i j ∂μ)=W.value s i j := + complex_setIntegral_rnDeriv _ (W.entry_absolutelyContinuous hdom i j) hs +end PositiveMatrixMeasure +end SecretKey + +end + +end OAI diff --git a/lean/OAI/InformationTheory/Entanglement/MatrixMeasureChannel.lean b/lean/OAI/InformationTheory/Entanglement/MatrixMeasureChannel.lean new file mode 100644 index 0000000000000000000000000000000000000000..7de17ad552904712757c9746b189b7816d405ac2 --- /dev/null +++ b/lean/OAI/InformationTheory/Entanglement/MatrixMeasureChannel.lean @@ -0,0 +1,160 @@ +import OAI.InformationTheory.Entanglement.FiniteRecovery +import OAI.InformationTheory.Entanglement.FactorizedLawGap +import OAI.InformationTheory.Entanglement.ChoiTransfer + +namespace OAI + +noncomputable section +open MeasureTheory Matrix Filter +open scoped MeasureTheory BigOperators ComplexOrder MatrixOrder +namespace SecretKey +open ChannelCompletion TensorCriterion +variable {T : Type*} [MeasurableSpace T] {n m : Type} [Fintype n] [Fintype m] + [DecidableEq n] [DecidableEq m] +namespace PositiveMatrixMeasure +omit [Fintype m] [DecidableEq m] in +lemma channel_entry_value (W : PositiveMatrixMeasure T n) (F : Map n m) (s : Set T) : + (fun a b => (∑ i, ∑ j, F (Matrix.single i j 1) a b • W.entry i j) s)=F (W.value s) := by + rw [linearMap_entries F (W.value s)] + ext a b + simp only [_root_.sum_apply,_root_.smul_apply,smul_eq_mul,Matrix.sum_apply,Matrix.smul_apply,value] + apply Finset.sum_congr rfl + intro i _ + apply Finset.sum_congr rfl + intro j _ + exact mul_comm _ _ + +def channel (W : PositiveMatrixMeasure T n) (F : Map n m) (hF : CP F) : PositiveMatrixMeasure T m where + entry a b := ∑ i, ∑ j, F (Matrix.single i j 1) a b • W.entry i j + positive s hs := by + rw [channel_entry_value] + exact cp_positive hF (W.positive s hs) +omit [DecidableEq m] in +lemma channel_value (W : PositiveMatrixMeasure T n) (F : Map n m) (hF : CP F) (s : Set T) : + (W.channel F hF).value s=F (W.value s) := channel_entry_value W F s +omit [DecidableEq m] in +lemma channel_traceMeasure (W : PositiveMatrixMeasure T n) (F : Map n m) + (hF : CP F) (hT : TracePreserving F) : (W.channel F hF).traceMeasure=W.traceMeasure := by + apply Measure.ext + intro s hs + apply (ENNReal.toReal_eq_toReal_iff' (measure_ne_top _ _) (measure_ne_top _ _)).mp + change (W.channel F hF).traceMeasure.real s=W.traceMeasure.real s + rw [traceMeasure_real _ hs,traceMeasure_real _ hs,channel_value,hT] +omit [Fintype m] [DecidableEq m] in +lemma channel_entry (F : Map n m) (D : Mat n) (a b : m) : + F D a b=∑ i, ∑ j, D i j*F (Matrix.single i j 1) a b := by + rw [linearMap_entries F D] + simp only [Matrix.sum_apply,Matrix.smul_apply,smul_eq_mul] +omit [Fintype m] [DecidableEq m] in +lemma channel_density_integrable (F : Map n m) {μ : Measure T} (D : T → Mat n) + (hi : ∀ a b, Integrable (fun t => D t a b) μ) (a b : m) : + Integrable (fun t => F (D t) a b) μ := by + have he : (fun t => F (D t) a b)=(fun t => ∑ i, ∑ j, D t i j*F (Matrix.single i j 1) a b) := + funext fun t => channel_entry F (D t) a b + rw [he] + exact integrable_finsetSum _ fun i _ => integrable_finsetSum _ fun j _ => (hi i j).mul_const _ +omit [Fintype m] [DecidableEq m] in +lemma channel_setIntegral (F : Map n m) {μ : Measure T} (D : T → Mat n) + (hi : ∀ a b, Integrable (fun t => D t a b) μ) (s : Set T) (a b : m) : + (∫ t in s, F (D t) a b ∂μ)=F (fun i j => ∫ t in s, D t i j ∂μ) a b := by + have he : (fun t => F (D t) a b)=(fun t => ∑ i, ∑ j, D t i j*F (Matrix.single i j 1) a b) := + funext fun t => channel_entry F (D t) a b + rw [he] + apply Eq.trans ?_ (channel_entry F (Matrix.of fun i j => ∫ t in s, D t i j ∂μ) a b).symm + rw [integral_finsetSum _ (fun i _ => integrable_finsetSum _ (fun j _ => (hi i j).integrableOn.mul_const _))] + apply Finset.sum_congr rfl + intro i _ + rw [integral_finsetSum _ (fun j _ => (hi i j).integrableOn.mul_const _)] + simp only [integral_mul_const,Matrix.of_apply] +omit [DecidableEq m] in +lemma channel_positiveDensity (W : PositiveMatrixMeasure T n) (F : Map n m) + (hF : CP F) (hT : TracePreserving F) {μ : Measure T} [IsFiniteMeasure μ] + (hW : W.traceMeasure≪μ) : + (fun t => F (W.positiveDensity μ t))=ᵐ[μ](W.channel F hF).positiveDensity μ := by + apply (W.channel F hF).density_unique + (by simpa only [channel_traceMeasure W F hF hT] using hW) + · exact channel_density_integrable F _ (W.positiveDensity_integrable hW) + · intro s hs a b + rw [channel_setIntegral F _ (W.positiveDensity_integrable hW),channel_value] + have he : (Matrix.of fun i j => ∫ t in s, W.positiveDensity μ t i j ∂μ)=W.value s := by + ext i j + exact W.positiveDensity_setIntegral hW hs i j + exact congrArg (fun M : Mat n => F M a b) he +end PositiveMatrixMeasure +omit [DecidableEq m] in +lemma bitComparisonMeasure_channel (W : Fin 2 → Fin 2 → PositiveMatrixMeasure T n) + (σ : PositiveMatrixMeasure T n) (F : Map n m) (hF : CP F) (hT : TracePreserving F) : + bitComparisonMeasure (fun i j => (W i j).channel F hF) (σ.channel F hF)=bitComparisonMeasure W σ := by + simp only [bitComparisonMeasure,familyTraceMeasure,PositiveMatrixMeasure.channel_traceMeasure _ F hF hT] +omit [Fintype m] [DecidableEq n] [DecidableEq m] in +lemma measurable_matrix_map (F : Map n m) : Measurable F := by + exact F.continuous_of_finiteDimensional.measurable +omit [MeasurableSpace T] [Fintype n] [DecidableEq n] in +lemma idealDensity_psd (σ : T → Mat n) (hσ : ∀ t, (σ t).PosSemidef) (i j : Fin 2) (t : T) : + (idealDensity σ i j t).PosSemidef := by + unfold idealDensity halfDensity + split_ifs + · exact (hσ t).smul (by rw [Complex.nonneg_iff]; norm_num) + · exact Matrix.PosSemidef.zero +omit [Fintype n] [DecidableEq n] in +lemma idealDensity_measurable (σ : T → Mat n) (hσ : Measurable σ) (i j : Fin 2) : + Measurable (idealDensity σ i j) := by + unfold idealDensity halfDensity + split_ifs + · exact hσ.const_smul (1/2 : ℂ) + · exact measurable_const +omit [DecidableEq n] in +lemma idealDensity_trace_integrable (σ : T → Mat n) {μ : Measure T} + (hσ : Integrable (fun t => (Matrix.trace (σ t)).re) μ) (i j : Fin 2) : + Integrable (fun t => (Matrix.trace (idealDensity σ i j t)).re) μ := by + unfold idealDensity + split_ifs + · simpa only [halfDensity_trace] using hσ.div_const 2 + · simp only [Matrix.trace_zero,Complex.zero_re]; exact integrable_zero _ _ _ +omit [MeasurableSpace T] [Fintype n] [Fintype m] [DecidableEq n] [DecidableEq m] in +lemma channel_idealDensity (F : Map n m) (σ : T → Mat n) (i j : Fin 2) (t : T) : + F (idealDensity σ i j t)=idealDensity (fun t => F (σ t)) i j t := by + unfold idealDensity halfDensity + split_ifs <;> simp only [map_smul,map_zero] + +theorem cqBitDistance_channel (W : Fin 2 → Fin 2 → PositiveMatrixMeasure T n) + (σ : PositiveMatrixMeasure T n) (F : Map n m) (hF : CP F) (hT : TracePreserving F) : + cqBitDistance (fun i j => (W i j).channel F hF) (σ.channel F hF) ≤ cqBitDistance W σ := by + have htr : ∀ A, Matrix.trace (F A)=Matrix.trace A := hT + let μ := bitComparisonMeasure W σ + have hW (i j : Fin 2) := (W i j).channel_positiveDensity F hF hT (bitComparison_actual_dom W σ i j) + have hσ := σ.channel_positiveDensity F hF hT (bitComparison_ideal_dom W σ) + unfold cqBitDistance + rw [bitComparisonMeasure_channel W σ F hF hT, + ← bitDistance_congr_ae hW hσ] + apply Finset.sum_le_sum + intro i _ + apply Finset.sum_le_sum + intro j _ + apply integral_mono + · apply integrable_traceNorm_sub + · exact (measurable_matrix_map F).comp ((W i j).positiveDensity_measurable μ) + · exact idealDensity_measurable _ ((measurable_matrix_map F).comp (σ.positiveDensity_measurable μ)) i j + · intro t; exact cp_positive hF ((W i j).positiveDensity_psd μ t) + · exact idealDensity_psd _ (fun t => cp_positive hF (σ.positiveDensity_psd μ t)) i j + · simpa only [htr] using (W i j).positiveDensity_trace_integrable (bitComparison_actual_dom W σ i j) + · apply idealDensity_trace_integrable + simpa only [htr] using σ.positiveDensity_trace_integrable (bitComparison_ideal_dom W σ) + · apply integrable_traceNorm_sub + · exact (W i j).positiveDensity_measurable μ + · exact idealDensity_measurable _ (σ.positiveDensity_measurable μ) i j + · exact (W i j).positiveDensity_psd μ + · exact idealDensity_psd _ (σ.positiveDensity_psd μ) i j + · exact (W i j).positiveDensity_trace_integrable (bitComparison_actual_dom W σ i j) + · exact idealDensity_trace_integrable _ (σ.positiveDensity_trace_integrable (bitComparison_ideal_dom W σ)) i j + · intro t + dsimp only + rw [← channel_idealDensity F (σ.positiveDensity μ) i j t,← map_sub] + exact traceNorm_cptp F hF hT (((W i j).positiveDensity_psd μ t).isHermitian.sub + (idealDensity_psd _ (σ.positiveDensity_psd μ) i j t).isHermitian) + +end SecretKey + +end + +end OAI diff --git a/lean/OAI/InformationTheory/Entanglement/MatrixPolar.lean b/lean/OAI/InformationTheory/Entanglement/MatrixPolar.lean new file mode 100644 index 0000000000000000000000000000000000000000..a16d84c4a9ad6c0cde90a2ccc9e1daedc40a540e --- /dev/null +++ b/lean/OAI/InformationTheory/Entanglement/MatrixPolar.lean @@ -0,0 +1,72 @@ +import Mathlib + +namespace OAI + +noncomputable section +open scoped MatrixOrder ComplexOrder BigOperators +open Matrix +namespace MatrixPolar + +lemma isometry_factor {V : Type*} [NormedAddCommGroup V] [InnerProductSpace ℂ V] + [FiniteDimensional ℂ V] (f g : V →ₗ[ℂ] V) + (hn : ∀ x, ‖f x‖ = ‖g x‖) : + ∃ U : V →ₗᵢ[ℂ] V, U.toLinearMap.comp g = f := by + have hk : g.ker ≤ f.ker := by + intro x hx + apply LinearMap.mem_ker.mpr + apply norm_eq_zero.mp + rw [hn, LinearMap.mem_ker.mp hx, norm_zero] + let l : g.range →ₗ[ℂ] V := + (g.ker.liftQ f hk).comp g.quotKerEquivRange.symm.toLinearMap + have hl (x : V) : l ⟨g x, LinearMap.mem_range_self g x⟩ = f x := by + simp [l] + have hln (x : g.range) : ‖l x‖ = ‖x‖ := by + rcases x with ⟨x,hx⟩ + obtain ⟨y,rfl⟩ := hx + rw [hl] + exact hn y + let L : g.range →ₗᵢ[ℂ] V := ⟨l,hln⟩ + refine ⟨L.extend,?_⟩ + ext x + change L.extend (g x) = f x + rw [show L.extend (g x) = L ⟨g x, LinearMap.mem_range_self g x⟩ from + L.extend_apply ⟨g x, LinearMap.mem_range_self g x⟩] + exact hl x + +variable {n : Type*} [Fintype n] [DecidableEq n] +lemma gram_inner (A : Matrix n n ℂ) (x y : EuclideanSpace ℂ n) : + inner ℂ (Matrix.toEuclideanLin A x) (Matrix.toEuclideanLin A y) = + inner ℂ x (Matrix.toEuclideanLin (Aᴴ * A) y) := by + rw [Matrix.toLpLin_mul 2 2 2, Matrix.toEuclideanLin_conjTranspose_eq_adjoint] + exact (LinearMap.adjoint_inner_right (Matrix.toEuclideanLin A) x + (Matrix.toEuclideanLin A y)).symm + +lemma sqrt_gram_norm (A : Matrix n n ℂ) (x : EuclideanSpace ℂ n) : + ‖Matrix.toEuclideanLin A x‖ = + ‖Matrix.toEuclideanLin (CFC.sqrt (Aᴴ * A)) x‖ := by + have h : (CFC.sqrt (Aᴴ * A))ᴴ * CFC.sqrt (Aᴴ * A) = Aᴴ * A := by + rw [(Matrix.nonneg_iff_posSemidef.mp (CFC.sqrt_nonneg (Aᴴ * A))).isHermitian.eq] + exact CFC.sqrt_mul_sqrt_self _ (Matrix.posSemidef_conjTranspose_mul_self A).nonneg + apply (sq_eq_sq₀ (norm_nonneg _) (norm_nonneg _)).mp + rw [norm_sq_eq_re_inner (𝕜 := ℂ), norm_sq_eq_re_inner (𝕜 := ℂ), gram_inner, gram_inner, h] + +lemma polar (A : Matrix n n ℂ) : + ∃ U : Matrix n n ℂ, Uᴴ * U = 1 ∧ A = U * CFC.sqrt (Aᴴ * A) := by + obtain ⟨l,hl⟩ := isometry_factor (Matrix.toEuclideanLin A) + (Matrix.toEuclideanLin (CFC.sqrt (Aᴴ * A))) (sqrt_gram_norm A) + let U := Matrix.toEuclideanLin.symm l.toLinearMap + have hU : Matrix.toEuclideanLin U = l.toLinearMap := Matrix.toEuclideanLin.apply_symm_apply _ + refine ⟨U,?_,?_⟩ + · apply Matrix.toEuclideanLin.injective + rw [Matrix.toLpLin_mul 2 2 2, Matrix.toEuclideanLin_conjTranspose_eq_adjoint, + hU, Matrix.toLpLin_one] + exact l.adjoint_comp_self' + · apply Matrix.toEuclideanLin.injective + rw [Matrix.toLpLin_mul 2 2 2, hU] + exact hl.symm + +end MatrixPolar + +end + +end OAI diff --git a/lean/OAI/InformationTheory/Entanglement/MatrixTraceMeasure.lean b/lean/OAI/InformationTheory/Entanglement/MatrixTraceMeasure.lean new file mode 100644 index 0000000000000000000000000000000000000000..bdac781e5e8f9857191d629f9c3ec3b91ee7bf6a --- /dev/null +++ b/lean/OAI/InformationTheory/Entanglement/MatrixTraceMeasure.lean @@ -0,0 +1,86 @@ +import OAI.InformationTheory.Entanglement.DensityPositivity + +namespace OAI + +noncomputable section +open scoped BigOperators ComplexOrder MatrixOrder ENNReal MeasureTheory Matrix.Norms.L2Operator +open Matrix MeasureTheory Filter +attribute [local instance] Classical.propDecidable +namespace SecretKey +open ChannelCompletion +variable {Ω : Type*} [MeasurableSpace Ω] {n : Type} [Fintype n] +namespace PositiveMatrixMeasure +variable (W : PositiveMatrixMeasure Ω n) +def traceSigned : SignedMeasure Ω := ComplexMeasure.re (∑ i, W.entry i i) +lemma traceSigned_apply (s : Set Ω) : W.traceSigned s=(Matrix.trace (W.value s)).re := by + change ((∑ i, W.entry i i) s).re=_ + simp only [_root_.sum_apply,value,Matrix.trace,Matrix.diag] +lemma traceSigned_nonneg : 0 ≤[Set.univ] W.traceSigned := by + apply VectorMeasure.restrict_le_restrict_of_subset_le + intro s hs _ + change 0≤W.traceSigned s + rw [W.traceSigned_apply] + exact + (Complex.nonneg_iff.mp (W.positive s hs).trace_nonneg).1 + +def traceMeasure : Measure Ω := + W.traceSigned.toMeasureOfZeroLE Set.univ MeasurableSet.univ W.traceSigned_nonneg +instance : IsFiniteMeasure W.traceMeasure := SignedMeasure.toMeasureOfZeroLE_finite _ _ _ +lemma traceMeasure_real {s : Set Ω} (hs : MeasurableSet s) : + W.traceMeasure.real s=(Matrix.trace (W.value s)).re := by + rw [traceMeasure,SignedMeasure.toMeasureOfZeroLE_real_apply _ _ _ hs,Set.univ_inter, + W.traceSigned_apply] +lemma trace_domination {μ : Measure Ω} (h : W.traceMeasure≪μ) : + ∀ s, MeasurableSet s → μ s=0 → (Matrix.trace (W.value s)).re=0 := by + intro s hs hz + rw [← W.traceMeasure_real hs,measureReal_def,h hz,ENNReal.toReal_zero] + +def positiveDensity (μ : Measure Ω) (x : Ω) : Mat n := + if (W.density μ x).PosSemidef then W.density μ x else 0 +lemma positiveDensity_psd (μ : Measure Ω) (x : Ω) : (W.positiveDensity μ x).PosSemidef := by + unfold positiveDensity + split + · assumption + · exact Matrix.PosSemidef.zero +lemma positiveDensity_measurable [DecidableEq n] (μ : Measure Ω) : + Measurable (W.positiveDensity μ) := by + apply (W.density_measurable (μ := μ)).ite _ measurable_const + simpa only [Matrix.nonneg_iff_posSemidef] using + measurableSet_le (show Measurable (fun _ : Ω => (0 : Mat n)) from measurable_const) + (W.density_measurable (μ := μ)) +lemma positiveDensity_ae_eq {μ : Measure Ω} [SigmaFinite μ] (h : W.traceMeasure≪μ) : + W.positiveDensity μ=ᵐ[μ] W.density μ := by + filter_upwards [W.density_ae_psd (W.trace_domination h)] with x hx + exact ite_eq_left hx +lemma positiveDensity_integrable {μ : Measure Ω} [SigmaFinite μ] (h : W.traceMeasure≪μ) + (i j : n) : Integrable (fun x => W.positiveDensity μ x i j) μ := by + refine (W.density_integrable i j).congr ?_ + filter_upwards [W.positiveDensity_ae_eq h] with x hx + exact (congrArg (fun M : Mat n => M i j) hx).symm +lemma positiveDensity_setIntegral {μ : Measure Ω} [SigmaFinite μ] (h : W.traceMeasure≪μ) + {s : Set Ω} (hs : MeasurableSet s) (i j : n) : + (∫ x in s, W.positiveDensity μ x i j ∂μ)=W.value s i j := by + rw [integral_congr_ae (ae_restrict_of_ae (W.positiveDensity_ae_eq h |>.mono + (fun x hx => congrArg (fun M : Mat n => M i j) hx)))] + exact W.density_setIntegral (W.trace_domination h) hs i j +lemma positiveDensity_trace_integrable {μ : Measure Ω} [SigmaFinite μ] (h : W.traceMeasure≪μ) : + Integrable (fun x => (Matrix.trace (W.positiveDensity μ x)).re) μ := by + exact (integrable_finsetSum _ fun i _ => W.positiveDensity_integrable h i i).re +lemma positiveDensity_trace_setIntegral {μ : Measure Ω} [SigmaFinite μ] (h : W.traceMeasure≪μ) + {s : Set Ω} (hs : MeasurableSet s) : + (∫ x in s, (Matrix.trace (W.positiveDensity μ x)).re ∂μ)=W.traceMeasure.real s := by + rw [W.traceMeasure_real hs] + change (∫ x in s, RCLike.re (Matrix.trace (W.positiveDensity μ x)) ∂μ)=_ + have hi : Integrable (fun x => Matrix.trace (W.positiveDensity μ x)) μ := + integrable_finsetSum Finset.univ (fun i _ => W.positiveDensity_integrable h i i) + rw [integral_re hi.integrableOn] + exact congrArg Complex.re ((integral_finsetSum Finset.univ + (fun i _ => (W.positiveDensity_integrable h i i).integrableOn)).trans + (Finset.sum_congr rfl (fun i _ => W.positiveDensity_setIntegral h hs i i))) +end PositiveMatrixMeasure + +end SecretKey + +end + +end OAI diff --git a/lean/OAI/InformationTheory/Entanglement/MultiTensor.lean b/lean/OAI/InformationTheory/Entanglement/MultiTensor.lean new file mode 100644 index 0000000000000000000000000000000000000000..078710cc412baca1d92c07b462ee248f714a2ae3 --- /dev/null +++ b/lean/OAI/InformationTheory/Entanglement/MultiTensor.lean @@ -0,0 +1,84 @@ +import OAI.InformationTheory.Entanglement.ProjectionData + +namespace OAI + +noncomputable section +open scoped BigOperators +open Matrix +namespace FiniteConstruction +open ChannelCompletion +variable {S V A : Type} [Fintype S] [Fintype V] [Fintype A] + [DecidableEq S] [DecidableEq V] + +def multiTensor (M : S → Mat V) : Mat (S → V) := fun i j => ∏ s, M s (i s) (j s) +omit [DecidableEq V] in +lemma multiTensor_mul (M N : S → Mat V) : + multiTensor M*multiTensor N=multiTensor (fun s => M s*N s) := by + ext i j + simp only [Matrix.mul_apply,multiTensor,← Finset.prod_mul_distrib] + exact (Fintype.prod_sum (fun s : S => fun k : V => M s (i s) k*N s k (j s))).symm +omit [Fintype V] [DecidableEq S] in +lemma multiTensor_one : multiTensor (fun _ : S => (1 : Mat V))=1 := by + ext i j + simp only [multiTensor,Matrix.one_apply] + rw [Fintype.prod_boole] + simp only [funext_iff] +omit [Fintype V] [DecidableEq S] [DecidableEq V] in +lemma multiTensor_zero_of (M : S → Mat V) (s : S) (hs : M s=0) : multiTensor M=0 := by + ext i j + change (∏ t, M t (i t) (j t))=0 + exact Finset.prod_eq_zero (Finset.mem_univ s) (by rw [hs]; rfl) +omit [Fintype V] [DecidableEq S] [DecidableEq V] in +lemma multiTensor_adjoint (M : S → Mat V) : + (multiTensor M)ᴴ=multiTensor (fun s => (M s)ᴴ) := by + ext i j + simp [multiTensor,Matrix.conjTranspose_apply] +omit [Fintype V] [DecidableEq S] [DecidableEq V] in +lemma multiTensor_hermitian (M : S → Mat V) (hM : ∀ s, (M s).IsHermitian) : + (multiTensor M).IsHermitian := by + rw [Matrix.IsHermitian,multiTensor_adjoint] + simp_rw [(hM _).eq] +omit [DecidableEq V] in +lemma multiTensor_idempotent (M : S → Mat V) (hM : ∀ s, M s*M s=M s) : + multiTensor M*multiTensor M=multiTensor M := by + rw [multiTensor_mul] + simp_rw [hM] +omit [DecidableEq V] in +lemma multiTensor_commute (M N : S → Mat V) (h : ∀ s, M s*N s=N s*M s) : + multiTensor M*multiTensor N=multiTensor N*multiTensor M := by + rw [multiTensor_mul,multiTensor_mul] + simp_rw [h] +omit [DecidableEq V] in +lemma multiTensor_trace (M : S → Mat V) : + Matrix.trace (multiTensor M)=∏ s, Matrix.trace (M s) := by + change (∑ i : S → V, ∏ s, M s (i s) (i s))=∏ s, ∑ i, M s i i + exact (Fintype.prod_sum (fun s : S => fun i : V => M s i i)).symm +omit [Fintype V] [DecidableEq V] in +lemma multiTensor_sum (M : S → A → Mat V) : + (∑ a : S → A, multiTensor (fun s => M s (a s)))= + multiTensor (fun s => ∑ a, M s a) := by + ext i j + simp only [Matrix.sum_apply,multiTensor] + exact (Fintype.prod_sum (fun s : S => fun a : A => M s a (i s) (j s))).symm +omit [Fintype V] in +lemma multiTensor_complete (M : S → A → Mat V) (hM : ∀ s, ∑ a, M s a=1) : + (∑ a : S → A, multiTensor (fun s => M s (a s)))=1 := by + rw [multiTensor_sum] + simp only [hM,multiTensor_one] +omit [Fintype A] [DecidableEq V] in +lemma multiTensor_orthogonal (M : S → A → Mat V) + (hM : ∀ s a b, a ≠ b → M s a*M s b=0) + (a b : S → A) (hab : a ≠ b) : + multiTensor (fun s => M s (a s))*multiTensor (fun s => M s (b s))=0 := by + rw [multiTensor_mul] + obtain ⟨s,hs⟩ := Function.ne_iff.mp hab + exact multiTensor_zero_of _ s (hM s _ _ hs) +omit [DecidableEq V] in +lemma multiTensor_trace_mul (M N : S → Mat V) : + Matrix.trace (multiTensor M*multiTensor N)=∏ s, Matrix.trace (M s*N s) := by + rw [multiTensor_mul,multiTensor_trace] +end FiniteConstruction + +end + +end OAI diff --git a/lean/OAI/InformationTheory/Entanglement/NormalizeRepresentation.lean b/lean/OAI/InformationTheory/Entanglement/NormalizeRepresentation.lean new file mode 100644 index 0000000000000000000000000000000000000000..c6fbad45385088dedab2558db46ace91753662ef --- /dev/null +++ b/lean/OAI/InformationTheory/Entanglement/NormalizeRepresentation.lean @@ -0,0 +1,66 @@ +import OAI.InformationTheory.Entanglement.TensorTools +import OAI.InformationTheory.Entanglement.EffectNormalization + +namespace OAI + +noncomputable section +open scoped BigOperators ComplexOrder MatrixOrder Kronecker +open Matrix +namespace SecretKey +open ChannelCompletion TensorCriterion +variable {n m p q : Type} [Fintype n] [Fintype m] [Fintype p] [Fintype q] + [DecidableEq n] [DecidableEq m] [DecidableEq p] [DecidableEq q] + +lemma ad_one : ad (1 : Mat n)=LinearMap.id := by + ext A i j + simp [ad_apply] + +omit [DecidableEq p] [DecidableEq q] in +lemma tensorMap_ad_left (F : Map n p) (G : Map m q) (S : Mat n) : + tensorMap (F.comp (ad S)) G=(tensorMap F G).comp (ad (S ⊗ₖ (1 : Mat m))) := by + rw [← tensorMap_ad,ad_one,tensorMap_comp] + simp + +omit [Fintype p] [DecidableEq n] [DecidableEq p] in +lemma cp_ad_input_transpose {F : Map n p} (hFT : CP (F.comp transposeMap)) (S : Mat n) : + CP ((F.comp (ad S)).comp transposeMap) := by + have he : (ad S).comp transposeMap = transposeMap.comp (ad (Sᴴ)ᵀ) := by + have hs : ((Sᴴ)ᵀ)ᴴ=Sᵀ := by + ext i j + simp [Matrix.conjTranspose_apply] + ext A i j + simp only [LinearMap.comp_apply,transposeMap_apply,ad_apply,hs, + Matrix.transpose_mul,Matrix.transpose_transpose,Matrix.mul_assoc] + rw [LinearMap.comp_assoc,he,← LinearMap.comp_assoc] + exact cp_comp hFT (cp_ad _) + +omit [DecidableEq q] in +lemma normalized_representation (R : Mat (p × q)) (hR : Represented R) + (X : Fin 2 → Mat p) (hX : ∀ i, (X i).PosSemidef) : + ∃ r s : ℕ, 0 d • x i) A=hilbertEmbed x ((d*star d) • A) := by + ext u + rw [hilbertEmbed_apply,hilbertEmbed_apply] + apply Finset.sum_congr rfl; intro i hi + apply Finset.sum_congr rfl; intro j hj + simp only [inner_smul_left,smul_smul,Matrix.smul_apply,smul_eq_mul] + congr 1 + simp only [starRingEnd_apply] + ring +omit [DecidableEq n] in +lemma hilbertEmbed_normalized_filter {H : Type*} [NormedAddCommGroup H] + [InnerProductSpace ℂ H] [CompleteSpace H] (x : n→H) (A : Mat n) : + hilbertEmbed (fun i => (Real.sqrt (Fintype.card n : ℝ) : ℂ) • x i) A= + hilbertEmbed x ((Fintype.card n : ℂ) • A) := by + rw [hilbertEmbed_smul_vectors,Complex.star_def,Complex.conj_ofReal, + FiniteInputInstrument.sqrt_card_mul] + +theorem normalized_purification_tested_gap + {Ω : Type*} {mΩ : MeasurableSpace Ω} [StandardBorelSpace Ω] + (ν : Measure Ω) [IsFiniteMeasure ν] (t : Ω→T) (ht : Measurable t) + {A B : MeasurableSpace Ω} (hA : A ≤ mΩ) (hB : B ≤ mΩ) + (hind : CondIndep (MeasurableSpace.comap t inferInstance) A B ht.comap_le ν) + (a : Fin 2→Option (PositiveTestIndex n)→Set Ω) + (q : Fin 2→Option (PositiveTestIndex m)→Set Ω) + (ha : ∀ i r, MeasurableSet[A] (a i r)) (hq : ∀ j s, MeasurableSet[B] (q j s)) + (M : Fin 2→Fin 2→PositiveMatrixMeasure T (n×m)) + (hdom : ∀ i j, (M i j).traceMeasure ≪ (@Measure.map Ω T mΩ _ t ν)) + (hleft : ∀ i r s, MeasurableSet s → + (∑ j, (Matrix.trace ((probePOVM r ⊗ₖ (1 : Mat m))*(M i j).value s)).re)= + ν.real (a i r∩t⁻¹' s)) + (hright : ∀ j g s, MeasurableSet s → + (∑ i, (Matrix.trace (((1 : Mat n) ⊗ₖ probePOVM g)*(M i j).value s)).re)= + ν.real (q j g∩t⁻¹' s)) + (hjoint : ∀ i j r g s, MeasurableSet s → + (Matrix.trace ((probePOVM r ⊗ₖ probePOVM g)*(M i j).value s)).re= + ν.real ((a i r∩q j g)∩t⁻¹' s)) + {H : Type*} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + {ι : Type*} (b : HilbertBasis ι ℂ H) + (R : Mat (n×m)) (hR : Represented R) (i₀ : n×m) + (x : (n×m)→H) (hxGram : ∀ i j, inner ℂ (x i) (x j)=Rᵀ i j) + (W : Fin 2→Fin 2→PositiveHilbertMeasure T H b) + (hW : ∀ i j s, MeasurableSet s → (W i j).value s= + hilbertEmbed (fun k => (Real.sqrt ((Fintype.card n : ℝ)*Fintype.card m) : ℂ) • x k) + ((M i j).value s)) + (hW1 : (∑ i, ∑ j, hilbertTrace b ((W i j).value Set.univ))=1) + (σ : PositiveHilbertMeasure T H b) (hσ1 : σ.traceMeasure Set.univ=1) : + ENNReal.ofReal (1/5) ≤ hilbertCQDistance b W σ := by + let c : ℝ≥0 := Fintype.card (n×m) + let N := fun i j => (M i j).scale (c : ℝ) (NNReal.coe_nonneg c) + apply arbitrary_purification_tested_gap (c•ν) t ht hA hB + (condIndep_rescale ht.comap_le hA hB hind c) a q ha hq N + ?_ ?_ ?_ ?_ b R hR i₀ x hxGram W ?_ hW1 σ hσ1 + · intro i j + rw [Measure.map_smul c ht.aemeasurable] + exact (M i j).scale_domination (hdom i j) c + · intro i r s hs + simp only [N,PositiveMatrixMeasure.scale_born,← Finset.mul_sum, + hleft i r s hs,measureReal_nnreal_smul_apply] + · intro j g s hs + simp only [N,PositiveMatrixMeasure.scale_born,← Finset.mul_sum, + hright j g s hs,measureReal_nnreal_smul_apply] + · intro i j r g s hs + simp only [N,PositiveMatrixMeasure.scale_born,hjoint i j r g s hs, + measureReal_nnreal_smul_apply] + · intro i j s hs + rw [hW i j s hs] + have he : (Real.sqrt ((Fintype.card n : ℝ)*Fintype.card m) : ℂ)= + (Real.sqrt (Fintype.card (n×m) : ℝ) : ℂ) := by + simp only [Fintype.card_prod,Nat.cast_mul] + rw [he,hilbertEmbed_normalized_filter] + rfl + +end SecretKey + +end + +end OAI diff --git a/lean/OAI/InformationTheory/Entanglement/OperationalNorm.lean b/lean/OAI/InformationTheory/Entanglement/OperationalNorm.lean new file mode 100644 index 0000000000000000000000000000000000000000..04955a8965434b65b8db0fad61a6ab4ab34d1995 --- /dev/null +++ b/lean/OAI/InformationTheory/Entanglement/OperationalNorm.lean @@ -0,0 +1,56 @@ +import Mathlib + +namespace OAI + +noncomputable section +open Filter +open scoped Topology +namespace SecretKey + +theorem recovered_gap_limit {E : Type*} [SeminormedAddCommGroup E] + {D : ℕ → Type*} [∀ k, SeminormedAddCommGroup (D k)] + (τ : ℕ → E) (τlim γ : E) (original : (k : ℕ) → D k) + (recover : (k : ℕ) → E → D k) + (hrec : ∀ k, recover k (τ k)=original k) + (hcontract : ∀ k x y, ‖recover k x-recover k y‖≤‖x-y‖) + (hgap : ∀ k, 1/5≤‖original k-recover k γ‖) + (hlim : Tendsto τ atTop (𝓝 τlim)) : 1/5≤‖τlim-γ‖ := by + have ht : Tendsto (fun k => ‖τ k-γ‖) atTop (𝓝 ‖τlim-γ‖) := + (hlim.sub tendsto_const_nhds).norm + apply ge_of_tendsto ht + exact Filter.Eventually.of_forall fun k => (hgap k).trans (by simpa only [hrec] using hcontract k (τ k) γ) + +theorem abort_replacement_bound {E : Type*} [SeminormedAddCommGroup E] [NormedSpace ℝ E] + (δ : ℝ) (hδ0 : 0≤δ) (hδ1 : δ≤1) (ok bad γ : E) + (hstates : ‖bad-γ‖≤2) : + ‖((1-δ) • ok+δ • bad)-γ‖≤(1-δ)*‖ok-γ‖+2*δ := by + have he : ((1-δ) • ok+δ • bad)-γ=(1-δ) • (ok-γ)+δ • (bad-γ) := by + module + rw [he] + calc + _≤‖(1-δ) • (ok-γ)‖+‖δ • (bad-γ)‖ := norm_add_le _ _ + _=(1-δ)*‖ok-γ‖+δ*‖bad-γ‖ := by + rw [norm_smul,norm_smul,Real.norm_eq_abs,Real.norm_eq_abs, + abs_of_nonneg (sub_nonneg.mpr hδ1),abs_of_nonneg hδ0] + _≤(1-δ)*‖ok-γ‖+2*δ := by nlinarith + +theorem vanishing_abort_contradicts_gap (δ error replaced : ℕ → ℝ) + (hδ0 : ∀ k, 0≤δ k) (hδ1 : ∀ k, δ k≤1) (he0 : ∀ k, 0≤error k) + (hbound : ∀ k, replaced k≤(1-δ k)*error k+2*δ k) + (hgap : ∀ k, 1/5≤replaced k) + (hδ : Tendsto δ atTop (𝓝 0)) (he : Tendsto error atTop (𝓝 0)) : False := by + have herror : Tendsto (fun k => (1-δ k)*error k) atTop (𝓝 0) := + squeeze_zero + (fun k => mul_nonneg (sub_nonneg.mpr (hδ1 k)) (he0 k)) + (fun k => mul_le_of_le_one_left (he0 k) (sub_le_self _ (hδ0 k))) he + have ht : Tendsto (fun k => (1-δ k)*error k+2*δ k) atTop (𝓝 0) := by + simpa using herror.add (hδ.const_mul 2) + have hh : (1:ℝ)/5≤0 := ge_of_tendsto ht + (Filter.Eventually.of_forall fun k => (hgap k).trans (hbound k)) + norm_num at hh + +end SecretKey + +end + +end OAI diff --git a/lean/OAI/InformationTheory/Entanglement/ParityData.lean b/lean/OAI/InformationTheory/Entanglement/ParityData.lean new file mode 100644 index 0000000000000000000000000000000000000000..c26ab308b6322c117004b1d744ad551196680fde --- /dev/null +++ b/lean/OAI/InformationTheory/Entanglement/ParityData.lean @@ -0,0 +1,53 @@ +import OAI.InformationTheory.Entanglement.ProjectionData + +namespace OAI + +noncomputable section +open scoped BigOperators Kronecker +open Matrix +namespace FiniteConstruction +open ChannelCompletion +abbrev Four := Fin 2 × Fin 2 +abbrev Outcome := Fin 2 × Fin 2 +def XQ : Matrix (Fin 2) (Fin 2) ℚ := !![0,1;1,0] +def ZQ : Matrix (Fin 2) (Fin 2) ℚ := !![1,0;0,-1] +def JQ : Matrix (Fin 2) (Fin 2) ℚ := !![0,-1;1,0] +def squareQ : Fin 3 → Fin 3 → Matrix Four Four ℚ := + ![![XQ ⊗ₖ 1,1 ⊗ₖ XQ,XQ ⊗ₖ XQ], + ![1 ⊗ₖ ZQ,ZQ ⊗ₖ 1,ZQ ⊗ₖ ZQ], + ![XQ ⊗ₖ ZQ,ZQ ⊗ₖ XQ,-(JQ ⊗ₖ JQ)]] +def contextQ : Fin 6 → Fin 3 → Matrix Four Four ℚ := + ![squareQ 0,squareQ 1,squareQ 2, + (fun i => squareQ i 0),(fun i => squareQ i 1),(fun i => squareQ i 2)] +def signQ (i : Fin 2) : ℚ := if i=0 then -1 else 1 +def eQ (t : Fin 6) : ℚ := if t=5 then -1 else 1 +def hQ (t : Fin 6) (a : Outcome) : Matrix Four Four ℚ := + (1/4 : ℚ) • ((1+signQ a.1 • contextQ t 0)*(1+signQ a.2 • contextQ t 1)) +def eigSignQ (t : Fin 6) (a : Outcome) : Fin 3 → ℚ := + ![signQ a.1,signQ a.2,eQ t*signQ a.1*signQ a.2] + +lemma hQ_symmetric (t : Fin 6) (a : Outcome) : (hQ t a)ᵀ=hQ t a := by + revert t a + decide +kernel +lemma hQ_idempotent (t : Fin 6) (a : Outcome) : hQ t a*hQ t a=hQ t a := by + revert t a + decide +kernel +lemma hQ_orthogonal (t : Fin 6) (a b : Outcome) (hab : a ≠ b) : hQ t a*hQ t b=0 := by + revert t a b + decide +kernel +lemma hQ_complete (t : Fin 6) : ∑ a, hQ t a=1 := by + revert t + decide +kernel +lemma hQ_eigen (t : Fin 6) (a : Outcome) (j : Fin 3) : + contextQ t j*hQ t a=eigSignQ t a j • hQ t a := by + revert t a j + decide +kernel + +def h (t : Fin 6) (a : Outcome) : Mat Four := (hQ t a).map (Rat.castHom ℂ) +def context (t : Fin 6) (j : Fin 3) : Mat Four := (contextQ t j).map (Rat.castHom ℂ) +def eigSign (t : Fin 6) (a : Outcome) (j : Fin 3) : ℂ := eigSignQ t a j +end FiniteConstruction + +end + +end OAI diff --git a/lean/OAI/InformationTheory/Entanglement/ParityObstruction.lean b/lean/OAI/InformationTheory/Entanglement/ParityObstruction.lean new file mode 100644 index 0000000000000000000000000000000000000000..6034576a7321eb66a7ae156358694a166ec9f4ef --- /dev/null +++ b/lean/OAI/InformationTheory/Entanglement/ParityObstruction.lean @@ -0,0 +1,117 @@ +import OAI.InformationTheory.Entanglement.ParityData + +namespace OAI + +noncomputable section +open scoped BigOperators Kronecker +open Matrix +namespace FiniteConstruction +open ChannelCompletion +lemma ratMatrix_smul (c : ℚ) (A : Matrix Four Four ℚ) : + (c • A).map (Rat.castHom ℂ)=(c : ℂ) • A.map (Rat.castHom ℂ) := by + ext i j + simp +lemma h_real (t : Fin 6) (a : Outcome) (i j : Four) : star (h t a i j)=h t a i j := by + simp [h] +lemma h_hermitian (t : Fin 6) (a : Outcome) : (h t a).IsHermitian := by + ext i j + rw [Matrix.conjTranspose_apply,h_real] + exact congrArg (fun A : Matrix Four Four ℚ => ((A i j : ℚ) : ℂ)) (hQ_symmetric t a) +lemma h_idempotent (t : Fin 6) (a : Outcome) : h t a*h t a=h t a := by + simpa only [Matrix.map_mul,h] using congrArg (fun A : Matrix Four Four ℚ => A.map (Rat.castHom ℂ)) (hQ_idempotent t a) +lemma h_orthogonal (t : Fin 6) (a b : Outcome) (hab : a ≠ b) : h t a*h t b=0 := by + unfold h + rw [← Matrix.map_mul,hQ_orthogonal t a b hab] + ext i j + simp +lemma h_complete (t : Fin 6) : ∑ a, h t a=1 := by + ext i j + have he := congrArg (fun A : Matrix Four Four ℚ => ((A i j : ℚ) : ℂ)) (hQ_complete t) + by_cases hij : i=j <;> simpa [h,Matrix.sum_apply,Matrix.one_apply,hij] using he +lemma h_eigen (t : Fin 6) (a : Outcome) (j : Fin 3) : + context t j*h t a=eigSign t a j • h t a := by + simpa only [Matrix.map_mul,ratMatrix_smul,h,context,eigSign] using + congrArg (fun A : Matrix Four Four ℚ => A.map (Rat.castHom ℂ)) (hQ_eigen t a j) +lemma contextQ_symmetric (t : Fin 6) (j : Fin 3) : (contextQ t j)ᵀ=contextQ t j := by + revert t j + decide +kernel +lemma context_hermitian (t : Fin 6) (j : Fin 3) : (context t j).IsHermitian := by + ext i k + change star ((contextQ t j k i : ℚ) : ℂ)=((contextQ t j i k : ℚ) : ℂ) + simp only [star_ratCast] + exact congrArg (fun A : Matrix Four Four ℚ => ((A i k : ℚ) : ℂ)) (contextQ_symmetric t j) +lemma h_eigen_right (t : Fin 6) (a : Outcome) (j : Fin 3) : + h t a*context t j=eigSign t a j • h t a := by + have he := congrArg Matrix.conjTranspose (h_eigen t a j) + simpa only [Matrix.conjTranspose_mul,(h_hermitian t a).eq,(context_hermitian t j).eq, + Matrix.conjTranspose_smul,eigSign,star_ratCast] using he +lemma shared_context (r c : Fin 3) : context (Fin.castLE (by decide) r) c= + context ⟨3+c.val,by omega⟩ r := by + have he : contextQ (Fin.castLE (by decide) r) c = contextQ ⟨3+c.val,by omega⟩ r := by + revert r c + decide +kernel + exact congrArg (fun A : Matrix Four Four ℚ => A.map (Rat.castHom ℂ)) he +lemma eigSignQ_product (t : Fin 6) (a : Outcome) : + eigSignQ t a 0*eigSignQ t a 1*eigSignQ t a 2=eQ t := by + revert t a + decide +kernel +lemma eigSign_product (t : Fin 6) (a : Outcome) : + eigSign t a 0*eigSign t a 1*eigSign t a 2=(eQ t : ℂ) := by + unfold eigSign + exact_mod_cast eigSignQ_product t a + +theorem parity_zero_product (a : Fin 6 → Outcome) : + ∃ t u : Fin 6, t ≠ u ∧ h t (a t)*h u (a u)=0 := by + by_contra hn + push Not at hn + have consistent (r c : Fin 3) : + eigSign (Fin.castLE (by decide) r) (a (Fin.castLE (by decide) r)) c= + eigSign ⟨3+c.val,by omega⟩ (a ⟨3+c.val,by omega⟩) r := by + let t : Fin 6 := Fin.castLE (by decide) r + let u : Fin 6 := ⟨3+c.val,by omega⟩ + have hne : t ≠ u := by intro he; have := congrArg Fin.val he; dsimp [t,u] at this; omega + have he : (eigSign t (a t) c-eigSign u (a u) r) • (h t (a t)*h u (a u))=0 := by + rw [sub_smul,← Matrix.smul_mul,← h_eigen_right,Matrix.mul_assoc, + shared_context, h_eigen, Matrix.mul_smul,sub_self] + exact sub_eq_zero.mp ((smul_eq_zero.mp he).resolve_right (hn t u hne)) + have row : + (eigSign 0 (a 0) 0*eigSign 0 (a 0) 1*eigSign 0 (a 0) 2)* + (eigSign 1 (a 1) 0*eigSign 1 (a 1) 1*eigSign 1 (a 1) 2)* + (eigSign 2 (a 2) 0*eigSign 2 (a 2) 1*eigSign 2 (a 2) 2)=1 := by + rw [eigSign_product,eigSign_product,eigSign_product] + norm_num [eQ,Fin.ext_iff] + have col : + (eigSign 3 (a 3) 0*eigSign 3 (a 3) 1*eigSign 3 (a 3) 2)* + (eigSign 4 (a 4) 0*eigSign 4 (a 4) 1*eigSign 4 (a 4) 2)* + (eigSign 5 (a 5) 0*eigSign 5 (a 5) 1*eigSign 5 (a 5) 2)=-1 := by + rw [eigSign_product,eigSign_product,eigSign_product] + norm_num [eQ,Fin.ext_iff] + have hc0 (r : Fin 3) := consistent r 0 + have hc1 (r : Fin 3) := consistent r 1 + have hc2 (r : Fin 3) := consistent r 2 + simp only [show (⟨3+(0:Fin 3).val,by omega⟩ : Fin 6)=3 by rfl] at hc0 + simp only [show (⟨3+(1:Fin 3).val,by omega⟩ : Fin 6)=4 by rfl] at hc1 + simp only [show (⟨3+(2:Fin 3).val,by omega⟩ : Fin 6)=5 by rfl] at hc2 + have h00 := hc0 0 + have h01 := hc1 0 + have h02 := hc2 0 + have h10 := hc0 1 + have h11 := hc1 1 + have h12 := hc2 1 + have h20 := hc0 2 + have h21 := hc1 2 + have h22 := hc2 2 + have ce0 : Fin.castLE (show 3≤6 by decide) (0:Fin 3)=(0:Fin 6) := by decide + have ce1 : Fin.castLE (show 3≤6 by decide) (1:Fin 3)=(1:Fin 6) := by decide + have ce2 : Fin.castLE (show 3≤6 by decide) (2:Fin 3)=(2:Fin 6) := by decide + simp only [ce0,ce1,ce2] at h00 h01 h02 h10 h11 h12 h20 h21 h22 + rw [h00,h01,h02,h10,h11,h12,h20,h21,h22] at row + have he : (2:ℂ)=0 := by + linear_combination -row+col + norm_num at he + +end FiniteConstruction + +end + +end OAI diff --git a/lean/OAI/InformationTheory/Entanglement/PhysicalAdaptiveStep.lean b/lean/OAI/InformationTheory/Entanglement/PhysicalAdaptiveStep.lean new file mode 100644 index 0000000000000000000000000000000000000000..fa5084bcfc51e04fb9d74363eeac3691f310a638 --- /dev/null +++ b/lean/OAI/InformationTheory/Entanglement/PhysicalAdaptiveStep.lean @@ -0,0 +1,88 @@ +import OAI.InformationTheory.Entanglement.PhysicalVersion + +namespace OAI + +noncomputable section +open scoped InnerProductSpace ComplexOrder MeasureTheory +open ContinuousLinearMap MeasureTheory ProbabilityTheory Filter +namespace SecretKey +variable {H K L : Type*} + [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + [NormedAddCommGroup K] [InnerProductSpace ℂ K] [CompleteSpace K] + [NormedAddCommGroup L] [InnerProductSpace ℂ L] [CompleteSpace L] +variable {ι κ υ S X : Type*} [MeasurableSpace S] [MeasurableSpace X] + +theorem physical_history_kernel_eq (b : HilbertBasis ι ℂ H) (c : HilbertBasis κ ℂ K) + (d : HilbertBasis υ ℂ L) (J : S→TraceInstrument b c X) + (G : S→TraceInstrument (tensorHilbertBasis b d) (tensorHilbertBasis c d) X) + (hG : ∀ h s, MeasurableSet s → IsLeftTraceAction b c d ((J h).event s) ((G h).event s)) + (ρ : S→DensityOperator b) (σ : S→DensityOperator d) + (R : S→DensityOperator (tensorHilbertBasis b d)) + (μ : Measure S) + (hR : R=ᵐ[μ](fun h => densityTensor b d (ρ h) (σ h))) + (hm : ∀ V, MeasurableSet V → Measurable (fun h => (J h).outcome (ρ h) V)) + (hmg : ∀ V, MeasurableSet V → Measurable (fun h => (G h).outcome (R h) V)) : + TraceInstrument.historyKernel G R hmg=ᵐ[μ]TraceInstrument.historyKernel J ρ hm := by + filter_upwards [hR] with h hh + change (G h).outcome (R h)=(J h).outcome (ρ h) + rw [hh] + exact physical_product_outcome b c d (J h) (G h) (hG h) (ρ h) (σ h) + +theorem physical_adaptive_prefix (b : HilbertBasis ι ℂ H) (c : HilbertBasis κ ℂ K) + (d : HilbertBasis υ ℂ L) (J : S→TraceInstrument b c X) + (G : S→TraceInstrument (tensorHilbertBasis b d) (tensorHilbertBasis c d) X) + (hG : ∀ h s, MeasurableSet s → IsLeftTraceAction b c d ((J h).event s) ((G h).event s)) + (ρ : S→DensityOperator b) (σ : S→DensityOperator d) + (R : S→DensityOperator (tensorHilbertBasis b d)) + (μ : Measure S) [IsProbabilityMeasure μ] + (hR : R=ᵐ[μ](fun h => densityTensor b d (ρ h) (σ h))) + (hm : ∀ V, MeasurableSet V → Measurable (fun h => (J h).outcome (ρ h) V)) + (hmg : ∀ V, MeasurableSet V → Measurable (fun h => (G h).outcome (R h) V)) + (U : ∀ h, (G h).ConditionalUpdate (R h)) + (V : ∀ h, (J h).ConditionalUpdate (ρ h)) + (hf : ∀ x y, Measurable (fun p : S×X => inner ℂ x (((U p.1).state p.2).val.val y))) + (hp : ∀ x y, Measurable (fun p : S×X => inner ℂ x + ((densityTensor c d ((V p.1).state p.2) (σ p.1)).val.val y))) + (T : DensityOperator (tensorHilbertBasis c d)) + (hmean : ∀ x y, inner ℂ x (T.val.val y)=∫ p, inner ℂ x (((U p.1).state p.2).val.val y) + ∂(μ ⊗ₘ TraceInstrument.historyKernel G R hmg)) : + (μ ⊗ₘ TraceInstrument.historyKernel G R hmg)= + (μ ⊗ₘ TraceInstrument.historyKernel J ρ hm) ∧ + (fun p : S×X => (U p.1).state p.2)=ᵐ[μ ⊗ₘ TraceInstrument.historyKernel G R hmg] + (fun p => densityTensor c d ((V p.1).state p.2) (σ p.1)) := by + have hk := physical_history_kernel_eq b c d J G hG ρ σ R μ hR hm hmg + have hμ := Measure.compProd_congr hk + refine ⟨hμ,?_⟩ + rw [hμ] at hmean ⊢ + let ν := μ ⊗ₘ TraceInstrument.historyKernel J ρ hm + let f := fun p : S×X => (U p.1).state p.2 + let q := fun p : S×X => densityTensor c d ((V p.1).state p.2) (σ p.1) + apply weak_density_ae_unique (tensorHilbertBasis c d) ν f q T hf hp hmean + intro Z hZ x y + have hfi := density_coefficient_integrable (tensorHilbertBasis c d) ν f hf x y + have hqi := density_coefficient_integrable (tensorHilbertBasis c d) ν q hp x y + have he : ν.withDensityᵥ (fun p => inner ℂ x ((f p).val.val y))= + ν.withDensityᵥ (fun p => inner ℂ x ((q p).val.val y)) := by + apply complexMeasure_ext_rectangles + intro A B hA hB + rw [withDensityᵥ_apply hfi (hA.prod hB),withDensityᵥ_apply hqi (hA.prod hB)] + change (∫ p in A ×ˢ B, inner ℂ x ((f p).val.val y) ∂(μ ⊗ₘ TraceInstrument.historyKernel J ρ hm))=_ + rw [Measure.setIntegral_compProd hA hB hfi.integrableOn, + Measure.setIntegral_compProd hA hB hqi.integrableOn] + apply setIntegral_congr_ae hA + filter_upwards [hR] with h hh + intro _ + change (∫ z in B, inner ℂ x (((U h).state z).val.val y) ∂(J h).outcome (ρ h))=_ + have hlaw : (G h).outcome (R h)=(J h).outcome (ρ h) := by + rw [hh] + exact physical_product_outcome b c d (J h) (G h) (hG h) (ρ h) (σ h) + rw [← hlaw,← (U h).disintegration B hB x y,hh] + exact physical_disintegration_all b c d (J h) (ρ h) (σ h) (V h) hB ((G h).event B) (hG h B hB) x y + have hh := congrArg (fun M : ComplexMeasure (S×X) => M Z) he + simpa only [withDensityᵥ_apply hfi hZ,withDensityᵥ_apply hqi hZ] using hh + +end SecretKey + +end + +end OAI diff --git a/lean/OAI/InformationTheory/Entanglement/PhysicalChronology.lean b/lean/OAI/InformationTheory/Entanglement/PhysicalChronology.lean new file mode 100644 index 0000000000000000000000000000000000000000..8da3eb03177b51664afdd927308157e290597512 --- /dev/null +++ b/lean/OAI/InformationTheory/Entanglement/PhysicalChronology.lean @@ -0,0 +1,69 @@ +import OAI.InformationTheory.Entanglement.PhysicalExecutionStep + +namespace OAI + +noncomputable section +open scoped InnerProductSpace ComplexOrder MeasureTheory +open ContinuousLinearMap MeasureTheory ProbabilityTheory Filter +namespace SecretKey +variable {H K : Type*} + [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + [NormedAddCommGroup K] [InnerProductSpace ℂ K] [CompleteSpace K] +variable {ι κ X : Type*} [MeasurableSpace X] + +theorem physical_chronological_prefixes (b : HilbertBasis ι ℂ H) (d : HilbertBasis κ ℂ K) + (W : (n : ℕ)→PositiveHilbertMeasure (Fin n→X) (HilbertTensor H K) (tensorHilbertBasis b d)) + [∀ n, IsProbabilityMeasure (W n).traceMeasure] + (ρ : (n : ℕ)→(Fin n→X)→DensityOperator b) + (σ : (n : ℕ)→(Fin n→X)→DensityOperator d) + (P : (n : ℕ)→Kernel (Fin n→X) X) [∀ n, IsMarkovKernel (P n)] + (hm : ∀ n x y, Measurable (fun h => inner ℂ x ((densityTensor b d (ρ n h) (σ n h)).val.val y))) + (hzero : IsWeakDensity (tensorHilbertBasis b d) (W 0) (W 0).traceMeasure + (fun h => densityTensor b d (ρ 0 h) (σ 0 h))) + (hstep : ∀ n, PhysicalExecutionStep b d (W n) + ((W (n+1)).mapRecord (historyStepEquiv X n) (historyStepEquiv X n).measurable) + (ρ n) (σ n) (ρ (n+1) ∘ (historyStepEquiv X n).symm) + (σ (n+1) ∘ (historyStepEquiv X n).symm) (P n)) : + (∀ n, IsWeakDensity (tensorHilbertBasis b d) (W n) (W n).traceMeasure + (fun h => densityTensor b d (ρ n h) (σ n h))) ∧ + (∀ n, (W (n+1)).traceMeasure.map (historyStepEquiv X n)=(W n).traceMeasure ⊗ₘ P n) := by + have hs n (hd : IsWeakDensity (tensorHilbertBasis b d) (W n) (W n).traceMeasure + (fun h => densityTensor b d (ρ n h) (σ n h))) := + physical_execution_step b d (W n) + ((W (n+1)).mapRecord (historyStepEquiv X n) (historyStepEquiv X n).measurable) + (ρ n) (σ n) (ρ (n+1) ∘ (historyStepEquiv X n).symm) + (σ (n+1) ∘ (historyStepEquiv X n).symm) (P n) + (hm n) (fun x y => (hm (n+1) x y).comp (historyStepEquiv X n).symm.measurable) hd (hstep n) + have hd n : IsWeakDensity (tensorHilbertBasis b d) (W n) (W n).traceMeasure + (fun h => densityTensor b d (ρ n h) (σ n h)) := by + induction n with + | zero => exact hzero + | succ n ih => + obtain ⟨hk,hpost⟩ := hs n ih + apply weakDensity_of_step (tensorHilbertBasis b d) (W (n+1)) (W (n+1)).traceMeasure + (fun h => densityTensor b d (ρ (n+1) h) (σ (n+1) h)) (hm (n+1)) + change IsWeakDensity (tensorHilbertBasis b d) + ((W (n+1)).mapRecord (historyStepEquiv X n) (historyStepEquiv X n).measurable) + (((W (n+1)).mapRecord (historyStepEquiv X n) (historyStepEquiv X n).measurable).traceMeasure) _ + rw [hk] + exact hpost + exact ⟨hd,fun n => (hs n (hd n)).1⟩ + +theorem complete_history_kernel_of_prefixes [StandardBorelSpace X] [Nonempty X] + (W : (n : ℕ)→Measure (Fin n→X)) + (P : (n : ℕ)→Kernel (Fin n→X) X) + (hs : ∀ n, (W (n+1)).map (historyStepEquiv X n)=W n ⊗ₘ P n) + (ν : Measure (ℕ→X)) + (hfull : ∀ n, ν.map (recordPrefix n)=W n) : + ∀ n, ν.map (fun x => (recordPrefix n x,x n))=ν.map (recordPrefix n) ⊗ₘ P n := by + intro n + have he : (fun x : ℕ→X => (recordPrefix n x,x n))= + (historyStepEquiv X n) ∘ recordPrefix (n+1) := rfl + rw [he,← Measure.map_map (historyStepEquiv X n).measurable (recordPrefix_measurable (n+1)), + hfull (n+1),hs n,hfull n] + +end SecretKey + +end + +end OAI diff --git a/lean/OAI/InformationTheory/Entanglement/PhysicalConditionalUpdate.lean b/lean/OAI/InformationTheory/Entanglement/PhysicalConditionalUpdate.lean new file mode 100644 index 0000000000000000000000000000000000000000..0adfa363b16db056b34a22750c4d6d363cef8224 --- /dev/null +++ b/lean/OAI/InformationTheory/Entanglement/PhysicalConditionalUpdate.lean @@ -0,0 +1,87 @@ +import OAI.InformationTheory.Entanglement.WeakTensorMeasurable +import OAI.InformationTheory.Entanglement.WeakIntegralForm + +namespace OAI + +noncomputable section +open scoped TensorProduct InnerProductSpace ComplexOrder MeasureTheory +open ContinuousLinearMap UniformSpace MeasureTheory +namespace SecretKey +variable {H K L : Type*} + [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + [NormedAddCommGroup K] [InnerProductSpace ℂ K] [CompleteSpace K] + [NormedAddCommGroup L] [InnerProductSpace ℂ L] [CompleteSpace L] +variable {ι κ υ : Type*} +variable {X : Type*} [MeasurableSpace X] +lemma physical_disintegration_all (b : HilbertBasis ι ℂ H) (c : HilbertBasis κ ℂ K) + (d : HilbertBasis υ ℂ L) (I : TraceInstrument b c X) + (ρ : DensityOperator b) (σ : DensityOperator d) (U : I.ConditionalUpdate ρ) + {s : Set X} (hs : MeasurableSet s) + (G : TraceClass (tensorHilbertBasis b d) →ₗ[ℂ] TraceClass (tensorHilbertBasis c d)) + (hG : IsLeftTraceAction b c d (I.event s) G) + (x y : HilbertTensor K L) : + inner ℂ x ((G (densityTensor b d ρ σ).val).val y)= + ∫ z in s, inner ℂ x ((densityTensor c d (U.state z) σ).val.val y) ∂I.outcome ρ := by + let R := fun z => densityTensor c d (U.state z) σ + have hR : ∀ a a', Measurable (fun z => inner ℂ a ((R z).val.val a')) := + densityTensor_coefficient_measurable c d U.state (fun _ => σ) + U.coefficient_measurable (fun _ _ => measurable_const) + let μ := (I.outcome ρ).restrict s + let T := (G (densityTensor b d ρ σ).val).val + have hI (a a') : Integrable (fun z => inner ℂ a ((R z).val.val a')) μ := + density_coefficient_integrable (tensorHilbertBasis c d) μ R hR a a' + have hleft (a : K) (v : L) (z : HilbertTensor K L) : + inner ℂ z (T (hilbertTmul a v))=∫ t, inner ℂ z ((R t).val.val (hilbertTmul a v)) ∂μ := by + refine Completion.induction_on z (isClosed_eq (by fun_prop) + (densityIntegral_left_continuous (tensorHilbertBasis c d) μ R hR _)) ?_ + intro t + induction t using TensorProduct.inductionOn with + | tmul p q => exact physical_product_disintegration b c d I ρ σ U hs G hG p a q v + | add p q hp hq => + simp only [Completion.coe_add,inner_add_left,integral_add (hI _ _) (hI _ _),hp,hq] + change inner ℂ x (T y)=∫ t, inner ℂ x ((R t).val.val y) ∂μ + refine Completion.induction_on y (isClosed_eq (by fun_prop) + (densityIntegral_right_continuous (tensorHilbertBasis c d) μ R hR x)) ?_ + intro t + induction t using TensorProduct.inductionOn with + | tmul p q => exact hleft p q x + | add p q hp hq => + simp only [Completion.coe_add,map_add,inner_add_right,integral_add (hI _ _) (hI _ _),hp,hq] + +lemma physical_product_outcome (b : HilbertBasis ι ℂ H) (c : HilbertBasis κ ℂ K) + (d : HilbertBasis υ ℂ L) (I : TraceInstrument b c X) + (G : TraceInstrument (tensorHilbertBasis b d) (tensorHilbertBasis c d) X) + (hG : ∀ s, MeasurableSet s → IsLeftTraceAction b c d (I.event s) (G.event s)) + (ρ : DensityOperator b) (σ : DensityOperator d) : + G.outcome (densityTensor b d ρ σ)=I.outcome ρ := by + apply Measure.ext + intro s hs + apply (ENNReal.toReal_eq_toReal_iff' (measure_ne_top _ _) (measure_ne_top _ _)).mp + change (G.outcome (densityTensor b d ρ σ)).real s=(I.outcome ρ).real s + rw [G.outcome_born _ hs] + exact physical_product_born b c d I ρ σ hs (G.event s) (hG s hs) + +def physical_product_update (b : HilbertBasis ι ℂ H) (c : HilbertBasis κ ℂ K) + (d : HilbertBasis υ ℂ L) (I : TraceInstrument b c X) + (G : TraceInstrument (tensorHilbertBasis b d) (tensorHilbertBasis c d) X) + (hG : ∀ s, MeasurableSet s → IsLeftTraceAction b c d (I.event s) (G.event s)) + (ρ : DensityOperator b) (σ : DensityOperator d) (U : I.ConditionalUpdate ρ) : + G.ConditionalUpdate (densityTensor b d ρ σ) where + state z := densityTensor c d (U.state z) σ + coefficient_measurable := densityTensor_coefficient_measurable c d U.state (fun _ => σ) + U.coefficient_measurable (fun _ _ => measurable_const) + coefficient_integrable x y := by + rw [physical_product_outcome b c d I G hG ρ σ] + exact density_coefficient_integrable (tensorHilbertBasis c d) (I.outcome ρ) + (fun z => densityTensor c d (U.state z) σ) + (densityTensor_coefficient_measurable c d U.state (fun _ => σ) + U.coefficient_measurable (fun _ _ => measurable_const)) x y + disintegration s hs x y := by + rw [physical_product_outcome b c d I G hG ρ σ] + exact physical_disintegration_all b c d I ρ σ U hs (G.event s) (hG s hs) x y + +end SecretKey + +end + +end OAI diff --git a/lean/OAI/InformationTheory/Entanglement/PhysicalExecutionStep.lean b/lean/OAI/InformationTheory/Entanglement/PhysicalExecutionStep.lean new file mode 100644 index 0000000000000000000000000000000000000000..21d1b2d59918931bee5b956a7bd986a024516013 --- /dev/null +++ b/lean/OAI/InformationTheory/Entanglement/PhysicalExecutionStep.lean @@ -0,0 +1,96 @@ +import OAI.InformationTheory.Entanglement.PhysicalPublicPrefix + +namespace OAI + +noncomputable section +open scoped InnerProductSpace ComplexOrder MeasureTheory +open ContinuousLinearMap MeasureTheory ProbabilityTheory Filter +namespace SecretKey +variable {H K : Type*} + [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + [NormedAddCommGroup K] [InnerProductSpace ℂ K] [CompleteSpace K] +variable {ι κ S X : Type*} [MeasurableSpace S] [MeasurableSpace X] + +def IsRawInstrumentTransition (b : HilbertBasis ι ℂ H) + (W : PositiveHilbertMeasure S H b) (V : PositiveHilbertMeasure (S×X) H b) + (G : S→TraceInstrument b b X) : Prop := + ∀ R : S→DensityOperator b, + (∀ x y, Measurable (fun h => inner ℂ x ((R h).val.val y))) → + IsWeakDensity b W W.traceMeasure R → + ∀ A B, MeasurableSet A → MeasurableSet B → ∀ x y, + V.coeff x y (A ×ˢ B)=∫ h in A, inner ℂ x (((G h).event B (R h).val).val y) ∂W.traceMeasure + +def IsRawPublicTransition (b : HilbertBasis ι ℂ H) + (W : PositiveHilbertMeasure S H b) (V : PositiveHilbertMeasure (S×X) H b) + (P : Kernel S X) : Prop := + ∀ R : S→DensityOperator b, + (∀ x y, Measurable (fun h => inner ℂ x ((R h).val.val y))) → + IsWeakDensity b W W.traceMeasure R → + ∀ A B, MeasurableSet A → MeasurableSet B → ∀ x y, + V.coeff x y (A ×ˢ B)=∫ h in A, ((P h).real B : ℂ)*inner ℂ x ((R h).val.val y) ∂W.traceMeasure + +inductive PhysicalExecutionStep (b : HilbertBasis ι ℂ H) (d : HilbertBasis κ ℂ K) + (W : PositiveHilbertMeasure S (HilbertTensor H K) (tensorHilbertBasis b d)) + (V : PositiveHilbertMeasure (S×X) (HilbertTensor H K) (tensorHilbertBasis b d)) + (ρ : S→DensityOperator b) (σ : S→DensityOperator d) + (ρ' : S×X→DensityOperator b) (σ' : S×X→DensityOperator d) (P : Kernel S X) : Prop + | left + (J : S→TraceInstrument b b X) + (G : S→TraceInstrument (tensorHilbertBasis b d) (tensorHilbertBasis b d) X) + (hG : ∀ h s, MeasurableSet s → IsLeftTraceAction b b d ((J h).event s) ((G h).event s)) + (hm : ∀ s, MeasurableSet s → Measurable (fun h => (J h).outcome (ρ h) s)) + (U : ∀ h, (J h).ConditionalUpdate (ρ h)) + (hraw : IsRawInstrumentTransition (tensorHilbertBasis b d) W V G) + (hstateA : ρ'=fun p => (U p.1).state p.2) + (hstateB : σ'=σ ∘ Prod.fst) + (hkernel : P=TraceInstrument.historyKernel J ρ hm) : + PhysicalExecutionStep b d W V ρ σ ρ' σ' P + | right + (J : S→TraceInstrument d d X) + (G : S→TraceInstrument (tensorHilbertBasis b d) (tensorHilbertBasis b d) X) + (hG : ∀ h s, MeasurableSet s → IsRightTraceAction d d b ((J h).event s) ((G h).event s)) + (hm : ∀ s, MeasurableSet s → Measurable (fun h => (J h).outcome (σ h) s)) + (U : ∀ h, (J h).ConditionalUpdate (σ h)) + (hraw : IsRawInstrumentTransition (tensorHilbertBasis b d) W V G) + (hstateA : ρ'=ρ ∘ Prod.fst) + (hstateB : σ'=fun p => (U p.1).state p.2) + (hkernel : P=TraceInstrument.historyKernel J σ hm) : + PhysicalExecutionStep b d W V ρ σ ρ' σ' P + | publicDraw + (hraw : IsRawPublicTransition (tensorHilbertBasis b d) W V P) + (hstateA : ρ'=ρ ∘ Prod.fst) (hstateB : σ'=σ ∘ Prod.fst) : + PhysicalExecutionStep b d W V ρ σ ρ' σ' P +variable (b : HilbertBasis ι ℂ H) (d : HilbertBasis κ ℂ K) + +theorem physical_execution_step + (W : PositiveHilbertMeasure S (HilbertTensor H K) (tensorHilbertBasis b d)) + (V : PositiveHilbertMeasure (S×X) (HilbertTensor H K) (tensorHilbertBasis b d)) + [IsProbabilityMeasure W.traceMeasure] [IsProbabilityMeasure V.traceMeasure] + (ρ : S→DensityOperator b) (σ : S→DensityOperator d) + (ρ' : S×X→DensityOperator b) (σ' : S×X→DensityOperator d) (P : Kernel S X) [IsMarkovKernel P] + (hR : ∀ x y, Measurable (fun h => inner ℂ x ((densityTensor b d (ρ h) (σ h)).val.val y))) + (hR' : ∀ x y, Measurable (fun p => inner ℂ x ((densityTensor b d (ρ' p) (σ' p)).val.val y))) + (hd : IsWeakDensity (tensorHilbertBasis b d) W W.traceMeasure (fun h => densityTensor b d (ρ h) (σ h))) + (hstep : PhysicalExecutionStep b d W V ρ σ ρ' σ' P) : + V.traceMeasure=W.traceMeasure ⊗ₘ P ∧ + IsWeakDensity (tensorHilbertBasis b d) V (W.traceMeasure ⊗ₘ P) + (fun p => densityTensor b d (ρ' p) (σ' p)) := by + cases hstep with + | left J G hG hm U hraw ha hb hk => + subst ρ'; subst σ'; subst P + exact physical_raw_prefix b b d J G hG ρ σ W.traceMeasure hm U hR' V + (hraw _ hR hd) + | right J G hG hm U hraw ha hb hk => + subst ρ'; subst σ'; subst P + exact physical_right_raw_prefix d d b J G hG σ ρ W.traceMeasure hm U hR' V + (hraw _ hR hd) + | publicDraw hraw ha hb => + subst ρ'; subst σ' + exact physical_public_raw_prefix (tensorHilbertBasis b d) W.traceMeasure P + (fun h => densityTensor b d (ρ h) (σ h)) hR V (hraw _ hR hd) + +end SecretKey + +end + +end OAI diff --git a/lean/OAI/InformationTheory/Entanglement/PhysicalHistoryRealization.lean b/lean/OAI/InformationTheory/Entanglement/PhysicalHistoryRealization.lean new file mode 100644 index 0000000000000000000000000000000000000000..0e433f9075770815fdabf7c5312e2649c7329d6e --- /dev/null +++ b/lean/OAI/InformationTheory/Entanglement/PhysicalHistoryRealization.lean @@ -0,0 +1,53 @@ +import OAI.InformationTheory.Entanglement.PhysicalChronology +import OAI.InformationTheory.Entanglement.CausalRealization + +namespace OAI + +noncomputable section +open scoped InnerProductSpace ComplexOrder MeasureTheory unitInterval +open ContinuousLinearMap MeasureTheory ProbabilityTheory Filter Function +namespace SecretKey +variable {H K : Type*} + [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + [NormedAddCommGroup K] [InnerProductSpace ℂ K] [CompleteSpace K] +variable {ι κ X : Type*} [MeasurableSpace X] [StandardBorelSpace X] [Nonempty X] + +theorem physical_history_realization (b : HilbertBasis ι ℂ H) (d : HilbertBasis κ ℂ K) + (role : ℕ→TapeRole) (pub : Set ℕ) (x₀ : X) + (hsource : ∀ n, role n=.source → n∈pub) + (W : (n : ℕ)→PositiveHilbertMeasure (Fin n→X) (HilbertTensor H K) (tensorHilbertBasis b d)) + [∀ n, IsProbabilityMeasure (W n).traceMeasure] + (ρ : (n : ℕ)→(Fin n→X)→DensityOperator b) + (τ : (n : ℕ)→(Fin n→X)→DensityOperator d) + (P Q : (n : ℕ)→Kernel (Fin n→X) X) + [∀ n, IsMarkovKernel (P n)] [∀ n, IsMarkovKernel (Q n)] + (hlocal : ∀ n, P n=visibleKernel role pub x₀ Q n) + (hm : ∀ n x y, Measurable (fun h => inner ℂ x ((densityTensor b d (ρ n h) (τ n h)).val.val y))) + (hzero : IsWeakDensity (tensorHilbertBasis b d) (W 0) (W 0).traceMeasure + (fun h => densityTensor b d (ρ 0 h) (τ 0 h))) + (hstep : ∀ n, PhysicalExecutionStep b d (W n) + ((W (n+1)).mapRecord (historyStepEquiv X n) (historyStepEquiv X n).measurable) + (ρ n) (τ n) (ρ (n+1) ∘ (historyStepEquiv X n).symm) + (τ (n+1) ∘ (historyStepEquiv X n).symm) (P n)) + (ν : Measure (ℕ→X)) [IsProbabilityMeasure ν] + (hfull : ∀ n, ν.map (recordPrefix n)=(W n).traceMeasure) : + ∃ g : (n : ℕ)→(Fin n→X)→I→X, + (∀ n, Measurable (uncurry (g n))) ∧ + ν=uniformTapesLaw.map (sampledHistory (causalSampler role pub x₀ g)) ∧ + ∃ hT : Measurable (completeCausalPublic role pub x₀ g), + CondIndep ((inferInstance : MeasurableSpace (ℕ→X)).comap (completeCausalPublic role pub x₀ g)) + (roleInfo role .alice ⊔ (inferInstance : MeasurableSpace (ℕ→X)).comap (completeCausalPublic role pub x₀ g)) + (roleInfo role .bob ⊔ (inferInstance : MeasurableSpace (ℕ→X)).comap (completeCausalPublic role pub x₀ g)) + hT.comap_le uniformTapesLaw := by + have hpre := physical_chronological_prefixes b d W ρ τ P hm hzero hstep + have hν := complete_history_kernel_of_prefixes (fun n => (W n).traceMeasure) P hpre.2 ν hfull + apply causal_history_realization role pub x₀ hsource Q ν + intro n + rw [← hlocal n] + exact hν n + +end SecretKey + +end + +end OAI diff --git a/lean/OAI/InformationTheory/Entanglement/PhysicalProductStep.lean b/lean/OAI/InformationTheory/Entanglement/PhysicalProductStep.lean new file mode 100644 index 0000000000000000000000000000000000000000..92ea1b7a93f26aa28d38d38b5a6b9e0ccd164087 --- /dev/null +++ b/lean/OAI/InformationTheory/Entanglement/PhysicalProductStep.lean @@ -0,0 +1,106 @@ +import OAI.InformationTheory.Entanglement.TraceTensor +import OAI.InformationTheory.Entanglement.WeakProductPrefix + +namespace OAI + +noncomputable section +open scoped TensorProduct InnerProductSpace ComplexOrder MeasureTheory +open ContinuousLinearMap UniformSpace MeasureTheory ProbabilityTheory +namespace SecretKey +variable {H K L : Type*} + [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + [NormedAddCommGroup K] [InnerProductSpace ℂ K] [CompleteSpace K] + [NormedAddCommGroup L] [InnerProductSpace ℂ L] [CompleteSpace L] +variable {ι κ υ : Type*} +def traceTensorBilinear (b : HilbertBasis ι ℂ H) (c : HilbertBasis κ ℂ K) : + TraceClass b →ₗ[ℂ] TraceClass c →ₗ[ℂ] TraceClass (tensorHilbertBasis b c) where + toFun A := + { toFun := traceTensor b c A + map_add' := fun B C => Subtype.ext (hilbertTensorMap_add_right A.val B.val C.val) + map_smul' := fun s B => Subtype.ext (hilbertTensorMap_smul_right s A.val B.val) } + map_add' A B := by + apply LinearMap.ext + intro C + apply Subtype.ext + exact hilbertTensorMap_add_left A.val B.val C.val + map_smul' s A := by + apply LinearMap.ext + intro B + apply Subtype.ext + exact hilbertTensorMap_smul_left s A.val B.val + +def traceTensorEmbedding (b : HilbertBasis ι ℂ H) (c : HilbertBasis κ ℂ K) : + TraceClass b ⊗[ℂ] TraceClass c →ₗ[ℂ] TraceClass (tensorHilbertBasis b c) := + TensorProduct.lift (traceTensorBilinear b c) +@[simp] lemma traceTensorEmbedding_tmul (b : HilbertBasis ι ℂ H) (c : HilbertBasis κ ℂ K) + (A : TraceClass b) (B : TraceClass c) : + traceTensorEmbedding b c (A ⊗ₜ[ℂ] B)=traceTensor b c A B := rfl +lemma traceTensorEmbedding_trace (b : HilbertBasis ι ℂ H) (c : HilbertBasis κ ℂ K) : + (traceClassTrace (tensorHilbertBasis b c)).comp (traceTensorEmbedding b c)= + tensorFunctional (traceClassTrace b) (traceClassTrace c) := by + apply TensorProduct.ext' + intro A B + exact traceTensor_trace b c A B +lemma traceTensorEmbedding_coeff (b : HilbertBasis ι ℂ H) (c : HilbertBasis κ ℂ K) + (x y : H) (u v : K) : + (traceClassCoefficient (tensorHilbertBasis b c) (hilbertTmul x u) (hilbertTmul y v)).comp + (traceTensorEmbedding b c)= + tensorFunctional (traceClassCoefficient b x y) (traceClassCoefficient c u v) := by + apply TensorProduct.ext' + intro A B + change inner ℂ (hilbertTmul x u) (hilbertTensorMap A.val B.val (hilbertTmul y v))=_ + rw [hilbertTensorMap_tmul,hilbertTmul_inner] + rfl +def densityTensor (b : HilbertBasis ι ℂ H) (c : HilbertBasis κ ℂ K) + (ρ : DensityOperator b) (σ : DensityOperator c) : DensityOperator (tensorHilbertBasis b c) := + ⟨traceTensor b c ρ.val σ.val,hilbertTensorMap_nonneg ρ.property.1 σ.property.1,by + rw [traceTensor_trace,ρ.property.2,σ.property.2,mul_one]⟩ + +def IsLeftTraceAction (b : HilbertBasis ι ℂ H) (c : HilbertBasis κ ℂ K) + (d : HilbertBasis υ ℂ L) (F : TraceClass b →ₗ[ℂ] TraceClass c) + (G : TraceClass (tensorHilbertBasis b d) →ₗ[ℂ] TraceClass (tensorHilbertBasis c d)) : Prop := + ∀ A B, G (traceTensor b d A B)=traceTensor c d (F A) B +lemma leftTraceAction_intertwines (b : HilbertBasis ι ℂ H) (c : HilbertBasis κ ℂ K) + (d : HilbertBasis υ ℂ L) (F : TraceClass b →ₗ[ℂ] TraceClass c) + (G : TraceClass (tensorHilbertBasis b d) →ₗ[ℂ] TraceClass (tensorHilbertBasis c d)) + (hG : IsLeftTraceAction b c d F G) : + G.comp (traceTensorEmbedding b d)= + (traceTensorEmbedding c d).comp (TensorProduct.map F LinearMap.id) := by + apply TensorProduct.ext' + intro A B + exact hG A B +variable {X : Type*} [MeasurableSpace X] + +theorem physical_product_born (b : HilbertBasis ι ℂ H) (c : HilbertBasis κ ℂ K) + (d : HilbertBasis υ ℂ L) (I : TraceInstrument b c X) + (ρ : DensityOperator b) (σ : DensityOperator d) {s : Set X} (hs : MeasurableSet s) + (G : TraceClass (tensorHilbertBasis b d) →ₗ[ℂ] TraceClass (tensorHilbertBasis c d)) + (hG : IsLeftTraceAction b c d (I.event s) G) : + (traceClassTrace (tensorHilbertBasis c d) (G (densityTensor b d ρ σ).val)).re= + (I.outcome ρ).real s := by + change (traceClassTrace (tensorHilbertBasis c d) (G (traceTensor b d ρ.val σ.val))).re=_ + rw [hG,traceTensor_trace,σ.property.2,mul_one,I.outcome_born ρ hs] + +theorem physical_product_disintegration (b : HilbertBasis ι ℂ H) (c : HilbertBasis κ ℂ K) + (d : HilbertBasis υ ℂ L) (I : TraceInstrument b c X) + (ρ : DensityOperator b) (σ : DensityOperator d) (U : I.ConditionalUpdate ρ) + {s : Set X} (hs : MeasurableSet s) + (G : TraceClass (tensorHilbertBasis b d) →ₗ[ℂ] TraceClass (tensorHilbertBasis c d)) + (hG : IsLeftTraceAction b c d (I.event s) G) (x y : K) (u v : L) : + inner ℂ (hilbertTmul x u) ((G (densityTensor b d ρ σ).val).val (hilbertTmul y v))= + ∫ z in s, inner ℂ (hilbertTmul x u) + ((densityTensor c d (U.state z) σ).val.val (hilbertTmul y v)) ∂I.outcome ρ := by + change inner ℂ (hilbertTmul x u) ((G (traceTensor b d ρ.val σ.val)).val (hilbertTmul y v))=_ + rw [hG] + change inner ℂ (hilbertTmul x u) (hilbertTensorMap (I.event s ρ.val).val σ.val.val (hilbertTmul y v))=_ + rw [hilbertTensorMap_tmul,hilbertTmul_inner,U.disintegration s hs] + erw [← integral_mul_const] + apply setIntegral_congr_fun hs + intro z hz + simp [densityTensor,traceTensor,hilbertTmul_inner] + +end SecretKey + +end + +end OAI diff --git a/lean/OAI/InformationTheory/Entanglement/PhysicalPublicPrefix.lean b/lean/OAI/InformationTheory/Entanglement/PhysicalPublicPrefix.lean new file mode 100644 index 0000000000000000000000000000000000000000..7a2aa66fdaad12941bb59f726092a0ff3c9f4d22 --- /dev/null +++ b/lean/OAI/InformationTheory/Entanglement/PhysicalPublicPrefix.lean @@ -0,0 +1,45 @@ +import OAI.InformationTheory.Entanglement.PhysicalRightRawPrefix +import OAI.InformationTheory.Entanglement.HilbertRecordMap + +namespace OAI + +noncomputable section +open scoped InnerProductSpace ComplexOrder MeasureTheory +open ContinuousLinearMap MeasureTheory ProbabilityTheory Filter +namespace SecretKey +variable {H : Type*} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] +variable {ι S X : Type*} [MeasurableSpace S] [MeasurableSpace X] + +theorem physical_public_raw_prefix (b : HilbertBasis ι ℂ H) + (μ : Measure S) [IsProbabilityMeasure μ] (κ : Kernel S X) [IsMarkovKernel κ] + (ρ : S→DensityOperator b) + (hm : ∀ x y, Measurable (fun h => inner ℂ x ((ρ h).val.val y))) + (W : PositiveHilbertMeasure (S×X) H b) [IsProbabilityMeasure W.traceMeasure] + (hEvent : ∀ A B, MeasurableSet A → MeasurableSet B → ∀ x y, + W.coeff x y (A ×ˢ B)=∫ h in A, ((κ h).real B : ℂ)*inner ℂ x ((ρ h).val.val y) ∂μ) : + W.traceMeasure=μ ⊗ₘ κ ∧ IsWeakDensity b W (μ ⊗ₘ κ) (ρ ∘ Prod.fst) := by + let ν := μ ⊗ₘ κ + let f : S×X→DensityOperator b := ρ ∘ Prod.fst + have hf : ∀ x y, Measurable (fun p : S×X => inner ℂ x ((f p).val.val y)) := + fun x y => (hm x y).comp measurable_fst + have hd : IsWeakDensity b W ν f := by + intro Z hZ x y + have hi := density_coefficient_integrable b ν f hf x y + have he : W.coeff x y=ν.withDensityᵥ (fun p => inner ℂ x ((f p).val.val y)) := by + apply complexMeasure_ext_rectangles + intro A B hA hB + rw [withDensityᵥ_apply hi (hA.prod hB)] + change W.coeff x y (A ×ˢ B)=(∫ p in A ×ˢ B, inner ℂ x ((f p).val.val y) ∂(μ ⊗ₘ κ)) + rw [Measure.setIntegral_compProd hA hB hi.integrableOn,hEvent A B hA hB x y] + apply setIntegral_congr_fun hA + intro h hh + change ((κ h).real B : ℂ)*inner ℂ x ((ρ h).val.val y)=∫ _ in B, inner ℂ x ((ρ h).val.val y) ∂κ h + simp only [integral_const,Measure.restrict_apply_univ,Measure.real,Complex.real_smul] + rw [he,withDensityᵥ_apply hi hZ] + exact ⟨weak_density_trace_eq b W ν f hf hd,hd⟩ + +end SecretKey + +end + +end OAI diff --git a/lean/OAI/InformationTheory/Entanglement/PhysicalRawPrefix.lean b/lean/OAI/InformationTheory/Entanglement/PhysicalRawPrefix.lean new file mode 100644 index 0000000000000000000000000000000000000000..da8ded6f2e46639e4e2be16abcb4f06a704dafc1 --- /dev/null +++ b/lean/OAI/InformationTheory/Entanglement/PhysicalRawPrefix.lean @@ -0,0 +1,58 @@ +import OAI.InformationTheory.Entanglement.PhysicalRightAdaptive +import OAI.InformationTheory.Entanglement.WeakLawTrace + +namespace OAI + +noncomputable section +open scoped InnerProductSpace ComplexOrder MeasureTheory +open ContinuousLinearMap MeasureTheory ProbabilityTheory Filter +namespace SecretKey +variable {H K L : Type*} + [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + [NormedAddCommGroup K] [InnerProductSpace ℂ K] [CompleteSpace K] + [NormedAddCommGroup L] [InnerProductSpace ℂ L] [CompleteSpace L] +variable {ι κ υ S X : Type*} [MeasurableSpace S] [MeasurableSpace X] + +theorem physical_raw_prefix (b : HilbertBasis ι ℂ H) (c : HilbertBasis κ ℂ K) + (d : HilbertBasis υ ℂ L) (J : S→TraceInstrument b c X) + (G : S→TraceInstrument (tensorHilbertBasis b d) (tensorHilbertBasis c d) X) + (hG : ∀ h s, MeasurableSet s → IsLeftTraceAction b c d ((J h).event s) ((G h).event s)) + (ρ : S→DensityOperator b) (σ : S→DensityOperator d) + (μ : Measure S) [IsProbabilityMeasure μ] + (hm : ∀ V, MeasurableSet V → Measurable (fun h => (J h).outcome (ρ h) V)) + (U : ∀ h, (J h).ConditionalUpdate (ρ h)) + (hp : ∀ x y, Measurable (fun p : S×X => inner ℂ x + ((densityTensor c d ((U p.1).state p.2) (σ p.1)).val.val y))) + (W : PositiveHilbertMeasure (S×X) (HilbertTensor K L) (tensorHilbertBasis c d)) + [IsProbabilityMeasure W.traceMeasure] + (hEvent : ∀ A B, MeasurableSet A → MeasurableSet B → ∀ x y, + W.coeff x y (A ×ˢ B)=∫ h in A, + inner ℂ x (((G h).event B (densityTensor b d (ρ h) (σ h)).val).val y) ∂μ) : + W.traceMeasure=μ ⊗ₘ TraceInstrument.historyKernel J ρ hm ∧ + ∀ Z, MeasurableSet Z → ∀ x y, W.coeff x y Z= + ∫ p in Z, inner ℂ x ((densityTensor c d ((U p.1).state p.2) (σ p.1)).val.val y) + ∂(μ ⊗ₘ TraceInstrument.historyKernel J ρ hm) := by + let ν := μ ⊗ₘ TraceInstrument.historyKernel J ρ hm + let f := fun p : S×X => densityTensor c d ((U p.1).state p.2) (σ p.1) + have hd (Z : Set (S×X)) (hZ : MeasurableSet Z) (x y : HilbertTensor K L) : + W.coeff x y Z=∫ p in Z, inner ℂ x ((f p).val.val y) ∂ν := by + have hi := density_coefficient_integrable (tensorHilbertBasis c d) ν f hp x y + have he : W.coeff x y=ν.withDensityᵥ (fun p => inner ℂ x ((f p).val.val y)) := by + apply complexMeasure_ext_rectangles + intro A B hA hB + rw [withDensityᵥ_apply hi (hA.prod hB)] + change W.coeff x y (A ×ˢ B)=(∫ p in A ×ˢ B, inner ℂ x ((f p).val.val y) + ∂(μ ⊗ₘ TraceInstrument.historyKernel J ρ hm)) + rw [Measure.setIntegral_compProd hA hB hi.integrableOn,hEvent A B hA hB x y] + apply setIntegral_congr_fun hA + intro h hh + exact physical_disintegration_all b c d (J h) (ρ h) (σ h) (U h) hB + ((G h).event B) (hG h B hB) x y + rw [he,withDensityᵥ_apply hi hZ] + exact ⟨weak_density_trace_eq (tensorHilbertBasis c d) W ν f hp hd,hd⟩ + +end SecretKey + +end + +end OAI diff --git a/lean/OAI/InformationTheory/Entanglement/PhysicalRightAdaptive.lean b/lean/OAI/InformationTheory/Entanglement/PhysicalRightAdaptive.lean new file mode 100644 index 0000000000000000000000000000000000000000..2e2b0eeb7b805f6ed6da437f9f8eeae117178dbc --- /dev/null +++ b/lean/OAI/InformationTheory/Entanglement/PhysicalRightAdaptive.lean @@ -0,0 +1,88 @@ +import OAI.InformationTheory.Entanglement.PhysicalRightStep + +namespace OAI + +noncomputable section +open scoped InnerProductSpace ComplexOrder MeasureTheory +open ContinuousLinearMap MeasureTheory ProbabilityTheory Filter +namespace SecretKey +variable {H K L : Type*} + [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + [NormedAddCommGroup K] [InnerProductSpace ℂ K] [CompleteSpace K] + [NormedAddCommGroup L] [InnerProductSpace ℂ L] [CompleteSpace L] +variable {ι κ υ S X : Type*} [MeasurableSpace S] [MeasurableSpace X] + +theorem physical_right_history_kernel_eq (b : HilbertBasis ι ℂ H) (c : HilbertBasis κ ℂ K) + (d : HilbertBasis υ ℂ L) (J : S→TraceInstrument b c X) + (G : S→TraceInstrument (tensorHilbertBasis d b) (tensorHilbertBasis d c) X) + (hG : ∀ h s, MeasurableSet s → IsRightTraceAction b c d ((J h).event s) ((G h).event s)) + (ρ : S→DensityOperator b) (σ : S→DensityOperator d) + (R : S→DensityOperator (tensorHilbertBasis d b)) + (μ : Measure S) + (hR : R=ᵐ[μ](fun h => densityTensor d b (σ h) (ρ h))) + (hm : ∀ V, MeasurableSet V → Measurable (fun h => (J h).outcome (ρ h) V)) + (hmg : ∀ V, MeasurableSet V → Measurable (fun h => (G h).outcome (R h) V)) : + TraceInstrument.historyKernel G R hmg=ᵐ[μ]TraceInstrument.historyKernel J ρ hm := by + filter_upwards [hR] with h hh + change (G h).outcome (R h)=(J h).outcome (ρ h) + rw [hh] + exact physical_right_outcome b c d (J h) (G h) (hG h) (ρ h) (σ h) + +theorem physical_right_adaptive_prefix (b : HilbertBasis ι ℂ H) (c : HilbertBasis κ ℂ K) + (d : HilbertBasis υ ℂ L) (J : S→TraceInstrument b c X) + (G : S→TraceInstrument (tensorHilbertBasis d b) (tensorHilbertBasis d c) X) + (hG : ∀ h s, MeasurableSet s → IsRightTraceAction b c d ((J h).event s) ((G h).event s)) + (ρ : S→DensityOperator b) (σ : S→DensityOperator d) + (R : S→DensityOperator (tensorHilbertBasis d b)) + (μ : Measure S) [IsProbabilityMeasure μ] + (hR : R=ᵐ[μ](fun h => densityTensor d b (σ h) (ρ h))) + (hm : ∀ V, MeasurableSet V → Measurable (fun h => (J h).outcome (ρ h) V)) + (hmg : ∀ V, MeasurableSet V → Measurable (fun h => (G h).outcome (R h) V)) + (U : ∀ h, (G h).ConditionalUpdate (R h)) + (V : ∀ h, (J h).ConditionalUpdate (ρ h)) + (hf : ∀ x y, Measurable (fun p : S×X => inner ℂ x (((U p.1).state p.2).val.val y))) + (hp : ∀ x y, Measurable (fun p : S×X => inner ℂ x + ((densityTensor d c (σ p.1) ((V p.1).state p.2)).val.val y))) + (T : DensityOperator (tensorHilbertBasis d c)) + (hmean : ∀ x y, inner ℂ x (T.val.val y)=∫ p, inner ℂ x (((U p.1).state p.2).val.val y) + ∂(μ ⊗ₘ TraceInstrument.historyKernel G R hmg)) : + (μ ⊗ₘ TraceInstrument.historyKernel G R hmg)= + (μ ⊗ₘ TraceInstrument.historyKernel J ρ hm) ∧ + (fun p : S×X => (U p.1).state p.2)=ᵐ[μ ⊗ₘ TraceInstrument.historyKernel G R hmg] + (fun p => densityTensor d c (σ p.1) ((V p.1).state p.2)) := by + have hk := physical_right_history_kernel_eq b c d J G hG ρ σ R μ hR hm hmg + have hμ := Measure.compProd_congr hk + refine ⟨hμ,?_⟩ + rw [hμ] at hmean ⊢ + let ν := μ ⊗ₘ TraceInstrument.historyKernel J ρ hm + let f := fun p : S×X => (U p.1).state p.2 + let q := fun p : S×X => densityTensor d c (σ p.1) ((V p.1).state p.2) + apply weak_density_ae_unique (tensorHilbertBasis d c) ν f q T hf hp hmean + intro Z hZ x y + have hfi := density_coefficient_integrable (tensorHilbertBasis d c) ν f hf x y + have hqi := density_coefficient_integrable (tensorHilbertBasis d c) ν q hp x y + have he : ν.withDensityᵥ (fun p => inner ℂ x ((f p).val.val y))= + ν.withDensityᵥ (fun p => inner ℂ x ((q p).val.val y)) := by + apply complexMeasure_ext_rectangles + intro A B hA hB + rw [withDensityᵥ_apply hfi (hA.prod hB),withDensityᵥ_apply hqi (hA.prod hB)] + change (∫ p in A ×ˢ B, inner ℂ x ((f p).val.val y) ∂(μ ⊗ₘ TraceInstrument.historyKernel J ρ hm))=_ + rw [Measure.setIntegral_compProd hA hB hfi.integrableOn, + Measure.setIntegral_compProd hA hB hqi.integrableOn] + apply setIntegral_congr_ae hA + filter_upwards [hR] with h hh + intro _ + change (∫ z in B, inner ℂ x (((U h).state z).val.val y) ∂(J h).outcome (ρ h))=_ + have hlaw : (G h).outcome (R h)=(J h).outcome (ρ h) := by + rw [hh] + exact physical_right_outcome b c d (J h) (G h) (hG h) (ρ h) (σ h) + rw [← hlaw,← (U h).disintegration B hB x y,hh] + exact physical_right_disintegration_all b c d (J h) (ρ h) (σ h) (V h) hB ((G h).event B) (hG h B hB) x y + have hh := congrArg (fun M : ComplexMeasure (S×X) => M Z) he + simpa only [withDensityᵥ_apply hfi hZ,withDensityᵥ_apply hqi hZ] using hh + +end SecretKey + +end + +end OAI diff --git a/lean/OAI/InformationTheory/Entanglement/PhysicalRightRawPrefix.lean b/lean/OAI/InformationTheory/Entanglement/PhysicalRightRawPrefix.lean new file mode 100644 index 0000000000000000000000000000000000000000..594716f2290dc31ce1859a18f3a42b142de62e3d --- /dev/null +++ b/lean/OAI/InformationTheory/Entanglement/PhysicalRightRawPrefix.lean @@ -0,0 +1,57 @@ +import OAI.InformationTheory.Entanglement.PhysicalRawPrefix + +namespace OAI + +noncomputable section +open scoped InnerProductSpace ComplexOrder MeasureTheory +open ContinuousLinearMap MeasureTheory ProbabilityTheory Filter +namespace SecretKey +variable {H K L : Type*} + [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + [NormedAddCommGroup K] [InnerProductSpace ℂ K] [CompleteSpace K] + [NormedAddCommGroup L] [InnerProductSpace ℂ L] [CompleteSpace L] +variable {ι κ υ S X : Type*} [MeasurableSpace S] [MeasurableSpace X] + +theorem physical_right_raw_prefix (b : HilbertBasis ι ℂ H) (c : HilbertBasis κ ℂ K) + (d : HilbertBasis υ ℂ L) (J : S→TraceInstrument b c X) + (G : S→TraceInstrument (tensorHilbertBasis d b) (tensorHilbertBasis d c) X) + (hG : ∀ h s, MeasurableSet s → IsRightTraceAction b c d ((J h).event s) ((G h).event s)) + (ρ : S→DensityOperator b) (σ : S→DensityOperator d) + (μ : Measure S) [IsProbabilityMeasure μ] + (hm : ∀ V, MeasurableSet V → Measurable (fun h => (J h).outcome (ρ h) V)) + (U : ∀ h, (J h).ConditionalUpdate (ρ h)) + (hp : ∀ x y, Measurable (fun p : S×X => inner ℂ x + ((densityTensor d c (σ p.1) ((U p.1).state p.2)).val.val y))) + (W : PositiveHilbertMeasure (S×X) (HilbertTensor L K) (tensorHilbertBasis d c)) + [IsProbabilityMeasure W.traceMeasure] + (hEvent : ∀ A B, MeasurableSet A → MeasurableSet B → ∀ x y, + W.coeff x y (A ×ˢ B)=∫ h in A, + inner ℂ x (((G h).event B (densityTensor d b (σ h) (ρ h)).val).val y) ∂μ) : + W.traceMeasure=μ ⊗ₘ TraceInstrument.historyKernel J ρ hm ∧ + ∀ Z, MeasurableSet Z → ∀ x y, W.coeff x y Z= + ∫ p in Z, inner ℂ x ((densityTensor d c (σ p.1) ((U p.1).state p.2)).val.val y) + ∂(μ ⊗ₘ TraceInstrument.historyKernel J ρ hm) := by + let ν := μ ⊗ₘ TraceInstrument.historyKernel J ρ hm + let f := fun p : S×X => densityTensor d c (σ p.1) ((U p.1).state p.2) + have hd (Z : Set (S×X)) (hZ : MeasurableSet Z) (x y : HilbertTensor L K) : + W.coeff x y Z=∫ p in Z, inner ℂ x ((f p).val.val y) ∂ν := by + have hi := density_coefficient_integrable (tensorHilbertBasis d c) ν f hp x y + have he : W.coeff x y=ν.withDensityᵥ (fun p => inner ℂ x ((f p).val.val y)) := by + apply complexMeasure_ext_rectangles + intro A B hA hB + rw [withDensityᵥ_apply hi (hA.prod hB)] + change W.coeff x y (A ×ˢ B)=(∫ p in A ×ˢ B, inner ℂ x ((f p).val.val y) + ∂(μ ⊗ₘ TraceInstrument.historyKernel J ρ hm)) + rw [Measure.setIntegral_compProd hA hB hi.integrableOn,hEvent A B hA hB x y] + apply setIntegral_congr_fun hA + intro h hh + exact physical_right_disintegration_all b c d (J h) (ρ h) (σ h) (U h) hB + ((G h).event B) (hG h B hB) x y + rw [he,withDensityᵥ_apply hi hZ] + exact ⟨weak_density_trace_eq (tensorHilbertBasis d c) W ν f hp hd,hd⟩ + +end SecretKey + +end + +end OAI diff --git a/lean/OAI/InformationTheory/Entanglement/PhysicalRightStep.lean b/lean/OAI/InformationTheory/Entanglement/PhysicalRightStep.lean new file mode 100644 index 0000000000000000000000000000000000000000..388b3b1ba9972c132e882d8d121ebf4dc2e7ddbe --- /dev/null +++ b/lean/OAI/InformationTheory/Entanglement/PhysicalRightStep.lean @@ -0,0 +1,117 @@ +import OAI.InformationTheory.Entanglement.PhysicalAdaptiveStep + +namespace OAI + +noncomputable section +open scoped TensorProduct InnerProductSpace ComplexOrder MeasureTheory +open ContinuousLinearMap UniformSpace MeasureTheory ProbabilityTheory +namespace SecretKey +variable {H K L : Type*} + [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + [NormedAddCommGroup K] [InnerProductSpace ℂ K] [CompleteSpace K] + [NormedAddCommGroup L] [InnerProductSpace ℂ L] [CompleteSpace L] +variable {ι κ υ : Type*} + +def IsRightTraceAction (b : HilbertBasis ι ℂ H) (c : HilbertBasis κ ℂ K) + (d : HilbertBasis υ ℂ L) (F : TraceClass b →ₗ[ℂ] TraceClass c) + (G : TraceClass (tensorHilbertBasis d b) →ₗ[ℂ] TraceClass (tensorHilbertBasis d c)) : Prop := + ∀ A B, G (traceTensor d b B A)=traceTensor d c B (F A) +variable {X : Type*} [MeasurableSpace X] +lemma physical_right_born (b : HilbertBasis ι ℂ H) (c : HilbertBasis κ ℂ K) + (d : HilbertBasis υ ℂ L) (I : TraceInstrument b c X) + (ρ : DensityOperator b) (σ : DensityOperator d) {s : Set X} (hs : MeasurableSet s) + (G : TraceClass (tensorHilbertBasis d b) →ₗ[ℂ] TraceClass (tensorHilbertBasis d c)) + (hG : IsRightTraceAction b c d (I.event s) G) : + (traceClassTrace (tensorHilbertBasis d c) (G (densityTensor d b σ ρ).val)).re= + (I.outcome ρ).real s := by + change (traceClassTrace (tensorHilbertBasis d c) (G (traceTensor d b σ.val ρ.val))).re=_ + rw [hG,traceTensor_trace,σ.property.2,one_mul,I.outcome_born ρ hs] +lemma physical_right_disintegration (b : HilbertBasis ι ℂ H) (c : HilbertBasis κ ℂ K) + (d : HilbertBasis υ ℂ L) (I : TraceInstrument b c X) + (ρ : DensityOperator b) (σ : DensityOperator d) (U : I.ConditionalUpdate ρ) + {s : Set X} (hs : MeasurableSet s) + (G : TraceClass (tensorHilbertBasis d b) →ₗ[ℂ] TraceClass (tensorHilbertBasis d c)) + (hG : IsRightTraceAction b c d (I.event s) G) (x y : K) (u v : L) : + inner ℂ (hilbertTmul u x) ((G (densityTensor d b σ ρ).val).val (hilbertTmul v y))= + ∫ z in s, inner ℂ (hilbertTmul u x) + ((densityTensor d c σ (U.state z)).val.val (hilbertTmul v y)) ∂I.outcome ρ := by + change inner ℂ (hilbertTmul u x) ((G (traceTensor d b σ.val ρ.val)).val (hilbertTmul v y))=_ + rw [hG] + change inner ℂ (hilbertTmul u x) (hilbertTensorMap σ.val.val (I.event s ρ.val).val (hilbertTmul v y))=_ + rw [hilbertTensorMap_tmul,hilbertTmul_inner,U.disintegration s hs] + erw [← integral_const_mul] + apply setIntegral_congr_fun hs + intro z hz + simp [densityTensor,traceTensor,hilbertTmul_inner] +lemma physical_right_disintegration_all (b : HilbertBasis ι ℂ H) (c : HilbertBasis κ ℂ K) + (d : HilbertBasis υ ℂ L) (I : TraceInstrument b c X) + (ρ : DensityOperator b) (σ : DensityOperator d) (U : I.ConditionalUpdate ρ) + {s : Set X} (hs : MeasurableSet s) + (G : TraceClass (tensorHilbertBasis d b) →ₗ[ℂ] TraceClass (tensorHilbertBasis d c)) + (hG : IsRightTraceAction b c d (I.event s) G) + (x y : HilbertTensor L K) : + inner ℂ x ((G (densityTensor d b σ ρ).val).val y)= + ∫ z in s, inner ℂ x ((densityTensor d c σ (U.state z)).val.val y) ∂I.outcome ρ := by + let R := fun z => densityTensor d c σ (U.state z) + have hR : ∀ a a', Measurable (fun z => inner ℂ a ((R z).val.val a')) := + densityTensor_coefficient_measurable d c (fun _ => σ) U.state + (fun _ _ => measurable_const) U.coefficient_measurable + let μ := (I.outcome ρ).restrict s + let T := (G (densityTensor d b σ ρ).val).val + have hI (a a') : Integrable (fun z => inner ℂ a ((R z).val.val a')) μ := + density_coefficient_integrable (tensorHilbertBasis d c) μ R hR a a' + have hleft (a : L) (v : K) (z : HilbertTensor L K) : + inner ℂ z (T (hilbertTmul a v))=∫ t, inner ℂ z ((R t).val.val (hilbertTmul a v)) ∂μ := by + refine Completion.induction_on z (isClosed_eq (by fun_prop) + (densityIntegral_left_continuous (tensorHilbertBasis d c) μ R hR _)) ?_ + intro t + induction t using TensorProduct.inductionOn with + | tmul p q => exact physical_right_disintegration b c d I ρ σ U hs G hG q v p a + | add p q hp hq => + simp only [Completion.coe_add,inner_add_left,integral_add (hI _ _) (hI _ _),hp,hq] + change inner ℂ x (T y)=∫ t, inner ℂ x ((R t).val.val y) ∂μ + refine Completion.induction_on y (isClosed_eq (by fun_prop) + (densityIntegral_right_continuous (tensorHilbertBasis d c) μ R hR x)) ?_ + intro t + induction t using TensorProduct.inductionOn with + | tmul p q => exact hleft p q x + | add p q hp hq => + simp only [Completion.coe_add,map_add,inner_add_right,integral_add (hI _ _) (hI _ _),hp,hq] + +lemma physical_right_outcome (b : HilbertBasis ι ℂ H) (c : HilbertBasis κ ℂ K) + (d : HilbertBasis υ ℂ L) (I : TraceInstrument b c X) + (G : TraceInstrument (tensorHilbertBasis d b) (tensorHilbertBasis d c) X) + (hG : ∀ s, MeasurableSet s → IsRightTraceAction b c d (I.event s) (G.event s)) + (ρ : DensityOperator b) (σ : DensityOperator d) : + G.outcome (densityTensor d b σ ρ)=I.outcome ρ := by + apply Measure.ext + intro s hs + apply (ENNReal.toReal_eq_toReal_iff' (measure_ne_top _ _) (measure_ne_top _ _)).mp + change (G.outcome (densityTensor d b σ ρ)).real s=(I.outcome ρ).real s + rw [G.outcome_born _ hs] + exact physical_right_born b c d I ρ σ hs (G.event s) (hG s hs) + +def physical_right_update (b : HilbertBasis ι ℂ H) (c : HilbertBasis κ ℂ K) + (d : HilbertBasis υ ℂ L) (I : TraceInstrument b c X) + (G : TraceInstrument (tensorHilbertBasis d b) (tensorHilbertBasis d c) X) + (hG : ∀ s, MeasurableSet s → IsRightTraceAction b c d (I.event s) (G.event s)) + (ρ : DensityOperator b) (σ : DensityOperator d) (U : I.ConditionalUpdate ρ) : + G.ConditionalUpdate (densityTensor d b σ ρ) where + state z := densityTensor d c σ (U.state z) + coefficient_measurable := densityTensor_coefficient_measurable d c (fun _ => σ) U.state + (fun _ _ => measurable_const) U.coefficient_measurable + coefficient_integrable x y := by + rw [physical_right_outcome b c d I G hG ρ σ] + exact density_coefficient_integrable (tensorHilbertBasis d c) (I.outcome ρ) + (fun z => densityTensor d c σ (U.state z)) + (densityTensor_coefficient_measurable d c (fun _ => σ) U.state + (fun _ _ => measurable_const) U.coefficient_measurable) x y + disintegration s hs x y := by + rw [physical_right_outcome b c d I G hG ρ σ] + exact physical_right_disintegration_all b c d I ρ σ U hs (G.event s) (hG s hs) x y + +end SecretKey + +end + +end OAI diff --git a/lean/OAI/InformationTheory/Entanglement/PhysicalVersion.lean b/lean/OAI/InformationTheory/Entanglement/PhysicalVersion.lean new file mode 100644 index 0000000000000000000000000000000000000000..6f584a16e9733c7eff8cd8b75fbdaf02ae2e4032 --- /dev/null +++ b/lean/OAI/InformationTheory/Entanglement/PhysicalVersion.lean @@ -0,0 +1,29 @@ +import OAI.InformationTheory.Entanglement.WeakStateUnique + +namespace OAI + +noncomputable section +open scoped InnerProductSpace ComplexOrder MeasureTheory +open ContinuousLinearMap MeasureTheory +namespace SecretKey +variable {H K L : Type*} + [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + [NormedAddCommGroup K] [InnerProductSpace ℂ K] [CompleteSpace K] + [NormedAddCommGroup L] [InnerProductSpace ℂ L] [CompleteSpace L] +variable {ι κ υ X : Type*} [MeasurableSpace X] + +theorem physical_product_version (b : HilbertBasis ι ℂ H) (c : HilbertBasis κ ℂ K) + (d : HilbertBasis υ ℂ L) (I : TraceInstrument b c X) + (G : TraceInstrument (tensorHilbertBasis b d) (tensorHilbertBasis c d) X) + (hG : ∀ s, MeasurableSet s → IsLeftTraceAction b c d (I.event s) (G.event s)) + (ρ : DensityOperator b) (σ : DensityOperator d) (U : I.ConditionalUpdate ρ) + (V : G.ConditionalUpdate (densityTensor b d ρ σ)) : + V.state=ᵐ[G.outcome (densityTensor b d ρ σ)] + (fun z => densityTensor c d (U.state z) σ) := + V.ae_unique (physical_product_update b c d I G hG ρ σ U) + +end SecretKey + +end + +end OAI diff --git a/lean/OAI/InformationTheory/Entanglement/PolynomialGcdDegree.lean b/lean/OAI/InformationTheory/Entanglement/PolynomialGcdDegree.lean new file mode 100644 index 0000000000000000000000000000000000000000..d49d62879dbb10b8900152eaf0a1d20851757c01 --- /dev/null +++ b/lean/OAI/InformationTheory/Entanglement/PolynomialGcdDegree.lean @@ -0,0 +1,50 @@ +import OAI.Analysis.Quantum.PPTSquare.Mod131Powers01 +import OAI.Analysis.Quantum.PPTSquare.Mod131Powers02 +import OAI.Analysis.Quantum.PPTSquare.Mod131Powers03 +import OAI.Analysis.Quantum.PPTSquare.Mod131Powers04 +import OAI.Analysis.Quantum.PPTSquare.Mod131Data +import OAI.Analysis.Quantum.PPTSquare.Mod131Products +import OAI.Analysis.Quantum.PPTSquare.Mod131Reduction +import OAI.Analysis.Quantum.PPTSquare.Mod139Powers01 +import OAI.Analysis.Quantum.PPTSquare.Mod139Powers02 +import OAI.Analysis.Quantum.PPTSquare.Mod139Powers03 +import OAI.Analysis.Quantum.PPTSquare.Mod139Powers04 +import OAI.Analysis.Quantum.PPTSquare.Mod139Powers05 +import OAI.Analysis.Quantum.PPTSquare.Mod139Data +import OAI.Analysis.Quantum.PPTSquare.Mod139Products +import OAI.Analysis.Quantum.PPTSquare.Mod139Reduction +import OAI.Analysis.Quantum.PPTSquare.Mod41Powers01 +import OAI.Analysis.Quantum.PPTSquare.Mod41Powers02 +import OAI.Analysis.Quantum.PPTSquare.Mod41Powers03 +import OAI.Analysis.Quantum.PPTSquare.Mod41Powers04 +import OAI.Analysis.Quantum.PPTSquare.Mod41Powers05 +import OAI.Analysis.Quantum.PPTSquare.Mod41Powers06 +import OAI.Analysis.Quantum.PPTSquare.Mod41Data +import OAI.Analysis.Quantum.PPTSquare.Mod41Products +import OAI.Analysis.Quantum.PPTSquare.Mod41Reduction +import OAI.Analysis.Quantum.PPTSquare.ModularSupport +import OAI.Analysis.Quantum.PPTSquare.GaloisAction + +namespace OAI + +open Polynomial +noncomputable section +namespace PolynomialGcdDegree +attribute [local instance] Classical.propDecidable +local instance : Fact (Nat.Prime 41) := ⟨by decide⟩ +def dg (e : ℕ) : Prop := (EuclideanDomain.gcd ModularPencil.P41.f (X^e-X)).natDegree = 0 +def dgc (e : ℕ) : Prop := by + classical + exact (EuclideanDomain.gcd ModularPencil.P41.f (X^e-X)).natDegree = 0 +lemma bridge (e n : ℕ) (h : ModularPencil.P41.degreeCert e n) : + (EuclideanDomain.gcd ModularPencil.P41.f (X^e-X)).natDegree = n := by + unfold ModularPencil.P41.degreeCert at h + convert h using 2 +lemma concrete : dg (41^4) := by + exact bridge (41^4) 0 ModularPencil.P41.gcd_degree4 + +end PolynomialGcdDegree + +end + +end OAI diff --git a/lean/OAI/InformationTheory/Entanglement/PositiveBlock.lean b/lean/OAI/InformationTheory/Entanglement/PositiveBlock.lean new file mode 100644 index 0000000000000000000000000000000000000000..760c4c3740998876caf25252022735d3a3b5cdf9 --- /dev/null +++ b/lean/OAI/InformationTheory/Entanglement/PositiveBlock.lean @@ -0,0 +1,79 @@ +import OAI.InformationTheory.Entanglement.TraceNorm + +namespace OAI + +noncomputable section +open scoped MatrixOrder ComplexOrder BigOperators Kronecker +open Matrix +namespace SecretKey +variable {n m k : Type} [Fintype n] [Fintype m] [Fintype k] + +def hsVector (A : Matrix n m ℂ) : EuclideanSpace ℂ (n × m) := + WithLp.toLp 2 (fun p => A p.1 p.2) +def hsNorm (A : Matrix n m ℂ) : ℝ := ‖hsVector A‖ + +lemma trace_mul_conj_eq_inner (A B : Matrix n m ℂ) : + Matrix.trace (A * Bᴴ) = inner ℂ (hsVector B) (hsVector A) := by + simp [Matrix.trace, Matrix.mul_apply, Matrix.conjTranspose_apply, hsVector, + PiLp.inner_apply, Fintype.sum_prod_type, RCLike.inner_apply] + +lemma hsNorm_sq (A : Matrix n m ℂ) : + hsNorm A ^ 2 = (Matrix.trace (A * Aᴴ)).re := by + rw [trace_mul_conj_eq_inner] + exact norm_sq_eq_re_inner (𝕜 := ℂ) _ + +lemma trace_mul_conj_norm_le (A B : Matrix n m ℂ) : + ‖Matrix.trace (A * Bᴴ)‖ ≤ hsNorm A * hsNorm B := by + rw [trace_mul_conj_eq_inner] + simpa [hsNorm, mul_comm] using norm_inner_le_norm (hsVector B) (hsVector A) + +lemma hsNorm_unitary [DecidableEq n] {U : Matrix n n ℂ} (hU : Uᴴ * U = 1) + (A : Matrix n m ℂ) : hsNorm (U * A) = hsNorm A := by + apply (sq_eq_sq₀ (norm_nonneg _) (norm_nonneg _)).mp + change hsNorm (U * A) ^ 2 = hsNorm A ^ 2 + rw [hsNorm_sq, hsNorm_sq, Matrix.conjTranspose_mul] + congr 1 + calc + Matrix.trace (U * A * (Aᴴ * Uᴴ)) = Matrix.trace (U * (A * Aᴴ) * Uᴴ) := by + simp only [Matrix.mul_assoc] + _ = Matrix.trace (Uᴴ * U * (A * Aᴴ)) := Matrix.trace_mul_cycle _ _ _ + _ = Matrix.trace (A * Aᴴ) := by rw [hU, Matrix.one_mul] + +lemma traceNorm_mul_conj_le [DecidableEq n] (A B : Matrix n m ℂ) : + traceNorm (A * Bᴴ) ≤ hsNorm A * hsNorm B := by + obtain ⟨U,hU,he⟩ := traceNorm_witness (A * Bᴴ) + rw [he, ← Matrix.mul_assoc] + exact (Complex.re_le_norm _).trans + ((trace_mul_conj_norm_le (U * A) B).trans_eq (by rw [hsNorm_unitary hU])) + +lemma traceNorm_mul_conj_le_sqrt [DecidableEq n] (A B : Matrix n m ℂ) : + traceNorm (A * Bᴴ) ≤ Real.sqrt ((Matrix.trace (A * Aᴴ)).re * (Matrix.trace (B * Bᴴ)).re) := by + rw [← hsNorm_sq, ← hsNorm_sq, ← mul_pow, Real.sqrt_sq_eq_abs, abs_of_nonneg (show 0 ≤ hsNorm A * hsNorm B from mul_nonneg (norm_nonneg _) (norm_nonneg _))] + exact traceNorm_mul_conj_le A B + +lemma positive_block [DecidableEq n] (H J Z : Matrix n n ℂ) + (h : (Matrix.fromBlocks H Z Zᴴ J).PosSemidef) : + traceNorm Z ≤ Real.sqrt ((Matrix.trace H).re * (Matrix.trace J).re) := by + let Q := CFC.sqrt (Matrix.fromBlocks H Z Zᴴ J) + have hQh : Qᴴ = Q := + (Matrix.nonneg_iff_posSemidef.mp (CFC.sqrt_nonneg _)).isHermitian.eq + have hQ : Q * Qᴴ = Matrix.fromBlocks H Z Zᴴ J := by + rw [hQh] + exact CFC.sqrt_mul_sqrt_self _ h.nonneg + let A : Matrix n (n ⊕ n) ℂ := fun i j => Q (Sum.inl i) j + let B : Matrix n (n ⊕ n) ℂ := fun i j => Q (Sum.inr i) j + have hA : A * Aᴴ = H := by + ext i j + exact congrArg (fun M => M (Sum.inl i) (Sum.inl j)) hQ + have hB : B * Bᴴ = J := by + ext i j + exact congrArg (fun M => M (Sum.inr i) (Sum.inr j)) hQ + have hZ : A * Bᴴ = Z := by + ext i j + exact congrArg (fun M => M (Sum.inl i) (Sum.inr j)) hQ + simpa only [hA,hB,hZ] using traceNorm_mul_conj_le_sqrt A B +end SecretKey + +end + +end OAI diff --git a/lean/OAI/InformationTheory/Entanglement/PowersStormer.lean b/lean/OAI/InformationTheory/Entanglement/PowersStormer.lean new file mode 100644 index 0000000000000000000000000000000000000000..79f846c68fcfc85aa78f4e526b7b63d359f90914 --- /dev/null +++ b/lean/OAI/InformationTheory/Entanglement/PowersStormer.lean @@ -0,0 +1,109 @@ +import OAI.InformationTheory.Entanglement.FidelityTools + +namespace OAI + +noncomputable section +open scoped BigOperators ComplexOrder MatrixOrder Kronecker +open Matrix +namespace SecretKey +open ChannelCompletion TensorCriterion +variable {n : Type} [Fintype n] [DecidableEq n] + +omit [Fintype n] [DecidableEq n] in +lemma psd_diagonal_real {A : Mat n} (hA : A.PosSemidef) (i : n) : + 0≤(A i i).re := (Complex.nonneg_iff.mp (hA.diag_nonneg (i := i))).1 + +lemma powers_stormer_diagonal {A B : Mat n} (hA : A.PosSemidef) (hB : B.PosSemidef) + (z : n → ℝ) (hz : A-B=Matrix.diagonal (fun i => (z i : ℂ))) : + ∑ i, (z i)^2 ≤ traceNorm (A*A-B*B) := by + let ε : n → ℝ := fun i => if z i<0 then -1 else 1 + have hε (i : n) : ε i * z i=|z i| := by + dsimp [ε] + split_ifs with hi + · rw [abs_of_neg hi]; ring + · rw [abs_of_nonneg (le_of_not_gt hi)]; ring + have hεsq (i : n) : ε i*ε i=1 := by dsimp [ε]; split_ifs <;> norm_num + let S : Mat n := Matrix.diagonal (fun i => (ε i : ℂ)) + have hS : Sᴴ*S=1 := by + simp only [S,Matrix.diagonal_conjTranspose, + Matrix.diagonal_mul_diagonal] + ext i j + by_cases h : i=j + · subst j + simp only [Matrix.diagonal_apply_eq,Matrix.one_apply_eq,Pi.star_apply,Complex.star_def,Complex.conj_ofReal,← Complex.ofReal_mul,hεsq, + Complex.ofReal_one] + · simp [Matrix.diagonal_apply_ne _ h,Matrix.one_apply_ne h] + have he : A*A-B*B=(A-B)*A+B*(A-B) := by noncomm_ring + have ht : (Matrix.trace (S*(A*A-B*B))).re = + ∑ i, |z i| *((A i i).re+(B i i).re) := by + rw [he,hz] + change (∑ i, (S*((diagonal (fun j => (z j : ℂ)))*A+B*diagonal (fun j => (z j : ℂ)))) i i).re = _ + rw [Complex.re_sum] + apply Finset.sum_congr rfl + intro i _ + simp only [S,Matrix.add_apply,Matrix.diagonal_mul,Matrix.mul_diagonal, + Complex.add_re,Complex.mul_re,Complex.ofReal_re,Complex.ofReal_im,zero_mul,mul_zero, + sub_zero] + calc + ε i * (z i*(A i i).re+(B i i).re*z i)= + (ε i*z i)*((A i i).re+(B i i).re) := by ring + _ = _ := by rw [hε] + have hdiag (i : n) : (A i i).re-(B i i).re=z i := by + have h := congrArg (fun M : Mat n => (M i i).re) hz + simpa only [Matrix.sub_apply,Complex.sub_re,Matrix.diagonal_apply_eq,Complex.ofReal_re] using h + have hi (i : n) : (z i)^2 ≤ |z i| *((A i i).re+(B i i).re) := by + have habs : |z i| ≤ (A i i).re+(B i i).re := abs_le.mpr ⟨by + linarith [hdiag i,psd_diagonal_real hA i,psd_diagonal_real hB i],by + linarith [hdiag i,psd_diagonal_real hA i,psd_diagonal_real hB i]⟩ + have h := mul_le_mul_of_nonneg_left habs (abs_nonneg (z i)) + nlinarith [sq_abs (z i)] + calc + ∑ i, (z i)^2 ≤ ∑ i, |z i| *((A i i).re+(B i i).re) := + Finset.sum_le_sum (fun i _ => hi i) + _ = (Matrix.trace (S*(A*A-B*B))).re := ht.symm + _ ≤ ‖Matrix.trace (S*(A*A-B*B))‖ := Complex.re_le_norm _ + _ ≤ traceNorm (A*A-B*B) := trace_unitary_norm_le _ hS + +lemma powers_stormer {A B : Mat n} (hA : A.PosSemidef) (hB : B.PosSemidef) : + (Matrix.trace ((A-B)*(A-B))).re ≤ traceNorm (A*A-B*B) := by + let Z := A-B + have hZ : Z.IsHermitian := hA.isHermitian.sub hB.isHermitian + obtain ⟨U,hU,hdiag⟩ := unitary_spectral hZ + let a := Uᴴ*A*U + let b := Uᴴ*B*U + have ha : a.PosSemidef := hA.conjTranspose_mul_mul_same U + have hb : b.PosSemidef := hB.conjTranspose_mul_mul_same U + have hab : a-b=diagonal (fun i => (hZ.eigenvalues i : ℂ)) := by + rw [← hdiag] + simp only [a,b,Z,Matrix.mul_sub,Matrix.sub_mul] + have h := powers_stormer_diagonal ha hb hZ.eigenvalues hab + have he : a*a-b*b=Uᴴ*(A*A-B*B)*U := by + dsimp only [a,b] + rw [unitary_conj_mul hU,unitary_conj_mul hU,Matrix.mul_sub,Matrix.sub_mul] + rw [he,unitary_traceNorm_conj hU] at h + have ht : (Matrix.trace ((A-B)*(A-B))).re=∑ i, (hZ.eigenvalues i)^2 := by + rw [← unitary_trace_conj hU ((A-B)*(A-B)),← unitary_conj_mul hU] + change (Matrix.trace ((Uᴴ*Z*U)*(Uᴴ*Z*U))).re=_ + rw [hdiag,Matrix.diagonal_mul_diagonal,Matrix.trace_diagonal,Complex.re_sum] + simp only [Complex.mul_re,Complex.ofReal_re,Complex.ofReal_im,mul_zero,sub_zero,pow_two] + rwa [ht] + +lemma fidelity_lower {H J : Mat n} (hH : H.PosSemidef) (hJ : J.PosSemidef) : + ((Matrix.trace H).re+(Matrix.trace J).re-traceNorm (H-J))/2 ≤ fidelity H J := by + have h := powers_stormer (sqrt_psd H) (sqrt_psd J) + rw [CFC.sqrt_mul_sqrt_self H hH.nonneg,CFC.sqrt_mul_sqrt_self J hJ.nonneg] at h + have he : (Matrix.trace ((CFC.sqrt H-CFC.sqrt J)*(CFC.sqrt H-CFC.sqrt J))).re = + (Matrix.trace H).re+(Matrix.trace J).re-2*(Matrix.trace (CFC.sqrt H*CFC.sqrt J)).re := by + simp only [Matrix.mul_sub,Matrix.sub_mul,Matrix.trace_sub,Complex.sub_re, + CFC.sqrt_mul_sqrt_self H hH.nonneg,CFC.sqrt_mul_sqrt_self J hJ.nonneg] + rw [Matrix.trace_mul_comm (CFC.sqrt J)] + ring + rw [he] at h + have hf := trace_re_le_traceNorm (CFC.sqrt H*CFC.sqrt J) + dsimp [fidelity] + linarith +end SecretKey + +end + +end OAI diff --git a/lean/OAI/InformationTheory/Entanglement/ProbeDensity.lean b/lean/OAI/InformationTheory/Entanglement/ProbeDensity.lean new file mode 100644 index 0000000000000000000000000000000000000000..52cff7dbc3ba00a5b2d6b16add488dd2d3a86228 --- /dev/null +++ b/lean/OAI/InformationTheory/Entanglement/ProbeDensity.lean @@ -0,0 +1,51 @@ +import OAI.InformationTheory.Entanglement.ConditionalUpdate +import OAI.InformationTheory.Entanglement.MatrixFamilyDensity +import OAI.InformationTheory.Entanglement.ProbePOVM + +namespace OAI + +noncomputable section +open MeasureTheory ProbabilityTheory Filter Set +open scoped BigOperators MeasureTheory ProbabilityTheory +namespace SecretKey +variable {Ω T : Type*} {mΩ : MeasurableSpace Ω} [MeasurableSpace T] +variable {ν : Measure Ω} [IsFiniteMeasure ν] {t : Ω → T} (ht : Measurable t) +include ht in + +lemma transcript_density_condExp {a : Set Ω} (ha : MeasurableSet a) + {f : T → ℝ} (hfm : Measurable f) (hfi : Integrable f ((@Measure.map Ω T mΩ _ t ν))) + (hf : ∀ s, MeasurableSet s → (∫ u in s, f u ∂(@Measure.map Ω T mΩ _ t ν))=ν.real (a∩t⁻¹' s)) : + (fun x => f (t x)) =ᵐ[ν] (ν⟦a | MeasurableSpace.comap t inferInstance⟧) := by + have hsub : MeasurableSpace.comap t inferInstance ≤ mΩ := ht.comap_le + have hcomp : Integrable (fun x => f (t x)) ν := (integrable_map_measure hfm.aestronglyMeasurable ht.aemeasurable).mp hfi + apply ae_eq_condExp_of_forall_setIntegral_eq hsub ((integrable_const (1 : ℝ)).indicator ha) + · intro s hs _ + exact hcomp.integrableOn + · intro s hs _ + obtain ⟨u,hu,rfl⟩ := hs + rw [← setIntegral_map hu hfm.aestronglyMeasurable ht.aemeasurable,hf u hu] + simp [integral_indicator ha, measureReal_def, Measure.restrict_apply ha,Set.inter_comm] + · exact (hfm.comp (comap_measurable t)).stronglyMeasurable.aestronglyMeasurable + +lemma independent_transcript_densities [StandardBorelSpace Ω] + {A B : MeasurableSpace Ω} (hA : A ≤ mΩ) (hB : B ≤ mΩ) + (hind : CondIndep (MeasurableSpace.comap t inferInstance) A B ht.comap_le ν) + {a b : Set Ω} (ha : MeasurableSet[A] a) (hb : MeasurableSet[B] b) + {f g h : T → ℝ} (hfm : Measurable f) (hgm : Measurable g) (hhm : Measurable h) + (hfi : Integrable f ((@Measure.map Ω T mΩ _ t ν))) (hgi : Integrable g ((@Measure.map Ω T mΩ _ t ν))) + (hhi : Integrable h ((@Measure.map Ω T mΩ _ t ν))) + (hf : ∀ s, MeasurableSet s → (∫ u in s, f u ∂(@Measure.map Ω T mΩ _ t ν))=ν.real (a∩t⁻¹' s)) + (hg : ∀ s, MeasurableSet s → (∫ u in s, g u ∂(@Measure.map Ω T mΩ _ t ν))=ν.real (b∩t⁻¹' s)) + (hh : ∀ s, MeasurableSet s → (∫ u in s, h u ∂(@Measure.map Ω T mΩ _ t ν))=ν.real ((a∩b)∩t⁻¹' s)) : + h =ᵐ[(@Measure.map Ω T mΩ _ t ν)] f*g := by + have he := (condIndep_iff _ _ _ ht.comap_le hA hB ν).mp hind a b ha hb + have hf' := transcript_density_condExp ht (hA a ha) hfm hfi hf + have hg' := transcript_density_condExp ht (hB b hb) hgm hgi hg + have hh' := transcript_density_condExp ht ((hA a ha).inter (hB b hb)) hhm hhi hh + apply (ae_map_iff ht.aemeasurable (measurableSet_eq_fun hhm (hfm.mul hgm))).mpr + exact hh'.trans (he.trans (hf'.mul hg').symm) +end SecretKey + +end + +end OAI diff --git a/lean/OAI/InformationTheory/Entanglement/ProbeFactorization.lean b/lean/OAI/InformationTheory/Entanglement/ProbeFactorization.lean new file mode 100644 index 0000000000000000000000000000000000000000..8cafaa5d1bb44f8c43f6cffc5667911bcddebb27 --- /dev/null +++ b/lean/OAI/InformationTheory/Entanglement/ProbeFactorization.lean @@ -0,0 +1,82 @@ +import OAI.InformationTheory.Entanglement.ProbeDensity + +namespace OAI + +noncomputable section +open scoped BigOperators ComplexOrder MatrixOrder Kronecker +open Matrix MeasureTheory ProbabilityTheory Filter Set +namespace SecretKey +open ChannelCompletion +variable {n m : Type} [Fintype n] [Fintype m] [DecidableEq n] [DecidableEq m] +lemma trace_mul_psd_eq_real {E W : Mat n} (hE : E.PosSemidef) (hW : W.PosSemidef) : + Matrix.trace (E*W)=((Matrix.trace (E*W)).re : ℂ) := by + apply Complex.ext + · rfl + rw [Complex.ofReal_im] + rw [← trace_filter hE] + exact (Complex.nonneg_iff.mp (hW.mul_mul_conjTranspose_same _).trace_nonneg).2.symm +variable {T : Type*} [MeasurableSpace T] {μ : Measure T} +omit [DecidableEq n] in +lemma integrable_test_trace (E : Mat n) {W : T → Mat n} + (hW : ∀ a b, Integrable (fun t => W t a b) μ) : + Integrable (fun t => (Matrix.trace (E*W t)).re) μ := by + have h : Integrable (fun t => Matrix.trace (E*W t)) μ := by + simp only [Matrix.trace,Matrix.diag,Matrix.mul_apply] + exact integrable_finsetSum _ fun a _ => integrable_finsetSum _ fun b _ => (hW b a).const_mul _ + exact h.re +omit [DecidableEq n] in +lemma measurable_test_trace (E : Mat n) {W : T → Mat n} (hW : Measurable W) : + Measurable (fun t => (Matrix.trace (E*W t)).re) := by + have hc : Continuous (fun M : Mat n => (Matrix.trace (E*M)).re) := by fun_prop + exact hc.measurable.comp hW +variable {Ω : Type*} {mΩ : MeasurableSpace Ω} [StandardBorelSpace Ω] +variable {ν : Measure Ω} [IsFiniteMeasure ν] {t : Ω → T} + +theorem probe_density_product (ht : Measurable t) + {A B : MeasurableSpace Ω} (hA : A ≤ mΩ) (hB : B ≤ mΩ) + (hind : CondIndep (MeasurableSpace.comap t inferInstance) A B ht.comap_le ν) + (a : Fin 2 → Option (PositiveTestIndex n) → Set Ω) + (b : Fin 2 → Option (PositiveTestIndex m) → Set Ω) + (ha : ∀ i e, MeasurableSet[A] (a i e)) (hb : ∀ j g, MeasurableSet[B] (b j g)) + (U : Fin 2 → T → Mat n) (V : Fin 2 → T → Mat m) + (W : Fin 2 → Fin 2 → T → Mat (n×m)) + (hUp : ∀ i u, (U i u).PosSemidef) (hVp : ∀ j u, (V j u).PosSemidef) + (hWp : ∀ i j u, (W i j u).PosSemidef) + (hUm : ∀ i, Measurable (U i)) (hVm : ∀ j, Measurable (V j)) + (hWm : ∀ i j, Measurable (W i j)) + (hUi : ∀ i a b, Integrable (fun u => U i u a b) (@Measure.map Ω T mΩ _ t ν)) + (hVi : ∀ j a b, Integrable (fun u => V j u a b) (@Measure.map Ω T mΩ _ t ν)) + (hWi : ∀ i j a b, Integrable (fun u => W i j u a b) (@Measure.map Ω T mΩ _ t ν)) + (hUlaw : ∀ i e s, MeasurableSet s → + (∫ u in s, (Matrix.trace (probePOVM e*U i u)).re ∂(@Measure.map Ω T mΩ _ t ν))= + ν.real (a i e∩t⁻¹' s)) + (hVlaw : ∀ j g s, MeasurableSet s → + (∫ u in s, (Matrix.trace (probePOVM g*V j u)).re ∂(@Measure.map Ω T mΩ _ t ν))= + ν.real (b j g∩t⁻¹' s)) + (hWlaw : ∀ i j e g s, MeasurableSet s → + (∫ u in s, (Matrix.trace ((probePOVM e ⊗ₖ probePOVM g)*W i j u)).re + ∂(@Measure.map Ω T mΩ _ t ν))=ν.real ((a i e∩b j g)∩t⁻¹' s)) : + ∀ᵐ u ∂(@Measure.map Ω T mΩ _ t ν), ∀ i j, W i j u=U i u ⊗ₖ V j u := by + have he (i j : Fin 2) (e : Option (PositiveTestIndex n)) (g : Option (PositiveTestIndex m)) : + (fun u => (Matrix.trace ((probePOVM e ⊗ₖ probePOVM g)*W i j u)).re)=ᵐ[(@Measure.map Ω T mΩ _ t ν)] + (fun u => (Matrix.trace (probePOVM e*U i u)).re*(Matrix.trace (probePOVM g*V j u)).re) := by + exact independent_transcript_densities ht hA hB hind (ha i e) (hb j g) + (measurable_test_trace _ (hUm i)) (measurable_test_trace _ (hVm j)) + (measurable_test_trace _ (hWm i j)) + (integrable_test_trace _ (hUi i)) (integrable_test_trace _ (hVi j)) + (integrable_test_trace _ (hWi i j)) (hUlaw i e) (hVlaw j g) (hWlaw i j e g) + have hall := ae_all_iff.mpr (fun i => ae_all_iff.mpr (fun j => + ae_all_iff.mpr (fun e => ae_all_iff.mpr (he i j e)))) + filter_upwards [hall] with u hu + intro i j + apply tensor_product_of_probePOVM + intro e g + rw [trace_mul_psd_eq_real ((probePOVM_psd e).kronecker (probePOVM_psd g)) (hWp i j u), + trace_mul_psd_eq_real (probePOVM_psd e) (hUp i u), + trace_mul_psd_eq_real (probePOVM_psd g) (hVp j u),← Complex.ofReal_mul,hu i j e g] + +end SecretKey + +end + +end OAI diff --git a/lean/OAI/InformationTheory/Entanglement/ProbeMatrices.lean b/lean/OAI/InformationTheory/Entanglement/ProbeMatrices.lean new file mode 100644 index 0000000000000000000000000000000000000000..66dd2dc9d5fe25ead0fab924c9f541d6264f0dfa --- /dev/null +++ b/lean/OAI/InformationTheory/Entanglement/ProbeMatrices.lean @@ -0,0 +1,52 @@ +import OAI.InformationTheory.Entanglement.ProbeDensity + +namespace OAI + +noncomputable section +open scoped BigOperators ComplexOrder MatrixOrder Kronecker +open Matrix MeasureTheory Filter +namespace SecretKey +open ChannelCompletion +variable {n m : Type} [Fintype n] [Fintype m] [DecidableEq n] [DecidableEq m] +def marginalLeft (W : Mat (n×m)) : Mat n := fun i j => ∑ a, W (i,a) (j,a) +def marginalRight (W : Mat (n×m)) : Mat m := fun a b => ∑ i, W (i,a) (i,b) +omit [DecidableEq n] [DecidableEq m] in +lemma marginalLeft_psd {W : Mat (n×m)} (hW : W.PosSemidef) : (marginalLeft W).PosSemidef := + partial_trace_psd hW +omit [Fintype m] [DecidableEq n] [DecidableEq m] in +lemma marginalRight_psd {W : Mat (n×m)} (hW : W.PosSemidef) : (marginalRight W).PosSemidef := by + have he : marginalRight W=∑ i, W.submatrix (fun a => (i,a)) (fun a => (i,a)) := by ext a b; simp [marginalRight,Matrix.sum_apply,Matrix.submatrix_apply] + rw [he] + exact Matrix.posSemidef_sum _ (fun i _ => hW.submatrix _) +omit [DecidableEq n] in +lemma trace_test_left (E : Mat n) (W : Mat (n×m)) : + Matrix.trace (E*marginalLeft W)=Matrix.trace ((E ⊗ₖ (1 : Mat m))*W) := by + simp only [Matrix.trace,Matrix.diag,Matrix.mul_apply,marginalLeft,Matrix.kronecker_apply, + Fintype.sum_prod_type,Matrix.one_apply,mul_ite,mul_one,mul_zero,ite_mul,zero_mul,Finset.sum_ite_eq, + Finset.mem_univ,ite_true,Finset.mul_sum] + exact Finset.sum_congr rfl (fun i _ => Finset.sum_comm) +omit [DecidableEq m] in +lemma trace_test_right (G : Mat m) (W : Mat (n×m)) : + Matrix.trace (G*marginalRight W)=Matrix.trace (((1 : Mat n) ⊗ₖ G)*W) := by + have hh (i : n) (a : m) : + (∑ k : n, ∑ b : m, if i=k then G a b*W (k,b) (i,a) else 0)= + ∑ b : m, G a b*W (i,b) (i,a) := by + rw [Finset.sum_eq_single i] + · simp + · intro k _ hk + simp [Ne.symm hk] + · simp + simp only [Matrix.trace,Matrix.diag,Matrix.mul_apply,marginalRight,Matrix.kronecker_apply, + Fintype.sum_prod_type,Matrix.one_apply,ite_mul,one_mul,zero_mul,Finset.mul_sum] + change (∑ a : m, ∑ b : m, ∑ i : n, G a b*W (i,b) (i,a))= + ∑ i : n, ∑ a : m, ∑ k : n, ∑ b : m, if i=k then G a b*W (k,b) (i,a) else 0 + simp_rw [hh] + calc + _=∑ a : m, ∑ i : n, ∑ b : m, G a b*W (i,b) (i,a) := + Finset.sum_congr rfl (fun a _ => Finset.sum_comm) + _=_ := Finset.sum_comm +end SecretKey + +end + +end OAI diff --git a/lean/OAI/InformationTheory/Entanglement/ProbePOVM.lean b/lean/OAI/InformationTheory/Entanglement/ProbePOVM.lean new file mode 100644 index 0000000000000000000000000000000000000000..34fa29e47e2a489d281119bc106df8fd3dc8dcf0 --- /dev/null +++ b/lean/OAI/InformationTheory/Entanglement/ProbePOVM.lean @@ -0,0 +1,84 @@ +import OAI.InformationTheory.Entanglement.InformationalComplete +import OAI.Analysis.Quantum.PPTSquare.ChannelModel +import OAI.Analysis.Quantum.PPTSquare.TraceCompletion +import OAI.Analysis.Quantum.PPTSquare.Compression +import OAI.Analysis.Quantum.PPTSquare.ChannelCompletion + +namespace OAI + +noncomputable section +open scoped BigOperators ComplexOrder MatrixOrder Kronecker +open Matrix +namespace SecretKey +open ChannelCompletion +variable {n m : Type} [Fintype n] [Fintype m] [DecidableEq n] [DecidableEq m] +def testSum (n : Type) [Fintype n] [DecidableEq n] : Mat n := + ∑ k : PositiveTestIndex n, positiveTest k +lemma testSum_psd : (testSum n).PosSemidef := by + exact Matrix.posSemidef_sum _ (fun k _ => positiveTest_psd k) +def probeScale (n : Type) [Fintype n] [DecidableEq n] : ℝ := + (1+(Matrix.trace (testSum n)).re)⁻¹ +lemma probeScale_pos : 0 (probeScale n : ℂ) • positiveTest k + | none => 1-(probeScale n : ℂ) • testSum n +lemma probePOVM_psd (k : Option (PositiveTestIndex n)) : (probePOVM k).PosSemidef := by + cases k with + | some k => exact (positiveTest_psd k).smul (by exact_mod_cast (probeScale_pos (n := n)).le) + | none => + have htrace : ((Matrix.trace (testSum n)).re : ℂ)=Matrix.trace (testSum n) := by + exact Complex.ext rfl (by simpa using (Complex.nonneg_iff.mp (testSum_psd (n := n)).trace_nonneg).2) + have he : (1-(probeScale n : ℂ) • testSum n) = + (probeScale n : ℂ) • (1 : Mat n)+ + (probeScale n : ℂ) • (Matrix.trace (testSum n) • (1 : Mat n)-testSum n) := by + rw [smul_sub,smul_smul,← add_sub_assoc,← add_smul] + have hc : (probeScale n : ℂ)+(probeScale n : ℂ)*Matrix.trace (testSum n)=1 := by + rw [← htrace,← Complex.ofReal_mul,← Complex.ofReal_add,probeScale_mul_trace] + rfl + rw [hc,one_smul] + change (1-(probeScale n : ℂ) • testSum n).PosSemidef + rw [he] + exact (Matrix.PosSemidef.one.smul (by exact_mod_cast (probeScale_pos (n := n)).le)).add + ((psd_trace_bound testSum_psd).smul (by exact_mod_cast (probeScale_pos (n := n)).le)) +lemma probePOVM_sum : (∑ k : Option (PositiveTestIndex n), probePOVM k) = 1 := by + rw [Fintype.sum_option] + simp only [probePOVM,← Finset.smul_sum,testSum] + abel +lemma linear_eq_zero_of_probePOVM (L : Mat n →ₗ[ℂ] ℂ) + (h : ∀ k, L (probePOVM k)=0) : L=0 := by + apply linear_eq_zero_of_positive_tests L + intro k + have hk := h (some k) + change L ((probeScale n : ℂ) • positiveTest k)=0 at hk + rw [map_smul,smul_eq_mul] at hk + exact (mul_eq_zero.mp hk).resolve_left (by exact_mod_cast (probeScale_pos (n := n)).ne') + +theorem tensor_product_of_probePOVM (W : Mat (n×m)) (X : Mat n) (Y : Mat m) + (htest : ∀ e : Option (PositiveTestIndex n), ∀ g : Option (PositiveTestIndex m), + Matrix.trace ((probePOVM e ⊗ₖ probePOVM g)*W)= + Matrix.trace (probePOVM e*X)*Matrix.trace (probePOVM g*Y)) : + W=X ⊗ₖ Y := by + apply tensor_product_of_positive_tests + intro e g + have h := htest (some e) (some g) + simp only [probePOVM,Matrix.smul_kronecker,Matrix.kronecker_smul,Matrix.smul_mul, + Matrix.trace_smul,smul_eq_mul] at h + have hc : (probeScale n : ℂ) ≠ 0 := by exact_mod_cast (probeScale_pos (n := n)).ne' + have hd : (probeScale m : ℂ) ≠ 0 := by exact_mod_cast (probeScale_pos (n := m)).ne' + apply mul_left_cancel₀ hc + apply mul_left_cancel₀ hd + linear_combination h + +end SecretKey + +end + +end OAI diff --git a/lean/OAI/InformationTheory/Entanglement/ProbeRescaling.lean b/lean/OAI/InformationTheory/Entanglement/ProbeRescaling.lean new file mode 100644 index 0000000000000000000000000000000000000000..75e2630f6df3ff083f1804452c98f96ed9c4fbfd --- /dev/null +++ b/lean/OAI/InformationTheory/Entanglement/ProbeRescaling.lean @@ -0,0 +1,66 @@ +import OAI.InformationTheory.Entanglement.NormalizedProbe +import OAI.InformationTheory.Entanglement.ConditionedLaw + +namespace OAI + +noncomputable section +open MeasureTheory ProbabilityTheory Filter Set +open scoped MeasureTheory ProbabilityTheory ENNReal NNReal +namespace SecretKey +variable {Ω : Type*} {mΩ : MeasurableSpace Ω} + +lemma condExp_rescale {μ : Measure Ω} [IsFiniteMeasure μ] + {F : MeasurableSpace Ω} (hF : F ≤ mΩ) {f : Ω→ℝ} (hf : Integrable f μ) + (c : ℝ≥0) : μ[f|F]=ᵐ[c•μ] (c•μ)[f|F] := by + apply ae_eq_condExp_of_forall_setIntegral_eq hF hf.smul_measure_nnreal + · intro s hs hfin + exact (integrable_condExp.smul_measure_nnreal (c := c)).integrableOn + · intro s hs hfin + rw [Measure.restrict_smul,integral_smul_nnreal_measure,integral_smul_nnreal_measure, + setIntegral_condExp hF hf hs] + · exact stronglyMeasurable_condExp.aestronglyMeasurable +lemma condIndep_rescale {μ : Measure Ω} [IsFiniteMeasure μ] + [StandardBorelSpace Ω] {F A B : MeasurableSpace Ω} + (hF : F ≤ mΩ) (hA : A ≤ mΩ) (hB : B ≤ mΩ) + (hind : CondIndep F A B hF μ) (c : ℝ≥0) : CondIndep F A B hF (c•μ) := by + rw [condIndep_iff _ _ _ hF hA hB] at hind ⊢ + intro s t hs ht + have hi (u : Set Ω) (hu : MeasurableSet[mΩ] u) : Integrable (u.indicator (fun _ => (1 : ℝ))) μ := + (integrable_const 1).indicator hu + have hst := condExp_rescale hF (hi (s∩t) ((hA s hs).inter (hB t ht))) c + have hsa := condExp_rescale hF (hi s (hA s hs)) c + have htb := condExp_rescale hF (hi t (hB t ht)) c + filter_upwards [hst,hsa,htb,Measure.ae_smul_measure (hind s t hs ht) c] with x hx hy hz hc + simp only [Pi.mul_apply] at hc ⊢ + rw [← hx,← hy,← hz] + exact hc +namespace PositiveMatrixMeasure +open ChannelCompletion Matrix +variable {n : Type} [Fintype n] + +lemma scale_traceMeasure (W : PositiveMatrixMeasure Ω n) (c : ℝ≥0) : + (W.scale (c : ℝ) (NNReal.coe_nonneg c)).traceMeasure=c • W.traceMeasure := by + apply Measure.ext + intro s hs + apply (ENNReal.toReal_eq_toReal_iff' (measure_ne_top _ _) (measure_ne_top _ _)).mp + change (W.scale (c : ℝ) (NNReal.coe_nonneg c)).traceMeasure.real s=(c • W.traceMeasure).real s + rw [traceMeasure_real _ hs,scale_value,Matrix.trace_smul, + measureReal_nnreal_smul_apply,traceMeasure_real _ hs] + simp [smul_eq_mul] +lemma scale_domination (W : PositiveMatrixMeasure Ω n) {μ : Measure Ω} + (h : W.traceMeasure ≪ μ) (c : ℝ≥0) : + (W.scale (c : ℝ) (NNReal.coe_nonneg c)).traceMeasure ≪ c • μ := by + rw [scale_traceMeasure] + exact h.smul c +lemma scale_born (W : PositiveMatrixMeasure Ω n) (E : Mat n) (s : Set Ω) (c : ℝ≥0) : + (Matrix.trace (E*(W.scale (c : ℝ) (NNReal.coe_nonneg c)).value s)).re= + c*(Matrix.trace (E*W.value s)).re := by + rw [scale_value,Matrix.mul_smul,Matrix.trace_smul] + simp [smul_eq_mul] +end PositiveMatrixMeasure + +end SecretKey + +end + +end OAI diff --git a/lean/OAI/InformationTheory/Entanglement/ProductInstrumentStep.lean b/lean/OAI/InformationTheory/Entanglement/ProductInstrumentStep.lean new file mode 100644 index 0000000000000000000000000000000000000000..dd8dc26aceaa87ec93d0a60ab33da5e553c72663 --- /dev/null +++ b/lean/OAI/InformationTheory/Entanglement/ProductInstrumentStep.lean @@ -0,0 +1,61 @@ +import OAI.InformationTheory.Entanglement.TraceInstrument + +namespace OAI + +noncomputable section +open scoped BigOperators InnerProductSpace ComplexOrder ENNReal MeasureTheory TensorProduct +open ContinuousLinearMap MeasureTheory ProbabilityTheory +namespace SecretKey +variable {H K L : Type*} + [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + [NormedAddCommGroup K] [InnerProductSpace ℂ K] [CompleteSpace K] + [NormedAddCommGroup L] [InnerProductSpace ℂ L] [CompleteSpace L] +variable {ι κ υ : Type*} {X : Type*} [MeasurableSpace X] + +def traceClassCoefficient (b : HilbertBasis ι ℂ H) (x y : H) : TraceClass b →ₗ[ℂ] ℂ where + toFun A := inner ℂ x ((A : H →L[ℂ] H) y) + map_add' A B := by simp + map_smul' c A := by simp + +omit [CompleteSpace H] [CompleteSpace L] in +theorem local_product_disintegration (b : HilbertBasis ι ℂ H) (c : HilbertBasis κ ℂ K) + (d : HilbertBasis υ ℂ L) (I : TraceInstrument b c X) + (ρ : DensityOperator b) (σ : DensityOperator d) + (U : I.ConditionalUpdate ρ) {s : Set X} (hs : MeasurableSet s) + (x y : K) (u v : L) : + tensorFunctional (traceClassCoefficient c x y) (traceClassCoefficient d u v) + (TensorProduct.map (I.event s) LinearMap.id (ρ.val ⊗ₜ[ℂ] σ.val))= + ∫ z in s, tensorFunctional (traceClassCoefficient c x y) (traceClassCoefficient d u v) + ((U.state z).val ⊗ₜ[ℂ] σ.val) ∂I.outcome ρ := by + simp only [local_product_event,tensorFunctional_tmul,traceClassCoefficient,LinearMap.coe_mk, + AddHom.coe_mk] + rw [U.disintegration s hs x y,integral_mul_const] + +omit [CompleteSpace H] [CompleteSpace L] in +theorem right_product_disintegration (b : HilbertBasis ι ℂ H) (c : HilbertBasis κ ℂ K) + (d : HilbertBasis υ ℂ L) (I : TraceInstrument b c X) + (ρ : DensityOperator b) (σ : DensityOperator d) + (U : I.ConditionalUpdate ρ) {s : Set X} (hs : MeasurableSet s) + (x y : K) (u v : L) : + tensorFunctional (traceClassCoefficient d u v) (traceClassCoefficient c x y) + (TensorProduct.map LinearMap.id (I.event s) (σ.val ⊗ₜ[ℂ] ρ.val))= + ∫ z in s, tensorFunctional (traceClassCoefficient d u v) (traceClassCoefficient c x y) + (σ.val ⊗ₜ[ℂ] (U.state z).val) ∂I.outcome ρ := by + simp only [TensorProduct.map_tmul,tensorFunctional_tmul,LinearMap.id_apply, + traceClassCoefficient,LinearMap.coe_mk,AddHom.coe_mk] + rw [U.disintegration s hs x y,integral_const_mul] + +omit [CompleteSpace H] [CompleteSpace L] in +lemma conditional_product_trace (b : HilbertBasis ι ℂ H) (c : HilbertBasis κ ℂ K) + (d : HilbertBasis υ ℂ L) (I : TraceInstrument b c X) + (ρ : DensityOperator b) (σ : DensityOperator d) + (U : I.ConditionalUpdate ρ) (z : X) : + tensorFunctional (traceClassTrace c) (traceClassTrace d) + ((U.state z).val ⊗ₜ[ℂ] σ.val)=1 := by + rw [tensorFunctional_tmul,(U.state z).property.2,σ.property.2,mul_one] + +end SecretKey + +end + +end OAI diff --git a/lean/OAI/InformationTheory/Entanglement/ProjectionData.lean b/lean/OAI/InformationTheory/Entanglement/ProjectionData.lean new file mode 100644 index 0000000000000000000000000000000000000000..355ea89c5bab5f353b5f1ce7f95ab93c2c694deb --- /dev/null +++ b/lean/OAI/InformationTheory/Entanglement/ProjectionData.lean @@ -0,0 +1,118 @@ +import OAI.InformationTheory.Entanglement.TensorTools + +namespace OAI + +noncomputable section +open scoped BigOperators ComplexOrder MatrixOrder Kronecker +open Matrix +namespace ProjectionCriterion +open ChannelCompletion TensorCriterion +variable {Q K D I : Type} [Fintype Q] [Fintype K] [Fintype D] [Fintype I] + [DecidableEq Q] [DecidableEq D] [DecidableEq I] + +def correlation (u : Q → K → ℝ) (q r : Q) : ℝ := ∑ a, u q a * u r a + +structure Data (Q K D I : Type) [Fintype Q] [Fintype K] [Fintype D] [Fintype I] + [DecidableEq Q] [DecidableEq D] where + question : I → Q + u : Q → K → ℝ + unit : ∀ q, ∑ a, u q a * u q a = 1 + P : I → Mat D + hermitian : ∀ i, (P i).IsHermitian + idempotent : ∀ i, P i * P i = P i + orthogonal : ∀ i j, question i = question j → i ≠ j → P i * P j = 0 + complete : ∀ q, ∑ i with question i = q, P i = 1 + commute : ∀ i j, correlation u (question i) (question j) ≠ 0 → P i * P j = P j * P i + κ : ℝ + gap : κ < (Fintype.card Q : ℝ) / Fintype.card K + clique : ∀ J : Finset I, + (∀ i ∈ J, ∀ j ∈ J, i ≠ j → 0 < (Matrix.trace (P i * P j)).re) → + (J.card : ℝ) ≤ κ + +namespace Data +variable (d : Data Q K D I) +def c (i j : I) : ℝ := correlation d.u (d.question i) (d.question j) +def H (i j : I) : Mat D := (d.c i j : ℂ) • (d.P i * d.P j) +def Psi : Map I D where + toFun X := ∑ i, ∑ j, X i j • d.H i j + map_add' X Y := by simp [add_smul,Finset.sum_add_distrib] + map_smul' a X := by simp [smul_smul,Finset.smul_sum] +def C : Mat (I × I) := choi ((hsAdjoint d.Psi).comp d.Psi) +def B : Mat I := fun i j => d.C (i,i) (j,j) + +omit [DecidableEq I] in +lemma c_symm (i j : I) : d.c i j = d.c j i := by + simp only [c,correlation,mul_comm] +omit [DecidableEq I] in +lemma c_self (i : I) : d.c i i = 1 := d.unit (d.question i) +omit [DecidableEq I] in +lemma P_psd (i : I) : (d.P i).PosSemidef := by + have h := Matrix.posSemidef_conjTranspose_mul_self (d.P i) + simpa only [(d.hermitian i).eq,d.idempotent] using h +omit [DecidableEq I] in +lemma H_self (i : I) : d.H i i = d.P i := by simp [H,d.c_self,d.idempotent] +omit [DecidableEq I] in +lemma H_symm (i j : I) : d.H i j = d.H j i := by + by_cases h : d.c i j = 0 + · simp [H,h,← d.c_symm i j] + · rw [H,H,← d.c_symm i j,d.commute i j h] +omit [DecidableEq I] in +lemma H_adjoint (i j : I) : (d.H i j)ᴴ = d.H j i := by + simp only [H,Matrix.conjTranspose_smul,Matrix.conjTranspose_mul, + (d.hermitian i).eq,(d.hermitian j).eq,Complex.star_def,Complex.conj_ofReal,d.c_symm i j] +omit [DecidableEq I] in +lemma H_hermitian (i j : I) : (d.H i j).IsHermitian := by + rw [Matrix.IsHermitian,d.H_adjoint,d.H_symm] +lemma Psi_single (i j : I) : d.Psi (Matrix.single i j 1) = d.H i j := by + simp [Psi,Matrix.single_apply,ite_and,ite_smul] +lemma choi_Psi : choi d.Psi = fun a b => d.H a.1 b.1 a.2 b.2 := by + ext ⟨i,a⟩ ⟨j,b⟩ + exact congrArg (fun X : Mat D => X a b) (d.Psi_single i j) + +def gramFactor : Matrix (K × D) (I × D) ℂ := + fun a b => (d.u (d.question b.1) a.1 : ℂ) * d.P b.1 a.2 b.2 +lemma choi_gram : choi d.Psi = d.gramFactorᴴ * d.gramFactor := by + rw [d.choi_Psi] + ext ⟨i,a⟩ ⟨j,b⟩ + change (d.c i j : ℂ) * (∑ e, d.P i a e * d.P j e b) = _ + simp only [Matrix.mul_apply,Matrix.conjTranspose_apply,gramFactor,star_mul, + Complex.star_def,Complex.conj_ofReal,Fintype.sum_prod_type] + have hp (e : D) : star (d.P i e a) = d.P i a e := (d.hermitian i).apply a e + simp only [← Complex.star_def,hp] + rw [c,correlation,Complex.ofReal_sum] + simp only [Complex.ofReal_mul,Finset.sum_mul,Finset.mul_sum] + rw [Finset.sum_comm] + apply Finset.sum_congr rfl + intro k _ + apply Finset.sum_congr rfl + intro e _ + ring +lemma Psi_cp : CP d.Psi := by + apply cp_of_choi + rw [d.choi_gram] + exact Matrix.posSemidef_conjTranspose_mul_self _ +omit [DecidableEq I] in +lemma Psi_input_transpose : d.Psi.comp transposeMap = d.Psi := by + ext X a b + change (∑ i, ∑ j, X j i • d.H i j) a b = (∑ i, ∑ j, X i j • d.H i j) a b + rw [Finset.sum_comm] + simp only [Matrix.sum_apply,Matrix.smul_apply] + apply Finset.sum_congr rfl + intro i _ + apply Finset.sum_congr rfl + intro j _ + rw [d.H_symm] +lemma Psi_ppt : PPT d.Psi := by + refine ⟨d.Psi_cp,?_⟩ + have h := cp_simultaneous_transpose d.Psi_cp + rwa [d.Psi_input_transpose] at h +lemma adjoint_ppt : PPT (hsAdjoint d.Psi) := ppt_hsAdjoint d.Psi_ppt +lemma adjoint_output_transpose : transposeMap.comp (hsAdjoint d.Psi) = hsAdjoint d.Psi := by + rw [← hsAdjoint_input_transpose,d.Psi_input_transpose] + +end Data +end ProjectionCriterion + +end + +end OAI diff --git a/lean/OAI/InformationTheory/Entanglement/ProjectionMain.lean b/lean/OAI/InformationTheory/Entanglement/ProjectionMain.lean new file mode 100644 index 0000000000000000000000000000000000000000..93df5bc4e57e5b6e294386300fb31e9af1487353 --- /dev/null +++ b/lean/OAI/InformationTheory/Entanglement/ProjectionMain.lean @@ -0,0 +1,51 @@ +import OAI.InformationTheory.Entanglement.ProjectionStats +import OAI.InformationTheory.Entanglement.CorrelationBound +import OAI.InformationTheory.Entanglement.SparseSeparable + +namespace OAI + +noncomputable section +open scoped BigOperators ComplexOrder MatrixOrder Kronecker +open Matrix +namespace ProjectionCriterion +open ChannelCompletion TensorCriterion +variable {Q K D I : Type} [Fintype Q] [Fintype K] [Fintype D] [Fintype I] + [DecidableEq Q] [DecidableEq K] [DecidableEq D] [DecidableEq I] + [Nonempty Q] [Nonempty K] [Nonempty D] + +namespace Data +variable (d : Data Q K D I) +lemma C_nonseparable : ¬ Separable d.C := by + intro hsep + have hu := separable_compression_bound hsep d.κ (fun J hJ => d.clique J (by + simpa only [d.C_diag] using hJ)) + have ht : compressionTrace d.C=(Fintype.card Q : ℝ)*(Fintype.card D : ℝ) := by + change (Matrix.trace d.B).re = _ + rw [d.B_trace] + simp + have hs : compressionSum d.C=(∑ q, ∑ r, (correlation d.u q r)^2)*(Fintype.card D : ℝ) := by + change (∑ i, ∑ j, d.B i j).re = _ + rw [d.B_sum] + simp [-Complex.ofReal_pow] + rw [ht,hs] at hu + have hD : 0 < (Fintype.card D : ℝ) := Nat.cast_pos.mpr Fintype.card_pos + have hQ : 0 < (Fintype.card Q : ℝ) := Nat.cast_pos.mpr Fintype.card_pos + have hlo := mul_le_mul_of_nonneg_right (correlation_lower d.u d.unit) hD.le + have hhi := mul_lt_mul_of_pos_right d.gap (mul_pos hQ hD) + have he : (Fintype.card Q : ℝ)/Fintype.card K* + ((Fintype.card Q : ℝ)*Fintype.card D) = + (Fintype.card Q : ℝ)^2/Fintype.card K*Fintype.card D := by ring + rw [he] at hhi + exact (not_lt_of_ge (hlo.trans hu)) hhi +end Data + +theorem rectangular_projection_criterion (d : Data Q K D I) : + PPT d.Psi ∧ PPT (hsAdjoint d.Psi) ∧ ¬ Separable d.C ∧ + Matrix.trace d.C=(Fintype.card Q : ℂ)^2*(Fintype.card D : ℂ) := by + exact ⟨d.Psi_ppt,d.adjoint_ppt,d.C_nonseparable,d.C_trace⟩ + +end ProjectionCriterion + +end + +end OAI diff --git a/lean/OAI/InformationTheory/Entanglement/ProjectionReal.lean b/lean/OAI/InformationTheory/Entanglement/ProjectionReal.lean new file mode 100644 index 0000000000000000000000000000000000000000..d474c840dd61be29d6aa7073b2fd86bf44a578c6 --- /dev/null +++ b/lean/OAI/InformationTheory/Entanglement/ProjectionReal.lean @@ -0,0 +1,104 @@ +import OAI.InformationTheory.Entanglement.ProjectionMain +import OAI.InformationTheory.Entanglement.ChoiTransfer + +namespace OAI + +noncomputable section +open scoped BigOperators ComplexOrder MatrixOrder Kronecker +open Matrix +namespace ProjectionCriterion +open ChannelCompletion TensorCriterion SecretKey +namespace Data +variable {Q K D I : Type} [Fintype Q] [Fintype K] [Fintype D] [Fintype I] + [DecidableEq Q] [DecidableEq K] [DecidableEq D] [DecidableEq I] +variable (d : Data Q K D I) + +def RealProjections : Prop := ∀ i a b, (d.P i a b).im=0 +omit [DecidableEq K] [DecidableEq I] in +lemma P_transpose (hr : d.RealProjections) (i : I) : (d.P i)ᵀ=d.P i := by + ext a b + have he := (d.hermitian i).apply a b + rw [Complex.ext_iff] at he ⊢ + exact ⟨he.1,by change (d.P i b a).im=(d.P i a b).im; rw [hr i b a,hr i a b]⟩ +omit [DecidableEq K] [DecidableEq I] in +lemma H_transpose (hr : d.RealProjections) (i j : I) : (d.H i j)ᵀ=d.H i j := by + simp only [H,Matrix.transpose_smul,Matrix.transpose_mul,d.P_transpose hr] + by_cases hc : d.c i j=0 + · simp [hc] + · rw [d.commute i j hc] +omit [DecidableEq K] in +lemma adjoint_input_transpose (hr : d.RealProjections) : + (hsAdjoint d.Psi).comp transposeMap=hsAdjoint d.Psi := by + ext A i j + change hsAdjoint d.Psi Aᵀ i j=hsAdjoint d.Psi A i j + simp only [d.adjoint_apply,(d.H_hermitian i j).eq] + rw [← d.H_transpose hr i j,Matrix.trace_transpose_mul,d.H_transpose hr i j] +omit [DecidableEq K] in +lemma adjoint_trace (A : Mat D) : + Matrix.trace (hsAdjoint d.Psi A)=(Fintype.card Q : ℂ)*Matrix.trace A := by + change (∑ i, hsAdjoint d.Psi A i i)=_ + simp_rw [d.adjoint_apply,d.H_self,(d.hermitian _).eq,Matrix.trace_mul_comm (d.P _) A] + simpa only [one_mul,Finset.sum_const,Finset.card_univ,nsmul_eq_mul,mul_one] + using d.weighted_trace (fun _ => 1) A +omit [DecidableEq K] in +lemma choi_real (hr : d.RealProjections) : + d.C=tensorMap (hsAdjoint d.Psi) (hsAdjoint d.Psi) (projector (omega (n := D))) := by + change choi ((hsAdjoint d.Psi).comp d.Psi)=_ + rw [choi_transfer d.Psi_cp] + have he : sharp d.Psi=hsAdjoint d.Psi := by + rw [sharp,d.adjoint_input_transpose hr,d.adjoint_output_transpose] + rw [he] + +def localChannel : Map D I := (((Fintype.card Q : ℝ)⁻¹ : ℝ) : ℂ) • hsAdjoint d.Psi +def rho : Mat (I × I) := ((((Fintype.card Q : ℝ)^2*(Fintype.card D : ℝ))⁻¹ : ℝ) : ℂ) • d.C + +omit [DecidableEq K] in +lemma localChannel_ppt : PPT d.localChannel := by + refine ⟨cp_smul d.adjoint_ppt.1 (inv_nonneg.mpr (Nat.cast_nonneg _)),?_⟩ + change CP ((((Fintype.card Q : ℝ)⁻¹ : ℝ) : ℂ) • (transposeMap.comp (hsAdjoint d.Psi))) + exact cp_smul d.adjoint_ppt.2 (inv_nonneg.mpr (Nat.cast_nonneg _)) +omit [DecidableEq K] in +lemma localChannel_tp [Nonempty Q] : TracePreserving d.localChannel := by + intro A + change Matrix.trace ((((Fintype.card Q : ℝ)⁻¹ : ℝ) : ℂ) • hsAdjoint d.Psi A)=_ + rw [Matrix.trace_smul,d.adjoint_trace,smul_eq_mul] + have hq : (Fintype.card Q : ℂ) ≠ 0 := Nat.cast_ne_zero.mpr (ne_of_gt Fintype.card_pos) + push_cast + field_simp + +omit [DecidableEq K] in +lemma rho_psd : d.rho.PosSemidef := + (cp_choi (cp_comp d.adjoint_ppt.1 d.Psi_cp)).smul (by + change (0 : ℂ) ≤ (((Fintype.card Q : ℝ)^2*(Fintype.card D : ℝ))⁻¹ : ℝ) + have hn : 0 ≤ ((Fintype.card Q : ℝ)^2*(Fintype.card D : ℝ))⁻¹ := by positivity + exact_mod_cast hn) +omit [DecidableEq K] in +lemma rho_trace [Nonempty Q] [Nonempty D] : Matrix.trace d.rho=1 := by + rw [rho,Matrix.trace_smul,d.C_trace,smul_eq_mul] + have hq : (Fintype.card Q : ℂ) ≠ 0 := Nat.cast_ne_zero.mpr (ne_of_gt Fintype.card_pos) + have hd : (Fintype.card D : ℂ) ≠ 0 := Nat.cast_ne_zero.mpr (ne_of_gt Fintype.card_pos) + push_cast + field_simp + +omit [Fintype I] [DecidableEq I] in +lemma separable_scaling {Z : Mat (I × I)} (hZ : Separable Z) {a : ℝ} (ha : 0 ≤ a) : + Separable ((a : ℂ) • Z) := by + obtain ⟨r,A,B,hA,hB,rfl⟩ := hZ + refine ⟨r,fun i => (a : ℂ) • A i,B,fun i => (hA i).smul (by exact_mod_cast ha),hB,?_⟩ + simp only [Finset.smul_sum,Matrix.smul_kronecker] +lemma rho_nonseparable [Nonempty Q] [Nonempty K] [Nonempty D] : ¬ Separable d.rho := by + intro h + have hq : (Fintype.card Q : ℝ)≠0 := Nat.cast_ne_zero.mpr (ne_of_gt Fintype.card_pos) + have hd : (Fintype.card D : ℝ)≠0 := Nat.cast_ne_zero.mpr (ne_of_gt Fintype.card_pos) + have hz := separable_scaling h (mul_nonneg (sq_nonneg (Fintype.card Q : ℝ)) (Nat.cast_nonneg (Fintype.card D))) + have he : ((((Fintype.card Q : ℝ)^2*(Fintype.card D : ℝ)) : ℝ) : ℂ) • d.rho=d.C := by + rw [rho,smul_smul,← Complex.ofReal_mul,mul_inv_cancel₀ (mul_ne_zero (pow_ne_zero _ hq) hd)] + simp + rw [he] at hz + exact d.C_nonseparable hz +end Data +end ProjectionCriterion + +end + +end OAI diff --git a/lean/OAI/InformationTheory/Entanglement/ProjectionRealMain.lean b/lean/OAI/InformationTheory/Entanglement/ProjectionRealMain.lean new file mode 100644 index 0000000000000000000000000000000000000000..d2f7760c25e874ce34bb64bfaf6b6ce3ba88dc23 --- /dev/null +++ b/lean/OAI/InformationTheory/Entanglement/ProjectionRealMain.lean @@ -0,0 +1,70 @@ +import OAI.InformationTheory.Entanglement.ProjectionReal + +namespace OAI + +noncomputable section +open scoped BigOperators ComplexOrder MatrixOrder Kronecker +open Matrix +namespace ProjectionCriterion +open ChannelCompletion TensorCriterion SecretKey + +lemma projector_real_smul {n : Type} (r : ℝ) (v : n → ℂ) : + projector ((r : ℂ) • v)=((r^2 : ℝ) : ℂ) • projector v := by + ext i j + simp only [projector,Matrix.vecMulVec_apply,Pi.smul_apply,Pi.star_apply,smul_eq_mul, + star_mul,Complex.star_def,Complex.conj_ofReal,Matrix.smul_apply,Complex.ofReal_pow] + ring + +def Phi (D : ℕ) : Fin D × Fin D → ℂ := (((Real.sqrt (D : ℝ))⁻¹ : ℝ) : ℂ) • omega +lemma Phi_projector (D : ℕ) : projector (Phi D)=(((D : ℝ)⁻¹ : ℝ) : ℂ) • projector (omega (n := Fin D)) := by + rw [Phi,projector_real_smul,inv_pow,Real.sq_sqrt (Nat.cast_nonneg D)] + +namespace Data +variable {Q K I : Type} [Fintype Q] [Fintype K] [Fintype I] + [DecidableEq Q] [DecidableEq K] [DecidableEq I] + [Nonempty Q] [Nonempty K] {D : ℕ} [NeZero D] +variable (d : Data Q K (Fin D) I) +omit [DecidableEq K] [Nonempty Q] [Nonempty K] [NeZero D] in +lemma localChannel_input_transpose (hr : d.RealProjections) : + d.localChannel.comp transposeMap=d.localChannel := by + unfold localChannel + rw [LinearMap.smul_comp,d.adjoint_input_transpose hr] + +omit [DecidableEq K] [Nonempty Q] [Nonempty K] [NeZero D] in +lemma rho_identification (hr : d.RealProjections) : + d.rho=tensorMap d.localChannel d.localChannel (projector (Phi D)) := by + rw [Phi_projector,localChannel,tensorMap_smul] + simp only [LinearMap.smul_apply,map_smul,smul_smul] + rw [← d.choi_real hr] + unfold rho + congr 1 + simp only [Fintype.card_fin,Complex.ofReal_inv,Complex.ofReal_natCast, + Complex.ofReal_mul,mul_inv,pow_two,mul_assoc] + ring + +omit [DecidableEq K] [Nonempty K] in +lemma rho_represented (hr : d.RealProjections) : Represented d.rho := by + refine ⟨d.rho_psd,d.rho_trace,D,D,Nat.pos_of_ne_zero (NeZero.ne D), + Nat.pos_of_ne_zero (NeZero.ne D),d.localChannel,d.localChannel,Phi D, + d.localChannel_ppt.1,?_,d.localChannel_ppt.1,?_,d.rho_identification hr⟩ + all_goals rw [d.localChannel_input_transpose hr]; exact d.localChannel_ppt.1 +end Data + +theorem real_channel {Q K I : Type} [Fintype Q] [Fintype K] [Fintype I] + [DecidableEq Q] [DecidableEq K] [DecidableEq I] [Nonempty Q] [Nonempty K] + {D : ℕ} [NeZero D] (d : Data Q K (Fin D) I) (hr : d.RealProjections) : + (hsAdjoint d.Psi).comp transposeMap=hsAdjoint d.Psi ∧ + transposeMap.comp (hsAdjoint d.Psi)=hsAdjoint d.Psi ∧ + (∀ A, Matrix.trace (hsAdjoint d.Psi A)=(Fintype.card Q : ℂ)*Matrix.trace A) ∧ + PPT d.localChannel ∧ TracePreserving d.localChannel ∧ + d.rho=tensorMap d.localChannel d.localChannel (projector (Phi D)) ∧ + Represented d.rho ∧ ¬ Separable d.rho := by + exact ⟨d.adjoint_input_transpose hr,d.adjoint_output_transpose,d.adjoint_trace, + d.localChannel_ppt,d.localChannel_tp,d.rho_identification hr,d.rho_represented hr, + d.rho_nonseparable⟩ + +end ProjectionCriterion + +end + +end OAI diff --git a/lean/OAI/InformationTheory/Entanglement/ProjectionReindex.lean b/lean/OAI/InformationTheory/Entanglement/ProjectionReindex.lean new file mode 100644 index 0000000000000000000000000000000000000000..e634fedcdc258e062d1be2f1b92449c9290284c1 --- /dev/null +++ b/lean/OAI/InformationTheory/Entanglement/ProjectionReindex.lean @@ -0,0 +1,73 @@ +import OAI.InformationTheory.Entanglement.ProjectionData + +namespace OAI + +noncomputable section +open scoped BigOperators +open Matrix +namespace ProjectionCriterion +open ChannelCompletion +variable {Q K D I D' I' : Type} [Fintype Q] [Fintype K] [Fintype D] [Fintype I] + [Fintype D'] [Fintype I'] [DecidableEq Q] [DecidableEq K] [DecidableEq D] + [DecidableEq I] [DecidableEq D'] [DecidableEq I'] +omit [DecidableEq D] [DecidableEq D'] in +lemma trace_reindex (e : D' ≃ D) (A : Mat D) : + Matrix.trace (A.submatrix e e)=Matrix.trace A := + e.sum_comp (fun i => A i i) +namespace Data +variable (d : Data Q K D I) (eD : D' ≃ D) (eI : I' ≃ I) +def reindexP (i : I') : Mat D' := (d.P (eI i)).submatrix eD eD +omit [Fintype I'] [DecidableEq K] [DecidableEq I] [DecidableEq D'] [DecidableEq I'] in +lemma reindexP_overlap (i j : I') : + Matrix.trace (d.reindexP eD eI i*d.reindexP eD eI j)= + Matrix.trace (d.P (eI i)*d.P (eI j)) := by + rw [reindexP,reindexP,Matrix.submatrix_mul_equiv,trace_reindex] +omit [Fintype D'] [DecidableEq K] [DecidableEq I] [DecidableEq I'] in +lemma reindexP_complete (q : Q) : + ∑ i : I' with d.question (eI i)=q, d.reindexP eD eI i=1 := by + rw [Finset.sum_filter] + calc + _ = ∑ i : I, if d.question i=q then (d.P i).submatrix eD eD else 0 := + eI.sum_comp _ + _ = (∑ i : I with d.question i=q, d.P i).submatrix eD eD := by + ext a b + simp only [Matrix.sum_apply,Matrix.submatrix_apply,Finset.sum_filter] + apply Finset.sum_congr rfl + intro c hc + split_ifs <;> rfl + _ = 1 := by rw [d.complete,Matrix.submatrix_one_equiv] +omit [Fintype I'] [DecidableEq K] [DecidableEq D'] [DecidableEq I'] in +lemma reindexP_clique (J : Finset I') + (hJ : ∀ i ∈ J, ∀ j ∈ J, i ≠ j → 0 < (Matrix.trace (d.reindexP eD eI i*d.reindexP eD eI j)).re) : + (J.card : ℝ) ≤ d.κ := by + have hh := d.clique (J.image eI) (by + intro i hi j hj hij + obtain ⟨a,ha,rfl⟩ := Finset.mem_image.mp hi + obtain ⟨b,hb,rfl⟩ := Finset.mem_image.mp hj + rw [← d.reindexP_overlap eD eI] + exact hJ a ha b hb (fun he => hij (he ▸ rfl))) + simpa only [Finset.card_image_of_injective _ eI.injective] using hh + +def reindex : Data Q K D' I' where + question i := d.question (eI i) + u := d.u + unit := d.unit + P := d.reindexP eD eI + hermitian i := (d.hermitian (eI i)).submatrix eD + idempotent i := by rw [reindexP,Matrix.submatrix_mul_equiv,d.idempotent] + orthogonal i j hq hij := by + rw [reindexP,reindexP,Matrix.submatrix_mul_equiv, + d.orthogonal (eI i) (eI j) hq (eI.injective.ne hij)] + rfl + complete := d.reindexP_complete eD eI + commute i j h := by + rw [reindexP,reindexP,Matrix.submatrix_mul_equiv,Matrix.submatrix_mul_equiv,d.commute _ _ h] + κ := d.κ + gap := d.gap + clique := d.reindexP_clique eD eI +end Data +end ProjectionCriterion + +end + +end OAI diff --git a/lean/OAI/InformationTheory/Entanglement/ProjectionSquare.lean b/lean/OAI/InformationTheory/Entanglement/ProjectionSquare.lean new file mode 100644 index 0000000000000000000000000000000000000000..e9012dd0ba470a17cf9f0bb775ea88adfdc422fe --- /dev/null +++ b/lean/OAI/InformationTheory/Entanglement/ProjectionSquare.lean @@ -0,0 +1,73 @@ +import OAI.InformationTheory.Entanglement.ProjectionMain + +namespace OAI + +noncomputable section +open scoped BigOperators ComplexOrder MatrixOrder Kronecker +open Matrix +namespace ProjectionCriterion +open ChannelCompletion TensorCriterion + +lemma hsAdjoint_left_ad {n m p : Type} [Fintype n] [Fintype m] [Fintype p] + [DecidableEq n] {F : Map n m} (hF : CP F) (S : Matrix p m ℂ) : + hsAdjoint ((ad S).comp F)=(hsAdjoint F).comp (ad Sᴴ) := by + ext X i j + have he (Y : Mat n) : Matrix.trace (Y*hsAdjoint ((ad S).comp F) X)= + Matrix.trace (Y*hsAdjoint F (ad Sᴴ X)) := by + rw [trace_hsAdjoint (cp_comp (cp_ad S) hF),trace_hsAdjoint hF] + simp only [LinearMap.comp_apply,ad_apply,Matrix.conjTranspose_conjTranspose] + calc + Matrix.trace (S*F Y*Sᴴ*X)=Matrix.trace (S*(F Y*Sᴴ*X)) := by simp only [Matrix.mul_assoc] + _ = Matrix.trace ((F Y*Sᴴ*X)*S) := Matrix.trace_mul_comm _ _ + _ = _ := by simp only [Matrix.mul_assoc] + change hsAdjoint ((ad S).comp F) X i j=hsAdjoint F (ad Sᴴ X) i j + simpa only [Matrix.trace_single_mul,one_smul] using he (Matrix.single j i 1) + +namespace Data +variable {Q K : Type} [Fintype Q] [Fintype K] [DecidableEq Q] [DecidableEq K] + {D n : ℕ} (d : Data Q K (Fin D) (Fin n)) (h : D ≤ n) + +def firstCoordinates (_d : Data Q K (Fin D) (Fin n)) (h : D ≤ n) : + Matrix (Fin n) (Fin D) ℂ := coord (Fin.castLE h) +def Xi1 : Map (Fin n) (Fin n) := (ad (d.firstCoordinates h)).comp d.Psi +def Xi2 : Map (Fin n) (Fin n) := (hsAdjoint d.Psi).comp (ad (d.firstCoordinates h)ᴴ) + +omit [DecidableEq K] in +lemma Xi1_ppt : PPT (d.Xi1 h) := ppt_ad_comp d.Psi_ppt _ +omit [DecidableEq K] in +lemma Xi2_ppt : PPT (d.Xi2 h) := ppt_comp_cp d.adjoint_ppt (cp_ad _) +omit [DecidableEq K] in +lemma Xi2_adjoint : d.Xi2 h=hsAdjoint (d.Xi1 h) := (hsAdjoint_left_ad d.Psi_cp _).symm +omit [DecidableEq K] in +lemma Xi_composite : (d.Xi2 h).comp (d.Xi1 h)=(hsAdjoint d.Psi).comp d.Psi := by + ext X a b + simp only [Xi1,Xi2,LinearMap.comp_apply,ad_apply,Matrix.conjTranspose_conjTranspose] + have hh : (d.firstCoordinates h)ᴴ*d.firstCoordinates h=1 := + coord_isometry _ (Fin.castLE_injective h) + have he : (d.firstCoordinates h)ᴴ*((d.firstCoordinates h)*d.Psi X*(d.firstCoordinates h)ᴴ)* + (d.firstCoordinates h)=d.Psi X := by + calc + _ = ((d.firstCoordinates h)ᴴ*d.firstCoordinates h)*d.Psi X* + ((d.firstCoordinates h)ᴴ*d.firstCoordinates h) := by simp only [Matrix.mul_assoc] + _ = _ := by rw [hh,Matrix.one_mul,Matrix.mul_one] + rw [he] +lemma Xi_not_eb [Nonempty Q] [Nonempty K] [NeZero D] : + ¬ EntanglementBreaking ((d.Xi2 h).comp (d.Xi1 h)) := by + intro heb + rw [d.Xi_composite h] at heb + exact d.C_nonseparable (eb_choi heb) +end Data + +theorem square_embedding {Q K : Type} [Fintype Q] [Fintype K] + [DecidableEq Q] [DecidableEq K] [Nonempty Q] [Nonempty K] + {D n : ℕ} [NeZero D] (d : Data Q K (Fin D) (Fin n)) (h : D ≤ n) : + PPT (d.Xi1 h) ∧ PPT (d.Xi2 h) ∧ d.Xi2 h=hsAdjoint (d.Xi1 h) ∧ + (d.Xi2 h).comp (d.Xi1 h)=(hsAdjoint d.Psi).comp d.Psi ∧ + ¬ EntanglementBreaking ((d.Xi2 h).comp (d.Xi1 h)) := by + exact ⟨d.Xi1_ppt h,d.Xi2_ppt h,d.Xi2_adjoint h,d.Xi_composite h,d.Xi_not_eb h⟩ + +end ProjectionCriterion + +end + +end OAI diff --git a/lean/OAI/InformationTheory/Entanglement/ProjectionStats.lean b/lean/OAI/InformationTheory/Entanglement/ProjectionStats.lean new file mode 100644 index 0000000000000000000000000000000000000000..8b828745cc9bfcc9588d4c25ebc46ade9af47e43 --- /dev/null +++ b/lean/OAI/InformationTheory/Entanglement/ProjectionStats.lean @@ -0,0 +1,104 @@ +import OAI.InformationTheory.Entanglement.ProjectionData + +namespace OAI + +noncomputable section +open scoped BigOperators ComplexOrder MatrixOrder Kronecker +open Matrix +namespace ProjectionCriterion +open ChannelCompletion TensorCriterion +namespace Data +variable {Q K D I : Type} [Fintype Q] [Fintype K] [Fintype D] [Fintype I] + [DecidableEq Q] [DecidableEq D] [DecidableEq I] +variable (d : Data Q K D I) + +lemma adjoint_apply (A : Mat D) (i j : I) : + hsAdjoint d.Psi A i j = Matrix.trace ((d.H i j)ᴴ * A) := by + simp only [hsAdjoint,d.Psi_single] + change (∑ a, ∑ b, star (d.H i j a b)*A a b) = + ∑ a, ∑ b, star (d.H i j b a)*A b a + rw [Finset.sum_comm] +lemma C_entry (i j a b : I) : d.C (i,a) (j,b) = Matrix.trace ((d.H a b)ᴴ*d.H i j) := by + change hsAdjoint d.Psi (d.Psi (Matrix.single i j 1)) a b = _ + rw [d.Psi_single,d.adjoint_apply] +lemma C_diag (i j : I) : d.C (i,j) (i,j) = Matrix.trace (d.P i*d.P j) := by + rw [d.C_entry,d.H_self,d.H_self,(d.hermitian j).eq,Matrix.trace_mul_comm] +omit [DecidableEq I] in +lemma overlap_gram (i j : I) : + Matrix.trace ((d.P i*d.P j)ᴴ*(d.P i*d.P j))=Matrix.trace (d.P i*d.P j) := by + rw [Matrix.conjTranspose_mul,(d.hermitian i).eq,(d.hermitian j).eq] + calc + Matrix.trace (d.P j*d.P i*(d.P i*d.P j)) = + Matrix.trace (d.P j*(d.P i*d.P i)*d.P j) := by simp only [Matrix.mul_assoc] + _ = Matrix.trace (d.P j*d.P i*d.P j) := by rw [d.idempotent] + _ = Matrix.trace (d.P j*d.P j*d.P i) := Matrix.trace_mul_cycle _ _ _ + _ = Matrix.trace (d.P i*d.P j) := by rw [d.idempotent,Matrix.trace_mul_comm] +omit [DecidableEq I] in +lemma overlap_nonneg (i j : I) : 0 ≤ (Matrix.trace (d.P i*d.P j)).re := by + rw [← d.overlap_gram] + exact (Complex.nonneg_iff.mp (Matrix.posSemidef_conjTranspose_mul_self (d.P i*d.P j)).trace_nonneg).1 +omit [DecidableEq I] in +lemma overlap_im (i j : I) : (Matrix.trace (d.P i*d.P j)).im=0 := by + rw [← d.overlap_gram] + exact (Complex.nonneg_iff.mp (Matrix.posSemidef_conjTranspose_mul_self (d.P i*d.P j)).trace_nonneg).2.symm +lemma B_entry (i j : I) : d.B i j = ((d.c i j)^2 : ℂ) * Matrix.trace (d.P i*d.P j) := by + change d.C (i,i) (j,j) = _ + rw [d.C_entry] + simp only [H,Matrix.conjTranspose_smul,Complex.star_def,Complex.conj_ofReal, + Matrix.smul_mul,Matrix.mul_smul,smul_smul,Matrix.trace_smul,smul_eq_mul] + rw [d.overlap_gram] + ring +omit [DecidableEq I] in +lemma weighted_trace (f : Q → ℂ) (A : Mat D) : + (∑ i, f (d.question i)*Matrix.trace (A*d.P i)) = + (∑ q, f q)*Matrix.trace A := by + rw [← Finset.sum_fiberwise Finset.univ d.question] + calc + (∑ q, ∑ i with d.question i=q, f (d.question i)*Matrix.trace (A*d.P i)) = + ∑ q, f q * Matrix.trace A := by + apply Finset.sum_congr rfl + intro q _ + calc + (∑ i with d.question i=q, f (d.question i)*Matrix.trace (A*d.P i)) = + ∑ i with d.question i=q, f q*Matrix.trace (A*d.P i) := by + apply Finset.sum_congr rfl + intro i hi + rw [(Finset.mem_filter.mp hi).2] + _ = f q*Matrix.trace (A*(∑ i with d.question i=q, d.P i)) := by + simp only [Matrix.trace_sum,Finset.mul_sum] + _ = f q*Matrix.trace A := by rw [d.complete,Matrix.mul_one] + _ = _ := (Finset.sum_mul ..).symm +omit [DecidableEq I] in +lemma weighted_projector_trace (f : Q → ℂ) : + (∑ i, f (d.question i)*Matrix.trace (d.P i)) = + (∑ q, f q)*(Fintype.card D : ℂ) := by + simpa only [Matrix.one_mul,Matrix.trace_one] using d.weighted_trace f 1 +omit [DecidableEq I] in +lemma weighted_overlap (f : Q → Q → ℂ) : + (∑ i, ∑ j, f (d.question i) (d.question j)*Matrix.trace (d.P i*d.P j)) = + (∑ q, ∑ r, f q r)*(Fintype.card D : ℂ) := by + simp_rw [d.weighted_trace] + exact d.weighted_projector_trace (fun q => ∑ r, f q r) +lemma C_trace : Matrix.trace d.C = (Fintype.card Q : ℂ)^2*(Fintype.card D : ℂ) := by + change (∑ ij, d.C ij ij) = _ + rw [Fintype.sum_prod_type] + simp_rw [d.C_diag] + have h := d.weighted_overlap (fun _ _ => 1) + simpa only [one_mul,Finset.sum_const,Finset.card_univ,nsmul_eq_mul,mul_one,pow_two] using h +lemma B_trace : Matrix.trace d.B = (Fintype.card Q : ℂ)*(Fintype.card D : ℂ) := by + change (∑ i, d.C (i,i) (i,i)) = _ + simp_rw [d.C_diag,d.idempotent] + have h := d.weighted_projector_trace (fun _ => 1) + simpa only [one_mul,Finset.sum_const,Finset.card_univ,nsmul_eq_mul,mul_one] using h +lemma B_sum : (∑ i, ∑ j, d.B i j) = + ((∑ q, ∑ r, (correlation d.u q r)^2 : ℝ) : ℂ)*(Fintype.card D : ℂ) := by + simp only [d.B_entry,c] + rw [d.weighted_overlap (fun q r => (correlation d.u q r : ℂ)^2)] + push_cast + rfl +end Data +end ProjectionCriterion + +end + +end OAI diff --git a/lean/OAI/InformationTheory/Entanglement/PublicSampler.lean b/lean/OAI/InformationTheory/Entanglement/PublicSampler.lean new file mode 100644 index 0000000000000000000000000000000000000000..9ef7b8b40e5b08afabcc4c08cf48b040b1d6f40b --- /dev/null +++ b/lean/OAI/InformationTheory/Entanglement/PublicSampler.lean @@ -0,0 +1,44 @@ +import OAI.InformationTheory.Entanglement.IndependentTapes + +namespace OAI + +noncomputable section +open MeasureTheory ProbabilityTheory Filter Function +open scoped MeasureTheory ProbabilityTheory unitInterval +namespace SecretKey +variable {Ω S T Y : Type*} {mΩ : MeasurableSpace Ω} [StandardBorelSpace Ω] +variable [MeasurableSpace S] [MeasurableSpace T] [MeasurableSpace Y] +variable [StandardBorelSpace Y] [Nonempty Y] +variable {μ : Measure Ω} [IsProbabilityMeasure μ] + +omit [StandardBorelSpace Y] [Nonempty Y] in +theorem sampled_public_independence + {F A : MeasurableSpace Ω} (hF : F ≤ mΩ) (_ : A ≤ mΩ) + (H : Ω → S) (hH : @Measurable Ω S mΩ _ H) + (hFH : F ≤ (inferInstance : MeasurableSpace S).comap H) + (hAH : A ≤ (inferInstance : MeasurableSpace S).comap H) + (g : S → T) (hg : Measurable g) (hpub : Measurable[F] (g ∘ H)) + (U : Ω → I) (hU : @Measurable Ω I mΩ _ U) (hind : IndepFun H U μ) + (hUlaw : @Measure.map Ω I mΩ _ U μ=volume) + (κ : Kernel T Y) [IsMarkovKernel κ] + (f : T → I → Y) (hf : Measurable (uncurry f)) + (hmap : ∀ t, volume.map (f t)=κ t) : + CondIndep F A ((inferInstance : MeasurableSpace Y).comap (fun ω => f (g (H ω)) (U ω))) hF μ := by + let : MeasurableSpace Ω := mΩ + have hC : @Measurable Ω Y mΩ _ (fun ω => f (g (H ω)) (U ω)) := + hf.comp ((hg.comp hH).prodMk hU) + apply independent_of_public_conditional_laws hF hH.comap_le hFH hAH hC.comap_le + intro b hb + obtain ⟨E,hE,rfl⟩ := hb + have hs := sampled_conditional_event H U hH hU hind (fun s u => f (g s) u) + (hf.comp ((hg.comp measurable_fst).prodMk measurable_snd)) (κ.comap g hg) + (by intro s; simpa only [hUlaw,Kernel.comap_apply] using hmap (g s)) E hE + have hm : StronglyMeasurable[F] (fun ω => (κ (g (H ω))).real E) := by + exact (((κ.measurable_coe hE).comp hpub).ennreal_toReal).stronglyMeasurable + exact hm.aestronglyMeasurable.congr hs.symm + +end SecretKey + +end + +end OAI diff --git a/lean/OAI/InformationTheory/Entanglement/PurificationExpansion.lean b/lean/OAI/InformationTheory/Entanglement/PurificationExpansion.lean new file mode 100644 index 0000000000000000000000000000000000000000..b5043c9fee78844037bd5563d148eebf0905a033 --- /dev/null +++ b/lean/OAI/InformationTheory/Entanglement/PurificationExpansion.lean @@ -0,0 +1,41 @@ +import OAI.InformationTheory.Entanglement.PurificationSupport +import OAI.InformationTheory.Entanglement.HilbertEmbeddingOrder + +namespace OAI + +noncomputable section +open scoped BigOperators InnerProductSpace ComplexOrder MatrixOrder +open Matrix ContinuousLinearMap +namespace SecretKey +open ChannelCompletion TensorCriterion +variable {n : Type} [Fintype n] [DecidableEq n] +variable {H : Type*} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + +omit [DecidableEq n] [CompleteSpace H] in +theorem purification_orthonormal_expansion (x : n→H) : + ∃ d : ℕ, ∃ v : Fin d→H, ∃ B : Matrix (Fin d) n ℂ, + Orthonormal ℂ v ∧ (∀ j, ∑ i, B i j • v i=x j) ∧ + (∀ i j, (Bᴴ*B) i j=inner ℂ (x i) (x j)) := by + obtain ⟨d,V,B,hx,hg⟩ := purification_finite_span x + let e := EuclideanSpace.basisFun (Fin d) ℂ + let v := fun i => V (e i) + have hv : Orthonormal ℂ v := by + rw [orthonormal_iff_ite] + intro i j + rw [show inner ℂ (v i) (v j)=inner ℂ (e i) (e j) from V.inner_map_map _ _] + exact orthonormal_iff_ite.mp e.orthonormal i j + refine ⟨d,v,B,hv,?_,hg⟩ + intro j + calc + _=V (∑ i, B i j • e i) := by simp only [map_sum,map_smul]; rfl + _=V (WithLp.toLp 2 (fun i => B i j)) := by + congr 1 + simpa only [e,EuclideanSpace.basisFun_repr,WithLp.ofLp_toLp] using + e.sum_repr (WithLp.toLp 2 (fun i => B i j)) + _=x j := hx j + +end SecretKey + +end + +end OAI diff --git a/lean/OAI/InformationTheory/Entanglement/PurificationSupport.lean b/lean/OAI/InformationTheory/Entanglement/PurificationSupport.lean new file mode 100644 index 0000000000000000000000000000000000000000..93fd186acf07d9a18a61d13450cb55a4429291a6 --- /dev/null +++ b/lean/OAI/InformationTheory/Entanglement/PurificationSupport.lean @@ -0,0 +1,53 @@ +import OAI.InformationTheory.Entanglement.FiniteRecovery + +namespace OAI + +noncomputable section +open scoped BigOperators InnerProductSpace ComplexOrder MatrixOrder +open Matrix +namespace SecretKey +open ChannelCompletion TensorCriterion +variable {n : Type} [Fintype n] [DecidableEq n] +variable {H : Type*} [NormedAddCommGroup H] [InnerProductSpace ℂ H] + +omit [DecidableEq n] in +theorem purification_finite_span (x : n → H) : + ∃ d : ℕ, ∃ V : EuclideanSpace ℂ (Fin d) →ₗᵢ[ℂ] H, + ∃ B : Matrix (Fin d) n ℂ, + (∀ j, V (WithLp.toLp 2 (fun a => B a j))=x j) ∧ + (∀ i j, (Bᴴ*B) i j=inner ℂ (x i) (x j)) := by + let S := Submodule.span ℂ (Set.range x) + let : FiniteDimensional ℂ S := FiniteDimensional.span_of_finite ℂ (Set.finite_range x) + let b := stdOrthonormalBasis ℂ S + let v (j : n) : S := ⟨x j,Submodule.subset_span (Set.mem_range_self j)⟩ + let V : EuclideanSpace ℂ (Fin (Module.finrank ℂ S)) →ₗᵢ[ℂ] H := + S.subtypeₗᵢ.comp b.repr.symm.toLinearIsometry + let B : Matrix (Fin (Module.finrank ℂ S)) n ℂ := fun a j => b.repr (v j) a + have hv (j : n) : V (WithLp.toLp 2 (fun a => B a j))=x j := by + change ↑(b.repr.symm (b.repr (v j)))=x j + rw [b.repr.symm_apply_apply] + refine ⟨_,V,B,hv,?_⟩ + intro i j + rw [← hv i,← hv j,V.inner_map_map] + simp only [EuclideanSpace.inner_eq_star_dotProduct, + Matrix.mul_apply,Matrix.conjTranspose_apply,dotProduct,Pi.star_apply,mul_comm] + +theorem purification_support_recovery (i₀ : n) (x : n → H) : + ∃ d : ℕ, ∃ V : EuclideanSpace ℂ (Fin d) →ₗᵢ[ℂ] H, + ∃ B : Matrix (Fin d) n ℂ, ∃ F : Map (Fin d) n, + CP F ∧ TracePreserving F ∧ + (∀ j, V (WithLp.toLp 2 (fun a => B a j))=x j) ∧ + (∀ A : Mat n, F (B*A*Bᴴ)= + CFC.sqrt (Matrix.of fun i j => inner ℂ (x i) (x j))*A*CFC.sqrt (Matrix.of fun i j => inner ℂ (x i) (x j))) := by + obtain ⟨d,V,B,hx,hgram⟩ := purification_finite_span x + obtain ⟨F,hF,hT,hrec⟩ := finite_purification_recovery i₀ B + have he : Bᴴ*B=Matrix.of (fun i j => inner ℂ (x i) (x j)) := by ext i j; exact hgram i j + refine ⟨d,V,B,F,hF,hT,hx,?_⟩ + intro A + simpa only [he] using hrec A + +end SecretKey + +end + +end OAI diff --git a/lean/OAI/InformationTheory/Entanglement/QuantumStepKernel.lean b/lean/OAI/InformationTheory/Entanglement/QuantumStepKernel.lean new file mode 100644 index 0000000000000000000000000000000000000000..2ef3c7b738693e4ed394ad0a462143f9ec780d4e --- /dev/null +++ b/lean/OAI/InformationTheory/Entanglement/QuantumStepKernel.lean @@ -0,0 +1,55 @@ +import OAI.InformationTheory.Entanglement.ProductInstrumentStep + +namespace OAI + +noncomputable section +open scoped BigOperators InnerProductSpace ComplexOrder ENNReal MeasureTheory TensorProduct +open ContinuousLinearMap MeasureTheory ProbabilityTheory +namespace SecretKey +variable {S X : Type*} [MeasurableSpace S] [MeasurableSpace X] +lemma compProd_real_rectangle (ν : Measure S) [IsFiniteMeasure ν] (K : Kernel S X) + [IsMarkovKernel K] {U : Set S} {V : Set X} (hU : MeasurableSet U) (hV : MeasurableSet V) : + (ν ⊗ₘ K).real (U ×ˢ V)=∫ h in U, (K h).real V ∂ν := by + rw [Measure.real,Measure.compProd_apply_prod hU hV] + exact (integral_toReal (K.measurable_coe hV).aemeasurable + (Filter.Eventually.of_forall (fun h => measure_lt_top (K h) V))).symm +variable {H K L : Type*} + [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + [NormedAddCommGroup K] [InnerProductSpace ℂ K] [CompleteSpace K] + [NormedAddCommGroup L] [InnerProductSpace ℂ L] [CompleteSpace L] +variable {ι κ υ : Type*} + +omit [CompleteSpace H] [CompleteSpace L] in +theorem quantum_step_kernel (b : HilbertBasis ι ℂ H) (c : HilbertBasis κ ℂ K) + (d : HilbertBasis υ ℂ L) (J : S→TraceInstrument b c X) + (ρ : S→DensityOperator b) (σ : S→DensityOperator d) + (hm : ∀ V, MeasurableSet V → Measurable (fun h => (J h).outcome (ρ h) V)) + (ν : Measure S) [IsFiniteMeasure ν] (ν' : Measure (S×X)) [IsFiniteMeasure ν'] + (hBorn : ∀ U V, MeasurableSet U → MeasurableSet V → + ν'.real (U ×ˢ V)=∫ h in U, + (tensorFunctional (traceClassTrace c) (traceClassTrace d) + (TensorProduct.map ((J h).event V) LinearMap.id ((ρ h).val ⊗ₜ[ℂ] (σ h).val))).re ∂ν) : + ν'=ν ⊗ₘ TraceInstrument.historyKernel J ρ hm := by + apply Measure.ext_prod + intro U V hU hV + apply (ENNReal.toReal_eq_toReal_iff' (measure_ne_top _ _) (measure_ne_top _ _)).mp + change ν'.real (U ×ˢ V)=(ν ⊗ₘ TraceInstrument.historyKernel J ρ hm).real (U ×ˢ V) + rw [hBorn U V hU hV,compProd_real_rectangle ν _ hU hV] + apply setIntegral_congr_fun hU + intro h hh + exact local_product_born b c d (J h) (ρ h) (σ h) hV + +omit [CompleteSpace H] [CompleteSpace L] in +lemma right_product_born (b : HilbertBasis ι ℂ H) (c : HilbertBasis κ ℂ K) + (d : HilbertBasis υ ℂ L) (I : TraceInstrument b c X) + (ρ : DensityOperator b) (σ : DensityOperator d) {V : Set X} (hV : MeasurableSet V) : + (tensorFunctional (traceClassTrace d) (traceClassTrace c) + (TensorProduct.map LinearMap.id (I.event V) (σ.val ⊗ₜ[ℂ] ρ.val))).re=(I.outcome ρ).real V := by + rw [TensorProduct.map_tmul,tensorFunctional_tmul,LinearMap.id_apply,σ.property.2,one_mul, + I.outcome_born ρ hV] + +end SecretKey + +end + +end OAI diff --git a/lean/OAI/InformationTheory/Entanglement/ReferenceFilter.lean b/lean/OAI/InformationTheory/Entanglement/ReferenceFilter.lean new file mode 100644 index 0000000000000000000000000000000000000000..c9e44c98256927071f9e558416c849c2cb06bb66 --- /dev/null +++ b/lean/OAI/InformationTheory/Entanglement/ReferenceFilter.lean @@ -0,0 +1,92 @@ +import OAI.InformationTheory.Entanglement.MatrixTraceMeasure +import OAI.InformationTheory.Entanglement.ProbeMatrices + +namespace OAI + +noncomputable section +open scoped BigOperators ComplexOrder MatrixOrder MeasureTheory Kronecker +open Matrix MeasureTheory +namespace SecretKey +open ChannelCompletion +variable {Ω : Type*} [MeasurableSpace Ω] +variable {n m : Type} [Fintype n] [Fintype m] [DecidableEq n] [DecidableEq m] +namespace PositiveMatrixMeasure +omit [Fintype m] [DecidableEq n] [DecidableEq m] in +lemma filter_entry_value (W : PositiveMatrixMeasure Ω n) (K : Matrix m n ℂ) (s : Set Ω) : + (fun a b => (∑ i, ∑ j, (K a i*star (K b j)) • W.entry i j) s)=K*W.value s*Kᴴ := by + ext a b + simp only [_root_.sum_apply,_root_.smul_apply,smul_eq_mul,Matrix.mul_apply, + Matrix.conjTranspose_apply,Finset.sum_mul,value] + rw [Finset.sum_comm] + apply Finset.sum_congr rfl + intro i hi + apply Finset.sum_congr rfl + intro j hj + ring + +def filter (W : PositiveMatrixMeasure Ω n) (K : Matrix m n ℂ) : PositiveMatrixMeasure Ω m where + entry a b := ∑ i, ∑ j, (K a i*star (K b j)) • W.entry i j + positive s hs := by + rw [filter_entry_value] + exact (W.positive s hs).mul_mul_conjTranspose_same K +omit [DecidableEq n] [DecidableEq m] in +lemma filter_value (W : PositiveMatrixMeasure Ω n) (K : Matrix m n ℂ) (s : Set Ω) : + (W.filter K).value s=K*W.value s*Kᴴ := filter_entry_value W K s +end PositiveMatrixMeasure +omit [Fintype m] [DecidableEq n] [DecidableEq m] in +lemma filter_density_integrable {μ : Measure Ω} {D : Ω → Mat n} + (hD : ∀ a b, Integrable (fun x => D x a b) μ) (K : Matrix m n ℂ) (a b : m) : + Integrable (fun x => (K*D x*Kᴴ) a b) μ := by + simp only [Matrix.mul_apply,Finset.sum_mul] + exact integrable_finsetSum _ fun j _ => integrable_finsetSum _ fun i _ => + ((hD i j).const_mul _).mul_const _ +omit [Fintype m] [DecidableEq n] [DecidableEq m] in +lemma filter_density_measurable {D : Ω → Mat n} (hD : Measurable D) (K : Matrix m n ℂ) : + Measurable (fun x => K*D x*Kᴴ) := by + have hc : Continuous (fun M : Mat n => K*M*Kᴴ) := by fun_prop + exact hc.measurable.comp hD +omit [DecidableEq n] [DecidableEq m] in +lemma filter_setIntegral {μ : Measure Ω} (W : PositiveMatrixMeasure Ω n) (K : Matrix m n ℂ) + (D : Ω → Mat n) (hD : ∀ a b, Integrable (fun x => D x a b) μ) + (hs : ∀ s, MeasurableSet s → ∀ a b, (∫ x in s, D x a b ∂μ)=W.value s a b) + {s : Set Ω} (hsm : MeasurableSet s) (a b : m) : + (∫ x in s, (K*D x*Kᴴ) a b ∂μ)=(W.filter K).value s a b := by + rw [PositiveMatrixMeasure.filter_value] + simp only [Matrix.mul_apply,Finset.sum_mul] + rw [integral_finsetSum] + · apply Finset.sum_congr rfl + intro j hj + rw [integral_finsetSum] + · apply Finset.sum_congr rfl + intro i hi + rw [integral_mul_const,integral_const_mul, hs s hsm] + · intro i hi + exact (((hD i j).const_mul _).mul_const _).integrableOn + · intro j hj + exact (integrable_finsetSum _ fun i _ => ((hD i j).const_mul _).mul_const _).integrableOn + +def canonicalProbeFilter (R : Mat (n×m)) : Mat (n×m) := + (Real.sqrt ((Fintype.card n : ℝ)*Fintype.card m) : ℂ) • (CFC.sqrt R)ᵀ +lemma canonicalProbeFilter_hermitian (R : Mat (n×m)) : + (canonicalProbeFilter R)ᴴ=canonicalProbeFilter R := by + unfold canonicalProbeFilter + rw [Matrix.conjTranspose_smul,Complex.star_def,Complex.conj_ofReal] + exact congrArg (_ • ·) (sqrt_psd R).isHermitian.transpose.eq +lemma canonicalProbeFilter_product (R : Mat (n×m)) (U : Mat n) (V : Mat m) : + canonicalProbeFilter R*(U ⊗ₖ V)*(canonicalProbeFilter R)ᴴ = + eveBlock R (((Fintype.card n : ℂ) • Uᵀ) ⊗ₖ ((Fintype.card m : ℂ) • Vᵀ)) := by + rw [canonicalProbeFilter_hermitian] + unfold canonicalProbeFilter eveBlock + simp only [Matrix.smul_mul,Matrix.mul_smul,smul_smul] + rw [← Complex.ofReal_mul,Real.mul_self_sqrt (by positivity)] + simp only [Complex.ofReal_mul,Complex.ofReal_natCast] + rw [Matrix.smul_kronecker,Matrix.kronecker_smul,smul_smul,Matrix.mul_smul,Matrix.smul_mul, + Matrix.transpose_smul,Matrix.transpose_mul,Matrix.transpose_mul,Matrix.kroneckerMap_transpose, + Matrix.transpose_transpose] + simp only [Matrix.mul_assoc] + +end SecretKey + +end + +end OAI diff --git a/lean/OAI/InformationTheory/Entanglement/RestrictedIntersections.lean b/lean/OAI/InformationTheory/Entanglement/RestrictedIntersections.lean new file mode 100644 index 0000000000000000000000000000000000000000..2abf469000280984d2997e7941ff6fad8c289268 --- /dev/null +++ b/lean/OAI/InformationTheory/Entanglement/RestrictedIntersections.lean @@ -0,0 +1,67 @@ +import OAI.InformationTheory.Entanglement.BooleanSpan + +namespace OAI + +noncomputable section +open scoped BigOperators +namespace FiniteConstruction + +abbrev Base := {A : Finset (Fin 1028) // A.card=514 ∧ (0 : Fin 1028) ∈ A} +def b : ℕ := Nat.choose 1027 513 +def a₀ : ℕ := ∑ j ∈ Finset.range 257, Nat.choose 1028 j +instance prime257 : Fact (Nat.Prime 257) := ⟨by norm_num⟩ + +lemma sum_monomial_apply {α β : Type} [Fintype α] [Fintype β] + [DecidableEq α] [DecidableEq β] (B : β → Finset α) (A : Finset α) (c : β) : + (∑ a ∈ A, monomial (𝔽 := ZMod 257) B {a}) c=((A ∩ B c).card : ZMod 257) := by + simp only [Finset.sum_apply,monomial,Finset.singleton_subset_iff] + simp + +theorem restricted_intersections (F : Finset Base) + (h : ∀ A ∈ F, ∀ B ∈ F, A ≠ B → (A.val ∩ B.val).card ≠ 257) : + F.card ≤ a₀ := by + let B : F → Finset (Fin 1028) := fun A => A.val.val + have hm (A : F) : Pi.single A (1 : ZMod 257) ∈ lowDegree B 256 := by + have hc : (1 : F → ZMod 257) ∈ lowDegree B 256 := by + simpa only [monomial_empty] using + monomial_mem (𝔽 := ZMod 257) B (s := ∅) (d := 256) (by simp) + have hp := sum_power_mem (𝔽 := ZMod 257) B (B A) 256 + have hd := Submodule.sub_mem (lowDegree (𝔽 := ZMod 257) B 256) hc hp + convert hd using 1 + ext C + simp only [Pi.single_apply,Pi.sub_apply,Pi.one_apply,Pi.pow_apply,sum_monomial_apply] + by_cases he : C=A + · subst C + have hcard : (B A).card=514 := A.val.property.1 + simp [hcard,show (514 : ZMod 257)=0 by decide] + · have hne : A.val ≠ C.val := by intro hh; exact he (Subtype.ext hh.symm) + have hsets : B A ≠ B C := by intro hh; exact hne (Subtype.ext hh) + have hpos : 0 < (B A ∩ B C).card := Finset.card_pos.mpr ⟨0, + Finset.mem_inter.mpr ⟨A.val.property.2,C.val.property.2⟩⟩ + have hle : (B A ∩ B C).card ≤ 514 := by + simpa only [show (B A).card=514 from A.val.property.1] using + Finset.card_le_card (Finset.inter_subset_left : B A ∩ B C ⊆ B A) + have hlt : (B A ∩ B C).card < 514 := by + by_contra hn + have ha : B A ∩ B C=B A := Finset.eq_of_subset_of_card_le + Finset.inter_subset_left (by rw [A.val.property.1]; omega) + have hb : B A ∩ B C=B C := Finset.eq_of_subset_of_card_le + Finset.inter_subset_right (by rw [C.val.property.1]; omega) + exact hsets (ha.symm.trans hb) + have hx : (B A ∩ B C).card ≠ 257 := h A.val A.property C.val C.property hne + have hnz : ((B A ∩ B C).card : ZMod 257) ≠ 0 := by + intro hz + have hdvd := (ZMod.natCast_eq_zero_iff (B A ∩ B C).card 257).mp hz + obtain ⟨t,ht⟩ := hdvd + omega + have hpw := ZMod.pow_card_sub_one_eq_one hnz + norm_num at hpw + simp only [he,ite_false,hpw,sub_self] + have hdim := interpolation_dimension_bound (𝔽 := ZMod 257) B 256 hm + simpa only [Fintype.card_coe,Fintype.card_fin,show 256+1=257 by rfl,a₀] using hdim + +end FiniteConstruction + +end + +end OAI diff --git a/lean/OAI/InformationTheory/Entanglement/ScalarGap.lean b/lean/OAI/InformationTheory/Entanglement/ScalarGap.lean new file mode 100644 index 0000000000000000000000000000000000000000..40b4d9b56bc31e4c5b16824483fca7d0b6b15ceb --- /dev/null +++ b/lean/OAI/InformationTheory/Entanglement/ScalarGap.lean @@ -0,0 +1,69 @@ +import Mathlib + +namespace OAI + +noncomputable section +open MeasureTheory +open scoped BigOperators +namespace SecretKey +variable {Ω : Type*} [MeasurableSpace Ω] {μ : Measure Ω} +lemma sqrt_memLp_two {p : Ω → ℝ} (hp : Integrable p μ) (hn : ∀ x, 0≤p x) : + MemLp (fun x => Real.sqrt (p x)) 2 μ := by + apply (memLp_two_iff_integrable_sq hp.1.aemeasurable.sqrt.aestronglyMeasurable).mpr + simpa only [Real.sq_sqrt (hn _)] using hp +lemma sqrt_product_integrable {p q : Ω → ℝ} (hp : Integrable p μ) (hq : Integrable q μ) + (hn : ∀ x, 0≤p x) (hm : ∀ x, 0≤q x) : Integrable (fun x => Real.sqrt (p x*q x)) μ := by + have hi := (sqrt_memLp_two hp hn).integrable_mul (sqrt_memLp_two hq hm) + simpa only [Pi.mul_def,Real.sqrt_mul (hn _)] using hi +lemma integral_sqrt_product_le {p q : Ω → ℝ} (hp : Integrable p μ) (hq : Integrable q μ) + (hn : ∀ x, 0≤p x) (hm : ∀ x, 0≤q x) : + (∫ x, Real.sqrt (p x*q x) ∂μ) ≤ Real.sqrt ((∫ x, p x ∂μ)*(∫ x, q x ∂μ)) := by + have hh : (2 : ℝ).HolderConjugate 2 := by norm_num [Real.holderConjugate_iff] + have h := integral_mul_le_Lp_mul_Lq_of_nonneg hh + (f := fun x => Real.sqrt (p x)) (g := fun x => Real.sqrt (q x)) + (Filter.Eventually.of_forall fun _ => Real.sqrt_nonneg _) + (Filter.Eventually.of_forall fun _ => Real.sqrt_nonneg _) + (by simpa using sqrt_memLp_two hp hn) (by simpa using sqrt_memLp_two hq hm) + simpa only [Real.rpow_two,Real.sq_sqrt (hn _),Real.sq_sqrt (hm _), + ← Real.sqrt_eq_rpow,Real.sqrt_mul (hn _), + Real.sqrt_mul (integral_nonneg hn)] using h + +lemma two_sqrt_products_le {a b c d : ℝ} (ha : 0≤a) (hb : 0≤b) (hc : 0≤c) (hd : 0≤d) : + Real.sqrt (a*b)+Real.sqrt (c*d) ≤ Real.sqrt ((a+d)*(b+c)) := by + have h := Real.sum_sqrt_mul_sqrt_le (Finset.univ : Finset (Fin 2)) + (f := ![a,d]) (g := ![b,c]) (by intro i; fin_cases i <;> assumption) + (by intro i; fin_cases i <;> assumption) + simpa only [Fin.sum_univ_two,Matrix.cons_val_zero,Matrix.cons_val_one, + Matrix.cons_val_fin_one,← Real.sqrt_mul ha,← Real.sqrt_mul hd, + ← Real.sqrt_mul (add_nonneg ha hd),mul_comm d c] using h +lemma two_sqrt_le_add {a b : ℝ} (ha : 0≤a) (hb : 0≤b) : 2*Real.sqrt (a*b)≤a+b := by + have hs := Real.sq_sqrt (mul_nonneg ha hb) + have hn := Real.sqrt_nonneg (a*b) + nlinarith [sq_nonneg (a-b)] + +theorem scalar_secret_bit_gap {a b c d q η : ℝ} + (ha : 0≤a) (hb : 0≤b) (hc : 0≤c) (hd : 0≤d) + (hs : a+b+c+d=1) (he : b+c≤η/2) (hq : q≤η-(b+c)) + (hf : (a+d-q)/2≤Real.sqrt (a*b)+Real.sqrt (c*d)+2*Real.sqrt (b*c)) : + 1/5≤η := by + have hu := add_le_add (two_sqrt_products_le ha hb hc hd) (two_sqrt_le_add hb hc) + have hlow : (1-η)/2≤Real.sqrt ((b+c)*(1-(b+c)))+(b+c) := by + have hx : (a+d)*(b+c)=(b+c)*(1-(b+c)) := by nlinarith [hs] + rw [hx] at hu + linarith + by_contra hh + have heta : η<1/5 := lt_of_not_ge hh + have en : 0≤b+c := add_nonneg hb hc + have eb : b+c<1/10 := by linarith + have eone : 0≤1-(b+c) := by linarith + have hr := Real.sq_sqrt (mul_nonneg en eone) + have sr := Real.sqrt_nonneg ((b+c)*(1-(b+c))) + have hprod : (b+c)*(1-(b+c))≤9/100 := by + nlinarith [mul_nonneg en (by linarith : 0≤1/10-(b+c))] + have hsqrt : Real.sqrt ((b+c)*(1-(b+c)))≤3/10 := by nlinarith + linarith +end SecretKey + +end + +end OAI diff --git a/lean/OAI/InformationTheory/Entanglement/SecretDefinitions.lean b/lean/OAI/InformationTheory/Entanglement/SecretDefinitions.lean new file mode 100644 index 0000000000000000000000000000000000000000..c6ab21045213ceeeeb38a5463d8ecb299784741e --- /dev/null +++ b/lean/OAI/InformationTheory/Entanglement/SecretDefinitions.lean @@ -0,0 +1,32 @@ +import OAI.Analysis.Quantum.PPTSquare.ChannelModel +import OAI.Analysis.Quantum.PPTSquare.Compression +import OAI.Analysis.Quantum.PPTSquare.TensorModel +import OAI.Analysis.Quantum.PPTSquare.TensorPositivity +import OAI.Analysis.Quantum.PPTSquare.SymmetricVectors +import OAI.Analysis.Quantum.PPTSquare.QuadraticCriterion + +namespace OAI + +noncomputable section +open scoped BigOperators ComplexOrder Kronecker MatrixOrder +open Matrix +namespace SecretKey +open ChannelCompletion TensorCriterion +variable {n m : Type} [Fintype n] [Fintype m] + +noncomputable def traceNorm (A : Matrix n m ℂ) : ℝ := by + classical + exact (Matrix.trace (CFC.sqrt (Aᴴ * A))).re + +def Represented (R : Mat (n × m)) : Prop := + R.PosSemidef ∧ Matrix.trace R = 1 ∧ + ∃ r s : ℕ, 0 < r ∧ 0 < s ∧ + ∃ (L : Map (Fin r) n) (M : Map (Fin s) m) (χ : Fin r × Fin s → ℂ), + CP L ∧ CP (L.comp transposeMap) ∧ CP M ∧ CP (M.comp transposeMap) ∧ + R = tensorMap L M (Matrix.vecMulVec χ (star χ)) + +end SecretKey + +end + +end OAI diff --git a/lean/OAI/InformationTheory/Entanglement/SequentialSampling.lean b/lean/OAI/InformationTheory/Entanglement/SequentialSampling.lean new file mode 100644 index 0000000000000000000000000000000000000000..a42536e33deaf0b25a29527bf9e38a5d11c17380 --- /dev/null +++ b/lean/OAI/InformationTheory/Entanglement/SequentialSampling.lean @@ -0,0 +1,172 @@ +import OAI.InformationTheory.Entanglement.IndependentTapes + +namespace OAI + +noncomputable section +open MeasureTheory ProbabilityTheory Filter Function +open scoped MeasureTheory ProbabilityTheory unitInterval +namespace SecretKey +variable {Ω S X : Type*} [MeasurableSpace Ω] [MeasurableSpace S] + [MeasurableSpace X] +variable {μ : Measure Ω} [IsProbabilityMeasure μ] + +theorem sampled_pair_law (H : Ω → S) (U : Ω → I) + (hH : Measurable H) (hU : Measurable U) (hind : IndepFun H U μ) + (hUlaw : μ.map U=volume) (κ : Kernel S X) [IsMarkovKernel κ] + (f : S → I → X) (hf : Measurable (uncurry f)) + (hmap : ∀ s, volume.map (f s)=κ s) : + μ.map (fun ω => (H ω,f (H ω) (U ω)))=μ.map H ⊗ₘ κ := by + let g : S×I → S×X := fun p => (p.1,f p.1 p.2) + have hg : Measurable g := measurable_fst.prodMk hf + have he : μ.map (fun ω => (H ω,f (H ω) (U ω)))= + ((μ.map H).prod volume).map g := by + rw [← hUlaw,← hind.map_prod_eq_prod_map_map hH.aemeasurable hU.aemeasurable, + Measure.map_map hg (hH.prodMk hU)] + rfl + rw [he] + ext E hE + rw [Measure.map_apply hg hE,Measure.prod_apply (hg hE),Measure.compProd_apply hE] + apply lintegral_congr + intro s + have hm : Measurable (f s) := hf.comp (measurable_const.prodMk measurable_id) + rw [← hmap s,Measure.map_apply hm (measurable_prodMk_left hE)] + rfl + +variable (f : (k : ℕ) → (Fin k → X) → I → X) + +def sampledPrefix : (k : ℕ) → UniformTapes ℕ → (Fin k → X) + | 0,_ => Fin.elim0 + | k+1,ω => Fin.snoc (sampledPrefix k ω) (f k (sampledPrefix k ω) (ω k)) +def sampledHistory (ω : UniformTapes ℕ) (k : ℕ) : X := + f k (sampledPrefix f k ω) (ω k) +omit [MeasurableSpace X] in +lemma sampledPrefix_succ (k : ℕ) (ω : UniformTapes ℕ) : + sampledPrefix f (k+1) ω=Fin.snoc (sampledPrefix f k ω) (sampledHistory f ω k) := rfl +omit [MeasurableSpace X] in +lemma sampledPrefix_eq (k : ℕ) (ω : UniformTapes ℕ) (i : Fin k) : + sampledPrefix f k ω i=sampledHistory f ω i := by + induction k with + | zero => exact Fin.elim0 i + | succ k ih => + refine Fin.lastCases ?_ (fun j => ?_) i + · simp only [sampledPrefix_succ,Fin.snoc_last,Fin.val_last] + · simpa only [sampledPrefix_succ,Fin.snoc_castSucc,Fin.val_castSucc] using ih j + +lemma measurable_tape_coordinate (s : Set ℕ) (k : ℕ) (hk : k∈s) : + Measurable[tapeInformation s] (fun ω : UniformTapes ℕ => ω k) := by + rw [measurable_iff_comap_le] + exact le_iSup_of_le k (le_iSup_of_le hk le_rfl) +lemma sampledPrefix_measurable (hf : ∀ k, Measurable (uncurry (f k))) (k : ℕ) : + Measurable[tapeInformation (Set.Iio k)] (sampledPrefix f k) := by + induction k with + | zero => + let : MeasurableSpace (UniformTapes ℕ) := tapeInformation (Set.Iio 0) + apply Measurable.of_eval; intro i; exact Fin.elim0 i + | succ k ih => + let : MeasurableSpace (UniformTapes ℕ) := tapeInformation (Set.Iio (k+1)) + have hp : Measurable[tapeInformation (Set.Iio (k+1))] (sampledPrefix f k) := + ih.mono (tapeInformation_mono (fun _ h => Nat.lt_trans h (Nat.lt_succ_self k))) le_rfl + have hu := measurable_tape_coordinate (Set.Iio (k+1)) k (Nat.lt_succ_self k) + apply Measurable.of_eval + intro i + refine Fin.lastCases ?_ (fun j => ?_) i + · simpa only [sampledPrefix_succ,sampledHistory,Fin.snoc_last,Function.comp_def,Function.uncurry] using (hf k).comp (hp.prodMk hu) + · simpa only [sampledPrefix_succ,Fin.snoc_castSucc,Function.comp_def] using (measurable_pi_apply j).comp hp +lemma sampledPrefix_measurable_global (hf : ∀ k, Measurable (uncurry (f k))) (k : ℕ) : + Measurable (sampledPrefix f k) := + (sampledPrefix_measurable f hf k).mono (tapeInformation_le _) le_rfl +lemma sampledHistory_measurable (hf : ∀ k, Measurable (uncurry (f k))) : + Measurable (sampledHistory f) := by + apply Measurable.of_eval + intro k + exact (hf k).comp ((sampledPrefix_measurable_global f hf k).prodMk (measurable_pi_apply k)) + +theorem sampled_history_step (hf : ∀ k, Measurable (uncurry (f k))) + (κ : (k : ℕ) → Kernel (Fin k → X) X) [∀ k, IsMarkovKernel (κ k)] + (hmap : ∀ k s, volume.map (f k s)=κ k s) (k : ℕ) : + uniformTapesLaw.map (fun ω => (sampledPrefix f k ω,sampledHistory f ω k))= + uniformTapesLaw.map (sampledPrefix f k) ⊗ₘ κ k := by + apply sampled_pair_law _ _ (sampledPrefix_measurable_global f hf k) + (measurable_pi_apply k) _ (tape_coordinate_law k) (κ k) (f k) (hf k) (hmap k) + exact fresh_coordinate_independent (by simp only [Set.mem_Iio]; exact lt_irrefl k) _ + (sampledPrefix_measurable f hf k) + +end SecretKey + +namespace SecretKey +open MeasureTheory ProbabilityTheory Function +open scoped MeasureTheory ProbabilityTheory unitInterval +variable {X : Type*} [MeasurableSpace X] +def recordPrefix (k : ℕ) (x : ℕ → X) : Fin k → X := fun i => x i +lemma recordPrefix_measurable (k : ℕ) : Measurable (recordPrefix (X := X) k) := by + apply Measurable.of_eval; intro i; exact measurable_pi_apply i.val +lemma snoc_measurable (k : ℕ) : + Measurable (fun p : (Fin k → X)×X => Fin.snoc (α := fun _ : Fin (k+1) => X) p.1 p.2) := by + apply Measurable.of_eval + intro i + refine Fin.lastCases ?_ (fun j => ?_) i + · simpa only [Fin.snoc_last] using measurable_snd + · simpa only [Fin.snoc_castSucc,Function.comp_def] using (measurable_pi_apply j).comp measurable_fst +omit [MeasurableSpace X] in +lemma recordPrefix_succ (k : ℕ) (x : ℕ → X) : + recordPrefix (k+1) x=Fin.snoc (recordPrefix k x) (x k) := by + funext i + refine Fin.lastCases ?_ (fun j => ?_) i <;> simp [recordPrefix] + +theorem full_history_law_unique (ν ξ : Measure (ℕ → X)) [IsFiniteMeasure ν] + (h : ∀ k, ν.map (recordPrefix k)=ξ.map (recordPrefix k)) : ν=ξ := by + let P := fun J : Finset ℕ => ν.map J.restrict + have hν : IsProjectiveLimit ν P := fun J => rfl + have hξ : IsProjectiveLimit ξ P := by + intro J + let k := J.sup id+1 + have hb (i : J) : i.val x ⟨i.val,hb i⟩ + have hg : Measurable g := by fun_prop + have he : J.restrict=(g ∘ recordPrefix k : (ℕ → X) → (J → X)) := rfl + change ξ.map J.restrict=ν.map J.restrict + rw [he,← Measure.map_map hg (recordPrefix_measurable k), + ← Measure.map_map hg (recordPrefix_measurable k),h k] + exact hν.unique hξ + +theorem sampled_full_history_law + (f : (k : ℕ) → (Fin k → X) → I → X) + (hf : ∀ k, Measurable (uncurry (f k))) + (κ : (k : ℕ) → Kernel (Fin k → X) X) [∀ k, IsMarkovKernel (κ k)] + (hmap : ∀ k s, volume.map (f k s)=κ k s) + (ν : Measure (ℕ → X)) [IsProbabilityMeasure ν] + (hν : ∀ k, ν.map (fun x => (recordPrefix k x,x k))=ν.map (recordPrefix k) ⊗ₘ κ k) : + ν=uniformTapesLaw.map (sampledHistory f) := by + have hp : ∀ k, ν.map (recordPrefix k)=uniformTapesLaw.map (sampledPrefix f k) := by + intro k + induction k with + | zero => + have he : recordPrefix (X := X) 0=(fun _ : ℕ → X => (Fin.elim0 : Fin 0 → X)) := by + funext x i; exact Fin.elim0 i + have hf0 : sampledPrefix f 0=(fun _ : UniformTapes ℕ => (Fin.elim0 : Fin 0 → X)) := rfl + rw [he,hf0,Measure.map_const,Measure.map_const] + simp + | succ k ih => + have he : recordPrefix (X := X) (k+1)= + (fun p : (Fin k → X)×X => Fin.snoc (α := fun _ : Fin (k+1) => X) p.1 p.2) ∘ (fun x => (recordPrefix k x,x k)) := by + funext x; exact recordPrefix_succ k x + have hx : Measurable (fun ω : UniformTapes ℕ => sampledHistory f ω k) := by + simpa only [Function.comp_def] using + (measurable_pi_apply k).comp (sampledHistory_measurable f hf) + rw [he,← Measure.map_map (snoc_measurable k) + ((recordPrefix_measurable k).prodMk (measurable_pi_apply k)),hν k,ih, + ← sampled_history_step f hf κ hmap k,Measure.map_map (snoc_measurable k) + ((sampledPrefix_measurable_global f hf k).prodMk hx)] + rfl + apply full_history_law_unique + intro k + rw [Measure.map_map (recordPrefix_measurable k) (sampledHistory_measurable f hf),hp k] + congr 1 + funext ω i + exact sampledPrefix_eq f k ω i + +end SecretKey + +end + +end OAI diff --git a/lean/OAI/InformationTheory/Entanglement/SparseSeparable.lean b/lean/OAI/InformationTheory/Entanglement/SparseSeparable.lean new file mode 100644 index 0000000000000000000000000000000000000000..3b3bd1ef6b3b3dc0792445de9b0193092dbe6c71 --- /dev/null +++ b/lean/OAI/InformationTheory/Entanglement/SparseSeparable.lean @@ -0,0 +1,129 @@ +import OAI.Analysis.Quantum.PPTSquare.ChannelModel +import OAI.Analysis.Quantum.PPTSquare.Compression +import OAI.Analysis.Quantum.PPTSquare.TensorModel +import OAI.Analysis.Quantum.PPTSquare.TensorPositivity +import OAI.Analysis.Quantum.PPTSquare.SymmetricVectors +import OAI.Analysis.Quantum.PPTSquare.QuadraticCriterion + +namespace OAI + +noncomputable section +open scoped BigOperators ComplexOrder MatrixOrder Kronecker +open Matrix +namespace ProjectionCriterion +open ChannelCompletion TensorCriterion +variable {n m r : Type} [Fintype n] [Fintype m] [Fintype r] + +omit [Fintype n] in +lemma projector_col_sum (A : Matrix n m ℂ) : + (∑ j, projector (fun i => A i j)) = A*Aᴴ := by + ext i k + simp only [Matrix.sum_apply,projector,Matrix.vecMulVec_apply,Pi.star_apply, + Matrix.mul_apply,Matrix.conjTranspose_apply] + +lemma separable_rankone {C : Mat (n × m)} [DecidableEq n] [DecidableEq m] + (hC : Separable C) : + ∃ (t : ℕ) (x : Fin t × (n × m) → n → ℂ) (y : Fin t × (n × m) → m → ℂ), + C = ∑ k, projector (product (x k) (y k)) := by + obtain ⟨t,A,B,hA,hB,rfl⟩ := hC + let x : Fin t × (n × m) → n → ℂ := fun k i => CFC.sqrt (A k.1) i k.2.1 + let y : Fin t × (n × m) → m → ℂ := fun k i => CFC.sqrt (B k.1) i k.2.2 + refine ⟨t,x,y,?_⟩ + rw [Fintype.sum_prod_type] + apply Finset.sum_congr rfl + intro k _ + simp only [Fintype.sum_prod_type,x,y,projector_product] + have ha : (∑ j, projector (fun i => CFC.sqrt (A k) i j)) = A k := + (projector_col_sum _).trans (sqrt_mul_conjTranspose _ (hA k)) + have hb : (∑ j, projector (fun i => CFC.sqrt (B k) i j)) = B k := + (projector_col_sum _).trans (sqrt_mul_conjTranspose _ (hB k)) + calc + A k ⊗ₖ B k = (∑ j, projector (fun i => CFC.sqrt (A k) i j)) ⊗ₖ + (∑ j, projector (fun i => CFC.sqrt (B k) i j)) := by rw [ha,hb] + _ = _ := by + ext ⟨a,c⟩ ⟨b,d⟩ + simp only [Matrix.kroneckerMap_apply,Matrix.sum_apply,Finset.sum_mul,Finset.mul_sum] + rw [Finset.sum_comm] + +omit [Fintype n] in +lemma norm_sq_sum_le_card (s : Finset n) (z : n → ℂ) : + ‖∑ i ∈ s, z i‖^2 ≤ (s.card : ℝ) * ∑ i ∈ s, ‖z i‖^2 := by + have h := Finset.sum_mul_sq_le_sq_mul_sq s (fun _ => (1 : ℝ)) (fun i => ‖z i‖) + simp only [one_mul,one_pow,Finset.sum_const,mul_one,nsmul_eq_mul] at h + have hn := norm_sum_le s z + have hx : 0 ≤ ∑ i ∈ s, ‖z i‖ := Finset.sum_nonneg (fun _ _ => norm_nonneg _) + nlinarith [norm_nonneg (∑ i ∈ s, z i)] + +lemma norm_sq_sparse_sum [DecidableEq n] (z : n → ℂ) (κ : ℝ) + (h : ((Finset.univ.filter (fun i => z i ≠ 0)).card : ℝ) ≤ κ) : + ‖∑ i, z i‖^2 ≤ κ * ∑ i, ‖z i‖^2 := by + let S := Finset.univ.filter (fun i => z i ≠ 0) + have hsum : ∑ i ∈ S, z i = ∑ i, z i := by + apply Finset.sum_subset (Finset.filter_subset _ _) + intro i _ hi + simpa [S] using hi + have hsq : ∑ i ∈ S, ‖z i‖^2 = ∑ i, ‖z i‖^2 := by + apply Finset.sum_subset (Finset.filter_subset _ _) + intro i _ hi + have hz : z i=0 := by simpa [S] using hi + simp [hz] + have hc := norm_sq_sum_le_card S z + rw [hsum,hsq] at hc + exact hc.trans (mul_le_mul_of_nonneg_right h (Finset.sum_nonneg (fun i _ => sq_nonneg _))) + +lemma mul_star_re (z : ℂ) : (z * star z).re = ‖z‖^2 := by + rw [Complex.star_def,Complex.mul_conj,Complex.ofReal_re,Complex.normSq_eq_norm_sq] + +omit [Fintype n] in +lemma projector_diagonal (z : n → ℂ) (i : n) : (projector z i i).re = ‖z i‖^2 := + mul_star_re _ +lemma projector_all_sum (z : n → ℂ) : + (∑ i, ∑ j, projector z i j).re = ‖∑ i, z i‖^2 := by + simp only [projector,Matrix.vecMulVec_apply,Pi.star_apply] + simp_rw [← Finset.mul_sum] + rw [← Finset.sum_mul,← star_sum] + exact mul_star_re _ + +def compressionSum (C : Mat (n × n)) : ℝ := (∑ i, ∑ j, C (i,i) (j,j)).re +def compressionTrace (C : Mat (n × n)) : ℝ := (∑ i, C (i,i) (i,i)).re + +theorem separable_compression_bound [DecidableEq n] {C : Mat (n × n)} + (hC : Separable C) (κ : ℝ) + (hclique : ∀ J : Finset n, + (∀ i ∈ J, ∀ j ∈ J, i ≠ j → 0 < (C (i,j) (i,j)).re) → (J.card : ℝ) ≤ κ) : + compressionSum C ≤ κ * compressionTrace C := by + obtain ⟨t,x,y,hC⟩ := separable_rankone hC + let z := fun k i => x k i * y k i + have hd (i j : n) : (C (i,j) (i,j)).re = ∑ k, ‖x k i * y k j‖^2 := by + rw [hC] + simp only [Matrix.sum_apply,Complex.re_sum,projector_diagonal,product] + have hsupport (k : Fin t × (n × n)) : + ((Finset.univ.filter (fun i => z k i ≠ 0)).card : ℝ) ≤ κ := by + apply hclique + intro i hi j hj _ + have hi' : x k i ≠ 0 := (mul_ne_zero_iff.mp (Finset.mem_filter.mp hi).2).1 + have hj' : y k j ≠ 0 := (mul_ne_zero_iff.mp (Finset.mem_filter.mp hj).2).2 + rw [hd] + have hle : ‖x k i*y k j‖^2 ≤ ∑ k', ‖x k' i*y k' j‖^2 := + Finset.single_le_sum (fun k' _ => sq_nonneg ‖x k' i*y k' j‖) (Finset.mem_univ k) + exact (sq_pos_of_pos (norm_pos_iff.mpr (mul_ne_zero hi' hj'))).trans_le hle + have hs : compressionSum C = ∑ k, ‖∑ i, z k i‖^2 := by + rw [hC] + simp only [compressionSum,Matrix.sum_apply,Complex.re_sum] + conv_lhs => arg 2; ext i; rw [Finset.sum_comm] + rw [Finset.sum_comm] + apply Finset.sum_congr rfl + intro k _ + have he (i j : n) : projector (product (x k) (y k)) (i,i) (j,j) = projector (z k) i j := rfl + simp only [he,← Complex.re_sum,projector_all_sum] + have ht : compressionTrace C = ∑ k, ∑ i, ‖z k i‖^2 := by + rw [hC] + simp only [compressionTrace,Matrix.sum_apply,Complex.re_sum,projector_diagonal,product,z] + rw [Finset.sum_comm] + rw [hs,ht,Finset.mul_sum] + exact Finset.sum_le_sum (fun k _ => norm_sq_sparse_sum (z k) κ (hsupport k)) +end ProjectionCriterion + +end + +end OAI diff --git a/lean/OAI/InformationTheory/Entanglement/SpectralCut.lean b/lean/OAI/InformationTheory/Entanglement/SpectralCut.lean new file mode 100644 index 0000000000000000000000000000000000000000..595f90dd7a24588f30a88e276ee2342328c664ae --- /dev/null +++ b/lean/OAI/InformationTheory/Entanglement/SpectralCut.lean @@ -0,0 +1,139 @@ +import OAI.InformationTheory.Entanglement.EffectNormalization + +namespace OAI + +noncomputable section +open scoped BigOperators ComplexOrder MatrixOrder +open Matrix +namespace SecretKey +variable {n : Type} [Fintype n] [DecidableEq n] + +lemma unitary_conjugate_mul {U : Matrix n n ℂ} (hU : Uᴴ*U=1) (A B : Matrix n n ℂ) : + (Uᴴ*A*U)*(Uᴴ*B*U)=Uᴴ*(A*B)*U := by + have hU' := unitary_reverse hU + simp only [Matrix.mul_assoc] + rw [← Matrix.mul_assoc U Uᴴ, hU',Matrix.one_mul] + +lemma unitary_conjugate_cancel {U : Matrix n n ℂ} (hU : Uᴴ*U=1) (A : Matrix n n ℂ) : + U*(Uᴴ*A*U)*Uᴴ=A := by + calc + U*(Uᴴ*A*U)*Uᴴ=(U*Uᴴ)*A*(U*Uᴴ) := by simp only [Matrix.mul_assoc] + _ = A := by rw [unitary_reverse hU,Matrix.one_mul,Matrix.mul_one] + +lemma unitary_conjugate_restore {U : Matrix n n ℂ} (hU : Uᴴ*U=1) (A : Matrix n n ℂ) : + Uᴴ*(U*A*Uᴴ)*U=A := by + calc + Uᴴ*(U*A*Uᴴ)*U=(Uᴴ*U)*A*(Uᴴ*U) := by simp only [Matrix.mul_assoc] + _ = A := by rw [hU,Matrix.one_mul,Matrix.mul_one] + +lemma spectral_cut {A B : Matrix n n ℂ} (hA : A.IsHermitian) (hB : B.IsHermitian) + (hAB : Commute A B) : + ∃ P : Matrix n n ℂ, Pᴴ=P ∧ P*P=P ∧ Commute P A ∧ Commute P B ∧ + (P*(A-B)*P).PosSemidef ∧ ((1-P)*(B-A)*(1-P)).PosSemidef := by + let C := A-B + have hC : C.IsHermitian := hA.sub hB + obtain ⟨U,hU,hdiag⟩ := unitary_spectral hC + have hU' := unitary_reverse hU + let eig := hC.eigenvalues + let a := Uᴴ*A*U + let b := Uᴴ*B*U + let D : Matrix n n ℂ := diagonal (fun i => (eig i : ℂ)) + change Uᴴ*C*U=D at hdiag + have hab : a-b=D := by + rw [← hdiag] + simp [a,b,C,Matrix.mul_sub,Matrix.sub_mul] + have hCA : C*A=A*C := by + dsimp [C] + rw [Matrix.sub_mul,Matrix.mul_sub,hAB.eq] + have hDa : D*a=a*D := by + rw [← hab] + change (Uᴴ*A*U-Uᴴ*B*U)*(Uᴴ*A*U)=(Uᴴ*A*U)*(Uᴴ*A*U-Uᴴ*B*U) + rw [← Matrix.sub_mul,← Matrix.mul_sub] + rw [unitary_conjugate_mul hU,unitary_conjugate_mul hU,hCA] + let q : n → ℂ := fun i => if 0 ≤ eig i then 1 else 0 + let Q : Matrix n n ℂ := diagonal q + have hQ : Qᴴ=Q := by simp [Q,q,Matrix.diagonal_conjTranspose] + have hQQ : Q*Q=Q := by + rw [Matrix.diagonal_mul_diagonal] + congr 1 + funext i + simp [q] + have hezero (i j : n) (hne : (0 ≤ eig i) ≠ (0 ≤ eig j)) : a i j=0 := by + have he := congrArg (fun M => M i j) hDa + simp only [D,Matrix.diagonal_mul,Matrix.mul_diagonal] at he + have hz : ((eig i : ℂ) - eig j)*a i j=0 := by linear_combination he + apply (mul_eq_zero.mp hz).resolve_left + intro hij + apply hne + have hh : eig i=eig j := Complex.ofReal_injective (sub_eq_zero.mp hij) + rw [hh] + have hQa : Q*a=a*Q := by + ext i j + simp only [Q,Matrix.diagonal_mul,Matrix.mul_diagonal,q] + split_ifs with hi hj hj + · simp + · rw [hezero i j (by simp [hi,hj])]; simp + · rw [hezero i j (by simp [hi,hj])]; simp + · simp + have hQb : Q*b=b*Q := by + have hb : b=a-D := by rw [← hab]; abel + rw [hb,Matrix.mul_sub,Matrix.sub_mul,hQa] + congr 1 + simp [Q,D,Matrix.diagonal_mul_diagonal,mul_comm] + let P := U*Q*Uᴴ + have hP : Pᴴ=P := by simp [P,Matrix.conjTranspose_mul,hQ,Matrix.mul_assoc] + have hP' : Uᴴ*P*U=Q := by + dsimp [P] + simp only [← Matrix.mul_assoc,hU,Matrix.one_mul] + rw [Matrix.mul_assoc,hU,Matrix.mul_one] + have hstrong (E F : Matrix n n ℂ) (he : Uᴴ*E*U=Uᴴ*F*U) : E=F := by + have hh := congrArg (fun M => U*M*Uᴴ) he + simpa only [unitary_conjugate_cancel hU] using hh + have hPP : P*P=P := by + apply hstrong + rw [← unitary_conjugate_mul hU P P,hP',hQQ] + have hPA : Commute P A := by + change P*A=A*P + apply hstrong + rw [← unitary_conjugate_mul hU P A,← unitary_conjugate_mul hU A P,hP'] + exact hQa + have hPB : Commute P B := by + change P*B=B*P + apply hstrong + rw [← unitary_conjugate_mul hU P B,← unitary_conjugate_mul hU B P,hP'] + exact hQb + have hRe : Uᴴ*(1-P)*U=1-Q := by + rw [Matrix.mul_sub,Matrix.sub_mul,Matrix.mul_one,hU,hP'] + have hpos : (Q*D*Q).PosSemidef := by + simp only [Q,D,Matrix.diagonal_mul_diagonal] + apply Matrix.PosSemidef.diagonal + intro i + dsimp [q] + split_ifs with hi + · simpa using (show (0:ℂ) ≤ eig i from Complex.nonneg_iff.mpr ⟨hi,by simp⟩) + · simp + have hneg : ((1-Q)*(-D)*(1-Q)).PosSemidef := by + have h1 : (1 : Matrix n n ℂ)=diagonal (fun _ => 1) := Matrix.diagonal_one.symm + simp only [h1,Q,D,Matrix.diagonal_sub,Matrix.diagonal_neg, + Matrix.diagonal_mul_diagonal,Matrix.diagonal_mul_diagonal] + apply Matrix.PosSemidef.diagonal + intro i + dsimp [q] + split_ifs with hi + · simp + · simpa using (show (0:ℂ) ≤ -(eig i:ℂ) from Complex.nonneg_iff.mpr ⟨by simpa using le_of_lt (neg_pos.mpr (lt_of_not_ge hi)),by simp⟩) + refine ⟨P,hP,hPP,hPA,hPB,?_,?_⟩ + · have hh := hpos.mul_mul_conjTranspose_same U + convert hh using 1 + apply hstrong + rw [← unitary_conjugate_mul hU (P*C) P,← unitary_conjugate_mul hU P C,hP',hdiag,unitary_conjugate_restore hU] + · have hh := hneg.mul_mul_conjTranspose_same U + convert hh using 1 + apply hstrong + have hd : Uᴴ*(B-A)*U = -D := by rw [show B-A= -C from by dsimp [C]; abel, Matrix.mul_neg,Matrix.neg_mul,hdiag] + rw [← unitary_conjugate_mul hU ((1-P)*(B-A)) (1-P),← unitary_conjugate_mul hU (1-P) (B-A),hRe,hd,unitary_conjugate_restore hU] +end SecretKey + +end + +end OAI diff --git a/lean/OAI/InformationTheory/Entanglement/SpectralWeights.lean b/lean/OAI/InformationTheory/Entanglement/SpectralWeights.lean new file mode 100644 index 0000000000000000000000000000000000000000..23025c50046f165f094af113d4ade157c29908c9 --- /dev/null +++ b/lean/OAI/InformationTheory/Entanglement/SpectralWeights.lean @@ -0,0 +1,90 @@ +import OAI.InformationTheory.Entanglement.SpectralCut +import OAI.InformationTheory.Entanglement.CPBlocks + +namespace OAI + +noncomputable section +open scoped BigOperators ComplexOrder MatrixOrder Kronecker +open Matrix +namespace SecretKey +open ChannelCompletion TensorCriterion +variable {n m : Type} [Fintype n] [Fintype m] + +def quad (A : Mat n) (x : n → ℂ) : ℝ := (star x ⬝ᵥ A.mulVec x).re + +lemma quad_nonneg {A : Mat n} (hA : A.PosSemidef) (x : n → ℂ) : 0 ≤ quad A x := + (Complex.nonneg_iff.mp (hA.dotProduct_mulVec_nonneg x)).1 +lemma quad_add (A B : Mat n) (x : n → ℂ) : quad (A+B) x=quad A x+quad B x := by + simp [quad,Matrix.add_mulVec,dotProduct_add] +lemma quad_sub (A B : Mat n) (x : n → ℂ) : quad (A-B) x=quad A x-quad B x := by + simp [quad,Matrix.sub_mulVec,dotProduct_sub] +lemma quad_conj (A S : Mat n) (x : n → ℂ) : + quad (Sᴴ*A*S) x=quad A (S.mulVec x) := by + simp only [quad,Matrix.star_mulVec,Matrix.dotProduct_mulVec,Matrix.vecMul_vecMul] +lemma quad_trace (A : Mat n) (x : n → ℂ) : + (Matrix.trace (A*projector x)).re=quad A x := by + rw [Matrix.trace_mul_comm,trace_projector_mul] + rfl + +variable [DecidableEq n] [DecidableEq m] + +lemma matrix_projection_split {A P : Mat n} (hP : P*P=P) (hPA : Commute P A) : + A=P*A*P+(1-P)*A*(1-P) := by + have hPAP : P*A*P=P*A := by + rw [Matrix.mul_assoc,← hPA.eq,← Matrix.mul_assoc,hP] + rw [hPAP] + simp only [Matrix.mul_sub,Matrix.sub_mul,Matrix.one_mul,Matrix.mul_one,hPAP] + rw [hPA.eq] + abel + +omit [Fintype n] [Fintype m] [DecidableEq n] [DecidableEq m] in +lemma sub_kronecker (A C : Mat n) (B : Mat m) : + (A-C) ⊗ₖ B=A ⊗ₖ B-C ⊗ₖ B := by + ext i j + simp [Matrix.kroneckerMap_apply,sub_mul] + +omit [DecidableEq n] in +lemma quad_tensor_filter (A P : Mat n) (B : Mat m) (x : n × m → ℂ) : + quad (A ⊗ₖ B) ((P ⊗ₖ (1 : Mat m)).mulVec x)=quad ((Pᴴ*A*P) ⊗ₖ B) x := by + rw [← quad_conj] + simp only [Matrix.conjTranspose_kronecker,Matrix.conjTranspose_one, + ← Matrix.mul_kronecker_mul,Matrix.one_mul,Matrix.mul_one] + +lemma spectral_weights (A : Fin 2 → Mat n) (B : Fin 2 → Mat m) + (hA : ∀ i, (A i).PosSemidef) (hB : ∀ j, (B j).PosSemidef) + (hcomm : Commute (A 0) (A 1)) (x : n × m → ℂ) : + ∃ v w : n × m → ℂ, x=v+w ∧ + (∀ i j, quad (A i ⊗ₖ B j) x=quad (A i ⊗ₖ B j) v+quad (A i ⊗ₖ B j) w) ∧ + quad (A 1 ⊗ₖ B 1) v≤quad (A 0 ⊗ₖ B 1) v ∧ + quad (A 0 ⊗ₖ B 0) w≤quad (A 1 ⊗ₖ B 0) w := by + obtain ⟨P,hPh,hPP,hPA,hPB,hpos,hneg⟩ := spectral_cut (hA 0).isHermitian (hA 1).isHermitian hcomm + let Q : Mat n := 1-P + have hQh : Qᴴ=Q := by simp [Q,Matrix.conjTranspose_sub,hPh] + let v := (P ⊗ₖ (1 : Mat m)).mulVec x + let w := (Q ⊗ₖ (1 : Mat m)).mulVec x + have hsum : x=v+w := by + dsimp [v,w,Q] + rw [← Matrix.add_mulVec,← Matrix.add_kronecker] + simp + have hPc (i : Fin 2) : Commute P (A i) := by fin_cases i <;> assumption + refine ⟨v,w,hsum,?_,?_,?_⟩ + · intro i j + dsimp [v,w] + rw [quad_tensor_filter,quad_tensor_filter,hPh,hQh,← quad_add, + ← Matrix.add_kronecker,← matrix_projection_split hPP (hPc i)] + · dsimp [v] + rw [quad_tensor_filter,quad_tensor_filter,hPh] + have h := quad_nonneg (hpos.kronecker (hB 1)) x + rw [Matrix.mul_sub P (A 0) (A 1),Matrix.sub_mul,sub_kronecker,quad_sub] at h + linarith + · dsimp [w] + rw [quad_tensor_filter,quad_tensor_filter,hQh] + have h := quad_nonneg (hneg.kronecker (hB 0)) x + change 0≤quad ((Q*(A 1-A 0)*Q) ⊗ₖ B 0) x at h + rw [Matrix.mul_sub Q (A 1) (A 0),Matrix.sub_mul (Q*A 1) (Q*A 0) Q,sub_kronecker,quad_sub] at h + linarith +end SecretKey + +end + +end OAI diff --git a/lean/OAI/InformationTheory/Entanglement/SplittingEmbedding.lean b/lean/OAI/InformationTheory/Entanglement/SplittingEmbedding.lean new file mode 100644 index 0000000000000000000000000000000000000000..a79130e26692fd325f0e4ad1ebe7363ee439422c --- /dev/null +++ b/lean/OAI/InformationTheory/Entanglement/SplittingEmbedding.lean @@ -0,0 +1,17 @@ +import OAI.Analysis.Quantum.PPTSquare.FieldExtension +import OAI.Analysis.Quantum.PPTSquare.SplittingSetup +import Mathlib.Analysis.Complex.Polynomial.Basic + +namespace OAI + +noncomputable section +open Polynomial +namespace SplittingEmbedding +abbrev f : ℤ[X] := PencilAlgebra.N0Num.charpoly +abbrev K := SplittingSetup.Split f +def phi : K →ₐ[ℚ] ℂ := Polynomial.SplittingField.lift (f.map (Int.castRingHom ℚ)) (IsAlgClosed.splits _) +end SplittingEmbedding + +end + +end OAI diff --git a/lean/OAI/InformationTheory/Entanglement/TensorClosure.lean b/lean/OAI/InformationTheory/Entanglement/TensorClosure.lean new file mode 100644 index 0000000000000000000000000000000000000000..7ddd28858c3a3905016e1358e4d8ccf5a22b9520 --- /dev/null +++ b/lean/OAI/InformationTheory/Entanglement/TensorClosure.lean @@ -0,0 +1,149 @@ +import OAI.InformationTheory.Entanglement.SecretDefinitions + +namespace OAI + +noncomputable section +open scoped BigOperators ComplexOrder MatrixOrder Kronecker +open Matrix +namespace SecretKey +open ChannelCompletion TensorCriterion +variable {a b c d r s u v : Type} [Fintype a] [Fintype b] [Fintype c] [Fintype d] + [Fintype r] [Fintype s] [Fintype u] [Fintype v] + +def groupedTensor (A : Mat (a × b)) (B : Mat (c × d)) : Mat ((a × c) × (b × d)) := + (A ⊗ₖ B).submatrix (Equiv.prodProdProdComm a c b d) (Equiv.prodProdProdComm a c b d) + +omit [Fintype a] [Fintype b] [Fintype c] [Fintype d] in +lemma groupedTensor_apply (A : Mat (a × b)) (B : Mat (c × d)) + (i j : (a × c) × (b × d)) : + groupedTensor A B i j=A (i.1.1,i.2.1) (j.1.1,j.2.1)*B (i.1.2,i.2.2) (j.1.2,j.2.2) := rfl + +lemma groupedTensor_psd {A : Mat (a × b)} {B : Mat (c × d)} + (hA : A.PosSemidef) (hB : B.PosSemidef) : (groupedTensor A B).PosSemidef := + (hA.kronecker hB).submatrix _ + +lemma groupedTensor_trace (A : Mat (a × b)) (B : Mat (c × d)) : + Matrix.trace (groupedTensor A B)=Matrix.trace A*Matrix.trace B := by + change (∑ i, (A ⊗ₖ B) ((Equiv.prodProdProdComm a c b d) i) ((Equiv.prodProdProdComm a c b d) i))=_ + exact ((Equiv.prodProdProdComm a c b d).sum_comp + (fun i => (A ⊗ₖ B) i i)).trans (Matrix.trace_kronecker A B) + +lemma tensorMap_input_transpose (F : Map a b) (G : Map c d) : + (tensorMap F G).comp transposeMap=tensorMap (F.comp transposeMap) (G.comp transposeMap) := rfl + +def inputReindex (e : r ≃ a) (F : Map a b) : Map r b where + toFun A := F (A.submatrix e.symm e.symm) + map_add' A B := by exact map_add F _ _ + map_smul' z A := by exact map_smul F _ _ + +omit [Fintype a] [Fintype b] [Fintype r] in +lemma inputReindex_cp (e : r ≃ a) {F : Map a b} (hF : CP F) : CP (inputReindex e F) := by + intro k _ X hX + exact hF k (X.submatrix (Prod.map id e.symm) (Prod.map id e.symm)) (hX.submatrix _) + +omit [Fintype a] [Fintype b] [Fintype r] in +lemma inputReindex_transpose (e : r ≃ a) (F : Map a b) : + (inputReindex e F).comp transposeMap=inputReindex e (F.comp transposeMap) := rfl + +lemma tensorMap_inputReindex (e : r ≃ a) (f : s ≃ c) (F : Map a b) (G : Map c d) + (A : Mat (r × s)) : + tensorMap (inputReindex e F) (inputReindex f G) A= + tensorMap F G (A.submatrix (e.symm.prodCongr f.symm) (e.symm.prodCongr f.symm)) := rfl + +lemma represented_of_finite [Nonempty r] [Nonempty s] + {R : Mat (a × b)} (hR : R.PosSemidef) (ht : Matrix.trace R=1) + (L : Map r a) (M : Map s b) (χ : r × s → ℂ) + (hL : CP L) (hLT : CP (L.comp transposeMap)) + (hM : CP M) (hMT : CP (M.comp transposeMap)) + (he : R=tensorMap L M (projector χ)) : Represented R := by + classical + let e := (Fintype.equivFin r).symm + let f := (Fintype.equivFin s).symm + refine ⟨hR,ht,Fintype.card r,Fintype.card s,Fintype.card_pos,Fintype.card_pos, + inputReindex e L,inputReindex f M,χ ∘ (e.prodCongr f),inputReindex_cp e hL,?_, + inputReindex_cp f hM,?_,?_⟩ + · rw [inputReindex_transpose] + exact inputReindex_cp e hLT + · rw [inputReindex_transpose] + exact inputReindex_cp f hMT + · rw [tensorMap_inputReindex] + convert he using 1 + congr 1 + ext ⟨i,i'⟩ ⟨j,j'⟩ + simp only [projector,Matrix.submatrix_apply,Matrix.vecMulVec_apply,Pi.star_apply, + Function.comp_apply,Equiv.prodCongr_apply,Prod.map_apply,Equiv.apply_symm_apply] + +omit [Fintype a] [Fintype b] [Fintype c] [Fintype d] in +lemma groupedTensor_projector (χ : a × b → ℂ) (ψ : c × d → ℂ) : + groupedTensor (projector χ) (projector ψ)= + projector (fun i : (a × c) × (b × d) => χ (i.1.1,i.2.1)*ψ (i.1.2,i.2.2)) := by + ext i j + simp only [groupedTensor_apply,projector,Matrix.vecMulVec_apply,Pi.star_apply,star_mul] + ring +lemma tensorMap_groupedTensor (L : Map r a) (M : Map s b) + (L' : Map u c) (M' : Map v d) (A : Mat (r × s)) (B : Mat (u × v)) : + tensorMap (tensorMap L L') (tensorMap M M') (groupedTensor A B)= + groupedTensor (tensorMap L M A) (tensorMap L' M' B) := by + ext i j + change tensorMap L L' (Matrix.of fun k l => + tensorMap M M' ((Matrix.of fun x y => A (k.1,x) (l.1,y)) ⊗ₖ + (Matrix.of fun x y => B (k.2,x) (l.2,y))) i.2 j.2) i.1 j.1=_ + simp_rw [tensorMap_kronecker] + change tensorMap L L' ((Matrix.of fun k l => M (Matrix.of fun x y => A (k,x) (l,y)) i.2.1 j.2.1) ⊗ₖ + (Matrix.of fun k l => M' (Matrix.of fun x y => B (k,x) (l,y)) i.2.2 j.2.2)) i.1 j.1=_ + rw [tensorMap_kronecker] + rfl + +theorem represented_groupedTensor {A : Mat (a × b)} {B : Mat (c × d)} + (hA : Represented A) (hB : Represented B) : Represented (groupedTensor A B) := by + classical + obtain ⟨hAp,hAt,r,s,hr,hs,L,M,χ,hL,hLT,hM,hMT,hA⟩ := hA + obtain ⟨hBp,hBt,u,v,hu,hv,L',M',ψ,hL',hLT',hM',hMT',hB⟩ := hB + let : NeZero r := ⟨Nat.ne_of_gt hr⟩ + let : NeZero s := ⟨Nat.ne_of_gt hs⟩ + let : NeZero u := ⟨Nat.ne_of_gt hu⟩ + let : NeZero v := ⟨Nat.ne_of_gt hv⟩ + refine represented_of_finite (groupedTensor_psd hAp hBp) + (by rw [groupedTensor_trace,hAt,hBt]; ring) + (tensorMap L L') (tensorMap M M') + (fun i => χ (i.1.1,i.2.1)*ψ (i.1.2,i.2.2)) + (cp_tensorMap hL hL') ?_ (cp_tensorMap hM hM') ?_ ?_ + · rw [tensorMap_input_transpose] + exact cp_tensorMap hLT hLT' + · rw [tensorMap_input_transpose] + exact cp_tensorMap hMT hMT' + · rw [← groupedTensor_projector,tensorMap_groupedTensor] + exact congrArg₂ groupedTensor hA hB + +def CopyIndex (a : Type) : ℕ → Type + | 0 => a + | k+1 => CopyIndex a k × a + +instance copyIndex_fintype (a : Type) [Fintype a] : (k : ℕ) → Fintype (CopyIndex a k) + | 0 => inferInstanceAs (Fintype a) + | k+1 => letI := copyIndex_fintype a k; inferInstanceAs (Fintype (CopyIndex a k × a)) + +def groupedCopies (A : Mat (a × b)) : (k : ℕ) → Mat (CopyIndex a k × CopyIndex b k) + | 0 => A + | k+1 => groupedTensor (groupedCopies A k) A + +lemma copyIndex_card (a : Type) [Fintype a] (k : ℕ) : + Fintype.card (CopyIndex a k)=Fintype.card a^(k+1) := by + induction k with + | zero => change Fintype.card a=Fintype.card a^1; simp + | succ k ih => + change Fintype.card (CopyIndex a k × a)=_ + rw [Fintype.card_prod,ih] + exact (pow_succ (Fintype.card a) (k+1)).symm + +theorem represented_groupedCopies {A : Mat (a × b)} (hA : Represented A) (k : ℕ) : + Represented (groupedCopies A k) := by + induction k with + | zero => exact hA + | succ k ih => exact represented_groupedTensor ih hA + +end SecretKey + +end + +end OAI diff --git a/lean/OAI/InformationTheory/Entanglement/TensorPowers.lean b/lean/OAI/InformationTheory/Entanglement/TensorPowers.lean new file mode 100644 index 0000000000000000000000000000000000000000..73fe8bd3db8de41f9780f5a8456172e37413b52f --- /dev/null +++ b/lean/OAI/InformationTheory/Entanglement/TensorPowers.lean @@ -0,0 +1,175 @@ +import OAI.InformationTheory.Entanglement.ChoiTransfer +import OAI.InformationTheory.Entanglement.SecretDefinitions +import OAI.InformationTheory.Entanglement.MultiTensor + +namespace OAI + +noncomputable section +open scoped BigOperators ComplexOrder MatrixOrder Kronecker +open Matrix +namespace SecretKey +open ChannelCompletion TensorCriterion FiniteConstruction +variable {S n m p q : Type} [Fintype S] [Fintype n] [Fintype m] [Fintype p] [Fintype q] + [DecidableEq S] [DecidableEq n] [DecidableEq m] [DecidableEq p] [DecidableEq q] +lemma multiTensor_psd {M : S → Mat n} (hM : ∀ s, (M s).PosSemidef) : + (multiTensor M).PosSemidef := by + have he : multiTensor M=multiTensor (fun s => CFC.sqrt (M s))* + (multiTensor (fun s => CFC.sqrt (M s)))ᴴ := by + rw [multiTensor_adjoint,multiTensor_mul] + congr 1 + funext s + exact (TensorCriterion.sqrt_mul_conjTranspose (M s) (hM s)).symm + rw [he] + exact Matrix.posSemidef_self_mul_conjTranspose _ + +def powerMap (F : Map n m) : Map (S → n) (S → m) where + toFun A := Matrix.of fun a b => ∑ i, ∑ j, A i j * ∏ s, F (Matrix.single (i s) (j s) 1) (a s) (b s) + map_add' A B := by + ext a b + change (∑ i, ∑ j, (A i j+B i j) * ∏ s, F (Matrix.single (i s) (j s) 1) (a s) (b s)) = + (∑ i, ∑ j, A i j * ∏ s, F (Matrix.single (i s) (j s) 1) (a s) (b s)) + + (∑ i, ∑ j, B i j * ∏ s, F (Matrix.single (i s) (j s) 1) (a s) (b s)) + simp only [add_mul,Finset.sum_add_distrib] + map_smul' c A := by + ext a b + change (∑ i, ∑ j, (c*A i j) * ∏ s, F (Matrix.single (i s) (j s) 1) (a s) (b s)) = + c*(∑ i, ∑ j, A i j * ∏ s, F (Matrix.single (i s) (j s) 1) (a s) (b s)) + simp only [mul_assoc,Finset.mul_sum] +omit [Fintype m] [DecidableEq m] in +lemma powerMap_single (F : Map n m) (i j : S → n) : + powerMap F (Matrix.single i j 1)=fun a b => ∏ s, F (Matrix.single (i s) (j s) 1) (a s) (b s) := by + ext a b + simp [powerMap,Matrix.single_apply,ite_and] +lemma powerMap_cp {F : Map n m} (hF : CP F) : CP (powerMap (S := S) F) := by + apply cp_of_choi + have he : choi (powerMap (S := S) F)= + (multiTensor (fun _ : S => choi F)).submatrix + (fun a s => (a.1 s,a.2 s)) (fun a s => (a.1 s,a.2 s)) := by + ext a b + exact congrFun (congrFun (powerMap_single F a.1 b.1) a.2) b.2 + rw [he] + exact (multiTensor_psd (fun _ => cp_choi hF)).submatrix _ +omit [Fintype m] [DecidableEq m] in +lemma powerMap_input_transpose (F : Map n m) : + (powerMap (S := S) F).comp transposeMap=powerMap (F.comp transposeMap) := by + ext A a b + change (∑ i, ∑ j, A j i * ∏ s, F (Matrix.single (i s) (j s) 1) (a s) (b s))=_ + rw [Finset.sum_comm] + change (∑ i, ∑ j, A i j * ∏ s, F (Matrix.single (j s) (i s) 1) (a s) (b s))=_ + simp only [powerMap,LinearMap.comp_apply,transposeMap_apply,Matrix.transpose_single] + rfl +lemma powerMap_input_cp {F : Map n m} (hF : CP (F.comp transposeMap)) : + CP ((powerMap (S := S) F).comp transposeMap) := by + rw [powerMap_input_transpose] + exact powerMap_cp hF + +def pull (e : p → n) : Map n p where + toFun A := A.submatrix e e + map_add' _ _ := rfl + map_smul' _ _ := rfl +omit [Fintype n] [Fintype p] [DecidableEq n] [DecidableEq p] in +lemma pull_cp (e : p → n) : CP (pull e) := by + intro k _ A hA + exact hA.submatrix (fun a : k×p => (a.1,e a.2)) +omit [Fintype n] [Fintype p] [DecidableEq n] [DecidableEq p] in +lemma pull_transpose (e : p → n) : (pull e).comp transposeMap=transposeMap.comp (pull e) := rfl +omit [DecidableEq n] [DecidableEq m] [DecidableEq p] [DecidableEq q] in +lemma tensorMap_pull (e : p → n) (f : q → m) : + tensorMap (pull e) (pull f)=pull (fun a => (e a.1,f a.2)) := rfl + +omit [DecidableEq n] [DecidableEq m] [DecidableEq p] [DecidableEq q] in +lemma represented_of_witness {R : Mat (n×m)} (hR : R.PosSemidef) (h1 : Matrix.trace R=1) + [Nonempty p] [Nonempty q] (L : Map p n) (M : Map q m) (χ : p×q → ℂ) + (hL : CP L) (hLT : CP (L.comp transposeMap)) + (hM : CP M) (hMT : CP (M.comp transposeMap)) + (he : R=tensorMap L M (projector χ)) : Represented R := by + let e := Fintype.equivFin p + let f := Fintype.equivFin q + let L' := L.comp (pull e) + let M' := M.comp (pull f) + let χ' : Fin (Fintype.card p) × Fin (Fintype.card q) → ℂ := + fun a => χ (e.symm a.1,f.symm a.2) + refine ⟨hR,h1,Fintype.card p,Fintype.card q,Fintype.card_pos,Fintype.card_pos,L',M',χ', + cp_comp hL (pull_cp e),?_,cp_comp hM (pull_cp f),?_,?_⟩ + · change CP ((L.comp (pull e)).comp transposeMap) + rw [LinearMap.comp_assoc,pull_transpose,← LinearMap.comp_assoc] + exact cp_comp hLT (pull_cp e) + · change CP ((M.comp (pull f)).comp transposeMap) + rw [LinearMap.comp_assoc,pull_transpose,← LinearMap.comp_assoc] + exact cp_comp hMT (pull_cp f) + · change R=tensorMap (L.comp (pull e)) (M.comp (pull f)) (projector χ') + rw [← tensorMap_comp,tensorMap_pull] + change R=tensorMap L M ((projector χ').submatrix (fun a => (e a.1,f a.2)) (fun a => (e a.1,f a.2))) + have hc : (projector χ').submatrix (fun a => (e a.1,f a.2)) (fun a => (e a.1,f a.2))=projector χ := by + ext a b + simp [χ',projector,Matrix.vecMulVec_apply] + rw [hc] + exact he + +omit [DecidableEq n] [DecidableEq m] in +lemma tensorMap_entry_sum (L : Map p n) (M : Map q m) (A : Mat (p×q)) + (a b : n×m) : tensorMap L M A a b= + ∑ i, ∑ j, A i j*(L (Matrix.single i.1 j.1 1) a.1 b.1* + M (Matrix.single i.2 j.2 1) a.2 b.2) := by + rw [linearMap_entries (tensorMap L M)] + simp only [Matrix.sum_apply,Matrix.smul_apply,smul_eq_mul] + apply Finset.sum_congr rfl + intro i _ + apply Finset.sum_congr rfl + intro j _ + rw [← single_product,tensorMap_kronecker] + rfl + +def tensorPower (R : Mat (n×m)) : Mat ((S → n)×(S → m)) := + fun a b => ∏ s, R (a.1 s,a.2 s) (b.1 s,b.2 s) +def vectorPower (χ : p×q → ℂ) : (S → p)×(S → q) → ℂ := + fun a => ∏ s, χ (a.1 s,a.2 s) +lemma tensorPower_psd {R : Mat (n×m)} (hR : R.PosSemidef) : + (tensorPower (S := S) R).PosSemidef := + (multiTensor_psd (fun _ : S => hR)).submatrix (fun a : (S → n)×(S → m) => fun s => (a.1 s,a.2 s)) +omit [DecidableEq n] [DecidableEq m] in +lemma tensorPower_trace (R : Mat (n×m)) : + Matrix.trace (tensorPower (S := S) R)=(Matrix.trace R)^(Fintype.card S) := by + let e := Equiv.arrowProdEquivProdArrow S (fun _ => n) (fun _ => m) + have he := e.symm.sum_comp (fun a : S → n×m => ∏ s, R (a s) (a s)) + change (∑ a : (S → n)×(S → m), ∏ s, R (a.1 s,a.2 s) (a.1 s,a.2 s))=_ + calc + _ = ∑ i : S → n×m, ∏ s, R (i s) (i s) := he + _ = ∏ _ : S, ∑ a : n×m, R a a := (Fintype.prod_sum (fun _ : S => fun a : n×m => R a a)).symm + _ = _ := by simp only [Matrix.trace,Matrix.diag,Finset.prod_const,Finset.card_univ] +omit [DecidableEq n] [DecidableEq m] in +lemma powerMap_representation (L : Map p n) (M : Map q m) (χ : p×q → ℂ) : + tensorPower (S := S) (tensorMap L M (projector χ))= + tensorMap (powerMap L) (powerMap M) (projector (vectorPower χ)) := by + ext a b + change (∏ s, tensorMap L M (projector χ) (a.1 s,a.2 s) (b.1 s,b.2 s))=_ + simp_rw [tensorMap_entry_sum] + simp only [Fintype.sum_prod_type] + simp_rw [Fintype.prod_sum] + simp only [powerMap_single,projector,Matrix.vecMulVec_apply,Pi.star_apply,vectorPower] + apply Finset.sum_congr rfl + intro i _ + apply Finset.sum_congr rfl + intro k _ + apply Finset.sum_congr rfl + intro j _ + apply Finset.sum_congr rfl + intro l _ + simp only [Finset.prod_mul_distrib,star_prod] + +theorem represented_tensorPower {R : Mat (n×m)} (hR : Represented R) : + Represented (tensorPower (S := S) R) := by + obtain ⟨hRp,hRt,r,s,hr,hs,L,M,χ,hL,hLT,hM,hMT,hEq⟩ := hR + have : Nonempty (Fin r) := ⟨⟨0,hr⟩⟩ + have : Nonempty (Fin s) := ⟨⟨0,hs⟩⟩ + apply represented_of_witness (tensorPower_psd hRp) (by rw [tensorPower_trace,hRt,one_pow]) + (powerMap L) (powerMap M) (vectorPower χ) (powerMap_cp hL) (powerMap_input_cp hLT) + (powerMap_cp hM) (powerMap_input_cp hMT) + rw [hEq] + exact powerMap_representation L M χ + +end SecretKey + +end + +end OAI diff --git a/lean/OAI/InformationTheory/Entanglement/TensorTools.lean b/lean/OAI/InformationTheory/Entanglement/TensorTools.lean new file mode 100644 index 0000000000000000000000000000000000000000..f4267f8ad54d7bddeea9f7a56f8cdb3c0ba4c128 --- /dev/null +++ b/lean/OAI/InformationTheory/Entanglement/TensorTools.lean @@ -0,0 +1,107 @@ +import OAI.InformationTheory.Entanglement.CPBlocks + +namespace OAI + +noncomputable section +open scoped BigOperators ComplexOrder MatrixOrder Kronecker +open Matrix +namespace SecretKey +open ChannelCompletion TensorCriterion +variable {n m p q r s t : Type} [Fintype n] [Fintype m] [Fintype p] [Fintype q] + [Fintype r] [Fintype s] [Fintype t] + +omit [Fintype n] [Fintype m] in +lemma single_product [DecidableEq n] [DecidableEq m] (i j : n × m) : + (Matrix.single i.1 j.1 (1:ℂ)) ⊗ₖ (Matrix.single i.2 j.2 (1:ℂ)) = Matrix.single i j 1 := by + simpa using (Matrix.single_kronecker_single i.1 j.1 i.2 j.2 (1:ℂ) 1) + +omit [Fintype p] in +lemma linearMap_eq_of_tensors [DecidableEq n] [DecidableEq m] + (F G : Map (n × m) p) + (h : ∀ (A : Mat n) (B : Mat m), F (A ⊗ₖ B)=G (A ⊗ₖ B)) : F=G := by + apply LinearMap.ext + intro X + induction X using Matrix.induction_on' with + | h_zero => simp + | h_add A B hA hB => simp [hA,hB] + | h_std_basis i j c => + have he : Matrix.single i j c=c • Matrix.single i j (1:ℂ) := by simp + rw [he,map_smul,map_smul,← single_product] + rw [h] + +lemma tensorMap_comp [DecidableEq n] [DecidableEq m] + (F : Map n p) (G : Map m q) (H : Map p r) (J : Map q s) : + (tensorMap H J).comp (tensorMap F G)=tensorMap (H.comp F) (J.comp G) := by + apply linearMap_eq_of_tensors + intro A B + simp only [LinearMap.comp_apply,tensorMap_kronecker] + +lemma tensorMap_ad [DecidableEq n] [DecidableEq m] (S : Matrix p n ℂ) (T : Matrix q m ℂ) : + tensorMap (ad S) (ad T)=ad (S ⊗ₖ T) := by + apply linearMap_eq_of_tensors + intro A B + simp only [tensorMap_kronecker,ad_apply,Matrix.mul_kronecker_mul,Matrix.conjTranspose_kronecker] + +lemma tensorMap_id [DecidableEq n] [DecidableEq m] : + tensorMap (LinearMap.id : Map n n) (LinearMap.id : Map m m)=LinearMap.id := by + apply linearMap_eq_of_tensors + intro A B + simp [tensorMap_kronecker] + +lemma tensorMap_transpose [DecidableEq n] [DecidableEq m] : + tensorMap (transposeMap : Map n n) (transposeMap : Map m m)=transposeMap := by + apply linearMap_eq_of_tensors + intro A B + simp only [tensorMap_kronecker,transposeMap_apply,Matrix.kroneckerMap_transpose] + +lemma cp_tensor_input_transpose [DecidableEq n] [DecidableEq m] + {F : Map n p} {G : Map m q} (hF : CP (F.comp transposeMap)) + (hG : CP (G.comp transposeMap)) : CP ((tensorMap F G).comp transposeMap) := by + rw [← tensorMap_transpose, tensorMap_comp] + exact cp_tensorMap hF hG + +lemma hsAdjoint_tensor_effect [DecidableEq n] [DecidableEq m] + (F : Map n p) (G : Map m q) (A : Mat p) (B : Mat q) : + hsAdjoint (tensorMap F G) (A ⊗ₖ B)=hsAdjoint F A ⊗ₖ hsAdjoint G B := by + ext ⟨i,k⟩ ⟨j,l⟩ + change (∑ a, ∑ b, star (tensorMap F G (Matrix.single (i,k) (j,l) 1) a b) * + (A ⊗ₖ B) a b) = + (∑ a, ∑ b, star (F (Matrix.single i j 1) a b)*A a b) * + (∑ a, ∑ b, star (G (Matrix.single k l 1) a b)*B a b) + simp_rw [← single_product (i,k) (j,l),tensorMap_kronecker] + have he (c d e f : ℂ) : star (c*d)*(e*f)=(star c*e)*(star d*f) := by + simp only [star_mul] + ring + simp only [Matrix.kroneckerMap_apply,Fintype.sum_prod_type] + simp_rw [he, ← Finset.mul_sum] + simp_rw [← Finset.sum_mul] + simp_rw [← Finset.mul_sum] + rw [← Finset.sum_mul] + +lemma pullback_tensor [DecidableEq n] [DecidableEq m] + {F : Map n p} {G : Map m q} (hF : CP F) (hG : CP G) + (A : Mat p) (B : Mat q) (Z : Mat (n × m)) : + Matrix.trace ((A ⊗ₖ B)*tensorMap F G Z)= + Matrix.trace ((hsAdjoint F A ⊗ₖ hsAdjoint G B)*Z) := by + rw [Matrix.trace_mul_comm,← trace_hsAdjoint (cp_tensorMap hF hG),hsAdjoint_tensor_effect, + Matrix.trace_mul_comm] + +lemma hsAdjoint_ad_comp [DecidableEq n] [DecidableEq m] + {F : Map n m} (hF : CP F) (S : Mat n) (X : Mat m) : + hsAdjoint (F.comp (ad S)) X=Sᴴ*hsAdjoint F X*S := by + ext i j + have h (Y : Mat n) : Matrix.trace (Y*hsAdjoint (F.comp (ad S)) X)= + Matrix.trace (Y*(Sᴴ*hsAdjoint F X*S)) := by + rw [trace_hsAdjoint (cp_comp hF (cp_ad S)),LinearMap.comp_apply, + ← trace_hsAdjoint hF] + simp only [ad_apply] + calc + Matrix.trace (S*Y*Sᴴ*hsAdjoint F X)=Matrix.trace (S*(Y*Sᴴ*hsAdjoint F X)) := by simp only [Matrix.mul_assoc] + _ = Matrix.trace ((Y*Sᴴ*hsAdjoint F X)*S) := Matrix.trace_mul_comm _ _ + _ = Matrix.trace (Y*(Sᴴ*hsAdjoint F X*S)) := by simp only [Matrix.mul_assoc] + simpa only [Matrix.trace_single_mul,one_smul] using h (Matrix.single j i 1) +end SecretKey + +end + +end OAI diff --git a/lean/OAI/InformationTheory/Entanglement/TestedQuantumConsumer.lean b/lean/OAI/InformationTheory/Entanglement/TestedQuantumConsumer.lean new file mode 100644 index 0000000000000000000000000000000000000000..5f6fd1e18b6568515849a99249c9d3a1d83694fb --- /dev/null +++ b/lean/OAI/InformationTheory/Entanglement/TestedQuantumConsumer.lean @@ -0,0 +1,146 @@ +import OAI.InformationTheory.Entanglement.FullQuantumConsumer +import OAI.InformationTheory.Entanglement.ProbeFactorization + +namespace OAI + +noncomputable section +open scoped BigOperators ENNReal MeasureTheory InnerProductSpace ComplexOrder MatrixOrder Kronecker +open scoped Matrix.Norms.L2Operator +open MeasureTheory Matrix ContinuousLinearMap ProbabilityTheory Filter +namespace SecretKey +open ChannelCompletion TensorCriterion +variable {T : Type*} [MeasurableSpace T] +variable {n m : Type} [Fintype n] [Fintype m] [DecidableEq n] [DecidableEq m] +namespace PositiveMatrixMeasure +omit [DecidableEq n] in +lemma density_test_setIntegral (M : PositiveMatrixMeasure T n) {μ : Measure T} + [IsFiniteMeasure μ] (hdom : M.traceMeasure ≪ μ) (E : Mat n) + {s : Set T} (hs : MeasurableSet s) : + (∫ t in s, (Matrix.trace (E*M.positiveDensity μ t)).re ∂μ)= + (Matrix.trace (E*M.value s)).re := by + apply integral_trace_of_entry_integrals + · intro a c + simp only [Matrix.mul_apply] + exact (integrable_finsetSum _ fun k _ => + (M.positiveDensity_integrable hdom k c).const_mul (E a k)).integrableOn + · intro a c + simp only [Matrix.mul_apply] + rw [integral_finsetSum] + · apply Finset.sum_congr rfl + intro k hk + rw [integral_const_mul,M.positiveDensity_setIntegral hdom hs] + · intro k hk + exact ((M.positiveDensity_integrable hdom k c).const_mul (E a k)).integrableOn +end PositiveMatrixMeasure + +theorem independent_tested_quantum_gap + {Ω : Type*} {mΩ : MeasurableSpace Ω} [StandardBorelSpace Ω] + (ν : Measure Ω) [IsFiniteMeasure ν] (t : Ω→T) (ht : Measurable t) + {A B : MeasurableSpace Ω} (hA : A ≤ mΩ) (hB : B ≤ mΩ) + (hind : CondIndep (MeasurableSpace.comap t inferInstance) A B ht.comap_le ν) + (a : Fin 2→Option (PositiveTestIndex n)→Set Ω) + (q : Fin 2→Option (PositiveTestIndex m)→Set Ω) + (ha : ∀ i r, MeasurableSet[A] (a i r)) (hq : ∀ j s, MeasurableSet[B] (q j s)) + (M : Fin 2→Fin 2→PositiveMatrixMeasure T (n×m)) + (hdom : ∀ i j, (M i j).traceMeasure ≪ (@Measure.map Ω T mΩ _ t ν)) + (hleft : ∀ i r s, MeasurableSet s → + (∑ j, (Matrix.trace ((probePOVM r ⊗ₖ (1 : Mat m))*(M i j).value s)).re)= + ν.real (a i r∩t⁻¹' s)) + (hright : ∀ j g s, MeasurableSet s → + (∑ i, (Matrix.trace (((1 : Mat n) ⊗ₖ probePOVM g)*(M i j).value s)).re)= + ν.real (q j g∩t⁻¹' s)) + (hjoint : ∀ i j r g s, MeasurableSet s → + (Matrix.trace ((probePOVM r ⊗ₖ probePOVM g)*(M i j).value s)).re= + ν.real ((a i r∩q j g)∩t⁻¹' s)) + {H : Type*} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + {ι : Type*} (b : HilbertBasis ι ℂ H) + {e : Type} [Fintype e] [DecidableEq e] + (R : Mat (n×m)) (hR : Represented R) (i₀ : n×m) + (v : e→H) (hv : Orthonormal ℂ v) (j₀ : e) (Z : Matrix e (n×m) ℂ) + (hGram : Zᴴ*Z=Rᵀ) + (hW1 : (∑ i, ∑ j, (Matrix.trace (((M i j).filter Z).value Set.univ)).re)=1) + (σ : PositiveHilbertMeasure T H b) (hσ1 : σ.traceMeasure Set.univ=1) : + ENNReal.ofReal (1/5) ≤ hilbertCQDistance b + (fun i j => ((M i j).filter Z).hilbertEmbedding b v hv) σ := by + let μ := (@Measure.map Ω T mΩ _ t ν) + let D := fun i j => (M i j).positiveDensity μ + let U : Fin 2→T→Mat n := fun i u => ∑ j, marginalLeft (D i j u) + let V : Fin 2→T→Mat m := fun j u => ∑ i, marginalRight (D i j u) + have hDi i j c d : Integrable (fun u => D i j u c d) μ := + (M i j).positiveDensity_integrable (hdom i j) c d + have hDm i j : Measurable (D i j) := (M i j).positiveDensity_measurable μ + have hDp i j u : (D i j u).PosSemidef := (M i j).positiveDensity_psd μ u + have hUp i u : (U i u).PosSemidef := + Matrix.posSemidef_sum _ fun j _ => marginalLeft_psd (hDp i j u) + have hVp j u : (V j u).PosSemidef := + Matrix.posSemidef_sum _ fun i _ => marginalRight_psd (hDp i j u) + have hUm i : Measurable (U i) := by + have hc : Continuous (marginalLeft : Mat (n×m)→Mat n) := by + unfold marginalLeft; fun_prop + exact Finset.measurable_sum _ fun j _ => hc.measurable.comp (hDm i j) + have hVm j : Measurable (V j) := by + have hc : Continuous (marginalRight : Mat (n×m)→Mat m) := by + unfold marginalRight; fun_prop + exact Finset.measurable_sum _ fun i _ => hc.measurable.comp (hDm i j) + have hUi i c d : Integrable (fun u => U i u c d) μ := by + simp only [U,Matrix.sum_apply,marginalLeft] + exact integrable_finsetSum _ fun j _ => integrable_finsetSum _ fun k _ => hDi i j (c,k) (d,k) + have hVi j c d : Integrable (fun u => V j u c d) μ := by + simp only [V,Matrix.sum_apply,marginalRight] + exact integrable_finsetSum _ fun i _ => integrable_finsetSum _ fun k _ => hDi i j (k,c) (k,d) + have hUlaw i r s (hs : MeasurableSet s) : + (∫ u in s, (Matrix.trace (probePOVM r*U i u)).re ∂μ)=ν.real (a i r∩t⁻¹' s) := by + simp only [U,Matrix.mul_sum,Matrix.trace_sum,trace_test_left,Complex.re_sum] + rw [integral_finsetSum] + · rw [← hleft i r s hs] + apply Finset.sum_congr rfl; intro j hj + exact (M i j).density_test_setIntegral (hdom i j) _ hs + · intro j hj + exact (integrable_test_trace _ (hDi i j)).integrableOn + have hVlaw j g s (hs : MeasurableSet s) : + (∫ u in s, (Matrix.trace (probePOVM g*V j u)).re ∂μ)=ν.real (q j g∩t⁻¹' s) := by + simp only [V,Matrix.mul_sum,Matrix.trace_sum,trace_test_right,Complex.re_sum] + rw [integral_finsetSum] + · rw [← hright j g s hs] + apply Finset.sum_congr rfl; intro i hi + exact (M i j).density_test_setIntegral (hdom i j) _ hs + · intro i hi + exact (integrable_test_trace _ (hDi i j)).integrableOn + have hWlaw i j r g s (hs : MeasurableSet s) : + (∫ u in s, (Matrix.trace ((probePOVM r ⊗ₖ probePOVM g)*D i j u)).re ∂μ)= + ν.real ((a i r∩q j g)∩t⁻¹' s) := by + rw [(M i j).density_test_setIntegral (hdom i j) _ hs] + exact hjoint i j r g s hs + have hp := probe_density_product ht hA hB hind a q ha hq U V D hUp hVp hDp + hUm hVm hDm hUi hVi hDi hUlaw hVlaw hWlaw + let X := fun i u => (U i u)ᵀ + let Y := fun j u => (V j u)ᵀ + have he i j u : (X i u ⊗ₖ Y j u)ᵀ=U i u ⊗ₖ V j u := rfl + apply full_quantum_factorized_gap b R hR i₀ v hv j₀ Z hGram M μ X Y + · intro i + have hc : Continuous (Matrix.transpose : Mat n→Mat n) := by fun_prop + exact hc.measurable.comp (hUm i) + · intro j + have hc : Continuous (Matrix.transpose : Mat m→Mat m) := by fun_prop + exact hc.measurable.comp (hVm j) + · intro i u; exact (hUp i u).transpose + · intro j u; exact (hVp j u).transpose + · intro i j c d + apply (hDi i j c d).congr + filter_upwards [hp] with u hu + rw [he,hu i j] + · intro i j s hs c d + calc + _=∫ u in s, D i j u c d ∂μ := by + apply integral_congr_ae + filter_upwards [ae_restrict_of_ae hp] with u hu + rw [he,hu i j] + _=(M i j).value s c d := (M i j).positiveDensity_setIntegral (hdom i j) hs c d + · exact hW1 + · exact hσ1 + +end SecretKey + +end + +end OAI diff --git a/lean/OAI/InformationTheory/Entanglement/TraceClassModel.lean b/lean/OAI/InformationTheory/Entanglement/TraceClassModel.lean new file mode 100644 index 0000000000000000000000000000000000000000..cc01fb94fd8bda9ec66766efe31f333fbd549525 --- /dev/null +++ b/lean/OAI/InformationTheory/Entanglement/TraceClassModel.lean @@ -0,0 +1,79 @@ +import OAI.InformationTheory.Entanglement.HilbertTraceDifference + +namespace OAI + +noncomputable section +open scoped BigOperators InnerProductSpace ComplexOrder +open ContinuousLinearMap +namespace SecretKey +variable {H : Type*} [NormedAddCommGroup H] [InnerProductSpace ℂ H] +variable {ι : Type*} + +def traceClassSpace (b : HilbertBasis ι ℂ H) : Submodule ℂ (H →L[ℂ] H) := + Submodule.span ℂ {A | HasFinitePositiveTrace b A} +abbrev TraceClass (b : HilbertBasis ι ℂ H) := traceClassSpace b +lemma positive_diagonal_real {A : H →L[ℂ] H} (hA : 0≤A) (x : H) : + inner ℂ x (A x)=((inner ℂ x (A x)).re : ℂ) := by + have hp := (nonneg_iff_isPositive.mp hA).inner_nonneg_right x + apply Complex.ext + · rfl + · exact (Complex.nonneg_iff.mp hp).2.symm +lemma positive_complex_diagonal_summable (b : HilbertBasis ι ℂ H) + {A : H →L[ℂ] H} (hA : HasFinitePositiveTrace b A) : + Summable (fun i => inner ℂ (b i) (A (b i))) := by + have hs := hA.2.hasSum.mapL Complex.ofRealCLM + have hc : Summable (fun i => ((inner ℂ (b i) (A (b i))).re : ℂ)) := hs.summable + exact hc.congr (fun i => (positive_diagonal_real hA.1 (b i)).symm) +lemma traceClass_diagonal_summable (b : HilbertBasis ι ℂ H) + {A : H →L[ℂ] H} (hA : A∈traceClassSpace b) : + Summable (fun i => inner ℂ (b i) (A (b i))) := by + induction hA using Submodule.span_induction with + | mem x hx => exact positive_complex_diagonal_summable b hx + | zero => simp + | add x y hx hy hx' hy' => + simpa only [add_apply,inner_add_right] using hx'.add hy' + | smul c x hx hx' => + simpa only [smul_apply,inner_smul_right] using hx'.mul_left c +lemma traceClass_positive_iff (b : HilbertBasis ι ℂ H) (A : H →L[ℂ] H) : + (A∈traceClassSpace b ∧ 0≤A) ↔ HasFinitePositiveTrace b A := by + constructor + · rintro ⟨hm,hp⟩ + exact ⟨hp,((traceClass_diagonal_summable b hm).hasSum.mapL Complex.reCLM).summable⟩ + · intro h + exact ⟨Submodule.subset_span h,h.1⟩ + +def traceClassTrace (b : HilbertBasis ι ℂ H) : TraceClass b →ₗ[ℂ] ℂ where + toFun A := ∑' i, inner ℂ (b i) ((A : H →L[ℂ] H) (b i)) + map_add' A B := by + simp only [Submodule.coe_add,add_apply,inner_add_right] + exact (traceClass_diagonal_summable b A.property).tsum_add + (traceClass_diagonal_summable b B.property) + map_smul' c A := by + simp only [Submodule.coe_smul,smul_apply,inner_smul_right,RingHom.id_apply,smul_eq_mul] + exact tsum_mul_left +lemma traceClassTrace_re (b : HilbertBasis ι ℂ H) (A : TraceClass b) : + (traceClassTrace b A).re=hilbertTrace b A := by + exact ((traceClass_diagonal_summable b A.property).hasSum.mapL Complex.reCLM).tsum_eq.symm +lemma traceClassTrace_positive (b : HilbertBasis ι ℂ H) (A : TraceClass b) + (hp : 0≤(A : H →L[ℂ] H)) : 0≤traceClassTrace b A := by + exact tsum_nonneg (fun index => (nonneg_iff_isPositive.mp hp).inner_nonneg_right (b index)) + +def DensityOperator (b : HilbertBasis ι ℂ H) := + {A : TraceClass b // 0≤(A : H →L[ℂ] H) ∧ traceClassTrace b A=1} + +def TraceBlockPositive (b : HilbertBasis ι ℂ H) {r : Type*} [Fintype r] + (A : Matrix r r (TraceClass b)) : Prop := + ∀ x : r → H, 0≤∑ i, ∑ j, inner ℂ (x i) ((A i j : H →L[ℂ] H) (x j)) +variable {K : Type*} [NormedAddCommGroup K] [InnerProductSpace ℂ K] [CompleteSpace K] +variable {κ : Type*} + +def TraceCP (b : HilbertBasis ι ℂ H) (c : HilbertBasis κ ℂ K) + (F : TraceClass b →ₗ[ℂ] TraceClass c) : Prop := + ∀ r : Type, ∀ _ : Fintype r, ∀ A : Matrix r r (TraceClass b), + TraceBlockPositive b A → TraceBlockPositive c (fun i j => F (A i j)) + +end SecretKey + +end + +end OAI diff --git a/lean/OAI/InformationTheory/Entanglement/TraceContractivity.lean b/lean/OAI/InformationTheory/Entanglement/TraceContractivity.lean new file mode 100644 index 0000000000000000000000000000000000000000..b5640c3ad2d1f2879bf188146d0e8ac2c6ae748e --- /dev/null +++ b/lean/OAI/InformationTheory/Entanglement/TraceContractivity.lean @@ -0,0 +1,38 @@ +import OAI.InformationTheory.Entanglement.DensityChange + +namespace OAI + +noncomputable section +open scoped BigOperators ComplexOrder MatrixOrder Matrix.Norms.L2Operator +open Matrix +namespace SecretKey +open ChannelCompletion TensorCriterion +variable {n m : Type} [Fintype n] [Fintype m] [DecidableEq n] [DecidableEq m] + +lemma traceNorm_jordan {A : Mat n} (hA : A.IsHermitian) : + traceNorm A=(Matrix.trace (posPart A)).re+(Matrix.trace (negPart A)).re := by + change (Matrix.trace (CFC.abs A)).re=_ + rw [← CFC.posPart_add_negPart A hA,Matrix.trace_add,Complex.add_re] + +theorem traceNorm_positive_channel (F : Map n m) + (hF : ∀ {A : Mat n}, A.PosSemidef → (F A).PosSemidef) + (hT : TracePreserving F) {A : Mat n} (hA : A.IsHermitian) : + traceNorm (F A)≤traceNorm A := by + have hp : (posPart A).PosSemidef := Matrix.nonneg_iff_posSemidef.mp (CFC.posPart_nonneg A) + have hm : (negPart A).PosSemidef := Matrix.nonneg_iff_posSemidef.mp (CFC.negPart_nonneg A) + calc + traceNorm (F A)=traceNorm (F (posPart A)-F (negPart A)) := by + rw [← map_sub, CFC.posPart_sub_negPart A hA] + _ ≤ traceNorm (F (posPart A))+traceNorm (F (negPart A)) := traceNorm_sub_le _ _ + _ = (Matrix.trace (posPart A)).re+(Matrix.trace (negPart A)).re := by + rw [traceNorm_of_psd (hF hp),traceNorm_of_psd (hF hm),hT,hT] + _ = traceNorm A := (traceNorm_jordan hA).symm +lemma traceNorm_cptp (F : Map n m) (hF : CP F) (hT : TracePreserving F) + {A : Mat n} (hA : A.IsHermitian) : traceNorm (F A)≤traceNorm A := + traceNorm_positive_channel F (fun h => cp_positive hF h) hT hA + +end SecretKey + +end + +end OAI diff --git a/lean/OAI/InformationTheory/Entanglement/TraceInstrument.lean b/lean/OAI/InformationTheory/Entanglement/TraceInstrument.lean new file mode 100644 index 0000000000000000000000000000000000000000..e5b2f7b8a1da972576857aba98a1f86f0ad38188 --- /dev/null +++ b/lean/OAI/InformationTheory/Entanglement/TraceInstrument.lean @@ -0,0 +1,92 @@ +import OAI.InformationTheory.Entanglement.TraceClassModel +import OAI.InformationTheory.Entanglement.HilbertMeasure +import OAI.InformationTheory.Entanglement.LocalMemoryKernels + +namespace OAI + +noncomputable section +open scoped BigOperators InnerProductSpace ComplexOrder ENNReal MeasureTheory TensorProduct +open ContinuousLinearMap MeasureTheory ProbabilityTheory +namespace SecretKey +variable {H K L : Type*} + [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + [NormedAddCommGroup K] [InnerProductSpace ℂ K] [CompleteSpace K] + [NormedAddCommGroup L] [InnerProductSpace ℂ L] [CompleteSpace L] +variable {ι κ υ : Type*} +variable {X : Type*} [MeasurableSpace X] + +structure TraceInstrument (b : HilbertBasis ι ℂ H) (c : HilbertBasis κ ℂ K) + (X : Type*) [MeasurableSpace X] where + event : Set X → TraceClass b →ₗ[ℂ] TraceClass c + event_cp : ∀ s, MeasurableSet s → TraceCP b c (event s) + law : ∀ A : TraceClass b, 0≤(A : H →L[ℂ] H) → PositiveHilbertMeasure X K c + law_value : ∀ A hA s, MeasurableSet s → (law A hA).value s=event s A + trace_preserving : ∀ A, traceClassTrace c (event Set.univ A)=traceClassTrace b A +namespace TraceInstrument +variable {b : HilbertBasis ι ℂ H} {c : HilbertBasis κ ℂ K} +variable (I : TraceInstrument b c X) +def outcome (ρ : DensityOperator b) : Measure X := (I.law ρ.val ρ.property.1).traceMeasure +instance outcome_probability (ρ : DensityOperator b) : IsProbabilityMeasure (I.outcome ρ) := by + let : IsFiniteMeasure (I.outcome ρ) := by unfold outcome; infer_instance + refine ⟨?_⟩ + apply (ENNReal.toReal_eq_toReal_iff' (measure_ne_top _ _) ENNReal.one_ne_top).mp + change (I.law ρ.val ρ.property.1).traceMeasure.real Set.univ=(1 : ℝ≥0∞).toReal + rw [(I.law ρ.val ρ.property.1).trace_value _ MeasurableSet.univ, + I.law_value _ _ _ MeasurableSet.univ,← traceClassTrace_re, + I.trace_preserving,ρ.property.2] + norm_num +omit [CompleteSpace H] in +lemma outcome_born (ρ : DensityOperator b) {s : Set X} (hs : MeasurableSet s) : + (I.outcome ρ).real s=(traceClassTrace c (I.event s ρ.val)).re := by + rw [outcome,(I.law ρ.val ρ.property.1).trace_value _ hs,I.law_value _ _ _ hs,traceClassTrace_re] + +structure ConditionalUpdate (ρ : DensityOperator b) where + state : X → DensityOperator c + coefficient_measurable : ∀ x y : K, + Measurable (fun z => inner ℂ x ((state z).val.val y)) + coefficient_integrable : ∀ x y : K, + Integrable (fun z => inner ℂ x ((state z).val.val y)) (I.outcome ρ) + disintegration : ∀ s, MeasurableSet s → ∀ x y : K, + inner ℂ x ((I.event s ρ.val).val y)= + ∫ z in s, inner ℂ x ((state z).val.val y) ∂I.outcome ρ + +def historyKernel {S : Type*} [MeasurableSpace S] + (J : S → TraceInstrument b c X) (ρ : S → DensityOperator b) + (hm : ∀ s, MeasurableSet s → Measurable (fun h => (J h).outcome (ρ h) s)) : Kernel S X where + toFun h := (J h).outcome (ρ h) + measurable' := by + apply Measure.measurable_of_measurable_coe + exact hm +instance historyKernel_markov {S : Type*} [MeasurableSpace S] + (J : S → TraceInstrument b c X) (ρ : S → DensityOperator b) + (hm : ∀ s, MeasurableSet s → Measurable (fun h => (J h).outcome (ρ h) s)) : + IsMarkovKernel (historyKernel J ρ hm) := ⟨fun h => inferInstanceAs (IsProbabilityMeasure ((J h).outcome (ρ h)))⟩ +end TraceInstrument + +section TensorActions +variable {V W V' W' : Type*} + [AddCommGroup V] [Module ℂ V] [AddCommGroup W] [Module ℂ W] + [AddCommGroup V'] [Module ℂ V'] [AddCommGroup W'] [Module ℂ W'] +def tensorFunctional (f : V →ₗ[ℂ] ℂ) (g : W →ₗ[ℂ] ℂ) : V ⊗[ℂ] W →ₗ[ℂ] ℂ := + TensorProduct.lift (f.smulRight g) +lemma tensorFunctional_tmul (f : V →ₗ[ℂ] ℂ) (g : W →ₗ[ℂ] ℂ) (x : V) (y : W) : + tensorFunctional f g (x ⊗ₜ[ℂ] y)=f x*g y := by rfl +lemma local_product_event (f : V' →ₗ[ℂ] ℂ) (g : W →ₗ[ℂ] ℂ) + (F : V →ₗ[ℂ] V') (x : V) (y : W) : + tensorFunctional f g (TensorProduct.map F LinearMap.id (x ⊗ₜ[ℂ] y))=f (F x)*g y := by + rw [TensorProduct.map_tmul,tensorFunctional_tmul,LinearMap.id_apply] +end TensorActions +omit [CompleteSpace H] [CompleteSpace L] in +lemma local_product_born (b : HilbertBasis ι ℂ H) (c : HilbertBasis κ ℂ K) + (d : HilbertBasis υ ℂ L) (I : TraceInstrument b c X) + (ρ : DensityOperator b) (σ : DensityOperator d) {s : Set X} (hs : MeasurableSet s) : + (tensorFunctional (traceClassTrace c) (traceClassTrace d) + (TensorProduct.map (I.event s) LinearMap.id (ρ.val ⊗ₜ[ℂ] σ.val))).re= + (I.outcome ρ).real s := by + rw [local_product_event,σ.property.2,mul_one,I.outcome_born ρ hs] + +end SecretKey + +end + +end OAI diff --git a/lean/OAI/InformationTheory/Entanglement/TraceMatrixSpace.lean b/lean/OAI/InformationTheory/Entanglement/TraceMatrixSpace.lean new file mode 100644 index 0000000000000000000000000000000000000000..1824f0fe828dccc95db5cc037d2bf11f84815854 --- /dev/null +++ b/lean/OAI/InformationTheory/Entanglement/TraceMatrixSpace.lean @@ -0,0 +1,98 @@ +import OAI.InformationTheory.Entanglement.DensityChange + +namespace OAI + +noncomputable section +open scoped BigOperators ComplexOrder MatrixOrder Matrix.Norms.L2Operator +open Matrix MeasureTheory +namespace SecretKey +open ChannelCompletion +variable {n : Type} [Fintype n] [DecidableEq n] +lemma traceNorm_eq_zero (A : Mat n) : traceNorm A=0 ↔ A=0 := by + constructor + · intro h + have hs : CFC.sqrt (Aᴴ*A)=0 := by + apply (sqrt_psd (Aᴴ*A)).trace_eq_zero_iff.mp + apply Complex.ext + · exact h + · exact (Complex.nonneg_iff.mp (sqrt_psd (Aᴴ*A)).trace_nonneg).2.symm + have he := CFC.sqrt_mul_sqrt_self (Aᴴ*A) (Matrix.posSemidef_conjTranspose_mul_self A).nonneg + rw [hs,zero_mul] at he + exact Matrix.conjTranspose_mul_self_eq_zero.mp he.symm + · rintro rfl + simp [traceNorm] +lemma traceNorm_real_smul (c : ℝ) (A : Mat n) : + traceNorm (c • A)= |c| *traceNorm A := by + by_cases hc : 0≤c + · have he : c • A=(c : ℂ) • A := by ext i j; simp + rw [he,traceNorm_smul_nonneg c hc,abs_of_nonneg hc] + · have hn : 0≤-c := by linarith + have he : c • A=-((-c) • A) := by simp + rw [he,traceNorm_neg] + have he' : (-c) • A=((-c) : ℂ) • A := by ext i j; simp + rw [he',abs_of_nonpos (le_of_not_ge hc)] + simpa only [Complex.ofReal_neg] using traceNorm_smul_nonneg (-c) hn A + +@[ext] structure TraceMatrix (n : Type) where + val : Matrix n n ℂ +namespace TraceMatrix +def toEquiv : TraceMatrix n ≃ Mat n where + toFun := val + invFun := mk + left_inv := by intro A; cases A; rfl + right_inv := fun _ => rfl +instance traceMatrixAddCommGroup : AddCommGroup (TraceMatrix n) := toEquiv.addCommGroup +instance traceMatrixModule : Module ℝ (TraceMatrix n) := toEquiv.addEquiv.module ℝ +def equiv : TraceMatrix n ≃ₗ[ℝ] Mat n := toEquiv.addEquiv.linearEquiv ℝ +instance traceMatrixNormedAddCommGroup : NormedAddCommGroup (TraceMatrix n) := AddGroupNorm.toNormedAddCommGroup + { toFun := fun A => traceNorm A.val + map_zero' := (traceNorm_eq_zero 0).mpr rfl + neg' := fun A => traceNorm_neg A.val + add_le' := fun A B => traceNorm_add_le A.val B.val + eq_zero_of_map_eq_zero' := fun A h => toEquiv.injective ((traceNorm_eq_zero A.val).mp h) } +lemma norm_eq (A : TraceMatrix n) : ‖A‖=traceNorm A.val := rfl +instance traceMatrixNormedSpace : NormedSpace ℝ (TraceMatrix n) where + norm_smul_le c A := by + change traceNorm (c • A.val)≤‖c‖*traceNorm A.val + rw [traceNorm_real_smul,Real.norm_eq_abs] +instance traceMatrixFiniteDimensional : FiniteDimensional ℝ (TraceMatrix n) := equiv.symm.finiteDimensional +instance traceMatrixCompleteSpace : CompleteSpace (TraceMatrix n) := FiniteDimensional.complete ℝ _ +def equivL : TraceMatrix n ≃L[ℝ] Mat n := equiv.toContinuousLinearEquiv +instance traceMatrixMeasurableSpace : MeasurableSpace (TraceMatrix n) := borel _ +instance traceMatrixBorelSpace : BorelSpace (TraceMatrix n) := ⟨rfl⟩ +instance traceMatrixSecondCountableTopology : SecondCountableTopology (TraceMatrix n) := by + have : ProperSpace (TraceMatrix n) := FiniteDimensional.proper ℝ _ + infer_instance +lemma measurable_into {T : Type*} [MeasurableSpace T] {D : T → Mat n} + (hD : Measurable D) : Measurable (fun t => TraceMatrix.mk (D t)) := + equivL.symm.continuous.measurable.comp hD +lemma integrable_into {T : Type*} [MeasurableSpace T] {μ : Measure T} {D : T → Mat n} + (hD : ∀ i j, Integrable (fun t => D t i j) μ) : + Integrable (fun t => TraceMatrix.mk (D t)) μ := by + let B (i j : n) : ℂ →ₗ[ℝ] Mat n := + { toFun := fun c => Matrix.single i j c + map_add' := fun x y => Matrix.single_add _ _ _ _ + map_smul' := fun c x => by simp } + have hb (i j : n) : Integrable (fun t => Matrix.single i j (D t i j)) μ := + (B i j).toContinuousLinearMap.integrable_comp (hD i j) + have hi : Integrable D μ := by + have h := integrable_finsetSum Finset.univ (fun i _ => + integrable_finsetSum Finset.univ (fun j _ => hb i j)) + have he : (fun t => ∑ i, ∑ j, Matrix.single i j (D t i j))=D := by + funext t + exact (Matrix.matrix_eq_sum_single (D t)).symm + rwa [he] at h + exact equivL.symm.toContinuousLinearMap.integrable_comp hi +lemma setIntegral_entry {T : Type*} [MeasurableSpace T] {μ : Measure T} {D : T → Mat n} + (hD : ∀ i j, Integrable (fun t => D t i j) μ) (s : Set T) (i j : n) : + (∫ t in s, TraceMatrix.mk (D t) ∂μ).val i j=∫ t in s, D t i j ∂μ := by + let f : TraceMatrix n →L[ℝ] ℂ := + (ContinuousLinearMap.proj j).comp ((ContinuousLinearMap.proj i).comp equivL.toContinuousLinearMap) + exact (f.integral_comp_comm (integrable_into hD).integrableOn).symm +end TraceMatrix + +end SecretKey + +end + +end OAI diff --git a/lean/OAI/InformationTheory/Entanglement/TraceNorm.lean b/lean/OAI/InformationTheory/Entanglement/TraceNorm.lean new file mode 100644 index 0000000000000000000000000000000000000000..323da348cb94ad5cdea3071f3faaedbbf1856977 --- /dev/null +++ b/lean/OAI/InformationTheory/Entanglement/TraceNorm.lean @@ -0,0 +1,126 @@ +import OAI.InformationTheory.Entanglement.MatrixPolar +import OAI.InformationTheory.Entanglement.SecretDefinitions + +namespace OAI + +noncomputable section +open scoped MatrixOrder ComplexOrder BigOperators Kronecker +open Matrix +namespace SecretKey +variable {n : Type} [Fintype n] [DecidableEq n] + +lemma unitary_reverse {U : Matrix n n ℂ} (h : Uᴴ * U = 1) : U * Uᴴ = 1 := + Matrix.mem_unitaryGroup_iff.mp (Matrix.mem_unitaryGroup_iff'.mpr h) +lemma unitary_mul {U V : Matrix n n ℂ} (hU : Uᴴ * U = 1) (hV : Vᴴ * V = 1) : + (U * V)ᴴ * (U * V) = 1 := by + rw [Matrix.conjTranspose_mul, Matrix.mul_assoc, + ← Matrix.mul_assoc Uᴴ U V, hU, Matrix.one_mul, hV] +lemma unitary_star {U : Matrix n n ℂ} (h : Uᴴ * U = 1) : (Uᴴ)ᴴ * Uᴴ = 1 := by + rw [Matrix.conjTranspose_conjTranspose, unitary_reverse h] + +lemma unitary_entry_norm_le {U : Matrix n n ℂ} (h : Uᴴ * U = 1) (i j : n) : + ‖U i j‖ ≤ 1 := by + have hs : (∑ k, ‖U k j‖ ^ 2) = 1 := by + have hh := congrArg Complex.re (congrFun (congrFun h j) j) + simpa only [Matrix.mul_apply, Matrix.conjTranspose_apply, Complex.star_def, + Complex.conj_mul', Complex.re_sum, ← Complex.ofReal_pow, Complex.ofReal_re, + Matrix.one_apply_eq, Complex.one_re] using hh + have hl := Finset.single_le_sum (fun k (_ : k ∈ Finset.univ) => sq_nonneg ‖U k j‖) + (Finset.mem_univ i) + rw [hs] at hl + nlinarith [norm_nonneg (U i j)] + +lemma trace_mul_diagonal (A : Matrix n n ℂ) (d : n → ℂ) : + Matrix.trace (A * Matrix.diagonal d) = ∑ i, A i i * d i := by + simp [Matrix.trace] + +lemma trace_mul_psd_norm_le {H U : Matrix n n ℂ} (hH : H.PosSemidef) + (hU : Uᴴ * U = 1) : ‖Matrix.trace (U * H)‖ ≤ (Matrix.trace H).re := by + let V : Matrix n n ℂ := hH.isHermitian.eigenvectorUnitary + have hV : Vᴴ * V = 1 := Unitary.coe_star_mul_self _ + have hspec : H = V * Matrix.diagonal (fun i => (hH.isHermitian.eigenvalues i : ℂ)) * Vᴴ := by + simpa only [V, Unitary.conjStarAlgAut_apply, Matrix.star_eq_conjTranspose, + Function.comp_def, RCLike.ofReal_eq_complex_ofReal] using hH.isHermitian.spectral_theorem + let W : Matrix n n ℂ := Vᴴ * U * V + have hW : Wᴴ * W = 1 := unitary_mul (unitary_mul (unitary_star hV) hU) hV + have ht : Matrix.trace (U * H) = + ∑ i, W i i * (hH.isHermitian.eigenvalues i : ℂ) := by + conv_lhs => rw [hspec, ← Matrix.mul_assoc, Matrix.trace_mul_comm] + rw [← Matrix.mul_assoc, ← Matrix.mul_assoc, trace_mul_diagonal] + rw [ht, hH.isHermitian.trace_eq_sum_eigenvalues] + simp only [Complex.re_sum] + calc + ‖∑ i, W i i * (hH.isHermitian.eigenvalues i : ℂ)‖ ≤ + ∑ i, ‖W i i * (hH.isHermitian.eigenvalues i : ℂ)‖ := norm_sum_le _ _ + _ ≤ ∑ i, hH.isHermitian.eigenvalues i := by + apply Finset.sum_le_sum + intro i _ + rw [norm_mul, Complex.norm_real, Real.norm_eq_abs, abs_of_nonneg (hH.eigenvalues_nonneg i)] + exact mul_le_of_le_one_left (hH.eigenvalues_nonneg i) (unitary_entry_norm_le hW i i) + +omit [DecidableEq n] in +lemma traceNorm_nonneg {m : Type} [Fintype m] (A : Matrix n m ℂ) : 0 ≤ traceNorm A := by + classical + exact (Complex.nonneg_iff.mp + (Matrix.nonneg_iff_posSemidef.mp (CFC.sqrt_nonneg (Aᴴ * A))).trace_nonneg).1 + +lemma traceNorm_of_psd {H : Matrix n n ℂ} (hH : H.PosSemidef) : + traceNorm H = (Matrix.trace H).re := by + unfold traceNorm + rw [hH.isHermitian.eq, CFC.sqrt_mul_self H hH.nonneg] + +lemma traceNorm_unitary_left (A : Matrix n n ℂ) {U : Matrix n n ℂ} (hU : Uᴴ * U = 1) : + traceNorm (U * A) = traceNorm A := by + unfold traceNorm + rw [Matrix.conjTranspose_mul, Matrix.mul_assoc, ← Matrix.mul_assoc Uᴴ U A, hU, + Matrix.one_mul] + +lemma traceNorm_unitary_right (A : Matrix n n ℂ) {U : Matrix n n ℂ} (hU : Uᴴ * U = 1) : + traceNorm (A * U) = traceNorm A := by + let H := CFC.sqrt (Aᴴ * A) + have hH : H.PosSemidef := Matrix.nonneg_iff_posSemidef.mp (CFC.sqrt_nonneg _) + have hHsq : H * H = Aᴴ * A := + CFC.sqrt_mul_sqrt_self _ (Matrix.posSemidef_conjTranspose_mul_self A).nonneg + have h : CFC.sqrt ((A * U)ᴴ * (A * U)) = Uᴴ * H * U := by + apply CFC.sqrt_unique + · rw [Matrix.conjTranspose_mul] + calc + Uᴴ * H * U * (Uᴴ * H * U) = Uᴴ * H * (U * Uᴴ) * H * U := by + simp only [Matrix.mul_assoc] + _ = Uᴴ * (H * H) * U := by rw [unitary_reverse hU]; simp only [Matrix.mul_one, Matrix.mul_assoc] + _ = Uᴴ * Aᴴ * (A * U) := by rw [hHsq]; simp only [Matrix.mul_assoc] + · simpa using (hH.mul_mul_conjTranspose_same Uᴴ).nonneg + unfold traceNorm + rw [h, Matrix.trace_mul_cycle, unitary_reverse hU, Matrix.one_mul] + +lemma trace_unitary_norm_le (A : Matrix n n ℂ) {U : Matrix n n ℂ} (hU : Uᴴ * U = 1) : + ‖Matrix.trace (U * A)‖ ≤ traceNorm A := by + obtain ⟨V,hV,he⟩ := MatrixPolar.polar A + conv_lhs => rw [he, ← Matrix.mul_assoc] + exact trace_mul_psd_norm_le (Matrix.nonneg_iff_posSemidef.mp (CFC.sqrt_nonneg _)) + (unitary_mul hU hV) + +lemma traceNorm_witness (A : Matrix n n ℂ) : + ∃ U : Matrix n n ℂ, Uᴴ * U = 1 ∧ traceNorm A = (Matrix.trace (U * A)).re := by + obtain ⟨V,hV,he⟩ := MatrixPolar.polar A + refine ⟨Vᴴ,unitary_star hV,?_⟩ + conv_rhs => rw [he, ← Matrix.mul_assoc, hV, Matrix.one_mul] + rfl + +lemma trace_re_le_traceNorm (A : Matrix n n ℂ) : (Matrix.trace A).re ≤ traceNorm A := by + calc + (Matrix.trace A).re ≤ ‖Matrix.trace A‖ := Complex.re_le_norm _ + _ ≤ traceNorm A := by simpa using trace_unitary_norm_le A (U := 1) (by simp) + +lemma traceNorm_add_le (A B : Matrix n n ℂ) : traceNorm (A+B) ≤ traceNorm A + traceNorm B := by + obtain ⟨U,hU,he⟩ := traceNorm_witness (A+B) + rw [he, Matrix.mul_add, Matrix.trace_add, Complex.add_re] + apply add_le_add + · exact (Complex.re_le_norm _).trans (trace_unitary_norm_le A hU) + · exact (Complex.re_le_norm _).trans (trace_unitary_norm_le B hU) + +end SecretKey + +end + +end OAI diff --git a/lean/OAI/InformationTheory/Entanglement/TraceStateBounds.lean b/lean/OAI/InformationTheory/Entanglement/TraceStateBounds.lean new file mode 100644 index 0000000000000000000000000000000000000000..b48abded6519afcbf32de16336877bb54bbc0da4 --- /dev/null +++ b/lean/OAI/InformationTheory/Entanglement/TraceStateBounds.lean @@ -0,0 +1,63 @@ +import OAI.InformationTheory.Entanglement.HilbertChannel + +namespace OAI + +noncomputable section +open scoped BigOperators InnerProductSpace ComplexOrder +open ContinuousLinearMap +namespace SecretKey +variable {H : Type*} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] +variable {ι : Type*} + +lemma positive_opNorm_le_trace (b : HilbertBasis ι ℂ H) {A : H →L[ℂ] H} + (hA : HasFinitePositiveTrace b A) : ‖A‖ ≤ hilbertTrace b A := by + let S := CFC.sqrt A + have hS : S.IsSymmetric := (nonneg_iff_isPositive.mp (CFC.sqrt_nonneg A)).isSymmetric + have hsum : Summable (fun i => ‖S (b i)‖^2) := by + simpa only [S,← positive_diagonal_sqrt hA.1] using hA.2 + have ht : ∑' i, ‖S (b i)‖^2=hilbertTrace b A := by + simp only [S,← positive_diagonal_sqrt hA.1,hilbertTrace] + have hn : 0 ≤ hilbertTrace b A := by rw [← ht]; exact tsum_nonneg (fun i => sq_nonneg _) + have hb (x : H) : ‖S x‖^2 ≤ hilbertTrace b A*‖x‖^2 := by + rw [← (hilbert_parseval b (S x)).tsum_eq,← ht,← tsum_mul_right] + apply Summable.tsum_le_tsum _ (hilbert_parseval b (S x)).summable (hsum.mul_right _) + intro i + have he : inner ℂ (b i) (S x)=inner ℂ (S (b i)) x := (hS _ _).symm + rw [he] + calc + ‖inner ℂ (S (b i)) x‖^2 ≤ (‖S (b i)‖*‖x‖)^2 := + pow_le_pow_left₀ (norm_nonneg _) (norm_inner_le_norm _ _) 2 + _ = ‖S (b i)‖^2*‖x‖^2 := mul_pow _ _ _ + have hSn : ‖S‖ ≤ Real.sqrt (hilbertTrace b A) := by + apply S.opNorm_le_bound (Real.sqrt_nonneg _) + intro x + have h := hb x + have he := Real.sq_sqrt hn + have hx := norm_nonneg x + have hs := Real.sqrt_nonneg (hilbertTrace b A) + nlinarith [norm_nonneg (S x),mul_nonneg hs hx, + mul_self_nonneg (‖S x‖-Real.sqrt (hilbertTrace b A)*‖x‖)] + have he : S*S=A := CFC.sqrt_mul_sqrt_self A hA.1 + calc + ‖A‖ = ‖S*S‖ := congrArg norm he.symm + _ ≤ ‖S‖*‖S‖ := norm_mul_le S S + _ ≤ hilbertTrace b A := by + nlinarith [Real.sq_sqrt hn,norm_nonneg S,Real.sqrt_nonneg (hilbertTrace b A)] +lemma density_opNorm_le_one (b : HilbertBasis ι ℂ H) (ρ : DensityOperator b) : + ‖(ρ.val : H →L[ℂ] H)‖ ≤ 1 := by + have hp := (traceClass_positive_iff b _).mp ⟨ρ.val.property,ρ.property.1⟩ + have h := positive_opNorm_le_trace b hp + rw [← traceClassTrace_re,ρ.property.2] at h + simpa using h +lemma density_coefficient_bound (b : HilbertBasis ι ℂ H) (ρ : DensityOperator b) (x y : H) : + ‖inner ℂ x ((ρ.val : H →L[ℂ] H) y)‖ ≤ ‖x‖*‖y‖ := by + apply (norm_inner_le_norm x _).trans + apply mul_le_mul_of_nonneg_left _ (norm_nonneg x) + exact ((ρ.val : H →L[ℂ] H).le_opNorm y).trans + (by nlinarith [density_opNorm_le_one b ρ,norm_nonneg y]) + +end SecretKey + +end + +end OAI diff --git a/lean/OAI/InformationTheory/Entanglement/TraceTensor.lean b/lean/OAI/InformationTheory/Entanglement/TraceTensor.lean new file mode 100644 index 0000000000000000000000000000000000000000..160b8f374cb385a0fdf8b93e65af18487f2d040a --- /dev/null +++ b/lean/OAI/InformationTheory/Entanglement/TraceTensor.lean @@ -0,0 +1,144 @@ +import OAI.InformationTheory.Entanglement.HilbertTensor + +namespace OAI + +noncomputable section +open scoped TensorProduct InnerProductSpace ComplexOrder +open ContinuousLinearMap UniformSpace +namespace SecretKey +variable {H K : Type*} + [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + [NormedAddCommGroup K] [InnerProductSpace ℂ K] [CompleteSpace K] +variable {ι κ : Type*} +lemma hilbertTensorMap_nonneg {A : H →L[ℂ] H} {B : K →L[ℂ] K} (hA : 0≤A) (hB : 0≤B) : + 0≤hilbertTensorMap A B := by + have ha : (CFC.sqrt A).adjoint=CFC.sqrt A := by + rw [← star_eq_adjoint]; exact (CFC.sqrt_nonneg A).isSelfAdjoint + have hb : (CFC.sqrt B).adjoint=CFC.sqrt B := by + rw [← star_eq_adjoint]; exact (CFC.sqrt_nonneg B).isSelfAdjoint + have he : star (hilbertTensorMap (CFC.sqrt A) (CFC.sqrt B))* + hilbertTensorMap (CFC.sqrt A) (CFC.sqrt B)=hilbertTensorMap A B := by + rw [star_eq_adjoint,hilbertTensorMap_adjoint,ha,hb,mul_def,← hilbertTensorMap_comp, + ← mul_def,← mul_def,CFC.sqrt_mul_sqrt_self A hA,CFC.sqrt_mul_sqrt_self B hB] + rw [← he] + exact star_mul_self_nonneg (hilbertTensorMap (CFC.sqrt A) (CFC.sqrt B)) +omit [CompleteSpace H] [CompleteSpace K] in +lemma tensor_positive_diagonal (b : HilbertBasis ι ℂ H) (c : HilbertBasis κ ℂ K) + {A : H →L[ℂ] H} {B : K →L[ℂ] K} (hA : 0≤A) (hB : 0≤B) (p : ι×κ) : + (inner ℂ (tensorHilbertBasis b c p) (hilbertTensorMap A B (tensorHilbertBasis b c p))).re= + (inner ℂ (b p.1) (A (b p.1))).re*(inner ℂ (c p.2) (B (c p.2))).re := by + rw [tensorHilbertBasis_apply,hilbertTensorMap_tmul,hilbertTmul_inner, + positive_diagonal_real hA,positive_diagonal_real hB] + simp +lemma tensor_positive_trace (b : HilbertBasis ι ℂ H) (c : HilbertBasis κ ℂ K) + {A : H →L[ℂ] H} {B : K →L[ℂ] K} + (hA : HasFinitePositiveTrace b A) (hB : HasFinitePositiveTrace c B) : + HasFinitePositiveTrace (tensorHilbertBasis b c) (hilbertTensorMap A B) ∧ + hilbertTrace (tensorHilbertBasis b c) (hilbertTensorMap A B)=hilbertTrace b A*hilbertTrace c B := by + have hnA (i : ι) : 0≤(inner ℂ (b i) (A (b i))).re := + (nonneg_iff_isPositive.mp hA.1).re_inner_nonneg_right _ + have hnB (j : κ) : 0≤(inner ℂ (c j) (B (c j))).re := + (nonneg_iff_isPositive.mp hB.1).re_inner_nonneg_right _ + have hs := hA.2.mul_of_nonneg hB.2 hnA hnB + refine ⟨⟨hilbertTensorMap_nonneg hA.1 hB.1,?_⟩,?_⟩ + · exact hs.congr (fun p => (tensor_positive_diagonal b c hA.1 hB.1 p).symm) + · unfold hilbertTrace + simp_rw [tensor_positive_diagonal b c hA.1 hB.1] + exact (hA.2.tsum_mul_tsum hB.2 hs).symm +omit [CompleteSpace H] [CompleteSpace K] in +lemma hilbertTmul_add_left (x y : H) (z : K) : + hilbertTmul (x+y) z=hilbertTmul x z+hilbertTmul y z := by + simp only [hilbertTmul,TensorProduct.add_tmul,Completion.coe_add] +omit [CompleteSpace H] [CompleteSpace K] in +lemma hilbertTmul_add_right (x : H) (y z : K) : + hilbertTmul x (y+z)=hilbertTmul x y+hilbertTmul x z := by + simp only [hilbertTmul,TensorProduct.tmul_add,Completion.coe_add] +omit [CompleteSpace H] [CompleteSpace K] in +lemma hilbertTmul_smul_left (s : ℂ) (x : H) (y : K) : + hilbertTmul (s • x) y=s • hilbertTmul x y := by + simp only [hilbertTmul,← TensorProduct.smul_tmul',Completion.coe_smul] +omit [CompleteSpace H] [CompleteSpace K] in +lemma hilbertTmul_smul_right (s : ℂ) (x : H) (y : K) : + hilbertTmul x (s • y)=s • hilbertTmul x y := by + simp [hilbertTmul,TensorProduct.tmul_smul] +omit [CompleteSpace H] [CompleteSpace K] in +lemma hilbertTensorMap_add_left (A B : H →L[ℂ] H) (C : K →L[ℂ] K) : + hilbertTensorMap (A+B) C=hilbertTensorMap A C+hilbertTensorMap B C := by + apply hilbertTensor_ext + intro x y + simp [hilbertTmul_add_left] +omit [CompleteSpace H] [CompleteSpace K] in +lemma hilbertTensorMap_add_right (A : H →L[ℂ] H) (B C : K →L[ℂ] K) : + hilbertTensorMap A (B+C)=hilbertTensorMap A B+hilbertTensorMap A C := by + apply hilbertTensor_ext + intro x y + simp [hilbertTmul_add_right] +omit [CompleteSpace H] [CompleteSpace K] in +lemma hilbertTensorMap_smul_left (s : ℂ) (A : H →L[ℂ] H) (B : K →L[ℂ] K) : + hilbertTensorMap (s • A) B=s • hilbertTensorMap A B := by + apply hilbertTensor_ext + intro x y + simp [hilbertTmul_smul_left] +omit [CompleteSpace H] [CompleteSpace K] in +lemma hilbertTensorMap_smul_right (s : ℂ) (A : H →L[ℂ] H) (B : K →L[ℂ] K) : + hilbertTensorMap A (s • B)=s • hilbertTensorMap A B := by + apply hilbertTensor_ext + intro x y + simp [hilbertTmul_smul_right] +omit [CompleteSpace H] [CompleteSpace K] in +@[simp] lemma hilbertTensorMap_zero_left (B : K →L[ℂ] K) : + hilbertTensorMap (0 : H →L[ℂ] H) B=0 := by + apply hilbertTensor_ext + intro x y + rw [hilbertTensorMap_tmul] + simp [hilbertTmul] +omit [CompleteSpace H] [CompleteSpace K] in +@[simp] lemma hilbertTensorMap_zero_right (A : H →L[ℂ] H) : + hilbertTensorMap A (0 : K →L[ℂ] K)=0 := by + apply hilbertTensor_ext + intro x y + rw [hilbertTensorMap_tmul] + simp [hilbertTmul] +lemma tensor_traceClass_mem (b : HilbertBasis ι ℂ H) (c : HilbertBasis κ ℂ K) + {A : H →L[ℂ] H} {B : K →L[ℂ] K} + (hA : A∈traceClassSpace b) (hB : B∈traceClassSpace c) : + hilbertTensorMap A B∈traceClassSpace (tensorHilbertBasis b c) := by + induction hA using Submodule.span_induction with + | mem A hA => + induction hB using Submodule.span_induction with + | mem B hB => exact Submodule.subset_span (tensor_positive_trace b c hA hB).1 + | zero => simp + | add x y _ _ hx hy => + rw [hilbertTensorMap_add_right]; exact Submodule.add_mem _ hx hy + | smul s x _ hx => + rw [hilbertTensorMap_smul_right]; exact Submodule.smul_mem _ s hx + | zero => simp + | add x y _ _ hx hy => + rw [hilbertTensorMap_add_left]; exact Submodule.add_mem _ hx hy + | smul s x _ hx => + rw [hilbertTensorMap_smul_left]; exact Submodule.smul_mem _ s hx + +def traceTensor (b : HilbertBasis ι ℂ H) (c : HilbertBasis κ ℂ K) + (A : TraceClass b) (B : TraceClass c) : TraceClass (tensorHilbertBasis b c) := + ⟨hilbertTensorMap A.val B.val,tensor_traceClass_mem b c A.property B.property⟩ +lemma traceTensor_trace (b : HilbertBasis ι ℂ H) (c : HilbertBasis κ ℂ K) + (A : TraceClass b) (B : TraceClass c) : + traceClassTrace (tensorHilbertBasis b c) (traceTensor b c A B)= + traceClassTrace b A*traceClassTrace c B := by + have hs := traceClass_diagonal_summable (tensorHilbertBasis b c) (traceTensor b c A B).property + have he (p : ι×κ) : inner ℂ (tensorHilbertBasis b c p) + ((traceTensor b c A B).val (tensorHilbertBasis b c p))= + inner ℂ (b p.1) (A.val (b p.1))*inner ℂ (c p.2) (B.val (c p.2)) := by + simp [traceTensor,hilbertTmul_inner] + simp_rw [he] at hs + change (∑' p, inner ℂ (tensorHilbertBasis b c p) + ((traceTensor b c A B).val (tensorHilbertBasis b c p)))=_ + simp_rw [he] + exact ((traceClass_diagonal_summable b A.property).hasSum.mul + (traceClass_diagonal_summable c B.property).hasSum hs).tsum_eq + +end SecretKey + +end + +end OAI diff --git a/lean/OAI/InformationTheory/Entanglement/TranscriptClassical.lean b/lean/OAI/InformationTheory/Entanglement/TranscriptClassical.lean new file mode 100644 index 0000000000000000000000000000000000000000..7903288df607cee0304f763953681106bd3d87f3 --- /dev/null +++ b/lean/OAI/InformationTheory/Entanglement/TranscriptClassical.lean @@ -0,0 +1,58 @@ +import OAI.InformationTheory.Entanglement.ConditionalUpdate + +namespace OAI + +noncomputable section +open MeasureTheory ProbabilityTheory Filter +open scoped MeasureTheory ProbabilityTheory Topology +namespace SecretKey +variable {Ω : Type*} {mΩ : MeasurableSpace Ω} [StandardBorelSpace Ω] +variable (μ : Measure Ω) [IsFiniteMeasure μ] + +def TapePublicStep (A B F G : MeasurableSpace Ω) (hF : F ≤ mΩ) : Prop := + G ≤ A ⊔ F ∨ G ≤ B ⊔ F ∨ + ∃ C : MeasurableSpace Ω, ∃ _ : C ≤ mΩ, + G=C ⊔ F ∧ CondIndep F C (A ⊔ B) hF μ + +theorem tapes_independent_given_complete_public + (A B : MeasurableSpace Ω) (hA : A ≤ mΩ) (hB : B ≤ mΩ) + (F : Filtration ℕ mΩ) + (h0 : CondIndep (F 0) A B (F.le 0) μ) + (hstep : ∀ k, TapePublicStep μ A B (F k) (F (k+1)) (F.le k)) : + CondIndep (⨆ k, F k) (A ⊔ ⨆ k, F k) (B ⊔ ⨆ k, F k) + (iSup_le fun k => F.le k) μ := by + have hp : ∀ k, CondIndep (F k) A B (F.le k) μ := by + intro k + induction k with + | zero => exact h0 + | succ k ih => + rcases hstep k with ha|hb|⟨C,hC,hg,hind⟩ + · exact sender_message_preserves_independence (F.le k) hA hB ih + (F.mono (Nat.le_succ k)) ha + · exact (sender_message_preserves_independence (F.le k) hB hA ih.symm + (F.mono (Nat.le_succ k)) hb).symm + · simpa only [hg] using + public_source_preserves_independence (F.le k) hA hB ih hC hind + exact conditional_independence_adjoin_public (iSup_le fun k => F.le k) hA hB + (conditional_independence_limit μ F A B hA hB hp) + +theorem terminal_tape_variables_independent + (A B : MeasurableSpace Ω) (hA : A ≤ mΩ) (hB : B ≤ mΩ) + (F : Filtration ℕ mΩ) + (h0 : CondIndep (F 0) A B (F.le 0) μ) + (hstep : ∀ k, TapePublicStep μ A B (F k) (F (k+1)) (F.le k)) + {α β : Type*} [MeasurableSpace α] [MeasurableSpace β] + (X : Ω → α) (Y : Ω → β) + (hX : Measurable[A ⊔ ⨆ k, F k] X) + (hY : Measurable[B ⊔ ⨆ k, F k] Y) : + CondIndepFun (⨆ k, F k) (iSup_le fun k => F.le k) X Y μ := by + rw [condIndepFun_iff_condIndep] + exact condIndep_of_condIndep_of_le_right + (condIndep_of_condIndep_of_le_left + (tapes_independent_given_complete_public μ A B hA hB F h0 hstep) hX.comap_le) hY.comap_le + +end SecretKey + +end + +end OAI diff --git a/lean/OAI/InformationTheory/Entanglement/TranscriptLimit.lean b/lean/OAI/InformationTheory/Entanglement/TranscriptLimit.lean new file mode 100644 index 0000000000000000000000000000000000000000..27ec7c653acc409c6ff6eea467ad658dae3d678a --- /dev/null +++ b/lean/OAI/InformationTheory/Entanglement/TranscriptLimit.lean @@ -0,0 +1,29 @@ +import Mathlib + +namespace OAI + +noncomputable section +open MeasureTheory ProbabilityTheory Filter +open scoped MeasureTheory ProbabilityTheory Topology +namespace SecretKey + +theorem conditional_independence_limit {Ω : Type*} {mΩ : MeasurableSpace Ω} + [StandardBorelSpace Ω] (μ : Measure Ω) [IsFiniteMeasure μ] + (F : Filtration ℕ mΩ) (A B : MeasurableSpace Ω) (hA : A ≤ mΩ) (hB : B ≤ mΩ) + (h : ∀ k, CondIndep (F k) A B (F.le k) μ) : + CondIndep (⨆ k, F k) A B (iSup_le fun k => F.le k) μ := by + rw [condIndep_iff _ _ _ _ hA hB] + intro s t hs ht + have he : ∀ k, (μ⟦s ∩ t | F k⟧) =ᵐ[μ] (μ⟦s | F k⟧) * (μ⟦t | F k⟧) := + fun k => (condIndep_iff _ _ _ _ hA hB μ).mp (h k) s t hs ht + have ha := MeasureTheory.tendsto_ae_condExp (μ := μ) (ℱ := F) (s.indicator (fun _ => (1 : ℝ))) + have hb := MeasureTheory.tendsto_ae_condExp (μ := μ) (ℱ := F) (t.indicator (fun _ => (1 : ℝ))) + have hab := MeasureTheory.tendsto_ae_condExp (μ := μ) (ℱ := F) ((s ∩ t).indicator (fun _ => (1 : ℝ))) + have hall := ae_all_iff.mpr he + filter_upwards [ha,hb,hab,hall] with x hax hbx habx hex + exact tendsto_nhds_unique habx ((hax.mul hbx).congr (fun k => (hex k).symm)) +end SecretKey + +end + +end OAI diff --git a/lean/OAI/InformationTheory/Entanglement/WeakIntegralForm.lean b/lean/OAI/InformationTheory/Entanglement/WeakIntegralForm.lean new file mode 100644 index 0000000000000000000000000000000000000000..811f905f42e75e6479884d66fb1039707e116aab --- /dev/null +++ b/lean/OAI/InformationTheory/Entanglement/WeakIntegralForm.lean @@ -0,0 +1,70 @@ +import OAI.InformationTheory.Entanglement.TraceStateBounds + +namespace OAI + +noncomputable section +open scoped InnerProductSpace MeasureTheory +open MeasureTheory ContinuousLinearMap +namespace SecretKey +variable {H : Type*} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] +variable {ι X : Type*} [MeasurableSpace X] +variable (b : HilbertBasis ι ℂ H) (μ : Measure X) [IsFiniteMeasure μ] +variable (ρ : X→DensityOperator b) +variable (hρ : ∀ x y : H, Measurable (fun z => inner ℂ x ((ρ z).val.val y))) +include hρ +lemma density_coefficient_integrable (x y : H) : + Integrable (fun z => inner ℂ x ((ρ z).val.val y)) μ := by + apply (integrable_const (‖x‖*‖y‖)).mono' (hρ x y).aestronglyMeasurable + exact Filter.Eventually.of_forall (fun z => density_coefficient_bound b (ρ z) x y) +def densityIntegralLeft (y : H) : H→L[ℝ]ℂ := + ({ toFun x := ∫ z, inner ℂ x ((ρ z).val.val y) ∂μ + map_add' x x' := by + simp only [inner_add_left] + exact integral_add (density_coefficient_integrable b μ ρ hρ x y) + (density_coefficient_integrable b μ ρ hρ x' y) + map_smul' r x := by + change (∫ z, inner ℂ (r • x) ((ρ z).val.val y) ∂μ)=r • _ + calc + _ = ∫ z, r • inner ℂ x ((ρ z).val.val y) ∂μ := by + apply integral_congr_ae + filter_upwards with z + rw [← Complex.coe_smul r x] + exact inner_smul_real_left (𝕜 := ℂ) x ((ρ z).val.val y) r + _ = _ := integral_smul r _ } : H→ₗ[ℝ]ℂ).mkContinuous + (‖y‖*μ.real Set.univ) (fun x => by + change ‖∫ z, inner ℂ x ((ρ z).val.val y) ∂μ‖ ≤ (‖y‖*μ.real Set.univ)*‖x‖ + have hh := norm_integral_le_of_norm_le_const (μ := μ) + (Filter.Eventually.of_forall (fun z => density_coefficient_bound b (ρ z) x y)) + simpa only [mul_assoc,mul_left_comm,mul_comm] using hh) +def densityIntegralRight (x : H) : H→L[ℝ]ℂ := + ({ toFun y := ∫ z, inner ℂ x ((ρ z).val.val y) ∂μ + map_add' y y' := by + simp only [map_add,inner_add_right] + exact integral_add (density_coefficient_integrable b μ ρ hρ x y) + (density_coefficient_integrable b μ ρ hρ x y') + map_smul' r y := by + change (∫ z, inner ℂ x ((ρ z).val.val (r • y)) ∂μ)=r • _ + calc + _ = ∫ z, r • inner ℂ x ((ρ z).val.val y) ∂μ := by + apply integral_congr_ae + filter_upwards with z + rw [← Complex.coe_smul r y,map_smul] + exact inner_smul_real_right (𝕜 := ℂ) x ((ρ z).val.val y) r + _ = _ := integral_smul r _ } : H→ₗ[ℝ]ℂ).mkContinuous + (‖x‖*μ.real Set.univ) (fun y => by + change ‖∫ z, inner ℂ x ((ρ z).val.val y) ∂μ‖ ≤ (‖x‖*μ.real Set.univ)*‖y‖ + have hh := norm_integral_le_of_norm_le_const (μ := μ) + (Filter.Eventually.of_forall (fun z => density_coefficient_bound b (ρ z) x y)) + simpa only [mul_assoc,mul_left_comm,mul_comm] using hh) +lemma densityIntegral_left_continuous (y : H) : + Continuous (fun x => ∫ z, inner ℂ x ((ρ z).val.val y) ∂μ) := + (densityIntegralLeft b μ ρ hρ y).continuous +lemma densityIntegral_right_continuous (x : H) : + Continuous (fun y => ∫ z, inner ℂ x ((ρ z).val.val y) ∂μ) := + (densityIntegralRight b μ ρ hρ x).continuous + +end SecretKey + +end + +end OAI diff --git a/lean/OAI/InformationTheory/Entanglement/WeakLawTrace.lean b/lean/OAI/InformationTheory/Entanglement/WeakLawTrace.lean new file mode 100644 index 0000000000000000000000000000000000000000..ce971d7f5f78d44df8a63ae7d8832da55e67d8b5 --- /dev/null +++ b/lean/OAI/InformationTheory/Entanglement/WeakLawTrace.lean @@ -0,0 +1,57 @@ +import OAI.InformationTheory.Entanglement.WeakStateUnique +import OAI.InformationTheory.Entanglement.HilbertMeasure + +namespace OAI + +noncomputable section +open scoped BigOperators InnerProductSpace ComplexOrder MeasureTheory +open ContinuousLinearMap MeasureTheory Filter +namespace SecretKey +variable {H : Type*} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] +variable {ι X : Type*} [MeasurableSpace X] + +lemma weak_density_trace_le (b : HilbertBasis ι ℂ H) + (W : PositiveHilbertMeasure X H b) (μ : Measure X) [IsFiniteMeasure μ] + (ρ : X→DensityOperator b) + (hm : ∀ x y : H, Measurable (fun z => inner ℂ x ((ρ z).val.val y))) + (hd : ∀ s, MeasurableSet s → ∀ x y : H, + W.coeff x y s=∫ z in s, inner ℂ x ((ρ z).val.val y) ∂μ) : + W.traceMeasure≤μ := by + classical + apply Measure.le_iff.mpr + intro s hs + apply (ENNReal.toReal_le_toReal (measure_ne_top _ _) (measure_ne_top _ _)).mp + change W.traceMeasure.real s≤μ.real s + rw [W.trace_value s hs] + change (∑' i, (inner ℂ (b i) (W.value s (b i))).re)≤μ.real s + apply (W.positive s hs).2.tsum_le_of_sum_le + intro t + have hdiag (i : ι) : Integrable (fun z => densityDiag b (ρ z) i) (μ.restrict s) := + (density_coefficient_integrable b μ ρ hm (b i) (b i)).re.integrableOn + have he (i : ι) : (inner ℂ (b i) (W.value s (b i))).re= + ∫ z in s, densityDiag b (ρ z) i ∂μ := by + rw [← W.coeff_value _ _ _ hs,hd s hs] + exact (integral_re (density_coefficient_integrable b μ ρ hm (b i) (b i)).integrableOn).symm + simp_rw [he] + rw [← integral_finsetSum _ (fun i _ => hdiag i)] + calc + (∫ z in s, ∑ i∈t, densityDiag b (ρ z) i ∂μ)≤∫ _ in s, (1 : ℝ) ∂μ := by + apply integral_mono (integrable_finsetSum _ (fun i _ => hdiag i)) (integrable_const _) + intro z + rw [← densityDiag_sum b (ρ z)] + exact (densityDiag_summable b (ρ z)).sum_le_tsum t (fun i _ => densityDiag_nonneg b (ρ z) i) + _=μ.real s := by simp +lemma weak_density_trace_eq (b : HilbertBasis ι ℂ H) + (W : PositiveHilbertMeasure X H b) [IsProbabilityMeasure W.traceMeasure] + (μ : Measure X) [IsProbabilityMeasure μ] (ρ : X→DensityOperator b) + (hm : ∀ x y : H, Measurable (fun z => inner ℂ x ((ρ z).val.val y))) + (hd : ∀ s, MeasurableSet s → ∀ x y : H, + W.coeff x y s=∫ z in s, inner ℂ x ((ρ z).val.val y) ∂μ) : + W.traceMeasure=μ := + Measure.eq_of_le_of_measure_univ_eq (weak_density_trace_le b W μ ρ hm hd) (by simp) + +end SecretKey + +end + +end OAI diff --git a/lean/OAI/InformationTheory/Entanglement/WeakProductPrefix.lean b/lean/OAI/InformationTheory/Entanglement/WeakProductPrefix.lean new file mode 100644 index 0000000000000000000000000000000000000000..8874c2ff67a02973941a6e2f4a35e90a92696466 --- /dev/null +++ b/lean/OAI/InformationTheory/Entanglement/WeakProductPrefix.lean @@ -0,0 +1,66 @@ +import OAI.InformationTheory.Entanglement.TraceStateBounds +import OAI.InformationTheory.Entanglement.QuantumStepKernel + +namespace OAI + +noncomputable section +open scoped BigOperators InnerProductSpace ComplexOrder ENNReal MeasureTheory TensorProduct +open ContinuousLinearMap MeasureTheory ProbabilityTheory +namespace SecretKey +variable {S X : Type*} [MeasurableSpace S] [MeasurableSpace X] +variable {H K L : Type*} + [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + [NormedAddCommGroup K] [InnerProductSpace ℂ K] [CompleteSpace K] + [NormedAddCommGroup L] [InnerProductSpace ℂ L] [CompleteSpace L] +variable {ι κ υ : Type*} +lemma complexMeasure_ext_rectangles {M N : ComplexMeasure (S×X)} + (h : ∀ U V, MeasurableSet U → MeasurableSet V → M (U ×ˢ V)=N (U ×ˢ V)) : M=N := by + apply VectorMeasure.ext_of_generateFrom _ _ generateFrom_prod.symm isPiSystem_prod + · rw [← Set.univ_prod_univ] + exact h _ _ MeasurableSet.univ MeasurableSet.univ + · rintro - ⟨U,hU,V,hV,rfl⟩ + exact h U V hU hV + +lemma product_density_integrable (b : HilbertBasis ι ℂ H) (d : HilbertBasis υ ℂ L) + {Ω : Type*} [MeasurableSpace Ω] (ν : Measure Ω) [IsFiniteMeasure ν] + (ρ : Ω→DensityOperator b) (σ : Ω→DensityOperator d) + (x y : H) (u v : L) + (hm : Measurable (fun z => inner ℂ x ((ρ z).val.val y)*inner ℂ u ((σ z).val.val v))) : + Integrable (fun z => inner ℂ x ((ρ z).val.val y)*inner ℂ u ((σ z).val.val v)) ν := by + apply (integrable_const (‖x‖*‖y‖*(‖u‖*‖v‖))).mono' hm.aestronglyMeasurable + filter_upwards with z + rw [norm_mul] + exact mul_le_mul (density_coefficient_bound b (ρ z) x y) + (density_coefficient_bound d (σ z) u v) (norm_nonneg _) (mul_nonneg (norm_nonneg _) (norm_nonneg _)) + +omit [CompleteSpace H] in +theorem local_refinement_product_density (b : HilbertBasis ι ℂ H) (c : HilbertBasis κ ℂ K) + (d : HilbertBasis υ ℂ L) (J : S→TraceInstrument b c X) + (ρ : S→DensityOperator b) (σ : S→DensityOperator d) + (hm : ∀ V, MeasurableSet V → Measurable (fun h => (J h).outcome (ρ h) V)) + (U : ∀ h, (J h).ConditionalUpdate (ρ h)) + (ν : Measure S) [IsFiniteMeasure ν] + (x y : K) (u v : L) + (hf : Measurable (fun p : S×X => inner ℂ x (((U p.1).state p.2).val.val y)* + inner ℂ u ((σ p.1).val.val v))) + (M : ComplexMeasure (S×X)) + (hEvent : ∀ A B, MeasurableSet A → MeasurableSet B → M (A ×ˢ B)= + ∫ h in A, tensorFunctional (traceClassCoefficient c x y) (traceClassCoefficient d u v) + (TensorProduct.map ((J h).event B) LinearMap.id ((ρ h).val ⊗ₜ[ℂ] (σ h).val)) ∂ν) : + M=(ν ⊗ₘ TraceInstrument.historyKernel J ρ hm).withDensityᵥ + (fun p : S×X => inner ℂ x (((U p.1).state p.2).val.val y)*inner ℂ u ((σ p.1).val.val v)) := by + let k := TraceInstrument.historyKernel J ρ hm + have hi := product_density_integrable c d (ν ⊗ₘ k) + (fun p : S×X => (U p.1).state p.2) (fun p : S×X => σ p.1) x y u v hf + apply complexMeasure_ext_rectangles + intro A B hA hB + rw [withDensityᵥ_apply hi (hA.prod hB),Measure.setIntegral_compProd hA hB hi.integrableOn,hEvent A B hA hB] + apply setIntegral_congr_fun hA + intro h hh + exact local_product_disintegration b c d (J h) (ρ h) (σ h) (U h) hB x y u v + +end SecretKey + +end + +end OAI diff --git a/lean/OAI/InformationTheory/Entanglement/WeakStateSupport.lean b/lean/OAI/InformationTheory/Entanglement/WeakStateSupport.lean new file mode 100644 index 0000000000000000000000000000000000000000..9094bd994b133497dc282e8422444a8513d6ed67 --- /dev/null +++ b/lean/OAI/InformationTheory/Entanglement/WeakStateSupport.lean @@ -0,0 +1,98 @@ +import OAI.InformationTheory.Entanglement.WeakIntegralForm + +namespace OAI + +noncomputable section +open scoped InnerProductSpace ComplexOrder MeasureTheory +open ContinuousLinearMap MeasureTheory Filter +namespace SecretKey +variable {H : Type*} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] +variable {ι X : Type*} [MeasurableSpace X] +def densityDiag (b : HilbertBasis ι ℂ H) (ρ : DensityOperator b) (i : ι) : ℝ := + (inner ℂ (b i) (ρ.val.val (b i))).re +omit [CompleteSpace H] in +lemma densityDiag_nonneg (b : HilbertBasis ι ℂ H) (ρ : DensityOperator b) (i : ι) : + 0≤densityDiag b ρ i := (nonneg_iff_isPositive.mp ρ.property.1).re_inner_nonneg_right _ +omit [CompleteSpace H] in +lemma densityDiag_summable (b : HilbertBasis ι ℂ H) (ρ : DensityOperator b) : + Summable (densityDiag b ρ) := ((traceClass_positive_iff b _).mp ⟨ρ.val.property,ρ.property.1⟩).2 +omit [CompleteSpace H] in +lemma densityDiag_sum (b : HilbertBasis ι ℂ H) (ρ : DensityOperator b) : ∑' i, densityDiag b ρ i=1 := by + change hilbertTrace b ρ.val.val=1 + rw [← traceClassTrace_re,ρ.property.2] + rfl +lemma positive_re_inner_zero {A : H→L[ℂ]H} (hA : 0≤A) {x : H} + (hx : (inner ℂ x (A x)).re=0) : A x=0 := by + have hs : ‖CFC.sqrt A x‖^2=0 := by rwa [← positive_diagonal_sqrt hA] + have hz : CFC.sqrt A x=0 := norm_eq_zero.mp ((pow_eq_zero_iff (by decide : 2≠0)).mp hs) + rw [← CFC.sqrt_mul_sqrt_self A hA] + change CFC.sqrt A (CFC.sqrt A x)=0 + rw [hz,map_zero] +omit [CompleteSpace H] in +lemma density_subtype_diag_le (b : HilbertBasis ι ℂ H) (ρ : DensityOperator b) (s : Set ι) : + (∑' i : s, densityDiag b ρ i)≤1 := by + rw [← densityDiag_sum b ρ] + exact Summable.tsum_le_tsum_of_inj Subtype.val Subtype.val_injective + (fun i _ => densityDiag_nonneg b ρ i) (fun i => le_rfl) + ((densityDiag_summable b ρ).subtype s) (densityDiag_summable b ρ) +lemma density_kills_outside (b : HilbertBasis ι ℂ H) (ρ : DensityOperator b) (s : Set ι) + (hs : (∑' i : s, densityDiag b ρ i)=1) : ∀ i∉s, ρ.val.val (b i)=0 := by + have he := (densityDiag_summable b ρ).tsum_subtype_add_tsum_subtype_compl s + rw [hs,densityDiag_sum b ρ] at he + have hh : (∑' i : ↥(sᶜ), densityDiag b ρ i)=0 := by linarith + intro i hi + apply positive_re_inner_zero ρ.property.1 + have hl := ((densityDiag_summable b ρ).subtype sᶜ).le_tsum (⟨i,hi⟩ : ↥(sᶜ)) + (fun j hj => densityDiag_nonneg b ρ j) + change densityDiag b ρ i ≤ ∑' j : ↥(sᶜ), densityDiag b ρ j at hl + rw [hh] at hl + exact le_antisymm hl (densityDiag_nonneg b ρ i) + +theorem weak_density_countable_support (b : HilbertBasis ι ℂ H) + (μ : Measure X) [IsProbabilityMeasure μ] (ρ : X→DensityOperator b) (T : DensityOperator b) + (hρ : ∀ x y : H, Measurable (fun z => inner ℂ x ((ρ z).val.val y))) + (hmean : ∀ x y : H, inner ℂ x (T.val.val y)=∫ z, inner ℂ x ((ρ z).val.val y) ∂μ) : + (Function.support (densityDiag b T)).Countable ∧ + ∀ᵐ z ∂μ, ∀ i∉Function.support (densityDiag b T), (ρ z).val.val (b i)=0 := by + let s := Function.support (densityDiag b T) + have hcount : s.Countable := (densityDiag_summable b T).countable_support + let : Countable s := hcount.to_subtype + have hdiag (i : ι) : Integrable (fun z => densityDiag b (ρ z) i) μ := + (density_coefficient_integrable b μ ρ hρ (b i) (b i)).re + have hmean' (i : ι) : ∫ z, densityDiag b (ρ z) i ∂μ=densityDiag b T i := by + change (∫ z, (inner ℂ (b i) ((ρ z).val.val (b i))).re ∂μ)=_ + erw [integral_re (density_coefficient_integrable b μ ρ hρ (b i) (b i))] + exact congrArg Complex.re (hmean (b i) (b i)).symm + have hnorm (i : s) : ∫ z, ‖densityDiag b (ρ z) i‖ ∂μ=densityDiag b T i := by + simpa only [Real.norm_eq_abs,abs_of_nonneg (densityDiag_nonneg b (ρ _) _)] using hmean' i + have hsum : Summable (fun i : s => ∫ z, ‖densityDiag b (ρ z) i‖ ∂μ) := by + simp_rw [hnorm] + exact (densityDiag_summable b T).subtype s + let g := fun z => ∑' i : s, densityDiag b (ρ z) i + have hgmean : ∫ z, g z ∂μ=1 := by + have hh := (hasSum_integral_of_summable_integral_norm (fun i : s => hdiag i) hsum).tsum_eq + rw [← hh] + simp only [hmean'] + rw [tsum_subtype_eq_of_support_subset (show Function.support (densityDiag b T)⊆s from Set.Subset.rfl)] + exact densityDiag_sum b T + have hgm : Measurable g := by + exact Measurable.tsum (fun i : s => (hρ (b i) (b i)).re) + have hgn (z : X) : 0≤g z := tsum_nonneg (fun i => densityDiag_nonneg b (ρ z) i) + have hgle (z : X) : g z≤1 := density_subtype_diag_le b (ρ z) s + have hgi : Integrable g μ := by + apply (integrable_const (1 : ℝ)).mono' hgm.aestronglyMeasurable + exact Eventually.of_forall (fun z => by simpa only [Real.norm_eq_abs,abs_of_nonneg (hgn z)] using hgle z) + have hzero : ∀ᵐ z ∂μ, 1-g z=0 := by + apply (integral_eq_zero_iff_of_nonneg_ae + (Eventually.of_forall (fun z => sub_nonneg.mpr (hgle z))) ((integrable_const (1 : ℝ)).sub hgi)).mp + rw [integral_sub (integrable_const (1 : ℝ)) hgi,hgmean] + simp + refine ⟨hcount,?_⟩ + filter_upwards [hzero] with z hz + exact density_kills_outside b (ρ z) s (by linarith) + +end SecretKey + +end + +end OAI diff --git a/lean/OAI/InformationTheory/Entanglement/WeakStateUnique.lean b/lean/OAI/InformationTheory/Entanglement/WeakStateUnique.lean new file mode 100644 index 0000000000000000000000000000000000000000..b3af11f7114a499abfb5ed64850f271697be3717 --- /dev/null +++ b/lean/OAI/InformationTheory/Entanglement/WeakStateUnique.lean @@ -0,0 +1,90 @@ +import OAI.InformationTheory.Entanglement.WeakStateSupport +import OAI.InformationTheory.Entanglement.PhysicalConditionalUpdate + +namespace OAI + +noncomputable section +open scoped InnerProductSpace ComplexOrder MeasureTheory +open ContinuousLinearMap MeasureTheory Filter +namespace SecretKey +variable {H : Type*} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] +variable {ι X : Type*} [MeasurableSpace X] +omit [CompleteSpace H] in +lemma hilbertBasis_operator_ext (b : HilbertBasis ι ℂ H) {A B : H→L[ℂ]H} + (h : ∀ i j, inner ℂ (b i) (A (b j))=inner ℂ (b i) (B (b j))) : A=B := by + have hc (j : ι) : A (b j)=B (b j) := by + apply b.repr.injective + ext i + simpa only [b.repr_apply_apply] using h i j + ext x + have ha := (b.hasSum_repr x).mapL A + have hb := (b.hasSum_repr x).mapL B + have he : (fun i => A (b.repr x i • b i))=(fun i => B (b.repr x i • b i)) := by + funext i + rw [map_smul,map_smul,hc] + rw [he] at ha + exact ha.unique hb + +theorem weak_density_ae_unique (b : HilbertBasis ι ℂ H) (μ : Measure X) [IsProbabilityMeasure μ] + (ρ σ : X→DensityOperator b) (T : DensityOperator b) + (hρ : ∀ x y, Measurable (fun z => inner ℂ x ((ρ z).val.val y))) + (hσ : ∀ x y, Measurable (fun z => inner ℂ x ((σ z).val.val y))) + (hmean : ∀ x y, inner ℂ x (T.val.val y)=∫ z, inner ℂ x ((ρ z).val.val y) ∂μ) + (hsets : ∀ s, MeasurableSet s → ∀ x y, + ∫ z in s, inner ℂ x ((ρ z).val.val y) ∂μ=∫ z in s, inner ℂ x ((σ z).val.val y) ∂μ) : + ρ=ᵐ[μ]σ := by + have hmean' (x y : H) : inner ℂ x (T.val.val y)=∫ z, inner ℂ x ((σ z).val.val y) ∂μ := by + rw [hmean] + simpa only [Measure.restrict_univ] using hsets Set.univ MeasurableSet.univ x y + obtain ⟨hc,hface⟩ := weak_density_countable_support b μ ρ T hρ hmean + obtain ⟨_,hspace⟩ := weak_density_countable_support b μ σ T hσ hmean' + let s := Function.support (densityDiag b T) + let : Countable s := hc.to_subtype + have hcoeff (i j : s) : (fun z => inner ℂ (b i) ((ρ z).val.val (b j)))=ᵐ[μ] + (fun z => inner ℂ (b i) ((σ z).val.val (b j))) := by + apply ae_eq_of_forall_setIntegral_eq_of_sigmaFinite + · intro a ha hfin + exact (density_coefficient_integrable b μ ρ hρ (b i) (b j)).integrableOn + · intro a ha hfin + exact (density_coefficient_integrable b μ σ hσ (b i) (b j)).integrableOn + · intro a ha hfin + exact hsets a ha (b i) (b j) + have hall : ∀ᵐ z ∂μ, ∀ i j : s, + inner ℂ (b i) ((ρ z).val.val (b j))=inner ℂ (b i) ((σ z).val.val (b j)) := + ae_all_iff.mpr (fun i => ae_all_iff.mpr (hcoeff i)) + filter_upwards [hface,hspace,hall] with z hz hz' hzc + apply Subtype.ext + apply Subtype.ext + apply hilbertBasis_operator_ext b + intro i j + by_cases hj : j∈s + · by_cases hi : i∈s + · exact hzc ⟨i,hi⟩ ⟨j,hj⟩ + · have hA := (nonneg_iff_isPositive.mp (ρ z).property.1).isSymmetric + have hB := (nonneg_iff_isPositive.mp (σ z).property.1).isSymmetric + erw [← hA (b i) (b j),← hB (b i) (b j),hz i hi,hz' i hi] + · rw [hz j hj,hz' j hj] +variable {K : Type*} [NormedAddCommGroup K] [InnerProductSpace ℂ K] [CompleteSpace K] +variable {κ : Type*} +namespace TraceInstrument.ConditionalUpdate +variable {b : HilbertBasis ι ℂ H} {c : HilbertBasis κ ℂ K} +variable {I : TraceInstrument b c X} {ρ : DensityOperator b} + +omit [CompleteSpace H] in +theorem ae_unique (U V : I.ConditionalUpdate ρ) : U.state=ᵐ[I.outcome ρ]V.state := by + let T : DensityOperator c := ⟨I.event Set.univ ρ.val, + cp_trace_positive b c (I.event_cp Set.univ MeasurableSet.univ) ρ.property.1,by + rw [I.trace_preserving,ρ.property.2]⟩ + apply weak_density_ae_unique c (I.outcome ρ) U.state V.state T + U.coefficient_measurable V.coefficient_measurable + · intro x y + simpa only [Measure.restrict_univ] using U.disintegration Set.univ MeasurableSet.univ x y + · intro s hs x y + rw [← U.disintegration s hs x y,← V.disintegration s hs x y] +end TraceInstrument.ConditionalUpdate + +end SecretKey + +end + +end OAI diff --git a/lean/OAI/InformationTheory/Entanglement/WeakTensorMeasurable.lean b/lean/OAI/InformationTheory/Entanglement/WeakTensorMeasurable.lean new file mode 100644 index 0000000000000000000000000000000000000000..33cd9026189bd604b4ab591951cffa8dabcad2ee --- /dev/null +++ b/lean/OAI/InformationTheory/Entanglement/WeakTensorMeasurable.lean @@ -0,0 +1,72 @@ +import OAI.InformationTheory.Entanglement.PhysicalProductStep + +namespace OAI + +noncomputable section +open scoped TensorProduct InnerProductSpace MeasureTheory +open ContinuousLinearMap UniformSpace MeasureTheory Filter +namespace SecretKey +variable {H K : Type*} + [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + [NormedAddCommGroup K] [InnerProductSpace ℂ K] [CompleteSpace K] +variable {X : Type*} [MeasurableSpace X] + +omit [CompleteSpace H] [CompleteSpace K] in +lemma hilbertTensor_weak_measurable (F : X→HilbertTensor H K→L[ℂ]HilbertTensor H K) + (hF : ∀ x y : H, ∀ u v : K, + Measurable (fun z => inner ℂ (hilbertTmul x u) (F z (hilbertTmul y v)))) : + ∀ x y : HilbertTensor H K, Measurable (fun z => inner ℂ x (F z y)) := by + have hc (y : HilbertTensor H K) : + IsClosed {x : HilbertTensor H K | Measurable (fun z => inner ℂ x (F z y))} := by + apply IsSeqClosed.isClosed + intro f x hf hlim + apply measurable_of_tendsto_metrizable (fun n => hf n) + apply tendsto_pi_nhds.mpr + intro z + exact hlim.inner tendsto_const_nhds + have hr (x : HilbertTensor H K) : + IsClosed {y : HilbertTensor H K | Measurable (fun z => inner ℂ x (F z y))} := by + apply IsSeqClosed.isClosed + intro f y hf hlim + apply measurable_of_tendsto_metrizable (fun n => hf n) + apply tendsto_pi_nhds.mpr + intro z + exact tendsto_const_nhds.inner ((F z).continuous.continuousAt.tendsto.comp hlim) + have hleft (y : H) (v : K) (x : HilbertTensor H K) : + Measurable (fun z => inner ℂ x (F z (hilbertTmul y v))) := by + refine Completion.induction_on x (hc _) ?_ + intro t + induction t using TensorProduct.inductionOn with + | tmul a b => exact hF a y b v + | add a b ha hb => + convert ha.add hb using 1 + ext z + simp only [Pi.add_apply,Completion.coe_add,inner_add_left] + intro x y + refine Completion.induction_on y (hr x) ?_ + intro t + induction t using TensorProduct.inductionOn with + | tmul a b => exact hleft a b x + | add a b ha hb => + convert ha.add hb using 1 + ext z + simp only [Pi.add_apply,Completion.coe_add,map_add,inner_add_right] +lemma densityTensor_coefficient_measurable {ι κ : Type*} + (b : HilbertBasis ι ℂ H) (c : HilbertBasis κ ℂ K) + (ρ : X→DensityOperator b) (σ : X→DensityOperator c) + (hρ : ∀ x y, Measurable (fun z => inner ℂ x ((ρ z).val.val y))) + (hσ : ∀ u v, Measurable (fun z => inner ℂ u ((σ z).val.val v))) + (x y : HilbertTensor H K) : + Measurable (fun z => inner ℂ x ((densityTensor b c (ρ z) (σ z)).val.val y)) := by + apply hilbertTensor_weak_measurable _ _ x y + intro a a' u u' + change Measurable (fun z => inner ℂ (hilbertTmul a u) + (hilbertTensorMap (ρ z).val.val (σ z).val.val (hilbertTmul a' u'))) + simp only [hilbertTensorMap_tmul,hilbertTmul_inner] + exact (hρ a a').mul (hσ u u') + +end SecretKey + +end + +end OAI diff --git a/lean/OAI/InformationTheory/PhotonNumber/Basic.lean b/lean/OAI/InformationTheory/PhotonNumber/Basic.lean new file mode 100644 index 0000000000000000000000000000000000000000..7c8619d6b039b9b37d5dbd1893c3604b1f935f90 --- /dev/null +++ b/lean/OAI/InformationTheory/PhotonNumber/Basic.lean @@ -0,0 +1,102 @@ +import Mathlib + +namespace OAI + +noncomputable section + +open scoped BigOperators ComplexConjugate + +namespace EntropyPhotonNumber + +/-- The number-basis indices for `n` bosonic modes. -/ +abbrev NumberIndex (n : ℕ) := Fin n → ℕ + +/-- The full, untruncated bosonic Fock space `ℓ²(ℕⁿ, ℂ)`. -/ +abbrev Fock (n : ℕ) := lp (fun _ : NumberIndex n => ℂ) 2 + +/-- A number-basis vector. -/ +def numberKet {n : ℕ} (k : NumberIndex n) : Fock n := lp.single 2 k 1 + +/-- Matrix entries of an operator in the number basis. -/ +def entry {n : ℕ} (T : Fock n →L[ℂ] Fock n) (k l : NumberIndex n) : ℂ := + inner ℂ (numberKet k) (T (numberKet l)) + +/-- Positive trace-one operators. For a positive bounded operator on this +Hilbert space, summability of its diagonal is the positive trace-class +criterion; `HasSum ... 1` includes summability as well as normalization. -/ +structure State (n : ℕ) where + op : Fock n →L[ℂ] Fock n + positive : op.IsPositive + trace_one : HasSum (fun k => (entry op k k).re) 1 + +/-- Total number of quanta in a number-basis vector. -/ +def totalNumber {n : ℕ} (k : NumberIndex n) : ℕ := ∑ j, k j + +/-- Exactly finiteness of the expectation of the nonnegative number operator. -/ +def FiniteEnergy {n : ℕ} (ρ : State n) : Prop := + Summable (fun k => (totalNumber k : ℝ) * (entry ρ.op k k).re) + +/-- `−Tr ρ log ρ`, using the continuous extension of `−t log t` at zero +and continuous functional calculus for the positive operator `ρ`. -/ +def entropy {n : ℕ} (ρ : State n) : ℝ := + ∑' k, (entry (cfc (fun z : ℂ => (-(z.re * Real.log z.re) : ℂ)) ρ.op) k k).re + +/-- The thermal entropy per mode; Lean's `Real.log 0 = 0` implements +exactly the stated convention `0 log 0 = 0`. -/ +def g (t : ℝ) : ℝ := (t + 1) * Real.log (t + 1) - t * Real.log t + +/-- The inverse of increasing `g : [0,∞) → [0,∞)`, expressed by its lower +level cut. Only its values on `[0,∞)` occur in the main theorem. -/ +def gInv (s : ℝ) : ℝ := sInf {t : ℝ | 0 ≤ t ∧ s ≤ g t} + +/-- One-mode passive beam-splitter coefficient, in number bases. It is the +coefficient of `(c†)^k (d†)^e` in +`(√η c† − √(1−η) d†)^a (√(1−η) c† + √η d†)^b`, +with the normalized number-vector factorials. -/ +def oneModeBeamCoefficient (η : ℝ) (k e a b : ℕ) : ℝ := + if k + e = a + b then + Real.sqrt (((k.factorial : ℝ) * e.factorial) / (a.factorial * b.factorial)) * + ∑ p ∈ Finset.range (a + 1), ∑ q ∈ Finset.range (b + 1), + if p + q = k then + (a.choose p : ℝ) * b.choose q * + Real.sqrt η ^ p * (-Real.sqrt (1 - η)) ^ (a - p) * + Real.sqrt (1 - η) ^ q * Real.sqrt η ^ (b - q) + else 0 + else 0 + +/-- The same passive rotation is performed on all mode indices. -/ +def beamCoefficient {n : ℕ} (η : ℝ) (k e a b : NumberIndex n) : ℝ := + ∏ j, oneModeBeamCoefficient η (k j) (e j) (a j) (b j) + +/-- Choices of the first input number in the total-number sector of `(k,e)`. -/ +abbrev SectorSplit {n : ℕ} (k e : NumberIndex n) := ∀ j, Fin (k j + e j + 1) + +def splitLeft {n : ℕ} {k e : NumberIndex n} (a : SectorSplit k e) : NumberIndex n := + fun j => a j + +def splitRight {n : ℕ} {k e : NumberIndex n} (a : SectorSplit k e) : NumberIndex n := + fun j => k j + e j - a j + +/-- A single discarded-number diagonal block of `U(ρA ⊗ ρB)U†`. +The sums are finite because passive mixing preserves number in each paired +mode. The two unrestricted density matrices allow all internal entanglement. -/ +def outputBlock {n : ℕ} (η : ℝ) (ρA ρB : State n) + (k l e : NumberIndex n) : ℂ := + ∑ a : SectorSplit k e, ∑ b : SectorSplit l e, + (beamCoefficient η k e (splitLeft a) (splitRight a) : ℂ) * + entry ρA.op (splitLeft a) (splitLeft b) * + entry ρB.op (splitRight a) (splitRight b) * + (beamCoefficient η l e (splitLeft b) (splitRight b) : ℂ) + +/-- Reduced state after passive beam-splitter mixing of independent ports. +The second row of the orthogonal rotation is `(-√(1−η),√η)`; changing its +sign has no effect on this reduced state. `HasSum` records the actual partial +trace, not a default value for a possibly divergent series. -/ +def IsBeamSplitterOutput {n : ℕ} (η : ℝ) (ρA ρB ρC : State n) : Prop := + ∀ k l, HasSum (outputBlock η ρA ρB k l) (entry ρC.op k l) + +end EntropyPhotonNumber + +end + +end OAI diff --git a/lean/OAI/InformationTheory/PhotonNumber/BeamForms.lean b/lean/OAI/InformationTheory/PhotonNumber/BeamForms.lean new file mode 100644 index 0000000000000000000000000000000000000000..809659ede9feaadb54b57dc8f597d629095b562f --- /dev/null +++ b/lean/OAI/InformationTheory/PhotonNumber/BeamForms.lean @@ -0,0 +1,1680 @@ +import OAI.InformationTheory.PhotonNumber.BeamTrace +import OAI.InformationTheory.PhotonNumber.ThermalMetric + +namespace OAI + +noncomputable section + +open scoped BigOperators ComplexConjugate ENNReal Topology +open MeasureTheory +open scoped ComplexConjugate +open scoped BigOperators ComplexConjugate +open scoped BigOperators +open MvPolynomial +open scoped BigOperators ComplexConjugate Classical +open Submodule +open ContinuousLinearMap +open scoped ENNReal + +namespace BeamLadder + +section +open EntropyPhotonNumber QuantumTrace Annihilation TensorLp +variable {n : ℕ} {I J K : Type*} + +theorem physical_ensemble_output (η : ℝ) (hη : η ∈ Set.Icc 0 1) + (ρ σ τ : State n) (hτ : IsBeamSplitterOutput η ρ σ τ) + (v : I → Fock n) (w : J → Fock n) + (hv : HasSum (fun i => ‖v i‖^2) 1) (hw : HasSum (fun j => ‖w j‖^2) 1) + (hev : TraceEnsemble.operator v=ρ.op) (hew : TraceEnsemble.operator w=σ.op) : + partialTrace (fun ij : I × J => beamUnitary η hη (tensor (v ij.1) (w ij.2)))=τ.op := by + have hs : Summable (fun ij : I × J => ‖beamUnitary η hη (tensor (v ij.1) (w ij.2))‖^2) := by + simpa only [LinearIsometryEquiv.norm_map] using (TraceEnsemble.hasSum_tensor_norm hv hw).summable + apply entry_ext + intro k l + have he := partialTrace_entry hs k l + simp only [beam_ensemble_entry η hη ρ σ v w hv hw hev hew] at he + exact he.unique (hτ k l) + +theorem cross_slice_eq_partialTrace (v : I → JointFock n) : + CrossEnsemble.operator (fun ie : I × NumberIndex n => slice (v ie.1) ie.2) + (fun ie : I × NumberIndex n => slice (v ie.1) ie.2)=partialTrace v := by + exact (Equiv.prodComm I (NumberIndex n)).tsum_eq + (fun ei => InnerProductSpace.rankOne ℂ (slice (v ei.2) ei.1) (slice (v ei.2) ei.1)) + +theorem physical_weighted_output (η : ℝ) (hη : η ∈ Set.Icc 0 1) + (ρ σ τ : State n) (hτ : IsBeamSplitterOutput η ρ σ τ) + (x : I → Fock n) (y : J → Fock n) (z : K → Fock n) + (hxn : HasSum (fun i => ‖inverseWeight 3 (x i)‖^2) 1) + (hyn : HasSum (fun j => ‖inverseWeight 3 (y j)‖^2) 1) + (hex : TraceEnsemble.operator (fun i => inverseWeight 3 (x i))=ρ.op) + (hey : TraceEnsemble.operator (fun j => inverseWeight 3 (y j))=σ.op) + (hez : TraceEnsemble.operator (fun k => inverseWeight 3 (z k))=τ.op) : + CrossEnsemble.operator + (fun ie : (I × J) × NumberIndex n => slice (inverse + (beamUnitary η hη (tensorPreimage (x ie.1.1) (y ie.1.2)))) ie.2) + (fun ie : (I × J) × NumberIndex n => slice (inverse + (beamUnitary η hη (tensorPreimage (x ie.1.1) (y ie.1.2)))) ie.2)= + CrossEnsemble.operator (fun k => inverseWeight 3 (z k)) (fun k => inverseWeight 3 (z k)) := by + rw [cross_slice_eq_partialTrace (fun ij : I × J => inverse + (beamUnitary η hη (tensorPreimage (x ij.1) (y ij.2))))] + simp only [covariance_inverse_apply, tensorPreimage_inverse] + change partialTrace _=TraceEnsemble.operator _ + rw [hez] + exact physical_ensemble_output η hη ρ σ τ hτ (fun i => inverseWeight 3 (x i)) (fun j => inverseWeight 3 (y j)) hxn hyn hex hey + +theorem physical_product_weak (η a b : ℝ) (hη : η ∈ Set.Icc 0 1) + (ρ σ τ : State n) (hτ : IsBeamSplitterOutput η ρ σ τ) + (j : Fin n) (x : I → Fock n) (y : J → Fock n) (z : K → Fock n) + (hx : Summable (fun i => ‖x i‖^2)) (hy : Summable (fun j => ‖y j‖^2)) + (hz : Summable (fun k => ‖z k‖^2)) + (hxn : HasSum (fun i => ‖inverseWeight 3 (x i)‖^2) 1) + (hyn : HasSum (fun j => ‖inverseWeight 3 (y j)‖^2) 1) + (hex : TraceEnsemble.operator (fun i => inverseWeight 3 (x i))=ρ.op) + (hey : TraceEnsemble.operator (fun j => inverseWeight 3 (y j))=σ.op) + (hez : TraceEnsemble.operator (fun k => inverseWeight 3 (z k))=τ.op) + (Z : Fock n →L[ℂ] Fock n) : + singleWeak (η*a+(1-η)*b) j z Z= + (Real.sqrt η:ℂ)*singleWeak a j x + (conditionalLeft (fun j => inverseWeight 3 (y j)) hyn (conjugate η hη Z))+ + (Real.sqrt (1-η):ℂ)*singleWeak b j y + (conditionalRight (fun i => inverseWeight 3 (x i)) hxn (conjugate η hη Z)) := by + have hs := tensorPreimage_summable x y hx hy + have hu : Summable (fun ij : I × J => ‖beamUnitary η hη (tensorPreimage (x ij.1) (y ij.2))‖^2) := by + simpa only [LinearIsometryEquiv.norm_map] using hs + have he := physical_weighted_output η hη ρ σ τ hτ x y z hxn hyn hex hey hez + rw [← output_weak _ j _ z hu hz he Z] + exact product_weak_covariance η hη a b j x y hx hy hxn hyn Z +end + +section +open EntropyPhotonNumber QuantumTrace Annihilation TensorLp +open scoped ComplexConjugate +variable {n : ℕ} + +def preLowerL (j : Fin n) : JointFock n →L[ℂ] JointFock n := lowerL j ∘L (1-inverse) +def preLowerR (j : Fin n) : JointFock n →L[ℂ] JointFock n := lowerR j ∘L (1-inverse) +def preRaiseL (j : Fin n) : JointFock n →L[ℂ] JointFock n := raiseL j ∘L (1+inverse) +def preRaiseR (j : Fin n) : JointFock n →L[ℂ] JointFock n := raiseR j ∘L (1+inverse) + +theorem inverse_preLowerL (j : Fin n) (x : JointFock n) : + inverse (preLowerL j x)=lowerL j (inverse x) := by + apply lp.ext + funext ke + have hw : (W ke:ℂ)≠0 := by exact_mod_cast (by linarith [W_one_le ke] : W ke≠0) + have hu : (W ke:ℂ)+1≠0 := by exact_mod_cast (by linarith [W_one_le ke] : W ke+1≠0) + simp only [preLowerL, ContinuousLinearMap.comp_apply, inverse_apply, lowerL_apply, + sub_apply, one_apply_eq_self, lp.coeFn_sub, Pi.sub_apply, W_upL] + push_cast + field_simp + ring + +theorem inverse_preLowerR (j : Fin n) (x : JointFock n) : + inverse (preLowerR j x)=lowerR j (inverse x) := by + apply lp.ext + funext ke + have hw : (W ke:ℂ)≠0 := by exact_mod_cast (by linarith [W_one_le ke] : W ke≠0) + have hu : (W ke:ℂ)+1≠0 := by exact_mod_cast (by linarith [W_one_le ke] : W ke+1≠0) + simp only [preLowerR, ContinuousLinearMap.comp_apply, inverse_apply, lowerR_apply, + sub_apply, one_apply_eq_self, lp.coeFn_sub, Pi.sub_apply, W_upR] + push_cast + field_simp + ring + +theorem inverse_preRaiseL (j : Fin n) (x : JointFock n) : + inverse (preRaiseL j x)=raiseL j (inverse x) := by + apply lp.ext + funext ke + obtain ⟨k,e⟩ := ke + by_cases hk : k j=0 + · simp only [preRaiseL, ContinuousLinearMap.comp_apply, inverse_apply, + raiseL_zero j _ (k,e) hk, mul_zero] + · obtain ⟨a,rfl⟩ : ∃ a, k=up j a := ⟨down j k,(up_down j k (Nat.pos_of_ne_zero hk)).symm⟩ + change inverse (raiseL j ((1+inverse) x)) (upL j (a,e))=raiseL j (inverse x) (upL j (a,e)) + have hw : (W (a,e):ℂ)≠0 := by exact_mod_cast (by linarith [W_one_le (a,e)] : W (a,e)≠0) + have hu : (W (a,e):ℂ)+1≠0 := by exact_mod_cast (by linarith [W_one_le (a,e)] : W (a,e)+1≠0) + simp only [inverse_apply, W_upL, raiseL_up, add_apply, one_apply_eq_self, lp.coeFn_add, Pi.add_apply] + push_cast + field_simp + +theorem inverse_preRaiseR (j : Fin n) (x : JointFock n) : + inverse (preRaiseR j x)=raiseR j (inverse x) := by + apply lp.ext + funext ke + obtain ⟨k,e⟩ := ke + by_cases he : e j=0 + · simp only [preRaiseR, ContinuousLinearMap.comp_apply, inverse_apply, + raiseR_zero j _ (k,e) he, mul_zero] + · obtain ⟨a,rfl⟩ : ∃ a, e=up j a := ⟨down j e,(up_down j e (Nat.pos_of_ne_zero he)).symm⟩ + change inverse (raiseR j ((1+inverse) x)) (upR j (k,a))=raiseR j (inverse x) (upR j (k,a)) + have hw : (W (k,a):ℂ)≠0 := by exact_mod_cast (by linarith [W_one_le (k,a)] : W (k,a)≠0) + have hu : (W (k,a):ℂ)+1≠0 := by exact_mod_cast (by linarith [W_one_le (k,a)] : W (k,a)+1≠0) + simp only [inverse_apply, W_upR, raiseR_up, add_apply, one_apply_eq_self, lp.coeFn_add, Pi.add_apply] + push_cast + field_simp + +def quadMinusL (j : Fin n) (x y : JointFock n) (Z : JointFock n →L[ℂ] JointFock n) : ℂ := + inner ℂ (lowerL j (inverse x)) (Z (lowerL j (inverse y)))- + (2:ℂ)⁻¹*(inner ℂ (inverse (inverse x)) (Z (raiseL j (preLowerL j y)))+ + inner ℂ (raiseL j (preLowerL j x)) (Z (inverse (inverse y)))) +def quadMinusR (j : Fin n) (x y : JointFock n) (Z : JointFock n →L[ℂ] JointFock n) : ℂ := + inner ℂ (lowerR j (inverse x)) (Z (lowerR j (inverse y)))- + (2:ℂ)⁻¹*(inner ℂ (inverse (inverse x)) (Z (raiseR j (preLowerR j y)))+ + inner ℂ (raiseR j (preLowerR j x)) (Z (inverse (inverse y)))) +def quadPlusL (j : Fin n) (x y : JointFock n) (Z : JointFock n →L[ℂ] JointFock n) : ℂ := + inner ℂ (raiseL j (inverse x)) (Z (raiseL j (inverse y)))- + (2:ℂ)⁻¹*(inner ℂ (inverse (inverse x)) (Z (lowerL j (preRaiseL j y)))+ + inner ℂ (lowerL j (preRaiseL j x)) (Z (inverse (inverse y)))) +def quadPlusR (j : Fin n) (x y : JointFock n) (Z : JointFock n →L[ℂ] JointFock n) : ℂ := + inner ℂ (raiseR j (inverse x)) (Z (raiseR j (inverse y)))- + (2:ℂ)⁻¹*(inner ℂ (inverse (inverse x)) (Z (lowerR j (preRaiseR j y)))+ + inner ℂ (lowerR j (preRaiseR j x)) (Z (inverse (inverse y)))) + +theorem liftLeft_adjoint_inner {A B : Type*} (Z : H A →L[ℂ] H A) + (x y : H (A × B)) : + inner ℂ (liftLeft Z.adjoint x) y=inner ℂ x (liftLeft Z y) := by + apply HasSum.unique (hasSum_slice_inner (liftLeft Z.adjoint x) y) + convert! hasSum_slice_inner x (liftLeft Z y) using 1 + ext b + simp only [slice_liftLeft, ContinuousLinearMap.adjoint_inner_left] + +theorem discarded_commutator_star (j : Fin n) (Z : Fock n →L[ℂ] Fock n) + (x y : JointFock n) : + inner ℂ (raiseR j x) (liftLeft Z (inverse y))= + inner ℂ (inverse x) (liftLeft Z (lowerR j y)) := by + have hh := congrArg (conj : ℂ → ℂ) (discarded_commutator j Z.adjoint y x) + simpa only [inner_conj_symm, liftLeft_adjoint_inner] using hh + +theorem quadMinusR_zero (j : Fin n) (x y : JointFock n) (Z : Fock n →L[ℂ] Fock n) : + quadMinusR j x y (liftLeft Z)=0 := by + have h₁ := discarded_commutator j Z (inverse x) (preLowerR j y) + have h₂ := discarded_commutator_star j Z (preLowerR j x) (inverse y) + rw [inverse_preLowerR] at h₁ h₂ + unfold quadMinusR + rw [h₁, h₂] + ring + +theorem quadPlusR_zero (j : Fin n) (x y : JointFock n) (Z : Fock n →L[ℂ] Fock n) : + quadPlusR j x y (liftLeft Z)=0 := by + have h₁ := discarded_commutator_star j Z (inverse x) (preRaiseR j y) + have h₂ := discarded_commutator j Z (preRaiseR j x) (inverse y) + rw [inverse_preRaiseR] at h₁ h₂ + unfold quadPlusR + rw [← h₁, ← h₂] + ring + +theorem inverse_injective : Function.Injective (inverse (n:=n)) := by + intro x y h + apply lp.ext + funext ke + have hh := congrArg (fun z : JointFock n => z ke) h + simp only [inverse_apply] at hh + have hw : (W ke:ℂ)≠0 := by exact_mod_cast (by linarith [W_one_le ke] : W ke≠0) + exact mul_left_cancel₀ (inv_ne_zero hw) hh + +theorem cross_raise_lower (j : Fin n) (x : JointFock n) : + raiseL j (preLowerR j x)=lowerR j (preRaiseL j x) := by + apply lp.ext + funext ke + obtain ⟨k,e⟩ := ke + by_cases hk : k j=0 + · rw [raiseL_zero j _ (k,e) hk, lowerR_apply] + change 0=_*raiseL j ((1+inverse) x) (k,up j e) + rw [raiseL_zero j _ (k,up j e) hk, mul_zero] + · obtain ⟨a,rfl⟩ : ∃ a,k=up j a := ⟨down j k,(up_down j k (Nat.pos_of_ne_zero hk)).symm⟩ + change raiseL j (preLowerR j x) (upL j (a,e))=_ + rw [raiseL_up, lowerR_apply] + change _=_*raiseL j ((1+inverse) x) (upL j (a,up j e)) + rw [raiseL_up] + have hw : (W (a,e):ℂ)≠0 := by exact_mod_cast (by linarith [W_one_le (a,e)] : W (a,e)≠0) + have hu : (W (a,e):ℂ)+1≠0 := by exact_mod_cast (by linarith [W_one_le (a,e)] : W (a,e)+1≠0) + have hv : (W (a,e):ℂ)+1+1≠0 := by exact_mod_cast (by linarith [W_one_le (a,e)] : W (a,e)+1+1≠0) + simp only [preLowerR, ContinuousLinearMap.comp_apply, lowerR_apply, + sub_apply, add_apply, one_apply_eq_self, lp.coeFn_sub, lp.coeFn_add, + Pi.sub_apply, Pi.add_apply, inverse_apply] + change _=_ + simp only [show W (a,up j e)=W (a,e)+1 from W_upR j (a,e), + show W (up j a,e)=W (a,e)+1 from W_upL j (a,e), upR] + push_cast + field_simp + ring + +theorem cross_lower_raise (j : Fin n) (x : JointFock n) : + raiseR j (preLowerL j x)=lowerL j (preRaiseR j x) := by + apply lp.ext + funext ke + obtain ⟨k,e⟩ := ke + by_cases he : e j=0 + · rw [raiseR_zero j _ (k,e) he, lowerL_apply] + change 0=_*raiseR j ((1+inverse) x) (up j k,e) + rw [raiseR_zero j _ (up j k,e) he, mul_zero] + · obtain ⟨a,rfl⟩ : ∃ a,e=up j a := ⟨down j e,(up_down j e (Nat.pos_of_ne_zero he)).symm⟩ + change raiseR j (preLowerL j x) (upR j (k,a))=_ + rw [raiseR_up, lowerL_apply] + change _=_*raiseR j ((1+inverse) x) (upR j (up j k,a)) + rw [raiseR_up] + have hw : (W (k,a):ℂ)≠0 := by exact_mod_cast (by linarith [W_one_le (k,a)] : W (k,a)≠0) + have hu : (W (k,a):ℂ)+1≠0 := by exact_mod_cast (by linarith [W_one_le (k,a)] : W (k,a)+1≠0) + have hv : (W (k,a):ℂ)+1+1≠0 := by exact_mod_cast (by linarith [W_one_le (k,a)] : W (k,a)+1+1≠0) + simp only [preLowerL, ContinuousLinearMap.comp_apply, lowerL_apply, + sub_apply, add_apply, one_apply_eq_self, lp.coeFn_sub, lp.coeFn_add, + Pi.sub_apply, Pi.add_apply, inverse_apply] + simp only [show W (up j k,a)=W (k,a)+1 from W_upL j (k,a), + show W (k,up j a)=W (k,a)+1 from W_upR j (k,a), upL] + push_cast + field_simp + ring + +def crossMinus (j : Fin n) (x y : JointFock n) (T : JointFock n →L[ℂ] JointFock n) : ℂ := + inner ℂ (lowerL j (inverse x)) (T (lowerR j (inverse y)))+ + inner ℂ (lowerR j (inverse x)) (T (lowerL j (inverse y)))- + (2:ℂ)⁻¹*(inner ℂ (inverse (inverse x)) (T (raiseL j (preLowerR j y)))+ + inner ℂ (inverse (inverse x)) (T (raiseR j (preLowerL j y)))+ + inner ℂ (raiseL j (preLowerR j x)) (T (inverse (inverse y)))+ + inner ℂ (raiseR j (preLowerL j x)) (T (inverse (inverse y)))) + +def crossPlus (j : Fin n) (x y : JointFock n) (T : JointFock n →L[ℂ] JointFock n) : ℂ := + inner ℂ (raiseL j (inverse x)) (T (raiseR j (inverse y)))+ + inner ℂ (raiseR j (inverse x)) (T (raiseL j (inverse y)))- + (2:ℂ)⁻¹*(inner ℂ (inverse (inverse x)) (T (lowerL j (preRaiseR j y)))+ + inner ℂ (inverse (inverse x)) (T (lowerR j (preRaiseL j y)))+ + inner ℂ (lowerL j (preRaiseR j x)) (T (inverse (inverse y)))+ + inner ℂ (lowerR j (preRaiseL j x)) (T (inverse (inverse y)))) + +theorem cross_heat_zero (j : Fin n) (x y : JointFock n) (Z : Fock n →L[ℂ] Fock n) : + crossMinus j x y (liftLeft Z)+crossPlus j x y (liftLeft Z)=0 := by + have h₁ := discarded_commutator j Z (inverse x) (preLowerL j y) + have h₂ := discarded_commutator_star j Z (preLowerL j x) (inverse y) + have h₃ := discarded_commutator_star j Z (inverse x) (preRaiseL j y) + have h₄ := discarded_commutator j Z (preRaiseL j x) (inverse y) + rw [inverse_preLowerL] at h₁ h₂ + rw [inverse_preRaiseL] at h₃ h₄ + unfold crossMinus crossPlus + simp only [← cross_lower_raise, cross_raise_lower] + rw [h₁, h₂, ← h₃, ← h₄] + ring + +theorem covariance_preLowerL (η : ℝ) (hη : η ∈ Set.Icc 0 1) (j : Fin n) (x : JointFock n) : + preLowerL j (beamUnitary η hη x)=(Real.sqrt η:ℂ) • beamUnitary η hη (preLowerL j x)+ + (Real.sqrt (1-η):ℂ) • beamUnitary η hη (preLowerR j x) := by + have hi : (1-inverse) (beamUnitary η hη x)=beamUnitary η hη ((1-inverse) x) := by + simp only [sub_apply,one_apply_eq_self,map_sub,covariance_inverse_apply] + simp only [preLowerL, preLowerR,ContinuousLinearMap.comp_apply] + rw [hi, covariance_lower_apply] + +theorem covariance_preLowerR (η : ℝ) (hη : η ∈ Set.Icc 0 1) (j : Fin n) (x : JointFock n) : + preLowerR j (beamUnitary η hη x)=-(Real.sqrt (1-η):ℂ) • beamUnitary η hη (preLowerL j x)+ + (Real.sqrt η:ℂ) • beamUnitary η hη (preLowerR j x) := by + have hi : (1-inverse) (beamUnitary η hη x)=beamUnitary η hη ((1-inverse) x) := by + simp only [sub_apply,one_apply_eq_self,map_sub,covariance_inverse_apply] + simp only [preLowerL, preLowerR,ContinuousLinearMap.comp_apply] + rw [hi, covariance_discarded_lower_apply] + +theorem covariance_preRaiseL (η : ℝ) (hη : η ∈ Set.Icc 0 1) (j : Fin n) (x : JointFock n) : + preRaiseL j (beamUnitary η hη x)=(Real.sqrt η:ℂ) • beamUnitary η hη (preRaiseL j x)+ + (Real.sqrt (1-η):ℂ) • beamUnitary η hη (preRaiseR j x) := by + have hi : (1+inverse) (beamUnitary η hη x)=beamUnitary η hη ((1+inverse) x) := by + simp only [add_apply,one_apply_eq_self,map_add,covariance_inverse_apply] + simp only [preRaiseL, preRaiseR,ContinuousLinearMap.comp_apply] + rw [hi, covariance_raise_apply] + +theorem covariance_preRaiseR (η : ℝ) (hη : η ∈ Set.Icc 0 1) (j : Fin n) (x : JointFock n) : + preRaiseR j (beamUnitary η hη x)=-(Real.sqrt (1-η):ℂ) • beamUnitary η hη (preRaiseL j x)+ + (Real.sqrt η:ℂ) • beamUnitary η hη (preRaiseR j x) := by + have hi : (1+inverse) (beamUnitary η hη x)=beamUnitary η hη ((1+inverse) x) := by + simp only [add_apply,one_apply_eq_self,map_add,covariance_inverse_apply] + simp only [preRaiseL, preRaiseR,ContinuousLinearMap.comp_apply] + rw [hi, covariance_discarded_raise_apply] + +theorem undo_rotation {E : Type*} [AddCommGroup E] [Module ℂ E] + (c s : ℂ) (hc : c^2+s^2=1) (X Y : E) : + c • (c • X+s • Y)-s • (-s • X+c • Y)=X ∧ + s • (c • X+s • Y)+c • (-s • X+c • Y)=Y := by + constructor + · calc + _=(c^2+s^2) • X := by module + _=X := by rw [hc,one_smul] + · calc + _=(c^2+s^2) • Y := by module + _=Y := by rw [hc,one_smul] + +theorem beam_squares (η : ℝ) (hη : η ∈ Set.Icc 0 1) : + (Real.sqrt η:ℂ)^2+(Real.sqrt (1-η):ℂ)^2=1 := by + norm_cast + rw [Real.sq_sqrt hη.1,Real.sq_sqrt (sub_nonneg.mpr hη.2)] + ring + +theorem undo_lowerL (η : ℝ) (hη : η ∈ Set.Icc 0 1) (j : Fin n) (x : JointFock n) : + beamUnitary η hη (lowerL j x)=(Real.sqrt η:ℂ) • lowerL j (beamUnitary η hη x)-(Real.sqrt (1-η):ℂ) • lowerR j (beamUnitary η hη x) := by + rw [covariance_lower_apply, covariance_discarded_lower_apply] + exact (undo_rotation _ _ (beam_squares η hη) _ _).1.symm + +theorem undo_lowerR (η : ℝ) (hη : η ∈ Set.Icc 0 1) (j : Fin n) (x : JointFock n) : + beamUnitary η hη (lowerR j x)=(Real.sqrt (1-η):ℂ) • lowerL j (beamUnitary η hη x)+(Real.sqrt η:ℂ) • lowerR j (beamUnitary η hη x) := by + rw [covariance_lower_apply, covariance_discarded_lower_apply] + exact (undo_rotation _ _ (beam_squares η hη) _ _).2.symm + +theorem undo_raiseL (η : ℝ) (hη : η ∈ Set.Icc 0 1) (j : Fin n) (x : JointFock n) : + beamUnitary η hη (raiseL j x)=(Real.sqrt η:ℂ) • raiseL j (beamUnitary η hη x)-(Real.sqrt (1-η):ℂ) • raiseR j (beamUnitary η hη x) := by + rw [covariance_raise_apply, covariance_discarded_raise_apply] + exact (undo_rotation _ _ (beam_squares η hη) _ _).1.symm + +theorem undo_raiseR (η : ℝ) (hη : η ∈ Set.Icc 0 1) (j : Fin n) (x : JointFock n) : + beamUnitary η hη (raiseR j x)=(Real.sqrt (1-η):ℂ) • raiseL j (beamUnitary η hη x)+(Real.sqrt η:ℂ) • raiseR j (beamUnitary η hη x) := by + rw [covariance_raise_apply, covariance_discarded_raise_apply] + exact (undo_rotation _ _ (beam_squares η hη) _ _).2.symm + +theorem undo_preLowerL (η : ℝ) (hη : η ∈ Set.Icc 0 1) (j : Fin n) (x : JointFock n) : + beamUnitary η hη (preLowerL j x)=(Real.sqrt η:ℂ) • preLowerL j (beamUnitary η hη x)-(Real.sqrt (1-η):ℂ) • preLowerR j (beamUnitary η hη x) := by + rw [covariance_preLowerL, covariance_preLowerR] + exact (undo_rotation _ _ (beam_squares η hη) _ _).1.symm + +theorem undo_preLowerR (η : ℝ) (hη : η ∈ Set.Icc 0 1) (j : Fin n) (x : JointFock n) : + beamUnitary η hη (preLowerR j x)=(Real.sqrt (1-η):ℂ) • preLowerL j (beamUnitary η hη x)+(Real.sqrt η:ℂ) • preLowerR j (beamUnitary η hη x) := by + rw [covariance_preLowerL, covariance_preLowerR] + exact (undo_rotation _ _ (beam_squares η hη) _ _).2.symm + +theorem undo_preRaiseL (η : ℝ) (hη : η ∈ Set.Icc 0 1) (j : Fin n) (x : JointFock n) : + beamUnitary η hη (preRaiseL j x)=(Real.sqrt η:ℂ) • preRaiseL j (beamUnitary η hη x)-(Real.sqrt (1-η):ℂ) • preRaiseR j (beamUnitary η hη x) := by + rw [covariance_preRaiseL, covariance_preRaiseR] + exact (undo_rotation _ _ (beam_squares η hη) _ _).1.symm + +theorem undo_preRaiseR (η : ℝ) (hη : η ∈ Set.Icc 0 1) (j : Fin n) (x : JointFock n) : + beamUnitary η hη (preRaiseR j x)=(Real.sqrt (1-η):ℂ) • preRaiseL j (beamUnitary η hη x)+(Real.sqrt η:ℂ) • preRaiseR j (beamUnitary η hη x) := by + rw [covariance_preRaiseL, covariance_preRaiseR] + exact (undo_rotation _ _ (beam_squares η hη) _ _).2.symm + +theorem expand_quadMinusL (η : ℝ) (hη : η ∈ Set.Icc 0 1) (j : Fin n) + (x y : JointFock n) (Z : Fock n →L[ℂ] Fock n) : + quadMinusL j x y (conjugate η hη Z)= + (Real.sqrt (η):ℂ)^2*quadMinusL j (beamUnitary η hη x) (beamUnitary η hη y) (liftLeft Z)+ + (Real.sqrt (1-η):ℂ)^2*quadMinusR j (beamUnitary η hη x) (beamUnitary η hη y) (liftLeft Z)- + (Real.sqrt η:ℂ)*(Real.sqrt (1-η):ℂ)*crossMinus j (beamUnitary η hη x) (beamUnitary η hη y) (liftLeft Z) := by + unfold quadMinusL quadMinusR crossMinus + simp only [conjugate_inner, undo_lowerL, undo_raiseL, undo_preLowerL, + ← covariance_inverse_apply] + simp only [map_sub, map_smul, inner_sub_left, inner_sub_right, + inner_smul_left, inner_smul_right, Complex.conj_ofReal] + ring + +theorem expand_quadMinusR (η : ℝ) (hη : η ∈ Set.Icc 0 1) (j : Fin n) + (x y : JointFock n) (Z : Fock n →L[ℂ] Fock n) : + quadMinusR j x y (conjugate η hη Z)= + (Real.sqrt (1-η):ℂ)^2*quadMinusL j (beamUnitary η hη x) (beamUnitary η hη y) (liftLeft Z)+ + (Real.sqrt (η):ℂ)^2*quadMinusR j (beamUnitary η hη x) (beamUnitary η hη y) (liftLeft Z)+ + (Real.sqrt η:ℂ)*(Real.sqrt (1-η):ℂ)*crossMinus j (beamUnitary η hη x) (beamUnitary η hη y) (liftLeft Z) := by + unfold quadMinusL quadMinusR crossMinus + simp only [conjugate_inner, undo_lowerR, undo_raiseR, undo_preLowerR, + ← covariance_inverse_apply] + simp only [map_add, map_smul, inner_add_left, inner_add_right, + inner_smul_left, inner_smul_right, Complex.conj_ofReal] + ring + +theorem expand_quadPlusL (η : ℝ) (hη : η ∈ Set.Icc 0 1) (j : Fin n) + (x y : JointFock n) (Z : Fock n →L[ℂ] Fock n) : + quadPlusL j x y (conjugate η hη Z)= + (Real.sqrt (η):ℂ)^2*quadPlusL j (beamUnitary η hη x) (beamUnitary η hη y) (liftLeft Z)+ + (Real.sqrt (1-η):ℂ)^2*quadPlusR j (beamUnitary η hη x) (beamUnitary η hη y) (liftLeft Z)- + (Real.sqrt η:ℂ)*(Real.sqrt (1-η):ℂ)*crossPlus j (beamUnitary η hη x) (beamUnitary η hη y) (liftLeft Z) := by + unfold quadPlusL quadPlusR crossPlus + simp only [conjugate_inner, undo_raiseL, undo_lowerL, undo_preRaiseL, + ← covariance_inverse_apply] + simp only [map_sub, map_smul, inner_sub_left, inner_sub_right, + inner_smul_left, inner_smul_right, Complex.conj_ofReal] + ring + +theorem expand_quadPlusR (η : ℝ) (hη : η ∈ Set.Icc 0 1) (j : Fin n) + (x y : JointFock n) (Z : Fock n →L[ℂ] Fock n) : + quadPlusR j x y (conjugate η hη Z)= + (Real.sqrt (1-η):ℂ)^2*quadPlusL j (beamUnitary η hη x) (beamUnitary η hη y) (liftLeft Z)+ + (Real.sqrt (η):ℂ)^2*quadPlusR j (beamUnitary η hη x) (beamUnitary η hη y) (liftLeft Z)+ + (Real.sqrt η:ℂ)*(Real.sqrt (1-η):ℂ)*crossPlus j (beamUnitary η hη x) (beamUnitary η hη y) (liftLeft Z) := by + unfold quadPlusL quadPlusR crossPlus + simp only [conjugate_inner, undo_raiseR, undo_lowerR, undo_preRaiseR, + ← covariance_inverse_apply] + simp only [map_add, map_smul, inner_add_left, inner_add_right, + inner_smul_left, inner_smul_right, Complex.conj_ofReal] + ring + +theorem generator_covariance (η a b : ℝ) (hη : η ∈ Set.Icc 0 1) (j : Fin n) + (x y : JointFock n) (Z : Fock n →L[ℂ] Fock n) : + ((η*a+(1-η)*b:ℝ)+1:ℂ)*quadMinusL j (beamUnitary η hη x) (beamUnitary η hη y) (liftLeft Z)+ + (η*a+(1-η)*b:ℂ)*quadPlusL j (beamUnitary η hη x) (beamUnitary η hη y) (liftLeft Z)= + (a+1:ℂ)*quadMinusL j x y (conjugate η hη Z)+(a:ℂ)*quadPlusL j x y (conjugate η hη Z)+ + (b+1:ℂ)*quadMinusR j x y (conjugate η hη Z)+(b:ℂ)*quadPlusR j x y (conjugate η hη Z) := by + rw [expand_quadMinusL,expand_quadPlusL,expand_quadMinusR,expand_quadPlusR, + quadMinusR_zero,quadPlusR_zero] + have hc : (Real.sqrt η:ℂ)^2=(η:ℂ) := by exact_mod_cast Real.sq_sqrt hη.1 + have hs : (Real.sqrt (1-η):ℂ)^2=(1-η:ℂ) := by exact_mod_cast Real.sq_sqrt (sub_nonneg.mpr hη.2) + rw [hc,hs] + push_cast + have hh := cross_heat_zero j (beamUnitary η hη x) (beamUnitary η hη y) Z + linear_combination (Real.sqrt η:ℂ)*(Real.sqrt (1-η):ℂ)*(a-b)*hh + +theorem numberL_minus (j : Fin n) (x : JointFock n) (k e : NumberIndex n) : + raiseL j (preLowerL j x) (k,e)=(k j:ℂ)*inverse (inverse x) (k,e) := by + by_cases hk : k j=0 + · rw [raiseL_zero j _ (k,e) hk, hk, Nat.cast_zero,zero_mul] + · obtain ⟨a,rfl⟩ : ∃ a,k=up j a := ⟨down j k,(up_down j k (Nat.pos_of_ne_zero hk)).symm⟩ + change raiseL j (preLowerL j x) (upL j (a,e))=(up j a j:ℂ)*inverse (inverse x) (upL j (a,e)) + rw [raiseL_up] + have hw : (W (a,e):ℂ)≠0 := by exact_mod_cast (by linarith [W_one_le (a,e)] : W (a,e)≠0) + have hu : (W (a,e):ℂ)+1≠0 := by exact_mod_cast (by linarith [W_one_le (a,e)] : W (a,e)+1≠0) + have hs : (Real.sqrt ((a j:ℝ)+1):ℂ)^2=((a j:ℝ)+1:ℂ) := by exact_mod_cast Real.sq_sqrt (by positivity : 0≤(a j:ℝ)+1) + simp only [preLowerL,ContinuousLinearMap.comp_apply,lowerL_apply,sub_apply,one_apply_eq_self, + lp.coeFn_sub,Pi.sub_apply,inverse_apply,up_same,W_upL] + push_cast + field_simp + linear_combination x (upL j (a,e))*(W (a,e):ℂ)*hs + +theorem numberL_plus (j : Fin n) (x : JointFock n) (k e : NumberIndex n) : + lowerL j (preRaiseL j x) (k,e)=(k j+1:ℂ)*inverse (inverse x) (k,e) := by + rw [lowerL_apply] + change _*raiseL j ((1+inverse) x) (upL j (k,e))=_ + rw [raiseL_up] + have hw : (W (k,e):ℂ)≠0 := by exact_mod_cast (by linarith [W_one_le (k,e)] : W (k,e)≠0) + have hu : (W (k,e):ℂ)+1≠0 := by exact_mod_cast (by linarith [W_one_le (k,e)] : W (k,e)+1≠0) + have hs : (Real.sqrt ((k j:ℝ)+1):ℂ)^2=((k j:ℝ)+1:ℂ) := by exact_mod_cast Real.sq_sqrt (by positivity : 0≤(k j:ℝ)+1) + simp only [add_apply,one_apply_eq_self,lp.coeFn_add,Pi.add_apply,inverse_apply] + push_cast + field_simp + linear_combination x (k,e)*hs + +theorem numberR_minus (j : Fin n) (x : JointFock n) (e k : NumberIndex n) : + raiseR j (preLowerR j x) (k,e)=(e j:ℂ)*inverse (inverse x) (k,e) := by + by_cases hk : e j=0 + · rw [raiseR_zero j _ (k,e) hk, hk, Nat.cast_zero,zero_mul] + · obtain ⟨a,rfl⟩ : ∃ a,e=up j a := ⟨down j e,(up_down j e (Nat.pos_of_ne_zero hk)).symm⟩ + change raiseR j (preLowerR j x) (upR j (k,a))=(up j a j:ℂ)*inverse (inverse x) (upR j (k,a)) + rw [raiseR_up] + have hw : (W (k,a):ℂ)≠0 := by exact_mod_cast (by linarith [W_one_le (k,a)] : W (k,a)≠0) + have hu : (W (k,a):ℂ)+1≠0 := by exact_mod_cast (by linarith [W_one_le (k,a)] : W (k,a)+1≠0) + have hs : (Real.sqrt ((a j:ℝ)+1):ℂ)^2=((a j:ℝ)+1:ℂ) := by exact_mod_cast Real.sq_sqrt (by positivity : 0≤(a j:ℝ)+1) + simp only [preLowerR,ContinuousLinearMap.comp_apply,lowerR_apply,sub_apply,one_apply_eq_self, + lp.coeFn_sub,Pi.sub_apply,inverse_apply,up_same,W_upR] + push_cast + field_simp + linear_combination x (upR j (k,a))*(W (k,a):ℂ)*hs + +theorem numberR_plus (j : Fin n) (x : JointFock n) (e k : NumberIndex n) : + lowerR j (preRaiseR j x) (k,e)=(e j+1:ℂ)*inverse (inverse x) (k,e) := by + rw [lowerR_apply] + change _*raiseR j ((1+inverse) x) (upR j (k,e))=_ + rw [raiseR_up] + have hw : (W (k,e):ℂ)≠0 := by exact_mod_cast (by linarith [W_one_le (k,e)] : W (k,e)≠0) + have hu : (W (k,e):ℂ)+1≠0 := by exact_mod_cast (by linarith [W_one_le (k,e)] : W (k,e)+1≠0) + have hs : (Real.sqrt ((e j:ℝ)+1):ℂ)^2=((e j:ℝ)+1:ℂ) := by exact_mod_cast Real.sq_sqrt (by positivity : 0≤(e j:ℝ)+1) + simp only [add_apply,one_apply_eq_self,lp.coeFn_add,Pi.add_apply,inverse_apply] + push_cast + field_simp + linear_combination x (k,e)*hs + +end + +section +open EntropyPhotonNumber QuantumTrace Annihilation TensorLp +variable {n : ℕ} + +def tensorPreimage2 (x y : Fock n) : JointFock n := + tensor (inverseWeight 1 x) (inverseWeight 3 y)+ + tensor (inverseWeight 3 x) (inverseWeight 1 y)+ + tensor (inverseWeight 3 x) (inverseWeight 3 y)+ + (2:ℂ) • tensor (inverseWeight 2 x) (inverseWeight 2 y)- + (2:ℂ) • tensor (inverseWeight 2 x) (inverseWeight 3 y)- + (2:ℂ) • tensor (inverseWeight 3 x) (inverseWeight 2 y) + +theorem tensorPreimage2_apply (x y : Fock n) (k e : NumberIndex n) : + tensorPreimage2 x y (k,e)=(W (k,e):ℂ)^2*inverseWeight 3 x k*inverseWeight 3 y e := by + have hk : (numberWeight k:ℂ)≠0 := by exact_mod_cast (by linarith [numberWeight_one_le k] : numberWeight k≠0) + have he : (numberWeight e:ℂ)≠0 := by exact_mod_cast (by linarith [numberWeight_one_le e] : numberWeight e≠0) + simp only [tensorPreimage2,lp.coeFn_sub,lp.coeFn_add,lp.coeFn_smul,Pi.sub_apply, + Pi.add_apply,Pi.smul_apply,smul_eq_mul,tensor_apply,inverseWeight_apply,W,pow_one] + push_cast + field_simp + ring + +theorem tensorPreimage2_inverse (x y : Fock n) : + inverse (tensorPreimage2 x y)=tensorPreimage x y := by + apply lp.ext + funext ke + obtain ⟨k,e⟩ := ke + rw [inverse_apply,tensorPreimage2_apply,tensorPreimage_apply] + have hw : (W (k,e):ℂ)≠0 := by exact_mod_cast (by linarith [W_one_le (k,e)] : W (k,e)≠0) + field_simp + +theorem square_smul_summable {I E : Type*} [NormedAddCommGroup E] [NormedSpace ℂ E] + {x : I → E} (hx : Summable (fun i => ‖x i‖^2)) (c : ℂ) : + Summable (fun i => ‖c • x i‖^2) := by + simpa only [norm_smul,mul_pow] using hx.mul_left (‖c‖^2) + +theorem tensorPreimage2_summable {I J : Type*} (x : I → Fock n) (y : J → Fock n) + (hx : Summable (fun i => ‖x i‖^2)) (hy : Summable (fun j => ‖y j‖^2)) : + Summable (fun ij : I × J => ‖tensorPreimage2 (x ij.1) (y ij.2)‖^2) := by + have ht (a b : ℕ) : Summable (fun ij : I × J => ‖tensor (inverseWeight a (x ij.1)) (inverseWeight b (y ij.2))‖^2) := by + simpa only [tensor_norm_sq] using + (CrossEnsemble.applied_summable hx (inverseWeight a)).mul_of_nonneg + (CrossEnsemble.applied_summable hy (inverseWeight b)) (fun _ => sq_nonneg _) (fun _ => sq_nonneg _) + have hs a b := square_smul_summable (ht a b) (2:ℂ) + have hn a b : Summable (fun ij : I × J => ‖-((2:ℂ) • tensor (inverseWeight a (x ij.1)) (inverseWeight b (y ij.2)))‖^2) := by + simpa only [norm_neg] using hs a b + simpa only [tensorPreimage2,sub_eq_add_neg] using + square_add_summable (square_add_summable + (square_add_summable (square_add_summable (square_add_summable (ht 1 3) (ht 3 1)) + (ht 3 3)) (hs 2 2)) (hn 2 3)) (hn 3 2) + +end + +section +open EntropyPhotonNumber QuantumTrace Annihilation TensorLp +open scoped ComplexConjugate +variable {n : ℕ} {I J : Type*} + +theorem dissipator_summable (x y : I → JointFock n) + (hx : Summable (fun i => ‖x i‖^2)) (hy : Summable (fun i => ‖y i‖^2)) + (A B C Z : JointFock n →L[ℂ] JointFock n) : + Summable (fun i => inner ℂ (A (x i)) (Z (A (y i)))- + (2:ℂ)⁻¹*(inner ℂ (B (x i)) (Z (C (y i)))+ + inner ℂ (C (x i)) (Z (B (y i))))) := by + have ha := CrossEnsemble.pairing_summable + (CrossEnsemble.applied_summable hy A) (CrossEnsemble.applied_summable hx A) Z + have hb := CrossEnsemble.pairing_summable + (CrossEnsemble.applied_summable hy C) (CrossEnsemble.applied_summable hx B) Z + have hc := CrossEnsemble.pairing_summable + (CrossEnsemble.applied_summable hy B) (CrossEnsemble.applied_summable hx C) Z + exact ha.sub ((hb.add hc).mul_left (2:ℂ)⁻¹) + +theorem quadMinusL_summable (j : Fin n) (x y : I → JointFock n) + (hx : Summable (fun i => ‖x i‖^2)) (hy : Summable (fun i => ‖y i‖^2)) + (Z : JointFock n →L[ℂ] JointFock n) : + Summable (fun i => quadMinusL j (x i) (y i) Z) := + dissipator_summable x y hx hy (lowerL j ∘L inverse) (inverse ∘L inverse) (raiseL j ∘L preLowerL j) Z + +theorem quadPlusL_summable (j : Fin n) (x y : I → JointFock n) + (hx : Summable (fun i => ‖x i‖^2)) (hy : Summable (fun i => ‖y i‖^2)) + (Z : JointFock n →L[ℂ] JointFock n) : + Summable (fun i => quadPlusL j (x i) (y i) Z) := + dissipator_summable x y hx hy (raiseL j ∘L inverse) (inverse ∘L inverse) (lowerL j ∘L preRaiseL j) Z + +theorem quadMinusR_summable (j : Fin n) (x y : I → JointFock n) + (hx : Summable (fun i => ‖x i‖^2)) (hy : Summable (fun i => ‖y i‖^2)) + (Z : JointFock n →L[ℂ] JointFock n) : + Summable (fun i => quadMinusR j (x i) (y i) Z) := + dissipator_summable x y hx hy (lowerR j ∘L inverse) (inverse ∘L inverse) (raiseR j ∘L preLowerR j) Z + +theorem quadPlusR_summable (j : Fin n) (x y : I → JointFock n) + (hx : Summable (fun i => ‖x i‖^2)) (hy : Summable (fun i => ‖y i‖^2)) + (Z : JointFock n →L[ℂ] JointFock n) : + Summable (fun i => quadPlusR j (x i) (y i) Z) := + dissipator_summable x y hx hy (raiseR j ∘L inverse) (inverse ∘L inverse) (lowerR j ∘L preRaiseR j) Z + +def generatorPairingL (r : ℝ) (x y : I → JointFock n) + (Z : JointFock n →L[ℂ] JointFock n) : ℂ := + ∑ j, (((r+1:ℝ):ℂ)*(∑' i, quadMinusL j (x i) (y i) Z)+ + (r:ℂ)*(∑' i, quadPlusL j (x i) (y i) Z)) +def generatorPairingR (r : ℝ) (x y : I → JointFock n) + (Z : JointFock n →L[ℂ] JointFock n) : ℂ := + ∑ j, (((r+1:ℝ):ℂ)*(∑' i, quadMinusR j (x i) (y i) Z)+ + (r:ℂ)*(∑' i, quadPlusR j (x i) (y i) Z)) + +theorem generatorPairing_covariance (η a b : ℝ) (hη : η ∈ Set.Icc 0 1) + (x y : I → JointFock n) (hx : Summable (fun i => ‖x i‖^2)) + (hy : Summable (fun i => ‖y i‖^2)) (Z : Fock n →L[ℂ] Fock n) : + generatorPairingL (η*a+(1-η)*b) + (fun i => beamUnitary η hη (x i)) (fun i => beamUnitary η hη (y i)) (liftLeft Z)= + generatorPairingL a x y (conjugate η hη Z)+generatorPairingR b x y (conjugate η hη Z) := by + have hx' := CrossEnsemble.applied_summable hx (beamUnitary η hη).toContinuousLinearEquiv.toContinuousLinearMap + have hy' := CrossEnsemble.applied_summable hy (beamUnitary η hη).toContinuousLinearEquiv.toContinuousLinearMap + change Summable (fun i => ‖beamUnitary η hη (x i)‖^2) at hx' + change Summable (fun i => ‖beamUnitary η hη (y i)‖^2) at hy' + unfold generatorPairingL generatorPairingR + rw [← Finset.sum_add_distrib] + apply Finset.sum_congr rfl + intro j _ + have h1 := quadMinusL_summable j x y hx hy (conjugate η hη Z) + have h2 := quadPlusL_summable j x y hx hy (conjugate η hη Z) + have h3 := quadMinusR_summable j x y hx hy (conjugate η hη Z) + have h4 := quadPlusR_summable j x y hx hy (conjugate η hη Z) + have h5 := quadMinusL_summable j _ _ hx' hy' (liftLeft Z) + have h6 := quadPlusL_summable j _ _ hx' hy' (liftLeft Z) + have hh := congrArg (fun f : I → ℂ => ∑' i, f i) + (funext (fun i => generator_covariance η a b hη j (x i) (y i) Z)) + have hl := (h5.mul_left ((η*a+(1-η)*b:ℝ)+1:ℂ)).tsum_add + (h6.mul_left ((η:ℂ)*a+(1-(η:ℂ))*b)) + have hr := (((h1.mul_left ((a:ℂ)+1)).add (h2.mul_left (a:ℂ))).add + (h3.mul_left ((b:ℂ)+1))).tsum_add (h4.mul_left (b:ℂ)) + rw [hl,hr,((h1.mul_left ((a:ℂ)+1)).add (h2.mul_left (a:ℂ))).tsum_add + (h3.mul_left ((b:ℂ)+1)),(h1.mul_left ((a:ℂ)+1)).tsum_add (h2.mul_left (a:ℂ))] at hh + simp only [tsum_mul_left] at hh + convert hh using 1 <;> push_cast <;> ring + +end + +open EntropyPhotonNumber QuantumTrace Annihilation TensorLp +open scoped BigOperators +variable {n : ℕ} {I J : Type*} + +theorem tensorPreimage2_numberL_minus (j : Fin n) (x y : Fock n) : + raiseL j (preLowerL j (tensorPreimage2 x y))= + tensor (inverseWeight 2 (modeBound j false x)) (inverseWeight 3 y) := by + apply lp.ext + funext ke + obtain ⟨k,e⟩ := ke + rw [numberL_minus,tensorPreimage2_inverse,tensorPreimage_inverse,tensor_apply,tensor_apply] + have hk : (numberWeight k:ℂ)≠0 := by exact_mod_cast (by linarith [numberWeight_one_le k] : numberWeight k≠0) + simp only [inverseWeight_apply,modeBound_apply,Bool.false_eq_true,↓reduceIte,add_zero] + push_cast + field_simp + +theorem tensorPreimage2_numberL_plus (j : Fin n) (x y : Fock n) : + lowerL j (preRaiseL j (tensorPreimage2 x y))= + tensor (inverseWeight 2 (modeBound j true x)) (inverseWeight 3 y) := by + apply lp.ext + funext ke + obtain ⟨k,e⟩ := ke + rw [numberL_plus,tensorPreimage2_inverse,tensorPreimage_inverse,tensor_apply,tensor_apply] + have hk : (numberWeight k:ℂ)≠0 := by exact_mod_cast (by linarith [numberWeight_one_le k] : numberWeight k≠0) + simp only [inverseWeight_apply,modeBound_apply,↓reduceIte] + push_cast + field_simp + +theorem tensorPreimage2_numberR_minus (j : Fin n) (x y : Fock n) : + raiseR j (preLowerR j (tensorPreimage2 x y))= + tensor (inverseWeight 3 x) (inverseWeight 2 (modeBound j false y)) := by + apply lp.ext + funext ke + obtain ⟨k,e⟩ := ke + rw [numberR_minus,tensorPreimage2_inverse,tensorPreimage_inverse,tensor_apply,tensor_apply] + have he : (numberWeight e:ℂ)≠0 := by exact_mod_cast (by linarith [numberWeight_one_le e] : numberWeight e≠0) + simp only [inverseWeight_apply,modeBound_apply,Bool.false_eq_true,↓reduceIte,add_zero] + push_cast + field_simp + +theorem tensorPreimage2_numberR_plus (j : Fin n) (x y : Fock n) : + lowerR j (preRaiseR j (tensorPreimage2 x y))= + tensor (inverseWeight 3 x) (inverseWeight 2 (modeBound j true y)) := by + apply lp.ext + funext ke + obtain ⟨k,e⟩ := ke + rw [numberR_plus,tensorPreimage2_inverse,tensorPreimage_inverse,tensor_apply,tensor_apply] + have he : (numberWeight e:ℂ)≠0 := by exact_mod_cast (by linarith [numberWeight_one_le e] : numberWeight e≠0) + simp only [inverseWeight_apply,modeBound_apply,↓reduceIte] + push_cast + field_simp + +def singleGeneratorPairing (r : ℝ) (x : I → Fock n) (Z : Fock n →L[ℂ] Fock n) : ℂ := + ∑ j, (((r+1:ℝ):ℂ)*(CrossEnsemble.pairing + (fun i => sandwich 0 3 (by omega) j (x i)) (fun i => sandwich 0 3 (by omega) j (x i)) Z- + (2:ℂ)⁻¹*(CrossEnsemble.pairing (fun i => inverseWeight 2 (modeBound j false (x i))) (fun i => inverseWeight 3 (x i)) Z+ + CrossEnsemble.pairing (fun i => inverseWeight 3 (x i)) (fun i => inverseWeight 2 (modeBound j false (x i))) Z))+ + (r:ℂ)*(CrossEnsemble.pairing + (fun i => creationSandwich 0 3 (by omega) j (x i)) (fun i => creationSandwich 0 3 (by omega) j (x i)) Z- + (2:ℂ)⁻¹*(CrossEnsemble.pairing (fun i => inverseWeight 2 (modeBound j true (x i))) (fun i => inverseWeight 3 (x i)) Z+ + CrossEnsemble.pairing (fun i => inverseWeight 3 (x i)) (fun i => inverseWeight 2 (modeBound j true (x i))) Z))) + +theorem generatorPairingL_product (r : ℝ) (x : I → Fock n) (y : J → Fock n) + (hx : Summable (fun i => ‖x i‖^2)) (hy : Summable (fun j => ‖y j‖^2)) + (hyn : HasSum (fun j => ‖inverseWeight 3 (y j)‖^2) 1) + (Z : JointFock n →L[ℂ] JointFock n) : + generatorPairingL r (fun ij : I × J => tensorPreimage2 (x ij.1) (y ij.2)) + (fun ij : I × J => tensorPreimage2 (x ij.1) (y ij.2)) Z= + singleGeneratorPairing r x (conditionalLeft (fun j => inverseWeight 3 (y j)) hyn Z) := by + have hp := tensorPreimage2_summable x y hx hy + have hi := CrossEnsemble.applied_summable hx (inverseWeight 3) + have hm (j : Fin n) (u : Bool) := CrossEnsemble.applied_summable hx (inverseWeight 2 ∘L modeBound j u) + have hl (j : Fin n) := CrossEnsemble.applied_summable hx (sandwich 0 3 (by omega) j) + have hr (j : Fin n) := CrossEnsemble.applied_summable hx (creationSandwich 0 3 (by omega) j) + unfold generatorPairingL singleGeneratorPairing + apply Finset.sum_congr rfl + intro j _ + have hts (u v : I → Fock n) (hu : Summable (fun i => ‖u i‖^2)) + (hv : Summable (fun i => ‖v i‖^2)) := + pairing_conditionalLeft u v (fun j => inverseWeight 3 (y j)) hu hv hyn Z + have h1 := hts _ _ (hl j) (hl j) + have h2 := hts _ _ (hm j false) hi + have h3 := hts _ _ hi (hm j false) + have h4 := hts _ _ (hr j) (hr j) + have h5 := hts _ _ (hm j true) hi + have h6 := hts _ _ hi (hm j true) + unfold quadMinusL quadPlusL + simp only [tensorPreimage2_inverse,tensorPreimage_inverse,tensorPreimage_lowerL, + tensorPreimage_raiseL,tensorPreimage2_numberL_minus,tensorPreimage2_numberL_plus] + have hA := CrossEnsemble.pairing_summable + (CrossEnsemble.applied_summable hp (lowerL j ∘L inverse)) + (CrossEnsemble.applied_summable hp (lowerL j ∘L inverse)) Z + have hB := CrossEnsemble.pairing_summable + (CrossEnsemble.applied_summable hp (raiseL j ∘L preLowerL j)) + (CrossEnsemble.applied_summable hp (inverse ∘L inverse)) Z + have hC := CrossEnsemble.pairing_summable + (CrossEnsemble.applied_summable hp (inverse ∘L inverse)) + (CrossEnsemble.applied_summable hp (raiseL j ∘L preLowerL j)) Z + have hD := CrossEnsemble.pairing_summable + (CrossEnsemble.applied_summable hp (raiseL j ∘L inverse)) + (CrossEnsemble.applied_summable hp (raiseL j ∘L inverse)) Z + have hE := CrossEnsemble.pairing_summable + (CrossEnsemble.applied_summable hp (lowerL j ∘L preRaiseL j)) + (CrossEnsemble.applied_summable hp (inverse ∘L inverse)) Z + have hF := CrossEnsemble.pairing_summable + (CrossEnsemble.applied_summable hp (inverse ∘L inverse)) + (CrossEnsemble.applied_summable hp (lowerL j ∘L preRaiseL j)) Z + simp only [ContinuousLinearMap.comp_apply,tensorPreimage2_inverse,tensorPreimage_inverse, + tensorPreimage_lowerL,tensorPreimage_raiseL,tensorPreimage2_numberL_minus,tensorPreimage2_numberL_plus] at hA hB hC hD hE hF + rw [hA.tsum_sub ((hB.add hC).mul_left _), hD.tsum_sub ((hE.add hF).mul_left _), + tsum_mul_left,tsum_mul_left,hB.tsum_add hC,hE.tsum_add hF] + simpa only [CrossEnsemble.pairing, ContinuousLinearMap.comp_apply] using congrArg₂ HAdd.hAdd + (congrArg (fun z : ℂ => ((r+1:ℝ):ℂ)*z) (congrArg₂ HSub.hSub h1 (congrArg (fun z : ℂ => (2:ℂ)⁻¹*z) (congrArg₂ HAdd.hAdd h2 h3)))) + (congrArg (fun z : ℂ => (r:ℂ)*z) (congrArg₂ HSub.hSub h4 (congrArg (fun z : ℂ => (2:ℂ)⁻¹*z) (congrArg₂ HAdd.hAdd h5 h6)))) +end BeamLadder + +namespace CrossEnsemble +open EntropyPhotonNumber +open scoped ComplexConjugate +variable {n : ℕ} {I J : Type*} + +theorem shifted_both_operator_eq (x y : I → Fock n) (u v : J → Fock n) + (hx : Summable (fun i => ‖x i‖^2)) (hy : Summable (fun i => ‖y i‖^2)) + (hu : Summable (fun j => ‖u j‖^2)) (hv : Summable (fun j => ‖v j‖^2)) + (f : NumberIndex n → NumberIndex n) (c : NumberIndex n → ℂ) + (hyx : ∀ i k, y i k=c k*x i (f k)) (hvu : ∀ j k, v j k=c k*u j (f k)) + (he : operator x x=operator u u) : operator y y=operator v v := by + apply entry_ext + intro a b + have h₁ := ((coordinate_hasSum x x hx hx (f a) (f b)).mul_left (c a)).mul_right (conj (c b)) + have h₂ := ((coordinate_hasSum u u hu hu (f a) (f b)).mul_left (c a)).mul_right (conj (c b)) + have he₁ : entry (operator y y) a b=c a*entry (operator x x) (f a) (f b)*conj (c b) := by + apply (coordinate_hasSum y y hy hy a b).unique + convert! h₁ using 1 + ext i + rw [hyx,hyx,map_mul] + ring + have he₂ : entry (operator v v) a b=c a*entry (operator u u) (f a) (f b)*conj (c b) := by + apply (coordinate_hasSum v v hv hv a b).unique + convert! h₂ using 1 + ext i + rw [hvu,hvu,map_mul] + ring + rw [he₁,he₂,he] +end CrossEnsemble + +namespace BeamLadder + +section +open EntropyPhotonNumber QuantumTrace Annihilation TensorLp +open scoped ComplexConjugate +variable {n : ℕ} + +theorem lowerL_second_inverse_apply (j : Fin n) (x : JointFock n) (k e : NumberIndex n) : + lowerL j (inverse x) (k,e)=(Real.sqrt ((k j:ℝ)+1):ℂ)*inverse (inverse x) (up j k,e) := by + exact lowerL_inverse_apply j (inverse x) k e + +theorem raiseL_second_inverse_apply (j : Fin n) (x : JointFock n) (k e : NumberIndex n) : + raiseL j (inverse x) (k,e)= + (if k j=0 then (0:ℂ) else (Real.sqrt (k j:ℝ):ℂ))*inverse (inverse x) (down j k,e) := by + by_cases hk : k j=0 + · rw [raiseL_zero j _ (k,e) hk,ite_eq_left hk,zero_mul] + · rw [ite_eq_right hk] + obtain ⟨a,rfl⟩ : ∃ a,k=up j a := ⟨down j k,(up_down j k (Nat.pos_of_ne_zero hk)).symm⟩ + change raiseL j (inverse x) (upL j (a,e))=_ + rw [raiseL_up,down_up,up_same] + have hw : (W (a,e):ℂ)≠0 := by exact_mod_cast (by linarith [W_one_le (a,e)] : W (a,e)≠0) + simp only [inverse_apply] + push_cast + field_simp + +theorem single_lower_third_apply (j : Fin n) (x : Fock n) (k : NumberIndex n) : + sandwich 0 3 (by omega) j x k= + (Real.sqrt ((k j:ℝ)+1):ℂ)*inverseWeight 3 x (up j k) := by + simp only [sandwich_apply,coefficient,inverseWeight_apply,pow_zero,one_mul] + push_cast + ring + +theorem single_raise_third_apply (j : Fin n) (x : Fock n) (k : NumberIndex n) : + creationSandwich 0 3 (by omega) j x k= + (if k j=0 then (0:ℂ) else (Real.sqrt (k j:ℝ):ℂ))*inverseWeight 3 x (down j k) := by + by_cases hk : k j=0 + · rw [creationSandwich_zero _ _ _ _ _ k hk,ite_eq_left hk,zero_mul] + · rw [ite_eq_right hk] + obtain ⟨a,rfl⟩ : ∃ a,k=up j a := ⟨down j k,(up_down j k (Nat.pos_of_ne_zero hk)).symm⟩ + rw [creationSandwich_up,down_up,up_same] + simp only [creationCoefficient,inverseWeight_apply,pow_zero,one_mul] + push_cast + ring + +theorem single_number_third_apply (j : Fin n) (u : Bool) (x : Fock n) (k : NumberIndex n) : + inverseWeight 2 (modeBound j u x) k= + ((k j:ℂ)+(if u then 1 else 0))*inverseWeight 3 x k := by + have hk : (numberWeight k:ℂ)≠0 := by exact_mod_cast (by linarith [numberWeight_one_le k] : numberWeight k≠0) + simp only [inverseWeight_apply,modeBound_apply] + push_cast + cases u <;> simp only [Bool.false_eq_true,↓reduceIte,add_zero] <;> field_simp <;> push_cast <;> ring + +end + +section +open EntropyPhotonNumber QuantumTrace Annihilation TensorLp +open scoped ComplexConjugate +variable {n : ℕ} {I J : Type*} + +theorem slice_dissipator (x y z : I → JointFock n) (u v w : J → Fock n) + (hx : Summable (fun i => ‖x i‖^2)) (hy : Summable (fun i => ‖y i‖^2)) + (hz : Summable (fun i => ‖z i‖^2)) (hu : Summable (fun k => ‖u k‖^2)) + (hv : Summable (fun k => ‖v k‖^2)) (hw : Summable (fun k => ‖w k‖^2)) + (f g : NumberIndex n → NumberIndex n) (c d : NumberIndex n → ℂ) + (hyx : ∀ i k e, y i (k,e)=c k*x i (f k,e)) + (hzx : ∀ i k e, z i (k,e)=d k*x i (g k,e)) + (hvu : ∀ i k, v i k=c k*u i (f k)) (hwu : ∀ i k, w i k=d k*u i (g k)) + (he : CrossEnsemble.operator (fun ie : I × NumberIndex n => slice (x ie.1) ie.2) + (fun ie : I × NumberIndex n => slice (x ie.1) ie.2)=CrossEnsemble.operator u u) + (Z : Fock n →L[ℂ] Fock n) : + (∑' i, (inner ℂ (y i) (liftLeft Z (y i))- + (2:ℂ)⁻¹*(inner ℂ (x i) (liftLeft Z (z i))+inner ℂ (z i) (liftLeft Z (x i)))))= + CrossEnsemble.pairing v v Z-(2:ℂ)⁻¹*(CrossEnsemble.pairing w u Z+CrossEnsemble.pairing u w Z) := by + have hxs := slice_family_summable x hx + have hys := slice_family_summable y hy + have hzs := slice_family_summable z hz + have h1 := CrossEnsemble.shifted_both_operator_eq _ _ _ _ hxs hys hu hv f c + (fun ie k => hyx ie.1 k ie.2) hvu he + have h2 := CrossEnsemble.shifted_left_operator_eq _ _ _ _ hxs hzs hu hw g d + (fun ie k => hzx ie.1 k ie.2) hwu he + have h3 := CrossEnsemble.shifted_right_operator_eq _ _ _ _ hxs hzs hu hw g d + (fun ie k => hzx ie.1 k ie.2) hwu he + let bas : HilbertBasis (NumberIndex n) ℂ (Fock n) := HilbertBasis.ofRepr (LinearIsometryEquiv.refl ℂ _) + have hp1 := CrossEnsemble.pairing_eq_of_operator_eq bas hys hys hv hv h1 Z + have hp2 := CrossEnsemble.pairing_eq_of_operator_eq bas hzs hxs hw hu h2 Z + have hp3 := CrossEnsemble.pairing_eq_of_operator_eq bas hxs hzs hu hw h3 Z + rw [(CrossEnsemble.pairing_summable hy hy (liftLeft Z)).tsum_sub + (((CrossEnsemble.pairing_summable hz hx (liftLeft Z)).add + (CrossEnsemble.pairing_summable hx hz (liftLeft Z))).mul_left _),tsum_mul_left, + (CrossEnsemble.pairing_summable hz hx (liftLeft Z)).tsum_add + (CrossEnsemble.pairing_summable hx hz (liftLeft Z))] + change CrossEnsemble.pairing y y (liftLeft Z)-(2:ℂ)⁻¹* + (CrossEnsemble.pairing z x (liftLeft Z)+CrossEnsemble.pairing x z (liftLeft Z))=_ + rw [pairing_liftLeft _ _ hy hy,pairing_liftLeft _ _ hz hx,pairing_liftLeft _ _ hx hz,hp1,hp2,hp3] + +theorem output_generator (r : ℝ) (x : I → JointFock n) (z : J → Fock n) + (hx : Summable (fun i => ‖x i‖^2)) (hz : Summable (fun j => ‖z j‖^2)) + (he : CrossEnsemble.operator + (fun ie : I × NumberIndex n => slice (inverse (inverse (x ie.1))) ie.2) + (fun ie : I × NumberIndex n => slice (inverse (inverse (x ie.1))) ie.2)= + CrossEnsemble.operator (fun j => inverseWeight 3 (z j)) (fun j => inverseWeight 3 (z j))) + (Z : Fock n →L[ℂ] Fock n) : + generatorPairingL r x x (liftLeft Z)=singleGeneratorPairing r z Z := by + unfold generatorPairingL singleGeneratorPairing + apply Finset.sum_congr rfl + intro j _ + have hi := CrossEnsemble.applied_summable hx (inverse ∘L inverse) + have hl := CrossEnsemble.applied_summable hx (lowerL j ∘L inverse) + have hr := CrossEnsemble.applied_summable hx (raiseL j ∘L inverse) + have hm := CrossEnsemble.applied_summable hx (raiseL j ∘L preLowerL j) + have hn := CrossEnsemble.applied_summable hx (lowerL j ∘L preRaiseL j) + have hzi := CrossEnsemble.applied_summable hz (inverseWeight 3) + have hzl := CrossEnsemble.applied_summable hz (sandwich 0 3 (by omega) j) + have hzr := CrossEnsemble.applied_summable hz (creationSandwich 0 3 (by omega) j) + have hzm := CrossEnsemble.applied_summable hz (inverseWeight 2 ∘L modeBound j false) + have hzn := CrossEnsemble.applied_summable hz (inverseWeight 2 ∘L modeBound j true) + have hm' := slice_dissipator _ _ _ _ _ _ hi hl hm hzi hzl hzm + (up j) id (fun k => (Real.sqrt ((k j:ℝ)+1):ℂ)) (fun k => (k j:ℂ)) + (fun i k e => lowerL_second_inverse_apply j (x i) k e) + (fun i k e => numberL_minus j (x i) k e) + (fun i k => single_lower_third_apply j (z i) k) + (fun i k => by simpa only [Bool.false_eq_true,↓reduceIte,add_zero,id_eq,ContinuousLinearMap.comp_apply] using single_number_third_apply j false (z i) k) + he Z + have hp' := slice_dissipator _ _ _ _ _ _ hi hr hn hzi hzr hzn + (down j) id (fun k => if k j=0 then (0:ℂ) else (Real.sqrt (k j:ℝ):ℂ)) (fun k => (k j:ℂ)+1) + (fun i k e => raiseL_second_inverse_apply j (x i) k e) + (fun i k e => numberL_plus j (x i) k e) + (fun i k => single_raise_third_apply j (z i) k) + (fun i k => by simpa only [↓reduceIte,id_eq,ContinuousLinearMap.comp_apply] using single_number_third_apply j true (z i) k) + he Z + exact congrArg₂ HAdd.hAdd (congrArg (fun t : ℂ => ((r+1:ℝ):ℂ)*t) hm') + (congrArg (fun t : ℂ => (r:ℂ)*t) hp') +end + +section +open EntropyPhotonNumber QuantumTrace Annihilation TensorLp +open scoped BigOperators +variable {n : ℕ} {I J : Type*} + +theorem generatorPairingR_product (r : ℝ) (x : I → Fock n) (y : J → Fock n) + (hx : Summable (fun i => ‖x i‖^2)) (hy : Summable (fun j => ‖y j‖^2)) + (hxn : HasSum (fun i => ‖inverseWeight 3 (x i)‖^2) 1) + (Z : JointFock n →L[ℂ] JointFock n) : + generatorPairingR r (fun ij : I × J => tensorPreimage2 (x ij.1) (y ij.2)) + (fun ij : I × J => tensorPreimage2 (x ij.1) (y ij.2)) Z= + singleGeneratorPairing r y (conditionalRight (fun i => inverseWeight 3 (x i)) hxn Z) := by + have hp := tensorPreimage2_summable x y hx hy + have hi := CrossEnsemble.applied_summable hy (inverseWeight 3) + have hm (j : Fin n) (u : Bool) := CrossEnsemble.applied_summable hy (inverseWeight 2 ∘L modeBound j u) + have hl (j : Fin n) := CrossEnsemble.applied_summable hy (sandwich 0 3 (by omega) j) + have hr (j : Fin n) := CrossEnsemble.applied_summable hy (creationSandwich 0 3 (by omega) j) + unfold generatorPairingR singleGeneratorPairing + apply Finset.sum_congr rfl + intro j _ + have hts (u v : J → Fock n) (hu : Summable (fun i => ‖u i‖^2)) + (hv : Summable (fun i => ‖v i‖^2)) := + pairing_conditionalRight (fun i => inverseWeight 3 (x i)) u v hxn hu hv Z + have h1 := hts _ _ (hl j) (hl j) + have h2 := hts _ _ (hm j false) hi + have h3 := hts _ _ hi (hm j false) + have h4 := hts _ _ (hr j) (hr j) + have h5 := hts _ _ (hm j true) hi + have h6 := hts _ _ hi (hm j true) + unfold quadMinusR quadPlusR + simp only [tensorPreimage2_inverse,tensorPreimage_inverse,tensorPreimage_lowerR, + tensorPreimage_raiseR,tensorPreimage2_numberR_minus,tensorPreimage2_numberR_plus] + have hA := CrossEnsemble.pairing_summable + (CrossEnsemble.applied_summable hp (lowerR j ∘L inverse)) + (CrossEnsemble.applied_summable hp (lowerR j ∘L inverse)) Z + have hB := CrossEnsemble.pairing_summable + (CrossEnsemble.applied_summable hp (raiseR j ∘L preLowerR j)) + (CrossEnsemble.applied_summable hp (inverse ∘L inverse)) Z + have hC := CrossEnsemble.pairing_summable + (CrossEnsemble.applied_summable hp (inverse ∘L inverse)) + (CrossEnsemble.applied_summable hp (raiseR j ∘L preLowerR j)) Z + have hD := CrossEnsemble.pairing_summable + (CrossEnsemble.applied_summable hp (raiseR j ∘L inverse)) + (CrossEnsemble.applied_summable hp (raiseR j ∘L inverse)) Z + have hE := CrossEnsemble.pairing_summable + (CrossEnsemble.applied_summable hp (lowerR j ∘L preRaiseR j)) + (CrossEnsemble.applied_summable hp (inverse ∘L inverse)) Z + have hF := CrossEnsemble.pairing_summable + (CrossEnsemble.applied_summable hp (inverse ∘L inverse)) + (CrossEnsemble.applied_summable hp (lowerR j ∘L preRaiseR j)) Z + simp only [ContinuousLinearMap.comp_apply,tensorPreimage2_inverse,tensorPreimage_inverse, + tensorPreimage_lowerR,tensorPreimage_raiseR,tensorPreimage2_numberR_minus,tensorPreimage2_numberR_plus] at hA hB hC hD hE hF + rw [hA.tsum_sub ((hB.add hC).mul_left _), hD.tsum_sub ((hE.add hF).mul_left _), + tsum_mul_left,tsum_mul_left,hB.tsum_add hC,hE.tsum_add hF] + simpa only [CrossEnsemble.pairing, ContinuousLinearMap.comp_apply] using congrArg₂ HAdd.hAdd + (congrArg (fun z : ℂ => ((r+1:ℝ):ℂ)*z) (congrArg₂ HSub.hSub h1 (congrArg (fun z : ℂ => (2:ℂ)⁻¹*z) (congrArg₂ HAdd.hAdd h2 h3)))) + (congrArg (fun z : ℂ => (r:ℂ)*z) (congrArg₂ HSub.hSub h4 (congrArg (fun z : ℂ => (2:ℂ)⁻¹*z) (congrArg₂ HAdd.hAdd h5 h6)))) +end + +section +open EntropyPhotonNumber QuantumTrace Annihilation TensorLp +variable {n : ℕ} {I J K : Type*} + +theorem physical_product_generator (η a b : ℝ) (hη : η ∈ Set.Icc 0 1) + (ρ σ τ : State n) (hτ : IsBeamSplitterOutput η ρ σ τ) + (x : I → Fock n) (y : J → Fock n) (z : K → Fock n) + (hx : Summable (fun i => ‖x i‖^2)) (hy : Summable (fun j => ‖y j‖^2)) + (hz : Summable (fun k => ‖z k‖^2)) + (hxn : HasSum (fun i => ‖inverseWeight 3 (x i)‖^2) 1) + (hyn : HasSum (fun j => ‖inverseWeight 3 (y j)‖^2) 1) + (hex : TraceEnsemble.operator (fun i => inverseWeight 3 (x i))=ρ.op) + (hey : TraceEnsemble.operator (fun j => inverseWeight 3 (y j))=σ.op) + (hez : TraceEnsemble.operator (fun k => inverseWeight 3 (z k))=τ.op) + (Z : Fock n →L[ℂ] Fock n) : + singleGeneratorPairing (η*a+(1-η)*b) z Z= + singleGeneratorPairing a x + (conditionalLeft (fun j => inverseWeight 3 (y j)) hyn (conjugate η hη Z))+ + singleGeneratorPairing b y + (conditionalRight (fun i => inverseWeight 3 (x i)) hxn (conjugate η hη Z)) := by + have hs := tensorPreimage2_summable x y hx hy + have hu : Summable (fun ij : I × J => ‖beamUnitary η hη (tensorPreimage2 (x ij.1) (y ij.2))‖^2) := by + simpa only [LinearIsometryEquiv.norm_map] using hs + have he := physical_weighted_output η hη ρ σ τ hτ x y z hxn hyn hex hey hez + have hi (u v : Fock n) : inverse (inverse (beamUnitary η hη (tensorPreimage2 u v)))= + inverse (beamUnitary η hη (tensorPreimage u v)) := by + rw [covariance_inverse_apply,tensorPreimage2_inverse] + have he' : CrossEnsemble.operator + (fun ie : (I × J) × NumberIndex n => slice (inverse (inverse + (beamUnitary η hη (tensorPreimage2 (x ie.1.1) (y ie.1.2))))) ie.2) + (fun ie : (I × J) × NumberIndex n => slice (inverse (inverse + (beamUnitary η hη (tensorPreimage2 (x ie.1.1) (y ie.1.2))))) ie.2)= + CrossEnsemble.operator (fun k => inverseWeight 3 (z k)) (fun k => inverseWeight 3 (z k)) := by + simpa only [hi] using he + rw [← output_generator _ _ z hu hz he' Z] + rw [generatorPairing_covariance η a b hη _ _ hs hs Z] + rw [generatorPairingL_product a x y hx hy hyn, generatorPairingR_product b x y hx hy hxn] +end + +open EntropyPhotonNumber QuantumTrace Annihilation TensorLp +variable {n : ℕ} + +def tensorRatio (ke : NumberIndex n × NumberIndex n) : ℝ := + W ke/(numberWeight ke.1*numberWeight ke.2) + +def retainedRatio (ke : NumberIndex n × NumberIndex n) : ℝ := numberWeight ke.1/W ke + +theorem tensorRatio_mem (ke : NumberIndex n × NumberIndex n) : tensorRatio ke ∈ Set.Icc 0 1 := by + have h1 := numberWeight_one_le ke.1 + have h2 := numberWeight_one_le ke.2 + have hw : 0 ((tensorRatio ke)^2:ℂ)) + 1 (by norm_num) (fun ke => by simpa only [Complex.real_smul,mul_one,Complex.ofReal_pow] using ratioSquare_norm (tensorRatio_mem ke)) + +def retainedRatioCLM : JointFock n →L[ℂ] JointFock n := + WeightedShift.pullCLM id Function.injective_id (fun ke => ((retainedRatio ke)^2:ℂ)) + 1 (by norm_num) (fun ke => by simpa only [Complex.real_smul,mul_one,Complex.ofReal_pow] using ratioSquare_norm (retainedRatio_mem ke)) + +theorem tensorRatioCLM_norm (z : JointFock n) : ‖tensorRatioCLM z‖≤‖z‖ := by + have hb : ‖tensorRatioCLM z‖ ≤ 1*‖z‖ := WeightedShift.pull_bound id Function.injective_id + (fun ke : NumberIndex n × NumberIndex n => ((tensorRatio ke)^2:ℂ)) + 1 (by norm_num) (fun ke => by simpa only [Complex.real_smul,mul_one,Complex.ofReal_pow] using ratioSquare_norm (tensorRatio_mem ke)) z + simpa only [one_mul] using hb + +theorem retainedRatioCLM_norm (z : JointFock n) : ‖retainedRatioCLM z‖≤‖z‖ := by + have hb : ‖retainedRatioCLM z‖ ≤ 1*‖z‖ := WeightedShift.pull_bound id Function.injective_id + (fun ke : NumberIndex n × NumberIndex n => ((retainedRatio ke)^2:ℂ)) + 1 (by norm_num) (fun ke => by simpa only [Complex.real_smul,mul_one,Complex.ofReal_pow] using ratioSquare_norm (retainedRatio_mem ke)) z + simpa only [one_mul] using hb + +def weightedColumn (η : ℝ) (hη : η ∈ Set.Icc 0 1) (y : Fock n) : Fock n →L[ℂ] JointFock n := + retainedRatioCLM ∘L (beamUnitary η hη).toContinuousLinearEquiv.toContinuousLinearMap ∘L + tensorRatioCLM ∘L tensorRight y + +@[simp] theorem weightedColumn_apply (η : ℝ) (hη : η ∈ Set.Icc 0 1) (x y : Fock n) : + weightedColumn η hη y x = retainedRatioCLM (beamUnitary η hη (tensorRatioCLM (tensor x y))) := rfl + +theorem weightedColumn_norm (η : ℝ) (hη : η ∈ Set.Icc 0 1) (y : Fock n) : + ‖weightedColumn η hη y‖≤‖y‖ := by + apply ContinuousLinearMap.opNorm_le_bound _ (norm_nonneg y) + intro x + rw [weightedColumn_apply] + calc + _ ≤ ‖beamUnitary η hη (tensorRatioCLM (tensor x y))‖ := retainedRatioCLM_norm _ + _ = ‖tensorRatioCLM (tensor x y)‖ := (beamUnitary η hη).norm_map _ + _ ≤ ‖tensor x y‖ := tensorRatioCLM_norm _ + _ = ‖y‖*‖x‖ := by rw [tensor_norm,mul_comm] + +theorem weightedColumn_summable {I : Type*} (η : ℝ) (hη : η ∈ Set.Icc 0 1) + (y : I → Fock n) (hy : Summable (fun i => ‖y i‖^2)) : + Summable (fun i => ‖weightedColumn η hη (y i)‖^2) := + hy.of_nonneg_of_le (fun _ => sq_nonneg _) (fun i => + pow_le_pow_left₀ (norm_nonneg _) (weightedColumn_norm η hη (y i)) 2) + +theorem tensorRatio_inverse (x y : Fock n) : + inverse (inverse (tensorRatioCLM (tensor x y)))=tensor (inverseWeight 2 x) (inverseWeight 2 y) := by + apply lp.ext + funext ke + obtain ⟨k,e⟩ := ke + have hw : (W (k,e):ℂ)≠0 := by exact_mod_cast (by linarith [W_one_le (k,e)] : W (k,e)≠0) + have hk : (numberWeight k:ℂ)≠0 := by exact_mod_cast (by linarith [numberWeight_one_le k] : numberWeight k≠0) + have he : (numberWeight e:ℂ)≠0 := by exact_mod_cast (by linarith [numberWeight_one_le e] : numberWeight e≠0) + simp only [inverse_apply,tensorRatioCLM,WeightedShift.pullCLM_apply,tensorRatio, + id_eq,tensor_apply,inverseWeight_apply,Complex.ofReal_div,Complex.ofReal_mul] + field_simp + +theorem retainedRatio_inverse (z : JointFock n) : + liftLeft (inverseWeight 2) (retainedRatioCLM z)=inverse (inverse z) := by + apply lp.ext + funext ke + obtain ⟨k,e⟩ := ke + have hw : (W (k,e):ℂ)≠0 := by exact_mod_cast (by linarith [W_one_le (k,e)] : W (k,e)≠0) + have hk : (numberWeight k:ℂ)≠0 := by exact_mod_cast (by linarith [numberWeight_one_le k] : numberWeight k≠0) + simp only [liftLeft_apply,inverseWeight_apply,slice_apply,retainedRatioCLM, + WeightedShift.pullCLM_apply,retainedRatio,id_eq,inverse_apply,Complex.ofReal_div] + field_simp + +theorem weightedColumn_inverse (η : ℝ) (hη : η ∈ Set.Icc 0 1) (x y : Fock n) : + liftLeft (inverseWeight 2) (weightedColumn η hη y x)= + beamUnitary η hη (tensor (inverseWeight 2 x) (inverseWeight 2 y)) := by + rw [weightedColumn_apply] + rw [retainedRatio_inverse,covariance_inverse_apply,covariance_inverse_apply,tensorRatio_inverse] + +end BeamLadder + +namespace EnsemblePullback + +section +variable {E F : Type*} [NormedAddCommGroup E] [InnerProductSpace ℂ E] [CompleteSpace E] +variable [NormedAddCommGroup F] [InnerProductSpace ℂ F] [CompleteSpace F] +variable {I : Type*} + +def compression (V : E →L[ℂ] F) (Z : F →L[ℂ] F) : E →L[ℂ] E := + V.adjoint ∘L Z ∘L V + +theorem compression_norm (V : E →L[ℂ] F) (Z : F →L[ℂ] F) : + ‖compression V Z‖ ≤ ‖Z‖*‖V‖^2 := by + calc + _ ≤ ‖V.adjoint‖*‖Z ∘L V‖ := ContinuousLinearMap.opNorm_comp_le _ _ + _ ≤ ‖V.adjoint‖*(‖Z‖*‖V‖) := + mul_le_mul_of_nonneg_left (ContinuousLinearMap.opNorm_comp_le _ _) (norm_nonneg _) + _ = _ := by rw [ContinuousLinearMap.adjoint.norm_map]; ring + +theorem summable_norm_compression {V : I → E →L[ℂ] F} (hV : Summable (fun i => ‖V i‖^2)) + (Z : F →L[ℂ] F) : Summable (fun i => ‖compression (V i) Z‖) := by + exact (hV.mul_left ‖Z‖).of_nonneg_of_le (fun _ => norm_nonneg _) (fun i => compression_norm _ _) + +theorem summable_compression {V : I → E →L[ℂ] F} (hV : Summable (fun i => ‖V i‖^2)) + (Z : F →L[ℂ] F) : Summable (fun i => compression (V i) Z) := by + apply Summable.of_norm_bounded (hV.mul_left ‖Z‖) + exact fun i => compression_norm _ _ + +def pullback (V : I → E →L[ℂ] F) (Z : F →L[ℂ] F) : E →L[ℂ] E := + ∑' i, compression (V i) Z + +theorem pullback_norm {V : I → E →L[ℂ] F} (hV : Summable (fun i => ‖V i‖^2)) + (Z : F →L[ℂ] F) : ‖pullback V Z‖ ≤ ‖Z‖*(∑' i, ‖V i‖^2) := by + rw [← tsum_mul_left] + exact (norm_tsum_le_tsum_norm (summable_norm_compression hV Z)).trans + (((summable_norm_compression hV Z)).tsum_le_tsum (fun i => compression_norm _ _) (hV.mul_left _)) + +theorem compression_entry (V : E →L[ℂ] F) (Z : F →L[ℂ] F) (x y : E) : + inner ℂ x (compression V Z y) = inner ℂ (V x) (Z (V y)) := by + exact ContinuousLinearMap.adjoint_inner_right V x (Z (V y)) + +theorem hasSum_entry {V : I → E →L[ℂ] F} (hV : Summable (fun i => ‖V i‖^2)) + (Z : F →L[ℂ] F) (x y : E) : + HasSum (fun i => inner ℂ (V i x) (Z (V i y))) (inner ℂ x (pullback V Z y)) := by + convert! (((summable_compression hV Z).hasSum).mapL + (ContinuousLinearMap.apply ℂ E y)).mapL (innerSL ℂ x) using 1 + ext i + exact (compression_entry _ _ _ _).symm + +theorem compression_positive (V : E →L[ℂ] F) {Z : F →L[ℂ] F} (hZ : Z.IsPositive) : + (compression V Z).IsPositive := hZ.adjoint_conj V + +theorem pullback_positive (V : I → E →L[ℂ] F) {Z : F →L[ℂ] F} (hZ : Z.IsPositive) : + (pullback V Z).IsPositive := by + apply ContinuousLinearMap.nonneg_iff_isPositive.mp + apply tsum_nonneg + exact fun i => ContinuousLinearMap.nonneg_iff_isPositive.mpr (compression_positive _ hZ) + +theorem pullback_add {V : I → E →L[ℂ] F} (hV : Summable (fun i => ‖V i‖^2)) + (Z T : F →L[ℂ] F) : pullback V (Z+T) = pullback V Z + pullback V T := by + unfold pullback compression + simp only [ContinuousLinearMap.add_comp, ContinuousLinearMap.comp_add] + exact (summable_compression hV Z).tsum_add (summable_compression hV T) + +theorem pullback_smul {V : I → E →L[ℂ] F} (hV : Summable (fun i => ‖V i‖^2)) (c : ℂ) (Z : F →L[ℂ] F) : + pullback V (c • Z) = c • pullback V Z := by + unfold pullback compression + simp only [ContinuousLinearMap.smul_comp, ContinuousLinearMap.comp_smul] + exact (summable_compression hV Z).tsum_const_smul c + +def map (V : I → E →L[ℂ] F) (hV : Summable (fun i => ‖V i‖^2)) : + (F →L[ℂ] F) →L[ℂ] (E →L[ℂ] E) := + LinearMap.mkContinuous + { toFun := pullback V + map_add' := pullback_add hV + map_smul' := fun c Z => pullback_smul hV c Z } + (∑' i, ‖V i‖^2) (fun Z => by + change ‖pullback V Z‖ ≤ (∑' i, ‖V i‖^2)*‖Z‖ + simpa only [mul_comm] using pullback_norm hV Z) + +end + +variable {E F : Type*} [NormedAddCommGroup E] [InnerProductSpace ℂ E] [CompleteSpace E] +variable [NormedAddCommGroup F] [InnerProductSpace ℂ F] [CompleteSpace F] +variable {I J : Type*} + +omit [CompleteSpace E] [CompleteSpace F] in +theorem applied_family_summable (V : J → E →L[ℂ] F) + (hV : Summable (fun j => ‖V j‖^2)) (x : I → E) + (hx : Summable (fun i => ‖x i‖^2)) : + Summable (fun ij : I × J => ‖V ij.2 (x ij.1)‖^2) := by + have hs := hx.mul_of_nonneg hV (fun _ => sq_nonneg _) (fun _ => sq_nonneg _) + apply hs.of_nonneg_of_le (fun _ => sq_nonneg _) + intro ij + calc + _ ≤ (‖V ij.2‖*‖x ij.1‖)^2 := + pow_le_pow_left₀ (norm_nonneg _) (ContinuousLinearMap.le_opNorm _ _) 2 + _ = ‖x ij.1‖^2*‖V ij.2‖^2 := by ring + +theorem pairing_pullback (V : J → E →L[ℂ] F) + (hV : Summable (fun j => ‖V j‖^2)) (x y : I → E) + (hx : Summable (fun i => ‖x i‖^2)) (hy : Summable (fun i => ‖y i‖^2)) + (Z : F →L[ℂ] F) : + CrossEnsemble.pairing (fun ij : I × J => V ij.2 (x ij.1)) + (fun ij : I × J => V ij.2 (y ij.1)) Z = + CrossEnsemble.pairing x y (pullback V Z) := by + have hs := CrossEnsemble.pairing_summable (applied_family_summable V hV x hx) + (applied_family_summable V hV y hy) Z + exact (hs.hasSum.prod_fiberwise (fun i => hasSum_entry hV Z (y i) (x i))).tsum_eq.symm +end EnsemblePullback + +namespace BeamLadder +open EntropyPhotonNumber QuantumTrace Annihilation TensorLp +variable {n : ℕ} {I J : Type*} + +def weightedConditional (η : ℝ) (hη : η ∈ Set.Icc 0 1) (y : J → Fock n) + (B : Fock n →L[ℂ] Fock n) : Fock n →L[ℂ] Fock n := + EnsemblePullback.pullback (fun j => weightedColumn η hη (y j)) (liftLeft B) + +def weightedSlices (η : ℝ) (hη : η ∈ Set.Icc 0 1) (y : J → Fock n) + (x : I → Fock n) (ije : (I × J) × NumberIndex n) : Fock n := + slice (weightedColumn η hη (y ije.1.2) (x ije.1.1)) ije.2 + +theorem weightedSlices_summable (η : ℝ) (hη : η ∈ Set.Icc 0 1) + (y : J → Fock n) (hy : Summable (fun j => ‖y j‖^2)) + (x : I → Fock n) (hx : Summable (fun i => ‖x i‖^2)) : + Summable (fun ije => ‖weightedSlices η hη y x ije‖^2) := + by + have hs : Summable (fun ij : I × J => ‖weightedColumn η hη (y ij.2) (x ij.1)‖^2) := + EnsemblePullback.applied_family_summable + (fun j => weightedColumn η hη (y j)) (weightedColumn_summable η hη y hy) x hx + exact slice_family_summable (fun ij : I × J => weightedColumn η hη (y ij.2) (x ij.1)) hs + +theorem weighted_pairing_slicing (η : ℝ) (hη : η ∈ Set.Icc 0 1) + (y : J → Fock n) (hy : Summable (fun j => ‖y j‖^2)) + (u v : I → Fock n) (hu : Summable (fun i => ‖u i‖^2)) + (hv : Summable (fun i => ‖v i‖^2)) (B : Fock n →L[ℂ] Fock n) : + CrossEnsemble.pairing (weightedSlices η hη y u) (weightedSlices η hη y v) B = + CrossEnsemble.pairing u v (weightedConditional η hη y B) := by + have hV := weightedColumn_summable η hη y hy + unfold weightedSlices weightedConditional + rw [← pairing_liftLeft _ _ + (EnsemblePullback.applied_family_summable _ hV u hu) + (EnsemblePullback.applied_family_summable _ hV v hv)] + exact EnsemblePullback.pairing_pullback _ hV u v hu hv (liftLeft B) + +end BeamLadder + +namespace CrossEnsemble +variable {E J : Type*} [NormedAddCommGroup E] [InnerProductSpace ℂ E] [CompleteSpace E] + +theorem rankOne_trace (b : HilbertBasis J ℂ E) (A : E →L[ℂ] E) (x y : E) : + HasSum (fun k => inner ℂ (b k) ((InnerProductSpace.rankOne ℂ x y) (A (b k)))) + (inner ℂ y (A x)) := by + convert! b.hasSum_inner_mul_inner (A.adjoint y) x using 1 + · ext k + simp only [InnerProductSpace.rankOne_apply, inner_smul_right, + ContinuousLinearMap.adjoint_inner_left] + · rw [ContinuousLinearMap.adjoint_inner_left] + +variable {I : Type*} +theorem pairing_selfAdjoint_sandwich (x y : I → E) (P Z : E →L[ℂ] E) + (hP : IsSelfAdjoint P) : + pairing x y (P ∘L Z ∘L P)=pairing (fun i => P (x i)) (fun i => P (y i)) Z := by + unfold pairing + apply tsum_congr + intro i + simp only [ContinuousLinearMap.comp_apply] + exact (ContinuousLinearMap.isSelfAdjoint_iff_isSymmetric.mp hP (y i) (Z (P (x i)))).symm +end CrossEnsemble + +namespace Annihilation +open EntropyPhotonNumber QuantumTrace +variable {n : ℕ} + +theorem inverseWeight_rankOne_range (m : ℕ) (k : NumberIndex n) : + ∃ v : Fock n, inverseWeight m v=numberKet k := by + refine ⟨lp.single 2 k ((numberWeight k:ℂ)^m), ?_⟩ + have hh := WeightedShift.pullCLM_single id Function.injective_id + (fun a : NumberIndex n => ((numberWeight a:ℂ)^m)⁻¹) 1 (by norm_num) + (coefficient_inverse_bound m) k ((numberWeight k:ℂ)^m) + change inverseWeight m (lp.single 2 k ((numberWeight k:ℂ)^m))=_ at hh + rw [hh] + have hw : (numberWeight k:ℂ)≠0 := by exact_mod_cast (by linarith [numberWeight_one_le k] : numberWeight k≠0) + simp only [inv_mul_cancel₀ (pow_ne_zero m hw)] + rfl + +theorem inverseWeight_rankOne (m : ℕ) (x y : Fock n) : + inverseWeight m ∘L InnerProductSpace.rankOne ℂ x y ∘L inverseWeight m = + InnerProductSpace.rankOne ℂ (inverseWeight m x) (inverseWeight m y) := by + apply ContinuousLinearMap.ext + intro z + simp only [ContinuousLinearMap.comp_apply,InnerProductSpace.rankOne_apply,map_smul] + exact congrArg (fun a : ℂ => a • inverseWeight m x) + (ContinuousLinearMap.isSelfAdjoint_iff_isSymmetric.mp (inverseWeight_selfAdjoint m) y z).symm + +theorem weighted_trace_ext {J : Type*} (b : HilbertBasis J ℂ (Fock n)) + (A Q : Fock n →L[ℂ] Fock n) + (f g : (Fock n →L[ℂ] Fock n) → ℂ) + (hf : ∀ Z, HasSum (fun k => inner ℂ (b k) (Z (A (b k)))) (f Z)) + (hg : ∀ Z, HasSum (fun k => inner ℂ (b k) (Z (Q (b k)))) (g Z)) + (h : ∀ Z, f (inverseWeight 2 ∘L Z ∘L inverseWeight 2)= + g (inverseWeight 2 ∘L Z ∘L inverseWeight 2)) : ∀ Z, f Z=g Z := by + have he : A=Q := by + apply entry_ext + intro k l + obtain ⟨x,hx⟩ := inverseWeight_rankOne_range 2 l + obtain ⟨y,hy⟩ := inverseWeight_rankOne_range 2 k + have hh := h (InnerProductSpace.rankOne ℂ x y) + rw [inverseWeight_rankOne,hx,hy] at hh + have hA := (hf (InnerProductSpace.rankOne ℂ (numberKet l) (numberKet k))).unique + (CrossEnsemble.rankOne_trace b A (numberKet l) (numberKet k)) + have hQ := (hg (InnerProductSpace.rankOne ℂ (numberKet l) (numberKet k))).unique + (CrossEnsemble.rankOne_trace b Q (numberKet l) (numberKet k)) + exact hA.symm.trans (hh.trans hQ) + intro Z + apply (hf Z).unique + rw [he] + exact hg Z +end Annihilation + +namespace BeamLadder +open EntropyPhotonNumber QuantumTrace Annihilation TensorLp +variable {n : ℕ} {I : Type*} + +theorem gain_inverse_apply (j : Fin n) (u : Bool) (x : Fock n) : + inverseWeight 2 (gain j u x)= + if u then creationSandwich 0 3 (by omega) j x else sandwich 0 3 (by omega) j x := by + cases u + · exact congrArg (fun T : Fock n →L[ℂ] Fock n => T x) (sandwich_factor 2 3 (by omega) j).symm + · exact congrArg (fun T : Fock n →L[ℂ] Fock n => T x) (creationSandwich_factor 2 3 (by omega) j).symm + +theorem inverse_two_one (x : Fock n) : inverseWeight 2 (inverseWeight 1 x)=inverseWeight 3 x := + congrArg (fun T : Fock n →L[ℂ] Fock n => T x) (inverseWeight_add 2 1).symm + +theorem weighted_pairing_physical (r : ℝ) (x : I → Fock n) + (Z : Fock n →L[ℂ] Fock n) : + WeightedGenerator.pairing r x (inverseWeight 2 ∘L Z ∘L inverseWeight 2)= + singleGeneratorPairing r x Z := by + simp only [WeightedGenerator.pairing,singleGeneratorPairing, + CrossEnsemble.pairing_selfAdjoint_sandwich _ _ _ _ (inverseWeight_selfAdjoint 2), + gain_inverse_apply,inverse_two_one,Bool.false_eq_true,ite_false,ite_true] +end BeamLadder + +namespace WeightedGenerator +open EntropyPhotonNumber Annihilation +open scoped BigOperators +variable {n : ℕ} {I K : Type*} + +def pushedDissipator (F : (I → Fock n) → K → Fock n) (x : I → Fock n) + (j : Fin n) (upward : Bool) : Fock n →L[ℂ] Fock n := + CrossEnsemble.operator (F (fun i => gain j upward (x i))) (F (fun i => gain j upward (x i)))- + (2:ℂ)⁻¹ • (CrossEnsemble.operator (F (fun i => modeBound j upward (x i))) (F (fun i => inverseWeight 1 (x i)))+ + CrossEnsemble.operator (F (fun i => inverseWeight 1 (x i))) (F (fun i => modeBound j upward (x i)))) + +def pushedGenerator (F : (I → Fock n) → K → Fock n) (r : ℝ) (x : I → Fock n) : Fock n →L[ℂ] Fock n := + ∑ j, (((r+1:ℝ):ℂ) • pushedDissipator F x j false+(r:ℂ) • pushedDissipator F x j true) + +def pushedPairing (F : (I → Fock n) → K → Fock n) (r : ℝ) (x : I → Fock n) + (Z : Fock n →L[ℂ] Fock n) : ℂ := + ∑ j, (((r+1:ℝ):ℂ)*(CrossEnsemble.pairing (F (fun i => gain j false (x i))) (F (fun i => gain j false (x i))) Z- + (2:ℂ)⁻¹*(CrossEnsemble.pairing (F (fun i => modeBound j false (x i))) (F (fun i => inverseWeight 1 (x i))) Z+ + CrossEnsemble.pairing (F (fun i => inverseWeight 1 (x i))) (F (fun i => modeBound j false (x i))) Z))+ + (r:ℂ)*(CrossEnsemble.pairing (F (fun i => gain j true (x i))) (F (fun i => gain j true (x i))) Z- + (2:ℂ)⁻¹*(CrossEnsemble.pairing (F (fun i => modeBound j true (x i))) (F (fun i => inverseWeight 1 (x i))) Z+ + CrossEnsemble.pairing (F (fun i => inverseWeight 1 (x i))) (F (fun i => modeBound j true (x i))) Z))) + +theorem pushedPairing_hasSum {J : Type*} (b : HilbertBasis J ℂ (Fock n)) + (F : (I → Fock n) → K → Fock n) + (hF : ∀ u, Summable (fun i => ‖u i‖^2) → Summable (fun k => ‖F u k‖^2)) + (r : ℝ) (x : I → Fock n) (hx : Summable (fun i => ‖x i‖^2)) + (Z : Fock n →L[ℂ] Fock n) : + HasSum (fun k => inner ℂ (b k) (Z (pushedGenerator F r x (b k)))) (pushedPairing F r x Z) := by + have ha (j : Fin n) (u : Bool) := hF _ (CrossEnsemble.applied_summable hx (gain j u)) + have hb (j : Fin n) (u : Bool) := hF _ (CrossEnsemble.applied_summable hx (modeBound j u)) + have hc := hF _ (CrossEnsemble.applied_summable hx (inverseWeight 1)) + have h (j : Fin n) (u : Bool) := + (CrossEnsemble.pairing_trace b (ha j u) (ha j u) Z).sub + (((CrossEnsemble.pairing_trace b (hb j u) hc Z).add + (CrossEnsemble.pairing_trace b hc (hb j u) Z)).mul_left (2:ℂ)⁻¹) + have hh := hasSum_sum fun j (_hj : j ∈ (Finset.univ : Finset (Fin n))) => + ((h j false).mul_left ((r+1:ℝ):ℂ)).add ((h j true).mul_left (r:ℂ)) + convert! hh using 1 + ext k + simp only [pushedGenerator,pushedDissipator,sum_apply,add_apply,sub_apply,smul_apply, + map_sum,map_add,map_sub,map_smul,inner_sum,inner_sub_right,inner_add_right,inner_smul_right] + +theorem pushedPairing_slicing (F : (I → Fock n) → K → Fock n) + (B Z : Fock n →L[ℂ] Fock n) + (hF : ∀ u v, Summable (fun i => ‖u i‖^2) → Summable (fun i => ‖v i‖^2) → + CrossEnsemble.pairing (F u) (F v) B=CrossEnsemble.pairing u v Z) + (r : ℝ) (x : I → Fock n) (hx : Summable (fun i => ‖x i‖^2)) : + pushedPairing F r x B=pairing r x Z := by + have ha (j : Fin n) (u : Bool) := CrossEnsemble.applied_summable hx (gain j u) + have hb (j : Fin n) (u : Bool) := CrossEnsemble.applied_summable hx (modeBound j u) + have hc := CrossEnsemble.applied_summable hx (inverseWeight 1) + unfold pushedPairing pairing + apply Finset.sum_congr rfl + intro j _ + rw [hF _ _ (ha j false) (ha j false),hF _ _ (hb j false) hc,hF _ _ hc (hb j false), + hF _ _ (ha j true) (ha j true),hF _ _ (hb j true) hc,hF _ _ hc (hb j true)] +end WeightedGenerator + +namespace BeamLadder + +section +open EntropyPhotonNumber QuantumTrace Annihilation TensorLp +variable {n : ℕ} {I J : Type*} + +theorem weightedSlices_inverse (η : ℝ) (hη : η ∈ Set.Icc 0 1) (y : J → Fock n) + (u : I → Fock n) (ije : (I × J) × NumberIndex n) : + inverseWeight 2 (weightedSlices η hη y u ije)= + slice (beamUnitary η hη (tensor (inverseWeight 2 (u ije.1.1)) (inverseWeight 2 (y ije.1.2)))) ije.2 := by + unfold weightedSlices + rw [← slice_liftLeft,weightedColumn_inverse] + +theorem weighted_pairing_bounded_physical (η : ℝ) (hη : η ∈ Set.Icc 0 1) + (y : J → Fock n) (hyn : HasSum (fun j => ‖inverseWeight 2 (y j)‖^2) 1) + (u v : I → Fock n) (hu : Summable (fun i => ‖u i‖^2)) + (hv : Summable (fun i => ‖v i‖^2)) (Z : Fock n →L[ℂ] Fock n) : + CrossEnsemble.pairing (weightedSlices η hη y u) (weightedSlices η hη y v) + (inverseWeight 2 ∘L Z ∘L inverseWeight 2)= + CrossEnsemble.pairing (fun i => inverseWeight 2 (u i)) (fun i => inverseWeight 2 (v i)) + (conditionalLeft (fun j => inverseWeight 2 (y j)) hyn (conjugate η hη Z)) := by + have hu' := CrossEnsemble.applied_summable hu (inverseWeight 2) + have hv' := CrossEnsemble.applied_summable hv (inverseWeight 2) + have hs := tensorFamily_summable (fun i => inverseWeight 2 (u i)) _ hu' hyn.summable + have ht := tensorFamily_summable (fun i => inverseWeight 2 (v i)) _ hv' hyn.summable + have hsu : Summable (fun ij : I × J => ‖beamUnitary η hη (tensor (inverseWeight 2 (u ij.1)) (inverseWeight 2 (y ij.2)))‖^2) := by + simpa only [LinearIsometryEquiv.norm_map] using hs + have htu : Summable (fun ij : I × J => ‖beamUnitary η hη (tensor (inverseWeight 2 (v ij.1)) (inverseWeight 2 (y ij.2)))‖^2) := by + simpa only [LinearIsometryEquiv.norm_map] using ht + rw [CrossEnsemble.pairing_selfAdjoint_sandwich _ _ _ _ (inverseWeight_selfAdjoint 2)] + simp only [weightedSlices_inverse] + rw [← pairing_liftLeft _ _ hsu htu] + calc + _ = CrossEnsemble.pairing + (fun ij : I × J => tensor (inverseWeight 2 (u ij.1)) (inverseWeight 2 (y ij.2))) + (fun ij : I × J => tensor (inverseWeight 2 (v ij.1)) (inverseWeight 2 (y ij.2))) (conjugate η hη Z) := by + unfold CrossEnsemble.pairing + apply tsum_congr + intro ij + exact (conjugate_inner η hη Z _ _).symm + _ = _ := pairing_conditionalLeft _ _ _ hu' hv' hyn _ + +def weightedColumnRight (η : ℝ) (hη : η ∈ Set.Icc 0 1) (y : Fock n) : Fock n →L[ℂ] JointFock n := + retainedRatioCLM ∘L (beamUnitary η hη).toContinuousLinearEquiv.toContinuousLinearMap ∘L + tensorRatioCLM ∘L tensorLeft y + +@[simp] theorem weightedColumnRight_apply (η : ℝ) (hη : η ∈ Set.Icc 0 1) (x y : Fock n) : + weightedColumnRight η hη y x = retainedRatioCLM (beamUnitary η hη (tensorRatioCLM (tensor y x))) := rfl + +theorem weightedColumnRight_norm (η : ℝ) (hη : η ∈ Set.Icc 0 1) (y : Fock n) : + ‖weightedColumnRight η hη y‖≤‖y‖ := by + apply ContinuousLinearMap.opNorm_le_bound _ (norm_nonneg y) + intro x + rw [weightedColumnRight_apply] + calc + _ ≤ ‖beamUnitary η hη (tensorRatioCLM (tensor y x))‖ := retainedRatioCLM_norm _ + _ = ‖tensorRatioCLM (tensor y x)‖ := (beamUnitary η hη).norm_map _ + _ ≤ ‖tensor y x‖ := tensorRatioCLM_norm _ + _ = ‖y‖*‖x‖ := tensor_norm y x + +theorem weightedColumnRight_summable (η : ℝ) (hη : η ∈ Set.Icc 0 1) + (y : J → Fock n) (hy : Summable (fun i => ‖y i‖^2)) : + Summable (fun i => ‖weightedColumnRight η hη (y i)‖^2) := + hy.of_nonneg_of_le (fun _ => sq_nonneg _) (fun i => + pow_le_pow_left₀ (norm_nonneg _) (weightedColumnRight_norm η hη (y i)) 2) + +theorem weightedColumnRight_inverse (η : ℝ) (hη : η ∈ Set.Icc 0 1) (x y : Fock n) : + liftLeft (inverseWeight 2) (weightedColumnRight η hη y x)= + beamUnitary η hη (tensor (inverseWeight 2 y) (inverseWeight 2 x)) := by + rw [weightedColumnRight_apply,retainedRatio_inverse,covariance_inverse_apply, + covariance_inverse_apply,tensorRatio_inverse] + +def weightedConditionalRight (η : ℝ) (hη : η ∈ Set.Icc 0 1) (y : J → Fock n) + (B : Fock n →L[ℂ] Fock n) : Fock n →L[ℂ] Fock n := + EnsemblePullback.pullback (fun j => weightedColumnRight η hη (y j)) (liftLeft B) + +def weightedSlicesRight (η : ℝ) (hη : η ∈ Set.Icc 0 1) (y : J → Fock n) + (x : I → Fock n) (ije : (I × J) × NumberIndex n) : Fock n := + slice (weightedColumnRight η hη (y ije.1.2) (x ije.1.1)) ije.2 + +theorem weightedSlicesRight_summable (η : ℝ) (hη : η ∈ Set.Icc 0 1) + (y : J → Fock n) (hy : Summable (fun j => ‖y j‖^2)) + (x : I → Fock n) (hx : Summable (fun i => ‖x i‖^2)) : + Summable (fun ije => ‖weightedSlicesRight η hη y x ije‖^2) := by + have hs : Summable (fun ij : I × J => ‖weightedColumnRight η hη (y ij.2) (x ij.1)‖^2) := + EnsemblePullback.applied_family_summable + (fun j => weightedColumnRight η hη (y j)) (weightedColumnRight_summable η hη y hy) x hx + exact slice_family_summable (fun ij : I × J => weightedColumnRight η hη (y ij.2) (x ij.1)) hs + +theorem weighted_pairing_slicing_right (η : ℝ) (hη : η ∈ Set.Icc 0 1) + (y : J → Fock n) (hy : Summable (fun j => ‖y j‖^2)) + (u v : I → Fock n) (hu : Summable (fun i => ‖u i‖^2)) + (hv : Summable (fun i => ‖v i‖^2)) (B : Fock n →L[ℂ] Fock n) : + CrossEnsemble.pairing (weightedSlicesRight η hη y u) (weightedSlicesRight η hη y v) B = + CrossEnsemble.pairing u v (weightedConditionalRight η hη y B) := by + have hV := weightedColumnRight_summable η hη y hy + unfold weightedSlicesRight weightedConditionalRight + rw [← pairing_liftLeft _ _ + (EnsemblePullback.applied_family_summable _ hV u hu) + (EnsemblePullback.applied_family_summable _ hV v hv)] + exact EnsemblePullback.pairing_pullback _ hV u v hu hv (liftLeft B) + +theorem weightedSlicesRight_inverse (η : ℝ) (hη : η ∈ Set.Icc 0 1) (y : J → Fock n) + (u : I → Fock n) (ije : (I × J) × NumberIndex n) : + inverseWeight 2 (weightedSlicesRight η hη y u ije)= + slice (beamUnitary η hη (tensor (inverseWeight 2 (y ije.1.2)) (inverseWeight 2 (u ije.1.1)))) ije.2 := by + unfold weightedSlicesRight + rw [← slice_liftLeft,weightedColumnRight_inverse] + +theorem weighted_pairing_bounded_physical_right (η : ℝ) (hη : η ∈ Set.Icc 0 1) + (y : J → Fock n) (hyn : HasSum (fun j => ‖inverseWeight 2 (y j)‖^2) 1) + (u v : I → Fock n) (hu : Summable (fun i => ‖u i‖^2)) + (hv : Summable (fun i => ‖v i‖^2)) (Z : Fock n →L[ℂ] Fock n) : + CrossEnsemble.pairing (weightedSlicesRight η hη y u) (weightedSlicesRight η hη y v) + (inverseWeight 2 ∘L Z ∘L inverseWeight 2)= + CrossEnsemble.pairing (fun i => inverseWeight 2 (u i)) (fun i => inverseWeight 2 (v i)) + (conditionalRight (fun j => inverseWeight 2 (y j)) hyn (conjugate η hη Z)) := by + have hu' := CrossEnsemble.applied_summable hu (inverseWeight 2) + have hv' := CrossEnsemble.applied_summable hv (inverseWeight 2) + have hs := (tensorFamily_summable _ (fun i => inverseWeight 2 (u i)) hyn.summable hu').prod_symm + have ht := (tensorFamily_summable _ (fun i => inverseWeight 2 (v i)) hyn.summable hv').prod_symm + have hsu : Summable (fun ij : I × J => ‖beamUnitary η hη (tensor (inverseWeight 2 (y ij.2)) (inverseWeight 2 (u ij.1)))‖^2) := by + simpa only [LinearIsometryEquiv.norm_map,Prod.swap] using hs + have htu : Summable (fun ij : I × J => ‖beamUnitary η hη (tensor (inverseWeight 2 (y ij.2)) (inverseWeight 2 (v ij.1)))‖^2) := by + simpa only [LinearIsometryEquiv.norm_map,Prod.swap] using ht + rw [CrossEnsemble.pairing_selfAdjoint_sandwich _ _ _ _ (inverseWeight_selfAdjoint 2)] + simp only [weightedSlicesRight_inverse] + rw [← pairing_liftLeft _ _ hsu htu] + calc + _ = CrossEnsemble.pairing + (fun ji : J × I => tensor (inverseWeight 2 (y ji.1)) (inverseWeight 2 (u ji.2))) + (fun ji : J × I => tensor (inverseWeight 2 (y ji.1)) (inverseWeight 2 (v ji.2))) (conjugate η hη Z) := by + unfold CrossEnsemble.pairing + simp only [← conjugate_inner] + simpa only [Equiv.prodComm_apply,Prod.swap] using + (Equiv.prodComm I J).tsum_eq (fun ji : J × I => + inner ℂ (tensor (inverseWeight 2 (y ji.1)) (inverseWeight 2 (v ji.2))) + (conjugate η hη Z (tensor (inverseWeight 2 (y ji.1)) (inverseWeight 2 (u ji.2))))) + _ = _ := pairing_conditionalRight _ _ _ hyn hu' hv' _ +end + +open EntropyPhotonNumber QuantumTrace Annihilation TensorLp +variable {n : ℕ} {I J K : Type*} + +theorem weighted_pushed_pairing_physical (η : ℝ) (hη : η ∈ Set.Icc 0 1) + (y : J → Fock n) (hyn : HasSum (fun j => ‖inverseWeight 2 (y j)‖^2) 1) + (r : ℝ) (x : I → Fock n) (hx : Summable (fun i => ‖x i‖^2)) + (Z : Fock n →L[ℂ] Fock n) : + WeightedGenerator.pushedPairing (weightedSlices η hη y) r x + (inverseWeight 2 ∘L Z ∘L inverseWeight 2)= + singleGeneratorPairing r x + (conditionalLeft (fun j => inverseWeight 2 (y j)) hyn (conjugate η hη Z)) := by + rw [← weighted_pairing_physical] + apply WeightedGenerator.pushedPairing_slicing _ _ _ _ r x hx + intro u v hu hv + rw [weighted_pairing_bounded_physical η hη y hyn u v hu hv Z, + CrossEnsemble.pairing_selfAdjoint_sandwich _ _ _ _ (inverseWeight_selfAdjoint 2)] + +theorem weighted_pushed_pairing_physical_right (η : ℝ) (hη : η ∈ Set.Icc 0 1) + (y : J → Fock n) (hyn : HasSum (fun j => ‖inverseWeight 2 (y j)‖^2) 1) + (r : ℝ) (x : I → Fock n) (hx : Summable (fun i => ‖x i‖^2)) + (Z : Fock n →L[ℂ] Fock n) : + WeightedGenerator.pushedPairing (weightedSlicesRight η hη y) r x + (inverseWeight 2 ∘L Z ∘L inverseWeight 2)= + singleGeneratorPairing r x + (conditionalRight (fun j => inverseWeight 2 (y j)) hyn (conjugate η hη Z)) := by + rw [← weighted_pairing_physical] + apply WeightedGenerator.pushedPairing_slicing _ _ _ _ r x hx + intro u v hu hv + rw [weighted_pairing_bounded_physical_right η hη y hyn u v hu hv Z, + CrossEnsemble.pairing_selfAdjoint_sandwich _ _ _ _ (inverseWeight_selfAdjoint 2)] + +theorem weighted_product_generator (η a b : ℝ) (hη : η ∈ Set.Icc 0 1) + (ρ σ τ : State n) (hτ : IsBeamSplitterOutput η ρ σ τ) + (x : I → Fock n) (y : J → Fock n) (z : K → Fock n) + (hx : Summable (fun i => ‖x i‖^2)) (hy : Summable (fun j => ‖y j‖^2)) + (hz : Summable (fun k => ‖z k‖^2)) + (hxn : HasSum (fun i => ‖inverseWeight 3 (x i)‖^2) 1) + (hyn : HasSum (fun j => ‖inverseWeight 3 (y j)‖^2) 1) + (hex : TraceEnsemble.operator (fun i => inverseWeight 3 (x i))=ρ.op) + (hey : TraceEnsemble.operator (fun j => inverseWeight 3 (y j))=σ.op) + (hez : TraceEnsemble.operator (fun k => inverseWeight 3 (z k))=τ.op) + (B : Fock n →L[ℂ] Fock n) : + WeightedGenerator.pairing (η*a+(1-η)*b) z B= + WeightedGenerator.pairing a x + (weightedConditional η hη (fun j => inverseWeight 1 (y j)) B)+ + WeightedGenerator.pairing b y + (weightedConditionalRight η hη (fun i => inverseWeight 1 (x i)) B) := by + let y2 := fun j => inverseWeight 1 (y j) + let x2 := fun i => inverseWeight 1 (x i) + let F1 := weightedSlices η hη y2 (I := I) + let F2 := weightedSlicesRight η hη x2 (I := J) + have hy2 : Summable (fun j => ‖y2 j‖^2) := CrossEnsemble.applied_summable hy (inverseWeight 1) + have hx2 : Summable (fun i => ‖x2 i‖^2) := CrossEnsemble.applied_summable hx (inverseWeight 1) + have hy2n : HasSum (fun j => ‖inverseWeight 2 (y2 j)‖^2) 1 := by + simpa only [y2,inverse_two_one] using hyn + have hx2n : HasSum (fun i => ‖inverseWeight 2 (x2 i)‖^2) 1 := by + simpa only [x2,inverse_two_one] using hxn + have hF1 : ∀ u, Summable (fun i => ‖u i‖^2) → Summable (fun k => ‖F1 u k‖^2) := + fun u hu => weightedSlices_summable η hη y2 hy2 u hu + have hF2 : ∀ u, Summable (fun j => ‖u j‖^2) → Summable (fun k => ‖F2 u k‖^2) := + fun u hu => weightedSlicesRight_summable η hη x2 hx2 u hu + let bas : HilbertBasis (NumberIndex n) ℂ (Fock n) := + HilbertBasis.ofRepr (LinearIsometryEquiv.refl ℂ _) + have hh : ∀ Z, WeightedGenerator.pairing (η*a+(1-η)*b) z Z= + WeightedGenerator.pushedPairing F1 a x Z+WeightedGenerator.pushedPairing F2 b y Z := by + apply weighted_trace_ext bas (WeightedGenerator.generator (η*a+(1-η)*b) z) + (WeightedGenerator.pushedGenerator F1 a x+WeightedGenerator.pushedGenerator F2 b y) + · exact fun Z => WeightedGenerator.pairing_hasSum bas _ z hz Z + · intro Z + simpa only [add_apply,map_add,inner_add_right] using + (WeightedGenerator.pushedPairing_hasSum bas F1 hF1 a x hx Z).add + (WeightedGenerator.pushedPairing_hasSum bas F2 hF2 b y hy Z) + · intro Z + rw [weighted_pairing_physical, + weighted_pushed_pairing_physical η hη y2 hy2n a x hx Z, + weighted_pushed_pairing_physical_right η hη x2 hx2n b y hy Z] + simp only [y2,x2,inverse_two_one] + exact physical_product_generator η a b hη ρ σ τ hτ x y z hx hy hz hxn hyn hex hey hez Z + rw [hh] + congr 1 + · apply WeightedGenerator.pushedPairing_slicing F1 B _ _ a x hx + intro u v hu hv + exact weighted_pairing_slicing η hη y2 hy2 u v hu hv B + · apply WeightedGenerator.pushedPairing_slicing F2 B _ _ b y hy + intro u v hu hv + exact weighted_pairing_slicing_right η hη x2 hx2 u v hu hv B +end BeamLadder + +namespace CrossEnsemble +open EntropyPhotonNumber +open scoped ComplexConjugate +variable {n : ℕ} {I : Type*} + +theorem entry_transform (u v x y : I → Fock n) + (hu : Summable (fun i => ‖u i‖^2)) (hv : Summable (fun i => ‖v i‖^2)) + (hx : Summable (fun i => ‖x i‖^2)) (hy : Summable (fun i => ‖y i‖^2)) + (a b c d : NumberIndex n) (s t : ℂ) + (he : ∀ i, u i a*conj (v i b)=s*conj t*(x i c*conj (y i d))) : + entry (operator u v) a b=s*conj t*entry (operator x y) c d := by + exact (coordinate_hasSum u v hu hv a b).unique + (by simpa only [he] using (coordinate_hasSum x y hx hy c d).mul_left (s*conj t)) +end CrossEnsemble + +end + +end OAI diff --git a/lean/OAI/InformationTheory/PhotonNumber/BeamTrace.lean b/lean/OAI/InformationTheory/PhotonNumber/BeamTrace.lean new file mode 100644 index 0000000000000000000000000000000000000000..0af132af5d0035f547990edd6eacb9fecb4427ad --- /dev/null +++ b/lean/OAI/InformationTheory/PhotonNumber/BeamTrace.lean @@ -0,0 +1,1283 @@ +import OAI.MathematicalPhysics.Fock.Beam +import OAI.InformationTheory.PhotonNumber.Gibbs +import OAI.Analysis.TensorLp + +namespace OAI + +noncomputable section + +section +open scoped BigOperators ComplexConjugate ENNReal Topology +open MeasureTheory +open scoped ComplexConjugate +open scoped BigOperators ComplexConjugate +open scoped BigOperators +open MvPolynomial +open scoped BigOperators ComplexConjugate Classical +open Submodule + +namespace Annihilation +open EntropyPhotonNumber QuantumTrace +variable {n : ℕ} +theorem weight_down (j : Fin n) (k : NumberIndex n) (hk : 0 < k j) : + numberWeight (down j k)=numberWeight k-1 := by + have hh := weight_up j (down j k) + rw [up_down j k hk] at hh + linarith +end Annihilation + +namespace BeamLadder +open EntropyPhotonNumber QuantumTrace Annihilation +variable {n : ℕ} +def W (ke : NumberIndex n × NumberIndex n) : ℝ := numberWeight ke.1+numberWeight ke.2-1 + +theorem W_one_le (ke : NumberIndex n × NumberIndex n) : 1 ≤ W ke := by + dsimp [W] + linarith [numberWeight_one_le ke.1, numberWeight_one_le ke.2] + +def upL (j : Fin n) (ke : NumberIndex n × NumberIndex n) := (up j ke.1,ke.2) +def upR (j : Fin n) (ke : NumberIndex n × NumberIndex n) := (ke.1,up j ke.2) + +theorem upL_inj (j : Fin n) : Function.Injective (upL j) := by + intro x y h + change (up j x.1,x.2)=(up j y.1,y.2) at h + exact Prod.ext (up_injective j (Prod.mk.inj h).1) (Prod.mk.inj h).2 +theorem upR_inj (j : Fin n) : Function.Injective (upR j) := by + intro x y h + change (x.1,up j x.2)=(y.1,up j y.2) at h + exact Prod.ext (Prod.mk.inj h).1 (up_injective j (Prod.mk.inj h).2) +@[simp] theorem W_upL (j : Fin n) (ke : NumberIndex n × NumberIndex n) : W (upL j ke)=W ke+1 := by + simp only [W, upL, weight_up] + ring +@[simp] theorem W_upR (j : Fin n) (ke : NumberIndex n × NumberIndex n) : W (upR j ke)=W ke+1 := by + simp only [W, upR, weight_up] + ring + +theorem up_update (j : Fin n) (k : NumberIndex n) : up j k=Function.update k j (k j+1) := by + funext i + by_cases he : i=j + · subst i; simp + · simp [he] + +theorem coordinate_le (j : Fin n) (k : NumberIndex n) : (k j:ℝ)+1 ≤ numberWeight k := by + unfold numberWeight + have hh : (k j:ℝ) ≤ ∑ i : Fin n, (k i:ℝ) := Finset.single_le_sum (fun (i : Fin n) (_hi : i ∈ Finset.univ) => Nat.cast_nonneg (k i)) (Finset.mem_univ j) + linarith + +theorem lowerL_bound (j : Fin n) (ke : NumberIndex n × NumberIndex n) : + ‖((Real.sqrt ((ke.1 j:ℝ)+1)/(W ke+1):ℝ):ℂ)‖ ≤ 1 := by + have hw : 0 < W ke+1 := by linarith [W_one_le ke] + rw [Complex.norm_real, Real.norm_eq_abs, abs_of_nonneg (div_nonneg (Real.sqrt_nonneg _) hw.le)] + apply (div_le_one (by linarith [W_one_le ke])).mpr + have hs : Real.sqrt ((ke.1 j:ℝ)+1) ≤ (ke.1 j:ℝ)+1 := Real.sqrt_le_self_iff.mpr (Or.inr (by linarith [Nat.cast_nonneg (ke.1 j) (α:=ℝ)])) + dsimp [W] + linarith [coordinate_le j ke.1, numberWeight_one_le ke.2] + +theorem lowerR_bound (j : Fin n) (ke : NumberIndex n × NumberIndex n) : + ‖((Real.sqrt ((ke.2 j:ℝ)+1)/(W ke+1):ℝ):ℂ)‖ ≤ 1 := by + have hw : 0 < W ke+1 := by linarith [W_one_le ke] + rw [Complex.norm_real, Real.norm_eq_abs, abs_of_nonneg (div_nonneg (Real.sqrt_nonneg _) hw.le)] + apply (div_le_one (by linarith [W_one_le ke])).mpr + have hs : Real.sqrt ((ke.2 j:ℝ)+1) ≤ (ke.2 j:ℝ)+1 := Real.sqrt_le_self_iff.mpr (Or.inr (by linarith [Nat.cast_nonneg (ke.2 j) (α:=ℝ)])) + dsimp [W] + linarith [coordinate_le j ke.2, numberWeight_one_le ke.1] + +def lowerL (j : Fin n) : JointFock n →L[ℂ] JointFock n := + WeightedShift.pullCLM (upL j) (upL_inj j) + (fun ke => ((Real.sqrt ((ke.1 j:ℝ)+1)/(W ke+1):ℝ):ℂ)) 1 (by norm_num) (lowerL_bound j) +def lowerR (j : Fin n) : JointFock n →L[ℂ] JointFock n := + WeightedShift.pullCLM (upR j) (upR_inj j) + (fun ke => ((Real.sqrt ((ke.2 j:ℝ)+1)/(W ke+1):ℝ):ℂ)) 1 (by norm_num) (lowerR_bound j) +@[simp] theorem lowerL_apply (j : Fin n) (x : JointFock n) (ke : NumberIndex n × NumberIndex n) : + lowerL j x ke=((Real.sqrt ((ke.1 j:ℝ)+1)/(W ke+1):ℝ):ℂ)*x (upL j ke) := rfl +@[simp] theorem lowerR_apply (j : Fin n) (x : JointFock n) (ke : NumberIndex n × NumberIndex n) : + lowerR j x ke=((Real.sqrt ((ke.2 j:ℝ)+1)/(W ke+1):ℝ):ℂ)*x (upR j ke) := rfl + +theorem lowerL_single (j : Fin n) (a b : NumberIndex n) : + lowerL j (lp.single 2 (a,b) 1)= + ((Real.sqrt (a j)/W (a,b):ℝ):ℂ) • lp.single 2 (down j a,b) 1 := by + by_cases ha : 0 arg 2; arg 2; rw [he] + rw [lowerL, WeightedShift.pullCLM_single] + have hw : W (down j a,b)+1=W (a,b) := by simpa only [upL, up_down j a ha] using W_upL j (down j a,b) |>.symm + have hc : ((down j a) j:ℝ)+1=a j := by + rw [down, Function.update_self] + exact_mod_cast (Nat.sub_add_cancel ha) + simp only [hc, hw, mul_one] + simpa only [smul_eq_mul, mul_one] using lp.single_smul (E:=fun _ : NumberIndex n × NumberIndex n => ℂ) 2 (down j a,b) ((Real.sqrt (a j)/W (a,b):ℝ):ℂ) (1:ℂ) + · have hz : a j=0 := Nat.eq_zero_of_not_pos ha + have hout (ke : NumberIndex n × NumberIndex n) : upL j ke ≠ (a,b) := by + intro he + have hh := congrArg (fun p : NumberIndex n × NumberIndex n => p.1 j) he + simp [upL, hz] at hh + rw [lowerL, WeightedShift.pullCLM_single_outside _ _ _ _ _ _ _ hout] + simp [hz] + +theorem lowerR_single (j : Fin n) (a b : NumberIndex n) : + lowerR j (lp.single 2 (a,b) 1)= + ((Real.sqrt (b j)/W (a,b):ℝ):ℂ) • lp.single 2 (a,down j b) 1 := by + by_cases hb : 0 arg 2; arg 2; rw [he] + rw [lowerR, WeightedShift.pullCLM_single] + have hw : W (a,down j b)+1=W (a,b) := by simpa only [upR, up_down j b hb] using W_upR j (a,down j b) |>.symm + have hc : ((down j b) j:ℝ)+1=b j := by + rw [down, Function.update_self] + exact_mod_cast (Nat.sub_add_cancel hb) + simp only [hc, hw, mul_one] + simpa only [smul_eq_mul, mul_one] using lp.single_smul (E:=fun _ : NumberIndex n × NumberIndex n => ℂ) 2 (a,down j b) ((Real.sqrt (b j)/W (a,b):ℝ):ℂ) (1:ℂ) + · have hz : b j=0 := Nat.eq_zero_of_not_pos hb + have hout (ke : NumberIndex n × NumberIndex n) : upR j ke ≠ (a,b) := by + intro he + have hh := congrArg (fun p : NumberIndex n × NumberIndex n => p.2 j) he + simp [upR, hz] at hh + rw [lowerR, WeightedShift.pullCLM_single_outside _ _ _ _ _ _ _ hout] + simp [hz] + +theorem coefficient_W (η : ℝ) (k e a b : NumberIndex n) (hc : beamCoefficient η k e a b ≠ 0) : + W (k,e)=W (a,b) := by + have hj (j : Fin n) : k j+e j=a j+b j := by + have hp := (Finset.prod_ne_zero_iff.mp hc) j (Finset.mem_univ j) + by_contra hh + apply hp + simp only [oneModeBeamCoefficient, ite_eq_right hh] + have hs : (∑ j, (k j:ℝ))+(∑ j, (e j:ℝ))=(∑ j, (a j:ℝ))+(∑ j, (b j:ℝ)) := by + simp only [← Finset.sum_add_distrib] + apply Finset.sum_congr rfl + intro j _ + exact_mod_cast hj j + dsimp [W, numberWeight] + linarith + +theorem inverse_W_coefficient (η : ℝ) (j : Fin n) (k e a b : NumberIndex n) : + (W (k,e)+1)⁻¹*beamCoefficient η (up j k) e a b= + (W (a,b))⁻¹*beamCoefficient η (up j k) e a b := by + by_cases hc : beamCoefficient η (up j k) e a b=0 + · simp [hc] + · have hh : W (k,e)+1=W (a,b) := by + rw [← W_upL j (k,e)] + exact coefficient_W η _ _ _ _ hc + rw [hh] + +theorem retained_covariance (η : ℝ) (hη : η ∈ Set.Icc 0 1) (j : Fin n) : + lowerL j ∘L (beamUnitary η hη).toContinuousLinearEquiv.toContinuousLinearMap = + (beamUnitary η hη).toContinuousLinearEquiv.toContinuousLinearMap ∘L + ((Real.sqrt η:ℂ) • lowerL j+(Real.sqrt (1-η):ℂ) • lowerR j) := by + apply lp.ext_continuousLinearMap (by norm_num : (2:ENNReal) ≠ ⊤) + intro ab + apply ContinuousLinearMap.ext_ring + change lowerL j (beamUnitary η hη (lp.single 2 ab 1))= + beamUnitary η hη (((Real.sqrt η:ℂ) • lowerL j+(Real.sqrt (1-η):ℂ) • lowerR j) (lp.single 2 ab 1)) + obtain ⟨a,b⟩ := ab + simp only [add_apply, smul_apply, lowerL_single, lowerR_single, map_add, map_smul] + apply lp.ext + funext ke + obtain ⟨k,e⟩ := ke + simp only [lowerL_apply, upL, beam_coordinate, lp.coeFn_add, lp.coeFn_smul, Pi.add_apply, Pi.smul_apply, smul_eq_mul] + have hh := beam_retained_lower η j k e a b + rw [← up_update] at hh + change _=(Real.sqrt η:ℂ)*(((Real.sqrt (a j)/W (a,b):ℝ):ℂ)*(beamCoefficient η k e (down j a) b:ℂ))+ + (Real.sqrt (1-η):ℂ)*(((Real.sqrt (b j)/W (a,b):ℝ):ℂ)*(beamCoefficient η k e a (down j b):ℂ)) + have hw := inverse_W_coefficient η j k e a b + norm_cast + dsimp [down] at * + norm_num only [Nat.cast_add, Nat.cast_one] at * + linear_combination (Real.sqrt ((k j:ℝ)+1))*hw+(W (a,b))⁻¹*hh +end BeamLadder + +namespace EntropyPhotonNumber + theorem beam_discarded_lower {n : ℕ} (η : ℝ) (j : Fin n) (k e a b : NumberIndex n) : + Real.sqrt ((e j:ℝ)+1)*beamCoefficient η k (Function.update e j (e j+1)) a b = + -(Real.sqrt (1-η)*Real.sqrt (a j))*beamCoefficient η k e (Function.update a j (a j-1)) b+ + Real.sqrt η*Real.sqrt (b j)*beamCoefficient η k e a (Function.update b j (b j-1)) := by + exact beam_product_lower j (fun _ e k a b => oneModeBeamCoefficient η k e a b) e k a b + _ _ _ (oneMode_discarded_lower η (k j) (e j) (a j) (b j)) +end EntropyPhotonNumber + +namespace BeamLadder + +section +open EntropyPhotonNumber QuantumTrace Annihilation +variable {n : ℕ} + +theorem inverse_W_coefficient_right (η : ℝ) (j : Fin n) (k e a b : NumberIndex n) : + (W (k,e)+1)⁻¹*beamCoefficient η k (up j e) a b= + (W (a,b))⁻¹*beamCoefficient η k (up j e) a b := by + by_cases hc : beamCoefficient η k (up j e) a b=0 + · simp [hc] + · have hh : W (k,e)+1=W (a,b) := by + rw [← W_upR j (k,e)] + exact coefficient_W η _ _ _ _ hc + rw [hh] + +theorem discarded_covariance (η : ℝ) (hη : η ∈ Set.Icc 0 1) (j : Fin n) : + lowerR j ∘L (beamUnitary η hη).toContinuousLinearEquiv.toContinuousLinearMap = + (beamUnitary η hη).toContinuousLinearEquiv.toContinuousLinearMap ∘L + (-(Real.sqrt (1-η):ℂ) • lowerL j+(Real.sqrt η:ℂ) • lowerR j) := by + apply lp.ext_continuousLinearMap (by norm_num : (2:ENNReal) ≠ ⊤) + intro ab + apply ContinuousLinearMap.ext_ring + change lowerR j (beamUnitary η hη (lp.single 2 ab 1))= + beamUnitary η hη ((-(Real.sqrt (1-η):ℂ) • lowerL j+(Real.sqrt η:ℂ) • lowerR j) (lp.single 2 ab 1)) + obtain ⟨a,b⟩ := ab + simp only [add_apply, smul_apply, lowerL_single, lowerR_single, map_add, map_smul] + apply lp.ext + funext ke + obtain ⟨k,e⟩ := ke + simp only [lowerR_apply, upR, beam_coordinate, lp.coeFn_add, lp.coeFn_smul, Pi.add_apply, Pi.smul_apply, smul_eq_mul] + have hh := beam_discarded_lower η j k e a b + rw [← up_update] at hh + change _= -(Real.sqrt (1-η):ℂ)*(((Real.sqrt (a j)/W (a,b):ℝ):ℂ)*(beamCoefficient η k e (down j a) b:ℂ))+ + (Real.sqrt η:ℂ)*(((Real.sqrt (b j)/W (a,b):ℝ):ℂ)*(beamCoefficient η k e a (down j b):ℂ)) + have hw := inverse_W_coefficient_right η j k e a b + norm_cast + dsimp [down] at * + norm_num only [Nat.cast_add, Nat.cast_one] at * + linear_combination (Real.sqrt ((e j:ℝ)+1))*hw+(W (a,b))⁻¹*hh +end + +section +open EntropyPhotonNumber QuantumTrace Annihilation +open scoped ComplexConjugate +variable {n : ℕ} + +def radial (f : ℝ → ℝ) (C : ℝ) (hC : 0≤C) (hf : ∀ ke : NumberIndex n × NumberIndex n, |f (W ke)|≤C) : + JointFock n →L[ℂ] JointFock n := + WeightedShift.pullCLM id Function.injective_id (fun ke => (f (W ke):ℂ)) C hC + (fun ke => by simpa only [Complex.norm_real, Real.norm_eq_abs] using hf ke) + +@[simp] theorem radial_apply (f : ℝ → ℝ) (C : ℝ) (hC : 0≤C) + (hf : ∀ ke : NumberIndex n × NumberIndex n, |f (W ke)|≤C) + (x : JointFock n) (ke : NumberIndex n × NumberIndex n) : + radial f C hC hf x ke=(f (W ke):ℂ)*x ke := rfl + +theorem radial_single (f : ℝ → ℝ) (C : ℝ) (hC : 0≤C) + (hf : ∀ ke : NumberIndex n × NumberIndex n, |f (W ke)|≤C) + (ke : NumberIndex n × NumberIndex n) : + radial f C hC hf (lp.single 2 ke 1)=(f (W ke):ℂ) • lp.single 2 ke 1 := by + apply lp.ext + funext ab + by_cases he : ab=ke + · subst ab + simp only [radial_apply, lp.coeFn_smul, Pi.smul_apply, smul_eq_mul, lp.single_apply] + · simp only [radial_apply, lp.coeFn_smul, Pi.smul_apply, smul_eq_mul, lp.coeFn_single, Pi.single_apply, ite_eq_right he, mul_zero] + +theorem radial_covariance (η : ℝ) (hη : η ∈ Set.Icc 0 1) + (f : ℝ → ℝ) (C : ℝ) (hC : 0≤C) + (hf : ∀ ke : NumberIndex n × NumberIndex n, |f (W ke)|≤C) : + radial f C hC hf ∘L (beamUnitary η hη).toContinuousLinearEquiv.toContinuousLinearMap = + (beamUnitary η hη).toContinuousLinearEquiv.toContinuousLinearMap ∘L radial f C hC hf := by + apply lp.ext_continuousLinearMap (by norm_num : (2:ENNReal)≠⊤) + intro ab + apply ContinuousLinearMap.ext_ring + change radial f C hC hf (beamUnitary η hη (lp.single 2 ab 1))= + beamUnitary η hη (radial f C hC hf (lp.single 2 ab 1)) + rw [radial_single, map_smul] + obtain ⟨a,b⟩ := ab + apply lp.ext + funext ke + obtain ⟨k,e⟩ := ke + simp only [radial_apply, beam_coordinate, lp.coeFn_smul, Pi.smul_apply, smul_eq_mul] + by_cases hc : beamCoefficient η k e a b=0 + · simp only [hc, Complex.ofReal_zero, mul_zero] + · rw [coefficient_W η k e a b hc] + +theorem adjoint_covariance {E : Type*} [NormedAddCommGroup E] [InnerProductSpace ℂ E] + [CompleteSpace E] (U : E ≃ₗᵢ[ℂ] E) (A B : E →L[ℂ] E) + (h : A ∘L U.toContinuousLinearEquiv.toContinuousLinearMap= + U.toContinuousLinearEquiv.toContinuousLinearMap ∘L B) : + A.adjoint ∘L U.toContinuousLinearEquiv.toContinuousLinearMap= + U.toContinuousLinearEquiv.toContinuousLinearMap ∘L B.adjoint := by + apply ContinuousLinearMap.ext + intro y + apply ext_inner_left ℂ + intro x + change inner ℂ x (A.adjoint (U y))=inner ℂ x (U (B.adjoint y)) + rw [ContinuousLinearMap.adjoint_inner_right] + have hh : A x=U (B (U.symm x)) := by + have hh := congrArg (fun T : E →L[ℂ] E => T (U.symm x)) h + change A (U (U.symm x))=U (B (U.symm x)) at hh + simpa only [U.apply_symm_apply] using hh + rw [hh, U.inner_map_map] + rw [← ContinuousLinearMap.adjoint_inner_right] + exact (U.inner_map_map (U.symm x) (B.adjoint y)).symm.trans (by rw [U.apply_symm_apply]) + +theorem retained_adjoint_covariance (η : ℝ) (hη : η ∈ Set.Icc 0 1) (j : Fin n) : + (lowerL j).adjoint ∘L (beamUnitary η hη).toContinuousLinearEquiv.toContinuousLinearMap = + (beamUnitary η hη).toContinuousLinearEquiv.toContinuousLinearMap ∘L + ((Real.sqrt η:ℂ) • (lowerL j).adjoint+(Real.sqrt (1-η):ℂ) • (lowerR j).adjoint) := by + simpa only [map_add, map_smulₛₗ, Complex.conj_ofReal] using + adjoint_covariance (beamUnitary η hη) (lowerL j) _ (retained_covariance η hη j) + +theorem discarded_adjoint_covariance (η : ℝ) (hη : η ∈ Set.Icc 0 1) (j : Fin n) : + (lowerR j).adjoint ∘L (beamUnitary η hη).toContinuousLinearEquiv.toContinuousLinearMap = + (beamUnitary η hη).toContinuousLinearEquiv.toContinuousLinearMap ∘L + (-(Real.sqrt (1-η):ℂ) • (lowerL j).adjoint+(Real.sqrt η:ℂ) • (lowerR j).adjoint) := by + simpa only [map_add, map_smulₛₗ, map_neg, Complex.conj_ofReal] using + adjoint_covariance (beamUnitary η hη) (lowerR j) _ (discarded_covariance η hη j) +end + +section +open EntropyPhotonNumber QuantumTrace Annihilation +variable {n : ℕ} + +def increase (w : ℝ) : ℝ := if 1 q.1 j) he + simp only [upL, up_same, hk] at hh + omega + +theorem raiseR_zero (j : Fin n) (x : JointFock n) (ke : NumberIndex n × NumberIndex n) + (hk : ke.2 j=0) : raiseR j x ke=0 := by + change _*((lowerR j).adjoint x ke)=0 + rw [lowerR, WeightedShift.adjoint_apply_outside] + · exact mul_zero _ + · intro ab he + have hh := congrArg (fun q => q.2 j) he + simp only [upR, up_same, hk] at hh + omega +end + +section +open EntropyPhotonNumber QuantumTrace Annihilation TensorLp +open scoped ComplexConjugate +variable {n : ℕ} + +theorem inverse_bound (ke : NumberIndex n × NumberIndex n) : |(W ke)⁻¹|≤1 := by + rw [abs_of_nonneg (inv_nonneg.mpr (by linarith [W_one_le ke]))] + exact inv_le_one_of_one_le₀ (W_one_le ke) + +def inverse : JointFock n →L[ℂ] JointFock n := + radial (fun t => t⁻¹) 1 (by norm_num) inverse_bound + +@[simp] theorem inverse_apply (x : JointFock n) (ke : NumberIndex n × NumberIndex n) : + inverse x ke=((W ke)⁻¹:ℂ)*x ke := by + change (((W ke)⁻¹:ℝ):ℂ)*x ke=_ + rw [Complex.ofReal_inv] + +theorem inverse_selfAdjoint : IsSelfAdjoint (inverse (n:=n)) := by + apply ContinuousLinearMap.isSelfAdjoint_iff_isSymmetric.mpr + intro x y + apply HasSum.unique (lp.hasSum_inner (𝕜:=ℂ) (inverse x) y) + convert! lp.hasSum_inner (𝕜:=ℂ) x (inverse y) using 1 + ext ke + simp only [inverse_apply, RCLike.inner_apply, map_mul, map_inv₀, Complex.conj_ofReal] + ring + +theorem inverse_covariance (η : ℝ) (hη : η ∈ Set.Icc 0 1) : + inverse ∘L (beamUnitary (n:=n) η hη).toContinuousLinearEquiv.toContinuousLinearMap = + (beamUnitary η hη).toContinuousLinearEquiv.toContinuousLinearMap ∘L inverse := + radial_covariance η hη (fun t => t⁻¹) 1 (by norm_num) inverse_bound + +theorem slice_raiseR_up (j : Fin n) (x : JointFock n) (e : NumberIndex n) : + slice (raiseR j x) (up j e)=(Real.sqrt ((e j:ℝ)+1):ℂ) • slice (inverse x) e := by + apply lp.ext + funext k + change raiseR j x (upR j (k,e))=_ + rw [raiseR_up] + simp only [slice_apply, lp.coeFn_smul, Pi.smul_apply, smul_eq_mul, inverse_apply, + div_eq_mul_inv] + push_cast + ring + +theorem slice_raiseR_zero (j : Fin n) (x : JointFock n) (e : NumberIndex n) + (he : e j=0) : slice (raiseR j x) e=0 := by + apply lp.ext + funext k + exact raiseR_zero j x (k,e) he + +theorem discarded_commutator_operator (j : Fin n) (Z : Fock n →L[ℂ] Fock n) : + inverse ∘L liftLeft Z ∘L raiseR j = + (lowerR j).adjoint ∘L liftLeft Z ∘L inverse := by + apply ContinuousLinearMap.ext + intro x + apply lp.ext + funext ke + obtain ⟨k,e⟩ := ke + by_cases he : 0 q.2 j) hh + simp only [upR, up_same, hz] at h + omega + +theorem discarded_commutator (j : Fin n) (Z : Fock n →L[ℂ] Fock n) + (x y : JointFock n) : + inner ℂ (inverse x) (liftLeft Z (raiseR j y))= + inner ℂ (lowerR j x) (liftLeft Z (inverse y)) := by + have hi : inner ℂ (inverse x) (liftLeft Z (raiseR j y))= + inner ℂ x (inverse (liftLeft Z (raiseR j y))) := + (ContinuousLinearMap.isSelfAdjoint_iff_isSymmetric.mp (inverse_selfAdjoint (n:=n))) x _ + rw [hi] + have hh := congrArg (fun T : JointFock n →L[ℂ] JointFock n => T y) + (discarded_commutator_operator j Z) + change inverse (liftLeft Z (raiseR j y))=(lowerR j).adjoint (liftLeft Z (inverse y)) at hh + rw [hh, ContinuousLinearMap.adjoint_inner_right] + +def conjugate (η : ℝ) (hη : η ∈ Set.Icc 0 1) (Z : Fock n →L[ℂ] Fock n) : + JointFock n →L[ℂ] JointFock n := + (beamUnitary η hη).symm.toContinuousLinearEquiv.toContinuousLinearMap ∘L + liftLeft Z ∘L (beamUnitary η hη).toContinuousLinearEquiv.toContinuousLinearMap + +theorem conjugate_inner (η : ℝ) (hη : η ∈ Set.Icc 0 1) (Z : Fock n →L[ℂ] Fock n) + (x y : JointFock n) : + inner ℂ x (conjugate η hη Z y)=inner ℂ (beamUnitary η hη x) (liftLeft Z (beamUnitary η hη y)) := by + change inner ℂ x ((beamUnitary η hη).symm (liftLeft Z (beamUnitary η hη y)))=_ + rw [← (beamUnitary η hη).inner_map_map, (beamUnitary η hη).apply_symm_apply] + +theorem covariance_lower_apply (η : ℝ) (hη : η ∈ Set.Icc 0 1) (j : Fin n) (x : JointFock n) : + lowerL j (beamUnitary η hη x)=(Real.sqrt η:ℂ) • beamUnitary η hη (lowerL j x)+ + (Real.sqrt (1-η):ℂ) • beamUnitary η hη (lowerR j x) := by + have hh := congrArg (fun T : JointFock n →L[ℂ] JointFock n => T x) (retained_covariance η hη j) + change lowerL j (beamUnitary η hη x)=beamUnitary η hη ((Real.sqrt η:ℂ) • lowerL j x+(Real.sqrt (1-η):ℂ) • lowerR j x) at hh + simpa only [map_add, map_smul] using hh + +theorem covariance_raise_apply (η : ℝ) (hη : η ∈ Set.Icc 0 1) (j : Fin n) (x : JointFock n) : + raiseL j (beamUnitary η hη x)=(Real.sqrt η:ℂ) • beamUnitary η hη (raiseL j x)+ + (Real.sqrt (1-η):ℂ) • beamUnitary η hη (raiseR j x) := by + have hh := congrArg (fun T : JointFock n →L[ℂ] JointFock n => T x) (retained_creation_covariance η hη j) + change raiseL j (beamUnitary η hη x)=beamUnitary η hη ((Real.sqrt η:ℂ) • raiseL j x+(Real.sqrt (1-η):ℂ) • raiseR j x) at hh + simpa only [map_add, map_smul] using hh + +theorem covariance_inverse_apply (η : ℝ) (hη : η ∈ Set.Icc 0 1) (x : JointFock n) : + inverse (beamUnitary η hη x)=beamUnitary η hη (inverse x) := + congrArg (fun T : JointFock n →L[ℂ] JointFock n => T x) (inverse_covariance η hη) + +theorem covariance_discarded_lower_apply (η : ℝ) (hη : η ∈ Set.Icc 0 1) (j : Fin n) (x : JointFock n) : + lowerR j (beamUnitary η hη x)=-(Real.sqrt (1-η):ℂ) • beamUnitary η hη (lowerL j x)+ + (Real.sqrt η:ℂ) • beamUnitary η hη (lowerR j x) := by + have hh := congrArg (fun T : JointFock n →L[ℂ] JointFock n => T x) (discarded_covariance η hη j) + change lowerR j (beamUnitary η hη x)=beamUnitary η hη (-(Real.sqrt (1-η):ℂ) • lowerL j x+(Real.sqrt η:ℂ) • lowerR j x) at hh + simpa only [map_add, map_smul] using hh + +theorem covariance_discarded_raise_apply (η : ℝ) (hη : η ∈ Set.Icc 0 1) (j : Fin n) (x : JointFock n) : + raiseR j (beamUnitary η hη x)=-(Real.sqrt (1-η):ℂ) • beamUnitary η hη (raiseL j x)+ + (Real.sqrt η:ℂ) • beamUnitary η hη (raiseR j x) := by + have hh := congrArg (fun T : JointFock n →L[ℂ] JointFock n => T x) (discarded_creation_covariance η hη j) + change raiseR j (beamUnitary η hη x)=beamUnitary η hη (-(Real.sqrt (1-η):ℂ) • raiseL j x+(Real.sqrt η:ℂ) • raiseR j x) at hh + simpa only [map_add, map_smul] using hh + +theorem two_port_algebra (c s r a b A B C D : ℂ) (hs : c^2+s^2=1) + (hr : r=c^2*a+s^2*b) (hd : -s*A+c*B= -s*C+c*D) : + (r+1)*(c*A+s*B)-r*(c*C+s*D)= + c*((a+1)*A-a*C)+s*((b+1)*B-b*D) := by + rw [hr] + linear_combination (c*a*(A-C)+s*b*(B-D))*hs+c*s*(a-b)*hd + +def weakL (r : ℝ) (j : Fin n) (x y : JointFock n) + (T : JointFock n →L[ℂ] JointFock n) : ℂ := + (r+1:ℂ)*inner ℂ (lowerL j x) (T (inverse y))- + (r:ℂ)*inner ℂ (inverse x) (T (raiseL j y)) + +def weakR (r : ℝ) (j : Fin n) (x y : JointFock n) + (T : JointFock n →L[ℂ] JointFock n) : ℂ := + (r+1:ℂ)*inner ℂ (lowerR j x) (T (inverse y))- + (r:ℂ)*inner ℂ (inverse x) (T (raiseR j y)) + +theorem physical_weak_covariance (η : ℝ) (hη : η ∈ Set.Icc 0 1) (a b : ℝ) (j : Fin n) + (x y : JointFock n) (Z : Fock n →L[ℂ] Fock n) : + weakL (η*a+(1-η)*b) j (beamUnitary η hη x) (beamUnitary η hη y) (liftLeft Z)= + (Real.sqrt η:ℂ)*weakL a j x y (conjugate η hη Z)+ + (Real.sqrt (1-η):ℂ)*weakR b j x y (conjugate η hη Z) := by + have hd := discarded_commutator j Z (beamUnitary η hη x) (beamUnitary η hη y) + rw [covariance_inverse_apply, covariance_inverse_apply, covariance_discarded_lower_apply, + covariance_discarded_raise_apply] at hd + simp only [map_add, map_smul, inner_add_left, inner_add_right, inner_smul_left, + inner_smul_right, map_neg, Complex.conj_ofReal, ← conjugate_inner] at hd + unfold weakL weakR + rw [covariance_lower_apply, covariance_raise_apply, covariance_inverse_apply, covariance_inverse_apply] + simp only [map_add, map_smul, inner_add_left, inner_add_right, inner_smul_left, + inner_smul_right, Complex.conj_ofReal, ← conjugate_inner] + apply two_port_algebra + · have hc : (Real.sqrt η:ℂ)^2=(η:ℂ) := by exact_mod_cast Real.sq_sqrt hη.1 + have hs : (Real.sqrt (1-η):ℂ)^2=(1-η:ℂ) := by exact_mod_cast Real.sq_sqrt (sub_nonneg.mpr hη.2) + rw [hc, hs] + ring + · norm_cast + rw [Real.sq_sqrt hη.1, Real.sq_sqrt (sub_nonneg.mpr hη.2)] + · exact hd.symm +end + +open EntropyPhotonNumber QuantumTrace Annihilation TensorLp +variable {n : ℕ} + +def tensorPreimage (x y : Fock n) : JointFock n := + tensor (inverseWeight 2 x) (inverseWeight 3 y)+ + tensor (inverseWeight 3 x) (inverseWeight 2 y)- + tensor (inverseWeight 3 x) (inverseWeight 3 y) + +theorem tensorPreimage_apply (x y : Fock n) (k e : NumberIndex n) : + tensorPreimage x y (k,e)=(W (k,e):ℂ)*inverseWeight 3 x k*inverseWeight 3 y e := by + have hk : (numberWeight k:ℂ)≠0 := by exact_mod_cast (by linarith [numberWeight_one_le k] : numberWeight k≠0) + have he : (numberWeight e:ℂ)≠0 := by exact_mod_cast (by linarith [numberWeight_one_le e] : numberWeight e≠0) + simp only [tensorPreimage, lp.coeFn_sub, lp.coeFn_add, Pi.sub_apply, Pi.add_apply, + tensor_apply, inverseWeight_apply, W] + push_cast + field_simp + +theorem tensorPreimage_inverse (x y : Fock n) : + inverse (tensorPreimage x y)=tensor (inverseWeight 3 x) (inverseWeight 3 y) := by + apply lp.ext + funext ke + obtain ⟨k,e⟩ := ke + rw [inverse_apply, tensorPreimage_apply, tensor_apply] + have hw : (W (k,e):ℂ)≠0 := by exact_mod_cast (by linarith [W_one_le (k,e)] : W (k,e)≠0) + field_simp + +theorem tensorPreimage_lowerL (j : Fin n) (x y : Fock n) : + lowerL j (tensorPreimage x y)=tensor (sandwich 0 3 (by omega) j x) (inverseWeight 3 y) := by + apply lp.ext + funext ke + obtain ⟨k,e⟩ := ke + simp only [lowerL_apply, upL, tensorPreimage_apply, tensor_apply, sandwich_apply, coefficient, + pow_zero, one_mul, inverseWeight_apply] + have hh := W_upL j (k,e) + change W (up j k,e)=W (k,e)+1 at hh + rw [hh] + have hw : (W (k,e):ℂ)+1≠0 := by exact_mod_cast (by linarith [W_one_le (k,e)] : W (k,e)+1≠0) + push_cast + field_simp + +theorem tensorPreimage_lowerR (j : Fin n) (x y : Fock n) : + lowerR j (tensorPreimage x y)=tensor (inverseWeight 3 x) (sandwich 0 3 (by omega) j y) := by + apply lp.ext + funext ke + obtain ⟨k,e⟩ := ke + simp only [lowerR_apply, upR, tensorPreimage_apply, tensor_apply, sandwich_apply, coefficient, + pow_zero, one_mul, inverseWeight_apply] + have hh := W_upR j (k,e) + change W (k,up j e)=W (k,e)+1 at hh + rw [hh] + have hw : (W (k,e):ℂ)+1≠0 := by exact_mod_cast (by linarith [W_one_le (k,e)] : W (k,e)+1≠0) + push_cast + field_simp + +theorem tensorPreimage_raiseL (j : Fin n) (x y : Fock n) : + raiseL j (tensorPreimage x y)=tensor (creationSandwich 0 3 (by omega) j x) (inverseWeight 3 y) := by + apply lp.ext + funext ke + obtain ⟨k,e⟩ := ke + rcases index_cases j k with hk | ⟨a,rfl⟩ + · rw [raiseL_zero j _ (k,e) hk, tensor_apply, creationSandwich_zero _ _ _ _ _ k hk, zero_mul] + · change raiseL j (tensorPreimage x y) (upL j (a,e))=_ + rw [raiseL_up, tensorPreimage_apply, tensor_apply, creationSandwich_up] + have hw : (W (a,e):ℂ)≠0 := by exact_mod_cast (by linarith [W_one_le (a,e)] : W (a,e)≠0) + simp only [creationCoefficient, pow_zero, one_mul, inverseWeight_apply] + push_cast + field_simp + +theorem tensorPreimage_raiseR (j : Fin n) (x y : Fock n) : + raiseR j (tensorPreimage x y)=tensor (inverseWeight 3 x) (creationSandwich 0 3 (by omega) j y) := by + apply lp.ext + funext ke + obtain ⟨k,e⟩ := ke + rcases index_cases j e with he | ⟨b,rfl⟩ + · rw [raiseR_zero j _ (k,e) he, tensor_apply, creationSandwich_zero _ _ _ _ _ e he, mul_zero] + · change raiseR j (tensorPreimage x y) (upR j (k,b))=_ + rw [raiseR_up, tensorPreimage_apply, tensor_apply, creationSandwich_up] + have hw : (W (k,b):ℂ)≠0 := by exact_mod_cast (by linarith [W_one_le (k,b)] : W (k,b)≠0) + simp only [creationCoefficient, pow_zero, one_mul, inverseWeight_apply] + push_cast + field_simp + +theorem square_add_summable {I E : Type*} [NormedAddCommGroup E] {x y : I → E} + (hx : Summable (fun i => ‖x i‖^2)) (hy : Summable (fun i => ‖y i‖^2)) : + Summable (fun i => ‖x i+y i‖^2) := by + have hmx : Memℓp x 2 := by + simpa only [memℓp_gen_iff (by norm_num : (0:ℝ)<(2:ENNReal).toReal), ENNReal.toReal_ofNat, Real.rpow_two] using hx + have hmy : Memℓp y 2 := by + simpa only [memℓp_gen_iff (by norm_num : (0:ℝ)<(2:ENNReal).toReal), ENNReal.toReal_ofNat, Real.rpow_two] using hy + simpa only [memℓp_gen_iff (by norm_num : (0:ℝ)<(2:ENNReal).toReal), ENNReal.toReal_ofNat, Real.rpow_two, Pi.add_apply] using hmx.add hmy + +theorem tensorPreimage_summable {I J : Type*} (x : I → Fock n) (y : J → Fock n) + (hx : Summable (fun i => ‖x i‖^2)) (hy : Summable (fun j => ‖y j‖^2)) : + Summable (fun ij : I × J => ‖tensorPreimage (x ij.1) (y ij.2)‖^2) := by + have ht (a b : ℕ) : Summable (fun ij : I × J => ‖tensor (inverseWeight a (x ij.1)) (inverseWeight b (y ij.2))‖^2) := by + simpa only [tensor_norm_sq] using + (CrossEnsemble.applied_summable hx (inverseWeight a)).mul_of_nonneg + (CrossEnsemble.applied_summable hy (inverseWeight b)) (fun _ => sq_nonneg _) (fun _ => sq_nonneg _) + have hn : Summable (fun ij : I × J => ‖-tensor (inverseWeight 3 (x ij.1)) (inverseWeight 3 (y ij.2))‖^2) := by + simpa only [norm_neg] using ht 3 3 + simpa only [tensorPreimage, sub_eq_add_neg] using square_add_summable (square_add_summable (ht 2 3) (ht 3 2)) hn +end BeamLadder + +open scoped BigOperators ComplexConjugate ENNReal Topology +open MeasureTheory +open scoped ComplexConjugate +open scoped BigOperators ComplexConjugate +open scoped BigOperators +open MvPolynomial +open scoped BigOperators ComplexConjugate Classical +open Submodule +open ContinuousLinearMap + +namespace KrausBounded + +section +variable {E H I : Type*} [NormedAddCommGroup E] [InnerProductSpace ℂ E] + [NormedAddCommGroup H] [InnerProductSpace ℂ H] + +def wave (V : I → E →L[ℂ] H) (hs : ∀ x, Summable (fun i => ‖V i x‖^2)) (x : E) : + lp (fun _ : I => H) 2 := + ⟨fun i => V i x, (memℓp_gen_iff (by norm_num : 0 < (2 : ENNReal).toReal)).mpr + (by simpa only [ENNReal.toReal_ofNat, Real.rpow_two] using hs x)⟩ + +@[simp] theorem wave_apply (V : I → E →L[ℂ] H) (hs : ∀ x, Summable (fun i => ‖V i x‖^2)) + (x : E) (i : I) : wave V hs x i = V i x := rfl + + theorem wave_square (V : I → E →L[ℂ] H) (hs : ∀ x, Summable (fun i => ‖V i x‖^2)) (x : E) : + ‖wave V hs x‖^2 = ∑' i, ‖V i x‖^2 := by + symm + simpa only [ENNReal.toReal_ofNat, Real.rpow_two, wave_apply] using + (lp.hasSum_norm (p := 2) (by norm_num) (wave V hs x)).tsum_eq + +def linearMap (V : I → E →L[ℂ] H) (hs : ∀ x, Summable (fun i => ‖V i x‖^2)) : + E →ₗ[ℂ] lp (fun _ : I => H) 2 where + toFun := wave V hs + map_add' := fun x y => by apply lp.ext; funext i; exact map_add (V i) x y + map_smul' := fun c x => by apply lp.ext; funext i; exact map_smul (V i) c x + + theorem wave_bound (V : I → E →L[ℂ] H) (hs : ∀ x, Summable (fun i => ‖V i x‖^2)) + {C : ℝ} (hC : 0 ≤ C) (hb : ∀ x, (∑' i, ‖V i x‖^2) ≤ C^2*‖x‖^2) (x : E) : + ‖wave V hs x‖ ≤ C*‖x‖ := by + have hh := hb x + rw [← wave_square V hs x] at hh + nlinarith [norm_nonneg (wave V hs x), mul_nonneg hC (norm_nonneg x)] + +def lift (V : I → E →L[ℂ] H) (hs : ∀ x, Summable (fun i => ‖V i x‖^2)) + (C : ℝ) (hC : 0 ≤ C) (hb : ∀ x, (∑' i, ‖V i x‖^2) ≤ C^2*‖x‖^2) : + E →L[ℂ] lp (fun _ : I => H) 2 := + (linearMap V hs).mkContinuous C (wave_bound V hs hC hb) + + theorem sum_bound {V : I → E →L[ℂ] H} (hV : ∀ x, HasSum (fun i => ‖V i x‖^2) (‖x‖^2)) + (Z : H →L[ℂ] H) (x : E) : + Summable (fun i => ‖Z (V i x)‖^2) ∧ (∑' i, ‖Z (V i x)‖^2) ≤ ‖Z‖^2*‖x‖^2 := by + have hb (i : I) : ‖Z (V i x)‖^2 ≤ ‖Z‖^2*‖V i x‖^2 := by + nlinarith [Z.le_opNorm (V i x), norm_nonneg (Z (V i x)), mul_nonneg (norm_nonneg Z) (norm_nonneg (V i x))] + have hs := (hV x).summable.mul_left (‖Z‖^2) + have ht := hs.of_nonneg_of_le (fun _ => sq_nonneg _) hb + exact ⟨ht, (ht.tsum_le_tsum hb hs).trans_eq (by rw [tsum_mul_left, (hV x).tsum_eq])⟩ + +variable [CompleteSpace E] [CompleteSpace H] + +def analysis (V : I → E →L[ℂ] H) (hV : ∀ x, HasSum (fun i => ‖V i x‖^2) (‖x‖^2)) : + E →L[ℂ] lp (fun _ : I => H) 2 := + lift V (fun x => (hV x).summable) 1 (by norm_num) (by intro x; simp [(hV x).tsum_eq]) + +def acted (V : I → E →L[ℂ] H) (hV : ∀ x, HasSum (fun i => ‖V i x‖^2) (‖x‖^2)) + (Z : H →L[ℂ] H) : E →L[ℂ] lp (fun _ : I => H) 2 := + lift (fun i => Z ∘L V i) (fun x => (sum_bound hV Z x).1) ‖Z‖ (norm_nonneg Z) + (fun x => (sum_bound hV Z x).2) + +def dual (V : I → E →L[ℂ] H) (hV : ∀ x, HasSum (fun i => ‖V i x‖^2) (‖x‖^2)) + (Z : H →L[ℂ] H) : E →L[ℂ] E := (analysis V hV).adjoint ∘L acted V hV Z + + theorem dual_entry (V : I → E →L[ℂ] H) (hV : ∀ x, HasSum (fun i => ‖V i x‖^2) (‖x‖^2)) + (Z : H →L[ℂ] H) (x y : E) : + HasSum (fun i => inner ℂ (V i x) (Z (V i y))) (inner ℂ x (dual V hV Z y)) := by + have hh := lp.hasSum_inner (𝕜 := ℂ) (analysis V hV x) (acted V hV Z y) + rw [← ContinuousLinearMap.adjoint_inner_right] at hh + exact hh + +omit [CompleteSpace E] [CompleteSpace H] in + theorem analysis_norm (V : I → E →L[ℂ] H) (hV : ∀ x, HasSum (fun i => ‖V i x‖^2) (‖x‖^2)) : + ‖analysis V hV‖ ≤ 1 := by + apply ContinuousLinearMap.opNorm_le_bound _ (by norm_num) + intro x + exact wave_bound V (fun y => (hV y).summable) (by norm_num : (0:ℝ) ≤ 1) (by intro y; simp [(hV y).tsum_eq]) x + +omit [CompleteSpace E] [CompleteSpace H] in + theorem acted_norm (V : I → E →L[ℂ] H) (hV : ∀ x, HasSum (fun i => ‖V i x‖^2) (‖x‖^2)) + (Z : H →L[ℂ] H) : ‖acted V hV Z‖ ≤ ‖Z‖ := by + apply ContinuousLinearMap.opNorm_le_bound _ (norm_nonneg Z) + intro x + exact wave_bound (fun i => Z ∘L V i) (fun y => (sum_bound hV Z y).1) (norm_nonneg Z) (fun y => (sum_bound hV Z y).2) x + + theorem dual_norm (V : I → E →L[ℂ] H) (hV : ∀ x, HasSum (fun i => ‖V i x‖^2) (‖x‖^2)) + (Z : H →L[ℂ] H) : ‖dual V hV Z‖ ≤ ‖Z‖ := by + calc + _ ≤ ‖(analysis V hV).adjoint‖*‖acted V hV Z‖ := opNorm_comp_le _ _ + _ = ‖analysis V hV‖*‖acted V hV Z‖ := by rw [LinearIsometryEquiv.norm_map] + _ ≤ 1*‖Z‖ := mul_le_mul (analysis_norm V hV) (acted_norm V hV Z) (by positivity) (by norm_num) + _ = _ := one_mul _ + +end + +variable {E H I : Type*} [NormedAddCommGroup E] [InnerProductSpace ℂ E] + [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace E] [CompleteSpace H] + + theorem dual_add (V : I → E →L[ℂ] H) (hV : ∀ x, HasSum (fun i => ‖V i x‖^2) (‖x‖^2)) + (Z T : H →L[ℂ] H) : dual V hV (Z+T) = dual V hV Z+dual V hV T := by + ext y + apply ext_inner_left ℂ + intro x + exact (dual_entry V hV (Z+T) x y).unique (by + simpa only [add_apply, inner_add_right] using + (dual_entry V hV Z x y).add (dual_entry V hV T x y)) + + theorem dual_smul (V : I → E →L[ℂ] H) (hV : ∀ x, HasSum (fun i => ‖V i x‖^2) (‖x‖^2)) + (c : ℂ) (Z : H →L[ℂ] H) : dual V hV (c • Z) = c • dual V hV Z := by + ext y + apply ext_inner_left ℂ + intro x + exact (dual_entry V hV (c • Z) x y).unique (by + simpa only [smul_apply, inner_smul_right] using (dual_entry V hV Z x y).mul_left c) + + theorem dual_adjoint (V : I → E →L[ℂ] H) (hV : ∀ x, HasSum (fun i => ‖V i x‖^2) (‖x‖^2)) + (Z : H →L[ℂ] H) : dual V hV Z.adjoint = (dual V hV Z).adjoint := by + ext y + apply ext_inner_left ℂ + intro x + have hh := (dual_entry V hV Z y x).mapL Complex.conjCLE.toContinuousLinearEquiv.toContinuousLinearMap + change HasSum (fun i => starRingEnd ℂ (inner ℂ (V i y) (Z (V i x)))) + (starRingEnd ℂ (inner ℂ y (dual V hV Z x))) at hh + exact (dual_entry V hV Z.adjoint x y).unique (by + simpa only [ContinuousLinearMap.adjoint_inner_right, inner_conj_symm] using hh) + + theorem dual_selfAdjoint (V : I → E →L[ℂ] H) (hV : ∀ x, HasSum (fun i => ‖V i x‖^2) (‖x‖^2)) + {Z : H →L[ℂ] H} (hZ : IsSelfAdjoint Z) : IsSelfAdjoint (dual V hV Z) := by + change (dual V hV Z).adjoint = _ + rw [← dual_adjoint, show Z.adjoint = Z from hZ] + +end KrausBounded + +namespace TensorLp +open scoped BigOperators ComplexConjugate +variable {A B I J : Type*} + + theorem rightFamily_norm (y : J → H B) (hy : HasSum (fun j => ‖y j‖^2) 1) (x : H A) : + HasSum (fun j => ‖tensorRight (y j) x‖^2) (‖x‖^2) := by + simpa only [tensorRight_apply, tensor_norm_sq, mul_one] using hy.mul_left (‖x‖^2) + theorem leftFamily_norm (x : I → H A) (hx : HasSum (fun i => ‖x i‖^2) 1) (y : H B) : + HasSum (fun i => ‖tensorLeft (x i) y‖^2) (‖y‖^2) := by + simpa only [tensorLeft_apply, tensor_norm_sq, one_mul] using hx.mul_right (‖y‖^2) + +def conditionalLeft (y : J → H B) (hy : HasSum (fun j => ‖y j‖^2) 1) + (Z : H (A × B) →L[ℂ] H (A × B)) : H A →L[ℂ] H A := + KrausBounded.dual (fun j => tensorRight (y j)) (rightFamily_norm y hy) Z + +def conditionalRight (x : I → H A) (hx : HasSum (fun i => ‖x i‖^2) 1) + (Z : H (A × B) →L[ℂ] H (A × B)) : H B →L[ℂ] H B := + KrausBounded.dual (fun i => tensorLeft (x i)) (leftFamily_norm x hx) Z + + theorem conditionalLeft_entry (y : J → H B) (hy : HasSum (fun j => ‖y j‖^2) 1) + (Z : H (A × B) →L[ℂ] H (A × B)) (u v : H A) : + HasSum (fun j => inner ℂ (tensor u (y j)) (Z (tensor v (y j)))) (inner ℂ u (conditionalLeft y hy Z v)) := + KrausBounded.dual_entry _ _ _ _ _ + + theorem conditionalRight_entry (x : I → H A) (hx : HasSum (fun i => ‖x i‖^2) 1) + (Z : H (A × B) →L[ℂ] H (A × B)) (u v : H B) : + HasSum (fun i => inner ℂ (tensor (x i) u) (Z (tensor (x i) v))) (inner ℂ u (conditionalRight x hx Z v)) := + KrausBounded.dual_entry _ _ _ _ _ + + theorem tensorFamily_summable (x : I → H A) (y : J → H B) + (hx : Summable (fun i => ‖x i‖^2)) (hy : Summable (fun j => ‖y j‖^2)) : + Summable (fun ij : I × J => ‖tensor (x ij.1) (y ij.2)‖^2) := by + simpa only [tensor_norm_sq] using hx.mul_of_nonneg hy (fun _ => sq_nonneg _) (fun _ => sq_nonneg _) + +theorem pairing_conditionalLeft (u v : I → H A) (y : J → H B) + (hu : Summable (fun i => ‖u i‖^2)) (hv : Summable (fun i => ‖v i‖^2)) + (hy : HasSum (fun j => ‖y j‖^2) 1) (Z : H (A × B) →L[ℂ] H (A × B)) : + CrossEnsemble.pairing (fun ij : I × J => tensor (u ij.1) (y ij.2)) + (fun ij : I × J => tensor (v ij.1) (y ij.2)) Z= + CrossEnsemble.pairing u v (conditionalLeft y hy Z) := by + have hh := (CrossEnsemble.pairing_summable (tensorFamily_summable u y hu hy.summable) + (tensorFamily_summable v y hv hy.summable) Z).hasSum.prod_fiberwise + (fun i => conditionalLeft_entry y hy Z (v i) (u i)) + exact hh.tsum_eq.symm + +theorem pairing_conditionalRight (x : I → H A) (u v : J → H B) + (hx : HasSum (fun i => ‖x i‖^2) 1) + (hu : Summable (fun j => ‖u j‖^2)) (hv : Summable (fun j => ‖v j‖^2)) + (Z : H (A × B) →L[ℂ] H (A × B)) : + CrossEnsemble.pairing (fun ij : I × J => tensor (x ij.1) (u ij.2)) + (fun ij : I × J => tensor (x ij.1) (v ij.2)) Z= + CrossEnsemble.pairing u v (conditionalRight x hx Z) := by + have hs := CrossEnsemble.pairing_summable (tensorFamily_summable x u hx.summable hu) + (tensorFamily_summable x v hx.summable hv) Z + have hh := hs.prod_symm.hasSum.prod_fiberwise + (fun j => conditionalRight_entry x hx Z (v j) (u j)) + have he := (Equiv.prodComm J I).tsum_eq + (fun ij : I × J => inner ℂ (tensor (x ij.1) (v ij.2)) (Z (tensor (x ij.1) (u ij.2)))) + change (∑' ji : J × I, inner ℂ (tensor (x ji.swap.1) (v ji.swap.2)) + (Z (tensor (x ji.swap.1) (u ji.swap.2))))=_ at he + rw [he] at hh + exact hh.tsum_eq.symm +end TensorLp + +namespace BeamLadder +open EntropyPhotonNumber QuantumTrace Annihilation TensorLp +variable {n : ℕ} {I J : Type*} + +def singleWeak (r : ℝ) (j : Fin n) (x : I → Fock n) (Z : Fock n →L[ℂ] Fock n) : ℂ := + (r+1:ℂ)*CrossEnsemble.pairing (fun i => inverseWeight 3 (x i)) + (fun i => sandwich 0 3 (by omega) j (x i)) Z- + (r:ℂ)*CrossEnsemble.pairing (fun i => creationSandwich 0 3 (by omega) j (x i)) + (fun i => inverseWeight 3 (x i)) Z + +theorem weakL_summable (r : ℝ) (j : Fin n) (x y : I → JointFock n) + (hx : Summable (fun i => ‖x i‖^2)) (hy : Summable (fun i => ‖y i‖^2)) + (T : JointFock n →L[ℂ] JointFock n) : + Summable (fun i => weakL r j (x i) (y i) T) := + ((CrossEnsemble.pairing_summable (CrossEnsemble.applied_summable hy inverse) + (CrossEnsemble.applied_summable hx (lowerL j)) T).mul_left _).sub + ((CrossEnsemble.pairing_summable (CrossEnsemble.applied_summable hy (raiseL j)) + (CrossEnsemble.applied_summable hx inverse) T).mul_left _) + +theorem weakR_summable (r : ℝ) (j : Fin n) (x y : I → JointFock n) + (hx : Summable (fun i => ‖x i‖^2)) (hy : Summable (fun i => ‖y i‖^2)) + (T : JointFock n →L[ℂ] JointFock n) : + Summable (fun i => weakR r j (x i) (y i) T) := + ((CrossEnsemble.pairing_summable (CrossEnsemble.applied_summable hy inverse) + (CrossEnsemble.applied_summable hx (lowerR j)) T).mul_left _).sub + ((CrossEnsemble.pairing_summable (CrossEnsemble.applied_summable hy (raiseR j)) + (CrossEnsemble.applied_summable hx inverse) T).mul_left _) + +theorem weakL_product (r : ℝ) (j : Fin n) (x : I → Fock n) (y : J → Fock n) + (hx : Summable (fun i => ‖x i‖^2)) + (hy : HasSum (fun j => ‖inverseWeight 3 (y j)‖^2) 1) + (Z : JointFock n →L[ℂ] JointFock n) : + (∑' ij : I × J, weakL r j (tensorPreimage (x ij.1) (y ij.2)) + (tensorPreimage (x ij.1) (y ij.2)) Z)= + singleWeak r j x (conditionalLeft (fun j => inverseWeight 3 (y j)) hy Z) := by + have hi := CrossEnsemble.applied_summable hx (inverseWeight 3) + have hl := CrossEnsemble.applied_summable hx (sandwich 0 3 (by omega) j) + have hr := CrossEnsemble.applied_summable hx (creationSandwich 0 3 (by omega) j) + simp only [weakL, tensorPreimage_lowerL, tensorPreimage_inverse, tensorPreimage_raiseL] + rw [Summable.tsum_sub (((CrossEnsemble.pairing_summable (tensorFamily_summable _ _ hi hy.summable) + (tensorFamily_summable _ _ hl hy.summable) Z).mul_left _)) + (((CrossEnsemble.pairing_summable (tensorFamily_summable _ _ hr hy.summable) + (tensorFamily_summable _ _ hi hy.summable) Z).mul_left _)), tsum_mul_left, tsum_mul_left] + change (r+1:ℂ)*CrossEnsemble.pairing _ _ Z-(r:ℂ)*CrossEnsemble.pairing _ _ Z=_ + rw [pairing_conditionalLeft _ _ _ hi hl hy, pairing_conditionalLeft _ _ _ hr hi hy] + rfl + +theorem weakR_product (r : ℝ) (j : Fin n) (x : I → Fock n) (y : J → Fock n) + (hx : HasSum (fun i => ‖inverseWeight 3 (x i)‖^2) 1) + (hy : Summable (fun j => ‖y j‖^2)) + (Z : JointFock n →L[ℂ] JointFock n) : + (∑' ij : I × J, weakR r j (tensorPreimage (x ij.1) (y ij.2)) + (tensorPreimage (x ij.1) (y ij.2)) Z)= + singleWeak r j y (conditionalRight (fun i => inverseWeight 3 (x i)) hx Z) := by + have hi := CrossEnsemble.applied_summable hy (inverseWeight 3) + have hl := CrossEnsemble.applied_summable hy (sandwich 0 3 (by omega) j) + have hr := CrossEnsemble.applied_summable hy (creationSandwich 0 3 (by omega) j) + simp only [weakR, tensorPreimage_lowerR, tensorPreimage_inverse, tensorPreimage_raiseR] + rw [Summable.tsum_sub (((CrossEnsemble.pairing_summable (tensorFamily_summable _ _ hx.summable hi) + (tensorFamily_summable _ _ hx.summable hl) Z).mul_left _)) + (((CrossEnsemble.pairing_summable (tensorFamily_summable _ _ hx.summable hr) + (tensorFamily_summable _ _ hx.summable hi) Z).mul_left _)), tsum_mul_left, tsum_mul_left] + change (r+1:ℂ)*CrossEnsemble.pairing _ _ Z-(r:ℂ)*CrossEnsemble.pairing _ _ Z=_ + rw [pairing_conditionalRight _ _ _ hx hi hl, pairing_conditionalRight _ _ _ hx hr hi] + rfl + +theorem product_weak_covariance (η : ℝ) (hη : η ∈ Set.Icc 0 1) (a b : ℝ) (j : Fin n) + (x : I → Fock n) (y : J → Fock n) + (hx : Summable (fun i => ‖x i‖^2)) (hy : Summable (fun j => ‖y j‖^2)) + (hxn : HasSum (fun i => ‖inverseWeight 3 (x i)‖^2) 1) + (hyn : HasSum (fun j => ‖inverseWeight 3 (y j)‖^2) 1) + (Z : Fock n →L[ℂ] Fock n) : + (∑' ij : I × J, weakL (η*a+(1-η)*b) j + (beamUnitary η hη (tensorPreimage (x ij.1) (y ij.2))) + (beamUnitary η hη (tensorPreimage (x ij.1) (y ij.2))) (liftLeft Z))= + (Real.sqrt η:ℂ)*singleWeak a j x (conditionalLeft (fun j => inverseWeight 3 (y j)) hyn (conjugate η hη Z))+ + (Real.sqrt (1-η):ℂ)*singleWeak b j y (conditionalRight (fun i => inverseWeight 3 (x i)) hxn (conjugate η hη Z)) := by + have hs := tensorPreimage_summable x y hx hy + simp only [physical_weak_covariance] + rw [Summable.tsum_add ((weakL_summable a j _ _ hs hs _).mul_left _) + ((weakR_summable b j _ _ hs hs _).mul_left _), tsum_mul_left, tsum_mul_left, + weakL_product a j x y hx hyn, weakR_product b j x y hxn hy] +end BeamLadder + +end + +open scoped BigOperators ComplexConjugate ENNReal Topology +open MeasureTheory +open scoped ComplexConjugate +open scoped BigOperators ComplexConjugate +open scoped BigOperators +open MvPolynomial +open scoped BigOperators ComplexConjugate Classical +open Submodule +open ContinuousLinearMap +open scoped ENNReal + +namespace EntropyPhotonNumber +variable {n : ℕ} +theorem entry_ext {T R : Fock n →L[ℂ] Fock n} + (h : ∀ k l, entry T k l = entry R k l) : T = R := by + apply lp.ext_continuousLinearMap (by norm_num : (2 : ℝ≥0∞) ≠ ⊤) + intro l + apply ContinuousLinearMap.ext + intro c + apply lp.ext + funext k + have h₁ : lp.single (E := fun _ : NumberIndex n => ℂ) 2 l c = c • numberKet l := by + simp [numberKet, ← lp.single_smul] + change T (lp.single 2 l c) k = R (lp.single 2 l c) k + rw [h₁, map_smul, map_smul] + have he := h k l + simpa [entry, numberKet, lp.inner_single_left] using congrArg (fun z : ℂ => c*z) he +end EntropyPhotonNumber + +namespace TensorLp +variable {A B I : Type*} +theorem slice_family_summable (x : I → H (A × B)) (hx : Summable (fun i => ‖x i‖^2)) : + Summable (fun ie : I × B => ‖slice (x ie.1) ie.2‖^2) := by + apply (summable_prod_of_nonneg (fun _ => sq_nonneg _)).mpr + refine ⟨fun i => (hasSum_slice_norm_sq (x i)).summable, ?_⟩ + simpa only [(hasSum_slice_norm_sq _).tsum_eq] using hx + +theorem pairing_liftLeft (x y : I → H (A × B)) + (hx : Summable (fun i => ‖x i‖^2)) (hy : Summable (fun i => ‖y i‖^2)) + (Z : H A →L[ℂ] H A) : + CrossEnsemble.pairing x y (liftLeft Z)= + CrossEnsemble.pairing (fun ie : I × B => slice (x ie.1) ie.2) + (fun ie : I × B => slice (y ie.1) ie.2) Z := by + have hh := (CrossEnsemble.pairing_summable (slice_family_summable x hx) + (slice_family_summable y hy) Z).hasSum.prod_fiberwise + (fun i => by simpa only [slice_liftLeft] using hasSum_slice_inner (y i) (liftLeft Z (x i))) + exact hh.tsum_eq +end TensorLp + +namespace CrossEnsemble +open EntropyPhotonNumber +open scoped ComplexConjugate +variable {n : ℕ} {I J : Type*} + +theorem coordinate_hasSum (x y : I → Fock n) + (hx : Summable (fun i => ‖x i‖^2)) (hy : Summable (fun i => ‖y i‖^2)) + (a b : NumberIndex n) : HasSum (fun i => x i a*conj (y i b)) (entry (operator x y) a b) := by + simpa only [entry, numberKet, lp.inner_single_left, lp.inner_single_right, + RCLike.inner_apply, map_one, one_mul, mul_one] using entry_hasSum hx hy (numberKet a) (numberKet b) + +theorem shifted_right_operator_eq (x y : I → Fock n) (u v : J → Fock n) + (hx : Summable (fun i => ‖x i‖^2)) (hy : Summable (fun i => ‖y i‖^2)) + (hu : Summable (fun j => ‖u j‖^2)) (hv : Summable (fun j => ‖v j‖^2)) + (f : NumberIndex n → NumberIndex n) (c : NumberIndex n → ℂ) + (hyx : ∀ i k, y i k=c k*x i (f k)) (hvu : ∀ j k, v j k=c k*u j (f k)) + (he : operator x x=operator u u) : operator x y=operator u v := by + apply entry_ext + intro a b + have h₁ := (coordinate_hasSum x x hx hx a (f b)).mul_right (conj (c b)) + have h₂ := (coordinate_hasSum u u hu hu a (f b)).mul_right (conj (c b)) + have he₁ : entry (operator x y) a b=entry (operator x x) a (f b)*conj (c b) := by + apply (coordinate_hasSum x y hx hy a b).unique + convert! h₁ using 1 + ext i + rw [hyx, map_mul] + ring + have he₂ : entry (operator u v) a b=entry (operator u u) a (f b)*conj (c b) := by + apply (coordinate_hasSum u v hu hv a b).unique + convert! h₂ using 1 + ext j + rw [hvu, map_mul] + ring + rw [he₁, he₂, he] + +theorem shifted_left_operator_eq (x y : I → Fock n) (u v : J → Fock n) + (hx : Summable (fun i => ‖x i‖^2)) (hy : Summable (fun i => ‖y i‖^2)) + (hu : Summable (fun j => ‖u j‖^2)) (hv : Summable (fun j => ‖v j‖^2)) + (f : NumberIndex n → NumberIndex n) (c : NumberIndex n → ℂ) + (hyx : ∀ i k, y i k=c k*x i (f k)) (hvu : ∀ j k, v j k=c k*u j (f k)) + (he : operator x x=operator u u) : operator y x=operator v u := by + apply entry_ext + intro a b + have h₁ := (coordinate_hasSum x x hx hx (f a) b).mul_left (c a) + have h₂ := (coordinate_hasSum u u hu hu (f a) b).mul_left (c a) + have he₁ : entry (operator y x) a b=c a*entry (operator x x) (f a) b := by + apply (coordinate_hasSum y x hy hx a b).unique + convert! h₁ using 1 + ext i + rw [hyx] + ring + have he₂ : entry (operator v u) a b=c a*entry (operator u u) (f a) b := by + apply (coordinate_hasSum v u hv hu a b).unique + convert! h₂ using 1 + ext j + rw [hvu] + ring + rw [he₁, he₂, he] +end CrossEnsemble + +namespace BeamLadder +open EntropyPhotonNumber QuantumTrace Annihilation TensorLp +variable {n : ℕ} {I J : Type*} + +theorem lowerL_inverse_apply (j : Fin n) (x : JointFock n) (k e : NumberIndex n) : + lowerL j x (k,e)=(Real.sqrt ((k j:ℝ)+1):ℂ)*inverse x (up j k,e) := by + simp only [lowerL_apply, inverse_apply, + show W (up j k,e)=W (k,e)+1 from W_upL j (k,e)] + push_cast + rw [div_eq_mul_inv, mul_assoc] + rfl + +theorem raiseL_inverse_apply (j : Fin n) (x : JointFock n) (k e : NumberIndex n) : + raiseL j x (k,e)=(Real.sqrt (k j:ℝ):ℂ)*inverse x (down j k,e) := by + rcases index_cases j k with hk | ⟨a,rfl⟩ + · simp only [raiseL_zero j x (k,e) hk, hk, Nat.cast_zero, Real.sqrt_zero, Complex.ofReal_zero, zero_mul] + · change raiseL j x (upL j (a,e))=_ + rw [raiseL_up, up_same, down_up, inverse_apply] + push_cast + ring + +theorem single_lower_inverse_apply (j : Fin n) (x : Fock n) (k : NumberIndex n) : + sandwich 0 3 (by omega) j x k=(Real.sqrt ((k j:ℝ)+1):ℂ)*inverseWeight 3 x (up j k) := by + simp only [sandwich_apply, coefficient, pow_zero, one_mul, inverseWeight_apply] + push_cast + ring + +theorem single_raise_inverse_apply (j : Fin n) (x : Fock n) (k : NumberIndex n) : + creationSandwich 0 3 (by omega) j x k=(Real.sqrt (k j:ℝ):ℂ)*inverseWeight 3 x (down j k) := by + rcases index_cases j k with hk | ⟨a,rfl⟩ + · simp only [creationSandwich_zero _ _ _ _ _ k hk, hk, Nat.cast_zero, Real.sqrt_zero, Complex.ofReal_zero, zero_mul] + · rw [creationSandwich_up, up_same, down_up, inverseWeight_apply] + simp only [creationCoefficient, pow_zero, one_mul] + push_cast + ring + +theorem output_weak (r : ℝ) (j : Fin n) (x : I → JointFock n) (z : J → Fock n) + (hx : Summable (fun i => ‖x i‖^2)) (hz : Summable (fun j => ‖z j‖^2)) + (he : CrossEnsemble.operator (fun ie : I × NumberIndex n => slice (inverse (x ie.1)) ie.2) + (fun ie : I × NumberIndex n => slice (inverse (x ie.1)) ie.2)= + CrossEnsemble.operator (fun j => inverseWeight 3 (z j)) (fun j => inverseWeight 3 (z j))) + (Z : Fock n →L[ℂ] Fock n) : + (∑' i, weakL r j (x i) (x i) (liftLeft Z))=singleWeak r j z Z := by + have hi := CrossEnsemble.applied_summable hx inverse + have hl := CrossEnsemble.applied_summable hx (lowerL j) + have hr := CrossEnsemble.applied_summable hx (raiseL j) + have hzi := CrossEnsemble.applied_summable hz (inverseWeight 3) + have hzl := CrossEnsemble.applied_summable hz (sandwich 0 3 (by omega) j) + have hzr := CrossEnsemble.applied_summable hz (creationSandwich 0 3 (by omega) j) + have his := slice_family_summable _ hi + have hls := slice_family_summable _ hl + have hrs := slice_family_summable _ hr + have heL := CrossEnsemble.shifted_right_operator_eq _ _ _ _ his hls hzi hzl + (up j) (fun k => (Real.sqrt ((k j:ℝ)+1):ℂ)) + (fun ie k => lowerL_inverse_apply j (x ie.1) k ie.2) + (fun i k => single_lower_inverse_apply j (z i) k) he + have heR := CrossEnsemble.shifted_left_operator_eq _ _ _ _ his hrs hzi hzr + (down j) (fun k => (Real.sqrt (k j:ℝ):ℂ)) + (fun ie k => raiseL_inverse_apply j (x ie.1) k ie.2) + (fun i k => single_raise_inverse_apply j (z i) k) he + let bas : HilbertBasis (NumberIndex n) ℂ (Fock n) := HilbertBasis.ofRepr (LinearIsometryEquiv.refl ℂ _) + have hpL := CrossEnsemble.pairing_eq_of_operator_eq bas his hls hzi hzl heL Z + have hpR := CrossEnsemble.pairing_eq_of_operator_eq bas hrs his hzr hzi heR Z + simp only [weakL] + rw [Summable.tsum_sub ((CrossEnsemble.pairing_summable hi hl (liftLeft Z)).mul_left _) + ((CrossEnsemble.pairing_summable hr hi (liftLeft Z)).mul_left _), tsum_mul_left, tsum_mul_left] + change (r+1:ℂ)*CrossEnsemble.pairing _ _ (liftLeft Z)-(r:ℂ)*CrossEnsemble.pairing _ _ (liftLeft Z)=_ + rw [pairing_liftLeft _ _ hi hl, pairing_liftLeft _ _ hr hi, hpL, hpR] + rfl +end BeamLadder + +namespace TensorLp +variable {A B I : Type*} + +theorem hasSum_slice_family {v : I → H (A × B)} {t : ℝ} + (hv : HasSum (fun i => ‖v i‖^2) t) : + HasSum (fun bi : B × I => ‖slice (v bi.2) bi.1‖^2) t := by + have hp (i : I) : (∑' b, ‖slice (v i) b‖^2) = ‖v i‖^2 := (hasSum_slice_norm_sq (v i)).tsum_eq + have hd : Summable (fun ib : I × B => ‖slice (v ib.1) ib.2‖^2) := by + apply (summable_prod_of_nonneg (fun _ => sq_nonneg _)).mpr + refine ⟨fun i => (hasSum_slice_norm_sq (v i)).summable, ?_⟩ + simpa only [hp] using hv.summable + have ht : (∑' ib : I × B, ‖slice (v ib.1) ib.2‖^2) = t := by + rw [hd.tsum_prod] + simpa only [hp] using hv.tsum_eq + have hsum : HasSum (fun ib : I × B => ‖slice (v ib.1) ib.2‖^2) t := ht ▸ hd.hasSum + exact (Equiv.prodComm B I).hasSum_iff.mpr hsum + +def partialTrace (v : I → H (A × B)) : H A →L[ℂ] H A := + TraceEnsemble.operator (fun bi : B × I => slice (v bi.2) bi.1) + +theorem partialTrace_positive {v : I → H (A × B)} + (hv : Summable (fun i => ‖v i‖^2)) : (partialTrace v).IsPositive := + TraceEnsemble.positive (hasSum_slice_family hv.hasSum).summable + +theorem partialTrace_trace {v : I → H (A × B)} {t : ℝ} + (hv : HasSum (fun i => ‖v i‖^2) t) (b : HilbertBasis A ℂ (H A)) : + HasSum (fun a => (inner ℂ (b a) (partialTrace v (b a))).re) t := + TraceEnsemble.trace (hasSum_slice_family hv) b + +theorem partialTrace_entry [DecidableEq A] [DecidableEq B] + {v : I → H (A × B)} (hv : Summable (fun i => ‖v i‖^2)) (a c : A) : + HasSum (fun b => inner ℂ (lp.single 2 (a,b) 1) + (TraceEnsemble.operator v (lp.single 2 (c,b) 1))) + (inner ℂ (lp.single 2 a 1) (partialTrace v (lp.single 2 c 1))) := by + have hs := TraceEnsemble.hasSum_entry (hasSum_slice_family hv.hasSum).summable + (lp.single 2 a 1) (lp.single 2 c 1) + have hrow (b : B) : HasSum + (fun i => inner ℂ (lp.single 2 a 1) (slice (v i) b) * + inner ℂ (slice (v i) b) (lp.single 2 c 1)) + (inner ℂ (lp.single 2 (a,b) 1) (TraceEnsemble.operator v (lp.single 2 (c,b) 1))) := by + convert! TraceEnsemble.hasSum_entry hv (lp.single 2 (a,b) 1) (lp.single 2 (c,b) 1) using 1 + ext i + simp [lp.inner_single_left, lp.inner_single_right, slice_apply] + exact hs.prod_fiberwise hrow + +end TensorLp + +namespace TraceEnsemble +open TensorLp +variable {A B I J : Type*} + +theorem hasSum_tensor_norm {v : I → H A} {w : J → H B} {a b : ℝ} + (hv : HasSum (fun i => ‖v i‖^2) a) (hw : HasSum (fun j => ‖w j‖^2) b) : + HasSum (fun ij : I × J => ‖tensor (v ij.1) (w ij.2)‖^2) (a*b) := by + simpa only [tensor_norm_sq] using hv.mul hw + (hv.summable.mul_of_nonneg hw.summable (fun _ => sq_nonneg _) (fun _ => sq_nonneg _)) + +theorem tensor_entry [DecidableEq A] [DecidableEq B] + {v : I → H A} {w : J → H B} + (hv : Summable (fun i => ‖v i‖^2)) (hw : Summable (fun j => ‖w j‖^2)) + (a c : A) (b d : B) : + inner ℂ (lp.single 2 (a,b) 1) + (operator (fun ij : I × J => tensor (v ij.1) (w ij.2)) (lp.single 2 (c,d) 1)) = + inner ℂ (lp.single 2 a 1) (operator v (lp.single 2 c 1)) * + inner ℂ (lp.single 2 b 1) (operator w (lp.single 2 d 1)) := by + apply (hasSum_entry (hasSum_tensor_norm hv.hasSum hw.hasSum).summable _ _).unique + convert! (hasSum_entry hv (lp.single 2 a 1) (lp.single 2 c 1)).mul + (hasSum_entry hw (lp.single 2 b 1) (lp.single 2 d 1)) + (summable_mul_of_summable_norm + (f := fun i => inner ℂ (lp.single 2 a 1) (v i)*inner ℂ (v i) (lp.single 2 c 1)) + (g := fun j => inner ℂ (lp.single 2 b 1) (w j)*inner ℂ (w j) (lp.single 2 d 1)) + (summable_entry_norm hv (lp.single 2 a 1) (lp.single 2 c 1)) + (summable_entry_norm hw (lp.single 2 b 1) (lp.single 2 d 1))) using 1 + ext ij + simp only [lp.inner_single_left, lp.inner_single_right, tensor_apply, RCLike.inner_apply, map_mul, map_one] + ring + +theorem unitary_entry {E : Type*} [NormedAddCommGroup E] [InnerProductSpace ℂ E] + [CompleteSpace E] {v : I → E} (hv : Summable (fun i => ‖v i‖^2)) + (U : E ≃ₗᵢ[ℂ] E) (x y : E) : + inner ℂ x (operator (fun i => U (v i)) y) = + inner ℂ (U.symm x) (operator v (U.symm y)) := by + have hu : Summable (fun i => ‖U (v i)‖^2) := by simpa only [U.norm_map] using hv + apply (hasSum_entry hu x y).unique + convert! hasSum_entry hv (U.symm x) (U.symm y) using 1 + ext i + have h₁ : inner ℂ x (U (v i)) = inner ℂ (U.symm x) (v i) := by + simpa only [U.apply_symm_apply] using U.inner_map_map (U.symm x) (v i) + have h₂ : inner ℂ (U (v i)) y = inner ℂ (v i) (U.symm y) := by + simpa only [U.apply_symm_apply] using U.inner_map_map (v i) (U.symm y) + rw [h₁,h₂] + +end TraceEnsemble + +namespace EntropyPhotonNumber +open TensorLp +theorem beam_ensemble_entry {n : ℕ} {I J : Type*} (η : ℝ) (hη : η ∈ Set.Icc 0 1) + (ρ σ : State n) (v : I → Fock n) (w : J → Fock n) + (hv : HasSum (fun i => ‖v i‖^2) 1) (hw : HasSum (fun j => ‖w j‖^2) 1) + (hev : TraceEnsemble.operator v = ρ.op) (hew : TraceEnsemble.operator w = σ.op) + (k l e : NumberIndex n) : + inner ℂ (lp.single 2 (k,e) 1) + (TraceEnsemble.operator (fun ij : I × J => beamUnitary η hη (tensor (v ij.1) (w ij.2))) + (lp.single 2 (l,e) 1)) = outputBlock η ρ σ k l e := by + rw [TraceEnsemble.unitary_entry (TraceEnsemble.hasSum_tensor_norm hv hw).summable] + rw [beam_symm_number, beam_symm_number] + simp only [map_sum, map_smul, inner_sum, sum_inner, inner_smul_left, inner_smul_right, + Complex.conj_ofReal, Finset.mul_sum] + rw [Finset.sum_comm] + unfold outputBlock + apply Finset.sum_congr rfl + intro a _ + apply Finset.sum_congr rfl + intro b _ + rw [TraceEnsemble.tensor_entry hv.summable hw.summable, hev, hew] + simp only [entry, numberKet] + ring + +end EntropyPhotonNumber + +end + +end OAI diff --git a/lean/OAI/InformationTheory/PhotonNumber/Continuity.lean b/lean/OAI/InformationTheory/PhotonNumber/Continuity.lean new file mode 100644 index 0000000000000000000000000000000000000000..cbc80d31e0dab17adb902555fa6832582b147f9f --- /dev/null +++ b/lean/OAI/InformationTheory/PhotonNumber/Continuity.lean @@ -0,0 +1,1013 @@ +import OAI.InformationTheory.PhotonNumber.BeamTrace + +namespace OAI + +noncomputable section + +open scoped BigOperators ComplexConjugate ENNReal Topology +open MeasureTheory +open scoped ComplexConjugate +open scoped BigOperators ComplexConjugate +open scoped BigOperators +open MvPolynomial +open scoped BigOperators ComplexConjugate Classical +open Submodule +open ContinuousLinearMap +open scoped ENNReal +open Set Filter Topology Complex MeasureTheory +open Set Filter Topology Complex Metric +open MeasureTheory Set Filter Topology Complex Metric InnerProductSpace +open scoped ENNReal NNReal +open Filter Topology + +namespace EntropyPhotonNumber +open TensorLp +def mixedVector {n : ℕ} (η : ℝ) (hη : η ∈ Set.Icc 0 1) (ρA ρB : State n) + (ab : PairedIndex n) : JointFock n := + beamUnitary η hη (tensor (rootColumn ρA ab.1) (rootColumn ρB ab.2)) + +theorem mixedVector_norm {n : ℕ} (η : ℝ) (hη : η ∈ Set.Icc 0 1) (ρA ρB : State n) : + HasSum (fun ab => ‖mixedVector η hη ρA ρB ab‖^2) 1 := by + simpa only [mixedVector, LinearIsometryEquiv.norm_map, one_mul] using + TraceEnsemble.hasSum_tensor_norm (rootColumn_norm ρA) (rootColumn_norm ρB) + +def beamOutput {n : ℕ} (η : ℝ) (hη : η ∈ Set.Icc 0 1) (ρA ρB : State n) : State n where + op := partialTrace (mixedVector η hη ρA ρB) + positive := partialTrace_positive (mixedVector_norm η hη ρA ρB).summable + trace_one := by + simpa only [channelNumberBasis_apply, entry] using + partialTrace_trace (mixedVector_norm η hη ρA ρB) (channelNumberBasis n) + +theorem mixedVector_entry {n : ℕ} (η : ℝ) (hη : η ∈ Set.Icc 0 1) (ρA ρB : State n) + (k l e : NumberIndex n) : + inner ℂ (lp.single 2 (k,e) 1) + (TraceEnsemble.operator (mixedVector η hη ρA ρB) (lp.single 2 (l,e) 1)) = + outputBlock η ρA ρB k l e := by + unfold mixedVector + rw [TraceEnsemble.unitary_entry + (TraceEnsemble.hasSum_tensor_norm (rootColumn_norm ρA) (rootColumn_norm ρB)).summable] + rw [beam_symm_number, beam_symm_number] + simp only [map_sum, map_smul, inner_sum, sum_inner, inner_smul_left, inner_smul_right, + Complex.conj_ofReal, Finset.mul_sum] + rw [Finset.sum_comm] + unfold outputBlock + apply Finset.sum_congr rfl + intro a _ + apply Finset.sum_congr rfl + intro b _ + rw [TraceEnsemble.tensor_entry (rootColumn_norm ρA).summable (rootColumn_norm ρB).summable, + rootColumn_operator, rootColumn_operator] + simp only [entry, numberKet] + ring + +theorem beamOutput_spec {n : ℕ} (η : ℝ) (hη : η ∈ Set.Icc 0 1) (ρA ρB : State n) : + IsBeamSplitterOutput η ρA ρB (beamOutput η hη ρA ρB) := by + intro k l + have h := partialTrace_entry (mixedVector_norm η hη ρA ρB).summable k l + simpa only [mixedVector_entry, beamOutput, entry, numberKet] using h + +end EntropyPhotonNumber + +namespace BlockUnitary +variable {J : Type*} [Fintype J] + +theorem finite_transform_norm_sq (U : J → J → ℝ) + (hc : ∀ a b, ∑ k, U k a*U k b = if a=b then 1 else 0) (z : J → ℂ) : + (∑ k, ‖∑ a, (U k a : ℂ)*z a‖^2) = ∑ a, ‖z a‖^2 := by + classical + let v : J → EuclideanSpace ℂ J := fun a => WithLp.toLp 2 (fun k => (U k a : ℂ)) + have hv : Orthonormal ℂ v := by + rw [orthonormal_iff_ite] + intro a b + change (∑ k, (U k b : ℂ)*star (U k a : ℂ)) = _ + simp only [Complex.star_def, Complex.conj_ofReal, ← Complex.ofReal_mul, + ← Complex.ofReal_sum, hc] + by_cases hab : a=b + · simp [hab] + · simp [hab, Ne.symm hab] + have hi := hv.inner_sum z z Finset.univ + have he : (∑ a, z a • v a) = WithLp.toLp 2 (fun k => ∑ a, (U k a : ℂ)*z a) := by + ext k + simp [v, mul_comm] + have hnorm : ‖∑ a, z a • v a‖^2 = ∑ a, ‖z a‖^2 := by + calc + _ = (inner ℂ (∑ a, z a • v a) (∑ a, z a • v a)).re := + (inner_self_eq_norm_sq (𝕜 := ℂ) _).symm + _ = (∑ a, conj (z a)*z a).re := congrArg Complex.re hi + _ = _ := by simp [Complex.mul_re, Complex.sq_norm, Complex.normSq_apply] + rw [he, EuclideanSpace.norm_sq_eq] at hnorm + exact hnorm + +variable {S : Type*} {I : S → Type*} [∀ s, Fintype (I s)] +variable {E : Type*} [NormedAddCommGroup E] [InnerProductSpace ℂ E] [CompleteSpace E] + +theorem unitary_coordinate (b : HilbertBasis (Sigma I) ℂ E) + (U : ∀ s, I s → I s → ℝ) + (hcol : ∀ s a d, ∑ k, U s k a*U s k d = if a=d then 1 else 0) + (hrow : ∀ s k l, ∑ a, U s k a*U s l a = if k=l then 1 else 0) + (x : E) (s : S) (k : I s) : + inner ℂ (b ⟨s,k⟩) (unitary b U hcol hrow x) = + ∑ a, (U s k a : ℂ)* inner ℂ (b ⟨s,a⟩) x := by + have hi := (unitary b U hcol hrow).inner_map_map + ((unitary b U hcol hrow).symm (b ⟨s,k⟩)) x + rw [LinearIsometryEquiv.apply_symm_apply, unitary_symm_apply_basis] at hi + rw [hi] + simp only [sum_inner, inner_smul_left, Complex.conj_ofReal] + +theorem unitary_sector_mass (b : HilbertBasis (Sigma I) ℂ E) + (U : ∀ s, I s → I s → ℝ) + (hcol : ∀ s a d, ∑ k, U s k a*U s k d = if a=d then 1 else 0) + (hrow : ∀ s k l, ∑ a, U s k a*U s l a = if k=l then 1 else 0) + (x : E) (s : S) : + (∑ k, ‖inner ℂ (b ⟨s,k⟩) (unitary b U hcol hrow x)‖^2) = + ∑ k, ‖inner ℂ (b ⟨s,k⟩) x‖^2 := by + simp only [unitary_coordinate] + exact finite_transform_norm_sq (U s) (hcol s) _ + +theorem unitary_weighted_mass (b : HilbertBasis (Sigma I) ℂ E) + (U : ∀ s, I s → I s → ℝ) + (hcol : ∀ s a d, ∑ k, U s k a*U s k d = if a=d then 1 else 0) + (hrow : ∀ s k l, ∑ a, U s k a*U s l a = if k=l then 1 else 0) + (x : E) (w : S → ℝ≥0∞) : + (∑' i : Sigma I, w i.1 * ENNReal.ofReal (‖inner ℂ (b i) (unitary b U hcol hrow x)‖^2)) = + ∑' i : Sigma I, w i.1 * ENNReal.ofReal (‖inner ℂ (b i) x‖^2) := by + rw [ENNReal.tsum_sigma', ENNReal.tsum_sigma'] + congr 1 + funext s + simp only [tsum_fintype, ← Finset.mul_sum] + congr 1 + rw [← ENNReal.ofReal_sum_of_nonneg (fun _ _ => sq_nonneg _), + ← ENNReal.ofReal_sum_of_nonneg (fun _ _ => sq_nonneg _), unitary_sector_mass] + +end BlockUnitary + +namespace TensorLp +variable {A B I : Type*} + +def vectorMoment (w : A → ℝ≥0∞) (x : H A) : ℝ≥0∞ := + ∑' a, w a * ENNReal.ofReal (‖x a‖^2) + +def matrixMoment [DecidableEq A] (w : A → ℝ≥0∞) (T : H A →L[ℂ] H A) : ℝ≥0∞ := + ∑' a, w a * ENNReal.ofReal (inner ℂ (lp.single 2 a 1) (T (lp.single 2 a 1))).re + +theorem vectorMoment_one (x : H A) : vectorMoment (fun _ => 1) x = ENNReal.ofReal (‖x‖^2) := by + simp only [vectorMoment, one_mul] + rw [← ENNReal.ofReal_tsum_of_nonneg (fun _ => sq_nonneg _) (hasSum_square x).summable, + (hasSum_square x).tsum_eq] + +theorem matrixMoment_ensemble [DecidableEq A] {v : I → H A} + (hv : Summable (fun i => ‖v i‖^2)) (w : A → ℝ≥0∞) : + matrixMoment w (TraceEnsemble.operator v) = ∑' i, vectorMoment w (v i) := by + have he (a : A) : ENNReal.ofReal + (inner ℂ (lp.single 2 a 1) (TraceEnsemble.operator v (lp.single 2 a 1))).re = + ∑' i, ENNReal.ofReal (‖v i a‖^2) := by + have h : HasSum (fun i => ‖v i a‖^2) + (inner ℂ (lp.single 2 a 1) (TraceEnsemble.operator v (lp.single 2 a 1))).re := by + convert! TraceEnsemble.hasSum_quadratic hv (lp.single 2 a 1) using 1 + ext i + simp only [lp.inner_single_left, RCLike.inner_apply, map_one, mul_one] + rw [← h.tsum_eq, ENNReal.ofReal_tsum_of_nonneg (fun _ => sq_nonneg _) h.summable] + simp only [matrixMoment, he, ← ENNReal.tsum_mul_left, vectorMoment] + exact ENNReal.tsum_comm + +theorem partialTrace_moment [DecidableEq A] {v : I → H (A × B)} + (hv : Summable (fun i => ‖v i‖^2)) (w : A → ℝ≥0∞) : + matrixMoment w (partialTrace v) = ∑' i, vectorMoment (fun ab : A × B => w ab.1) (v i) := by + rw [partialTrace, matrixMoment_ensemble (hasSum_slice_family hv.hasSum).summable] + simp only [vectorMoment, slice_apply] + rw [ENNReal.tsum_prod', ENNReal.tsum_comm] + congr 1 + funext i + rw [ENNReal.tsum_comm, ← ENNReal.tsum_prod] + +theorem tensor_add_moment (w : A → ℝ≥0∞) (u : B → ℝ≥0∞) (x : H A) (y : H B) : + vectorMoment (fun ab : A × B => w ab.1+u ab.2) (tensor x y) = + vectorMoment w x * ENNReal.ofReal (‖y‖^2) + + ENNReal.ofReal (‖x‖^2) * vectorMoment u y := by + have hx : (∑' a, ENNReal.ofReal (‖x a‖^2)) = ENNReal.ofReal (‖x‖^2) := by + simpa only [vectorMoment, one_mul] using vectorMoment_one x + have hy : (∑' b, ENNReal.ofReal (‖y b‖^2)) = ENNReal.ofReal (‖y‖^2) := by + simpa only [vectorMoment, one_mul] using vectorMoment_one y + change (∑' ab : A × B, (w ab.1+u ab.2)*ENNReal.ofReal (‖x ab.1*y ab.2‖^2)) = _ + simp only [norm_mul, mul_pow, ENNReal.ofReal_mul (sq_nonneg _), + add_mul, ENNReal.tsum_add, ENNReal.tsum_prod'] + congr 1 + · simp only [← mul_assoc, ENNReal.tsum_mul_left, ENNReal.tsum_mul_right, hy, vectorMoment] + · simp only [mul_left_comm (u _) (ENNReal.ofReal _), ENNReal.tsum_mul_left, + ENNReal.tsum_mul_right, hx, vectorMoment] + +theorem ensemble_tensor_add_moment [DecidableEq A] [DecidableEq B] + {v : I → H A} {J : Type*} {z : J → H B} + (hv : HasSum (fun i => ‖v i‖^2) 1) (hz : HasSum (fun j => ‖z j‖^2) 1) + (w : A → ℝ≥0∞) (u : B → ℝ≥0∞) : + (∑' ij : I × J, vectorMoment (fun ab : A × B => w ab.1+u ab.2) (tensor (v ij.1) (z ij.2))) = + matrixMoment w (TraceEnsemble.operator v) + matrixMoment u (TraceEnsemble.operator z) := by + have hv₁ : (∑' i, ENNReal.ofReal (‖v i‖^2)) = 1 := by + rw [← ENNReal.ofReal_tsum_of_nonneg (fun _ => sq_nonneg _) hv.summable, hv.tsum_eq] + norm_num + have hz₁ : (∑' j, ENNReal.ofReal (‖z j‖^2)) = 1 := by + rw [← ENNReal.ofReal_tsum_of_nonneg (fun _ => sq_nonneg _) hz.summable, hz.tsum_eq] + norm_num + simp only [tensor_add_moment, ENNReal.tsum_add, ENNReal.tsum_prod', + ENNReal.tsum_mul_left, ENNReal.tsum_mul_right, hv₁, hz₁, one_mul, mul_one] + rw [matrixMoment_ensemble hv.summable, matrixMoment_ensemble hz.summable] + +end TensorLp + +namespace EntropyPhotonNumber +open TensorLp FischerBeam + +theorem beam_sector_weighted_mass {n : ℕ} (η : ℝ) (hη : η ∈ Set.Icc 0 1) + (x : JointFock n) (w : NumberIndex n → ℝ≥0∞) : + (∑' a : NumberSector n, w a.1 * ENNReal.ofReal + (‖inner ℂ (jointSectorBasis n a) (beamUnitary η hη x)‖^2)) = + ∑' a : NumberSector n, w a.1 * ENNReal.ofReal (‖inner ℂ (jointSectorBasis n a) x‖^2) := by + unfold beamUnitary + exact BlockUnitary.unitary_weighted_mass _ _ _ _ _ _ + +theorem beam_vector_moment {n : ℕ} (η : ℝ) (hη : η ∈ Set.Icc 0 1) + (x : JointFock n) (w : NumberIndex n → ℝ≥0∞) : + vectorMoment (fun ab : PairedIndex n => w (fun j => ab.1 j+ab.2 j)) (beamUnitary η hη x) = + vectorMoment (fun ab : PairedIndex n => w (fun j => ab.1 j+ab.2 j)) x := by + unfold vectorMoment + rw [← (sectorEquiv n).tsum_eq (fun ab => w (fun j => ab.1 j+ab.2 j) * + ENNReal.ofReal (‖beamUnitary η hη x ab‖^2)), + ← (sectorEquiv n).tsum_eq (fun ab => w (fun j => ab.1 j+ab.2 j) * + ENNReal.ofReal (‖x ab‖^2))] + have he (a : NumberSector n) : + (fun j => (sectorEquiv n a).1 j+(sectorEquiv n a).2 j) = a.1 := by + funext j + exact Nat.add_sub_of_le (Nat.le_of_lt_succ (a.2 j).isLt) + simpa only [he, jointSectorBasis_apply, lp.inner_single_left, RCLike.inner_apply, + map_one, one_mul, mul_one] using beam_sector_weighted_mass η hη x w + +theorem beam_total_moment {n : ℕ} (η : ℝ) (hη : η ∈ Set.Icc 0 1) (x : JointFock n) : + vectorMoment (fun ab : PairedIndex n => (totalNumber ab.1 : ℝ≥0∞)+totalNumber ab.2) + (beamUnitary η hη x) = + vectorMoment (fun ab : PairedIndex n => (totalNumber ab.1 : ℝ≥0∞)+totalNumber ab.2) x := by + simpa only [totalNumber, Finset.sum_add_distrib, Nat.cast_add] using + beam_vector_moment η hη x (fun k => (totalNumber k : ℝ≥0∞)) + +def energyMoment {n : ℕ} (ρ : State n) : ℝ≥0∞ := + matrixMoment (fun k => (totalNumber k : ℝ≥0∞)) ρ.op + +theorem energyMoment_eq {n : ℕ} (ρ : State n) : + energyMoment ρ = ∑' k, ENNReal.ofReal ((totalNumber k : ℝ)*(entry ρ.op k k).re) := by + simp only [energyMoment, matrixMoment, entry, numberKet, + ENNReal.ofReal_mul (Nat.cast_nonneg _), ENNReal.ofReal_natCast] + +theorem finiteEnergy_iff {n : ℕ} (ρ : State n) : FiniteEnergy ρ ↔ energyMoment ρ < ⊤ := by + rw [energyMoment_eq] + have hp (k : NumberIndex n) : 0 ≤ (totalNumber k : ℝ)*(entry ρ.op k k).re := + mul_nonneg (Nat.cast_nonneg _) (ρ.positive.re_inner_nonneg_right _) + constructor + · intro h + exact h.tsum_ofReal_lt_top + · intro h + have hs := ENNReal.summable_toReal h.ne + change Summable (fun k => (totalNumber k : ℝ)*(entry ρ.op k k).re) + simpa only [ENNReal.toReal_ofReal (hp _)] using hs + +theorem beamOutput_energy_le {n : ℕ} (η : ℝ) (hη : η ∈ Set.Icc 0 1) (ρA ρB : State n) : + energyMoment (beamOutput η hη ρA ρB) ≤ energyMoment ρA + energyMoment ρB := by + change matrixMoment _ (partialTrace (mixedVector η hη ρA ρB)) ≤ _ + rw [partialTrace_moment (mixedVector_norm η hη ρA ρB).summable] + calc + _ ≤ ∑' a, vectorMoment (fun ab : PairedIndex n => + (totalNumber ab.1 : ℝ≥0∞)+totalNumber ab.2) (mixedVector η hη ρA ρB a) := by + apply ENNReal.tsum_le_tsum + intro a + apply ENNReal.tsum_le_tsum + intro ab + exact mul_le_mul' le_self_add le_rfl + _ = ∑' a : PairedIndex n, vectorMoment (fun ab : PairedIndex n => + (totalNumber ab.1 : ℝ≥0∞)+totalNumber ab.2) + (tensor (rootColumn ρA a.1) (rootColumn ρB a.2)) := by + simp only [mixedVector, beam_total_moment] + _ = energyMoment ρA + energyMoment ρB := by + rw [ensemble_tensor_add_moment (rootColumn_norm ρA) (rootColumn_norm ρB) + (fun k => (totalNumber k : ℝ≥0∞)) (fun k => (totalNumber k : ℝ≥0∞)), + rootColumn_operator, rootColumn_operator] + rfl + +theorem beamOutput_finiteEnergy {n : ℕ} (η : ℝ) (hη : η ∈ Set.Icc 0 1) {ρA ρB : State n} + (hA : FiniteEnergy ρA) (hB : FiniteEnergy ρB) : FiniteEnergy (beamOutput η hη ρA ρB) := by + apply (finiteEnergy_iff _).mpr + exact (beamOutput_energy_le η hη ρA ρB).trans_lt + (ENNReal.add_lt_top.mpr ⟨(finiteEnergy_iff ρA).mp hA, (finiteEnergy_iff ρB).mp hB⟩) + +end EntropyPhotonNumber + +namespace TensorLp +variable {A B : Type*} + +theorem sum_slice_moment (w : A → ℝ≥0∞) (z : H (A × B)) : + (∑' b, vectorMoment w (slice z b)) = vectorMoment (fun ab : A × B => w ab.1) z := by + simp only [vectorMoment, slice_apply] + rw [ENNReal.tsum_comm, ← ENNReal.tsum_prod] + +end TensorLp + +namespace EntropyPhotonNumber +open TensorLp + +def firstKraus {n : ℕ} (η : ℝ) (hη : η ∈ Set.Icc 0 1) (σ : State n) + (eb : NumberIndex n × NumberIndex n) : Fock n →L[ℂ] Fock n := + sliceCLM eb.1 ∘L ((beamUnitary η hη).toContinuousLinearEquiv.toContinuousLinearMap ∘L + tensorRight (rootColumn σ eb.2)) + +@[simp] theorem firstKraus_apply {n : ℕ} (η : ℝ) (hη : η ∈ Set.Icc 0 1) (σ : State n) + (eb : NumberIndex n × NumberIndex n) (x : Fock n) : + firstKraus η hη σ eb x = slice (beamUnitary η hη (tensor x (rootColumn σ eb.2))) eb.1 := rfl + +theorem firstKraus_norm {n : ℕ} (η : ℝ) (hη : η ∈ Set.Icc 0 1) (σ : State n) (x : Fock n) : + HasSum (fun eb => ‖firstKraus η hη σ eb x‖^2) (‖x‖^2) := by + simp only [firstKraus_apply] + apply hasSum_slice_family (v := fun b => beamUnitary η hη (tensor x (rootColumn σ b))) + simpa only [LinearIsometryEquiv.norm_map, tensor_norm_sq, mul_one] using + (rootColumn_norm σ).mul_left (‖x‖^2) + +theorem firstKraus_energy {n : ℕ} (η : ℝ) (hη : η ∈ Set.Icc 0 1) (σ : State n) (x : Fock n) : + (∑' eb, vectorMoment (fun k => (totalNumber k : ℝ≥0∞)) (firstKraus η hη σ eb x)) ≤ + vectorMoment (fun k => (totalNumber k : ℝ≥0∞)) x + + energyMoment σ * ENNReal.ofReal (‖x‖^2) := by + have hn : (∑' b, ENNReal.ofReal (‖rootColumn σ b‖^2)) = 1 := by + rw [← ENNReal.ofReal_tsum_of_nonneg (fun _ => sq_nonneg _) (rootColumn_norm σ).summable, + (rootColumn_norm σ).tsum_eq, ENNReal.ofReal_one] + have he : (∑' b, vectorMoment (fun k => (totalNumber k : ℝ≥0∞)) (rootColumn σ b)) = + energyMoment σ := by + rw [← matrixMoment_ensemble (rootColumn_norm σ).summable, rootColumn_operator] + rfl + simp only [firstKraus_apply, ENNReal.tsum_prod'] + rw [ENNReal.tsum_comm] + simp only [sum_slice_moment] + calc + _ ≤ ∑' b, vectorMoment (fun ab : NumberIndex n × NumberIndex n => + (totalNumber ab.1 : ℝ≥0∞)+totalNumber ab.2) + (beamUnitary η hη (tensor x (rootColumn σ b))) := by + apply ENNReal.tsum_le_tsum + intro b + apply ENNReal.tsum_le_tsum + intro ab + exact mul_le_mul' le_self_add le_rfl + _ = _ := by + simp only [beam_total_moment] + simp_rw [tensor_add_moment (fun k : NumberIndex n => (totalNumber k : ℝ≥0∞)) + (fun k : NumberIndex n => (totalNumber k : ℝ≥0∞))] + simp only [ENNReal.tsum_add, + ENNReal.tsum_mul_left, ENNReal.tsum_mul_right, hn, he, mul_comm, one_mul] + +def secondKraus {n : ℕ} (η : ℝ) (hη : η ∈ Set.Icc 0 1) (ρ : State n) + (ea : NumberIndex n × NumberIndex n) : Fock n →L[ℂ] Fock n := + sliceCLM ea.1 ∘L ((beamUnitary η hη).toContinuousLinearEquiv.toContinuousLinearMap ∘L + tensorLeft (rootColumn ρ ea.2)) + +@[simp] theorem secondKraus_apply {n : ℕ} (η : ℝ) (hη : η ∈ Set.Icc 0 1) (ρ : State n) + (ea : NumberIndex n × NumberIndex n) (x : Fock n) : + secondKraus η hη ρ ea x = slice (beamUnitary η hη (tensor (rootColumn ρ ea.2) x)) ea.1 := rfl + +theorem secondKraus_norm {n : ℕ} (η : ℝ) (hη : η ∈ Set.Icc 0 1) (ρ : State n) (x : Fock n) : + HasSum (fun ea => ‖secondKraus η hη ρ ea x‖^2) (‖x‖^2) := by + simp only [secondKraus_apply] + apply hasSum_slice_family (v := fun a => beamUnitary η hη (tensor (rootColumn ρ a) x)) + simpa only [LinearIsometryEquiv.norm_map, tensor_norm_sq, one_mul] using + (rootColumn_norm ρ).mul_right (‖x‖^2) + +theorem secondKraus_energy {n : ℕ} (η : ℝ) (hη : η ∈ Set.Icc 0 1) (ρ : State n) (x : Fock n) : + (∑' ea, vectorMoment (fun k => (totalNumber k : ℝ≥0∞)) (secondKraus η hη ρ ea x)) ≤ + vectorMoment (fun k => (totalNumber k : ℝ≥0∞)) x + + energyMoment ρ * ENNReal.ofReal (‖x‖^2) := by + have hn : (∑' a, ENNReal.ofReal (‖rootColumn ρ a‖^2)) = 1 := by + rw [← ENNReal.ofReal_tsum_of_nonneg (fun _ => sq_nonneg _) (rootColumn_norm ρ).summable, + (rootColumn_norm ρ).tsum_eq, ENNReal.ofReal_one] + have he : (∑' a, vectorMoment (fun k => (totalNumber k : ℝ≥0∞)) (rootColumn ρ a)) = + energyMoment ρ := by + rw [← matrixMoment_ensemble (rootColumn_norm ρ).summable, rootColumn_operator] + rfl + simp only [secondKraus_apply, ENNReal.tsum_prod'] + rw [ENNReal.tsum_comm] + simp only [sum_slice_moment] + calc + _ ≤ ∑' a, vectorMoment (fun ab : NumberIndex n × NumberIndex n => + (totalNumber ab.1 : ℝ≥0∞)+totalNumber ab.2) + (beamUnitary η hη (tensor (rootColumn ρ a) x)) := by + apply ENNReal.tsum_le_tsum + intro a + apply ENNReal.tsum_le_tsum + intro ab + exact mul_le_mul' le_self_add le_rfl + _ = _ := by + simp only [beam_total_moment] + simp_rw [tensor_add_moment (fun k : NumberIndex n => (totalNumber k : ℝ≥0∞)) + (fun k : NumberIndex n => (totalNumber k : ℝ≥0∞))] + simp only [ENNReal.tsum_add, + ENNReal.tsum_mul_right, hn, he, one_mul, add_comm] + +def composeKraus {n : ℕ} {I J : Type*} (U : I → Fock n →L[ℂ] Fock n) + (V : J → Fock n →L[ℂ] Fock n) (ij : I × J) : Fock n →L[ℂ] Fock n := U ij.1 ∘L V ij.2 + +theorem composeKraus_norm {n : ℕ} {I J : Type*} (U : I → Fock n →L[ℂ] Fock n) + (V : J → Fock n →L[ℂ] Fock n) + (hU : ∀ x, HasSum (fun i => ‖U i x‖^2) (‖x‖^2)) + (hV : ∀ x, HasSum (fun j => ‖V j x‖^2) (‖x‖^2)) (x : Fock n) : + HasSum (fun ij => ‖composeKraus U V ij x‖^2) (‖x‖^2) := by + change HasSum (fun ij : I × J => ‖U ij.1 (V ij.2 x)‖^2) (‖x‖^2) + have hu (j : J) : (∑' i, ‖U i (V j x)‖^2) = ‖V j x‖^2 := (hU (V j x)).tsum_eq + have hs : Summable (fun ji : J × I => ‖U ji.2 (V ji.1 x)‖^2) := by + apply (summable_prod_of_nonneg (fun _ => sq_nonneg _)).mpr + exact ⟨fun j => (hU (V j x)).summable, by simpa only [hu] using (hV x).summable⟩ + have ht : (∑' ji : J × I, ‖U ji.2 (V ji.1 x)‖^2) = ‖x‖^2 := by + rw [hs.tsum_prod] + simpa only [hu] using (hV x).tsum_eq + have hsum : HasSum (fun ji : J × I => ‖U ji.2 (V ji.1 x)‖^2) (‖x‖^2) := ht ▸ hs.hasSum + exact (Equiv.prodComm I J).hasSum_iff.mpr hsum + +theorem composeKraus_energy {n : ℕ} {I J : Type*} (U : I → Fock n →L[ℂ] Fock n) + (V : J → Fock n →L[ℂ] Fock n) {EU EV : ℝ≥0∞} + (hV : ∀ x, HasSum (fun j => ‖V j x‖^2) (‖x‖^2)) + (hEU : ∀ x, (∑' i, vectorMoment (fun k => (totalNumber k : ℝ≥0∞)) (U i x)) ≤ + vectorMoment (fun k => (totalNumber k : ℝ≥0∞)) x+EU*ENNReal.ofReal (‖x‖^2)) + (hEV : ∀ x, (∑' j, vectorMoment (fun k => (totalNumber k : ℝ≥0∞)) (V j x)) ≤ + vectorMoment (fun k => (totalNumber k : ℝ≥0∞)) x+EV*ENNReal.ofReal (‖x‖^2)) + (x : Fock n) : + (∑' ij, vectorMoment (fun k => (totalNumber k : ℝ≥0∞)) (composeKraus U V ij x)) ≤ + vectorMoment (fun k => (totalNumber k : ℝ≥0∞)) x+(EU+EV)*ENNReal.ofReal (‖x‖^2) := by + have hn : (∑' j, ENNReal.ofReal (‖V j x‖^2)) = ENNReal.ofReal (‖x‖^2) := by + rw [← ENNReal.ofReal_tsum_of_nonneg (fun _ => sq_nonneg _) (hV x).summable, (hV x).tsum_eq] + change (∑' ij : I × J, vectorMoment _ (U ij.1 (V ij.2 x))) ≤ _ + rw [ENNReal.tsum_prod', ENNReal.tsum_comm] + calc + _ ≤ ∑' j, (vectorMoment (fun k => (totalNumber k : ℝ≥0∞)) (V j x)+EU*ENNReal.ofReal (‖V j x‖^2)) := + ENNReal.tsum_le_tsum (fun j => hEU (V j x)) + _ = (∑' j, vectorMoment (fun k => (totalNumber k : ℝ≥0∞)) (V j x))+EU*ENNReal.ofReal (‖x‖^2) := by + rw [ENNReal.tsum_add, ENNReal.tsum_mul_left, hn] + _ ≤ _ := by + have hh := add_le_add_right (hEV x) (EU*ENNReal.ofReal (‖x‖^2)) + simpa only [add_mul, add_assoc, add_left_comm, add_comm] using hh + +theorem state_ext {n : ℕ} {ρ σ : State n} (h : ρ.op = σ.op) : ρ = σ := by + cases ρ; cases σ; cases h; rfl + +theorem output_unique {n : ℕ} {η : ℝ} {ρA ρB ρC ρD : State n} + (hC : IsBeamSplitterOutput η ρA ρB ρC) (hD : IsBeamSplitterOutput η ρA ρB ρD) : + ρC = ρD := by + apply state_ext + exact entry_ext fun k l => (hC k l).unique (hD k l) + +theorem output_eq {n : ℕ} {η : ℝ} (hη : η ∈ Set.Icc 0 1) {ρA ρB ρC : State n} + (hC : IsBeamSplitterOutput η ρA ρB ρC) : ρC = beamOutput η hη ρA ρB := + output_unique hC (beamOutput_spec η hη ρA ρB) + +end EntropyPhotonNumber + +namespace TraceEnsemble +variable {E : Type*} [NormedAddCommGroup E] [InnerProductSpace ℂ E] [CompleteSpace E] +variable {I J K : Type*} + +omit [CompleteSpace E] in +theorem operator_reindex (e : I ≃ J) (v : J → E) : operator (fun i => v (e i)) = operator v := by + exact e.tsum_eq (fun j => InnerProductSpace.rankOne ℂ (v j) (v j)) + +omit [CompleteSpace E] in +theorem kraus_hasSum {V : I → E →L[ℂ] E} + (hV : ∀ x, HasSum (fun i => ‖V i x‖^2) (‖x‖^2)) + {v : J → E} {t : ℝ} (hv : HasSum (fun j => ‖v j‖^2) t) : + HasSum (fun ij : I × J => ‖V ij.1 (v ij.2)‖^2) t := by + have hu (j : J) : (∑' i, ‖V i (v j)‖^2) = ‖v j‖^2 := (hV (v j)).tsum_eq + have hs : Summable (fun ji : J × I => ‖V ji.2 (v ji.1)‖^2) := by + apply (summable_prod_of_nonneg (fun _ => sq_nonneg _)).mpr + exact ⟨fun j => (hV (v j)).summable, by simpa only [hu] using hv.summable⟩ + have ht : (∑' ji : J × I, ‖V ji.2 (v ji.1)‖^2) = t := by + rw [hs.tsum_prod] + simpa only [hu] using hv.tsum_eq + have hsum : HasSum (fun ji : J × I => ‖V ji.2 (v ji.1)‖^2) t := ht ▸ hs.hasSum + exact (Equiv.prodComm I J).hasSum_iff.mpr hsum + +end TraceEnsemble + +namespace EntropyPhotonNumber +open TensorLp +theorem beam_ensemble {n : ℕ} {I J : Type*} (η : ℝ) (hη : η ∈ Set.Icc 0 1) + (ρ σ : State n) (v : I → Fock n) (w : J → Fock n) + (hv : HasSum (fun i => ‖v i‖^2) 1) (hw : HasSum (fun j => ‖w j‖^2) 1) + (hev : TraceEnsemble.operator v = ρ.op) (hew : TraceEnsemble.operator w = σ.op) : + partialTrace (fun ij : I × J => beamUnitary η hη (tensor (v ij.1) (w ij.2))) = + (beamOutput η hη ρ σ).op := by + have hn : Summable (fun ij : I × J => ‖beamUnitary η hη (tensor (v ij.1) (w ij.2))‖^2) := by + simpa only [LinearIsometryEquiv.norm_map] using (TraceEnsemble.hasSum_tensor_norm hv hw).summable + apply entry_ext + intro k l + have hh : HasSum (fun e => outputBlock η ρ σ k l e) + (entry (partialTrace (fun ij : I × J => beamUnitary η hη (tensor (v ij.1) (w ij.2)))) k l) := by + simpa only [entry, numberKet, beam_ensemble_entry η hη ρ σ v w hv hw hev hew] using + partialTrace_entry hn k l + exact hh.unique (beamOutput_spec η hη ρ σ k l) + +theorem firstKraus_ensemble {n : ℕ} {I : Type*} (η : ℝ) (hη : η ∈ Set.Icc 0 1) + (ρ σ : State n) (v : I → Fock n) (hv : HasSum (fun i => ‖v i‖^2) 1) + (hev : TraceEnsemble.operator v = ρ.op) : + TraceEnsemble.operator (fun ei : (NumberIndex n × NumberIndex n) × I => + firstKraus η hη σ ei.1 (v ei.2)) = (beamOutput η hη ρ σ).op := by + let e := (Equiv.prodAssoc (NumberIndex n) (NumberIndex n) I).trans + (Equiv.prodCongr (Equiv.refl (NumberIndex n)) (Equiv.prodComm (NumberIndex n) I)) + have he := TraceEnsemble.operator_reindex e (fun z : NumberIndex n × (I × NumberIndex n) => + slice (beamUnitary η hη (tensor (v z.2.1) (rootColumn σ z.2.2))) z.1) + change _ = partialTrace (fun ij : I × NumberIndex n => beamUnitary η hη (tensor (v ij.1) (rootColumn σ ij.2))) at he + exact he.trans (beam_ensemble η hη ρ σ v (rootColumn σ) hv (rootColumn_norm σ) hev (rootColumn_operator σ)) + +theorem secondKraus_ensemble {n : ℕ} {I : Type*} (η : ℝ) (hη : η ∈ Set.Icc 0 1) + (ρ σ : State n) (v : I → Fock n) (hv : HasSum (fun i => ‖v i‖^2) 1) + (hev : TraceEnsemble.operator v = σ.op) : + TraceEnsemble.operator (fun ei : (NumberIndex n × NumberIndex n) × I => + secondKraus η hη ρ ei.1 (v ei.2)) = (beamOutput η hη ρ σ).op := by + have he := TraceEnsemble.operator_reindex (Equiv.prodAssoc (NumberIndex n) (NumberIndex n) I) + (fun z : NumberIndex n × (NumberIndex n × I) => + slice (beamUnitary η hη (tensor (rootColumn ρ z.2.1) (v z.2.2))) z.1) + change _ = partialTrace (fun ij : NumberIndex n × I => beamUnitary η hη (tensor (rootColumn ρ ij.1) (v ij.2))) at he + exact he.trans (beam_ensemble η hη ρ σ (rootColumn ρ) v (rootColumn_norm ρ) hv (rootColumn_operator ρ) hev) + +theorem composeKraus_ensemble {n : ℕ} {I J K : Type*} + (U : I → Fock n →L[ℂ] Fock n) (V : J → Fock n →L[ℂ] Fock n) (v : K → Fock n) : + TraceEnsemble.operator (fun z : (I × J) × K => composeKraus U V z.1 (v z.2)) = + TraceEnsemble.operator (fun z : I × (J × K) => U z.1 (V z.2.1 (v z.2.2))) := by + unfold composeKraus + exact TraceEnsemble.operator_reindex (Equiv.prodAssoc I J K) + (fun z : I × (J × K) => U z.1 (V z.2.1 (v z.2.2))) + +end EntropyPhotonNumber + +namespace EnsembleL2 +open scoped BigOperators ComplexConjugate +variable {I J E : Type*} [NormedAddCommGroup E] [InnerProductSpace ℂ E] + +def vector (v : I → E) (hv : Summable (fun i => ‖v i‖^2)) : lp (fun _ : I => E) 2 := + ⟨v, (memℓp_gen_iff (by norm_num : 0 < (2 : ENNReal).toReal)).mpr + (by simpa only [ENNReal.toReal_ofNat, Real.rpow_two] using hv)⟩ +omit [InnerProductSpace ℂ E] in +@[simp] theorem vector_apply (v : I → E) (hv : Summable (fun i => ‖v i‖^2)) (i : I) : vector v hv i = v i := rfl + +omit [InnerProductSpace ℂ E] in +theorem norm_sum (v : I → E) (hv : Summable (fun i => ‖v i‖^2)) : + HasSum (fun i => ‖v i‖^2) (‖vector v hv‖^2) := by + simpa only [ENNReal.toReal_ofNat, Real.rpow_two, vector_apply] using + lp.hasSum_norm (p := 2) (by norm_num) (vector v hv) + +theorem inner_sum (v w : I → E) (hv : Summable (fun i => ‖v i‖^2)) (hw : Summable (fun i => ‖w i‖^2)) : + HasSum (fun i => inner ℂ (v i) (w i)) (inner ℂ (vector v hv) (vector w hw)) := + lp.hasSum_inner (𝕜 := ℂ) (vector v hv) (vector w hw) + +theorem image_summable (v : I → E) (hv : Summable (fun i => ‖v i‖^2)) (T : E →L[ℂ] E) : + Summable (fun i => ‖T (v i)‖^2) := by + apply (hv.mul_left (‖T‖^2)).of_nonneg_of_le (fun _ => sq_nonneg _) + intro i + simpa only [mul_pow] using pow_le_pow_left₀ (norm_nonneg _) (T.le_opNorm (v i)) 2 + +theorem projection_bound (x a b : E) (hab : inner ℂ a b = 0) + (hax : inner ℂ a x = inner ℂ a a) (hbx : inner ℂ b x = inner ℂ b b) : + ‖a‖^2+‖b‖^2 ≤ ‖x‖^2 := by + have hba : inner ℂ b a = 0 := by rw [← inner_conj_symm b a, hab, map_zero] + have hxa : inner ℂ x a = inner ℂ a a := by + rw [← inner_conj_symm x a, hax, inner_self_conj] + have hxb : inner ℂ x b = inner ℂ b b := by + rw [← inner_conj_symm x b, hbx, inner_self_conj] + have hh : 0 ≤ (inner ℂ (x-a-b) (x-a-b)).re := inner_self_nonneg (𝕜 := ℂ) (x := x-a-b) + simp only [inner_sub_left, inner_sub_right, hax, hbx, hxa, hxb, hab, hba] at hh + simp only [Complex.sub_re, Complex.zero_re] at hh + have hn (v : E) : (inner ℂ v v).re = ‖v‖^2 := by + exact (norm_sq_eq_re_inner (𝕜 := ℂ) v).symm + simp only [hn] at hh + nlinarith + +theorem projection_sums (x a b : I → E) (u v w : ℝ) + (hx : HasSum (fun i => ‖x i‖^2) w) (ha : HasSum (fun i => ‖a i‖^2) u) + (hb : HasSum (fun i => ‖b i‖^2) v) + (hab : HasSum (fun i => inner ℂ (a i) (b i)) 0) + (hax : HasSum (fun i => inner ℂ (a i) (x i)) (u : ℂ)) + (hbx : HasSum (fun i => inner ℂ (b i) (x i)) (v : ℂ)) : u+v ≤ w := by + have hna := (norm_sum a ha.summable).unique ha + have hnb := (norm_sum b hb.summable).unique hb + have hnx := (norm_sum x hx.summable).unique hx + have hh := projection_bound (vector x hx.summable) (vector a ha.summable) (vector b hb.summable) + ((inner_sum a b ha.summable hb.summable).unique hab) + (by rw [(inner_sum a x ha.summable hx.summable).unique hax, inner_self_eq_norm_sq_to_K] + change (u:ℂ)=(‖vector a ha.summable‖:ℂ)^2 + rw [← Complex.ofReal_pow, hna]) + (by rw [(inner_sum b x hb.summable hx.summable).unique hbx, inner_self_eq_norm_sq_to_K] + change (v:ℂ)=(‖vector b hb.summable‖:ℂ)^2 + rw [← Complex.ofReal_pow, hnb]) + rwa [hna, hnb, hnx] at hh + +theorem fubini_inner (a z : I × J → E) (u : I → ℂ) (t : ℂ) + (ha : Summable (fun ij => ‖a ij‖^2)) (hz : Summable (fun ij => ‖z ij‖^2)) + (hrow : ∀ i, HasSum (fun j => inner ℂ (a (i,j)) (z (i,j))) (u i)) + (hu : HasSum u t) : HasSum (fun ij => inner ℂ (a ij) (z ij)) t := by + have hh := inner_sum a z ha hz + exact (hh.prod_fiberwise hrow).unique hu ▸ hh + +theorem fubini_inner_second (a z : I × J → E) (u : J → ℂ) (t : ℂ) + (ha : Summable (fun ij => ‖a ij‖^2)) (hz : Summable (fun ij => ‖z ij‖^2)) + (hrow : ∀ j, HasSum (fun i => inner ℂ (a (i,j)) (z (i,j))) (u j)) + (hu : HasSum u t) : HasSum (fun ij => inner ℂ (a ij) (z ij)) t := by + have hh := fubini_inner (fun ji : J × I => a (ji.2,ji.1)) + (fun ji : J × I => z (ji.2,ji.1)) u t + ha.prod_symm hz.prod_symm hrow hu + exact (Equiv.prodComm J I).hasSum_iff (f := fun ij => inner ℂ (a ij) (z ij)) |>.mp hh + +theorem self_inner_hasSum (v : I → E) (hv : Summable (fun i => ‖v i‖^2)) : + HasSum (fun i => inner ℂ (v i) (v i)) (((∑' i, ‖v i‖^2):ℝ):ℂ) := by + have hh := hv.hasSum.mapL Complex.ofRealCLM + have he (i : I) : inner ℂ (v i) (v i) = (((‖v i‖^2):ℝ):ℂ) := by + rw [inner_self_eq_norm_sq_to_K] + change (‖v i‖:ℂ)^2=(((‖v i‖^2):ℝ):ℂ) + rw [Complex.ofReal_pow] + simpa only [he, Complex.ofRealCLM_apply] using hh + +end EnsembleL2 + +namespace TensorLp +open scoped BigOperators ComplexConjugate +variable {A B I J : Type*} +theorem conditional_left_overlap (x : I → H A) (y : J → H B) + (hx : Summable (fun i => ‖x i‖^2)) (hy : HasSum (fun j => ‖y j‖^2) 1) + (Z : H (A × B) →L[ℂ] H (A × B)) (S : H A →L[ℂ] H A) + (hentry : ∀ u v, HasSum (fun j => inner ℂ (tensor u (y j)) (Z (tensor v (y j)))) (inner ℂ u (S v))) : + HasSum (fun ij : I × J => inner ℂ (tensor (S (x ij.1)) (y ij.2)) + (Z (tensor (x ij.1) (y ij.2)))) (((∑' i, ‖S (x i)‖^2) : ℝ):ℂ) := by + exact EnsembleL2.fubini_inner + (fun ij : I × J => tensor (S (x ij.1)) (y ij.2)) + (fun ij : I × J => Z (tensor (x ij.1) (y ij.2))) + (fun i => inner ℂ (S (x i)) (S (x i))) _ + (tensorFamily_summable (fun i => S (x i)) y (EnsembleL2.image_summable x hx S) hy.summable) + (EnsembleL2.image_summable (fun ij : I × J => tensor (x ij.1) (y ij.2)) + (tensorFamily_summable x y hx hy.summable) Z) + (fun i => hentry (S (x i)) (x i)) + (EnsembleL2.self_inner_hasSum (fun i => S (x i)) (EnsembleL2.image_summable x hx S)) + +theorem conditional_right_overlap (x : I → H A) (y : J → H B) + (hx : HasSum (fun i => ‖x i‖^2) 1) (hy : Summable (fun j => ‖y j‖^2)) + (Z : H (A × B) →L[ℂ] H (A × B)) (T : H B →L[ℂ] H B) + (hentry : ∀ u v, HasSum (fun i => inner ℂ (tensor (x i) u) (Z (tensor (x i) v))) (inner ℂ u (T v))) : + HasSum (fun ij : I × J => inner ℂ (tensor (x ij.1) (T (y ij.2))) + (Z (tensor (x ij.1) (y ij.2)))) (((∑' j, ‖T (y j)‖^2) : ℝ):ℂ) := by + exact EnsembleL2.fubini_inner_second + (fun ij : I × J => tensor (x ij.1) (T (y ij.2))) + (fun ij : I × J => Z (tensor (x ij.1) (y ij.2))) + (fun j => inner ℂ (T (y j)) (T (y j))) _ + (tensorFamily_summable x (fun j => T (y j)) hx.summable (EnsembleL2.image_summable y hy T)) + (EnsembleL2.image_summable (fun ij : I × J => tensor (x ij.1) (y ij.2)) + (tensorFamily_summable x y hx.summable hy) Z) + (fun j => hentry (T (y j)) (y j)) + (EnsembleL2.self_inner_hasSum (fun j => T (y j)) (EnsembleL2.image_summable y hy T)) + + theorem tensorFamily_norm (x : I → H A) (y : J → H B) (α β : ℝ) + (hx : HasSum (fun i => ‖x i‖^2) α) (hy : HasSum (fun j => ‖y j‖^2) β) : + HasSum (fun ij : I × J => ‖tensor (x ij.1) (y ij.2)‖^2) (α*β) := by + have hs := hx.summable.mul_of_nonneg hy.summable (fun _ => sq_nonneg _) (fun _ => sq_nonneg _) + simpa only [tensor_norm_sq] using hx.mul hy hs + + theorem tensorFamily_orthogonal (x x' : I → H A) (y y' : J → H B) + (hx : Summable (fun i => ‖x i‖^2)) (hx' : Summable (fun i => ‖x' i‖^2)) + (hy : Summable (fun j => ‖y j‖^2)) (hy' : Summable (fun j => ‖y' j‖^2)) + (hleft : HasSum (fun i => inner ℂ (x i) (x' i)) 0) + (hright : HasSum (fun j => inner ℂ (y j) (y' j)) 0) : + HasSum (fun ij : I × J => inner ℂ (tensor (x ij.1) (y ij.2)) (tensor (x' ij.1) (y' ij.2))) 0 := by + have hs := (EnsembleL2.inner_sum + (fun ij : I × J => tensor (x ij.1) (y ij.2)) + (fun ij : I × J => tensor (x' ij.1) (y' ij.2)) + (tensorFamily_summable x y hx hy) (tensorFamily_summable x' y' hx' hy')).summable + simp only [inner_tensor] at hs + simpa only [inner_tensor, zero_mul] using hleft.mul hright hs + +theorem arithmetic_projection (x : I → H A) (y : J → H B) + (hx : HasSum (fun i => ‖x i‖^2) 1) (hy : HasSum (fun j => ‖y j‖^2) 1) + (Z : H (A × B) →L[ℂ] H (A × B)) + (S : H A →L[ℂ] H A) (T : H B →L[ℂ] H B) + (hSentry : ∀ u v, HasSum (fun j => inner ℂ (tensor u (y j)) (Z (tensor v (y j)))) (inner ℂ u (S v))) + (hTentry : ∀ u v, HasSum (fun i => inner ℂ (tensor (x i) u) (Z (tensor (x i) v))) (inner ℂ u (T v))) + (hleft : HasSum (fun i => inner ℂ (x i) (S (x i))) 0) + (hright : HasSum (fun j => inner ℂ (y j) (T (y j))) 0) : + (∑' i, ‖S (x i)‖^2)+(∑' j, ‖T (y j)‖^2) ≤ + ∑' ij : I × J, ‖Z (tensor (x ij.1) (y ij.2))‖^2 := by + have hS := EnsembleL2.image_summable x hx.summable S + have hT := EnsembleL2.image_summable y hy.summable T + let z := fun ij : I × J => Z (tensor (x ij.1) (y ij.2)) + let a := fun ij : I × J => tensor (S (x ij.1)) (y ij.2) + let b := fun ij : I × J => tensor (x ij.1) (T (y ij.2)) + have hz : Summable (fun ij => ‖z ij‖^2) := + EnsembleL2.image_summable (fun ij : I × J => tensor (x ij.1) (y ij.2)) (tensorFamily_summable x y hx.summable hy.summable) Z + have ha : HasSum (fun ij => ‖a ij‖^2) (∑' i, ‖S (x i)‖^2) := by + exact mul_one (∑' i, ‖S (x i)‖^2) ▸ tensorFamily_norm (fun i => S (x i)) y _ 1 hS.hasSum hy + have hb : HasSum (fun ij => ‖b ij‖^2) (∑' j, ‖T (y j)‖^2) := by + exact one_mul (∑' j, ‖T (y j)‖^2) ▸ tensorFamily_norm x (fun j => T (y j)) 1 _ hx hT.hasSum + have hcl : HasSum (fun i => inner ℂ (S (x i)) (x i)) 0 := by + have hh := hleft.mapL Complex.conjCLE.toContinuousLinearMap + change HasSum (fun i => conj (inner ℂ (x i) (S (x i)))) (conj 0) at hh + simpa only [map_zero, inner_conj_symm] using hh + have hab : HasSum (fun ij => inner ℂ (a ij) (b ij)) 0 := + tensorFamily_orthogonal (fun i => S (x i)) x y (fun j => T (y j)) hS hx.summable hy.summable hT hcl hright + exact EnsembleL2.projection_sums z a b _ _ _ hz.hasSum ha hb hab + (conditional_left_overlap x y hx.summable hy Z S hSentry) (conditional_right_overlap x y hx hy.summable Z T hTentry) +end TensorLp + +namespace KrausBounded +variable {E H I : Type*} [NormedAddCommGroup E] [InnerProductSpace ℂ E] + [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace E] [CompleteSpace H] + +theorem dual_point_square (V : I → E →L[ℂ] H) + (hV : ∀ x, HasSum (fun i => ‖V i x‖^2) (‖x‖^2)) + (Z : H →L[ℂ] H) (x : E) : + ‖dual V hV Z x‖^2 ≤ ∑' i, ‖Z (V i x)‖^2 := by + have hn : ‖(analysis V hV).adjoint‖ ≤ 1 := by + rw [LinearIsometryEquiv.norm_map] + exact analysis_norm V hV + have ht : ‖dual V hV Z x‖ ≤ ‖acted V hV Z x‖ := by + exact ((analysis V hV).adjoint.le_opNorm (acted V hV Z x)).trans + (by simpa only [one_mul] using mul_le_mul_of_nonneg_right hn (norm_nonneg (acted V hV Z x))) + have hs : HasSum (fun i => ‖Z (V i x)‖^2) (‖acted V hV Z x‖^2) := by + convert! lp.hasSum_norm (p:=2) (by norm_num) (acted V hV Z x) using 1 <;> simp only [ENNReal.toReal_ofNat, Real.rpow_two] + rfl + rw [hs.tsum_eq] + exact pow_le_pow_left₀ (norm_nonneg _) ht 2 +end KrausBounded + +namespace EnsembleL2 +open scoped BigOperators ComplexConjugate +variable {I J E : Type*} [NormedAddCommGroup E] [InnerProductSpace ℂ E] [CompleteSpace E] +def mean (v : I → E) (Z : E →L[ℂ] E) : ℂ := ∑' i, inner ℂ (v i) (Z (v i)) +def center (v : I → E) (Z : E →L[ℂ] E) : E →L[ℂ] E := Z-mean v Z • ContinuousLinearMap.id ℂ E + +omit [CompleteSpace E] in +theorem mean_hasSum (v : I → E) (hv : Summable (fun i => ‖v i‖^2)) (Z : E →L[ℂ] E) : + HasSum (fun i => inner ℂ (v i) (Z (v i))) (mean v Z) := + (inner_sum v (fun i => Z (v i)) hv (image_summable v hv Z)).summable.hasSum + +omit [CompleteSpace E] in +theorem center_mean (v : I → E) (hv : HasSum (fun i => ‖v i‖^2) 1) (Z : E →L[ℂ] E) : + HasSum (fun i => inner ℂ (v i) (center v Z (v i))) 0 := by + have hi : HasSum (fun i => inner ℂ (v i) (v i)) (1:ℂ) := by + simpa only [hv.tsum_eq, Complex.ofReal_one] using self_inner_hasSum v hv.summable + have hh := (mean_hasSum v hv.summable Z).sub (hi.mul_left (mean v Z)) + simpa only [center, sub_apply, smul_apply, inner_sub_right, inner_smul_right, + ContinuousLinearMap.id_apply, mul_one, sub_self] using hh +end EnsembleL2 + +namespace TensorLp +open scoped BigOperators ComplexConjugate +variable {A B I J : Type*} + +theorem conditionalLeft_mean (x : I → H A) (y : J → H B) + (hx : HasSum (fun i => ‖x i‖^2) 1) (hy : HasSum (fun j => ‖y j‖^2) 1) + (Z : H (A × B) →L[ℂ] H (A × B)) : + HasSum (fun i => inner ℂ (x i) (conditionalLeft y hy Z (x i))) + (EnsembleL2.mean (fun ij : I × J => tensor (x ij.1) (y ij.2)) Z) := by + have hh := EnsembleL2.mean_hasSum (fun ij : I × J => tensor (x ij.1) (y ij.2)) + (tensorFamily_summable x y hx.summable hy.summable) Z + exact hh.prod_fiberwise (fun i => conditionalLeft_entry y hy Z (x i) (x i)) + +theorem conditionalRight_mean (x : I → H A) (y : J → H B) + (hx : HasSum (fun i => ‖x i‖^2) 1) (hy : HasSum (fun j => ‖y j‖^2) 1) + (Z : H (A × B) →L[ℂ] H (A × B)) : + HasSum (fun j => inner ℂ (y j) (conditionalRight x hx Z (y j))) + (EnsembleL2.mean (fun ij : I × J => tensor (x ij.1) (y ij.2)) Z) := by + have hh := EnsembleL2.mean_hasSum (fun ij : I × J => tensor (x ij.1) (y ij.2)) + (tensorFamily_summable x y hx.summable hy.summable) Z + exact ((Equiv.prodComm J I).hasSum_iff.mpr hh).prod_fiberwise + (fun j => conditionalRight_entry x hx Z (y j) (y j)) + +theorem centered_arithmetic_projection (x : I → H A) (y : J → H B) + (hx : HasSum (fun i => ‖x i‖^2) 1) (hy : HasSum (fun j => ‖y j‖^2) 1) + (Z : H (A × B) →L[ℂ] H (A × B)) : + let T := EnsembleL2.center (fun ij : I × J => tensor (x ij.1) (y ij.2)) Z + (∑' i, ‖conditionalLeft y hy T (x i)‖^2)+(∑' j, ‖conditionalRight x hx T (y j)‖^2) ≤ + ∑' ij : I × J, ‖T (tensor (x ij.1) (y ij.2))‖^2 := by + dsimp only + let T := EnsembleL2.center (fun ij : I × J => tensor (x ij.1) (y ij.2)) Z + have hv : HasSum (fun ij : I × J => ‖tensor (x ij.1) (y ij.2)‖^2) 1 := by + simpa only [one_mul] using tensorFamily_norm x y 1 1 hx hy + have hm := EnsembleL2.center_mean (fun ij : I × J => tensor (x ij.1) (y ij.2)) hv Z + have hz : EnsembleL2.mean (fun ij : I × J => tensor (x ij.1) (y ij.2)) T=0 := hm.tsum_eq + apply arithmetic_projection x y hx hy T (conditionalLeft y hy T) (conditionalRight x hx T) + (conditionalLeft_entry y hy T) (conditionalRight_entry x hx T) + · exact hz ▸ conditionalLeft_mean x y hx hy T + · exact hz ▸ conditionalRight_mean x y hx hy T +end TensorLp + +namespace KrausBounded + +section +variable {E H I : Type*} [NormedAddCommGroup E] [InnerProductSpace ℂ E] + [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace E] [CompleteSpace H] + +theorem dual_id (V : I → E →L[ℂ] H) (hV : ∀ x, HasSum (fun i => ‖V i x‖^2) (‖x‖^2)) : + dual V hV (ContinuousLinearMap.id ℂ H)=ContinuousLinearMap.id ℂ E := by + have he : acted V hV (ContinuousLinearMap.id ℂ H)=analysis V hV := by + ext x i + rfl + rw [dual, he] + apply (ContinuousLinearMap.norm_map_iff_adjoint_comp_self _).mp + intro x + have hh : ‖analysis V hV x‖^2=‖x‖^2 := (wave_square V (fun y => (hV y).summable) x).trans (hV x).tsum_eq + nlinarith [norm_nonneg (analysis V hV x), norm_nonneg x] +end + +open scoped BigOperators ComplexConjugate +variable {E H K I : Type*} [NormedAddCommGroup E] [InnerProductSpace ℂ E] + [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace E] [CompleteSpace H] + +omit [CompleteSpace E] [CompleteSpace H] in +theorem family_hasSum (V : K → E →L[ℂ] H) + (hV : ∀ x, HasSum (fun k => ‖V k x‖^2) (‖x‖^2)) + (v : I → E) (t : ℝ) (hv : HasSum (fun i => ‖v i‖^2) t) : + HasSum (fun ik : I × K => ‖V ik.2 (v ik.1)‖^2) t := by + have hs : Summable (fun ik : I × K => ‖V ik.2 (v ik.1)‖^2) := by + apply (summable_prod_of_nonneg (fun _ => sq_nonneg _)).mpr + refine ⟨fun i => (hV (v i)).summable, ?_⟩ + simpa only [(hV _).tsum_eq] using hv.summable + have he : (∑' ik : I × K, ‖V ik.2 (v ik.1)‖^2)=t := by + rw [hs.tsum_prod] + simpa only [(hV _).tsum_eq] using hv.tsum_eq + exact he ▸ hs.hasSum + +theorem dual_output_mean (V : K → E →L[ℂ] H) + (hV : ∀ x, HasSum (fun k => ‖V k x‖^2) (‖x‖^2)) + (v : I → E) (hv : Summable (fun i => ‖v i‖^2)) (Z : H →L[ℂ] H) : + EnsembleL2.mean v (dual V hV Z)=EnsembleL2.mean (fun ik : I × K => V ik.2 (v ik.1)) Z := by + have hw := family_hasSum V hV v _ hv.hasSum + have hh := EnsembleL2.mean_hasSum (fun ik : I × K => V ik.2 (v ik.1)) hw.summable Z + exact (EnsembleL2.mean_hasSum v hv (dual V hV Z)).unique + (hh.prod_fiberwise (fun i => dual_entry V hV Z (v i) (v i))) + +theorem dual_center (V : K → E →L[ℂ] H) + (hV : ∀ x, HasSum (fun k => ‖V k x‖^2) (‖x‖^2)) + (v : I → E) (hv : Summable (fun i => ‖v i‖^2)) (Z : H →L[ℂ] H) : + EnsembleL2.center v (dual V hV Z)= + dual V hV (EnsembleL2.center (fun ik : I × K => V ik.2 (v ik.1)) Z) := by + unfold EnsembleL2.center + rw [dual_output_mean V hV v hv Z] + simp only [sub_eq_add_neg, ← neg_smul, dual_add, dual_smul, dual_id] + +theorem dual_variance (V : K → E →L[ℂ] H) + (hV : ∀ x, HasSum (fun k => ‖V k x‖^2) (‖x‖^2)) + (v : I → E) (hv : Summable (fun i => ‖v i‖^2)) (Z : H →L[ℂ] H) : + (∑' i, ‖EnsembleL2.center v (dual V hV Z) (v i)‖^2) ≤ + ∑' ik : I × K, ‖EnsembleL2.center (fun ik : I × K => V ik.2 (v ik.1)) Z (V ik.2 (v ik.1))‖^2 := by + let T := EnsembleL2.center (fun ik : I × K => V ik.2 (v ik.1)) Z + have hw := family_hasSum V hV v _ hv.hasSum + have hs := EnsembleL2.image_summable (fun ik : I × K => V ik.2 (v ik.1)) hw.summable T + rw [dual_center V hV v hv Z, hs.tsum_prod] + exact Summable.tsum_le_tsum (fun i => dual_point_square V hV T (v i)) + (EnsembleL2.image_summable v hv (dual V hV T)) hs.prod +end KrausBounded + +namespace TensorLp +open scoped BigOperators ComplexConjugate +variable {A B I J K E : Type*} [NormedAddCommGroup E] [InnerProductSpace ℂ E] [CompleteSpace E] + +theorem channel_arithmetic_projection (x : I → H A) (y : J → H B) + (hx : HasSum (fun i => ‖x i‖^2) 1) (hy : HasSum (fun j => ‖y j‖^2) 1) + (V : K → H (A × B) →L[ℂ] E) + (hV : ∀ z, HasSum (fun k => ‖V k z‖^2) (‖z‖^2)) + (Z : E →L[ℂ] E) : + let v := fun ij : I × J => tensor (x ij.1) (y ij.2) + let T := EnsembleL2.center v (KrausBounded.dual V hV Z) + (∑' i, ‖conditionalLeft y hy T (x i)‖^2)+(∑' j, ‖conditionalRight x hx T (y j)‖^2) ≤ + ∑' ik : (I × J) × K, ‖EnsembleL2.center (fun ik : (I × J) × K => V ik.2 (v ik.1)) Z (V ik.2 (v ik.1))‖^2 := by + exact (centered_arithmetic_projection x y hx hy (KrausBounded.dual V hV Z)).trans + (KrausBounded.dual_variance V hV (fun ij : I × J => tensor (x ij.1) (y ij.2)) + (tensorFamily_summable x y hx.summable hy.summable) Z) +end TensorLp + +namespace KrausBounded +open scoped BigOperators ComplexConjugate +variable {E H F I J : Type*} [NormedAddCommGroup E] [InnerProductSpace ℂ E] + [NormedAddCommGroup H] [InnerProductSpace ℂ H] [NormedAddCommGroup F] [InnerProductSpace ℂ F] + [CompleteSpace E] [CompleteSpace H] [CompleteSpace F] + +def composite (V : I → E →L[ℂ] H) (U : J → H →L[ℂ] F) (ij : I × J) : E →L[ℂ] F := U ij.2 ∘L V ij.1 + +omit [CompleteSpace E] [CompleteSpace H] [CompleteSpace F] in +theorem composite_norm (V : I → E →L[ℂ] H) (U : J → H →L[ℂ] F) + (hV : ∀ x, HasSum (fun i => ‖V i x‖^2) (‖x‖^2)) + (hU : ∀ x, HasSum (fun j => ‖U j x‖^2) (‖x‖^2)) (x : E) : + HasSum (fun ij => ‖composite V U ij x‖^2) (‖x‖^2) := + family_hasSum U hU (fun i => V i x) _ (hV x) + +theorem dual_composite (V : I → E →L[ℂ] H) (U : J → H →L[ℂ] F) + (hV : ∀ x, HasSum (fun i => ‖V i x‖^2) (‖x‖^2)) + (hU : ∀ x, HasSum (fun j => ‖U j x‖^2) (‖x‖^2)) (Z : F →L[ℂ] F) : + dual (composite V U) (composite_norm V U hV hU) Z=dual V hV (dual U hU Z) := by + ext y + apply ext_inner_left ℂ + intro x + have hh := dual_entry (composite V U) (composite_norm V U hV hU) Z x y + exact (hh.prod_fiberwise (fun i => dual_entry U hU Z (V i x) (V i y))).unique + (dual_entry V hV (dual U hU Z) x y) + +theorem dual_reindex {K : Type*} (e : K ≃ I) (V : I → E →L[ℂ] H) + (hV : ∀ x, HasSum (fun i => ‖V i x‖^2) (‖x‖^2)) + (hW : ∀ x, HasSum (fun k => ‖V (e k) x‖^2) (‖x‖^2)) (Z : H →L[ℂ] H) : + dual (fun k => V (e k)) hW Z=dual V hV Z := by + ext y + apply ext_inner_left ℂ + intro x + exact (dual_entry _ hW Z x y).unique (e.hasSum_iff.mpr (dual_entry V hV Z x y)) +end KrausBounded + +namespace EntropyPhotonNumber +open TensorLp KrausBounded +open scoped BigOperators ComplexConjugate + +def jointKraus {n : ℕ} (η : ℝ) (hη : η ∈ Set.Icc 0 1) (e : NumberIndex n) : + H (NumberIndex n × NumberIndex n) →L[ℂ] Fock n := + sliceCLM e ∘L (beamUnitary η hη).toContinuousLinearEquiv.toContinuousLinearMap + +theorem jointKraus_norm {n : ℕ} (η : ℝ) (hη : η ∈ Set.Icc 0 1) + (x : H (NumberIndex n × NumberIndex n)) : + HasSum (fun e => ‖jointKraus η hη e x‖^2) (‖x‖^2) := by + convert! hasSum_slice_norm_sq (beamUnitary η hη x) using 1 + exact (beamUnitary η hη).norm_map x |>.symm |> congrArg (fun t : ℝ => t^2) + +def rawJointKraus {n : ℕ} (η θ : ℝ) (hη : η ∈ Set.Icc 0 1) (hθ : θ ∈ Set.Icc 0 1) + (τ : State n) := composite (jointKraus η hη) (firstKraus θ hθ τ) + +theorem rawJointKraus_norm {n : ℕ} (η θ : ℝ) (hη : η ∈ Set.Icc 0 1) (hθ : θ ∈ Set.Icc 0 1) + (τ : State n) (x : H (NumberIndex n × NumberIndex n)) : + HasSum (fun e => ‖rawJointKraus η θ hη hθ τ e x‖^2) (‖x‖^2) := + composite_norm _ _ (jointKraus_norm η hη) (firstKraus_norm θ hθ τ) x + +def rawDual {n : ℕ} (η θ : ℝ) (hη : η ∈ Set.Icc 0 1) (hθ : θ ∈ Set.Icc 0 1) + (τ : State n) (Z : Fock n →L[ℂ] Fock n) := + dual (rawJointKraus η θ hη hθ τ) (rawJointKraus_norm η θ hη hθ τ) Z + +theorem physical_arithmetic_projection {n : ℕ} (η θ : ℝ) + (hη : η ∈ Set.Icc 0 1) (hθ : θ ∈ Set.Icc 0 1) (ρ σ τ : State n) + (Z : Fock n →L[ℂ] Fock n) : + let x := rootColumn ρ + let y := rootColumn σ + let v := fun ij : NumberIndex n × NumberIndex n => tensor (x ij.1) (y ij.2) + let T := EnsembleL2.center v (rawDual η θ hη hθ τ Z) + let out := fun ik : (NumberIndex n × NumberIndex n) × (NumberIndex n × (NumberIndex n × NumberIndex n)) => + rawJointKraus η θ hη hθ τ ik.2 (v ik.1) + (∑' i, ‖conditionalLeft y (rootColumn_norm σ) T (x i)‖^2)+ + (∑' j, ‖conditionalRight x (rootColumn_norm ρ) T (y j)‖^2) ≤ + ∑' ik, ‖EnsembleL2.center out Z (out ik)‖^2 := + channel_arithmetic_projection (rootColumn ρ) (rootColumn σ) (rootColumn_norm ρ) + (rootColumn_norm σ) (rawJointKraus η θ hη hθ τ) (rawJointKraus_norm η θ hη hθ τ) Z + +def fixedPortEquiv (n : ℕ) : ((NumberIndex n × NumberIndex n) × (NumberIndex n × NumberIndex n)) ≃ + NumberIndex n × (NumberIndex n × (NumberIndex n × NumberIndex n)) where + toFun z := (z.2.2, (z.2.1,z.1)) + invFun z := (z.2.2,(z.2.1,z.1)) + left_inv _ := rfl + right_inv _ := rfl + +theorem rawDual_first_slice {n : ℕ} (η θ : ℝ) + (hη : η ∈ Set.Icc 0 1) (hθ : θ ∈ Set.Icc 0 1) (σ τ : State n) + (Z : Fock n →L[ℂ] Fock n) : + conditionalLeft (rootColumn σ) (rootColumn_norm σ) (rawDual η θ hη hθ τ Z)= + dual (composeKraus (firstKraus θ hθ τ) (firstKraus η hη σ)) + (composeKraus_norm _ _ (firstKraus_norm θ hθ τ) (firstKraus_norm η hη σ)) Z := by + let V := fun j => tensorRight (A := NumberIndex n) (rootColumn σ j) + let U := rawJointKraus η θ hη hθ τ + have hh := dual_composite V U (rightFamily_norm _ (rootColumn_norm σ)) + (rawJointKraus_norm η θ hη hθ τ) Z + change dual V _ (dual U _ Z)=_ + rw [← hh] + have he : (fun k => composite V U (fixedPortEquiv n k))= + composeKraus (firstKraus θ hθ τ) (firstKraus η hη σ) := by + funext k + ext z + rfl + have hr := dual_reindex (fixedPortEquiv n) (composite V U) + (composite_norm V U (rightFamily_norm _ (rootColumn_norm σ)) (rawJointKraus_norm η θ hη hθ τ)) + (fun x => (fixedPortEquiv n).hasSum_iff.mpr + (composite_norm V U (rightFamily_norm _ (rootColumn_norm σ)) (rawJointKraus_norm η θ hη hθ τ) x)) Z + simpa only [he] using hr.symm + +theorem rawDual_second_slice {n : ℕ} (η θ : ℝ) + (hη : η ∈ Set.Icc 0 1) (hθ : θ ∈ Set.Icc 0 1) (ρ τ : State n) + (Z : Fock n →L[ℂ] Fock n) : + conditionalRight (rootColumn ρ) (rootColumn_norm ρ) (rawDual η θ hη hθ τ Z)= + dual (composeKraus (firstKraus θ hθ τ) (secondKraus η hη ρ)) + (composeKraus_norm _ _ (firstKraus_norm θ hθ τ) (secondKraus_norm η hη ρ)) Z := by + let V := fun j => tensorLeft (B := NumberIndex n) (rootColumn ρ j) + let U := rawJointKraus η θ hη hθ τ + have hh := dual_composite V U (leftFamily_norm _ (rootColumn_norm ρ)) + (rawJointKraus_norm η θ hη hθ τ) Z + change dual V _ (dual U _ Z)=_ + rw [← hh] + have he : (fun k => composite V U (fixedPortEquiv n k))= + composeKraus (firstKraus θ hθ τ) (secondKraus η hη ρ) := by + funext k + ext z + rfl + have hr := dual_reindex (fixedPortEquiv n) (composite V U) + (composite_norm V U (leftFamily_norm _ (rootColumn_norm ρ)) (rawJointKraus_norm η θ hη hθ τ)) + (fun x => (fixedPortEquiv n).hasSum_iff.mpr + (composite_norm V U (leftFamily_norm _ (rootColumn_norm ρ)) (rawJointKraus_norm η θ hη hθ τ) x)) Z + simpa only [he] using hr.symm +end EntropyPhotonNumber + +end + +end OAI diff --git a/lean/OAI/InformationTheory/PhotonNumber/Contraction.lean b/lean/OAI/InformationTheory/PhotonNumber/Contraction.lean new file mode 100644 index 0000000000000000000000000000000000000000..60052d56e3b357831f5fdebb7a3366bf02d8e316 --- /dev/null +++ b/lean/OAI/InformationTheory/PhotonNumber/Contraction.lean @@ -0,0 +1,961 @@ +import OAI.InformationTheory.PhotonNumber.SpectralForms +import OAI.InformationTheory.PhotonNumber.SpectralLog +import OAI.InformationTheory.PhotonNumber.Continuity + +namespace OAI + +noncomputable section + +open scoped BigOperators ComplexConjugate ENNReal Topology +open MeasureTheory +open scoped ComplexConjugate +open scoped BigOperators ComplexConjugate +open scoped BigOperators +open MvPolynomial +open scoped BigOperators ComplexConjugate Classical +open Submodule +open ContinuousLinearMap +open scoped ENNReal +open Set Filter Topology Complex MeasureTheory +open Set Filter Topology Complex Metric +open MeasureTheory Set Filter Topology Complex Metric InnerProductSpace +open scoped ENNReal NNReal +open Filter Topology + +namespace EnsembleL2 + +section +open scoped BigOperators ComplexConjugate +variable {E I J : Type*} [NormedAddCommGroup E] [InnerProductSpace ℂ E] + +def secondMoment (v : I → E) (Z : E →L[ℂ] E) : ℝ := ∑' i, ‖Z (v i)‖^2 + +theorem shifted_secondMoment (v : I → E) (hv : HasSum (fun i => ‖v i‖^2) 1) + (Z : E →L[ℂ] E) (c : ℂ) : + secondMoment v (Z-c • ContinuousLinearMap.id ℂ E)= + secondMoment v Z-2*(c*conj (mean v Z)).re+‖c‖^2 := by + have hm := ((mean_hasSum v hv.summable Z).mapL Complex.conjCLE.toContinuousLinearMap).mul_left c + change HasSum (fun i => c*conj (inner ℂ (v i) (Z (v i)))) (c*conj (mean v Z)) at hm + have hr := (hm.mapL Complex.reCLM).mul_left 2 + have hh := ((image_summable v hv.summable Z).hasSum.sub hr).add (hv.mul_left (‖c‖^2)) + have he (i : I) : ‖(Z-c • ContinuousLinearMap.id ℂ E) (v i)‖^2 = + ‖Z (v i)‖^2-2*(c*conj (inner ℂ (v i) (Z (v i)))).re+‖c‖^2*‖v i‖^2 := by + simp only [sub_apply, smul_apply, ContinuousLinearMap.id_apply, norm_sub_sq (𝕜 := ℂ), + inner_smul_right, inner_conj_symm, norm_smul, mul_pow] + rfl + have hs : HasSum (fun i => ‖(Z-c • ContinuousLinearMap.id ℂ E) (v i)‖^2) + (secondMoment v Z-2*(c*conj (mean v Z)).re+‖c‖^2) := by + simpa only [he, secondMoment, Complex.reCLM_apply, Complex.conjCLE_apply, mul_one] using hh + exact hs.tsum_eq + +theorem center_secondMoment (v : I → E) (hv : HasSum (fun i => ‖v i‖^2) 1) + (Z : E →L[ℂ] E) : + secondMoment v (center v Z)=secondMoment v Z-‖mean v Z‖^2 := by + rw [center, shifted_secondMoment v hv Z, Complex.mul_conj, Complex.ofReal_re, + Complex.normSq_eq_norm_sq] + ring + +theorem mean_square_le (v : I → E) (hv : HasSum (fun i => ‖v i‖^2) 1) + (Z : E →L[ℂ] E) : ‖mean v Z‖^2 ≤ secondMoment v Z := by + have hp : 0 ≤ secondMoment v (center v Z) := tsum_nonneg (fun _ => sq_nonneg _) + rw [center_secondMoment v hv Z] at hp + linarith + +def mixture (v : I → E) (w : J → E) (t : ℝ) : I ⊕ J → E := + Sum.elim (fun i => (Real.sqrt t : ℂ) • v i) (fun j => (Real.sqrt (1-t) : ℂ) • w j) + +theorem mixture_norm_left (v : I → E) (w : J → E) {t : ℝ} (ht : 0 ≤ t) (i : I) : + ‖mixture v w t (.inl i)‖^2=t*‖v i‖^2 := by + simp only [mixture, Sum.elim_inl, norm_smul, Complex.norm_real, Real.norm_eq_abs, + abs_of_nonneg (Real.sqrt_nonneg t), mul_pow, Real.sq_sqrt ht] + +theorem mixture_norm_right (v : I → E) (w : J → E) {t : ℝ} (ht : t ≤ 1) (j : J) : + ‖mixture v w t (.inr j)‖^2=(1-t)*‖w j‖^2 := by + simp only [mixture, Sum.elim_inr, norm_smul, Complex.norm_real, Real.norm_eq_abs, + abs_of_nonneg (Real.sqrt_nonneg (1-t)), mul_pow, Real.sq_sqrt (sub_nonneg.mpr ht)] + +theorem mixture_hasSum (v : I → E) (w : J → E) {t : ℝ} (ht : t ∈ Set.Icc 0 1) + (hv : HasSum (fun i => ‖v i‖^2) 1) (hw : HasSum (fun j => ‖w j‖^2) 1) : + HasSum (fun k => ‖mixture v w t k‖^2) 1 := by + have h₁ : HasSum ((fun k => ‖mixture v w t k‖^2) ∘ Sum.inl) t := by + simpa only [Function.comp_def, mixture_norm_left v w ht.1, mul_one] using hv.mul_left t + have h₂ : HasSum ((fun k => ‖mixture v w t k‖^2) ∘ Sum.inr) (1-t) := by + simpa only [Function.comp_def, mixture_norm_right v w ht.2, mul_one] using hw.mul_left (1-t) + simpa only [add_sub_cancel] using h₁.sum h₂ + +theorem mixture_mean (v : I → E) (w : J → E) {t : ℝ} (ht : t ∈ Set.Icc 0 1) + (hv : Summable (fun i => ‖v i‖^2)) (hw : Summable (fun j => ‖w j‖^2)) (Z : E →L[ℂ] E) : + mean (mixture v w t) Z=(t:ℂ)*mean v Z+((1-t:ℝ):ℂ)*mean w Z := by + have he {a : ℝ} (ha : 0 ≤ a) (x : E) : + inner ℂ ((Real.sqrt a:ℂ) • x) (Z ((Real.sqrt a:ℂ) • x))=(a:ℂ)*inner ℂ x (Z x) := by + simp only [map_smul, inner_smul_left, inner_smul_right, Complex.conj_ofReal] + rw [← mul_assoc, ← Complex.ofReal_mul, Real.mul_self_sqrt ha] + have h₁ : HasSum ((fun k => inner ℂ (mixture v w t k) (Z (mixture v w t k))) ∘ Sum.inl) + ((t:ℂ)*mean v Z) := by + simpa only [Function.comp_def, mixture, Sum.elim_inl, he ht.1] using + (mean_hasSum v hv Z).mul_left (t:ℂ) + have h₂ : HasSum ((fun k => inner ℂ (mixture v w t k) (Z (mixture v w t k))) ∘ Sum.inr) + (((1-t:ℝ):ℂ)*mean w Z) := by + simpa only [Function.comp_def, mixture, Sum.elim_inr, he (sub_nonneg.mpr ht.2)] using + (mean_hasSum w hw Z).mul_left ((1-t:ℝ):ℂ) + exact (h₁.sum h₂).tsum_eq + +theorem mixture_secondMoment (v : I → E) (w : J → E) {t : ℝ} (ht : t ∈ Set.Icc 0 1) + (hv : Summable (fun i => ‖v i‖^2)) (hw : Summable (fun j => ‖w j‖^2)) (Z : E →L[ℂ] E) : + secondMoment (mixture v w t) Z=t*secondMoment v Z+(1-t)*secondMoment w Z := by + have h₁ : HasSum ((fun k => ‖Z (mixture v w t k)‖^2) ∘ Sum.inl) (t*secondMoment v Z) := by + simpa only [Function.comp_def, mixture, Sum.elim_inl, map_smul, norm_smul, Complex.norm_real, + Real.norm_eq_abs, abs_of_nonneg (Real.sqrt_nonneg _), mul_pow, Real.sq_sqrt ht.1, secondMoment] using + (image_summable v hv Z).hasSum.mul_left t + have h₂ : HasSum ((fun k => ‖Z (mixture v w t k)‖^2) ∘ Sum.inr) ((1-t)*secondMoment w Z) := by + simpa only [Function.comp_def, mixture, Sum.elim_inr, map_smul, norm_smul, Complex.norm_real, + Real.norm_eq_abs, abs_of_nonneg (Real.sqrt_nonneg _), mul_pow, Real.sq_sqrt (sub_nonneg.mpr ht.2), secondMoment] using + (image_summable w hw Z).hasSum.mul_left (1-t) + exact (h₁.sum h₂).tsum_eq +end + +open scoped BigOperators +variable {E I J : Type*} [NormedAddCommGroup E] [InnerProductSpace ℂ E] + +theorem complex_mixture_square (t : ℝ) (a b : ℂ) : + t*‖a‖^2+(1-t)*‖b‖^2-‖(t:ℂ)*a+((1-t:ℝ):ℂ)*b‖^2 = t*(1-t)*‖a-b‖^2 := by + simp only [← Complex.normSq_eq_norm_sq, Complex.normSq_apply, Complex.add_re, + Complex.add_im, Complex.sub_re, Complex.sub_im, Complex.mul_re, Complex.mul_im, + Complex.ofReal_re, Complex.ofReal_im] + ring + +theorem mixture_variance (v : I → E) (w : J → E) {t : ℝ} (ht : t ∈ Set.Icc 0 1) + (hv : HasSum (fun i => ‖v i‖^2) 1) (hw : HasSum (fun j => ‖w j‖^2) 1) (Z : E →L[ℂ] E) : + secondMoment (mixture v w t) (center (mixture v w t) Z)= + t*secondMoment v (center v Z)+(1-t)*secondMoment w (center w Z)+ + t*(1-t)*‖mean v Z-mean w Z‖^2 := by + rw [center_secondMoment _ (mixture_hasSum v w ht hv hw), + mixture_secondMoment v w ht hv.summable hw.summable, + mixture_mean v w ht hv.summable hw.summable, + center_secondMoment v hv, center_secondMoment w hw] + linear_combination complex_mixture_square t (mean v Z) (mean w Z) + +theorem mixture_variance_left (v : I → E) (w : J → E) {t : ℝ} (ht : t ∈ Set.Icc 0 1) + (hv : HasSum (fun i => ‖v i‖^2) 1) (hw : HasSum (fun j => ‖w j‖^2) 1) (Z : E →L[ℂ] E) : + t*secondMoment v (center v Z) ≤ secondMoment (mixture v w t) (center (mixture v w t) Z) := by + rw [mixture_variance v w ht hv hw Z] + have h₁ : 0 ≤ (1-t)*secondMoment w (center w Z) := + mul_nonneg (sub_nonneg.mpr ht.2) (tsum_nonneg (fun _ => sq_nonneg _)) + have h₂ := mul_nonneg (mul_nonneg ht.1 (sub_nonneg.mpr ht.2)) (sq_nonneg ‖mean v Z-mean w Z‖) + linarith + +theorem mixture_between_variance (v : I → E) (w : J → E) {t : ℝ} (ht : t ∈ Set.Icc 0 1) + (hv : HasSum (fun i => ‖v i‖^2) 1) (hw : HasSum (fun j => ‖w j‖^2) 1) (Z : E →L[ℂ] E) : + t*(1-t)*‖mean v Z-mean w Z‖^2 ≤ secondMoment (mixture v w t) (center (mixture v w t) Z) := by + rw [mixture_variance v w ht hv hw Z] + have h₁ : 0 ≤ t*secondMoment v (center v Z) := + mul_nonneg ht.1 (tsum_nonneg (fun _ => sq_nonneg _)) + have h₂ : 0 ≤ (1-t)*secondMoment w (center w Z) := + mul_nonneg (sub_nonneg.mpr ht.2) (tsum_nonneg (fun _ => sq_nonneg _)) + linarith +end EnsembleL2 + +namespace ThermalSpectral.Space +open EntropyPhotonNumber DiagonalForms.System ThermalMetric +open scoped BigOperators +variable {E : Type*} [NormedAddCommGroup E] [InnerProductSpace ℂ E] [CompleteSpace E] +variable (S : ThermalSpectral.Space E) + +def ensemble (i : S.I) : E := (Real.sqrt (S.p i) : ℂ) • S.basis i + +theorem ensemble_norm (i : S.I) : ‖S.ensemble i‖^2=S.p i := by + simp only [ensemble, norm_smul, Complex.norm_real, Real.norm_eq_abs, + abs_of_nonneg (Real.sqrt_nonneg _), S.basis.orthonormal.norm_eq_one i, mul_one] + exact Real.sq_sqrt (S.pos i).le + +theorem ensemble_hasSum : HasSum (fun i => ‖S.ensemble i‖^2) 1 := by + simpa only [S.ensemble_norm] using S.sum + +theorem image_ensemble_norm (Z : E →L[ℂ] E) (i : S.I) : + ‖Z (S.ensemble i)‖^2=S.p i*‖Z (S.basis i)‖^2 := by + simp only [ensemble, map_smul, norm_smul, Complex.norm_real, Real.norm_eq_abs, + abs_of_nonneg (Real.sqrt_nonneg _), mul_pow, Real.sq_sqrt (S.pos i).le] + +theorem minus_quad_ensemble (Z : E →L[ℂ] E) : + S.quad minus Z=∑' i, ‖Z (S.ensemble i)‖^2 := by + simp only [quad, S.minus_entry Z, S.image_ensemble_norm Z] + have hs := BKM.weighted_column_summable S.basis S.p (fun i => (S.pos i).le) S.sum.summable Z + rw [hs.tsum_prod, ← hs.tsum_comm] + simp only [tsum_mul_left, (BKM.hasSum_column S.basis Z _).tsum_eq] + +theorem plus_quad_ensemble (Z : E →L[ℂ] E) : + S.quad plus Z=∑' i, ‖Z.adjoint (S.ensemble i)‖^2 := by + simp only [quad, S.plus_entry Z, S.image_ensemble_norm Z.adjoint] + rw [(BKM.weighted_row_summable S.basis S.p (fun i => (S.pos i).le) S.sum.summable Z).tsum_prod] + simp only [tsum_mul_left, (BKM.hasSum_row S.basis Z _).tsum_eq] +end ThermalSpectral.Space + +namespace EnsembleL2 +open scoped ComplexConjugate +variable {E I J K : Type*} [NormedAddCommGroup E] [InnerProductSpace ℂ E] [CompleteSpace E] + +theorem mean_eq_of_operator_eq (b : HilbertBasis K ℂ E) {v : I → E} {w : J → E} + (hv : Summable (fun i => ‖v i‖^2)) (hw : Summable (fun j => ‖w j‖^2)) + (he : TraceEnsemble.operator v=TraceEnsemble.operator w) (Z : E →L[ℂ] E) : + mean v Z=mean w Z := + CrossEnsemble.pairing_eq_of_operator_eq b hv hv hw hw he Z + +theorem secondMoment_eq_of_operator_eq (b : HilbertBasis K ℂ E) {v : I → E} {w : J → E} + (hv : Summable (fun i => ‖v i‖^2)) (hw : Summable (fun j => ‖w j‖^2)) + (he : TraceEnsemble.operator v=TraceEnsemble.operator w) (Z : E →L[ℂ] E) : + secondMoment v Z=secondMoment w Z := by + have hh := congrArg Complex.re (mean_eq_of_operator_eq b hv hw he (Z.adjoint ∘L Z)) + have ht (x : E) : (inner ℂ x ((Z.adjoint ∘L Z) x)).re=‖Z x‖^2 := by + simp only [ContinuousLinearMap.comp_apply, ContinuousLinearMap.adjoint_inner_right, + inner_self_eq_norm_sq_to_K] + change ((‖Z x‖ : ℂ)^2).re=‖Z x‖^2 + rw [← Complex.ofReal_pow, Complex.ofReal_re] + have h₁ := (mean_hasSum v hv (Z.adjoint ∘L Z)).mapL Complex.reCLM + have h₂ := (mean_hasSum w hw (Z.adjoint ∘L Z)).mapL Complex.reCLM + have hm₁ : secondMoment v Z=(mean v (Z.adjoint ∘L Z)).re := by + simpa only [Complex.reCLM_apply, ht, secondMoment] using h₁.tsum_eq + have hm₂ : secondMoment w Z=(mean w (Z.adjoint ∘L Z)).re := by + simpa only [Complex.reCLM_apply, ht, secondMoment] using h₂.tsum_eq + exact hm₁.trans (hh.trans hm₂.symm) + +theorem center_eq_of_operator_eq (b : HilbertBasis K ℂ E) {v : I → E} {w : J → E} + (hv : Summable (fun i => ‖v i‖^2)) (hw : Summable (fun j => ‖w j‖^2)) + (he : TraceEnsemble.operator v=TraceEnsemble.operator w) (Z : E →L[ℂ] E) : + center v Z=center w Z := by + simp only [center, mean_eq_of_operator_eq b hv hw he Z] + +theorem variance_eq_of_operator_eq (b : HilbertBasis K ℂ E) {v : I → E} {w : J → E} + (hv : Summable (fun i => ‖v i‖^2)) (hw : Summable (fun j => ‖w j‖^2)) + (he : TraceEnsemble.operator v=TraceEnsemble.operator w) (Z : E →L[ℂ] E) : + secondMoment v (center v Z)=secondMoment w (center w Z) := by + rw [center_eq_of_operator_eq b hv hw he Z] + exact secondMoment_eq_of_operator_eq b hv hw he _ +end EnsembleL2 + +namespace BKM +variable {J E : Type*} [NormedAddCommGroup E] [InnerProductSpace ℂ E] +def mean (b : HilbertBasis J ℂ E) (p : J → ℝ) (Z : E →L[ℂ] E) : ℂ := + ∑' j, (p j : ℂ)*entry b Z j j +def center (b : HilbertBasis J ℂ E) (p : J → ℝ) (Z : E →L[ℂ] E) : E →L[ℂ] E := + Z-mean b p Z • ContinuousLinearMap.id ℂ E +end BKM + +namespace ThermalSpectral.Space +open EntropyPhotonNumber DiagonalForms.System ThermalMetric +open scoped BigOperators +variable {E : Type*} [NormedAddCommGroup E] [InnerProductSpace ℂ E] [CompleteSpace E] +variable (S : ThermalSpectral.Space E) + +theorem ensemble_operator (T : E →L[ℂ] E) (hT : T.IsSymmetric) + (he : ∀ j, T (S.basis j)=(S.p j : ℂ) • S.basis j) : + TraceEnsemble.operator S.ensemble=T := + CrossEnsemble.eigenEnsemble_operator S.basis S.p (fun j => (S.pos j).le) S.sum.summable T hT he + +theorem ensemble_mean (Z : E →L[ℂ] E) : EnsembleL2.mean S.ensemble Z=BKM.mean S.basis S.p Z := by + unfold EnsembleL2.mean BKM.mean + apply tsum_congr + intro j + simp only [ensemble, map_smul, inner_smul_left, inner_smul_right, Complex.conj_ofReal] + rw [← mul_assoc, ← Complex.ofReal_mul, Real.mul_self_sqrt (S.pos j).le] + rfl + +theorem ensemble_center (Z : E →L[ℂ] E) : EnsembleL2.center S.ensemble Z=BKM.center S.basis S.p Z := by + simp only [EnsembleL2.center, S.ensemble_mean, BKM.center] + +theorem minus_quad_of_ensemble {I : Type*} (v : I → E) + (hv : Summable (fun i => ‖v i‖^2)) (he : TraceEnsemble.operator S.ensemble=TraceEnsemble.operator v) + (Z : E →L[ℂ] E) : S.quad minus Z=EnsembleL2.secondMoment v Z := by + rw [S.minus_quad_ensemble] + exact EnsembleL2.secondMoment_eq_of_operator_eq S.basis S.ensemble_hasSum.summable hv he Z + +theorem plus_quad_of_ensemble {I : Type*} (v : I → E) + (hv : Summable (fun i => ‖v i‖^2)) (he : TraceEnsemble.operator S.ensemble=TraceEnsemble.operator v) + (Z : E →L[ℂ] E) : S.quad plus Z=EnsembleL2.secondMoment v Z.adjoint := by + rw [S.plus_quad_ensemble] + exact EnsembleL2.secondMoment_eq_of_operator_eq S.basis S.ensemble_hasSum.summable hv he Z.adjoint +end ThermalSpectral.Space + +namespace TensorLp +open KrausBounded +variable {A B I J : Type*} + +theorem conditionalLeft_center (x : I → H A) (y : J → H B) + (hx : HasSum (fun i => ‖x i‖^2) 1) (hy : HasSum (fun j => ‖y j‖^2) 1) + (Z : H (A × B) →L[ℂ] H (A × B)) : + conditionalLeft y hy (EnsembleL2.center (fun ij : I × J => tensor (x ij.1) (y ij.2)) Z)= + EnsembleL2.center x (conditionalLeft y hy Z) := by + have hh : EnsembleL2.mean x (conditionalLeft y hy Z)= + EnsembleL2.mean (fun ij : I × J => tensor (x ij.1) (y ij.2)) Z := + (conditionalLeft_mean x y hx hy Z).tsum_eq + simp only [EnsembleL2.center] + rw [hh] + simp only [conditionalLeft, sub_eq_add_neg, ← neg_smul, dual_add, dual_smul, dual_id] + +theorem conditionalRight_center (x : I → H A) (y : J → H B) + (hx : HasSum (fun i => ‖x i‖^2) 1) (hy : HasSum (fun j => ‖y j‖^2) 1) + (Z : H (A × B) →L[ℂ] H (A × B)) : + conditionalRight x hx (EnsembleL2.center (fun ij : I × J => tensor (x ij.1) (y ij.2)) Z)= + EnsembleL2.center y (conditionalRight x hx Z) := by + have hh : EnsembleL2.mean y (conditionalRight x hx Z)= + EnsembleL2.mean (fun ij : I × J => tensor (x ij.1) (y ij.2)) Z := + (conditionalRight_mean x y hx hy Z).tsum_eq + simp only [EnsembleL2.center] + rw [hh] + simp only [conditionalRight, sub_eq_add_neg, ← neg_smul, dual_add, dual_smul, dual_id] +end TensorLp + +namespace EntropyPhotonNumber +open TensorLp KrausBounded +open scoped BigOperators ComplexConjugate + +abbrev RawIndex (n : ℕ) := (NumberIndex n × NumberIndex n) × + (NumberIndex n × (NumberIndex n × NumberIndex n)) + +def rawEnsemble {n : ℕ} (η θ : ℝ) (hη : η ∈ Set.Icc 0 1) (hθ : θ ∈ Set.Icc 0 1) + (ρ σ τ : State n) (ik : RawIndex n) : Fock n := + rawJointKraus η θ hη hθ τ ik.2 (tensor (rootColumn ρ ik.1.1) (rootColumn σ ik.1.2)) + +theorem rawEnsemble_norm {n : ℕ} (η θ : ℝ) (hη : η ∈ Set.Icc 0 1) (hθ : θ ∈ Set.Icc 0 1) + (ρ σ τ : State n) : HasSum (fun i => ‖rawEnsemble η θ hη hθ ρ σ τ i‖^2) 1 := by + let v : NumberIndex n × NumberIndex n → H (NumberIndex n × NumberIndex n) := + fun ij => tensor (rootColumn ρ ij.1) (rootColumn σ ij.2) + have hv : HasSum (fun ij => ‖v ij‖^2) 1 := by + simpa only [one_mul] using tensorFamily_norm (rootColumn ρ) (rootColumn σ) 1 1 + (rootColumn_norm ρ) (rootColumn_norm σ) + have hh := family_hasSum (rawJointKraus η θ hη hθ τ) (rawJointKraus_norm η θ hη hθ τ) v 1 hv + exact hh + +def rawEnsembleEquiv (n : ℕ) : RawIndex n ≃ + (NumberIndex n × NumberIndex n) × (NumberIndex n × (NumberIndex n × NumberIndex n)) where + toFun i := (i.2.2, (i.2.1,i.1)) + invFun i := (i.2.2,(i.2.1,i.1)) + left_inv _ := rfl + right_inv _ := rfl + +theorem rawEnsemble_operator {n : ℕ} (η θ : ℝ) + (hη : η ∈ Set.Icc 0 1) (hθ : θ ∈ Set.Icc 0 1) (ρ σ τ : State n) : + TraceEnsemble.operator (rawEnsemble η θ hη hθ ρ σ τ)= + (beamOutput θ hθ (beamOutput η hη ρ σ) τ).op := by + let v : NumberIndex n × (NumberIndex n × NumberIndex n) → Fock n := fun i => + slice (beamUnitary η hη (tensor (rootColumn ρ i.2.1) (rootColumn σ i.2.2))) i.1 + have hv : HasSum (fun i => ‖v i‖^2) 1 := by + change HasSum (fun bi : NumberIndex n × (NumberIndex n × NumberIndex n) => + ‖slice (mixedVector η hη ρ σ bi.2) bi.1‖^2) 1 + exact hasSum_slice_family (v := mixedVector η hη ρ σ) (mixedVector_norm η hη ρ σ) + have he : TraceEnsemble.operator v=(beamOutput η hη ρ σ).op := rfl + have hr := TraceEnsemble.operator_reindex (rawEnsembleEquiv n) + (fun i => firstKraus θ hθ τ i.1 (v i.2)) + exact hr.trans (firstKraus_ensemble θ hθ (beamOutput η hη ρ σ) τ v hv he) + +theorem raw_centered_arithmetic {n : ℕ} (η θ : ℝ) + (hη : η ∈ Set.Icc 0 1) (hθ : θ ∈ Set.Icc 0 1) (ρ σ τ : State n) + (Z : Fock n →L[ℂ] Fock n) : + EnsembleL2.secondMoment (rootColumn ρ) + (EnsembleL2.center (rootColumn ρ) + (conditionalLeft (rootColumn σ) (rootColumn_norm σ) (rawDual η θ hη hθ τ Z)))+ + EnsembleL2.secondMoment (rootColumn σ) + (EnsembleL2.center (rootColumn σ) + (conditionalRight (rootColumn ρ) (rootColumn_norm ρ) (rawDual η θ hη hθ τ Z))) ≤ + EnsembleL2.secondMoment (rawEnsemble η θ hη hθ ρ σ τ) + (EnsembleL2.center (rawEnsemble η θ hη hθ ρ σ τ) Z) := by + have hh := physical_arithmetic_projection η θ hη hθ ρ σ τ Z + dsimp only at hh + rw [conditionalLeft_center _ _ (rootColumn_norm ρ) (rootColumn_norm σ), + conditionalRight_center _ _ (rootColumn_norm ρ) (rootColumn_norm σ)] at hh + exact hh +end EntropyPhotonNumber + +namespace EnsembleL2 +open scoped ComplexConjugate +variable {E I : Type*} [NormedAddCommGroup E] [InnerProductSpace ℂ E] [CompleteSpace E] + +theorem mean_adjoint (v : I → E) (Z : E →L[ℂ] E) : mean v Z.adjoint=conj (mean v Z) := by + simp only [mean, ContinuousLinearMap.adjoint_inner_right, inner_conj_symm, Complex.conj_tsum] + +theorem center_adjoint (v : I → E) (Z : E →L[ℂ] E) : center v Z.adjoint=(center v Z).adjoint := by + simp only [center, mean_adjoint, map_sub, map_smulₛₗ, + ContinuousLinearMap.adjoint_id] +end EnsembleL2 + +namespace EntropyPhotonNumber +open TensorLp KrausBounded +open scoped BigOperators ComplexConjugate +variable {n : ℕ} + +def rawFirstSlice (η θ : ℝ) (hη : η ∈ Set.Icc 0 1) (hθ : θ ∈ Set.Icc 0 1) + (σ τ : State n) (Z : Fock n →L[ℂ] Fock n) : Fock n →L[ℂ] Fock n := + conditionalLeft (rootColumn σ) (rootColumn_norm σ) (rawDual η θ hη hθ τ Z) + +def rawSecondSlice (η θ : ℝ) (hη : η ∈ Set.Icc 0 1) (hθ : θ ∈ Set.Icc 0 1) + (ρ τ : State n) (Z : Fock n →L[ℂ] Fock n) : Fock n →L[ℂ] Fock n := + conditionalRight (rootColumn ρ) (rootColumn_norm ρ) (rawDual η θ hη hθ τ Z) + +theorem rawFirstSlice_adjoint (η θ : ℝ) (hη : η ∈ Set.Icc 0 1) (hθ : θ ∈ Set.Icc 0 1) + (σ τ : State n) (Z : Fock n →L[ℂ] Fock n) : + rawFirstSlice η θ hη hθ σ τ Z.adjoint=(rawFirstSlice η θ hη hθ σ τ Z).adjoint := by + simp only [rawFirstSlice, conditionalLeft, rawDual, dual_adjoint] + +theorem rawSecondSlice_adjoint (η θ : ℝ) (hη : η ∈ Set.Icc 0 1) (hθ : θ ∈ Set.Icc 0 1) + (ρ τ : State n) (Z : Fock n →L[ℂ] Fock n) : + rawSecondSlice η θ hη hθ ρ τ Z.adjoint=(rawSecondSlice η θ hη hθ ρ τ Z).adjoint := by + simp only [rawSecondSlice, conditionalRight, rawDual, dual_adjoint] + +theorem replaced_arithmetic {J : Type*} (η θ κ : ℝ) + (hη : η ∈ Set.Icc 0 1) (hθ : θ ∈ Set.Icc 0 1) (hκ : κ ∈ Set.Icc 0 1) + (ρ σ τ : State n) (v : J → Fock n) (hv : HasSum (fun j => ‖v j‖^2) 1) + (Z : Fock n →L[ℂ] Fock n) : + let m := EnsembleL2.mixture (rawEnsemble η θ hη hθ ρ σ τ) v (1-κ) + (1-κ)*(EnsembleL2.secondMoment (rootColumn ρ) + (EnsembleL2.center (rootColumn ρ) (rawFirstSlice η θ hη hθ σ τ Z))+ + EnsembleL2.secondMoment (rootColumn σ) + (EnsembleL2.center (rootColumn σ) (rawSecondSlice η θ hη hθ ρ τ Z))) ≤ + EnsembleL2.secondMoment m (EnsembleL2.center m Z) ∧ + (1-κ)*(EnsembleL2.secondMoment (rootColumn ρ) + (EnsembleL2.center (rootColumn ρ) (rawFirstSlice η θ hη hθ σ τ Z)).adjoint+ + EnsembleL2.secondMoment (rootColumn σ) + (EnsembleL2.center (rootColumn σ) (rawSecondSlice η θ hη hθ ρ τ Z)).adjoint) ≤ + EnsembleL2.secondMoment m (EnsembleL2.center m Z).adjoint := by + dsimp only + have hk : 1-κ ∈ Set.Icc (0:ℝ) 1 := ⟨sub_nonneg.mpr hκ.2, sub_le_self _ hκ.1⟩ + have hh (T : Fock n →L[ℂ] Fock n) := + (mul_le_mul_of_nonneg_left (raw_centered_arithmetic η θ hη hθ ρ σ τ T) hk.1).trans + (EnsembleL2.mixture_variance_left (rawEnsemble η θ hη hθ ρ σ τ) v hk + (rawEnsemble_norm η θ hη hθ ρ σ τ) hv T) + refine ⟨hh Z, ?_⟩ + have ha := hh Z.adjoint + change (1-κ)*(EnsembleL2.secondMoment (rootColumn ρ) + (EnsembleL2.center (rootColumn ρ) (rawFirstSlice η θ hη hθ σ τ Z.adjoint))+ + EnsembleL2.secondMoment (rootColumn σ) + (EnsembleL2.center (rootColumn σ) (rawSecondSlice η θ hη hθ ρ τ Z.adjoint))) ≤ _ at ha + simpa only [rawFirstSlice_adjoint, rawSecondSlice_adjoint, EnsembleL2.center_adjoint] using ha +end EntropyPhotonNumber + +namespace EnsembleL2 +variable {E I J : Type*} [NormedAddCommGroup E] [InnerProductSpace ℂ E] [CompleteSpace E] + +theorem mixture_operator (v : I → E) (w : J → E) {t : ℝ} (ht : t ∈ Set.Icc 0 1) + (hv : Summable (fun i => ‖v i‖^2)) (hw : Summable (fun j => ‖w j‖^2)) : + TraceEnsemble.operator (mixture v w t)= + (t:ℂ) • TraceEnsemble.operator v+((1-t:ℝ):ℂ) • TraceEnsemble.operator w := by + have he {a : ℝ} (ha : 0 ≤ a) (x : E) : + InnerProductSpace.rankOne ℂ ((Real.sqrt a:ℂ) • x) ((Real.sqrt a:ℂ) • x)= + (a:ℂ) • InnerProductSpace.rankOne ℂ x x := by + ext y + simp only [InnerProductSpace.rankOne_apply, inner_smul_left, Complex.conj_ofReal, + smul_apply, smul_smul] + congr 1 + rw [mul_right_comm, ← Complex.ofReal_mul, Real.mul_self_sqrt ha] + have h₁ : HasSum ((fun k => InnerProductSpace.rankOne ℂ (mixture v w t k) (mixture v w t k)) ∘ Sum.inl) + ((t:ℂ) • TraceEnsemble.operator v) := by + simpa only [Function.comp_def, mixture, Sum.elim_inl, he ht.1] using + (TraceEnsemble.hasSum_rankOne hv).const_smul (t:ℂ) + have h₂ : HasSum ((fun k => InnerProductSpace.rankOne ℂ (mixture v w t k) (mixture v w t k)) ∘ Sum.inr) + (((1-t:ℝ):ℂ) • TraceEnsemble.operator w) := by + simpa only [Function.comp_def, mixture, Sum.elim_inr, he (sub_nonneg.mpr ht.2)] using + (TraceEnsemble.hasSum_rankOne hw).const_smul ((1-t:ℝ):ℂ) + exact (h₁.sum h₂).tsum_eq +end EnsembleL2 + +namespace ThermalSpectral.Space +open EntropyPhotonNumber DiagonalForms.System ThermalMetric +variable {E I : Type*} [NormedAddCommGroup E] [InnerProductSpace ℂ E] [CompleteSpace E] +variable (S : ThermalSpectral.Space E) + +theorem minus_center_of_ensemble (v : I → E) (hv : Summable (fun i => ‖v i‖^2)) + (he : TraceEnsemble.operator S.ensemble=TraceEnsemble.operator v) (Z : E →L[ℂ] E) : + S.quad minus (BKM.center S.basis S.p Z)=EnsembleL2.secondMoment v (EnsembleL2.center v Z) := by + rw [S.minus_quad_of_ensemble v hv he, ← S.ensemble_center, + EnsembleL2.center_eq_of_operator_eq S.basis S.ensemble_hasSum.summable hv he] + +theorem plus_center_of_ensemble (v : I → E) (hv : Summable (fun i => ‖v i‖^2)) + (he : TraceEnsemble.operator S.ensemble=TraceEnsemble.operator v) (Z : E →L[ℂ] E) : + S.quad plus (BKM.center S.basis S.p Z)=EnsembleL2.secondMoment v (EnsembleL2.center v Z).adjoint := by + rw [S.plus_quad_of_ensemble v hv he, ← S.ensemble_center, + EnsembleL2.center_eq_of_operator_eq S.basis S.ensemble_hasSum.summable hv he] +end ThermalSpectral.Space + +namespace EntropyPhotonNumber +open ThermalSpectral ThermalSpectral.Space +variable {n : ℕ} + +theorem replaced_spectral_arithmetic (η θ κ : ℝ) + (hη : η ∈ Set.Icc 0 1) (hθ : θ ∈ Set.Icc 0 1) (hκ : κ ∈ Set.Icc 0 1) + (ρ σ τ ω : State n) (S₀ S₁ S₂ : Space (Fock n)) + (he₁ : ∀ j, ρ.op (S₁.basis j)=(S₁.p j:ℂ) • S₁.basis j) + (he₂ : ∀ j, σ.op (S₂.basis j)=(S₂.p j:ℂ) • S₂.basis j) + (he₀ : TraceEnsemble.operator S₀.ensemble= + ((1-κ:ℝ):ℂ) • (beamOutput θ hθ (beamOutput η hη ρ σ) τ).op+(κ:ℂ) • ω.op) + (Z : Fock n →L[ℂ] Fock n) : + (1-κ)*(S₁.quad minus (BKM.center S₁.basis S₁.p (rawFirstSlice η θ hη hθ σ τ Z))+ + S₂.quad minus (BKM.center S₂.basis S₂.p (rawSecondSlice η θ hη hθ ρ τ Z))) ≤ + S₀.quad minus (BKM.center S₀.basis S₀.p Z) ∧ + (1-κ)*(S₁.quad plus (BKM.center S₁.basis S₁.p (rawFirstSlice η θ hη hθ σ τ Z))+ + S₂.quad plus (BKM.center S₂.basis S₂.p (rawSecondSlice η θ hη hθ ρ τ Z))) ≤ + S₀.quad plus (BKM.center S₀.basis S₀.p Z) := by + have hr : TraceEnsemble.operator S₁.ensemble=TraceEnsemble.operator (rootColumn ρ) := + (S₁.ensemble_operator ρ.op ρ.positive.isSymmetric he₁).trans (rootColumn_operator ρ).symm + have hs : TraceEnsemble.operator S₂.ensemble=TraceEnsemble.operator (rootColumn σ) := + (S₂.ensemble_operator σ.op σ.positive.isSymmetric he₂).trans (rootColumn_operator σ).symm + let v := EnsembleL2.mixture (rawEnsemble η θ hη hθ ρ σ τ) (rootColumn ω) (1-κ) + have hk : 1-κ ∈ Set.Icc (0:ℝ) 1 := ⟨sub_nonneg.mpr hκ.2,sub_le_self _ hκ.1⟩ + have hv := EnsembleL2.mixture_hasSum (rawEnsemble η θ hη hθ ρ σ τ) (rootColumn ω) hk + (rawEnsemble_norm η θ hη hθ ρ σ τ) (rootColumn_norm ω) + have he : TraceEnsemble.operator S₀.ensemble=TraceEnsemble.operator v := by + dsimp only [v] + rw [he₀, EnsembleL2.mixture_operator _ _ hk (rawEnsemble_norm η θ hη hθ ρ σ τ).summable + (rootColumn_norm ω).summable, rawEnsemble_operator, rootColumn_operator, sub_sub_cancel] + rw [S₁.minus_center_of_ensemble _ (rootColumn_norm ρ).summable hr, + S₂.minus_center_of_ensemble _ (rootColumn_norm σ).summable hs, + S₀.minus_center_of_ensemble v hv.summable he, + S₁.plus_center_of_ensemble _ (rootColumn_norm ρ).summable hr, + S₂.plus_center_of_ensemble _ (rootColumn_norm σ).summable hs, + S₀.plus_center_of_ensemble v hv.summable he] + exact replaced_arithmetic η θ κ hη hθ hκ ρ σ τ (rootColumn ω) (rootColumn_norm ω) Z +end EntropyPhotonNumber + +namespace BKM + +section +open scoped BigOperators +variable {J E : Type*} [NormedAddCommGroup E] [InnerProductSpace ℂ E] +theorem entry_add (b : HilbertBasis J ℂ E) (Z T : E →L[ℂ] E) (i j : J) : + entry b (Z+T) i j=entry b Z i j+entry b T i j := by simp [entry] +theorem entry_sub (b : HilbertBasis J ℂ E) (Z T : E →L[ℂ] E) (i j : J) : + entry b (Z-T) i j=entry b Z i j-entry b T i j := by simp [entry] +theorem entry_smul (b : HilbertBasis J ℂ E) (c : ℂ) (Z : E →L[ℂ] E) (i j : J) : + entry b (c • Z) i j=c*entry b Z i j := by simp [entry] +theorem entry_norm_le (b : HilbertBasis J ℂ E) (Z : E →L[ℂ] E) (i j : J) : + ‖entry b Z i j‖ ≤ ‖Z‖ := by + calc + _ ≤ ‖b i‖*‖Z (b j)‖ := norm_inner_le_norm _ _ + _ ≤ ‖b i‖*(‖Z‖*‖b j‖) := mul_le_mul_of_nonneg_left (Z.le_opNorm _) (norm_nonneg _) + _ = ‖Z‖ := by simp [b.orthonormal.norm_eq_one] + +theorem mean_summable (b : HilbertBasis J ℂ E) (p : J → ℝ) (hp : ∀j,0 ≤ p j) (hs : Summable p) + (Z : E →L[ℂ] E) : Summable (fun j => (p j : ℂ)*entry b Z j j) := by + apply (hs.mul_right ‖Z‖).of_norm_bounded + intro j + rw [norm_mul, Complex.norm_real, Real.norm_of_nonneg (hp j)] + exact mul_le_mul_of_nonneg_left (entry_norm_le b Z j j) (hp j) + +theorem mean_add (b : HilbertBasis J ℂ E) (p : J → ℝ) (hp : ∀j,0 ≤ p j) (hs : Summable p) + (Z T : E →L[ℂ] E) : mean b p (Z+T)=mean b p Z+mean b p T := by + simp only [mean, entry_add, mul_add] + exact (mean_summable b p hp hs Z).tsum_add (mean_summable b p hp hs T) + +theorem mean_smul (b : HilbertBasis J ℂ E) (p : J → ℝ) (c : ℂ) (Z : E →L[ℂ] E) : + mean b p (c • Z)=c*mean b p Z := by + simp only [mean, entry_smul, mul_left_comm (p _ : ℂ) c, tsum_mul_left] + +theorem entry_id [DecidableEq J] (b : HilbertBasis J ℂ E) (i j : J) : + entry b (ContinuousLinearMap.id ℂ E) i j = if i=j then 1 else 0 := by + exact orthonormal_iff_ite.mp b.orthonormal i j + +theorem mean_id (b : HilbertBasis J ℂ E) (p : J → ℝ) (hs : HasSum p 1) : + mean b p (ContinuousLinearMap.id ℂ E)=1 := by + classical + simp only [mean, entry_id, ite_true, mul_one] + exact (hs.mapL Complex.ofRealCLM).tsum_eq + +end + +section +open scoped BigOperators ComplexConjugate +variable {J E : Type*} [NormedAddCommGroup E] [InnerProductSpace ℂ E] + +theorem mean_neg (b : HilbertBasis J ℂ E) (p : J → ℝ) (Z : E →L[ℂ] E) : + mean b p (-Z) = -mean b p Z := by + simpa only [neg_one_smul, neg_one_mul] using mean_smul b p (-1) Z + +theorem mean_sub (b : HilbertBasis J ℂ E) (p : J → ℝ) (hp : ∀j,0 ≤ p j) (hs : Summable p) + (Z T : E →L[ℂ] E) : mean b p (Z-T)=mean b p Z-mean b p T := by + rw [sub_eq_add_neg, mean_add b p hp hs, mean_neg, sub_eq_add_neg] + +def centerLM (b : HilbertBasis J ℂ E) (p : J → ℝ) (hp : ∀j,0 ≤ p j) (hs : Summable p) : + (E →L[ℂ] E) →ₗ[ℂ] (E →L[ℂ] E) where + toFun := center b p + map_add' Z T := by simp only [center, mean_add b p hp hs, add_smul]; abel + map_smul' c Z := by simp [center, mean_smul, smul_sub, smul_smul] + +@[simp] theorem centerLM_apply (b : HilbertBasis J ℂ E) (p : J → ℝ) (hp : ∀j,0 ≤ p j) (hs : Summable p) + (Z : E →L[ℂ] E) : centerLM b p hp hs Z = center b p Z := rfl + +theorem mean_center (b : HilbertBasis J ℂ E) (p : J → ℝ) (hp : ∀j,0 ≤ p j) (hs : HasSum p 1) + (Z : E →L[ℂ] E) : mean b p (center b p Z)=0 := by + rw [center, mean_sub b p hp hs.summable, mean_smul, mean_id b p hs, mul_one, sub_self] + +end + +open scoped BigOperators +variable {J E : Type*} [NormedAddCommGroup E] [InnerProductSpace ℂ E] +theorem mean_rankOne [DecidableEq J] (b : HilbertBasis J ℂ E) (p : J → ℝ) (i j : J) : + mean b p (InnerProductSpace.rankOne ℂ (b i) (b j))=if i=j then (p i:ℂ) else 0 := by + classical + rw [mean, tsum_eq_single i] + · simp only [entry, InnerProductSpace.rankOne_apply, inner_smul_right, + orthonormal_iff_ite.mp b.orthonormal, ite_true, mul_one] + split_ifs <;> simp_all + · intro k hk + simp only [entry, InnerProductSpace.rankOne_apply, inner_smul_right, + orthonormal_iff_ite.mp b.orthonormal, ite_eq_right hk, mul_zero] + +end BKM + +namespace CenteredTests +open scoped BigOperators +variable {J E : Type*} [NormedAddCommGroup E] [InnerProductSpace ℂ E] + +theorem generator_eq_center (b : HilbertBasis J ℂ E) (p : J → ℝ) (ij : J × J) : + generator b p ij=BKM.center b p (InnerProductSpace.rankOne ℂ (b ij.1) (b ij.2)) := by + classical + rw [BKM.center, BKM.mean_rankOne] + rfl + +theorem mean_eq_zero (b : HilbertBasis J ℂ E) (p : J → ℝ) (hp : ∀j,0 ≤ p j) (hs : HasSum p 1) + {Z : E →L[ℂ] E} (hZ : Z ∈ operatorSpace b p) : BKM.mean b p Z=0 := by + obtain ⟨c,rfl⟩ := Finsupp.mem_span_range_iff_exists_finsupp.mp hZ + have hc : (c.sum fun ij a => a • generator b p ij)= + BKM.centerLM b p hp hs.summable (c.sum fun ij a => a • InnerProductSpace.rankOne ℂ (b ij.1) (b ij.2)) := by + simp only [Finsupp.sum, map_sum, map_smul, BKM.centerLM_apply, ← generator_eq_center] + rw [hc, BKM.centerLM_apply] + exact BKM.mean_center b p hp hs _ + +end CenteredTests + +namespace ThermalSpectral.Space +open EntropyPhotonNumber DiagonalForms.System ThermalMetric +variable {E : Type*} [NormedAddCommGroup E] [InnerProductSpace ℂ E] [CompleteSpace E] +variable (S : ThermalSpectral.Space E) + +theorem quad_smul (X : ℝ × ℝ → ℝ) (c : ℂ) (Z : E →L[ℂ] E) : + S.quad X (c • Z)=Complex.normSq c*S.quad X Z := by + simp only [quad, map_smul, Pi.smul_apply, smul_eq_mul, Complex.normSq_mul, + mul_left_comm (X _) (Complex.normSq c), tsum_mul_left] + +theorem pquad_smul (X : ThermalSpectral.Param → ℝ) (c : ℂ) (Z : E →L[ℂ] E) : + S.pquad X (c • Z)=Complex.normSq c*S.pquad X Z := by + simp only [pquad, map_smul, Pi.smul_apply, smul_eq_mul, Complex.normSq_mul, + mul_left_comm (X _) (Complex.normSq c), tsum_mul_left] + +theorem pquad_constant (c : ℝ) (Z : E →L[ℂ] E) : + S.pquad (fun _ => c) Z=c*S.pquad (fun _ => 1) Z := by + simp only [pquad, one_mul, tsum_mul_left] + +theorem pquad_nonneg {X : ThermalSpectral.Param → ℝ} (hX : ∀ q, 0 ≤ X q) + (Z : E →L[ℂ] E) : 0 ≤ S.pquad X Z := + tsum_nonneg (fun _ij => mul_nonneg (hX _) (Complex.normSq_nonneg _)) + +theorem center_of_mem {Z : E →L[ℂ] E} (hZ : Z ∈ CenteredTests.operatorSpace S.basis S.p) : + BKM.center S.basis S.p Z=Z := by + simp only [BKM.center, CenteredTests.mean_eq_zero S.basis S.p (fun j => (S.pos j).le) S.sum hZ, + zero_smul, sub_zero] + +def normalize (lam : ℝ) : (E →L[ℂ] E) →ₗ[ℂ] (E →L[ℂ] E) := + (Real.sqrt lam : ℂ)⁻¹ • BKM.centerLM S.basis S.p (fun j => (S.pos j).le) S.sum.summable + +theorem normalize_quad {lam : ℝ} (hlam : 0 < lam) (X : ℝ × ℝ → ℝ) (Z : E →L[ℂ] E) : + lam*S.quad X (S.normalize lam Z)=S.quad X (BKM.center S.basis S.p Z) := by + change lam*S.quad X ((Real.sqrt lam:ℂ)⁻¹ • BKM.center S.basis S.p Z)=_ + rw [S.quad_smul, Complex.normSq_inv, Complex.normSq_ofReal, + Real.mul_self_sqrt hlam.le, ← mul_assoc, mul_inv_cancel₀ hlam.ne', one_mul] +theorem normalize_pquad {lam : ℝ} (hlam : 0 < lam) (X : ThermalSpectral.Param → ℝ) (Z : E →L[ℂ] E) : + lam*S.pquad X (S.normalize lam Z)=S.pquad X (BKM.center S.basis S.p Z) := by + change lam*S.pquad X ((Real.sqrt lam:ℂ)⁻¹ • BKM.center S.basis S.p Z)=_ + rw [S.pquad_smul, Complex.normSq_inv, Complex.normSq_ofReal, + Real.mul_self_sqrt hlam.le, ← mul_assoc, mul_inv_cancel₀ hlam.ne', one_mul] +end ThermalSpectral.Space + +namespace EntropyPhotonNumber +open TensorLp KrausBounded ThermalSpectral ThermalSpectral.Space +variable {n : ℕ} + +def rawFirstSliceLM (η θ : ℝ) (hη : η ∈ Set.Icc 0 1) (hθ : θ ∈ Set.Icc 0 1) + (σ τ : State n) : (Fock n →L[ℂ] Fock n) →ₗ[ℂ] (Fock n →L[ℂ] Fock n) where + toFun := rawFirstSlice η θ hη hθ σ τ + map_add' Z T := by simp only [rawFirstSlice, conditionalLeft, rawDual, dual_add] + map_smul' c Z := by simp only [rawFirstSlice, conditionalLeft, rawDual, dual_smul, RingHom.id_apply] + +def rawSecondSliceLM (η θ : ℝ) (hη : η ∈ Set.Icc 0 1) (hθ : θ ∈ Set.Icc 0 1) + (ρ τ : State n) : (Fock n →L[ℂ] Fock n) →ₗ[ℂ] (Fock n →L[ℂ] Fock n) where + toFun := rawSecondSlice η θ hη hθ ρ τ + map_add' Z T := by simp only [rawSecondSlice, conditionalRight, rawDual, dual_add] + map_smul' c Z := by simp only [rawSecondSlice, conditionalRight, rawDual, dual_smul, RingHom.id_apply] + +def normalizedSlices (η θ : ℝ) (hη : η ∈ Set.Icc 0 1) (hθ : θ ∈ Set.Icc 0 1) + (ρ σ τ : State n) (S : Fin 2 → Space (Fock n)) (lam : Fin 2 → ℝ) : + (i : Fin 2) → (Fock n →L[ℂ] Fock n) →ₗ[ℂ] (Fock n →L[ℂ] Fock n) := + ![((S 0).normalize (lam 0)).comp (rawFirstSliceLM η θ hη hθ σ τ), + ((S 1).normalize (lam 1)).comp (rawSecondSliceLM η θ hη hθ ρ τ)] + +theorem physical_diagram_arithmetic (η θ κ : ℝ) + (hη : η ∈ Set.Icc 0 1) (hθ : θ ∈ Set.Icc 0 1) (hκ : κ ∈ Set.Icc 0 1) + (ρ σ τ ω : State n) (S₀ : Space (Fock n)) (S : Fin 2 → Space (Fock n)) + (lam : Fin 2 → ℝ) (hlam : ∀ i, 0 < lam i) + (he₁ : ∀ j, ρ.op ((S 0).basis j)=((S 0).p j:ℂ) • (S 0).basis j) + (he₂ : ∀ j, σ.op ((S 1).basis j)=((S 1).p j:ℂ) • (S 1).basis j) + (he₀ : TraceEnsemble.operator S₀.ensemble= + ((1-κ:ℝ):ℂ) • (beamOutput θ hθ (beamOutput η hη ρ σ) τ).op+(κ:ℂ) • ω.op) : + let D := diagram S₀ S (fun i => (1-κ)*lam i) (normalizedSlices η θ hη hθ ρ σ τ S lam) + D.Comparison minusWeight ∧ D.Comparison plusWeight := by + dsimp only + have hw (i : Fin 2) : 0 ≤ (1-κ)*lam i := mul_nonneg (sub_nonneg.mpr hκ.2) (hlam i).le + have hmain (X : Param → ℝ) (X' : ℝ × ℝ → ℝ) (heX : X=X' ∘ raw) + (hX : ∀ q, 0 ≤ X q) + (hs : ∀ i Z, Summable (fun ij => X ((S i).pparam ij)*Complex.normSq ((S i).coords Z ij))) + (hp : ∀ Z, (1-κ)*((S 0).quad X' (BKM.center (S 0).basis (S 0).p (rawFirstSlice η θ hη hθ σ τ Z))+ + (S 1).quad X' (BKM.center (S 1).basis (S 1).p (rawSecondSlice η θ hη hθ ρ τ Z))) ≤ + S₀.quad X' (BKM.center S₀.basis S₀.p Z)) : + (diagram S₀ S (fun i => (1-κ)*lam i) (normalizedSlices η θ hη hθ ρ σ τ S lam)).Comparison X := by + apply diagram_comparison S₀ S _ hw _ X hX hs + intro Z hZ + have hh := hp Z + rw [S₀.center_of_mem hZ] at hh + simp only [Fin.sum_univ_two, heX, Space.pquad, Function.comp_apply] + change (1-κ)*lam 0*(S 0).quad X' ((S 0).normalize (lam 0) (rawFirstSlice η θ hη hθ σ τ Z))+ + (1-κ)*lam 1*(S 1).quad X' ((S 1).normalize (lam 1) (rawSecondSlice η θ hη hθ ρ τ Z)) ≤ S₀.quad X' Z + rw [mul_assoc, mul_assoc, (S 0).normalize_quad (hlam 0), (S 1).normalize_quad (hlam 1), ← mul_add] + exact hh + have hh := replaced_spectral_arithmetic η θ κ hη hθ hκ ρ σ τ ω S₀ (S 0) (S 1) he₁ he₂ he₀ + exact ⟨hmain minusWeight minus rfl (fun q => (minusWeight_pos q).le) + (fun i Z => (S i).minus_summable Z) (fun Z => (hh Z).1), + hmain plusWeight plus rfl (fun q => (plusWeight_pos q).le) + (fun i Z => (S i).plus_summable Z) (fun Z => (hh Z).2)⟩ +end EntropyPhotonNumber + +namespace BKM +open DiagonalForms.System +variable {J E : Type*} [NormedAddCommGroup E] [InnerProductSpace ℂ E] +def quadratic (b : HilbertBasis J ℂ E) (p : J → ℝ) (Z : E →L[ℂ] E) : ℝ := + ∑' ij : J × J, logMean (p ij.1) (p ij.2)*Complex.normSq (entry b Z ij.1 ij.2) +end BKM + +namespace ThermalSpectral.Space +open EntropyPhotonNumber DiagonalForms.System ThermalMetric +variable {E : Type*} [NormedAddCommGroup E] [InnerProductSpace ℂ E] [CompleteSpace E] +variable (S : ThermalSpectral.Space E) + +theorem pquad_one (Z : E →L[ℂ] E) : + S.pquad (fun _ => 1) Z=h S.r*BKM.quadratic S.basis S.p Z := by + simp only [pquad, one_mul, S.coords_norm, base, BKM.quadratic, mul_assoc, tsum_mul_left] + +theorem normalized_hessian (S₀ : ThermalSpectral.Space E) {lam κ ε : ℝ} + (hlam : 0 < lam) (hκ : κ < 1) (T Z : E →L[ℂ] E) + (hh : (1-κ)^2*BKM.quadratic S.basis S.p (BKM.center S.basis S.p T) ≤ + (1+ε)*(1-κ)*lam*(h S₀.r/h S.r)*BKM.quadratic S₀.basis S₀.p Z) : + (1-κ)*S.pquad (fun _ => 1) (S.normalize lam T) ≤ (1+ε)*S₀.pquad (fun _ => 1) Z := by + have hn : lam*S.pquad (fun _ => 1) (S.normalize lam T)=S.pquad (fun _ => 1) (BKM.center S.basis S.p T) := + S.normalize_pquad hlam (fun _ => 1) T + apply (mul_le_mul_iff_right₀ (mul_pos (sub_pos.mpr hκ) hlam)).mp + calc + _ = (1-κ)^2*(lam*S.pquad (fun _ => 1) (S.normalize lam T)) := by ring + _ = h S.r*((1-κ)^2*BKM.quadratic S.basis S.p (BKM.center S.basis S.p T)) := by + rw [hn, S.pquad_one]; ring + _ ≤ h S.r*((1+ε)*(1-κ)*lam*(h S₀.r/h S.r)*BKM.quadratic S₀.basis S₀.p Z) := + mul_le_mul_of_nonneg_left hh (h_pos S.rpos).le + _ = _ := by rw [S₀.pquad_one]; field_simp [(h_pos S.rpos).ne'] +end ThermalSpectral.Space + +namespace ThermalSpectral +open EntropyPhotonNumber DiagonalForms.System ThermalMetric +open scoped BigOperators +variable {E : Type*} [NormedAddCommGroup E] [InnerProductSpace ℂ E] [CompleteSpace E] + +theorem diagram_constant (S₀ : Space E) (S : Fin 2 → Space E) (lam : Fin 2 → ℝ) + (hlam : ∀ i, 0 ≤ lam i) (κ ε : ℝ) (hκ : κ ≤ 1) + (L : (i : Fin 2) → (E →L[ℂ] E) →ₗ[ℂ] (E →L[ℂ] E)) + (hh : ∀ i Z, Z ∈ CenteredTests.operatorSpace S₀.basis S₀.p → + (1-κ)*(S i).pquad (fun _ => 1) (L i Z) ≤ (1+ε)*S₀.pquad (fun _ => 1) Z) + (X : Param → ℝ) (hX : ∀ q, 0 ≤ X q) (c₀ : ℝ) (c : Fin 2 → ℝ) (hc : ∀ i, 0 ≤ c i) + (he₀ : ∀ a, X (S₀.pparam a)=c₀) (he : ∀ i a, X ((S i).pparam a)=c i) + (hslack : (1+ε)*(∑ i, lam i*c i) ≤ c₀) : + (diagram S₀ S (fun i => (1-κ)*lam i) L).Comparison X := by + have hw i : 0 ≤ (1-κ)*lam i := mul_nonneg (sub_nonneg.mpr hκ) (hlam i) + have hq₀ Z : S₀.pquad X Z=c₀*S₀.pquad (fun _ => 1) Z := by + simp only [Space.pquad, he₀, one_mul, tsum_mul_left] + have hq i Z : (S i).pquad X Z=c i*(S i).pquad (fun _ => 1) Z := by + simp only [Space.pquad, he, one_mul, tsum_mul_left] + apply diagram_comparison S₀ S _ hw L X hX + · intro i Z + simpa only [he] using (S i).constant_summable (c i) Z + intro Z hZ + rw [hq₀] + calc + _ = ∑ i, (lam i*c i)*((1-κ)*(S i).pquad (fun _ => 1) (L i Z)) := by + apply Finset.sum_congr rfl + intro i _ + rw [hq]; ring + _ ≤ ∑ i, (lam i*c i)*((1+ε)*S₀.pquad (fun _ => 1) Z) := by + apply Finset.sum_le_sum + intro i _ + exact mul_le_mul_of_nonneg_left (hh i Z hZ) (mul_nonneg (hlam i) (hc i)) + _ = ((1+ε)*∑ i, lam i*c i)*S₀.pquad (fun _ => 1) Z := by + rw [← Finset.sum_mul] + ring + _ ≤ _ := mul_le_mul_of_nonneg_right hslack (S₀.pquad_nonneg (fun _ => zero_le_one) Z) + +theorem diagram_reference (S₀ : Space E) (S : Fin 2 → Space E) (lam : Fin 2 → ℝ) + (hlam : ∀ i, 0 ≤ lam i) (κ ε : ℝ) (hκ : κ ≤ 1) + (L : (i : Fin 2) → (E →L[ℂ] E) →ₗ[ℂ] (E →L[ℂ] E)) + (hh : ∀ i Z, Z ∈ CenteredTests.operatorSpace S₀.basis S₀.p → + (1-κ)*(S i).pquad (fun _ => 1) (L i Z) ≤ (1+ε)*S₀.pquad (fun _ => 1) Z) + (hr : (1+ε)*(∑ i, lam i*(S i).r) ≤ S₀.r) + (hs : (1+ε)*(∑ i, lam i*((S i).r+1)) ≤ S₀.r+1) : + (diagram S₀ S (fun i => (1-κ)*lam i) L).Comparison (fun q => q.1.val) ∧ + (diagram S₀ S (fun i => (1-κ)*lam i) L).Comparison (fun q => q.1.val+1) := by + constructor + · exact diagram_constant S₀ S lam hlam κ ε hκ L hh (fun q => q.1.val) (fun q => q.1.property.le) + S₀.r (fun i => (S i).r) (fun i => (S i).rpos.le) (fun _ => rfl) (fun _ _ => rfl) hr + · exact diagram_constant S₀ S lam hlam κ ε hκ L hh (fun q => q.1.val+1) (fun q => by linarith [q.1.property]) + (S₀.r+1) (fun i => (S i).r+1) (fun i => by linarith [(S i).rpos]) + (fun _ => rfl) (fun _ _ => rfl) hs + +theorem diagram_observable (S₀ : Space E) (S : Fin 2 → Space E) (w : Fin 2 → ℝ) + (hw : ∀ i, 0 ≤ w i) + (L : (i : Fin 2) → (E →L[ℂ] E) →ₗ[ℂ] (E →L[ℂ] E)) (X : Param → ℝ) + (hX : ∀ q, 0 ≤ X q) + (hs : ∀ i Z, Summable (fun a => X ((S i).pparam a)*Complex.normSq ((S i).coords Z a))) + (hh : (diagram S₀ S w L).Comparison X) (Z : E →L[ℂ] E) + (hZ : Z ∈ CenteredTests.operatorSpace S₀.basis S₀.p) : + ∑ i, w i*(S i).pquad X (L i Z) ≤ S₀.pquad X Z := by + let z : CenteredTests.coordinates S₀.basis S₀.p S₀.base := ⟨S₀.coords Z, ⟨Z,hZ,rfl⟩⟩ + have hz : CenteredTests.realize S₀.basis S₀.p S₀.base S₀.base_pos z=Z := by + apply CenteredTests.entryMap_injective S₀.basis S₀.base S₀.base_pos + exact CenteredTests.realize_entries S₀.basis S₀.p S₀.base S₀.base_pos z + have hn (a : Σ i, (S i).I × (S i).I) : 0 ≤ X ((S a.1).pparam a.2)* + (w a.1*Complex.normSq ((S a.1).coords (L a.1 Z) a.2)) := + mul_nonneg (hX _) (mul_nonneg (hw _) (Complex.normSq_nonneg _)) + have ht : Summable (fun a : Σ i, (S i).I × (S i).I => X ((S a.1).pparam a.2)* + (w a.1*Complex.normSq ((S a.1).coords (L a.1 Z) a.2))) := by + apply (summable_sigma_of_nonneg hn).mpr + refine ⟨fun i => ?_, (hasSum_fintype _).summable⟩ + simpa only [mul_left_comm] using (hs i (L i Z)).mul_left (w i) + have hsum : (∑' a : Σ i, (S i).I × (S i).I, X ((S a.1).pparam a.2)* + (w a.1*Complex.normSq ((S a.1).coords (L a.1 Z) a.2))) = + ∑ i, w i*(S i).pquad X (L i Z) := by + rw [ht.tsum_sigma] + simp only [tsum_fintype, Space.pquad, mul_left_comm (X _) (w _), tsum_mul_left] + rw [← hsum] + apply ht.tsum_le_of_sum_le + intro s + have hh' := hh z s + change (∑ a ∈ s, X ((S a.1).pparam a.2)*Complex.normSq + (targetMap S w L (CenteredTests.realize S₀.basis S₀.p S₀.base S₀.base_pos z) a)) ≤ + S₀.pquad X Z at hh' + simpa only [hz, targetMap_norm S w hw L] using hh' +end ThermalSpectral + +namespace EntropyPhotonNumber +open TensorLp KrausBounded ThermalSpectral ThermalSpectral.Space ThermalMetric +variable {n : ℕ} + +theorem physical_thermal_contraction (η θ κ ε : ℝ) + (hη : η ∈ Set.Icc 0 1) (hθ : θ ∈ Set.Icc 0 1) (hκ : κ ∈ Set.Icc 0 1) (hκ1 : κ < 1) + (ρ σ τ ω : State n) (S₀ : Space (Fock n)) (S : Fin 2 → Space (Fock n)) + (lam : Fin 2 → ℝ) (hlam : ∀ i, 0 < lam i) + (he₁ : ∀ j, ρ.op ((S 0).basis j)=((S 0).p j:ℂ) • (S 0).basis j) + (he₂ : ∀ j, σ.op ((S 1).basis j)=((S 1).p j:ℂ) • (S 1).basis j) + (he₀ : TraceEnsemble.operator S₀.ensemble= + ((1-κ:ℝ):ℂ) • (beamOutput θ hθ (beamOutput η hη ρ σ) τ).op+(κ:ℂ) • ω.op) + (hh₁ : ∀ Z, Z ∈ CenteredTests.operatorSpace S₀.basis S₀.p → + (1-κ)^2*BKM.quadratic (S 0).basis (S 0).p + (BKM.center (S 0).basis (S 0).p (rawFirstSlice η θ hη hθ σ τ Z)) ≤ + (1+ε)*(1-κ)*lam 0*(h S₀.r/h (S 0).r)*BKM.quadratic S₀.basis S₀.p Z) + (hh₂ : ∀ Z, Z ∈ CenteredTests.operatorSpace S₀.basis S₀.p → + (1-κ)^2*BKM.quadratic (S 1).basis (S 1).p + (BKM.center (S 1).basis (S 1).p (rawSecondSlice η θ hη hθ ρ τ Z)) ≤ + (1+ε)*(1-κ)*lam 1*(h S₀.r/h (S 1).r)*BKM.quadratic S₀.basis S₀.p Z) + (hr : (1+ε)*(∑ i, lam i*(S i).r) ≤ S₀.r) + (hs : (1+ε)*(∑ i, lam i*((S i).r+1)) ≤ S₀.r+1) + (Z : Fock n →L[ℂ] Fock n) (hZ : Z ∈ CenteredTests.operatorSpace S₀.basis S₀.p) : + ∑ i, ((1-κ)*lam i)*(S i).pquad thermalWeight + (normalizedSlices η θ hη hθ ρ σ τ S lam i Z) ≤ S₀.pquad thermalWeight Z := by + have ha := physical_diagram_arithmetic η θ κ hη hθ hκ ρ σ τ ω S₀ S lam hlam he₁ he₂ he₀ + have hh : ∀ i Z, Z ∈ CenteredTests.operatorSpace S₀.basis S₀.p → + (1-κ)*(S i).pquad (fun _ => 1) (normalizedSlices η θ hη hθ ρ σ τ S lam i Z) ≤ + (1+ε)*S₀.pquad (fun _ => 1) Z := by + intro i U hU + fin_cases i + · exact (S 0).normalized_hessian S₀ (hlam 0) hκ1 _ U (hh₁ U hU) + · exact (S 1).normalized_hessian S₀ (hlam 1) hκ1 _ U (hh₂ U hU) + have hc := diagram_reference S₀ S lam (fun i => (hlam i).le) κ ε hκ.2 + (normalizedSlices η θ hη hθ ρ σ τ S lam) hh hr hs + have ht := diagram_thermal S₀ S (fun i => (1-κ)*lam i) + (normalizedSlices η θ hη hθ ρ σ τ S lam) ha.2 ha.1 hc.1 hc.2 + exact diagram_observable S₀ S _ (fun i => mul_nonneg (sub_nonneg.mpr hκ.2) (hlam i).le) + _ thermalWeight (fun q => (weight_pos q.1.property _).le) + (fun i U => (S i).thermal_summable U) ht Z hZ +end EntropyPhotonNumber + +namespace EntropyPhotonNumber.SpectralLogData +open QuantumTrace Annihilation WeightedGenerator ThermalMetric ThermalSpectral +open scoped ComplexConjugate +variable {n : ℕ} {ρ : State n} (G : SpectralLogData n ρ) + +def thermalSpace (t : ℝ) (ht : 0 inverseWeight 3 (G.spectralColumns r)) + (fun r => inverseWeight 3 (G.spectralColumns r))=ρ.op := by + simp only [G.spectralColumns_inverse] + exact CrossEnsemble.eigenEnsemble_operator G.basis G.probability + (fun r => (G.probability_pos r).le) G.probability_sum.summable ρ.op ρ.positive.isSymmetric G.eigen + +def weightedColumns : WeightedColumns ρ where + Index := G.J + vector := G.spectralColumns + summable := G.spectralColumns_summable + normalized := G.spectralColumns_normalized + density := G.inverse_spectralColumns_operator + +def ambientDefect (t : ℝ) (ht : 0 ℂ) 2 →L[ℂ] ℂ := + defectFunctional t ht G.probability G.probability_pos (G.centeredMatrix j) + (G.centeredMatrix_defect_summable t j) + +theorem ambientDefect_observable (t : ℝ) (ht : 0 ‖x i‖^2) 1) (hy : HasSum (fun j => ‖y j‖^2) 1) + (he : TraceEnsemble.operator x=TraceEnsemble.operator y) + (Z : H (A × B) →L[ℂ] H (A × B)) : conditionalLeft x hx Z=conditionalLeft y hy Z := by + apply ContinuousLinearMap.ext + intro v + apply ext_inner_left ℂ + intro u + rw [← (conditionalLeft_entry x hx Z u v).tsum_eq, ← (conditionalLeft_entry y hy Z u v).tsum_eq] + let bas : HilbertBasis B ℂ (H B) := HilbertBasis.ofRepr (LinearIsometryEquiv.refl ℂ _) + have hh := CrossEnsemble.pairing_eq_of_operator_eq bas hx.summable hx.summable hy.summable hy.summable + he ((tensorLeft u).adjoint ∘L Z ∘L tensorLeft v) + simpa only [CrossEnsemble.pairing, ContinuousLinearMap.comp_apply, + ContinuousLinearMap.adjoint_inner_right, tensorLeft_apply] using hh + +theorem conditionalRight_eq_of_operator (x : I → H A) (y : J → H A) + (hx : HasSum (fun i => ‖x i‖^2) 1) (hy : HasSum (fun j => ‖y j‖^2) 1) + (he : TraceEnsemble.operator x=TraceEnsemble.operator y) + (Z : H (A × B) →L[ℂ] H (A × B)) : conditionalRight x hx Z=conditionalRight y hy Z := by + apply ContinuousLinearMap.ext + intro v + apply ext_inner_left ℂ + intro u + rw [← (conditionalRight_entry x hx Z u v).tsum_eq, ← (conditionalRight_entry y hy Z u v).tsum_eq] + let bas : HilbertBasis A ℂ (H A) := HilbertBasis.ofRepr (LinearIsometryEquiv.refl ℂ _) + have hh := CrossEnsemble.pairing_eq_of_operator_eq bas hx.summable hx.summable hy.summable hy.summable + he ((tensorRight u).adjoint ∘L Z ∘L tensorRight v) + simpa only [CrossEnsemble.pairing, ContinuousLinearMap.comp_apply, + ContinuousLinearMap.adjoint_inner_right, tensorRight_apply] using hh +end TensorLp + +namespace EntropyPhotonNumber +open TensorLp KrausBounded BeamLadder Annihilation +variable {n : ℕ} + +theorem joint_dual_conjugate (η : ℝ) (hη : η ∈ Set.Icc 0 1) (Z : Fock n →L[ℂ] Fock n) : + dual (jointKraus η hη) (jointKraus_norm η hη) Z=conjugate η hη Z := by + apply ContinuousLinearMap.ext + intro y + apply ext_inner_left ℂ + intro x + rw [conjugate_inner] + exact (dual_entry _ _ Z x y).unique (by + simpa only [jointKraus, ContinuousLinearMap.comp_apply, sliceCLM_apply, + LinearIsometryEquiv.coe_toContinuousLinearEquiv, ContinuousLinearEquiv.coe_coe, slice_liftLeft] + using hasSum_slice_inner (beamUnitary η hη x) (liftLeft Z (beamUnitary η hη y))) + +theorem first_dual_conditional (η : ℝ) (hη : η ∈ Set.Icc 0 1) (σ : State n) + (Z : Fock n →L[ℂ] Fock n) : + dual (firstKraus η hη σ) (firstKraus_norm η hη σ) Z= + conditionalLeft (rootColumn σ) (rootColumn_norm σ) (conjugate η hη Z) := by + let V := fun j => tensorRight (A:=NumberIndex n) (rootColumn σ j) + let U := jointKraus (n:=n) η hη + have hV := rightFamily_norm (rootColumn σ) (rootColumn_norm σ) (A:=NumberIndex n) + have hU := jointKraus_norm (n:=n) η hη + have hr := dual_reindex (Equiv.prodComm _ _) (composite V U) (composite_norm V U hV hU) + (fun x => (Equiv.prodComm _ _).hasSum_iff.mpr (composite_norm V U hV hU x)) Z + change dual (firstKraus η hη σ) _ Z=dual (composite V U) _ Z at hr + rw [hr, dual_composite V U hV hU] + change dual V hV (dual (jointKraus η hη) hU Z)=_ + rw [joint_dual_conjugate] + rfl + +namespace WeightedColumns +variable {ρ σ τ : State n} + +theorem rawSlice_root (X : WeightedColumns ρ) (η : ℝ) (hη : η ∈ Set.Icc 0 1) + (Z : Fock n →L[ℂ] Fock n) : + X.rawSlice η hη Z=conditionalLeft (rootColumn ρ) (rootColumn_norm ρ) (conjugate η hη Z) := by + apply conditionalLeft_eq_of_operator + exact X.density.trans (rootColumn_operator ρ).symm + +theorem rawSliceRight_root (X : WeightedColumns ρ) (η : ℝ) (hη : η ∈ Set.Icc 0 1) + (Z : Fock n →L[ℂ] Fock n) : + X.rawSliceRight η hη Z=conditionalRight (rootColumn ρ) (rootColumn_norm ρ) (conjugate η hη Z) := by + apply conditionalRight_eq_of_operator + exact X.density.trans (rootColumn_operator ρ).symm + +theorem rawSlice_dual (X : WeightedColumns ρ) (η : ℝ) (hη : η ∈ Set.Icc 0 1) + (Z : Fock n →L[ℂ] Fock n) : + X.rawSlice η hη Z=dual (firstKraus η hη ρ) (firstKraus_norm η hη ρ) Z := by + rw [X.rawSlice_root, first_dual_conditional] + +theorem rawFirstSlice_physical (Y : WeightedColumns σ) (D : WeightedColumns τ) + (η θ : ℝ) (hη : η ∈ Set.Icc 0 1) (hθ : θ ∈ Set.Icc 0 1) (Z : Fock n →L[ℂ] Fock n) : + rawFirstSlice η θ hη hθ σ τ Z=Y.rawSlice η hη (D.rawSlice θ hθ Z) := by + rw [Y.rawSlice_root, D.rawSlice_dual] + unfold rawFirstSlice rawDual rawJointKraus + rw [dual_composite _ _ (jointKraus_norm η hη) (firstKraus_norm θ hθ τ), joint_dual_conjugate] + +theorem rawSecondSlice_physical (X : WeightedColumns ρ) (D : WeightedColumns τ) + (η θ : ℝ) (hη : η ∈ Set.Icc 0 1) (hθ : θ ∈ Set.Icc 0 1) (Z : Fock n →L[ℂ] Fock n) : + rawSecondSlice η θ hη hθ ρ τ Z=X.rawSliceRight η hη (D.rawSlice θ hθ Z) := by + rw [X.rawSliceRight_root, D.rawSlice_dual] + unfold rawSecondSlice rawDual rawJointKraus + rw [dual_composite _ _ (jointKraus_norm η hη) (firstKraus_norm θ hθ τ), joint_dual_conjugate] +end WeightedColumns +end EntropyPhotonNumber + +namespace ThermalSpectral +open EntropyPhotonNumber DiagonalForms.System ThermalMetric +open scoped BigOperators +variable {E : Type*} [NormedAddCommGroup E] [InnerProductSpace ℂ E] [CompleteSpace E] + +def scalarTarget (q : (E →L[ℂ] E) →ₗ[ℂ] ℂ) : + (E →L[ℂ] E) →ₗ[ℂ] (Unit → ℂ) where + toFun Z _ := q Z + map_add' X Y := by ext; exact map_add q X Y + map_smul' c X := by ext; exact q.map_smul c X + +def scalarDiagram (S : Space E) (q : (E →L[ℂ] E) →ₗ[ℂ] ℂ) : + DiagonalForms.System (Option Param) (S.I × S.I) Unit := + CenteredTests.system S.basis S.p S.pos S.sum.summable (h S.r) (h_pos S.rpos) + (fun ij => some (S.pparam ij)) (some (⟨S.r,S.rpos⟩,0)) + (fun j => by simp [Space.pparam, Space.param, frequency]) + (fun _ => none) (scalarTarget q) + +def scalarWeight (w : Param → ℝ) : Option Param → ℝ + | none => 1 + | some p => w p + +theorem scalar_comparison (S : Space E) (q : (E →L[ℂ] E) →ₗ[ℂ] ℂ) + (w : Param → ℝ) + (hh : ∀ Z, Z ∈ CenteredTests.operatorSpace S.basis S.p → + Complex.normSq (q Z) ≤ S.pquad w Z) : + (scalarDiagram S q).Comparison (scalarWeight w) := by + intro z s + let Z := CenteredTests.realize S.basis S.p S.base S.base_pos z + have hz : S.coords Z=z.val := CenteredTests.realize_entries S.basis S.p S.base S.base_pos z + have hm : Z ∈ CenteredTests.operatorSpace S.basis S.p := + CenteredTests.realize_mem S.basis S.p S.base S.base_pos z + have hh' := hh Z hm + have ht : (∑ _u ∈ s, Complex.normSq (q Z)) ≤ Complex.normSq (q Z) := by + have hh := (hasSum_fintype (fun _u : Unit => Complex.normSq (q Z))).summable.sum_le_tsum + s (fun _ _ => Complex.normSq_nonneg _) + simpa using hh + change (∑ _u ∈ s, 1*Complex.normSq (q Z)) ≤ _ + simp only [one_mul] + convert! ht.trans hh' using 1 + simp only [sourceForm, scalarDiagram, CenteredTests.system, scalarWeight, Space.pquad, hz] + +theorem scalar_logMean_bound (S : Space E) (q : (E →L[ℂ] E) →ₗ[ℂ] ℂ) + (v w : Param → ℝ) (hv : ∀ p, 0 < v p) (hw : ∀ p, 0 < w p) + (hV : ∀ Z, Z ∈ CenteredTests.operatorSpace S.basis S.p → + Complex.normSq (q Z) ≤ S.pquad v Z) + (hW : ∀ Z, Z ∈ CenteredTests.operatorSpace S.basis S.p → + Complex.normSq (q Z) ≤ S.pquad w Z) + (Z : E →L[ℂ] E) (hZ : Z ∈ CenteredTests.operatorSpace S.basis S.p) : + Complex.normSq (q Z) ≤ S.pquad (fun p => logMean (v p) (w p)) Z := by + let D := scalarDiagram S q + have hv' : ∀ p, 0 < scalarWeight v p := by intro p; cases p <;> simp [scalarWeight,hv] + have hw' : ∀ p, 0 < scalarWeight w p := by intro p; cases p <;> simp [scalarWeight,hw] + have hi := D.comparison_logMean (scalar_comparison S q v hV) (scalar_comparison S q w hW) hv' hw' + let z : D.tests := ⟨S.coords Z, ⟨Z,hZ,rfl⟩⟩ + have hz : CenteredTests.realize S.basis S.p S.base S.base_pos z=Z := by + apply CenteredTests.entryMap_injective S.basis S.base S.base_pos + exact CenteredTests.realize_entries S.basis S.p S.base S.base_pos z + have hh := hi z Finset.univ + change (∑ _u : Unit, logMean 1 1*Complex.normSq (q + (CenteredTests.realize S.basis S.p S.base S.base_pos z))) ≤ _ at hh + rw [hz] at hh + simpa only [logMean_self, one_mul, Finset.univ_unique, Finset.sum_singleton, + sourceForm, D, scalarDiagram, CenteredTests.system, scalarWeight, Space.pquad, z] + using hh + +theorem scalar_arithmetic_BKM (S : Space E) (q : (E →L[ℂ] E) →ₗ[ℂ] ℂ) + (hV : ∀ Z, Z ∈ CenteredTests.operatorSpace S.basis S.p → + Complex.normSq (q Z) ≤ S.pquad plusWeight Z) + (hW : ∀ Z, Z ∈ CenteredTests.operatorSpace S.basis S.p → + Complex.normSq (q Z) ≤ S.pquad minusWeight Z) + (Z : E →L[ℂ] E) (hZ : Z ∈ CenteredTests.operatorSpace S.basis S.p) : + Complex.normSq (q Z) ≤ S.pquad (fun _ => 1/h S.r) Z := by + have hh := scalar_logMean_bound S q plusWeight minusWeight plusWeight_pos minusWeight_pos hV hW Z hZ + convert! hh using 1 + apply tsum_congr + intro a + congr 1 + exact (EntropyPhotonNumber.logarithmicMean_exp_pair (one_div_pos.mpr (h_pos S.rpos)) + (h S.r*(S.param a).2/2)).symm + +end ThermalSpectral + +end + +open scoped BigOperators ComplexConjugate +open scoped BigOperators +open MvPolynomial +open scoped BigOperators ComplexConjugate Classical +open Submodule +open scoped ENNReal +open scoped ComplexConjugate +open ContinuousLinearMap +open Set Filter Topology Complex Metric +open MeasureTheory Set Filter Topology Complex Metric InnerProductSpace +open scoped ENNReal NNReal +open Filter Topology +open Set Filter Topology Complex MeasureTheory + +namespace EnsembleL2 +open scoped BigOperators ComplexConjugate +variable {E I J : Type*} [NormedAddCommGroup E] [InnerProductSpace ℂ E] [CompleteSpace E] + +def meanLM (v : I → E) (hv : Summable (fun i => ‖v i‖^2)) : + (E →L[ℂ] E) →ₗ[ℂ] ℂ where + toFun := mean v + map_add' Z Y := by + unfold mean + simp only [add_apply, inner_add_right] + exact (mean_hasSum v hv Z).summable.tsum_add (mean_hasSum v hv Y).summable + map_smul' c Z := by + simp only [mean, smul_apply, inner_smul_right, tsum_mul_left, smul_eq_mul, RingHom.id_apply] +def mixtureFunctional (v : I → E) (w : J → E) + (hv : Summable (fun i => ‖v i‖^2)) (hw : Summable (fun j => ‖w j‖^2)) + (t : ℝ) : (E →L[ℂ] E) →ₗ[ℂ] ℂ := + (Real.sqrt (t*(1-t)) : ℂ) • (meanLM v hv-meanLM w hw) + +omit [CompleteSpace E] in +theorem mixtureFunctional_apply (v : I → E) (w : J → E) + (hv : Summable (fun i => ‖v i‖^2)) (hw : Summable (fun j => ‖w j‖^2)) + (t : ℝ) (Z : E →L[ℂ] E) : + mixtureFunctional v w hv hw t Z = (Real.sqrt (t*(1-t)) : ℂ)*(mean v Z-mean w Z) := rfl + +omit [CompleteSpace E] in +theorem mixtureFunctional_square (v : I → E) (w : J → E) + (hv : Summable (fun i => ‖v i‖^2)) (hw : Summable (fun j => ‖w j‖^2)) + {t : ℝ} (ht : t ∈ Set.Icc 0 1) (Z : E →L[ℂ] E) : + Complex.normSq (mixtureFunctional v w hv hw t Z)=t*(1-t)*‖mean v Z-mean w Z‖^2 := by + rw [mixtureFunctional_apply, Complex.normSq_mul, Complex.normSq_ofReal, + Real.mul_self_sqrt (mul_nonneg ht.1 (sub_nonneg.mpr ht.2)), Complex.normSq_eq_norm_sq] + +theorem mixtureFunctional_adjoint_square (v : I → E) (w : J → E) + (hv : Summable (fun i => ‖v i‖^2)) (hw : Summable (fun j => ‖w j‖^2)) + {t : ℝ} (ht : t ∈ Set.Icc 0 1) (Z : E →L[ℂ] E) : + Complex.normSq (mixtureFunctional v w hv hw t Z.adjoint)= + Complex.normSq (mixtureFunctional v w hv hw t Z) := by + simp only [mixtureFunctional_square v w hv hw ht, mean_adjoint, ← map_sub, + Complex.norm_conj] +end EnsembleL2 + +namespace ThermalSpectral +open EntropyPhotonNumber DiagonalForms.System ThermalMetric +open scoped BigOperators +variable {E I J : Type*} [NormedAddCommGroup E] [InnerProductSpace ℂ E] [CompleteSpace E] + +theorem mixture_arithmetic_bounds (S : Space E) (v : I → E) (w : J → E) + {t : ℝ} (ht : t ∈ Set.Icc 0 1) + (hv : HasSum (fun i => ‖v i‖^2) 1) (hw : HasSum (fun j => ‖w j‖^2) 1) + (he : TraceEnsemble.operator S.ensemble=TraceEnsemble.operator (EnsembleL2.mixture v w t)) + (Z : E →L[ℂ] E) (hZ : Z ∈ CenteredTests.operatorSpace S.basis S.p) : + Complex.normSq (EnsembleL2.mixtureFunctional v w hv.summable hw.summable t Z) ≤ S.pquad plusWeight Z ∧ + Complex.normSq (EnsembleL2.mixtureFunctional v w hv.summable hw.summable t Z) ≤ S.pquad minusWeight Z := by + let u := EnsembleL2.mixture v w t + have hu : HasSum (fun a => ‖u a‖^2) 1 := EnsembleL2.mixture_hasSum v w ht hv hw + have hz : EnsembleL2.mean u Z=0 := by + rw [← EnsembleL2.mean_eq_of_operator_eq S.basis S.ensemble_hasSum.summable hu.summable he Z, + S.ensemble_mean] + exact CenteredTests.mean_eq_zero S.basis S.p (fun j => (S.pos j).le) S.sum hZ + have hza : EnsembleL2.mean u Z.adjoint=0 := by rw [EnsembleL2.mean_adjoint, hz, map_zero] + have hc : EnsembleL2.center u Z=Z := by simp only [EnsembleL2.center,hz,zero_smul,sub_zero] + have hca : EnsembleL2.center u Z.adjoint=Z.adjoint := by simp only [EnsembleL2.center,hza,zero_smul,sub_zero] + have hm := EnsembleL2.mixture_between_variance v w ht hv hw Z + have hp := EnsembleL2.mixture_between_variance v w ht hv hw Z.adjoint + change _ ≤ EnsembleL2.secondMoment u (EnsembleL2.center u Z) at hm + change _ ≤ EnsembleL2.secondMoment u (EnsembleL2.center u Z.adjoint) at hp + rw [hc] at hm + rw [hca] at hp + rw [← EnsembleL2.mixtureFunctional_square v w hv.summable hw.summable ht Z] at hm + rw [← EnsembleL2.mixtureFunctional_square v w hv.summable hw.summable ht Z.adjoint, + EnsembleL2.mixtureFunctional_adjoint_square v w hv.summable hw.summable ht Z] at hp + constructor + · change _ ≤ S.quad Space.plus Z + rw [S.plus_quad_of_ensemble u hu.summable he Z] + exact hp + · change _ ≤ S.quad Space.minus Z + rw [S.minus_quad_of_ensemble u hu.summable he Z] + exact hm + +theorem mixture_BKM_bound (S : Space E) (v : I → E) (w : J → E) + {t : ℝ} (ht : t ∈ Set.Icc 0 1) + (hv : HasSum (fun i => ‖v i‖^2) 1) (hw : HasSum (fun j => ‖w j‖^2) 1) + (he : TraceEnsemble.operator S.ensemble=TraceEnsemble.operator (EnsembleL2.mixture v w t)) + (Z : E →L[ℂ] E) (hZ : Z ∈ CenteredTests.operatorSpace S.basis S.p) : + Complex.normSq (EnsembleL2.mixtureFunctional v w hv.summable hw.summable t Z) ≤ + S.pquad (fun _ => 1/h S.r) Z := + scalar_arithmetic_BKM S _ (fun Y hY => (mixture_arithmetic_bounds S v w ht hv hw he Y hY).1) + (fun Y hY => (mixture_arithmetic_bounds S v w ht hv hw he Y hY).2) Z hZ +end ThermalSpectral + +namespace ThermalDual + +variable {I J : Type*} [Fintype I] [Fintype J] + +theorem weighted_sum_bound (w a b : I → ℝ) (hw : ∀ i, 0 ≤ w i) : + ∑ i, w i*a i*b i ≤ Real.sqrt (∑ i, w i*a i^2)*Real.sqrt (∑ i, w i*b i^2) := by + have hh := Real.sum_mul_le_sqrt_mul_sqrt Finset.univ + (fun i => Real.sqrt (w i)*a i) (fun i => Real.sqrt (w i)*b i) + have he (i : I) : Real.sqrt (w i)*a i*(Real.sqrt (w i)*b i)=w i*a i*b i := by + linear_combination a i*b i*(Real.sq_sqrt (hw i)) + simpa only [he, mul_pow, Real.sq_sqrt (hw _)] using hh + +theorem weighted_functionals_bound (w : I → ℝ) (hw : ∀ i, 0 ≤ w i) + (E : I → Type*) [∀ i, NormedAddCommGroup (E i)] [∀ i, NormedSpace ℂ (E i)] + (q : (i : I) → E i →L[ℂ] ℂ) (z : (i : I) → E i) : + ‖∑ i, (w i:ℂ)*q i (z i)‖ ≤ + Real.sqrt (∑ i, w i*‖q i‖^2)*Real.sqrt (∑ i, w i*‖z i‖^2) := by + calc + _ ≤ ∑ i, ‖(w i:ℂ)*q i (z i)‖ := norm_sum_le _ _ + _ ≤ ∑ i, w i*‖q i‖*‖z i‖ := by + apply Finset.sum_le_sum + intro i _ + rw [norm_mul, Complex.norm_real, Real.norm_of_nonneg (hw i), mul_assoc] + exact mul_le_mul_of_nonneg_left ((q i).le_opNorm (z i)) (hw i) + _ ≤ _ := weighted_sum_bound w (fun i => ‖q i‖) (fun i => ‖z i‖) hw + +theorem modes_triangle (q a b : J → ℝ) (hq : ∀ j, 0 ≤ q j) + (_ha : ∀ j, 0 ≤ a j) (_hb : ∀ j, 0 ≤ b j) (hh : ∀ j, q j ≤ a j+b j) : + Real.sqrt (∑ j, q j^2) ≤ Real.sqrt (∑ j, a j^2)+Real.sqrt (∑ j, b j^2) := by + have hs : ∑ j, q j^2 ≤ ∑ j, (a j+b j)^2 := by + exact Finset.sum_le_sum (fun j _ => pow_le_pow_left₀ (hq j) (hh j) 2) + have he : (∑ j, (a j+b j)^2)=(∑ j, a j^2)+2*(∑ j, a j*b j)+(∑ j, b j^2) := by + simp only [add_sq, Finset.sum_add_distrib, Finset.mul_sum] + ring_nf + rw [he] at hs + have hc := Real.sum_mul_le_sqrt_mul_sqrt Finset.univ a b + have hqa := Real.sq_sqrt (show 0 ≤ ∑ j, a j^2 from Finset.sum_nonneg (fun j _ => sq_nonneg (a j))) + have hqb := Real.sq_sqrt (show 0 ≤ ∑ j, b j^2 from Finset.sum_nonneg (fun j _ => sq_nonneg (b j))) + apply Real.sqrt_le_iff.mpr + constructor + · positivity + · nlinarith + +theorem defect_young {x a m C κ ε : ℝ} + (hx : 0 ≤ x) (_ha : 0 ≤ a) (_hm : 0 ≤ m) (hC : 0 < C) (hκ : 0 ≤ κ) (hε : 0 < ε) + (hk : κ ≤ ε^2/(4*(ε+2)*C^2)) + (ht : x ≤ a+Real.sqrt (2*κ)*C*m) : + x^2 ≤ a^2+ε/2*(a^2+m^2) := by + let t := Real.sqrt (2*κ)*C + have htpos : 0 ≤ t := mul_nonneg (Real.sqrt_nonneg _) hC.le + have ht2 : t^2=2*κ*C^2 := by + dsimp only [t] + rw [mul_pow, Real.sq_sqrt (by positivity)] + have hkd : 0 < 4*(ε+2)*C^2 := by positivity + have hk' := (le_div_iff₀ hkd).mp hk + have htb : 2*(ε+2)*t^2 ≤ ε^2 := by nlinarith [ht2] + have htbm := mul_le_mul_of_nonneg_right htb (sq_nonneg m) + have hy := sq_nonneg (ε*a-2*t*m) + have ht' : x^2 ≤ (a+t*m)^2 := pow_le_pow_left₀ hx ht 2 + have htx := mul_le_mul_of_nonneg_left ht' hε.le + have hh : ε*(x^2-(a^2+ε/2*(a^2+m^2))) ≤ 0 := by + nlinarith + exact sub_nonpos.mp ((mul_le_mul_iff_of_pos_left hε).mp (by simpa only [mul_zero] using hh)) +end ThermalDual + +namespace ThermalSpectral +open EntropyPhotonNumber ThermalMetric +variable {E I J : Type*} [NormedAddCommGroup E] [InnerProductSpace ℂ E] [CompleteSpace E] + +theorem mixture_thermal_bound (S : Space E) (v : I → E) (w : J → E) + {t : ℝ} (ht : t ∈ Set.Icc 0 1) + (hv : HasSum (fun i => ‖v i‖^2) 1) (hw : HasSum (fun j => ‖w j‖^2) 1) + (he : TraceEnsemble.operator S.ensemble=TraceEnsemble.operator (EnsembleL2.mixture v w t)) + (Z : E →L[ℂ] E) (hZ : Z ∈ CenteredTests.operatorSpace S.basis S.p) : + ‖EnsembleL2.mixtureFunctional v w hv.summable hw.summable t Z‖ ≤ + mixtureConstant S.r*‖S.observable Z‖ := by + have hh := (mixture_BKM_bound S v w ht hv hw he Z hZ).trans (S.BKM_thermal_bound Z) + rw [Complex.normSq_eq_norm_sq] at hh + have hm := mul_nonneg (mixtureConstant_pos S.rpos).le (norm_nonneg (S.observable Z)) + nlinarith [norm_nonneg (EnsembleL2.mixtureFunctional v w hv.summable hw.summable t Z)] +end ThermalSpectral + +namespace ThermalDual + +section +open EntropyPhotonNumber ThermalMetric ThermalSpectral +open scoped BigOperators +variable {E I J K : Type*} [NormedAddCommGroup E] [InnerProductSpace ℂ E] [CompleteSpace E] +variable [Fintype K] + +theorem dual_bound_from_core (S₀ : Space E) (S : K → Space E) + (w : K → ℝ) (hw : ∀ i, 0 ≤ w i) + (L : (i : K) → (E →L[ℂ] E) →ₗ[ℂ] (E →L[ℂ] E)) + (q₀ : lp (fun _ : S₀.I × S₀.I => ℂ) 2 →L[ℂ] ℂ) + (q : (i : K) → lp (fun _ : (S i).I × (S i).I => ℂ) 2 →L[ℂ] ℂ) + (v : I → E) (u : J → E) {t : ℝ} (ht : t ∈ Set.Icc 0 1) + (hv : HasSum (fun i => ‖v i‖^2) 1) (hu : HasSum (fun j => ‖u j‖^2) 1) + (he : TraceEnsemble.operator S₀.ensemble=TraceEnsemble.operator (EnsembleL2.mixture v u t)) + (c : ℂ) + (hL : ∀ Z, Z ∈ CenteredTests.operatorSpace S₀.basis S₀.p → + ∑ i, w i*(S i).pquad thermalWeight (L i Z) ≤ S₀.pquad thermalWeight Z) + (hq : ∀ Z, Z ∈ CenteredTests.operatorSpace S₀.basis S₀.p → + q₀ (S₀.observable Z) = (∑ i, (w i:ℂ)*q i ((S i).observable (L i Z)))+ + c*EnsembleL2.mixtureFunctional v u hv.summable hu.summable t Z) : + ‖q₀.comp (centeredSpace S₀.r S₀.rpos S₀.p S₀.pos S₀.sum.summable).subtypeL‖ ≤ + Real.sqrt (∑ i, w i*‖q i‖^2)+‖c‖*mixtureConstant S₀.r := by + apply restricted_norm_bound_of_core S₀.basis S₀.p S₀.pos S₀.sum S₀.r S₀.rpos q₀ _ + (add_nonneg (Real.sqrt_nonneg _) (mul_nonneg (norm_nonneg _) (mixtureConstant_pos S₀.rpos).le)) + intro Z hZ + change ‖q₀ (S₀.observable Z)‖ ≤ _*‖S₀.observable Z‖ + rw [hq Z hZ] + have hh := weighted_functionals_bound w hw + (fun i => lp (fun _ : (S i).I × (S i).I => ℂ) 2) q (fun i => (S i).observable (L i Z)) + have hc : ∑ i, w i*‖(S i).observable (L i Z)‖^2 ≤ ‖S₀.observable Z‖^2 := by + simpa only [Space.observable_norm_sq] using hL Z hZ + have hs : Real.sqrt (∑ i, w i*‖(S i).observable (L i Z)‖^2) ≤ ‖S₀.observable Z‖ := by + simpa only [Real.sqrt_sq_eq_abs, abs_of_nonneg (norm_nonneg _)] using Real.sqrt_le_sqrt hc + have hj := mixture_thermal_bound S₀ v u ht hv hu he Z hZ + calc + _ ≤ ‖∑ i, (w i:ℂ)*q i ((S i).observable (L i Z))‖+ + ‖c*EnsembleL2.mixtureFunctional v u hv.summable hu.summable t Z‖ := norm_add_le _ _ + _ ≤ Real.sqrt (∑ i, w i*‖q i‖^2)*‖S₀.observable Z‖+ + ‖c‖*(mixtureConstant S₀.r*‖S₀.observable Z‖) := + add_le_add (hh.trans (mul_le_mul_of_nonneg_left hs (Real.sqrt_nonneg _))) + (by rw [norm_mul]; exact mul_le_mul_of_nonneg_left hj (norm_nonneg _)) + _ = _ := by ring +end + +section +variable {I J : Type*} [Fintype I] [Fintype J] + +theorem two_sqrt_norm_sq (a b : ℝ) (ha : 0≤a) (hb : 0≤b) (x y : ℂ) : + ‖(Real.sqrt a:ℂ)*x+(Real.sqrt b:ℂ)*y‖^2 ≤ 2*(a*‖x‖^2+b*‖y‖^2) := by + have hn := pow_le_pow_left₀ (norm_nonneg ((Real.sqrt a:ℂ)*x+(Real.sqrt b:ℂ)*y)) + (norm_add_le ((Real.sqrt a:ℂ)*x) ((Real.sqrt b:ℂ)*y)) 2 + have hp := sq_nonneg (‖(Real.sqrt a:ℂ)*x‖-‖(Real.sqrt b:ℂ)*y‖) + have he (r : ℝ) (hr : 0≤r) (z : ℂ) : ‖(Real.sqrt r:ℂ)*z‖^2=r*‖z‖^2 := by + rw [norm_mul, mul_pow, Complex.norm_real, Real.norm_of_nonneg (Real.sqrt_nonneg _), Real.sq_sqrt hr] + nlinarith [he a ha x, he b hb y] + +theorem aggregate_bound (w : I → ℝ) (hw : ∀ i, 0≤w i) + (q0 g : J → ℝ) (q m : I → J → ℝ) (hq : ∀ j, 0≤q0 j) + (hg : ∀ j, 0≤g j) (C κ : ℝ) (hC : 0≤C) (hκ : κ ∈ Set.Icc 0 1) + (hm : ∀ j, (1-κ)*g j^2≤2*∑ i, w i*m i j^2) + (hmode : ∀ j, q0 j≤Real.sqrt (∑ i, w i*q i j^2)+Real.sqrt ((1-κ)*κ)*g j*C) : + Real.sqrt (∑ j, q0 j^2)≤Real.sqrt (∑ i, w i*∑ j, q i j^2)+ + Real.sqrt (2*κ)*C*Real.sqrt (∑ i, w i*∑ j, m i j^2) := by + have hqsum j : 0≤∑ i, w i*q i j^2 := Finset.sum_nonneg (fun i _ => mul_nonneg (hw i) (sq_nonneg _)) + have hmsum : 0≤∑ i, w i*∑ j, m i j^2 := + Finset.sum_nonneg (fun i _ => mul_nonneg (hw i) (Finset.sum_nonneg (fun j _ => sq_nonneg _))) + have hh := modes_triangle q0 (fun j => Real.sqrt (∑ i, w i*q i j^2)) + (fun j => Real.sqrt ((1-κ)*κ)*g j*C) hq (fun _ => Real.sqrt_nonneg _) + (fun j => mul_nonneg (mul_nonneg (Real.sqrt_nonneg _) (hg j)) hC) hmode + have hqa : (∑ j, (Real.sqrt (∑ i, w i*q i j^2))^2)=∑ i, w i*∑ j, q i j^2 := by + simp only [Real.sq_sqrt (hqsum _), Finset.mul_sum] + exact Finset.sum_comm + have hgm : (1-κ)*(∑ j, g j^2)≤2*(∑ i, w i*∑ j, m i j^2) := by + calc + _ = ∑ j, (1-κ)*g j^2 := Finset.mul_sum .. + _ ≤ ∑ j, 2*∑ i, w i*m i j^2 := Finset.sum_le_sum (fun j _ => hm j) + _ = 2*∑ i, w i*∑ j, m i j^2 := by + rw [← Finset.mul_sum, Finset.sum_comm] + simp only [Finset.mul_sum] + have hc : (∑ j, (Real.sqrt ((1-κ)*κ)*g j*C)^2) ≤ + (Real.sqrt (2*κ)*C*Real.sqrt (∑ i, w i*∑ j, m i j^2))^2 := by + simp only [mul_pow, Real.sq_sqrt (mul_nonneg (sub_nonneg.mpr hκ.2) hκ.1), + Real.sq_sqrt (mul_nonneg (by norm_num : (0:ℝ)≤2) hκ.1), Real.sq_sqrt hmsum] + calc + _ = (κ*C^2)*((1-κ)*∑ j, g j^2) := by + simp only [Finset.mul_sum] + apply Finset.sum_congr rfl + intro j _ + ring + _ ≤ (κ*C^2)*(2*(∑ i, w i*∑ j, m i j^2)) := + mul_le_mul_of_nonneg_left hgm (mul_nonneg hκ.1 (sq_nonneg C)) + _ = _ := by ring + have hc' := Real.sqrt_le_sqrt hc + rw [Real.sqrt_sq (mul_nonneg (mul_nonneg (Real.sqrt_nonneg _) hC) (Real.sqrt_nonneg _))] at hc' + rw [hqa] at hh + exact hh.trans (add_le_add le_rfl hc') +end + +open scoped ComplexConjugate + +theorem real_mul_inverse_sqrt {a : ℝ} (ha : 0 (f k:ℂ)) C hC + (fun k => by simpa only [Complex.norm_real, Real.norm_eq_abs] using hf k) + +@[simp] theorem diagonal_apply (f : NumberIndex n → ℝ) (C : ℝ) (hC : 0 ≤ C) + (hf : ∀ k, |f k| ≤ C) (x : Fock n) (k : NumberIndex n) : + diagonal f C hC hf x k=(f k:ℂ)*x k := rfl + +theorem diagonal_quadratic (f : NumberIndex n → ℝ) (C : ℝ) (hC : 0 ≤ C) + (hf : ∀ k, |f k| ≤ C) (x : Fock n) : + HasSum (fun k => f k*‖x k‖^2) (inner ℂ x (diagonal f C hC hf x)).re := by + have hh := (lp.hasSum_inner (𝕜 := ℂ) x (diagonal f C hC hf x)).mapL Complex.reCLM + convert! hh using 1 + ext k + simp only [RCLike.inner_apply, diagonal_apply, Complex.reCLM_apply] + rw [mul_assoc, Complex.mul_conj, Complex.mul_re] + simp only [Complex.ofReal_re, Complex.ofReal_im, zero_mul, sub_zero, Complex.normSq_eq_norm_sq] + +theorem gain_lower_sq (j : Fin n) (x : Fock n) (k : NumberIndex n) : + ‖gain j false x k‖^2 = numberWeight k^4*((k j:ℝ)+1)/numberWeight (up j k)^6 * ‖x (up j k)‖^2 := by + simp only [gain, Bool.false_eq_true, ↓reduceIte, sandwich_apply, coefficient, norm_mul, + mul_pow, Complex.norm_real, Real.norm_eq_abs, sq_abs, div_pow, + Real.sq_sqrt (show 0≤(k j:ℝ)+1 by positivity)] + ring + +theorem gain_raise_sq (j : Fin n) (x : Fock n) (k : NumberIndex n) : + ‖gain j true x (up j k)‖^2 = numberWeight (up j k)^4*((k j:ℝ)+1)/numberWeight k^6 * ‖x k‖^2 := by + simp only [gain, ↓reduceIte, creationSandwich_up, creationCoefficient, norm_mul, + mul_pow, Complex.norm_real, Real.norm_eq_abs, sq_abs, div_pow, + Real.sq_sqrt (show 0≤(k j:ℝ)+1 by positivity)] + ring + +theorem gain_raise_zero (j : Fin n) (x : Fock n) (k : NumberIndex n) (hk : k j=0) : + gain j true x k=0 := creationSandwich_zero 2 3 (by omega) j x k hk + +theorem gain_lower_diagonal (f : NumberIndex n → ℝ) (C : ℝ) (hC : 0 ≤ C) + (hf : ∀ k, |f k /numberWeight k^4| ≤ C) (j : Fin n) (x : Fock n) : + HasSum (fun k => (k j:ℝ)*f (down j k)/numberWeight k^6 *‖x k‖^2) + (inner ℂ (gain j false x) (diagonal (fun k => f k/numberWeight k^4) C hC hf (gain j false x))).re := by + have hh := diagonal_quadratic (fun k => f k/numberWeight k^4) C hC hf (gain j false x) + have he (k : NumberIndex n) : f k/numberWeight k^4 *‖gain j false x k‖^2 = + (((up j k) j:ℝ)*f (down j (up j k))/numberWeight (up j k)^6 *‖x (up j k)‖^2) := by + rw [gain_lower_sq, up_same, down_up, Nat.cast_add, Nat.cast_one] + have hw : numberWeight k ≠ 0 := by linarith [numberWeight_one_le k] + field_simp + have hz (k : NumberIndex n) (hk : k ∉ Set.range (up j)) : + (k j:ℝ)*f (down j k)/numberWeight k^6 *‖x k‖^2=0 := by + rcases index_cases j k with he | ⟨l,rfl⟩ + · simp [he] + · exact (hk ⟨l,rfl⟩).elim + apply (up_injective j).hasSum_iff hz |>.mp + convert! hh using 1 + ext k + exact (he k).symm + +theorem gain_raise_diagonal (f : NumberIndex n → ℝ) (C : ℝ) (hC : 0 ≤ C) + (hf : ∀ k, |f k/numberWeight k^4| ≤ C) (j : Fin n) (x : Fock n) : + HasSum (fun k => ((k j:ℝ)+1)*f (up j k)/numberWeight k^6 *‖x k‖^2) + (inner ℂ (gain j true x) (diagonal (fun k => f k/numberWeight k^4) C hC hf (gain j true x))).re := by + have hz (k : NumberIndex n) (hk : k ∉ Set.range (up j)) : + f k/numberWeight k^4 *‖gain j true x k‖^2=0 := by + rcases index_cases j k with he | ⟨l,rfl⟩ + · simp [gain_raise_zero _ _ _ he] + · exact (hk ⟨l,rfl⟩).elim + have hh := (up_injective j).hasSum_iff hz |>.mpr + (diagonal_quadratic (fun k => f k/numberWeight k^4) C hC hf (gain j true x)) + convert! hh using 1 + ext k + simp only [Function.comp_def, gain_raise_sq] + have hw : numberWeight (up j k) ≠ 0 := by linarith [numberWeight_one_le (up j k)] + field_simp + +theorem diagonal_mode_left (f : NumberIndex n → ℝ) (C : ℝ) (hC : 0 ≤ C) + (hf : ∀ k, |f k/numberWeight k^4| ≤ C) (j : Fin n) (u : Bool) (x : Fock n) : + HasSum (fun k => ((k j:ℝ)+(if u then 1 else 0))*f k/numberWeight k^6 *‖x k‖^2) + (inner ℂ (inverseWeight 1 x) (diagonal (fun k => f k/numberWeight k^4) C hC hf (modeBound j u x))).re := by + have hh := (lp.hasSum_inner (𝕜 := ℂ) (inverseWeight 1 x) + (diagonal (fun k => f k/numberWeight k^4) C hC hf (modeBound j u x))).mapL Complex.reCLM + convert! hh using 1 + ext k + simp only [RCLike.inner_apply, diagonal_apply, inverseWeight_apply, modeBound_apply, + map_mul, map_inv₀, map_pow, Complex.conj_ofReal, Complex.reCLM_apply] + have he : ((f k/numberWeight k^4:ℝ):ℂ) * + (((((k j:ℝ)+(if u then 1 else 0))/numberWeight k:ℝ):ℂ)*x k) * + (((numberWeight k:ℂ)^1)⁻¹*conj (x k)) = + (((((k j:ℝ)+(if u then 1 else 0))*f k/numberWeight k^6):ℝ):ℂ)*(x k*conj (x k)) := by + push_cast + ring + rw [he, Complex.mul_conj, Complex.mul_re] + simp only [Complex.ofReal_re, Complex.ofReal_im, zero_mul, sub_zero, Complex.normSq_eq_norm_sq] + +theorem diagonal_selfAdjoint (f : NumberIndex n → ℝ) (C : ℝ) (hC : 0 ≤ C) + (hf : ∀ k, |f k| ≤ C) : IsSelfAdjoint (diagonal f C hC hf) := by + apply ContinuousLinearMap.isSelfAdjoint_iff_isSymmetric.mpr + intro x y + apply HasSum.unique (lp.hasSum_inner (𝕜 := ℂ) (diagonal f C hC hf x) y) + convert! lp.hasSum_inner (𝕜 := ℂ) x (diagonal f C hC hf y) using 1 + ext k + simp only [diagonal_apply, RCLike.inner_apply, map_mul, Complex.conj_ofReal] + ring + +theorem diagonal_mode_right (f : NumberIndex n → ℝ) (C : ℝ) (hC : 0 ≤ C) + (hf : ∀ k, |f k/numberWeight k^4| ≤ C) (j : Fin n) (u : Bool) (x : Fock n) : + HasSum (fun k => ((k j:ℝ)+(if u then 1 else 0))*f k/numberWeight k^6 *‖x k‖^2) + (inner ℂ (modeBound j u x) (diagonal (fun k => f k/numberWeight k^4) C hC hf (inverseWeight 1 x))).re := by + have he := ContinuousLinearMap.isSelfAdjoint_iff_isSymmetric.mp (diagonal_selfAdjoint _ C hC hf) + (modeBound j u x) (inverseWeight 1 x) + have ht := congrArg Complex.re he + have hi : (inner ℂ (diagonal (fun k => f k/numberWeight k^4) C hC hf (modeBound j u x)) (inverseWeight 1 x)).re = + (inner ℂ (inverseWeight 1 x) (diagonal (fun k => f k/numberWeight k^4) C hC hf (modeBound j u x))).re := + inner_re_symm (𝕜 := ℂ) _ _ + exact (hi.symm.trans ht) ▸ diagonal_mode_left f C hC hf j u x +end Annihilation + +namespace WeightedGenerator +open EntropyPhotonNumber QuantumTrace Annihilation +open scoped BigOperators +variable {n : ℕ} {I : Type*} + +def columnPairing (r : ℝ) (x : Fock n) (Z : Fock n →L[ℂ] Fock n) : ℝ := + ∑ j, ((r+1)*((inner ℂ (gain j false x) (Z (gain j false x))).re- + ((inner ℂ (inverseWeight 1 x) (Z (modeBound j false x))).re+ + (inner ℂ (modeBound j false x) (Z (inverseWeight 1 x))).re)/2)+ + r*((inner ℂ (gain j true x) (Z (gain j true x))).re- + ((inner ℂ (inverseWeight 1 x) (Z (modeBound j true x))).re+ + (inner ℂ (modeBound j true x) (Z (inverseWeight 1 x))).re)/2)) + +theorem columnPairing_hasSum (r : ℝ) (x : I → Fock n) + (hx : Summable (fun i => ‖x i‖^2)) (Z : Fock n →L[ℂ] Fock n) : + HasSum (fun i => columnPairing r (x i) Z) (pairing r x Z).re := by + have ha (j : Fin n) (u : Bool) := CrossEnsemble.applied_summable hx (gain j u) + have hb (j : Fin n) (u : Bool) := CrossEnsemble.applied_summable hx (modeBound j u) + have hc := CrossEnsemble.applied_summable hx (inverseWeight 1) + have h (j : Fin n) (u : Bool) := + ((CrossEnsemble.pairing_summable (ha j u) (ha j u) Z).hasSum.sub + ((((CrossEnsemble.pairing_summable (hb j u) hc Z).hasSum).add + ((CrossEnsemble.pairing_summable hc (hb j u) Z).hasSum)).mul_left (2:ℂ)⁻¹)) + have hh := (hasSum_sum fun j (_hj : j ∈ (Finset.univ : Finset (Fin n))) => + ((h j false).mul_left ((r+1:ℝ):ℂ)).add ((h j true).mul_left (r:ℂ))).mapL Complex.reCLM + convert! hh using 1 + · ext i + simp only [columnPairing, Complex.reCLM_apply, Complex.re_sum, Complex.add_re, + Complex.sub_re, Complex.mul_re, Complex.ofReal_re, Complex.ofReal_im, zero_mul, sub_zero] + congr 1 + ext j + norm_num + ring + +def drift (r : ℝ) (f : NumberIndex n → ℝ) (k : NumberIndex n) : ℝ := + ∑ j, ((r+1)*(k j:ℝ)*(f (down j k)-f k)+r*((k j:ℝ)+1)*(f (up j k)-f k)) + +theorem mode_pairing_hasSum (f : NumberIndex n → ℝ) (C : ℝ) (hC : 0 ≤ C) + (hf : ∀ k, |f k/numberWeight k^4| ≤ C) (x : Fock n) (j : Fin n) (u : Bool) : + let Z := diagonal (fun k => f k/numberWeight k^4) C hC hf + HasSum (fun k => ((k j:ℝ)+(if u then 1 else 0))*f k/numberWeight k^6*‖x k‖^2) + (((inner ℂ (inverseWeight 1 x) (Z (modeBound j u x))).re+ + (inner ℂ (modeBound j u x) (Z (inverseWeight 1 x))).re)/2) := by + have h₁ := diagonal_mode_left f C hC hf j u x + have h₂ := diagonal_mode_right f C hC hf j u x + have hh := (h₁.add h₂).div_const 2 + convert! hh using 1 + ext k + ring + +def componentPairing (r : ℝ) (x : Fock n) (Z : Fock n →L[ℂ] Fock n) (j : Fin n) : ℝ := + (r+1)*((inner ℂ (gain j false x) (Z (gain j false x))).re- + ((inner ℂ (inverseWeight 1 x) (Z (modeBound j false x))).re+ + (inner ℂ (modeBound j false x) (Z (inverseWeight 1 x))).re)/2)+ + r*((inner ℂ (gain j true x) (Z (gain j true x))).re- + ((inner ℂ (inverseWeight 1 x) (Z (modeBound j true x))).re+ + (inner ℂ (modeBound j true x) (Z (inverseWeight 1 x))).re)/2) + +theorem component_pairing_hasSum (r : ℝ) (f : NumberIndex n → ℝ) (C : ℝ) (hC : 0 ≤ C) + (hf : ∀ k, |f k/numberWeight k^4| ≤ C) (x : Fock n) (j : Fin n) : + HasSum + (fun k => ((r+1)*(k j:ℝ)*(f (down j k)-f k)+r*((k j:ℝ)+1)*(f (up j k)-f k))/numberWeight k^6*‖x k‖^2) + (componentPairing r x (diagonal (fun k => f k/numberWeight k^4) C hC hf) j) := by + have h₁ := (gain_lower_diagonal f C hC hf j x).sub (mode_pairing_hasSum f C hC hf x j false) + have h₂ := (gain_raise_diagonal f C hC hf j x).sub (mode_pairing_hasSum f C hC hf x j true) + have hh := (h₁.mul_left (r+1)).add (h₂.mul_left r) + convert! hh using 1 + ext k + simp only [Bool.false_eq_true, ↓reduceIte] + ring + +theorem drift_column (r : ℝ) (f : NumberIndex n → ℝ) (C : ℝ) (hC : 0 ≤ C) + (hf : ∀ k, |f k/numberWeight k^4| ≤ C) (x : Fock n) : + HasSum (fun k => drift r f k/numberWeight k^6*‖x k‖^2) + (columnPairing r x (diagonal (fun k => f k/numberWeight k^4) C hC hf)) := by + have hh := hasSum_sum fun j (_hj : j ∈ (Finset.univ : Finset (Fin n))) => + component_pairing_hasSum r f C hC hf x j + convert! hh using 1 + · ext k + simp only [drift, Finset.sum_div, Finset.sum_mul] +end WeightedGenerator + +namespace WeightedShift +variable {I K : Type*} +theorem family_coordinates_summable (x : I → H K) (hx : Summable (fun i => ‖x i‖^2)) : + Summable (fun ik : I × K => ‖x ik.1 ik.2‖^2) := by + exact (summable_prod_of_nonneg (fun _ => sq_nonneg _)).mpr + ⟨fun i => (hasSum_square (x i)).summable, + by simpa only [(hasSum_square _).tsum_eq] using hx⟩ +end WeightedShift + +namespace EntropyPhotonNumber +open QuantumTrace WeightedShift Annihilation +variable {n : ℕ} + +theorem weightedRoot_row (m : ℕ) (ρ : State n) (hm : FiniteMoment (2*m) ρ) + (k : NumberIndex n) : + HasSum (fun i => ‖weightedRoot m ρ hm i k‖^2) + (numberWeight k^(2*m)*(entry ρ.op k k).re) := by + have hh := (TraceEnsemble.hasSum_quadratic (rootColumn_norm ρ).summable (numberKet k)).mul_left (numberWeight k^(2*m)) + rw [rootColumn_operator] at hh + convert! hh using 1 + ext i + simp only [weightedRoot_apply, numberKet, lp.inner_single_left, RCLike.inner_apply, + map_one, mul_one, norm_mul, mul_pow, Complex.norm_real, Real.norm_eq_abs, sq_abs, + ← pow_mul, mul_comm m 2] + +theorem thermalGenerator_drift (r : ℝ) (ρ : State n) (hm : FiniteMoment 6 ρ) + (f : NumberIndex n → ℝ) (C D : ℝ) (hC : 0 ≤ C) + (hf : ∀ k, |f k/numberWeight k^4| ≤ C) + (hd : ∀ k, |WeightedGenerator.drift r f k/numberWeight k^6| ≤ D) : + HasSum (fun k => WeightedGenerator.drift r f k*(entry ρ.op k k).re) + (WeightedGenerator.pairing r (weightedRoot 3 ρ hm) + (diagonal (fun k => f k/numberWeight k^4) C hC hf)).re := by + let x := weightedRoot 3 ρ hm + let a := fun (i k : NumberIndex n) => WeightedGenerator.drift r f k/numberWeight k^6*‖x i k‖^2 + have hx := weightedRoot_summable 3 ρ hm + have hp : Summable (Function.uncurry a) := by + apply ((family_coordinates_summable x hx).mul_left D).of_norm_bounded + intro ik + change ‖WeightedGenerator.drift r f ik.2/numberWeight ik.2^6*‖x ik.1 ik.2‖^2‖ ≤ D*‖x ik.1 ik.2‖^2 + rw [Real.norm_eq_abs, abs_mul, abs_of_nonneg (sq_nonneg ‖x ik.1 ik.2‖)] + exact mul_le_mul_of_nonneg_right (hd _) (sq_nonneg _) + have hc (i : NumberIndex n) := WeightedGenerator.drift_column r f C hC hf (x i) + have hr (k : NumberIndex n) : HasSum (fun i => a i k) + (WeightedGenerator.drift r f k*(entry ρ.op k k).re) := by + have he := (weightedRoot_row 3 ρ hm k).mul_left (WeightedGenerator.drift r f k/numberWeight k^6) + convert! he using 1 + have hne : numberWeight k ≠ 0 := by linarith [numberWeight_one_le k] + field_simp + have he : (∑' k, ∑' i, a i k)=(WeightedGenerator.pairing r x + (diagonal (fun k => f k/numberWeight k^4) C hC hf)).re := by + rw [hp.tsum_comm] + simp only [a, (hc _).tsum_eq] + exact (WeightedGenerator.columnPairing_hasSum r x hx _).tsum_eq + have hs := hp.prod_symm.prod.hasSum + change HasSum (fun k => ∑' i, a i k) (∑' k, ∑' i, a i k) at hs + rw [he] at hs + simpa only [(hr _).tsum_eq] using hs +end EntropyPhotonNumber + +open scoped ComplexConjugate +open scoped BigOperators ComplexConjugate +open scoped BigOperators ComplexConjugate ENNReal Topology +open MeasureTheory + +namespace QuantumTrace + +section +open Filter Topology + +def numberBox (n K : ℕ) : Finset (Fin n → ℕ) := + Fintype.piFinset (fun _ => Finset.range (K + 1)) + +theorem numberBox_compl_weight {n K : ℕ} {k : Fin n → ℕ} + (hk : k ∉ numberBox n K) : (K + 1 : ℝ) ≤ ∑ j, (k j : ℝ) := by + classical + simp only [numberBox, Fintype.mem_piFinset, Finset.mem_range, not_forall] at hk + obtain ⟨j, hj⟩ := hk + have hh : K + 1 ≤ k j := Nat.le_of_not_gt hj + have hs := Finset.single_le_sum (fun i (_ : i ∈ Finset.univ) => Nat.zero_le (k i)) + (Finset.mem_univ j) + exact_mod_cast hh.trans hs + +theorem number_tail_mass_le {n K : ℕ} (p : (Fin n → ℕ) → ℝ) + (hp : ∀ k, 0 ≤ p k) (hs : Summable p) + (hE : Summable (fun k => (∑ j, (k j : ℝ)) * p k)) : + (∑' k : {k // k ∉ numberBox n K}, p k) ≤ + (∑' k, (∑ j, (k j : ℝ)) * p k) / (K + 1) := by + rw [le_div_iff₀ (by positivity : (0 : ℝ) < K + 1)] + rw [← tsum_mul_right] + calc + _ ≤ ∑' k : {k // k ∉ numberBox n K}, (∑ j, ((k : Fin n → ℕ) j : ℝ)) * p k := by + apply ((hs.subtype _).mul_right _).tsum_le_tsum _ (hE.subtype _) + intro k + change p k * (K + 1) ≤ (∑ j, ((k : Fin n → ℕ) j : ℝ)) * p k + nlinarith [numberBox_compl_weight k.property, hp k] + _ ≤ _ := Summable.tsum_subtype_le _ _ (fun k => mul_nonneg + (Finset.sum_nonneg (fun _ _ => Nat.cast_nonneg _)) (hp k)) hE + +theorem entropy_tail_le_modulus {n : ℕ} (p : (Fin n → ℕ) → ℝ) + (hp : ∀ k, 0 ≤ p k) (hpu : ∀ k, p k ≤ 1) (hs : Summable p) + (hE : Summable (fun k => (∑ j, (k j : ℝ)) * p k)) + (s : Finset (Fin n → ℕ)) {E : ℝ} + (hEb : (∑' k, (∑ j, (k j : ℝ)) * p k) ≤ E) : + let q := ∑' k : {k // k ∉ s}, p k + (∑' k : {k // k ∉ s}, Real.negMulLog (p k)) ≤ + (n + 1 : ℝ) * Real.negMulLog q + n * q ^ 2 + E * q := by + classical + let a : (Fin n → ℕ) → ℝ := fun k => if k ∈ s then 0 else p k + have ha : ∀ k, 0 ≤ a k := fun k => by dsimp [a]; split_ifs <;> first | exact le_refl _ | exact hp k + have hau : ∀ k, a k ≤ 1 := fun k => by dsimp [a]; split_ifs <;> first | linarith | exact hpu k + have has : Summable a := hs.of_nonneg_of_le ha (fun k => by dsimp [a]; split_ifs <;> simp_all) + have hae : Summable (fun k => (∑ j, (k j : ℝ)) * a k) := by + apply hE.of_nonneg_of_le (fun k => mul_nonneg (Finset.sum_nonneg (fun _ _ => Nat.cast_nonneg _)) (ha k)) + intro k + dsimp [a]; split_ifs + · simp only [mul_zero] + exact mul_nonneg (Finset.sum_nonneg (fun _ _ => Nat.cast_nonneg _)) (hp k) + · exact le_refl _ + have haq : (∑' k, a k) = ∑' k : {k // k ∉ s}, p k := by + convert (tsum_subtype {k | k ∉ s} p).symm using 1 + · congr 1; ext k; simp [a, Set.indicator_apply] + · rfl + have haentropy : (∑' k, Real.negMulLog (a k)) = + ∑' k : {k // k ∉ s}, Real.negMulLog (p k) := by + convert (tsum_subtype {k | k ∉ s} (fun k => Real.negMulLog (p k))).symm using 1 + · congr 1; ext k; by_cases hk : k ∈ s <;> simp [a, hk] + · rfl + have hh := (entropy_small_mass_bound a ha hau has.hasSum hae).2 + rw [haq, haentropy] at hh + apply hh.trans + apply add_le_add_right + apply mul_le_mul_of_nonneg_right _ (tsum_nonneg (fun k : {k // k ∉ s} => hp k)) + apply le_trans _ hEb + apply hae.tsum_le_tsum _ hE + intro k + dsimp [a]; split_ifs + · simp only [mul_zero] + exact mul_nonneg (Finset.sum_nonneg (fun _ _ => Nat.cast_nonneg _)) (hp k) + · exact le_refl _ + +theorem entropy_uniform_tail {n : ℕ} {E ε : ℝ} (_hE0 : 0 ≤ E) (hε : 0 < ε) : + ∃ K : ℕ, ∀ (p : (Fin n → ℕ) → ℝ), (∀ k, 0 ≤ p k) → + (∀ k, p k ≤ 1) → Summable p → + Summable (fun k => (∑ j, (k j : ℝ)) * p k) → + (∑' k, (∑ j, (k j : ℝ)) * p k) ≤ E → + (∑' k : {k // k ∉ numberBox n K}, Real.negMulLog (p k)) < ε := by + let M : ℝ → ℝ := fun q => (n + 1 : ℝ) * Real.negMulLog q + n * q ^ 2 + E * q + have hm : ContinuousAt M 0 := by fun_prop + have hm0 : M 0 = 0 := by simp [M] + obtain ⟨δ, hδ, hd⟩ := Metric.continuousAt_iff.mp hm ε hε + obtain ⟨K, hK⟩ := exists_nat_gt (E / δ) + refine ⟨K, ?_⟩ + intro p hp hpu hs hEs hEb + let q := ∑' k : {k // k ∉ numberBox n K}, p k + have hq0 : 0 ≤ q := tsum_nonneg (fun k => hp k) + have hqle : q ≤ E / (K + 1) := + (number_tail_mass_le p hp hs hEs).trans (div_le_div_of_nonneg_right hEb (by positivity)) + have hqδ : q < δ := by + have hkδ : E < K * δ := (div_lt_iff₀ hδ).mp hK + apply hqle.trans_lt + rw [div_lt_iff₀ (by positivity : (0 : ℝ) < K + 1)] + nlinarith + have hh := hd (show dist q 0 < δ by simpa [Real.dist_eq, abs_of_nonneg hq0] using hqδ) + rw [hm0, dist_zero_right, Real.norm_eq_abs] at hh + exact (entropy_tail_le_modulus p hp hpu hs hEs _ hEb).trans_lt ((le_abs_self _).trans_lt hh) + +theorem tendsto_tsum_of_uniform_tail {α ι : Type*} {l : Filter α} + {f : α → ι → ℝ} {g : ι → ℝ} + (hf : ∀ a, Summable (f a)) (hg : Summable g) + (hfp : ∀ a i, 0 ≤ f a i) (hgp : ∀ i, 0 ≤ g i) + (hlim : ∀ i, Tendsto (fun a => f a i) l (𝓝 (g i))) + (htail : ∀ ε > 0, ∃ s : Finset ι, + (∀ a, (∑' i : {i // i ∉ s}, f a i) < ε) ∧ + (∑' i : {i // i ∉ s}, g i) < ε) : + Tendsto (fun a => ∑' i, f a i) l (𝓝 (∑' i, g i)) := by + classical + rw [Metric.tendsto_nhds] + intro ε hε + obtain ⟨s, hs, hsg⟩ := htail (ε / 3) (by positivity) + have hh := Metric.tendsto_nhds.mp (tendsto_finsetSum s (fun i _ => hlim i)) (ε / 3) (by positivity) + filter_upwards [hh] with a ha + rw [dist_eq_norm, ← (hf a).sum_add_tsum_compl (s := s), ← hg.sum_add_tsum_compl (s := s)] + have hsub : + (∑ i ∈ s, f a i) + (∑' i : {i // i ∉ s}, f a i) - + ((∑ i ∈ s, g i) + (∑' i : {i // i ∉ s}, g i)) = + ((∑ i ∈ s, f a i) - (∑ i ∈ s, g i)) + + ((∑' i : {i // i ∉ s}, f a i) - (∑' i : {i // i ∉ s}, g i)) := by ring + change ‖(∑ i ∈ s, f a i) + (∑' i : {i // i ∉ s}, f a i) - + ((∑ i ∈ s, g i) + (∑' i : {i // i ∉ s}, g i))‖ < ε + rw [hsub] + apply (norm_add_le _ _).trans_lt + have hnorm := norm_sub_le (∑' i : {i // i ∉ s}, f a i) (∑' i : {i // i ∉ s}, g i) + simp only [Real.norm_eq_abs] at hnorm + rw [abs_of_nonneg (tsum_nonneg (fun i : {i // i ∉ s} => hfp a i)), + abs_of_nonneg (tsum_nonneg (fun i : {i // i ∉ s} => hgp i))] at hnorm + simp only [Real.norm_eq_abs] + rw [dist_eq_norm, Real.norm_eq_abs] at ha + linarith [hs a] + +open Filter Topology +variable {H : Type*} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] +variable {ι : Type*} + +omit [CompleteSpace H] in +theorem diagonal_le_one (b : HilbertBasis ι ℂ H) {T : H →L[ℂ] H} + (hp : T.IsPositive) (ht : HasSum (fun i => (inner ℂ (b i) (T (b i))).re) 1) + (i : ι) : (inner ℂ (b i) (T (b i))).re ≤ 1 := by + simpa only [ht.tsum_eq] using ht.summable.le_tsum i (fun j _ => hp.re_inner_nonneg_right (b j)) + +theorem entropyOperator_tendsto {α : Type*} {l : Filter α} + {T : α → H →L[ℂ] H} {A : H →L[ℂ] H} + (hp : ∀ a, (T a).IsPositive) (hA : A.IsPositive) + (hn : ∀ a, ‖T a‖ ≤ 1) (hnA : ‖A‖ ≤ 1) + (ht : Tendsto T l (𝓝 A)) : + Tendsto (fun a => entropyOperator (T a)) l (𝓝 (entropyOperator A)) := by + rcases subsingleton_or_nontrivial H with hH | hH + · have : Subsingleton H := hH + have he : (fun a => entropyOperator (T a)) = fun _ => entropyOperator A := + funext (fun a => Subsingleton.elim _ _) + rw [he] + exact tendsto_const_nhds + have : Nontrivial H := hH + have hspec (B : H →L[ℂ] H) (hB : B.IsPositive) (hBn : ‖B‖ ≤ 1) : + spectrum ℝ B ⊆ Set.Icc 0 1 := by + intro x hx + exact ⟨spectrum_nonneg_of_nonneg (ContinuousLinearMap.nonneg_iff_isPositive.mpr hB) hx, + (Real.le_norm_self _).trans ((spectrum.norm_le_norm_of_mem hx).trans hBn)⟩ + exact Tendsto.cfc isCompact_Icc Real.negMulLog ht + (Eventually.of_forall (fun a => hspec _ (hp a) (hn a))) + (Eventually.of_forall (fun a => (hp a).isSymmetric.isSelfAdjoint)) + (hspec _ hA hnA) hA.isSymmetric.isSelfAdjoint Real.continuous_negMulLog.continuousOn + +theorem entropy_tendsto_finite_energy {α : Type*} {l : Filter α} {n : ℕ} + (b : HilbertBasis (Fin n → ℕ) ℂ H) {T : α → H →L[ℂ] H} {A : H →L[ℂ] H} + (hp : ∀ a, (T a).IsPositive) (hA : A.IsPositive) + (ht : ∀ a, HasSum (fun k => (inner ℂ (b k) (T a (b k))).re) 1) + (htA : HasSum (fun k => (inner ℂ (b k) (A (b k))).re) 1) + (hEs : ∀ a, Summable (fun k => (∑ j, (k j : ℝ)) * (inner ℂ (b k) (T a (b k))).re)) + (hEsA : Summable (fun k => (∑ j, (k j : ℝ)) * (inner ℂ (b k) (A (b k))).re)) + {E : ℝ} (hEb : ∀ a, (∑' k, (∑ j, (k j : ℝ)) * (inner ℂ (b k) (T a (b k))).re) ≤ E) + (hEbA : (∑' k, (∑ j, (k j : ℝ)) * (inner ℂ (b k) (A (b k))).re) ≤ E) + (hlim : Tendsto T l (𝓝 A)) : + Tendsto (fun a => ∑' k, (inner ℂ (b k) (entropyOperator (T a) (b k))).re) l + (𝓝 (∑' k, (inner ℂ (b k) (entropyOperator A (b k))).re)) := by + have hn (a : α) := norm_le_trace b (hp a) (ht a) + have hnA := norm_le_trace b hA htA + have hepos (a : α) := entropyOperator_positive (hp a) (hn a) + have heA := entropyOperator_positive hA hnA + apply tendsto_tsum_of_uniform_tail + (fun a => entropy_summable_finite_energy b (hp a) (ht a) (hEs a)) + (entropy_summable_finite_energy b hA htA hEsA) + (fun a k => (hepos a).re_inner_nonneg_right (b k)) + (fun k => heA.re_inner_nonneg_right (b k)) + · intro k + have hh := entropyOperator_tendsto hp hA hn hnA hlim + have heval : Continuous (fun B : H →L[ℂ] H => B (b k)) := + continuous_id.clm_apply continuous_const + have hx := heval.continuousAt.tendsto.comp hh + exact Complex.continuous_re.continuousAt.tendsto.comp (tendsto_const_nhds.inner hx) + · intro ε hε + have hE0 : 0 ≤ E := (tsum_nonneg (fun k => mul_nonneg + (Finset.sum_nonneg (fun _ _ => Nat.cast_nonneg _)) (hA.re_inner_nonneg_right (b k)))).trans hEbA + obtain ⟨K, hK⟩ := entropy_uniform_tail (n := n) hE0 hε + refine ⟨numberBox n K, ?_, ?_⟩ + · intro a + have hpd (k : Fin n → ℕ) := (hp a).re_inner_nonneg_right (b k) + have hpu (k : Fin n → ℕ) := diagonal_le_one b (hp a) (ht a) k + have hes := (entropy_small_mass_bound _ hpd hpu (ht a) (hEs a)).1 + apply lt_of_le_of_lt _ (hK _ hpd hpu (ht a).summable (hEs a) (hEb a)) + apply ((entropy_summable_finite_energy b (hp a) (ht a) (hEs a)).subtype _).tsum_le_tsum _ (hes.subtype _) + intro k + exact entropyOperator_quadratic_le b (hp a) (ht a) (b k) (b.orthonormal.norm_eq_one k) + · have hpd (k : Fin n → ℕ) := hA.re_inner_nonneg_right (b k) + have hpu (k : Fin n → ℕ) := diagonal_le_one b hA htA k + have hes := (entropy_small_mass_bound _ hpd hpu htA hEsA).1 + apply lt_of_le_of_lt _ (hK _ hpd hpu htA.summable hEsA hEbA) + apply ((entropy_summable_finite_energy b hA htA hEsA).subtype _).tsum_le_tsum _ (hes.subtype _) + intro k + exact entropyOperator_quadratic_le b hA htA (b k) (b.orthonormal.norm_eq_one k) + +end + +section +open ContinuousLinearMap InnerProductSpace Filter Topology +variable {H : Type*} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] +variable {ι : Type*} + +def basisProjection (b : HilbertBasis ι ℂ H) (s : Finset ι) : H →L[ℂ] H := + basisApprox b (ContinuousLinearMap.id ℂ H) s + +omit [CompleteSpace H] in +theorem basisProjection_apply_basis (b : HilbertBasis ι ℂ H) (s : Finset ι) (j : ι) + [Decidable (j ∈ s)] : basisProjection b s (b j) = if j ∈ s then b j else 0 := by + simpa [basisProjection] using basisApprox_apply_basis b (ContinuousLinearMap.id ℂ H) s j + +theorem basisProjection_adjoint (b : HilbertBasis ι ℂ H) (s : Finset ι) : + adjoint (basisProjection b s) = basisProjection b s := by + simp [basisProjection, basisApprox] + +omit [CompleteSpace H] in +theorem basisProjection_idempotent (b : HilbertBasis ι ℂ H) (s : Finset ι) : + basisProjection b s ∘L basisProjection b s = basisProjection b s := by + classical + apply ContinuousLinearMap.ext_on (Submodule.dense_iff_topologicalClosure_eq_top.mpr b.dense_span) + rintro _ ⟨j, rfl⟩ + simp only [comp_apply, basisProjection_apply_basis] + by_cases hj : j ∈ s <;> simp [hj, basisProjection_apply_basis] + +theorem basisProjection_norm_le (b : HilbertBasis ι ℂ H) (s : Finset ι) : + ‖basisProjection b s‖ ≤ 1 := by + apply IsStarProjection.norm_le + exact ⟨basisProjection_idempotent b s, basisProjection_adjoint b s⟩ + +omit [CompleteSpace H] in +theorem basisApprox_eq_comp (b : HilbertBasis ι ℂ H) (T : H →L[ℂ] H) (s : Finset ι) : + basisApprox b T s = T ∘L basisProjection b s := by + classical + apply ContinuousLinearMap.ext_on (Submodule.dense_iff_topologicalClosure_eq_top.mpr b.dense_span) + rintro _ ⟨j, rfl⟩ + simp only [basisApprox_apply_basis, comp_apply, basisProjection_apply_basis] + split_ifs <;> simp + +theorem double_compression_norm_le (b : HilbertBasis ι ℂ H) {T : H →L[ℂ] H} + (hp : T.IsPositive) (ht : HasSum (fun i => (inner ℂ (b i) (T (b i))).re) 1) + (s : Finset ι) : + ‖T - basisProjection b s ∘L T ∘L basisProjection b s‖ ≤ + 2 * Real.sqrt (1 - ∑ i ∈ s, (inner ℂ (b i) (T (b i))).re) := by + let P := basisProjection b s + let S := CFC.sqrt T + have hS : S ∘L S = T := by + simpa only [S, pow_two, ContinuousLinearMap.mul_def] using + CFC.sq_sqrt T (ContinuousLinearMap.nonneg_iff_isPositive.mpr hp) + have hSn : ‖S‖ ≤ 1 := by + dsimp [S] + rw [CFC.norm_sqrt T (ContinuousLinearMap.nonneg_iff_isPositive.mpr hp)] + exact (Real.sqrt_le_sqrt (norm_le_trace b hp ht)).trans_eq Real.sqrt_one + have hsp : ‖S - S ∘L P‖ ≤ + Real.sqrt (1 - ∑ i ∈ s, (inner ℂ (b i) (T (b i))).re) := by + have hs : HasSum (fun i => ‖S (b i)‖ ^ 2) 1 := by + simpa only [sqrt_inner_eq hp] using ht + simpa only [basisApprox_eq_comp, S, P, ← sqrt_inner_eq hp] using basisApprox_norm_sub_le b S hs s + have hright : ‖T - T ∘L P‖ ≤ + Real.sqrt (1 - ∑ i ∈ s, (inner ℂ (b i) (T (b i))).re) := by + have he : T - T ∘L P = S ∘L (S - S ∘L P) := by + rw [comp_sub, ← comp_assoc, hS] + rw [he] + exact (opNorm_comp_le _ _).trans ((mul_le_mul_of_nonneg_right hSn (norm_nonneg _)).trans + (by simpa using hsp)) + have hleft : ‖T - P ∘L T‖ = ‖T - T ∘L P‖ := by + rw [← (adjoint : (H →L[ℂ] H) ≃ₗᵢ⋆[ℂ] (H →L[ℂ] H)).norm_map (T - P ∘L T)] + simp [adjoint_comp, hp.isSymmetric.isSelfAdjoint.adjoint_eq, P, basisProjection_adjoint] + have he : T - P ∘L T ∘L P = (T - P ∘L T) + P ∘L (T - T ∘L P) := by + rw [comp_sub] + abel + rw [he] + calc + _ ≤ ‖T - P ∘L T‖ + ‖P ∘L (T - T ∘L P)‖ := norm_add_le _ _ + _ ≤ ‖T - T ∘L P‖ + ‖P‖ * ‖T - T ∘L P‖ := by + rw [hleft]; exact add_le_add_right (opNorm_comp_le _ _) _ + _ ≤ 2 * ‖T - T ∘L P‖ := by + have hn := mul_le_mul_of_nonneg_right (basisProjection_norm_le b s) (norm_nonneg (T - T ∘L P)) + dsimp [P] at * + linarith + _ ≤ _ := mul_le_mul_of_nonneg_left hright (by norm_num) + +end + +section +open Filter Topology + +theorem tsum_bound_of_tendsto {α ι : Type*} {l : Filter α} [NeBot l] + {f : α → ι → ℝ} {g : ι → ℝ} {C : ℝ} + (hfp : ∀ a i, 0 ≤ f a i) (hfs : ∀ a, Summable (f a)) + (hfb : ∀ a, (∑' i, f a i) ≤ C) + (hlim : ∀ i, Tendsto (fun a => f a i) l (𝓝 (g i))) : + Summable g ∧ (∑' i, g i) ≤ C := by + have hg : ∀ i, 0 ≤ g i := fun i => ge_of_tendsto (hlim i) (Eventually.of_forall (fun a => hfp a i)) + have hs : ∀ s : Finset ι, (∑ i ∈ s, g i) ≤ C := by + intro s + apply le_of_tendsto (tendsto_finsetSum s (fun i _ => hlim i)) + exact Eventually.of_forall (fun a => ((hfs a).sum_le_tsum s (fun i _ => hfp a i)).trans (hfb a)) + exact ⟨summable_of_sum_le hg hs, Real.tsum_le_of_sum_le hg hs⟩ + +variable {H : Type*} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + +def energySet {n : ℕ} (b : HilbertBasis (Fin n → ℕ) ℂ H) (E : ℝ) : Set (H →L[ℂ] H) := + {T | T.IsPositive ∧ + HasSum (fun k => (inner ℂ (b k) (T (b k))).re) 1 ∧ + Summable (fun k => (∑ j, (k j : ℝ)) * (inner ℂ (b k) (T (b k))).re) ∧ + (∑' k, (∑ j, (k j : ℝ)) * (inner ℂ (b k) (T (b k))).re) ≤ E} + +theorem energySet_limit {α : Type*} {l : Filter α} [NeBot l] {n : ℕ} + (b : HilbertBasis (Fin n → ℕ) ℂ H) {E : ℝ} + {T : α → H →L[ℂ] H} {A : H →L[ℂ] H} + (hT : ∀ a, T a ∈ energySet b E) (hlim : Tendsto T l (𝓝 A)) : A ∈ energySet b E := by + have hA : A.IsPositive := by + apply ContinuousLinearMap.nonneg_iff_isPositive.mp + exact isClosed_Ici.mem_of_tendsto hlim (Eventually.of_forall (fun a => + ContinuousLinearMap.nonneg_iff_isPositive.mpr (hT a).1)) + have hdiag (k : Fin n → ℕ) : + Tendsto (fun a => (inner ℂ (b k) (T a (b k))).re) l + (𝓝 (inner ℂ (b k) (A (b k))).re) := by + have heval : Continuous (fun B : H →L[ℂ] H => B (b k)) := + continuous_id.clm_apply continuous_const + exact Complex.continuous_re.continuousAt.tendsto.comp + (tendsto_const_nhds.inner (heval.continuousAt.tendsto.comp hlim)) + have hds := tsum_bound_of_tendsto + (fun a k => (hT a).1.re_inner_nonneg_right (b k)) + (fun a => (hT a).2.1.summable) (fun a => (hT a).2.1.tsum_eq.le) hdiag + have hes := tsum_bound_of_tendsto + (fun a k => mul_nonneg (Finset.sum_nonneg (fun _ _ => Nat.cast_nonneg _)) + ((hT a).1.re_inner_nonneg_right (b k))) + (fun a => (hT a).2.2.1) (fun a => (hT a).2.2.2) + (fun k => tendsto_const_nhds.mul (hdiag k)) + have hsum : Tendsto (fun a => ∑' k, (inner ℂ (b k) (T a (b k))).re) l + (𝓝 (∑' k, (inner ℂ (b k) (A (b k))).re)) := by + apply tendsto_tsum_of_uniform_tail + (fun a => (hT a).2.1.summable) hds.1 + (fun a k => (hT a).1.re_inner_nonneg_right (b k)) + (fun k => hA.re_inner_nonneg_right (b k)) hdiag + intro ε hε + obtain ⟨K, hK⟩ := exists_nat_gt (E / ε) + have hb : E / (K + 1) < ε := by + rw [div_lt_iff₀ (by positivity : (0 : ℝ) < K + 1)] + have hh := (div_lt_iff₀ hε).mp hK + nlinarith + refine ⟨numberBox n K, ?_, ?_⟩ + · intro a + apply lt_of_le_of_lt _ hb + exact (number_tail_mass_le _ (fun k => (hT a).1.re_inner_nonneg_right (b k)) + (hT a).2.1.summable (hT a).2.2.1).trans + (div_le_div_of_nonneg_right (hT a).2.2.2 (by positivity)) + · apply lt_of_le_of_lt _ hb + exact (number_tail_mass_le _ (fun k => hA.re_inner_nonneg_right (b k)) + hds.1 hes.1).trans (div_le_div_of_nonneg_right hes.2 (by positivity)) + have heq : (∑' k, (inner ℂ (b k) (A (b k))).re) = 1 := by + apply tendsto_nhds_unique hsum + convert! (tendsto_const_nhds : Tendsto (fun _ : α => (1 : ℝ)) l (𝓝 1)) using 1 + funext a + exact (hT a).2.1.tsum_eq + exact ⟨hA, heq ▸ hds.1.hasSum, hes⟩ + +end + +section +open ContinuousLinearMap InnerProductSpace Filter Topology +variable {H : Type*} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] +variable {ι : Type*} + +def matrixEmbed (b : HilbertBasis ι ℂ H) (s : Finset ι) (c : s → s → ℂ) : H →L[ℂ] H := + ∑ i, ∑ j, c i j • rankOne ℂ (b i) (b j) + +omit [CompleteSpace H] in +theorem matrixEmbed_continuous (b : HilbertBasis ι ℂ H) (s : Finset ι) : + Continuous (matrixEmbed b s) := by + unfold matrixEmbed + fun_prop + +omit [CompleteSpace H] in +theorem matrixEmbed_entries (b : HilbertBasis ι ℂ H) (s : Finset ι) (T : H →L[ℂ] H) : + matrixEmbed b s (fun i j => inner ℂ (b i) (T (b j))) = + basisProjection b s ∘L T ∘L basisProjection b s := by + classical + apply ContinuousLinearMap.ext_on (Submodule.dense_iff_topologicalClosure_eq_top.mpr b.dense_span) + rintro _ ⟨k, rfl⟩ + simp only [comp_apply, basisProjection_apply_basis] + by_cases hk : k ∈ s + · simp only [ite_eq_left hk, matrixEmbed, sum_apply, smul_apply, rankOne_apply, + orthonormal_iff_ite.mp b.orthonormal] + simp only [smul_ite, smul_zero, one_smul, ite_smul, zero_smul] + have hj (j : s) : ((j : ι) = k) = (j = ⟨k, hk⟩) := by + apply propext + exact ⟨fun h => Subtype.ext h, fun h => congrArg Subtype.val h⟩ + simp_rw [hj] + simp only [Finset.sum_ite_eq', Finset.mem_univ, ite_true] + calc + _ = ∑ i ∈ s, inner ℂ (b i) (T (b k)) • b i := + Finset.sum_coe_sort s (fun i : ι => inner ℂ (b i) (T (b k)) • b i) + _ = _ := by simp [basisProjection, basisApprox, sum_apply, rankOne_apply] + · simp only [ite_eq_right hk, map_zero, matrixEmbed, sum_apply, smul_apply, rankOne_apply, + orthonormal_iff_ite.mp b.orthonormal] + apply Finset.sum_eq_zero + intro i _ + apply Finset.sum_eq_zero + intro j _ + have hj : (j : ι) ≠ k := fun hh => hk (hh ▸ j.property) + simp [hj] + +omit [CompleteSpace H] in +theorem entry_norm_le_one (b : HilbertBasis ι ℂ H) {T : H →L[ℂ] H} (hT : ‖T‖ ≤ 1) + (i j : ι) : ‖inner ℂ (b i) (T (b j))‖ ≤ 1 := by + calc + _ ≤ ‖b i‖ * ‖T (b j)‖ := norm_inner_le_norm _ _ + _ = ‖T (b j)‖ := by rw [b.orthonormal.norm_eq_one, one_mul] + _ ≤ ‖T‖ * ‖b j‖ := T.le_opNorm _ + _ ≤ 1 := by simpa only [b.orthonormal.norm_eq_one, mul_one] using hT + +omit [CompleteSpace H] in + +theorem double_compressions_compact (b : HilbertBasis ι ℂ H) (s : Finset ι) : + ∃ C : Set (H →L[ℂ] H), IsCompact C ∧ + ∀ T : H →L[ℂ] H, ‖T‖ ≤ 1 → basisProjection b s ∘L T ∘L basisProjection b s ∈ C := by + let C := matrixEmbed b s '' Metric.closedBall (0 : s → s → ℂ) 1 + refine ⟨C, (isCompact_closedBall _ _).image (matrixEmbed_continuous b s), ?_⟩ + intro T hT + refine ⟨(fun i j => inner ℂ (b i) (T (b j))), ?_, matrixEmbed_entries b s T⟩ + rw [Metric.mem_closedBall, dist_zero_right] + apply (pi_norm_le_iff_of_nonneg (by norm_num : (0 : ℝ) ≤ 1)).mpr + intro i + apply (pi_norm_le_iff_of_nonneg (by norm_num : (0 : ℝ) ≤ 1)).mpr + intro j + exact entry_norm_le_one b hT i j + +theorem energySet_isClosed {n : ℕ} (b : HilbertBasis (Fin n → ℕ) ℂ H) (E : ℝ) : + IsClosed (energySet b E) := by + apply IsSeqClosed.isClosed + intro T A hT hlim + exact energySet_limit b hT hlim + +end + +section +open ContinuousLinearMap Filter Topology +variable {H : Type*} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + +theorem energySet_totallyBounded {n : ℕ} (b : HilbertBasis (Fin n → ℕ) ℂ H) (E : ℝ) : + TotallyBounded (energySet b E) := by + classical + rw [Metric.totallyBounded_iff] + intro ε hε + obtain ⟨K, hK⟩ := exists_nat_gt (E / (ε / 4) ^ 2) + have hcut : E / (K + 1) < (ε / 4) ^ 2 := by + rw [div_lt_iff₀ (by positivity : (0 : ℝ) < K + 1)] + have hh := (div_lt_iff₀ (by positivity : (0 : ℝ) < (ε / 4) ^ 2)).mp hK + nlinarith + let s := numberBox n K + let P := basisProjection b s + obtain ⟨C, hC, hPC⟩ := double_compressions_compact b s + obtain ⟨t, htfin, hcover⟩ := Metric.totallyBounded_iff.mp hC.totallyBounded (ε / 2) (by positivity) + refine ⟨t, htfin, ?_⟩ + intro T hT + have hp := hT.1 + have htr := hT.2.1 + have hmass : (1 - ∑ k ∈ s, (inner ℂ (b k) (T (b k))).re) = + ∑' k : {k // k ∉ s}, (inner ℂ (b k) (T (b k))).re := by + have hh := htr.summable.sum_add_tsum_compl (s := s) + rw [htr.tsum_eq] at hh + change (∑ k ∈ s, (inner ℂ (b k) (T (b k))).re) + + (∑' k : {k // k ∉ s}, (inner ℂ (b k) (T (b k))).re) = 1 at hh + linarith + have hq0 : 0 ≤ 1 - ∑ k ∈ s, (inner ℂ (b k) (T (b k))).re := by + rw [hmass] + exact tsum_nonneg (fun k => hp.re_inner_nonneg_right (b k)) + have hqb : 1 - ∑ k ∈ s, (inner ℂ (b k) (T (b k))).re < (ε / 4) ^ 2 := by + rw [hmass] + apply lt_of_le_of_lt _ hcut + exact (number_tail_mass_le _ (fun k => hp.re_inner_nonneg_right (b k)) htr.summable hT.2.2.1).trans + (div_le_div_of_nonneg_right hT.2.2.2 (by positivity)) + have happ : dist T (P ∘L T ∘L P) < ε / 2 := by + rw [dist_eq_norm] + apply (double_compression_norm_le b hp htr s).trans_lt + have hs := Real.sq_sqrt hq0 + have hn := Real.sqrt_nonneg (1 - ∑ k ∈ s, (inner ℂ (b k) (T (b k))).re) + nlinarith + have hc : P ∘L T ∘L P ∈ C := hPC T (norm_le_trace b hp htr) + obtain ⟨y, hy, hdist⟩ : ∃ y ∈ t, dist (P ∘L T ∘L P) y < ε / 2 := by + rcases Set.mem_iUnion.mp (hcover hc) with ⟨y, hy⟩ + rcases Set.mem_iUnion.mp hy with ⟨hyt, hy⟩ + exact ⟨y, hyt, hy⟩ + simp only [Set.mem_iUnion, Metric.mem_ball] + refine ⟨y, hy, ?_⟩ + exact (dist_triangle T (P ∘L T ∘L P) y).trans_lt (by linarith) + +theorem energySet_isCompact {n : ℕ} (b : HilbertBasis (Fin n → ℕ) ℂ H) (E : ℝ) : + IsCompact (energySet b E) := + (energySet_totallyBounded b E).isCompact_of_isClosed (energySet_isClosed b E) + +end + +open Filter Topology +variable {H : Type*} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + +def momentSet {n : ℕ} (b : HilbertBasis (Fin n → ℕ) ℂ H) + (w : (Fin n → ℕ) → ℝ) (E M : ℝ) : Set (H →L[ℂ] H) := + {T | T ∈ energySet b E ∧ + Summable (fun k => w k * (inner ℂ (b k) (T (b k))).re) ∧ + (∑' k, w k * (inner ℂ (b k) (T (b k))).re) ≤ M} + +theorem momentSet_limit {α : Type*} {l : Filter α} [NeBot l] {n : ℕ} + (b : HilbertBasis (Fin n → ℕ) ℂ H) {w : (Fin n → ℕ) → ℝ} + (hw : ∀ k, 0 ≤ w k) {E M : ℝ} + {T : α → H →L[ℂ] H} {A : H →L[ℂ] H} + (hT : ∀ a, T a ∈ momentSet b w E M) (hlim : Tendsto T l (𝓝 A)) : + A ∈ momentSet b w E M := by + refine ⟨energySet_limit b (fun a => (hT a).1) hlim, ?_⟩ + apply tsum_bound_of_tendsto (l := l) + (fun a k => mul_nonneg (hw k) ((hT a).1.1.re_inner_nonneg_right (b k))) + (fun a => (hT a).2.1) (fun a => (hT a).2.2) + intro k + have heval : Continuous (fun B : H →L[ℂ] H => B (b k)) := + continuous_id.clm_apply continuous_const + exact tendsto_const_nhds.mul (Complex.continuous_re.continuousAt.tendsto.comp + (tendsto_const_nhds.inner (heval.continuousAt.tendsto.comp hlim))) + +theorem momentSet_isCompact {n : ℕ} (b : HilbertBasis (Fin n → ℕ) ℂ H) + (w : (Fin n → ℕ) → ℝ) (hw : ∀ k, 0 ≤ w k) (E M : ℝ) : + IsCompact (momentSet b w E M) := by + have hc : IsClosed (momentSet b w E M) := by + apply IsSeqClosed.isClosed + intro T A hT hlim + exact momentSet_limit b hw hT hlim + exact (energySet_isCompact b E).of_isClosed_subset hc (fun _ h => h.1) + +theorem lowerSemicontinuous_tsum_nonneg {A I : Type*} [TopologicalSpace A] + (f : A → I → ℝ) (hp : ∀ a i, 0 ≤ f a i) (hs : ∀ a, Summable (f a)) + (hc : ∀ i, Continuous (fun a => f a i)) : + LowerSemicontinuous (fun a => ∑' i, f a i) := by + intro a y hy + obtain ⟨F, hF⟩ := ((hs a).hasSum.eventually (eventually_gt_nhds hy)).exists + have ch : Continuous (fun x => ∑ i ∈ F, f x i) := + continuous_finsetSum F (fun i _ => hc i) + filter_upwards [ch.continuousAt.eventually (eventually_gt_nhds hF)] with x hx + exact hx.trans_le ((hs x).sum_le_tsum F (fun i _ => hp x i)) + +omit [CompleteSpace H] in +theorem moment_lowerSemicontinuous {n : ℕ} (b : HilbertBasis (Fin n → ℕ) ℂ H) + (w : (Fin n → ℕ) → ℝ) (hw : ∀ k, 0 ≤ w k) (E M : ℝ) : + LowerSemicontinuous (fun T : momentSet b w E M => + ∑' k, w k * (inner ℂ (b k) (T.val (b k))).re) := by + apply lowerSemicontinuous_tsum_nonneg + · exact fun T k => mul_nonneg (hw k) (T.property.1.1.re_inner_nonneg_right _) + · exact fun T => T.property.2.1 + · intro k + exact continuous_const.mul (Complex.continuous_re.comp + (continuous_const.inner (continuous_subtype_val.clm_apply continuous_const))) + +omit [CompleteSpace H] in +theorem energy_lowerSemicontinuous {n : ℕ} (b : HilbertBasis (Fin n → ℕ) ℂ H) (E : ℝ) : + LowerSemicontinuous (fun T : energySet b E => + ∑' k, (∑ j, (k j : ℝ)) * (inner ℂ (b k) (T.val (b k))).re) := by + apply lowerSemicontinuous_tsum_nonneg + · exact fun T k => mul_nonneg (Finset.sum_nonneg (fun _ _ => Nat.cast_nonneg _)) + (T.property.1.re_inner_nonneg_right _) + · exact fun T => T.property.2.2.1 + · intro k + exact continuous_const.mul (Complex.continuous_re.comp + (continuous_const.inner (continuous_subtype_val.clm_apply continuous_const))) + +theorem entropy_continuous_energySet {n : ℕ} (b : HilbertBasis (Fin n → ℕ) ℂ H) (E : ℝ) : + Continuous (fun T : energySet b E => + ∑' k, (inner ℂ (b k) (entropyOperator T.val (b k))).re) := by + rw [continuous_iff_continuousAt] + intro A + apply entropy_tendsto_finite_energy b + (fun T => T.property.1) A.property.1 + (fun T => T.property.2.1) A.property.2.1 + (fun T => T.property.2.2.1) A.property.2.2.1 + (fun T => T.property.2.2.2) A.property.2.2.2 + exact continuous_subtype_val.continuousAt + +end QuantumTrace + +end + +namespace EntropyPhotonNumber +open scoped ComplexConjugate +open scoped BigOperators ComplexConjugate +open scoped BigOperators ComplexConjugate ENNReal Topology +open MeasureTheory +open scoped BigOperators +open MvPolynomial +open scoped BigOperators ComplexConjugate Classical +open Submodule + +def energy {n : ℕ} (ρ : State n) : ℝ := + ∑' k, (totalNumber k : ℝ) * (entry ρ.op k k).re + +theorem energy_nonneg {n : ℕ} (ρ : State n) : 0 ≤ energy ρ := by + exact tsum_nonneg (fun k => mul_nonneg (Nat.cast_nonneg _) + (ρ.positive.re_inner_nonneg_right _)) + +theorem entropy_eq_quantumTrace {n : ℕ} (ρ : State n) : + entropy ρ = ∑' k, (inner ℂ (numberBasis n k) + (QuantumTrace.entropyOperator ρ.op (numberBasis n k))).re := by + rw [QuantumTrace.entropyOperator_eq_complex ρ.positive.isSymmetric] + simp only [entropy, entry, numberBasis_apply] + +theorem entropy_summable {n : ℕ} (ρ : State n) (hρ : FiniteEnergy ρ) : + Summable (fun k => (entry (cfc (fun z : ℂ => (-(z.re * Real.log z.re) : ℂ)) ρ.op) k k).re) := by + have hE : Summable (fun k => (∑ j, (k j : ℝ)) * (inner ℂ (numberBasis n k) (ρ.op (numberBasis n k))).re) := by + simpa only [FiniteEnergy, totalNumber, Nat.cast_sum, numberBasis_apply, entry] using hρ + have hh := QuantumTrace.entropy_summable_finite_energy (numberBasis n) ρ.positive (trace_one_numberBasis ρ) hE + simpa only [QuantumTrace.entropyOperator_eq_complex ρ.positive.isSymmetric, numberBasis_apply, entry] using hh + +theorem entropy_nonneg {n : ℕ} (ρ : State n) : 0 ≤ entropy ρ := by + rw [entropy_eq_quantumTrace] + exact QuantumTrace.entropy_nonneg (numberBasis n) ρ.positive (trace_one_numberBasis ρ) + +theorem entropy_energy_bound {n : ℕ} (hn : 1 ≤ n) (ρ : State n) (hρ : FiniteEnergy ρ) : + 0 ≤ entropy ρ ∧ entropy ρ ≤ n * g (energy ρ / n) := by + refine ⟨entropy_nonneg ρ, ?_⟩ + rw [entropy_eq_quantumTrace] + have hE : Summable (fun k => (∑ j, (k j : ℝ)) * (inner ℂ (numberBasis n k) (ρ.op (numberBasis n k))).re) := by + simpa only [FiniteEnergy, totalNumber, Nat.cast_sum, numberBasis_apply, entry] using hρ + simpa only [g, energy, totalNumber, Nat.cast_sum, entry, numberBasis_apply] using + QuantumTrace.entropy_energy_bound hn (numberBasis n) ρ.positive (trace_one_numberBasis ρ) hE + +end EntropyPhotonNumber + +open scoped ComplexConjugate +open scoped BigOperators ComplexConjugate +open scoped BigOperators ComplexConjugate ENNReal Topology +open MeasureTheory +open scoped BigOperators +open MvPolynomial +open scoped BigOperators ComplexConjugate Classical +open Submodule +open scoped ENNReal + +namespace TraceEnsemble +open Filter Topology +open scoped BigOperators +variable {I A E G : Type*} +variable [NormedAddCommGroup G] [CompleteSpace G] + +theorem norm_tail_le {f : I → G} {s : ℝ} (hf : HasSum (fun i => ‖f i‖) s) + (F : Finset I) : ‖(∑' i, f i) - ∑ i ∈ F, f i‖ ≤ s - ∑ i ∈ F, ‖f i‖ := by + classical + have h₁ := hf.summable.of_norm.sum_add_tsum_compl (s := F) + have h₂ := hf.summable.sum_add_tsum_compl (s := F) + rw [hf.tsum_eq] at h₂ + have e₁ : (∑' i, f i) - ∑ i ∈ F, f i = ∑' i : ↥((↑F : Set I)ᶜ), f i := by + rw [← h₁]; abel + have e₂ : s - ∑ i ∈ F, ‖f i‖ = ∑' i : ↥((↑F : Set I)ᶜ), ‖f i‖ := by + rw [← h₂]; ring + rw [e₁,e₂] + exact norm_tsum_le_tsum_norm (hf.summable.subtype _) + +theorem tendsto_tsum_fixed_norm {l : Filter A} {f : A → I → G} {g : I → G} {s : ℝ} + (hf : ∀ a, HasSum (fun i => ‖f a i‖) s) (hg : HasSum (fun i => ‖g i‖) s) + (hfg : ∀ i, Tendsto (fun a => f a i) l (𝓝 (g i))) : + Tendsto (fun a => ∑' i, f a i) l (𝓝 (∑' i, g i)) := by + classical + rw [Metric.tendsto_nhds] + intro ε hε + obtain ⟨F, hF⟩ : ∃ F : Finset I, dist (∑ i ∈ F, ‖g i‖) s < ε/4 := + ((Metric.tendsto_nhds.mp hg) (ε/4) (by positivity)).exists + have hsF : s - ∑ i ∈ F, ‖g i‖ < ε/4 := by + exact (le_abs_self _).trans_lt (by simpa [Real.dist_eq, abs_sub_comm] using hF) + have hhead := tendsto_finsetSum F (fun i _ => hfg i) + have hmass := tendsto_finsetSum F (fun i _ => (hfg i).norm) + filter_upwards [(Metric.tendsto_nhds.mp hhead) (ε/4) (by positivity), + (Metric.tendsto_nhds.mp hmass) (ε/4) (by positivity)] with a ha hm + have hmass' : (∑ i ∈ F, ‖g i‖) - ∑ i ∈ F, ‖f a i‖ < ε/4 := + (le_abs_self _).trans_lt (by simpa [Real.dist_eq, abs_sub_comm] using hm) + rw [dist_eq_norm] + calc + _ ≤ ‖(∑' i, f a i) - ∑ i ∈ F, f a i‖ + + ‖(∑ i ∈ F, f a i) - ∑ i ∈ F, g i‖ + + ‖(∑' i, g i) - ∑ i ∈ F, g i‖ := by + simpa [norm_sub_rev, add_assoc] using + (norm_sub_le_norm_sub_add_norm_sub (∑' i, f a i) + (∑ i ∈ F, f a i) (∑' i, g i)).trans + (add_le_add le_rfl (norm_sub_le_norm_sub_add_norm_sub + (∑ i ∈ F, f a i) (∑ i ∈ F, g i) (∑' i, g i))) + _ ≤ (s - ∑ i ∈ F, ‖f a i‖) + ‖(∑ i ∈ F, f a i) - ∑ i ∈ F, g i‖ + + (s - ∑ i ∈ F, ‖g i‖) := + add_le_add (add_le_add (norm_tail_le (hf a) F) le_rfl) (norm_tail_le hg F) + _ < ε := by rw [dist_eq_norm] at ha; linarith + +variable [NormedAddCommGroup E] [InnerProductSpace ℂ E] [CompleteSpace E] + +theorem tendsto_operator {l : Filter A} {v : A → I → E} {w : I → E} {s : ℝ} + (hv : ∀ a, HasSum (fun i => ‖v a i‖^2) s) (hw : HasSum (fun i => ‖w i‖^2) s) + (hvw : ∀ i, Tendsto (fun a => v a i) l (𝓝 (w i))) : + Tendsto (fun a => operator (v a)) l (𝓝 (operator w)) := by + apply tendsto_tsum_fixed_norm (s := s) + · intro a + simpa only [InnerProductSpace.norm_rankOne, pow_two] using hv a + · simpa only [InnerProductSpace.norm_rankOne, pow_two] using hw + · intro i + have hc : Continuous (fun x : E => InnerProductSpace.rankOne ℂ x x) := by + simp only [InnerProductSpace.rankOne_def] + exact ((ContinuousLinearMap.smulRightL ℂ E E).continuous.comp + (innerSL ℂ).continuous).clm_apply continuous_id + exact (hc.tendsto _).comp (hvw i) + +theorem tendsto_positiveRoot {l : Filter A} {T : A → E →L[ℂ] E} {R : E →L[ℂ] E} + (hT : ∀ a, (T a).IsPositive) (hR : R.IsPositive) + (h : Tendsto T l (𝓝 R)) : Tendsto (fun a => positiveRoot (T a)) l (𝓝 (positiveRoot R)) := by + apply (CFC.continuousOn_sqrt.continuousWithinAt + (ContinuousLinearMap.nonneg_iff_isPositive.mpr hR)).tendsto.comp + exact tendsto_nhdsWithin_iff.mpr ⟨h, Filter.Eventually.of_forall (fun a => + ContinuousLinearMap.nonneg_iff_isPositive.mpr (hT a))⟩ + +end TraceEnsemble + +namespace TensorLp +variable {A B : Type*} + +def tensorBilinear : H A →L[ℂ] H B →L[ℂ] H (A × B) := + LinearMap.mkContinuous + { toFun := tensorLeft + map_add' := fun x y => by + apply ContinuousLinearMap.ext + intro z + apply lp.ext + funext ab + change (x ab.1+y ab.1)*z ab.2 = x ab.1*z ab.2 + y ab.1*z ab.2 + ring + map_smul' := fun c x => by + apply ContinuousLinearMap.ext + intro z + apply lp.ext + funext ab + change (c*x ab.1)*z ab.2 = c*(x ab.1*z ab.2) + ring } + 1 (fun x => by + apply ContinuousLinearMap.opNorm_le_bound _ (by positivity) + intro y + change ‖tensor x y‖ ≤ (1*‖x‖)*‖y‖ + rw [tensor_norm, one_mul]) + +@[simp] theorem tensorBilinear_apply (x : H A) (y : H B) : tensorBilinear x y = tensor x y := rfl + +theorem tendsto_tensor {C : Type*} {l : Filter C} {x : C → H A} {y : C → H B} + {a : H A} {b : H B} (hx : Filter.Tendsto x l (nhds a)) (hy : Filter.Tendsto y l (nhds b)) : + Filter.Tendsto (fun c => tensor (x c) (y c)) l (nhds (tensor a b)) := + (tensorBilinear.continuous₂.tendsto (a,b)).comp (hx.prodMk_nhds hy) + +end TensorLp + +namespace EntropyPhotonNumber + +section +open Filter Topology TensorLp + +theorem tendsto_rootColumn {n : ℕ} {A : Type*} {l : Filter A} + {ρ : A → State n} {σ : State n} + (h : Tendsto (fun a => (ρ a).op) l (𝓝 σ.op)) (k : NumberIndex n) : + Tendsto (fun a => rootColumn (ρ a) k) l (𝓝 (rootColumn σ k)) := + (ContinuousLinearMap.apply ℂ (Fock n) (numberKet k)).continuous.tendsto _ |>.comp + (TraceEnsemble.tendsto_positiveRoot (fun a => (ρ a).positive) σ.positive h) + +theorem tendsto_beamOutput {n : ℕ} {A : Type*} {l : Filter A} + (η : ℝ) (hη : η ∈ Set.Icc 0 1) + {ρ σ : A → State n} {ρ₀ σ₀ : State n} + (hρ : Tendsto (fun a => (ρ a).op) l (𝓝 ρ₀.op)) + (hσ : Tendsto (fun a => (σ a).op) l (𝓝 σ₀.op)) : + Tendsto (fun a => (beamOutput η hη (ρ a) (σ a)).op) l (𝓝 (beamOutput η hη ρ₀ σ₀).op) := by + apply TraceEnsemble.tendsto_operator + (fun a => hasSum_slice_family (mixedVector_norm η hη (ρ a) (σ a))) + (hasSum_slice_family (mixedVector_norm η hη ρ₀ σ₀)) + intro bi + apply (sliceCLM bi.1).continuous.tendsto _ |>.comp + apply (beamUnitary η hη).continuous.tendsto _ |>.comp + exact tendsto_tensor (tendsto_rootColumn hρ bi.2.1) (tendsto_rootColumn hσ bi.2.2) + +end + +open QuantumTrace TraceEnsemble +theorem diagonalState_entropy {n : ℕ} (p : NumberIndex n → ℝ) + (hp : ∀ k, 0 ≤ p k) (hs : HasSum p 1) : + entropy (diagonalState p hp hs) = ∑' k, Real.negMulLog (p k) := by + rw [entropy_eq_quantumTrace] + congr 1 + funext k + rw [QuantumTrace.entropyOperator_apply_eigenvector (diagonalState p hp hs).positive.isSymmetric + (diagonalState_eigen p hp hs k), inner_smul_right, + orthonormal_iff_ite.mp (numberBasis n).orthonormal k k, ite_eq_left rfl, mul_one, Complex.ofReal_re] +@[simp] theorem mixture_entry {n : ℕ} (t : ℝ) (ht : t ∈ Set.Icc 0 1) (ρ σ : State n) + (k l : NumberIndex n) : + entry (mixture t ht ρ σ).op k l = (t : ℂ)*entry ρ.op k l + ((1-t : ℝ) : ℂ)*entry σ.op k l := by + simp only [mixture, entry, add_apply, smul_apply, + inner_add_right, inner_smul_right] + +theorem mixture_finiteEnergy {n : ℕ} (t : ℝ) (ht : t ∈ Set.Icc 0 1) {ρ σ : State n} + (hρ : FiniteEnergy ρ) (hσ : FiniteEnergy σ) : FiniteEnergy (mixture t ht ρ σ) := by + unfold FiniteEnergy + convert! (hρ.mul_left t).add (hσ.mul_left (1-t)) using 1 + funext k + simp only [mixture_entry, Complex.add_re, Complex.mul_re, Complex.ofReal_re, + Complex.ofReal_im, zero_mul, sub_zero] + ring + +theorem mixture_energy {n : ℕ} (t : ℝ) (ht : t ∈ Set.Icc 0 1) {ρ σ : State n} + (hρ : FiniteEnergy ρ) (hσ : FiniteEnergy σ) : + energy (mixture t ht ρ σ) = t*energy ρ+(1-t)*energy σ := by + unfold energy + have he (k : NumberIndex n) : + (totalNumber k : ℝ)*(entry (mixture t ht ρ σ).op k k).re = + t*((totalNumber k : ℝ)*(entry ρ.op k k).re)+ + (1-t)*((totalNumber k : ℝ)*(entry σ.op k k).re) := by + simp only [mixture_entry, Complex.add_re, Complex.mul_re, Complex.ofReal_re, + Complex.ofReal_im, zero_mul, sub_zero] + ring + simp only [he] + rw [(hρ.mul_left t).tsum_add (hσ.mul_left (1-t)), tsum_mul_left, tsum_mul_left] + +end EntropyPhotonNumber + +namespace QuantumTrace +open scoped ENNReal + +theorem summable_finite_product (n : ℕ) (w : ℕ → ℝ) + (hw : ∀ k, 0 ≤ w k) (hs : Summable w) : + Summable (fun k : Fin n → ℕ => ∏ j, w (k j)) := by + have hh : (∑' k : Fin n → ℕ, ENNReal.ofReal (∏ j, w (k j))) < ⊤ := by + simp only [ENNReal.ofReal_prod_of_nonneg (fun _ _ => hw _)] + rw [tsum_finite_product n (fun k => ENNReal.ofReal (w k))] + exact ENNReal.pow_lt_top hs.tsum_ofReal_lt_top + have he := ENNReal.summable_toReal hh.ne + simpa only [ENNReal.toReal_ofReal (Finset.prod_nonneg (fun _ _ => hw _))] using he + +theorem one_add_sum_le_product {I : Type*} (s : Finset I) (a : I → ℝ) + (ha : ∀ i, 0 ≤ a i) : 1+∑ i ∈ s, a i ≤ ∏ i ∈ s, (1+a i) := by + classical + induction s using Finset.induction_on with + | empty => simp + | @insert i s hi ih => + rw [Finset.sum_insert hi, Finset.prod_insert hi] + have hp : 0 ≤ ∑ j ∈ s, a j := Finset.sum_nonneg (fun j _ => ha j) + have hm := mul_le_mul_of_nonneg_left ih (by linarith [ha i] : 0 ≤ 1+a i) + nlinarith [mul_nonneg (ha i) hp] + +theorem summable_shift_pow_geometric {q : ℝ} (hq : 0 < q) (hq1 : q < 1) (m : ℕ) : + Summable (fun k : ℕ => (1+(k : ℝ))^m*q^k) := by + have hs := (summable_pow_mul_geometric_of_norm_lt_one m + (show ‖q‖ < 1 by rwa [Real.norm_eq_abs, abs_of_pos hq])).comp_injective Nat.succ_injective + convert! hs.mul_left q⁻¹ using 1 + funext k + change (1+(k : ℝ))^m*q^k = q⁻¹*((k+1 : ℕ)^m*q^(k+1)) + simp only [Nat.cast_succ, pow_succ] + rw [add_comm (k : ℝ) 1] + field_simp + +theorem thermalWeight_moment_summable (n m : ℕ) {r : ℝ} (hr : 0 < r) : + Summable (fun k : Fin n → ℕ => (1+∑ j, (k j : ℝ))^m * thermalWeight n r k) := by + let q := r/(r+1) + have hq : 0 < q := by dsimp [q]; positivity + have hq1 : q < 1 := (div_lt_one (by linarith : 0 < r+1)).mpr (by linarith) + have hs := summable_finite_product n + (fun k => (1+(k : ℝ))^m*((r+1)⁻¹*q^k)) + (fun _ => by positivity) + (by simpa only [mul_left_comm _ (r+1)⁻¹] using + (summable_shift_pow_geometric hq hq1 m).mul_left (r+1)⁻¹) + apply Summable.of_nonneg_of_le (fun _ => by apply mul_nonneg _ (thermalWeight_pos n hr _).le; positivity) _ hs + intro k + have h := pow_le_pow_left₀ (by positivity : (0 : ℝ) ≤ 1+∑ j, (k j : ℝ)) + (one_add_sum_le_product Finset.univ (fun j => (k j : ℝ)) (fun _ => Nat.cast_nonneg _)) m + have hh := mul_le_mul_of_nonneg_right h (thermalWeight_pos n hr k).le + simpa only [← Finset.prod_pow, thermalWeight, ← Finset.prod_mul_distrib, q] using hh + +end QuantumTrace + +namespace EntropyPhotonNumber + +section +open QuantumTrace +theorem numberMoment_nonneg {n : ℕ} (m : ℕ) (ρ : State n) : 0 ≤ numberMoment m ρ := + tsum_nonneg (fun k => mul_nonneg (by positivity) (ρ.positive.re_inner_nonneg_right _)) + +theorem thermalState_finiteMoment (n m : ℕ) (r : ℝ) (hr : 0 < r) : + FiniteMoment m (thermalState n r hr) := by + simpa only [FiniteMoment, thermalState_diagonal, totalNumber, Nat.cast_sum] using + thermalWeight_moment_summable n m hr + +theorem finiteMoment_finiteEnergy {n m : ℕ} (hm : 1 ≤ m) {ρ : State n} (hρ : FiniteMoment m ρ) : + FiniteEnergy ρ := by + apply Summable.of_nonneg_of_le + (fun k => mul_nonneg (Nat.cast_nonneg _) (ρ.positive.re_inner_nonneg_right _)) _ hρ + intro k + have h : (1+(totalNumber k : ℝ))^1 ≤ (1+(totalNumber k : ℝ))^m := + pow_le_pow_right₀ (by linarith [Nat.cast_nonneg (α := ℝ) (totalNumber k)]) hm + exact mul_le_mul_of_nonneg_right (by simpa only [pow_one] using (by linarith : + (totalNumber k : ℝ) ≤ (1+(totalNumber k : ℝ))^m)) (ρ.positive.re_inner_nonneg_right _) + +theorem thermalState_finiteEnergy (n : ℕ) (r : ℝ) (hr : 0 < r) : + FiniteEnergy (thermalState n r hr) := + finiteMoment_finiteEnergy le_rfl (thermalState_finiteMoment n 1 r hr) + +theorem mixture_finiteMoment {n : ℕ} (m : ℕ) (t : ℝ) (ht : t ∈ Set.Icc 0 1) {ρ σ : State n} + (hρ : FiniteMoment m ρ) (hσ : FiniteMoment m σ) : FiniteMoment m (mixture t ht ρ σ) := by + unfold FiniteMoment + convert! (hρ.mul_left t).add (hσ.mul_left (1-t)) using 1 + funext k + simp only [mixture_entry, Complex.add_re, Complex.mul_re, Complex.ofReal_re, + Complex.ofReal_im, zero_mul, sub_zero] + ring + +end + +open QuantumTrace Filter Topology + +theorem energyMoment_ofReal {n : ℕ} {ρ : State n} (hρ : FiniteEnergy ρ) : + energyMoment ρ = ENNReal.ofReal (energy ρ) := by + rw [energyMoment_eq] + exact (ENNReal.ofReal_tsum_of_nonneg + (fun k => mul_nonneg (Nat.cast_nonneg _) (ρ.positive.re_inner_nonneg_right _)) hρ).symm + +theorem beamOutput_energy_bound {n : ℕ} (η : ℝ) (hη : η ∈ Set.Icc 0 1) + {ρ σ : State n} (hρ : FiniteEnergy ρ) (hσ : FiniteEnergy σ) : + energy (beamOutput η hη ρ σ) ≤ energy ρ + energy σ := by + have h := beamOutput_energy_le η hη ρ σ + rw [energyMoment_ofReal (beamOutput_finiteEnergy η hη hρ hσ), + energyMoment_ofReal hρ, energyMoment_ofReal hσ, + ← ENNReal.ofReal_add (energy_nonneg ρ) (energy_nonneg σ)] at h + exact (ENNReal.ofReal_le_ofReal_iff (add_nonneg (energy_nonneg ρ) (energy_nonneg σ))).mp h + +def regularizedOutput {n : ℕ} (η δ κ : ℝ) (hη : η ∈ Set.Icc 0 1) + (hδ : δ ∈ Set.Icc 0 1) (hκ : κ ∈ Set.Icc 0 1) (τD τ0 ρ σ : State n) : State n := + mixture (1-κ) ⟨sub_nonneg.mpr hκ.2, sub_le_self _ hκ.1⟩ + (beamOutput (1-δ) ⟨sub_nonneg.mpr hδ.2, sub_le_self _ hδ.1⟩ + (beamOutput η hη ρ σ) τD) τ0 + +theorem regularizedOutput_finiteEnergy {n : ℕ} (η δ κ : ℝ) (hη : η ∈ Set.Icc 0 1) + (hδ : δ ∈ Set.Icc 0 1) (hκ : κ ∈ Set.Icc 0 1) {τD τ0 ρ σ : State n} + (hD : FiniteEnergy τD) (h0 : FiniteEnergy τ0) (hρ : FiniteEnergy ρ) (hσ : FiniteEnergy σ) : + FiniteEnergy (regularizedOutput η δ κ hη hδ hκ τD τ0 ρ σ) := + mixture_finiteEnergy _ _ (beamOutput_finiteEnergy _ _ (beamOutput_finiteEnergy _ _ hρ hσ) hD) h0 + +theorem regularizedOutput_energy_bound {n : ℕ} (η δ κ : ℝ) (hη : η ∈ Set.Icc 0 1) + (hδ : δ ∈ Set.Icc 0 1) (hκ : κ ∈ Set.Icc 0 1) {τD τ0 ρ σ : State n} + (hD : FiniteEnergy τD) (h0 : FiniteEnergy τ0) (hρ : FiniteEnergy ρ) (hσ : FiniteEnergy σ) : + energy (regularizedOutput η δ κ hη hδ hκ τD τ0 ρ σ) ≤ + energy ρ+energy σ+energy τD+energy τ0 := by + let γ := beamOutput (1-δ) ⟨sub_nonneg.mpr hδ.2, sub_le_self _ hδ.1⟩ (beamOutput η hη ρ σ) τD + have hg := beamOutput_finiteEnergy (1-δ) ⟨sub_nonneg.mpr hδ.2, sub_le_self _ hδ.1⟩ (beamOutput_finiteEnergy η hη hρ hσ) hD + have hb := beamOutput_energy_bound (1-δ) ⟨sub_nonneg.mpr hδ.2, sub_le_self _ hδ.1⟩ + (beamOutput_finiteEnergy η hη hρ hσ) hD + have ha := beamOutput_energy_bound η hη hρ hσ + change energy (mixture _ _ γ τ0) ≤ _ + apply (mixture_energy (1-κ) ⟨sub_nonneg.mpr hκ.2, sub_le_self _ hκ.1⟩ + (ρ := γ) (σ := τ0) hg h0).le.trans + have hp := energy_nonneg γ + have hq := energy_nonneg τ0 + have hb' : energy γ ≤ energy ρ+energy σ+energy τD := by dsimp [γ]; linarith + nlinarith [mul_nonneg hκ.1 hp, mul_nonneg (sub_nonneg.mpr hκ.2) hq] + +theorem tendsto_regularizedOutput {n : ℕ} {A : Type*} {l : Filter A} + (η δ κ : ℝ) (hη : η ∈ Set.Icc 0 1) (hδ : δ ∈ Set.Icc 0 1) (hκ : κ ∈ Set.Icc 0 1) + (τD τ0 : State n) {ρ σ : A → State n} {ρ₀ σ₀ : State n} + (hρ : Tendsto (fun a => (ρ a).op) l (𝓝 ρ₀.op)) + (hσ : Tendsto (fun a => (σ a).op) l (𝓝 σ₀.op)) : + Tendsto (fun a => (regularizedOutput η δ κ hη hδ hκ τD τ0 (ρ a) (σ a)).op) l + (𝓝 (regularizedOutput η δ κ hη hδ hκ τD τ0 ρ₀ σ₀).op) := by + exact ((tendsto_const_nhds.smul (tendsto_beamOutput _ _ + (tendsto_beamOutput _ _ hρ hσ) tendsto_const_nhds)).add tendsto_const_nhds) + +theorem tendsto_entropy {n : ℕ} {A : Type*} {l : Filter A} {ρ : A → State n} {σ : State n} + {E : ℝ} (hρ : ∀ a, FiniteEnergy (ρ a)) (hσ : FiniteEnergy σ) + (hb : ∀ a, energy (ρ a) ≤ E) (hc : energy σ ≤ E) + (h : Tendsto (fun a => (ρ a).op) l (𝓝 σ.op)) : + Tendsto (fun a => entropy (ρ a)) l (𝓝 (entropy σ)) := by + simp only [entropy_eq_quantumTrace] + apply entropy_tendsto_finite_energy (E := E) (numberBasis n) (fun a => (ρ a).positive) σ.positive + (fun a => trace_one_numberBasis (ρ a)) (trace_one_numberBasis σ) _ _ _ _ h + · simpa only [FiniteEnergy, totalNumber, Nat.cast_sum, entry, numberBasis_apply] using hρ + · simpa only [FiniteEnergy, totalNumber, Nat.cast_sum, entry, numberBasis_apply] using hσ + · simpa only [energy, totalNumber, Nat.cast_sum, entry, numberBasis_apply] using hb + · simpa only [energy, totalNumber, Nat.cast_sum, entry, numberBasis_apply] using hc + +theorem entropy_linear_bound {n : ℕ} (ρ : State n) (hρ : FiniteEnergy ρ) + {a b : ℝ} (ha : 0 < a) (hb : 0 < b) : + a*entropy ρ ≤ a*n*Real.log (2*a/b+1)+(b/2)*energy ρ := by + have hr : 0 < 2*a/b := by positivity + have hh := entropy_le_thermal_crossEntropy (numberBasis n) ρ.positive + (trace_one_numberBasis ρ) + (by simpa only [FiniteEnergy, totalNumber, Nat.cast_sum, entry, numberBasis_apply] using hρ) hr + have hlog : Real.log ((2*a/b+1)/(2*a/b)) ≤ b/(2*a) := by + have h := Real.log_le_sub_one_of_pos (by positivity : 0 < (2*a/b+1)/(2*a/b)) + convert h using 1 + field_simp + ring + rw [← entropy_eq_quantumTrace] at hh + have hh' : entropy ρ ≤ n*Real.log (2*a/b+1)+energy ρ*Real.log ((2*a/b+1)/(2*a/b)) := by + simpa only [energy, totalNumber, Nat.cast_sum, entry, numberBasis_apply] using hh + have hm := mul_le_mul_of_nonneg_left hh' ha.le + have hl := mul_le_mul_of_nonneg_left hlog (mul_nonneg ha.le (energy_nonneg ρ)) + have he : a*energy ρ*(b/(2*a)) = b/2*energy ρ := by field_simp + rw [he] at hl + nlinarith + +instance stateTopology (n : ℕ) : TopologicalSpace (State n) := + TopologicalSpace.induced State.op inferInstance + +theorem continuous_state_op (n : ℕ) : Continuous (State.op : State n → Fock n →L[ℂ] Fock n) := + continuous_induced_dom + +theorem State.ext_op {n : ℕ} {ρ σ : State n} (h : ρ.op = σ.op) : ρ = σ := by + cases ρ + cases σ + cases h + rfl + +def boundedStates (n : ℕ) (E M : ℝ) : Set (State n) := + {ρ | FiniteEnergy ρ ∧ energy ρ ≤ E ∧ FiniteMoment 4 ρ ∧ numberMoment 4 ρ ≤ M} + +def stateOfMomentSet {n : ℕ} {E M : ℝ} + (T : momentSet (numberBasis n) (fun k => (1+(totalNumber k : ℝ))^4) E M) : State n where + op := T.val + positive := T.property.1.1 + trace_one := by simpa only [numberBasis_apply, entry] using T.property.1.2.1 + +theorem stateOfMomentSet_mem {n : ℕ} {E M : ℝ} + (T : momentSet (numberBasis n) (fun k => (1+(totalNumber k : ℝ))^4) E M) : + stateOfMomentSet T ∈ boundedStates n E M := by + refine ⟨?_, ?_, ?_, ?_⟩ + · simpa only [FiniteEnergy, totalNumber, Nat.cast_sum, entry, numberBasis_apply, + stateOfMomentSet] using T.property.1.2.2.1 + · simpa only [energy, totalNumber, Nat.cast_sum, entry, numberBasis_apply, + stateOfMomentSet] using T.property.1.2.2.2 + · simpa only [FiniteMoment, entry, numberBasis_apply, stateOfMomentSet] using T.property.2.1 + · simpa only [numberMoment, entry, numberBasis_apply, stateOfMomentSet] using T.property.2.2 + +theorem op_mem_momentSet {n : ℕ} {E M : ℝ} {ρ : State n} (hρ : ρ ∈ boundedStates n E M) : + ρ.op ∈ momentSet (numberBasis n) (fun k => (1+(totalNumber k : ℝ))^4) E M := by + refine ⟨⟨ρ.positive, trace_one_numberBasis ρ, ?_, ?_⟩, ?_, ?_⟩ + · simpa only [FiniteEnergy, totalNumber, Nat.cast_sum, entry, numberBasis_apply] using hρ.1 + · simpa only [energy, totalNumber, Nat.cast_sum, entry, numberBasis_apply] using hρ.2.1 + · simpa only [FiniteMoment, entry, numberBasis_apply] using hρ.2.2.1 + · simpa only [numberMoment, entry, numberBasis_apply] using hρ.2.2.2 + +theorem boundedStates_isCompact (n : ℕ) (E M : ℝ) : IsCompact (boundedStates n E M) := by + let S := momentSet (numberBasis n) (fun k => (1+(totalNumber k : ℝ))^4) E M + have hc : IsCompact S := momentSet_isCompact _ _ (fun _ => by positivity) E M + let : CompactSpace S := isCompact_iff_compactSpace.mp hc + have hf : Continuous (stateOfMomentSet : S → State n) := + continuous_induced_rng.mpr continuous_subtype_val + have hi : Set.range (stateOfMomentSet : S → State n) = boundedStates n E M := by + ext ρ + constructor + · rintro ⟨T, rfl⟩ + exact stateOfMomentSet_mem T + · intro hρ + exact ⟨⟨ρ.op, op_mem_momentSet hρ⟩, State.ext_op rfl⟩ + rw [← hi] + exact isCompact_range hf + +theorem continuous_entropy_boundedStates (n : ℕ) (E M : ℝ) : + Continuous (fun ρ : boundedStates n E M => entropy ρ.val) := by + rw [continuous_iff_continuousAt] + intro ρ + exact tendsto_entropy (fun σ => σ.property.1) ρ.property.1 + (fun σ => σ.property.2.1) ρ.property.2.1 + ((continuous_state_op n).comp continuous_subtype_val).continuousAt + +theorem penalty_lowerSemicontinuous (n : ℕ) (E M : ℝ) {b ζ : ℝ} (hb : 0 ≤ b) (hζ : 0 ≤ ζ) : + LowerSemicontinuous (fun ρ : boundedStates n E M => b*energy ρ.val+ζ*numberMoment 4 ρ.val) := by + have he (ρ : boundedStates n E M) : b*energy ρ.val+ζ*numberMoment 4 ρ.val = + ∑' k, (b*(totalNumber k : ℝ)+ζ*(1+(totalNumber k : ℝ))^4)*(entry ρ.val.op k k).re := by + rw [energy, numberMoment, ← tsum_mul_left, ← tsum_mul_left, + ← (ρ.property.1.mul_left b).tsum_add (ρ.property.2.2.1.mul_left ζ)] + congr 1 + funext k + ring + simp only [he] + apply lowerSemicontinuous_tsum_nonneg + · intro ρ k + apply mul_nonneg _ (ρ.val.positive.re_inner_nonneg_right _) + positivity + · intro ρ + convert! (ρ.property.1.mul_left b).add (ρ.property.2.2.1.mul_left ζ) using 1 + funext k + ring + · intro k + exact continuous_const.mul (Complex.continuous_re.comp (continuous_const.inner + (((continuous_state_op n).comp continuous_subtype_val).clm_apply continuous_const))) + +structure Regularization (n : ℕ) where + η : ℝ + δ : ℝ + κ : ℝ + hη : η ∈ Set.Icc 0 1 + hδ : δ ∈ Set.Icc 0 1 + hκ : κ ∈ Set.Icc 0 1 + τD : State n + τ0 : State n + finiteD : FiniteEnergy τD + finite0 : FiniteEnergy τ0 + c : ℝ + a1 : ℝ + a2 : ℝ + b1 : ℝ + b2 : ℝ + ζ : ℝ + hc : 0 < c + ha1 : 0 < a1 + ha2 : 0 < a2 + hb1 : 0 < b1 + hb2 : 0 < b2 + hζ : 0 < ζ + +namespace Regularization +variable {n : ℕ} (R : Regularization n) + +def output (ρ σ : State n) : State n := + regularizedOutput R.η R.δ R.κ R.hη R.hδ R.hκ R.τD R.τ0 ρ σ + +def objective (ρ σ : State n) : ℝ := + R.c*entropy (R.output ρ σ)-R.a1*entropy ρ-R.a2*entropy σ+ + (R.b1*energy ρ+R.ζ*numberMoment 4 ρ)+(R.b2*energy σ+R.ζ*numberMoment 4 σ) + +def entropyConstant : ℝ := + R.a1*n*Real.log (2*R.a1/R.b1+1)+R.a2*n*Real.log (2*R.a2/R.b2+1) + +theorem coercive (ρ σ : State n) (hρ : FiniteEnergy ρ) (hσ : FiniteEnergy σ) : + R.b1/2*energy ρ+R.b2/2*energy σ+R.ζ*numberMoment 4 ρ+R.ζ*numberMoment 4 σ ≤ + R.objective ρ σ+R.entropyConstant := by + have h1 := entropy_linear_bound ρ hρ R.ha1 R.hb1 + have h2 := entropy_linear_bound σ hσ R.ha2 R.hb2 + have h0 := mul_nonneg R.hc.le (entropy_nonneg (R.output ρ σ)) + dsimp [objective, entropyConstant] + linarith + +theorem continuous_output_entropy (E M : ℝ) : + Continuous (fun p : boundedStates n E M × boundedStates n E M => + entropy (R.output p.1.val p.2.val)) := by + rw [continuous_iff_continuousAt] + intro p + apply tendsto_entropy (E := E+E+energy R.τD+energy R.τ0) + (fun q => regularizedOutput_finiteEnergy _ _ _ _ _ _ R.finiteD R.finite0 + q.1.property.1 q.2.property.1) + (regularizedOutput_finiteEnergy _ _ _ _ _ _ R.finiteD R.finite0 p.1.property.1 p.2.property.1) + · intro q + exact (regularizedOutput_energy_bound _ _ _ _ _ _ R.finiteD R.finite0 + q.1.property.1 q.2.property.1).trans (by linarith [q.1.property.2.1, q.2.property.2.1]) + · exact (regularizedOutput_energy_bound _ _ _ _ _ _ R.finiteD R.finite0 + p.1.property.1 p.2.property.1).trans (by linarith [p.1.property.2.1, p.2.property.2.1]) + · exact tendsto_regularizedOutput _ _ _ _ _ _ _ _ + ((continuous_state_op n).comp (continuous_subtype_val.comp continuous_fst)).continuousAt + ((continuous_state_op n).comp (continuous_subtype_val.comp continuous_snd)).continuousAt + +theorem objective_lowerSemicontinuous (E M : ℝ) : + LowerSemicontinuous (fun p : boundedStates n E M × boundedStates n E M => + R.objective p.1.val p.2.val) := by + have hc : Continuous (fun p : boundedStates n E M × boundedStates n E M => + R.c*entropy (R.output p.1.val p.2.val)-R.a1*entropy p.1.val-R.a2*entropy p.2.val) := + ((continuous_const.mul (R.continuous_output_entropy E M)).sub + (continuous_const.mul ((continuous_entropy_boundedStates n E M).comp continuous_fst))).sub + (continuous_const.mul ((continuous_entropy_boundedStates n E M).comp continuous_snd)) + exact (hc.lowerSemicontinuous.add + ((penalty_lowerSemicontinuous n E M R.hb1.le R.hζ.le).comp continuous_fst)).add + ((penalty_lowerSemicontinuous n E M R.hb2.le R.hζ.le).comp continuous_snd) + +theorem sublevel_bounds (C : ℝ) (ρ σ : State n) (hρ : FiniteEnergy ρ) (hσ : FiniteEnergy σ) + (h : R.objective ρ σ ≤ C) : + 0 ≤ C+R.entropyConstant ∧ + energy ρ ≤ 2*(C+R.entropyConstant)/R.b1 ∧ + energy σ ≤ 2*(C+R.entropyConstant)/R.b2 ∧ + numberMoment 4 ρ ≤ (C+R.entropyConstant)/R.ζ ∧ + numberMoment 4 σ ≤ (C+R.entropyConstant)/R.ζ := by + have hc := R.coercive ρ σ hρ hσ + have he1 := energy_nonneg ρ + have he2 := energy_nonneg σ + have hm1 := numberMoment_nonneg 4 ρ + have hm2 := numberMoment_nonneg 4 σ + have hp1 := mul_nonneg R.hb1.le he1 + have hp2 := mul_nonneg R.hb2.le he2 + have hq1 := mul_nonneg R.hζ.le hm1 + have hq2 := mul_nonneg R.hζ.le hm2 + refine ⟨by linarith, (le_div_iff₀ R.hb1).mpr ?_, (le_div_iff₀ R.hb2).mpr ?_, + (le_div_iff₀ R.hζ).mpr ?_, (le_div_iff₀ R.hζ).mpr ?_⟩ <;> nlinarith + +theorem sublevel_mem_bounded (C : ℝ) (ρ σ : State n) + (h1 : FiniteMoment 4 ρ) (h2 : FiniteMoment 4 σ) (h : R.objective ρ σ ≤ C) : + ρ ∈ boundedStates n (2*(C+R.entropyConstant)/R.b1+2*(C+R.entropyConstant)/R.b2) + ((C+R.entropyConstant)/R.ζ) ∧ + σ ∈ boundedStates n (2*(C+R.entropyConstant)/R.b1+2*(C+R.entropyConstant)/R.b2) + ((C+R.entropyConstant)/R.ζ) := by + have hE1 := finiteMoment_finiteEnergy (by decide : 1 ≤ 4) h1 + have hE2 := finiteMoment_finiteEnergy (by decide : 1 ≤ 4) h2 + have hb := R.sublevel_bounds C ρ σ hE1 hE2 h + have hp : 0 ≤ 2*(C+R.entropyConstant)/R.b1 := div_nonneg (by linarith [hb.1]) R.hb1.le + have hq : 0 ≤ 2*(C+R.entropyConstant)/R.b2 := div_nonneg (by linarith [hb.1]) R.hb2.le + exact ⟨⟨hE1, by linarith [hb.2.1], h1, hb.2.2.2.1⟩, + ⟨hE2, by linarith [hb.2.2.1], h2, hb.2.2.2.2⟩⟩ + +theorem exists_constrained_minimum (E M : ℝ) (pw : boundedStates n E M × boundedStates n E M) : + ∃ p : boundedStates n E M × boundedStates n E M, + ∀ q : boundedStates n E M × boundedStates n E M, + R.objective p.1.val p.2.val ≤ R.objective q.1.val q.2.val := by + let : CompactSpace (boundedStates n E M) := + isCompact_iff_compactSpace.mp (boundedStates_isCompact n E M) + obtain ⟨p, _, hp⟩ := LowerSemicontinuousOn.exists_isMinOn + (s := Set.univ) ⟨pw, Set.mem_univ _⟩ isCompact_univ + ((R.objective_lowerSemicontinuous E M).lowerSemicontinuousOn Set.univ) + exact ⟨p, fun q => hp (Set.mem_univ q)⟩ + +theorem exists_minimum (ρw σw : State n) (hw1 : FiniteMoment 4 ρw) (hw2 : FiniteMoment 4 σw) : + ∃ ρ σ : State n, FiniteMoment 4 ρ ∧ FiniteMoment 4 σ ∧ + R.objective ρ σ ≤ R.objective ρw σw ∧ + ∀ ρ' σ' : State n, FiniteMoment 4 ρ' → FiniteMoment 4 σ' → + R.objective ρ σ ≤ R.objective ρ' σ' := by + let C := R.objective ρw σw + let E := 2*(C+R.entropyConstant)/R.b1+2*(C+R.entropyConstant)/R.b2 + let M := (C+R.entropyConstant)/R.ζ + have hwm := R.sublevel_mem_bounded C ρw σw hw1 hw2 le_rfl + let pw : boundedStates n E M × boundedStates n E M := (⟨ρw, hwm.1⟩, ⟨σw, hwm.2⟩) + obtain ⟨p, hp⟩ := R.exists_constrained_minimum E M pw + have hpw : R.objective p.1.val p.2.val ≤ C := hp pw + refine ⟨p.1.val, p.2.val, p.1.property.2.2.1, p.2.property.2.2.1, hpw, ?_⟩ + intro ρ σ h1 h2 + by_cases h : R.objective ρ σ ≤ C + · have hh := R.sublevel_mem_bounded C ρ σ h1 h2 h + exact hp (⟨ρ, hh.1⟩, ⟨σ, hh.2⟩) + · exact hpw.trans (le_of_lt (lt_of_not_ge h)) + +end Regularization +end EntropyPhotonNumber + +namespace QuantumTrace +variable {E : Type*} [NormedAddCommGroup E] [InnerProductSpace ℂ E] +variable {I J : Type*} + +def basisMoment (b : HilbertBasis I ℂ E) (w : I → ℝ≥0∞) (x : E) : ℝ≥0∞ := + ∑' i, w i*ENNReal.ofReal (‖inner ℂ (b i) x‖^2) + +def basisExpectation (b : HilbertBasis I ℂ E) (w : I → ℝ≥0∞) (T : E →L[ℂ] E) : ℝ≥0∞ := + ∑' i, w i*ENNReal.ofReal (inner ℂ (b i) (T (b i))).re + +theorem basisMoment_one (b : HilbertBasis I ℂ E) (x : E) : + basisMoment b (fun _ => 1) x = ENNReal.ofReal (‖x‖^2) := by + simp only [basisMoment, one_mul] + rw [← ENNReal.ofReal_tsum_of_nonneg (fun _ => sq_nonneg _) (basis_hasSum_norm_sq b x).summable, + (basis_hasSum_norm_sq b x).tsum_eq] + +theorem basisMoment_ofReal (b : HilbertBasis I ℂ E) (w : I → ℝ) (hw : ∀ i, 0 ≤ w i) + (x : E) (hs : Summable (fun i => w i*‖inner ℂ (b i) x‖^2)) : + basisMoment b (fun i => ENNReal.ofReal (w i)) x = + ENNReal.ofReal (∑' i, w i*‖inner ℂ (b i) x‖^2) := by + simp only [basisMoment, ← ENNReal.ofReal_mul (hw _)] + exact (ENNReal.ofReal_tsum_of_nonneg (fun i => mul_nonneg (hw i) (sq_nonneg _)) hs).symm + +variable [CompleteSpace E] + +theorem basisExpectation_ensemble (b : HilbertBasis I ℂ E) (w : I → ℝ≥0∞) + {v : J → E} (hv : Summable (fun j => ‖v j‖^2)) : + basisExpectation b w (TraceEnsemble.operator v) = ∑' j, basisMoment b w (v j) := by + have he (i : I) : ENNReal.ofReal (inner ℂ (b i) (TraceEnsemble.operator v (b i))).re = + ∑' j, ENNReal.ofReal (‖inner ℂ (b i) (v j)‖^2) := by + have hs := TraceEnsemble.hasSum_quadratic hv (b i) + rw [← hs.tsum_eq, ENNReal.ofReal_tsum_of_nonneg (fun _ => sq_nonneg _) hs.summable] + simp only [basisExpectation, he, ← ENNReal.tsum_mul_left, basisMoment] + exact ENNReal.tsum_comm + +theorem basisExpectation_le_of_form_le (a : HilbertBasis J ℂ E) (b : HilbertBasis I ℂ E) + (w : I → ℝ≥0∞) (v : J → ℝ≥0∞) {A B : ℝ≥0∞} + (h : ∀ x, basisMoment b w x ≤ A*ENNReal.ofReal (‖x‖^2)+B*basisMoment a v x) + {T : E →L[ℂ] E} (hp : T.IsPositive) + (ht : HasSum (fun j => (inner ℂ (a j) (T (a j))).re) 1) : + basisExpectation b w T ≤ A+B*basisExpectation a v T := by + let u : J → E := fun j => TraceEnsemble.positiveRoot T (a j) + have hu : HasSum (fun j => ‖u j‖^2) 1 := by + simpa only [TraceEnsemble.sqrt_quadratic hp] using ht + have he : TraceEnsemble.operator u = T := TraceEnsemble.sqrt_ensemble a hp ht.summable + have hn : (∑' j, ENNReal.ofReal (‖u j‖^2)) = 1 := by + rw [← ENNReal.ofReal_tsum_of_nonneg (fun _ => sq_nonneg _) hu.summable, + hu.tsum_eq, ENNReal.ofReal_one] + rw [← he, basisExpectation_ensemble b w hu.summable, basisExpectation_ensemble a v hu.summable] + calc + _ ≤ ∑' j, (A*ENNReal.ofReal (‖u j‖^2)+B*basisMoment a v (u j)) := + ENNReal.tsum_le_tsum (fun j => h (u j)) + _ = _ := by rw [ENNReal.tsum_add, ENNReal.tsum_mul_left, ENNReal.tsum_mul_left, hn, mul_one] + +end QuantumTrace + +namespace EntropyPhotonNumber +open QuantumTrace + +def numberVectorMoment {n : ℕ} (x : Fock n) : ℝ≥0∞ := + basisMoment (numberBasis n) (fun k => (totalNumber k : ℝ≥0∞)) x + +theorem numberVectorMoment_eq {n : ℕ} (x : Fock n) : + numberVectorMoment x = ∑' k, ENNReal.ofReal ((totalNumber k : ℝ)*‖inner ℂ (numberBasis n k) x‖^2) := by + simp only [numberVectorMoment, basisMoment, ENNReal.ofReal_mul (Nat.cast_nonneg _), + ENNReal.ofReal_natCast] + +theorem finiteVectorEnergy_iff {n : ℕ} (x : Fock n) : + FiniteVectorEnergy x ↔ numberVectorMoment x < ⊤ := by + rw [numberVectorMoment_eq] + constructor + · intro hx + exact hx.tsum_ofReal_lt_top + · intro hx + have hs := ENNReal.summable_toReal hx.ne + simpa only [FiniteVectorEnergy, ENNReal.toReal_ofReal (mul_nonneg (Nat.cast_nonneg _) (sq_nonneg _))] using hs + +theorem numberVectorMoment_ofReal {n : ℕ} (x : Fock n) (hx : FiniteVectorEnergy x) : + numberVectorMoment x = ENNReal.ofReal (vectorEnergy x) := by + rw [numberVectorMoment_eq] + exact (ENNReal.ofReal_tsum_of_nonneg + (fun _ => mul_nonneg (Nat.cast_nonneg _) (sq_nonneg _)) hx).symm + +theorem thermal_log_constants {n : ℕ} {r κ : ℝ} (hr : 0 < r) (hκ : 0 < κ) (hκ1 : κ ≤ 1) : + 0 ≤ -Real.log κ+n*Real.log (r+1) ∧ 0 < Real.log ((r+1)/r) := by + have hr1 : 1 ≤ r+1 := by linarith + have hlogκ := Real.log_nonpos hκ.le hκ1 + have hlogr := Real.log_nonneg hr1 + constructor + · exact add_nonneg (neg_nonneg.mpr hlogκ) (mul_nonneg (Nat.cast_nonneg _) hlogr) + · apply Real.log_pos + exact (lt_div_iff₀ hr).mpr (by linarith) + +theorem negativeLog_extended_le_thermal {n : ℕ} (ρ : State n) {r κ : ℝ} (hr : 0 < r) + (hκ : 0 < κ) (hκ1 : κ ≤ 1) (hle : (κ : ℂ) • (thermalState n r hr).op ≤ ρ.op) + {J : Type*} (b : HilbertBasis J ℂ (Fock n)) (p : J → ℝ) (hp : ∀ j, 0 < p j) + (hs : HasSum p 1) (he : ∀ j, ρ.op (b j) = (p j : ℂ) • b j) (x : Fock n) : + basisMoment b (fun j => ENNReal.ofReal (-Real.log (p j))) x ≤ + ENNReal.ofReal (-Real.log κ+n*Real.log (r+1))*ENNReal.ofReal (‖x‖^2)+ + ENNReal.ofReal (Real.log ((r+1)/r))*numberVectorMoment x := by + have hc := thermal_log_constants (n := n) hr hκ hκ1 + have hp1 (j : J) : p j ≤ 1 := hs.tsum_eq ▸ hs.summable.le_tsum j (fun i _ => (hp i).le) + have hlog (j : J) : 0 ≤ -Real.log (p j) := neg_nonneg.mpr (Real.log_nonpos (hp j).le (hp1 j)) + by_cases hx : FiniteVectorEnergy x + · have h := negativeLog_le_thermal ρ hr hκ hκ1 hle b p hp hs he x hx + have hE : 0 ≤ vectorEnergy x := tsum_nonneg (fun _ => mul_nonneg (Nat.cast_nonneg _) (sq_nonneg _)) + rw [basisMoment_ofReal b _ hlog x h.1, numberVectorMoment_ofReal x hx, + ← ENNReal.ofReal_mul hc.1, ← ENNReal.ofReal_mul hc.2.le, ← ENNReal.ofReal_add (mul_nonneg hc.1 (sq_nonneg _)) (mul_nonneg hc.2.le hE)] + exact ENNReal.ofReal_le_ofReal h.2 + · have he : numberVectorMoment x = ⊤ := not_lt_top_iff.mp (fun h => hx ((finiteVectorEnergy_iff x).mpr h)) + rw [he, ENNReal.mul_top (ENNReal.ofReal_pos.mpr hc.2).ne', add_top] + exact le_top + +theorem negativeLog_expectation_le_thermal {n : ℕ} (ρ σ : State n) {r κ : ℝ} (hr : 0 < r) + (hκ : 0 < κ) (hκ1 : κ ≤ 1) (hle : (κ : ℂ) • (thermalState n r hr).op ≤ ρ.op) + {J : Type*} (b : HilbertBasis J ℂ (Fock n)) (p : J → ℝ) (hp : ∀ j, 0 < p j) + (hs : HasSum p 1) (he : ∀ j, ρ.op (b j) = (p j : ℂ) • b j) : + basisExpectation b (fun j => ENNReal.ofReal (-Real.log (p j))) σ.op ≤ + ENNReal.ofReal (-Real.log κ+n*Real.log (r+1))+ + ENNReal.ofReal (Real.log ((r+1)/r))* + basisExpectation (numberBasis n) (fun k => (totalNumber k : ℝ≥0∞)) σ.op := + basisExpectation_le_of_form_le (numberBasis n) b _ _ + (negativeLog_extended_le_thermal ρ hr hκ hκ1 hle b p hp hs he) σ.positive (trace_one_numberBasis σ) + +end EntropyPhotonNumber + +namespace QuantumTrace +variable {E : Type*} [NormedAddCommGroup E] [InnerProductSpace ℂ E] [CompleteSpace E] +variable {I J K : Type*} + +def sliceMoment (b : HilbertBasis J ℂ E) (w : J → ℝ≥0∞) + (V : I → E →L[ℂ] E) (x : E) : ℝ≥0∞ := ∑' i, basisMoment b w (V i x) + +omit [CompleteSpace E] in +theorem sliceMoment_bound (a : HilbertBasis K ℂ E) (b : HilbertBasis J ℂ E) + (v : K → ℝ≥0∞) (w : J → ℝ≥0∞) (V : I → E →L[ℂ] E) {A B F : ℝ≥0∞} + (hform : ∀ x, basisMoment b w x ≤ A*ENNReal.ofReal (‖x‖^2)+B*basisMoment a v x) + (hn : ∀ x, HasSum (fun i => ‖V i x‖^2) (‖x‖^2)) + (he : ∀ x, (∑' i, basisMoment a v (V i x)) ≤ + basisMoment a v x+F*ENNReal.ofReal (‖x‖^2)) (x : E) : + sliceMoment b w V x ≤ (A+B*F)*ENNReal.ofReal (‖x‖^2)+B*basisMoment a v x := by + have hN : (∑' i, ENNReal.ofReal (‖V i x‖^2)) = ENNReal.ofReal (‖x‖^2) := by + rw [← ENNReal.ofReal_tsum_of_nonneg (fun _ => sq_nonneg _) (hn x).summable, (hn x).tsum_eq] + calc + _ ≤ ∑' i, (A*ENNReal.ofReal (‖V i x‖^2)+B*basisMoment a v (V i x)) := + ENNReal.tsum_le_tsum (fun i => hform (V i x)) + _ = A*ENNReal.ofReal (‖x‖^2)+B*(∑' i, basisMoment a v (V i x)) := by + rw [ENNReal.tsum_add, ENNReal.tsum_mul_left, ENNReal.tsum_mul_left, hN] + _ ≤ A*ENNReal.ofReal (‖x‖^2)+B*(basisMoment a v x+F*ENNReal.ofReal (‖x‖^2)) := by + exact add_le_add le_rfl (mul_le_mul' le_rfl (he x)) + _ = _ := by ring + +def sliceCoordinates (b : HilbertBasis J ℂ E) (w : J → ℝ) + (V : I → E →L[ℂ] E) (S : E →L[ℂ] E) (ij : I × J) : E →ₗ[ℂ] ℂ := + (Real.sqrt (w ij.2) : ℂ) • ((innerSL ℂ (b ij.2)).toLinearMap.comp + ((V ij.1).toLinearMap.comp S.toLinearMap)) + +omit [CompleteSpace E] in +theorem sliceCoordinates_square (b : HilbertBasis J ℂ E) (w : J → ℝ) (hw : ∀ j, 0 ≤ w j) + (V : I → E →L[ℂ] E) (S : E →L[ℂ] E) (ij : I × J) (x : E) : + ‖sliceCoordinates b w V S ij x‖^2 = w ij.2*‖inner ℂ (b ij.2) (V ij.1 (S x))‖^2 := by + change ‖(Real.sqrt (w ij.2) : ℂ)*inner ℂ (b ij.2) (V ij.1 (S x))‖^2 = _ + rw [norm_mul, mul_pow, Complex.norm_real, Real.norm_eq_abs, sq_abs, Real.sq_sqrt (hw _)] + +omit [CompleteSpace E] in +theorem sliceCoordinates_sum (b : HilbertBasis J ℂ E) (w : J → ℝ) (hw : ∀ j, 0 ≤ w j) + (V : I → E →L[ℂ] E) (S : E →L[ℂ] E) (x : E) : + (∑' ij, ENNReal.ofReal (‖sliceCoordinates b w V S ij x‖^2)) = + sliceMoment b (fun j => ENNReal.ofReal (w j)) V (S x) := by + simp only [sliceCoordinates_square b w hw, ENNReal.ofReal_mul (hw _), + ENNReal.tsum_prod', sliceMoment, basisMoment] + +theorem sliceMoment_bounded_representation (b : HilbertBasis J ℂ E) (w : J → ℝ) + (hw : ∀ j, 0 ≤ w j) (V : I → E →L[ℂ] E) (S : E →L[ℂ] E) {C : ℝ} (hC : 0 ≤ C) + (hb : ∀ x, sliceMoment b (fun j => ENNReal.ofReal (w j)) V (S x) ≤ + ENNReal.ofReal (C*‖x‖^2)) : + ∃ B : E →L[ℂ] E, B.IsPositive ∧ ∀ x, + ENNReal.ofReal (inner ℂ x (B x)).re = + sliceMoment b (fun j => ENNReal.ofReal (w j)) V (S x) := by + let f := sliceCoordinates b w V S + have hs (x : E) : Summable (fun ij => ‖f ij x‖^2) := by + have hfinite : (∑' ij, ENNReal.ofReal (‖f ij x‖^2)) ≠ ⊤ := by + rw [sliceCoordinates_sum b w hw] + exact ne_top_of_le_ne_top ENNReal.ofReal_ne_top (hb x) + simpa only [ENNReal.toReal_ofReal (sq_nonneg _)] using ENNReal.summable_toReal hfinite + have hbound (x : E) : (∑' ij, ‖f ij x‖^2) ≤ C*‖x‖^2 := by + apply (ENNReal.ofReal_le_ofReal_iff (mul_nonneg hC (sq_nonneg _))).mp + rw [ENNReal.ofReal_tsum_of_nonneg (fun _ => sq_nonneg _) (hs x), sliceCoordinates_sum b w hw] + exact hb x + obtain ⟨B,hB,he⟩ := SquareAnalysis.exists_positive_representation f hs hC hbound + refine ⟨B,hB,fun x => ?_⟩ + rw [he, ENNReal.ofReal_tsum_of_nonneg (fun _ => sq_nonneg _) (hs x)] + exact sliceCoordinates_sum b w hw V S x + +end QuantumTrace + +namespace EntropyPhotonNumber + +section +open QuantumTrace TensorLp + +theorem numberVectorMoment_eq_tensor {n : ℕ} (x : Fock n) : + numberVectorMoment x = vectorMoment (fun k => (totalNumber k : ℝ≥0∞)) x := by + simp only [numberVectorMoment, basisMoment, vectorMoment, numberBasis_apply, numberKet, + lp.inner_single_left, RCLike.inner_apply, map_one, mul_one] + +theorem numberWeight_eq {n : ℕ} (i : NumberIndex n) : + numberWeight i = 1+(totalNumber i : ℝ) := by + simp only [numberWeight, totalNumber, Nat.cast_sum] + +def energyInverse (n : ℕ) : Fock n →L[ℂ] Fock n := + inversePower rootNumberWeight rootNumberWeight_one_le 1 + +theorem energyInverse_quadratic {n : ℕ} (x : Fock n) (i : NumberIndex n) : + numberWeight i*‖energyInverse n x i‖^2 = ‖x i‖^2 := by + have hW : 0 < numberWeight i := lt_of_lt_of_le (by norm_num) (numberWeight_one_le i) + change numberWeight i*‖(((rootNumberWeight i^1)⁻¹ : ℝ) : ℂ)*x i‖^2 = _ + rw [pow_one, norm_mul, mul_pow, Complex.norm_real, Real.norm_eq_abs, sq_abs, + inv_pow, rootNumberWeight, Real.sq_sqrt hW.le] + rw [← mul_assoc, mul_inv_cancel₀ hW.ne', one_mul] + +theorem energyInverse_norm {n : ℕ} (x : Fock n) : ‖energyInverse n x‖ ≤ ‖x‖ := by + calc + _ ≤ ‖energyInverse n‖*‖x‖ := (energyInverse n).le_opNorm x + _ ≤ 1*‖x‖ := mul_le_mul_of_nonneg_right (inversePower_norm_le _ _ _) (norm_nonneg _) + _ = _ := one_mul _ + +theorem energyInverse_finiteEnergy {n : ℕ} (x : Fock n) : FiniteVectorEnergy (energyInverse n x) := by + change Summable _ + simp only [numberBasis_apply, numberKet, lp.inner_single_left, RCLike.inner_apply, map_one, mul_one] + apply Summable.of_nonneg_of_le (fun _ => mul_nonneg (Nat.cast_nonneg _) (sq_nonneg _)) _ + (SquareAnalysis.hasSum_square x).summable + intro i + calc + _ ≤ numberWeight i*‖energyInverse n x i‖^2 := by + apply mul_le_mul_of_nonneg_right _ (sq_nonneg _) + rw [numberWeight_eq] + linarith + _ = _ := energyInverse_quadratic x i + +theorem energyInverse_energy {n : ℕ} (x : Fock n) : + vectorEnergy (energyInverse n x) ≤ ‖x‖^2 := by + rw [vectorEnergy, ← (SquareAnalysis.hasSum_square x).tsum_eq] + apply (energyInverse_finiteEnergy x).tsum_le_tsum _ (SquareAnalysis.hasSum_square x).summable + intro i + simp only [numberBasis_apply, numberKet, lp.inner_single_left, RCLike.inner_apply, map_one, mul_one] + calc + _ ≤ numberWeight i*‖energyInverse n x i‖^2 := by + apply mul_le_mul_of_nonneg_right _ (sq_nonneg _) + rw [numberWeight_eq] + linarith + _ = _ := energyInverse_quadratic x i + +theorem logarithmic_slice_representation {n : ℕ} (ρ : State n) {r κ : ℝ} (hr : 0 < r) + (hκ : 0 < κ) (hκ1 : κ ≤ 1) (hle : (κ : ℂ) • (thermalState n r hr).op ≤ ρ.op) + {J I : Type*} (b : HilbertBasis J ℂ (Fock n)) (p : J → ℝ) (hp : ∀ j, 0 < p j) + (hs : HasSum p 1) (he : ∀ j, ρ.op (b j) = (p j : ℂ) • b j) + (V : I → Fock n →L[ℂ] Fock n) (F : ℝ) (hF : 0 ≤ F) + (hV : ∀ x, HasSum (fun i => ‖V i x‖^2) (‖x‖^2)) + (hE : ∀ x, (∑' i, vectorMoment (fun k => (totalNumber k : ℝ≥0∞)) (V i x)) ≤ + vectorMoment (fun k => (totalNumber k : ℝ≥0∞)) x+ENNReal.ofReal F*ENNReal.ofReal (‖x‖^2)) : + ∃ B : Fock n →L[ℂ] Fock n, B.IsPositive ∧ ∀ x, + ENNReal.ofReal (inner ℂ x (B x)).re = + sliceMoment b (fun j => ENNReal.ofReal (-Real.log (p j))) V (energyInverse n x) := by + let A := -Real.log κ+n*Real.log (r+1) + let D := Real.log ((r+1)/r) + have hc := thermal_log_constants (n := n) hr hκ hκ1 + have hA : 0 ≤ A := hc.1 + have hD : 0 ≤ D := hc.2.le + have hp1 (j : J) : p j ≤ 1 := hs.tsum_eq ▸ hs.summable.le_tsum j (fun i _ => (hp i).le) + have hlog (j : J) : 0 ≤ -Real.log (p j) := neg_nonneg.mpr (Real.log_nonpos (hp j).le (hp1 j)) + apply sliceMoment_bounded_representation b (fun j => -Real.log (p j)) hlog V (energyInverse n) + (C := A+D*F+D) (by positivity) + intro x + have h := sliceMoment_bound (numberBasis n) b (fun k => (totalNumber k : ℝ≥0∞)) + (fun j => ENNReal.ofReal (-Real.log (p j))) V + (negativeLog_extended_le_thermal ρ hr hκ hκ1 hle b p hp hs he) hV + (by intro y; simpa only [← numberVectorMoment_eq_tensor, numberVectorMoment] using hE y) (energyInverse n x) + have hN : ‖energyInverse n x‖^2 ≤ ‖x‖^2 := + pow_le_pow_left₀ (norm_nonneg _) (energyInverse_norm x) 2 + have hE0 : 0 ≤ vectorEnergy (energyInverse n x) := + tsum_nonneg (fun _ => mul_nonneg (Nat.cast_nonneg _) (sq_nonneg _)) + change _ ≤ (ENNReal.ofReal A+ENNReal.ofReal D*ENNReal.ofReal F)* + ENNReal.ofReal (‖energyInverse n x‖^2)+ENNReal.ofReal D*numberVectorMoment (energyInverse n x) at h + rw [numberVectorMoment_ofReal _ (energyInverse_finiteEnergy x), ← ENNReal.ofReal_mul hD, + ← ENNReal.ofReal_add hA (mul_nonneg hD hF), + ← ENNReal.ofReal_mul (add_nonneg hA (mul_nonneg hD hF)), + ← ENNReal.ofReal_mul hD, ← ENNReal.ofReal_add + (mul_nonneg (add_nonneg hA (mul_nonneg hD hF)) (sq_nonneg _)) (mul_nonneg hD hE0)] at h + apply h.trans + apply ENNReal.ofReal_le_ofReal + have hn := mul_le_mul_of_nonneg_left hN (add_nonneg hA (mul_nonneg hD hF)) + have he' := mul_le_mul_of_nonneg_left (energyInverse_energy x) hD + nlinarith + +end + +open QuantumTrace + +theorem number_form_representation (n : ℕ) : + ∃ B : Fock n →L[ℂ] Fock n, B.IsPositive ∧ ∀ x, + ENNReal.ofReal (inner ℂ x (B x)).re = numberVectorMoment (energyInverse n x) := by + have hb (x : Fock n) : sliceMoment (numberBasis n) (fun k => ENNReal.ofReal (totalNumber k)) + (fun _ : Unit => (1 : Fock n →L[ℂ] Fock n)) (energyInverse n x) ≤ + ENNReal.ofReal (1*‖x‖^2) := by + simp only [sliceMoment, one_apply_eq_self, tsum_fintype, + Fintype.sum_unique, ENNReal.ofReal_natCast] + change numberVectorMoment (energyInverse n x) ≤ _ + rw [numberVectorMoment_ofReal _ (energyInverse_finiteEnergy x), one_mul] + exact ENNReal.ofReal_le_ofReal (energyInverse_energy x) + obtain ⟨B,hB,h⟩ := sliceMoment_bounded_representation (numberBasis n) + (fun k => (totalNumber k : ℝ)) (fun _ => Nat.cast_nonneg _) + (fun _ : Unit => (1 : Fock n →L[ℂ] Fock n)) (energyInverse n) (by norm_num : (0:ℝ) ≤ 1) hb + refine ⟨B,hB,fun x => ?_⟩ + simpa only [sliceMoment, one_apply_eq_self, tsum_fintype, + Fintype.sum_unique, ENNReal.ofReal_natCast, numberVectorMoment] using h x + +theorem combined_form_representation {n : ℕ} {J I : Type*} + (b : HilbertBasis J ℂ (Fock n)) (w : J → ℝ≥0∞) (V : I → Fock n →L[ℂ] Fock n) + {B : Fock n →L[ℂ] Fock n} (hB : B.IsPositive) + (he : ∀ x, ENNReal.ofReal (inner ℂ x (B x)).re = sliceMoment b w V (energyInverse n x)) + {α β : ℝ} (hα : 0 ≤ α) (hβ : 0 ≤ β) : + ∃ C : Fock n →L[ℂ] Fock n, C.IsPositive ∧ ∀ x, + ENNReal.ofReal (inner ℂ x (C x)).re = + ENNReal.ofReal α*sliceMoment b w V (energyInverse n x)+ + ENNReal.ofReal β*numberVectorMoment (energyInverse n x) := by + obtain ⟨D,hD,hDe⟩ := number_form_representation n + let C := (α : ℂ) • B+(β : ℂ) • D + have hC : C.IsPositive := (hB.smul_of_nonneg (by exact_mod_cast hα)).add + (hD.smul_of_nonneg (by exact_mod_cast hβ)) + refine ⟨C,hC,fun x => ?_⟩ + have hx : (inner ℂ x (C x)).re = α*(inner ℂ x (B x)).re+β*(inner ℂ x (D x)).re := by + change (inner ℂ x ((α : ℂ) • B x+(β : ℂ) • D x)).re = _ + simp + have hBx : 0 ≤ (inner ℂ x (B x)).re := hB.re_inner_nonneg_right x + have hDx : 0 ≤ (inner ℂ x (D x)).re := hD.re_inner_nonneg_right x + rw [hx, ENNReal.ofReal_add (mul_nonneg hα hBx) (mul_nonneg hβ hDx), ENNReal.ofReal_mul hα, + ENNReal.ofReal_mul hβ, he, hDe] + +theorem gibbsFactor_quadratic {ι : Type*} (s : ι → ℝ) (hs : ∀ i, 1 ≤ s i) + (k : ℝ) (B : SequenceHilbert ι →L[ℂ] SequenceHilbert ι) (x : SequenceHilbert ι) : + (inner ℂ x (gibbsFactor s hs k B x)).re = k*‖x‖^2+ + (inner ℂ (inversePower s hs 3 x) (B (inversePower s hs 3 x))).re := by + have hh : inner ℂ (inversePower s hs 3 x) (B (inversePower s hs 3 x)) = + inner ℂ x (inversePower s hs 3 (B (inversePower s hs 3 x))) := + (inversePower_positive s hs 3).isSymmetric x (B (inversePower s hs 3 x)) + change (inner ℂ x (k • x+inversePower s hs 3 (B (inversePower s hs 3 x)))).re = _ + rw [inner_add_right, Complex.add_re, ← hh] + rw [inner_smul_right_eq_smul, Complex.smul_re] + simp [inner_self_eq_norm_sq_to_K, ← Complex.ofReal_pow] + +theorem energyInverse_mul_three {n : ℕ} (x : Fock n) : + energyInverse n (inversePower rootNumberWeight rootNumberWeight_one_le 3 x) = + inversePower rootNumberWeight rootNumberWeight_one_le 4 x := by + exact congrArg (fun T : Fock n →L[ℂ] Fock n => T x) + (inversePower_mul rootNumberWeight rootNumberWeight_one_le 1 3) + +theorem gibbsFactor_slice_form {n : ℕ} {J I : Type*} + (b : HilbertBasis J ℂ (Fock n)) (w : J → ℝ≥0∞) (V : I → Fock n →L[ℂ] Fock n) + {B : Fock n →L[ℂ] Fock n} (hB : B.IsPositive) {α β : ℝ} + (he : ∀ x, ENNReal.ofReal (inner ℂ x (B x)).re = + ENNReal.ofReal α*sliceMoment b w V (energyInverse n x)+ + ENNReal.ofReal β*numberVectorMoment (energyInverse n x)) + {k : ℝ} (hk : 0 ≤ k) (x : Fock n) : + ENNReal.ofReal (inner ℂ x (gibbsFactor rootNumberWeight rootNumberWeight_one_le k B x)).re = + ENNReal.ofReal k*ENNReal.ofReal (‖x‖^2)+ + (ENNReal.ofReal α*sliceMoment b w V (inversePower rootNumberWeight rootNumberWeight_one_le 4 x)+ + ENNReal.ofReal β*numberVectorMoment (inversePower rootNumberWeight rootNumberWeight_one_le 4 x)) := by + have hBx : 0 ≤ (inner ℂ (inversePower rootNumberWeight rootNumberWeight_one_le 3 x) + (B (inversePower rootNumberWeight rootNumberWeight_one_le 3 x))).re := + hB.re_inner_nonneg_right _ + rw [gibbsFactor_quadratic, ENNReal.ofReal_add (mul_nonneg hk (sq_nonneg _)) + hBx, ENNReal.ofReal_mul hk, he, energyInverse_mul_three] + +end EntropyPhotonNumber + +namespace QuantumTrace + +section +variable {ι J L : Type*} + +theorem gibbs_form_energy_identity (s : ι → ℝ) (hs : ∀ i, 1 ≤ s i) + (A : SequenceHilbert ι →L[ℂ] SequenceHilbert ι) (hA : IsStrictlyPositive A) + (c : HilbertBasis L ℂ (SequenceHilbert ι)) (u : L → ℝ) (hu : ∀ l, 0 < u l) + (heU : ∀ l, (inversePower s hs 4*Ring.inverse A*inversePower s hs 4) (c l) = + (((u l)⁻¹ : ℝ) : ℂ) • c l) + (b : HilbertBasis J ℂ (SequenceHilbert ι)) + (T : SequenceHilbert ι →L[ℂ] SequenceHilbert ι) (p : J → ℝ) + (hp : ∀ j, 0 ≤ p j) (heT : ∀ j, T (b j) = (p j : ℂ) • b j) + (hm : Summable (fun i => s i^8*(inner ℂ (sequenceBasis ι i) (T (sequenceBasis ι i))).re)) : + ∃ y : J → SequenceHilbert ι, + (∀ j i, y j i = (s i^4 : ℂ)*((Real.sqrt (p j) : ℂ)*b j i)) ∧ + (∀ j, inversePower s hs 4 (y j) = (Real.sqrt (p j) : ℂ) • b j) ∧ + Summable (fun j => ‖y j‖^2) ∧ + (∑' j, ‖y j‖^2) = ∑' i, s i^8*(inner ℂ (sequenceBasis ι i) (T (sequenceBasis ι i))).re ∧ + Summable (fun j => (inner ℂ (y j) (A (y j))).re) ∧ + HasSum (fun l => u l*(inner ℂ (c l) (T (c l))).re) + (∑' j, (inner ℂ (y j) (A (y j))).re) := by + have hm' : Summable (fun i => (s i^4)^2*(inner ℂ (sequenceBasis ι i) (T (sequenceBasis ι i))).re) := by + simpa only [← pow_mul] using hm + obtain ⟨y, hy, hyS, hyE⟩ := weighted_spectral_vectors b T p hp heT (fun i => s i^4) hm' + have hxy (j : J) : inversePower s hs 4 (y j) = (Real.sqrt (p j) : ℂ) • b j := by + ext i + rw [inversePower_apply, hy] + change (((s i^4)⁻¹ : ℝ) : ℂ)*(((s i^4 : ℝ) : ℂ)*((Real.sqrt (p j) : ℂ)*b j i)) = (Real.sqrt (p j) : ℂ)*b j i + rw [← mul_assoc, ← Complex.ofReal_mul, inv_mul_cancel₀ (pow_ne_zero _ (by linarith [hs i]))] + simp + have hAp : A.IsPositive := ContinuousLinearMap.nonneg_iff_isPositive.mp hA.nonneg + have hsum : Summable (fun j => (inner ℂ (y j) (A (y j))).re) := by + apply Summable.of_nonneg_of_le (fun j => hAp.re_inner_nonneg_right _) _ (hyS.mul_left ‖A‖) + intro j + calc + _ ≤ ‖inner ℂ (y j) (A (y j))‖ := Complex.re_le_norm _ + _ ≤ ‖y j‖*‖A (y j)‖ := norm_inner_le_norm _ _ + _ ≤ ‖y j‖*(‖A‖*‖y j‖) := mul_le_mul_of_nonneg_left (A.le_opNorm _) (norm_nonneg _) + _ = _ := by ring + let f : J × L → ℝ := fun a => u a.2*(p a.1*‖inner ℂ (c a.2) (b a.1)‖^2) + have hf0 (a : J × L) : 0 ≤ f a := mul_nonneg (hu _).le (mul_nonneg (hp _) (sq_nonneg _)) + have hrow (j : J) : HasSum (fun l => f (j,l)) (inner ℂ (y j) (A (y j))).re := by + have hh := inverse_factor_form_parseval c A (inversePower s hs 4) hA + (inversePower_positive s hs 4).isSymmetric (inversePower_injective s hs 4) u hu heU (y j) + rw [hxy] at hh + simpa only [f, inner_smul_right, norm_mul, Complex.norm_real, Real.norm_eq_abs, + mul_pow, sq_abs, Real.sq_sqrt (hp j)] using hh + have hf : Summable f := by + apply (summable_prod_of_nonneg hf0).mpr + refine ⟨fun j => (hrow j).summable, ?_⟩ + simpa only [(hrow _).tsum_eq] using hsum + have hcol (l : L) : HasSum (fun j => f (j,l)) (u l*(inner ℂ (c l) (T (c l))).re) := by + have hh := (hasSum_quadratic_eigenbasis b T p heT (c l)).mul_left (u l) + simpa only [f, norm_inner_symm] using hh + have hh : HasSum (fun l => u l*(inner ℂ (c l) (T (c l))).re) + (∑' j, (inner ℂ (y j) (A (y j))).re) := by + have hcols : Summable (fun l => u l*(inner ℂ (c l) (T (c l))).re) := by + have hc : Summable (fun l => ∑' j, f (j,l)) := hf.prod_symm.prod + simpa only [(hcol _).tsum_eq] using hc + have heq : (∑' l, u l*(inner ℂ (c l) (T (c l))).re) = + ∑' j, (inner ℂ (y j) (A (y j))).re := calc + _ = ∑' l, ∑' j, f (j,l) := tsum_congr (fun l => (hcol l).tsum_eq.symm) + _ = ∑' j, ∑' l, f (j,l) := Summable.tsum_comm (f := fun j l => f (j,l)) hf + _ = _ := tsum_congr (fun j => (hrow j).tsum_eq) + exact heq ▸ hcols.hasSum + refine ⟨y, ?_, hxy, hyS, ?_, hsum, hh⟩ + · intro j i + simpa only [Complex.ofReal_pow] using hy j i + · simpa only [← pow_mul] using hyE + +end + +variable {E : Type*} [NormedAddCommGroup E] [InnerProductSpace ℂ E] [CompleteSpace E] +variable {I J K : Type*} + +theorem sliceMoment_ensemble (b : HilbertBasis K ℂ E) (w : K → ℝ≥0∞) + (V : I → E →L[ℂ] E) {v : J → E} + (hs : Summable (fun ij : I × J => ‖V ij.1 (v ij.2)‖^2)) : + (∑' j, sliceMoment b w V (v j)) = + basisExpectation b w (TraceEnsemble.operator (fun ij : I × J => V ij.1 (v ij.2))) := by + rw [basisExpectation_ensemble b w hs] + simp only [sliceMoment, ENNReal.tsum_prod'] + exact ENNReal.tsum_comm + +omit [CompleteSpace E] in +theorem basisMoment_smul (b : HilbertBasis K ℂ E) (w : K → ℝ≥0∞) (x : E) (c : ℂ) : + basisMoment b w (c • x) = ENNReal.ofReal (‖c‖^2)*basisMoment b w x := by + simp only [basisMoment, inner_smul_right, norm_mul, mul_pow, + ENNReal.ofReal_mul (sq_nonneg _)] + rw [← ENNReal.tsum_mul_left] + apply tsum_congr + intro i + ring + +omit [CompleteSpace E] in +theorem sliceMoment_smul (b : HilbertBasis K ℂ E) (w : K → ℝ≥0∞) + (V : I → E →L[ℂ] E) (x : E) (c : ℂ) : + sliceMoment b w V (c • x) = ENNReal.ofReal (‖c‖^2)*sliceMoment b w V x := by + simp only [sliceMoment, map_smul, basisMoment_smul, ENNReal.tsum_mul_left] + +end QuantumTrace + +namespace EntropyPhotonNumber +open QuantumTrace TensorLp + +theorem firstKraus_slice_expectation {n : ℕ} {K : Type*} + (η : ℝ) (hη : η ∈ Set.Icc 0 1) (ρ σ : State n) + (b : HilbertBasis K ℂ (Fock n)) (w : K → ℝ≥0∞) : + (∑' j, sliceMoment b w (firstKraus η hη σ) (rootColumn ρ j)) = + basisExpectation b w (beamOutput η hη ρ σ).op := by + rw [sliceMoment_ensemble b w (firstKraus η hη σ) + (TraceEnsemble.kraus_hasSum (firstKraus_norm η hη σ) (rootColumn_norm ρ)).summable, + firstKraus_ensemble η hη ρ σ (rootColumn ρ) (rootColumn_norm ρ) (rootColumn_operator ρ)] + +theorem secondKraus_slice_expectation {n : ℕ} {K : Type*} + (η : ℝ) (hη : η ∈ Set.Icc 0 1) (ρ σ : State n) + (b : HilbertBasis K ℂ (Fock n)) (w : K → ℝ≥0∞) : + (∑' j, sliceMoment b w (secondKraus η hη ρ) (rootColumn σ j)) = + basisExpectation b w (beamOutput η hη ρ σ).op := by + rw [sliceMoment_ensemble b w (secondKraus η hη ρ) + (TraceEnsemble.kraus_hasSum (secondKraus_norm η hη ρ) (rootColumn_norm σ)).summable, + secondKraus_ensemble η hη ρ σ (rootColumn σ) (rootColumn_norm σ) (rootColumn_operator σ)] + +theorem composedKraus_first_ensemble {n : ℕ} {J : Type*} + (η θ : ℝ) (hη : η ∈ Set.Icc 0 1) (hθ : θ ∈ Set.Icc 0 1) (ρ σ τ : State n) + (v : J → Fock n) (hv : HasSum (fun j => ‖v j‖^2) 1) + (he : TraceEnsemble.operator v = ρ.op) : + TraceEnsemble.operator (fun z : ((NumberIndex n × NumberIndex n) × + (NumberIndex n × NumberIndex n)) × J => + composeKraus (firstKraus θ hθ τ) (firstKraus η hη σ) z.1 (v z.2)) = + (beamOutput θ hθ (beamOutput η hη ρ σ) τ).op := by + have hV := TraceEnsemble.kraus_hasSum (firstKraus_norm η hη σ) hv + have heV := firstKraus_ensemble η hη ρ σ v hv he + have heU := firstKraus_ensemble θ hθ (beamOutput η hη ρ σ) τ _ hV heV + exact (composeKraus_ensemble (firstKraus θ hθ τ) (firstKraus η hη σ) v).trans heU + +theorem composed_slice_expectation {n : ℕ} {K : Type*} + (η θ : ℝ) (hη : η ∈ Set.Icc 0 1) (hθ : θ ∈ Set.Icc 0 1) (ρ σ τ : State n) + (b : HilbertBasis K ℂ (Fock n)) (w : K → ℝ≥0∞) : + (∑' j, sliceMoment b w (composeKraus (firstKraus θ hθ τ) (firstKraus η hη σ)) + (rootColumn ρ j)) = + basisExpectation b w (beamOutput θ hθ (beamOutput η hη ρ σ) τ).op := by + have hV := composeKraus_norm (firstKraus θ hθ τ) (firstKraus η hη σ) + (firstKraus_norm θ hθ τ) (firstKraus_norm η hη σ) + rw [sliceMoment_ensemble b w _ (TraceEnsemble.kraus_hasSum hV (rootColumn_norm ρ)).summable, + composedKraus_first_ensemble η θ hη hθ ρ σ τ (rootColumn ρ) (rootColumn_norm ρ) + (rootColumn_operator ρ)] + +end EntropyPhotonNumber + +namespace QuantumTrace +variable {E : Type*} [NormedAddCommGroup E] [InnerProductSpace ℂ E] +variable {J : Type*} + +theorem basisExpectation_ofReal (b : HilbertBasis J ℂ E) (w : J → ℝ) + (hw : ∀ j, 0 ≤ w j) {T : E →L[ℂ] E} (hp : T.IsPositive) + (hs : Summable (fun j => w j*(inner ℂ (b j) (T (b j))).re)) : + basisExpectation b (fun j => ENNReal.ofReal (w j)) T = + ENNReal.ofReal (∑' j, w j*(inner ℂ (b j) (T (b j))).re) := by + simp only [basisExpectation, ← ENNReal.ofReal_mul (hw _)] + exact (ENNReal.ofReal_tsum_of_nonneg (fun j => mul_nonneg (hw j) + (hp.re_inner_nonneg_right _)) hs).symm + +theorem basisExpectation_finite_iff (b : HilbertBasis J ℂ E) (w : J → ℝ) + (hw : ∀ j, 0 ≤ w j) {T : E →L[ℂ] E} (hp : T.IsPositive) : + basisExpectation b (fun j => ENNReal.ofReal (w j)) T < ⊤ ↔ + Summable (fun j => w j*(inner ℂ (b j) (T (b j))).re) := by + simp only [basisExpectation, ← ENNReal.ofReal_mul (hw _)] + constructor + · intro h + have hs := ENNReal.summable_toReal h.ne + convert hs using 1 + funext j + exact (ENNReal.toReal_ofReal (mul_nonneg (hw j) (hp.re_inner_nonneg_right (b j)))).symm + · intro h + exact h.tsum_ofReal_lt_top + +end QuantumTrace + +namespace TraceEnsemble +variable {E : Type*} [NormedAddCommGroup E] [InnerProductSpace ℂ E] [CompleteSpace E] +variable {J : Type*} + +theorem diagonalVector_operator (b : HilbertBasis J ℂ E) (p : J → ℝ) + (hp : ∀ j, 0 ≤ p j) (hs : Summable p) (T : E →L[ℂ] E) + (he : ∀ j, T (b j) = (p j : ℂ) • b j) : operator (diagonalVector b p) = T := by + have hb (j : J) : operator (diagonalVector b p) (b j) = T (b j) := by + rw [diagonalVector_eigen b p hp hs j, he] + ext x + have hh := (operator (diagonalVector b p)).hasSum (b.hasSum_repr x) + apply hh.unique + convert T.hasSum (b.hasSum_repr x) using 1 + funext j + simp only [ContinuousLinearMap.map_smul, hb] + +end TraceEnsemble + +namespace EntropyPhotonNumber +open QuantumTrace TraceEnsemble + +theorem sequenceBasis_numberKet {n : ℕ} (i : NumberIndex n) : + sequenceBasis (NumberIndex n) i = numberKet i := by + apply lp.ext + funext j + by_cases h : i = j + · subst j; simp [sequenceBasis_apply, numberKet, lp.single_apply] + · simp [sequenceBasis_apply, numberKet, lp.single_apply, h] + +theorem gibbs_slice_trace {n : ℕ} {J L K I : Type*} + (c : HilbertBasis L ℂ (Fock n)) (u : L → ℝ) (hu : ∀ l, 0 < u l) + (b : HilbertBasis J ℂ (Fock n)) (p : J → ℝ) (hp : ∀ j, 0 ≤ p j) (hs : HasSum p 1) + (ρ : State n) (heρ : ∀ j, ρ.op (b j) = (p j : ℂ) • b j) (hm : FiniteMoment 4 ρ) + (a : HilbertBasis K ℂ (Fock n)) (w : K → ℝ≥0∞) + (V : I → Fock n →L[ℂ] Fock n) (hV : ∀ x, HasSum (fun i => ‖V i x‖^2) (‖x‖^2)) + (σ : State n) + (heσ : TraceEnsemble.operator (fun z : I × J => V z.1 (diagonalVector b p z.2)) = σ.op) + {B : Fock n →L[ℂ] Fock n} (hB : B.IsPositive) {α β : ℝ} + (hform : ∀ x, ENNReal.ofReal (inner ℂ x (B x)).re = + ENNReal.ofReal α*sliceMoment a w V (energyInverse n x)+ + ENNReal.ofReal β*numberVectorMoment (energyInverse n x)) + {k : ℝ} (hk : 0 < k) + (heK : ∀ l, gibbsInverse rootNumberWeight rootNumberWeight_one_le k B (c l) = + (((u l)⁻¹ : ℝ) : ℂ) • c l) : + ∃ E : ℝ, HasSum (fun l => u l*(inner ℂ (c l) (ρ.op (c l))).re) E ∧ + ENNReal.ofReal E = ENNReal.ofReal k*ENNReal.ofReal (numberMoment 4 ρ)+ + (ENNReal.ofReal α*basisExpectation a w σ.op+ + ENNReal.ofReal β*ENNReal.ofReal (energy ρ)) := by + classical + have hm' : Summable (fun i => rootNumberWeight i^8* + (inner ℂ (sequenceBasis _ i) (ρ.op (sequenceBasis _ i))).re) := by + simpa only [rootNumberWeight_pow_eight, numberWeight_eq, sequenceBasis_numberKet, + FiniteMoment, entry] using hm + obtain ⟨y, _, hy, hyS, hyE, hyA, hK⟩ := gibbs_form_energy_identity + rootNumberWeight rootNumberWeight_one_le (gibbsFactor rootNumberWeight rootNumberWeight_one_le k B) + (gibbsFactor_strictPositive _ _ hk hB) c u hu heK b ρ.op p hp heρ hm' + have hnorm : (∑' j, ‖y j‖^2) = numberMoment 4 ρ := by + simpa only [rootNumberWeight_pow_eight, numberWeight_eq, numberMoment, + sequenceBasis_numberKet, entry] using hyE + have hv : HasSum (fun j => ‖diagonalVector b p j‖^2) 1 := by + simpa only [diagonalVector_norm_sq b p hp] using hs + have hρv := diagonalVector_operator b p hp hs.summable ρ.op heρ + have hSv : (∑' j, sliceMoment a w V (diagonalVector b p j)) = basisExpectation a w σ.op := by + rw [sliceMoment_ensemble a w V (TraceEnsemble.kraus_hasSum hV hv).summable, heσ] + have hNv : (∑' j, numberVectorMoment (diagonalVector b p j)) = ENNReal.ofReal (energy ρ) := by + rw [show (∑' j, numberVectorMoment (diagonalVector b p j)) = + basisExpectation (numberBasis n) (fun i => (totalNumber i : ℝ≥0∞)) + (TraceEnsemble.operator (diagonalVector b p)) from + (basisExpectation_ensemble _ _ hv.summable).symm, hρv] + have he := basisExpectation_ofReal (numberBasis n) (fun i => (totalNumber i : ℝ)) + (fun _ => Nat.cast_nonneg _) ρ.positive (by simpa only [FiniteEnergy, numberBasis_apply, entry] using (finiteMoment_finiteEnergy (by norm_num : 1 ≤ 4) hm)) + simpa only [ENNReal.ofReal_natCast, energy, numberBasis_apply, entry] using he + let A := gibbsFactor rootNumberWeight rootNumberWeight_one_le k B + have hA : A.IsPositive := ContinuousLinearMap.nonneg_iff_isPositive.mp + (gibbsFactor_strictPositive _ _ hk hB).nonneg + refine ⟨_, hK, ?_⟩ + change ENNReal.ofReal (∑' j, (inner ℂ (y j) (A (y j))).re) = _ + have hsum : ENNReal.ofReal (∑' j, (inner ℂ (y j) (A (y j))).re) = + ∑' j, ENNReal.ofReal (inner ℂ (y j) (A (y j))).re := + ENNReal.ofReal_tsum_of_nonneg (fun j => hA.re_inner_nonneg_right (y j)) hyA + rw [hsum] + have hQ (j : J) : ENNReal.ofReal (inner ℂ (y j) (A (y j))).re = + ENNReal.ofReal k*ENNReal.ofReal (‖y j‖^2)+ + (ENNReal.ofReal α*sliceMoment a w V (diagonalVector b p j)+ + ENNReal.ofReal β*numberVectorMoment (diagonalVector b p j)) := by + have hh := gibbsFactor_slice_form a w V hB hform hk.le (y j) + simpa only [hy, diagonalVector, A] using hh + simp_rw [hQ] + rw [ENNReal.tsum_add, ENNReal.tsum_add, ENNReal.tsum_mul_left, + ENNReal.tsum_mul_left, ENNReal.tsum_mul_left, hSv, hNv, + ← ENNReal.ofReal_tsum_of_nonneg (fun _ => sq_nonneg _) hyS, hnorm] + +end EntropyPhotonNumber + +end + +end OAI diff --git a/lean/OAI/InformationTheory/PhotonNumber/FiniteVariation.lean b/lean/OAI/InformationTheory/PhotonNumber/FiniteVariation.lean new file mode 100644 index 0000000000000000000000000000000000000000..c33f6bdcf8903581b425304cdfc4f3e336a5d48d --- /dev/null +++ b/lean/OAI/InformationTheory/PhotonNumber/FiniteVariation.lean @@ -0,0 +1,2881 @@ +import OAI.InformationTheory.PhotonNumber.GibbsVariational +import OAI.InformationTheory.PhotonNumber.Contraction + +namespace OAI + +noncomputable section + +section +open scoped ComplexConjugate +open scoped BigOperators ComplexConjugate +open scoped BigOperators ComplexConjugate ENNReal Topology +open MeasureTheory +open scoped BigOperators +open MvPolynomial +open scoped BigOperators ComplexConjugate Classical +open Submodule +open scoped ENNReal +open Module +open scoped ComplexConjugate BigOperators Matrix + +namespace FiniteBlock + +section +variable {I J E : Type*} [Fintype I] +variable [NormedAddCommGroup E] [InnerProductSpace ℂ E] + +def embedLinear (b : HilbertBasis (I ⊕ J) ℂ E) : EuclideanSpace ℂ I →ₗ[ℂ] E := + (EuclideanSpace.basisFun I ℂ).toBasis.constr ℂ (fun i => b (Sum.inl i)) + +@[simp] theorem embedLinear_basis (b : HilbertBasis (I ⊕ J) ℂ E) (i : I) : + embedLinear b ((EuclideanSpace.basisFun I ℂ) i) = b (Sum.inl i) := by + exact (EuclideanSpace.basisFun I ℂ).toBasis.constr_basis ℂ _ i + +theorem embedLinear_orthonormal (b : HilbertBasis (I ⊕ J) ℂ E) : + Orthonormal ℂ (embedLinear b ∘ (EuclideanSpace.basisFun I ℂ).toBasis) := by + have he : embedLinear b ∘ (EuclideanSpace.basisFun I ℂ).toBasis = (fun i => b (Sum.inl i)) := by + funext i + exact embedLinear_basis b i + rw [he] + exact b.orthonormal.comp Sum.inl Sum.inl_injective + +def embed (b : HilbertBasis (I ⊕ J) ℂ E) : EuclideanSpace ℂ I →ₗᵢ[ℂ] E := + (embedLinear b).isometryOfOrthonormal (v := (EuclideanSpace.basisFun I ℂ).toBasis) + (EuclideanSpace.basisFun I ℂ).orthonormal (embedLinear_orthonormal b) + +@[simp] theorem embed_basis (b : HilbertBasis (I ⊕ J) ℂ E) (i : I) : + embed b ((EuclideanSpace.basisFun I ℂ) i) = b (Sum.inl i) := embedLinear_basis b i + +theorem embed_apply (b : HilbertBasis (I ⊕ J) ℂ E) (x : EuclideanSpace ℂ I) : + embed b x = ∑ i, x i • b (Sum.inl i) := by + conv_lhs => rw [← (EuclideanSpace.basisFun I ℂ).sum_repr x] + simp only [map_sum, map_smul, embed_basis] + rfl + +variable (b : HilbertBasis (I ⊕ J) ℂ E) (c : OrthonormalBasis I ℂ (EuclideanSpace ℂ I)) + +def vectors : I ⊕ J → E := Sum.elim (fun i => embed b (c i)) (fun j => b (Sum.inr j)) + +theorem vectors_orthonormal : Orthonormal ℂ (vectors b c) := by + classical + rw [orthonormal_iff_ite] + intro i j + cases i with + | inl i => + cases j with + | inl j => simpa only [vectors, Sum.elim_inl, (embed b).inner_map_map, + Sum.inl.injEq] using (orthonormal_iff_ite.mp c.orthonormal i j) + | inr j => + simp only [vectors, Sum.elim_inl, Sum.elim_inr, Sum.inl_ne_inr, ↓reduceIte, + embed_apply, sum_inner, inner_smul_left, orthonormal_iff_ite.mp b.orthonormal, + mul_zero, Finset.sum_const_zero] + | inr i => + cases j with + | inl j => + simp only [vectors, Sum.elim_inl, Sum.elim_inr, Sum.inr_ne_inl, ↓reduceIte, + embed_apply, inner_sum, inner_smul_right, orthonormal_iff_ite.mp b.orthonormal, + mul_zero, Finset.sum_const_zero] + | inr j => simpa only [vectors, Sum.elim_inr, Sum.inr.injEq] using + (orthonormal_iff_ite.mp b.orthonormal (Sum.inr i) (Sum.inr j)) + +variable [CompleteSpace E] + +def basis : HilbertBasis (I ⊕ J) ℂ E := HilbertBasis.mk (vectors_orthonormal b c) (by + have hsub : Submodule.span ℂ (Set.range b) ≤ Submodule.span ℂ (Set.range (vectors b c)) := by + apply Submodule.span_le.mpr + rintro _ ⟨i,rfl⟩ + cases i with + | inr j => exact Submodule.subset_span ⟨Sum.inr j,rfl⟩ + | inl i => + rw [← embed_basis b i, ← c.sum_repr ((EuclideanSpace.basisFun I ℂ) i), map_sum] + apply Submodule.sum_mem + intro j _ + rw [map_smul] + exact Submodule.smul_mem _ _ (Submodule.subset_span ⟨Sum.inl j,rfl⟩) + exact b.dense_span.ge.trans (Submodule.topologicalClosure_mono hsub)) + +@[simp] theorem basis_inl (i : I) : basis b c (Sum.inl i) = embed b (c i) := + congrFun (HilbertBasis.coe_mk _ _) _ +@[simp] theorem basis_inr (j : J) : basis b c (Sum.inr j) = b (Sum.inr j) := + congrFun (HilbertBasis.coe_mk _ _) _ + +omit [CompleteSpace E] in + +def block (M : Matrix I I ℂ) : E →L[ℂ] E := + ∑ i, ∑ j, M i j • InnerProductSpace.rankOne ℂ (b (Sum.inl i)) (b (Sum.inl j)) + +omit [CompleteSpace E] in +theorem inner_basis_embed (i : I) (x : EuclideanSpace ℂ I) : + inner ℂ (b (Sum.inl i)) (embed b x) = x i := by + classical + simp [embed_apply, orthonormal_iff_ite.mp b.orthonormal] + +omit [CompleteSpace E] in +theorem block_embed (M : Matrix I I ℂ) (x : EuclideanSpace ℂ I) : + block b M (embed b x) = embed b (WithLp.toLp 2 (M *ᵥ ⇑x)) := by + classical + simp only [block, sum_apply, smul_apply, + InnerProductSpace.rankOne_apply, inner_basis_embed, smul_smul] + rw [embed_apply] + simp only [Matrix.mulVec, dotProduct, Finset.sum_smul] + +omit [CompleteSpace E] in +theorem block_tail (M : Matrix I I ℂ) (j : J) : block b M (b (Sum.inr j)) = 0 := by + classical + simp [block, InnerProductSpace.rankOne_apply, orthonormal_iff_ite.mp b.orthonormal] + +variable [DecidableEq I] + +theorem block_eigen (M : Matrix I I ℂ) (hM : M.IsHermitian) (i : I) : + block b M (basis b hM.eigenvectorBasis (Sum.inl i)) = + (hM.eigenvalues i : ℂ) • basis b hM.eigenvectorBasis (Sum.inl i) := by + rw [basis_inl, block_embed, hM.mulVec_eigenvectorBasis] + simp only [WithLp.toLp_smul, WithLp.toLp_ofLp] + change embed b ((hM.eigenvalues i : ℂ) • hM.eigenvectorBasis i) = _ + exact map_smul (embed b) _ _ + +end + +open NormedSpace Matrix +open scoped Matrix.Norms.Operator +variable {I : Type*} [Fintype I] [DecidableEq I] + +theorem exp_spectral (M : Matrix I I ℂ) (hM : M.IsHermitian) : + exp M = (hM.eigenvectorUnitary : Matrix I I ℂ) * + Matrix.diagonal (fun i => (Real.exp (hM.eigenvalues i) : ℂ)) * + star (hM.eigenvectorUnitary : Matrix I I ℂ) := by + let f := Unitary.conjStarAlgAut ℂ (Matrix I I ℂ) hM.eigenvectorUnitary + have hf : Continuous f := f.toAlgEquiv.toLinearMap.continuous_of_finiteDimensional + calc + exp M = exp (f (Matrix.diagonal (RCLike.ofReal ∘ hM.eigenvalues))) := + congrArg NormedSpace.exp hM.spectral_theorem + _ = f (exp (Matrix.diagonal (RCLike.ofReal ∘ hM.eigenvalues))) := (map_exp f hf _).symm + _ = f (Matrix.diagonal (fun i => (Real.exp (hM.eigenvalues i) : ℂ))) := by + congr 1 + rw [Matrix.exp_diagonal] + congr 1 + funext i + simp [Pi.coe_exp, Complex.exp_eq_exp_ℂ, Complex.ofReal_exp] + _ = _ := rfl + +theorem exp_eigenvector (M : Matrix I I ℂ) (hM : M.IsHermitian) (i : I) : + exp M *ᵥ ⇑(hM.eigenvectorBasis i) = + (Real.exp (hM.eigenvalues i) : ℂ) • ⇑(hM.eigenvectorBasis i) := by + rw [exp_spectral M hM, ← Matrix.mulVec_mulVec, hM.star_eigenvectorUnitary_mulVec, + ← Matrix.mulVec_mulVec, Matrix.diagonal_mulVec_single] + rw [show (Real.exp (hM.eigenvalues i) : ℂ)*1 = + (Real.exp (hM.eigenvalues i) : ℂ) • (1:ℂ) by rfl, + Pi.single_smul, Matrix.mulVec_smul, hM.eigenvectorUnitary_mulVec] + +theorem trace_exp (M : Matrix I I ℂ) (hM : M.IsHermitian) : + (Matrix.trace (exp M)).re = ∑ i, Real.exp (hM.eigenvalues i) := by + rw [exp_spectral M hM, Matrix.trace_mul_comm] + rw [← Matrix.mul_assoc, Unitary.coe_star_mul_self, Matrix.one_mul, Matrix.trace_diagonal] + simp only [Complex.re_sum, Complex.ofReal_re] + +def partition {J : Type*} (p : I ⊕ J → ℝ) (M : Matrix I I ℂ) (hM : M.IsHermitian) : ℝ := + (∑' j, p (Sum.inr j)) + ∑ i, Real.exp (hM.eigenvalues i) + +def weights {J : Type*} (p : I ⊕ J → ℝ) (M : Matrix I I ℂ) (hM : M.IsHermitian) : I ⊕ J → ℝ := + Sum.elim (fun i => Real.exp (hM.eigenvalues i) / partition p M hM) + (fun j => p (Sum.inr j) / partition p M hM) + +theorem partition_pos {J : Type*} (p : I ⊕ J → ℝ) (hp : ∀ j, 0 < p j) + (hs : HasSum p 1) (M : Matrix I I ℂ) (hM : M.IsHermitian) : + 0 < partition p M hM := by + classical + have htail := hs.summable.comp_injective Sum.inr_injective + obtain ⟨j,hj⟩ : ∃ j, p j ≠ 0 := by + by_contra! h + have he : p = fun _ => 0 := funext h + have : HasSum p 0 := by rw [he]; exact hasSum_zero + exact zero_ne_one (this.unique hs) + unfold partition + cases j with + | inl i => + exact add_pos_of_nonneg_of_pos (tsum_nonneg (fun j => (hp (Sum.inr j)).le)) + (Finset.sum_pos' (fun j _ => (Real.exp_pos _).le) ⟨i,Finset.mem_univ _,Real.exp_pos _⟩) + | inr j => + exact add_pos_of_pos_of_nonneg + ((hp (Sum.inr j)).trans_le (htail.le_tsum j (fun i _ => (hp _).le))) + (Finset.sum_nonneg (fun _ _ => (Real.exp_pos _).le)) + +theorem weights_pos {J : Type*} (p : I ⊕ J → ℝ) (hp : ∀ j, 0 < p j) + (hs : HasSum p 1) (M : Matrix I I ℂ) (hM : M.IsHermitian) (j : I ⊕ J) : + 0 < weights p M hM j := by + cases j with + | inl i => exact div_pos (Real.exp_pos _) (partition_pos p hp hs M hM) + | inr j => exact div_pos (hp _) (partition_pos p hp hs M hM) + +theorem weights_hasSum {J : Type*} (p : I ⊕ J → ℝ) (hp : ∀ j, 0 < p j) + (hs : HasSum p 1) (M : Matrix I I ℂ) (hM : M.IsHermitian) : + HasSum (weights p M hM) 1 := by + have ht := hs.summable.comp_injective Sum.inr_injective + have hf : HasSum (Sum.elim (fun i => Real.exp (hM.eigenvalues i)) (fun j => p (Sum.inr j))) + ((∑ i, Real.exp (hM.eigenvalues i)) + ∑' j, p (Sum.inr j)) := + HasSum.sum (hasSum_fintype _) ht.hasSum + have hh := hf.div_const (partition p M hM) + convert! hh using 1 + · funext j + cases j <;> rfl + · rw [add_comm] + change 1 = partition p M hM / partition p M hM + exact (div_self (partition_pos p hp hs M hM).ne').symm + +end FiniteBlock + +namespace QuantumTrace +variable {E : Type*} [NormedAddCommGroup E] [InnerProductSpace ℂ E] +variable {I J : Type*} + +theorem basisMoment_smul_coeff (b : HilbertBasis I ℂ E) (w : I → ℝ≥0∞) (z : ℂ) (x : E) : + basisMoment b w (z • x) = ENNReal.ofReal (‖z‖^2)*basisMoment b w x := by + simp only [basisMoment, inner_smul_right, norm_mul, mul_pow, + ENNReal.ofReal_mul (sq_nonneg _)] + rw [← ENNReal.tsum_mul_left] + congr 1 + funext i + exact mul_left_comm _ _ _ + +theorem basisMoment_add_le (b : HilbertBasis I ℂ E) (w : I → ℝ≥0∞) (x y : E) : + basisMoment b w (x+y) ≤ 2*basisMoment b w x+2*basisMoment b w y := by + simp only [basisMoment, ← ENNReal.tsum_mul_left, ← ENNReal.tsum_add] + apply ENNReal.tsum_le_tsum + intro i + have hn : ‖inner ℂ (b i) (x+y)‖^2 ≤ + 2*‖inner ℂ (b i) x‖^2+2*‖inner ℂ (b i) y‖^2 := by + rw [inner_add_right] + calc + _ ≤ (‖inner ℂ (b i) x‖+‖inner ℂ (b i) y‖)^2 := + pow_le_pow_left₀ (norm_nonneg _) (norm_add_le _ _) _ + _ ≤ _ := by nlinarith [sq_nonneg (‖inner ℂ (b i) x‖-‖inner ℂ (b i) y‖)] + calc + _ ≤ w i*ENNReal.ofReal (2*‖inner ℂ (b i) x‖^2+2*‖inner ℂ (b i) y‖^2) := + mul_le_mul' le_rfl (ENNReal.ofReal_le_ofReal hn) + _ = _ := by + rw [ENNReal.ofReal_add (by positivity) (by positivity)] + simp only [ENNReal.ofReal_mul (by norm_num : (0:ℝ)≤2), ENNReal.ofReal_ofNat] + ring + +def momentDomain (b : HilbertBasis I ℂ E) (w : I → ℝ≥0∞) : Submodule ℂ E where + carrier := {x | basisMoment b w x < ⊤} + zero_mem' := by simp [basisMoment] + add_mem' := by + intro x y hx hy + exact (basisMoment_add_le b w x y).trans_lt (ENNReal.add_lt_top.mpr + ⟨ENNReal.mul_lt_top (by norm_num) hx, ENNReal.mul_lt_top (by norm_num) hy⟩) + smul_mem' := by + intro z x hx + change basisMoment b w (z • x) < ⊤ + rw [basisMoment_smul_coeff] + exact ENNReal.mul_lt_top ENNReal.ofReal_lt_top hx + +@[simp] theorem mem_momentDomain (b : HilbertBasis I ℂ E) (w : I → ℝ≥0∞) (x : E) : + x ∈ momentDomain b w ↔ basisMoment b w x < ⊤ := Iff.rfl + +variable [CompleteSpace E] + +theorem basisExpectation_diagonal (b : HilbertBasis I ℂ E) (w : I → ℝ≥0∞) + (c : HilbertBasis J ℂ E) (p : J → ℝ) (hp : ∀ j, 0 ≤ p j) (hs : Summable p) : + basisExpectation b w (TraceEnsemble.operator (TraceEnsemble.diagonalVector c p)) = + ∑' j, ENNReal.ofReal (p j)*basisMoment b w (c j) := by + rw [basisExpectation_ensemble b w (by simpa only [TraceEnsemble.diagonalVector_norm_sq c p hp] using hs)] + congr 1 + funext j + rw [TraceEnsemble.diagonalVector, basisMoment_smul_coeff] + simp only [Complex.norm_real, Real.norm_eq_abs, abs_of_nonneg (Real.sqrt_nonneg _), + Real.sq_sqrt (hp _)] + +theorem eigenvector_moment_finite (b : HilbertBasis I ℂ E) (w : I → ℝ≥0∞) + (c : HilbertBasis J ℂ E) (p : J → ℝ) (hp : ∀ j, 0 < p j) (hs : Summable p) + (hm : basisExpectation b w (TraceEnsemble.operator (TraceEnsemble.diagonalVector c p)) < ⊤) + (j : J) : basisMoment b w (c j) < ⊤ := by + rw [basisExpectation_diagonal b w c p (fun j => (hp j).le) hs] at hm + have hj := (ENNReal.le_tsum j).trans_lt hm + by_contra hn + have he : basisMoment b w (c j) = ⊤ := top_le_iff.mp (not_lt.mp hn) + rw [he] at hj + simp [ENNReal.ofReal_pos.mpr (hp j) |>.ne'] at hj + +end QuantumTrace + +namespace TraceEnsemble +variable {E : Type*} [NormedAddCommGroup E] [InnerProductSpace ℂ E] [CompleteSpace E] +variable {I J : Type*} + +omit [CompleteSpace E] in +theorem summable_basis_square (b : HilbertBasis J ℂ E) {v : I → E} + (hv : Summable (fun i => ‖v i‖^2)) : + Summable (fun ij : I × J => ‖inner ℂ (b ij.2) (v ij.1)‖^2) := by + rw [summable_prod_of_nonneg (fun _ => sq_nonneg _)] + exact ⟨fun i => (basis_hasSum_norm_sq b (v i)).summable, + by simpa only [(basis_hasSum_norm_sq b _).tsum_eq] using hv⟩ + +omit [CompleteSpace E] in +theorem summable_map_square {v : I → E} (hv : Summable (fun i => ‖v i‖^2)) + (Z : E →L[ℂ] E) : Summable (fun i => ‖Z (v i)‖^2) := by + apply Summable.of_nonneg_of_le (fun _ => sq_nonneg _) _ (hv.mul_left (‖Z‖^2)) + intro i + simpa only [mul_pow] using pow_le_pow_left₀ (norm_nonneg _) (Z.le_opNorm (v i)) 2 + +omit [CompleteSpace E] in +theorem summable_trace_pair (b : HilbertBasis J ℂ E) {v : I → E} + (hv : Summable (fun i => ‖v i‖^2)) (Z : E →L[ℂ] E) : + Summable (fun ij : I × J => inner ℂ (v ij.1) (b ij.2)*inner ℂ (b ij.2) (Z (v ij.1))) := by + apply Summable.of_norm + apply Summable.of_nonneg_of_le (fun _ => norm_nonneg _) _ + (((summable_basis_square b hv).add + (summable_basis_square b (summable_map_square hv Z))).div_const 2) + intro ij + simp only [norm_mul, norm_inner_symm (v ij.1) (b ij.2)] + nlinarith [sq_nonneg (‖inner ℂ (b ij.2) (v ij.1)‖-‖inner ℂ (b ij.2) (Z (v ij.1))‖)] + +def expectation (v : I → E) (Z : E →L[ℂ] E) : ℂ := + ∑' i, inner ℂ (v i) (Z (v i)) + +omit [CompleteSpace E] in +theorem hasSum_expectation {v : I → E} (hv : Summable (fun i => ‖v i‖^2)) + (Z : E →L[ℂ] E) : HasSum (fun i => inner ℂ (v i) (Z (v i))) (expectation v Z) := + (summable_expectation_norm hv Z).of_norm.hasSum + +theorem hasSum_expectation_basis (b : HilbertBasis J ℂ E) {v : I → E} + (hv : Summable (fun i => ‖v i‖^2)) (Z : E →L[ℂ] E) : + HasSum (fun j => inner ℂ (b j) (Z (operator v (b j)))) (expectation v Z) := by + have hd := summable_trace_pair b hv Z + have hrow (i : I) : HasSum (fun j => inner ℂ (v i) (b j)*inner ℂ (b j) (Z (v i))) + (inner ℂ (v i) (Z (v i))) := b.hasSum_inner_mul_inner (v i) (Z (v i)) + have hcol (j : J) : HasSum (fun i => inner ℂ (v i) (b j)*inner ℂ (b j) (Z (v i))) + (inner ℂ (b j) (Z (operator v (b j)))) := by + have hh := (((ContinuousLinearMap.apply ℂ E (b j)).hasSum (hasSum_rankOne hv)).mapL Z).mapL + (innerSL ℂ (b j)) + simpa only [ContinuousLinearMap.apply_apply, InnerProductSpace.rankOne_apply, + map_smul, innerSL_apply_apply, inner_smul_right, smul_eq_mul] using hh + have he : (∑' ij : I × J, inner ℂ (v ij.1) (b ij.2)*inner ℂ (b ij.2) (Z (v ij.1))) = + expectation v Z := by + rw [hd.tsum_prod] + simp only [(hrow _).tsum_eq, expectation] + rw [← he] + exact ((Equiv.prodComm J I).hasSum_iff.2 hd.hasSum).prod_fiberwise hcol + +theorem expectation_eq_of_operator_eq (b : HilbertBasis J ℂ E) + {K : Type*} {v : I → E} {w : K → E} + (hv : Summable (fun i => ‖v i‖^2)) (hw : Summable (fun j => ‖w j‖^2)) + (h : operator v = operator w) (Z : E →L[ℂ] E) : expectation v Z = expectation w Z := by + have hh := hasSum_expectation_basis b hv Z + rw [h] at hh + exact hh.unique (hasSum_expectation_basis b hw Z) + +end TraceEnsemble + +namespace EntropyPhotonNumber + +section +open TraceEnsemble + +def expectation {n : ℕ} (ρ : State n) (Z : Fock n →L[ℂ] Fock n) : ℂ := + TraceEnsemble.expectation (rootColumn ρ) Z + +theorem expectation_ensemble {n : ℕ} (ρ : State n) {I : Type*} (v : I → Fock n) + (hv : Summable (fun i => ‖v i‖^2)) (he : TraceEnsemble.operator v = ρ.op) + (Z : Fock n →L[ℂ] Fock n) : expectation ρ Z = TraceEnsemble.expectation v Z := by + exact TraceEnsemble.expectation_eq_of_operator_eq (channelNumberBasis n) (rootColumn_norm ρ).summable hv + ((rootColumn_operator ρ).trans he.symm) Z + +theorem hasSum_expectation_basis {n : ℕ} {J : Type*} (b : HilbertBasis J ℂ (Fock n)) + (ρ : State n) (Z : Fock n →L[ℂ] Fock n) : + HasSum (fun j => inner ℂ (b j) (Z (ρ.op (b j)))) (expectation ρ Z) := by + simpa only [rootColumn_operator, expectation] using + TraceEnsemble.hasSum_expectation_basis b (rootColumn_norm ρ).summable Z + +theorem expectation_add {n : ℕ} (ρ : State n) (X Y : Fock n →L[ℂ] Fock n) : + expectation ρ (X+Y) = expectation ρ X+expectation ρ Y := by + exact (hasSum_expectation_basis (channelNumberBasis n) ρ (X+Y)).unique (by + simpa only [add_apply, inner_add_right] using + (hasSum_expectation_basis (channelNumberBasis n) ρ X).add (hasSum_expectation_basis (channelNumberBasis n) ρ Y)) + +theorem expectation_smul {n : ℕ} (ρ : State n) (a : ℂ) (Z : Fock n →L[ℂ] Fock n) : + expectation ρ (a • Z) = a*expectation ρ Z := by + exact (hasSum_expectation_basis (channelNumberBasis n) ρ (a • Z)).unique (by + simpa only [smul_apply, inner_smul_right] using + (hasSum_expectation_basis (channelNumberBasis n) ρ Z).mul_left a) + +end + +open QuantumTrace TraceEnsemble + +def spectralState {n : ℕ} {J : Type*} (b : HilbertBasis J ℂ (Fock n)) + (p : J → ℝ) (hp : ∀ j, 0 ≤ p j) (hs : HasSum p 1) : State n where + op := TraceEnsemble.operator (diagonalVector b p) + positive := TraceEnsemble.positive (by simpa only [diagonalVector_norm_sq b p hp] using hs.summable) + trace_one := by + simpa only [numberBasis_apply, entry] using TraceEnsemble.trace + (by simpa only [diagonalVector_norm_sq b p hp] using hs : + HasSum (fun j => ‖diagonalVector b p j‖^2) 1) (numberBasis n) + +@[simp] theorem spectralState_eigen {n : ℕ} {J : Type*} (b : HilbertBasis J ℂ (Fock n)) + (p : J → ℝ) (hp : ∀ j, 0 ≤ p j) (hs : HasSum p 1) (j : J) : + (spectralState b p hp hs).op (b j) = (p j : ℂ) • b j := + diagonalVector_eigen b p hp hs.summable j + +def blockState {n : ℕ} {I J : Type*} [Fintype I] [DecidableEq I] + (b : HilbertBasis (I ⊕ J) ℂ (Fock n)) (p : I ⊕ J → ℝ) + (hp : ∀ j, 0 < p j) (hs : HasSum p 1) (M : Matrix I I ℂ) (hM : M.IsHermitian) : State n := + spectralState (FiniteBlock.basis b hM.eigenvectorBasis) (FiniteBlock.weights p M hM) + (fun j => (FiniteBlock.weights_pos p hp hs M hM j).le) (FiniteBlock.weights_hasSum p hp hs M hM) + +end EntropyPhotonNumber + +namespace FiniteBlock + +section +open QuantumTrace +variable {I J E K : Type*} [Fintype I] [DecidableEq I] +variable [NormedAddCommGroup E] [InnerProductSpace ℂ E] [CompleteSpace E] + +omit [DecidableEq I] in + theorem basis_domain (a : HilbertBasis K ℂ E) (w : K → ℝ≥0∞) + (b : HilbertBasis (I ⊕ J) ℂ E) (p : I ⊕ J → ℝ) (hp : ∀ j, 0 < p j) + (hs : HasSum p 1) + (hm : basisExpectation a w (TraceEnsemble.operator (TraceEnsemble.diagonalVector b p)) < ⊤) + (c : OrthonormalBasis I ℂ (EuclideanSpace ℂ I)) (j : I ⊕ J) : + basisMoment a w (basis b c j) < ⊤ := by + have hv (j : I ⊕ J) : b j ∈ momentDomain a w := + eigenvector_moment_finite a w b p hp hs.summable hm j + change basis b c j ∈ momentDomain a w + cases j with + | inr j => simpa only [basis_inr] using hv (Sum.inr j) + | inl i => + rw [basis_inl, embed_apply] + exact Submodule.sum_mem _ (fun j _ => Submodule.smul_mem _ _ (hv (Sum.inl j))) + + theorem tilted_moment_finite (a : HilbertBasis K ℂ E) (w : K → ℝ≥0∞) + (b : HilbertBasis (I ⊕ J) ℂ E) (p : I ⊕ J → ℝ) (hp : ∀ j, 0 < p j) + (hs : HasSum p 1) + (hm : basisExpectation a w (TraceEnsemble.operator (TraceEnsemble.diagonalVector b p)) < ⊤) + (M : Matrix I I ℂ) (hM : M.IsHermitian) : + basisExpectation a w (TraceEnsemble.operator + (TraceEnsemble.diagonalVector (basis b hM.eigenvectorBasis) (weights p M hM))) < ⊤ := by + rw [basisExpectation_diagonal a w _ _ (fun j => (weights_pos p hp hs M hM j).le) + (weights_hasSum p hp hs M hM).summable] + let P := (ENNReal.ofReal (partition p M hM))⁻¹ + have hP : P < ⊤ := by + exact ENNReal.inv_lt_top.mpr (ENNReal.ofReal_pos.mpr (partition_pos p hp hs M hM)) + have htail : (∑' j, ENNReal.ofReal (p (Sum.inr j))*basisMoment a w (b (Sum.inr j))) < ⊤ := by + rw [basisExpectation_diagonal a w b p (fun j => (hp j).le) hs.summable] at hm + exact (ENNReal.tsum_comp_le_tsum_of_injective Sum.inr_injective _).trans_lt hm + have hh : HasSum (fun j : I ⊕ J => ENNReal.ofReal (weights p M hM j)* + basisMoment a w (basis b hM.eigenvectorBasis j)) + ((∑ i, ENNReal.ofReal (weights p M hM (Sum.inl i))* + basisMoment a w (basis b hM.eigenvectorBasis (Sum.inl i)))+ + ∑' j, ENNReal.ofReal (weights p M hM (Sum.inr j))* + basisMoment a w (basis b hM.eigenvectorBasis (Sum.inr j))) := + HasSum.sum (hasSum_fintype _) ENNReal.summable.hasSum + rw [hh.tsum_eq] + apply ENNReal.add_lt_top.mpr + constructor + · exact ENNReal.sum_lt_top.mpr (fun i _ => ENNReal.mul_lt_top ENNReal.ofReal_lt_top + (basis_domain a w b p hp hs hm hM.eigenvectorBasis (Sum.inl i))) + · have he (j : J) : ENNReal.ofReal (weights p M hM (Sum.inr j))* + basisMoment a w (basis b hM.eigenvectorBasis (Sum.inr j)) = + P*(ENNReal.ofReal (p (Sum.inr j))*basisMoment a w (b (Sum.inr j))) := by + rw [basis_inr] + change ENNReal.ofReal (p (Sum.inr j)/partition p M hM)*_ = _ + rw [ENNReal.ofReal_div_of_pos (partition_pos p hp hs M hM), div_eq_mul_inv] + dsimp only [P] + ac_rfl + simp only [he, ENNReal.tsum_mul_left] + exact ENNReal.mul_lt_top hP htail + +end + +variable {I J E : Type*} [Fintype I] [DecidableEq I] +variable [NormedAddCommGroup E] [InnerProductSpace ℂ E] [CompleteSpace E] + +omit [DecidableEq I] in + theorem block_adjoint (b : HilbertBasis (I ⊕ J) ℂ E) (M : Matrix I I ℂ) : + (block b M).adjoint = block b M.conjTranspose := by + classical + simp only [block, map_sum, map_smulₛₗ, InnerProductSpace.adjoint_rankOne] + rw [Finset.sum_comm] + rfl + +omit [DecidableEq I] in + theorem block_symmetric (b : HilbertBasis (I ⊕ J) ℂ E) (M : Matrix I I ℂ) + (hM : M.IsHermitian) : (block b M).IsSymmetric := by + rw [← ContinuousLinearMap.isSelfAdjoint_iff_isSymmetric, isSelfAdjoint_iff] + change (block b M).adjoint = block b M + rw [block_adjoint, hM.eq] + +omit [DecidableEq I] [CompleteSpace E] in + theorem block_add (b : HilbertBasis (I ⊕ J) ℂ E) (M N : Matrix I I ℂ) : + block b (M+N) = block b M+block b N := by + simp [block, add_smul, Finset.sum_add_distrib] + +omit [DecidableEq I] [CompleteSpace E] in + theorem block_smul (b : HilbertBasis (I ⊕ J) ℂ E) (t : ℂ) (M : Matrix I I ℂ) : + block b (t • M) = t • block b M := by + simp [block, Finset.smul_sum, smul_smul] + +end FiniteBlock + +namespace EntropyPhotonNumber +open QuantumTrace +variable {n : ℕ} {I J : Type*} [Fintype I] [DecidableEq I] + + theorem expectation_block_eigen (σ : State n) (b : HilbertBasis (I ⊕ J) ℂ (Fock n)) + (M : Matrix I I ℂ) (hM : M.IsHermitian) : + (expectation σ (FiniteBlock.block b M)).re = ∑ i, hM.eigenvalues i* + (inner ℂ (FiniteBlock.basis b hM.eigenvectorBasis (Sum.inl i)) + (σ.op (FiniteBlock.basis b hM.eigenvectorBasis (Sum.inl i)))).re := by + let a := FiniteBlock.basis b hM.eigenvectorBasis + have hh := (hasSum_expectation_basis a σ (FiniteBlock.block b M)).mapL Complex.reCLM + have he (j : I ⊕ J) : + (inner ℂ (a j) (FiniteBlock.block b M (σ.op (a j)))).re = + Sum.elim (fun i => hM.eigenvalues i*(inner ℂ (a (Sum.inl i)) (σ.op (a (Sum.inl i)))).re) + (fun _ => 0) j := by + erw [← FiniteBlock.block_symmetric b M hM (a j) (σ.op (a j))] + cases j with + | inl i => + change (inner ℂ (FiniteBlock.block b M (FiniteBlock.basis b hM.eigenvectorBasis (Sum.inl i))) (σ.op (a (Sum.inl i)))).re = _ + rw [FiniteBlock.block_eigen b M hM i, inner_smul_left] + simp [a] + | inr j => simp [a, FiniteBlock.block_tail] + have hz : HasSum (Sum.elim + (fun i => hM.eigenvalues i*(inner ℂ (a (Sum.inl i)) (σ.op (a (Sum.inl i)))).re) + (fun _ : J => (0:ℝ))) + (∑ i, hM.eigenvalues i*(inner ℂ (a (Sum.inl i)) (σ.op (a (Sum.inl i)))).re) := by + simpa only [Function.comp_def, Sum.elim_inl, add_zero] using HasSum.sum (f := Sum.elim (fun i => hM.eigenvalues i*(inner ℂ (a (Sum.inl i)) (σ.op (a (Sum.inl i)))).re) (fun _ : J => (0:ℝ))) (hasSum_fintype _) (hasSum_zero : HasSum (fun _ : J => (0:ℝ)) 0) + exact (by simpa only [Complex.reCLM_apply, he] using hh : HasSum _ _).unique hz + + theorem expectation_block_diagonal (σ : State n) (b : HilbertBasis (I ⊕ J) ℂ (Fock n)) + (d : I → ℝ) : + (expectation σ (FiniteBlock.block b (Matrix.diagonal (fun i => (d i : ℂ))))).re = + ∑ i, d i*(inner ℂ (b (Sum.inl i)) (σ.op (b (Sum.inl i)))).re := by + have hs : (Matrix.diagonal (fun i => (d i : ℂ))).IsHermitian := Matrix.isHermitian_diagonal_iff.mpr (by intro i; exact isSelfAdjoint_iff.mpr (Complex.conj_ofReal _)) + have he (j : I ⊕ J) : + (inner ℂ (b j) (FiniteBlock.block b (Matrix.diagonal (fun i => (d i : ℂ))) (σ.op (b j)))).re = + Sum.elim (fun i => d i*(inner ℂ (b (Sum.inl i)) (σ.op (b (Sum.inl i)))).re) + (fun _ => 0) j := by + erw [← FiniteBlock.block_symmetric b _ hs (b j) (σ.op (b j))] + cases j with + | inl i => + have hb : FiniteBlock.block b (Matrix.diagonal (fun i => (d i : ℂ))) (b (Sum.inl i)) = + (d i : ℂ) • b (Sum.inl i) := by + classical + simp only [FiniteBlock.block, sum_apply, smul_apply, + InnerProductSpace.rankOne_apply, orthonormal_iff_ite.mp b.orthonormal] + simp [Matrix.diagonal_apply] + change (inner ℂ (FiniteBlock.block b (Matrix.diagonal (fun i => (d i : ℂ))) (b (Sum.inl i))) (σ.op (b (Sum.inl i)))).re = _ + rw [hb, inner_smul_left] + simp + | inr j => simp [FiniteBlock.block_tail] + have hh := (hasSum_expectation_basis b σ (FiniteBlock.block b (Matrix.diagonal (fun i => (d i : ℂ))))).mapL Complex.reCLM + have hz := HasSum.sum (f := Sum.elim (fun i => d i*(inner ℂ (b (Sum.inl i)) (σ.op (b (Sum.inl i)))).re) (fun _ : J => (0:ℝ))) (hasSum_fintype (fun i => d i*(inner ℂ (b (Sum.inl i)) (σ.op (b (Sum.inl i)))).re)) + (hasSum_zero : HasSum (fun _ : J => (0:ℝ)) 0) + exact (by simpa only [Complex.reCLM_apply, he] using hh : HasSum _ _).unique + (by simpa only [Function.comp_def, Sum.elim_inl, add_zero] using hz) + +end EntropyPhotonNumber + +open scoped ComplexConjugate +open scoped BigOperators ComplexConjugate +open scoped BigOperators ComplexConjugate ENNReal Topology +open MeasureTheory +open scoped BigOperators +open MvPolynomial +open scoped BigOperators ComplexConjugate Classical +open Submodule +open scoped ENNReal +open Module +open scoped ComplexConjugate BigOperators Matrix +open NormedSpace +open scoped Matrix.Norms.Operator + +namespace FiniteBlock +variable {I J E : Type*} [Fintype I] [DecidableEq I] +variable [NormedAddCommGroup E] [InnerProductSpace ℂ E] [CompleteSpace E] + +omit [CompleteSpace E] in + theorem inner_block (b : HilbertBasis (I ⊕ J) ℂ E) (M : Matrix I I ℂ) (x : E) (i : I) : + inner ℂ (b (Sum.inl i)) (block b M x) = ∑ j, M i j*inner ℂ (b (Sum.inl j)) x := by + classical + simp [block, InnerProductSpace.rankOne_apply, orthonormal_iff_ite.mp b.orthonormal] + +omit [CompleteSpace E] [DecidableEq I] in + theorem inner_tail_block (b : HilbertBasis (I ⊕ J) ℂ E) (M : Matrix I I ℂ) (x : E) (j : J) : + inner ℂ (b (Sum.inr j)) (block b M x) = 0 := by + simp [block, InnerProductSpace.rankOne_apply, orthonormal_iff_ite.mp b.orthonormal] + + omit [CompleteSpace E] [DecidableEq I] in + theorem block_sub (b : HilbertBasis (I ⊕ J) ℂ E) (M N : Matrix I I ℂ) : + block b (M-N) = block b M-block b N := by + simp [block, sub_smul, Finset.sum_sub_distrib] + + theorem block_exp_eigen (b : HilbertBasis (I ⊕ J) ℂ E) (M : Matrix I I ℂ) + (hM : M.IsHermitian) (i : I) : + block b (exp M) (basis b hM.eigenvectorBasis (Sum.inl i)) = + (Real.exp (hM.eigenvalues i) : ℂ) • basis b hM.eigenvectorBasis (Sum.inl i) := by + rw [basis_inl, block_embed, exp_eigenvector M hM i] + simp only [WithLp.toLp_smul, WithLp.toLp_ofLp] + change embed b ((Real.exp (hM.eigenvalues i) : ℂ) • hM.eigenvectorBasis i) = _ + exact map_smul (embed b) _ _ + +omit [CompleteSpace E] in + theorem reference_on_block (b : HilbertBasis (I ⊕ J) ℂ E) (p : I ⊕ J → ℝ) + (T : E →L[ℂ] E) (he : ∀ j, T (b j) = (p j : ℂ) • b j) + (x : EuclideanSpace ℂ I) : + T (embed b x) = block b (Matrix.diagonal (fun i => (p (Sum.inl i) : ℂ))) (embed b x) := by + rw [block_embed, embed_apply b x, map_sum, embed_apply] + simp only [map_smul, he, smul_smul] + simp [Matrix.mulVec, dotProduct, Matrix.diagonal_apply, ite_mul, mul_comm] + +end FiniteBlock + +namespace EntropyPhotonNumber + +section +open QuantumTrace TraceEnsemble +variable {n : ℕ} {I J : Type*} [Fintype I] [DecidableEq I] + + theorem expectation_block_matrix (σ : State n) (b : HilbertBasis (I ⊕ J) ℂ (Fock n)) + (M : Matrix I I ℂ) : + expectation σ (FiniteBlock.block b M) = + ∑ i, ∑ j, M i j*inner ℂ (b (Sum.inl j)) (σ.op (b (Sum.inl i))) := by + have he (j : I ⊕ J) : inner ℂ (b j) (FiniteBlock.block b M (σ.op (b j))) = + Sum.elim (fun i => ∑ k, M i k*inner ℂ (b (Sum.inl k)) (σ.op (b (Sum.inl i)))) + (fun _ => 0) j := by + cases j with + | inl i => exact FiniteBlock.inner_block b M _ i + | inr j => exact FiniteBlock.inner_tail_block b M _ j + have hh := hasSum_expectation_basis b σ (FiniteBlock.block b M) + simp only [he] at hh + have ht : HasSum (Sum.elim + (fun i => ∑ k, M i k*inner ℂ (b (Sum.inl k)) (σ.op (b (Sum.inl i)))) (fun _ : J => (0:ℂ))) + ((∑ i, ∑ k, M i k*inner ℂ (b (Sum.inl k)) (σ.op (b (Sum.inl i))))+0) := + HasSum.sum (hasSum_fintype _) hasSum_zero + simpa only [add_zero] using hh.unique ht + + theorem blockState_operator (ρ : State n) (b : HilbertBasis (I ⊕ J) ℂ (Fock n)) + (p : I ⊕ J → ℝ) (hp : ∀ j, 0 < p j) (hs : HasSum p 1) + (he : ∀ j, ρ.op (b j) = (p j : ℂ) • b j) (M : Matrix I I ℂ) (hM : M.IsHermitian) : + (blockState b p hp hs M hM).op = ((FiniteBlock.partition p M hM : ℂ)⁻¹) • + (ρ.op+FiniteBlock.block b (exp M)-FiniteBlock.block b (Matrix.diagonal (fun i => (p (Sum.inl i) : ℂ)))) := by + let a := FiniteBlock.basis b hM.eigenvectorBasis + apply ContinuousLinearMap.ext_on (Submodule.dense_iff_topologicalClosure_eq_top.mpr a.dense_span) + rintro _ ⟨j,rfl⟩ + change (spectralState a _ _ _).op (a j) = _ + rw [spectralState_eigen] + simp only [smul_apply, sub_apply, add_apply] + cases j with + | inl i => + have ht : ρ.op (a (Sum.inl i)) = + FiniteBlock.block b (Matrix.diagonal (fun i => (p (Sum.inl i) : ℂ))) (a (Sum.inl i)) := by + simpa only [a, FiniteBlock.basis_inl] using + FiniteBlock.reference_on_block b p ρ.op he (hM.eigenvectorBasis i) + rw [ht, add_sub_cancel_left] + rw [FiniteBlock.block_exp_eigen b M hM i, smul_smul] + congr 1 + simp only [FiniteBlock.weights, Sum.elim_inl] + push_cast + ring + | inr j => + simp only [a, FiniteBlock.basis_inr, he, FiniteBlock.block_tail, add_zero, sub_zero, + smul_smul, FiniteBlock.weights, Sum.elim_inr] + push_cast + congr 1 + ring + +end + +section +open QuantumTrace +variable {n : ℕ} {I J : Type*} [Fintype I] [DecidableEq I] + +theorem block_crossEntropy (σ : State n) (b : HilbertBasis (I ⊕ J) ℂ (Fock n)) + (p : I ⊕ J → ℝ) (hp : ∀ j, 0 < p j) (hs : HasSum p 1) + (hc : Summable (fun j => (-Real.log (p j))*(inner ℂ (b j) (σ.op (b j))).re)) + (M : Matrix I I ℂ) (hM : M.IsHermitian) : + HasSum (fun j => (-Real.log (FiniteBlock.weights p M hM j))* + (inner ℂ (FiniteBlock.basis b hM.eigenvectorBasis j) + (σ.op (FiniteBlock.basis b hM.eigenvectorBasis j))).re) + (crossEntropy b p σ+ + (expectation σ (FiniteBlock.block b (Matrix.diagonal (fun i => (Real.log (p (Sum.inl i)) : ℂ))))).re- + (expectation σ (FiniteBlock.block b M)).re+Real.log (FiniteBlock.partition p M hM)) := by + let a := FiniteBlock.basis b hM.eigenvectorBasis + let C := ∑' j, (-Real.log (p (Sum.inr j)))*(inner ℂ (b (Sum.inr j)) (σ.op (b (Sum.inr j)))).re + have ht : HasSum (fun j => (-Real.log (p (Sum.inr j)))* + (inner ℂ (b (Sum.inr j)) (σ.op (b (Sum.inr j)))).re) C := + (hc.comp_injective Sum.inr_injective).hasSum + have ho : HasSum (fun j => (-Real.log (p j))*(inner ℂ (b j) (σ.op (b j))).re) + ((∑ i, (-Real.log (p (Sum.inl i)))*(inner ℂ (b (Sum.inl i)) (σ.op (b (Sum.inl i)))).re)+C) := + HasSum.sum (hasSum_fintype _) ht + have hC : C = crossEntropy b p σ+ + (expectation σ (FiniteBlock.block b (Matrix.diagonal (fun i => (Real.log (p (Sum.inl i)) : ℂ))))).re := by + have hh := ho.unique hc.hasSum + rw [expectation_block_diagonal] + dsimp only [crossEntropy] + simp only [neg_mul, Finset.sum_neg_distrib] at hh ⊢ + linarith + have h0 : HasSum (Sum.elim (fun _ : I => (0:ℝ)) + (fun j => (-Real.log (p (Sum.inr j)))*(inner ℂ (b (Sum.inr j)) (σ.op (b (Sum.inr j)))).re)) C := by + simpa only [Function.comp_def, Sum.elim_inr, zero_add] using HasSum.sum (f := Sum.elim (fun _ : I => (0:ℝ)) (fun j => (-Real.log (p (Sum.inr j)))*(inner ℂ (b (Sum.inr j)) (σ.op (b (Sum.inr j)))).re)) (hasSum_zero : HasSum (fun _ : I => (0:ℝ)) 0) ht + have h1 : HasSum (Sum.elim + (fun i => hM.eigenvalues i*(inner ℂ (a (Sum.inl i)) (σ.op (a (Sum.inl i)))).re) + (fun _ : J => (0:ℝ))) (expectation σ (FiniteBlock.block b M)).re := by + rw [expectation_block_eigen] + simpa only [Function.comp_def, Sum.elim_inl, add_zero] using HasSum.sum (f := Sum.elim (fun i => hM.eigenvalues i*(inner ℂ (a (Sum.inl i)) (σ.op (a (Sum.inl i)))).re) (fun _ : J => (0:ℝ))) (hasSum_fintype + (fun i => hM.eigenvalues i*(inner ℂ (a (Sum.inl i)) (σ.op (a (Sum.inl i)))).re)) + (hasSum_zero : HasSum (fun _ : J => (0:ℝ)) 0) + have h2 := (hasSum_trace_basis (numberBasis n) a σ.positive (trace_one_numberBasis σ)).mul_left + (Real.log (FiniteBlock.partition p M hM)) + have hh := (h0.sub h1).add h2 + rw [mul_one, hC] at hh + convert! hh using 1 + funext j + cases j with + | inl i => + simp only [FiniteBlock.weights, Sum.elim_inl, + Real.log_div (Real.exp_pos _).ne' (FiniteBlock.partition_pos p hp hs M hM).ne', Real.log_exp] + ring + | inr j => + simp only [FiniteBlock.weights, Sum.elim_inr, + Real.log_div (hp _).ne' (FiniteBlock.partition_pos p hp hs M hM).ne', a, FiniteBlock.basis_inr] + ring + +theorem block_relativeEntropy_lower (σ : State n) (hσ : FiniteEnergy σ) + (b : HilbertBasis (I ⊕ J) ℂ (Fock n)) (p : I ⊕ J → ℝ) + (hp : ∀ j, 0 < p j) (hs : HasSum p 1) + (hc : Summable (fun j => (-Real.log (p j))*(inner ℂ (b j) (σ.op (b j))).re)) + (M : Matrix I I ℂ) (hM : M.IsHermitian) : + (expectation σ (FiniteBlock.block b M)).re- + (expectation σ (FiniteBlock.block b (Matrix.diagonal (fun i => (Real.log (p (Sum.inl i)) : ℂ))))).re- + Real.log (FiniteBlock.partition p M hM) ≤ relativeEntropy b p σ := by + have ht := block_crossEntropy σ b p hp hs hc M hM + have hK := (entropy_le_crossEntropy (blockState b p hp hs M hM) σ hσ _ _ + (FiniteBlock.weights_pos p hp hs M hM) (FiniteBlock.weights_hasSum p hp hs M hM) + (spectralState_eigen _ _ _ _) ht.summable).1 + change entropy σ ≤ ∑' j, _ at hK + rw [ht.tsum_eq] at hK + dsimp only [relativeEntropy] + linarith + +end + +open QuantumTrace TraceEnsemble +variable {n : ℕ} {I J : Type*} [Fintype I] [DecidableEq I] + + theorem blockState_finiteMoment (ρ : State n) {m : ℕ} (hm : FiniteMoment m ρ) + (b : HilbertBasis (I ⊕ J) ℂ (Fock n)) (p : I ⊕ J → ℝ) + (hp : ∀ j, 0 < p j) (hs : HasSum p 1) + (he : ∀ j, ρ.op (b j) = (p j : ℂ) • b j) (M : Matrix I I ℂ) (hM : M.IsHermitian) : + FiniteMoment m (blockState b p hp hs M hM) := by + rw [finiteMoment_iff] at hm ⊢ + have ht := FiniteBlock.tilted_moment_finite (numberBasis n) + (fun k => (1+(totalNumber k : ℝ≥0∞))^m) b p hp hs ?_ M hM + · simpa only [powerMoment, TensorLp.matrixMoment, basisExpectation, + numberBasis_apply, numberKet, blockState, spectralState] using ht + · rw [diagonalVector_operator b p (fun j => (hp j).le) hs.summable ρ.op he] + simpa only [powerMoment, TensorLp.matrixMoment, basisExpectation, + numberBasis_apply, numberKet] using hm + +omit [Fintype I] [DecidableEq I] in + theorem crossEntropy_self_summable (ρ : State n) (hρ : FiniteEnergy ρ) + (b : HilbertBasis J ℂ (Fock n)) (p : J → ℝ) + (he : ∀ j, ρ.op (b j) = (p j : ℂ) • b j) : + Summable (fun j => (-Real.log (p j))*(inner ℂ (b j) (ρ.op (b j))).re) := by + have h := hasSum_entropy_eigenvalues (numberBasis n) b ρ.positive + (trace_one_numberBasis ρ) p he (entropy_hasSum ρ hρ) + convert h.summable using 1 + funext j + rw [he, inner_smul_right, inner_self_eq_norm_sq_to_K, b.orthonormal.norm_eq_one] + simp [Real.negMulLog] + ring + + theorem blockState_crossEntropy_finite (ρ : State n) (hρ : FiniteEnergy ρ) + (b : HilbertBasis (I ⊕ J) ℂ (Fock n)) (p : I ⊕ J → ℝ) + (hp : ∀ j, 0 < p j) (hs : HasSum p 1) + (he : ∀ j, ρ.op (b j) = (p j : ℂ) • b j) (M : Matrix I I ℂ) (hM : M.IsHermitian) : + Summable (fun j => (-Real.log (p j))* + (inner ℂ (b j) ((blockState b p hp hs M hM).op (b j))).re) := by + have hc := (crossEntropy_self_summable ρ hρ b p he).comp_injective Sum.inr_injective + apply Summable.sum _ (hasSum_fintype _).summable + apply (hc.div_const (FiniteBlock.partition p M hM)).congr + intro j + dsimp only [Function.comp_def] + rw [blockState_operator ρ b p hp hs he M hM] + simp only [smul_apply, sub_apply, add_apply, FiniteBlock.block_tail, add_zero, sub_zero, + inner_smul_right, ← Complex.ofReal_inv, Complex.mul_re, Complex.ofReal_re, + Complex.ofReal_im, zero_mul, sub_zero] + ring + + theorem blockState_relativeEntropy (ρ : State n) (hρ : FiniteEnergy ρ) + (b : HilbertBasis (I ⊕ J) ℂ (Fock n)) (p : I ⊕ J → ℝ) + (hp : ∀ j, 0 < p j) (hs : HasSum p 1) + (he : ∀ j, ρ.op (b j) = (p j : ℂ) • b j) (M : Matrix I I ℂ) (hM : M.IsHermitian) + (hσ : FiniteEnergy (blockState b p hp hs M hM)) : + relativeEntropy b p (blockState b p hp hs M hM) = + (expectation (blockState b p hp hs M hM) (FiniteBlock.block b M)).re- + (expectation (blockState b p hp hs M hM) + (FiniteBlock.block b (Matrix.diagonal (fun i => (Real.log (p (Sum.inl i)) : ℂ))))).re- + Real.log (FiniteBlock.partition p M hM) := by + have hc := block_crossEntropy (blockState b p hp hs M hM) b p hp hs + (blockState_crossEntropy_finite ρ hρ b p hp hs he M hM) M hM + have hh := crossEntropy_self (blockState b p hp hs M hM) hσ + (FiniteBlock.basis b hM.eigenvectorBasis) (FiniteBlock.weights p M hM) + (spectralState_eigen _ _ _ _) + change (∑' j, _) = _ at hh + rw [hc.tsum_eq] at hh + dsimp only [relativeEntropy] + linarith + + theorem blockState_block_entry (ρ : State n) + (b : HilbertBasis (I ⊕ J) ℂ (Fock n)) (p : I ⊕ J → ℝ) + (hp : ∀ j, 0 < p j) (hs : HasSum p 1) + (he : ∀ j, ρ.op (b j) = (p j : ℂ) • b j) (M : Matrix I I ℂ) (hM : M.IsHermitian) + (i j : I) : + inner ℂ (b (Sum.inl i)) ((blockState b p hp hs M hM).op (b (Sum.inl j))) = + exp M i j/(FiniteBlock.partition p M hM : ℂ) := by + rw [blockState_operator ρ b p hp hs he M hM] + simp only [smul_apply, sub_apply, add_apply, inner_smul_right, inner_sub_right, inner_add_right, + he, inner_smul_right, FiniteBlock.inner_block] + simp [orthonormal_iff_ite.mp b.orthonormal, Matrix.diagonal_apply, + mul_ite, div_eq_mul_inv, mul_comm] + by_cases h : i = j <;> simp [h] + + theorem blockState_block_expectation (ρ : State n) + (b : HilbertBasis (I ⊕ J) ℂ (Fock n)) (p : I ⊕ J → ℝ) + (hp : ∀ j, 0 < p j) (hs : HasSum p 1) + (he : ∀ j, ρ.op (b j) = (p j : ℂ) • b j) (M : Matrix I I ℂ) (hM : M.IsHermitian) + (Z : Matrix I I ℂ) : + expectation (blockState b p hp hs M hM) (FiniteBlock.block b Z) = + Matrix.trace (Z*exp M)/(FiniteBlock.partition p M hM : ℂ) := by + rw [expectation_block_matrix] + simp only [blockState_block_entry ρ b p hp hs he M hM, Matrix.trace, Matrix.diag, + Matrix.mul_apply, Finset.sum_div, mul_div_assoc] + +end EntropyPhotonNumber + +end + +section +open scoped ComplexConjugate +open scoped BigOperators ComplexConjugate +open scoped BigOperators ComplexConjugate ENNReal Topology +open MeasureTheory +open scoped BigOperators +open MvPolynomial +open scoped BigOperators ComplexConjugate Classical +open Submodule +open scoped ENNReal +open Module +open scoped ComplexConjugate BigOperators Matrix +open NormedSpace +open scoped Matrix.Norms.Operator +open scoped Topology +open MeasureTheory NormedSpace + +namespace QuantumCalculus + +section +variable {A : Type*} [NormedRing A] [NormedAlgebra ℝ A] [CompleteSpace A] + +local instance : NormedAlgebra ℚ A := NormedAlgebra.restrictScalars ℚ ℝ A + +theorem exp_sub_eq_integral (a b : A) : + exp b - exp a = ∫ s in (0 : ℝ)..1, exp ((1-s) • a) * (b-a) * exp (s • b) := by + have hd (s : ℝ) : HasDerivAt (fun t : ℝ => exp ((1-t) • a) * exp (t • b)) + (exp ((1-s) • a) * (b-a) * exp (s • b)) s := by + have hleft : HasDerivAt (fun t : ℝ => exp ((1-t) • a)) + (-(exp ((1-s) • a) * a)) s := by + simpa [Function.comp_def] using (hasDerivAt_exp_smul_const a (1-s)).scomp s + ((hasDerivAt_const s (1 : ℝ)).sub (hasDerivAt_id s)) + have hright := hasDerivAt_exp_smul_const' b s + have heq : exp ((1-s) • a) * (b-a) * exp (s • b) = + -(exp ((1-s) • a) * a) * exp (s • b) + + exp ((1-s) • a) * (b * exp (s • b)) := by noncomm_ring + rw [heq] + exact hleft.mul hright + have hc : Continuous (fun s : ℝ => exp ((1-s) • a) * (b-a) * exp (s • b)) := by fun_prop + have h := intervalIntegral.integral_eq_sub_of_hasDerivAt (fun s _ => hd s) + (hc.intervalIntegrable 0 1) + simpa using h.symm + +theorem exp_add_smul_sub (a z : A) (t : ℝ) : + exp (a+t • z) - exp a = + t • (∫ s in (0 : ℝ)..1, exp ((1-s) • a) * z * exp (s • (a+t • z))) := by + rw [exp_sub_eq_integral, ← intervalIntegral.integral_smul] + congr 1 + funext s + simp + +theorem continuous_duhamel (a z : A) : + Continuous (fun t : ℝ => + ∫ s in (0 : ℝ)..1, exp ((1-s) • a) * z * exp (s • (a+t • z))) := by + have hc : Continuous (Function.uncurry (fun t s : ℝ => + exp ((1-s) • a) * z * exp (s • (a+t • z)))) := by fun_prop + have hh := continuous_parametric_integral_of_continuous (μ := volume) hc (s := Set.Icc (0:ℝ) 1) isCompact_Icc + convert! hh using 1 + funext t + rw [intervalIntegral.integral_of_le zero_le_one, integral_Icc_eq_integral_Ioc] + +theorem hasDerivAt_exp_add_smul_zero (a z : A) : + HasDerivAt (fun t : ℝ => exp (a+t • z)) + (∫ s in (0 : ℝ)..1, exp ((1-s) • a) * z * exp (s • a)) 0 := by + rw [hasDerivAt_iff_tendsto_slope] + have hc := (continuous_duhamel a z).continuousAt.tendsto.mono_left + (nhdsWithin_le_nhds : 𝓝[≠] (0:ℝ) ≤ 𝓝 0) + apply Filter.Tendsto.congr' ?_ (by simpa only [zero_smul, add_zero] using hc) + filter_upwards [self_mem_nhdsWithin] with t ht + have ht0 : t ≠ 0 := ht + rw [slope_def_module] + simp only [zero_smul, add_zero, sub_zero, exp_add_smul_sub, smul_smul, inv_mul_cancel₀ ht0, + one_smul] + +theorem hasDerivAt_exp_add_smul (a z : A) (t : ℝ) : + HasDerivAt (fun u : ℝ => exp (a+u • z)) + (∫ s in (0 : ℝ)..1, exp ((1-s) • (a+t • z)) * z * exp (s • (a+t • z))) t := by + have hh := (hasDerivAt_exp_add_smul_zero (a+t • z) z).scomp_of_eq t + ((hasDerivAt_id t).sub_const t) (by simp) + convert! hh using 1 + · funext u + simp [sub_smul] + · simp + +end + +section +variable {A : Type*} [NormedRing A] [NormedAlgebra ℝ A] [CompleteSpace A] +local instance : NormedAlgebra ℚ A := NormedAlgebra.restrictScalars ℚ ℝ A + +theorem trace_duhamel (τ : A →L[ℝ] ℝ) (hτ : ∀ x y, τ (x*y) = τ (y*x)) + (a z : A) : + τ (∫ s in (0 : ℝ)..1, exp ((1-s) • a) * z * exp (s • a)) = τ (exp a * z) := by + have hc : Continuous (fun s : ℝ => exp ((1-s) • a) * z * exp (s • a)) := by fun_prop + rw [← τ.intervalIntegral_comp_comm (hc.intervalIntegrable 0 1)] + have heq (s : ℝ) : τ (exp ((1-s) • a) * z * exp (s • a)) = τ (exp a * z) := by + rw [hτ, ← mul_assoc, ← exp_add_of_commute + (((Commute.refl a).smul_left s).smul_right (1-s)), ← add_smul] + simp + simp_rw [heq] + simp + +theorem hasDerivAt_trace_exp (τ : A →L[ℝ] ℝ) (hτ : ∀ x y, τ (x*y) = τ (y*x)) + (a z : A) (t : ℝ) : + HasDerivAt (fun u : ℝ => τ (exp (a+u • z))) (τ (exp (a+t • z)*z)) t := by + have hh := τ.hasFDerivAt.comp_hasDerivAt t (hasDerivAt_exp_add_smul a z t) + simpa only [Function.comp_def, trace_duhamel τ hτ] using hh + +theorem hasDerivAt_trace_exp_mul (τ : A →L[ℝ] ℝ) + (a z : A) (t : ℝ) : + HasDerivAt (fun u : ℝ => τ (exp (a+u • z)*z)) + (τ ((∫ s in (0 : ℝ)..1, + exp ((1-s) • (a+t • z))*z*exp (s • (a+t • z)))*z)) t := by + exact τ.hasFDerivAt.comp_hasDerivAt t + ((hasDerivAt_exp_add_smul a z t).mul_const z) + +end + +section +open scoped Matrix.Norms.Operator ComplexConjugate +open Matrix +variable {I : Type*} [Fintype I] [DecidableEq I] + +def matrixReTrace : Matrix I I ℂ →L[ℝ] ℝ := + Complex.reCLM.comp (Matrix.traceLinearMap I ℝ ℂ).toContinuousLinearMap + +omit [DecidableEq I] in +@[simp] theorem matrixReTrace_apply (M : Matrix I I ℂ) : + matrixReTrace M = (Matrix.trace M).re := rfl + +omit [DecidableEq I] in +theorem matrixReTrace_cyclic (M N : Matrix I I ℂ) : + matrixReTrace (M*N) = matrixReTrace (N*M) := by + simp only [matrixReTrace_apply, Matrix.trace_mul_comm M N] + +theorem exp_real_diagonal (v : I → ℝ) (s : ℝ) : + exp (s • Matrix.diagonal (fun i => (v i : ℂ))) = + Matrix.diagonal (fun i => (Real.exp (s*v i) : ℂ)) := by + rw [← Matrix.diagonal_smul, Matrix.exp_diagonal] + congr 1 + funext i + simp [← Complex.exp_eq_exp_ℂ, Complex.ofReal_exp] + +theorem matrix_duhamel_integrand (v : I → ℝ) (Z : Matrix I I ℂ) + (hZ : Z.IsHermitian) (s : ℝ) : + matrixReTrace (exp ((1-s) • Matrix.diagonal (fun i => (v i : ℂ))) * Z * + exp (s • Matrix.diagonal (fun i => (v i : ℂ))) * Z) = + ∑ i, ∑ j, Real.exp ((1-s)*v i+s*v j) * Complex.normSq (Z i j) := by + rw [exp_real_diagonal, exp_real_diagonal, matrixReTrace_apply] + have heq : + (Matrix.diagonal (fun i => (↑(Real.exp ((1-s)*v i)) : ℂ)) * Z * + Matrix.diagonal (fun i => (↑(Real.exp (s*v i)) : ℂ)) * Z).trace = + ∑ i, ∑ j, (↑(Real.exp ((1-s)*v i)) : ℂ) * Z i j * + ↑(Real.exp (s*v j)) * Z j i := by + unfold Matrix.trace + apply Finset.sum_congr rfl + intro i _ + rw [Matrix.diag_apply, Matrix.mul_apply] + apply Finset.sum_congr rfl + intro j _ + rw [Matrix.mul_diagonal, Matrix.diagonal_mul] + rw [heq] + simp only [Complex.re_sum] + apply Finset.sum_congr rfl + intro i _ + apply Finset.sum_congr rfl + intro j _ + rw [← hZ.apply j i, Real.exp_add] + simp only [Complex.mul_re, Complex.mul_im, Complex.ofReal_re, Complex.ofReal_im, + Complex.star_def, Complex.conj_re, Complex.conj_im, Complex.normSq_apply] + ring + +theorem matrix_duhamel_hessian (p : I → ℝ) (hp : ∀ i, 0 < p i) + (Z : Matrix I I ℂ) (hZ : Z.IsHermitian) : + matrixReTrace ((∫ s in (0 : ℝ)..1, + exp ((1-s) • Matrix.diagonal (fun i => (Real.log (p i) : ℂ))) * Z * + exp (s • Matrix.diagonal (fun i => (Real.log (p i) : ℂ)))) * Z) = + ∑ i, ∑ j, DiagonalForms.System.logMean (p i) (p j) * Complex.normSq (Z i j) := by + let a : Matrix I I ℂ := Matrix.diagonal (fun i => (Real.log (p i) : ℂ)) + have hc : Continuous (fun s : ℝ => exp ((1-s) • a) * Z * exp (s • a)) := by fun_prop + have hm := ((ContinuousLinearMap.mul ℝ (Matrix I I ℂ)).flip Z).intervalIntegral_comp_comm + (hc.intervalIntegrable (μ := volume) 0 1) + change (∫ s in (0:ℝ)..1, (exp ((1-s) • a)*Z*exp (s • a))*Z) = + (∫ s in (0:ℝ)..1, exp ((1-s) • a)*Z*exp (s • a))*Z at hm + change matrixReTrace ((∫ s in (0:ℝ)..1, exp ((1-s) • a)*Z*exp (s • a))*Z) = _ + rw [← hm] + have hc' : Continuous (fun s : ℝ => exp ((1-s) • a)*Z*exp (s • a)*Z) := + hc.mul continuous_const + trans ∫ s in (0:ℝ)..1, matrixReTrace (exp ((1-s) • a)*Z*exp (s • a)*Z) + · exact (matrixReTrace.intervalIntegral_comp_comm + (hc'.intervalIntegrable (μ := volume) 0 1)).symm + simp_rw [a, matrix_duhamel_integrand _ Z hZ] + rw [intervalIntegral.integral_finsetSum] + · apply Finset.sum_congr rfl + intro i _ + rw [intervalIntegral.integral_finsetSum] + · apply Finset.sum_congr rfl + intro j _ + rw [intervalIntegral.integral_mul_const, integral_exp_affine_log (hp i) (hp j)] + · intro j _ + exact (by fun_prop : Continuous (fun s : ℝ => + Real.exp ((1-s)*Real.log (p i)+s*Real.log (p j))*Complex.normSq (Z i j))).intervalIntegrable 0 1 + · intro i _ + apply Continuous.intervalIntegrable + fun_prop + +end + +section +open Filter Asymptotics + +theorem quadratic_expansion {f f' : ℝ → ℝ} {d : ℝ} + (hff' : ∀ᶠ t in 𝓝 (0:ℝ), HasDerivAt f (f' t) t) + (hd : HasDerivAt f' d 0) : + (fun t => f t-f 0-f' 0*t-d/2*t^2) =o[𝓝 (0:ℝ)] (fun t => t^2) := by + obtain ⟨δ, hδ, hh⟩ := Metric.eventually_nhds_iff.mp hff' + let R : ℝ → ℝ := fun t => f t-f 0-f' 0*t-d/2*t^2 + let R' : ℝ → ℝ := fun t => f' t-f' 0-d*t + have he : R' =o[𝓝 (0:ℝ)] (fun t => t) := by + simpa only [R', sub_zero, smul_eq_mul, mul_comm d] using hd.isLittleO + have hs := (convex_ball (0:ℝ) δ).isLittleO_pow_succ_real + (Metric.mem_ball_self hδ) (n := 1) (f := R) (f' := R') ?_ ?_ + · have hn : 𝓝[Metric.ball (0:ℝ) δ] (0:ℝ) = 𝓝 0 := + nhdsWithin_eq_nhds.mpr (Metric.ball_mem_nhds 0 hδ) + simpa [R, hn] using hs + · intro t ht + have hf := hh ht + have hpoly := ((hasDerivAt_const t (f' 0)).mul (hasDerivAt_id t)) + have hquad := ((hasDerivAt_id t).pow 2).const_mul (d/2) + convert (((hf.sub_const (f 0)).sub hpoly).sub hquad).hasDerivWithinAt using 1 + · funext u + dsimp [R] + · dsimp [R'] + ring + · simpa only [sub_zero, pow_one] using he.mono nhdsWithin_le_nhds + +variable {A : Type*} [NormedRing A] [NormedAlgebra ℝ A] [CompleteSpace A] +local instance : NormedAlgebra ℚ A := NormedAlgebra.restrictScalars ℚ ℝ A + +theorem log_partition_expansion (τ : A →L[ℝ] ℝ) + (hτ : ∀ x y, τ (x*y) = τ (y*x)) (a z : A) (c : ℝ) + (hn : c+τ (exp a) = 1) : + (fun t : ℝ => Real.log (c+τ (exp (a+t • z))) - + τ (exp a*z)*t - + (τ ((∫ s in (0:ℝ)..1, exp ((1-s) • a)*z*exp (s • a))*z) - + (τ (exp a*z))^2)/2*t^2) =o[𝓝 (0:ℝ)] (fun t => t^2) := by + let P : ℝ → ℝ := fun t => c+τ (exp (a+t • z)) + let M : ℝ → ℝ := fun t => τ (exp (a+t • z)*z) + have hP (t : ℝ) : HasDerivAt P (M t) t := (hasDerivAt_trace_exp τ hτ a z t).const_add c + have hP0 : P 0 = 1 := by simpa [P] using hn + have hnz : ∀ᶠ t in 𝓝 (0:ℝ), P t ≠ 0 := + (hP 0).continuousAt.eventually_ne (by simp [hP0]) + have hlog : ∀ᶠ t in 𝓝 (0:ℝ), + HasDerivAt (fun t => Real.log (P t)) (M t/P t) t := by + filter_upwards [hnz] with t ht using (hP t).log ht + have hd := (hasDerivAt_trace_exp_mul τ a z 0).div (hP 0) (by simp [hP0]) + have hd' : HasDerivAt (fun t => M t/P t) + (τ ((∫ s in (0:ℝ)..1, exp ((1-s) • a)*z*exp (s • a))*z) - + (τ (exp a*z))^2) 0 := by + convert hd using 1 + first | rfl | + simp only [M, zero_smul, add_zero, hP0, mul_one, div_one, pow_two] + have hh := quadratic_expansion hlog hd' + simpa only [P, M, zero_smul, add_zero, hn, Real.log_one, sub_zero, div_one] using hh + +end + +section +open Matrix Filter Asymptotics +open scoped Matrix.Norms.Operator +variable {I : Type*} [Fintype I] [DecidableEq I] + +theorem finite_block_partition_expansion (p : I → ℝ) (hp : ∀ i, 0 < p i) + (Z : Matrix I I ℂ) (hZ : Z.IsHermitian) (c : ℝ) + (hn : c + ∑ i, p i = 1) : + (fun t : ℝ => Real.log (c + matrixReTrace + (exp (Matrix.diagonal (fun i => (Real.log (p i) : ℂ)) + t • Z))) - + (∑ i, p i*(Z i i).re)*t - + ((∑ i, ∑ j, DiagonalForms.System.logMean (p i) (p j) * Complex.normSq (Z i j)) - + (∑ i, p i*(Z i i).re)^2)/2*t^2) =o[𝓝 (0:ℝ)] (fun t => t^2) := by + let a := Matrix.diagonal (fun i => (Real.log (p i) : ℂ)) + have hea : exp a = Matrix.diagonal (fun i => (p i : ℂ)) := by + simpa only [one_smul, one_mul, Real.exp_log (hp _)] using + exp_real_diagonal (fun i => Real.log (p i)) 1 + have htr : matrixReTrace (exp a) = ∑ i, p i := by + rw [hea, matrixReTrace_apply, Matrix.trace_diagonal] + simp + have hm : matrixReTrace (exp a*Z) = ∑ i, p i*(Z i i).re := by + rw [hea, matrixReTrace_apply] + simp [Matrix.trace, Matrix.diag_apply, Matrix.diagonal_mul] + have hh := log_partition_expansion (matrixReTrace (I := I)) matrixReTrace_cyclic a Z c + (by erw [htr]; exact hn) + erw [hm, matrix_duhamel_hessian p hp Z hZ] at hh + exact hh + +end + +section +open Filter Asymptotics +variable {A : Type*} [NormedRing A] [NormedAlgebra ℝ A] [CompleteSpace A] +local instance : NormedAlgebra ℚ A := NormedAlgebra.restrictScalars ℚ ℝ A + +theorem relative_partition_expansion (τ : A →L[ℝ] ℝ) + (hτ : ∀ x y, τ (x*y) = τ (y*x)) (a z : A) (c : ℝ) + (hn : c+τ (exp a) = 1) : + (fun t : ℝ => t*(τ (exp (a+t • z)*z)/(c+τ (exp (a+t • z))))- + Real.log (c+τ (exp (a+t • z)))- + (τ ((∫ s in (0:ℝ)..1, exp ((1-s) • a)*z*exp (s • a))*z)- + (τ (exp a*z))^2)/2*t^2) =o[𝓝 (0:ℝ)] (fun t => t^2) := by + let P : ℝ → ℝ := fun t => c+τ (exp (a+t • z)) + let M : ℝ → ℝ := fun t => τ (exp (a+t • z)*z) + let d : ℝ := τ ((∫ s in (0:ℝ)..1, exp ((1-s) • a)*z*exp (s • a))*z)- + (τ (exp a*z))^2 + have hP (t : ℝ) : HasDerivAt P (M t) t := (hasDerivAt_trace_exp τ hτ a z t).const_add c + have hP0 : P 0 = 1 := by simpa [P] using hn + have hd := (hasDerivAt_trace_exp_mul τ a z 0).div (hP 0) (by simp [hP0]) + have hd' : HasDerivAt (fun t => M t/P t) d 0 := by + convert hd using 1 + first | rfl | + simp only [d, M, zero_smul, add_zero, hP0, mul_one, div_one, pow_two] + have he : (fun t => M t/P t-M 0-d*t) =o[𝓝 (0:ℝ)] (fun t => t) := by + simpa only [hP0, div_one, sub_zero, smul_eq_mul, mul_comm d] using hd'.isLittleO + have he2 : (fun t => (M t/P t-M 0-d*t)*t) =o[𝓝 (0:ℝ)] (fun t => t^2) := by + simpa only [pow_two] using he.mul_isBigO (isBigO_refl (fun t : ℝ => t) (𝓝 0)) + have hq := log_partition_expansion τ hτ a z c hn + have hh := he2.sub hq + convert! hh using 1 + · funext t + dsimp only [P, M, d] + simp only [zero_smul, add_zero] + ring + +end + +open Matrix Filter Asymptotics +open scoped Matrix.Norms.Operator +variable {I : Type*} [Fintype I] [DecidableEq I] + + theorem finite_block_relative_expansion (p : I → ℝ) (hp : ∀ i, 0 < p i) + (Z : Matrix I I ℂ) (hZ : Z.IsHermitian) (c : ℝ) + (hn : c + ∑ i, p i = 1) : + (fun t : ℝ => t*(matrixReTrace + (exp (Matrix.diagonal (fun i => (Real.log (p i) : ℂ))+t • Z)*Z)/ + (c+matrixReTrace (exp (Matrix.diagonal (fun i => (Real.log (p i) : ℂ))+t • Z))))- + Real.log (c+matrixReTrace (exp (Matrix.diagonal (fun i => (Real.log (p i) : ℂ))+t • Z)))- + ((∑ i, ∑ j, DiagonalForms.System.logMean (p i) (p j) * Complex.normSq (Z i j)) - + (∑ i, p i*(Z i i).re)^2)/2*t^2) =o[𝓝 (0:ℝ)] (fun t => t^2) := by + let a := Matrix.diagonal (fun i => (Real.log (p i) : ℂ)) + have hea : exp a = Matrix.diagonal (fun i => (p i : ℂ)) := by + simpa only [one_smul, one_mul, Real.exp_log (hp _)] using + exp_real_diagonal (fun i => Real.log (p i)) 1 + have htr : matrixReTrace (exp a) = ∑ i, p i := by + rw [hea, matrixReTrace_apply, Matrix.trace_diagonal] + simp + have hm : matrixReTrace (exp a*Z) = ∑ i, p i*(Z i i).re := by + rw [hea, matrixReTrace_apply] + simp [Matrix.trace, Matrix.diag_apply, Matrix.diagonal_mul] + have hh := relative_partition_expansion (matrixReTrace (I := I)) matrixReTrace_cyclic a Z c + (by erw [htr]; exact hn) + erw [hm, matrix_duhamel_hessian p hp Z hZ] at hh + exact hh + +end QuantumCalculus + +namespace FiniteBlock +open QuantumCalculus +variable {I J : Type*} [Fintype I] [DecidableEq I] + +def tiltMatrix (p : I ⊕ J → ℝ) (Z : Matrix I I ℂ) (t : ℝ) : Matrix I I ℂ := + Matrix.diagonal (fun i => (Real.log (p (Sum.inl i)) : ℂ))+t • Z + +omit [Fintype I] in + theorem tiltMatrix_hermitian (p : I ⊕ J → ℝ) (Z : Matrix I I ℂ) (hZ : Z.IsHermitian) (t : ℝ) : + (tiltMatrix p Z t).IsHermitian := by + exact (Matrix.isHermitian_diagonal_iff.mpr + (by intro i; exact isSelfAdjoint_iff.mpr (Complex.conj_ofReal _))).add + (hZ.smul (isSelfAdjoint_iff.mpr rfl)) + + theorem partition_trace (p : I ⊕ J → ℝ) (M : Matrix I I ℂ) (hM : M.IsHermitian) : + partition p M hM = (∑' j, p (Sum.inr j))+matrixReTrace (exp M) := by + rw [matrixReTrace_apply, trace_exp] + rfl + +omit [DecidableEq I] in + theorem tail_normalization (p : I ⊕ J → ℝ) (hs : HasSum p 1) : + (∑' j, p (Sum.inr j)) + ∑ i, p (Sum.inl i) = 1 := by + have hh := HasSum.sum (f := p) (hasSum_fintype (fun i => p (Sum.inl i))) + (hs.summable.comp_injective Sum.inr_injective).hasSum + rw [add_comm] + exact hh.unique hs + +end FiniteBlock + +namespace EntropyPhotonNumber +open QuantumCalculus QuantumTrace Filter Asymptotics +variable {n : ℕ} {I J : Type*} [Fintype I] [DecidableEq I] + +def blockTilt (b : HilbertBasis (I ⊕ J) ℂ (Fock n)) (p : I ⊕ J → ℝ) + (hp : ∀ j, 0 < p j) (hs : HasSum p 1) (Z : Matrix I I ℂ) (hZ : Z.IsHermitian) (t : ℝ) : State n := + blockState b p hp hs (FiniteBlock.tiltMatrix p Z t) (FiniteBlock.tiltMatrix_hermitian p Z hZ t) + + theorem blockTilt_relativeEntropy (ρ : State n) (hρ : FiniteEnergy ρ) + (b : HilbertBasis (I ⊕ J) ℂ (Fock n)) (p : I ⊕ J → ℝ) + (hp : ∀ j, 0 < p j) (hs : HasSum p 1) + (he : ∀ j, ρ.op (b j) = (p j : ℂ) • b j) + (Z : Matrix I I ℂ) (hZ : Z.IsHermitian) (t : ℝ) + (ht : FiniteEnergy (blockTilt b p hp hs Z hZ t)) : + relativeEntropy b p (blockTilt b p hp hs Z hZ t) = + t*(matrixReTrace (exp (FiniteBlock.tiltMatrix p Z t)*Z)/ + ((∑' j, p (Sum.inr j))+matrixReTrace (exp (FiniteBlock.tiltMatrix p Z t))))- + Real.log ((∑' j, p (Sum.inr j))+matrixReTrace (exp (FiniteBlock.tiltMatrix p Z t))) := by + rw [blockTilt, blockState_relativeEntropy ρ hρ b p hp hs he _ _ ht] + have hsZ : t • Z = (t : ℂ) • Z := by ext i j; simp + rw [show FiniteBlock.block b (FiniteBlock.tiltMatrix p Z t) = + FiniteBlock.block b (Matrix.diagonal (fun i => (Real.log (p (Sum.inl i)) : ℂ)))+ + (t:ℂ) • FiniteBlock.block b Z by + rw [FiniteBlock.tiltMatrix, FiniteBlock.block_add, hsZ, FiniteBlock.block_smul]] + rw [expectation_add, expectation_smul] + simp only [Complex.add_re, Complex.mul_re, Complex.ofReal_re, Complex.ofReal_im, zero_mul, sub_zero] + rw [blockState_block_expectation ρ b p hp hs he _ _ Z] + rw [Matrix.trace_mul_comm Z, Complex.div_ofReal_re, + FiniteBlock.partition_trace] + simp only [matrixReTrace_apply] + ring + + theorem blockTilt_relativeEntropy_expansion (ρ : State n) (hρ : FiniteEnergy ρ) + (b : HilbertBasis (I ⊕ J) ℂ (Fock n)) (p : I ⊕ J → ℝ) + (hp : ∀ j, 0 < p j) (hs : HasSum p 1) + (he : ∀ j, ρ.op (b j) = (p j : ℂ) • b j) + (Z : Matrix I I ℂ) (hZ : Z.IsHermitian) + (ht : ∀ t, FiniteEnergy (blockTilt b p hp hs Z hZ t)) : + (fun t : ℝ => relativeEntropy b p (blockTilt b p hp hs Z hZ t)- + ((∑ i, ∑ j, DiagonalForms.System.logMean (p (Sum.inl i)) (p (Sum.inl j)) * Complex.normSq (Z i j)) - + (∑ i, p (Sum.inl i)*(Z i i).re)^2)/2*t^2) =o[𝓝 (0:ℝ)] (fun t => t^2) := by + simp_rw [blockTilt_relativeEntropy ρ hρ b p hp hs he Z hZ _ (ht _), FiniteBlock.tiltMatrix] + exact finite_block_relative_expansion _ (fun i => hp (Sum.inl i)) Z hZ _ + (FiniteBlock.tail_normalization p hs) + + theorem blockTilt_finiteMoment (ρ : State n) {m : ℕ} (hm : FiniteMoment m ρ) + (b : HilbertBasis (I ⊕ J) ℂ (Fock n)) (p : I ⊕ J → ℝ) + (hp : ∀ j, 0 < p j) (hs : HasSum p 1) + (he : ∀ j, ρ.op (b j) = (p j : ℂ) • b j) + (Z : Matrix I I ℂ) (hZ : Z.IsHermitian) (t : ℝ) : + FiniteMoment m (blockTilt b p hp hs Z hZ t) := + blockState_finiteMoment ρ hm b p hp hs he _ _ + + theorem blockTilt_relativeEntropy_expansion_of_moment (ρ : State n) (hm : FiniteMoment 4 ρ) + (b : HilbertBasis (I ⊕ J) ℂ (Fock n)) (p : I ⊕ J → ℝ) + (hp : ∀ j, 0 < p j) (hs : HasSum p 1) + (he : ∀ j, ρ.op (b j) = (p j : ℂ) • b j) + (Z : Matrix I I ℂ) (hZ : Z.IsHermitian) : + (fun t : ℝ => relativeEntropy b p (blockTilt b p hp hs Z hZ t)- + ((∑ i, ∑ j, DiagonalForms.System.logMean (p (Sum.inl i)) (p (Sum.inl j)) * Complex.normSq (Z i j)) - + (∑ i, p (Sum.inl i)*(Z i i).re)^2)/2*t^2) =o[𝓝 (0:ℝ)] (fun t => t^2) := + blockTilt_relativeEntropy_expansion ρ (finiteMoment_finiteEnergy (by norm_num) hm) + b p hp hs he Z hZ (fun t => finiteMoment_finiteEnergy (by norm_num) + (blockTilt_finiteMoment ρ hm b p hp hs he Z hZ t)) + + theorem block_relativeEntropy_tilt_lower (σ : State n) (hσ : FiniteEnergy σ) + (b : HilbertBasis (I ⊕ J) ℂ (Fock n)) (p : I ⊕ J → ℝ) + (hp : ∀ j, 0 < p j) (hs : HasSum p 1) + (hc : Summable (fun j => (-Real.log (p j))*(inner ℂ (b j) (σ.op (b j))).re)) + (Z : Matrix I I ℂ) (hZ : Z.IsHermitian) (t : ℝ) : + t*(expectation σ (FiniteBlock.block b Z)).re- + Real.log ((∑' j, p (Sum.inr j))+matrixReTrace (exp (FiniteBlock.tiltMatrix p Z t))) ≤ + relativeEntropy b p σ := by + have hh := block_relativeEntropy_lower σ hσ b p hp hs hc + (FiniteBlock.tiltMatrix p Z t) (FiniteBlock.tiltMatrix_hermitian p Z hZ t) + have hsZ : t • Z = (t : ℂ) • Z := by ext i j; simp + rw [show FiniteBlock.block b (FiniteBlock.tiltMatrix p Z t) = + FiniteBlock.block b (Matrix.diagonal (fun i => (Real.log (p (Sum.inl i)) : ℂ)))+ + (t:ℂ) • FiniteBlock.block b Z by + rw [FiniteBlock.tiltMatrix, FiniteBlock.block_add, hsZ, FiniteBlock.block_smul], + expectation_add, expectation_smul] at hh + simp only [Complex.add_re, Complex.mul_re, Complex.ofReal_re, + Complex.ofReal_im, zero_mul, sub_zero] at hh + rw [FiniteBlock.partition_trace] at hh + linarith + +end EntropyPhotonNumber + +namespace FiniteBlock +variable {I J E : Type*} [Fintype I] [DecidableEq I] +variable [NormedAddCommGroup E] [InnerProductSpace ℂ E] [CompleteSpace E] + +omit [CompleteSpace E] in + theorem block_basis (b : HilbertBasis (I ⊕ J) ℂ E) (M : Matrix I I ℂ) (j : I) : + block b M (b (Sum.inl j)) = ∑ i, M i j • b (Sum.inl i) := by + simp [block, InnerProductSpace.rankOne_apply, orthonormal_iff_ite.mp b.orthonormal] + +def entries (b : HilbertBasis (I ⊕ J) ℂ E) (Z : E →L[ℂ] E) : Matrix I I ℂ := + fun i j => inner ℂ (b (Sum.inl i)) (Z (b (Sum.inl j))) + +omit [CompleteSpace E] [DecidableEq I] in + theorem trace_block_bounded (b : HilbertBasis (I ⊕ J) ℂ E) (A : Matrix I I ℂ) + (Z : E →L[ℂ] E) : + HasSum (fun j => inner ℂ (b j) (Z (block b A (b j)))) + (Matrix.trace (A * entries b Z)) := by + classical + have he (j : I ⊕ J) : inner ℂ (b j) (Z (block b A (b j))) = + Sum.elim (fun j => ∑ i, A i j*inner ℂ (b (Sum.inl j)) (Z (b (Sum.inl i)))) (fun _ => 0) j := by + cases j with + | inl j => simp [block_basis] + | inr j => simp only [block_tail, map_zero, inner_zero_right, Sum.elim_inr] + simp_rw [he] + have h := HasSum.sum (f := Sum.elim (fun j => ∑ i, A i j*inner ℂ (b (Sum.inl j)) (Z (b (Sum.inl i)))) (fun _ : J => (0:ℂ))) + (hasSum_fintype _) (hasSum_zero : HasSum (fun _ : J => (0:ℂ)) 0) + have heq : (∑ j, ∑ i, A i j * inner ℂ (b (Sum.inl j)) (Z (b (Sum.inl i)))) = + Matrix.trace (A * entries b Z) := by + simp only [Matrix.trace, Matrix.diag, Matrix.mul_apply, entries] + exact Finset.sum_comm + simpa only [Function.comp_def, Sum.elim_inl, add_zero, heq] using h + +end FiniteBlock + +namespace EntropyPhotonNumber +open QuantumTrace +variable {n : ℕ} {I J : Type*} [Fintype I] [DecidableEq I] + + theorem blockState_expectation (ρ : State n) + (b : HilbertBasis (I ⊕ J) ℂ (Fock n)) (p : I ⊕ J → ℝ) + (hp : ∀ j, 0 < p j) (hs : HasSum p 1) + (he : ∀ j, ρ.op (b j) = (p j : ℂ) • b j) (M : Matrix I I ℂ) (hM : M.IsHermitian) + (Z : Fock n →L[ℂ] Fock n) : + expectation (blockState b p hp hs M hM) Z = + (expectation ρ Z + Matrix.trace ((exp M-Matrix.diagonal (fun i => (p (Sum.inl i) : ℂ)))* + FiniteBlock.entries b Z))/(FiniteBlock.partition p M hM : ℂ) := by + have hρ := hasSum_expectation_basis b ρ Z + have hA := FiniteBlock.trace_block_bounded b + (exp M-Matrix.diagonal (fun i => (p (Sum.inl i) : ℂ))) Z + have hσ := hasSum_expectation_basis b (blockState b p hp hs M hM) Z + rw [blockState_operator ρ b p hp hs he M hM] at hσ + simp only [smul_apply, sub_apply, add_apply, map_smul, map_sub, map_add, + inner_smul_right, inner_sub_right, inner_add_right] at hσ + have hh := (hρ.add hA).mul_left ((FiniteBlock.partition p M hM : ℂ)⁻¹) + simp only [FiniteBlock.block_sub, sub_apply, map_sub, inner_sub_right] at hh + apply hσ.unique + rw [div_eq_mul_inv, mul_comm] + convert! hh using 1 + funext j + ring + +end EntropyPhotonNumber + +namespace QuantumCalculus +open Matrix Filter Asymptotics +open scoped Matrix.Norms.Operator +variable {I : Type*} [Fintype I] [DecidableEq I] + + theorem matrix_duhamel_mixed_integrand (v : I → ℝ) (X Y : Matrix I I ℂ) (s : ℝ) : + matrixReTrace (exp ((1-s) • Matrix.diagonal (fun i => (v i : ℂ)))*X* + exp (s • Matrix.diagonal (fun i => (v i : ℂ)))*Y) = + ∑ i, ∑ j, Real.exp ((1-s)*v i+s*v j)*(X i j*Y j i).re := by + rw [exp_real_diagonal, exp_real_diagonal, matrixReTrace_apply] + have he : (Matrix.diagonal (fun i => (Real.exp ((1-s)*v i) : ℂ))*X* + Matrix.diagonal (fun i => (Real.exp (s*v i) : ℂ))*Y).trace = + ∑ i, ∑ j, (Real.exp ((1-s)*v i) : ℂ)*X i j*(Real.exp (s*v j) : ℂ)*Y j i := by + unfold Matrix.trace + apply Finset.sum_congr rfl + intro i _ + rw [Matrix.diag_apply, Matrix.mul_apply] + apply Finset.sum_congr rfl + intro j _ + rw [Matrix.mul_diagonal, Matrix.diagonal_mul] + rw [he] + simp only [Complex.re_sum] + apply Finset.sum_congr rfl + intro i _ + apply Finset.sum_congr rfl + intro j _ + rw [Real.exp_add] + simp only [Complex.mul_re, Complex.mul_im, Complex.ofReal_re, Complex.ofReal_im] + ring + + theorem matrix_duhamel_mixed (p : I → ℝ) (hp : ∀ i, 0 < p i) (X Y : Matrix I I ℂ) : + matrixReTrace ((∫ s in (0:ℝ)..1, + exp ((1-s) • Matrix.diagonal (fun i => (Real.log (p i) : ℂ)))*X* + exp (s • Matrix.diagonal (fun i => (Real.log (p i) : ℂ))))*Y) = + ∑ i, ∑ j, DiagonalForms.System.logMean (p i) (p j)*(X i j*Y j i).re := by + let a : Matrix I I ℂ := Matrix.diagonal (fun i => (Real.log (p i) : ℂ)) + have hc : Continuous (fun s : ℝ => exp ((1-s) • a)*X*exp (s • a)) := by fun_prop + have hm := ((ContinuousLinearMap.mul ℝ (Matrix I I ℂ)).flip Y).intervalIntegral_comp_comm + (hc.intervalIntegrable (μ := volume) 0 1) + change (∫ s in (0:ℝ)..1, (exp ((1-s) • a)*X*exp (s • a))*Y) = + (∫ s in (0:ℝ)..1, exp ((1-s) • a)*X*exp (s • a))*Y at hm + change matrixReTrace ((∫ s in (0:ℝ)..1, exp ((1-s) • a)*X*exp (s • a))*Y) = _ + rw [← hm] + have hcy : Continuous (fun s : ℝ => exp ((1-s) • a)*X*exp (s • a)*Y) := hc.mul continuous_const + trans ∫ s in (0:ℝ)..1, matrixReTrace (exp ((1-s) • a)*X*exp (s • a)*Y) + · exact (matrixReTrace.intervalIntegral_comp_comm (hcy.intervalIntegrable (μ := volume) 0 1)).symm + simp_rw [a, matrix_duhamel_mixed_integrand] + rw [intervalIntegral.integral_finsetSum] + · apply Finset.sum_congr rfl + intro i _ + rw [intervalIntegral.integral_finsetSum] + · apply Finset.sum_congr rfl + intro j _ + rw [intervalIntegral.integral_mul_const, integral_exp_affine_log (hp i) (hp j)] + · intro j _ + exact (by fun_prop : Continuous (fun s : ℝ => + Real.exp ((1-s)*Real.log (p i)+s*Real.log (p j))*(X i j*Y j i).re)).intervalIntegrable 0 1 + · intro i _ + apply Continuous.intervalIntegrable + fun_prop + + theorem normalized_expectation_deriv (p : I → ℝ) (hp : ∀ i, 0 < p i) + (X Y : Matrix I I ℂ) (c μ : ℝ) (hn : c+∑ i, p i = 1) : + HasDerivAt (fun t : ℝ => + (μ+matrixReTrace ((exp (Matrix.diagonal (fun i => (Real.log (p i) : ℂ))+t • X)- + Matrix.diagonal (fun i => (p i : ℂ)))*Y))/ + (c+matrixReTrace (exp (Matrix.diagonal (fun i => (Real.log (p i) : ℂ))+t • X)))) + ((∑ i, ∑ j, DiagonalForms.System.logMean (p i) (p j)*(X i j*Y j i).re)- + μ*(∑ i, p i*(X i i).re)) 0 := by + let a : Matrix I I ℂ := Matrix.diagonal (fun i => (Real.log (p i) : ℂ)) + have hea : exp a = Matrix.diagonal (fun i => (p i : ℂ)) := by + simpa only [one_smul, one_mul, Real.exp_log (hp _)] using + exp_real_diagonal (fun i => Real.log (p i)) 1 + have htr : matrixReTrace (exp a) = ∑ i, p i := by + rw [hea, matrixReTrace_apply, Matrix.trace_diagonal] + simp + have hm : matrixReTrace (exp a*X) = ∑ i, p i*(X i i).re := by + rw [hea, matrixReTrace_apply] + simp [Matrix.trace, Matrix.diag_apply, Matrix.diagonal_mul] + have hd := (hasDerivAt_trace_exp matrixReTrace matrixReTrace_cyclic a X 0).const_add c + have hv := matrixReTrace.hasFDerivAt.comp_hasDerivAt 0 + (((hasDerivAt_exp_add_smul a X 0).sub_const (Matrix.diagonal (fun i => (p i : ℂ)))).mul_const Y) + simp only [zero_smul, add_zero] at hd hv + have hnorm : c+matrixReTrace (exp a) = 1 := htr ▸ hn + have hbase : exp a-Matrix.diagonal (fun i => (p i : ℂ)) = 0 := by rw [hea, sub_self] + have hh := (hv.const_add μ).div hd (by + change c+matrixReTrace (exp (a+(0:ℝ) • X)) ≠ 0 + rw [zero_smul, add_zero, hnorm] + exact one_ne_zero) + simp only [Function.comp_def, zero_smul, add_zero] at hh + erw [hbase, zero_mul, map_zero, hnorm, hm, matrix_duhamel_mixed p hp X Y] at hh + simp only [add_zero, mul_one, one_pow, div_one] at hh + convert! hh using 1 + +end QuantumCalculus + +open scoped ComplexConjugate +open scoped BigOperators ComplexConjugate +open scoped BigOperators ComplexConjugate ENNReal Topology +open MeasureTheory +open scoped BigOperators +open MvPolynomial +open scoped BigOperators ComplexConjugate Classical +open Submodule +open scoped ENNReal +open Module +open scoped ComplexConjugate BigOperators Matrix +open NormedSpace +open scoped Matrix.Norms.Operator +open scoped Topology +open MeasureTheory NormedSpace +open Filter Asymptotics Topology + +namespace QuantumCalculus + +theorem quadratic_coefficient_nonneg {f : ℝ → ℝ} {a : ℝ} + (he : (fun t => f t-a*t^2) =o[𝓝 (0:ℝ)] (fun t => t^2)) + (hf : ∀ᶠ t in 𝓝 (0:ℝ), 0 ≤ f t) : 0 ≤ a := by + by_contra h + have ha : 0 < -a/2 := by linarith + have hh := he.bound ha + obtain ⟨δ,hδ,heδ⟩ := Metric.eventually_nhds_iff.mp (hh.and hf) + have ht : dist (δ/2) (0:ℝ) < δ := by rw [Real.dist_eq, sub_zero, abs_of_pos (by positivity)]; linarith + obtain ⟨h1,h2⟩ := heδ ht + rw [Real.norm_eq_abs, Real.norm_eq_abs, abs_of_nonneg (sq_nonneg (δ/2))] at h1 + have hp : 0 < (δ/2)^2 := sq_pos_of_pos (by positivity) + have h3 := (le_abs_self (f (δ/2)-a*(δ/2)^2)).trans h1 + nlinarith + +theorem hessian_comparison {D P E : ℝ → ℝ} {α Qi Qo m d : ℝ} + (hD : (fun t => D t-Qi/2*t^2) =o[𝓝 (0:ℝ)] (fun t => t^2)) + (hP : (fun t => P t-m*t-Qo/2*t^2) =o[𝓝 (0:ℝ)] (fun t => t^2)) + (hE : HasDerivAt E d 0) (hE0 : E 0 = m) + (hle : ∀ᶠ t in 𝓝 (0:ℝ), t*E t-P t ≤ α*D t) : + 2*d ≤ α*Qi+Qo := by + have hE' : (fun t => E t-m-d*t) =o[𝓝 (0:ℝ)] (fun t => t) := by + simpa only [hE0, sub_zero, smul_eq_mul, mul_comm d] using hE.isLittleO + have hE2 : (fun t => t*(E t-m-d*t)) =o[𝓝 (0:ℝ)] (fun t => t^2) := by + simpa only [pow_two] using (isBigO_refl (fun t : ℝ => t) (𝓝 0)).mul_isLittleO hE' + have hh := ((hD.const_mul_left α).add hP).sub hE2 + have hh' : (fun t => (α*D t-(t*E t-P t))-(α*Qi/2+Qo/2-d)*t^2) + =o[𝓝 (0:ℝ)] (fun t => t^2) := by + convert! hh using 1 + funext t + ring + have hn := quadratic_coefficient_nonneg hh' (hle.mono (fun _ h => sub_nonneg.mpr h)) + linarith +end QuantumCalculus + +end + +open scoped ComplexConjugate +open scoped BigOperators ComplexConjugate +open scoped BigOperators ComplexConjugate ENNReal Topology +open MeasureTheory +open scoped BigOperators +open MvPolynomial +open scoped BigOperators ComplexConjugate Classical +open Submodule +open scoped ENNReal +open Module +open scoped ComplexConjugate BigOperators Matrix +open NormedSpace +open scoped Matrix.Norms.Operator +open scoped Topology +open MeasureTheory NormedSpace +open Filter Asymptotics Topology +open ContinuousLinearMap + +namespace EntropyPhotonNumber + +section +open QuantumTrace TraceEnsemble +variable {n : ℕ} + +def KrausFlow.dual (F : KrausFlow n) (Z : Fock n →L[ℂ] Fock n) : Fock n →L[ℂ] Fock n := + KrausBounded.dual F.V F.norm Z + + theorem KrausFlow.dual_entry (F : KrausFlow n) (Z : Fock n →L[ℂ] Fock n) (x y : Fock n) : + HasSum (fun i => inner ℂ (F.V i x) (Z (F.V i y))) (inner ℂ x (F.dual Z y)) := + KrausBounded.dual_entry F.V F.norm Z x y + + theorem KrausFlow.expectation_dual (F : KrausFlow n) (ρ : State n) + (Z : Fock n →L[ℂ] Fock n) : expectation (F.map ρ) Z = expectation ρ (F.dual Z) := by + have hn := TraceEnsemble.kraus_hasSum F.norm (rootColumn_norm ρ) + have he := F.ensemble (NumberIndex n) (rootColumn ρ) ρ (rootColumn_norm ρ) (rootColumn_operator ρ) + rw [expectation_ensemble (F.map ρ) _ hn.summable he] + have hs := (TraceEnsemble.summable_expectation_norm hn.summable Z).of_norm + change (∑' z : F.I × NumberIndex n, inner ℂ (F.V z.1 (rootColumn ρ z.2)) + (Z (F.V z.1 (rootColumn ρ z.2)))) = _ + have hc (j : NumberIndex n) := F.dual_entry Z (rootColumn ρ j) (rootColumn ρ j) + have hh := ((Equiv.prodComm (NumberIndex n) F.I).hasSum_iff.2 hs.hasSum).prod_fiberwise hc + exact hh.tsum_eq.symm + + theorem KrausFlow.dual_selfAdjoint (F : KrausFlow n) {Z : Fock n →L[ℂ] Fock n} + (hZ : IsSelfAdjoint Z) : IsSelfAdjoint (F.dual Z) := + KrausBounded.dual_selfAdjoint F.V F.norm hZ + + theorem expectation_mixture (α : ℝ) (hα : α ∈ Set.Icc 0 1) (ρ σ : State n) + (Z : Fock n →L[ℂ] Fock n) : + expectation (mixture α hα ρ σ) Z = (α : ℂ)*expectation ρ Z+(1-α : ℂ)*expectation σ Z := by + have hh := ((hasSum_expectation_basis (numberBasis n) ρ Z).mul_left (α : ℂ)).add + ((hasSum_expectation_basis (numberBasis n) σ Z).mul_left (1-α : ℂ)) + apply (hasSum_expectation_basis (numberBasis n) (mixture α hα ρ σ) Z).unique + simpa only [mixture, smul_apply, add_apply, map_add, map_smul, inner_add_right, inner_smul_right, Complex.ofReal_sub, Complex.ofReal_one] using hh + +end + +section +open QuantumCalculus QuantumTrace Filter Asymptotics +open scoped Matrix.Norms.Operator +variable {n : ℕ} {I J : Type*} [Fintype I] [DecidableEq I] + + theorem blockTilt_expectation_formula (ρ : State n) + (b : HilbertBasis (I ⊕ J) ℂ (Fock n)) (p : I ⊕ J → ℝ) + (hp : ∀ j, 0 < p j) (hs : HasSum p 1) + (he : ∀ j, ρ.op (b j) = (p j : ℂ) • b j) + (X : Matrix I I ℂ) (hX : X.IsHermitian) (Z : Fock n →L[ℂ] Fock n) (t : ℝ) : + (expectation (blockTilt b p hp hs X hX t) Z).re = + ((expectation ρ Z).re+matrixReTrace + ((exp (FiniteBlock.tiltMatrix p X t)-Matrix.diagonal (fun i => (p (Sum.inl i) : ℂ)))* + FiniteBlock.entries b Z))/ + ((∑' j, p (Sum.inr j))+matrixReTrace (exp (FiniteBlock.tiltMatrix p X t))) := by + rw [blockTilt, blockState_expectation ρ b p hp hs he, + Complex.div_ofReal_re, Complex.add_re, FiniteBlock.partition_trace] + rfl + + theorem blockTilt_expectation_deriv (ρ : State n) + (b : HilbertBasis (I ⊕ J) ℂ (Fock n)) (p : I ⊕ J → ℝ) + (hp : ∀ j, 0 < p j) (hs : HasSum p 1) + (he : ∀ j, ρ.op (b j) = (p j : ℂ) • b j) + (X : Matrix I I ℂ) (hX : X.IsHermitian) (Z : Fock n →L[ℂ] Fock n) : + HasDerivAt (fun t : ℝ => (expectation (blockTilt b p hp hs X hX t) Z).re) + ((∑ i, ∑ j, DiagonalForms.System.logMean (p (Sum.inl i)) (p (Sum.inl j))* + (X i j*inner ℂ (b (Sum.inl j)) (Z (b (Sum.inl i)))).re)- + (expectation ρ Z).re*(∑ i, p (Sum.inl i)*(X i i).re)) 0 := by + simp_rw [blockTilt_expectation_formula ρ b p hp hs he X hX Z] + exact normalized_expectation_deriv (fun i => p (Sum.inl i)) (fun i => hp (Sum.inl i)) + X (FiniteBlock.entries b Z) _ _ (FiniteBlock.tail_normalization p hs) + + theorem blockTilt_expectation_zero (ρ : State n) + (b : HilbertBasis (I ⊕ J) ℂ (Fock n)) (p : I ⊕ J → ℝ) + (hp : ∀ j, 0 < p j) (hs : HasSum p 1) + (he : ∀ j, ρ.op (b j) = (p j : ℂ) • b j) + (X : Matrix I I ℂ) (hX : X.IsHermitian) (Z : Fock n →L[ℂ] Fock n) : + (expectation (blockTilt b p hp hs X hX 0) Z).re = (expectation ρ Z).re := by + rw [blockTilt_expectation_formula ρ b p hp hs he X hX Z] + have h0 : exp (FiniteBlock.tiltMatrix p X 0) = Matrix.diagonal (fun i => (p (Sum.inl i) : ℂ)) := by + simpa only [FiniteBlock.tiltMatrix, zero_smul, add_zero, one_smul, one_mul, + Real.exp_log (hp _)] using exp_real_diagonal (fun i => Real.log (p (Sum.inl i))) 1 + rw [h0, sub_self, zero_mul, map_zero, add_zero, matrixReTrace_apply, Matrix.trace_diagonal] + simp only [Complex.re_sum, Complex.ofReal_re] + rw [FiniteBlock.tail_normalization p hs, div_one] + + theorem expectation_block_of_eigen (ρ : State n) + (b : HilbertBasis (I ⊕ J) ℂ (Fock n)) (p : I ⊕ J → ℝ) + (he : ∀ j, ρ.op (b j) = (p j : ℂ) • b j) (Z : Matrix I I ℂ) : + expectation ρ (FiniteBlock.block b Z) = ∑ i, (p (Sum.inl i) : ℂ)*Z i i := by + have heq (j : I ⊕ J) : inner ℂ (b j) (FiniteBlock.block b Z (ρ.op (b j))) = + Sum.elim (fun i => (p (Sum.inl i) : ℂ)*Z i i) (fun _ => 0) j := by + rw [he, map_smul, inner_smul_right] + cases j with + | inl i => simp [FiniteBlock.block_basis, inner_sum, inner_smul_right, orthonormal_iff_ite.mp b.orthonormal] + | inr j => simp [FiniteBlock.block_tail] + have hh := HasSum.sum (f := Sum.elim (fun i => (p (Sum.inl i) : ℂ)*Z i i) (fun _ : J => (0:ℂ))) + (hasSum_fintype _) (hasSum_zero : HasSum (fun _ : J => (0:ℂ)) 0) + exact (hasSum_expectation_basis b ρ (FiniteBlock.block b Z)).unique (by + simpa only [heq, Function.comp_def, Sum.elim_inl, add_zero] using hh) + + theorem expectation_block_of_eigen_re (ρ : State n) + (b : HilbertBasis (I ⊕ J) ℂ (Fock n)) (p : I ⊕ J → ℝ) + (he : ∀ j, ρ.op (b j) = (p j : ℂ) • b j) (Z : Matrix I I ℂ) : + (expectation ρ (FiniteBlock.block b Z)).re = ∑ i, p (Sum.inl i)*(Z i i).re := by + rw [expectation_block_of_eigen ρ b p he] + simp + +end + +open QuantumCalculus QuantumTrace Filter Asymptotics + + theorem crossEntropy_mixture_summable {n : ℕ} {J : Type*} + (b : HilbertBasis J ℂ (Fock n)) (p : J → ℝ) (t : ℝ) (ht : t ∈ Set.Icc 0 1) + (ρ σ : State n) + (hρ : Summable (fun j => (-Real.log (p j))*(inner ℂ (b j) (ρ.op (b j))).re)) + (hσ : Summable (fun j => (-Real.log (p j))*(inner ℂ (b j) (σ.op (b j))).re)) : + Summable (fun j => (-Real.log (p j))*(inner ℂ (b j) ((mixture t ht ρ σ).op (b j))).re) := by + apply ((hρ.mul_left t).add (hσ.mul_left (1-t))).congr + intro j + simp only [mixture, add_apply, smul_apply, inner_add_right, inner_smul_right, + Complex.add_re, Complex.mul_re, Complex.ofReal_re, Complex.ofReal_im, zero_mul, sub_zero] + ring + + theorem one_port_relative_entropy_bound {n : ℕ} {J L : Type*} + (F : KrausFlow n) (τ : State n) (κ : ℝ) (hκ : κ ∈ Set.Icc 0 1) + (c a β ζ C : ℝ) (hc : 0 < c) (ha : 0 < a) + (ρ : State n) (hmρ : FiniteMoment 4 ρ) + (b : HilbertBasis J ℂ (Fock n)) (p : J → ℝ) + (d : HilbertBasis L ℂ (Fock n)) (q : L → ℝ) + (he : ∀ j, ρ.op (b j) = (p j : ℂ) • b j) + (he0 : ∀ j, (mixture (1-κ) ⟨sub_nonneg.mpr hκ.2, sub_le_self _ hκ.1⟩ (F.map ρ) τ).op (d j) = + (q j : ℂ) • d j) + (hτ : FiniteEnergy τ) + (hcross : ∀ σ, FiniteMoment 4 σ → + Summable (fun j => (-Real.log (q j))*(inner ℂ (d j) ((F.map σ).op (d j))).re)) + (hcτ : Summable (fun j => (-Real.log (q j))*(inner ℂ (d j) (τ.op (d j))).re)) + (hlog : ∀ σ, FiniteMoment 4 σ → crossEntropy b p σ = + (ζ/a)*numberMoment 4 σ+(c*(1-κ)/a)*crossEntropy d q (F.map σ)+(β/a)*energy σ+C) + (hmin : ∀ σ, FiniteMoment 4 σ → + c*entropy (mixture (1-κ) ⟨sub_nonneg.mpr hκ.2, sub_le_self _ hκ.1⟩ (F.map ρ) τ)- + a*entropy ρ+β*energy ρ+ζ*numberMoment 4 ρ ≤ + c*entropy (mixture (1-κ) ⟨sub_nonneg.mpr hκ.2, sub_le_self _ hκ.1⟩ (F.map σ) τ)- + a*entropy σ+β*energy σ+ζ*numberMoment 4 σ) + (σ : State n) (hmσ : FiniteMoment 4 σ) : + relativeEntropy d q (mixture (1-κ) ⟨sub_nonneg.mpr hκ.2, sub_le_self _ hκ.1⟩ (F.map σ) τ) ≤ + (a/c)*relativeEntropy b p σ := by + let ht : 1-κ ∈ Set.Icc 0 1 := ⟨sub_nonneg.mpr hκ.2, sub_le_self _ hκ.1⟩ + have hself := crossEntropy_self ρ (finiteMoment_finiteEnergy (by norm_num) hmρ) b p he + have hself0 := crossEntropy_self (mixture (1-κ) ht (F.map ρ) τ) + (mixture_finiteEnergy _ _ (F.finiteEnergy _ (finiteMoment_finiteEnergy (by norm_num) hmρ)) hτ) d q he0 + rw [crossEntropy_mixture d q (1-κ) ht (F.map ρ) τ (hcross ρ hmρ) hcτ] at hself0 + rw [hlog ρ hmρ] at hself + have hself' := congrArg (fun x => a*x) hself + have hcancel (x : ℝ) : a*(x/a) = x := mul_div_cancel₀ x ha.ne' + simp only [mul_add, ← mul_assoc, hcancel] at hself' + have hσ := hmin σ hmσ + have hid : a*relativeEntropy b p σ-c*relativeEntropy d q (mixture (1-κ) ht (F.map σ) τ) = + (c*entropy (mixture (1-κ) ht (F.map σ) τ)-a*entropy σ+β*energy σ+ζ*numberMoment 4 σ)- + (c*entropy (mixture (1-κ) ht (F.map ρ) τ)-a*entropy ρ+β*energy ρ+ζ*numberMoment 4 ρ) := by + unfold relativeEntropy + rw [hlog σ hmσ, crossEntropy_mixture d q (1-κ) ht (F.map σ) τ (hcross σ hmσ) hcτ] + field_simp [ha.ne'] + linear_combination hself'-c*hself0 + have hb : 0 ≤ a*relativeEntropy b p σ-c*relativeEntropy d q (mixture (1-κ) ht (F.map σ) τ) := by + rw [hid] + exact sub_nonneg.mpr hσ + rw [div_mul_eq_mul_div] + exact (le_div_iff₀ hc).mpr (by nlinarith) + +end EntropyPhotonNumber + +namespace FiniteBlock +open DiagonalForms.System +variable {I J : Type*} [Fintype I] +def mean (p : I ⊕ J → ℝ) (X : Matrix I I ℂ) : ℝ := ∑ i, p (Sum.inl i)*(X i i).re + +def variance (p : I ⊕ J → ℝ) (X : Matrix I I ℂ) : ℝ := + (∑ i, ∑ j, logMean (p (Sum.inl i)) (p (Sum.inl j))*Complex.normSq (X i j))-mean p X^2 + +def covariance (p : I ⊕ J → ℝ) (X Y : Matrix I I ℂ) (μ : ℝ) : ℝ := + (∑ i, ∑ j, logMean (p (Sum.inl i)) (p (Sum.inl j))*(X i j*Y j i).re)-μ*mean p X +end FiniteBlock + +namespace EntropyPhotonNumber +open QuantumCalculus QuantumTrace Filter Asymptotics +open scoped Matrix.Norms.Operator + + theorem flow_finite_hessian {n : ℕ} {I J K L : Type*} + [Fintype I] [DecidableEq I] [Fintype K] [DecidableEq K] + (F : KrausFlow n) (τ : State n) (κ : ℝ) (hκ : κ ∈ Set.Icc 0 1) + (c a β ζ C : ℝ) (hc : 0 < c) (ha : 0 < a) + (ρ : State n) (hmρ : FiniteMoment 4 ρ) + (b : HilbertBasis (I ⊕ J) ℂ (Fock n)) (p : I ⊕ J → ℝ) + (hp : ∀ j, 0 < p j) (hs : HasSum p 1) + (d : HilbertBasis (K ⊕ L) ℂ (Fock n)) (q : K ⊕ L → ℝ) + (hq : ∀ j, 0 < q j) (ht : HasSum q 1) + (he : ∀ j, ρ.op (b j) = (p j : ℂ) • b j) + (he0 : ∀ j, (mixture (1-κ) ⟨sub_nonneg.mpr hκ.2, sub_le_self _ hκ.1⟩ (F.map ρ) τ).op (d j) = + (q j : ℂ) • d j) + (hτ : FiniteEnergy τ) + (hcross : ∀ σ, FiniteMoment 4 σ → + Summable (fun j => (-Real.log (q j))*(inner ℂ (d j) ((F.map σ).op (d j))).re)) + (hcτ : Summable (fun j => (-Real.log (q j))*(inner ℂ (d j) (τ.op (d j))).re)) + (hlog : ∀ σ, FiniteMoment 4 σ → crossEntropy b p σ = + (ζ/a)*numberMoment 4 σ+(c*(1-κ)/a)*crossEntropy d q (F.map σ)+(β/a)*energy σ+C) + (hmin : ∀ σ, FiniteMoment 4 σ → + c*entropy (mixture (1-κ) ⟨sub_nonneg.mpr hκ.2, sub_le_self _ hκ.1⟩ (F.map ρ) τ)- + a*entropy ρ+β*energy ρ+ζ*numberMoment 4 ρ ≤ + c*entropy (mixture (1-κ) ⟨sub_nonneg.mpr hκ.2, sub_le_self _ hκ.1⟩ (F.map σ) τ)- + a*entropy σ+β*energy σ+ζ*numberMoment 4 σ) + (X : Matrix I I ℂ) (hX : X.IsHermitian) (Z : Matrix K K ℂ) (hZ : Z.IsHermitian) : + 2*((1-κ)*FiniteBlock.covariance p X (FiniteBlock.entries b (F.dual (FiniteBlock.block d Z))) + (expectation ρ (F.dual (FiniteBlock.block d Z))).re) ≤ + (a/c)*FiniteBlock.variance p X+FiniteBlock.variance q Z := by + let hκ' : 1-κ ∈ Set.Icc 0 1 := ⟨sub_nonneg.mpr hκ.2, sub_le_self _ hκ.1⟩ + let σ := fun t => blockTilt b p hp hs X hX t + let ω := fun t => mixture (1-κ) hκ' (F.map (σ t)) τ + let Y := FiniteBlock.block d Z + have hm (t : ℝ) : FiniteMoment 4 (σ t) := blockTilt_finiteMoment ρ hmρ b p hp hs he X hX t + have hf (t : ℝ) : FiniteEnergy (ω t) := mixture_finiteEnergy _ _ + (F.finiteEnergy _ (finiteMoment_finiteEnergy (by norm_num) (hm t))) hτ + have hcro (t : ℝ) : Summable (fun j => (-Real.log (q j))*(inner ℂ (d j) ((ω t).op (d j))).re) := + crossEntropy_mixture_summable d q (1-κ) hκ' (F.map (σ t)) τ (hcross _ (hm t)) hcτ + have hD := blockTilt_relativeEntropy_expansion_of_moment ρ hmρ b p hp hs he X hX + have hP := finite_block_partition_expansion (fun i => q (Sum.inl i)) (fun i => hq (Sum.inl i)) Z hZ + (∑' j, q (Sum.inr j)) (FiniteBlock.tail_normalization q ht) + have hd := blockTilt_expectation_deriv ρ b p hp hs he X hX (F.dual Y) + have hE : HasDerivAt (fun t => (expectation (ω t) Y).re) + ((1-κ)*FiniteBlock.covariance p X (FiniteBlock.entries b (F.dual Y)) (expectation ρ (F.dual Y)).re) 0 := by + convert! (hd.const_mul (1-κ)).add_const (κ*(expectation τ Y).re) using 1 + funext t + dsimp only [ω] + rw [expectation_mixture, F.expectation_dual] + simp only [Complex.add_re, Complex.mul_re, Complex.ofReal_re, Complex.ofReal_im, + Complex.sub_re, Complex.sub_im, Complex.one_re, Complex.one_im, zero_mul, sub_self, sub_zero] + ring + have hE0 : (expectation (ω 0) Y).re = FiniteBlock.mean q Z := by + trans (expectation (mixture (1-κ) hκ' (F.map ρ) τ) Y).re + · dsimp only [ω] + rw [expectation_mixture, expectation_mixture, F.expectation_dual, F.expectation_dual] + simp only [Complex.add_re, Complex.mul_re, Complex.ofReal_re, Complex.ofReal_im, + Complex.sub_re, Complex.sub_im, Complex.one_re, Complex.one_im, zero_mul, sub_self, sub_zero] + rw [show (expectation (σ 0) (F.dual Y)).re = (expectation ρ (F.dual Y)).re from + blockTilt_expectation_zero ρ b p hp hs he X hX (F.dual Y)] + · exact expectation_block_of_eigen_re _ d q he0 Z + have hi (t : ℝ) : t*(expectation (ω t) Y).re- + Real.log ((∑' j, q (Sum.inr j))+matrixReTrace (exp (FiniteBlock.tiltMatrix q Z t))) ≤ + (a/c)*relativeEntropy b p (σ t) := by + have hlo := block_relativeEntropy_tilt_lower (ω t) (hf t) d q hq ht (hcro t) Z hZ t + exact hlo.trans (one_port_relative_entropy_bound F τ κ hκ c a β ζ C hc ha ρ hmρ b p d q + he he0 hτ hcross hcτ hlog hmin (σ t) (hm t)) + exact hessian_comparison hD hP hE hE0 (Filter.Eventually.of_forall hi) + +end EntropyPhotonNumber + +namespace FiniteBlock +open DiagonalForms.System +open scoped ComplexConjugate +variable {I J : Type*} [Fintype I] + + theorem mean_scale (p : I ⊕ J → ℝ) (X : Matrix I I ℂ) (t : ℝ) : + mean p ((t:ℂ) • X) = t*mean p X := by + simp only [mean, Matrix.smul_apply, smul_eq_mul, Complex.mul_re, Complex.ofReal_re, + Complex.ofReal_im, zero_mul, sub_zero, Finset.mul_sum] + apply Finset.sum_congr rfl + intro i _; ring + + theorem variance_scale (p : I ⊕ J → ℝ) (X : Matrix I I ℂ) (t : ℝ) : + variance p ((t:ℂ) • X) = t^2*variance p X := by + rw [variance, mean_scale, variance] + simp only [Matrix.smul_apply, smul_eq_mul, Complex.normSq_mul, Complex.normSq_ofReal] + have hh : (∑ i, ∑ j, logMean (p (Sum.inl i)) (p (Sum.inl j)) * + (t^2*Complex.normSq (X i j))) = + t^2*(∑ i, ∑ j, logMean (p (Sum.inl i)) (p (Sum.inl j))*Complex.normSq (X i j)) := by + simp_rw [Finset.mul_sum] + congr 1; ext i; congr 1; ext j; ring + simp only [← pow_two] + rw [hh] + ring + + theorem covariance_scale_self (p : I ⊕ J → ℝ) (X : Matrix I I ℂ) (hX : X.IsHermitian) + (μ t : ℝ) : covariance p ((t:ℂ) • X) X μ = + t*((∑ i, ∑ j, logMean (p (Sum.inl i)) (p (Sum.inl j))*Complex.normSq (X i j))-μ*mean p X) := by + have hc (i j : I) : (X j i) = conj (X i j) := by + exact (congrFun (congrFun hX.eq j) i).symm + rw [covariance, mean_scale] + simp only [Matrix.smul_apply, smul_eq_mul] + have hh (i j : I) : ((t:ℂ)*X i j*X j i).re = t*Complex.normSq (X i j) := by + rw [hc i j, mul_assoc, Complex.mul_conj] + simp + simp_rw [hh] + have he : (∑ i, ∑ j, logMean (p (Sum.inl i)) (p (Sum.inl j)) * + (t*Complex.normSq (X i j))) = + t*(∑ i, ∑ j, logMean (p (Sum.inl i)) (p (Sum.inl j))*Complex.normSq (X i j)) := by + simp_rw [Finset.mul_sum] + congr 1; ext i; congr 1; ext j; ring + rw [he] + ring +end FiniteBlock + +namespace BKM +open DiagonalForms.System +variable {J E : Type*} [NormedAddCommGroup E] [InnerProductSpace ℂ E] [CompleteSpace E] + + theorem compression_mean (b : HilbertBasis J ℂ E) (p : J → ℝ) (Y : E →L[ℂ] E) (s : Finset J) : + FiniteBlock.mean (p ∘ Equiv.sumCompl (fun j => j ∈ s)) + (FiniteBlock.entries (reindexBasis b (Equiv.sumCompl (fun j => j ∈ s))) Y) = + ∑ j ∈ s, p j*(entry b Y j j).re := by + classical + simp only [FiniteBlock.mean, FiniteBlock.entries, reindexBasis_apply, Function.comp_apply, + Equiv.sumCompl_apply_inl, entry] + exact (Finset.sum_subtype s (fun _ => Iff.rfl) (fun j => p j*(inner ℂ (b j) (Y (b j))).re)).symm + + theorem compression_quadratic (b : HilbertBasis J ℂ E) (p : J → ℝ) (Y : E →L[ℂ] E) (s : Finset J) : + (∑ i : s, ∑ j : s, logMean (p i.val) (p j.val)*Complex.normSq + (FiniteBlock.entries (reindexBasis b (Equiv.sumCompl (fun j => j ∈ s))) Y i j)) = + ∑ i ∈ s, ∑ j ∈ s, logMean (p i) (p j)*Complex.normSq (entry b Y i j) := by + classical + simp only [FiniteBlock.entries, reindexBasis_apply, Equiv.sumCompl_apply_inl, entry, + Finset.sum_subtype s (fun _ => Iff.rfl)] + + theorem compression_hessian_to_variance (b : HilbertBasis J ℂ E) (p : J → ℝ) + (hp : ∀ j, 0 < p j) (hs : Summable p) (Y : E →L[ℂ] E) (μ α γ W : ℝ) + (hm : HasSum (fun j => p j*(entry b Y j j).re) μ) (hα : 0 < α) + (hY : IsSelfAdjoint Y) + (h : ∀ (s : Finset J) (t : ℝ), + let b' := reindexBasis b (Equiv.sumCompl (fun j => j ∈ s)) + let p' := p ∘ Equiv.sumCompl (fun j => j ∈ s) + let X := FiniteBlock.entries b' Y + 2*(γ*FiniteBlock.covariance p' ((t:ℂ) • X) X μ) ≤ + α*FiniteBlock.variance p' ((t:ℂ) • X)+W) : + γ^2*((∑' ij : J × J, logMean (p ij.1) (p ij.2)*Complex.normSq (entry b Y ij.1 ij.2))-μ^2) ≤ α*W := by + classical + apply finite_hessian_to_variance _ _ μ _ α γ W (logMean_summable b p hp hs Y).hasSum hm hα + intro s t + have hh := h s t + dsimp only at hh + have hX : (FiniteBlock.entries (reindexBasis b (Equiv.sumCompl (fun j => j ∈ s))) Y).IsHermitian := by + ext i j + change conj (inner ℂ (reindexBasis b _ (Sum.inl j)) (Y (reindexBasis b _ (Sum.inl i)))) = + inner ℂ (reindexBasis b _ (Sum.inl i)) (Y (reindexBasis b _ (Sum.inl j))) + rw [inner_conj_symm] + exact (ContinuousLinearMap.isSelfAdjoint_iff_isSymmetric.mp hY) _ _ + rw [FiniteBlock.covariance_scale_self _ _ hX, FiniteBlock.variance_scale, + FiniteBlock.variance, compression_mean] at hh + simp only [Function.comp_apply, Equiv.sumCompl_apply_inl, compression_quadratic] at hh + nlinarith +end BKM + +namespace EntropyPhotonNumber + +section +open QuantumTrace DiagonalForms.System +open scoped ComplexConjugate +variable {n : ℕ} {J K L : Type*} [Fintype K] [DecidableEq K] + + theorem crossEntropy_reindex {M : Type*} (b : HilbertBasis J ℂ (Fock n)) (p : J → ℝ) + (e : M ≃ J) (ρ : State n) : crossEntropy (BKM.reindexBasis b e) (p ∘ e) ρ = crossEntropy b p ρ := by + simp only [crossEntropy, BKM.reindexBasis_apply, Function.comp_def] + exact e.tsum_eq (fun j : J => (-Real.log (p j))*(inner ℂ (b j) (ρ.op (b j))).re) + + theorem finite_entries_selfAdjoint {I T E : Type*} [Fintype I] [NormedAddCommGroup E] + [InnerProductSpace ℂ E] [CompleteSpace E] (b : HilbertBasis (I ⊕ T) ℂ E) + (Z : E →L[ℂ] E) (hZ : IsSelfAdjoint Z) : (FiniteBlock.entries b Z).IsHermitian := by + ext i j + change conj (inner ℂ (b (Sum.inl j)) (Z (b (Sum.inl i)))) = inner ℂ (b (Sum.inl i)) (Z (b (Sum.inl j))) + rw [inner_conj_symm] + exact (ContinuousLinearMap.isSelfAdjoint_iff_isSymmetric.mp hZ) _ _ + + theorem expectation_eigen_hasSum (ρ : State n) (b : HilbertBasis J ℂ (Fock n)) (p : J → ℝ) + (he : ∀ j, ρ.op (b j) = (p j : ℂ) • b j) (Z : Fock n →L[ℂ] Fock n) : + HasSum (fun j => p j*(BKM.entry b Z j j).re) (expectation ρ Z).re := by + have h := (hasSum_expectation_basis b ρ Z).mapL Complex.reCLM + simpa only [he, map_smul, inner_smul_right, Complex.reCLM_apply, Complex.mul_re, + Complex.ofReal_re, Complex.ofReal_im, zero_mul, sub_zero, BKM.entry] using h + + theorem flow_full_hessian (F : KrausFlow n) (τ : State n) (κ : ℝ) (hκ : κ ∈ Set.Icc 0 1) + (c a β ζ C : ℝ) (hc : 0 < c) (ha : 0 < a) (ρ : State n) (hmρ : FiniteMoment 4 ρ) + (b : HilbertBasis J ℂ (Fock n)) (p : J → ℝ) (hp : ∀ j, 0 < p j) (hs : HasSum p 1) + (d : HilbertBasis (K ⊕ L) ℂ (Fock n)) (q : K ⊕ L → ℝ) + (hq : ∀ j, 0 < q j) (ht : HasSum q 1) + (he : ∀ j, ρ.op (b j) = (p j : ℂ) • b j) + (he0 : ∀ j, (mixture (1-κ) ⟨sub_nonneg.mpr hκ.2, sub_le_self _ hκ.1⟩ (F.map ρ) τ).op (d j) = + (q j : ℂ) • d j) + (hτ : FiniteEnergy τ) + (hcross : ∀ σ, FiniteMoment 4 σ → + Summable (fun j => (-Real.log (q j))*(inner ℂ (d j) ((F.map σ).op (d j))).re)) + (hcτ : Summable (fun j => (-Real.log (q j))*(inner ℂ (d j) (τ.op (d j))).re)) + (hlog : ∀ σ, FiniteMoment 4 σ → crossEntropy b p σ = + (ζ/a)*numberMoment 4 σ+(c*(1-κ)/a)*crossEntropy d q (F.map σ)+(β/a)*energy σ+C) + (hmin : ∀ σ, FiniteMoment 4 σ → + c*entropy (mixture (1-κ) ⟨sub_nonneg.mpr hκ.2, sub_le_self _ hκ.1⟩ (F.map ρ) τ)- + a*entropy ρ+β*energy ρ+ζ*numberMoment 4 ρ ≤ + c*entropy (mixture (1-κ) ⟨sub_nonneg.mpr hκ.2, sub_le_self _ hκ.1⟩ (F.map σ) τ)- + a*entropy σ+β*energy σ+ζ*numberMoment 4 σ) + (Z : Matrix K K ℂ) (hZ : Z.IsHermitian) : + (1-κ)^2*((∑' ij : J × J, logMean (p ij.1) (p ij.2)* + Complex.normSq (BKM.entry b (F.dual (FiniteBlock.block d Z)) ij.1 ij.2))- + (expectation ρ (F.dual (FiniteBlock.block d Z))).re^2) ≤ (a/c)*FiniteBlock.variance q Z := by + classical + let Y := F.dual (FiniteBlock.block d Z) + let μ := (expectation ρ Y).re + have hY : IsSelfAdjoint Y := F.dual_selfAdjoint (ContinuousLinearMap.isSelfAdjoint_iff_isSymmetric.mpr (FiniteBlock.block_symmetric d Z hZ)) + apply BKM.compression_hessian_to_variance b p hp hs.summable Y μ (a/c) (1-κ) + (FiniteBlock.variance q Z) (expectation_eigen_hasSum ρ b p he Y) (div_pos ha hc) hY + intro s t + let e := Equiv.sumCompl (fun j => j ∈ s) + let b' := BKM.reindexBasis b e + let p' := p ∘ e + let X := FiniteBlock.entries b' Y + have hX := finite_entries_selfAdjoint b' Y hY + have hl' (σ : State n) (hh : FiniteMoment 4 σ) : crossEntropy b' p' σ = + (ζ/a)*numberMoment 4 σ+(c*(1-κ)/a)*crossEntropy d q (F.map σ)+(β/a)*energy σ+C := by + rw [crossEntropy_reindex] + exact hlog σ hh + have he' (j) : ρ.op (b' j) = (p' j : ℂ) • b' j := by + simpa only [b', p', BKM.reindexBasis_apply, Function.comp_apply] using he (e j) + have htself : IsSelfAdjoint (t : ℂ) := by + change conj (t : ℂ) = (t : ℂ) + exact Complex.conj_ofReal t + have hh := flow_finite_hessian F τ κ hκ c a β ζ C hc ha ρ hmρ b' p' + (fun j => hp (e j)) (e.hasSum_iff.mpr hs) d q hq ht he' he0 hτ hcross hcτ hl' + hmin ((t:ℂ) • X) (hX.smul htself) Z hZ + exact hh + +end + +open QuantumTrace DiagonalForms.System +variable {n : ℕ} {K L : Type*} [Fintype K] [DecidableEq K] + +theorem minimum_component_hessian + (F : KrausFlow n) (τ : State n) {r : ℝ} (hr : 0 < r) (hτ : τ = thermalState n r hr) + (κ : ℝ) (hκ : κ ∈ Set.Icc 0 1) (hκ0 : 0 < κ) + (c a β ζ : ℝ) (hc : 0 < c) (ha : 0 < a) (hβ : 0 ≤ β) (hζ : 0 < ζ) + (ρ : State n) (hmρ : FiniteMoment 4 ρ) + (d : HilbertBasis (K ⊕ L) ℂ (Fock n)) (q : K ⊕ L → ℝ) + (hq : ∀ j, 0 < q j) (ht : HasSum q 1) + (he0 : ∀ j, (mixture (1-κ) ⟨sub_nonneg.mpr hκ.2, sub_le_self _ hκ.1⟩ (F.map ρ) τ).op (d j) = + (q j : ℂ) • d j) + (hmin : ∀ σ, FiniteMoment 4 σ → + c*entropy (mixture (1-κ) ⟨sub_nonneg.mpr hκ.2, sub_le_self _ hκ.1⟩ (F.map ρ) τ)-a*entropy ρ+ + β*energy ρ+ζ*numberMoment 4 ρ ≤ + c*entropy (mixture (1-κ) ⟨sub_nonneg.mpr hκ.2, sub_le_self _ hκ.1⟩ (F.map σ) τ)-a*entropy σ+ + β*energy σ+ζ*numberMoment 4 σ) : + ∃ G : GibbsData n (ζ/a) ρ, ∀ (Z : Matrix K K ℂ), Z.IsHermitian → + (1-κ)^2*((∑' ij : G.J × G.J, logMean (gibbsWeight G.eigenval ij.1) + (gibbsWeight G.eigenval ij.2)* + Complex.normSq (BKM.entry G.basis (F.dual (FiniteBlock.block d Z)) ij.1 ij.2))- + (expectation ρ (F.dual (FiniteBlock.block d Z))).re^2) ≤ (a/c)*FiniteBlock.variance q Z := by + obtain ⟨G,hG⟩ := flow_minimum_gibbs F τ hr hτ κ hκ hκ0 c a β ζ hc ha hβ hζ ρ hmρ + d q hq ht he0 hmin + let _ := G.nonempty + let htκ : 1-κ ∈ Set.Icc 0 1 := ⟨sub_nonneg.mpr hκ.2, sub_le_self _ hκ.1⟩ + let ρ0 := mixture (1-κ) htκ (F.map ρ) τ + have hle : (κ : ℂ) • (thermalState n r hr).op ≤ ρ0.op := by + rw [← hτ] + exact mixture_replacement_le κ hκ (F.map ρ) τ + have hfτ : FiniteEnergy τ := by simpa only [hτ] using thermalState_finiteEnergy n r hr + have hcross (σ : State n) (hm : FiniteMoment 4 σ) : + Summable (fun j => (-Real.log (q j))*(inner ℂ (d j) ((F.map σ).op (d j))).re) := + crossEntropy_finite ρ0 (F.map σ) (F.finiteEnergy _ (finiteMoment_finiteEnergy (by norm_num) hm)) + hr hκ0 hκ.2 hle d q hq ht he0 + have hcτ := crossEntropy_finite ρ0 τ hfτ hr hκ0 hκ.2 hle d q hq ht he0 + have hα : 0 ≤ c*(1-κ)/a := div_nonneg (mul_nonneg hc.le (sub_nonneg.mpr hκ.2)) ha.le + have hlog (σ : State n) (hm : FiniteMoment 4 σ) : + crossEntropy G.basis (gibbsWeight G.eigenval) σ = + (ζ/a)*numberMoment 4 σ+(c*(1-κ)/a)*crossEntropy d q (F.map σ)+(β/a)*energy σ+ + Real.log (heatPartition G.eigenval) := + (G.crossEntropy_hamiltonian d q hq ht F hα (div_nonneg hβ ha.le) (div_pos hζ ha) + hG σ hm (hcross σ hm)).tsum_eq + refine ⟨G, fun Z hZ => ?_⟩ + exact flow_full_hessian F τ κ hκ c a β ζ (Real.log (heatPartition G.eigenval)) hc ha + ρ hmρ G.basis (gibbsWeight G.eigenval) (gibbsWeight_pos G.eigenval G.heat) + (gibbsWeight_hasSum G.eigenval G.heat) d q hq ht G.eigen he0 hfτ hcross hcτ hlog hmin Z hZ + +end EntropyPhotonNumber + +namespace BKM +open scoped BigOperators ComplexConjugate ComplexStarModule +open DiagonalForms.System +variable {J E : Type*} [NormedAddCommGroup E] [InnerProductSpace ℂ E] +theorem entry_real_smul (b : HilbertBasis J ℂ E) (c : ℝ) (Z : E →L[ℂ] E) (i j : J) : + entry b (c • Z) i j=(c:ℂ)*entry b Z i j := by + rw [RCLike.real_smul_eq_coe_smul (K := ℂ), entry_smul] + rfl + +variable [CompleteSpace E] + +theorem entry_realPart (b : HilbertBasis J ℂ E) (Z : E →L[ℂ] E) (i j : J) : + entry b (realPart Z : E →L[ℂ] E) i j=(entry b Z i j+conj (entry b Z j i))/2 := by + rw [realPart_apply_coe, entry_real_smul, entry_add, ContinuousLinearMap.star_eq_adjoint, entry_adjoint] + push_cast + ring + +theorem entry_imaginaryPart (b : HilbertBasis J ℂ E) (Z : E →L[ℂ] E) (i j : J) : + entry b (imaginaryPart Z : E →L[ℂ] E) i j=-Complex.I*(entry b Z i j-conj (entry b Z j i))/2 := by + rw [imaginaryPart_apply_coe, entry_smul, entry_real_smul, entry_sub, + ContinuousLinearMap.star_eq_adjoint, entry_adjoint] + push_cast + ring + +end BKM + +namespace Complex +open scoped _root_.Complex +open scoped ComplexConjugate + theorem normSq_polar_parts (z w : ℂ) : + _root_.Complex.normSq ((z+conj w)/2)+_root_.Complex.normSq (-_root_.Complex.I*(z-conj w)/2)=(_root_.Complex.normSq z+_root_.Complex.normSq w)/2 := by + simp only [div_eq_mul_inv, _root_.Complex.normSq_apply, _root_.Complex.add_re, _root_.Complex.add_im, _root_.Complex.mul_re, _root_.Complex.mul_im, _root_.Complex.sub_re, _root_.Complex.sub_im, + _root_.Complex.conj_re, _root_.Complex.conj_im, _root_.Complex.neg_re, _root_.Complex.neg_im, _root_.Complex.I_re, _root_.Complex.I_im, _root_.Complex.inv_re, _root_.Complex.inv_im] + norm_num + ring +end Complex + +namespace BKM + +section +open scoped BigOperators ComplexConjugate ComplexStarModule +open DiagonalForms.System +variable {J E : Type*} [NormedAddCommGroup E] [InnerProductSpace ℂ E] [CompleteSpace E] +theorem quadratic_adjoint (b : HilbertBasis J ℂ E) (p : J → ℝ) (Z : E →L[ℂ] E) : + quadratic b p Z.adjoint=quadratic b p Z := by + simp only [quadratic, entry_adjoint, Complex.normSq_conj] + have h := (Equiv.prodComm J J).tsum_eq (fun ij : J × J => logMean (p ij.1) (p ij.2)*Complex.normSq (entry b Z ij.1 ij.2)) + convert! h using 1 + congr 1 + ext ij + exact congrArg (fun x => x*Complex.normSq (entry b Z ij.2 ij.1)) (logMean_symm _ _) + +theorem quadratic_parts (b : HilbertBasis J ℂ E) (p : J → ℝ) (hp : ∀ j,0 < p j) (hs : Summable p) + (Z : E →L[ℂ] E) : + quadratic b p (realPart Z : E →L[ℂ] E)+quadratic b p (imaginaryPart Z : E →L[ℂ] E)=quadratic b p Z := by + have hr := logMean_summable b p hp hs (realPart Z : E →L[ℂ] E) + have hi := logMean_summable b p hp hs (imaginaryPart Z : E →L[ℂ] E) + have hz := logMean_summable b p hp hs Z + have ha := logMean_summable b p hp hs Z.adjoint + have he (ij : J × J) : + logMean (p ij.1) (p ij.2)*Complex.normSq (entry b (realPart Z : E →L[ℂ] E) ij.1 ij.2)+ + logMean (p ij.1) (p ij.2)*Complex.normSq (entry b (imaginaryPart Z : E →L[ℂ] E) ij.1 ij.2)= + (logMean (p ij.1) (p ij.2)*Complex.normSq (entry b Z ij.1 ij.2)+ + logMean (p ij.1) (p ij.2)*Complex.normSq (entry b Z.adjoint ij.1 ij.2))/2 := by + rw [← mul_add, entry_realPart, entry_imaginaryPart, Complex.normSq_polar_parts, entry_adjoint, Complex.normSq_conj] + ring + have hh := hr.hasSum.add hi.hasSum + simp_rw [he] at hh + have ht := (hz.hasSum.add ha.hasSum).div_const 2 + have heq := hh.unique ht + change quadratic b p (realPart Z : E →L[ℂ] E)+quadratic b p (imaginaryPart Z : E →L[ℂ] E)= + (quadratic b p Z+quadratic b p Z.adjoint)/2 at heq + rw [quadratic_adjoint] at heq + linarith + +end + +section +open scoped BigOperators ComplexConjugate ComplexStarModule +open DiagonalForms.System +variable {J E : Type*} [NormedAddCommGroup E] [InnerProductSpace ℂ E] +variable [CompleteSpace E] + +theorem mean_adjoint (b : HilbertBasis J ℂ E) (p : J → ℝ) (Z : E →L[ℂ] E) : + mean b p Z.adjoint=conj (mean b p Z) := by + simp only [mean, entry_adjoint, Complex.conj_tsum, map_mul, Complex.conj_ofReal] + +theorem mean_parts (b : HilbertBasis J ℂ E) (p : J → ℝ) (hp : ∀j,0 ≤ p j) (hs : Summable p) + (Z : E →L[ℂ] E) : + mean b p (realPart Z : E →L[ℂ] E)=(mean b p Z).re ∧ + mean b p (imaginaryPart Z : E →L[ℂ] E)=(mean b p Z).im := by + have hr (j : J) : + (p j : ℂ)*entry b (realPart Z : E →L[ℂ] E) j j = + (p j : ℂ)*(entry b Z j j + conj (entry b Z j j))/2 := by rw [entry_realPart]; ring + have hi (j : J) : + (p j : ℂ)*entry b (imaginaryPart Z : E →L[ℂ] E) j j = + -Complex.I*((p j : ℂ)*entry b Z j j-conj ((p j : ℂ)*entry b Z j j))/2 := by + rw [entry_imaginaryPart] + simp only [map_mul, Complex.conj_ofReal] + ring + have h := mean_summable b p hp hs Z + have hc := (h.hasSum.mapL Complex.conjCLE.toContinuousLinearMap) + change HasSum (fun j => conj ((p j : ℂ)*entry b Z j j)) (conj (mean b p Z)) at hc + constructor + · have hh := (h.hasSum.add hc).div_const 2 + have he (j : J) : + ((p j : ℂ)*entry b Z j j+conj ((p j : ℂ)*entry b Z j j))/2= + (p j : ℂ)*entry b (realPart Z : E →L[ℂ] E) j j := by + rw [hr, map_mul, Complex.conj_ofReal]; ring + simp_rw [he] at hh + rw [mean, hh.tsum_eq] + change (mean b p Z+conj (mean b p Z))/2=((mean b p Z).re:ℂ) + rw [Complex.add_conj] + push_cast + ring + · have hh := ((h.hasSum.sub hc).mul_left (-Complex.I)).div_const 2 + simp_rw [← hi] at hh + rw [mean, hh.tsum_eq] + change -Complex.I*(mean b p Z-conj (mean b p Z))/2=((mean b p Z).im:ℂ) + rw [Complex.sub_conj] + push_cast + ring_nf + simp only [Complex.I_sq] + ring + +def variance (b : HilbertBasis J ℂ E) (p : J → ℝ) (Z : E →L[ℂ] E) : ℝ := + quadratic b p Z - Complex.normSq (mean b p Z) + +theorem variance_parts (b : HilbertBasis J ℂ E) (p : J → ℝ) (hp : ∀j,0 < p j) (hs : Summable p) + (Z : E →L[ℂ] E) : + variance b p (realPart Z : E →L[ℂ] E)+variance b p (imaginaryPart Z : E →L[ℂ] E)=variance b p Z := by + obtain ⟨hr,hi⟩ := mean_parts b p (fun j => (hp j).le) hs Z + simp only [variance, hr, hi, Complex.normSq_apply, Complex.ofReal_re, Complex.ofReal_im, zero_mul, add_zero] + have h := quadratic_parts b p hp hs Z + linarith + +end + +open scoped BigOperators ComplexConjugate ComplexStarModule +open DiagonalForms.System +variable {I J E : Type*} [Fintype I] [DecidableEq I] +variable [NormedAddCommGroup E] [InnerProductSpace ℂ E] [CompleteSpace E] + +omit [CompleteSpace E] in +theorem entry_block (b : HilbertBasis (I ⊕ J) ℂ E) (X : Matrix I I ℂ) (i j : I ⊕ J) : + entry b (FiniteBlock.block b X) i j=match i,j with + | Sum.inl a,Sum.inl c => X a c + | _,_ => 0 := by + classical + cases i <;> cases j <;> + simp [entry, FiniteBlock.block_basis, FiniteBlock.block_tail, + orthonormal_iff_ite.mp b.orthonormal] + +omit [CompleteSpace E] in +theorem mean_block (b : HilbertBasis (I ⊕ J) ℂ E) (p : I ⊕ J → ℝ) (X : Matrix I I ℂ) : + mean b p (FiniteBlock.block b X)=∑ i, (p (Sum.inl i):ℂ)*X i i := by + have hh := HasSum.sum (f := fun j : I ⊕ J => (p j:ℂ)*entry b (FiniteBlock.block b X) j j) + (by simpa only [Function.comp_def, entry_block] using hasSum_fintype (fun i : I => (p (Sum.inl i):ℂ)*X i i)) + (by simpa only [Function.comp_def, entry_block, mul_zero] using (hasSum_zero : HasSum (fun _ : J => (0:ℂ)) 0)) + simpa only [add_zero, mean] using hh.tsum_eq + +theorem quadratic_block (b : HilbertBasis (I ⊕ J) ℂ E) (p : I ⊕ J → ℝ) + (hp : ∀ j, 0

logMean (p (Sum.inl i)) (p j)*Complex.normSq (entry b (FiniteBlock.block b X) (Sum.inl i) j)) + (by simpa only [Function.comp_def, entry_block] using hasSum_fintype (fun j : I => logMean (p (Sum.inl i)) (p (Sum.inl j))*Complex.normSq (X i j))) + (by simpa only [Function.comp_def, entry_block, Complex.normSq_zero, mul_zero] using (hasSum_zero : HasSum (fun _ : J => (0:ℝ)) 0)) + simpa only [add_zero] using hh.tsum_eq + have hh := HasSum.sum (f := fun i : I ⊕ J => ∑' j : I ⊕ J, logMean (p i) (p j)*Complex.normSq (entry b (FiniteBlock.block b X) i j)) + (by simpa only [Function.comp_def, row] using hasSum_fintype (fun i : I => ∑ j, logMean (p (Sum.inl i)) (p (Sum.inl j))*Complex.normSq (X i j))) + (by simpa only [Function.comp_def, entry_block, Complex.normSq_zero, mul_zero, tsum_zero] using (hasSum_zero : HasSum (fun _ : J => (0:ℝ)) 0)) + simpa only [add_zero] using hh.tsum_eq + +omit [Fintype I] [DecidableEq I] in +theorem normSq_mean_selfAdjoint (b : HilbertBasis J ℂ E) (p : J → ℝ) + (Z : E →L[ℂ] E) (hZ : IsSelfAdjoint Z) : Complex.normSq (mean b p Z)=(mean b p Z).re^2 := by + have hh := mean_adjoint b p Z + rw [show Z.adjoint=Z from hZ] at hh + have hi := congrArg Complex.im hh + simp only [Complex.conj_im] at hi + rw [Complex.normSq_apply] + nlinarith + +theorem variance_block (b : HilbertBasis (I ⊕ J) ℂ E) (p : I ⊕ J → ℝ) + (hp : ∀ j, 0

(-Real.log (q j))*(inner ℂ (d j) ((F.map σ).op (d j))).re)) + (hcτ : Summable (fun j => (-Real.log (q j))*(inner ℂ (d j) (τ.op (d j))).re)) + (hlog : ∀ σ, FiniteMoment 4 σ → crossEntropy b p σ = + (ζ/a)*numberMoment 4 σ+(c*(1-κ)/a)*crossEntropy d q (F.map σ)+(β/a)*energy σ+C) + (hmin : ∀ σ, FiniteMoment 4 σ → + c*entropy (mixture (1-κ) ⟨sub_nonneg.mpr hκ.2, sub_le_self _ hκ.1⟩ (F.map ρ) τ)- + a*entropy ρ+β*energy ρ+ζ*numberMoment 4 ρ ≤ + c*entropy (mixture (1-κ) ⟨sub_nonneg.mpr hκ.2, sub_le_self _ hκ.1⟩ (F.map σ) τ)- + a*entropy σ+β*energy σ+ζ*numberMoment 4 σ) + (Z : Matrix K K ℂ) : + (1-κ)^2*BKM.variance b p (F.dual (FiniteBlock.block d Z)) ≤ + (a/c)*BKM.variance d q (FiniteBlock.block d Z) := by + apply complex_component_hessian F c a κ b p hp hs.summable d q hq ht.summable + intro T hT + rw [BKM.variance, BKM.normSq_mean_selfAdjoint b p _ + (F.dual_selfAdjoint (ContinuousLinearMap.isSelfAdjoint_iff_isSymmetric.mpr + (FiniteBlock.block_symmetric d T hT))), mean_expectation ρ b p he] + exact flow_full_hessian F τ κ hκ c a β ζ C hc ha ρ hmρ b p hp hs d q hq ht + he he0 hτ hcross hcτ hlog hmin T hT +end EntropyPhotonNumber + +namespace BKM +open scoped BigOperators +open DiagonalForms.System +variable {I J E : Type*} [NormedAddCommGroup E] [InnerProductSpace ℂ E] [CompleteSpace E] + +theorem mean_reindex (b : HilbertBasis J ℂ E) (p : J → ℝ) (e : I ≃ J) (Z : E →L[ℂ] E) : + mean (reindexBasis b e) (p ∘ e) Z=mean b p Z := by + simp only [mean, entry, reindexBasis_apply, Function.comp_def] + exact e.tsum_eq (fun j : J => (p j : ℂ)*inner ℂ (b j) (Z (b j))) + +theorem quadratic_reindex (b : HilbertBasis J ℂ E) (p : J → ℝ) (e : I ≃ J) (Z : E →L[ℂ] E) : + quadratic (reindexBasis b e) (p ∘ e) Z=quadratic b p Z := by + simp only [quadratic, entry, reindexBasis_apply, Function.comp_def] + exact (Equiv.prodCongr e e).tsum_eq (fun ij : J × J => logMean (p ij.1) (p ij.2)*Complex.normSq (inner ℂ (b ij.1) (Z (b ij.2)))) + +theorem variance_reindex (b : HilbertBasis J ℂ E) (p : J → ℝ) (e : I ≃ J) (Z : E →L[ℂ] E) : + variance (reindexBasis b e) (p ∘ e) Z=variance b p Z := by + rw [variance, quadratic_reindex, mean_reindex, variance] +end BKM + +namespace EntropyPhotonNumber +open QuantumTrace DiagonalForms.System +variable {n : ℕ} {J : Type*} [DecidableEq J] + +theorem minimum_all_blocks_hessian + (F : KrausFlow n) (τ : State n) {r : ℝ} (hr : 0 < r) (hτ : τ = thermalState n r hr) + (κ : ℝ) (hκ : κ ∈ Set.Icc 0 1) (hκ0 : 0 < κ) + (c a β ζ : ℝ) (hc : 0 < c) (ha : 0 < a) (hβ : 0 ≤ β) (hζ : 0 < ζ) + (ρ : State n) (hmρ : FiniteMoment 4 ρ) + (d : HilbertBasis J ℂ (Fock n)) (q : J → ℝ) + (hq : ∀ j, 0 < q j) (ht : HasSum q 1) + (he0 : ∀ j, (mixture (1-κ) ⟨sub_nonneg.mpr hκ.2, sub_le_self _ hκ.1⟩ (F.map ρ) τ).op (d j) = + (q j : ℂ) • d j) + (hmin : ∀ σ, FiniteMoment 4 σ → + c*entropy (mixture (1-κ) ⟨sub_nonneg.mpr hκ.2, sub_le_self _ hκ.1⟩ (F.map ρ) τ)-a*entropy ρ+ + β*energy ρ+ζ*numberMoment 4 ρ ≤ + c*entropy (mixture (1-κ) ⟨sub_nonneg.mpr hκ.2, sub_le_self _ hκ.1⟩ (F.map σ) τ)-a*entropy σ+ + β*energy σ+ζ*numberMoment 4 σ) : + ∃ G : GibbsData n (ζ/a) ρ, ∀ (s : Finset J) (Z : Matrix s s ℂ), + (1-κ)^2*BKM.variance G.basis (gibbsWeight G.eigenval) + (F.dual (FiniteBlock.block (BKM.reindexBasis d (Equiv.sumCompl (· ∈ s))) Z)) ≤ + (a/c)*BKM.variance d q (FiniteBlock.block (BKM.reindexBasis d (Equiv.sumCompl (· ∈ s))) Z) := by + classical + obtain ⟨G,hG⟩ := flow_minimum_gibbs F τ hr hτ κ hκ hκ0 c a β ζ hc ha hβ hζ ρ hmρ + d q hq ht he0 hmin + let _ := G.nonempty + let htκ : 1-κ ∈ Set.Icc 0 1 := ⟨sub_nonneg.mpr hκ.2, sub_le_self _ hκ.1⟩ + let ρ0 := mixture (1-κ) htκ (F.map ρ) τ + have hle : (κ : ℂ) • (thermalState n r hr).op ≤ ρ0.op := by + rw [← hτ] + exact mixture_replacement_le κ hκ (F.map ρ) τ + have hfτ : FiniteEnergy τ := by simpa only [hτ] using thermalState_finiteEnergy n r hr + have hcross (σ : State n) (hm : FiniteMoment 4 σ) : + Summable (fun j => (-Real.log (q j))*(inner ℂ (d j) ((F.map σ).op (d j))).re) := + crossEntropy_finite ρ0 (F.map σ) (F.finiteEnergy _ (finiteMoment_finiteEnergy (by norm_num) hm)) + hr hκ0 hκ.2 hle d q hq ht he0 + have hcτ := crossEntropy_finite ρ0 τ hfτ hr hκ0 hκ.2 hle d q hq ht he0 + have hα : 0 ≤ c*(1-κ)/a := div_nonneg (mul_nonneg hc.le (sub_nonneg.mpr hκ.2)) ha.le + have hlog (σ : State n) (hm : FiniteMoment 4 σ) : + crossEntropy G.basis (gibbsWeight G.eigenval) σ = + (ζ/a)*numberMoment 4 σ+(c*(1-κ)/a)*crossEntropy d q (F.map σ)+(β/a)*energy σ+ + Real.log (heatPartition G.eigenval) := + (G.crossEntropy_hamiltonian d q hq ht F hα (div_nonneg hβ ha.le) (div_pos hζ ha) + hG σ hm (hcross σ hm)).tsum_eq + refine ⟨G, fun s Z => ?_⟩ + let e := Equiv.sumCompl (fun j => j ∈ s) + let d' := BKM.reindexBasis d e + have hq' : ∀ j, 0 < (q ∘ e) j := fun j => hq (e j) + have ht' : HasSum (q ∘ e) 1 := e.hasSum_iff.mpr ht + have he0' : ∀ j, (mixture (1-κ) htκ (F.map ρ) τ).op (d' j)=((q ∘ e) j:ℂ) • d' j := by + intro j + simpa only [d', BKM.reindexBasis_apply, Function.comp_def] using he0 (e j) + have hcross' (σ : State n) (hm : FiniteMoment 4 σ) : + Summable (fun j => (-Real.log ((q ∘ e) j))*(inner ℂ (d' j) ((F.map σ).op (d' j))).re) := by + simpa only [d', BKM.reindexBasis_apply, Function.comp_def] using + (hcross σ hm).comp_injective e.injective + have hcτ' : Summable (fun j => (-Real.log ((q ∘ e) j))*(inner ℂ (d' j) (τ.op (d' j))).re) := by + simpa only [d', BKM.reindexBasis_apply, Function.comp_def] using hcτ.comp_injective e.injective + have hlog' (σ : State n) (hm : FiniteMoment 4 σ) : + crossEntropy G.basis (gibbsWeight G.eigenval) σ = + (ζ/a)*numberMoment 4 σ+(c*(1-κ)/a)*crossEntropy d' (q ∘ e) (F.map σ)+(β/a)*energy σ+ + Real.log (heatPartition G.eigenval) := by + simpa only [d', crossEntropy_reindex] using hlog σ hm + have hh := flow_complex_hessian F τ κ hκ c a β ζ (Real.log (heatPartition G.eigenval)) hc ha + ρ hmρ G.basis (gibbsWeight G.eigenval) (gibbsWeight_pos G.eigenval G.heat) + (gibbsWeight_hasSum G.eigenval G.heat) d' (q ∘ e) hq' ht' G.eigen he0' hfτ hcross' hcτ' hlog' hmin Z + simpa only [d', BKM.variance_reindex] using hh +end EntropyPhotonNumber + +namespace BKM + +section +open scoped BigOperators ComplexConjugate +open DiagonalForms.System +variable {J E : Type*} [NormedAddCommGroup E] [InnerProductSpace ℂ E] [CompleteSpace E] + +def vector (b : HilbertBasis J ℂ E) (p : J → ℝ) (hp : ∀j,0 < p j) (hs : Summable p) + (Z : E →L[ℂ] E) : lp (fun _ : J × J => ℂ) 2 := + EnsembleL2.vector (fun ij => (Real.sqrt (logMean (p ij.1) (p ij.2)):ℂ)*entry b Z ij.1 ij.2) (by + convert! logMean_summable b p hp hs Z using 1 + ext ij + rw [← Complex.normSq_eq_norm_sq, Complex.normSq_mul, Complex.normSq_ofReal, + Real.mul_self_sqrt (logMean_pos (hp _) (hp _)).le]) + +@[simp] theorem vector_apply (b : HilbertBasis J ℂ E) (p : J → ℝ) (hp : ∀j,0 < p j) (hs : Summable p) + (Z : E →L[ℂ] E) (ij : J × J) : + vector b p hp hs Z ij=(Real.sqrt (logMean (p ij.1) (p ij.2)):ℂ)*entry b Z ij.1 ij.2 := rfl + +theorem vector_add (b : HilbertBasis J ℂ E) (p : J → ℝ) (hp : ∀j,0 < p j) (hs : Summable p) + (Z T : E →L[ℂ] E) : vector b p hp hs (Z+T)=vector b p hp hs Z+vector b p hp hs T := by + apply lp.ext + ext ij + simp [entry_add, mul_add] + +theorem vector_sub (b : HilbertBasis J ℂ E) (p : J → ℝ) (hp : ∀j,0 < p j) (hs : Summable p) + (Z T : E →L[ℂ] E) : vector b p hp hs (Z-T)=vector b p hp hs Z-vector b p hp hs T := by + apply lp.ext + ext ij + simp [entry_sub, mul_sub] + +theorem vector_smul (b : HilbertBasis J ℂ E) (p : J → ℝ) (hp : ∀j,0 < p j) (hs : Summable p) + (c : ℂ) (Z : E →L[ℂ] E) : vector b p hp hs (c • Z)=c • vector b p hp hs Z := by + apply lp.ext + ext ij + simp [entry_smul, mul_left_comm] + +theorem vector_norm (b : HilbertBasis J ℂ E) (p : J → ℝ) (hp : ∀j,0 < p j) (hs : Summable p) + (Z : E →L[ℂ] E) : ‖vector b p hp hs Z‖^2=quadratic b p Z := by + have hh := lp.hasSum_norm (p := (2:ENNReal)) (by norm_num) (vector b p hp hs Z) + simp only [ENNReal.toReal_ofNat, Real.rpow_two, vector_apply, ← Complex.normSq_eq_norm_sq, + Complex.normSq_mul, Complex.normSq_ofReal, + Real.mul_self_sqrt (logMean_pos (hp _) (hp _)).le] at hh + exact hh.tsum_eq.symm +theorem vector_id_inner (b : HilbertBasis J ℂ E) (p : J → ℝ) (hp : ∀j,0 < p j) (hs : Summable p) + (Z : E →L[ℂ] E) : + inner ℂ (vector b p hp hs (ContinuousLinearMap.id ℂ E)) (vector b p hp hs Z)=mean b p Z := by + classical + have hh := lp.hasSum_inner (𝕜 := ℂ) (vector b p hp hs (ContinuousLinearMap.id ℂ E)) (vector b p hp hs Z) + rw [← hh.tsum_eq, hh.summable.tsum_prod] + unfold mean + congr 1 + ext i + calc + _ = (p i:ℂ)*entry b Z i i := by + rw [tsum_eq_single i] + · simp only [vector_apply, entry_id, ite_true, mul_one, logMean_self, + RCLike.inner_apply, Complex.conj_ofReal] + rw [show (Real.sqrt (p i):ℂ)*entry b Z i i*(Real.sqrt (p i):ℂ)= + ((Real.sqrt (p i)*Real.sqrt (p i):ℝ):ℂ)*entry b Z i i by push_cast; ring] + rw [Real.mul_self_sqrt (hp i).le] + · intro j hj + simp [Ne.symm hj, entry_id] +theorem vector_id_norm (b : HilbertBasis J ℂ E) (p : J → ℝ) (hp : ∀j,0 < p j) (hs : HasSum p 1) : + ‖vector b p hp hs.summable (ContinuousLinearMap.id ℂ E)‖^2=1 := by + have hh := vector_id_inner b p hp hs.summable (ContinuousLinearMap.id ℂ E) + rw [mean_id b p hs, inner_self_eq_norm_sq_to_K] at hh + have hh' := congrArg Complex.re hh + change ((‖vector b p hp hs.summable (ContinuousLinearMap.id ℂ E)‖ : ℂ)^2).re=1 at hh' + rw [← Complex.ofReal_pow, Complex.ofReal_re] at hh' + exact hh' +theorem quadratic_center (b : HilbertBasis J ℂ E) (p : J → ℝ) (hp : ∀j,0 < p j) (hs : HasSum p 1) + (Z : E →L[ℂ] E) : quadratic b p (center b p Z)=variance b p Z := by + rw [← vector_norm b p hp hs.summable, center, vector_sub, vector_smul, norm_sub_sq (𝕜 := ℂ)] + have hi : inner ℂ (vector b p hp hs.summable Z) (vector b p hp hs.summable (ContinuousLinearMap.id ℂ E))= + conj (mean b p Z) := by + rw [← inner_conj_symm, vector_id_inner] + rw [vector_norm, inner_smul_right, hi, norm_smul, mul_pow, vector_id_norm b p hp hs, mul_one] + simp only [← Complex.normSq_eq_norm_sq, Complex.mul_conj] + change quadratic b p Z-2*Complex.normSq (mean b p Z)+Complex.normSq (mean b p Z)=variance b p Z + unfold variance + ring + +end + +open scoped BigOperators ComplexConjugate +variable {J E : Type*} [NormedAddCommGroup E] [InnerProductSpace ℂ E] +theorem center_id (b : HilbertBasis J ℂ E) (p : J → ℝ) (hs : HasSum p 1) : + center b p (ContinuousLinearMap.id ℂ E)=0 := by simp [center, mean_id b p hs] + +theorem center_center (b : HilbertBasis J ℂ E) (p : J → ℝ) (hp : ∀j,0 ≤ p j) (hs : HasSum p 1) + (Z : E →L[ℂ] E) : center b p (center b p Z)=center b p Z := by + simp only [center, mean_sub b p hp hs.summable, mean_smul, mean_id b p hs, mul_one, + sub_self, zero_smul, sub_zero] + +theorem center_sub_scalar (b : HilbertBasis J ℂ E) (p : J → ℝ) (hp : ∀j,0 ≤ p j) (hs : HasSum p 1) + (Z : E →L[ℂ] E) (c : ℂ) : + center b p (Z-c • ContinuousLinearMap.id ℂ E)=center b p Z := by + change centerLM b p hp hs.summable (Z-c • ContinuousLinearMap.id ℂ E)=_ + simp only [map_sub, map_smul, centerLM_apply, center_id b p hs, smul_zero, sub_zero] + +variable [CompleteSpace E] + +theorem variance_sub_scalar (b : HilbertBasis J ℂ E) (p : J → ℝ) (hp : ∀j,0 < p j) (hs : HasSum p 1) + (Z : E →L[ℂ] E) (c : ℂ) : + variance b p (Z-c • ContinuousLinearMap.id ℂ E)=variance b p Z := by + rw [← quadratic_center b p hp hs, center_sub_scalar b p (fun j => (hp j).le) hs, + quadratic_center b p hp hs] +end BKM + +namespace CenteredTests +open scoped BigOperators +variable {J E : Type*} [NormedAddCommGroup E] [InnerProductSpace ℂ E] [CompleteSpace E] +theorem exists_block [DecidableEq J] (b : HilbertBasis J ℂ E) (p : J → ℝ) (hp : ∀j,0 ≤ p j) (hs : Summable p) + {Z : E →L[ℂ] E} (hZ : Z ∈ operatorSpace b p) : + ∃ (s : Finset J) (M : Matrix s s ℂ), + Z=BKM.center b p (FiniteBlock.block (BKM.reindexBasis b (Equiv.sumCompl (· ∈ s))) M) := by + classical + obtain ⟨c,rfl⟩ := Finsupp.mem_span_range_iff_exists_finsupp.mp hZ + let s := c.support.biUnion (fun ij => {ij.1,ij.2}) + have hsub : c.support ⊆ s ×ˢ s := by + intro ij hij + simp only [Finset.mem_product] + constructor + · exact Finset.mem_biUnion.mpr ⟨ij,hij,by simp⟩ + · exact Finset.mem_biUnion.mpr ⟨ij,hij,by simp⟩ + refine ⟨s, (fun i j => c (i.val,j.val)), ?_⟩ + have hc : (c.sum fun ij a => a • generator b p ij)= + BKM.centerLM b p hp hs (c.sum fun ij a => a • InnerProductSpace.rankOne ℂ (b ij.1) (b ij.2)) := by + simp only [Finsupp.sum, map_sum, map_smul, BKM.centerLM_apply, ← generator_eq_center] + rw [hc, BKM.centerLM_apply] + congr 1 + rw [c.sum_of_support_subset hsub _ (by intro ij; simp)] + simp only [FiniteBlock.block, BKM.reindexBasis_apply, Equiv.sumCompl_apply_inl] + rw [Finset.sum_product] + simp only [← Finset.sum_coe_sort s] +end CenteredTests + +namespace EntropyPhotonNumber + +section +open QuantumTrace DiagonalForms.System +variable {n : ℕ} {I J : Type*} [DecidableEq J] + +theorem KrausFlow.dual_id (F : KrausFlow n) : + F.dual (ContinuousLinearMap.id ℂ (Fock n))=ContinuousLinearMap.id ℂ (Fock n) := + KrausBounded.dual_id F.V F.norm + +theorem blocks_to_centered_hessian + (F : KrausFlow n) (b : HilbertBasis I ℂ (Fock n)) (p : I → ℝ) + (hp : ∀ i, 0 < p i) (hs : HasSum p 1) + (d : HilbertBasis J ℂ (Fock n)) (q : J → ℝ) (hq : ∀ j, 0 < q j) (ht : HasSum q 1) + (a κ : ℝ) + (hh : ∀ (s : Finset J) (M : Matrix s s ℂ), + (1-κ)^2*BKM.variance b p (F.dual (FiniteBlock.block (BKM.reindexBasis d (Equiv.sumCompl (· ∈ s))) M)) ≤ + a*BKM.variance d q (FiniteBlock.block (BKM.reindexBasis d (Equiv.sumCompl (· ∈ s))) M)) + (Z : Fock n →L[ℂ] Fock n) (hZ : Z ∈ CenteredTests.operatorSpace d q) : + (1-κ)^2*BKM.quadratic b p (BKM.center b p (F.dual Z)) ≤ a*BKM.quadratic d q Z := by + rw [BKM.quadratic_center b p hp hs] + have hz : BKM.variance d q Z=BKM.quadratic d q Z := by + rw [BKM.variance, CenteredTests.mean_eq_zero d q (fun j => (hq j).le) ht hZ] + simp + rw [← hz] + obtain ⟨s,M,rfl⟩ := CenteredTests.exists_block d q (fun j => (hq j).le) ht.summable hZ + simp only [BKM.center, F.dual_sub, F.dual_smul, F.dual_id, + BKM.variance_sub_scalar b p hp hs, BKM.variance_sub_scalar d q hq ht] + exact hh s M +end + +open QuantumTrace DiagonalForms.System +variable {n : ℕ} {J : Type*} [DecidableEq J] +theorem minimum_centered_hessian + (F : KrausFlow n) (τ : State n) {r : ℝ} (hr : 0 < r) (hτ : τ = thermalState n r hr) + (κ : ℝ) (hκ : κ ∈ Set.Icc 0 1) (hκ0 : 0 < κ) + (c a β ζ : ℝ) (hc : 0 < c) (ha : 0 < a) (hβ : 0 ≤ β) (hζ : 0 < ζ) + (ρ : State n) (hmρ : FiniteMoment 4 ρ) + (d : HilbertBasis J ℂ (Fock n)) (q : J → ℝ) + (hq : ∀ j, 0 < q j) (ht : HasSum q 1) + (he0 : ∀ j, (mixture (1-κ) ⟨sub_nonneg.mpr hκ.2, sub_le_self _ hκ.1⟩ (F.map ρ) τ).op (d j) = + (q j : ℂ) • d j) + (hmin : ∀ σ, FiniteMoment 4 σ → + c*entropy (mixture (1-κ) ⟨sub_nonneg.mpr hκ.2, sub_le_self _ hκ.1⟩ (F.map ρ) τ)-a*entropy ρ+ + β*energy ρ+ζ*numberMoment 4 ρ ≤ + c*entropy (mixture (1-κ) ⟨sub_nonneg.mpr hκ.2, sub_le_self _ hκ.1⟩ (F.map σ) τ)-a*entropy σ+ + β*energy σ+ζ*numberMoment 4 σ) : + ∃ G : GibbsData n (ζ/a) ρ, ∀ (Z : Fock n →L[ℂ] Fock n), + Z ∈ CenteredTests.operatorSpace d q → + (1-κ)^2*BKM.quadratic G.basis (gibbsWeight G.eigenval) + (BKM.center G.basis (gibbsWeight G.eigenval) (F.dual Z)) ≤ + (a/c)*BKM.quadratic d q Z := by + obtain ⟨G,hG⟩ := minimum_all_blocks_hessian F τ hr hτ κ hκ hκ0 c a β ζ hc ha hβ hζ ρ hmρ + d q hq ht he0 hmin + let _ := G.nonempty + refine ⟨G, ?_⟩ + exact blocks_to_centered_hessian F G.basis (gibbsWeight G.eigenval) + (gibbsWeight_pos G.eigenval G.heat) (gibbsWeight_hasSum G.eigenval G.heat) d q hq ht (a/c) κ hG + +theorem minimum_all_blocks_hessian_data + (F : KrausFlow n) (τ : State n) {r : ℝ} (hr : 0 < r) (hτ : τ = thermalState n r hr) + (κ : ℝ) (hκ : κ ∈ Set.Icc 0 1) (hκ0 : 0 < κ) + (c a β ζ : ℝ) (hc : 0 < c) (ha : 0 < a) (hβ : 0 ≤ β) (hζ : 0 < ζ) + (ρ : State n) (hmρ : FiniteMoment 4 ρ) + (d : HilbertBasis J ℂ (Fock n)) (q : J → ℝ) + (hq : ∀ j, 0 < q j) (ht : HasSum q 1) + (he0 : ∀ j, (mixture (1-κ) ⟨sub_nonneg.mpr hκ.2, sub_le_self _ hκ.1⟩ (F.map ρ) τ).op (d j) = + (q j : ℂ) • d j) + (hmin : ∀ σ, FiniteMoment 4 σ → + c*entropy (mixture (1-κ) ⟨sub_nonneg.mpr hκ.2, sub_le_self _ hκ.1⟩ (F.map ρ) τ)-a*entropy ρ+ + β*energy ρ+ζ*numberMoment 4 ρ ≤ + c*entropy (mixture (1-κ) ⟨sub_nonneg.mpr hκ.2, sub_le_self _ hκ.1⟩ (F.map σ) τ)-a*entropy σ+ + β*energy σ+ζ*numberMoment 4 σ) : + ∃ G : GibbsData n (ζ/a) ρ, + (∀ x, ENNReal.ofReal (inner ℂ x (G.B x)).re = + ENNReal.ofReal (c*(1-κ)/a)* + sliceMoment d (fun j => ENNReal.ofReal (-Real.log (q j))) F.V (energyInverse n x)+ + ENNReal.ofReal (β/a)*numberVectorMoment (energyInverse n x)) ∧ + ∀ (s : Finset J) (Z : Matrix s s ℂ), + (1-κ)^2*BKM.variance G.basis (gibbsWeight G.eigenval) + (F.dual (FiniteBlock.block (BKM.reindexBasis d (Equiv.sumCompl (· ∈ s))) Z)) ≤ + (a/c)*BKM.variance d q (FiniteBlock.block (BKM.reindexBasis d (Equiv.sumCompl (· ∈ s))) Z) := by + classical + obtain ⟨G,hG⟩ := flow_minimum_gibbs F τ hr hτ κ hκ hκ0 c a β ζ hc ha hβ hζ ρ hmρ + d q hq ht he0 hmin + let _ := G.nonempty + let htκ : 1-κ ∈ Set.Icc 0 1 := ⟨sub_nonneg.mpr hκ.2, sub_le_self _ hκ.1⟩ + let ρ0 := mixture (1-κ) htκ (F.map ρ) τ + have hle : (κ : ℂ) • (thermalState n r hr).op ≤ ρ0.op := by + rw [← hτ] + exact mixture_replacement_le κ hκ (F.map ρ) τ + have hfτ : FiniteEnergy τ := by simpa only [hτ] using thermalState_finiteEnergy n r hr + have hcross (σ : State n) (hm : FiniteMoment 4 σ) : + Summable (fun j => (-Real.log (q j))*(inner ℂ (d j) ((F.map σ).op (d j))).re) := + crossEntropy_finite ρ0 (F.map σ) (F.finiteEnergy _ (finiteMoment_finiteEnergy (by norm_num) hm)) + hr hκ0 hκ.2 hle d q hq ht he0 + have hcτ := crossEntropy_finite ρ0 τ hfτ hr hκ0 hκ.2 hle d q hq ht he0 + have hα : 0 ≤ c*(1-κ)/a := div_nonneg (mul_nonneg hc.le (sub_nonneg.mpr hκ.2)) ha.le + have hlog (σ : State n) (hm : FiniteMoment 4 σ) : + crossEntropy G.basis (gibbsWeight G.eigenval) σ = + (ζ/a)*numberMoment 4 σ+(c*(1-κ)/a)*crossEntropy d q (F.map σ)+(β/a)*energy σ+ + Real.log (heatPartition G.eigenval) := + (G.crossEntropy_hamiltonian d q hq ht F hα (div_nonneg hβ ha.le) (div_pos hζ ha) + hG σ hm (hcross σ hm)).tsum_eq + refine ⟨G, hG, fun s Z => ?_⟩ + let e := Equiv.sumCompl (fun j => j ∈ s) + let d' := BKM.reindexBasis d e + have hq' : ∀ j, 0 < (q ∘ e) j := fun j => hq (e j) + have ht' : HasSum (q ∘ e) 1 := e.hasSum_iff.mpr ht + have he0' : ∀ j, (mixture (1-κ) htκ (F.map ρ) τ).op (d' j)=((q ∘ e) j:ℂ) • d' j := by + intro j + simpa only [d', BKM.reindexBasis_apply, Function.comp_def] using he0 (e j) + have hcross' (σ : State n) (hm : FiniteMoment 4 σ) : + Summable (fun j => (-Real.log ((q ∘ e) j))*(inner ℂ (d' j) ((F.map σ).op (d' j))).re) := by + simpa only [d', BKM.reindexBasis_apply, Function.comp_def] using + (hcross σ hm).comp_injective e.injective + have hcτ' : Summable (fun j => (-Real.log ((q ∘ e) j))*(inner ℂ (d' j) (τ.op (d' j))).re) := by + simpa only [d', BKM.reindexBasis_apply, Function.comp_def] using hcτ.comp_injective e.injective + have hlog' (σ : State n) (hm : FiniteMoment 4 σ) : + crossEntropy G.basis (gibbsWeight G.eigenval) σ = + (ζ/a)*numberMoment 4 σ+(c*(1-κ)/a)*crossEntropy d' (q ∘ e) (F.map σ)+(β/a)*energy σ+ + Real.log (heatPartition G.eigenval) := by + simpa only [d', crossEntropy_reindex] using hlog σ hm + have hh := flow_complex_hessian F τ κ hκ c a β ζ (Real.log (heatPartition G.eigenval)) hc ha + ρ hmρ G.basis (gibbsWeight G.eigenval) (gibbsWeight_pos G.eigenval G.heat) + (gibbsWeight_hasSum G.eigenval G.heat) d' (q ∘ e) hq' ht' G.eigen he0' hfτ hcross' hcτ' hlog' hmin Z + simpa only [d', BKM.variance_reindex] using hh + +theorem minimum_centered_hessian_data + (F : KrausFlow n) (τ : State n) {r : ℝ} (hr : 0 < r) (hτ : τ = thermalState n r hr) + (κ : ℝ) (hκ : κ ∈ Set.Icc 0 1) (hκ0 : 0 < κ) + (c a β ζ : ℝ) (hc : 0 < c) (ha : 0 < a) (hβ : 0 ≤ β) (hζ : 0 < ζ) + (ρ : State n) (hmρ : FiniteMoment 4 ρ) + (d : HilbertBasis J ℂ (Fock n)) (q : J → ℝ) + (hq : ∀ j, 0 < q j) (ht : HasSum q 1) + (he0 : ∀ j, (mixture (1-κ) ⟨sub_nonneg.mpr hκ.2, sub_le_self _ hκ.1⟩ (F.map ρ) τ).op (d j) = + (q j : ℂ) • d j) + (hmin : ∀ σ, FiniteMoment 4 σ → + c*entropy (mixture (1-κ) ⟨sub_nonneg.mpr hκ.2, sub_le_self _ hκ.1⟩ (F.map ρ) τ)-a*entropy ρ+ + β*energy ρ+ζ*numberMoment 4 ρ ≤ + c*entropy (mixture (1-κ) ⟨sub_nonneg.mpr hκ.2, sub_le_self _ hκ.1⟩ (F.map σ) τ)-a*entropy σ+ + β*energy σ+ζ*numberMoment 4 σ) : + ∃ G : GibbsData n (ζ/a) ρ, + (∀ x, ENNReal.ofReal (inner ℂ x (G.B x)).re = + ENNReal.ofReal (c*(1-κ)/a)* + sliceMoment d (fun j => ENNReal.ofReal (-Real.log (q j))) F.V (energyInverse n x)+ + ENNReal.ofReal (β/a)*numberVectorMoment (energyInverse n x)) ∧ + ∀ (Z : Fock n →L[ℂ] Fock n), + Z ∈ CenteredTests.operatorSpace d q → + (1-κ)^2*BKM.quadratic G.basis (gibbsWeight G.eigenval) + (BKM.center G.basis (gibbsWeight G.eigenval) (F.dual Z)) ≤ + (a/c)*BKM.quadratic d q Z := by + obtain ⟨G,hform,hG⟩ := minimum_all_blocks_hessian_data F τ hr hτ κ hκ hκ0 c a β ζ hc ha hβ hζ ρ hmρ + d q hq ht he0 hmin + let _ := G.nonempty + refine ⟨G, hform, ?_⟩ + exact blocks_to_centered_hessian F G.basis (gibbsWeight G.eigenval) + (gibbsWeight_pos G.eigenval G.heat) (gibbsWeight_hasSum G.eigenval G.heat) d q hq ht (a/c) κ hG +end EntropyPhotonNumber + +namespace QuantumTrace +variable {E : Type*} [NormedAddCommGroup E] [InnerProductSpace ℂ E] + +theorem positive_eq_of_quadratic {A B : E →L[ℂ] E} (hA : A.IsPositive) (hB : B.IsPositive) + (h : ∀ x, (inner ℂ x (A x)).re=(inner ℂ x (B x)).re) : A=B := by + apply ContinuousLinearMap.coe_injective + apply (ext_inner_map A.toLinearMap B.toLinearMap).mp + intro x + have hAx := ((ContinuousLinearMap.isPositive_iff_complex A).mp hA x).1 + have hBx := ((ContinuousLinearMap.isPositive_iff_complex B).mp hB x).1 + change inner ℂ (A x) x=inner ℂ (B x) x + rw [← hAx, ← hBx] + congr 1 + change (inner ℂ (A x) x).re=(inner ℂ (B x) x).re + rw [← Complex.conj_re (inner ℂ (A x) x), inner_conj_symm, + ← Complex.conj_re (inner ℂ (B x) x), inner_conj_symm] + exact h x +end QuantumTrace + +namespace EntropyPhotonNumber +open QuantumTrace +namespace GibbsData +variable {n : ℕ} {k : ℝ} {ρ : State n} (G : GibbsData n k ρ) + +def quarticLogarithm : Fock n →L[ℂ] Fock n := + logarithmSandwich (gibbsFactor rootNumberWeight rootNumberWeight_one_le k G.B) + (inversePower rootNumberWeight rootNumberWeight_one_le 4) (Real.log (heatPartition G.eigenval)) + +theorem quarticLogarithm_parseval (hk : 0 -Real.log (gibbsWeight G.eigenval j)* + ‖inner ℂ (G.basis j) (inversePower rootNumberWeight rootNumberWeight_one_le 4 x)‖^2) + (inner ℂ x (G.quarticLogarithm x)).re := by + let _ := G.nonempty + exact gibbs_logarithmSandwich_parseval G.basis _ _ + (gibbsFactor_strictPositive rootNumberWeight rootNumberWeight_one_le hk G.positive) + (inversePower_positive rootNumberWeight rootNumberWeight_one_le 4).isSymmetric + (inversePower_injective rootNumberWeight rootNumberWeight_one_le 4) + G.eigenval G.positive_eigenval G.inverse_eigen G.heat x + +theorem exact_logarithmic_identity {J : Type*} + (F : KrausFlow n) (τ : State n) {r δ : ℝ} (hr : 0 ENNReal.ofReal (-Real.log (p j))) F.V (energyInverse n x)+ + ENNReal.ofReal β*numberVectorMoment (energyInverse n x)) : + ∃ C D : Fock n →L[ℂ] Fock n, C.IsPositive ∧ D.IsPositive ∧ + (∀ x, ENNReal.ofReal (inner ℂ x (C x)).re = + sliceMoment b (fun j => ENNReal.ofReal (-Real.log (p j))) F.V + (inversePower rootNumberWeight rootNumberWeight_one_le 4 x)) ∧ + (∀ x, ENNReal.ofReal (inner ℂ x (D x)).re = + numberVectorMoment (inversePower rootNumberWeight rootNumberWeight_one_le 4 x)) ∧ + G.quarticLogarithm = (k:ℂ) • (1 : Fock n →L[ℂ] Fock n)+(α:ℂ) • C+(β:ℂ) • D+ + (Real.log (heatPartition G.eigenval):ℂ) • + (inversePower rootNumberWeight rootNumberWeight_one_le 4 * + inversePower rootNumberWeight rootNumberWeight_one_le 4) := by + obtain ⟨C,hC,hCe⟩ := logarithmic_slice_representation τ hr hδ hδ1 hle b p hp hs he + F.V F.F F.nonneg F.norm F.energy + obtain ⟨D,hD,hDe⟩ := number_form_representation n + have hSum : ((α:ℂ) • C+(β:ℂ) • D).IsPositive := + (hC.smul_of_nonneg (by exact_mod_cast hα)).add (hD.smul_of_nonneg (by exact_mod_cast hβ)) + have hB : G.B=(α:ℂ) • C+(β:ℂ) • D := by + apply positive_eq_of_quadratic G.positive hSum + intro x + apply (ENNReal.ofReal_eq_ofReal_iff (G.positive.re_inner_nonneg_right x) (hSum.re_inner_nonneg_right x)).mp + change ENNReal.ofReal (inner ℂ x (G.B x)).re=ENNReal.ofReal (inner ℂ x (((α:ℂ) • C+(β:ℂ) • D) x)).re + rw [hform] + have hh : (inner ℂ x (((α:ℂ) • C+(β:ℂ) • D) x)).re = + α*(inner ℂ x (C x)).re+β*(inner ℂ x (D x)).re := by + simp only [add_apply,smul_apply,inner_add_right,inner_smul_right, + Complex.add_re,Complex.mul_re,Complex.ofReal_re,Complex.ofReal_im,zero_mul,sub_zero] + have hCn : 0≤(inner ℂ x (C x)).re := hC.re_inner_nonneg_right x + have hDn : 0≤(inner ℂ x (D x)).re := hD.re_inner_nonneg_right x + rw [hh,ENNReal.ofReal_add (mul_nonneg hα hCn) + (mul_nonneg hβ hDn),ENNReal.ofReal_mul hα, ENNReal.ofReal_mul hβ,hCe,hDe] + let R := inversePower (rootNumberWeight (n:=n)) rootNumberWeight_one_le 3 + have hRa : R.adjoint=R := inversePower_adjoint _ _ _ + have hCR : (R*C*R).IsPositive := by simpa only [hRa, ← ContinuousLinearMap.mul_def, mul_assoc] using hC.adjoint_conj R + have hDR : (R*D*R).IsPositive := by simpa only [hRa, ← ContinuousLinearMap.mul_def, mul_assoc] using hD.adjoint_conj R + have hquad (T : Fock n →L[ℂ] Fock n) (x : Fock n) : + inner ℂ x ((R*T*R) x)=inner ℂ (R x) (T (R x)) := by + change inner ℂ x (R (T (R x)))=_ + exact ((inversePower_positive rootNumberWeight rootNumberWeight_one_le 3).isSymmetric x (T (R x))).symm + refine ⟨R*C*R,R*D*R,hCR,hDR,?_,?_,?_⟩ + · intro x + rw [hquad,hCe,energyInverse_mul_three] + · intro x + rw [hquad,hDe,energyInverse_mul_three] + · simp only [quarticLogarithm, logarithmSandwich, gibbsFactor,hB] + apply ContinuousLinearMap.ext + intro x + simp only [add_apply,smul_apply,mul_apply_eq_comp,map_add,map_smul,one_apply_eq_self] + simp only [R, RCLike.real_smul_eq_coe_smul (K:=ℂ), add_assoc] + rfl +end GibbsData +end EntropyPhotonNumber + +end + +end OAI diff --git a/lean/OAI/InformationTheory/PhotonNumber/Functions.lean b/lean/OAI/InformationTheory/PhotonNumber/Functions.lean new file mode 100644 index 0000000000000000000000000000000000000000..8e08d7de8e88d7c2dd704fe8d693484ee1db3099 --- /dev/null +++ b/lean/OAI/InformationTheory/PhotonNumber/Functions.lean @@ -0,0 +1,1297 @@ +import Mathlib + +namespace OAI + +noncomputable section + +section +open scoped BigOperators ComplexConjugate ENNReal Topology +open MeasureTheory +open scoped ComplexConjugate +open scoped BigOperators ComplexConjugate + +namespace EntropyPhotonNumber + +open Set Filter Topology + +def f (x : ℝ) : ℝ := if x = 0 then 1 else x / Real.sinh x + +def b (x : ℝ) : ℝ := f x * Real.cosh x + +@[simp] theorem f_zero : f 0 = 1 := by simp [f] +@[simp] theorem b_zero : b 0 = 1 := by simp [b] + +theorem f_of_ne_zero {x : ℝ} (hx : x ≠ 0) : f x = x / Real.sinh x := by + simp [f, hx] + +@[simp] theorem f_neg (x : ℝ) : f (-x) = f x := by + by_cases hx : x = 0 + · simp [hx] + · simp [f, hx, Real.sinh_neg] + +@[simp] theorem b_neg (x : ℝ) : b (-x) = b x := by + simp [b, Real.cosh_neg] + +theorem f_pos (x : ℝ) : 0 < f x := by + rcases lt_trichotomy x 0 with hx | hx | hx + · rw [← f_neg, f_of_ne_zero (neg_ne_zero.mpr hx.ne)] + exact div_pos (neg_pos.mpr hx) (Real.sinh_pos_iff.mpr (neg_pos.mpr hx)) + · simp [hx] + · rw [f_of_ne_zero hx.ne'] + exact div_pos hx (Real.sinh_pos_iff.mpr hx) + +theorem b_pos (x : ℝ) : 0 < b x := mul_pos (f_pos x) (Real.cosh_pos x) + +theorem f_mul_sinh (x : ℝ) : f x * Real.sinh x = x := by + by_cases hx : x = 0 + · simp [hx] + · rw [f_of_ne_zero hx, div_mul_cancel₀ _ (Real.sinh_ne_zero.mpr hx)] + +theorem b_sq (x : ℝ) : b x ^ 2 = f x ^ 2 + x ^ 2 := by + have h := Real.cosh_sq_sub_sinh_sq x + have hx := f_mul_sinh x + dsimp [b] + nlinarith [sq_nonneg (f x), sq_nonneg (Real.sinh x), + congrArg (fun t : ℝ => t ^ 2) hx] + +theorem f_mul_exp (x : ℝ) : f x * Real.exp x = b x + x := by + have h : Real.exp x = Real.cosh x + Real.sinh x := by + rw [Real.cosh_eq, Real.sinh_eq] + ring + rw [h, mul_add, f_mul_sinh] + rfl + +theorem f_mul_exp_neg (x : ℝ) : f x * Real.exp (-x) = b x - x := by + simpa [sub_eq_add_neg] using f_mul_exp (-x) + +def fourWeightTarget (m x y : ℝ) : ℝ := m * f x * f y / f (x + y) + +theorem fourWeightTarget_pos {m : ℝ} (hm : 0 < m) (x y : ℝ) : + 0 < fourWeightTarget m x y := by + exact div_pos (mul_pos (mul_pos hm (f_pos x)) (f_pos y)) (f_pos (x + y)) + +end EntropyPhotonNumber + +end + +open scoped BigOperators ComplexConjugate ENNReal Topology +open MeasureTheory +open scoped ComplexConjugate +open scoped BigOperators ComplexConjugate +open scoped BigOperators +open MvPolynomial +open scoped BigOperators ComplexConjugate Classical +open Submodule +open ContinuousLinearMap +open scoped ENNReal +open Set Filter Topology Complex MeasureTheory +open Set Filter Topology Complex Metric + +namespace EntropyPhotonNumber + +open Set Filter Topology +theorem target_mul_add (x y : ℝ) : + (f x * f y / f (x + y)) * (x + y) = y * b x + x * b y := by + calc + (f x * f y / f (x + y)) * (x + y) = + (f x * f y / f (x + y)) * (f (x + y) * Real.sinh (x + y)) := by + congr 1 + exact (f_mul_sinh (x + y)).symm + _ = f x * f y * Real.sinh (x + y) := by + rw [← mul_assoc, div_mul_cancel₀ _ (ne_of_gt (f_pos (x + y)))] + _ = f x * f y * (Real.sinh x * Real.cosh y + Real.cosh x * Real.sinh y) := by + rw [Real.sinh_add] + _ = + f y * (f x * Real.sinh x) * Real.cosh y + + (f y * Real.sinh y) * (f x * Real.cosh x) := by ring + _ = y * b x + x * b y := by + rw [f_mul_sinh, f_mul_sinh] + dsimp [b] + ring + +theorem target_eq_of_add_ne_zero {x y : ℝ} (hxy : x + y ≠ 0) : + f x * f y / f (x + y) = (y * b x + x * b y) / (x + y) := by + exact (eq_div_iff hxy).mpr (target_mul_add x y) + +theorem target_opposite (x : ℝ) : f x * f (-x) / f (x + -x) = f x ^ 2 := by + simp [pow_two] + +theorem f_eq_inv_dslope (x : ℝ) : f x = (dslope Real.sinh 0 x)⁻¹ := by + by_cases hx : x = 0 + · simp [hx, dslope_same, Real.deriv_sinh] + · rw [f_of_ne_zero hx, dslope_of_ne _ hx] + simp [slope, div_eq_mul_inv, mul_comm] + +theorem continuous_f : Continuous f := by + apply continuous_iff_continuousAt.mpr + intro x + change ContinuousAt (fun u => f u) x + simp_rw [f_eq_inv_dslope] + apply ContinuousAt.inv₀ + · by_cases hx : x = 0 + · subst x + exact continuousAt_dslope_same.mpr Real.differentiableAt_sinh + · exact (continuousAt_dslope_of_ne hx).mpr Real.continuous_sinh.continuousAt + · by_cases hx : x = 0 + · simp [hx, dslope_same, Real.deriv_sinh] + · rw [dslope_of_ne _ hx] + simp [slope, hx, Real.sinh_ne_zero.mpr hx] + +theorem continuous_b : Continuous b := continuous_f.mul Real.continuous_cosh + +theorem f_le_one (x : ℝ) : f x ≤ 1 := by + have h (y : ℝ) (hy : 0 ≤ y) : f y ≤ 1 := by + rcases hy.eq_or_lt with hy | hy + · simp [← hy] + · rw [f_of_ne_zero hy.ne', div_le_one (Real.sinh_pos_iff.mpr hy)] + exact Real.self_le_sinh_iff.mpr hy.le + rcases le_total 0 x with hx | hx + · exact h x hx + · simpa using h (-x) (neg_nonneg.mpr hx) + +theorem f_lt_one {x : ℝ} (hx : x ≠ 0) : f x < 1 := by + have h (y : ℝ) (hy : 0 < y) : f y < 1 := by + rw [f_of_ne_zero hy.ne', div_lt_one (Real.sinh_pos_iff.mpr hy)] + exact Real.self_lt_sinh_iff.mpr hy + rcases lt_or_gt_of_ne hx with hneg | hpos + · simpa using h (-x) (neg_pos.mpr hneg) + · exact h x hpos + +theorem sinh_lt_mul_cosh {x : ℝ} (hx : 0 < x) : Real.sinh x < x * Real.cosh x := by + have hmono : StrictMonoOn (fun u : ℝ => u * Real.cosh u - Real.sinh u) (Ici 0) := by + apply strictMonoOn_of_deriv_pos (convex_Ici 0) + ((continuous_id.mul Real.continuous_cosh).sub Real.continuous_sinh).continuousOn + intro u hu + rw [interior_Ici, mem_Ioi] at hu + have hd := ((hasDerivAt_id u).mul (Real.hasDerivAt_cosh u)).sub + (Real.hasDerivAt_sinh u) + rw [hd.deriv] + simpa using mul_pos hu (Real.sinh_pos_iff.mpr hu) + have h := hmono (show (0 : ℝ) ∈ Ici 0 by simp) hx.le hx + simpa using h + +theorem one_lt_b {x : ℝ} (hx : x ≠ 0) : 1 < b x := by + have h (y : ℝ) (hy : 0 < y) : 1 < b y := by + rw [b, f_of_ne_zero hy.ne', div_mul_eq_mul_div, + lt_div_iff₀ (Real.sinh_pos_iff.mpr hy)] + simpa using sinh_lt_mul_cosh hy + rcases lt_or_gt_of_ne hx with hneg | hpos + · simpa using h (-x) (neg_pos.mpr hneg) + · exact h x hpos + +theorem hasDerivAt_f {x : ℝ} (hx : x ≠ 0) : + HasDerivAt f ((Real.sinh x - x * Real.cosh x) / Real.sinh x ^ 2) x := by + have hd := (hasDerivAt_id x).div (Real.hasDerivAt_sinh x) (Real.sinh_ne_zero.mpr hx) + simp only [one_mul, id_eq] at hd + apply hd.congr_of_eventuallyEq + filter_upwards [eventually_ne_nhds hx] with y hy + exact f_of_ne_zero hy + +theorem strictAntiOn_f : StrictAntiOn f (Ici 0) := by + apply strictAntiOn_of_deriv_neg (convex_Ici 0) continuous_f.continuousOn + intro x hx + rw [interior_Ici, mem_Ioi] at hx + rw [(hasDerivAt_f hx.ne').deriv] + exact div_neg_of_neg_of_pos (sub_neg.mpr (sinh_lt_mul_cosh hx)) + (sq_pos_of_pos (Real.sinh_pos_iff.mpr hx)) + +theorem f_injOn_nonneg : InjOn f (Ici 0) := strictAntiOn_f.injOn + +theorem hasDerivAt_b {x : ℝ} (hx : x ≠ 0) : + HasDerivAt b ((b x - f x ^ 2) / x) x := by + have hd := (hasDerivAt_f hx).mul (Real.hasDerivAt_cosh x) + change HasDerivAt b _ x at hd + convert! hd using 1 + dsimp [b] + rw [f_of_ne_zero hx] + have hs := Real.sinh_ne_zero.mpr hx + have hi := Real.cosh_sq_sub_sinh_sq x + field_simp + nlinarith [congrArg (fun z : ℝ => x * z) hi] + +theorem hasDerivAt_f_sq {x : ℝ} (hx : x ≠ 0) : + HasDerivAt (fun u => f u ^ 2) (2 * f x ^ 2 * (1 - b x) / x) x := by + convert! (hasDerivAt_f hx).pow 2 using 1 + dsimp [b] + rw [f_of_ne_zero hx] + have hs := Real.sinh_ne_zero.mpr hx + field_simp + +theorem strictAntiOn_f_sq : StrictAntiOn (fun u => f u ^ 2) (Ici 0) := by + intro x hx y hy hxy + exact sq_lt_sq₀ (f_pos y).le (f_pos x).le |>.mpr (strictAntiOn_f hx hy hxy) + +theorem f_eq_exp {x : ℝ} (hx : 0 < x) : + f x = (2 * (x * Real.exp (-x))) / (1 - Real.exp (-x) ^ 2) := by + have he : Real.exp (-x) < 1 := Real.exp_lt_one_iff.mpr (neg_neg_of_pos hx) + have hep : 0 < Real.exp (-x) := Real.exp_pos _ + have hden : 1 - Real.exp (-x) ^ 2 ≠ 0 := by nlinarith + rw [f_of_ne_zero hx.ne', Real.sinh_eq] + have hs : Real.exp x - Real.exp (-x) ≠ 0 := by + have : 0 < Real.sinh x := Real.sinh_pos_iff.mpr hx + rw [Real.sinh_eq] at this + linarith + have hm : Real.exp x * Real.exp (-x) = 1 := by rw [← Real.exp_add]; simp + field_simp + nlinarith [congrArg (fun t : ℝ => 2 * x * t) hm] + +theorem tendsto_f_atTop : Tendsto f atTop (𝓝 0) := by + have he : Tendsto (fun x : ℝ => Real.exp (-x)) atTop (𝓝 0) := + Real.tendsto_exp_atBot.comp tendsto_neg_atTop_atBot + have hxe : Tendsto (fun x : ℝ => x * Real.exp (-x)) atTop (𝓝 0) := by + simpa using Real.tendsto_pow_mul_exp_neg_atTop_nhds_zero 1 + have hfrac := (hxe.const_mul 2).div (tendsto_const_nhds.sub (he.pow 2)) + (show (1 : ℝ) - 0 ^ 2 ≠ 0 by norm_num) + have heq : f =ᶠ[atTop] (fun x : ℝ => (2 * (x * Real.exp (-x))) / (1 - Real.exp (-x) ^ 2)) := by + filter_upwards [eventually_gt_atTop (0 : ℝ)] with x hx + exact f_eq_exp hx + have ht : Tendsto (fun x : ℝ => (2 * (x * Real.exp (-x))) / + (1 - Real.exp (-x) ^ 2)) atTop (𝓝 0) := by + convert! hfrac using 1; norm_num + exact ht.congr' heq.symm + +theorem range_f_nonneg : f '' Ici 0 = Ioc 0 1 := by + apply Subset.antisymm + · rintro _ ⟨x, _, rfl⟩ + exact ⟨f_pos x, f_le_one x⟩ + · intro y hy + obtain ⟨x, hx, hxy⟩ : ∃ x : ℝ, 0 ≤ x ∧ f x < y := by + have h := (tendsto_order.mp tendsto_f_atTop).2 y hy.1 + obtain ⟨x, hx, hxy⟩ := (eventually_ge_atTop (0 : ℝ)).and h |>.exists + exact ⟨x, hx, hxy⟩ + have hsurj := continuous_f.continuousOn.surjOn_Icc + (s := Ici (0 : ℝ)) hx (show (0 : ℝ) ∈ Ici 0 by simp) + exact hsurj ⟨hxy.le, by simpa using hy.2⟩ + +theorem existsUnique_f_sq_parameter {s : ℝ} (hs : s ∈ Ioc 0 1) : + ∃! x : ℝ, 0 ≤ x ∧ f x ^ 2 = s := by + have hroot : Real.sqrt s ∈ f '' Ici 0 := by + rw [range_f_nonneg] + exact ⟨Real.sqrt_pos.2 hs.1, Real.sqrt_le_one.2 hs.2⟩ + obtain ⟨x, hx, hfx⟩ := hroot + refine ⟨x, ⟨hx, ?_⟩, ?_⟩ + · rw [hfx, Real.sq_sqrt hs.1.le] + · intro y hy + apply strictAntiOn_f_sq.injOn hy.1 hx + change f y ^ 2 = f x ^ 2 + rw [hy.2, hfx, Real.sq_sqrt hs.1.le] + +theorem mul_cos_lt_sin {x : ℝ} (hx : x ∈ Ioo 0 Real.pi) : + x * Real.cos x < Real.sin x := by + have hmono : StrictMonoOn (fun t : ℝ => Real.sin t - t * Real.cos t) (Icc 0 Real.pi) := by + apply strictMonoOn_of_deriv_pos (convex_Icc _ _) + (Real.continuous_sin.sub (continuous_id.mul Real.continuous_cos)).continuousOn + intro t ht + rw [interior_Icc, mem_Ioo] at ht + have hd := (Real.hasDerivAt_sin t).sub ((hasDerivAt_id t).mul (Real.hasDerivAt_cos t)) + rw [hd.deriv] + simp only [id_eq, one_mul] + have hs := Real.sin_pos_of_pos_of_lt_pi ht.1 ht.2 + nlinarith [mul_pos ht.1 hs] + have h := hmono (show (0 : ℝ) ∈ Icc 0 Real.pi by exact ⟨le_rfl, Real.pi_pos.le⟩) + ⟨hx.1.le, hx.2.le⟩ hx.1 + simpa using h + +def bParameter (s : ℝ) : ℝ := Function.invFunOn (fun x : ℝ => f x ^ 2) (Ici 0) s + +def B (s : ℝ) : ℝ := b (bParameter s) + +theorem bParameter_nonneg {s : ℝ} (hs : s ∈ Ioc 0 1) : 0 ≤ bParameter s := by + apply Function.invFunOn_mem + obtain ⟨x, hx, _⟩ := existsUnique_f_sq_parameter hs + exact ⟨x, hx⟩ + +theorem f_sq_bParameter {s : ℝ} (hs : s ∈ Ioc 0 1) : f (bParameter s) ^ 2 = s := by + change (fun x : ℝ => f x ^ 2) (Function.invFunOn (fun x : ℝ => f x ^ 2) (Ici 0) s) = s + apply Function.invFunOn_eq (f := fun x : ℝ => f x ^ 2) (s := Ici (0 : ℝ)) + obtain ⟨x, hx, _⟩ := existsUnique_f_sq_parameter hs + exact ⟨x, hx⟩ + +theorem f_sq_mem {x : ℝ} (_hx : 0 ≤ x) : f x ^ 2 ∈ Ioc (0 : ℝ) 1 := by + exact ⟨sq_pos_of_pos (f_pos x), by nlinarith [f_pos x, f_le_one x]⟩ + +theorem bParameter_f_sq {x : ℝ} (hx : 0 ≤ x) : bParameter (f x ^ 2) = x := by + apply strictAntiOn_f_sq.injOn (bParameter_nonneg (f_sq_mem hx)) hx + exact f_sq_bParameter (f_sq_mem hx) + +theorem B_f_sq {x : ℝ} (hx : 0 ≤ x) : B (f x ^ 2) = b x := by + rw [B, bParameter_f_sq hx] + +@[simp] theorem bParameter_one : bParameter 1 = 0 := by + simpa using bParameter_f_sq (x := 0) le_rfl + +@[simp] theorem B_one : B 1 = 1 := by simp [B] + +theorem bParameter_pos {s : ℝ} (hs : s ∈ Ioo 0 1) : 0 < bParameter s := by + have hn := bParameter_nonneg ⟨hs.1, hs.2.le⟩ + have he := f_sq_bParameter ⟨hs.1, hs.2.le⟩ + by_contra h + have : bParameter s = 0 := le_antisymm (not_lt.mp h) hn + simp [this] at he + linarith [hs.2] + +theorem strictAntiOn_bParameter : StrictAntiOn bParameter (Ioc 0 1) := by + intro s hs t ht hst + by_contra h + have hle := strictAntiOn_f_sq.antitoneOn (bParameter_nonneg hs) + (bParameter_nonneg ht) (not_lt.mp h) + rw [f_sq_bParameter hs, f_sq_bParameter ht] at hle + exact (not_le_of_gt hst) hle + +theorem range_bParameter : bParameter '' Ioo 0 1 = Ioi (0 : ℝ) := by + apply Subset.antisymm + · rintro _ ⟨s, hs, rfl⟩ + exact bParameter_pos hs + · intro x hx + refine ⟨f x ^ 2, ?_, bParameter_f_sq hx.le⟩ + refine ⟨sq_pos_of_pos (f_pos x), ?_⟩ + have hf := f_lt_one hx.ne' + nlinarith [f_pos x] + +theorem continuousAt_bParameter {s : ℝ} (hs : s ∈ Ioo 0 1) : + ContinuousAt bParameter s := by + have hm : StrictAntiOn bParameter (Ioo 0 1) := + strictAntiOn_bParameter.mono Ioo_subset_Ioc_self + apply hm.dual_right.continuousAt_of_image_mem_nhds (Ioo_mem_nhds hs.1 hs.2) + change bParameter '' Ioo 0 1 ∈ 𝓝 (bParameter s) + rw [range_bParameter] + exact Ioi_mem_nhds (bParameter_pos hs) + +theorem hasDerivAt_bParameter {s : ℝ} (hs : s ∈ Ioo 0 1) : + HasDerivAt bParameter + (2 * s * (1 - B s) / bParameter s)⁻¹ s := by + have hp := bParameter_pos hs + have hd := hasDerivAt_f_sq hp.ne' + rw [f_sq_bParameter ⟨hs.1, hs.2.le⟩] at hd + apply HasDerivAt.of_local_left_inverse (continuousAt_bParameter hs) hd + · exact div_ne_zero (mul_ne_zero (mul_ne_zero (by norm_num) hs.1.ne') + (sub_ne_zero.mpr (one_lt_b hp.ne').ne)) hp.ne' + · filter_upwards [Ioo_mem_nhds hs.1 hs.2] with t ht + exact f_sq_bParameter ⟨ht.1, ht.2.le⟩ + +theorem hasDerivAt_B {s : ℝ} (hs : s ∈ Ioo 0 1) : + HasDerivAt B ((B s - s) / (2 * s * (1 - B s))) s := by + have hp := bParameter_pos hs + have hd := (hasDerivAt_b hp.ne').comp s (hasDerivAt_bParameter hs) + rw [f_sq_bParameter ⟨hs.1, hs.2.le⟩] at hd + convert! hd using 1 + change (B s - s) / (2 * s * (1 - B s)) = + ((B s - s) / bParameter s) * (2 * s * (1 - B s) / bParameter s)⁻¹ + field_simp [hp.ne'] + +def sineParameter (z : ℂ) : ℂ := Complex.sin z / z + +def cotParameter (z : ℂ) : ℂ := z * Complex.cos z / Complex.sin z + +theorem normSq_sin (z : ℂ) : + Complex.normSq (Complex.sin z) = Real.sin z.re ^ 2 + Real.sinh z.im ^ 2 := by + rw [Complex.sin_eq] + simp only [Complex.normSq_apply, Complex.add_re, Complex.add_im, Complex.mul_re, + Complex.mul_im, Complex.I_re, Complex.I_im, Complex.sin_ofReal_re, + Complex.sin_ofReal_im, Complex.cos_ofReal_re, Complex.cos_ofReal_im, + Complex.sinh_ofReal_re, Complex.sinh_ofReal_im, Complex.cosh_ofReal_re, + Complex.cosh_ofReal_im, mul_zero, zero_mul, add_zero, zero_add, sub_zero, + mul_one] + have ht := Real.sin_sq_add_cos_sq z.re + have hh := Real.cosh_sq_sub_sinh_sq z.im + nlinarith [congrArg (fun t : ℝ => Real.sin z.re ^ 2 * t) hh, + congrArg (fun t : ℝ => Real.sinh z.im ^ 2 * t) ht] + +theorem sin_ne_zero_of_im_pos {z : ℂ} (hz : 0 < z.im) : Complex.sin z ≠ 0 := by + apply Complex.normSq_pos.mp + rw [normSq_sin] + exact add_pos_of_nonneg_of_pos (sq_nonneg _) (sq_pos_of_pos (Real.sinh_pos_iff.mpr hz)) + +theorem cotParameter_im (z : ℂ) : + (cotParameter z).im = + (z.im * Real.sin z.re * Real.cos z.re - z.re * Real.sinh z.im * Real.cosh z.im) / + (Real.sin z.re ^ 2 + Real.sinh z.im ^ 2) := by + dsimp [cotParameter] + rw [Complex.div_im, normSq_sin, Complex.sin_eq, Complex.cos_eq] + simp only [Complex.add_re, Complex.add_im, Complex.sub_re, Complex.sub_im, + Complex.mul_re, Complex.mul_im, Complex.I_re, Complex.I_im, + Complex.sin_ofReal_re, Complex.sin_ofReal_im, Complex.cos_ofReal_re, + Complex.cos_ofReal_im, Complex.sinh_ofReal_re, Complex.sinh_ofReal_im, + Complex.cosh_ofReal_re, Complex.cosh_ofReal_im, mul_zero, zero_mul, + add_zero, zero_add, sub_zero, mul_one, zero_sub] + rw [← sub_div] + congr 1 + have ht := Real.sin_sq_add_cos_sq z.re + have hh := Real.cosh_sq_sub_sinh_sq z.im + nlinarith [congrArg (fun t : ℝ => z.im * Real.sin z.re * Real.cos z.re * t) hh, + congrArg (fun t : ℝ => z.re * Real.sinh z.im * Real.cosh z.im * t) ht] + +theorem cotParameter_im_neg {z : ℂ} (hr : 0 < z.re) (hi : 0 < z.im) : + (cotParameter z).im < 0 := by + rw [cotParameter_im] + apply div_neg_of_neg_of_pos + · have ht := Real.sin_le (show 0 ≤ 2 * z.re by positivity) + have hh := Real.self_lt_sinh_iff.mpr (show 0 < 2 * z.im by positivity) + rw [Real.sin_two_mul] at ht + rw [Real.sinh_two_mul] at hh + nlinarith [mul_le_mul_of_nonneg_left ht hi.le, mul_lt_mul_of_pos_left hh hr] + · exact add_pos_of_nonneg_of_pos (sq_nonneg _) + (sq_pos_of_pos (Real.sinh_pos_iff.mpr hi)) + +theorem hasDerivAt_sineParameter {z : ℂ} (hz : z ≠ 0) : + HasDerivAt sineParameter ((z * Complex.cos z - Complex.sin z) / z ^ 2) z := by + convert! (Complex.hasDerivAt_sin z).div (hasDerivAt_id z) hz using 1 + simp [mul_comm] + +theorem deriv_sineParameter_ne_zero {z : ℂ} (hr : 0 < z.re) (hi : 0 < z.im) : + deriv sineParameter z ≠ 0 := by + have hz : z ≠ 0 := by intro h; simp [h] at hr + rw [(hasDerivAt_sineParameter hz).deriv] + apply div_ne_zero _ (pow_ne_zero _ hz) + intro h + have hc : cotParameter z = 1 := by + dsimp [cotParameter] + rw [sub_eq_zero.mp h, div_self (sin_ne_zero_of_im_pos hi)] + have hn := cotParameter_im_neg hr hi + simp [hc] at hn + +theorem covering_bijective_of_simplyConnected + {E X : Type*} [TopologicalSpace E] [TopologicalSpace X] + [PreconnectedSpace E] [Nonempty E] + [SimplyConnectedSpace X] [LocallyPathConnectedSpace X] + {p : E → X} (hp : IsCoveringMap p) : Function.Bijective p := by + classical + let e₀ : E := Classical.choice inferInstance + obtain ⟨F, ⟨hF₀, hF⟩, _⟩ := hp.existsUnique_continuousMap_lifts + (ContinuousMap.id X) (p e₀) e₀ rfl + have hright : p ∘ F = id := hF + have hleft : F ∘ p = id := by + apply hp.eq_of_comp_eq (F.continuous.comp hp.continuous) continuous_id _ e₀ hF₀ + ext e + exact congrFun hright (p e) + constructor + · intro e e' h + have he := congrFun hleft e + have he' := congrFun hleft e' + change F (p e) = e at he + change F (p e') = e' at he' + exact he.symm.trans ((congrArg F h).trans he') + · intro x + exact ⟨F x, congrFun hright x⟩ + +def csinc : ℂ → ℂ := dslope Complex.sin 0 + +theorem csinc_zero : csinc 0 = 1 := by + rw [csinc, dslope_same, (Complex.hasDerivAt_sin 0).deriv] + simp + +theorem csinc_of_ne {z : ℂ} (hz : z ≠ 0) : csinc z = sineParameter z := by + simp [csinc, dslope_of_ne _ hz, slope, sineParameter, div_eq_mul_inv, mul_comm] + +theorem analyticAt_csinc (z : ℂ) : AnalyticAt ℂ csinc z := by + rcases eq_or_ne z 0 with rfl | hz + · apply Complex.analyticAt_of_differentiable_on_punctured_nhds_of_continuousAt + · filter_upwards [self_mem_nhdsWithin] with z hz + exact (differentiableAt_dslope_of_ne hz).mpr (Complex.differentiableAt_sin) + · exact continuousAt_dslope_same.mpr (Complex.differentiableAt_sin) + · have he : csinc =ᶠ[𝓝 z] sineParameter := by + filter_upwards [eventually_ne_nhds hz] with w hw + exact csinc_of_ne hw + exact ((Complex.analyticAt_sin).div analyticAt_id hz).congr he.symm + +theorem continuous_csinc : Continuous csinc := continuous_iff_continuousAt.mpr + (fun z => (analyticAt_csinc z).continuousAt) + +theorem sin_sub_mul_cos_pos {p : ℝ} (hp : p ∈ Ioo 0 Real.pi) : + 0 < Real.sin p - p * Real.cos p := by + have hm : StrictMonoOn (fun u : ℝ => Real.sin u - u * Real.cos u) (Icc 0 Real.pi) := by + apply strictMonoOn_of_deriv_pos (convex_Icc 0 Real.pi) + (Real.continuous_sin.sub (continuous_id.mul Real.continuous_cos)).continuousOn + intro u hu + rw [interior_Icc, mem_Ioo] at hu + have hd := (Real.hasDerivAt_sin u).sub ((hasDerivAt_id u).mul (Real.hasDerivAt_cos u)) + rw [hd.deriv] + have hs := Real.sin_pos_of_pos_of_lt_pi hu.1 hu.2 + simp only [id_eq] at * + nlinarith [mul_pos hu.1 hs] + have he := hm (show (0 : ℝ) ∈ Icc 0 Real.pi from ⟨le_rfl, Real.pi_pos.le⟩) + ⟨hp.1.le, hp.2.le⟩ hp.1 + simpa using he + +theorem sineParameter_re (z : ℂ) : + (sineParameter z).re = + (z.re * Real.sin z.re * Real.cosh z.im + z.im * Real.cos z.re * Real.sinh z.im) / + (z.re ^ 2 + z.im ^ 2) := by + rw [sineParameter, Complex.div_re, Complex.sin_eq] + simp only [Complex.add_re, Complex.add_im, Complex.mul_re, Complex.mul_im, + Complex.I_re, Complex.I_im, Complex.sin_ofReal_re, Complex.sin_ofReal_im, + Complex.cos_ofReal_re, Complex.cos_ofReal_im, Complex.sinh_ofReal_re, + Complex.sinh_ofReal_im, Complex.cosh_ofReal_re, Complex.cosh_ofReal_im, + mul_zero, zero_mul, add_zero, zero_add, sub_zero, mul_one, Complex.normSq_apply] + ring + +theorem sineParameter_im (z : ℂ) : + (sineParameter z).im = + (z.re * Real.cos z.re * Real.sinh z.im - z.im * Real.sin z.re * Real.cosh z.im) / + (z.re ^ 2 + z.im ^ 2) := by + rw [sineParameter, Complex.div_im, Complex.sin_eq] + simp only [Complex.add_re, Complex.add_im, Complex.mul_re, Complex.mul_im, + Complex.I_re, Complex.I_im, Complex.sin_ofReal_re, Complex.sin_ofReal_im, + Complex.cos_ofReal_re, Complex.cos_ofReal_im, Complex.sinh_ofReal_re, + Complex.sinh_ofReal_im, Complex.cosh_ofReal_re, Complex.cosh_ofReal_im, + mul_zero, zero_mul, add_zero, zero_add, sub_zero, mul_one, Complex.normSq_apply] + ring + +theorem sineParameter_im_neg {z : ℂ} (hp : z.re ∈ Ioo 0 Real.pi) (hq : 0 < z.im) : + (sineParameter z).im < 0 := by + rw [sineParameter_im] + have hs := Real.sin_pos_of_pos_of_lt_pi hp.1 hp.2 + have hsh := Real.sinh_pos_iff.mpr hq + have hch := Real.cosh_pos z.im + apply div_neg_of_neg_of_pos _ (add_pos_of_pos_of_nonneg (sq_pos_of_pos hp.1) (sq_nonneg _)) + rcases le_or_gt (Real.cos z.re) 0 with hc | hc + · have h₁ := mul_nonpos_of_nonneg_of_nonpos hp.1.le hc + have h₂ := mul_nonpos_of_nonpos_of_nonneg h₁ hsh.le + have h₃ := mul_pos (mul_pos hq hs) hch + linarith + · have h₁ := sinh_lt_mul_cosh hq + have h₂ := sin_sub_mul_cos_pos hp + have h₃ := mul_lt_mul_of_pos_left h₁ (mul_pos hp.1 hc) + have h₄ := mul_lt_mul_of_pos_right (sub_pos.mp h₂) (mul_pos hq hch) + nlinarith + +theorem half_sq_le_sinh {x : ℝ} (hx : 0 ≤ x) : x ^ 2 / 2 ≤ Real.sinh x := by + have hm : MonotoneOn (fun u : ℝ => Real.sinh u - u ^ 2 / 2) (Ici 0) := by + apply monotoneOn_of_deriv_nonneg (convex_Ici 0) + (Real.continuous_sinh.sub ((continuous_id.pow 2).div_const 2)).continuousOn + · intro u hu + exact ((Real.differentiableAt_sinh).sub + ((differentiableAt_id.pow 2).div_const 2)).differentiableWithinAt + · intro u hu + rw [interior_Ici, mem_Ioi] at hu + rw [((Real.hasDerivAt_sinh u).sub + ((hasDerivAt_id u).pow 2 |>.div_const 2)).deriv] + have h₁ := Real.self_le_sinh_iff.mpr hu.le + have h₂ := Real.sinh_lt_cosh u + simp only [id_eq, mul_one] + linarith + have h := hm (show (0 : ℝ) ∈ Ici 0 by simp) hx hx + simpa using h + +def sineDomain : Set ℂ := {z | 0 < z.re ∧ z.re < Real.pi ∧ 0 < z.im ∧ 0 < (csinc z).re} +def sineQuadrant : Set ℂ := {z | 0 < z.re ∧ z.im < 0} +def sineStrip : Set ℂ := {z | 0 ≤ z.re ∧ z.re ≤ Real.pi ∧ 0 ≤ z.im} + +theorem isOpen_sineDomain : IsOpen sineDomain := + (isOpen_lt continuous_const Complex.continuous_re).inter + ((isOpen_lt Complex.continuous_re continuous_const).inter + ((isOpen_lt continuous_const Complex.continuous_im).inter + (isOpen_lt continuous_const (Complex.continuous_re.comp continuous_csinc)))) + +theorem isOpen_sineQuadrant : IsOpen sineQuadrant := + (isOpen_lt continuous_const Complex.continuous_re).inter + (isOpen_lt Complex.continuous_im continuous_const) + +theorem isClosed_sineStrip : IsClosed sineStrip := + (isClosed_le continuous_const Complex.continuous_re).inter + ((isClosed_le Complex.continuous_re continuous_const).inter + (isClosed_le continuous_const Complex.continuous_im)) + +theorem csinc_mapsTo : MapsTo csinc sineDomain sineQuadrant := by + intro z hz + refine ⟨hz.2.2.2, ?_⟩ + rw [csinc_of_ne (by intro he; have := hz.1; simp [he] at this)] + exact sineParameter_im_neg ⟨hz.1, hz.2.1⟩ hz.2.2.1 + +theorem csinc_strip_bound {z : ℂ} (hz : z ∈ sineStrip) {M : ℝ} (hM : ‖csinc z‖ ≤ M) : + z.im ≤ Real.pi + 4 * M := by + have hM0 : 0 ≤ M := (norm_nonneg _).trans hM + by_contra! hq + have hz0 : z ≠ 0 := by + intro he + simp only [he, Complex.zero_im] at hq + linarith [Real.pi_pos] + have hn : Real.sinh z.im ≤ ‖Complex.sin z‖ := by + have hnorm := Complex.normSq_eq_norm_sq (Complex.sin z) + rw [normSq_sin] at hnorm + nlinarith [norm_nonneg (Complex.sin z), Real.sinh_nonneg_iff.mpr hz.2.2, + sq_nonneg (Real.sin z.re)] + have hzbound : ‖z‖ ≤ Real.pi + z.im := by + have he := Complex.norm_le_abs_re_add_abs_im z + rw [abs_of_nonneg hz.1, abs_of_nonneg hz.2.2] at he + linarith [hz.2.1] + have he : ‖Complex.sin z‖ = ‖csinc z‖ * ‖z‖ := by + rw [csinc_of_ne hz0, sineParameter, norm_div, div_mul_cancel₀ _ (norm_ne_zero_iff.mpr hz0)] + have hsq := half_sq_le_sinh hz.2.2 + have hu : z.im ^ 2 / 2 ≤ M * (Real.pi + z.im) := + hsq.trans (hn.trans (he ▸ mul_le_mul hM hzbound (norm_nonneg _) hM0)) + have hqp : Real.pi < z.im := by linarith + have hqm : 4 * M < z.im := by linarith [Real.pi_pos] + have hpos : 0 < z.im := Real.pi_pos.trans hqp + nlinarith [mul_nonneg hM0 (sub_nonneg.mpr hqp.le), mul_pos hpos (sub_pos.mpr hqm)] + +theorem csinc_strip_quadrant {z : ℂ} (hz : z ∈ sineStrip) + (ha : csinc z ∈ sineQuadrant) : z ∈ sineDomain := by + have hz0 : z ≠ 0 := by intro he; simp [he, csinc_zero, sineQuadrant] at ha + have he := csinc_of_ne hz0 + have hi := ha.2 + have hr := ha.1 + rw [he, sineParameter_im] at hi + rw [he, sineParameter_re] at hr + refine ⟨?_, ?_, ?_, ha.1⟩ + · by_contra! h + have hp : z.re = 0 := le_antisymm h hz.1 + simp [hp] at hi + · by_contra! h + have hp : z.re = Real.pi := le_antisymm hz.2.1 h + simp [hp] at hr + have : -(z.im * Real.sinh z.im) / (Real.pi ^ 2 + z.im ^ 2) ≤ 0 := + div_nonpos_of_nonpos_of_nonneg (neg_nonpos.mpr + (mul_nonneg hz.2.2 (Real.sinh_nonneg_iff.mpr hz.2.2))) (by positivity) + linarith + · by_contra! h + have hq : z.im = 0 := le_antisymm h hz.2.2 + simp [hq] at hi + +theorem isCompact_strip_preimage {K : Set ℂ} (hK : IsCompact K) : + IsCompact (sineStrip ∩ csinc ⁻¹' K) := by + obtain ⟨M, hM⟩ := hK.isBounded.exists_norm_le + apply Metric.isCompact_of_isClosed_isBounded (isClosed_sineStrip.inter (hK.isClosed.preimage continuous_csinc)) + apply isBounded_iff_forall_norm_le.mpr + refine ⟨Real.pi + (Real.pi + 4 * M), ?_⟩ + intro z hz + have he := Complex.norm_le_abs_re_add_abs_im z + rw [abs_of_nonneg hz.1.1, abs_of_nonneg hz.1.2.2] at he + linarith [hz.1.2.1, csinc_strip_bound hz.1 (hM _ hz.2)] + +def sineMap : sineDomain → sineQuadrant := fun z => ⟨csinc z, csinc_mapsTo z.property⟩ + +theorem continuous_sineMap : Continuous sineMap := + (continuous_csinc.comp continuous_subtype_val).subtype_mk _ + +theorem proper_sineMap : IsProperMap sineMap := by + apply isProperMap_iff_isCompact_preimage.mpr + refine ⟨continuous_sineMap, ?_⟩ + intro K hK + have hc := isCompact_strip_preimage (hK.image continuous_subtype_val) + have he : Subtype.val '' (sineMap ⁻¹' K) = sineStrip ∩ csinc ⁻¹' (Subtype.val '' K) := by + ext z + constructor + · rintro ⟨u, hu, rfl⟩ + exact ⟨⟨u.property.1.le, u.property.2.1.le, u.property.2.2.1.le⟩, _, hu, rfl⟩ + · rintro ⟨hz, w, hw, he⟩ + have ha : csinc z ∈ sineQuadrant := he ▸ w.property + refine ⟨⟨z, csinc_strip_quadrant hz ha⟩, ?_, rfl⟩ + have hw' : sineMap ⟨z, csinc_strip_quadrant hz ha⟩ = w := Subtype.ext he.symm + simpa [hw'] using hw + exact (Topology.IsEmbedding.subtypeVal.isCompact_iff).mpr (he ▸ hc) + +theorem deriv_csinc_ne_zero {z : ℂ} (hz : z ∈ sineDomain) : deriv csinc z ≠ 0 := by + have hn : z ≠ 0 := by intro he; have := hz.1; simp [he] at this + have he : csinc =ᶠ[𝓝 z] sineParameter := by + filter_upwards [eventually_ne_nhds hn] with w hw + exact csinc_of_ne hw + rw [he.deriv_eq] + exact deriv_sineParameter_ne_zero hz.1 hz.2.2.1 + +theorem localHomeomorphOn_csinc : IsLocalHomeomorphOn csinc sineDomain := by + intro z hz + let hd := (analyticAt_csinc z).hasStrictDerivAt.hasStrictFDerivAt_equiv + (deriv_csinc_ne_zero hz) + exact ⟨hd.toOpenPartialHomeomorph csinc, hd.mem_toOpenPartialHomeomorph_source, + hd.toOpenPartialHomeomorph_coe.symm⟩ + +theorem localHomeomorph_sineMap : IsLocalHomeomorph sineMap := by + have hi := isOpen_sineDomain.isOpenEmbedding_subtypeVal.isLocalHomeomorph + have ho := isOpen_sineQuadrant.isOpenEmbedding_subtypeVal.isLocalHomeomorph + have hc : IsLocalHomeomorph (csinc ∘ (Subtype.val : sineDomain → ℂ)) := by + apply isLocalHomeomorph_iff_isLocalHomeomorphOn_univ.mpr + exact localHomeomorphOn_csinc.comp hi.isLocalHomeomorphOn (fun x _ => x.property) + change IsLocalHomeomorph ((Subtype.val : sineQuadrant → ℂ) ∘ sineMap) at hc + exact hc.of_comp ho continuous_sineMap + +theorem covering_sineMap : IsCoveringMap sineMap := by + apply isCoveringMap_iff_isCoveringMapOn_univ.mpr + apply proper_sineMap.isClosedMap.isCoveringMapOn_of_isLocalHomeomorphOn + · intro x _ + apply (proper_sineMap.isCompact_preimage isCompact_singleton).finite + apply (show IsLocalHomeomorphOn sineMap (sineMap ⁻¹' {x}) from + fun z _ => localHomeomorph_sineMap z).isDiscrete_of_image + exact ((Set.finite_singleton x).subset (Set.image_preimage_subset _ _)).isDiscrete + · exact localHomeomorph_sineMap.isLocalHomeomorphOn + +theorem strictAnti_boundaryRatio : + StrictAntiOn (fun p : ℝ => p * Real.sin p / (-Real.cos p)) + (Ioo (Real.pi / 2) Real.pi) := by + have hc : ∀ p ∈ Ioo (Real.pi / 2) Real.pi, Real.cos p < 0 := by + intro p hp + exact Real.cos_neg_of_pi_div_two_lt_of_lt hp.1 (by linarith [hp.2, Real.pi_pos]) + apply strictAntiOn_of_deriv_neg (convex_Ioo _ _) + · apply ContinuousOn.div + · exact (continuous_id.mul Real.continuous_sin).continuousOn + · exact Real.continuous_cos.neg.continuousOn + · intro p hp + exact neg_ne_zero.mpr (ne_of_lt (hc p hp)) + · intro p hp + rw [interior_Ioo] at hp + have hn : -Real.cos p ≠ 0 := neg_ne_zero.mpr (ne_of_lt (hc p hp)) + have hd := ((hasDerivAt_id p).mul (Real.hasDerivAt_sin p)).div + (Real.hasDerivAt_cos p).neg hn + simp only [Pi.mul_apply, Pi.neg_apply, id_eq] at hd + change deriv (id * Real.sin / -Real.cos) p < 0 + rw [hd.deriv] + apply div_neg_of_neg_of_pos _ (sq_pos_of_ne_zero hn) + simp only [one_mul, neg_neg] + have hs := Real.sin_sq_add_cos_sq p + have hq := sq_nonneg (Real.sin p + Real.cos p) + have hp1 : 1 < p := by linarith [hp.1, Real.pi_gt_three] + nlinarith + +theorem csinc_re_pos_of_small_re {z : ℂ} (hp : 0 < z.re) + (hp' : z.re ≤ Real.pi / 2) (hq : 0 < z.im) : 0 < (csinc z).re := by + rw [csinc_of_ne (by intro h; simp [h] at hp), sineParameter_re] + apply div_pos _ (add_pos_of_pos_of_nonneg (sq_pos_of_pos hp) (sq_nonneg _)) + have hsin := Real.sin_pos_of_pos_of_lt_pi hp (by linarith [Real.pi_pos]) + have hcos := Real.cos_nonneg_of_mem_Icc (show z.re ∈ Icc (-(Real.pi / 2)) (Real.pi / 2) + from ⟨by linarith [Real.pi_pos], hp'⟩) + exact add_pos_of_pos_of_nonneg (mul_pos (mul_pos hp hsin) (Real.cosh_pos _)) + (mul_nonneg (mul_nonneg hq.le hcos) (Real.sinh_nonneg_iff.mpr hq.le)) + +theorem csinc_re_pos_iff_of_large_re {z : ℂ} (hp : Real.pi / 2 < z.re) + (hp' : z.re < Real.pi) (_hq : 0 < z.im) : + 0 < (csinc z).re ↔ z.im * Real.sinh z.im / Real.cosh z.im < + z.re * Real.sin z.re / (-Real.cos z.re) := by + have hp0 : 0 < z.re := by linarith [Real.pi_pos] + have hcos := Real.cos_neg_of_pi_div_two_lt_of_lt hp (show z.re < Real.pi + Real.pi / 2 by + linarith [Real.pi_pos]) + rw [csinc_of_ne (by intro h; simp [h] at hp0), sineParameter_re, + div_pos_iff_of_pos_right (add_pos_of_pos_of_nonneg (sq_pos_of_pos hp0) (sq_nonneg _)), + div_lt_div_iff₀ (Real.cosh_pos _) (neg_pos.mpr hcos)] + constructor <;> intro h <;> nlinarith + +theorem sineDomain_horizontal {z w : ℂ} (hz : z ∈ sineDomain) + (hi : w.im = z.im) (hp : 0 < w.re) + (hl : w.re ≤ max (Real.pi / 2) z.re) : w ∈ sineDomain := by + have hpi : w.re < Real.pi := lt_of_le_of_lt hl + (max_lt (by linarith [Real.pi_pos]) hz.2.1) + refine ⟨hp, hpi, hi ▸ hz.2.2.1, ?_⟩ + by_cases hs : w.re ≤ Real.pi / 2 + · exact csinc_re_pos_of_small_re hp hs (hi ▸ hz.2.2.1) + · have hs' : Real.pi / 2 < w.re := lt_of_not_ge hs + have hz' : Real.pi / 2 < z.re := by + by_contra! hn + rw [max_eq_left hn] at hl + exact hs hl + rw [csinc_re_pos_iff_of_large_re hs' hpi (hi ▸ hz.2.2.1)] + have hzr := (csinc_re_pos_iff_of_large_re hz' hz.2.1 hz.2.2.1).mp hz.2.2.2 + rw [hi] + apply lt_of_lt_of_le hzr + apply strictAnti_boundaryRatio.antitoneOn ⟨hs', hpi⟩ ⟨hz', hz.2.1⟩ + simpa [max_eq_right hz'.le] using hl + +def sineMidPoint (q : ℝ) : ℂ := ⟨Real.pi / 2, q⟩ + +theorem sineMidPoint_mem {q : ℝ} (hq : 0 < q) : sineMidPoint q ∈ sineDomain := by + have hp : 0 < Real.pi / 2 := by positivity + refine ⟨hp, by dsimp [sineMidPoint]; linarith [Real.pi_pos], hq, ?_⟩ + exact csinc_re_pos_of_small_re hp le_rfl hq + +theorem joined_horizontal {z : ℂ} (hz : z ∈ sineDomain) : + JoinedIn sineDomain z (sineMidPoint z.im) := by + apply JoinedIn.of_segment_subset + intro w hw + have hp : 0 < w.re := (convex_halfSpace_re_gt 0).segment_subset + hz.1 (show 0 < (sineMidPoint z.im).re by dsimp [sineMidPoint]; positivity) hw + have hl : w.re ≤ max (Real.pi / 2) z.re := + (convex_halfSpace_re_le (max (Real.pi / 2) z.re)).segment_subset + (show z.re ≤ max (Real.pi / 2) z.re from le_max_right _ _) (show (sineMidPoint z.im).re ≤ max (Real.pi / 2) z.re from le_max_left _ _) hw + apply sineDomain_horizontal hz _ hp hl + rcases hw with ⟨a, b, ha, hb, hab, rfl⟩ + simp only [Complex.add_im, Complex.smul_im, sineMidPoint, smul_eq_mul] + rw [← add_mul, hab, one_mul] + +theorem joined_sineMidPoints {q r : ℝ} (hq : 0 < q) (hr : 0 < r) : + JoinedIn sineDomain (sineMidPoint q) (sineMidPoint r) := by + apply JoinedIn.of_segment_subset + intro w hw + have hi : 0 < w.im := (convex_halfSpace_im_gt 0).segment_subset hq hr hw + have he : w = sineMidPoint w.im := by + apply Complex.ext + · rcases hw with ⟨a, b, ha, hb, hab, rfl⟩ + simp only [Complex.add_re, Complex.smul_re, sineMidPoint, smul_eq_mul] + rw [← add_mul, hab, one_mul] + · rfl + rw [he] + exact sineMidPoint_mem hi + +theorem isPathConnected_sineDomain : IsPathConnected sineDomain := by + refine ⟨sineMidPoint 1, sineMidPoint_mem zero_lt_one, ?_⟩ + intro z hz + exact (joined_sineMidPoints zero_lt_one hz.2.2.1).trans (joined_horizontal hz).symm + +theorem convex_sineQuadrant : Convex ℝ sineQuadrant := + (convex_halfSpace_re_gt 0).inter (convex_halfSpace_im_lt 0) + +theorem bijective_sineMap : Function.Bijective sineMap := by + let : PathConnectedSpace sineDomain := + isPathConnected_iff_pathConnectedSpace.mp isPathConnected_sineDomain + let : ContractibleSpace sineQuadrant := convex_sineQuadrant.contractibleSpace + ⟨⟨1, -1⟩, by constructor <;> norm_num⟩ + let : LocallyPathConnectedSpace sineQuadrant := convex_sineQuadrant.locallyPathConnectedSpace + exact covering_bijective_of_simplyConnected covering_sineMap + +def sineInverse (w : ℂ) : ℂ := by + classical + exact if hw : w ∈ sineQuadrant then + ((Equiv.ofBijective sineMap bijective_sineMap).symm ⟨w, hw⟩).val + else 0 + +theorem sineInverse_mem {w : ℂ} (hw : w ∈ sineQuadrant) : + sineInverse w ∈ sineDomain := by + simpa only [sineInverse, dite_eq_left hw] using + ((Equiv.ofBijective sineMap bijective_sineMap).symm ⟨w, hw⟩).property + +theorem csinc_sineInverse {w : ℂ} (hw : w ∈ sineQuadrant) : + csinc (sineInverse w) = w := by + have he := congrArg Subtype.val + ((Equiv.ofBijective sineMap bijective_sineMap).apply_symm_apply ⟨w, hw⟩) + simpa only [sineInverse, dite_eq_left hw, Equiv.ofBijective_apply, sineMap] using he + +theorem sineInverse_csinc {z : ℂ} (hz : z ∈ sineDomain) : + sineInverse (csinc z) = z := by + have he := congrArg Subtype.val + ((Equiv.ofBijective sineMap bijective_sineMap).symm_apply_apply ⟨z, hz⟩) + simpa only [sineInverse, dite_eq_left (csinc_mapsTo hz), Equiv.ofBijective_apply, + sineMap] using he + +theorem analyticAt_sineInverse {w : ℂ} (hw : w ∈ sineQuadrant) : + AnalyticAt ℂ sineInverse w := by + let z := sineInverse w + have hz : z ∈ sineDomain := sineInverse_mem hw + have he : sineInverse ∘ csinc =ᶠ[𝓝 z] id := by + filter_upwards [isOpen_sineDomain.mem_nhds hz] with u hu + exact sineInverse_csinc hu + have ha : AnalyticAt ℂ (sineInverse ∘ csinc) z := analyticAt_id.congr he.symm + have := (analyticAt_comp_iff_of_deriv_ne_zero (analyticAt_csinc z) + (deriv_csinc_ne_zero hz)).mp ha + simpa only [z, csinc_sineInverse hw] using this + +theorem inv_sqrt_mem_sineQuadrant {s : ℂ} (hs : 0 < s.im) : + (Complex.sqrt s)⁻¹ ∈ sineQuadrant := by + have hn : |s.re| < ‖s‖ := Complex.abs_re_lt_norm.mpr hs.ne' + have hr : 0 < (Complex.sqrt s).re := by + change 0 < (s ^ (2⁻¹ : ℂ)).re + rw [Complex.cpow_inv_two_re] + apply Real.sqrt_pos.mpr + have := (abs_lt.mp hn).1 + linarith + have hi : 0 < (Complex.sqrt s).im := by + change 0 < (s ^ (2⁻¹ : ℂ)).im + rw [Complex.cpow_inv_two_im_eq_sqrt hs.le] + exact Real.sqrt_pos.mpr (by linarith [(abs_lt.mp hn).2]) + have hz : Complex.sqrt s ≠ 0 := by intro he; simp [he] at hr + constructor + · rw [Complex.inv_re] + exact div_pos hr (Complex.normSq_pos.mpr hz) + · rw [Complex.inv_im] + exact div_neg_of_neg_of_pos (neg_neg_of_pos hi) (Complex.normSq_pos.mpr hz) + +def upperB (s : ℂ) : ℂ := cotParameter (sineInverse (Complex.sqrt s)⁻¹) + +theorem analyticAt_upperB {s : ℂ} (hs : 0 < s.im) : AnalyticAt ℂ upperB s := by + have hm := sineInverse_mem (inv_sqrt_mem_sineQuadrant hs) + have hsqrt : AnalyticAt ℂ Complex.sqrt s := + Complex.differentiableOn_sqrt.analyticOnNhd Complex.isOpen_slitPlane s (Or.inr hs.ne') + have hn : Complex.sqrt s ≠ 0 := by + have hi := (inv_sqrt_mem_sineQuadrant hs).1 + intro he + simp [he] at hi + have ha := (analyticAt_sineInverse (inv_sqrt_mem_sineQuadrant hs)).comp + (f := fun w : ℂ => (Complex.sqrt w)⁻¹) (hsqrt.inv hn) + have hsin : Complex.sin (sineInverse (Complex.sqrt s)⁻¹) ≠ 0 := by + intro he + have he' := Complex.normSq_eq_zero.mpr he + rw [normSq_sin] at he' + have hsh := Real.sinh_pos_iff.mpr hm.2.2.1 + nlinarith [sq_nonneg (Real.sin (sineInverse (Complex.sqrt s)⁻¹).re)] + exact (ha.mul (Complex.analyticAt_cos.comp ha)).div (Complex.analyticAt_sin.comp ha) hsin + +theorem upperB_im_neg {s : ℂ} (hs : 0 < s.im) : (upperB s).im < 0 := by + have hm := sineInverse_mem (inv_sqrt_mem_sineQuadrant hs) + exact cotParameter_im_neg hm.1 hm.2.2.1 + +def sinhc : ℝ → ℝ := dslope Real.sinh 0 + +@[simp] theorem sinhc_zero : sinhc 0 = 1 := by + simp [sinhc, dslope_same, (Real.hasDerivAt_sinh 0).deriv] + +theorem sinhc_of_ne {q : ℝ} (hq : q ≠ 0) : sinhc q = Real.sinh q / q := by + simp [sinhc, dslope_of_ne _ hq, slope, div_eq_mul_inv, mul_comm] + +theorem continuous_sinhc : Continuous sinhc := by + apply continuous_iff_continuousAt.mpr + intro q + rcases eq_or_ne q 0 with rfl | hq + · exact continuousAt_dslope_same.mpr Real.differentiableAt_sinh + · exact (continuousAt_dslope_of_ne hq).mpr Real.continuous_sinh.continuousAt + +theorem strictMonoOn_sinhc : StrictMonoOn sinhc (Ici 0) := by + apply strictMonoOn_of_deriv_pos (convex_Ici 0) continuous_sinhc.continuousOn + intro q hq + rw [interior_Ici, mem_Ioi] at hq + have he : sinhc =ᶠ[𝓝 q] fun x => Real.sinh x / x := by + filter_upwards [eventually_ne_nhds hq.ne'] with x hx + exact sinhc_of_ne hx + rw [he.deriv_eq] + change 0 < deriv (Real.sinh / id) q + rw [((Real.hasDerivAt_sinh q).div (hasDerivAt_id q) hq.ne').deriv] + simpa only [one_mul, mul_one, mul_comm, id_eq] using + div_pos (sub_pos.mpr (sinh_lt_mul_cosh hq)) (sq_pos_of_pos hq) + +theorem strictAntiOn_sinc : StrictAntiOn Real.sinc (Icc 0 Real.pi) := by + apply strictAntiOn_of_deriv_neg (convex_Icc 0 Real.pi) Real.continuous_sinc.continuousOn + intro p hp + rw [interior_Icc, mem_Ioo] at hp + have he : Real.sinc =ᶠ[𝓝 p] fun x => Real.sin x / x := by + filter_upwards [eventually_ne_nhds hp.1.ne'] with x hx + exact Real.sinc_of_ne_zero hx + rw [he.deriv_eq] + change deriv (Real.sin / id) p < 0 + rw [((Real.hasDerivAt_sin p).div (hasDerivAt_id p) hp.1.ne').deriv] + apply div_neg_of_neg_of_pos _ (sq_pos_of_pos hp.1) + have := sin_sub_mul_cos_pos hp + simp only [mul_one, id_eq] + nlinarith + +@[simp] theorem csinc_ofReal (p : ℝ) : csinc (p : ℂ) = (Real.sinc p : ℂ) := by + rcases eq_or_ne p 0 with rfl | hp + · simp [csinc_zero] + · rw [csinc_of_ne (Complex.ofReal_ne_zero.mpr hp), sineParameter, + Real.sinc_of_ne_zero hp, ← Complex.ofReal_sin, Complex.ofReal_div] + +@[simp] theorem csinc_mul_I (q : ℝ) : csinc ((q : ℂ) * I) = (sinhc q : ℂ) := by + rcases eq_or_ne q 0 with rfl | hq + · simp [csinc_zero] + · rw [csinc_of_ne (mul_ne_zero (Complex.ofReal_ne_zero.mpr hq) Complex.I_ne_zero), + sineParameter, Complex.sin_mul_I, ← Complex.ofReal_sinh, sinhc_of_ne hq, + Complex.ofReal_div] + field_simp + +def closedSineQuadrant : Set ℂ := {w | 0 < w.re ∧ w.im ≤ 0} +def closedSineDomain : Set ℂ := sineStrip ∩ csinc ⁻¹' closedSineQuadrant + +theorem csinc_strip_re_lt_pi {z : ℂ} (hz : z ∈ sineStrip) (ha : 0 < (csinc z).re) : + z.re < Real.pi := by + by_contra! hn + have hp : z.re = Real.pi := le_antisymm hz.2.1 hn + have hz0 : z ≠ 0 := by intro he; simp [he] at hp; linarith [Real.pi_pos] + rw [csinc_of_ne hz0, sineParameter_re, hp] at ha + simp only [Real.sin_pi, Real.cos_pi, mul_zero, zero_mul, mul_neg_one, zero_add] at ha + have : -(z.im * Real.sinh z.im) / (Real.pi ^ 2 + z.im ^ 2) ≤ 0 := + div_nonpos_of_nonpos_of_nonneg (neg_nonpos.mpr + (mul_nonneg hz.2.2 (Real.sinh_nonneg_iff.mpr hz.2.2))) (by positivity) + rw [neg_mul] at ha + linarith + +theorem csinc_boundary_axes {z : ℂ} (hz : z ∈ closedSineDomain) + (hi : (csinc z).im = 0) : z.re = 0 ∨ z.im = 0 := by + by_contra! hn + have hp : 0 < z.re := lt_of_le_of_ne hz.1.1 hn.1.symm + have hq : 0 < z.im := lt_of_le_of_ne hz.1.2.2 hn.2.symm + have he := sineParameter_im_neg ⟨hp, csinc_strip_re_lt_pi hz.1 hz.2.1⟩ hq + rw [← csinc_of_ne (show z ≠ 0 by intro he; simp [he] at hp)] at he + linarith + +theorem sinc_eq_sinhc_only_zero {p q : ℝ} (hp : p ∈ Icc 0 Real.pi) (hq : 0 ≤ q) + (he : Real.sinc p = sinhc q) : p = 0 ∧ q = 0 := by + have hlow : 1 ≤ sinhc q := by + simpa using strictMonoOn_sinhc.monotoneOn (show (0 : ℝ) ∈ Ici 0 by simp) hq hq + have hp0 : p = 0 := by + by_contra hn + have hlt := strictAntiOn_sinc ⟨le_rfl, Real.pi_pos.le⟩ hp (lt_of_le_of_ne hp.1 (Ne.symm hn)) + simp only [Real.sinc_zero] at hlt + linarith + have hq0 : q = 0 := by + by_contra hn + have hlt := strictMonoOn_sinhc (show (0 : ℝ) ∈ Ici 0 by simp) hq + (lt_of_le_of_ne hq (Ne.symm hn)) + simp only [sinhc_zero] at hlt + simp [hp0] at he + linarith + exact ⟨hp0, hq0⟩ + +theorem eq_of_im_zero {z : ℂ} (hz : z.im = 0) : z = (z.re : ℂ) := by + apply Complex.ext <;> simp [hz] + +theorem eq_mul_I_of_re_zero {z : ℂ} (hz : z.re = 0) : z = (z.im : ℂ) * I := by + apply Complex.ext <;> simp [hz] + +theorem csinc_eq_sinhc_of_re_zero {z : ℂ} (hz : z.re = 0) : + csinc z = (sinhc z.im : ℂ) := + (congrArg csinc (eq_mul_I_of_re_zero hz)).trans (csinc_mul_I z.im) + +theorem csinc_eq_sinc_of_im_zero {z : ℂ} (hz : z.im = 0) : + csinc z = (Real.sinc z.re : ℂ) := + (congrArg csinc (eq_of_im_zero hz)).trans (csinc_ofReal z.re) + +theorem csinc_injOn_closedSineDomain : InjOn csinc closedSineDomain := by + intro z hz w hw he + by_cases hi : (csinc z).im < 0 + · have hz' : z ∈ sineDomain := csinc_strip_quadrant hz.1 ⟨hz.2.1, hi⟩ + have hw' : w ∈ sineDomain := csinc_strip_quadrant hw.1 ⟨hw.2.1, he ▸ hi⟩ + exact congrArg Subtype.val (bijective_sineMap.1 (a₁ := ⟨z, hz'⟩) (a₂ := ⟨w, hw'⟩) + (Subtype.ext he)) + · have hi0 : (csinc z).im = 0 := le_antisymm hz.2.2 (le_of_not_gt hi) + have hiw : (csinc w).im = 0 := he ▸ hi0 + rcases csinc_boundary_axes hz hi0 with hzr | hzi <;> + rcases csinc_boundary_axes hw hiw with hwr | hwi + · have he' : sinhc z.im = sinhc w.im := by + apply Complex.ofReal_injective + simpa only [csinc_eq_sinhc_of_re_zero hzr, csinc_eq_sinhc_of_re_zero hwr] using he + have heq := strictMonoOn_sinhc.injOn hz.1.2.2 hw.1.2.2 he' + exact Complex.ext (hzr.trans hwr.symm) heq + · have he' : Real.sinc w.re = sinhc z.im := by + apply Complex.ofReal_injective + simpa only [csinc_eq_sinhc_of_re_zero hzr, csinc_eq_sinc_of_im_zero hwi] + using he.symm + obtain ⟨hwr0, hzi0⟩ := sinc_eq_sinhc_only_zero ⟨hw.1.1, hw.1.2.1⟩ hz.1.2.2 he' + exact Complex.ext (hzr.trans hwr0.symm) (hzi0.trans hwi.symm) + · have he' : Real.sinc z.re = sinhc w.im := by + apply Complex.ofReal_injective + simpa only [csinc_eq_sinc_of_im_zero hzi, csinc_eq_sinhc_of_re_zero hwr] + using he + obtain ⟨hzr0, hwi0⟩ := sinc_eq_sinhc_only_zero ⟨hz.1.1, hz.1.2.1⟩ hw.1.2.2 he' + exact Complex.ext (hzr0.trans hwr.symm) (hzi.trans hwi0.symm) + · have he' : Real.sinc z.re = Real.sinc w.re := by + apply Complex.ofReal_injective + simpa only [csinc_eq_sinc_of_im_zero hzi, csinc_eq_sinc_of_im_zero hwi] using he + have heq := strictAntiOn_sinc.injOn ⟨hz.1.1, hz.1.2.1⟩ ⟨hw.1.1, hw.1.2.1⟩ he' + exact Complex.ext heq (hzi.trans hwi.symm) + +def closedSineMap : closedSineDomain → closedSineQuadrant := fun z => ⟨csinc z, z.property.2⟩ + +theorem continuous_closedSineMap : Continuous closedSineMap := + (continuous_csinc.comp continuous_subtype_val).subtype_mk _ + +theorem proper_closedSineMap : IsProperMap closedSineMap := by + apply isProperMap_iff_isCompact_preimage.mpr + refine ⟨continuous_closedSineMap, ?_⟩ + intro K hK + have hc := isCompact_strip_preimage (hK.image continuous_subtype_val) + have he : Subtype.val '' (closedSineMap ⁻¹' K) = sineStrip ∩ csinc ⁻¹' (Subtype.val '' K) := by + ext z + constructor + · rintro ⟨u, hu, rfl⟩ + exact ⟨u.property.1, _, hu, rfl⟩ + · rintro ⟨hz, w, hw, he⟩ + have ha : csinc z ∈ closedSineQuadrant := he ▸ w.property + refine ⟨⟨z, hz, ha⟩, ?_, rfl⟩ + have hw' : closedSineMap ⟨z, hz, ha⟩ = w := Subtype.ext he.symm + simpa [hw'] using hw + exact (Topology.IsEmbedding.subtypeVal.isCompact_iff).mpr (he ▸ hc) + +theorem closedSineMap_injective : Function.Injective closedSineMap := by + intro z w he + apply Subtype.ext + exact csinc_injOn_closedSineDomain z.property w.property (congrArg Subtype.val he) + +theorem range_closedSineMap_of_im_neg {w : closedSineQuadrant} (hw : w.val.im < 0) : + w ∈ range closedSineMap := by + obtain ⟨z, hz⟩ := bijective_sineMap.2 ⟨w, w.property.1, hw⟩ + have hm : z.val ∈ closedSineDomain := + ⟨⟨z.property.1.le, z.property.2.1.le, z.property.2.2.1.le⟩, + z.property.2.2.2, (csinc_mapsTo z.property).2.le⟩ + have he : csinc z.val = w.val := congrArg (fun u : sineQuadrant => u.val) hz + exact ⟨⟨z, hm⟩, Subtype.ext he⟩ + +theorem closedSineMap_surjective : Function.Surjective closedSineMap := by + intro w + let v : ℕ → closedSineQuadrant := fun n => + ⟨⟨w.val.re, w.val.im - 1 / ((n : ℝ) + 1)⟩, w.property.1, + sub_nonpos.mpr (w.property.2.trans (by positivity))⟩ + have hv (n : ℕ) : (v n).val.im < 0 := by + dsimp [v] + have hp : 0 < 1 / ((n : ℝ) + 1) := by positivity + linarith [w.property.2] + have ht : Tendsto v atTop (𝓝 w) := by + apply tendsto_subtype_rng.mpr + have hzero : Tendsto (fun n : ℕ => 1 / ((n : ℝ) + 1)) atTop (𝓝 0) := by + simpa only [Function.comp_def, Nat.cast_add, Nat.cast_one] using + (tendsto_const_div_atTop_nhds_zero_nat (1 : ℝ)).comp (tendsto_add_atTop_nat 1) + have h := (tendsto_const_nhds (x := w.val)).sub + ((Complex.continuous_ofReal.continuousAt.tendsto.comp hzero).mul_const I) + simp only [Complex.ofReal_zero, zero_mul, sub_zero] at h + convert h using 1 + funext n + apply Complex.ext <;> + simp only [v, Function.comp_apply, Complex.sub_re, Complex.sub_im, + Complex.mul_re, Complex.mul_im, Complex.ofReal_re, Complex.ofReal_im, + Complex.I_re, Complex.I_im, mul_zero, mul_one, sub_zero, add_zero] + + exact proper_closedSineMap.isClosed_range.mem_of_tendsto ht + (Eventually.of_forall (fun n => range_closedSineMap_of_im_neg (hv n))) + +def closedSineHomeomorph : closedSineDomain ≃ₜ closedSineQuadrant := + (Equiv.ofBijective closedSineMap ⟨closedSineMap_injective, closedSineMap_surjective⟩).toHomeomorphOfContinuousClosed continuous_closedSineMap proper_closedSineMap.isClosedMap + +def closedSineInverse (w : ℂ) : ℂ := by + classical + exact if hw : w ∈ closedSineQuadrant then (closedSineHomeomorph.symm ⟨w, hw⟩).val else 0 + +theorem closedSineInverse_mem {w : ℂ} (hw : w ∈ closedSineQuadrant) : + closedSineInverse w ∈ closedSineDomain := by + simpa only [closedSineInverse, dite_eq_left hw] using + (closedSineHomeomorph.symm ⟨w, hw⟩).property + +theorem csinc_closedSineInverse {w : ℂ} (hw : w ∈ closedSineQuadrant) : + csinc (closedSineInverse w) = w := by + have he := congrArg Subtype.val (closedSineHomeomorph.apply_symm_apply ⟨w, hw⟩) + change csinc (closedSineHomeomorph.symm ⟨w, hw⟩).val = w at he + simpa only [closedSineInverse, dite_eq_left hw] using he + +theorem continuousOn_closedSineInverse : ContinuousOn closedSineInverse closedSineQuadrant := by + rw [continuousOn_iff_continuous_domRestrict] + have he : closedSineQuadrant.domRestrict closedSineInverse = + fun w : closedSineQuadrant => (closedSineHomeomorph.symm w).val := by + funext w + simp only [domRestrict_apply, closedSineInverse, dite_eq_left w.property] + rw [he] + exact continuous_subtype_val.comp closedSineHomeomorph.symm.continuous + +theorem closedSineInverse_eq_sineInverse {w : ℂ} (hw : w ∈ sineQuadrant) : + closedSineInverse w = sineInverse w := by + have hw' : w ∈ closedSineQuadrant := ⟨hw.1, hw.2.le⟩ + have hz := sineInverse_mem hw + apply csinc_injOn_closedSineDomain (closedSineInverse_mem hw') + ⟨⟨hz.1.le, hz.2.1.le, hz.2.2.1.le⟩, hz.2.2.2, (csinc_mapsTo hz).2.le⟩ + exact (csinc_closedSineInverse hw').trans (csinc_sineInverse hw).symm + +def ccot (z : ℂ) : ℂ := Complex.cos z / csinc z + +@[simp] theorem ccot_zero : ccot 0 = 1 := by simp [ccot, csinc_zero] + +theorem ccot_eq_cotParameter {z : ℂ} (hz : z ≠ 0) : ccot z = cotParameter z := by + rw [ccot, csinc_of_ne hz, sineParameter, cotParameter] + rw [div_div_eq_mul_div, mul_comm] + +theorem continuousAt_ccot {z : ℂ} (hz : csinc z ≠ 0) : ContinuousAt ccot z := + Complex.continuous_cos.continuousAt.div continuous_csinc.continuousAt hz + +theorem ccot_boundary_im {w : ℂ} (hw : w ∈ closedSineQuadrant) (hi : w.im = 0) : + (ccot (closedSineInverse w)).im = 0 := by + let z := closedSineInverse w + have hz : z ∈ closedSineDomain := closedSineInverse_mem hw + have he : csinc z = w := csinc_closedSineInverse hw + rcases csinc_boundary_axes hz (by rw [he, hi]) with hr | hi' + · have hcos : Complex.cos z = (Real.cosh z.im : ℂ) := by + calc + Complex.cos z = Complex.cos ((z.im : ℂ) * I) := congrArg _ (eq_mul_I_of_re_zero hr) + _ = (Real.cosh z.im : ℂ) := by rw [Complex.cos_mul_I, Complex.ofReal_cosh] + change (ccot z).im = 0 + rw [ccot, hcos, csinc_eq_sinhc_of_re_zero hr, ← Complex.ofReal_div] + exact Complex.ofReal_im _ + · have hcos : Complex.cos z = (Real.cos z.re : ℂ) := by + calc + Complex.cos z = Complex.cos (z.re : ℂ) := congrArg _ (eq_of_im_zero hi') + _ = (Real.cos z.re : ℂ) := (Complex.ofReal_cos _).symm + change (ccot z).im = 0 + rw [ccot, hcos, csinc_eq_sinc_of_im_zero hi', ← Complex.ofReal_div] + exact Complex.ofReal_im _ + +def upperReflect (s : ℂ) : ℂ := ⟨s.re, |s.im|⟩ + +theorem continuous_upperReflect : Continuous upperReflect := by + have he : upperReflect = fun s : ℂ => (s.re : ℂ) + ((|s.im| : ℝ) : ℂ) * I := by + funext s + apply Complex.ext <;> simp [upperReflect] + rw [he] + fun_prop + +theorem upperReflect_eq {s : ℂ} (hs : 0 ≤ s.im) : upperReflect s = s := by + apply Complex.ext <;> simp [upperReflect, abs_of_nonneg hs] + +theorem inv_sqrt_mem_closedSineQuadrant {s : ℂ} (hr : 0 < s.re) (hi : 0 ≤ s.im) : + (Complex.sqrt s)⁻¹ ∈ closedSineQuadrant := by + rcases eq_or_lt_of_le hi with he | hpos + · have hs : s = (s.re : ℂ) := eq_of_im_zero he.symm + have hsq : Complex.sqrt s = (Real.sqrt s.re : ℂ) := by + rw [hs] + change (s.re : ℂ) ^ (2⁻¹ : ℂ) = (Real.sqrt s.re : ℂ) + rw [Real.sqrt_eq_rpow, Complex.ofReal_cpow hr.le] + congr 1 + norm_num + rw [hsq, ← Complex.ofReal_inv] + exact ⟨inv_pos.mpr (Real.sqrt_pos.mpr hr), by simp⟩ + · have hm := inv_sqrt_mem_sineQuadrant hpos + exact ⟨hm.1, hm.2.le⟩ + +def boundaryB (s : ℂ) : ℂ := ccot (closedSineInverse (Complex.sqrt (upperReflect s))⁻¹) + +theorem boundaryB_eq_upperB {s : ℂ} (hs : 0 < s.im) : boundaryB s = upperB s := by + rw [boundaryB, upperReflect_eq hs.le, + closedSineInverse_eq_sineInverse (inv_sqrt_mem_sineQuadrant hs)] + have hz := sineInverse_mem (inv_sqrt_mem_sineQuadrant hs) + exact ccot_eq_cotParameter (by intro he; have hr := hz.1; simp [he] at hr) + +theorem analyticAt_boundaryB {s : ℂ} (hs : 0 < s.im) : AnalyticAt ℂ boundaryB s := by + apply (analyticAt_upperB hs).congr + filter_upwards [(isOpen_lt continuous_const Complex.continuous_im).mem_nhds hs] with z hz + exact (boundaryB_eq_upperB hz).symm + +theorem boundaryB_im_neg {s : ℂ} (hs : 0 < s.im) : (boundaryB s).im < 0 := by + rw [boundaryB_eq_upperB hs] + exact upperB_im_neg hs + +theorem continuousAt_reflectedRoot {s : ℂ} (hs : 0 < s.re) : + ContinuousAt (fun z => (Complex.sqrt (upperReflect z))⁻¹) s := by + have hm : (Complex.sqrt (upperReflect s))⁻¹ ∈ closedSineQuadrant := + inv_sqrt_mem_closedSineQuadrant hs (abs_nonneg _) + have hn : Complex.sqrt (upperReflect s) ≠ 0 := by + intro he + have hp := hm.1 + simp only [he, inv_zero, Complex.zero_re, lt_self_iff_false] at hp + have hc : ContinuousAt Complex.sqrt (upperReflect s) := + Complex.continuousAt_sqrt (Or.inl hs.le) + exact (hc.comp continuous_upperReflect.continuousAt).inv₀ hn + +theorem continuousAt_boundaryB {x : ℝ} (hx : 0 < x) : ContinuousAt boundaryB (x : ℂ) := by + let U : Set ℂ := {s | 0 < s.re} + let r : ℂ → ℂ := fun s => (Complex.sqrt (upperReflect s))⁻¹ + have hmaps : MapsTo r U closedSineQuadrant := fun s hs => + inv_sqrt_mem_closedSineQuadrant hs (abs_nonneg _) + have hr : ContinuousOn r U := fun s hs => (continuousAt_reflectedRoot hs).continuousWithinAt + have ht : ContinuousAt (closedSineInverse ∘ r) (x : ℂ) := + (continuousOn_closedSineInverse.comp hr hmaps).continuousAt + ((isOpen_lt continuous_const Complex.continuous_re).mem_nhds hx) + have hm : r (x : ℂ) ∈ closedSineQuadrant := hmaps hx + have hn : csinc (closedSineInverse (r (x : ℂ))) ≠ 0 := by + rw [csinc_closedSineInverse hm] + intro he + have hp := hm.1 + simp only [he, Complex.zero_re, lt_self_iff_false] at hp + exact (continuousAt_ccot hn).comp (f := closedSineInverse ∘ r) ht + +theorem boundaryB_real {x : ℝ} (hx : 0 < x) : (boundaryB (x : ℂ)).im = 0 := by + have hr : (Complex.sqrt (x : ℂ))⁻¹ ∈ closedSineQuadrant := + inv_sqrt_mem_closedSineQuadrant hx (by simp) + have hi : ((Complex.sqrt (x : ℂ))⁻¹).im = 0 := by + have hs : Complex.sqrt (x : ℂ) = (Real.sqrt x : ℂ) := by + exact Complex.sqrt_of_nonneg (by exact_mod_cast hx.le) + rw [hs, ← Complex.ofReal_inv] + exact Complex.ofReal_im _ + rw [boundaryB, upperReflect_eq (by simp : (0 : ℝ) ≤ (x : ℂ).im)] + exact ccot_boundary_im hr hi + +@[simp] theorem closedSineInverse_one : closedSineInverse 1 = 0 := by + have hw : (1 : ℂ) ∈ closedSineQuadrant := by constructor <;> norm_num + have hz : (0 : ℂ) ∈ closedSineDomain := by + refine ⟨⟨le_rfl, Real.pi_pos.le, le_rfl⟩, ?_⟩ + change csinc 0 ∈ closedSineQuadrant + simpa only [csinc_zero] using hw + exact csinc_injOn_closedSineDomain (closedSineInverse_mem hw) hz + ((csinc_closedSineInverse hw).trans csinc_zero.symm) + +@[simp] theorem boundaryB_one : boundaryB 1 = 1 := by + rw [boundaryB, upperReflect_eq (by norm_num), Complex.sqrt_one, inv_one, + closedSineInverse_one, ccot_zero] + +end EntropyPhotonNumber + +end + +end OAI diff --git a/lean/OAI/InformationTheory/PhotonNumber/Generator.lean b/lean/OAI/InformationTheory/PhotonNumber/Generator.lean new file mode 100644 index 0000000000000000000000000000000000000000..00ea4f4b4d761f370090616f7e0dade2693b9dbc --- /dev/null +++ b/lean/OAI/InformationTheory/PhotonNumber/Generator.lean @@ -0,0 +1,779 @@ +import OAI.InformationTheory.PhotonNumber.BeamForms + +namespace OAI + +noncomputable section + +open scoped BigOperators ComplexConjugate ENNReal Topology +open MeasureTheory +open scoped ComplexConjugate +open scoped BigOperators ComplexConjugate +open scoped BigOperators +open MvPolynomial +open scoped BigOperators ComplexConjugate Classical +open Submodule +open ContinuousLinearMap +open scoped ENNReal + +namespace PhysicalGenerator +open EntropyPhotonNumber QuantumTrace Annihilation BeamLadder +open scoped BigOperators ComplexConjugate +variable {n : ℕ} {I : Type*} + +def lowerCoefficient (j : Fin n) (k : NumberIndex n) : ℂ := Real.sqrt ((k j:ℝ)+1) +def raiseCoefficient (j : Fin n) (k : NumberIndex n) : ℂ := + if k j=0 then 0 else Real.sqrt (k j:ℝ) +def modeCoefficient (j : Fin n) (u : Bool) (k : NumberIndex n) : ℂ := + (k j:ℂ)+(if u then 1 else 0) + +def lowerFamily (j : Fin n) (x : I → Fock n) := fun i => sandwich 0 3 (by omega) j (x i) +def raiseFamily (j : Fin n) (x : I → Fock n) := fun i => creationSandwich 0 3 (by omega) j (x i) +def modeFamily (j : Fin n) (u : Bool) (x : I → Fock n) := fun i => inverseWeight 2 (modeBound j u (x i)) +def baseFamily (x : I → Fock n) := fun i => inverseWeight 3 (x i) + +def dissipator (j : Fin n) (u : Bool) (x : I → Fock n) : Fock n →L[ℂ] Fock n := + CrossEnsemble.operator (if u then raiseFamily j x else lowerFamily j x) + (if u then raiseFamily j x else lowerFamily j x)- + (2:ℂ)⁻¹ • (CrossEnsemble.operator (modeFamily j u x) (baseFamily x)+ + CrossEnsemble.operator (baseFamily x) (modeFamily j u x)) +def generator (r : ℝ) (x : I → Fock n) : Fock n →L[ℂ] Fock n := + ∑ j, (((r+1:ℝ):ℂ) • dissipator j false x+(r:ℂ) • dissipator j true x) + +theorem pairing_hasSum {J : Type*} (b : HilbertBasis J ℂ (Fock n)) + (r : ℝ) (x : I → Fock n) (hx : Summable (fun i => ‖x i‖^2)) + (Z : Fock n →L[ℂ] Fock n) : + HasSum (fun k => inner ℂ (b k) (Z (generator r x (b k)))) (singleGeneratorPairing r x Z) := by + have hl (j : Fin n) := CrossEnsemble.applied_summable hx (sandwich 0 3 (by omega) j) + have hr (j : Fin n) := CrossEnsemble.applied_summable hx (creationSandwich 0 3 (by omega) j) + have hm (j : Fin n) (u : Bool) := CrossEnsemble.applied_summable hx (inverseWeight 2 ∘L modeBound j u) + have hi := CrossEnsemble.applied_summable hx (inverseWeight 3) + have hl' (j : Fin n) := (CrossEnsemble.pairing_trace b (hl j) (hl j) Z).sub + (((CrossEnsemble.pairing_trace b (hm j false) hi Z).add + (CrossEnsemble.pairing_trace b hi (hm j false) Z)).mul_left (2:ℂ)⁻¹) + have hr' (j : Fin n) := (CrossEnsemble.pairing_trace b (hr j) (hr j) Z).sub + (((CrossEnsemble.pairing_trace b (hm j true) hi Z).add + (CrossEnsemble.pairing_trace b hi (hm j true) Z)).mul_left (2:ℂ)⁻¹) + have hh := hasSum_sum fun j (_hj : j ∈ (Finset.univ : Finset (Fin n))) => + ((hl' j).mul_left ((r+1:ℝ):ℂ)).add ((hr' j).mul_left (r:ℂ)) + convert! hh using 1 + ext k + simp only [generator,dissipator, + Bool.false_eq_true,ite_false,ite_true,sum_apply,add_apply,sub_apply,smul_apply, + map_sum,map_add,map_sub,map_smul,inner_sum,inner_sub_right,inner_add_right,inner_smul_right] + rfl + +theorem dissipator_entry (x : I → Fock n) (hx : Summable (fun i => ‖x i‖^2)) + (j : Fin n) (u : Bool) (k l : NumberIndex n) : + entry (dissipator j u x) k l = + (if u then raiseCoefficient j k*conj (raiseCoefficient j l)* + entry (CrossEnsemble.operator (baseFamily x) (baseFamily x)) (down j k) (down j l) + else lowerCoefficient j k*conj (lowerCoefficient j l)* + entry (CrossEnsemble.operator (baseFamily x) (baseFamily x)) (up j k) (up j l))- + (2:ℂ)⁻¹*((modeCoefficient j u k+conj (modeCoefficient j u l))* + entry (CrossEnsemble.operator (baseFamily x) (baseFamily x)) k l) := by + have hi : Summable (fun i => ‖baseFamily x i‖^2) := CrossEnsemble.applied_summable hx (inverseWeight 3) + have hm : Summable (fun i => ‖modeFamily j u x i‖^2) := + CrossEnsemble.applied_summable hx (inverseWeight 2 ∘L modeBound j u) + have hml := CrossEnsemble.entry_transform (modeFamily j u x) (baseFamily x) (baseFamily x) (baseFamily x) + hm hi hi hi k l k l (modeCoefficient j u k) 1 (by + intro i + simp only [modeFamily,baseFamily,single_number_third_apply,modeCoefficient,map_one,mul_one] + ring) + have hmr := CrossEnsemble.entry_transform (baseFamily x) (modeFamily j u x) (baseFamily x) (baseFamily x) + hi hm hi hi k l k l 1 (modeCoefficient j u l) (by + intro i + simp only [modeFamily,baseFamily,single_number_third_apply,modeCoefficient,one_mul,map_mul] + ring) + have hg : entry (CrossEnsemble.operator (if u then raiseFamily j x else lowerFamily j x) + (if u then raiseFamily j x else lowerFamily j x)) k l = + (if u then raiseCoefficient j k*conj (raiseCoefficient j l)* + entry (CrossEnsemble.operator (baseFamily x) (baseFamily x)) (down j k) (down j l) + else lowerCoefficient j k*conj (lowerCoefficient j l)* + entry (CrossEnsemble.operator (baseFamily x) (baseFamily x)) (up j k) (up j l)) := by + cases u + · simp only [Bool.false_eq_true,ite_false] + apply CrossEnsemble.entry_transform _ _ _ _ + (CrossEnsemble.applied_summable hx (sandwich 0 3 (by omega) j)) + (CrossEnsemble.applied_summable hx (sandwich 0 3 (by omega) j)) hi hi + intro i + simp only [baseFamily,single_lower_third_apply,lowerCoefficient,map_mul] + ring + · simp only [ite_true] + apply CrossEnsemble.entry_transform _ _ _ _ + (CrossEnsemble.applied_summable hx (creationSandwich 0 3 (by omega) j)) + (CrossEnsemble.applied_summable hx (creationSandwich 0 3 (by omega) j)) hi hi + intro i + simp only [baseFamily,single_raise_third_apply,raiseCoefficient,map_mul] + ring + have hout : entry (dissipator j u x) k l=entry (CrossEnsemble.operator + (if u then raiseFamily j x else lowerFamily j x) (if u then raiseFamily j x else lowerFamily j x)) k l- + (2:ℂ)⁻¹*(entry (CrossEnsemble.operator (modeFamily j u x) (baseFamily x)) k l+ + entry (CrossEnsemble.operator (baseFamily x) (modeFamily j u x)) k l) := by + simp only [entry,dissipator,sub_apply,smul_apply,add_apply,inner_sub_right,inner_smul_right,inner_add_right] + rw [hout,hg,hml,hmr] + simp only [map_one,mul_one,one_mul] + ring + +theorem lowerCoefficient_self (j : Fin n) (k : NumberIndex n) : + lowerCoefficient j k*conj (lowerCoefficient j k)=(k j:ℂ)+1 := by + simp only [lowerCoefficient,Complex.conj_ofReal,← Complex.ofReal_mul, + Real.mul_self_sqrt (by positivity : 0≤(k j:ℝ)+1)] + push_cast + rfl + +theorem raiseCoefficient_self (j : Fin n) (k : NumberIndex n) : + raiseCoefficient j k*conj (raiseCoefficient j k)=(k j:ℂ) := by + by_cases hk : k j=0 + · simp [raiseCoefficient,hk] + · simp only [raiseCoefficient,ite_eq_right hk,Complex.conj_ofReal,← Complex.ofReal_mul, + Real.mul_self_sqrt (Nat.cast_nonneg (k j)), Complex.ofReal_natCast] + +theorem modeCoefficient_conj (j : Fin n) (u : Bool) (k : NumberIndex n) : + conj (modeCoefficient j u k)=modeCoefficient j u k := by + cases u <;> simp [modeCoefficient] + +theorem generator_zero_of_geometric_diagonal (r : ℝ) (p : NumberIndex n → ℝ) + (hb : ∀ j k, ((r+1:ℝ):ℂ)*(p (up j k):ℂ)=(r:ℂ)*(p k:ℂ)) + (x : I → Fock n) (hx : Summable (fun i => ‖x i‖^2)) + (he : ∀ k l, entry (CrossEnsemble.operator (baseFamily x) (baseFamily x)) k l= + if k=l then (p k:ℂ) else 0) : generator r x=0 := by + have hj (j : Fin n) : ((r+1:ℝ):ℂ) • dissipator j false x+(r:ℂ) • dissipator j true x=0 := by + apply entry_ext + intro k l + have hs : entry (((r+1:ℝ):ℂ) • dissipator j false x+(r:ℂ) • dissipator j true x) k l= + ((r+1:ℝ):ℂ)*entry (dissipator j false x) k l+(r:ℂ)*entry (dissipator j true x) k l := by + simp only [entry,add_apply,smul_apply,inner_add_right,inner_smul_right] + rw [hs,dissipator_entry x hx j false,dissipator_entry x hx j true] + simp only [Bool.false_eq_true,ite_false,ite_true,he,modeCoefficient_conj] + by_cases hkl : k=l + · subst l + simp only [ite_true,lowerCoefficient_self,raiseCoefficient_self,modeCoefficient, + Bool.false_eq_true,ite_false,add_zero,ite_true,entry,zero_apply,inner_zero_right] + have hb1 := hb j k + by_cases hk : k j=0 + · simp only [hk,Nat.cast_zero,zero_add,one_mul,zero_mul,add_zero,mul_zero,sub_zero] + linear_combination hb1 + · have hb2 := hb j (down j k) + rw [up_down j k (Nat.pos_of_ne_zero hk)] at hb2 + linear_combination ((k j:ℂ)+1)*hb1-(k j:ℂ)*hb2 + · have hup : up j k≠up j l := fun h => hkl (up_injective j h) + have hr : raiseCoefficient j k*conj (raiseCoefficient j l)* + (if down j k=down j l then (p (down j k):ℂ) else 0)=0 := by + by_cases hk : k j=0 + · simp [raiseCoefficient,hk] + by_cases hl : l j=0 + · simp [raiseCoefficient,hl] + have hd : down j k≠down j l := by + intro hh + have hh' := congrArg (up j) hh + rw [up_down j k (Nat.pos_of_ne_zero hk),up_down j l (Nat.pos_of_ne_zero hl)] at hh' + exact hkl hh' + rw [ite_eq_right hd,mul_zero] + rw [ite_eq_right hkl,ite_eq_right hup,hr] + simp only [mul_zero,sub_zero,add_zero,entry,zero_apply,inner_zero_right] + simp only [generator,hj,Finset.sum_const_zero] + +theorem weighted_pairing_zero_of_geometric_diagonal (r : ℝ) (p : NumberIndex n → ℝ) + (hb : ∀ j k, ((r+1:ℝ):ℂ)*(p (up j k):ℂ)=(r:ℂ)*(p k:ℂ)) + (x : I → Fock n) (hx : Summable (fun i => ‖x i‖^2)) + (he : ∀ k l, entry (CrossEnsemble.operator (baseFamily x) (baseFamily x)) k l= + if k=l then (p k:ℂ) else 0) (B : Fock n →L[ℂ] Fock n) : + WeightedGenerator.pairing r x B=0 := by + let bas : HilbertBasis (NumberIndex n) ℂ (Fock n) := + HilbertBasis.ofRepr (LinearIsometryEquiv.refl ℂ _) + have hg := generator_zero_of_geometric_diagonal r p hb x hx he + have hzero : HasSum (fun _ : NumberIndex n => (0:ℂ)) 0 := hasSum_zero + have hphys (Z : Fock n →L[ℂ] Fock n) : singleGeneratorPairing r x Z=0 := by + have hh := pairing_hasSum bas r x hx Z + have hz : HasSum (fun _ : NumberIndex n => (0:ℂ)) (singleGeneratorPairing r x Z) := by + simpa only [hg,zero_apply,map_zero,inner_zero_right] using hh + exact hz.unique hzero + apply weighted_trace_ext bas (WeightedGenerator.generator r x) 0 + (WeightedGenerator.pairing r x) (fun _ => 0) + (fun Z => WeightedGenerator.pairing_hasSum bas r x hx Z) + (fun Z => by simpa only [zero_apply,map_zero,inner_zero_right] using hzero) + (fun Z => by rw [weighted_pairing_physical,hphys]) B +end PhysicalGenerator + +namespace QuantumTrace +theorem thermalWeight_number (n : ℕ) (r : ℝ) (k : Fin n → ℕ) : + thermalWeight n r k=(r+1)⁻¹^n*(r/(r+1))^(∑ j,k j) := by + simp [thermalWeight,Finset.prod_mul_distrib,Finset.prod_pow_eq_pow_sum] + +theorem thermalWeight_up {n : ℕ} (r : ℝ) (j : Fin n) (k : Fin n → ℕ) : + thermalWeight n r (Annihilation.up j k)=r/(r+1)*thermalWeight n r k := by + have hs : (∑ i,Annihilation.up j k i)=(∑ i,k i)+1 := by + simp [Annihilation.up,Finset.sum_add_distrib] + rw [thermalWeight_number,thermalWeight_number,hs,pow_succ] + ring + +theorem thermalWeight_balance {n : ℕ} (r : ℝ) (hr : 0 ‖x i‖^2)) + (he : ∀ k l, entry (CrossEnsemble.operator (baseFamily x) (baseFamily x)) k l= + if k=l then (thermalWeight n r k:ℂ) else 0) (B : Fock n →L[ℂ] Fock n) : + WeightedGenerator.pairing r x B=0 := + weighted_pairing_zero_of_geometric_diagonal r (thermalWeight n r) + (thermalWeight_balance r hr) x hx he B +end + +open EntropyPhotonNumber QuantumTrace Annihilation BeamLadder +open scoped BigOperators ComplexConjugate +variable {n : ℕ} {I J K : Type*} + +theorem dissipator_affine (c d : ℂ) (x : I → Fock n) (y : J → Fock n) (z : K → Fock n) + (hx : Summable (fun i => ‖x i‖^2)) (hy : Summable (fun j => ‖y j‖^2)) + (hz : Summable (fun k => ‖z k‖^2)) + (he : CrossEnsemble.operator (baseFamily z) (baseFamily z)= + c • CrossEnsemble.operator (baseFamily x) (baseFamily x)+ + d • CrossEnsemble.operator (baseFamily y) (baseFamily y)) + (j : Fin n) (u : Bool) : dissipator j u z=c • dissipator j u x+d • dissipator j u y := by + have he' (k l : NumberIndex n) : + entry (CrossEnsemble.operator (baseFamily z) (baseFamily z)) k l= + c*entry (CrossEnsemble.operator (baseFamily x) (baseFamily x)) k l+ + d*entry (CrossEnsemble.operator (baseFamily y) (baseFamily y)) k l := by + rw [he] + simp only [entry,add_apply,smul_apply,inner_add_right,inner_smul_right] + apply entry_ext + intro k l + have hs : entry (c • dissipator j u x+d • dissipator j u y) k l= + c*entry (dissipator j u x) k l+d*entry (dissipator j u y) k l := by + simp only [entry,add_apply,smul_apply,inner_add_right,inner_smul_right] + rw [hs,dissipator_entry z hz,dissipator_entry x hx,dissipator_entry y hy] + simp only [he'] + cases u <;> simp only [Bool.false_eq_true,ite_false,ite_true] <;> ring + +theorem generator_affine (r : ℝ) (c d : ℂ) (x : I → Fock n) (y : J → Fock n) (z : K → Fock n) + (hx : Summable (fun i => ‖x i‖^2)) (hy : Summable (fun j => ‖y j‖^2)) + (hz : Summable (fun k => ‖z k‖^2)) + (he : CrossEnsemble.operator (baseFamily z) (baseFamily z)= + c • CrossEnsemble.operator (baseFamily x) (baseFamily x)+ + d • CrossEnsemble.operator (baseFamily y) (baseFamily y)) : + generator r z=c • generator r x+d • generator r y := by + unfold generator + simp only [dissipator_affine c d x y z hx hy hz he,smul_add,Finset.smul_sum,← Finset.sum_add_distrib] + apply Finset.sum_congr rfl + intro j _ + module + +theorem pairing_affine (r : ℝ) (c d : ℂ) (x : I → Fock n) (y : J → Fock n) (z : K → Fock n) + (hx : Summable (fun i => ‖x i‖^2)) (hy : Summable (fun j => ‖y j‖^2)) + (hz : Summable (fun k => ‖z k‖^2)) + (he : CrossEnsemble.operator (baseFamily z) (baseFamily z)= + c • CrossEnsemble.operator (baseFamily x) (baseFamily x)+ + d • CrossEnsemble.operator (baseFamily y) (baseFamily y)) (Z : Fock n →L[ℂ] Fock n) : + singleGeneratorPairing r z Z=c*singleGeneratorPairing r x Z+d*singleGeneratorPairing r y Z := by + let bas : HilbertBasis (NumberIndex n) ℂ (Fock n) := HilbertBasis.ofRepr (LinearIsometryEquiv.refl ℂ _) + apply (pairing_hasSum bas r z hz Z).unique + rw [generator_affine r c d x y z hx hy hz he] + simpa only [add_apply,smul_apply,map_add,map_smul,inner_add_right,inner_smul_right] using + ((pairing_hasSum bas r x hx Z).mul_left c).add ((pairing_hasSum bas r y hy Z).mul_left d) + +theorem weighted_pairing_affine (r : ℝ) (c d : ℂ) (x : I → Fock n) (y : J → Fock n) (z : K → Fock n) + (hx : Summable (fun i => ‖x i‖^2)) (hy : Summable (fun j => ‖y j‖^2)) + (hz : Summable (fun k => ‖z k‖^2)) + (he : CrossEnsemble.operator (baseFamily z) (baseFamily z)= + c • CrossEnsemble.operator (baseFamily x) (baseFamily x)+ + d • CrossEnsemble.operator (baseFamily y) (baseFamily y)) (B : Fock n →L[ℂ] Fock n) : + WeightedGenerator.pairing r z B=c*WeightedGenerator.pairing r x B+d*WeightedGenerator.pairing r y B := by + let bas : HilbertBasis (NumberIndex n) ℂ (Fock n) := HilbertBasis.ofRepr (LinearIsometryEquiv.refl ℂ _) + apply weighted_trace_ext bas (WeightedGenerator.generator r z) + (c • WeightedGenerator.generator r x+d • WeightedGenerator.generator r y) + (WeightedGenerator.pairing r z) (fun Z => c*WeightedGenerator.pairing r x Z+d*WeightedGenerator.pairing r y Z) + · exact fun Z => WeightedGenerator.pairing_hasSum bas r z hz Z + · intro Z + simpa only [add_apply,smul_apply,map_add,map_smul,inner_add_right,inner_smul_right] using + ((WeightedGenerator.pairing_hasSum bas r x hx Z).mul_left c).add + ((WeightedGenerator.pairing_hasSum bas r y hy Z).mul_left d) + · intro Z + simp only [weighted_pairing_physical] + exact pairing_affine r c d x y z hx hy hz he Z +end PhysicalGenerator + +namespace EntropyPhotonNumber +open QuantumTrace Annihilation BeamLadder + +structure WeightedColumns {n : ℕ} (ρ : State n) where + Index : Type + vector : Index → Fock n + summable : Summable (fun i => ‖vector i‖^2) + normalized : HasSum (fun i => ‖inverseWeight 3 (vector i)‖^2) 1 + density : TraceEnsemble.operator (fun i => inverseWeight 3 (vector i))=ρ.op + +namespace WeightedColumns +variable {n : ℕ} {ρ : State n} (X : WeightedColumns ρ) + +theorem base_density : + CrossEnsemble.operator (PhysicalGenerator.baseFamily X.vector) (PhysicalGenerator.baseFamily X.vector)=ρ.op := + X.density + +def slice (η : ℝ) (hη : η ∈ Set.Icc 0 1) (B : Fock n →L[ℂ] Fock n) : Fock n →L[ℂ] Fock n := + weightedConditional η hη (fun i => inverseWeight 1 (X.vector i)) B + +def sliceRight (η : ℝ) (hη : η ∈ Set.Icc 0 1) (B : Fock n →L[ℂ] Fock n) : Fock n →L[ℂ] Fock n := + weightedConditionalRight η hη (fun i => inverseWeight 1 (X.vector i)) B + +theorem thermal_pairing_zero (r : ℝ) (hr : 0 ‖x i‖^2)) + (Z : Fock n →L[ℂ] Fock n) : + HasSum (fun k => inner ℂ (b k) (Z (weakOperator r j x (b k)))) (singleWeak r j x Z) := by + have hi := CrossEnsemble.applied_summable hx (inverseWeight 3) + have hl := CrossEnsemble.applied_summable hx (sandwich 0 3 (by omega) j) + have hr := CrossEnsemble.applied_summable hx (creationSandwich 0 3 (by omega) j) + have hh := ((CrossEnsemble.pairing_trace b hi hl Z).mul_left (r+1:ℂ)).sub + ((CrossEnsemble.pairing_trace b hr hi Z).mul_left (r:ℂ)) + unfold weakOperator + simp only [smul_apply,sub_apply,map_sub,map_smul,inner_sub_right,inner_smul_right] + exact hh + +theorem weakOperator_entry (r : ℝ) (j : Fin n) (x : I → Fock n) + (hx : Summable (fun i => ‖x i‖^2)) (k l : NumberIndex n) : + entry (weakOperator r j x) k l= + (r+1:ℂ)*conj (lowerCoefficient j l)*entry (CrossEnsemble.operator (baseFamily x) (baseFamily x)) k (up j l)- + (r:ℂ)*raiseCoefficient j k*entry (CrossEnsemble.operator (baseFamily x) (baseFamily x)) (down j k) l := by + have hi := CrossEnsemble.applied_summable hx (inverseWeight 3) + have hl := CrossEnsemble.applied_summable hx (sandwich 0 3 (by omega) j) + have hr := CrossEnsemble.applied_summable hx (creationSandwich 0 3 (by omega) j) + have el := CrossEnsemble.entry_transform (baseFamily x) (lowerFamily j x) (baseFamily x) (baseFamily x) + hi hl hi hi k l k (up j l) 1 (lowerCoefficient j l) (by + intro i + simp only [baseFamily,lowerFamily,single_lower_third_apply,lowerCoefficient,map_mul,one_mul] + ring) + have er := CrossEnsemble.entry_transform (raiseFamily j x) (baseFamily x) (baseFamily x) (baseFamily x) + hr hi hi hi k l (down j k) l (raiseCoefficient j k) 1 (by + intro i + simp only [baseFamily,raiseFamily,single_raise_third_apply,raiseCoefficient,map_one,mul_one] + ring) + have ee : entry (weakOperator r j x) k l= + (r+1:ℂ)*entry (CrossEnsemble.operator (baseFamily x) (lowerFamily j x)) k l- + (r:ℂ)*entry (CrossEnsemble.operator (raiseFamily j x) (baseFamily x)) k l := by + simp only [entry,weakOperator,sub_apply,smul_apply,inner_sub_right,inner_smul_right] + rw [ee,el,er] + simp only [one_mul,map_one,mul_one] + ring + +theorem weakOperator_affine (r : ℝ) (j : Fin n) (c d : ℂ) + (x : I → Fock n) (y : J → Fock n) (z : K → Fock n) + (hx : Summable (fun i => ‖x i‖^2)) (hy : Summable (fun j => ‖y j‖^2)) + (hz : Summable (fun k => ‖z k‖^2)) + (he : CrossEnsemble.operator (baseFamily z) (baseFamily z)= + c • CrossEnsemble.operator (baseFamily x) (baseFamily x)+ + d • CrossEnsemble.operator (baseFamily y) (baseFamily y)) : + weakOperator r j z=c • weakOperator r j x+d • weakOperator r j y := by + apply entry_ext + intro k l + have e (T U : Fock n →L[ℂ] Fock n) (a b : NumberIndex n) : + entry (c • T+d • U) a b=c*entry T a b+d*entry U a b := by + simp only [entry,add_apply,smul_apply,inner_add_right,inner_smul_right] + rw [weakOperator_entry r j z hz,e,weakOperator_entry r j x hx,weakOperator_entry r j y hy,he] + rw [e,e] + ring + +theorem weak_pairing_affine (r : ℝ) (j : Fin n) (c d : ℂ) + (x : I → Fock n) (y : J → Fock n) (z : K → Fock n) + (hx : Summable (fun i => ‖x i‖^2)) (hy : Summable (fun j => ‖y j‖^2)) + (hz : Summable (fun k => ‖z k‖^2)) + (he : CrossEnsemble.operator (baseFamily z) (baseFamily z)= + c • CrossEnsemble.operator (baseFamily x) (baseFamily x)+ + d • CrossEnsemble.operator (baseFamily y) (baseFamily y)) (Z : Fock n →L[ℂ] Fock n) : + singleWeak r j z Z=c*singleWeak r j x Z+d*singleWeak r j y Z := by + let bas : HilbertBasis (NumberIndex n) ℂ (Fock n) := HilbertBasis.ofRepr (LinearIsometryEquiv.refl ℂ _) + apply (weak_pairing_hasSum bas r j z hz Z).unique + rw [weakOperator_affine r j c d x y z hx hy hz he] + simpa only [add_apply,smul_apply,map_add,map_smul,inner_add_right,inner_smul_right] using + ((weak_pairing_hasSum bas r j x hx Z).mul_left c).add ((weak_pairing_hasSum bas r j y hy Z).mul_left d) + +theorem weakOperator_zero_of_geometric_diagonal (r : ℝ) (p : NumberIndex n → ℝ) + (hb : ∀ j k, (r+1:ℂ)*(p (up j k):ℂ)=(r:ℂ)*(p k:ℂ)) + (x : I → Fock n) (hx : Summable (fun i => ‖x i‖^2)) + (he : ∀ k l, entry (CrossEnsemble.operator (baseFamily x) (baseFamily x)) k l= + if k=l then (p k:ℂ) else 0) (j : Fin n) : weakOperator r j x=0 := by + apply entry_ext + intro k l + rw [weakOperator_entry r j x hx,he,he] + simp only [entry, zero_apply, inner_zero_right] + by_cases hk : k=up j l + · subst k + have hc : raiseCoefficient j (up j l)=conj (lowerCoefficient j l) := by + simp [raiseCoefficient, lowerCoefficient, up_same] + rw [ite_eq_left rfl,down_up,ite_eq_left rfl,hc] + calc + _ = conj (lowerCoefficient j l)*((r+1:ℂ)*(p (up j l):ℂ)-(r:ℂ)*(p l:ℂ)) := by ring + _ = 0 := by rw [hb]; ring + · rw [ite_eq_right hk,mul_zero,zero_sub] + by_cases hz : k j=0 + · simp [raiseCoefficient,hz] + · have hd : down j k≠l := by + intro h + apply hk + rw [← h,up_down j k (Nat.pos_of_ne_zero hz)] + rw [ite_eq_right hd,mul_zero,neg_zero] + +theorem weak_thermal_pairing_zero (r : ℝ) (hr : 0 ‖x i‖^2)) + (he : ∀ k l, entry (CrossEnsemble.operator (baseFamily x) (baseFamily x)) k l= + if k=l then (thermalWeight n r k:ℂ) else 0) (j : Fin n) (Z : Fock n →L[ℂ] Fock n) : + singleWeak r j x Z=0 := by + let bas : HilbertBasis (NumberIndex n) ℂ (Fock n) := HilbertBasis.ofRepr (LinearIsometryEquiv.refl ℂ _) + have hh := weak_pairing_hasSum bas r j x hx Z + have he0 := weakOperator_zero_of_geometric_diagonal r (thermalWeight n r) (fun j k => by simpa only [Complex.ofReal_add, Complex.ofReal_one] using thermalWeight_balance r hr j k) x hx he j + have hzero : HasSum (fun _ : NumberIndex n => (0:ℂ)) 0 := hasSum_zero + have hz : HasSum (fun _ : NumberIndex n => (0:ℂ)) (singleWeak r j x Z) := by + simpa only [he0,zero_apply,map_zero,inner_zero_right] using hh + exact hz.unique hzero +end PhysicalGenerator + +namespace EntropyPhotonNumber +open QuantumTrace Annihilation BeamLadder TensorLp +namespace WeightedColumns +variable {n : ℕ} {ρ : State n} (X : WeightedColumns ρ) + +def rawSlice (η : ℝ) (hη : η ∈ Set.Icc 0 1) (Z : Fock n →L[ℂ] Fock n) : Fock n →L[ℂ] Fock n := + conditionalLeft (fun i => inverseWeight 3 (X.vector i)) X.normalized (conjugate η hη Z) + +def rawSliceRight (η : ℝ) (hη : η ∈ Set.Icc 0 1) (Z : Fock n →L[ℂ] Fock n) : Fock n →L[ℂ] Fock n := + conditionalRight (fun i => inverseWeight 3 (X.vector i)) X.normalized (conjugate η hη Z) + +theorem thermal_weak_zero (r : ℝ) (hr : 0 ‖V i x‖^2) (‖x‖^2)) : + dual V hV (1 : H →L[ℂ] H)=1 := by + apply ContinuousLinearMap.coe_injective + apply (ext_inner_map _ _).mp + intro x + have hh := dual_entry V hV 1 x x + have hs : HasSum (fun i => inner ℂ (V i x) (V i x)) (inner ℂ x x) := by + convert! (hV x).mapL Complex.ofRealCLM using 1 <;> + simp only [inner_self_eq_norm_sq_to_K,Complex.ofReal_pow,Complex.ofRealCLM_apply] + all_goals rfl + have he : inner ℂ x (dual V hV 1 x)=inner ℂ x x := hh.unique (by simpa only [one_apply_eq_self] using hs) + simpa only [inner_conj_symm,ContinuousLinearMap.coe_coe,one_apply_eq_self] using + congrArg (starRingEnd ℂ) he +end KrausBounded + +namespace BeamLadder +open EntropyPhotonNumber QuantumTrace Annihilation TensorLp +variable {n : ℕ} +theorem conjugate_one (η : ℝ) (hη : η ∈ Set.Icc 0 1) : + conjugate (n:=n) η hη 1=1 := by + apply ContinuousLinearMap.ext + intro x + simp only [conjugate,liftLeft_one,ContinuousLinearMap.comp_apply,one_apply_eq_self] + change (beamUnitary η hη).symm (beamUnitary η hη x)=x + exact (beamUnitary η hη).symm_apply_apply x +end BeamLadder + +namespace EntropyPhotonNumber +open QuantumTrace Annihilation BeamLadder TensorLp +namespace WeightedColumns +variable {n : ℕ} {ρ : State n} (X : WeightedColumns ρ) + +def expectation (Z : Fock n →L[ℂ] Fock n) : ℂ := + CrossEnsemble.pairing (fun i => inverseWeight 3 (X.vector i)) + (fun i => inverseWeight 3 (X.vector i)) Z + +def weakMean (r : ℝ) (j : Fin n) : ℂ := singleWeak r j X.vector 1 + +def centeredWeak (r : ℝ) (j : Fin n) (Z : Fock n →L[ℂ] Fock n) : ℂ := + singleWeak r j X.vector Z-X.weakMean r j*X.expectation Z + +theorem expectation_one : X.expectation 1=1 := by + have hh := X.normalized.mapL Complex.ofRealCLM + unfold expectation CrossEnsemble.pairing + have hs : HasSum (fun i => inner ℂ (inverseWeight 3 (X.vector i)) + ((1 : Fock n →L[ℂ] Fock n) (inverseWeight 3 (X.vector i)))) (1:ℂ) := by + convert! hh using 1 + ext i + simp only [one_apply_eq_self,inner_self_eq_norm_sq_to_K,Complex.ofRealCLM_apply,Complex.ofReal_pow] + rfl + exact hs.tsum_eq + +theorem centeredWeak_one (r : ℝ) (j : Fin n) : X.centeredWeak r j 1=0 := by + simp only [centeredWeak,weakMean,X.expectation_one,mul_one,sub_self] + +theorem rawSlice_one (η : ℝ) (hη : η ∈ Set.Icc 0 1) : X.rawSlice η hη 1=1 := by + simp only [rawSlice,conjugate_one,conditionalLeft,KrausBounded.dual_one] + +theorem rawSliceRight_one (η : ℝ) (hη : η ∈ Set.Icc 0 1) : X.rawSliceRight η hη 1=1 := by + simp only [rawSliceRight,conjugate_one,conditionalRight,KrausBounded.dual_one] + +theorem expectation_affine {σ τ : State n} (Y : WeightedColumns σ) (Z : WeightedColumns τ) + (c d : ℂ) (he : τ.op=c • ρ.op+d • σ.op) (A : Fock n →L[ℂ] Fock n) : + Z.expectation A=c*X.expectation A+d*Y.expectation A := by + let bas : HilbertBasis (NumberIndex n) ℂ (Fock n) := HilbertBasis.ofRepr (LinearIsometryEquiv.refl ℂ _) + have hx := CrossEnsemble.pairing_trace bas X.normalized.summable X.normalized.summable A + have hy := CrossEnsemble.pairing_trace bas Y.normalized.summable Y.normalized.summable A + have hz := CrossEnsemble.pairing_trace bas Z.normalized.summable Z.normalized.summable A + change HasSum (fun k => inner ℂ (bas k) (A (TraceEnsemble.operator + (fun i => inverseWeight 3 (X.vector i)) (bas k)))) (X.expectation A) at hx + rw [X.density] at hx + change HasSum (fun k => inner ℂ (bas k) (A (TraceEnsemble.operator + (fun i => inverseWeight 3 (Y.vector i)) (bas k)))) (Y.expectation A) at hy + rw [Y.density] at hy + change HasSum (fun k => inner ℂ (bas k) (A (TraceEnsemble.operator + (fun i => inverseWeight 3 (Z.vector i)) (bas k)))) (Z.expectation A) at hz + rw [Z.density] at hz + exact hz.unique (by + simpa only [he,add_apply,smul_apply,map_add,map_smul,inner_add_right,inner_smul_right] using + (hx.mul_left c).add (hy.mul_left d)) +end WeightedColumns + +theorem physical_rawSlice_expectation {n : ℕ} (η : ℝ) (hη : η ∈ Set.Icc 0 1) + (ρ σ τ : State n) (hτ : IsBeamSplitterOutput η ρ σ τ) + (X : WeightedColumns ρ) (Y : WeightedColumns σ) (T : WeightedColumns τ) + (Z : Fock n →L[ℂ] Fock n) : + X.expectation (Y.rawSlice η hη Z)=T.expectation Z ∧ + Y.expectation (X.rawSliceRight η hη Z)=T.expectation Z := by + let v := fun i => inverseWeight 3 (X.vector i) + let w := fun j => inverseWeight 3 (Y.vector j) + let U := fun ij : X.Index × Y.Index => beamUnitary η hη (tensor (v ij.1) (w ij.2)) + have hu : Summable (fun ij => ‖U ij‖^2) := by + simpa only [U,LinearIsometryEquiv.norm_map] using + tensorFamily_summable v w X.normalized.summable Y.normalized.summable + have hd := physical_ensemble_output η hη ρ σ τ hτ v w X.normalized Y.normalized X.density Y.density + have hs := slice_family_summable U hu + have he : CrossEnsemble.operator (fun ie : (X.Index × Y.Index) × NumberIndex n => slice (U ie.1) ie.2) + (fun ie : (X.Index × Y.Index) × NumberIndex n => slice (U ie.1) ie.2)= + CrossEnsemble.operator (fun i => inverseWeight 3 (T.vector i)) (fun i => inverseWeight 3 (T.vector i)) := by + rw [cross_slice_eq_partialTrace] + change partialTrace U=TraceEnsemble.operator _ + rw [T.density] + exact hd + let bas : HilbertBasis (NumberIndex n) ℂ (Fock n) := HilbertBasis.ofRepr (LinearIsometryEquiv.refl ℂ _) + have hp := CrossEnsemble.pairing_eq_of_operator_eq bas hs hs T.normalized.summable T.normalized.summable he Z + have hpair : CrossEnsemble.pairing (fun ij : X.Index × Y.Index => tensor (v ij.1) (w ij.2)) + (fun ij : X.Index × Y.Index => tensor (v ij.1) (w ij.2)) (conjugate η hη Z)=T.expectation Z := by + calc + _ = CrossEnsemble.pairing U U (liftLeft Z) := by + unfold CrossEnsemble.pairing + congr 1 + funext ij + exact conjugate_inner η hη Z _ _ + _ = _ := (pairing_liftLeft U U hu hu Z).trans hp + constructor + · rw [← hpair] + exact (pairing_conditionalLeft v v w X.normalized.summable X.normalized.summable Y.normalized + (conjugate η hη Z)).symm + · rw [← hpair] + exact (pairing_conditionalRight v w w X.normalized Y.normalized.summable Y.normalized.summable + (conjugate η hη Z)).symm + +theorem replaced_threeport_centered_weak + {n : ℕ} (η θ κ a b d : ℝ) (hη : η ∈ Set.Icc 0 1) (hθ : θ ∈ Set.Icc 0 1) + (ρ σ τD m γ ω ρ0 : State n) + (h1 : IsBeamSplitterOutput η ρ σ m) (h2 : IsBeamSplitterOutput θ m τD γ) + (X : WeightedColumns ρ) (Y : WeightedColumns σ) (D : WeightedColumns τD) + (M : WeightedColumns m) (G : WeightedColumns γ) (O : WeightedColumns ω) (R : WeightedColumns ρ0) + (hd : 0.mpr + (lp.hasSum_inner (𝕜:=ℂ) (inverseWeight 3 x) (creationSandwich 0 3 (by omega) j y)) + apply HasSum.unique (lp.hasSum_inner (𝕜:=ℂ) (sandwich 0 3 (by omega) j x) (inverseWeight 3 y)) + convert! hh using 1 + ext k + simp only [Function.comp_def,RCLike.inner_apply,single_lower_third_apply, + single_raise_third_apply,up_same,down_up,Nat.add_eq_zero_iff,Nat.one_ne_zero,and_false, + ↓reduceIte,Nat.cast_add,Nat.cast_one,map_mul,Complex.conj_ofReal] + ring +end BeamLadder + +namespace EntropyPhotonNumber + +namespace WeightedColumns +open QuantumTrace Annihilation BeamLadder +variable {n : ℕ} {ρ : State n} (X : WeightedColumns ρ) + +theorem weakMean_trace (r : ℝ) (j : Fin n) : + X.weakMean r j=∑' i, inner ℂ (sandwich 0 3 (by omega) j (X.vector i)) + (inverseWeight 3 (X.vector i)) := by + have he : CrossEnsemble.pairing (fun i => creationSandwich 0 3 (by omega) j (X.vector i)) + (fun i => inverseWeight 3 (X.vector i)) 1= + CrossEnsemble.pairing (fun i => inverseWeight 3 (X.vector i)) + (fun i => sandwich 0 3 (by omega) j (X.vector i)) 1 := by + unfold CrossEnsemble.pairing + apply tsum_congr + intro i + simpa only [one_apply_eq_self] using (single_ladder_inner j (X.vector i) (X.vector i)).symm + unfold weakMean singleWeak + rw [he] + simp only [CrossEnsemble.pairing,one_apply_eq_self] + ring + +theorem weakMean_reference (a b : ℝ) (j : Fin n) : X.weakMean a j=X.weakMean b j := by + rw [X.weakMean_trace,X.weakMean_trace] +end WeightedColumns + +def MainObligation : Prop := + ∀ (n : ℕ), 1 ≤ n → ∀ (ρA ρB ρC : State n), + FiniteEnergy ρA → FiniteEnergy ρB → ∀ η : ℝ, η ∈ Set.Icc 0 1 → + IsBeamSplitterOutput η ρA ρB ρC → + η * gInv (entropy ρA / n) + (1 - η) * gInv (entropy ρB / n) ≤ + gInv (entropy ρC / n) + +end EntropyPhotonNumber + +end + +end OAI diff --git a/lean/OAI/InformationTheory/PhotonNumber/Gibbs.lean b/lean/OAI/InformationTheory/PhotonNumber/Gibbs.lean new file mode 100644 index 0000000000000000000000000000000000000000..5ff52273ee21db969534e4efe0e6ec60cb142604 --- /dev/null +++ b/lean/OAI/InformationTheory/PhotonNumber/Gibbs.lean @@ -0,0 +1,925 @@ +import OAI.MathematicalPhysics.Fock.Operators + +namespace OAI + +noncomputable section + +open scoped BigOperators ComplexConjugate ENNReal Topology +open MeasureTheory +open scoped ComplexConjugate +open scoped BigOperators ComplexConjugate + +namespace TraceEnsemble + +section +variable {E : Type*} [NormedAddCommGroup E] [InnerProductSpace ℂ E] [CompleteSpace E] +variable {I J : Type*} + +def positiveRoot (T : E →L[ℂ] E) : E →L[ℂ] E := CFC.sqrt T + +def operator (v : I → E) : E →L[ℂ] E := + ∑' i, InnerProductSpace.rankOne ℂ (v i) (v i) + +theorem summable_rankOne {v : I → E} (hv : Summable (fun i => ‖v i‖^2)) : + Summable (fun i => InnerProductSpace.rankOne ℂ (v i) (v i)) := by + apply Summable.of_norm + simpa only [InnerProductSpace.norm_rankOne, pow_two] using hv + +theorem hasSum_rankOne {v : I → E} (hv : Summable (fun i => ‖v i‖^2)) : + HasSum (fun i => InnerProductSpace.rankOne ℂ (v i) (v i)) (operator v) := + (summable_rankOne hv).hasSum + +theorem positive {v : I → E} (_hv : Summable (fun i => ‖v i‖^2)) : + (operator v).IsPositive := by + apply ContinuousLinearMap.nonneg_iff_isPositive.mp + exact tsum_nonneg (fun i => ContinuousLinearMap.nonneg_iff_isPositive.mpr + (InnerProductSpace.isPositive_rankOne_self (v i))) + +theorem hasSum_entry {v : I → E} (hv : Summable (fun i => ‖v i‖^2)) (x y : E) : + HasSum (fun i => inner ℂ x (v i) * inner ℂ (v i) y) + (inner ℂ x (operator v y)) := by + convert! ((hasSum_rankOne hv).mapL (ContinuousLinearMap.apply ℂ E y)).mapL (innerSL ℂ x) using 1 + ext i + simp [InnerProductSpace.rankOne_apply, mul_comm] + +theorem hasSum_quadratic {v : I → E} (hv : Summable (fun i => ‖v i‖^2)) (x : E) : + HasSum (fun i => ‖inner ℂ x (v i)‖^2) (inner ℂ x (operator v x)).re := by + convert! (hasSum_entry hv x x).mapL Complex.reCLM using 1 + ext i + rw [← inner_conj_symm (v i) x, Complex.mul_conj] + simp only [Complex.reCLM_apply, Complex.normSq_eq_norm_sq, Complex.ofReal_re] + +omit [CompleteSpace E] in +theorem basis_hasSum_norm_sq (b : HilbertBasis J ℂ E) (x : E) : + HasSum (fun j => ‖inner ℂ (b j) x‖^2) (‖x‖^2) := by + have h := (b.hasSum_inner_mul_inner x x).mapL Complex.reCLM + convert! h using 1 + · ext j + simp only [Complex.reCLM_apply] + conv_rhs => rw [← inner_conj_symm x (b j), Complex.conj_mul'] + simp [← Complex.ofReal_pow] + · simp [← Complex.ofReal_pow] + +theorem trace {v : I → E} {t : ℝ} (hv : HasSum (fun i => ‖v i‖^2) t) + (b : HilbertBasis J ℂ E) : + HasSum (fun j => (inner ℂ (b j) (operator v (b j))).re) t := by + have hparse (i : I) : (∑' j, ‖inner ℂ (b j) (v i)‖^2) = ‖v i‖^2 := + (basis_hasSum_norm_sq b (v i)).tsum_eq + have hd : Summable (fun a : I × J => ‖inner ℂ (b a.2) (v a.1)‖^2) := by + apply (summable_prod_of_nonneg (fun _ => sq_nonneg _)).mpr + refine ⟨fun i => (basis_hasSum_norm_sq b (v i)).summable, ?_⟩ + simpa only [hparse] using hv.summable + have he : (∑' j, ∑' i, ‖inner ℂ (b j) (v i)‖^2) = t := by + calc + _ = ∑' i, ∑' j, ‖inner ℂ (b j) (v i)‖^2 := + Summable.tsum_comm (f := fun i j => ‖inner ℂ (b j) (v i)‖^2) hd + _ = t := by simpa only [hparse] using hv.tsum_eq + have hquad (j : J) : (∑' i, ‖inner ℂ (b j) (v i)‖^2) = + (inner ℂ (b j) (operator v (b j))).re := (hasSum_quadratic hv.summable (b j)).tsum_eq + have hh : Summable (fun j => ∑' i, ‖inner ℂ (b j) (v i)‖^2) := hd.prod_symm.prod + exact he ▸ (by simpa only [hquad] using hh.hasSum) + +theorem operator_ext {v w : I → E} + (hv : Summable (fun i => ‖v i‖^2)) (hw : Summable (fun i => ‖w i‖^2)) + (h : ∀ x y, ∑' i, inner ℂ x (v i)*inner ℂ (v i) y = + ∑' i, inner ℂ x (w i)*inner ℂ (w i) y) : operator v = operator w := by + ext y + apply ext_inner_left ℂ + intro x + rw [← (hasSum_entry hv x y).tsum_eq, ← (hasSum_entry hw x y).tsum_eq] + exact h x y + +end + +variable {E : Type*} [NormedAddCommGroup E] [InnerProductSpace ℂ E] [CompleteSpace E] +variable {I J : Type*} + +omit [CompleteSpace E] in +theorem summable_entry_norm {v : I → E} (hv : Summable (fun i => ‖v i‖^2)) (x y : E) : + Summable (fun i => ‖inner ℂ x (v i)*inner ℂ (v i) y‖) := by + apply Summable.of_nonneg_of_le (fun _ => norm_nonneg _) _ (hv.mul_left (‖x‖*‖y‖)) + intro i + calc + _ = ‖inner ℂ x (v i)‖*‖inner ℂ (v i) y‖ := norm_mul _ _ + _ ≤ (‖x‖*‖v i‖)*(‖v i‖*‖y‖) := + mul_le_mul (norm_inner_le_norm _ _) (norm_inner_le_norm _ _) (norm_nonneg _) (by positivity) + _ = (‖x‖*‖y‖)*‖v i‖^2 := by ring + +theorem sqrt_quadratic {T : E →L[ℂ] E} (hp : T.IsPositive) (x : E) : + (inner ℂ x (T x)).re = ‖positiveRoot T x‖^2 := by + change (inner ℂ x (T x)).re = ‖CFC.sqrt T x‖^2 + have hn : 0 ≤ T := ContinuousLinearMap.nonneg_iff_isPositive.mpr hp + have hs (x y : E) : inner ℂ (CFC.sqrt T x) y = inner ℂ x (CFC.sqrt T y) := + (ContinuousLinearMap.nonneg_iff_isPositive.mp (CFC.sqrt_nonneg T)).isSymmetric x y + have he : CFC.sqrt T (CFC.sqrt T x) = T x := by + simpa [pow_two] using congrArg (fun A : E →L[ℂ] E => A x) (CFC.sq_sqrt T hn) + rw [← he, ← hs] + simp [← Complex.ofReal_pow] + +theorem sqrt_ensemble (b : HilbertBasis I ℂ E) {T : E →L[ℂ] E} + (hp : T.IsPositive) (ht : Summable (fun i => (inner ℂ (b i) (T (b i))).re)) : + operator (fun i => positiveRoot T (b i)) = T := by + have hv : Summable (fun i => ‖CFC.sqrt T (b i)‖^2) := by + simpa only [sqrt_quadratic hp, positiveRoot] using ht + have hn : 0 ≤ T := ContinuousLinearMap.nonneg_iff_isPositive.mpr hp + have hs (x y : E) : inner ℂ (CFC.sqrt T x) y = inner ℂ x (CFC.sqrt T y) := + (ContinuousLinearMap.nonneg_iff_isPositive.mp (CFC.sqrt_nonneg T)).isSymmetric x y + ext y + apply ext_inner_left ℂ + intro x + have he : inner ℂ (CFC.sqrt T x) (CFC.sqrt T y) = inner ℂ x (T y) := by + rw [hs] + congr 1 + simpa [pow_two] using congrArg (fun A : E →L[ℂ] E => A y) (CFC.sq_sqrt T hn) + have hh := b.hasSum_inner_mul_inner (CFC.sqrt T x) (CFC.sqrt T y) + have hrow (i : I) : inner ℂ x (CFC.sqrt T (b i)) * inner ℂ (CFC.sqrt T (b i)) y = + inner ℂ (CFC.sqrt T x) (b i) * inner ℂ (b i) (CFC.sqrt T y) := by + rw [hs, hs] + exact (hasSum_entry hv x y).unique (by simpa only [← hrow, he] using hh) + +omit [CompleteSpace E] in + +theorem summable_expectation_norm {v : I → E} (hv : Summable (fun i => ‖v i‖^2)) + (Z : E →L[ℂ] E) : Summable (fun i => ‖inner ℂ (v i) (Z (v i))‖) := by + apply Summable.of_nonneg_of_le (fun _ => norm_nonneg _) _ (hv.mul_left ‖Z‖) + intro i + calc + _ ≤ ‖v i‖*‖Z (v i)‖ := norm_inner_le_norm _ _ + _ ≤ ‖v i‖*(‖Z‖*‖v i‖) := mul_le_mul_of_nonneg_left (Z.le_opNorm _) (norm_nonneg _) + _ = ‖Z‖*‖v i‖^2 := by ring + +end TraceEnsemble + +namespace EntropyPhotonNumber + +def channelNumberBasis (n : ℕ) : HilbertBasis (NumberIndex n) ℂ (Fock n) := + HilbertBasis.ofRepr (LinearIsometryEquiv.refl ℂ _) + +@[simp] theorem channelNumberBasis_apply {n : ℕ} (a : NumberIndex n) : + channelNumberBasis n a = numberKet a := by + exact ((channelNumberBasis n).repr_symm_single a).symm + +def rootColumn {n : ℕ} (ρ : State n) (a : NumberIndex n) : Fock n := + TraceEnsemble.positiveRoot ρ.op (numberKet a) + +theorem rootColumn_norm {n : ℕ} (ρ : State n) : + HasSum (fun a => ‖rootColumn ρ a‖^2) 1 := by + have h := ρ.trace_one + simp only [entry, TraceEnsemble.sqrt_quadratic ρ.positive] at h + exact h + +theorem rootColumn_operator {n : ℕ} (ρ : State n) : + TraceEnsemble.operator (rootColumn ρ) = ρ.op := by + have ht : Summable (fun a => (inner ℂ (channelNumberBasis n a) + (ρ.op (channelNumberBasis n a))).re) := by + simpa only [channelNumberBasis_apply, entry] using ρ.trace_one.summable + have h := TraceEnsemble.sqrt_ensemble (T := ρ.op) (channelNumberBasis n) ρ.positive ht + simp only [channelNumberBasis_apply] at h + convert! h using 1 + +def numberMoment {n : ℕ} (m : ℕ) (ρ : State n) : ℝ := + ∑' k, (1+(totalNumber k : ℝ))^m * (entry ρ.op k k).re + +def FiniteMoment {n : ℕ} (m : ℕ) (ρ : State n) : Prop := + Summable (fun k => (1+(totalNumber k : ℝ))^m * (entry ρ.op k k).re) + +end EntropyPhotonNumber + +namespace WeightedShift +open scoped BigOperators ComplexConjugate +variable {I K : Type*} [DecidableEq K] + +theorem weighted_entries_summable (w : K → ℝ) (v : I → H K) + (hv : Summable (fun i => ‖v i‖^2)) + (hm : Summable (fun k => w k^2 * (inner ℂ (lp.single 2 k 1) + (TraceEnsemble.operator v (lp.single 2 k 1))).re)) : + Summable (fun z : I × K => ‖((w z.2 : ℂ)*v z.1 z.2)‖^2) := by + have hr (k : K) : HasSum (fun i => w k^2*‖v i k‖^2) + (w k^2 * (inner ℂ (lp.single 2 k 1) + (TraceEnsemble.operator v (lp.single 2 k 1))).re) := by + have hh := (TraceEnsemble.hasSum_quadratic hv (lp.single 2 k 1)).mul_left (w k^2) + simpa only [lp.inner_single_left, RCLike.inner_apply, map_one, mul_one] using hh + have hs : Summable (fun z : K × I => w z.1^2*‖v z.2 z.1‖^2) := + (summable_prod_of_nonneg (fun _ => mul_nonneg (sq_nonneg _) (sq_nonneg _))).mpr + ⟨fun k => (hr k).summable, hm.congr (fun k => (hr k).tsum_eq.symm)⟩ + convert! hs.prod_symm using 1 + funext z + rw [norm_mul, mul_pow, Complex.norm_real, Real.norm_eq_abs, sq_abs] + rfl + +def weightedFamily (w : K → ℝ) (v : I → H K) + (hs : Summable (fun z : I × K => ‖((w z.2 : ℂ)*v z.1 z.2)‖^2)) (i : I) : H K := + ⟨fun k => (w k : ℂ)*v i k, + (memℓp_gen_iff (by norm_num : 0 < (2 : ENNReal).toReal)).mpr (by + simpa only [ENNReal.toReal_ofNat, Real.rpow_two] using + ((summable_prod_of_nonneg (fun z : I × K => sq_nonneg + ‖((w z.2 : ℂ)*v z.1 z.2)‖)).mp hs).1 i)⟩ + +omit [DecidableEq K] in +@[simp] theorem weightedFamily_apply (w : K → ℝ) (v : I → H K) + (hs : Summable (fun z : I × K => ‖((w z.2 : ℂ)*v z.1 z.2)‖^2)) (i : I) (k : K) : + weightedFamily w v hs i k=(w k:ℂ)*v i k := rfl + +omit [DecidableEq K] in +theorem weightedFamily_summable (w : K → ℝ) (v : I → H K) + (hs : Summable (fun z : I × K => ‖((w z.2 : ℂ)*v z.1 z.2)‖^2)) : + Summable (fun i => ‖weightedFamily w v hs i‖^2) := by + have ht := ((summable_prod_of_nonneg (fun z : I × K => sq_nonneg + ‖((w z.2 : ℂ)*v z.1 z.2)‖)).mp hs).2 + apply ht.congr + intro i + exact (hasSum_square (weightedFamily w v hs i)).tsum_eq +end WeightedShift + +namespace EntropyPhotonNumber +open QuantumTrace WeightedShift Annihilation +variable {n : ℕ} + +theorem root_weighted_entries (m : ℕ) (ρ : State n) (hm : FiniteMoment (2*m) ρ) : + Summable (fun z : NumberIndex n × NumberIndex n => + ‖((numberWeight z.2^m : ℝ):ℂ)*rootColumn ρ z.1 z.2‖^2) := by + apply weighted_entries_summable (fun k => numberWeight k^m) (rootColumn ρ) + (rootColumn_norm ρ).summable + simpa only [rootColumn_operator, ← pow_mul, mul_comm m 2, numberWeight, + totalNumber, Nat.cast_sum, entry, numberKet, FiniteMoment] using hm + +def weightedRoot (m : ℕ) (ρ : State n) (hm : FiniteMoment (2*m) ρ) : + NumberIndex n → Fock n := + weightedFamily (fun k => numberWeight k^m) (rootColumn ρ) (root_weighted_entries m ρ hm) + +@[simp] theorem weightedRoot_apply (m : ℕ) (ρ : State n) (hm : FiniteMoment (2*m) ρ) + (i k : NumberIndex n) : weightedRoot m ρ hm i k=((numberWeight k^m:ℝ):ℂ)*rootColumn ρ i k := rfl + +theorem weightedRoot_summable (m : ℕ) (ρ : State n) (hm : FiniteMoment (2*m) ρ) : + Summable (fun i => ‖weightedRoot m ρ hm i‖^2) := + weightedFamily_summable _ _ _ + +theorem inverse_weightedRoot (m : ℕ) (ρ : State n) (hm : FiniteMoment (2*m) ρ) + (i : NumberIndex n) : inverseWeight m (weightedRoot m ρ hm i)=rootColumn ρ i := by + apply lp.ext + funext k + simp only [inverseWeight_apply, weightedRoot_apply, Complex.ofReal_pow] + have hw : (numberWeight k:ℂ) ≠ 0 := by + exact_mod_cast (show numberWeight k ≠ 0 by linarith [numberWeight_one_le k]) + field_simp +end EntropyPhotonNumber + +namespace Annihilation +open EntropyPhotonNumber QuantumTrace +open scoped ComplexConjugate +variable {n : ℕ} + +theorem inner_inverse_pair (a b : ℕ) (x y : Fock n) : + inner ℂ (inverseWeight a x) (inverseWeight b y)=inner ℂ x (inverseWeight (a+b) y) := by + rw [inverseWeight_add, ContinuousLinearMap.comp_apply] + exact ContinuousLinearMap.isSelfAdjoint_iff_isSymmetric.mp (inverseWeight_selfAdjoint a) x (inverseWeight b y) + +theorem gain_trace (j : Fin n) (u : Bool) (x : Fock n) : + inner ℂ (gain j u x) (inverseWeight 4 (gain j u x))= + (‖unweightedGain j u (inverseWeight 2 x)‖^2:ℝ) := by + have he : inverseWeight 2 (gain j u x)=unweightedGain j u (inverseWeight 2 x) := + congrArg (fun T : Fock n →L[ℂ] Fock n => T x) (gain_factor j u) + rw [← inner_inverse_pair 2 2, he] + rw [inner_self_eq_norm_sq_to_K] + exact (map_pow Complex.ofRealHom _ 2).symm + +theorem mode_trace_left (j : Fin n) (u : Bool) (x : Fock n) : + inner ℂ (inverseWeight 1 x) (inverseWeight 4 (modeBound j u x))= + (‖unweightedGain j u (inverseWeight 2 x)‖^2:ℝ) := by + calc + _ = inner ℂ (inverseWeight 3 x) (inverseWeight 2 (modeBound j u x)) := by + rw [inner_inverse_pair, inner_inverse_pair] + _ = _ := mode_quadratic j u x + +theorem mode_trace_right (j : Fin n) (u : Bool) (x : Fock n) : + inner ℂ (modeBound j u x) (inverseWeight 4 (inverseWeight 1 x))= + (‖unweightedGain j u (inverseWeight 2 x)‖^2:ℝ) := by + have hh := congrArg (starRingEnd ℂ) (mode_trace_left j u x) + calc + _ = inner ℂ (inverseWeight 4 (modeBound j u x)) (inverseWeight 1 x) := + (ContinuousLinearMap.isSelfAdjoint_iff_isSymmetric.mp + (inverseWeight_selfAdjoint 4) (modeBound j u x) (inverseWeight 1 x)).symm + _ = _ := by simpa only [inner_conj_symm, Complex.conj_ofReal] using hh +end Annihilation + +namespace WeightedGenerator +open EntropyPhotonNumber Annihilation +open scoped BigOperators +variable {n : ℕ} {I J : Type*} + +theorem pairing_inverse_zero (r : ℝ) (x : I → Fock n) : pairing r x (inverseWeight 4)=0 := by + unfold pairing CrossEnsemble.pairing + simp only [gain_trace, mode_trace_left, mode_trace_right] + apply Finset.sum_eq_zero + intro j _hj + ring + +theorem trace_zero (b : HilbertBasis J ℂ (Fock n)) (r : ℝ) (x : I → Fock n) + (hx : Summable (fun i => ‖x i‖^2)) : + HasSum (fun k => inner ℂ (b k) (inverseWeight 4 (generator r x (b k)))) 0 := by + simpa only [pairing_inverse_zero] using pairing_hasSum b r x hx (inverseWeight 4) +end WeightedGenerator + +namespace CrossEnsemble +open scoped ComplexConjugate +variable {I J E : Type*} [NormedAddCommGroup E] [InnerProductSpace ℂ E] [CompleteSpace E] + +theorem pairing_trace_sandwich (b : HilbertBasis J ℂ E) {u v : I → E} + (hu : Summable (fun i => ‖u i‖^2)) (hv : Summable (fun i => ‖v i‖^2)) + (A Z : E →L[ℂ] E) : + HasSum (fun k => inner ℂ (b k) (Z ((A ∘L operator u v ∘L A.adjoint) (b k)))) + (pairing u v (A.adjoint ∘L Z ∘L A)) := by + rw [operator_sandwich hu hv A] + have hh := pairing_trace b (applied_summable hu A) (applied_summable hv A) Z + convert hh using 1 + unfold pairing + apply tsum_congr + intro i + simp only [ContinuousLinearMap.comp_apply, ContinuousLinearMap.adjoint_inner_right] +end CrossEnsemble + +namespace WeightedGenerator +open EntropyPhotonNumber Annihilation +open scoped BigOperators +variable {n : ℕ} {I J : Type*} + +theorem pairing_sandwich_hasSum (b : HilbertBasis J ℂ (Fock n)) (r : ℝ) + (x : I → Fock n) (hx : Summable (fun i => ‖x i‖^2)) (A Z : Fock n →L[ℂ] Fock n) : + HasSum (fun k => inner ℂ (b k) (Z ((A ∘L generator r x ∘L A.adjoint) (b k)))) + (pairing r x (A.adjoint ∘L Z ∘L A)) := by + have ha (j : Fin n) (u : Bool) := CrossEnsemble.applied_summable hx (gain j u) + have hb (j : Fin n) (u : Bool) := CrossEnsemble.applied_summable hx (modeBound j u) + have hc := CrossEnsemble.applied_summable hx (inverseWeight 1) + have h (j : Fin n) (u : Bool) := + (CrossEnsemble.pairing_trace_sandwich b (ha j u) (ha j u) A Z).sub + (((CrossEnsemble.pairing_trace_sandwich b (hb j u) hc A Z).add + (CrossEnsemble.pairing_trace_sandwich b hc (hb j u) A Z)).mul_left (2:ℂ)⁻¹) + have hh := hasSum_sum fun j (_hj : j ∈ (Finset.univ : Finset (Fin n))) => + ((h j false).mul_left ((r+1:ℝ):ℂ)).add ((h j true).mul_left (r:ℂ)) + convert! hh using 1 + ext k + simp only [generator, dissipator, ContinuousLinearMap.comp_apply, sum_apply, add_apply, + sub_apply, smul_apply, map_sum, map_add, map_sub, map_smul, + inner_sum, inner_sub_right, inner_add_right, inner_smul_right] +end WeightedGenerator + +namespace EntropyPhotonNumber +open QuantumTrace Annihilation +variable {n : ℕ} {J : Type*} + +def thermalGenerator (r : ℝ) (ρ : State n) (hm : FiniteMoment 6 ρ) : Fock n →L[ℂ] Fock n := + inverseWeight 2 ∘L WeightedGenerator.generator r (weightedRoot 3 ρ hm) ∘L inverseWeight 2 + +theorem thermalGenerator_pairing (b : HilbertBasis J ℂ (Fock n)) + (r : ℝ) (ρ : State n) (hm : FiniteMoment 6 ρ) (Z : Fock n →L[ℂ] Fock n) : + HasSum (fun k => inner ℂ (b k) (Z (thermalGenerator r ρ hm (b k)))) + (WeightedGenerator.pairing r (weightedRoot 3 ρ hm) (inverseWeight 2 ∘L Z ∘L inverseWeight 2)) := by + have hh := WeightedGenerator.pairing_sandwich_hasSum b r (weightedRoot 3 ρ hm) + (weightedRoot_summable 3 ρ hm) (inverseWeight 2) Z + have ha : (inverseWeight 2 : Fock n →L[ℂ] Fock n).adjoint=inverseWeight 2 := + inverseWeight_selfAdjoint 2 + simpa only [ha, thermalGenerator] using hh + +theorem thermalGenerator_traceless (b : HilbertBasis J ℂ (Fock n)) + (r : ℝ) (ρ : State n) (hm : FiniteMoment 6 ρ) : + HasSum (fun k => inner ℂ (b k) (thermalGenerator r ρ hm (b k))) 0 := by + have hh := thermalGenerator_pairing b r ρ hm (ContinuousLinearMap.id ℂ (Fock n)) + have hc : inverseWeight 2 ∘L ContinuousLinearMap.id ℂ (Fock n) ∘L inverseWeight 2 = inverseWeight 4 := by + simp only [ContinuousLinearMap.id_comp] + exact (inverseWeight_add 2 2).symm + simpa only [ContinuousLinearMap.id_apply, hc, WeightedGenerator.pairing_inverse_zero] using hh +end EntropyPhotonNumber + +namespace CrossEnsemble +open scoped ComplexConjugate +variable {I J E : Type*} [NormedAddCommGroup E] [InnerProductSpace ℂ E] [CompleteSpace E] + +theorem sandwich_injective (X : E →L[ℂ] E) (hX : IsSelfAdjoint X) + (hi : Function.Injective X) {A B : E →L[ℂ] E} + (h : X ∘L A ∘L X = X ∘L B ∘L X) : A = B := by + have hr : A ∘L X = B ∘L X := by + ext y + exact hi (congrArg (fun T : E →L[ℂ] E => T y) h) + have hl := congrArg ContinuousLinearMap.adjoint hr + simp only [ContinuousLinearMap.adjoint_comp, show X.adjoint=X from hX] at hl + have ha : A.adjoint=B.adjoint := by + ext y + exact hi (congrArg (fun T : E →L[ℂ] E => T y) hl) + simpa only [ContinuousLinearMap.adjoint_adjoint] using congrArg ContinuousLinearMap.adjoint ha + +theorem pairing_transform (x : I → E) (A B Z : E →L[ℂ] E) : + pairing (fun i => A (x i)) (fun i => B (x i)) Z = + pairing x x (B.adjoint ∘L Z ∘L A) := by + unfold pairing + apply tsum_congr + intro i + exact (ContinuousLinearMap.adjoint_inner_right B (x i) (Z (A (x i)))).symm + +theorem pairing_transform_eq (b : HilbertBasis J ℂ E) {K : Type*} + {x : I → E} {y : K → E} (hx : Summable (fun i => ‖x i‖^2)) + (hy : Summable (fun i => ‖y i‖^2)) (he : operator x x=operator y y) + (A B Z : E →L[ℂ] E) : + pairing (fun i => A (x i)) (fun i => B (x i)) Z = + pairing (fun i => A (y i)) (fun i => B (y i)) Z := by + rw [pairing_transform, pairing_transform] + exact pairing_eq_of_operator_eq b hx hx hy hy he _ + +def eigenEnsemble (b : HilbertBasis J ℂ E) (p : J → ℝ) (j : J) : E := + (Real.sqrt (p j) : ℂ) • b j + +omit [CompleteSpace E] in +theorem eigenEnsemble_norm (b : HilbertBasis J ℂ E) (p : J → ℝ) + (hp : ∀ j, 0 ≤ p j) (j : J) : ‖eigenEnsemble b p j‖^2=p j := by + simp only [eigenEnsemble, norm_smul, Complex.norm_real, Real.norm_eq_abs, + b.orthonormal.norm_eq_one j, mul_one, sq_abs, Real.sq_sqrt (hp j)] + +theorem eigenEnsemble_operator (b : HilbertBasis J ℂ E) (p : J → ℝ) + (hp : ∀ j, 0 ≤ p j) (hs : Summable p) (T : E →L[ℂ] E) (hT : T.IsSymmetric) + (he : ∀ j, T (b j)=(p j : ℂ) • b j) : + operator (eigenEnsemble b p) (eigenEnsemble b p)=T := by + have hn : Summable (fun j => ‖eigenEnsemble b p j‖^2) := by + simpa only [eigenEnsemble_norm b p hp] using hs + ext y + apply ext_inner_left ℂ + intro x + have hprod (j : J) : inner ℂ x (eigenEnsemble b p j)*inner ℂ (eigenEnsemble b p j) y = + inner ℂ x (b j)*inner ℂ (b j) (T y) := by + have hsym := hT (b j) y + change inner ℂ (T (b j)) y = inner ℂ (b j) (T y) at hsym + rw [← hsym, he] + simp only [eigenEnsemble, inner_smul_left, inner_smul_right, Complex.conj_ofReal] + calc + _ = ((Real.sqrt (p j) : ℂ)^2)*(inner ℂ x (b j)*inner ℂ (b j) y) := by ring + _ = _ := by rw [← Complex.ofReal_pow, Real.sq_sqrt (hp j)]; ring + exact (entry_hasSum hn hn x y).unique (by simpa only [hprod] using b.hasSum_inner_mul_inner x (T y)) +end CrossEnsemble + +namespace WeightedGenerator +open EntropyPhotonNumber Annihilation +variable {n : ℕ} {I J K : Type*} + +theorem pairing_eq_of_operator_eq (b : HilbertBasis K ℂ (Fock n)) + {x : I → Fock n} {y : J → Fock n} (hx : Summable (fun i => ‖x i‖^2)) + (hy : Summable (fun i => ‖y i‖^2)) + (he : CrossEnsemble.operator x x=CrossEnsemble.operator y y) + (r : ℝ) (Z : Fock n →L[ℂ] Fock n) : pairing r x Z=pairing r y Z := by + unfold pairing + congr 1 + funext j + simp only [CrossEnsemble.pairing_transform_eq b hx hy he] +end WeightedGenerator + +namespace EntropyPhotonNumber +open Annihilation CrossEnsemble +variable {n : ℕ} {J : Type*} + +theorem weightedRoot_operator_eq (ρ : State n) (hm : FiniteMoment 6 ρ) + (b : HilbertBasis J ℂ (Fock n)) (p : J → ℝ) (hp : ∀ j, 0 ≤ p j) + (hs : Summable p) (he : ∀ j, ρ.op (b j)=(p j : ℂ) • b j) + (x : J → Fock n) (hx : Summable (fun j => ‖x j‖^2)) + (hi : ∀ j, inverseWeight 3 (x j)=eigenEnsemble b p j) : + operator (weightedRoot 3 ρ hm) (weightedRoot 3 ρ hm)=operator x x := by + apply sandwich_injective (inverseWeight 3) (inverseWeight_selfAdjoint 3) (inverseWeight_injective 3) + have hleft := operator_sandwich (weightedRoot_summable 3 ρ hm) (weightedRoot_summable 3 ρ hm) (inverseWeight 3) + have hright := operator_sandwich hx hx (inverseWeight 3) + rw [show (inverseWeight 3 : Fock n →L[ℂ] Fock n).adjoint=inverseWeight 3 from inverseWeight_selfAdjoint 3] at hleft hright + rw [hleft, hright] + simp only [inverse_weightedRoot, hi] + change TraceEnsemble.operator (rootColumn ρ)=operator (eigenEnsemble b p) (eigenEnsemble b p) + rw [rootColumn_operator, eigenEnsemble_operator b p hp hs ρ.op ρ.positive.isSymmetric he] +end EntropyPhotonNumber + +namespace Annihilation +open EntropyPhotonNumber QuantumTrace +open scoped ComplexConjugate +variable {n : ℕ} + +theorem log_mode_left (S : Fock n →L[ℂ] Fock n) (hS : S.IsSymmetric) + (x : Fock n) (c : ℝ) + (he : S (inverseWeight 1 x) = (c : ℂ) • inverseWeight 5 x) + (j : Fin n) (u : Bool) : + inner ℂ (inverseWeight 1 x) (S (modeBound j u x)) = + ((c*‖unweightedGain j u (inverseWeight 2 x)‖^2 : ℝ) : ℂ) := by + have hsym := hS (inverseWeight 1 x) (modeBound j u x) + change inner ℂ (S (inverseWeight 1 x)) (modeBound j u x) = + inner ℂ (inverseWeight 1 x) (S (modeBound j u x)) at hsym + rw [← hsym, he, inner_smul_left, Complex.conj_ofReal, Complex.ofReal_mul] + congr 1 + calc + _ = inner ℂ (inverseWeight 3 x) (inverseWeight 2 (modeBound j u x)) := by + rw [show inverseWeight 5 x = inverseWeight 2 (inverseWeight 3 x) from + congrArg (fun T : Fock n →L[ℂ] Fock n => T x) (inverseWeight_add 2 3)] + exact ContinuousLinearMap.isSelfAdjoint_iff_isSymmetric.mp (inverseWeight_selfAdjoint 2) _ _ + _ = _ := mode_quadratic j u x + +theorem log_mode_right (S : Fock n →L[ℂ] Fock n) (hS : S.IsSymmetric) + (x : Fock n) (c : ℝ) + (he : S (inverseWeight 1 x) = (c : ℂ) • inverseWeight 5 x) + (j : Fin n) (u : Bool) : + inner ℂ (modeBound j u x) (S (inverseWeight 1 x)) = + ((c*‖unweightedGain j u (inverseWeight 2 x)‖^2 : ℝ) : ℂ) := by + have hs := hS (modeBound j u x) (inverseWeight 1 x) + change inner ℂ (S (modeBound j u x)) (inverseWeight 1 x) = + inner ℂ (modeBound j u x) (S (inverseWeight 1 x)) at hs + rw [← hs, ← inner_conj_symm, log_mode_left S hS x c he j u, Complex.conj_ofReal] +end Annihilation + +namespace WeightedGenerator +open EntropyPhotonNumber Annihilation +open scoped BigOperators ComplexConjugate +variable {n : ℕ} {J : Type*} + +def spectralGain (b : HilbertBasis J ℂ (Fock n)) (x : J → Fock n) + (j : Fin n) (u : Bool) (l r : J) : ℂ := + inner ℂ (b l) (unweightedGain j u (inverseWeight 2 (x r))) + +theorem crossed_log_summable (b : HilbertBasis J ℂ (Fock n)) + (x : J → Fock n) (hx : Summable (fun r => ‖x r‖^2)) + (S : Fock n →L[ℂ] Fock n) (c : J → ℝ) (hc : ∀ l, 0 ≤ c l) + (hf : ∀ y, HasSum (fun l => c l*‖inner ℂ (b l) (inverseWeight 2 y)‖^2) + (inner ℂ y (S y)).re) (j : Fin n) (u : Bool) : + Summable (fun a : J × J => c a.1*‖spectralGain b x j u a.1 a.2‖^2) := by + have hcol (r : J) : HasSum (fun l => c l*‖spectralGain b x j u l r‖^2) + (inner ℂ (gain j u (x r)) (S (gain j u (x r)))).re := by + have he := congrArg (fun T : Fock n →L[ℂ] Fock n => T (x r)) (gain_factor j u) + change inverseWeight 2 (gain j u (x r)) = unweightedGain j u (inverseWeight 2 (x r)) at he + simpa only [he, spectralGain] using hf (gain j u (x r)) + have ha := CrossEnsemble.applied_summable hx (gain j u) + have hs : Summable (fun r => (inner ℂ (gain j u (x r)) (S (gain j u (x r)))).re) := + ((CrossEnsemble.pairing_summable ha ha S).hasSum.mapL Complex.reCLM).summable + suffices hs : Summable (fun a : J × J => c a.2*‖spectralGain b x j u a.2 a.1‖^2) from hs.prod_symm + apply (summable_prod_of_nonneg (fun a : J × J => mul_nonneg (hc a.2) (sq_nonneg _))).mpr + refine ⟨fun r => (hcol r).summable, ?_⟩ + simpa only [(hcol _).tsum_eq] using hs + +theorem uncrossed_log_summable (b : HilbertBasis J ℂ (Fock n)) + (x : J → Fock n) (hx : Summable (fun r => ‖x r‖^2)) + (S : Fock n →L[ℂ] Fock n) (hS : S.IsSymmetric) (c : J → ℝ) + (hc : ∀ l, 0 ≤ c l) + (he : ∀ r, S (inverseWeight 1 (x r)) = (c r : ℂ) • inverseWeight 5 (x r)) + (j : Fin n) (u : Bool) : + Summable (fun a : J × J => c a.2*‖spectralGain b x j u a.1 a.2‖^2) := by + have hcol (r : J) : HasSum (fun l => c r*‖spectralGain b x j u l r‖^2) + (c r*‖unweightedGain j u (inverseWeight 2 (x r))‖^2) := by + exact (TraceEnsemble.basis_hasSum_norm_sq b _).mul_left _ + have ha := CrossEnsemble.applied_summable hx (modeBound j u) + have hv := CrossEnsemble.applied_summable hx (inverseWeight 1) + have hs := ((CrossEnsemble.pairing_summable ha hv S).hasSum.mapL Complex.reCLM).summable + simp only [Complex.reCLM_apply, log_mode_left S hS _ _ (he _) j u, Complex.ofReal_re] at hs + suffices hs : Summable (fun a : J × J => c a.1*‖spectralGain b x j u a.2 a.1‖^2) from hs.prod_symm + apply (summable_prod_of_nonneg (fun a : J × J => mul_nonneg (hc a.1) (sq_nonneg _))).mpr + refine ⟨fun r => (hcol r).summable, ?_⟩ + simpa only [(hcol _).tsum_eq] using hs + +theorem tsum_prod_columns {I K : Type*} (f : I × K → ℝ) (hs : Summable f) + (g : K → ℝ) (hc : ∀ k, HasSum (fun i => f (i,k)) (g k)) : + (∑' a, f a) = ∑' k, g k := by + rw [hs.tsum_prod, ← Summable.tsum_comm (f := fun i k => f (i,k)) hs] + exact tsum_congr (fun k => (hc k).tsum_eq) + +theorem dissipator_log_sum (b : HilbertBasis J ℂ (Fock n)) + (x : J → Fock n) (hx : Summable (fun r => ‖x r‖^2)) + (S : Fock n →L[ℂ] Fock n) (hS : S.IsSymmetric) (c : J → ℝ) + (hc : ∀ l, 0 ≤ c l) + (hf : ∀ y, HasSum (fun l => c l*‖inner ℂ (b l) (inverseWeight 2 y)‖^2) + (inner ℂ y (S y)).re) + (he : ∀ r, S (inverseWeight 1 (x r)) = (c r : ℂ) • inverseWeight 5 (x r)) + (j : Fin n) (u : Bool) : + (CrossEnsemble.pairing (fun r => gain j u (x r)) (fun r => gain j u (x r)) S- + (2:ℂ)⁻¹*(CrossEnsemble.pairing (fun r => modeBound j u (x r)) (fun r => inverseWeight 1 (x r)) S+ + CrossEnsemble.pairing (fun r => inverseWeight 1 (x r)) (fun r => modeBound j u (x r)) S)).re = + ∑' a : J × J, (c a.1-c a.2)*‖spectralGain b x j u a.1 a.2‖^2 := by + have hcross := crossed_log_summable b x hx S c hc hf j u + have huncross := uncrossed_log_summable b x hx S hS c hc he j u + have hg := CrossEnsemble.applied_summable hx (gain j u) + have hm := CrossEnsemble.applied_summable hx (modeBound j u) + have hv := CrossEnsemble.applied_summable hx (inverseWeight 1) + have hgcol (r : J) : HasSum (fun l => c l*‖spectralGain b x j u l r‖^2) + (inner ℂ (gain j u (x r)) (S (gain j u (x r)))).re := by + have hi := congrArg (fun T : Fock n →L[ℂ] Fock n => T (x r)) (gain_factor j u) + change inverseWeight 2 (gain j u (x r)) = unweightedGain j u (inverseWeight 2 (x r)) at hi + simpa only [hi, spectralGain] using hf (gain j u (x r)) + have hmcol (r : J) : HasSum (fun l => c r*‖spectralGain b x j u l r‖^2) + (c r*‖unweightedGain j u (inverseWeight 2 (x r))‖^2) := + (TraceEnsemble.basis_hasSum_norm_sq b _).mul_left _ + have hxval : (∑' a : J × J, c a.1*‖spectralGain b x j u a.1 a.2‖^2) = + (CrossEnsemble.pairing (fun r => gain j u (x r)) (fun r => gain j u (x r)) S).re := by + have ht := tsum_prod_columns (fun a : J × J => c a.1*‖spectralGain b x j u a.1 a.2‖^2) + hcross (fun r => (inner ℂ (gain j u (x r)) (S (gain j u (x r)))).re) hgcol + exact ht.trans (Complex.re_tsum (CrossEnsemble.pairing_summable hg hg S)).symm + have hmval : (∑' a : J × J, c a.2*‖spectralGain b x j u a.1 a.2‖^2) = + (CrossEnsemble.pairing (fun r => modeBound j u (x r)) (fun r => inverseWeight 1 (x r)) S).re := by + rw [tsum_prod_columns (fun a : J × J => c a.2*‖spectralGain b x j u a.1 a.2‖^2) + huncross (fun r => c r*‖unweightedGain j u (inverseWeight 2 (x r))‖^2) hmcol] + change (∑' r, c r*‖unweightedGain j u (inverseWeight 2 (x r))‖^2) = + (∑' r, inner ℂ (inverseWeight 1 (x r)) (S (modeBound j u (x r)))).re + rw [Complex.re_tsum (CrossEnsemble.pairing_summable hm hv S)] + apply tsum_congr + intro r + exact (congrArg Complex.re (log_mode_left S hS _ _ (he r) j u)).symm + have hequal : CrossEnsemble.pairing (fun r => inverseWeight 1 (x r)) (fun r => modeBound j u (x r)) S = + CrossEnsemble.pairing (fun r => modeBound j u (x r)) (fun r => inverseWeight 1 (x r)) S := by + unfold CrossEnsemble.pairing + apply tsum_congr + intro r + rw [log_mode_right S hS _ _ (he _) j u, log_mode_left S hS _ _ (he _) j u] + calc + _ = (CrossEnsemble.pairing (fun r => gain j u (x r)) (fun r => gain j u (x r)) S).re- + (CrossEnsemble.pairing (fun r => modeBound j u (x r)) (fun r => inverseWeight 1 (x r)) S).re := by + rw [hequal] + rw [show (2:ℂ)⁻¹ * (CrossEnsemble.pairing (fun r => modeBound j u (x r)) (fun r => inverseWeight 1 (x r)) S + CrossEnsemble.pairing (fun r => modeBound j u (x r)) (fun r => inverseWeight 1 (x r)) S) = CrossEnsemble.pairing (fun r => modeBound j u (x r)) (fun r => inverseWeight 1 (x r)) S by ring] + exact Complex.sub_re _ _ + _ = _ := by + rw [← hxval, ← hmval, ← hcross.tsum_sub huncross] + apply tsum_congr + intro a + ring +end WeightedGenerator + +namespace EntropyPhotonNumber +open QuantumTrace Annihilation + +structure GibbsData (n : ℕ) (k : ℝ) (ρ : State n) where + B : Fock n →L[ℂ] Fock n + positive : B.IsPositive + J : Type + nonempty : Nonempty J + basis : HilbertBasis J ℂ (Fock n) + eigenval : J → ℝ + positive_eigenval : ∀ j, 0 < eigenval j + heat : Summable (fun j => Real.exp (-eigenval j)) + inverse_eigen : ∀ j, gibbsInverse rootNumberWeight rootNumberWeight_one_le k B (basis j) = + (((eigenval j)⁻¹ : ℝ) : ℂ) • basis j + operator_eq : ρ.op = spectralGibbs basis eigenval heat + faithful : Function.Injective ρ.op + moment : FiniteMoment 7 ρ + +variable {n : ℕ} {k : ℝ} {ρ : State n} + +theorem inversePower_root_four : + inversePower (rootNumberWeight (n := n)) rootNumberWeight_one_le 4 = inverseWeight 2 := by + ext y i + simp only [inversePower_apply, rootNumberWeight_pow_four, inverseWeight_apply, + Complex.ofReal_inv, Complex.ofReal_pow] + +theorem finiteMoment_mono {m l : ℕ} (hml : m ≤ l) (hρ : FiniteMoment l ρ) : + FiniteMoment m ρ := by + apply Summable.of_nonneg_of_le (fun i => mul_nonneg (by positivity) (ρ.positive.re_inner_nonneg_right _)) _ hρ + intro i + apply mul_le_mul_of_nonneg_right _ (ρ.positive.re_inner_nonneg_right _) + exact pow_le_pow_right₀ (by linarith [Nat.cast_nonneg (α := ℝ) (totalNumber i)] : (1:ℝ) ≤ 1+↑(totalNumber i)) hml + +namespace GibbsData +variable (G : GibbsData n k ρ) + +def logSandwich : Fock n →L[ℂ] Fock n := + logarithmSandwich (gibbsFactor (rootNumberWeight (n := n)) rootNumberWeight_one_le k G.B) + (inverseWeight 2) (Real.log (heatPartition G.eigenval)) + +def probability (j : G.J) : ℝ := gibbsWeight G.eigenval j + +def logCoefficient (j : G.J) : ℝ := -Real.log (G.probability j) + +theorem probability_pos (j : G.J) : 0 < G.probability j := by + let : Nonempty G.J := G.nonempty + exact gibbsWeight_pos G.eigenval G.heat j + +theorem probability_sum : HasSum G.probability 1 := by + let : Nonempty G.J := G.nonempty + exact gibbsWeight_hasSum G.eigenval G.heat + +theorem logCoefficient_nonneg (j : G.J) : 0 ≤ G.logCoefficient j := by + apply neg_nonneg.mpr + apply Real.log_nonpos (G.probability_pos j).le + have hh := G.probability_sum.summable.le_tsum j (fun i _ => (G.probability_pos i).le) + rwa [G.probability_sum.tsum_eq] at hh + +theorem eigen (j : G.J) : ρ.op (G.basis j)=(G.probability j : ℂ) • G.basis j := by + let : Nonempty G.J := G.nonempty + rw [G.operator_eq] + exact spectralGibbs_eigen G.basis G.eigenval G.heat j + +theorem logSandwich_symmetric (hk : 0 < k) : G.logSandwich.IsSymmetric := by + have hA := ContinuousLinearMap.nonneg_iff_isPositive.mp + (gibbsFactor_strictPositive rootNumberWeight rootNumberWeight_one_le hk G.positive).nonneg + apply ContinuousLinearMap.isSelfAdjoint_iff_isSymmetric.mp + unfold logSandwich logarithmSandwich + apply IsSelfAdjoint.add hA.isSelfAdjoint + have hs : IsSelfAdjoint ((inverseWeight (n := n) 2)*(inverseWeight 2)) := + by simpa only [pow_two] using (inverseWeight_selfAdjoint (n := n) 2).pow 2 + exact (show IsSelfAdjoint (Real.log (heatPartition G.eigenval) : ℂ) from Complex.conj_ofReal _).smul hs + +theorem logSandwich_parseval (hk : 0 < k) (y : Fock n) : + HasSum (fun j => G.logCoefficient j*‖inner ℂ (G.basis j) (inverseWeight 2 y)‖^2) + (inner ℂ y (G.logSandwich y)).re := by + let : Nonempty G.J := G.nonempty + have he (j : G.J) : ((inverseWeight (n := n) 2) * + Ring.inverse (gibbsFactor (rootNumberWeight (n := n)) rootNumberWeight_one_le k G.B)* + inverseWeight 2 : Fock n →L[ℂ] Fock n) (G.basis j)=(((G.eigenval j)⁻¹ : ℝ):ℂ) • G.basis j := by + simpa only [gibbsInverse, inversePower_root_four] using G.inverse_eigen j + exact gibbs_logarithmSandwich_parseval G.basis _ _ + (gibbsFactor_strictPositive _ _ hk G.positive) + (ContinuousLinearMap.isSelfAdjoint_iff_isSymmetric.mp (inverseWeight_selfAdjoint 2)) + (inverseWeight_injective 2) G.eigenval G.positive_eigenval he G.heat y + +theorem logSandwich_preimage (hk : 0 < k) (j : G.J) (x : Fock n) + (hi : inverseWeight 3 x = CrossEnsemble.eigenEnsemble G.basis G.probability j) : + G.logSandwich (inverseWeight 1 x) = + (G.logCoefficient j : ℂ) • inverseWeight 5 x := by + let : Nonempty G.J := G.nonempty + have he (j : G.J) : ((inverseWeight (n := n) 2) * + Ring.inverse (gibbsFactor (rootNumberWeight (n := n)) rootNumberWeight_one_le k G.B)* + inverseWeight 2 : Fock n →L[ℂ] Fock n) (G.basis j)=(((G.eigenval j)⁻¹ : ℝ):ℂ) • G.basis j := by + simpa only [gibbsInverse, inversePower_root_four] using G.inverse_eigen j + have hv : inverseWeight 2 (inverseWeight 1 x)= + (Real.sqrt (G.probability j):ℂ) • G.basis j := by + change (inverseWeight 2 ∘L inverseWeight 1) x = _ + rw [← inverseWeight_add] + exact hi + have hh := logarithmSandwich_eigen_preimage G.basis _ _ + (gibbsFactor_strictPositive _ _ hk G.positive) (inverseWeight_injective 2) + G.eigenval G.positive_eigenval he (Real.log (heatPartition G.eigenval)) j + (inverseWeight 1 x) (Real.sqrt (G.probability j):ℂ) hv + have hc : G.eigenval j+Real.log (heatPartition G.eigenval)=G.logCoefficient j := by + simp only [logCoefficient, probability, log_gibbsWeight G.eigenval G.heat] + have hid : inverseWeight 2 ((Real.sqrt (G.probability j):ℂ) • G.basis j)=inverseWeight 5 x := by + rw [← hv] + change (inverseWeight 2 ∘L inverseWeight 2 ∘L inverseWeight 1) x= inverseWeight 5 x + rw [← inverseWeight_add, ← inverseWeight_add] + exact (hh.trans (by rw [hc, hid])) + +theorem weighted_columns : ∃ x : G.J → Fock n, + Summable (fun j => ‖x j‖^2) ∧ + (∀ j, inverseWeight 3 (x j)=CrossEnsemble.eigenEnsemble G.basis G.probability j) := by + have hm6 := finiteMoment_mono (by norm_num : 6 ≤ 7) G.moment + have hm : Summable (fun i => (numberWeight i^3)^2* + (inner ℂ (sequenceBasis (NumberIndex n) i) (ρ.op (sequenceBasis _ i))).re) := by + have hb (i : NumberIndex n) : sequenceBasis (NumberIndex n) i = numberKet i := by + ext a + by_cases ha : i=a <;> simp [sequenceBasis_apply, numberKet, ha] + simpa only [← pow_mul, show (3*2:ℕ)=6 from rfl, numberWeight, totalNumber, Nat.cast_sum, + FiniteMoment, entry, hb] using hm6 + obtain ⟨x, hx, hs, _⟩ := weighted_spectral_vectors G.basis ρ.op G.probability + (fun j => (G.probability_pos j).le) G.eigen (fun i => numberWeight i^3) hm + refine ⟨x, hs, fun j => ?_⟩ + apply lp.ext + funext i + simp only [inverseWeight_apply, hx, CrossEnsemble.eigenEnsemble, lp.coeFn_smul, + Pi.smul_apply, smul_eq_mul, Complex.ofReal_pow] + have hw : (numberWeight i : ℂ) ≠ 0 := by + exact_mod_cast (show numberWeight i ≠ 0 by linarith [numberWeight_one_le i]) + field_simp + +end GibbsData +end EntropyPhotonNumber + +namespace WeightedGenerator +open EntropyPhotonNumber Annihilation +variable {n : ℕ} {J : Type*} + +def loweringEntry (b : HilbertBasis J ℂ (Fock n)) (p : J → ℝ) + (x : J → Fock n) (j : Fin n) (l r : J) : ℂ := + spectralGain b x j false l r / (Real.sqrt (p r) : ℂ) + +theorem spectralGain_adjoint (b : HilbertBasis J ℂ (Fock n)) + (p : J → ℝ) (x : J → Fock n) + (hi : ∀ r, inverseWeight 3 (x r)=(Real.sqrt (p r):ℂ) • b r) + (j : Fin n) (l r : J) : + (Real.sqrt (p l):ℂ)*spectralGain b x j true l r = + (Real.sqrt (p r):ℂ)*conj (spectralGain b x j false r l) := by + have h := ladder_adjoint_pairing j (inverseWeight 2 (x l)) (inverseWeight 2 (x r)) + have hw (r : J) : inverseWeight 1 (inverseWeight 2 (x r))=(Real.sqrt (p r):ℂ) • b r := by + change (inverseWeight 1 ∘L inverseWeight 2) (x r)=_ + rw [← inverseWeight_add] + exact hi r + rw [hw l, hw r, inner_smul_left, inner_smul_right, Complex.conj_ofReal] at h + simpa only [spectralGain, unweightedGain, Bool.false_eq_true, ↓reduceIte, + inner_conj_symm, mul_comm] using h.symm + +theorem spectralGain_lowering (b : HilbertBasis J ℂ (Fock n)) + (p : J → ℝ) (hp : ∀ r, 0

‖x r‖^2)) + (S : Fock n →L[ℂ] Fock n) (hS : S.IsSymmetric) (c : J → ℝ) + (hc : ∀ l, 0 ≤ c l) + (hf : ∀ y, HasSum (fun l => c l*‖inner ℂ (b l) (inverseWeight 2 y)‖^2) + (inner ℂ y (S y)).re) + (he : ∀ r, S (inverseWeight 1 (x r)) = (c r : ℂ) • inverseWeight 5 (x r)) + (j : Fin n) (u : Bool) : + Summable (fun a : J × J => (c a.1-c a.2)*‖spectralGain b x j u a.1 a.2‖^2) := by + simpa only [sub_mul] using (crossed_log_summable b x hx S c hc hf j u).sub + (uncrossed_log_summable b x hx S hS c hc he j u) + +theorem thermal_log_spectral (b : HilbertBasis J ℂ (Fock n)) + (p : J → ℝ) (hp : ∀ r, 0

‖x r‖^2)) + (hi : ∀ r, inverseWeight 3 (x r)=(Real.sqrt (p r):ℂ) • b r) + (S : Fock n →L[ℂ] Fock n) (hS : S.IsSymmetric) (c : J → ℝ) + (hc : ∀ l, 0 ≤ c l) + (hf : ∀ y, HasSum (fun l => c l*‖inner ℂ (b l) (inverseWeight 2 y)‖^2) + (inner ℂ y (S y)).re) + (he : ∀ r, S (inverseWeight 1 (x r)) = (c r : ℂ) • inverseWeight 5 (x r)) + (t : ℝ) : + (pairing t x S).re = ∑ j, ∑' a : J × J, + (c a.1-c a.2)*((t+1)*p a.2-t*p a.1)*‖loweringEntry b p x j a.1 a.2‖^2 := by + unfold pairing + rw [Complex.re_sum] + apply Finset.sum_congr rfl + intro j _ + simp only [Complex.add_re, Complex.mul_re, Complex.ofReal_re, Complex.ofReal_im, + zero_mul, sub_zero] + rw [dissipator_log_sum b x hx S hS c hc hf he j false, + dissipator_log_sum b x hx S hS c hc hf he j true] + have hd := log_difference_summable b x hx S hS c hc hf he j false + have hu := (log_difference_summable b x hx S hS c hc hf he j true).prod_symm + simp only [Prod.swap] at hu + rw [← (Equiv.prodComm J J).tsum_eq + (fun a : J × J => (c a.1-c a.2)*‖spectralGain b x j true a.1 a.2‖^2)] + change (t+1)*(∑' a : J × J, (c a.1-c a.2)*‖spectralGain b x j false a.1 a.2‖^2)+ + t*(∑' a : J × J, (c a.2-c a.1)*‖spectralGain b x j true a.2 a.1‖^2)=_ + rw [← tsum_mul_left, ← tsum_mul_left, ← (hd.mul_left (t+1)).tsum_add (hu.mul_left t)] + apply tsum_congr + intro a + rw [spectralGain_lowering_sq b p hp, spectralGain_raising_sq b p hp x hi] + ring + +end WeightedGenerator + +namespace EntropyPhotonNumber +open QuantumTrace Annihilation +variable {n : ℕ} {k : ℝ} {ρ : State n} +namespace GibbsData +variable (G : GibbsData n k ρ) + +def spectralColumns : G.J → Fock n := Classical.choose G.weighted_columns + +theorem spectralColumns_summable : Summable (fun r => ‖G.spectralColumns r‖^2) := + (Classical.choose_spec G.weighted_columns).1 + +theorem spectralColumns_inverse (r : G.J) : + inverseWeight 3 (G.spectralColumns r)=CrossEnsemble.eigenEnsemble G.basis G.probability r := + (Classical.choose_spec G.weighted_columns).2 r + +theorem spectralColumns_normalized : + HasSum (fun r => ‖inverseWeight 3 (G.spectralColumns r)‖^2) 1 := by + simpa only [G.spectralColumns_inverse, + CrossEnsemble.eigenEnsemble_norm G.basis G.probability (fun r => (G.probability_pos r).le)] + using G.probability_sum + +theorem spectralColumns_operator (hm : FiniteMoment 6 ρ) : + CrossEnsemble.operator (weightedRoot 3 ρ hm) (weightedRoot 3 ρ hm)= + CrossEnsemble.operator G.spectralColumns G.spectralColumns := by + exact weightedRoot_operator_eq ρ hm G.basis G.probability + (fun r => (G.probability_pos r).le) G.probability_sum.summable G.eigen + G.spectralColumns G.spectralColumns_summable G.spectralColumns_inverse + +theorem thermalGenerator_logarithmic_trace (hk : 0 G.logSandwich_preimage hk r _ (G.spectralColumns_inverse r)) t + +end GibbsData +end EntropyPhotonNumber + +end + +end OAI diff --git a/lean/OAI/InformationTheory/PhotonNumber/GibbsVariational.lean b/lean/OAI/InformationTheory/PhotonNumber/GibbsVariational.lean new file mode 100644 index 0000000000000000000000000000000000000000..d2a70fef149b28ae6a0ae8209779191a6c4e5bb7 --- /dev/null +++ b/lean/OAI/InformationTheory/PhotonNumber/GibbsVariational.lean @@ -0,0 +1,974 @@ +import OAI.InformationTheory.PhotonNumber.Entropy + +namespace OAI + +noncomputable section + +open scoped ComplexConjugate +open scoped BigOperators ComplexConjugate +open scoped BigOperators ComplexConjugate ENNReal Topology +open MeasureTheory +open scoped BigOperators +open MvPolynomial +open scoped BigOperators ComplexConjugate Classical +open Submodule +open scoped ENNReal + +namespace QuantumTrace + +section +open scoped BigOperators +open Filter Topology + +theorem negMulLog_lt_crossEntropy {p q : ℝ} (hp : 0 ≤ p) (hq : 0 < q) (hne : p ≠ q) : + Real.negMulLog p < q - p + p * (-Real.log q) := by + by_cases hz : p = 0 + · simp [hz, hq] + have hneq : p/q ≠ 1 := by + intro h + exact hne ((div_eq_one_iff_eq hq.ne').mp h) + have h := mul_lt_mul_of_pos_left + (Real.negMulLog_lt_one_sub_self (div_nonneg hp hq.le) hneq) hq + change q * (-(p / q) * Real.log (p / q)) < q * (1 - p / q) at h + rw [Real.log_div hz hq.ne'] at h + have hl : q * (-(p / q) * (Real.log p - Real.log q)) = + -p * Real.log p + p * Real.log q := by field_simp; ring + have hr : q * (1 - p / q) = q - p := by field_simp + rw [hl, hr] at h + dsimp [Real.negMulLog] + linarith + +structure StochasticOverlap (I J : Type*) where + value : I → J → ℝ + nonneg : ∀ i j, 0 ≤ value i j + row : ∀ i, HasSum (value i) 1 + col : ∀ j, HasSum (fun i => value i j) 1 + +namespace StochasticOverlap +variable {I J : Type*} (a : StochasticOverlap I J) + +theorem hasSum_row_product (p : I → ℝ) {s : ℝ} (hp : HasSum p s) : + HasSum (fun ij : I × J => a.value ij.1 ij.2 * p ij.1) s := by + have hs : Summable (fun ij : I × J => a.value ij.1 ij.2 * p ij.1) := by + apply Summable.of_norm + apply (summable_prod_of_nonneg (fun _ => norm_nonneg _)).mpr + constructor + · intro i + simpa [Real.norm_eq_abs, abs_mul, abs_of_nonneg (a.nonneg i _)] using + (a.row i).summable.mul_right |p i| + · simp_rw [Real.norm_eq_abs, abs_mul, abs_of_nonneg (a.nonneg _ _), + tsum_mul_right, (a.row _).tsum_eq, one_mul] + exact hp.summable.norm + convert hs.hasSum using 1 + rw [hs.tsum_prod] + simp only [tsum_mul_right, (a.row _).tsum_eq, one_mul, hp.tsum_eq] + +def transpose : StochasticOverlap J I where + value j i := a.value i j + nonneg j i := a.nonneg i j + row := a.col + col := a.row + +theorem hasSum_col_product (q : J → ℝ) {s : ℝ} (hq : HasSum q s) : + HasSum (fun ij : I × J => a.value ij.1 ij.2 * q ij.2) s := by + exact (Equiv.prodComm J I).hasSum_iff.mp (a.transpose.hasSum_row_product q hq) + +theorem hasSum_prod_nonneg {v : I × J → ℝ} {c : I → ℝ} {s : ℝ} + (hv : ∀ ij, 0 ≤ v ij) (hf : ∀ i, HasSum (fun j => v (i,j)) (c i)) + (hc : HasSum c s) : HasSum v s := by + have hs : Summable v := (summable_prod_of_nonneg hv).mpr + ⟨fun i => (hf i).summable, by simpa only [(hf _).tsum_eq] using hc.summable⟩ + convert hs.hasSum using 1 + rw [hs.tsum_prod] + simp only [(hf _).tsum_eq, hc.tsum_eq] + +def diagonal (p : I → ℝ) (j : J) : ℝ := ∑' i, a.value i j * p i + +theorem hasSum_crossEntropy {p : I → ℝ} {q : J → ℝ} + (hp : ∀ i, 0 ≤ p i) (hp1 : HasSum p 1) + (hq : ∀ j, 0 < q j) (hq1 : HasSum q 1) + {C : ℝ} (hc : HasSum (fun j => a.diagonal p j * (-Real.log (q j))) C) : + HasSum (fun ij : I × J => a.value ij.1 ij.2 * p ij.1 * (-Real.log (q ij.2))) C := by + have hpairs := a.hasSum_row_product p hp1 + have hl (j : J) : 0 ≤ -Real.log (q j) := by + apply neg_nonneg.mpr + apply Real.log_nonpos (hq j).le + rw [← hq1.tsum_eq] + exact hq1.summable.le_tsum j (fun j _ => (hq j).le) + apply (Equiv.prodComm J I).hasSum_iff.mp + apply hasSum_prod_nonneg (c := fun j => a.diagonal p j * (-Real.log (q j))) + (fun ji => mul_nonneg (mul_nonneg (a.nonneg _ _) (hp _)) (hl _)) _ hc + intro j + exact (hpairs.summable.prod_symm.prod_factor j).hasSum.mul_right _ + +theorem klein {p : I → ℝ} {q : J → ℝ} + (hp : ∀ i, 0 ≤ p i) (hp1 : HasSum p 1) + (hq : ∀ j, 0 < q j) (hq1 : HasSum q 1) + {H C : ℝ} (hh : HasSum (fun i => Real.negMulLog (p i)) H) + (hc : HasSum (fun j => a.diagonal p j * (-Real.log (q j))) C) : + H ≤ C ∧ (H = C → ∀ i j, a.value i j ≠ 0 → p i = q j) := by + let d (ij : I × J) : ℝ := a.value ij.1 ij.2 * + (q ij.2 - p ij.1 + p ij.1 * (-Real.log (q ij.2)) - Real.negMulLog (p ij.1)) + have hd (ij : I × J) : 0 ≤ d ij := + mul_nonneg (a.nonneg _ _) (sub_nonneg.mpr (negMulLog_le_crossEntropy (hp _) (hq _))) + have hdSum : HasSum d (C-H) := by + have h := (((a.hasSum_col_product q hq1).sub (a.hasSum_row_product p hp1)).add + (a.hasSum_crossEntropy hp hp1 hq hq1 hc)).sub + (a.hasSum_row_product (fun i => Real.negMulLog (p i)) hh) + convert! h using 1 + · funext ij + dsimp [d] + ring + · ring + refine ⟨sub_nonneg.mp (hdSum.tsum_eq ▸ tsum_nonneg hd), ?_⟩ + intro he i j ha + by_contra hne + have hpos : 0 < d (i,j) := mul_pos (lt_of_le_of_ne (a.nonneg i j) (Ne.symm ha)) + (sub_pos.mpr (negMulLog_lt_crossEntropy (hp i) (hq j) hne)) + have hx := hdSum.summable.le_tsum (i,j) (fun ij _ => hd ij) + rw [hdSum.tsum_eq, he, sub_self] at hx + exact (not_lt_of_ge hx) hpos + +end StochasticOverlap +end + +section +open scoped BigOperators +variable {I J : Type*} {E : Type*} [NormedAddCommGroup E] [InnerProductSpace ℂ E] + +def basisOverlap (b : HilbertBasis I ℂ E) (c : HilbertBasis J ℂ E) : + StochasticOverlap I J where + value i j := ‖inner ℂ (c j) (b i)‖ ^ 2 + nonneg _ _ := sq_nonneg _ + row i := by + simpa only [b.orthonormal.norm_eq_one, one_pow] using basis_hasSum_norm_sq c (b i) + col j := by + simpa only [norm_inner_symm, c.orthonormal.norm_eq_one, one_pow] using + basis_hasSum_norm_sq b (c j) + +theorem basisOverlap_diagonal (b : HilbertBasis I ℂ E) (c : HilbertBasis J ℂ E) + (T : E →L[ℂ] E) (p : I → ℝ) (he : ∀ i, T (b i) = (p i : ℂ) • b i) (j : J) : + (basisOverlap b c).diagonal p j = (inner ℂ (c j) (T (c j))).re := by + have hh := hasSum_quadratic_eigenbasis b T p he (c j) + simpa only [StochasticOverlap.diagonal, basisOverlap, norm_inner_symm, mul_comm] using hh.tsum_eq + +theorem quantum_klein (b : HilbertBasis I ℂ E) (c : HilbertBasis J ℂ E) + {T S : E →L[ℂ] E} (hs : S.IsSymmetric) + {p : I → ℝ} {q : J → ℝ} (hp : ∀ i, 0 ≤ p i) (hp1 : HasSum p 1) + (hq : ∀ j, 0 < q j) (hq1 : HasSum q 1) + (heT : ∀ i, T (b i) = (p i : ℂ) • b i) + (heS : ∀ j, S (c j) = (q j : ℂ) • c j) + {H C : ℝ} (hh : HasSum (fun i => Real.negMulLog (p i)) H) + (hc : HasSum (fun j => (inner ℂ (c j) (T (c j))).re * (-Real.log (q j))) C) : + H ≤ C ∧ (H = C → T = S) := by + have hcc : HasSum (fun j => (basisOverlap b c).diagonal p j * (-Real.log (q j))) C := by + simpa only [basisOverlap_diagonal b c T p heT] using hc + obtain ⟨hle, heq⟩ := (basisOverlap b c).klein hp hp1 hq hq1 hh hcc + refine ⟨hle, ?_⟩ + intro he + have hcoef (i : I) (j : J) : + (q j : ℂ) * inner ℂ (c j) (b i) = (p i : ℂ) * inner ℂ (c j) (b i) := by + by_cases hz : inner ℂ (c j) (b i) = 0 + · simp [hz] + · rw [heq he i j (by simpa only [basisOverlap, ne_eq, sq_eq_zero_iff, + norm_eq_zero] using hz)] + have hb (i : I) : T (b i) = S (b i) := by + apply c.repr.injective + apply lp.ext + funext j + simp only [c.repr_apply_apply, heT, inner_smul_right] + have hsym : inner ℂ (S (c j)) (b i) = inner ℂ (c j) (S (b i)) := hs _ _ + rw [← hsym, heS, inner_smul_left] + simpa only [Complex.conj_ofReal] using (hcoef i j).symm + ext x + have ht := T.hasSum (b.hasSum_repr x) + have hu := S.hasSum (b.hasSum_repr x) + apply ht.unique + convert hu using 1 + funext i + simp only [ContinuousLinearMap.map_smul, hb] + +end + +section +variable {E : Type*} [NormedAddCommGroup E] [InnerProductSpace ℂ E] [CompleteSpace E] +variable {I J : Type*} + +theorem hasSum_entropy_eigenvalues (a : HilbertBasis I ℂ E) (b : HilbertBasis J ℂ E) + {T : E →L[ℂ] E} (hp : T.IsPositive) + (ht : HasSum (fun i => (inner ℂ (a i) (T (a i))).re) 1) + (p : J → ℝ) (he : ∀ j, T (b j) = (p j : ℂ) • b j) {S : ℝ} + (hS : HasSum (fun i => (inner ℂ (a i) (entropyOperator T (a i))).re) S) : + HasSum (fun j => Real.negMulLog (p j)) S := by + have hh := hasSum_trace_basis a b (entropyOperator_positive hp (norm_le_trace a hp ht)) hS + have hev (j : J) : (inner ℂ (b j) (entropyOperator T (b j))).re = Real.negMulLog (p j) := by + rw [entropyOperator_apply_eigenvector hp.isSymmetric (he j), inner_smul_right, + inner_self_eq_norm_sq_to_K, b.orthonormal.norm_eq_one] + simp + simpa only [hev] using hh + +theorem spectral_gibbs_variational [Nonempty J] (a : HilbertBasis I ℂ E) + (b : HilbertBasis J ℂ E) (u : J → ℝ) + (hheat : Summable (fun j => Real.exp (-u j))) + {T : E →L[ℂ] E} (hp : T.IsPositive) + (ht : HasSum (fun i => (inner ℂ (a i) (T (a i))).re) 1) + {S K : ℝ} (hS : HasSum (fun i => (inner ℂ (a i) (entropyOperator T (a i))).re) S) + (hK : HasSum (fun j => u j*(inner ℂ (b j) (T (b j))).re) K) : + -Real.log (heatPartition u) ≤ K-S ∧ + (K-S = -Real.log (heatPartition u) → T = spectralGibbs b u hheat) := by + obtain ⟨L, c, p, hpp, hpt, heT⟩ := exists_positive_eigenbasis a hp ht + have hSp := hasSum_entropy_eigenvalues a c hp ht p heT hS + have ht' := hasSum_trace_basis a b hp ht + have hcross : HasSum (fun j => (inner ℂ (b j) (T (b j))).re * (-Real.log (gibbsWeight u j))) + (K+Real.log (heatPartition u)) := by + have hh := hK.add (ht'.mul_right (Real.log (heatPartition u))) + convert! hh using 1 + · funext j + rw [log_gibbsWeight u hheat] + ring + · ring + obtain ⟨hle, heq⟩ := quantum_klein c b (spectralGibbs_positive b u hheat).isSymmetric + hpp hpt (gibbsWeight_pos u hheat) (gibbsWeight_hasSum u hheat) + heT (spectralGibbs_eigen b u hheat) hSp hcross + exact ⟨by linarith, fun hh => heq (by linarith)⟩ + +end + +variable {J : Type*} + +theorem spectral_gibbs_attains {E : Type*} [NormedAddCommGroup E] [InnerProductSpace ℂ E] + [CompleteSpace E] [Nonempty J] {I : Type*} (a : HilbertBasis I ℂ E) + (b : HilbertBasis J ℂ E) (u : J → ℝ) (hu : ∀ j, 0 ≤ u j) + (hheat : Summable (fun j => Real.exp (-u j))) + (hhalf : Summable (fun j => Real.exp (-(1/2 : ℝ)*u j))) : + let ω := spectralGibbs b u hheat + Summable (fun j => u j*(inner ℂ (b j) (ω (b j))).re) ∧ + Summable (fun i => (inner ℂ (a i) (entropyOperator ω (a i))).re) ∧ + (∑' j, u j*(inner ℂ (b j) (ω (b j))).re) - + (∑' i, (inner ℂ (a i) (entropyOperator ω (a i))).re) = -Real.log (heatPartition u) := by + let ω := spectralGibbs b u hheat + have he (j : J) : (inner ℂ (b j) (ω (b j))).re = gibbsWeight u j := by + rw [show ω = spectralGibbs b u hheat from rfl, spectralGibbs_eigen, + inner_smul_right, inner_self_eq_norm_sq_to_K, b.orthonormal.norm_eq_one] + simp + have hE : Summable (fun j => u j*gibbsWeight u j) := by + have hh : Summable (fun j => Real.exp (-u j)*u j) := by + apply Summable.of_nonneg_of_le (fun j => mul_nonneg (Real.exp_nonneg _) (hu j)) _ + (summable_polynomial_heat u hu hhalf) + intro j + apply mul_le_mul_of_nonneg_left _ (Real.exp_nonneg _) + nlinarith [sq_nonneg (u j-1)] + apply (hh.div_const (heatPartition u)).congr + intro j + dsimp [gibbsWeight] + ring + have hH : HasSum (fun j => Real.negMulLog (gibbsWeight u j)) + ((∑' j, u j*gibbsWeight u j)+Real.log (heatPartition u)) := by + have hh := hE.hasSum.add ((gibbsWeight_hasSum u hheat).mul_right (Real.log (heatPartition u))) + convert! hh using 1 + · funext j + rw [show Real.negMulLog (gibbsWeight u j) = gibbsWeight u j * (-Real.log (gibbsWeight u j)) by + rw [Real.negMulLog]; ring, log_gibbsWeight u hheat] + ring + · ring + have hHb : HasSum (fun j => (inner ℂ (b j) (entropyOperator ω (b j))).re) + ((∑' j, u j*gibbsWeight u j)+Real.log (heatPartition u)) := by + convert! hH using 1 + funext j + rw [entropyOperator_apply_eigenvector (spectralGibbs_positive b u hheat).isSymmetric + (spectralGibbs_eigen b u hheat j), inner_smul_right, inner_self_eq_norm_sq_to_K, + b.orthonormal.norm_eq_one] + simp + have hHa := hasSum_trace_basis b a + (entropyOperator_positive (spectralGibbs_positive b u hheat) + (norm_le_trace b (spectralGibbs_positive b u hheat) (spectralGibbs_trace_one b u hheat b))) hHb + refine ⟨?_, hHa.summable, ?_⟩ + · change Summable (fun j => u j*(inner ℂ (b j) (ω (b j))).re) + simpa only [he] using hE + · change (∑' j, u j*(inner ℂ (b j) (ω (b j))).re) - _ = _ + simp only [he, hHa.tsum_eq] + ring + +end QuantumTrace + +namespace EntropyPhotonNumber +open QuantumTrace + +def crossEntropy {n : ℕ} {J : Type*} (b : HilbertBasis J ℂ (Fock n)) + (p : J → ℝ) (σ : State n) : ℝ := + ∑' j, (-Real.log (p j))*(inner ℂ (b j) (σ.op (b j))).re + +theorem entropy_hasSum {n : ℕ} (ρ : State n) (hρ : FiniteEnergy ρ) : + HasSum (fun k => (inner ℂ (numberBasis n k) (entropyOperator ρ.op (numberBasis n k))).re) + (entropy ρ) := by + rw [entropy_eq_quantumTrace] + have hh := (entropy_summable ρ hρ) + simpa only [entropyOperator_eq_complex ρ.positive.isSymmetric, numberBasis_apply, entry] + using hh.hasSum + +theorem entropy_le_crossEntropy {n : ℕ} (ρ σ : State n) (hσ : FiniteEnergy σ) + {J : Type*} (b : HilbertBasis J ℂ (Fock n)) (p : J → ℝ) + (hp : ∀ j, 0 < p j) (hs : HasSum p 1) + (he : ∀ j, ρ.op (b j) = (p j : ℂ) • b j) + (hc : Summable (fun j => (-Real.log (p j))*(inner ℂ (b j) (σ.op (b j))).re)) : + entropy σ ≤ crossEntropy b p σ ∧ + (entropy σ = crossEntropy b p σ → σ = ρ) := by + obtain ⟨I, a, q, hq, hqt, hqe⟩ := exists_positive_eigenbasis (numberBasis n) + σ.positive (trace_one_numberBasis σ) + have hS := hasSum_entropy_eigenvalues (numberBasis n) a σ.positive + (trace_one_numberBasis σ) q hqe (entropy_hasSum σ hσ) + have hC : HasSum (fun j => (inner ℂ (b j) (σ.op (b j))).re*(-Real.log (p j))) + (crossEntropy b p σ) := by + simpa only [crossEntropy, mul_comm] using hc.hasSum + obtain ⟨hle, heq⟩ := quantum_klein a b ρ.positive.isSymmetric hq hqt hp hs hqe he hS hC + exact ⟨hle, fun h => state_ext (heq h)⟩ + +theorem crossEntropy_self {n : ℕ} (ρ : State n) (hρ : FiniteEnergy ρ) + {J : Type*} (b : HilbertBasis J ℂ (Fock n)) (p : J → ℝ) + (he : ∀ j, ρ.op (b j) = (p j : ℂ) • b j) : + crossEntropy b p ρ = entropy ρ := by + have h := hasSum_entropy_eigenvalues (numberBasis n) b ρ.positive + (trace_one_numberBasis ρ) p he (entropy_hasSum ρ hρ) + rw [crossEntropy, ← h.tsum_eq] + congr 1 + funext j + rw [he, inner_smul_right, inner_self_eq_norm_sq_to_K, b.orthonormal.norm_eq_one] + simp [Real.negMulLog] + ring + +theorem crossEntropy_finite {n : ℕ} (ρ σ : State n) (hσ : FiniteEnergy σ) + {r κ : ℝ} (hr : 0 < r) (hκ : 0 < κ) (hκ1 : κ ≤ 1) + (hle : (κ : ℂ) • (thermalState n r hr).op ≤ ρ.op) + {J : Type*} (b : HilbertBasis J ℂ (Fock n)) (p : J → ℝ) + (hp : ∀ j, 0 < p j) (hs : HasSum p 1) + (he : ∀ j, ρ.op (b j) = (p j : ℂ) • b j) : + Summable (fun j => (-Real.log (p j))*(inner ℂ (b j) (σ.op (b j))).re) := by + have hp1 (j : J) : p j ≤ 1 := hs.tsum_eq ▸ hs.summable.le_tsum j (fun i _ => (hp i).le) + have hw (j : J) : 0 ≤ -Real.log (p j) := neg_nonneg.mpr (Real.log_nonpos (hp j).le (hp1 j)) + apply (basisExpectation_finite_iff b _ hw σ.positive).mp + have hh := negativeLog_expectation_le_thermal ρ σ hr hκ hκ1 hle b p hp hs he + have hhE : basisExpectation (numberBasis n) (fun k => (totalNumber k : ℝ≥0∞)) σ.op = + ENNReal.ofReal (energy σ) := by + have hh := basisExpectation_ofReal (numberBasis n) (fun k => (totalNumber k : ℝ)) + (fun _ => Nat.cast_nonneg _) σ.positive (by + simpa only [FiniteEnergy, numberBasis_apply, entry] using hσ) + simpa only [ENNReal.ofReal_natCast, energy, numberBasis_apply, entry] using hh + rw [hhE] at hh + exact hh.trans_lt (ENNReal.add_lt_top.mpr ⟨ENNReal.ofReal_lt_top, + ENNReal.mul_lt_top ENNReal.ofReal_lt_top ENNReal.ofReal_lt_top⟩) + +end EntropyPhotonNumber + +namespace QuantumTrace +variable {n : ℕ} {J : Type*} [Nonempty J] + +theorem spectralGibbs_seventh_moment + (b : HilbertBasis J ℂ (SequenceHilbert (Fin n → ℕ))) (u : J → ℝ) + (hu : ∀ j, 0 < u j) {k : ℝ} (hk : 0 < k) + {B : SequenceHilbert (Fin n → ℕ) →L[ℂ] SequenceHilbert (Fin n → ℕ)} + (hheat : Summable (fun j => Real.exp (-u j))) + (hhalf : Summable (fun j => Real.exp (-(1/2 : ℝ)*u j))) + (hreg : ∀ j, ∃ z : SequenceHilbert (Fin n → ℕ), + (∀ i, z i = (rootNumberWeight i^7 : ℝ)*b j i) ∧ + ‖z‖ ≤ k⁻¹*(u j+‖B‖*Real.sqrt (u j/k))) : + Summable (fun i => numberWeight i^7 * + (inner ℂ (sequenceBasis _ i) (spectralGibbs b u hheat (sequenceBasis _ i))).re) := by + choose z hz hzs using hreg + have hn : Summable (fun j => Real.exp (-u j)*‖z j‖^2) := + gibbs_high_moment_summable u (fun j => (hu j).le) hk (norm_nonneg B) + (fun j => ‖z j‖) (fun j => norm_nonneg _) hzs hhalf + have hw : Summable (fun j => gibbsWeight u j*‖z j‖^2) := by + apply (hn.div_const (heatPartition u)).congr + intro j + dsimp [gibbsWeight] + ring + apply weighted_number_moment b (spectralGibbs b u hheat) (gibbsWeight u) + (fun j => (gibbsWeight_pos u hheat j).le) (spectralGibbs_eigen b u hheat) + (fun i => numberWeight i^7) (fun i => pow_nonneg (by linarith [numberWeight_one_le i]) _) + (fun j => ‖z j‖^2) _ hw + intro j + have heq : (fun i => ‖z j i‖^2) = (fun i => numberWeight i^7*‖b j i‖^2) := by + funext i + rw [hz, norm_mul, Complex.norm_real, Real.norm_eq_abs, + abs_of_nonneg (by positivity [rootNumberWeight_one_le i]), mul_pow] + congr 1 + rw [← pow_mul, show (7*2 : ℕ) = 2*7 from rfl, pow_mul, rootNumberWeight, + Real.sq_sqrt (by linarith [numberWeight_one_le i])] + rw [← heq] + exact sequence_hasSum_norm_sq (z j) + +end QuantumTrace + +namespace EntropyPhotonNumber + +section +open QuantumTrace +theorem exists_gibbs_state (n : ℕ) {k : ℝ} (hk : 0 < k) + {B : Fock n →L[ℂ] Fock n} (hB : B.IsPositive) : + ∃ (J : Type) (_ : Nonempty J) (b : HilbertBasis J ℂ (Fock n)) (u : J → ℝ) + (hheat : Summable (fun j => Real.exp (-u j))) (ω : State n), + (∀ j, 0 < u j) ∧ + (∀ j, gibbsInverse rootNumberWeight rootNumberWeight_one_le k B (b j) = + (((u j)⁻¹ : ℝ) : ℂ) • b j) ∧ + (∀ t : ℝ, 0 < t → Summable (fun j => Real.exp (-t*u j))) ∧ + ω.op = spectralGibbs b u hheat ∧ Function.Injective ω.op ∧ FiniteMoment 7 ω := by + classical + obtain ⟨J,b,u,hu,he,hreg,hheat⟩ := gibbs_fock_spectral_regular n hk hB + have hJ : Nonempty J := by + by_contra h + have : IsEmpty J := not_nonempty_iff.mp h + have hh := (basis_hasSum_norm_sq b (numberKet (fun _ : Fin n => 0))).tsum_eq + simp only [tsum_empty] at hh + have hn : ‖numberKet (fun _ : Fin n => 0)‖ = 1 := by simp [numberKet] + rw [hn, one_pow] at hh + exact zero_ne_one hh + let _ := hJ + have ht : Summable (fun j => Real.exp (-u j)) := by simpa using hheat 1 (by norm_num) + let T := spectralGibbs b u ht + have hT : T.IsPositive := spectralGibbs_positive b u ht + have hs : HasSum (fun i => (entry T i i).re) 1 := by + simpa only [sequenceBasis_numberKet, entry] using + spectralGibbs_trace_one b u ht (sequenceBasis (NumberIndex n)) + let ω : State n := ⟨T,hT,hs⟩ + refine ⟨J,hJ,b,u,ht,ω,hu,he,hheat,rfl,spectralGibbs_injective b u ht,?_⟩ + have hm := spectralGibbs_seventh_moment b u hu hk ht (hheat (1/2) (by norm_num)) + (B := B) (fun j => by obtain ⟨y,z,_,hz,_,hzs⟩ := hreg j; exact ⟨z,hz,hzs⟩) + simpa only [FiniteMoment, numberWeight_eq, sequenceBasis_numberKet, entry] using hm + +end + +section +open QuantumTrace TraceEnsemble + +theorem gibbs_slice_real_trace {n : ℕ} {J L K I : Type*} + (c : HilbertBasis L ℂ (Fock n)) (u : L → ℝ) (hu : ∀ l, 0 < u l) + (b : HilbertBasis J ℂ (Fock n)) (p : J → ℝ) (hp : ∀ j, 0 ≤ p j) (hs : HasSum p 1) + (ρ : State n) (heρ : ∀ j, ρ.op (b j) = (p j : ℂ) • b j) (hm : FiniteMoment 4 ρ) + (a : HilbertBasis K ℂ (Fock n)) (w : K → ℝ) (hw : ∀ j, 0 ≤ w j) + (V : I → Fock n →L[ℂ] Fock n) (hV : ∀ x, HasSum (fun i => ‖V i x‖^2) (‖x‖^2)) + (σ : State n) + (heσ : TraceEnsemble.operator (fun z : I × J => V z.1 (diagonalVector b p z.2)) = σ.op) + (hc : Summable (fun j => w j*(inner ℂ (a j) (σ.op (a j))).re)) + {B : Fock n →L[ℂ] Fock n} (hB : B.IsPositive) {α β : ℝ} (hα : 0 ≤ α) (hβ : 0 ≤ β) + (hform : ∀ x, ENNReal.ofReal (inner ℂ x (B x)).re = + ENNReal.ofReal α*sliceMoment a (fun j => ENNReal.ofReal (w j)) V (energyInverse n x)+ + ENNReal.ofReal β*numberVectorMoment (energyInverse n x)) + {k : ℝ} (hk : 0 < k) + (heK : ∀ l, gibbsInverse rootNumberWeight rootNumberWeight_one_le k B (c l) = + (((u l)⁻¹ : ℝ) : ℂ) • c l) : + HasSum (fun l => u l*(inner ℂ (c l) (ρ.op (c l))).re) + (k*numberMoment 4 ρ + α*(∑' j, w j*(inner ℂ (a j) (σ.op (a j))).re) + β*energy ρ) := by + obtain ⟨E,hE,he⟩ := gibbs_slice_trace c u hu b p hp hs ρ heρ hm a + (fun j => ENNReal.ofReal (w j)) V hV σ heσ hB hform hk heK + have hE0 : 0 ≤ E := hE.tsum_eq ▸ tsum_nonneg + (fun j => mul_nonneg (hu j).le (ρ.positive.re_inner_nonneg_right _)) + have hc0 : 0 ≤ ∑' j, w j*(inner ℂ (a j) (σ.op (a j))).re := + tsum_nonneg (fun j => mul_nonneg (hw j) (σ.positive.re_inner_nonneg_right _)) + rw [basisExpectation_ofReal a w hw σ.positive hc, + ← ENNReal.ofReal_mul hk.le, ← ENNReal.ofReal_mul hα, ← ENNReal.ofReal_mul hβ, + ← ENNReal.ofReal_add (mul_nonneg hα hc0) (mul_nonneg hβ (energy_nonneg ρ)), + ← ENNReal.ofReal_add (mul_nonneg hk.le (numberMoment_nonneg 4 ρ)) + (add_nonneg (mul_nonneg hα hc0) (mul_nonneg hβ (energy_nonneg ρ)))] at he + have he' := (ENNReal.ofReal_eq_ofReal_iff hE0 + (add_nonneg (mul_nonneg hk.le (numberMoment_nonneg 4 ρ)) + (add_nonneg (mul_nonneg hα hc0) (mul_nonneg hβ (energy_nonneg ρ))))).mp he + simpa only [he', add_assoc] using hE + +def sliceFreeEnergy {n : ℕ} {K : Type*} (a : HilbertBasis K ℂ (Fock n)) (w : K → ℝ) + (Φ : State n → State n) (k α β : ℝ) (ρ : State n) : ℝ := + k*numberMoment 4 ρ + α*(∑' j, w j*(inner ℂ (a j) ((Φ ρ).op (a j))).re) + + β*energy ρ - entropy ρ + +theorem sliced_gibbs_minimizer {n : ℕ} {K I : Type*} + (a : HilbertBasis K ℂ (Fock n)) (w : K → ℝ) (hw : ∀ j, 0 ≤ w j) + (V : I → Fock n →L[ℂ] Fock n) (hV : ∀ x, HasSum (fun i => ‖V i x‖^2) (‖x‖^2)) + (Φ : State n → State n) + (hΦ : ∀ (J : Type) (v : J → Fock n) (ρ : State n), + HasSum (fun j => ‖v j‖^2) 1 → operator v = ρ.op → + operator (fun z : I × J => V z.1 (v z.2)) = (Φ ρ).op) + (hc : ∀ ρ, FiniteMoment 4 ρ → + Summable (fun j => w j*(inner ℂ (a j) ((Φ ρ).op (a j))).re)) + {B : Fock n →L[ℂ] Fock n} (hB : B.IsPositive) {α β : ℝ} (hα : 0 ≤ α) (hβ : 0 ≤ β) + (hform : ∀ x, ENNReal.ofReal (inner ℂ x (B x)).re = + ENNReal.ofReal α*sliceMoment a (fun j => ENNReal.ofReal (w j)) V (energyInverse n x)+ + ENNReal.ofReal β*numberVectorMoment (energyInverse n x)) + {k : ℝ} (hk : 0 < k) (ρ : State n) (hm : FiniteMoment 4 ρ) + (hmin : ∀ σ, FiniteMoment 4 σ → sliceFreeEnergy a w Φ k α β ρ ≤ sliceFreeEnergy a w Φ k α β σ) : + ∃ (J : Type) (_ : Nonempty J) (b : HilbertBasis J ℂ (Fock n)) (u : J → ℝ) + (hheat : Summable (fun j => Real.exp (-u j))), + (∀ j, 0 < u j) ∧ + (∀ j, gibbsInverse rootNumberWeight rootNumberWeight_one_le k B (b j) = + (((u j)⁻¹ : ℝ) : ℂ) • b j) ∧ + ρ.op = spectralGibbs b u hheat ∧ Function.Injective ρ.op ∧ FiniteMoment 7 ρ := by + classical + obtain ⟨J,hJ,b,u,ht,ω,hu,he,hheat,hω,hinj,hmω⟩ := exists_gibbs_state n hk hB + let _ := hJ + have htrace (σ : State n) (hmσ : FiniteMoment 4 σ) : + HasSum (fun j => u j*(inner ℂ (b j) (σ.op (b j))).re) + (k*numberMoment 4 σ + α*(∑' j, w j*(inner ℂ (a j) ((Φ σ).op (a j))).re) + β*energy σ) := by + obtain ⟨L,c,p,hp,hs,heσ⟩ := exists_positive_eigenbasis (numberBasis n) + σ.positive (trace_one_numberBasis σ) + have hv : HasSum (fun j => ‖diagonalVector c p j‖^2) 1 := by + simpa only [diagonalVector_norm_sq c p hp] using hs + exact gibbs_slice_real_trace b u hu c p hp hs σ heσ hmσ a w hw V hV (Φ σ) + (hΦ L _ σ hv (diagonalVector_operator c p hp hs.summable σ.op heσ)) (hc σ hmσ) + hB hα hβ hform hk he + have hmω4 := finiteMoment_mono (by norm_num : 4 ≤ 7) hmω + have htρ := htrace ρ hm + have hVρ := spectral_gibbs_variational (numberBasis n) b u ht ρ.positive + (trace_one_numberBasis ρ) (entropy_hasSum ρ (finiteMoment_finiteEnergy (by norm_num) hm)) htρ + have hωatt := spectral_gibbs_attains (numberBasis n) b u (fun j => (hu j).le) ht + (hheat (1/2) (by norm_num)) + have hSω : HasSum (fun i => (inner ℂ ((numberBasis n) i) + (entropyOperator ω.op ((numberBasis n) i))).re) (entropy ω) := + entropy_hasSum ω (finiteMoment_finiteEnergy (by norm_num) hmω4) + have hωeq : sliceFreeEnergy a w Φ k α β ω = -Real.log (heatPartition u) := by + dsimp only at hωatt + rw [← hω] at hωatt + rw [(htrace ω hmω4).tsum_eq, hSω.tsum_eq] at hωatt + exact hωatt.2.2 + have heq : sliceFreeEnergy a w Φ k α β ρ = -Real.log (heatPartition u) := + le_antisymm ((hmin ω hmω4).trans_eq hωeq) hVρ.1 + have hρop := hVρ.2 heq + have hρω : ρ = ω := state_ext (hρop.trans hω.symm) + exact ⟨J,hJ,b,u,ht,hu,he,hρop,by simpa only [hρω] using hinj,by simpa only [hρω] using hmω⟩ + +end + +section +open QuantumTrace + +theorem crossEntropy_mixture {n : ℕ} {J : Type*} (b : HilbertBasis J ℂ (Fock n)) + (p : J → ℝ) (t : ℝ) (ht : t ∈ Set.Icc 0 1) (ρ σ : State n) + (hρ : Summable (fun j => (-Real.log (p j))*(inner ℂ (b j) (ρ.op (b j))).re)) + (hσ : Summable (fun j => (-Real.log (p j))*(inner ℂ (b j) (σ.op (b j))).re)) : + crossEntropy b p (mixture t ht ρ σ) = t*crossEntropy b p ρ+(1-t)*crossEntropy b p σ := by + have hh := (hρ.hasSum.mul_left t).add (hσ.hasSum.mul_left (1-t)) + have hf (j : J) : (-Real.log (p j))*(inner ℂ (b j) ((mixture t ht ρ σ).op (b j))).re = + t*((-Real.log (p j))*(inner ℂ (b j) (ρ.op (b j))).re)+ + (1-t)*((-Real.log (p j))*(inner ℂ (b j) (σ.op (b j))).re) := by + simp only [mixture, add_apply, smul_apply, inner_add_right, inner_smul_right, + Complex.add_re, Complex.mul_re, Complex.ofReal_re, Complex.ofReal_im, zero_mul, sub_zero] + ring + unfold crossEntropy + simpa only [hf] using hh.tsum_eq + +theorem one_port_majorant {n : ℕ} {J : Type*} + (Φ : State n → State n) (τ : State n) (κ : ℝ) (hκ : κ ∈ Set.Icc 0 1) + (c a β ζ : ℝ) (hc : 0 < c) (ha : 0 < a) + (ρ : State n) (hmρ : FiniteMoment 4 ρ) + (b : HilbertBasis J ℂ (Fock n)) (p : J → ℝ) + (hp : ∀ j, 0 < p j) (hs : HasSum p 1) + (he : ∀ j, (mixture (1-κ) ⟨sub_nonneg.mpr hκ.2, sub_le_self _ hκ.1⟩ (Φ ρ) τ).op (b j) = + (p j : ℂ) • b j) + (hfinite : ∀ σ, FiniteMoment 4 σ → FiniteEnergy (Φ σ)) (hτ : FiniteEnergy τ) + (hcross : ∀ σ, FiniteMoment 4 σ → + Summable (fun j => (-Real.log (p j))*(inner ℂ (b j) ((Φ σ).op (b j))).re)) + (hcτ : Summable (fun j => (-Real.log (p j))*(inner ℂ (b j) (τ.op (b j))).re)) + (hmin : ∀ σ, FiniteMoment 4 σ → + c*entropy (mixture (1-κ) ⟨sub_nonneg.mpr hκ.2, sub_le_self _ hκ.1⟩ (Φ ρ) τ)-a*entropy ρ+ + β*energy ρ+ζ*numberMoment 4 ρ ≤ + c*entropy (mixture (1-κ) ⟨sub_nonneg.mpr hκ.2, sub_le_self _ hκ.1⟩ (Φ σ) τ)-a*entropy σ+ + β*energy σ+ζ*numberMoment 4 σ) : + ∀ σ, FiniteMoment 4 σ → + sliceFreeEnergy b (fun j => -Real.log (p j)) Φ (ζ/a) (c*(1-κ)/a) (β/a) ρ ≤ + sliceFreeEnergy b (fun j => -Real.log (p j)) Φ (ζ/a) (c*(1-κ)/a) (β/a) σ := by + let ht : 1-κ ∈ Set.Icc 0 1 := ⟨sub_nonneg.mpr hκ.2, sub_le_self _ hκ.1⟩ + let ρ0 := mixture (1-κ) ht (Φ ρ) τ + have hself := crossEntropy_self ρ0 (mixture_finiteEnergy _ _ (hfinite ρ hmρ) hτ) b p he + have hmixρ := crossEntropy_mixture b p (1-κ) ht (Φ ρ) τ (hcross ρ hmρ) hcτ + intro σ hmσ + have hmixσ := crossEntropy_mixture b p (1-κ) ht (Φ σ) τ (hcross σ hmσ) hcτ + have hcσ : Summable (fun j => (-Real.log (p j))*(inner ℂ (b j) + ((mixture (1-κ) ht (Φ σ) τ).op (b j))).re) := by + convert! ((hcross σ hmσ).mul_left (1-κ)).add (hcτ.mul_left (1-(1-κ))) using 1 + funext j + simp only [mixture, add_apply, smul_apply, inner_add_right, inner_smul_right, + Complex.add_re, Complex.mul_re, Complex.ofReal_re, Complex.ofReal_im, zero_mul, sub_zero] + ring + have hmaj := (entropy_le_crossEntropy ρ0 (mixture (1-κ) ht (Φ σ) τ) + (mixture_finiteEnergy _ _ (hfinite σ hmσ) hτ) b p hp hs he hcσ).1 + have hm := hmin σ hmσ + have hρeq : c*entropy ρ0 = c*((1-κ)*crossEntropy b p (Φ ρ)+κ*crossEntropy b p τ) := by + rw [← hself, hmixρ] + congr 1 + ring + have hσle : c*entropy (mixture (1-κ) ht (Φ σ) τ) ≤ + c*((1-κ)*crossEntropy b p (Φ σ)+κ*crossEntropy b p τ) := by + have hh := mul_le_mul_of_nonneg_left hmaj hc.le + rw [hmixσ] at hh + simpa only [show 1-(1-κ) = κ by ring] using hh + apply (mul_le_mul_iff_right₀ ha).mp + have hscale (x : State n) : + a*sliceFreeEnergy b (fun j => -Real.log (p j)) Φ (ζ/a) (c*(1-κ)/a) (β/a) x = + ζ*numberMoment 4 x+c*(1-κ)*crossEntropy b p (Φ x)+β*energy x-a*entropy x := by + dsimp [sliceFreeEnergy, crossEntropy] + field_simp + rw [hscale, hscale] + change c*entropy ρ0-a*entropy ρ+β*energy ρ+ζ*numberMoment 4 ρ ≤ _ at hm + rw [hρeq] at hm + linarith + +end + +section +open QuantumTrace TensorLp + +structure KrausFlow (n : ℕ) where + I : Type + V : I → Fock n →L[ℂ] Fock n + norm : ∀ x, HasSum (fun i => ‖V i x‖^2) (‖x‖^2) + F : ℝ + nonneg : 0 ≤ F + energy : ∀ x, (∑' i, vectorMoment (fun k => (totalNumber k : ℝ≥0∞)) (V i x)) ≤ + vectorMoment (fun k => (totalNumber k : ℝ≥0∞)) x+ENNReal.ofReal F*ENNReal.ofReal (‖x‖^2) + map : State n → State n + ensemble : ∀ (J : Type) (v : J → Fock n) (ρ : State n), + HasSum (fun j => ‖v j‖^2) 1 → TraceEnsemble.operator v = ρ.op → + TraceEnsemble.operator (fun z : I × J => V z.1 (v z.2)) = (map ρ).op + finiteEnergy : ∀ ρ, FiniteEnergy ρ → FiniteEnergy (map ρ) + +theorem composedKraus_second_ensemble {n : ℕ} {J : Type*} + (η θ : ℝ) (hη : η ∈ Set.Icc 0 1) (hθ : θ ∈ Set.Icc 0 1) (ρ σ τ : State n) + (v : J → Fock n) (hv : HasSum (fun j => ‖v j‖^2) 1) + (he : TraceEnsemble.operator v = σ.op) : + TraceEnsemble.operator (fun z : ((NumberIndex n × NumberIndex n) × + (NumberIndex n × NumberIndex n)) × J => + composeKraus (firstKraus θ hθ τ) (secondKraus η hη ρ) z.1 (v z.2)) = + (beamOutput θ hθ (beamOutput η hη ρ σ) τ).op := by + have hV := TraceEnsemble.kraus_hasSum (secondKraus_norm η hη ρ) hv + have heV := secondKraus_ensemble η hη ρ σ v hv he + have heU := firstKraus_ensemble θ hθ (beamOutput η hη ρ σ) τ _ hV heV + exact (composeKraus_ensemble (firstKraus θ hθ τ) (secondKraus η hη ρ) v).trans heU + +namespace Regularization +variable {n : ℕ} (R : Regularization n) + +def rawOutput (ρ σ : State n) : State n := + beamOutput (1-R.δ) ⟨sub_nonneg.mpr R.hδ.2, sub_le_self _ R.hδ.1⟩ + (beamOutput R.η R.hη ρ σ) R.τD + +def firstFlow (σ : State n) (hσ : FiniteEnergy σ) : KrausFlow n where + I := (NumberIndex n × NumberIndex n) × (NumberIndex n × NumberIndex n) + V := composeKraus (firstKraus (1-R.δ) ⟨sub_nonneg.mpr R.hδ.2, sub_le_self _ R.hδ.1⟩ R.τD) + (firstKraus R.η R.hη σ) + norm := composeKraus_norm _ _ (firstKraus_norm _ _ _) (firstKraus_norm _ _ _) + F := energy R.τD+energy σ + nonneg := add_nonneg (energy_nonneg _) (energy_nonneg _) + energy := by + intro x + have hh := composeKraus_energy + (firstKraus (1-R.δ) ⟨sub_nonneg.mpr R.hδ.2, sub_le_self _ R.hδ.1⟩ R.τD) + (firstKraus R.η R.hη σ) (firstKraus_norm _ _ _) (firstKraus_energy _ _ _) + (firstKraus_energy _ _ _) x + simpa only [energyMoment_ofReal R.finiteD, energyMoment_ofReal hσ, + ENNReal.ofReal_add (energy_nonneg R.τD) (energy_nonneg σ)] using hh + map := fun ρ => R.rawOutput ρ σ + ensemble := by + intro J v ρ hv he + exact composedKraus_first_ensemble _ _ _ _ ρ σ R.τD v hv he + finiteEnergy := fun _ hρ => beamOutput_finiteEnergy _ _ (beamOutput_finiteEnergy _ _ hρ hσ) R.finiteD + +def secondFlow (ρ : State n) (hρ : FiniteEnergy ρ) : KrausFlow n where + I := (NumberIndex n × NumberIndex n) × (NumberIndex n × NumberIndex n) + V := composeKraus (firstKraus (1-R.δ) ⟨sub_nonneg.mpr R.hδ.2, sub_le_self _ R.hδ.1⟩ R.τD) + (secondKraus R.η R.hη ρ) + norm := composeKraus_norm _ _ (firstKraus_norm _ _ _) (secondKraus_norm _ _ _) + F := energy R.τD+energy ρ + nonneg := add_nonneg (energy_nonneg _) (energy_nonneg _) + energy := by + intro x + have hh := composeKraus_energy + (firstKraus (1-R.δ) ⟨sub_nonneg.mpr R.hδ.2, sub_le_self _ R.hδ.1⟩ R.τD) + (secondKraus R.η R.hη ρ) (secondKraus_norm _ _ _) (firstKraus_energy _ _ _) + (secondKraus_energy _ _ _) x + simpa only [energyMoment_ofReal R.finiteD, energyMoment_ofReal hρ, + ENNReal.ofReal_add (energy_nonneg R.τD) (energy_nonneg ρ)] using hh + map := fun σ => R.rawOutput ρ σ + ensemble := by + intro J v σ hv he + exact composedKraus_second_ensemble _ _ _ _ ρ σ R.τD v hv he + finiteEnergy := fun _ hσ => beamOutput_finiteEnergy _ _ (beamOutput_finiteEnergy _ _ hρ hσ) R.finiteD + +end Regularization +end + +section +open QuantumTrace +theorem flow_minimum_gibbs {n : ℕ} {J : Type*} + (F : KrausFlow n) (τ : State n) {r : ℝ} (hr : 0 < r) (hτ : τ = thermalState n r hr) + (κ : ℝ) (hκ : κ ∈ Set.Icc 0 1) (hκ0 : 0 < κ) + (c a β ζ : ℝ) (hc : 0 < c) (ha : 0 < a) (hβ : 0 ≤ β) (hζ : 0 < ζ) + (ρ : State n) (hmρ : FiniteMoment 4 ρ) + (b : HilbertBasis J ℂ (Fock n)) (p : J → ℝ) (hp : ∀ j, 0 < p j) (hs : HasSum p 1) + (he : ∀ j, (mixture (1-κ) ⟨sub_nonneg.mpr hκ.2, sub_le_self _ hκ.1⟩ (F.map ρ) τ).op (b j) = + (p j : ℂ) • b j) + (hmin : ∀ σ, FiniteMoment 4 σ → + c*entropy (mixture (1-κ) ⟨sub_nonneg.mpr hκ.2, sub_le_self _ hκ.1⟩ (F.map ρ) τ)-a*entropy ρ+ + β*energy ρ+ζ*numberMoment 4 ρ ≤ + c*entropy (mixture (1-κ) ⟨sub_nonneg.mpr hκ.2, sub_le_self _ hκ.1⟩ (F.map σ) τ)-a*entropy σ+ + β*energy σ+ζ*numberMoment 4 σ) : + ∃ G : GibbsData n (ζ/a) ρ, ∀ x, + ENNReal.ofReal (inner ℂ x (G.B x)).re = + ENNReal.ofReal (c*(1-κ)/a)* + sliceMoment b (fun j => ENNReal.ofReal (-Real.log (p j))) F.V (energyInverse n x)+ + ENNReal.ofReal (β/a)*numberVectorMoment (energyInverse n x) := by + let ht : 1-κ ∈ Set.Icc 0 1 := ⟨sub_nonneg.mpr hκ.2, sub_le_self _ hκ.1⟩ + let ρ0 := mixture (1-κ) ht (F.map ρ) τ + have hle : (κ : ℂ) • (thermalState n r hr).op ≤ ρ0.op := by + rw [← hτ] + exact mixture_replacement_le κ hκ (F.map ρ) τ + have hf (σ : State n) (hm : FiniteMoment 4 σ) : FiniteEnergy (F.map σ) := + F.finiteEnergy σ (finiteMoment_finiteEnergy (by norm_num) hm) + have hfτ : FiniteEnergy τ := by simpa only [hτ] using thermalState_finiteEnergy n r hr + have hcross (σ : State n) (hm : FiniteMoment 4 σ) : + Summable (fun j => (-Real.log (p j))*(inner ℂ (b j) ((F.map σ).op (b j))).re) := + crossEntropy_finite ρ0 (F.map σ) (hf σ hm) hr hκ0 hκ.2 hle b p hp hs he + have hcτ := crossEntropy_finite ρ0 τ hfτ hr hκ0 hκ.2 hle b p hp hs he + have hα : 0 ≤ c*(1-κ)/a := div_nonneg (mul_nonneg hc.le (sub_nonneg.mpr hκ.2)) ha.le + have hβ' : 0 ≤ β/a := div_nonneg hβ ha.le + have hk : 0 < ζ/a := div_pos hζ ha + have hw (j : J) : 0 ≤ -Real.log (p j) := neg_nonneg.mpr (Real.log_nonpos (hp j).le + (hs.tsum_eq ▸ hs.summable.le_tsum j (fun i _ => (hp i).le))) + obtain ⟨B,hB,hform⟩ := logarithmic_slice_representation ρ0 hr hκ0 hκ.2 hle b p hp hs he + F.V F.F F.nonneg F.norm F.energy + obtain ⟨C,hC,hCform⟩ := combined_form_representation b + (fun j => ENNReal.ofReal (-Real.log (p j))) F.V hB hform hα hβ' + have hm := one_port_majorant F.map τ κ hκ c a β ζ hc ha ρ hmρ b p hp hs he hf hfτ hcross hcτ hmin + obtain ⟨L,hL,d,u,heat,hu,hinv,hop,hinj,hm7⟩ := sliced_gibbs_minimizer b + (fun j => -Real.log (p j)) hw F.V F.norm F.map F.ensemble hcross hC hα hβ' hCform hk ρ hmρ hm + let G : GibbsData n (ζ/a) ρ := ⟨C,hC,L,hL,d,u,hu,heat,hinv,hop,hinj,hm7⟩ + exact ⟨G,hCform⟩ + +namespace Regularization +variable {n : ℕ} (R : Regularization n) + +theorem minimum_gibbs (ρ σ : State n) (hmρ : FiniteMoment 4 ρ) (hmσ : FiniteMoment 4 σ) + {r : ℝ} (hr : 0 < r) (hτ : R.τ0 = thermalState n r hr) (hκ : 0 < R.κ) + (hmin : ∀ ρ' σ', FiniteMoment 4 ρ' → FiniteMoment 4 σ' → R.objective ρ σ ≤ R.objective ρ' σ') : + ∃ (J : Type) (b : HilbertBasis J ℂ (Fock n)) (p : J → ℝ), + (∀ j, 0 < p j) ∧ HasSum p 1 ∧ (∀ j, (R.output ρ σ).op (b j) = (p j : ℂ) • b j) ∧ + ∃ (G1 : GibbsData n (R.ζ/R.a1) ρ) (G2 : GibbsData n (R.ζ/R.a2) σ), + (∀ x, ENNReal.ofReal (inner ℂ x (G1.B x)).re = + ENNReal.ofReal (R.c*(1-R.κ)/R.a1)*sliceMoment b (fun j => ENNReal.ofReal (-Real.log (p j))) + (R.firstFlow σ (finiteMoment_finiteEnergy (by norm_num) hmσ)).V (energyInverse n x)+ + ENNReal.ofReal (R.b1/R.a1)*numberVectorMoment (energyInverse n x)) ∧ + (∀ x, ENNReal.ofReal (inner ℂ x (G2.B x)).re = + ENNReal.ofReal (R.c*(1-R.κ)/R.a2)*sliceMoment b (fun j => ENNReal.ofReal (-Real.log (p j))) + (R.secondFlow ρ (finiteMoment_finiteEnergy (by norm_num) hmρ)).V (energyInverse n x)+ + ENNReal.ofReal (R.b2/R.a2)*numberVectorMoment (energyInverse n x)) := by + have hle : (R.κ : ℂ) • (thermalState n r hr).op ≤ (R.output ρ σ).op := by + rw [← hτ] + exact mixture_replacement_le R.κ R.hκ (R.rawOutput ρ σ) R.τ0 + obtain ⟨J,b,p,hp,hs,he⟩ := exists_faithful_eigenbasis_of_thermal_le (R.output ρ σ) hr hκ hle + have hmin1 (ρ' : State n) (hmρ' : FiniteMoment 4 ρ') := hmin ρ' σ hmρ' hmσ + have hmin2 (σ' : State n) (hmσ' : FiniteMoment 4 σ') := hmin ρ σ' hmρ hmσ' + obtain ⟨G1,hG1⟩ := flow_minimum_gibbs + (R.firstFlow σ (finiteMoment_finiteEnergy (by norm_num) hmσ)) R.τ0 hr hτ R.κ R.hκ hκ + R.c R.a1 R.b1 R.ζ R.hc R.ha1 R.hb1.le R.hζ ρ hmρ b p hp hs he (by + intro ρ' hmρ' + have h := hmin1 ρ' hmρ' + dsimp only [objective] at h + change R.c*entropy (R.output ρ σ)-R.a1*entropy ρ+R.b1*energy ρ+R.ζ*numberMoment 4 ρ ≤ + R.c*entropy (R.output ρ' σ)-R.a1*entropy ρ'+R.b1*energy ρ'+R.ζ*numberMoment 4 ρ' + linarith) + obtain ⟨G2,hG2⟩ := flow_minimum_gibbs + (R.secondFlow ρ (finiteMoment_finiteEnergy (by norm_num) hmρ)) R.τ0 hr hτ R.κ R.hκ hκ + R.c R.a2 R.b2 R.ζ R.hc R.ha2 R.hb2.le R.hζ σ hmσ b p hp hs he (by + intro σ' hmσ' + have h := hmin2 σ' hmσ' + dsimp only [objective] at h + change R.c*entropy (R.output ρ σ)-R.a2*entropy σ+R.b2*energy σ+R.ζ*numberMoment 4 σ ≤ + R.c*entropy (R.output ρ σ')-R.a2*entropy σ'+R.b2*energy σ'+R.ζ*numberMoment 4 σ' + linarith) + exact ⟨J,b,p,hp,hs,he,G1,G2,hG1,hG2⟩ + +end Regularization +end + +open QuantumTrace TraceEnsemble + +namespace GibbsData +variable {n : ℕ} {k : ℝ} {ρ : State n} (G : GibbsData n k ρ) +theorem crossEntropy_hamiltonian {J : Type*} + (a : HilbertBasis J ℂ (Fock n)) (p : J → ℝ) (hp : ∀ j, 0 < p j) (hs : HasSum p 1) + (F : KrausFlow n) {α β : ℝ} (hα : 0 ≤ α) (hβ : 0 ≤ β) (hk : 0 < k) + (hform : ∀ x, ENNReal.ofReal (inner ℂ x (G.B x)).re = + ENNReal.ofReal α*sliceMoment a (fun j => ENNReal.ofReal (-Real.log (p j))) F.V (energyInverse n x)+ + ENNReal.ofReal β*numberVectorMoment (energyInverse n x)) + (σ : State n) (hm : FiniteMoment 4 σ) + (hc : Summable (fun j => (-Real.log (p j))*(inner ℂ (a j) ((F.map σ).op (a j))).re)) : + HasSum (fun j => (-Real.log (gibbsWeight G.eigenval j))*(inner ℂ (G.basis j) (σ.op (G.basis j))).re) + (k*numberMoment 4 σ+α*crossEntropy a p (F.map σ)+β*energy σ+Real.log (heatPartition G.eigenval)) := by + let _ := G.nonempty + obtain ⟨L,b,q,hq,hqt,he⟩ := exists_positive_eigenbasis (numberBasis n) σ.positive (trace_one_numberBasis σ) + have hv : HasSum (fun j => ‖diagonalVector b q j‖^2) 1 := by + simpa only [diagonalVector_norm_sq b q hq] using hqt + have hw (j : J) : 0 ≤ -Real.log (p j) := neg_nonneg.mpr (Real.log_nonpos (hp j).le + (hs.tsum_eq ▸ hs.summable.le_tsum j (fun i _ => (hp i).le))) + have hK := gibbs_slice_real_trace G.basis G.eigenval G.positive_eigenval b q hq hqt σ he hm + a (fun j => -Real.log (p j)) hw F.V F.norm (F.map σ) + (F.ensemble L _ σ hv (diagonalVector_operator b q hq hqt.summable σ.op he)) hc + G.positive hα hβ hform hk G.inverse_eigen + have htr := hasSum_trace_basis (numberBasis n) G.basis σ.positive (trace_one_numberBasis σ) + have hh := hK.add (htr.mul_left (Real.log (heatPartition G.eigenval))) + convert! hh using 1 + · funext j + rw [log_gibbsWeight G.eigenval G.heat] + ring + · simp only [mul_one, crossEntropy] + +end GibbsData + +def relativeEntropy {n : ℕ} {J : Type*} (b : HilbertBasis J ℂ (Fock n)) (p : J → ℝ) + (σ : State n) : ℝ := crossEntropy b p σ-entropy σ + +theorem flow_relative_entropy_identity {n : ℕ} {J : Type*} + (F : KrausFlow n) (τ : State n) (κ : ℝ) (hκ : κ ∈ Set.Icc 0 1) + (c a β ζ : ℝ) (ha : 0 < a) + (ρ : State n) (hmρ : FiniteMoment 4 ρ) + (b : HilbertBasis J ℂ (Fock n)) (p : J → ℝ) + (G : GibbsData n (ζ/a) ρ) + (he0 : ∀ j, (mixture (1-κ) ⟨sub_nonneg.mpr hκ.2, sub_le_self _ hκ.1⟩ (F.map ρ) τ).op (b j) = + (p j : ℂ) • b j) + (hτ : FiniteEnergy τ) + (hcross : ∀ σ, FiniteMoment 4 σ → + Summable (fun j => (-Real.log (p j))*(inner ℂ (b j) ((F.map σ).op (b j))).re)) + (hcτ : Summable (fun j => (-Real.log (p j))*(inner ℂ (b j) (τ.op (b j))).re)) + (hlog : ∀ σ, FiniteMoment 4 σ → crossEntropy G.basis (gibbsWeight G.eigenval) σ = + (ζ/a)*numberMoment 4 σ+(c*(1-κ)/a)*crossEntropy b p (F.map σ)+(β/a)*energy σ+ + Real.log (heatPartition G.eigenval)) + (σ : State n) (hmσ : FiniteMoment 4 σ) : + a*relativeEntropy G.basis (gibbsWeight G.eigenval) σ- + c*relativeEntropy b p (mixture (1-κ) ⟨sub_nonneg.mpr hκ.2, sub_le_self _ hκ.1⟩ (F.map σ) τ) = + (c*entropy (mixture (1-κ) ⟨sub_nonneg.mpr hκ.2, sub_le_self _ hκ.1⟩ (F.map σ) τ)- + a*entropy σ+β*energy σ+ζ*numberMoment 4 σ)- + (c*entropy (mixture (1-κ) ⟨sub_nonneg.mpr hκ.2, sub_le_self _ hκ.1⟩ (F.map ρ) τ)- + a*entropy ρ+β*energy ρ+ζ*numberMoment 4 ρ) := by + let ht : 1-κ ∈ Set.Icc 0 1 := ⟨sub_nonneg.mpr hκ.2, sub_le_self _ hκ.1⟩ + have hself := crossEntropy_self ρ (finiteMoment_finiteEnergy (by norm_num) hmρ) + G.basis (gibbsWeight G.eigenval) G.eigen + have hself0 := crossEntropy_self (mixture (1-κ) ht (F.map ρ) τ) + (mixture_finiteEnergy _ _ (F.finiteEnergy _ (finiteMoment_finiteEnergy (by norm_num) hmρ)) hτ) b p he0 + rw [crossEntropy_mixture b p (1-κ) ht (F.map ρ) τ (hcross ρ hmρ) hcτ] at hself0 + rw [hlog ρ hmρ] at hself + unfold relativeEntropy + rw [hlog σ hmσ, crossEntropy_mixture b p (1-κ) ht (F.map σ) τ (hcross σ hmσ) hcτ] + have hself' := congrArg (fun x => a*x) hself + have hcancel (x : ℝ) : a*(x/a) = x := mul_div_cancel₀ x ha.ne' + simp only [mul_add, ← mul_assoc, hcancel] at hself' + field_simp [ha.ne'] + linear_combination hself' - c*hself0 + +end EntropyPhotonNumber + +namespace TensorLp +variable {A B I J : Type*} + +theorem tensor_mul_moment (w : A → ℝ≥0∞) (u : B → ℝ≥0∞) (x : H A) (y : H B) : + vectorMoment (fun ab : A × B => w ab.1*u ab.2) (tensor x y) = + vectorMoment w x*vectorMoment u y := by + change (∑' ab : A × B, (w ab.1*u ab.2)*ENNReal.ofReal (‖x ab.1*y ab.2‖^2)) = _ + simp only [norm_mul, mul_pow, ENNReal.ofReal_mul (sq_nonneg _), ENNReal.tsum_prod'] + simp_rw [mul_mul_mul_comm (w _) (u _) (ENNReal.ofReal _) (ENNReal.ofReal _)] + simp only [ENNReal.tsum_mul_left, ENNReal.tsum_mul_right, vectorMoment] + +theorem ensemble_tensor_mul_moment [DecidableEq A] [DecidableEq B] + {v : I → H A} {z : J → H B} + (hv : Summable (fun i => ‖v i‖^2)) (hz : Summable (fun j => ‖z j‖^2)) + (w : A → ℝ≥0∞) (u : B → ℝ≥0∞) : + (∑' ij : I × J, vectorMoment (fun ab : A × B => w ab.1*u ab.2) (tensor (v ij.1) (z ij.2))) = + matrixMoment w (TraceEnsemble.operator v)*matrixMoment u (TraceEnsemble.operator z) := by + simp only [tensor_mul_moment, ENNReal.tsum_prod', ENNReal.tsum_mul_left, ENNReal.tsum_mul_right] + rw [matrixMoment_ensemble hv, matrixMoment_ensemble hz] + +end TensorLp + +namespace EntropyPhotonNumber +open TensorLp + +def powerMoment {n : ℕ} (m : ℕ) (ρ : State n) : ℝ≥0∞ := + matrixMoment (fun k => (1+(totalNumber k : ℝ≥0∞))^m) ρ.op + +theorem powerMoment_eq {n : ℕ} (m : ℕ) (ρ : State n) : + powerMoment m ρ = ∑' k, ENNReal.ofReal ((1+(totalNumber k : ℝ))^m*(entry ρ.op k k).re) := by + unfold powerMoment matrixMoment + congr 1 + funext k + rw [ENNReal.ofReal_mul (pow_nonneg (by positivity) _), + ENNReal.ofReal_pow (by positivity), + ENNReal.ofReal_add (by positivity) (by positivity), + ENNReal.ofReal_one, ENNReal.ofReal_natCast] + rfl + +theorem finiteMoment_iff {n : ℕ} (m : ℕ) (ρ : State n) : + FiniteMoment m ρ ↔ powerMoment m ρ < ⊤ := by + rw [powerMoment_eq] + have hp (k : NumberIndex n) : 0 ≤ (1+(totalNumber k : ℝ))^m*(entry ρ.op k k).re := + mul_nonneg (pow_nonneg (by positivity) _) (ρ.positive.re_inner_nonneg_right _) + constructor + · intro h + exact h.tsum_ofReal_lt_top + · intro h + have hs := ENNReal.summable_toReal h.ne + change Summable (fun k => (1+(totalNumber k : ℝ))^m*(entry ρ.op k k).re) + simpa only [ENNReal.toReal_ofReal (hp _)] using hs + +theorem beamOutput_powerMoment_le {n : ℕ} (η : ℝ) (hη : η ∈ Set.Icc 0 1) + (m : ℕ) (ρA ρB : State n) : + powerMoment m (beamOutput η hη ρA ρB) ≤ powerMoment m ρA*powerMoment m ρB := by + change matrixMoment _ (partialTrace (mixedVector η hη ρA ρB)) ≤ _ + rw [partialTrace_moment (mixedVector_norm η hη ρA ρB).summable] + calc + _ ≤ ∑' a, vectorMoment (fun ab : PairedIndex n => + (1+((totalNumber (fun j => ab.1 j+ab.2 j)) : ℝ≥0∞))^m) (mixedVector η hη ρA ρB a) := by + apply ENNReal.tsum_le_tsum + intro a + apply ENNReal.tsum_le_tsum + intro ab + apply mul_le_mul' _ le_rfl + apply pow_le_pow_left' + simp only [totalNumber, Finset.sum_add_distrib, Nat.cast_add] + exact add_le_add_right le_self_add 1 + _ = ∑' a : PairedIndex n, vectorMoment (fun ab : PairedIndex n => + (1+((totalNumber (fun j => ab.1 j+ab.2 j)) : ℝ≥0∞))^m) + (tensor (rootColumn ρA a.1) (rootColumn ρB a.2)) := by + congr 1 + funext a + exact beam_vector_moment η hη _ (fun k => (1+(totalNumber k : ℝ≥0∞))^m) + _ ≤ ∑' a : PairedIndex n, vectorMoment (fun ab : PairedIndex n => + (1+(totalNumber ab.1 : ℝ≥0∞))^m*(1+(totalNumber ab.2 : ℝ≥0∞))^m) + (tensor (rootColumn ρA a.1) (rootColumn ρB a.2)) := by + apply ENNReal.tsum_le_tsum + intro a + apply ENNReal.tsum_le_tsum + intro ab + apply mul_le_mul' _ le_rfl + dsimp only + rw [← mul_pow] + apply pow_le_pow_left' + simp only [totalNumber, Finset.sum_add_distrib, Nat.cast_add] + rw [add_mul, one_mul, mul_add, mul_one] + rw [← add_assoc] + calc + 1+((∑ j, ab.1 j : ℕ):ℝ≥0∞)+(∑ j, ab.2 j : ℕ) ≤ + 1+((∑ j, ab.1 j : ℕ):ℝ≥0∞)+(∑ j, ab.2 j : ℕ)+ + ((∑ j, ab.1 j : ℕ):ℝ≥0∞)*(∑ j, ab.2 j : ℕ) := le_self_add + _ = _ := by ac_rfl + _ = powerMoment m ρA*powerMoment m ρB := by + rw [ensemble_tensor_mul_moment (rootColumn_norm ρA).summable (rootColumn_norm ρB).summable + (fun k => (1+(totalNumber k : ℝ≥0∞))^m) (fun k => (1+(totalNumber k : ℝ≥0∞))^m), + rootColumn_operator, rootColumn_operator] + rfl + +theorem beamOutput_finiteMoment {n : ℕ} (η : ℝ) (hη : η ∈ Set.Icc 0 1) {m : ℕ} {ρA ρB : State n} + (hA : FiniteMoment m ρA) (hB : FiniteMoment m ρB) : FiniteMoment m (beamOutput η hη ρA ρB) := by + apply (finiteMoment_iff _ _).mpr + exact (beamOutput_powerMoment_le η hη m ρA ρB).trans_lt + (ENNReal.mul_lt_top ((finiteMoment_iff _ _).mp hA) ((finiteMoment_iff _ _).mp hB)) + +end EntropyPhotonNumber + +end + +end OAI diff --git a/lean/OAI/InformationTheory/PhotonNumber/Inequality.lean b/lean/OAI/InformationTheory/PhotonNumber/Inequality.lean new file mode 100644 index 0000000000000000000000000000000000000000..03d92853f7c8985d2c89f51cbc22ab6a5fe69ef4 --- /dev/null +++ b/lean/OAI/InformationTheory/PhotonNumber/Inequality.lean @@ -0,0 +1,707 @@ +import OAI.InformationTheory.PhotonNumber.ThermalLimit + +namespace OAI + +noncomputable section + +section +open scoped BigOperators ComplexConjugate Topology +open Filter + +namespace HilbertBasis +open scoped _root_.HilbertBasis +variable {I E A : Type*} [NormedAddCommGroup E] [InnerProductSpace ℂ E] + +theorem tendsto_isometries (b : HilbertBasis I ℂ E) {l : Filter A} + (U : A → E ≃ₗᵢ[ℂ] E) (V : E ≃ₗᵢ[ℂ] E) + (hb : ∀ i, Tendsto (fun a => U a (b i)) l (𝓝 (V (b i)))) (x : E) : + Tendsto (fun a => U a x) l (𝓝 (V x)) := by + classical + apply Metric.tendsto_nhds.mpr + intro ε hε + obtain ⟨s,hs⟩ := ((b.hasSum_repr x).eventually + (Metric.ball_mem_nhds x (by positivity : 0<ε/3))).exists + let v := ∑ i ∈ s, (b.repr x i) • b i + have hdist : dist v x<ε/3 := hs + have hv : Tendsto (fun a => U a v) l (𝓝 (V v)) := by + simp only [v,map_sum,map_smul] + exact tendsto_finsetSum s (fun i _ => (hb i).const_smul _) + filter_upwards [hv.eventually (Metric.ball_mem_nhds (V v) (by positivity : 0<ε/3))] with a ha + have h1 := dist_triangle (U a x) (U a v) (V x) + have h2 := dist_triangle (U a v) (V v) (V x) + have h3 : dist (U a v) (V v)<ε/3 := ha + rw [(U a).dist_map] at h1 + rw [V.dist_map] at h2 + rw [dist_comm v x] at hdist + linarith +end HilbertBasis + +namespace EntropyPhotonNumber +open QuantumTrace TensorLp + +theorem continuous_oneModeBeamCoefficient (k e a b : ℕ) : + Continuous (fun η => oneModeBeamCoefficient η k e a b) := by + unfold oneModeBeamCoefficient + split_ifs + · apply continuous_const.mul + apply continuous_finsetSum + intro p _hp + apply continuous_finsetSum + intro q _hq + split_ifs <;> fun_prop + · exact continuous_const + +theorem continuous_beamCoefficient {n : ℕ} (k e a b : NumberIndex n) : + Continuous (fun η => beamCoefficient η k e a b) := by + exact continuous_finsetProd _ (fun j _ => continuous_oneModeBeamCoefficient _ _ _ _) + +theorem tendsto_beamUnitary {n : ℕ} {A : Type*} {l : Filter A} {η : A → ℝ} + (hη : ∀ a, η a∈Set.Icc 0 1) {θ : ℝ} (hθ : θ∈Set.Icc 0 1) + (hlim : Tendsto η l (𝓝 θ)) (x : JointFock n) : + Tendsto (fun a => beamUnitary (η a) (hη a) x) l (𝓝 (beamUnitary θ hθ x)) := by + apply _root_.OAI.HilbertBasis.tendsto_isometries (jointSectorBasis n) + (fun a => beamUnitary (η a) (hη a)) (beamUnitary θ hθ) + rintro ⟨T,i⟩ + simp only [beamUnitary_apply_sector,BlockUnitary.rotated,← beam_sectorCoefficient] + refine tendsto_finsetSum _ (fun k _ => ?_) + exact (Complex.continuous_ofReal.continuousAt.tendsto.comp + ((continuous_beamCoefficient _ _ _ _).continuousAt.tendsto.comp hlim)).smul_const _ + +theorem tendsto_beamOutput_parameter {n : ℕ} {A : Type*} {l : Filter A} {η : A → ℝ} + (hη : ∀ a, η a∈Set.Icc 0 1) {θ : ℝ} (hθ : θ∈Set.Icc 0 1) + (hlim : Tendsto η l (𝓝 θ)) (ρ σ : State n) : + Tendsto (fun a => (beamOutput (η a) (hη a) ρ σ).op) l (𝓝 (beamOutput θ hθ ρ σ).op) := by + apply TraceEnsemble.tendsto_operator + (fun a => hasSum_slice_family (mixedVector_norm (η a) (hη a) ρ σ)) + (hasSum_slice_family (mixedVector_norm θ hθ ρ σ)) + intro bi + exact (sliceCLM bi.1).continuous.tendsto _ |>.comp + (tendsto_beamUnitary hη hθ hlim (tensor (rootColumn ρ bi.2.1) (rootColumn σ bi.2.2))) + +end EntropyPhotonNumber + +end + +namespace EntropyPhotonNumber +open scoped BigOperators Topology + +open Set Filter ThermalMetric + +@[simp] theorem g_zero : g 0 = 0 := by simp [g] + +theorem continuous_g : Continuous g := by + have h : g = fun t : ℝ => Real.negMulLog t - Real.negMulLog (t + 1) := by + funext t + simp only [g, Real.negMulLog_def] + ring + rw [h] + exact Real.continuous_negMulLog.sub + (Real.continuous_negMulLog.comp (continuous_id.add continuous_const)) + +theorem hasDerivAt_g {t : ℝ} (ht : 0 < t) : + HasDerivAt g (Real.log (t + 1) - Real.log t) t := by + have h₁ := Real.hasDerivAt_negMulLog (ne_of_gt ht) + have h₂ := (Real.hasDerivAt_negMulLog (ne_of_gt (by linarith : 0 < t + 1))).comp t + ((hasDerivAt_id t).add_const 1) + convert! h₁.sub h₂ using 1 + · funext x + simp only [g, Real.negMulLog_def, Pi.sub_apply, Function.comp_apply, id_eq] + ring + · ring + +theorem strictMonoOn_g : StrictMonoOn g (Ici 0) := by + apply strictMonoOn_of_deriv_pos (convex_Ici 0) continuous_g.continuousOn + intro x hx + rw [interior_Ici, mem_Ioi] at hx + rw [(hasDerivAt_g hx).deriv] + exact sub_pos.mpr (Real.strictMonoOn_log hx + (show 0 < x + 1 by linarith) (show x < x + 1 by linarith)) + +theorem g_nonneg {t : ℝ} (ht : 0 ≤ t) : 0 ≤ g t := by + simpa using strictMonoOn_g.monotoneOn (show 0 ∈ Ici (0 : ℝ) by simp) ht ht + +theorem g_pos {t : ℝ} (ht : 0 < t) : 0 < g t := by + simpa using strictMonoOn_g (show 0 ∈ Ici (0 : ℝ) by simp) (le_of_lt ht) ht + +theorem gInv_g {t : ℝ} (ht : 0 ≤ t) : gInv (g t) = t := by + apply csInf_eq_of_forall_ge_of_forall_gt_exists_lt (s := {u : ℝ | 0 ≤ u ∧ g t ≤ g u}) + · exact ⟨t, ht, le_rfl⟩ + · intro u hu + by_contra h + have hlt := strictMonoOn_g hu.1 ht (lt_of_not_ge h) + exact (not_lt_of_ge hu.2) hlt + · intro w hw + exact ⟨t, ⟨ht, le_rfl⟩, hw⟩ + +@[simp] theorem gInv_zero : gInv 0 = 0 := by simpa using gInv_g (t := 0) le_rfl + +theorem h_antitone {a b : ℝ} (ha : 0 min T.cap (1/((m:ℝ)+1))) atTop (𝓝 (0:ℝ)) + simpa only [min_eq_right T.cap_pos.le,eps] using + (tendsto_const_nhds.min tendsto_one_div_add_atTop_nhds_zero_nat : + Tendsto (fun m : ℕ => min T.cap (1/((m:ℝ)+1))) atTop (𝓝 (min T.cap 0))) +def kap (m : ℕ) : ℝ := min (1/((m:ℝ)+2)) + (T.eps m^2/(4*(T.eps m+2)*mixtureConstant T.r0^2)) +theorem kap_pos (m : ℕ) : 0 (T.kap_pos m).le) (fun _ => min_le_left _ _) + have hh : Tendsto (fun m : ℕ => 1/((m:ℝ)+1)) atTop (𝓝 (0:ℝ)) := + tendsto_one_div_add_atTop_nhds_zero_nat + have hcomp := hh.comp (tendsto_add_atTop_nat 1) + change Tendsto (fun m : ℕ => 1/(((m+1:ℕ):ℝ)+1)) atTop (𝓝 (0:ℝ)) at hcomp + simpa only [Nat.cast_add,Nat.cast_one,add_assoc,one_add_one_eq_two] using hcomp + +def setup (m : ℕ) : ThermalSetup where + η := T.η + θ := T.θ + κ := T.kap m + ε := T.eps m + d := T.d + r1 := T.r1 + r2 := T.r2 + hη := T.hη + hθ := T.hθ + hκ := ⟨T.kap_pos m,T.kap_lt_one m⟩ + hε := T.eps_pos m + hd := T.hd + hr1 := T.hr1 + hr2 := T.hr2 + slack_r := by + have hh := (min_le_left T.cap (1/((m:ℝ)+1))).trans + (min_le_left ((1-T.θ)*T.d/T.a) ((1-T.θ)*(T.d+1)/T.b)) + have hm := (le_div_iff₀ T.a_pos).mp hh + change T.eps m*T.a≤(1-T.θ)*T.d at hm + dsimp [a] at hm + nlinarith + slack_s := by + have hh := (min_le_left T.cap (1/((m:ℝ)+1))).trans + (min_le_right ((1-T.θ)*T.d/T.a) ((1-T.θ)*(T.d+1)/T.b)) + have hm := (le_div_iff₀ T.b_pos).mp hh + change T.eps m*T.b≤(1-T.θ)*(T.d+1) at hm + dsimp [b,a] at hm + nlinarith + small_κ := min_le_right _ _ + +def raw {n : ℕ} (ρ σ : State n) : State n := + beamOutput T.θ ⟨T.hθ.1.le,T.hθ.2.le⟩ + (beamOutput T.η ⟨T.hη.1.le,T.hη.2.le⟩ ρ σ) (thermalState n T.d T.hd) + +theorem out_limit {n : ℕ} (ρ σ : State n) : + Tendsto (fun m => ((T.setup m).out ρ σ).op) atTop (𝓝 (T.raw ρ σ).op) := by + have hc : Tendsto (fun m => (T.kap m : ℂ)) atTop (𝓝 0) := by + simpa using T.kap_limit.ofReal + have h1 := (hc.const_sub 1).smul_const (T.raw ρ σ).op + have h2 := hc.zero_smul_const (thermalState n T.r0 T.r0_pos).op + have hh := h1.add h2 + simpa only [sub_zero,one_smul,add_zero, + ThermalSetup.out,ThermalSetup.output_op,setup,ThermalSetup.raw,ThermalSetup.middle, + ThermalSetup.r0,raw,r0,a,Complex.ofReal_sub,Complex.ofReal_one,Function.comp_apply] using hh + +theorem out_entropy_limit {n : ℕ} {ρ σ : State n} (hρ : FiniteEnergy ρ) (hσ : FiniteEnergy σ) : + Tendsto (fun m => entropy ((T.setup m).out ρ σ)) atTop (𝓝 (entropy (T.raw ρ σ))) := by + let E := energy ρ+energy σ+energy (thermalState n T.d T.hd)+energy (thermalState n T.r0 T.r0_pos) + apply tendsto_entropy (E:=E) + · intro m + exact regularizedOutput_finiteEnergy T.η (1-T.θ) (T.kap m) + (T.setup m).η_mem (T.setup m).δ_mem (T.setup m).κ_mem + (thermalState_finiteEnergy n T.d T.hd) (thermalState_finiteEnergy n T.r0 T.r0_pos) hρ hσ + · exact beamOutput_finiteEnergy _ _ (beamOutput_finiteEnergy _ _ hρ hσ) + (thermalState_finiteEnergy n T.d T.hd) + · intro m + exact regularizedOutput_energy_bound T.η (1-T.θ) (T.kap m) + (T.setup m).η_mem (T.setup m).δ_mem (T.setup m).κ_mem + (thermalState_finiteEnergy n T.d T.hd) (thermalState_finiteEnergy n T.r0 T.r0_pos) hρ hσ + · have hh := beamOutput_energy_bound T.θ ⟨T.hθ.1.le,T.hθ.2.le⟩ + (beamOutput_finiteEnergy T.η ⟨T.hη.1.le,T.hη.2.le⟩ hρ hσ) (thermalState_finiteEnergy n T.d T.hd) + have hi := beamOutput_energy_bound T.η ⟨T.hη.1.le,T.hη.2.le⟩ hρ hσ + have hp := energy_nonneg (thermalState n T.r0 T.r0_pos) + dsimp [E,raw] + linarith + · exact T.out_limit ρ σ + +theorem entropy_tangent {n : ℕ} {ρ σ : State n} (hρ : FiniteMoment 4 ρ) (hσ : FiniteMoment 4 σ) : + 0≤(entropy (T.raw ρ σ)-n*g T.r0)/h T.r0- + (T.θ*T.η)*(entropy ρ-n*g T.r1)/h T.r1- + (T.θ*(1-T.η))*(entropy σ-n*g T.r2)/h T.r2 := by + have ho := T.out_entropy_limit (finiteMoment_finiteEnergy (by decide : 1≤4) hρ) + (finiteMoment_finiteEnergy (by decide : 1≤4) hσ) + have hw1 := ((T.kap_limit.const_sub 1).mul_const T.θ).mul_const T.η + have hw2 := ((T.kap_limit.const_sub 1).mul_const T.θ).mul_const (1-T.η) + have he := (((ho.sub_const (n*g T.r0)).div_const (h T.r0)).sub + ((hw1.mul_const (entropy ρ-n*g T.r1)).div_const (h T.r1))).sub + ((hw2.mul_const (entropy σ-n*g T.r2)).div_const (h T.r2)) + have hp := T.eps_limit.mul + (((hw1.div_const (h T.r1)).mul_const (thermalRelative T.r1 ρ)).add + ((hw2.div_const (h T.r2)).mul_const (thermalRelative T.r2 σ))) + have hh := he.add hp + simp only [sub_zero,one_mul,zero_mul,add_zero] at hh + apply ge_of_tendsto hh + filter_upwards [] with m + exact (T.setup m).base_nonnegative hρ hσ +end ThermalInterior +end + +section +open QuantumTrace FischerBeam TensorLp MvPolynomial + +theorem oneModeBeamCoefficient_one (k e a b : ℕ) : + oneModeBeamCoefficient 1 k e a b=if k=a ∧ e=b then 1 else 0 := by + classical + rw [oneModeBeamCoefficient_eq] + have hp : rotated 1 0 a b=monomial (degree a b) 1 := by + simp only [rotated,creatorA,creatorB,one_smul,zero_smul,sub_zero,zero_add, + X_pow_eq_monomial,monomial_mul_monomial,one_mul,degree] + simp only [Real.sqrt_one,sub_self,Real.sqrt_zero,hp,coeff_monomial,degree_eq_iff,eq_comm (a := a) (b := k),eq_comm (a := b) (b := e)] + split_ifs with hh + · rcases hh with ⟨rfl,rfl⟩ + rw [div_self (Real.sqrt_ne_zero'.mpr (by simp [weight_degree]; positivity)),mul_one] + · simp + +theorem beamCoefficient_one {n : ℕ} (k e a b : NumberIndex n) : + beamCoefficient 1 k e a b=if k=a ∧ e=b then 1 else 0 := by + classical + simp only [beamCoefficient,oneModeBeamCoefficient_one] + by_cases hh : k=a ∧ e=b + · rcases hh with ⟨rfl,rfl⟩; simp + · rw [ite_eq_right hh] + have hj : ∃ j, ¬ (k j=a j ∧ e j=b j) := by + by_contra hn + push Not at hn + exact hh ⟨funext (fun j => (hn j).1),funext (fun j => (hn j).2)⟩ + obtain ⟨j,hj⟩ := hj + exact Finset.prod_eq_zero (Finset.mem_univ j) (ite_eq_right hj) + +theorem beamUnitary_one {n : ℕ} (h1 : (1:ℝ)∈Set.Icc 0 1) (x : JointFock n) : + beamUnitary 1 h1 x=x := by + have he : (beamUnitary (n:=n) 1 h1).toContinuousLinearEquiv.toContinuousLinearMap=ContinuousLinearMap.id ℂ (JointFock n) := by + apply ContinuousLinearMap.ext_on + (Submodule.dense_iff_topologicalClosure_eq_top.mpr (jointNumberBasis n).dense_span) + rintro _ ⟨⟨a,b⟩,rfl⟩ + apply lp.ext + funext ⟨k,e⟩ + simp only [jointNumberBasis_apply] + change beamUnitary 1 h1 (lp.single 2 (a,b) 1 : JointFock n) (k,e)= + (lp.single 2 (a,b) 1 : JointFock n) (k,e) + simp only [beam_coordinate,beamCoefficient_one,lp.single_apply] + split_ifs <;> simp_all [eq_comm] + exact congrArg (fun A : JointFock n →L[ℂ] JointFock n => A x) he + +theorem beamOutput_one {n : ℕ} (h1 : (1:ℝ)∈Set.Icc 0 1) (ρ σ : State n) : + beamOutput 1 h1 ρ σ=ρ := by + apply State.ext_op + apply entry_ext + intro k l + have hv := (TraceEnsemble.hasSum_tensor_norm (rootColumn_norm ρ) (rootColumn_norm σ)).summable + have hh := partialTrace_entry hv k l + simp only [TraceEnsemble.tensor_entry (rootColumn_norm ρ).summable (rootColumn_norm σ).summable, + rootColumn_operator] at hh + have hs : HasSum (fun e => entry σ.op e e) (1:ℂ) := by + convert! σ.trace_one.mapL Complex.ofRealCLM using 1 + funext e + apply Complex.ext + · rfl + · exact (RCLike.nonneg_iff.mp (σ.positive.inner_nonneg_right (numberKet e))).2 + have ht := hs.mul_left (entry ρ.op k l) + rw [mul_one] at ht + have he := hh.unique ht + change entry (partialTrace (mixedVector 1 h1 ρ σ)) k l=entry ρ.op k l + have hm : mixedVector 1 h1 ρ σ=(fun ij => tensor (rootColumn ρ ij.1) (rootColumn σ ij.2)) := by + funext ij + exact beamUnitary_one h1 _ + rw [hm] + exact he +end + +section +open QuantumTrace ThermalMetric Filter + +theorem continuousAt_h_pos {r : ℝ} (hr : 0 Real.log (x+1)-Real.log x) r + have hs : ContinuousAt (fun x : ℝ => x+1) r := continuousAt_id.add continuousAt_const + apply ContinuousAt.sub + · exact hs.log (by linarith : r+1≠0) + · exact Real.continuousAt_log hr.ne' + +theorem tendsto_entropy_beamOutput_parameter {n : ℕ} {A : Type*} {l : Filter A} {η : A → ℝ} + (hη : ∀ a, η a∈Set.Icc 0 1) {θ : ℝ} (hθ : θ∈Set.Icc 0 1) + (hlim : Tendsto η l (𝓝 θ)) {ρ σ : State n} (hρ : FiniteEnergy ρ) (hσ : FiniteEnergy σ) : + Tendsto (fun a => entropy (beamOutput (η a) (hη a) ρ σ)) l + (𝓝 (entropy (beamOutput θ hθ ρ σ))) := by + exact tendsto_entropy (E:=energy ρ+energy σ) + (fun a => beamOutput_finiteEnergy (η a) (hη a) hρ hσ) + (beamOutput_finiteEnergy θ hθ hρ hσ) + (fun a => beamOutput_energy_bound (η a) (hη a) hρ hσ) + (beamOutput_energy_bound θ hθ hρ hσ) + (tendsto_beamOutput_parameter hη hθ hlim ρ σ) + +def interiorTransmission (m : ℕ) : ℝ := 1-1/((m:ℝ)+2) +theorem interiorTransmission_mem (m : ℕ) : interiorTransmission m∈Set.Ioo 0 1 := by + have h1 : 0<1/((m:ℝ)+2) := by positivity + have h2 : 1/((m:ℝ)+2)<1 := (div_lt_one (by positivity)).mpr (by linarith [Nat.cast_nonneg (α:=ℝ) m]) + exact ⟨sub_pos.mpr h2,sub_lt_self _ h1⟩ +theorem interiorTransmission_limit : Tendsto interiorTransmission atTop (𝓝 1) := by + have hh : Tendsto (fun m : ℕ => 1/((m:ℝ)+2)) atTop (𝓝 (0:ℝ)) := by + have hf : Tendsto (fun m : ℕ => 1/((m:ℝ)+1)) atTop (𝓝 (0:ℝ)) := + tendsto_one_div_add_atTop_nhds_zero_nat + have hc := hf.comp (tendsto_add_atTop_nat 1) + change Tendsto (fun m : ℕ => 1/(((m+1:ℕ):ℝ)+1)) atTop (𝓝 (0:ℝ)) at hc + simpa only [Nat.cast_add,Nat.cast_one,add_assoc,one_add_one_eq_two] using hc + change Tendsto (fun m : ℕ => 1-1/((m:ℝ)+2)) atTop (𝓝 (1:ℝ)) + simpa only [sub_zero] using hh.const_sub 1 + +theorem entropy_tangent_beam {n : ℕ} {η r1 r2 : ℝ} (hη : η∈Set.Ioo 0 1) + (hr1 : 0 { + η := η, θ := interiorTransmission m, d := 1, r1 := r1, r2 := r2, + hη := hη, hθ := interiorTransmission_mem m, hd := zero_lt_one, hr1 := hr1, hr2 := hr2 } + have hEρ := finiteMoment_finiteEnergy (by decide : 1≤4) hρ + have hEσ := finiteMoment_finiteEnergy (by decide : 1≤4) hσ + have hl := tendsto_entropy_beamOutput_parameter + (fun m => ⟨(interiorTransmission_mem m).1.le,(interiorTransmission_mem m).2.le⟩) + (show (1:ℝ)∈Set.Icc 0 1 from ⟨zero_le_one,le_rfl⟩) interiorTransmission_limit + (beamOutput_finiteEnergy η ⟨hη.1.le,hη.2.le⟩ hEρ hEσ) (thermalState_finiteEnergy n 1 zero_lt_one) + rw [beamOutput_one] at hl + have hr0 : 0<η*r1+(1-η)*r2 := add_pos (mul_pos hη.1 hr1) (mul_pos (sub_pos.mpr hη.2) hr2) + have hrlim : Tendsto (fun m => (T m).r0) atTop (𝓝 (η*r1+(1-η)*r2)) := by + have hh := (interiorTransmission_limit.mul_const (η*r1+(1-η)*r2)).add + ((interiorTransmission_limit.const_sub 1).mul_const 1) + simpa only [one_mul,sub_self,zero_mul,add_zero,T,ThermalInterior.r0,ThermalInterior.a] using hh + have hg := continuous_g.continuousAt.tendsto.comp hrlim + have hh := (continuousAt_h_pos hr0).tendsto.comp hrlim + have hmain := ((hl.sub (hg.const_mul (n:ℝ))).div hh (h_pos hr0).ne').sub + ((interiorTransmission_limit.mul_const η).mul_const (entropy ρ-n*g r1) |>.div_const (h r1)) + have hmain' := hmain.sub + ((interiorTransmission_limit.mul_const (1-η)).mul_const (entropy σ-n*g r2) |>.div_const (h r2)) + simp only [one_mul] at hmain' + apply ge_of_tendsto hmain' + filter_upwards [] with m + exact (T m).entropy_tangent hρ hσ +end + +namespace NumberCutoff +open QuantumTrace Filter InnerProductSpace + +variable {n : ℕ} (ρ : State n) (F : Finset (NumberIndex n)) +def mass : ℝ := ∑ k ∈ F, (entry ρ.op k k).re +def projection : Fock n →L[ℂ] Fock n := basisProjection (numberBasis n) F +def compressed : Fock n →L[ℂ] Fock n := projection F ∘L ρ.op ∘L projection F +def vacuum : Fock n →L[ℂ] Fock n := rankOne ℂ (numberKet (0:NumberIndex n)) (numberKet 0) + +theorem mass_le_one : mass ρ F≤1 := by + apply (ρ.trace_one.summable.sum_le_tsum F (fun k _ => ρ.positive.re_inner_nonneg_right (numberKet k))).trans_eq + exact ρ.trace_one.tsum_eq + +theorem compressed_positive : (compressed ρ F).IsPositive := by + have hh := ρ.positive.adjoint_conj (projection F) + simpa only [compressed, projection,basisProjection_adjoint] using hh + +theorem compressed_diagonal (k : NumberIndex n) : + entry (compressed ρ F) k k=if k∈F then entry ρ.op k k else 0 := by + classical + unfold entry compressed + rw [← numberBasis_apply n k] + simp only [ContinuousLinearMap.comp_apply] + rw [← ContinuousLinearMap.adjoint_inner_left,projection,basisProjection_adjoint, + basisProjection_apply_basis] + split_ifs <;> simp + +theorem vacuum_diagonal (k : NumberIndex n) : entry (vacuum (n:=n)) k k=if k=0 then 1 else 0 := by + classical + simp only [vacuum,entry,rankOne_apply,inner_smul_right,← numberBasis_apply, + orthonormal_iff_ite.mp (numberBasis n).orthonormal] + split_ifs <;> simp_all + +def state : State n where + op := compressed ρ F+((1-mass ρ F:ℝ):ℂ) • vacuum + positive := (compressed_positive ρ F).add + ((isPositive_rankOne_self (numberKet (0:NumberIndex n))).smul_of_nonneg + (by exact_mod_cast sub_nonneg.mpr (mass_le_one ρ F))) + trace_one := by + classical + have h1 : HasSum (fun k => if k∈F then (entry ρ.op k k).re else 0) (mass ρ F) := by + simpa only [mass, Finset.sum_ite_mem, Finset.inter_self] using + (hasSum_sum_of_ne_finset_zero (s:=F) (f:=fun k => if k∈F then (entry ρ.op k k).re else 0) + (by intro k hk; simp only [ite_eq_right hk])) + have h2 : HasSum (fun k : NumberIndex n => if k=0 then 1-mass ρ F else 0) (1-mass ρ F) := + hasSum_ite_eq 0 _ + convert! h1.add h2 using 1 + · funext k + simp only [entry,add_apply,smul_apply,inner_add_right,inner_smul_right] + change (entry (compressed ρ F) k k+((1-mass ρ F:ℝ):ℂ)*entry vacuum k k).re=_ + rw [compressed_diagonal,vacuum_diagonal] + split_ifs <;> simp [entry] + · ring + +theorem diagonal (k : NumberIndex n) : + (entry (state ρ F).op k k).re= + (if k∈F then (entry ρ.op k k).re else 0)+(if k=0 then 1-mass ρ F else 0) := by + classical + change (entry (compressed ρ F+((1-mass ρ F:ℝ):ℂ) • vacuum) k k).re=_ + simp only [entry,add_apply,smul_apply,inner_add_right,inner_smul_right] + change (entry (compressed ρ F) k k+((1-mass ρ F:ℝ):ℂ)*entry vacuum k k).re=_ + rw [compressed_diagonal,vacuum_diagonal] + split_ifs <;> simp [entry] + +theorem finiteMoment (m : ℕ) : FiniteMoment m (state ρ F) := by + classical + apply summable_of_ne_finset_zero (s:=insert 0 F) + intro k hk + have hF : k∉F := fun h => hk (Finset.mem_insert_of_mem h) + have h0 : k≠0 := by intro h; subst k; exact hk (Finset.mem_insert_self 0 F) + rw [diagonal,ite_eq_right hF,ite_eq_right h0] + simp + +theorem energy_le (hρ : FiniteEnergy ρ) : energy (state ρ F)≤energy ρ := by + classical + have he (k : NumberIndex n) : (totalNumber k:ℝ)*(entry (state ρ F).op k k).re= + if k∈F then (totalNumber k:ℝ)*(entry ρ.op k k).re else 0 := by + rw [diagonal] + by_cases h0 : k=0 + · subst k; simp [totalNumber] + · rw [ite_eq_right h0,add_zero]; split_ifs <;> simp [entry] + unfold energy + simp only [he] + have hs : HasSum (fun k => if k∈F then (totalNumber k:ℝ)*(entry ρ.op k k).re else 0) + (∑ k∈F, (totalNumber k:ℝ)*(entry ρ.op k k).re) := by + simpa only [Finset.sum_ite_mem, Finset.inter_self] using + (hasSum_sum_of_ne_finset_zero (s:=F) + (f:=fun k => if k∈F then (totalNumber k:ℝ)*(entry ρ.op k k).re else 0) + (by intro k hk; simp only [ite_eq_right hk])) + rw [hs.tsum_eq] + exact hρ.sum_le_tsum F (fun k _ => mul_nonneg (Nat.cast_nonneg _) + (ρ.positive.re_inner_nonneg_right (numberKet k))) + +theorem limit : Tendsto (fun F : Finset (NumberIndex n) => (state ρ F).op) atTop (𝓝 ρ.op) := by + have hm : Tendsto (mass ρ) atTop (𝓝 1) := ρ.trace_one + have hc : Tendsto (compressed ρ) atTop (𝓝 ρ.op) := by + apply tendsto_iff_norm_sub_tendsto_zero.mpr + apply squeeze_zero (fun _ => norm_nonneg _) + (fun F => (norm_sub_rev _ _).le.trans (double_compression_norm_le (numberBasis n) ρ.positive + (trace_one_numberBasis ρ) F)) + have hh := (Real.continuous_sqrt.continuousAt.tendsto.comp (hm.const_sub 1)).const_mul 2 + simpa only [sub_self,Real.sqrt_zero,mul_zero,numberBasis_apply,entry,projection,compressed,mass,Function.comp_apply] using hh + have hr : Tendsto (fun F => ((1 - mass ρ F : ℝ) : ℂ)) atTop (𝓝 0) := by + simpa using (hm.const_sub 1).ofReal + have hh := hc.add (hr.zero_smul_const (vacuum (n:=n))) + simpa only [add_zero,state] using hh +end NumberCutoff + +open QuantumTrace ThermalMetric Filter + +theorem entropy_tangent_finiteEnergy {n : ℕ} {η r1 r2 : ℝ} (hη : η∈Set.Ioo 0 1) + (hr1 : 0 NumberCutoff.energy_le ρ F hρ) le_rfl (NumberCutoff.limit ρ) + have hσlim := tendsto_entropy hσm hσ (fun F => NumberCutoff.energy_le σ F hσ) le_rfl (NumberCutoff.limit σ) + have hclim := tendsto_entropy (E:=energy ρ+energy σ) + (fun F => beamOutput_finiteEnergy η ⟨hη.1.le,hη.2.le⟩ (hρm F) (hσm F)) + (beamOutput_finiteEnergy η ⟨hη.1.le,hη.2.le⟩ hρ hσ) + (fun F => (beamOutput_energy_bound η ⟨hη.1.le,hη.2.le⟩ (hρm F) (hσm F)).trans + (add_le_add (NumberCutoff.energy_le ρ F hρ) (NumberCutoff.energy_le σ F hσ))) + (beamOutput_energy_bound η ⟨hη.1.le,hη.2.le⟩ hρ hσ) + (tendsto_beamOutput η ⟨hη.1.le,hη.2.le⟩ (NumberCutoff.limit ρ) (NumberCutoff.limit σ)) + have hl := (((hclim.sub_const ((n:ℝ)*g (η*r1+(1-η)*r2))).div_const (h (η*r1+(1-η)*r2))).sub + (((hρlim.sub_const ((n:ℝ)*g r1)).const_mul η).div_const (h r1))) + have hl' := hl.sub (((hσlim.sub_const ((n:ℝ)*g r2)).const_mul (1-η)).div_const (h r2)) + apply ge_of_tendsto hl' + filter_upwards [] with F + exact entropy_tangent_beam hη hr1 hr2 (NumberCutoff.finiteMoment ρ F 4) (NumberCutoff.finiteMoment σ F 4) + +def positiveReference (a : ℝ) (m : ℕ) : ℝ := a+1/((m:ℝ)+1) +theorem positiveReference_pos {a : ℝ} (ha : 0≤a) (m : ℕ) : 0 1/((m:ℝ)+1)) atTop (𝓝 (0:ℝ))).const_add a + change Tendsto (fun m : ℕ => a+1/((m:ℝ)+1)) atTop (𝓝 a) + simpa only [add_zero] using hh + +theorem reference_error_limit {a : ℝ} (ha : 0≤a) : + Tendsto (fun m => (g a-g (positiveReference a m))/h (positiveReference a m)) atTop (𝓝 0) := by + have hc : 0 ‖(g a-g (positiveReference a m))/h (positiveReference a m)‖) atTop (𝓝 0) := by + apply squeeze_zero (fun _ => norm_nonneg _) + (fun m => ?_) (by simpa only [sub_self,norm_zero,zero_div] using hbound) + rw [norm_div,Real.norm_eq_abs (h (positiveReference a m)),abs_of_pos (h_pos (positiveReference_pos ha m))] + exact div_le_div_of_nonneg_left (norm_nonneg _) hc + (h_antitone (positiveReference_pos ha m) (positiveReference_le ha m)) + apply tendsto_iff_norm_sub_tendsto_zero.mpr + simpa only [sub_zero] using hnorm + +theorem epni_entropy_interior {n : ℕ} (hn : 1≤n) {η : ℝ} (hη : η∈Set.Ioo 0 1) + {ρ σ : State n} (hρ : FiniteEnergy ρ) (hσ : FiniteEnergy σ) : + g (η*gInv (entropy ρ/n)+(1-η)*gInv (entropy σ/n)) ≤ + entropy (beamOutput η ⟨hη.1.le,hη.2.le⟩ ρ σ)/n := by + have hnR : 0<(n:ℝ) := by exact_mod_cast (lt_of_lt_of_le Nat.zero_lt_one hn) + let a := gInv (entropy ρ/n) + let b := gInv (entropy σ/n) + have ha : 0≤a := gInv_nonneg (div_nonneg (entropy_nonneg ρ) hnR.le) + have hb : 0≤b := gInv_nonneg (div_nonneg (entropy_nonneg σ) hnR.le) + have hga : g a=entropy ρ/n := g_gInv (div_nonneg (entropy_nonneg ρ) hnR.le) + have hgb : g b=entropy σ/n := g_gInv (div_nonneg (entropy_nonneg σ) hnR.le) + have hρeq : entropy ρ=(n:ℝ)*g a := by rw [hga]; field_simp + have hσeq : entropy σ=(n:ℝ)*g b := by rw [hgb]; field_simp + have hc0 : 0≤η*a+(1-η)*b := add_nonneg (mul_nonneg hη.1.le ha) (mul_nonneg (sub_nonneg.mpr hη.2.le) hb) + rcases eq_or_lt_of_le hc0 with hzero | hpos + · rw [← hzero,g_zero] + exact div_nonneg (entropy_nonneg _) hnR.le + have hrlim := ((positiveReference_limit a).const_mul η).add + ((positiveReference_limit b).const_mul (1-η)) + have hg := continuous_g.continuousAt.tendsto.comp hrlim + have hh := (continuousAt_h_pos hpos).tendsto.comp hrlim + have heρ := (reference_error_limit ha).const_mul ((n:ℝ)*η) + have heσ := (reference_error_limit hb).const_mul ((n:ℝ)*(1-η)) + have hout := ((hg.const_mul (n:ℝ)).const_sub + (entropy (beamOutput η ⟨hη.1.le,hη.2.le⟩ ρ σ))).div hh (h_pos hpos).ne' + have hmain := (hout.sub heρ).sub heσ + simp only [mul_zero,sub_zero] at hmain + have hnonneg : 0≤(entropy (beamOutput η ⟨hη.1.le,hη.2.le⟩ ρ σ)-(n:ℝ)*g (η*a+(1-η)*b))/h (η*a+(1-η)*b) := by + apply ge_of_tendsto hmain + filter_upwards [] with m + have ht := entropy_tangent_finiteEnergy hη (positiveReference_pos ha m) (positiveReference_pos hb m) hρ hσ + rw [hρeq,hσeq] at ht + convert! ht using 1 + dsimp only [Pi.div_apply,Function.comp_apply] + ring + have ht := (le_div_iff₀ (h_pos hpos)).mp hnonneg + change g (η*a+(1-η)*b)≤_ + exact (le_div_iff₀ hnR).mpr (by nlinarith) + +theorem epni_entropy_closed {n : ℕ} (hn : 1 ≤ n) {η : ℝ} (hη : η∈Set.Icc 0 1) + {ρ σ : State n} (hρ : FiniteEnergy ρ) (hσ : FiniteEnergy σ) : + g (η*gInv (entropy ρ/n)+(1-η)*gInv (entropy σ/n)) ≤ + entropy (beamOutput η hη ρ σ)/n := by + let ηm : ℕ → ℝ := fun m => interiorTransmission m*η+(1-interiorTransmission m)/2 + have hηm (m : ℕ) : ηm m∈Set.Ioo 0 1 := by + have ht := interiorTransmission_mem m + have hp := mul_nonneg ht.1.le hη.1 + have hu : interiorTransmission m*η ≤ interiorTransmission m := + mul_le_of_le_one_right ht.1.le hη.2 + dsimp [ηm] + constructor <;> linarith [ht.1,ht.2] + have hlim : Tendsto ηm atTop (𝓝 η) := by + have hh := (interiorTransmission_limit.mul_const η).add + ((interiorTransmission_limit.const_sub 1).div_const 2) + simpa only [one_mul,sub_self,zero_div,add_zero,ηm] using hh + have hout := (tendsto_entropy_beamOutput_parameter + (fun m => ⟨(hηm m).1.le,(hηm m).2.le⟩) hη hlim hρ hσ).div_const (n:ℝ) + have harg := (hlim.mul_const (gInv (entropy ρ/n))).add + ((hlim.const_sub 1).mul_const (gInv (entropy σ/n))) + have hg := continuous_g.continuousAt.tendsto.comp harg + exact le_of_tendsto_of_tendsto hg hout (Eventually.of_forall (fun m => epni_entropy_interior hn (hηm m) hρ hσ)) + +theorem entropy_photon_number_inequality + (n : ℕ) (hn : 1 ≤ n) (ρA ρB ρC : State n) + (hA : FiniteEnergy ρA) (hB : FiniteEnergy ρB) + (η : ℝ) (hη : η ∈ Set.Icc 0 1) + (hC : IsBeamSplitterOutput η ρA ρB ρC) : + η * gInv (entropy ρA / n) + (1 - η) * gInv (entropy ρB / n) ≤ + gInv (entropy ρC / n) := by + have hnR : 0<(n:ℝ) := by exact_mod_cast (lt_of_lt_of_le Nat.zero_lt_one hn) + have ha := gInv_nonneg (div_nonneg (entropy_nonneg ρA) hnR.le) + have hb := gInv_nonneg (div_nonneg (entropy_nonneg ρB) hnR.le) + have hw := add_nonneg (mul_nonneg hη.1 ha) (mul_nonneg (sub_nonneg.mpr hη.2) hb) + apply (le_gInv_iff hw (div_nonneg (entropy_nonneg ρC) hnR.le)).mpr + rw [output_eq hη hC] + exact epni_entropy_closed hn hη hA hB +end EntropyPhotonNumber + +end + +end OAI diff --git a/lean/OAI/InformationTheory/PhotonNumber/Interpolation.lean b/lean/OAI/InformationTheory/PhotonNumber/Interpolation.lean new file mode 100644 index 0000000000000000000000000000000000000000..5546696262c7305aaa1c9b9b07b2f0e67f6632db --- /dev/null +++ b/lean/OAI/InformationTheory/PhotonNumber/Interpolation.lean @@ -0,0 +1,671 @@ +import OAI.Analysis.Herglotz +import OAI.Analysis.DiagonalForms + +namespace OAI + +noncomputable section + +section +open scoped BigOperators ComplexConjugate ENNReal Topology +open MeasureTheory +open scoped ComplexConjugate +open scoped BigOperators ComplexConjugate +open scoped BigOperators +open MvPolynomial +open scoped BigOperators ComplexConjugate Classical +open Submodule +open ContinuousLinearMap +open scoped ENNReal +open Set Filter Topology Complex MeasureTheory +open Set Filter Topology Complex Metric +open MeasureTheory Set Filter Topology Complex Metric InnerProductSpace +open scoped ENNReal NNReal + +namespace EntropyPhotonNumber +open Herglotz MeasureTheory + +theorem boundaryB_f_sq {x : ℝ} (hx : 0 ≤ x) : + boundaryB ((f x ^ 2 : ℝ) : ℂ) = (b x : ℂ) := by + have hf := f_pos x + have hroot : Complex.sqrt ((f x ^ 2 : ℝ) : ℂ) = (f x : ℂ) := by + rw [Complex.sqrt_of_nonneg (by exact_mod_cast (sq_nonneg (f x))), Complex.ofReal_re, + Real.sqrt_sq hf.le] + have hsin : sinhc x = (f x)⁻¹ := by + rw [f_eq_inv_dslope, inv_inv] + rfl + have hz : (x : ℂ) * I ∈ closedSineDomain := by + constructor + · exact ⟨by simp, by simpa using Real.pi_pos.le, by simpa using hx⟩ + · change 0 < (csinc ((x : ℂ) * I)).re ∧ (csinc ((x : ℂ) * I)).im ≤ 0 + rw [csinc_mul_I, hsin] + exact ⟨inv_pos.mpr hf, by simp⟩ + have hw : (f x : ℂ)⁻¹ ∈ closedSineQuadrant := by + rw [← Complex.ofReal_inv] + exact ⟨inv_pos.mpr hf, by simp⟩ + have hi : closedSineInverse ((f x : ℂ)⁻¹) = (x : ℂ) * I := by + apply csinc_injOn_closedSineDomain (closedSineInverse_mem hw) hz + rw [csinc_closedSineInverse hw, csinc_mul_I, hsin, Complex.ofReal_inv] + rw [boundaryB, upperReflect_eq (by simp [-Complex.ofReal_pow]), hroot, hi, ccot, Complex.cos_mul_I, + ← Complex.ofReal_cosh, csinc_mul_I, ← Complex.ofReal_div, hsin, div_inv_eq_mul] + simp only [b, Complex.ofReal_mul, mul_comm] + +theorem boundaryB_eq_B {s : ℝ} (hs : s ∈ Ioc 0 1) : boundaryB (s : ℂ) = (B s : ℂ) := by + have he := boundaryB_f_sq (bParameter_nonneg hs) + rw [f_sq_bParameter hs] at he + exact he + +theorem exists_B_resolvent : ∃ μ : FiniteMeasure Angle, + (μ : Measure Angle) ≠ 0 ∧ + ∀ s : ℂ, 0 < s.im ∨ (s.im = 0 ∧ 0 < s.re) → + boundaryB s = 1 - (s - 1) * compactIntegral μ s := by + obtain ⟨μ, hμ⟩ := pick_divided_difference_of_continuous (P := fun s => -boundaryB s) + (fun s hs => (analyticAt_boundaryB hs).neg) + (fun s hs => by simpa using (boundaryB_im_neg hs).le) + (fun x hx => ⟨(continuousAt_boundaryB hx).neg, by simp [boundaryB_real hx]⟩) + have he (s : ℂ) (hs : 0 < s.im) : boundaryB s = 1 - (s - 1) * compactIntegral μ s := by + have h := hμ s hs + rw [boundaryB_one] at h + linear_combination -h + have hn : (μ : Measure Angle) ≠ 0 := by + intro hz + have h := he I (by simp) + simp only [compactIntegral, hz, integral_zero_measure, mul_zero, sub_zero] at h + have hi := boundaryB_im_neg (s := I) (by simp) + simp [h] at hi + refine ⟨μ, hn, ?_⟩ + intro s hs + rcases hs with hs | ⟨hi, hr⟩ + · exact he s hs + · have hb := upper_boundary_eq (continuousAt_boundaryB hr) + (continuousAt_const.sub ((continuousAt_id.sub continuousAt_const).mul + (continuousAt_compactIntegral μ hr))) he + have hs : (s.re : ℂ) = s := (eq_of_im_zero hi).symm + simpa only [Pi.sub_apply, Pi.mul_apply, id_eq, hs] using hb + +end EntropyPhotonNumber + +namespace EntropyPhotonNumber.Herglotz + +theorem compactIntegral_re_pos (μ : FiniteMeasure Angle) (hμ : (μ : Measure Angle) ≠ 0) + {s : ℂ} (hs : 0 < s.re) : 0 < (compactIntegral μ s).re := by + have hi := compactKernel_integrable μ (Or.inr hs) + have hre : (compactIntegral μ s).re = ∫ θ : Angle, + (compactKernel (boundaryParameter θ) (boundaryWeight θ) s).re ∂(μ : Measure Angle) := + (Complex.reCLM.integral_comp_comm hi).symm + have hp (θ : Angle) : 0 < (compactKernel (boundaryParameter θ) (boundaryWeight θ) s).re := by + have ht := boundaryParameter_mem θ + have hd : 0 < (1 + (s - 1) * (boundaryParameter θ : ℂ)).re := by + simp only [Complex.add_re, Complex.one_re, Complex.mul_re, Complex.sub_re, + Complex.ofReal_re, Complex.ofReal_im, mul_zero, sub_zero] + by_cases ha : boundaryParameter θ = 0 + · simp [ha] + · nlinarith [mul_pos hs (lt_of_le_of_ne ht.1 (Ne.symm ha)), ht.2] + simp only [compactKernel, Complex.div_re, Complex.ofReal_re, Complex.ofReal_im, + zero_mul, zero_div, add_zero] + exact div_pos (mul_pos (boundaryWeight_pos θ) hd) + (Complex.normSq_pos.mpr (compactDen_ne_zero ht (Or.inr hs))) + rw [hre, integral_pos_iff_support_of_nonneg (fun θ => (hp θ).le) (Complex.reCLM.integrable_comp hi)] + have he : Function.support (fun θ : Angle => + (compactKernel (boundaryParameter θ) (boundaryWeight θ) s).re) = univ := by + ext θ + simp only [Function.mem_support, mem_univ, iff_true] + exact (hp θ).ne' + rw [he] + exact Measure.measure_univ_pos.mpr hμ + +end EntropyPhotonNumber.Herglotz + +namespace EntropyPhotonNumber +open MeasureTheory Herglotz + +def resolventB (μ : FiniteMeasure Angle) (s : ℂ) : ℂ := + 1 - (s - 1) * compactIntegral μ s + +def resolventR (μ : FiniteMeasure Angle) (s : ℂ) : ℂ := + (s * compactIntegral μ s)⁻¹ + +theorem analyticAt_resolventB (μ : FiniteMeasure Angle) {s : ℂ} + (hs : 0 < s.im ∨ 0 < s.re) : AnalyticAt ℂ (resolventB μ) s := + analyticAt_const.sub ((analyticAt_id.sub analyticAt_const).mul (analyticAt_compactIntegral μ hs)) + +theorem analyticAt_resolventR (μ : FiniteMeasure Angle) (hμ : (μ : Measure Angle) ≠ 0) + {s : ℂ} (hs : 0 < s.im ∨ 0 < s.re) : AnalyticAt ℂ (resolventR μ) s := by + apply ((analyticAt_id.mul (analyticAt_compactIntegral μ hs))).inv + apply mul_ne_zero + · intro h + change s = 0 at h + rcases hs with hs | hs <;> simp [h] at hs + · rcases hs with hs | hs + · exact compactIntegral_ne_zero μ hμ hs + · intro h + have hp := compactIntegral_re_pos μ hμ hs + simp [h] at hp + +theorem resolventR_im_nonpos (μ : FiniteMeasure Angle) {s : ℂ} (hs : 0 < s.im) : + (resolventR μ s).im ≤ 0 := by + rw [resolventR, Complex.inv_im] + exact div_nonpos_of_nonpos_of_nonneg (neg_nonpos.mpr (mul_compactIntegral_im_nonneg μ hs)) + (Complex.normSq_nonneg _) + +theorem resolventR_real (μ : FiniteMeasure Angle) (x : ℝ) : (resolventR μ (x : ℂ)).im = 0 := by + rw [resolventR, compactIntegral_real, ← Complex.ofReal_mul, ← Complex.ofReal_inv] + exact Complex.ofReal_im _ + +theorem resolventR_real_pos (μ : FiniteMeasure Angle) (hμ : (μ : Measure Angle) ≠ 0) + {x : ℝ} (hx : 0 < x) : 0 < (resolventR μ (x : ℂ)).re := by + have hp := compactIntegral_real_pos μ hμ hx + rw [resolventR, compactIntegral_real, ← Complex.ofReal_mul, ← Complex.ofReal_inv, Complex.ofReal_re] + rw [compactIntegral_real, Complex.ofReal_re] at hp + exact inv_pos.mpr (mul_pos hx hp) + +theorem resolventR_stieltjes (μ : FiniteMeasure Angle) (hμ : (μ : Measure Angle) ≠ 0) : + ∃ c : ℝ, 0 ≤ c ∧ ∃ ν : FiniteMeasure Angle, + ∀ x : ℝ, 0 < x → (resolventR μ (x : ℂ)).re = c + + ∫ θ : Angle, (1 + (x - 1) * boundaryParameter θ)⁻¹ ∂(ν : Measure Angle) := by + apply compact_stieltjes_representation + · intro s hs + exact analyticAt_resolventR μ hμ (Or.inl hs) + · exact fun s hs => resolventR_im_nonpos μ hs + · intro x hx + exact ⟨analyticAt_resolventR μ hμ (Or.inr hx), resolventR_real μ x, + (resolventR_real_pos μ hμ hx).le⟩ + +theorem analytic_eqOn_rightHalfPlane_of_real_interval {F K : ℂ → ℂ} + (hF : AnalyticOnNhd ℂ F {z : ℂ | 0 < z.re}) + (hK : AnalyticOnNhd ℂ K {z : ℂ | 0 < z.re}) + (he : ∀ x : ℝ, x ∈ Ioo 0 1 → F (x : ℂ) = K (x : ℂ)) : + EqOn F K {z : ℂ | 0 < z.re} := by + apply hF.eqOn_of_preconnected_of_mem_closure hK (convex_halfSpace_re_gt 0).isPreconnected + (z₀ := (1 / 2 : ℂ)) (by norm_num) + let xs : ℕ → ℝ := fun n => 1 / 2 + 1 / ((n : ℝ) + 3) + have hxs (n : ℕ) : xs n ∈ Ioo 0 1 := by + have hn : 0 ≤ (n : ℝ) := Nat.cast_nonneg n + have hp : 0 < 1 / ((n : ℝ) + 3) := by positivity + have hlt : 1 / ((n : ℝ) + 3) < 1 / 2 := by + exact one_div_lt_one_div_of_lt (by norm_num) (by linarith) + dsimp [xs] + constructor <;> linarith + have ht : Tendsto xs atTop (𝓝 (1 / 2)) := by + have hd : Tendsto (fun n : ℕ => (1 : ℝ) / ((n : ℝ) + 3)) atTop (𝓝 0) := by + simpa only [Function.comp_def, Nat.cast_add, Nat.cast_ofNat] using + (tendsto_const_div_atTop_nhds_zero_nat (1 : ℝ)).comp (tendsto_add_atTop_nat 3) + simpa [xs] using (tendsto_const_nhds (x := (1 / 2 : ℝ))).add hd + have htc : Tendsto (fun n => (xs n : ℂ)) atTop (𝓝 (1 / 2 : ℂ)) := by + convert! Complex.continuous_ofReal.continuousAt.tendsto.comp ht using 1 + norm_num + apply mem_closure_of_tendsto htc + filter_upwards with n + refine ⟨he (xs n) (hxs n), ?_⟩ + simp only [mem_singleton_iff] + intro h + have hreal := congrArg Complex.re h + norm_num at hreal + have hp : 0 < 1 / ((n : ℝ) + 3) := by positivity + dsimp [xs] at hreal + norm_num at hreal + linarith + +theorem deriv_resolventB_on_original (μ : FiniteMeasure Angle) + (he : ∀ x : ℝ, x ∈ Ioc 0 1 → resolventB μ (x : ℂ) = (B x : ℂ)) + {x : ℝ} (hx : x ∈ Ioo 0 1) : + deriv (resolventB μ) (x : ℂ) = ((B x - x) / (2 * x * (1 - B x)) : ℝ) := by + have hd := ((analyticAt_resolventB μ (s := (x : ℂ)) (Or.inr hx.1)).differentiableAt.hasDerivAt).comp_ofReal + have hr := (hasDerivAt_B hx).ofReal_comp + apply hd.unique + apply hr.congr_of_eventuallyEq + filter_upwards [Ioo_mem_nhds hx.1 hx.2] with y hy + exact he y ⟨hy.1, hy.2.le⟩ + +theorem deriv_resolventB_ode (μ : FiniteMeasure Angle) (hμ : (μ : Measure Angle) ≠ 0) + (he : ∀ x : ℝ, x ∈ Ioc 0 1 → resolventB μ (x : ℂ) = (B x : ℂ)) + {s : ℂ} (hs : 0 < s.re) : + deriv (resolventB μ) s = -(s⁻¹ + resolventR μ s) / 2 := by + have ha : AnalyticOnNhd ℂ (resolventB μ) {z : ℂ | 0 < z.re} := + fun z hz => analyticAt_resolventB μ (Or.inr hz) + apply analytic_eqOn_rightHalfPlane_of_real_interval ha.deriv + (fun z hz => ((analyticAt_id.inv (by intro h; change z = 0 at h; simp [h] at hz)).add + (analyticAt_resolventR μ hμ (Or.inr hz))).neg.div_const) ?_ hs + intro x hx + change deriv (resolventB μ) (x : ℂ) = -((x : ℂ)⁻¹ + resolventR μ (x : ℂ)) / 2 + rw [deriv_resolventB_on_original μ he hx] + have hz : (x : ℂ) ≠ 0 := by exact_mod_cast hx.1.ne' + have hz1 : (x : ℂ) - 1 ≠ 0 := by exact_mod_cast sub_ne_zero.mpr hx.2.ne + have hg : compactIntegral μ (x : ℂ) ≠ 0 := by + intro h + have hp := compactIntegral_real_pos μ hμ hx.1 + simp [h] at hp + have hB := he x ⟨hx.1, hx.2.le⟩ + simp only [Complex.ofReal_div, Complex.ofReal_sub, Complex.ofReal_mul, + Complex.ofReal_ofNat, Complex.ofReal_one] + rw [← hB, resolventB, resolventR] + have heq : (1 : ℂ) - (1 - ((x : ℂ) - 1) * compactIntegral μ (x : ℂ)) = + ((x : ℂ) - 1) * compactIntegral μ (x : ℂ) := by ring + rw [heq] + field_simp [hz, hz1, hg] + ring + +theorem hasDerivAt_resolventB_one (μ : FiniteMeasure Angle) : + HasDerivAt (resolventB μ) (-compactIntegral μ 1) 1 := by + have hd := (hasDerivAt_const (1 : ℂ) (1 : ℂ)).sub + (((hasDerivAt_id (1 : ℂ)).sub_const 1).mul + ((analyticAt_compactIntegral μ (s := (1 : ℂ)) (Or.inr (by norm_num))).differentiableAt.hasDerivAt)) + convert! hd using 1 + simp only [id_eq, one_mul, sub_self, zero_mul, add_zero, zero_sub] + +theorem compactIntegral_one (μ : FiniteMeasure Angle) (hμ : (μ : Measure Angle) ≠ 0) + (he : ∀ x : ℝ, x ∈ Ioc 0 1 → resolventB μ (x : ℂ) = (B x : ℂ)) : + compactIntegral μ 1 = 1 := by + have hp := compactIntegral_real_pos μ hμ (x := 1) (by norm_num) + norm_num only [Complex.ofReal_one] at hp + have hg : compactIntegral μ 1 ≠ 0 := by intro h; simp [h] at hp + have hr := deriv_resolventB_ode μ hμ he (s := 1) (by norm_num) + rw [(hasDerivAt_resolventB_one μ).deriv, resolventR] at hr + simp only [one_mul, inv_one] at hr + have hquad : 2 * compactIntegral μ 1 ^ 2 - compactIntegral μ 1 - 1 = 0 := by + field_simp [hg] at hr + linear_combination -hr + have hf : (compactIntegral μ 1 - 1) * (2 * compactIntegral μ 1 + 1) = 0 := by + linear_combination hquad + rcases mul_eq_zero.mp hf with h | h + · exact sub_eq_zero.mp h + · have hh := congrArg Complex.re h + norm_num at hh + linarith + +theorem resolventB_real (μ : FiniteMeasure Angle) (x : ℝ) : (resolventB μ (x : ℂ)).im = 0 := by + rw [resolventB, compactIntegral_real] + simp + +theorem hasDerivAt_real_resolventB (μ : FiniteMeasure Angle) (hμ : (μ : Measure Angle) ≠ 0) + (he : ∀ x : ℝ, x ∈ Ioc 0 1 → resolventB μ (x : ℂ) = (B x : ℂ)) + {x : ℝ} (hx : 0 < x) : + HasDerivAt (fun t : ℝ => (resolventB μ (t : ℂ)).re) + (-(x⁻¹ + (resolventR μ (x : ℂ)).re) / 2) x := by + have hd := (analyticAt_resolventB μ (s := (x : ℂ)) (Or.inr hx)).differentiableAt.hasDerivAt + rw [deriv_resolventB_ode μ hμ he hx] at hd + convert! hd.real_of_complex using 1 + simp + +theorem strictAntiOn_real_resolventB (μ : FiniteMeasure Angle) (hμ : (μ : Measure Angle) ≠ 0) + (he : ∀ x : ℝ, x ∈ Ioc 0 1 → resolventB μ (x : ℂ) = (B x : ℂ)) : + StrictAntiOn (fun t : ℝ => (resolventB μ (t : ℂ)).re) (Ioi 0) := by + apply strictAntiOn_of_deriv_neg (convex_Ioi (0 : ℝ)) + · intro x hx + exact (hasDerivAt_real_resolventB μ hμ he hx).continuousAt.continuousWithinAt + · intro x hx + rw [interior_Ioi, mem_Ioi] at hx + rw [(hasDerivAt_real_resolventB μ hμ he hx).deriv] + have hp := resolventR_real_pos μ hμ hx + have hi : 0 < x⁻¹ := inv_pos.mpr hx + linarith + +theorem exists_analytic_stieltjes_B : ∃ Be : ℂ → ℂ, + AnalyticOnNhd ℂ Be {s : ℂ | 0 < s.im ∨ 0 < s.re} ∧ + (∀ x : ℝ, x ∈ Ioc 0 1 → Be (x : ℂ) = (B x : ℂ)) ∧ + (∀ x : ℝ, 0 < x → (Be (x : ℂ)).im = 0) ∧ + Be 1 = 1 ∧ deriv Be 1 = -1 ∧ + StrictAntiOn (fun x : ℝ => (Be (x : ℂ)).re) (Ioi 0) ∧ + ∃ c : ℝ, 0 ≤ c ∧ ∃ ν : FiniteMeasure Angle, + ∀ x : ℝ, 0 < x → + -deriv (fun t : ℝ => (Be (t : ℂ)).re) x = + (x⁻¹ + c + ∫ θ : Angle, (1 + (x - 1) * boundaryParameter θ)⁻¹ ∂(ν : Measure Angle)) / 2 := by + obtain ⟨μ, hμ, hb⟩ := exists_B_resolvent + have he (x : ℝ) (hx : x ∈ Ioc 0 1) : resolventB μ (x : ℂ) = (B x : ℂ) := + (hb (x : ℂ) (Or.inr ⟨Complex.ofReal_im x, hx.1⟩)).symm.trans (boundaryB_eq_B hx) + obtain ⟨c, hc, ν, hν⟩ := resolventR_stieltjes μ hμ + refine ⟨resolventB μ, fun s hs => analyticAt_resolventB μ hs, he, + fun x _ => resolventB_real μ x, ?_, ?_, strictAntiOn_real_resolventB μ hμ he, + c, hc, ν, ?_⟩ + · simp [resolventB] + · rw [(hasDerivAt_resolventB_one μ).deriv, compactIntegral_one μ hμ he] + · intro x hx + rw [(hasDerivAt_real_resolventB μ hμ he hx).deriv, hν x hx] + ring + +end EntropyPhotonNumber + +end + +open scoped BigOperators ComplexConjugate ENNReal Topology +open MeasureTheory +open scoped ComplexConjugate +open scoped BigOperators ComplexConjugate +open scoped BigOperators +open MvPolynomial +open scoped BigOperators ComplexConjugate Classical +open Submodule +open ContinuousLinearMap +open scoped ENNReal +open Set Filter Topology Complex MeasureTheory +open Set Filter Topology Complex Metric +open MeasureTheory Set Filter Topology Complex Metric InnerProductSpace +open scoped ENNReal NNReal +open Filter Topology + +namespace EntropyPhotonNumber + +section +open DiagonalForms.System MeasureTheory Set Filter Topology + +theorem logarithmicMean_exp_pair {m : ℝ} (hm : 0 < m) (x : ℝ) : + logMean (m*f x*Real.exp x) (m*f x*Real.exp (-x)) = m := by + by_cases hx : x = 0 + · simp [hx, logMean] + have hx2 : 2*x ≠ 0 := mul_ne_zero (by norm_num) hx + have hmf : 0 < m*f x := mul_pos hm (f_pos x) + have he : m*f x*Real.exp x ≠ m*f x*Real.exp (-x) := by + intro h + have ht := mul_left_cancel₀ hmf.ne' h + have ht' := Real.exp_injective ht + exact hx (by linarith) + rw [logMean, ite_eq_right he, Real.log_mul hmf.ne' (Real.exp_ne_zero _), + Real.log_mul hmf.ne' (Real.exp_ne_zero _), Real.log_exp, Real.log_exp] + have hn : m*f x*Real.exp (-x) - m*f x*Real.exp x = -2*m*x := by + rw [mul_assoc, mul_assoc, f_mul_exp_neg, f_mul_exp] + ring + rw [hn] + have hd : Real.log (m*f x) + -x - (Real.log (m*f x) + x) = -2*x := by ring + rw [hd] + field_simp + +theorem dualLogarithmicMean_exp_pair {m : ℝ} (hm : 0 < m) (x : ℝ) : + (m*f x*Real.exp x)*(m*f x*Real.exp (-x)) / + logMean (m*f x*Real.exp x) (m*f x*Real.exp (-x)) = m * f x ^ 2 := by + rw [logarithmicMean_exp_pair hm] + have he : Real.exp x * Real.exp (-x) = 1 := by rw [← Real.exp_add]; simp + field_simp + nlinarith [he] + +theorem comparison_basic_weights {P I J : Type*} (D : DiagonalForms.System P I J) + (m x y : P → ℝ) (hm : ∀ p, 0 < m p) + (hxP : D.Comparison (fun p => m p*f (x p)*Real.exp (x p))) + (hxM : D.Comparison (fun p => m p*f (x p)*Real.exp (-x p))) + (hyP : D.Comparison (fun p => m p*f (y p)*Real.exp (y p))) + (hyM : D.Comparison (fun p => m p*f (y p)*Real.exp (-y p))) : + D.Comparison m ∧ D.Comparison (fun p => m p*f (x p)^2) ∧ + D.Comparison (fun p => m p*f (y p)^2) := by + have hpos (t : P → ℝ) (p : P) : 0 < m p*f (t p)*Real.exp (t p) := + mul_pos (mul_pos (hm p) (f_pos _)) (Real.exp_pos _) + have hneg (t : P → ℝ) (p : P) : 0 < m p*f (t p)*Real.exp (-t p) := + mul_pos (mul_pos (hm p) (f_pos _)) (Real.exp_pos _) + refine ⟨?_, ?_, ?_⟩ + · simpa only [logarithmicMean_exp_pair (hm _)] using + D.comparison_logMean hxP hxM (hpos x) (hneg x) + · simpa only [dualLogarithmicMean_exp_pair (hm _)] using + D.comparison_dualLogMean hxP hxM (hpos x) (hneg x) + · simpa only [dualLogarithmicMean_exp_pair (hm _)] using + D.comparison_dualLogMean hyP hyM (hpos y) (hneg y) + +theorem B_f_sq_all (x : ℝ) : B (f x ^ 2) = b x := by + rcases le_total 0 x with hx | hx + · exact B_f_sq hx + · rw [← f_neg x, B_f_sq (neg_nonneg.mpr hx), b_neg] + +def genericAdditionalE (D : ℝ → ℝ) (s t : ℝ) : ℝ := + (∫ θ : UnitInterval, D ((1-θ.val)*s+θ.val*t))⁻¹ + +theorem genericAdditionalE_pos {D : ℝ → ℝ} (hc : ContinuousOn D (Ioi 0)) + (hp : ∀ q, 0 < q → 0 < D q) {s t : ℝ} (hs : 0 < s) (ht : 0 < t) : + 0 < genericAdditionalE D s t := by + apply inv_pos.mpr + have hct : Continuous (fun θ : UnitInterval => D ((1-θ.val)*s+θ.val*t)) := + hc.comp_continuous (by fun_prop) (affine_pos hs ht) + have hsup : Function.support (fun θ : UnitInterval => D ((1-θ.val)*s+θ.val*t)) = univ := by + ext θ + simp only [Function.mem_support, mem_univ, iff_true] + exact (hp _ (affine_pos hs ht θ)).ne' + rw [integral_pos_iff_support_of_nonneg (fun θ => (hp _ (affine_pos hs ht θ)).le) + (hct.integrable_of_hasCompactSupport (HasCompactSupport.of_compactSpace _)), hsup, + unitInterval_volume] + norm_num + +theorem genericAdditionalE_difference {B₀ D : ℝ → ℝ} + (hc : ContinuousOn D (Ioi 0)) (hp : ∀ q, 0 < q → 0 < D q) + (hd : ∀ q, 0 < q → HasDerivAt B₀ (-D q/2) q) + {s t : ℝ} (hs : 0 < s) (ht : 0 < t) : + 2*genericAdditionalE D s t*(B₀ s-B₀ t) = t-s := by + have hpos := genericAdditionalE_pos hc hp hs ht + let q (θ : ℝ) := (1-θ)*s+θ*t + have hqc : Continuous q := by dsimp [q]; fun_prop + have hqp (θ : ℝ) (hθ : θ ∈ Icc 0 1) : 0 < q θ := affine_pos hs ht ⟨θ, hθ⟩ + have hI : IntervalIntegrable (fun θ => -D (q θ)/2*(t-s)) volume 0 1 := by + apply ContinuousOn.intervalIntegrable + rw [uIcc_of_le (by norm_num : (0 : ℝ) ≤ 1)] + exact ((hc.comp hqc.continuousOn hqp).neg.div_const 2).mul_const (t-s) + have hFTC := intervalIntegral.integral_eq_sub_of_hasDerivAt + (f := fun θ => B₀ (q θ)) (f' := fun θ => -D (q θ)/2*(t-s)) (a := 0) (b := 1) (by + intro θ hθ + rw [uIcc_of_le (by norm_num : (0 : ℝ) ≤ 1)] at hθ + have hq : HasDerivAt q (t-s) θ := by + convert! (((hasDerivAt_const θ 1).sub (hasDerivAt_id θ)).mul_const s).add + ((hasDerivAt_id θ).mul_const t) using 1 + ring + exact (hd _ (hqp θ hθ)).comp θ hq) hI + have hei : (∫ θ : UnitInterval, D (q θ.val)) = ∫ θ in (0 : ℝ)..1, D (q θ) := + by convert! integral_unitInterval (fun θ => D (q θ)) using 1 + have hnorm : (t-s)*(∫ θ : UnitInterval, D (q θ.val)) = 2*(B₀ s-B₀ t) := by + rw [hei] + have hq0 : q 0 = s := by simp [q] + have hq1 : q 1 = t := by simp [q] + rw [hq0, hq1] at hFTC + rw [intervalIntegral.integral_mul_const, intervalIntegral.integral_div, + intervalIntegral.integral_neg] at hFTC + nlinarith + have hn : (∫ θ : UnitInterval, D (q θ.val)) ≠ 0 := by + exact (mt inv_eq_zero.mpr) (ne_of_gt hpos) + dsimp [genericAdditionalE] + calc + 2 * (∫ θ : UnitInterval, D ((1-θ.val)*s+θ.val*t))⁻¹ * (B₀ s-B₀ t) = + (2*(B₀ s-B₀ t))*(∫ θ : UnitInterval, D (q θ.val))⁻¹ := by ring + _ = t-s := by rw [← hnorm, mul_inv_cancel_right₀ hn] + +theorem continuous_genericAdditionalE_f {D : ℝ → ℝ} (hc : ContinuousOn D (Ioi 0)) + (hp : ∀ q, 0 < q → 0 < D q) (x : ℝ) : + Continuous (fun y => genericAdditionalE D (f x^2) (f y^2)) := by + have hf : Continuous (fun z : ℝ × UnitInterval => + D ((1-z.2.val)*f x^2+z.2.val*f z.1^2)) := by + have hv : Continuous (fun z : ℝ × UnitInterval => z.2.val) := + continuous_subtype_val.comp continuous_snd + exact hc.comp_continuous + (((continuous_const.sub hv).mul_const (f x^2)).add + (hv.mul ((continuous_f.comp continuous_fst).pow 2))) + (fun z => affine_pos (sq_pos_of_pos (f_pos x)) (sq_pos_of_pos (f_pos z.1)) z.2) + have hi : Continuous (fun y => ∫ θ : UnitInterval, + D ((1-θ.val)*f x^2+θ.val*f y^2)) := by + simpa only [setIntegral_univ] using + (continuous_parametric_integral_of_continuous (μ := volume) hf isCompact_univ) + exact hi.inv₀ (fun y => (mt inv_eq_zero.mpr) (genericAdditionalE_pos hc hp + (sq_pos_of_pos (f_pos x)) (sq_pos_of_pos (f_pos y))).ne') + +theorem scalar_minimum_off {B₀ D : ℝ → ℝ} + (hc : ContinuousOn D (Ioi 0)) (hp : ∀ q, 0 < q → 0 < D q) + (hd : ∀ q, 0 < q → HasDerivAt B₀ (-D q/2) q) + (hb : ∀ x, B₀ (f x^2) = b x) {x y : ℝ} (hxy : x+y ≠ 0) : + (b x+b y-(x-y)^2/(b x+b y+2*genericAdditionalE D (f x^2) (f y^2)))/2 = + f x*f y/f (x+y) := by + let e := genericAdditionalE D (f x^2) (f y^2) + have he : 0 < e := genericAdditionalE_pos hc hp + (sq_pos_of_pos (f_pos x)) (sq_pos_of_pos (f_pos y)) + have hrel := genericAdditionalE_difference hc hp hd + (sq_pos_of_pos (f_pos x)) (sq_pos_of_pos (f_pos y)) + rw [hb, hb] at hrel + change 2*e*(b x-b y) = f y^2-f x^2 at hrel + have hA : 0 < b x+b y+2*e := by positivity [b_pos x, b_pos y] + have hr : (b x-b y)*(b x+b y+2*e) = (x-y)*(x+y) := by + nlinarith [b_sq x, b_sq y] + rw [target_eq_of_add_ne_zero hxy] + change (b x+b y-(x-y)^2/(b x+b y+2*e))/2 = (y*b x+x*b y)/(x+y) + field_simp + nlinarith [congrArg (fun z : ℝ => z*(x-y)) hr] + +theorem scalar_minimum {B₀ D : ℝ → ℝ} + (hc : ContinuousOn D (Ioi 0)) (hp : ∀ q, 0 < q → 0 < D q) + (hd : ∀ q, 0 < q → HasDerivAt B₀ (-D q/2) q) + (hb : ∀ x, B₀ (f x^2) = b x) (x y : ℝ) : + (b x+b y-(x-y)^2/(b x+b y+2*genericAdditionalE D (f x^2) (f y^2)))/2 = + f x*f y/f (x+y) := by + by_cases hxy : x+y ≠ 0 + · exact scalar_minimum_off hc hp hd hb hxy + have hy : y = -x := by + have hz := not_ne_iff.mp hxy + linarith + subst y + let L (y : ℝ) := + (b x+b y-(x-y)^2/(b x+b y+2*genericAdditionalE D (f x^2) (f y^2)))/2 + let R (y : ℝ) := f x*f y/f (x+y) + have hL : Continuous L := by + have hden : ∀ y, b x+b y+2*genericAdditionalE D (f x^2) (f y^2) ≠ 0 := by + intro y + exact ne_of_gt (by positivity [b_pos x, b_pos y, + genericAdditionalE_pos hc hp (sq_pos_of_pos (f_pos x)) (sq_pos_of_pos (f_pos y))]) + exact (((continuous_const.add continuous_b).sub + ((continuous_const.sub continuous_id).pow 2 |>.div + ((continuous_const.add continuous_b).add + ((continuous_genericAdditionalE_f hc hp x).const_mul 2)) hden)).div_const 2) + have hR : Continuous R := + (continuous_const.mul continuous_f).div + (continuous_f.comp (continuous_const.add continuous_id)) (fun y => (f_pos (x+y)).ne') + have heq : L =ᶠ[𝓝[≠] (-x)] R := by + filter_upwards [self_mem_nhdsWithin] with y hy + apply scalar_minimum_off hc hp hd hb + simp only [mem_compl_iff, mem_singleton_iff] at hy + intro h + exact hy (by linarith) + exact tendsto_nhds_unique + (hL.continuousAt.mono_left nhdsWithin_le_nhds) + ((hR.continuousAt.mono_left nhdsWithin_le_nhds).congr' heq.symm) + +def interpolationQuadratic (m x y e : ℝ) (ξ φ : ℂ) : ℝ := + 1/4*(m*f x*Real.exp x*Complex.normSq (ξ-φ)) + + 1/4*(m*f x*Real.exp (-x)*Complex.normSq (ξ+φ)) + + 1/4*(m*f y*Real.exp y*Complex.normSq (ξ+φ)) + + 1/4*(m*f y*Real.exp (-y)*Complex.normSq (ξ-φ)) + + m*e*Complex.normSq φ + +theorem interpolationQuadratic_expand (m x y e : ℝ) (ξ φ : ℂ) : + interpolationQuadratic m x y e ξ φ = + m*(b x+b y)/2*Complex.normSq ξ + + m*((b x+b y)/2+e)*Complex.normSq φ - + m*(x-y)*(ξ.re*φ.re+ξ.im*φ.im) := by + unfold interpolationQuadratic + have hp (z : ℝ) : m*f z*Real.exp z = m*(b z+z) := by + rw [mul_assoc, f_mul_exp] + have hn (z : ℝ) : m*f z*Real.exp (-z) = m*(b z-z) := by + rw [mul_assoc, f_mul_exp_neg] + rw [hp, hp, hn, hn] + simp only [Complex.normSq_apply, Complex.sub_re, Complex.sub_im, + Complex.add_re, Complex.add_im] + ring + +theorem interpolationQuadratic_complete {m x y e : ℝ} (he : 0 < e) + (ξ φ : ℂ) : + interpolationQuadratic m x y e ξ φ = + m*((b x+b y-(x-y)^2/(b x+b y+2*e))/2)*Complex.normSq ξ + + m*(b x+b y+2*e)/2 * + Complex.normSq (φ-(((x-y)/(b x+b y+2*e) : ℝ) : ℂ)*ξ) := by + have hA : b x+b y+2*e ≠ 0 := ne_of_gt (by positivity [b_pos x, b_pos y]) + rw [interpolationQuadratic_expand] + simp only [Complex.normSq_apply, Complex.sub_re, Complex.sub_im, Complex.mul_re, + Complex.mul_im, Complex.ofReal_re, Complex.ofReal_im, zero_mul, sub_zero] + field_simp + ring + +theorem interpolationQuadratic_lower {B₀ D : ℝ → ℝ} + (hc : ContinuousOn D (Ioi 0)) (hp : ∀ q, 0 < q → 0 < D q) + (hd : ∀ q, 0 < q → HasDerivAt B₀ (-D q/2) q) + (hb : ∀ x, B₀ (f x^2) = b x) {m : ℝ} (hm : 0 < m) (x y : ℝ) (ξ φ : ℂ) : + fourWeightTarget m x y * Complex.normSq ξ ≤ + interpolationQuadratic m x y (genericAdditionalE D (f x^2) (f y^2)) ξ φ := by + have he := genericAdditionalE_pos hc hp (sq_pos_of_pos (f_pos x)) (sq_pos_of_pos (f_pos y)) + rw [interpolationQuadratic_complete he, scalar_minimum hc hp hd hb] + have hnon : 0 ≤ m*(b x+b y+2*genericAdditionalE D (f x^2) (f y^2))/2 * + Complex.normSq (φ-(((x-y)/(b x+b y+2*genericAdditionalE D (f x^2) (f y^2)) : ℝ) : ℂ)*ξ) := by + exact mul_nonneg (div_nonneg (mul_nonneg hm.le (by positivity [b_pos x, b_pos y])) (by norm_num)) + (Complex.normSq_nonneg _) + dsimp [fourWeightTarget] + convert le_add_of_nonneg_right hnon using 1 + ring + +theorem interpolationQuadratic_minimum {B₀ D : ℝ → ℝ} + (hc : ContinuousOn D (Ioi 0)) (hp : ∀ q, 0 < q → 0 < D q) + (hd : ∀ q, 0 < q → HasDerivAt B₀ (-D q/2) q) + (hb : ∀ x, B₀ (f x^2) = b x) {m : ℝ} (x y : ℝ) (ξ : ℂ) : + interpolationQuadratic m x y (genericAdditionalE D (f x^2) (f y^2)) ξ + ((((x-y)/(b x+b y+2*genericAdditionalE D (f x^2) (f y^2)) : ℝ) : ℂ)*ξ) = + fourWeightTarget m x y * Complex.normSq ξ := by + have he := genericAdditionalE_pos hc hp (sq_pos_of_pos (f_pos x)) (sq_pos_of_pos (f_pos y)) + rw [interpolationQuadratic_complete he, scalar_minimum hc hp hd hb] + simp only [sub_self, map_zero, mul_zero, add_zero] + dsimp [fourWeightTarget] + ring + +theorem comparison_interpolation_of_stieltjes {P I J : Type*} (S : DiagonalForms.System P I J) + {B₀ D : ℝ → ℝ} (hc : ContinuousOn D (Ioi 0)) (hp : ∀ q, 0 < q → 0 < D q) + (hd : ∀ q, 0 < q → HasDerivAt B₀ (-D q/2) q) (hb : ∀ x, B₀ (f x^2) = b x) + (m x y : P → ℝ) (hm : ∀ p, 0 < m p) + (hxP : S.Comparison (fun p => m p*f (x p)*Real.exp (x p))) + (hxM : S.Comparison (fun p => m p*f (x p)*Real.exp (-x p))) + (hyP : S.Comparison (fun p => m p*f (y p)*Real.exp (y p))) + (hyM : S.Comparison (fun p => m p*f (y p)*Real.exp (-y p))) + (hE : S.Comparison (fun p => m p*genericAdditionalE D (f (x p)^2) (f (y p)^2))) : + S.Comparison (fun p => fourWeightTarget (m p) (x p) (y p)) := by + apply S.comparison_fiveQuadratic + (δ := fun p => (x p-y p)/(b (x p)+b (y p)+2*genericAdditionalE D (f (x p)^2) (f (y p)^2))) + (S.comparison_smul hxP (by norm_num : (0 : ℝ) ≤ 1/4)) + (S.comparison_smul hxM (by norm_num : (0 : ℝ) ≤ 1/4)) + (S.comparison_smul hyP (by norm_num : (0 : ℝ) ≤ 1/4)) + (S.comparison_smul hyM (by norm_num : (0 : ℝ) ≤ 1/4)) hE + · intro p ξ + convert interpolationQuadratic_minimum hc hp hd hb (x p) (y p) ξ using 1 + dsimp [fiveQuadratic, interpolationQuadratic] + ring + · intro p ξ φ + convert interpolationQuadratic_lower hc hp hd hb (hm p) (x p) (y p) ξ φ using 1 + dsimp [fiveQuadratic, interpolationQuadratic] + ring + +end + +open DiagonalForms.System MeasureTheory Set Filter Topology Herglotz + +theorem four_weight_interpolation {P I J : Type*} (S : DiagonalForms.System P I J) + (m x y : P → ℝ) (hm : ∀ p, 0 < m p) + (hxP : S.Comparison (fun p => m p*f (x p)*Real.exp (x p))) + (hxM : S.Comparison (fun p => m p*f (x p)*Real.exp (-x p))) + (hyP : S.Comparison (fun p => m p*f (y p)*Real.exp (y p))) + (hyM : S.Comparison (fun p => m p*f (y p)*Real.exp (-y p))) : + S.Comparison (fun p => fourWeightTarget (m p) (x p) (y p)) := by + obtain ⟨μ, hμ, hμB⟩ := exists_B_resolvent + have he (q : ℝ) (hq : q ∈ Ioc 0 1) : resolventB μ (q : ℂ) = (B q : ℂ) := + (hμB (q : ℂ) (Or.inr ⟨Complex.ofReal_im q, hq.1⟩)).symm.trans (boundaryB_eq_B hq) + obtain ⟨c, hc, ν, hν⟩ := resolventR_stieltjes μ hμ + let D := resolventWeight (ν : Measure Angle) c boundaryParameter + let B₀ := fun q : ℝ => (resolventB μ (q : ℂ)).re + have hcont : ContinuousOn D (Ioi 0) := + continuousOn_resolventWeight (ν : Measure Angle) continuous_boundaryParameter boundaryParameter_mem + have hpos (q : ℝ) (hq : 0 < q) : 0 < D q := + resolventWeight_pos (ν : Measure Angle) hc boundaryParameter_mem hq + have hd (q : ℝ) (hq : 0 < q) : HasDerivAt B₀ (-D q/2) q := by + have h := hasDerivAt_real_resolventB μ hμ he hq + rw [hν q hq] at h + convert h using 1 + dsimp [D, B₀, resolventWeight] + ring + have hb (z : ℝ) : B₀ (f z^2) = b z := by + have hq : f z^2 ∈ Ioc (0 : ℝ) 1 := + ⟨sq_pos_of_pos (f_pos z), by nlinarith [f_pos z, f_le_one z]⟩ + dsimp [B₀] + rw [he _ hq, Complex.ofReal_re, B_f_sq_all] + obtain ⟨hmc, hsc, htc⟩ := comparison_basic_weights S m x y hm hxP hxM hyP hyM + have hE : S.Comparison (fun p => m p*genericAdditionalE D (f (x p)^2) (f (y p)^2)) := by + have h := S.comparison_resolvent_average (ν : Measure Angle) ⟨0, ⟨le_rfl, by positivity⟩⟩ hc + continuous_boundaryParameter boundaryParameter_mem hm + (fun p => sq_pos_of_pos (f_pos (x p))) (fun p => sq_pos_of_pos (f_pos (y p))) hmc hsc htc + simpa only [D, genericAdditionalE, div_eq_mul_inv] using h + exact comparison_interpolation_of_stieltjes S hcont hpos hd hb m x y hm hxP hxM hyP hyM hE + +end EntropyPhotonNumber + +end + +end OAI diff --git a/lean/OAI/InformationTheory/PhotonNumber/Minimum.lean b/lean/OAI/InformationTheory/PhotonNumber/Minimum.lean new file mode 100644 index 0000000000000000000000000000000000000000..252d4c6aae59bcb5002a5571745c1a66709eb552 --- /dev/null +++ b/lean/OAI/InformationTheory/PhotonNumber/Minimum.lean @@ -0,0 +1,1499 @@ +import OAI.InformationTheory.PhotonNumber.PhysicalMinimum +import OAI.InformationTheory.PhotonNumber.Duality + +namespace OAI + +noncomputable section + +section +open scoped BigOperators ComplexConjugate +open scoped BigOperators +open MvPolynomial +open scoped BigOperators ComplexConjugate Classical +open Submodule +open scoped ENNReal +open scoped ComplexConjugate +open ContinuousLinearMap +open Set Filter Topology _root_.Complex _root_.OAI.Complex Metric +open MeasureTheory Set Filter Topology _root_.Complex _root_.OAI.Complex Metric InnerProductSpace +open scoped ENNReal NNReal +open Filter Topology +open Set Filter Topology _root_.Complex _root_.OAI.Complex MeasureTheory + +namespace EntropyPhotonNumber + +section +open QuantumTrace Annihilation BeamLadder TensorLp ThermalMetric ThermalSpectral +open scoped ComplexConjugate +variable {n : ℕ} + +def twoPortLambda (η θ : ℝ) : Fin 2 → ℝ := ![θ*η,θ*(1-η)] + +def outputReference (η θ : ℝ) (a : Fin 2 → ℝ) (d : ℝ) : ℝ := + θ*(η*a 0+(1-η)*a 1)+(1-θ)*d + +theorem twoPortLambda_pos {η θ : ℝ} (hη : η ∈ Set.Ioo 0 1) (hθ : 0<θ) (i : Fin 2) : + 0.observable + (normalizedSlices η θ ⟨hη.1.le,hη.2.le⟩ ⟨hθ.1.le,hθ.2.le⟩ (ρ 0) (ρ 1) τD + (fun i => (G i).thermalSpace (a i) (ha i)) (twoPortLambda η θ) i Z)))+ + ((Real.sqrt ((1-κ)*κ):ℂ)*V.weakMean (outputReference η θ a d) j)* + EnsembleL2.mixtureFunctional (fun k => inverseWeight 3 (V.vector k)) + (fun k => inverseWeight 3 (O.vector k)) V.normalized.summable O.normalized.summable (1-κ) Z := by + change 0<η ∧ η<1 at hη + change 0<θ ∧ θ<1 at hθ + rw [G0.ambientDefect_centered] + unfold outputReference + have hp := replaced_threeport_centered_weak η θ κ (a 0) (a 1) d + ⟨hη.1.le,hη.2.le⟩ ⟨hθ.1.le,hθ.2.le⟩ (ρ 0) (ρ 1) τD m γ ω ρ0 h1 h2 + (G 0).weightedColumns (G 1).weightedColumns D M V O G0.weightedColumns hd hr0 hD hO hrepl j Z + rw [hp] + have hηc : η ∈ Set.Icc 0 1 := ⟨hη.1.le,hη.2.le⟩ + have hθc : θ ∈ Set.Icc 0 1 := ⟨hθ.1.le,hθ.2.le⟩ + have hl0 : normalizedSlices η θ hηc hθc (ρ 0) (ρ 1) τD + (fun i => (G i).thermalSpace (a i) (ha i)) (twoPortLambda η θ) 0 Z= + ((G 0).thermalSpace (a 0) (ha 0)).normalize (twoPortLambda η θ 0) + ((G 1).weightedColumns.rawSlice η hηc (D.rawSlice θ hθc Z)) := by + change ((G 0).thermalSpace (a 0) (ha 0)).normalize (twoPortLambda η θ 0) + (rawFirstSlice η θ hηc hθc (ρ 1) τD Z)=_ + rw [WeightedColumns.rawFirstSlice_physical (G 1).weightedColumns D] + have hl1 : normalizedSlices η θ hηc hθc (ρ 0) (ρ 1) τD + (fun i => (G i).thermalSpace (a i) (ha i)) (twoPortLambda η θ) 1 Z= + ((G 1).thermalSpace (a 1) (ha 1)).normalize (twoPortLambda η θ 1) + ((G 0).weightedColumns.rawSliceRight η hηc (D.rawSlice θ hθc Z)) := by + change ((G 1).thermalSpace (a 1) (ha 1)).normalize (twoPortLambda η θ 1) + (rawSecondSlice η θ hηc hθc (ρ 0) τD Z)=_ + rw [WeightedColumns.rawSecondSlice_physical (G 0).weightedColumns D] + simp only [Fin.sum_univ_two, hl0, hl1] + rw [(G 0).ambientDefect_normalize, (G 1).ambientDefect_normalize] + have hs (i : Fin 2) : + ((((1-κ)*twoPortLambda η θ i:ℝ):ℂ)*(Real.sqrt (twoPortLambda η θ i):ℂ)⁻¹)= + ((1-κ:ℝ):ℂ)*(Real.sqrt (twoPortLambda η θ i):ℂ) := by + rw [Complex.ofReal_mul, mul_assoc, ThermalDual.real_mul_inverse_sqrt (twoPortLambda_pos hη hθ.1 i)] + simp only [← mul_assoc, hs] + have hs0 : Real.sqrt (twoPortLambda η θ 0)=Real.sqrt θ*Real.sqrt η := Real.sqrt_mul hθ.1.le η + have hs1 : Real.sqrt (twoPortLambda η θ 1)=Real.sqrt θ*Real.sqrt (1-η) := Real.sqrt_mul hθ.1.le (1-η) + have hsq : (Real.sqrt ((1-κ)*κ):ℂ)*(Real.sqrt ((1-κ)*κ):ℂ)=(((1-κ)*κ:ℝ):ℂ) := by + rw [← Complex.ofReal_mul, Real.mul_self_sqrt (mul_nonneg (sub_nonneg.mpr hκ.2) hκ.1)] + rw [hs0, hs1, EnsembleL2.mixtureFunctional_apply] + have he : 1-(1-κ)=κ := by ring + rw [he] + change _=_+_*((Real.sqrt ((1-κ)*κ):ℂ)*(V.expectation Z-O.expectation Z)) + simp only [Complex.ofReal_mul, Complex.ofReal_sub, Complex.ofReal_one] at hsq ⊢ + linear_combination -(V.weakMean (θ*(η*a 0+(1-η)*a 1)+(1-θ)*d) j*(V.expectation Z-O.expectation Z))*hsq +end + +section +open QuantumTrace Annihilation ThermalMetric ThermalSpectral TensorLp +open scoped ComplexConjugate +variable {n : ℕ} + +theorem physical_defect_mode_bound (η θ κ ε d : ℝ) (a : Fin 2 → ℝ) + (hη : η ∈ Set.Ioo 0 1) (hθ : θ ∈ Set.Ioo 0 1) (hκ : κ ∈ Set.Icc 0 1) (hκ1 : κ<1) + (hd : 0 (G i).thermalSpace (a i) (ha i) + let w := fun i => (1-κ)*twoPortLambda η θ i + let L := normalizedSlices η θ ⟨hη.1.le,hη.2.le⟩ ⟨hθ.1.le,hθ.2.le⟩ (ρ 0) (ρ 1) τD S (twoPortLambda η θ) + have hw i : 0≤w i := mul_nonneg (sub_nonneg.mpr hκ.2) (twoPortLambda_pos hη hθ.1 i).le + have hk : 1-κ ∈ Set.Icc 0 1 := ⟨sub_nonneg.mpr hκ.2, by linarith [hκ.1]⟩ + have he0 : TraceEnsemble.operator S0.ensemble=ρ0.op := + S0.ensemble_operator ρ0.op ρ0.positive.isSymmetric G0.eigen + have hemix : TraceEnsemble.operator S0.ensemble=TraceEnsemble.operator + (EnsembleL2.mixture (fun k => inverseWeight 3 (V.vector k)) + (fun k => inverseWeight 3 (O.vector k)) (1-κ)) := by + rw [EnsembleL2.mixture_operator _ _ hk V.normalized.summable O.normalized.summable, + he0, show 1-(1-κ)=κ by ring] + exact hrepl.trans (congrArg₂ (·+·) (congrArg (((1-κ:ℝ):ℂ) • ·) V.density.symm) + (congrArg ((κ:ℂ) • ·) O.density.symm)) + have hephys : TraceEnsemble.operator S0.ensemble= + ((1-κ:ℝ):ℂ) • (beamOutput θ ⟨hθ.1.le,hθ.2.le⟩ + (beamOutput η ⟨hη.1.le,hη.2.le⟩ (ρ 0) (ρ 1)) τD).op+(κ:ℂ) • ω.op := by + rw [he0, ← output_eq ⟨hη.1.le,hη.2.le⟩ h1, + ← output_eq ⟨hθ.1.le,hθ.2.le⟩ h2] + exact hrepl + have hhL : ∀ Z, Z ∈ CenteredTests.operatorSpace S0.basis S0.p → + ∑ i, w i*(S i).pquad ThermalSpectral.thermalWeight (L i Z) ≤ S0.pquad ThermalSpectral.thermalWeight Z := by + intro Z hZ + exact physical_thermal_contraction η θ κ ε ⟨hη.1.le,hη.2.le⟩ ⟨hθ.1.le,hθ.2.le⟩ hκ hκ1 + (ρ 0) (ρ 1) τD ω S0 S (twoPortLambda η θ) (twoPortLambda_pos hη hθ.1) + (G 0).eigen (G 1).eigen hephys hh₁ hh₂ hr hs Z hZ + have hh := ThermalDual.dual_bound_from_core S0 S w hw L + (G0.ambientDefect _ hr0 j) (fun i => (G i).ambientDefect (a i) (ha i) j) + (fun k => inverseWeight 3 (V.vector k)) (fun k => inverseWeight 3 (O.vector k)) + hk V.normalized O.normalized hemix + ((Real.sqrt ((1-κ)*κ):ℂ)*V.weakMean (outputReference η θ a d) j) hhL + (fun Z _ => physical_defect_convolution η θ κ d a hη hθ hκ hd ha hr0 + ρ τD m γ ω ρ0 h1 h2 G G0 D M V O hD hO hrepl j Z) + change ‖G0.defect (outputReference η θ a d) hr0 j‖ ≤ _ at hh + change ‖G0.defect (outputReference η θ a d) hr0 j‖ ≤ + Real.sqrt (∑ i, ((1-κ)*twoPortLambda η θ i)*‖(G i).ambientDefect (a i) (ha i) j‖^2)+ + ‖(Real.sqrt ((1-κ)*κ):ℂ)*V.weakMean (outputReference η θ a d) j‖* + mixtureConstant (outputReference η θ a d) at hh + simpa only [SpectralLogData.ambientDefect_norm, norm_mul, Complex.norm_real, + Real.norm_of_nonneg (Real.sqrt_nonneg _)] using hh +end + +section +open QuantumTrace Annihilation ThermalMetric ThermalSpectral TensorLp BeamLadder +open scoped ComplexConjugate +variable {n : ℕ} + +theorem physical_mean_covariance (η θ d : ℝ) (a : Fin 2 → ℝ) + (hη : η ∈ Set.Ioo 0 1) (hθ : θ ∈ Set.Ioo 0 1) + (hd : 0 (1-κ)*twoPortLambda η θ i) + (fun i => mul_nonneg (sub_nonneg.mpr hκ.2) (twoPortLambda_pos hη hθ.1 i).le) + (fun j => ‖G0.defect (outputReference η θ a d) hr0 j‖) + (fun j => ‖V.weakMean (outputReference η θ a d) j‖) + (fun i j => ‖(G i).defect (a i) (ha i) j‖) (fun i j => ‖(G i).annihilationMean j‖) + (fun j => norm_nonneg (G0.defect (outputReference η θ a d) hr0 j)) (fun j => norm_nonneg (V.weakMean (outputReference η θ a d) j)) (mixtureConstant (outputReference η θ a d)) κ + (mixtureConstant_pos hr0).le hκ + (physical_mean_bound η θ κ d a hη hθ hκ.2 hd ha hr0 ρ τD m γ ω h1 h2 G D M V O hD hO) + (physical_defect_mode_bound η θ κ ε d a hη hθ hκ hκ1 hd ha hr0 ρ τD m γ ω ρ0 h1 h2 G G0 D M V O hD hO hrepl hh₁ hh₂ hr hs) + +theorem physical_defect_estimate (η θ κ ε d : ℝ) (a : Fin 2 → ℝ) + (hη : η ∈ Set.Ioo 0 1) (hθ : θ ∈ Set.Ioo 0 1) (hκ : κ ∈ Set.Icc 0 1) (hκ1 : κ<1) + (hd : 0 sq_nonneg _) + have hA : 0≤∑ i, ((1-κ)*twoPortLambda η θ i)*(∑ j, ‖(G i).defect (a i) (ha i) j‖^2) := Finset.sum_nonneg (fun i _ => mul_nonneg + (mul_nonneg (sub_nonneg.mpr hκ.2) (twoPortLambda_pos hη hθ.1 i).le) + (Finset.sum_nonneg (fun j _ => sq_nonneg _))) + have hM : 0≤∑ i, ((1-κ)*twoPortLambda η θ i)*(∑ j, ‖(G i).annihilationMean j‖^2) := Finset.sum_nonneg (fun i _ => mul_nonneg + (mul_nonneg (sub_nonneg.mpr hκ.2) (twoPortLambda_pos hη hθ.1 i).le) + (Finset.sum_nonneg (fun j _ => sq_nonneg _))) + have hh := ThermalDual.defect_young (Real.sqrt_nonneg _) (Real.sqrt_nonneg _) (Real.sqrt_nonneg _) + (mixtureConstant_pos hr0) hκ.1 hε hk (physical_defect_triangle η θ κ ε d a hη hθ hκ hκ1 hd ha hr0 ρ τD m γ ω ρ0 h1 h2 G G0 D M V O hD hO hrepl hh₁ hh₂ hr hs) + simpa only [Real.sq_sqrt hq0, Real.sq_sqrt hA, Real.sq_sqrt hM] using hh +end EntropyPhotonNumber + +namespace BeamLadder +open EntropyPhotonNumber QuantumTrace Annihilation TensorLp +variable {n : ℕ} {I J : Type*} + +theorem output_lower_square (j : Fin n) (x : I → JointFock n) (z : J → Fock n) + (hx : Summable (fun i => ‖x i‖^2)) (hz : Summable (fun j => ‖z j‖^2)) + (he : CrossEnsemble.operator (fun ie : I × NumberIndex n => slice (inverse (x ie.1)) ie.2) + (fun ie : I × NumberIndex n => slice (inverse (x ie.1)) ie.2)= + CrossEnsemble.operator (fun j => inverseWeight 3 (z j)) (fun j => inverseWeight 3 (z j))) : + (∑' i, ‖lowerL j (x i)‖^2) = ∑' i, ‖sandwich 0 3 (by omega) j (z i)‖^2 := by + have hi := CrossEnsemble.applied_summable hx inverse + have hl := CrossEnsemble.applied_summable hx (lowerL j) + have hzi := CrossEnsemble.applied_summable hz (inverseWeight 3) + have hzl := CrossEnsemble.applied_summable hz (sandwich 0 3 (by omega) j) + have his := slice_family_summable _ hi + have hls := slice_family_summable _ hl + have heL := CrossEnsemble.shifted_both_operator_eq _ _ _ _ his hls hzi hzl + (up j) (fun k => (Real.sqrt ((k j:ℝ)+1):ℂ)) + (fun ie k => lowerL_inverse_apply j (x ie.1) k ie.2) + (fun i k => single_lower_inverse_apply j (z i) k) he + let bas : HilbertBasis (NumberIndex n) ℂ (Fock n) := HilbertBasis.ofRepr (LinearIsometryEquiv.refl ℂ _) + have hp := CrossEnsemble.pairing_eq_of_operator_eq bas hls hls hzl hzl heL 1 + rw [← pairing_liftLeft _ _ hl hl, liftLeft_one] at hp + have hh1 := (EnsembleL2.self_inner_hasSum (fun i => lowerL j (x i)) hl).tsum_eq + have hh2 := (EnsembleL2.self_inner_hasSum (fun i => sandwich 0 3 (by omega) j (z i)) hzl).tsum_eq + simpa only [CrossEnsemble.pairing,one_apply_eq_self,hh1,hh2,Complex.ofReal_inj] using hp +end BeamLadder + +namespace EnsembleL2 +variable {E I : Type*} [NormedAddCommGroup E] [InnerProductSpace ℂ E] + +theorem real_smul_add_square (c d : ℝ) (x y : E) : + ‖(c:ℂ) • x+(d:ℂ) • y‖^2=c^2*‖x‖^2+d^2*‖y‖^2+2*c*d*(inner ℂ x y).re := by + rw [norm_add_sq (𝕜:=ℂ)] + simp only [norm_smul,Complex.norm_real,Real.norm_eq_abs,mul_pow,sq_abs, + inner_smul_left,inner_smul_right,Complex.conj_ofReal] + change _+2*((d:ℂ)*((c:ℂ)*inner ℂ x y)).re+_=_ + simp only [Complex.mul_re, Complex.ofReal_re, Complex.ofReal_im,zero_mul,sub_zero] + ring + +theorem real_smul_add_hasSum (c d : ℝ) (x y : I → E) (a b : ℝ) (v : ℂ) + (hx : HasSum (fun i => ‖x i‖^2) a) (hy : HasSum (fun i => ‖y i‖^2) b) + (hxy : HasSum (fun i => inner ℂ (x i) (y i)) v) : + HasSum (fun i => ‖(c:ℂ) • x i+(d:ℂ) • y i‖^2) (c^2*a+d^2*b+2*c*d*v.re) := by + simpa only [real_smul_add_square,Complex.reCLM_apply] using + ((hx.mul_left (c^2)).add (hy.mul_left (d^2))).add + ((hxy.mapL Complex.reCLM).mul_left (2*c*d)) +end EnsembleL2 + +namespace TensorLp +variable {A B I J : Type*} +theorem tensorFamily_inner (x x' : I → H A) (y y' : J → H B) + (hx : Summable (fun i => ‖x i‖^2)) (hx' : Summable (fun i => ‖x' i‖^2)) + (hy : Summable (fun j => ‖y j‖^2)) (hy' : Summable (fun j => ‖y' j‖^2)) + (a b : ℂ) (hleft : HasSum (fun i => inner ℂ (x i) (x' i)) a) + (hright : HasSum (fun j => inner ℂ (y j) (y' j)) b) : + HasSum (fun ij : I × J => inner ℂ (tensor (x ij.1) (y ij.2)) (tensor (x' ij.1) (y' ij.2))) (a*b) := by + have hs := (EnsembleL2.inner_sum + (fun ij : I × J => tensor (x ij.1) (y ij.2)) + (fun ij : I × J => tensor (x' ij.1) (y' ij.2)) + (tensorFamily_summable x y hx hy) (tensorFamily_summable x' y' hx' hy')).summable + simp only [inner_tensor] at hs + simpa only [inner_tensor] using hleft.mul hright hs +end TensorLp + +namespace EntropyPhotonNumber.WeightedColumns +open QuantumTrace Annihilation BeamLadder TensorLp +variable {n : ℕ} {ρ σ τ : State n} + +def lowerEnergy (X : WeightedColumns ρ) (j : Fin n) : ℝ := + ∑' i, ‖sandwich 0 3 (by omega) j (X.vector i)‖^2 + +theorem weakMean_hasSum (X : WeightedColumns ρ) (r : ℝ) (j : Fin n) : + HasSum (fun i => inner ℂ (sandwich 0 3 (by omega) j (X.vector i)) + (inverseWeight 3 (X.vector i))) (X.weakMean r j) := by + rw [X.weakMean_trace] + exact (EnsembleL2.inner_sum _ _ + (CrossEnsemble.applied_summable X.summable (sandwich 0 3 (by omega) j)) + X.normalized.summable).summable.hasSum + +theorem physical_lowerEnergy (η : ℝ) (hη : η ∈ Set.Icc 0 1) + (r s : ℝ) (j : Fin n) (X : WeightedColumns ρ) (Y : WeightedColumns σ) + (T : WeightedColumns τ) (hτ : IsBeamSplitterOutput η ρ σ τ) : + T.lowerEnergy j=η*X.lowerEnergy j+(1-η)*Y.lowerEnergy j+ + 2*Real.sqrt η*Real.sqrt (1-η)*(X.weakMean r j*conj (Y.weakMean s j)).re := by + let xl := fun i => sandwich 0 3 (by omega) j (X.vector i) + let yl := fun i => sandwich 0 3 (by omega) j (Y.vector i) + let xb := fun i => inverseWeight 3 (X.vector i) + let yb := fun i => inverseWeight 3 (Y.vector i) + have hxl := CrossEnsemble.applied_summable X.summable (sandwich 0 3 (by omega) j) + have hyl := CrossEnsemble.applied_summable Y.summable (sandwich 0 3 (by omega) j) + have hmY : HasSum (fun i => inner ℂ (yb i) (yl i)) (conj (Y.weakMean s j)) := by + convert! (Y.weakMean_hasSum s j).mapL Complex.conjCLE.toContinuousLinearMap using 1 + ext i + exact (inner_conj_symm _ _).symm + have hxy := tensorFamily_inner xl xb yb yl hxl X.normalized.summable + Y.normalized.summable hyl (X.weakMean r j) (conj (Y.weakMean s j)) + (X.weakMean_hasSum r j) hmY + have ha : HasSum (fun ij : X.Index × Y.Index => ‖tensor (xl ij.1) (yb ij.2)‖^2) (X.lowerEnergy j) := by + simpa only [mul_one, lowerEnergy] using tensorFamily_norm xl yb _ _ hxl.hasSum Y.normalized + have hb : HasSum (fun ij : X.Index × Y.Index => ‖tensor (xb ij.1) (yl ij.2)‖^2) (Y.lowerEnergy j) := by + simpa only [one_mul, lowerEnergy] using tensorFamily_norm xb yl _ _ X.normalized hyl.hasSum + have hh := EnsembleL2.real_smul_add_hasSum (Real.sqrt η) (Real.sqrt (1-η)) + (fun ij : X.Index × Y.Index => tensor (xl ij.1) (yb ij.2)) + (fun ij : X.Index × Y.Index => tensor (xb ij.1) (yl ij.2)) _ _ _ ha hb hxy + rw [Real.sq_sqrt hη.1,Real.sq_sqrt (sub_nonneg.mpr hη.2)] at hh + let v := fun ij : X.Index × Y.Index => beamUnitary η hη (tensorPreimage (X.vector ij.1) (Y.vector ij.2)) + have hv : Summable (fun ij => ‖v ij‖^2) := by + simpa only [v,LinearIsometryEquiv.norm_map] using tensorPreimage_summable X.vector Y.vector X.summable Y.summable + have he := physical_weighted_output η hη ρ σ τ hτ X.vector Y.vector T.vector + X.normalized Y.normalized X.density Y.density T.density + have ho := output_lower_square j v T.vector hv T.summable he + change (∑' i, ‖sandwich 0 3 (by omega) j (T.vector i)‖^2)=_ + rw [← ho] + convert! hh.tsum_eq using 1 + apply tsum_congr + intro ij + dsimp [v] + rw [covariance_lower_apply,tensorPreimage_lowerL,tensorPreimage_lowerR, + ← map_smul,← map_smul,← map_add,LinearIsometryEquiv.norm_map] + rfl +end EntropyPhotonNumber.WeightedColumns + +namespace EnsembleL2 +variable {E I : Type*} [NormedAddCommGroup E] [InnerProductSpace ℂ E] + +theorem sub_smul_square (x y : E) (μ : ℂ) : + ‖x-μ • y‖^2=‖x‖^2+‖μ‖^2*‖y‖^2-2*(μ*inner ℂ x y).re := by + rw [norm_sub_sq (𝕜:=ℂ),norm_smul,mul_pow,inner_smul_right] + change ‖x‖^2-2*(μ*inner ℂ x y).re+‖μ‖^2*‖y‖^2=_ + ring + +theorem centered_square (x y : I → E) (e : ℝ) (μ : ℂ) + (hx : HasSum (fun i => ‖x i‖^2) e) (hy : HasSum (fun i => ‖y i‖^2) 1) + (hxy : HasSum (fun i => inner ℂ (x i) (y i)) (conj μ)) : + HasSum (fun i => ‖x i-μ • y i‖^2) (e-‖μ‖^2) := by + have hh := (hx.add (hy.mul_left (‖μ‖^2))).sub + (((hxy.mul_left μ).mapL Complex.reCLM).mul_left 2) + simpa only [sub_smul_square,Complex.reCLM_apply,Complex.mul_conj,Complex.normSq_eq_norm_sq, + Complex.ofReal_re,mul_one,show e+‖μ‖^2-2*‖μ‖^2=e-‖μ‖^2 by ring] using hh +end EnsembleL2 + +namespace EntropyPhotonNumber.SpectralLogData +open QuantumTrace Annihilation WeightedGenerator ThermalMetric +variable {n : ℕ} {ρ : State n} (G : SpectralLogData n ρ) + +theorem centeredEnergy_lowerEnergy (t : ℝ) (ht : 0 sandwich 0 3 (by omega) j (G.spectralColumns i)) + (fun i => inverseWeight 3 (G.spectralColumns i)) (G.weightedColumns.lowerEnergy j) + (G.annihilationMean j) + (CrossEnsemble.applied_summable G.spectralColumns_summable (sandwich 0 3 (by omega) j)).hasSum + G.spectralColumns_normalized + (by + have hh := G.weightedColumns.weakMean_hasSum t j + rw [G.weakMean_eq_conj t ht j] at hh + exact hh) + rw [← he.tsum_eq] + apply tsum_congr + intro i + congr 2 + simp only [centeredLadder,Bool.false_eq_true,↓reduceIte,ContinuousLinearMap.comp_apply, + sub_apply,smul_apply,lowering] + have hu : inverseWeight 1 (inverseWeight 2 (G.spectralColumns i))=inverseWeight 3 (G.spectralColumns i) := by + change (inverseWeight 1 ∘L inverseWeight 2) (G.spectralColumns i)=_ + rw [← inverseWeight_add] + rw [hu] + congr 1 + exact congrArg (fun A : Fock n →L[ℂ] Fock n => A (G.spectralColumns i)) + (sandwich_right_inverse 0 1 2 (by omega) j).symm +end EntropyPhotonNumber.SpectralLogData + +namespace Annihilation +open EntropyPhotonNumber QuantumTrace +variable {n : ℕ} +theorem weighted_lowering_norm_sum (j : Fin n) (x : Fock n) : + HasSum (fun k : NumberIndex n => (k j:ℝ)*‖inverseWeight 3 x k‖^2) + (‖sandwich 0 3 (by omega) j x‖^2) := by + have hh := lowering_norm_sum j (inverseWeight 2 x) + have hu : inverseWeight 1 (inverseWeight 2 x)=inverseWeight 3 x := by + change (inverseWeight 1 ∘L inverseWeight 2) x=_ + rw [← inverseWeight_add] + have hl : lowering j (inverseWeight 2 x)=sandwich 0 3 (by omega) j x := by + exact congrArg (fun A : Fock n →L[ℂ] Fock n => A x) (sandwich_right_inverse 0 1 2 (by omega) j).symm + simpa only [hu,hl] using hh +end Annihilation + +namespace EntropyPhotonNumber.WeightedColumns + +section +open QuantumTrace Annihilation +variable {n : ℕ} {ρ : State n} + +theorem lowerEnergy_hasSum (X : WeightedColumns ρ) (j : Fin n) : + HasSum (fun k => (k j:ℝ)*(entry ρ.op k k).re) (X.lowerEnergy j) := by + let f := fun (i : X.Index) (k : NumberIndex n) => (k j:ℝ)*‖inverseWeight 3 (X.vector i) k‖^2 + have hrow (k : NumberIndex n) : HasSum (fun i => f i k) ((k j:ℝ)*(entry ρ.op k k).re) := by + have hh := (TraceEnsemble.hasSum_quadratic X.normalized.summable (numberKet k)).mul_left (k j:ℝ) + rw [show TraceEnsemble.operator (fun i => inverseWeight 3 (X.vector i))=ρ.op from X.density] at hh + simpa only [f,numberKet,lp.inner_single_left,RCLike.inner_apply,map_one,one_mul,mul_one,entry] using hh + have hcol i : HasSum (f i) (‖sandwich 0 3 (by omega) j (X.vector i)‖^2) := + weighted_lowering_norm_sum j (X.vector i) + have hs : Summable (Function.uncurry f) := by + apply (summable_prod_of_nonneg (fun ik => mul_nonneg (Nat.cast_nonneg _) (sq_nonneg _))).mpr + refine ⟨fun i => (hcol i).summable,?_⟩ + convert CrossEnsemble.applied_summable X.summable (sandwich 0 3 (by omega) j) using 1 + ext i + exact (hcol i).tsum_eq + have hss : Summable (fun k => (k j:ℝ)*(entry ρ.op k k).re) := by + exact hs.prod_symm.prod.congr (fun k => (hrow k).tsum_eq) + have he : (∑' k, (k j:ℝ)*(entry ρ.op k k).re)=X.lowerEnergy j := by + calc + ∑' k, (k j:ℝ)*(entry ρ.op k k).re=∑' k, ∑' i, f i k := tsum_congr (fun k => (hrow k).tsum_eq.symm) + _ = ∑' i, ∑' k, f i k := hs.tsum_comm + _ = X.lowerEnergy j := tsum_congr (fun i => (hcol i).tsum_eq) + simpa only [he] using hss.hasSum +end + +section +open QuantumTrace Annihilation +variable {n : ℕ} + +theorem lowerEnergy_affine {ρ σ τ : State n} (X : WeightedColumns ρ) (Y : WeightedColumns σ) + (T : WeightedColumns τ) (s t : ℝ) (he : τ.op=(s:ℂ) • ρ.op+(t:ℂ) • σ.op) (j : Fin n) : + T.lowerEnergy j=s*X.lowerEnergy j+t*Y.lowerEnergy j := by + apply (T.lowerEnergy_hasSum j).unique + convert! ((X.lowerEnergy_hasSum j).mul_left s).add ((Y.lowerEnergy_hasSum j).mul_left t) using 1 + funext k + simp only [entry,he,add_apply,smul_apply,inner_add_right,inner_smul_right,Complex.add_re, + Complex.mul_re,Complex.ofReal_re,Complex.ofReal_im,zero_mul,sub_zero] + ring + +theorem thermal_lowerEnergy {ρ : State n} (X : WeightedColumns ρ) (r : ℝ) (hr : 0 (k j:ℝ)*thermalWeight n r k) (X.lowerEnergy j) := by + simpa only [he,ite_true,Complex.ofReal_re] using X.lowerEnergy_hasSum j + have hz (k : NumberIndex n) (hk : k ∉ Set.range (up j)) : (k j:ℝ)*thermalWeight n r k=0 := by + rcases index_cases j k with h | ⟨l,rfl⟩ + · simp only [h,Nat.cast_zero,zero_mul] + · exact (hk ⟨l,rfl⟩).elim + have hsh := (up_injective j).hasSum_iff hz |>.mpr hE + have hsh' : HasSum (fun k => r/(r+1)*((k j:ℝ)*thermalWeight n r k+thermalWeight n r k)) + (X.lowerEnergy j) := by + convert hsh using 1 + funext k + simp only [Function.comp_def,up_same,Nat.cast_add,Nat.cast_one,thermalWeight_up] + ring + have hh := hsh'.unique ((hE.add (hasSum_thermalWeight n hr)).mul_left (r/(r+1))) + have hr1 : r+1≠0 := by positivity + field_simp at hh + nlinarith +end + +section +open QuantumTrace Annihilation BeamLadder +variable {n : ℕ} {ρ σ τ : State n} + +theorem beam_weakMean (η : ℝ) (hη : η ∈ Set.Icc 0 1) (r s u : ℝ) (j : Fin n) + (X : WeightedColumns ρ) (Y : WeightedColumns σ) (T : WeightedColumns τ) + (hτ : IsBeamSplitterOutput η ρ σ τ) : + T.weakMean u j=(Real.sqrt η:ℂ)*X.weakMean r j+(Real.sqrt (1-η):ℂ)*Y.weakMean s j := by + rw [T.weakMean_reference u (η*r+(1-η)*s)] + have hh := physical_product_weak η r s hη ρ σ τ hτ j X.vector Y.vector T.vector + X.summable Y.summable T.summable X.normalized Y.normalized X.density Y.density T.density 1 + change T.weakMean (η*r+(1-η)*s) j=_ at hh + change T.weakMean (η*r+(1-η)*s) j= + (Real.sqrt η:ℂ)*singleWeak r j X.vector (Y.rawSlice η hη 1)+ + (Real.sqrt (1-η):ℂ)*singleWeak s j Y.vector (X.rawSliceRight η hη 1) at hh + simpa only [Y.rawSlice_one,X.rawSliceRight_one,weakMean] using hh + +theorem weakMean_affine (X : WeightedColumns ρ) (Y : WeightedColumns σ) (T : WeightedColumns τ) + (c d : ℂ) (he : τ.op=c • ρ.op+d • σ.op) (r : ℝ) (j : Fin n) : + T.weakMean r j=c*X.weakMean r j+d*Y.weakMean r j := by + apply PhysicalGenerator.weak_pairing_affine r j c d X.vector Y.vector T.vector + X.summable Y.summable T.summable _ 1 + change TraceEnsemble.operator (fun i => inverseWeight 3 (T.vector i))= + c • TraceEnsemble.operator (fun i => inverseWeight 3 (X.vector i))+ + d • TraceEnsemble.operator (fun i => inverseWeight 3 (Y.vector i)) + rw [T.density,X.density,Y.density,he] + +def centeredLowerEnergy (X : WeightedColumns ρ) (r : ℝ) (j : Fin n) : ℝ := + X.lowerEnergy j-‖X.weakMean r j‖^2 + +theorem sqrt_complex_square (η : ℝ) (hη : η ∈ Set.Icc 0 1) (x y : ℂ) : + ‖(Real.sqrt η:ℂ)*x+(Real.sqrt (1-η):ℂ)*y‖^2= + η*‖x‖^2+(1-η)*‖y‖^2+2*Real.sqrt η*Real.sqrt (1-η)*(x*conj y).re := by + have hh := EnsembleL2.real_smul_add_square (Real.sqrt η) (Real.sqrt (1-η)) x y + rw [Real.sq_sqrt hη.1,Real.sq_sqrt (sub_nonneg.mpr hη.2)] at hh + convert! hh using 1 + simp only [RCLike.inner_apply,Complex.mul_re,Complex.conj_re,Complex.conj_im] + ring + +theorem beam_centeredLowerEnergy (η : ℝ) (hη : η ∈ Set.Icc 0 1) (r s u : ℝ) (j : Fin n) + (X : WeightedColumns ρ) (Y : WeightedColumns σ) (T : WeightedColumns τ) + (hτ : IsBeamSplitterOutput η ρ σ τ) : + T.centeredLowerEnergy u j=η*X.centeredLowerEnergy r j+(1-η)*Y.centeredLowerEnergy s j := by + rw [centeredLowerEnergy,physical_lowerEnergy η hη r s j X Y T hτ, + beam_weakMean η hη r s u j X Y T hτ,sqrt_complex_square η hη] + simp only [centeredLowerEnergy] + ring + +theorem thermal_centeredLowerEnergy (X : WeightedColumns ρ) (r u : ℝ) (hr : 0 + threeport_centered_energy_mode η θ κ a b d hη hθ hd hr0 ρ σ τD m γ ω ρ0 h1 h2 + G1.weightedColumns G2.weightedColumns D M V O G0.weightedColumns hD hO hrepl j) + simp only [Finset.sum_sub_distrib,Finset.sum_add_distrib,← Finset.mul_sum,Finset.sum_const, + Finset.card_univ,Fintype.card_fin,nsmul_eq_mul,← G0.centeredEnergy_eq_sum _ hr0, + ← G1.centeredEnergy_eq_sum a ha,← G2.centeredEnergy_eq_sum b hb] at hh + convert! hh using 1; ring +end EntropyPhotonNumber + +end + +namespace EntropyPhotonNumber +open scoped BigOperators ComplexConjugate + +section +open TensorLp KrausBounded BeamLadder +variable {n : ℕ} + +theorem second_dual_conditional (η : ℝ) (hη : η ∈ Set.Icc 0 1) (ρ : State n) + (Z : Fock n →L[ℂ] Fock n) : + dual (secondKraus η hη ρ) (secondKraus_norm η hη ρ) Z= + conditionalRight (rootColumn ρ) (rootColumn_norm ρ) (conjugate η hη Z) := by + let V := fun j => tensorLeft (B:=NumberIndex n) (rootColumn ρ j) + let U := jointKraus (n:=n) η hη + have hV := leftFamily_norm (rootColumn ρ) (rootColumn_norm ρ) (B:=NumberIndex n) + have hU := jointKraus_norm (n:=n) η hη + have hr := dual_reindex (Equiv.prodComm _ _) (composite V U) (composite_norm V U hV hU) + (fun x => (Equiv.prodComm _ _).hasSum_iff.mpr (composite_norm V U hV hU x)) Z + change dual (secondKraus η hη ρ) _ Z=dual (composite V U) _ Z at hr + rw [hr, dual_composite V U hV hU] + change dual V hV (dual (jointKraus η hη) hU Z)=_ + rw [joint_dual_conjugate] + rfl + +theorem dual_composeKraus {I J : Type*} (U : I → Fock n →L[ℂ] Fock n) + (V : J → Fock n →L[ℂ] Fock n) + (hU : ∀ x, HasSum (fun i => ‖U i x‖^2) (‖x‖^2)) + (hV : ∀ x, HasSum (fun j => ‖V j x‖^2) (‖x‖^2)) (Z : Fock n →L[ℂ] Fock n) : + dual (composeKraus U V) (composeKraus_norm U V hU hV) Z=dual V hV (dual U hU Z) := by + have hr := dual_reindex (Equiv.prodComm _ _) (composite V U) (composite_norm V U hV hU) + (fun x => (Equiv.prodComm _ _).hasSum_iff.mpr (composite_norm V U hV hU x)) Z + change dual (composeKraus U V) _ Z=dual (composite V U) _ Z at hr + rw [hr,dual_composite V U hV hU] + +namespace Regularization +open QuantumTrace +variable (R : Regularization n) + +theorem firstFlow_dual_raw (σ : State n) (hσ : FiniteEnergy σ) (Z : Fock n →L[ℂ] Fock n) : + (R.firstFlow σ hσ).dual Z=rawFirstSlice R.η (1-R.δ) R.hη + ⟨sub_nonneg.mpr R.hδ.2,sub_le_self _ R.hδ.1⟩ σ R.τD Z := by + have hθ : 1-R.δ ∈ Set.Icc 0 1 := ⟨sub_nonneg.mpr R.hδ.2,sub_le_self _ R.hδ.1⟩ + change dual (composeKraus (firstKraus (1-R.δ) hθ R.τD) (firstKraus R.η R.hη σ)) + (composeKraus_norm _ _ (firstKraus_norm _ _ _) (firstKraus_norm _ _ _)) Z= + rawFirstSlice R.η (1-R.δ) R.hη hθ σ R.τD Z + rw [dual_composeKraus _ _ (firstKraus_norm _ _ _) (firstKraus_norm _ _ _), first_dual_conditional] + unfold rawFirstSlice rawDual rawJointKraus + have hd := dual_composite (jointKraus R.η R.hη) + (firstKraus (1-R.δ) (show 1-R.δ ∈ Set.Icc 0 1 from ⟨sub_nonneg.mpr R.hδ.2,sub_le_self _ R.hδ.1⟩) R.τD) + (jointKraus_norm R.η R.hη) (firstKraus_norm _ _ _) Z + rw [joint_dual_conjugate] at hd + exact congrArg (conditionalLeft (rootColumn σ) (rootColumn_norm σ)) hd.symm + +theorem secondFlow_dual_raw (ρ : State n) (hρ : FiniteEnergy ρ) (Z : Fock n →L[ℂ] Fock n) : + (R.secondFlow ρ hρ).dual Z=rawSecondSlice R.η (1-R.δ) R.hη + ⟨sub_nonneg.mpr R.hδ.2,sub_le_self _ R.hδ.1⟩ ρ R.τD Z := by + have hθ : 1-R.δ ∈ Set.Icc 0 1 := ⟨sub_nonneg.mpr R.hδ.2,sub_le_self _ R.hδ.1⟩ + change dual (composeKraus (firstKraus (1-R.δ) hθ R.τD) (secondKraus R.η R.hη ρ)) + (composeKraus_norm _ _ (firstKraus_norm _ _ _) (secondKraus_norm _ _ _)) Z= + rawSecondSlice R.η (1-R.δ) R.hη hθ ρ R.τD Z + rw [dual_composeKraus _ _ (firstKraus_norm _ _ _) (secondKraus_norm _ _ _), second_dual_conditional] + unfold rawSecondSlice rawDual rawJointKraus + have hd := dual_composite (jointKraus R.η R.hη) + (firstKraus (1-R.δ) (show 1-R.δ ∈ Set.Icc 0 1 from ⟨sub_nonneg.mpr R.hδ.2,sub_le_self _ R.hδ.1⟩) R.τD) + (jointKraus_norm R.η R.hη) (firstKraus_norm _ _ _) Z + rw [joint_dual_conjugate] at hd + exact congrArg (conditionalRight (rootColumn ρ) (rootColumn_norm ρ)) hd.symm +end Regularization +end + +open QuantumTrace Annihilation +variable {n : ℕ} {J : Type} {ρ : State n} + +theorem spectralLogData_of_sandwich (b : HilbertBasis J ℂ (Fock n)) (p : J → ℝ) + (hp : ∀ j, 0

ENNReal.ofReal (-Real.log (p j))) (inverseWeight 2 x)) : + ∃ G : SpectralLogData n ρ, G.J=J ∧ HEq G.basis b ∧ HEq G.probability p ∧ G.logSandwich=B := by + have hc (j : J) : 0≤-Real.log (p j) := by + apply neg_nonneg.mpr + exact Real.log_nonpos (hp j).le (hs.tsum_eq ▸ hs.summable.le_tsum j (fun i _ => (hp i).le)) + have hfin (x : Fock n) : Summable (fun j => -Real.log (p j)*‖inner ℂ (b j) (inverseWeight 2 x)‖^2) := by + have heq : (∑' j, ENNReal.ofReal (-Real.log (p j)*‖inner ℂ (b j) (inverseWeight 2 x)‖^2))= + ENNReal.ofReal (inner ℂ x (B x)).re := by + rw [hBe]; simp only [basisMoment, ENNReal.ofReal_mul (hc _)] + have hfinite : (∑' j, ENNReal.ofReal (-Real.log (p j)*‖inner ℂ (b j) (inverseWeight 2 x)‖^2))≠⊤ := + heq ▸ ENNReal.ofReal_ne_top + simpa only [ENNReal.toReal_ofReal (mul_nonneg (hc _) (sq_nonneg _))] using ENNReal.summable_toReal hfinite + have hsum (x : Fock n) : HasSum + (fun j => -Real.log (p j)*‖inner ℂ (b j) (inverseWeight 2 x)‖^2) (inner ℂ x (B x)).re := by + have hh := hBe x + rw [basisMoment_ofReal b _ hc _ (hfin x)] at hh + have hn : 0≤(inner ℂ x (B x)).re := hB.re_inner_nonneg_right x + have hnn : 0≤∑' j, -Real.log (p j)*‖inner ℂ (b j) (inverseWeight 2 x)‖^2 := + tsum_nonneg (fun j => mul_nonneg (hc j) (sq_nonneg _)) + have heq : (inner ℂ x (B x)).re=∑' j, -Real.log (p j)*‖inner ℂ (b j) (inverseWeight 2 x)‖^2 := + by simpa only [ENNReal.toReal_ofReal hn, ENNReal.toReal_ofReal hnn] using congrArg ENNReal.toReal hh + rw [heq]; exact (hfin x).hasSum + have hb (x : Fock n) : (∑' j, -Real.log (p j)*‖inner ℂ (b j) (inverseWeight 2 x)‖^2) ≤ ‖B‖*‖x‖^2 := by + rw [(hsum x).tsum_eq] + calc + (inner ℂ x (B x)).re ≤ ‖inner ℂ x (B x)‖ := Complex.re_le_norm _ + _ ≤ ‖x‖*‖B x‖ := norm_inner_le_norm _ _ + _ ≤ ‖x‖*(‖B‖*‖x‖) := mul_le_mul_of_nonneg_left (B.le_opNorm x) (norm_nonneg _) + _ = ‖B‖*‖x‖^2 := by ring + obtain ⟨B',hB',hs',he'⟩ := spectral_form_representation b (fun j => -Real.log (p j)) hc + (inverseWeight 2) (ContinuousLinearMap.isSelfAdjoint_iff_isSymmetric.mp (inverseWeight_selfAdjoint 2)) + hfin (norm_nonneg B) hb + have hBB : B'=B := positive_eq_of_quadratic hB' hB (fun x => (hs' x).unique (hsum x)) + subst B' + obtain ⟨x,hx,hix⟩ := spectral_weighted_columns b p (fun j => (hp j).le) he hm + let G : SpectralLogData n ρ := { + J := J + basis := b + probability := p + probability_pos := hp + probability_sum := hs + eigen := he + spectralColumns := x + spectralColumns_summable := hx + spectralColumns_inverse := hix + logSandwich := B + logSandwich_symmetric := hB.isSymmetric + logSandwich_parseval := hsum + logSandwich_preimage := by + intro j + have hi : inverseWeight 2 (inverseWeight 1 (x j))=(Real.sqrt (p j):ℂ) • b j := by + change (inverseWeight 2 ∘L inverseWeight 1) (x j)=_ + rw [← inverseWeight_add] + exact hix j + have hh := he' j (inverseWeight 1 (x j)) (Real.sqrt (p j):ℂ) hi + have hz : inverseWeight 2 ((Real.sqrt (p j):ℂ) • b j)=inverseWeight 5 (x j) := by + rw [← hi] + change (inverseWeight 2 ∘L inverseWeight 2 ∘L inverseWeight 1) (x j)=_ + rw [← inverseWeight_add,← inverseWeight_add] + simpa only [hz] using hh } + exact ⟨G,rfl,HEq.rfl,HEq.rfl,rfl⟩ + +namespace GibbsData +variable {k : ℝ} (G : GibbsData n k ρ) +theorem quarticLogarithm_eq_logSandwich : G.quarticLogarithm=G.logSandwich := by + unfold quarticLogarithm logSandwich + rw [inversePower_root_four] +end GibbsData + +end EntropyPhotonNumber + +section +open scoped BigOperators + +namespace WeightedGenerator + +section +open EntropyPhotonNumber QuantumTrace Annihilation +variable {n : ℕ} +theorem drift_radial (r : ℝ) (f : ℝ → ℝ) (k : NumberIndex n) : + drift r (fun k => f (numberWeight k)) k = + (r+1)*(numberWeight k-1)*(f (numberWeight k-1)-f (numberWeight k))+ + r*(numberWeight k-1+n)*(f (numberWeight k+1)-f (numberWeight k)) := by + have he (j : Fin n) : (r+1)*(k j:ℝ)*(f (numberWeight (down j k))-f (numberWeight k)) = + ((k j:ℝ)*(r+1))*(f (numberWeight k-1)-f (numberWeight k)) := by + by_cases hk : k j=0 + · simp [hk] + · rw [weight_down j k (Nat.pos_of_ne_zero hk)] + ring + simp only [drift, he, weight_up, Finset.sum_add_distrib, ← Finset.sum_mul, ← Finset.mul_sum] + simp only [Finset.sum_const, Finset.card_univ, Fintype.card_fin, + nsmul_eq_mul, mul_one, numberWeight] + ring + +theorem drift_number (r : ℝ) (k : NumberIndex n) : + drift r (fun k => (totalNumber k:ℝ)) k = n*r-totalNumber k := by + have he (k : NumberIndex n) : (totalNumber k:ℝ)=numberWeight k-1 := by + simp [totalNumber, numberWeight] + have hh := drift_radial r (fun t => t-1) k + simp_rw [he] + rw [hh] + ring + +def driftPolynomial (n : ℕ) (r t : ℝ) : ℝ := + (r+1)*t*(t^4-(t+1)^4)+r*(t+n)*((t+2)^4-(t+1)^4) + +theorem drift_fourth (r : ℝ) (k : NumberIndex n) : + drift r (fun k => numberWeight k^4) k=driftPolynomial n r (totalNumber k) := by + rw [drift_radial r (fun t => t^4) k] + simp only [driftPolynomial, numberWeight, totalNumber, Nat.cast_sum] + ring + +theorem driftPolynomial_expand (r t : ℝ) : + driftPolynomial n r t = -4*t^4+(4*r*n+12*r-6)*t^3+ + (18*r*n+24*r-4)*t^2+(28*r*n+14*r-1)*t+15*r*n := by + unfold driftPolynomial + ring +end + +theorem negative_quartic_bounded (a b c d : ℝ) : + ∃ C : ℝ, ∀ t : ℝ, 0 ≤ t → -4*t^4+a*t^3+b*t^2+c*t+d ≤ C := by + let S : ℝ := 1+|a|+|b|+|c|+|d| + have hS : 1 ≤ S := by dsimp [S]; linarith [abs_nonneg a, abs_nonneg b, abs_nonneg c, abs_nonneg d] + have ha : a ≤ |a| := le_abs_self a + have hb : b ≤ |b| := le_abs_self b + have hc : c ≤ |c| := le_abs_self c + have hd : d ≤ |d| := le_abs_self d + have hsa : 0 ≤ |a| := abs_nonneg a + have hsb : 0 ≤ |b| := abs_nonneg b + have hsc : 0 ≤ |c| := abs_nonneg c + have hsd : 0 ≤ |d| := abs_nonneg d + refine ⟨S*(S^3+S^2+S+1), ?_⟩ + intro t ht + have htop : -4*t^4+a*t^3+b*t^2+c*t+d ≤ |a| *t^3+|b| *t^2+|c| *t+|d| := by + nlinarith [mul_le_mul_of_nonneg_right ha (pow_nonneg ht 3), + mul_le_mul_of_nonneg_right hb (sq_nonneg t), mul_le_mul_of_nonneg_right hc ht, + pow_nonneg ht 4] + have hC : 0 ≤ S*(S^3+S^2+S+1) := by positivity + by_cases h : t ≤ S + · have h₁ : |a| *t^3 ≤ S*S^3 := by + apply mul_le_mul + · dsimp [S]; linarith + · exact pow_le_pow_left₀ ht h 3 + · positivity + · linarith + have h₂ : |b| *t^2 ≤ S*S^2 := by + apply mul_le_mul + · dsimp [S]; linarith + · exact pow_le_pow_left₀ ht h 2 + · positivity + · linarith + have h₃ : |c| *t ≤ S*S := by + apply mul_le_mul + · dsimp [S]; linarith + · exact h + · exact ht + · linarith + have h₄ : |d| ≤ S := by dsimp [S]; linarith + nlinarith + · have htS : S ≤ t := (lt_of_not_ge h).le + have ht1 : 1 ≤ t := hS.trans htS + have ht2 : t ≤ t^2 := by nlinarith + have ht3 : t^2 ≤ t^3 := by nlinarith [mul_nonneg (sq_nonneg t) (sub_nonneg.mpr ht1)] + have h₁ := mul_le_mul_of_nonneg_left ht3 hsb + have h₂ := mul_le_mul_of_nonneg_left (ht2.trans ht3) hsc + have h₃ := mul_le_mul_of_nonneg_left (ht1.trans (ht2.trans ht3)) hsd + have h₄ : (|a|+|b|+|c|+|d|)*t^3 ≤ t^4 := by + have hs : |a|+|b|+|c|+|d| ≤ t := by dsimp [S] at htS; linarith + simpa only [← pow_succ'] using mul_le_mul_of_nonneg_right hs (pow_nonneg ht 3) + have ht4 : 0 ≤ t^4 := pow_nonneg ht 4 + have hlead : a*t^3+b*t^2+c*t+d ≤ (|a|+|b|+|c|+|d|)*t^3 := by + nlinarith [mul_le_mul_of_nonneg_right ha (pow_nonneg ht 3), + mul_le_mul_of_nonneg_right hb (sq_nonneg t), mul_le_mul_of_nonneg_right hc ht] + nlinarith + +theorem driftPolynomial_bounded (n : ℕ) (r : ℝ) : + ∃ C : ℝ, ∀ k : ℕ, driftPolynomial n r k ≤ C := by + obtain ⟨C,hC⟩ := negative_quartic_bounded (4*r*n+12*r-6) (18*r*n+24*r-4) + (28*r*n+14*r-1) (15*r*n) + exact ⟨C, fun k => (driftPolynomial_expand r k).trans_le (hC k (Nat.cast_nonneg k))⟩ +end WeightedGenerator + +namespace EntropyPhotonNumber + +section +open QuantumTrace Annihilation +variable {n : ℕ} + +theorem number_le_weight (k : NumberIndex n) : (totalNumber k:ℝ)≤numberWeight k := by + simp only [numberWeight,totalNumber,Nat.cast_sum]; linarith + +theorem number_weight_eq (k : NumberIndex n) : numberWeight k=1+(totalNumber k:ℝ) := by + simp only [numberWeight,totalNumber,Nat.cast_sum] + +theorem number_div_weight_bound (k : NumberIndex n) : |(totalNumber k:ℝ)/numberWeight k^4|≤1 := by + rw [abs_of_nonneg (by positivity)] + apply (div_le_one (pow_pos (lt_of_lt_of_le zero_lt_one (numberWeight_one_le k)) _)).mpr + exact (number_le_weight k).trans (le_self_pow₀ (numberWeight_one_le k) (by norm_num)) + +def numberSandwich (n : ℕ) : Fock n →L[ℂ] Fock n := + diagonal (fun k => (totalNumber k:ℝ)/numberWeight k^4) 1 (by norm_num) number_div_weight_bound + +theorem numberSandwich_positive (n : ℕ) : (numberSandwich n).IsPositive := by + refine ⟨ContinuousLinearMap.isSelfAdjoint_iff_isSymmetric.mp (diagonal_selfAdjoint _ _ _ _), ?_⟩ + intro x + have hh := diagonal_quadratic (fun k : NumberIndex n => (totalNumber k:ℝ)/numberWeight k^4) 1 (by norm_num) number_div_weight_bound x + have hs : (inner ℂ x (numberSandwich n x)).re=∑' k, (totalNumber k:ℝ)/numberWeight k^4*‖x k‖^2 := hh.tsum_eq.symm + change 0≤(inner ℂ (numberSandwich n x) x).re + rw [show (inner ℂ (numberSandwich n x) x).re=(inner ℂ x (numberSandwich n x)).re from inner_re_symm (𝕜:=ℂ) _ _, hs] + exact tsum_nonneg (fun k => by positivity) + +theorem numberSandwich_form (x : Fock n) : + ENNReal.ofReal (inner ℂ x (numberSandwich n x)).re = numberVectorMoment (inverseWeight 2 x) := by + rw [numberVectorMoment_eq] + have hh := diagonal_quadratic (fun k : NumberIndex n => (totalNumber k:ℝ)/numberWeight k^4) 1 (by norm_num) number_div_weight_bound x + change HasSum _ (inner ℂ x (numberSandwich n x)).re at hh + rw [← hh.tsum_eq, ENNReal.ofReal_tsum_of_nonneg (fun k => by positivity) hh.summable] + apply tsum_congr + intro k + congr 1 + simp [numberBasis_apply,numberKet,lp.inner_single_left,inverseWeight_apply, + norm_pow,norm_inv,Complex.norm_real,Real.norm_eq_abs, + abs_of_nonneg (le_trans zero_le_one (numberWeight_one_le k))] + ring + +theorem numberSandwich_unique (D : Fock n →L[ℂ] Fock n) (hD : D.IsPositive) + (he : ∀ x, ENNReal.ofReal (inner ℂ x (D x)).re = + numberVectorMoment (inversePower rootNumberWeight rootNumberWeight_one_le 4 x)) : + D=numberSandwich n := by + apply positive_eq_of_quadratic hD (numberSandwich_positive n) + intro x + have hh := congrArg ENNReal.toReal (he x) + rw [inversePower_root_four, ← numberSandwich_form] at hh + simpa only [ENNReal.toReal_ofReal (show 0≤(inner ℂ x (D x)).re from hD.re_inner_nonneg_right x), + ENNReal.toReal_ofReal (show 0≤(inner ℂ x (numberSandwich n x)).re from (numberSandwich_positive n).re_inner_nonneg_right x)] using hh + +theorem drift_number_div_bound (r : ℝ) (k : NumberIndex n) : + |WeightedGenerator.drift r (fun k => (totalNumber k:ℝ)) k/numberWeight k^6|≤|(n:ℝ)*r|+1 := by + rw [WeightedGenerator.drift_number,abs_div,abs_of_pos (pow_pos (lt_of_lt_of_le zero_lt_one (numberWeight_one_le k)) _)] + apply (div_le_iff₀ (pow_pos (lt_of_lt_of_le zero_lt_one (numberWeight_one_le k)) _)).mpr + have hw : 1≤numberWeight k^6 := one_le_pow₀ (numberWeight_one_le k) + have hn : (totalNumber k:ℝ)≤numberWeight k^6 := + (number_le_weight k).trans (le_self_pow₀ (numberWeight_one_le k) (by norm_num)) + calc + |(n:ℝ)*r-totalNumber k|≤|(n:ℝ)*r|+|(totalNumber k:ℝ)| := abs_sub _ _ + _ ≤ (|(n:ℝ)*r|+1)*numberWeight k^6 := by + have hnabs : |(totalNumber k:ℝ)|=(totalNumber k:ℝ) := abs_of_nonneg (Nat.cast_nonneg _) + rw [hnabs] + nlinarith [mul_le_mul_of_nonneg_left hw (abs_nonneg ((n:ℝ)*r))] + +theorem thermalGenerator_number (r : ℝ) (ρ : State n) (hm : FiniteMoment 6 ρ) : + (WeightedGenerator.pairing r (weightedRoot 3 ρ hm) (numberSandwich n)).re=(n:ℝ)*r-energy ρ := by + have hh := thermalGenerator_drift r ρ hm (fun k => (totalNumber k:ℝ)) 1 (|(n:ℝ)*r|+1) + (by norm_num) number_div_weight_bound (drift_number_div_bound r) + have he := (ρ.trace_one.mul_left ((n:ℝ)*r)).sub (finiteMoment_finiteEnergy (by norm_num) hm).hasSum + change HasSum _ (WeightedGenerator.pairing r (weightedRoot 3 ρ hm) (numberSandwich n)).re at hh + apply hh.unique + simpa only [WeightedGenerator.drift_number, sub_mul, mul_one, energy] using he +end + +open QuantumTrace Annihilation WeightedGenerator +variable {n : ℕ} + +theorem polynomial_weight_six_bound (a b c d e : ℝ) (k : NumberIndex n) : + |a*(totalNumber k:ℝ)^4+b*(totalNumber k:ℝ)^3+c*(totalNumber k:ℝ)^2+d*(totalNumber k:ℝ)+e|≤ + (|a|+|b|+|c|+|d|+|e|)*numberWeight k^6 := by + have hp (m : ℕ) (hm : m≤6) : (totalNumber k:ℝ)^m≤numberWeight k^6 := + (pow_le_pow_left₀ (Nat.cast_nonneg _) (number_le_weight k) m).trans + (pow_le_pow_right₀ (numberWeight_one_le k) hm) + have h1 : (totalNumber k:ℝ)≤numberWeight k^6 := by simpa using hp 1 (by norm_num) + have h0 : 1≤numberWeight k^6 := one_le_pow₀ (numberWeight_one_le k) + calc + _ ≤ |a*(totalNumber k:ℝ)^4+b*(totalNumber k:ℝ)^3+c*(totalNumber k:ℝ)^2+d*(totalNumber k:ℝ)|+|e| := abs_add_le _ _ + _ ≤ |a*(totalNumber k:ℝ)^4+b*(totalNumber k:ℝ)^3+c*(totalNumber k:ℝ)^2|+|d*(totalNumber k:ℝ)|+|e| := by gcongr; exact abs_add_le _ _ + _ ≤ |a*(totalNumber k:ℝ)^4+b*(totalNumber k:ℝ)^3|+|c*(totalNumber k:ℝ)^2|+|d*(totalNumber k:ℝ)|+|e| := by gcongr; exact abs_add_le _ _ + _ ≤ |a*(totalNumber k:ℝ)^4|+|b*(totalNumber k:ℝ)^3|+|c*(totalNumber k:ℝ)^2|+|d*(totalNumber k:ℝ)|+|e| := by gcongr; exact abs_add_le _ _ + _ = |a| *(totalNumber k:ℝ)^4+|b| *(totalNumber k:ℝ)^3+|c| *(totalNumber k:ℝ)^2+|d| *(totalNumber k:ℝ)+|e| := by simp [abs_mul,abs_pow,abs_of_nonneg (show 0≤(totalNumber k:ℝ) from Nat.cast_nonneg _)] + _ ≤ |a| *numberWeight k^6+|b| *numberWeight k^6+|c| *numberWeight k^6+|d| *numberWeight k^6+|e| *numberWeight k^6 := by + exact add_le_add (add_le_add (add_le_add (add_le_add + (mul_le_mul_of_nonneg_left (hp 4 (by norm_num)) (abs_nonneg a)) + (mul_le_mul_of_nonneg_left (hp 3 (by norm_num)) (abs_nonneg b))) + (mul_le_mul_of_nonneg_left (hp 2 (by norm_num)) (abs_nonneg c))) + (mul_le_mul_of_nonneg_left h1 (abs_nonneg d))) (by nlinarith [mul_le_mul_of_nonneg_left h0 (abs_nonneg e)]) + _ = _ := by ring + +def fourthDriftConstant (n : ℕ) (r : ℝ) : ℝ := + |(-4:ℝ)|+|4*r*n+12*r-6|+|18*r*n+24*r-4|+|28*r*n+14*r-1|+|15*r*n| + +theorem drift_fourth_div_bound (r : ℝ) (k : NumberIndex n) : + |drift r (fun k => numberWeight k^4) k/numberWeight k^6|≤fourthDriftConstant n r := by + rw [drift_fourth,driftPolynomial_expand,abs_div,abs_of_pos (pow_pos (lt_of_lt_of_le zero_lt_one (numberWeight_one_le k)) _)] + apply (div_le_iff₀ (pow_pos (lt_of_lt_of_le zero_lt_one (numberWeight_one_le k)) _)).mpr + exact polynomial_weight_six_bound (-4) (4*r*n+12*r-6) (18*r*n+24*r-4) (28*r*n+14*r-1) (15*r*n) k + +theorem fourth_diagonal_eq_one : + diagonal (fun k : NumberIndex n => numberWeight k^4/numberWeight k^4) 1 (by norm_num) + (fun k => by rw [div_self (pow_ne_zero _ (ne_of_gt (lt_of_lt_of_le zero_lt_one (numberWeight_one_le k))))]; norm_num)= + (1 : Fock n →L[ℂ] Fock n) := by + ext x k + simp only [diagonal_apply,div_self (pow_ne_zero _ (ne_of_gt (lt_of_lt_of_le zero_lt_one (numberWeight_one_le k)))),Complex.ofReal_one, + one_mul,one_apply_eq_self] + +theorem thermalGenerator_fourth (r : ℝ) (ρ : State n) (hm : FiniteMoment 6 ρ) : + HasSum (fun k => driftPolynomial n r (totalNumber k)*(entry ρ.op k k).re) + (WeightedGenerator.pairing r (weightedRoot 3 ρ hm) (1 : Fock n →L[ℂ] Fock n)).re := by + have hh := thermalGenerator_drift r ρ hm (fun k => numberWeight k^4) 1 (fourthDriftConstant n r) + (by norm_num) (fun k => by rw [div_self (pow_ne_zero _ (ne_of_gt (lt_of_lt_of_le zero_lt_one (numberWeight_one_le k))))]; norm_num) + (drift_fourth_div_bound r) + simpa only [drift_fourth,fourth_diagonal_eq_one] using hh + +theorem thermalGenerator_fourth_bound (r : ℝ) : ∃ C : ℝ, ∀ (ρ : State n) (hm : FiniteMoment 6 ρ), + (WeightedGenerator.pairing r (weightedRoot 3 ρ hm) (1 : Fock n →L[ℂ] Fock n)).re≤C := by + obtain ⟨C,hC⟩ := driftPolynomial_bounded n r + refine ⟨C,fun ρ hm => ?_⟩ + have hh := thermalGenerator_fourth r ρ hm + have hpos (k : NumberIndex n) : 0≤(entry ρ.op k k).re := ρ.positive.re_inner_nonneg_right _ + have hle := hh.summable.tsum_le_tsum + (fun k => mul_le_mul_of_nonneg_right (hC (totalNumber k)) (hpos k)) + (ρ.trace_one.summable.mul_left C) + simpa only [hh.tsum_eq,tsum_mul_left,ρ.trace_one.tsum_eq,mul_one] using hle +end EntropyPhotonNumber + +end + +open scoped BigOperators ComplexConjugate + +namespace EntropyPhotonNumber.Regularization +open QuantumTrace Annihilation +variable {n : ℕ} (R : Regularization n) + +theorem attenuation_mem : 1-R.δ ∈ Set.Icc 0 1 := + ⟨sub_nonneg.mpr R.hδ.2,sub_le_self _ R.hδ.1⟩ + +theorem thermal_state_diagonal (r : ℝ) (hr : 0 X.lowerEnergy_hasSum j) + have he : HasSum (fun k => (totalNumber k:ℝ)*(entry ρ.op k k).re) (∑ j, X.lowerEnergy j) := by + simpa only [totalNumber,Nat.cast_sum,Finset.sum_mul] using hh + exact he.tsum_eq.symm +end WeightedColumns +namespace SpectralLogData +variable {n : ℕ} {ρ : State n} (G : SpectralLogData n ρ) +theorem centeredEnergy_eq_energy (t : ℝ) (ht : 0 sq_nonneg _) +theorem meanSquared_nonneg : 0≤G.meanSquared := Finset.sum_nonneg (fun _j _ => sq_nonneg _) +end SpectralLogData +namespace GibbsData +variable {n : ℕ} {k : ℝ} {ρ : State n} (G : GibbsData n k ρ) +theorem spectral_defect (hk : 0 Fin.elim0 i)) + have hr0 : 0 sq_nonneg _),?_⟩ + exact physical_centered_energy_identity P.η P.θ P.κ P.r1 P.r2 P.d P.η_mem P.θ_mem P.hd P.hr1 P.hr2 P.r0_pos + ρ σ (thermalState n P.d P.hd) (P.middle ρ σ) (P.raw ρ σ) (thermalState n P.r0 P.r0_pos) + ((P.reg n ζ hζ).output ρ σ) (beamOutput_spec _ _ _ _) (beamOutput_spec _ _ _ _) G1 G2 G0 D M V O + (Regularization.thermal_state_diagonal P.d P.hd) (Regularization.thermal_state_diagonal P.r0 P.r0_pos) + (P.output_op ζ hζ ρ σ) +end ThermalSetup + +namespace ThermalDual + +theorem decay_from_cancellation (q A M ε K ζ D C : ℝ) (hε : 0<ε) (hζ : 0≤ζ) + (hK : 0≤K) (hD : D≤C) + (hq : q≤A+ε/2*(A+M)) (hc : 0=q-(1+ε)*A-ε*M-K+ζ*D) : + A+M≤(2*C/ε)*ζ := by + have hh : ε/2*(A+M)≤ζ*C := by nlinarith [mul_le_mul_of_nonneg_left hD hζ] + calc + (A+M) ≤ (2*C*ζ)/ε := by apply (le_div_iff₀ hε).mpr; nlinarith only [hh] + _ = (2*C/ε)*ζ := by ring + +end ThermalDual +namespace ThermalSetup +variable {n : ℕ} (P : ThermalSetup) + +theorem minimum_decay (C1 C2 : ℝ) + (hC1 : ∀ (ρ : State n) (hm : FiniteMoment 6 ρ), + (WeightedGenerator.pairing P.r1 (weightedRoot 3 ρ hm) (1 : Fock n →L[ℂ] Fock n)).re≤C1) + (hC2 : ∀ (ρ : State n) (hm : FiniteMoment 6 ρ), + (WeightedGenerator.pairing P.r2 (weightedRoot 3 ρ hm) (1 : Fock n →L[ℂ] Fock n)).re≤C2) + (ζ : ℝ) (hζ : 0<ζ) (ρ σ : State n) (hmρ : FiniteMoment 4 ρ) (hmσ : FiniteMoment 4 σ) + (hmin : ∀ ρ' σ', FiniteMoment 4 ρ' → FiniteMoment 4 σ' → + (P.reg n ζ hζ).objective ρ σ≤(P.reg n ζ hζ).objective ρ' σ') : + ∃ (G1 : GibbsData n (ζ/((1+P.ε)*P.w1/h P.r1)) ρ) + (G2 : GibbsData n (ζ/((1+P.ε)*P.w2/h P.r2)) σ), + P.w1*((∑ j, ‖G1.defect (div_pos hζ (P.reg n ζ hζ).ha1) P.r1 P.hr1 j‖^2)+ + (∑ j, ‖G1.annihilationMean j‖^2))+ + P.w2*((∑ j, ‖G2.defect (div_pos hζ (P.reg n ζ hζ).ha2) P.r2 P.hr2 j‖^2)+ + (∑ j, ‖G2.annihilationMean j‖^2)) ≤ (2*(C1+C2)/P.ε)*ζ := by + let R := P.reg n ζ hζ + obtain ⟨G1,G2,G0,h6ρ,h6σ,h60,hbal,hh1,hh2⟩ := R.minimum_spectral_pairing_balance ρ σ hmρ hmσ + P.r1 P.r2 P.d P.r0 P.hd P.r0_pos (by simp only [R,reg,sub_sub_cancel]; rfl) rfl rfl P.hκ.1 hmin + let E1 := G1.toSpectralLogData (div_pos R.hζ R.ha1) + let E2 := G2.toSpectralLogData (div_pos R.hζ R.ha2) + have hH1 : ∀ Z, Z ∈ CenteredTests.operatorSpace G0.basis G0.probability → + (1-P.κ)^2*BKM.quadratic E1.basis E1.probability + (BKM.center E1.basis E1.probability (rawFirstSlice P.η P.θ P.η_mem P.θ_mem σ (thermalState n P.d P.hd) Z))≤ + ((1+P.ε)*P.w1/h P.r1)/(1/h P.r0)*BKM.quadratic G0.basis G0.probability Z := by + intro Z hZ + simpa only [E1,GibbsData.toSpectralLogData,R,reg,sub_sub_cancel] using hh1 Z hZ + have hH2 : ∀ Z, Z ∈ CenteredTests.operatorSpace G0.basis G0.probability → + (1-P.κ)^2*BKM.quadratic E2.basis E2.probability + (BKM.center E2.basis E2.probability (rawSecondSlice P.η P.θ P.η_mem P.θ_mem ρ (thermalState n P.d P.hd) Z))≤ + ((1+P.ε)*P.w2/h P.r2)/(1/h P.r0)*BKM.quadratic G0.basis G0.probability Z := by + intro Z hZ + simpa only [E2,GibbsData.toSpectralLogData,R,reg,sub_sub_cancel] using hh2 Z hZ + have hdef := P.physical_estimate ζ hζ ρ σ E1 E2 G0 h6ρ h6σ hH1 hH2 + obtain ⟨v,hv,hce⟩ := P.physical_energy ζ hζ ρ σ E1 E2 G0 h6ρ h6σ + have hbalr := congrArg Complex.re hbal + simp only [Complex.add_re,Complex.mul_re,Complex.ofReal_re,Complex.ofReal_im, + zero_mul,sub_zero] at hbalr + have hstat : + (1+P.ε)*P.w1*((WeightedGenerator.pairing P.r1 (weightedRoot 3 ρ h6ρ) E1.logSandwich).re/h P.r1)+ + (1+P.ε)*P.w2*((WeightedGenerator.pairing P.r2 (weightedRoot 3 σ h6σ) E2.logSandwich).re/h P.r2)= + (WeightedGenerator.pairing P.r0 (weightedRoot 3 (R.output ρ σ) h60) G0.logSandwich).re/h P.r0+ + P.ε*P.w1*(WeightedGenerator.pairing P.r1 (weightedRoot 3 ρ h6ρ) (numberSandwich n)).re+ + P.ε*P.w2*(WeightedGenerator.pairing P.r2 (weightedRoot 3 σ h6σ) (numberSandwich n)).re+ + ζ*((WeightedGenerator.pairing P.r1 (weightedRoot 3 ρ h6ρ) (1 : Fock n →L[ℂ] Fock n)).re+ + (WeightedGenerator.pairing P.r2 (weightedRoot 3 σ h6σ) (1 : Fock n →L[ℂ] Fock n)).re) := by + convert hbalr using 1 <;> dsimp only [R,reg,E1,E2,GibbsData.toSpectralLogData] <;> ring + rw [E1.entropy_production h6ρ P.r1 P.hr1,E2.entropy_production h6σ P.r2 P.hr2, + G0.entropy_production h60 P.r0 P.r0_pos,thermalGenerator_number,thermalGenerator_number] at hstat + have he1 : energy ρ=E1.centeredEnergy+E1.meanSquared := by + have hh := E1.centeredEnergy_eq_energy P.r1 P.hr1 + change E1.centeredEnergy=energy ρ-E1.meanSquared at hh + linarith + have he2 : energy σ=E2.centeredEnergy+E2.meanSquared := by + have hh := E2.centeredEnergy_eq_energy P.r2 P.hr2 + change E2.centeredEnergy=energy σ-E2.meanSquared at hh + linarith + rw [he1,he2,hce] at hstat + have hc : 0=G0.defectSquared P.r0 P.r0_pos- + (1+P.ε)*(P.w1*E1.defectSquared P.r1 P.hr1+P.w2*E2.defectSquared P.r2 P.hr2)- + P.ε*(P.w1*E1.meanSquared+P.w2*E2.meanSquared)-P.κ*(1-P.κ)*v+ + ζ*((WeightedGenerator.pairing P.r1 (weightedRoot 3 ρ h6ρ) (1 : Fock n →L[ℂ] Fock n)).re+ + (WeightedGenerator.pairing P.r2 (weightedRoot 3 σ h6σ) (1 : Fock n →L[ℂ] Fock n)).re) := by + dsimp only [SpectralLogData.defectSquared] + linear_combination hstat + have hdec := ThermalDual.decay_from_cancellation _ _ _ _ _ _ _ (C1+C2) P.hε hζ.le + (mul_nonneg (mul_nonneg P.hκ.1.le (sub_nonneg.mpr P.hκ.2.le)) hv) + (add_le_add (hC1 ρ h6ρ) (hC2 σ h6σ)) hdef hc + refine ⟨G1,G2,?_⟩ + change P.w1*(E1.defectSquared P.r1 P.hr1+E1.meanSquared)+ + P.w2*(E2.defectSquared P.r2 P.hr2+E2.meanSquared)≤(2*(C1+C2)/P.ε)*ζ + nlinarith only [hdec] + +theorem uniform_minimum_decay : ∃ C : ℝ, 0 (hC1 ρ hm).trans (by linarith [le_max_left C1 0])) + (fun ρ hm => (hC2 ρ hm).trans (le_max_left C2 0)) ζ hζ ρ σ hmρ hmσ hmin +end ThermalSetup +end EntropyPhotonNumber + +end + +end OAI diff --git a/lean/OAI/InformationTheory/PhotonNumber/PhysicalMinimum.lean b/lean/OAI/InformationTheory/PhotonNumber/PhysicalMinimum.lean new file mode 100644 index 0000000000000000000000000000000000000000..d09a49a16edbf7331304df87caf0f9f09c09713e --- /dev/null +++ b/lean/OAI/InformationTheory/PhotonNumber/PhysicalMinimum.lean @@ -0,0 +1,827 @@ +import OAI.InformationTheory.PhotonNumber.FiniteVariation + +namespace OAI + +noncomputable section + +open scoped ComplexConjugate +open scoped BigOperators ComplexConjugate +open scoped BigOperators ComplexConjugate ENNReal Topology +open MeasureTheory +open scoped BigOperators +open MvPolynomial +open scoped BigOperators ComplexConjugate Classical +open Submodule +open scoped ENNReal +open Module +open scoped ComplexConjugate BigOperators Matrix +open NormedSpace +open scoped Matrix.Norms.Operator +open scoped Topology +open MeasureTheory NormedSpace +open Filter Asymptotics Topology +open ContinuousLinearMap + +namespace TensorLp +open scoped ENNReal +variable {A B : Type*} + +theorem positive_quadratic_slices {Z : H A →L[ℂ] H A} (hZ : Z.IsPositive) + (x : H (A × B)) : + ENNReal.ofReal (inner ℂ x (liftLeft Z x)).re= + ∑' b, ENNReal.ofReal (inner ℂ (slice x b) (Z (slice x b))).re := by + have hs : HasSum (fun b => (inner ℂ (slice x b) (Z (slice x b))).re) + (inner ℂ x (liftLeft Z x)).re := by + simpa only [Complex.reCLM_apply,slice_liftLeft] using + (hasSum_slice_inner x (liftLeft Z x)).mapL Complex.reCLM + have hn (b : B) : 0 ≤ (inner ℂ (slice x b) (Z (slice x b))).re := + hZ.re_inner_nonneg_right (slice x b) + rw [← hs.tsum_eq, ENNReal.ofReal_tsum_of_nonneg hn hs.summable] +end TensorLp + +namespace BeamLadder +open EntropyPhotonNumber QuantumTrace Annihilation TensorLp +variable {n : ℕ} {J : Type*} + +theorem weightedConditional_form (η : ℝ) (hη : η ∈ Set.Icc 0 1) + (y : J → Fock n) (hy : Summable (fun j => ‖y j‖^2)) + (B : Fock n →L[ℂ] Fock n) (hB : B.IsPositive) (Q : Fock n → ℝ≥0∞) + (hQ : ∀ x, ENNReal.ofReal (inner ℂ x (B x)).re=Q (inverseWeight 2 x)) + (x : Fock n) : + ENNReal.ofReal (inner ℂ x (weightedConditional η hη y B x)).re= + ∑' j, ∑' e, Q (slice (beamUnitary η hη + (tensor (inverseWeight 2 x) (inverseWeight 2 (y j)))) e) := by + have hp := liftLeft_positive (B:=NumberIndex n) hB + have hs : HasSum (fun j => (inner ℂ (weightedColumn η hη (y j) x) + (liftLeft B (weightedColumn η hη (y j) x))).re) + (inner ℂ x (weightedConditional η hη y B x)).re := by + exact (EnsemblePullback.hasSum_entry (weightedColumn_summable η hη y hy) + (liftLeft B) x x).mapL Complex.reCLM + have hn (j : J) : 0 ≤ (inner ℂ (weightedColumn η hη (y j) x) + (liftLeft B (weightedColumn η hη (y j) x))).re := + hp.re_inner_nonneg_right (weightedColumn η hη (y j) x) + rw [← hs.tsum_eq,ENNReal.ofReal_tsum_of_nonneg hn hs.summable] + apply tsum_congr + intro j + rw [positive_quadratic_slices hB] + apply tsum_congr + intro e + rw [hQ] + congr 1 + rw [← slice_liftLeft,weightedColumn_inverse] +theorem weightedConditionalRight_form (η : ℝ) (hη : η ∈ Set.Icc 0 1) + (y : J → Fock n) (hy : Summable (fun j => ‖y j‖^2)) + (B : Fock n →L[ℂ] Fock n) (hB : B.IsPositive) (Q : Fock n → ℝ≥0∞) + (hQ : ∀ x, ENNReal.ofReal (inner ℂ x (B x)).re=Q (inverseWeight 2 x)) + (x : Fock n) : + ENNReal.ofReal (inner ℂ x (weightedConditionalRight η hη y B x)).re= + ∑' j, ∑' e, Q (slice (beamUnitary η hη + (tensor (inverseWeight 2 (y j)) (inverseWeight 2 x))) e) := by + have hp := liftLeft_positive (B:=NumberIndex n) hB + have hs : HasSum (fun j => (inner ℂ (weightedColumnRight η hη (y j) x) + (liftLeft B (weightedColumnRight η hη (y j) x))).re) + (inner ℂ x (weightedConditionalRight η hη y B x)).re := by + exact (EnsemblePullback.hasSum_entry (weightedColumnRight_summable η hη y hy) + (liftLeft B) x x).mapL Complex.reCLM + have hn (j : J) : 0 ≤ (inner ℂ (weightedColumnRight η hη (y j) x) + (liftLeft B (weightedColumnRight η hη (y j) x))).re := + hp.re_inner_nonneg_right (weightedColumnRight η hη (y j) x) + rw [← hs.tsum_eq,ENNReal.ofReal_tsum_of_nonneg hn hs.summable] + apply tsum_congr + intro j + rw [positive_quadratic_slices hB] + apply tsum_congr + intro e + rw [hQ] + congr 1 + rw [← slice_liftLeft,weightedColumnRight_inverse] +end BeamLadder + +namespace EntropyPhotonNumber + +section +open QuantumTrace Annihilation BeamLadder TensorLp +variable {n : ℕ} +theorem weightedConditional_root_form (η : ℝ) (hη : η ∈ Set.Icc 0 1) + (σ : State n) (hm : FiniteMoment 4 σ) + (B : Fock n →L[ℂ] Fock n) (hB : B.IsPositive) (Q : Fock n → ℝ≥0∞) + (hQ : ∀ x, ENNReal.ofReal (inner ℂ x (B x)).re=Q (inverseWeight 2 x)) + (x : Fock n) : + ENNReal.ofReal (inner ℂ x (weightedConditional η hη (weightedRoot 2 σ hm) B x)).re= + ∑' eb, Q (firstKraus η hη σ eb (inverseWeight 2 x)) := by + rw [weightedConditional_form η hη _ (weightedRoot_summable 2 σ hm) B hB Q hQ] + simp only [inverse_weightedRoot,firstKraus_apply,ENNReal.tsum_prod'] + exact ENNReal.tsum_comm + +theorem weightedConditionalRight_root_form (η : ℝ) (hη : η ∈ Set.Icc 0 1) + (σ : State n) (hm : FiniteMoment 4 σ) + (B : Fock n →L[ℂ] Fock n) (hB : B.IsPositive) (Q : Fock n → ℝ≥0∞) + (hQ : ∀ x, ENNReal.ofReal (inner ℂ x (B x)).re=Q (inverseWeight 2 x)) + (x : Fock n) : + ENNReal.ofReal (inner ℂ x (weightedConditionalRight η hη (weightedRoot 2 σ hm) B x)).re= + ∑' eb, Q (secondKraus η hη σ eb (inverseWeight 2 x)) := by + rw [weightedConditionalRight_form η hη _ (weightedRoot_summable 2 σ hm) B hB Q hQ] + simp only [inverse_weightedRoot,secondKraus_apply,ENNReal.tsum_prod'] + exact ENNReal.tsum_comm + +namespace GibbsData +variable {k : ℝ} {ρ : State n} (G : GibbsData n k ρ) + +theorem logarithmic_weight_nonneg (j : G.J) : 0 ≤ -Real.log (gibbsWeight G.eigenval j) := by + let : Nonempty G.J := G.nonempty + apply neg_nonneg.mpr + apply Real.log_nonpos (gibbsWeight_pos G.eigenval G.heat j).le + have hh := (gibbsWeight_hasSum G.eigenval G.heat).summable.le_tsum j + (fun i _ => (gibbsWeight_pos G.eigenval G.heat i).le) + rwa [(gibbsWeight_hasSum G.eigenval G.heat).tsum_eq] at hh + +theorem quarticLogarithm_positive (hk : 0 ?_⟩ + change 0 ≤ RCLike.re (inner ℂ (G.quarticLogarithm x) x) + rw [inner_re_symm] + exact (G.quarticLogarithm_parseval hk x).nonneg + (fun j => mul_nonneg (G.logarithmic_weight_nonneg j) (sq_nonneg _)) + +theorem quarticLogarithm_form (hk : 0 ENNReal.ofReal (-Real.log (gibbsWeight G.eigenval j))) + (inverseWeight 2 x) := by + have hs := G.quarticLogarithm_parseval hk x + rw [inversePower_root_four] at hs + rw [basisMoment_ofReal G.basis _ G.logarithmic_weight_nonneg _ hs.summable,hs.tsum_eq] + +end GibbsData + +def WeightedColumns.canonical (ρ : State n) (hm : FiniteMoment 6 ρ) : WeightedColumns ρ where + Index := NumberIndex n + vector := weightedRoot 3 ρ hm + summable := weightedRoot_summable 3 ρ hm + normalized := by simpa only [inverse_weightedRoot] using rootColumn_norm ρ + density := by simpa only [inverse_weightedRoot] using rootColumn_operator ρ + +theorem weightedRoot_inverse_one (ρ : State n) (hm : FiniteMoment 6 ρ) + (hm4 : FiniteMoment 4 ρ) (i : NumberIndex n) : + inverseWeight 1 (weightedRoot 3 ρ hm i)=weightedRoot 2 ρ hm4 i := by + apply lp.ext + funext k + have hw : (numberWeight k:ℂ) ≠ 0 := by + exact_mod_cast (show numberWeight k ≠ 0 by linarith [numberWeight_one_le k]) + simp only [inverseWeight_apply,weightedRoot_apply,Complex.ofReal_pow,pow_one] + field_simp + +namespace WeightedColumns + +theorem canonical_slice (ρ : State n) (hm : FiniteMoment 6 ρ) (hm4 : FiniteMoment 4 ρ) + (η : ℝ) (hη : η ∈ Set.Icc 0 1) (B : Fock n →L[ℂ] Fock n) : + (canonical ρ hm).slice η hη B=weightedConditional η hη (weightedRoot 2 ρ hm4) B := by + unfold slice canonical + congr 1 + funext i + exact weightedRoot_inverse_one ρ hm hm4 i + +theorem canonical_sliceRight (ρ : State n) (hm : FiniteMoment 6 ρ) (hm4 : FiniteMoment 4 ρ) + (η : ℝ) (hη : η ∈ Set.Icc 0 1) (B : Fock n →L[ℂ] Fock n) : + (canonical ρ hm).sliceRight η hη B=weightedConditionalRight η hη (weightedRoot 2 ρ hm4) B := by + unfold sliceRight canonical + congr 1 + funext i + exact weightedRoot_inverse_one ρ hm hm4 i +end WeightedColumns + +theorem weightedConditional_positive (η : ℝ) (hη : η ∈ Set.Icc 0 1) + {J : Type*} (y : J → Fock n) {B : Fock n →L[ℂ] Fock n} (hB : B.IsPositive) : + (weightedConditional η hη y B).IsPositive := + EnsemblePullback.pullback_positive _ (liftLeft_positive hB) + +theorem weightedConditionalRight_positive (η : ℝ) (hη : η ∈ Set.Icc 0 1) + {J : Type*} (y : J → Fock n) {B : Fock n →L[ℂ] Fock n} (hB : B.IsPositive) : + (weightedConditionalRight η hη y B).IsPositive := + EnsemblePullback.pullback_positive _ (liftLeft_positive hB) + +theorem weightedConditional_twopass_form (η θ : ℝ) (hη : η ∈ Set.Icc 0 1) (hθ : θ ∈ Set.Icc 0 1) + (σ τD : State n) (hσ : FiniteMoment 4 σ) (hD : FiniteMoment 4 τD) + (B : Fock n →L[ℂ] Fock n) (hB : B.IsPositive) (Q : Fock n → ℝ≥0∞) + (hQ : ∀ x, ENNReal.ofReal (inner ℂ x (B x)).re=Q (inverseWeight 2 x)) + (x : Fock n) : + ENNReal.ofReal (inner ℂ x (weightedConditional η hη (weightedRoot 2 σ hσ) + (weightedConditional θ hθ (weightedRoot 2 τD hD) B) x)).re= + ∑' ij, Q (composeKraus (firstKraus θ hθ τD) (firstKraus η hη σ) ij (inverseWeight 2 x)) := by + rw [weightedConditional_root_form η hη σ hσ _ + (weightedConditional_positive θ hθ _ hB) + (fun z => ∑' e, Q (firstKraus θ hθ τD e z)) + (weightedConditional_root_form θ hθ τD hD B hB Q hQ)] + simp only [composeKraus,ContinuousLinearMap.comp_apply] + rw [ENNReal.tsum_prod' (f := fun ij : + (NumberIndex n × NumberIndex n) × (NumberIndex n × NumberIndex n) => + Q (firstKraus θ hθ τD ij.1 (firstKraus η hη σ ij.2 (inverseWeight 2 x))))] + exact ENNReal.tsum_comm + +theorem weightedConditionalRight_twopass_form (η θ : ℝ) (hη : η ∈ Set.Icc 0 1) (hθ : θ ∈ Set.Icc 0 1) + (σ τD : State n) (hσ : FiniteMoment 4 σ) (hD : FiniteMoment 4 τD) + (B : Fock n →L[ℂ] Fock n) (hB : B.IsPositive) (Q : Fock n → ℝ≥0∞) + (hQ : ∀ x, ENNReal.ofReal (inner ℂ x (B x)).re=Q (inverseWeight 2 x)) + (x : Fock n) : + ENNReal.ofReal (inner ℂ x (weightedConditionalRight η hη (weightedRoot 2 σ hσ) + (weightedConditional θ hθ (weightedRoot 2 τD hD) B) x)).re= + ∑' ij, Q (composeKraus (firstKraus θ hθ τD) (secondKraus η hη σ) ij (inverseWeight 2 x)) := by + rw [weightedConditionalRight_root_form η hη σ hσ _ + (weightedConditional_positive θ hθ _ hB) + (fun z => ∑' e, Q (firstKraus θ hθ τD e z)) + (weightedConditional_root_form θ hθ τD hD B hB Q hQ)] + simp only [composeKraus,ContinuousLinearMap.comp_apply] + rw [ENNReal.tsum_prod' (f := fun ij : + (NumberIndex n × NumberIndex n) × (NumberIndex n × NumberIndex n) => + Q (firstKraus θ hθ τD ij.1 (secondKraus η hη σ ij.2 (inverseWeight 2 x))))] + exact ENNReal.tsum_comm + +theorem spectral_physical_twopass_identification {J : Type*} + (η θ : ℝ) (hη : η ∈ Set.Icc 0 1) (hθ : θ ∈ Set.Icc 0 1) + (σ τD : State n) (hσ : FiniteMoment 4 σ) (hD : FiniteMoment 4 τD) + (b : HilbertBasis J ℂ (Fock n)) (w : J → ℝ≥0∞) + (B C : Fock n →L[ℂ] Fock n) (hB : B.IsPositive) (hC : C.IsPositive) + (hBe : ∀ x, ENNReal.ofReal (inner ℂ x (B x)).re=basisMoment b w (inverseWeight 2 x)) + (hCe : ∀ x, ENNReal.ofReal (inner ℂ x (C x)).re= + sliceMoment b w (composeKraus (firstKraus θ hθ τD) (firstKraus η hη σ)) + (inversePower rootNumberWeight rootNumberWeight_one_le 4 x)) : + C=weightedConditional η hη (weightedRoot 2 σ hσ) + (weightedConditional θ hθ (weightedRoot 2 τD hD) B) := by + have hp := weightedConditional_positive η hη (weightedRoot 2 σ hσ) + (weightedConditional_positive θ hθ (weightedRoot 2 τD hD) hB) + apply positive_eq_of_quadratic hC hp + intro x + apply (ENNReal.ofReal_eq_ofReal_iff (hC.re_inner_nonneg_right x) (hp.re_inner_nonneg_right x)).mp + change ENNReal.ofReal (inner ℂ x (C x)).re = + ENNReal.ofReal (inner ℂ x (weightedConditional η hη (weightedRoot 2 σ hσ) + (weightedConditional θ hθ (weightedRoot 2 τD hD) B) x)).re + rw [hCe,inversePower_root_four,weightedConditional_twopass_form η θ hη hθ σ τD hσ hD B hB + (basisMoment b w) hBe] + rfl + +theorem spectral_physical_right_twopass_identification {J : Type*} + (η θ : ℝ) (hη : η ∈ Set.Icc 0 1) (hθ : θ ∈ Set.Icc 0 1) + (σ τD : State n) (hσ : FiniteMoment 4 σ) (hD : FiniteMoment 4 τD) + (b : HilbertBasis J ℂ (Fock n)) (w : J → ℝ≥0∞) + (B C : Fock n →L[ℂ] Fock n) (hB : B.IsPositive) (hC : C.IsPositive) + (hBe : ∀ x, ENNReal.ofReal (inner ℂ x (B x)).re=basisMoment b w (inverseWeight 2 x)) + (hCe : ∀ x, ENNReal.ofReal (inner ℂ x (C x)).re= + sliceMoment b w (composeKraus (firstKraus θ hθ τD) (secondKraus η hη σ)) + (inversePower rootNumberWeight rootNumberWeight_one_le 4 x)) : + C=weightedConditionalRight η hη (weightedRoot 2 σ hσ) + (weightedConditional θ hθ (weightedRoot 2 τD hD) B) := by + have hp := weightedConditionalRight_positive η hη (weightedRoot 2 σ hσ) + (weightedConditional_positive θ hθ (weightedRoot 2 τD hD) hB) + apply positive_eq_of_quadratic hC hp + intro x + apply (ENNReal.ofReal_eq_ofReal_iff (hC.re_inner_nonneg_right x) (hp.re_inner_nonneg_right x)).mp + change ENNReal.ofReal (inner ℂ x (C x)).re = + ENNReal.ofReal (inner ℂ x (weightedConditionalRight η hη (weightedRoot 2 σ hσ) + (weightedConditional θ hθ (weightedRoot 2 τD hD) B) x)).re + rw [hCe,inversePower_root_four,weightedConditionalRight_twopass_form η θ hη hθ σ τD hσ hD B hB + (basisMoment b w) hBe] + rfl +end + +section +open QuantumTrace TensorLp + +theorem output_logarithm_representation {n : ℕ} (ρ : State n) {r κ : ℝ} (hr : 0 < r) + (hκ : 0 < κ) (hκ1 : κ ≤ 1) (hle : (κ : ℂ) • (thermalState n r hr).op ≤ ρ.op) + {J : Type*} (b : HilbertBasis J ℂ (Fock n)) (p : J → ℝ) (hp : ∀ j, 0 < p j) + (hs : HasSum p 1) (he : ∀ j, ρ.op (b j) = (p j : ℂ) • b j) : + ∃ B : Fock n →L[ℂ] Fock n, B.IsPositive ∧ ∀ x, + ENNReal.ofReal (inner ℂ x (B x)).re = + basisMoment b (fun j => ENNReal.ofReal (-Real.log (p j))) + (inversePower rootNumberWeight rootNumberWeight_one_le 4 x) := by + let V : Unit → Fock n →L[ℂ] Fock n := fun _ => 1 + have hV : ∀ x : Fock n, HasSum (fun i => ‖V i x‖^2) (‖x‖^2) := by + intro x + simpa only [V,one_apply_eq_self,Finset.univ_unique,Finset.sum_singleton] + using (hasSum_fintype (fun i : Unit => ‖V i x‖^2)) + have hE : ∀ x : Fock n, + (∑' i, vectorMoment (fun k => (totalNumber k : ℝ≥0∞)) (V i x)) ≤ + vectorMoment (fun k => (totalNumber k : ℝ≥0∞)) x+ + ENNReal.ofReal 0*ENNReal.ofReal (‖x‖^2) := by + intro x + simp only [V,one_apply_eq_self,tsum_fintype,Fintype.sum_unique,ENNReal.ofReal_zero,zero_mul,add_zero,le_refl] + obtain ⟨C,hC,hCe⟩ := logarithmic_slice_representation ρ hr hκ hκ1 hle b p hp hs he + V 0 le_rfl hV hE + let R := inversePower (rootNumberWeight (n:=n)) rootNumberWeight_one_le 3 + have hRa : R.adjoint=R := inversePower_adjoint _ _ _ + have hCR : (R*C*R).IsPositive := by + simpa only [hRa, ← ContinuousLinearMap.mul_def, mul_assoc] using hC.adjoint_conj R + refine ⟨R*C*R,hCR,fun x => ?_⟩ + have hquad : inner ℂ x ((R*C*R) x)=inner ℂ (R x) (C (R x)) := by + change inner ℂ x (R (C (R x)))=_ + exact ((inversePower_positive rootNumberWeight rootNumberWeight_one_le 3).isSymmetric + x (C (R x))).symm + rw [hquad,hCe,energyInverse_mul_three] + simp only [sliceMoment,V,one_apply_eq_self,tsum_fintype,Fintype.sum_unique] +end + +section +open QuantumTrace Annihilation BeamLadder TensorLp +variable {n : ℕ} {k : ℝ} {ρ : State n} +namespace GibbsData +variable (G : GibbsData n k ρ) + +theorem exact_physical_first_logarithmic_identity {J : Type*} + (R : Regularization n) (σ : State n) (hσ : FiniteMoment 4 σ) (hD : FiniteMoment 4 R.τD) + (τ : State n) {r δ : ℝ} (hr : 0 ENNReal.ofReal (-Real.log (p j))) (inverseWeight 2 x)) + (hform : ∀ x, ENNReal.ofReal (inner ℂ x (G.B x)).re = ENNReal.ofReal α* + sliceMoment b (fun j => ENNReal.ofReal (-Real.log (p j))) + (R.firstFlow σ (finiteMoment_finiteEnergy (by norm_num) hσ)).V (energyInverse n x)+ + ENNReal.ofReal β*numberVectorMoment (energyInverse n x)) : + ∃ D : Fock n →L[ℂ] Fock n, D.IsPositive ∧ + (∀ x, ENNReal.ofReal (inner ℂ x (D x)).re = + numberVectorMoment (inversePower rootNumberWeight rootNumberWeight_one_le 4 x)) ∧ + G.quarticLogarithm = (k:ℂ) • (1 : Fock n →L[ℂ] Fock n)+ + (α:ℂ) • (weightedConditional R.η R.hη (weightedRoot 2 σ hσ) + (weightedConditional (1-R.δ) ⟨sub_nonneg.mpr R.hδ.2, sub_le_self _ R.hδ.1⟩ + (weightedRoot 2 R.τD hD) B))+(β:ℂ) • D+ + (Real.log (heatPartition G.eigenval):ℂ) • + (inversePower rootNumberWeight rootNumberWeight_one_le 4 * + inversePower rootNumberWeight rootNumberWeight_one_le 4) := by + obtain ⟨C,D,hC,hD',hCe,hDe,hid⟩ := G.exact_logarithmic_identity + (R.firstFlow σ (finiteMoment_finiteEnergy (by norm_num) hσ)) τ hr hδ hδ1 hle + b p hp hs he hα hβ hform + have hphysical := spectral_physical_twopass_identification R.η (1-R.δ) R.hη + ⟨sub_nonneg.mpr R.hδ.2, sub_le_self _ R.hδ.1⟩ σ R.τD hσ hD b + (fun j => ENNReal.ofReal (-Real.log (p j))) B C hB hC hBe hCe + exact ⟨D,hD',hDe,by simpa only [hphysical] using hid⟩ + +theorem exact_physical_second_logarithmic_identity {J : Type*} + (R : Regularization n) (σ : State n) (hσ : FiniteMoment 4 σ) (hD : FiniteMoment 4 R.τD) + (τ : State n) {r δ : ℝ} (hr : 0 ENNReal.ofReal (-Real.log (p j))) (inverseWeight 2 x)) + (hform : ∀ x, ENNReal.ofReal (inner ℂ x (G.B x)).re = ENNReal.ofReal α* + sliceMoment b (fun j => ENNReal.ofReal (-Real.log (p j))) + (R.secondFlow σ (finiteMoment_finiteEnergy (by norm_num) hσ)).V (energyInverse n x)+ + ENNReal.ofReal β*numberVectorMoment (energyInverse n x)) : + ∃ D : Fock n →L[ℂ] Fock n, D.IsPositive ∧ + (∀ x, ENNReal.ofReal (inner ℂ x (D x)).re = + numberVectorMoment (inversePower rootNumberWeight rootNumberWeight_one_le 4 x)) ∧ + G.quarticLogarithm = (k:ℂ) • (1 : Fock n →L[ℂ] Fock n)+ + (α:ℂ) • (weightedConditionalRight R.η R.hη (weightedRoot 2 σ hσ) + (weightedConditional (1-R.δ) ⟨sub_nonneg.mpr R.hδ.2, sub_le_self _ R.hδ.1⟩ + (weightedRoot 2 R.τD hD) B))+(β:ℂ) • D+ + (Real.log (heatPartition G.eigenval):ℂ) • + (inversePower rootNumberWeight rootNumberWeight_one_le 4 * + inversePower rootNumberWeight rootNumberWeight_one_le 4) := by + obtain ⟨C,D,hC,hD',hCe,hDe,hid⟩ := G.exact_logarithmic_identity + (R.secondFlow σ (finiteMoment_finiteEnergy (by norm_num) hσ)) τ hr hδ hδ1 hle + b p hp hs he hα hβ hform + have hphysical := spectral_physical_right_twopass_identification R.η (1-R.δ) R.hη + ⟨sub_nonneg.mpr R.hδ.2, sub_le_self _ R.hδ.1⟩ σ R.τD hσ hD b + (fun j => ENNReal.ofReal (-Real.log (p j))) B C hB hC hBe hCe + exact ⟨D,hD',hDe,by simpa only [hphysical] using hid⟩ +end GibbsData +end + +namespace Regularization +open QuantumTrace +variable {n : ℕ} (R : Regularization n) + +theorem minimum_centered_gibbs_data (ρ σ : State n) (hmρ : FiniteMoment 4 ρ) (hmσ : FiniteMoment 4 σ) + {r : ℝ} (hr : 0 < r) (hτ : R.τ0 = thermalState n r hr) (hκ : 0 < R.κ) + (hmin : ∀ ρ' σ', FiniteMoment 4 ρ' → FiniteMoment 4 σ' → R.objective ρ σ ≤ R.objective ρ' σ') : + ∃ (J : Type) (b : HilbertBasis J ℂ (Fock n)) (p : J → ℝ), + (∀ j, 0 < p j) ∧ HasSum p 1 ∧ (∀ j, (R.output ρ σ).op (b j) = (p j : ℂ) • b j) ∧ + ∃ (G1 : GibbsData n (R.ζ/R.a1) ρ) (G2 : GibbsData n (R.ζ/R.a2) σ), + (∀ x, ENNReal.ofReal (inner ℂ x (G1.B x)).re = + ENNReal.ofReal (R.c*(1-R.κ)/R.a1)*sliceMoment b (fun j => ENNReal.ofReal (-Real.log (p j))) + (R.firstFlow σ (finiteMoment_finiteEnergy (by norm_num) hmσ)).V (energyInverse n x)+ + ENNReal.ofReal (R.b1/R.a1)*numberVectorMoment (energyInverse n x)) ∧ + (∀ x, ENNReal.ofReal (inner ℂ x (G2.B x)).re = + ENNReal.ofReal (R.c*(1-R.κ)/R.a2)*sliceMoment b (fun j => ENNReal.ofReal (-Real.log (p j))) + (R.secondFlow ρ (finiteMoment_finiteEnergy (by norm_num) hmρ)).V (energyInverse n x)+ + ENNReal.ofReal (R.b2/R.a2)*numberVectorMoment (energyInverse n x)) ∧ + (∀ Z : Fock n →L[ℂ] Fock n, Z ∈ CenteredTests.operatorSpace b p → + (1-R.κ)^2*BKM.quadratic G1.basis (gibbsWeight G1.eigenval) + (BKM.center G1.basis (gibbsWeight G1.eigenval) + ((R.firstFlow σ (finiteMoment_finiteEnergy (by norm_num) hmσ)).dual Z)) ≤ + (R.a1/R.c)*BKM.quadratic b p Z) ∧ + (∀ Z : Fock n →L[ℂ] Fock n, Z ∈ CenteredTests.operatorSpace b p → + (1-R.κ)^2*BKM.quadratic G2.basis (gibbsWeight G2.eigenval) + (BKM.center G2.basis (gibbsWeight G2.eigenval) + ((R.secondFlow ρ (finiteMoment_finiteEnergy (by norm_num) hmρ)).dual Z)) ≤ + (R.a2/R.c)*BKM.quadratic b p Z) := by + classical + have hle : (R.κ : ℂ) • (thermalState n r hr).op ≤ (R.output ρ σ).op := by + rw [← hτ] + exact mixture_replacement_le R.κ R.hκ (R.rawOutput ρ σ) R.τ0 + obtain ⟨J,b,p,hp,hs,he⟩ := exists_faithful_eigenbasis_of_thermal_le (R.output ρ σ) hr hκ hle + have hmin1 (ρ' : State n) (hmρ' : FiniteMoment 4 ρ') := hmin ρ' σ hmρ' hmσ + have hmin2 (σ' : State n) (hmσ' : FiniteMoment 4 σ') := hmin ρ σ' hmρ hmσ' + obtain ⟨G1,hG1,hh1⟩ := minimum_centered_hessian_data + (R.firstFlow σ (finiteMoment_finiteEnergy (by norm_num) hmσ)) R.τ0 hr hτ R.κ R.hκ hκ + R.c R.a1 R.b1 R.ζ R.hc R.ha1 R.hb1.le R.hζ ρ hmρ b p hp hs he (by + intro ρ' hmρ' + have h := hmin1 ρ' hmρ' + dsimp only [objective] at h + change R.c*entropy (R.output ρ σ)-R.a1*entropy ρ+R.b1*energy ρ+R.ζ*numberMoment 4 ρ ≤ + R.c*entropy (R.output ρ' σ)-R.a1*entropy ρ'+R.b1*energy ρ'+R.ζ*numberMoment 4 ρ' + linarith) + obtain ⟨G2,hG2,hh2⟩ := minimum_centered_hessian_data + (R.secondFlow ρ (finiteMoment_finiteEnergy (by norm_num) hmρ)) R.τ0 hr hτ R.κ R.hκ hκ + R.c R.a2 R.b2 R.ζ R.hc R.ha2 R.hb2.le R.hζ σ hmσ b p hp hs he (by + intro σ' hmσ' + have h := hmin2 σ' hmσ' + dsimp only [objective] at h + change R.c*entropy (R.output ρ σ)-R.a2*entropy σ+R.b2*energy σ+R.ζ*numberMoment 4 σ ≤ + R.c*entropy (R.output ρ σ')-R.a2*entropy σ'+R.b2*energy σ'+R.ζ*numberMoment 4 σ' + linarith) + exact ⟨J,b,p,hp,hs,he,G1,G2,hG1,hG2,hh1,hh2⟩ + +end Regularization + +open QuantumTrace Annihilation BeamLadder TensorLp +namespace Regularization +variable {n : ℕ} (R : Regularization n) + +theorem minimum_physical_log_data (ρ σ : State n) (hmρ : FiniteMoment 4 ρ) + (hmσ : FiniteMoment 4 σ) (hmD : FiniteMoment 4 R.τD) + {r : ℝ} (hr : 0 < r) (hτ : R.τ0 = thermalState n r hr) (hκ : 0 < R.κ) + (hmin : ∀ ρ' σ', FiniteMoment 4 ρ' → FiniteMoment 4 σ' → R.objective ρ σ ≤ R.objective ρ' σ') : + ∃ (J : Type) (b : HilbertBasis J ℂ (Fock n)) (p : J → ℝ), + (∀ j, 0 < p j) ∧ HasSum p 1 ∧ (∀ j, (R.output ρ σ).op (b j) = (p j : ℂ) • b j) ∧ + ∃ (G1 : GibbsData n (R.ζ/R.a1) ρ) (G2 : GibbsData n (R.ζ/R.a2) σ) + (B D1 D2 : Fock n →L[ℂ] Fock n), B.IsPositive ∧ D1.IsPositive ∧ D2.IsPositive ∧ + (∀ x, ENNReal.ofReal (inner ℂ x (B x)).re= + basisMoment b (fun j => ENNReal.ofReal (-Real.log (p j))) (inverseWeight 2 x)) ∧ + (∀ x, ENNReal.ofReal (inner ℂ x (D1 x)).re= + numberVectorMoment (inversePower rootNumberWeight rootNumberWeight_one_le 4 x)) ∧ + (∀ x, ENNReal.ofReal (inner ℂ x (D2 x)).re= + numberVectorMoment (inversePower rootNumberWeight rootNumberWeight_one_le 4 x)) ∧ + (G1.quarticLogarithm = ((R.ζ/R.a1:ℝ):ℂ) • (1 : Fock n →L[ℂ] Fock n)+ + ((R.c*(1-R.κ)/R.a1:ℝ):ℂ) • + (weightedConditional R.η R.hη (weightedRoot 2 σ hmσ) + (weightedConditional (1-R.δ) ⟨sub_nonneg.mpr R.hδ.2,sub_le_self _ R.hδ.1⟩ + (weightedRoot 2 R.τD hmD) B))+ + ((R.b1/R.a1:ℝ):ℂ) • D1+(Real.log (heatPartition G1.eigenval):ℂ) • + (inversePower rootNumberWeight rootNumberWeight_one_le 4 * + inversePower rootNumberWeight rootNumberWeight_one_le 4)) ∧ + (G2.quarticLogarithm = ((R.ζ/R.a2:ℝ):ℂ) • (1 : Fock n →L[ℂ] Fock n)+ + ((R.c*(1-R.κ)/R.a2:ℝ):ℂ) • + (weightedConditionalRight R.η R.hη (weightedRoot 2 ρ hmρ) + (weightedConditional (1-R.δ) ⟨sub_nonneg.mpr R.hδ.2,sub_le_self _ R.hδ.1⟩ + (weightedRoot 2 R.τD hmD) B))+ + ((R.b2/R.a2:ℝ):ℂ) • D2+(Real.log (heatPartition G2.eigenval):ℂ) • + (inversePower rootNumberWeight rootNumberWeight_one_le 4 * + inversePower rootNumberWeight rootNumberWeight_one_le 4)) ∧ + (∀ Z : Fock n →L[ℂ] Fock n, Z ∈ CenteredTests.operatorSpace b p → + (1-R.κ)^2*BKM.quadratic G1.basis (gibbsWeight G1.eigenval) + (BKM.center G1.basis (gibbsWeight G1.eigenval) + ((R.firstFlow σ (finiteMoment_finiteEnergy (by norm_num) hmσ)).dual Z)) ≤ + (R.a1/R.c)*BKM.quadratic b p Z) ∧ + (∀ Z : Fock n →L[ℂ] Fock n, Z ∈ CenteredTests.operatorSpace b p → + (1-R.κ)^2*BKM.quadratic G2.basis (gibbsWeight G2.eigenval) + (BKM.center G2.basis (gibbsWeight G2.eigenval) + ((R.secondFlow ρ (finiteMoment_finiteEnergy (by norm_num) hmρ)).dual Z)) ≤ + (R.a2/R.c)*BKM.quadratic b p Z) := by + obtain ⟨J,b,p,hp,hs,he,G1,G2,hf1,hf2,hh1,hh2⟩ := + R.minimum_centered_gibbs_data ρ σ hmρ hmσ hr hτ hκ hmin + have hle : (R.κ : ℂ) • (thermalState n r hr).op ≤ (R.output ρ σ).op := by + rw [← hτ] + exact mixture_replacement_le R.κ R.hκ (R.rawOutput ρ σ) R.τ0 + obtain ⟨B,hB,hBe⟩ := output_logarithm_representation (R.output ρ σ) hr hκ R.hκ.2 hle b p hp hs he + have hBe' (x : Fock n) : ENNReal.ofReal (inner ℂ x (B x)).re= + basisMoment b (fun j => ENNReal.ofReal (-Real.log (p j))) (inverseWeight 2 x) := by + simpa only [inversePower_root_four] using hBe x + have hα1 : 0 ≤ R.c*(1-R.κ)/R.a1 := + div_nonneg (mul_nonneg R.hc.le (sub_nonneg.mpr R.hκ.2)) R.ha1.le + have hα2 : 0 ≤ R.c*(1-R.κ)/R.a2 := + div_nonneg (mul_nonneg R.hc.le (sub_nonneg.mpr R.hκ.2)) R.ha2.le + obtain ⟨D1,hD1,heD1,hid1⟩ := G1.exact_physical_first_logarithmic_identity R σ hmσ hmD + (R.output ρ σ) hr hκ R.hκ.2 hle b p hp hs he hα1 + (div_nonneg R.hb1.le R.ha1.le) B hB hBe' hf1 + obtain ⟨D2,hD2,heD2,hid2⟩ := G2.exact_physical_second_logarithmic_identity R ρ hmρ hmD + (R.output ρ σ) hr hκ R.hκ.2 hle b p hp hs he hα2 + (div_nonneg R.hb2.le R.ha2.le) B hB hBe' hf2 + exact ⟨J,b,p,hp,hs,he,G1,G2,B,D1,D2,hB,hD1,hD2,hBe',heD1,heD2,hid1,hid2,hh1,hh2⟩ +end Regularization +end EntropyPhotonNumber + +namespace WeightedGenerator +open EntropyPhotonNumber QuantumTrace Annihilation +variable {n : ℕ} {I : Type*} + +theorem pairing_add (r : ℝ) (x : I → Fock n) + (hx : Summable (fun i => ‖x i‖^2)) (A B : Fock n →L[ℂ] Fock n) : + pairing r x (A+B)=pairing r x A+pairing r x B := by + apply (pairing_hasSum (numberBasis n) r x hx (A+B)).unique + convert! (pairing_hasSum (numberBasis n) r x hx A).add + (pairing_hasSum (numberBasis n) r x hx B) using 1 + ext k + simp only [add_apply,inner_add_right] + +theorem pairing_smul (r : ℝ) (x : I → Fock n) + (hx : Summable (fun i => ‖x i‖^2)) (c : ℂ) (A : Fock n →L[ℂ] Fock n) : + pairing r x (c • A)=c*pairing r x A := by + apply (pairing_hasSum (numberBasis n) r x hx (c • A)).unique + convert! (pairing_hasSum (numberBasis n) r x hx A).mul_left c using 1 + ext k + simp only [smul_apply,inner_smul_right] + +theorem pairing_scalar_inverse (r : ℝ) (x : I → Fock n) + (hx : Summable (fun i => ‖x i‖^2)) (c : ℂ) : + pairing r x (c • (inversePower rootNumberWeight rootNumberWeight_one_le 4 * + inversePower rootNumberWeight rootNumberWeight_one_le 4))=0 := by + rw [pairing_smul r x hx,inversePower_root_four] + change c*pairing r x (inverseWeight 2 ∘L inverseWeight 2)=0 + rw [← inverseWeight_add,pairing_inverse_zero,mul_zero] +end WeightedGenerator + +namespace EntropyPhotonNumber + +section +open QuantumTrace Annihilation BeamLadder TensorLp +variable {n : ℕ} {k : ℝ} {ρ : State n} +namespace GibbsData +variable (G : GibbsData n k ρ) +theorem exact_physical_first_logarithmic_pairing {J : Type*} + (s : ℝ) (X : WeightedColumns ρ) + (R : Regularization n) (σ : State n) (hσ : FiniteMoment 4 σ) (hD : FiniteMoment 4 R.τD) + (τ : State n) {r δ : ℝ} (hr : 0 ENNReal.ofReal (-Real.log (p j))) (inverseWeight 2 x)) + (hform : ∀ x, ENNReal.ofReal (inner ℂ x (G.B x)).re = ENNReal.ofReal α* + sliceMoment b (fun j => ENNReal.ofReal (-Real.log (p j))) + (R.firstFlow σ (finiteMoment_finiteEnergy (by norm_num) hσ)).V (energyInverse n x)+ + ENNReal.ofReal β*numberVectorMoment (energyInverse n x)) : + ∃ D : Fock n →L[ℂ] Fock n, D.IsPositive ∧ + (∀ x, ENNReal.ofReal (inner ℂ x (D x)).re = + numberVectorMoment (inversePower rootNumberWeight rootNumberWeight_one_le 4 x)) ∧ + WeightedGenerator.pairing s X.vector G.quarticLogarithm = + (k:ℂ)*WeightedGenerator.pairing s X.vector (1 : Fock n →L[ℂ] Fock n)+ + (α:ℂ)*WeightedGenerator.pairing s X.vector + (weightedConditional R.η R.hη (weightedRoot 2 σ hσ) + (weightedConditional (1-R.δ) ⟨sub_nonneg.mpr R.hδ.2,sub_le_self _ R.hδ.1⟩ + (weightedRoot 2 R.τD hD) B))+ + (β:ℂ)*WeightedGenerator.pairing s X.vector D := by + obtain ⟨D,hD',hDe,hid⟩ := G.exact_physical_first_logarithmic_identity R σ hσ hD + τ hr hδ hδ1 hle b p hp hs he hα hβ B hB hBe hform + refine ⟨D,hD',hDe,?_⟩ + have hh := congrArg (WeightedGenerator.pairing s X.vector) hid + simpa only [WeightedGenerator.pairing_add s X.vector X.summable, + WeightedGenerator.pairing_scalar_inverse s X.vector X.summable, + WeightedGenerator.pairing_smul s X.vector X.summable,add_zero] using hh + +theorem exact_physical_second_logarithmic_pairing {J : Type*} + (s : ℝ) (X : WeightedColumns ρ) + (R : Regularization n) (σ : State n) (hσ : FiniteMoment 4 σ) (hD : FiniteMoment 4 R.τD) + (τ : State n) {r δ : ℝ} (hr : 0 ENNReal.ofReal (-Real.log (p j))) (inverseWeight 2 x)) + (hform : ∀ x, ENNReal.ofReal (inner ℂ x (G.B x)).re = ENNReal.ofReal α* + sliceMoment b (fun j => ENNReal.ofReal (-Real.log (p j))) + (R.secondFlow σ (finiteMoment_finiteEnergy (by norm_num) hσ)).V (energyInverse n x)+ + ENNReal.ofReal β*numberVectorMoment (energyInverse n x)) : + ∃ D : Fock n →L[ℂ] Fock n, D.IsPositive ∧ + (∀ x, ENNReal.ofReal (inner ℂ x (D x)).re = + numberVectorMoment (inversePower rootNumberWeight rootNumberWeight_one_le 4 x)) ∧ + WeightedGenerator.pairing s X.vector G.quarticLogarithm = + (k:ℂ)*WeightedGenerator.pairing s X.vector (1 : Fock n →L[ℂ] Fock n)+ + (α:ℂ)*WeightedGenerator.pairing s X.vector + (weightedConditionalRight R.η R.hη (weightedRoot 2 σ hσ) + (weightedConditional (1-R.δ) ⟨sub_nonneg.mpr R.hδ.2,sub_le_self _ R.hδ.1⟩ + (weightedRoot 2 R.τD hD) B))+ + (β:ℂ)*WeightedGenerator.pairing s X.vector D := by + obtain ⟨D,hD',hDe,hid⟩ := G.exact_physical_second_logarithmic_identity R σ hσ hD + τ hr hδ hδ1 hle b p hp hs he hα hβ B hB hBe hform + refine ⟨D,hD',hDe,?_⟩ + have hh := congrArg (WeightedGenerator.pairing s X.vector) hid + simpa only [WeightedGenerator.pairing_add s X.vector X.summable, + WeightedGenerator.pairing_scalar_inverse s X.vector X.summable, + WeightedGenerator.pairing_smul s X.vector X.summable,add_zero] using hh + +end GibbsData +end + +namespace Regularization + +section +open QuantumTrace Annihilation BeamLadder TensorLp +variable {n : ℕ} (R : Regularization n) + +private theorem pairing_balance_algebra (a1 a2 c k b1 b2 t l1 l2 w1 w2 s1 s2 d1 d2 : ℂ) + (ha1 : a1 ≠ 0) (ha2 : a2 ≠ 0) + (h1 : l1=k/a1*w1+c*t/a1*s1+b1/a1*d1) + (h2 : l2=k/a2*w2+c*t/a2*s2+b2/a2*d2) : + a1*l1+a2*l2=c*t*(s1+s2)+b1*d1+b2*d2+k*(w1+w2) := by + rw [h1,h2] + field_simp [ha1,ha2]; ring + +theorem minimum_physical_pairing_balance (ρ σ : State n) (hmρ : FiniteMoment 4 ρ) + (hmσ : FiniteMoment 4 σ) (hmD : FiniteMoment 4 R.τD) + {r : ℝ} (hr : 0 < r) (hτ : R.τ0 = thermalState n r hr) (hκ : 0 < R.κ) + (hmin : ∀ ρ' σ', FiniteMoment 4 ρ' → FiniteMoment 4 σ' → R.objective ρ σ ≤ R.objective ρ' σ') : + ∃ (J : Type) (b : HilbertBasis J ℂ (Fock n)) (p : J → ℝ), + (∀ j, 0 < p j) ∧ HasSum p 1 ∧ (∀ j, (R.output ρ σ).op (b j) = (p j : ℂ) • b j) ∧ + ∃ (G1 : GibbsData n (R.ζ/R.a1) ρ) (G2 : GibbsData n (R.ζ/R.a2) σ) + (B D1 D2 : Fock n →L[ℂ] Fock n), B.IsPositive ∧ D1.IsPositive ∧ D2.IsPositive ∧ + (∀ x, ENNReal.ofReal (inner ℂ x (B x)).re= + basisMoment b (fun j => ENNReal.ofReal (-Real.log (p j))) (inverseWeight 2 x)) ∧ + (∀ x, ENNReal.ofReal (inner ℂ x (D1 x)).re= + numberVectorMoment (inversePower rootNumberWeight rootNumberWeight_one_le 4 x)) ∧ + (∀ x, ENNReal.ofReal (inner ℂ x (D2 x)).re= + numberVectorMoment (inversePower rootNumberWeight rootNumberWeight_one_le 4 x)) ∧ + (∀ (s1 s2 : ℝ) (X : WeightedColumns ρ) (Y : WeightedColumns σ), + (R.a1:ℂ)*WeightedGenerator.pairing s1 X.vector G1.quarticLogarithm+ + (R.a2:ℂ)*WeightedGenerator.pairing s2 Y.vector G2.quarticLogarithm= + (R.c:ℂ)*((1-R.κ:ℝ):ℂ)* + (WeightedGenerator.pairing s1 X.vector + (weightedConditional R.η R.hη (weightedRoot 2 σ hmσ) + (weightedConditional (1-R.δ) ⟨sub_nonneg.mpr R.hδ.2,sub_le_self _ R.hδ.1⟩ + (weightedRoot 2 R.τD hmD) B))+ + WeightedGenerator.pairing s2 Y.vector + (weightedConditionalRight R.η R.hη (weightedRoot 2 ρ hmρ) + (weightedConditional (1-R.δ) ⟨sub_nonneg.mpr R.hδ.2,sub_le_self _ R.hδ.1⟩ + (weightedRoot 2 R.τD hmD) B)))+ + (R.b1:ℂ)*WeightedGenerator.pairing s1 X.vector D1+ + (R.b2:ℂ)*WeightedGenerator.pairing s2 Y.vector D2+ + (R.ζ:ℂ)*(WeightedGenerator.pairing s1 X.vector (1 : Fock n →L[ℂ] Fock n)+ + WeightedGenerator.pairing s2 Y.vector (1 : Fock n →L[ℂ] Fock n))) ∧ + (∀ Z : Fock n →L[ℂ] Fock n, Z ∈ CenteredTests.operatorSpace b p → + (1-R.κ)^2*BKM.quadratic G1.basis (gibbsWeight G1.eigenval) + (BKM.center G1.basis (gibbsWeight G1.eigenval) + ((R.firstFlow σ (finiteMoment_finiteEnergy (by norm_num) hmσ)).dual Z)) ≤ + (R.a1/R.c)*BKM.quadratic b p Z) ∧ + (∀ Z : Fock n →L[ℂ] Fock n, Z ∈ CenteredTests.operatorSpace b p → + (1-R.κ)^2*BKM.quadratic G2.basis (gibbsWeight G2.eigenval) + (BKM.center G2.basis (gibbsWeight G2.eigenval) + ((R.secondFlow ρ (finiteMoment_finiteEnergy (by norm_num) hmρ)).dual Z)) ≤ + (R.a2/R.c)*BKM.quadratic b p Z) := by + obtain ⟨J,b,p,hp,hs,he,G1,G2,B,D1,D2,hB,hD1,hD2,hBe,heD1,heD2,hid1,hid2,hh1,hh2⟩ := + R.minimum_physical_log_data ρ σ hmρ hmσ hmD hr hτ hκ hmin + refine ⟨J,b,p,hp,hs,he,G1,G2,B,D1,D2,hB,hD1,hD2,hBe,heD1,heD2,?_,hh1,hh2⟩ + intro s1 s2 X Y + have he1 := congrArg (WeightedGenerator.pairing s1 X.vector) hid1 + have he2 := congrArg (WeightedGenerator.pairing s2 Y.vector) hid2 + simp only [WeightedGenerator.pairing_add s1 X.vector X.summable, + WeightedGenerator.pairing_scalar_inverse s1 X.vector X.summable, + WeightedGenerator.pairing_smul s1 X.vector X.summable,add_zero, + Complex.ofReal_div,Complex.ofReal_mul] at he1 + simp only [WeightedGenerator.pairing_add s2 Y.vector Y.summable, + WeightedGenerator.pairing_scalar_inverse s2 Y.vector Y.summable, + WeightedGenerator.pairing_smul s2 Y.vector Y.summable,add_zero, + Complex.ofReal_div,Complex.ofReal_mul] at he2 + apply pairing_balance_algebra _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ he1 he2 + · exact_mod_cast R.ha1.ne' + · exact_mod_cast R.ha2.ne' +end + +open QuantumTrace Annihilation BeamLadder +variable {n : ℕ} (R : Regularization n) + +theorem canonical_output_generator (ρ σ : State n) + (hmρ : FiniteMoment 6 ρ) (hmσ : FiniteMoment 6 σ) + (hmD : FiniteMoment 6 R.τD) (hmO : FiniteMoment 6 R.τ0) + (a b d r0 : ℝ) (hd : 0 ENNReal.ofReal (-Real.log (p j))) (inverseWeight 2 x)) ∧ + (∀ x, ENNReal.ofReal (inner ℂ x (D1 x)).re= + numberVectorMoment (inversePower rootNumberWeight rootNumberWeight_one_le 4 x)) ∧ + (∀ x, ENNReal.ofReal (inner ℂ x (D2 x)).re= + numberVectorMoment (inversePower rootNumberWeight rootNumberWeight_one_le 4 x)) ∧ + ∃ (h6ρ : FiniteMoment 6 ρ) (h6σ : FiniteMoment 6 σ) (h60 : FiniteMoment 6 (R.output ρ σ)), + (R.a1:ℂ)*WeightedGenerator.pairing s1 (WeightedColumns.canonical ρ h6ρ).vector G1.quarticLogarithm+ + (R.a2:ℂ)*WeightedGenerator.pairing s2 (WeightedColumns.canonical σ h6σ).vector G2.quarticLogarithm= + (R.c:ℂ)*WeightedGenerator.pairing r0 (WeightedColumns.canonical (R.output ρ σ) h60).vector B+ + (R.b1:ℂ)*WeightedGenerator.pairing s1 (WeightedColumns.canonical ρ h6ρ).vector D1+ + (R.b2:ℂ)*WeightedGenerator.pairing s2 (WeightedColumns.canonical σ h6σ).vector D2+ + (R.ζ:ℂ)*(WeightedGenerator.pairing s1 (WeightedColumns.canonical ρ h6ρ).vector + (1 : Fock n →L[ℂ] Fock n)+ + WeightedGenerator.pairing s2 (WeightedColumns.canonical σ h6σ).vector + (1 : Fock n →L[ℂ] Fock n)) := by + have h6D : FiniteMoment 6 R.τD := by rw [hD]; exact thermalState_finiteMoment n 6 d hd + have h4D : FiniteMoment 4 R.τD := finiteMoment_mono (by norm_num) h6D + have h6O : FiniteMoment 6 R.τ0 := by rw [hτ]; exact thermalState_finiteMoment n 6 r0 hr0 + obtain ⟨J,b,p,hp,hs,he,G1,G2,B,D1,D2,hB,hD1,hD2,hBe,heD1,heD2,hbal,_,_⟩ := + R.minimum_physical_pairing_balance ρ σ hmρ hmσ h4D hr0 hτ hκ hmin + have h6ρ : FiniteMoment 6 ρ := finiteMoment_mono (by norm_num) G1.moment + have h6σ : FiniteMoment 6 σ := finiteMoment_mono (by norm_num) G2.moment + obtain ⟨h60,hcov⟩ := R.canonical_output_generator ρ σ h6ρ h6σ h6D h6O + s1 s2 d r0 hd hr0 heq + (by intro k l; rw [hD]; exact thermal_state_entries n d hd k l) + (by intro k l; rw [hτ]; exact thermal_state_entries n r0 hr0 k l) B + have hb := hbal s1 s2 (WeightedColumns.canonical ρ h6ρ) (WeightedColumns.canonical σ h6σ) + have hθ : 1-R.δ ∈ Set.Icc 0 1 := ⟨sub_nonneg.mpr R.hδ.2,sub_le_self _ R.hδ.1⟩ + change WeightedGenerator.pairing r0 (WeightedColumns.canonical (R.output ρ σ) h60).vector B= + ((1-R.κ:ℝ):ℂ)*(WeightedGenerator.pairing s1 (WeightedColumns.canonical ρ h6ρ).vector + ((WeightedColumns.canonical σ h6σ).slice R.η R.hη + ((WeightedColumns.canonical R.τD h6D).slice (1-R.δ) hθ B))+ + WeightedGenerator.pairing s2 (WeightedColumns.canonical σ h6σ).vector + ((WeightedColumns.canonical ρ h6ρ).sliceRight R.η R.hη + ((WeightedColumns.canonical R.τD h6D).slice (1-R.δ) hθ B))) at hcov + rw [WeightedColumns.canonical_slice R.τD h6D h4D, + WeightedColumns.canonical_slice σ h6σ hmσ, + WeightedColumns.canonical_sliceRight ρ h6ρ hmρ] at hcov + rw [mul_assoc (R.c:ℂ),← hcov] at hb + exact ⟨J,b,p,hp,hs,he,G1,G2,B,D1,D2,hB,hD1,hD2,hBe,heD1,heD2,h6ρ,h6σ,h60,hb⟩ +end Regularization +end EntropyPhotonNumber + +end + +end OAI diff --git a/lean/OAI/InformationTheory/PhotonNumber/SpectralForms.lean b/lean/OAI/InformationTheory/PhotonNumber/SpectralForms.lean new file mode 100644 index 0000000000000000000000000000000000000000..f355562bacec29471234afd8666e6940d86d2851 --- /dev/null +++ b/lean/OAI/InformationTheory/PhotonNumber/SpectralForms.lean @@ -0,0 +1,1014 @@ +import OAI.InformationTheory.PhotonNumber.BeamForms +import OAI.InformationTheory.PhotonNumber.Generator +import OAI.InformationTheory.PhotonNumber.Interpolation + +namespace OAI + +noncomputable section + +section +open scoped BigOperators ComplexConjugate ENNReal Topology +open MeasureTheory +open scoped ComplexConjugate +open scoped BigOperators ComplexConjugate +open scoped BigOperators +open MvPolynomial +open scoped BigOperators ComplexConjugate Classical +open Submodule +open ContinuousLinearMap +open scoped ENNReal +open Set Filter Topology Complex MeasureTheory + +namespace BKM + +section +open scoped ComplexConjugate +variable {J K E : Type*} [NormedAddCommGroup E] [InnerProductSpace ℂ E] [CompleteSpace E] + +def reindexBasis (b : HilbertBasis J ℂ E) (e : K ≃ J) : HilbertBasis K ℂ E := + HilbertBasis.mk (b.orthonormal.comp e e.injective) (by + have hr : Set.range (b ∘ e) = Set.range b := by + ext x + constructor + · rintro ⟨i, rfl⟩; exact ⟨e i, rfl⟩ + · rintro ⟨j, rfl⟩; exact ⟨e.symm j, by simp⟩ + rw [hr] + exact b.dense_span.ge) +@[simp] theorem reindexBasis_apply (b : HilbertBasis J ℂ E) (e : K ≃ J) (i : K) : + reindexBasis b e i = b (e i) := by simp [reindexBasis] + +omit [CompleteSpace E] in + theorem basis_hasSum_normSq (b : HilbertBasis J ℂ E) (x : E) : + HasSum (fun j => Complex.normSq (inner ℂ (b j) x)) (‖x‖^2) := by + simpa only [Complex.normSq_eq_norm_sq] using TraceEnsemble.basis_hasSum_norm_sq b x + +def entry (b : HilbertBasis J ℂ E) (Z : E →L[ℂ] E) (i j : J) : ℂ := inner ℂ (b i) (Z (b j)) + + theorem entry_adjoint (b : HilbertBasis J ℂ E) (Z : E →L[ℂ] E) (i j : J) : + entry b Z.adjoint i j = conj (entry b Z j i) := by + rw [entry, ContinuousLinearMap.adjoint_inner_right, entry, inner_conj_symm] + +omit [CompleteSpace E] in + theorem hasSum_column (b : HilbertBasis J ℂ E) (Z : E →L[ℂ] E) (j : J) : + HasSum (fun i => Complex.normSq (entry b Z i j)) (‖Z (b j)‖^2) := basis_hasSum_normSq b _ + + theorem hasSum_row (b : HilbertBasis J ℂ E) (Z : E →L[ℂ] E) (i : J) : + HasSum (fun j => Complex.normSq (entry b Z i j)) (‖Z.adjoint (b i)‖^2) := by + have h := hasSum_column b Z.adjoint i + simpa only [entry_adjoint, Complex.normSq_conj] using h + +omit [CompleteSpace E] in + theorem weighted_column_summable (b : HilbertBasis J ℂ E) (p : J → ℝ) + (hp : ∀ j, 0 ≤ p j) (hs : Summable p) (Z : E →L[ℂ] E) : + Summable (fun ij : J × J => p ij.2*Complex.normSq (entry b Z ij.1 ij.2)) := by + have hb (j : J) : ‖Z (b j)‖^2 ≤ ‖Z‖^2 := by + have h := Z.le_opNorm (b j) + rw [b.orthonormal.norm_eq_one j, mul_one] at h + exact pow_le_pow_left₀ (norm_nonneg _) h 2 + have ht : Summable (fun j => p j*‖Z (b j)‖^2) := + (hs.mul_right (‖Z‖^2)).of_nonneg_of_le (fun j => mul_nonneg (hp j) (sq_nonneg _)) + (fun j => mul_le_mul_of_nonneg_left (hb j) (hp j)) + have hh : Summable (fun ji : J × J => p ji.1*Complex.normSq (entry b Z ji.2 ji.1)) := by + rw [summable_prod_of_nonneg (fun ji => mul_nonneg (hp _) (Complex.normSq_nonneg _))] + exact ⟨fun j => ((hasSum_column b Z j).mul_left (p j)).summable, + by simpa only [tsum_mul_left, (hasSum_column b Z _).tsum_eq] using ht⟩ + exact (Equiv.prodComm J J).summable_iff.mpr hh + + theorem weighted_row_summable (b : HilbertBasis J ℂ E) (p : J → ℝ) + (hp : ∀ j, 0 ≤ p j) (hs : Summable p) (Z : E →L[ℂ] E) : + Summable (fun ij : J × J => p ij.1*Complex.normSq (entry b Z ij.1 ij.2)) := by + have hh := (Equiv.prodComm J J).summable_iff.mpr (weighted_column_summable b p hp hs Z.adjoint) + simpa only [Function.comp_def, Equiv.prodComm_apply, Prod.swap, entry_adjoint, Complex.normSq_conj] using hh + + theorem logMean_summable (b : HilbertBasis J ℂ E) (p : J → ℝ) + (hp : ∀ j, 0 < p j) (hs : Summable p) (Z : E →L[ℂ] E) : + Summable (fun ij : J × J => DiagonalForms.System.logMean (p ij.1) (p ij.2)* + Complex.normSq (entry b Z ij.1 ij.2)) := by + have hh := ((weighted_row_summable b p (fun j => (hp j).le) hs Z).add + (weighted_column_summable b p (fun j => (hp j).le) hs Z)).div_const 2 + apply hh.of_nonneg_of_le + · intro ij + exact mul_nonneg (DiagonalForms.System.logMean_pos (hp _) (hp _)).le (Complex.normSq_nonneg _) + · intro ij + convert! mul_le_mul_of_nonneg_right (DiagonalForms.System.logMean_le_arithmetic (hp ij.1) (hp ij.2)) + (Complex.normSq_nonneg (entry b Z ij.1 ij.2)) using 1 + ring + +end + +open scoped BigOperators +variable {J : Type*} + + theorem tendsto_square_finset : Tendsto (fun s : Finset J => s ×ˢ s) atTop atTop := by + classical + apply tendsto_atTop.2 + intro t + filter_upwards [eventually_ge_atTop (t.image Prod.fst ∪ t.image Prod.snd)] with s hs + intro ij hij + exact Finset.mem_product.mpr ⟨hs (Finset.mem_union_left _ (Finset.mem_image.mpr ⟨ij,hij,rfl⟩)), + hs (Finset.mem_union_right _ (Finset.mem_image.mpr ⟨ij,hij,rfl⟩))⟩ + + theorem hasSum_square_finset {v : J × J → ℝ} {a : ℝ} (h : HasSum v a) : + Tendsto (fun s : Finset J => ∑ i ∈ s, ∑ j ∈ s, v (i,j)) atTop (𝓝 a) := by + classical + simpa only [Function.comp_def, Finset.sum_product] using h.comp tendsto_square_finset + + theorem finite_hessian_to_variance (v : J × J → ℝ) (m : J → ℝ) (μ A α γ W : ℝ) + (hv : HasSum v A) (hm : HasSum m μ) (hα : 0 < α) + (h : ∀ (s : Finset J) (t : ℝ), + 2*γ*t*((∑ i ∈ s, ∑ j ∈ s, v (i,j))-μ*(∑ i ∈ s, m i)) ≤ + α*t^2*((∑ i ∈ s, ∑ j ∈ s, v (i,j))-(∑ i ∈ s, m i)^2)+W) : + γ^2*(A-μ^2) ≤ α*W := by + have hQ := hasSum_square_finset hv + have hlo : Tendsto (fun s : Finset J => + 2*γ*(γ/α)*((∑ i ∈ s, ∑ j ∈ s, v (i,j))-μ*(∑ i ∈ s, m i))) atTop + (𝓝 (2*γ*(γ/α)*(A-μ*μ))) := (hQ.sub (hm.const_mul μ)).const_mul _ + have hup : Tendsto (fun s : Finset J => + α*(γ/α)^2*((∑ i ∈ s, ∑ j ∈ s, v (i,j))-(∑ i ∈ s, m i)^2)+W) atTop + (𝓝 (α*(γ/α)^2*(A-μ^2)+W)) := ((hQ.sub (hm.pow 2)).const_mul _).add_const _ + have hh := le_of_tendsto_of_tendsto hlo hup (Filter.Eventually.of_forall fun s => h s (γ/α)) + have hh' := mul_le_mul_of_nonneg_left hh hα.le + have hne := hα.ne' + field_simp at hh' + nlinarith + +end BKM + +namespace SpectralTests +open scoped BigOperators ComplexConjugate +variable {A I P : Type*} + +def space (g : A → I → ℂ) : Submodule ℂ (I → ℂ) := Submodule.span ℂ (Set.range g) + +theorem frequency_finite (g : A → I → ℂ) (v : I → P) (q : A → P) + (hg : ∀ a i, g a i ≠ 0 → v i = q a) (z : I → ℂ) (hz : z ∈ space g) : + ∃ s : Finset P, ∀ i, z i ≠ 0 → v i ∈ s := by + classical + induction hz using Submodule.span_induction with + | mem x hx => + obtain ⟨a, rfl⟩ := hx + exact ⟨{q a}, fun i hi => by simpa only [Finset.mem_singleton] using hg a i hi⟩ + | zero => exact ⟨∅, fun i hi => (hi rfl).elim⟩ + | add x y _ _ hx hy => + obtain ⟨s, hs⟩ := hx + obtain ⟨t, ht⟩ := hy + refine ⟨s ∪ t, fun i hi => ?_⟩ + by_cases hxi : x i = 0 + · have hyi : y i ≠ 0 := by simpa only [Pi.add_apply, hxi, zero_add] using hi + exact Finset.mem_union.mpr (Or.inr (ht i hyi)) + · exact Finset.mem_union.mpr (Or.inl (hs i hxi)) + | smul c x _ hx => + obtain ⟨s, hs⟩ := hx + refine ⟨s, fun i hi => hs i ?_⟩ + intro hxi + apply hi + simp [hxi] + +def multiplier (v : I → P) (w : P → ℂ) : (I → ℂ) →ₗ[ℂ] (I → ℂ) where + toFun z i := w (v i)*z i + map_add' x y := by ext i; simp only [Pi.add_apply, mul_add] + map_smul' c x := by ext i; simp only [Pi.smul_apply, smul_eq_mul, RingHom.id_apply]; ring + +theorem multiplier_generator (g : A → I → ℂ) (v : I → P) (q : A → P) + (hg : ∀ a i, g a i ≠ 0 → v i = q a) (w : P → ℂ) (a : A) : + multiplier v w (g a) = w (q a) • g a := by + ext i + change w (v i)*g a i=w (q a)*g a i + by_cases hi : g a i = 0 + · simp [hi] + · rw [hg a i hi] + +theorem multiplier_mem (g : A → I → ℂ) (v : I → P) (q : A → P) + (hg : ∀ a i, g a i ≠ 0 → v i = q a) (z : I → ℂ) (hz : z ∈ space g) (w : P → ℂ) : + multiplier v w z ∈ space g := by + induction hz using Submodule.span_induction with + | mem x hx => + obtain ⟨a, rfl⟩ := hx + rw [multiplier_generator g v q hg] + exact (space g).smul_mem _ (Submodule.subset_span ⟨a,rfl⟩) + | zero => simpa only [map_zero] using (space g).zero_mem + | add x y _ _ hx hy => simpa only [map_add] using (space g).add_mem hx hy + | smul c x _ hx => simpa only [map_smul] using (space g).smul_mem c hx + +theorem square_summable_iff (z : I → ℂ) : + Summable (fun i => Complex.normSq (z i)) ↔ Memℓp z 2 := by + rw [memℓp_gen_iff (by norm_num : 0 < (2:ENNReal).toReal)] + simp only [Complex.normSq_eq_norm_sq, ENNReal.toReal_ofNat, Real.rpow_two] + +theorem mass_summable (g : A → I → ℂ) (hg : ∀ a, Summable (fun i => Complex.normSq (g a i))) + (z : I → ℂ) (hz : z ∈ space g) : Summable (fun i => Complex.normSq (z i)) := by + rw [square_summable_iff] + induction hz using Submodule.span_induction with + | mem x hx => obtain ⟨a,rfl⟩ := hx; exact (square_summable_iff _).mp (hg a) + | zero => exact (show Memℓp (0 : I → ℂ) 2 from zero_memℓp) + | add x y _ _ hx hy => exact hx.add hy + | smul c x _ hx => exact hx.const_smul c + +end SpectralTests + +namespace CenteredTests +open scoped BigOperators ComplexConjugate +variable {J E : Type*} [NormedAddCommGroup E] [InnerProductSpace ℂ E] + +def entryMap (b : HilbertBasis J ℂ E) (w : J × J → ℝ) : + (E →L[ℂ] E) →ₗ[ℂ] (J × J → ℂ) where + toFun Z ij := (Real.sqrt (w ij) : ℂ)*BKM.entry b Z ij.1 ij.2 + map_add' X Y := by ext ij; simp [BKM.entry, mul_add] + map_smul' c X := by ext ij; simp [BKM.entry, mul_left_comm] + +@[simp] theorem entryMap_apply (b : HilbertBasis J ℂ E) (w : J × J → ℝ) + (Z : E →L[ℂ] E) (ij : J × J) : + entryMap b w Z ij = (Real.sqrt (w ij) : ℂ)*BKM.entry b Z ij.1 ij.2 := rfl + +theorem entryMap_injective (b : HilbertBasis J ℂ E) (w : J × J → ℝ) (hw : ∀ ij, 0 < w ij) : + Function.Injective (entryMap b w) := by + intro X Y h + have hb (j : J) : X (b j)=Y (b j) := by + apply b.repr.injective + ext i + simp only [b.repr_apply_apply] + have hh := congrFun h (i,j) + exact mul_left_cancel₀ (Complex.ofReal_ne_zero.mpr (Real.sqrt_ne_zero'.mpr (hw (i,j)))) hh + ext x + have hX := (b.hasSum_repr x).mapL X + have hY := (b.hasSum_repr x).mapL Y + apply hX.unique + convert! hY using 1 + ext j + simp only [map_smul, hb] + +def generator (b : HilbertBasis J ℂ E) (p : J → ℝ) (ij : J × J) : E →L[ℂ] E := by + classical + exact InnerProductSpace.rankOne ℂ (b ij.1) (b ij.2) - + (if ij.1=ij.2 then (p ij.1:ℂ) else 0) • ContinuousLinearMap.id ℂ E + +theorem generator_entry [DecidableEq J] (b : HilbertBasis J ℂ E) (p : J → ℝ) (ij kl : J × J) : + BKM.entry b (generator b p ij) kl.1 kl.2 = + (if kl.1=ij.1 ∧ kl.2=ij.2 then (1:ℂ) else 0)- + (if ij.1=ij.2 then (p ij.1:ℂ) else 0)*(if kl.1=kl.2 then 1 else 0) := by + classical + simp only [generator, BKM.entry, sub_apply, + smul_apply, ContinuousLinearMap.id_apply, InnerProductSpace.rankOne_apply, + inner_sub_right, inner_smul_right, orthonormal_iff_ite.mp b.orthonormal] + split_ifs <;> simp_all + +theorem generator_frequency (b : HilbertBasis J ℂ E) (p : J → ℝ) (w : J × J → ℝ) + {P : Type*} (v : J × J → P) (q : P) (hv : ∀ j, v (j,j)=q) + (ij kl : J × J) (hz : entryMap b w (generator b p ij) kl ≠ 0) : v kl=v ij := by + classical + have hg : BKM.entry b (generator b p ij) kl.1 kl.2 ≠ 0 := by + intro hh; apply hz; simp [hh] + rw [generator_entry] at hg + by_cases hij : ij.1=ij.2 + · have hkl : kl.1=kl.2 := by + by_contra hk + have hp : ¬ (kl.1=ij.1 ∧ kl.2=ij.2) := fun hf => hk (hf.1.trans (hij.trans hf.2.symm)) + simp [hp,hk] at hg + calc v kl=v (kl.2,kl.2) := by congr 1; exact Prod.ext hkl rfl + _=q := hv _ + _=v (ij.2,ij.2) := (hv _).symm + _=v ij := by congr 1; exact Prod.ext hij.symm rfl + · have hkl : kl.1=ij.1 ∧ kl.2=ij.2 := by + by_contra hk + simp [hij,hk] at hg + exact congrArg v (Prod.ext hkl.1 hkl.2) + +def operatorSpace (b : HilbertBasis J ℂ E) (p : J → ℝ) : Submodule ℂ (E →L[ℂ] E) := + Submodule.span ℂ (Set.range (generator b p)) + +def coordinates (b : HilbertBasis J ℂ E) (p : J → ℝ) (w : J × J → ℝ) : + Submodule ℂ (J × J → ℂ) := (operatorSpace b p).map (entryMap b w) + +theorem coordinates_eq_span (b : HilbertBasis J ℂ E) (p : J → ℝ) (w : J × J → ℝ) : + coordinates b p w = SpectralTests.space (fun ij => entryMap b w (generator b p ij)) := by + rw [coordinates, operatorSpace, Submodule.map_span, ← Set.range_comp] + rfl + +variable [CompleteSpace E] + +theorem coordinates_mass (b : HilbertBasis J ℂ E) (p : J → ℝ) (hp : ∀ j, 0 < p j) + (hs : Summable p) (h : ℝ) (hh : 0 ≤ h) (z : coordinates b p (fun ij => h*DiagonalForms.System.logMean (p ij.1) (p ij.2))) : + Summable (fun ij => Complex.normSq (z.val ij)) := by + obtain ⟨Z, _hZ, he⟩ := z.property + rw [← he] + have hsum := (BKM.logMean_summable b p hp hs Z).mul_left h + convert! hsum using 1 + ext ij + simp only [entryMap_apply, Complex.normSq_mul, Complex.normSq_ofReal] + rw [Real.mul_self_sqrt (mul_nonneg hh (DiagonalForms.System.logMean_pos (hp _) (hp _)).le)] + ring + +end CenteredTests + +namespace ThermalMetric + +section +open scoped ComplexConjugate +variable {J E : Type*} [NormedAddCommGroup E] [InnerProductSpace ℂ E] [CompleteSpace E] + +theorem observable_summable (b : HilbertBasis J ℂ E) (p : J → ℝ) + (hp : ∀ j, 0 < p j) (hs : Summable p) (t : ℝ) (ht : 0 < t) (Z : E →L[ℂ] E) : + Summable (fun a : J × J => metricCoefficient t (p a.1) (p a.2) * + ‖BKM.entry b Z a.1 a.2‖^2) := by + have hc := BKM.weighted_column_summable b p (fun j => (hp j).le) hs Z + have hr := BKM.weighted_row_summable b p (fun j => (hp j).le) hs Z + simp only [Complex.normSq_eq_norm_sq] at hc hr + apply Summable.of_nonneg_of_le + (fun a => mul_nonneg (metricCoefficient_pos ht (hp _) (hp _)).le (sq_nonneg _)) _ + (((hr.mul_left t).add (hc.mul_left (t+1))).mul_left (h t/2)) + intro a + have hh := DiagonalForms.System.logMean_le_arithmetic (mul_pos ht (hp a.1)) + (mul_pos (by positivity : 0 ℂ) 2 where + toFun Z := weightedVector (fun a => metricCoefficient t (p a.1) (p a.2)) + (fun a => BKM.entry b Z a.1 a.2) (observable_summable b p hp hs t ht Z) + (fun a => (metricCoefficient_pos ht (hp _) (hp _)).le) + map_add' Z U := by ext a; simp [BKM.entry, mul_add] + map_smul' c Z := by ext a; simp [BKM.entry, mul_left_comm] + +@[simp] theorem observableMap_apply (b : HilbertBasis J ℂ E) (p : J → ℝ) + (hp : ∀ j, 0 < p j) (hs : Summable p) (t : ℝ) (ht : 0 < t) + (Z : E →L[ℂ] E) (a : J × J) : + observableMap b p hp hs t ht Z a = + (Real.sqrt (metricCoefficient t (p a.1) (p a.2)) : ℂ) * BKM.entry b Z a.1 a.2 := rfl + +@[simp] theorem observableMap_id (b : HilbertBasis J ℂ E) (p : J → ℝ) + (hp : ∀ j, 0 < p j) (hs : Summable p) (t : ℝ) (ht : 0 < t) : + observableMap b p hp hs t ht (ContinuousLinearMap.id ℂ E) = identityVector t ht p hp hs := by + classical + ext a + simp [BKM.entry, identityVector, identityEntry, + orthonormal_iff_ite.mp b.orthonormal] + +end + +section +open scoped ComplexConjugate +variable {J : Type*} + +def centerProjection (e : lp (fun _ : J => ℂ) 2) : + lp (fun _ : J => ℂ) 2 →L[ℂ] lp (fun _ : J => ℂ) 2 := + ContinuousLinearMap.id ℂ _ - (innerSL ℂ e).smulRight e + +@[simp] theorem centerProjection_apply (e x : lp (fun _ : J => ℂ) 2) : + centerProjection e x=x-inner ℂ e x • e := rfl + +theorem centerProjection_mem (e x : lp (fun _ : J => ℂ) 2) + (he : inner ℂ e e=1) : centerProjection e x ∈ (innerSL ℂ e).ker := by + change inner ℂ e (x-inner ℂ e x • e)=0 + simp only [inner_sub_right, inner_smul_right, he, mul_one, sub_self] + +theorem centerProjection_eq (e x : lp (fun _ : J => ℂ) 2) + (hx : x ∈ (innerSL ℂ e).ker) : centerProjection e x=x := by + change inner ℂ e x=0 at hx + simp only [centerProjection_apply, hx, zero_smul, sub_zero] + +variable [DecidableEq J] + +theorem centered_single_dense (e : lp (fun _ : J => ℂ) 2) + (he : inner ℂ e e=1) : + (Submodule.span ℂ (Set.range (fun j => centerProjection e (lp.single 2 j (1:ℂ))))).topologicalClosure = + (innerSL ℂ e).ker := by + classical + let S := Submodule.span ℂ (Set.range (fun j => centerProjection e (lp.single 2 j (1:ℂ)))) + apply le_antisymm + · apply S.topologicalClosure_minimal + · apply Submodule.span_le.mpr + rintro _ ⟨j,rfl⟩ + exact centerProjection_mem _ _ he + · exact (innerSL ℂ e).isClosed_ker + · intro x hx + have hh := (lp.hasSum_single (by norm_num : (2:ENNReal)≠⊤) x).mapL (centerProjection e) + rw [centerProjection_eq _ _ hx] at hh + apply S.isClosed_topologicalClosure.mem_of_tendsto hh + apply Filter.Eventually.of_forall + intro s + apply S.topologicalClosure.sum_mem + intro j _ + have hs : centerProjection e (lp.single 2 j (x j)) ∈ S := by + have hsingle : lp.single (E := fun _ : J => ℂ) 2 j (x j)=(x j) • lp.single 2 j (1:ℂ) := by + rw [← lp.single_smul] + simp only [smul_eq_mul, mul_one] + rw [hsingle, map_smul] + exact S.smul_mem _ (Submodule.subset_span ⟨j,rfl⟩) + exact S.le_topologicalClosure hs + +@[simp] theorem identityVector_apply (r : ℝ) (hr : 0 ℂ) 2 := by + classical + exact (Real.sqrt (metricCoefficient r (p ij.1) (p ij.2)):ℂ) • lp.single 2 ij 1 - + (if ij.1=ij.2 then (p ij.1:ℂ) else 0) • identityVector r hr p hp hs + +theorem matrixGenerator_projection (r : ℝ) (hr : 0 centerProjection e (lp.single 2 j (1:ℂ)))) := by + apply le_antisymm + · apply Submodule.span_le.mpr + rintro _ ⟨ij,rfl⟩ + rw [matrixGenerator_projection] + exact Submodule.smul_mem _ _ (Submodule.subset_span ⟨ij,rfl⟩) + · apply Submodule.span_le.mpr + rintro _ ⟨ij,rfl⟩ + have hz : (Real.sqrt (metricCoefficient r (p ij.1) (p ij.2)):ℂ)≠0 := + Complex.ofReal_ne_zero.mpr (Real.sqrt_ne_zero'.mpr (metricCoefficient_pos hr (hp _) (hp _))) + have ht : centerProjection e (lp.single 2 ij 1)= + (Real.sqrt (metricCoefficient r (p ij.1) (p ij.2)):ℂ)⁻¹ • matrixGenerator r hr p hp hs.summable ij := by + rw [matrixGenerator_projection, smul_smul, inv_mul_cancel₀ hz, one_smul] + dsimp only + rw [ht] + exact Submodule.smul_mem _ _ (Submodule.subset_span ⟨ij,rfl⟩) + rw [he] + exact hh +end + +open scoped ComplexConjugate +variable {J E : Type*} [NormedAddCommGroup E] [InnerProductSpace ℂ E] [CompleteSpace E] + +@[simp] theorem observableMap_generator [DecidableEq J] (b : HilbertBasis J ℂ E) (p : J → ℝ) + (hp : ∀ j, 0 < p j) (hs : Summable p) (t : ℝ) (ht : 0 < t) (ij : J × J) : + observableMap b p hp hs t ht (CenteredTests.generator b p ij) = + matrixGenerator t ht p hp hs ij := by + classical + ext kl + simp only [observableMap_apply, CenteredTests.generator_entry, matrixGenerator, + lp.coeFn_sub, Pi.sub_apply, lp.coeFn_smul, Pi.smul_apply, smul_eq_mul, + lp.single_apply, Pi.single_apply, identityVector_apply] + by_cases he : kl=ij + · subst kl + by_cases hd : ij.1=ij.2 + · simp only [hd, metricCoefficient_self ht (hp _), ite_true, and_self, + mul_one] + ring + · simp [hd] + · have he' : ¬ (kl.1=ij.1 ∧ kl.2=ij.2) := fun hh => he (Prod.ext hh.1 hh.2) + simp only [ite_eq_right he, ite_eq_right he', mul_zero, zero_sub] + by_cases hd : kl.1=kl.2 + · simp only [hd, metricCoefficient_self ht (hp _), ite_true] + ring + · simp [hd] + +theorem observable_core_dense (b : HilbertBasis J ℂ E) (p : J → ℝ) + (hp : ∀ j, 0 < p j) (hs : HasSum p 1) (t : ℝ) (ht : 0 < t) : + ((CenteredTests.operatorSpace b p).map + (observableMap b p hp hs.summable t ht)).topologicalClosure = + centeredSpace t ht p hp hs.summable := by + classical + rw [CenteredTests.operatorSpace, Submodule.map_span, ← Set.range_comp] + simpa only [Function.comp_def, observableMap_generator] using + matrixGenerator_dense t ht p hp hs + +theorem functional_bound_of_core (b : HilbertBasis J ℂ E) (p : J → ℝ) + (hp : ∀ j, 0 < p j) (hs : HasSum p 1) (t : ℝ) (ht : 0 < t) + (q : lp (fun _ : J × J => ℂ) 2 →L[ℂ] ℂ) (C : ℝ) + (hc : ∀ Z, Z ∈ CenteredTests.operatorSpace b p → + ‖q (observableMap b p hp hs.summable t ht Z)‖ ≤ + C*‖observableMap b p hp hs.summable t ht Z‖) : + ∀ x ∈ centeredSpace t ht p hp hs.summable, ‖q x‖ ≤ C*‖x‖ := by + have hclosed : IsClosed {x : lp (fun _ : J × J => ℂ) 2 | ‖q x‖ ≤ C*‖x‖} := + isClosed_le q.continuous.norm (continuous_const.mul continuous_norm) + have himage : (((CenteredTests.operatorSpace b p).map + (observableMap b p hp hs.summable t ht) : Submodule ℂ _) : Set _) ⊆ + {x | ‖q x‖ ≤ C*‖x‖} := by + rintro _ ⟨Z,hZ,rfl⟩ + exact hc Z hZ + have hh := closure_minimal himage hclosed + rw [← Submodule.topologicalClosure_coe, observable_core_dense b p hp hs t ht] at hh + exact hh + +theorem restricted_norm_bound_of_core (b : HilbertBasis J ℂ E) (p : J → ℝ) + (hp : ∀ j, 0 < p j) (hs : HasSum p 1) (t : ℝ) (ht : 0 < t) + (q : lp (fun _ : J × J => ℂ) 2 →L[ℂ] ℂ) (C : ℝ) (hC : 0 ≤ C) + (hc : ∀ Z, Z ∈ CenteredTests.operatorSpace b p → + ‖q (observableMap b p hp hs.summable t ht Z)‖ ≤ + C*‖observableMap b p hp hs.summable t ht Z‖) : + ‖q.comp (centeredSpace t ht p hp hs.summable).subtypeL‖ ≤ C := by + apply ContinuousLinearMap.opNorm_le_bound _ hC + intro x + exact functional_bound_of_core b p hp hs t ht q C hc x.val x.property + +end ThermalMetric + +end + +open scoped BigOperators ComplexConjugate ENNReal Topology +open MeasureTheory +open scoped ComplexConjugate +open scoped BigOperators ComplexConjugate +open scoped BigOperators +open MvPolynomial +open scoped BigOperators ComplexConjugate Classical +open Submodule +open ContinuousLinearMap +open scoped ENNReal +open Set Filter Topology Complex MeasureTheory +open Set Filter Topology Complex Metric +open MeasureTheory Set Filter Topology Complex Metric InnerProductSpace +open scoped ENNReal NNReal +open Filter Topology + +namespace CenteredTests +open scoped BigOperators +variable {J T E P : Type*} [NormedAddCommGroup E] [InnerProductSpace ℂ E] [CompleteSpace E] + +def includeRange (b : HilbertBasis J ℂ E) (p : J → ℝ) (w : J × J → ℝ) : + coordinates b p w →ₗ[ℂ] LinearMap.range (entryMap b w) where + toFun z := ⟨z.val, by obtain ⟨Z, _hZ, he⟩ := z.property; exact ⟨Z,he⟩⟩ + map_add' _ _ := rfl + map_smul' _ _ := rfl + +def realize (b : HilbertBasis J ℂ E) (p : J → ℝ) (w : J × J → ℝ) (hw : ∀ ij, 0 < w ij) : + coordinates b p w →ₗ[ℂ] (E →L[ℂ] E) := + (LinearEquiv.ofInjective (entryMap b w) (entryMap_injective b w hw)).symm.toLinearMap.comp + (includeRange b p w) + +omit [CompleteSpace E] in +theorem realize_entries (b : HilbertBasis J ℂ E) (p : J → ℝ) (w : J × J → ℝ) + (hw : ∀ ij, 0 < w ij) (z : coordinates b p w) : entryMap b w (realize b p w hw z)=z.val := by + exact LinearEquiv.ofInjective_symm_apply (h := entryMap_injective b w hw) _ _ + +omit [CompleteSpace E] in +theorem realize_mem (b : HilbertBasis J ℂ E) (p : J → ℝ) (w : J × J → ℝ) + (hw : ∀ ij, 0 < w ij) (z : coordinates b p w) : realize b p w hw z ∈ operatorSpace b p := by + obtain ⟨Z,hZ,he⟩ := z.property + have hh : realize b p w hw z=Z := entryMap_injective b w hw ((realize_entries b p w hw z).trans he.symm) + rw [hh] + exact hZ + +def system (b : HilbertBasis J ℂ E) (p : J → ℝ) (hp : ∀ j, 0 < p j) (hs : Summable p) + (h : ℝ) (hh : 0 < h) (v : J × J → P) (q : P) (hv : ∀ j, v (j,j)=q) + (targetParam : T → P) (L : (E →L[ℂ] E) →ₗ[ℂ] (T → ℂ)) : DiagonalForms.System P (J × J) T where + sourceParam := v + targetParam := targetParam + tests := coordinates b p (fun ij => h*DiagonalForms.System.logMean (p ij.1) (p ij.2)) + map := L.comp (realize b p _ (fun ij => mul_pos hh (DiagonalForms.System.logMean_pos (hp _) (hp _)))) + mass_summable z := coordinates_mass b p hp hs h hh.le z + finite_values z := by + apply SpectralTests.frequency_finite (fun ij => entryMap b _ (generator b p ij)) v v + (generator_frequency b p _ v q hv) z.val + rw [← coordinates_eq_span] + exact z.property + multiplier_mem z w := by + apply (SetLike.ext_iff.mp (coordinates_eq_span b p _) _).mpr + exact SpectralTests.multiplier_mem (fun ij => entryMap b _ (generator b p ij)) v v + (generator_frequency b p _ v q hv) z.val (by rw [← coordinates_eq_span]; exact z.property) w + +end CenteredTests + +namespace ThermalMetric +open EntropyPhotonNumber DiagonalForms.System + +theorem reference_plus {r : ℝ} (hr : 0 plus (S.param ij)*Complex.normSq (S.coords Z ij)) := by + simpa only [S.plus_entry Z] using BKM.weighted_row_summable S.basis S.p (fun i => (S.pos i).le) S.sum.summable Z + +theorem minus_summable (Z : E →L[ℂ] E) : Summable (fun ij => minus (S.param ij)*Complex.normSq (S.coords Z ij)) := by + simpa only [S.minus_entry Z] using BKM.weighted_column_summable S.basis S.p (fun i => (S.pos i).le) S.sum.summable Z + +theorem constant_summable (c : ℝ) (Z : E →L[ℂ] E) : + Summable (fun ij => c*Complex.normSq (S.coords Z ij)) := by + have hh := ((BKM.logMean_summable S.basis S.p S.pos S.sum.summable Z).mul_left (h S.r)).mul_left c + simpa only [S.coords_norm, base, mul_assoc] using hh +end Space + +abbrev Param := {r : ℝ // 0 < r} × ℝ +def raw (q : Param) : ℝ × ℝ := (q.1.val,q.2) +def Space.pparam (S : Space E) (ij : S.I × S.I) : Param := (⟨S.r,S.rpos⟩,(S.param ij).2) +def Space.pquad (S : Space E) (X : Param → ℝ) (Z : E →L[ℂ] E) : ℝ := + ∑' ij, X (S.pparam ij)*Complex.normSq (S.coords Z ij) + +def targetMap (S : Fin 2 → Space E) (w : Fin 2 → ℝ) + (L : (i : Fin 2) → (E →L[ℂ] E) →ₗ[ℂ] (E →L[ℂ] E)) : + (E →L[ℂ] E) →ₗ[ℂ] ((Σ i, (S i).I × (S i).I) → ℂ) where + toFun Z a := (Real.sqrt (w a.1):ℂ)*(S a.1).coords (L a.1 Z) a.2 + map_add' X Y := by ext a; simp [mul_add] + map_smul' c X := by ext a; simp [mul_left_comm] + +def diagram (S₀ : Space E) (S : Fin 2 → Space E) (w : Fin 2 → ℝ) + (L : (i : Fin 2) → (E →L[ℂ] E) →ₗ[ℂ] (E →L[ℂ] E)) : + DiagonalForms.System Param (S₀.I × S₀.I) (Σ i, (S i).I × (S i).I) := + CenteredTests.system S₀.basis S₀.p S₀.pos S₀.sum.summable (h S₀.r) (h_pos S₀.rpos) + S₀.pparam (⟨S₀.r,S₀.rpos⟩,0) + (fun j => by simp [Space.pparam, Space.param, frequency]) + (fun a => (S a.1).pparam a.2) (targetMap S w L) + +theorem targetMap_norm (S : Fin 2 → Space E) (w : Fin 2 → ℝ) (hw : ∀ i, 0 ≤ w i) + (L : (i : Fin 2) → (E →L[ℂ] E) →ₗ[ℂ] (E →L[ℂ] E)) + (Z : E →L[ℂ] E) (a : Σ i, (S i).I × (S i).I) : + Complex.normSq (targetMap S w L Z a)=w a.1*Complex.normSq ((S a.1).coords (L a.1 Z) a.2) := by + simp only [targetMap, LinearMap.coe_mk, AddHom.coe_mk, Complex.normSq_mul, Complex.normSq_ofReal] + rw [Real.mul_self_sqrt (hw _)] + +theorem diagram_comparison (S₀ : Space E) (S : Fin 2 → Space E) (w : Fin 2 → ℝ) + (hw : ∀ i, 0 ≤ w i) + (L : (i : Fin 2) → (E →L[ℂ] E) →ₗ[ℂ] (E →L[ℂ] E)) (X : Param → ℝ) + (hX : ∀ q, 0 ≤ X q) + (hs : ∀ i Z, Summable (fun a => X ((S i).pparam a)*Complex.normSq ((S i).coords Z a))) + (he : ∀ Z, Z ∈ CenteredTests.operatorSpace S₀.basis S₀.p → + ∑ i, w i*(S i).pquad X (L i Z) ≤ S₀.pquad X Z) : + (diagram S₀ S w L).Comparison X := by + intro z s + let Z := CenteredTests.realize S₀.basis S₀.p S₀.base S₀.base_pos z + have hz : S₀.coords Z=z.val := CenteredTests.realize_entries S₀.basis S₀.p S₀.base S₀.base_pos z + have hm : Z ∈ CenteredTests.operatorSpace S₀.basis S₀.p := + CenteredTests.realize_mem S₀.basis S₀.p S₀.base S₀.base_pos z + have hn (a : Σ i, (S i).I × (S i).I) : 0 ≤ X ((S a.1).pparam a.2)* + (w a.1*Complex.normSq ((S a.1).coords (L a.1 Z) a.2)) := mul_nonneg (hX _) (mul_nonneg (hw _) (Complex.normSq_nonneg _)) + have hsum : Summable (fun a : Σ i, (S i).I × (S i).I => X ((S a.1).pparam a.2)* + (w a.1*Complex.normSq ((S a.1).coords (L a.1 Z) a.2))) := by + apply (summable_sigma_of_nonneg hn).mpr + refine ⟨fun i => ?_, (hasSum_fintype _).summable⟩ + simpa only [mul_left_comm] using (hs i (L i Z)).mul_left (w i) + have ht := Summable.sum_le_tsum s (fun a _ => hn a) hsum + have hv : (∑' a : Σ i, (S i).I × (S i).I, X ((S a.1).pparam a.2)* + (w a.1*Complex.normSq ((S a.1).coords (L a.1 Z) a.2))) = + ∑ i, w i*(S i).pquad X (L i Z) := by + rw [hsum.tsum_sigma] + simp only [tsum_fintype, Space.pquad, mul_left_comm (X _) (w _), tsum_mul_left] + rw [hv] at ht + have hh := ht.trans (he Z hm) + change (∑ a ∈ s, X ((S a.1).pparam a.2)*Complex.normSq (targetMap S w L Z a)) ≤ _ + simp only [targetMap_norm S w hw L] + convert! hh using 1 + simp only [sourceForm, Space.pquad, hz] + rfl + +def plusWeight (q : Param) : ℝ := Space.plus (raw q) +def minusWeight (q : Param) : ℝ := Space.minus (raw q) +def thermalWeight (q : Param) : ℝ := weight q.1.val q.2 + +theorem plusWeight_pos (q : Param) : 0 < plusWeight q := + mul_pos (mul_pos (one_div_pos.mpr (h_pos q.1.property)) (f_pos _)) (Real.exp_pos _) +theorem minusWeight_pos (q : Param) : 0 < minusWeight q := + mul_pos (mul_pos (one_div_pos.mpr (h_pos q.1.property)) (f_pos _)) (Real.exp_pos _) + +theorem diagram_thermal (S₀ : Space E) (S : Fin 2 → Space E) (w : Fin 2 → ℝ) + (L : (i : Fin 2) → (E →L[ℂ] E) →ₗ[ℂ] (E →L[ℂ] E)) + (hp : (diagram S₀ S w L).Comparison plusWeight) + (hm : (diagram S₀ S w L).Comparison minusWeight) + (hr : (diagram S₀ S w L).Comparison (fun q => q.1.val)) + (hs : (diagram S₀ S w L).Comparison (fun q => q.1.val+1)) : + (diagram S₀ S w L).Comparison thermalWeight := by + have h₁ : (fun q : Param => (1/h q.1.val)*f (-h q.1.val/2)*Real.exp (-h q.1.val/2)) = + (fun q => q.1.val) := funext (fun q => reference_plus q.1.property) + have h₂ : (fun q : Param => (1/h q.1.val)*f (-h q.1.val/2)*Real.exp (-(-h q.1.val/2))) = + (fun q => q.1.val+1) := funext (fun q => reference_minus q.1.property) + have hh := four_weight_interpolation (diagram S₀ S w L) + (fun q => 1/h q.1.val) (fun q => h q.1.val*q.2/2) (fun q => -h q.1.val/2) + (fun q => one_div_pos.mpr (h_pos q.1.property)) hp hm (by rwa [h₁]) (by rwa [h₂]) + exact hh +end ThermalSpectral + +namespace ThermalMetric +open EntropyPhotonNumber DiagonalForms.System + +theorem weight_bounds {r : ℝ} (hr : 0 ℂ) 2 := + observableMap S.basis S.p S.pos S.sum.summable S.r S.rpos + +theorem observable_norm_sq (Z : E →L[ℂ] E) : + ‖S.observable Z‖^2=S.pquad thermalWeight Z := by + rw [observable, observableMap, LinearMap.coe_mk, AddHom.coe_mk, weightedVector_norm_sq] + simp only [pquad, S.coords_norm, Complex.normSq_eq_norm_sq] + apply tsum_congr + intro a + simp only [thermalWeight, pparam, param, base, metricCoefficient] + ring + +theorem thermal_summable (Z : E →L[ℂ] E) : + Summable (fun ij => thermalWeight (S.pparam ij)*Complex.normSq (S.coords Z ij)) := by + have hn (ij : S.I × S.I) : 0 ≤ thermalWeight (S.pparam ij)*Complex.normSq (S.coords Z ij) := + mul_nonneg (weight_pos S.rpos _).le (Complex.normSq_nonneg _) + have hb (ij : S.I × S.I) : + thermalWeight (S.pparam ij)*Complex.normSq (S.coords Z ij) ≤ + (S.r+1)*Complex.normSq (S.coords Z ij) := by + have hh : thermalWeight (S.pparam ij) ≤ S.r+1 := + (weight_frequency_bounds S.rpos (S.pos ij.1) (S.pos ij.2)).2 + exact mul_le_mul_of_nonneg_right hh (Complex.normSq_nonneg _) + exact Summable.of_nonneg_of_le hn hb (S.constant_summable (S.r+1) Z) + +theorem BKM_thermal_bound (Z : E →L[ℂ] E) : + S.pquad (fun _ => 1/h S.r) Z ≤ mixtureConstant S.r^2*‖S.observable Z‖^2 := by + rw [S.observable_norm_sq] + simp only [pquad, ← tsum_mul_left] + apply Summable.tsum_le_tsum + · intro a + have hh := BKM_weight_bound S.rpos (S.param a).2 + exact (mul_le_mul_of_nonneg_right hh (Complex.normSq_nonneg _)).trans_eq (mul_assoc _ _ _) + · exact S.constant_summable (1/h S.r) Z + · exact (S.thermal_summable Z).mul_left _ + +theorem observable_mem_core (Z : E →L[ℂ] E) + (hZ : Z ∈ CenteredTests.operatorSpace S.basis S.p) : + S.observable Z ∈ centeredSpace S.r S.rpos S.p S.pos S.sum.summable := by + rw [← observable_core_dense S.basis S.p S.pos S.sum S.r S.rpos] + exact Submodule.le_topologicalClosure _ ⟨Z,hZ,rfl⟩ +end ThermalSpectral.Space + +namespace CrossEnsemble +open scoped ComplexConjugate +variable {I E : Type*} [NormedAddCommGroup E] [InnerProductSpace ℂ E] [CompleteSpace E] + +def pairingLM (u v : I → E) (hu : Summable (fun i => ‖u i‖^2)) + (hv : Summable (fun i => ‖v i‖^2)) : (E →L[ℂ] E) →ₗ[ℂ] ℂ where + toFun := pairing u v + map_add' Z T := by + simp only [pairing, add_apply, inner_add_right] + exact (pairing_summable hu hv Z).tsum_add (pairing_summable hu hv T) + map_smul' c Z := by + simp only [pairing, smul_apply, inner_smul_right, tsum_mul_left, smul_eq_mul, RingHom.id_apply] + +omit [CompleteSpace E] in +theorem pairing_sub_right (u v w : I → E) (hu : Summable (fun i => ‖u i‖^2)) + (hv : Summable (fun i => ‖v i‖^2)) (hw : Summable (fun i => ‖w i‖^2)) + (c : ℂ) (Z : E →L[ℂ] E) : + pairing u (fun i => v i-c • w i) Z=pairing u v Z-conj c*pairing u w Z := by + simp only [pairing, inner_sub_left, inner_smul_left] + rw [(pairing_summable hu hv Z).tsum_sub ((pairing_summable hu hw Z).mul_left (conj c)), tsum_mul_left] + +omit [CompleteSpace E] in +theorem pairing_sub_left (u v w : I → E) (hu : Summable (fun i => ‖u i‖^2)) + (hv : Summable (fun i => ‖v i‖^2)) (hw : Summable (fun i => ‖w i‖^2)) + (c : ℂ) (Z : E →L[ℂ] E) : + pairing (fun i => u i-c • v i) w Z=pairing u w Z-c*pairing v w Z := by + simp only [pairing, map_sub, map_smul, inner_sub_right, inner_smul_right] + rw [(pairing_summable hu hw Z).tsum_sub ((pairing_summable hv hw Z).mul_left c), tsum_mul_left] +end CrossEnsemble + +namespace WeightedGenerator +open EntropyPhotonNumber Annihilation BeamLadder ThermalMetric +open scoped ComplexConjugate +variable {n : ℕ} {J : Type*} + +theorem centeredLadder_lower (j : Fin n) (μ : ℂ) (x : Fock n) : + centeredLadder j μ false x=sandwich 0 3 (by omega) j x-μ • inverseWeight 3 x := by + have hw : inverseWeight 1 (inverseWeight 2 x)=inverseWeight 3 x := by + change (inverseWeight 1 ∘L inverseWeight 2) x=_ + rw [← inverseWeight_add] + simp only [centeredLadder, Bool.false_eq_true, ↓reduceIte, ContinuousLinearMap.comp_apply, + sub_apply, smul_apply, hw] + congr 1 + ext k + rw [lowering_weighted_apply, single_lower_third_apply] + +theorem centeredLadder_raise (j : Fin n) (μ : ℂ) (x : Fock n) : + centeredLadder j μ true x=creationSandwich 0 3 (by omega) j x-conj μ • inverseWeight 3 x := by + have hw : inverseWeight 1 (inverseWeight 2 x)=inverseWeight 3 x := by + change (inverseWeight 1 ∘L inverseWeight 2) x=_ + rw [← inverseWeight_add] + simp only [centeredLadder, ↓reduceIte, ContinuousLinearMap.comp_apply, sub_apply, smul_apply, hw] + congr 1 + ext k + rw [raising_weighted_apply, single_raise_third_apply] + by_cases hk : k j=0 + · simp only [hk, Nat.cast_zero, Real.sqrt_zero, Complex.ofReal_zero, zero_mul, ↓reduceIte] + · rw [ite_eq_right hk] + +theorem weakDefect_uncentered (t : ℝ) (x : J → Fock n) + (hx : Summable (fun r => ‖x r‖^2)) (j : Fin n) (μ : ℂ) (Z : Fock n →L[ℂ] Fock n) : + weakDefect t x j μ Z=singleWeak t j x Z-conj μ* + CrossEnsemble.pairing (fun r => inverseWeight 3 (x r)) (fun r => inverseWeight 3 (x r)) Z := by + have hi := CrossEnsemble.applied_summable hx (inverseWeight 3) + have hl := CrossEnsemble.applied_summable hx (sandwich 0 3 (by omega) j) + have hr := CrossEnsemble.applied_summable hx (creationSandwich 0 3 (by omega) j) + simp only [weakDefect, centeredLadder_lower, centeredLadder_raise] + rw [CrossEnsemble.pairing_sub_right _ _ _ hi hl hi, + CrossEnsemble.pairing_sub_left _ _ _ hr hi hi] + unfold singleWeak + ring +end WeightedGenerator + +namespace ThermalSpectral.Space +open EntropyPhotonNumber Annihilation WeightedGenerator ThermalMetric +open scoped ComplexConjugate +variable {n : ℕ} (S : Space (Fock n)) + +theorem defectFunctional_observable (x : S.I → Fock n) + (hx : Summable (fun r => ‖x r‖^2)) + (hi : ∀ r, inverseWeight 3 (x r)=(Real.sqrt (S.p r):ℂ) • S.basis r) + (j : Fin n) (μ : ℂ) + (hd : Summable (fun a : S.I × S.I => + (1-frequency S.r (S.p a.1) (S.p a.2))*defectCoefficient S.r (S.p a.1) (S.p a.2)* + ‖centeredEntry S.basis S.p x j μ a.1 a.2‖^2)) (Z : Fock n →L[ℂ] Fock n) : + defectFunctional S.r S.rpos S.p S.pos (fun a => centeredEntry S.basis S.p x j μ a.1 a.2) hd + (S.observable Z)=weakDefect S.r x j μ Z := by + exact (defectVector_pairing S.r S.rpos S.p S.pos _ hd + (fun a => inner ℂ (S.basis a.1) (Z (S.basis a.2))) + (observable_summable S.basis S.p S.pos S.sum.summable S.r S.rpos Z)).unique + (weakDefect_spectral S.basis S.p S.pos x hx hi S.r j μ Z) + +theorem defectFunctional_one (d : S.I × S.I → ℂ) (hd) + (hc : HasSum (fun j => (S.p j:ℂ)*d (j,j)) 0) : + defectFunctional S.r S.rpos S.p S.pos d hd (S.observable 1)=0 := by + have hh := defectVector_mem_centeredSpace S.r S.rpos S.p S.pos S.sum.summable d hd hc + change inner ℂ (identityVector S.r S.rpos S.p S.pos S.sum.summable) + (defectVector S.r S.rpos S.p S.pos d hd)=0 at hh + change inner ℂ (defectVector S.r S.rpos S.p S.pos d hd) (S.observable 1)=0 + have he : S.observable 1=identityVector S.r S.rpos S.p S.pos S.sum.summable := + observableMap_id S.basis S.p S.pos S.sum.summable S.r S.rpos + rw [he, ← inner_conj_symm, hh, map_zero] + +theorem weakDefect_centered {ρ : State n} (X : WeightedColumns ρ) (hI : X.Index=S.I) + (x : S.I → Fock n) (hx : Summable (fun r => ‖x r‖^2)) + (hi : ∀ r, inverseWeight 3 (x r)=(Real.sqrt (S.p r):ℂ) • S.basis r) + (he : HEq X.vector x) (j : Fin n) (μ : ℂ) + (hd : Summable (fun a : S.I × S.I => + (1-frequency S.r (S.p a.1) (S.p a.2))*defectCoefficient S.r (S.p a.1) (S.p a.2)* + ‖centeredEntry S.basis S.p x j μ a.1 a.2‖^2)) + (hc : HasSum (fun r => (S.p r:ℂ)*centeredEntry S.basis S.p x j μ r r) 0) + (Z : Fock n →L[ℂ] Fock n) : + weakDefect S.r x j μ Z=X.centeredWeak S.r j Z := by + have hz : weakDefect S.r x j μ 1=0 := by + rw [← S.defectFunctional_observable x hx hi j μ hd, S.defectFunctional_one _ hd hc] + rcases X with ⟨I,v,hs,hn,heig⟩ + dsimp only at hI he ⊢ + subst I + have hev : v=x := eq_of_heq he + subst v + have hm : BeamLadder.singleWeak S.r j x 1=conj μ := by + rw [weakDefect_uncentered S.r x hx j μ 1] at hz + have ht : CrossEnsemble.pairing (fun r => inverseWeight 3 (x r)) + (fun r => inverseWeight 3 (x r)) 1=1 := + (WeightedColumns.mk S.I x hs hn heig).expectation_one + rw [ht, mul_one] at hz + exact sub_eq_zero.mp hz + rw [weakDefect_uncentered S.r x hx j μ Z] + simp only [WeightedColumns.centeredWeak, WeightedColumns.weakMean, WeightedColumns.expectation, hm] +end ThermalSpectral.Space + +end + +end OAI diff --git a/lean/OAI/InformationTheory/PhotonNumber/SpectralLog.lean b/lean/OAI/InformationTheory/PhotonNumber/SpectralLog.lean new file mode 100644 index 0000000000000000000000000000000000000000..b05f24dfc5205a7bb0685c3b27d5d2634a9456ed --- /dev/null +++ b/lean/OAI/InformationTheory/PhotonNumber/SpectralLog.lean @@ -0,0 +1,785 @@ +import OAI.InformationTheory.PhotonNumber.ThermalMetric + +namespace OAI + +noncomputable section + +open scoped BigOperators ComplexConjugate ENNReal Topology +open MeasureTheory +open scoped ComplexConjugate +open scoped BigOperators ComplexConjugate +open scoped BigOperators +open MvPolynomial +open scoped BigOperators ComplexConjugate Classical +open Submodule +open ContinuousLinearMap +open scoped ENNReal +open Set Filter Topology Complex MeasureTheory +open Set Filter Topology Complex Metric +open MeasureTheory Set Filter Topology Complex Metric InnerProductSpace +open scoped ENNReal NNReal +open Filter Topology + +namespace SquareAnalysis +variable {E : Type*} [NormedAddCommGroup E] [InnerProductSpace ℂ E] +variable {I : Type*} + +abbrev H (I : Type*) := lp (fun _ : I => ℂ) 2 + +def vector (f : I → E →ₗ[ℂ] ℂ) (hs : ∀ x, Summable (fun i => ‖f i x‖^2)) (x : E) : H I := + ⟨fun i => f i x, (memℓp_gen_iff (by norm_num : 0 < (2 : ENNReal).toReal)).mpr + (by simpa only [ENNReal.toReal_ofNat, Real.rpow_two] using hs x)⟩ + +@[simp] theorem vector_apply (f : I → E →ₗ[ℂ] ℂ) (hs : ∀ x, Summable (fun i => ‖f i x‖^2)) + (x : E) (i : I) : vector f hs x i = f i x := rfl + +theorem hasSum_square (x : H I) : HasSum (fun i => ‖x i‖^2) (‖x‖^2) := by + simpa only [ENNReal.toReal_ofNat, Real.rpow_two] using (lp.hasSum_norm (p := 2) (by norm_num) x) + +theorem vector_norm_sq (f : I → E →ₗ[ℂ] ℂ) (hs : ∀ x, Summable (fun i => ‖f i x‖^2)) + (x : E) : ‖vector f hs x‖^2 = ∑' i, ‖f i x‖^2 := + (hasSum_square (vector f hs x)).tsum_eq.symm + +def linearMap (f : I → E →ₗ[ℂ] ℂ) (hs : ∀ x, Summable (fun i => ‖f i x‖^2)) : + E →ₗ[ℂ] H I where + toFun := vector f hs + map_add' := fun x y => by apply lp.ext; funext i; exact map_add (f i) x y + map_smul' := fun c x => by apply lp.ext; funext i; exact map_smul (f i) c x + +theorem vector_norm_le (f : I → E →ₗ[ℂ] ℂ) (hs : ∀ x, Summable (fun i => ‖f i x‖^2)) + {C : ℝ} (hC : 0 ≤ C) (hb : ∀ x, (∑' i, ‖f i x‖^2) ≤ C*‖x‖^2) (x : E) : + ‖vector f hs x‖ ≤ Real.sqrt C*‖x‖ := by + have hh := hb x + rw [← vector_norm_sq f hs x] at hh + have he := Real.sq_sqrt hC + have hp := mul_nonneg (Real.sqrt_nonneg C) (norm_nonneg x) + nlinarith [sq_nonneg (‖vector f hs x‖-Real.sqrt C*‖x‖)] + +def continuousMap (f : I → E →ₗ[ℂ] ℂ) (hs : ∀ x, Summable (fun i => ‖f i x‖^2)) + (C : ℝ) (hC : 0 ≤ C) (hb : ∀ x, (∑' i, ‖f i x‖^2) ≤ C*‖x‖^2) : E →L[ℂ] H I := + (linearMap f hs).mkContinuous (Real.sqrt C) (vector_norm_le f hs hC hb) + +@[simp] theorem continuousMap_apply (f : I → E →ₗ[ℂ] ℂ) + (hs : ∀ x, Summable (fun i => ‖f i x‖^2)) + (C : ℝ) (hC : 0 ≤ C) (hb : ∀ x, (∑' i, ‖f i x‖^2) ≤ C*‖x‖^2) (x : E) : + continuousMap f hs C hC hb x = vector f hs x := rfl + +variable [CompleteSpace E] + +def gram (f : I → E →ₗ[ℂ] ℂ) (hs : ∀ x, Summable (fun i => ‖f i x‖^2)) + (C : ℝ) (hC : 0 ≤ C) (hb : ∀ x, (∑' i, ‖f i x‖^2) ≤ C*‖x‖^2) : E →L[ℂ] E := + (continuousMap f hs C hC hb).adjoint ∘L continuousMap f hs C hC hb + +theorem gram_positive (f : I → E →ₗ[ℂ] ℂ) (hs : ∀ x, Summable (fun i => ‖f i x‖^2)) + (C : ℝ) (hC : 0 ≤ C) (hb : ∀ x, (∑' i, ‖f i x‖^2) ≤ C*‖x‖^2) : + (gram f hs C hC hb).IsPositive := + ContinuousLinearMap.isPositive_adjoint_comp_self _ + +theorem gram_quadratic (f : I → E →ₗ[ℂ] ℂ) (hs : ∀ x, Summable (fun i => ‖f i x‖^2)) + (C : ℝ) (hC : 0 ≤ C) (hb : ∀ x, (∑' i, ‖f i x‖^2) ≤ C*‖x‖^2) (x : E) : + (inner ℂ x (gram f hs C hC hb x)).re = ∑' i, ‖f i x‖^2 := by + exact ((continuousMap f hs C hC hb).apply_norm_sq_eq_inner_adjoint_right x).symm.trans + (vector_norm_sq f hs x) + +theorem exists_positive_representation (f : I → E →ₗ[ℂ] ℂ) + (hs : ∀ x, Summable (fun i => ‖f i x‖^2)) + {C : ℝ} (hC : 0 ≤ C) (hb : ∀ x, (∑' i, ‖f i x‖^2) ≤ C*‖x‖^2) : + ∃ B : E →L[ℂ] E, B.IsPositive ∧ ∀ x, (inner ℂ x (B x)).re = ∑' i, ‖f i x‖^2 := + ⟨gram f hs C hC hb, gram_positive f hs C hC hb, gram_quadratic f hs C hC hb⟩ + +end SquareAnalysis + +namespace QuantumTrace +open scoped ComplexConjugate +variable {E : Type*} [NormedAddCommGroup E] [InnerProductSpace ℂ E] [CompleteSpace E] +variable {J : Type*} + +def logCoordinates (b : HilbertBasis J ℂ E) (c : J → ℝ) (V : E →L[ℂ] E) (j : J) : E →ₗ[ℂ] ℂ := + (Real.sqrt (c j):ℂ) • ((innerSL ℂ (b j)).toLinearMap.comp V.toLinearMap) + +omit [CompleteSpace E] in +theorem logCoordinates_square (b : HilbertBasis J ℂ E) (c : J → ℝ) (hc : ∀ j, 0≤c j) + (V : E →L[ℂ] E) (j : J) (x : E) : + ‖logCoordinates b c V j x‖^2=c j*‖inner ℂ (b j) (V x)‖^2 := by + change ‖(Real.sqrt (c j):ℂ)*inner ℂ (b j) (V x)‖^2=_ + rw [norm_mul,mul_pow,Complex.norm_real,Real.norm_eq_abs,sq_abs,Real.sq_sqrt (hc j)] + +theorem spectral_form_representation (b : HilbertBasis J ℂ E) (c : J → ℝ) + (hc : ∀ j, 0≤c j) (V : E →L[ℂ] E) (hV : V.IsSymmetric) + (hs : ∀ y, Summable (fun j => c j*‖inner ℂ (b j) (V y)‖^2)) + {C : ℝ} (hC : 0≤C) + (hb : ∀ y, (∑' j, c j*‖inner ℂ (b j) (V y)‖^2)≤C*‖y‖^2) : + ∃ B : E →L[ℂ] E, B.IsPositive ∧ + (∀ y, HasSum (fun j => c j*‖inner ℂ (b j) (V y)‖^2) (inner ℂ y (B y)).re) ∧ + ∀ (j : J) (y : E) (z : ℂ), V y=z • b j → B y=(c j:ℂ) • V (z • b j) := by + classical + let f := logCoordinates b c V + have hf (y : E) : Summable (fun j => ‖f j y‖^2) := by + simpa only [f,logCoordinates_square b c hc] using hs y + have hfB (y : E) : (∑' j, ‖f j y‖^2)≤C*‖y‖^2 := by + simpa only [f,logCoordinates_square b c hc] using hb y + let A := SquareAnalysis.continuousMap f hf C hC hfB + refine ⟨SquareAnalysis.gram f hf C hC hfB, SquareAnalysis.gram_positive f hf C hC hfB, ?_, ?_⟩ + · intro y + rw [SquareAnalysis.gram_quadratic] + simpa only [f,logCoordinates_square b c hc] using (hf y).hasSum + · intro j y z hy + have hAy : A y=((Real.sqrt (c j):ℂ)*z) • (lp.single (E := fun _ : J => ℂ) 2 j (1:ℂ)) := by + apply lp.ext + funext i + change (Real.sqrt (c i):ℂ)*inner ℂ (b i) (V y)=_ + rw [hy,inner_smul_right] + by_cases hi : i=j + · subst i + simp [inner_self_eq_norm_sq_to_K, b.orthonormal.norm_eq_one, lp.single_apply] + · have hii : inner ℂ (b i) (b j)=0 := b.orthonormal.inner_eq_zero hi + simp [hii,lp.single_apply,Ne.symm hi] + apply ext_inner_left ℂ + intro x + change inner ℂ x (A.adjoint (A y))=inner ℂ x ((c j:ℂ) • V (z • b j)) + rw [A.adjoint_inner_right,hAy,inner_smul_right,lp.inner_single_right] + simp only [RCLike.inner_apply,one_mul] + change ((Real.sqrt (c j):ℂ)*z)*conj (f j x)=_ + change ((Real.sqrt (c j):ℂ)*z)*conj ((Real.sqrt (c j):ℂ)*inner ℂ (b j) (V x))=_ + rw [map_mul,Complex.conj_ofReal,inner_smul_right,map_smul,inner_smul_right] + have he : inner ℂ x (V (b j))=conj (inner ℂ (b j) (V x)) := by + rw [← inner_conj_symm] + exact congrArg conj (hV (b j) x) + rw [he] + have hsqrt : (Real.sqrt (c j):ℂ)^2=(c j:ℂ) := by exact_mod_cast Real.sq_sqrt (hc j) + linear_combination (z*conj (inner ℂ (b j) (V x)))*hsqrt +end QuantumTrace + +namespace EntropyPhotonNumber +open QuantumTrace Annihilation + +structure SpectralLogData (n : ℕ) (ρ : State n) where + J : Type + basis : HilbertBasis J ℂ (Fock n) + probability : J → ℝ + probability_pos : ∀ j, 0 < probability j + probability_sum : HasSum probability 1 + eigen : ∀ j, ρ.op (basis j)=(probability j:ℂ) • basis j + spectralColumns : J → Fock n + spectralColumns_summable : Summable (fun j => ‖spectralColumns j‖^2) + spectralColumns_inverse : ∀ j, inverseWeight 3 (spectralColumns j)= + CrossEnsemble.eigenEnsemble basis probability j + logSandwich : Fock n →L[ℂ] Fock n + logSandwich_symmetric : logSandwich.IsSymmetric + logSandwich_parseval : ∀ y, HasSum + (fun j => -Real.log (probability j)*‖inner ℂ (basis j) (inverseWeight 2 y)‖^2) + (inner ℂ y (logSandwich y)).re + logSandwich_preimage : ∀ j, logSandwich (inverseWeight 1 (spectralColumns j))= + ((-Real.log (probability j):ℝ):ℂ) • inverseWeight 5 (spectralColumns j) + +namespace GibbsData +variable {n : ℕ} {k : ℝ} {ρ : State n} + +def toSpectralLogData (G : GibbsData n k ρ) (hk : 0 G.logSandwich_preimage hk j _ (G.spectralColumns_inverse j) +end GibbsData +namespace SpectralLogData +variable {n : ℕ} {ρ : State n} (G : SpectralLogData n ρ) + +def logCoefficient (j : G.J) : ℝ := -Real.log (G.probability j) +theorem logCoefficient_nonneg (j : G.J) : 0 ≤ G.logCoefficient j := by + apply neg_nonneg.mpr + apply Real.log_nonpos (G.probability_pos j).le + exact G.probability_sum.tsum_eq ▸ G.probability_sum.summable.le_tsum j (fun i _ => (G.probability_pos i).le) +theorem spectralColumns_normalized : + HasSum (fun r => ‖inverseWeight 3 (G.spectralColumns r)‖^2) 1 := by + simpa only [G.spectralColumns_inverse, + CrossEnsemble.eigenEnsemble_norm G.basis G.probability (fun r => (G.probability_pos r).le)] + using G.probability_sum + +theorem spectralColumns_operator (hm : FiniteMoment 6 ρ) : + CrossEnsemble.operator (weightedRoot 3 ρ hm) (weightedRoot 3 ρ hm)= + CrossEnsemble.operator G.spectralColumns G.spectralColumns := by + exact weightedRoot_operator_eq ρ hm G.basis G.probability + (fun r => (G.probability_pos r).le) G.probability_sum.summable G.eigen + G.spectralColumns G.spectralColumns_summable G.spectralColumns_inverse + +theorem thermalGenerator_logarithmic_trace (hm : FiniteMoment 6 ρ) (t : ℝ) : + (WeightedGenerator.pairing t (weightedRoot 3 ρ hm) G.logSandwich).re = + ∑ j, ∑' a : G.J × G.J, + (G.logCoefficient a.1-G.logCoefficient a.2)* + ((t+1)*G.probability a.2-t*G.probability a.1)* + ‖WeightedGenerator.loweringEntry G.basis G.probability G.spectralColumns j a.1 a.2‖^2 := by + rw [WeightedGenerator.pairing_eq_of_operator_eq G.basis + (weightedRoot_summable 3 ρ hm) G.spectralColumns_summable (G.spectralColumns_operator hm)] + exact WeightedGenerator.thermal_log_spectral G.basis G.probability G.probability_pos + G.spectralColumns G.spectralColumns_summable G.spectralColumns_inverse + G.logSandwich G.logSandwich_symmetric G.logCoefficient G.logCoefficient_nonneg + G.logSandwich_parseval G.logSandwich_preimage t + +end SpectralLogData +end EntropyPhotonNumber + +namespace EntropyPhotonNumber.SpectralLogData +open QuantumTrace Annihilation WeightedGenerator ThermalMetric +variable {n : ℕ} {ρ : State n} (G : SpectralLogData n ρ) + +def annihilationMatrix (j : Fin n) (a : G.J × G.J) : ℂ := + loweringEntry G.basis G.probability G.spectralColumns j a.1 a.2 + +def annihilationMean (j : Fin n) : ℂ := diagonalMean G.probability (G.annihilationMatrix j) + +def centeredMatrix (j : Fin n) (a : G.J × G.J) : ℂ := + centeredEntry G.basis G.probability G.spectralColumns j (G.annihilationMean j) a.1 a.2 + +theorem annihilation_mean_summable (j : Fin n) : + Summable (fun r => (G.probability r:ℂ)*G.annihilationMatrix j (r,r)) := by + apply diagonal_mean_summable G.probability (fun r => (G.probability_pos r).le) + G.probability_sum.summable + have hh := nonlog_summable G.basis G.spectralColumns G.spectralColumns_summable j false + simpa only [spectralGain_lowering_sq G.basis G.probability G.probability_pos, + annihilationMatrix] using hh + +theorem centeredMatrix_mean_zero (j : Fin n) : + HasSum (fun r => (G.probability r:ℂ)*G.centeredMatrix j (r,r)) 0 := by + classical + simpa only [centeredMatrix, centeredEntry, ↓reduceIte, annihilationMean, annihilationMatrix] + using diagonal_centering G.probability G.probability_sum + (G.annihilationMatrix j) (G.annihilation_mean_summable j) + +theorem centeredMatrix_six_sums (j : Fin n) : + Summable (fun a : G.J × G.J => G.probability a.2*‖G.centeredMatrix j a‖^2) ∧ + Summable (fun a : G.J × G.J => G.probability a.1*‖G.centeredMatrix j a‖^2) ∧ + Summable (fun a : G.J × G.J => G.logCoefficient a.1*G.probability a.2*‖G.centeredMatrix j a‖^2) ∧ + Summable (fun a : G.J × G.J => G.logCoefficient a.2*G.probability a.2*‖G.centeredMatrix j a‖^2) ∧ + Summable (fun a : G.J × G.J => G.logCoefficient a.1*G.probability a.1*‖G.centeredMatrix j a‖^2) ∧ + Summable (fun a : G.J × G.J => G.logCoefficient a.2*G.probability a.1*‖G.centeredMatrix j a‖^2) := + centered_six_sums G.basis G.probability G.probability_pos G.probability_sum.summable + G.spectralColumns G.spectralColumns_summable G.spectralColumns_inverse + G.logSandwich (G.logSandwich_symmetric) G.logCoefficient G.logCoefficient_nonneg + (G.logSandwich_parseval) + G.logSandwich_preimage j (G.annihilationMean j) + +theorem centeredMatrix_defect_summable (t : ℝ) (j : Fin n) : + Summable (fun a : G.J × G.J => + (1-frequency t (G.probability a.1) (G.probability a.2))* + defectCoefficient t (G.probability a.1) (G.probability a.2)*‖G.centeredMatrix j a‖^2) := by + rcases G.centeredMatrix_six_sums j with ⟨h₁,h₂,h₃,h₄,h₅,h₆⟩ + exact defect_series_summable t G.probability G.logCoefficient (fun _ => rfl) + (G.centeredMatrix j) h₁ h₂ h₃ h₄ h₅ h₆ + +def defect (t : ℝ) (ht : 0 rfl) + (G.centeredMatrix j) (G.centeredMatrix_defect_summable t j) + (coefficient_series_summable t G.probability (G.centeredMatrix j) hh.1 hh.2.1) + simp only [hj, Finset.sum_sub_distrib] + congr 1 + exact centered_K_sum G.basis G.probability G.probability_pos G.spectralColumns + G.spectralColumns_summable G.spectralColumns_inverse G.spectralColumns_normalized G.annihilationMean t + +end EntropyPhotonNumber.SpectralLogData + +namespace EntropyPhotonNumber + +section +open QuantumTrace Annihilation +variable {n : ℕ} {J : Type} {ρ : State n} + +theorem spectral_weighted_columns (b : HilbertBasis J ℂ (Fock n)) (p : J → ℝ) + (hp : ∀ j, 0≤p j) (he : ∀ j, ρ.op (b j)=(p j:ℂ) • b j) + (hm : FiniteMoment 6 ρ) : + ∃ x : J → Fock n, Summable (fun j => ‖x j‖^2) ∧ + ∀ j, inverseWeight 3 (x j)=CrossEnsemble.eigenEnsemble b p j := by + have hm' : Summable (fun i => (numberWeight i^3)^2* + (inner ℂ (sequenceBasis (NumberIndex n) i) (ρ.op (sequenceBasis _ i))).re) := by + have hb (i : NumberIndex n) : sequenceBasis (NumberIndex n) i = numberKet i := by + ext a + by_cases ha : i=a <;> simp [sequenceBasis_apply, numberKet, ha] + simpa only [← pow_mul, show (3*2:ℕ)=6 from rfl, numberWeight, totalNumber, Nat.cast_sum, + FiniteMoment, entry, hb] using hm + obtain ⟨x, hx, hs, _⟩ := weighted_spectral_vectors b ρ.op p hp he + (fun i => numberWeight i^3) hm' + refine ⟨x, hs, fun j => ?_⟩ + apply lp.ext + funext i + simp only [inverseWeight_apply, hx, CrossEnsemble.eigenEnsemble, lp.coeFn_smul, + Pi.smul_apply, smul_eq_mul, Complex.ofReal_pow] + have hw : (numberWeight i : ℂ) ≠ 0 := by + exact_mod_cast (show numberWeight i ≠ 0 by linarith [numberWeight_one_le i]) + field_simp + +theorem exists_spectralLogData_of_bound (b : HilbertBasis J ℂ (Fock n)) (p : J → ℝ) + (hp : ∀ j, 0

-Real.log (p j)*‖inner ℂ (b j) (inverseWeight 2 y)‖^2)) + {C : ℝ} (hC : 0≤C) + (hb : ∀ y, (∑' j, -Real.log (p j)*‖inner ℂ (b j) (inverseWeight 2 y)‖^2)≤C*‖y‖^2) : + Nonempty (SpectralLogData n ρ) := by + have hc (j : J) : 0≤-Real.log (p j) := by + apply neg_nonneg.mpr + exact Real.log_nonpos (hp j).le (hs.tsum_eq ▸ hs.summable.le_tsum j (fun i _ => (hp i).le)) + obtain ⟨B,hB,hBsum,hBe⟩ := spectral_form_representation b (fun j => -Real.log (p j)) hc + (inverseWeight 2) (ContinuousLinearMap.isSelfAdjoint_iff_isSymmetric.mp (inverseWeight_selfAdjoint 2)) hfin hC hb + obtain ⟨x,hx,hix⟩ := spectral_weighted_columns b p (fun j => (hp j).le) he hm + refine ⟨{ + J := J + basis := b + probability := p + probability_pos := hp + probability_sum := hs + eigen := he + spectralColumns := x + spectralColumns_summable := hx + spectralColumns_inverse := hix + logSandwich := B + logSandwich_symmetric := hB.isSymmetric + logSandwich_parseval := hBsum + logSandwich_preimage := ?_ }⟩ + intro j + have hi : inverseWeight 2 (inverseWeight 1 (x j))=(Real.sqrt (p j):ℂ) • b j := by + change (inverseWeight 2 ∘L inverseWeight 1) (x j)=_ + rw [← inverseWeight_add] + exact hix j + have hh := hBe j (inverseWeight 1 (x j)) (Real.sqrt (p j):ℂ) hi + have hz : inverseWeight 2 ((Real.sqrt (p j):ℂ) • b j)=inverseWeight 5 (x j) := by + rw [← hi] + change (inverseWeight 2 ∘L inverseWeight 2 ∘L inverseWeight 1) (x j)=_ + rw [← inverseWeight_add,← inverseWeight_add] + simpa only [hz] using hh +end + +def numberBasis (n : ℕ) : HilbertBasis (NumberIndex n) ℂ (Fock n) := + HilbertBasis.ofRepr (LinearIsometryEquiv.refl ℂ _) + +@[simp] theorem numberBasis_apply (n : ℕ) (k : NumberIndex n) : + numberBasis n k = numberKet k := by + classical + exact ((numberBasis n).repr_symm_single k).symm + +theorem trace_one_numberBasis {n : ℕ} (ρ : State n) : + HasSum (fun k => (inner ℂ (numberBasis n k) (ρ.op (numberBasis n k))).re) 1 := by + simpa only [numberBasis_apply, entry] using ρ.trace_one + +end EntropyPhotonNumber + +namespace TraceEnsemble +variable {E : Type*} [NormedAddCommGroup E] [InnerProductSpace ℂ E] [CompleteSpace E] +variable {I : Type*} + +def diagonalVector (b : HilbertBasis I ℂ E) (p : I → ℝ) (i : I) : E := + (Real.sqrt (p i) : ℂ) • b i + +omit [CompleteSpace E] in +@[simp] theorem diagonalVector_norm_sq (b : HilbertBasis I ℂ E) (p : I → ℝ) + (hp : ∀ i, 0 ≤ p i) (i : I) : ‖diagonalVector b p i‖^2 = p i := by + simp [diagonalVector, norm_smul, b.orthonormal.norm_eq_one, Real.sq_sqrt (hp i)] + +theorem diagonalVector_eigen (b : HilbertBasis I ℂ E) (p : I → ℝ) + (hp : ∀ i, 0 ≤ p i) (hs : Summable p) (i : I) : + operator (diagonalVector b p) (b i) = (p i : ℂ) • b i := by + classical + have hv : Summable (fun j => ‖diagonalVector b p j‖^2) := by + simpa only [diagonalVector_norm_sq b p hp] using hs + have he (j : I) : InnerProductSpace.rankOne ℂ (diagonalVector b p j) + (diagonalVector b p j) (b i) = if j=i then (p i : ℂ) • b i else 0 := by + simp only [InnerProductSpace.rankOne_apply, diagonalVector, inner_smul_left, + orthonormal_iff_ite.mp b.orthonormal] + split_ifs with h + · subst j + have hsq : (Real.sqrt (p i) : ℂ) * (Real.sqrt (p i) : ℂ) = (p i : ℂ) := by + norm_cast + exact Real.mul_self_sqrt (hp i) + simp only [Complex.conj_ofReal, mul_one, smul_smul, hsq] + · simp only [mul_zero, zero_smul] + have hh := ((ContinuousLinearMap.apply ℂ E (b i)).hasSum (hasSum_rankOne hv)) + simpa only [ContinuousLinearMap.apply_apply, he, tsum_ite_eq] using hh.tsum_eq.symm + +end TraceEnsemble + +namespace EntropyPhotonNumber +open QuantumTrace TraceEnsemble + +def diagonalState {n : ℕ} (p : NumberIndex n → ℝ) (hp : ∀ k, 0 ≤ p k) (hs : HasSum p 1) : State n where + op := TraceEnsemble.operator (diagonalVector (numberBasis n) p) + positive := TraceEnsemble.positive (by simpa only [diagonalVector_norm_sq _ p hp] using hs.summable) + trace_one := by + simpa only [numberBasis_apply, entry] using TraceEnsemble.trace + (by simpa only [diagonalVector_norm_sq _ p hp] using hs : + HasSum (fun k => ‖diagonalVector (numberBasis n) p k‖^2) 1) (numberBasis n) + +@[simp] theorem diagonalState_eigen {n : ℕ} (p : NumberIndex n → ℝ) + (hp : ∀ k, 0 ≤ p k) (hs : HasSum p 1) (k : NumberIndex n) : + (diagonalState p hp hs).op (numberBasis n k) = (p k : ℂ) • numberBasis n k := + diagonalVector_eigen _ _ hp hs.summable k + +@[simp] theorem diagonalState_diagonal {n : ℕ} (p : NumberIndex n → ℝ) + (hp : ∀ k, 0 ≤ p k) (hs : HasSum p 1) (k : NumberIndex n) : + (entry (diagonalState p hp hs).op k k).re = p k := by + rw [entry, ← numberBasis_apply n k, diagonalState_eigen, inner_smul_right, + orthonormal_iff_ite.mp (numberBasis n).orthonormal k k, ite_eq_left rfl, mul_one, Complex.ofReal_re] + +def thermalState (n : ℕ) (r : ℝ) (hr : 0 < r) : State n := + diagonalState (thermalWeight n r) (fun k => (thermalWeight_pos n hr k).le) + (hasSum_thermalWeight n hr) + +@[simp] theorem thermalState_diagonal (n : ℕ) (r : ℝ) (hr : 0 < r) (k : NumberIndex n) : + (entry (thermalState n r hr).op k k).re = thermalWeight n r k := + diagonalState_diagonal _ _ _ _ + +def mixture {n : ℕ} (t : ℝ) (ht : t ∈ Set.Icc 0 1) (ρ σ : State n) : State n where + op := (t : ℂ) • ρ.op + ((1-t : ℝ) : ℂ) • σ.op + positive := by + have h₁ := ρ.positive.smul_of_nonneg (c := (t : ℂ)) (by exact_mod_cast ht.1) + have h₂ := σ.positive.smul_of_nonneg (c := ((1-t : ℝ) : ℂ)) (by exact_mod_cast (sub_nonneg.mpr ht.2)) + exact h₁.add h₂ + trace_one := by + convert! (ρ.trace_one.mul_left t).add (σ.trace_one.mul_left (1-t)) using 1 + · funext k + simp only [entry, add_apply, smul_apply, + inner_add_right, inner_smul_right, Complex.add_re, Complex.mul_re, + Complex.ofReal_re, Complex.ofReal_im, zero_mul, sub_zero] + · ring + +end EntropyPhotonNumber + +namespace QuantumTrace + +section +variable {E : Type*} [NormedAddCommGroup E] [InnerProductSpace ℂ E] [CompleteSpace E] +variable {I J : Type*} + +theorem log_apply_eigenvector {T : E →L[ℂ] E} (hT : IsStrictlyPositive T) + {x : E} {p : ℝ} (he : T x = (p : ℂ) • x) : + CFC.log T x = (Real.log p : ℂ) • x := by + have hs := (ContinuousLinearMap.nonneg_iff_isPositive.mp hT.nonneg).isSymmetric + change cfc Real.log T x = _ + rw [cfc_real_eq_complex Real.log hs.isSelfAdjoint] + have hf : ContinuousOn (fun z : ℂ => (Real.log z.re : ℂ)) (spectrum ℂ T) := by + intro z hz + have hp : 0 < z.re := + (StarOrderedRing.isStrictlyPositive_iff_spectrum_pos (R := ℝ) T hs.isSelfAdjoint).mp hT + z.re (hs.isSelfAdjoint.spectrumRestricts.apply_mem hz) + exact (Complex.continuous_ofReal.continuousAt.comp + ((Real.continuousAt_log hp.ne').comp Complex.continuous_re.continuousAt)).continuousWithinAt + simpa using cfc_apply_eigenvector hs he _ hf + +def regularNegLog (T : E →L[ℂ] E) (ε : ℝ) : E →L[ℂ] E := + Real.log (1+ε) • 1 - CFC.log (T + ε • 1) + +theorem add_scalar_strictPositive {T : E →L[ℂ] E} (hT : T.IsPositive) + {ε : ℝ} (hε : 0 < ε) : IsStrictlyPositive (T + ε • 1) := by + exact (IsStrictlyPositive.smul hε isStrictlyPositive_one).nonneg_add + (ContinuousLinearMap.nonneg_iff_isPositive.mpr hT) + +theorem regularNegLog_eigen {T : E →L[ℂ] E} (hT : T.IsPositive) + {ε : ℝ} (hε : 0 < ε) {x : E} {p : ℝ} (he : T x = (p : ℂ) • x) : + regularNegLog T ε x = ((Real.log (1+ε)-Real.log (p+ε) : ℝ) : ℂ) • x := by + have ht : (T + ε • 1) x = ((p+ε : ℝ) : ℂ) • x := by + simp [he, add_smul] + rw [regularNegLog, sub_apply, + log_apply_eigenvector (add_scalar_strictPositive hT hε) ht] + simp [sub_smul] + +theorem regularNegLog_antitone {R T : E →L[ℂ] E} (hR : R.IsPositive) + (hRT : R ≤ T) {ε : ℝ} (hε : 0 < ε) : regularNegLog T ε ≤ regularNegLog R ε := by + have hRT' : R + ε • (1 : E →L[ℂ] E) ≤ T + ε • 1 := add_le_add_left hRT _ + have hRp : IsStrictlyPositive (R + ε • (1 : E →L[ℂ] E)) := add_scalar_strictPositive hR hε + have hh : CFC.log (R + ε • (1 : E →L[ℂ] E)) ≤ CFC.log (T + ε • 1) := by + apply CFC.log_le_log + · exact hRT' + · exact hRp + change Real.log (1+ε) • 1 - CFC.log (T + ε • 1) ≤ + Real.log (1+ε) • 1 - CFC.log (R + ε • 1) + exact sub_le_sub_left hh _ + +theorem regularNegLog_scalar_bounds {p ε : ℝ} (hp : 0 < p) (hp1 : p ≤ 1) + (hε : 0 ≤ ε) : 0 ≤ Real.log (1+ε)-Real.log (p+ε) ∧ + Real.log (1+ε)-Real.log (p+ε) ≤ -Real.log p := by + constructor + · exact sub_nonneg.mpr (Real.log_le_log (by linarith) (by linarith)) + · have hh : p*(1+ε) ≤ p+ε := by nlinarith + have hl := Real.log_le_log (mul_pos hp (by linarith)) hh + rw [Real.log_mul hp.ne' (by linarith : (1+ε : ℝ) ≠ 0)] at hl + linarith + +theorem negativeLog_form_mono (b : HilbertBasis I ℂ E) (c : HilbertBasis J ℂ E) + {T R : E →L[ℂ] E} (hT : T.IsPositive) (hR : R.IsPositive) (hRT : R ≤ T) + (p : I → ℝ) (q : J → ℝ) (hp : ∀ i, 0 < p i) (hq : ∀ j, 0 < q j) + (hp1 : ∀ i, p i ≤ 1) (hq1 : ∀ j, q j ≤ 1) + (heT : ∀ i, T (b i) = (p i : ℂ) • b i) + (heR : ∀ j, R (c j) = (q j : ℂ) • c j) (x : E) + (hfin : Summable (fun j => -Real.log (q j)*‖inner ℂ (c j) x‖^2)) : + Summable (fun i => -Real.log (p i)*‖inner ℂ (b i) x‖^2) ∧ + (∑' i, -Real.log (p i)*‖inner ℂ (b i) x‖^2) ≤ + ∑' j, -Real.log (q j)*‖inner ℂ (c j) x‖^2 := by + have hnp (i : I) : 0 ≤ -Real.log (p i)*‖inner ℂ (b i) x‖^2 := + mul_nonneg (neg_nonneg.mpr (Real.log_nonpos (hp i).le (hp1 i))) (sq_nonneg _) + have hpartial (s : Finset I) : + ∑ i ∈ s, -Real.log (p i)*‖inner ℂ (b i) x‖^2 ≤ + ∑' j, -Real.log (q j)*‖inner ℂ (c j) x‖^2 := by + have hbdd (ε : ℝ) (hε : 0 < ε) : + ∑ i ∈ s, (Real.log (1+ε)-Real.log (p i+ε))*‖inner ℂ (b i) x‖^2 ≤ + ∑' j, -Real.log (q j)*‖inner ℂ (c j) x‖^2 := by + have ht := hasSum_quadratic_eigenbasis b (regularNegLog T ε) + (fun i => Real.log (1+ε)-Real.log (p i+ε)) + (fun i => regularNegLog_eigen hT hε (heT i)) x + have hr := hasSum_quadratic_eigenbasis c (regularNegLog R ε) + (fun j => Real.log (1+ε)-Real.log (q j+ε)) + (fun j => regularNegLog_eigen hR hε (heR j)) x + have hquad : (inner ℂ x (regularNegLog T ε x)).re ≤ + (inner ℂ x (regularNegLog R ε x)).re := by + have hh := (ContinuousLinearMap.nonneg_iff_isPositive.mp + (sub_nonneg.mpr (regularNegLog_antitone hR hRT hε))).re_inner_nonneg_right x + simpa [inner_sub_right] using hh + calc + _ ≤ (inner ℂ x (regularNegLog T ε x)).re := by + rw [← ht.tsum_eq] + exact ht.summable.sum_le_tsum s (fun i _ => + mul_nonneg (regularNegLog_scalar_bounds (hp i) (hp1 i) hε.le).1 (sq_nonneg _)) + _ ≤ (inner ℂ x (regularNegLog R ε x)).re := hquad + _ ≤ _ := by + rw [← hr.tsum_eq] + exact Summable.tsum_le_tsum (fun j => mul_le_mul_of_nonneg_right + (regularNegLog_scalar_bounds (hq j) (hq1 j) hε.le).2 (sq_nonneg _)) hr.summable hfin + have hc : ContinuousAt (fun ε : ℝ => + ∑ i ∈ s, (Real.log (1+ε)-Real.log (p i+ε))*‖inner ℂ (b i) x‖^2) 0 := by + apply tendsto_finsetSum + intro i _ + apply ContinuousAt.mul_const + apply ContinuousAt.sub + · exact (Real.continuousAt_log (by norm_num : (1+(0:ℝ)) ≠ 0)).comp + (continuousAt_const.add continuousAt_id) + · exact (Real.continuousAt_log (by simpa using (hp i).ne')).comp + (continuousAt_const.add continuousAt_id) + have hl : Filter.Tendsto (fun ε : ℝ => + ∑ i ∈ s, (Real.log (1+ε)-Real.log (p i+ε))*‖inner ℂ (b i) x‖^2) + (𝓝[>] 0) (𝓝 (∑ i ∈ s, -Real.log (p i)*‖inner ℂ (b i) x‖^2)) := by + simpa using hc.tendsto.mono_left nhdsWithin_le_nhds + exact le_of_tendsto hl (eventually_mem_nhdsWithin.mono fun ε hε => hbdd ε hε) + have hs := summable_of_sum_le hnp hpartial + refine ⟨hs, ?_⟩ + exact le_of_tendsto hs.hasSum (Filter.Eventually.of_forall hpartial) + +end + +variable {E : Type*} [NormedAddCommGroup E] [InnerProductSpace ℂ E] +variable {I : Type*} + +theorem eigenbasis_quadratic_pos (b : HilbertBasis I ℂ E) (T : E →L[ℂ] E) + (p : I → ℝ) (hp : ∀ i, 0 < p i) (he : ∀ i, T (b i) = (p i : ℂ) • b i) + {x : E} (hx : x ≠ 0) : 0 < (inner ℂ x (T x)).re := by + classical + have hex : ∃ i, inner ℂ (b i) x ≠ 0 := by + by_contra! h + apply hx + apply b.repr.injective + apply lp.ext + funext i + rw [map_zero, HilbertBasis.repr_apply_apply] + exact h i + obtain ⟨i, hi⟩ := hex + have hs := hasSum_quadratic_eigenbasis b T p he x + have hn : ∀ i, 0 ≤ p i*‖inner ℂ (b i) x‖^2 := fun i => mul_nonneg (hp i).le (sq_nonneg _) + have ht := hs.summable.le_tsum i (fun j _ => hn j) + rw [hs.tsum_eq] at ht + exact (mul_pos (hp i) (sq_pos_of_ne_zero (norm_ne_zero_iff.mpr hi))).trans_le ht + +end QuantumTrace + +namespace EntropyPhotonNumber + +section +open QuantumTrace + +theorem mixture_replacement_le {n : ℕ} (κ : ℝ) (hκ : κ ∈ Set.Icc 0 1) (ρ τ : State n) : + (κ : ℂ) • τ.op ≤ (mixture (1-κ) ⟨sub_nonneg.mpr hκ.2, sub_le_self _ hκ.1⟩ ρ τ).op := by + have hp := ρ.positive.smul_of_nonneg (c := ((1-κ : ℝ) : ℂ)) + (by exact_mod_cast sub_nonneg.mpr hκ.2) + have he : 1-(1-κ) = κ := by ring + simpa only [mixture, he, add_sub_cancel_right] using + le_add_of_nonneg_left (ContinuousLinearMap.nonneg_iff_isPositive.mpr hp) + +theorem exists_faithful_eigenbasis_of_thermal_le {n : ℕ} (ρ : State n) + {r κ : ℝ} (hr : 0 < r) (hκ : 0 < κ) + (hle : (κ : ℂ) • (thermalState n r hr).op ≤ ρ.op) : + ∃ (J : Type) (b : HilbertBasis J ℂ (Fock n)) (p : J → ℝ), + (∀ j, 0 < p j) ∧ HasSum p 1 ∧ ∀ j, ρ.op (b j) = (p j : ℂ) • b j := by + obtain ⟨J, b, p, hp, hs, he⟩ := exists_positive_eigenbasis (numberBasis n) ρ.positive + (trace_one_numberBasis ρ) + refine ⟨J, b, p, ?_, hs, he⟩ + intro j + have ht := eigenbasis_quadratic_pos (numberBasis n) ((κ : ℂ) • (thermalState n r hr).op) + (fun k => κ*thermalWeight n r k) (fun k => mul_pos hκ (thermalWeight_pos n hr k)) + (fun k => by simp only [smul_apply, thermalState, diagonalState_eigen, smul_smul, + Complex.ofReal_mul]) (b.orthonormal.ne_zero j) + have hh := (ContinuousLinearMap.nonneg_iff_isPositive.mp (sub_nonneg.mpr hle)).re_inner_nonneg_right (b j) + have hvalue : (inner ℂ (b j) (ρ.op (b j))).re = p j := by + rw [he, inner_smul_right, inner_self_eq_norm_sq_to_K, b.orthonormal.norm_eq_one] + simp + simp only [sub_apply, inner_sub_right] at hh + change 0 ≤ (inner ℂ (b j) (ρ.op (b j))).re - + (inner ℂ (b j) (((κ : ℂ) • (thermalState n r hr).op) (b j))).re at hh + rw [hvalue] at hh + linarith + +def vectorEnergy {n : ℕ} (x : Fock n) : ℝ := + ∑' k, (totalNumber k : ℝ)*‖inner ℂ (numberBasis n k) x‖^2 + +def FiniteVectorEnergy {n : ℕ} (x : Fock n) : Prop := + Summable (fun k => (totalNumber k : ℝ)*‖inner ℂ (numberBasis n k) x‖^2) + +theorem thermal_negativeLog_hasSum {n : ℕ} {r κ : ℝ} (hr : 0 < r) (hκ : 0 < κ) + (x : Fock n) (hx : FiniteVectorEnergy x) : + HasSum (fun k => -Real.log (κ*thermalWeight n r k)*‖inner ℂ (numberBasis n k) x‖^2) + ((-Real.log κ+n*Real.log (r+1))*‖x‖^2+Real.log ((r+1)/r)*vectorEnergy x) := by + have h := ((basis_hasSum_norm_sq (numberBasis n) x).mul_left + (-Real.log κ+n*Real.log (r+1))).add (hx.hasSum.mul_left (Real.log ((r+1)/r))) + convert! h using 1 + funext k + rw [Real.log_mul hκ.ne' (thermalWeight_pos n hr k).ne'] + have he : -Real.log (thermalWeight n r k) = + n*Real.log (r+1)+(totalNumber k : ℝ)*Real.log ((r+1)/r) := by + simpa only [totalNumber, Nat.cast_sum] using log_thermalWeight n hr k + rw [neg_add, he] + ring + +theorem negativeLog_le_thermal {n : ℕ} (ρ : State n) {r κ : ℝ} (hr : 0 < r) + (hκ : 0 < κ) (hκ1 : κ ≤ 1) (hle : (κ : ℂ) • (thermalState n r hr).op ≤ ρ.op) + {J : Type*} (b : HilbertBasis J ℂ (Fock n)) (p : J → ℝ) (hp : ∀ j, 0 < p j) + (hs : HasSum p 1) (he : ∀ j, ρ.op (b j) = (p j : ℂ) • b j) + (x : Fock n) (hx : FiniteVectorEnergy x) : + Summable (fun j => -Real.log (p j)*‖inner ℂ (b j) x‖^2) ∧ + (∑' j, -Real.log (p j)*‖inner ℂ (b j) x‖^2) ≤ + (-Real.log κ+n*Real.log (r+1))*‖x‖^2+Real.log ((r+1)/r)*vectorEnergy x := by + have ht := thermal_negativeLog_hasSum hr hκ x hx + have hp1 (j : J) : p j ≤ 1 := hs.tsum_eq ▸ hs.summable.le_tsum j (fun i _ => (hp i).le) + have hq1 (k : NumberIndex n) : κ*thermalWeight n r k ≤ 1 := by + have h := (hasSum_thermalWeight n hr).summable.le_tsum k (fun i _ => (thermalWeight_pos n hr i).le) + rw [(hasSum_thermalWeight n hr).tsum_eq] at h + nlinarith [thermalWeight_pos n hr k] + have hR := (thermalState n r hr).positive.smul_of_nonneg (c := (κ : ℂ)) (by exact_mod_cast hκ.le) + have h := negativeLog_form_mono b (numberBasis n) ρ.positive hR hle p + (fun k => κ*thermalWeight n r k) hp (fun k => mul_pos hκ (thermalWeight_pos n hr k)) hp1 hq1 he + (fun k => by simp only [smul_apply, thermalState, diagonalState_eigen, smul_smul, + Complex.ofReal_mul]) x ht.summable + exact ⟨h.1, h.2.trans_eq ht.tsum_eq⟩ + +end + +open QuantumTrace Annihilation +variable {n : ℕ} + +theorem inverseWeight_two_norm (x : Fock n) : ‖inverseWeight 2 x‖≤‖x‖ := by + change ‖WeightedShift.pull id Function.injective_id + (fun k : NumberIndex n => ((numberWeight k^2)⁻¹:ℂ)) 1 (by norm_num) + (coefficient_inverse_bound 2) x‖≤‖x‖ + simpa only [one_mul] using WeightedShift.pull_bound id Function.injective_id + (fun k : NumberIndex n => ((numberWeight k^2)⁻¹:ℂ)) 1 (by norm_num) + (coefficient_inverse_bound 2) x + +theorem inverseWeight_two_energy_term (x : Fock n) (i : NumberIndex n) : + (totalNumber i:ℝ)*‖inner ℂ (numberBasis n i) (inverseWeight 2 x)‖^2≤‖x i‖^2 := by + simp only [numberBasis_apply, numberKet, lp.inner_single_left, RCLike.inner_apply, + map_one, mul_one, inverseWeight_apply, norm_mul, mul_pow, norm_inv, norm_pow, + Complex.norm_real, Real.norm_eq_abs, sq_abs] + have hW := numberWeight_one_le i + have hw : 0 mul_nonneg (Nat.cast_nonneg _) (sq_nonneg _)) + exact inverseWeight_two_energy_term x + +theorem inverseWeight_two_energy (x : Fock n) : vectorEnergy (inverseWeight 2 x)≤‖x‖^2 := by + rw [vectorEnergy,← (SquareAnalysis.hasSum_square x).tsum_eq] + exact (inverseWeight_two_finiteEnergy x).tsum_le_tsum (inverseWeight_two_energy_term x) + (SquareAnalysis.hasSum_square x).summable + +theorem exists_spectralLogData_of_thermal_le (ρ : State n) {r κ : ℝ} + (hr : 0 (hh y).1) + (C := A+D) (add_nonneg hA hD) + intro y + exact (hh y).2.trans (by + have h1 := mul_le_mul_of_nonneg_left + (pow_le_pow_left₀ (norm_nonneg _) (inverseWeight_two_norm y) 2) hA + have h2 := mul_le_mul_of_nonneg_left (inverseWeight_two_energy y) hD + change A*‖inverseWeight 2 y‖^2+D*vectorEnergy (inverseWeight 2 y)≤(A+D)*‖y‖^2 + nlinarith) +end EntropyPhotonNumber + +end + +end OAI diff --git a/lean/OAI/InformationTheory/PhotonNumber/ThermalLimit.lean b/lean/OAI/InformationTheory/PhotonNumber/ThermalLimit.lean new file mode 100644 index 0000000000000000000000000000000000000000..457ac02b2df18f0ea670acf62601147eea03a887 --- /dev/null +++ b/lean/OAI/InformationTheory/PhotonNumber/ThermalLimit.lean @@ -0,0 +1,728 @@ +import OAI.InformationTheory.PhotonNumber.Minimum + +namespace OAI + +noncomputable section + +section +open scoped BigOperators ComplexConjugate ENNReal Topology +open MeasureTheory +open scoped ComplexConjugate +open scoped BigOperators ComplexConjugate + +namespace ThermalMetric +open EntropyPhotonNumber +variable {J E : Type*} [NormedAddCommGroup E] [InnerProductSpace ℂ E] [CompleteSpace E] + +omit [CompleteSpace E] in + +theorem column_metric_bound (b : HilbertBasis J ℂ E) (p : J → ℝ) + (hp : ∀ j, 0

p a.2*‖inner ℂ (b a.1) (Z (b a.2))‖^2) ∧ + (∑' a : J × J, p a.2*‖inner ℂ (b a.1) (Z (b a.2))‖^2) ≤ ‖Z‖^2 := by + have hn (j : J) : ‖Z (b j)‖^2 ≤ ‖Z‖^2 := by + apply pow_le_pow_left₀ (norm_nonneg _) + simpa only [b.orthonormal.norm_eq_one, mul_one] using Z.le_opNorm (b j) + have hsum : Summable (fun j => p j*‖Z (b j)‖^2) := + Summable.of_nonneg_of_le (fun j => mul_nonneg (hp j).le (sq_nonneg _)) + (fun j => mul_le_mul_of_nonneg_left (hn j) (hp j).le) (hs.summable.mul_right (‖Z‖^2)) + have he (j : J) : HasSum (fun i => p j*‖inner ℂ (b i) (Z (b j))‖^2) + (p j*‖Z (b j)‖^2) := (QuantumTrace.basis_hasSum_norm_sq b (Z (b j))).mul_left (p j) + have hadd : Summable (fun a : J × J => p a.1*‖inner ℂ (b a.2) (Z (b a.1))‖^2) := by + apply (summable_prod_of_nonneg (fun a => mul_nonneg (hp a.1).le (sq_nonneg _))).mpr + exact ⟨fun j => (he j).summable, by simpa only [(he _).tsum_eq] using hsum⟩ + refine ⟨hadd.prod_symm, ?_⟩ + calc + (∑' a : J × J, p a.2*‖inner ℂ (b a.1) (Z (b a.2))‖^2) = + ∑' a : J × J, p a.1*‖inner ℂ (b a.2) (Z (b a.1))‖^2 := + by simpa only [Equiv.prodComm_apply, Prod.swap] using + (Equiv.prodComm J J).tsum_eq (fun a : J × J => p a.1*‖inner ℂ (b a.2) (Z (b a.1))‖^2) + _ = ∑' j, p j*‖Z (b j)‖^2 := by rw [hadd.tsum_prod]; simp only [(he _).tsum_eq] + _ ≤ ∑' j, p j*‖Z‖^2 := hsum.tsum_le_tsum + (fun j => mul_le_mul_of_nonneg_left (hn j) (hp j).le) (hs.summable.mul_right _) + _ = ‖Z‖^2 := by rw [tsum_mul_right, hs.tsum_eq, one_mul] + +theorem bounded_matrix_bound (b : HilbertBasis J ℂ E) (p : J → ℝ) + (hp : ∀ j, 0

p a.1*‖inner ℂ (b a.1) (Z (b a.2))‖^2) ∧ + (∑' a : J × J, p a.1*‖inner ℂ (b a.1) (Z (b a.2))‖^2) ≤ ‖Z‖^2 := by + constructor + · simpa only [Prod.swap, ContinuousLinearMap.adjoint_inner_right, norm_inner_symm] + using hca.1.prod_symm + · have he := (Equiv.prodComm J J).tsum_eq + (fun a : J × J => p a.2*‖inner ℂ (b a.1) (Z.adjoint (b a.2))‖^2) + have hb := hca.2 + rw [← he] at hb + simpa only [Equiv.prodComm_apply, Prod.swap, ContinuousLinearMap.adjoint_inner_right, + norm_inner_symm, LinearIsometryEquiv.norm_map] using hb + have hh := bounded_matrix_summable b p hp hs.summable t ht Z + have hb := (((hr.1.mul_left t).add (hc.1.mul_left (t+1))).mul_left (h t/2)) + calc + _ ≤ ∑' a : J × J, h t/2*(t*(p a.1*‖inner ℂ (b a.1) (Z (b a.2))‖^2)+ + (t+1)*(p a.2*‖inner ℂ (b a.1) (Z (b a.2))‖^2)) := by + apply hh.tsum_le_tsum _ hb + intro a + have ha := DiagonalForms.System.logMean_le_arithmetic (mul_pos ht (hp a.1)) + (mul_pos (by positivity : 0 inner ℂ (G.basis a.1) (Z (G.basis a.2))) + (bounded_matrix_summable G.basis G.probability G.probability_pos + G.probability_sum.summable t ht Z)).unique + (weakDefect_spectral G.basis G.probability G.probability_pos G.spectralColumns + G.spectralColumns_summable G.spectralColumns_inverse t j (G.annihilationMean j) Z) + +theorem observableVector_bound (t : ℝ) (ht : 0 + intro p b hb hpb + have hpj : 0 < (p j : ℝ) := Nat.cast_pos.mpr (by omega) + have hz := hM j p b (by omega) + have hne : (r+1)*Real.sqrt (p j : ℝ) ≠ 0 := by positivity + simp only [hb, Nat.cast_zero, Real.sqrt_zero, mul_zero, zero_smul] at hz + exact (smul_eq_zero.mp hz).resolve_left hne + | succ m ih => + intro p b hb hpb + have hprev := ih (lower p j) (lower b j) (by simp [hb]) (by simp; omega) + have hpj : 0 < (p j : ℝ) := Nat.cast_pos.mpr (by omega) + have hz := hM j p b (by omega) + rw [hprev, smul_zero] at hz + exact (smul_eq_zero.mp hz).resolve_left (by positivity) + exact hall (b j) p b rfl hp + +omit [Fintype J] in + +theorem off_diagonal_zero {r : ℝ} (hr : 0 < r) + {M : (J → ℕ) → (J → ℕ) → ℂ} (hM : Balance r M) + (hstar : ∀ p b, M b p = conj (M p b)) {p b : J → ℕ} (hne : p ≠ b) : M p b = 0 := by + obtain ⟨j, hj⟩ := Function.ne_iff.mp hne + rcases lt_or_gt_of_ne hj with h | h + · have hb := entry_zero_of_lt hr hM j h + rw [hstar] at hb + simpa using congrArg conj hb + · exact entry_zero_of_lt hr hM j h + +omit [Fintype J] in + +theorem diagonal_step {r : ℝ} (hr : 0 < r) + {M : (J → ℕ) → (J → ℕ) → ℂ} (hM : Balance r M) + {p : J → ℕ} {j : J} (hp : 0 < p j) : + M p p = (r/(r+1)) • M (lower p j) (lower p j) := by + have hh := hM j p p hp + have ha : (r+1)*Real.sqrt (p j:ℝ) ≠ 0 := by positivity + have he : ((r+1)*Real.sqrt (p j:ℝ)) • + ((r/(r+1)) • M (lower p j) (lower p j)) = + (r*Real.sqrt (p j:ℝ)) • M (lower p j) (lower p j) := by + rw [smul_smul] + congr 1 + field_simp + apply (smul_right_injective _ ha) + exact hh.trans he.symm + +theorem diagonal_formula {r : ℝ} (hr : 0 < r) + {M : (J → ℕ) → (J → ℕ) → ℂ} (hM : Balance r M) (p : J → ℕ) : + M p p = (r/(r+1))^(∑ j, p j) • M 0 0 := by + have hall (m : ℕ) : ∀ p : J → ℕ, (∑ j, p j) = m → + M p p = (r/(r+1))^m • M 0 0 := by + induction m using Nat.strong_induction_on with + | h m ih => + intro p hp + by_cases hzero : p = 0 + · subst p + simp at hp + subst m + simp + · obtain ⟨j, hj⟩ := Function.ne_iff.mp hzero + change p j ≠ 0 at hj + have hj0 : 0 < p j := Nat.pos_of_ne_zero hj + have hsum := lower_sum hj0 + rw [hp] at hsum + rw [diagonal_step hr hM hj0, ih (∑ k, lower p j k) (by omega) (lower p j) rfl, + smul_smul, ← pow_succ'] + rw [hsum] + exact hall _ p rfl + +end + +theorem thermalWeight_eq (n : ℕ) (r : ℝ) (p : Fin n → ℕ) : + QuantumTrace.thermalWeight n r p = (r+1)⁻¹^n * (r/(r+1))^(∑ j, p j) := by + simp [QuantumTrace.thermalWeight, Finset.prod_mul_distrib, Finset.prod_pow_eq_pow_sum] + +theorem unique_thermal_matrix (n : ℕ) {r : ℝ} (hr : 0 < r) + {M : (Fin n → ℕ) → (Fin n → ℕ) → ℂ} (hM : Balance r M) + (hstar : ∀ p b, M b p = conj (M p b)) + (htrace : HasSum (fun p => (M p p).re) 1) (p b : Fin n → ℕ) : + M p b = if p = b then (QuantumTrace.thermalWeight n r p : ℂ) else 0 := by + let c : ℂ := (r+1)^n • M 0 0 + have hr1 : r+1 ≠ 0 := by positivity + have hc0 : c.im = 0 := by + have he := congrArg Complex.im (hstar 0 0) + dsimp [c] + simp only [Complex.conj_im] at he + simp only [Complex.mul_im, Complex.ofReal_re, Complex.ofReal_im, + zero_mul, add_zero] + have hz : (M 0 0).im = 0 := by linarith + rw [hz, mul_zero] + have hf (a : Fin n → ℕ) : M a a = QuantumTrace.thermalWeight n r a • c := by + have hw : QuantumTrace.thermalWeight n r a * (r+1)^n = + (r/(r+1))^(∑ j, a j) := by + rw [thermalWeight_eq n r a, inv_pow] + field_simp + calc + M a a = (r/(r+1))^(∑ j, a j) • M 0 0 := diagonal_formula hr hM a + _ = (QuantumTrace.thermalWeight n r a * (r+1)^n) • M 0 0 := by rw [hw] + _ = QuantumTrace.thermalWeight n r a • c := (smul_smul _ _ _).symm + have hs := ((QuantumTrace.hasSum_thermalWeight n hr).mul_right c.re) + have hc1 : c.re = 1 := by + have hefun : (fun a : Fin n → ℕ => (M a a).re) = + (fun a => QuantumTrace.thermalWeight n r a * c.re) := by + funext a + rw [hf] + simp + rw [hefun] at htrace + simpa only [one_mul] using hs.unique htrace + have hc : c = 1 := Complex.ext hc1 hc0 + by_cases he : p = b + · subst b + rw [ite_eq_left rfl, hf, hc] + simp + · rw [ite_eq_right he] + exact off_diagonal_zero hr hM hstar he + +end ThermalRecurrence + +namespace EntropyPhotonNumber +open Filter Topology Annihilation WeightedGenerator ThermalMetric +variable {n : ℕ} + +theorem entry_tendsto {ρ : ℕ → State n} {σ : State n} + (he : Tendsto (fun m => (ρ m).op) atTop (𝓝 σ.op)) (a b : NumberIndex n) : + Tendsto (fun m => entry (ρ m).op a b) atTop (𝓝 (entry σ.op a b)) := + tendsto_const_nhds.inner + (((ContinuousLinearMap.apply ℂ (Fock n) (numberKet b)).continuous.tendsto _).comp he) + +theorem state_entry_star (ρ : State n) (a b : NumberIndex n) : + entry ρ.op b a=conj (entry ρ.op a b) := by + change inner ℂ (numberKet b) (ρ.op (numberKet a))= _ + calc + _ = inner ℂ (ρ.op (numberKet b)) (numberKet a) := + (ρ.positive.isSymmetric (numberKet b) (numberKet a)).symm + _ = _ := (inner_conj_symm _ _).symm + +theorem weakDefect_tendsto {ρ : ℕ → State n} {k : ℕ → ℝ} + (G : ∀ m, GibbsData n (k m) (ρ m)) (hk : ∀ m, 0 ‖(G m).defect (hk m) t ht j‖) atTop (𝓝 0)) + (Z : Fock n →L[ℂ] Fock n) : + Tendsto (fun m => weakDefect t (G m).spectralColumns j ((G m).annihilationMean j) Z) + atTop (𝓝 0) := by + have hsq : Tendsto (fun m => ‖weakDefect t (G m).spectralColumns j + ((G m).annihilationMean j) Z‖^2) atTop (𝓝 0) := by + exact squeeze_zero (fun _ => sq_nonneg _) + (fun m => (G m).weakDefect_bound (hk m) t ht j Z) + (by simpa only [zero_pow (by decide : 2≠0), zero_mul] using + (hq.pow 2).mul_const ((h t/2*(2*t+1))*‖Z‖^2)) + apply tendsto_zero_iff_norm_tendsto_zero.mpr + have hh := Real.continuous_sqrt.continuousAt.tendsto.comp hsq + simpa only [Function.comp_def, Real.sqrt_sq (norm_nonneg _), Real.sqrt_zero] using hh + +theorem thermal_limit_entries {ρ : ℕ → State n} {k : ℕ → ℝ} {σ : State n} + (G : ∀ m, GibbsData n (k m) (ρ m)) (hk : ∀ m, 0 (ρ m).op) atTop (𝓝 σ.op)) + (hμ : ∀ j, Tendsto (fun m => (G m).annihilationMean j) atTop (𝓝 0)) + (hq : ∀ j, Tendsto (fun m => ‖(G m).defect (hk m) t ht j‖) atTop (𝓝 0)) + (p b : NumberIndex n) : + entry σ.op p b = if p=b then (QuantumTrace.thermalWeight n t p:ℂ) else 0 := by + have hz (j : Fin n) (a b : NumberIndex n) : + (t+1:ℂ)*(Real.sqrt ((a j:ℝ)+1):ℂ)*entry σ.op b (up j a)- + (t:ℂ)*(Real.sqrt (b j:ℝ):ℂ)*entry σ.op (down j b) a=0 := by + have hl := weakDefect_tendsto G hk t ht j (hq j) (numberMatrixUnit a b) + simp only [(G _).weakDefect_numberMatrixUnit] at hl + have hr := (((entry_tendsto he b (up j a)).const_mul + ((t+1:ℂ)*(Real.sqrt ((a j:ℝ)+1):ℂ))).sub + ((entry_tendsto he (down j b) a).const_mul ((t:ℂ)*(Real.sqrt (b j:ℝ):ℂ)))).sub + ((Complex.continuous_conj.tendsto 0 |>.comp (hμ j)).mul (entry_tendsto he b a)) + have hh := tendsto_nhds_unique hr hl + simpa only [map_zero, zero_mul, sub_zero] using hh + have hb : ThermalRecurrence.Balance t (entry σ.op) := by + intro j p b hp + have hh := congrArg conj (hz j (down j p) b) + have hdown : (down j p j:ℝ)+1=p j := by + simp only [down, Function.update_self] + exact_mod_cast Nat.sub_add_cancel hp + have hlow (a : NumberIndex n) : ThermalRecurrence.lower a j=down j a := rfl + simp only [map_sub, map_mul, map_add, map_one, Complex.conj_ofReal, map_zero, + ← state_entry_star, up_down j p hp, hdown] at hh + simpa only [hlow, Complex.real_smul, Complex.ofReal_mul, Complex.ofReal_add, + Complex.ofReal_one, mul_assoc] using sub_eq_zero.mp hh + exact ThermalRecurrence.unique_thermal_matrix n ht hb (state_entry_star σ) σ.trace_one p b +end EntropyPhotonNumber + +end + +open scoped BigOperators ComplexConjugate Topology + +namespace EntropyPhotonNumber + +section +open QuantumTrace Annihilation BeamLadder + +theorem thermalState_energy (n : ℕ) (r : ℝ) (hr : 0 (∑ j, (k j:ℝ))*thermalWeight n r k) := by + simpa only [FiniteEnergy,thermalState,diagonalState_diagonal,totalNumber,Nat.cast_sum] using + thermalState_finiteEnergy n r hr + have hs := tsum_thermal_crossEntropy (hasSum_thermalWeight n hr) hE hr + have he : (∑' k : NumberIndex n, (∑ j, (k j:ℝ))*thermalWeight n r k)=(n:ℝ)*r := by + simpa only [energy,thermalState,diagonalState_diagonal,totalNumber,Nat.cast_sum] using + thermalState_energy n r hr + rw [he] at hs + rw [thermalState,diagonalState_entropy] + have hh : (∑' k : NumberIndex n, Real.negMulLog (thermalWeight n r k))= + ∑' k : NumberIndex n, thermalWeight n r k*(-Real.log (thermalWeight n r k)) := by + apply tsum_congr + intro k + simp only [Real.negMulLog_def] + ring + rw [hh,hs] + unfold g + rw [Real.log_div (by linarith : r+1≠0) hr.ne'] + ring + +theorem thermal_beamOutput {n : ℕ} (η a b : ℝ) (hη : η∈Set.Icc 0 1) + (ha : 0 (ρ (f m)).op) atTop (𝓝 α.op) ∧ + Tendsto (fun m => (σ (f m)).op) atTop (𝓝 β.op) := by + have hc := (energySet_isCompact (numberBasis n) E).prod (energySet_isCompact (numberBasis n) E) + obtain ⟨p,hp,f,hf,hlim⟩ := hc.tendsto_subseq (fun m => + (show ((ρ m).op,(σ m).op)∈energySet (numberBasis n) E ×ˢ energySet (numberBasis n) E from + ⟨op_mem_energySet (hρ m) (hbρ m),op_mem_energySet (hσ m) (hbσ m)⟩)) + let α : State n := ⟨p.1,hp.1.1,by simpa only [numberBasis_apply,entry] using hp.1.2.1⟩ + let β : State n := ⟨p.2,hp.2.1,by simpa only [numberBasis_apply,entry] using hp.2.2.1⟩ + refine ⟨α,β,?_,?_,?_,?_,f,hf,?_,?_⟩ + · simpa only [FiniteEnergy,totalNumber,Nat.cast_sum,entry,numberBasis_apply,α] using hp.1.2.2.1 + · simpa only [FiniteEnergy,totalNumber,Nat.cast_sum,entry,numberBasis_apply,β] using hp.2.2.2.1 + · simpa only [energy,totalNumber,Nat.cast_sum,entry,numberBasis_apply,α] using hp.1.2.2.2 + · simpa only [energy,totalNumber,Nat.cast_sum,entry,numberBasis_apply,β] using hp.2.2.2.2 + · simpa only [Function.comp_def,α] using (continuous_fst.tendsto p).comp hlim + · simpa only [Function.comp_def,β] using (continuous_snd.tendsto p).comp hlim + +theorem thermal_limit_state {n : ℕ} {ρ : ℕ → State n} {k : ℕ → ℝ} {σ : State n} + (G : ∀ m, GibbsData n (k m) (ρ m)) (hk : ∀ m, 0 (ρ m).op) atTop (𝓝 σ.op)) + (hμ : ∀ j, Tendsto (fun m => (G m).annihilationMean j) atTop (𝓝 0)) + (hq : ∀ j, Tendsto (fun m => ‖(G m).defect (hk m) t ht j‖) atTop (𝓝 0)) : + σ=thermalState n t ht := by + apply State.ext_op + apply entry_ext + intro p b + exact (thermal_limit_entries G hk t ht he hμ hq p b).trans + (Regularization.thermal_state_diagonal t ht p b).symm + +theorem component_tendsto_zero {n : ℕ} {v : ℕ → Fin n → ℝ} {B : ℕ → ℝ} + {w : ℝ} (hw : 0 v m j) atTop (𝓝 0) := by + have hsq : Tendsto (fun m => (v m j)^2) atTop (𝓝 0) := by + apply squeeze_zero (fun _ => sq_nonneg _) + (fun m => (show (v m j)^2≤B m/w from (le_div_iff₀ hw).mpr ?_)) + (by simpa only [zero_div] using hB.div_const w) + have hh := Finset.single_le_sum (fun i (_hi : i∈(Finset.univ : Finset (Fin n))) => sq_nonneg (v m i)) + (Finset.mem_univ j) + nlinarith [mul_le_mul_of_nonneg_left hh hw.le,hb m] + simpa only [Function.comp_def,Real.sqrt_sq (hv _ _),Real.sqrt_zero] using + Real.continuous_sqrt.continuousAt.tendsto.comp hsq + +theorem weighted_pair_components {w u a b c d B : ℝ} (hw : 0≤w) (hu : 0≤u) + (ha : 0≤a) (hb : 0≤b) (hc : 0≤c) (hd : 0≤d) + (hh : w*(a+b)+u*(c+d)≤B) : w*a≤B ∧ w*b≤B ∧ u*c≤B ∧ u*d≤B := by + have hwa := mul_nonneg hw ha + have hwb := mul_nonneg hw hb + have huc := mul_nonneg hu hc + have hud := mul_nonneg hu hd + simp only [mul_add] at hh + constructor + · linarith + constructor + · linarith + constructor <;> linarith + +theorem four_components_tendsto_zero {n : ℕ} {q1 q2 μ1 μ2 : ℕ → Fin n → ℝ} + {w1 w2 : ℝ} (hw1 : 0 q1 m j) atTop (𝓝 0)) ∧ + (∀ j, Tendsto (fun m => q2 m j) atTop (𝓝 0)) ∧ + (∀ j, Tendsto (fun m => μ1 m j) atTop (𝓝 0)) ∧ + (∀ j, Tendsto (fun m => μ2 m j) atTop (𝓝 0)) := by + have hn (v : ℕ → Fin n → ℝ) (m) : 0≤∑ j, (v m j)^2 := + Finset.sum_nonneg (fun _j _ => sq_nonneg _) + have hh (m) := weighted_pair_components hw1.le hw2.le + (hn q1 m) (hn μ1 m) (hn q2 m) (hn μ2 m) (hb m) + exact ⟨component_tendsto_zero hw1 hq1 (fun m => (hh m).1) hB, + component_tendsto_zero hw2 hq2 (fun m => (hh m).2.2.1) hB, + component_tendsto_zero hw1 hμ1 (fun m => (hh m).2.1) hB, + component_tendsto_zero hw2 hμ2 (fun m => (hh m).2.2.2) hB⟩ + +theorem pair_thermal_subsequence {n : ℕ} {ρ σ : ℕ → State n} {k1 k2 : ℕ → ℝ} + (G1 : ∀ m, GibbsData n (k1 m) (ρ m)) (G2 : ∀ m, GibbsData n (k2 m) (σ m)) + (hk1 : ∀ m, 0 ‖(G1 m).defect (hk1 m) r1 hr1 j‖) atTop (𝓝 0)) + (hq2 : ∀ j, Tendsto (fun m => ‖(G2 m).defect (hk2 m) r2 hr2 j‖) atTop (𝓝 0)) + (hμ1 : ∀ j, Tendsto (fun m => ‖(G1 m).annihilationMean j‖) atTop (𝓝 0)) + (hμ2 : ∀ j, Tendsto (fun m => ‖(G2 m).annihilationMean j‖) atTop (𝓝 0)) + (hρ : ∀ m, FiniteEnergy (ρ m)) (hσ : ∀ m, FiniteEnergy (σ m)) + {E : ℝ} (hbρ : ∀ m, energy (ρ m)≤E) (hbσ : ∀ m, energy (σ m)≤E) : + ∃ f : ℕ → ℕ, StrictMono f ∧ + Tendsto (fun m => (ρ (f m)).op) atTop (𝓝 (thermalState n r1 hr1).op) ∧ + Tendsto (fun m => (σ (f m)).op) atTop (𝓝 (thermalState n r2 hr2).op) := by + obtain ⟨α,β,_hα,_hβ,_hbα,_hbβ,f,hf,hlim1,hlim2⟩ := pair_energy_subsequence hρ hσ hbρ hbσ + have he1 := thermal_limit_state (fun m => G1 (f m)) (fun m => hk1 (f m)) r1 hr1 hlim1 + (fun j => (tendsto_zero_iff_norm_tendsto_zero.mpr (hμ1 j)).comp hf.tendsto_atTop) + (fun j => (hq1 j).comp hf.tendsto_atTop) + have he2 := thermal_limit_state (fun m => G2 (f m)) (fun m => hk2 (f m)) r2 hr2 hlim2 + (fun j => (tendsto_zero_iff_norm_tendsto_zero.mpr (hμ2 j)).comp hf.tendsto_atTop) + (fun j => (hq2 j).comp hf.tendsto_atTop) + exact ⟨f,hf,by simpa only [he1] using hlim1,by simpa only [he2] using hlim2⟩ + +namespace ThermalSetup +variable {n : ℕ} (P : ThermalSetup) +theorem minimum_thermal_subsequence {ζ : ℕ → ℝ} (hζ : ∀ m, 0<ζ m) + (hzlim : Tendsto ζ atTop (𝓝 0)) {ρ σ : ℕ → State n} + (h4ρ : ∀ m, FiniteMoment 4 (ρ m)) (h4σ : ∀ m, FiniteMoment 4 (σ m)) + (hmin : ∀ m ρ' σ', FiniteMoment 4 ρ' → FiniteMoment 4 σ' → + (P.reg n (ζ m) (hζ m)).objective (ρ m) (σ m)≤(P.reg n (ζ m) (hζ m)).objective ρ' σ') + {E : ℝ} (hbρ : ∀ m, energy (ρ m)≤E) (hbσ : ∀ m, energy (σ m)≤E) : + ∃ f : ℕ → ℕ, StrictMono f ∧ + Tendsto (fun m => (ρ (f m)).op) atTop (𝓝 (thermalState n P.r1 P.hr1).op) ∧ + Tendsto (fun m => (σ (f m)).op) atTop (𝓝 (thermalState n P.r2 P.hr2).op) := by + obtain ⟨C,_hC,hdec⟩ := P.uniform_minimum_decay (n:=n) + choose G1 G2 hG using fun m => hdec (ζ m) (hζ m) (ρ m) (σ m) (h4ρ m) (h4σ m) (hmin m) + let k1 := fun m => ζ m/((1+P.ε)*P.w1/h P.r1) + let k2 := fun m => ζ m/((1+P.ε)*P.w2/h P.r2) + have hk1 (m) : 0 C*ζ m) atTop (𝓝 0) := by + simpa only [mul_zero] using hzlim.const_mul C + obtain ⟨hq1,hq2,hμ1,hμ2⟩ := four_components_tendsto_zero (q1:=fun m j => ‖(G1 m).defect (hk1 m) P.r1 P.hr1 j‖) + (q2:=fun m j => ‖(G2 m).defect (hk2 m) P.r2 P.hr2 j‖) + (μ1:=fun m j => ‖(G1 m).annihilationMean j‖) + (μ2:=fun m j => ‖(G2 m).annihilationMean j‖) P.w1_pos P.w2_pos + (fun m j => norm_nonneg ((G1 m).defect (hk1 m) P.r1 P.hr1 j)) + (fun m j => norm_nonneg ((G2 m).defect (hk2 m) P.r2 P.hr2 j)) + (fun m j => norm_nonneg ((G1 m).annihilationMean j)) + (fun m j => norm_nonneg ((G2 m).annihilationMean j)) hG hB + exact pair_thermal_subsequence G1 G2 hk1 hk2 P.r1 P.r2 P.hr1 P.hr2 hq1 hq2 hμ1 hμ2 + (fun m => finiteMoment_finiteEnergy (by decide : 1≤4) (h4ρ m)) + (fun m => finiteMoment_finiteEnergy (by decide : 1≤4) (h4σ m)) hbρ hbσ +end ThermalSetup +end + +open QuantumTrace ThermalMetric Filter + +def thermalRelative {n : ℕ} (r : ℝ) (ρ : State n) : ℝ := + n*Real.log (r+1)+h r*energy ρ-entropy ρ + +theorem thermalRelative_nonneg {n : ℕ} {r : ℝ} (hr : 0 (ρ a).op) l (𝓝 (thermalState n P.r1 P.hr1).op)) + (hlimσ : Tendsto (fun a => (σ a).op) l (𝓝 (thermalState n P.r2 P.hr2).op)) : + Tendsto (fun a => P.entropyPart (ρ a) (σ a)) l (𝓝 0) := by + let E' := max E (max ((n:ℝ)*P.r1) ((n:ℝ)*P.r2)) + have hb1 (a) : energy (ρ a)≤E' := (hbρ a).trans (le_max_left _ _) + have hb2 (a) : energy (σ a)≤E' := (hbσ a).trans (le_max_left _ _) + have hc1 : energy (thermalState n P.r1 P.hr1)≤E' := by + rw [thermalState_energy]; exact (le_max_left _ _).trans (le_max_right _ _) + have hc2 : energy (thermalState n P.r2 P.hr2)≤E' := by + rw [thermalState_energy]; exact (le_max_right _ _).trans (le_max_right _ _) + have h1 := tendsto_entropy hρ (thermalState_finiteEnergy n _ P.hr1) hb1 hc1 hlimρ + have h2 := tendsto_entropy hσ (thermalState_finiteEnergy n _ P.hr2) hb2 hc2 hlimσ + let R := P.reg n 1 zero_lt_one + have h0 : Tendsto (fun a => entropy (P.out (ρ a) (σ a))) l + (𝓝 (entropy (P.out (thermalState n P.r1 P.hr1) (thermalState n P.r2 P.hr2)))) := by + apply tendsto_entropy (E:=E'+E'+energy R.τD+energy R.τ0) + (fun a => regularizedOutput_finiteEnergy R.η R.δ R.κ R.hη R.hδ R.hκ R.finiteD R.finite0 (hρ a) (hσ a)) + (regularizedOutput_finiteEnergy R.η R.δ R.κ R.hη R.hδ R.hκ R.finiteD R.finite0 + (thermalState_finiteEnergy n _ P.hr1) (thermalState_finiteEnergy n _ P.hr2)) + · intro a + exact (regularizedOutput_energy_bound R.η R.δ R.κ R.hη R.hδ R.hκ R.finiteD R.finite0 (hρ a) (hσ a)).trans + (by linarith [hb1 a,hb2 a]) + · exact (regularizedOutput_energy_bound R.η R.δ R.κ R.hη R.hδ R.hκ R.finiteD R.finite0 + (thermalState_finiteEnergy n _ P.hr1) (thermalState_finiteEnergy n _ P.hr2)).trans + (by linarith) + · exact tendsto_regularizedOutput R.η R.δ R.κ R.hη R.hδ R.hκ R.τD R.τ0 hlimρ hlimσ + have he := (((h0.sub_const (n*g P.r0)).div_const (h P.r0)).sub + ((h1.sub_const (n*g P.r1)).const_mul P.w1 |>.div_const (h P.r1))).sub + ((h2.sub_const (n*g P.r2)).const_mul P.w2 |>.div_const (h P.r2)) + simpa only [out,P.output_thermal,thermalState_entropy,sub_self,mul_zero,zero_div,entropyPart] using he + +theorem base_nonnegative {ρw σw : State n} (hw1 : FiniteMoment 4 ρw) (hw2 : FiniteMoment 4 σw) : + 0≤P.entropyPart ρw σw+P.penalty ρw σw := by + let ζ : ℕ → ℝ := fun m => 1/((m:ℝ)+1) + have hζ (m) : 0<ζ m := by dsimp [ζ]; positivity + have hζ1 (m) : ζ m≤1 := by + dsimp [ζ] + exact (div_le_one (by positivity)).mpr (by linarith [Nat.cast_nonneg (α := ℝ) m]) + have hzlim : Tendsto ζ atTop (𝓝 0) := tendsto_one_div_add_atTop_nhds_zero_nat + choose ρ σ h4ρ h4σ hminw hmin using fun m => (P.reg n (ζ m) (hζ m)).exists_minimum ρw σw hw1 hw2 + have hρ (m) := finiteMoment_finiteEnergy (by decide : 1≤4) (h4ρ m) + have hσ (m) := finiteMoment_finiteEnergy (by decide : 1≤4) (h4σ m) + let R := P.reg n 1 zero_lt_one + let C := R.objective ρw σw + have hbmin (m) : (P.reg n (ζ m) (hζ m)).objective (ρ m) (σ m)≤C := by + apply (hminw m).trans + have hzm := mul_le_mul_of_nonneg_right (hζ1 m) + (add_nonneg (numberMoment_nonneg 4 ρw) (numberMoment_nonneg 4 σw)) + have h1 := P.objective_offset (ζ m) (hζ m) ρw σw + have h2 := P.objective_offset 1 zero_lt_one ρw σw + dsimp [C,R] + linarith + let E := max (2*(C+R.entropyConstant)/R.b1) (2*(C+R.entropyConstant)/R.b2) + have hbρ (m) : energy (ρ m)≤E := by + have hh := (P.reg n (ζ m) (hζ m)).sublevel_bounds C (ρ m) (σ m) (hρ m) (hσ m) (hbmin m) + exact hh.2.1.trans (le_max_left _ _) + have hbσ (m) : energy (σ m)≤E := by + have hh := (P.reg n (ζ m) (hζ m)).sublevel_bounds C (ρ m) (σ m) (hρ m) (hσ m) (hbmin m) + exact hh.2.2.1.trans (le_max_right _ _) + obtain ⟨f,hf,hlim1,hlim2⟩ := P.minimum_thermal_subsequence hζ hzlim h4ρ h4σ hmin hbρ hbσ + have he := P.entropyPart_tendsto (fun m => hρ (f m)) (fun m => hσ (f m)) + (fun m => hbρ (f m)) (fun m => hbσ (f m)) hlim1 hlim2 + have hu : Tendsto (fun m => P.entropyPart ρw σw+P.penalty ρw σw+ + ζ (f m)*(numberMoment 4 ρw+numberMoment 4 σw)) atTop + (𝓝 (P.entropyPart ρw σw+P.penalty ρw σw)) := by + simpa only [zero_mul,add_zero,Function.comp_apply] using + ((hzlim.comp hf.tendsto_atTop).mul_const (numberMoment 4 ρw+numberMoment 4 σw)).const_add + (P.entropyPart ρw σw+P.penalty ρw σw) + apply le_of_tendsto_of_tendsto he hu + filter_upwards [] with m + have hp := P.penalty_nonneg (hρ (f m)) (hσ (f m)) + have hm := mul_nonneg (hζ (f m)).le + (add_nonneg (numberMoment_nonneg 4 (ρ (f m))) (numberMoment_nonneg 4 (σ (f m)))) + have h1 := P.objective_offset (ζ (f m)) (hζ (f m)) (ρ (f m)) (σ (f m)) + have h2 := P.objective_offset (ζ (f m)) (hζ (f m)) ρw σw + linarith [hminw (f m)] +end ThermalSetup +end EntropyPhotonNumber + +end + +end OAI diff --git a/lean/OAI/InformationTheory/PhotonNumber/ThermalMetric.lean b/lean/OAI/InformationTheory/PhotonNumber/ThermalMetric.lean new file mode 100644 index 0000000000000000000000000000000000000000..6897fecd425f2367bdf6d38dc3c2923a6174b33b --- /dev/null +++ b/lean/OAI/InformationTheory/PhotonNumber/ThermalMetric.lean @@ -0,0 +1,1043 @@ +import OAI.InformationTheory.PhotonNumber.Gibbs +import OAI.Analysis.DiagonalForms + +namespace OAI + +noncomputable section + +open scoped BigOperators ComplexConjugate ENNReal Topology +open MeasureTheory +open scoped ComplexConjugate +open scoped BigOperators ComplexConjugate + +namespace ThermalMetric + +section +open EntropyPhotonNumber DiagonalForms.System + +def h (r : ℝ) : ℝ := Real.log (r+1)-Real.log r + +theorem h_pos {r : ℝ} (hr : 0 nlinarith + +end + +section +open DiagonalForms.System + +theorem logMean_mul_log_sub {p q : ℝ} (hp : 0 a j*‖z j‖^2)) (ha : ∀ j, 0 ≤ a j) : + lp (fun _ : J => ℂ) 2 := by + refine ⟨fun j => (Real.sqrt (a j):ℂ)*z j, ?_⟩ + apply memℓp_gen + convert! hz using 1 + funext j + simp only [ENNReal.toReal_ofNat, Real.rpow_two, norm_mul, Complex.norm_real, + Real.norm_eq_abs, mul_pow, sq_abs, Real.sq_sqrt (ha j)] + +@[simp] theorem weightedVector_apply (a : J → ℝ) (z : J → ℂ) + (hz : Summable (fun j => a j*‖z j‖^2)) (ha : ∀ j, 0 ≤ a j) (j : J) : + weightedVector a z hz ha j=(Real.sqrt (a j):ℂ)*z j := rfl + +theorem weightedVector_norm_sq (a : J → ℝ) (z : J → ℂ) + (hz : Summable (fun j => a j*‖z j‖^2)) (ha : ∀ j, 0 ≤ a j) : + ‖weightedVector a z hz ha‖^2=∑' j, a j*‖z j‖^2 := by + have hh := lp.hasSum_norm (p := 2) (by norm_num : 0 < (2:ENNReal).toReal) (weightedVector a z hz ha) + simpa only [ENNReal.toReal_ofNat, Real.rpow_two, weightedVector_apply, norm_mul, + Complex.norm_real, Real.norm_eq_abs, mul_pow, sq_abs, Real.sq_sqrt (ha _)] using hh.tsum_eq.symm + +theorem defectVector_entry_norm (r p q : ℝ) (hr : 0 + (1-frequency r (p a.1) (p a.2))*defectCoefficient r (p a.1) (p a.2)*‖d a‖^2)) : + lp (fun _ : J × J => ℂ) 2 := by + refine ⟨fun a => ((defectCoefficient r (p a.1) (p a.2) / + Real.sqrt (metricCoefficient r (p a.1) (p a.2)):ℝ):ℂ)*d a, ?_⟩ + apply memℓp_gen + simpa only [ENNReal.toReal_ofNat, Real.rpow_two, + defectVector_entry_norm r _ _ hr (hp _) (hp _)] using hd + +@[simp] theorem defectVector_apply (r : ℝ) (hr : 0 metricCoefficient r (p a.1) (p a.2)*‖z a‖^2)) : + HasSum (fun a : J × J => (defectCoefficient r (p a.1) (p a.2):ℂ)*conj (d a)*z a) + (inner ℂ (defectVector r hr p hp d hd) + (weightedVector (fun a => metricCoefficient r (p a.1) (p a.2)) z hz + (fun a => (metricCoefficient_pos hr (hp a.1) (hp a.2)).le))) := by + have hh := lp.hasSum_inner (𝕜 := ℂ) (defectVector r hr p hp d hd) + (weightedVector (fun a => metricCoefficient r (p a.1) (p a.2)) z hz + (fun a => (metricCoefficient_pos hr (hp a.1) (hp a.2)).le)) + convert! hh using 1 + ext a + simp only [defectVector_apply, weightedVector_apply, RCLike.inner_apply, + map_mul, Complex.ofReal_div, map_div₀, Complex.conj_ofReal] + have hn : (Real.sqrt (metricCoefficient r (p a.1) (p a.2)):ℂ)≠0 := by + exact_mod_cast (Real.sqrt_pos.mpr (metricCoefficient_pos hr (hp a.1) (hp a.2))).ne' + field_simp + +end + +section +variable {J : Type*} + +def defectFunctional (r : ℝ) (hr : 0 + (1-frequency r (p a.1) (p a.2))*defectCoefficient r (p a.1) (p a.2)*‖d a‖^2)) : + lp (fun _ : J × J => ℂ) 2 →L[ℂ] ℂ := + innerSL ℂ (defectVector r hr p hp d hd) + +theorem defectFunctional_norm_sq (r : ℝ) (hr : 0 ℂ) 2)) + (hv : defectVector r hr p hp d hd ∈ P) : + ‖(defectFunctional r hr p hp d hd).comp P.subtypeL‖= + ‖defectFunctional r hr p hp d hd‖ := by + have he : (defectFunctional r hr p hp d hd).comp P.subtypeL = + innerSL ℂ (⟨defectVector r hr p hp d hd,hv⟩ : P) := by + ext z + rfl + rw [he, innerSL_apply_norm, defectFunctional, innerSL_apply_norm] + rfl +end + +open scoped ComplexConjugate +variable {J : Type*} + +@[simp] theorem metricCoefficient_self {r p : ℝ} (hr : 0 if a.1=a.2 then f a.1 else 0) s := by + have hi : Function.Injective (fun j : J => (j,j)) := fun _ _ he => (Prod.mk.inj he).1 + apply (hi.hasSum_iff (fun a ha => ?_)).mp + · simpa only [Function.comp_def, ↓reduceIte] using hf + · have hn : a.1≠a.2 := by + intro he + apply ha + exact ⟨a.1, Prod.ext rfl he⟩ + simp only [hn, ↓reduceIte] + +theorem summable_diagonal [DecidableEq J] {f : J → ℝ} (hf : Summable f) : + Summable (fun a : J × J => if a.1=a.2 then f a.1 else 0) := by + have hi : Function.Injective (fun j : J => (j,j)) := fun _ _ he => (Prod.mk.inj he).1 + apply (hi.summable_iff (fun a ha => ?_)).mp + · simpa only [Function.comp_def, ↓reduceIte] using hf + · have hn : a.1≠a.2 := by + intro he + exact ha ⟨a.1, Prod.ext rfl he⟩ + simp only [hn, ↓reduceIte] + +def identityEntry (a : J × J) : ℂ := by + classical + exact if a.1=a.2 then 1 else 0 + +theorem identityEntry_summable (r : ℝ) (hr : 0 metricCoefficient r (p a.1) (p a.2)*‖identityEntry a‖^2) := by + classical + convert! summable_diagonal hs using 1 + ext a + by_cases he : a.1=a.2 + · simp only [identityEntry, he, ↓reduceIte, norm_one, one_pow, mul_one, + metricCoefficient_self hr (hp _)] + · simp only [identityEntry, he, ↓reduceIte, norm_zero, ne_eq, OfNat.ofNat_ne_zero, + not_false_eq_true, zero_pow, mul_zero] + +def identityVector (r : ℝ) (hr : 0 ℂ) 2 := + weightedVector (fun a => metricCoefficient r (p a.1) (p a.2)) identityEntry + (identityEntry_summable r hr p hp hs) (fun _a => (metricCoefficient_pos hr (hp _) (hp _)).le) + +def centeredSpace (r : ℝ) (hr : 0 ℂ) 2) := + (innerSL ℂ (identityVector r hr p hp hs)).ker + +theorem defectVector_mem_centeredSpace (r : ℝ) (hr : 0 (p j:ℂ)*d (j,j)) 0) : + defectVector r hr p hp d hd ∈ centeredSpace r hr p hp hs := by + classical + have ht := hasSum_diagonal (Complex.hasSum_conj'.mpr hc) + have hz : HasSum (fun a : J × J => (defectCoefficient r (p a.1) (p a.2):ℂ)* + conj (d a)*identityEntry a) 0 := by + convert! ht using 1 + · ext a + by_cases he : a.1=a.2 + · obtain ⟨l,q⟩ := a + dsimp only [Prod.fst, Prod.snd] at he ⊢ + subst q + simp only [identityEntry, ↓reduceIte, mul_one, map_mul, Complex.conj_ofReal] + congr 1 + unfold defectCoefficient + push_cast + ring + · simp only [identityEntry, he, ↓reduceIte, mul_zero] + · simp + have hh := defectVector_pairing r hr p hp d hd identityEntry (identityEntry_summable r hr p hp hs) + have he : inner ℂ (defectVector r hr p hp d hd) (identityVector r hr p hp hs)=0 := hh.unique hz + change inner ℂ (identityVector r hr p hp hs) (defectVector r hr p hp d hd)=0 + rw [← inner_conj_symm, he, map_zero] + +theorem centered_defect_norm_sq (r : ℝ) (hr : 0 (p j:ℂ)*d (j,j)) 0) : + ‖(defectFunctional r hr p hp d hd).comp (centeredSpace r hr p hp hs).subtypeL‖^2= + ∑' a : J × J, (1-frequency r (p a.1) (p a.2))*defectCoefficient r (p a.1) (p a.2)*‖d a‖^2 := by + rw [defectFunctional_restrict_norm r hr p hp d hd _ + (defectVector_mem_centeredSpace r hr p hp hs d hd hc), defectFunctional_norm_sq] + +theorem defect_series_summable (t : ℝ) (p : J → ℝ) (c : J → ℝ) + (hc : ∀ j, c j = -Real.log (p j)) (d : J × J → ℂ) + (h₁ : Summable (fun a : J × J => p a.2*‖d a‖^2)) + (h₂ : Summable (fun a : J × J => p a.1*‖d a‖^2)) + (h₃ : Summable (fun a : J × J => c a.1*p a.2*‖d a‖^2)) + (h₄ : Summable (fun a : J × J => c a.2*p a.2*‖d a‖^2)) + (h₅ : Summable (fun a : J × J => c a.1*p a.1*‖d a‖^2)) + (h₆ : Summable (fun a : J × J => c a.2*p a.1*‖d a‖^2)) : + Summable (fun a : J × J => (1-frequency t (p a.1) (p a.2))* + defectCoefficient t (p a.1) (p a.2)*‖d a‖^2) := by + convert! ((h₁.mul_left (t+1)).sub (h₂.mul_left t)).add + ((((h₃.sub h₄).mul_left (t+1)).sub ((h₅.sub h₆).mul_left t)).div_const (h t)) using 1 + ext a + simp only [hc, frequency, defectCoefficient] + ring + +theorem coefficient_series_summable (t : ℝ) (p : J → ℝ) (d : J × J → ℂ) + (h₁ : Summable (fun a : J × J => p a.2*‖d a‖^2)) + (h₂ : Summable (fun a : J × J => p a.1*‖d a‖^2)) : + Summable (fun a : J × J => defectCoefficient t (p a.1) (p a.2)*‖d a‖^2) := by + convert! (h₁.mul_left (t+1)).sub (h₂.mul_left t) using 1 + ext a + simp only [defectCoefficient] + ring + +theorem production_series_subtraction (t : ℝ) (p : J → ℝ) (c : J → ℝ) + (hc : ∀ j, c j = -Real.log (p j)) (d : J × J → ℂ) + (hd : Summable (fun a : J × J => (1-frequency t (p a.1) (p a.2))* + defectCoefficient t (p a.1) (p a.2)*‖d a‖^2)) + (hk : Summable (fun a : J × J => defectCoefficient t (p a.1) (p a.2)*‖d a‖^2)) : + (∑' a : J × J, (c a.1-c a.2)*defectCoefficient t (p a.1) (p a.2)*‖d a‖^2)/h t = + (∑' a : J × J, (1-frequency t (p a.1) (p a.2))* + defectCoefficient t (p a.1) (p a.2)*‖d a‖^2)- + (∑' a : J × J, defectCoefficient t (p a.1) (p a.2)*‖d a‖^2) := by + rw [← tsum_div_const, ← hd.tsum_sub hk] + apply tsum_congr + intro a + simp only [hc, frequency] + ring + +theorem diagonal_mean_summable (p : J → ℝ) (hp : ∀ j, 0≤p j) (hs : Summable p) + (d : J × J → ℂ) (hd : Summable (fun a : J × J => p a.2*‖d a‖^2)) : + Summable (fun j => (p j:ℂ)*d (j,j)) := by + have hi : Function.Injective (fun j : J => (j,j)) := fun _ _ he => (Prod.mk.inj he).1 + have hh := hd.comp_injective hi + apply Summable.of_norm_bounded (hh.add hs) + intro j + simp only [norm_mul, Complex.norm_real, Real.norm_eq_abs, abs_of_nonneg (hp j)] + have hn : ‖d (j,j)‖≤‖d (j,j)‖^2+1 := by nlinarith [sq_nonneg (‖d (j,j)‖-1)] + simpa only [mul_add, mul_one, Function.comp_apply] using mul_le_mul_of_nonneg_left hn (hp j) + +def diagonalMean (p : J → ℝ) (d : J × J → ℂ) : ℂ := ∑' j, (p j:ℂ)*d (j,j) + +theorem diagonal_centering (p : J → ℝ) (hs : HasSum p 1) + (d : J × J → ℂ) (hd : Summable (fun j => (p j:ℂ)*d (j,j))) : + HasSum (fun j => (p j:ℂ)*(d (j,j)-diagonalMean p d)) 0 := by + have hh := hd.hasSum.sub ((Complex.hasSum_ofReal.mpr hs).mul_right (diagonalMean p d)) + simpa only [diagonalMean, Complex.ofReal_one, one_mul, sub_self, mul_sub] using hh + +end ThermalMetric + +namespace WeightedGenerator +open EntropyPhotonNumber Annihilation +open scoped ComplexConjugate BigOperators +variable {n : ℕ} {J : Type*} + +def centeredEntry (b : HilbertBasis J ℂ (Fock n)) (p : J → ℝ) (x : J → Fock n) + (j : Fin n) (μ : ℂ) (l r : J) : ℂ := by + classical + exact loweringEntry b p x j l r - if l=r then μ else 0 + +theorem nonlog_summable (b : HilbertBasis J ℂ (Fock n)) + (x : J → Fock n) (hx : Summable (fun r => ‖x r‖^2)) (j : Fin n) (u : Bool) : + Summable (fun a : J × J => ‖spectralGain b x j u a.1 a.2‖^2) := by + have hs := CrossEnsemble.applied_summable hx (unweightedGain j u ∘L inverseWeight 2) + have hh := CrossEnsemble.square_coordinates_summable b hs + simpa only [spectralGain, ContinuousLinearMap.comp_apply, Prod.swap] using hh.prod_symm + +theorem centered_weight_summable [DecidableEq J] (f : J × J → ℝ) (hf : ∀ a, 0 ≤ f a) + (d : J × J → ℂ) (hd : Summable (fun a => f a*‖d a‖^2)) + (hdiag : Summable (fun j => f (j,j))) (μ : ℂ) : + Summable (fun a : J × J => f a*‖d a-(if a.1=a.2 then μ else 0)‖^2) := by + classical + have ht : Summable (fun a : J × J => if a.1=a.2 then f a*‖μ‖^2 else 0) := by + apply (summable_prod_of_nonneg (by intro a; dsimp only; split_ifs; exact mul_nonneg (hf a) (sq_nonneg _); exact le_rfl)).mpr + refine ⟨?_, ?_⟩ + · intro l + have hh := (hasSum_ite_eq' l (f (l,l)*‖μ‖^2)).summable + convert! hh using 1 + ext q + by_cases h : l=q + · subst q; rfl + · simp only [h, ↓reduceIte] + · simpa only [tsum_ite_eq'] using hdiag.mul_right (‖μ‖^2) + apply Summable.of_nonneg_of_le (fun a => mul_nonneg (hf a) (sq_nonneg _)) _ + ((hd.mul_left 2).add (ht.mul_left 2)) + intro a + by_cases he : a.1=a.2 + · simp only [he, ↓reduceIte] + have hn := norm_sub_le (d a) μ + have hsq : ‖d a-μ‖^2 ≤ 2*‖d a‖^2+2*‖μ‖^2 := by + nlinarith [sq_nonneg (‖d a‖-‖μ‖), norm_nonneg (d a-μ), norm_nonneg (d a), norm_nonneg μ] + nlinarith [mul_le_mul_of_nonneg_left hsq (hf a)] + · simp only [he, ↓reduceIte, sub_zero, mul_zero, add_zero] + nlinarith [mul_nonneg (hf a) (sq_nonneg ‖d a‖)] + +theorem entropy_weight_summable (b : HilbertBasis J ℂ (Fock n)) + (p : J → ℝ) (hp : ∀ r, 0

‖x r‖^2)) + (hi : ∀ r, inverseWeight 3 (x r)=(Real.sqrt (p r):ℂ) • b r) + (S : Fock n →L[ℂ] Fock n) (c : J → ℝ) + (he : ∀ r, S (inverseWeight 1 (x r)) = (c r : ℂ) • inverseWeight 5 (x r)) : + Summable (fun r => c r*p r) := by + have hs := CrossEnsemble.applied_summable hx (inverseWeight 1) + have ht := (CrossEnsemble.pairing_summable hs hs S).hasSum.mapL Complex.reCLM + convert! ht.summable using 1 + ext r + simp only [Complex.reCLM_apply, he, inner_smul_right] + have hw : inner ℂ (inverseWeight 1 (x r)) (inverseWeight 5 (x r))= + inner ℂ (inverseWeight 3 (x r)) (inverseWeight 3 (x r)) := by + have h5 : inverseWeight 5 (x r)=inverseWeight 2 (inverseWeight 3 (x r)) := by + exact congrArg (fun T : Fock n →L[ℂ] Fock n => T (x r)) (inverseWeight_add 2 3) + rw [h5] + calc + _ = inner ℂ (inverseWeight 2 (inverseWeight 1 (x r))) (inverseWeight 3 (x r)) := + (ContinuousLinearMap.isSelfAdjoint_iff_isSymmetric.mp (inverseWeight_selfAdjoint 2) + (inverseWeight 1 (x r)) (inverseWeight 3 (x r))).symm + _ = _ := by + congr 1 + change (inverseWeight 2 ∘L inverseWeight 1) (x r)=_ + rw [← inverseWeight_add] + rw [hw, hi, inner_self_eq_norm_sq_to_K, norm_smul, b.orthonormal.norm_eq_one, mul_one, + Complex.norm_real, Real.norm_eq_abs, abs_of_nonneg (Real.sqrt_nonneg _)] + norm_cast + rw [Real.sq_sqrt (hp r).le] + simp + +theorem centered_six_sums (b : HilbertBasis J ℂ (Fock n)) + (p : J → ℝ) (hp : ∀ r, 0

‖x r‖^2)) + (hi : ∀ r, inverseWeight 3 (x r)=(Real.sqrt (p r):ℂ) • b r) + (S : Fock n →L[ℂ] Fock n) (hS : S.IsSymmetric) (c : J → ℝ) + (hc : ∀ l, 0 ≤ c l) + (hf : ∀ y, HasSum (fun l => c l*‖inner ℂ (b l) (inverseWeight 2 y)‖^2) + (inner ℂ y (S y)).re) + (he : ∀ r, S (inverseWeight 1 (x r)) = (c r : ℂ) • inverseWeight 5 (x r)) + (j : Fin n) (μ : ℂ) : + Summable (fun a : J × J => p a.2*‖centeredEntry b p x j μ a.1 a.2‖^2) ∧ + Summable (fun a : J × J => p a.1*‖centeredEntry b p x j μ a.1 a.2‖^2) ∧ + Summable (fun a : J × J => c a.1*p a.2*‖centeredEntry b p x j μ a.1 a.2‖^2) ∧ + Summable (fun a : J × J => c a.2*p a.2*‖centeredEntry b p x j μ a.1 a.2‖^2) ∧ + Summable (fun a : J × J => c a.1*p a.1*‖centeredEntry b p x j μ a.1 a.2‖^2) ∧ + Summable (fun a : J × J => c a.2*p a.1*‖centeredEntry b p x j μ a.1 a.2‖^2) := by + classical + have hec := entropy_weight_summable b p hp x hx hi S c he + have hd := nonlog_summable b x hx j false + have hu := (nonlog_summable b x hx j true).prod_symm + have hcd := crossed_log_summable b x hx S c hc hf j false + have hud := uncrossed_log_summable b x hx S hS c hc he j false + have hcu := (crossed_log_summable b x hx S c hc hf j true).prod_symm + have huu := (uncrossed_log_summable b x hx S hS c hc he j true).prod_symm + simp only [spectralGain_lowering_sq b p hp, spectralGain_raising_sq b p hp x hi, + Prod.swap, ← mul_assoc] at hd hu hcd hud hcu huu + refine ⟨?_, ?_, ?_, ?_, ?_, ?_⟩ + · exact centered_weight_summable (fun a => p a.2) (fun a => (hp a.2).le) + (fun a => loweringEntry b p x j a.1 a.2) hd hs μ + · exact centered_weight_summable (fun a => p a.1) (fun a => (hp a.1).le) + (fun a => loweringEntry b p x j a.1 a.2) hu hs μ + · exact centered_weight_summable (fun a => c a.1*p a.2) (fun a => mul_nonneg (hc _) (hp _).le) + (fun a => loweringEntry b p x j a.1 a.2) hcd hec μ + · exact centered_weight_summable (fun a => c a.2*p a.2) (fun a => mul_nonneg (hc _) (hp _).le) + (fun a => loweringEntry b p x j a.1 a.2) hud hec μ + · exact centered_weight_summable (fun a => c a.1*p a.1) (fun a => mul_nonneg (hc _) (hp _).le) + (fun a => loweringEntry b p x j a.1 a.2) huu hec μ + · exact centered_weight_summable (fun a => c a.2*p a.1) (fun a => mul_nonneg (hc _) (hp _).le) + (fun a => loweringEntry b p x j a.1 a.2) hcu hec μ + +end WeightedGenerator + +namespace Annihilation +open EntropyPhotonNumber +variable {n : ℕ} {J : Type*} + +theorem centered_canonical_norm (j : Fin n) (x : Fock n) (μ : ℂ) : + ‖raising j x-conj μ • inverseWeight 1 x‖^2 = + ‖lowering j x-μ • inverseWeight 1 x‖^2+‖inverseWeight 1 x‖^2 := by + have ha := ladder_adjoint_pairing j x x + have hc : (inner ℂ (raising j x) (conj μ • inverseWeight 1 x)).re = + (inner ℂ (lowering j x) (μ • inverseWeight 1 x)).re := by + rw [inner_smul_right, inner_smul_right, ha] + have he := inner_conj_symm (𝕜 := ℂ) (inverseWeight 1 x) (raising j x) + calc + _ = (conj (μ*inner ℂ (inverseWeight 1 x) (raising j x))).re := by + rw [map_mul, ← he] + simp + _ = _ := Complex.conj_re _ + change RCLike.re (inner ℂ (raising j x) (conj μ • inverseWeight 1 x)) = + RCLike.re (inner ℂ (lowering j x) (μ • inverseWeight 1 x)) at hc + rw [norm_sub_sq (𝕜 := ℂ), norm_sub_sq (𝕜 := ℂ), hc, norm_smul, norm_smul, Complex.norm_conj, + canonical_norm_identity] + ring + +def centeredLadder (j : Fin n) (μ : ℂ) (up : Bool) : Fock n →L[ℂ] Fock n := + (if up then raising j-conj μ • inverseWeight 1 else lowering j-μ • inverseWeight 1) ∘L inverseWeight 2 + +theorem centeredLadder_summable (x : J → Fock n) + (hx : Summable (fun r => ‖x r‖^2)) (j : Fin n) (μ : ℂ) (up : Bool) : + Summable (fun r => ‖centeredLadder j μ up (x r)‖^2) := + CrossEnsemble.applied_summable hx _ + +theorem centeredLadder_ccr (x : Fock n) (j : Fin n) (μ : ℂ) : + ‖centeredLadder j μ true x‖^2=‖centeredLadder j μ false x‖^2+‖inverseWeight 3 x‖^2 := by + have hw : inverseWeight 1 (inverseWeight 2 x)=inverseWeight 3 x := by + change (inverseWeight 1 ∘L inverseWeight 2) x=_ + rw [← inverseWeight_add] + simpa only [centeredLadder, Bool.false_eq_true, ↓reduceIte, + ContinuousLinearMap.comp_apply, sub_apply, + smul_apply, hw] using centered_canonical_norm j (inverseWeight 2 x) μ + +theorem centeredLadder_ensemble_gap (x : J → Fock n) + (hx : Summable (fun r => ‖x r‖^2)) + (hn : HasSum (fun r => ‖inverseWeight 3 (x r)‖^2) 1) (μ : Fin n → ℂ) : + (∑ j, ∑' r, ‖centeredLadder j (μ j) true (x r)‖^2) = + (∑ j, ∑' r, ‖centeredLadder j (μ j) false (x r)‖^2)+(n:ℝ) := by + have hj (j : Fin n) : (∑' r, ‖centeredLadder j (μ j) true (x r)‖^2) = + (∑' r, ‖centeredLadder j (μ j) false (x r)‖^2)+1 := by + simp only [centeredLadder_ccr] + exact ((centeredLadder_summable x hx j (μ j) false).hasSum.add hn).tsum_eq + simp only [hj, Finset.sum_add_distrib, Finset.sum_const, Finset.card_univ, + Fintype.card_fin, nsmul_eq_mul, mul_one] + +end Annihilation + +namespace WeightedGenerator +open EntropyPhotonNumber Annihilation +open scoped ComplexConjugate BigOperators +variable {n : ℕ} {J : Type*} + +theorem centered_lowering_coordinate (b : HilbertBasis J ℂ (Fock n)) + (p : J → ℝ) (hp : ∀ r, 0

ring + +theorem centered_raising_coordinate (b : HilbertBasis J ℂ (Fock n)) + (p : J → ℝ) (hp : ∀ r, 0

‖x r‖^2)) + (hi : ∀ r, inverseWeight 3 (x r)=(Real.sqrt (p r):ℂ) • b r) + (j : Fin n) (μ : ℂ) : + (∑' a : J × J, p a.2*‖centeredEntry b p x j μ a.1 a.2‖^2)= + ∑' r, ‖centeredLadder j μ false (x r)‖^2 := by + have hs := (CrossEnsemble.square_coordinates_summable b (centeredLadder_summable x hx j μ false)).prod_symm + simp only [Prod.swap] at hs + simp only [← centered_down_sq b p hp x hi] + rw [hs.tsum_prod] + calc + _ = ∑' (r : J) (l : J), ‖inner ℂ (b l) (centeredLadder j μ false (x r))‖^2 := + (Summable.tsum_comm (f := fun l r : J => ‖inner ℂ (b l) (centeredLadder j μ false (x r))‖^2) hs).symm + _ = _ := by simp only [(TraceEnsemble.basis_hasSum_norm_sq b _).tsum_eq] + +theorem centered_up_sum (b : HilbertBasis J ℂ (Fock n)) + (p : J → ℝ) (hp : ∀ r, 0

‖x r‖^2)) + (hi : ∀ r, inverseWeight 3 (x r)=(Real.sqrt (p r):ℂ) • b r) + (j : Fin n) (μ : ℂ) : + (∑' a : J × J, p a.1*‖centeredEntry b p x j μ a.1 a.2‖^2)= + ∑' l, ‖centeredLadder j μ true (x l)‖^2 := by + have hs := CrossEnsemble.square_coordinates_summable b (centeredLadder_summable x hx j μ true) + simp only [← centered_up_sq b p hp x hi] + rw [hs.tsum_prod] + simp only [(TraceEnsemble.basis_hasSum_norm_sq b _).tsum_eq] + +theorem centered_K_sum (b : HilbertBasis J ℂ (Fock n)) + (p : J → ℝ) (hp : ∀ r, 0

‖x r‖^2)) + (hi : ∀ r, inverseWeight 3 (x r)=(Real.sqrt (p r):ℂ) • b r) + (hn : HasSum (fun r => ‖inverseWeight 3 (x r)‖^2) 1) (μ : Fin n → ℂ) (t : ℝ) : + (∑ j, ∑' a : J × J, ((t+1)*p a.2-t*p a.1)*‖centeredEntry b p x j (μ j) a.1 a.2‖^2)= + (∑ j, ∑' r, ‖centeredLadder j (μ j) false (x r)‖^2)-(n:ℝ)*t := by + have hj (j : Fin n) : + (∑' a : J × J, ((t+1)*p a.2-t*p a.1)*‖centeredEntry b p x j (μ j) a.1 a.2‖^2)= + (t+1)*(∑' r, ‖centeredLadder j (μ j) false (x r)‖^2)- + t*(∑' r, ‖centeredLadder j (μ j) true (x r)‖^2) := by + have hd := (CrossEnsemble.square_coordinates_summable b (centeredLadder_summable x hx j (μ j) false)).prod_symm + have hu := CrossEnsemble.square_coordinates_summable b (centeredLadder_summable x hx j (μ j) true) + simp only [Prod.swap, centered_down_sq b p hp x hi] at hd + simp only [centered_up_sq b p hp x hi] at hu + simp only [sub_mul, mul_assoc] + rw [(hd.mul_left (t+1)).tsum_sub (hu.mul_left t), tsum_mul_left, tsum_mul_left, + centered_down_sum b p hp x hx hi, centered_up_sum b p hp x hx hi] + simp only [hj, Finset.sum_sub_distrib, ← Finset.mul_sum] + rw [centeredLadder_ensemble_gap x hx hn μ] + ring +end WeightedGenerator + +namespace EntropyPhotonNumber.GibbsData +open QuantumTrace Annihilation WeightedGenerator ThermalMetric +variable {n : ℕ} {k : ℝ} {ρ : State n} (G : GibbsData n k ρ) + +def annihilationMatrix (j : Fin n) (a : G.J × G.J) : ℂ := + loweringEntry G.basis G.probability G.spectralColumns j a.1 a.2 + +def annihilationMean (j : Fin n) : ℂ := diagonalMean G.probability (G.annihilationMatrix j) + +def centeredMatrix (j : Fin n) (a : G.J × G.J) : ℂ := + centeredEntry G.basis G.probability G.spectralColumns j (G.annihilationMean j) a.1 a.2 + +theorem annihilation_mean_summable (j : Fin n) : + Summable (fun r => (G.probability r:ℂ)*G.annihilationMatrix j (r,r)) := by + apply diagonal_mean_summable G.probability (fun r => (G.probability_pos r).le) + G.probability_sum.summable + have hh := nonlog_summable G.basis G.spectralColumns G.spectralColumns_summable j false + simpa only [spectralGain_lowering_sq G.basis G.probability G.probability_pos, + annihilationMatrix] using hh + +theorem centeredMatrix_mean_zero (j : Fin n) : + HasSum (fun r => (G.probability r:ℂ)*G.centeredMatrix j (r,r)) 0 := by + classical + simpa only [centeredMatrix, centeredEntry, ↓reduceIte, annihilationMean, annihilationMatrix] + using diagonal_centering G.probability G.probability_sum + (G.annihilationMatrix j) (G.annihilation_mean_summable j) + +theorem centeredMatrix_six_sums (hk : 0 G.probability a.2*‖G.centeredMatrix j a‖^2) ∧ + Summable (fun a : G.J × G.J => G.probability a.1*‖G.centeredMatrix j a‖^2) ∧ + Summable (fun a : G.J × G.J => G.logCoefficient a.1*G.probability a.2*‖G.centeredMatrix j a‖^2) ∧ + Summable (fun a : G.J × G.J => G.logCoefficient a.2*G.probability a.2*‖G.centeredMatrix j a‖^2) ∧ + Summable (fun a : G.J × G.J => G.logCoefficient a.1*G.probability a.1*‖G.centeredMatrix j a‖^2) ∧ + Summable (fun a : G.J × G.J => G.logCoefficient a.2*G.probability a.1*‖G.centeredMatrix j a‖^2) := + centered_six_sums G.basis G.probability G.probability_pos G.probability_sum.summable + G.spectralColumns G.spectralColumns_summable G.spectralColumns_inverse + G.logSandwich (G.logSandwich_symmetric hk) G.logCoefficient G.logCoefficient_nonneg + (G.logSandwich_parseval hk) + (fun r => G.logSandwich_preimage hk r _ (G.spectralColumns_inverse r)) j (G.annihilationMean j) + +theorem centeredMatrix_defect_summable (hk : 0 + (1-frequency t (G.probability a.1) (G.probability a.2))* + defectCoefficient t (G.probability a.1) (G.probability a.2)*‖G.centeredMatrix j a‖^2) := by + rcases G.centeredMatrix_six_sums hk j with ⟨h₁,h₂,h₃,h₄,h₅,h₆⟩ + exact defect_series_summable t G.probability G.logCoefficient (fun _ => rfl) + (G.centeredMatrix j) h₁ h₂ h₃ h₄ h₅ h₆ + +def defect (hk : 0 rfl) + (G.centeredMatrix j) (G.centeredMatrix_defect_summable hk t j) + (coefficient_series_summable t G.probability (G.centeredMatrix j) hh.1 hh.2.1) + simp only [hj, Finset.sum_sub_distrib] + congr 1 + exact centered_K_sum G.basis G.probability G.probability_pos G.spectralColumns + G.spectralColumns_summable G.spectralColumns_inverse G.spectralColumns_normalized G.annihilationMean t + +end EntropyPhotonNumber.GibbsData + +namespace CrossEnsemble +open scoped ComplexConjugate +variable {I J E : Type*} [NormedAddCommGroup E] [InnerProductSpace ℂ E] [CompleteSpace E] + +omit [CompleteSpace E] in + +theorem pairing_rows (b : HilbertBasis J ℂ E) (u v : I → E) + (hu : Summable (fun i => ‖u i‖^2)) (hv : Summable (fun i => ‖v i‖^2)) + (Z : E →L[ℂ] E) : + HasSum (fun a : I × J => inner ℂ (v a.1) (b a.2)*inner ℂ (b a.2) (Z (u a.1))) + (pairing u v Z) := by + have hs : Summable (fun a : I × J => inner ℂ (v a.1) (b a.2)*inner ℂ (b a.2) (Z (u a.1))) := by + simpa only [mul_comm] using (trace_norm_summable b (applied_summable hu Z) hv).of_norm + have ht := hs.hasSum.prod_fiberwise (fun i => b.hasSum_inner_mul_inner (v i) (Z (u i))) + have he := ht.unique (pairing_summable hu hv Z).hasSum + change HasSum _ (∑' i, inner ℂ (v i) (Z (u i))) + rw [← he] + exact hs.hasSum + +theorem pairing_columns (b : HilbertBasis J ℂ E) (u v : I → E) + (hu : Summable (fun i => ‖u i‖^2)) (hv : Summable (fun i => ‖v i‖^2)) + (Z : E →L[ℂ] E) : + HasSum (fun a : I × J => inner ℂ (v a.1) (Z (b a.2))*inner ℂ (b a.2) (u a.1)) + (pairing u v Z) := by + have hh := pairing_rows b u (fun i => Z.adjoint (v i)) hu (applied_summable hv Z.adjoint) + (ContinuousLinearMap.id ℂ E) + simpa only [ContinuousLinearMap.id_apply, ContinuousLinearMap.adjoint_inner_left, pairing] using hh +end CrossEnsemble + +namespace WeightedGenerator +open EntropyPhotonNumber Annihilation ThermalMetric +open scoped ComplexConjugate +variable {n : ℕ} {J : Type*} + +def weakDefect (t : ℝ) (x : J → Fock n) (j : Fin n) (μ : ℂ) + (Z : Fock n →L[ℂ] Fock n) : ℂ := + (t+1:ℂ)*CrossEnsemble.pairing (fun r => inverseWeight 3 (x r)) + (fun r => centeredLadder j μ false (x r)) Z- + (t:ℂ)*CrossEnsemble.pairing (fun r => centeredLadder j μ true (x r)) + (fun r => inverseWeight 3 (x r)) Z + +theorem weakDefect_spectral (b : HilbertBasis J ℂ (Fock n)) (p : J → ℝ) + (hp : ∀ r, 0

‖x r‖^2)) + (hi : ∀ r, inverseWeight 3 (x r)=(Real.sqrt (p r):ℂ) • b r) + (t : ℝ) (j : Fin n) (μ : ℂ) (Z : Fock n →L[ℂ] Fock n) : + HasSum (fun a : J × J => (defectCoefficient t (p a.1) (p a.2):ℂ)* + conj (centeredEntry b p x j μ a.1 a.2)*inner ℂ (b a.1) (Z (b a.2))) + (weakDefect t x j μ Z) := by + have hw := CrossEnsemble.applied_summable hx (inverseWeight 3) + have hd := centeredLadder_summable x hx j μ false + have hu := centeredLadder_summable x hx j μ true + have hr := (Equiv.prodComm J J).hasSum_iff.mpr + (CrossEnsemble.pairing_rows b (fun r => inverseWeight 3 (x r)) + (fun r => centeredLadder j μ false (x r)) hw hd Z) + have hl := CrossEnsemble.pairing_columns b (fun r => centeredLadder j μ true (x r)) + (fun r => inverseWeight 3 (x r)) hu hw Z + have he₁ (a : J × J) : + inner ℂ (centeredLadder j μ false (x a.2)) (b a.1)* + inner ℂ (b a.1) (Z (inverseWeight 3 (x a.2)))= + (p a.2:ℂ)*conj (centeredEntry b p x j μ a.1 a.2)*inner ℂ (b a.1) (Z (b a.2)) := by + rw [← inner_conj_symm, centered_lowering_coordinate b p hp x hi, hi, map_smul, inner_smul_right, + map_mul, Complex.conj_ofReal] + have hs : (Real.sqrt (p a.2):ℂ)^2=(p a.2:ℂ) := by exact_mod_cast Real.sq_sqrt (hp a.2).le + linear_combination conj (centeredEntry b p x j μ a.1 a.2)*inner ℂ (b a.1) (Z (b a.2))*hs + have he₂ (a : J × J) : + inner ℂ (inverseWeight 3 (x a.1)) (Z (b a.2))* + inner ℂ (b a.2) (centeredLadder j μ true (x a.1))= + (p a.1:ℂ)*conj (centeredEntry b p x j μ a.1 a.2)*inner ℂ (b a.1) (Z (b a.2)) := by + rw [centered_raising_coordinate b p hp x hi, hi, inner_smul_left, Complex.conj_ofReal] + have hs : (Real.sqrt (p a.1):ℂ)^2=(p a.1:ℂ) := by exact_mod_cast Real.sq_sqrt (hp a.1).le + linear_combination conj (centeredEntry b p x j μ a.1 a.2)*inner ℂ (b a.1) (Z (b a.2))*hs + simp only [Equiv.prodComm_apply, Function.comp_def, Prod.swap, he₁] at hr + simp only [he₂] at hl + convert! (hr.mul_left (t+1:ℂ)).sub (hl.mul_left (t:ℂ)) using 1 + ext a + simp only [defectCoefficient, Complex.ofReal_sub, Complex.ofReal_add, Complex.ofReal_one, + Complex.ofReal_mul] + ring + +end WeightedGenerator + +namespace ThermalMetric +open scoped ComplexConjugate +variable {J E : Type*} [NormedAddCommGroup E] [InnerProductSpace ℂ E] [CompleteSpace E] + +theorem bounded_matrix_summable (b : HilbertBasis J ℂ E) (p : J → ℝ) + (hp : ∀ j, 0

metricCoefficient t (p a.1) (p a.2)* + ‖inner ℂ (b a.1) (Z (b a.2))‖^2) := by + let u : J → E := fun r => (Real.sqrt (p r):ℂ) • b r + have hu : Summable (fun r => ‖u r‖^2) := by + convert! hs using 1 + ext r + simp only [u, norm_smul, Complex.norm_real, Real.norm_eq_abs, sq_abs, + Real.sq_sqrt (hp r).le, b.orthonormal.norm_eq_one r, mul_one] + have hc : Summable (fun a : J × J => p a.2*‖inner ℂ (b a.1) (Z (b a.2))‖^2) := by + have hh := (CrossEnsemble.square_coordinates_summable b (CrossEnsemble.applied_summable hu Z)).prod_symm + simpa only [Prod.swap, u, map_smul, inner_smul_right, norm_mul, Complex.norm_real, + Real.norm_eq_abs, mul_pow, sq_abs, Real.sq_sqrt (hp _).le] using hh + have hr : Summable (fun a : J × J => p a.1*‖inner ℂ (b a.1) (Z (b a.2))‖^2) := by + have hh := CrossEnsemble.square_coordinates_summable b (CrossEnsemble.applied_summable hu Z.adjoint) + simpa only [u, map_smul, inner_smul_right, norm_mul, Complex.norm_real, + Real.norm_eq_abs, mul_pow, sq_abs, Real.sq_sqrt (hp _).le, + ContinuousLinearMap.adjoint_inner_right, norm_inner_symm] using hh + apply Summable.of_nonneg_of_le + (fun a => mul_nonneg (metricCoefficient_pos ht (hp _) (hp _)).le (sq_nonneg _)) _ + (((hr.mul_left t).add (hc.mul_left (t+1))).mul_left (h t/2)) + intro a + have hh := DiagonalForms.System.logMean_le_arithmetic (mul_pos ht (hp a.1)) + (mul_pos (by positivity : 0 metricCoefficient t (p a.1) (p a.2)*‖z a‖^2)) : + lp (fun _ : J × J => ℂ) 2 := + weightedVector (fun a : J × J => metricCoefficient t (p a.1) (p a.2)) z hz + (fun a => (metricCoefficient_pos ht (hp a.1) (hp a.2)).le) + +theorem weightedVector_centered (t : ℝ) (ht : 0 metricCoefficient t (p a.1) (p a.2)*‖z a‖^2)) + (hm : HasSum (fun j => (p j:ℂ)*z (j,j)) 0) : + matrixVector t ht p hp z hz ∈ centeredSpace t ht p hp hs := by + classical + have hi := lp.hasSum_inner (𝕜 := ℂ) (identityVector t ht p hp hs) + (weightedVector (fun a => metricCoefficient t (p a.1) (p a.2)) z hz + (fun a => (metricCoefficient_pos ht (hp a.1) (hp a.2)).le)) + have hdiag : HasSum (fun a : J × J => if a.1=a.2 then (p a.1:ℂ)*z (a.1,a.1) else 0) + (inner ℂ (identityVector t ht p hp hs) + (weightedVector (fun a => metricCoefficient t (p a.1) (p a.2)) z hz + (fun a => (metricCoefficient_pos ht (hp a.1) (hp a.2)).le))) := by + convert! hi using 1 + ext a + by_cases he : a.1=a.2 + · obtain ⟨l,r⟩ := a + dsimp only [Prod.fst, Prod.snd] at he ⊢ + subst r + simp only [identityVector, weightedVector_apply, identityEntry, ↓reduceIte, mul_one, + RCLike.inner_apply, Complex.conj_ofReal, metricCoefficient_self ht (hp l)] + have hh : (Real.sqrt (p l):ℂ)^2=(p l:ℂ) := by exact_mod_cast Real.sq_sqrt (hp l).le + linear_combination -z (l,l)*hh + · simp only [identityVector, weightedVector_apply, identityEntry, he, ↓reduceIte, + mul_zero, RCLike.inner_apply, map_zero] + exact hdiag.unique (hasSum_diagonal hm) + +end ThermalMetric + +namespace EntropyPhotonNumber.GibbsData +open QuantumTrace Annihilation WeightedGenerator ThermalMetric +variable {n : ℕ} {k : ℝ} {ρ : State n} (G : GibbsData n k ρ) + +def observableVector (t : ℝ) (ht : 0 ℂ) 2 := + matrixVector t ht G.probability G.probability_pos + (fun a => inner ℂ (G.basis a.1) (Z (G.basis a.2))) + (bounded_matrix_summable G.basis G.probability G.probability_pos + G.probability_sum.summable t ht Z) + +theorem observableVector_mem (t : ℝ) (ht : 0 (G.probability r:ℂ)*inner ℂ (G.basis r) (Z (G.basis r))) 0) : + G.observableVector t ht Z ∈ centeredSpace t ht G.probability G.probability_pos + G.probability_sum.summable := + weightedVector_centered t ht G.probability G.probability_pos G.probability_sum.summable + _ _ hZ + +theorem defect_on_observable (hk : 0 (G.probability r:ℂ)*inner ℂ (G.basis r) (Z (G.basis r))) 0) : + G.defect hk t ht j ⟨G.observableVector t ht Z,G.observableVector_mem t ht Z hZ⟩ = + weakDefect t G.spectralColumns j (G.annihilationMean j) Z := by + have hv := defectVector_pairing t ht G.probability G.probability_pos + (G.centeredMatrix j) (G.centeredMatrix_defect_summable hk t j) + (fun a => inner ℂ (G.basis a.1) (Z (G.basis a.2))) + (bounded_matrix_summable G.basis G.probability G.probability_pos + G.probability_sum.summable t ht Z) + exact hv.unique (weakDefect_spectral G.basis G.probability G.probability_pos + G.spectralColumns G.spectralColumns_summable G.spectralColumns_inverse + t j (G.annihilationMean j) Z) + +end EntropyPhotonNumber.GibbsData + +namespace Annihilation +open EntropyPhotonNumber +variable {n : ℕ} + +theorem lowering_weighted_apply (j : Fin n) (x : Fock n) (k : NumberIndex n) : + lowering j (inverseWeight 2 x) k= + (Real.sqrt ((k j:ℝ)+1):ℂ)*inverseWeight 3 x (up j k) := by + rw [lowering_apply] + change _ * ((inverseWeight 1 ∘L inverseWeight 2) x) _ = _ + rw [← inverseWeight_add] + +theorem raising_weighted_apply (j : Fin n) (x : Fock n) (k : NumberIndex n) : + raising j (inverseWeight 2 x) k= + (Real.sqrt (k j:ℝ):ℂ)*inverseWeight 3 x (down j k) := by + rcases index_cases j k with hk | ⟨l,rfl⟩ + · simp only [raising_zero j _ k hk, hk, Nat.cast_zero, Real.sqrt_zero, + Complex.ofReal_zero, zero_mul] + · rw [raising_up] + change _ * ((inverseWeight 1 ∘L inverseWeight 2) x) _ = _ + rw [← inverseWeight_add, up_same, down_up] + norm_cast +end Annihilation + +namespace EntropyPhotonNumber +open Annihilation +open scoped ComplexConjugate +variable {n : ℕ} + +def numberMatrixUnit (a b : NumberIndex n) : Fock n →L[ℂ] Fock n := + InnerProductSpace.rankOne ℂ (numberKet a) (numberKet b) + +@[simp] theorem numberKet_inner (a : NumberIndex n) (x : Fock n) : + inner ℂ (numberKet a) x=x a := by + simp only [numberKet, lp.inner_single_left, RCLike.inner_apply, map_one, mul_one] + +@[simp] theorem inner_numberKet (a : NumberIndex n) (x : Fock n) : + inner ℂ x (numberKet a)=conj (x a) := by + rw [← inner_conj_symm, numberKet_inner] + +@[simp] theorem numberMatrixUnit_inner (u v : Fock n) (a b : NumberIndex n) : + inner ℂ v (numberMatrixUnit a b u)=u b*conj (v a) := by + simp only [numberMatrixUnit, InnerProductSpace.rankOne_apply, inner_smul_right, + numberKet_inner, inner_numberKet] +end EntropyPhotonNumber + +namespace WeightedGenerator +open EntropyPhotonNumber Annihilation +open scoped ComplexConjugate +variable {n : ℕ} {J : Type*} + +theorem inverseColumns_entry (x : J → Fock n) (hx : Summable (fun j => ‖x j‖^2)) + (ρ : State n) + (he : CrossEnsemble.operator (fun j => inverseWeight 3 (x j)) (fun j => inverseWeight 3 (x j))=ρ.op) + (a b : NumberIndex n) : + HasSum (fun j => inverseWeight 3 (x j) a*conj (inverseWeight 3 (x j) b)) (entry ρ.op a b) := by + have hi := CrossEnsemble.applied_summable hx (inverseWeight 3) + simpa only [he, numberKet_inner, inner_numberKet, entry] using + CrossEnsemble.entry_hasSum hi hi (numberKet a) (numberKet b) + +theorem weakDefect_numberMatrixUnit (t : ℝ) (x : J → Fock n) + (hx : Summable (fun j => ‖x j‖^2)) (ρ : State n) + (he : CrossEnsemble.operator (fun j => inverseWeight 3 (x j)) (fun j => inverseWeight 3 (x j))=ρ.op) + (j : Fin n) (μ : ℂ) (a b : NumberIndex n) : + weakDefect t x j μ (numberMatrixUnit a b)= + (t+1:ℂ)*(Real.sqrt ((a j:ℝ)+1):ℂ)*entry ρ.op b (up j a)- + (t:ℂ)*(Real.sqrt (b j:ℝ):ℂ)*entry ρ.op (down j b) a- + conj μ*entry ρ.op b a := by + have hw := CrossEnsemble.applied_summable hx (inverseWeight 3) + have h₀ := inverseColumns_entry x hx ρ he b a + have h₁ := inverseColumns_entry x hx ρ he b (up j a) + have h₂ := inverseColumns_entry x hx ρ he (down j b) a + have hi (y : Fock n) : inverseWeight 1 (inverseWeight 2 y)=inverseWeight 3 y := by + change (inverseWeight 1 ∘L inverseWeight 2) y=_ + rw [← inverseWeight_add] + have hl : CrossEnsemble.pairing (fun r => inverseWeight 3 (x r)) + (fun r => centeredLadder j μ false (x r)) (numberMatrixUnit a b)= + (Real.sqrt ((a j:ℝ)+1):ℂ)*entry ρ.op b (up j a)-conj μ*entry ρ.op b a := by + apply (CrossEnsemble.pairing_summable hw (centeredLadder_summable x hx j μ false) _).hasSum.unique + convert! (h₁.mul_left (Real.sqrt ((a j:ℝ)+1):ℂ)).sub (h₀.mul_left (conj μ)) using 1 + ext r + simp only [numberMatrixUnit_inner, centeredLadder, Bool.false_eq_true, ↓reduceIte, + ContinuousLinearMap.comp_apply, sub_apply, smul_apply, lp.coeFn_sub, Pi.sub_apply, + lp.coeFn_smul, Pi.smul_apply, smul_eq_mul, hi, lowering_weighted_apply, + map_sub, map_mul, Complex.conj_ofReal] + ring + have hu : CrossEnsemble.pairing (fun r => centeredLadder j μ true (x r)) + (fun r => inverseWeight 3 (x r)) (numberMatrixUnit a b)= + (Real.sqrt (b j:ℝ):ℂ)*entry ρ.op (down j b) a-conj μ*entry ρ.op b a := by + apply (CrossEnsemble.pairing_summable (centeredLadder_summable x hx j μ true) hw _).hasSum.unique + convert! (h₂.mul_left (Real.sqrt (b j:ℝ):ℂ)).sub (h₀.mul_left (conj μ)) using 1 + ext r + simp only [numberMatrixUnit_inner, centeredLadder, ↓reduceIte, + ContinuousLinearMap.comp_apply, sub_apply, smul_apply, lp.coeFn_sub, Pi.sub_apply, + lp.coeFn_smul, Pi.smul_apply, smul_eq_mul, hi, raising_weighted_apply] + ring + rw [weakDefect, hl, hu] + ring +end WeightedGenerator + +namespace EntropyPhotonNumber.GibbsData +open Annihilation WeightedGenerator +variable {n : ℕ} {k : ℝ} {ρ : State n} (G : GibbsData n k ρ) + +theorem inverse_spectralColumns_operator : + CrossEnsemble.operator (fun r => inverseWeight 3 (G.spectralColumns r)) + (fun r => inverseWeight 3 (G.spectralColumns r))=ρ.op := by + simp only [G.spectralColumns_inverse] + exact CrossEnsemble.eigenEnsemble_operator G.basis G.probability + (fun r => (G.probability_pos r).le) G.probability_sum.summable ρ.op ρ.positive.isSymmetric G.eigen + +theorem weakDefect_numberMatrixUnit (t : ℝ) (j : Fin n) (a b : NumberIndex n) : + weakDefect t G.spectralColumns j (G.annihilationMean j) (numberMatrixUnit a b)= + (t+1:ℂ)*(Real.sqrt ((a j:ℝ)+1):ℂ)*entry ρ.op b (up j a)- + (t:ℂ)*(Real.sqrt (b j:ℝ):ℂ)*entry ρ.op (down j b) a- + star (G.annihilationMean j)*entry ρ.op b a := + WeightedGenerator.weakDefect_numberMatrixUnit t G.spectralColumns G.spectralColumns_summable + ρ G.inverse_spectralColumns_operator j (G.annihilationMean j) a b +end EntropyPhotonNumber.GibbsData + +end + +end OAI diff --git a/lean/OAI/InformationTheory/QuantumCircuit/Ancilla.lean b/lean/OAI/InformationTheory/QuantumCircuit/Ancilla.lean new file mode 100644 index 0000000000000000000000000000000000000000..62c47be76239726285da719e9ebac04ea90e9932 --- /dev/null +++ b/lean/OAI/InformationTheory/QuantumCircuit/Ancilla.lean @@ -0,0 +1,141 @@ +import OAI.InformationTheory.QuantumCircuit.Computational + +namespace OAI + +noncomputable section +open scoped BigOperators Matrix.Norms.L2Operator Topology +open Matrix Polynomial Filter Asymptotics + +namespace QAC + +/-- The zero-ancilla computational subspace, without any condition on final garbage. -/ +def ancillaValid {N : ℕ} (n : ℕ) (z : Word N) : Prop := ∀ i, n ≤ i.val → z i=0 + +instance {N : ℕ} (n : ℕ) (z : Word N) : Decidable (ancillaValid n z) := by + unfold ancillaValid + infer_instance + +def restrictWord {n N : ℕ} (hnN : n ≤ N) (z : Word N) : Word n := + fun i => z ⟨i.val,lt_of_lt_of_le i.isLt hnN⟩ + +lemma restrict_inputWord {n N : ℕ} (hnN : n ≤ N) (x : Word n) : + restrictWord hnN (inputWord x)=x := by + funext i + simp [restrictWord,inputWord,i.isLt] + +lemma inputWord_injective {n N : ℕ} (hnN : n ≤ N) : + Function.Injective (@inputWord n N) := + Function.LeftInverse.injective (restrict_inputWord hnN) + +lemma inputWord_valid {n N : ℕ} (x : Word n) : ancillaValid n (@inputWord n N x) := by + intro i hi + simp [inputWord,not_lt.mpr hi] + +lemma input_restrictWord {n N : ℕ} (hnN : n ≤ N) (z : Word N) (hz : ancillaValid n z) : + inputWord (restrictWord hnN z)=z := by + funext i + by_cases hi : i.val inputWord x) + · intro x _ + simp only [Finset.mem_filter,Finset.mem_univ,true_and] + exact inputWord_valid x + · intro x _ y _ hxy + exact inputWord_injective hnN hxy + · intro z hz + refine ⟨restrictWord hnN z,Finset.mem_univ _,?_⟩ + exact input_restrictWord hnN z (Finset.mem_filter.mp hz).2 + · intro x _ + rfl + +def ancillaProjection (n N : ℕ) : Operator N := + tensorMatrix fun i => if i.val if ancillaValid n z then 1 else 0) := by + classical + have hloc : (fun i : Fin N => if i.val Matrix.diagonal (fun b => if n ≤ i.val → b=0 then (1:ℂ) else 0) := by + funext i + by_cases hi : i.val fin_cases b <;> norm_num [bitX] + +lemma inputFlip_entry (n N : ℕ) (x y : Word N) : + inputFlip n N x y = if x=flipWord (inputSet n N) y then 1 else 0 := by + classical + have hloc (i : Fin N) : (if i.val ‖c i‖)).sum * C) + ((l.map (fun i => ‖c i‖)).sum * δ) (l.map (fun i => c i • E i)).sum := by + induction l with + | nil => exact ⟨0, degree_zero r, by simp, by simp⟩ + | cons i l ih => + simpa only [List.map_cons, List.sum_cons, add_mul] using + ((h i (List.mem_cons_self ..)).smul (c i)).add + (ih (fun j hj => h j (List.mem_cons_of_mem _ hj))) + +lemma approx_real_list_sum {N : ℕ} {ι : Type*} (ψ : State N) (l : List ι) + (c : ι → ℝ) (E : ι → Operator N) (r C δ : ℝ) + (h : ∀ i ∈ l, ApproxOn ψ r C δ (E i)) : + ApproxOn ψ r ((l.map (fun i => |c i|)).sum * C) + ((l.map (fun i => |c i|)).sum * δ) (l.map (fun i => c i • E i)).sum := by + induction l with + | nil => exact ⟨0, degree_zero r, by simp, by simp⟩ + | cons i l ih => + simpa only [List.map_cons, List.sum_cons, add_mul] using + ((h i (List.mem_cons_self ..)).real_smul (c i)).add + (ih (fun j hj => h j (List.mem_cons_of_mem _ hj))) + +lemma reflection_double_expansion {N : ℕ} (l : List (Count N)) + (hl : l.Pairwise (fun A B => Disjoint A.support B.support)) (D : Operator N) : + conjugate (reflectList l) D = + ((reflectionTerms l).map (fun p => p.1 • + ((reflectionTerms l).map (fun q => q.1 • (p.2.zero * D * q.2.zero))).sum)).sum := by + unfold conjugate + rw [reflectList_selfAdjoint l hl, ← reflectionTerms_sum l hl] + calc + _ = ((reflectionTerms l).map (fun a => (a.1 • a.2.zero) * D * + ((reflectionTerms l).map (fun b => b.1 • b.2.zero)).sum)).sum := by + rw [← List.sum_map_mul_right, ← List.sum_map_mul_right] + _ = _ := by + congr 1 + apply List.map_congr_left + intro a _ + rw [← List.sum_map_mul_left] + simp only [List.map_map, smul_mul_assoc, mul_smul_comm, List.smul_sum] + congr 1 + apply List.map_congr_left + intro b _ + exact smul_comm b.1 a.1 _ + +lemma sandwich_approximation {N : ℕ} (ψ : State N) (M : Count N) + (J S T : Finset (Fin N)) (D : Operator N) (hD : TensorSupported J D) + (hDn : ‖D‖ ≤ 1) (p : Polynomial ℝ) (r δ τ : ℝ) + (hδ : 0 ≤ δ) (hψ : ‖ψ‖ ≤ 1) (hp0 : p.eval 0 = 1) + (hp : ∀ k : ℕ, 1 ≤ k → (k : ℝ) < r → |p.eval (k : ℝ)| ≤ δ) + (htail : ‖act ((M.restrict ((S ∪ T) \ J)).high r) ψ‖ ≤ τ) : + ApproxOn ψ ((J.card : ℝ) + p.natDegree) (weight N p) + (δ + (1 + weight N p) * τ) + ((M.restrict S).zero * D * (M.restrict T).zero) := by + let Q := M.restrict ((S ∪ T) \ J) + let I := interiorTerm M J S T D + refine ⟨I * Q.polynomial p, ?_, ?_, ?_⟩ + · exact (tensor_hasDegreeLE J I (interiorTerm_supported M J S T D hD) le_rfl).mul + (Q.polynomial_degree p) + · exact (norm_mul_le_right _ _ (interiorTerm_norm M J S T D hDn)).trans + (Q.polynomial_norm_le p) + · rw [sandwich_factor M J S T D hD] + change ‖act (I * Q.zero - I * Q.polynomial p) ψ‖ ≤ _ + rw [← mul_sub, act_mul] + exact (act_norm_le_of_contraction I (interiorTerm_norm M J S T D hDn) _).trans + (Q.polynomial_action_error p ψ r δ τ hδ hψ hp0 hp htail) + +end QAC + +end + +end OAI diff --git a/lean/OAI/InformationTheory/QuantumCircuit/Asymptotics.lean b/lean/OAI/InformationTheory/QuantumCircuit/Asymptotics.lean new file mode 100644 index 0000000000000000000000000000000000000000..c2d75b02e475c15d8e15c9d5c00960493f2ec540 --- /dev/null +++ b/lean/OAI/InformationTheory/QuantumCircuit/Asymptotics.lean @@ -0,0 +1,289 @@ +import OAI.InformationTheory.QuantumCircuit.Polynomial + +namespace OAI + +noncomputable section +open scoped BigOperators Matrix.Norms.L2Operator +open Polynomial Filter Asymptotics + +namespace QAC + +/-- Strict exponent gaps absorb every fixed multiplicative constant. -/ +lemma eventually_power_le {s t : ℝ} (hst : s < t) (C : ℝ) : + ∀ᶠ N : ℕ in atTop, C * (N : ℝ) ^ s ≤ (N : ℝ) ^ t := by + have ht : Tendsto (fun N : ℕ => (N : ℝ) ^ (t - s)) atTop atTop := + (tendsto_rpow_atTop (sub_pos.2 hst)).comp tendsto_natCast_atTop_atTop + filter_upwards [ht.eventually_ge_atTop C, eventually_ge_atTop 1] with N hN h1 + have hN0 : (0 : ℝ) < N := by exact_mod_cast (show 0 < N by omega) + calc + C * (N : ℝ) ^ s ≤ (N : ℝ) ^ (t - s) * (N : ℝ) ^ s := + mul_le_mul_of_nonneg_right hN (Real.rpow_nonneg hN0.le _) + _ = (N : ℝ) ^ t := by rw [← Real.rpow_add hN0]; congr 1; ring + +/-- The same strict gap absorbs a logarithm, with no change to the exponent. -/ +lemma eventually_power_log_le {s t : ℝ} (hst : s < t) (C : ℝ) : + ∀ᶠ N : ℕ in atTop, C * (N : ℝ) ^ s * Real.log N ≤ (N : ℝ) ^ t := by + have h := ((isLittleO_log_rpow_atTop (sub_pos.2 hst)).const_mul_left C).bound + (c := 1) zero_lt_one + have hn := tendsto_natCast_atTop_atTop.eventually h + filter_upwards [hn, eventually_ge_atTop 1] with N hN h1 + have hN0 : (0 : ℝ) < N := by exact_mod_cast (show 0 < N by omega) + have hbound : C * Real.log N ≤ (N : ℝ) ^ (t - s) := by + have hN' : |C * Real.log N| ≤ (N : ℝ) ^ (t - s) := by + simpa only [Real.norm_eq_abs, one_mul, + abs_of_nonneg (Real.rpow_nonneg hN0.le (t - s))] using hN + exact (le_abs_self _).trans hN' + calc + C * (N : ℝ) ^ s * Real.log N = (C * Real.log N) * (N : ℝ) ^ s := by ring + _ ≤ (N : ℝ) ^ (t - s) * (N : ℝ) ^ s := + mul_le_mul_of_nonneg_right hbound (Real.rpow_nonneg hN0.le _) + _ = (N : ℝ) ^ t := by rw [← Real.rpow_add hN0]; congr 1; ring + +lemma ceil_rpow_bounds {N : ℕ} {a : ℝ} (hN : 1 ≤ N) (ha : 0 ≤ a) : + (N : ℝ) ^ a ≤ (⌈(N : ℝ) ^ a⌉₊ : ℝ) ∧ + (⌈(N : ℝ) ^ a⌉₊ : ℝ) ≤ 2 * (N : ℝ) ^ a := by + have h1 : (1 : ℝ) ≤ N := by exact_mod_cast hN + have hp1 : 1 ≤ (N : ℝ) ^ a := Real.one_le_rpow h1 ha + constructor + · exact Nat.le_ceil _ + · have h := Nat.ceil_lt_add_one (Real.rpow_nonneg (Nat.cast_nonneg N) a) + linarith + +lemma ceil_rpow_log {N : ℕ} {b : ℝ} (hN : 2 ≤ N) (hb : 0 ≤ b) : + Real.log (⌈(N : ℝ) ^ b⌉₊ : ℝ) ≤ (b + 1) * Real.log N := by + have hN0 : (0 : ℝ) < N := by exact_mod_cast (show 0 < N by omega) + have h2 : (2 : ℝ) ≤ N := by exact_mod_cast hN + have hbounds := ceil_rpow_bounds (show 1 ≤ N by omega) hb + have hceil0 : (0 : ℝ) < ⌈(N : ℝ) ^ b⌉₊ := + lt_of_lt_of_le (Real.rpow_pos_of_pos hN0 _) hbounds.1 + calc + _ ≤ Real.log (2 * (N : ℝ) ^ b) := Real.log_le_log hceil0 hbounds.2 + _ = Real.log 2 + b * Real.log N := by + rw [Real.log_mul (by norm_num) (ne_of_gt (Real.rpow_pos_of_pos hN0 _)), + Real.log_rpow hN0] + _ ≤ (b + 1) * Real.log N := by + have := Real.log_le_log (by norm_num : (0 : ℝ) < 2) h2 + nlinarith + + +lemma approx_weight_exp {N r k : ℕ} {v u : ℝ} (hN : 6 ≤ N) + (hsum : (r : ℝ) + k ≤ 4 * (N : ℝ) ^ v) + (hcostN : 8 * (N : ℝ) ^ v * Real.log N ≤ (N : ℝ) ^ u) : + (1 + (N : ℝ)) ^ r * (7 + 4 * (N : ℝ)) ^ k ≤ Real.exp ((N : ℝ) ^ u) := by + have hN6R : (6 : ℝ) ≤ N := by exact_mod_cast hN + have hlogN : 0 ≤ Real.log N := Real.log_nonneg (by linarith) + have hlog1 : Real.log (1 + (N : ℝ)) ≤ 2 * Real.log N := by + have h := Real.log_le_log (by positivity : 0 < 1 + (N : ℝ)) + (show 1 + (N : ℝ) ≤ (N : ℝ) ^ 2 by nlinarith only [hN6R]) + simpa only [Real.log_pow, Nat.cast_ofNat] using h + have hlog2 : Real.log (7 + 4 * (N : ℝ)) ≤ 2 * Real.log N := by + have h := Real.log_le_log (by positivity : 0 < 7 + 4 * (N : ℝ)) + (show 7 + 4 * (N : ℝ) ≤ (N : ℝ) ^ 2 by nlinarith only [hN6R]) + simpa only [Real.log_pow, Nat.cast_ofNat] using h + have hcost : (r : ℝ) * Real.log (1 + (N : ℝ)) + + (k : ℝ) * Real.log (7 + 4 * (N : ℝ)) ≤ (N : ℝ) ^ u := by + calc + _ ≤ (r : ℝ) * (2 * Real.log N) + (k : ℝ) * (2 * Real.log N) := + add_le_add (mul_le_mul_of_nonneg_left hlog1 (Nat.cast_nonneg r)) + (mul_le_mul_of_nonneg_left hlog2 (Nat.cast_nonneg k)) + _ ≤ 8 * (N : ℝ) ^ v * Real.log N := by + nlinarith only [mul_le_mul_of_nonneg_right hsum hlogN] + _ ≤ _ := hcostN + calc + _ = Real.exp ((r : ℝ) * Real.log (1 + (N : ℝ)) + + (k : ℝ) * Real.log (7 + 4 * (N : ℝ))) := by + rw [Real.exp_add, Real.exp_nat_mul, Real.exp_nat_mul, + Real.exp_log (by positivity), Real.exp_log (by positivity)] + _ ≤ _ := Real.exp_le_exp.2 hcost + +lemma approx_decay_exp {r : ℕ} {m z : ℝ} (hr : 1 ≤ r) (hm : 1 ≤ Real.log m) + (hz : z ≤ r) : 2 * Real.exp (-(3 * (r : ℝ) * Real.log m)) ≤ Real.exp (-z) := by + have hr1 : (1 : ℝ) ≤ r := by exact_mod_cast hr + calc + _ ≤ Real.exp 1 * Real.exp (-(3 * (r : ℝ) * Real.log m)) := by + apply mul_le_mul_of_nonneg_right _ (Real.exp_nonneg _) + have := Real.add_one_le_exp 1 + norm_num at this ⊢ + exact this + _ = Real.exp (1 - 3 * (r : ℝ) * Real.log m) := by rw [← Real.exp_add]; congr 1 + _ ≤ _ := by + apply Real.exp_le_exp.2 + nlinarith only [mul_le_mul_of_nonneg_left hm (Nat.cast_nonneg r), hz, hr1] + +lemma ceil_approx_condition {N : ℕ} {a b v : ℝ} (hN : 2 ≤ N) + (ha : 0 ≤ a) (hb : 0 ≤ b) (hv : 0 ≤ v) + (hkN : (8 * (b + 1)) * (N : ℝ) ^ ((a + b) / 2) * Real.log N ≤ (N : ℝ) ^ v) : + 4 * (⌈(N : ℝ) ^ a⌉₊ : ℝ) * Real.log (⌈(N : ℝ) ^ b⌉₊ : ℝ) ≤ + (⌈(N : ℝ) ^ v⌉₊ : ℝ) * + Real.sqrt ((⌈(N : ℝ) ^ a⌉₊ : ℝ) / (⌈(N : ℝ) ^ b⌉₊ : ℝ)) := by + have hN1 : 1 ≤ N := by omega + have hN0 : (0 : ℝ) < N := by exact_mod_cast (show 0 < N by omega) + let r := ⌈(N : ℝ) ^ a⌉₊ + let m := ⌈(N : ℝ) ^ b⌉₊ + let k := ⌈(N : ℝ) ^ v⌉₊ + have hrap := ceil_rpow_bounds hN1 ha + have hmbp := ceil_rpow_bounds hN1 hb + have hkvp := ceil_rpow_bounds hN1 hv + have hm0 : (0 : ℝ) < m := lt_of_lt_of_le (Real.rpow_pos_of_pos hN0 _) hmbp.1 + have hlogm := ceil_rpow_log hN hb + have hsquare : ((N : ℝ) ^ ((a + b) / 2)) ^ 2 = (N : ℝ) ^ a * (N : ℝ) ^ b := by + rw [← Real.rpow_natCast, ← Real.rpow_mul hN0.le, ← Real.rpow_add hN0] + congr 1 + ring + have hsqrt : Real.sqrt ((r : ℝ) * m) ≤ 2 * (N : ℝ) ^ ((a + b) / 2) := by + apply (Real.sqrt_le_left (by positivity)).2 + have hmul := mul_le_mul hrap.2 hmbp.2 (Nat.cast_nonneg m) + (by positivity : 0 ≤ 2 * (N : ℝ) ^ a) + rw [mul_pow, hsquare] + nlinarith only [hmul] + have hksqrt : 4 * Real.sqrt ((r : ℝ) * m) * Real.log m ≤ (k : ℝ) := by + calc + _ ≤ 4 * (2 * (N : ℝ) ^ ((a + b) / 2)) * ((b + 1) * Real.log N) := by + apply mul_le_mul _ hlogm (by positivity) (by positivity) + exact mul_le_mul_of_nonneg_left hsqrt (by norm_num) + _ = (8 * (b + 1)) * (N : ℝ) ^ ((a + b) / 2) * Real.log N := by ring + _ ≤ (N : ℝ) ^ v := hkN + _ ≤ (k : ℝ) := hkvp.1 + have hsqrtmul : Real.sqrt ((r : ℝ) * m) * Real.sqrt ((r : ℝ) / m) = r := by + rw [← Real.sqrt_mul (by positivity), show (r : ℝ) * m * ((r : ℝ) / m) = (r : ℝ)^2 by + field_simp, Real.sqrt_sq (Nat.cast_nonneg r)] + calc + _ = (4 * Real.sqrt ((r : ℝ) * m) * Real.log m) * Real.sqrt ((r : ℝ) / m) := by + calc + _ = 4 * Real.log m * (Real.sqrt ((r : ℝ) * m) * Real.sqrt ((r : ℝ) / m)) := by + rw [hsqrtmul]; ring + _ = _ := by ring + _ ≤ _ := mul_le_mul_of_nonneg_right hksqrt (Real.sqrt_nonneg _) + +/-- Polynomial approximation uniform in `N`, including `b > 1`. -/ +theorem polynomial_approximation {a b u : ℝ} (ha : 0 < a) (hab : a < b) + (hu : (a + b) / 2 < u) : + ∀ᶠ N : ℕ in atTop, ∃ p : ℝ[X], + (p.natDegree : ℝ) ≤ (N : ℝ) ^ u ∧ weight N p ≤ Real.exp ((N : ℝ) ^ u) ∧ + p.eval 0 = 1 ∧ ∀ x : ℕ, 1 ≤ x → x ≤ ⌈(N : ℝ) ^ b⌉₊ → + |p.eval (x : ℝ)| ≤ Real.exp (-((N : ℝ) ^ a)) := by + let g := (a + b) / 2 + let v := (g + u) / 2 + have hgu : g < u := hu + have hag : a < g := by dsimp [g]; linarith + have hgv : g < v := by dsimp [v]; linarith only [hgu] + have hvu : v < u := by dsimp [v]; linarith only [hgu] + have hav : a < v := lt_trans hag hgv + have hb : 0 < b := lt_trans ha hab + have hv : 0 < v := lt_trans ha hav + have hexp : ∀ᶠ N : ℕ in atTop, Real.exp 1 ≤ (N : ℝ) ^ b := + ((tendsto_rpow_atTop hb).comp tendsto_natCast_atTop_atTop).eventually_ge_atTop _ + filter_upwards [eventually_ge_atTop 6, eventually_power_le hab 4, + eventually_power_le hvu 4, eventually_power_log_le hvu 8, + eventually_power_log_le hgv (8 * (b + 1)), hexp] with N hN habN hdegN hcostN hkN hexpN + have hN1 : 1 ≤ N := by omega + have hN1R : (1 : ℝ) ≤ N := by exact_mod_cast hN1 + let r := ⌈(N : ℝ) ^ a⌉₊ + let m := ⌈(N : ℝ) ^ b⌉₊ + let k := ⌈(N : ℝ) ^ v⌉₊ + have hrap := ceil_rpow_bounds hN1 ha.le + have hmbp := ceil_rpow_bounds hN1 hb.le + have hkvp := ceil_rpow_bounds hN1 hv.le + have hr1 : (1 : ℝ) ≤ r := (Real.one_le_rpow hN1R ha.le).trans hrap.1 + have hr : 1 ≤ r := by exact_mod_cast hr1 + have hm : 2 * r ≤ m := by + have h : 2 * (r : ℝ) ≤ m := by nlinarith only [hrap.2, hmbp.1, habN] + exact_mod_cast h + have hlogm1 : 1 ≤ Real.log (m : ℝ) := by + have h := Real.log_le_log (Real.exp_pos 1) (hexpN.trans hmbp.1) + simpa only [Real.log_exp] using h + have hk := ceil_approx_condition (show 2 ≤ N by omega) ha.le hb.le hv.le hkN + obtain ⟨hdeg, hweight, hzero, hdecay⟩ := approxPoly_bounds (Nat.cast_nonneg N) hr hm hk + have havN : (N : ℝ) ^ a ≤ (N : ℝ) ^ v := + Real.rpow_le_rpow_of_exponent_le hN1R hav.le + have hsum : (r : ℝ) + k ≤ 4 * (N : ℝ) ^ v := by + nlinarith only [hrap.2, hkvp.2, havN] + refine ⟨approxPoly r m k, ?_, ?_, hzero, ?_⟩ + · exact (by exact_mod_cast hdeg : ((approxPoly r m k).natDegree : ℝ) ≤ (r : ℝ) + k).trans + (hsum.trans hdegN) + · exact hweight.trans (approx_weight_exp hN hsum hcostN) + · intro x hx0 hxm + exact (hdecay x hx0 hxm).trans (approx_decay_exp hr hlogm1 hrap.1) + + +lemma eventually_two_powers_le {a b t : ℝ} (ha : a < t) (hb : b < t) : + ∀ᶠ N : ℕ in atTop, (N:ℝ)^a + (N:ℝ)^b ≤ (N:ℝ)^t := by + filter_upwards [eventually_power_le ha 2,eventually_power_le hb 2] with N haN hbN + linarith + +/-- Every fixed coefficient and prefactor is absorbed by the strict power gaps. -/ +lemma eventually_exp_power_gap {s u v : ℝ} (hs : s < v) (hu : u < v) (hv : 0 < v) + (C ε D K : ℝ) (hC : 0 < C) (hε : 0 < ε) : + ∀ᶠ N : ℕ in atTop, C * Real.exp (K*(N:ℝ)^u - (N:ℝ)^v) ≤ + ε * Real.exp (-(D*(N:ℝ)^s)) := by + filter_upwards [eventually_power_le hv (3*Real.log (C/ε)), + eventually_power_le hu (3*K),eventually_power_le hs (3*D)] with N h0 h1 h2 + simp only [Real.rpow_zero,mul_one] at h0 + calc + _ = ε * Real.exp (Real.log (C/ε) + K*(N:ℝ)^u - (N:ℝ)^v) := by + rw [show Real.log (C/ε) + K*(N:ℝ)^u - (N:ℝ)^v = + Real.log (C/ε) + (K*(N:ℝ)^u - (N:ℝ)^v) by ring, Real.exp_add, + Real.exp_log (div_pos hC hε)] + field_simp + _ ≤ _ := mul_le_mul_of_nonneg_left (Real.exp_le_exp.mpr (by linarith only [h0,h1,h2])) hε.le + +lemma ceil_power_log_bound {N : ℕ} {a : ℝ} (hN : 2 ≤ N) (ha : 0 ≤ a) : + ((⌈(N:ℝ)^a⌉₊:ℝ)+1)*Real.log (N+1) ≤ 6*(N:ℝ)^a*Real.log N := by + have hN1 : (1:ℝ) ≤ N := by exact_mod_cast (show 1 ≤ N by omega) + have hN2 : (2:ℝ) ≤ N := by exact_mod_cast hN + have hp : 1 ≤ (N:ℝ)^a := Real.one_le_rpow hN1 ha + have hc := (ceil_rpow_bounds (show 1 ≤ N by omega) ha).2 + have hl : Real.log (N+1) ≤ 2*Real.log N := by + calc + _ ≤ Real.log ((N:ℝ)^2) := Real.log_le_log (by positivity) (by nlinarith only [hN2]) + _ = _ := by rw [Real.log_pow]; norm_num + have hlog : 0 ≤ Real.log (N+1) := Real.log_nonneg (by linarith only [hN1]) + calc + _ ≤ (3*(N:ℝ)^a)*Real.log (N+1) := mul_le_mul_of_nonneg_right (by linarith) hlog + _ ≤ (3*(N:ℝ)^a)*(2*Real.log N) := mul_le_mul_of_nonneg_left hl (by positivity) + _ = _ := by ring + +lemma eventually_pattern_cost {a s v : ℝ} (ha : 0 ≤ a) (hav : a < v) (hsv : s < v) : + ∀ᶠ N : ℕ in atTop, + (N+1:ℝ)^(⌈(N:ℝ)^a⌉₊+1) * Real.exp (-((N:ℝ)^v)) ≤ Real.exp (-((N:ℝ)^s)) := by + filter_upwards [eventually_power_log_le hav 12,eventually_power_le hsv 2, + eventually_ge_atTop 2] with N hcost htarget hN + have hc := ceil_power_log_bound hN ha + have hp : (N+1:ℝ)^(⌈(N:ℝ)^a⌉₊+1) = + Real.exp (((⌈(N:ℝ)^a⌉₊:ℝ)+1)*Real.log (N+1)) := by + rw [show (⌈(N:ℝ)^a⌉₊:ℝ)+1 = ((⌈(N:ℝ)^a⌉₊+1:ℕ):ℝ) by push_cast; rfl, + Real.exp_nat_mul,Real.exp_log (by positivity)] + rw [hp,← Real.exp_add] + apply Real.exp_le_exp.mpr + linarith only [hc,hcost,htarget] + +lemma eventually_backward_cost {s a u w t : ℝ} (hs : 0 ≤ s) (hsa : s < a) + (hau : a < u) (huw : u < w) (hwt : w < t) : + ∀ᶠ N : ℕ in atTop, + Real.exp ((N:ℝ)^u-(N:ℝ)^w) + Real.exp (-((N:ℝ)^a)) + + (1+Real.exp ((N:ℝ)^u))*Real.exp (-((N:ℝ)^t)) ≤ Real.exp (-2*(N:ℝ)^s) := by + have ha : 0 < a := lt_of_le_of_lt hs hsa + have hsu := hsa.trans hau + have hsw := hsu.trans huw + have hst := hsw.trans hwt + filter_upwards [eventually_exp_power_gap hsw huw (ha.trans (hau.trans huw)) 1 (1/3) 2 1 + zero_lt_one (by norm_num), + eventually_exp_power_gap hsa ha ha 1 (1/3) 2 0 zero_lt_one (by norm_num), + eventually_exp_power_gap hst (huw.trans hwt) (lt_of_le_of_lt hs hst) 2 (1/3) 2 1 + (by norm_num) (by norm_num)] with N h1 h2 h3 + simp only [one_mul,zero_mul,zero_sub] at h1 h2 h3 + have hnon : 1 ≤ Real.exp ((N:ℝ)^u) := Real.one_le_exp (by positivity) + have hlast : (1+Real.exp ((N:ℝ)^u))*Real.exp (-((N:ℝ)^t)) ≤ + 2*Real.exp ((N:ℝ)^u-(N:ℝ)^t) := by + rw [Real.exp_sub,div_eq_mul_inv,← Real.exp_neg] + nlinarith only [hnon,Real.exp_pos (-((N:ℝ)^t))] + have hlast' := hlast.trans h3 + have heq : -(2*(N:ℝ)^s) = -2*(N:ℝ)^s := by ring + rw [heq] at h1 h2 hlast' + linarith only [h1,h2,hlast'] + +end QAC + +end + +end OAI diff --git a/lean/OAI/InformationTheory/QuantumCircuit/Backward.lean b/lean/OAI/InformationTheory/QuantumCircuit/Backward.lean new file mode 100644 index 0000000000000000000000000000000000000000..41185bf4215458e331bf0a0d66e0fe457c434743 --- /dev/null +++ b/lean/OAI/InformationTheory/QuantumCircuit/Backward.lean @@ -0,0 +1,109 @@ +import OAI.InformationTheory.QuantumCircuit.Reflection +import OAI.InformationTheory.QuantumCircuit.Polynomial + +namespace OAI + +noncomputable section +open scoped BigOperators Matrix.Norms.L2Operator Topology +open Matrix Polynomial Filter Asymptotics + +namespace QAC + +lemma conjugate_finset_sum {A ι : Type*} [CStarAlgebra A] (U : A) (s : Finset ι) (f : ι → A) : + conjugate U (∑ i ∈ s, f i) = ∑ i ∈ s, conjugate U (f i) := by + simp only [conjugate,Finset.mul_sum,Finset.sum_mul] + +lemma Count.polynomial_norm_le {N : ℕ} (D : Count N) (p : Polynomial ℝ) : + ‖D.polynomial p‖ ≤ weight N p := by + classical + rw [D.polynomial_eq_sum] + apply (norm_sum_le _ _).trans + change (∑ k ∈ p.support, ‖p.coeff k • D.operator^k‖) ≤ ∑ k ∈ p.support, |p.coeff k| *(N:ℝ)^k + apply Finset.sum_le_sum + intro k _ + rw [norm_smul,Real.norm_eq_abs] + apply mul_le_mul_of_nonneg_left _ (abs_nonneg _) + exact (norm_pow_le _ _).trans (pow_le_pow_left₀ (norm_nonneg _) D.operator_norm_le _) + +lemma Count.monomial_transition {N : ℕ} (D M : Count N) (U : Operator N) (r μ δ : ℝ) + (hδ : 0 ≤ δ) (k : ℕ) (hk : (k:ℝ) ≤ μ) + (hA : ∀ A : Count N, (A.support.card:ℝ) ≤ μ → + ‖M.high r*conjugate U A.zero*M.zero‖ ≤ δ) : + ‖M.high r*conjugate U (D.operator^k)*M.zero‖ ≤ (N:ℝ)^k*δ := by + rw [D.operator_monomials,conjugate_list_sum,← List.sum_map_mul_left,← List.sum_map_mul_right] + have h := list_norm_sum_le_const (selectionSets D.support k) + (fun F => M.high r*conjugate U ((D.flip D.support).restrict F).zero*M.zero) δ (by + intro F hF + apply hA + have hc := ((D.flip D.support).restrict_support_card F).trans (selectionSets_card _ _ F hF) + exact (show (((D.flip D.support).restrict F).support.card:ℝ) ≤ k by exact_mod_cast hc).trans hk) + apply h.trans + rw [selectionSets_length] + apply mul_le_mul_of_nonneg_right _ hδ + exact_mod_cast Nat.pow_le_pow_left (show D.support.card ≤ N by simpa using Finset.card_le_univ D.support) k + +lemma Count.polynomial_transition {N : ℕ} (D M : Count N) (U : Operator N) + (p : Polynomial ℝ) (r μ δ : ℝ) (hδ : 0 ≤ δ) (hp : (p.natDegree:ℝ) ≤ μ) + (hA : ∀ A : Count N, (A.support.card:ℝ) ≤ μ → + ‖M.high r*conjugate U A.zero*M.zero‖ ≤ δ) : + ‖M.high r*conjugate U (D.polynomial p)*M.zero‖ ≤ weight N p*δ := by + classical + rw [D.polynomial_eq_sum,conjugate_finset_sum,Finset.mul_sum,Finset.sum_mul] + simp only [conjugate_smul,mul_smul_comm,smul_mul_assoc] + apply (norm_sum_le _ _).trans + change (∑ k ∈ p.support, ‖p.coeff k • (M.high r*conjugate U (D.operator^k)*M.zero)‖) ≤ + (∑ k ∈ p.support, |p.coeff k| *(N:ℝ)^k)*δ + rw [Finset.sum_mul] + apply Finset.sum_le_sum + intro k hk + rw [norm_smul,Real.norm_eq_abs] + rw [mul_assoc (|p.coeff k|) ((N:ℝ)^k)] + apply mul_le_mul_of_nonneg_left _ (abs_nonneg _) + apply D.monomial_transition M U r μ δ hδ k _ hA + exact (show (k:ℝ) ≤ p.natDegree by exact_mod_cast Polynomial.le_natDegree_of_mem_supp k hk).trans hp + +lemma Count.backward_finite {N : ℕ} (M D : Count N) (U : Operator N) (hU : U ∈ unitary (Operator N)) + (p : Polynomial ℝ) (r b A B E T : ℝ) + (hx : ‖M.high r*conjugate U (D.polynomial p)*M.zero‖ ≤ A) + (hp : ‖D.polynomial p‖ ≤ B) + (he : ‖(D.zero-D.polynomial p)*D.low b‖ ≤ E) + (ht : ‖D.high b*star U*M.zero*U*D.zero‖ ≤ T) : + ‖M.high r*conjugate U D.zero*M.zero‖^2 ≤ A+E+(1+B)*T := by + let Q := conjugate U D.zero + let X := conjugate U (D.polynomial p) + let W := conjugate U (D.high b) + have hQ : IsStarProjection Q := conjugate_projection hU D.zero_projection + have hQn : ‖Q‖ ≤ 1 := IsStarProjection.norm_le _ hQ + have hXn : ‖X‖ ≤ B := by + change ‖U*D.polynomial p*star U‖ ≤ B + rw [norm_unitary_conjugate hU] + exact hp + have hn : ‖Q-X‖ ≤ 1+B := (norm_sub_le _ _).trans (add_le_add hQn hXn) + have hlow : ‖(Q-X)*(1-W)‖ ≤ E := by + have heq : (Q-X)*(1-W) = conjugate U ((D.zero-D.polynomial p)*D.low b) := by + change (conjugate U D.zero-conjugate U (D.polynomial p))*(1-conjugate U (D.high b)) = _ + simp only [Count.low,conjugate_mul hU,conjugate_sub,conjugate_one hU] + rw [heq] + change ‖U*((D.zero-D.polynomial p)*D.low b)*star U‖ ≤ E + rw [norm_unitary_conjugate hU] + exact he + have htail : ‖W*M.zero*Q‖ ≤ T := by + have heq : W*M.zero*Q = conjugate U (D.high b*star U*M.zero*U*D.zero) := by + dsimp only [W,Q,conjugate] + simp only [mul_assoc] + rw [heq] + change ‖U*(D.high b*star U*M.zero*U*D.zero)*star U‖ ≤ T + rw [norm_unitary_conjugate hU] + exact ht + have herr : ‖(Q-X)*M.zero*Q‖ ≤ E+(1+B)*T := by + apply (norm_split_bound (Q-X) W M.zero Q (IsStarProjection.norm_le _ M.zero_projection) hQn).trans + exact add_le_add hlow (mul_le_mul hn htail (norm_nonneg _) ((norm_nonneg _).trans hn)) + have hsquare := projection_transition_square (M.high r) M.zero Q X + (M.high_projection r) M.zero_projection hQ + exact hsquare.trans ((add_le_add hx herr).trans_eq (by ring)) + +end QAC + +end + +end OAI diff --git a/lean/OAI/InformationTheory/QuantumCircuit/Basic.lean b/lean/OAI/InformationTheory/QuantumCircuit/Basic.lean new file mode 100644 index 0000000000000000000000000000000000000000..bfe4b427ad1c1720d9ab5a80a0be98ae65264b67 --- /dev/null +++ b/lean/OAI/InformationTheory/QuantumCircuit/Basic.lean @@ -0,0 +1,73 @@ +import OAI.InformationTheory.QuantumCircuit.Model + +namespace OAI + +noncomputable section +open scoped BigOperators Matrix.Norms.L2Operator symmDiff + +namespace QAC + +/-- The orthogonal projection onto a normalized one-qubit vector. -/ +def rankOne (v : Bit → ℂ) : QubitOperator := fun x y => v x * star (v y) + +/-- The same data describe a product projection and its mismatch count. +Normalization is exactly the sum of the squared moduli being one. -/ +structure Count (N : ℕ) where + support : Finset (Fin N) + vector : Fin N → Bit → ℂ + normalized : ∀ i ∈ support, ∑ b, Complex.normSq (vector i b) = 1 + +namespace Count + +def zero {N : ℕ} (M : Count N) : Operator N := + tensorMatrix fun i => if i ∈ M.support then rankOne (M.vector i) else 1 + +/-- The orthogonal projection specifying precisely the mismatch set F. +It is used only for F contained in the counted support. -/ +def pattern {N : ℕ} (M : Count N) (F : Finset (Fin N)) : Operator N := + tensorMatrix fun i => if i ∈ M.support then + (if i ∈ F then 1 - rankOne (M.vector i) else rankOne (M.vector i)) else 1 + +/-- The spectral projection [M ≥ r], explicitly expanded in its product eigenbasis. -/ +def high {N : ℕ} (M : Count N) (r : ℝ) : Operator N := + ∑ F ∈ M.support.powerset, if r ≤ (F.card : ℝ) then M.pattern F else 0 + +/-- The mismatch operator ∑ᵢ (I - |vᵢ⟩⟨vᵢ|)ᵢ. -/ +def operator {N : ℕ} (M : Count N) : Operator N := + ∑ i ∈ M.support, tensorMatrix fun j => if j = i then 1 - rankOne (M.vector i) else 1 + +end Count + +abbrev LocalLayer (N : ℕ) := Fin N → Matrix.unitaryGroup Bit ℂ + +def localMatrix {N : ℕ} (L : LocalLayer N) : Operator N := + tensorMatrix fun i => (L i : QubitOperator) + +/-- A parallel layer of product-projection reflections, with disjoint supports. -/ +structure ReflectionLayer (N : ℕ) where + gates : List (Count N) + disjoint : gates.Pairwise (fun A B => Disjoint A.support B.support) + +def reflectionMatrix {N : ℕ} (R : ReflectionLayer N) : Operator N := + (R.gates.map fun A => (1 : Operator N) - (2 : ℂ) • A.zero).prod + +/-- The enlarged normal form of depth at most `d`. +Identity local and reflection layers are allowed. -/ +def IsCircuit {N : ℕ} : ℕ → Operator N → Prop + | 0, U => ∃ L : LocalLayer N, U = localMatrix L + | d + 1, U => ∃ (V : Operator N) (R : ReflectionLayer N) (L : LocalLayer N), + IsCircuit d V ∧ U = V * reflectionMatrix R * localMatrix L + +/-- Full uniform localization theorem, including s = 0 and arbitrary t > s. -/ +def LocalizationStatement : Prop := + ∀ (d : ℕ) (s t : ℝ), 0 ≤ s → s < t → + ∃ N₀ : ℕ, ∀ N ≥ N₀, ∀ U : Operator N, IsCircuit d U → + ∀ M D : Count N, + ‖M.high ((N : ℝ) ^ t) * U * D.zero * star U * M.zero‖ ≤ + Real.exp (-((N : ℝ) ^ s)) + +end QAC + +end + +end OAI diff --git a/lean/OAI/InformationTheory/QuantumCircuit/Circuit.lean b/lean/OAI/InformationTheory/QuantumCircuit/Circuit.lean new file mode 100644 index 0000000000000000000000000000000000000000..8a10f88bd3a0c06de3891ed83d677dce43922c55 --- /dev/null +++ b/lean/OAI/InformationTheory/QuantumCircuit/Circuit.lean @@ -0,0 +1,179 @@ +import OAI.InformationTheory.QuantumCircuit.ProductProjection + +namespace OAI + +noncomputable section +open scoped BigOperators Matrix.Norms.L2Operator symmDiff +open Matrix + +namespace QAC + +lemma coe_sum_normSq (v : Bit → ℂ) : + ((∑ b, Complex.normSq (v b) : ℝ) : ℂ) = star v ⬝ᵥ v := by + simp only [Complex.ofReal_sum, dotProduct, Pi.star_apply, Complex.star_def, + mul_comm ((starRingEnd ℂ) _), Complex.mul_conj] + +lemma normalized_mulVec {U : QubitOperator} (hU : U ∈ unitary QubitOperator) + {v : Bit → ℂ} (hv : ∑ b, Complex.normSq (v b) = 1) : + ∑ b, Complex.normSq ((U *ᵥ v) b) = 1 := by + apply Complex.ofReal_injective + rw [coe_sum_normSq, Matrix.star_mulVec, dotProduct_mulVec, Matrix.vecMul_vecMul] + change Matrix.vecMul (star v) (star U * U) ⬝ᵥ v = _ + rw [Unitary.star_mul_self_of_mem hU, Matrix.vecMul_one] + simpa only [dotProduct, Pi.star_apply, Complex.ofReal_one] using normalized_complex hv + +lemma rankOne_mulVec (U : QubitOperator) (v : Bit → ℂ) : + rankOne (U *ᵥ v) = U * rankOne v * star U := by + change Matrix.vecMulVec (U *ᵥ v) (star (U *ᵥ v)) = + U * Matrix.vecMulVec v (star v) * star U + rw [Matrix.mul_vecMulVec, Matrix.vecMulVec_mul, Matrix.star_mulVec] + rfl + +/-- The canonical orthogonal unit vector in a qubit. -/ +def orthogonalVector (v : Bit → ℂ) : Bit → ℂ := ![-star (v 1), star (v 0)] + +lemma orthogonalVector_normalized {v : Bit → ℂ} (hv : ∑ b, Complex.normSq (v b) = 1) : + ∑ b, Complex.normSq (orthogonalVector v b) = 1 := by + simpa [orthogonalVector, Fin.sum_univ_two, Complex.star_def, add_comm] using hv + +lemma rankOne_orthogonalVector {v : Bit → ℂ} (hv : ∑ b, Complex.normSq (v b) = 1) : + rankOne (orthogonalVector v) = 1 - rankOne v := by + have h := normalized_complex hv + simp only [Fin.sum_univ_two, Complex.star_def] at h + ext i j + fin_cases i <;> fin_cases j <;> simp [rankOne, orthogonalVector] + · linear_combination h + · ring + · ring + · linear_combination h + +/-- Conjugation by a local layer preserves the exact count support. -/ +def Count.rotate {N : ℕ} (M : Count N) (L : LocalLayer N) : Count N where + support := M.support + vector i := (L i : QubitOperator) *ᵥ M.vector i + normalized i hi := normalized_mulVec (L i).property (M.normalized i hi) + +lemma Count.rotate_zero {N : ℕ} (M : Count N) (L : LocalLayer N) : + (M.rotate L).zero = localMatrix L * M.zero * star (localMatrix L) := by + classical + dsimp only [Count.zero, Count.rotate, localMatrix] + rw [tensorMatrix_star, tensorMatrix_mul, tensorMatrix_mul] + congr 1 + funext i + by_cases hi : i ∈ M.support + · simp only [ite_eq_left hi] + exact rankOne_mulVec _ _ + · simp only [ite_eq_right hi, mul_one, Unitary.mul_star_self_of_mem (L i).property] + +/-- Flipping any subset of the reference axes is still a count, not an added gate. -/ +def Count.flip {N : ℕ} (M : Count N) (F : Finset (Fin N)) : Count N where + support := M.support + vector i := if i ∈ F then orthogonalVector (M.vector i) else M.vector i + normalized i hi := by + split_ifs + · exact orthogonalVector_normalized (M.normalized i hi) + · exact M.normalized i hi + +lemma Count.flip_zero {N : ℕ} (M : Count N) (F : Finset (Fin N)) : + (M.flip F).zero = M.pattern F := by + classical + dsimp only [Count.zero, Count.flip, Count.pattern] + congr 1 + funext i + split_ifs with hi hF + · exact rankOne_orthogonalVector (M.normalized i hi) + · rfl + · rfl + +lemma localMatrix_unitary {N : ℕ} (L : LocalLayer N) : localMatrix L ∈ unitary (Operator N) := + tensorMatrix_unitary _ (fun i => (L i).property) + +lemma localMatrix_mul {N : ℕ} (L K : LocalLayer N) : + localMatrix L * localMatrix K = localMatrix (fun i => L i * K i) := by + exact tensorMatrix_mul _ _ + +lemma localMatrix_star {N : ℕ} (L : LocalLayer N) : + star (localMatrix L) = localMatrix (fun i => star (L i)) := by + exact tensorMatrix_star _ + +lemma reflection_unitary {N : ℕ} (M : Count N) : + (1 : Operator N) - (2 : ℂ) • M.zero ∈ unitary (Operator N) := by + have h := M.zero_projection.two_mul_sub_one_mem_unitary + have hneg : -(2 * M.zero - 1) ∈ unitary (Operator N) := by + simpa only [Unitary.mem_iff, star_neg, neg_mul_neg] using h + simpa only [two_smul, two_mul, neg_sub] using hneg + +lemma reflectionMatrix_unitary {N : ℕ} (R : ReflectionLayer N) : + reflectionMatrix R ∈ unitary (Operator N) := by + apply (unitary (Operator N)).list_prod_mem + intro U hU + obtain ⟨M, _, rfl⟩ := List.mem_map.mp hU + exact reflection_unitary M + +lemma IsCircuit.mem_unitary {N d : ℕ} {U : Operator N} (hU : IsCircuit d U) : + U ∈ unitary (Operator N) := by + induction d generalizing U with + | zero => obtain ⟨L, rfl⟩ := hU; exact localMatrix_unitary L + | succ d ih => + obtain ⟨V, R, L, hV, rfl⟩ := hU + exact (unitary (Operator N)).mul_mem + ((unitary (Operator N)).mul_mem (ih hV) (reflectionMatrix_unitary R)) (localMatrix_unitary L) + + +lemma IsCircuit.mul_local {N d : ℕ} {U : Operator N} (hU : IsCircuit d U) + (L : LocalLayer N) : IsCircuit d (U * localMatrix L) := by + cases d with + | zero => + obtain ⟨K, rfl⟩ := hU + exact ⟨fun i => K i * L i, localMatrix_mul K L⟩ + | succ d => + obtain ⟨V, R, K, hV, rfl⟩ := hU + exact ⟨V, R, (fun i => K i * L i), hV, by rw [mul_assoc, localMatrix_mul]⟩ + +lemma IsCircuit.mul {N d e : ℕ} {U V : Operator N} + (hU : IsCircuit d U) (hV : IsCircuit e V) : IsCircuit (d + e) (U * V) := by + induction e generalizing V with + | zero => + obtain ⟨L, rfl⟩ := hV + exact hU.mul_local L + | succ e ih => + obtain ⟨W, R, L, hW, rfl⟩ := hV + exact ⟨U * W, R, L, ih hW, by simp only [mul_assoc]⟩ + +lemma star_list_prod_reverse {A B : Type*} [Ring B] [StarRing B] + (f : A → B) (hf : ∀ a, star (f a) = f a) (l : List A) : + star (l.map f).prod = (l.reverse.map f).prod := by + induction l with + | nil => simp + | cons a l ih => simp [List.reverse_cons, List.map_append, List.prod_append, star_mul, hf, ih] + +def ReflectionLayer.reverse {N : ℕ} (R : ReflectionLayer N) : ReflectionLayer N where + gates := R.gates.reverse + disjoint := (R.disjoint.imp (fun h => h.symm)).reverse + +lemma reflectionMatrix_star {N : ℕ} (R : ReflectionLayer N) : + star (reflectionMatrix R) = reflectionMatrix R.reverse := by + apply star_list_prod_reverse + intro M + simp only [star_sub, star_one, star_smul, star_ofNat, M.zero_projection.isSelfAdjoint.star_eq] + +lemma IsCircuit.star_mem {N d : ℕ} {U : Operator N} (hU : IsCircuit d U) : + IsCircuit d (star U) := by + induction d generalizing U with + | zero => + obtain ⟨L, rfl⟩ := hU + exact ⟨fun i => star (L i), localMatrix_star L⟩ + | succ d ih => + obtain ⟨V, R, L, hV, rfl⟩ := hU + have hL : IsCircuit 0 (star (localMatrix L)) := ⟨_, localMatrix_star L⟩ + have hLR : IsCircuit 1 (star (localMatrix L) * reflectionMatrix R.reverse) := by + refine ⟨_, R.reverse, (fun _ => 1), hL, ?_⟩ + simp [localMatrix] + have h := hLR.mul (ih hV) + simpa only [star_mul, reflectionMatrix_star, Nat.add_comm 1, mul_assoc] using h + +end QAC + +end + +end OAI diff --git a/lean/OAI/InformationTheory/QuantumCircuit/CommonAxes.lean b/lean/OAI/InformationTheory/QuantumCircuit/CommonAxes.lean new file mode 100644 index 0000000000000000000000000000000000000000..08a1b7cb3fb6380334043cc6800978b146fc0997 --- /dev/null +++ b/lean/OAI/InformationTheory/QuantumCircuit/CommonAxes.lean @@ -0,0 +1,72 @@ +import OAI.InformationTheory.QuantumCircuit.RegularApproximation + +namespace OAI + +/-! Product counts sharing the same local axes. -/ + +noncomputable section +open scoped BigOperators Matrix.Norms.L2Operator + +namespace QAC + +lemma jointTest_subcount_of {N : ℕ} (l : List (Count N)) (M : Count N) + (h : ∀ A ∈ l, A.Subcount M) : (jointTest l).Subcount M := by + induction l with + | nil => exact ⟨Finset.empty_subset _, by simp [jointTest, Count.empty]⟩ + | cons A l ih => + exact (h A (List.mem_cons_self ..)).join + (ih (fun B hb => h B (List.mem_cons_of_mem _ hb))) + +lemma Count.compatible_zero_pattern_commute {N : ℕ} (A B : Count N) + (h : ∀ i ∈ A.support, i ∈ B.support → A.vector i = B.vector i) + (F : Finset (Fin N)) : Commute A.zero (B.pattern F) := by + classical + change A.zero * B.pattern F = B.pattern F * A.zero + unfold Count.zero Count.pattern + rw [tensorMatrix_mul, tensorMatrix_mul] + congr 1 + funext i + by_cases ha : i ∈ A.support + · by_cases hb : i ∈ B.support + · by_cases hf : i ∈ F <;> simp [ha, hb, hf, h i ha hb, mul_sub, sub_mul] + · simp [ha, hb] + · simp [ha] + +lemma Count.compatible_zero_high_commute {N : ℕ} (A B : Count N) + (h : ∀ i ∈ A.support, i ∈ B.support → A.vector i = B.vector i) + (r : ℝ) : Commute A.zero (B.high r) := by + classical + change A.zero * B.high r = B.high r * A.zero + rw [Count.high, Finset.mul_sum, Finset.sum_mul] + apply Finset.sum_congr rfl + intro F _ + split_ifs + · exact (A.compatible_zero_pattern_commute B h F).eq + · simp + +lemma reflection_joint_high_commute {N : ℕ} (R : ReflectionLayer N) + (S : List (Count N)) (hS : S.Sublist R.gates) (r : ℝ) : + Commute (reflectionMatrix R) ((jointTest S).high r) := by + rw [reflectionMatrix_eq] + apply Commute.list_prod_left + intro x hx + obtain ⟨A, hA, rfl⟩ := List.mem_map.mp hx + have hA' := jointTest_subcount R.gates R.disjoint A hA + have hB' := jointTest_subcount_of S (jointTest R.gates) + (fun B hB => jointTest_subcount R.gates R.disjoint B (hS.subset hB)) + exact (Commute.one_left _).sub_left + ((A.compatible_zero_high_commute _ (fun i hi hj => + (hA'.2 i hi).trans (hB'.2 i hj).symm) r).smul_left (2 : ℝ)) + +lemma reflection_joint_tail_eq {N : ℕ} (R : ReflectionLayer N) + (S : List (Count N)) (hS : S.Sublist R.gates) (r : ℝ) (ψ : State N) : + ‖act ((jointTest S).high r) (act (reflectionMatrix R) ψ)‖ = + ‖act ((jointTest S).high r) ψ‖ := by + rw [← act_mul, ← (reflection_joint_high_commute R S hS r).eq, act_mul] + exact act_unitary_norm (reflectionMatrix_unitary R) _ + +end QAC + +end + +end OAI diff --git a/lean/OAI/InformationTheory/QuantumCircuit/Computational.lean b/lean/OAI/InformationTheory/QuantumCircuit/Computational.lean new file mode 100644 index 0000000000000000000000000000000000000000..1eeade2cf3261a0c2afb122a8beaa1b96984bb26 --- /dev/null +++ b/lean/OAI/InformationTheory/QuantumCircuit/Computational.lean @@ -0,0 +1,187 @@ +import OAI.InformationTheory.QuantumCircuit.Toffoli +import OAI.InformationTheory.QuantumCircuit.Spectral + +namespace OAI + +noncomputable section +open scoped BigOperators Matrix.Norms.L2Operator Topology +open Matrix Polynomial Filter Asymptotics + +namespace QAC + +lemma matrix_entry_norm_le {ι : Type*} [Fintype ι] [DecidableEq ι] (A : Matrix ι ι ℂ) (i j : ι) : + ‖A i j‖ ≤ ‖A‖ := by + classical + let v : EuclideanSpace ℂ ι := WithLp.toLp 2 (Pi.single j 1) + have h := A.l2_opNorm_mulVec v + have he := PiLp.norm_apply_le ((EuclideanSpace.equiv ι ℂ).symm (A *ᵥ v)) i + have hv : ‖v‖=1 := by simp [v] + rw [hv,mul_one] at h + apply le_trans _ h + simpa [v,Matrix.mulVec,dotProduct,Pi.single_apply] using he + +lemma tensorMatrix_diagonal {N : ℕ} (f : Fin N → Bit → ℂ) : + tensorMatrix (fun i => Matrix.diagonal (f i)) = Matrix.diagonal (fun x => ∏ i, f i (x i)) := by + classical + ext x y + simp only [tensorMatrix,Matrix.diagonal_apply] + by_cases hxy : x=y + · subst y; simp + · simp only [ite_eq_right hxy] + obtain ⟨i,hi⟩ := Function.ne_iff.mp hxy + exact Finset.prod_eq_zero (Finset.mem_univ i) (by simp [hi]) + +lemma rankOne_basis_diagonal (b : Bit) : + rankOne (basisVector b) = Matrix.diagonal (fun x => if x=b then 1 else 0) := by + ext x y + rw [rankOne_basis,Matrix.diagonal_apply] + split_ifs <;> simp_all + +lemma one_sub_rankOne_basis (b : Bit) : + 1-rankOne (basisVector b) = rankOne (basisVector (1-b)) := by + ext x y + simp only [Matrix.sub_apply,Matrix.one_apply,rankOne_basis] + fin_cases b <;> fin_cases x <;> fin_cases y <;> norm_num + +/-- A full computational-basis count. -/ +def computationalCount {N : ℕ} (z : Word N) : Count N where + support := Finset.univ + vector i := basisVector (z i) + normalized i _ := basisVector_normalized (z i) + +def basisProjection {N : ℕ} (z : Word N) : Operator N := + Matrix.diagonal (fun x => if x=z then 1 else 0) + +lemma computationalCount_zero {N : ℕ} (z : Word N) : (computationalCount z).zero=basisProjection z := by + classical + simp only [Count.zero,computationalCount,Finset.mem_univ,ite_true,rankOne_basis_diagonal] + rw [tensorMatrix_diagonal] + congr 1 + funext x + rw [Fintype.prod_boole] + simp only [funext_iff] + split_ifs <;> rfl + +/-- Complement selected computational bits. -/ +def flipWord {N : ℕ} (F : Finset (Fin N)) (z : Word N) : Word N := + fun i => if i ∈ F then 1-z i else z i + +lemma flipWord_involutive {N : ℕ} (F : Finset (Fin N)) : Function.Involutive (flipWord F) := by + intro z + funext i + simp only [flipWord] + split_ifs + · generalize z i = b + fin_cases b <;> decide + · rfl + +lemma computationalCount_pattern {N : ℕ} (z : Word N) (F : Finset (Fin N)) : + (computationalCount z).pattern F = basisProjection (flipWord F z) := by + classical + rw [← computationalCount_zero] + simp only [Count.pattern,Count.zero,computationalCount,Finset.mem_univ,ite_true] + congr 1 + funext i + by_cases hi : i∈F + · simp only [ite_eq_left hi,flipWord] + exact one_sub_rankOne_basis (z i) + · simp [hi,flipWord] + +lemma basisProjection_mul_entry {N : ℕ} (z : Word N) (A : Operator N) (y : Word N) : + (basisProjection z*A) z y = A z y := by + classical + simp [basisProjection,Matrix.diagonal_mul] + +lemma mul_basisProjection_entry {N : ℕ} (z : Word N) (A : Operator N) (y : Word N) : + (A*basisProjection z) y z = A y z := by + classical + simp [basisProjection,Matrix.mul_diagonal] + +lemma high_entry_bound {N : ℕ} (B : Operator N) (z : Word N) (F : Finset (Fin N)) + {r : ℝ} (hr : r ≤ (F.card:ℝ)) : + ‖B (flipWord F z) z‖ ≤ ‖(computationalCount z).high r*B*(computationalCount z).zero‖ := by + let y := flipWord F z + have habs := (computationalCount z).high_mul_pattern F (Finset.subset_univ F) r + rw [ite_eq_left hr,computationalCount_pattern] at habs + have hleft : basisProjection y*(computationalCount z).high r = basisProjection y := by + have h := congrArg star habs + rw [star_mul, ((computationalCount z).high_projection r).isSelfAdjoint.star_eq] at h + change star (basisProjection y)*(computationalCount z).high r = star (basisProjection y) at h + simpa only [← computationalCount_zero, + (computationalCount y).zero_projection.isSelfAdjoint.star_eq, + ((computationalCount z).high_projection r).isSelfAdjoint.star_eq] using h + have heq : ((computationalCount z).high r*B*basisProjection z) y z = B y z := by + rw [← basisProjection_mul_entry y ((computationalCount z).high r*B*basisProjection z) z] + rw [← mul_assoc,← mul_assoc,hleft,mul_basisProjection_entry,basisProjection_mul_entry] + rw [computationalCount_zero] + exact heq ▸ matrix_entry_norm_le ((computationalCount z).high r*B*basisProjection z) y z + +/-- Input positions; ancillas occupy the other positions. -/ +def inputSet (n N : ℕ) : Finset (Fin N) := Finset.univ.filter (fun i => i.val (bitSign b:ℂ)) +def bitH : QubitOperator := !![(halfScale:ℂ),(halfScale:ℂ);(halfScale:ℂ),-(halfScale:ℂ)] + +lemma halfScale_complex_sq : (halfScale:ℂ)^2=1/2 := by + rw [← Complex.ofReal_pow,halfScale_sq] + norm_num + +lemma bitH_star : star bitH=bitH := by + ext i j + fin_cases i <;> fin_cases j <;> simp [bitH,Matrix.star_apply] + +lemma bitH_sq : bitH*bitH=1 := by + ext i j + fin_cases i <;> fin_cases j <;> + simp [bitH,Matrix.mul_apply,Fin.sum_univ_two] + all_goals linear_combination 2*halfScale_complex_sq + +lemma bitH_unitary : bitH ∈ unitary QubitOperator := by + simp only [Unitary.mem_iff,bitH_star,bitH_sq,and_self] + +def hadamardGate : Matrix.unitaryGroup Bit ℂ := ⟨bitH,bitH_unitary⟩ + +lemma bitH_X_H : bitH*bitX*bitH=bitZ := by + ext i j + fin_cases i <;> fin_cases j <;> + simp [bitH,bitX,bitZ,bitSign,Matrix.mul_apply,Fin.sum_univ_two] + all_goals first | linear_combination 2*halfScale_complex_sq | linear_combination -2*halfScale_complex_sq + +def inputHadamard (n N : ℕ) : LocalLayer N := fun i => if i.val if i.val if i.val c i • a i) = (∏ i, c i) • tensorMatrix a := by + ext x y + simp only [tensorMatrix, Matrix.smul_apply, Complex.real_smul, Finset.prod_mul_distrib, + Complex.ofReal_prod] + +open scoped MatrixOrder in +lemma tensorMatrix_nonneg {N : ℕ} (a : Fin N → QubitOperator) (ha : ∀ i, 0 ≤ a i) : + 0 ≤ tensorMatrix a := by + choose b hb using fun i => CStarAlgebra.nonneg_iff_eq_star_mul_self.mp (ha i) + have h : tensorMatrix a = star (tensorMatrix b) * tensorMatrix b := by + rw [tensorMatrix_star, tensorMatrix_mul] + congr 1 + funext i + exact hb i + rw [h] + exact star_mul_self_nonneg _ + +open scoped MatrixOrder in +lemma tensorMatrix_le_one {N : ℕ} (a : Fin N → QubitOperator) + (ha : ∀ i, 0 ≤ a i) (ha1 : ∀ i, a i ≤ 1) : tensorMatrix a ≤ 1 := by + classical + have hsum := tensorMatrix_sum_patterns (Finset.univ : Finset (Fin N)) + (fun i => 1 - a i) a (fun _ => 1) + simp only [Finset.mem_univ, ite_true, sub_add_cancel, tensorMatrix_one] at hsum + rw [← hsum] + have hmem : (∅ : Finset (Fin N)) ∈ Finset.univ.powerset := Finset.mem_powerset.mpr (Finset.empty_subset _) + have h := Finset.single_le_sum (fun F (_ : F ∈ (Finset.univ : Finset (Fin N)).powerset) => + tensorMatrix_nonneg (fun i => if i ∈ F then 1 - a i else a i) + (fun i => by split_ifs; exact sub_nonneg.mpr (ha1 i); exact ha i)) hmem + simpa only [Finset.notMem_empty, ite_false] using h + +def Count.empty {N : ℕ} : Count N where + support := ∅ + vector := fun _ _ => 0 + normalized := by simp + +@[simp] lemma Count.empty_zero {N : ℕ} : (Count.empty : Count N).zero = 1 := by + simp [Count.zero, Count.empty] + +def Count.join {N : ℕ} (A B : Count N) : Count N where + support := A.support ∪ B.support + vector i := if i ∈ A.support then A.vector i else B.vector i + normalized i hi := by + classical + split_ifs with hA + · exact A.normalized i hA + · exact B.normalized i ((Finset.mem_union.mp hi).resolve_left hA) + +lemma Count.join_zero {N : ℕ} (A B : Count N) (h : Disjoint A.support B.support) : + (A.join B).zero = A.zero * B.zero := by + classical + dsimp only [Count.zero, Count.join] + rw [tensorMatrix_mul] + congr 1 + funext i + by_cases hA : i ∈ A.support + · have hB : i ∉ B.support := Finset.disjoint_left.mp h hA + simp [hA, hB] + · by_cases hB : i ∈ B.support <;> simp [hA, hB] + +lemma Count.disjoint_commute {N : ℕ} (A B : Count N) (h : Disjoint A.support B.support) : + Commute A.zero B.zero := by + classical + show A.zero * B.zero = B.zero * A.zero + dsimp only [Count.zero] + rw [tensorMatrix_mul, tensorMatrix_mul] + congr 1 + funext i + by_cases hA : i ∈ A.support + · have hB : i ∉ B.support := Finset.disjoint_left.mp h hA + simp [hA, hB] + · simp [hA] + +/-- Subcounts with the same axes, allowing repeated monomial indices to collapse. -/ +def Count.restrict {N : ℕ} (M : Count N) (S : Finset (Fin N)) : Count N where + support := M.support ∩ S + vector := M.vector + normalized i hi := M.normalized i (Finset.mem_inter.mp hi).1 + +lemma Count.restrict_zero_mul {N : ℕ} (M : Count N) (S T : Finset (Fin N)) : + (M.restrict S).zero * (M.restrict T).zero = (M.restrict (S ∪ T)).zero := by + classical + dsimp only [Count.zero, Count.restrict] + rw [tensorMatrix_mul] + congr 1 + funext i + by_cases hi : i ∈ M.support + · by_cases hS : i ∈ S <;> by_cases hT : i ∈ T <;> + simp [hi, hS, hT, (rankOne_projection (M.normalized i hi)).isIdempotentElem.eq] + · simp [hi] + +lemma Count.restrict_support_card {N : ℕ} (M : Count N) (S : Finset (Fin N)) : + (M.restrict S).support.card ≤ S.card := Finset.card_le_card Finset.inter_subset_right + +end QAC + +end + +end OAI diff --git a/lean/OAI/InformationTheory/QuantumCircuit/Degree.lean b/lean/OAI/InformationTheory/QuantumCircuit/Degree.lean new file mode 100644 index 0000000000000000000000000000000000000000..30389207aeb332fdb25dd01830db337c80b23be9 --- /dev/null +++ b/lean/OAI/InformationTheory/QuantumCircuit/Degree.lean @@ -0,0 +1,139 @@ +import OAI.InformationTheory.QuantumCircuit.Trajectory + +namespace OAI + +/-! Local support and degree bounds for quantum operators. -/ + +noncomputable section +open scoped BigOperators Matrix.Norms.L2Operator +open Polynomial + +namespace QAC + +def TensorSupported {N : ℕ} (J : Finset (Fin N)) (A : Operator N) : Prop := + ∃ a : Fin N → QubitOperator, A = tensorMatrix a ∧ ∀ i ∉ J, a i = 1 + +def degreeSpace (N : ℕ) (r : ℝ) : Submodule ℂ (Operator N) := + Submodule.span ℂ {A | ∃ J : Finset (Fin N), (J.card : ℝ) ≤ r ∧ TensorSupported J A} + +def HasDegreeLE {N : ℕ} (A : Operator N) (r : ℝ) : Prop := A ∈ degreeSpace N r + +lemma HasDegreeLE.mono {N : ℕ} {A : Operator N} {r s : ℝ} + (h : HasDegreeLE A r) (hrs : r ≤ s) : HasDegreeLE A s := by + apply Submodule.span_mono ?_ h + rintro A ⟨J, hJ, ha⟩ + exact ⟨J, hJ.trans hrs, ha⟩ + +lemma tensor_hasDegreeLE {N : ℕ} (J : Finset (Fin N)) (A : Operator N) + (hA : TensorSupported J A) {r : ℝ} (hr : (J.card : ℝ) ≤ r) : HasDegreeLE A r := + Submodule.subset_span ⟨J, hr, hA⟩ + +lemma degree_zero {N : ℕ} (r : ℝ) : HasDegreeLE (0 : Operator N) r := + (degreeSpace N r).zero_mem + +lemma degree_one {N : ℕ} {r : ℝ} (hr : 0 ≤ r) : HasDegreeLE (1 : Operator N) r := by + apply tensor_hasDegreeLE ∅ _ _ (by simpa using hr) + exact ⟨fun _ => 1, tensorMatrix_one.symm, by simp⟩ + +lemma HasDegreeLE.add {N : ℕ} {A B : Operator N} {r : ℝ} + (hA : HasDegreeLE A r) (hB : HasDegreeLE B r) : HasDegreeLE (A + B) r := + (degreeSpace N r).add_mem hA hB + +lemma HasDegreeLE.smul {N : ℕ} {A : Operator N} {r : ℝ} + (hA : HasDegreeLE A r) (c : ℂ) : HasDegreeLE (c • A) r := + (degreeSpace N r).smul_mem c hA + +lemma degree_sum {N : ℕ} {ι : Type*} (s : Finset ι) (A : ι → Operator N) {r : ℝ} + (hA : ∀ i ∈ s, HasDegreeLE (A i) r) : HasDegreeLE (∑ i ∈ s, A i) r := + (degreeSpace N r).sum_mem hA + +lemma degree_list_sum {N : ℕ} (l : List (Operator N)) {r : ℝ} + (hl : ∀ A ∈ l, HasDegreeLE A r) : HasDegreeLE l.sum r := by + induction l with + | nil => exact degree_zero r + | cons A l ih => + exact (hl A (List.mem_cons_self ..)).add + (ih (fun B hB => hl B (List.mem_cons_of_mem A hB))) + +lemma TensorSupported.mul {N : ℕ} {J K : Finset (Fin N)} {A B : Operator N} + (hA : TensorSupported J A) (hB : TensorSupported K B) : TensorSupported (J ∪ K) (A * B) := by + rcases hA with ⟨a, rfl, ha⟩ + rcases hB with ⟨b, rfl, hb⟩ + refine ⟨fun i => a i * b i, tensorMatrix_mul a b, ?_⟩ + intro i hi + have hiJ : i ∉ J := fun h => hi (Finset.mem_union_left K h) + have hiK : i ∉ K := fun h => hi (Finset.mem_union_right J h) + simp only [ha i hiJ, hb i hiK, one_mul] + +lemma HasDegreeLE.mul {N : ℕ} {A B : Operator N} {r s : ℝ} + (hA : HasDegreeLE A r) (hB : HasDegreeLE B s) : HasDegreeLE (A * B) (r + s) := by + induction hA using Submodule.span_induction with + | mem A hA => + rcases hA with ⟨J, hJ, ha⟩ + induction hB using Submodule.span_induction with + | mem B hB => + rcases hB with ⟨K, hK, hb⟩ + apply tensor_hasDegreeLE (J ∪ K) _ (ha.mul hb) + have hcard : ((J ∪ K).card : ℝ) ≤ J.card + K.card := by + exact_mod_cast Finset.card_union_le J K + exact hcard.trans (add_le_add hJ hK) + | zero => simpa only [mul_zero] using degree_zero (N := N) (r + s) + | add B C _ _ hb hc => simpa only [mul_add] using hb.add hc + | smul c B _ hb => simpa only [mul_smul_comm] using hb.smul c + | zero => simpa only [zero_mul] using degree_zero (N := N) (r + s) + | add A C _ _ ha hc => simpa only [add_mul] using ha.add hc + | smul c A _ ha => simpa only [smul_mul_assoc] using ha.smul c + +lemma HasDegreeLE.pow {N : ℕ} {A : Operator N} {r : ℝ} + (hA : HasDegreeLE A r) (k : ℕ) : HasDegreeLE (A ^ k) ((k : ℝ) * r) := by + induction k with + | zero => simpa using degree_one (N := N) (le_refl (0 : ℝ)) + | succ k ih => + simpa only [pow_succ, Nat.cast_add, Nat.cast_one, add_mul, one_mul] using ih.mul hA + +lemma Count.zero_degree {N : ℕ} (A : Count N) : + HasDegreeLE A.zero (A.support.card : ℝ) := by + apply tensor_hasDegreeLE A.support _ _ le_rfl + exact ⟨_, rfl, by intro i hi; simp [hi]⟩ + +lemma Count.operator_degree {N : ℕ} (A : Count N) : HasDegreeLE A.operator 1 := by + apply degree_sum + intro i _ + apply tensor_hasDegreeLE {i} _ _ (by simp) + exact ⟨_, rfl, by intro j hj; simp only [Finset.mem_singleton] at hj; simp [hj]⟩ + +lemma Count.polynomial_degree {N : ℕ} (A : Count N) (p : ℝ[X]) : + HasDegreeLE (A.polynomial p) (p.natDegree : ℝ) := by + rw [A.polynomial_eq_sum] + apply degree_sum + intro k hk + have hk' : (k : ℝ) ≤ p.natDegree := by exact_mod_cast le_natDegree_of_ne_zero (mem_support_iff.mp hk) + change HasDegreeLE ((p.coeff k : ℂ) • A.operator ^ k) (p.natDegree : ℝ) + exact ((A.operator_degree.pow k).mono (by simpa using hk')).smul _ + +lemma TensorSupported.local_conjugate {N : ℕ} {J : Finset (Fin N)} + {A : Operator N} (hA : TensorSupported J A) (L : LocalLayer N) : + TensorSupported J (conjugate (localMatrix L) A) := by + rcases hA with ⟨a, rfl, ha⟩ + refine ⟨fun i => (L i : QubitOperator) * a i * star (L i : QubitOperator), ?_, ?_⟩ + · simp only [conjugate, localMatrix, tensorMatrix_star, tensorMatrix_mul] + · intro i hi + change (L i : QubitOperator) * a i * star (L i : QubitOperator) = 1 + rw [ha i hi, mul_one, Unitary.mul_star_self_of_mem (L i).property] + +lemma HasDegreeLE.local_conjugate {N : ℕ} {A : Operator N} {r : ℝ} + (hA : HasDegreeLE A r) (L : LocalLayer N) : + HasDegreeLE (conjugate (localMatrix L) A) r := by + induction hA using Submodule.span_induction with + | mem A hA => + rcases hA with ⟨J, hJ, ha⟩ + exact tensor_hasDegreeLE J _ (ha.local_conjugate L) hJ + | zero => simpa [conjugate] using degree_zero (N := N) r + | add A B _ _ ha hb => simpa [conjugate, mul_add, add_mul] using ha.add hb + | smul c A _ ha => simpa [conjugate, mul_smul_comm, smul_mul_assoc] using ha.smul c + +end QAC + +end + +end OAI diff --git a/lean/OAI/InformationTheory/QuantumCircuit/DepthZero.lean b/lean/OAI/InformationTheory/QuantumCircuit/DepthZero.lean new file mode 100644 index 0000000000000000000000000000000000000000..e00ee468ec31f8347d845391d176470bd771db7d --- /dev/null +++ b/lean/OAI/InformationTheory/QuantumCircuit/DepthZero.lean @@ -0,0 +1,200 @@ +import OAI.InformationTheory.QuantumCircuit.Count + +namespace OAI + +noncomputable section +open scoped BigOperators Matrix.Norms.L2Operator symmDiff +open Matrix + +namespace QAC + +lemma rankOne_sandwich (v w : Bit → ℂ) : + rankOne v * rankOne w * rankOne v = + Complex.normSq (star w ⬝ᵥ v) • rankOne v := by + ext i j + simp only [rankOne, Matrix.mul_apply, Fin.sum_univ_two, Matrix.smul_apply, + Complex.real_smul, ← Complex.mul_conj, dotProduct, Pi.star_apply, + Fin.sum_univ_two, map_add, map_mul, Complex.conj_conj, Complex.star_def] + ring + +open scoped MatrixOrder in +lemma rankOne_markov_le (v w : Bit → ℂ) + (hv : ∑ b, Complex.normSq (v b) = 1) + (hw : ∑ b, Complex.normSq (w b) = 1) : + rankOne v * rankOne w * ((2:ℝ) • (1 - rankOne v) + rankOne v) * rankOne w * rankOne v ≤ 1 := by + let P := rankOne v + let Q := rankOne w + let c : ℝ := Complex.normSq (star w ⬝ᵥ v) + have hP := rankOne_projection hv + have hQ := rankOne_projection hw + have hPQ : P * Q * P = c • P := rankOne_sandwich v w + have hid : P * Q * ((2:ℝ) • (1 - P) + P) * Q * P = (2*c-c^2) • P := by + have h1 : P * Q * Q * P = c • P := by rw [mul_assoc P Q Q, hQ.isIdempotentElem.eq, hPQ] + have h2 : P * Q * P * Q * P = c^2 • P := by + rw [hPQ, smul_mul_assoc, smul_mul_assoc, hPQ, smul_smul, pow_two] + calc + _ = (2:ℝ) • (P * Q * Q * P) - P * Q * P * Q * P := by + simp only [two_smul, mul_add, add_mul, mul_sub, sub_mul, mul_one] + abel + _ = _ := by rw [h1, h2, smul_smul, ← sub_smul] + change P * Q * ((2:ℝ) • (1 - P) + P) * Q * P ≤ 1 + rw [hid] + apply sub_nonneg.mp + have heq : 1 - (2*c-c^2) • P = (1-P) + (1-c)^2 • P := by + have hc : (1-c)^2 = 1-(2*c-c^2) := by ring + simp only [hc, sub_smul, one_smul] + abel + rw [heq] + exact add_nonneg hP.one_sub.nonneg (smul_nonneg (sq_nonneg _) hP.nonneg) + +lemma tensorMatrix_pattern_scale {N : ℕ} (M : Count N) (F : Finset (Fin N)) + (hF : F ⊆ M.support) (z : ℝ) : + tensorMatrix (fun i => if i ∈ M.support then + (if i ∈ F then z • (1 - rankOne (M.vector i)) else rankOne (M.vector i)) else 1) = + z ^ F.card • M.pattern F := by + classical + have heq : (fun i => if i ∈ M.support then + (if i ∈ F then z • (1 - rankOne (M.vector i)) else rankOne (M.vector i)) else 1) = + (fun i => (if i ∈ F then z else 1) • + (if i ∈ M.support then (if i ∈ F then 1 - rankOne (M.vector i) else rankOne (M.vector i)) else 1)) := by + funext i + by_cases hiF : i ∈ F + · simp [hiF, hF hiF] + · simp [hiF] + rw [heq, tensorMatrix_smul] + congr 1 + simp + +/-- The generating function of the mismatch spectral partition. -/ +lemma Count.spectral_power_tensor {N : ℕ} (M : Count N) (z : ℝ) : + (∑ F ∈ M.support.powerset, z ^ F.card • M.pattern F) = + tensorMatrix (fun i => if i ∈ M.support then + z • (1 - rankOne (M.vector i)) + rankOne (M.vector i) else 1) := by + classical + rw [← tensorMatrix_sum_patterns M.support] + apply Finset.sum_congr rfl + intro F hF + exact (tensorMatrix_pattern_scale M F (Finset.mem_powerset.mp hF) z).symm + +open scoped MatrixOrder in +lemma Count.high_le_generating {N : ℕ} (M : Count N) (r : ℝ) : + M.high r ≤ (2 : ℝ) ^ (-r) • + (∑ F ∈ M.support.powerset, (2 : ℝ)^F.card • M.pattern F) := by + classical + rw [Finset.smul_sum] + unfold Count.high + apply Finset.sum_le_sum + intro F _ + rw [smul_smul] + by_cases hr : r ≤ F.card + · rw [ite_eq_left hr] + nth_rw 1 [← one_smul ℝ (M.pattern F)] + apply smul_le_smul_of_nonneg_right _ (M.pattern_projection F).nonneg + rw [← Real.rpow_natCast, ← Real.rpow_add (by norm_num : (0:ℝ)<2)] + exact Real.one_le_rpow (by norm_num) (by linarith) + · rw [ite_eq_right hr] + exact smul_nonneg (by positivity) (M.pattern_projection F).nonneg + + +/-- Single-site factor of a product projection. -/ +def Count.site {N : ℕ} (M : Count N) (i : Fin N) : QubitOperator := + if i ∈ M.support then rankOne (M.vector i) else 1 + +lemma Count.site_projection {N : ℕ} (M : Count N) (i : Fin N) : IsStarProjection (M.site i) := by + classical + dsimp [Count.site] + split_ifs with hi + · exact rankOne_projection (M.normalized i hi) + · exact IsStarProjection.one _ + +open scoped MatrixOrder in +lemma projection_markov_nonneg {A : Type*} [Ring A] [StarRing A] [PartialOrder A] + [StarOrderedRing A] [Algebra ℝ A] [IsOrderedModule ℝ A] + (P Q : A) (hP : IsStarProjection P) (hQ : IsStarProjection Q) : + 0 ≤ P * Q * ((2:ℝ) • (1-P)+P) * Q * P := by + have hn : 0 ≤ (2:ℝ) • (1-P)+P := + add_nonneg (smul_nonneg (by norm_num) hP.one_sub.nonneg) hP.nonneg + simpa only [star_mul, hQ.isSelfAdjoint.star_eq, hP.isSelfAdjoint.star_eq, mul_assoc] using + star_right_conjugate_nonneg hn (P*Q) + +lemma projection_markov_self {A : Type*} [Ring A] [Module ℝ A] [SMulCommClass ℝ A A] + {P : A} (hP : IsIdempotentElem P) : P * ((2:ℝ) • (1-P)+P) * P = P := by + have hc : P * (1-P) = 0 := by rw [mul_sub,mul_one,hP.eq,sub_self] + simp only [mul_add, mul_smul_comm, hc, smul_zero, zero_add, hP.eq] + +open scoped MatrixOrder in +lemma Count.markov_site_le {N : ℕ} (M D : Count N) (i : Fin N) : + M.site i * D.site i * ((2:ℝ) • (1-M.site i)+M.site i) * D.site i * M.site i ≤ 1 := by + classical + by_cases hM : i ∈ M.support + · by_cases hD : i ∈ D.support + · simp only [Count.site, ite_eq_left hM, ite_eq_left hD] + exact rankOne_markov_le _ _ (M.normalized i hM) (D.normalized i hD) + · simp only [Count.site, ite_eq_left hM, ite_eq_right hD, mul_one] + rw [projection_markov_self (rankOne_projection (M.normalized i hM)).isIdempotentElem] + exact (rankOne_projection (M.normalized i hM)).le_one + · have heq : M.site i = 1 := ite_eq_right hM + rw [heq] + simp only [sub_self, smul_zero, zero_add, one_mul, mul_one, + (D.site_projection i).isIdempotentElem.eq] + exact (D.site_projection i).le_one + +lemma Count.generating_eq_sites {N : ℕ} (M : Count N) : + (∑ F ∈ M.support.powerset, (2 : ℝ)^F.card • M.pattern F) = + tensorMatrix (fun i => (2:ℝ) • (1-M.site i)+M.site i) := by + classical + rw [M.spectral_power_tensor] + congr 1 + funext i + by_cases hi : i ∈ M.support <;> simp [Count.site,hi] + +open scoped MatrixOrder in +lemma Count.markov_sandwich_le {N : ℕ} (M D : Count N) : + M.zero * D.zero * (∑ F ∈ M.support.powerset, (2 : ℝ)^F.card • M.pattern F) * + D.zero * M.zero ≤ 1 := by + rw [M.generating_eq_sites] + change tensorMatrix M.site * tensorMatrix D.site * + tensorMatrix (fun i => (2:ℝ) • (1-M.site i)+M.site i) * + tensorMatrix D.site * tensorMatrix M.site ≤ 1 + simp only [tensorMatrix_mul] + exact tensorMatrix_le_one _ + (fun i => projection_markov_nonneg _ _ (M.site_projection i) (D.site_projection i)) + (fun i => M.markov_site_le D i) + +open scoped MatrixOrder in +lemma Count.depth_zero_square {N : ℕ} (M D : Count N) (r : ℝ) : + ‖M.high r * D.zero * M.zero‖^2 ≤ (2 : ℝ)^(-r) := by + let A := M.high r * D.zero * M.zero + have heq : star A * A = M.zero * D.zero * M.high r * D.zero * M.zero := by + dsimp [A] + simp only [star_mul, M.zero_projection.isSelfAdjoint.star_eq, + D.zero_projection.isSelfAdjoint.star_eq, (M.high_projection r).isSelfAdjoint.star_eq] + simp only [mul_assoc] + rw [← mul_assoc (M.high r) (M.high r), (M.high_projection r).isIdempotentElem.eq] + have h := star_right_conjugate_le_conjugate (M.high_le_generating r) (M.zero * D.zero) + simp only [star_mul, M.zero_projection.isSelfAdjoint.star_eq, + D.zero_projection.isSelfAdjoint.star_eq, mul_smul_comm, smul_mul_assoc] at h + have hbound : star A * A ≤ (2 : ℝ)^(-r) • (1 : Operator N) := by + rw [heq] + exact le_trans (by simpa only [mul_assoc] using h) + (smul_le_smul_of_nonneg_left (M.markov_sandwich_le D) (by positivity)) + have hn := (CStarAlgebra.norm_le_iff_le_algebraMap (star A * A) (by positivity : 0 ≤ (2:ℝ)^(-r)) (star_mul_self_nonneg A)).2 + (by simpa only [Algebra.algebraMap_eq_smul_one] using hbound) + simpa only [CStarRing.norm_star_mul_self, pow_two] using hn + + +lemma Count.depth_zero_bound {N : ℕ} (M D : Count N) (r : ℝ) : + ‖M.high r * D.zero * M.zero‖ ≤ Real.exp (-(Real.log 2 / 2) * r) := by + have hsq := M.depth_zero_square D r + have heq : Real.exp (-(Real.log 2 / 2) * r)^2 = (2:ℝ)^(-r) := by + rw [pow_two, ← Real.exp_add, Real.rpow_def_of_pos (by norm_num)] + congr 1 + ring + rw [← heq] at hsq + exact (sq_le_sq₀ (norm_nonneg _) (Real.exp_pos _).le).mp hsq + +end QAC + +end + +end OAI diff --git a/lean/OAI/InformationTheory/QuantumCircuit/HeavyOutcome.lean b/lean/OAI/InformationTheory/QuantumCircuit/HeavyOutcome.lean new file mode 100644 index 0000000000000000000000000000000000000000..2ea0c4eeace5c2416d4dc6aec0a8bacafec22b32 --- /dev/null +++ b/lean/OAI/InformationTheory/QuantumCircuit/HeavyOutcome.lean @@ -0,0 +1,62 @@ +import OAI.InformationTheory.QuantumCircuit.ProductDistribution + +namespace OAI + +/-! Probability bounds for retained reflection outcomes. -/ + +noncomputable section +open scoped BigOperators Matrix.Norms.L2Operator + +namespace QAC + +lemma heavy_low_outcome (hspec : PublishedProductSpectralResolution) + {N : ℕ} (hN : 1 ≤ N) (M : Count N) (ψ : State N) (hψ : ‖ψ‖ = 1) + {r : ℝ} (hr : 0 < r) (hmean : meanCount M ψ ≤ r / 2) : + ∃ F : Finset (Fin N), F ⊆ M.support ∧ (F.card : ℝ) < r ∧ + 1 / (2 * ((N + 1 : ℝ)^(⌈r⌉₊ + 1))) ≤ outcomeMass M ψ F := by + classical + let s := M.support.powerset.filter (fun F => (F.card : ℝ) < r) + let t := M.support.powerset.filter (fun F => r ≤ (F.card : ℝ)) + let mass := outcomeMass M ψ + have hhigh : r * (∑ F ∈ t, mass F) ≤ meanCount M ψ := by + dsimp [t, meanCount] + rw [Finset.sum_filter, Finset.mul_sum] + apply Finset.sum_le_sum + intro F _ + split_ifs with hF + · exact mul_le_mul_of_nonneg_right hF (outcomeMass_nonneg M ψ F) + · simpa using mul_nonneg (Nat.cast_nonneg F.card) (outcomeMass_nonneg M ψ F) + have htotal : (∑ F ∈ s, mass F) + (∑ F ∈ t, mass F) = 1 := by + dsimp [s, t] + rw [Finset.sum_filter, Finset.sum_filter, ← Finset.sum_add_distrib] + calc + _ = ∑ F ∈ M.support.powerset, mass F := by + apply Finset.sum_congr rfl + intro F _ + by_cases hF : r ≤ (F.card : ℝ) <;> simp [hF, not_lt.mpr, lt_of_not_ge] + _ = 1 := by rw [outcomeMass_total hspec M ψ, hψ]; norm_num + have hlower : (1 : ℝ)/2 ≤ ∑ F ∈ s, mass F := by nlinarith + have hs : s.Nonempty := by + by_contra h + rw [Finset.not_nonempty_iff_eq_empty.mp h, Finset.sum_empty] at hlower + norm_num at hlower + obtain ⟨F, hF, hmax⟩ := s.exists_max_image mass hs + have hsum : ∑ G ∈ s, mass G ≤ (s.card : ℝ) * mass F := by + calc + _ ≤ ∑ _G ∈ s, mass F := Finset.sum_le_sum (fun G hG => hmax G hG) + _ = _ := by simp + have hcard : (s.card : ℝ) ≤ (N + 1 : ℝ)^(⌈r⌉₊+1) := by + exact_mod_cast low_patterns_card M.support (r := r) hN + have hmF := outcomeMass_nonneg M ψ F + have hbound : (1 : ℝ)/2 ≤ (N + 1 : ℝ)^(⌈r⌉₊+1) * mass F := + hlower.trans (hsum.trans (mul_le_mul_of_nonneg_right hcard hmF)) + refine ⟨F, Finset.mem_powerset.mp (Finset.mem_filter.mp hF).1, + (Finset.mem_filter.mp hF).2, ?_⟩ + apply (div_le_iff₀ (by positivity : 0 < 2 * (N + 1 : ℝ)^(⌈r⌉₊+1))).mpr + nlinarith + +end QAC + +end + +end OAI diff --git a/lean/OAI/InformationTheory/QuantumCircuit/Localization.lean b/lean/OAI/InformationTheory/QuantumCircuit/Localization.lean new file mode 100644 index 0000000000000000000000000000000000000000..3322bf70d2a233ae63d61634c8b7f6d50f314386 --- /dev/null +++ b/lean/OAI/InformationTheory/QuantumCircuit/Localization.lean @@ -0,0 +1,148 @@ +import OAI.InformationTheory.QuantumCircuit.Backward +import OAI.InformationTheory.QuantumCircuit.Asymptotics +import OAI.InformationTheory.QuantumCircuit.ScaleInduction +import OAI.InformationTheory.QuantumCircuit.DepthZero + +namespace OAI + +noncomputable section +open scoped BigOperators Matrix.Norms.L2Operator Topology +open Polynomial Filter Asymptotics + +namespace QAC + +/-- The uniform estimate, with the eventual quantifier outside all circuit data. -/ +def UniformLocalization (d : ℕ) (s t : ℝ) : Prop := + ∀ᶠ N : ℕ in Filter.atTop, ∀ U : Operator N, IsCircuit d U → ∀ M D : Count N, + ‖M.high ((N:ℝ)^t)*conjugate U D.zero*M.zero‖ ≤ Real.exp (-((N:ℝ)^s)) + +lemma uniform_zero {s t : ℝ} (hst : s < t) : UniformLocalization 0 s t := by + have hlog : 0 < Real.log 2 := Real.log_pos (by norm_num) + filter_upwards [eventually_power_le hst (2/Real.log 2)] with N hN + intro U hU M D + obtain ⟨L,rfl⟩ := hU + have hb := M.depth_zero_bound (D.rotate L) ((N:ℝ)^t) + rw [D.rotate_zero L] at hb + apply hb.trans + apply Real.exp_le_exp.mpr + have h := (div_le_iff₀ hlog).mp (show 2*(N:ℝ)^s/Real.log 2 ≤ (N:ℝ)^t by + simpa only [div_mul_eq_mul_div] using hN) + nlinarith only [h] + +lemma uniform_large (d : ℕ) {s t : ℝ} (ht : 1 < t) : UniformLocalization d s t := by + filter_upwards [eventually_power_le ht 2,Filter.eventually_ge_atTop 1] with N hN hN1 + intro U _ M D + have hNpos : (0:ℝ) < N := by exact_mod_cast (show 0 < N by omega) + have hlimit : (N:ℝ) < (N:ℝ)^t := by rw [Real.rpow_one] at hN; linarith only [hN,hNpos] + rw [M.high_eq_zero hlimit,zero_mul,zero_mul,norm_zero] + exact (Real.exp_pos _).le + +lemma uniform_low_propagation {d : ℕ} + (ih : ∀ s t : ℝ, 0 ≤ s → s < t → UniformLocalization d s t) + {a s t : ℝ} (ha : 0 ≤ a) (_hs : 0 ≤ s) (hat : a < t) (hst : s < t) : + ∀ᶠ N : ℕ in Filter.atTop, ∀ U : Operator N, IsCircuit d U → ∀ M D : Count N, + ‖M.high ((N:ℝ)^t)*conjugate U D.zero*M.low ((N:ℝ)^a)‖ ≤ Real.exp (-((N:ℝ)^s)) := by + obtain ⟨v,hv,hvt⟩ := exists_between (max_lt hat hst) + have hav : a < v := (le_max_left _ _).trans_lt hv + have hsv : s < v := (le_max_right _ _).trans_lt hv + obtain ⟨q,hvq,hqt⟩ := exists_between hvt + filter_upwards [ih v q (ha.trans hav.le) hvq, + eventually_two_powers_le hqt hat,eventually_pattern_cost ha hav hsv, + Filter.eventually_ge_atTop 1] with N hN hp hc hN1 + intro U hU M D + exact (M.low_propagation_bound (conjugate U D.zero) hN1 (Real.exp_pos _).le hp + (fun K => hN U hU K D)).trans hc + +lemma uniform_small_support {d : ℕ} + (ih : ∀ s t : ℝ, 0 ≤ s → s < t → UniformLocalization d s t) + {u w t : ℝ} (hu : 0 ≤ u) (_hw : 0 ≤ w) (hut : u < t) (hwt : w < t) : + ∀ᶠ N : ℕ in Filter.atTop, ∀ U : Operator N, IsCircuit (d+1) U → ∀ M A : Count N, + (A.support.card:ℝ) ≤ (N:ℝ)^u → + ‖M.high ((N:ℝ)^t)*conjugate U A.zero*M.zero‖ ≤ Real.exp (-((N:ℝ)^w)) := by + obtain ⟨v,hv,hvt⟩ := exists_between (max_lt hut hwt) + have huv : u < v := (le_max_left _ _).trans_lt hv + have hwv : w < v := (le_max_right _ _).trans_lt hv + have hv0 : 0 < v := lt_of_le_of_lt hu huv + obtain ⟨r₁,hvr₁,hr₁t⟩ := exists_between hvt + obtain ⟨r₂,hr₁r₂,hr₂t⟩ := exists_between hr₁t + filter_upwards [ih v r₁ hv0.le hvr₁, + uniform_low_propagation ih (hv0.le.trans hvr₁.le) hv0.le hr₁r₂ (hvr₁.trans hr₁r₂), + uniform_low_propagation ih (hv0.le.trans (hvr₁.trans hr₁r₂).le) hv0.le hr₂t hvt, + eventually_exp_power_gap hwv huv hv0 3 1 1 (Real.log 9) (by norm_num) zero_lt_one] with N h₁ h₂ h₃ hc + intro U hU M A hA + obtain ⟨V,R,L,hV,rfl⟩ := hU + have hb := small_support_layer_bound V hV.mem_unitary R L M A (Real.exp_pos _).le + (fun D => h₁ V hV M D) (fun D => h₂ V hV M D) (fun D => h₃ V hV M D) + have hcost : (9:ℝ)^A.support.card ≤ Real.exp (Real.log 9*(N:ℝ)^u) := by + calc + _ = Real.exp (Real.log 9*(A.support.card:ℝ)) := by + rw [mul_comm,Real.exp_nat_mul,Real.exp_log (by norm_num)] + _ ≤ _ := Real.exp_le_exp.mpr (mul_le_mul_of_nonneg_left hA (Real.log_nonneg (by norm_num))) + apply hb.trans + calc + _ ≤ Real.exp (Real.log 9*(N:ℝ)^u)*(3*Real.exp (-((N:ℝ)^v))) := + mul_le_mul_of_nonneg_right hcost (by positivity) + _ = 3*Real.exp (Real.log 9*(N:ℝ)^u-(N:ℝ)^v) := by rw [sub_eq_add_neg,Real.exp_add]; ring + _ ≤ _ := by simpa only [one_mul] using hc + +lemma uniform_backward {d : ℕ} + (ih : ∀ s t : ℝ, 0 ≤ s → s < t → UniformLocalization d s t) + {s t a b u w : ℝ} (hs : 0 ≤ s) (hsa : s < a) (hau : a < u) + (huw : u < w) (hwt : w < t) (htb : t < b) (hdegree : (a+b)/2 < u) + (hnext : UniformLocalization (d+1) t b) : UniformLocalization (d+1) s t := by + have ha : 0 < a := lt_of_le_of_lt hs hsa + have hab : a < b := hau.trans (huw.trans (hwt.trans htb)) + filter_upwards [polynomial_approximation ha hab hdegree, + uniform_small_support ih (ha.trans hau).le (ha.trans (hau.trans huw)).le (huw.trans hwt) hwt, + hnext,eventually_backward_cost hs hsa hau huw hwt] with N hp hsmall htail hcost + intro U hU M D + obtain ⟨p,hdeg,hweight,hzero,hp⟩ := hp + have hx := D.polynomial_transition M U p ((N:ℝ)^t) ((N:ℝ)^u) (Real.exp (-((N:ℝ)^w))) + (Real.exp_pos _).le hdeg (fun A hA => hsmall U hU M A hA) + have hx' : ‖M.high ((N:ℝ)^t)*conjugate U (D.polynomial p)*M.zero‖ ≤ + Real.exp ((N:ℝ)^u-(N:ℝ)^w) := by + apply hx.trans + calc + _ ≤ Real.exp ((N:ℝ)^u)*Real.exp (-((N:ℝ)^w)) := + mul_le_mul_of_nonneg_right hweight (Real.exp_pos _).le + _ = _ := (Real.exp_add _ _).symm + have herr := D.polynomial_error_low p (Real.exp_pos _).le hzero (fun k hk hkb => + hp k hk (by exact_mod_cast hkb.le.trans (Nat.le_ceil ((N:ℝ)^b)))) + have hinv := htail (star U) hU.star_mem D M + simp only [conjugate,star_star,mul_assoc] at hinv + have hsq := M.backward_finite D U hU.mem_unitary p ((N:ℝ)^t) ((N:ℝ)^b) + (Real.exp ((N:ℝ)^u-(N:ℝ)^w)) (Real.exp ((N:ℝ)^u)) + (Real.exp (-((N:ℝ)^a))) (Real.exp (-((N:ℝ)^t))) hx' + ((D.polynomial_norm_le p).trans hweight) herr (by simpa only [mul_assoc] using hinv) + have hsq' := hsq.trans hcost + have heq : Real.exp (-2*(N:ℝ)^s) = (Real.exp (-((N:ℝ)^s)))^2 := by + rw [pow_two,← Real.exp_add] + congr 1 + ring + rw [heq] at hsq' + exact (sq_le_sq₀ (norm_nonneg _) (Real.exp_pos _).le).mp hsq' + +/-- Uniform localization, proved by depth and finite scale induction. -/ +theorem uniform_localization : ∀ d s t, 0 ≤ s → s < t → UniformLocalization d s t := by + intro d + induction d with + | zero => intro s t _ hst; exact uniform_zero hst + | succ d ih => + apply finite_scale_induction (UniformLocalization (d+1)) + · intro s t _ _ ht; exact uniform_large (d+1) ht + · intro s t a b u w hs hsa hau huw hwt htb hdegree hnext + exact uniform_backward ih hs hsa hau huw hwt htb hdegree hnext + +/-- Uniform product-projection localization in the Euclidean operator norm. -/ +theorem localization : LocalizationStatement := by + intro d s t hs hst + obtain ⟨N₀,hN₀⟩ := Filter.eventually_atTop.mp (uniform_localization d s t hs hst) + refine ⟨N₀,?_⟩ + intro N hN U hU M D + simpa only [conjugate,mul_assoc] using hN₀ N hN U hU M D + +end QAC + +end + +end OAI diff --git a/lean/OAI/InformationTheory/QuantumCircuit/LowDegreePropagation.lean b/lean/OAI/InformationTheory/QuantumCircuit/LowDegreePropagation.lean new file mode 100644 index 0000000000000000000000000000000000000000..22e97b639c575c08b2115fa6997af6995a60f5ff --- /dev/null +++ b/lean/OAI/InformationTheory/QuantumCircuit/LowDegreePropagation.lean @@ -0,0 +1,148 @@ +import OAI.InformationTheory.QuantumCircuit.Propagation + +namespace OAI + +/-! Low-degree propagation with subexponential norm and error bounds. -/ + +noncomputable section +open scoped BigOperators Matrix.Norms.L2Operator Topology +open Filter + +namespace QAC + +def headLayer {N : ℕ} (l : List (AnalyticLayer N)) : AnalyticLayer N := + l.headD (.local (fun _ => 1)) + +lemma headLayer_nil_matrix {N : ℕ} : (headLayer ([] : List (AnalyticLayer N))).matrix = 1 := by + simp [headLayer, AnalyticLayer.matrix, localMatrix] + +lemma evolution_tail {N : ℕ} (l : List (AnalyticLayer N)) : + evolution l = evolution l.tail * (headLayer l).matrix := by + cases l with + | nil => simp [evolution, headLayer_nil_matrix] + | cons a l => rfl + +lemma evolution_take_tail {N : ℕ} (l : List (AnalyticLayer N)) (j : ℕ) : + evolution (l.take (j + 1)) = evolution (l.tail.take j) * (headLayer l).matrix := by + cases l with + | nil => simp [evolution, headLayer_nil_matrix] + | cons a l => simp [List.take_succ_cons, evolution, headLayer] + +lemma RegularTrajectory.head {m : ℕ → ℕ} {l : ∀ ν, List (AnalyticLayer (m ν))} + {ψ : ∀ ν, State (m ν)} (hreg : RegularTrajectory m l ψ) : + LayerRegular m (fun ν => headLayer (l ν)) ψ := by + intro b h p hb hbh hh hp hph + filter_upwards [hreg b h p hb hbh hh hp hph] with ν hν + intro R hR S hS hsize + have hj : (l ν)[0]? = some (.reflection R) := by + cases hl : l ν with + | nil => simp [hl, headLayer] at hR + | cons a l => simpa [hl, headLayer] using congrArg some hR + simpa [evolution] using hν 0 R hj S hS hsize + +lemma RegularTrajectory.tail {m : ℕ → ℕ} {l : ∀ ν, List (AnalyticLayer (m ν))} + {ψ : ∀ ν, State (m ν)} (hreg : RegularTrajectory m l ψ) : + RegularTrajectory m (fun ν => (l ν).tail) + (fun ν => act (headLayer (l ν)).matrix (ψ ν)) := by + intro b h p hb hbh hh hp hph + filter_upwards [hreg b h p hb hbh hh hp hph] with ν hν + intro j R hj S hS hsize + have hget : (l ν)[j + 1]? = some (.reflection R) := by + simpa only [List.getElem?_tail] using hj + have hh := hν (j + 1) R hget S hS hsize + rwa [evolution_take_tail, act_mul] at hh + +theorem low_degree_propagation_with_prefactor + (hpauli : PublishedPauliExpansion) (hspec : PublishedProductSpectralResolution) + (d : ℕ) (m : ℕ → ℕ) (hm : Tendsto m atTop atTop) + (l : ∀ ν, List (AnalyticLayer (m ν))) (hl : ∀ ν, (l ν).length ≤ d) + (ψ : ∀ ν, State (m ν)) (hψ : ∀ ν, ‖ψ ν‖ ≤ 1) + (hreg : RegularTrajectory m l ψ) + {k K : ℝ} (hk : 0 < k) (hkK : k < K) (hK : K < 1) + {ε : ℝ} (hε : 0 < ε) : + ∀ᶠ ν in atTop, ∀ E : Operator (m ν), + HasDegreeLE E ((m ν : ℝ)^k) → ‖E‖ ≤ Real.exp ((m ν : ℝ)^k) → + TransportOn (evolution (l ν)) (ψ ν) ((m ν : ℝ)^K) (Real.exp ((m ν : ℝ)^K)) + (ε * Real.exp (-((m ν : ℝ)^k))) E := by + induction d generalizing l ψ k K ε with + | zero => + filter_upwards [hm.eventually (eventually_ge_atTop 1)] with ν hN + intro E hE hn + have hl0 : l ν = [] := List.length_eq_zero_iff.mp (Nat.eq_zero_of_le_zero (hl ν)) + have hpow : (m ν : ℝ)^k ≤ (m ν : ℝ)^K := + Real.rpow_le_rpow_of_exponent_le (by exact_mod_cast hN) hkK.le + refine ⟨E, hE.mono hpow, hn.trans (Real.exp_le_exp.mpr hpow), ?_⟩ + simp only [hl0, evolution, act_one, sub_self, norm_zero] + positivity + | succ d ih => + obtain ⟨v, hkv, hvK⟩ := exists_between hkK + let ξ : ∀ ν, State (m ν) := fun ν => act (headLayer (l ν)).matrix (ψ ν) + have hξ : ∀ ν, ‖ξ ν‖ ≤ 1 := by + intro ν + exact (act_unitary_norm (headLayer (l ν)).isCircuit.mem_unitary (ψ ν)).le.trans (hψ ν) + have htlen : ∀ ν, (l ν).tail.length ≤ d := by + intro ν + have hh := hl ν + simp only [List.length_tail] + omega + have htreg : RegularTrajectory m (fun ν => (l ν).tail) ξ := hreg.tail + have hfirst := regular_layer_propagation hpauli hspec m hm + (fun ν => headLayer (l ν)) ψ hψ hreg.head hk hkv (hvK.trans hK) + (ε := ε / 2) (by positivity) + have hrest := ih (fun ν => (l ν).tail) htlen ξ hξ htreg + (hk.trans hkv) hvK hK (ε := ε / 2) (by positivity) + filter_upwards [hfirst, hrest, hm.eventually (eventually_ge_atTop 1)] with ν hf hr hN + intro E hE hn + obtain ⟨E₁, hd₁, hn₁, he₁⟩ := hf E hE hn + obtain ⟨E₂, hd₂, hn₂, he₂⟩ := hr E₁ hd₁ hn₁ + refine ⟨E₂, hd₂, hn₂, ?_⟩ + have heq : act (evolution (l ν)) (act E (ψ ν)) - + act E₂ (act (evolution (l ν)) (ψ ν)) = + act (evolution (l ν).tail) + (act (headLayer (l ν)).matrix (act E (ψ ν)) - act E₁ (ξ ν)) + + (act (evolution (l ν).tail) (act E₁ (ξ ν)) - + act E₂ (act (evolution (l ν).tail) (ξ ν))) := by + rw [evolution_tail] + simp only [act_mul, act_sub_state, ξ] + abel + rw [heq] + have hpow : (m ν : ℝ)^k ≤ (m ν : ℝ)^v := + Real.rpow_le_rpow_of_exponent_le (by exact_mod_cast hN) hkv.le + calc + _ ≤ ‖act (evolution (l ν).tail) + (act (headLayer (l ν)).matrix (act E (ψ ν)) - act E₁ (ξ ν))‖ + + ‖act (evolution (l ν).tail) (act E₁ (ξ ν)) - + act E₂ (act (evolution (l ν).tail) (ξ ν))‖ := norm_add_le _ _ + _ ≤ (ε / 2) * Real.exp (-((m ν : ℝ)^k)) + + (ε / 2) * Real.exp (-((m ν : ℝ)^v)) := by + rw [act_unitary_norm (evolution_isCircuit (l ν).tail).mem_unitary] + exact add_le_add he₁ he₂ + _ ≤ (ε / 2) * Real.exp (-((m ν : ℝ)^k)) + + (ε / 2) * Real.exp (-((m ν : ℝ)^k)) := by + apply add_le_add le_rfl + apply mul_le_mul_of_nonneg_left (Real.exp_le_exp.mpr (neg_le_neg hpow)) + positivity + _ = _ := by ring + +theorem low_degree_propagation + (hpauli : PublishedPauliExpansion) (hspec : PublishedProductSpectralResolution) + (d : ℕ) (m : ℕ → ℕ) (hm : Tendsto m atTop atTop) + (l : ∀ ν, List (AnalyticLayer (m ν))) (hl : ∀ ν, (l ν).length ≤ d) + (ψ : ∀ ν, State (m ν)) (hψ : ∀ ν, ‖ψ ν‖ ≤ 1) + (hreg : RegularTrajectory m l ψ) + {k K : ℝ} (hk : 0 < k) (hkK : k < K) (hK : K < 1) : + ∀ᶠ ν in atTop, ∀ E : Operator (m ν), + HasDegreeLE E ((m ν : ℝ)^k) → ‖E‖ ≤ Real.exp ((m ν : ℝ)^k) → + ∃ E' : Operator (m ν), HasDegreeLE E' ((m ν : ℝ)^K) ∧ + ‖E'‖ ≤ Real.exp ((m ν : ℝ)^K) ∧ + ‖act (evolution (l ν)) (act E (ψ ν)) - + act E' (act (evolution (l ν)) (ψ ν))‖ ≤ Real.exp (-((m ν : ℝ)^k)) := by + simpa only [one_mul, TransportOn] using + low_degree_propagation_with_prefactor hpauli hspec d m hm l hl ψ hψ hreg hk hkK hK + (ε := 1) zero_lt_one + +end QAC + +end + +end OAI diff --git a/lean/OAI/InformationTheory/QuantumCircuit/Main.lean b/lean/OAI/InformationTheory/QuantumCircuit/Main.lean new file mode 100644 index 0000000000000000000000000000000000000000..56c7d2410e355ff9f2791d30c0685c196ada7750 --- /dev/null +++ b/lean/OAI/InformationTheory/QuantumCircuit/Main.lean @@ -0,0 +1,45 @@ +import OAI.InformationTheory.QuantumCircuit.Parity + +namespace OAI + +noncomputable section +open scoped BigOperators Matrix.Norms.L2Operator Topology +open Polynomial Filter Asymptotics + +namespace QAC + +/-- Measured-output parity for a polynomial qubit bound with a fixed multiplicative constant. -/ +theorem parity_lower_bound_polynomial_size (d k C : ℕ) + (_hd : 0 < d) (_hk : 0 < k) (_hC : 0 < C) : + ∃ n₀ : ℕ, ∀ n ≥ n₀, ∀ N : ℕ, n ≤ N → N ≤ C * (n + 1) ^ k → + ∀ layers : List (PhysicalLayer N), layers.length ≤ d → + ∀ out : Fin N, ∃ x : Word n, + successProbability (physicalCircuitMatrix layers) out x < (2 : ℝ) / 3 := by + classical + obtain ⟨n₀, h₀⟩ := parity_lower_bound d ((k + 1 : ℕ) : ℝ) (1 / 6) + (by exact_mod_cast Nat.succ_le_succ (Nat.zero_le k)) (by norm_num) (by norm_num) + refine ⟨max n₀ (max 1 (C * 2 ^ k)), ?_⟩ + intro n hn N hnN hN layers hdepth out + rcases max_le_iff.mp hn with ⟨hn₀, hnrest⟩ + rcases max_le_iff.mp hnrest with ⟨hn1, hCn⟩ + have hpoly : N ≤ n ^ (k + 1) := by + calc + N ≤ C * (n + 1) ^ k := hN + _ ≤ C * (2 * n) ^ k := + Nat.mul_le_mul_left C (Nat.pow_le_pow_left (by omega) k) + _ = (C * 2 ^ k) * n ^ k := by rw [mul_pow, Nat.mul_assoc] + _ ≤ n * n ^ k := Nat.mul_le_mul_right (n ^ k) hCn + _ = n ^ (k + 1) := by rw [pow_succ, Nat.mul_comm] + have hsize : (N : ℝ) ≤ (n : ℝ) ^ ((k + 1 : ℕ) : ℝ) := by + rw [Real.rpow_natCast] + exact_mod_cast hpoly + have hnot := h₀ n hn₀ N hnN hsize layers hdepth out + push Not at hnot + norm_num at hnot + exact hnot + +end QAC + +end + +end OAI diff --git a/lean/OAI/InformationTheory/QuantumCircuit/Measurement.lean b/lean/OAI/InformationTheory/QuantumCircuit/Measurement.lean new file mode 100644 index 0000000000000000000000000000000000000000..bd464a22e70f5e27eb2423db95e083b3ea7be116 --- /dev/null +++ b/lean/OAI/InformationTheory/QuantumCircuit/Measurement.lean @@ -0,0 +1,110 @@ +import OAI.InformationTheory.QuantumCircuit.ParityTrace + +namespace OAI + +noncomputable section +open scoped BigOperators Matrix.Norms.L2Operator Topology +open Matrix Polynomial Filter Asymptotics + +namespace QAC + +/-- The measured zero-outcome projector is a product projection on one qubit. -/ +def outputZeroCount {N : ℕ} (out : Fin N) : Count N where + support := {out} + vector _ := basisVector 0 + normalized _ _ := basisVector_normalized 0 + +lemma outputZeroCount_diagonal {N : ℕ} (out : Fin N) : + (outputZeroCount out).zero = Matrix.diagonal (fun z => if z out=0 then 1 else 0) := by + classical + have hloc : (fun i : Fin N => if i=out then rankOne (basisVector 0) else (1:QubitOperator)) = + fun i => Matrix.diagonal (fun b => if i=out → b=0 then (1:ℂ) else 0) := by + funext i + by_cases hi : i=out + · simp [hi,rankOne_basis_diagonal] + · simp [hi,Matrix.diagonal_one] + simp only [Count.zero,outputZeroCount,Finset.mem_singleton] + rw [hloc,tensorMatrix_diagonal] + congr 1 + funext z + rw [Fintype.prod_boole] + simp + +/-- Born probability for an arbitrary fixed input basis state. -/ +def outputProbability {N : ℕ} (W : Operator N) (out : Fin N) (b : Bit) (z : Word N) : ℝ := + ∑ y, if y out=b then Complex.normSq (W y z) else 0 + +lemma born_zero_diagonal {N : ℕ} (W : Operator N) (out : Fin N) (z : Word N) : + (star W*(outputZeroCount out).zero*W) z z = (outputProbability W out 0 z:ℂ) := by + classical + rw [outputZeroCount_diagonal,Matrix.mul_apply] + simp only [Matrix.mul_diagonal,Matrix.star_apply,outputProbability,Complex.ofReal_sum] + apply Finset.sum_congr rfl + intro y _ + by_cases hy : y out=0 + · simp only [ite_eq_left hy,mul_one,Complex.star_def,← Complex.normSq_eq_conj_mul_self] + · simp [hy] + +lemma total_born_probability {N : ℕ} (W : Operator N) (hW : W ∈ unitary (Operator N)) + (z : Word N) : (∑ y, Complex.normSq (W y z))=1 := by + apply Complex.ofReal_injective + have h := congrArg (fun A : Operator N => A z z) (Unitary.star_mul_self_of_mem hW) + simpa only [Matrix.mul_apply,Matrix.star_apply,Complex.star_def, + ← Complex.normSq_eq_conj_mul_self,← Complex.ofReal_sum,Matrix.one_apply_eq,Complex.ofReal_one] using h + +lemma outputProbability_complement {N : ℕ} (W : Operator N) (hW : W ∈ unitary (Operator N)) + (out : Fin N) (z : Word N) : + outputProbability W out 0 z+outputProbability W out 1 z=1 := by + rw [outputProbability,outputProbability,← Finset.sum_add_distrib,← total_born_probability W hW z] + apply Finset.sum_congr rfl + intro y _ + generalize y out=b + fin_cases b <;> simp + +lemma success_character_lower {n N : ℕ} (W : Operator N) (hW : W ∈ unitary (Operator N)) + (out : Fin N) (x : Word n) {ε : ℝ} (hsuccess : 1/2+ε ≤ successProbability W out x) : + ε+bitSign (parity x)/2 ≤ + ((bitSign (parity x):ℂ)*(star W*(outputZeroCount out).zero*W) (inputWord x) (inputWord x)).re := by + rw [born_zero_diagonal,← Complex.ofReal_mul,Complex.ofReal_re] + have htotal := outputProbability_complement W hW out (inputWord x) + change 1/2+ε ≤ outputProbability W out (parity x) (inputWord x) at hsuccess + generalize hp : parity x=b at hsuccess ⊢ + fin_cases b + · norm_num [bitSign] at * + linarith only [hsuccess] + · norm_num [bitSign] at * + linarith only [hsuccess,htotal] + +/-- The finite Fourier step, with all final garbage summed out by the Born rule. -/ +lemma parity_advantage_from_entries {n N : ℕ} (hn : 0 + success_character_lower W hW out x (hsuccess x)) + have hzero := sum_bitSign_parity hn + simp only [Finset.sum_add_distrib,Finset.sum_const,Finset.card_univ,nsmul_eq_mul, + ← Finset.sum_div,hzero,zero_div,add_zero] at hlow + have hupp := Finset.sum_le_sum (fun (x : Word n) (_ : x∈Finset.univ) => + (Complex.re_le_norm ((H*B*H) (flipWord (inputSet n N) (inputWord x)) (inputWord x))).trans (hentry x)) + simp only [Finset.sum_const,Finset.card_univ,nsmul_eq_mul] at hupp + have heq := congrArg Complex.re (parity_trace_identity hnN B) + have hsumre (f : Word n → ℂ) : (∑ x, f x).re = ∑ x, (f x).re := + map_sum Complex.reAddGroupHom f Finset.univ + rw [hsumre,hsumre] at heq + change (∑ x : Word n, ((H*B*H) (flipWord (inputSet n N) (inputWord x)) (inputWord x)).re) = + ∑ x : Word n, ((bitSign (parity x):ℂ)*B (inputWord x) (inputWord x)).re at heq + rw [heq] at hupp + have hc : 0 < (Fintype.card (Word n):ℝ) := Nat.cast_pos.mpr Fintype.card_pos + exact (mul_le_mul_iff_right₀ hc).mp (hlow.trans hupp) + +end QAC + +end + +end OAI diff --git a/lean/OAI/InformationTheory/QuantumCircuit/Model.lean b/lean/OAI/InformationTheory/QuantumCircuit/Model.lean new file mode 100644 index 0000000000000000000000000000000000000000..2f705820e77dadbeabf471d91c9dcd33f875840e --- /dev/null +++ b/lean/OAI/InformationTheory/QuantumCircuit/Model.lean @@ -0,0 +1,73 @@ +import Mathlib + +namespace OAI + +noncomputable section +open scoped BigOperators Matrix.Norms.L2Operator + +namespace QAC + +abbrev Bit := Fin 2 +abbrev Word (N : ℕ) := Fin N → Bit +abbrev Operator (N : ℕ) := Matrix (Word N) (Word N) ℂ +abbrev QubitOperator := Matrix Bit Bit ℂ + +/-- Tensor product in the computational basis. -/ +def tensorMatrix {N : ℕ} (a : Fin N → QubitOperator) : Operator N := + fun x y => ∏ i, a i (x i) (y i) + +/-- A one-qubit unitary or an unbounded-arity Toffoli gate. -/ +inductive Gate (N : ℕ) where + | local (q : Fin N) (u : Matrix.unitaryGroup Bit ℂ) + | toffoli (controls : Finset (Fin N)) (target : Fin N) (hne : target ∉ controls) + +namespace Gate + +def support {N : ℕ} : Gate N → Finset (Fin N) + | .local q _ => {q} + | .toffoli c t _ => insert t c + +/-- A Toffoli flips its target iff all controls are one. -/ +def toffoliWord {N : ℕ} (c : Finset (Fin N)) (t : Fin N) (x : Word N) : Word N := + if ∀ i ∈ c, x i = 1 then Function.update x t (1 - x t) else x + +def matrix {N : ℕ} : Gate N → Operator N + | .local q u => tensorMatrix fun i => if i = q then (u : QubitOperator) else 1 + | .toffoli c t _ => fun x y => if x = toffoliWord c t y then 1 else 0 + +end Gate + +structure PhysicalLayer (N : ℕ) where + gates : List (Gate N) + disjoint : gates.Pairwise (fun A B => Disjoint A.support B.support) + +def physicalLayerMatrix {N : ℕ} (L : PhysicalLayer N) : Operator N := + (L.gates.map Gate.matrix).prod + +/-- Chronological order: the rightmost matrix acts first. -/ +def physicalCircuitMatrix {N : ℕ} (layers : List (PhysicalLayer N)) : Operator N := + ((layers.map physicalLayerMatrix).reverse).prod + +/-- The computational-basis input with the remaining qubits initialized to zero. -/ +def inputWord {n N : ℕ} (x : Word n) : Word N := + fun i => if h : i.val < n then x ⟨i.val, h⟩ else 0 + +def parity {n : ℕ} (x : Word n) : Bit := ∑ i, x i + +/-- Born probability, summing all final garbage with no cleanliness assumption. -/ +def successProbability {n N : ℕ} (W : Operator N) (out : Fin N) (x : Word n) : ℝ := + ∑ y : Word N, if y out = parity x then Complex.normSq (W y (inputWord x)) else 0 + +/-- The literal measured-output, polynomial-total-qubit parity lower bound. -/ +def ParityStatement : Prop := + ∀ (d : ℕ) (c ε : ℝ), 1 ≤ c → 0 < ε → ε ≤ 1 / 2 → + ∃ n₀ : ℕ, ∀ n ≥ n₀, ∀ N : ℕ, n ≤ N → (N : ℝ) ≤ (n : ℝ) ^ c → + ∀ layers : List (PhysicalLayer N), layers.length ≤ d → + ∀ out : Fin N, ¬ (∀ x : Word n, + 1 / 2 + ε ≤ successProbability (physicalCircuitMatrix layers) out x) + +end QAC + +end + +end OAI diff --git a/lean/OAI/InformationTheory/QuantumCircuit/Parity.lean b/lean/OAI/InformationTheory/QuantumCircuit/Parity.lean new file mode 100644 index 0000000000000000000000000000000000000000..b2a3acffd4e18de89321b89b6f58918c849531d7 --- /dev/null +++ b/lean/OAI/InformationTheory/QuantumCircuit/Parity.lean @@ -0,0 +1,82 @@ +import OAI.InformationTheory.QuantumCircuit.Localization +import OAI.InformationTheory.QuantumCircuit.Physical +import OAI.InformationTheory.QuantumCircuit.Measurement + +namespace OAI + +noncomputable section +open scoped BigOperators Matrix.Norms.L2Operator Topology +open Polynomial Filter Asymptotics + +namespace QAC + +lemma eventually_exp_neg_power_lt {s ε : ℝ} (hs : 0 fin_cases b <;> norm_num [bitSign,Fin.add_def,Fin.ext_iff] + +lemma bitSign_finset_sum {ι : Type*} (s : Finset ι) (f : ι → Bit) : + bitSign (∑ i ∈ s, f i)=∏ i ∈ s, bitSign (f i) := by + classical + induction s using Finset.induction_on with + | empty => simp [bitSign] + | @insert i s hi ih => simp only [Finset.sum_insert hi,Finset.prod_insert hi,bitSign_add,ih] + +lemma bitSign_parity {n : ℕ} (x : Word n) : bitSign (parity x)=∏ i, bitSign (x i) := + bitSign_finset_sum _ _ + +lemma sum_bitSign_parity {n : ℕ} (hn : 0 bitSign b)] + exact Finset.prod_eq_zero (Finset.mem_univ (⟨0,hn⟩ : Fin n)) (by norm_num [Fin.sum_univ_two,bitSign]) + +def inputSign {N : ℕ} (n : ℕ) (z : Word N) : ℝ := + ∏ i : Fin N, if i.val (inputSign n z:ℂ)) := by + have hloc : (fun i : Fin N => if i.val Matrix.diagonal (fun b => ((if i.val simp [bitZ,Matrix.diagonal_one] + rw [inputPhase,hloc,tensorMatrix_diagonal] + congr 1 + funext z + simp only [inputSign,Complex.ofReal_prod] + +lemma inputSign_inputWord {n N : ℕ} (hnN : n ≤ N) (x : Word n) : + inputSign n (@inputWord n N x)=bitSign (parity x) := by + classical + rw [inputSign,bitSign_parity,← Finset.prod_filter] + symm + apply Finset.prod_bij (fun i _ => Fin.castLE hnN i) + · intro i _ + simp only [Finset.mem_filter,Finset.mem_univ,true_and,Fin.val_castLE] + exact i.isLt + · intro i _ j _ hij + exact Fin.ext (congrArg (fun k : Fin N => k.val) hij) + · intro i hi + refine ⟨⟨i.val,(Finset.mem_filter.mp hi).2⟩,Finset.mem_univ _,?_⟩ + rfl + · intro i _ + simp [inputWord,i.isLt] + +lemma trace_phase_ancilla {n N : ℕ} (hnN : n ≤ N) (B : Operator N) : + Matrix.trace (inputPhase n N*ancillaProjection n N*B) = + ∑ x : Word n, (bitSign (parity x):ℂ)*B (inputWord x) (inputWord x) := by + classical + rw [inputPhase_diagonal,ancillaProjection_diagonal,Matrix.diagonal_mul_diagonal] + simp only [Matrix.trace,Matrix.diag_apply,Matrix.diagonal_mul] + simp only [mul_ite,mul_one,mul_zero,ite_mul,zero_mul] + rw [sum_ancillaValid hnN] + simp only [inputSign_inputWord hnN] + +/-- Character orthogonality as a finite-dimensional cyclic trace identity. -/ +lemma parity_trace_identity {n N : ℕ} (hnN : n ≤ N) (B : Operator N) : + (∑ x : Word n, (localMatrix (inputHadamard n N)*B*localMatrix (inputHadamard n N)) + (flipWord (inputSet n N) (inputWord x)) (inputWord x)) = + ∑ x : Word n, (bitSign (parity x):ℂ)*B (inputWord x) (inputWord x) := by + rw [← trace_flip_ancilla hnN] + let H := localMatrix (inputHadamard n N) + let T := inputFlip n N*ancillaProjection n N + change Matrix.trace (T*(H*B*H)) = _ + calc + Matrix.trace (T*(H*B*H)) = Matrix.trace ((T*(H*B))*H) := + congrArg Matrix.trace (mul_assoc T (H*B) H).symm + _ = Matrix.trace (H*T*(H*B)) := Matrix.trace_mul_cycle _ _ _ + _ = Matrix.trace ((H*T*H)*B) := by rw [mul_assoc (H*T) H B] + _ = Matrix.trace (inputPhase n N*ancillaProjection n N*B) := by + rw [show H*T*H=inputPhase n N*ancillaProjection n N from inputHadamard_ancilla_flip n N] + _ = _ := trace_phase_ancilla hnN B + +end QAC + +end + +end OAI diff --git a/lean/OAI/InformationTheory/QuantumCircuit/PauliBasis.lean b/lean/OAI/InformationTheory/QuantumCircuit/PauliBasis.lean new file mode 100644 index 0000000000000000000000000000000000000000..b96d8358e327005d712e2ce42c888cff27b30cef --- /dev/null +++ b/lean/OAI/InformationTheory/QuantumCircuit/PauliBasis.lean @@ -0,0 +1,172 @@ +import OAI.InformationTheory.QuantumCircuit.ProductSpectralResolution +import OAI.InformationTheory.QuantumCircuit.Computational + +namespace OAI + +/-! The tensor-product Pauli basis. -/ + +noncomputable section +open scoped BigOperators Matrix.Norms.L2Operator + +namespace QAC + +def pauli (s : Fin 4) : QubitOperator := + if s = 0 then 1 else if s = 1 then !![0,1;1,0] + else if s = 2 then !![1,0;0,-1] else !![0,1;-1,0] + +@[simp] lemma pauli_zero : pauli 0 = 1 := by simp [pauli] + +lemma pauli_unitary (s : Fin 4) : pauli s ∈ unitary QubitOperator := by + rw [Unitary.mem_iff] + fin_cases s <;> constructor <;> ext x y <;> fin_cases x <;> fin_cases y <;> + norm_num [pauli, Matrix.mul_apply, Fin.sum_univ_two, Matrix.star_apply, Matrix.one_apply] + +lemma pauli_trace_star {s : Fin 4} (hs : s ≠ 0) : Matrix.trace (star (pauli s)) = 0 := by + fin_cases s <;> simp_all [pauli, Matrix.trace, Matrix.star_apply, Fin.sum_univ_two] + +lemma pauli_complete (x y u v : Bit) : + (∑ s : Fin 4, pauli s x y * star (pauli s u v)) = + if x = u ∧ y = v then (2 : ℂ) else 0 := by + fin_cases x <;> fin_cases y <;> fin_cases u <;> fin_cases v <;> + norm_num [pauli, Fin.sum_univ_succ, Matrix.one_apply] + +def pauliTensor {N : ℕ} (w : Fin N → Fin 4) : Operator N := + tensorMatrix (fun i => pauli (w i)) + +def pauliSupport {N : ℕ} (w : Fin N → Fin 4) : Finset (Fin N) := + Finset.univ.filter (fun i => w i ≠ 0) + +lemma pauliTensor_unitary {N : ℕ} (w : Fin N → Fin 4) : + pauliTensor w ∈ unitary (Operator N) := tensorMatrix_unitary _ (fun i => pauli_unitary (w i)) + +lemma pauliTensor_complete {N : ℕ} (x y u v : Word N) : + (∑ w : Fin N → Fin 4, pauliTensor w x y * star (pauliTensor w u v)) = + if x = u ∧ y = v then (2 : ℂ)^N else 0 := by + classical + simp only [pauliTensor, tensorMatrix, star_prod, ← Finset.prod_mul_distrib] + rw [← Fintype.prod_sum (fun i s => pauli s (x i) (y i) * star (pauli s (u i) (v i)))] + simp_rw [pauli_complete] + by_cases h : x = u ∧ y = v + · rcases h with ⟨rfl, rfl⟩ + simp + · rw [ite_eq_right h] + have hh : ∃ i, ¬ (x i = u i ∧ y i = v i) := by + by_contra hn + push Not at hn + exact h ⟨funext (fun i => (hn i).1), funext (fun i => (hn i).2)⟩ + obtain ⟨i, hi⟩ := hh + exact Finset.prod_eq_zero (Finset.mem_univ i) (ite_eq_right hi) + +def pauliCoefficient {N : ℕ} (E : Operator N) (w : Fin N → Fin 4) : ℂ := + ((2 : ℂ)^N)⁻¹ * Matrix.trace (star (pauliTensor w) * E) + +lemma sum_three_rotate {α β γ : Type*} [Fintype α] [Fintype β] [Fintype γ] + (f : α → β → γ → ℂ) : + (∑ a, ∑ b, ∑ c, f a b c) = ∑ b, ∑ c, ∑ a, f a b c := by + rw [Finset.sum_comm] + apply Finset.sum_congr rfl + intro b _ + exact Finset.sum_comm + +lemma matrix_delta_sum {N : ℕ} (E : Operator N) (x y : Word N) (z : ℂ) : + (∑ u : Word N, ∑ v : Word N, E u v * (if x = u ∧ y = v then z else 0)) = + E x y * z := by + classical + simp [ite_and, mul_ite] + +lemma pauli_expansion {N : ℕ} (E : Operator N) : + (∑ w : Fin N → Fin 4, pauliCoefficient E w • pauliTensor w) = E := by + classical + ext x y + simp only [Matrix.sum_apply, Matrix.smul_apply, smul_eq_mul] + change (∑ w : Fin N → Fin 4, pauliCoefficient E w * pauliTensor w x y) = E x y + calc + _ = ((2 : ℂ)^N)⁻¹ * ∑ w : Fin N → Fin 4, ∑ u : Word N, ∑ v : Word N, + E u v * (pauliTensor w x y * star (pauliTensor w u v)) := by + rw [Finset.mul_sum] + apply Finset.sum_congr rfl + intro w _ + simp only [pauliCoefficient, Matrix.trace, Matrix.diag_apply, Matrix.mul_apply, + Matrix.star_apply, Finset.mul_sum, Finset.sum_mul] + rw [Finset.sum_comm] + apply Finset.sum_congr rfl + intro u _ + apply Finset.sum_congr rfl + intro v _ + ring + _ = ((2 : ℂ)^N)⁻¹ * ∑ u : Word N, ∑ v : Word N, + E u v * ∑ w : Fin N → Fin 4, pauliTensor w x y * star (pauliTensor w u v) := by + rw [sum_three_rotate] + simp only [Finset.mul_sum] + _ = E x y := by + simp_rw [pauliTensor_complete] + rw [matrix_delta_sum] + have htwo : (2 : ℂ)^N ≠ 0 := pow_ne_zero N (by norm_num) + calc + _ = E x y * (((2 : ℂ)^N)⁻¹ * (2 : ℂ)^N) := by ring + _ = _ := by rw [inv_mul_cancel₀ htwo, mul_one] + +lemma pauliCoefficient_add {N : ℕ} (E F : Operator N) (w : Fin N → Fin 4) : + pauliCoefficient (E + F) w = pauliCoefficient E w + pauliCoefficient F w := by + simp [pauliCoefficient, mul_add, Matrix.trace_add] + +lemma pauliCoefficient_smul {N : ℕ} (c : ℂ) (E : Operator N) (w : Fin N → Fin 4) : + pauliCoefficient (c • E) w = c * pauliCoefficient E w := by + simp [pauliCoefficient, Matrix.trace_smul, smul_eq_mul, mul_left_comm] + +lemma tensorMatrix_trace {N : ℕ} (a : Fin N → QubitOperator) : + Matrix.trace (tensorMatrix a) = ∏ i, Matrix.trace (a i) := by + classical + exact (Fintype.prod_sum (fun i b => a i b b)).symm + +lemma pauliCoefficient_supported_zero {N : ℕ} (J : Finset (Fin N)) + (E : Operator N) (hE : TensorSupported J E) (w : Fin N → Fin 4) + (hw : ¬ pauliSupport w ⊆ J) : pauliCoefficient E w = 0 := by + classical + rcases hE with ⟨a, rfl, ha⟩ + obtain ⟨i, hi, hiJ⟩ := Finset.not_subset.mp hw + have hwi : w i ≠ 0 := (Finset.mem_filter.mp hi).2 + unfold pauliCoefficient pauliTensor + rw [tensorMatrix_star, tensorMatrix_mul, tensorMatrix_trace] + have hz : Matrix.trace (star (pauli (w i)) * a i) = 0 := by + rw [ha i hiJ, mul_one, pauli_trace_star hwi] + rw [Finset.prod_eq_zero (Finset.mem_univ i) hz, mul_zero] + +lemma pauliCoefficient_degree_zero {N ell : ℕ} (E : Operator N) + (hE : HasDegreeLE E ell) (w : Fin N → Fin 4) (hw : ell < (pauliSupport w).card) : + pauliCoefficient E w = 0 := by + induction hE using Submodule.span_induction with + | mem E hE => + obtain ⟨J, hJ, hJE⟩ := hE + apply pauliCoefficient_supported_zero J E hJE w + intro hs + have hh := Finset.card_le_card hs + have hj : J.card ≤ ell := by exact_mod_cast hJ + omega + | zero => simp [pauliCoefficient] + | add E F _ _ hE hF => rw [pauliCoefficient_add, hE, hF, add_zero] + | smul c E _ hE => rw [pauliCoefficient_smul, hE, mul_zero] + +lemma pauliCoefficient_norm {N : ℕ} (E : Operator N) (w : Fin N → Fin 4) : + ‖pauliCoefficient E w‖ ≤ ‖E‖ := by + have ht : ‖Matrix.trace (star (pauliTensor w) * E)‖ ≤ (2 : ℝ)^N * ‖E‖ := by + calc + _ ≤ ∑ x : Word N, ‖(star (pauliTensor w) * E) x x‖ := norm_sum_le _ _ + _ ≤ ∑ _x : Word N, ‖star (pauliTensor w) * E‖ := + Finset.sum_le_sum (fun x _ => matrix_entry_norm_le _ x x) + _ = (2 : ℝ)^N * ‖E‖ := by + simp [CStarRing.norm_mem_unitary_mul E + (Unitary.star_mem (pauliTensor_unitary w))] + unfold pauliCoefficient + rw [norm_mul, norm_inv, norm_pow] + norm_num only [Complex.norm_ofNat] + calc + _ ≤ ((2 : ℝ)^N)⁻¹ * ((2 : ℝ)^N * ‖E‖) := + mul_le_mul_of_nonneg_left ht (by positivity) + _ = _ := by rw [← mul_assoc, inv_mul_cancel₀ (by positivity), one_mul] + +end QAC + +end + +end OAI diff --git a/lean/OAI/InformationTheory/QuantumCircuit/PauliExpansion.lean b/lean/OAI/InformationTheory/QuantumCircuit/PauliExpansion.lean new file mode 100644 index 0000000000000000000000000000000000000000..73397bfa6312dee63a3933553924bcdcd070c485 --- /dev/null +++ b/lean/OAI/InformationTheory/QuantumCircuit/PauliExpansion.lean @@ -0,0 +1,132 @@ +import OAI.InformationTheory.QuantumCircuit.PauliBasis + +namespace OAI + +/-! Pauli coefficient and support bounds for low-degree operators. -/ + +noncomputable section +open scoped BigOperators Matrix.Norms.L2Operator + +namespace QAC + +def pauliFiber (N : ℕ) (S : Finset (Fin N)) : Finset (Fin N → Fin 4) := + Finset.univ.filter (fun w => pauliSupport w = S) + +lemma pauliFiber_card (N : ℕ) (S : Finset (Fin N)) : + (pauliFiber N S).card ≤ 3^S.card := by + classical + let f : ↥(pauliFiber N S) → (S → {a : Fin 4 // a ≠ 0}) := fun w i => + ⟨w.val i, by + have hs : pauliSupport w.val = S := (Finset.mem_filter.mp w.property).2 + have hi : i.val ∈ pauliSupport w.val := hs.symm ▸ i.property + exact (Finset.mem_filter.mp hi).2⟩ + have hf : Function.Injective f := by + intro w v heq + apply Subtype.ext + funext i + by_cases hi : i ∈ S + · exact congrArg Subtype.val (congrFun heq ⟨i, hi⟩) + · have hw : w.val i = 0 := by + by_contra hw + have hs : pauliSupport w.val = S := (Finset.mem_filter.mp w.property).2 + exact hi (hs ▸ Finset.mem_filter.mpr ⟨Finset.mem_univ i, hw⟩) + have hv : v.val i = 0 := by + by_contra hv + have hs : pauliSupport v.val = S := (Finset.mem_filter.mp v.property).2 + exact hi (hs ▸ Finset.mem_filter.mpr ⟨Finset.mem_univ i, hv⟩) + exact hw.trans hv.symm + have hc := Fintype.card_le_of_injective f hf + have hn : Fintype.card {a : Fin 4 // a ≠ 0} = 3 := by decide + simpa only [Fintype.card_coe, Fintype.card_fun, hn] using hc + +def lowPaulis (N ell : ℕ) : Finset (Fin N → Fin 4) := + Finset.univ.filter (fun w => (pauliSupport w).card ≤ ell) + +lemma lowPaulis_card {N ell : ℕ} (hN : 1 ≤ N) : + (lowPaulis N ell).card ≤ (ell + 1) * (3 * N)^ell := by + classical + let layers := fun j => (Finset.univ : Finset (Fin N)).powersetCard j + have hsub : lowPaulis N ell ⊆ (Finset.range (ell + 1)).biUnion + (fun j => (layers j).biUnion (pauliFiber N)) := by + intro w hw + have hw' := (Finset.mem_filter.mp hw).2 + refine Finset.mem_biUnion.mpr ⟨(pauliSupport w).card, by simp; omega, ?_⟩ + refine Finset.mem_biUnion.mpr ⟨pauliSupport w, + Finset.mem_powersetCard.mpr ⟨Finset.subset_univ _, rfl⟩, ?_⟩ + simp [pauliFiber] + calc + _ ≤ ((Finset.range (ell + 1)).biUnion (fun j => (layers j).biUnion (pauliFiber N))).card := + Finset.card_le_card hsub + _ ≤ ∑ j ∈ Finset.range (ell + 1), ((layers j).biUnion (pauliFiber N)).card := + Finset.card_biUnion_le + _ ≤ ∑ j ∈ Finset.range (ell + 1), ∑ S ∈ layers j, (pauliFiber N S).card := + Finset.sum_le_sum (fun _ _ => Finset.card_biUnion_le) + _ ≤ ∑ j ∈ Finset.range (ell + 1), (3 * N)^j := by + apply Finset.sum_le_sum + intro j _ + calc + _ ≤ ∑ S ∈ layers j, 3^j := by + apply Finset.sum_le_sum + intro S hS + have hc : S.card = j := (Finset.mem_powersetCard.mp hS).2 + simpa only [hc] using pauliFiber_card N S + _ = N.choose j * 3^j := by simp [layers, Finset.card_powersetCard] + _ ≤ N^j * 3^j := Nat.mul_le_mul_right _ (Nat.choose_le_pow _ _) + _ = _ := by rw [← mul_pow, Nat.mul_comm] + _ ≤ ∑ _j ∈ Finset.range (ell + 1), (3 * N)^ell := by + apply Finset.sum_le_sum + intro j hj + exact Nat.pow_le_pow_right (by omega) (by have := Finset.mem_range.mp hj; omega) + _ = _ := by simp + +lemma pauli_expansion_low {N ell : ℕ} (E : Operator N) (hE : HasDegreeLE E ell) : + (∑ w ∈ lowPaulis N ell, pauliCoefficient E w • pauliTensor w) = E := by + classical + calc + _ = ∑ w : Fin N → Fin 4, pauliCoefficient E w • pauliTensor w := by + apply Finset.sum_subset (Finset.subset_univ _) + intro w _ hw + have hh : ell < (pauliSupport w).card := by + have hn : ¬ (pauliSupport w).card ≤ ell := by simpa [lowPaulis] using hw + omega + rw [pauliCoefficient_degree_zero E hE w hh, zero_smul] + _ = E := pauli_expansion E + +def pauliExpansionTerm {N : ℕ} (E : Operator N) (w : Fin N → Fin 4) : LocalExpansionTerm N where + coeff := pauliCoefficient E w + gates := fun i => ⟨pauli (w i), pauli_unitary (w i)⟩ + support := pauliSupport w + outside := by + intro i hi + have hw : w i = 0 := by simpa [pauliSupport] using hi + apply Subtype.ext + simp [hw] + +theorem published_pauli_expansion : PublishedPauliExpansion := by + classical + intro N ell hN E hE + let terms := (lowPaulis N ell).toList.map (pauliExpansionTerm E) + refine ⟨terms, ?_, ?_, ?_⟩ + · dsimp [terms] + rw [List.map_map] + change E = ((lowPaulis N ell).toList.map + (fun w => pauliCoefficient E w • pauliTensor w)).sum + rw [← List.sum_toFinset _ (lowPaulis N ell).nodup_toList, Finset.toList_toFinset] + exact (pauli_expansion_low E hE).symm + · intro t ht + obtain ⟨w, hw, rfl⟩ := List.mem_map.mp ht + exact (Finset.mem_filter.mp (Finset.mem_toList.mp hw)).2 + · dsimp [terms] + rw [List.map_map] + change ((lowPaulis N ell).toList.map (fun w => ‖pauliCoefficient E w‖)).sum ≤ _ + rw [← List.sum_toFinset _ (lowPaulis N ell).nodup_toList, Finset.toList_toFinset] + calc + _ ≤ ∑ _w ∈ lowPaulis N ell, ‖E‖ := Finset.sum_le_sum (fun w _ => pauliCoefficient_norm E w) + _ = ((lowPaulis N ell).card : ℝ) * ‖E‖ := by simp + _ ≤ _ := mul_le_mul_of_nonneg_right (by exact_mod_cast lowPaulis_card (ell := ell) hN) (norm_nonneg E) + +end QAC + +end + +end OAI diff --git a/lean/OAI/InformationTheory/QuantumCircuit/Physical.lean b/lean/OAI/InformationTheory/QuantumCircuit/Physical.lean new file mode 100644 index 0000000000000000000000000000000000000000..3fc5ab1c396fe6355aafd20a2927c190a684041a --- /dev/null +++ b/lean/OAI/InformationTheory/QuantumCircuit/Physical.lean @@ -0,0 +1,143 @@ +import OAI.InformationTheory.QuantumCircuit.Toffoli +import OAI.InformationTheory.QuantumCircuit.Reflection + +namespace OAI + +noncomputable section +open scoped BigOperators Matrix.Norms.L2Operator Topology +open Polynomial Filter Asymptotics + +namespace QAC + +/-- A physical one-qubit gate, as a local layer. -/ +def singleLocal {N : ℕ} (q : Fin N) (u : Matrix.unitaryGroup Bit ℂ) : LocalLayer N := + fun i => if i=q then u else 1 + +lemma local_gate_matrix {N : ℕ} (q : Fin N) (u : Matrix.unitaryGroup Bit ℂ) : + Gate.matrix (.local q u) = localMatrix (singleLocal q u) := by + classical + change tensorMatrix (fun i => if i=q then (u:QubitOperator) else 1) = + tensorMatrix (fun i => ((singleLocal q u i):QubitOperator)) + congr 1 + funext i + unfold singleLocal + split_ifs <;> rfl + +lemma reflectList_rotate {N : ℕ} (l : List (Count N)) (L : LocalLayer N) : + reflectList (l.map (fun A => A.rotate L)) = conjugate (localMatrix L) (reflectList l) := by + induction l with + | nil => simp [reflectList,conjugate_one (localMatrix_unitary L)] + | cons A l ih => + simp only [List.map_cons,reflectList,List.prod_cons,List.map_map] at ih ⊢ + rw [conjugate_mul (localMatrix_unitary L),← ih] + congr 1 + simp only [reflect,conjugate_sub,conjugate_one (localMatrix_unitary L),conjugate_smul] + rw [A.rotate_zero L] + rfl + +lemma reflectList_rotate_commute {N : ℕ} (l : List (Count N)) (L : LocalLayer N) : + localMatrix L*reflectList l = reflectList (l.map (fun A => A.rotate L))*localMatrix L := by + rw [reflectList_rotate,conjugate] + simp only [mul_assoc,Unitary.star_mul_self_of_mem (localMatrix_unitary L),mul_one] + +/-- Local gates are moved to the right by rotating the product axes; supports +are unchanged, so a disjoint physical layer yields one reflection layer. -/ +def normalCounts {N : ℕ} : List (Gate N) → List (Count N) + | [] => [] + | .local q u :: l => (normalCounts l).map (fun A => A.rotate (singleLocal q u)) + | .toffoli c t _ :: l => toffoliCount c t :: normalCounts l + +def normalLocal {N : ℕ} : List (Gate N) → LocalLayer N + | [] => fun _ => 1 + | .local q u :: l => fun i => singleLocal q u i * normalLocal l i + | .toffoli _ _ _ :: l => normalLocal l + +lemma normalCounts_support {N : ℕ} (l : List (Gate N)) : + ∀ A ∈ normalCounts l, ∃ g ∈ l, A.support=g.support := by + induction l with + | nil => simp [normalCounts] + | cons g l ih => + cases g with + | «local» q u => + intro A hA + obtain ⟨B,hB,rfl⟩ := List.mem_map.mp hA + obtain ⟨g,hg,hBg⟩ := ih B hB + exact ⟨g,List.mem_cons_of_mem _ hg,hBg⟩ + | toffoli c t ht => + intro A hA + rcases List.mem_cons.mp hA with rfl | hA + · exact ⟨.toffoli c t ht,List.mem_cons_self ..,rfl⟩ + · obtain ⟨g,hg,hAg⟩ := ih A hA + exact ⟨g,List.mem_cons_of_mem _ hg,hAg⟩ + +lemma normalCounts_disjoint {N : ℕ} (l : List (Gate N)) + (hl : l.Pairwise (fun A B => Disjoint A.support B.support)) : + (normalCounts l).Pairwise (fun A B => Disjoint A.support B.support) := by + induction l with + | nil => simp [normalCounts] + | cons g l ih => + have hparts := List.pairwise_cons.mp hl + clear hl + cases g with + | «local» q u => + exact (ih hparts.2).map (fun A : Count N => A.rotate (singleLocal q u)) (fun _ _ h => h) + | toffoli c t ht => + apply List.pairwise_cons.mpr + refine ⟨?_,ih hparts.2⟩ + intro A hA + obtain ⟨g,hg',hAg⟩ := normalCounts_support l A hA + change Disjoint (Gate.support (.toffoli c t ht)) A.support + rw [hAg] + exact hparts.1 g hg' + +lemma gateList_normal {N : ℕ} (l : List (Gate N)) : + (l.map Gate.matrix).prod = reflectList (normalCounts l)*localMatrix (normalLocal l) := by + induction l with + | nil => simp [normalCounts,normalLocal,reflectList,localMatrix] + | cons g l ih => + cases g with + | «local» q u => + simp only [List.map_cons,List.prod_cons,normalCounts,normalLocal] + rw [local_gate_matrix,ih,← mul_assoc,reflectList_rotate_commute,mul_assoc,localMatrix_mul] + | toffoli c t ht => + simp only [List.map_cons,List.prod_cons,normalCounts,normalLocal] + rw [toffoli_reflection,ih] + simp only [reflectList,List.map_cons,List.prod_cons,mul_assoc] + +lemma physicalLayer_isCircuit {N : ℕ} (P : PhysicalLayer N) : + IsCircuit 1 (physicalLayerMatrix P) := by + let R : ReflectionLayer N := ⟨normalCounts P.gates,normalCounts_disjoint _ P.disjoint⟩ + refine ⟨1,R,normalLocal P.gates,?_,?_⟩ + · exact ⟨fun _ => 1,by simp [localMatrix]⟩ + · rw [one_mul,reflectionMatrix_eq] + exact gateList_normal P.gates + +lemma physicalCircuit_isCircuit {N : ℕ} (l : List (PhysicalLayer N)) : + IsCircuit l.length (physicalCircuitMatrix l) := by + induction l with + | nil => exact ⟨fun _ => 1,by simp [physicalCircuitMatrix,localMatrix]⟩ + | cons L l ih => + have h := ih.mul (physicalLayer_isCircuit L) + simpa only [physicalCircuitMatrix,List.map_cons,List.reverse_cons,List.prod_append, + List.prod_singleton,List.length_cons] using h + +lemma IsCircuit.succ {N d : ℕ} {U : Operator N} (hU : IsCircuit d U) : IsCircuit (d+1) U := by + refine ⟨U,⟨[],by simp⟩,fun _ => 1,hU,?_⟩ + simp [reflectionMatrix,localMatrix] + +lemma IsCircuit.mono {N d e : ℕ} {U : Operator N} (hU : IsCircuit d U) (hde : d ≤ e) : + IsCircuit e U := by + induction hde with + | refl => exact hU + | step h ih => exact ih.succ + +lemma IsCircuit.local_mul {N d : ℕ} {U : Operator N} (hU : IsCircuit d U) (L : LocalLayer N) : + IsCircuit d (localMatrix L*U) := by + have hL : IsCircuit 0 (localMatrix L) := ⟨L,rfl⟩ + simpa only [Nat.zero_add] using hL.mul hU + +end QAC + +end + +end OAI diff --git a/lean/OAI/InformationTheory/QuantumCircuit/Polynomial.lean b/lean/OAI/InformationTheory/QuantumCircuit/Polynomial.lean new file mode 100644 index 0000000000000000000000000000000000000000..6c6c77411d4108a3ab807f2dd834d7aea8bcc0e8 --- /dev/null +++ b/lean/OAI/InformationTheory/QuantumCircuit/Polynomial.lean @@ -0,0 +1,346 @@ +import OAI.InformationTheory.QuantumCircuit.Basic + +namespace OAI + +noncomputable section +open scoped BigOperators Matrix.Norms.L2Operator +open Polynomial Filter Asymptotics + +namespace QAC + +/-- The coefficient norm required to pay for expanding powers of a count. -/ +def weight (R : ℝ) (p : ℝ[X]) : ℝ := p.sum fun k c => |c| * R ^ k + +lemma weight_nonneg {R : ℝ} (hR : 0 ≤ R) (p : ℝ[X]) : 0 ≤ weight R p := by + exact Finset.sum_nonneg fun _ _ => mul_nonneg (abs_nonneg _) (pow_nonneg hR _) + +@[simp] lemma weight_zero (R : ℝ) : weight R 0 = 0 := by simp [weight] +@[simp] lemma weight_monomial (R c : ℝ) (k : ℕ) : + weight R (monomial k c) = |c| * R ^ k := by simp [weight] +@[simp] lemma weight_C (R c : ℝ) : weight R (C c) = |c| := by simp [weight] +@[simp] lemma weight_one (R : ℝ) : weight R 1 = 1 := by + simpa only [map_one, abs_one] using weight_C R 1 +@[simp] lemma weight_X (R : ℝ) : weight R X = R := by simp [weight] + +lemma weight_add_le {R : ℝ} (hR : 0 ≤ R) (p q : ℝ[X]) : + weight R (p + q) ≤ weight R p + weight R q := by + let s := p.support ∪ q.support + have hf : ∀ i : ℕ, |(0 : ℝ)| * R ^ i = 0 := by simp + have hp : p.support ⊆ s := Finset.subset_union_left + have hq : q.support ⊆ s := Finset.subset_union_right + unfold weight + rw [sum_eq_of_subset _ hf (support_add.trans (Finset.Subset.refl s)), + sum_eq_of_subset _ hf hp, sum_eq_of_subset _ hf hq, ← Finset.sum_add_distrib] + exact Finset.sum_le_sum fun i _ => by + rw [coeff_add, ← add_mul] + exact mul_le_mul_of_nonneg_right (abs_add_le _ _) (pow_nonneg hR _) + +@[simp] lemma weight_neg (R : ℝ) (p : ℝ[X]) : weight R (-p) = weight R p := by + simp [weight, Polynomial.sum] + +lemma weight_sub_le {R : ℝ} (hR : 0 ≤ R) (p q : ℝ[X]) : + weight R (p - q) ≤ weight R p + weight R q := by + simpa only [sub_eq_add_neg, weight_neg] using weight_add_le hR p (-q) + +lemma weight_sum_le {ι : Type*} {R : ℝ} (hR : 0 ≤ R) (s : Finset ι) (p : ι → ℝ[X]) : + weight R (∑ i ∈ s, p i) ≤ ∑ i ∈ s, weight R (p i) := by + classical + induction s using Finset.induction_on with + | empty => simp + | @insert i s hi ih => + simpa only [Finset.sum_insert hi] using + (weight_add_le hR (p i) (∑ j ∈ s, p j)).trans (add_le_add_right ih _) + +lemma weight_mul_le {R : ℝ} (hR : 0 ≤ R) (p q : ℝ[X]) : + weight R (p * q) ≤ weight R p * weight R q := by + rw [mul_eq_sum_sum] + apply (weight_sum_le hR _ _).trans + calc + _ ≤ ∑ i ∈ p.support, ∑ j ∈ q.support, + weight R (monomial (i + j) (p.coeff i * q.coeff j)) := + Finset.sum_le_sum fun i _ => weight_sum_le hR _ _ + _ = weight R p * weight R q := by + simp_rw [weight_monomial, abs_mul, pow_add] + unfold weight Polynomial.sum + rw [Finset.sum_mul] + simp_rw [Finset.mul_sum] + apply Finset.sum_congr rfl + intro i hi + apply Finset.sum_congr rfl + intro j hj + ring + +lemma weight_prod_le {ι : Type*} {R : ℝ} (hR : 0 ≤ R) (s : Finset ι) (p : ι → ℝ[X]) : + weight R (∏ i ∈ s, p i) ≤ ∏ i ∈ s, weight R (p i) := by + classical + induction s using Finset.induction_on with + | empty => simp + | @insert i s hi ih => + simp only [Finset.prod_insert hi] + exact (weight_mul_le hR _ _).trans + (mul_le_mul_of_nonneg_left ih (weight_nonneg hR _)) + +lemma weight_chebyshev {R : ℝ} (hR : 0 ≤ R) (z : ℝ[X]) (k : ℕ) : + weight R ((Polynomial.Chebyshev.T ℝ k).comp z) ≤ (2 * weight R z + 1) ^ k := by + let b := weight R z + let A := 2 * b + 1 + have hb : 0 ≤ b := weight_nonneg hR z + have hA : 1 ≤ A := by dsimp [A]; linarith + change weight R ((Polynomial.Chebyshev.T ℝ k).comp z) ≤ A ^ k + induction k using Nat.twoStepInduction with + | zero => simp [Polynomial.Chebyshev.T_zero] + | one => simpa [Polynomial.Chebyshev.T_one, A, b] using (show b ≤ A by dsimp [A]; linarith) + | more k hk hk1 => + have heq : Polynomial.Chebyshev.T ℝ (↑(k + 2)) = + 2 * X * Polynomial.Chebyshev.T ℝ (↑(k + 1)) - Polynomial.Chebyshev.T ℝ k := by + simpa only [Nat.cast_add, Nat.cast_ofNat, Nat.cast_one] using Polynomial.Chebyshev.T_add_two ℝ (k : ℤ) + rw [heq, sub_comp, mul_comp, mul_comp, X_comp] + have htwo : weight R ((2 : ℝ[X]).comp z) = 2 := by + rw [show (2 : ℝ[X]) = C 2 by exact (map_ofNat C 2).symm, C_comp, weight_C] + norm_num + calc + _ ≤ weight R (((2 : ℝ[X]).comp z) * z * (Polynomial.Chebyshev.T ℝ (↑(k + 1))).comp z) + + weight R ((Polynomial.Chebyshev.T ℝ (↑k)).comp z) := weight_sub_le hR _ _ + _ ≤ (2 * b) * A ^ (k + 1) + A ^ k := by + apply add_le_add _ hk + apply (weight_mul_le hR _ _).trans + apply mul_le_mul _ hk1 (weight_nonneg hR _) (by positivity) + simpa only [htwo] using weight_mul_le hR ((2 : ℝ[X]).comp z) z + _ ≤ A ^ (k + 2) := by + rw [pow_succ, pow_succ, pow_succ] + have h : 2 * b * A + 1 ≤ A * A := by dsimp [A]; nlinarith + nlinarith [mul_le_mul_of_nonneg_left h (pow_nonneg (le_trans zero_le_one hA) k)] + + +lemma chebyshev_abs_le_one (k : ℕ) {x : ℝ} (hx : x ∈ Set.Icc (-1) 1) : + |(Polynomial.Chebyshev.T ℝ k).eval x| ≤ 1 := by + rw [← Real.cos_arccos hx.1 hx.2, Polynomial.Chebyshev.T_real_cos] + exact Real.abs_cos_le_one _ + +/-- An elementary hyperbolic lower bound for the Chebyshev denominator. -/ +lemma chebyshev_denominator (k : ℕ) {m r : ℝ} (hr : 0 < r) (hm : r < m) : + 1 ≤ (Polynomial.Chebyshev.T ℝ k).eval ((m + r) / (m - r)) ∧ + Real.exp ((k : ℝ) * Real.sqrt (r / m)) / 2 ≤ + (Polynomial.Chebyshev.T ℝ k).eval ((m + r) / (m - r)) := by + let q := Real.sqrt (r / m) + have hm0 : 0 < m := lt_trans hr hm + have hq0 : 0 < q := Real.sqrt_pos.2 (div_pos hr hm0) + have hq1 : q < 1 := by + dsimp [q] + apply (Real.sqrt_lt' (by norm_num)).2 + simpa using (div_lt_one hm0).2 hm + have hq2 : q ^ 2 = r / m := Real.sq_sqrt (le_of_lt (div_pos hr hm0)) + let h := (1 + q) / (1 - q) + have hh0 : 0 < h := div_pos (by linarith) (by linarith) + have hlog : q ≤ Real.log h := by + dsimp [h] + rw [Real.log_div (by linarith) (by linarith)] + have hp := Real.log_nonneg (show 1 ≤ 1 + q by linarith) + have hn := Real.log_le_sub_one_of_pos (show 0 < 1 - q by linarith) + linarith + have harg : (m + r) / (m - r) = Real.cosh (Real.log h) := by + rw [Real.cosh_eq, Real.exp_log hh0, Real.exp_neg, Real.exp_log hh0] + dsimp [h] + have hqm : m * q ^ 2 = r := by nlinarith [((eq_div_iff (ne_of_gt hm0)).1 hq2)] + have hmr : m - r ≠ 0 := by linarith + have hqm1 : 1 - q ≠ 0 := by linarith + have hqp1 : 1 + q ≠ 0 := by linarith + field_simp [hmr, hqm1, hqp1] + nlinarith + rw [harg, Polynomial.Chebyshev.T_real_cosh] + constructor + · exact Real.one_le_cosh _ + · have he : Real.exp ((k : ℝ) * q) ≤ Real.exp ((k : ℤ) * Real.log h) := by + apply Real.exp_le_exp.2 + norm_cast + exact mul_le_mul_of_nonneg_left hlog (Nat.cast_nonneg k) + rw [Real.cosh_eq] + exact (div_le_div_of_nonneg_right he (by norm_num)).trans + (by have := Real.exp_pos (-((k : ℤ) * Real.log h)); linarith) + +/-- Exact roots at the first r positive integers. -/ +def rootPoly (r : ℕ) : ℝ[X] := + ∏ j ∈ Finset.range r, (1 - C ((j + 1 : ℝ)⁻¹) * X) + +@[simp] lemma rootPoly_eval_zero (r : ℕ) : (rootPoly r).eval 0 = 1 := by + simp [rootPoly, eval_prod] + +lemma rootPoly_eval_nat {r x : ℕ} (hx0 : 1 ≤ x) (hxr : x ≤ r) : + (rootPoly r).eval (x : ℝ) = 0 := by + have hx : x - 1 ∈ Finset.range r := Finset.mem_range.2 (by omega) + have hx1 : x - 1 + 1 = x := by omega + simp only [rootPoly, Polynomial.eval_prod, eval_sub, eval_one, eval_mul, eval_C, eval_X] + apply Finset.prod_eq_zero hx + have hxne : (x : ℝ) ≠ 0 := by exact_mod_cast (show x ≠ 0 by omega) + have he : ((x - 1 : ℕ) : ℝ) + 1 = x := by exact_mod_cast hx1 + rw [he, inv_mul_cancel₀ hxne, sub_self] + +lemma rootPoly_weight {R : ℝ} (hR : 0 ≤ R) (r : ℕ) : + weight R (rootPoly r) ≤ (1 + R) ^ r := by + unfold rootPoly + apply (weight_prod_le hR _ _).trans + calc + _ ≤ ∏ _j ∈ Finset.range r, (1 + R) := by + apply Finset.prod_le_prod₀ + · intro j hj + exact weight_nonneg hR _ + · intro j hj + apply (weight_sub_le hR _ _).trans + simp only [weight_one] + apply add_le_add_right + apply (weight_mul_le hR _ _).trans + rw [weight_C, weight_X, abs_of_nonneg (by positivity)] + exact mul_le_of_le_one_left hR (inv_le_one_of_one_le₀ (by norm_num)) + _ = (1 + R) ^ r := by simp + +lemma rootPoly_abs_eval {m x : ℝ} (hm : 1 ≤ m) (hx0 : 0 ≤ x) (hxm : x ≤ m) (r : ℕ) : + |(rootPoly r).eval x| ≤ m ^ r := by + simp only [rootPoly, eval_prod, eval_sub, eval_one, eval_mul, eval_C, eval_X, + Finset.abs_prod] + calc + _ ≤ ∏ _j ∈ Finset.range r, m := by + apply Finset.prod_le_prod₀ (fun _ _ => abs_nonneg _) + intro j hj + have hj1 : (1 : ℝ) ≤ (j : ℝ) + 1 := by norm_num + have hj0 : 0 < (j : ℝ) + 1 := by positivity + have hv0 : 0 ≤ ((j : ℝ) + 1)⁻¹ * x := by positivity + have hv : ((j : ℝ) + 1)⁻¹ * x ≤ m := + (mul_le_of_le_one_left hx0 (inv_le_one_of_one_le₀ hj1)).trans hxm + exact abs_le.2 ⟨by linarith, by linarith⟩ + _ = m ^ r := by simp + + +lemma rootPoly_degree (r : ℕ) : (rootPoly r).natDegree ≤ r := by + apply (natDegree_prod_le _ _).trans + calc + _ ≤ ∑ _j ∈ Finset.range r, 1 := by + apply Finset.sum_le_sum + intro j hj + apply (natDegree_sub_le _ _).trans + apply max_le (by simp) + exact (natDegree_C_mul_le _ _).trans (by simp) + _ = r := by simp + +/-- The affine map taking [r,m] onto [1,-1]. -/ +def scalePoly (r m : ℝ) : ℝ[X] := C ((m + r) / (m - r)) - C (2 / (m - r)) * X + +lemma scalePoly_eval (r m x : ℝ) : + (scalePoly r m).eval x = (m + r - 2 * x) / (m - r) := by + simp only [scalePoly, eval_sub, eval_C, eval_mul, eval_X] + ring + +lemma scalePoly_zero (r m : ℝ) : + (scalePoly r m).eval 0 = (m + r) / (m - r) := by rw [scalePoly_eval]; ring + +lemma scalePoly_interval {r m x : ℝ} (hrm : r < m) (hrx : r ≤ x) (hxm : x ≤ m) : + (scalePoly r m).eval x ∈ Set.Icc (-1) 1 := by + rw [scalePoly_eval] + constructor + · apply (le_div_iff₀ (sub_pos.2 hrm)).2 + linarith + · apply (div_le_one (sub_pos.2 hrm)).2 + linarith + +lemma scalePoly_degree (r m : ℝ) : (scalePoly r m).natDegree ≤ 1 := by + apply (natDegree_sub_le _ _).trans + simp only [natDegree_C, Nat.zero_max] + exact (natDegree_C_mul_le _ _).trans (by simp) + +lemma scalePoly_weight {R r m : ℝ} (hR : 0 ≤ R) (hr : 1 ≤ r) (hm : 2 * r ≤ m) : + weight R (scalePoly r m) ≤ 3 + 2 * R := by + have hmr : 1 ≤ m - r := by linarith + have hmr0 : 0 < m - r := by linarith + have hconst0 : 0 ≤ (m + r) / (m - r) := div_nonneg (by linarith) hmr0.le + have hconst : (m + r) / (m - r) ≤ 3 := by + apply (div_le_iff₀ hmr0).2 + linarith + have hlin0 : 0 ≤ 2 / (m - r) := by positivity + have hlin : 2 / (m - r) ≤ 2 := by + apply (div_le_iff₀ hmr0).2 + linarith + apply (weight_sub_le hR _ _).trans + apply (add_le_add_right (weight_mul_le hR _ _) _).trans + simp only [weight_C, weight_X, abs_of_nonneg hconst0, abs_of_nonneg hlin0] + exact add_le_add hconst (mul_le_mul_of_nonneg_right hlin hR) + +def approxPoly (r m k : ℕ) : ℝ[X] := + C (((Polynomial.Chebyshev.T ℝ k).eval (((m : ℝ) + r) / (m - r)))⁻¹) * + rootPoly r * (Polynomial.Chebyshev.T ℝ k).comp (scalePoly r m) + +/-- Finite degree, coefficient, normalization, and decay bounds for the approximating polynomial. -/ +lemma approxPoly_bounds {r m k : ℕ} {R : ℝ} (hR : 0 ≤ R) + (hr : 1 ≤ r) (hm : 2 * r ≤ m) + (hk : 4 * (r : ℝ) * Real.log m ≤ (k : ℝ) * Real.sqrt ((r : ℝ) / m)) : + (approxPoly r m k).natDegree ≤ r + k ∧ + weight R (approxPoly r m k) ≤ (1 + R) ^ r * (7 + 4 * R) ^ k ∧ + (approxPoly r m k).eval 0 = 1 ∧ + ∀ x : ℕ, 1 ≤ x → x ≤ m → + |(approxPoly r m k).eval (x : ℝ)| ≤ 2 * Real.exp (-(3 * (r : ℝ) * Real.log m)) := by + have hrR : (1 : ℝ) ≤ r := by exact_mod_cast hr + have hmR : 2 * (r : ℝ) ≤ m := by exact_mod_cast hm + have hrm : (r : ℝ) < m := by linarith + have hm0 : (0 : ℝ) < m := by linarith + have hden := chebyshev_denominator k (lt_of_lt_of_le zero_lt_one hrR) hrm + let den := (Polynomial.Chebyshev.T ℝ k).eval (((m : ℝ) + r) / (m - r)) + have hd1 : 1 ≤ den := hden.1 + have hd0 : 0 < den := lt_of_lt_of_le zero_lt_one hd1 + have hdb : Real.exp (4 * (r : ℝ) * Real.log m) / 2 ≤ den := + (div_le_div_of_nonneg_right (Real.exp_le_exp.2 hk) (by norm_num)).trans hden.2 + refine ⟨?_, ?_, ?_, ?_⟩ + · apply natDegree_mul_le.trans + apply add_le_add + · exact (natDegree_C_mul_le _ _).trans (rootPoly_degree r) + · apply natDegree_comp_le.trans + simpa only [Polynomial.Chebyshev.natDegree_T, Int.natAbs_natCast, mul_one] using + Nat.mul_le_mul_left k (scalePoly_degree r m) + · apply (weight_mul_le hR _ _).trans + apply mul_le_mul _ _ (weight_nonneg hR _) (by positivity) + · apply (weight_mul_le hR _ _).trans + rw [weight_C, abs_of_pos (inv_pos.2 hd0)] + exact (mul_le_of_le_one_left (weight_nonneg hR _) (inv_le_one_of_one_le₀ hd1)).trans + (rootPoly_weight hR r) + · apply (weight_chebyshev hR _ k).trans + apply pow_le_pow_left₀ (by have := weight_nonneg hR (scalePoly r m); linarith) + have := scalePoly_weight hR hrR hmR + linarith + · simp only [approxPoly, eval_mul, eval_C, rootPoly_eval_zero, mul_one, + eval_comp, scalePoly_zero] + exact inv_mul_cancel₀ (ne_of_gt hd0) + · intro x hx0 hxm + by_cases hxr : x ≤ r + · simp only [approxPoly, eval_mul, rootPoly_eval_nat hx0 hxr, mul_zero, zero_mul, + abs_zero] + positivity + have hrx : (r : ℝ) ≤ x := by exact_mod_cast (Nat.le_of_lt (Nat.lt_of_not_ge hxr)) + have hxmR : (x : ℝ) ≤ m := by exact_mod_cast hxm + have hroot := rootPoly_abs_eval (show (1 : ℝ) ≤ m by linarith) + (Nat.cast_nonneg x) hxmR r + have hcheb := chebyshev_abs_le_one k (scalePoly_interval hrm hrx hxmR) + have heq : (approxPoly r m k).eval (x : ℝ) = + den⁻¹ * (rootPoly r).eval (x : ℝ) * + (Polynomial.Chebyshev.T ℝ k).eval ((scalePoly r m).eval (x : ℝ)) := by + simp only [approxPoly, eval_mul, eval_C, eval_comp, den] + rw [heq, abs_mul, abs_mul, abs_of_pos (inv_pos.2 hd0)] + apply (mul_le_mul (mul_le_mul_of_nonneg_left hroot (le_of_lt (inv_pos.2 hd0))) + hcheb (abs_nonneg _) (by positivity)).trans + rw [mul_one, inv_mul_eq_div] + apply (div_le_iff₀ hd0).2 + have epos : 0 ≤ 2 * Real.exp (-(3 * (r : ℝ) * Real.log m)) := by positivity + apply (le_trans ?_ (mul_le_mul_of_nonneg_left hdb epos)) + rw [show 2 * Real.exp (-(3 * (r : ℝ) * Real.log m)) * + (Real.exp (4 * (r : ℝ) * Real.log m) / 2) = + Real.exp ((r : ℝ) * Real.log m) by + rw [show 2 * Real.exp (-(3 * (r : ℝ) * Real.log m)) * + (Real.exp (4 * (r : ℝ) * Real.log m) / 2) = + Real.exp (-(3 * (r : ℝ) * Real.log m)) * + Real.exp (4 * (r : ℝ) * Real.log m) by ring, + ← Real.exp_add] + congr 1 + ring] + rw [Real.exp_nat_mul, Real.exp_log hm0] + +end QAC + +end + +end OAI diff --git a/lean/OAI/InformationTheory/QuantumCircuit/ProductDistribution.lean b/lean/OAI/InformationTheory/QuantumCircuit/ProductDistribution.lean new file mode 100644 index 0000000000000000000000000000000000000000..c7a6fae3a384653a8df5d2efdd28517fd09453df --- /dev/null +++ b/lean/OAI/InformationTheory/QuantumCircuit/ProductDistribution.lean @@ -0,0 +1,116 @@ +import OAI.InformationTheory.QuantumCircuit.CommonAxes +import OAI.InformationTheory.QuantumCircuit.ProductState + +namespace OAI + +/-! Distribution of excitation patterns in a product basis. -/ + +noncomputable section +open scoped BigOperators Matrix.Norms.L2Operator + +namespace QAC + +def outcomeMass {N : ℕ} (M : Count N) (ψ : State N) (F : Finset (Fin N)) : ℝ := + ‖act (M.pattern F) ψ‖^2 + +def meanCount {N : ℕ} (M : Count N) (ψ : State N) : ℝ := + ∑ F ∈ M.support.powerset, (F.card : ℝ) * outcomeMass M ψ F + +lemma outcomeMass_nonneg {N : ℕ} (M : Count N) (ψ : State N) (F : Finset (Fin N)) : + 0 ≤ outcomeMass M ψ F := sq_nonneg _ + +lemma outcomeMass_total (hspec : PublishedProductSpectralResolution) + {N : ℕ} (M : Count N) (ψ : State N) : + ∑ F ∈ M.support.powerset, outcomeMass M ψ F = ‖ψ‖^2 := by + symm + have h := hspec.pythagoras M.support.powerset M.pattern ψ + (fun F _ => M.pattern_projection F) (fun F hF G hG hFG => by + rw [M.pattern_mul (Finset.mem_powerset.mp hF) (Finset.mem_powerset.mp hG), + ite_eq_right hFG]) + simpa only [M.sum_pattern, act_one, outcomeMass] using h + +lemma outcomeMass_high (hspec : PublishedProductSpectralResolution) + {N : ℕ} (M : Count N) (ψ : State N) (r : ℝ) : + ∑ F ∈ M.support.powerset.filter (fun F => r ≤ (F.card : ℝ)), outcomeMass M ψ F = + ‖act (M.high r) ψ‖^2 := by + symm + rw [M.high_eq_sum_filter] + exact hspec.pythagoras _ M.pattern ψ (fun F _ => M.pattern_projection F) + (fun F hF G hG hFG => by + rw [M.pattern_mul (Finset.mem_powerset.mp (Finset.mem_filter.mp hF).1) + (Finset.mem_powerset.mp (Finset.mem_filter.mp hG).1), ite_eq_right hFG]) + +lemma meanCount_le_cut (hspec : PublishedProductSpectralResolution) + {N : ℕ} (M : Count N) (ψ : State N) {r : ℝ} (hr : 0 ≤ r) : + meanCount M ψ ≤ r * ‖ψ‖^2 + N * ‖act (M.high r) ψ‖^2 := by + rw [← outcomeMass_total hspec M ψ, ← outcomeMass_high hspec M ψ, + Finset.sum_filter, Finset.mul_sum, Finset.mul_sum, ← Finset.sum_add_distrib] + apply Finset.sum_le_sum + intro F hF + have hfN : (F.card : ℝ) ≤ N := by + exact_mod_cast (show F.card ≤ N by simpa using + (Finset.card_le_card (Finset.mem_powerset.mp hF)).trans (Finset.card_le_univ _)) + have hm := outcomeMass_nonneg M ψ F + by_cases hf : r ≤ (F.card : ℝ) + · simp only [hf, ite_true] + nlinarith [mul_le_mul_of_nonneg_right hfN hm] + · simp only [hf, ite_false, mul_zero, add_zero] + exact mul_le_mul_of_nonneg_right (not_le.mp hf).le hm + +lemma Count.Subcount.pattern_eq {N : ℕ} {A M : Count N} + (h : A.Subcount M) (F : Finset (Fin N)) : + A.pattern F = (M.restrict A.support).pattern F := by + classical + unfold Count.pattern Count.restrict + congr 1 + funext i + by_cases hi : i ∈ A.support + · simp [hi, h.1 hi, h.2 i hi] + · simp [hi] + +lemma meanCount_subcount (hspec : PublishedProductSpectralResolution) + {N : ℕ} (A M : Count N) (h : A.Subcount M) (ψ : State N) : + meanCount A ψ = ∑ F ∈ M.support.powerset, + ((F ∩ A.support).card : ℝ) * outcomeMass M ψ F := by + have hh := hspec.restriction_moment M A.support ψ + have hs : (M.restrict A.support).support = A.support := Finset.inter_eq_right.mpr h.1 + rw [hs] at hh + simpa only [meanCount, outcomeMass, h.pattern_eq] using hh + +lemma meanCount_join (hspec : PublishedProductSpectralResolution) + {N : ℕ} (A B : Count N) (h : Disjoint A.support B.support) (ψ : State N) : + meanCount (A.join B) ψ = meanCount A ψ + meanCount B ψ := by + classical + rw [meanCount_subcount hspec A (A.join B) (Count.subcount_join_left A B), + meanCount_subcount hspec B (A.join B) (Count.subcount_join_right A B h), + ← Finset.sum_add_distrib] + apply Finset.sum_congr rfl + intro F hF + have hdis : Disjoint (F ∩ A.support) (F ∩ B.support) := + h.mono Finset.inter_subset_right Finset.inter_subset_right + have hu : F ∩ A.support ∪ F ∩ B.support = F := by + rw [← Finset.inter_union_distrib_left, Finset.inter_eq_left] + exact Finset.mem_powerset.mp hF + have hc := Finset.card_union_of_disjoint hdis + rw [hu] at hc + change (F.card : ℝ) * outcomeMass (A.join B) ψ F = _ + rw [hc] + push_cast + ring + +lemma meanCount_joint (hspec : PublishedProductSpectralResolution) + {N : ℕ} (l : List (Count N)) + (hl : l.Pairwise (fun A B => Disjoint A.support B.support)) (ψ : State N) : + meanCount (jointTest l) ψ = (l.map (fun A => meanCount A ψ)).sum := by + induction l with + | nil => simp [jointTest, meanCount, Count.empty, outcomeMass] + | cons A l ih => + obtain ⟨ha, hl⟩ := List.pairwise_cons.mp hl + rw [jointTest, meanCount_join hspec A _ (jointTest_disjoint A l ha), ih hl] + rfl + +end QAC + +end + +end OAI diff --git a/lean/OAI/InformationTheory/QuantumCircuit/ProductProjection.lean b/lean/OAI/InformationTheory/QuantumCircuit/ProductProjection.lean new file mode 100644 index 0000000000000000000000000000000000000000..25965c68f07394dd21fdce88b4e23261cb243f84 --- /dev/null +++ b/lean/OAI/InformationTheory/QuantumCircuit/ProductProjection.lean @@ -0,0 +1,311 @@ +import OAI.InformationTheory.QuantumCircuit.Basic + +namespace OAI + +noncomputable section +open scoped BigOperators Matrix.Norms.L2Operator symmDiff +open Matrix + +namespace QAC + +@[simp] lemma tensorMatrix_one {N : ℕ} : tensorMatrix (fun _ : Fin N => (1 : QubitOperator)) = 1 := by + classical + ext x y + simp only [tensorMatrix, Matrix.one_apply] + by_cases h : x = y + · subst y + simp + · rw [ite_eq_right h] + obtain ⟨i, hi⟩ := Function.ne_iff.mp h + exact Finset.prod_eq_zero (Finset.mem_univ i) (ite_eq_right hi) + +lemma tensorMatrix_mul {N : ℕ} (a b : Fin N → QubitOperator) : + tensorMatrix a * tensorMatrix b = tensorMatrix (fun i => a i * b i) := by + classical + ext x y + simp only [Matrix.mul_apply, tensorMatrix] + simp_rw [← Finset.prod_mul_distrib] + exact (Fintype.prod_sum (fun i z => a i (x i) z * b i z (y i))).symm + +@[simp] lemma tensorMatrix_star {N : ℕ} (a : Fin N → QubitOperator) : + star (tensorMatrix a) = tensorMatrix (fun i => star (a i)) := by + classical + ext x y + simp [tensorMatrix, Matrix.star_apply] + +lemma tensorMatrix_zero_of_zero {N : ℕ} (a : Fin N → QubitOperator) + (i : Fin N) (hi : a i = 0) : tensorMatrix a = 0 := by + classical + ext x y + apply Finset.prod_eq_zero (Finset.mem_univ i) + simp [hi] + +lemma tensorMatrix_projection {N : ℕ} (a : Fin N → QubitOperator) + (ha : ∀ i, IsStarProjection (a i)) : IsStarProjection (tensorMatrix a) := by + rw [isStarProjection_iff'] + constructor + · rw [tensorMatrix_mul] + congr 1 + funext i + exact (ha i).isIdempotentElem.eq + · rw [tensorMatrix_star] + congr 1 + funext i + exact (ha i).isSelfAdjoint.star_eq + +lemma tensorMatrix_unitary {N : ℕ} (a : Fin N → QubitOperator) + (ha : ∀ i, a i ∈ unitary QubitOperator) : tensorMatrix a ∈ unitary (Operator N) := by + rw [Unitary.mem_iff] + simp only [tensorMatrix_star, tensorMatrix_mul] + constructor <;> convert tensorMatrix_one (N := N) using 1 <;> + congr 1 <;> funext i + · exact (Unitary.mem_iff.mp (ha i)).1 + · exact (Unitary.mem_iff.mp (ha i)).2 + +@[simp] lemma rankOne_star (v : Bit → ℂ) : star (rankOne v) = rankOne v := by + ext x y + simp [rankOne, Matrix.star_apply, mul_comm] + +lemma normalized_complex {v : Bit → ℂ} (hv : ∑ b, Complex.normSq (v b) = 1) : + ∑ b, star (v b) * v b = 1 := by + have h := congrArg (fun x : ℝ => (x : ℂ)) hv + simp only [Complex.ofReal_sum, Complex.ofReal_one] at h + simpa only [mul_comm, Complex.star_def, Complex.mul_conj] using h + +lemma rankOne_projection {v : Bit → ℂ} (hv : ∑ b, Complex.normSq (v b) = 1) : + IsStarProjection (rankOne v) := by + rw [isStarProjection_iff'] + refine ⟨?_, rankOne_star v⟩ + ext x y + simp only [Matrix.mul_apply, rankOne] + calc + _ = v x * (∑ z, star (v z) * v z) * star (v y) := by + simp only [Finset.mul_sum, Finset.sum_mul] + congr 1 + funext z + ring + _ = _ := by rw [normalized_complex hv]; ring + +lemma Count.zero_projection {N : ℕ} (M : Count N) : IsStarProjection M.zero := by + apply tensorMatrix_projection + intro i + split_ifs with hi + · exact rankOne_projection (M.normalized i hi) + · exact IsStarProjection.one _ + +lemma Count.pattern_projection {N : ℕ} (M : Count N) (F : Finset (Fin N)) : + IsStarProjection (M.pattern F) := by + apply tensorMatrix_projection + intro i + split_ifs with hi hF + · exact (rankOne_projection (M.normalized i hi)).one_sub + · exact rankOne_projection (M.normalized i hi) + · exact IsStarProjection.one _ + +@[simp] lemma Count.pattern_empty {N : ℕ} (M : Count N) : M.pattern ∅ = M.zero := by + simp [Count.pattern, Count.zero] + +lemma Count.pattern_mul {N : ℕ} (M : Count N) {F G : Finset (Fin N)} + (hF : F ⊆ M.support) (hG : G ⊆ M.support) : + M.pattern F * M.pattern G = if F = G then M.pattern F else 0 := by + classical + by_cases hFG : F = G + · subst G + rw [ite_eq_left rfl, (M.pattern_projection F).isIdempotentElem.eq] + rw [ite_eq_right hFG, Count.pattern, Count.pattern, tensorMatrix_mul] + obtain ⟨i, hi⟩ : ∃ i, (i ∈ F ∧ i ∉ G) ∨ (i ∈ G ∧ i ∉ F) := by + by_contra h + push Not at h + apply hFG + ext i + specialize h i + aesop + apply tensorMatrix_zero_of_zero _ i + rcases hi with ⟨hiF, hiG⟩ | ⟨hiG, hiF⟩ + · simp only [ite_eq_left (hF hiF), ite_eq_left hiF, ite_eq_right hiG] + exact (rankOne_projection (M.normalized i (hF hiF))).one_sub_mul_self + · simp only [ite_eq_left (hG hiG), ite_eq_left hiG, ite_eq_right hiF] + exact (rankOne_projection (M.normalized i (hG hiG))).mul_one_sub_self + + +lemma sum_powerset_prod_ite {ι R : Type*} [DecidableEq ι] [CommSemiring R] + (S : Finset ι) (a b : ι → R) : + ∑ F ∈ S.powerset, ∏ i ∈ S, (if i ∈ F then a i else b i) = ∏ i ∈ S, (a i + b i) := by + classical + rw [Finset.prod_add] + apply Finset.sum_congr rfl + intro F hF + have hFS : F ⊆ S := Finset.mem_powerset.mp hF + rw [Finset.prod_ite] + congr 1 + · congr 1 + ext i + simp only [Finset.mem_filter] + exact ⟨fun h => h.2, fun h => ⟨hFS h, h⟩⟩ + · congr 1 + ext i + simp + +lemma prod_ite_mem {ι R : Type*} [Fintype ι] [DecidableEq ι] [CommMonoid R] + (S : Finset ι) (a b : ι → R) : + ∏ i, (if i ∈ S then a i else b i) = (∏ i ∈ S, a i) * ∏ i ∈ Finset.univ \ S, b i := by + classical + rw [Finset.prod_ite] + congr 1 + · simp + · congr 1 + ext i + simp + +lemma tensorMatrix_sum_patterns {N : ℕ} (S : Finset (Fin N)) + (a b c : Fin N → QubitOperator) : + (∑ F ∈ S.powerset, tensorMatrix (fun i => + if i ∈ S then (if i ∈ F then a i else b i) else c i)) = + tensorMatrix (fun i => if i ∈ S then a i + b i else c i) := by + classical + ext x y + simp only [Matrix.sum_apply] + change (∑ F ∈ S.powerset, ∏ i, (if i ∈ S then (if i ∈ F then a i else b i) else c i) (x i) (y i)) = + ∏ i, (if i ∈ S then a i + b i else c i) (x i) (y i) + simp only [Matrix.ite_apply, Matrix.add_apply] + simp_rw [prod_ite_mem S] + rw [← Finset.sum_mul, sum_powerset_prod_ite] + +@[simp] lemma Count.sum_pattern {N : ℕ} (M : Count N) : + ∑ F ∈ M.support.powerset, M.pattern F = 1 := by + classical + unfold Count.pattern + rw [tensorMatrix_sum_patterns] + simp + +lemma projection_sum {A ι : Type*} [Ring A] [StarRing A] (s : Finset ι) (p : ι → A) + (hp : ∀ i ∈ s, IsStarProjection (p i)) + (horth : ∀ i ∈ s, ∀ j ∈ s, i ≠ j → p i * p j = 0) : + IsStarProjection (∑ i ∈ s, p i) := by + classical + induction s using Finset.induction_on with + | empty => simp + | @insert i s hi ih => + rw [Finset.sum_insert hi] + apply (hp i (Finset.mem_insert_self _ _)).add + · apply ih + · exact fun j hj => hp j (Finset.mem_insert_of_mem hj) + · exact fun j hj k hk h => horth j (Finset.mem_insert_of_mem hj) + k (Finset.mem_insert_of_mem hk) h + · rw [Finset.mul_sum] + apply Finset.sum_eq_zero + intro j hj + apply horth i (Finset.mem_insert_self _ _) j (Finset.mem_insert_of_mem hj) + intro h + exact hi (h ▸ hj) + +lemma Count.high_eq_sum_filter {N : ℕ} (M : Count N) (r : ℝ) : + M.high r = ∑ F ∈ M.support.powerset.filter (fun F => r ≤ (F.card : ℝ)), M.pattern F := by + classical + simp only [Count.high, Finset.sum_filter] + +lemma Count.high_projection {N : ℕ} (M : Count N) (r : ℝ) : IsStarProjection (M.high r) := by + classical + rw [M.high_eq_sum_filter] + apply projection_sum + · exact fun F _ => M.pattern_projection F + · intro F hF G hG hFG + rw [M.pattern_mul (Finset.mem_powerset.mp (Finset.mem_filter.mp hF).1) + (Finset.mem_powerset.mp (Finset.mem_filter.mp hG).1), ite_eq_right hFG] + +lemma Count.high_mul_zero {N : ℕ} (M : Count N) {r : ℝ} (hr : 0 < r) : + M.high r * M.zero = 0 := by + classical + rw [M.high_eq_sum_filter, Finset.sum_mul] + apply Finset.sum_eq_zero + intro F hF + rw [← M.pattern_empty, M.pattern_mul (Finset.mem_powerset.mp (Finset.mem_filter.mp hF).1) + (Finset.empty_subset _)] + split_ifs with h + · subst F + have h' := (Finset.mem_filter.mp hF).2 + simp only [Finset.card_empty, Nat.cast_zero] at h' + exact (not_le_of_gt hr h').elim + · rfl + +lemma Count.high_eq_zero {N : ℕ} (M : Count N) {r : ℝ} (hr : (N : ℝ) < r) : M.high r = 0 := by + classical + unfold Count.high + apply Finset.sum_eq_zero + intro F hF + rw [ite_eq_right] + have hFN : F.card ≤ N := by simpa using Finset.card_le_univ F + have hFR : (F.card : ℝ) ≤ N := by exact_mod_cast hFN + linarith + + +section SpectralAlgebra + +variable {A ι : Type*} [CStarAlgebra A] + +lemma orthogonal_sum_mul (s : Finset ι) (p : ι → A) + (hp : ∀ i ∈ s, IsStarProjection (p i)) + (horth : ∀ i ∈ s, ∀ j ∈ s, i ≠ j → p i * p j = 0) (c d : ι → ℝ) : + (∑ i ∈ s, c i • p i) * (∑ i ∈ s, d i • p i) = ∑ i ∈ s, (c i * d i) • p i := by + classical + rw [Finset.sum_mul] + apply Finset.sum_congr rfl + intro i hi + rw [Finset.mul_sum, Finset.sum_eq_single i] + · rw [smul_mul_smul_comm, (hp i hi).isIdempotentElem.eq] + · intro j hj hji + rw [smul_mul_smul_comm, horth i hi j hj (Ne.symm hji), smul_zero] + · intro h + exact (h hi).elim + +lemma orthogonal_sum_star (s : Finset ι) (p : ι → A) + (hp : ∀ i ∈ s, IsStarProjection (p i)) (c : ι → ℝ) : + star (∑ i ∈ s, c i • p i) = ∑ i ∈ s, c i • p i := by + rw [star_sum] + apply Finset.sum_congr rfl + intro i hi + simp only [star_smul, star_trivial, (hp i hi).isSelfAdjoint.star_eq] + +variable [PartialOrder A] [StarOrderedRing A] + +lemma orthogonal_sum_norm_le (s : Finset ι) (p : ι → A) + (hp : ∀ i ∈ s, IsStarProjection (p i)) + (horth : ∀ i ∈ s, ∀ j ∈ s, i ≠ j → p i * p j = 0) + (hsum : ∑ i ∈ s, p i = 1) (c : ι → ℝ) {C : ℝ} (hC : 0 ≤ C) + (hc : ∀ i ∈ s, |c i| ≤ C) : ‖∑ i ∈ s, c i • p i‖ ≤ C := by + have hsq : star (∑ i ∈ s, c i • p i) * (∑ i ∈ s, c i • p i) = + ∑ i ∈ s, (c i)^2 • p i := by + rw [orthogonal_sum_star s p hp c, orthogonal_sum_mul s p hp horth] + simp only [pow_two] + have hle : (∑ i ∈ s, (c i)^2 • p i) ≤ algebraMap ℝ A (C^2) := by + calc + _ ≤ ∑ i ∈ s, C^2 • p i := by + apply Finset.sum_le_sum + intro i hi + apply smul_le_smul_of_nonneg_right _ (hp i hi).nonneg + simpa only [sq_abs] using (sq_le_sq₀ (abs_nonneg _) hC).2 (hc i hi) + _ = _ := by rw [← Finset.smul_sum, hsum, Algebra.algebraMap_eq_smul_one] + have hnorm := (CStarAlgebra.norm_le_iff_le_algebraMap _ (sq_nonneg C) + (star_mul_self_nonneg (∑ i ∈ s, c i • p i))).2 (hsq ▸ hle) + rw [CStarRing.norm_star_mul_self] at hnorm + nlinarith only [hnorm, norm_nonneg (∑ i ∈ s, c i • p i), hC] + +end SpectralAlgebra + +open scoped MatrixOrder in +lemma Count.spectral_norm_le {N : ℕ} (M : Count N) (f : ℕ → ℝ) + {C : ℝ} (hC : 0 ≤ C) (hf : ∀ k ≤ N, |f k| ≤ C) : + ‖∑ F ∈ M.support.powerset, f F.card • M.pattern F‖ ≤ C := by + refine orthogonal_sum_norm_le M.support.powerset M.pattern + (fun F _ => M.pattern_projection F) ?_ M.sum_pattern _ hC ?_ + · intro F hF G hG hFG + rw [M.pattern_mul (Finset.mem_powerset.mp hF) (Finset.mem_powerset.mp hG), ite_eq_right hFG] + · intro F _ + apply hf + simpa using Finset.card_le_univ F + +end QAC + +end + +end OAI diff --git a/lean/OAI/InformationTheory/QuantumCircuit/ProductSpectralResolution.lean b/lean/OAI/InformationTheory/QuantumCircuit/ProductSpectralResolution.lean new file mode 100644 index 0000000000000000000000000000000000000000..f6aba7c297afdafd7d8aa1eeaba5e7557c73daab --- /dev/null +++ b/lean/OAI/InformationTheory/QuantumCircuit/ProductSpectralResolution.lean @@ -0,0 +1,171 @@ +import OAI.InformationTheory.QuantumCircuit.Pruning + +namespace OAI + +/-! Orthogonal product-basis spectral resolutions. -/ + +noncomputable section +open scoped BigOperators Matrix.Norms.L2Operator +open Polynomial + +namespace QAC + +lemma act_finset_sum {N : ℕ} {ι : Type*} (s : Finset ι) + (P : ι → Operator N) (ψ : State N) : + act (∑ i ∈ s, P i) ψ = ∑ i ∈ s, act (P i) ψ := by + simp [act, map_sum] + +lemma projection_pythagoras {N : ℕ} {ι : Type} (s : Finset ι) + (P : ι → Operator N) (ψ : State N) + (hp : ∀ i ∈ s, IsStarProjection (P i)) + (ho : ∀ i ∈ s, ∀ j ∈ s, i ≠ j → P i * P j = 0) : + ‖act (∑ i ∈ s, P i) ψ‖^2 = ∑ i ∈ s, ‖act (P i) ψ‖^2 := by + classical + have hc : ∀ i ∈ s, ∀ j ∈ s, i ≠ j → + inner ℂ (act (P i) ψ) (act (P j) ψ) = 0 := by + intro i hi j hj hij + calc + _ = inner ℂ ψ (act (star (P i)) (act (P j) ψ)) := by + simpa only [star_star] using (inner_act_right (star (P i)) ψ (act (P j) ψ)).symm + _ = 0 := by rw [← act_mul, (hp i hi).isSelfAdjoint.star_eq, ho i hi j hj hij, act_zero, inner_zero_right] + rw [act_finset_sum] + have hh : inner ℂ (∑ i ∈ s, act (P i) ψ) (∑ i ∈ s, act (P i) ψ) = + ∑ i ∈ s, inner ℂ (act (P i) ψ) (act (P i) ψ) := by + simp only [inner_sum, sum_inner] + apply Finset.sum_congr rfl + intro i hi + apply Finset.sum_eq_single i + · intro j hj hji + exact hc j hj i hi hji + · exact fun h => (h hi).elim + have hreal := congrArg Complex.re hh + simpa [inner_self_eq_norm_sq_to_K, ← Complex.ofReal_pow] using hreal + +lemma Count.restrict_operator_mul_pattern {N : ℕ} (M : Count N) + (J F : Finset (Fin N)) (hF : F ⊆ M.support) : + (M.restrict J).operator * M.pattern F = ((F ∩ J).card : ℝ) • M.pattern F := by + classical + rw [Count.operator, Finset.sum_mul] + calc + _ = ∑ i ∈ M.support ∩ J, if i ∈ F then M.pattern F else 0 := by + apply Finset.sum_congr rfl + intro i hi + exact M.generator_mul_pattern i (Finset.mem_inter.mp hi).1 F + _ = _ := by + rw [Finset.sum_ite_mem] + have heq : (M.support ∩ J) ∩ F = F ∩ J := by + ext i + simp only [Finset.mem_inter] + constructor + · tauto + · intro hi; exact ⟨⟨hF hi.1, hi.2⟩, hi.1⟩ + rw [heq, Finset.sum_const, ← Nat.cast_smul_eq_nsmul ℝ] + +lemma Count.restrict_operator_pow_mul_pattern {N : ℕ} (M : Count N) + (J F : Finset (Fin N)) (hF : F ⊆ M.support) (k : ℕ) : + (M.restrict J).operator^k * M.pattern F = + (((F ∩ J).card : ℝ)^k) • M.pattern F := by + induction k with + | zero => simp + | succ k ih => + rw [pow_succ', mul_assoc, ih, mul_smul_comm, M.restrict_operator_mul_pattern J F hF, smul_smul] + congr 1 + +lemma Count.restrict_polynomial_mul_pattern {N : ℕ} (M : Count N) + (J F : Finset (Fin N)) (hF : F ⊆ M.support) (p : ℝ[X]) : + (M.restrict J).polynomial p * M.pattern F = + p.eval ((F ∩ J).card : ℝ) • M.pattern F := by + classical + rw [(M.restrict J).polynomial_eq_sum, Finset.sum_mul, Polynomial.eval_eq_sum, Polynomial.sum] + simp_rw [smul_mul_assoc, M.restrict_operator_pow_mul_pattern J F hF, smul_smul] + exact (Finset.sum_smul ..).symm + +lemma Count.restrict_operator_expansion {N : ℕ} (M : Count N) (J : Finset (Fin N)) : + (M.restrict J).operator = ∑ F ∈ M.support.powerset, + ((F ∩ J).card : ℝ) • M.pattern F := by + calc + _ = (M.restrict J).operator * (∑ F ∈ M.support.powerset, M.pattern F) := by + rw [M.sum_pattern, mul_one] + _ = _ := by + rw [Finset.mul_sum] + apply Finset.sum_congr rfl + intro F hF + exact M.restrict_operator_mul_pattern J F (Finset.mem_powerset.mp hF) + +lemma Count.restrict_high_expansion {N : ℕ} (M : Count N) + (J : Finset (Fin N)) (r : ℝ) : + (M.restrict J).high r = ∑ F ∈ M.support.powerset, + if r ≤ ((F ∩ J).card : ℝ) then M.pattern F else 0 := by + classical + let s := Finset.range (N + 1) + let p : ℝ[X] := Lagrange.interpolate s (fun k : ℕ => (k : ℝ)) + (fun k => if r ≤ (k : ℝ) then 1 else 0) + have hp : ∀ k : ℕ, k ≤ N → p.eval (k : ℝ) = if r ≤ (k : ℝ) then 1 else 0 := by + intro k hk + exact Lagrange.eval_interpolate_at_node _ (by intro i _ j _ hij; exact_mod_cast hij) + (by simp [s]; omega) + have heq : (M.restrict J).high r = (M.restrict J).polynomial p := by + rw [(M.restrict J).high_spectral] + unfold Count.polynomial Count.spectral + apply Finset.sum_congr rfl + intro F hF + have hk : F.card ≤ N := (Finset.card_le_card (Finset.mem_powerset.mp hF)).trans + (by simpa using Finset.card_le_univ (M.restrict J).support) + change (if r ≤ (F.card : ℝ) then (1 : ℝ) else 0) • _ = p.eval (F.card : ℝ) • _ + rw [hp F.card hk] + rw [heq] + calc + _ = (M.restrict J).polynomial p * (∑ F ∈ M.support.powerset, M.pattern F) := by + rw [M.sum_pattern, mul_one] + _ = _ := by + rw [Finset.mul_sum] + apply Finset.sum_congr rfl + intro F hF + rw [M.restrict_polynomial_mul_pattern J F (Finset.mem_powerset.mp hF)] + have hk : (F ∩ J).card ≤ N := (Finset.card_le_card Finset.inter_subset_left).trans + (by simpa using Finset.card_le_univ F) + rw [hp _ hk] + split_ifs <;> simp + +lemma expectation_pattern_sum {N : ℕ} (M : Count N) (ψ : State N) + (c : Finset (Fin N) → ℝ) : + (inner ℂ ψ (act (∑ F ∈ M.support.powerset, c F • M.pattern F) ψ)).re = + ∑ F ∈ M.support.powerset, c F * outcomeMass M ψ F := by + rw [act_finset_sum, inner_sum] + simp only [act_real_smul] + simp_rw [show ∀ F, (c F • act (M.pattern F) ψ : State N) = + (c F : ℂ) • act (M.pattern F) ψ from fun _ => rfl, + inner_smul_right, projection_inner_self _ (M.pattern_projection _)] + simp [outcomeMass, -Complex.ofReal_pow] + +lemma restriction_moment {N : ℕ} (M : Count N) (J : Finset (Fin N)) (ψ : State N) : + meanCount (M.restrict J) ψ = ∑ F ∈ M.support.powerset, + ((F ∩ J).card : ℝ) * outcomeMass M ψ F := by + have ha : meanCount (M.restrict J) ψ = + (inner ℂ ψ (act (M.restrict J).operator ψ)).re := by + rw [(M.restrict J).operator_spectral] + exact (expectation_pattern_sum (M.restrict J) ψ (fun F => F.card)).symm + rw [ha, M.restrict_operator_expansion] + exact expectation_pattern_sum M ψ _ + +theorem published_product_spectral_resolution : PublishedProductSpectralResolution where + restriction := Count.restrict_high_expansion + pythagoras := projection_pythagoras + restriction_moment := restriction_moment + +theorem regular_pruning_unconditional (d : ℕ) + (m : ℕ → ℕ) (hm : Filter.Tendsto m Filter.atTop Filter.atTop) (hN : ∀ ν, 1 ≤ m ν) + (l : ∀ ν, List (AnalyticLayer (m ν))) (hl : ∀ ν, (l ν).length ≤ d) + (hs : ∀ ν, NonemptyGateSupports (l ν)) (P : ∀ ν, ProductInput (m ν)) : + RegularTrajectory m (fun ν => pruneCircuit (l ν) (P ν).state) (fun ν => (P ν).state) ∧ + (∀ ν, (pruneCircuit (l ν) (P ν).state).length = (l ν).length) ∧ + (∀ ν, ‖act (evolution (l ν)) (P ν).state - + act (evolution (pruneCircuit (l ν) (P ν).state)) (P ν).state‖ ≤ + 2 * ((l ν).length : ℝ) * (m ν : ℝ)^(-2 : ℝ)) := + regular_pruning published_product_spectral_resolution d m hm hN l hl hs P + +end QAC + +end + +end OAI diff --git a/lean/OAI/InformationTheory/QuantumCircuit/ProductState.lean b/lean/OAI/InformationTheory/QuantumCircuit/ProductState.lean new file mode 100644 index 0000000000000000000000000000000000000000..503d3504ff60ddb0234fc7dc277803fcaba7d86f --- /dev/null +++ b/lean/OAI/InformationTheory/QuantumCircuit/ProductState.lean @@ -0,0 +1,99 @@ +import OAI.InformationTheory.QuantumCircuit.ApproximationBudget + +namespace OAI + +/-! Product input states and their excitation counts. -/ + +noncomputable section +open scoped BigOperators Matrix.Norms.L2Operator Topology +open Filter + +namespace QAC + +def pureProjector {N : ℕ} (ψ : State N) : Operator N := + fun x y => ψ x * star (ψ y) + +structure ProductInput (N : ℕ) where + state : State N + norm_state : ‖state‖ = 1 + test : Count N + full_support : test.support = Finset.univ + projector : test.zero = pureProjector state + +lemma act_pureProjector {N : ℕ} (ψ ξ : State N) : + act (pureProjector ψ) ξ = (inner ℂ ψ ξ) • ψ := by + ext x + change ∑ y, (ψ x * star (ψ y)) * ξ y = (inner ℂ ψ ξ) * ψ x + calc + _ = ψ x * (∑ y, star (ψ y) * ξ y) := by + rw [Finset.mul_sum] + apply Finset.sum_congr rfl + intro y _ + ring + _ = ψ x * inner ℂ ψ ξ := by + congr 1 + simp only [PiLp.inner_apply, RCLike.inner_apply] + apply Finset.sum_congr rfl + intro y _ + exact mul_comm _ _ + _ = _ := mul_comm _ _ + +lemma act_smul_state {N : ℕ} (A : Operator N) (c : ℂ) (ψ : State N) : + act A (c • ψ) = c • act A ψ := by simp [act] + +lemma inner_act_right {N : ℕ} (A : Operator N) (ψ ξ : State N) : + inner ℂ ψ (act A ξ) = inner ℂ (act (star A) ψ) ξ := by + have hh := ContinuousLinearMap.adjoint_inner_left + (Matrix.toEuclideanCLM (n := Word N) (𝕜 := ℂ) A) ξ ψ + simpa only [act, map_star, ContinuousLinearMap.star_eq_adjoint] using hh.symm + +lemma projection_inner_self {N : ℕ} (Q : Operator N) (hQ : IsStarProjection Q) + (ψ : State N) : inner ℂ ψ (act Q ψ) = (‖act Q ψ‖ ^ 2 : ℝ) := by + calc + _ = inner ℂ (act Q ψ) (act Q ψ) := by + have hh := inner_act_right Q ψ (act Q ψ) + rw [← act_mul, hQ.isIdempotentElem.eq, hQ.isSelfAdjoint.star_eq] at hh + exact hh + _ = _ := by rw [inner_self_eq_norm_sq_to_K]; push_cast; rfl + +lemma conjugated_product_projection_action {N : ℕ} (P : ProductInput N) + (U : Operator N) (Q : Operator N) (hQ : IsStarProjection Q) : + act (conjugate U P.test.zero) (act Q (act U P.state)) = + ((‖act Q (act U P.state)‖ ^ 2 : ℝ) : ℂ) • act U P.state := by + simp only [conjugate, act_mul, P.projector, act_pureProjector, act_smul_state] + rw [inner_act_right (star U), star_star, projection_inner_self Q hQ] + +theorem uniform_product_overlap_tail (d : ℕ) (m : ℕ → ℕ) (hm : Tendsto m atTop atTop) + (P : ∀ ν, ProductInput (m ν)) {p h : ℝ} (hp : 0 < p) (hph : p < h) : + ∀ᶠ ν in atTop, ∀ U : Operator (m ν), IsCircuit d U → ∀ B : Count (m ν), + ‖act B.zero (act U (P ν).state)‖^2 * + ‖act (B.high ((m ν : ℝ)^h)) (act U (P ν).state)‖ ≤ + Real.exp (-((m ν : ℝ)^p)) := by + filter_upwards [hm.eventually (uniform_localization d p h hp.le hph)] with ν hh + intro U hU B + let ψ := act U (P ν).state + have hψ : ‖ψ‖ = 1 := (act_unitary_norm hU.mem_unitary _).trans (P ν).norm_state + have hb := act_norm_le (B.high ((m ν : ℝ)^h) * conjugate U (P ν).test.zero * B.zero) ψ + rw [hψ, mul_one] at hb + have hid := conjugated_product_projection_action (P ν) U B.zero B.zero_projection + have heq : act (B.high ((m ν : ℝ)^h) * conjugate U (P ν).test.zero * B.zero) ψ = + ((‖act B.zero ψ‖^2 : ℝ) : ℂ) • act (B.high ((m ν : ℝ)^h)) ψ := by + rw [act_mul, act_mul, hid, act_smul_state] + rw [heq, norm_smul, Complex.norm_real, Real.norm_eq_abs, abs_of_nonneg (sq_nonneg _)] at hb + exact hb.trans (hh U hU B (P ν).test) + + theorem product_overlap_tail (d : ℕ) (m : ℕ → ℕ) (hm : Tendsto m atTop atTop) + (U : ∀ ν, Operator (m ν)) (hU : ∀ ν, IsCircuit d (U ν)) + (P : ∀ ν, ProductInput (m ν)) {p h : ℝ} (hp : 0 < p) (hph : p < h) : + ∀ᶠ ν in atTop, ∀ B : Count (m ν), + ‖act B.zero (act (U ν) (P ν).state)‖^2 * + ‖act (B.high ((m ν : ℝ)^h)) (act (U ν) (P ν).state)‖ ≤ + Real.exp (-((m ν : ℝ)^p)) := by + filter_upwards [uniform_product_overlap_tail d m hm P hp hph] with ν hh + exact hh (U ν) (hU ν) + +end QAC + +end + +end OAI diff --git a/lean/OAI/InformationTheory/QuantumCircuit/ProductStateBasis.lean b/lean/OAI/InformationTheory/QuantumCircuit/ProductStateBasis.lean new file mode 100644 index 0000000000000000000000000000000000000000..015cc93d2aaf6222dde357ea72b7a3c04f1cf0ad --- /dev/null +++ b/lean/OAI/InformationTheory/QuantumCircuit/ProductStateBasis.lean @@ -0,0 +1,46 @@ +import OAI.InformationTheory.QuantumCircuit.ProductState + +namespace OAI + +/-! Normalized local factors as product-state inputs. -/ + +noncomputable section +open scoped BigOperators Matrix.Norms.L2Operator + +namespace QAC + +def productVector {N : ℕ} (a : Fin N → Bit → ℂ) : State N := + WithLp.toLp 2 (fun x => ∏ i, a i (x i)) + +lemma productVector_norm {N : ℕ} (a : Fin N → Bit → ℂ) + (ha : ∀ i, ∑ b, Complex.normSq (a i b) = 1) : ‖productVector a‖ = 1 := by + have hs : ‖productVector a‖^2 = 1 := by + rw [PiLp.norm_sq_eq_of_L2] + change (∑ x : Word N, ‖∏ i, a i (x i)‖^2) = 1 + simp only [norm_prod, ← Finset.prod_pow, ← Complex.normSq_eq_norm_sq] + rw [← Fintype.prod_sum (fun i b => Complex.normSq (a i b))] + simp [ha] + nlinarith [norm_nonneg (productVector a)] + +lemma productVector_projector {N : ℕ} (a : Fin N → Bit → ℂ) : + pureProjector (productVector a) = tensorMatrix (fun i => rankOne (a i)) := by + ext x y + change (∏ i, a i (x i)) * star (∏ i, a i (y i)) = + ∏ i, a i (x i) * star (a i (y i)) + rw [Finset.prod_mul_distrib, star_prod] + +def ProductInput.ofFactors {N : ℕ} (a : Fin N → Bit → ℂ) + (ha : ∀ i, ∑ b, Complex.normSq (a i b) = 1) : ProductInput N where + state := productVector a + norm_state := productVector_norm a ha + test := ⟨Finset.univ, a, fun i _ => ha i⟩ + full_support := rfl + projector := by + rw [productVector_projector] + simp [Count.zero] + +end QAC + +end + +end OAI diff --git a/lean/OAI/InformationTheory/QuantumCircuit/Propagation.lean b/lean/OAI/InformationTheory/QuantumCircuit/Propagation.lean new file mode 100644 index 0000000000000000000000000000000000000000..455a7a4d0a3820ff54f3474d1fe432cef787410e --- /dev/null +++ b/lean/OAI/InformationTheory/QuantumCircuit/Propagation.lean @@ -0,0 +1,140 @@ +import OAI.InformationTheory.QuantumCircuit.PropagationAsymptotics + +namespace OAI + +/-! Low-degree transport along regular trajectories. -/ + +noncomputable section +open scoped BigOperators Matrix.Norms.L2Operator Topology +open Filter + +namespace QAC + +theorem regular_layer_propagation + (hpauli : PublishedPauliExpansion) (hspec : PublishedProductSpectralResolution) + (m : ℕ → ℕ) (hm : Tendsto m atTop atTop) + (a : ∀ ν, AnalyticLayer (m ν)) (ψ : ∀ ν, State (m ν)) + (hψ : ∀ ν, ‖ψ ν‖ ≤ 1) (hreg : LayerRegular m a ψ) + {k K : ℝ} (hk : 0 < k) (hkK : k < K) (hK : K < 1) + {ε : ℝ} (hε : 0 < ε) : + ∀ᶠ ν in atTop, ∀ E : Operator (m ν), + HasDegreeLE E ((m ν : ℝ)^k) → ‖E‖ ≤ Real.exp ((m ν : ℝ)^k) → + TransportOn (a ν).matrix (ψ ν) ((m ν : ℝ)^K) (Real.exp ((m ν : ℝ)^K)) + (ε * Real.exp (-((m ν : ℝ)^k))) E := by + let Δ := K - k + let q := k + Δ / 12 + let p₁ := k + Δ / 6 + let L := k + 5 * Δ / 6 + let r := k + 2 * Δ / 3 + let p₂ := k + 3 * Δ / 4 + have hΔ : 0 < Δ := sub_pos.mpr hkK + have hkq : k < q := by dsimp [q]; linarith + have hqp : q < p₁ := by dsimp [q, p₁]; linarith + have hpr : p₁ < r := by dsimp [p₁, r]; linarith + have hrp : r < p₂ := by dsimp [r, p₂]; linarith + have hpL : p₂ < L := by dsimp [p₂, L]; linarith + have hLK : L < K := by dsimp [L, Δ]; linarith + have hrK := hrp.trans (hpL.trans hLK) + have hqK := hqp.trans (hpr.trans hrK) + have hkL := hkq.trans (hqp.trans (hpr.trans (hrp.trans hpL))) + have hp₁ : 0 < p₁ := hk.trans (hkq.trans hqp) + have hp₂ : 0 < p₂ := hp₁.trans (hpr.trans hrp) + have hpoly : (p₁ + L) / 2 < r := by dsimp [p₁, L, r]; linarith + have he₁ := hm.eventually (eventually_exp_power_gap (hkq.trans hqp) hqp hp₁ + 1 (ε / 2) 1 1 (by norm_num) (by positivity)) + have he₂ := hm.eventually (eventually_exp_power_gap + (hkq.trans (hqp.trans (hpr.trans hrp))) hrp hp₂ + 2 (ε / 2) 1 2 (by norm_num) (by positivity)) + filter_upwards [hreg k L p₂ hk.le hkL (hLK.trans hK) hp₂ hpL, + hm.eventually (polynomial_approximation hp₁ (hpr.trans (hrp.trans hpL)) hpoly), + hm.eventually (eventually_propagationBudget hk.le (hkK.trans hK).le hkq), + hm.eventually (eventually_two_powers_le hkK hrK), + hm.eventually (eventually_two_powers_le hqK hrK), + hm.eventually (eventually_ge_atTop 1), he₁, he₂] + with ν ht hp hbudget hdegree hnorm hN he₁ he₂ + intro E hE hEn + have hN1 : (1 : ℝ) ≤ m ν := by exact_mod_cast hN + have hqr : (m ν : ℝ)^q ≤ (m ν : ℝ)^r := + Real.rpow_le_rpow_of_exponent_le hN1 (hqp.trans hpr).le + have hkKpow : (m ν : ℝ)^k ≤ (m ν : ℝ)^K := + Real.rpow_le_rpow_of_exponent_le hN1 hkK.le + cases ha : a ν with + | «local» U => + have hu := localMatrix_unitary U + refine ⟨conjugate (localMatrix U) E, (hE.local_conjugate U).mono hkKpow, ?_, ?_⟩ + · exact (norm_unitary_conjugate hu E).le.trans (hEn.trans (Real.exp_le_exp.mpr hkKpow)) + · have hx : act (localMatrix U) (act E (ψ ν)) = + act (conjugate (localMatrix U) E) (act (localMatrix U) (ψ ν)) := by + simp only [conjugate, ← act_mul, mul_assoc, + Unitary.star_mul_self_of_mem hu, mul_one] + change ‖act (localMatrix U) (act E (ψ ν)) - + act (conjugate (localMatrix U) E) (act (localMatrix U) (ψ ν))‖ ≤ _ + rw [hx, sub_self, norm_zero] + positivity + | reflection R => + obtain ⟨p, hpd, hpw, hp0, hpa⟩ := hp + let ell := ⌊(m ν : ℝ)^k⌋₊ + have hell : (ell : ℝ) ≤ (m ν : ℝ)^k := Nat.floor_le (by positivity) + have hcut : ∀ x : ℕ, 1 ≤ x → (x : ℝ) < (m ν : ℝ)^L → + |p.eval (x : ℝ)| ≤ Real.exp (-((m ν : ℝ)^p₁)) := by + intro x hx hxr + apply hpa x hx + exact_mod_cast hxr.le.trans (Nat.le_ceil _) + have htail : ∀ S : List (Count (m ν)), S.Sublist R.gates → S.length ≤ ell → + ‖act ((jointTest S).high ((m ν : ℝ)^L)) (ψ ν)‖ ≤ + Real.exp (-((m ν : ℝ)^p₂)) := by + intro S hS hs + exact ht R ha S hS ((by exact_mod_cast hs : (S.length : ℝ) ≤ ell).trans hell) + have hfin := low_degree_reflection_approximation hpauli hspec hN R (ψ ν) (hψ ν) + E (hE.floor (by positivity)) p ((m ν : ℝ)^L) + (Real.exp (-((m ν : ℝ)^p₁))) (Real.exp (-((m ν : ℝ)^p₂))) + (Real.exp_pos _).le (Real.exp_pos _).le hp0 hcut htail + have hmass : propagationBudget (m ν) ell * ‖E‖ ≤ Real.exp ((m ν : ℝ)^q) := + (mul_le_mul_of_nonneg_left hEn (propagationBudget_nonneg _ _)).trans + (hbudget ell hell) + have hn : propagationBudget (m ν) ell * ‖E‖ * weight (m ν) p ≤ + Real.exp ((m ν : ℝ)^K) := by + calc + _ ≤ Real.exp ((m ν : ℝ)^q) * Real.exp ((m ν : ℝ)^r) := + mul_le_mul hmass hpw (weight_nonneg (Nat.cast_nonneg _) p) (Real.exp_pos _).le + _ = Real.exp ((m ν : ℝ)^q + (m ν : ℝ)^r) := (Real.exp_add ..).symm + _ ≤ _ := Real.exp_le_exp.mpr hnorm + have he : propagationBudget (m ν) ell * ‖E‖ * + (Real.exp (-((m ν : ℝ)^p₁)) + (1 + weight (m ν) p) * Real.exp (-((m ν : ℝ)^p₂))) ≤ + ε * Real.exp (-((m ν : ℝ)^k)) := by + have hw1 : 1 ≤ Real.exp ((m ν : ℝ)^r) := Real.one_le_exp (by positivity) + calc + _ ≤ Real.exp ((m ν : ℝ)^q) * + (Real.exp (-((m ν : ℝ)^p₁)) + + (2 * Real.exp ((m ν : ℝ)^r)) * Real.exp (-((m ν : ℝ)^p₂))) := by + have hw0 : 0 ≤ weight (m ν) p := weight_nonneg (Nat.cast_nonneg _) p + have hb : Real.exp (-((m ν : ℝ)^p₁)) + + (1 + weight (m ν) p) * Real.exp (-((m ν : ℝ)^p₂)) ≤ + Real.exp (-((m ν : ℝ)^p₁)) + + (2 * Real.exp ((m ν : ℝ)^r)) * Real.exp (-((m ν : ℝ)^p₂)) := by + apply add_le_add le_rfl + apply mul_le_mul_of_nonneg_right _ (Real.exp_pos _).le + linarith only [hpw, hw1] + exact mul_le_mul hmass hb (by positivity) (Real.exp_pos _).le + _ = Real.exp ((m ν : ℝ)^q - (m ν : ℝ)^p₁) + + 2 * Real.exp ((m ν : ℝ)^q + (m ν : ℝ)^r - (m ν : ℝ)^p₂) := by + simp only [sub_eq_add_neg, Real.exp_add] + ring + _ ≤ Real.exp ((m ν : ℝ)^q - (m ν : ℝ)^p₁) + + 2 * Real.exp (2 * (m ν : ℝ)^r - (m ν : ℝ)^p₂) := by + apply add_le_add le_rfl + apply mul_le_mul_of_nonneg_left _ (by norm_num : (0 : ℝ) ≤ 2) + apply Real.exp_le_exp.mpr + linarith only [hqr] + _ ≤ (ε / 2) * Real.exp (-((m ν : ℝ)^k)) + + (ε / 2) * Real.exp (-((m ν : ℝ)^k)) := + add_le_add (by simpa only [one_mul] using he₁) (by simpa only [one_mul] using he₂) + _ = _ := by ring + exact (hfin.mono ((add_le_add hell hpd).trans hdegree) hn he).transport + (reflectionMatrix_unitary R) + +end QAC + +end + +end OAI diff --git a/lean/OAI/InformationTheory/QuantumCircuit/PropagationAsymptotics.lean b/lean/OAI/InformationTheory/QuantumCircuit/PropagationAsymptotics.lean new file mode 100644 index 0000000000000000000000000000000000000000..cf27aa42d6ad9d7c375069425134eff908d6e511 --- /dev/null +++ b/lean/OAI/InformationTheory/QuantumCircuit/PropagationAsymptotics.lean @@ -0,0 +1,93 @@ +import OAI.InformationTheory.QuantumCircuit.ReflectionApproximation + +namespace OAI + +/-! Asymptotic estimates for propagation through reflection layers. -/ + +noncomputable section +open scoped BigOperators Matrix.Norms.L2Operator Topology +open Filter + +namespace QAC + +lemma HasDegreeLE.floor {N : ℕ} {E : Operator N} {r : ℝ} + (hE : HasDegreeLE E r) (hr : 0 ≤ r) : HasDegreeLE E (⌊r⌋₊ : ℝ) := by + apply Submodule.span_mono ?_ hE + rintro A ⟨J, hJ, hA⟩ + exact ⟨J, by exact_mod_cast (Nat.le_floor_iff hr).mpr hJ, hA⟩ + +lemma propagationBudget_log_bound {N ell : ℕ} {k : ℝ} + (hN : 27 ≤ N) (hk : 0 ≤ k) (hk1 : k ≤ 1) (hell : (ell : ℝ) ≤ (N : ℝ)^k) : + propagationBudget N ell ≤ Real.exp (4 * (N : ℝ)^k * Real.log N) := by + have hN1 : (1 : ℝ) ≤ N := by exact_mod_cast (show 1 ≤ N by omega) + have hN27 : (27 : ℝ) ≤ N := by exact_mod_cast hN + have hN0 : (0 : ℝ) < N := by linarith + have hx : 1 ≤ (N : ℝ)^k := Real.one_le_rpow hN1 hk + have hxN : (N : ℝ)^k ≤ N := by + simpa using Real.rpow_le_rpow_of_exponent_le hN1 hk1 + have hlog : 0 ≤ Real.log N := Real.log_nonneg hN1 + have hlogA : Real.log (ell + 1 : ℝ) ≤ 2 * Real.log N := by + calc + _ ≤ Real.log ((N : ℝ)^2) := Real.log_le_log (by positivity) (by nlinarith) + _ = _ := by rw [Real.log_pow]; norm_num + have hlogB : Real.log (27 * N : ℝ) ≤ 2 * Real.log N := by + calc + _ ≤ Real.log ((N : ℝ)^2) := Real.log_le_log (by positivity) (by nlinarith) + _ = _ := by rw [Real.log_pow]; norm_num + have heq : propagationBudget N ell = + Real.exp (Real.log (ell + 1 : ℝ) + ell * Real.log (27 * N : ℝ)) := by + rw [Real.exp_add, Real.exp_nat_mul, Real.exp_log (by positivity), + Real.exp_log (by positivity)] + unfold propagationBudget + push_cast + rw [mul_assoc, ← mul_pow] + congr 2 + ring + rw [heq] + apply Real.exp_le_exp.mpr + calc + _ ≤ 2 * Real.log N + (ell : ℝ) * (2 * Real.log N) := + add_le_add hlogA (mul_le_mul_of_nonneg_left hlogB (Nat.cast_nonneg ell)) + _ ≤ 4 * (N : ℝ)^k * Real.log N := by + nlinarith [mul_le_mul_of_nonneg_right hell hlog, + mul_le_mul_of_nonneg_right hx hlog] + +lemma eventually_propagationBudget {k q : ℝ} (hk : 0 ≤ k) (hk1 : k ≤ 1) (hkq : k < q) : + ∀ᶠ N : ℕ in atTop, ∀ ell : ℕ, (ell : ℝ) ≤ (N : ℝ)^k → + propagationBudget N ell * Real.exp ((N : ℝ)^k) ≤ Real.exp ((N : ℝ)^q) := by + filter_upwards [eventually_ge_atTop 27, eventually_power_log_le hkq 8, + eventually_power_le hkq 2] with N hN hlog hpow + intro ell hell + calc + _ ≤ Real.exp (4 * (N : ℝ)^k * Real.log N) * Real.exp ((N : ℝ)^k) := + mul_le_mul_of_nonneg_right (propagationBudget_log_bound hN hk hk1 hell) (Real.exp_nonneg _) + _ = Real.exp (4 * (N : ℝ)^k * Real.log N + (N : ℝ)^k) := (Real.exp_add ..).symm + _ ≤ _ := Real.exp_le_exp.mpr (by linarith) + +def LayerRegular (m : ℕ → ℕ) (a : ∀ ν, AnalyticLayer (m ν)) + (ψ : ∀ ν, State (m ν)) : Prop := + ∀ b h p : ℝ, 0 ≤ b → b < h → h < 1 → 0 < p → p < h → + ∀ᶠ ν in atTop, ∀ R, a ν = .reflection R → + ∀ S : List (Count (m ν)), S.Sublist R.gates → (S.length : ℝ) ≤ (m ν : ℝ)^b → + ‖act ((jointTest S).high ((m ν : ℝ)^h)) (ψ ν)‖ ≤ Real.exp (-((m ν : ℝ)^p)) + +def TransportOn {N : ℕ} (U : Operator N) (ψ : State N) + (r C δ : ℝ) (E : Operator N) : Prop := + ∃ E' : Operator N, HasDegreeLE E' r ∧ ‖E'‖ ≤ C ∧ + ‖act U (act E ψ) - act E' (act U ψ)‖ ≤ δ + +lemma ApproxOn.transport {N : ℕ} {U : Operator N} {ψ : State N} + {r C δ : ℝ} {E : Operator N} (hU : U ∈ unitary (Operator N)) + (h : ApproxOn (act U ψ) r C δ (conjugate U E)) : TransportOn U ψ r C δ E := by + obtain ⟨E', hd, hn, he⟩ := h + refine ⟨E', hd, hn, ?_⟩ + have hid : act (conjugate U E) (act U ψ) = act U (act E ψ) := by + simp only [conjugate, ← act_mul, mul_assoc, + Unitary.star_mul_self_of_mem hU, mul_one] + rwa [act_sub, hid] at he + +end QAC + +end + +end OAI diff --git a/lean/OAI/InformationTheory/QuantumCircuit/Pruning.lean b/lean/OAI/InformationTheory/QuantumCircuit/Pruning.lean new file mode 100644 index 0000000000000000000000000000000000000000..9e52e2319386476df5d0af3c32a4b1f5c3cedaa0 --- /dev/null +++ b/lean/OAI/InformationTheory/QuantumCircuit/Pruning.lean @@ -0,0 +1,50 @@ +import OAI.InformationTheory.QuantumCircuit.RetainedRegularity +import OAI.InformationTheory.QuantumCircuit.PruningConstruction + +namespace OAI + +/-! Regular trajectories obtained by state-dependent pruning. -/ + +noncomputable section +open scoped BigOperators Matrix.Norms.L2Operator Topology +open Filter + +namespace QAC + +theorem pruneCircuit_regular + (hspec : PublishedProductSpectralResolution) (d : ℕ) + (m : ℕ → ℕ) (hm : Tendsto m atTop atTop) + (l : ∀ ν, List (AnalyticLayer (m ν))) (hl : ∀ ν, (l ν).length ≤ d) + (P : ∀ ν, ProductInput (m ν)) : + RegularTrajectory m (fun ν => pruneCircuit (l ν) (P ν).state) (fun ν => (P ν).state) := by + intro b h p hb hbh hh hp hph + filter_upwards [retained_layer_regular hspec d m hm P hb hbh hh hp hph] with ν hν + intro j R hj S hS hsize + let W := pruneCircuit (l ν) (P ν).state + have hlen : (W.take j).length ≤ d := by + calc + _ ≤ W.length := by simp only [List.length_take]; exact Nat.min_le_right _ _ + _ = (l ν).length := pruneCircuit_length _ _ + _ ≤ d := hl ν + have hU : IsCircuit d (evolution (W.take j)) := (evolution_isCircuit _).mono hlen + exact hν (evolution (W.take j)) hU R + (pruneCircuit_gate_probability (l ν) (P ν).state j R hj) S hS hsize + +theorem regular_pruning + (hspec : PublishedProductSpectralResolution) (d : ℕ) + (m : ℕ → ℕ) (hm : Tendsto m atTop atTop) (hN : ∀ ν, 1 ≤ m ν) + (l : ∀ ν, List (AnalyticLayer (m ν))) (hl : ∀ ν, (l ν).length ≤ d) + (hs : ∀ ν, NonemptyGateSupports (l ν)) (P : ∀ ν, ProductInput (m ν)) : + RegularTrajectory m (fun ν => pruneCircuit (l ν) (P ν).state) (fun ν => (P ν).state) ∧ + (∀ ν, (pruneCircuit (l ν) (P ν).state).length = (l ν).length) ∧ + (∀ ν, ‖act (evolution (l ν)) (P ν).state - + act (evolution (pruneCircuit (l ν) (P ν).state)) (P ν).state‖ ≤ + 2 * ((l ν).length : ℝ) * (m ν : ℝ)^(-2 : ℝ)) := by + exact ⟨pruneCircuit_regular hspec d m hm l hl P, + fun ν => pruneCircuit_length _ _, fun ν => pruneCircuit_error (hN ν) (l ν) (hs ν) _⟩ + +end QAC + +end + +end OAI diff --git a/lean/OAI/InformationTheory/QuantumCircuit/PruningConstruction.lean b/lean/OAI/InformationTheory/QuantumCircuit/PruningConstruction.lean new file mode 100644 index 0000000000000000000000000000000000000000..d563671b6ac8a9927fbd3eda2e11efee0068912e --- /dev/null +++ b/lean/OAI/InformationTheory/QuantumCircuit/PruningConstruction.lean @@ -0,0 +1,194 @@ +import OAI.InformationTheory.QuantumCircuit.ProductState + +namespace OAI + +/-! Pruning reflection circuits by an excitation threshold. -/ + +noncomputable section +open scoped BigOperators Matrix.Norms.L2Operator + +namespace QAC + +def ReflectionLayer.retain {N : ℕ} (R : ReflectionLayer N) (ψ : State N) (q : ℝ) : + ReflectionLayer N where + gates := R.gates.filter (fun A => decide (q ≤ ‖act A.zero ψ‖^2)) + disjoint := R.disjoint.filter _ + +lemma reflectList_unitary {N : ℕ} (l : List (Count N)) : + reflectList l ∈ unitary (Operator N) := by + induction l with + | nil => simp [reflectList] + | cons A l ih => + exact (unitary (Operator N)).mul_mem (reflect_unitary A) ih + +lemma reflectList_zero_commute {N : ℕ} (A : Count N) (l : List (Count N)) + (h : ∀ B ∈ l, Disjoint A.support B.support) : Commute (reflectList l) A.zero := by + apply Commute.list_prod_left + intro x hx + obtain ⟨B, hB, rfl⟩ := List.mem_map.mp hx + exact reflect_disjoint_zero_commute B A (h B hB).symm + +lemma reflect_action_error {N : ℕ} (A : Count N) (ψ : State N) : + ‖act (reflect A) ψ - ψ‖ = 2 * ‖act A.zero ψ‖ := by + have heq : act (reflect A) ψ - ψ = act (reflect A - 1) ψ := by rw [act_sub, act_one] + have halg : reflect A - 1 = (-2 : ℝ) • A.zero := by dsimp [reflect]; module + rw [heq, halg, act_real_smul, norm_smul, Real.norm_eq_abs] + norm_num + +lemma reflection_filter_error {N : ℕ} (l : List (Count N)) + (hl : l.Pairwise (fun A B => Disjoint A.support B.support)) + (ψ : State N) {σ : ℝ} (hσ : 0 ≤ σ) : + ‖act (reflectList l) ψ - + act (reflectList (l.filter (fun A => decide (σ^2 ≤ ‖act A.zero ψ‖^2)))) ψ‖ ≤ + (l.length : ℝ) * (2 * σ) := by + induction l with + | nil => simp [reflectList] + | cons A l ih => + obtain ⟨ha, hl⟩ := List.pairwise_cons.mp hl + have hi := ih hl + let f := l.filter (fun B => decide (σ^2 ≤ ‖act B.zero ψ‖^2)) + by_cases hp : σ^2 ≤ ‖act A.zero ψ‖^2 + · simp only [List.filter_cons, hp, decide_true, ite_true, + reflectList, List.map_cons, List.prod_cons, act_mul] + have heq : act (reflect A) (act (reflectList l) ψ) - + act (reflect A) (act (reflectList f) ψ) = + act (reflect A) (act (reflectList l) ψ - act (reflectList f) ψ) := by simp [act] + change ‖act (reflect A) (act (reflectList l) ψ) - + act (reflect A) (act (reflectList f) ψ)‖ ≤ _ + rw [heq, act_unitary_norm (reflect_unitary A)] + have hbudget : (l.length : ℝ) * (2 * σ) ≤ ((A :: l).length : ℝ) * (2 * σ) := by + simp only [List.length_cons, Nat.cast_add, Nat.cast_one]; nlinarith + exact hi.trans hbudget + · have hsmall : ‖act A.zero ψ‖ ≤ σ := by + have hn := norm_nonneg (act A.zero ψ) + nlinarith + have hc : Commute (reflectList f) A.zero := reflectList_zero_commute A f + (fun B hB => ha B (List.mem_filter.mp hB).1) + have hn : ‖act A.zero (act (reflectList f) ψ)‖ = ‖act A.zero ψ‖ := by + rw [← act_mul, ← hc.eq, act_mul, act_unitary_norm (reflectList_unitary f)] + have hd : ‖act (reflect A) (act (reflectList f) ψ) - act (reflectList f) ψ‖ ≤ 2 * σ := by + rw [reflect_action_error, hn] + linarith + simp only [List.filter_cons, hp, decide_false, Bool.false_eq_true, ite_false, + reflectList, List.map_cons, List.prod_cons, act_mul] + have heq : act (reflect A) (act (reflectList l) ψ) - act (reflectList f) ψ = + act (reflect A) (act (reflectList l) ψ - act (reflectList f) ψ) + + (act (reflect A) (act (reflectList f) ψ) - act (reflectList f) ψ) := by + simp only [act, map_sub]; abel + change ‖act (reflect A) (act (reflectList l) ψ) - act (reflectList f) ψ‖ ≤ _ + rw [heq] + apply (norm_add_le _ _).trans + rw [act_unitary_norm (reflect_unitary A)] + have hsum := add_le_add hi hd + simpa only [List.length_cons, Nat.cast_add, Nat.cast_one, add_mul, one_mul] using hsum + +def pruneLayer {N : ℕ} (a : AnalyticLayer N) (ψ : State N) : AnalyticLayer N := + match a with + | .local L => .local L + | .reflection R => .reflection (R.retain ψ ((N : ℝ)^(-6 : ℝ))) + +def pruneCircuit {N : ℕ} : List (AnalyticLayer N) → State N → List (AnalyticLayer N) + | [], _ => [] + | a :: l, ψ => let a' := pruneLayer a ψ + a' :: pruneCircuit l (act a'.matrix ψ) + +lemma pruneCircuit_length {N : ℕ} (l : List (AnalyticLayer N)) (ψ : State N) : + (pruneCircuit l ψ).length = l.length := by + induction l generalizing ψ with + | nil => rfl + | cons a l ih => simp only [pruneCircuit, List.length_cons, ih] + +def NonemptyGateSupports {N : ℕ} (l : List (AnalyticLayer N)) : Prop := + ∀ a ∈ l, ∀ R, a = .reflection R → ∀ A ∈ R.gates, A.support.Nonempty + +lemma reflectionLayer_length_le {N : ℕ} (R : ReflectionLayer N) + (h : ∀ A ∈ R.gates, A.support.Nonempty) : R.gates.length ≤ N := by + have hh := list_disjoint_hits_length Count.support R.gates R.disjoint Finset.univ + (fun A hA => by simpa using h A hA) + simpa using hh + +lemma pruneLayer_error {N : ℕ} (hN : 1 ≤ N) (a : AnalyticLayer N) + (ha : ∀ R, a = .reflection R → ∀ A ∈ R.gates, A.support.Nonempty) + (ψ : State N) : + ‖act a.matrix ψ - act (pruneLayer a ψ).matrix ψ‖ ≤ 2 * (N : ℝ)^(-2 : ℝ) := by + have hn : (0 : ℝ) < N := by exact_mod_cast (show 0 < N by omega) + cases a with + | «local» L => simp [pruneLayer] + | reflection R => + have hs : ((N : ℝ)^(-3 : ℝ))^2 = (N : ℝ)^(-6 : ℝ) := by + rw [← Real.rpow_mul_natCast hn.le] + norm_num + have hh := reflection_filter_error R.gates R.disjoint ψ + (σ := (N : ℝ)^(-3 : ℝ)) (Real.rpow_nonneg hn.le _) + rw [hs] at hh + change ‖act (reflectionMatrix R) ψ - + act (reflectionMatrix (R.retain ψ ((N : ℝ)^(-6 : ℝ)))) ψ‖ ≤ _ + rw [reflectionMatrix_eq, reflectionMatrix_eq] + have hlen : (R.gates.length : ℝ) ≤ N := by + exact_mod_cast reflectionLayer_length_le R (ha R rfl) + calc + _ ≤ (R.gates.length : ℝ) * (2 * (N : ℝ)^(-3 : ℝ)) := hh + _ ≤ (N : ℝ) * (2 * (N : ℝ)^(-3 : ℝ)) := + mul_le_mul_of_nonneg_right hlen (by positivity) + _ = _ := by + have hp : (N : ℝ)^(-2 : ℝ) = (N : ℝ)^(-3 : ℝ) * N := by + convert Real.rpow_add_one hn.ne' (-3) using 1 + norm_num + rw [hp] + ring + +theorem pruneCircuit_error {N : ℕ} (hN : 1 ≤ N) + (l : List (AnalyticLayer N)) (hs : NonemptyGateSupports l) (ψ : State N) : + ‖act (evolution l) ψ - act (evolution (pruneCircuit l ψ)) ψ‖ ≤ + 2 * (l.length : ℝ) * (N : ℝ)^(-2 : ℝ) := by + induction l generalizing ψ with + | nil => simp [pruneCircuit] + | cons a l ih => + let a' := pruneLayer a ψ + let ξ := act a'.matrix ψ + have htail : NonemptyGateSupports l := fun b hb => hs b (List.mem_cons_of_mem _ hb) + have hfirst := pruneLayer_error hN a (hs a (List.mem_cons_self ..)) ψ + have hlast := ih htail ξ + have heq : act (evolution (a :: l)) ψ - act (evolution (pruneCircuit (a :: l) ψ)) ψ = + act (evolution l) (act a.matrix ψ - act a'.matrix ψ) + + (act (evolution l) ξ - act (evolution (pruneCircuit l ξ)) ξ) := by + simp only [evolution, pruneCircuit, act_mul, a', ξ, act_sub_state] + abel + rw [heq] + apply (norm_add_le _ _).trans + rw [act_unitary_norm (evolution_isCircuit l).mem_unitary] + have hh := add_le_add hfirst hlast + simpa only [List.length_cons, Nat.cast_add, Nat.cast_one, mul_add, add_mul, + mul_one, one_mul, add_comm, add_left_comm, add_assoc] using hh + +lemma pruneCircuit_gate_probability {N : ℕ} (l : List (AnalyticLayer N)) + (ψ : State N) (j : ℕ) (R : ReflectionLayer N) + (hj : (pruneCircuit l ψ)[j]? = some (.reflection R)) : + ∀ A ∈ R.gates, (N : ℝ)^(-6 : ℝ) ≤ + ‖act A.zero (act (evolution ((pruneCircuit l ψ).take j)) ψ)‖^2 := by + induction l generalizing ψ j R with + | nil => simp [pruneCircuit] at hj + | cons a l ih => + cases j with + | zero => + cases a with + | «local» L => simp [pruneCircuit, pruneLayer] at hj + | reflection T => + simp only [pruneCircuit, pruneLayer, List.getElem?_cons_zero, Option.some.injEq, + AnalyticLayer.reflection.injEq] at hj + subst R + intro A hA + simpa only [List.take_zero, evolution, act_one, ReflectionLayer.retain, + List.mem_filter, decide_eq_true_eq] using (List.mem_filter.mp hA).2 + | succ j => + simp only [pruneCircuit, List.getElem?_cons_succ] at hj + have hh := ih (act (pruneLayer a ψ).matrix ψ) j R hj + intro A hA + have ha := hh A hA + simpa only [pruneCircuit, List.take_succ_cons, evolution, act_mul] using ha + +end QAC + +end + +end OAI diff --git a/lean/OAI/InformationTheory/QuantumCircuit/Reflection.lean b/lean/OAI/InformationTheory/QuantumCircuit/Reflection.lean new file mode 100644 index 0000000000000000000000000000000000000000..b74ddba002929ae40a1087e14159797b04d3a78d --- /dev/null +++ b/lean/OAI/InformationTheory/QuantumCircuit/Reflection.lean @@ -0,0 +1,216 @@ +import OAI.InformationTheory.QuantumCircuit.Transition + +namespace OAI + +noncomputable section +open scoped BigOperators Matrix.Norms.L2Operator symmDiff +open Matrix + +namespace QAC + +/-- The real scalar spelling makes the coefficient budget transparent. -/ +def reflect {N : ℕ} (D : Count N) : Operator N := 1 - (2:ℝ) • D.zero + +def reflectList {N : ℕ} (l : List (Count N)) : Operator N := (l.map reflect).prod + +lemma reflectionMatrix_eq {N : ℕ} (R : ReflectionLayer N) : reflectionMatrix R = reflectList R.gates := by + unfold reflectionMatrix reflectList + congr 1 + +lemma reflect_unitary {N : ℕ} (D : Count N) : reflect D ∈ unitary (Operator N) := by + simpa only [reflect,two_smul] using reflection_unitary D + +lemma reflect_disjoint_commute {N : ℕ} (A B : Count N) (h : Disjoint A.support B.support) : + Commute (reflect A) (reflect B) := by + exact (Commute.one_left _).sub_left + (((Commute.one_right _).sub_right ((A.disjoint_commute B h).smul_right (2:ℝ))).smul_left (2:ℝ)) + +lemma reflect_disjoint_zero_commute {N : ℕ} (A B : Count N) (h : Disjoint A.support B.support) : + Commute (reflect A) B.zero := + (Commute.one_left _).sub_left ((A.disjoint_commute B h).smul_left (2:ℝ)) + +def ReflectionLayer.active {N : ℕ} (R : ReflectionLayer N) (A : Count N) : ReflectionLayer N where + gates := R.gates.filter (fun D => decide (¬Disjoint D.support A.support)) + disjoint := R.disjoint.filter _ + +lemma ReflectionLayer.active_length {N : ℕ} (R : ReflectionLayer N) (A : Count N) : + (R.active A).gates.length ≤ A.support.card := by + apply list_disjoint_hits_length Count.support _ (R.active A).disjoint + intro D hD + have h := (List.mem_filter.mp hD).2 + simp only [decide_eq_true_eq] at h + exact Finset.not_disjoint_iff_nonempty_inter.mp h + +lemma ReflectionLayer.active_conjugate {N : ℕ} (R : ReflectionLayer N) (A : Count N) : + conjugate (reflectionMatrix R) A.zero = conjugate (reflectionMatrix (R.active A)) A.zero := by + rw [reflectionMatrix_eq,reflectionMatrix_eq] + apply list_conjugate_filter + · exact R.disjoint.imp (fun h => reflect_disjoint_commute _ _ h) + · intro D _; exact reflect_unitary D + · intro D _ hD + apply reflect_disjoint_zero_commute + simpa using hD + + +/-- Expansion of a disjoint reflection product. The real coefficients carry +all multiplicities; no commutation of the middle projection is required. -/ +def reflectionTerms {N : ℕ} : List (Count N) → List (ℝ × Count N) + | [] => [(1,Count.empty)] + | A::l => reflectionTerms l ++ (reflectionTerms l).map (fun p => (-2*p.1,A.join p.2)) + +lemma reflectionTerms_support {N : ℕ} (l : List (Count N)) : + ∀ p ∈ reflectionTerms l, ∀ i ∈ p.2.support, ∃ A ∈ l, i ∈ A.support := by + induction l with + | nil => simp [reflectionTerms,Count.empty] + | cons A l ih => + intro p hp i hi + rcases List.mem_append.mp hp with hp | hp + · obtain ⟨B,hB,hiB⟩ := ih p hp i hi + exact ⟨B,List.mem_cons_of_mem _ hB,hiB⟩ + · obtain ⟨q,hq,rfl⟩ := List.mem_map.mp hp + rcases Finset.mem_union.mp hi with hi | hi + · exact ⟨A,List.mem_cons_self ..,hi⟩ + · obtain ⟨B,hB,hiB⟩ := ih q hq i hi + exact ⟨B,List.mem_cons_of_mem _ hB,hiB⟩ + +lemma reflectionTerms_disjoint {N : ℕ} (A : Count N) (l : List (Count N)) + (h : ∀ B ∈ l, Disjoint A.support B.support) (p : ℝ × Count N) (hp : p ∈ reflectionTerms l) : + Disjoint A.support p.2.support := by + apply Finset.disjoint_left.mpr + intro i hiA hip + obtain ⟨B,hB,hiB⟩ := reflectionTerms_support l p hp i hip + exact Finset.disjoint_left.mp (h B hB) hiA hiB + +lemma reflectionTerms_sum {N : ℕ} (l : List (Count N)) + (hl : l.Pairwise (fun A B => Disjoint A.support B.support)) : + ((reflectionTerms l).map (fun p => p.1 • p.2.zero)).sum = reflectList l := by + induction l with + | nil => simp [reflectionTerms,reflectList] + | cons A l ih => + obtain ⟨ha,hl⟩ := List.pairwise_cons.mp hl + rw [reflectionTerms,List.map_append,List.sum_append,List.map_map] + have heq : ((reflectionTerms l).map (fun p => (-2*p.1) • (A.join p.2).zero)) = + (reflectionTerms l).map (fun p => ((-2:ℝ) • A.zero) * (p.1 • p.2.zero)) := by + apply List.map_congr_left + intro p hp + rw [A.join_zero p.2 (reflectionTerms_disjoint A l ha p hp),smul_mul_smul_comm] + change ((reflectionTerms l).map (fun p => p.1 • p.2.zero)).sum + + ((reflectionTerms l).map (fun p => (-2*p.1) • (A.join p.2).zero)).sum = _ + rw [heq,List.sum_map_mul_left,ih hl] + simp only [reflectList,List.map_cons,List.prod_cons,reflect,sub_mul,one_mul,neg_smul,neg_mul] + abel + +lemma reflectionTerms_weight {N : ℕ} (l : List (Count N)) : + ((reflectionTerms l).map (fun p => |p.1|)).sum = (3:ℝ)^l.length := by + induction l with + | nil => simp [reflectionTerms] + | cons A l ih => + simp only [reflectionTerms,List.map_append,List.sum_append,List.map_map,List.length_cons,pow_succ] + change ((reflectionTerms l).map (fun p => |p.1|)).sum + + ((reflectionTerms l).map (fun p => |(-2:ℝ)*p.1|)).sum = _ + simp_rw [abs_mul] + norm_num only [abs_neg] + rw [List.sum_map_mul_left,ih] + ring + +lemma star_list_sum {A ι : Type*} [AddMonoid A] [StarAddMonoid A] (l : List ι) (f : ι → A) : + star (l.map f).sum = (l.map (fun i => star (f i))).sum := by + induction l with + | nil => simp + | cons i l ih => simp [ih] + +lemma reflectList_selfAdjoint {N : ℕ} (l : List (Count N)) + (hl : l.Pairwise (fun A B => Disjoint A.support B.support)) : + star (reflectList l) = reflectList l := by + rw [← reflectionTerms_sum l hl,star_list_sum] + congr 1 + apply List.map_congr_left + intro p _ + simp only [star_smul,star_trivial,p.2.zero_projection.isSelfAdjoint.star_eq] + + +section BilinearBudget +variable {A : Type*} [CStarAlgebra A] + +lemma list_sum_sandwich {ι : Type*} (l : List ι) (c : ι → ℝ) (f : ι → A) (L R : A) : + L * (l.map (fun i => c i • f i)).sum * R = + (l.map (fun i => c i • (L*f i*R))).sum := by + simp only [← List.sum_map_mul_left,← List.sum_map_mul_right,mul_smul_comm,smul_mul_assoc] + +lemma bilinear_list_bound {ι : Type*} (l : List ι) (c : ι → ℝ) (f : ι → A) + (H B P : A) (δ : ℝ) + (h : ∀ i ∈ l, ∀ j ∈ l, ‖H*f i*B*f j*P‖ ≤ δ) : + ‖H * (l.map (fun i => c i • f i)).sum * B * + (l.map (fun i => c i • f i)).sum * P‖ ≤ (l.map (fun i => |c i|)).sum^2 * δ := by + let T := (l.map (fun i => c i • f i)).sum + let C := (l.map (fun i => |c i|)).sum + have hj : ∀ i ∈ l, ‖H*f i*B*T*P‖ ≤ C*δ := by + intro i hi + rw [show H*f i*B*T*P = (H*f i*B)*T*P by rfl, list_sum_sandwich] + exact norm_list_smul_sum l c _ δ (h i hi) + have heq : H*T*B*T*P = (l.map (fun i => c i • (H*f i*B*T*P))).sum := by + calc + _ = H*T*(B*T*P) := by simp only [mul_assoc] + _ = _ := by rw [list_sum_sandwich]; simp only [mul_assoc] + change ‖H*T*B*T*P‖ ≤ C^2*δ + rw [heq] + exact (norm_list_smul_sum l c _ (C*δ) hj).trans_eq (by ring) +end BilinearBudget + +lemma reflection_conjugate_expansion {N : ℕ} (l : List (Count N)) + (hl : l.Pairwise (fun A B => Disjoint A.support B.support)) (V : Operator N) : + conjugate V (reflectList l) = + ((reflectionTerms l).map (fun p => p.1 • conjugate V p.2.zero)).sum := by + rw [← reflectionTerms_sum l hl,conjugate_list_sum] + simp only [conjugate_smul] + +lemma reflection_transition_bound {N : ℕ} (R : ReflectionLayer N) (V H P : Operator N) + (A : Count N) (hV : V ∈ unitary (Operator N)) (δ : ℝ) + (h : ∀ X Y : Count N, ‖H*conjugate V X.zero*conjugate V A.zero*conjugate V Y.zero*P‖ ≤ δ) : + ‖H*conjugate V (conjugate (reflectionMatrix R) A.zero)*P‖ ≤ (9:ℝ)^R.gates.length*δ := by + rw [reflectionMatrix_eq] + unfold conjugate at * + have heq : H*(V*(reflectList R.gates*A.zero*star (reflectList R.gates))*star V)*P = + H*conjugate V (reflectList R.gates)*conjugate V A.zero*conjugate V (reflectList R.gates)*P := by + change H*conjugate V (reflectList R.gates*A.zero*star (reflectList R.gates))*P = _ + rw [reflectList_selfAdjoint _ R.disjoint,conjugate_mul hV,conjugate_mul hV] + simp only [mul_assoc] + rw [heq,reflection_conjugate_expansion _ R.disjoint V] + apply (bilinear_list_bound (reflectionTerms R.gates) Prod.fst + (fun p => conjugate V p.2.zero) H (conjugate V A.zero) P δ (fun i _ j _ => h i.2 j.2)).trans_eq + rw [reflectionTerms_weight] + congr 1 + rw [pow_two,← mul_pow] + norm_num + +lemma small_support_layer_bound {N : ℕ} (V : Operator N) (hV : V ∈ unitary (Operator N)) + (R : ReflectionLayer N) (L : LocalLayer N) (M A : Count N) {r r₁ r₂ δ : ℝ} (hδ : 0 ≤ δ) + (h₁ : ∀ D : Count N, ‖M.high r₁*conjugate V D.zero*M.zero‖ ≤ δ) + (h₂ : ∀ D : Count N, ‖M.high r₂*conjugate V D.zero*M.low r₁‖ ≤ δ) + (h₃ : ∀ D : Count N, ‖M.high r*conjugate V D.zero*M.low r₂‖ ≤ δ) : + ‖M.high r*conjugate (V*reflectionMatrix R*localMatrix L) A.zero*M.zero‖ ≤ + (9:ℝ)^A.support.card*(3*δ) := by + have hc : ∀ D : Count N, ‖conjugate V D.zero‖ ≤ 1 := fun D => + IsStarProjection.norm_le _ (conjugate_projection hV D.zero_projection) + have htriple : ∀ X Y Z : Count N, + ‖M.high r*conjugate V X.zero*conjugate V Y.zero*conjugate V Z.zero*M.zero‖ ≤ 3*δ := by + intro X Y Z + exact three_factor_transition _ _ (M.high r₁) (M.high r₂) _ _ _ + (IsStarProjection.norm_le _ (M.high_projection r)) (IsStarProjection.norm_le _ M.zero_projection) + (IsStarProjection.norm_le _ (M.low_projection r₁)) (hc X) (hc Y) (hc Z) (h₁ Z) (h₂ Y) (h₃ X) + have hbound := reflection_transition_bound (R.active (A.rotate L)) V (M.high r) M.zero + (A.rotate L) hV (3*δ) (fun X Y => htriple X (A.rotate L) Y) + have hlen : (R.active (A.rotate L)).gates.length ≤ A.support.card := R.active_length (A.rotate L) + calc + _ = ‖M.high r*conjugate V (conjugate (reflectionMatrix (R.active (A.rotate L))) (A.rotate L).zero)*M.zero‖ := by + rw [conjugate_comp,conjugate_comp, + show conjugate (localMatrix L) A.zero = (A.rotate L).zero from (A.rotate_zero L).symm, + R.active_conjugate] + _ ≤ (9:ℝ)^(R.active (A.rotate L)).gates.length*(3*δ) := hbound + _ ≤ _ := mul_le_mul_of_nonneg_right (pow_le_pow_right₀ (by norm_num) hlen) (by positivity) + +end QAC + +end + +end OAI diff --git a/lean/OAI/InformationTheory/QuantumCircuit/ReflectionApproximation.lean b/lean/OAI/InformationTheory/QuantumCircuit/ReflectionApproximation.lean new file mode 100644 index 0000000000000000000000000000000000000000..ccb3365c53a206e5bae0b6888ce945917e1e5364 --- /dev/null +++ b/lean/OAI/InformationTheory/QuantumCircuit/ReflectionApproximation.lean @@ -0,0 +1,167 @@ +import OAI.InformationTheory.QuantumCircuit.ApproximationBudget +import OAI.InformationTheory.QuantumCircuit.CommonAxes + +namespace OAI + +/-! Low-degree approximation of products of reflections. -/ + +noncomputable section +open scoped BigOperators Matrix.Norms.L2Operator + +namespace QAC + +def propagationBudget (N ell : ℕ) : ℝ := + ((ell + 1 : ℕ) : ℝ) * (3 * N : ℝ) ^ ell * (9 : ℝ) ^ ell + +lemma propagationBudget_nonneg (N ell : ℕ) : 0 ≤ propagationBudget N ell := by + unfold propagationBudget + positivity + +lemma conjugate_complex_list_sum {N : ℕ} {ι : Type*} (U : Operator N) + (l : List ι) (c : ι → ℂ) (D : ι → Operator N) : + conjugate U (l.map (fun i => c i • D i)).sum = + (l.map (fun i => c i • conjugate U (D i))).sum := by + simp only [conjugate, ← List.sum_map_mul_left, ← List.sum_map_mul_right, + mul_smul_comm, smul_mul_assoc] + +lemma subcount_sandwich_approximation + (hspec : PublishedProductSpectralResolution) {N : ℕ} + (ψ : State N) (hψ : ‖ψ‖ ≤ 1) (M A B : Count N) + (hA : A.Subcount M) (hB : B.Subcount M) + (J : Finset (Fin N)) (D : Operator N) (hD : TensorSupported J D) + (hDn : ‖D‖ ≤ 1) (p : Polynomial ℝ) (r δ τ : ℝ) + (hδ : 0 ≤ δ) (hp0 : p.eval 0 = 1) + (hp : ∀ k : ℕ, 1 ≤ k → (k : ℝ) < r → |p.eval (k : ℝ)| ≤ δ) + (htail : ‖act (M.high r) ψ‖ ≤ τ) : + ApproxOn ψ ((J.card : ℝ) + p.natDegree) (weight N p) + (δ + (1 + weight N p) * τ) (A.zero * D * B.zero) := by + have hz : A.zero * D * B.zero = + (M.restrict A.support).zero * D * (M.restrict B.support).zero := + congrArg₂ (fun X Y : Operator N => X * D * Y) hA.zero_eq hB.zero_eq + rw [hz] + exact sandwich_approximation ψ M J A.support B.support D hD hDn p r δ τ hδ hψ hp0 hp + ((M.restrict_high_action_le hspec _ r ψ).trans htail) + +lemma reflection_expansion_approximation + (hspec : PublishedProductSpectralResolution) {N : ℕ} + (l : List (Count N)) (hl : l.Pairwise (fun A B => Disjoint A.support B.support)) + (ψ : State N) (hψ : ‖ψ‖ ≤ 1) + (J : Finset (Fin N)) (D : Operator N) (hD : TensorSupported J D) + (hDn : ‖D‖ ≤ 1) (p : Polynomial ℝ) (r δ τ : ℝ) + (hδ : 0 ≤ δ) (hp0 : p.eval 0 = 1) + (hp : ∀ k : ℕ, 1 ≤ k → (k : ℝ) < r → |p.eval (k : ℝ)| ≤ δ) + (htail : ‖act ((jointTest l).high r) ψ‖ ≤ τ) : + ApproxOn ψ ((J.card : ℝ) + p.natDegree) ((9 : ℝ)^l.length * weight N p) + ((9 : ℝ)^l.length * (δ + (1 + weight N p) * τ)) + (conjugate (reflectList l) D) := by + let W := weight N p + let ε := δ + (1 + W) * τ + have hpair : ∀ a ∈ reflectionTerms l, ∀ b ∈ reflectionTerms l, + ApproxOn ψ ((J.card : ℝ) + p.natDegree) W ε (a.2.zero * D * b.2.zero) := by + intro a ha b hb + exact subcount_sandwich_approximation hspec ψ hψ (jointTest l) a.2 b.2 + (reflectionTerms_subcount l (jointTest l) (jointTest_subcount l hl) a ha) + (reflectionTerms_subcount l (jointTest l) (jointTest_subcount l hl) b hb) + J D hD hDn p r δ τ hδ hp0 hp htail + rw [reflection_double_expansion l hl] + have hdouble := approx_real_list_sum ψ (reflectionTerms l) Prod.fst + (fun a => ((reflectionTerms l).map (fun b => b.1 • (a.2.zero * D * b.2.zero))).sum) + ((J.card : ℝ) + p.natDegree) + (((reflectionTerms l).map (fun a => |a.1|)).sum * W) + (((reflectionTerms l).map (fun a => |a.1|)).sum * ε) + (fun a ha => approx_real_list_sum ψ (reflectionTerms l) Prod.fst + (fun b => a.2.zero * D * b.2.zero) _ W ε (hpair a ha)) + rw [reflectionTerms_weight] at hdouble + have hpow : (3 : ℝ)^l.length * (3 : ℝ)^l.length = (9 : ℝ)^l.length := by + rw [← mul_pow]; norm_num + simpa only [← mul_assoc, hpow] using hdouble + +lemma tensor_reflection_approximation + (hspec : PublishedProductSpectralResolution) {N ell : ℕ} + (R : ReflectionLayer N) (ψ : State N) (hψ : ‖ψ‖ ≤ 1) + (J : Finset (Fin N)) (hJ : J.card ≤ ell) + (D : Operator N) (hD : TensorSupported J D) (hDn : ‖D‖ ≤ 1) + (p : Polynomial ℝ) (r δ τ : ℝ) (hδ : 0 ≤ δ) (hτ : 0 ≤ τ) + (hp0 : p.eval 0 = 1) + (hp : ∀ k : ℕ, 1 ≤ k → (k : ℝ) < r → |p.eval (k : ℝ)| ≤ δ) + (htail : ∀ S : List (Count N), S.Sublist R.gates → S.length ≤ ell → + ‖act ((jointTest S).high r) ψ‖ ≤ τ) : + ApproxOn (act (reflectionMatrix R) ψ) ((ell : ℝ) + p.natDegree) + ((9 : ℝ)^ell * weight N p) + ((9 : ℝ)^ell * (δ + (1 + weight N p) * τ)) + (conjugate (reflectionMatrix R) D) := by + let A := R.touching J + have hlen : A.gates.length ≤ ell := (R.touching_length J).trans hJ + have hξ : ‖act (reflectionMatrix R) ψ‖ ≤ 1 := + (act_unitary_norm (reflectionMatrix_unitary R) ψ).trans_le hψ + have ht : ‖act ((jointTest A.gates).high r) (act (reflectionMatrix R) ψ)‖ ≤ τ := by + exact (reflection_joint_tail_eq R A.gates (List.filter_sublist) r ψ).trans_le + (htail A.gates (List.filter_sublist) hlen) + have h := reflection_expansion_approximation hspec A.gates A.disjoint + (act (reflectionMatrix R) ψ) hξ J D hD hDn p r δ τ hδ hp0 hp ht + have hc : (9 : ℝ)^A.gates.length ≤ (9 : ℝ)^ell := pow_le_pow_right₀ (by norm_num) hlen + have heq : conjugate (reflectionMatrix R) D = conjugate (reflectList A.gates) D := by + calc + _ = conjugate (reflectionMatrix A) D := R.touching_conjugate J D hD + _ = _ := congrArg (fun U : Operator N => conjugate U D) (reflectionMatrix_eq A) + have hcard : (J.card : ℝ) ≤ (ell : ℝ) := by exact_mod_cast hJ + have hdeg : (J.card : ℝ) + p.natDegree ≤ (ell : ℝ) + p.natDegree := by linarith + have hnorm := mul_le_mul_of_nonneg_right hc (weight_nonneg (Nat.cast_nonneg N) p) + have herror := mul_le_mul_of_nonneg_right hc + (show 0 ≤ δ + (1 + weight N p) * τ by + have := weight_nonneg (Nat.cast_nonneg N) p + positivity) + exact (h.mono hdeg hnorm herror).congr_operator heq.symm + +theorem low_degree_reflection_approximation + (hpauli : PublishedPauliExpansion) (hspec : PublishedProductSpectralResolution) + {N ell : ℕ} (hN : 1 ≤ N) (R : ReflectionLayer N) (ψ : State N) (hψ : ‖ψ‖ ≤ 1) + (E : Operator N) (hE : HasDegreeLE E ell) (p : Polynomial ℝ) + (r δ τ : ℝ) (hδ : 0 ≤ δ) (hτ : 0 ≤ τ) (hp0 : p.eval 0 = 1) + (hp : ∀ k : ℕ, 1 ≤ k → (k : ℝ) < r → |p.eval (k : ℝ)| ≤ δ) + (htail : ∀ S : List (Count N), S.Sublist R.gates → S.length ≤ ell → + ‖act ((jointTest S).high r) ψ‖ ≤ τ) : + ApproxOn (act (reflectionMatrix R) ψ) ((ell : ℝ) + p.natDegree) + (propagationBudget N ell * ‖E‖ * weight N p) + (propagationBudget N ell * ‖E‖ * (δ + (1 + weight N p) * τ)) + (conjugate (reflectionMatrix R) E) := by + let ξ := act (reflectionMatrix R) ψ + let W := weight N p + let ε := δ + (1 + W) * τ + have hW : 0 ≤ W := weight_nonneg (Nat.cast_nonneg N) p + have hε : 0 ≤ ε := by dsimp [ε]; positivity + obtain ⟨terms, hsum, hsupp, hmass⟩ := hpauli N ell hN E hE + have hterm : ∀ t ∈ terms, + ApproxOn ξ ((ell : ℝ) + p.natDegree) ((9 : ℝ)^ell * W) + ((9 : ℝ)^ell * ε) (conjugate (reflectionMatrix R) (localMatrix t.gates)) := by + intro t ht + have hn : ‖localMatrix t.gates‖ ≤ 1 := + (CStarRing.norm_coe_unitary (⟨localMatrix t.gates, localMatrix_unitary t.gates⟩ : + unitary (Operator N))).le + exact tensor_reflection_approximation hspec R ψ hψ t.support (hsupp t ht) + (localMatrix t.gates) (localMatrix_supported t.gates t.support t.outside) hn + p r δ τ hδ hτ hp0 hp htail + have heq : conjugate (reflectionMatrix R) E = + (terms.map (fun t => t.coeff • conjugate (reflectionMatrix R) (localMatrix t.gates))).sum := by + rw [hsum] + exact conjugate_complex_list_sum (reflectionMatrix R) terms + LocalExpansionTerm.coeff (fun t => localMatrix t.gates) + rw [heq] + have hh := approx_list_sum ξ terms LocalExpansionTerm.coeff + (fun t => conjugate (reflectionMatrix R) (localMatrix t.gates)) + ((ell : ℝ) + p.natDegree) ((9 : ℝ)^ell * W) ((9 : ℝ)^ell * ε) hterm + apply hh.mono le_rfl + · calc + _ ≤ (((ell + 1 : ℕ) : ℝ) * (3 * N : ℝ)^ell * ‖E‖) * ((9 : ℝ)^ell * W) := + mul_le_mul_of_nonneg_right hmass (by positivity) + _ = _ := by dsimp [propagationBudget, W]; ring + · calc + _ ≤ (((ell + 1 : ℕ) : ℝ) * (3 * N : ℝ)^ell * ‖E‖) * ((9 : ℝ)^ell * ε) := + mul_le_mul_of_nonneg_right hmass (by positivity) + _ = _ := by dsimp [propagationBudget, ε, W]; ring + +end QAC + +end + +end OAI diff --git a/lean/OAI/InformationTheory/QuantumCircuit/RegularApproximation.lean b/lean/OAI/InformationTheory/QuantumCircuit/RegularApproximation.lean new file mode 100644 index 0000000000000000000000000000000000000000..c5e1307ab00d9d17c6ee6ce7adcfeba9a66e7d09 --- /dev/null +++ b/lean/OAI/InformationTheory/QuantumCircuit/RegularApproximation.lean @@ -0,0 +1,253 @@ +import OAI.InformationTheory.QuantumCircuit.SpectralIdentities + +namespace OAI + +/-! Polynomial approximations on regular quantum trajectories. -/ + +noncomputable section +open scoped BigOperators Matrix.Norms.L2Operator +open Filter + +namespace QAC + +def Count.Subcount {N : ℕ} (A M : Count N) : Prop := + A.support ⊆ M.support ∧ ∀ i ∈ A.support, A.vector i = M.vector i + +lemma Count.Subcount.refl {N : ℕ} (M : Count N) : M.Subcount M := ⟨Finset.Subset.refl _, by simp⟩ + +lemma Count.Subcount.trans {N : ℕ} {A B M : Count N} + (h : A.Subcount B) (h' : B.Subcount M) : A.Subcount M := + ⟨h.1.trans h'.1, fun i hi => (h.2 i hi).trans (h'.2 i (h.1 hi))⟩ + +lemma Count.Subcount.zero_eq {N : ℕ} {A M : Count N} (h : A.Subcount M) : + A.zero = (M.restrict A.support).zero := by + classical + dsimp only [Count.zero, Count.restrict] + congr 1 + funext i + by_cases hi : i ∈ A.support + · simp [hi, h.1 hi, h.2 i hi] + · simp [hi] + +lemma Count.subcount_join_left {N : ℕ} (A B : Count N) : A.Subcount (A.join B) := by + classical + exact ⟨Finset.subset_union_left, by intro i hi; simp [Count.join, hi]⟩ + +lemma Count.subcount_join_right {N : ℕ} (A B : Count N) + (h : Disjoint A.support B.support) : B.Subcount (A.join B) := by + classical + refine ⟨Finset.subset_union_right, ?_⟩ + intro i hi + have hn : i ∉ A.support := fun ha => Finset.disjoint_left.mp h ha hi + simp [Count.join, hn] + +lemma Count.Subcount.join {N : ℕ} {A B M : Count N} + (hA : A.Subcount M) (hB : B.Subcount M) : (A.join B).Subcount M := by + classical + refine ⟨Finset.union_subset hA.1 hB.1, ?_⟩ + intro i hi + change (if i ∈ A.support then A.vector i else B.vector i) = M.vector i + split_ifs with ha + · exact hA.2 i ha + · exact hB.2 i ((Finset.mem_union.mp hi).resolve_left ha) + +lemma jointTest_support {N : ℕ} (l : List (Count N)) (i : Fin N) : + i ∈ (jointTest l).support ↔ ∃ A ∈ l, i ∈ A.support := by + induction l with + | nil => simp [jointTest, Count.empty] + | cons A l ih => simp [jointTest, Count.join, ih, or_and_right, exists_or] + +lemma jointTest_disjoint {N : ℕ} (A : Count N) (l : List (Count N)) + (h : ∀ B ∈ l, Disjoint A.support B.support) : + Disjoint A.support (jointTest l).support := by + apply Finset.disjoint_left.mpr + intro i hi hj + obtain ⟨B, hB, hiB⟩ := (jointTest_support l i).mp hj + exact Finset.disjoint_left.mp (h B hB) hi hiB + +lemma jointTest_subcount {N : ℕ} (l : List (Count N)) + (hl : l.Pairwise (fun A B => Disjoint A.support B.support)) : + ∀ A ∈ l, A.Subcount (jointTest l) := by + induction l with + | nil => simp + | cons A l ih => + obtain ⟨ha, hl⟩ := List.pairwise_cons.mp hl + intro B hB + rcases List.mem_cons.mp hB with rfl | hB + · exact Count.subcount_join_left _ _ + · exact (ih hl B hB).trans (Count.subcount_join_right _ _ (jointTest_disjoint A l ha)) + +lemma reflectionTerms_subcount {N : ℕ} (l : List (Count N)) (M : Count N) + (hl : ∀ A ∈ l, A.Subcount M) : ∀ p ∈ reflectionTerms l, p.2.Subcount M := by + induction l with + | nil => simp [reflectionTerms, Count.Subcount, Count.empty] + | cons A l ih => + intro p hp + rcases List.mem_append.mp hp with hp | hp + · exact ih (fun B hb => hl B (List.mem_cons_of_mem _ hb)) p hp + · obtain ⟨q, hq, rfl⟩ := List.mem_map.mp hp + exact (hl A (List.mem_cons_self ..)).join + (ih (fun B hb => hl B (List.mem_cons_of_mem _ hb)) q hq) + +lemma TensorSupported.disjoint_commute {N : ℕ} {J K : Finset (Fin N)} + {A B : Operator N} (hA : TensorSupported J A) (hB : TensorSupported K B) + (h : Disjoint J K) : Commute A B := by + classical + rcases hA with ⟨a, rfl, ha⟩ + rcases hB with ⟨b, rfl, hb⟩ + show tensorMatrix a * tensorMatrix b = tensorMatrix b * tensorMatrix a + rw [tensorMatrix_mul, tensorMatrix_mul] + congr 1 + funext i + by_cases hi : i ∈ J + · have hik : i ∉ K := Finset.disjoint_left.mp h hi + simp [hb i hik] + · simp [ha i hi] + +lemma Count.zero_supported {N : ℕ} (A : Count N) : TensorSupported A.support A.zero := + ⟨_, rfl, by intro i hi; simp [hi]⟩ + +lemma localMatrix_supported {N : ℕ} (L : LocalLayer N) (J : Finset (Fin N)) + (h : ∀ i ∉ J, L i = 1) : TensorSupported J (localMatrix L) := + ⟨_, rfl, by intro i hi; simp [h i hi]⟩ + +def ReflectionLayer.touching {N : ℕ} (R : ReflectionLayer N) (J : Finset (Fin N)) : + ReflectionLayer N where + gates := R.gates.filter (fun D => decide (¬Disjoint D.support J)) + disjoint := R.disjoint.filter _ + +lemma ReflectionLayer.touching_length {N : ℕ} (R : ReflectionLayer N) + (J : Finset (Fin N)) : (R.touching J).gates.length ≤ J.card := by + apply list_disjoint_hits_length Count.support _ (R.touching J).disjoint + intro D hD + have h := (List.mem_filter.mp hD).2 + simp only [decide_eq_true_eq] at h + exact Finset.not_disjoint_iff_nonempty_inter.mp h + +lemma ReflectionLayer.touching_conjugate {N : ℕ} (R : ReflectionLayer N) + (J : Finset (Fin N)) (D : Operator N) (hD : TensorSupported J D) : + conjugate (reflectionMatrix R) D = conjugate (reflectionMatrix (R.touching J)) D := by + rw [reflectionMatrix_eq, reflectionMatrix_eq] + apply list_conjugate_filter + · exact R.disjoint.imp (fun h => reflect_disjoint_commute _ _ h) + · intro A _; exact reflect_unitary A + · intro A _ hA + have hd : Disjoint A.support J := by simpa using hA + exact (Commute.one_left _).sub_left ((A.zero_supported.disjoint_commute hD hd).smul_left (2 : ℝ)) + +def interiorTerm {N : ℕ} (M : Count N) (J S T : Finset (Fin N)) + (D : Operator N) : Operator N := + (M.restrict (S ∩ J)).zero * D * (M.restrict (T ∩ J)).zero + +lemma interiorTerm_supported {N : ℕ} (M : Count N) (J S T : Finset (Fin N)) + (D : Operator N) (hD : TensorSupported J D) : + TensorSupported J (interiorTerm M J S T D) := by + rcases hD with ⟨a, rfl, ha⟩ + refine ⟨fun i => + (if i ∈ (M.restrict (S ∩ J)).support then rankOne (M.vector i) else 1) * a i * + (if i ∈ (M.restrict (T ∩ J)).support then rankOne (M.vector i) else 1), ?_, ?_⟩ + · unfold interiorTerm Count.zero + rw [tensorMatrix_mul, tensorMatrix_mul] + rfl + · intro i hi + simp [Count.restrict, hi, ha i hi] + +lemma interiorTerm_norm {N : ℕ} (M : Count N) (J S T : Finset (Fin N)) + (D : Operator N) (hD : ‖D‖ ≤ 1) : ‖interiorTerm M J S T D‖ ≤ 1 := + norm_mul_le_one + (norm_mul_le_one (IsStarProjection.norm_le _ (M.restrict _).zero_projection) hD) + (IsStarProjection.norm_le _ (M.restrict _).zero_projection) + +lemma sandwich_factor {N : ℕ} (M : Count N) (J S T : Finset (Fin N)) + (D : Operator N) (hD : TensorSupported J D) : + (M.restrict S).zero * D * (M.restrict T).zero = + interiorTerm M J S T D * (M.restrict ((S ∪ T) \ J)).zero := by + classical + rcases hD with ⟨a, rfl, ha⟩ + unfold interiorTerm Count.zero + simp only [tensorMatrix_mul] + congr 1 + funext i + by_cases hm : i ∈ M.support + · have hid := (rankOne_projection (M.normalized i hm)).isIdempotentElem.eq + by_cases hj : i ∈ J + · by_cases hs : i ∈ S <;> by_cases ht : i ∈ T <;> + simp [Count.restrict, hm, hj, hs, ht] + · by_cases hs : i ∈ S <;> by_cases ht : i ∈ T <;> + simp [Count.restrict, hm, hj, hs, ht, ha i hj, hid] + · simp [Count.restrict, hm] + +lemma Count.restrict_zero_pattern_commute {N : ℕ} (M : Count N) + (J F : Finset (Fin N)) : Commute (M.restrict J).zero (M.pattern F) := by + classical + change (M.restrict J).zero * M.pattern F = M.pattern F * (M.restrict J).zero + unfold Count.zero Count.pattern + rw [tensorMatrix_mul, tensorMatrix_mul] + congr 1 + funext i + by_cases hm : i ∈ M.support + · by_cases hj : i ∈ J <;> by_cases hf : i ∈ F <;> + simp [Count.restrict, hm, hj, hf, mul_sub, sub_mul] + · simp [Count.restrict, hm] + +lemma Count.restrict_zero_high_commute {N : ℕ} (M : Count N) + (J : Finset (Fin N)) (r : ℝ) : Commute (M.restrict J).zero (M.high r) := by + classical + change (M.restrict J).zero * M.high r = M.high r * (M.restrict J).zero + rw [Count.high, Finset.mul_sum, Finset.sum_mul] + apply Finset.sum_congr rfl + intro F _ + split_ifs + · exact (M.restrict_zero_pattern_commute J F).eq + · simp + +lemma Count.restrict_high_absorb (hspec : PublishedProductSpectralResolution) + {N : ℕ} (M : Count N) (J : Finset (Fin N)) (r : ℝ) : + (M.restrict J).high r * M.high r = (M.restrict J).high r := by + classical + have hleft : M.high r * (M.restrict J).high r = (M.restrict J).high r := by + rw [hspec.restriction, Finset.mul_sum] + apply Finset.sum_congr rfl + intro F hF + by_cases hr : r ≤ ((F ∩ J).card : ℝ) + · simp only [hr, ite_true] + rw [M.high_mul_pattern F (Finset.mem_powerset.mp hF)] + exact ite_eq_left (hr.trans (by exact_mod_cast Finset.card_le_card Finset.inter_subset_left)) + · simp [hr] + have := congrArg star hleft + simpa only [star_mul, (M.high_projection r).isSelfAdjoint.star_eq, + ((M.restrict J).high_projection r).isSelfAdjoint.star_eq] using this + +lemma Count.restrict_high_action_le (hspec : PublishedProductSpectralResolution) + {N : ℕ} (M : Count N) (J : Finset (Fin N)) (r : ℝ) (ψ : State N) : + ‖act ((M.restrict J).high r) ψ‖ ≤ ‖act (M.high r) ψ‖ := by + rw [← M.restrict_high_absorb hspec J r, act_mul] + exact act_norm_le_of_contraction _ (IsStarProjection.norm_le _ ((M.restrict J).high_projection r)) _ + +lemma Count.polynomial_action_error {N : ℕ} (M : Count N) (p : Polynomial ℝ) + (ψ : State N) (r δ τ : ℝ) (hδ : 0 ≤ δ) (hψ : ‖ψ‖ ≤ 1) + (hp0 : p.eval 0 = 1) + (hp : ∀ k : ℕ, 1 ≤ k → (k : ℝ) < r → |p.eval (k : ℝ)| ≤ δ) + (htail : ‖act (M.high r) ψ‖ ≤ τ) : + ‖act (M.zero - M.polynomial p) ψ‖ ≤ δ + (1 + weight N p) * τ := by + have hsplit : M.zero - M.polynomial p = + (M.zero - M.polynomial p) * M.low r + (M.zero - M.polynomial p) * M.high r := by + dsimp [Count.low]; noncomm_ring + rw [hsplit, act_add] + apply (norm_add_le _ _).trans + apply add_le_add + · exact (act_norm_le _ _).trans ((mul_le_mul_of_nonneg_right + (M.polynomial_error_low p hδ hp0 hp) (norm_nonneg _)).trans + (by simpa using mul_le_mul_of_nonneg_left hψ hδ)) + · rw [act_mul] + have hw : 0 ≤ 1 + weight N p := by have := weight_nonneg (Nat.cast_nonneg N) p; linarith + exact (act_norm_le _ _).trans (mul_le_mul + ((norm_sub_le _ _).trans (add_le_add + (IsStarProjection.norm_le _ M.zero_projection) (M.polynomial_norm_le p))) + htail (norm_nonneg _) hw) + +end QAC + +end + +end OAI diff --git a/lean/OAI/InformationTheory/QuantumCircuit/Regularity.lean b/lean/OAI/InformationTheory/QuantumCircuit/Regularity.lean new file mode 100644 index 0000000000000000000000000000000000000000..6d729b8b684a1d2a843ef466fc8e275def72d287 --- /dev/null +++ b/lean/OAI/InformationTheory/QuantumCircuit/Regularity.lean @@ -0,0 +1,50 @@ +import OAI.InformationTheory.QuantumCircuit.ConditionalParity +import OAI.InformationTheory.QuantumCircuit.PauliExpansion +import OAI.InformationTheory.QuantumCircuit.LowDegreePropagation +import OAI.InformationTheory.QuantumCircuit.ProductStateBasis + +namespace OAI + +/-! Low-degree propagation and pruning for regular quantum trajectories. -/ + +noncomputable section +open scoped BigOperators Matrix.Norms.L2Operator Topology +open Filter + +namespace QAC + +theorem low_degree_propagation_unconditional + (d : ℕ) (m : ℕ → ℕ) (hm : Tendsto m atTop atTop) + (l : ∀ ν, List (AnalyticLayer (m ν))) (hl : ∀ ν, (l ν).length ≤ d) + (ψ : ∀ ν, State (m ν)) (hψ : ∀ ν, ‖ψ ν‖ ≤ 1) + (hreg : RegularTrajectory m l ψ) + {k K : ℝ} (hk : 0 < k) (hkK : k < K) (hK : K < 1) : + ∀ᶠ ν in atTop, ∀ E : Operator (m ν), + HasDegreeLE E ((m ν : ℝ)^k) → ‖E‖ ≤ Real.exp ((m ν : ℝ)^k) → + ∃ E' : Operator (m ν), HasDegreeLE E' ((m ν : ℝ)^K) ∧ + ‖E'‖ ≤ Real.exp ((m ν : ℝ)^K) ∧ + ‖act (evolution (l ν)) (act E (ψ ν)) - + act E' (act (evolution (l ν)) (ψ ν))‖ ≤ Real.exp (-((m ν : ℝ)^k)) := + low_degree_propagation published_pauli_expansion published_product_spectral_resolution + d m hm l hl ψ hψ hreg hk hkK hK + +theorem regular_pruning_of_factors + (d : ℕ) (m : ℕ → ℕ) (hm : Tendsto m atTop atTop) (hN : ∀ ν, 1 ≤ m ν) + (l : ∀ ν, List (AnalyticLayer (m ν))) (hl : ∀ ν, (l ν).length ≤ d) + (hs : ∀ ν, NonemptyGateSupports (l ν)) + (a : ∀ ν, Fin (m ν) → Bit → ℂ) + (ha : ∀ ν i, ∑ b, Complex.normSq (a ν i b) = 1) : + RegularTrajectory m (fun ν => pruneCircuit (l ν) (productVector (a ν))) + (fun ν => productVector (a ν)) ∧ + (∀ ν, (pruneCircuit (l ν) (productVector (a ν))).length = (l ν).length) ∧ + (∀ ν, ‖act (evolution (l ν)) (productVector (a ν)) - + act (evolution (pruneCircuit (l ν) (productVector (a ν)))) (productVector (a ν))‖ ≤ + 2 * ((l ν).length : ℝ) * (m ν : ℝ)^(-2 : ℝ)) := + regular_pruning_unconditional d m hm hN l hl hs + (fun ν => ProductInput.ofFactors (a ν) (ha ν)) + +end QAC + +end + +end OAI diff --git a/lean/OAI/InformationTheory/QuantumCircuit/RetainedMean.lean b/lean/OAI/InformationTheory/QuantumCircuit/RetainedMean.lean new file mode 100644 index 0000000000000000000000000000000000000000..2d612a3b05ae668a0503b62d2e941ba31969fd84 --- /dev/null +++ b/lean/OAI/InformationTheory/QuantumCircuit/RetainedMean.lean @@ -0,0 +1,66 @@ +import OAI.InformationTheory.QuantumCircuit.HeavyOutcome + +namespace OAI + +/-! Mean excitation counts of retained reflection layers. -/ + +noncomputable section +open scoped BigOperators Matrix.Norms.L2Operator Topology +open Filter + +namespace QAC + +lemma eventually_exp_le_negative_power {p : ℝ} (hp : 0 < p) (c : ℝ) : + ∀ᶠ N : ℕ in atTop, Real.exp (-((N : ℝ)^p)) ≤ (N : ℝ)^(-c) := by + filter_upwards [eventually_power_log_le hp c, eventually_ge_atTop 1] with N hc hN + have hn : (0 : ℝ) < N := by exact_mod_cast (show 0 < N by omega) + conv_rhs => rw [Real.rpow_def_of_pos hn] + apply Real.exp_le_exp.mpr + simp only [Real.rpow_zero, mul_one] at hc + nlinarith only [hc] + +theorem retained_test_mean + (hspec : PublishedProductSpectralResolution) (d : ℕ) + (m : ℕ → ℕ) (hm : Tendsto m atTop atTop) (P : ∀ ν, ProductInput (m ν)) + {ε : ℝ} (hε : 0 < ε) : + ∀ᶠ ν in atTop, ∀ U : Operator (m ν), IsCircuit d U → ∀ B : Count (m ν), + (m ν : ℝ)^(-6 : ℝ) ≤ ‖act B.zero (act U (P ν).state)‖^2 → + meanCount B (act U (P ν).state) ≤ (m ν : ℝ)^ε := by + have hp : 0 < ε / 4 := by positivity + have hph : ε / 4 < ε / 2 := by linarith + filter_upwards [uniform_product_overlap_tail d m hm P hp hph, + hm.eventually (eventually_exp_le_negative_power hp 7), + hm.eventually (eventually_two_powers_le (show ε / 2 < ε by linarith) hε), + hm.eventually (eventually_ge_atTop 1)] with ν hov hex hsum hN + intro U hU B hret + let ψ := act U (P ν).state + let T := ‖act (B.high ((m ν : ℝ)^(ε / 2))) ψ‖ + have hn : (0 : ℝ) < m ν := by exact_mod_cast (show 0 < m ν by omega) + have hn1 : (1 : ℝ) ≤ m ν := by exact_mod_cast hN + have hT : T ≤ (m ν : ℝ)^(-1 : ℝ) := by + have hmul : (m ν : ℝ)^(-6 : ℝ) * T ≤ (m ν : ℝ)^(-7 : ℝ) := + (mul_le_mul_of_nonneg_right hret (norm_nonneg _)).trans ((hov U hU B).trans hex) + have hdiv : T ≤ (m ν : ℝ)^(-7 : ℝ) / (m ν : ℝ)^(-6 : ℝ) := + (le_div_iff₀ (Real.rpow_pos_of_pos hn _)).mpr (by simpa only [mul_comm] using hmul) + rw [← Real.rpow_sub hn] at hdiv + norm_num at hdiv + exact hdiv + have hT1 : T ≤ 1 := hT.trans (by rw [Real.rpow_neg_one]; exact inv_le_one_of_one_le₀ hn1) + have hnT : (m ν : ℝ) * T ≤ 1 := by + have hh := mul_le_mul_of_nonneg_left hT hn.le + rw [Real.rpow_neg_one, mul_inv_cancel₀ hn.ne'] at hh + exact hh + have htiny : (m ν : ℝ) * T^2 ≤ 1 := by + nlinarith [mul_le_mul_of_nonneg_right hnT (norm_nonneg (act (B.high ((m ν : ℝ)^(ε / 2))) ψ))] + have hψ : ‖ψ‖ = 1 := (act_unitary_norm hU.mem_unitary _).trans (P ν).norm_state + have hh := meanCount_le_cut hspec B ψ (r := (m ν : ℝ)^(ε / 2)) (by positivity) + rw [hψ, one_pow, mul_one] at hh + simp only [Real.rpow_zero] at hsum + dsimp [T] at htiny + linarith only [hh, htiny, hsum] + +end QAC + +end + +end OAI diff --git a/lean/OAI/InformationTheory/QuantumCircuit/RetainedRegularity.lean b/lean/OAI/InformationTheory/QuantumCircuit/RetainedRegularity.lean new file mode 100644 index 0000000000000000000000000000000000000000..d810e418545f5f9dc5dfa5b7be4a4738d1d2f7a8 --- /dev/null +++ b/lean/OAI/InformationTheory/QuantumCircuit/RetainedRegularity.lean @@ -0,0 +1,120 @@ +import OAI.InformationTheory.QuantumCircuit.RetainedMean + +namespace OAI + +/-! Regularity of the retained trajectories. -/ + +noncomputable section +open scoped BigOperators Matrix.Norms.L2Operator Topology +open Filter + +namespace QAC + +lemma Count.high_flip_action_le {N : ℕ} (M : Count N) (F : Finset (Fin N)) + (hF : F ⊆ M.support) {r q : ℝ} (hgap : q + F.card ≤ r) (ψ : State N) : + ‖act (M.high r) ψ‖ ≤ ‖act ((M.flip F).high q) ψ‖ := by + have hh := congrArg star (M.high_flip_absorb F hF hgap) + simp only [star_mul, (M.high_projection r).isSelfAdjoint.star_eq, + ((M.flip F).high_projection q).isSelfAdjoint.star_eq] at hh + calc + _ = ‖act (M.high r) (act ((M.flip F).high q) ψ)‖ := by rw [← act_mul, hh] + _ ≤ _ := act_norm_le_of_contraction _ (IsStarProjection.norm_le _ (M.high_projection r)) _ + +lemma eventually_heavy_probability {a b : ℝ} (ha : 0 ≤ a) (hab : a < b) (hb : 0 < b) : + ∀ᶠ N : ℕ in atTop, Real.exp (-((N : ℝ)^b)) ≤ + 1 / (2 * (N + 1 : ℝ)^(⌈(N : ℝ)^a⌉₊ + 1)) := by + filter_upwards [eventually_pattern_cost ha hab hb] with N hN + have hh : Real.exp (-1 : ℝ) ≤ 1/2 := by + rw [Real.exp_neg] + have he := Real.add_one_le_exp (1 : ℝ) + have he2 : (2 : ℝ) ≤ Real.exp 1 := by linarith + simpa only [one_div] using one_div_le_one_div_of_le (by norm_num) he2 + simp only [Real.rpow_zero] at hN + apply (le_div_iff₀ (by positivity : 0 < 2 * (N + 1 : ℝ)^(⌈(N : ℝ)^a⌉₊ + 1))).mpr + nlinarith [hN.trans hh] + +lemma list_real_sum_le {ι : Type*} (l : List ι) (f : ι → ℝ) (C : ℝ) + (h : ∀ i ∈ l, f i ≤ C) : (l.map f).sum ≤ (l.length : ℝ) * C := by + induction l with + | nil => simp + | cons i l ih => + simp only [List.map_cons, List.sum_cons, List.length_cons, Nat.cast_add, Nat.cast_one, add_mul, one_mul] + exact (add_le_add (h i (List.mem_cons_self ..)) + (ih (fun j hj => h j (List.mem_cons_of_mem _ hj)))).trans_eq (add_comm _ _) + +theorem retained_layer_regular + (hspec : PublishedProductSpectralResolution) (d : ℕ) + (m : ℕ → ℕ) (hm : Tendsto m atTop atTop) (P : ∀ ν, ProductInput (m ν)) + {b h p : ℝ} (hb : 0 ≤ b) (hbh : b < h) (_hh : h < 1) (hp : 0 < p) (hph : p < h) : + ∀ᶠ ν in atTop, ∀ U : Operator (m ν), IsCircuit d U → + ∀ R : ReflectionLayer (m ν), + (∀ A ∈ R.gates, (m ν : ℝ)^(-6 : ℝ) ≤ ‖act A.zero (act U (P ν).state)‖^2) → + ∀ S : List (Count (m ν)), S.Sublist R.gates → (S.length : ℝ) ≤ (m ν : ℝ)^b → + ‖act ((jointTest S).high ((m ν : ℝ)^h)) (act U (P ν).state)‖ ≤ + Real.exp (-((m ν : ℝ)^p)) := by + let ε := (h - b) / 4 + let a := b + ε + let c := b + 2 * ε + let β := b + 3 * ε + have hε : 0 < ε := by dsimp [ε]; linarith + have hac : a < c := by dsimp [a, c]; linarith + have hcβ : c < β := by dsimp [c, β]; linarith + have hβh : β < h := by dsimp [β, ε]; linarith + have hc : 0 ≤ c := by dsimp [c]; linarith + have hβ : 0 < β := by dsimp [β]; linarith + obtain ⟨p', hmp, hph'⟩ := exists_between (max_lt hph hβh) + obtain ⟨h', hp'h', hh'h⟩ := exists_between hph' + have hpp' : p < p' := (le_max_left _ _).trans_lt hmp + have hβp' : β < p' := (le_max_right _ _).trans_lt hmp + have hcp' : c < p' := hcβ.trans hβp' + filter_upwards [retained_test_mean hspec d m hm P hε, + uniform_product_overlap_tail d m hm P (hp.trans hpp') hp'h', + hm.eventually (eventually_power_le hac 2), + hm.eventually (eventually_heavy_probability hc hcβ hβ), + hm.eventually (eventually_two_powers_le hh'h (hcp'.trans (hp'h'.trans hh'h))), + hm.eventually (eventually_exp_power_gap hpp' hβp' (hp.trans hpp') 1 1 1 1 + (by norm_num) (by norm_num)), + hm.eventually (eventually_ge_atTop 1)] + with ν hmean hov hmark hmass hshift hdec hN + intro U hU R hret S hS hsize + let ψ := act U (P ν).state + let M := jointTest S + have hψ : ‖ψ‖ = 1 := (act_unitary_norm hU.mem_unitary _).trans (P ν).norm_state + have hM : meanCount M ψ ≤ (m ν : ℝ)^a := by + rw [meanCount_joint hspec S (R.disjoint.sublist hS)] + calc + _ ≤ (S.length : ℝ) * (m ν : ℝ)^ε := + list_real_sum_le S (fun A => meanCount A ψ) _ + (fun A hA => hmean U hU A (hret A (hS.subset hA))) + _ ≤ (m ν : ℝ)^b * (m ν : ℝ)^ε := + mul_le_mul_of_nonneg_right hsize (Real.rpow_nonneg (Nat.cast_nonneg _) _) + _ = _ := (Real.rpow_add (by exact_mod_cast (show 0 < m ν by omega)) _ _).symm + have hmark' : meanCount M ψ ≤ (m ν : ℝ)^c / 2 := by linarith + obtain ⟨F, hFM, hFc, hFmass⟩ := heavy_low_outcome hspec hN M ψ hψ + (r := (m ν : ℝ)^c) (Real.rpow_pos_of_pos (by exact_mod_cast (show 0 < m ν by omega)) _) hmark' + have hF : Real.exp (-((m ν : ℝ)^β)) ≤ outcomeMass M ψ F := hmass.trans hFmass + have htail := hov U hU (M.flip F) + have ht : ‖act (M.high ((m ν : ℝ)^h)) ψ‖ ≤ + ‖act ((M.flip F).high ((m ν : ℝ)^h')) ψ‖ := + M.high_flip_action_le F hFM (by linarith) ψ + have hprod : Real.exp (-((m ν : ℝ)^β)) * ‖act (M.high ((m ν : ℝ)^h)) ψ‖ ≤ + Real.exp (-((m ν : ℝ)^p')) := by + have hprob : outcomeMass M ψ F = ‖act (M.flip F).zero ψ‖^2 := by + rw [M.flip_zero]; rfl + rw [hprob] at hF + exact (mul_le_mul hF ht (norm_nonneg _) (sq_nonneg _)).trans htail + have hdiv : ‖act (M.high ((m ν : ℝ)^h)) ψ‖ ≤ + Real.exp (-((m ν : ℝ)^p')) / Real.exp (-((m ν : ℝ)^β)) := + (le_div_iff₀ (Real.exp_pos (-((m ν : ℝ)^β)))).mpr + (by simpa only [mul_comm] using hprod) + have hexp : Real.exp (-((m ν : ℝ)^p')) / Real.exp (-((m ν : ℝ)^β)) = + Real.exp ((m ν : ℝ)^β - (m ν : ℝ)^p') := by + rw [← Real.exp_sub]; congr 1; ring + rw [hexp] at hdiv + exact hdiv.trans (by simpa only [one_mul] using hdec) + +end QAC + +end + +end OAI diff --git a/lean/OAI/InformationTheory/QuantumCircuit/ScaleInduction.lean b/lean/OAI/InformationTheory/QuantumCircuit/ScaleInduction.lean new file mode 100644 index 0000000000000000000000000000000000000000..2e55cfdaf1f9f2e44b44fecc6a04ae47fc21eecd --- /dev/null +++ b/lean/OAI/InformationTheory/QuantumCircuit/ScaleInduction.lean @@ -0,0 +1,119 @@ +import OAI.InformationTheory.QuantumCircuit.Basic + +namespace OAI + +noncomputable section +open scoped BigOperators Matrix.Norms.L2Operator Topology +open Polynomial Filter Asymptotics + +namespace QAC + +/-- Finite scale bootstrap, stated for the uniform bound relation. This is a +pure real-arithmetic induction and contains no operator-theoretic assumption. -/ +theorem finite_scale_induction (B : ℝ → ℝ → Prop) + (large : ∀ s t, 0 ≤ s → s < t → 1 < t → B s t) + (backstep : ∀ s t a b u w, 0 ≤ s → s < a → a < u → u < w → w < t → t < b → + (a + b) / 2 < u → B t b → B s t) : + ∀ s t, 0 ≤ s → s < t → B s t := by + intro s t hs hst + by_cases ht : 1 < t + · exact large s t hs hst ht + have ht1 : t ≤ 1 := le_of_not_gt ht + let g := t - s + have hg : 0 < g := sub_pos.2 hst + have hg1 : g ≤ 1 := by dsimp [g]; linarith + let K := ⌈2 / g⌉₊ + let η := g ^ 2 / 100 + have hη : 0 < η := by dsimp [η]; positivity + have hKlow : 2 / g ≤ (K : ℝ) := Nat.le_ceil _ + have hKhigh : (K : ℝ) < 2 / g + 1 := Nat.ceil_lt_add_one (by positivity) + have hKg : (K : ℝ) * g ≥ 2 := (div_le_iff₀ hg).1 hKlow + have hKg' : (K : ℝ) * g < 2 + g := by + have := (lt_div_iff₀ hg).1 (show (K : ℝ) < (2 + g) / g by + convert hKhigh using 1 + field_simp) + exact this + have hKη : 3 * (K : ℝ) * η < g / 2 := by + dsimp [η] + nlinarith only [hg, hg1, hKg', mul_lt_mul_of_pos_right hKg' hg] + let T : ℕ → ℝ := fun i => t + (i : ℝ) * g - 3 * η * i * (i + 1) / 2 + let S : ℕ → ℝ := fun i => T i - (g - 3 * i * η) + have hT0 : T 0 = t := by simp [T] + have hS0 : S 0 = s := by simp [S, T, g] + have hTS : ∀ i, S (i + 1) = T i := by + intro i + dsimp [S, T] + push_cast + ring + have hgap : ∀ i ≤ K, g / 2 < T i - S i := by + intro i hi + have hi' : (i : ℝ) ≤ K := by exact_mod_cast hi + dsimp [S] + nlinarith only [hKη, mul_le_mul_of_nonneg_right hi' hη.le] + have hTstep : ∀ i, T (i + 1) = 2 * T i - S i - 3 * η := by + intro i + dsimp [S, T] + push_cast + ring + have hSnonneg : ∀ i ≤ K, 0 ≤ S i := by + intro i + induction i with + | zero => intro _; simpa only [hS0] using hs + | succ i ih => + intro hi + have hiK : i ≤ K := by omega + rw [hTS] + have := hgap i hiK + have := ih hiK + linarith + have hstep : ∀ i < K, T i + g / 2 < T (i + 1) := by + intro i hi + have h := hgap (i + 1) (by omega) + rw [hTS] at h + linarith + have hTbound : ∀ i ≤ K, t + i * (g / 2) ≤ T i := by + intro i + induction i with + | zero => intro _; simp [hT0] + | succ i ih => + intro hi + have h := hstep i (by omega) + have h' := ih (by omega) + push_cast + linarith + have hTK : 1 < T K := by + have h := hTbound K le_rfl + have ht0 : 0 < t := lt_of_le_of_lt hs hst + nlinarith only [h, hKg, ht0] + have hηgap : ∀ i ≤ K, 3 * η < T i - S i := by + intro i hi + have h := hgap i hi + dsimp [η] + nlinarith only [h, hg, hg1, mul_le_mul_of_nonneg_left hg1 hg.le] + have hB : ∀ i ≤ K, B (S i) (T i) := by + intro i hi + induction hi using Nat.decreasingInduction with + | self => + exact large (S K) (T K) (hSnonneg K le_rfl) + (by have := hgap K le_rfl; linarith) hTK + | of_succ i hi ih => + have hiK : i ≤ K := by omega + have h := hηgap i hiK + have htstep := hTstep i + have hnext : B (T i) (T (i + 1)) := by simpa only [hTS] using ih + apply backstep (S i) (T i) (S i + η / 2) (T (i + 1)) + (T i - η) (T i - η / 2) (hSnonneg i hiK) + · linarith + · linarith + · linarith + · linarith + · linarith + · linarith + · exact hnext + simpa only [hS0, hT0] using hB 0 (Nat.zero_le K) + +end QAC + +end + +end OAI diff --git a/lean/OAI/InformationTheory/QuantumCircuit/Spectral.lean b/lean/OAI/InformationTheory/QuantumCircuit/Spectral.lean new file mode 100644 index 0000000000000000000000000000000000000000..b7d03225186053207915cb5e2e8a4d3f565e45fd --- /dev/null +++ b/lean/OAI/InformationTheory/QuantumCircuit/Spectral.lean @@ -0,0 +1,316 @@ +import OAI.InformationTheory.QuantumCircuit.Count + +namespace OAI + +noncomputable section +open scoped BigOperators Matrix.Norms.L2Operator symmDiff +open Matrix + +namespace QAC + +lemma Count.flip_pattern {N : ℕ} (M : Count N) (F G : Finset (Fin N)) : + (M.flip F).pattern G = M.pattern (F ∆ G) := by + classical + dsimp only [Count.pattern, Count.flip] + congr 1 + funext i + by_cases hi : i ∈ M.support + · have hv := rankOne_orthogonalVector (M.normalized i hi) + by_cases hF : i ∈ F <;> by_cases hG : i ∈ G <;> + simp [hi, hF, hG, Finset.mem_symmDiff, hv] + · simp [hi] + +lemma Count.high_mul_pattern {N : ℕ} (M : Count N) (F : Finset (Fin N)) + (hF : F ⊆ M.support) (r : ℝ) : + M.high r * M.pattern F = if r ≤ (F.card : ℝ) then M.pattern F else 0 := by + classical + rw [Count.high, Finset.sum_mul, Finset.sum_eq_single F] + · split_ifs with h + · exact (M.pattern_projection F).isIdempotentElem.eq + · exact zero_mul _ + · intro G hG hGF + split_ifs + · rw [M.pattern_mul (Finset.mem_powerset.mp hG) hF, ite_eq_right hGF] + · exact zero_mul _ + · intro h + exact (h (Finset.mem_powerset.mpr hF)).elim + +lemma symmDiff_subset_of_subset {α : Type*} [DecidableEq α] {F G S : Finset α} + (hF : F ⊆ S) (hG : G ⊆ S) : F ∆ G ⊆ S := + Finset.symmDiff_subset_union.trans (Finset.union_subset hF hG) + +lemma card_le_add_symmDiff {α : Type*} [DecidableEq α] (F G : Finset α) : + G.card ≤ F.card + (F ∆ G).card := by + have h : G ⊆ F ∪ (F ∆ G) := by + intro i hi + by_cases hF : i ∈ F + · exact Finset.mem_union_left _ hF + · exact Finset.mem_union_right _ (Finset.mem_symmDiff.mpr (Or.inr ⟨hi,hF⟩)) + exact (Finset.card_le_card h).trans (Finset.card_union_le _ _) + +lemma Count.high_flip_absorb {N : ℕ} (M : Count N) (F : Finset (Fin N)) + (hF : F ⊆ M.support) {r q : ℝ} (hrq : q + F.card ≤ r) : + (M.flip F).high q * M.high r = M.high r := by + classical + rw [M.high_eq_sum_filter r, Finset.mul_sum] + apply Finset.sum_congr rfl + intro G hG + have hrG : r ≤ (G.card : ℝ) := (Finset.mem_filter.mp hG).2 + have hGs : G ⊆ M.support := Finset.mem_powerset.mp (Finset.mem_filter.mp hG).1 + have hFGs : F ∆ G ⊆ (M.flip F).support := symmDiff_subset_of_subset hF hGs + have heq : M.pattern G = (M.flip F).pattern (F ∆ G) := by + rw [M.flip_pattern, symmDiff_symmDiff_cancel_left] + rw [heq, (M.flip F).high_mul_pattern _ hFGs, ite_eq_left] + have hc : (G.card : ℝ) ≤ F.card + (F ∆ G).card := by exact_mod_cast card_le_add_symmDiff F G + linarith + +def Count.low {N : ℕ} (M : Count N) (r : ℝ) : Operator N := 1 - M.high r + +lemma Count.low_projection {N : ℕ} (M : Count N) (r : ℝ) : IsStarProjection (M.low r) := + (M.high_projection r).one_sub + +lemma Count.low_eq_sum {N : ℕ} (M : Count N) (r : ℝ) : + M.low r = ∑ F ∈ M.support.powerset.filter (fun F => (F.card : ℝ) < r), M.pattern F := by + classical + rw [Count.low, ← M.sum_pattern] + unfold Count.high + rw [← Finset.sum_sub_distrib, Finset.sum_filter] + apply Finset.sum_congr rfl + intro F _ + by_cases h : r ≤ (F.card : ℝ) + · simp [h, not_lt.mpr h] + · simp [h, lt_of_not_ge h] + +lemma norm_mul_le_right {A : Type*} [NormedRing A] (x y : A) (hx : ‖x‖ ≤ 1) : + ‖x*y‖ ≤ ‖y‖ := (norm_mul_le _ _).trans (by nlinarith only [hx, norm_nonneg y]) + +lemma norm_mul_le_left {A : Type*} [NormedRing A] (x y : A) (hy : ‖y‖ ≤ 1) : + ‖x*y‖ ≤ ‖x‖ := (norm_mul_le _ _).trans (by nlinarith only [hy, norm_nonneg x]) + +lemma Count.high_flip_norm {N : ℕ} (M : Count N) (F : Finset (Fin N)) + (hF : F ⊆ M.support) {r q : ℝ} (hrq : q + F.card ≤ r) (B : Operator N) : + ‖M.high r * B * M.pattern F‖ ≤ ‖(M.flip F).high q * B * (M.flip F).zero‖ := by + have habs := congrArg star (M.high_flip_absorb F hF hrq) + simp only [star_mul, (M.high_projection r).isSelfAdjoint.star_eq, + ((M.flip F).high_projection q).isSelfAdjoint.star_eq] at habs + rw [M.flip_zero] + calc + _ = ‖M.high r * ((M.flip F).high q * B * M.pattern F)‖ := by rw [← mul_assoc, ← mul_assoc, habs] + _ ≤ _ := norm_mul_le_right _ _ (IsStarProjection.norm_le _ (M.high_projection r)) + + +lemma Count.generator_mul_pattern {N : ℕ} (M : Count N) (i : Fin N) (hi : i ∈ M.support) + (F : Finset (Fin N)) : + tensorMatrix (fun j => if j = i then 1-rankOne (M.vector i) else 1) * M.pattern F = + if i ∈ F then M.pattern F else 0 := by + classical + rw [Count.pattern, tensorMatrix_mul] + by_cases hiF : i ∈ F + · rw [ite_eq_left hiF] + congr 1 + funext j + by_cases hji : j = i + · subst j + simp only [ite_eq_left hi, ite_eq_left hiF] + exact (rankOne_projection (M.normalized i hi)).one_sub.isIdempotentElem.eq + · simp only [ite_eq_right hji, one_mul] + · rw [ite_eq_right hiF] + apply tensorMatrix_zero_of_zero _ i + simp only [ite_eq_left hi, ite_eq_right hiF] + exact (rankOne_projection (M.normalized i hi)).one_sub_mul_self + +lemma Count.operator_mul_pattern {N : ℕ} (M : Count N) (F : Finset (Fin N)) (hF : F ⊆ M.support) : + M.operator * M.pattern F = (F.card : ℝ) • M.pattern F := by + classical + rw [Count.operator, Finset.sum_mul] + calc + _ = ∑ i ∈ M.support, if i ∈ F then M.pattern F else 0 := by + apply Finset.sum_congr rfl + intro i hi + exact M.generator_mul_pattern i hi F + _ = _ := by + rw [Finset.sum_ite_mem, Finset.inter_eq_right.mpr hF, Finset.sum_const, ← Nat.cast_smul_eq_nsmul ℝ] + +def Count.spectral {N : ℕ} (M : Count N) (f : ℕ → ℝ) : Operator N := + ∑ F ∈ M.support.powerset, f F.card • M.pattern F + +lemma Count.operator_spectral {N : ℕ} (M : Count N) : + M.operator = M.spectral (fun k => k) := by + classical + calc + _ = M.operator * (∑ F ∈ M.support.powerset, M.pattern F) := by rw [M.sum_pattern,mul_one] + _ = _ := by + rw [Finset.mul_sum] + apply Finset.sum_congr rfl + intro F hF + exact M.operator_mul_pattern F (Finset.mem_powerset.mp hF) + +lemma Count.spectral_mul {N : ℕ} (M : Count N) (f g : ℕ → ℝ) : + M.spectral f * M.spectral g = M.spectral (fun k => f k * g k) := by + classical + exact orthogonal_sum_mul _ _ (fun F _ => M.pattern_projection F) + (fun F hF G hG hFG => by + rw [M.pattern_mul (Finset.mem_powerset.mp hF) (Finset.mem_powerset.mp hG),ite_eq_right hFG]) _ _ + +lemma Count.operator_pow_spectral {N : ℕ} (M : Count N) (k : ℕ) : + M.operator^k = M.spectral (fun j => (j:ℝ)^k) := by + induction k with + | zero => simp [Count.spectral] + | succ k ih => rw [pow_succ,ih,M.operator_spectral,M.spectral_mul]; simp only [pow_succ] + +lemma Count.operator_norm_le {N : ℕ} (M : Count N) : ‖M.operator‖ ≤ N := by + rw [M.operator_spectral] + exact M.spectral_norm_le _ (by positivity) (fun k hk => by simpa using (show (k:ℝ) ≤ N by exact_mod_cast hk)) + +/-- Evaluate a real polynomial using the explicit integer spectral decomposition. -/ +def Count.polynomial {N : ℕ} (M : Count N) (p : Polynomial ℝ) : Operator N := + M.spectral (fun k => p.eval (k:ℝ)) + +lemma Count.polynomial_eq_sum {N : ℕ} (M : Count N) (p : Polynomial ℝ) : + M.polynomial p = ∑ k ∈ p.support, p.coeff k • M.operator^k := by + classical + unfold Count.polynomial Count.spectral + simp_rw [Polynomial.eval_eq_sum, Polynomial.sum, Finset.sum_smul, mul_smul] + rw [Finset.sum_comm] + apply Finset.sum_congr rfl + intro k _ + rw [← Finset.smul_sum] + change p.coeff k • M.spectral (fun j => (j:ℝ)^k) = _ + rw [← M.operator_pow_spectral] + +lemma Count.generator_eq_restrict {N : ℕ} (M : Count N) (i : Fin N) (hi : i ∈ M.support) : + tensorMatrix (fun j => if j = i then 1-rankOne (M.vector i) else 1) = + ((M.flip M.support).restrict {i}).zero := by + classical + dsimp only [Count.zero, Count.restrict, Count.flip] + congr 1 + funext j + by_cases hji : j = i + · subst j + simp only [Finset.mem_inter, Finset.mem_singleton, hi, true_and, ite_true] + exact (rankOne_orthogonalVector (M.normalized i hi)).symm + · simp [hji] + +/-- Ordered monomials, retaining multiplicities, with repeated coordinates collapsed. -/ +def selectionSets {ι : Type*} [DecidableEq ι] (S : Finset ι) : ℕ → List (Finset ι) + | 0 => [∅] + | k+1 => S.toList.flatMap (fun i => (selectionSets S k).map (insert i)) + +lemma selectionSets_card {ι : Type*} [DecidableEq ι] (S : Finset ι) (k : ℕ) : + ∀ F ∈ selectionSets S k, F.card ≤ k := by + induction k with + | zero => intro F hF; simpa [selectionSets] using hF + | succ k ih => + intro F hF + obtain ⟨i, _, hFi⟩ := List.mem_flatMap.mp hF + obtain ⟨G, hG, rfl⟩ := List.mem_map.mp hFi + exact (Finset.card_insert_le _ _).trans (Nat.add_le_add_right (ih G hG) 1) + +lemma selectionSets_length {ι : Type*} [DecidableEq ι] (S : Finset ι) (k : ℕ) : + (selectionSets S k).length = S.card^k := by + induction k with + | zero => simp [selectionSets] + | succ k ih => simp [selectionSets, List.length_flatMap, ih, pow_succ, mul_comm] + +lemma list_sum_flatMap {ι κ A : Type*} [AddMonoid A] (l : List ι) (f : ι → List κ) (g : κ → A) : + ((l.flatMap f).map g).sum = (l.map (fun i => ((f i).map g).sum)).sum := by + induction l with + | nil => simp + | cons i l ih => simp [ih] + +lemma Count.selectionSets_sum {N : ℕ} (M : Count N) (S : Finset (Fin N)) (k : ℕ) : + ((selectionSets S k).map (fun F => (M.restrict F).zero)).sum = + (∑ i ∈ S, (M.restrict {i}).zero)^k := by + classical + induction k with + | zero => simp [selectionSets,Count.zero,Count.restrict] + | succ k ih => + rw [selectionSets, list_sum_flatMap] + simp only [List.map_map] + dsimp only [Function.comp_def] + have hi : ∀ i, ((selectionSets S k).map (fun F => (M.restrict (insert i F)).zero)).sum = + (M.restrict {i}).zero * ((selectionSets S k).map (fun F => (M.restrict F).zero)).sum := by + intro i + simp_rw [← Finset.singleton_union, ← M.restrict_zero_mul] + exact List.sum_map_mul_left _ _ _ + simp_rw [hi,ih] + rw [List.sum_map_mul_right, ← List.sum_toFinset _ S.nodup_toList, Finset.toList_toFinset, pow_succ'] + +lemma Count.operator_monomials {N : ℕ} (M : Count N) (k : ℕ) : + M.operator^k = ((selectionSets M.support k).map + (fun F => ((M.flip M.support).restrict F).zero)).sum := by + rw [(M.flip M.support).selectionSets_sum] + congr 1 + unfold Count.operator + apply Finset.sum_congr rfl + intro i hi + exact M.generator_eq_restrict i hi + +lemma list_norm_sum_le {A : Type*} [SeminormedAddCommGroup A] (l : List A) : + ‖l.sum‖ ≤ (l.map norm).sum := by + induction l with + | nil => simp + | cons a l ih => + simp only [List.sum_cons,List.map_cons] + exact (norm_add_le _ _).trans (add_le_add le_rfl ih) + +lemma list_norm_sum_le_const {ι A : Type*} [SeminormedAddCommGroup A] + (l : List ι) (f : ι → A) (C : ℝ) (hf : ∀ i ∈ l, ‖f i‖ ≤ C) : + ‖(l.map f).sum‖ ≤ l.length * C := by + apply (list_norm_sum_le _).trans + rw [List.map_map] + have h := List.sum_le_length_nsmul (l.map (norm ∘ f)) C (by + intro c hc + obtain ⟨i,hi,rfl⟩ := List.mem_map.mp hc + exact hf i hi) + simpa only [List.length_map, nsmul_eq_mul] using h + + +lemma Count.zero_spectral {N : ℕ} (M : Count N) : + M.zero = M.spectral (fun k => if k = 0 then 1 else 0) := by + classical + unfold Count.spectral + rw [Finset.sum_eq_single ∅] + · simp + · intro F _ hF + simp only [Finset.card_eq_zero, ite_eq_right hF, zero_smul] + · simp + +lemma Count.high_spectral {N : ℕ} (M : Count N) (r : ℝ) : + M.high r = M.spectral (fun k => if r ≤ (k:ℝ) then 1 else 0) := by + unfold Count.high Count.spectral + apply Finset.sum_congr rfl + intro F _ + split_ifs with h <;> simp only [h, ite_true, ite_false, one_smul, zero_smul] + +lemma Count.low_spectral {N : ℕ} (M : Count N) (r : ℝ) : + M.low r = M.spectral (fun k => if (k:ℝ) < r then 1 else 0) := by + classical + rw [M.low_eq_sum, Finset.sum_filter] + apply Finset.sum_congr rfl + intro F _ + split_ifs with h <;> simp only [h, ite_true, ite_false, one_smul, zero_smul] + +lemma Count.spectral_sub {N : ℕ} (M : Count N) (f g : ℕ → ℝ) : + M.spectral f - M.spectral g = M.spectral (fun k => f k - g k) := by + simp only [Count.spectral, sub_smul, Finset.sum_sub_distrib] + +lemma Count.polynomial_error_low {N : ℕ} (M : Count N) (p : Polynomial ℝ) + {r δ : ℝ} (hδ : 0 ≤ δ) (hp0 : p.eval 0 = 1) + (hp : ∀ k : ℕ, 1 ≤ k → (k:ℝ) < r → |p.eval (k:ℝ)| ≤ δ) : + ‖(M.zero - M.polynomial p) * M.low r‖ ≤ δ := by + rw [M.zero_spectral, Count.polynomial, M.spectral_sub, M.low_spectral, M.spectral_mul] + apply M.spectral_norm_le (fun k => ((if k = 0 then 1 else 0) - p.eval (k:ℝ)) * + (if (k:ℝ) < r then 1 else 0)) hδ + intro k _ + by_cases hk : k = 0 + · subst k; simpa [hp0] using hδ + · by_cases hkr : (k:ℝ) < r + · simpa [hk,hkr] using hp k (by omega) hkr + · simpa [hkr] using hδ + +end QAC + +end + +end OAI diff --git a/lean/OAI/InformationTheory/QuantumCircuit/SpectralIdentities.lean b/lean/OAI/InformationTheory/QuantumCircuit/SpectralIdentities.lean new file mode 100644 index 0000000000000000000000000000000000000000..fb8cdd7878e1a315011154aa5e8b8de7b3b524d2 --- /dev/null +++ b/lean/OAI/InformationTheory/QuantumCircuit/SpectralIdentities.lean @@ -0,0 +1,49 @@ +import OAI.InformationTheory.QuantumCircuit.Degree + +namespace OAI + +/-! Finite Pauli expansions and spectral identities in product bases. -/ + +noncomputable section +open scoped BigOperators Matrix.Norms.L2Operator + +namespace QAC + +structure LocalExpansionTerm (N : ℕ) where + coeff : ℂ + gates : LocalLayer N + support : Finset (Fin N) + outside : ∀ i ∉ support, gates i = 1 + +def LocalExpansionTerm.value {N : ℕ} (t : LocalExpansionTerm N) : Operator N := + t.coeff • localMatrix t.gates + +def PublishedPauliExpansion : Prop := + ∀ (N ell : ℕ), 1 ≤ N → ∀ (E : Operator N), HasDegreeLE E (ell : ℝ) → + ∃ terms : List (LocalExpansionTerm N), + E = (terms.map LocalExpansionTerm.value).sum ∧ + (∀ t ∈ terms, t.support.card ≤ ell) ∧ + (terms.map (fun t => ‖t.coeff‖)).sum ≤ + ((ell + 1 : ℕ) : ℝ) * (3 * N : ℝ) ^ ell * ‖E‖ + +structure PublishedProductSpectralResolution : Prop where + restriction : ∀ {N : ℕ} (M : Count N) (J : Finset (Fin N)) (r : ℝ), + (M.restrict J).high r = ∑ F ∈ M.support.powerset, + if r ≤ ((F ∩ J).card : ℝ) then M.pattern F else 0 + pythagoras : ∀ {N : ℕ} {ι : Type} (s : Finset ι) (P : ι → Operator N) + (ψ : State N), + (∀ i ∈ s, IsStarProjection (P i)) → + (∀ i ∈ s, ∀ j ∈ s, i ≠ j → P i * P j = 0) → + ‖act (∑ i ∈ s, P i) ψ‖ ^ 2 = ∑ i ∈ s, ‖act (P i) ψ‖ ^ 2 + + restriction_moment : ∀ {N : ℕ} (M : Count N) (J : Finset (Fin N)) (ψ : State N), + (∑ F ∈ (M.restrict J).support.powerset, + (F.card : ℝ) * ‖act ((M.restrict J).pattern F) ψ‖^2) = + ∑ F ∈ M.support.powerset, + ((F ∩ J).card : ℝ) * ‖act (M.pattern F) ψ‖^2 + +end QAC + +end + +end OAI diff --git a/lean/OAI/InformationTheory/QuantumCircuit/Toffoli.lean b/lean/OAI/InformationTheory/QuantumCircuit/Toffoli.lean new file mode 100644 index 0000000000000000000000000000000000000000..e355f92a88588f1125a078c356f697bf1cb25276 --- /dev/null +++ b/lean/OAI/InformationTheory/QuantumCircuit/Toffoli.lean @@ -0,0 +1,130 @@ +import OAI.InformationTheory.QuantumCircuit.Reflection + +namespace OAI + +noncomputable section +open scoped BigOperators Matrix.Norms.L2Operator Topology +open Matrix Polynomial Filter Asymptotics + +namespace QAC + +/-- Computational basis vectors and the normalized minus vector. -/ +def basisVector (b : Bit) : Bit → ℂ := fun x => if x=b then 1 else 0 + +def halfScale : ℝ := (Real.sqrt 2)⁻¹ + +lemma halfScale_sq : halfScale^2 = 1/2 := by + rw [halfScale,inv_pow,Real.sq_sqrt (by norm_num)] + norm_num + +lemma halfScale_nonneg : 0 ≤ halfScale := by unfold halfScale; positivity + +lemma basisVector_normalized (b : Bit) : ∑ x, Complex.normSq (basisVector b x) = 1 := by + classical + simp [basisVector] + +lemma rankOne_basis (b : Bit) (x y : Bit) : + rankOne (basisVector b) x y = if x=b ∧ y=b then 1 else 0 := by + classical + simp only [rankOne,basisVector] + split_ifs <;> simp_all + +def minusVector (b : Bit) : ℂ := if b=0 then (halfScale:ℂ) else -(halfScale:ℂ) + +lemma minusVector_normalized : ∑ b, Complex.normSq (minusVector b) = 1 := by + norm_num [Fin.sum_univ_two,minusVector,Complex.normSq_ofReal] + nlinarith only [halfScale_sq] + +lemma rankOne_minus (x y : Bit) : + rankOne minusVector x y = if x=y then (1/2:ℂ) else -(1/2:ℂ) := by + have hh : (halfScale:ℂ)^2 = 1/2 := by rw [← Complex.ofReal_pow,halfScale_sq]; norm_num + fin_cases x <;> fin_cases y <;> simp [rankOne,minusVector,← pow_two,hh] + +/-- The product projection in the exact Toffoli identity I-2 C⊗|-><-|. -/ +def toffoliCount {N : ℕ} (c : Finset (Fin N)) (t : Fin N) : Count N where + support := insert t c + vector i := if i=t then minusVector else basisVector 1 + normalized i _ := by + split_ifs + · exact minusVector_normalized + · exact basisVector_normalized 1 + +lemma toffoliCount_entry {N : ℕ} (c : Finset (Fin N)) (t : Fin N) (ht : t ∉ c) + (x y : Word N) : + (toffoliCount c t).zero x y = + if (∀ i, i ≠ t → x i=y i) ∧ (∀ i ∈ c, y i=1) then + rankOne minusVector (x t) (y t) else 0 := by + classical + let a : Fin N → QubitOperator := fun i => + if i ∈ insert t c then rankOne (if i=t then minusVector else basisVector 1) else 1 + change (∏ i, a i (x i) (y i)) = _ + have hat : a t (x t) (y t) = rankOne minusVector (x t) (y t) := by simp [a] + have hf : ∀ i, i ≠ t → a i (x i) (y i) = + if x i=y i ∧ (i ∈ c → y i=1) then 1 else 0 := by + intro i hi + by_cases hic : i ∈ c + · simp only [a,Finset.mem_insert,hic,or_true,ite_true,ite_eq_right hi,rankOne_basis,true_implies] + congr 1 + apply propext + constructor + · rintro ⟨hx,hy⟩; exact ⟨hx.trans hy.symm,hy⟩ + · rintro ⟨hxy,hy⟩; exact ⟨hxy.trans hy,hy⟩ + · simp [a,hi,hic,Matrix.one_apply] + split_ifs with h + · rw [Finset.prod_eq_single t] + · exact hat + · intro i _ hit + rw [hf i hit,ite_eq_left ⟨h.1 i hit,h.2 i⟩] + · simp + · obtain h | h := not_and_or.mp h + · push Not at h + obtain ⟨i,hit,hxy⟩ := h + exact Finset.prod_eq_zero (Finset.mem_univ i) (by rw [hf i hit]; simp [hxy]) + · push Not at h + obtain ⟨i,hic,hy⟩ := h + have hit : i ≠ t := fun h => ht (h ▸ hic) + exact Finset.prod_eq_zero (Finset.mem_univ i) (by rw [hf i hit]; simp [hic,hy]) + +lemma toffoli_reflection {N : ℕ} (c : Finset (Fin N)) (t : Fin N) (ht : t ∉ c) : + Gate.matrix (.toffoli c t ht) = reflect (toffoliCount c t) := by + classical + ext x y + change (if x=Gate.toffoliWord c t y then (1:ℂ) else 0) = + (if x=y then 1 else 0) - 2*(toffoliCount c t).zero x y + rw [toffoliCount_entry c t ht] + by_cases hctrl : ∀ i ∈ c, y i=1 + · have hw : Gate.toffoliWord c t y = Function.update y t (1-y t) := by + exact ite_eq_left hctrl + rw [hw] + by_cases hrest : ∀ i, i ≠ t → x i=y i + · have hxy : x=y ↔ x t=y t := by + constructor + · intro h; exact congrFun h t + · intro h; funext i; by_cases hi : i=t + · simpa [hi] using h + · exact hrest i hi + have hxu : x=Function.update y t (1-y t) ↔ x t=1-y t := by + constructor + · intro h; simpa using congrFun h t + · intro h; funext i; by_cases hi : i=t + · simpa [hi] using h + · simpa [Function.update_of_ne hi] using hrest i hi + have hboth : (∀ i, i ≠ t → x i=y i) ∧ (∀ i ∈ c, y i=1) := ⟨hrest,hctrl⟩ + rw [ite_eq_left hboth,rankOne_minus] + simp only [hxy,hxu] + generalize x t = a, y t = b + fin_cases a <;> fin_cases b <;> norm_num + · have hxy : x ≠ y := by intro h; apply hrest; intro i _; exact congrFun h i + have hxu : x ≠ Function.update y t (1-y t) := by + intro h; apply hrest; intro i hi + simpa [Function.update_of_ne hi] using congrFun h i + simp [hrest,hxy,hxu] + · have hw : Gate.toffoliWord c t y = y := by exact ite_eq_right hctrl + rw [hw] + simp [hctrl] + +end QAC + +end + +end OAI diff --git a/lean/OAI/InformationTheory/QuantumCircuit/Trajectory.lean b/lean/OAI/InformationTheory/QuantumCircuit/Trajectory.lean new file mode 100644 index 0000000000000000000000000000000000000000..8a1425134d85d76f3e6c84f3314369d0f83007b4 --- /dev/null +++ b/lean/OAI/InformationTheory/QuantumCircuit/Trajectory.lean @@ -0,0 +1,213 @@ +import OAI.InformationTheory.QuantumCircuit.Localization +import OAI.InformationTheory.QuantumCircuit.Physical + +namespace OAI + +/-! Excitation tails and regular trajectories of shallow quantum circuits. -/ + +noncomputable section +open scoped BigOperators Matrix.Norms.L2Operator Topology +open Filter + +namespace QAC + +abbrev State (N : ℕ) := EuclideanSpace ℂ (Word N) + +def act {N : ℕ} (A : Operator N) (ψ : State N) : State N := + Matrix.toEuclideanCLM (n := Word N) (𝕜 := ℂ) A ψ + +@[simp] lemma act_mul {N : ℕ} (A B : Operator N) (ψ : State N) : + act (A * B) ψ = act A (act B ψ) := by + simp [act, map_mul] + +@[simp] lemma act_one {N : ℕ} (ψ : State N) : act (1 : Operator N) ψ = ψ := by + simp [act] + +@[simp] lemma act_zero {N : ℕ} (ψ : State N) : act (0 : Operator N) ψ = 0 := by + simp [act] + +lemma act_add {N : ℕ} (A B : Operator N) (ψ : State N) : + act (A + B) ψ = act A ψ + act B ψ := by simp [act, map_add] + +lemma act_sub {N : ℕ} (A B : Operator N) (ψ : State N) : + act (A - B) ψ = act A ψ - act B ψ := by simp [act, map_sub] + +lemma act_norm_le {N : ℕ} (A : Operator N) (ψ : State N) : + ‖act A ψ‖ ≤ ‖A‖ * ‖ψ‖ := (Matrix.toEuclideanCLM (n := Word N) (𝕜 := ℂ) A).le_opNorm ψ + +lemma act_norm_le_of_contraction {N : ℕ} (A : Operator N) (hA : ‖A‖ ≤ 1) + (ψ : State N) : ‖act A ψ‖ ≤ ‖ψ‖ := + (act_norm_le A ψ).trans (by simpa using mul_le_mul_of_nonneg_right hA (norm_nonneg ψ)) + +lemma act_unitary_norm {N : ℕ} {U : Operator N} (hU : U ∈ unitary (Operator N)) + (ψ : State N) : ‖act U ψ‖ = ‖ψ‖ := by + apply le_antisymm + · exact act_norm_le_of_contraction U (by simpa using (CStarRing.norm_coe_unitary ⟨U, hU⟩).le) ψ + · calc + ‖ψ‖ = ‖act (star U) (act U ψ)‖ := by + rw [← act_mul, Unitary.star_mul_self_of_mem hU, act_one] + _ ≤ ‖act U ψ‖ := act_norm_le_of_contraction (star U) + (by simpa using (CStarRing.norm_coe_unitary ⟨U, hU⟩).le) _ + +lemma projection_action_tail_bound {N : ℕ} (A : Count N) (Q : Operator N) + (ψ : State N) (r R δ : ℝ) (hδ : 0 ≤ δ) (hψ : ‖ψ‖ ≤ 1) (hQ : ‖Q‖ ≤ 1) + (hloc : ‖A.high R * Q * A.low r‖ ≤ δ) + (htail : ‖act (A.high r) ψ‖ ≤ δ) : + ‖act (A.high R) (act Q ψ)‖ ≤ δ + δ := by + have hsplit : A.high R * Q = A.high R * Q * A.low r + + (A.high R * Q) * A.high r := by + dsimp [Count.low]; noncomm_ring + rw [← act_mul, hsplit, act_add] + apply (norm_add_le _ _).trans + apply add_le_add + · exact (act_norm_le _ _).trans ((mul_le_mul_of_nonneg_right hloc + (norm_nonneg _)).trans (by simpa using mul_le_mul_of_nonneg_left hψ hδ)) + · rw [act_mul] + exact (act_norm_le_of_contraction _ + (norm_mul_le_one (IsStarProjection.norm_le _ (A.high_projection R)) hQ) _).trans htail + +def HasExcitationTails (m : ℕ → ℕ) (A : ∀ ν, Count (m ν)) + (ψ : ∀ ν, State (m ν)) (b : ℝ) : Prop := + ∀ h p : ℝ, b < h → h < 1 → 0 < p → p < h → + ∀ᶠ ν in atTop, + ‖act ((A ν).high ((m ν : ℝ) ^ h)) (ψ ν)‖ ≤ Real.exp (-((m ν : ℝ) ^ p)) + +theorem excitation_tail_transport (d : ℕ) (m : ℕ → ℕ) + (hm : Tendsto m atTop atTop) (U : ∀ ν, Operator (m ν)) + (hU : ∀ ν, IsCircuit d (U ν)) (A B : ∀ ν, Count (m ν)) + (ψ : ∀ ν, State (m ν)) (hψ : ∀ ν, ‖ψ ν‖ ≤ 1) + {b : ℝ} (hb : 0 ≤ b) (htail : HasExcitationTails m A ψ b) : + HasExcitationTails m A + (fun ν => act (conjugate (U ν) (B ν).zero) (ψ ν)) b := by + intro h p hbh hh hp hph + obtain ⟨v, hv, hvh⟩ := exists_between (max_lt hbh hph) + have hbv : b < v := (le_max_left _ _).trans_lt hv + have hpv : p < v := (le_max_right _ _).trans_lt hv + obtain ⟨a, hva, hah⟩ := exists_between hvh + have ha : 0 ≤ a := hb.trans (hbv.trans hva).le + have hloc := hm.eventually (uniform_low_propagation + (fun s t hs hst => uniform_localization d s t hs hst) ha + (hp.trans hpv).le hah hvh) + have hsmall := htail a v (hbv.trans hva) (hah.trans hh) (hp.trans hpv) hva + have hcost := hm.eventually (eventually_exp_power_gap hpv hpv (hp.trans hpv) + 2 1 1 0 (by norm_num) (by norm_num)) + filter_upwards [hloc, hsmall, hcost] with ν hloc hsmall hcost + have hQ : ‖conjugate (U ν) (B ν).zero‖ ≤ 1 := IsStarProjection.norm_le _ + (conjugate_projection (hU ν).mem_unitary (B ν).zero_projection) + exact (projection_action_tail_bound (A ν) _ (ψ ν) _ _ _ (Real.exp_pos _).le + (hψ ν) hQ (hloc (U ν) (hU ν) (A ν) (B ν)) hsmall).trans + (by simpa only [zero_mul, zero_sub, one_mul, ← two_mul] using hcost) + +end QAC + +namespace QAC + +inductive AnalyticLayer (N : ℕ) where + | local (L : LocalLayer N) + | reflection (R : ReflectionLayer N) + +namespace AnalyticLayer + +def matrix {N : ℕ} : AnalyticLayer N → Operator N + | .local L => localMatrix L + | .reflection R => reflectionMatrix R + +lemma isCircuit {N : ℕ} (a : AnalyticLayer N) : IsCircuit 1 a.matrix := by + cases a with + | «local» L => exact (show IsCircuit 0 (localMatrix L) from ⟨L, rfl⟩).succ + | reflection R => + refine ⟨1, R, (fun _ => 1), ?_, ?_⟩ + · exact ⟨fun _ => 1, tensorMatrix_one.symm⟩ + · simp [matrix, localMatrix] + +end AnalyticLayer + +def evolution {N : ℕ} : List (AnalyticLayer N) → Operator N + | [] => 1 + | a :: l => evolution l * a.matrix + +lemma evolution_append {N : ℕ} (a b : List (AnalyticLayer N)) : + evolution (a ++ b) = evolution b * evolution a := by + induction a with + | nil => simp [evolution] + | cons x a ih => simp [evolution, ih, mul_assoc] + +lemma evolution_isCircuit {N : ℕ} (l : List (AnalyticLayer N)) : + IsCircuit l.length (evolution l) := by + induction l with + | nil => exact ⟨fun _ => 1, tensorMatrix_one.symm⟩ + | cons a l ih => simpa [evolution] using ih.mul a.isCircuit + +def jointTest {N : ℕ} : List (Count N) → Count N + | [] => Count.empty + | A :: l => A.join (jointTest l) + +def RegularTrajectory (m : ℕ → ℕ) (l : ∀ ν, List (AnalyticLayer (m ν))) + (ψ : ∀ ν, State (m ν)) : Prop := + ∀ b h p : ℝ, 0 ≤ b → b < h → h < 1 → 0 < p → p < h → + ∀ᶠ ν in atTop, ∀ j R, (l ν)[j]? = some (.reflection R) → + ∀ S : List (Count (m ν)), S.Sublist R.gates → (S.length : ℝ) ≤ (m ν : ℝ) ^ b → + ‖act ((jointTest S).high ((m ν : ℝ) ^ h)) + (act (evolution ((l ν).take j)) (ψ ν))‖ ≤ Real.exp (-((m ν : ℝ) ^ p)) + +def projectedInput {N : ℕ} (l : List (AnalyticLayer N)) (B : Count N) (ψ : State N) : + State N := act (star (evolution l) * B.zero * evolution l) ψ + +lemma projectedInput_at_cut {N : ℕ} (l : List (AnalyticLayer N)) + (B : Count N) (ψ : State N) (j : ℕ) : + act (evolution (l.take j)) (projectedInput l B ψ) = + act (conjugate (star (evolution (l.drop j))) B.zero) + (act (evolution (l.take j)) ψ) := by + have hU := (evolution_isCircuit (l.take j)).mem_unitary + have heq : evolution l = evolution (l.drop j) * evolution (l.take j) := by + rw [← evolution_append, List.take_append_drop] + simp only [projectedInput, ← act_mul, heq, star_mul, conjugate, star_star] + congr 1 + calc + _ = (evolution (l.take j) * star (evolution (l.take j))) * + star (evolution (l.drop j)) * B.zero * evolution (l.drop j) * + evolution (l.take j) := by noncomm_ring + _ = _ := by rw [Unitary.mul_star_self_of_mem hU, one_mul] + +theorem regular_projection_insertion (d : ℕ) (m : ℕ → ℕ) + (hm : Tendsto m atTop atTop) (l : ∀ ν, List (AnalyticLayer (m ν))) + (hl : ∀ ν, (l ν).length ≤ d) (ψ : ∀ ν, State (m ν)) + (hψ : ∀ ν, ‖ψ ν‖ ≤ 1) (hreg : RegularTrajectory m l ψ) + (B : ∀ ν, Count (m ν)) : + RegularTrajectory m l (fun ν => projectedInput (l ν) (B ν) (ψ ν)) := by + intro b h p hb hbh hh hp hph + obtain ⟨v, hv, hvh⟩ := exists_between (max_lt hbh hph) + have hbv : b < v := (le_max_left _ _).trans_lt hv + have hpv : p < v := (le_max_right _ _).trans_lt hv + obtain ⟨a, hva, hah⟩ := exists_between hvh + have ha : 0 ≤ a := hb.trans (hbv.trans hva).le + have hloc := hm.eventually (uniform_low_propagation + (fun s t hs hst => uniform_localization d s t hs hst) ha + (hp.trans hpv).le hah hvh) + have hsmall := hreg b a v hb (hbv.trans hva) (hah.trans hh) (hp.trans hpv) hva + have hcost := hm.eventually (eventually_exp_power_gap hpv hpv (hp.trans hpv) + 2 1 1 0 (by norm_num) (by norm_num)) + filter_upwards [hloc, hsmall, hcost] with ν hloc hsmall hcost + intro j R hj S hS hsize + rw [projectedInput_at_cut] + let A := jointTest S + let Q := conjugate (star (evolution ((l ν).drop j))) (B ν).zero + let ξ := act (evolution ((l ν).take j)) (ψ ν) + have hξ : ‖ξ‖ ≤ 1 := by + rw [show ‖ξ‖ = ‖ψ ν‖ from act_unitary_norm + (evolution_isCircuit ((l ν).take j)).mem_unitary _] + exact hψ ν + have hU : IsCircuit d (star (evolution ((l ν).drop j))) := + (evolution_isCircuit ((l ν).drop j)).star_mem.mono + (by simpa only [List.length_drop] using (Nat.sub_le (l ν).length j).trans (hl ν)) + have hQ : ‖Q‖ ≤ 1 := IsStarProjection.norm_le _ + (conjugate_projection hU.mem_unitary (B ν).zero_projection) + exact (projection_action_tail_bound A Q ξ _ _ _ (Real.exp_pos _).le hξ hQ + (hloc _ hU A (B ν)) (hsmall j R hj S hS hsize)).trans + (by simpa only [zero_mul, zero_sub, one_mul, ← two_mul] using hcost) + +end QAC + +end + +end OAI diff --git a/lean/OAI/InformationTheory/QuantumCircuit/Transition.lean b/lean/OAI/InformationTheory/QuantumCircuit/Transition.lean new file mode 100644 index 0000000000000000000000000000000000000000..752a73f5bb8fe9c1fb3365f95fed0f49139c23cb --- /dev/null +++ b/lean/OAI/InformationTheory/QuantumCircuit/Transition.lean @@ -0,0 +1,239 @@ +import OAI.InformationTheory.QuantumCircuit.Spectral + +namespace OAI + +noncomputable section +open scoped BigOperators Matrix.Norms.L2Operator symmDiff +open Matrix + +namespace QAC + +section NormAlgebra +variable {A : Type*} [CStarAlgebra A] + +lemma norm_unitary_conjugate {U : A} (hU : U ∈ unitary A) (B : A) : + ‖U * B * star U‖ = ‖B‖ := by + rw [CStarRing.norm_mul_mem_unitary _ (Unitary.star_mem hU), CStarRing.norm_mem_unitary_mul _ hU] + +lemma conjugate_projection {U B : A} (hU : U ∈ unitary A) (hB : IsStarProjection B) : + IsStarProjection (U * B * star U) := by + rw [isStarProjection_iff'] + constructor + · calc + _ = U * (B * B) * star U := by + simp only [mul_assoc, ← mul_assoc (star U) U, Unitary.star_mul_self_of_mem hU, one_mul] + _ = _ := by rw [hB.isIdempotentElem.eq] + · simp only [star_mul, star_star, hB.isSelfAdjoint.star_eq, mul_assoc] + +lemma projection_transition_square (H P Q X : A) + (hH : IsStarProjection H) (hP : IsStarProjection P) (hQ : IsStarProjection Q) : + ‖H * Q * P‖^2 ≤ ‖H * X * P‖ + ‖(Q-X) * P * Q‖ := by + have hid : (H*Q*P) * star (H*Q*P) = H*Q*P*Q*H := by + simp only [star_mul, hH.isSelfAdjoint.star_eq, hP.isSelfAdjoint.star_eq, + hQ.isSelfAdjoint.star_eq] + calc + _ = H * Q * (P*P) * Q * H := by simp only [mul_assoc] + _ = _ := by rw [hP.isIdempotentElem.eq] + have heq : H*Q*P*Q*H = (H*X*P)*Q*H + H*((Q-X)*P*Q)*H := by noncomm_ring + calc + ‖H*Q*P‖^2 = ‖(H*Q*P) * star (H*Q*P)‖ := by rw [CStarRing.norm_self_mul_star]; ring + _ = ‖(H*X*P)*Q*H + H*((Q-X)*P*Q)*H‖ := by rw [hid,heq] + _ ≤ ‖(H*X*P)*Q*H‖ + ‖H*((Q-X)*P*Q)*H‖ := norm_add_le _ _ + _ ≤ _ := by + apply add_le_add + · exact (norm_mul_le_left _ _ (IsStarProjection.norm_le _ hH)).trans + (norm_mul_le_left _ _ (IsStarProjection.norm_le _ hQ)) + · exact (norm_mul_le_left _ _ (IsStarProjection.norm_le _ hH)).trans + (norm_mul_le_right _ _ (IsStarProjection.norm_le _ hH)) + +lemma norm_split_bound (E W P Q : A) (hP : ‖P‖ ≤ 1) (hQ : ‖Q‖ ≤ 1) : + ‖E*P*Q‖ ≤ ‖E*(1-W)‖ + ‖E‖*‖W*P*Q‖ := by + have heq : E*P*Q = E*(1-W)*P*Q + E*(W*P*Q) := by noncomm_ring + rw [heq] + exact (norm_add_le _ _).trans (add_le_add + ((norm_mul_le_left _ _ hQ).trans (norm_mul_le_left _ _ hP)) (norm_mul_le _ _)) +end NormAlgebra + + +lemma sum_powers_bound (N K : ℕ) (hN : 1 ≤ N) : + ∑ k ∈ Finset.range K, N^k ≤ (N+1)^K := by + induction K with + | zero => simp + | succ K ih => + rw [Finset.sum_range_succ, pow_succ] + have hpow : N^K ≤ (N+1)^K := Nat.pow_le_pow_left (by omega) _ + have hmul : (N+1)^K ≤ (N+1)^K*N := by + simpa only [mul_one] using Nat.mul_le_mul_left ((N+1)^K) hN + nlinarith only [ih, hpow, hmul] + +lemma low_patterns_card {N : ℕ} (S : Finset (Fin N)) {r : ℝ} (hN : 1 ≤ N) : + (S.powerset.filter (fun F => (F.card:ℝ) < r)).card ≤ (N+1)^(⌈r⌉₊+1) := by + classical + have hsub : S.powerset.filter (fun F => (F.card:ℝ) < r) ⊆ + (Finset.range (⌈r⌉₊+1)).biUnion (fun k => S.powersetCard k) := by + intro F hF + obtain ⟨hFS, hFr⟩ := Finset.mem_filter.mp hF + refine Finset.mem_biUnion.mpr ⟨F.card, ?_, Finset.mem_powersetCard.mpr ⟨Finset.mem_powerset.mp hFS,rfl⟩⟩ + rw [Finset.mem_range] + have h : (F.card:ℝ) ≤ ⌈r⌉₊ := hFr.le.trans (Nat.le_ceil r) + have : F.card ≤ ⌈r⌉₊ := by exact_mod_cast h + omega + calc + _ ≤ ((Finset.range (⌈r⌉₊+1)).biUnion (fun k => S.powersetCard k)).card := Finset.card_le_card hsub + _ ≤ ∑ k ∈ Finset.range (⌈r⌉₊+1), (S.powersetCard k).card := Finset.card_biUnion_le + _ ≤ ∑ k ∈ Finset.range (⌈r⌉₊+1), N^k := by + apply Finset.sum_le_sum + intro k _ + rw [Finset.card_powersetCard] + exact (Nat.choose_le_pow _ _).trans (Nat.pow_le_pow_left (by simpa using Finset.card_le_univ S) _) + _ ≤ _ := sum_powers_bound N _ hN + +lemma list_disjoint_hits_length {ι κ : Type*} [DecidableEq κ] + (f : ι → Finset κ) (l : List ι) (hl : l.Pairwise (fun a b => Disjoint (f a) (f b))) + (S : Finset κ) (hS : ∀ a ∈ l, (f a ∩ S).Nonempty) : l.length ≤ S.card := by + induction l generalizing S with + | nil => simp + | cons a l ih => + obtain ⟨ha,hl⟩ := List.pairwise_cons.mp hl + obtain ⟨i,hi⟩ := hS a (List.mem_cons_self ..) + obtain ⟨hia,hiS⟩ := Finset.mem_inter.mp hi + have hh : ∀ b ∈ l, (f b ∩ S.erase i).Nonempty := by + intro b hb + obtain ⟨j,hj⟩ := hS b (List.mem_cons_of_mem _ hb) + obtain ⟨hjb,hjS⟩ := Finset.mem_inter.mp hj + have hji : j ≠ i := by + intro h + subst j + exact Finset.disjoint_left.mp (ha b hb) hia hjb + exact ⟨j,Finset.mem_inter.mpr ⟨hjb,Finset.mem_erase.mpr ⟨hji,hjS⟩⟩⟩ + have h := ih hl (S.erase i) hh + simp only [List.length_cons] + have hc := Finset.card_erase_add_one hiS + omega + +/-- Scalar list estimates retain multiplicities, including the ordered monomials. -/ +lemma norm_list_smul_sum {ι A : Type*} [SeminormedAddCommGroup A] [NormedSpace ℝ A] + (l : List ι) (c : ι → ℝ) (f : ι → A) (δ : ℝ) (hf : ∀ i ∈ l, ‖f i‖ ≤ δ) : + ‖(l.map (fun i => c i • f i)).sum‖ ≤ (l.map (fun i => |c i|)).sum * δ := by + induction l with + | nil => simp + | cons i l ih => + simp only [List.map_cons,List.sum_cons,add_mul] + apply (norm_add_le _ _).trans + apply add_le_add + · rw [norm_smul,Real.norm_eq_abs] + exact mul_le_mul_of_nonneg_left (hf i (List.mem_cons_self ..)) (abs_nonneg _) + · exact ih (fun j hj => hf j (List.mem_cons_of_mem _ hj)) + + +lemma Count.low_propagation_bound {N : ℕ} (M : Count N) (B : Operator N) + {r q R δ : ℝ} (hN : 1 ≤ N) (hδ : 0 ≤ δ) (hrq : q + r ≤ R) + (hB : ∀ K : Count N, ‖K.high q * B * K.zero‖ ≤ δ) : + ‖M.high R * B * M.low r‖ ≤ (N+1:ℝ)^(⌈r⌉₊+1) * δ := by + classical + rw [M.low_eq_sum, Finset.mul_sum] + apply (norm_sum_le _ _).trans + calc + _ ≤ ∑ F ∈ M.support.powerset.filter (fun F => (F.card:ℝ) < r), δ := by + apply Finset.sum_le_sum + intro F hF + obtain ⟨hFs, hFr⟩ := Finset.mem_filter.mp hF + exact (M.high_flip_norm F (Finset.mem_powerset.mp hFs) + (by linarith) B).trans (hB (M.flip F)) + _ = ((M.support.powerset.filter (fun F => (F.card:ℝ) < r)).card:ℝ)*δ := by simp + _ ≤ _ := mul_le_mul_of_nonneg_right (by exact_mod_cast low_patterns_card M.support (r:=r) hN) hδ + +lemma norm_mul_le_one {A : Type*} [NormedRing A] {x y : A} + (hx : ‖x‖ ≤ 1) (hy : ‖y‖ ≤ 1) : ‖x*y‖ ≤ 1 := + (norm_mul_le_left _ _ hy).trans hx + +section ThreeFactors +variable {A : Type*} [CStarAlgebra A] + +lemma three_factor_transition (H P H₁ H₂ B₁ B₂ B₃ : A) {δ : ℝ} + (hH : ‖H‖ ≤ 1) (hP : ‖P‖ ≤ 1) + (hE₁ : ‖1-H₁‖ ≤ 1) + (hB₁ : ‖B₁‖ ≤ 1) (hB₂ : ‖B₂‖ ≤ 1) (hB₃ : ‖B₃‖ ≤ 1) + (h₁ : ‖H₁*B₃*P‖ ≤ δ) (h₂ : ‖H₂*B₂*(1-H₁)‖ ≤ δ) + (h₃ : ‖H*B₁*(1-H₂)‖ ≤ δ) : ‖H*B₁*B₂*B₃*P‖ ≤ 3*δ := by + have heq : H*B₁*B₂*B₃*P = (H*B₁*B₂)*(H₁*B₃*P) + + (H*B₁)*(H₂*B₂*(1-H₁))*(B₃*P) + + (H*B₁*(1-H₂))*(B₂*(1-H₁)*B₃*P) := by noncomm_ring + have ht₁ : ‖(H*B₁*B₂)*(H₁*B₃*P)‖ ≤ δ := + (norm_mul_le_right _ _ (norm_mul_le_one (norm_mul_le_one hH hB₁) hB₂)).trans h₁ + have ht₂ : ‖(H*B₁)*(H₂*B₂*(1-H₁))*(B₃*P)‖ ≤ δ := + ((norm_mul_le_left _ _ (norm_mul_le_one hB₃ hP)).trans + (norm_mul_le_right _ _ (norm_mul_le_one hH hB₁))).trans h₂ + have ht₃ : ‖(H*B₁*(1-H₂))*(B₂*(1-H₁)*B₃*P)‖ ≤ δ := + (norm_mul_le_left _ _ (norm_mul_le_one (norm_mul_le_one + (norm_mul_le_one hB₂ hE₁) hB₃) hP)).trans h₃ + rw [heq] + exact (norm_add_le _ _).trans ((add_le_add (norm_add_le _ _) le_rfl).trans + (by linarith only [ht₁,ht₂,ht₃])) +end ThreeFactors + + +section Conjugation +variable {A : Type*} [CStarAlgebra A] + +def conjugate (U B : A) : A := U*B*star U + +lemma conjugate_comp (U V B : A) : conjugate (U*V) B = conjugate U (conjugate V B) := by + simp only [conjugate,star_mul,mul_assoc] + +lemma conjugate_mul {U : A} (hU : U ∈ unitary A) (B C : A) : + conjugate U (B*C) = conjugate U B * conjugate U C := by + simp only [conjugate,mul_assoc,← mul_assoc (star U) U,Unitary.star_mul_self_of_mem hU,one_mul] + +lemma conjugate_star (U B : A) : conjugate U (star B) = star (conjugate U B) := by + simp only [conjugate,star_mul,star_star,mul_assoc] + +lemma conjugate_sub (U B C : A) : conjugate U (B-C) = conjugate U B - conjugate U C := by + simp only [conjugate,mul_sub,sub_mul] + +lemma conjugate_one {U : A} (hU : U ∈ unitary A) : conjugate U 1 = 1 := by + simp only [conjugate,mul_one,Unitary.mul_star_self_of_mem hU] + +lemma conjugate_smul (U B : A) (r : ℝ) : conjugate U (r • B) = r • conjugate U B := by + simp only [conjugate,mul_smul_comm,smul_mul_assoc] + +lemma conjugate_list_sum {ι : Type*} (U : A) (l : List ι) (f : ι → A) : + conjugate U (l.map f).sum = (l.map (fun i => conjugate U (f i))).sum := by + simp only [conjugate,← List.sum_map_mul_left,← List.sum_map_mul_right] + +lemma conjugate_fixed {U B : A} (hU : U ∈ unitary A) (h : Commute U B) : + conjugate U B = B := by + rw [conjugate,h.eq,mul_assoc,Unitary.mul_star_self_of_mem hU,mul_one] + +lemma list_conjugate_filter {ι : Type*} (f : ι → A) (l : List ι) (p : ι → Bool) (B : A) + (hl : l.Pairwise (fun a b => Commute (f a) (f b))) + (hu : ∀ a ∈ l, f a ∈ unitary A) + (hd : ∀ a ∈ l, p a = false → Commute (f a) B) : + conjugate (l.map f).prod B = conjugate ((l.filter p).map f).prod B := by + induction l with + | nil => simp + | cons a l ih => + obtain ⟨ha,hl⟩ := List.pairwise_cons.mp hl + have hu' : ∀ b ∈ l, f b ∈ unitary A := fun b hb => hu b (List.mem_cons_of_mem _ hb) + have hd' : ∀ b ∈ l, p b = false → Commute (f b) B := fun b hb => hd b (List.mem_cons_of_mem _ hb) + have hc : Commute (f a) (l.map f).prod := by + apply Commute.list_prod_right + intro x hx + obtain ⟨b,hb,rfl⟩ := List.mem_map.mp hx + exact ha b hb + cases hpa : p a with + | false => + simp only [List.map_cons,List.prod_cons,List.filter_cons,hpa,Bool.false_eq_true,ite_false] + rw [hc.eq,conjugate_comp,conjugate_fixed (hu a (List.mem_cons_self ..)) + (hd a (List.mem_cons_self ..) hpa)] + exact ih hl hu' hd' + | true => + simp only [List.map_cons,List.prod_cons,List.filter_cons,hpa,ite_true,List.map_cons,List.prod_cons] + rw [conjugate_comp,conjugate_comp,ih hl hu' hd'] +end Conjugation + +end QAC + +end + +end OAI diff --git a/lean/OAI/InformationTheory/SecretKey/ChoiTransfer.lean b/lean/OAI/InformationTheory/SecretKey/ChoiTransfer.lean new file mode 100644 index 0000000000000000000000000000000000000000..c5957f97f6599ac08c68ef874ea57856d31129f2 --- /dev/null +++ b/lean/OAI/InformationTheory/SecretKey/ChoiTransfer.lean @@ -0,0 +1,89 @@ +import OAI.InformationTheory.SecretKey.MatrixBasics +import OAI.Analysis.Quantum.PPTSquare.TensorPositivity + +namespace OAI + +noncomputable section +open Matrix +open scoped BigOperators ComplexOrder MatrixOrder Kronecker + +namespace ZeroKey.ChoiTransfer + +def sharp {a b : ℕ} (F : ChannelCompletion.Map (Fin a) (Fin b)) : + Mat b →ₗ[ℂ] Mat a := + ChannelCompletion.transposeMap.comp + ((TensorCriterion.hsAdjoint F).comp ChannelCompletion.transposeMap) + +def omega (b : ℕ) : Fin b × Fin b → ℂ := + fun i => if i.1 = i.2 then 1 else 0 + +def PublishedTransfer {a b c : ℕ} + (F : ChannelCompletion.Map (Fin a) (Fin b)) + (G : ChannelCompletion.Map (Fin b) (Fin c)) : Prop := + ChannelCompletion.choi (G.comp F) = + tensorMap (sharp F) G (outer (omega b) (omega b)) + +def PublishedPPT {a b c : ℕ} + (F : ChannelCompletion.Map (Fin a) (Fin b)) + (G : ChannelCompletion.Map (Fin b) (Fin c)) : Prop := + PPTType (sharp F) ∧ PPTType G + +lemma cp_smul {a b : ℕ} {F : Mat a →ₗ[ℂ] Mat b} + (hF : CompletelyPositive F) {s : ℂ} (hs : 0 ≤ s) : + CompletelyPositive (s • F) := by + intro k X hX + exact (hF k X hX).smul hs + +lemma ppt_smul {a b : ℕ} {F : Mat a →ₗ[ℂ] Mat b} + (hF : PPTType F) {s : ℂ} (hs : 0 ≤ s) : PPTType (s • F) := by + refine ⟨cp_smul hF.1 hs, ?_⟩ + have he : (s • F).comp (transposeLinear a) = + s • (F.comp (transposeLinear a)) := rfl + rw [he] + exact cp_smul hF.2 hs + +lemma tensorMap_smul_left {a b c d : ℕ} (F : Mat a →ₗ[ℂ] Mat b) + (G : Mat c →ₗ[ℂ] Mat d) (s : ℂ) + (X : Matrix (Fin a × Fin c) (Fin a × Fin c) ℂ) : + tensorMap (s • F) G X = s • tensorMap F G X := by + ext i j + simp only [tensorMap, LinearMap.smul_apply, Matrix.smul_apply, smul_eq_mul, + Finset.mul_sum] + apply Finset.sum_congr rfl + intro x _ + apply Finset.sum_congr rfl + intro y _ + apply Finset.sum_congr rfl + intro z _ + apply Finset.sum_congr rfl + intro w _ + ring + +def normalize {a b : ℕ} (Z : Matrix (Fin a × Fin b) (Fin a × Fin b) ℂ) := + (trace Z)⁻¹ • Z + +lemma normalize_density {a b : ℕ} + {Z : Matrix (Fin a × Fin b) (Fin a × Fin b) ℂ} + (hZ : Z.PosSemidef) (hne : Z ≠ 0) : Density (normalize Z) := by + have ht : trace Z ≠ 0 := fun h => hne (hZ.trace_eq_zero_iff.mp h) + refine ⟨hZ.smul (inv_nonneg.mpr hZ.trace_nonneg), ?_⟩ + simp only [normalize, Matrix.trace_smul, smul_eq_mul, inv_mul_cancel₀ ht] + +theorem normalized_inClass_conditional {a b c : ℕ} + (F : ChannelCompletion.Map (Fin a) (Fin b)) + (G : ChannelCompletion.Map (Fin b) (Fin c)) + (hPPT : PublishedPPT F G) (htransfer : PublishedTransfer F G) + (hZ : (ChannelCompletion.choi (G.comp F)).PosSemidef) + (hne : ChannelCompletion.choi (G.comp F) ≠ 0) : + InClass (normalize (ChannelCompletion.choi (G.comp F))) := by + let Z := ChannelCompletion.choi (G.comp F) + refine ⟨normalize_density hZ hne, b, b, (trace Z)⁻¹ • sharp F, G, + omega b, ppt_smul hPPT.1 (inv_nonneg.mpr hZ.trace_nonneg), hPPT.2, ?_⟩ + rw [tensorMap_smul_left, ← htransfer] + rfl + +end ZeroKey.ChoiTransfer + +end + +end OAI diff --git a/lean/OAI/InformationTheory/SecretKey/ChoiTransferProof.lean b/lean/OAI/InformationTheory/SecretKey/ChoiTransferProof.lean new file mode 100644 index 0000000000000000000000000000000000000000..23e48a4e55e4301bf48b972249a436090a73ffd4 --- /dev/null +++ b/lean/OAI/InformationTheory/SecretKey/ChoiTransferProof.lean @@ -0,0 +1,58 @@ +import OAI.InformationTheory.SecretKey.ChoiTransfer + +namespace OAI + +noncomputable section +open Matrix +open scoped BigOperators ComplexOrder MatrixOrder Kronecker + +namespace ZeroKey.ChoiTransfer + +lemma cp_of_channelCP {a b : ℕ} + {F : ChannelCompletion.Map (Fin a) (Fin b)} (hF : ChannelCompletion.CP F) : + CompletelyPositive F := by + intro k X hX + exact hF (Fin k) X hX + +lemma ppt_of_channelPPT {a b : ℕ} + {F : ChannelCompletion.Map (Fin a) (Fin b)} (hF : ChannelCompletion.PPT F) : + PPTType F := + ⟨cp_of_channelCP hF.1, + cp_of_channelCP (TensorCriterion.ppt_input_transpose hF).1⟩ + +theorem publishedPPT {a b c : ℕ} + {F : ChannelCompletion.Map (Fin a) (Fin b)} + {G : ChannelCompletion.Map (Fin b) (Fin c)} + (hF : ChannelCompletion.PPT F) (hG : ChannelCompletion.PPT G) : + PublishedPPT F G := by + refine ⟨ppt_of_channelPPT ?_, ppt_of_channelPPT hG⟩ + exact TensorCriterion.ppt_output_transpose + (TensorCriterion.ppt_input_transpose (TensorCriterion.ppt_hsAdjoint hF)) + +lemma matrixUnit_single {a : ℕ} (i j : Fin a) : + matrixUnit i j = Matrix.single i j (1 : ℂ) := by + ext x y + simp [matrixUnit, Matrix.single_apply, ite_and, eq_comm] + +lemma sharp_matrixUnit {a b : ℕ} + {F : ChannelCompletion.Map (Fin a) (Fin b)} (hF : ChannelCompletion.CP F) + (x y : Fin b) (i j : Fin a) : + sharp F (matrixUnit x y) i j = F (Matrix.single i j 1) x y := by + change TensorCriterion.hsAdjoint F (matrixUnit x y)ᵀ j i = _ + rw [matrixUnit_single, Matrix.transpose_single, TensorCriterion.hsAdjoint_single] + exact (ChannelCompletion.cp_choi hF).isHermitian.apply (i, x) (j, y) + +theorem publishedTransfer {a b c : ℕ} + (F : ChannelCompletion.Map (Fin a) (Fin b)) + (G : ChannelCompletion.Map (Fin b) (Fin c)) + (hF : ChannelCompletion.CP F) : PublishedTransfer F G := by + ext ⟨i, k⟩ ⟨j, l⟩ + change G (F (Matrix.single i j 1)) k l = _ + rw [linearMap_matrix_units_apply] + simp [tensorMap, outer, omega, ite_mul, mul_ite, sharp_matrixUnit hF] + +end ZeroKey.ChoiTransfer + +end + +end OAI diff --git a/lean/OAI/InformationTheory/SecretKey/Construction.lean b/lean/OAI/InformationTheory/SecretKey/Construction.lean new file mode 100644 index 0000000000000000000000000000000000000000..502a0c30d368bc0d2ecbecba20cb64076c923e77 --- /dev/null +++ b/lean/OAI/InformationTheory/SecretKey/Construction.lean @@ -0,0 +1,1008 @@ +import OAI.InformationTheory.SecretKey.MatrixBasics + +namespace OAI + +noncomputable section + +open Matrix + +open scoped MatrixOrder ComplexOrder Kronecker + +namespace ZeroKey + +section + +universe v1102_0 v1102_1 + +variable {σ : Type v1102_0} {ι : σ → Type v1102_1} [inst1102_0 : Fintype σ] [inst1102_1 : DecidableEq σ] + [inst1102_2 : ∀ s, Fintype (ι s)] [inst1102_3 : ∀ s, DecidableEq (ι s)] + +omit inst1102_3 in +lemma tensorPi_trace [∀ s, DecidableEq (ι s)] (A : ∀ s, Matrix (ι s) (ι s) ℂ) : + trace (tensorPi A) = ∏ s, trace (A s) := by + simp only [Matrix.trace, Matrix.diag, tensorPi] + exact (Fintype.prod_sum (fun s i => A s i i)).symm + +lemma tensorPi_trace_mul (A B : ∀ s, Matrix (ι s) (ι s) ℂ) : + trace (tensorPi A * tensorPi B) = ∏ s, trace (A s * B s) := by + rw [← tensorPi_mul, tensorPi_trace] + +lemma tensorPi_commute (A B : ∀ s, Matrix (ι s) (ι s) ℂ) + (h : ∀ s, Commute (A s) (B s)) : Commute (tensorPi A) (tensorPi B) := by + change tensorPi A * tensorPi B = tensorPi B * tensorPi A + rw [← tensorPi_mul, ← tensorPi_mul] + congr 1 + funext s + exact (h s).eq + +end + +section + +namespace Explicit + +def constructionMap : Matrix Basis Basis ℂ →ₗ[ℂ] Matrix Label Label ℂ := traceBlockMap block + +lemma contextParity_sq (t : Fin 6) : contextParity t * contextParity t = 1 := by + unfold contextParity + split <;> norm_num + +lemma contextEigenvalue_product (t : Fin 6) (a : Outcome) : + ∏ j, contextEigenvalue t a j = contextParity t := by + rw [Fin.prod_univ_three] + change signValue (ofLex a).1 * signValue (ofLex a).2 * + (contextParity t * signValue (ofLex a).1 * signValue (ofLex a).2) = _ + calc + _ = contextParity t * (signValue (ofLex a).1 * signValue (ofLex a).1) * + (signValue (ofLex a).2 * signValue (ofLex a).2) := by ring + _ = _ := by rw [signValue_sq, signValue_sq, mul_one, mul_one] + +lemma context_shared (r c : Fin 3) : + contextObservable (Fin.castAdd 3 r) c = contextObservable (Fin.natAdd 3 c) r := by + fin_cases r <;> fin_cases c <;> rfl + +theorem magic_parity (a : Fin 6 → Outcome) : + ¬∀ t s, t≠s → 0 < (Matrix.trace (contextProjection t (a t) * + contextProjection s (a s))).re := by + intro hp + have ha (r c : Fin 3) : + contextEigenvalue (Fin.castAdd 3 r) (a (Fin.castAdd 3 r)) c = + contextEigenvalue (Fin.natAdd 3 c) (a (Fin.natAdd 3 c)) r := by + have ht : Fin.castAdd 3 r ≠ Fin.natAdd 3 c := by + fin_cases r <;> fin_cases c <;> decide + have hpos := hp _ _ ht + have hn : contextProjection (Fin.castAdd 3 r) (a (Fin.castAdd 3 r)) * + contextProjection (Fin.natAdd 3 c) (a (Fin.natAdd 3 c)) ≠ 0 := by + intro hz + rw [hz, Matrix.trace_zero] at hpos + exact (lt_irrefl 0 hpos) + apply eigenvalues_agree _ _ (contextObservable (Fin.castAdd 3 r) c) _ _ + (context_eigen_right _ _ _) ?_ hn + rw [context_shared] + exact context_eigen _ _ _ + have hr : (∏ r : Fin 3, ∏ c : Fin 3, + contextEigenvalue (Fin.castAdd 3 r) (a (Fin.castAdd 3 r)) c) = 1 := by + simp only [contextEigenvalue_product] + rw [Fin.prod_univ_three] + norm_num [contextParity, Fin.ext_iff] + have hc : (∏ c : Fin 3, ∏ r : Fin 3, + contextEigenvalue (Fin.natAdd 3 c) (a (Fin.natAdd 3 c)) r) = -1 := by + simp only [contextEigenvalue_product] + rw [Fin.prod_univ_three] + norm_num [contextParity, Fin.ext_iff] + have he : (1:ℂ) = -1 := by + calc + 1 = ∏ r : Fin 3, ∏ c : Fin 3, + contextEigenvalue (Fin.castAdd 3 r) (a (Fin.castAdd 3 r)) c := hr.symm + _ = ∏ c : Fin 3, ∏ r : Fin 3, + contextEigenvalue (Fin.natAdd 3 c) (a (Fin.natAdd 3 c)) r := by + simp_rw [ha] + exact Finset.prod_comm + _ = -1 := hc + norm_num at he + +lemma sum_basis (f : Basis → ℂ) : ∑ i, f i = ∑ i : EightSet → LocalBasis, f (toLex i) := by + exact (Equiv.sum_comp (show (EightSet → LocalBasis) ≃ Basis from Equiv.refl _) f).symm + +lemma projection_trace_mul (i j : Label) : + trace (projection i * projection j) = ∏ S, trace + (localProjection S (ofLex i).1 (ofLex (ofLex i).2 S) * + localProjection S (ofLex j).1 (ofLex (ofLex j).2 S)) := by + let e : Basis ≃ (EightSet → LocalBasis) := Equiv.refl _ + let A := tensorPi (fun S => localProjection S (ofLex i).1 (ofLex (ofLex i).2 S)) + let B := tensorPi (fun S => localProjection S (ofLex j).1 (ofLex (ofLex j).2 S)) + change trace (A.submatrix e e * B.submatrix e e) = _ + rw [Matrix.submatrix_mul_equiv] + change (∑ h : Basis, (A * B) (ofLex h) (ofLex h)) = _ + rw [sum_basis] + exact tensorPi_trace_mul _ _ + +lemma projection_orthogonal (q : Question) (a b : OutcomeString) (hab : a≠b) : + projection (toLex (q,a)) * projection (toLex (q,b)) = 0 := by + have hab' : ofLex a ≠ ofLex b := by + intro h + exact hab ((show OutcomeString ≃ (EightSet → Outcome) from Equiv.refl _).injective h) + obtain ⟨S,hS⟩ := Function.ne_iff.mp hab' + ext h l + apply (projection_mul_apply (i := (toLex (q,a) : Label)) (j := (toLex (q,b) : Label)) h l).trans + apply Finset.prod_eq_zero (Finset.mem_univ S) + change (localProjection S q (ofLex a S) * localProjection S q (ofLex b S)) _ _ = 0 + rw [localProjection_orthogonal S q _ _ hS] + rfl + +universe v1803_0 + +lemma trace_product_nonneg {ι : Type v1803_0} [Fintype ι] [DecidableEq ι] + {A B : Matrix ι ι ℂ} (hA : A.PosSemidef) (hB : B.PosSemidef) : + 0 ≤ trace (A*B) := by + have hh := (hB.mul_mul_conjTranspose_same (CFC.sqrt A)).trace_nonneg + rwa [(CFC.sqrt_nonneg A).posSemidef.isHermitian.eq, trace_mul_cycle, + CFC.sqrt_mul_sqrt_self A hA.nonneg] at hh + +lemma local_trace_pos_of_global (i j : Label) + (h : 0 < (trace (projection i * projection j)).re) (S : EightSet) : + 0 < (trace (localProjection S (ofLex i).1 (ofLex (ofLex i).2 S) * + localProjection S (ofLex j).1 (ofLex (ofLex j).2 S))).re := by + have hnn := trace_product_nonneg (localProjection_projection S (ofLex i).1 (ofLex (ofLex i).2 S)).nonneg.posSemidef + (localProjection_projection S (ofLex j).1 (ofLex (ofLex j).2 S)).nonneg.posSemidef + have hn : trace (localProjection S (ofLex i).1 (ofLex (ofLex i).2 S) * + localProjection S (ofLex j).1 (ofLex (ofLex j).2 S)) ≠ 0 := by + intro hz + rw [projection_trace_mul, Finset.prod_eq_zero (Finset.mem_univ S) hz] at h + exact lt_irrefl 0 h + have hpair := RCLike.nonneg_iff.mp hnn + apply lt_of_le_of_ne hpair.1 + intro hz + apply hn + apply Complex.ext + · exact hz.symm + · exact hpair.2 + +end Explicit + +open Finset + +section BooleanFunctions + +universe v1836_0 v1836_1 + +variable {α : Type v1836_0} {𝕜 : Type v1836_1} [inst1836_0 : Fintype α] [inst1836_1 : DecidableEq α] [inst1836_2 : Field 𝕜] + +def booleanMonomial (S : Finset α) : Finset α → 𝕜 := + fun B => if S ⊆ B then 1 else 0 + +def booleanDegreeSpace (d : ℕ) : Submodule 𝕜 (Finset α → 𝕜) := + Submodule.span 𝕜 (Set.range (fun S : {S : Finset α // S.card ≤ d} => booleanMonomial S.1)) + +omit inst1836_0 in +lemma booleanMonomial_mul [Fintype α] (S T : Finset α) : + booleanMonomial (𝕜 := 𝕜) S * booleanMonomial T = booleanMonomial (S ∪ T) := by + ext B + simp only [booleanMonomial, Pi.mul_apply, Finset.union_subset_iff] + split_ifs <;> simp_all + +omit inst1836_0 in +lemma booleanMonomial_mem [Fintype α] {S : Finset α} {d : ℕ} (h : S.card ≤ d) : + booleanMonomial (𝕜 := 𝕜) S ∈ booleanDegreeSpace d := + Submodule.subset_span ⟨⟨S,h⟩, rfl⟩ + +lemma boolean_one_mem (d : ℕ) : (1 : Finset α → 𝕜) ∈ booleanDegreeSpace d := by + convert booleanMonomial_mem (α := α) (𝕜 := 𝕜) (S := ∅) (Nat.zero_le d) using 1 + ext B + simp [booleanMonomial] + +lemma boolean_mul_mem {d e : ℕ} {f g : Finset α → 𝕜} + (hf : f ∈ booleanDegreeSpace d) (hg : g ∈ booleanDegreeSpace e) : + f*g ∈ booleanDegreeSpace (d+e) := by + induction hf using Submodule.span_induction with + | mem f hf => + obtain ⟨⟨S,hS⟩,rfl⟩ := hf + induction hg using Submodule.span_induction with + | mem g hg => + obtain ⟨⟨T,hT⟩,rfl⟩ := hg + rw [booleanMonomial_mul] + exact booleanMonomial_mem ((Finset.card_union_le S T).trans (Nat.add_le_add hS hT)) + | zero => simp + | add g h _ _ hg hh => simpa only [mul_add] using Submodule.add_mem _ hg hh + | smul c g _ hg => simpa only [mul_smul_comm] using Submodule.smul_mem _ c hg + | zero => simp + | add f h _ _ hf hh => simpa only [add_mul] using Submodule.add_mem _ hf hh + | smul c f _ hf => simpa only [smul_mul_assoc] using Submodule.smul_mem _ c hf + +lemma boolean_pow_mem {f : Finset α → 𝕜} (hf : f ∈ booleanDegreeSpace 1) (n : ℕ) : + f^n ∈ booleanDegreeSpace n := by + induction n with + | zero => simpa using boolean_one_mem (α := α) (𝕜 := 𝕜) 0 + | succ n ih => simpa only [pow_succ] using boolean_mul_mem ih hf + +def intersectionSum (A : Finset α) : Finset α → 𝕜 := + ∑ h ∈ A, booleanMonomial {h} + +lemma intersectionSum_mem (A : Finset α) : + intersectionSum (𝕜 := 𝕜) A ∈ booleanDegreeSpace 1 := by + apply Submodule.sum_mem + intro h hh + exact booleanMonomial_mem (by simp) + +omit inst1836_0 in +lemma intersectionSum_apply [Fintype α] (A B : Finset α) : + intersectionSum (𝕜 := 𝕜) A B = (A ∩ B).card := by + simp only [intersectionSum, Finset.sum_apply, booleanMonomial, Finset.singleton_subset_iff] + rw [← Finset.sum_filter] + simp only [Finset.sum_const, nsmul_eq_mul, mul_one] + congr 1 + +universe v1900_0 + +lemma boolean_biorthogonal_bound {ν : Type v1900_0} [Fintype ν] [DecidableEq ν] + (f : ν → Finset α → 𝕜) (eval : ν → Finset α) + (d : ℕ) (hmem : ∀ v, f v ∈ booleanDegreeSpace d) + (heval : ∀ v w, f v (eval w) = if v=w then 1 else 0) : + Fintype.card ν ≤ Fintype.card {S : Finset α // S.card ≤ d} := by + classical + have hlin : LinearIndependent 𝕜 f := by + rw [linearIndependent_iff'] + intro S c hc v hv + have h := congrFun hc (eval v) + simpa only [Finset.sum_apply, Pi.smul_apply, smul_eq_mul, Pi.zero_apply, + heval, mul_ite, mul_one, mul_zero, Finset.sum_ite_eq', ite_eq_left hv] using h + rw [← finrank_span_eq_card hlin] + exact (Submodule.finrank_mono (Submodule.span_le.mpr (by + rintro _ ⟨v,rfl⟩ + exact hmem v))).trans (finrank_range_le_card _) + +omit inst1836_1 in +lemma card_booleanMonomials [DecidableEq α] (d : ℕ) : + Fintype.card {S : Finset α // S.card ≤ d} = + ∑ j ∈ Finset.range (d+1), Nat.choose (Fintype.card α) j := by + let e : {S : Finset α // S.card ≤ d} ≃ + (Σ j : Fin (d+1), {S : Finset α // S.card = j.val}) := + { toFun := fun S => ⟨⟨S.1.card, Nat.lt_succ_of_le S.2⟩, ⟨S.1,rfl⟩⟩ + invFun := fun S => ⟨S.2.1, by rw [S.2.2]; exact Nat.le_of_lt_succ S.1.2⟩ + left_inv := fun _ => rfl + right_inv := by rintro ⟨⟨j,hj⟩,S,hS⟩; cases hS; rfl } + rw [Fintype.card_congr e, Fintype.card_sigma] + have hc (j : ℕ) : Fintype.card {S : Finset α // S.card=j} = Nat.choose (Fintype.card α) j := by + rw [Fintype.card_of_subtype ((Finset.univ : Finset α).powersetCard j) (by + intro S + simp only [Finset.mem_powersetCard, Finset.subset_univ, true_and])] + rw [Finset.card_powersetCard, Finset.card_univ] + simp only [hc] + exact Fin.sum_univ_eq_sum_range _ _ + +end BooleanFunctions + +universe v1938_0 + +lemma modular_intersection_bound {α : Type v1938_0} [Fintype α] [DecidableEq α] + (p : ℕ) [Fact p.Prime] (F : Finset (Finset α)) + (hself : ∀ A ∈ F, ((A.card : ℕ) : ZMod p) = 0) + (hdist : ∀ A ∈ F, ∀ B ∈ F, A ≠ B → (((A ∩ B).card : ℕ) : ZMod p) ≠ 0) : + F.card ≤ ∑ j ∈ Finset.range p, Nat.choose (Fintype.card α) j := by + classical + let f : F → Finset α → ZMod p := fun A => 1 - (intersectionSum A.1)^(p-1) + have hmem (A : F) : f A ∈ booleanDegreeSpace (p-1) := + Submodule.sub_mem _ (boolean_one_mem _) (boolean_pow_mem (intersectionSum_mem A.1) _) + have heval (A B : F) : f A B.1 = if A=B then 1 else 0 := by + dsimp [f] + simp only [intersectionSum_apply] + by_cases h : A=B + · subst B + rw [ite_eq_left rfl, Finset.inter_self, hself A.1 A.2, zero_pow (by + have hp := (Fact.out : p.Prime).two_le + omega), sub_zero] + · rw [ite_eq_right h, ZMod.pow_card_sub_one_eq_one (hdist A.1 A.2 B.1 B.2 (by + exact fun he => h (Subtype.ext he))), sub_self] + have hb := boolean_biorthogonal_bound f Subtype.val (p-1) hmem heval + rw [Fintype.card_coe, card_booleanMonomials] at hb + have hp := (Fact.out : p.Prime).two_le + simpa only [Nat.sub_add_cancel (by omega : 1 ≤ p)] using hb + +end + +namespace Explicit + +lemma overlap_product (q r : Question) : + overlap q r = ∏ l, (((ofLex q l).1 ∩ (ofLex r l).1).card / (p:ℝ) - 1) := by + change Lex (Fin 3 → Base) at q r + unfold overlap vector + simp only [← Finset.prod_mul_distrib] + rw [← Fintype.prod_sum (fun l h => baseVector (ofLex q l) h * baseVector (ofLex r l) h)] + simp only [base_inner] + +lemma base_no_orthogonal_bound (F : Finset Base) + (hF : ∀ A ∈ F, ∀ B ∈ F, A ≠ B → ∑ h, baseVector A h * baseVector B h ≠ 0) : + F.card ≤ a₀ := by + let : Fact (Nat.Prime p) := ⟨by norm_num [p]⟩ + let G : Finset (Finset (Fin k)) := F.image Subtype.val + have hG := ZeroKey.modular_intersection_bound p G + have hs : ∀ A ∈ G, (A.card : ZMod p) = 0 := by + intro A hA + obtain ⟨B,hB,rfl⟩ := Finset.mem_image.mp hA + rw [B.2.1, ZMod.natCast_eq_zero_iff] + norm_num [p] + have hd : ∀ A ∈ G, ∀ B ∈ G, A ≠ B → ((A ∩ B).card : ZMod p) ≠ 0 := by + intro A hA B hB hne hz + obtain ⟨A',hA',rfl⟩ := Finset.mem_image.mp hA + obtain ⟨B',hB',rfl⟩ := Finset.mem_image.mp hB + change Base at A' B' + have hn : A' ≠ B' := fun h => hne (congrArg Subtype.val h) + have hp : 0 < (A'.1 ∩ B'.1).card := Finset.card_pos.mpr + ⟨0, Finset.mem_inter.mpr ⟨A'.2.2, B'.2.2⟩⟩ + have hl : (A'.1 ∩ B'.1).card < 514 := by + have hle := Finset.card_le_card (Finset.inter_subset_left : A'.1 ∩ B'.1 ⊆ A'.1) + rw [A'.2.1] at hle + apply lt_of_le_of_ne hle + intro he + have hab : A'.1 ⊆ B'.1 := by + have heq : A'.1 ∩ B'.1 = A'.1 := Finset.eq_of_subset_of_card_le + Finset.inter_subset_left (by rw [he, A'.2.1]) + exact Finset.inter_eq_left.mp heq + exact hne (Finset.eq_of_subset_of_card_le hab (by rw [A'.2.1,B'.2.1])) + obtain ⟨j,hj⟩ := (ZMod.natCast_eq_zero_iff _ _).mp hz + have hi : (A'.1 ∩ B'.1).card = 257 := by dsimp [p] at hj; omega + have ho := hF A' hA' B' hB' hn + rw [base_inner, hi] at ho + norm_num [p] at ho + have h := hG hs hd + have hc : G.card = F.card := Finset.card_image_of_injective _ Subtype.val_injective + rw [hc, Fintype.card_fin] at h + delta a₀ + exact h + +end Explicit + +universe v2084_0 v2084_1 + +def OrProduct {α : Type v2084_0} {β : Type v2084_1} (R : α → α → Prop) (S : β → β → Prop) : + α × β → α × β → Prop := fun x y => R x.1 y.1 ∨ S x.2 y.2 + +universe v2087_0 v2087_1 + +lemma two_fibers_clique {α : Type v2087_0} {β : Type v2087_1} [DecidableEq α] [DecidableEq β] + (R : α → α → Prop) (S : β → β → Prop) (hR : (∀ ⦃left right⦄, R left right → R right left)) + {a a' : α} (_haa : a ≠ a') (har : R a a') + (T T' : Finset β) (hT : (T : Set β).Pairwise S) (hT' : (T' : Set β).Pairwise S) : + ((T.image (fun b => (a,b)) ∪ T'.image (fun b => (a',b)) : Finset (α × β)) : Set (α × β)).Pairwise (OrProduct R S) := by + intro x hx y hy hxy + rcases Finset.mem_union.mp hx with hx | hx <;> + rcases Finset.mem_union.mp hy with hy | hy + · obtain ⟨b,hb,rfl⟩ := Finset.mem_image.mp hx + obtain ⟨c,hc,rfl⟩ := Finset.mem_image.mp hy + exact Or.inr (hT hb hc (fun h => hxy (by rw [h]))) + · obtain ⟨b,hb,rfl⟩ := Finset.mem_image.mp hx + obtain ⟨c,hc,rfl⟩ := Finset.mem_image.mp hy + exact Or.inl har + · obtain ⟨b,hb,rfl⟩ := Finset.mem_image.mp hx + obtain ⟨c,hc,rfl⟩ := Finset.mem_image.mp hy + exact Or.inl (hR har) + · obtain ⟨b,hb,rfl⟩ := Finset.mem_image.mp hx + obtain ⟨c,hc,rfl⟩ := Finset.mem_image.mp hy + exact Or.inr (hT' hb hc (fun h => hxy (by rw [h]))) + +universe v2109_0 v2109_1 + +lemma rich_fiber_bound {α : Type v2109_0} {β : Type v2109_1} [Fintype α] [Fintype β] + [DecidableEq α] [DecidableEq β] + (R : α → α → Prop) (S : β → β → Prop) (hR : (∀ ⦃left right⦄, R left right → R right left)) + (a b r : ℕ) + (hA : ∀ F : Finset α, (∀ x ∈ F, ∀ y ∈ F, x ≠ y → ¬R x y) → F.card ≤ a) + (hB : ∀ F : Finset β, (¬∃ T ⊆ F, T.card=r ∧ (T : Set β).Pairwise S) → F.card ≤ b) + (F : Finset (α × β)) + (hF : ¬∃ T ⊆ F, T.card=2*r ∧ (T : Set (α × β)).Pairwise (OrProduct R S)) : + F.card ≤ a * Fintype.card β + b * Fintype.card α := by + classical + let fiber (x : α) : Finset β := Finset.univ.filter (fun y => (x,y) ∈ F) + let rich : Finset α := Finset.univ.filter (fun x => ∃ T ⊆ fiber x, T.card=r ∧ (T : Set β).Pairwise S) + have hrich : rich.card ≤ a := by + apply hA + intro x hx y hy hxy hrel + obtain ⟨T,hT,hTc,hTp⟩ := (Finset.mem_filter.mp hx).2 + obtain ⟨T',hT',hTc',hTp'⟩ := (Finset.mem_filter.mp hy).2 + let U := T.image (fun z => (x,z)) ∪ T'.image (fun z => (y,z)) + apply hF + refine ⟨U, ?_, ?_, two_fibers_clique R S hR hxy hrel T T' hTp hTp'⟩ + · intro z hz + rcases Finset.mem_union.mp hz with hz | hz + · obtain ⟨w,hw,rfl⟩ := Finset.mem_image.mp hz + exact (Finset.mem_filter.mp (hT hw)).2 + · obtain ⟨w,hw,rfl⟩ := Finset.mem_image.mp hz + exact (Finset.mem_filter.mp (hT' hw)).2 + · have hd : Disjoint (T.image (fun z => (x,z))) (T'.image (fun z => (y,z))) := by + rw [Finset.disjoint_left] + intro z hz hz' + obtain ⟨u,hu,heu⟩ := Finset.mem_image.mp hz + obtain ⟨v,hv,hev⟩ := Finset.mem_image.mp hz' + exact hxy (congrArg Prod.fst (heu.trans hev.symm)) + dsimp [U] + rw [Finset.card_union_of_disjoint hd, + Finset.card_image_of_injective _ (fun _ _ h => Prod.mk.inj h |>.2), + Finset.card_image_of_injective _ (fun _ _ h => Prod.mk.inj h |>.2), hTc,hTc'] + omega + have cf (x : α) : (F.filter (fun z => z.1=x)).card = (fiber x).card := by + apply Finset.card_bij (fun z _ => z.2) + · intro z hz + obtain ⟨hz,he⟩ := Finset.mem_filter.mp hz + apply Finset.mem_filter.mpr ⟨Finset.mem_univ _, ?_⟩ + simpa only [← he, Prod.eta] using hz + · intro z hz w hw he + apply Prod.ext + · exact (Finset.mem_filter.mp hz).2.trans (Finset.mem_filter.mp hw).2.symm + · exact he + · intro z hz + exact ⟨(x,z), Finset.mem_filter.mpr ⟨(Finset.mem_filter.mp hz).2,rfl⟩,rfl⟩ + have hc : F.card = ∑ x, (fiber x).card := by + rw [Finset.card_eq_sum_card_fiberwise (t := Finset.univ) (f := Prod.fst) + (fun _ _ => Finset.mem_univ _)] + simp only [cf] + have hbound (x : α) : (fiber x).card ≤ (if x ∈ rich then Fintype.card β else 0)+b := by + by_cases hx : x ∈ rich + · rw [ite_eq_left hx] + exact (Finset.card_le_univ _).trans (Nat.le_add_right _ _) + · rw [ite_eq_right hx, Nat.zero_add] + apply hB + simpa only [rich, Finset.mem_filter, Finset.mem_univ, true_and] using hx + calc + F.card = ∑ x, (fiber x).card := hc + _ ≤ ∑ x, ((if x ∈ rich then Fintype.card β else 0)+b) := Finset.sum_le_sum (fun x _ => hbound x) + _ = rich.card * Fintype.card β + b * Fintype.card α := by + rw [Finset.sum_add_distrib] + simp [Nat.mul_comm] + _ ≤ a * Fintype.card β + b * Fintype.card α := Nat.add_le_add_right (Nat.mul_le_mul_right _ hrich) _ + +namespace Explicit + +section + +def BaseOrthogonal (A B : Base) : Prop := ∑ h, baseVector A h * baseVector B h = 0 + +lemma base_orthogonal_symm : (∀ ⦃left right⦄, BaseOrthogonal left right → BaseOrthogonal right left) := by + intro A B h + simpa only [BaseOrthogonal, mul_comm] using h + +lemma base_no_two_bound (F : Finset Base) + (hF : ¬∃ T ⊆ F, T.card=2 ∧ (T : Set Base).Pairwise BaseOrthogonal) : F.card ≤ a₀ := by + apply base_no_orthogonal_bound F + intro A hA B hB hne horth + apply hF + refine ⟨{A,B}, ?_, by simp [hne], ?_⟩ + · intro x hx + simp only [Finset.mem_insert, Finset.mem_singleton] at hx + rcases hx with rfl | rfl + · exact hA + · exact hB + intro x hx y hy hxy + simp only [Finset.mem_coe, Finset.mem_insert, Finset.mem_singleton] at hx hy + rcases hx with rfl | rfl <;> rcases hy with rfl | rfl + · exact (hxy rfl).elim + · exact horth + · exact base_orthogonal_symm horth + · exact (hxy rfl).elim + +lemma pair_no_four_bound (F : Finset (Base × Base)) + (hF : ¬∃ T ⊆ F, T.card=4 ∧ (T : Set (Base × Base)).Pairwise + (OrProduct BaseOrthogonal BaseOrthogonal)) : F.card ≤ 2*a₀*b := by + have h := rich_fiber_bound BaseOrthogonal BaseOrthogonal base_orthogonal_symm a₀ a₀ 2 + base_no_orthogonal_bound base_no_two_bound F hF + rw [card_base] at h + calc F.card ≤ a₀*b+a₀*b := h + _ = 2*a₀*b := by ring + +lemma triple_no_eight_bound (F : Finset (Base × (Base × Base))) + (hF : ¬∃ T ⊆ F, T.card=8 ∧ (T : Set (Base × (Base × Base))).Pairwise + (OrProduct BaseOrthogonal (OrProduct BaseOrthogonal BaseOrthogonal))) : + F.card ≤ 3*a₀*b^2 := by + have h := rich_fiber_bound BaseOrthogonal (OrProduct BaseOrthogonal BaseOrthogonal) + base_orthogonal_symm a₀ (2*a₀*b) 4 base_no_orthogonal_bound pair_no_four_bound F hF + rw [Fintype.card_prod, card_base] at h + calc F.card ≤ a₀*(b*b)+(2*a₀*b)*b := h + _ = 3*a₀*b^2 := by ring + +def questionTriple : Question ≃ Base × (Base × Base) where + toFun q := (ofLex q 0, (ofLex q 1, ofLex q 2)) + invFun t := toLex ![t.1,t.2.1,t.2.2] + left_inv q := by + change toLex ![ofLex q 0,ofLex q 1,ofLex q 2] = q + apply ofLex.injective + ext i + fin_cases i <;> rfl + right_inv t := rfl + +lemma questionTriple_apply (q : Question) : + questionTriple q = (ofLex q 0, (ofLex q 1, ofLex q 2)) := rfl + +lemma overlap_zero_iff (q r : Question) : overlap q r = 0 ↔ + OrProduct BaseOrthogonal (OrProduct BaseOrthogonal BaseOrthogonal) + (questionTriple q) (questionTriple r) := by + rw [overlap_product] + rw [questionTriple_apply, questionTriple_apply] + change _ ↔ BaseOrthogonal (ofLex q 0) (ofLex r 0) ∨ + BaseOrthogonal (ofLex q 1) (ofLex r 1) ∨ BaseOrthogonal (ofLex q 2) (ofLex r 2) + simp only [Fin.prod_univ_three, mul_eq_zero, BaseOrthogonal, base_inner, or_assoc] + +universe v2247_0 v2247_1 + +lemma no_clique_image {α : Type v2247_0} {β : Type v2247_1} [DecidableEq α] [DecidableEq β] + (e : α ≃ β) (R : α → α → Prop) (S : β → β → Prop) + (hRS : ∀ x y, R x y ↔ S (e x) (e y)) (n : ℕ) (F : Finset α) + (hF : ¬∃ T ⊆ F, T.card=n ∧ (T : Set α).Pairwise R) : + ¬∃ T ⊆ F.map e.toEmbedding, T.card=n ∧ (T : Set β).Pairwise S := by + rintro ⟨T,hT,hc,hp⟩ + apply hF + refine ⟨T.map e.symm.toEmbedding, ?_, by simpa using hc, ?_⟩ + · intro x hx + obtain ⟨y,hy,rfl⟩ := Finset.mem_map.mp hx + obtain ⟨z,hz,he⟩ := Finset.mem_map.mp (hT hy) + simpa only [← he, Equiv.toEmbedding_apply, Equiv.symm_apply_apply] using hz + · intro x hx y hy hxy + obtain ⟨u,hu,rfl⟩ := Finset.mem_map.mp hx + obtain ⟨v,hv,rfl⟩ := Finset.mem_map.mp hy + apply (hRS _ _).mpr + simpa only [Equiv.toEmbedding_apply, Equiv.apply_symm_apply] using + hp hu hv (fun he => hxy (congrArg e.symm he)) + +theorem vector_family_bound (F : Finset Question) + (hF : ¬∃ T ⊆ F, T.card=8 ∧ (T : Set Question).Pairwise (fun q r => overlap q r=0)) : + F.card ≤ 3*a₀*b^2 := by + have h := triple_no_eight_bound (F.map questionTriple.toEmbedding) + (no_clique_image questionTriple _ _ overlap_zero_iff 8 F hF) + simpa only [Finset.card_map] using h + +open Finset + +lemma vector_family_strict : (3*a₀*b^2)*K < Q := by + have h := Nat.mul_lt_mul_of_pos_right strict_parameter_bound (pow_pos b_pos 2) + delta Q + calc + (3*a₀*b^2)*K = (3*a₀*K)*b^2 := by ring + _ < b*b^2 := h + _ = b^3 := by ring + +end + +lemma projection_orthogonal_of_question_eq {i j : Label} + (hq : (ofLex i).1 = (ofLex j).1) (hij : i≠j) : projection i * projection j = 0 := by + let e : Label ≃ Question × OutcomeString := Equiv.refl _ + have ha : (ofLex i).2 ≠ (ofLex j).2 := fun hh => hij (e.injective (Prod.ext hq hh)) + have hi : (toLex ((ofLex i).1, (ofLex i).2) : Label) = i := rfl + have hj : (toLex ((ofLex i).1, (ofLex j).2) : Label) = j := e.injective (Prod.ext hq rfl) + have hh := projection_orthogonal (ofLex i).1 (ofLex i).2 (ofLex j).2 ha + rw [hi,hj] at hh + exact hh + +lemma localProjection_ordered (S : EightSet) (hS : PairwiseOrthogonal S) (t : Fin 6) : + localProjection S ((S.1.orderIsoOfFin S.2) (Fin.castLE (by decide : 6≤8) t)).1 = + contextProjection t := by + change {S : Finset Question // S.card=8} at S + funext a + unfold localProjection + rw [ite_eq_left hS, dite_eq_left ((S.1.orderIsoOfFin S.2) (Fin.castLE (by decide) t)).2] + simp only [Subtype.coe_eta, OrderIso.symm_apply_apply, Fin.val_castLE] + rw [dite_eq_left t.isLt] + +lemma clique_no_eight (J : Finset Label) + (hJ : ∀ i ∈ J, ∀ j ∈ J, i≠j → 0 < (trace (projection i * projection j)).re) : + ¬∃ T ⊆ J.image (fun i => (ofLex i).1), T.card=8 ∧ + (T : Set Question).Pairwise (fun q r => overlap q r=0) := by + rintro ⟨T,hTJ,hT,horth⟩ + let S : EightSet := ⟨T,hT⟩ + have hS : PairwiseOrthogonal S := fun q hq r hr hqr => horth hq hr hqr + let q (t : Fin 6) : Question := ((T.orderIsoOfFin hT) (Fin.castLE (by decide : 6≤8) t)).1 + have hq (t : Fin 6) : q t ∈ T := ((T.orderIsoOfFin hT) (Fin.castLE (by decide) t)).2 + have hpick (t : Fin 6) : ∃ i ∈ J, (ofLex i).1 = q t := Finset.mem_image.mp (hTJ (hq t)) + choose i hi he using hpick + let a (t : Fin 6) : Outcome := ofLex (ofLex (i t)).2 S + apply magic_parity a + intro t s hts + have hqq : q t ≠ q s := by + intro hh + have hh' := (T.orderIsoOfFin hT).injective (Subtype.ext hh) + exact hts (Fin.ext (congrArg (fun u : Fin 8 => u.val) hh')) + have hii : i t ≠ i s := fun hh => hqq (by rw [← he t, ← he s, hh]) + have hh := local_trace_pos_of_global (i t) (i s) (hJ _ (hi t) _ (hi s) hii) S + rw [he t, he s] at hh + have ht := localProjection_ordered S hS t + have hs := localProjection_ordered S hS s + change localProjection S (q t) = contextProjection t at ht + change localProjection S (q s) = contextProjection s at hs + rw [ht,hs] at hh + exact hh + +theorem projection_clique_bound (J : Finset Label) + (hJ : ∀ i ∈ J, ∀ j ∈ J, i≠j → 0 < (trace (projection i * projection j)).re) : + J.card ≤ 3*a₀*b^2 := by + have hinj : Set.InjOn (fun i : Label => (ofLex i).1) (J : Set Label) := by + intro i hi j hj he + by_contra hij + have hh := hJ i hi j hj hij + rw [projection_orthogonal_of_question_eq he hij, trace_zero] at hh + exact lt_irrefl 0 hh + have hc := vector_family_bound (J.image (fun i => (ofLex i).1)) (clique_no_eight J hJ) + rwa [Finset.card_image_of_injOn hinj] at hc + +lemma rawOutput_compression (i j : Label) : + rawOutput (i,i) (j,j) = (overlap (ofLex i).1 (ofLex j).1 : ℂ)^2 * + trace (projection i * projection j) := by + rw [rawOutput_trace] + by_cases h : overlap (ofLex i).1 (ofLex j).1 = 0 + · simp only [block, h, Complex.ofReal_zero, zero_smul, zero_mul, trace_zero, zero_pow (by decide : 2≠0)] + · have hp : (projection i * projection j) * (projection i * projection j) = + projection i * projection j := by + calc + _ = projection i * (projection j * projection i) * projection j := by noncomm_ring + _ = (projection i * projection i) * (projection j * projection j) := by + rw [← (projection_commute i j h).eq] + noncomm_ring + _ = _ := by rw [(projection_projection i).isIdempotentElem, + (projection_projection j).isIdempotentElem] + rw [block, smul_mul_smul_comm, hp, trace_smul, pow_two] + rfl + +lemma projection_idem (i : Label) : projection i * projection i = projection i := + (projection_projection i).isIdempotentElem + +lemma rawOutput_compression_trace : (∑ i, rawOutput (i,i) (i,i)) = (Q*D : ℕ) := by + simp_rw [rawOutput_crossed_diagonal, projection_idem] + rw [sum_label] + have h (q : Question) : ∑ a : OutcomeString, trace (projection (makeLabel q a)) = (D:ℂ) := by + simpa only [trace_sum, trace_one, card_basis] using congrArg Matrix.trace (projection_sum_makeLabel q) + simp only [h, Finset.sum_const, Finset.card_univ, nsmul_eq_mul, card_question, Nat.cast_mul] + +lemma rawOutput_compression_total : (∑ i, ∑ j, rawOutput (i,i) (j,j)) = + (D:ℂ) * ∑ q, ∑ r, (overlap q r : ℂ)^2 := by + simp_rw [rawOutput_compression, sum_label] + change (∑ q, ∑ a : OutcomeString, ∑ r, ∑ b : OutcomeString, + (overlap q r : ℂ)^2 * trace (projection (makeLabel q a) * projection (makeLabel r b))) = _ + conv_lhs => + arg 2; ext q + rw [Finset.sum_comm] + simp_rw [← Finset.mul_sum, sum_projection_pair_trace] + rw [Finset.mul_sum] + apply Finset.sum_congr rfl + intro q _ + rw [Finset.mul_sum] + exact Finset.sum_congr rfl (fun r _ => mul_comm _ _) + +end Explicit + +end ZeroKey + +open scoped MatrixOrder ComplexOrder Kronecker + +open Matrix + +namespace ZeroKey + +universe u + +universe v2609_0 + +def sepOuter {ι : Type v2609_0} (u v : ι → ℂ) : Matrix ι ι ℂ := + fun i j => u i * star (v j) + +variable {ι : Type u} [inst2613_0 : Fintype ι] [inst2613_1 : DecidableEq ι] + +omit inst2613_1 in +lemma normSq_sum_le_support [DecidableEq ι] (z : ι → ℂ) : + Complex.normSq (∑ i, z i) ≤ + ((Finset.univ.filter (fun i => z i ≠ 0)).card : ℝ) * ∑ i, Complex.normSq (z i) := by + classical + let S := Finset.univ.filter (fun i => z i ≠ 0) + have hs : ∑ i, z i = ∑ i ∈ S, z i := by + symm + exact Finset.sum_filter_ne_zero _ + have hn : ∑ i, Complex.normSq (z i) = ∑ i ∈ S, Complex.normSq (z i) := by + symm + apply Finset.sum_subset (Finset.filter_subset _ _) + intro i hi hnot + have hz : z i = 0 := by simpa [S] using hnot + simp [hz] + rw [hs, hn, Complex.normSq_eq_norm_sq] + have ht := norm_sum_le S z + have hc := Finset.sum_mul_sq_le_sq_mul_sq S (fun i => ‖z i‖) (fun _ => (1:ℝ)) + simp only [mul_one, one_pow, Finset.sum_const, nsmul_eq_mul, mul_one, + ← Complex.normSq_eq_norm_sq] at hc + exact (sq_le_sq₀ (norm_nonneg _) (Finset.sum_nonneg (fun _ _ => norm_nonneg _))).2 ht |>.trans + (by simpa only [mul_comm] using hc) + +universe v2637_0 + +lemma pure_decomposition_certificate {ν : Type v2637_0} [Fintype ν] (x y : ν → ι → ℂ) + (G : Matrix (ι × ι) (ι × ι) ℂ) + (hG : G = ∑ s, sepOuter (fun i => x s i.1 * y s i.2) (fun i => x s i.1 * y s i.2)) + (κ : ℕ) + (hclique : ∀ S : Finset ι, + (∀ i ∈ S, ∀ j ∈ S, i ≠ j → 0 < (G (i,j) (i,j)).re) → S.card ≤ κ) : + (∑ i, ∑ j, G (i,i) (j,j)).re ≤ (κ:ℝ) * ∑ i, (G (i,i) (i,i)).re := by + classical + let z : ν → ι → ℂ := fun s i => x s i * y s i + have hdiag (i j : ι) : (G (i,j) (i,j)).re = + ∑ s, Complex.normSq (x s i * y s j) := by + rw [hG] + simp only [Matrix.sum_apply, sepOuter, Complex.star_def, Complex.mul_conj, Complex.re_sum, Complex.ofReal_re] + have hzcard (s : ν) : (Finset.univ.filter (fun i => z s i ≠ 0)).card ≤ κ := by + apply hclique + intro i hi j hj _ + have hi' : x s i * y s i ≠ 0 := (Finset.mem_filter.mp hi).2 + have hj' : x s j * y s j ≠ 0 := (Finset.mem_filter.mp hj).2 + have hij : x s i * y s j ≠ 0 := mul_ne_zero (mul_ne_zero_iff.mp hi').1 (mul_ne_zero_iff.mp hj').2 + rw [hdiag] + exact (Complex.normSq_pos.mpr hij).trans_le + (Finset.single_le_sum (fun t _ => Complex.normSq_nonneg (x t i * y t j)) (Finset.mem_univ s)) + have hsum : (∑ i, ∑ j, G (i,i) (j,j)).re = ∑ s, Complex.normSq (∑ i, z s i) := by + have hc : (∑ i, ∑ j, G (i,i) (j,j)) = + ∑ s, (Complex.normSq (∑ i, z s i) : ℂ) := by + rw [hG] + simp only [Matrix.sum_apply, sepOuter, Complex.normSq_eq_conj_mul_self, + map_sum, Finset.sum_mul, Finset.mul_sum, z, starRingEnd_apply] + conv_lhs => rw [Finset.sum_comm]; arg 2; ext j; rw [Finset.sum_comm] + rw [Finset.sum_comm] + apply Finset.sum_congr rfl + intro s _ + rw [Finset.sum_comm] + apply Finset.sum_congr rfl + intro i _ + apply Finset.sum_congr rfl + intro j _ + ring + rw [hc, Complex.re_sum] + simp only [Complex.ofReal_re] + rw [hsum] + calc + _ ≤ ∑ s, (κ:ℝ) * ∑ i, Complex.normSq (z s i) := by + apply Finset.sum_le_sum + intro s _ + exact (normSq_sum_le_support (z s)).trans + (mul_le_mul_of_nonneg_right (by exact_mod_cast hzcard s) + (Finset.sum_nonneg (fun _ _ => Complex.normSq_nonneg _))) + _ = _ := by + simp only [← Finset.mul_sum, z, hdiag] + rw [Finset.sum_comm] + +lemma sqrt_column_decomposition (A : Matrix ι ι ℂ) (hA : A.PosSemidef) (i j : ι) : + A i j = ∑ k, (CFC.sqrt A) i k * star ((CFC.sqrt A) j k) := by + have h : A = CFC.sqrt A * (CFC.sqrt A)ᴴ := by + rw [(CFC.sqrt_nonneg A).posSemidef.isHermitian.eq] + exact (CFC.sqrt_mul_sqrt_self A hA.nonneg).symm + conv_lhs => rw [h] + simp only [Matrix.mul_apply, Matrix.conjTranspose_apply] + +lemma separable_has_pure_decomposition (G : Matrix (ι × ι) (ι × ι) ℂ) + (hG : Separable G) : + ∃ (ν : Type u) (_ : Fintype ν) (x y : ν → ι → ℂ), + G = ∑ s, sepOuter (fun i => x s i.1 * y s i.2) (fun i => x s i.1 * y s i.2) := by + classical + obtain ⟨n,A,B,hA,hB,hG⟩ := hG + refine ⟨Fin n × (ι × ι), inferInstance, + (fun s i => CFC.sqrt (A s.1) i s.2.1), + (fun s i => CFC.sqrt (B s.1) i s.2.2), ?_⟩ + rw [hG] + ext ⟨i,j⟩ ⟨k,l⟩ + simp only [Matrix.sum_apply, Matrix.kronecker_apply, Fintype.sum_prod_type, sepOuter] + apply Finset.sum_congr rfl + intro s _ + rw [sqrt_column_decomposition _ (hA s) i k, sqrt_column_decomposition _ (hB s) j l] + simp only [Finset.sum_mul, Finset.mul_sum] + rw [Finset.sum_comm] + apply Finset.sum_congr rfl + intro a _ + apply Finset.sum_congr rfl + intro b _ + simp only [star_mul] + ring + +theorem separable_support_certificate + (G : Matrix (ι × ι) (ι × ι) ℂ) (hG : Separable G) (κ : ℕ) + (hclique : ∀ S : Finset ι, + (∀ i ∈ S, ∀ j ∈ S, i ≠ j → 0 < (G (i,j) (i,j)).re) → S.card ≤ κ) : + (∑ i, ∑ j, G (i,i) (j,j)).re ≤ (κ:ℝ) * ∑ i, (G (i,i) (i,i)).re := by + obtain ⟨ν,hν,x,y,h⟩ := separable_has_pure_decomposition G hG + let := hν + exact pure_decomposition_certificate x y G h κ hclique + +theorem not_separable_of_support_certificate + (G : Matrix (ι × ι) (ι × ι) ℂ) (κ : ℕ) + (hclique : ∀ S : Finset ι, + (∀ i ∈ S, ∀ j ∈ S, i ≠ j → 0 < (G (i,j) (i,j)).re) → S.card ≤ κ) + (hgap : (κ:ℝ) * ∑ i, (G (i,i) (i,i)).re < (∑ i, ∑ j, G (i,i) (j,j)).re) : + ¬ Separable G := by + intro h + exact (not_le_of_gt hgap) (separable_support_certificate G h κ hclique) + +end ZeroKey + +open Finset + +namespace ZeroKey + +section + +universe v2749_0 v2749_1 + +variable {α : Type v2749_0} {β : Type v2749_1} [inst2749_0 : Fintype α] [inst2749_1 : Fintype β] + +lemma frame_potential_rearrange (u : α → β → ℝ) : + (∑ q, ∑ r, (∑ h, u q h * u r h)^2) = + ∑ h, ∑ l, (∑ q, u q h * u q l)^2 := by + simp only [pow_two, sum_mul, mul_sum] + conv_lhs => + arg 2; ext q + rw [sum_comm] + rw [sum_comm] + conv_lhs => + arg 2; ext h + arg 2; ext q + rw [sum_comm] + conv_lhs => + arg 2; ext h + rw [sum_comm] + apply sum_congr rfl + intro h _ + apply sum_congr rfl + intro l _ + apply sum_congr rfl + intro q _ + apply sum_congr rfl + intro r _ + ring + +theorem frame_potential_bound (u : α → β → ℝ) (hu : ∀ q, ∑ h, u q h * u q h = 1) : + (Fintype.card α : ℝ)^2 ≤ (Fintype.card β : ℝ) * + ∑ q, ∑ r, (∑ h, u q h * u r h)^2 := by + classical + have ht : ∑ h, ∑ q, u q h * u q h = (Fintype.card α : ℝ) := by + rw [sum_comm] + simp only [hu, sum_const, card_univ, nsmul_eq_mul, mul_one] + have hc := sum_mul_sq_le_sq_mul_sq univ (fun h => ∑ q, u q h * u q h) (fun _ => (1:ℝ)) + simp only [mul_one, ht, one_pow, sum_const, card_univ, nsmul_eq_mul] at hc + have hd : (∑ h, (∑ q, u q h * u q h)^2) ≤ ∑ h, ∑ l, (∑ q, u q h * u q l)^2 := by + apply sum_le_sum + intro h _ + exact single_le_sum (fun l _ => sq_nonneg (∑ q, u q h * u q l)) (mem_univ h) + rw [frame_potential_rearrange] + calc + (Fintype.card α : ℝ)^2 ≤ (Fintype.card β : ℝ) * ∑ h, (∑ q, u q h * u q h)^2 := by + simpa only [mul_comm] using hc + _ ≤ _ := mul_le_mul_of_nonneg_left hd (Nat.cast_nonneg _) + +end + +namespace Explicit + +lemma K_pos : 0 < K := by unfold K; exact pow_pos (by decide) 3 + +lemma card_vectorIndex : Fintype.card (Fin 3 → Fin k) = K := by + + rw [Fintype.card_fun, Fintype.card_fin, Fintype.card_fin] + unfold K + rfl + +theorem rawOutput_not_separable : ¬ Separable rawOutput := by + apply not_separable_of_support_certificate rawOutput (3*a₀*b^2) + · intro J hJ + exact projection_clique_bound J (by simpa only [rawOutput_crossed_diagonal] using hJ) + · let S : ℝ := ∑ q, ∑ r, (overlap q r)^2 + have hfr : (Q:ℝ)^2 ≤ (K:ℝ)*S := by + have hh := frame_potential_bound (α := Question) (β := Fin 3 → Fin k) + vector (fun q => show (∑ h, vector q h * vector q h)=1 from vector_unit q) + rw [card_question, card_vectorIndex] at hh + exact hh + have hst : ((3*a₀*b^2 : ℕ):ℝ)*(K:ℝ) < (Q:ℝ) := by + exact_mod_cast vector_family_strict + have hq : (0:ℝ) A.submatrix basisOrder basisOrder) + (block_transpose (labelOrder i) (labelOrder j)) + +lemma trace_transpose_left (A U : Mat D) : trace (A * Uᵀ) = trace (Aᵀ * U) := by + simp only [trace, Matrix.diag_apply, Matrix.mul_apply, Matrix.transpose_apply] + rw [Finset.sum_comm] + +lemma constructionMapFin_transpose : constructionMapFin.comp (transposeLinear D) = constructionMapFin := by + ext U i j + change trace (blockFin i j * Uᵀ) = trace (blockFin i j * U) + rw [trace_transpose_left, blockFin_transpose] + +lemma constructionMapFin_ppt : PPTType constructionMapFin := by + exact ⟨constructionMapFin_cp, by rw [constructionMapFin_transpose]; exact constructionMapFin_cp⟩ + +end Explicit + +universe v2984_0 v2984_1 v2984_2 v2984_3 + +variable {ι : Type v2984_0} {κ : Type v2984_1} {α : Type v2984_2} {β : Type v2984_3} [inst2984_0 : Fintype ι] [inst2984_1 : Fintype κ] [inst2984_2 : Fintype α] [inst2984_3 : Fintype β] + +lemma Separable.smul {G : Matrix (ι × κ) (ι × κ) ℂ} (hG : Separable G) + {c : ℂ} (hc : 0 ≤ c) : Separable (c • G) := by + obtain ⟨n,A,B,hA,hB,rfl⟩ := hG + refine ⟨n,fun s => c • A s,B,fun s => (hA s).smul hc,hB,?_⟩ + simp only [Finset.smul_sum, Matrix.smul_kronecker] + +lemma Separable.submatrix {G : Matrix (ι × κ) (ι × κ) ℂ} (hG : Separable G) + (f : α → ι) (g : β → κ) : + Separable (G.submatrix (Prod.map f g) (Prod.map f g)) := by + obtain ⟨n,A,B,hA,hB,rfl⟩ := hG + refine ⟨n,fun s => (A s).submatrix f f,fun s => (B s).submatrix g g, + fun s => (hA s).submatrix f,fun s => (hB s).submatrix g,?_⟩ + ext ⟨i,j⟩ ⟨k,l⟩ + simp only [Matrix.submatrix_apply, Matrix.sum_apply, Matrix.kronecker_apply, Prod.map_apply] + +end + +namespace Explicit + +lemma rawOutputFin_not_separable : ¬ Separable rawOutputFin := by + intro h + apply rawOutput_not_separable + have hh := h.submatrix labelOrder.symm labelOrder.symm + convert hh using 1 + ext ⟨i,j⟩ ⟨k,l⟩ + simp only [rawOutputFin, Matrix.submatrix_apply, Prod.map_apply, + OrderIso.apply_symm_apply] + +lemma rhoFin_not_separable : ¬ Separable rhoFin := by + intro h + apply rawOutputFin_not_separable + have hh := h.smul (Nat.cast_nonneg (α := ℂ) (Q^2*D)) + rw [rhoFin_eq, smul_smul, mul_inv_cancel₀ normalization_ne_zero, one_smul] at hh + exact hh + +lemma rhoFin_inClass : InClass rhoFin := by + refine ⟨rhoFin_density, D,D,constructionMapFin,constructionMapFin, + (fun i => ((Real.sqrt (Q^2*D : ℕ))⁻¹ : ℝ) * omegaVector i), + constructionMapFin_ppt,constructionMapFin_ppt,?_⟩ + have hc : ((((Real.sqrt (Q^2*D : ℕ))⁻¹ : ℝ) : ℂ) * + (((Real.sqrt (Q^2*D : ℕ))⁻¹ : ℝ) : ℂ)) = ((Q^2*D : ℕ) : ℂ)⁻¹ := by + rw [← Complex.ofReal_mul, ← mul_inv, Real.mul_self_sqrt (Nat.cast_nonneg _), + Complex.ofReal_inv, Complex.ofReal_natCast] + have ho : outer (fun i => ((Real.sqrt (Q^2*D : ℕ))⁻¹ : ℝ) * omegaVector i) + (fun i => ((Real.sqrt (Q^2*D : ℕ))⁻¹ : ℝ) * omegaVector i) = + ((Q^2*D : ℕ) : ℂ)⁻¹ • outer omegaVector omegaVector := by + ext i j + simp only [outer, star_mul, Complex.star_def, Complex.conj_ofReal, + Matrix.smul_apply, smul_eq_mul] + rw [← hc] + ring + rw [ho, tensorMap_smul, ← rawOutputFin_tensor, ← rhoFin_eq] + +theorem explicit_entangled_class_state : + Density rhoFin ∧ ¬ Separable rhoFin ∧ InClass rhoFin := + ⟨rhoFin_density,rhoFin_not_separable,rhoFin_inClass⟩ + +end Explicit + +end ZeroKey + +end + +end OAI diff --git a/lean/OAI/InformationTheory/SecretKey/DimensionTen.lean b/lean/OAI/InformationTheory/SecretKey/DimensionTen.lean new file mode 100644 index 0000000000000000000000000000000000000000..b4854ea09005e8e2a1b60b5b3592597a97e6cb71 --- /dev/null +++ b/lean/OAI/InformationTheory/SecretKey/DimensionTen.lean @@ -0,0 +1,77 @@ +import OAI.InformationTheory.SecretKey.Main +import OAI.InformationTheory.SecretKey.ChoiTransferProof +import OAI.Analysis.Quantum.DimensionTen.Channel +import OAI.InformationTheory.SecretKey.DimensionTenModel + +namespace OAI + +/-! Key separation for the dimension-ten state in the finite terminal-readout model. -/ + +noncomputable section +open Matrix +open scoped ComplexOrder MatrixOrder + +namespace ZeroKey.TenDimensional + +universe u + +lemma rho_density : Density rho := DimensionTen.rho_density + +lemma trace_ne_zero : trace DimensionTen.compositeChoi ≠ 0 := + DimensionTen.compositeChoi_trace_ne + +lemma rho_not_separable : ¬ Separable rho := DimensionTen.rho_entangled + +lemma rho_productfree : + ∀ u v : Fin 10 → ℂ, ∀ w : Fin 10 × Fin 10 → ℂ, + rho *ᵥ w = DimensionTen.productVector u v → u = 0 ∨ v = 0 := + DimensionTen.rho_productfree + +def TransferInput : Prop := + ChoiTransfer.PublishedTransfer DimensionTen.phiOneLinear DimensionTen.phiTwoLinear + +def PPTInput : Prop := + ChoiTransfer.PublishedPPT DimensionTen.phiOneLinear DimensionTen.phiTwoLinear + +lemma rho_inClass_conditional (hppt : PPTInput) (htransfer : TransferInput) : + InClass rho := by + have h := ChoiTransfer.normalized_inClass_conditional + DimensionTen.phiOneLinear DimensionTen.phiTwoLinear hppt htransfer + rw [DimensionTen.linear_composite_choi] at h + exact h DimensionTen.compositeChoi_posSemidef DimensionTen.compositeChoi_ne + +theorem main_state_conditional (hppt : PPTInput) (htransfer : TransferInput) : + MainClaim.{u} := by + have hc := rho_inClass_conditional hppt htransfer + exact ⟨rho_density, rho_not_separable, rho_productfree, + class_distillableSecretKey_zero rho rho_density hc, + class_uniformProtocolGap rho rho_density hc, + class_uniformCompletedGap rho rho_density hc⟩ + +end ZeroKey.TenDimensional + +noncomputable section + +namespace ZeroKey.TenDimensional + +universe u + +theorem pptInput : PPTInput := + ChoiTransfer.publishedPPT DimensionTen.phiOneLinear_ppt DimensionTen.phiTwoLinear_ppt + +theorem transferInput : TransferInput := + ChoiTransfer.publishedTransfer DimensionTen.phiOneLinear DimensionTen.phiTwoLinear + DimensionTen.phiOneLinear_cp + +theorem rho_inClass : InClass rho := + rho_inClass_conditional pptInput transferInput + +theorem main_state : MainClaim.{u} := + main_state_conditional pptInput transferInput + +end ZeroKey.TenDimensional + +end +end + +end OAI diff --git a/lean/OAI/InformationTheory/SecretKey/DimensionTenModel.lean b/lean/OAI/InformationTheory/SecretKey/DimensionTenModel.lean new file mode 100644 index 0000000000000000000000000000000000000000..d4199617303ce15359b8423cbe52362fa7cb3820 --- /dev/null +++ b/lean/OAI/InformationTheory/SecretKey/DimensionTenModel.lean @@ -0,0 +1,29 @@ +import OAI.InformationTheory.SecretKey.Model +import OAI.InformationTheory.DimensionTen.StateDensity + +namespace OAI + +/-! The normalized Choi state and key separation in the finite terminal-readout model. -/ + +noncomputable section +open Matrix + +namespace ZeroKey.TenDimensional + +universe u + +def rho : Matrix (Fin 10 × Fin 10) (Fin 10 × Fin 10) ℂ := + DimensionTen.rho + +def MainClaim : Prop := + ∃ hR : Density rho, ¬ Separable rho ∧ + (∀ u v : Fin 10 → ℂ, ∀ w : Fin 10 × Fin 10 → ℂ, + rho *ᵥ w = DimensionTen.productVector u v → u = 0 ∨ v = 0) ∧ + distillableSecretKey.{u} rho hR = 0 ∧ + UniformProtocolGap.{u} rho hR ∧ UniformCompletedGap.{u} rho hR + +end ZeroKey.TenDimensional + +end + +end OAI diff --git a/lean/OAI/InformationTheory/SecretKey/Discussion.lean b/lean/OAI/InformationTheory/SecretKey/Discussion.lean new file mode 100644 index 0000000000000000000000000000000000000000..4213657477f4d65764d79a2ec8817019e31a25a4 --- /dev/null +++ b/lean/OAI/InformationTheory/SecretKey/Discussion.lean @@ -0,0 +1,292 @@ +import OAI.InformationTheory.SecretKey.MatrixMeasure + +namespace OAI + +noncomputable section + +namespace ZeroKey + +section + +open Matrix MeasureTheory ProbabilityTheory + +open scoped ComplexOrder MatrixOrder Matrix.Norms.L2Operator Kronecker + +open UnrestrictedQuantum + +universe v5690_0 v5690_1 v5690_2 v5690_3 v5690_4 v5690_5 + +variable {O : Type v5690_0} {M : Type v5690_1} {ι : Type v5690_2} {η : Type v5690_3} [inst5690_0 : MeasurableSpace O] [inst5690_1 : MeasurableSpace M] + [inst5690_2 : Fintype ι] [inst5690_3 : Fintype η] [inst5690_4 : DecidableEq ι] [inst5690_5 : DecidableEq η] + {A : ℕ → Type v5690_4} {B : ℕ → Type v5690_5} + [inst5690_6 : ∀ n, AddCommGroup (A n)] [inst5690_7 : ∀ n, Module ℂ (A n)] [inst5690_8 : ∀ n, One (A n)] [inst5690_9 : ∀ n, LE (A n)] + [inst5690_10 : ∀ n, AddCommGroup (B n)] [inst5690_11 : ∀ n, Module ℂ (B n)] [inst5690_12 : ∀ n, One (B n)] [inst5690_13 : ∀ n, LE (B n)] + (p : LocalOutcomeSampler O M) + (κA κB : (n : ℕ) → Kernel (LocalHistory O M n) O) + [inst5690_14 : ∀ n, IsMarkovKernel (κA n)] [inst5690_15 : ∀ n, IsMarkovKernel (κB n)] + (eA : LocalObservableExecution (ι := ι) A κA p.sendA) + (eB : LocalObservableExecution (ι := η) B κB p.sendB) + +def globalLocalReferenceA (n : ℕ) (s : Fin n → O) : Matrix ι ι ℂ := + eA.reference n (p.extractPrivate true n s,p.publicFrom n s) + +def globalLocalReferenceB (n : ℕ) (s : Fin n → O) : Matrix η η ℂ := + eB.reference n (p.extractPrivate false n s,p.publicFrom n s) + +omit inst5690_14 in +lemma globalLocalReferenceA_measurable [∀ n, IsMarkovKernel (κA n)] (n : ℕ) : + Measurable (globalLocalReferenceA p κA eA n) := + (eA.reference_measurable n).comp + ((p.measurable_extractPrivate true n).prodMk (p.measurable_publicFrom n)) + +omit inst5690_15 in +lemma globalLocalReferenceB_measurable [∀ n, IsMarkovKernel (κB n)] (n : ℕ) : + Measurable (globalLocalReferenceB p κB eB n) := + (eB.reference_measurable n).comp + ((p.measurable_extractPrivate false n).prodMk (p.measurable_publicFrom n)) + +omit inst5690_14 in +lemma globalLocalReferenceA_mean [∀ n, IsMarkovKernel (κA n)] (n : ℕ) (s : Fin n → O) (i j : ι) : + (∫ o, globalLocalReferenceA p κA eA (n+1) (Fin.snoc s o) i j + ∂p.instrumentKernel κA κB n s) = globalLocalReferenceA p κA eA n s i j := by + unfold globalLocalReferenceA + simp_rw [p.extractPrivate_snoc, p.publicFrom_snoc] + unfold LocalOutcomeSampler.instrumentKernel + cases hrole : p.alice n with + | true => + simp only [↓reduceIte,Kernel.comap_apply] + exact eA.active_mean n _ i j + | false => + simp only [Bool.false_eq_true,↓reduceIte,Kernel.comap_apply] + change (∫ o, eA.reference (n+1) (localPassive + (p.extractPrivate true n s,p.publicFrom n s) + (p.sendB n ((p.extractPrivate false n s,p.publicFrom n s),o))) i j + ∂κB n (p.extractPrivate false n s,p.publicFrom n s)) = _ + simp only [eA.passive_reference] + simp + +omit inst5690_15 in +lemma globalLocalReferenceB_mean [∀ n, IsMarkovKernel (κB n)] (n : ℕ) (s : Fin n → O) (i j : η) : + (∫ o, globalLocalReferenceB p κB eB (n+1) (Fin.snoc s o) i j + ∂p.instrumentKernel κA κB n s) = globalLocalReferenceB p κB eB n s i j := by + unfold globalLocalReferenceB + simp_rw [p.extractPrivate_snoc, p.publicFrom_snoc] + unfold LocalOutcomeSampler.instrumentKernel + cases hrole : p.alice n with + | false => + simp only [↓reduceIte] + exact eB.active_mean n _ i j + | true => + simp only [Bool.true_eq_false,↓reduceIte,Kernel.comap_apply] + change (∫ o, eB.reference (n+1) (localPassive + (p.extractPrivate false n s,p.publicFrom n s) + (p.sendA n ((p.extractPrivate true n s,p.publicFrom n s),o))) i j + ∂κA n (p.extractPrivate true n s,p.publicFrom n s)) = _ + simp only [eB.passive_reference] + simp + +def jointReference (n : ℕ) (s : Fin n → O) : Matrix (ι × η) (ι × η) ℂ := + globalLocalReferenceA p κA eA n s ⊗ₖ globalLocalReferenceB p κB eB n s + +omit inst5690_14 inst5690_15 in +lemma jointReference_density [∀ n, IsMarkovKernel (κA n)] [∀ n, IsMarkovKernel (κB n)] (n : ℕ) (s : Fin n → O) : + Density (jointReference p κA κB eA eB n s) := by + refine ⟨(eA.reference_density n _).1.kronecker (eB.reference_density n _).1,?_⟩ + simp only [jointReference, Matrix.trace_kronecker,globalLocalReferenceA, + globalLocalReferenceB,(eA.reference_density n _).2,(eB.reference_density n _).2,one_mul] + +lemma jointReference_measurable (n : ℕ) : + Measurable (jointReference p κA κB eA eB n) := by + have hm : Measurable (fun s i j => jointReference p κA κB eA eB n s i j) := by + apply Measurable.of_eval; intro i + apply Measurable.of_eval; intro j + exact (((Matrix.entryLinearMap ℂ ℂ i.1 j.1).toContinuousLinearMap).measurable.comp + (globalLocalReferenceA_measurable p κA eA n)).mul + (((Matrix.entryLinearMap ℂ ℂ i.2 j.2).toContinuousLinearMap).measurable.comp + (globalLocalReferenceB_measurable p κB eB n)) + have hM : Continuous (Matrix.of : ((ι × η) → (ι × η) → ℂ) → Matrix (ι × η) (ι × η) ℂ) := + continuous_matrix (fun i j => continuous_apply_apply i j) + exact hM.measurable.comp hm + +omit inst5690_14 inst5690_15 in +lemma jointReference_mean [∀ n, IsMarkovKernel (κA n)] [∀ n, IsMarkovKernel (κB n)] (n : ℕ) (s : Fin n → O) (i j : ι × η) : + (∫ o, jointReference p κA κB eA eB (n+1) (Fin.snoc s o) i j + ∂p.instrumentKernel κA κB n s) = jointReference p κA κB eA eB n s i j := by + change (∫ o, globalLocalReferenceA p κA eA (n+1) (Fin.snoc s o) i.1 j.1 * + globalLocalReferenceB p κB eB (n+1) (Fin.snoc s o) i.2 j.2 + ∂p.instrumentKernel κA κB n s) = + globalLocalReferenceA p κA eA n s i.1 j.1 * globalLocalReferenceB p κB eB n s i.2 j.2 + simp only [globalLocalReferenceA,globalLocalReferenceB] + simp_rw [p.extractPrivate_snoc,p.publicFrom_snoc] + unfold LocalOutcomeSampler.instrumentKernel + cases hrole : p.alice n with + | true => + simp only [Bool.true_eq_false,↓reduceIte,Kernel.comap_apply] + change (∫ o, eA.reference (n+1) (localActive + (p.extractPrivate true n s,p.publicFrom n s) o + (p.sendA n ((p.extractPrivate true n s,p.publicFrom n s),o))) i.1 j.1 * + eB.reference (n+1) (localPassive (p.extractPrivate false n s,p.publicFrom n s) + (p.sendA n ((p.extractPrivate true n s,p.publicFrom n s),o))) i.2 j.2 + ∂κA n (p.extractPrivate true n s,p.publicFrom n s)) = _ + simp_rw [eB.passive_reference] + rw [integral_mul_const,eA.active_mean] + | false => + simp only [Bool.false_eq_true,↓reduceIte,Kernel.comap_apply] + change (∫ o, eA.reference (n+1) (localPassive + (p.extractPrivate true n s,p.publicFrom n s) + (p.sendB n ((p.extractPrivate false n s,p.publicFrom n s),o))) i.1 j.1 * + eB.reference (n+1) (localActive (p.extractPrivate false n s,p.publicFrom n s) o + (p.sendB n ((p.extractPrivate false n s,p.publicFrom n s),o))) i.2 j.2 + ∂κB n (p.extractPrivate false n s,p.publicFrom n s)) = _ + simp_rw [eA.passive_reference] + rw [integral_const_mul,eB.active_mean] + +end + +section + +open MeasureTheory ProbabilityTheory Set Function unitInterval + +universe v6512_0 v6512_1 + +theorem exists_adaptive_instrument_sampler {O : Type v6512_0} {M : Type v6512_1} [MeasurableSpace O] + [StandardBorelSpace O] [Nonempty O] [MeasurableSpace M] + (alice : (n : ℕ) → (Fin n → M) → Bool) (hq : ∀ n, Measurable (alice n)) + (κA κB : (n : ℕ) → Kernel ((Fin n → (O ⊕ Unit)) × (Fin n → M)) O) + [∀ n, IsMarkovKernel (κA n)] [∀ n, IsMarkovKernel (κB n)] + (sendA sendB : (n : ℕ) → ((Fin n → (O ⊕ Unit)) × (Fin n → M)) × O → M) + (ha : ∀ n, Measurable (sendA n)) (hb : ∀ n, Measurable (sendB n)) : + ∃ p : AdaptiveOutcomeSampler O M, + p.alice = alice ∧ p.sendA = sendA ∧ p.sendB = sendB ∧ + (∀ n s, volume.map (fun u => p.sampleA n (s,u)) = κA n s) ∧ + (∀ n s, volume.map (fun u => p.sampleB n (s,u)) = κB n s) := by + have hA (n : ℕ) := sample_instrument_kernel (κA n) + have hB (n : ℕ) := sample_instrument_kernel (κB n) + choose fA hfA hlawA hrestA using hA + choose fB hfB hlawB hrestB using hB + exact ⟨⟨alice,hq,fun n pair => fA n pair.1 pair.2, + fun n pair => fB n pair.1 pair.2,sendA,sendB,hfA,hfB,ha,hb⟩, + rfl,rfl,rfl,hlawA,hlawB⟩ + +end + +section + +open MeasureTheory ProbabilityTheory Matrix + +open scoped ComplexOrder MatrixOrder Matrix.Norms.L2Operator Kronecker + +universe v7283_0 v7283_1 v7283_2 + +variable {Ω : Type v7283_0} {ι : Type v7283_1} {κ : Type v7283_2} {C A B : MeasurableSpace Ω} {mΩ : MeasurableSpace Ω} + [inst7283_0 : StandardBorelSpace Ω] [inst7283_1 : Fintype ι] [inst7283_2 : Fintype κ] [inst7283_3 : DecidableEq ι] [inst7283_4 : DecidableEq κ] + {μ : Measure Ω} [inst7283_5 : IsFiniteMeasure μ] + +lemma publicMatrix_positive (W : Ω → Matrix ι ι ℂ) + (hW : ∀ x, (W x).PosSemidef) (x : Ω) : + (publicMatrix C μ W x).PosSemidef := + (integral_nonneg_of_ae (Filter.Eventually.of_forall (fun y => (hW y).nonneg))).posSemidef + +end + +open MeasureTheory Matrix Filter + +open scoped ComplexOrder MatrixOrder + +namespace PositiveMatrixMeasure + +universe v7485_0 v7485_1 + +variable {Ω : Type v7485_0} {ι : Type v7485_1} {mΩ : MeasurableSpace Ω} [inst7485_0 : Fintype ι] [inst7485_1 : DecidableEq ι] + +universe v7524_0 + +lemma filter_eq_of_filtration {κ : Type v7524_0} [Fintype κ] [DecidableEq κ] + (W : PositiveMatrixMeasure Ω ι) (V : PositiveMatrixMeasure Ω κ) + (K : Matrix κ ι ℂ) (F : Filtration ℕ mΩ) (hm : mΩ = ⨆ n, F n) + (h : ∀ n S, MeasurableSet[F n] S → V.value S = K * W.value S * Kᴴ) : + V = W.filter K := by + apply V.ext_on_filtration (W.filter K) F hm + intro n S hS + rw [filter_value] + exact h n S hS + +end PositiveMatrixMeasure + +end ZeroKey + +namespace UnrestrictedQuantum + +open Matrix MeasureTheory + +open scoped ComplexOrder MatrixOrder Matrix.Norms.L2Operator + +universe v7551_0 v7551_1 v7551_2 + +variable {A : Type v7551_0} {B : Type v7551_1} {ι : Type v7551_2} [inst7551_0 : AddCommGroup A] [inst7551_1 : Module ℂ A] [inst7551_2 : One A] [inst7551_3 : LE A] + [inst7551_4 : AddCommGroup B] [inst7551_5 : Module ℂ B] [inst7551_6 : One B] [inst7551_7 : LE B] + [inst7551_8 : Fintype ι] [inst7551_9 : DecidableEq ι] + (J : ObservableInstrument Bool A B) (S : ReferenceFunctional A ι) + (r : InstrumentRun J S) + +include r in +lemma bitReference_total_trace (htrace : trace (S 1) = 1) : + trace (bitReference J S false) + trace (bitReference J S true) = 1 := by + rw [← Matrix.trace_add, bitReference_sum J S r, htrace] + +universe v7591_0 + +omit inst7551_9 in +lemma bitReference_filter [DecidableEq ι] {κ : Type v7591_0} [Fintype κ] [DecidableEq κ] + (K : Matrix κ ι ℂ) (i : Bool) : + bitReference J (filterFunctional K S) i = + K * bitReference J S i * Kᴴ := rfl + +end UnrestrictedQuantum + +open Matrix MeasureTheory + +open scoped TensorProduct Kronecker + +namespace UnrestrictedQuantum + +universe v8007_0 v8007_1 v8007_2 v8007_3 v8007_4 v8007_5 + +variable {A : Type v8007_0} {A' : Type v8007_1} {B : Type v8007_2} {B' : Type v8007_3} + [inst8007_0 : AddCommGroup A] [inst8007_1 : Module ℂ A] [inst8007_2 : AddCommGroup A'] [inst8007_3 : Module ℂ A'] + [inst8007_4 : AddCommGroup B] [inst8007_5 : Module ℂ B] [inst8007_6 : AddCommGroup B'] [inst8007_7 : Module ℂ B'] + {ι : Type v8007_4} {η : Type v8007_5} + +def tensorReferenceFunctional (S : A →ₗ[ℂ] Matrix ι ι ℂ) + (T : B →ₗ[ℂ] Matrix η η ℂ) : + (TensorProduct ℂ A B) →ₗ[ℂ] Matrix (ι × η) (ι × η) ℂ := + TensorProduct.lift ((Matrix.kroneckerBilinear (R := ℂ) (α := ℂ)).compl₁₂ S T) + +@[simp] +lemma tensorReferenceFunctional_apply (S : A →ₗ[ℂ] Matrix ι ι ℂ) + (T : B →ₗ[ℂ] Matrix η η ℂ) (a : A) (b : B) : + tensorReferenceFunctional S T (a ⊗ₜ[ℂ] b) = S a ⊗ₖ T b := rfl + +theorem tensorReferenceFunctional_precompose + (S : A →ₗ[ℂ] Matrix ι ι ℂ) (T : B →ₗ[ℂ] Matrix η η ℂ) + (L : A' →ₗ[ℂ] A) (N : B' →ₗ[ℂ] B) : + (tensorReferenceFunctional S T).comp (TensorProduct.map L N) = + tensorReferenceFunctional (S.comp L) (T.comp N) := by + apply TensorProduct.ext' + intro a b + simp only [LinearMap.comp_apply, TensorProduct.map_tmul, tensorReferenceFunctional_apply] + +lemma product_event_reference [One A] [One B] [One A'] + (S : A →ₗ[ℂ] Matrix ι ι ℂ) (T : B →ₗ[ℂ] Matrix η η ℂ) + (L : A' →ₗ[ℂ] A) : + ((tensorReferenceFunctional S T).comp + (TensorProduct.map L (LinearMap.id : B →ₗ[ℂ] B))) (1 ⊗ₜ[ℂ] 1) = + S (L 1) ⊗ₖ T 1 := by + simp only [LinearMap.comp_apply, TensorProduct.map_tmul, LinearMap.id_apply, + tensorReferenceFunctional_apply] + +end UnrestrictedQuantum + +end + +end OAI diff --git a/lean/OAI/InformationTheory/SecretKey/Extensions.lean b/lean/OAI/InformationTheory/SecretKey/Extensions.lean new file mode 100644 index 0000000000000000000000000000000000000000..649d7636589c28b9d0d8e74c0f720ea82efb4081 --- /dev/null +++ b/lean/OAI/InformationTheory/SecretKey/Extensions.lean @@ -0,0 +1,860 @@ +import OAI.InformationTheory.SecretKey.KeyRate + +namespace OAI + +noncomputable section + +namespace UnrestrictedQuantum + +open Matrix MeasureTheory ProbabilityTheory Filter + +open scoped ComplexOrder MatrixOrder Matrix.Norms.L2Operator + +universe v11816_0 v11816_1 v11816_2 + +variable {K : Type v11816_0} {A : Type v11816_1} {ι : Type v11816_2} [inst11816_0 : MeasurableSpace K] [inst11816_1 : MeasurableSingletonClass K] [inst11816_2 : DecidableEq K] + [inst11816_3 : AddCommGroup A] [inst11816_4 : Module ℂ A] [inst11816_5 : One A] [inst11816_6 : Preorder A] + [inst11816_7 : Fintype ι] [inst11816_8 : DecidableEq ι] + +def deterministicInstrument (k : K) : ObservableInstrument K A A := by + classical + exact { + operation := fun E => if k ∈ E then LinearMap.id else 0 + positive := by + intro E hE x hx + by_cases h : k ∈ E + · simpa only [h, ite_eq_left, LinearMap.id_apply] using hx + · simp only [h]; exact le_rfl + total_unit := by simp + } + +def deterministicRun (k : K) (S : ReferenceFunctional A ι) + (hS : PositiveFunctional S) (hn : trace (S 1) = 1) : + InstrumentRun (deterministicInstrument (A := A) k) S where + law := Measure.dirac k + probability := inferInstance + posterior _ := S + posterior_positive _ := hS + posterior_trace _ := hn + integrable _ _ _ := integrable_const _ + update E hE x i j := by + by_cases h : k ∈ E + · simp [deterministicInstrument,h,Measure.real, Measure.dirac_apply', hE] + · simp [deterministicInstrument,h,Measure.real, Measure.dirac_apply', hE] + +omit inst11816_1 inst11816_7 inst11816_8 in +lemma deterministic_event [MeasurableSingletonClass K] [Fintype ι] [DecidableEq ι] (k l : K) (S : ReferenceFunctional A ι) : + S ((deterministicInstrument (A := A) k).operation {l} 1) = + if k = l then S 1 else 0 := by + by_cases h : k = l <;> simp [deterministicInstrument,h] + +universe v11853_0 + +variable {Ω : Type v11853_0} {L : MeasurableSpace Ω} {mΩ : MeasurableSpace Ω} + {μ : Measure Ω} {F : Filtration ℕ mΩ} {U : ℕ → Ω → Matrix ι ι ℂ} + +def scalarReference (G : Matrix ι ι ℂ) : ReferenceFunctional ℂ ι where + toFun z := z • G + map_add' z w := add_smul z w G + map_smul' z w := by simp [smul_smul] + +omit inst11816_7 inst11816_8 in +lemma scalarReference_positive [Fintype ι] [DecidableEq ι] {G : Matrix ι ι ℂ} (hG : G.PosSemidef) : + PositiveFunctional (scalarReference G) := by + intro z hz + exact hG.smul hz + +omit inst11816_7 inst11816_8 in +@[simp] lemma scalarReference_one [Fintype ι] [DecidableEq ι] (G : Matrix ι ι ℂ) : scalarReference G 1 = G := one_smul _ _ + +def scalarIncoming (G : Ω → Matrix ι ι ℂ) + (hG : ∀ x, ZeroKey.Density (G x)) (hm : Measurable[L] G) + (hc : ∀ n E, MeasurableSet[F n] E → + (∫ x in E, G x ∂μ) = ∫ x in E, U n x ∂μ) : + IncomingObservableProcess (L := L) (A := ℂ) μ F U where + state x := scalarReference (G x) + positive x := scalarReference_positive (hG x).1 + positive_unit := zero_le_one + normalized x := by simpa using (hG x).2 + local_measurable := by simpa using hm + causality := by simpa using hc + +namespace IncomingObservableProcess + +variable (e : IncomingObservableProcess (L := L) (A := A) μ F U) + [inst11884_0 : Fintype K] [inst11884_1 : Nonempty K] + +def classicalReadout (f : Ω → K) (hf : Measurable[L] f) : e.FiniteReadout (K := K) (B := A) where + instrument x := deterministicInstrument (f x) + run x := deterministicRun (f x) (e.state x) (e.positive x) (e.normalized x) + positive_unit := e.positive_unit + local_measurable k := by + simp_rw [deterministic_event] + exact e.local_measurable.ite (measurableSet_eq_fun hf measurable_const) measurable_const + +omit inst11884_1 in +lemma classicalReadout_value [Nonempty K] (f : Ω → K) (hf : Measurable[L] f) (k : K) (x : Ω) : + (e.classicalReadout f hf).value k x = if f x = k then e.state x 1 else 0 := + deterministic_event _ _ _ + +end IncomingObservableProcess + +end UnrestrictedQuantum + +namespace ZeroKey + +section + +open MeasureTheory Matrix Filter + +open scoped ComplexOrder MatrixOrder Matrix.Norms.L2Operator ProbabilityTheory ENNReal NNReal Topology + +universe v11915_0 v11915_1 + +variable {Ω : Type v11915_0} {ι : Type v11915_1} {mΩ : MeasurableSpace Ω} [inst11915_0 : Fintype ι] [inst11915_1 : DecidableEq ι] + {μ : Measure Ω} [inst11915_2 : IsFiniteMeasure μ] (F : Filtration ℕ mΩ) + +structure ConsistentReferenceHistory where + finiteMeasure : (n : ℕ) → @PositiveMatrixMeasure Ω ι (F n) _ + traceLaw : ∀ n, @PositiveMatrixMeasure.traceMeasure Ω ι (F n) _ (finiteMeasure n) = μ.trim (F.le n) + consistency : ∀ n k, n ≤ k → ∀ S, MeasurableSet[F n] S → + @PositiveMatrixMeasure.value Ω ι (F n) _ (finiteMeasure n) S = + @PositiveMatrixMeasure.value Ω ι (F k) _ (finiteMeasure k) S + +namespace ConsistentReferenceHistory + +variable {F} + +variable (H : ConsistentReferenceHistory (ι := ι) (μ := μ) F) + +def finiteValue (n : ℕ) (S : Set Ω) : Matrix ι ι ℂ := + @PositiveMatrixMeasure.value Ω ι (F n) _ (H.finiteMeasure n) S + +def density (n : ℕ) : Ω → Matrix ι ι ℂ := + @PositiveMatrixMeasure.density Ω ι (F n) _ (H.finiteMeasure n) (μ.trim (F.le n)) + +omit inst11915_2 in +lemma measurable_density [IsFiniteMeasure μ] (n : ℕ) : Measurable[F n] (H.density n) := + @PositiveMatrixMeasure.measurable_density Ω ι (F n) _ _ (H.finiteMeasure n) _ + +lemma measurable_entry (n : ℕ) (i j : ι) : Measurable[F n] (fun ω => H.density n ω i j) := by + let L : Matrix ι ι ℂ →L[ℂ] ℂ := (Matrix.entryLinearMap ℂ ℂ i j).toContinuousLinearMap + exact L.continuous.measurable.comp (H.measurable_density n) + +omit inst11915_2 in +lemma integrable_entry [IsFiniteMeasure μ] (n : ℕ) (i j : ι) : Integrable (fun ω => H.density n ω i j) μ := + integrable_of_integrable_trim (F.le n) + (@PositiveMatrixMeasure.integrable_entry Ω ι (F n) _ _ (H.finiteMeasure n) _ i j) + +lemma integral_entry (n : ℕ) (S : Set Ω) (hS : MeasurableSet[F n] S) (i j : ι) : + (∫ ω in S, H.density n ω i j ∂μ) = H.finiteValue n S i j := by + rw [setIntegral_trim (F.le n) (H.measurable_entry n i j).stronglyMeasurable hS] + let : MeasurableSpace Ω := F n + apply (H.finiteMeasure n).integral_density_entry _ _ S hS i j + intro T hT hμ + apply (H.finiteMeasure n).value_zero_of_traceMeasure_zero T hT + rwa [H.traceLaw n] + +lemma density_pos (n : ℕ) : ∀ᵐ ω ∂μ, (H.density n ω).PosSemidef := by + apply ae_of_ae_trim (F.le n) + let : MeasurableSpace Ω := F n + apply density_posSemidef_ae (H.finiteMeasure n) + intro S hS hs + apply (H.finiteMeasure n).value_zero_of_traceMeasure_zero S hS + rwa [H.traceLaw n] + +lemma density_trace (n : ℕ) : ∀ᵐ ω ∂μ, (trace (H.density n ω)).re = 1 := by + apply ae_of_ae_trim (F.le n) + let : MeasurableSpace Ω := F n + let W := H.finiteMeasure n + let ν := μ.trim (F.le n) + have hi := (W.integrable_trace_density ν).re + apply Integrable.ae_eq_of_forall_setIntegral_eq _ _ hi (integrable_const (1 : ℝ)) + intro S hS _ + change (∫ ω in S, RCLike.re (trace (W.density ν ω)) ∂ν) = _ + rw [integral_re (W.integrable_trace_density ν).integrableOn] + have hAC : ∀ T, MeasurableSet[F n] T → ν T = 0 → W.value T = 0 := by + intro T hT hμ + apply W.value_zero_of_traceMeasure_zero T hT + rwa [H.traceLaw n] + rw [W.integral_trace_density ν hAC S hS,integral_const] + simp only [smul_eq_mul,mul_one] + change (trace (W.value S)).re = (ν.restrict S).real Set.univ + rw [← W.traceMeasure_real S hS,H.traceLaw n] + simp only [Measure.real,Measure.restrict_apply_univ] + rfl + +lemma density_entry_martingale_re (i j : ι) : + Martingale (fun n ω => (H.density n ω i j).re) F μ := by + refine ⟨fun n => ((H.measurable_entry n i j).re).stronglyMeasurable, ?_⟩ + intro n k hnk + symm + apply ae_eq_condExp_of_forall_setIntegral_eq (F.le n) ((H.integrable_entry k i j).re) + · intro S _ _ + exact (H.integrable_entry n i j).re.integrableOn + · intro S hS _ + change (∫ ω in S, RCLike.re (H.density n ω i j) ∂μ) = + ∫ ω in S, RCLike.re (H.density k ω i j) ∂μ + rw [integral_re (H.integrable_entry n i j).integrableOn, + integral_re (H.integrable_entry k i j).integrableOn, + H.integral_entry n S hS i j, + H.integral_entry k S ((F.mono hnk) S hS) i j] + exact congrArg (fun Z : Matrix ι ι ℂ => (Z i j).re) (H.consistency n k hnk S hS) + · exact ((H.measurable_entry n i j).re).stronglyMeasurable.aestronglyMeasurable + +lemma density_entry_martingale_im (i j : ι) : + Martingale (fun n ω => (H.density n ω i j).im) F μ := by + refine ⟨fun n => ((H.measurable_entry n i j).im).stronglyMeasurable, ?_⟩ + intro n k hnk + symm + apply ae_eq_condExp_of_forall_setIntegral_eq (F.le n) ((H.integrable_entry k i j).im) + · intro S _ _ + exact (H.integrable_entry n i j).im.integrableOn + · intro S hS _ + change (∫ ω in S, RCLike.im (H.density n ω i j) ∂μ) = + ∫ ω in S, RCLike.im (H.density k ω i j) ∂μ + rw [integral_im (H.integrable_entry n i j).integrableOn, + integral_im (H.integrable_entry k i j).integrableOn, + H.integral_entry n S hS i j, + H.integral_entry k S ((F.mono hnk) S hS) i j] + exact congrArg (fun Z : Matrix ι ι ℂ => (Z i j).im) (H.consistency n k hnk S hS) + · exact ((H.measurable_entry n i j).im).stronglyMeasurable.aestronglyMeasurable + +theorem full_reference_measure : ∃ V : PositiveMatrixMeasure Ω ι, + ∀ n S, MeasurableSet[F n] S → V.value S = H.finiteValue n S := by + obtain ⟨V,hV⟩ := positive_matrix_martingale_extension (H.density) + H.density_entry_martingale_re H.density_entry_martingale_im H.density_pos + (fun n => (H.density_trace n).mono (fun _ h => le_of_eq h)) + refine ⟨V,fun n S hS => ?_⟩ + rw [hV n S hS] + ext i j + exact H.integral_entry n S hS i j + +end ConsistentReferenceHistory + +end + +section + +open Matrix MeasureTheory ProbabilityTheory Filter + +open scoped ComplexOrder MatrixOrder Matrix.Norms.L2Operator + +section + +namespace PositiveMatrixMeasure + +universe v12052_0 v12052_1 v12052_2 + +variable {Ω : Type v12052_0} {T : Type v12052_1} {ι : Type v12052_2} {mΩ : MeasurableSpace Ω} [inst12052_0 : MeasurableSpace T] + [inst12052_1 : Fintype ι] [inst12052_2 : DecidableEq ι] + +def restrictEvent (W : PositiveMatrixMeasure Ω ι) (A : Set Ω) (hA : MeasurableSet A) : + PositiveMatrixMeasure Ω ι where + entry i j := (W.entry i j).restrict A + positive S hS := by + simpa only [VectorMeasure.restrict_apply _ hA hS] using W.positive (S ∩ A) (hS.inter hA) + +omit inst12052_2 in +lemma restrictEvent_value [DecidableEq ι] (W : PositiveMatrixMeasure Ω ι) (A : Set Ω) + (hA : MeasurableSet A) (S : Set Ω) (hS : MeasurableSet S) : + (W.restrictEvent A hA).value S = W.value (S ∩ A) := by + ext i j + exact VectorMeasure.restrict_apply _ hA hS + +omit inst12052_2 in +lemma eq_of_value [DecidableEq ι] (W V : PositiveMatrixMeasure Ω ι) + (h : ∀ S, MeasurableSet S → W.value S = V.value S) : W = V := by + have he : W.entry = V.entry := by + funext i j + apply VectorMeasure.ext + intro S hS + exact congrArg (fun X : Matrix ι ι ℂ => X i j) (h S hS) + cases W + cases V + cases he + rfl + +universe v12080_0 + +lemma restrictEvent_filter {κ : Type v12080_0} [Fintype κ] [DecidableEq κ] + (W : PositiveMatrixMeasure Ω ι) (A : Set Ω) (hA : MeasurableSet A) + (K : Matrix κ ι ℂ) : + (W.filter K).restrictEvent A hA = (W.restrictEvent A hA).filter K := by + apply eq_of_value + intro S hS + rw [restrictEvent_value _ _ _ _ hS,filter_value,filter_value, + restrictEvent_value _ _ _ _ hS] + +def testMeasure (W : PositiveMatrixMeasure Ω ι) (E : Matrix ι ι ℂ) : Measure Ω := + (W.filter (CFC.sqrt E)).traceMeasure + +instance testMeasure_finite (W : PositiveMatrixMeasure Ω ι) (E : Matrix ι ι ℂ) : + IsFiniteMeasure (W.testMeasure E) := inferInstanceAs (IsFiniteMeasure (W.filter (CFC.sqrt E)).traceMeasure) + +lemma testMeasure_real (W : PositiveMatrixMeasure Ω ι) (E : Matrix ι ι ℂ) + (hE : E.PosSemidef) (S : Set Ω) (hS : MeasurableSet S) : + (W.testMeasure E).real S = (trace (E * W.value S)).re := by + rw [testMeasure,traceMeasure_real _ S hS,filter_value] + have hs : (CFC.sqrt E)ᴴ = CFC.sqrt E := (CFC.sqrt_nonneg E).isSelfAdjoint.isHermitian.eq + rw [hs,Matrix.trace_mul_cycle] + rw [CFC.sqrt_mul_sqrt_self E hE.nonneg] + +def bitReadout (W : PositiveMatrixMeasure Ω ι) (record : Ω → T) (hr : Measurable record) + (a b : Ω → Bool) (ha : Measurable a) (hb : Measurable b) (i j : Bool) : + PositiveMatrixMeasure T ι := + (W.restrictEvent ((a ⁻¹' {i}) ∩ (b ⁻¹' {j})) + ((ha (measurableSet_singleton i)).inter (hb (measurableSet_singleton j)))).pushforward record hr + +lemma bitReadout_value (W : PositiveMatrixMeasure Ω ι) (record : Ω → T) (hr : Measurable record) + (a b : Ω → Bool) (ha : Measurable a) (hb : Measurable b) (i j : Bool) + (S : Set T) (hS : MeasurableSet S) : + (W.bitReadout record hr a b ha hb i j).value S = + W.value ((record ⁻¹' S) ∩ ((a ⁻¹' {i}) ∩ (b ⁻¹' {j}))) := by + rw [bitReadout,pushforward_value _ _ _ S hS, + restrictEvent_value _ _ _ _ (hr hS)] + +universe v12122_0 + +lemma bitReadout_filter {κ : Type v12122_0} [Fintype κ] [DecidableEq κ] + (W : PositiveMatrixMeasure Ω ι) (record : Ω → T) (hr : Measurable record) + (a b : Ω → Bool) (ha : Measurable a) (hb : Measurable b) (i j : Bool) + (K : Matrix κ ι ℂ) (S : Set T) (hS : MeasurableSet S) : + ((W.filter K).bitReadout record hr a b ha hb i j).value S = + ((W.bitReadout record hr a b ha hb i j).filter K).value S := by + rw [bitReadout_value _ _ _ _ _ _ _ _ _ _ hS,filter_value,filter_value, + bitReadout_value _ _ _ _ _ _ _ _ _ _ hS] + +end PositiveMatrixMeasure + +open MeasurableSpace + +universe v12136_0 + +lemma scalar_measure_ext_on_filtration {Ω : Type v12136_0} {mΩ : MeasurableSpace Ω} + (μ ν : Measure Ω) [IsFiniteMeasure μ] (F : Filtration ℕ mΩ) + (hm : mΩ = ⨆ n, F n) + (h : ∀ n S, MeasurableSet[F n] S → μ S = ν S) : μ = ν := by + let C : Set (Set Ω) := {S | ∃ n, MeasurableSet[F n] S} + have hc : IsPiSystem C := by + intro S hS T hT _ + obtain ⟨n,hn⟩ := hS + obtain ⟨k,hk⟩ := hT + exact ⟨max n k, ((F.mono (le_max_left n k)) S hn).inter + ((F.mono (le_max_right n k)) T hk)⟩ + have hgen : mΩ = generateFrom C := by + rw [hm] + apply le_antisymm + · apply iSup_le; intro n S hS + exact measurableSet_generateFrom ⟨n,hS⟩ + · apply generateFrom_le + rintro S ⟨n,hn⟩ + exact (le_iSup (fun n => F n) n) S hn + exact ext_of_generate_finite C hgen hc (fun S ⟨n,hn⟩ => h n S hn) + (h 0 Set.univ MeasurableSet.univ) + +namespace ConsistentReferenceHistory + +universe v12159_0 v12159_1 + +variable {Ω : Type v12159_0} {ι : Type v12159_1} {mΩ : MeasurableSpace Ω} [inst12159_0 : Fintype ι] [inst12159_1 : DecidableEq ι] + {μ : Measure Ω} [inst12159_2 : IsFiniteMeasure μ] {F : Filtration ℕ mΩ} + (H : ConsistentReferenceHistory (ι := ι) (μ := μ) F) + +theorem full_reference_born (hm : mΩ = ⨆ n, F n) : + ∃ W : PositiveMatrixMeasure Ω ι, + (∀ n S, MeasurableSet[F n] S → W.value S = H.finiteValue n S) ∧ + ∀ (E : Matrix ι ι ℂ), E.PosSemidef → ∀ (ν : Measure Ω) [IsFiniteMeasure ν], + (∀ n S, MeasurableSet[F n] S → + (trace (E * H.finiteValue n S)).re = ν.real S) → W.testMeasure E = ν := by + obtain ⟨W,hW⟩ := H.full_reference_measure + refine ⟨W,hW,?_⟩ + intro E hE ν hν htests + apply scalar_measure_ext_on_filtration _ _ F hm + intro n S hS + apply (ENNReal.toReal_eq_toReal_iff' (measure_ne_top _ _) (measure_ne_top _ _)).mp + change (W.testMeasure E).real S = ν.real S + rw [W.testMeasure_real E hE S (F.le n S hS),hW n S hS] + exact htests n S hS + +end ConsistentReferenceHistory + +end + +namespace PositiveMatrixMeasure + +universe v12187_0 v12187_1 v12187_2 v12187_3 + +variable {Ω : Type v12187_0} {T : Type v12187_1} {ι : Type v12187_2} {α : Type v12187_3} [inst12187_0 : MeasurableSpace Ω] [inst12187_1 : MeasurableSpace T] + [inst12187_2 : Fintype ι] [inst12187_3 : DecidableEq ι] + +omit inst12187_3 in +lemma value_sum_readout [DecidableEq ι] [Fintype α] [MeasurableSpace α] [MeasurableSingletonClass α] + (W : PositiveMatrixMeasure Ω ι) (a : Ω → α) (ha : Measurable a) + (S : Set Ω) (hS : MeasurableSet S) : + ∑ i, W.value (S ∩ a ⁻¹' {i}) = W.value S := by + classical + have hd : Set.PairwiseDisjoint (↑(Finset.univ : Finset α)) (fun i => S ∩ a ⁻¹' {i}) := by + intro i _ j _ hij + apply Set.disjoint_left.mpr + intro x hi hj + exact hij (hi.2.symm.trans hj.2) + have hm : ∀ i ∈ (Finset.univ : Finset α), MeasurableSet (S ∩ a ⁻¹' {i}) := + fun i _ => hS.inter (ha (measurableSet_singleton i)) + have hu : (⋃ i ∈ (Finset.univ : Finset α), S ∩ a ⁻¹' {i}) = S := by + ext x + simp only [Finset.mem_univ,Set.iUnion_true,Set.mem_iUnion,Set.mem_inter_iff, + Set.mem_preimage,Set.mem_singleton_iff] + exact ⟨fun ⟨_,hx,_⟩ => hx, fun hx => ⟨a x,hx,rfl⟩⟩ + ext i j + simp only [Matrix.sum_apply] + have h := (W.entry i j).of_biUnion_finset hd hm + rw [hu] at h + simpa only [Finset.mem_univ,ite_true,value] using h.symm + +lemma bitReadout_total (W : PositiveMatrixMeasure Ω ι) (record : Ω → T) (hr : Measurable record) + (a b : Ω → Bool) (ha : Measurable a) (hb : Measurable b) + (S : Set T) (hS : MeasurableSet S) : + ∑ i, ∑ j, (W.bitReadout record hr a b ha hb i j).value S = W.value (record ⁻¹' S) := by + simp_rw [bitReadout_value _ _ _ _ _ _ _ _ _ _ hS, ← Set.inter_assoc] + have hi (i : Bool) : (∑ j, W.value ((record ⁻¹' S ∩ a ⁻¹' {i}) ∩ b ⁻¹' {j})) = + W.value (record ⁻¹' S ∩ a ⁻¹' {i}) := + W.value_sum_readout b hb _ ((hr hS).inter (ha (measurableSet_singleton i))) + simp_rw [hi] + exact W.value_sum_readout a ha _ (hr hS) + +theorem filtered_bitReadout_normalized [Nonempty ι] + (W : PositiveMatrixMeasure Ω ι) + (hprobe : W.value Set.univ = keepReference (outer (localProbe (ι := ι)) localProbe)) + (record : Ω → T) (hr : Measurable record) + (a b : Ω → Bool) (ha : Measurable a) (hb : Measurable b) + (R : Matrix ι ι ℂ) (hR : Density R) : + (trace (∑ i, ∑ j, + ((W.bitReadout record hr a b ha hb i j).filter (preparationFilter R)).value Set.univ)).re = 1 := by + have he : (∑ i, ∑ j, + ((W.bitReadout record hr a b ha hb i j).filter (preparationFilter R)).value Set.univ) = + ((W.filter (preparationFilter R)).value Set.univ) := by + simp_rw [← bitReadout_filter _ _ _ _ _ _ _ _ _ _ _ MeasurableSet.univ] + rw [bitReadout_total _ _ _ _ _ _ _ _ MeasurableSet.univ,Set.preimage_univ] + rw [he,filter_value,hprobe,← keepReference_filter,preparation_filter_identity, + canonical_reference R hR.1,Matrix.trace_transpose,hR.2] + rfl + +end PositiveMatrixMeasure + +end + +section + +open Matrix MeasureTheory ProbabilityTheory Function Filter + +open scoped ComplexOrder MatrixOrder Matrix.Norms.L2Operator Kronecker + +open UnrestrictedQuantum + +universe v12259_0 v12259_1 v12259_2 v12259_3 v12259_4 v12259_5 v12259_6 + +variable {O : Type v12259_0} {M : Type v12259_1} {ι : Type v12259_2} {η : Type v12259_3} [inst12259_0 : MeasurableSpace O] [inst12259_1 : MeasurableSpace M] + [inst12259_2 : StandardBorelSpace O] [inst12259_3 : Nonempty O] [inst12259_4 : StandardBorelSpace M] [inst12259_5 : Nonempty M] + [inst12259_6 : Fintype ι] [inst12259_7 : Fintype η] [inst12259_8 : DecidableEq ι] [inst12259_9 : DecidableEq η] + {K : Type v12259_4} [inst12259_10 : MeasurableSpace K] [inst12259_11 : MeasurableSingletonClass K] + [inst12259_12 : Fintype K] [inst12259_13 : DecidableEq K] [inst12259_14 : Nonempty K] + (d : Discussion O M) + (A : ℕ → Type v12259_5) (B : ℕ → Type v12259_6) + [inst12259_15 : ∀ n, AddCommGroup (A n)] [inst12259_16 : ∀ n, Module ℂ (A n)] [inst12259_17 : ∀ n, One (A n)] [inst12259_18 : ∀ n, LE (A n)] + [inst12259_19 : ∀ n, AddCommGroup (B n)] [inst12259_20 : ∀ n, Module ℂ (B n)] [inst12259_21 : ∀ n, One (B n)] [inst12259_22 : ∀ n, LE (B n)] + +structure ClassicalProtocol where + executionA : LocalObservableExecution (ι := ι) A d.kernelA d.sendA + executionB : LocalObservableExecution (ι := η) B d.kernelB d.sendB + initialA : executionA.reference 0 (Fin.elim0,Fin.elim0) = + keepReference (outer (localProbe (ι := ι)) localProbe) + initialB : executionB.reference 0 (Fin.elim0,Fin.elim0) = + keepReference (outer (localProbe (ι := η)) localProbe) + outputA : (ℕ → O) → K + outputB : (ℕ → O) → K + measurableA : Measurable[d.sampler.localField true] outputA + measurableB : Measurable[d.sampler.localField false] outputB + +variable {d A B} + +namespace ClassicalProtocol + +variable (p : ClassicalProtocol (ι := ι) (η := η) (K := K) d A B) + +structure Completion where + G : (ℕ → O) → Matrix ι ι ℂ + H : (ℕ → O) → Matrix η η ℂ + measurableG : Measurable[d.sampler.localField true] G + measurableH : Measurable[d.sampler.localField false] H + densityG : ∀ x, Density (G x) + densityH : ∀ x, Density (H x) + consistentG : ∀ n S, MeasurableSet[historyFiltration n] S → + (∫ x in S, G x ∂d.probeLaw) = ∫ x in S, + AdaptiveQuantum.globalLocalReferenceA d.sampler d.kernelA p.executionA n (historyPrefix n x) ∂d.probeLaw + consistentH : ∀ n S, MeasurableSet[historyFiltration n] S → + (∫ x in S, H x ∂d.probeLaw) = ∫ x in S, + AdaptiveQuantum.globalLocalReferenceB d.sampler d.kernelB p.executionB n (historyPrefix n x) ∂d.probeLaw + reference : PositiveMatrixMeasure (ℕ → O) (ι × η) + reference_value : ∀ S, MeasurableSet S → reference.value S = ∫ x in S, G x ⊗ₖ H x ∂d.probeLaw + reference_prefix : ∀ n S, MeasurableSet[historyFiltration n] S → + reference.value S = ∫ x in S, + AdaptiveQuantum.jointReference d.sampler d.kernelA d.kernelB p.executionA p.executionB + n (historyPrefix n x) ∂d.probeLaw + +omit inst12259_4 inst12259_5 inst12259_11 inst12259_12 inst12259_13 inst12259_14 in +lemma completion_exists [StandardBorelSpace M] [Nonempty M] [MeasurableSingletonClass K] [Fintype K] [DecidableEq K] [Nonempty K] : Nonempty p.Completion := by + obtain ⟨G,H,hGm,hHm,hG,hH,hGc,hHc,W,hW,hWc⟩ := + AdaptiveQuantum.full_reference_extension d.sampler d.kernelA d.kernelB p.executionA p.executionB + d.probeLaw d.probeLaw_prefix + exact ⟨⟨G,H,hGm,hHm,hG,hH,hGc,hHc,W,hW,hWc⟩⟩ + +def completion : p.Completion := Classical.choice p.completion_exists + +def toFinite : FiniteProtocol (ι := ι) (η := η) (K := K) d A B ℂ ℂ ℂ ℂ where + executionA := p.executionA + executionB := p.executionB + initialA := p.initialA + initialB := p.initialB + incomingA := scalarIncoming p.completion.G p.completion.densityG p.completion.measurableG p.completion.consistentG + incomingB := scalarIncoming p.completion.H p.completion.densityH p.completion.measurableH p.completion.consistentH + readoutA := (scalarIncoming p.completion.G p.completion.densityG p.completion.measurableG + p.completion.consistentG).classicalReadout p.outputA p.measurableA + readoutB := (scalarIncoming p.completion.H p.completion.densityH p.completion.measurableH + p.completion.consistentH).classicalReadout p.outputB p.measurableB + +lemma completeReference_value (i j : K) (x : ℕ → O) : + p.toFinite.completeReference i j x = + if p.outputA x = i ∧ p.outputB x = j then p.completion.G x ⊗ₖ p.completion.H x else 0 := by + simp only [FiniteProtocol.completeReference, toFinite, + IncomingObservableProcess.classicalReadout_value, scalarIncoming] + by_cases ha : p.outputA x = i <;> by_cases hb : p.outputB x = j <;> + simp [ha,hb,scalarReference_one] + +theorem output_event (i j : K) (S : Set (ℕ → M)) (hS : MeasurableSet S) : + (p.toFinite.probeOutput i j).value S = p.completion.reference.value + ((d.sampler.publicRecord ⁻¹' S) ∩ (p.outputA ⁻¹' {i} ∩ p.outputB ⁻¹' {j})) := by + have ha := p.measurableA.mono (d.sampler.localField_le true) le_rfl + have hb := p.measurableB.mono (d.sampler.localField_le false) le_rfl + have he := (ha (measurableSet_singleton i)).inter (hb (measurableSet_singleton j)) + rw [p.toFinite.probeOutput_event i j S hS,p.completion.reference_value _ + ((d.sampler.measurable_publicRecord hS).inter he)] + have hind : (fun x => p.toFinite.completeReference i j x) = + (p.outputA ⁻¹' {i} ∩ p.outputB ⁻¹' {j}).indicator + (fun x => p.completion.G x ⊗ₖ p.completion.H x) := by + funext x + simp only [p.completeReference_value,Set.indicator,Set.mem_inter_iff,Set.mem_preimage, + Set.mem_singleton_iff] + rw [hind,integral_indicator he,Measure.restrict_restrict he] + rw [Set.inter_comm] + +theorem canonicalOutput_event (R : Matrix (ι × η) (ι × η) ℂ) + (i j : K) (S : Set (ℕ → M)) (hS : MeasurableSet S) : + (p.toFinite.canonicalOutput R i j).value S = + (p.completion.reference.filter (preparationFilter R)).value + ((d.sampler.publicRecord ⁻¹' S) ∩ (p.outputA ⁻¹' {i} ∩ p.outputB ⁻¹' {j})) := by + rw [FiniteProtocol.canonicalOutput,PositiveMatrixMeasure.filter_value,p.output_event i j S hS, + PositiveMatrixMeasure.filter_value] + +end ClassicalProtocol + +end + +open Matrix MeasureTheory ProbabilityTheory Filter + +open scoped ComplexOrder MatrixOrder Matrix.Norms.L2Operator + +namespace PositiveMatrixMeasure + +universe v12382_0 v12382_1 v12382_2 + +variable {Ω : Type v12382_0} {T : Type v12382_1} {ι : Type v12382_2} {mΩ : MeasurableSpace Ω} [inst12382_0 : MeasurableSpace T] + [inst12382_1 : Fintype ι] [inst12382_2 : DecidableEq ι] + +lemma value_eq_of_ae_set (W : PositiveMatrixMeasure Ω ι) + (S U : Set Ω) (hS : MeasurableSet S) (hU : MeasurableSet U) + (h : S =ᵐ[W.traceMeasure] U) : W.value S = W.value U := by + ext i j + rw [← W.integral_density_entry W.traceMeasure W.value_zero_of_traceMeasure_zero S hS i j, + ← W.integral_density_entry W.traceMeasure W.value_zero_of_traceMeasure_zero U hU i j] + exact setIntegral_congr_set h + +theorem bitReadout_eq_off_private_null (W : PositiveMatrixMeasure Ω ι) + (record : Ω → T) (hr : Measurable record) + (a b a' b' : Ω → Bool) (ha : Measurable a) (hb : Measurable b) + (ha' : Measurable a') (hb' : Measurable b') + (N : Set Ω) (hN : W.traceMeasure N = 0) + (hbits : ∀ x, x ∉ N → a x = a' x ∧ b x = b' x) + (i j : Bool) : + W.bitReadout record hr a b ha hb i j = W.bitReadout record hr a' b' ha' hb' i j := by + apply eq_of_value + intro S hS + rw [bitReadout_value _ _ _ _ _ _ _ _ _ _ hS, + bitReadout_value _ _ _ _ _ _ _ _ _ _ hS] + apply value_eq_of_ae_set _ _ _ + ((hr hS).inter ((ha (measurableSet_singleton i)).inter (hb (measurableSet_singleton j)))) + ((hr hS).inter ((ha' (measurableSet_singleton i)).inter (hb' (measurableSet_singleton j)))) + have hn : ∀ᵐ x ∂W.traceMeasure, x ∉ N := by + rw [ae_iff] + simpa only [not_not,Set.ofPred_mem_eq] using hN + filter_upwards [hn] with x hx + rcases hbits x hx with ⟨he,hf⟩ + apply propext + change (record x ∈ S ∧ (a x = i ∧ b x = j)) ↔ + (record x ∈ S ∧ (a' x = i ∧ b' x = j)) + rw [he,hf] + +universe v12423_0 + +theorem prepared_default_outputs {κ : Type v12423_0} [Fintype κ] [DecidableEq κ] + (V : PositiveMatrixMeasure Ω κ) (W : PositiveMatrixMeasure Ω ι) + (K : Matrix κ ι ℂ) (F : Filtration ℕ mΩ) (hm : mΩ = ⨆ n, F n) + (hfinite : ∀ n S, MeasurableSet[F n] S → V.value S = K * W.value S * Kᴴ) + (record : Ω → T) (hr : Measurable record) + (a b a' b' : Ω → Bool) (ha : Measurable a) (hb : Measurable b) + (ha' : Measurable a') (hb' : Measurable b') + (N : Set Ω) (hN : V.traceMeasure N = 0) + (hbits : ∀ x, x ∉ N → a x = a' x ∧ b x = b' x) + (i j : Bool) : + V.bitReadout record hr a b ha hb i j = + (W.bitReadout record hr a' b' ha' hb' i j).filter K := by + rw [V.bitReadout_eq_off_private_null record hr a b a' b' ha hb ha' hb' N hN hbits i j] + have he : V = W.filter K := by + exact W.filter_eq_of_filtration V K F hm hfinite + rw [he] + apply eq_of_value + intro S hS + exact W.bitReadout_filter record hr a' b' ha' hb' i j K S hS + +end PositiveMatrixMeasure + +end ZeroKey + +section + +open Matrix MeasureTheory ProbabilityTheory + +open scoped ComplexOrder MatrixOrder Matrix.Norms.L2Operator Kronecker TensorProduct + +namespace UnrestrictedQuantum + +section Algebra + +universe v12456_0 v12456_1 v12456_2 v12456_3 v12456_4 v12456_5 v12456_6 + +variable {A : Type v12456_0} {B : Type v12456_1} {C : Type v12456_2} {D : Type v12456_3} + [inst12456_0 : AddCommGroup A] [inst12456_1 : Module ℂ A] [inst12456_2 : AddCommGroup B] [inst12456_3 : Module ℂ B] + [inst12456_4 : AddCommGroup C] [inst12456_5 : Module ℂ C] [inst12456_6 : AddCommGroup D] [inst12456_7 : Module ℂ D] + {ι : Type v12456_4} {η : Type v12456_5} {κ : Type v12456_6} [inst12456_8 : Fintype ι] [inst12456_9 : Fintype η] [inst12456_10 : Fintype κ] + [inst12456_11 : DecidableEq ι] [inst12456_12 : DecidableEq η] [inst12456_13 : DecidableEq κ] + +omit inst12456_10 inst12456_11 inst12456_12 inst12456_13 in +theorem tensor_filter_precompose [Fintype κ] [DecidableEq ι] [DecidableEq η] [DecidableEq κ] + (S : ReferenceFunctional A ι) (T : ReferenceFunctional B η) + (K : Matrix κ (ι × η) ℂ) (L : C →ₗ[ℂ] A) (N : D →ₗ[ℂ] B) : + (filterFunctional K (tensorReferenceFunctional S T)).comp (TensorProduct.map L N) = + filterFunctional K (tensorReferenceFunctional (S.comp L) (T.comp N)) := by + apply TensorProduct.ext' + intro a b + simp only [LinearMap.comp_apply, TensorProduct.map_tmul] + rfl + +theorem tensor_filter_event [One C] [One D] + (S : ReferenceFunctional A ι) (T : ReferenceFunctional B η) + (K : Matrix κ (ι × η) ℂ) (L : C →ₗ[ℂ] A) (N : D →ₗ[ℂ] B) : + ((filterFunctional K (tensorReferenceFunctional S T)).comp + (TensorProduct.map L N)) (1 ⊗ₜ[ℂ] 1) = K * (S (L 1) ⊗ₖ T (N 1)) * Kᴴ := by + rw [tensor_filter_precompose] + rfl + +end Algebra + +universe v12490_0 v12490_1 v12490_2 v12490_3 v12490_4 v12490_5 v12490_6 + +variable {O : Type v12490_0} {A : Type v12490_1} {B : Type v12490_2} {C : Type v12490_3} {ι : Type v12490_4} {η : Type v12490_5} {κ : Type v12490_6} [inst12490_0 : MeasurableSpace O] + [inst12490_1 : AddCommGroup A] [inst12490_2 : Module ℂ A] [inst12490_3 : One A] [inst12490_4 : LE A] + [inst12490_5 : AddCommGroup B] [inst12490_6 : Module ℂ B] [inst12490_7 : One B] [inst12490_8 : LE B] + [inst12490_9 : AddCommGroup C] [inst12490_10 : Module ℂ C] [inst12490_11 : One C] + [inst12490_12 : Fintype ι] [inst12490_13 : Fintype η] [inst12490_14 : Fintype κ] + [inst12490_15 : DecidableEq ι] [inst12490_16 : DecidableEq η] [inst12490_17 : DecidableEq κ] + (J : ObservableInstrument O A B) (S : ReferenceFunctional A ι) + (r : InstrumentRun J S) (T : ReferenceFunctional C η) + +omit inst12490_11 in +theorem InstrumentRun.tensor_event [One C] (E : Set O) (hE : MeasurableSet E) + (a : B) (b : C) : + (∫ o in E, r.posterior o a ⊗ₖ T b ∂r.law) = S (J.operation E a) ⊗ₖ T b := by + have hi : Integrable (fun o => r.posterior o a ⊗ₖ T b) r.law := by + apply ZeroKey.integrable_matrix_of_entries + intro i j + exact (r.integrable a i.1 j.1).mul_const _ + ext i j + rw [ZeroKey.integral_matrix_entry hi.integrableOn] + simp only [Matrix.kroneckerMap_apply] + rw [integral_mul_const,r.update E hE] + +theorem InstrumentRun.filtered_tensor_event (K : Matrix κ (ι × η) ℂ) + (E : Set O) (hE : MeasurableSet E) (a : B) (b : C) : + (∫ o in E, K * (r.posterior o a ⊗ₖ T b) * Kᴴ ∂r.law) = + K * (S (J.operation E a) ⊗ₖ T b) * Kᴴ := by + have hi : Integrable (fun o => r.posterior o a ⊗ₖ T b) r.law := by + apply ZeroKey.integrable_matrix_of_entries + intro i j + exact (r.integrable a i.1 j.1).mul_const _ + rw [ZeroKey.integral_filter _ hi.integrableOn,InstrumentRun.tensor_event J S r T E hE] + +end UnrestrictedQuantum + +namespace ZeroKey + +open UnrestrictedQuantum + +universe v12531_0 v12531_1 v12531_2 v12531_3 v12531_4 v12531_5 v12531_6 v12531_7 v12531_8 v12531_9 v12531_10 + +variable {O : Type v12531_0} {M : Type v12531_1} {ι : Type v12531_2} {η : Type v12531_3} {κ : Type v12531_4} [inst12531_0 : MeasurableSpace O] [inst12531_1 : MeasurableSpace M] + [inst12531_2 : StandardBorelSpace O] [inst12531_3 : Nonempty O] [inst12531_4 : StandardBorelSpace M] [inst12531_5 : Nonempty M] + [inst12531_6 : Fintype ι] [inst12531_7 : Fintype η] [inst12531_8 : Fintype κ] [inst12531_9 : DecidableEq ι] [inst12531_10 : DecidableEq η] [inst12531_11 : DecidableEq κ] + {d : Discussion O M} {A : ℕ → Type v12531_5} {B : ℕ → Type v12531_6} + [inst12531_12 : ∀ n, AddCommGroup (A n)] [inst12531_13 : ∀ n, Module ℂ (A n)] [inst12531_14 : ∀ n, One (A n)] [inst12531_15 : ∀ n, LE (A n)] + [inst12531_16 : ∀ n, AddCommGroup (B n)] [inst12531_17 : ∀ n, Module ℂ (B n)] [inst12531_18 : ∀ n, One (B n)] [inst12531_19 : ∀ n, LE (B n)] + {TA : Type v12531_7} {TB : Type v12531_8} {CA : Type v12531_9} {CB : Type v12531_10} + [inst12531_20 : AddCommGroup TA] [inst12531_21 : Module ℂ TA] [inst12531_22 : One TA] [inst12531_23 : LE TA] + [inst12531_24 : AddCommGroup TB] [inst12531_25 : Module ℂ TB] [inst12531_26 : One TB] [inst12531_27 : LE TB] + [inst12531_28 : AddCommGroup CA] [inst12531_29 : Module ℂ CA] [inst12531_30 : One CA] [inst12531_31 : LE CA] + [inst12531_32 : AddCommGroup CB] [inst12531_33 : Module ℂ CB] [inst12531_34 : One CB] [inst12531_35 : LE CB] + (p : BitProtocol (ι := ι) (η := η) d A B TA TB CA CB) + +theorem BitProtocol.filtered_output_event (K : Matrix κ (ι × η) ℂ) + (i j : Bool) (E : Set (ℕ → M)) (hE : MeasurableSet E) : + ((p.probeOutput i j).filter K).value E = + ∫ x in d.sampler.publicRecord ⁻¹' E, + ((filterFunctional K (tensorReferenceFunctional (p.incomingA.state x) (p.incomingB.state x))).comp + (TensorProduct.map ((p.readoutA.instrument x).operation {i}) + ((p.readoutB.instrument x).operation {j}))) (1 ⊗ₜ[ℂ] 1) ∂d.probeLaw := by + rw [PositiveMatrixMeasure.filter_value,p.probeOutput_event i j E hE] + simp_rw [tensor_filter_event] + exact (integral_filter _ (p.completeReference_integrable i j).integrableOn).symm + +end ZeroKey + +end + +namespace ZeroKey + +open Matrix MeasureTheory ProbabilityTheory Filter + +open scoped ComplexOrder MatrixOrder Matrix.Norms.L2Operator + +open UnrestrictedQuantum + +universe v12573_0 v12573_1 v12573_2 v12573_3 v12573_4 v12573_5 + +variable {O : Type v12573_0} {M : Type v12573_1} {ι : Type v12573_2} {η : Type v12573_3} [inst12573_0 : MeasurableSpace O] [inst12573_1 : MeasurableSpace M] + [inst12573_2 : StandardBorelSpace O] [inst12573_3 : Nonempty O] [inst12573_4 : StandardBorelSpace M] [inst12573_5 : Nonempty M] + [inst12573_6 : Fintype ι] [inst12573_7 : Fintype η] [inst12573_8 : DecidableEq ι] [inst12573_9 : DecidableEq η] + {d : Discussion O M} {A : ℕ → Type v12573_4} {B : ℕ → Type v12573_5} + [inst12573_10 : ∀ n, AddCommGroup (A n)] [inst12573_11 : ∀ n, Module ℂ (A n)] [inst12573_12 : ∀ n, One (A n)] [inst12573_13 : ∀ n, LE (A n)] + [inst12573_14 : ∀ n, AddCommGroup (B n)] [inst12573_15 : ∀ n, Module ℂ (B n)] [inst12573_16 : ∀ n, One (B n)] [inst12573_17 : ∀ n, LE (B n)] + +namespace ClassicalProtocol + +variable (p : ClassicalProtocol (ι := ι) (η := η) (K := Bool) d A B) + +def toBit : BitProtocol (ι := ι) (η := η) d A B ℂ ℂ ℂ ℂ := p.toFinite.toBit id + +lemma toBit_completeReference (i j : Bool) (x : ℕ → O) : + p.toBit.completeReference i j x = p.toFinite.completeReference i j x := rfl + +lemma toBit_probeOutput (i j : Bool) : p.toBit.probeOutput i j = p.toFinite.probeOutput i j := by + apply PositiveMatrixMeasure.eq_of_value + intro S hS + rw [p.toBit.probeOutput_event i j S hS,p.toFinite.probeOutput_event i j S hS] + rfl + +universe v12596_0 + +theorem toBit_purifiedOutput {κ : Type v12596_0} [Fintype κ] [DecidableEq κ] + (K : Matrix κ (ι × η) ℂ) (i j : Bool) : + (p.toBit.probeOutput i j).filter K = + (p.completion.reference.filter K).bitReadout + d.sampler.publicRecord d.sampler.measurable_publicRecord p.outputA p.outputB + (p.measurableA.mono (d.sampler.localField_le true) le_rfl) + (p.measurableB.mono (d.sampler.localField_le false) le_rfl) i j := by + apply PositiveMatrixMeasure.eq_of_value + intro S hS + rw [PositiveMatrixMeasure.bitReadout_value _ _ _ _ _ _ _ _ _ _ hS, + PositiveMatrixMeasure.filter_value,PositiveMatrixMeasure.filter_value, + p.toBit_probeOutput,p.output_event i j S hS] + +universe v12613_0 + +theorem prepared_actual_output {κ : Type v12613_0} [Fintype κ] [DecidableEq κ] + (K : Matrix κ (ι × η) ℂ) (V : PositiveMatrixMeasure (ℕ → O) κ) + (hfinite : ∀ n S, MeasurableSet[historyFiltration n] S → + V.value S = K * (∫ x in S, + AdaptiveQuantum.jointReference d.sampler d.kernelA d.kernelB p.executionA p.executionB + n (historyPrefix n x) ∂d.probeLaw) * Kᴴ) + (a b : (ℕ → O) → Bool) (ha : Measurable a) (hb : Measurable b) + (N : Set (ℕ → O)) (hN : V.traceMeasure N = 0) + (hbits : ∀ x, x ∉ N → a x = p.outputA x ∧ b x = p.outputB x) + (i j : Bool) : + V.bitReadout d.sampler.publicRecord d.sampler.measurable_publicRecord a b ha hb i j = + (p.toBit.probeOutput i j).filter K := by + have he : V = p.completion.reference.filter K := by + apply p.completion.reference.filter_eq_of_filtration V K historyFiltration + · exact historyFiltration_generates + · intro n S hS + rw [p.completion.reference_prefix n S hS] + exact hfinite n S hS + rw [V.bitReadout_eq_off_private_null _ _ a b p.outputA p.outputB ha hb + (p.measurableA.mono (d.sampler.localField_le true) le_rfl) + (p.measurableB.mono (d.sampler.localField_le false) le_rfl) N hN hbits i j,he, + p.toBit_purifiedOutput K i j] + +end ClassicalProtocol + +end ZeroKey + +open Matrix MeasureTheory ProbabilityTheory + +open scoped ComplexOrder MatrixOrder + +namespace UnrestrictedQuantum + +universe v12649_0 v12649_1 v12649_2 + +variable {O : Type v12649_0} {A : Type v12649_1} {ι : Type v12649_2} [inst12649_0 : MeasurableSpace O] + [inst12649_1 : AddCommGroup A] [inst12649_2 : Module ℂ A] [inst12649_3 : One A] [inst12649_4 : LE A] + [inst12649_5 : Fintype ι] [inst12649_6 : DecidableEq ι] + (μ : Measure O) [inst12649_7 : IsProbabilityMeasure μ] + (positive_scaling : ∀ (r : ℝ), 0 ≤ r → ∀ a : A, 0 ≤ a → 0 ≤ (r : ℂ) • a) + +def independentCoinInstrument : ObservableInstrument O A A where + operation E := (μ.real E : ℂ) • LinearMap.id + positive E hE a ha := positive_scaling (μ.real E) ENNReal.toReal_nonneg a ha + total_unit := by simp [Measure.real] + +def independentCoinRun (S : ReferenceFunctional A ι) (hS : PositiveFunctional S) + (hn : trace (S 1) = 1) : InstrumentRun (independentCoinInstrument μ positive_scaling) S where + law := μ + probability := inferInstance + posterior _ := S + posterior_positive _ := hS + posterior_trace _ := hn + integrable _ _ _ := integrable_const _ + update E hE a i j := by + simp only [independentCoinInstrument,LinearMap.smul_apply,LinearMap.id_apply, + map_smul,Matrix.smul_apply,integral_const, + smul_eq_mul,Complex.real_smul] + simp only [Measure.real, Measure.restrict_apply_univ] + +omit inst12649_6 in +lemma independentCoinRun_reference [DecidableEq ι] (S : ReferenceFunctional A ι) (hS : PositiveFunctional S) + (hn : trace (S 1) = 1) (o : O) (a : A) : + (independentCoinRun μ positive_scaling S hS hn).posterior o a = S a := rfl + +end UnrestrictedQuantum + +end + +end OAI diff --git a/lean/OAI/InformationTheory/SecretKey/Gap.lean b/lean/OAI/InformationTheory/SecretKey/Gap.lean new file mode 100644 index 0000000000000000000000000000000000000000..10d7ff17f1387f2256ad3c798943e4188398b299 --- /dev/null +++ b/lean/OAI/InformationTheory/SecretKey/Gap.lean @@ -0,0 +1,1352 @@ +import OAI.InformationTheory.SecretKey.Discussion + +namespace OAI + +noncomputable section + +namespace ZeroKey + +section + +open scoped ComplexOrder MatrixOrder Kronecker + +open Matrix + +universe v8144_0 v8144_1 + +variable {ι : Type v8144_0} {κ : Type v8144_1} [inst8144_0 : Fintype ι] [inst8144_1 : Fintype κ] [inst8144_2 : DecidableEq ι] [inst8144_3 : DecidableEq κ] + +omit inst8144_2 inst8144_3 in +lemma faithful_input_effects [DecidableEq ι] [DecidableEq κ] (U : Matrix ι ι ℂ) (V : Matrix κ κ ℂ) + (hU : U.PosSemidef) (hV : V.PosSemidef) : + (((Fintype.card ι : ℂ) • Uᵀ).PosSemidef ∧ ((Fintype.card κ : ℂ) • Vᵀ).PosSemidef) := + ⟨hU.transpose.smul (Nat.cast_nonneg _),hV.transpose.smul (Nat.cast_nonneg _)⟩ + +end + +section + +open scoped MatrixOrder ComplexOrder Kronecker + +open Matrix + +section + +universe v8188_0 + +variable {ι : Type v8188_0} [inst8188_0 : Fintype ι] [inst8188_1 : DecidableEq ι] + +lemma traceNorm_unitary_mul_le (A : Matrix ι ι ℂ) (U : Matrix.unitaryGroup ι ℂ) : + traceNorm ((U : Matrix ι ι ℂ) * A) ≤ traceNorm A := by + obtain ⟨W,hW⟩ := exists_unitary_traceNorm ((U : Matrix ι ι ℂ) * A) + rw [← hW, ← mul_assoc] + exact re_trace_unitary_mul_le_traceNorm A (W*U) + +lemma traceNorm_unitary_mul (A : Matrix ι ι ℂ) (U : Matrix.unitaryGroup ι ℂ) : + traceNorm ((U : Matrix ι ι ℂ) * A) = traceNorm A := by + apply le_antisymm (traceNorm_unitary_mul_le A U) + have h := traceNorm_unitary_mul_le ((U : Matrix ι ι ℂ) * A) (star U) + simpa only [Unitary.coe_star, Matrix.star_eq_conjTranspose, ← mul_assoc, + show (U : Matrix ι ι ℂ)ᴴ * U = 1 from U.prop.1, one_mul] using h + +lemma traceNorm_mul_unitary_le (A : Matrix ι ι ℂ) (U : Matrix.unitaryGroup ι ℂ) : + traceNorm (A * (U : Matrix ι ι ℂ)) ≤ traceNorm A := by + obtain ⟨W,hW⟩ := exists_unitary_traceNorm (A * (U : Matrix ι ι ℂ)) + rw [← hW, ← mul_assoc, Matrix.trace_mul_cycle] + exact re_trace_unitary_mul_le_traceNorm A (U*W) + +lemma traceNorm_mul_unitary (A : Matrix ι ι ℂ) (U : Matrix.unitaryGroup ι ℂ) : + traceNorm (A * (U : Matrix ι ι ℂ)) = traceNorm A := by + apply le_antisymm (traceNorm_mul_unitary_le A U) + have h := traceNorm_mul_unitary_le (A * (U : Matrix ι ι ℂ)) (star U) + simpa only [Unitary.coe_star, Matrix.star_eq_conjTranspose, mul_assoc, + show (U : Matrix ι ι ℂ) * (U : Matrix ι ι ℂ)ᴴ = 1 from U.prop.2, mul_one] using h + +lemma traceNorm_posSemidef {A : Matrix ι ι ℂ} (hA : A.PosSemidef) : + traceNorm A = (trace A).re := by + simp only [traceNorm, hA.isHermitian.eq, CFC.sqrt_mul_self A hA.nonneg] + +lemma re_trace_le_traceNorm (A : Matrix ι ι ℂ) : (trace A).re ≤ traceNorm A := by + simpa using re_trace_unitary_mul_le_traceNorm A 1 + +lemma traceNorm_conjTranspose_le (A : Matrix ι ι ℂ) : traceNorm Aᴴ ≤ traceNorm A := by + obtain ⟨W,hW⟩ := exists_unitary_traceNorm Aᴴ + have he : (trace ((W : Matrix ι ι ℂ) * Aᴴ)).re = + (trace ((W : Matrix ι ι ℂ)ᴴ * A)).re := by + have heq : (W : Matrix ι ι ℂ) * Aᴴ = (A * (W : Matrix ι ι ℂ)ᴴ)ᴴ := by simp + rw [heq, Matrix.trace_conjTranspose, Matrix.trace_mul_comm] + rfl + rw [← hW, he] + exact re_trace_unitary_mul_le_traceNorm A (star W) + +lemma traceNorm_conjTranspose (A : Matrix ι ι ℂ) : traceNorm Aᴴ = traceNorm A := by + apply le_antisymm (traceNorm_conjTranspose_le A) + simpa only [Matrix.conjTranspose_conjTranspose] using traceNorm_conjTranspose_le Aᴴ + +lemma traceNorm_transpose_le (A : Matrix ι ι ℂ) : traceNorm Aᵀ ≤ traceNorm A := by + obtain ⟨W,hW⟩ := exists_unitary_traceNorm Aᵀ + rw [← hW, ← Matrix.trace_transpose, Matrix.transpose_mul, + Matrix.transpose_transpose, Matrix.trace_mul_comm] + exact re_trace_unitary_mul_le_traceNorm A (Matrix.UnitaryGroup.transpose W) + +lemma traceNorm_transpose (A : Matrix ι ι ℂ) : traceNorm Aᵀ = traceNorm A := by + apply le_antisymm (traceNorm_transpose_le A) + simpa only [Matrix.transpose_transpose] using traceNorm_transpose_le Aᵀ + +def rootFidelity (H J : Matrix ι ι ℂ) : ℝ := traceNorm (CFC.sqrt H * CFC.sqrt J) + +lemma polar_fidelity (A B : Matrix ι ι ℂ) : + rootFidelity (Aᴴ * A) (Bᴴ * B) = traceNorm (A * Bᴴ) := by + obtain ⟨U,hU⟩ := exists_unitary_polar A + obtain ⟨V,hV⟩ := exists_unitary_polar B + have hS : (CFC.sqrt (Bᴴ * B))ᴴ = CFC.sqrt (Bᴴ * B) := + (CFC.sqrt_nonneg _).posSemidef.isHermitian.eq + have he : A * Bᴴ = (U : Matrix ι ι ℂ) * + (CFC.sqrt (Aᴴ*A) * CFC.sqrt (Bᴴ*B)) * ((star V : Matrix.unitaryGroup ι ℂ) : Matrix ι ι ℂ) := by + conv_lhs => rw [hU, hV] + simp only [Matrix.conjTranspose_mul, hS, Unitary.coe_star, Matrix.star_eq_conjTranspose, + mul_assoc] + rw [he, traceNorm_mul_unitary, traceNorm_unitary_mul] + rfl + +end + +section + +universe v8268_0 + +variable {ι : Type v8268_0} [inst8268_0 : Fintype ι] [inst8268_1 : DecidableEq ι] + +def unitSign (t : ℝ) := if 0 ≤ t then (1 : ℝ) else -1 + +lemma unitSign_square (t : ℝ) : unitSign t * unitSign t = 1 := by + by_cases h : 0 ≤ t <;> simp [unitSign, h] + +lemma signed_absolute (H : Matrix ι ι ℂ) (hH : H.IsHermitian) : + ∃ U : Matrix.unitaryGroup ι ℂ, Commute (U : Matrix ι ι ℂ) H ∧ + ((U : Matrix ι ι ℂ)*H - H).PosSemidef ∧ + ((U : Matrix ι ι ℂ)*H + H).PosSemidef := by + let S := cfc unitSign H + have hS : S.IsHermitian := IsSelfAdjoint.cfc + have hSS : S*S=1 := by + dsimp [S] + rw [← matrix_cfc_mul _ _ H hH] + simp only [unitSign_square, cfc_const_one ℝ H] + have hSU : S ∈ Matrix.unitaryGroup ι ℂ := by + constructor <;> simpa only [Matrix.star_eq_conjTranspose, hS.eq] using hSS + have hc : Commute S H := (Commute.refl H).cfc_real _ + have hSH : S*H = cfc (fun t => unitSign t * t) H := by + conv_lhs => arg 2; rw [← cfc_id ℝ H] + rw [matrix_cfc_mul _ _ H hH] + rfl + refine ⟨⟨S,hSU⟩,hc,?_,?_⟩ + · change (S*H-H).PosSemidef + have he : S*H-H = cfc (fun t => unitSign t*t-t) H := by + rw [cfc_sub _ _ H (matrix_cfc_continuous _ H) (matrix_cfc_continuous _ H), + show cfc (fun t : ℝ => t) H = H from cfc_id ℝ H, hSH] + rw [he] + apply LE.le.posSemidef + apply cfc_nonneg + intro t _ + by_cases ht : 0 ≤ t <;> simp [unitSign, ht] + linarith + · change (S*H+H).PosSemidef + have he : S*H+H = cfc (fun t => unitSign t*t+t) H := by + rw [cfc_add H _ _ (matrix_cfc_continuous _ H) (matrix_cfc_continuous _ H), + show cfc (fun t : ℝ => t) H = H from cfc_id ℝ H, hSH] + rw [he] + apply LE.le.posSemidef + apply cfc_nonneg + intro t _ + by_cases ht : 0 ≤ t <;> simp [unitSign, ht] + +lemma powers_stormer {A B : Matrix ι ι ℂ} (hA : A.PosSemidef) (hB : B.PosSemidef) : + (trace ((A-B)*(A-B))).re ≤ traceNorm (A*A-B*B) := by + obtain ⟨U,hUZ,hminus,hplus⟩ := signed_absolute (A-B) (hA.isHermitian.sub hB.isHermitian) + let S : Matrix ι ι ℂ := U + have h₁ := re_trace_mul_nonneg hminus hA + have h₂ := re_trace_mul_nonneg hplus hB + have hd := re_trace_unitary_mul_le_traceNorm (A*A-B*B) U + have he : trace (S*(A*A-B*B)) = trace (S*(A-B)*(A+B)) := by + have he₁ : A*A-B*B = (A-B)*A+B*(A-B) := by noncomm_ring + rw [he₁, mul_add, Matrix.trace_add, ← mul_assoc] + rw [show trace (S*(B*(A-B))) = trace (S*(A-B)*B) by + rw [← mul_assoc, Matrix.trace_mul_cycle, ← hUZ.eq]] + rw [← Matrix.trace_add, ← mul_add] + have he₂ : (S*(A-B)-(A-B))*A + (S*(A-B)+(A-B))*B = + S*(A-B)*(A+B) - (A-B)*(A-B) := by noncomm_ring + have hsum := add_nonneg h₁ h₂ + change 0 ≤ (trace ((S*(A-B)-(A-B))*A)).re + + (trace ((S*(A-B)+(A-B))*B)).re at hsum + rw [← Complex.add_re, ← Matrix.trace_add, he₂, Matrix.trace_sub, Complex.sub_re, + ← he] at hsum + change (trace (S*(A*A-B*B))).re ≤ _ at hd + linarith + +lemma fidelity_lower {H J : Matrix ι ι ℂ} (hH : H.PosSemidef) (hJ : J.PosSemidef) : + ((trace H).re + (trace J).re - traceNorm (H-J))/2 ≤ rootFidelity H J := by + let A := CFC.sqrt H + let B := CFC.sqrt J + have hA : A.PosSemidef := (CFC.sqrt_nonneg H).posSemidef + have hB : B.PosSemidef := (CFC.sqrt_nonneg J).posSemidef + have hAA : A*A=H := CFC.sqrt_mul_sqrt_self H hH.nonneg + have hBB : B*B=J := CFC.sqrt_mul_sqrt_self J hJ.nonneg + have h := powers_stormer hA hB + rw [hAA,hBB] at h + have he : trace ((A-B)*(A-B)) = trace H + trace J - 2*trace (A*B) := by + simp only [sub_mul, mul_sub, Matrix.trace_sub, hAA, hBB, Matrix.trace_mul_comm B A] + ring + rw [he, Complex.sub_re, Complex.add_re, Complex.mul_re] at h + have hb := re_trace_le_traceNorm (A*B) + change _ ≤ traceNorm (A*B) + norm_num at h + linarith + +end + +section + +universe v8360_0 + +variable {ι : Type v8360_0} [inst8360_0 : Fintype ι] [inst8360_1 : DecidableEq ι] + +lemma traceNorm_neg (A : Matrix ι ι ℂ) : traceNorm (-A) = traceNorm A := by + simp only [traceNorm, Matrix.conjTranspose_neg, neg_mul_neg] + +lemma traceNorm_sub_comm (A B : Matrix ι ι ℂ) : traceNorm (A-B) = traceNorm (B-A) := by + rw [← neg_sub B A, traceNorm_neg] + +lemma abs_re_trace_le_traceNorm (A : Matrix ι ι ℂ) : |(trace A).re| ≤ traceNorm A := by + apply abs_le.mpr + constructor + · have h := re_trace_le_traceNorm (-A) + rw [Matrix.trace_neg, Complex.neg_re, traceNorm_neg] at h + linarith + · exact re_trace_le_traceNorm A + +lemma traceNorm_smul_nonneg (A : Matrix ι ι ℂ) {r : ℝ} (hr : 0 ≤ r) : + traceNorm (r • A) = r * traceNorm A := by + have he (U : Matrix.unitaryGroup ι ℂ) : + (trace ((U : Matrix ι ι ℂ) * (r • A))).re = r * (trace ((U : Matrix ι ι ℂ)*A)).re := by + simp only [Matrix.mul_smul, Matrix.trace_smul, Complex.real_smul, Complex.mul_re, + Complex.ofReal_re, Complex.ofReal_im, zero_mul, sub_zero] + apply le_antisymm + · obtain ⟨U,hU⟩ := exists_unitary_traceNorm (r • A) + rw [← hU, he] + exact mul_le_mul_of_nonneg_left (re_trace_unitary_mul_le_traceNorm A U) hr + · obtain ⟨U,hU⟩ := exists_unitary_traceNorm A + have h := re_trace_unitary_mul_le_traceNorm (r • A) U + rwa [he, hU] at h + +lemma sqrt_transpose {H : Matrix ι ι ℂ} (hH : H.PosSemidef) : + CFC.sqrt Hᵀ = (CFC.sqrt H)ᵀ := by + apply CFC.sqrt_unique + · rw [← Matrix.transpose_mul, CFC.sqrt_mul_sqrt_self H hH.nonneg] + · exact ((CFC.sqrt_nonneg H).posSemidef.transpose).nonneg + +lemma rootFidelity_symm (H J : Matrix ι ι ℂ) : rootFidelity H J = rootFidelity J H := by + dsimp [rootFidelity] + rw [← traceNorm_conjTranspose, Matrix.conjTranspose_mul, + (CFC.sqrt_nonneg H).posSemidef.isHermitian.eq, + (CFC.sqrt_nonneg J).posSemidef.isHermitian.eq] + +lemma rootFidelity_transpose {H J : Matrix ι ι ℂ} (hH : H.PosSemidef) (hJ : J.PosSemidef) : + rootFidelity Hᵀ Jᵀ = rootFidelity H J := by + dsimp [rootFidelity] + rw [sqrt_transpose hH, sqrt_transpose hJ, ← Matrix.transpose_mul, traceNorm_transpose] + exact rootFidelity_symm J H + +lemma eveBlock_positive (R : Matrix ι ι ℂ) {D : Matrix ι ι ℂ} (hD : D.PosSemidef) : + (eveBlock R D).PosSemidef := by + apply Matrix.PosSemidef.transpose + simpa only [(CFC.sqrt_nonneg R).posSemidef.isHermitian.eq] using + hD.mul_mul_conjTranspose_same (CFC.sqrt R) + +lemma trace_eveBlock {R : Matrix ι ι ℂ} (hR : R.PosSemidef) (D : Matrix ι ι ℂ) : + trace (eveBlock R D) = trace (D*R) := by + rw [eveBlock, Matrix.trace_transpose, Matrix.trace_mul_cycle, + CFC.sqrt_mul_sqrt_self R hR.nonneg, Matrix.trace_mul_comm] + +lemma fidelity_eveBlock {R D₀ D₁ : Matrix ι ι ℂ} (hR : R.PosSemidef) + (hD₀ : D₀.PosSemidef) (hD₁ : D₁.PosSemidef) : + rootFidelity (eveBlock R D₀) (eveBlock R D₁) = + traceNorm (CFC.sqrt D₀ * R * CFC.sqrt D₁) := by + let A := CFC.sqrt D₀ * CFC.sqrt R + let B := CFC.sqrt D₁ * CFC.sqrt R + have hA : Aᴴ*A = CFC.sqrt R * D₀ * CFC.sqrt R := by + dsimp [A] + simp only [Matrix.conjTranspose_mul, (CFC.sqrt_nonneg R).posSemidef.isHermitian.eq, + (CFC.sqrt_nonneg D₀).posSemidef.isHermitian.eq] + rw [mul_assoc, ← mul_assoc (CFC.sqrt D₀), CFC.sqrt_mul_sqrt_self D₀ hD₀.nonneg, ← mul_assoc] + have hB : Bᴴ*B = CFC.sqrt R * D₁ * CFC.sqrt R := by + dsimp [B] + simp only [Matrix.conjTranspose_mul, (CFC.sqrt_nonneg R).posSemidef.isHermitian.eq, + (CFC.sqrt_nonneg D₁).posSemidef.isHermitian.eq] + rw [mul_assoc, ← mul_assoc (CFC.sqrt D₁), CFC.sqrt_mul_sqrt_self D₁ hD₁.nonneg, ← mul_assoc] + have hAB : A*Bᴴ = CFC.sqrt D₀ * R * CFC.sqrt D₁ := by + dsimp [A,B] + simp only [Matrix.conjTranspose_mul, (CFC.sqrt_nonneg R).posSemidef.isHermitian.eq, + (CFC.sqrt_nonneg D₁).posSemidef.isHermitian.eq] + rw [mul_assoc, ← mul_assoc (CFC.sqrt R), CFC.sqrt_mul_sqrt_self R hR.nonneg, ← mul_assoc] + rw [eveBlock, eveBlock, ← hA, ← hB, + rootFidelity_transpose (Matrix.posSemidef_conjTranspose_mul_self A) + (Matrix.posSemidef_conjTranspose_mul_self B), polar_fidelity, hAB] + +end + +section + +open scoped Matrix.Norms.L2Operator + +universe v8454_0 + +variable {ι : Type v8454_0} [inst8454_0 : Fintype ι] [inst8454_1 : DecidableEq ι] + +open scoped Matrix.Norms.L2Operator in +lemma continuous_traceNorm : Continuous (traceNorm : Matrix ι ι ℂ → ℝ) := by + have h : Continuous (CFC.abs : Matrix ι ι ℂ → Matrix ι ι ℂ) := CFC.continuous_abs + change Continuous (fun A : Matrix ι ι ℂ => (trace (CFC.abs A)).re) + unfold Matrix.trace Matrix.diag + fun_prop + +universe v8463_0 + +variable {Ω : Type v8463_0} [inst8463_0 : MeasurableSpace Ω] + +lemma measurable_traceNorm {F : Ω → Matrix ι ι ℂ} (hF : Measurable F) : + Measurable (fun t => traceNorm (F t)) := continuous_traceNorm.measurable.comp hF + +open scoped Matrix.Norms.L2Operator in +lemma measurable_sqrt_psd {F : Ω → Matrix ι ι ℂ} + (hF : Measurable F) (hpos : ∀ t, (F t).PosSemidef) : + Measurable (fun t => CFC.sqrt (F t)) := by + let G : Ω → {A : Matrix ι ι ℂ // 0 ≤ A} := fun t => ⟨F t,(hpos t).nonneg⟩ + have hG : Measurable G := hF.subtype_mk + have hC : Continuous (fun A : {A : Matrix ι ι ℂ // 0 ≤ A} => CFC.sqrt A.1) := + continuousOn_iff_continuous_domRestrict.mp CFC.continuousOn_sqrt + exact hC.measurable.comp hG + +lemma measurable_rootFidelity {F G : Ω → Matrix ι ι ℂ} + (hF : Measurable F) (hG : Measurable G) + (hFp : ∀ t, (F t).PosSemidef) (hGp : ∀ t, (G t).PosSemidef) : + Measurable (fun t => rootFidelity (F t) (G t)) := by + have h₁ := measurable_sqrt_psd hF hFp + have h₂ := measurable_sqrt_psd hG hGp + apply measurable_traceNorm + exact h₁.mul h₂ + +omit inst8454_1 in +lemma measurable_re_trace [DecidableEq ι] {F : Ω → Matrix ι ι ℂ} (hF : Measurable F) : + Measurable (fun t => (trace (F t)).re) := by + have h : Continuous (fun A : Matrix ι ι ℂ => (trace A).re) := by + unfold Matrix.trace Matrix.diag + fun_prop + exact h.measurable.comp hF + +lemma traceNorm_sub_le_trace {A B : Matrix ι ι ℂ} (hA : A.PosSemidef) (hB : B.PosSemidef) : + traceNorm (A-B) ≤ (trace A).re + (trace B).re := by + have h := traceNorm_add_le A (-B) + rwa [← sub_eq_add_neg, traceNorm_posSemidef hA, traceNorm_neg, traceNorm_posSemidef hB] at h + +lemma traceNorm_sub_integrable {μ : MeasureTheory.Measure Ω} {F G : Ω → Matrix ι ι ℂ} + (hF : Measurable F) (hG : Measurable G) + (hFp : ∀ t, (F t).PosSemidef) (hGp : ∀ t, (G t).PosSemidef) + (hFi : MeasureTheory.Integrable (fun t => (trace (F t)).re) μ) + (hGi : MeasureTheory.Integrable (fun t => (trace (G t)).re) μ) : + MeasureTheory.Integrable (fun t => traceNorm (F t-G t)) μ := by + apply (hFi.add hGi).mono' (measurable_traceNorm (hF.sub hG)).aestronglyMeasurable + exact Filter.Eventually.of_forall fun t => by + rw [Real.norm_of_nonneg (traceNorm_nonneg _)] + exact traceNorm_sub_le_trace (hFp t) (hGp t) + +end + +open MeasureTheory + +section + +universe v8517_0 + +variable {Ω : Type v8517_0} [inst8517_0 : MeasurableSpace Ω] {μ : Measure Ω} + +lemma memLp_sqrt {p : Ω → ℝ} (hp : Integrable p μ) (hp0 : ∀ t, 0 ≤ p t) : + MemLp (fun t => Real.sqrt (p t)) 2 μ := by + apply (memLp_two_iff_integrable_sq (hp.aemeasurable.sqrt.aestronglyMeasurable)).mpr + simpa only [Real.sq_sqrt (hp0 _)] using hp + +lemma sqrt_product_integrable {p q : Ω → ℝ} (hp : Integrable p μ) (hq : Integrable q μ) + (hp0 : ∀ t, 0 ≤ p t) (hq0 : ∀ t, 0 ≤ q t) : + Integrable (fun t => Real.sqrt (p t*q t)) μ := by + have hp₂ := memLp_sqrt hp hp0 + have hq₂ := memLp_sqrt hq hq0 + have h := hp₂.integrable_mul hq₂ + change Integrable (fun t => Real.sqrt (p t) * Real.sqrt (q t)) μ at h + simpa only [Real.sqrt_mul (hp0 _)] using h + +lemma integral_sqrt_product_le {p q : Ω → ℝ} (hp : Integrable p μ) (hq : Integrable q μ) + (hp0 : ∀ t, 0 ≤ p t) (hq0 : ∀ t, 0 ≤ q t) : + (∫ t, Real.sqrt (p t*q t) ∂μ) ≤ Real.sqrt ((∫ t, p t ∂μ)*(∫ t, q t ∂μ)) := by + have hp₂ := memLp_sqrt hp hp0 + have hq₂ := memLp_sqrt hq hq0 + have h := integral_mul_le_Lp_mul_Lq_of_nonneg (Real.HolderConjugate.two_two) + (Filter.Eventually.of_forall (fun t => Real.sqrt_nonneg (p t))) + (Filter.Eventually.of_forall (fun t => Real.sqrt_nonneg (q t))) (by simpa using hp₂) (by simpa using hq₂) + simp only [Real.rpow_two, Real.sq_sqrt (hp0 _), Real.sq_sqrt (hq0 _), + ← Real.sqrt_eq_rpow, ← Real.sqrt_mul (hp0 _)] at h + rw [Real.sqrt_mul (integral_nonneg hp0)] + exact h + +end + +section + +lemma uniform_gap_arithmetic {e η f : ℝ} (_he0 : 0 ≤ e) (heη : e ≤ η/2) + (hlower : (1-η)/2 ≤ f) (hupper : f ≤ Real.sqrt (e*(1-e))+e) : 1/5 ≤ η := by + by_contra h + have hη : η < 1/5 := lt_of_not_ge h + have he : e < 1/10 := by linarith + have hprod : e*(1-e) < (3/10 : ℝ)^2 := by + have h := mul_pos (sub_pos.mpr he) (show 0 < (9/10 : ℝ)-e by linarith) + nlinarith + have hs : Real.sqrt (e*(1-e)) < 3/10 := (Real.sqrt_lt' (by norm_num)).mpr hprod + linarith + +lemma two_term_root_cauchy {a b c d : ℝ} (ha : 0 ≤ a) (hb : 0 ≤ b) + (hc : 0 ≤ c) (hd : 0 ≤ d) : + Real.sqrt (a*b)+Real.sqrt (c*d) ≤ Real.sqrt ((a+d)*(b+c)) := by + have h₁ := Real.mul_self_sqrt (mul_nonneg ha hb) + have h₂ := Real.mul_self_sqrt (mul_nonneg hc hd) + have h₃ := Real.mul_self_sqrt (mul_nonneg ha hc) + have h₄ := Real.mul_self_sqrt (mul_nonneg hb hd) + have he : Real.sqrt (a*b)*Real.sqrt (c*d) = Real.sqrt (a*c)*Real.sqrt (b*d) := by + rw [← Real.sqrt_mul (mul_nonneg ha hb), ← Real.sqrt_mul (mul_nonneg ha hc)] + congr 1 + ring + apply (Real.le_sqrt (by positivity) (by positivity)).mpr + have h := sq_nonneg (Real.sqrt (a*c)-Real.sqrt (b*d)) + nlinarith + +lemma root_cross_le_sum {a b : ℝ} (ha : 0 ≤ a) (hb : 0 ≤ b) : + 2*Real.sqrt (a*b) ≤ a+b := by + have h := sq_nonneg (Real.sqrt a - Real.sqrt b) + rw [Real.sqrt_mul ha] + nlinarith [Real.mul_self_sqrt ha, Real.mul_self_sqrt hb] + +open scoped Matrix.Norms.L2Operator + +universe v8592_0 v8592_1 + +variable {ι : Type v8592_0} {Ω : Type v8592_1} [inst8592_0 : Fintype ι] [inst8592_1 : DecidableEq ι] [inst8592_2 : MeasurableSpace Ω] + +lemma rootFidelity_le_sqrt_trace {H J : Matrix ι ι ℂ} + (hH : H.PosSemidef) (hJ : J.PosSemidef) : + rootFidelity H J ≤ Real.sqrt ((trace H).re*(trace J).re) := by + have h := traceNorm_mul_conjTranspose_le (CFC.sqrt H) (CFC.sqrt J) + simpa only [(CFC.sqrt_nonneg H).posSemidef.isHermitian.eq, + (CFC.sqrt_nonneg J).posSemidef.isHermitian.eq, + CFC.sqrt_mul_sqrt_self H hH.nonneg, CFC.sqrt_mul_sqrt_self J hJ.nonneg, + rootFidelity] using h + +lemma rootFidelity_integrable {μ : Measure Ω} {F G : Ω → Matrix ι ι ℂ} + (hF : Measurable F) (hG : Measurable G) + (hFp : ∀ t, (F t).PosSemidef) (hGp : ∀ t, (G t).PosSemidef) + (hFi : Integrable (fun t => (trace (F t)).re) μ) + (hGi : Integrable (fun t => (trace (G t)).re) μ) : + Integrable (fun t => rootFidelity (F t) (G t)) μ := by + apply (sqrt_product_integrable hFi hGi (fun t => re_trace_nonneg (hFp t)) + (fun t => re_trace_nonneg (hGp t))).mono' + (measurable_rootFidelity hF hG hFp hGp).aestronglyMeasurable + exact Filter.Eventually.of_forall fun t => by + rw [Real.norm_of_nonneg (show 0 ≤ rootFidelity (F t) (G t) from traceNorm_nonneg _)] + exact rootFidelity_le_sqrt_trace (hFp t) (hGp t) + +lemma traceNorm_sub_triangle (A B C : Matrix ι ι ℂ) : + traceNorm (A-B) ≤ traceNorm (A-C)+traceNorm (B-C) := by + have h := traceNorm_add_le (A-C) (C-B) + rwa [sub_add_sub_cancel, traceNorm_sub_comm C B] at h + +lemma trace_difference_le_norm (A B : Matrix ι ι ℂ) : + (trace B).re-(trace A).re ≤ traceNorm (A-B) := by + have h := re_trace_le_traceNorm (B-A) + rwa [Matrix.trace_sub, Complex.sub_re, traceNorm_sub_comm B A] at h + +end + +section + +open scoped Matrix.Norms.L2Operator + +universe v8632_0 v8632_1 + +variable {ι : Type v8632_0} {Ω : Type v8632_1} [inst8632_0 : Fintype ι] [inst8632_1 : DecidableEq ι] [inst8632_2 : MeasurableSpace Ω] + +lemma density_uniform_gap {μ : Measure Ω} (τ : BitDensity μ ι) + (hcoherence : ∀ t, rootFidelity (τ.block false false t) (τ.block true true t) ≤ + Real.sqrt ((trace (τ.block false false t)).re*(trace (τ.block false true t)).re) + + Real.sqrt ((trace (τ.block true false t)).re*(trace (τ.block true true t)).re) + + 2*Real.sqrt ((trace (τ.block false true t)).re*(trace (τ.block true false t)).re)) + (σ : Ω → Matrix ι ι ℂ) (hσ : Measurable σ) (hσp : ∀ t, (σ t).PosSemidef) + (hσi : Integrable (fun t => (trace (σ t)).re) μ) + (hσn : (∫ t, (trace (σ t)).re ∂μ) = 1) : + 1/5 ≤ τ.idealBitError σ := by + let p := fun i j t => (trace (τ.block i j t)).re + let P := fun i j => τ.mass i j + let e := P false true + P true false + let f := ∫ t, rootFidelity (τ.block false false t) (τ.block true true t) ∂μ + let S := fun t => (1/2 : ℝ) • σ t + let q := ∫ t, traceNorm (τ.block false false t-τ.block true true t) ∂μ + let a₀ := ∫ t, traceNorm (τ.block false false t-S t) ∂μ + let a₁ := ∫ t, traceNorm (τ.block true true t-S t) ∂μ + have hp (i j : Bool) (t : Ω) : 0 ≤ p i j t := re_trace_nonneg (τ.positive i j t) + have hP (i j : Bool) : 0 ≤ P i j := integral_nonneg (hp i j) + have hPn : P false false + P false true+P true false+P true true=1 := τ.normalized + have hfi : Integrable (fun t => rootFidelity (τ.block false false t) + (τ.block true true t)) μ := rootFidelity_integrable (τ.measurable _ _) (τ.measurable _ _) + (τ.positive _ _) (τ.positive _ _) (τ.integrable _ _) (τ.integrable _ _) + have h₁ := sqrt_product_integrable (τ.integrable false false) (τ.integrable false true) + (hp false false) (hp false true) + have h₂ := sqrt_product_integrable (τ.integrable true false) (τ.integrable true true) + (hp true false) (hp true true) + have h₃ := sqrt_product_integrable (τ.integrable false true) (τ.integrable true false) + (hp false true) (hp true false) + have hfupper : f ≤ Real.sqrt (P false false*P false true) + + Real.sqrt (P true false*P true true)+2*Real.sqrt (P false true*P true false) := by + have h := integral_mono hfi ((h₁.add h₂).add (h₃.const_mul 2)) hcoherence + rw [integral_add' (h₁.add h₂) (h₃.const_mul 2), integral_add' h₁ h₂, + integral_const_mul] at h + have hc₁ := integral_sqrt_product_le (τ.integrable false false) (τ.integrable false true) + (hp false false) (hp false true) + have hc₂ := integral_sqrt_product_le (τ.integrable true false) (τ.integrable true true) + (hp true false) (hp true true) + have hc₃ := integral_sqrt_product_le (τ.integrable false true) (τ.integrable true false) + (hp false true) (hp true false) + change _ ≤ Real.sqrt (P false false*P false true) at hc₁ + change _ ≤ Real.sqrt (P true false*P true true) at hc₂ + change _ ≤ Real.sqrt (P false true*P true false) at hc₃ + dsimp [f] + linarith + have hqi : Integrable (fun t => traceNorm (τ.block false false t-τ.block true true t)) μ := + traceNorm_sub_integrable (τ.measurable _ _) (τ.measurable _ _) (τ.positive _ _) + (τ.positive _ _) (τ.integrable _ _) (τ.integrable _ _) + have hSm : Measurable S := hσ.const_smul (1/2 : ℝ) + have hSp (t) : (S t).PosSemidef := (hσp t).smul (show (0:ℝ) ≤ 1/2 by norm_num) + have hSt (t) : (trace (S t)).re = (1/2 : ℝ)*(trace (σ t)).re := by + simp only [S, Matrix.trace_smul, Complex.real_smul, Complex.mul_re, + Complex.ofReal_re, Complex.ofReal_im, zero_mul, sub_zero] + have hSi : Integrable (fun t => (trace (S t)).re) μ := by + simpa only [hSt] using hσi.const_mul (1/2) + have hSn : (∫ t, (trace (S t)).re ∂μ) = 1/2 := by + simp only [hSt, integral_const_mul, hσn, mul_one] + have ha₀i := traceNorm_sub_integrable (τ.measurable false false) hSm + (τ.positive false false) hSp (τ.integrable false false) hSi + have ha₁i := traceNorm_sub_integrable (τ.measurable true true) hSm + (τ.positive true true) hSp (τ.integrable true true) hSi + have hq : q ≤ a₀+a₁ := by + have h := integral_mono hqi (ha₀i.add ha₁i) (fun t => + traceNorm_sub_triangle (τ.block false false t) (τ.block true true t) (S t)) + rwa [integral_add' ha₀i ha₁i] at h + have ha₀ : 1/2-P false false ≤ a₀ := by + have h := integral_mono (hSi.sub (τ.integrable false false)) ha₀i + (fun t => trace_difference_le_norm (τ.block false false t) (S t)) + rwa [integral_sub' hSi (τ.integrable false false), hSn] at h + have ha₁ : 1/2-P true true ≤ a₁ := by + have h := integral_mono (hSi.sub (τ.integrable true true)) ha₁i + (fun t => trace_difference_le_norm (τ.block true true t) (S t)) + rwa [integral_sub' hSi (τ.integrable true true), hSn] at h + have hflower : (P false false+P true true-q)/2 ≤ f := by + have hi := ((τ.integrable false false).add (τ.integrable true true)).sub hqi + have h := integral_mono (hi.div_const 2) hfi (fun t => + fidelity_lower (τ.positive false false t) (τ.positive true true t)) + rwa [integral_div, integral_sub' ((τ.integrable false false).add + (τ.integrable true true)) hqi, integral_add' (τ.integrable false false) + (τ.integrable true true)] at h + have he0 : 0 ≤ e := add_nonneg (hP _ _) (hP _ _) + have hη : τ.idealBitError σ = e+a₀+a₁ := rfl + have heη : e ≤ τ.idealBitError σ/2 := by rw [hη]; dsimp [e]; linarith + have hlow : (1-τ.idealBitError σ)/2 ≤ f := by rw [hη]; dsimp [e]; linarith + have hup : f ≤ Real.sqrt (e*(1-e))+e := by + have hc := two_term_root_cauchy (hP false false) (hP false true) + (hP true false) (hP true true) + have hx := root_cross_le_sum (hP false true) (hP true false) + have heq : (P false false+P true true)*(P false true+P true false)=e*(1-e) := by + have hn : P false false+P true true=1-e := by dsimp [e]; linarith + rw [hn] + exact mul_comm _ _ + rw [heq] at hc + change 2*Real.sqrt (P false true*P true false) ≤ e at hx + linarith + exact uniform_gap_arithmetic he0 heη hlow hup + +end + +open scoped Matrix.Norms.L2Operator + +universe v8764_0 + +theorem class_factor_density_uniform_gap {a b : ℕ} {Ω : Type v8764_0} [MeasurableSpace Ω] + {μ : Measure Ω} (R : Matrix (Fin a × Fin b) (Fin a × Fin b) ℂ) (hR : InClass R) + (τ : BitDensity μ (Fin a × Fin b)) (X : Bool → Ω → Mat a) (Y : Bool → Ω → Mat b) + (hX : ∀ i t, (X i t).PosSemidef) (hY : ∀ j t, (Y j t).PosSemidef) + (hblock : ∀ i j t, τ.block i j t = eveBlock R (X i t ⊗ₖ Y j t)) + (σ : Ω → Matrix (Fin a × Fin b) (Fin a × Fin b) ℂ) + (hσ : Measurable σ) (hσp : ∀ t, (σ t).PosSemidef) + (hσi : Integrable (fun t => (trace (σ t)).re) μ) + (hσn : (∫ t, (trace (σ t)).re ∂μ) = 1) : + 1/5 ≤ τ.idealBitError σ := by + apply density_uniform_gap τ _ σ hσ hσp hσi hσn + intro t + have ht (i j) : (trace (τ.block i j t)).re = weight R (X i t) (Y j t) := by + rw [hblock, trace_eveBlock hR.1.1] + rfl + simp only [ht] + rw [hblock, hblock, fidelity_eveBlock hR.1.1 ((hX false t).kronecker (hY false t)) + ((hX true t).kronecker (hY true t))] + exact four_effect_inequality R hR (X false t) (X true t) (Y false t) (Y true t) + (hX false t) (hX true t) (hY false t) (hY true t) + +end + +section + +open scoped ComplexOrder MatrixOrder Kronecker Matrix.Norms.L2Operator + +open Matrix MeasureTheory ProbabilityTheory + +universe v8797_0 v8797_1 + +variable {Ω : Type v8797_0} {ι : Type v8797_1} [inst8797_0 : MeasurableSpace Ω] [inst8797_1 : Fintype ι] [inst8797_2 : DecidableEq ι] + +omit inst8797_2 in +lemma real_trace_smul [DecidableEq ι] (r : ℝ) (A : Matrix ι ι ℂ) : + (trace (r • A)).re = r * (trace A).re := by + simp [Matrix.trace_smul,Complex.real_smul,Complex.mul_re] + +namespace BitDensity + +variable {μ ν : Measure Ω} [inst8804_0 : SigmaFinite μ] [inst8804_1 : SigmaFinite ν] + +def changeMeasure (τ : BitDensity μ ι) (hμν : μ ≪ ν) : BitDensity ν ι where + block i j t := (μ.rnDeriv ν t).toReal • τ.block i j t + positive i j t := (τ.positive i j t).smul ENNReal.toReal_nonneg + measurable i j := (Measure.measurable_rnDeriv μ ν).ennreal_toReal.smul (τ.measurable i j) + integrable i j := by + simp only [real_trace_smul] + exact (integrable_toReal_rnDeriv_mul_iff hμν).mpr (τ.integrable i j) + normalized := by + simp only [real_trace_smul,integral_toReal_rnDeriv_mul hμν] + exact τ.normalized + +lemma changeMeasure_mass (τ : BitDensity μ ι) (hμν : μ ≪ ν) (i j : Bool) : + (τ.changeMeasure hμν).mass i j = τ.mass i j := by + simp only [mass,changeMeasure,real_trace_smul,integral_toReal_rnDeriv_mul hμν] + +lemma changeMeasure_idealBitError (τ : BitDensity μ ι) (hμν : μ ≪ ν) + (σ : Ω → Matrix ι ι ℂ) : + (τ.changeMeasure hμν).idealBitError (fun t => (μ.rnDeriv ν t).toReal • σ t) = + τ.idealBitError σ := by + have he (A B : Matrix ι ι ℂ) (r : ℝ) (hr : 0 ≤ r) : + traceNorm (r • A - (1/2 : ℝ) • (r • B)) = r * traceNorm (A - (1/2 : ℝ) • B) := by + rw [smul_comm (1/2 : ℝ) r B, ← smul_sub, traceNorm_smul_nonneg _ hr] + simp only [idealBitError,changeMeasure_mass] + simp only [changeMeasure,he _ _ _ ENNReal.toReal_nonneg, + integral_toReal_rnDeriv_mul hμν] + +end BitDensity + +lemma eveBlock_smul_local {a b : ℕ} (R : Matrix (Fin a × Fin b) (Fin a × Fin b) ℂ) + (X : Mat a) (Y : Mat b) (r : ℝ) : + eveBlock R ((r • X) ⊗ₖ Y) = r • eveBlock R (X ⊗ₖ Y) := by + simp only [eveBlock, Matrix.smul_kronecker,Matrix.mul_smul,smul_mul_assoc, + Matrix.transpose_smul] + +theorem class_factor_gap_dominating_measure {a b : ℕ} + {μ ν : Measure Ω} [SigmaFinite μ] [SigmaFinite ν] + (hμν : μ ≪ ν) + (R : Matrix (Fin a × Fin b) (Fin a × Fin b) ℂ) (hR : InClass R) + (τ : BitDensity μ (Fin a × Fin b)) (X : Bool → Ω → Mat a) (Y : Bool → Ω → Mat b) + (hX : ∀ i t, (X i t).PosSemidef) (hY : ∀ j t, (Y j t).PosSemidef) + (hblock : ∀ i j t, τ.block i j t = eveBlock R (X i t ⊗ₖ Y j t)) + (σ : Ω → Matrix (Fin a × Fin b) (Fin a × Fin b) ℂ) + (hσ : Measurable σ) (hσp : ∀ t, (σ t).PosSemidef) + (hσi : Integrable (fun t => (trace (σ t)).re) ν) + (hσn : (∫ t, (trace (σ t)).re ∂ν) = 1) : + 1/5 ≤ (τ.changeMeasure hμν).idealBitError σ := by + apply class_factor_density_uniform_gap R hR (τ.changeMeasure hμν) + (fun i t => (μ.rnDeriv ν t).toReal • X i t) Y + (fun i t => (hX i t).smul ENNReal.toReal_nonneg) hY + _ σ hσ hσp hσi hσn + intro i j t + change (μ.rnDeriv ν t).toReal • τ.block i j t = _ + rw [hblock,eveBlock_smul_local] + +end + +section + +open Matrix MeasureTheory ProbabilityTheory Function unitInterval Filter + +open scoped ComplexOrder MatrixOrder Matrix.Norms.L2Operator Kronecker + +open UnrestrictedQuantum + +universe v8979_0 v8979_1 v8979_2 v8979_3 v8979_4 v8979_5 v8979_6 v8979_7 v8979_8 v8979_9 + +variable {O : Type v8979_0} {M : Type v8979_1} {ι : Type v8979_2} {η : Type v8979_3} [inst8979_0 : MeasurableSpace O] [inst8979_1 : MeasurableSpace M] + [inst8979_2 : StandardBorelSpace O] [inst8979_3 : Nonempty O] [inst8979_4 : StandardBorelSpace M] [inst8979_5 : Nonempty M] + [inst8979_6 : Fintype ι] [inst8979_7 : Fintype η] [inst8979_8 : DecidableEq ι] [inst8979_9 : DecidableEq η] + (d : Discussion O M) + (A : ℕ → Type v8979_4) (B : ℕ → Type v8979_5) + [inst8979_10 : ∀ n, AddCommGroup (A n)] [inst8979_11 : ∀ n, Module ℂ (A n)] [inst8979_12 : ∀ n, One (A n)] [inst8979_13 : ∀ n, LE (A n)] + [inst8979_14 : ∀ n, AddCommGroup (B n)] [inst8979_15 : ∀ n, Module ℂ (B n)] [inst8979_16 : ∀ n, One (B n)] [inst8979_17 : ∀ n, LE (B n)] + (TA : Type v8979_6) (TB : Type v8979_7) (CA : Type v8979_8) (CB : Type v8979_9) + [inst8979_18 : AddCommGroup TA] [inst8979_19 : Module ℂ TA] [inst8979_20 : One TA] [inst8979_21 : LE TA] + [inst8979_22 : AddCommGroup TB] [inst8979_23 : Module ℂ TB] [inst8979_24 : One TB] [inst8979_25 : LE TB] + [inst8979_26 : AddCommGroup CA] [inst8979_27 : Module ℂ CA] [inst8979_28 : One CA] [inst8979_29 : LE CA] + [inst8979_30 : AddCommGroup CB] [inst8979_31 : Module ℂ CB] [inst8979_32 : One CB] [inst8979_33 : LE CB] + +variable {d A B TA TB CA CB} + +namespace BitProtocol + +variable (p : BitProtocol (ι := ι) (η := η) d A B TA TB CA CB) + +lemma canonicalOutput_event (R : Matrix (ι × η) (ι × η) ℂ) + (i j : Bool) (S : Set (ℕ → M)) (hS : MeasurableSet S) : + (p.canonicalOutput R i j).value S = + ∫ x in d.sampler.publicRecord ⁻¹' S, + preparationFilter R * p.completeReference i j x * (preparationFilter R)ᴴ ∂d.probeLaw := by + rw [canonicalOutput,PositiveMatrixMeasure.filter_value,p.probeOutput_event i j S hS, + integral_filter _ (p.completeReference_integrable i j).integrableOn] + +end BitProtocol + +end + +section + +open scoped ComplexOrder MatrixOrder Kronecker Matrix.Norms.L2Operator + +open Matrix MeasureTheory ProbabilityTheory Filter + +universe v9125_0 v9125_1 + +variable {ι : Type v9125_0} {Ω : Type v9125_1} [inst9125_0 : Fintype ι] [inst9125_1 : DecidableEq ι] [inst9125_2 : MeasurableSpace Ω] + +lemma density_uniform_gap_ae {μ : Measure Ω} (τ : BitDensity μ ι) + (hcoherence : ∀ᵐ t ∂μ, rootFidelity (τ.block false false t) (τ.block true true t) ≤ + Real.sqrt ((trace (τ.block false false t)).re*(trace (τ.block false true t)).re) + + Real.sqrt ((trace (τ.block true false t)).re*(trace (τ.block true true t)).re) + + 2*Real.sqrt ((trace (τ.block false true t)).re*(trace (τ.block true false t)).re)) + (σ : Ω → Matrix ι ι ℂ) (hσ : Measurable σ) (hσp : ∀ t, (σ t).PosSemidef) + (hσi : Integrable (fun t => (trace (σ t)).re) μ) + (hσn : (∫ t, (trace (σ t)).re ∂μ) = 1) : + 1/5 ≤ τ.idealBitError σ := by + let p := fun i j t => (trace (τ.block i j t)).re + let P := fun i j => τ.mass i j + let e := P false true + P true false + let f := ∫ t, rootFidelity (τ.block false false t) (τ.block true true t) ∂μ + let S := fun t => (1/2 : ℝ) • σ t + let q := ∫ t, traceNorm (τ.block false false t-τ.block true true t) ∂μ + let a₀ := ∫ t, traceNorm (τ.block false false t-S t) ∂μ + let a₁ := ∫ t, traceNorm (τ.block true true t-S t) ∂μ + have hp (i j : Bool) (t : Ω) : 0 ≤ p i j t := re_trace_nonneg (τ.positive i j t) + have hP (i j : Bool) : 0 ≤ P i j := integral_nonneg (hp i j) + have hPn : P false false + P false true+P true false+P true true=1 := τ.normalized + have hfi : Integrable (fun t => rootFidelity (τ.block false false t) + (τ.block true true t)) μ := rootFidelity_integrable (τ.measurable _ _) (τ.measurable _ _) + (τ.positive _ _) (τ.positive _ _) (τ.integrable _ _) (τ.integrable _ _) + have h₁ := sqrt_product_integrable (τ.integrable false false) (τ.integrable false true) + (hp false false) (hp false true) + have h₂ := sqrt_product_integrable (τ.integrable true false) (τ.integrable true true) + (hp true false) (hp true true) + have h₃ := sqrt_product_integrable (τ.integrable false true) (τ.integrable true false) + (hp false true) (hp true false) + have hfupper : f ≤ Real.sqrt (P false false*P false true) + + Real.sqrt (P true false*P true true)+2*Real.sqrt (P false true*P true false) := by + have h := integral_mono_ae hfi ((h₁.add h₂).add (h₃.const_mul 2)) hcoherence + rw [integral_add' (h₁.add h₂) (h₃.const_mul 2), integral_add' h₁ h₂, + integral_const_mul] at h + have hc₁ := integral_sqrt_product_le (τ.integrable false false) (τ.integrable false true) + (hp false false) (hp false true) + have hc₂ := integral_sqrt_product_le (τ.integrable true false) (τ.integrable true true) + (hp true false) (hp true true) + have hc₃ := integral_sqrt_product_le (τ.integrable false true) (τ.integrable true false) + (hp false true) (hp true false) + change _ ≤ Real.sqrt (P false false*P false true) at hc₁ + change _ ≤ Real.sqrt (P true false*P true true) at hc₂ + change _ ≤ Real.sqrt (P false true*P true false) at hc₃ + dsimp [f] + linarith + have hqi : Integrable (fun t => traceNorm (τ.block false false t-τ.block true true t)) μ := + traceNorm_sub_integrable (τ.measurable _ _) (τ.measurable _ _) (τ.positive _ _) + (τ.positive _ _) (τ.integrable _ _) (τ.integrable _ _) + have hSm : Measurable S := hσ.const_smul (1/2 : ℝ) + have hSp (t) : (S t).PosSemidef := (hσp t).smul (show (0:ℝ) ≤ 1/2 by norm_num) + have hSt (t) : (trace (S t)).re = (1/2 : ℝ)*(trace (σ t)).re := by + simp only [S, Matrix.trace_smul, Complex.real_smul, Complex.mul_re, + Complex.ofReal_re, Complex.ofReal_im, zero_mul, sub_zero] + have hSi : Integrable (fun t => (trace (S t)).re) μ := by + simpa only [hSt] using hσi.const_mul (1/2) + have hSn : (∫ t, (trace (S t)).re ∂μ) = 1/2 := by + simp only [hSt, integral_const_mul, hσn, mul_one] + have ha₀i := traceNorm_sub_integrable (τ.measurable false false) hSm + (τ.positive false false) hSp (τ.integrable false false) hSi + have ha₁i := traceNorm_sub_integrable (τ.measurable true true) hSm + (τ.positive true true) hSp (τ.integrable true true) hSi + have hq : q ≤ a₀+a₁ := by + have h := integral_mono hqi (ha₀i.add ha₁i) (fun t => + traceNorm_sub_triangle (τ.block false false t) (τ.block true true t) (S t)) + rwa [integral_add' ha₀i ha₁i] at h + have ha₀ : 1/2-P false false ≤ a₀ := by + have h := integral_mono (hSi.sub (τ.integrable false false)) ha₀i + (fun t => trace_difference_le_norm (τ.block false false t) (S t)) + rwa [integral_sub' hSi (τ.integrable false false), hSn] at h + have ha₁ : 1/2-P true true ≤ a₁ := by + have h := integral_mono (hSi.sub (τ.integrable true true)) ha₁i + (fun t => trace_difference_le_norm (τ.block true true t) (S t)) + rwa [integral_sub' hSi (τ.integrable true true), hSn] at h + have hflower : (P false false+P true true-q)/2 ≤ f := by + have hi := ((τ.integrable false false).add (τ.integrable true true)).sub hqi + have h := integral_mono (hi.div_const 2) hfi (fun t => + fidelity_lower (τ.positive false false t) (τ.positive true true t)) + rwa [integral_div, integral_sub' ((τ.integrable false false).add + (τ.integrable true true)) hqi, integral_add' (τ.integrable false false) + (τ.integrable true true)] at h + have he0 : 0 ≤ e := add_nonneg (hP _ _) (hP _ _) + have hη : τ.idealBitError σ = e+a₀+a₁ := rfl + have heη : e ≤ τ.idealBitError σ/2 := by rw [hη]; dsimp [e]; linarith + have hlow : (1-τ.idealBitError σ)/2 ≤ f := by rw [hη]; dsimp [e]; linarith + have hup : f ≤ Real.sqrt (e*(1-e))+e := by + have hc := two_term_root_cauchy (hP false false) (hP false true) + (hP true false) (hP true true) + have hx := root_cross_le_sum (hP false true) (hP true false) + have heq : (P false false+P true true)*(P false true+P true false)=e*(1-e) := by + have hn : P false false+P true true=1-e := by dsimp [e]; linarith + rw [hn] + exact mul_comm _ _ + rw [heq] at hc + change 2*Real.sqrt (P false true*P true false) ≤ e at hx + linarith + exact uniform_gap_arithmetic he0 heη hlow hup + +end + +section + +open Matrix MeasureTheory ProbabilityTheory Filter + +open scoped ComplexOrder MatrixOrder Matrix.Norms.L2Operator Kronecker + +namespace PositiveMatrixMeasure + +universe v9319_0 v9319_1 + +variable {Ω : Type v9319_0} {ι : Type v9319_1} [inst9319_0 : MeasurableSpace Ω] [inst9319_1 : Fintype ι] [inst9319_2 : DecidableEq ι] + (W : PositiveMatrixMeasure Ω ι) (μ : Measure Ω) [inst9319_3 : SigmaFinite μ] + +lemma integral_density + (hAC : ∀ S, MeasurableSet S → μ S = 0 → W.value S = 0) + (S : Set Ω) (hS : MeasurableSet S) : + (∫ t in S, W.density μ t ∂μ) = W.value S := by + ext i j + let L := (Matrix.entryLinearMap ℂ ℂ i j).toContinuousLinearMap + have he := L.integral_comp_comm ((W.integrable_density μ).integrableOn (s := S)) + exact he.symm.trans (W.integral_density_entry μ hAC S hS i j) + +lemma density_eq_ae {F : Ω → Matrix ι ι ℂ} (hF : Integrable F μ) + (he : ∀ S, MeasurableSet S → W.value S = ∫ t in S, F t ∂μ) : + W.density μ =ᵐ[μ] F := by + have hAC : ∀ S, MeasurableSet S → μ S = 0 → W.value S = 0 := by + intro S hS hz + rw [he S hS,Measure.restrict_eq_zero.mpr hz,integral_zero_measure] + apply Integrable.ae_eq_of_forall_setIntegral_eq _ _ (W.integrable_density μ) hF + intro S hS hfin + exact (W.integral_density μ hAC S hS).trans (he S hS) + +lemma positiveDensity_eq_ae {F : Ω → Matrix ι ι ℂ} (hF : Integrable F μ) + (he : ∀ S, MeasurableSet S → W.value S = ∫ t in S, F t ∂μ) : + W.positiveDensity μ =ᵐ[μ] F := by + have hAC : ∀ S, MeasurableSet S → μ S = 0 → W.value S = 0 := by + intro S hS hz + rw [he S hS,Measure.restrict_eq_zero.mpr hz,integral_zero_measure] + exact (W.positiveDensity_ae μ hAC).trans (W.density_eq_ae μ hF he) + +lemma positiveDensity_trace_eq_one (hW : (trace (W.value Set.univ)).re = 1) : + (∫ t, (trace (W.positiveDensity W.traceMeasure t)).re ∂W.traceMeasure) = 1 := by + rw [W.integral_positiveDensity_trace _ (W.value_zero_of_traceMeasure_zero)] + exact hW + +lemma positiveDensity_integrable + (hAC : ∀ S, MeasurableSet S → μ S = 0 → W.value S = 0) : + Integrable (W.positiveDensity μ) μ := + (W.integrable_density μ).congr (W.positiveDensity_ae μ hAC).symm + +lemma positiveDensity_integral + (hAC : ∀ S, MeasurableSet S → μ S = 0 → W.value S = 0) + (S : Set Ω) (hS : MeasurableSet S) : + (∫ t in S, W.positiveDensity μ t ∂μ) = W.value S := by + rw [integral_congr_ae (ae_restrict_of_ae (W.positiveDensity_ae μ hAC))] + exact W.integral_density μ hAC S hS + +lemma positiveDensity_changeMeasure (ν : Measure Ω) [SigmaFinite ν] + (hμν : μ ≪ ν) + (hAC : ∀ S, MeasurableSet S → μ S = 0 → W.value S = 0) : + W.positiveDensity ν =ᵐ[ν] fun t => (μ.rnDeriv ν t).toReal • W.positiveDensity μ t := by + apply W.positiveDensity_eq_ae ν + ((integrable_rnDeriv_smul_iff hμν).mpr (W.positiveDensity_integrable μ hAC)) + intro S hS + rw [setIntegral_rnDeriv_smul hμν hS,W.positiveDensity_integral μ hAC S hS] + +end PositiveMatrixMeasure + +namespace BitDensity + +universe v9378_0 v9378_1 + +variable {Ω : Type v9378_0} {ι : Type v9378_1} [inst9378_0 : MeasurableSpace Ω] [inst9378_1 : Fintype ι] [inst9378_2 : DecidableEq ι] + {μ : Measure Ω} + +lemma idealBitError_congr (τ υ : BitDensity μ ι) (σ θ : Ω → Matrix ι ι ℂ) + (hτ : ∀ i j, τ.block i j =ᵐ[μ] υ.block i j) (hσ : σ =ᵐ[μ] θ) : + τ.idealBitError σ = υ.idealBitError θ := by + have hm (i j : Bool) : τ.mass i j = υ.mass i j := by + apply integral_congr_ae + filter_upwards [hτ i j] with t ht + rw [ht] + have hd (i : Bool) : + (∫ t, traceNorm (τ.block i i t - (1/2 : ℝ) • σ t) ∂μ) = + ∫ t, traceNorm (υ.block i i t - (1/2 : ℝ) • θ t) ∂μ := by + apply integral_congr_ae + filter_upwards [hτ i i,hσ] with t ht hs + rw [ht,hs] + simp only [idealBitError,hm,hd] + +end BitDensity + +end + +section + +open Matrix MeasureTheory ProbabilityTheory Function unitInterval Filter + +open scoped ComplexOrder MatrixOrder Matrix.Norms.L2Operator Kronecker + +open UnrestrictedQuantum + +universe v9409_0 v9409_1 v9409_2 v9409_3 v9409_4 v9409_5 v9409_6 v9409_7 v9409_8 v9409_9 + +variable {O : Type v9409_0} {M : Type v9409_1} {ι : Type v9409_2} {η : Type v9409_3} [inst9409_0 : MeasurableSpace O] [inst9409_1 : MeasurableSpace M] + [inst9409_2 : StandardBorelSpace O] [inst9409_3 : Nonempty O] [inst9409_4 : StandardBorelSpace M] [inst9409_5 : Nonempty M] + [inst9409_6 : Fintype ι] [inst9409_7 : Fintype η] [inst9409_8 : DecidableEq ι] [inst9409_9 : DecidableEq η] + [inst9409_10 : Nonempty ι] [inst9409_11 : Nonempty η] + {d : Discussion O M} {A : ℕ → Type v9409_4} {B : ℕ → Type v9409_5} + [inst9409_12 : ∀ n, AddCommGroup (A n)] [inst9409_13 : ∀ n, Module ℂ (A n)] [inst9409_14 : ∀ n, One (A n)] [inst9409_15 : ∀ n, LE (A n)] + [inst9409_16 : ∀ n, AddCommGroup (B n)] [inst9409_17 : ∀ n, Module ℂ (B n)] [inst9409_18 : ∀ n, One (B n)] [inst9409_19 : ∀ n, LE (B n)] + {TA : Type v9409_6} {TB : Type v9409_7} {CA : Type v9409_8} {CB : Type v9409_9} + [inst9409_20 : AddCommGroup TA] [inst9409_21 : Module ℂ TA] [inst9409_22 : One TA] [inst9409_23 : LE TA] + [inst9409_24 : AddCommGroup TB] [inst9409_25 : Module ℂ TB] [inst9409_26 : One TB] [inst9409_27 : LE TB] + [inst9409_28 : AddCommGroup CA] [inst9409_29 : Module ℂ CA] [inst9409_30 : One CA] [inst9409_31 : LE CA] + [inst9409_32 : AddCommGroup CB] [inst9409_33 : Module ℂ CB] [inst9409_34 : One CB] [inst9409_35 : LE CB] + +namespace BitProtocol + +variable (p : BitProtocol (ι := ι) (η := η) d A B TA TB CA CB) + (R : Matrix (ι × η) (ι × η) ℂ) (hR : Density R) + +include hR + +lemma canonicalOutput_ac (i j : Bool) (S : Set (ℕ → M)) (hS : MeasurableSet S) + (hnull : d.transcriptLaw S = 0) : (p.canonicalOutput R i j).value S = 0 := by + obtain ⟨τ,X,Y,hX,hY,hτ,hi,he⟩ := p.canonical_density_representation R hR + rw [he i j S hS,Measure.restrict_eq_zero.mpr hnull,integral_zero_measure] + +def outputDensity (ν : Measure (ℕ → M)) [SigmaFinite ν] + (hμν : d.transcriptLaw ≪ ν) : BitDensity ν (ι × η) := + PositiveMatrixMeasure.toBitDensity (p.canonicalOutput R) ν + (fun i j S hS hz => p.canonicalOutput_ac R hR i j S hS (hμν hz)) + (p.canonicalOutput_normalized R hR) + +lemma outputDensity_eq (ν : Measure (ℕ → M)) [SigmaFinite ν] + (hμν : d.transcriptLaw ≪ ν) + (τ : BitDensity d.transcriptLaw (ι × η)) + (hi : ∀ i j, Integrable (τ.block i j) d.transcriptLaw) + (he : ∀ i j S, MeasurableSet S → (p.canonicalOutput R i j).value S = + ∫ t in S, τ.block i j t ∂d.transcriptLaw) (i j : Bool) : + (p.outputDensity R hR ν hμν).block i j =ᵐ[ν] (τ.changeMeasure hμν).block i j := by + apply (p.canonicalOutput R i j).positiveDensity_eq_ae ν + ((integrable_rnDeriv_smul_iff hμν).mpr (hi i j)) + intro S hS + rw [setIntegral_rnDeriv_smul hμν hS,he i j S hS] + +def secretBitError (sigma : PositiveMatrixMeasure (ℕ → M) (ι × η)) : ℝ := + (p.outputDensity R hR (d.transcriptLaw + sigma.traceMeasure) + (Measure.AbsolutelyContinuous.rfl.add_right _)).idealBitError + (sigma.positiveDensity (d.transcriptLaw + sigma.traceMeasure)) + +end BitProtocol + +theorem BitProtocol.uniform_gap {a b : ℕ} [Nonempty (Fin a)] [Nonempty (Fin b)] + (p : BitProtocol (ι := Fin a) (η := Fin b) d A B TA TB CA CB) + (R : Matrix (Fin a × Fin b) (Fin a × Fin b) ℂ) (hR : InClass R) + (sigma : PositiveMatrixMeasure (ℕ → M) (Fin a × Fin b)) + (hsigma : (trace (sigma.value Set.univ)).re = 1) : + 1/5 ≤ p.secretBitError R hR.1 sigma := by + let ν := d.transcriptLaw + sigma.traceMeasure + have hμν : d.transcriptLaw ≪ ν := Measure.AbsolutelyContinuous.rfl.add_right _ + have hsν : sigma.traceMeasure ≪ ν := Measure.AbsolutelyContinuous.rfl.add_right' _ + have hsAC (S : Set (ℕ → M)) (hS : MeasurableSet S) (hz : ν S = 0) : + sigma.value S = 0 := sigma.value_zero_of_traceMeasure_zero S hS (hsν hz) + obtain ⟨τ,X,Y,hX,hY,hτ,hi,he⟩ := p.canonical_density_representation R hR.1 + have hg := class_factor_gap_dominating_measure hμν R hR τ X Y hX hY hτ + (sigma.positiveDensity ν) (sigma.measurable_positiveDensity ν) + (sigma.positiveDensity_pos ν) (sigma.integrable_positiveDensity_trace ν hsAC) + ((sigma.integral_positiveDensity_trace ν hsAC).trans hsigma) + have heq := BitDensity.idealBitError_congr (p.outputDensity R hR.1 ν hμν) + (τ.changeMeasure hμν) (sigma.positiveDensity ν) (sigma.positiveDensity ν) + (p.outputDensity_eq R hR.1 ν hμν τ hi he) Filter.EventuallyEq.rfl + change 1/5 ≤ (p.outputDensity R hR.1 ν hμν).idealBitError (sigma.positiveDensity ν) + rw [heq] + exact hg + +end + +section + +open Matrix + +open scoped ComplexOrder MatrixOrder Kronecker Matrix.Norms.L2Operator CFC + +universe v9542_0 v9542_1 + +theorem traceNorm_positive_tracePreserving {ι : Type v9542_0} {κ : Type v9542_1} + [Fintype ι] [Fintype κ] [DecidableEq ι] [DecidableEq κ] + (L : Matrix ι ι ℂ →ₗ[ℂ] Matrix κ κ ℂ) + (hpos : ∀ A, A.PosSemidef → (L A).PosSemidef) + (htr : ∀ A, trace (L A) = trace A) + (A : Matrix ι ι ℂ) (hA : A.IsHermitian) : + traceNorm (L A) ≤ traceNorm A := by + have hsa : IsSelfAdjoint A := hA + have hp : A⁺.PosSemidef := (CFC.posPart_nonneg A).posSemidef + have hn : A⁻.PosSemidef := (CFC.negPart_nonneg A).posSemidef + have hd := CFC.posPart_sub_negPart A hsa + have ha := CFC.posPart_add_negPart A hsa + calc + traceNorm (L A) = traceNorm (L A⁺ + -(L A⁻)) := by conv_lhs => rw [← hd,map_sub,sub_eq_add_neg] + _ ≤ traceNorm (L A⁺) + traceNorm (-(L A⁻)) := traceNorm_add_le _ _ + _ = (trace A⁺).re + (trace A⁻).re := by + rw [traceNorm_neg,traceNorm_posSemidef (hpos _ hp), + traceNorm_posSemidef (hpos _ hn),htr,htr] + _ = traceNorm A := by + rw [← Complex.add_re,← Matrix.trace_add,ha] + rfl + +end + +section + +open Matrix MeasureTheory + +open scoped ComplexOrder MatrixOrder Matrix.Norms.L2Operator + +section + +universe v9577_0 v9577_1 v9577_2 + +variable {ι : Type v9577_0} {α : Type v9577_1} {Λ : Type v9577_2} [inst9577_0 : Fintype ι] [inst9577_1 : DecidableEq ι] + +lemma traceNorm_sum_le (s : Finset α) (A : α → Matrix ι ι ℂ) : + traceNorm (∑ a ∈ s, A a) ≤ ∑ a ∈ s, traceNorm (A a) := by + classical + induction s using Finset.induction_on with + | empty => simp [traceNorm] + | @insert a s ha ih => + simp only [Finset.sum_insert ha] + exact (traceNorm_add_le _ _).trans (add_le_add le_rfl ih) + +variable [inst9588_0 : Fintype Λ] [inst9588_1 : DecidableEq Λ] + +def firstBitBlocks (W : (Bool × Λ) → (Bool × Λ) → Matrix ι ι ℂ) : + Bool → Bool → Matrix ι ι ℂ := fun i j => ∑ a, ∑ b, W (i,a) (j,b) + +omit inst9588_1 in +theorem firstBit_traceNorm_contracts [DecidableEq Λ] + (W V : (Bool × Λ) → (Bool × Λ) → Matrix ι ι ℂ) : + (∑ i, ∑ j, traceNorm (firstBitBlocks W i j - firstBitBlocks V i j)) ≤ + ∑ a, ∑ b, traceNorm (W a b - V a b) := by + have hb (i j : Bool) : + traceNorm (firstBitBlocks W i j - firstBitBlocks V i j) ≤ + ∑ a, ∑ b, traceNorm (W (i,a) (j,b) - V (i,a) (j,b)) := by + unfold firstBitBlocks + simp_rw [← Finset.sum_sub_distrib] + exact (traceNorm_sum_le Finset.univ _).trans + (Finset.sum_le_sum fun a _ => traceNorm_sum_le Finset.univ _) + calc + _ ≤ ∑ i : Bool, ∑ j : Bool, ∑ a : Λ, ∑ b : Λ, + traceNorm (W (i,a) (j,b) - V (i,a) (j,b)) := + Finset.sum_le_sum fun i _ => Finset.sum_le_sum fun j _ => hb i j + _ = _ := by + simp only [Fintype.sum_prod_type] + apply Finset.sum_congr rfl + intro i _ + rw [Finset.sum_comm] + +def idealKeyBlocks (σ : Matrix ι ι ℂ) : (Bool × Λ) → (Bool × Λ) → Matrix ι ι ℂ := + fun a b => if a=b then (1/(2*(Fintype.card Λ : ℝ))) • σ else 0 + +omit inst9577_0 inst9577_1 in +lemma firstBit_idealKey [Fintype ι] [DecidableEq ι] [Nonempty Λ] (σ : Matrix ι ι ℂ) (i j : Bool) : + firstBitBlocks (idealKeyBlocks (Λ := Λ) σ) i j = + if i=j then (1/2 : ℝ) • σ else 0 := by + classical + by_cases hij : i=j + · subst j + simp only [firstBitBlocks,idealKeyBlocks,Prod.mk.injEq,true_and,ite_true] + simp only [Finset.sum_ite_eq,Finset.mem_univ,ite_true,Finset.sum_const,Finset.card_univ] + rw [← Nat.cast_smul_eq_nsmul ℝ,smul_smul] + have hn : (Fintype.card Λ : ℝ) ≠ 0 := by exact_mod_cast Fintype.card_ne_zero + congr 1 + field_simp + · simp [firstBitBlocks,idealKeyBlocks,hij,Prod.mk.injEq] + +end + +section + +universe v9649_0 v9649_1 + +variable {Ω : Type v9649_0} {ι : Type v9649_1} [inst9649_0 : MeasurableSpace Ω] [inst9649_1 : Fintype ι] [inst9649_2 : DecidableEq ι] {μ : Measure Ω} + +def idealBitBlocks (sigma : Matrix ι ι ℂ) (i j : Bool) : Matrix ι ι ℂ := + if i = j then (1/2 : ℝ) • sigma else 0 + +def cqBitError (τ : Bool → Bool → Ω → Matrix ι ι ℂ) + (sigma : Ω → Matrix ι ι ℂ) (μ : Measure Ω) : ℝ := + ∑ i, ∑ j, ∫ t, traceNorm (τ i j t - idealBitBlocks (sigma t) i j) ∂μ + +lemma BitDensity.idealBitError_eq_cq (τ : BitDensity μ ι) + (sigma : Ω → Matrix ι ι ℂ) : τ.idealBitError sigma = cqBitError τ.block sigma μ := by + simp only [cqBitError,Fintype.sum_bool,idealBitBlocks,Bool.true_eq_false, + Bool.false_eq_true,ite_false,ite_true,sub_zero] + simp_rw [traceNorm_posSemidef (τ.positive true false _), + traceNorm_posSemidef (τ.positive false true _)] + unfold BitDensity.idealBitError BitDensity.mass + ring + +end + +universe v9682_0 v9682_1 v9682_2 v9682_3 + +variable {Ω : Type v9682_0} {ι : Type v9682_1} {K : Type v9682_2} {Λ : Type v9682_3} [inst9682_0 : MeasurableSpace Ω] [inst9682_1 : Fintype ι] [inst9682_2 : DecidableEq ι] + [inst9682_3 : Fintype K] [inst9682_4 : DecidableEq K] [inst9682_5 : Fintype Λ] [inst9682_6 : DecidableEq Λ] {μ : Measure Ω} + +omit inst9682_1 inst9682_2 in +lemma idealFiniteBlocks_bit [Fintype ι] [DecidableEq ι] (sigma : Matrix ι ι ℂ) : + idealFiniteBlocks (K := Bool) sigma = idealBitBlocks sigma := by + funext a b + simp [idealFiniteBlocks,idealBitBlocks] + +omit inst9682_1 inst9682_2 in +lemma idealFiniteBlocks_bitSuffix [Fintype ι] [DecidableEq ι] (sigma : Matrix ι ι ℂ) : + idealFiniteBlocks (K := Bool × Λ) sigma = idealKeyBlocks sigma := by + funext a b + simp [idealFiniteBlocks,idealKeyBlocks,Fintype.card_prod,Nat.cast_mul] + +omit inst9682_6 in +theorem cqDistance_firstBit_le [DecidableEq Λ] + (W V : (Bool × Λ) → (Bool × Λ) → Ω → Matrix ι ι ℂ) + (hW : ∀ a b, Measurable (W a b)) (hV : ∀ a b, Measurable (V a b)) + (hi : ∀ a b, Integrable (fun t => traceNorm (W a b t - V a b t)) μ) : + cqDistance (fun i j t => firstBitBlocks (fun a b => W a b t) i j) + (fun i j t => firstBitBlocks (fun a b => V a b t) i j) μ ≤ cqDistance W V μ := by + have hp (i j : Bool) (t : Ω) : + traceNorm (firstBitBlocks (fun a b => W a b t) i j - + firstBitBlocks (fun a b => V a b t) i j) ≤ + ∑ a : Λ, ∑ b : Λ, traceNorm (W (i,a) (j,b) t - V (i,a) (j,b) t) := by + unfold firstBitBlocks + simp_rw [← Finset.sum_sub_distrib] + exact (traceNorm_sum_le Finset.univ _).trans + (Finset.sum_le_sum fun a _ => traceNorm_sum_le Finset.univ _) + have hb (i j : Bool) : + (∫ t, traceNorm (firstBitBlocks (fun a b => W a b t) i j - + firstBitBlocks (fun a b => V a b t) i j) ∂μ) ≤ + ∑ a : Λ, ∑ b : Λ, ∫ t, traceNorm (W (i,a) (j,b) t - V (i,a) (j,b) t) ∂μ := by + have hir := integrable_finsetSum Finset.univ (fun a _ => + integrable_finsetSum Finset.univ (fun b _ => hi (i,a) (j,b))) + have hml : Measurable (fun t => traceNorm + (firstBitBlocks (fun a b => W a b t) i j - firstBitBlocks (fun a b => V a b t) i j)) := by + apply measurable_traceNorm + exact (Finset.measurable_sum Finset.univ (fun a _ => + Finset.measurable_sum Finset.univ (fun b _ => hW (i,a) (j,b)))).sub + (Finset.measurable_sum Finset.univ (fun a _ => + Finset.measurable_sum Finset.univ (fun b _ => hV (i,a) (j,b)))) + have hil := hir.mono' hml.aestronglyMeasurable (Filter.Eventually.of_forall (fun t => by + rw [Real.norm_of_nonneg (traceNorm_nonneg _)] + exact hp i j t)) + calc + _ ≤ ∫ t, ∑ a : Λ, ∑ b : Λ, traceNorm (W (i,a) (j,b) t - V (i,a) (j,b) t) ∂μ := + integral_mono hil hir (hp i j) + _ = _ := by + rw [integral_finsetSum _ (fun a _ => integrable_finsetSum _ (fun b _ => hi (i,a) (j,b)))] + apply Finset.sum_congr rfl + intro a _ + rw [integral_finsetSum _ (fun b _ => hi (i,a) (j,b))] + calc + _ ≤ ∑ i : Bool, ∑ j : Bool, ∑ a : Λ, ∑ b : Λ, + ∫ t, traceNorm (W (i,a) (j,b) t - V (i,a) (j,b) t) ∂μ := + Finset.sum_le_sum fun i _ => Finset.sum_le_sum fun j _ => hb i j + _ = _ := by + simp only [cqDistance,Fintype.sum_prod_type] + apply Finset.sum_congr rfl + intro i _ + rw [Finset.sum_comm] + +omit inst9682_2 in +lemma idealFinite_measurable [DecidableEq ι] (sigma : Ω → Matrix ι ι ℂ) (hs : Measurable sigma) (a b : K) : + Measurable (fun t => idealFiniteBlocks (sigma t) a b) := by + by_cases h : a = b <;> simp only [idealFiniteBlocks,h,ite_true,ite_false] + · exact hs.const_smul (1/(Fintype.card K : ℝ)) + · exact measurable_const + +omit inst9682_1 inst9682_2 in +lemma idealFinite_positive [Fintype ι] [DecidableEq ι] (sigma : Matrix ι ι ℂ) (hs : sigma.PosSemidef) (a b : K) : + (idealFiniteBlocks sigma a b).PosSemidef := by + by_cases h : a = b <;> simp only [idealFiniteBlocks,h,ite_true,ite_false] + · exact hs.smul (by positivity : (0:ℝ) ≤ 1/(Fintype.card K : ℝ)) + · exact Matrix.PosSemidef.zero + +omit inst9682_2 in +lemma idealFinite_trace_integrable [DecidableEq ι] (sigma : Ω → Matrix ι ι ℂ) + (hi : Integrable (fun t => (trace (sigma t)).re) μ) (a b : K) : + Integrable (fun t => (trace (idealFiniteBlocks (sigma t) a b)).re) μ := by + by_cases h : a = b <;> simp only [idealFiniteBlocks,h,ite_true,ite_false] + · simpa only [Matrix.trace_smul,Complex.smul_re,smul_eq_mul] using hi.const_mul (1/(Fintype.card K : ℝ)) + · simp + +theorem cqFirstBit_ideal_le [Nonempty Λ] + (W : (Bool × Λ) → (Bool × Λ) → Ω → Matrix ι ι ℂ) + (hW : ∀ a b, Measurable (W a b)) (hWp : ∀ a b t, (W a b t).PosSemidef) + (hWi : ∀ a b, Integrable (fun t => (trace (W a b t)).re) μ) + (sigma : Ω → Matrix ι ι ℂ) (hs : Measurable sigma) (hsp : ∀ t, (sigma t).PosSemidef) + (hsi : Integrable (fun t => (trace (sigma t)).re) μ) : + cqBitError (fun i j t => firstBitBlocks (fun a b => W a b t) i j) sigma μ ≤ + cqDistance W (fun a b t => idealFiniteBlocks (sigma t) a b) μ := by + have h := cqDistance_firstBit_le W (fun a b t => idealFiniteBlocks (sigma t) a b) hW + (idealFinite_measurable sigma hs) + (fun a b => traceNorm_sub_integrable (hW a b) (idealFinite_measurable sigma hs a b) + (hWp a b) (fun t => idealFinite_positive (sigma t) (hsp t) a b) + (hWi a b) (idealFinite_trace_integrable sigma hsi a b)) + simpa only [cqDistance,cqBitError,idealFiniteBlocks_bitSuffix,firstBit_idealKey, + idealBitBlocks] using h + +end + +open Matrix MeasureTheory Filter + +open scoped ComplexOrder MatrixOrder Matrix.Norms.L2Operator + +universe v9802_0 v9802_1 v9802_2 + +variable {Ω : Type v9802_0} {ι : Type v9802_1} {K : Type v9802_2} [inst9802_0 : MeasurableSpace Ω] [inst9802_1 : Fintype ι] [inst9802_2 : DecidableEq ι] + [inst9802_3 : Fintype K] [inst9802_4 : DecidableEq K] {μ : Measure Ω} + +omit inst9802_4 in +lemma cqDistance_nonneg [DecidableEq K] (W V : K → K → Ω → Matrix ι ι ℂ) : 0 ≤ cqDistance W V μ := + Finset.sum_nonneg fun _ _ => Finset.sum_nonneg fun _ _ => integral_nonneg fun _ => traceNorm_nonneg _ + +omit inst9802_4 in +lemma cqDistance_triangle [DecidableEq K] (W V Z : K → K → Ω → Matrix ι ι ℂ) + (hW : ∀ a b, Measurable (W a b)) (hV : ∀ a b, Measurable (V a b)) + (hZ : ∀ a b, Measurable (Z a b)) + (hWp : ∀ a b t, (W a b t).PosSemidef) (hVp : ∀ a b t, (V a b t).PosSemidef) + (hZp : ∀ a b t, (Z a b t).PosSemidef) + (hWi : ∀ a b, Integrable (fun t => (trace (W a b t)).re) μ) + (hVi : ∀ a b, Integrable (fun t => (trace (V a b t)).re) μ) + (hZi : ∀ a b, Integrable (fun t => (trace (Z a b t)).re) μ) : + cqDistance W Z μ ≤ cqDistance W V μ + cqDistance V Z μ := by + have h (a b : K) : (∫ t, traceNorm (W a b t - Z a b t) ∂μ) ≤ + (∫ t, traceNorm (W a b t - V a b t) ∂μ) + + ∫ t, traceNorm (V a b t - Z a b t) ∂μ := by + have hwv := traceNorm_sub_integrable (hW a b) (hV a b) (hWp a b) (hVp a b) (hWi a b) (hVi a b) + have hvz := traceNorm_sub_integrable (hV a b) (hZ a b) (hVp a b) (hZp a b) (hVi a b) (hZi a b) + have hwz := traceNorm_sub_integrable (hW a b) (hZ a b) (hWp a b) (hZp a b) (hWi a b) (hZi a b) + rw [← integral_add hwv hvz] + apply integral_mono hwz (hwv.add hvz) + intro t + have he : W a b t - Z a b t = (W a b t - V a b t) + (V a b t - Z a b t) := by abel + change traceNorm (W a b t - Z a b t) ≤ + traceNorm (W a b t - V a b t) + traceNorm (V a b t - Z a b t) + rw [he] + exact traceNorm_add_le _ _ + calc + _ ≤ ∑ a, ∑ b, ((∫ t, traceNorm (W a b t - V a b t) ∂μ) + + ∫ t, traceNorm (V a b t - Z a b t) ∂μ) := + Finset.sum_le_sum fun a _ => Finset.sum_le_sum fun b _ => h a b + _ = _ := by simp only [cqDistance,Finset.sum_add_distrib] + +lemma BitDensity.error_triangle (τ υ : BitDensity μ ι) + (sigma : Ω → Matrix ι ι ℂ) (hs : Measurable sigma) (hsp : ∀ t, (sigma t).PosSemidef) + (hsi : Integrable (fun t => (trace (sigma t)).re) μ) : + τ.idealBitError sigma ≤ cqDistance τ.block υ.block μ + υ.idealBitError sigma := by + have h := cqDistance_triangle τ.block υ.block (fun a b t => idealFiniteBlocks (sigma t) a b) + τ.measurable υ.measurable (idealFinite_measurable sigma hs) + τ.positive υ.positive (fun a b t => idealFinite_positive (sigma t) (hsp t) a b) + τ.integrable υ.integrable (idealFinite_trace_integrable sigma hsi) + simpa only [cqDistance,cqBitError,BitDensity.idealBitError_eq_cq,idealFiniteBlocks_bit] using h + +theorem BitDensity.gap_of_traceNorm_limit (τ : ℕ → BitDensity μ ι) (υ : BitDensity μ ι) + (sigma : Ω → Matrix ι ι ℂ) (hs : Measurable sigma) (hsp : ∀ t, (sigma t).PosSemidef) + (hsi : Integrable (fun t => (trace (sigma t)).re) μ) + (hgap : ∀ n, 1/5 ≤ (τ n).idealBitError sigma) + (hlim : Tendsto (fun n => cqDistance (τ n).block υ.block μ) atTop (nhds 0)) : + 1/5 ≤ υ.idealBitError sigma := by + have hle (n : ℕ) := (hgap n).trans ((τ n).error_triangle υ sigma hs hsp hsi) + have ht : Tendsto (fun n => cqDistance (τ n).block υ.block μ + υ.idealBitError sigma) + atTop (nhds (υ.idealBitError sigma)) := by simpa using hlim.add_const (υ.idealBitError sigma) + exact ge_of_tendsto ht (Filter.Eventually.of_forall hle) + +end ZeroKey + +open Matrix MeasureTheory ProbabilityTheory Filter + +open scoped ComplexOrder MatrixOrder Matrix.Norms.L2Operator + +namespace ZeroKey + +open UnrestrictedQuantum + +universe v9877_0 v9877_1 v9877_2 v9877_3 v9877_4 v9877_5 v9877_6 v9877_7 + +variable {O : Type v9877_0} {M : Type v9877_1} [inst9877_0 : MeasurableSpace O] [inst9877_1 : MeasurableSpace M] + [inst9877_2 : StandardBorelSpace O] [inst9877_3 : Nonempty O] [inst9877_4 : StandardBorelSpace M] [inst9877_5 : Nonempty M] + {d : Discussion O M} {A : ℕ → Type v9877_2} {B : ℕ → Type v9877_3} + [inst9877_6 : ∀ n, AddCommGroup (A n)] [inst9877_7 : ∀ n, Module ℂ (A n)] [inst9877_8 : ∀ n, One (A n)] [inst9877_9 : ∀ n, LE (A n)] + [inst9877_10 : ∀ n, AddCommGroup (B n)] [inst9877_11 : ∀ n, Module ℂ (B n)] [inst9877_12 : ∀ n, One (B n)] [inst9877_13 : ∀ n, LE (B n)] + {TA : Type v9877_4} {TB : Type v9877_5} {CA : Type v9877_6} {CB : Type v9877_7} + [inst9877_14 : AddCommGroup TA] [inst9877_15 : Module ℂ TA] [inst9877_16 : One TA] [inst9877_17 : LE TA] + [inst9877_18 : AddCommGroup TB] [inst9877_19 : Module ℂ TB] [inst9877_20 : One TB] [inst9877_21 : LE TB] + [inst9877_22 : AddCommGroup CA] [inst9877_23 : Module ℂ CA] [inst9877_24 : One CA] [inst9877_25 : LE CA] + [inst9877_26 : AddCommGroup CB] [inst9877_27 : Module ℂ CB] [inst9877_28 : One CB] [inst9877_29 : LE CB] + {a b : ℕ} [inst9877_30 : Nonempty (Fin a)] [inst9877_31 : Nonempty (Fin b)] + +theorem BitProtocol.uniform_gap_dominated + (p : BitProtocol (ι := Fin a) (η := Fin b) d A B TA TB CA CB) + (R : Matrix (Fin a × Fin b) (Fin a × Fin b) ℂ) (hR : InClass R) + (ν : Measure (ℕ → M)) [SigmaFinite ν] (hμν : d.transcriptLaw ≪ ν) + (sigma : (ℕ → M) → Matrix (Fin a × Fin b) (Fin a × Fin b) ℂ) + (hs : Measurable sigma) (hsp : ∀ t, (sigma t).PosSemidef) + (hsi : Integrable (fun t => (trace (sigma t)).re) ν) + (hsn : (∫ t, (trace (sigma t)).re ∂ν) = 1) : + 1/5 ≤ (p.outputDensity R hR.1 ν hμν).idealBitError sigma := by + obtain ⟨τ,X,Y,hX,hY,hτ,hi,he⟩ := p.canonical_density_representation R hR.1 + have hg := class_factor_gap_dominating_measure hμν R hR τ X Y hX hY hτ + sigma hs hsp hsi hsn + rw [BitDensity.idealBitError_congr (p.outputDensity R hR.1 ν hμν) + (τ.changeMeasure hμν) sigma sigma (p.outputDensity_eq R hR.1 ν hμν τ hi he) + Filter.EventuallyEq.rfl] + exact hg + +end ZeroKey + +end + +end OAI diff --git a/lean/OAI/InformationTheory/SecretKey/KeyRate.lean b/lean/OAI/InformationTheory/SecretKey/KeyRate.lean new file mode 100644 index 0000000000000000000000000000000000000000..469939551b672b5faa555140e95a461dfe18cf21 --- /dev/null +++ b/lean/OAI/InformationTheory/SecretKey/KeyRate.lean @@ -0,0 +1,277 @@ +import OAI.InformationTheory.SecretKey.Purification + +namespace OAI + +noncomputable section + +namespace ZeroKey + +section + +open Matrix MeasureTheory ProbabilityTheory Filter + +universe u + +lemma card_keyWord (n : ℕ) : Fintype.card (KeyWord n) = 2^n := by + induction n with + | zero => change Fintype.card Unit = 1; exact Fintype.card_unique + | succ n ih => + change Fintype.card (Bool × KeyWord n) = _ + rw [Fintype.card_prod,Fintype.card_bool,ih,pow_succ,mul_comm] + +end + +section + +open MeasureTheory Filter + +open scoped ENNReal + +universe v11415_0 + +variable {Ω : Type v11415_0} [inst11415_0 : MeasurableSpace Ω] + +def commonPublicLaw (μ : ℕ → Measure Ω) : Measure Ω := + Measure.sum (fun n => (2⁻¹ : ℝ≥0∞)^n • μ n) + +lemma commonPublicLaw_univ (μ : ℕ → Measure Ω) [∀ n, IsProbabilityMeasure (μ n)] : + commonPublicLaw μ Set.univ = 2 := by + simp only [commonPublicLaw,Measure.sum_apply _ MeasurableSet.univ,Measure.smul_apply, + measure_univ,smul_eq_mul,mul_one] + exact ENNReal.tsum_geometric_two + +instance commonPublicLaw_finite (μ : ℕ → Measure Ω) [∀ n, IsProbabilityMeasure (μ n)] : + IsFiniteMeasure (commonPublicLaw μ) := ⟨by rw [commonPublicLaw_univ]; norm_num⟩ + +lemma absolutelyContinuous_commonPublicLaw (μ : ℕ → Measure Ω) (n : ℕ) : + μ n ≪ commonPublicLaw μ := by + apply Measure.absolutelyContinuous_sum_right n + apply Measure.AbsolutelyContinuous.mk + intro S hS hzero + have hp : (2⁻¹ : ℝ≥0∞)^n ≠ 0 := pow_ne_zero _ (by norm_num) + simpa only [Measure.smul_apply,smul_eq_mul,mul_eq_zero,hp,false_or] using hzero + +end + +section + +open Matrix MeasureTheory ProbabilityTheory Filter + +open scoped ComplexOrder MatrixOrder Matrix.Norms.L2Operator + +universe u + +namespace KeyImplementation + +variable {a b ell : ℕ} {messages : ClassicalRecordSpace.{u}} + [inst11471_0 : Nonempty (Fin a)] [inst11471_1 : Nonempty (Fin b)] + (p : KeyImplementation a b ell messages) + (R : Matrix (Fin a × Fin b) (Fin a × Fin b) ℂ) (hR : Density R) + {e : ℕ} (P : Matrix (Fin a × Fin b) (Fin e) ℂ) (hP : P * Pᴴ = R) + (ν : Measure (ℕ → messages)) [inst11471_2 : SigmaFinite ν] (hμν : p.discussion.transcriptLaw ≪ ν) + +lemma uniform_gap (hc : InClass R) (hell : 0 < ell) (sigma : EveDensity ν (Fin e)) : + 1/5 ≤ (p.output R hR P hP ν hμν).idealError sigma := by + cases ell with + | zero => omega + | succ n => exact p.protocol.uniform_purified_key_gap_dominated R hc P hP ν hμν sigma + +end KeyImplementation + +namespace IsCompletedKeyOutput + +variable {a b ell e : ℕ} [inst11506_0 : Nonempty (Fin a)] [inst11506_1 : Nonempty (Fin b)] + {R : Matrix (Fin a × Fin b) (Fin a × Fin b) ℂ} {hR : Density R} + {P : Matrix (Fin a × Fin b) (Fin e) ℂ} {hP : P * Pᴴ = R} + {messages : ClassicalRecordSpace.{u}} {ν : Measure (ℕ → messages)} [inst11506_2 : SigmaFinite ν] + {τ : KeyDensity ν (KeyWord ell) (Fin e)} + +lemma of_implementation (p : KeyImplementation a b ell messages) + (hAC : p.discussion.transcriptLaw ≪ ν) : + IsCompletedKeyOutput R hR P hP messages ν (p.output R hR P hP ν hAC) := by + apply (isCompletedKeyOutput_iff_original R hR P hP messages ν _).2 + refine ⟨fun _ => p,fun _ => hAC,?_⟩ + simpa only [KeyDensity.distance_self] using + (tendsto_const_nhds : Tendsto (fun _ : ℕ => (0 : ℝ)) atTop (nhds 0)) + +theorem uniform_gap (hτ : IsCompletedKeyOutput R hR P hP messages ν τ) + (hc : InClass R) (hell : 0 < ell) (sigma : EveDensity ν (Fin e)) : + 1/5 ≤ τ.idealError sigma := by + obtain ⟨p,hAC,hlim⟩ := hτ + exact KeyDensity.gap_of_traceNorm_limit + (fun j => (p j).output R hR P hP ν (hAC j)) τ sigma + (fun j => (p j).uniform_gap R hR P hP ν (hAC j) hc hell sigma) hlim + +end IsCompletedKeyOutput + +attribute [instance] CompletedKeyTrial.sigmaFinite + +namespace CompletedKeyTrial + +variable {a b ell : ℕ} [inst11550_0 : Nonempty (Fin a)] [inst11550_1 : Nonempty (Fin b)] + {R : Matrix (Fin a × Fin b) (Fin a × Fin b) ℂ} {hR : Density R} + (p : CompletedKeyTrial R hR ell) + +lemma error_nonneg : 0 ≤ p.error := p.actual.idealError_nonneg p.ideal + +lemma uniform_error (hc : InClass R) (hell : 0 < ell) : 1/5 ≤ p.error := + p.completed.uniform_gap hc hell p.ideal + +end CompletedKeyTrial + +end + +open scoped ComplexOrder MatrixOrder Kronecker + +open Matrix + +def groupVector {a b c d : ℕ} (u : Fin a × Fin b → ℂ) (v : Fin c × Fin d → ℂ) : + Fin (a*c) × Fin (b*d) → ℂ := fun i => + u (groupIndex a b c d i).1 * v (groupIndex a b c d i).2 + +lemma outer_groupVector {a b c d : ℕ} (u : Fin a × Fin b → ℂ) (v : Fin c × Fin d → ℂ) : + outer (groupVector u v) (groupVector u v) = groupTensor (outer u u) (outer v v) := by + ext i j + simp only [outer,groupVector,groupTensor,Matrix.submatrix_apply,Matrix.kroneckerMap_apply,star_mul] + ring + +lemma tensorMap_kronecker {a b c d : ℕ} (L : Mat a →ₗ[ℂ] Mat b) (M : Mat c →ₗ[ℂ] Mat d) + (A : Mat a) (B : Mat c) : tensorMap L M (A ⊗ₖ B) = L A ⊗ₖ M B := by + ext ⟨i,k⟩ ⟨j,l⟩ + simp only [tensorMap,Matrix.kronecker_apply] + have hL := linearMap_matrix_units_apply L A i j + have hM := linearMap_matrix_units_apply M B k l + rw [hL,hM] + simp only [Finset.sum_mul] + simp only [Finset.mul_sum] + apply Finset.sum_congr rfl; intro x _ + apply Finset.sum_congr rfl; intro y _ + apply Finset.sum_congr rfl; intro z _ + apply Finset.sum_congr rfl; intro w _ + ring + +lemma matrixUnit_finProd {a c : ℕ} (x y : Fin (a*c)) : + (matrixUnit x y).submatrix finProdFinEquiv finProdFinEquiv = + matrixUnit (finProdFinEquiv.symm x).1 (finProdFinEquiv.symm y).1 ⊗ₖ + matrixUnit (finProdFinEquiv.symm x).2 (finProdFinEquiv.symm y).2 := by + ext ⟨i,k⟩ ⟨j,l⟩ + simp only [Matrix.submatrix_apply, matrixUnit, Matrix.kronecker_apply] + have hx : finProdFinEquiv (i,k) = x ↔ i = (finProdFinEquiv.symm x).1 ∧ + k = (finProdFinEquiv.symm x).2 := by + rw [← Equiv.eq_symm_apply] + exact Prod.ext_iff + have hy : finProdFinEquiv (j,l) = y ↔ j = (finProdFinEquiv.symm y).1 ∧ + l = (finProdFinEquiv.symm y).2 := by + rw [← Equiv.eq_symm_apply] + exact Prod.ext_iff + simp only [hx,hy] + split_ifs <;> simp_all + +lemma tensorLinear_unit {a b c d : ℕ} (L : Mat a →ₗ[ℂ] Mat b) (M : Mat c →ₗ[ℂ] Mat d) + (x y : Fin (a*c)) (i j : Fin (b*d)) : + tensorLinear L M (matrixUnit x y) i j = + L (matrixUnit (finProdFinEquiv.symm x).1 (finProdFinEquiv.symm y).1) + (finProdFinEquiv.symm i).1 (finProdFinEquiv.symm j).1 * + M (matrixUnit (finProdFinEquiv.symm x).2 (finProdFinEquiv.symm y).2) + (finProdFinEquiv.symm i).2 (finProdFinEquiv.symm j).2 := by + change (tensorMap L M _ _ _) = _ + rw [matrixUnit_finProd,tensorMap_kronecker] + rfl + +lemma tensorMap_groupTensor {a b c d e f g h : ℕ} + (L : Mat a →ₗ[ℂ] Mat b) (M : Mat c →ₗ[ℂ] Mat d) + (N : Mat e →ₗ[ℂ] Mat f) (P : Mat g →ₗ[ℂ] Mat h) + (U : Matrix (Fin a × Fin c) (Fin a × Fin c) ℂ) + (V : Matrix (Fin e × Fin g) (Fin e × Fin g) ℂ) : + tensorMap (tensorLinear L N) (tensorLinear M P) (groupTensor U V) = + groupTensor (tensorMap L M U) (tensorMap N P V) := by + ext ⟨i,k⟩ ⟨j,l⟩ + simp only [tensorMap, tensorLinear_unit,groupTensor,Matrix.submatrix_apply, + Matrix.kronecker_apply,groupIndex,Equiv.coe_fn_mk] + simp_rw [← Equiv.sum_comp (finProdFinEquiv : Fin a × Fin e ≃ _)] + simp_rw [← Equiv.sum_comp (finProdFinEquiv : Fin c × Fin g ≃ _)] + simp only [Equiv.symm_apply_apply,Fintype.sum_prod_type] + simp only [Finset.sum_mul] + simp only [Finset.mul_sum] + apply Finset.sum_congr rfl; intro x _ + rw [Finset.sum_comm] + apply Finset.sum_congr rfl; intro y _ + conv_lhs => arg 2; ext xv; rw [Finset.sum_comm] + rw [Finset.sum_comm] + apply Finset.sum_congr rfl; intro z _ + conv_lhs => arg 2; ext xv; arg 2; ext yv; rw [Finset.sum_comm] + conv_lhs => arg 2; ext xv; rw [Finset.sum_comm] + rw [Finset.sum_comm] + apply Finset.sum_congr rfl; intro w _ + apply Finset.sum_congr rfl; intro xv _ + apply Finset.sum_congr rfl; intro yv _ + apply Finset.sum_congr rfl; intro zv _ + apply Finset.sum_congr rfl; intro wv _ + ring + +lemma InClass.groupTensor {a b c d : ℕ} + {R : Matrix (Fin a × Fin b) (Fin a × Fin b) ℂ} + {S : Matrix (Fin c × Fin d) (Fin c × Fin d) ℂ} + (hR : InClass R) (hS : InClass S) : InClass (groupTensor R S) := by + obtain ⟨hdR,p,q,L,M,u,hL,hM,hu⟩ := hR + obtain ⟨hdS,r,s,N,P,v,hN,hP,hv⟩ := hS + refine ⟨hdR.groupTensor hdS,p*r,q*s,tensorLinear L N,tensorLinear M P, + groupVector u v,ppt_tensorLinear hL hN,ppt_tensorLinear hM hP,?_⟩ + rw [outer_groupVector,tensorMap_groupTensor,← hu,← hv] + +lemma InClass.positiveCopies {a b : ℕ} + {R : Matrix (Fin a × Fin b) (Fin a × Fin b) ℂ} (hR : InClass R) (k : ℕ) : + InClass (positiveCopies R k) := by + induction k with + | zero => exact hR + | succ k ih => exact ih.groupTensor hR + +end ZeroKey + +open Matrix MeasureTheory ProbabilityTheory Filter + +open scoped ComplexOrder MatrixOrder Matrix.Norms.L2Operator ENNReal + +namespace ZeroKey + +universe u + +namespace CompletedKeyScheme + +variable {a b : ℕ} [inst11756_0 : Nonempty (Fin a)] [inst11756_1 : Nonempty (Fin b)] + {R : Matrix (Fin a × Fin b) (Fin a × Fin b) ℂ} {hR : Density R} + (s : CompletedKeyScheme.{u} R hR) + +lemma eventually_length_zero (hc : InClass R) (hs : s.Secure) : + ∀ᶠ k in atTop, s.length k = 0 := by + have he : ∀ᶠ k in atTop, s.error k < 1/5 := (tendsto_order.mp hs).2 _ (by norm_num) + filter_upwards [he] with k hk + by_contra hn + exact (not_lt_of_ge ((s.trial k).uniform_error (hc.positiveCopies k) + (Nat.pos_of_ne_zero hn))) hk + +lemma lowerRate_zero (hc : InClass R) (hs : s.Secure) : s.lowerRate = 0 := by + unfold lowerRate + have he : (fun k : ℕ => (s.length k : ℝ≥0∞) / (k+1 : ℕ)) =ᶠ[atTop] fun _ => 0 := by + filter_upwards [s.eventually_length_zero hc hs] with k hk + simp [hk] + rw [Filter.liminf_congr he] + simp + +end CompletedKeyScheme + +theorem class_distillableSecretKey_zero {a b : ℕ} [Nonempty (Fin a)] [Nonempty (Fin b)] + (R : Matrix (Fin a × Fin b) (Fin a × Fin b) ℂ) (hR : Density R) (hc : InClass R) : + distillableSecretKey.{u} R hR = 0 := by + apply le_antisymm ?_ bot_le + apply sSup_le + intro r hr + rcases hr with rfl | ⟨s,hs,rfl⟩ + · rfl + · exact le_of_eq (s.lowerRate_zero hc hs) + +end ZeroKey + +end + +end OAI diff --git a/lean/OAI/InformationTheory/SecretKey/Main.lean b/lean/OAI/InformationTheory/SecretKey/Main.lean new file mode 100644 index 0000000000000000000000000000000000000000..8b140d53ec10d2c9d6e8e0059449a6b3e2d69103 --- /dev/null +++ b/lean/OAI/InformationTheory/SecretKey/Main.lean @@ -0,0 +1,54 @@ +import OAI.InformationTheory.SecretKey.Extensions + +namespace OAI + +noncomputable section + +open Matrix MeasureTheory ProbabilityTheory Filter + +open scoped ComplexOrder MatrixOrder Matrix.Norms.L2Operator ENNReal + +namespace ZeroKey + +universe u + +theorem class_uniformProtocolGap {a b : ℕ} [Nonempty (Fin a)] [Nonempty (Fin b)] + (R : Matrix (Fin a × Fin b) (Fin a × Fin b) ℂ) (hR : Density R) (hc : InClass R) : + UniformProtocolGap.{u} R hR := by + intro k O M _ _ _ _ _ _ d A B _ _ _ _ _ _ _ _ TA TB CA CB _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ p e P hP sigma hs + exact p.uniform_gap_purification (positiveCopies R k) (hc.positiveCopies k) P hP sigma hs + +theorem class_uniformCompletedGap {a b : ℕ} [Nonempty (Fin a)] [Nonempty (Fin b)] + (R : Matrix (Fin a × Fin b) (Fin a × Fin b) ℂ) (hR : Density R) (hc : InClass R) : + UniformCompletedGap.{u} R hR := by + intro k ell hell p + exact p.uniform_error (hc.positiveCopies k) hell + +namespace Explicit + +/-- The explicit density witness removes a proof dependency from the challenge statement. +This is equivalent to the original five-clause formulation. -/ +theorem mainClaim_iff_original : MainClaim.{u} ↔ + (Density rhoFin ∧ ¬ Separable rhoFin ∧ + distillableSecretKey.{u} rhoFin rhoFin_density = 0 ∧ + UniformProtocolGap.{u} rhoFin rhoFin_density ∧ + UniformCompletedGap.{u} rhoFin rhoFin_density) := by + constructor + · rintro ⟨hR, hsep, hkey, hprotocol, hcompleted⟩ + exact ⟨hR, hsep, hkey, hprotocol, hcompleted⟩ + · rintro ⟨hR, hsep, hkey, hprotocol, hcompleted⟩ + exact ⟨hR, hsep, hkey, hprotocol, hcompleted⟩ + +theorem main : MainClaim.{u} := by + exact ⟨rhoFin_density, rhoFin_not_separable, + class_distillableSecretKey_zero rhoFin rhoFin_density rhoFin_inClass, + class_uniformProtocolGap rhoFin rhoFin_density rhoFin_inClass, + class_uniformCompletedGap rhoFin rhoFin_density rhoFin_inClass⟩ + +end Explicit + +end ZeroKey + +end + +end OAI diff --git a/lean/OAI/InformationTheory/SecretKey/MatrixBasics.lean b/lean/OAI/InformationTheory/SecretKey/MatrixBasics.lean new file mode 100644 index 0000000000000000000000000000000000000000..b41d2a67f623d4854e9ee3d57e60230de8130b5f --- /dev/null +++ b/lean/OAI/InformationTheory/SecretKey/MatrixBasics.lean @@ -0,0 +1,900 @@ +import OAI.InformationTheory.SecretKey.Model + +namespace OAI + +noncomputable section + +open scoped MatrixOrder ComplexOrder Kronecker + +open Matrix + +namespace ZeroKey + +section MatrixPolar + +universe v43_0 + +variable {ι : Type v43_0} [inst43_0 : Fintype ι] [inst43_1 : DecidableEq ι] + +theorem exists_unitary_polar (A : Matrix ι ι ℂ) : + ∃ U : Matrix.unitaryGroup ι ℂ, A = (U : Matrix ι ι ℂ) * CFC.sqrt (Aᴴ * A) := by + apply exists_unitary_mul_of_gram_eq + rw [(CFC.sqrt_nonneg (Aᴴ * A)).posSemidef.isHermitian.eq] + exact (CFC.sqrt_mul_sqrt_self (Aᴴ * A) + (Matrix.posSemidef_conjTranspose_mul_self A).nonneg).symm + +end MatrixPolar + +section TraceNorm + +universe v84_0 + +variable {ι : Type v84_0} [inst84_0 : Fintype ι] [inst84_1 : DecidableEq ι] + +omit inst84_1 in +lemma re_trace_nonneg [DecidableEq ι] {S : Matrix ι ι ℂ} (hS : S.PosSemidef) : + 0 ≤ (trace S).re := (RCLike.nonneg_iff.mp hS.trace_nonneg).1 + +lemma re_trace_mul_nonneg {S T : Matrix ι ι ℂ} + (hS : S.PosSemidef) (hT : T.PosSemidef) : 0 ≤ (trace (S * T)).re := by + let B := CFC.sqrt S + have hB : Bᴴ = B := (CFC.sqrt_nonneg S).posSemidef.isHermitian.eq + have hBB : B * B = S := CFC.sqrt_mul_sqrt_self S hS.nonneg + have h := re_trace_nonneg (hT.mul_mul_conjTranspose_same B) + rwa [hB, Matrix.trace_mul_cycle, hBB] at h + +omit inst84_1 in +lemma re_trace_star_mul [DecidableEq ι] {S W : Matrix ι ι ℂ} (hS : S.IsHermitian) : + (trace (Wᴴ * S)).re = (trace (W * S)).re := by + have h : Wᴴ * S = (S * W)ᴴ := by simp [hS.eq] + rw [h, Matrix.trace_conjTranspose, Matrix.trace_mul_comm S W] + rfl + +lemma re_trace_unitary_mul_le {S : Matrix ι ι ℂ} (hS : S.PosSemidef) + (W : Matrix.unitaryGroup ι ℂ) : (trace ((W : Matrix ι ι ℂ) * S)).re ≤ (trace S).re := by + let V : Matrix ι ι ℂ := W + have hV : Vᴴ * V = 1 := W.prop.1 + have hp := re_trace_mul_nonneg (Matrix.posSemidef_conjTranspose_mul_self (V - 1)) hS + have hexp : (V - 1)ᴴ * (V - 1) * S = S + S - V * S - Vᴴ * S := by + simp only [Matrix.conjTranspose_sub, Matrix.conjTranspose_one, sub_mul, mul_sub, + hV, one_mul, mul_one] + noncomm_ring + rw [hexp, Matrix.trace_sub, Matrix.trace_sub, Matrix.trace_add, + Complex.sub_re, Complex.sub_re, Complex.add_re, re_trace_star_mul hS.isHermitian] at hp + change (trace (V * S)).re ≤ (trace S).re + linarith + +lemma traceNorm_nonneg (A : Matrix ι ι ℂ) : 0 ≤ traceNorm A := + re_trace_nonneg (CFC.sqrt_nonneg (Aᴴ * A)).posSemidef + +lemma re_trace_unitary_mul_le_traceNorm (A : Matrix ι ι ℂ) + (W : Matrix.unitaryGroup ι ℂ) : + (trace ((W : Matrix ι ι ℂ) * A)).re ≤ traceNorm A := by + obtain ⟨U, hU⟩ := exists_unitary_polar A + have h := re_trace_unitary_mul_le (CFC.sqrt_nonneg (Aᴴ * A)).posSemidef (W * U) + change (trace (((W : Matrix ι ι ℂ) * (U : Matrix ι ι ℂ)) * CFC.sqrt (Aᴴ * A))).re ≤ _ at h + rw [Matrix.mul_assoc, ← hU] at h + exact h + +lemma exists_unitary_traceNorm (A : Matrix ι ι ℂ) : + ∃ U : Matrix.unitaryGroup ι ℂ, (trace ((U : Matrix ι ι ℂ) * A)).re = traceNorm A := by + obtain ⟨U, hU⟩ := exists_unitary_polar A + refine ⟨star U, ?_⟩ + change (trace ((U : Matrix ι ι ℂ)ᴴ * A)).re = _ + nth_rw 1 [hU] + rw [← Matrix.mul_assoc, show (U : Matrix ι ι ℂ)ᴴ * U = 1 from U.prop.1, one_mul] + rfl + +lemma traceNorm_add_le (A B : Matrix ι ι ℂ) : + traceNorm (A + B) ≤ traceNorm A + traceNorm B := by + obtain ⟨U, hU⟩ := exists_unitary_traceNorm (A + B) + rw [← hU, mul_add, Matrix.trace_add, Complex.add_re] + exact add_le_add (re_trace_unitary_mul_le_traceNorm A U) + (re_trace_unitary_mul_le_traceNorm B U) + +lemma trace_re_unitary_conjugate (A : Matrix ι ι ℂ) (U : Matrix.unitaryGroup ι ℂ) : + trace ((U : Matrix ι ι ℂ) * A * (U : Matrix ι ι ℂ)ᴴ) = trace A := by + rw [Matrix.trace_mul_cycle, show (U : Matrix ι ι ℂ)ᴴ * U = 1 from U.prop.1, one_mul] + +end TraceNorm + +section Frobenius + +universe v155_0 v155_1 + +variable {ι : Type v155_0} {κ : Type v155_1} [inst155_0 : Fintype ι] [inst155_1 : Fintype κ] [inst155_2 : DecidableEq ι] + +omit inst155_2 in +lemma trace_mul_conjTranspose_eq_inner [DecidableEq ι] (A B : Matrix ι κ ℂ) : + trace (A * Bᴴ) = inner ℂ (matrixVector B) (matrixVector A) := by + simp [matrixVector, EuclideanSpace.inner_toLp_toLp, Matrix.trace, Matrix.mul_apply, + Matrix.conjTranspose_apply, dotProduct, Fintype.sum_prod_type] + +lemma norm_matrixVector (A : Matrix ι κ ℂ) : + ‖matrixVector A‖ = Real.sqrt (trace (A * Aᴴ)).re := by + rw [trace_mul_conjTranspose_eq_inner] + exact norm_eq_sqrt_re_inner (𝕜 := ℂ) (matrixVector A) + +lemma re_trace_mul_conjTranspose_le (A B : Matrix ι κ ℂ) : + (trace (A * Bᴴ)).re ≤ Real.sqrt ((trace (A * Aᴴ)).re * (trace (B * Bᴴ)).re) := by + rw [trace_mul_conjTranspose_eq_inner A B, Real.sqrt_mul + (re_trace_nonneg (Matrix.posSemidef_self_mul_conjTranspose A))] + change RCLike.re (inner ℂ (matrixVector B) (matrixVector A)) ≤ _ + calc + _ ≤ ‖matrixVector B‖ * ‖matrixVector A‖ := re_inner_le_norm _ _ + _ = _ := by rw [norm_matrixVector, norm_matrixVector, mul_comm] + +lemma traceNorm_mul_conjTranspose_le (A B : Matrix ι κ ℂ) : + traceNorm (A * Bᴴ) ≤ Real.sqrt ((trace (A * Aᴴ)).re * (trace (B * Bᴴ)).re) := by + obtain ⟨U, hU⟩ := exists_unitary_traceNorm (A * Bᴴ) + rw [← hU, ← Matrix.mul_assoc] + have h := re_trace_mul_conjTranspose_le ((U : Matrix ι ι ℂ) * A) B + have heq : trace (((U : Matrix ι ι ℂ) * A) * ((U : Matrix ι ι ℂ) * A)ᴴ) = + trace (A * Aᴴ) := by + rw [Matrix.conjTranspose_mul, ← Matrix.mul_assoc, Matrix.mul_assoc (U : Matrix ι ι ℂ) A, + trace_re_unitary_conjugate] + rwa [heq] at h + +end Frobenius + +section PositiveBlock + +universe v193_0 v193_1 + +variable {ι : Type v193_0} {κ : Type v193_1} [inst193_0 : Fintype ι] [inst193_1 : Fintype κ] [inst193_2 : DecidableEq ι] [inst193_3 : DecidableEq κ] + +omit inst193_0 inst193_2 in +lemma sqrtRows_gram [Fintype ι] [DecidableEq ι] {R : Matrix κ κ ℂ} (hR : R.PosSemidef) (f g : ι → κ) : + (CFC.sqrt R).submatrix f id * ((CFC.sqrt R).submatrix g id)ᴴ = R.submatrix f g := by + rw [Matrix.conjTranspose_submatrix, (CFC.sqrt_nonneg R).posSemidef.isHermitian.eq, + ← Matrix.submatrix_mul _ _ f id g Function.bijective_id, + CFC.sqrt_mul_sqrt_self R hR.nonneg] + +lemma traceNorm_submatrix_le {R : Matrix κ κ ℂ} (hR : R.PosSemidef) (f g : ι → κ) : + traceNorm (R.submatrix f g) ≤ + Real.sqrt ((trace (R.submatrix f f)).re * (trace (R.submatrix g g)).re) := by + have h := traceNorm_mul_conjTranspose_le ((CFC.sqrt R).submatrix f id) + ((CFC.sqrt R).submatrix g id) + simpa only [sqrtRows_gram hR] using h + +theorem positive_block_estimate (H Z J : Matrix ι ι ℂ) + (h : (Matrix.fromBlocks H Z Zᴴ J).PosSemidef) : + traceNorm Z ≤ Real.sqrt ((trace H).re * (trace J).re) := by + exact traceNorm_submatrix_le h Sum.inl Sum.inr + +end PositiveBlock + +section + +def InClass {a b : ℕ} (R : Matrix (Fin a × Fin b) (Fin a × Fin b) ℂ) : Prop := + Density R ∧ ∃ (c d : ℕ) (L : Mat c →ₗ[ℂ] Mat a) (M : Mat d →ₗ[ℂ] Mat b) + (χ : Fin c × Fin d → ℂ), PPTType L ∧ PPTType M ∧ R = tensorMap L M (outer χ χ) + +def weight {a b : ℕ} (R : Matrix (Fin a × Fin b) (Fin a × Fin b) ℂ) + (X : Mat a) (Y : Mat b) : ℝ := (Matrix.trace ((X ⊗ₖ Y) * R)).re + +lemma cp_positive {a b : ℕ} {L : Mat a →ₗ[ℂ] Mat b} (hL : CompletelyPositive L) + {U : Mat a} (hU : U.PosSemidef) : (L U).PosSemidef := by + have h := hL 1 (U.submatrix Prod.snd Prod.snd) (hU.submatrix Prod.snd) + exact h.submatrix (fun i => (0,i)) + +section TensorBlocks + +universe v344_0 + +def amplifyTensor {a b c d : ℕ} (L : Mat a →ₗ[ℂ] Mat b) (M : Mat c →ₗ[ℂ] Mat d) + {κ : Type v344_0} (U : Matrix (κ × (Fin a × Fin c)) (κ × (Fin a × Fin c)) ℂ) : + Matrix (κ × (Fin b × Fin d)) (κ × (Fin b × Fin d)) ℂ := + fun i j => tensorMap L M (fun x y => U (i.1,x) (j.1,y)) i.2 j.2 + +universe v349_0 + +lemma tensorMap_amplify_positive {a b c d : ℕ} {L : Mat a →ₗ[ℂ] Mat b} + {M : Mat c →ₗ[ℂ] Mat d} (hL : CompletelyPositive L) (hM : CompletelyPositive M) + {κ : Type v349_0} [Fintype κ] + {U : Matrix (κ × (Fin a × Fin c)) (κ × (Fin a × Fin c)) ℂ} (hU : U.PosSemidef) : + (amplifyTensor L M U).PosSemidef := by + have h₁ := cp_amplifyIndex hM _ + (hU.submatrix (fun i : (κ × Fin a) × Fin c => (i.1.1, (i.1.2, i.2)))) + have h₂ := cp_amplifyIndex hL _ + (h₁.submatrix (fun i : (κ × Fin d) × Fin a => ((i.1.1, i.2), i.1.2))) + have h₃ := h₂.submatrix (fun i : κ × (Fin b × Fin d) => ((i.1, i.2.2), i.2.1)) + convert h₃ using 1 + ext i j + exact tensorMap_apply L M _ _ _ _ _ + +lemma tensorMap_global_transpose {a b c d : ℕ} (L : Mat a →ₗ[ℂ] Mat b) + (M : Mat c →ₗ[ℂ] Mat d) (U : Matrix (Fin a × Fin c) (Fin a × Fin c) ℂ) : + tensorMap (L.comp (transposeLinear a)) (M.comp (transposeLinear c)) U = + tensorMap L M Uᵀ := by + ext i j + calc + _ = (L.comp (transposeLinear a)) + (fun x y => (M.comp (transposeLinear c)) (fun z w => U (x,z) (y,w)) i.2 j.2) + i.1 j.1 := tensorMap_apply _ _ _ _ _ _ _ + _ = L (fun x y => M (fun z w => Uᵀ (x,z) (y,w)) i.2 j.2) i.1 j.1 := rfl + _ = _ := (tensorMap_apply _ _ _ _ _ _ _).symm + +universe v378_0 + +lemma outer_transpose_conj {ι : Type v378_0} (u s : ι → ℂ) : + (outer (star s) (star u))ᵀ = outer u s := by + ext i j + simp [outer, Matrix.transpose_apply, mul_comm] + +lemma tensorMap_outer_block {a b c d : ℕ} {L : Mat a →ₗ[ℂ] Mat b} + {M : Mat c →ₗ[ℂ] Mat d} (hL : CompletelyPositive L) (hM : CompletelyPositive M) + (u s : Fin a × Fin c → ℂ) : + (fromBlocks (tensorMap L M (outer u u)) (tensorMap L M (outer u s)) + (tensorMap L M (outer s u)) (tensorMap L M (outer s s))).PosSemidef := by + let v : Bool × (Fin a × Fin c) → ℂ := fun i => if i.1 then s i.2 else u i.2 + have h := tensorMap_amplify_positive hL hM (outer_posSemidef v) + have h' := h.submatrix (Sum.elim (fun i => (false,i)) (fun i => (true,i))) + convert h' using 1 + ext i j + cases i <;> cases j <;> simp [amplifyTensor, Matrix.submatrix, v, outer, Matrix.fromBlocks] <;> rfl + +end TensorBlocks + +universe v398_0 + +variable {ι : Type v398_0} [inst398_0 : Fintype ι] [inst398_1 : DecidableEq ι] + +lemma filtered_block_estimate (H Z J F₀ F₁ : Matrix ι ι ℂ) + (h : (fromBlocks H Z Zᴴ J).PosSemidef) : + traceNorm (F₀ * Z * F₁ᴴ) ≤ + Real.sqrt ((trace (F₀ * H * F₀ᴴ)).re * (trace (F₁ * J * F₁ᴴ)).re) := by + have hf := h.mul_mul_conjTranspose_same (fromBlocks F₀ 0 0 F₁) + have hf' : (fromBlocks (F₀ * H * F₀ᴴ) (F₀ * Z * F₁ᴴ) + (F₀ * Z * F₁ᴴ)ᴴ (F₁ * J * F₁ᴴ)).PosSemidef := by + simpa [Matrix.fromBlocks_conjTranspose, Matrix.fromBlocks_multiply, + Matrix.conjTranspose_mul, Matrix.mul_assoc] using hf + exact positive_block_estimate _ _ _ hf' + +lemma trace_sqrt_filter (D R : Matrix ι ι ℂ) (hD : D.PosSemidef) : + trace (CFC.sqrt D * R * CFC.sqrt D) = trace (D * R) := by + rw [Matrix.trace_mul_cycle, CFC.sqrt_mul_sqrt_self D hD.nonneg] + +lemma sqrt_filtered_block_estimate (H Z J D₀ D₁ : Matrix ι ι ℂ) + (h : (fromBlocks H Z Zᴴ J).PosSemidef) (hD₀ : D₀.PosSemidef) (hD₁ : D₁.PosSemidef) : + traceNorm (CFC.sqrt D₀ * Z * CFC.sqrt D₁) ≤ + Real.sqrt ((trace (D₀ * H)).re * (trace (D₁ * J)).re) := by + have hf := filtered_block_estimate H Z J (CFC.sqrt D₀) (CFC.sqrt D₁) h + simpa only [(CFC.sqrt_nonneg D₀).posSemidef.isHermitian.eq, + (CFC.sqrt_nonneg D₁).posSemidef.isHermitian.eq, trace_sqrt_filter D₀ H hD₀, + trace_sqrt_filter D₁ J hD₁] using hf + +end + +section + +lemma tensorMap_outer_block_adjoint {a b c d : ℕ} {L : Mat a →ₗ[ℂ] Mat b} + {M : Mat c →ₗ[ℂ] Mat d} (hL : CompletelyPositive L) (hM : CompletelyPositive M) + (u s : Fin a × Fin c → ℂ) : + (fromBlocks (tensorMap L M (outer u u)) (tensorMap L M (outer u s)) + (tensorMap L M (outer u s))ᴴ (tensorMap L M (outer s s))).PosSemidef := by + have h := tensorMap_outer_block hL hM u s + have he := (Matrix.isHermitian_fromBlocks_iff.mp h.isHermitian).2.1 + rwa [he] + +lemma direct_block_bound {a b c d : ℕ} {L : Mat a →ₗ[ℂ] Mat b} + {M : Mat c →ₗ[ℂ] Mat d} (hL : CompletelyPositive L) (hM : CompletelyPositive M) + (u s : Fin a × Fin c → ℂ) (D₀ D₁ : Matrix (Fin b × Fin d) (Fin b × Fin d) ℂ) + (hD₀ : D₀.PosSemidef) (hD₁ : D₁.PosSemidef) : + traceNorm (CFC.sqrt D₀ * tensorMap L M (outer u s) * CFC.sqrt D₁) ≤ + Real.sqrt ((trace (D₀ * tensorMap L M (outer u u))).re * + (trace (D₁ * tensorMap L M (outer s s))).re) := by + exact sqrt_filtered_block_estimate _ _ _ _ _ + (tensorMap_outer_block_adjoint hL hM u s) hD₀ hD₁ + +lemma reversed_block_bound {a b c d : ℕ} {L : Mat a →ₗ[ℂ] Mat b} + {M : Mat c →ₗ[ℂ] Mat d} (hL : PPTType L) (hM : PPTType M) + (u s : Fin a × Fin c → ℂ) (D₀ D₁ : Matrix (Fin b × Fin d) (Fin b × Fin d) ℂ) + (hD₀ : D₀.PosSemidef) (hD₁ : D₁.PosSemidef) : + traceNorm (CFC.sqrt D₀ * tensorMap L M (outer u s) * CFC.sqrt D₁) ≤ + Real.sqrt ((trace (D₀ * tensorMap L M (outer s s))).re * + (trace (D₁ * tensorMap L M (outer u u))).re) := by + have h := direct_block_bound hL.2 hM.2 (star s) (star u) D₀ D₁ hD₀ hD₁ + simpa only [tensorMap_global_transpose, outer_transpose_conj] using h + +universe v464_0 + +variable {ι : Type v464_0} [inst464_0 : Fintype ι] [inst464_1 : DecidableEq ι] + +lemma trace_mul_nonneg {S T : Matrix ι ι ℂ} + (hS : S.PosSemidef) (hT : T.PosSemidef) : 0 ≤ trace (S * T) := by + let B := CFC.sqrt S + have hB : Bᴴ = B := (CFC.sqrt_nonneg S).posSemidef.isHermitian.eq + have hBB : B * B = S := CFC.sqrt_mul_sqrt_self S hS.nonneg + have h := (hT.mul_mul_conjTranspose_same B).trace_nonneg + rwa [hB, Matrix.trace_mul_cycle, hBB] at h + +lemma psd_of_quadratic_nonneg (A : Matrix ι ι ℂ) + (h : ∀ x : ι → ℂ, 0 ≤ star x ⬝ᵥ (A *ᵥ x)) : A.PosSemidef := by + apply Matrix.posSemidef_iff_dotProduct_mulVec.mpr + refine ⟨?_, h⟩ + apply Matrix.isSymmetric_toEuclideanLin_iff.mp + rw [LinearMap.isSymmetric_iff_inner_map_self_real] + intro x + have hp : 0 ≤ inner ℂ x (A.toEuclideanLin x) := by + simpa only [EuclideanSpace.inner_eq_star_dotProduct, Matrix.ofLp_toLpLin, Matrix.toLin'_apply, dotProduct_comm] using h (WithLp.ofLp x) + have hs := (IsSelfAdjoint.of_nonneg hp).star_eq + rw [← inner_conj_symm] + simpa only [starRingEnd_apply, star_star] using hs.symm + +omit inst464_1 in +lemma trace_mul_outer [DecidableEq ι] (A : Matrix ι ι ℂ) (u s : ι → ℂ) : + trace (A * outer u s) = star s ⬝ᵥ (A *ᵥ u) := by + simp only [trace, Matrix.diag, Matrix.mul_apply, outer, dotProduct, mulVec, + Finset.mul_sum, Pi.star_apply] + apply Finset.sum_congr rfl + intro i _ + apply Finset.sum_congr rfl + intro j _ + ring + +def effectDual {a b : ℕ} (L : Mat a →ₗ[ℂ] Mat b) (X : Mat b) : Mat a := + fun i j => trace (X * L (matrixUnit j i)) + +lemma effectDual_pairing {a b : ℕ} (L : Mat a →ₗ[ℂ] Mat b) (X : Mat b) (U : Mat a) : + trace (effectDual L X * U) = trace (X * L U) := by + have he : trace (X * L U) = ∑ i, ∑ j, U i j * trace (X * L (matrixUnit i j)) := by + rw [linearMap_matrix_units L U] + simp only [Matrix.mul_sum, Matrix.mul_smul, Matrix.trace_sum, Matrix.trace_smul, + smul_eq_mul] + rw [he] + simp only [trace, Matrix.diag, Matrix.mul_apply, effectDual] + rw [Finset.sum_comm] + apply Finset.sum_congr rfl + intro i _ + apply Finset.sum_congr rfl + intro j _ + ring + +lemma effectDual_positive {a b : ℕ} {L : Mat a →ₗ[ℂ] Mat b} + (hL : CompletelyPositive L) {X : Mat b} (hX : X.PosSemidef) : + (effectDual L X).PosSemidef := by + apply psd_of_quadratic_nonneg + intro u + rw [← trace_mul_outer, effectDual_pairing] + exact trace_mul_nonneg hX (cp_positive hL (outer_posSemidef u)) + +end + +lemma tensorMap_add {a b c d : ℕ} (L : Mat a →ₗ[ℂ] Mat b) (M : Mat c →ₗ[ℂ] Mat d) + (U V : Matrix (Fin a × Fin c) (Fin a × Fin c) ℂ) : + tensorMap L M (U+V) = tensorMap L M U + tensorMap L M V := by + ext i j + simp [tensorMap, add_mul, Finset.sum_add_distrib] + +lemma tensorMap_smul {a b c d : ℕ} (L : Mat a →ₗ[ℂ] Mat b) (M : Mat c →ₗ[ℂ] Mat d) + (z : ℂ) (U : Matrix (Fin a × Fin c) (Fin a × Fin c) ℂ) : + tensorMap L M (z • U) = z • tensorMap L M U := by + ext i j + simp [tensorMap, smul_eq_mul, mul_assoc, Finset.mul_sum] + +lemma tensorMap_expansion {a b c d : ℕ} (L : Mat a →ₗ[ℂ] Mat b) + (M : Mat c →ₗ[ℂ] Mat d) (U : Matrix (Fin a × Fin c) (Fin a × Fin c) ℂ) : + tensorMap L M U = ∑ i, ∑ j, U i j • + (L (matrixUnit i.1 j.1) ⊗ₖ M (matrixUnit i.2 j.2)) := by + ext s t + simp only [Matrix.sum_apply, Matrix.smul_apply, smul_eq_mul, Matrix.kroneckerMap_apply, + Fintype.sum_prod_type, tensorMap] + apply Finset.sum_congr rfl + intro i _ + rw [Finset.sum_comm] + apply Finset.sum_congr rfl + intro j _ + apply Finset.sum_congr rfl + intro k _ + apply Finset.sum_congr rfl + intro l _ + ring + +lemma tensorMap_effect_pairing {a b c d : ℕ} (L : Mat a →ₗ[ℂ] Mat b) + (M : Mat c →ₗ[ℂ] Mat d) (X : Mat b) (Y : Mat d) + (U : Matrix (Fin a × Fin c) (Fin a × Fin c) ℂ) : + trace ((X ⊗ₖ Y) * tensorMap L M U) = trace ((effectDual L X ⊗ₖ effectDual M Y) * U) := by + rw [tensorMap_expansion] + simp only [Matrix.mul_sum, Matrix.mul_smul, Matrix.trace_sum, Matrix.trace_smul, + ← Matrix.mul_kronecker_mul, Matrix.trace_kronecker, smul_eq_mul] + simp only [trace, Matrix.diag, Matrix.mul_apply, Matrix.kroneckerMap_apply, effectDual] + rw [Finset.sum_comm] + apply Finset.sum_congr rfl + intro i _ + apply Finset.sum_congr rfl + intro j _ + ring + +lemma tensor_weight_nonneg {a b c d : ℕ} {L : Mat a →ₗ[ℂ] Mat b} + {M : Mat c →ₗ[ℂ] Mat d} (hL : CompletelyPositive L) (hM : CompletelyPositive M) + (u : Fin a × Fin c → ℂ) {X : Mat b} {Y : Mat d} + (hX : X.PosSemidef) (hY : Y.PosSemidef) : + 0 ≤ weight (tensorMap L M (outer u u)) X Y := by + exact re_trace_mul_nonneg (hX.kronecker hY) (tensorMap_positive hL hM (outer_posSemidef u)) + +section + +universe v590_0 + +variable {ι : Type v590_0} [inst590_0 : Fintype ι] [inst590_1 : DecidableEq ι] + +lemma matrix_cfc_continuous (f : ℝ → ℝ) (H : Matrix ι ι ℂ) : + ContinuousOn f (spectrum ℝ H) := by + rw [continuousOn_iff_continuous_domRestrict] + exact continuous_of_discreteTopology + +lemma matrix_cfc_mul (f g : ℝ → ℝ) (H : Matrix ι ι ℂ) (_hH : H.IsHermitian) : + cfc (fun t => f t * g t) H = cfc f H * cfc g H := by + exact cfc_mul f g H (matrix_cfc_continuous f H) (matrix_cfc_continuous g H) + +lemma matrix_cfc_nonneg (f : ℝ → ℝ) (H : Matrix ι ι ℂ) (_hH : H.IsHermitian) + (hf : ∀ t ∈ spectrum ℝ H, 0 ≤ f t) : 0 ≤ cfc f H := by + exact cfc_nonneg (f := f) (a := H) hf + +def whiteningFunction (t : ℝ) : ℝ := if t = 0 then 1 else (Real.sqrt t)⁻¹ + +def unwhiteningFunction (t : ℝ) : ℝ := if t = 0 then 1 else Real.sqrt t + +def supportFunction (t : ℝ) : ℝ := if t = 0 then 0 else 1 + +lemma whitening_mul_unwhitening {t : ℝ} (ht : 0 ≤ t) : + whiteningFunction t * unwhiteningFunction t = 1 := by + by_cases h : t = 0 + · simp [whiteningFunction, unwhiteningFunction, h] + · simp [whiteningFunction, unwhiteningFunction, h, Real.sqrt_ne_zero'.mpr (lt_of_le_of_ne ht (Ne.symm h))] + +lemma whitening_square {t : ℝ} (ht : 0 ≤ t) : + whiteningFunction t * t * whiteningFunction t = supportFunction t := by + by_cases h : t = 0 + · simp [whiteningFunction, supportFunction, h] + · have hs : Real.sqrt t ≠ 0 := Real.sqrt_ne_zero'.mpr (lt_of_le_of_ne ht (Ne.symm h)) + simp only [whiteningFunction, supportFunction, ite_eq_right h] + calc + _ = (Real.sqrt t)⁻¹ * (Real.sqrt t * Real.sqrt t) * (Real.sqrt t)⁻¹ := by rw [Real.mul_self_sqrt ht] + _ = 1 := by field_simp + +lemma whitening_of_psd (H : Matrix ι ι ℂ) (hH : H.PosSemidef) : + let S := cfc whiteningFunction H + let T := cfc unwhiteningFunction H + let E := cfc supportFunction H + S.IsHermitian ∧ T.IsHermitian ∧ S * T = 1 ∧ T * S = 1 ∧ + S * H * S = E ∧ IsStarProjection E := by + dsimp + have hh : IsSelfAdjoint H := hH.isHermitian + have ht : ∀ t ∈ spectrum ℝ H, 0 ≤ t := fun t ht => + spectrum_nonneg_of_nonneg hH.nonneg ht + have hST : cfc whiteningFunction H * cfc unwhiteningFunction H = 1 := by + rw [← matrix_cfc_mul _ _ _ hH.isHermitian] + have he : cfc (fun t => whiteningFunction t * unwhiteningFunction t) H = cfc (fun _ : ℝ => 1) H := by + apply cfc_congr + intro t ht' + exact whitening_mul_unwhitening (ht t ht') + rw [he, cfc_const_one ℝ H] + refine ⟨IsSelfAdjoint.cfc.isHermitian, IsSelfAdjoint.cfc.isHermitian, hST, + ?_, ?_, ?_⟩ + · rw [(cfc_commute_cfc unwhiteningFunction whiteningFunction H).eq, hST] + · calc + _ = cfc whiteningFunction H * cfc (id : ℝ → ℝ) H * cfc whiteningFunction H := by rw [cfc_id ℝ H] + _ = cfc (fun t => whiteningFunction t * t * whiteningFunction t) H := by + rw [matrix_cfc_mul _ _ H hH.isHermitian, matrix_cfc_mul _ _ H hH.isHermitian] + rfl + _ = _ := cfc_congr (fun t ht' => whitening_square (ht t ht')) + · constructor + · change cfc supportFunction H * cfc supportFunction H = cfc supportFunction H + rw [← matrix_cfc_mul _ _ _ hH.isHermitian] + apply cfc_congr + intro t _ + simp [supportFunction] + · exact IsSelfAdjoint.cfc + +end + +section + +universe v667_0 + +variable {ι : Type v667_0} [inst667_0 : Fintype ι] [inst667_1 : DecidableEq ι] + +def cutFunction (t : ℝ) : ℝ := if 0 ≤ t then 1 else 0 + +lemma spectral_cut (H : Matrix ι ι ℂ) (hH : H.IsHermitian) : + let P := cfc cutFunction H + IsStarProjection P ∧ Commute P H ∧ (P * H * P).PosSemidef ∧ + ((1-P) * (-H) * (1-P)).PosSemidef := by + dsimp + have hh : IsSelfAdjoint H := hH + have hp : IsStarProjection (cfc cutFunction H) := by + constructor + · change cfc cutFunction H * cfc cutFunction H = cfc cutFunction H + rw [← matrix_cfc_mul _ _ H hH] + apply cfc_congr + intro t _ + simp [cutFunction] + · exact IsSelfAdjoint.cfc + have hc : Commute (cfc cutFunction H) H := (Commute.refl H).cfc_real _ + have hq : 1 - cfc cutFunction H = cfc (fun t => 1 - cutFunction t) H := by + rw [cfc_sub _ _ H (matrix_cfc_continuous _ H) (matrix_cfc_continuous _ H), cfc_const_one ℝ H] + refine ⟨hp, hc, ?_, ?_⟩ + · have he : cfc cutFunction H * H * cfc cutFunction H = + cfc (fun t => cutFunction t * t * cutFunction t) H := by + conv_lhs => arg 1; arg 2; rw [← cfc_id ℝ H] + rw [matrix_cfc_mul _ _ H hH, matrix_cfc_mul _ _ H hH] + rfl + rw [he] + apply LE.le.posSemidef + apply matrix_cfc_nonneg _ _ hH + intro t _ + by_cases ht : 0 ≤ t <;> simp [cutFunction, ht] + · rw [hq] + have hn : -H = cfc (fun t : ℝ => -t) H := by rw [cfc_neg_id (R := ℝ) H] + have he : cfc (fun t => 1 - cutFunction t) H * (-H) * cfc (fun t => 1 - cutFunction t) H = + cfc (fun t => (1-cutFunction t) * (-t) * (1-cutFunction t)) H := by + conv_lhs => arg 1; arg 2; rw [hn] + rw [matrix_cfc_mul _ _ H hH, matrix_cfc_mul _ _ H hH] + rw [he] + apply LE.le.posSemidef + apply matrix_cfc_nonneg _ _ hH + intro t _ + by_cases ht : 0 ≤ t <;> simp [cutFunction, ht] + linarith + +open scoped Matrix.Norms.L2Operator in +lemma commute_of_sum_projection (A B E : Matrix ι ι ℂ) + (hA : A.PosSemidef) (hB : B.PosSemidef) (hE : IsStarProjection E) (hsum : A+B=E) : + Commute A B := by + have hle : A ≤ E := by rw [← hsum]; exact le_add_of_nonneg_right hB.nonneg + have hsupp := hE.mul_right_and_mul_left_of_nonneg_of_le hA.nonneg hle + have he : B = E - A := by rw [← hsum]; abel + change A * B = B * A + rw [he, mul_sub, sub_mul, hsupp.1, hsupp.2] + +lemma whitened_effects_commute (A B : Matrix ι ι ℂ) (hA : A.PosSemidef) (hB : B.PosSemidef) : + let S := cfc whiteningFunction (A+B) + (S * A * S).PosSemidef ∧ (S * B * S).PosSemidef ∧ + Commute (S * A * S) (S * B * S) := by + dsimp + let S := cfc whiteningFunction (A+B) + let E := cfc supportFunction (A+B) + have hw := whitening_of_psd (A+B) (hA.add hB) + dsimp at hw + have hS : Sᴴ = S := hw.1.eq + have hSA : (S * A * S).PosSemidef := by + simpa only [hS] using hA.mul_mul_conjTranspose_same S + have hSB : (S * B * S).PosSemidef := by + simpa only [hS] using hB.mul_mul_conjTranspose_same S + have hsum : S * A * S + S * B * S = E := by + rw [← add_mul, ← mul_add] + exact hw.2.2.2.2.1 + exact ⟨hSA, hSB, commute_of_sum_projection _ _ E hSA hSB hw.2.2.2.2.2 hsum⟩ + +end + +section + +universe v746_0 + +variable {ι : Type v746_0} [inst746_0 : Fintype ι] [inst746_1 : DecidableEq ι] + +lemma projection_cross_zero {P A : Matrix ι ι ℂ} + (hP : IsStarProjection P) (hPA : Commute P A) : P * A * (1-P) = 0 := by + rw [hPA.eq, mul_assoc, hP.mul_one_sub_self, mul_zero] + +lemma commuting_spectral_cut (A B : Matrix ι ι ℂ) (hA : A.IsHermitian) + (hB : B.IsHermitian) (hAB : Commute A B) : + ∃ P : Matrix ι ι ℂ, IsStarProjection P ∧ Commute P A ∧ Commute P B ∧ + (P * (A-B) * P).PosSemidef ∧ ((1-P) * (B-A) * (1-P)).PosSemidef := by + let P := cfc cutFunction (A-B) + have h := spectral_cut (A-B) (hA.sub hB) + have ha : Commute (A-B) A := (Commute.refl A).sub_left hAB.symm + have hb : Commute (A-B) B := hAB.sub_left (Commute.refl B) + refine ⟨P, h.1, ha.cfc_real _, hb.cfc_real _, h.2.2.1, ?_⟩ + simpa only [neg_sub] using h.2.2.2 + +lemma congruence_cross (S T P A : Matrix ι ι ℂ) + (hS : S.IsHermitian) (hT : T.IsHermitian) (hP : P.IsHermitian) : + (S * P * T)ᴴ * A * (S * (1-P) * T) = T * (P * (S*A*S) * (1-P)) * T := by + simp only [Matrix.conjTranspose_mul, hS.eq, hT.eq, hP.eq] + noncomm_ring + +omit inst746_1 in +lemma congruence_diagonal [DecidableEq ι] (S T P A : Matrix ι ι ℂ) + (hS : S.IsHermitian) (hT : T.IsHermitian) (hP : P.IsHermitian) : + (S * P * T)ᴴ * A * (S * P * T) = T * (P * (S*A*S) * P) * T := by + simp only [Matrix.conjTranspose_mul, hS.eq, hT.eq, hP.eq] + noncomm_ring + +lemma generalized_effect_split (A B : Matrix ι ι ℂ) (hA : A.PosSemidef) + (hB : B.PosSemidef) : + ∃ V W : Matrix ι ι ℂ, V + W = 1 ∧ Vᴴ * A * W = 0 ∧ Vᴴ * B * W = 0 ∧ + (Vᴴ * (A-B) * V).PosSemidef ∧ (Wᴴ * (B-A) * W).PosSemidef := by + let S := cfc whiteningFunction (A+B) + let T := cfc unwhiteningFunction (A+B) + have hw := whitening_of_psd (A+B) (hA.add hB) + have hS : S.IsHermitian := hw.1 + have hT : T.IsHermitian := hw.2.1 + have hST : S*T=1 := hw.2.2.1 + have hc := whitened_effects_commute A B hA hB + obtain ⟨P, hP, hpA, hpB, hpplus, hpminus⟩ := + commuting_spectral_cut (S*A*S) (S*B*S) hc.1.isHermitian hc.2.1.isHermitian hc.2.2 + have hP' : P.IsHermitian := hP.isSelfAdjoint + have hQ : (1-P).IsHermitian := Matrix.isHermitian_one.sub hP' + refine ⟨S*P*T, S*(1-P)*T, ?_, ?_, ?_, ?_, ?_⟩ + · calc + _ = S * (P + (1-P)) * T := by noncomm_ring + _ = 1 := by simp [hST] + · rw [congruence_cross S T P A hS hT hP', projection_cross_zero hP hpA, mul_zero, zero_mul] + · rw [congruence_cross S T P B hS hT hP', projection_cross_zero hP hpB, mul_zero, zero_mul] + · rw [congruence_diagonal S T P (A-B) hS hT hP'] + have he : S * (A-B) * S = S*A*S - S*B*S := by noncomm_ring + rw [he] + simpa only [hT.eq] using hpplus.mul_mul_conjTranspose_same T + · rw [congruence_diagonal S T (1-P) (B-A) hS hT hQ] + have he : S * (B-A) * S = S*B*S - S*A*S := by noncomm_ring + rw [he] + simpa only [hT.eq] using hpminus.mul_mul_conjTranspose_same T + +end + +section + +universe v812_0 + +variable {ι : Type v812_0} [inst812_0 : Fintype ι] [inst812_1 : DecidableEq ι] + +def qform (A : Matrix ι ι ℂ) (u : ι → ℂ) : ℝ := (star u ⬝ᵥ (A *ᵥ u)).re + +omit inst812_1 in +lemma qform_nonneg [DecidableEq ι] {A : Matrix ι ι ℂ} (hA : A.PosSemidef) (u : ι → ℂ) : + 0 ≤ qform A u := by + exact (hA.dotProduct_mulVec_nonneg u).1 + +omit inst812_1 in +lemma qform_congruence [DecidableEq ι] (A T : Matrix ι ι ℂ) (u : ι → ℂ) : + qform A (T *ᵥ u) = qform (Tᴴ * A * T) u := by + simp only [qform, Matrix.star_mulVec, Matrix.mulVec_mulVec, Matrix.dotProduct_mulVec, + Matrix.vecMul_vecMul, mul_assoc] + +omit inst812_1 in +lemma qform_add [DecidableEq ι] (A B : Matrix ι ι ℂ) (u : ι → ℂ) : + qform (A+B) u = qform A u + qform B u := by + simp [qform, Matrix.add_mulVec, dotProduct_add] + +omit inst812_1 in +lemma qform_sub [DecidableEq ι] (A B : Matrix ι ι ℂ) (u : ι → ℂ) : + qform (A-B) u = qform A u - qform B u := by + simp [qform, Matrix.sub_mulVec, dotProduct_sub] + +lemma tensor_qform_eq_weight {a b c d : ℕ} (L : Mat a →ₗ[ℂ] Mat b) + (M : Mat c →ₗ[ℂ] Mat d) (X : Mat b) (Y : Mat d) (u : Fin a × Fin c → ℂ) : + weight (tensorMap L M (outer u u)) X Y = qform (effectDual L X ⊗ₖ effectDual M Y) u := by + rw [weight, tensorMap_effect_pairing, trace_mul_outer] + rfl + +lemma tensor_filter_congruence {a c : ℕ} (A V W : Mat a) (B : Mat c) : + (V ⊗ₖ (1 : Mat c))ᴴ * (A ⊗ₖ B) * (W ⊗ₖ (1 : Mat c)) = + (Vᴴ * A * W) ⊗ₖ B := by + simp only [Matrix.conjTranspose_kronecker, Matrix.conjTranspose_one, + ← Matrix.mul_kronecker_mul, one_mul, mul_one] + +lemma filter_qform_split {A V W : Matrix ι ι ℂ} (hVW : V+W=1) + (hA : A.IsHermitian) (hcross : Vᴴ * A * W=0) (u : ι → ℂ) : + qform A u = qform A (V *ᵥ u) + qform A (W *ᵥ u) := by + have hcross' : Wᴴ * A * V=0 := by + have h := congrArg Matrix.conjTranspose hcross + simpa only [Matrix.conjTranspose_mul, Matrix.conjTranspose_conjTranspose, + hA.eq, Matrix.conjTranspose_zero, mul_assoc] using h + have he : A = Vᴴ*A*V + Wᴴ*A*W := by + calc + A = (V+W)ᴴ*A*(V+W) := by simp [hVW] + _ = Vᴴ*A*V + Wᴴ*A*W := by + simp only [Matrix.conjTranspose_add, add_mul, mul_add, hcross, hcross'] + abel + rw [qform_congruence, qform_congruence, ← qform_add, ← he] + +lemma input_split_weights {a c : ℕ} (A₀ A₁ : Mat a) (B₀ B₁ : Mat c) + (hA₀ : A₀.PosSemidef) (hA₁ : A₁.PosSemidef) + (hB₀ : B₀.PosSemidef) (hB₁ : B₁.PosSemidef) (χ : Fin a × Fin c → ℂ) : + ∃ v w, χ = v+w ∧ + (∀ A ∈ ({A₀,A₁} : Finset (Mat a)), ∀ B ∈ ({B₀,B₁} : Finset (Mat c)), + qform (A ⊗ₖ B) χ = qform (A ⊗ₖ B) v + qform (A ⊗ₖ B) w) ∧ + qform (A₁ ⊗ₖ B₁) v ≤ qform (A₀ ⊗ₖ B₁) v ∧ + qform (A₀ ⊗ₖ B₀) w ≤ qform (A₁ ⊗ₖ B₀) w := by + classical + obtain ⟨V,W,hVW,hcross₀,hcross₁,hplus,hminus⟩ := generalized_effect_split A₀ A₁ hA₀ hA₁ + let VV := V ⊗ₖ (1 : Mat c) + let WW := W ⊗ₖ (1 : Mat c) + have hVVWW : VV+WW=1 := by + dsimp [VV, WW] + rw [← Matrix.add_kronecker, hVW, Matrix.one_kronecker_one] + refine ⟨VV *ᵥ χ, WW *ᵥ χ, ?_, ?_, ?_, ?_⟩ + · rw [← Matrix.add_mulVec, hVVWW, Matrix.one_mulVec] + · intro A hA B hB + have hc : Vᴴ*A*W=0 := by + simp only [Finset.mem_insert, Finset.mem_singleton] at hA + rcases hA with rfl | rfl <;> assumption + have hAp : A.PosSemidef := by + simp only [Finset.mem_insert, Finset.mem_singleton] at hA + rcases hA with rfl | rfl <;> assumption + have hBp : B.PosSemidef := by + simp only [Finset.mem_insert, Finset.mem_singleton] at hB + rcases hB with rfl | rfl <;> assumption + apply filter_qform_split hVVWW (hAp.kronecker hBp).isHermitian + dsimp [VV, WW] + rw [tensor_filter_congruence, hc, Matrix.zero_kronecker] + · have h := qform_nonneg (hplus.kronecker hB₁) χ + rw [qform_congruence, qform_congruence] + dsimp [VV] + rw [tensor_filter_congruence, tensor_filter_congruence] + have he : (Vᴴ * (A₀-A₁) * V) ⊗ₖ B₁ = + (Vᴴ*A₀*V) ⊗ₖ B₁ - (Vᴴ*A₁*V) ⊗ₖ B₁ := by + rw [mul_sub, sub_mul] + ext i j + simp only [Matrix.kroneckerMap_apply, Matrix.sub_apply, sub_mul] + rw [he, qform_sub] at h + linarith + · have h := qform_nonneg (hminus.kronecker hB₀) χ + rw [qform_congruence, qform_congruence] + dsimp [WW] + rw [tensor_filter_congruence, tensor_filter_congruence] + have he : (Wᴴ * (A₁-A₀) * W) ⊗ₖ B₀ = + (Wᴴ*A₁*W) ⊗ₖ B₀ - (Wᴴ*A₀*W) ⊗ₖ B₀ := by + rw [mul_sub, sub_mul] + ext i j + simp only [Matrix.kroneckerMap_apply, Matrix.sub_apply, sub_mul] + rw [he, qform_sub] at h + linarith + +end + +universe v919_0 + +lemma outer_add_four {ι : Type v919_0} (v w : ι → ℂ) : + outer (v+w) (v+w) = outer v v + outer w w + outer v w + outer w v := by + ext i j + simp only [outer, Pi.add_apply, star_add, Matrix.add_apply] + ring + +lemma sqrt_mul_mono {a b c d : ℝ} (hb : 0 ≤ b) (hc : 0 ≤ c) + (hac : a ≤ c) (hbd : b ≤ d) : Real.sqrt (a*b) ≤ Real.sqrt (c*d) := + Real.sqrt_le_sqrt (mul_le_mul hac hbd hb hc) + +theorem four_effect_inequality {a b : ℕ} + (R : Matrix (Fin a × Fin b) (Fin a × Fin b) ℂ) (hR : InClass R) + (X₀ X₁ : Mat a) (Y₀ Y₁ : Mat b) + (hX₀ : X₀.PosSemidef) (hX₁ : X₁.PosSemidef) + (hY₀ : Y₀.PosSemidef) (hY₁ : Y₁.PosSemidef) : + traceNorm (CFC.sqrt (X₀ ⊗ₖ Y₀) * R * CFC.sqrt (X₁ ⊗ₖ Y₁)) ≤ + Real.sqrt (weight R X₀ Y₀ * weight R X₀ Y₁) + + Real.sqrt (weight R X₁ Y₀ * weight R X₁ Y₁) + + 2 * Real.sqrt (weight R X₀ Y₁ * weight R X₁ Y₀) := by + classical + obtain ⟨_,c,d,L,M,χ,hL,hM,rfl⟩ := hR + let A₀ := effectDual L X₀ + let A₁ := effectDual L X₁ + let B₀ := effectDual M Y₀ + let B₁ := effectDual M Y₁ + obtain ⟨v,w,hχ,hsplit,hv,hw⟩ := input_split_weights A₀ A₁ B₀ B₁ + (effectDual_positive hL.1 hX₀) (effectDual_positive hL.1 hX₁) + (effectDual_positive hM.1 hY₀) (effectDual_positive hM.1 hY₁) χ + let p := fun X Y u => weight (tensorMap L M (outer u u)) X Y + let Z := fun u s => CFC.sqrt (X₀ ⊗ₖ Y₀) * tensorMap L M (outer u s) * + CFC.sqrt (X₁ ⊗ₖ Y₁) + have hpos (X : Mat a) (Y : Mat b) (hX : X.PosSemidef) (hY : Y.PosSemidef) + (u : Fin c × Fin d → ℂ) : 0 ≤ p X Y u := tensor_weight_nonneg hL.1 hM.1 u hX hY + have hsplit' (X : Mat a) (hX : X ∈ ({X₀,X₁} : Finset (Mat a))) + (Y : Mat b) (hY : Y ∈ ({Y₀,Y₁} : Finset (Mat b))) : + p X Y χ = p X Y v + p X Y w := by + dsimp [p] + simp only [tensor_qform_eq_weight] + apply hsplit + · simp only [Finset.mem_insert, Finset.mem_singleton] at hX ⊢ + rcases hX with rfl | rfl <;> tauto + · simp only [Finset.mem_insert, Finset.mem_singleton] at hY ⊢ + rcases hY with rfl | rfl <;> tauto + have hmono (X : Mat a) (hX : X ∈ ({X₀,X₁} : Finset (Mat a))) + (Y : Mat b) (hY : Y ∈ ({Y₀,Y₁} : Finset (Mat b))) : + p X Y v ≤ p X Y χ ∧ p X Y w ≤ p X Y χ := by + have hXp : X.PosSemidef := by + simp only [Finset.mem_insert, Finset.mem_singleton] at hX + rcases hX with rfl | rfl <;> assumption + have hYp : Y.PosSemidef := by + simp only [Finset.mem_insert, Finset.mem_singleton] at hY + rcases hY with rfl | rfl <;> assumption + have he := hsplit' X hX Y hY + have hvp := hpos X Y hXp hYp v + have hwp := hpos X Y hXp hYp w + constructor <;> linarith + have h00 := hmono X₀ (by simp) Y₀ (by simp) + have h01 := hmono X₀ (by simp) Y₁ (by simp) + have h10 := hmono X₁ (by simp) Y₀ (by simp) + have h11 := hmono X₁ (by simp) Y₁ (by simp) + have hv' : p X₁ Y₁ v ≤ p X₀ Y₁ v := by simpa [p, tensor_qform_eq_weight, A₀,A₁,B₀,B₁] using hv + have hw' : p X₀ Y₀ w ≤ p X₁ Y₀ w := by simpa [p, tensor_qform_eq_weight, A₀,A₁,B₀,B₁] using hw + have hdir (u s : Fin c × Fin d → ℂ) : + traceNorm (Z u s) ≤ Real.sqrt (p X₀ Y₀ u * p X₁ Y₁ s) := + direct_block_bound hL.1 hM.1 u s _ _ (hX₀.kronecker hY₀) (hX₁.kronecker hY₁) + have hrev (u s : Fin c × Fin d → ℂ) : + traceNorm (Z u s) ≤ Real.sqrt (p X₀ Y₀ s * p X₁ Y₁ u) := + reversed_block_bound hL hM u s _ _ (hX₀.kronecker hY₀) (hX₁.kronecker hY₁) + have hvv : traceNorm (Z v v) ≤ Real.sqrt (p X₀ Y₀ χ * p X₀ Y₁ χ) := + (hdir v v).trans (sqrt_mul_mono (hpos _ _ hX₁ hY₁ v) (hpos _ _ hX₀ hY₀ χ) + h00.1 (hv'.trans h01.1)) + have hww : traceNorm (Z w w) ≤ Real.sqrt (p X₁ Y₀ χ * p X₁ Y₁ χ) := + (hdir w w).trans (sqrt_mul_mono (hpos _ _ hX₁ hY₁ w) (hpos _ _ hX₁ hY₀ χ) + (hw'.trans h10.2) h11.2) + have hcross : Real.sqrt (p X₀ Y₀ w * p X₁ Y₁ v) ≤ + Real.sqrt (p X₀ Y₁ χ * p X₁ Y₀ χ) := by + rw [mul_comm (p X₀ Y₁ χ)] + exact sqrt_mul_mono (hpos _ _ hX₁ hY₁ v) (hpos _ _ hX₁ hY₀ χ) + (hw'.trans h10.2) (hv'.trans h01.1) + have hvw := (hrev v w).trans hcross + have hwv := (hdir w v).trans hcross + have hZ : Z χ χ = Z v v + Z w w + Z v w + Z w v := by + dsimp [Z] + rw [hχ, outer_add_four] + simp only [tensorMap_add, mul_add, add_mul] + change traceNorm (Z χ χ) ≤ _ + rw [hZ] + have ht₁ := traceNorm_add_le (Z v v) (Z w w) + have ht₂ := traceNorm_add_le (Z v v + Z w w) (Z v w) + have ht₃ := traceNorm_add_le (Z v v + Z w w + Z v w) (Z w v) + change traceNorm _ ≤ Real.sqrt (p X₀ Y₀ χ * p X₀ Y₁ χ) + + Real.sqrt (p X₁ Y₀ χ * p X₁ Y₁ χ) + 2 * Real.sqrt (p X₀ Y₁ χ * p X₁ Y₀ χ) + linarith + +universe v1039_0 + +lemma cp_sum {a b : ℕ} {ν : Type v1039_0} [Fintype ν] (L : ν → Mat a →ₗ[ℂ] Mat b) + (hL : ∀ s, CompletelyPositive (L s)) : CompletelyPositive (∑ s, L s) := by + intro r U hU + have he : amplify (∑ s, L s) r U = ∑ s, amplify (L s) r U := by + ext i j + change (∑ s, L s) (fun x y => U (i.1,x) (j.1,y)) i.2 j.2 = _ + erw [LinearMap.sum_apply] + simp only [Matrix.sum_apply, amplify] + + rw [he] + exact Matrix.posSemidef_sum _ (fun s _ => hL s r U hU) + +lemma cp_comp {a b c : ℕ} {L : Mat b →ₗ[ℂ] Mat c} {M : Mat a →ₗ[ℂ] Mat b} + (hL : CompletelyPositive L) (hM : CompletelyPositive M) : CompletelyPositive (L.comp M) := by + intro r U hU + exact hL r (amplify M r U) (hM r U hU) + +def tensorLinear {a b c d : ℕ} (L : Mat a →ₗ[ℂ] Mat b) (M : Mat c →ₗ[ℂ] Mat d) : + Mat (a*c) →ₗ[ℂ] Mat (b*d) where + toFun U := (tensorMap L M (U.submatrix finProdFinEquiv finProdFinEquiv)).submatrix + finProdFinEquiv.symm finProdFinEquiv.symm + map_add' U V := by + simp only [Matrix.submatrix_add, Pi.add_apply, tensorMap_add] + map_smul' z U := by + simp only [Matrix.submatrix_smul, Pi.smul_apply, tensorMap_smul, RingHom.id_apply] + +lemma cp_tensorLinear {a b c d : ℕ} {L : Mat a →ₗ[ℂ] Mat b} {M : Mat c →ₗ[ℂ] Mat d} + (hL : CompletelyPositive L) (hM : CompletelyPositive M) : CompletelyPositive (tensorLinear L M) := by + intro r U hU + have h := (tensorMap_amplify_positive hL hM + (hU.submatrix (fun i : Fin r × (Fin a × Fin c) => (i.1, finProdFinEquiv i.2)))).submatrix + (fun i : Fin r × Fin (b*d) => (i.1, finProdFinEquiv.symm i.2)) + exact h + +lemma tensorLinear_transpose {a b c d : ℕ} (L : Mat a →ₗ[ℂ] Mat b) (M : Mat c →ₗ[ℂ] Mat d) : + (tensorLinear L M).comp (transposeLinear (a*c)) = + tensorLinear (L.comp (transposeLinear a)) (M.comp (transposeLinear c)) := by + ext U i j + exact congr_fun (congr_fun (tensorMap_global_transpose L M + (U.submatrix finProdFinEquiv finProdFinEquiv)).symm + (finProdFinEquiv.symm i)) (finProdFinEquiv.symm j) + +lemma ppt_tensorLinear {a b c d : ℕ} {L : Mat a →ₗ[ℂ] Mat b} {M : Mat c →ₗ[ℂ] Mat d} + (hL : PPTType L) (hM : PPTType M) : PPTType (tensorLinear L M) := by + refine ⟨cp_tensorLinear hL.1 hM.1, ?_⟩ + rw [tensorLinear_transpose] + exact cp_tensorLinear hL.2 hM.2 + +end ZeroKey + +end + +end OAI diff --git a/lean/OAI/InformationTheory/SecretKey/MatrixMeasure.lean b/lean/OAI/InformationTheory/SecretKey/MatrixMeasure.lean new file mode 100644 index 0000000000000000000000000000000000000000..43f6b614f120b231c90e91cb5b39b666c2375d0b --- /dev/null +++ b/lean/OAI/InformationTheory/SecretKey/MatrixMeasure.lean @@ -0,0 +1,649 @@ +import OAI.InformationTheory.SecretKey.Sampling + +namespace OAI + +noncomputable section + +namespace ZeroKey + +section + +open MeasureTheory ProbabilityTheory Set Function unitInterval + +universe v4286_0 v4286_1 + +theorem exists_local_instrument_sampler {O : Type v4286_0} {M : Type v4286_1} [MeasurableSpace O] + [StandardBorelSpace O] [Nonempty O] [MeasurableSpace M] + (alice : ℕ → Bool) + (κA κB : (n : ℕ) → Kernel ((Fin n → (O ⊕ Unit)) × (Fin n → M)) O) + [∀ n, IsMarkovKernel (κA n)] [∀ n, IsMarkovKernel (κB n)] + (sendA sendB : (n : ℕ) → ((Fin n → (O ⊕ Unit)) × (Fin n → M)) × O → M) + (ha : ∀ n, Measurable (sendA n)) (hb : ∀ n, Measurable (sendB n)) : + ∃ p : LocalOutcomeSampler O M, + p.alice = alice ∧ p.sendA = sendA ∧ p.sendB = sendB ∧ + (∀ n s, volume.map (fun u => p.sampleA n (s,u)) = κA n s) ∧ + (∀ n s, volume.map (fun u => p.sampleB n (s,u)) = κB n s) := by + have hA (n : ℕ) := sample_instrument_kernel (κA n) + have hB (n : ℕ) := sample_instrument_kernel (κB n) + choose fA hfA hlawA hrestA using hA + choose fB hfB hlawB hrestB using hB + exact ⟨⟨alice,fun n pair => fA n pair.1 pair.2, + fun n pair => fB n pair.1 pair.2,sendA,sendB,hfA,hfB,ha,hb⟩, + rfl,rfl,rfl,hlawA,hlawB⟩ + +namespace LocalOutcomeSampler + +universe v4306_0 v4306_1 + +variable {O : Type v4306_0} {M : Type v4306_1} [inst4306_0 : MeasurableSpace O] [inst4306_1 : MeasurableSpace M] + (p : LocalOutcomeSampler O M) + +def instrumentKernel + (κA κB : (n : ℕ) → Kernel ((Fin n → (O ⊕ Unit)) × (Fin n → M)) O) + (n : ℕ) : Kernel (Fin n → O) O := + if p.alice n then + (κA n).comap (fun x => (p.extractPrivate true n x,p.publicFrom n x)) + ((p.measurable_extractPrivate true n).prodMk (p.measurable_publicFrom n)) else + (κB n).comap (fun x => (p.extractPrivate false n x,p.publicFrom n x)) + ((p.measurable_extractPrivate false n).prodMk (p.measurable_publicFrom n)) + +instance instrumentKernel_markov + (κA κB : (n : ℕ) → Kernel ((Fin n → (O ⊕ Unit)) × (Fin n → M)) O) + [∀ n, IsMarkovKernel (κA n)] [∀ n, IsMarkovKernel (κB n)] (n : ℕ) : + IsMarkovKernel (p.instrumentKernel κA κB n) := by + unfold instrumentKernel + split <;> infer_instance + +lemma causal_step_law + (κA κB : (n : ℕ) → Kernel ((Fin n → (O ⊕ Unit)) × (Fin n → M)) O) + (ha : ∀ n s, volume.map (fun u => p.sampleA n (s,u)) = κA n s) + (hb : ∀ n s, volume.map (fun u => p.sampleB n (s,u)) = κB n s) : + ∀ n s, volume.map (fun u => p.causal.step n (s,u)) = p.instrumentKernel κA κB n s := by + intro n s + change volume.map (fun u => if p.alice n then + p.sampleA n ((p.extractPrivate true n s,p.publicFrom n s),u) else + p.sampleB n ((p.extractPrivate false n s,p.publicFrom n s),u)) = _ + unfold instrumentKernel + split <;> simp_all only [Kernel.comap_apply] + +end LocalOutcomeSampler + +end + +section + +open MeasureTheory Matrix Filter + +open scoped ComplexOrder MatrixOrder + +universe v4357_0 v4357_1 + +variable {Ω : Type v4357_0} {ι : Type v4357_1} [inst4357_0 : MeasurableSpace Ω] [inst4357_1 : Fintype ι] [inst4357_2 : DecidableEq ι] + +namespace PositiveMatrixMeasure + +open scoped Matrix.Norms.L2Operator in +lemma integrable_density (W : PositiveMatrixMeasure Ω ι) (μ : Measure Ω) : + Integrable (W.density μ) μ := by + have hh : Integrable (fun t i j => (W.entry i j).rnDeriv μ t) μ := by + apply integrable_pi_iff.mpr; intro i + apply integrable_pi_iff.mpr; intro j + exact W.integrable_entry μ i j + let L : (ι → ι → ℂ) →L[ℂ] Matrix ι ι ℂ := + LinearMap.toContinuousLinearMap (Matrix.ofLinearEquiv ℂ).toLinearMap + exact L.integrable_comp hh + +end PositiveMatrixMeasure + +end + +section + +open MeasureTheory Matrix Filter + +open scoped ComplexOrder MatrixOrder Matrix.Norms.L2Operator ProbabilityTheory ENNReal NNReal Topology + +universe v4623_0 v4623_1 + +variable {Ω : Type v4623_0} {ι : Type v4623_1} {mΩ : MeasurableSpace Ω} [inst4623_0 : Fintype ι] [inst4623_1 : DecidableEq ι] + {μ : Measure Ω} [inst4623_2 : IsFiniteMeasure μ] {F : Filtration ℕ mΩ} + +theorem positive_matrix_martingale_extension (W : ℕ → Ω → Matrix ι ι ℂ) + (hr : ∀ i j, Martingale (fun n ω => (W n ω i j).re) F μ) + (hi : ∀ i j, Martingale (fun n ω => (W n ω i j).im) F μ) + (hp : ∀ n, ∀ᵐ ω ∂μ, (W n ω).PosSemidef) + (ht : ∀ n, ∀ᵐ ω ∂μ, (trace (W n ω)).re ≤ 1) : + ∃ V : PositiveMatrixMeasure Ω ι, ∀ n S, MeasurableSet[F n] S → + V.value S = fun i j => ∫ ω in S, W n ω i j ∂μ := by + have hbound (n : ℕ) (i j : ι) : ∀ᵐ ω ∂μ, ‖W n ω i j‖ ≤ 1 := by + filter_upwards [hp n,ht n] with ω hω htω + exact (psd_entry_norm_le_trace hω i j).trans htω + have hbr (i j : ι) (n : ℕ) : ∀ᵐ ω ∂μ, ‖(W n ω i j).re‖ ≤ 1 := + (hbound n i j).mono (fun ω hω => (show ‖(W n ω i j).re‖ ≤ ‖W n ω i j‖ from by simpa only [Real.norm_eq_abs] using Complex.abs_re_le_norm (W n ω i j)).trans hω) + have hbi (i j : ι) (n : ℕ) : ∀ᵐ ω ∂μ, ‖(W n ω i j).im‖ ≤ 1 := + (hbound n i j).mono (fun ω hω => (show ‖(W n ω i j).im‖ ≤ ‖W n ω i j‖ from by simpa only [Real.norm_eq_abs] using Complex.abs_im_le_norm (W n ω i j)).trans hω) + choose gr hgr htr hcr using (fun i j => bounded_martingale_limit (hr i j) (hbr i j)) + choose gi hgi hti hci using (fun i j => bounded_martingale_limit (hi i j) (hbi i j)) + let G : Ω → Matrix ι ι ℂ := fun ω i j => (gr i j ω : ℂ) + (gi i j ω : ℂ)*Complex.I + have hG (i j : ι) : Integrable (fun ω => G ω i j) μ := + ((hgr i j).ofReal).add (((hgi i j).ofReal).mul_const Complex.I) + have hlim : ∀ᵐ ω ∂μ, Tendsto (fun n => W n ω) atTop (𝓝 (G ω)) := by + have htr' := ae_all_iff.mpr (fun i => ae_all_iff.mpr (htr i)) + have hti' := ae_all_iff.mpr (fun i => ae_all_iff.mpr (hti i)) + filter_upwards [htr',hti'] with ω hωr hωi + have hc : Tendsto (fun n i j => W n ω i j) atTop (𝓝 (fun i j => G ω i j)) := by + apply tendsto_pi_nhds.mpr; intro i + apply tendsto_pi_nhds.mpr; intro j + have hh := (Complex.continuous_ofReal.continuousAt.tendsto.comp (hωr i j)).add + ((Complex.continuous_ofReal.continuousAt.tendsto.comp (hωi i j)).mul_const Complex.I) + simpa only [Function.comp_apply, Pi.add_apply, Complex.re_add_im] using hh + have hcM : Continuous (Matrix.of : (ι → ι → ℂ) → Matrix ι ι ℂ) := + continuous_matrix (fun i j => continuous_apply_apply i j) + exact hcM.continuousAt.tendsto.comp hc + have hGp : ∀ᵐ ω ∂μ, (G ω).PosSemidef := by + filter_upwards [hlim,ae_all_iff.mpr hp] with ω hω hh + exact (isClosed_Ici.mem_of_tendsto hω (Eventually.of_forall (fun n => (hh n).nonneg))).posSemidef + refine ⟨positiveMatrixMeasureOfDensity hG hGp, ?_⟩ + intro n S hS + rw [positiveMatrixMeasureOfDensity_value hG hGp S (F.le n S hS)] + have hc (i j : ι) : Integrable (fun ω => W n ω i j) μ := by + have hh := ((hr i j).integrable n).ofReal.add (((hi i j).integrable n).ofReal.mul_const Complex.I) + have hefun : (fun ω => W n ω i j) = + ((fun ω => ((W n ω i j).re : ℂ)) + (fun ω => ((W n ω i j).im : ℂ)*Complex.I)) := + funext (fun ω => (Complex.re_add_im (W n ω i j)).symm) + rw [hefun] + exact hh + have he (i j : ι) : (∫ ω in S, G ω i j ∂μ) = ∫ ω in S, W n ω i j ∂μ := by + apply Complex.ext + · change RCLike.re (∫ ω in S, G ω i j ∂μ) = RCLike.re (∫ ω in S, W n ω i j ∂μ) + rw [← integral_re (hG i j).integrableOn, ← integral_re (hc i j).integrableOn] + have heG : (fun ω => RCLike.re (G ω i j)) = gr i j := by + funext ω + change ((gr i j ω : ℂ) + (gi i j ω : ℂ)*Complex.I).re = _ + simp + rw [heG] + calc + _ = ∫ ω in S, μ[gr i j | F n] ω ∂μ := + (setIntegral_condExp (F.le n) (hgr i j) hS).symm + _ = _ := integral_congr_ae (ae_restrict_of_ae (hcr i j n).symm) + · change RCLike.im (∫ ω in S, G ω i j ∂μ) = RCLike.im (∫ ω in S, W n ω i j ∂μ) + rw [← integral_im (hG i j).integrableOn, ← integral_im (hc i j).integrableOn] + have heG : (fun ω => RCLike.im (G ω i j)) = gi i j := by + funext ω + change ((gr i j ω : ℂ) + (gi i j ω : ℂ)*Complex.I).im = _ + simp + rw [heG] + calc + _ = ∫ ω in S, μ[gi i j | F n] ω ∂μ := + (setIntegral_condExp (F.le n) (hgi i j) hS).symm + _ = _ := integral_congr_ae (ae_restrict_of_ae (hci i j n).symm) + exact Matrix.ext (fun i j => (integral_matrix_entry (integrable_matrix_of_entries hG).integrableOn i j).trans (he i j)) + +end + +section + +open scoped ComplexOrder MatrixOrder Kronecker + +open Matrix + +section ReferenceAlgebra + +universe v4714_0 v4714_1 v4714_2 + +variable {ι : Type v4714_0} {κ : Type v4714_1} {η : Type v4714_2} [inst4714_0 : Fintype ι] [inst4714_1 : Fintype κ] [inst4714_2 : Fintype η] + [inst4714_3 : DecidableEq ι] [inst4714_4 : DecidableEq κ] [inst4714_5 : DecidableEq η] + +omit inst4714_2 inst4714_3 inst4714_5 in +lemma keepReference_pos [Fintype η] [DecidableEq ι] [DecidableEq η] {U : Matrix (ι × η) (ι × η) ℂ} (hU : U.PosSemidef) : + (keepReference U).PosSemidef := by + have he : keepReference U = ∑ i, U.submatrix (fun x => (i,x)) (fun x => (i,x)) := by + ext x y; simp [keepReference,Matrix.sum_apply] + rw [he] + exact Matrix.posSemidef_sum _ (fun i _ => hU.submatrix _) + +omit inst4714_3 inst4714_5 in +lemma trace_keepReference [DecidableEq ι] [DecidableEq η] (U : Matrix (ι × η) (ι × η) ℂ) : + trace (keepReference U) = trace U := by + simp only [trace,diag,keepReference,Fintype.sum_prod_type] + exact Finset.sum_comm + +end ReferenceAlgebra + +universe v4805_0 v4805_1 + +variable {a b : ℕ} {η : Type v4805_0} {κ : Type v4805_1} [inst4805_0 : Fintype η] [inst4805_1 : Fintype κ] + [inst4805_2 : DecidableEq η] [inst4805_3 : DecidableEq κ] + +def localAction (L : Mat a →ₗ[ℂ] Mat b) + (U : Matrix (Fin a × η) (Fin a × η) ℂ) : Matrix (Fin b × η) (Fin b × η) ℂ := + fun p q => L (fun i j => U (i,p.2) (j,q.2)) p.1 q.1 + +lemma localAction_refFilter (L : Mat a →ₗ[ℂ] Mat b) (K : Matrix κ η ℂ) + (U : Matrix (Fin a × η) (Fin a × η) ℂ) : + localAction L (referenceFilter K U) = referenceFilter K (localAction L U) := by + ext ⟨i,x⟩ ⟨j,y⟩ + rw [referenceFilter_apply] + change L (fun u v => referenceFilter K U (u,x) (v,y)) i j = _ + have he : (fun u v => referenceFilter K U (u,x) (v,y) : Mat a) = + ∑ s, ∑ t, (K x s * star (K y t)) • (fun u v => U (u,s) (v,t) : Mat a) := by + apply Matrix.ext; intro u v + rw [referenceFilter_apply] + + simp only [Finset.sum_apply,Pi.smul_apply,smul_eq_mul] + apply Finset.sum_congr rfl; intro s _ + apply Finset.sum_congr rfl; intro t _ + ring + have hm : L (∑ s, ∑ t, (K x s * star (K y t)) • (fun u v => U (u,s) (v,t) : Mat a)) = + ∑ s, ∑ t, (K x s * star (K y t)) • L (fun u v => U (u,s) (v,t)) := by + exact map_sum L _ _ |>.trans (Finset.sum_congr rfl (fun s _ => + (map_sum L _ _).trans (Finset.sum_congr rfl (fun t _ => L.map_smul _ _)))) + have hh := congrArg (fun F : Mat b => F i j) ((congrArg L he).trans hm) + refine hh.trans ?_ + + simp only [Matrix.sum_apply,Matrix.smul_apply,smul_eq_mul] + apply Finset.sum_congr rfl; intro s _ + apply Finset.sum_congr rfl; intro t _ + + unfold localAction + ring + +omit inst4805_2 in +lemma localAction_positive [DecidableEq η] (L : Mat a →ₗ[ℂ] Mat b) (hL : CompletelyPositive L) + {U : Matrix (Fin a × η) (Fin a × η) ℂ} (hU : U.PosSemidef) : + (localAction L U).PosSemidef := + (cp_amplifyIndex hL (U.submatrix Prod.swap Prod.swap) (hU.submatrix Prod.swap)).submatrix Prod.swap + +end + +namespace PositiveMatrixMeasure + +open MeasureTheory Matrix Filter + +open scoped ComplexOrder MatrixOrder + +universe v4860_0 v4860_1 + +variable {Ω : Type v4860_0} {ι : Type v4860_1} [inst4860_0 : MeasurableSpace Ω] [inst4860_1 : Fintype ι] [inst4860_2 : DecidableEq ι] + +lemma traceMeasure_real (W : PositiveMatrixMeasure Ω ι) (S : Set Ω) (hS : MeasurableSet S) : + W.traceMeasure.real S = (trace (W.value S)).re := by + rw [traceMeasure,SignedMeasure.toMeasureOfZeroLE_real_apply _ _ _ hS, + Set.univ_inter,traceSigned_apply] + +lemma value_zero_of_traceMeasure_zero (W : PositiveMatrixMeasure Ω ι) + (S : Set Ω) (hS : MeasurableSet S) (h : W.traceMeasure S=0) : W.value S=0 := by + have hr : (trace (W.value S)).re=0 := by + rw [← W.traceMeasure_real S hS,Measure.real,h,ENNReal.toReal_zero] + apply (W.positive S hS).trace_eq_zero_iff.mp + apply Complex.ext + · exact hr + · exact (RCLike.nonneg_iff.mp (W.positive S hS).trace_nonneg).2 + +universe v4900_0 + +def sum {β : Type v4900_0} [Fintype β] (W : β → PositiveMatrixMeasure Ω ι) : + PositiveMatrixMeasure Ω ι where + entry i j := ∑ k, (W k).entry i j + positive S hS := by + have he : (fun i j => (∑ k, (W k).entry i j) S) = ∑ k, (W k).value S := by + ext i j; simp [value,Matrix.sum_apply] + rw [he] + exact Matrix.posSemidef_sum _ (fun k _ => (W k).positive S hS) + +universe v4909_0 + +omit inst4860_2 in +lemma sum_value [DecidableEq ι] {β : Type v4909_0} [Fintype β] (W : β → PositiveMatrixMeasure Ω ι) (S : Set Ω) : + (sum W).value S = ∑ k, (W k).value S := by + ext i j; simp [value,sum,Matrix.sum_apply] + +universe v4913_0 + +lemma value_zero_of_sum_trace_zero {β : Type v4913_0} [Fintype β] + (W : β → PositiveMatrixMeasure Ω ι) (S : Set Ω) (hS : MeasurableSet S) + (h : (sum W).traceMeasure S=0) (k : β) : (W k).value S=0 := by + have he := value_zero_of_traceMeasure_zero (sum W) S hS h + rw [sum_value] at he + have ht : ∑ l, (Matrix.trace ((W l).value S)).re=0 := by + have hh := congrArg (fun M : Matrix ι ι ℂ => (trace M).re) he + simpa [Matrix.trace_sum,Complex.re_sum] using hh + have hp (l : β) : 0 ≤ (Matrix.trace ((W l).value S)).re := + (RCLike.nonneg_iff.mp ((W l).positive S hS).trace_nonneg).1 + have hz := (Finset.sum_eq_zero_iff_of_nonneg (fun l _ => hp l)).mp ht k (Finset.mem_univ k) + apply ((W k).positive S hS).trace_eq_zero_iff.mp + exact Complex.ext hz (RCLike.nonneg_iff.mp ((W k).positive S hS).trace_nonneg).2 + +universe v4940_0 + +lemma sum_trace_density_one {β : Type v4940_0} [Fintype β] + (W : β → PositiveMatrixMeasure Ω ι) : + ∀ᵐ t ∂(sum W).traceMeasure, ∑ k, (trace ((W k).density (sum W).traceMeasure t)).re = 1 := by + let μ := (sum W).traceMeasure + have hi (k : β) : Integrable (fun t => (trace ((W k).density μ t)).re) μ := + ((W k).integrable_trace_density μ).re + apply Integrable.ae_eq_of_forall_setIntegral_eq _ _ (integrable_finsetSum _ (fun k _ => hi k)) + (integrable_const (1:ℝ)) + intro S hS _ + rw [integral_finsetSum _ (fun k _ => (hi k).integrableOn)] + simp only [integral_const,smul_eq_mul,mul_one] + have hf (k : β) : (∫ t in S, (trace ((W k).density μ t)).re ∂μ) = + (trace ((W k).value S)).re := by + change (∫ t in S, RCLike.re (trace ((W k).density μ t)) ∂μ) = _ + rw [integral_re ((W k).integrable_trace_density μ).integrableOn, + integral_trace_density _ μ (fun T hT h => value_zero_of_sum_trace_zero W T hT h k) S hS] + rfl + simp_rw [hf] + simp only [Measure.real,Measure.restrict_apply_univ] + change _ = μ.real S + rw [show μ.real S=(trace ((sum W).value S)).re from (sum W).traceMeasure_real S hS, + sum_value,Matrix.trace_sum,Complex.re_sum] + +lemma integrable_test_density (W : PositiveMatrixMeasure Ω ι) (μ : Measure Ω) + (T : Matrix ι ι ℂ) : Integrable (fun t => trace (T * W.density μ t)) μ := by + unfold trace diag + simp only [Matrix.mul_apply] + apply integrable_finsetSum; intro i _ + apply integrable_finsetSum; intro j _ + exact (W.integrable_entry μ j i).const_mul _ + +lemma integral_test_density (W : PositiveMatrixMeasure Ω ι) (μ : Measure Ω) [SigmaFinite μ] + (hAC : ∀ S, MeasurableSet S → μ S=0 → W.value S=0) + (T : Matrix ι ι ℂ) (S : Set Ω) (hS : MeasurableSet S) : + (∫ t in S, trace (T * W.density μ t) ∂μ) = trace (T * W.value S) := by + change (∫ t in S, ∑ i, ∑ j, T i j * W.density μ t j i ∂μ) = + ∑ i, ∑ j, T i j * W.value S j i + rw [integral_finsetSum _ (fun i _ => integrable_finsetSum _ + (fun j _ => ((W.integrable_entry μ j i).const_mul (T i j)).integrableOn))] + apply Finset.sum_congr rfl; intro i _ + rw [integral_finsetSum _ (fun j _ => + ((W.integrable_entry μ j i).const_mul (T i j)).integrableOn)] + apply Finset.sum_congr rfl; intro j _ + rw [integral_const_mul,W.integral_density_entry μ hAC S hS j i] + +end PositiveMatrixMeasure + +open Matrix MeasureTheory + +open scoped ComplexOrder MatrixOrder Kronecker Matrix.Norms.L2Operator + +universe v5030_0 v5030_1 v5030_2 + +lemma referenceFilter_pos {ι : Type v5030_0} {η : Type v5030_1} {κ : Type v5030_2} [Fintype ι] [Fintype η] + [Fintype κ] [DecidableEq ι] (K : Matrix κ η ℂ) + {U : Matrix (ι × η) (ι × η) ℂ} (hU : U.PosSemidef) : + (referenceFilter K U).PosSemidef := + hU.mul_mul_conjTranspose_same _ + +section InstrumentAlgebra + +universe v5037_0 + +variable {a b : ℕ} {η : Type v5037_0} [inst5037_0 : Fintype η] [inst5037_1 : DecidableEq η] + +omit inst5037_0 inst5037_1 in +lemma localAction_product [Fintype η] [DecidableEq η] (L : Mat a →ₗ[ℂ] Mat b) + (A : Mat a) (B : Matrix η η ℂ) : + localAction L (A ⊗ₖ B) = L A ⊗ₖ B := by + ext ⟨i,x⟩ ⟨j,y⟩ + change L (fun u v => A u v * B x y) i j = L A i j * B x y + have he : (fun u v => A u v * B x y : Mat a) = B x y • A := by + ext u v; simp [smul_eq_mul,mul_comm] + rw [he,map_smul] + simp [smul_eq_mul,mul_comm] + +omit inst5037_0 inst5037_1 in +lemma keepReference_localAction [Fintype η] [DecidableEq η] (L : Mat a →ₗ[ℂ] Mat b) + (hL : ∀ A, trace (L A) = trace A) + (U : Matrix (Fin a × η) (Fin a × η) ℂ) : + keepReference (localAction L U) = keepReference U := by + ext x y + exact hL (fun i j => U (i,x) (j,y)) + +lemma trace_localAction (L : Mat a →ₗ[ℂ] Mat b) + (hL : ∀ A, trace (L A) = trace A) + (U : Matrix (Fin a × η) (Fin a × η) ℂ) : + trace (localAction L U) = trace U := by + rw [← trace_keepReference,keepReference_localAction L hL,trace_keepReference] + +end InstrumentAlgebra + +universe v5068_0 + +structure QuantumInstrument (O : Type v5068_0) [MeasurableSpace O] (a b : ℕ) where + operation : Set O → Mat a →ₗ[ℂ] Mat b + coefficient : Fin b → Fin b → Fin a → Fin a → ComplexMeasure O + operation_coefficient : ∀ S i j x y, + operation S (matrixUnit x y) i j = coefficient i j x y S + completelyPositive : ∀ S, MeasurableSet S → CompletelyPositive (operation S) + totalTrace : ∀ U, trace (operation Set.univ U) = trace U + +namespace PositiveMatrixMeasure + +universe v5077_0 v5077_1 v5077_2 + +variable {O : Type v5077_0} {ι : Type v5077_1} {η : Type v5077_2} [inst5077_0 : MeasurableSpace O] [inst5077_1 : Fintype ι] [inst5077_2 : Fintype η] + [inst5077_3 : DecidableEq ι] [inst5077_4 : DecidableEq η] + +def retainReference (W : PositiveMatrixMeasure O (ι × η)) : PositiveMatrixMeasure O η where + entry x y := ∑ i, W.entry (i,x) (i,y) + positive S hS := by + have hp : (keepReference (W.value S)).PosSemidef := keepReference_pos (W.positive S hS) + have he : (fun x y : η => (∑ i, W.entry (i,x) (i,y)) S) = + keepReference (W.value S) := by + ext x y + simp only [_root_.sum_apply,keepReference,value] + rw [he] + exact hp + +lemma retainReference_value (W : PositiveMatrixMeasure O (ι × η)) (S : Set O) : + W.retainReference.value S = keepReference (W.value S) := by + ext x y; simp [retainReference,value,keepReference,_root_.sum_apply] + +universe v5109_0 v5109_1 + +lemma pushforward_filter {T : Type v5109_0} {κ : Type v5109_1} [MeasurableSpace T] [Fintype κ] [DecidableEq κ] + (W : PositiveMatrixMeasure O η) (f : O → T) (hf : Measurable f) + (K : Matrix κ η ℂ) (S : Set T) (hS : MeasurableSet S) : + ((W.filter K).pushforward f hf).value S = + ((W.pushforward f hf).filter K).value S := by + rw [pushforward_value _ _ _ S hS,filter_value,filter_value,pushforward_value _ _ _ S hS] + +lemma normalized_density (W : PositiveMatrixMeasure O η) : + ∀ᵐ t ∂W.traceMeasure, Density (W.density W.traceMeasure t) := by + let μ := W.traceMeasure + have hAC := W.value_zero_of_traceMeasure_zero + have htrace : ∀ᵐ t ∂μ, (trace (W.density μ t)).re = 1 := by + apply Integrable.ae_eq_of_forall_setIntegral_eq _ _ + (W.integrable_trace_density μ).re (integrable_const (1 : ℝ)) + intro S hS _ + change (∫ t in S, RCLike.re (trace (W.density μ t)) ∂μ) = _ + rw [integral_re ((W.integrable_trace_density μ).integrableOn), + W.integral_trace_density μ hAC S hS,integral_const] + simp only [smul_eq_mul,mul_one] + change (trace (W.value S)).re = (μ.restrict S).real Set.univ + simpa only [Measure.real,Measure.restrict_apply_univ] using (W.traceMeasure_real S hS).symm + filter_upwards [htrace,density_posSemidef_ae W μ hAC] with t ht hp + refine ⟨hp,?_⟩ + exact Complex.ext ht (RCLike.nonneg_iff.mp hp.trace_nonneg).2 + +end PositiveMatrixMeasure + +namespace QuantumInstrument + +universe v5136_0 + +variable {O : Type v5136_0} [inst5136_0 : MeasurableSpace O] {a b : ℕ} + (J : QuantumInstrument O a b) + +lemma operation_apply (S : Set O) (U : Mat a) (i j : Fin b) : + J.operation S U i j = ∑ x, ∑ y, U x y * J.coefficient i j x y S := by + have hh := congrArg (fun X : Mat b => X i j) + (congrArg (J.operation S) (matrix_sum_units U)) + rw [map_sum] at hh + simp only [map_sum,map_smul,Matrix.sum_apply,Matrix.smul_apply,smul_eq_mul, + J.operation_coefficient] at hh + exact hh + +universe v5151_0 + +def withReference {η : Type v5151_0} [Fintype η] [DecidableEq η] + (U : Matrix (Fin a × η) (Fin a × η) ℂ) (hU : U.PosSemidef) : + PositiveMatrixMeasure O (Fin b × η) where + entry p q := ∑ x, ∑ y, U (x,p.2) (y,q.2) • J.coefficient p.1 q.1 x y + positive S hS := by + have he : (fun p q : Fin b × η => + (∑ x, ∑ y, U (x,p.2) (y,q.2) • J.coefficient p.1 q.1 x y) S) = + localAction (J.operation S) U := by + ext ⟨i,r⟩ ⟨j,s⟩ + simp only [_root_.sum_apply,_root_.smul_apply,smul_eq_mul] + exact (J.operation_apply S _ i j).symm + rw [he] + exact localAction_positive _ (J.completelyPositive S hS) hU + +universe v5165_0 + +lemma withReference_value {η : Type v5165_0} [Fintype η] [DecidableEq η] + (U : Matrix (Fin a × η) (Fin a × η) ℂ) (hU : U.PosSemidef) (S : Set O) : + (J.withReference U hU).value S = localAction (J.operation S) U := by + ext ⟨i,r⟩ ⟨j,s⟩ + change (∑ x, ∑ y, U (x,r) (y,s) • J.coefficient i j x y) S = _ + simp only [_root_.sum_apply,_root_.smul_apply,smul_eq_mul] + exact (J.operation_apply S _ i j).symm + +universe v5173_0 + +lemma total_reference_unchanged {η : Type v5173_0} [Fintype η] [DecidableEq η] + (U : Matrix (Fin a × η) (Fin a × η) ℂ) (hU : U.PosSemidef) : + keepReference ((J.withReference U hU).value Set.univ) = keepReference U := by + rw [J.withReference_value] + exact keepReference_localAction _ J.totalTrace U + +universe v5179_0 + +lemma normalized_outcome_measure {η : Type v5179_0} [Fintype η] [DecidableEq η] + (U : Matrix (Fin a × η) (Fin a × η) ℂ) (hU : Density U) : + IsProbabilityMeasure (J.withReference U hU.1).traceMeasure := by + constructor + apply (ENNReal.toReal_eq_one_iff _).mp + change (J.withReference U hU.1).traceMeasure.real Set.univ = 1 + rw [(J.withReference U hU.1).traceMeasure_real Set.univ MeasurableSet.univ, + J.withReference_value,trace_localAction _ J.totalTrace,hU.2] + rfl + +universe v5191_0 v5191_1 + +lemma withReference_filter {η : Type v5191_0} {κ : Type v5191_1} [Fintype η] [Fintype κ] + [DecidableEq η] [DecidableEq κ] + (U : Matrix (Fin a × η) (Fin a × η) ℂ) (hU : U.PosSemidef) + (K : Matrix κ η ℂ) (S : Set O) : + (J.withReference (referenceFilter K U) (referenceFilter_pos K hU)).value S = + referenceFilter K ((J.withReference U hU).value S) := by + rw [J.withReference_value,J.withReference_value,localAction_refFilter] + +universe v5200_0 + +def referenceLaw {η : Type v5200_0} [Fintype η] [DecidableEq η] + (U : Matrix (Fin a × η) (Fin a × η) ℂ) (hU : U.PosSemidef) : + PositiveMatrixMeasure O η := (J.withReference U hU).retainReference + +universe v5204_0 + +lemma referenceLaw_value {η : Type v5204_0} [Fintype η] [DecidableEq η] + (U : Matrix (Fin a × η) (Fin a × η) ℂ) (hU : U.PosSemidef) (S : Set O) : + (J.referenceLaw U hU).value S = keepReference (localAction (J.operation S) U) := by + rw [referenceLaw,PositiveMatrixMeasure.retainReference_value,J.withReference_value] + +universe v5209_0 v5209_1 + +lemma referenceLaw_filter {η : Type v5209_0} {κ : Type v5209_1} [Fintype η] [Fintype κ] + [DecidableEq η] [DecidableEq κ] + (U : Matrix (Fin a × η) (Fin a × η) ℂ) (hU : U.PosSemidef) + (K : Matrix κ η ℂ) (S : Set O) : + (J.referenceLaw (referenceFilter K U) (referenceFilter_pos K hU)).value S = + ((J.referenceLaw U hU).filter K).value S := by + rw [J.referenceLaw_value,localAction_refFilter,keepReference_filter, + PositiveMatrixMeasure.filter_value,J.referenceLaw_value] + +universe v5221_0 + +lemma reference_test_born {η : Type v5221_0} [Fintype η] [DecidableEq η] + (U : Matrix (Fin a × η) (Fin a × η) ℂ) (hU : U.PosSemidef) + (E : Matrix η η ℂ) (hE : E.PosSemidef) (S : Set O) (hS : MeasurableSet S) : + (J.referenceLaw (referenceFilter (CFC.sqrt E) U) + (referenceFilter_pos _ hU)).traceMeasure.real S = + (trace (E * (J.referenceLaw U hU).value S)).re := by + rw [PositiveMatrixMeasure.traceMeasure_real _ S hS,J.referenceLaw_filter, + PositiveMatrixMeasure.filter_value,(CFC.sqrt_nonneg E).posSemidef.isHermitian.eq, + Matrix.trace_mul_cycle, CFC.sqrt_mul_sqrt_self E hE.nonneg] + +universe v5235_0 + +theorem reference_posterior_mean {η : Type v5235_0} [Fintype η] [DecidableEq η] + (U : Matrix (Fin a × η) (Fin a × η) ℂ) (hU : Density U) : + let W := J.withReference U hU.1 + (∀ᵐ o ∂W.traceMeasure, Density (W.density W.traceMeasure o)) ∧ + ∀ x y, (∫ o, keepReference (W.density W.traceMeasure o) x y ∂W.traceMeasure) = + keepReference U x y := by + dsimp only + refine ⟨(J.withReference U hU.1).normalized_density,?_⟩ + intro x y + let W := J.withReference U hU.1 + have he : (∫ o, keepReference (W.density W.traceMeasure o) x y ∂W.traceMeasure) = + keepReference (W.value Set.univ) x y := by + change (∫ o, ∑ i, W.density W.traceMeasure o (i,x) (i,y) ∂W.traceMeasure) = _ + rw [integral_finsetSum _ (fun i _ => W.integrable_entry W.traceMeasure (i,x) (i,y))] + change (∑ i, ∫ o, W.density W.traceMeasure o (i,x) (i,y) ∂W.traceMeasure) = _ + change (∑ i, ∫ o, W.density W.traceMeasure o (i,x) (i,y) ∂W.traceMeasure) = + ∑ i, W.value Set.univ (i,x) (i,y) + apply Finset.sum_congr rfl + intro i _ + simpa only [Measure.restrict_univ] using W.integral_density_entry W.traceMeasure + W.value_zero_of_traceMeasure_zero Set.univ MeasurableSet.univ (i,x) (i,y) + rw [he] + exact congrArg (fun A : Matrix η η ℂ => A x y) (J.total_reference_unchanged U hU.1) + +end QuantumInstrument + +end ZeroKey + +open Matrix MeasureTheory ProbabilityTheory Filter + +open scoped ComplexOrder MatrixOrder Matrix.Norms.L2Operator + +namespace ZeroKey + +universe v5273_0 + +variable {O : Type v5273_0} [inst5273_0 : MeasurableSpace O] + +universe v5311_0 + +variable {ι : Type v5311_0} [inst5311_0 : Fintype ι] [inst5311_1 : DecidableEq ι] + +variable (P : Measure (ℕ → O)) [inst5327_0 : IsProbabilityMeasure P] + (K : (n : ℕ) → Kernel (Fin n → O) O) [inst5327_1 : ∀ n, IsMarkovKernel (K n)] + (hP : ∀ n, P.map (historyPrefix (n+1)) = + ((P.map (historyPrefix n)) ⊗ₘ K n).map + (fun pair : (Fin n → O) × O => Fin.snoc (α := fun _ : Fin (n+1) => O) pair.1 pair.2)) + (U : (n : ℕ) → (Fin n → O) → Matrix ι ι ℂ) + (hU : ∀ n s, Density (U n s)) (hm : ∀ n, Measurable (U n)) + (hmean : ∀ n s i j, + (∫ o, U (n+1) (Fin.snoc (α := fun _ : Fin (n+1) => O) s o) i j ∂K n s) = U n s i j) + +include hP hU hm hmean in +theorem instrument_history_reference_extension : + ∃ V : PositiveMatrixMeasure (ℕ → O) ι, ∀ n S, + MeasurableSet[historyFiltration n] S → + V.value S = fun i j => ∫ x in S, U n (historyPrefix n x) i j ∂P := by + apply positive_matrix_martingale_extension (fun n x => U n (historyPrefix n x)) + · exact reference_history_martingale_re P K hP U hU hm hmean + · exact reference_history_martingale_im P K hP U hU hm hmean + · intro n; exact Filter.Eventually.of_forall (fun x => (hU n _).1) + · intro n; exact Filter.Eventually.of_forall (fun x => by simp only [(hU n _).2,Complex.one_re,le_refl]) + +end ZeroKey + +end + +end OAI diff --git a/lean/OAI/InformationTheory/SecretKey/Model.lean b/lean/OAI/InformationTheory/SecretKey/Model.lean new file mode 100644 index 0000000000000000000000000000000000000000..3bce66a98765b55edcea7127c22c429b9cd5e7a2 --- /dev/null +++ b/lean/OAI/InformationTheory/SecretKey/Model.lean @@ -0,0 +1,6442 @@ +import Mathlib + +namespace OAI + +noncomputable section + +namespace ZeroKey + +section + +open scoped MatrixOrder ComplexOrder Kronecker + +open Matrix + +universe v17_0 + +theorem exists_isometry_comp_of_norm_eq {V : Type v17_0} [inst17_0 : NormedAddCommGroup V] + [inst17_1 : InnerProductSpace ℂ V] [inst17_2 : FiniteDimensional ℂ V] + (f g : V →ₗ[ℂ] V) + (h : ∀ x, ‖f x‖ = ‖g x‖) : + ∃ U : V →ₗᵢ[ℂ] V, U.toLinearMap.comp g = f := by + have hb : ∃ C : ℝ, ∀ x, ‖f x‖ ≤ C * ‖g x‖ := ⟨1, fun x => by simp [h x]⟩ + let L : LinearMap.range g →ₗᵢ[ℂ] V := + { toLinearMap := (f.compLeftInverse g).toLinearMap + norm_map' := by + rintro ⟨y, x, rfl⟩ + simpa only [ContinuousLinearMap.coe_coe, + LinearMap.compLeftInverse_apply_of_bdd f g hb x (g x) rfl, + ← Submodule.norm_coe] using h x } + refine ⟨L.extend, ?_⟩ + ext x + change L.extend (g x) = f x + rw [show L.extend (g x) = L ⟨g x, LinearMap.mem_range_self g x⟩ from + L.extend_apply ⟨g x, LinearMap.mem_range_self g x⟩] + exact LinearMap.compLeftInverse_apply_of_bdd f g hb x (g x) rfl + +universe v43_0 + +lemma norm_eq_of_gram_eq {ι : Type v43_0} [inst43_0 : Fintype ι] [inst43_1 : DecidableEq ι] + (A B : Matrix ι ι ℂ) (h : Aᴴ * A = Bᴴ * B) + (x : EuclideanSpace ℂ ι) : ‖A.toEuclideanLin x‖ = ‖B.toEuclideanLin x‖ := by + have hh := congrArg (fun M : Matrix ι ι ℂ => + inner ℂ x (M.toEuclideanLin x)) h + simp only [Matrix.toLpLin_mul_same, Matrix.toEuclideanLin_conjTranspose_eq_adjoint, + LinearMap.comp_apply, LinearMap.adjoint_inner_right] at hh + change inner ℂ (A.toEuclideanLin x) (A.toEuclideanLin x) = + inner ℂ (B.toEuclideanLin x) (B.toEuclideanLin x) at hh + have hh' := congrArg (RCLike.re : ℂ → ℝ) hh + simpa only [inner_self_eq_norm_sq, sq_eq_sq₀ (norm_nonneg _) (norm_nonneg _)] using hh' + +theorem exists_unitary_mul_of_gram_eq {ι : Type v43_0} [inst43_0 : Fintype ι] + [inst43_1 : DecidableEq ι] + (A B : Matrix ι ι ℂ) + (h : Aᴴ * A = Bᴴ * B) : + ∃ U : Matrix.unitaryGroup ι ℂ, A = (U : Matrix ι ι ℂ) * B := by + obtain ⟨U, hU⟩ := exists_isometry_comp_of_norm_eq A.toEuclideanLin B.toEuclideanLin + (norm_eq_of_gram_eq A B h) + let e := U.toLinearIsometryEquiv rfl + let V : Matrix ι ι ℂ := Matrix.toEuclideanLin.symm U.toLinearMap + have hV : V ∈ Matrix.unitaryGroup ι ℂ := by + exact e.toMatrix_mem_unitaryGroup (EuclideanSpace.basisFun ι ℂ) + (EuclideanSpace.basisFun ι ℂ) + refine ⟨⟨V, hV⟩, ?_⟩ + apply Matrix.toEuclideanLin.injective + simp only [Matrix.toLpLin_mul_same] + have hVlin : V.toEuclideanLin = U.toLinearMap := by simp [V] + change A.toEuclideanLin = V.toEuclideanLin.comp B.toEuclideanLin + rw [hVlin, hU] + +universe v84_0 + +def traceNorm {ι : Type v84_0} [inst84_0 : Fintype ι] [inst84_1 : DecidableEq ι] + (A : Matrix ι ι ℂ) : ℝ := (Matrix.trace (CFC.sqrt (Aᴴ * A))).re + +universe v155_0 v155_1 + +def matrixVector {ι : Type v155_0} {κ : Type v155_1} + (A : Matrix ι κ ℂ) : EuclideanSpace ℂ (ι × κ) := + WithLp.toLp 2 (fun x => A x.1 x.2) + +abbrev Mat (d : ℕ) := Matrix (Fin d) (Fin d) ℂ + +universe v217_0 + +def matrixUnit {ι : Type v217_0} [DecidableEq ι] (i j : ι) : Matrix ι ι ℂ := + fun a b => if a = i ∧ b = j then 1 else 0 + +def amplify {a b : ℕ} (L : Mat a →ₗ[ℂ] Mat b) (k : ℕ) + (U : Matrix (Fin k × Fin a) (Fin k × Fin a) ℂ) : + Matrix (Fin k × Fin b) (Fin k × Fin b) ℂ := + fun i j => L (fun x y => U (i.1, x) (j.1, y)) i.2 j.2 + +def CompletelyPositive {a b : ℕ} (L : Mat a →ₗ[ℂ] Mat b) : Prop := + ∀ k U, U.PosSemidef → (amplify L k U).PosSemidef + +def transposeLinear (a : ℕ) : Mat a →ₗ[ℂ] Mat a where + toFun := Matrix.transpose + map_add' := Matrix.transpose_add + map_smul' _ _ := rfl + +def PPTType {a b : ℕ} (L : Mat a →ₗ[ℂ] Mat b) : Prop := + CompletelyPositive L ∧ CompletelyPositive (L.comp (transposeLinear a)) + +def tensorMap {a b c d : ℕ} (L : Mat a →ₗ[ℂ] Mat b) (M : Mat c →ₗ[ℂ] Mat d) + (U : Matrix (Fin a × Fin c) (Fin a × Fin c) ℂ) : + Matrix (Fin b × Fin d) (Fin b × Fin d) ℂ := + fun i j => ∑ x, ∑ y, ∑ z, ∑ w, + U (x,z) (y,w) * L (matrixUnit x y) i.1 j.1 * M (matrixUnit z w) i.2 j.2 + +universe v243_0 + +def outer {ι : Type v243_0} (u v : ι → ℂ) : Matrix ι ι ℂ := + fun i j => u i * star (v j) + +universe v246_0 + +def Density {ι : Type v246_0} [Fintype ι] (R : Matrix ι ι ℂ) : Prop := + R.PosSemidef ∧ Matrix.trace R = 1 + +universe v264_0 + +def amplifyIndex {a b : ℕ} (L : Mat a →ₗ[ℂ] Mat b) {κ : Type v264_0} + (U : Matrix (κ × Fin a) (κ × Fin a) ℂ) : + Matrix (κ × Fin b) (κ × Fin b) ℂ := + fun i j => L (fun x y => U (i.1,x) (j.1,y)) i.2 j.2 + +universe v269_0 + +lemma cp_amplifyIndex {a b : ℕ} {L : Mat a →ₗ[ℂ] Mat b} (hL : CompletelyPositive L) + {κ : Type v269_0} [Fintype κ] (U : Matrix (κ × Fin a) (κ × Fin a) ℂ) + (hU : U.PosSemidef) : (amplifyIndex L U).PosSemidef := by + let e := Fintype.equivFin κ + have h := hL (Fintype.card κ) + (U.submatrix (fun i => (e.symm i.1, i.2)) (fun i => (e.symm i.1, i.2))) + (hU.submatrix _) + have h' := h.submatrix (fun i : κ × Fin b => (e i.1, i.2)) + convert h' using 1 + ext i j + simp [amplifyIndex, amplify, Matrix.submatrix] + +lemma matrix_sum_units {a : ℕ} (U : Mat a) : + U = ∑ x, ∑ y, U x y • matrixUnit x y := by + ext i j + simp [matrixUnit, Matrix.sum_apply, Matrix.smul_apply, ite_and] + +lemma linearMap_matrix_units {a b : ℕ} (L : Mat a →ₗ[ℂ] Mat b) (U : Mat a) : + L U = ∑ x, ∑ y, U x y • L (matrixUnit x y) := by + conv_lhs => rw [matrix_sum_units U] + simp + +lemma linearMap_matrix_units_apply {a b : ℕ} (L : Mat a →ₗ[ℂ] Mat b) (U : Mat a) + (i j : Fin b) : L U i j = ∑ x, ∑ y, U x y * L (matrixUnit x y) i j := by + have h := congrArg (fun A : Mat b => A i j) (linearMap_matrix_units L U) + simpa only [Matrix.sum_apply, Matrix.smul_apply, smul_eq_mul] using h + +lemma tensorMap_apply {a b c d : ℕ} (L : Mat a →ₗ[ℂ] Mat b) (M : Mat c →ₗ[ℂ] Mat d) + (U : Matrix (Fin a × Fin c) (Fin a × Fin c) ℂ) (i j : Fin b) (k l : Fin d) : + tensorMap L M U (i,k) (j,l) = + L (fun x y => M (fun z w => U (x,z) (y,w)) k l) i j := by + calc + _ = ∑ x, ∑ y, (∑ z, ∑ w, U (x,z) (y,w) * M (matrixUnit z w) k l) * + L (matrixUnit x y) i j := by + simp only [tensorMap, Finset.sum_mul] + apply Finset.sum_congr rfl + intro x _ + apply Finset.sum_congr rfl + intro y _ + apply Finset.sum_congr rfl + intro z _ + apply Finset.sum_congr rfl + intro w _ + ring + _ = ∑ x, ∑ y, M (fun z w => U (x,z) (y,w)) k l * L (matrixUnit x y) i j := by + apply Finset.sum_congr rfl + intro x _ + apply Finset.sum_congr rfl + intro y _ + exact congrArg (fun t => t * L (matrixUnit x y) i j) + (linearMap_matrix_units_apply M (fun z w => U (x,z) (y,w)) k l).symm + _ = _ := (linearMap_matrix_units_apply L _ i j).symm + +lemma tensorMap_positive {a b c d : ℕ} {L : Mat a →ₗ[ℂ] Mat b} + {M : Mat c →ₗ[ℂ] Mat d} (hL : CompletelyPositive L) (hM : CompletelyPositive M) + {U : Matrix (Fin a × Fin c) (Fin a × Fin c) ℂ} (hU : U.PosSemidef) : + (tensorMap L M U).PosSemidef := by + have h₁ := cp_amplifyIndex hM U hU + have h₂ := cp_amplifyIndex hL _ (h₁.submatrix Prod.swap) + have h₃ := h₂.submatrix Prod.swap + convert h₃ using 1 + ext i j + exact tensorMap_apply L M U i.1 j.1 i.2 j.2 + +universe v375_0 + +lemma outer_posSemidef {ι : Type v375_0} [Fintype ι] (u : ι → ℂ) : (outer u u).PosSemidef := by + exact Matrix.posSemidef_vecMulVec_self_star u + +universe v1019_0 + +lemma cp_of_kraus_representation {a b : ℕ} {ν : Type v1019_0} [Fintype ν] + (L : Mat a →ₗ[ℂ] Mat b) (K : ν → Matrix (Fin b) (Fin a) ℂ) + (hK : ∀ U, L U = ∑ s, K s * U * (K s)ᴴ) : CompletelyPositive L := by + intro r U hU + have he : amplify L r U = ∑ s, ((1 : Mat r) ⊗ₖ K s) * U * ((1 : Mat r) ⊗ₖ K s)ᴴ := by + ext ⟨i,x⟩ ⟨j,y⟩ + change L (fun v w => U (i,v) (j,w)) x y = _ + erw [hK] + simp only [Matrix.sum_apply] + apply Finset.sum_congr rfl + intro s _ + change (K s * U.submatrix (fun v => (i,v)) (fun w => (j,w)) * (K s)ᴴ) x y = _ + simp [Matrix.mul_apply, Matrix.conjTranspose_apply, Matrix.submatrix, + Fintype.sum_prod_type, Matrix.one_apply, apply_ite] + + rw [he] + apply Matrix.posSemidef_sum + intro s _ + exact hU.mul_mul_conjTranspose_same _ + +end + +open Matrix + +open scoped MatrixOrder ComplexOrder Kronecker + +section + +universe v1102_0 v1102_1 + +variable {σ : Type v1102_0} {ι : σ → Type v1102_1} [inst1102_0 : Fintype σ] [inst1102_1 : DecidableEq σ] + [inst1102_2 : ∀ s, Fintype (ι s)] [inst1102_3 : ∀ s, DecidableEq (ι s)] + +def tensorPi (A : ∀ s, Matrix (ι s) (ι s) ℂ) : Matrix (∀ s, ι s) (∀ s, ι s) ℂ := + fun i j => ∏ s, A s (i s) (j s) + +omit inst1102_3 in +lemma tensorPi_mul [∀ s, DecidableEq (ι s)] (A B : ∀ s, Matrix (ι s) (ι s) ℂ) : + tensorPi (fun s => A s * B s) = tensorPi A * tensorPi B := by + ext i j + simp only [tensorPi, Matrix.mul_apply] + rw [Fintype.prod_sum] + apply Finset.sum_congr rfl + intro k _ + exact Finset.prod_mul_distrib + +omit inst1102_1 inst1102_2 in +lemma tensorPi_one [DecidableEq σ] [∀ s, Fintype (ι s)] : tensorPi (fun s => (1 : Matrix (ι s) (ι s) ℂ)) = 1 := by + ext i j + by_cases h : i=j + · subst j + simp [tensorPi] + · obtain ⟨s,hs⟩ := Function.ne_iff.mp h + simp only [tensorPi, Matrix.one_apply, ite_eq_right h] + apply Finset.prod_eq_zero (Finset.mem_univ s) + simp [hs] + +omit inst1102_1 inst1102_2 inst1102_3 in +lemma tensorPi_star [DecidableEq σ] [∀ s, Fintype (ι s)] [∀ s, DecidableEq (ι s)] (A : ∀ s, Matrix (ι s) (ι s) ℂ) : + tensorPi (fun s => (A s)ᴴ) = (tensorPi A)ᴴ := by + ext i j + simp [tensorPi, Matrix.conjTranspose_apply] + +lemma tensorPi_projection (A : ∀ s, Matrix (ι s) (ι s) ℂ) + (hA : ∀ s, IsStarProjection (A s)) : IsStarProjection (tensorPi A) := by + constructor + · change tensorPi A * tensorPi A = tensorPi A + rw [← tensorPi_mul] + congr 1 + funext s + exact (hA s).isIdempotentElem + · change (tensorPi A)ᴴ = tensorPi A + rw [← tensorPi_star] + congr 1 + funext s + exact (hA s).isSelfAdjoint + +universe v1163_0 + +omit inst1102_2 inst1102_3 in +lemma tensorPi_sum [∀ s, Fintype (ι s)] [∀ s, DecidableEq (ι s)] {α : σ → Type v1163_0} [∀ s, Fintype (α s)] + (A : ∀ s, α s → Matrix (ι s) (ι s) ℂ) : + (∑ a : ∀ s, α s, tensorPi (fun s => A s (a s))) = + tensorPi (fun s => ∑ a, A s a) := by + ext i j + simp only [Matrix.sum_apply, tensorPi] + exact (Fintype.prod_sum (fun s a => A s a (i s) (j s))).symm + +end + +namespace Explicit + +section + +abbrev p : ℕ := 257 + +abbrev k : ℕ := 1028 + +@[irreducible] def b : ℕ := Nat.choose 1027 513 + +@[irreducible] def Q : ℕ := b^3 + +@[irreducible] def K : ℕ := k^3 + +def dimensionFunction (q : ℕ) : ℕ := 4^(Nat.choose q 8) + +lemma dimensionFunction_eq (q : ℕ) : dimensionFunction q = 4^(Nat.choose q 8) := rfl + +@[irreducible] def D : ℕ := dimensionFunction Q + +lemma D_eq : D = 4^(Nat.choose Q 8) := by + unfold D + exact dimensionFunction_eq Q + +def outputDimensionFunction (q d : ℕ) : ℕ := q*d + +lemma outputDimensionFunction_eq (q d : ℕ) : outputDimensionFunction q d = q*d := rfl + +@[irreducible] def m : ℕ := outputDimensionFunction Q D + +lemma m_eq : m = Q*D := by + unfold m + exact outputDimensionFunction_eq Q D + +def Base := {A : Finset (Fin k) // A.card = 514 ∧ (0 : Fin k) ∈ A} + +instance : Finite Base := by unfold Base; infer_instance + +instance : Fintype Base := Fintype.ofFinite _ + +instance : DecidableEq Base := Classical.decEq _ + +instance : LinearOrder Base := LinearOrder.lift' (fun A : Base => A.1.sort (· ≤ ·)) (by + intro A B h + apply Subtype.ext + simpa only [Finset.sort_toFinset] using congrArg List.toFinset h) + +def Question := Lex (Fin 3 → Base) + +instance : Finite Question := by unfold Question; infer_instance + +instance : Fintype Question := Fintype.ofFinite _ + +instance : DecidableEq Question := Classical.decEq _ + +instance : LinearOrder Question := inferInstanceAs (LinearOrder (Lex (Fin 3 → Base))) + +def baseVector (A : Base) (h : Fin k) : ℝ := + (if h ∈ A.1 then 1 else -1) / Real.sqrt k + +def vector (q : Question) (h : Fin 3 → Fin k) : ℝ := + ∏ l, baseVector (ofLex q l) (h l) + +def overlap (q r : Question) : ℝ := ∑ h, vector q h * vector r h + +def EightSet := {S : Finset Question // S.card = 8} + +instance : Finite EightSet := by unfold EightSet; infer_instance + +instance : Fintype EightSet := Fintype.ofFinite _ + +instance : DecidableEq EightSet := Classical.decEq _ + +instance : LinearOrder EightSet := LinearOrder.lift' + (fun S : EightSet => S.1.sort (· ≤ ·)) (by + intro S T h + apply Subtype.ext + simpa only [Finset.sort_toFinset] using congrArg List.toFinset h) + +def PairwiseOrthogonal (S : EightSet) : Prop := + ∀ q ∈ S.1, ∀ r ∈ S.1, q ≠ r → overlap q r = 0 + +abbrev Sign := Fin 2 + +def signValue (s : Sign) : ℂ := if s=0 then -1 else 1 + +abbrev Outcome := Lex (Sign × Sign) + +abbrev LocalBasis := Lex (Fin 2 × Fin 2) + +def pauliX : Matrix (Fin 2) (Fin 2) ℂ := !![0,1;1,0] + +def pauliY : Matrix (Fin 2) (Fin 2) ℂ := !![0,-Complex.I;Complex.I,0] + +def pauliZ : Matrix (Fin 2) (Fin 2) ℂ := !![1,0;0,-1] + +def tensor₂ (A B : Matrix (Fin 2) (Fin 2) ℂ) : Matrix LocalBasis LocalBasis ℂ := + (A ⊗ₖ B).submatrix ofLex ofLex + +def observable : Fin 3 → Fin 3 → Matrix LocalBasis LocalBasis ℂ + | 0,0 => tensor₂ pauliX 1 + | 0,1 => tensor₂ 1 pauliX + | 0,2 => tensor₂ pauliX pauliX + | 1,0 => tensor₂ 1 pauliZ + | 1,1 => tensor₂ pauliZ 1 + | 1,2 => tensor₂ pauliZ pauliZ + | 2,0 => tensor₂ pauliX pauliZ + | 2,1 => tensor₂ pauliZ pauliX + | 2,2 => tensor₂ pauliY pauliY + +def contextObservable (t : Fin 6) (j : Fin 3) : Matrix LocalBasis LocalBasis ℂ := + if h : t.val < 3 then observable ⟨t.val,h⟩ j + else observable j ⟨t.val-3, by omega⟩ + +def contextProjection (t : Fin 6) (a : Outcome) : Matrix LocalBasis LocalBasis ℂ := + (1/4 : ℂ) • ((1+signValue (ofLex a).1 • contextObservable t 0) * + (1+signValue (ofLex a).2 • contextObservable t 1)) + +def trivialProjection (a : Outcome) : Matrix LocalBasis LocalBasis ℂ := + if ofLex a = (1,1) then 1 else 0 + +def localProjection (S : EightSet) (q : Question) (a : Outcome) : + Matrix LocalBasis LocalBasis ℂ := + by + classical + exact + if PairwiseOrthogonal S then + if h : q ∈ S.1 then + let rank := (S.1.orderIsoOfFin S.2).symm ⟨q,h⟩ + if hr : rank.val < 6 then contextProjection ⟨rank.val,hr⟩ a + else trivialProjection a + else trivialProjection a + else trivialProjection a + +def Basis := Lex (EightSet → LocalBasis) + +instance : Finite Basis := by unfold Basis; infer_instance + +instance : Fintype Basis := Fintype.ofFinite _ + +instance : DecidableEq Basis := Classical.decEq _ + +instance : LinearOrder Basis := inferInstanceAs (LinearOrder (Lex (EightSet → LocalBasis))) + +def OutcomeString := Lex (EightSet → Outcome) + +instance : Finite OutcomeString := by unfold OutcomeString; infer_instance + +instance : Fintype OutcomeString := Fintype.ofFinite _ + +instance : DecidableEq OutcomeString := Classical.decEq _ + +instance : LinearOrder OutcomeString := inferInstanceAs (LinearOrder (Lex (EightSet → Outcome))) + +def Label := Lex (Question × OutcomeString) + +instance : Finite Label := by unfold Label; infer_instance + +instance : Fintype Label := Fintype.ofFinite _ + +instance : DecidableEq Label := Classical.decEq _ + +instance : LinearOrder Label := inferInstanceAs (LinearOrder (Lex (Question × OutcomeString))) + +def projection (i : Label) : Matrix Basis Basis ℂ := fun h l => + ∏ S, localProjection S (ofLex i).1 (ofLex (ofLex i).2 S) (ofLex h S) (ofLex l S) + +def block (i j : Label) : Matrix Basis Basis ℂ := + (overlap (ofLex i).1 (ofLex j).1 : ℂ) • (projection i * projection j) + +universe v1312_0 v1312_1 + +def traceBlockMap {α : Type v1312_0} {β : Type v1312_1} [Fintype α] [DecidableEq α] + (H : β → β → Matrix α α ℂ) : Matrix α α ℂ →ₗ[ℂ] Matrix β β ℂ where + toFun U i j := trace (H i j * U) + map_add' U V := by + ext i j + change trace (H i j * (U+V)) = trace (H i j * U)+trace (H i j * V) + rw [mul_add, Matrix.trace_add] + map_smul' c U := by + ext i j + change trace (H i j * (c • U)) = c * trace (H i j * U) + rw [Matrix.mul_smul, Matrix.trace_smul] + rfl + +def rawOutput : Matrix (Label × Label) (Label × Label) ℂ := fun i j => + ∑ h, ∑ l, block i.1 j.1 l h * block i.2 j.2 l h + +def rho : Matrix (Label × Label) (Label × Label) ℂ := + ((Q^2*D : ℕ) : ℂ)⁻¹ • rawOutput + +lemma tensor₂_apply (A B : Matrix (Fin 2) (Fin 2) ℂ) (i j : LocalBasis) : + tensor₂ A B i j = A (ofLex i).1 (ofLex j).1 * B (ofLex i).2 (ofLex j).2 := rfl + +lemma sum_localBasis (f : LocalBasis → ℂ) : (∑ i, f i) = + f (toLex (0,0)) + f (toLex (0,1)) + (f (toLex (1,0)) + f (toLex (1,1))) := by + change (∑ i : Fin 2 × Fin 2, f (toLex i)) = _ + rw [Fintype.sum_prod_type, Fin.sum_univ_two, Fin.sum_univ_two, Fin.sum_univ_two] + +lemma signValue_sq (a : Sign) : signValue a * signValue a = 1 := by + fin_cases a <;> norm_num [signValue] + +lemma signValue_conj (a : Sign) : star (signValue a) = signValue a := by + fin_cases a <;> norm_num [signValue] + +lemma localBasis_one_apply (i j : LocalBasis) : + (1 : Matrix LocalBasis LocalBasis ℂ) i j = if ofLex i = ofLex j then 1 else 0 := by + simp only [Matrix.one_apply, ofLex.injective.eq_iff] + +lemma context_hermitian (t : Fin 6) (j : Fin 3) : + (contextObservable t j).IsHermitian := by + fin_cases t <;> fin_cases j <;> change (tensor₂ _ _).IsHermitian + all_goals + rw [Matrix.IsHermitian] + ext i l + rw [Matrix.conjTranspose_apply, tensor₂_apply, tensor₂_apply] + generalize hi : ofLex i = ii + generalize hl : ofLex l = ll + rcases ii with ⟨i,h⟩ + rcases ll with ⟨l,k⟩ + fin_cases i <;> fin_cases h <;> fin_cases l <;> fin_cases k <;> + norm_num [pauliX, pauliY, pauliZ, Matrix.one_apply] + +lemma context_real (t : Fin 6) (j : Fin 3) (i l : LocalBasis) : + star (contextObservable t j i l) = contextObservable t j i l := by + fin_cases t <;> fin_cases j <;> change star (tensor₂ _ _ i l) = tensor₂ _ _ i l + all_goals + rw [tensor₂_apply] + generalize hi : ofLex i = ii + generalize hl : ofLex l = ll + rcases ii with ⟨i,h⟩ + rcases ll with ⟨l,k⟩ + fin_cases i <;> fin_cases h <;> fin_cases l <;> fin_cases k <;> + norm_num [pauliX, pauliY, pauliZ, Matrix.one_apply] + +lemma context_involution (t : Fin 6) (j : Fin 3) : + contextObservable t j * contextObservable t j = 1 := by + fin_cases t <;> fin_cases j <;> change tensor₂ _ _ * tensor₂ _ _ = (1 : Matrix LocalBasis LocalBasis ℂ) + all_goals + ext i l + rw [Matrix.mul_apply, sum_localBasis, localBasis_one_apply] + simp only [tensor₂_apply, ofLex_toLex] + generalize hi : ofLex i = ii + generalize hl : ofLex l = ll + rcases ii with ⟨i,h⟩ + rcases ll with ⟨l,k⟩ + fin_cases i <;> fin_cases h <;> fin_cases l <;> fin_cases k <;> + norm_num [pauliX, pauliY, pauliZ, Matrix.one_apply] + +lemma context_commute (t : Fin 6) : + Commute (contextObservable t 0) (contextObservable t 1) := by + change contextObservable t 0 * contextObservable t 1 = contextObservable t 1 * contextObservable t 0 + fin_cases t <;> change tensor₂ _ _ * tensor₂ _ _ = tensor₂ _ _ * tensor₂ _ _ + all_goals + ext i l + simp only [Matrix.mul_apply, sum_localBasis, tensor₂_apply, ofLex_toLex] + generalize hi : ofLex i = ii + generalize hl : ofLex l = ll + rcases ii with ⟨i,h⟩ + rcases ll with ⟨l,k⟩ + fin_cases i <;> fin_cases h <;> fin_cases l <;> fin_cases k <;> + norm_num [pauliX, pauliY, pauliZ, Matrix.one_apply] + +def contextParity (t : Fin 6) : ℂ := if t=5 then -1 else 1 + +lemma context_third (t : Fin 6) : contextObservable t 2 = + contextParity t • (contextObservable t 0 * contextObservable t 1) := by + fin_cases t <;> change tensor₂ _ _ = _ • (tensor₂ _ _ * tensor₂ _ _) + all_goals + ext i l + simp only [Matrix.smul_apply, smul_eq_mul, Matrix.mul_apply, sum_localBasis, tensor₂_apply, ofLex_toLex] + generalize hi : ofLex i = ii + generalize hl : ofLex l = ll + rcases ii with ⟨i,h⟩ + rcases ll with ⟨l,k⟩ + fin_cases i <;> fin_cases h <;> fin_cases l <;> fin_cases k <;> + norm_num [contextParity, pauliX, pauliY, pauliZ, Matrix.one_apply, Fin.ext_iff] + +def spectralSign (O : Matrix LocalBasis LocalBasis ℂ) (a : Sign) := + (1/2 : ℂ) • (1 + signValue a • O) + +lemma sign_eigen_aux (O : Matrix LocalBasis LocalBasis ℂ) (hO : O*O=1) (a : Sign) : + O*(1+signValue a • O) = signValue a • (1+signValue a • O) := by + simp only [mul_add, mul_one, mul_smul_comm, hO, smul_add, smul_smul, + signValue_sq, one_smul] + exact add_comm _ _ + +lemma spectralSign_projection (O : Matrix LocalBasis LocalBasis ℂ) + (hO : O.IsHermitian) (hO2 : O*O=1) (a : Sign) : + IsStarProjection (spectralSign O a) := by + refine ⟨?_, ?_⟩ + · change spectralSign O a * spectralSign O a = spectralSign O a + dsimp [spectralSign] + rw [smul_mul_smul_comm, add_mul, one_mul, smul_mul_assoc, sign_eigen_aux O hO2] + rw [smul_smul, signValue_sq, one_smul] + module + · change star (spectralSign O a) = spectralSign O a + dsimp [spectralSign] + simp only [star_smul, star_add, star_one, signValue_conj, hO.star_eq] + norm_num + +lemma spectralSign_commute (O T : Matrix LocalBasis LocalBasis ℂ) + (h : Commute O T) (a b : Sign) : Commute (spectralSign O a) (spectralSign T b) := by + unfold spectralSign + exact ((Commute.one_left _).add_left ((Commute.one_right _).add_right + (h.smul_left _ |>.smul_right _))).smul_left _ |>.smul_right _ + +lemma contextProjection_factor (t : Fin 6) (a : Outcome) : contextProjection t a = + spectralSign (contextObservable t 0) (ofLex a).1 * + spectralSign (contextObservable t 1) (ofLex a).2 := by + simp only [contextProjection, spectralSign, smul_mul_smul_comm] + norm_num + +lemma contextProjection_projection (t : Fin 6) (a : Outcome) : + IsStarProjection (contextProjection t a) := by + rw [contextProjection_factor] + exact (spectralSign_projection _ (context_hermitian t 0) (context_involution t 0) _).mul + (spectralSign_projection _ (context_hermitian t 1) (context_involution t 1) _) + (spectralSign_commute _ _ (context_commute t) _ _) + +lemma contextProjection_real (t : Fin 6) (a : Outcome) (i j : LocalBasis) : + star (contextProjection t a i j) = contextProjection t a i j := by + simp only [contextProjection, Matrix.smul_apply, smul_eq_mul, Matrix.mul_apply, + star_mul, star_sum, Matrix.add_apply, Matrix.smul_apply, smul_eq_mul, + star_add, context_real, signValue_conj] + simp [Matrix.one_apply, mul_comm] + +lemma contextParity_conj (t : Fin 6) : star (contextParity t) = contextParity t := by + unfold contextParity + split <;> norm_num + +def contextEigenvalue (t : Fin 6) (a : Outcome) : Fin 3 → ℂ := + ![signValue (ofLex a).1, signValue (ofLex a).2, + contextParity t * signValue (ofLex a).1 * signValue (ofLex a).2] + +lemma context_eigen_first (t : Fin 6) (a : Outcome) : + contextObservable t 0 * contextProjection t a = + signValue (ofLex a).1 • contextProjection t a := by + unfold contextProjection + rw [mul_smul_comm, ← mul_assoc, sign_eigen_aux _ (context_involution t 0), + smul_mul_assoc, smul_comm] + +lemma context_eigen_second (t : Fin 6) (a : Outcome) : + contextObservable t 1 * contextProjection t a = + signValue (ofLex a).2 • contextProjection t a := by + unfold contextProjection + rw [mul_smul_comm] + have hc : Commute (contextObservable t 1) + (1+signValue (ofLex a).1 • contextObservable t 0) := + (Commute.one_right _).add_right ((context_commute t).symm.smul_right _) + rw [← mul_assoc, hc, mul_assoc, sign_eigen_aux _ (context_involution t 1), + mul_smul_comm, smul_comm] + +lemma context_eigen (t : Fin 6) (a : Outcome) (j : Fin 3) : + contextObservable t j * contextProjection t a = + contextEigenvalue t a j • contextProjection t a := by + fin_cases j + · exact context_eigen_first t a + · exact context_eigen_second t a + · change contextObservable t 2 * contextProjection t a = + (contextParity t * signValue (ofLex a).1 * signValue (ofLex a).2) • _ + rw [context_third, smul_mul_assoc, mul_assoc, context_eigen_second, + mul_smul_comm, context_eigen_first] + simp only [smul_smul] + congr 1 + ring + +lemma contextEigenvalue_conj (t : Fin 6) (a : Outcome) (j : Fin 3) : + star (contextEigenvalue t a j) = contextEigenvalue t a j := by + (fin_cases j <;> simp [contextEigenvalue, star_mul, signValue_conj, contextParity_conj]); ring + +lemma context_eigen_right (t : Fin 6) (a : Outcome) (j : Fin 3) : + contextProjection t a * contextObservable t j = + contextEigenvalue t a j • contextProjection t a := by + have h := congrArg star (context_eigen t a j) + simpa only [star_mul, (contextProjection_projection t a).isSelfAdjoint.star_eq, + (context_hermitian t j).star_eq, star_smul, contextEigenvalue_conj] using h + +lemma spectralSign_sum (O : Matrix LocalBasis LocalBasis ℂ) : + ∑ a, spectralSign O a = 1 := by + rw [Fin.sum_univ_two] + norm_num [spectralSign, signValue] + module + +lemma contextProjection_sum (t : Fin 6) : ∑ a, contextProjection t a = 1 := by + simp_rw [contextProjection_factor] + change (∑ a : Sign × Sign, spectralSign (contextObservable t 0) a.1 * + spectralSign (contextObservable t 1) a.2) = _ + rw [Fintype.sum_prod_type] + simp only [← Finset.mul_sum, ← Finset.sum_mul, spectralSign_sum, one_mul] + +universe v1552_0 + +lemma eigenvalues_agree {ι : Type v1552_0} [Fintype ι] (E F O : Matrix ι ι ℂ) + (a b : ℂ) (hE : E*O=a • E) (hF : O*F=b • F) (hEF : E*F≠0) : a=b := by + apply smul_left_injective ℂ hEF + calc a • (E*F) = (E*O)*F := by rw [hE, smul_mul_assoc] + _ = E*(O*F) := mul_assoc _ _ _ + _ = b • (E*F) := by rw [hF, mul_smul_comm] + +lemma signValue_injective : Function.Injective signValue := by + intro a b hab + fin_cases a <;> fin_cases b <;> first | rfl | norm_num [signValue] at hab + +lemma contextProjection_orthogonal (t : Fin 6) (a b : Outcome) (hab : a≠b) : + contextProjection t a * contextProjection t b = 0 := by + by_contra h + have he (j : Fin 3) := eigenvalues_agree _ _ _ _ _ + (context_eigen_right t a j) (context_eigen t b j) h + apply hab + apply ofLex.injective + apply Prod.ext + · exact signValue_injective (he 0) + · exact signValue_injective (he 1) + +lemma trivialProjection_projection (a : Outcome) : IsStarProjection (trivialProjection a) := by + unfold trivialProjection + split <;> simp only [IsStarProjection.one, IsStarProjection.zero] + +lemma trivialProjection_sum : ∑ a, trivialProjection a = 1 := by + classical + have h : ∀ a, trivialProjection a = if a = toLex (1,1) then 1 else 0 := by + intro a + simp [trivialProjection, ← ofLex.injective.eq_iff] + simp only [h] + simp + +lemma trivialProjection_orthogonal (a b : Outcome) (hab : a≠b) : + trivialProjection a * trivialProjection b = 0 := by + by_cases ha : ofLex a = (1,1) + · have hb : ofLex b ≠ (1,1) := fun hb => hab (ofLex.injective (ha.trans hb.symm)) + simp [trivialProjection, hb] + · simp [trivialProjection, ha] + +lemma localProjection_type (S : EightSet) (q : Question) : + (localProjection S q = trivialProjection) ∨ + (∃ t : Fin 6, localProjection S q = contextProjection t) := by + classical + unfold localProjection + split + · split + · dsimp only + split + · exact Or.inr ⟨_,rfl⟩ + · exact Or.inl rfl + · exact Or.inl rfl + · exact Or.inl rfl + +lemma localProjection_projection (S : EightSet) (q : Question) (a : Outcome) : + IsStarProjection (localProjection S q a) := by + rcases localProjection_type S q with h | ⟨t,h⟩ + · rw [h]; exact trivialProjection_projection a + · rw [h]; exact contextProjection_projection t a + +lemma localProjection_real (S : EightSet) (q : Question) (a : Outcome) (i j : LocalBasis) : + star (localProjection S q a i j) = localProjection S q a i j := by + rcases localProjection_type S q with h | ⟨t,h⟩ + · rw [h] + unfold trivialProjection + split <;> simp [Matrix.one_apply] + · rw [h]; exact contextProjection_real t a i j + +lemma localProjection_sum (S : EightSet) (q : Question) : + ∑ a, localProjection S q a = 1 := by + rcases localProjection_type S q with h | ⟨t,h⟩ + · rw [h]; exact trivialProjection_sum + · rw [h]; exact contextProjection_sum t + +lemma localProjection_orthogonal (S : EightSet) (q : Question) (a b : Outcome) (hab : a≠b) : + localProjection S q a * localProjection S q b = 0 := by + rcases localProjection_type S q with h | ⟨t,h⟩ + · rw [h]; exact trivialProjection_orthogonal a b hab + · rw [h]; exact contextProjection_orthogonal t a b hab + +lemma projection_tensor (i : Label) : projection i = + (tensorPi (fun S => localProjection S (ofLex i).1 (ofLex (ofLex i).2 S))).submatrix + (show Basis ≃ (EightSet → LocalBasis) from Equiv.refl _) (show Basis ≃ (EightSet → LocalBasis) from Equiv.refl _) := rfl + +lemma projection_projection (i : Label) : IsStarProjection (projection i) := by + let e : Basis ≃ (EightSet → LocalBasis) := Equiv.refl _ + let A := tensorPi (fun S => localProjection S (ofLex i).1 (ofLex (ofLex i).2 S)) + have hA : IsStarProjection A := tensorPi_projection _ (fun S => localProjection_projection _ _ _) + rw [projection_tensor] + change IsStarProjection (A.submatrix e e) + constructor + · change A.submatrix e e * A.submatrix e e = A.submatrix e e + rw [Matrix.submatrix_mul_equiv, hA.isIdempotentElem] + · change (A.submatrix e e)ᴴ = A.submatrix e e + rw [Matrix.conjTranspose_submatrix, show Aᴴ=A from hA.isSelfAdjoint] + +lemma projection_real (i : Label) (h l : Basis) : star (projection i h l) = projection i h l := by + change (starRingEnd ℂ) (∏ S, localProjection S (ofLex i).1 (ofLex (ofLex i).2 S) (ofLex h S) (ofLex l S)) = _ + rw [map_prod] + simp only [starRingEnd_apply, localProjection_real] + rfl + +lemma projection_sum (q : Question) : ∑ a : OutcomeString, projection (toLex (q,a)) = 1 := by + ext h l + simp only [Matrix.sum_apply, projection, ofLex_toLex] + have he := congr_fun (congr_fun (tensorPi_sum (fun S a => localProjection S q a)) (ofLex h)) (ofLex l) + have hr : tensorPi (fun S => ∑ a, localProjection S q a) = 1 := by + simp only [localProjection_sum, tensorPi_one] + rw [hr] at he + calc + _ = ∑ a : EightSet → Outcome, ∏ S, localProjection S q (a S) (ofLex h S) (ofLex l S) := + (Equiv.sum_comp (show (EightSet → Outcome) ≃ OutcomeString from Equiv.refl _) + (fun a : OutcomeString => ∏ S, localProjection S q (ofLex a S) (ofLex h S) (ofLex l S))).symm + _ = _ := by + simpa only [tensorPi, Matrix.sum_apply, Matrix.one_apply, + show (ofLex h = ofLex l) ↔ h=l from Iff.rfl] using he + +lemma projection_mul_apply (i j : Label) (h l : Basis) : + (projection i * projection j) h l = ∏ S, + (localProjection S (ofLex i).1 (ofLex (ofLex i).2 S) * + localProjection S (ofLex j).1 (ofLex (ofLex j).2 S)) (ofLex h S) (ofLex l S) := by + let e : Basis ≃ (EightSet → LocalBasis) := Equiv.refl _ + let A := tensorPi (fun S => localProjection S (ofLex i).1 (ofLex (ofLex i).2 S)) + let B := tensorPi (fun S => localProjection S (ofLex j).1 (ofLex (ofLex j).2 S)) + change (A.submatrix e e * B.submatrix e e) h l = _ + rw [Matrix.submatrix_mul_equiv] + exact congr_fun (congr_fun (tensorPi_mul _ _).symm (ofLex h)) (ofLex l) + +lemma trivialProjection_commute (a : Outcome) (A : Matrix LocalBasis LocalBasis ℂ) : + Commute (trivialProjection a) A := by + unfold trivialProjection + split <;> simp + +lemma localProjection_self_commute (S : EightSet) (q : Question) (a b : Outcome) : + Commute (localProjection S q a) (localProjection S q b) := by + by_cases h : a=b + · subst b; exact Commute.refl _ + · change _ * _ = _ * _ + rw [localProjection_orthogonal _ _ _ _ h, + localProjection_orthogonal _ _ _ _ (Ne.symm h)] + +lemma localProjection_trivial_of_not_orthogonal (S : EightSet) (q : Question) + (h : ¬PairwiseOrthogonal S) : localProjection S q = trivialProjection := by + funext a + simp only [localProjection, ite_eq_right h] + +lemma localProjection_trivial_of_not_mem (S : EightSet) (q : Question) + (h : q∉S.1) : localProjection S q = trivialProjection := by + funext a + simp only [localProjection, dite_eq_right h, ite_self] + +lemma localProjection_commute (S : EightSet) (q r : Question) (a b : Outcome) + (hqr : overlap q r ≠ 0) : Commute (localProjection S q a) (localProjection S r b) := by + by_cases he : q=r + · subst r; exact localProjection_self_commute S q a b + by_cases hS : PairwiseOrthogonal S + · by_cases hq : q∈S.1 + · have hr : r∉S.1 := fun hr => hqr (hS q hq r hr he) + rw [localProjection_trivial_of_not_mem S r hr] + exact (trivialProjection_commute b _).symm + · rw [localProjection_trivial_of_not_mem S q hq] + exact trivialProjection_commute a _ + · rw [localProjection_trivial_of_not_orthogonal S q hS] + exact trivialProjection_commute a _ + +lemma projection_commute (i j : Label) (hij : overlap (ofLex i).1 (ofLex j).1 ≠ 0) : + Commute (projection i) (projection j) := by + change _ * _ = _ * _ + ext h l + rw [projection_mul_apply, projection_mul_apply] + apply Finset.prod_congr rfl + intro S _ + rw [(localProjection_commute S _ _ _ _ hij).eq] + +universe v1965_0 + +lemma card_subsets_containing {α : Type v1965_0} [Fintype α] [DecidableEq α] + (a : α) (r : ℕ) (hr : 1 ≤ r) + [Fintype {A : Finset α // A.card=r ∧ a ∈ A}] : + Fintype.card {A : Finset α // A.card=r ∧ a ∈ A} = + Nat.choose (Fintype.card α - 1) (r-1) := by + rw [Fintype.card_of_subtype + (((Finset.univ : Finset α).powersetCard r).filter ({a} ⊆ ·)) (by + intro A + simp only [Finset.mem_filter, Finset.mem_powersetCard, Finset.subset_univ, + true_and, Finset.singleton_subset_iff])] + rw [Finset.card_filter_powersetCard_subset _ _ _ (Finset.subset_univ _) + (by simpa only [Finset.card_singleton] using hr)] + simp only [Finset.card_univ, Finset.card_singleton] + +lemma card_base : Fintype.card Base = b := by + let : Fintype {A : Finset (Fin k) // A.card=514 ∧ (0 : Fin k) ∈ A} := + inferInstanceAs (Fintype Base) + have h := card_subsets_containing (0 : Fin k) 514 (by decide) + change Fintype.card Base = Nat.choose (Fintype.card (Fin k)-1) (514-1) at h + rw [Fintype.card_fin] at h + delta b + exact h.trans (congrArg₂ Nat.choose (show k-1=1027 from rfl) (show 514-1=513 from rfl)) + +lemma card_question : Fintype.card Question = Q := by + rw [Fintype.card_congr (show Question ≃ (Fin 3 → Base) from Equiv.refl _)] + rw [Fintype.card_fun, Fintype.card_fin, card_base] + delta Q + rfl + +universe v1995_0 + +lemma signed_overlap {α : Type v1995_0} [Fintype α] [DecidableEq α] (A B : Finset α) : + (∑ h, (if h ∈ A then (1:ℝ) else -1) * (if h ∈ B then 1 else -1)) = + Fintype.card α - 2*(A.card:ℝ) - 2*(B.card:ℝ) + 4*(A ∩ B).card := by + have hp (h : α) : + (if h ∈ A then (1:ℝ) else -1) * (if h ∈ B then 1 else -1) = + 1 - 2*(if h ∈ A then 1 else 0) - 2*(if h ∈ B then 1 else 0) + + 4*(if h ∈ A ∩ B then 1 else 0) := by + by_cases ha : h ∈ A <;> by_cases hb : h ∈ B <;> simp [ha,hb] <;> norm_num + simp only [hp, Finset.sum_add_distrib, Finset.sum_sub_distrib, ← Finset.mul_sum] + simp + congr 1 + ext x + simp + +lemma base_inner (A B : Base) : + (∑ h, baseVector A h * baseVector B h) = (A.1 ∩ B.1).card / (p:ℝ) - 1 := by + simp only [baseVector, div_mul_div_comm, ← Finset.sum_div] + rw [Real.mul_self_sqrt (by norm_num : (0:ℝ) ≤ k), signed_overlap] + rw [A.2.1,B.2.1] + simp only [Fintype.card_fin, k, p] + push_cast + ring + +lemma base_unit (A : Base) : ∑ h, baseVector A h * baseVector A h = 1 := by + rw [base_inner, Finset.inter_self, A.2.1] + norm_num [p] + +lemma vector_unit (q : Question) : overlap q q = 1 := by + change Lex (Fin 3 → Base) at q + unfold overlap vector + simp only [← Finset.prod_mul_distrib] + rw [← Fintype.prod_sum (fun l h => baseVector (ofLex q l) h * baseVector (ofLex q l) h)] + simp only [base_unit, Finset.prod_const_one] + +@[irreducible] def a₀ : ℕ := ∑ j ∈ Finset.range p, Nat.choose k j + +open Finset + +lemma choose_mono_small {n i j : ℕ} (hij : i ≤ j) (hj : j ≤ n/2) : + Nat.choose n i ≤ Nat.choose n j := by + induction hij with + | refl => rfl + | @step j hij ih => + exact (ih (by omega)).trans (Nat.choose_le_succ_of_lt_half_left (by omega)) + +lemma a₀_upper : a₀ ≤ 257 * Nat.choose 1028 257 := by + delta a₀ + calc + (∑ j ∈ range 257, Nat.choose 1028 j) ≤ ∑ _j ∈ range 257, Nat.choose 1028 257 := by + apply sum_le_sum + intro j hj + exact choose_mono_small (Nat.le_of_lt (mem_range.mp hj)) (by decide) + _ = _ := by rw [sum_const, card_range, nsmul_eq_mul, Nat.cast_id] + +lemma binomial_term_le (n j x y : ℕ) (hj : j ≤ n) : + x^j*y^(n-j)*Nat.choose n j ≤ (x+y)^n := by + rw [add_pow] + exact single_le_sum (f := fun m => x^m*y^(n-m)*Nat.choose n m) + (fun _ _ => Nat.zero_le _) (show j ∈ range (n+1) from mem_range.mpr (by omega)) + +lemma choose_upper : Nat.choose 1028 257 < 12^257 := by + have ht := binomial_term_le 1028 257 1 3 (by decide) + simp only [one_pow, one_mul, show 1028-257=771 from rfl, show 1+3=4 from rfl] at ht + have hn : (4:ℕ)^1028 < 3^771*12^257 := by + have hh := pow_lt_pow_left₀ (by norm_num : (4:ℕ)^4 < 3^3*12) (by positivity) (by decide : 257 ≠ 0) + have hl : ((4:ℕ)^4)^257 = 4^1028 := by rw [← pow_mul] + have hr : ((3:ℕ)^3*12)^257 = 3^771*12^257 := + by rw [mul_pow, ← pow_mul] + exact (congrArg₂ (fun x y : ℕ => x Nat.choose 1027 513 + x) + (congrArg (Nat.choose 1027) (show Nat.succ 513=514 from rfl)))) + _ = 2 * Nat.choose 1027 513 := by rw [hs]; omega + +lemma b_lower : 2^1028 ≤ 2058*b := by + have h : (∑ j ∈ range (1028+1), Nat.choose 1028 j) ≤ + ∑ _j ∈ range (1028+1), Nat.choose 1028 514 := + sum_le_sum (fun j _ => Nat.choose_le_middle j 1028) + rw [Nat.sum_range_choose, sum_const, card_range, nsmul_eq_mul, double_b] at h + simpa only [Nat.cast_id, show 1028+1=1029 from rfl, ← Nat.mul_assoc, show 1029*2=2058 from rfl] using h + +lemma strict_parameter_bound : 3*a₀*K < b := by + have ha := a₀_upper + have hc := choose_upper + have hb := b_lower + have ha' : a₀ < 257*12^257 := lt_of_le_of_lt ha (Nat.mul_lt_mul_of_pos_left hc (by decide)) + have hn : (2058:ℕ)*(3*(257*12^257)*1028^3) < 2^1028 := by + calc + (2058:ℕ)*(3*(257*12^257)*1028^3) < 16^257 := by + rw [show 257=256+1 from rfl, pow_add, pow_add] + norm_num + _ = 2^1028 := by + calc + (16 : ℕ)^257 = ((2 : ℕ)^4)^257 := congrArg (fun value : ℕ => value^257) (show 16 = 2^4 from rfl) + _ = 2^1028 := by rw [← pow_mul] + delta K + change 3*a₀*1028^3 < b + apply Nat.lt_of_mul_lt_mul_left (a := 2058) + exact lt_of_le_of_lt (Nat.mul_le_mul_left 2058 + (Nat.mul_le_mul_right (1028^3) (Nat.mul_le_mul_left 3 (Nat.le_of_lt ha')))) (hn.trans_le hb) + +lemma b_pos : 0 < b := lt_of_le_of_lt (Nat.zero_le _) strict_parameter_bound + +end + +universe v2431_0 + +lemma card_subsets {α : Type v2431_0} [Fintype α] [DecidableEq α] (r : ℕ) + [Fintype {S : Finset α // S.card=r}] : + Fintype.card {S : Finset α // S.card=r} = Nat.choose (Fintype.card α) r := by + rw [Fintype.card_of_subtype ((Finset.univ : Finset α).powersetCard r) (by + intro S + simp only [Finset.mem_powersetCard, Finset.subset_univ, true_and])] + rw [Finset.card_powersetCard, Finset.card_univ] + +lemma card_eightSet : Fintype.card EightSet = Nat.choose Q 8 := by + let : Fintype {S : Finset Question // S.card=8} := inferInstanceAs (Fintype EightSet) + exact (card_subsets (α := Question) 8).trans (congrArg (fun n => Nat.choose n 8) card_question) + +lemma card_basis_aux : Fintype.card Basis = Fintype.card LocalBasis ^ Fintype.card EightSet := by + rw [← Nat.card_eq_fintype_card, ← Nat.card_eq_fintype_card, ← Nat.card_eq_fintype_card] + exact (Nat.card_congr (show Basis ≃ (EightSet → LocalBasis) from Equiv.refl _)).trans Nat.card_fun + +lemma card_localBasis : Fintype.card LocalBasis = 4 := by + rw [Fintype.card_congr (show LocalBasis ≃ (Fin 2 × Fin 2) from Equiv.refl _), + Fintype.card_prod, Fintype.card_fin] + +lemma card_basis : Fintype.card Basis = D := by + exact (card_basis_aux.trans (congrArg₂ (fun a b : ℕ => a^b) card_localBasis card_eightSet)).trans D_eq.symm + +lemma card_outcomeString : Fintype.card OutcomeString = D := + (Fintype.card_congr (show OutcomeString ≃ Basis from Equiv.refl _)).trans card_basis + +lemma card_label : Fintype.card Label = m := by + rw [Fintype.card_congr (show Label ≃ (Question × OutcomeString) from Equiv.refl _)] + rw [Fintype.card_prod, card_question, card_outcomeString] + exact m_eq.symm + +def basisOrder : Fin D ≃o Basis := Fintype.orderIsoFinOfCardEq Basis card_basis + +def labelOrder : Fin m ≃o Label := Fintype.orderIsoFinOfCardEq Label (by + have cardContaining {α : Type} [Fintype α] [DecidableEq α] + (a : α) (r : ℕ) (hr : 1 ≤ r) + [Fintype {A : Finset α // A.card = r ∧ a ∈ A}] : + Fintype.card {A : Finset α // A.card = r ∧ a ∈ A} = + Nat.choose (Fintype.card α - 1) (r - 1) := by + as_aux_lemma => + rw [Fintype.card_of_subtype + (((Finset.univ : Finset α).powersetCard r).filter ({a} ⊆ ·)) (by + intro A + simp only [Finset.mem_filter, Finset.mem_powersetCard, Finset.subset_univ, + true_and, Finset.singleton_subset_iff])] + rw [Finset.card_filter_powersetCard_subset _ _ _ (Finset.subset_univ _) + (by simpa only [Finset.card_singleton] using hr)] + simp only [Finset.card_univ, Finset.card_singleton] + have hbase : Fintype.card Base = b := by + as_aux_lemma => + let : Fintype {A : Finset (Fin k) // A.card = 514 ∧ (0 : Fin k) ∈ A} := + inferInstanceAs (Fintype Base) + have h := cardContaining (0 : Fin k) 514 (by decide) + change Fintype.card Base = Nat.choose (Fintype.card (Fin k) - 1) (514 - 1) at h + rw [Fintype.card_fin] at h + delta b + exact h.trans (congrArg₂ Nat.choose (show k - 1 = 1027 from rfl) + (show 514 - 1 = 513 from rfl)) + have hquestion : Fintype.card Question = Q := by + calc + Fintype.card Question = Fintype.card (Fin 3 → Base) := + Fintype.card_congr (show Question ≃ (Fin 3 → Base) from Equiv.refl _) + _ = Fintype.card Base ^ Fintype.card (Fin 3) := Fintype.card_fun + _ = b ^ 3 := congrArg₂ (fun x y : ℕ => x ^ y) hbase (Fintype.card_fin 3) + _ = Q := Q.eq_def.symm + + have height : Fintype.card EightSet = Nat.choose Q 8 := by + as_aux_lemma => + let : Fintype {S : Finset Question // S.card = 8} := inferInstanceAs (Fintype EightSet) + change Fintype.card {S : Finset Question // S.card = 8} = _ + rw [Fintype.card_of_subtype ((Finset.univ : Finset Question).powersetCard 8) (by + intro S + simp only [Finset.mem_powersetCard, Finset.subset_univ, true_and])] + rw [Finset.card_powersetCard, Finset.card_univ, hquestion] + have hlocal : Fintype.card Outcome = 4 := by + as_aux_lemma => + rw [Fintype.card_congr (show Outcome ≃ (Fin 2 × Fin 2) from Equiv.refl _), + Fintype.card_prod, Fintype.card_fin] + have houtcome : Fintype.card OutcomeString = D := by + as_aux_lemma => + calc + Fintype.card OutcomeString = Fintype.card Outcome ^ Fintype.card EightSet := by + rw [Fintype.card_congr (show OutcomeString ≃ (EightSet → Outcome) from Equiv.refl _), + Fintype.card_fun] + _ = 4 ^ Nat.choose Q 8 := congrArg₂ (fun a b : ℕ => a ^ b) hlocal height + _ = D := by + have hd (q : ℕ) : dimensionFunction q = 4 ^ Nat.choose q 8 := rfl + symm + unfold D + exact hd Q + rw [Fintype.card_congr (show Label ≃ (Question × OutcomeString) from Equiv.refl _)] + rw [Fintype.card_prod, hquestion, houtcome] + have hm (q d : ℕ) : outputDimensionFunction q d = q * d := rfl + symm + unfold m + exact hm Q D) + +def rhoFin : Matrix (Fin m × Fin m) (Fin m × Fin m) ℂ := + rho.submatrix (Prod.map labelOrder labelOrder) (Prod.map labelOrder labelOrder) + +lemma overlap_symm (q r : Question) : overlap q r = overlap r q := by + unfold overlap + exact Finset.sum_congr rfl (fun h _ => mul_comm _ _) + +lemma projection_transpose (i : Label) : (projection i)ᵀ = projection i := by + ext h l + have hh := congrArg (fun A : Matrix Basis Basis ℂ => A h l) + (show (projection i)ᴴ=projection i from (projection_projection i).isSelfAdjoint) + exact (projection_real i l h).symm.trans hh + +lemma block_swap (i j : Label) : block i j = block j i := by + by_cases h : overlap (ofLex i).1 (ofLex j).1 = 0 + · simp only [block, ← overlap_symm (ofLex i).1 (ofLex j).1, h, + Complex.ofReal_zero, zero_smul] + · unfold block + rw [overlap_symm, (projection_commute i j h).eq] + +lemma block_transpose (i j : Label) : (block i j)ᵀ = block i j := by + by_cases h : overlap (ofLex i).1 (ofLex j).1 = 0 + · simp only [block, h, Complex.ofReal_zero, zero_smul, Matrix.transpose_zero] + · unfold block + rw [Matrix.transpose_smul, Matrix.transpose_mul, projection_transpose, projection_transpose, + (projection_commute i j h).eq] + +lemma block_diag (i : Label) : block i i = projection i := by + unfold block + rw [vector_unit, Complex.ofReal_one, one_smul, (projection_projection i).isIdempotentElem] + +lemma rawOutput_trace (i j : Label × Label) : + rawOutput i j = trace (block i.1 j.1 * block i.2 j.2) := by + rw [← block_transpose i.1 j.1] + simp only [rawOutput, trace, Matrix.diag_apply, Matrix.mul_apply, Matrix.transpose_apply] + +lemma rawOutput_crossed_diagonal (i j : Label) : + rawOutput (i,j) (i,j) = trace (projection i * projection j) := by + rw [rawOutput_trace, block_diag, block_diag] + +def makeLabel (q : Question) (a : OutcomeString) : Label := toLex (q,a) + +lemma projection_sum_makeLabel (q : Question) : ∑ a, projection (makeLabel q a) = 1 := projection_sum q + +universe v2545_0 + +lemma sum_label {M : Type v2545_0} [AddCommMonoid M] (f : Label → M) : + ∑ i, f i = ∑ q : Question, ∑ a : OutcomeString, f (makeLabel q a) := by + exact (Equiv.sum_comp (show (Question × OutcomeString) ≃ Label from Equiv.refl _) f).symm.trans + (Fintype.sum_prod_type _) + +lemma sum_projection_pair_trace (q r : Question) : + (∑ a : OutcomeString, ∑ b : OutcomeString, + trace (projection (makeLabel q a) * projection (makeLabel r b))) = (D : ℂ) := by + have h : (∑ a : OutcomeString, ∑ b : OutcomeString, + projection (makeLabel q a) * projection (makeLabel r b)) = 1 := by + simp_rw [← Finset.mul_sum, projection_sum_makeLabel, mul_one] + exact projection_sum_makeLabel q + have hh := congrArg Matrix.trace h + simpa only [trace_sum, trace_one, card_basis] using hh + +lemma rawOutput_trace_total : trace rawOutput = (Q^2*D : ℕ) := by + change (∑ i : Label × Label, rawOutput i i) = _ + rw [Fintype.sum_prod_type] + simp_rw [rawOutput_crossed_diagonal, sum_label] + conv_lhs => + arg 2; ext q + rw [Finset.sum_comm] + simp_rw [sum_projection_pair_trace] + simp only [Finset.sum_const, Finset.card_univ, nsmul_eq_mul, card_question, + Nat.cast_mul, Nat.cast_pow] + ring + +end Explicit + +open scoped MatrixOrder ComplexOrder Kronecker + +open Matrix + +universe v2604_0 v2604_1 + +def Separable {ι : Type v2604_0} {κ : Type v2604_1} [Fintype ι] [Fintype κ] + (R : Matrix (ι × κ) (ι × κ) ℂ) : Prop := + ∃ (n : ℕ) (A : Fin n → Matrix ι ι ℂ) (B : Fin n → Matrix κ κ ℂ), + (∀ s, (A s).PosSemidef) ∧ (∀ s, (B s).PosSemidef) ∧ R = ∑ s, A s ⊗ₖ B s + +open Finset + +namespace Explicit + +lemma Q_pos : 0 < Q := by unfold Q; exact pow_pos b_pos 3 + +lemma D_pos : 0 < D := by rw [D_eq]; exact pow_pos (by decide) _ + +end Explicit + +open scoped ComplexOrder MatrixOrder Kronecker + +open Matrix + +section + +universe v2846_0 v2846_1 v2846_2 + +variable {α : Type v2846_0} {β : Type v2846_1} {γ : Type v2846_2} [inst2846_0 : Fintype α] [inst2846_1 : Fintype β] [inst2846_2 : Fintype γ] + +def projectionKraus (u : β → γ → ℝ) (P : β → Matrix α α ℂ) : + (γ × α) → Matrix β α ℂ := fun s i a => (u i s.1 : ℂ) * P i s.2 a + +omit inst2846_1 in +lemma projectionKraus_coeff [Fintype β] (u : β → γ → ℝ) (P : β → Matrix α α ℂ) + (hP : ∀ i, (P i).IsHermitian) (i j : β) (a b : α) : + (∑ s, projectionKraus u P s i a * star (projectionKraus u P s j b)) = + (∑ h, (u i h : ℂ) * (u j h : ℂ)) * (P j * P i) b a := by + simp only [projectionKraus, Fintype.sum_prod_type, star_mul, Complex.star_def, + Complex.conj_ofReal] + have hp (l : α) : star (P j l b) = P j b l := congrArg (fun A : Matrix α α ℂ => A b l) (hP j).eq + simp only [← Complex.star_def, hp, Matrix.mul_apply, Finset.sum_mul, Finset.mul_sum] + rw [Finset.sum_comm] + apply Finset.sum_congr rfl + intro h _ + apply Finset.sum_congr rfl + intro l _ + ring + +lemma projectionKraus_formula (u : β → γ → ℝ) (P : β → Matrix α α ℂ) + (hP : ∀ i, (P i).IsHermitian) (U : Matrix α α ℂ) (i j : β) : + (∑ s, projectionKraus u P s * U * (projectionKraus u P s)ᴴ) i j = + trace (((∑ h, (u i h : ℂ) * (u j h : ℂ)) • (P j * P i)) * U) := by + simp only [Matrix.sum_apply, Matrix.mul_apply, Matrix.conjTranspose_apply] + simp only [Finset.sum_mul] + calc + _ = ∑ b, ∑ a, (∑ s, projectionKraus u P s i a * star (projectionKraus u P s j b)) * U a b := by + simp only [Finset.sum_mul] + rw [Finset.sum_comm] + apply Finset.sum_congr rfl + intro b _ + rw [Finset.sum_comm] + apply Finset.sum_congr rfl + intro a _ + apply Finset.sum_congr rfl + intro s _ + ring + _ = _ := by + simp only [projectionKraus_coeff u P hP, trace, Matrix.diag_apply, + Matrix.mul_apply, Matrix.smul_apply, smul_eq_mul] + +end + +namespace Explicit + +def questionFin (i : Fin m) : Question := (ofLex (labelOrder i)).1 + +def projectionFin (i : Fin m) : Mat D := (projection (labelOrder i)).submatrix basisOrder basisOrder + +def blockFin (i j : Fin m) : Mat D := (block (labelOrder i) (labelOrder j)).submatrix basisOrder basisOrder + +def constructionMapFin : Mat D →ₗ[ℂ] Mat m := traceBlockMap blockFin + +lemma projectionFin_hermitian (i : Fin m) : (projectionFin i).IsHermitian := + (show (projection (labelOrder i)).IsHermitian from + (projection_projection (labelOrder i)).isSelfAdjoint).submatrix _ + +lemma blockFin_swap (i j : Fin m) : blockFin i j = blockFin j i := by + unfold blockFin + rw [block_swap] + +lemma blockFin_formula (i j : Fin m) : blockFin i j = + (overlap (questionFin i) (questionFin j) : ℂ) • + (projectionFin i * projectionFin j) := by + unfold blockFin block projectionFin + change _ = (overlap (questionFin i) (questionFin j) : ℂ) • _ + have hh := (Matrix.submatrix_mul_equiv (projection (labelOrder i)) (projection (labelOrder j)) + basisOrder basisOrder.toEquiv basisOrder).symm + exact congrArg (fun A : Mat D => (overlap (questionFin i) (questionFin j) : ℂ) • A) hh + +lemma constructionMapFin_kraus (U : Mat D) : constructionMapFin U = + ∑ s, projectionKraus (fun i => vector (questionFin i)) projectionFin s * U * + (projectionKraus (fun i => vector (questionFin i)) projectionFin s)ᴴ := by + ext i j + change trace (blockFin i j * U) = _ + rw [projectionKraus_formula _ _ projectionFin_hermitian] + rw [blockFin_swap i j, blockFin_formula] + have hc : (overlap (questionFin j) (questionFin i) : ℂ) = + ∑ h, (vector (questionFin i) h : ℂ) * (vector (questionFin j) h : ℂ) := by + rw [overlap_symm] + simp only [← Complex.ofReal_mul, ← Complex.ofReal_sum] + rfl + rw [hc] + +lemma constructionMapFin_cp : CompletelyPositive constructionMapFin := + cp_of_kraus_representation _ _ constructionMapFin_kraus + +lemma constructionMapFin_unit (x y : Fin D) (i j : Fin m) : + constructionMapFin (matrixUnit x y) i j = blockFin i j y x := by + change trace (blockFin i j * matrixUnit x y) = _ + simp [trace, Matrix.diag_apply, Matrix.mul_apply, matrixUnit, ite_and] + +def omegaVector : Fin D × Fin D → ℂ := fun i => if i.1=i.2 then 1 else 0 + +def rawOutputFin : Matrix (Fin m × Fin m) (Fin m × Fin m) ℂ := + rawOutput.submatrix (Prod.map labelOrder labelOrder) (Prod.map labelOrder labelOrder) + +lemma rawOutputFin_tensor : rawOutputFin = + tensorMap constructionMapFin constructionMapFin (outer omegaVector omegaVector) := by + ext ⟨i,a⟩ ⟨j,b⟩ + change rawOutput (labelOrder i, labelOrder a) (labelOrder j, labelOrder b) = _ + simp only [tensorMap, outer, omegaVector, constructionMapFin_unit, apply_ite, + star_one, star_zero, ite_mul, one_mul, zero_mul, mul_zero] + simp only [Finset.sum_ite_eq, Finset.mem_univ, ite_true] + change (∑ h, ∑ l, block (labelOrder i) (labelOrder j) l h * + block (labelOrder a) (labelOrder b) l h) = + ∑ h : Fin D, ∑ l : Fin D, block (labelOrder i) (labelOrder j) (basisOrder l) (basisOrder h) * + block (labelOrder a) (labelOrder b) (basisOrder l) (basisOrder h) + rw [← Equiv.sum_comp basisOrder.toEquiv] + apply Finset.sum_congr rfl + intro h _ + exact (Equiv.sum_comp basisOrder.toEquiv _).symm + +lemma rawOutputFin_psd : rawOutputFin.PosSemidef := by + rw [rawOutputFin_tensor] + exact tensorMap_positive constructionMapFin_cp constructionMapFin_cp (outer_posSemidef _) + +lemma rawOutputFin_trace : trace rawOutputFin = ((Q^2*D : ℕ) : ℂ) := by + rw [← rawOutput_trace_total] + unfold trace + exact Equiv.sum_comp (labelOrder.toEquiv.prodCongr labelOrder.toEquiv) + (fun x : Label × Label => rawOutput x x) + +lemma rhoFin_eq : rhoFin = ((Q^2*D : ℕ) : ℂ)⁻¹ • rawOutputFin := rfl + +lemma symbolic_normalization_ne_zero (q d : ℕ) (hq : 0 < q) (hd : 0 < d) : + ((q^2*d : ℕ) : ℂ) ≠ 0 := by + exact Nat.cast_ne_zero.mpr (mul_pos (pow_pos hq 2) hd).ne' + +lemma normalization_ne_zero : ((Q^2*D : ℕ) : ℂ) ≠ 0 := + symbolic_normalization_ne_zero Q D Q_pos D_pos + +lemma rhoFin_density : Density rhoFin := by + rw [rhoFin_eq] + constructor + · exact rawOutputFin_psd.smul (inv_nonneg.mpr (Nat.cast_nonneg _)) + · rw [trace_smul, rawOutputFin_trace, smul_eq_mul, inv_mul_cancel₀ normalization_ne_zero] + +end Explicit + +end ZeroKey + +namespace UnrestrictedQuantum + +open Matrix MeasureTheory + +open scoped ComplexOrder MatrixOrder + +universe v3096_0 v3096_1 v3096_2 v3096_3 v3096_4 + +variable {A : Type v3096_0} {B : Type v3096_1} {C : Type v3096_2} [inst3096_0 : AddCommGroup A] [inst3096_1 : Module ℂ A] [inst3096_2 : One A] + [inst3096_3 : AddCommGroup B] [inst3096_4 : Module ℂ B] [inst3096_5 : One B] + [inst3096_6 : AddCommGroup C] [inst3096_7 : Module ℂ C] [inst3096_8 : One C] + {ι : Type v3096_3} {κ : Type v3096_4} [inst3096_9 : Fintype ι] [inst3096_10 : Fintype κ] [inst3096_11 : DecidableEq ι] [inst3096_12 : DecidableEq κ] + +universe v3101_0 v3101_1 + +abbrev ReferenceFunctional (A : Type v3101_0) [AddCommGroup A] [Module ℂ A] + (ι : Type v3101_1) := A →ₗ[ℂ] Matrix ι ι ℂ + +def PositiveFunctional [LE A] (S : ReferenceFunctional A ι) : Prop := + ∀ x, 0 ≤ x → (S x).PosSemidef + +universe v3140_0 v3140_1 v3140_2 + +structure ObservableInstrument (O : Type v3140_0) [MeasurableSpace O] + (A : Type v3140_1) (B : Type v3140_2) [AddCommGroup A] [Module ℂ A] [One A] [LE A] + [AddCommGroup B] [Module ℂ B] [One B] [LE B] where + operation : Set O → B →ₗ[ℂ] A + positive : ∀ E, MeasurableSet E → ∀ x, 0 ≤ x → 0 ≤ operation E x + total_unit : operation Set.univ 1 = 1 + +universe v3147_0 + +variable {O : Type v3147_0} [inst3147_0 : MeasurableSpace O] [inst3147_1 : LE A] [inst3147_2 : LE B] + (J : ObservableInstrument O A B) (S : ReferenceFunctional A ι) + +structure InstrumentRun where + law : Measure O + probability : IsProbabilityMeasure law + posterior : O → ReferenceFunctional B ι + posterior_positive : ∀ o, PositiveFunctional (posterior o) + posterior_trace : ∀ o, trace (posterior o 1) = 1 + integrable : ∀ x i j, Integrable (fun o => posterior o x i j) law + update : ∀ E, MeasurableSet E → ∀ x i j, + (∫ o in E, posterior o x i j ∂law) = S (J.operation E x) i j + +namespace InstrumentRun + +variable (r : InstrumentRun J S) + +omit inst3096_11 in +theorem reference_mean [DecidableEq ι] (i j : ι) : + (∫ o, r.posterior o 1 i j ∂r.law) = S 1 i j := by + simpa only [Measure.restrict_univ, J.total_unit] using + r.update Set.univ MeasurableSet.univ 1 i j + +end InstrumentRun + +end UnrestrictedQuantum + +namespace ZeroKey + +section + +open MeasureTheory ProbabilityTheory Set Function unitInterval + +open scoped ENNReal + +section + +universe v3216_0 v3216_1 + +theorem sample_instrument_kernel {S : Type v3216_0} {O : Type v3216_1} [MeasurableSpace S] + [MeasurableSpace O] [StandardBorelSpace O] [Nonempty O] + (κ : Kernel S O) [IsMarkovKernel κ] : + ∃ f : S → I → O, Measurable (uncurry f) ∧ + (∀ s, volume.map (f s) = κ s) ∧ + ∀ (μ : Measure S) [IsFiniteMeasure μ], + (μ.prod (volume : Measure I)).map (fun p => (p.1, f p.1 p.2)) = μ ⊗ₘ κ := by + obtain ⟨f,hf,hfLaw⟩ := κ.exists_measurable_map_eq_unitInterval + change Measurable (fun p : S × I => f p.1 p.2) at hf + refine ⟨f,hf,hfLaw,?_⟩ + intro μ hμ + ext B hB + rw [Measure.map_apply (measurable_fst.prodMk hf) hB, + Measure.prod_apply (hB.preimage (measurable_fst.prodMk hf)), + Measure.compProd_apply hB] + congr 1 + funext s + rw [← hfLaw s, Measure.map_apply hf.of_uncurry_left (measurable_prodMk_left hB)] + rfl + +abbrev UniformTape := ℕ → I + +def uniformTapeLaw : Measure UniformTape := + Measure.infinitePi (fun _ : ℕ => (volume : Measure I)) + +instance : IsProbabilityMeasure uniformTapeLaw := by + unfold uniformTapeLaw + infer_instance + +end + +open MeasureTheory ProbabilityTheory Filter + +open scoped ENNReal + +section + +universe v3447_0 + +variable {Ω : Type v3447_0} {mΩ : MeasurableSpace Ω} [inst3447_0 : StandardBorelSpace Ω] + {μ : Measure Ω} [inst3447_1 : IsFiniteMeasure μ] + +lemma indicator_one_mul (s : Set Ω) (f : Ω → ℝ) : + s.indicator (fun _ => (1:ℝ)) * f = s.indicator f := by + ext x + by_cases hx : x∈s <;> simp [hx] + +lemma indicator_inter_one (s t : Set Ω) : + (s∩t).indicator (fun _ => (1:ℝ)) = + s.indicator (t.indicator (fun _ => (1:ℝ))) := by + ext x + by_cases hs : x∈s <;> by_cases ht : x∈t <;> simp [hs,ht] + +lemma condIndep_condExp_right {C A B : MeasurableSpace Ω} + (hC : C ≤ mΩ) (hA : A ≤ mΩ) (hB : B ≤ mΩ) (hCA : C ≤ A) + (h : CondIndep C A B hC μ) {t : Set Ω} (ht : MeasurableSet[B] t) : + μ[t.indicator (fun _ => (1:ℝ)) | A] =ᵐ[μ] + μ[t.indicator (fun _ => (1:ℝ)) | C] := by + let f := t.indicator (fun _ : Ω => (1:ℝ)) + have hf : Integrable f μ := (integrable_const (1:ℝ)).indicator (hB t ht) + symm + apply ae_eq_condExp_of_forall_setIntegral_eq hA hf + · intro s hs hμs + exact integrable_condExp.integrableOn + · intro s hs hμs + have hs' : MeasurableSet[mΩ] s := hA s hs + have hsi : Integrable (s.indicator (fun _ : Ω => (1:ℝ))) μ := + (integrable_const (1:ℝ)).indicator hs' + have hprod : Integrable (s.indicator (fun _ : Ω => (1:ℝ)) * μ[f | C]) μ := by + rw [indicator_one_mul] + exact integrable_condExp.indicator hs' + have hp := condExp_mul_of_stronglyMeasurable_right + (stronglyMeasurable_condExp (μ := μ) (m := C) (f := f)) hprod hsi + rw [indicator_one_mul] at hp + have hh := ((condIndep_iff C A B hC hA hB μ).mp h) s t hs ht + change μ[(s∩t).indicator (fun _ => (1:ℝ)) | C] =ᵐ[μ] + μ[s.indicator (fun _ => (1:ℝ)) | C] * μ[f | C] at hh + calc + (∫ x in s, μ[f | C] x ∂μ) = ∫ x, s.indicator (μ[f | C]) x ∂μ := + (integral_indicator hs').symm + _ = ∫ x, μ[s.indicator (μ[f | C]) | C] x ∂μ := (integral_condExp hC).symm + _ = ∫ x, μ[(s∩t).indicator (fun _ => (1:ℝ)) | C] x ∂μ := + integral_congr_ae (hp.trans hh.symm) + _ = ∫ x, (s∩t).indicator (fun _ => (1:ℝ)) x ∂μ := integral_condExp hC + _ = ∫ x in s, f x ∂μ := by + rw [indicator_inter_one, integral_indicator hs'] + · exact (stronglyMeasurable_condExp.mono hCA).aestronglyMeasurable + +lemma condIndep_local_refinement {C N A B : MeasurableSpace Ω} + (hC : C ≤ mΩ) (hA : A ≤ mΩ) (hB : B ≤ mΩ) + (hCA : C ≤ A) (hCN : C ≤ N) (hNA : N ≤ A) + (h : CondIndep C A B hC μ) : + CondIndep N A B (hNA.trans hA) μ := by + have hN := hNA.trans hA + rw [condIndep_iff N A B hN hA hB] + intro s t hs ht + let f := t.indicator (fun _ : Ω => (1:ℝ)) + have hf : Integrable f μ := (integrable_const (1:ℝ)).indicator (hB t ht) + have hp : μ[f | A] =ᵐ[μ] μ[f | C] := condIndep_condExp_right hC hA hB hCA h ht + have hcN : μ[μ[f | C] | N] = μ[f | C] := + condExp_of_stronglyMeasurable hN (stronglyMeasurable_condExp.mono hCN) integrable_condExp + have htN : μ[f | N] =ᵐ[μ] μ[f | C] := by + calc + _ =ᵐ[μ] μ[μ[f | A] | N] := (condExp_condExp_of_le hNA hA).symm + _ =ᵐ[μ] μ[μ[f | C] | N] := condExp_congr_ae hp + _ =ᵐ[μ] μ[f | C] := by rw [hcN] + have hsep : μ[s.indicator f | A] =ᵐ[μ] s.indicator (μ[f | C]) := by + apply (condExp_indicator hf hs).trans + filter_upwards [hp] with x hx + by_cases hxs : x∈s <;> simp [hxs,hx] + have hsi : Integrable (s.indicator (fun _ : Ω => (1:ℝ))) μ := + (integrable_const (1:ℝ)).indicator (hA s hs) + have hprod : Integrable (s.indicator (fun _ : Ω => (1:ℝ)) * μ[f | C]) μ := by + rw [indicator_one_mul] + exact integrable_condExp.indicator (hA s hs) + have hpull := condExp_mul_of_stronglyMeasurable_right + (stronglyMeasurable_condExp.mono hCN) hprod hsi + rw [indicator_one_mul] at hpull + change μ[(s∩t).indicator (fun _ => (1:ℝ)) | N] =ᵐ[μ] + μ[s.indicator (fun _ => (1:ℝ)) | N] * μ[f | N] + rw [indicator_inter_one] + calc + _ =ᵐ[μ] μ[μ[s.indicator f | A] | N] := (condExp_condExp_of_le hNA hA).symm + _ =ᵐ[μ] μ[s.indicator (μ[f | C]) | N] := condExp_congr_ae hsep + _ =ᵐ[μ] μ[s.indicator (fun _ => (1:ℝ)) | N] * μ[f | C] := hpull + _ =ᵐ[μ] _ := by + filter_upwards [htN] with x hx + simp only [Pi.mul_apply, hx] + +def recordInterFamily (B C : MeasurableSpace Ω) : Set (Set Ω) := + {s | ∃ b n, MeasurableSet[B] b ∧ MeasurableSet[C] n ∧ s = b∩n} + +lemma recordInterFamily_pi (B C : MeasurableSpace Ω) : IsPiSystem (recordInterFamily B C) := by + rintro s ⟨b,n,hb,hn,rfl⟩ t ⟨b',n',hb',hn',rfl⟩ _ + refine ⟨b∩b',n∩n',hb.inter hb',hn.inter hn',?_⟩ + ext x + simp only [Set.mem_inter_iff] + tauto + +lemma recordInterFamily_generate (B C : MeasurableSpace Ω) : + MeasurableSpace.generateFrom (recordInterFamily B C) = B ⊔ C := by + apply le_antisymm + · apply MeasurableSpace.generateFrom_le + rintro s ⟨b,n,hb,hn,rfl⟩ + exact ((show B ≤ B ⊔ C from le_sup_left) b hb).inter + ((show C ≤ B ⊔ C from le_sup_right) n hn) + · apply sup_le + · intro s hs + apply MeasurableSpace.measurableSet_generateFrom + exact ⟨s,Set.univ,hs,MeasurableSet.univ,(Set.inter_univ s).symm⟩ + · intro s hs + apply MeasurableSpace.measurableSet_generateFrom + exact ⟨Set.univ,s,MeasurableSet.univ,hs,(Set.univ_inter s).symm⟩ + +lemma condIndep_join_public_right {C A B : MeasurableSpace Ω} + (hC : C ≤ mΩ) (hA : A ≤ mΩ) (hB : B ≤ mΩ) + (h : CondIndep C A B hC μ) : CondIndep C A (B ⊔ C) hC μ := by + let p : Set (Set Ω) := {s | MeasurableSet[A] s} + have hp : IsPiSystem p := by + intro s hs t ht _ + exact hs.inter ht + have hpg : A = MeasurableSpace.generateFrom p := + (@MeasurableSpace.generateFrom_measurableSet Ω A).symm + have hpM : ∀ s ∈ p, MeasurableSet[mΩ] s := hA + have hrM : ∀ s ∈ recordInterFamily B C, MeasurableSet[mΩ] s := by + rintro s ⟨b,n,hb,hn,rfl⟩ + exact (hB b hb).inter (hC n hn) + apply CondIndepSets.condIndep hA (sup_le hB hC) hp (recordInterFamily_pi B C) + hpg (recordInterFamily_generate B C).symm + rw [condIndepSets_iff C hC p (recordInterFamily B C) hpM hrM μ] + rintro s _ hs ⟨b,n,hb,hn,rfl⟩ + have hsb : Integrable ((s∩b).indicator (fun _ : Ω => (1:ℝ))) μ := + (integrable_const (1:ℝ)).indicator ((hA s hs).inter (hB b hb)) + have hbI : Integrable (b.indicator (fun _ : Ω => (1:ℝ))) μ := + (integrable_const (1:ℝ)).indicator (hB b hb) + have hleft := condExp_indicator hsb hn + have hright := condExp_indicator hbI hn + have he1 : (s∩(b∩n)).indicator (fun _ : Ω => (1:ℝ)) = + n.indicator ((s∩b).indicator (fun _ : Ω => (1:ℝ))) := by + ext x + by_cases hx : x∈n <;> by_cases hsx : x∈s <;> by_cases hbx : x∈b <;> simp [hx,hsx,hbx] + have he2 : (b∩n).indicator (fun _ : Ω => (1:ℝ)) = + n.indicator (b.indicator (fun _ : Ω => (1:ℝ))) := by + ext x + by_cases hx : x∈n <;> by_cases hbx : x∈b <;> simp [hx,hbx] + have hfactor := (condIndep_iff C A B hC hA hB μ).mp h s b hs hb + change μ[(s∩(b∩n)).indicator (fun _ => (1:ℝ)) | C] =ᵐ[μ] + μ[s.indicator (fun _ => (1:ℝ)) | C] * μ[(b∩n).indicator (fun _ => (1:ℝ)) | C] + rw [he1,he2] + filter_upwards [hleft,hright,hfactor] with x hx hy hz + change μ[n.indicator ((s∩b).indicator (fun _ => (1:ℝ))) | C] x = + μ[s.indicator (fun _ => (1:ℝ)) | C] x * + μ[n.indicator (b.indicator (fun _ => (1:ℝ))) | C] x + rw [hx,hy] + by_cases hxn : x∈n <;> simp [hxn,Pi.mul_apply] at hz ⊢ + exact hz + +lemma condIndep_local_message {C N A B : MeasurableSpace Ω} + (hC : C ≤ mΩ) (hA : A ≤ mΩ) (hB : B ≤ mΩ) (hCN : C ≤ N) + (hNA : N ≤ A ⊔ C) (h : CondIndep C A B hC μ) : + CondIndep N A B (hNA.trans (sup_le hA hC)) μ := by + have hjoin : CondIndep C (A ⊔ C) B hC μ := + (condIndep_join_public_right hC hB hA h.symm).symm + have href := condIndep_local_refinement hC (sup_le hA hC) hB + le_sup_right hCN hNA hjoin + exact condIndep_of_condIndep_of_le_left href le_sup_left + +end + +universe v3643_0 + +lemma condFactor_full_transcript {Ω : Type v3643_0} {mΩ : MeasurableSpace Ω} {μ : Measure Ω} + [inst3643_0 : IsFiniteMeasure μ] + (ℱ : Filtration ℕ mΩ) (f g : Ω → ℝ) + (h : ∀ n, μ[f*g | ℱ n] =ᵐ[μ] μ[f | ℱ n] * μ[g | ℱ n]) : + μ[f*g | ⨆ n, ℱ n] =ᵐ[μ] μ[f | ⨆ n, ℱ n] * μ[g | ⨆ n, ℱ n] := by + have he : ∀ᵐ x ∂μ, ∀ n, μ[f*g | ℱ n] x = μ[f | ℱ n] x * μ[g | ℱ n] x := + ae_all_iff.mpr h + filter_upwards [he, tendsto_ae_condExp (ℱ := ℱ) (f*g), + tendsto_ae_condExp (ℱ := ℱ) f, tendsto_ae_condExp (ℱ := ℱ) g] with x hx hfg hf hg + exact tendsto_nhds_unique hfg ((hf.mul hg).congr (fun n => (hx n).symm)) + +lemma condIndep_full_transcript {Ω : Type v3643_0} {mΩ : MeasurableSpace Ω} {μ : Measure Ω} + [inst3643_0 : IsFiniteMeasure μ] + [StandardBorelSpace Ω] + (ℱ : Filtration ℕ mΩ) (mA mB : MeasurableSpace Ω) (hA : mA ≤ mΩ) (hB : mB ≤ mΩ) + (h : ∀ n, CondIndep (ℱ n) mA mB (ℱ.le n) μ) : + CondIndep (⨆ n, ℱ n) mA mB (iSup_le fun n => ℱ.le n) μ := by + rw [condIndep_iff _ _ _ _ hA hB] + intro s t hs ht + have hh (n : ℕ) := (condIndep_iff _ _ _ _ hA hB μ).mp (h n) s t hs ht + have he : (s ∩ t).indicator (fun _ : Ω => (1:ℝ)) = + s.indicator (fun _ : Ω => (1:ℝ)) * t.indicator (fun _ : Ω => (1:ℝ)) := by + ext x + by_cases hxs : x∈s <;> by_cases hxt : x∈t <;> simp [hxs,hxt] + simpa only [he] using condFactor_full_transcript ℱ (s.indicator (fun _ => (1:ℝ))) + (t.indicator (fun _ => (1:ℝ))) (by simpa only [he] using hh) + +open MeasureTheory ProbabilityTheory Function Set + +section + +universe v3698_0 + +lemma indep_condIndep_bot {Ω : Type v3698_0} {mΩ : MeasurableSpace Ω} + [StandardBorelSpace Ω] {P : Measure Ω} [IsProbabilityMeasure P] + {A B : MeasurableSpace Ω} (hA : A ≤ mΩ) (hB : B ≤ mΩ) (h : Indep A B P) : + CondIndep ⊥ A B bot_le P := by + rw [condIndep_iff _ _ _ _ hA hB] + intro s t hs ht + have hmul := (h.indepSet_of_measurableSet hs ht).measure_inter_eq_mul + simp only [condExp_bot, integral_indicator (hA s hs), integral_indicator (hB t ht), + integral_indicator ((hA s hs).inter (hB t ht)), integral_const, + smul_eq_mul, mul_one] + exact Filter.Eventually.of_forall fun _ => by + simpa only [Measure.real, Measure.restrict_apply_univ, Pi.mul_apply, ENNReal.toReal_mul] using congrArg ENNReal.toReal hmul + +universe v3715_0 v3715_1 v3715_2 + +structure LocalTapeProgram (U : Type v3715_0) (V : Type v3715_1) (M : Type v3715_2) [MeasurableSpace U] + [MeasurableSpace V] [MeasurableSpace M] where + alice : ℕ → Bool + sendA : (n : ℕ) → U × (Fin n → M) → M + sendB : (n : ℕ) → V × (Fin n → M) → M + measA : ∀ n, Measurable (sendA n) + measB : ∀ n, Measurable (sendB n) + +namespace LocalTapeProgram + +universe v3724_0 v3724_1 v3724_2 + +variable {U : Type v3724_0} {V : Type v3724_1} {M : Type v3724_2} [inst3724_0 : MeasurableSpace U] [inst3724_1 : MeasurableSpace V] [inst3724_2 : MeasurableSpace M] + (p : LocalTapeProgram U V M) + +def publicPrefix : (n : ℕ) → U × V → (Fin n → M) + | 0, _ => Fin.elim0 + | n+1, ω => Fin.snoc (publicPrefix n ω) + (if p.alice n then p.sendA n (ω.1,publicPrefix n ω) else p.sendB n (ω.2,publicPrefix n ω)) + +end LocalTapeProgram + +end + +open MeasureTheory ProbabilityTheory Function Set unitInterval + +universe v3943_0 v3943_1 + +structure LocalOutcomeSampler (O : Type v3943_0) (M : Type v3943_1) [MeasurableSpace O] [MeasurableSpace M] where + alice : ℕ → Bool + sampleA : (n : ℕ) → ((Fin n → (O ⊕ Unit)) × (Fin n → M)) × I → O + sampleB : (n : ℕ) → ((Fin n → (O ⊕ Unit)) × (Fin n → M)) × I → O + sendA : (n : ℕ) → ((Fin n → (O ⊕ Unit)) × (Fin n → M)) × O → M + sendB : (n : ℕ) → ((Fin n → (O ⊕ Unit)) × (Fin n → M)) × O → M + sampleA_meas : ∀ n, Measurable (sampleA n) + sampleB_meas : ∀ n, Measurable (sampleB n) + sendA_meas : ∀ n, Measurable (sendA n) + sendB_meas : ∀ n, Measurable (sendB n) + +namespace LocalOutcomeSampler + +universe v3955_0 v3955_1 + +variable {O : Type v3955_0} {M : Type v3955_1} [inst3955_0 : MeasurableSpace O] [inst3955_1 : MeasurableSpace M] + (p : LocalOutcomeSampler O M) + +def privatePrefix (a : Bool) : (n : ℕ) → UniformTape × (Fin n → M) → (Fin n → (O ⊕ Unit)) + | 0, _ => Fin.elim0 + | n+1, pair => + let old := privatePrefix a n (pair.1,fun i => pair.2 i.castSucc) + let pubPast := fun i : Fin n => pair.2 i.castSucc + Fin.snoc old (if p.alice n = a then Sum.inl + (if a then p.sampleA n ((old,pubPast),pair.1 n) + else p.sampleB n ((old,pubPast),pair.1 n)) else Sum.inr ()) + +def extractPrivate (a : Bool) (n : ℕ) (x : Fin n → O) : Fin n → (O ⊕ Unit) := + fun i => if p.alice i = a then Sum.inl (x i) else Sum.inr () + +def publicFrom : (n : ℕ) → (Fin n → O) → (Fin n → M) + | 0, _ => Fin.elim0 + | n+1, x => + let old := fun i : Fin n => x i.castSucc + let pubPast := publicFrom n old + Fin.snoc pubPast (if p.alice n then + p.sendA n ((p.extractPrivate true n old,pubPast),x (Fin.last n)) else + p.sendB n ((p.extractPrivate false n old,pubPast),x (Fin.last n))) + +end LocalOutcomeSampler + +end + +section + +open MeasureTheory Matrix Filter + +open scoped ComplexOrder MatrixOrder + +universe v4350_0 v4350_1 + +open scoped Matrix.Norms.L2Operator in +instance matrixMeasurableSpace {m : Type v4350_0} {n : Type v4350_1} [Fintype m] [Fintype n] : + MeasurableSpace (Matrix m n ℂ) := borel _ + +universe v4353_0 v4353_1 + +open scoped Matrix.Norms.L2Operator in +instance matrixBorelSpace {m : Type v4353_0} {n : Type v4353_1} [Fintype m] [Fintype n] : + BorelSpace (Matrix m n ℂ) := ⟨rfl⟩ + +universe v4357_0 v4357_1 + +variable {Ω : Type v4357_0} {ι : Type v4357_1} [inst4357_0 : MeasurableSpace Ω] [inst4357_1 : Fintype ι] [inst4357_2 : DecidableEq ι] + +universe v4361_0 v4361_1 + +structure PositiveMatrixMeasure (Ω : Type v4361_0) (ι : Type v4361_1) [MeasurableSpace Ω] [Fintype ι] where + entry : ι → ι → ComplexMeasure Ω + positive : ∀ S, MeasurableSet S → Matrix.PosSemidef (fun i j => entry i j S) + +namespace PositiveMatrixMeasure + +def value (W : PositiveMatrixMeasure Ω ι) (S : Set Ω) : Matrix ι ι ℂ := fun i j => W.entry i j S + +def density (W : PositiveMatrixMeasure Ω ι) (μ : Measure Ω) : Ω → Matrix ι ι ℂ := + fun t i j => (W.entry i j).rnDeriv μ t + +omit inst4357_2 in +lemma measurable_density [DecidableEq ι] (W : PositiveMatrixMeasure Ω ι) (μ : Measure Ω) : + Measurable (W.density μ) := by + have hh : Measurable (fun t i j => (W.entry i j).rnDeriv μ t) := by + apply Measurable.of_eval; intro i + apply Measurable.of_eval; intro j + unfold ComplexMeasure.rnDeriv + simp only [Complex.mk_eq_add_mul_I] + apply Measurable.add + · exact Complex.measurable_ofReal.comp ((W.entry i j).re.measurable_rnDeriv μ) + · exact (Complex.measurable_ofReal.comp ((W.entry i j).im.measurable_rnDeriv μ)).mul_const Complex.I + + have hc : Continuous (Matrix.of : (ι → ι → ℂ) → Matrix ι ι ℂ) := by + exact continuous_matrix (fun i j => continuous_apply_apply i j) + exact hc.measurable.comp hh + +omit inst4357_2 in +lemma integrable_entry [DecidableEq ι] (W : PositiveMatrixMeasure Ω ι) (μ : Measure Ω) (i j : ι) : + Integrable (fun t => W.density μ t i j) μ := (W.entry i j).integrable_rnDeriv μ + +omit inst4357_2 in +lemma entry_absolutelyContinuous [DecidableEq ι] (W : PositiveMatrixMeasure Ω ι) (μ : Measure Ω) + (hAC : ∀ S, MeasurableSet S → μ S = 0 → W.value S = 0) (i j : ι) : + W.entry i j ≪ᵥ μ.toENNRealVectorMeasure := by + intro S hS + by_cases hs : MeasurableSet S + · have hm : μ S = 0 := by simpa [Measure.toENNRealVectorMeasure_apply,hs] using hS + exact congrArg (fun M : Matrix ι ι ℂ => M i j) (hAC S hs hm) + · exact (W.entry i j).not_measurable hs + +lemma integral_density_entry (W : PositiveMatrixMeasure Ω ι) (μ : Measure Ω) [SigmaFinite μ] + (hAC : ∀ S, MeasurableSet S → μ S = 0 → W.value S = 0) + (S : Set Ω) (hS : MeasurableSet S) (i j : ι) : + (∫ t in S, W.density μ t i j ∂μ) = W.value S i j := by + have h := (ComplexMeasure.absolutelyContinuous_ennreal_iff _ _).mp + (W.entry_absolutelyContinuous μ hAC i j) + apply Complex.ext + · have hh := congrArg (fun s : SignedMeasure Ω => s S) + (SignedMeasure.withDensityᵥ_rnDeriv_eq (W.entry i j).re μ h.1) + rw [withDensityᵥ_apply (SignedMeasure.integrable_rnDeriv _ _) hS] at hh + change RCLike.re (∫ t in S, W.density μ t i j ∂μ) = _ + rw [← integral_re ((W.integrable_entry μ i j).integrableOn)] + exact hh + · have hh := congrArg (fun s : SignedMeasure Ω => s S) + (SignedMeasure.withDensityᵥ_rnDeriv_eq (W.entry i j).im μ h.2) + rw [withDensityᵥ_apply (SignedMeasure.integrable_rnDeriv _ _) hS] at hh + change RCLike.im (∫ t in S, W.density μ t i j ∂μ) = _ + rw [← integral_im ((W.integrable_entry μ i j).integrableOn)] + exact hh + +end PositiveMatrixMeasure + +lemma ae_complex_nonneg_of_integral_nonneg {μ : Measure Ω} {f : Ω → ℂ} + (hf : Integrable f μ) + (h : ∀ S, MeasurableSet S → μ S < ⊤ → 0 ≤ ∫ t in S, f t ∂μ) : + ∀ᵐ t ∂μ, 0 ≤ f t := by + have hre : ∀ᵐ t ∂μ, 0 ≤ (f t).re := by + apply ae_nonneg_of_forall_setIntegral_nonneg hf.re + intro S hs hm + rw [integral_re hf.integrableOn] + exact (RCLike.nonneg_iff.mp (h S hs hm)).1 + have him : (fun t => (f t).im) =ᵐ[μ] fun _ => (0:ℝ) := by + apply Integrable.ae_eq_of_forall_setIntegral_eq _ _ hf.im (integrable_zero _ _ _) + intro S hs hm + rw [integral_im hf.integrableOn] + simp only [Pi.zero_apply,integral_zero] + exact (RCLike.nonneg_iff.mp (h S hs hm)).2 + filter_upwards [hre,him] with t ht hi + exact RCLike.nonneg_iff.mpr ⟨ht,hi⟩ + +def quadraticValue (v : ι → ℂ) (M : Matrix ι ι ℂ) : ℂ := + ∑ i, ∑ j, star (v i) * M i j * v j + +omit inst4357_2 in +lemma quadraticValue_eq [DecidableEq ι] (v : ι → ℂ) (M : Matrix ι ι ℂ) : + quadraticValue v M = star v ⬝ᵥ (M *ᵥ v) := by + simp [quadraticValue,dotProduct,Matrix.mulVec,Finset.mul_sum,mul_assoc] + +omit inst4357_2 in +lemma integrable_quadraticValue [DecidableEq ι] {μ : Measure Ω} {F : Ω → Matrix ι ι ℂ} + (hF : ∀ i j, Integrable (fun t => F t i j) μ) (v : ι → ℂ) : + Integrable (fun t => quadraticValue v (F t)) μ := by + apply integrable_finsetSum; intro i _ + apply integrable_finsetSum; intro j _ + exact ((hF i j).const_mul _).mul_const _ + +omit inst4357_2 in +lemma integral_quadraticValue [DecidableEq ι] {μ : Measure Ω} {F : Ω → Matrix ι ι ℂ} + (hF : ∀ i j, Integrable (fun t => F t i j) μ) (v : ι → ℂ) : + (∫ t, quadraticValue v (F t) ∂μ) = quadraticValue v (fun i j => ∫ t, F t i j ∂μ) := by + unfold quadraticValue + rw [integral_finsetSum _ (fun i _ => integrable_finsetSum _ + (fun j _ => ((hF i j).const_mul _).mul_const _))] + apply Finset.sum_congr rfl; intro i _ + rw [integral_finsetSum _ (fun j _ => ((hF i j).const_mul _).mul_const _)] + apply Finset.sum_congr rfl; intro j _ + rw [integral_mul_const,integral_const_mul] + +lemma density_posSemidef_ae (W : PositiveMatrixMeasure Ω ι) (μ : Measure Ω) [SigmaFinite μ] + (hAC : ∀ S, MeasurableSet S → μ S = 0 → W.value S = 0) : + ∀ᵐ t ∂μ, (W.density μ t).PosSemidef := by + have hherm : ∀ᵐ t ∂μ, (W.density μ t).IsHermitian := by + have hij (i j : ι) : (fun t => star (W.density μ t j i)) =ᵐ[μ] + (fun t => W.density μ t i j) := by + apply Integrable.ae_eq_of_forall_setIntegral_eq _ _ + ((Complex.conjCLE.integrable_comp_iff).mpr (W.integrable_entry μ j i)) (W.integrable_entry μ i j) + intro S hs hm + simp only [Complex.conjCLE_apply,integral_conj,W.integral_density_entry μ hAC S hs] + exact congrArg (fun M : Matrix ι ι ℂ => M i j) (W.positive S hs).isHermitian.eq + have hh : ∀ᵐ t ∂μ, ∀ i j, star (W.density μ t j i)=W.density μ t i j := + ae_all_iff.mpr (fun i => ae_all_iff.mpr (hij i)) + filter_upwards [hh] with t ht + exact Matrix.IsHermitian.ext ht + have hq (v : ι → ℂ) : ∀ᵐ t ∂μ, 0 ≤ quadraticValue v (W.density μ t) := by + apply ae_complex_nonneg_of_integral_nonneg + (integrable_quadraticValue (W.integrable_entry μ) v) + intro S hs hm + rw [integral_quadraticValue (fun i j => (W.integrable_entry μ i j).integrableOn)] + simp only [W.integral_density_entry μ hAC S hs] + change 0 ≤ quadraticValue v (W.value S) + rw [quadraticValue_eq] + exact (W.positive S hs).dotProduct_mulVec_nonneg v + obtain ⟨s,hs,hd⟩ := TopologicalSpace.exists_countable_dense (ι → ℂ) + let : Countable s := hs.to_subtype + have hqs : ∀ᵐ t ∂μ, ∀ v : s, 0 ≤ quadraticValue v (W.density μ t) := + ae_all_iff.mpr (fun v => hq v) + filter_upwards [hherm,hqs] with t ht hqt + apply Matrix.posSemidef_iff_dotProduct_mulVec.mpr + refine ⟨ht,fun v => ?_⟩ + rw [← quadraticValue_eq] + refine hd.denseRange_val.induction_on (p := fun v => 0 ≤ quadraticValue v (W.density μ t)) v ?_ hqt + · apply isClosed_le continuous_const + unfold quadraticValue + fun_prop + +end + +section + +open MeasureTheory Matrix Filter + +open scoped ComplexOrder MatrixOrder Matrix.Norms.L2Operator ProbabilityTheory ENNReal NNReal Topology + +universe v4526_0 + +lemma psd_entry_norm_le_trace {ι : Type v4526_0} [inst4526_0 : Fintype ι] + [inst4526_1 : DecidableEq ι] + {M : Matrix ι ι ℂ} (hM : M.PosSemidef) (i j : ι) : + ‖M i j‖ ≤ (trace M).re := by + let S := CFC.sqrt M + have hS : S.IsHermitian := (CFC.sqrt_nonneg M).isSelfAdjoint.isHermitian + have hSS : S * Sᴴ = M := by rw [hS.eq]; exact CFC.sqrt_mul_sqrt_self M hM.nonneg + let v (i : ι) : EuclideanSpace ℂ ι := WithLp.toLp 2 (fun k => S i k) + have he (i j : ι) : M i j = inner ℂ (v j) (v i) := by + rw [← hSS] + simp [v,Matrix.mul_apply,EuclideanSpace.inner_toLp_toLp,dotProduct] + have hv (i : ι) : ‖v i‖ = Real.sqrt (M i i).re := by + rw [he]; exact norm_eq_sqrt_re_inner (𝕜 := ℂ) (v i) + have hdiag (i : ι) : (M i i).re ≤ (trace M).re := by + change (M i i).re ≤ (∑ k, M k k).re + rw [Complex.re_sum] + exact Finset.single_le_sum (fun k _ => (RCLike.nonneg_iff.mp (hM.diag_nonneg (i:=k))).1) (Finset.mem_univ i) + have ht : 0 ≤ (trace M).re := (RCLike.nonneg_iff.mp hM.trace_nonneg).1 + calc + ‖M i j‖ ≤ ‖v j‖ * ‖v i‖ := by rw [he]; exact norm_inner_le_norm _ _ + _ ≤ Real.sqrt (trace M).re * Real.sqrt (trace M).re := by + rw [hv,hv] + exact mul_le_mul (Real.sqrt_le_sqrt (hdiag j)) (Real.sqrt_le_sqrt (hdiag i)) + (Real.sqrt_nonneg _) (Real.sqrt_nonneg _) + _ = (trace M).re := Real.mul_self_sqrt ht + +universe v4553_0 + +lemma uniformIntegrable_of_ae_norm_le_one {Ω : Type v4553_0} {mΩ : MeasurableSpace Ω} + {μ : Measure Ω} [inst4553_0 : IsFiniteMeasure μ] + {f : ℕ → Ω → ℝ} + (hf : ∀ n, AEStronglyMeasurable (f n) μ) (hb : ∀ n, ∀ᵐ ω ∂μ, ‖f n ω‖ ≤ 1) : + UniformIntegrable f 1 μ := by + apply uniformIntegrable_of le_rfl ENNReal.one_ne_top hf + intro ε hε + refine ⟨2, fun n => ?_⟩ + have hz : ({ω | (2:ℝ≥0) ≤ ‖f n ω‖₊}.indicator (f n)) =ᵐ[μ] 0 := by + filter_upwards [hb n] with ω hω + rw [Set.indicator_of_notMem] + · rfl + · simp only [Set.mem_ofPred_eq,not_le] + have : ‖f n ω‖₊ ≤ (1:ℝ≥0) := hω + exact lt_of_le_of_lt this (by norm_num) + rw [eLpNorm_congr_ae hz,eLpNorm_zero] + exact bot_le + +lemma bounded_martingale_limit {Ω : Type v4553_0} {mΩ : MeasurableSpace Ω} {μ : Measure Ω} + [inst4553_0 : IsFiniteMeasure μ] {F : Filtration ℕ mΩ} + {f : ℕ → Ω → ℝ} (hf : Martingale f F μ) + (hb : ∀ n, ∀ᵐ ω ∂μ, ‖f n ω‖ ≤ 1) : + ∃ g : Ω → ℝ, Integrable g μ ∧ + (∀ᵐ ω ∂μ, Tendsto (fun n => f n ω) atTop (𝓝 (g ω))) ∧ + (∀ n, f n =ᵐ[μ] μ[g | F n]) := by + have hui := uniformIntegrable_of_ae_norm_le_one + (fun n => ((hf.stronglyMeasurable n).mono (F.le n)).aestronglyMeasurable) hb + refine ⟨F.limitProcess f μ, ?_, hf.submartingale.ae_tendsto_limitProcess_of_uniformIntegrable hui, + hf.ae_eq_condExp_limitProcess hui⟩ + obtain ⟨R,hR⟩ := hui.2 + exact (hf.submartingale.memLp_limitProcess hR).integrable le_rfl + +universe v4584_0 v4584_1 + +variable {Ω : Type v4584_0} {ι : Type v4584_1} [inst4584_0 : MeasurableSpace Ω] [inst4584_1 : Fintype ι] [inst4584_2 : DecidableEq ι] + {μ : Measure Ω} {G : Ω → Matrix ι ι ℂ} + +lemma integrable_matrix_of_entries (hG : ∀ i j, Integrable (fun ω => G ω i j) μ) : + Integrable G μ := by + have h : Integrable (fun ω i j => G ω i j) μ := + integrable_pi_iff.mpr (fun i => integrable_pi_iff.mpr (hG i)) + let L : (ι → ι → ℂ) →L[ℂ] Matrix ι ι ℂ := + LinearMap.toContinuousLinearMap (Matrix.ofLinearEquiv ℂ).toLinearMap + exact L.integrable_comp h + +lemma integral_matrix_entry (hG : Integrable G μ) (i j : ι) : + (∫ ω, G ω ∂μ) i j = ∫ ω, G ω i j ∂μ := by + let L : Matrix ι ι ℂ →L[ℂ] ℂ := (Matrix.entryLinearMap ℂ ℂ i j).toContinuousLinearMap + exact (L.integral_comp_comm hG).symm + +def positiveMatrixMeasureOfDensity (hG : ∀ i j, Integrable (fun ω => G ω i j) μ) + (hp : ∀ᵐ ω ∂μ, (G ω).PosSemidef) : PositiveMatrixMeasure Ω ι where + entry i j := μ.withDensityᵥ (fun ω => G ω i j) + positive S hS := by + have he : (fun i j => μ.withDensityᵥ (fun ω => G ω i j) S) = ∫ ω in S, G ω ∂μ := by + ext i j + rw [withDensityᵥ_apply (hG i j) hS, + integral_matrix_entry (integrable_matrix_of_entries hG).integrableOn] + rw [he] + exact (integral_nonneg_of_ae ((ae_restrict_of_ae hp).mono (fun _ h => h.nonneg))).posSemidef + +lemma positiveMatrixMeasureOfDensity_value + (hG : ∀ i j, Integrable (fun ω => G ω i j) μ) + (hp : ∀ᵐ ω ∂μ, (G ω).PosSemidef) (S : Set Ω) (hS : MeasurableSet S) : + (positiveMatrixMeasureOfDensity hG hp).value S = ∫ ω in S, G ω ∂μ := by + ext i j + change μ.withDensityᵥ (fun ω => G ω i j) S = _ + rw [withDensityᵥ_apply (hG i j) hS, + integral_matrix_entry (integrable_matrix_of_entries hG).integrableOn] + +end + +section + +open scoped ComplexOrder MatrixOrder Kronecker + +open Matrix + +universe v4714_0 v4714_1 v4714_2 + +variable {ι : Type v4714_0} {κ : Type v4714_1} {η : Type v4714_2} [inst4714_0 : Fintype ι] [inst4714_1 : Fintype κ] [inst4714_2 : Fintype η] + [inst4714_3 : DecidableEq ι] [inst4714_4 : DecidableEq κ] [inst4714_5 : DecidableEq η] + +def keepReference (U : Matrix (ι × η) (ι × η) ℂ) : Matrix η η ℂ := + fun x y => ∑ i, U (i,x) (i,y) + +def referenceFilter (K : Matrix κ η ℂ) (U : Matrix (ι × η) (ι × η) ℂ) : + Matrix (ι × κ) (ι × κ) ℂ := + ((1 : Matrix ι ι ℂ) ⊗ₖ K) * U * ((1 : Matrix ι ι ℂ) ⊗ₖ K)ᴴ + +omit inst4714_1 inst4714_4 inst4714_5 in +lemma referenceFilter_apply [Fintype κ] [DecidableEq κ] [DecidableEq η] (K : Matrix κ η ℂ) (U : Matrix (ι × η) (ι × η) ℂ) + (i j : ι) (x y : κ) : + referenceFilter K U (i,x) (j,y) = ∑ s, ∑ t, K x s * U (i,s) (j,t) * star (K y t) := by + simp only [referenceFilter,Matrix.conjTranspose_kronecker,Matrix.conjTranspose_one] + simp [Matrix.mul_apply,Fintype.sum_prod_type,Matrix.one_apply, + Matrix.conjTranspose_apply,Finset.sum_mul] + rw [Finset.sum_comm] + +lemma keepReference_filter (K : Matrix κ η ℂ) (U : Matrix (ι × η) (ι × η) ℂ) : + keepReference (referenceFilter K U) = K * keepReference U * Kᴴ := by + ext x y + simp only [keepReference,referenceFilter_apply,Matrix.mul_apply,Matrix.conjTranspose_apply] + simp_rw [Finset.mul_sum,Finset.sum_mul] + conv_rhs => rw [Finset.sum_comm] + rw [Finset.sum_comm] + apply Finset.sum_congr rfl; intro s _ + rw [Finset.sum_comm] + +def vectorize (S : Matrix ι η ℂ) : ι × η → ℂ := fun p => S p.1 p.2 + +omit inst4714_2 inst4714_3 inst4714_5 in +lemma keepReference_vectorize [Fintype η] [DecidableEq ι] [DecidableEq η] (S : Matrix ι η ℂ) : + keepReference (outer (vectorize S) (vectorize S)) = (Sᴴ*S)ᵀ := by + ext x y + simp only [keepReference,outer,vectorize,Matrix.transpose_apply,Matrix.mul_apply, + Matrix.conjTranspose_apply] + apply Finset.sum_congr rfl; intro i _; ring + +lemma referenceFilter_vectorize (K : Matrix κ η ℂ) (S : Matrix ι η ℂ) : + referenceFilter K (outer (vectorize S) (vectorize S)) = + outer (vectorize (S*Kᵀ)) (vectorize (S*Kᵀ)) := by + ext ⟨i,x⟩ ⟨j,y⟩ + rw [referenceFilter_apply] + simp only [outer,vectorize,Matrix.mul_apply,Matrix.transpose_apply,star_sum,star_mul] + simp_rw [Finset.mul_sum,Finset.sum_mul] + conv_rhs => rw [Finset.sum_comm] + apply Finset.sum_congr rfl; intro s _ + apply Finset.sum_congr rfl; intro t _ + ring + +def localProbe : ι × ι → ℂ := + vectorize (((Real.sqrt (Fintype.card ι : ℝ))⁻¹ : ℂ) • (1 : Matrix ι ι ℂ)) + +def canonicalPurification (R : Matrix ι ι ℂ) : ι × ι → ℂ := vectorize (CFC.sqrt R) + +def preparationFilter (R : Matrix ι ι ℂ) : Matrix ι ι ℂ := + (Real.sqrt (Fintype.card ι : ℝ) : ℂ) • (CFC.sqrt R)ᵀ + +lemma preparation_filter_identity [Nonempty ι] (R : Matrix ι ι ℂ) : + referenceFilter (preparationFilter R) (outer (localProbe (ι := ι)) localProbe) = + outer (canonicalPurification R) (canonicalPurification R) := by + unfold localProbe canonicalPurification preparationFilter + rw [referenceFilter_vectorize,Matrix.transpose_smul,Matrix.transpose_transpose, + Matrix.smul_mul,Matrix.mul_smul,one_mul,smul_smul] + have hc : (Real.sqrt (Fintype.card ι : ℝ) : ℂ) ≠ 0 := by + exact Complex.ofReal_ne_zero.mpr (Real.sqrt_pos.mpr (by exact_mod_cast Fintype.card_pos)).ne' + rw [inv_mul_cancel₀ hc,one_smul] + +lemma canonical_reference (R : Matrix ι ι ℂ) (hR : R.PosSemidef) : + keepReference (outer (canonicalPurification R) (canonicalPurification R)) = Rᵀ := by + rw [canonicalPurification,keepReference_vectorize, + (CFC.sqrt_nonneg R).posSemidef.isHermitian.eq,CFC.sqrt_mul_sqrt_self R hR.nonneg] + +end + +namespace PositiveMatrixMeasure + +section + +open MeasureTheory Matrix Filter + +open scoped ComplexOrder MatrixOrder + +universe v4860_0 v4860_1 + +variable {Ω : Type v4860_0} {ι : Type v4860_1} [inst4860_0 : MeasurableSpace Ω] [inst4860_1 : Fintype ι] [inst4860_2 : DecidableEq ι] + +def traceSigned (W : PositiveMatrixMeasure Ω ι) : SignedMeasure Ω := + ∑ i, (W.entry i i).re + +omit inst4860_2 in +lemma traceSigned_apply [DecidableEq ι] (W : PositiveMatrixMeasure Ω ι) (S : Set Ω) : + W.traceSigned S = (trace (W.value S)).re := by + simp [traceSigned,trace,value,ComplexMeasure.re_apply] + apply Finset.sum_congr rfl; intro i _; rfl + +lemma traceSigned_nonneg (W : PositiveMatrixMeasure Ω ι) : + (0 : SignedMeasure Ω) ≤[Set.univ] W.traceSigned := by + simpa only [VectorMeasure.restrict_univ] using (show (0 : SignedMeasure Ω) ≤ W.traceSigned from by + intro S hS + change 0 ≤ W.traceSigned S + rw [traceSigned_apply] + have hh : (0:ℂ) ≤ trace (W.value S) := (W.positive S hS).trace_nonneg + exact (RCLike.nonneg_iff.mp hh).1) + +def traceMeasure (W : PositiveMatrixMeasure Ω ι) : Measure Ω := + W.traceSigned.toMeasureOfZeroLE Set.univ MeasurableSet.univ (by + simpa only [VectorMeasure.restrict_univ] using + (show (0 : SignedMeasure Ω) ≤ W.traceSigned from by + intro S hS + have htrace : W.traceSigned S = (trace (W.value S)).re := by + simp [traceSigned, trace, value, ComplexMeasure.re_apply] + apply Finset.sum_congr rfl + intro i _ + rfl + change 0 ≤ W.traceSigned S + rw [htrace] + exact (RCLike.nonneg_iff.mp (W.positive S hS).trace_nonneg).1)) + +instance traceMeasure_finite (W : PositiveMatrixMeasure Ω ι) : IsFiniteMeasure W.traceMeasure := + inferInstanceAs (IsFiniteMeasure (W.traceSigned.toMeasureOfZeroLE Set.univ + MeasurableSet.univ W.traceSigned_nonneg)) + +lemma integrable_trace_density (W : PositiveMatrixMeasure Ω ι) (μ : Measure Ω) : + Integrable (fun t => trace (W.density μ t)) μ := by + exact integrable_finsetSum _ (fun i _ => W.integrable_entry μ i i) + +lemma integral_trace_density (W : PositiveMatrixMeasure Ω ι) (μ : Measure Ω) [SigmaFinite μ] + (hAC : ∀ S, MeasurableSet S → μ S=0 → W.value S=0) + (S : Set Ω) (hS : MeasurableSet S) : + (∫ t in S, trace (W.density μ t) ∂μ) = trace (W.value S) := by + unfold trace diag + rw [integral_finsetSum _ (fun i _ => (W.integrable_entry μ i i).integrableOn)] + apply Finset.sum_congr rfl; intro i _ + exact W.integral_density_entry μ hAC S hS i i + +universe v4989_0 + +def filter {κ : Type v4989_0} [Fintype κ] (W : PositiveMatrixMeasure Ω ι) (K : Matrix κ ι ℂ) : + PositiveMatrixMeasure Ω κ where + entry x y := ∑ i, ∑ j, (K x i * star (K y j)) • W.entry i j + positive S hS := by + have he : (fun x y => (∑ i, ∑ j, (K x i * star (K y j)) • W.entry i j) S) = + K * W.value S * Kᴴ := by + ext x y + simp only [_root_.sum_apply,_root_.smul_apply,Matrix.mul_apply, + Matrix.conjTranspose_apply,smul_eq_mul,Finset.sum_mul] + rw [Finset.sum_comm] + apply Finset.sum_congr rfl; intro i _ + apply Finset.sum_congr rfl; intro j _ + dsimp [value] + ring + rw [he] + exact (W.positive S hS).mul_mul_conjTranspose_same K + +universe v5006_0 + +omit inst4860_2 in +lemma filter_value [DecidableEq ι] {κ : Type v5006_0} [Fintype κ] (W : PositiveMatrixMeasure Ω ι) + (K : Matrix κ ι ℂ) (S : Set Ω) : (W.filter K).value S = K * W.value S * Kᴴ := by + ext x y + simp only [filter,value,_root_.sum_apply,_root_.smul_apply,Matrix.mul_apply, + Matrix.conjTranspose_apply,smul_eq_mul,Finset.sum_mul] + rw [Finset.sum_comm] + apply Finset.sum_congr rfl; intro i _ + apply Finset.sum_congr rfl; intro j _ + ring + +end + +open Matrix MeasureTheory + +open scoped ComplexOrder MatrixOrder Kronecker Matrix.Norms.L2Operator + +universe v5077_0 v5077_1 v5077_2 + +variable {O : Type v5077_0} {ι : Type v5077_1} {η : Type v5077_2} [inst5077_0 : MeasurableSpace O] [inst5077_1 : Fintype ι] [inst5077_2 : Fintype η] + [inst5077_3 : DecidableEq ι] [inst5077_4 : DecidableEq η] + +universe v5098_0 + +def pushforward {T : Type v5098_0} [MeasurableSpace T] (W : PositiveMatrixMeasure O η) + (f : O → T) (hf : Measurable f) : PositiveMatrixMeasure T η where + entry i j := (W.entry i j).map f + positive S hS := by + simpa only [VectorMeasure.map_apply _ hf hS] using W.positive (f ⁻¹' S) (hf hS) + +universe v5104_0 + +omit inst5077_4 in +lemma pushforward_value [DecidableEq η] {T : Type v5104_0} [MeasurableSpace T] (W : PositiveMatrixMeasure O η) + (f : O → T) (hf : Measurable f) (S : Set T) (hS : MeasurableSet S) : + (W.pushforward f hf).value S = W.value (f ⁻¹' S) := by + ext i j; exact VectorMeasure.map_apply _ hf hS + +end PositiveMatrixMeasure + +section + +open Matrix MeasureTheory ProbabilityTheory Filter + +open scoped ComplexOrder MatrixOrder Matrix.Norms.L2Operator + +universe v5273_0 + +variable {O : Type v5273_0} [inst5273_0 : MeasurableSpace O] + +def historyPrefix (n : ℕ) (x : ℕ → O) : Fin n → O := fun i => x i + +lemma measurable_historyPrefix (n : ℕ) : Measurable (historyPrefix (O := O) n) := by + unfold historyPrefix + fun_prop + +def historyFiltration : Filtration ℕ (inferInstance : MeasurableSpace (ℕ → O)) where + seq n := MeasurableSpace.comap (historyPrefix n) inferInstance + mono' := by + intro n k hnk + apply MeasurableSpace.comap_le_iff_le_map.mpr + intro S hS + change MeasurableSet[MeasurableSpace.comap (historyPrefix k) inferInstance] + (historyPrefix n ⁻¹' S) + refine ⟨(fun s : Fin k → O => fun i : Fin n => s (Fin.castLE hnk i)) ⁻¹' S, + (show Measurable (fun s : Fin k → O => fun i : Fin n => s (Fin.castLE hnk i)) by fun_prop) hS,?_⟩ + rfl + le' n := (show Measurable (historyPrefix (O := O) n) by unfold historyPrefix; fun_prop).comap_le + +lemma historyPrefix_adapted (n : ℕ) : + Measurable[(historyFiltration (O := O)) n] (historyPrefix (O := O) n) := + Measurable.of_comap_le le_rfl + +lemma historyFiltration_generates : + (inferInstance : MeasurableSpace (ℕ → O)) = ⨆ n, historyFiltration (O := O) n := by + apply le_antisymm + · change (⨆ k : ℕ, MeasurableSpace.comap (fun x : ℕ → O => x k) inferInstance) ≤ _ + apply iSup_le + intro k + apply le_iSup_of_le (k+1) + have hk := (measurable_pi_apply (⟨k,Nat.lt_succ_self k⟩ : Fin (k+1))).comp + (historyPrefix_adapted (O := O) (k+1)) + exact hk.comap_le + · exact iSup_le (fun n => (historyFiltration (O := O)).le n) + +universe v5311_0 + +variable {ι : Type v5311_0} [inst5311_0 : Fintype ι] [inst5311_1 : DecidableEq ι] + +universe v5313_0 + +lemma density_entry_bound {Ω : Type v5313_0} [MeasurableSpace Ω] + (U : Ω → Matrix ι ι ℂ) (hU : ∀ x, Density (U x)) (i j : ι) (x : Ω) : + ‖U x i j‖ ≤ 1 := by + have h := psd_entry_norm_le_trace (hU x).1 i j + simpa only [(hU x).2,Complex.one_re] using h + +universe v5319_0 + +lemma integrable_density_entry {Ω : Type v5319_0} [MeasurableSpace Ω] + (U : Ω → Matrix ι ι ℂ) (hU : ∀ x, Density (U x)) (hm : Measurable U) + (μ : Measure Ω) [IsFiniteMeasure μ] (i j : ι) : + Integrable (fun x => U x i j) μ := by + let L : Matrix ι ι ℂ →L[ℂ] ℂ := (Matrix.entryLinearMap ℂ ℂ i j).toContinuousLinearMap + exact Integrable.of_bound (L.continuous.measurable.comp hm).aestronglyMeasurable 1 + (Filter.Eventually.of_forall (density_entry_bound U hU i j)) + +variable (P : Measure (ℕ → O)) [inst5327_0 : IsProbabilityMeasure P] + (K : (n : ℕ) → Kernel (Fin n → O) O) [inst5327_1 : ∀ n, IsMarkovKernel (K n)] + (hP : ∀ n, P.map (historyPrefix (n+1)) = + ((P.map (historyPrefix n)) ⊗ₘ K n).map + (fun pair : (Fin n → O) × O => Fin.snoc (α := fun _ : Fin (n+1) => O) pair.1 pair.2)) + (U : (n : ℕ) → (Fin n → O) → Matrix ι ι ℂ) + (hU : ∀ n s, Density (U n s)) (hm : ∀ n, Measurable (U n)) + (hmean : ∀ n s i j, + (∫ o, U (n+1) (Fin.snoc (α := fun _ : Fin (n+1) => O) s o) i j ∂K n s) = U n s i j) + +include hP hU hm hmean in +lemma reference_history_step_integral (n : ℕ) (S : Set (ℕ → O)) + (hS : MeasurableSet[historyFiltration n] S) (i j : ι) : + (∫ x in S, U (n+1) (historyPrefix (n+1) x) i j ∂P) = + ∫ x in S, U n (historyPrefix n x) i j ∂P := by + classical + obtain ⟨A,hA,rfl⟩ := hS + let r : (Fin (n+1) → O) → (Fin n → O) := fun s i => s i.castSucc + have hr : Measurable r := by fun_prop + let snoc : (Fin n → O) × O → (Fin (n+1) → O) := fun s => Fin.snoc s.1 s.2 + have hs : Measurable snoc := by + apply Measurable.of_eval + intro i + refine Fin.lastCases ?_ (fun j => ?_) i + · simpa [snoc] using measurable_snd + · simpa only [snoc, Fin.snoc_castSucc, Function.comp_def] using ((measurable_pi_apply j).comp measurable_fst) + let f : (Fin (n+1) → O) → ℂ := (r ⁻¹' A).indicator (fun s => U (n+1) s i j) + let g : (Fin n → O) → ℂ := A.indicator (fun s => U n s i j) + let L : Matrix ι ι ℂ →L[ℂ] ℂ := (Matrix.entryLinearMap ℂ ℂ i j).toContinuousLinearMap + have hf : Measurable f := (L.continuous.measurable.comp (hm (n+1))).indicator (hr hA) + have hg : Measurable g := (L.continuous.measurable.comp (hm n)).indicator hA + have hfi : Integrable (fun s => f (snoc s)) ((P.map (historyPrefix n)) ⊗ₘ K n) := by + apply Integrable.of_bound (hf.comp hs).aestronglyMeasurable 1 + apply Filter.Eventually.of_forall + intro s + exact (norm_indicator_le_norm_self (s := r ⁻¹' A) (fun t => U (n+1) t i j) (snoc s)).trans (density_entry_bound (U (n+1)) (hU (n+1)) i j _) + have he (s : Fin n → O) : (∫ o, f (snoc (s,o)) ∂K n s) = g s := by + have hh (o : O) : f (snoc (s,o)) = + if s ∈ A then U (n+1) (Fin.snoc s o) i j else 0 := by + simp only [f,Set.indicator,Set.mem_preimage,r,snoc] + have ht : (fun i : Fin n => Fin.snoc (α := fun _ : Fin (n+1) => O) s o i.castSucc) = s := by + ext i; simp + rw [ht] + simp_rw [hh] + by_cases h : s ∈ A + · simp only [h,ite_true,g,Set.indicator_of_mem] + exact hmean n s i j + · simp [h,g] + calc + _ = ∫ x, f (historyPrefix (n+1) x) ∂P := by + rw [← integral_indicator ((measurable_historyPrefix n) hA)] + congr 1 + _ = ∫ s, f s ∂P.map (historyPrefix (n+1)) := + (integral_map (measurable_historyPrefix _).aemeasurable hf.aestronglyMeasurable).symm + _ = ∫ s, f s ∂(((P.map (historyPrefix n)) ⊗ₘ K n).map snoc) := by rw [hP n] + _ = ∫ s, f (snoc s) ∂((P.map (historyPrefix n)) ⊗ₘ K n) := + integral_map hs.aemeasurable hf.aestronglyMeasurable + _ = ∫ s, ∫ o, f (snoc (s,o)) ∂K n s ∂P.map (historyPrefix n) := + MeasureTheory.Measure.integral_compProd hfi + _ = ∫ s, g s ∂P.map (historyPrefix n) := by simp_rw [he] + _ = ∫ x, g (historyPrefix n x) ∂P := + integral_map (measurable_historyPrefix n).aemeasurable hg.aestronglyMeasurable + _ = _ := by + rw [← integral_indicator ((measurable_historyPrefix n) hA)] + rfl + +include hP hU hm hmean in +lemma reference_history_integral (n k : ℕ) (hnk : n ≤ k) (S : Set (ℕ → O)) + (hS : MeasurableSet[historyFiltration n] S) (i j : ι) : + (∫ x in S, U k (historyPrefix k x) i j ∂P) = + ∫ x in S, U n (historyPrefix n x) i j ∂P := by + induction k, hnk using Nat.le_induction with + | base => rfl + | succ k hnk ih => + rw [reference_history_step_integral P K hP U hU hm hmean k S + (((historyFiltration (O := O)).mono hnk) S hS) i j] + exact ih + +omit inst5311_1 in +lemma reference_history_measurable [DecidableEq ι] (n : ℕ) (i j : ι) (hm : ∀ n, Measurable (U n)) : + Measurable[historyFiltration n] (fun x => U n (historyPrefix n x) i j) := by + let L : Matrix ι ι ℂ →L[ℂ] ℂ := (Matrix.entryLinearMap ℂ ℂ i j).toContinuousLinearMap + exact L.continuous.measurable.comp ((hm n).comp (historyPrefix_adapted n)) + +lemma reference_history_integrable (n : ℕ) (i j : ι) (hU : ∀ n s, Density (U n s)) + (hm : ∀ n, Measurable (U n)) : + Integrable (fun x => U n (historyPrefix n x) i j) P := by + exact integrable_density_entry (fun x => U n (historyPrefix n x)) + (fun x => hU n _) ((hm n).comp (measurable_historyPrefix n)) P i j + +include hP hU hm hmean in +lemma reference_history_martingale_re (i j : ι) : + Martingale (fun n x => (U n (historyPrefix n x) i j).re) historyFiltration P := by + refine ⟨fun n => ((reference_history_measurable U n i j hm).re).stronglyMeasurable, ?_⟩ + intro n k hnk + symm + apply ae_eq_condExp_of_forall_setIntegral_eq (historyFiltration.le n) + ((reference_history_integrable P U k i j hU hm).re) + · intro S _ _ + exact (reference_history_integrable P U n i j hU hm).re.integrableOn + · intro S hS _ + change (∫ x in S, RCLike.re (U n (historyPrefix n x) i j) ∂P) = _ + rw [integral_re (reference_history_integrable P U n i j hU hm).integrableOn, + integral_re (reference_history_integrable P U k i j hU hm).integrableOn, + reference_history_integral P K hP U hU hm hmean n k hnk S hS i j] + · exact ((reference_history_measurable U n i j hm).re).stronglyMeasurable.aestronglyMeasurable + +include hP hU hm hmean in +lemma reference_history_martingale_im (i j : ι) : + Martingale (fun n x => (U n (historyPrefix n x) i j).im) historyFiltration P := by + refine ⟨fun n => ((reference_history_measurable U n i j hm).im).stronglyMeasurable, ?_⟩ + intro n k hnk + symm + apply ae_eq_condExp_of_forall_setIntegral_eq (historyFiltration.le n) + ((reference_history_integrable P U k i j hU hm).im) + · intro S _ _ + exact (reference_history_integrable P U n i j hU hm).im.integrableOn + · intro S hS _ + change (∫ x in S, RCLike.im (U n (historyPrefix n x) i j) ∂P) = _ + rw [integral_im (reference_history_integrable P U n i j hU hm).integrableOn, + integral_im (reference_history_integrable P U k i j hU hm).integrableOn, + reference_history_integral P K hP U hU hm hmean n k hnk S hS i j] + · exact ((reference_history_measurable U n i j hm).im).stronglyMeasurable.aestronglyMeasurable + +end + +open MeasureTheory ProbabilityTheory Matrix Filter + +open scoped ComplexOrder MatrixOrder Matrix.Norms.L2Operator Topology + +universe v5486_0 v5486_1 + +variable {Ω : Type v5486_0} {ι : Type v5486_1} {L : MeasurableSpace Ω} {mΩ : MeasurableSpace Ω} + [inst5486_0 : Fintype ι] [inst5486_1 : DecidableEq ι] {μ : Measure Ω} [inst5486_2 : IsFiniteMeasure μ] + {F : Filtration ℕ mΩ} + +theorem local_reference_limit + (W : ℕ → Ω → Matrix ι ι ℂ) + (hW : ∀ n x, Density (W n x)) + (hlocal : ∀ n, Measurable[L] (W n)) + (hL : L ≤ mΩ) + (hr : ∀ i j, Martingale (fun n x => (W n x i j).re) F μ) + (hi : ∀ i j, Martingale (fun n x => (W n x i j).im) F μ) : + ∃ G : Ω → Matrix ι ι ℂ, + Measurable[L] G ∧ (∀ x, Density (G x)) ∧ + (∀ i j, Integrable (fun x => G x i j) μ) ∧ + (∀ᵐ x ∂μ, Tendsto (fun n => W n x) atTop (𝓝 (G x))) ∧ + (∀ n S, MeasurableSet[F n] S → + (∫ x in S, G x ∂μ) = ∫ x in S, W n x ∂μ) := by + classical + have hbound (n : ℕ) (i j : ι) (x : Ω) : ‖W n x i j‖ ≤ 1 := by + simpa only [(hW n x).2, Complex.one_re] using + psd_entry_norm_le_trace (hW n x).1 i j + have hbr (i j : ι) (n : ℕ) : ∀ᵐ x ∂μ, ‖(W n x i j).re‖ ≤ 1 := + Filter.Eventually.of_forall (fun x => + (show ‖(W n x i j).re‖ ≤ ‖W n x i j‖ from by + simpa only [Real.norm_eq_abs] using Complex.abs_re_le_norm (W n x i j)).trans + (hbound n i j x)) + have hbi (i j : ι) (n : ℕ) : ∀ᵐ x ∂μ, ‖(W n x i j).im‖ ≤ 1 := + Filter.Eventually.of_forall (fun x => + (show ‖(W n x i j).im‖ ≤ ‖W n x i j‖ from by + simpa only [Real.norm_eq_abs] using Complex.abs_im_le_norm (W n x i j)).trans + (hbound n i j x)) + choose gr hgr htr hcr using (fun i j => bounded_martingale_limit (hr i j) (hbr i j)) + choose gi hgi hti hci using (fun i j => bounded_martingale_limit (hi i j) (hbi i j)) + let H : Ω → Matrix ι ι ℂ := fun x i j => (gr i j x : ℂ) + (gi i j x : ℂ)*Complex.I + have hH (i j : ι) : Integrable (fun x => H x i j) μ := + ((hgr i j).ofReal).add (((hgi i j).ofReal).mul_const Complex.I) + have hlimH : ∀ᵐ x ∂μ, Tendsto (fun n => W n x) atTop (𝓝 (H x)) := by + have htr' := ae_all_iff.mpr (fun i => ae_all_iff.mpr (htr i)) + have hti' := ae_all_iff.mpr (fun i => ae_all_iff.mpr (hti i)) + filter_upwards [htr', hti'] with x hx hy + have hc : Tendsto (fun n i j => W n x i j) atTop (𝓝 (fun i j => H x i j)) := by + apply tendsto_pi_nhds.mpr; intro i + apply tendsto_pi_nhds.mpr; intro j + have hh := (Complex.continuous_ofReal.continuousAt.tendsto.comp (hx i j)).add + ((Complex.continuous_ofReal.continuousAt.tendsto.comp (hy i j)).mul_const Complex.I) + simpa only [Function.comp_apply, Pi.add_apply, Complex.re_add_im] using hh + have hcM : Continuous (Matrix.of : (ι → ι → ℂ) → Matrix ι ι ℂ) := + continuous_matrix (fun i j => continuous_apply_apply i j) + exact hcM.continuousAt.tendsto.comp hc + let raw : Ω → Matrix ι ι ℂ := fun x => limUnder atTop (fun n => W n x) + have hraw : Measurable[L] raw := + (@StronglyMeasurable.limUnder ℕ Ω (Matrix ι ι ℂ) L _ _ atTop _ _ _ _ + (fun n => (hlocal n).stronglyMeasurable)).measurable + have hgood : MeasurableSet[L] {x | 0 ≤ raw x ∧ trace (raw x) = 1} := by + exact (measurableSet_le measurable_const hraw).inter + (measurableSet_eq_fun ((Matrix.traceLinearMap ι ℂ ℂ).toContinuousLinearMap.continuous.measurable.comp hraw) measurable_const) + let G : Ω → Matrix ι ι ℂ := fun x => + if 0 ≤ raw x ∧ trace (raw x) = 1 then raw x else W 0 x + have hGm : Measurable[L] G := hraw.ite hgood (hlocal 0) + have hGp (x : Ω) : Density (G x) := by + dsimp [G] + split + · rename_i h + exact ⟨h.1.posSemidef, h.2⟩ + · exact hW 0 x + have hGH : G =ᵐ[μ] H := by + filter_upwards [hlimH] with x hx + have hrx : raw x = H x := hx.limUnder_eq + have hp : 0 ≤ H x := + isClosed_Ici.mem_of_tendsto hx (Eventually.of_forall (fun n => (hW n x).1.nonneg)) + have ht : trace (H x) = 1 := by + have htend := (Matrix.traceLinearMap ι ℂ ℂ).toContinuousLinearMap.continuous.continuousAt.tendsto.comp hx + have he : (fun n => trace (W n x)) = fun _ => (1 : ℂ) := funext (fun n => (hW n x).2) + change Tendsto (fun n => trace (W n x)) atTop (𝓝 (trace (H x))) at htend + rw [he] at htend + exact tendsto_nhds_unique htend tendsto_const_nhds + simp only [G, hrx, hp, ht, and_self, ↓reduceIte] + have hGi (i j : ι) : Integrable (fun x => G x i j) μ := + (hH i j).congr (hGH.mono (fun x hx => congrArg (fun M => M i j) hx.symm)) + refine ⟨G,hGm,hGp,hGi,?_,?_⟩ + · filter_upwards [hlimH,hGH] with x hx he + simpa only [he] using hx + · intro n S hS + have hc (i j : ι) : Integrable (fun x => W n x i j) μ := + Integrable.of_bound (((Matrix.entryLinearMap ℂ ℂ i j).toContinuousLinearMap).measurable.comp + ((hlocal n).mono hL le_rfl)).aestronglyMeasurable 1 + (Eventually.of_forall (hbound n i j)) + ext i j + rw [integral_matrix_entry (integrable_matrix_of_entries hGi).integrableOn, + integral_matrix_entry (integrable_matrix_of_entries hc).integrableOn] + calc + _ = ∫ x in S, H x i j ∂μ := integral_congr_ae + (ae_restrict_of_ae (hGH.mono (fun x hx => congrArg (fun M => M i j) hx))) + _ = ∫ x in S, W n x i j ∂μ := by + apply Complex.ext + · change RCLike.re (∫ x in S, H x i j ∂μ) = RCLike.re (∫ x in S, W n x i j ∂μ) + rw [← integral_re (hH i j).integrableOn, ← integral_re (hc i j).integrableOn] + have heH : (fun x => RCLike.re (H x i j)) = gr i j := by + funext x; simp [H] + rw [heH, ← setIntegral_condExp (F.le n) (hgr i j) hS] + exact integral_congr_ae (ae_restrict_of_ae (hcr i j n).symm) + · change RCLike.im (∫ x in S, H x i j ∂μ) = RCLike.im (∫ x in S, W n x i j ∂μ) + rw [← integral_im (hH i j).integrableOn, ← integral_im (hc i j).integrableOn] + have heH : (fun x => RCLike.im (H x i j)) = gi i j := by + funext x; simp [H] + rw [heH, ← setIntegral_condExp (F.le n) (hgi i j) hS] + exact integral_congr_ae (ae_restrict_of_ae (hci i j n).symm) + +end ZeroKey + +namespace UnrestrictedQuantum + +open Matrix MeasureTheory ProbabilityTheory + +open scoped ComplexOrder MatrixOrder Matrix.Norms.L2Operator Kronecker + +universe v5616_0 v5616_1 + +abbrev LocalHistory (O : Type v5616_0) (M : Type v5616_1) (n : ℕ) := + (Fin n → (O ⊕ Unit)) × (Fin n → M) + +universe v5619_0 v5619_1 + +def localActive {O : Type v5619_0} {M : Type v5619_1} {n : ℕ} (h : LocalHistory O M n) (o : O) (m : M) : + LocalHistory O M (n+1) := + (Fin.snoc h.1 (Sum.inl o), Fin.snoc h.2 m) + +universe v5623_0 v5623_1 + +def localPassive {O : Type v5623_0} {M : Type v5623_1} {n : ℕ} (h : LocalHistory O M n) (m : M) : + LocalHistory O M (n+1) := + (Fin.snoc h.1 (Sum.inr ()), Fin.snoc h.2 m) + +universe v5628_0 v5628_1 v5628_2 v5628_3 + +variable {O : Type v5628_0} {M : Type v5628_1} {ι : Type v5628_2} [inst5628_0 : MeasurableSpace O] [inst5628_1 : MeasurableSpace M] + [inst5628_2 : Fintype ι] [inst5628_3 : DecidableEq ι] + (A : ℕ → Type v5628_3) [inst5628_4 : ∀ n, AddCommGroup (A n)] [inst5628_5 : ∀ n, Module ℂ (A n)] + [inst5628_6 : ∀ n, One (A n)] [inst5628_7 : ∀ n, LE (A n)] + (κ : (n : ℕ) → Kernel (LocalHistory O M n) O) + (send : (n : ℕ) → (LocalHistory O M n) × O → M) + +structure LocalObservableExecution where + state : (n : ℕ) → LocalHistory O M n → ReferenceFunctional (A n) ι + positive_state : ∀ n h, PositiveFunctional (state n h) + positive_unit : ∀ n, (0 : A n) ≤ 1 + normalized : ∀ n h, trace (state n h 1) = 1 + measurable_reference : ∀ n, Measurable (fun h => state n h 1) + instrument : (n : ℕ) → (h : LocalHistory O M n) → ObservableInstrument O (A n) (A (n+1)) + run : ∀ n h, InstrumentRun (instrument n h) (state n h) + run_law : ∀ n h, (run n h).law = κ n h + active_update : ∀ n h, + (fun o => state (n+1) (localActive h o (send n (h,o)))) =ᵐ[κ n h] (run n h).posterior + receive : (n : ℕ) → LocalHistory O M n → M → (A (n+1) →ₗ[ℂ] A n) + receive_positive : ∀ n h m x, 0 ≤ x → 0 ≤ receive n h m x + receive_unit : ∀ n h m, receive n h m 1 = 1 + passive_update : ∀ n h m, + state (n+1) (localPassive h m) = (state n h).comp (receive n h m) + +namespace LocalObservableExecution + +variable {A κ send} (e : LocalObservableExecution (ι := ι) A κ send) + +def reference (n : ℕ) (h : LocalHistory O M n) : Matrix ι ι ℂ := e.state n h 1 + +omit inst5628_3 in +lemma reference_density [DecidableEq ι] (n : ℕ) (h : LocalHistory O M n) : + ZeroKey.Density (e.reference n h) := + ⟨e.positive_state n h 1 (e.positive_unit n), e.normalized n h⟩ + +omit inst5628_3 in +lemma reference_measurable [DecidableEq ι] (n : ℕ) : Measurable (e.reference n) := e.measurable_reference n + +lemma active_mean (n : ℕ) (h : LocalHistory O M n) (i j : ι) : + (∫ o, e.reference (n+1) (localActive h o (send n (h,o))) i j ∂κ n h) = + e.reference n h i j := by + calc + _ = ∫ o, (e.run n h).posterior o 1 i j ∂κ n h := by + apply integral_congr_ae + filter_upwards [e.active_update n h] with o ho + exact congrArg (fun S : ReferenceFunctional (A (n+1)) ι => S 1 i j) ho + _ = _ := by + rw [← e.run_law] + exact InstrumentRun.reference_mean (e.instrument n h) (e.state n h) (e.run n h) i j + +omit inst5628_3 in +lemma passive_reference [DecidableEq ι] (n : ℕ) (h : LocalHistory O M n) (m : M) : + e.reference (n+1) (localPassive h m) = e.reference n h := by + simp only [reference,e.passive_update,LinearMap.comp_apply,e.receive_unit] + +end LocalObservableExecution + +end UnrestrictedQuantum + +namespace ZeroKey + +section + +open MeasureTheory ProbabilityTheory + +universe v5828_0 v5828_1 + +theorem condIndep_adaptive_public_message {Ω : Type v5828_0} {M : Type v5828_1} + {mΩ : MeasurableSpace Ω} [StandardBorelSpace Ω] [MeasurableSpace M] + {P : Measure Ω} [IsFiniteMeasure P] + {C A B : MeasurableSpace Ω} + (hC : C ≤ mΩ) (hA : A ≤ mΩ) (hB : B ≤ mΩ) + (h : CondIndep C A B hC P) + (q : Ω → Bool) (a b : Ω → M) (d : M) + (hq : @Measurable Ω Bool C _ q) + (ha : @Measurable Ω M (A ⊔ C) _ a) + (hb : @Measurable Ω M (B ⊔ C) _ b) : + let message := fun x => if q x then a x else b x + let N := C ⊔ MeasurableSpace.comap message inferInstance + CondIndep N A B (sup_le hC ((ha.mono (sup_le hA hC) le_rfl).ite + ((measurableSet_singleton true).preimage (hq.mono hC le_rfl)) + (hb.mono (sup_le hB hC) le_rfl)).comap_le) P := by + let left := fun x => if q x then a x else d + let right := fun x => if q x then d else b x + let NA := C ⊔ MeasurableSpace.comap left inferInstance + let NB := NA ⊔ MeasurableSpace.comap right inferInstance + let g := fun x => if q x then a x else b x + let N := C ⊔ MeasurableSpace.comap g inferInstance + have hqset : MeasurableSet[C] {x | q x = true} := hq (measurableSet_singleton true) + have hleft : @Measurable Ω M (A ⊔ C) _ left := + ha.ite ((show C ≤ A ⊔ C from le_sup_right) _ hqset) measurable_const + have hCA : C ≤ NA := le_sup_left + have hNAA : NA ≤ A ⊔ C := sup_le le_sup_right hleft.comap_le + have hNAM : NA ≤ mΩ := hNAA.trans (sup_le hA hC) + have h₁ : CondIndep NA A B hNAM P := condIndep_local_message hC hA hB hCA hNAA h + have hright : @Measurable Ω M (B ⊔ NA) _ right := + measurable_const.ite ((hCA.trans le_sup_right) _ hqset) + (hb.mono (sup_le_sup_left hCA B) le_rfl) + have hNBB : NB ≤ B ⊔ NA := sup_le le_sup_right hright.comap_le + have hNBM : NB ≤ mΩ := hNBB.trans (sup_le hB hNAM) + have h₂ : CondIndep NB A B hNBM P := + (condIndep_local_message hNAM hB hA le_sup_left hNBB h₁.symm).symm + have hCN : C ≤ N := le_sup_left + have hgN : @Measurable Ω M N _ g := Measurable.of_comap_le le_sup_right + have hlN : @Measurable Ω M N _ left := by + have hh : @Measurable Ω M N _ (fun x => if q x then g x else d) := + hgN.ite (hCN _ hqset) measurable_const + convert hh using 1 + ext x + cases hqx : q x <;> simp [left,g,hqx] + have hrN : @Measurable Ω M N _ right := by + have hh : @Measurable Ω M N _ (fun x => if q x then d else g x) := + measurable_const.ite (hCN _ hqset) hgN + convert hh using 1 + ext x + cases hqx : q x <;> simp [right,g,hqx] + have hNBN : NB ≤ N := sup_le (sup_le hCN hlN.comap_le) hrN.comap_le + have hCNB : C ≤ NB := le_sup_left.trans le_sup_left + have hlNB : @Measurable Ω M NB _ left := + Measurable.of_comap_le (le_sup_right.trans le_sup_left) + have hrNB : @Measurable Ω M NB _ right := Measurable.of_comap_le le_sup_right + have hgNB : @Measurable Ω M NB _ g := by + have hh : @Measurable Ω M NB _ (fun x => if q x then left x else right x) := + hlNB.ite (hCNB _ hqset) hrNB + convert hh using 1 + ext x + cases hqx : q x <;> simp [left,right,g,hqx] + have he : NB = N := le_antisymm hNBN (sup_le hCNB hgNB.comap_le) + simpa only [he] using h₂ + +open MeasureTheory ProbabilityTheory + +universe v5898_0 v5898_1 + +theorem adaptive_tapes_given_full_transcript {Ω : Type v5898_0} {M : Type v5898_1} + {mΩ : MeasurableSpace Ω} [StandardBorelSpace Ω] [MeasurableSpace M] + {P : Measure Ω} [IsFiniteMeasure P] + (F : Filtration ℕ mΩ) (A B : MeasurableSpace Ω) + (hA : A ≤ mΩ) (hB : B ≤ mΩ) + (hinitial : CondIndep (F 0) A B (F.le 0) P) + (q : ℕ → Ω → Bool) (a b : ℕ → Ω → M) (d : M) + (hq : ∀ n, @Measurable Ω Bool (F n) _ (q n)) + (ha : ∀ n, @Measurable Ω M (A ⊔ F n) _ (a n)) + (hb : ∀ n, @Measurable Ω M (B ⊔ F n) _ (b n)) + (hF : ∀ n, F (n+1) = F n ⊔ MeasurableSpace.comap + (fun x => if q n x then a n x else b n x) inferInstance) : + CondIndep (⨆ n, F n) (A ⊔ ⨆ n, F n) (B ⊔ ⨆ n, F n) + (iSup_le F.le) P := by + have hfinite : ∀ n, CondIndep (F n) A B (F.le n) P := by + intro n + induction n with + | zero => exact hinitial + | succ n ih => + have h := condIndep_adaptive_public_message (F.le n) hA hB ih + (q n) (a n) (b n) d (hq n) (ha n) (hb n) + simpa only [hF n] using h + have h := condIndep_full_transcript F A B hA hB hfinite + have hC := iSup_le F.le + have h1 := (condIndep_join_public_right hC hB hA h.symm).symm + exact condIndep_join_public_right hC (sup_le hA hC) hB h1 + +universe v5935_0 v5935_1 v5935_2 + +structure AdaptiveTapeProgram (U : Type v5935_0) (V : Type v5935_1) (M : Type v5935_2) [MeasurableSpace U] + [MeasurableSpace V] [MeasurableSpace M] where + alice : (n : ℕ) → (Fin n → M) → Bool + measAlice : ∀ n, Measurable (alice n) + sendA : (n : ℕ) → U × (Fin n → M) → M + sendB : (n : ℕ) → V × (Fin n → M) → M + measA : ∀ n, Measurable (sendA n) + measB : ∀ n, Measurable (sendB n) + +namespace AdaptiveTapeProgram + +universe v5945_0 v5945_1 v5945_2 + +variable {U : Type v5945_0} {V : Type v5945_1} {M : Type v5945_2} [inst5945_0 : MeasurableSpace U] [inst5945_1 : MeasurableSpace V] [inst5945_2 : MeasurableSpace M] + (p : AdaptiveTapeProgram U V M) + +def publicPrefix : (n : ℕ) → U × V → (Fin n → M) + | 0, _ => Fin.elim0 + | n+1, ω => Fin.snoc (publicPrefix n ω) + (if p.alice n (publicPrefix n ω) then p.sendA n (ω.1,publicPrefix n ω) else p.sendB n (ω.2,publicPrefix n ω)) + +def message (n : ℕ) (ω : U × V) : M := + if p.alice n (p.publicPrefix n ω) then p.sendA n (ω.1,p.publicPrefix n ω) else p.sendB n (ω.2,p.publicPrefix n ω) + +lemma prefix_succ (n : ℕ) (ω : U × V) : + p.publicPrefix (n+1) ω = Fin.snoc (p.publicPrefix n ω) (p.message n ω) := rfl + +lemma measurable_prefix : ∀ n, Measurable (p.publicPrefix n) := by + intro n + induction n with + | zero => exact Measurable.of_eval (fun i => Fin.elim0 i) + | succ n ih => + apply Measurable.of_eval + intro i + refine Fin.lastCases ?_ (fun j => ?_) i + · simp only [publicPrefix, Fin.snoc_last] + exact ((p.measA n).comp (measurable_fst.prodMk ih)).ite + ((measurableSet_singleton true).preimage ((p.measAlice n).comp ih)) + ((p.measB n).comp (measurable_snd.prodMk ih)) + · simpa only [publicPrefix, Fin.snoc_castSucc] using ih.eval (a := j) + +lemma measurable_message (n : ℕ) : Measurable (p.message n) := by + exact ((p.measA n).comp (measurable_fst.prodMk (p.measurable_prefix n))).ite + ((measurableSet_singleton true).preimage ((p.measAlice n).comp (p.measurable_prefix n))) + ((p.measB n).comp (measurable_snd.prodMk (p.measurable_prefix n))) + +abbrev field (n : ℕ) : MeasurableSpace (U × V) := + MeasurableSpace.comap (p.publicPrefix n) inferInstance + +lemma field_le (n : ℕ) : p.field n ≤ (inferInstance : MeasurableSpace (U × V)) := (p.measurable_prefix n).comap_le + +lemma field_mono : Monotone p.field := by + apply monotone_nat_of_le_succ + intro n + have h : @Measurable (U × V) (Fin n → M) (p.field (n+1)) _ (p.publicPrefix n) := by + let : MeasurableSpace (U × V) := p.field (n+1) + apply Measurable.of_eval + intro i + have hh := (@Measurable.of_comap_le (U × V) (Fin (n+1) → M) + (p.field (n+1)) _ (p.publicPrefix (n+1)) le_rfl).eval (a := i.castSucc) + simpa only [publicPrefix, Fin.snoc_castSucc] using hh + exact h.comap_le + +def filtration : Filtration ℕ (inferInstance : MeasurableSpace (U × V)) where + seq := p.field + mono' := p.field_mono + le' := p.field_le + +lemma field_zero : p.field 0 = ⊥ := by + exact MeasurableSpace.comap_const Fin.elim0 + +lemma field_succ (n : ℕ) : + p.field (n+1) = p.field n ⊔ MeasurableSpace.comap (p.message n) inferInstance := by + apply le_antisymm + · let : MeasurableSpace (U × V) := p.field n ⊔ MeasurableSpace.comap (p.message n) inferInstance + apply Measurable.comap_le + apply Measurable.of_eval + intro i + refine Fin.lastCases ?_ (fun j => ?_) i + · simpa only [prefix_succ,Fin.snoc_last] using + (Measurable.of_comap_le (f := p.message n) le_sup_right) + · simpa only [prefix_succ,Fin.snoc_castSucc,field] using + (Measurable.of_comap_le (f := p.publicPrefix n) le_sup_left).eval (a := j) + · apply sup_le (p.field_mono (Nat.le_succ n)) + let : MeasurableSpace (U × V) := p.field (n+1) + have h := (@Measurable.of_comap_le (U × V) (Fin (n+1) → M) + (p.field (n+1)) _ (p.publicPrefix (n+1)) le_rfl).eval (a := Fin.last n) + have hh : Measurable[p.field (n+1)] (p.message n) := by + simpa only [prefix_succ,Fin.snoc_last] using h + exact hh.comap_le + +theorem tapes_conditionally_independent [StandardBorelSpace U] [StandardBorelSpace V] + [Nonempty M] + (μ : Measure U) (ν : Measure V) [IsProbabilityMeasure μ] [IsProbabilityMeasure ν] : + CondIndep (⨆ n, p.field n) + (MeasurableSpace.comap Prod.fst ‹MeasurableSpace U› ⊔ ⨆ n, p.field n) + (MeasurableSpace.comap Prod.snd ‹MeasurableSpace V› ⊔ ⨆ n, p.field n) + (iSup_le p.field_le) (μ.prod ν) := by + refine adaptive_tapes_given_full_transcript (P := μ.prod ν) p.filtration _ _ + measurable_fst.comap_le measurable_snd.comap_le ?_ + (fun n ω => p.alice n (p.publicPrefix n ω)) + (fun n ω => p.sendA n (ω.1,p.publicPrefix n ω)) + (fun n ω => p.sendB n (ω.2,p.publicPrefix n ω)) (Classical.arbitrary M) ?_ ?_ ?_ ?_ + · change CondIndep (p.field 0) _ _ _ _ + have h0 := indep_condIndep_bot measurable_fst.comap_le measurable_snd.comap_le + (P := μ.prod ν) (indepFun_prod (μ := μ) (ν := ν) measurable_id measurable_id) + simpa only [p.field_zero] using h0 + · intro n + exact (p.measAlice n).comp (Measurable.of_comap_le le_rfl) + · intro n + exact (p.measA n).comp ((Measurable.of_comap_le le_sup_left).prodMk + (Measurable.of_comap_le le_sup_right)) + · intro n + exact (p.measB n).comp ((Measurable.of_comap_le le_sup_left).prodMk + (Measurable.of_comap_le le_sup_right)) + · exact p.field_succ + +def record (ω : U × V) (n : ℕ) : M := p.message n ω + +lemma measurable_record : Measurable p.record := + Measurable.of_eval p.measurable_message + +lemma prefix_eq_record (n : ℕ) (ω : U × V) (i : Fin n) : + p.publicPrefix n ω i = p.record ω i := by + induction n with + | zero => exact Fin.elim0 i + | succ n ih => + refine Fin.lastCases ?_ (fun j => ?_) i + · simp only [publicPrefix, Fin.snoc_last, record, message, Fin.val_last] + · simpa only [publicPrefix, Fin.snoc_castSucc, Fin.val_castSucc] using ih j + +lemma full_record_field : + MeasurableSpace.comap p.record inferInstance = ⨆ n, p.field n := by + apply le_antisymm + · let : MeasurableSpace (U × V) := ⨆ n, p.field n + apply Measurable.comap_le + apply Measurable.of_eval + intro n + have h : @Measurable (U × V) (Fin (n+1) → M) (⨆ n, p.field n) _ + (p.publicPrefix (n+1)) := Measurable.of_comap_le (le_iSup p.field (n+1)) + simpa only [publicPrefix, Fin.snoc_last, record, message] using h.eval (a := Fin.last n) + · apply iSup_le + intro n + let : MeasurableSpace (U × V) := MeasurableSpace.comap p.record inferInstance + apply Measurable.comap_le + apply Measurable.of_eval + intro i + simp_rw [prefix_eq_record] + exact (Measurable.of_comap_le (f := p.record) le_rfl).eval + +universe v6086_0 v6086_1 + +theorem final_records_conditionally_independent [Nonempty M] + [StandardBorelSpace U] [StandardBorelSpace V] + (μ : Measure U) (ν : Measure V) [IsProbabilityMeasure μ] [IsProbabilityMeasure ν] + {A : Type v6086_0} {B : Type v6086_1} [MeasurableSpace A] [MeasurableSpace B] + (readA : U × (ℕ → M) → A) (readB : V × (ℕ → M) → B) + (ha : Measurable readA) (hb : Measurable readB) : + CondIndepFun (MeasurableSpace.comap p.record inferInstance) + p.measurable_record.comap_le + (fun ω => readA (ω.1,p.record ω)) + (fun ω => readB (ω.2,p.record ω)) (μ.prod ν) := by + have h := p.tapes_conditionally_independent μ ν + rw [condIndepFun_iff_condIndep] + have hA : MeasurableSpace.comap (fun ω => readA (ω.1,p.record ω)) inferInstance ≤ + MeasurableSpace.comap Prod.fst ‹MeasurableSpace U› ⊔ ⨆ n, p.field n := by + apply Measurable.comap_le + exact ha.comp ((Measurable.of_comap_le le_sup_left).prodMk + (Measurable.of_comap_le (p.full_record_field ▸ le_sup_right))) + have hB : MeasurableSpace.comap (fun ω => readB (ω.2,p.record ω)) inferInstance ≤ + MeasurableSpace.comap Prod.snd ‹MeasurableSpace V› ⊔ ⨆ n, p.field n := by + apply Measurable.comap_le + exact hb.comp ((Measurable.of_comap_le le_sup_left).prodMk + (Measurable.of_comap_le (p.full_record_field ▸ le_sup_right))) + have h' := condIndep_of_condIndep_of_le_right + (condIndep_of_condIndep_of_le_left h hA) hB + simpa only [p.full_record_field] using h' + +end AdaptiveTapeProgram + +end + +section + +open MeasureTheory ProbabilityTheory Set Function unitInterval + +section + +universe v6124_0 + +variable {N : Type v6124_0} [inst6124_0 : MeasurableSpace N] (ν : Measure N) [inst6124_1 : IsProbabilityMeasure ν] + +def noiseTapeLaw : Measure (ℕ → N) := Measure.infinitePi (fun _ => ν) + +instance noiseTapeLaw_probability : IsProbabilityMeasure (noiseTapeLaw ν) := by + unfold noiseTapeLaw + infer_instance + +lemma noise_prefix_fresh_independent (n : ℕ) : + IndepFun (fun u : (ℕ → N) => fun i : Fin n => u i) (fun u => u n) (noiseTapeLaw ν) := by + have h := iIndepFun_infinitePi (P := fun _ : ℕ => ν) + (X := fun _ x => x) (fun _ => measurable_id) + have hd : Disjoint (Finset.range n) {n} := by simp + have hh := h.indepFun_finset (Finset.range n) {n} hd (fun i => measurable_pi_apply i) + have hh' := hh.comp + (show Measurable (fun x : (i : Finset.range n) → N => fun j : Fin n => + x ⟨j,Finset.mem_range.mpr j.isLt⟩) from by fun_prop) + (show Measurable (fun x : (i : ({n} : Finset ℕ)) → N => x ⟨n,by simp⟩) from by fun_prop) + exact hh' + +lemma noise_tape_eval (n : ℕ) : (noiseTapeLaw ν).map (fun u => u n) = ν := + Measure.infinitePi_map_eval _ _ + +universe v6146_0 v6146_1 + +structure NoiseSampler (N : Type v6146_0) (O : Type v6146_1) [MeasurableSpace N] [MeasurableSpace O] where + step : (n : ℕ) → (Fin n → O) × N → O + measurable_step : ∀ n, Measurable (step n) + +namespace NoiseSampler + +variable {ν} + +universe v6152_0 + +variable {O : Type v6152_0} [inst6152_0 : MeasurableSpace O] (f : NoiseSampler N O) + +def finiteHistory : (n : ℕ) → (Fin n → N) → (Fin n → O) + | 0, _ => Fin.elim0 + | n+1, u => Fin.snoc (finiteHistory n (fun i => u i.castSucc)) + (f.step n (finiteHistory n (fun i => u i.castSucc), u (Fin.last n))) + +lemma measurable_finiteHistory : ∀ n, Measurable (f.finiteHistory n) := by + intro n + induction n with + | zero => exact Measurable.of_eval (fun i => Fin.elim0 i) + | succ n ih => + have hr : Measurable (fun u : Fin (n+1) → N => fun i : Fin n => u i.castSucc) := by fun_prop + apply Measurable.of_eval + intro i + refine Fin.lastCases ?_ (fun j => ?_) i + · simpa only [finiteHistory, Fin.snoc_last,Function.comp_def] using + (f.measurable_step n).comp ((ih.comp hr).prodMk (measurable_pi_apply (Fin.last n))) + · simpa only [finiteHistory, Fin.snoc_castSucc,Function.comp_def] using (ih.comp hr).eval (a := j) + +def history (n : ℕ) (u : (ℕ → N)) : Fin n → O := + f.finiteHistory n (fun i => u i) + +lemma measurable_prefix (n : ℕ) : Measurable (f.history n) := + (f.measurable_finiteHistory n).comp (by fun_prop) + +lemma prefix_succ (n : ℕ) (u : (ℕ → N)) : + f.history (n+1) u = Fin.snoc (f.history n u) (f.step n (f.history n u,u n)) := rfl + +lemma prefix_fresh_independent (n : ℕ) : + IndepFun (f.history n) (fun u => u n) (noiseTapeLaw ν) := + (noise_prefix_fresh_independent ν n).comp (f.measurable_finiteHistory n) measurable_id + +lemma prefix_fresh_law (n : ℕ) : + (noiseTapeLaw ν).map (fun u => (f.history n u,u n)) = + ((noiseTapeLaw ν).map (f.history n)).prod ν := by + rw [(f.prefix_fresh_independent (ν := ν) n).map_prod_eq_prod_map_map + (f.measurable_prefix n).aemeasurable (measurable_pi_apply n).aemeasurable, + noise_tape_eval] + +theorem prefix_law_succ (κ : (n : ℕ) → Kernel (Fin n → O) O) + [∀ n, IsMarkovKernel (κ n)] + (hlaw : ∀ n s, ν.map (fun u => f.step n (s,u)) = κ n s) + (n : ℕ) : + (noiseTapeLaw ν).map (f.history (n+1)) = + (((noiseTapeLaw ν).map (f.history n)) ⊗ₘ κ n).map (fun p : (Fin n → O) × O => Fin.snoc (α := fun _ : Fin (n+1) => O) p.1 p.2) := by + have hfresh := f.prefix_fresh_law (ν := ν) n + have hsample : (((noiseTapeLaw ν).map (f.history n)).prod ν).map + (fun p => (p.1, f.step n p)) = ((noiseTapeLaw ν).map (f.history n)) ⊗ₘ κ n := by + ext B hB + rw [Measure.map_apply (measurable_fst.prodMk (f.measurable_step n)) hB, + Measure.prod_apply (hB.preimage (measurable_fst.prodMk (f.measurable_step n))), + Measure.compProd_apply hB] + congr 1 + funext s + have hm : Measurable (fun u : N => f.step n (s,u)) := by + simpa only [Function.comp_def, id_eq] using + ((f.measurable_step n).comp ((measurable_const (a := s)).prodMk measurable_id)) + rw [← hlaw n s, Measure.map_apply hm (measurable_prodMk_left hB)] + rfl + have hs : Measurable (fun p : (Fin n → O) × O => Fin.snoc (α := fun _ : Fin (n+1) => O) p.1 p.2) := by + apply Measurable.of_eval + intro i + refine Fin.lastCases ?_ (fun j => ?_) i + · simpa only [Fin.snoc_last] using measurable_snd + · simpa only [Fin.snoc_castSucc, Function.comp_def] using (measurable_pi_apply j).comp measurable_fst + rw [← hsample, ← hfresh, + Measure.map_map (measurable_fst.prodMk (f.measurable_step n)) + ((f.measurable_prefix n).prodMk (measurable_pi_apply n)), + Measure.map_map hs ((measurable_fst.prodMk (f.measurable_step n)).comp + ((f.measurable_prefix n).prodMk (measurable_pi_apply n)))] + rfl + +def record (u : (ℕ → N)) (n : ℕ) : O := f.step n (f.history n u,u n) + +lemma measurable_record : Measurable f.record := + Measurable.of_eval (fun n => + (f.measurable_step n).comp ((f.measurable_prefix n).prodMk (measurable_pi_apply n))) + +lemma prefix_eq_record (n : ℕ) (u : (ℕ → N)) (i : Fin n) : + f.history n u i = f.record u i := by + induction n with + | zero => exact Fin.elim0 i + | succ n ih => + rw [f.prefix_succ] + refine Fin.lastCases ?_ (fun j => ?_) i + · simp only [Fin.snoc_last,record, Fin.val_last] + · simpa only [Fin.snoc_castSucc, Fin.val_castSucc] using ih j + +theorem finite_law_unique (κ : (n : ℕ) → Kernel (Fin n → O) O) + [∀ n, IsMarkovKernel (κ n)] + (hlaw : ∀ n s, ν.map (fun u => f.step n (s,u)) = κ n s) + (P : Measure (ℕ → O)) [IsProbabilityMeasure P] + (hP : ∀ n, P.map (fun x => fun i : Fin (n+1) => x i) = + ((P.map (fun x => fun i : Fin n => x i)) ⊗ₘ κ n).map + (fun p : (Fin n → O) × O => Fin.snoc (α := fun _ : Fin (n+1) => O) p.1 p.2)) : + ∀ n, P.map (fun x => fun i : Fin n => x i) = (noiseTapeLaw ν).map (f.history n) := by + intro n + induction n with + | zero => + have ht : (fun x : ℕ → O => fun i : Fin 0 => x i) = fun _ => Fin.elim0 := by + funext x i + exact Fin.elim0 i + rw [ht] + change P.map (fun _ : ℕ → O => Fin.elim0) = + (noiseTapeLaw ν).map (fun _ : (ℕ → N) => Fin.elim0) + simp + | succ n ih => rw [hP n, ih, f.prefix_law_succ κ hlaw] + +theorem record_law_unique (κ : (n : ℕ) → Kernel (Fin n → O) O) + [∀ n, IsMarkovKernel (κ n)] + (hlaw : ∀ n s, ν.map (fun u => f.step n (s,u)) = κ n s) + (P : Measure (ℕ → O)) [IsProbabilityMeasure P] + (hP : ∀ n, P.map (fun x => fun i : Fin (n+1) => x i) = + ((P.map (fun x => fun i : Fin n => x i)) ⊗ₘ κ n).map + (fun p : (Fin n → O) × O => Fin.snoc (α := fun _ : Fin (n+1) => O) p.1 p.2)) : + P = (noiseTapeLaw ν).map f.record := by + let Q := (noiseTapeLaw ν).map f.record + have hQ : IsProbabilityMeasure Q := inferInstance + apply IsProjectiveLimit.unique (P := fun J : Finset ℕ => Q.map J.restrict) ?_ + (show IsProjectiveLimit Q (fun J : Finset ℕ => Q.map J.restrict) from fun _ => rfl) + intro J + let n := J.sup id + 1 + let index : J → Fin n := fun j => ⟨j.1,Nat.lt_succ_of_le (Finset.le_sup (f := id) j.2)⟩ + let cut : (Fin n → O) → (J → O) := fun x j => x (index j) + have hc : Measurable cut := by fun_prop + have h := congrArg (fun ν : Measure (Fin n → O) => ν.map cut) + (f.finite_law_unique κ hlaw P hP n) + rw [Measure.map_map hc (by fun_prop), Measure.map_map hc (f.measurable_prefix n)] at h + change P.map J.restrict = ((noiseTapeLaw ν).map f.record).map J.restrict + rw [Measure.map_map (Finset.measurable_restrict J) f.measurable_record] + have heL : cut ∘ (fun x : ℕ → O => fun i : Fin n => x i) = J.restrict := rfl + have heR : cut ∘ f.history n = J.restrict ∘ f.record := by + funext u j + exact f.prefix_eq_record n u (index j) + rwa [heL,heR] at h + +end NoiseSampler + +end + +universe v6315_0 v6315_1 + +structure AdaptiveOutcomeSampler (O : Type v6315_0) (M : Type v6315_1) [MeasurableSpace O] [MeasurableSpace M] where + alice : (n : ℕ) → (Fin n → M) → Bool + alice_meas : ∀ n, Measurable (alice n) + sampleA : (n : ℕ) → ((Fin n → (O ⊕ Unit)) × (Fin n → M)) × I → O + sampleB : (n : ℕ) → ((Fin n → (O ⊕ Unit)) × (Fin n → M)) × I → O + sendA : (n : ℕ) → ((Fin n → (O ⊕ Unit)) × (Fin n → M)) × O → M + sendB : (n : ℕ) → ((Fin n → (O ⊕ Unit)) × (Fin n → M)) × O → M + sampleA_meas : ∀ n, Measurable (sampleA n) + sampleB_meas : ∀ n, Measurable (sampleB n) + sendA_meas : ∀ n, Measurable (sendA n) + sendB_meas : ∀ n, Measurable (sendB n) + +namespace AdaptiveOutcomeSampler + +section + +universe v6328_0 v6328_1 + +variable {O : Type v6328_0} {M : Type v6328_1} [inst6328_0 : MeasurableSpace O] [inst6328_1 : MeasurableSpace M] + (p : AdaptiveOutcomeSampler O M) + +def privatePrefix (a : Bool) : (n : ℕ) → UniformTape × (Fin n → M) → (Fin n → (O ⊕ Unit)) + | 0, _ => Fin.elim0 + | n+1, pair => + let old := privatePrefix a n (pair.1,fun i => pair.2 i.castSucc) + let pubPast := fun i : Fin n => pair.2 i.castSucc + Fin.snoc old (if p.alice n pubPast = a then Sum.inl + (if a then p.sampleA n ((old,pubPast),pair.1 n) + else p.sampleB n ((old,pubPast),pair.1 n)) else Sum.inr ()) + +lemma measurable_privatePrefix (a : Bool) : ∀ n, Measurable (p.privatePrefix a n) := by + intro n + induction n with + | zero => exact Measurable.of_eval (fun i => Fin.elim0 i) + | succ n ih => + have hr : Measurable (fun pair : UniformTape × (Fin (n+1) → M) => + (pair.1,fun i : Fin n => pair.2 i.castSucc)) := by fun_prop + have hv : Measurable (fun pair : UniformTape × (Fin (n+1) → M) => + fun i : Fin n => pair.2 i.castSucc) := by fun_prop + apply Measurable.of_eval + intro i + refine Fin.lastCases ?_ (fun j => ?_) i + · simp only [privatePrefix,Fin.snoc_last] + apply Measurable.ite ((measurableSet_singleton a).preimage ((p.alice_meas n).comp hv)) _ measurable_const + apply measurable_inl.comp + cases a + · exact (p.sampleB_meas n).comp (((ih.comp hr).prodMk hv).prodMk + ((measurable_pi_apply n).comp measurable_fst)) + · exact (p.sampleA_meas n).comp (((ih.comp hr).prodMk hv).prodMk + ((measurable_pi_apply n).comp measurable_fst)) + · simpa only [privatePrefix,Fin.snoc_castSucc,Function.comp_def] using + (ih.comp hr).eval (a := j) + +def tapeProgram : AdaptiveTapeProgram UniformTape UniformTape M where + alice := p.alice + measAlice := p.alice_meas + sendA n pair := p.sendA n ((p.privatePrefix true n pair,pair.2), + p.sampleA n ((p.privatePrefix true n pair,pair.2),pair.1 n)) + sendB n pair := p.sendB n ((p.privatePrefix false n pair,pair.2), + p.sampleB n ((p.privatePrefix false n pair,pair.2),pair.1 n)) + measA n := (p.sendA_meas n).comp + (((p.measurable_privatePrefix true n).prodMk measurable_snd).prodMk + ((p.sampleA_meas n).comp (((p.measurable_privatePrefix true n).prodMk measurable_snd).prodMk + ((measurable_pi_apply n).comp measurable_fst)))) + measB n := (p.sendB_meas n).comp + (((p.measurable_privatePrefix false n).prodMk measurable_snd).prodMk + ((p.sampleB_meas n).comp (((p.measurable_privatePrefix false n).prodMk measurable_snd).prodMk + ((measurable_pi_apply n).comp measurable_fst)))) + +def replay : (n : ℕ) → (Fin n → O) → + ((Fin n → (O ⊕ Unit)) × (Fin n → (O ⊕ Unit))) × (Fin n → M) := + Nat.rec (fun _ => ((Fin.elim0,Fin.elim0),Fin.elim0)) (fun n previous x => + let r := previous (fun i => x i.castSucc) + let o := x (Fin.last n) + let q := p.alice n r.2 + ((Fin.snoc r.1.1 (if q then Sum.inl o else Sum.inr ()), + Fin.snoc r.1.2 (if q then Sum.inr () else Sum.inl o)), + Fin.snoc r.2 (if q then p.sendA n ((r.1.1,r.2),o) else p.sendB n ((r.1.2,r.2),o)))) + +universe v6393_0 v6393_1 + +lemma measurable_snoc {Z : Type v6393_0} {X : Type v6393_1} [MeasurableSpace Z] [MeasurableSpace X] + {n : ℕ} (f : Z → (Fin n → X)) (g : Z → X) + (hf : Measurable f) (hg : Measurable g) : + Measurable (fun x => Fin.snoc (α := fun _ : Fin (n+1) => X) (f x) (g x)) := by + apply Measurable.of_eval + intro i + refine Fin.lastCases ?_ (fun j => ?_) i + · simpa only [Fin.snoc_last] using hg + · simpa only [Fin.snoc_castSucc] using hf.eval (a := j) + +lemma measurable_replay : ∀ n, Measurable (p.replay n) := by + intro n + induction n with + | zero => exact measurable_const + | succ n ih => + have hr : Measurable (fun x : Fin (n+1) → O => fun i : Fin n => x i.castSucc) := by fun_prop + have hR := ih.comp hr + have hq := (p.alice_meas n).comp hR.snd + have hqs := (measurableSet_singleton true).preimage hq + exact ((measurable_snoc _ _ hR.fst.fst ((measurable_inl.comp (measurable_pi_apply (Fin.last n))).ite hqs measurable_const)).prodMk + (measurable_snoc _ _ hR.fst.snd (measurable_const.ite hqs (measurable_inl.comp (measurable_pi_apply (Fin.last n)))))).prodMk + (measurable_snoc _ _ hR.snd (((p.sendA_meas n).comp ((hR.fst.fst.prodMk hR.snd).prodMk (measurable_pi_apply (Fin.last n)))).ite hqs + ((p.sendB_meas n).comp ((hR.fst.snd.prodMk hR.snd).prodMk (measurable_pi_apply (Fin.last n)))))) + +def extractPrivate (a : Bool) (n : ℕ) (x : Fin n → O) : Fin n → O ⊕ Unit := + if a then (p.replay n x).1.1 else (p.replay n x).1.2 + +def publicFrom (n : ℕ) (x : Fin n → O) : Fin n → M := (p.replay n x).2 + +lemma measurable_extractPrivate (a : Bool) (n : ℕ) : Measurable (p.extractPrivate a n) := by + cases a + · exact (p.measurable_replay n).fst.snd + · exact (p.measurable_replay n).fst.fst + +lemma measurable_publicFrom (n : ℕ) : Measurable (p.publicFrom n) := (p.measurable_replay n).snd + +lemma extractPrivate_snoc (a : Bool) (n : ℕ) (x : Fin n → O) (z : O) : + p.extractPrivate a (n+1) (Fin.snoc (α := fun _ => O) x z) = + Fin.snoc (p.extractPrivate a n x) (if p.alice n (p.publicFrom n x) = a then Sum.inl z else Sum.inr ()) := by + cases a <;> cases hq : p.alice n (p.publicFrom n x) <;> + simp only [extractPrivate,replay,Fin.snoc_castSucc,Fin.snoc_last,publicFrom] at hq ⊢ <;> simp [hq] + +lemma publicFrom_snoc (n : ℕ) (x : Fin n → O) (z : O) : + p.publicFrom (n+1) (Fin.snoc (α := fun _ => O) x z) = + Fin.snoc (p.publicFrom n x) (if p.alice n (p.publicFrom n x) then + p.sendA n ((p.extractPrivate true n x,p.publicFrom n x),z) else + p.sendB n ((p.extractPrivate false n x,p.publicFrom n x),z)) := by + simp only [publicFrom,replay,extractPrivate,Fin.snoc_castSucc,Fin.snoc_last,Bool.false_eq_true,↓reduceIte] + +lemma privatePrefix_snoc (a : Bool) (n : ℕ) (u : UniformTape) (h : Fin n → M) (z : M) : + p.privatePrefix a (n+1) (u,Fin.snoc (α := fun _ => M) h z) = + Fin.snoc (p.privatePrefix a n (u,h)) (if p.alice n h = a then Sum.inl + (if a then p.sampleA n ((p.privatePrefix a n (u,h),h),u n) + else p.sampleB n ((p.privatePrefix a n (u,h),h),u n)) else Sum.inr ()) := by + simp only [privatePrefix,Fin.snoc_castSucc] + +/-- The sampled outcome history, without a bundled measurability certificate. -/ +def causalStep (n : ℕ) (pair : (Fin n → O) × (I × I)) : O := + if p.alice n (p.publicFrom n pair.1) then + p.sampleA n ((p.extractPrivate true n pair.1, p.publicFrom n pair.1), pair.2.1) + else p.sampleB n ((p.extractPrivate false n pair.1, p.publicFrom n pair.1), pair.2.2) + +def causalHistory : (n : ℕ) → (Fin n → I × I) → (Fin n → O) + | 0, _ => Fin.elim0 + | n+1, u => Fin.snoc (causalHistory n (fun i => u i.castSucc)) + (p.causalStep n (causalHistory n (fun i => u i.castSucc), u (Fin.last n))) + +def causalRecord (u : ℕ → I × I) (n : ℕ) : O := + p.causalStep n (p.causalHistory n (fun i => u i), u n) + +def causal : NoiseSampler (I × I) O where + step n pair := if p.alice n (p.publicFrom n pair.1) then + p.sampleA n ((p.extractPrivate true n pair.1,p.publicFrom n pair.1),pair.2.1) else + p.sampleB n ((p.extractPrivate false n pair.1,p.publicFrom n pair.1),pair.2.2) + measurable_step n := + ((p.sampleA_meas n).comp ((((p.measurable_extractPrivate true n).comp measurable_fst).prodMk + ((p.measurable_publicFrom n).comp measurable_fst)).prodMk measurable_snd.fst)).ite + ((measurableSet_singleton true).preimage ((p.alice_meas n).comp ((p.measurable_publicFrom n).comp measurable_fst))) + ((p.sampleB_meas n).comp ((((p.measurable_extractPrivate false n).comp measurable_fst).prodMk + ((p.measurable_publicFrom n).comp measurable_fst)).prodMk measurable_snd.snd)) + +lemma causalRecord_eq : p.causalRecord = p.causal.record := by + have h (n : ℕ) : p.causalHistory n = p.causal.finiteHistory n := by + induction n with + | zero => rfl + | succ n ih => + funext u + simp only [causalHistory, NoiseSampler.finiteHistory, ih] + rfl + funext u n + change p.causalStep n (p.causalHistory n (fun i => u i), u n) = + p.causal.step n (p.causal.finiteHistory n (fun i => u i), u n) + rw [h n] + rfl + +def pairedTape (uv : UniformTape × UniformTape) (n : ℕ) : I × I := (uv.1 n,uv.2 n) + +lemma measurable_pairedTape : Measurable pairedTape := by unfold pairedTape; fun_prop + +theorem replay_matches (n : ℕ) (uv : UniformTape × UniformTape) : + p.publicFrom n (p.causal.history n (pairedTape uv)) = p.tapeProgram.publicPrefix n uv ∧ + (∀ a, p.extractPrivate a n (p.causal.history n (pairedTape uv)) = + p.privatePrefix a n ((if a then uv.1 else uv.2),p.tapeProgram.publicPrefix n uv)) := by + induction n with + | zero => exact ⟨rfl,fun a => by cases a <;> rfl⟩ + | succ n ih => + have hs : p.causal.step n (p.causal.history n (pairedTape uv),pairedTape uv n) = + if p.alice n (p.tapeProgram.publicPrefix n uv) then + p.sampleA n ((p.privatePrefix true n (uv.1,p.tapeProgram.publicPrefix n uv), + p.tapeProgram.publicPrefix n uv),uv.1 n) else + p.sampleB n ((p.privatePrefix false n (uv.2,p.tapeProgram.publicPrefix n uv), + p.tapeProgram.publicPrefix n uv),uv.2 n) := by + change (if p.alice n (p.publicFrom n (p.causal.history n (pairedTape uv))) then + p.sampleA n ((p.extractPrivate true n (p.causal.history n (pairedTape uv)), + p.publicFrom n (p.causal.history n (pairedTape uv))),uv.1 n) + else p.sampleB n ((p.extractPrivate false n (p.causal.history n (pairedTape uv)), + p.publicFrom n (p.causal.history n (pairedTape uv))),uv.2 n)) = _ + rw [ih.1,ih.2 true,ih.2 false] + simp only [Bool.false_eq_true,↓reduceIte] + rw [p.causal.prefix_succ,p.publicFrom_snoc,hs,ih.1,ih.2 true,ih.2 false] + simp only [Bool.false_eq_true,↓reduceIte] + constructor + · rw [p.tapeProgram.prefix_succ] + congr 1 + unfold AdaptiveTapeProgram.message tapeProgram + split <;> simp_all only [] + · intro a + rw [p.extractPrivate_snoc,ih.2 a,ih.1,p.tapeProgram.prefix_succ,p.privatePrefix_snoc] + congr 1 + cases a <;> cases hrole : p.alice n (p.tapeProgram.publicPrefix n uv) <;> + simp only [Bool.false_eq_true,Bool.true_eq_false,↓reduceIte] + +end + +universe v6532_0 v6532_1 + +variable {O : Type v6532_0} {M : Type v6532_1} [inst6532_0 : MeasurableSpace O] [inst6532_1 : MeasurableSpace M] + (p : AdaptiveOutcomeSampler O M) + +def instrumentKernel + (κA κB : (n : ℕ) → Kernel ((Fin n → (O ⊕ Unit)) × (Fin n → M)) O) + (n : ℕ) : Kernel (Fin n → O) O := by + classical + exact Kernel.piecewise + ((measurableSet_singleton true).preimage ((p.alice_meas n).comp (p.measurable_publicFrom n))) + ((κA n).comap (fun x => (p.extractPrivate true n x,p.publicFrom n x)) + ((p.measurable_extractPrivate true n).prodMk (p.measurable_publicFrom n))) + ((κB n).comap (fun x => (p.extractPrivate false n x,p.publicFrom n x)) + ((p.measurable_extractPrivate false n).prodMk (p.measurable_publicFrom n))) + +lemma instrumentKernel_apply + (κA κB : (n : ℕ) → Kernel ((Fin n → (O ⊕ Unit)) × (Fin n → M)) O) + (n : ℕ) (s : Fin n → O) : + p.instrumentKernel κA κB n s = if p.alice n (p.publicFrom n s) then + κA n (p.extractPrivate true n s,p.publicFrom n s) else + κB n (p.extractPrivate false n s,p.publicFrom n s) := by + classical + simp only [instrumentKernel,Kernel.piecewise_apply,Set.mem_preimage,Set.mem_singleton_iff, + Function.comp_def,Kernel.comap_apply] + +instance instrumentKernel_markov + (κA κB : (n : ℕ) → Kernel ((Fin n → (O ⊕ Unit)) × (Fin n → M)) O) + [∀ n, IsMarkovKernel (κA n)] [∀ n, IsMarkovKernel (κB n)] (n : ℕ) : + IsMarkovKernel (p.instrumentKernel κA κB n) := by + unfold instrumentKernel + infer_instance + +lemma causal_step_law + (κA κB : (n : ℕ) → Kernel ((Fin n → (O ⊕ Unit)) × (Fin n → M)) O) + (ha : ∀ n s, volume.map (fun u => p.sampleA n (s,u)) = κA n s) + (hb : ∀ n s, volume.map (fun u => p.sampleB n (s,u)) = κB n s) : + ∀ n s, (volume.prod volume).map (fun u => p.causal.step n (s,u)) = + p.instrumentKernel κA κB n s := by + intro n s + rw [p.instrumentKernel_apply κA κB n s] + change (volume.prod volume).map (fun u => if p.alice n (p.publicFrom n s) then + p.sampleA n ((p.extractPrivate true n s,p.publicFrom n s),u.1) else + p.sampleB n ((p.extractPrivate false n s,p.publicFrom n s),u.2)) = _ + split + · have hm : Measurable (fun u : I => p.sampleA n ((p.extractPrivate true n s,p.publicFrom n s),u)) := + (p.sampleA_meas n).comp (measurable_const.prodMk measurable_id) + have hh := Measure.map_map (μ := (volume : Measure I).prod volume) hm + (measurable_fst : Measurable (Prod.fst : I × I → I)) + simp only [Measure.map_fst_prod, measure_univ, one_smul] at hh + exact hh.symm.trans (ha n _) + · have hm : Measurable (fun u : I => p.sampleB n ((p.extractPrivate false n s,p.publicFrom n s),u)) := + (p.sampleB_meas n).comp (measurable_const.prodMk measurable_id) + have hh := Measure.map_map (μ := (volume : Measure I).prod volume) hm + (measurable_snd : Measurable (Prod.snd : I × I → I)) + simp only [Measure.map_snd_prod, measure_univ, one_smul] at hh + exact hh.symm.trans (hb n _) + +end AdaptiveOutcomeSampler + +end + +namespace AdaptiveQuantum + +open Matrix MeasureTheory ProbabilityTheory + +open scoped ComplexOrder MatrixOrder Matrix.Norms.L2Operator Kronecker + +open UnrestrictedQuantum + +universe v6604_0 v6604_1 v6604_2 v6604_3 v6604_4 v6604_5 + +variable {O : Type v6604_0} {M : Type v6604_1} {ι : Type v6604_2} {η : Type v6604_3} [inst6604_0 : MeasurableSpace O] [inst6604_1 : MeasurableSpace M] + [inst6604_2 : Fintype ι] [inst6604_3 : Fintype η] [inst6604_4 : DecidableEq ι] [inst6604_5 : DecidableEq η] + {A : ℕ → Type v6604_4} {B : ℕ → Type v6604_5} + [inst6604_6 : ∀ n, AddCommGroup (A n)] [inst6604_7 : ∀ n, Module ℂ (A n)] [inst6604_8 : ∀ n, One (A n)] [inst6604_9 : ∀ n, LE (A n)] + [inst6604_10 : ∀ n, AddCommGroup (B n)] [inst6604_11 : ∀ n, Module ℂ (B n)] [inst6604_12 : ∀ n, One (B n)] [inst6604_13 : ∀ n, LE (B n)] + (p : AdaptiveOutcomeSampler O M) + (κA κB : (n : ℕ) → Kernel (LocalHistory O M n) O) + [inst6604_14 : ∀ n, IsMarkovKernel (κA n)] [inst6604_15 : ∀ n, IsMarkovKernel (κB n)] + (eA : LocalObservableExecution (ι := ι) A κA p.sendA) + (eB : LocalObservableExecution (ι := η) B κB p.sendB) + +def globalLocalReferenceA (n : ℕ) (s : Fin n → O) : Matrix ι ι ℂ := + eA.reference n (p.extractPrivate true n s,p.publicFrom n s) + +def globalLocalReferenceB (n : ℕ) (s : Fin n → O) : Matrix η η ℂ := + eB.reference n (p.extractPrivate false n s,p.publicFrom n s) + +omit inst6604_14 in +lemma globalLocalReferenceA_measurable [∀ n, IsMarkovKernel (κA n)] (n : ℕ) : + Measurable (globalLocalReferenceA p κA eA n) := + (eA.reference_measurable n).comp + ((p.measurable_extractPrivate true n).prodMk (p.measurable_publicFrom n)) + +omit inst6604_15 in +lemma globalLocalReferenceB_measurable [∀ n, IsMarkovKernel (κB n)] (n : ℕ) : + Measurable (globalLocalReferenceB p κB eB n) := + (eB.reference_measurable n).comp + ((p.measurable_extractPrivate false n).prodMk (p.measurable_publicFrom n)) + +omit inst6604_14 in +lemma globalLocalReferenceA_mean [∀ n, IsMarkovKernel (κA n)] (n : ℕ) (s : Fin n → O) (i j : ι) : + (∫ o, globalLocalReferenceA p κA eA (n+1) (Fin.snoc s o) i j + ∂p.instrumentKernel κA κB n s) = globalLocalReferenceA p κA eA n s i j := by + unfold globalLocalReferenceA + simp_rw [p.extractPrivate_snoc, p.publicFrom_snoc] + rw [p.instrumentKernel_apply] + cases hrole : p.alice n (p.publicFrom n s) with + | true => + simp only [↓reduceIte] + exact eA.active_mean n _ i j + | false => + simp only [Bool.false_eq_true,↓reduceIte] + change (∫ o, eA.reference (n+1) (localPassive + (p.extractPrivate true n s,p.publicFrom n s) + (p.sendB n ((p.extractPrivate false n s,p.publicFrom n s),o))) i j + ∂κB n (p.extractPrivate false n s,p.publicFrom n s)) = _ + simp only [eA.passive_reference] + simp + +omit inst6604_15 in +lemma globalLocalReferenceB_mean [∀ n, IsMarkovKernel (κB n)] (n : ℕ) (s : Fin n → O) (i j : η) : + (∫ o, globalLocalReferenceB p κB eB (n+1) (Fin.snoc s o) i j + ∂p.instrumentKernel κA κB n s) = globalLocalReferenceB p κB eB n s i j := by + unfold globalLocalReferenceB + simp_rw [p.extractPrivate_snoc, p.publicFrom_snoc] + rw [p.instrumentKernel_apply] + cases hrole : p.alice n (p.publicFrom n s) with + | false => + simp only [↓reduceIte] + exact eB.active_mean n _ i j + | true => + simp only [Bool.true_eq_false,↓reduceIte] + change (∫ o, eB.reference (n+1) (localPassive + (p.extractPrivate false n s,p.publicFrom n s) + (p.sendA n ((p.extractPrivate true n s,p.publicFrom n s),o))) i j + ∂κA n (p.extractPrivate true n s,p.publicFrom n s)) = _ + simp only [eB.passive_reference] + simp + +def jointReference (n : ℕ) (s : Fin n → O) : Matrix (ι × η) (ι × η) ℂ := + globalLocalReferenceA p κA eA n s ⊗ₖ globalLocalReferenceB p κB eB n s + +omit inst6604_14 inst6604_15 in +lemma jointReference_density [∀ n, IsMarkovKernel (κA n)] [∀ n, IsMarkovKernel (κB n)] (n : ℕ) (s : Fin n → O) : + Density (jointReference p κA κB eA eB n s) := by + refine ⟨(eA.reference_density n _).1.kronecker (eB.reference_density n _).1,?_⟩ + simp only [jointReference, Matrix.trace_kronecker,globalLocalReferenceA, + globalLocalReferenceB,(eA.reference_density n _).2,(eB.reference_density n _).2,one_mul] + +lemma jointReference_measurable (n : ℕ) : + Measurable (jointReference p κA κB eA eB n) := by + have hm : Measurable (fun s i j => jointReference p κA κB eA eB n s i j) := by + apply Measurable.of_eval; intro i + apply Measurable.of_eval; intro j + exact (((Matrix.entryLinearMap ℂ ℂ i.1 j.1).toContinuousLinearMap).measurable.comp + (globalLocalReferenceA_measurable p κA eA n)).mul + (((Matrix.entryLinearMap ℂ ℂ i.2 j.2).toContinuousLinearMap).measurable.comp + (globalLocalReferenceB_measurable p κB eB n)) + have hM : Continuous (Matrix.of : ((ι × η) → (ι × η) → ℂ) → Matrix (ι × η) (ι × η) ℂ) := + continuous_matrix (fun i j => continuous_apply_apply i j) + exact hM.measurable.comp hm + +omit inst6604_14 inst6604_15 in +lemma jointReference_mean [∀ n, IsMarkovKernel (κA n)] [∀ n, IsMarkovKernel (κB n)] (n : ℕ) (s : Fin n → O) (i j : ι × η) : + (∫ o, jointReference p κA κB eA eB (n+1) (Fin.snoc s o) i j + ∂p.instrumentKernel κA κB n s) = jointReference p κA κB eA eB n s i j := by + change (∫ o, globalLocalReferenceA p κA eA (n+1) (Fin.snoc s o) i.1 j.1 * + globalLocalReferenceB p κB eB (n+1) (Fin.snoc s o) i.2 j.2 + ∂p.instrumentKernel κA κB n s) = + globalLocalReferenceA p κA eA n s i.1 j.1 * globalLocalReferenceB p κB eB n s i.2 j.2 + simp only [globalLocalReferenceA,globalLocalReferenceB] + simp_rw [p.extractPrivate_snoc,p.publicFrom_snoc] + rw [p.instrumentKernel_apply] + cases hrole : p.alice n (p.publicFrom n s) with + | true => + simp only [Bool.true_eq_false,↓reduceIte] + change (∫ o, eA.reference (n+1) (localActive + (p.extractPrivate true n s,p.publicFrom n s) o + (p.sendA n ((p.extractPrivate true n s,p.publicFrom n s),o))) i.1 j.1 * + eB.reference (n+1) (localPassive (p.extractPrivate false n s,p.publicFrom n s) + (p.sendA n ((p.extractPrivate true n s,p.publicFrom n s),o))) i.2 j.2 + ∂κA n (p.extractPrivate true n s,p.publicFrom n s)) = _ + simp_rw [eB.passive_reference] + rw [integral_mul_const,eA.active_mean] + | false => + simp only [Bool.false_eq_true,↓reduceIte] + change (∫ o, eA.reference (n+1) (localPassive + (p.extractPrivate true n s,p.publicFrom n s) + (p.sendB n ((p.extractPrivate false n s,p.publicFrom n s),o))) i.1 j.1 * + eB.reference (n+1) (localActive (p.extractPrivate false n s,p.publicFrom n s) o + (p.sendB n ((p.extractPrivate false n s,p.publicFrom n s),o))) i.2 j.2 + ∂κB n (p.extractPrivate false n s,p.publicFrom n s)) = _ + simp_rw [eA.passive_reference] + rw [integral_const_mul,eB.active_mean] + +end AdaptiveQuantum + +section + +open MeasureTheory ProbabilityTheory Set Function unitInterval + +theorem paired_tapes_law : + (uniformTapeLaw.prod uniformTapeLaw).map + (fun uv : UniformTape × UniformTape => fun n => (uv.1 n,uv.2 n)) = + noiseTapeLaw ((volume : Measure I).prod volume) := by + let ν : Measure ((Fin 2 × ℕ) → I) := Measure.infinitePi (fun _ => (volume : Measure I)) + let split : ((Fin 2 × ℕ) → I) → UniformTape × UniformTape := + fun u => (fun n => u (0,n),fun n => u (1,n)) + have hs : Measurable split := by fun_prop + have hsplit : ν.map split = uniformTapeLaw.prod uniformTapeLaw := by + have hc := Measure.infinitePi_map_curry (fun (_ : Fin 2) (_ : ℕ) => (volume : Measure I)) + change ν.map (MeasurableEquiv.curry (Fin 2) ℕ I) = + Measure.infinitePi (fun _ : Fin 2 => uniformTapeLaw) at hc + rw [Measure.infinitePi_eq_pi (fun _ : Fin 2 => uniformTapeLaw)] at hc + have h := congrArg (fun P : Measure (Fin 2 → UniformTape) => P.map MeasurableEquiv.finTwoArrow) hc + rw [Measure.map_map (MeasurableEquiv.measurable _) (MeasurableEquiv.measurable _), + (measurePreserving_finTwoArrow uniformTapeLaw).map_eq] at h + exact h + have hswap := Measure.map_infinitePi_infinitePi_of_inj + (P := fun _ : Fin 2 × ℕ => (volume : Measure I)) + (f := fun p : ℕ × Fin 2 => (p.2,p.1)) (by intro a b h; cases a; cases b; simpa only [Prod.mk.injEq,and_comm] using h) + have hc := Measure.infinitePi_map_curry (fun (_ : ℕ) (_ : Fin 2) => (volume : Measure I)) + have hp := Measure.infinitePi_map_pi (fun _ : ℕ => Measure.infinitePi (fun _ : Fin 2 => (volume : Measure I))) + (f := fun _ => MeasurableEquiv.finTwoArrow) (fun _ => MeasurableEquiv.measurable _) + simp only [Measure.infinitePi_eq_pi, (measurePreserving_finTwoArrow (volume : Measure I)).map_eq] at hp + rw [← hsplit, Measure.map_map (by fun_prop) hs] + unfold noiseTapeLaw + rw [Measure.infinitePi_eq_pi (fun _ : Fin 2 => (volume : Measure I))] at hc + rw [← hp, ← hc, ← hswap] + rw [Measure.map_map (by fun_prop) (by fun_prop),Measure.map_map (by fun_prop) (by fun_prop)] + rfl + +end + +section + +open MeasureTheory ProbabilityTheory + +universe v6786_0 v6786_1 v6786_2 v6786_3 v6786_4 + +theorem condIndepFun_of_joint_law {Ω : Type v6786_0} {Ω' : Type v6786_1} {T : Type v6786_2} {A : Type v6786_3} {B : Type v6786_4} + [MeasurableSpace Ω] [StandardBorelSpace Ω] + [MeasurableSpace Ω'] [StandardBorelSpace Ω'] + [MeasurableSpace T] [MeasurableSpace A] [StandardBorelSpace A] [Nonempty A] + [MeasurableSpace B] [StandardBorelSpace B] [Nonempty B] + {P : Measure Ω} {Q : Measure Ω'} [IsFiniteMeasure P] [IsFiniteMeasure Q] + {t : Ω → T} {a : Ω → A} {b : Ω → B} + {t' : Ω' → T} {a' : Ω' → A} {b' : Ω' → B} + (ht : Measurable t) (ha : Measurable a) (hb : Measurable b) + (ht' : Measurable t') (ha' : Measurable a') (hb' : Measurable b') + (hlaw : P.map (fun x => (t x,a x,b x)) = Q.map (fun x => (t' x,a' x,b' x))) + (hind : CondIndepFun (MeasurableSpace.comap t' inferInstance) ht'.comap_le a' b' Q) : + CondIndepFun (MeasurableSpace.comap t inferInstance) ht.comap_le a b P := by + have hm : Measurable (fun x => (t x,a x,b x)) := ht.prodMk (ha.prodMk hb) + have hm' : Measurable (fun x => (t' x,a' x,b' x)) := ht'.prodMk (ha'.prodMk hb') + have hT : P.map t = Q.map t' := by + have h := congrArg (fun ν : Measure (T × A × B) => ν.map Prod.fst) hlaw + simpa only [Measure.map_map measurable_fst hm, + Measure.map_map measurable_fst hm', Function.comp_def] using h + have hA : P.map (fun x => (t x,a x)) = Q.map (fun x => (t' x,a' x)) := by + have hp : Measurable (fun x : T × A × B => (x.1,x.2.1)) := by fun_prop + have h := congrArg (fun ν : Measure (T × A × B) => ν.map (fun x => (x.1,x.2.1))) hlaw + simpa only [Measure.map_map hp hm, Measure.map_map hp hm', Function.comp_def] using h + have hB : P.map (fun x => (t x,b x)) = Q.map (fun x => (t' x,b' x)) := by + have hp : Measurable (fun x : T × A × B => (x.1,x.2.2)) := by fun_prop + have h := congrArg (fun ν : Measure (T × A × B) => ν.map (fun x => (x.1,x.2.2))) hlaw + simpa only [Measure.map_map hp hm, Measure.map_map hp hm', Function.comp_def] using h + rw [condIndepFun_iff_map_prod_eq_prod_condDistrib_prod_condDistrib ha hb ht] + rw [condIndepFun_iff_map_prod_eq_prod_condDistrib_prod_condDistrib ha' hb' ht'] at hind + have hca : condDistrib a t P = condDistrib a' t' Q := by + rw [condDistrib, condDistrib] + congr 1 + have hcb : condDistrib b t P = condDistrib b' t' Q := by + rw [condDistrib, condDistrib] + congr 1 + rw [hlaw,hca,hcb,hT] + exact hind + +end + +namespace AdaptiveOutcomeSampler + +open MeasureTheory ProbabilityTheory Set Function unitInterval + +universe v6835_0 v6835_1 + +variable {O : Type v6835_0} {M : Type v6835_1} [inst6835_0 : MeasurableSpace O] [inst6835_1 : MeasurableSpace M] + (p : AdaptiveOutcomeSampler O M) + +def privateRecord (a : Bool) (pair : UniformTape × (ℕ → M)) (n : ℕ) : O ⊕ Unit := + p.privatePrefix a (n+1) (pair.1,fun i => pair.2 i) (Fin.last n) + +lemma measurable_privateRecord (a : Bool) : Measurable (p.privateRecord a) := by + apply Measurable.of_eval + intro n + exact ((p.measurable_privatePrefix a (n+1)).comp (by fun_prop)).eval (a := Fin.last n) + +universe v6846_0 v6846_1 + +theorem final_records_independent [Nonempty M] {A : Type v6846_0} {B : Type v6846_1} [MeasurableSpace A] [MeasurableSpace B] + (readA : (ℕ → (O ⊕ Unit)) × (ℕ → M) → A) + (readB : (ℕ → (O ⊕ Unit)) × (ℕ → M) → B) + (ha : Measurable readA) (hb : Measurable readB) : + CondIndepFun (MeasurableSpace.comap p.tapeProgram.record inferInstance) + p.tapeProgram.measurable_record.comap_le + (fun uv => readA (p.privateRecord true (uv.1,p.tapeProgram.record uv),p.tapeProgram.record uv)) + (fun uv => readB (p.privateRecord false (uv.2,p.tapeProgram.record uv),p.tapeProgram.record uv)) + (uniformTapeLaw.prod uniformTapeLaw) := by + exact p.tapeProgram.final_records_conditionally_independent uniformTapeLaw uniformTapeLaw + (fun pair => readA (p.privateRecord true pair,pair.2)) + (fun pair => readB (p.privateRecord false pair,pair.2)) + (ha.comp ((p.measurable_privateRecord true).prodMk measurable_snd)) + (hb.comp ((p.measurable_privateRecord false).prodMk measurable_snd)) + +def outcomeRecord (uv : UniformTape × UniformTape) : ℕ → O := + p.causal.record (pairedTape uv) + +lemma measurable_outcomeRecord : Measurable p.outcomeRecord := + p.causal.measurable_record.comp measurable_pairedTape + +lemma outcomeRecord_law (κ : (n : ℕ) → Kernel (Fin n → O) O) + [∀ n, IsMarkovKernel (κ n)] + (hlaw : ∀ n s, (volume.prod volume).map (fun u => p.causal.step n (s,u)) = κ n s) + (P : Measure (ℕ → O)) [IsProbabilityMeasure P] + (hP : ∀ n, P.map (fun x => fun i : Fin (n+1) => x i) = + ((P.map (fun x => fun i : Fin n => x i)) ⊗ₘ κ n).map + (fun pair : (Fin n → O) × O => Fin.snoc (α := fun _ : Fin (n+1) => O) pair.1 pair.2)) : + (uniformTapeLaw.prod uniformTapeLaw).map p.outcomeRecord = P := by + rw [p.causal.record_law_unique κ hlaw P hP] + change (uniformTapeLaw.prod uniformTapeLaw).map (p.causal.record ∘ pairedTape) = _ + rw [← Measure.map_map p.causal.measurable_record measurable_pairedTape] + congr 1 + exact paired_tapes_law + +def publicRecord (x : ℕ → O) (n : ℕ) : M := + p.publicFrom (n+1) (fun i => x i) (Fin.last n) + +def localRecord (a : Bool) (x : ℕ → O) (n : ℕ) : O ⊕ Unit := + p.extractPrivate a (n+1) (fun i => x i) (Fin.last n) + +lemma measurable_publicRecord : Measurable p.publicRecord := by + apply Measurable.of_eval + intro n + exact ((p.measurable_publicFrom (n+1)).comp (by fun_prop)).eval (a := Fin.last n) + +lemma measurable_localRecord (a : Bool) : Measurable (p.localRecord a) := by + apply Measurable.of_eval + intro n + exact ((p.measurable_extractPrivate a (n+1)).comp (by fun_prop)).eval (a := Fin.last n) + +lemma publicRecord_replay (uv : UniformTape × UniformTape) : + p.publicRecord (p.outcomeRecord uv) = p.tapeProgram.record uv := by + funext n + have h := congrFun (p.replay_matches (n+1) uv).1 (Fin.last n) + have he : (fun i : Fin (n+1) => p.outcomeRecord uv i) = + p.causal.history (n+1) (pairedTape uv) := by + funext i + exact (p.causal.prefix_eq_record (n+1) (pairedTape uv) i).symm + change p.publicFrom (n+1) (fun i => p.outcomeRecord uv i) (Fin.last n) = _ + rw [he,h,p.tapeProgram.prefix_eq_record] + rfl + +lemma localRecord_replay (a : Bool) (uv : UniformTape × UniformTape) : + p.localRecord a (p.outcomeRecord uv) = + p.privateRecord a ((if a then uv.1 else uv.2),p.tapeProgram.record uv) := by + funext n + have h := congrFun ((p.replay_matches (n+1) uv).2 a) (Fin.last n) + have he : (fun i : Fin (n+1) => p.outcomeRecord uv i) = + p.causal.history (n+1) (pairedTape uv) := by + funext i + exact (p.causal.prefix_eq_record (n+1) (pairedTape uv) i).symm + change p.extractPrivate a (n+1) (fun i => p.outcomeRecord uv i) (Fin.last n) = _ + rw [he,h] + congr 2 + funext i + exact p.tapeProgram.prefix_eq_record (n+1) uv i + +universe v6928_0 v6928_1 + +theorem full_readout_law {A : Type v6928_0} {B : Type v6928_1} [MeasurableSpace A] [MeasurableSpace B] + (κ : (n : ℕ) → Kernel (Fin n → O) O) [∀ n, IsMarkovKernel (κ n)] + (hlaw : ∀ n s, (volume.prod volume).map (fun u => p.causal.step n (s,u)) = κ n s) + (P : Measure (ℕ → O)) [IsProbabilityMeasure P] + (hP : ∀ n, P.map (fun x => fun i : Fin (n+1) => x i) = + ((P.map (fun x => fun i : Fin n => x i)) ⊗ₘ κ n).map + (fun pair : (Fin n → O) × O => Fin.snoc (α := fun _ : Fin (n+1) => O) pair.1 pair.2)) + (readA : (ℕ → (O ⊕ Unit)) × (ℕ → M) → A) + (readB : (ℕ → (O ⊕ Unit)) × (ℕ → M) → B) + (ha : Measurable readA) (hb : Measurable readB) : + P.map (fun x => (p.publicRecord x, + readA (p.localRecord true x,p.publicRecord x), + readB (p.localRecord false x,p.publicRecord x))) = + (uniformTapeLaw.prod uniformTapeLaw).map (fun uv => (p.tapeProgram.record uv, + readA (p.privateRecord true (uv.1,p.tapeProgram.record uv),p.tapeProgram.record uv), + readB (p.privateRecord false (uv.2,p.tapeProgram.record uv),p.tapeProgram.record uv))) := by + rw [← p.outcomeRecord_law κ hlaw P hP] + have hm : Measurable (fun x => (p.publicRecord x, + readA (p.localRecord true x,p.publicRecord x), + readB (p.localRecord false x,p.publicRecord x))) := by + exact p.measurable_publicRecord.prodMk + ((ha.comp ((p.measurable_localRecord true).prodMk p.measurable_publicRecord)).prodMk + (hb.comp ((p.measurable_localRecord false).prodMk p.measurable_publicRecord))) + rw [Measure.map_map hm p.measurable_outcomeRecord] + congr 1 + funext uv + simp only [Function.comp_def,p.publicRecord_replay,p.localRecord_replay, + Bool.false_eq_true,↓reduceIte] + +universe v6957_0 v6957_1 + +theorem actual_records_independent [StandardBorelSpace O] [Nonempty M] {A : Type v6957_0} {B : Type v6957_1} + [MeasurableSpace A] [StandardBorelSpace A] [Nonempty A] + [MeasurableSpace B] [StandardBorelSpace B] [Nonempty B] + (κ : (n : ℕ) → Kernel (Fin n → O) O) [∀ n, IsMarkovKernel (κ n)] + (hlaw : ∀ n s, (volume.prod volume).map (fun u => p.causal.step n (s,u)) = κ n s) + (P : Measure (ℕ → O)) [IsProbabilityMeasure P] + (hP : ∀ n, P.map (fun x => fun i : Fin (n+1) => x i) = + ((P.map (fun x => fun i : Fin n => x i)) ⊗ₘ κ n).map + (fun pair : (Fin n → O) × O => Fin.snoc (α := fun _ : Fin (n+1) => O) pair.1 pair.2)) + (readA : (ℕ → (O ⊕ Unit)) × (ℕ → M) → A) + (readB : (ℕ → (O ⊕ Unit)) × (ℕ → M) → B) + (ha : Measurable readA) (hb : Measurable readB) : + CondIndepFun (MeasurableSpace.comap p.publicRecord inferInstance) + p.measurable_publicRecord.comap_le + (fun x => readA (p.localRecord true x,p.publicRecord x)) + (fun x => readB (p.localRecord false x,p.publicRecord x)) P := by + apply condIndepFun_of_joint_law p.measurable_publicRecord + (ha.comp ((p.measurable_localRecord true).prodMk p.measurable_publicRecord)) + (hb.comp ((p.measurable_localRecord false).prodMk p.measurable_publicRecord)) + p.tapeProgram.measurable_record + (ha.comp (((p.measurable_privateRecord true).comp + (measurable_fst.prodMk p.tapeProgram.measurable_record)).prodMk + p.tapeProgram.measurable_record)) + (hb.comp (((p.measurable_privateRecord false).comp + (measurable_snd.prodMk p.tapeProgram.measurable_record)).prodMk + p.tapeProgram.measurable_record)) + (p.full_readout_law κ hlaw P hP readA readB ha hb) + (p.final_records_independent readA readB ha hb) + +end AdaptiveOutcomeSampler + +section + +open Matrix MeasureTheory ProbabilityTheory Filter + +open scoped ComplexOrder MatrixOrder Matrix.Norms.L2Operator Kronecker Topology + +universe v7004_0 v7004_1 + +variable {ι : Type v7004_0} {η : Type v7004_1} [inst7004_0 : Fintype ι] [inst7004_1 : Fintype η] [inst7004_2 : DecidableEq ι] [inst7004_3 : DecidableEq η] + +omit inst7004_2 inst7004_3 in +lemma continuous_matrix_kronecker [DecidableEq ι] [DecidableEq η] : Continuous + (fun z : Matrix ι ι ℂ × Matrix η η ℂ => z.1 ⊗ₖ z.2) := by + apply continuous_matrix + intro i j + exact (((Matrix.entryLinearMap ℂ ℂ i.1 j.1).toContinuousLinearMap).continuous.comp + continuous_fst).mul + (((Matrix.entryLinearMap ℂ ℂ i.2 j.2).toContinuousLinearMap).continuous.comp + continuous_snd) + +universe v7015_0 + +lemma measurable_matrix_kronecker {Ω : Type v7015_0} [MeasurableSpace Ω] + {U : Ω → Matrix ι ι ℂ} {V : Ω → Matrix η η ℂ} + (hU : Measurable U) (hV : Measurable V) : + Measurable (fun x => U x ⊗ₖ V x) := + continuous_matrix_kronecker.measurable.comp (hU.prodMk hV) + +omit inst7004_2 inst7004_3 in +lemma density_kronecker [DecidableEq ι] [DecidableEq η] {U : Matrix ι ι ℂ} {V : Matrix η η ℂ} + (hU : Density U) (hV : Density V) : Density (U ⊗ₖ V) := by + refine ⟨hU.1.kronecker hV.1,?_⟩ + rw [Matrix.trace_kronecker,hU.2,hV.2,one_mul] + +universe v7027_0 + +variable {Ω : Type v7027_0} {LA LB : MeasurableSpace Ω} {mΩ : MeasurableSpace Ω} + {μ : Measure Ω} [inst7027_0 : IsFiniteMeasure μ] {F : Filtration ℕ mΩ} + +theorem local_product_reference_extension + (U : ℕ → Ω → Matrix ι ι ℂ) (V : ℕ → Ω → Matrix η η ℂ) + (hU : ∀ n x, Density (U n x)) (hV : ∀ n x, Density (V n x)) + (hLA : LA ≤ mΩ) (hLB : LB ≤ mΩ) + (hmU : ∀ n, Measurable[LA] (U n)) (hmV : ∀ n, Measurable[LB] (V n)) + (hrU : ∀ i j, Martingale (fun n x => (U n x i j).re) F μ) + (hiU : ∀ i j, Martingale (fun n x => (U n x i j).im) F μ) + (hrV : ∀ i j, Martingale (fun n x => (V n x i j).re) F μ) + (hiV : ∀ i j, Martingale (fun n x => (V n x i j).im) F μ) + (hrUV : ∀ i j, Martingale (fun n x => ((U n x ⊗ₖ V n x) i j).re) F μ) + (hiUV : ∀ i j, Martingale (fun n x => ((U n x ⊗ₖ V n x) i j).im) F μ) : + ∃ G : Ω → Matrix ι ι ℂ, ∃ H : Ω → Matrix η η ℂ, + Measurable[LA] G ∧ Measurable[LB] H ∧ + (∀ x, Density (G x)) ∧ (∀ x, Density (H x)) ∧ + (∀ᵐ x ∂μ, Tendsto (fun n => U n x) atTop (𝓝 (G x))) ∧ + (∀ᵐ x ∂μ, Tendsto (fun n => V n x) atTop (𝓝 (H x))) ∧ + (∀ n S, MeasurableSet[F n] S → + (∫ x in S, G x ∂μ) = ∫ x in S, U n x ∂μ) ∧ + (∀ n S, MeasurableSet[F n] S → + (∫ x in S, H x ∂μ) = ∫ x in S, V n x ∂μ) ∧ + ∃ W : PositiveMatrixMeasure Ω (ι × η), + (∀ S, MeasurableSet S → W.value S = ∫ x in S, G x ⊗ₖ H x ∂μ) ∧ + (∀ n S, MeasurableSet[F n] S → + W.value S = ∫ x in S, U n x ⊗ₖ V n x ∂μ) := by + obtain ⟨G,hGm,hG,hGi,hGt,hGc⟩ := local_reference_limit U hU hmU hLA hrU hiU + obtain ⟨H,hHm,hH,hHi,hHt,hHc⟩ := local_reference_limit V hV hmV hLB hrV hiV + obtain ⟨J,hJm,hJ,hJi,hJt,hJc⟩ := local_reference_limit + (fun n x => U n x ⊗ₖ V n x) + (fun n x => density_kronecker (hU n x) (hV n x)) + (fun n => measurable_matrix_kronecker ((hmU n).mono hLA le_rfl) + ((hmV n).mono hLB le_rfl)) le_rfl hrUV hiUV + have hprod : (fun x => G x ⊗ₖ H x) =ᵐ[μ] J := by + filter_upwards [hGt,hHt,hJt] with x hx hy hz + have ht : Tendsto (fun n => U n x ⊗ₖ V n x) atTop (𝓝 (G x ⊗ₖ H x)) := + continuous_matrix_kronecker.continuousAt.tendsto.comp (hx.prodMk_nhds hy) + exact tendsto_nhds_unique ht hz + let W := positiveMatrixMeasureOfDensity hJi + (Eventually.of_forall (fun x => (hJ x).1)) + refine ⟨G,H,hGm,hHm,hG,hH,hGt,hHt,hGc,hHc,W,?_,?_⟩ + · intro S hS + rw [positiveMatrixMeasureOfDensity_value hJi _ S hS] + exact integral_congr_ae (ae_restrict_of_ae hprod.symm) + · intro n S hS + rw [positiveMatrixMeasureOfDensity_value hJi _ S (F.le n S hS)] + exact hJc n S hS + +end + +section + +open Matrix MeasureTheory ProbabilityTheory Filter unitInterval + +open scoped ComplexOrder MatrixOrder Matrix.Norms.L2Operator Kronecker Topology + +namespace AdaptiveOutcomeSampler + +universe v7093_0 v7093_1 + +variable {O : Type v7093_0} {M : Type v7093_1} [inst7093_0 : MeasurableSpace O] [inst7093_1 : MeasurableSpace M] + (p : AdaptiveOutcomeSampler O M) + +lemma publicFrom_eq_record (n : ℕ) (x : ℕ → O) (i : Fin n) : + p.publicFrom n (historyPrefix n x) i = p.publicRecord x i := by + induction n with + | zero => exact Fin.elim0 i + | succ n ih => + refine Fin.lastCases ?_ (fun j => ?_) i + · rfl + · simp only [publicFrom,replay,Fin.snoc_castSucc] + exact ih j + +lemma extractPrivate_eq_record (a : Bool) (n : ℕ) (x : ℕ → O) (i : Fin n) : + p.extractPrivate a n (historyPrefix n x) i = p.localRecord a x i := by + induction n with + | zero => exact Fin.elim0 i + | succ n ih => + refine Fin.lastCases ?_ (fun j => ?_) i + · rfl + · cases a <;> simp only [extractPrivate,replay,Bool.false_eq_true,↓reduceIte, + Fin.snoc_castSucc] <;> exact ih j + +abbrev localField (a : Bool) : MeasurableSpace (ℕ → O) := + MeasurableSpace.comap (fun x => (p.localRecord a x,p.publicRecord x)) inferInstance + +lemma localField_le (a : Bool) : p.localField a ≤ (inferInstance : MeasurableSpace (ℕ → O)) := + ((p.measurable_localRecord a).prodMk p.measurable_publicRecord).comap_le + +lemma local_history_measurable (a : Bool) (n : ℕ) : + Measurable[p.localField a] (fun x => + (p.extractPrivate a n (historyPrefix n x),p.publicFrom n (historyPrefix n x))) := by + have he : (fun x => (p.extractPrivate a n (historyPrefix n x),p.publicFrom n (historyPrefix n x))) = + fun x => ((fun i : Fin n => p.localRecord a x i),fun i : Fin n => p.publicRecord x i) := by + funext x + congr 1 <;> funext i + · exact p.extractPrivate_eq_record a n x i + · exact p.publicFrom_eq_record n x i + rw [he] + let : MeasurableSpace (ℕ → O) := p.localField a + have hm : Measurable (fun x : ℕ → O => (p.localRecord a x,p.publicRecord x)) := + Measurable.of_comap_le le_rfl + exact (Measurable.of_eval (fun i => hm.fst.eval)).prodMk + (Measurable.of_eval (fun i => hm.snd.eval)) + +lemma localFields_independent [StandardBorelSpace O] [Nonempty O] + [StandardBorelSpace M] [Nonempty M] + (κ : (n : ℕ) → Kernel (Fin n → O) O) [∀ n, IsMarkovKernel (κ n)] + (hlaw : ∀ n s, ((volume : Measure I).prod volume).map + (fun u => p.causal.step n (s,u)) = κ n s) + (P : Measure (ℕ → O)) [IsProbabilityMeasure P] + (hP : ∀ n, P.map (historyPrefix (n+1)) = + ((P.map (historyPrefix n)) ⊗ₘ κ n).map + (fun pair : (Fin n → O) × O => Fin.snoc (α := fun _ : Fin (n+1) => O) pair.1 pair.2)) : + CondIndep (MeasurableSpace.comap p.publicRecord inferInstance) + (p.localField true) (p.localField false) p.measurable_publicRecord.comap_le P := by + classical + rw [condIndep_iff _ _ _ _ (p.localField_le true) (p.localField_le false)] + intro SA SB hSA hSB + obtain ⟨EA,hEA,rfl⟩ := hSA + obtain ⟨EB,hEB,rfl⟩ := hSB + let fa : (ℕ → O ⊕ Unit) × (ℕ → M) → Bool := + fun x => if x ∈ EA then true else false + let fb : (ℕ → O ⊕ Unit) × (ℕ → M) → Bool := + fun x => if x ∈ EB then true else false + have hfa : Measurable fa := measurable_const.ite hEA measurable_const + have hfb : Measurable fb := measurable_const.ite hEB measurable_const + have hi := p.actual_records_independent κ hlaw P hP fa fb hfa hfb + apply (condIndepFun_iff _ _ _ _ + (hfa.comp ((p.measurable_localRecord true).prodMk p.measurable_publicRecord)) + (hfb.comp ((p.measurable_localRecord false).prodMk p.measurable_publicRecord)) P).mp hi + · refine ⟨{true},measurableSet_singleton true,?_⟩ + ext x + simp [fa] + · refine ⟨{true},measurableSet_singleton true,?_⟩ + ext x + simp [fb] + +end AdaptiveOutcomeSampler + +namespace AdaptiveQuantum + +open UnrestrictedQuantum + +universe v7175_0 v7175_1 v7175_2 v7175_3 v7175_4 v7175_5 + +variable {O : Type v7175_0} {M : Type v7175_1} {ι : Type v7175_2} {η : Type v7175_3} [inst7175_0 : MeasurableSpace O] [inst7175_1 : MeasurableSpace M] + [inst7175_2 : Fintype ι] [inst7175_3 : Fintype η] [inst7175_4 : DecidableEq ι] [inst7175_5 : DecidableEq η] + {A : ℕ → Type v7175_4} {B : ℕ → Type v7175_5} + [inst7175_6 : ∀ n, AddCommGroup (A n)] [inst7175_7 : ∀ n, Module ℂ (A n)] [inst7175_8 : ∀ n, One (A n)] [inst7175_9 : ∀ n, LE (A n)] + [inst7175_10 : ∀ n, AddCommGroup (B n)] [inst7175_11 : ∀ n, Module ℂ (B n)] [inst7175_12 : ∀ n, One (B n)] [inst7175_13 : ∀ n, LE (B n)] + (p : AdaptiveOutcomeSampler O M) + (κA κB : (n : ℕ) → Kernel (LocalHistory O M n) O) + [inst7175_14 : ∀ n, IsMarkovKernel (κA n)] [inst7175_15 : ∀ n, IsMarkovKernel (κB n)] + (eA : LocalObservableExecution (ι := ι) A κA p.sendA) + (eB : LocalObservableExecution (ι := η) B κB p.sendB) + +theorem full_reference_extension + (P : Measure (ℕ → O)) [IsProbabilityMeasure P] + (hP : ∀ n, P.map (historyPrefix (n+1)) = + ((P.map (historyPrefix n)) ⊗ₘ p.instrumentKernel κA κB n).map + (fun pair : (Fin n → O) × O => Fin.snoc (α := fun _ : Fin (n+1) => O) pair.1 pair.2)) : + ∃ G : (ℕ → O) → Matrix ι ι ℂ, ∃ H : (ℕ → O) → Matrix η η ℂ, + Measurable[p.localField true] G ∧ Measurable[p.localField false] H ∧ + (∀ x, Density (G x)) ∧ (∀ x, Density (H x)) ∧ + (∀ n S, MeasurableSet[historyFiltration n] S → + (∫ x in S, G x ∂P) = ∫ x in S, globalLocalReferenceA p κA eA n (historyPrefix n x) ∂P) ∧ + (∀ n S, MeasurableSet[historyFiltration n] S → + (∫ x in S, H x ∂P) = ∫ x in S, globalLocalReferenceB p κB eB n (historyPrefix n x) ∂P) ∧ + ∃ W : PositiveMatrixMeasure (ℕ → O) (ι × η), + (∀ S, MeasurableSet S → W.value S = ∫ x in S, G x ⊗ₖ H x ∂P) ∧ + (∀ n S, MeasurableSet[historyFiltration n] S → + W.value S = ∫ x in S, jointReference p κA κB eA eB n (historyPrefix n x) ∂P) := by + let U := globalLocalReferenceA p κA eA + let V := globalLocalReferenceB p κB eB + have hU (n : ℕ) (s : Fin n → O) : Density (U n s) := eA.reference_density n _ + have hV (n : ℕ) (s : Fin n → O) : Density (V n s) := eB.reference_density n _ + have hmU := globalLocalReferenceA_measurable p κA eA + have hmV := globalLocalReferenceB_measurable p κB eB + have hmeanU := globalLocalReferenceA_mean p κA κB eA + have hmeanV := globalLocalReferenceB_mean p κA κB eB + have hrU := reference_history_martingale_re P (p.instrumentKernel κA κB) hP U hU hmU hmeanU + have hiU := reference_history_martingale_im P (p.instrumentKernel κA κB) hP U hU hmU hmeanU + have hrV := reference_history_martingale_re P (p.instrumentKernel κA κB) hP V hV hmV hmeanV + have hiV := reference_history_martingale_im P (p.instrumentKernel κA κB) hP V hV hmV hmeanV + have hrUV := reference_history_martingale_re P (p.instrumentKernel κA κB) hP + (jointReference p κA κB eA eB) (jointReference_density p κA κB eA eB) + (jointReference_measurable p κA κB eA eB) (jointReference_mean p κA κB eA eB) + have hiUV := reference_history_martingale_im P (p.instrumentKernel κA κB) hP + (jointReference p κA κB eA eB) (jointReference_density p κA κB eA eB) + (jointReference_measurable p κA κB eA eB) (jointReference_mean p κA κB eA eB) + obtain ⟨G,H,hGm,hHm,hG,hH,_,_,hGc,hHc,W,hW,hWc⟩ := + local_product_reference_extension + (fun n x => U n (historyPrefix n x)) (fun n x => V n (historyPrefix n x)) + (fun n x => hU n _) (fun n x => hV n _) (p.localField_le true) (p.localField_le false) + (fun n => (eA.reference_measurable n).comp (p.local_history_measurable true n)) + (fun n => (eB.reference_measurable n).comp (p.local_history_measurable false n)) + hrU hiU hrV hiV hrUV hiUV + exact ⟨G,H,hGm,hHm,hG,hH,hGc,hHc,W,hW,hWc⟩ + +end AdaptiveQuantum + +end + +section + +open MeasureTheory ProbabilityTheory Matrix + +open scoped ComplexOrder MatrixOrder Matrix.Norms.L2Operator Kronecker + +universe v7253_0 + +lemma condIndepFun_ae_indep_complex {Ω : Type v7253_0} {C : MeasurableSpace Ω} + {mΩ : MeasurableSpace Ω} [inst7253_0 : StandardBorelSpace Ω] {μ : Measure Ω} + [inst7253_1 : IsFiniteMeasure μ] (hC : C ≤ mΩ) + {f g : Ω → ℂ} + (hf : Measurable f) (hg : Measurable g) + (h : CondIndepFun C hC f g μ) : + ∀ᵐ x ∂μ.trim hC, IndepFun f g (condExpKernel μ C x) := by + have he := (condIndepFun_iff_map_prod_eq_prod_map_map hf hg).mp h + filter_upwards [he] with x hx + apply (indepFun_iff_map_prod_eq_prod_map_map hf.aemeasurable hg.aemeasurable).mpr + simpa only [Kernel.prod_apply, Kernel.map_apply _ (hf.prodMk hg), + Kernel.map_apply _ hf, Kernel.map_apply _ hg] using hx + +lemma condIndepFun_kernel_integral_mul {Ω : Type v7253_0} {C : MeasurableSpace Ω} + {mΩ : MeasurableSpace Ω} [inst7253_0 : StandardBorelSpace Ω] {μ : Measure Ω} + [inst7253_1 : IsFiniteMeasure μ] (hC : C ≤ mΩ) + {f g : Ω → ℂ} + (hf : Measurable f) (hg : Measurable g) + (h : CondIndepFun C hC f g μ) : + ∀ᵐ x ∂μ.trim hC, + (∫ y, f y * g y ∂condExpKernel μ C x) = + (∫ y, f y ∂condExpKernel μ C x) * + (∫ y, g y ∂condExpKernel μ C x) := by + filter_upwards [condIndepFun_ae_indep_complex hC hf hg h] with x hx + exact hx.integral_fun_mul_eq_mul_integral hf.stronglyMeasurable.aestronglyMeasurable + hg.stronglyMeasurable.aestronglyMeasurable + +universe v7283_0 v7283_1 v7283_2 + +variable {Ω : Type v7283_0} {ι : Type v7283_1} {κ : Type v7283_2} {C A B : MeasurableSpace Ω} {mΩ : MeasurableSpace Ω} + [inst7283_0 : StandardBorelSpace Ω] [inst7283_1 : Fintype ι] [inst7283_2 : Fintype κ] [inst7283_3 : DecidableEq ι] [inst7283_4 : DecidableEq κ] + {μ : Measure Ω} [inst7283_5 : IsFiniteMeasure μ] + +def publicMatrix (C : MeasurableSpace Ω) {mΩ : MeasurableSpace Ω} + [StandardBorelSpace Ω] (μ : Measure Ω) [IsFiniteMeasure μ] + (W : Ω → Matrix ι ι ℂ) (x : Ω) : Matrix ι ι ℂ := + ∫ y, W y ∂condExpKernel μ C x + +lemma publicMatrix_measurable (_hC : C ≤ mΩ) {W : Ω → Matrix ι ι ℂ} + (hW : Measurable W) : Measurable[C] (publicMatrix C μ W) := by + exact hW.stronglyMeasurable.integral_condExpKernel.measurable + +lemma publicMatrix_entry (W : Ω → Matrix ι ι ℂ) + (hWi : ∀ x, Integrable W (condExpKernel μ C x)) (x : Ω) (i j : ι) : + publicMatrix C μ W x i j = ∫ y, W y i j ∂condExpKernel μ C x := + integral_matrix_entry (hWi x) i j + +theorem condIndep_publicMatrix_kronecker + (hC : C ≤ mΩ) (hA : A ≤ mΩ) (hB : B ≤ mΩ) + (h : CondIndep C A B hC μ) + (U : Ω → Matrix ι ι ℂ) (V : Ω → Matrix κ κ ℂ) + (hUm : Measurable[A] U) (hVm : Measurable[B] V) + (hUi : ∀ x, Integrable U (condExpKernel μ C x)) + (hVi : ∀ x, Integrable V (condExpKernel μ C x)) + (hUVi : ∀ x, Integrable (fun y => U y ⊗ₖ V y) (condExpKernel μ C x)) : + publicMatrix C μ (fun y => U y ⊗ₖ V y) =ᵐ[μ.trim hC] + fun x => publicMatrix C μ U x ⊗ₖ publicMatrix C μ V x := by + have he (i j : ι) (k l : κ) : + ∀ᵐ x ∂μ.trim hC, + (∫ y, U y i j * V y k l ∂condExpKernel μ C x) = + (∫ y, U y i j ∂condExpKernel μ C x) * + (∫ y, V y k l ∂condExpKernel μ C x) := by + have huf : Measurable[A] (fun y => U y i j) := + ((Matrix.entryLinearMap ℂ ℂ i j).toContinuousLinearMap).measurable.comp hUm + have hvf : Measurable[B] (fun y => V y k l) := + ((Matrix.entryLinearMap ℂ ℂ k l).toContinuousLinearMap).measurable.comp hVm + have hfg : CondIndepFun C hC (fun y => U y i j) (fun y => V y k l) μ := by + exact condIndep_of_condIndep_of_le_right + (condIndep_of_condIndep_of_le_left h huf.comap_le) hvf.comap_le + exact condIndepFun_kernel_integral_mul hC (huf.mono hA le_rfl) + (hvf.mono hB le_rfl) hfg + have he' := ae_all_iff.mpr (fun i => ae_all_iff.mpr (fun j => + ae_all_iff.mpr (fun k => ae_all_iff.mpr (he i j k)))) + filter_upwards [he'] with x hx + ext ⟨i,k⟩ ⟨j,l⟩ + rw [publicMatrix_entry _ hUVi, Matrix.kronecker_apply, + publicMatrix_entry _ hUi, publicMatrix_entry _ hVi] + exact hx i j k l + +end + +section + +open Matrix MeasureTheory ProbabilityTheory + +open scoped ComplexOrder MatrixOrder Matrix.Norms.L2Operator Kronecker + +universe v7361_0 v7361_1 + +variable {ι : Type v7361_0} {η : Type v7361_1} [inst7361_0 : Fintype ι] [inst7361_1 : Fintype η] [inst7361_2 : DecidableEq ι] [inst7361_3 : DecidableEq η] + +def Subdensity (U : Matrix ι ι ℂ) : Prop := U.PosSemidef ∧ (trace U).re ≤ 1 + +omit inst7361_2 in +lemma subdensity_zero [DecidableEq ι] : Subdensity (0 : Matrix ι ι ℂ) := by + exact ⟨Matrix.PosSemidef.zero, by simp⟩ + +omit inst7361_2 inst7361_3 in +lemma subdensity_kronecker [DecidableEq ι] [DecidableEq η] {U : Matrix ι ι ℂ} {V : Matrix η η ℂ} + (hU : Subdensity U) (hV : Subdensity V) : Subdensity (U ⊗ₖ V) := by + refine ⟨hU.1.kronecker hV.1,?_⟩ + have hUi : (trace U).im = 0 := (RCLike.nonneg_iff.mp hU.1.trace_nonneg).2 + have hVi : (trace V).im = 0 := (RCLike.nonneg_iff.mp hV.1.trace_nonneg).2 + rw [Matrix.trace_kronecker, Complex.mul_re,hUi,hVi,mul_zero,sub_zero] + exact (mul_le_of_le_one_left ((RCLike.nonneg_iff.mp hV.1.trace_nonneg).1) hU.2).trans hV.2 + +universe v7376_0 + +lemma integrable_subdensity {Ω : Type v7376_0} [MeasurableSpace Ω] + (U : Ω → Matrix ι ι ℂ) (hU : ∀ x, Subdensity (U x)) (hm : Measurable U) + (μ : Measure Ω) [IsFiniteMeasure μ] : Integrable U μ := by + apply integrable_matrix_of_entries + intro i j + apply Integrable.of_bound + (((Matrix.entryLinearMap ℂ ℂ i j).toContinuousLinearMap).measurable.comp hm).aestronglyMeasurable 1 + exact Filter.Eventually.of_forall (fun x => + (psd_entry_norm_le_trace (hU x).1 i j).trans (hU x).2) + +universe v7386_0 + +lemma integral_subdensity {Ω : Type v7386_0} [MeasurableSpace Ω] + (U : Ω → Matrix ι ι ℂ) (hU : ∀ x, Subdensity (U x)) (hm : Measurable U) + (μ : Measure Ω) [IsProbabilityMeasure μ] : Subdensity (∫ x, U x ∂μ) := by + have hi := integrable_subdensity U hU hm μ + refine ⟨(integral_nonneg_of_ae (Filter.Eventually.of_forall + (fun x => (hU x).1.nonneg))).posSemidef,?_⟩ + let L : Matrix ι ι ℂ →L[ℂ] ℂ := (Matrix.traceLinearMap ι ℂ ℂ).toContinuousLinearMap + have htrace : trace (∫ x, U x ∂μ) = ∫ x, trace (U x) ∂μ := (L.integral_comp_comm hi).symm + rw [htrace] + change RCLike.re (∫ x, L (U x) ∂μ) ≤ 1 + rw [← integral_re (L.integrable_comp hi)] + calc + _ ≤ ∫ _ : Ω, (1 : ℝ) ∂μ := integral_mono ((L.integrable_comp hi).re) + (integrable_const 1) (fun x => (hU x).2) + _ = 1 := by simp + +universe v7402_0 v7402_1 + +lemma measurable_positive_factor {Ω : Type v7402_0} {T : Type v7402_1} [MeasurableSpace Ω] + [MeasurableSpace T] (r : Ω → T) + (U : Ω → Matrix ι ι ℂ) (hU : ∀ x, Subdensity (U x)) + (hm : Measurable[MeasurableSpace.comap r inferInstance] U) : + ∃ V : T → Matrix ι ι ℂ, Measurable V ∧ (∀ t, Subdensity (V t)) ∧ U = V ∘ r := by + classical + obtain ⟨V,hVm,hV⟩ := hm.exists_eq_measurable_comp + let good : Set T := {t | 0 ≤ V t ∧ (trace (V t)).re ≤ 1} + have hg : MeasurableSet good := + (measurableSet_le measurable_const hVm).inter + (measurableSet_le (((Matrix.traceLinearMap ι ℂ ℂ).toContinuousLinearMap).measurable.comp hVm).re measurable_const) + let W : T → Matrix ι ι ℂ := good.piecewise V (fun _ => 0) + refine ⟨W,hVm.piecewise hg measurable_const,?_,?_⟩ + · intro t + by_cases ht : t ∈ good + · simpa only [W,Set.piecewise_eq_of_mem good V _ ht] using + (show Subdensity (V t) from ⟨ht.1.posSemidef,ht.2⟩) + · simpa only [W,Set.piecewise_eq_of_notMem good V _ ht] using subdensity_zero (ι := ι) + · funext x + have he : U x = V (r x) := congrFun hV x + have hgx : r x ∈ good := by + change 0 ≤ V (r x) ∧ (trace (V (r x))).re ≤ 1 + rw [← he] + exact ⟨(hU x).1.nonneg,(hU x).2⟩ + simpa only [Function.comp_apply,W,Set.piecewise_eq_of_mem good V _ hgx] using he + +universe v7429_0 v7429_1 + +variable {Ω : Type v7429_0} {T : Type v7429_1} {A B : MeasurableSpace Ω} {mΩ : MeasurableSpace Ω} + [inst7429_0 : StandardBorelSpace Ω] [inst7429_1 : MeasurableSpace T] + {μ : Measure Ω} [inst7429_2 : IsFiniteMeasure μ] + (r : Ω → T) (hr : Measurable r) + +theorem terminal_public_factors + (hA : A ≤ mΩ) (hB : B ≤ mΩ) + (h : CondIndep (MeasurableSpace.comap r inferInstance) A B hr.comap_le μ) + (U : Bool → Ω → Matrix ι ι ℂ) (V : Bool → Ω → Matrix η η ℂ) + (hU : ∀ i x, Subdensity (U i x)) (hV : ∀ j x, Subdensity (V j x)) + (hmU : ∀ i, Measurable[A] (U i)) (hmV : ∀ j, Measurable[B] (V j)) : + ∃ X : Bool → T → Matrix ι ι ℂ, ∃ Y : Bool → T → Matrix η η ℂ, + (∀ i, Measurable (X i)) ∧ (∀ j, Measurable (Y j)) ∧ + (∀ i t, Subdensity (X i t)) ∧ (∀ j t, Subdensity (Y j t)) ∧ + (∀ i j, publicMatrix (MeasurableSpace.comap r inferInstance) μ + (fun x => U i x ⊗ₖ V j x) =ᵐ[μ] + fun x => X i (r x) ⊗ₖ Y j (r x)) := by + have hUm (i : Bool) := (hmU i).mono hA le_rfl + have hVm (j : Bool) := (hmV j).mono hB le_rfl + have hpU (i : Bool) : ∀ x, Subdensity (publicMatrix (MeasurableSpace.comap r inferInstance) μ (U i) x) := + fun x => integral_subdensity (U i) (hU i) (hUm i) (condExpKernel μ (MeasurableSpace.comap r inferInstance) x) + have hpV (j : Bool) : ∀ x, Subdensity (publicMatrix (MeasurableSpace.comap r inferInstance) μ (V j) x) := + fun x => integral_subdensity (V j) (hV j) (hVm j) (condExpKernel μ (MeasurableSpace.comap r inferInstance) x) + choose X hXm hXp hX using fun i => measurable_positive_factor r + (publicMatrix (MeasurableSpace.comap r inferInstance) μ (U i)) (hpU i) (publicMatrix_measurable hr.comap_le (hUm i)) + choose Y hYm hYp hY using fun j => measurable_positive_factor r + (publicMatrix (MeasurableSpace.comap r inferInstance) μ (V j)) (hpV j) (publicMatrix_measurable hr.comap_le (hVm j)) + refine ⟨X,Y,hXm,hYm,hXp,hYp,?_⟩ + intro i j + have he := condIndep_publicMatrix_kronecker hr.comap_le hA hB h + (U i) (V j) (hmU i) (hmV j) + (fun x => integrable_subdensity (U i) (hU i) (hUm i) (condExpKernel μ (MeasurableSpace.comap r inferInstance) x)) + (fun x => integrable_subdensity (V j) (hV j) (hVm j) (condExpKernel μ (MeasurableSpace.comap r inferInstance) x)) + (fun x => integrable_subdensity (fun y => U i y ⊗ₖ V j y) + (fun y => subdensity_kronecker (hU i y) (hV j y)) + (measurable_matrix_kronecker (hUm i) (hVm j)) (condExpKernel μ (MeasurableSpace.comap r inferInstance) x)) + have he' := ae_of_ae_trim hr.comap_le he + filter_upwards [he'] with x hx + exact hx.trans (by rw [congrFun (hX i) x,congrFun (hY j) x]; rfl) + +end + +open MeasureTheory Matrix Filter + +open scoped ComplexOrder MatrixOrder + +namespace PositiveMatrixMeasure + +universe v7485_0 v7485_1 + +variable {Ω : Type v7485_0} {ι : Type v7485_1} {mΩ : MeasurableSpace Ω} [inst7485_0 : Fintype ι] [inst7485_1 : DecidableEq ι] + +omit inst7485_1 in +lemma ext_on_generating_piSystem [DecidableEq ι] (W V : PositiveMatrixMeasure Ω ι) (C : Set (Set Ω)) + (hC : IsPiSystem C) (hm : mΩ = MeasurableSpace.generateFrom C) + (h : ∀ S ∈ C, W.value S = V.value S) (hu : W.value Set.univ = V.value Set.univ) : W = V := by + have he : W.entry = V.entry := by + funext i j + refine VectorMeasure.ext_of_generateFrom C ?_ hm hC ?_ + · intro S hS + exact congrArg (fun M : Matrix ι ι ℂ => M i j) (h S hS) + · exact congrArg (fun M : Matrix ι ι ℂ => M i j) hu + cases W + cases V + cases he + rfl + +lemma ext_on_filtration (W V : PositiveMatrixMeasure Ω ι) (F : Filtration ℕ mΩ) + (hm : mΩ = ⨆ n, F n) + (h : ∀ n S, MeasurableSet[F n] S → W.value S = V.value S) : W = V := by + let C : Set (Set Ω) := {S | ∃ n, MeasurableSet[F n] S} + have hc : IsPiSystem C := by + intro S hS T hT _ + obtain ⟨n,hn⟩ := hS + obtain ⟨k,hk⟩ := hT + exact ⟨max n k, ((F.mono (le_max_left n k)) S hn).inter ((F.mono (le_max_right n k)) T hk)⟩ + have hgen : mΩ = MeasurableSpace.generateFrom C := by + rw [hm] + apply le_antisymm + · apply iSup_le; intro n S hS + exact MeasurableSpace.measurableSet_generateFrom ⟨n,hS⟩ + · apply MeasurableSpace.generateFrom_le + rintro S ⟨n,hn⟩ + exact (le_iSup (fun n => F n) n) S hn + exact W.ext_on_generating_piSystem V C hc hgen (fun S ⟨n,hn⟩ => h n S hn) + (h 0 Set.univ MeasurableSet.univ) + +end PositiveMatrixMeasure + +end ZeroKey + +namespace UnrestrictedQuantum + +open Matrix MeasureTheory + +open scoped ComplexOrder MatrixOrder Matrix.Norms.L2Operator + +universe v7551_0 v7551_1 v7551_2 + +variable {A : Type v7551_0} {B : Type v7551_1} {ι : Type v7551_2} [inst7551_0 : AddCommGroup A] [inst7551_1 : Module ℂ A] [inst7551_2 : One A] [inst7551_3 : LE A] + [inst7551_4 : AddCommGroup B] [inst7551_5 : Module ℂ B] [inst7551_6 : One B] [inst7551_7 : LE B] + [inst7551_8 : Fintype ι] [inst7551_9 : DecidableEq ι] + (J : ObservableInstrument Bool A B) (S : ReferenceFunctional A ι) + (r : InstrumentRun J S) + +def bitReference (i : Bool) : Matrix ι ι ℂ := S (J.operation {i} 1) + +omit inst7551_8 inst7551_9 in +lemma bitReference_positive [Fintype ι] [DecidableEq ι] (hS : PositiveFunctional S) (h1 : (0 : B) ≤ 1) + (i : Bool) : (bitReference J S i).PosSemidef := + hS _ (J.positive {i} (measurableSet_singleton i) 1 h1) + +omit inst7551_9 in +lemma bitReference_entry [DecidableEq ι] (i : Bool) (k l : ι) : + bitReference J S i k l = ∫ b in {i}, r.posterior b 1 k l ∂r.law := + (r.update {i} (measurableSet_singleton i) 1 k l).symm + +include r in +theorem bitReference_sum : bitReference J S false + bitReference J S true = S 1 := by + ext k l + rw [Matrix.add_apply, bitReference_entry J S r false, + bitReference_entry J S r true] + have hd : Disjoint ({false} : Set Bool) {true} := by simp + have hu : ({false} : Set Bool) ∪ {true} = Set.univ := by + ext b; cases b <;> simp + rw [← setIntegral_union hd (measurableSet_singleton true) + (r.integrable 1 k l).integrableOn (r.integrable 1 k l).integrableOn, hu, + Measure.restrict_univ] + exact InstrumentRun.reference_mean J S r k l + +end UnrestrictedQuantum + +section + +open Matrix MeasureTheory ProbabilityTheory + +open scoped ComplexOrder MatrixOrder Matrix.Norms.L2Operator Kronecker + +namespace ZeroKey + +universe v7614_0 v7614_1 + +variable {Ω : Type v7614_0} {ι : Type v7614_1} [inst7614_0 : Fintype ι] [inst7614_1 : DecidableEq ι] + {L : MeasurableSpace Ω} {mΩ : MeasurableSpace Ω} + {μ : Measure Ω} [inst7614_2 : IsFiniteMeasure μ] + +omit inst7614_1 in +lemma density_subdensity [DecidableEq ι] {U : Matrix ι ι ℂ} (hU : Density U) : Subdensity U := + ⟨hU.1,by rw [hU.2]; norm_num⟩ + +theorem reference_density_unique_on_filtration (F : Filtration ℕ mΩ) + (hgen : mΩ = ⨆ n, F n) + (U V : Ω → Matrix ι ι ℂ) + (hU : ∀ x, Subdensity (U x)) (hV : ∀ x, Subdensity (V x)) + (hmU : Measurable U) (hmV : Measurable V) + (hEq : ∀ n S, MeasurableSet[F n] S → + (∫ x in S, U x ∂μ) = ∫ x in S, V x ∂μ) : U =ᵐ[μ] V := by + have hUi := integrable_subdensity U hU hmU μ + have hVi := integrable_subdensity V hV hmV μ + have hUe (i j : ι) : Integrable (fun x => U x i j) μ := + ((Matrix.entryLinearMap ℂ ℂ i j).toContinuousLinearMap).integrable_comp hUi + have hVe (i j : ι) : Integrable (fun x => V x i j) μ := + ((Matrix.entryLinearMap ℂ ℂ i j).toContinuousLinearMap).integrable_comp hVi + let P := positiveMatrixMeasureOfDensity hUe + (Filter.Eventually.of_forall (fun x => (hU x).1)) + let Q := positiveMatrixMeasureOfDensity hVe + (Filter.Eventually.of_forall (fun x => (hV x).1)) + have hpq : P = Q := by + apply PositiveMatrixMeasure.ext_on_filtration P Q F hgen + intro n S hS + dsimp only [P,Q] + rw [positiveMatrixMeasureOfDensity_value hUe _ S (F.le n S hS), + positiveMatrixMeasureOfDensity_value hVe _ S (F.le n S hS)] + exact hEq n S hS + apply Integrable.ae_eq_of_forall_setIntegral_eq U V hUi hVi + intro S hS _ + have he := congrArg (fun P : PositiveMatrixMeasure Ω ι => P.value S) hpq + dsimp only [P,Q] at he + simpa only [positiveMatrixMeasureOfDensity_value hUe _ S hS, + positiveMatrixMeasureOfDensity_value hVe _ S hS] using he + +end ZeroKey + +namespace UnrestrictedQuantum + +universe v7657_0 v7657_1 v7657_2 v7657_3 + +variable {Ω : Type v7657_0} {ι : Type v7657_1} {A : Type v7657_2} {B : Type v7657_3} [inst7657_0 : Fintype ι] [inst7657_1 : DecidableEq ι] + {L : MeasurableSpace Ω} {mΩ : MeasurableSpace Ω} + [inst7657_2 : AddCommGroup A] [inst7657_3 : Module ℂ A] [inst7657_4 : One A] [inst7657_5 : LE A] + [inst7657_6 : AddCommGroup B] [inst7657_7 : Module ℂ B] [inst7657_8 : One B] [inst7657_9 : LE B] + (μ : Measure Ω) (F : Filtration ℕ mΩ) + (U : ℕ → Ω → Matrix ι ι ℂ) + +structure IncomingObservableProcess where + state : Ω → ReferenceFunctional A ι + positive : ∀ x, PositiveFunctional (state x) + positive_unit : (0 : A) ≤ 1 + normalized : ∀ x, trace (state x 1) = 1 + local_measurable : Measurable[L] (fun x => state x 1) + causality : ∀ n S, MeasurableSet[F n] S → + (∫ x in S, state x 1 ∂μ) = ∫ x in S, U n x ∂μ + +namespace IncomingObservableProcess + +variable {μ F U} (e : IncomingObservableProcess (L := L) (A := A) μ F U) + +lemma reference_density (x : Ω) : ZeroKey.Density (e.state x 1) := + ⟨e.positive x 1 e.positive_unit,e.normalized x⟩ + +structure BitReadout where + instrument : Ω → ObservableInstrument Bool A B + run : ∀ x, InstrumentRun (instrument x) (e.state x) + positive_unit : (0 : B) ≤ 1 + local_measurable : ∀ i, Measurable[L] (fun x => bitReference (instrument x) (e.state x) i) + +namespace BitReadout + +variable {e} + +variable (b : e.BitReadout (B := B)) + +def value (i : Bool) (x : Ω) : Matrix ι ι ℂ := bitReference (b.instrument x) (e.state x) i + +lemma positive (i : Bool) (x : Ω) : (b.value i x).PosSemidef := + bitReference_positive (b.instrument x) (e.state x) (e.positive x) b.positive_unit i + +lemma sum (x : Ω) : b.value false x + b.value true x = e.state x 1 := + bitReference_sum (b.instrument x) (e.state x) (b.run x) + +lemma subdensity (i : Bool) (x : Ω) : ZeroKey.Subdensity (b.value i x) := by + refine ⟨b.positive i x,?_⟩ + have hsum := congrArg (fun M : Matrix ι ι ℂ => (trace M).re) (b.sum x) + rw [Matrix.trace_add,Complex.add_re,e.normalized x,Complex.one_re] at hsum + have h0 := (RCLike.nonneg_iff.mp (b.positive false x).trace_nonneg).1 + have h1 := (RCLike.nonneg_iff.mp (b.positive true x).trace_nonneg).1 + change 0 ≤ (trace (b.value false x)).re at h0 + change 0 ≤ (trace (b.value true x)).re at h1 + cases i <;> linarith + +lemma measurable (i : Bool) : Measurable[L] (b.value i) := b.local_measurable i + +end BitReadout + +end IncomingObservableProcess + +end UnrestrictedQuantum + +end + +namespace ZeroKey + +section + +open Matrix MeasureTheory ProbabilityTheory + +open scoped ComplexOrder MatrixOrder Matrix.Norms.L2Operator Kronecker + +universe v7730_0 v7730_1 v7730_2 v7730_3 + +variable {Ω : Type v7730_0} {T : Type v7730_1} {ι : Type v7730_2} {η : Type v7730_3} {L : MeasurableSpace Ω} {mΩ : MeasurableSpace Ω} + [inst7730_0 : StandardBorelSpace Ω] [inst7730_1 : MeasurableSpace T] + [inst7730_2 : Fintype ι] [inst7730_3 : Fintype η] [inst7730_4 : DecidableEq ι] [inst7730_5 : DecidableEq η] + {P : Measure Ω} [inst7730_6 : IsFiniteMeasure P] + +lemma setIntegral_publicMatrix (hL : L ≤ mΩ) (U : Ω → Matrix ι ι ℂ) + (hU : Integrable U P) (S : Set Ω) (hS : MeasurableSet[L] S) : + (∫ x in S, publicMatrix L P U x ∂P) = ∫ x in S, U x ∂P := by + calc + _ = ∫ x in S, P[U | L] x ∂P := integral_congr_ae + (ae_restrict_of_ae (condExp_ae_eq_integral_condExpKernel hL hU).symm) + _ = _ := setIntegral_condExp hL hU hS + +lemma public_factor_event (r : Ω → T) (hr : Measurable r) + (U : Ω → Matrix ι ι ℂ) (V : T → Matrix ι ι ℂ) + (hU : Integrable U P) (hV : Measurable V) + (he : publicMatrix (MeasurableSpace.comap r inferInstance) P U =ᵐ[P] V ∘ r) + (S : Set T) (hS : MeasurableSet S) : + (∫ t in S, V t ∂P.map r) = ∫ x in r ⁻¹' S, U x ∂P := by + rw [setIntegral_map hS hV.aestronglyMeasurable hr.aemeasurable] + calc + _ = ∫ x in r ⁻¹' S, publicMatrix (MeasurableSpace.comap r inferInstance) P U x ∂P := + integral_congr_ae (ae_restrict_of_ae he.symm) + _ = _ := setIntegral_publicMatrix hr.comap_le U hU _ ⟨S,hS,rfl⟩ + +end + +namespace AdaptiveQuantum + +open Matrix MeasureTheory ProbabilityTheory Filter unitInterval + +open scoped ComplexOrder MatrixOrder Matrix.Norms.L2Operator Kronecker Topology + +section + +open UnrestrictedQuantum + +universe v7771_0 v7771_1 v7771_2 v7771_3 v7771_4 v7771_5 v7771_6 v7771_7 v7771_8 v7771_9 + +variable {O : Type v7771_0} {M : Type v7771_1} {ι : Type v7771_2} {η : Type v7771_3} [inst7771_0 : MeasurableSpace O] [inst7771_1 : MeasurableSpace M] + [inst7771_2 : StandardBorelSpace O] [inst7771_3 : Nonempty O] [inst7771_4 : StandardBorelSpace M] [inst7771_5 : Nonempty M] + [inst7771_6 : Fintype ι] [inst7771_7 : Fintype η] [inst7771_8 : DecidableEq ι] [inst7771_9 : DecidableEq η] + {A : ℕ → Type v7771_4} {B : ℕ → Type v7771_5} + [inst7771_10 : ∀ n, AddCommGroup (A n)] [inst7771_11 : ∀ n, Module ℂ (A n)] [inst7771_12 : ∀ n, One (A n)] [inst7771_13 : ∀ n, LE (A n)] + [inst7771_14 : ∀ n, AddCommGroup (B n)] [inst7771_15 : ∀ n, Module ℂ (B n)] [inst7771_16 : ∀ n, One (B n)] [inst7771_17 : ∀ n, LE (B n)] + (p : AdaptiveOutcomeSampler O M) + (κA κB : (n : ℕ) → Kernel (LocalHistory O M n) O) + [inst7771_18 : ∀ n, IsMarkovKernel (κA n)] [inst7771_19 : ∀ n, IsMarkovKernel (κB n)] + (eA : LocalObservableExecution (ι := ι) A κA p.sendA) + (eB : LocalObservableExecution (ι := η) B κB p.sendB) + {TA : Type v7771_6} {TB : Type v7771_7} {CA : Type v7771_8} {CB : Type v7771_9} + [inst7771_20 : AddCommGroup TA] [inst7771_21 : Module ℂ TA] [inst7771_22 : One TA] [inst7771_23 : LE TA] + [inst7771_24 : AddCommGroup TB] [inst7771_25 : Module ℂ TB] [inst7771_26 : One TB] [inst7771_27 : LE TB] + [inst7771_28 : AddCommGroup CA] [inst7771_29 : Module ℂ CA] [inst7771_30 : One CA] [inst7771_31 : LE CA] + [inst7771_32 : AddCommGroup CB] [inst7771_33 : Module ℂ CB] [inst7771_34 : One CB] [inst7771_35 : LE CB] + (P : Measure (ℕ → O)) [inst7771_36 : IsProbabilityMeasure P] + (hP : ∀ n, P.map (historyPrefix (n+1)) = + ((P.map (historyPrefix n)) ⊗ₘ p.instrumentKernel κA κB n).map + (fun pair : (Fin n → O) × O => Fin.snoc (α := fun _ : Fin (n+1) => O) pair.1 pair.2)) + (eTA : IncomingObservableProcess (L := p.localField true) (A := TA) P historyFiltration + (fun n x => globalLocalReferenceA p κA eA n (historyPrefix n x))) + (eTB : IncomingObservableProcess (L := p.localField false) (A := TB) P historyFiltration + (fun n x => globalLocalReferenceB p κB eB n (historyPrefix n x))) + (bA : eTA.BitReadout (B := CA)) (bB : eTB.BitReadout (B := CB)) + +include hP + +omit inst7771_2 inst7771_3 inst7771_4 inst7771_5 in +theorem incoming_joint_reference_consistency [StandardBorelSpace O] [Nonempty O] [StandardBorelSpace M] [Nonempty M] : + ∀ n S, MeasurableSet[historyFiltration n] S → + (∫ x in S, (eTA.state x 1) ⊗ₖ (eTB.state x 1) ∂P) = + ∫ x in S, jointReference p κA κB eA eB n (historyPrefix n x) ∂P := by + obtain ⟨G,H,hGm,hHm,hG,hH,hGc,hHc,W,hW,hWc⟩ := + full_reference_extension p κA κB eA eB P hP + have hGa : (fun x => eTA.state x 1) =ᵐ[P] G := + reference_density_unique_on_filtration historyFiltration historyFiltration_generates + (fun x => eTA.state x 1) G + (fun x => density_subdensity (eTA.reference_density x)) + (fun x => density_subdensity (hG x)) + (eTA.local_measurable.mono (p.localField_le true) le_rfl) + (hGm.mono (p.localField_le true) le_rfl) + (fun n S hS => (eTA.causality n S hS).trans (hGc n S hS).symm) + have hHa : (fun x => eTB.state x 1) =ᵐ[P] H := + reference_density_unique_on_filtration historyFiltration historyFiltration_generates + (fun x => eTB.state x 1) H + (fun x => density_subdensity (eTB.reference_density x)) + (fun x => density_subdensity (hH x)) + (eTB.local_measurable.mono (p.localField_le false) le_rfl) + (hHm.mono (p.localField_le false) le_rfl) + (fun n S hS => (eTB.causality n S hS).trans (hHc n S hS).symm) + intro n S hS + rw [← hWc n S hS,hW S (historyFiltration.le n S hS)] + apply integral_congr_ae + filter_upwards [ae_restrict_of_ae hGa,ae_restrict_of_ae hHa] with x hx hy + rw [hx,hy] + +theorem genuine_terminal_public_factors + (hlaw : ∀ n s, ((volume : Measure I).prod volume).map + (fun u => p.causal.step n (s,u)) = p.instrumentKernel κA κB n s) : + ∃ X : Bool → (ℕ → M) → Matrix ι ι ℂ, + ∃ Y : Bool → (ℕ → M) → Matrix η η ℂ, + (∀ i, Measurable (X i)) ∧ (∀ j, Measurable (Y j)) ∧ + (∀ i t, Subdensity (X i t)) ∧ (∀ j t, Subdensity (Y j t)) ∧ + ∀ i j S, MeasurableSet S → + (∫ t in S, X i t ⊗ₖ Y j t ∂P.map p.publicRecord) = + ∫ x in p.publicRecord ⁻¹' S, bA.value i x ⊗ₖ bB.value j x ∂P := by + obtain ⟨X,Y,hXm,hYm,hXp,hYp,hXY⟩ := terminal_public_factors p.publicRecord + p.measurable_publicRecord (p.localField_le true) (p.localField_le false) + (p.localFields_independent (p.instrumentKernel κA κB) hlaw P hP) + bA.value bB.value bA.subdensity bB.subdensity bA.measurable bB.measurable + refine ⟨X,Y,hXm,hYm,hXp,hYp,?_⟩ + intro i j S hS + exact public_factor_event p.publicRecord p.measurable_publicRecord + (fun x => bA.value i x ⊗ₖ bB.value j x) (fun t => X i t ⊗ₖ Y j t) + (integrable_subdensity _ (fun x => subdensity_kronecker (bA.subdensity i x) (bB.subdensity j x)) + (measurable_matrix_kronecker ((bA.measurable i).mono (p.localField_le true) le_rfl) + ((bB.measurable j).mono (p.localField_le false) le_rfl)) P) + (measurable_matrix_kronecker (hXm i) (hYm j)) (hXY i j) S hS + +end + +open UnrestrictedQuantum + +universe v7869_0 v7869_1 v7869_2 v7869_3 v7869_4 v7869_5 v7869_6 v7869_7 v7869_8 v7869_9 + +variable {O : Type v7869_0} {M : Type v7869_1} {ι : Type v7869_2} {η : Type v7869_3} [inst7869_0 : MeasurableSpace O] [inst7869_1 : MeasurableSpace M] + [inst7869_2 : StandardBorelSpace O] [inst7869_3 : Nonempty O] [inst7869_4 : StandardBorelSpace M] [inst7869_5 : Nonempty M] + [inst7869_6 : Fintype ι] [inst7869_7 : Fintype η] [inst7869_8 : DecidableEq ι] [inst7869_9 : DecidableEq η] + {A : ℕ → Type v7869_4} {B : ℕ → Type v7869_5} + [inst7869_10 : ∀ n, AddCommGroup (A n)] [inst7869_11 : ∀ n, Module ℂ (A n)] [inst7869_12 : ∀ n, One (A n)] [inst7869_13 : ∀ n, LE (A n)] + [inst7869_14 : ∀ n, AddCommGroup (B n)] [inst7869_15 : ∀ n, Module ℂ (B n)] [inst7869_16 : ∀ n, One (B n)] [inst7869_17 : ∀ n, LE (B n)] + (p : AdaptiveOutcomeSampler O M) + (κA κB : (n : ℕ) → Kernel (LocalHistory O M n) O) + [inst7869_18 : ∀ n, IsMarkovKernel (κA n)] [inst7869_19 : ∀ n, IsMarkovKernel (κB n)] + (eA : LocalObservableExecution (ι := ι) A κA p.sendA) + (eB : LocalObservableExecution (ι := η) B κB p.sendB) + {TA : Type v7869_6} {TB : Type v7869_7} {CA : Type v7869_8} {CB : Type v7869_9} + [inst7869_20 : AddCommGroup TA] [inst7869_21 : Module ℂ TA] [inst7869_22 : One TA] [inst7869_23 : LE TA] + [inst7869_24 : AddCommGroup TB] [inst7869_25 : Module ℂ TB] [inst7869_26 : One TB] [inst7869_27 : LE TB] + [inst7869_28 : AddCommGroup CA] [inst7869_29 : Module ℂ CA] [inst7869_30 : One CA] [inst7869_31 : LE CA] + [inst7869_32 : AddCommGroup CB] [inst7869_33 : Module ℂ CB] [inst7869_34 : One CB] [inst7869_35 : LE CB] + (P : Measure (ℕ → O)) [inst7869_36 : IsProbabilityMeasure P] + (hP : ∀ n, P.map (historyPrefix (n+1)) = + ((P.map (historyPrefix n)) ⊗ₘ p.instrumentKernel κA κB n).map + (fun pair : (Fin n → O) × O => Fin.snoc (α := fun _ : Fin (n+1) => O) pair.1 pair.2)) + (eTA : IncomingObservableProcess (L := p.localField true) (A := TA) P historyFiltration + (fun n x => globalLocalReferenceA p κA eA n (historyPrefix n x))) + (eTB : IncomingObservableProcess (L := p.localField false) (A := TB) P historyFiltration + (fun n x => globalLocalReferenceB p κB eB n (historyPrefix n x))) + (bA : eTA.BitReadout (B := CA)) (bB : eTB.BitReadout (B := CB)) + +include hP + +theorem terminal_reference_total : + (∫ x, bA.value false x ⊗ₖ bB.value false x ∂P) + + (∫ x, bA.value false x ⊗ₖ bB.value true x ∂P) + + (∫ x, bA.value true x ⊗ₖ bB.value false x ∂P) + + (∫ x, bA.value true x ⊗ₖ bB.value true x ∂P) = + jointReference p κA κB eA eB 0 Fin.elim0 := by + have hi (i j : Bool) : Integrable (fun x => bA.value i x ⊗ₖ bB.value j x) P := + integrable_subdensity _ (fun x => subdensity_kronecker (bA.subdensity i x) (bB.subdensity j x)) + (measurable_matrix_kronecker ((bA.measurable i).mono (p.localField_le true) le_rfl) + ((bB.measurable j).mono (p.localField_le false) le_rfl)) P + have h2 := (integral_add ((hi false false).add (hi false true)) (hi true false)).symm + have h3 := (integral_add (((hi false false).add (hi false true)).add (hi true false)) (hi true true)).symm + simp only [Pi.add_apply] at h2 h3 + rw [← integral_add (hi false false) (hi false true),h2,h3] + have hs (x : ℕ → O) : bA.value false x ⊗ₖ bB.value false x + + bA.value false x ⊗ₖ bB.value true x + bA.value true x ⊗ₖ bB.value false x + + bA.value true x ⊗ₖ bB.value true x = eTA.state x 1 ⊗ₖ eTB.state x 1 := by + rw [← bA.sum x,← bB.sum x,Matrix.add_kronecker,Matrix.kronecker_add,Matrix.kronecker_add] + abel + simp_rw [hs] + have hc := incoming_joint_reference_consistency p κA κB eA eB P hP eTA eTB + 0 Set.univ MeasurableSet.univ + simp only [Measure.restrict_univ] at hc + rw [hc] + have he (x : ℕ → O) : historyPrefix 0 x = Fin.elim0 := Subsingleton.elim _ _ + simp_rw [he] + simp + +theorem terminal_public_normalization + (hlaw : ∀ n s, ((volume : Measure I).prod volume).map + (fun u => p.causal.step n (s,u)) = p.instrumentKernel κA κB n s) : + ∃ X : Bool → (ℕ → M) → Matrix ι ι ℂ, + ∃ Y : Bool → (ℕ → M) → Matrix η η ℂ, + (∀ i, Measurable (X i)) ∧ (∀ j, Measurable (Y j)) ∧ + (∀ i t, Subdensity (X i t)) ∧ (∀ j t, Subdensity (Y j t)) ∧ + (∀ i j S, MeasurableSet S → + (∫ t in S, X i t ⊗ₖ Y j t ∂P.map p.publicRecord) = + ∫ x in p.publicRecord ⁻¹' S, bA.value i x ⊗ₖ bB.value j x ∂P) ∧ + (∫ t, X false t ⊗ₖ Y false t ∂P.map p.publicRecord) + + (∫ t, X false t ⊗ₖ Y true t ∂P.map p.publicRecord) + + (∫ t, X true t ⊗ₖ Y false t ∂P.map p.publicRecord) + + (∫ t, X true t ⊗ₖ Y true t ∂P.map p.publicRecord) = + jointReference p κA κB eA eB 0 Fin.elim0 := by + obtain ⟨X,Y,hXm,hYm,hX,hY,hXY⟩ := genuine_terminal_public_factors + p κA κB eA eB P hP eTA eTB bA bB hlaw + refine ⟨X,Y,hXm,hYm,hX,hY,hXY,?_⟩ + have ht (i j : Bool) := hXY i j Set.univ MeasurableSet.univ + simp only [Measure.restrict_univ,Set.preimage_univ] at ht + simp_rw [ht] + exact terminal_reference_total p κA κB eA eB P hP eTA eTB bA bB + +end AdaptiveQuantum + +section + +open Matrix + +open scoped ComplexOrder MatrixOrder Kronecker + +universe v7966_0 v7966_1 + +variable {ι : Type v7966_0} {η : Type v7966_1} [inst7966_0 : Fintype ι] [inst7966_1 : Fintype η] [inst7966_2 : DecidableEq ι] [inst7966_3 : DecidableEq η] + +lemma localProbe_reference : + keepReference (outer (localProbe (ι := ι)) localProbe) = + (Fintype.card ι : ℂ)⁻¹ • (1 : Matrix ι ι ℂ) := by + rw [localProbe,keepReference_vectorize] + simp only [Matrix.conjTranspose_smul,Matrix.conjTranspose_one, + Matrix.smul_mul,Matrix.mul_smul,one_mul,Matrix.transpose_smul,Matrix.transpose_one] + have hc : star (((Real.sqrt (Fintype.card ι : ℝ))⁻¹ : ℂ)) * + ((Real.sqrt (Fintype.card ι : ℝ))⁻¹ : ℂ) = (Fintype.card ι : ℂ)⁻¹ := by + simp only [map_inv₀,Complex.star_def,Complex.conj_ofReal] + rw [← mul_inv,← Complex.ofReal_mul,Real.mul_self_sqrt (Nat.cast_nonneg _)] + simp + rw [smul_smul,mul_comm,hc] + +lemma localProbe_reference_product : + keepReference (outer (localProbe (ι := ι)) localProbe) ⊗ₖ + keepReference (outer (localProbe (ι := η)) localProbe) = + keepReference (outer (localProbe (ι := ι × η)) localProbe) := by + simp only [localProbe_reference,Matrix.smul_kronecker,Matrix.kronecker_smul, + Matrix.one_kronecker_one,smul_smul,Fintype.card_prod,Nat.cast_mul,mul_inv] + rw [mul_comm] + +end + +section + +open Matrix MeasureTheory ProbabilityTheory Function unitInterval + +open scoped ComplexOrder MatrixOrder Matrix.Norms.L2Operator Kronecker + +open UnrestrictedQuantum + +universe v8064_0 v8064_1 + +structure Discussion (O : Type v8064_0) (M : Type v8064_1) [MeasurableSpace O] [MeasurableSpace M] where + alice : (n : ℕ) → (Fin n → M) → Bool + alice_measurable : ∀ n, Measurable (alice n) + kernelA : (n : ℕ) → Kernel (LocalHistory O M n) O + kernelB : (n : ℕ) → Kernel (LocalHistory O M n) O + markovA : ∀ n, IsMarkovKernel (kernelA n) + markovB : ∀ n, IsMarkovKernel (kernelB n) + sendA : (n : ℕ) → LocalHistory O M n × O → M + sendB : (n : ℕ) → LocalHistory O M n × O → M + sendA_measurable : ∀ n, Measurable (sendA n) + sendB_measurable : ∀ n, Measurable (sendB n) + +namespace Discussion + +universe v8077_0 v8077_1 + +variable {O : Type v8077_0} {M : Type v8077_1} [inst8077_0 : MeasurableSpace O] [inst8077_1 : MeasurableSpace M] + [inst8077_2 : StandardBorelSpace O] [inst8077_3 : Nonempty O] (d : Discussion O M) + +attribute [instance] markovA markovB + +def sampler : AdaptiveOutcomeSampler O M := by + have sample (n : ℕ) (κ : Kernel (LocalHistory O M n) O) [IsMarkovKernel κ] : + ∃ f : LocalHistory O M n → I → O, Measurable (uncurry f) ∧ + (∀ h, volume.map (f h) = κ h) ∧ + ∀ (μ : Measure (LocalHistory O M n)) [IsFiniteMeasure μ], + (μ.prod (volume : Measure I)).map (fun p => (p.1, f p.1 p.2)) = μ ⊗ₘ κ := by + obtain ⟨f, hf, hfLaw⟩ := κ.exists_measurable_map_eq_unitInterval + change Measurable (fun pair : LocalHistory O M n × I => f pair.1 pair.2) at hf + refine ⟨f, hf, hfLaw, ?_⟩ + intro μ hμ + ext B hB + rw [Measure.map_apply (measurable_fst.prodMk hf) hB, + Measure.prod_apply (hB.preimage (measurable_fst.prodMk hf)), + Measure.compProd_apply hB] + congr 1 + funext h + rw [← hfLaw h, Measure.map_apply hf.of_uncurry_left (measurable_prodMk_left hB)] + rfl + exact { + alice := d.alice + alice_meas := d.alice_measurable + sampleA n := uncurry (Classical.choose (sample n (d.kernelA n))) + sampleB n := uncurry (Classical.choose (sample n (d.kernelB n))) + sendA := d.sendA + sendB := d.sendB + sampleA_meas n := (Classical.choose_spec (sample n (d.kernelA n))).1 + sampleB_meas n := (Classical.choose_spec (sample n (d.kernelB n))).1 + sendA_meas := d.sendA_measurable + sendB_meas := d.sendB_measurable } + +lemma sampler_law : ∀ n s, ((volume : Measure I).prod volume).map + (fun u => d.sampler.causal.step n (s,u)) = + d.sampler.instrumentKernel d.kernelA d.kernelB n s := by + apply d.sampler.causal_step_law + · intro n s + exact (Classical.choose_spec (sample_instrument_kernel (d.kernelA n))).2.1 s + · intro n s + exact (Classical.choose_spec (sample_instrument_kernel (d.kernelB n))).2.1 s + +def probeLaw : Measure (ℕ → O) := + (noiseTapeLaw ((volume : Measure I).prod volume)).map d.sampler.causalRecord + +instance probeLaw_probability : IsProbabilityMeasure d.probeLaw := + inferInstanceAs (IsProbabilityMeasure ((noiseTapeLaw ((volume : Measure I).prod volume)).map d.sampler.causal.record)) + +lemma probeLaw_prefix (n : ℕ) : d.probeLaw.map (historyPrefix (n+1)) = + ((d.probeLaw.map (historyPrefix n)) ⊗ₘ + d.sampler.instrumentKernel d.kernelA d.kernelB n).map + (fun pair : (Fin n → O) × O => Fin.snoc (α := fun _ : Fin (n+1) => O) pair.1 pair.2) := by + have he (k : ℕ) : historyPrefix k ∘ d.sampler.causal.record = + d.sampler.causal.history k := by + funext u i + exact (d.sampler.causal.prefix_eq_record k u i).symm + simp only [probeLaw, AdaptiveOutcomeSampler.causalRecord_eq, Measure.map_map (measurable_historyPrefix _) d.sampler.causal.measurable_record,he] + exact d.sampler.causal.prefix_law_succ _ d.sampler_law n + +def transcriptLaw : Measure (ℕ → M) := d.probeLaw.map d.sampler.publicRecord + +instance transcriptLaw_probability : IsProbabilityMeasure d.transcriptLaw := + inferInstanceAs (IsProbabilityMeasure (d.probeLaw.map d.sampler.publicRecord)) + +end Discussion + +end + +section + +open scoped ComplexOrder MatrixOrder Kronecker + +open Matrix + +universe v8144_0 v8144_1 + +variable {ι : Type v8144_0} {κ : Type v8144_1} [inst8144_0 : Fintype ι] [inst8144_1 : Fintype κ] [inst8144_2 : DecidableEq ι] [inst8144_3 : DecidableEq κ] + +lemma preparationFilter_product (R : Matrix (ι × κ) (ι × κ) ℂ) + (U : Matrix ι ι ℂ) (V : Matrix κ κ ℂ) : + preparationFilter R * (U ⊗ₖ V) * (preparationFilter R)ᴴ = + (CFC.sqrt R * (((Fintype.card ι : ℂ) • Uᵀ) ⊗ₖ ((Fintype.card κ : ℂ) • Vᵀ)) * CFC.sqrt R)ᵀ := by + have hs : (CFC.sqrt R)ᴴ = CFC.sqrt R := (CFC.sqrt_nonneg R).posSemidef.isHermitian.eq + have ht : ((CFC.sqrt R)ᵀ)ᴴ = (CFC.sqrt R)ᵀ := by + rw [Matrix.conjTranspose_transpose_eq_transpose_conjTranspose,hs] + have hc : (Real.sqrt (Fintype.card (ι × κ) : ℝ) : ℂ) * + (Real.sqrt (Fintype.card (ι × κ) : ℝ) : ℂ) = + (Fintype.card ι : ℂ)*(Fintype.card κ : ℂ) := by + rw [← Complex.ofReal_mul,Real.mul_self_sqrt (Nat.cast_nonneg _), + Fintype.card_prod,Nat.cast_mul] + simp + unfold preparationFilter + simp only [Matrix.conjTranspose_smul,Complex.star_def,Complex.conj_ofReal,ht, + smul_mul_assoc,mul_smul_comm,smul_smul,Matrix.transpose_mul, + ← Matrix.kroneckerMap_transpose,Matrix.transpose_smul,Matrix.transpose_transpose, + Matrix.smul_kronecker,Matrix.kronecker_smul] + rw [hc] + congr 1 + · ring + · exact Matrix.mul_assoc _ _ _ + +end + +section + +open scoped MatrixOrder ComplexOrder Kronecker + +open Matrix + +universe v8360_0 + +def eveBlock {ι : Type v8360_0} [inst8360_0 : Fintype ι] [inst8360_1 : DecidableEq ι] + (R D : Matrix ι ι ℂ) : Matrix ι ι ℂ := (CFC.sqrt R * D * CFC.sqrt R)ᵀ + +open MeasureTheory + +open scoped Matrix.Norms.L2Operator + +universe v8632_0 v8632_1 + +variable {ι : Type v8632_0} {Ω : Type v8632_1} [inst8632_0 : Fintype ι] [inst8632_1 : DecidableEq ι] [inst8632_2 : MeasurableSpace Ω] + +universe v8637_0 + +structure BitDensity (μ : Measure Ω) (ι : Type v8637_0) [Fintype ι] where + block : Bool → Bool → Ω → Matrix ι ι ℂ + positive : ∀ i j t, (block i j t).PosSemidef + measurable : ∀ i j, Measurable (block i j) + integrable : ∀ i j, Integrable (fun t => (trace (block i j t)).re) μ + normalized : (∫ t, (trace (block false false t)).re ∂μ) + + (∫ t, (trace (block false true t)).re ∂μ) + + (∫ t, (trace (block true false t)).re ∂μ) + + (∫ t, (trace (block true true t)).re ∂μ) = 1 + +def BitDensity.mass {μ : Measure Ω} (τ : BitDensity μ ι) (i j : Bool) : ℝ := + ∫ t, (trace (τ.block i j t)).re ∂μ + +def BitDensity.idealBitError {μ : Measure Ω} (τ : BitDensity μ ι) + (σ : Ω → Matrix ι ι ℂ) : ℝ := + τ.mass false true + τ.mass true false + + (∫ t, traceNorm (τ.block false false t - (1/2 : ℝ) • σ t) ∂μ) + + (∫ t, traceNorm (τ.block true true t - (1/2 : ℝ) • σ t) ∂μ) + +end + +section + +open Matrix MeasureTheory ProbabilityTheory + +open scoped ComplexOrder MatrixOrder Matrix.Norms.L2Operator Kronecker + +section MatrixFiltering + +universe v8879_0 v8879_1 v8879_2 + +variable {ι : Type v8879_0} {η : Type v8879_1} {Ω : Type v8879_2} [inst8879_0 : Fintype ι] [inst8879_1 : Fintype η] [inst8879_2 : DecidableEq ι] [inst8879_3 : DecidableEq η] + [inst8879_4 : MeasurableSpace Ω] {μ : Measure Ω} + +def matrixFilterLinear (K : Matrix η ι ℂ) : Matrix ι ι ℂ →ₗ[ℂ] Matrix η η ℂ where + toFun U := K * U * Kᴴ + map_add' U V := by rw [Matrix.mul_add,Matrix.add_mul] + map_smul' c U := by simp only [Matrix.mul_smul,Matrix.smul_mul,RingHom.id_apply] + +lemma integral_filter (K : Matrix η ι ℂ) {U : Ω → Matrix ι ι ℂ} + (hi : Integrable U μ) : + (∫ x, K * U x * Kᴴ ∂μ) = K * (∫ x, U x ∂μ) * Kᴴ := + (matrixFilterLinear K).toContinuousLinearMap.integral_comp_comm hi + +lemma integrable_filter (K : Matrix η ι ℂ) {U : Ω → Matrix ι ι ℂ} + (hi : Integrable U μ) : Integrable (fun x => K * U x * Kᴴ) μ := + (matrixFilterLinear K).toContinuousLinearMap.integrable_comp hi + +lemma integral_realTrace {U : Ω → Matrix ι ι ℂ} (hi : Integrable U μ) : + (∫ x, (trace (U x)).re ∂μ) = (trace (∫ x, U x ∂μ)).re := by + let L : Matrix ι ι ℂ →L[ℂ] ℂ := (Matrix.traceLinearMap ι ℂ ℂ).toContinuousLinearMap + change (∫ x, RCLike.re (L (U x)) ∂μ) = (L (∫ x,U x ∂μ)).re + rw [integral_re (L.integrable_comp hi)] + exact congrArg Complex.re (L.integral_comp_comm hi) + +lemma preparationFilter_probe_reference [Nonempty ι] + (R : Matrix ι ι ℂ) (hR : R.PosSemidef) : + preparationFilter R * keepReference (outer (localProbe (ι := ι)) localProbe) * + (preparationFilter R)ᴴ = Rᵀ := by + rw [← keepReference_filter,preparation_filter_identity,canonical_reference R hR] + +end MatrixFiltering + +universe v8912_0 v8912_1 v8912_2 + +variable {ι : Type v8912_0} {η : Type v8912_1} {T : Type v8912_2} [inst8912_0 : Fintype ι] [inst8912_1 : Fintype η] [inst8912_2 : DecidableEq ι] [inst8912_3 : DecidableEq η] + [inst8912_4 : Nonempty ι] [inst8912_5 : Nonempty η] [inst8912_6 : MeasurableSpace T] + (μ : Measure T) [inst8912_7 : IsFiniteMeasure μ] + (X : Bool → T → Matrix ι ι ℂ) (Y : Bool → T → Matrix η η ℂ) + (hXm : ∀ i, Measurable (X i)) (hYm : ∀ j, Measurable (Y j)) + (hX : ∀ i t, Subdensity (X i t)) (hY : ∀ j t, Subdensity (Y j t)) + (R : Matrix (ι × η) (ι × η) ℂ) (hR : Density R) + +omit inst8912_4 inst8912_5 in +include hXm hYm hX hY in +lemma public_product_integrable [Nonempty ι] [Nonempty η] (i j : Bool) : Integrable (fun t => X i t ⊗ₖ Y j t) μ := + integrable_subdensity _ (fun t => subdensity_kronecker (hX i t) (hY j t)) + (measurable_matrix_kronecker (hXm i) (hYm j)) μ + +def filteredPublicDensity + (hInit : (∫ t, X false t ⊗ₖ Y false t ∂μ) + + (∫ t, X false t ⊗ₖ Y true t ∂μ) + + (∫ t, X true t ⊗ₖ Y false t ∂μ) + + (∫ t, X true t ⊗ₖ Y true t ∂μ) = + keepReference (outer (localProbe (ι := ι × η)) localProbe)) : BitDensity μ (ι × η) where + block i j t := preparationFilter R * (X i t ⊗ₖ Y j t) * (preparationFilter R)ᴴ + positive i j t := ((hX i t).1.kronecker (hY j t).1).mul_mul_conjTranspose_same _ + measurable i j := (matrixFilterLinear (preparationFilter R)).toContinuousLinearMap.measurable.comp + (measurable_matrix_kronecker (hXm i) (hYm j)) + integrable i j := by + let L : Matrix (ι × η) (ι × η) ℂ →L[ℂ] ℂ := + (Matrix.traceLinearMap (ι × η) ℂ ℂ).toContinuousLinearMap + exact (L.integrable_comp (integrable_filter _ (public_product_integrable μ X Y hXm hYm hX hY i j))).re + normalized := by + have hi (i j : Bool) := integrable_filter (preparationFilter R) + (public_product_integrable μ X Y hXm hYm hX hY i j) + rw [integral_realTrace (hi false false),integral_realTrace (hi false true), + integral_realTrace (hi true false),integral_realTrace (hi true true)] + simp_rw [integral_filter _ (public_product_integrable μ X Y hXm hYm hX hY _ _)] + rw [← Complex.add_re,← Matrix.trace_add,← Complex.add_re,← Matrix.trace_add, + ← Complex.add_re,← Matrix.trace_add] + rw [← Matrix.add_mul,← Matrix.mul_add,← Matrix.add_mul,← Matrix.mul_add, + ← Matrix.add_mul,← Matrix.mul_add,hInit,preparationFilter_probe_reference R hR.1, + Matrix.trace_transpose,hR.2] + rfl + +lemma filteredPublicDensity_common_factors + (hInit : (∫ t, X false t ⊗ₖ Y false t ∂μ) + + (∫ t, X false t ⊗ₖ Y true t ∂μ) + + (∫ t, X true t ⊗ₖ Y false t ∂μ) + + (∫ t, X true t ⊗ₖ Y true t ∂μ) = + keepReference (outer (localProbe (ι := ι × η)) localProbe)) (i j : Bool) (t : T) : + (filteredPublicDensity μ X Y hXm hYm hX hY R hR hInit).block i j t = + eveBlock R (((Fintype.card ι : ℂ) • (X i t)ᵀ) ⊗ₖ ((Fintype.card η : ℂ) • (Y j t)ᵀ)) := + preparationFilter_product R (X i t) (Y j t) + +end + +section + +open Matrix MeasureTheory ProbabilityTheory Function unitInterval Filter + +open scoped ComplexOrder MatrixOrder Matrix.Norms.L2Operator Kronecker + +open UnrestrictedQuantum + +universe v8979_0 v8979_1 v8979_2 v8979_3 v8979_4 v8979_5 v8979_6 v8979_7 v8979_8 v8979_9 + +variable {O : Type v8979_0} {M : Type v8979_1} {ι : Type v8979_2} {η : Type v8979_3} [inst8979_0 : MeasurableSpace O] [inst8979_1 : MeasurableSpace M] + [inst8979_2 : StandardBorelSpace O] [inst8979_3 : Nonempty O] [inst8979_4 : StandardBorelSpace M] [inst8979_5 : Nonempty M] + [inst8979_6 : Fintype ι] [inst8979_7 : Fintype η] [inst8979_8 : DecidableEq ι] [inst8979_9 : DecidableEq η] + (d : Discussion O M) + (A : ℕ → Type v8979_4) (B : ℕ → Type v8979_5) + [inst8979_10 : ∀ n, AddCommGroup (A n)] [inst8979_11 : ∀ n, Module ℂ (A n)] [inst8979_12 : ∀ n, One (A n)] [inst8979_13 : ∀ n, LE (A n)] + [inst8979_14 : ∀ n, AddCommGroup (B n)] [inst8979_15 : ∀ n, Module ℂ (B n)] [inst8979_16 : ∀ n, One (B n)] [inst8979_17 : ∀ n, LE (B n)] + (TA : Type v8979_6) (TB : Type v8979_7) (CA : Type v8979_8) (CB : Type v8979_9) + [inst8979_18 : AddCommGroup TA] [inst8979_19 : Module ℂ TA] [inst8979_20 : One TA] [inst8979_21 : LE TA] + [inst8979_22 : AddCommGroup TB] [inst8979_23 : Module ℂ TB] [inst8979_24 : One TB] [inst8979_25 : LE TB] + [inst8979_26 : AddCommGroup CA] [inst8979_27 : Module ℂ CA] [inst8979_28 : One CA] [inst8979_29 : LE CA] + [inst8979_30 : AddCommGroup CB] [inst8979_31 : Module ℂ CB] [inst8979_32 : One CB] [inst8979_33 : LE CB] + +structure BitProtocol where + executionA : LocalObservableExecution (ι := ι) A d.kernelA d.sendA + executionB : LocalObservableExecution (ι := η) B d.kernelB d.sendB + initialA : executionA.reference 0 (Fin.elim0,Fin.elim0) = + keepReference (outer (localProbe (ι := ι)) localProbe) + initialB : executionB.reference 0 (Fin.elim0,Fin.elim0) = + keepReference (outer (localProbe (ι := η)) localProbe) + incomingA : IncomingObservableProcess (L := d.sampler.localField true) (A := TA) + d.probeLaw historyFiltration + (fun n x => AdaptiveQuantum.globalLocalReferenceA d.sampler d.kernelA executionA n (historyPrefix n x)) + incomingB : IncomingObservableProcess (L := d.sampler.localField false) (A := TB) + d.probeLaw historyFiltration + (fun n x => AdaptiveQuantum.globalLocalReferenceB d.sampler d.kernelB executionB n (historyPrefix n x)) + readoutA : incomingA.BitReadout (B := CA) + readoutB : incomingB.BitReadout (B := CB) + +variable {d A B TA TB CA CB} + +namespace BitProtocol + +variable (p : BitProtocol (ι := ι) (η := η) d A B TA TB CA CB) + +def completeReference (i j : Bool) (x : ℕ → O) : Matrix (ι × η) (ι × η) ℂ := + p.readoutA.value i x ⊗ₖ p.readoutB.value j x + +omit inst8979_4 inst8979_5 in +lemma completeReference_positive [StandardBorelSpace M] [Nonempty M] (i j : Bool) (x : ℕ → O) : + (p.completeReference i j x).PosSemidef := + (p.readoutA.positive i x).kronecker (p.readoutB.positive j x) + +omit inst8979_4 inst8979_5 in +lemma completeReference_measurable [StandardBorelSpace M] [Nonempty M] (i j : Bool) : Measurable (p.completeReference i j) := + measurable_matrix_kronecker + ((p.readoutA.measurable i).mono (d.sampler.localField_le true) le_rfl) + ((p.readoutB.measurable j).mono (d.sampler.localField_le false) le_rfl) + +lemma completeReference_integrable (i j : Bool) : Integrable (p.completeReference i j) d.probeLaw := + integrable_subdensity _ + (fun x => subdensity_kronecker (p.readoutA.subdensity i x) (p.readoutB.subdensity j x)) + (p.completeReference_measurable i j) d.probeLaw + +lemma completeReference_entry_integrable (i j : Bool) (k l : ι × η) : + Integrable (fun x => p.completeReference i j x k l) d.probeLaw := + ((Matrix.entryLinearMap ℂ ℂ k l).toContinuousLinearMap).integrable_comp + (p.completeReference_integrable i j) + +def probeOutput (i j : Bool) : PositiveMatrixMeasure (ℕ → M) (ι × η) := + (positiveMatrixMeasureOfDensity (p.completeReference_entry_integrable i j) + (Eventually.of_forall (p.completeReference_positive i j))).pushforward + d.sampler.publicRecord d.sampler.measurable_publicRecord + +lemma probeOutput_event (i j : Bool) (S : Set (ℕ → M)) (hS : MeasurableSet S) : + (p.probeOutput i j).value S = + ∫ x in d.sampler.publicRecord ⁻¹' S, p.completeReference i j x ∂d.probeLaw := by + rw [probeOutput,PositiveMatrixMeasure.pushforward_value _ _ _ S hS, + positiveMatrixMeasureOfDensity_value _ _ _ (d.sampler.measurable_publicRecord hS)] + +omit inst8979_4 inst8979_5 in +lemma initial_joint_reference [StandardBorelSpace M] [Nonempty M] : + AdaptiveQuantum.jointReference d.sampler d.kernelA d.kernelB p.executionA p.executionB + 0 Fin.elim0 = keepReference (outer (localProbe (ι := ι × η)) localProbe) := by + unfold AdaptiveQuantum.jointReference AdaptiveQuantum.globalLocalReferenceA + AdaptiveQuantum.globalLocalReferenceB + have ha : (d.sampler.extractPrivate true 0 Fin.elim0,d.sampler.publicFrom 0 Fin.elim0) = + (Fin.elim0,Fin.elim0) := Subsingleton.elim _ _ + have hb : (d.sampler.extractPrivate false 0 Fin.elim0,d.sampler.publicFrom 0 Fin.elim0) = + (Fin.elim0,Fin.elim0) := Subsingleton.elim _ _ + rw [ha,hb] + change p.executionA.reference 0 (Fin.elim0,Fin.elim0) ⊗ₖ + p.executionB.reference 0 (Fin.elim0,Fin.elim0) = _ + rw [p.initialA,p.initialB,localProbe_reference_product] + +theorem public_factors : + ∃ X : Bool → (ℕ → M) → Matrix ι ι ℂ, + ∃ Y : Bool → (ℕ → M) → Matrix η η ℂ, + (∀ i, Measurable (X i)) ∧ (∀ j, Measurable (Y j)) ∧ + (∀ i t, Subdensity (X i t)) ∧ (∀ j t, Subdensity (Y j t)) ∧ + (∀ i j S, MeasurableSet S → (p.probeOutput i j).value S = + ∫ t in S, X i t ⊗ₖ Y j t ∂d.transcriptLaw) ∧ + (∫ t, X false t ⊗ₖ Y false t ∂d.transcriptLaw) + + (∫ t, X false t ⊗ₖ Y true t ∂d.transcriptLaw) + + (∫ t, X true t ⊗ₖ Y false t ∂d.transcriptLaw) + + (∫ t, X true t ⊗ₖ Y true t ∂d.transcriptLaw) = + keepReference (outer (localProbe (ι := ι × η)) localProbe) := by + obtain ⟨X,Y,hXm,hYm,hX,hY,hXY,hn⟩ := AdaptiveQuantum.terminal_public_normalization + d.sampler d.kernelA d.kernelB p.executionA p.executionB d.probeLaw d.probeLaw_prefix + p.incomingA p.incomingB p.readoutA p.readoutB d.sampler_law + refine ⟨X,Y,hXm,hYm,hX,hY,?_,hn.trans p.initial_joint_reference⟩ + intro i j S hS + exact (p.probeOutput_event i j S hS).trans (hXY i j S hS).symm + +def canonicalOutput (R : Matrix (ι × η) (ι × η) ℂ) (i j : Bool) : + PositiveMatrixMeasure (ℕ → M) (ι × η) := + (p.probeOutput i j).filter (preparationFilter R) + +end BitProtocol + +end + +namespace PositiveMatrixMeasure + +open MeasureTheory Matrix Filter + +open scoped Matrix.Norms.L2Operator ComplexOrder MatrixOrder + +universe v9237_0 v9237_1 + +variable {Ω : Type v9237_0} {ι : Type v9237_1} [inst9237_0 : MeasurableSpace Ω] [inst9237_1 : Fintype ι] [inst9237_2 : DecidableEq ι] + +def positiveDensity (W : PositiveMatrixMeasure Ω ι) (μ : Measure Ω) (t : Ω) : Matrix ι ι ℂ := + by classical exact if (W.density μ t).PosSemidef then W.density μ t else 0 + +omit inst9237_2 in +lemma positiveDensity_pos [DecidableEq ι] (W : PositiveMatrixMeasure Ω ι) (μ : Measure Ω) (t : Ω) : + (W.positiveDensity μ t).PosSemidef := by + unfold positiveDensity + split + · assumption + · exact Matrix.PosSemidef.zero + +lemma measurable_positiveDensity (W : PositiveMatrixMeasure Ω ι) (μ : Measure Ω) : + Measurable (W.positiveDensity μ) := by + have hm : MeasurableSet {t | (W.density μ t).PosSemidef} := by + have he : {t | (W.density μ t).PosSemidef} = (W.density μ) ⁻¹' Set.Ici 0 := by + ext t + exact Matrix.nonneg_iff_posSemidef.symm + rw [he] + exact (W.measurable_density μ) measurableSet_Ici + exact (W.measurable_density μ).ite hm measurable_const + +lemma positiveDensity_ae (W : PositiveMatrixMeasure Ω ι) (μ : Measure Ω) [SigmaFinite μ] + (hAC : ∀ S, MeasurableSet S → μ S=0 → W.value S=0) : + W.positiveDensity μ =ᵐ[μ] W.density μ := by + filter_upwards [density_posSemidef_ae W μ hAC] with t ht + exact ite_eq_left ht + +lemma integrable_positiveDensity_trace (W : PositiveMatrixMeasure Ω ι) (μ : Measure Ω) + [SigmaFinite μ] (hAC : ∀ S, MeasurableSet S → μ S=0 → W.value S=0) : + Integrable (fun t => (trace (W.positiveDensity μ t)).re) μ := by + apply (W.integrable_trace_density μ).re.congr + filter_upwards [W.positiveDensity_ae μ hAC] with t ht + rw [ht] + rfl + +lemma integral_positiveDensity_trace (W : PositiveMatrixMeasure Ω ι) (μ : Measure Ω) + [SigmaFinite μ] (hAC : ∀ S, MeasurableSet S → μ S=0 → W.value S=0) : + (∫ t, (trace (W.positiveDensity μ t)).re ∂μ) = (trace (W.value Set.univ)).re := by + calc + _ = ∫ t, (trace (W.density μ t)).re ∂μ := by + apply integral_congr_ae + filter_upwards [W.positiveDensity_ae μ hAC] with t ht + rw [ht] + _ = (trace (W.value Set.univ)).re := by + change (∫ t, RCLike.re (trace (W.density μ t)) ∂μ) = _ + rw [integral_re (W.integrable_trace_density μ)] + have he := W.integral_trace_density μ hAC Set.univ MeasurableSet.univ + change (∫ t, trace (W.density μ t) ∂μ).re = _ + simpa only [Measure.restrict_univ] using congrArg Complex.re he + +def toBitDensity (W : Bool → Bool → PositiveMatrixMeasure Ω ι) + (μ : Measure Ω) [SigmaFinite μ] + (hAC : ∀ i j S, MeasurableSet S → μ S=0 → (W i j).value S=0) + (hn : (trace ((W false false).value Set.univ)).re + + (trace ((W false true).value Set.univ)).re + + (trace ((W true false).value Set.univ)).re + + (trace ((W true true).value Set.univ)).re = 1) : BitDensity μ ι where + block i j := (W i j).positiveDensity μ + positive i j := (W i j).positiveDensity_pos μ + measurable i j := (W i j).measurable_positiveDensity μ + integrable i j := (W i j).integrable_positiveDensity_trace μ (hAC i j) + normalized := by + simp only [integral_positiveDensity_trace _ μ (hAC _ _)] + exact hn + +end PositiveMatrixMeasure + +section + +open Matrix MeasureTheory ProbabilityTheory Function unitInterval Filter + +open scoped ComplexOrder MatrixOrder Matrix.Norms.L2Operator Kronecker + +open UnrestrictedQuantum + +universe v9409_0 v9409_1 v9409_2 v9409_3 v9409_4 v9409_5 v9409_6 v9409_7 v9409_8 v9409_9 + +variable {O : Type v9409_0} {M : Type v9409_1} {ι : Type v9409_2} {η : Type v9409_3} [inst9409_0 : MeasurableSpace O] [inst9409_1 : MeasurableSpace M] + [inst9409_2 : StandardBorelSpace O] [inst9409_3 : Nonempty O] [inst9409_4 : StandardBorelSpace M] [inst9409_5 : Nonempty M] + [inst9409_6 : Fintype ι] [inst9409_7 : Fintype η] [inst9409_8 : DecidableEq ι] [inst9409_9 : DecidableEq η] + [inst9409_10 : Nonempty ι] [inst9409_11 : Nonempty η] + {d : Discussion O M} {A : ℕ → Type v9409_4} {B : ℕ → Type v9409_5} + [inst9409_12 : ∀ n, AddCommGroup (A n)] [inst9409_13 : ∀ n, Module ℂ (A n)] [inst9409_14 : ∀ n, One (A n)] [inst9409_15 : ∀ n, LE (A n)] + [inst9409_16 : ∀ n, AddCommGroup (B n)] [inst9409_17 : ∀ n, Module ℂ (B n)] [inst9409_18 : ∀ n, One (B n)] [inst9409_19 : ∀ n, LE (B n)] + {TA : Type v9409_6} {TB : Type v9409_7} {CA : Type v9409_8} {CB : Type v9409_9} + [inst9409_20 : AddCommGroup TA] [inst9409_21 : Module ℂ TA] [inst9409_22 : One TA] [inst9409_23 : LE TA] + [inst9409_24 : AddCommGroup TB] [inst9409_25 : Module ℂ TB] [inst9409_26 : One TB] [inst9409_27 : LE TB] + [inst9409_28 : AddCommGroup CA] [inst9409_29 : Module ℂ CA] [inst9409_30 : One CA] [inst9409_31 : LE CA] + [inst9409_32 : AddCommGroup CB] [inst9409_33 : Module ℂ CB] [inst9409_34 : One CB] [inst9409_35 : LE CB] + +namespace BitProtocol + +variable (p : BitProtocol (ι := ι) (η := η) d A B TA TB CA CB) + (R : Matrix (ι × η) (ι × η) ℂ) (hR : Density R) + +include hR + +theorem canonical_density_representation : + ∃ τ : BitDensity d.transcriptLaw (ι × η), + ∃ X : Bool → (ℕ → M) → Matrix ι ι ℂ, + ∃ Y : Bool → (ℕ → M) → Matrix η η ℂ, + (∀ i t, (X i t).PosSemidef) ∧ (∀ j t, (Y j t).PosSemidef) ∧ + (∀ i j t, τ.block i j t = eveBlock R (X i t ⊗ₖ Y j t)) ∧ + (∀ i j, Integrable (τ.block i j) d.transcriptLaw) ∧ + (∀ i j S, MeasurableSet S → (p.canonicalOutput R i j).value S = + ∫ t in S, τ.block i j t ∂d.transcriptLaw) := by + obtain ⟨X,Y,hXm,hYm,hX,hY,hXY,hn⟩ := p.public_factors + let τ := filteredPublicDensity d.transcriptLaw X Y hXm hYm hX hY R hR hn + refine ⟨τ,fun i t => (Fintype.card ι : ℂ) • (X i t)ᵀ, + fun j t => (Fintype.card η : ℂ) • (Y j t)ᵀ,?_,?_,?_,?_,?_⟩ + · intro i t + exact (hX i t).1.transpose.smul (by exact_mod_cast Nat.zero_le (Fintype.card ι)) + · intro j t + exact (hY j t).1.transpose.smul (by exact_mod_cast Nat.zero_le (Fintype.card η)) + · exact filteredPublicDensity_common_factors d.transcriptLaw X Y hXm hYm hX hY R hR hn + · intro i j + exact integrable_filter _ (public_product_integrable d.transcriptLaw X Y hXm hYm hX hY i j) + · intro i j S hS + rw [canonicalOutput,PositiveMatrixMeasure.filter_value,hXY i j S hS] + exact (integral_filter _ + ((public_product_integrable d.transcriptLaw X Y hXm hYm hX hY i j).integrableOn)).symm + +lemma canonicalOutput_normalized : + (trace ((p.canonicalOutput R false false).value Set.univ)).re + + (trace ((p.canonicalOutput R false true).value Set.univ)).re + + (trace ((p.canonicalOutput R true false).value Set.univ)).re + + (trace ((p.canonicalOutput R true true).value Set.univ)).re = 1 := by + obtain ⟨τ,X,Y,hX,hY,hτ,hi,he⟩ := p.canonical_density_representation R hR + simp_rw [he _ _ Set.univ MeasurableSet.univ,Measure.restrict_univ,← integral_realTrace (hi _ _)] + exact τ.normalized + +end BitProtocol + +end + +section + +open Matrix MeasureTheory + +open scoped ComplexOrder MatrixOrder Matrix.Norms.L2Operator + +universe v9682_0 v9682_1 v9682_2 v9682_3 + +variable {Ω : Type v9682_0} {ι : Type v9682_1} {K : Type v9682_2} {Λ : Type v9682_3} [inst9682_0 : MeasurableSpace Ω] [inst9682_1 : Fintype ι] [inst9682_2 : DecidableEq ι] + [inst9682_3 : Fintype K] [inst9682_4 : DecidableEq K] [inst9682_5 : Fintype Λ] [inst9682_6 : DecidableEq Λ] {μ : Measure Ω} + +def cqDistance (W V : K → K → Ω → Matrix ι ι ℂ) (μ : Measure Ω) : ℝ := + ∑ a, ∑ b, ∫ t, traceNorm (W a b t - V a b t) ∂μ + +def idealFiniteBlocks (sigma : Matrix ι ι ℂ) (a b : K) : Matrix ι ι ℂ := + if a = b then (1/(Fintype.card K : ℝ)) • sigma else 0 + +end + +section + +open Matrix + +open scoped ComplexOrder MatrixOrder Kronecker Matrix.Norms.L2Operator + +universe v9922_0 v9922_1 + +variable {ι : Type v9922_0} {κ : Type v9922_1} [inst9922_0 : Fintype ι] [inst9922_1 : Fintype κ] [inst9922_2 : DecidableEq ι] [inst9922_3 : DecidableEq κ] + +def compressReference (D : Matrix ι ι ℂ) : + Matrix (κ ⊕ ι) (κ ⊕ ι) ℂ →ₗ[ℂ] Matrix ι ι ℂ where + toFun Z := Z.submatrix Sum.inr Sum.inr + trace (Z.submatrix Sum.inl Sum.inl) • D + map_add' Z W := by simp [Matrix.submatrix_add,Matrix.trace_add,add_smul]; abel + map_smul' c Z := by simp [Matrix.submatrix_smul,Matrix.trace_smul,smul_smul,smul_add] + +omit inst9922_0 inst9922_2 inst9922_3 in +lemma compressReference_pos [Fintype ι] [DecidableEq ι] [DecidableEq κ] (D : Matrix ι ι ℂ) (hD : D.PosSemidef) + {Z : Matrix (κ ⊕ ι) (κ ⊕ ι) ℂ} (hZ : Z.PosSemidef) : + (compressReference D Z).PosSemidef := + (hZ.submatrix Sum.inr).add (hD.smul (hZ.submatrix Sum.inl).trace_nonneg) + +omit inst9922_2 inst9922_3 in +lemma compressReference_trace [DecidableEq ι] [DecidableEq κ] (D : Matrix ι ι ℂ) (hD : trace D = 1) + (Z : Matrix (κ ⊕ ι) (κ ⊕ ι) ℂ) : trace (compressReference D Z) = trace Z := by + change trace (Z.submatrix Sum.inr Sum.inr + trace (Z.submatrix Sum.inl Sum.inl) • D) = _ + rw [Matrix.trace_add,Matrix.trace_smul,hD,smul_eq_mul,mul_one] + simp only [trace,diag,Matrix.submatrix_apply,Fintype.sum_sum_type] + exact add_comm _ _ + +omit inst9922_0 inst9922_2 inst9922_3 in +lemma compressReference_right [Fintype ι] [DecidableEq ι] [DecidableEq κ] (D Z : Matrix ι ι ℂ) : + compressReference (κ := κ) D (fromBlocks 0 0 0 Z) = Z := by + ext i j + simp [compressReference,Matrix.submatrix,Matrix.trace,Matrix.diag] + +lemma padded_purification_unitary (M : Matrix ι κ ℂ) (S : Matrix ι ι ℂ) + (hS : S.IsHermitian) (hgram : M * Mᴴ = S * S) : + ∃ U : Matrix.unitaryGroup (κ ⊕ ι) ℂ, + fromBlocks (0 : Matrix κ κ ℂ) Mᴴ 0 0 = + (U : Matrix (κ ⊕ ι) (κ ⊕ ι) ℂ) * fromBlocks 0 0 0 S := by + apply exists_unitary_mul_of_gram_eq + simp [Matrix.fromBlocks_conjTranspose,Matrix.fromBlocks_multiply,hS.eq,hgram] + +def embedReference : Matrix κ κ ℂ →ₗ[ℂ] Matrix (κ ⊕ ι) (κ ⊕ ι) ℂ where + toFun Z := fromBlocks Z 0 0 0 + map_add' _ _ := by ext i j; cases i <;> cases j <;> simp + map_smul' _ _ := by ext i j; cases i <;> cases j <;> simp + +omit inst9922_2 in +lemma embedReference_pos [DecidableEq ι] {Z : Matrix κ κ ℂ} (hZ : Z.PosSemidef) : + (embedReference (ι := ι) Z).PosSemidef := by + have hh := hZ.mul_mul_conjTranspose_same (Matrix.fromRows (1 : Matrix κ κ ℂ) (0 : Matrix ι κ ℂ)) + rw [Matrix.conjTranspose_fromRows_eq_fromCols_conjTranspose,Matrix.fromRows_mul, + Matrix.fromRows_mul_fromCols] at hh + simpa [embedReference] using hh + +omit inst9922_2 inst9922_3 in +lemma embedReference_trace [DecidableEq ι] [DecidableEq κ] (Z : Matrix κ κ ℂ) : + trace (embedReference (ι := ι) Z) = trace Z := by + simp [embedReference,trace,diag,Fintype.sum_sum_type] + +def refSandwich (K : Matrix ι κ ℂ) : Matrix κ κ ℂ →ₗ[ℂ] Matrix ι ι ℂ where + toFun Z := K * Z * Kᴴ + map_add' _ _ := by simp [Matrix.mul_add,Matrix.add_mul] + map_smul' _ _ := by simp [Matrix.mul_smul,Matrix.smul_mul] + +lemma padded_purification_blocks (M : Matrix ι κ ℂ) (S : Matrix ι ι ℂ) + (hS : S.IsHermitian) (U : Matrix.unitaryGroup (κ ⊕ ι) ℂ) + (hU : fromBlocks (0 : Matrix κ κ ℂ) Mᴴ 0 0 = + (U : Matrix (κ ⊕ ι) (κ ⊕ ι) ℂ) * fromBlocks 0 0 0 S) + (X : Matrix ι ι ℂ) : + embedReference (ι := ι) (Mᴴ * X * M) = + (U : Matrix (κ ⊕ ι) (κ ⊕ ι) ℂ) * fromBlocks 0 0 0 (S * X * S) * + (U : Matrix (κ ⊕ ι) (κ ⊕ ι) ℂ)ᴴ := by + let A : Matrix (κ ⊕ ι) (κ ⊕ ι) ℂ := fromBlocks 0 Mᴴ 0 0 + let B : Matrix (κ ⊕ ι) (κ ⊕ ι) ℂ := fromBlocks 0 0 0 S + let Y : Matrix (κ ⊕ ι) (κ ⊕ ι) ℂ := fromBlocks 0 0 0 X + have he : embedReference (ι := ι) (Mᴴ * X * M) = A * Y * Aᴴ := by + simp [embedReference,A,Y,Matrix.fromBlocks_conjTranspose,Matrix.fromBlocks_multiply] + have hb : B * Y * Bᴴ = fromBlocks 0 0 0 (S*X*S) := by + simp [B,Y,Matrix.fromBlocks_conjTranspose,Matrix.fromBlocks_multiply,hS.eq] + change A = (U : Matrix (κ ⊕ ι) (κ ⊕ ι) ℂ)*B at hU + rw [he,hU,Matrix.conjTranspose_mul] + calc + (U : Matrix (κ ⊕ ι) (κ ⊕ ι) ℂ)*B*Y*(Bᴴ*(U : Matrix (κ ⊕ ι) (κ ⊕ ι) ℂ)ᴴ) = + (U : Matrix (κ ⊕ ι) (κ ⊕ ι) ℂ)*(B*Y*Bᴴ)*(U : Matrix (κ ⊕ ι) (κ ⊕ ι) ℂ)ᴴ := by noncomm_ring + _ = _ := by rw [hb] + +theorem purification_recovery (R : Matrix ι ι ℂ) (hR : Density R) + (M : Matrix ι κ ℂ) (hM : M * Mᴴ = R) : + ∃ L : Matrix κ κ ℂ →ₗ[ℂ] Matrix ι ι ℂ, + (∀ Z, Z.PosSemidef → (L Z).PosSemidef) ∧ + (∀ Z, trace (L Z) = trace Z) ∧ + ∀ X, L (Mᴴ * X * M) = CFC.sqrt R * X * CFC.sqrt R := by + let S := CFC.sqrt R + have hS : S.IsHermitian := (CFC.sqrt_nonneg R).posSemidef.isHermitian + have hgram : M*Mᴴ = S*S := by rw [hM]; exact (CFC.sqrt_mul_sqrt_self R hR.1.nonneg).symm + obtain ⟨U,hU⟩ := padded_purification_unitary M S hS hgram + let V : Matrix (κ ⊕ ι) (κ ⊕ ι) ℂ := U + let L := (compressReference (κ := κ) R).comp ((refSandwich Vᴴ).comp embedReference) + refine ⟨L,?_,?_,?_⟩ + · intro Z hZ + exact compressReference_pos R hR.1 ((embedReference_pos hZ).mul_mul_conjTranspose_same Vᴴ) + · intro Z + change trace (compressReference R (Vᴴ * embedReference Z * Vᴴᴴ)) = _ + rw [compressReference_trace R hR.2,Matrix.conjTranspose_conjTranspose, + Matrix.trace_mul_cycle,show V*Vᴴ = 1 from U.prop.2,one_mul,embedReference_trace] + · intro X + change compressReference R (Vᴴ * embedReference (Mᴴ*X*M) * Vᴴᴴ) = _ + rw [padded_purification_blocks M S hS U hU X,Matrix.conjTranspose_conjTranspose] + have hv : Vᴴ * (V * fromBlocks 0 0 0 (S*X*S) * Vᴴ) * V = + fromBlocks 0 0 0 (S*X*S) := by + rw [mul_assoc V _ _,← mul_assoc Vᴴ V _,show Vᴴ*V=1 from U.prop.1,one_mul, + mul_assoc,show Vᴴ*V=1 from U.prop.1,mul_one] + change compressReference R (Vᴴ*(V*fromBlocks 0 0 0 (S*X*S)*Vᴴ)*V) = _ + rw [hv,compressReference_right] + +end + +section + +open Matrix + +open scoped ComplexOrder MatrixOrder Matrix.Norms.L2Operator + +universe v10053_0 v10053_1 + +theorem purification_recovery_transpose {ι : Type v10053_0} {κ : Type v10053_1} + [Fintype ι] [Fintype κ] [DecidableEq ι] [DecidableEq κ] + (R : Matrix ι ι ℂ) (hR : Density R) + (M : Matrix ι κ ℂ) (hM : M * Mᴴ = R) : + ∃ L : Matrix κ κ ℂ →ₗ[ℂ] Matrix ι ι ℂ, + (∀ Z, Z.PosSemidef → (L Z).PosSemidef) ∧ + (∀ Z, trace (L Z) = trace Z) ∧ + ∀ X, L ((Mᴴ * X * M)ᵀ) = (CFC.sqrt R * X * CFC.sqrt R)ᵀ := by + obtain ⟨L,hpos,htr,hrec⟩ := purification_recovery R hR M hM + let J : Matrix κ κ ℂ →ₗ[ℂ] Matrix ι ι ℂ := + { toFun Z := (L Zᵀ)ᵀ + map_add' Z W := by simp only [Matrix.transpose_add,map_add] + map_smul' c Z := by simp only [Matrix.transpose_smul,map_smul,RingHom.id_apply] } + refine ⟨J,?_,?_,?_⟩ + · intro Z hZ + exact (hpos Zᵀ hZ.transpose).transpose + · intro Z + change trace (L Zᵀ)ᵀ = trace Z + rw [Matrix.trace_transpose,htr,Matrix.trace_transpose] + · intro X + change (L ((Mᴴ*X*M)ᵀ)ᵀ)ᵀ = _ + rw [Matrix.transpose_transpose,hrec] + +end + +section + +open Matrix + +open scoped ComplexOrder MatrixOrder Matrix.Norms.L2Operator Kronecker + +universe v10089_0 v10089_1 + +variable {ι : Type v10089_0} {κ : Type v10089_1} [inst10089_0 : Fintype ι] [inst10089_1 : Fintype κ] [inst10089_2 : DecidableEq ι] [inst10089_3 : DecidableEq κ] + +def purificationFilter (P : Matrix ι κ ℂ) : Matrix κ ι ℂ := + (Real.sqrt (Fintype.card ι : ℝ) : ℂ) • Pᵀ + +open MeasureTheory + +/-- Matrix-valued output entries after purification and publication of the transcript. -/ +def publicPurifiedEntries {Ω T K : Type*} [MeasurableSpace Ω] [MeasurableSpace T] + (μ : Measure Ω) (record : Ω → T) (W : K → K → Ω → Matrix ι ι ℂ) + (P : Matrix ι κ ℂ) (a b : K) (x y : κ) : ComplexMeasure T := + ∑ i, ∑ j, (purificationFilter P x i * star (purificationFilter P y j)) • + (μ.withDensityᵥ (fun ω => W a b ω i j)).map record + +/-- The positive representative of the entrywise Radon–Nikodym derivative. -/ +def positiveEntryDensity {Ω : Type*} [MeasurableSpace Ω] + (W : ι → ι → ComplexMeasure Ω) (μ : Measure Ω) (t : Ω) : Matrix ι ι ℂ := by + classical + let D : Matrix ι ι ℂ := fun i j => (W i j).rnDeriv μ t + exact if D.PosSemidef then D else 0 + +omit inst10089_1 inst10089_2 inst10089_3 in +lemma purificationFilter_block [Fintype κ] [DecidableEq ι] [DecidableEq κ] (P : Matrix ι κ ℂ) (U : Matrix ι ι ℂ) : + purificationFilter P * U * (purificationFilter P)ᴴ = + (Pᴴ * ((Fintype.card ι : ℂ) • Uᵀ) * P)ᵀ := by + have hc : (Real.sqrt (Fintype.card ι : ℝ) : ℂ) * + (Real.sqrt (Fintype.card ι : ℝ) : ℂ) = (Fintype.card ι : ℂ) := by + rw [← Complex.ofReal_mul,Real.mul_self_sqrt (Nat.cast_nonneg _)] + norm_cast + simp only [purificationFilter,Matrix.conjTranspose_smul,Complex.star_def, + Complex.conj_ofReal,Matrix.smul_mul,Matrix.mul_smul,smul_smul, + Matrix.transpose_mul,Matrix.transpose_smul,Matrix.transpose_transpose, + Matrix.conjTranspose_transpose_eq_transpose_conjTranspose] + rw [hc,Matrix.mul_assoc] + +lemma preparationFilter_eq_purificationFilter (R : Matrix ι ι ℂ) : + preparationFilter R = purificationFilter (CFC.sqrt R) := rfl + +theorem purification_filter_recovery (R : Matrix ι ι ℂ) (hR : Density R) + (P : Matrix ι κ ℂ) (hP : P * Pᴴ = R) : + ∃ L : Matrix κ κ ℂ →ₗ[ℂ] Matrix ι ι ℂ, + (∀ Z, Z.PosSemidef → (L Z).PosSemidef) ∧ + (∀ Z, trace (L Z) = trace Z) ∧ + ∀ U, L (purificationFilter P * U * (purificationFilter P)ᴴ) = + preparationFilter R * U * (preparationFilter R)ᴴ := by + obtain ⟨L,hpos,htr,he⟩ := purification_recovery_transpose R hR P hP + refine ⟨L,hpos,htr,?_⟩ + intro U + rw [purificationFilter_block,he,preparationFilter_eq_purificationFilter, + purificationFilter_block,(CFC.sqrt_nonneg R).posSemidef.isHermitian.eq] + +end + +open Matrix MeasureTheory ProbabilityTheory Function Filter + +open scoped ComplexOrder MatrixOrder Matrix.Norms.L2Operator Kronecker + +open UnrestrictedQuantum + +universe v10227_0 v10227_1 v10227_2 v10227_3 v10227_4 v10227_5 v10227_6 v10227_7 v10227_8 v10227_9 v10227_10 + +variable {O : Type v10227_0} {M : Type v10227_1} {ι : Type v10227_2} {η : Type v10227_3} [inst10227_0 : MeasurableSpace O] [inst10227_1 : MeasurableSpace M] + [inst10227_2 : StandardBorelSpace O] [inst10227_3 : Nonempty O] [inst10227_4 : StandardBorelSpace M] [inst10227_5 : Nonempty M] + [inst10227_6 : Fintype ι] [inst10227_7 : Fintype η] [inst10227_8 : DecidableEq ι] [inst10227_9 : DecidableEq η] + [inst10227_10 : Nonempty ι] [inst10227_11 : Nonempty η] + {d : Discussion O M} {A : ℕ → Type v10227_4} {B : ℕ → Type v10227_5} + [inst10227_12 : ∀ n, AddCommGroup (A n)] [inst10227_13 : ∀ n, Module ℂ (A n)] [inst10227_14 : ∀ n, One (A n)] [inst10227_15 : ∀ n, LE (A n)] + [inst10227_16 : ∀ n, AddCommGroup (B n)] [inst10227_17 : ∀ n, Module ℂ (B n)] [inst10227_18 : ∀ n, One (B n)] [inst10227_19 : ∀ n, LE (B n)] + {TA : Type v10227_6} {TB : Type v10227_7} {CA : Type v10227_8} {CB : Type v10227_9} + [inst10227_20 : AddCommGroup TA] [inst10227_21 : Module ℂ TA] [inst10227_22 : One TA] [inst10227_23 : LE TA] + [inst10227_24 : AddCommGroup TB] [inst10227_25 : Module ℂ TB] [inst10227_26 : One TB] [inst10227_27 : LE TB] + [inst10227_28 : AddCommGroup CA] [inst10227_29 : Module ℂ CA] [inst10227_30 : One CA] [inst10227_31 : LE CA] + [inst10227_32 : AddCommGroup CB] [inst10227_33 : Module ℂ CB] [inst10227_34 : One CB] [inst10227_35 : LE CB] + {κ : Type v10227_10} [inst10227_36 : Fintype κ] [inst10227_37 : DecidableEq κ] + +namespace BitProtocol + +variable (p : BitProtocol (ι := ι) (η := η) d A B TA TB CA CB) + (R : Matrix (ι × η) (ι × η) ℂ) (hR : Density R) + (P : Matrix (ι × η) κ ℂ) (hP : P * Pᴴ = R) + +def purifiedOutput (i j : Bool) : PositiveMatrixMeasure (ℕ → M) κ := + (p.probeOutput i j).filter (purificationFilter P) + +omit inst10227_10 inst10227_11 inst10227_37 in +lemma purifiedOutput_ac [Nonempty ι] [Nonempty η] [DecidableEq κ] (i j : Bool) (S : Set (ℕ → M)) (hS : MeasurableSet S) + (hnull : d.transcriptLaw S = 0) : (p.purifiedOutput P i j).value S = 0 := by + obtain ⟨X,Y,hXm,hYm,hX,hY,he,hn⟩ := p.public_factors + rw [purifiedOutput,PositiveMatrixMeasure.filter_value,he i j S hS, + Measure.restrict_eq_zero.mpr hnull,integral_zero_measure,Matrix.mul_zero,Matrix.zero_mul] + +include hR hP + +omit inst10227_10 inst10227_11 in +lemma purifiedOutput_recovery [Nonempty ι] [Nonempty η] : + ∃ L : Matrix κ κ ℂ →ₗ[ℂ] Matrix (ι × η) (ι × η) ℂ, + (∀ Z, Z.PosSemidef → (L Z).PosSemidef) ∧ + (∀ Z, trace (L Z) = trace Z) ∧ + ∀ i j S, L ((p.purifiedOutput P i j).value S) = (p.canonicalOutput R i j).value S := by + obtain ⟨L,hpos,htr,he⟩ := purification_filter_recovery R hR P hP + refine ⟨L,hpos,htr,?_⟩ + intro i j S + simpa only [purifiedOutput,canonicalOutput,PositiveMatrixMeasure.filter_value] using + he ((p.probeOutput i j).value S) + +lemma purifiedOutput_normalized : + (trace ((p.purifiedOutput P false false).value Set.univ)).re + + (trace ((p.purifiedOutput P false true).value Set.univ)).re + + (trace ((p.purifiedOutput P true false).value Set.univ)).re + + (trace ((p.purifiedOutput P true true).value Set.univ)).re = 1 := by + obtain ⟨L,hpos,htr,he⟩ := p.purifiedOutput_recovery R hR P hP + have hh i j : trace ((p.purifiedOutput P i j).value Set.univ) = + trace ((p.canonicalOutput R i j).value Set.univ) := by rw [← he,htr] + simp_rw [hh] + exact p.canonicalOutput_normalized R hR + +def purifiedDensity (ν : Measure (ℕ → M)) [SigmaFinite ν] + (hμν : d.transcriptLaw ≪ ν) : BitDensity ν κ := + PositiveMatrixMeasure.toBitDensity (p.purifiedOutput P) ν + (fun i j S hS hz => p.purifiedOutput_ac P i j S hS (hμν hz)) + (p.purifiedOutput_normalized R hR P hP) + +/-- The operational bit error written directly in terms of the output entries. -/ +def rawPurifiedSecretBitError (P : Matrix (ι × η) κ ℂ) + (sigma : PositiveMatrixMeasure (ℕ → M) κ) : ℝ := + let ν := d.transcriptLaw + sigma.traceMeasure + let τ := fun i j => positiveEntryDensity + (publicPurifiedEntries d.probeLaw d.sampler.publicRecord p.completeReference P i j) ν + let σ := sigma.positiveDensity ν + (∫ t, (trace (τ false true t)).re ∂ν) + + (∫ t, (trace (τ true false t)).re ∂ν) + + (∫ t, traceNorm (τ false false t - (1 / ((2 : ℕ) : ℝ)) • σ t) ∂ν) + + (∫ t, traceNorm (τ true true t - (1 / ((2 : ℕ) : ℝ)) • σ t) ∂ν) + +def purifiedSecretBitError (sigma : PositiveMatrixMeasure (ℕ → M) κ) : ℝ := + (p.purifiedDensity R hR P hP (d.transcriptLaw + sigma.traceMeasure) + (Measure.AbsolutelyContinuous.rfl.add_right _)).idealBitError + (sigma.positiveDensity (d.transcriptLaw + sigma.traceMeasure)) + +lemma rawPurifiedSecretBitError_eq (sigma : PositiveMatrixMeasure (ℕ → M) κ) : + p.rawPurifiedSecretBitError P sigma = p.purifiedSecretBitError R hR P hP sigma := rfl + +end BitProtocol + +end ZeroKey + +namespace UnrestrictedQuantum + +open Matrix MeasureTheory Filter + +open scoped ComplexOrder MatrixOrder Matrix.Norms.L2Operator + +section + +universe v10363_0 v10363_1 v10363_2 v10363_3 + +variable {A : Type v10363_0} {B : Type v10363_1} {O : Type v10363_2} {ι : Type v10363_3} [inst10363_0 : AddCommGroup A] [inst10363_1 : Module ℂ A] [inst10363_2 : One A] [inst10363_3 : LE A] + [inst10363_4 : AddCommGroup B] [inst10363_5 : Module ℂ B] [inst10363_6 : One B] [inst10363_7 : LE B] + [inst10363_8 : MeasurableSpace O] [inst10363_9 : Nonempty O] [inst10363_10 : Fintype ι] [inst10363_11 : DecidableEq ι] + +namespace ObservableInstrument + +def postprocess (J : ObservableInstrument O A B) (f : O → Bool) (hf : Measurable f) : + ObservableInstrument Bool A B where + operation E := J.operation (f ⁻¹' E) + positive E hE x hx := J.positive _ (hf hE) x hx + total_unit := by simpa only [Set.preimage_univ] using J.total_unit + +end ObservableInstrument + +namespace InstrumentRun + +variable {J : ObservableInstrument O A B} {S : ReferenceFunctional A ι} + (r : InstrumentRun J S) + +omit inst10363_9 inst10363_11 in +lemma event_trace [Nonempty O] [DecidableEq ι] (E : Set O) (hE : MeasurableSet E) : + trace (S (J.operation E 1)) = (r.law.real E : ℂ) := by + calc + _ = ∫ o in E, trace (r.posterior o 1) ∂r.law := by + simp only [trace,diag] + rw [integral_finsetSum _ (fun i _ => (r.integrable 1 i i).integrableOn)] + apply Finset.sum_congr rfl + intro i _ + exact (r.update E hE 1 i i).symm + _ = _ := by simp [r.posterior_trace,integral_const,Complex.real_smul,Measure.real] + +omit inst10363_9 inst10363_11 in +lemma event_zero [Nonempty O] [DecidableEq ι] (E : Set O) (hE : MeasurableSet E) (hz : r.law E = 0) (x : B) : + S (J.operation E x) = 0 := by + ext i j + rw [← r.update E hE x i j,Measure.restrict_eq_zero.mpr hz,integral_zero_measure] + rfl + +variable (f : O → Bool) (hf : Measurable f) + +def coarseMass (i : Bool) : ℝ := r.law.real (f ⁻¹' {i}) + +def coarsePosterior (i : Bool) : ReferenceFunctional B ι := + if r.coarseMass f i = 0 then r.posterior (Classical.choice ‹Nonempty O›) + else ((r.coarseMass f i)⁻¹ : ℝ) • (S.comp (J.operation (f ⁻¹' {i}))) + +include hf + +omit inst10363_11 in +lemma coarsePosterior_positive [DecidableEq ι] (hS : PositiveFunctional S) (i : Bool) : + PositiveFunctional (r.coarsePosterior f i) := by + unfold coarsePosterior + split + · exact r.posterior_positive _ + · intro x hx + exact (hS _ (J.positive _ (hf (measurableSet_singleton i)) x hx)).smul + (inv_nonneg.mpr (ENNReal.toReal_nonneg)) + +lemma coarsePosterior_trace (_hS : PositiveFunctional S) (i : Bool) : + trace (r.coarsePosterior f i 1) = 1 := by + unfold coarsePosterior + split + · exact r.posterior_trace _ + · rename_i hn + simp only [LinearMap.smul_apply,LinearMap.comp_apply,Matrix.trace_smul] + rw [r.event_trace _ (hf (measurableSet_singleton i))] + change ((r.coarseMass f i)⁻¹ : ℝ) • ((r.coarseMass f i : ℝ) : ℂ) = 1 + simp only [Complex.real_smul,Complex.ofReal_inv,inv_mul_cancel₀ (Complex.ofReal_ne_zero.mpr hn)] + +lemma coarsePosterior_weighted (i : Bool) (x : B) : + r.coarseMass f i • r.coarsePosterior f i x = S (J.operation (f ⁻¹' {i}) x) := by + let : IsProbabilityMeasure r.law := r.probability + unfold coarsePosterior + split + · rename_i hz + rw [hz,zero_smul] + symm + apply r.event_zero _ (hf (measurableSet_singleton i)) + exact (ENNReal.toReal_eq_zero_iff _).mp hz |>.resolve_right (measure_ne_top _ _) + · rename_i hn + simp only [LinearMap.smul_apply,LinearMap.comp_apply,smul_smul,mul_inv_cancel₀ hn,one_smul] + +lemma coarsePosterior_singleton (i : Bool) (x : B) (k l : ι) : + (∫ b in {i}, r.coarsePosterior f b x k l ∂(r.law.map f)) = + S (J.operation (f ⁻¹' {i}) x) k l := by + rw [integral_singleton] + have hm : (r.law.map f).real {i} = r.coarseMass f i := by + rw [Measure.real,Measure.map_apply hf (measurableSet_singleton i)] + rfl + rw [hm] + exact congrArg (fun U : Matrix ι ι ℂ => U k l) (r.coarsePosterior_weighted f hf i x) + +lemma coarsePosterior_integral (E : Set Bool) (x : B) (k l : ι) : + (∫ b in E, r.coarsePosterior f b x k l ∂(r.law.map f)) = + S (J.operation (f ⁻¹' E) x) k l := by + let : IsProbabilityMeasure r.law := r.probability + let : IsProbabilityMeasure (r.law.map f) := inferInstance + have hpart : E = ∅ ∨ E = {false} ∨ E = {true} ∨ E = Set.univ := by + by_cases h0 : false ∈ E <;> by_cases h1 : true ∈ E + · right; right; right; ext b; cases b <;> simp_all + · right; left; ext b; cases b <;> simp_all + · right; right; left; ext b; cases b <;> simp_all + · left; ext b; cases b <;> simp_all + rcases hpart with rfl | rfl | rfl | rfl + · simp only [setIntegral_empty,Set.preimage_empty] + exact (congrArg (fun U : Matrix ι ι ℂ => U k l) + (r.event_zero ∅ MeasurableSet.empty (measure_empty) x)).symm + · exact r.coarsePosterior_singleton f hf false x k l + · exact r.coarsePosterior_singleton f hf true x k l + · have hd : Disjoint (f ⁻¹' {false}) (f ⁻¹' {true}) := by + apply Set.disjoint_left.mpr + intro o h0 h1 + simp only [Set.mem_preimage,Set.mem_singleton_iff] at h0 h1 + rw [h0] at h1 + contradiction + have hu : (f ⁻¹' {false}) ∪ (f ⁻¹' {true}) = Set.univ := by + ext o; cases f o <;> simp + have hb : ({false} : Set Bool) ∪ {true} = Set.univ := by ext b; cases b <;> simp + rw [← hb,setIntegral_union (by simp) (measurableSet_singleton true) + Integrable.of_finite.integrableOn Integrable.of_finite.integrableOn, + r.coarsePosterior_singleton f hf false x k l, + r.coarsePosterior_singleton f hf true x k l] + rw [← r.update _ (hf (measurableSet_singleton false)) x k l, + ← r.update _ (hf (measurableSet_singleton true)) x k l] + rw [← setIntegral_union hd (hf (measurableSet_singleton true)) + (r.integrable x k l).integrableOn (r.integrable x k l).integrableOn,hu] + simpa only [Set.preimage_union,Set.preimage_univ,hu] using + r.update Set.univ MeasurableSet.univ x k l + +def postprocess (hS : PositiveFunctional S) : + InstrumentRun (J.postprocess f hf) S where + law := r.law.map f + probability := by + let : IsProbabilityMeasure r.law := r.probability + exact inferInstance + posterior := r.coarsePosterior f + posterior_positive := r.coarsePosterior_positive f hf hS + posterior_trace := r.coarsePosterior_trace f hf hS + integrable x k l := by + let : IsProbabilityMeasure r.law := r.probability + let : IsProbabilityMeasure (r.law.map f) := inferInstance + exact Integrable.of_finite + update E hE x k l := r.coarsePosterior_integral f hf E x k l + +end InstrumentRun + +end + +universe v10518_0 v10518_1 v10518_2 v10518_3 v10518_4 + +variable {A : Type v10518_0} {B : Type v10518_1} {K : Type v10518_2} {ι : Type v10518_3} {Ω : Type v10518_4} [inst10518_0 : AddCommGroup A] [inst10518_1 : Module ℂ A] [inst10518_2 : One A] [inst10518_3 : LE A] + [inst10518_4 : AddCommGroup B] [inst10518_5 : Module ℂ B] [inst10518_6 : One B] [inst10518_7 : LE B] + [inst10518_8 : MeasurableSpace K] [inst10518_9 : MeasurableSingletonClass K] [inst10518_10 : Fintype K] [inst10518_11 : DecidableEq K] [inst10518_12 : Nonempty K] + [inst10518_13 : Fintype ι] [inst10518_14 : DecidableEq ι] + +omit inst10518_10 inst10518_11 inst10518_12 inst10518_14 in +lemma InstrumentRun.event_finset [Fintype K] [DecidableEq K] [Nonempty K] [DecidableEq ι] {J : ObservableInstrument K A B} + {S : ReferenceFunctional A ι} (r : InstrumentRun J S) (s : Finset K) (x : B) : + S (J.operation s x) = ∑ k ∈ s, S (J.operation {k} x) := by + ext i j + simp only [Matrix.sum_apply] + rw [← r.update s (s.finite_toSet.measurableSet) x i j, + setIntegral_finset s (r.integrable x i j).integrableOn] + apply Finset.sum_congr rfl + intro k hk + rw [← r.update {k} (measurableSet_singleton k) x i j,integral_singleton] + +lemma InstrumentRun.event_total {J : ObservableInstrument K A B} + {S : ReferenceFunctional A ι} (r : InstrumentRun J S) : + (∑ k, S (J.operation {k} 1)) = S 1 := by + simpa only [Finset.coe_univ,J.total_unit] using (r.event_finset Finset.univ 1).symm + +variable {L : MeasurableSpace Ω} {mΩ : MeasurableSpace Ω} + {μ : Measure Ω} {F : Filtration ℕ mΩ} {U : ℕ → Ω → Matrix ι ι ℂ} + (e : IncomingObservableProcess (L := L) (A := A) μ F U) + +namespace IncomingObservableProcess + +structure FiniteReadout where + instrument : Ω → ObservableInstrument K A B + run : ∀ x, InstrumentRun (instrument x) (e.state x) + positive_unit : (0 : B) ≤ 1 + local_measurable : ∀ k, Measurable[L] (fun x => e.state x ((instrument x).operation {k} 1)) + +namespace FiniteReadout + +variable {e} (b : e.FiniteReadout (B := B) (K := K)) + +def value (k : K) (x : Ω) : Matrix ι ι ℂ := e.state x ((b.instrument x).operation {k} 1) + +omit inst10518_9 inst10518_10 inst10518_11 inst10518_12 in +lemma measurable [MeasurableSingletonClass K] [Fintype K] [DecidableEq K] [Nonempty K] (k : K) : Measurable[L] (b.value k) := b.local_measurable k + +omit inst10518_10 inst10518_11 inst10518_12 in +lemma positive [Fintype K] [DecidableEq K] [Nonempty K] (k : K) (x : Ω) : (b.value k x).PosSemidef := + e.positive x _ ((b.instrument x).positive {k} (measurableSet_singleton k) 1 b.positive_unit) + +lemma sum (x : Ω) : (∑ k, b.value k x) = e.state x 1 := (b.run x).event_total + +lemma subdensity (k : K) (x : Ω) : ZeroKey.Subdensity (b.value k x) := by + refine ⟨b.positive k x,?_⟩ + have hsum := congrArg (fun M : Matrix ι ι ℂ => (trace M).re) (b.sum x) + simp only [Matrix.trace_sum,Complex.re_sum,e.normalized x,Complex.one_re] at hsum + rw [← hsum] + exact Finset.single_le_sum (fun l _ => (RCLike.nonneg_iff.mp (b.positive l x).trace_nonneg).1) + (Finset.mem_univ k) + +lemma event_finset (s : Finset K) (x : Ω) : + e.state x ((b.instrument x).operation s 1) = ∑ k ∈ s, b.value k x := + (b.run x).event_finset s 1 + +lemma eventMeasurable (s : Finset K) : + Measurable[L] (fun x => e.state x ((b.instrument x).operation s 1)) := by + simp_rw [b.event_finset s] + exact Finset.measurable_sum s (fun k _ => b.local_measurable k) + +def postprocess (f : K → Bool) : e.BitReadout (B := B) where + instrument x := (b.instrument x).postprocess f (measurable_of_finite f) + run x := (b.run x).postprocess f (measurable_of_finite f) (e.positive x) + positive_unit := b.positive_unit + local_measurable i := by + let s := Finset.univ.filter (fun k => f k = i) + have hs : (s : Set K) = f ⁻¹' {i} := by ext k; simp [s] + change Measurable[L] (fun x => e.state x ((b.instrument x).operation (f ⁻¹' {i}) 1)) + rw [← hs] + exact b.eventMeasurable s + +end FiniteReadout + +end IncomingObservableProcess + +end UnrestrictedQuantum + +namespace ZeroKey + +section + +open Matrix MeasureTheory ProbabilityTheory Function unitInterval Filter + +open scoped ComplexOrder MatrixOrder Matrix.Norms.L2Operator Kronecker + +section + +open UnrestrictedQuantum + +universe v10619_0 v10619_1 v10619_2 v10619_3 v10619_4 v10619_5 v10619_6 v10619_7 v10619_8 v10619_9 v10619_10 + +variable {O : Type v10619_0} {M : Type v10619_1} {ι : Type v10619_2} {η : Type v10619_3} [inst10619_0 : MeasurableSpace O] [inst10619_1 : MeasurableSpace M] + [inst10619_2 : StandardBorelSpace O] [inst10619_3 : Nonempty O] [inst10619_4 : StandardBorelSpace M] [inst10619_5 : Nonempty M] + [inst10619_6 : Fintype ι] [inst10619_7 : Fintype η] [inst10619_8 : DecidableEq ι] [inst10619_9 : DecidableEq η] + {K : Type v10619_4} [inst10619_10 : MeasurableSpace K] [inst10619_11 : MeasurableSingletonClass K] + [inst10619_12 : Fintype K] [inst10619_13 : DecidableEq K] [inst10619_14 : Nonempty K] + (d : Discussion O M) + (A : ℕ → Type v10619_5) (B : ℕ → Type v10619_6) + [inst10619_15 : ∀ n, AddCommGroup (A n)] [inst10619_16 : ∀ n, Module ℂ (A n)] [inst10619_17 : ∀ n, One (A n)] [inst10619_18 : ∀ n, LE (A n)] + [inst10619_19 : ∀ n, AddCommGroup (B n)] [inst10619_20 : ∀ n, Module ℂ (B n)] [inst10619_21 : ∀ n, One (B n)] [inst10619_22 : ∀ n, LE (B n)] + (TA : Type v10619_7) (TB : Type v10619_8) (CA : Type v10619_9) (CB : Type v10619_10) + [inst10619_23 : AddCommGroup TA] [inst10619_24 : Module ℂ TA] [inst10619_25 : One TA] [inst10619_26 : LE TA] + [inst10619_27 : AddCommGroup TB] [inst10619_28 : Module ℂ TB] [inst10619_29 : One TB] [inst10619_30 : LE TB] + [inst10619_31 : AddCommGroup CA] [inst10619_32 : Module ℂ CA] [inst10619_33 : One CA] [inst10619_34 : LE CA] + [inst10619_35 : AddCommGroup CB] [inst10619_36 : Module ℂ CB] [inst10619_37 : One CB] [inst10619_38 : LE CB] + +structure FiniteProtocol where + executionA : LocalObservableExecution (ι := ι) A d.kernelA d.sendA + executionB : LocalObservableExecution (ι := η) B d.kernelB d.sendB + initialA : executionA.reference 0 (Fin.elim0,Fin.elim0) = + keepReference (outer (localProbe (ι := ι)) localProbe) + initialB : executionB.reference 0 (Fin.elim0,Fin.elim0) = + keepReference (outer (localProbe (ι := η)) localProbe) + incomingA : IncomingObservableProcess (L := d.sampler.localField true) (A := TA) + d.probeLaw historyFiltration + (fun n x => AdaptiveQuantum.globalLocalReferenceA d.sampler d.kernelA executionA n (historyPrefix n x)) + incomingB : IncomingObservableProcess (L := d.sampler.localField false) (A := TB) + d.probeLaw historyFiltration + (fun n x => AdaptiveQuantum.globalLocalReferenceB d.sampler d.kernelB executionB n (historyPrefix n x)) + readoutA : incomingA.FiniteReadout (B := CA) (K := K) + readoutB : incomingB.FiniteReadout (B := CB) (K := K) + +variable {d A B TA TB CA CB} + +namespace FiniteProtocol + +variable (p : FiniteProtocol (ι := ι) (η := η) (K := K) d A B TA TB CA CB) + +def toBit (f : K → Bool) : BitProtocol (ι := ι) (η := η) d A B TA TB CA CB where + executionA := p.executionA + executionB := p.executionB + initialA := p.initialA + initialB := p.initialB + incomingA := p.incomingA + incomingB := p.incomingB + readoutA := p.readoutA.postprocess f + readoutB := p.readoutB.postprocess f + +def completeReference (i j : K) (x : ℕ → O) : Matrix (ι × η) (ι × η) ℂ := + p.readoutA.value i x ⊗ₖ p.readoutB.value j x + +omit inst10619_4 inst10619_5 in +lemma completeReference_positive [StandardBorelSpace M] [Nonempty M] (i j : K) (x : ℕ → O) : + (p.completeReference i j x).PosSemidef := + (p.readoutA.positive i x).kronecker (p.readoutB.positive j x) + +omit inst10619_4 inst10619_5 in +lemma completeReference_measurable [StandardBorelSpace M] [Nonempty M] (i j : K) : Measurable (p.completeReference i j) := + measurable_matrix_kronecker + ((p.readoutA.measurable i).mono (d.sampler.localField_le true) le_rfl) + ((p.readoutB.measurable j).mono (d.sampler.localField_le false) le_rfl) + +lemma completeReference_integrable (i j : K) : Integrable (p.completeReference i j) d.probeLaw := + integrable_subdensity _ + (fun x => subdensity_kronecker (p.readoutA.subdensity i x) (p.readoutB.subdensity j x)) + (p.completeReference_measurable i j) d.probeLaw + +lemma completeReference_entry_integrable (i j : K) (k l : ι × η) : + Integrable (fun x => p.completeReference i j x k l) d.probeLaw := + ((Matrix.entryLinearMap ℂ ℂ k l).toContinuousLinearMap).integrable_comp + (p.completeReference_integrable i j) + +def probeOutput (i j : K) : PositiveMatrixMeasure (ℕ → M) (ι × η) := + (positiveMatrixMeasureOfDensity (p.completeReference_entry_integrable i j) + (Eventually.of_forall (p.completeReference_positive i j))).pushforward + d.sampler.publicRecord d.sampler.measurable_publicRecord + +lemma probeOutput_event (i j : K) (S : Set (ℕ → M)) (hS : MeasurableSet S) : + (p.probeOutput i j).value S = + ∫ x in d.sampler.publicRecord ⁻¹' S, p.completeReference i j x ∂d.probeLaw := by + rw [probeOutput,PositiveMatrixMeasure.pushforward_value _ _ _ S hS, + positiveMatrixMeasureOfDensity_value _ _ _ (d.sampler.measurable_publicRecord hS)] + +def canonicalOutput (R : Matrix (ι × η) (ι × η) ℂ) (i j : K) : + PositiveMatrixMeasure (ℕ → M) (ι × η) := + (p.probeOutput i j).filter (preparationFilter R) + +lemma canonicalOutput_event (R : Matrix (ι × η) (ι × η) ℂ) + (i j : K) (S : Set (ℕ → M)) (hS : MeasurableSet S) : + (p.canonicalOutput R i j).value S = + ∫ x in d.sampler.publicRecord ⁻¹' S, + preparationFilter R * p.completeReference i j x * (preparationFilter R)ᴴ ∂d.probeLaw := by + rw [canonicalOutput,PositiveMatrixMeasure.filter_value,p.probeOutput_event i j S hS, + integral_filter _ (p.completeReference_integrable i j).integrableOn] + +end FiniteProtocol + +end + +open UnrestrictedQuantum + +universe v10926_0 v10926_1 v10926_2 v10926_3 v10926_4 v10926_5 v10926_6 v10926_7 v10926_8 v10926_9 v10926_10 + +variable {O : Type v10926_0} {M : Type v10926_1} {ι : Type v10926_2} {η : Type v10926_3} [inst10926_0 : MeasurableSpace O] [inst10926_1 : MeasurableSpace M] + [inst10926_2 : StandardBorelSpace O] [inst10926_3 : Nonempty O] [inst10926_4 : StandardBorelSpace M] [inst10926_5 : Nonempty M] + [inst10926_6 : Fintype ι] [inst10926_7 : Fintype η] [inst10926_8 : DecidableEq ι] [inst10926_9 : DecidableEq η] + {K : Type v10926_4} [inst10926_10 : MeasurableSpace K] [inst10926_11 : MeasurableSingletonClass K] + [inst10926_12 : Fintype K] [inst10926_13 : DecidableEq K] [inst10926_14 : Nonempty K] + [inst10926_15 : Nonempty ι] [inst10926_16 : Nonempty η] + (d : Discussion O M) + (A : ℕ → Type v10926_5) (B : ℕ → Type v10926_6) + [inst10926_17 : ∀ n, AddCommGroup (A n)] [inst10926_18 : ∀ n, Module ℂ (A n)] [inst10926_19 : ∀ n, One (A n)] [inst10926_20 : ∀ n, LE (A n)] + [inst10926_21 : ∀ n, AddCommGroup (B n)] [inst10926_22 : ∀ n, Module ℂ (B n)] [inst10926_23 : ∀ n, One (B n)] [inst10926_24 : ∀ n, LE (B n)] + (TA : Type v10926_7) (TB : Type v10926_8) (CA : Type v10926_9) (CB : Type v10926_10) + [inst10926_25 : AddCommGroup TA] [inst10926_26 : Module ℂ TA] [inst10926_27 : One TA] [inst10926_28 : LE TA] + [inst10926_29 : AddCommGroup TB] [inst10926_30 : Module ℂ TB] [inst10926_31 : One TB] [inst10926_32 : LE TB] + [inst10926_33 : AddCommGroup CA] [inst10926_34 : Module ℂ CA] [inst10926_35 : One CA] [inst10926_36 : LE CA] + [inst10926_37 : AddCommGroup CB] [inst10926_38 : Module ℂ CB] [inst10926_39 : One CB] [inst10926_40 : LE CB] + +variable {d A B TA TB CA CB} + +namespace FiniteProtocol + +variable (p : FiniteProtocol (ι := ι) (η := η) (K := K) d A B TA TB CA CB) + +omit inst10926_4 inst10926_5 inst10926_15 inst10926_16 in +lemma completeReference_sum [StandardBorelSpace M] [Nonempty M] [Nonempty ι] [Nonempty η] (x : ℕ → O) : + (∑ i, ∑ j, p.completeReference i j x) = + p.incomingA.state x 1 ⊗ₖ p.incomingB.state x 1 := by + rw [← p.readoutA.sum x,← p.readoutB.sum x] + ext a b + simp only [completeReference,Matrix.sum_apply,Matrix.kroneckerMap_apply, + Finset.sum_mul,Finset.mul_sum] + rw [Finset.sum_comm] + +lemma completeReference_total : + (∑ i, ∑ j, ∫ x, p.completeReference i j x ∂d.probeLaw) = + keepReference (outer (localProbe (ι := ι × η)) localProbe) := by + + simp_rw [← integral_finsetSum _ (fun j _ => p.completeReference_integrable _ j)] + rw [← integral_finsetSum _ (fun i _ => integrable_finsetSum _ + (fun j _ => p.completeReference_integrable i j))] + simp_rw [p.completeReference_sum] + have hc := AdaptiveQuantum.incoming_joint_reference_consistency + d.sampler d.kernelA d.kernelB p.executionA p.executionB d.probeLaw d.probeLaw_prefix + p.incomingA p.incomingB 0 Set.univ MeasurableSet.univ + simp only [Measure.restrict_univ] at hc + rw [hc] + have hpre (x : ℕ → O) : historyPrefix 0 x = Fin.elim0 := Subsingleton.elim _ _ + simp_rw [hpre] + have hi := (p.toBit (fun _ => false)).initial_joint_reference + change AdaptiveQuantum.jointReference d.sampler d.kernelA d.kernelB p.executionA p.executionB + 0 Fin.elim0 = _ at hi + simp [hi] + +lemma canonicalOutput_sum (R : Matrix (ι × η) (ι × η) ℂ) (hR : Density R) : + (∑ i, ∑ j, (p.canonicalOutput R i j).value Set.univ) = Rᵀ := by + simp_rw [p.canonicalOutput_event R _ _ Set.univ MeasurableSet.univ, + Set.preimage_univ,Measure.restrict_univ] + simp_rw [integral_filter _ (p.completeReference_integrable _ _)] + simp only [← Matrix.sum_mul,← Matrix.mul_sum] + rw [p.completeReference_total,← keepReference_filter,preparation_filter_identity, + canonical_reference R hR.1] + +lemma canonicalOutput_normalized (R : Matrix (ι × η) (ι × η) ℂ) (hR : Density R) : + (∑ i, ∑ j, (trace ((p.canonicalOutput R i j).value Set.univ)).re) = 1 := by + have h := congrArg (fun X : Matrix (ι × η) (ι × η) ℂ => (trace X).re) + (p.canonicalOutput_sum R hR) + simpa only [Matrix.trace_sum,Complex.re_sum,Matrix.trace_transpose,hR.2,Complex.one_re] using h + +end FiniteProtocol + +end + +section + +open Matrix MeasureTheory ProbabilityTheory Function Filter + +open scoped ComplexOrder MatrixOrder Matrix.Norms.L2Operator Kronecker + +open UnrestrictedQuantum + +universe v11008_0 v11008_1 v11008_2 v11008_3 v11008_4 v11008_5 v11008_6 v11008_7 v11008_8 v11008_9 v11008_10 v11008_11 + +variable {O : Type v11008_0} {M : Type v11008_1} {ι : Type v11008_2} {η : Type v11008_3} [inst11008_0 : MeasurableSpace O] [inst11008_1 : MeasurableSpace M] + [inst11008_2 : StandardBorelSpace O] [inst11008_3 : Nonempty O] [inst11008_4 : StandardBorelSpace M] [inst11008_5 : Nonempty M] + [inst11008_6 : Fintype ι] [inst11008_7 : Fintype η] [inst11008_8 : DecidableEq ι] [inst11008_9 : DecidableEq η] [inst11008_10 : Nonempty ι] [inst11008_11 : Nonempty η] + {K : Type v11008_4} [inst11008_12 : MeasurableSpace K] [inst11008_13 : MeasurableSingletonClass K] + [inst11008_14 : Fintype K] [inst11008_15 : DecidableEq K] [inst11008_16 : Nonempty K] + {d : Discussion O M} {A : ℕ → Type v11008_5} {B : ℕ → Type v11008_6} + [inst11008_17 : ∀ n, AddCommGroup (A n)] [inst11008_18 : ∀ n, Module ℂ (A n)] [inst11008_19 : ∀ n, One (A n)] [inst11008_20 : ∀ n, LE (A n)] + [inst11008_21 : ∀ n, AddCommGroup (B n)] [inst11008_22 : ∀ n, Module ℂ (B n)] [inst11008_23 : ∀ n, One (B n)] [inst11008_24 : ∀ n, LE (B n)] + {TA : Type v11008_7} {TB : Type v11008_8} {CA : Type v11008_9} {CB : Type v11008_10} + [inst11008_25 : AddCommGroup TA] [inst11008_26 : Module ℂ TA] [inst11008_27 : One TA] [inst11008_28 : LE TA] + [inst11008_29 : AddCommGroup TB] [inst11008_30 : Module ℂ TB] [inst11008_31 : One TB] [inst11008_32 : LE TB] + [inst11008_33 : AddCommGroup CA] [inst11008_34 : Module ℂ CA] [inst11008_35 : One CA] [inst11008_36 : LE CA] + [inst11008_37 : AddCommGroup CB] [inst11008_38 : Module ℂ CB] [inst11008_39 : One CB] [inst11008_40 : LE CB] + {κ : Type v11008_11} [inst11008_41 : Fintype κ] [inst11008_42 : DecidableEq κ] + +namespace FiniteProtocol + +variable (p : FiniteProtocol (ι := ι) (η := η) (K := K) d A B TA TB CA CB) + +def purifiedOutput (P : Matrix (ι × η) κ ℂ) (i j : K) : PositiveMatrixMeasure (ℕ → M) κ := + (p.probeOutput i j).filter (purificationFilter P) + +omit inst11008_10 inst11008_11 in +lemma purifiedOutput_event [Nonempty ι] [Nonempty η] (P : Matrix (ι × η) κ ℂ) + (i j : K) (S : Set (ℕ → M)) (hS : MeasurableSet S) : + (p.purifiedOutput P i j).value S = + ∫ x in d.sampler.publicRecord ⁻¹' S, + purificationFilter P * p.completeReference i j x * (purificationFilter P)ᴴ ∂d.probeLaw := by + rw [purifiedOutput,PositiveMatrixMeasure.filter_value,p.probeOutput_event i j S hS, + integral_filter _ (p.completeReference_integrable i j).integrableOn] + +lemma purifiedOutput_ac (P : Matrix (ι × η) κ ℂ) (i j : K) + (S : Set (ℕ → M)) (hS : MeasurableSet S) (hz : d.transcriptLaw S = 0) : + (p.purifiedOutput P i j).value S = 0 := by + have hp : d.probeLaw (d.sampler.publicRecord ⁻¹' S) = 0 := by + simpa only [Discussion.transcriptLaw,Measure.map_apply d.sampler.measurable_publicRecord hS] using hz + rw [p.purifiedOutput_event P i j S hS,Measure.restrict_eq_zero.mpr hp,integral_zero_measure] + +lemma purifiedOutput_normalized (R : Matrix (ι × η) (ι × η) ℂ) (hR : Density R) + (P : Matrix (ι × η) κ ℂ) (hP : P * Pᴴ = R) : + (trace (∑ i, ∑ j, (p.purifiedOutput P i j).value Set.univ)).re = 1 := by + obtain ⟨L,hpos,htr,he⟩ := purification_filter_recovery R hR P hP + have hh i j : trace ((p.purifiedOutput P i j).value Set.univ) = + trace ((p.canonicalOutput R i j).value Set.univ) := by + rw [← htr] + simpa only [purifiedOutput, canonicalOutput, PositiveMatrixMeasure.filter_value] using + congrArg trace (he ((p.probeOutput i j).value Set.univ)) + simp_rw [Matrix.trace_sum,Complex.re_sum,hh] + simpa only [Matrix.trace_sum,Complex.re_sum] using p.canonicalOutput_normalized R hR + +def purifiedOutputDensity (P : Matrix (ι × η) κ ℂ) (ν : Measure (ℕ → M)) (i j : K) : + (ℕ → M) → Matrix κ κ ℂ := (p.purifiedOutput P i j).positiveDensity ν + +end FiniteProtocol + +end + +section + +open Matrix MeasureTheory Filter + +open scoped ComplexOrder MatrixOrder Matrix.Norms.L2Operator + +universe v11165_0 v11165_1 v11165_2 + +variable {Ω : Type v11165_0} {ι : Type v11165_1} {K : Type v11165_2} [inst11165_0 : MeasurableSpace Ω] [inst11165_1 : Fintype ι] [inst11165_2 : DecidableEq ι] + [inst11165_3 : Fintype K] [inst11165_4 : DecidableEq K] {μ : Measure Ω} + +universe v11171_0 v11171_1 + +structure KeyDensity (μ : Measure Ω) (K : Type v11171_0) (ι : Type v11171_1) [Fintype K] [Fintype ι] [DecidableEq ι] where + block : K → K → Ω → Matrix ι ι ℂ + measurable : ∀ a b, Measurable (block a b) + positive : ∀ a b t, (block a b t).PosSemidef + integrable : ∀ a b, Integrable (fun t => (trace (block a b t)).re) μ + normalized : (∑ a, ∑ b, ∫ t, (trace (block a b t)).re ∂μ) = 1 + +universe v11179_0 + +structure EveDensity (μ : Measure Ω) (ι : Type v11179_0) [Fintype ι] [DecidableEq ι] where + block : Ω → Matrix ι ι ℂ + measurable : Measurable block + positive : ∀ t, (block t).PosSemidef + integrable : Integrable (fun t => (trace (block t)).re) μ + normalized : (∫ t, (trace (block t)).re ∂μ) = 1 + +namespace KeyDensity + +variable (τ υ : KeyDensity μ K ι) (sigma : EveDensity μ ι) + +def idealError : ℝ := cqDistance τ.block (fun a b t => idealFiniteBlocks (sigma.block t) a b) μ + +def distance : ℝ := cqDistance τ.block υ.block μ + +end KeyDensity + +end + +section + +open Matrix MeasureTheory ProbabilityTheory Filter + +open scoped ComplexOrder MatrixOrder Matrix.Norms.L2Operator + +open UnrestrictedQuantum + +universe v11244_0 v11244_1 v11244_2 v11244_3 v11244_4 v11244_5 v11244_6 v11244_7 v11244_8 v11244_9 v11244_10 v11244_11 + +variable {O : Type v11244_0} {M : Type v11244_1} {ι : Type v11244_2} {η : Type v11244_3} [inst11244_0 : MeasurableSpace O] [inst11244_1 : MeasurableSpace M] + [inst11244_2 : StandardBorelSpace O] [inst11244_3 : Nonempty O] [inst11244_4 : StandardBorelSpace M] [inst11244_5 : Nonempty M] + [inst11244_6 : Fintype ι] [inst11244_7 : Fintype η] [inst11244_8 : DecidableEq ι] [inst11244_9 : DecidableEq η] [inst11244_10 : Nonempty ι] [inst11244_11 : Nonempty η] + {K : Type v11244_4} [inst11244_12 : MeasurableSpace K] [inst11244_13 : MeasurableSingletonClass K] + [inst11244_14 : Fintype K] [inst11244_15 : DecidableEq K] [inst11244_16 : Nonempty K] + {d : Discussion O M} {A : ℕ → Type v11244_5} {B : ℕ → Type v11244_6} + [inst11244_17 : ∀ n, AddCommGroup (A n)] [inst11244_18 : ∀ n, Module ℂ (A n)] [inst11244_19 : ∀ n, One (A n)] [inst11244_20 : ∀ n, LE (A n)] + [inst11244_21 : ∀ n, AddCommGroup (B n)] [inst11244_22 : ∀ n, Module ℂ (B n)] [inst11244_23 : ∀ n, One (B n)] [inst11244_24 : ∀ n, LE (B n)] + {TA : Type v11244_7} {TB : Type v11244_8} {CA : Type v11244_9} {CB : Type v11244_10} + [inst11244_25 : AddCommGroup TA] [inst11244_26 : Module ℂ TA] [inst11244_27 : One TA] [inst11244_28 : LE TA] + [inst11244_29 : AddCommGroup TB] [inst11244_30 : Module ℂ TB] [inst11244_31 : One TB] [inst11244_32 : LE TB] + [inst11244_33 : AddCommGroup CA] [inst11244_34 : Module ℂ CA] [inst11244_35 : One CA] [inst11244_36 : LE CA] + [inst11244_37 : AddCommGroup CB] [inst11244_38 : Module ℂ CB] [inst11244_39 : One CB] [inst11244_40 : LE CB] + {κ : Type v11244_11} [inst11244_41 : Fintype κ] [inst11244_42 : DecidableEq κ] + +def FiniteProtocol.purifiedKeyDensity + (p : FiniteProtocol (ι := ι) (η := η) (K := K) d A B TA TB CA CB) + (R : Matrix (ι × η) (ι × η) ℂ) (hR : Density R) + (P : Matrix (ι × η) κ ℂ) (hP : P * Pᴴ = R) + (ν : Measure (ℕ → M)) [SigmaFinite ν] (hμν : d.transcriptLaw ≪ ν) : KeyDensity ν K κ where + block := p.purifiedOutputDensity P ν + measurable := fun i j => (p.purifiedOutput P i j).measurable_positiveDensity ν + positive := fun i j => (p.purifiedOutput P i j).positiveDensity_pos ν + integrable := fun i j => (p.purifiedOutput P i j).integrable_positiveDensity_trace ν + (fun S hS hz => p.purifiedOutput_ac P i j S hS (hμν hz)) + normalized := by + have he i j := (p.purifiedOutput P i j).integral_positiveDensity_trace ν + (fun S hS hz => p.purifiedOutput_ac P i j S hS (hμν hz)) + change (∑ i, ∑ j, ∫ t, (trace ((p.purifiedOutput P i j).positiveDensity ν t)).re ∂ν) = 1 + simp_rw [he] + simpa only [Matrix.trace_sum,Complex.re_sum] using p.purifiedOutput_normalized R hR P hP + +end + +section + +open Matrix MeasureTheory ProbabilityTheory Filter + +section + +universe u + +def KeyWord : ℕ → Type + | 0 => Unit + | n+1 => Bool × KeyWord n + +instance keyWordFintype (n : ℕ) : Fintype (KeyWord n) := by + induction n with + | zero => exact inferInstanceAs (Fintype Unit) + | succ n ih => letI := ih; exact inferInstanceAs (Fintype (Bool × KeyWord n)) + +instance keyWordDecidableEq (n : ℕ) : DecidableEq (KeyWord n) := by + induction n with + | zero => exact inferInstanceAs (DecidableEq Unit) + | succ n ih => letI := ih; exact inferInstanceAs (DecidableEq (Bool × KeyWord n)) + +instance keyWordNonempty (n : ℕ) : Nonempty (KeyWord n) := by + induction n with + | zero => exact inferInstanceAs (Nonempty Unit) + | succ n ih => let := ih; exact inferInstanceAs (Nonempty (Bool × KeyWord n)) + +instance keyWordMeasurableSpace (n : ℕ) : MeasurableSpace (KeyWord n) := by + induction n with + | zero => exact inferInstanceAs (MeasurableSpace Unit) + | succ n ih => letI := ih; exact inferInstanceAs (MeasurableSpace (Bool × KeyWord n)) + +instance keyWordMeasurableSingletonClass (n : ℕ) : MeasurableSingletonClass (KeyWord n) := by + induction n with + | zero => exact inferInstanceAs (MeasurableSingletonClass Unit) + | succ n ih => let := ih; exact inferInstanceAs (MeasurableSingletonClass (Bool × KeyWord n)) + +structure QuantumMemory where + Carrier : Type u + additive : AddCommGroup Carrier + complexModule : Module ℂ Carrier + unit : One Carrier + order : LE Carrier + +attribute [instance] QuantumMemory.additive QuantumMemory.complexModule QuantumMemory.unit QuantumMemory.order + +instance : CoeSort QuantumMemory (Type u) := ⟨QuantumMemory.Carrier⟩ + +structure ClassicalRecordSpace where + Carrier : Type u + measurableSpace : MeasurableSpace Carrier + standardBorel : StandardBorelSpace Carrier + nonempty : Nonempty Carrier + +attribute [instance] ClassicalRecordSpace.measurableSpace ClassicalRecordSpace.standardBorel ClassicalRecordSpace.nonempty + +instance : CoeSort ClassicalRecordSpace (Type u) := ⟨ClassicalRecordSpace.Carrier⟩ + +end + +open Matrix MeasureTheory ProbabilityTheory Filter + +open scoped ComplexOrder MatrixOrder Matrix.Norms.L2Operator + +universe u + +structure KeyImplementation (a b ell : ℕ) (messages : ClassicalRecordSpace.{u}) where + outcomes : ClassicalRecordSpace.{u} + discussion : Discussion outcomes messages + memoryA : ℕ → QuantumMemory.{u} + memoryB : ℕ → QuantumMemory.{u} + incomingMemoryA : QuantumMemory.{u} + incomingMemoryB : QuantumMemory.{u} + outgoingMemoryA : QuantumMemory.{u} + outgoingMemoryB : QuantumMemory.{u} + protocol : FiniteProtocol (ι := Fin a) (η := Fin b) (K := KeyWord ell) discussion + (fun n => memoryA n) (fun n => memoryB n) + incomingMemoryA incomingMemoryB outgoingMemoryA outgoingMemoryB + +namespace KeyImplementation + +variable {a b ell : ℕ} {messages : ClassicalRecordSpace.{u}} + [inst11471_0 : Nonempty (Fin a)] [inst11471_1 : Nonempty (Fin b)] + (p : KeyImplementation a b ell messages) + (R : Matrix (Fin a × Fin b) (Fin a × Fin b) ℂ) (hR : Density R) + {e : ℕ} (P : Matrix (Fin a × Fin b) (Fin e) ℂ) (hP : P * Pᴴ = R) + (ν : Measure (ℕ → messages)) [inst11471_2 : SigmaFinite ν] (hμν : p.discussion.transcriptLaw ≪ ν) + +def output : KeyDensity ν (KeyWord ell) (Fin e) := + p.protocol.purifiedKeyDensity R hR P hP ν hμν + +end KeyImplementation + +def IsCompletedKeyOutput {a b ell e : ℕ} [Nonempty (Fin a)] [Nonempty (Fin b)] + (R : Matrix (Fin a × Fin b) (Fin a × Fin b) ℂ) (_hR : Density R) + (P : Matrix (Fin a × Fin b) (Fin e) ℂ) (_hP : P * Pᴴ = R) + (messages : ClassicalRecordSpace.{u}) (ν : Measure (ℕ → messages)) [SigmaFinite ν] + (τ : KeyDensity ν (KeyWord ell) (Fin e)) : Prop := + ∃ p : ℕ → KeyImplementation a b ell messages, + ∃ _hAC : ∀ j, (p j).discussion.transcriptLaw ≪ ν, + Tendsto (fun j => cqDistance + (fun a b => positiveEntryDensity + (publicPurifiedEntries (p j).discussion.probeLaw + (p j).discussion.sampler.publicRecord (p j).protocol.completeReference P a b) ν) + τ.block ν) atTop (nhds 0) + +theorem isCompletedKeyOutput_iff_original {a b ell e : ℕ} + [Nonempty (Fin a)] [Nonempty (Fin b)] + (R : Matrix (Fin a × Fin b) (Fin a × Fin b) ℂ) (hR : Density R) + (P : Matrix (Fin a × Fin b) (Fin e) ℂ) (hP : P * Pᴴ = R) + (messages : ClassicalRecordSpace.{u}) (ν : Measure (ℕ → messages)) [SigmaFinite ν] + (τ : KeyDensity ν (KeyWord ell) (Fin e)) : + IsCompletedKeyOutput R hR P hP messages ν τ ↔ + ∃ p : ℕ → KeyImplementation a b ell messages, + ∃ hAC : ∀ j, (p j).discussion.transcriptLaw ≪ ν, + Tendsto (fun j => ((p j).output R hR P hP ν (hAC j)).distance τ) atTop (nhds 0) := + Iff.rfl + +structure CompletedKeyTrial {a b : ℕ} [Nonempty (Fin a)] [Nonempty (Fin b)] + (R : Matrix (Fin a × Fin b) (Fin a × Fin b) ℂ) (hR : Density R) (ell : ℕ) where + messages : ClassicalRecordSpace.{u} + eveDim : ℕ + purification : Matrix (Fin a × Fin b) (Fin eveDim) ℂ + prepares : purification * purificationᴴ = R + referenceMeasure : Measure (ℕ → messages) + sigmaFinite : SigmaFinite referenceMeasure + actual : KeyDensity referenceMeasure (KeyWord ell) (Fin eveDim) + completed : @IsCompletedKeyOutput _ _ _ _ _ _ R hR purification prepares + messages referenceMeasure sigmaFinite actual + ideal : EveDensity referenceMeasure (Fin eveDim) + +attribute [instance] CompletedKeyTrial.sigmaFinite + +namespace CompletedKeyTrial + +variable {a b ell : ℕ} [inst11550_0 : Nonempty (Fin a)] [inst11550_1 : Nonempty (Fin b)] + {R : Matrix (Fin a × Fin b) (Fin a × Fin b) ℂ} {hR : Density R} + (p : CompletedKeyTrial R hR ell) + +def error : ℝ := p.actual.idealError p.ideal + +end CompletedKeyTrial + +end + +section + +open scoped ComplexOrder MatrixOrder Kronecker + +open Matrix + +def groupIndex (a b c d : ℕ) : + (Fin (a*c) × Fin (b*d)) ≃ ((Fin a × Fin b) × (Fin c × Fin d)) where + toFun i := (((finProdFinEquiv.symm i.1).1,(finProdFinEquiv.symm i.2).1), + ((finProdFinEquiv.symm i.1).2,(finProdFinEquiv.symm i.2).2)) + invFun i := (finProdFinEquiv (i.1.1,i.2.1),finProdFinEquiv (i.1.2,i.2.2)) + left_inv i := by + apply Prod.ext <;> exact finProdFinEquiv.apply_symm_apply _ + right_inv i := by simp + +def groupTensor {a b c d : ℕ} + (R : Matrix (Fin a × Fin b) (Fin a × Fin b) ℂ) + (S : Matrix (Fin c × Fin d) (Fin c × Fin d) ℂ) : + Matrix (Fin (a*c) × Fin (b*d)) (Fin (a*c) × Fin (b*d)) ℂ := + (R ⊗ₖ S).submatrix (groupIndex a b c d) (groupIndex a b c d) + +lemma trace_groupTensor {a b c d : ℕ} + (R : Matrix (Fin a × Fin b) (Fin a × Fin b) ℂ) + (S : Matrix (Fin c × Fin d) (Fin c × Fin d) ℂ) : + trace (groupTensor R S) = trace R * trace S := by + rw [← trace_kronecker] + exact Equiv.sum_comp (groupIndex a b c d) (fun x => (R ⊗ₖ S) x x) + +lemma Density.groupTensor {a b c d : ℕ} + {R : Matrix (Fin a × Fin b) (Fin a × Fin b) ℂ} + {S : Matrix (Fin c × Fin d) (Fin c × Fin d) ℂ} + (hR : Density R) (hS : Density S) : Density (groupTensor R S) := by + refine ⟨(hR.1.kronecker hS.1).submatrix _,?_⟩ + rw [trace_groupTensor,hR.2,hS.2,one_mul] + +def copyDim (a : ℕ) : ℕ → ℕ + | 0 => a + | k+1 => copyDim a k * a + +lemma copyDim_eq (a k : ℕ) : copyDim a k = a^(k+1) := by + induction k with + | zero => simp [copyDim] + | succ k ih => simp only [copyDim,ih,pow_succ] + +def positiveCopies {a b : ℕ} (R : Matrix (Fin a × Fin b) (Fin a × Fin b) ℂ) : + (k : ℕ) → Matrix (Fin (copyDim a k) × Fin (copyDim b k)) + (Fin (copyDim a k) × Fin (copyDim b k)) ℂ + | 0 => R + | k+1 => groupTensor (positiveCopies R k) R + +end + +section + +open Matrix MeasureTheory ProbabilityTheory Filter + +open scoped ComplexOrder MatrixOrder Matrix.Norms.L2Operator ENNReal + +universe u + +lemma Density.positiveCopies {a b : ℕ} + {R : Matrix (Fin a × Fin b) (Fin a × Fin b) ℂ} (hR : Density R) (k : ℕ) : + Density (positiveCopies R k) := by + induction k with + | zero => exact hR + | succ k ih => exact ih.groupTensor hR + +instance positiveCopy_nonempty (a k : ℕ) [Nonempty (Fin a)] : Nonempty (Fin (copyDim a k)) := by + have ha : 0 < copyDim a k := by + induction k with + | zero => exact (show 0 < a from Fin.size_positive') + | succ k ih => exact Nat.mul_pos ih (show 0 < a from Fin.size_positive') + exact ⟨⟨0,ha⟩⟩ + +structure CompletedKeyScheme {a b : ℕ} [Nonempty (Fin a)] [Nonempty (Fin b)] + (R : Matrix (Fin a × Fin b) (Fin a × Fin b) ℂ) (hR : Density R) where + length : ℕ → ℕ + trial : (k : ℕ) → CompletedKeyTrial.{u} (positiveCopies R k) (by + induction k with + | zero => exact hR + | succ k ih => + refine ⟨(ih.1.kronecker hR.1).submatrix _, ?_⟩ + change trace (groupTensor (positiveCopies R k) R) = 1 + have ht := Equiv.sum_comp (groupIndex (copyDim a k) (copyDim b k) a b) + (fun x => (Matrix.kronecker (positiveCopies R k) R) x x) + change trace (groupTensor (positiveCopies R k) R) = trace (Matrix.kronecker (positiveCopies R k) R) at ht + rw [ht, Matrix.kronecker, trace_kronecker, ih.2, hR.2, one_mul]) (length k) + +namespace CompletedKeyScheme + +variable {a b : ℕ} [inst11756_0 : Nonempty (Fin a)] [inst11756_1 : Nonempty (Fin b)] + {R : Matrix (Fin a × Fin b) (Fin a × Fin b) ℂ} {hR : Density R} + (s : CompletedKeyScheme.{u} R hR) + +def error (k : ℕ) : ℝ := (s.trial k).error + +def Secure : Prop := Tendsto s.error atTop (nhds 0) + +def lowerRate : ℝ≥0∞ := liminf (fun k : ℕ => (s.length k : ℝ≥0∞) / (k+1 : ℕ)) atTop + +end CompletedKeyScheme + +def distillableSecretKey {a b : ℕ} [Nonempty (Fin a)] [Nonempty (Fin b)] + (R : Matrix (Fin a × Fin b) (Fin a × Fin b) ℂ) (hR : Density R) : ℝ≥0∞ := + sSup {r | r = 0 ∨ ∃ s : CompletedKeyScheme.{u} R hR, s.Secure ∧ r = s.lowerRate} + +end + +open Matrix MeasureTheory ProbabilityTheory Filter + +open scoped ComplexOrder MatrixOrder Matrix.Norms.L2Operator ENNReal + +universe u + +def UniformProtocolGap {a b : ℕ} [Nonempty (Fin a)] [Nonempty (Fin b)] + (R : Matrix (Fin a × Fin b) (Fin a × Fin b) ℂ) (_hR : Density R) : Prop := + ∀ (k : ℕ) (O M : Type u) [MeasurableSpace O] [MeasurableSpace M] + [StandardBorelSpace O] [Nonempty O] [StandardBorelSpace M] [Nonempty M] + (d : Discussion O M) (A B : ℕ → Type u) + [∀ n, AddCommGroup (A n)] [∀ n, Module ℂ (A n)] [∀ n, One (A n)] [∀ n, LE (A n)] + [∀ n, AddCommGroup (B n)] [∀ n, Module ℂ (B n)] [∀ n, One (B n)] [∀ n, LE (B n)] + (TA TB CA CB : Type u) + [AddCommGroup TA] [Module ℂ TA] [One TA] [LE TA] + [AddCommGroup TB] [Module ℂ TB] [One TB] [LE TB] + [AddCommGroup CA] [Module ℂ CA] [One CA] [LE CA] + [AddCommGroup CB] [Module ℂ CB] [One CB] [LE CB] + (p : BitProtocol (ι := Fin (copyDim a k)) (η := Fin (copyDim b k)) d A B TA TB CA CB) + (e : ℕ) (P : Matrix (Fin (copyDim a k) × Fin (copyDim b k)) (Fin e) ℂ) + (_hP : P * Pᴴ = positiveCopies R k) + (sigma : PositiveMatrixMeasure (ℕ → M) (Fin e)), + (trace (sigma.value Set.univ)).re = 1 → + 1/5 ≤ p.rawPurifiedSecretBitError P sigma + +def UniformCompletedGap {a b : ℕ} [Nonempty (Fin a)] [Nonempty (Fin b)] + (R : Matrix (Fin a × Fin b) (Fin a × Fin b) ℂ) (hR : Density R) : Prop := + ∀ (k ell : ℕ), 0 < ell → + ∀ p : CompletedKeyTrial.{u} (positiveCopies R k) (by + induction k with + | zero => exact hR + | succ k ih => + refine ⟨(ih.1.kronecker hR.1).submatrix _, ?_⟩ + change trace (groupTensor (positiveCopies R k) R) = 1 + have ht := Equiv.sum_comp (groupIndex (copyDim a k) (copyDim b k) a b) + (fun x => (Matrix.kronecker (positiveCopies R k) R) x x) + change trace (groupTensor (positiveCopies R k) R) = trace (Matrix.kronecker (positiveCopies R k) R) at ht + rw [ht, Matrix.kronecker, trace_kronecker, ih.2, hR.2, one_mul]) ell, + 1/5 ≤ p.error + +namespace Explicit + +lemma m_pos : 0 < m := by rw [m_eq]; exact Nat.mul_pos Q_pos D_pos + +instance output_nonempty : Nonempty (Fin m) := by + have hb : 0 < b := by + unfold b + exact Nat.choose_pos (by decide) + have hq : 0 < Q := by unfold Q; exact pow_pos hb 3 + have hd (q : ℕ) : 0 < dimensionFunction q := pow_pos (by decide) _ + have hD : 0 < D := by unfold D; exact hd Q + have hm (q d : ℕ) (hq : 0 < q) (hd : 0 < d) : + 0 < outputDimensionFunction q d := Nat.mul_pos hq hd + exact ⟨⟨0, by unfold m; exact hm Q D hq hD⟩⟩ + +def MainClaim : Prop := + ∃ hR : Density rhoFin, ¬ Separable rhoFin ∧ + distillableSecretKey.{u} rhoFin hR = 0 ∧ + UniformProtocolGap.{u} rhoFin hR ∧ + UniformCompletedGap.{u} rhoFin hR + +end Explicit + +end ZeroKey + +end + +end OAI diff --git a/lean/OAI/InformationTheory/SecretKey/Purification.lean b/lean/OAI/InformationTheory/SecretKey/Purification.lean new file mode 100644 index 0000000000000000000000000000000000000000..d3815c47e9dfa4f0cc275059cf1291ffecd24c2e --- /dev/null +++ b/lean/OAI/InformationTheory/SecretKey/Purification.lean @@ -0,0 +1,716 @@ +import OAI.InformationTheory.SecretKey.Gap + +namespace OAI + +noncomputable section + +namespace ZeroKey + +section + +open Matrix + +open scoped ComplexOrder MatrixOrder Matrix.Norms.L2Operator Kronecker + +universe v10089_0 v10089_1 + +variable {ι : Type v10089_0} {κ : Type v10089_1} [inst10089_0 : Fintype ι] [inst10089_1 : Fintype κ] [inst10089_2 : DecidableEq ι] [inst10089_3 : DecidableEq κ] + +lemma purification_filter_identity [Nonempty ι] (P : Matrix ι κ ℂ) : + referenceFilter (purificationFilter P) (outer (localProbe (ι := ι)) localProbe) = + outer (vectorize P) (vectorize P) := by + unfold localProbe purificationFilter + rw [referenceFilter_vectorize,Matrix.transpose_smul,Matrix.transpose_transpose, + Matrix.smul_mul,Matrix.mul_smul,Matrix.one_mul,smul_smul] + have hc : (Real.sqrt (Fintype.card ι : ℝ) : ℂ) ≠ 0 := + Complex.ofReal_ne_zero.mpr (Real.sqrt_pos.mpr (by exact_mod_cast Fintype.card_pos)).ne' + rw [inv_mul_cancel₀ hc,one_smul] + +end + +section + +open Matrix MeasureTheory + +open scoped ComplexOrder MatrixOrder Kronecker Matrix.Norms.L2Operator + +universe v10152_0 v10152_1 v10152_2 + +variable {ι : Type v10152_0} {κ : Type v10152_1} {Ω : Type v10152_2} [inst10152_0 : Fintype ι] [inst10152_1 : Fintype κ] [inst10152_2 : DecidableEq ι] [inst10152_3 : DecidableEq κ] + [inst10152_4 : MeasurableSpace Ω] {μ : Measure Ω} + +def BitDensity.mapReference (τ : BitDensity μ κ) + (L : Matrix κ κ ℂ →ₗ[ℂ] Matrix ι ι ℂ) + (hpos : ∀ Z, Z.PosSemidef → (L Z).PosSemidef) + (htr : ∀ Z, trace (L Z) = trace Z) : BitDensity μ ι where + block i j t := L (τ.block i j t) + positive i j t := hpos _ (τ.positive i j t) + measurable i j := L.continuous_of_finiteDimensional.measurable.comp (τ.measurable i j) + integrable i j := by simpa only [htr] using τ.integrable i j + normalized := by simpa only [htr] using τ.normalized + +lemma traceNorm_channel_sub (L : Matrix κ κ ℂ →ₗ[ℂ] Matrix ι ι ℂ) + (hpos : ∀ Z, Z.PosSemidef → (L Z).PosSemidef) + (htr : ∀ Z, trace (L Z) = trace Z) + {A B : Matrix κ κ ℂ} (hA : A.PosSemidef) (hB : B.PosSemidef) : + traceNorm (L A - L B) ≤ traceNorm (A-B) := by + rw [← map_sub] + exact traceNorm_positive_tracePreserving L hpos htr _ (hA.isHermitian.sub hB.isHermitian) + +theorem BitDensity.idealBitError_mapReference_le (τ : BitDensity μ κ) + (L : Matrix κ κ ℂ →ₗ[ℂ] Matrix ι ι ℂ) + (hpos : ∀ Z, Z.PosSemidef → (L Z).PosSemidef) + (htr : ∀ Z, trace (L Z) = trace Z) + (σ : Ω → Matrix κ κ ℂ) (hσ : Measurable σ) + (hσp : ∀ t, (σ t).PosSemidef) + (hσi : Integrable (fun t => (trace (σ t)).re) μ) : + (τ.mapReference L hpos htr).idealBitError (fun t => L (σ t)) ≤ τ.idealBitError σ := by + have hm : Measurable (fun t => L (σ t)) := L.continuous_of_finiteDimensional.measurable.comp hσ + have hi : Integrable (fun t => (trace (L (σ t))).re) μ := by simpa only [htr] using hσi + have hc (a : Bool) : + (∫ t, traceNorm (L (τ.block a a t) - (1/2 : ℝ) • L (σ t)) ∂μ) ≤ + ∫ t, traceNorm (τ.block a a t - (1/2 : ℝ) • σ t) ∂μ := by + have hleft := traceNorm_sub_integrable + (L.continuous_of_finiteDimensional.measurable.comp (τ.measurable a a)) + (show Measurable (fun t => (1/2 : ℝ) • L (σ t)) from hm.const_smul (1/2 : ℝ)) (fun t => hpos _ (τ.positive a a t)) + (fun t => (hpos _ (hσp t)).smul (show (0:ℝ)≤1/2 by norm_num)) + (show Integrable (fun t => (trace (L (τ.block a a t))).re) μ by simpa only [htr] using τ.integrable a a) + (by simpa only [Matrix.trace_smul,Complex.smul_re,smul_eq_mul] using hi.const_mul (1/2)) + have hright := traceNorm_sub_integrable (τ.measurable a a) (show Measurable (fun t => (1/2 : ℝ) • σ t) from hσ.const_smul (1/2 : ℝ)) + (τ.positive a a) (fun t => (hσp t).smul (show (0:ℝ)≤1/2 by norm_num)) + (τ.integrable a a) + (by simpa only [Matrix.trace_smul,Complex.smul_re,smul_eq_mul] using hσi.const_mul (1/2)) + apply integral_mono hleft hright + intro t + change traceNorm (L (τ.block a a t) - (1/2 : ℝ) • L (σ t)) ≤ _ + rw [← L.map_smul_of_tower (1/2 : ℝ) (σ t)] + exact traceNorm_channel_sub L hpos htr (τ.positive a a t) + ((hσp t).smul (show (0:ℝ)≤1/2 by norm_num)) + have hf := hc false + have ht := hc true + unfold BitDensity.idealBitError BitDensity.mass + simp only [BitDensity.mapReference,htr] + linarith + +end + +open Matrix MeasureTheory ProbabilityTheory Function Filter + +open scoped ComplexOrder MatrixOrder Matrix.Norms.L2Operator Kronecker + +open UnrestrictedQuantum + +universe v10227_0 v10227_1 v10227_2 v10227_3 v10227_4 v10227_5 v10227_6 v10227_7 v10227_8 v10227_9 v10227_10 + +variable {O : Type v10227_0} {M : Type v10227_1} {ι : Type v10227_2} {η : Type v10227_3} [inst10227_0 : MeasurableSpace O] [inst10227_1 : MeasurableSpace M] + [inst10227_2 : StandardBorelSpace O] [inst10227_3 : Nonempty O] [inst10227_4 : StandardBorelSpace M] [inst10227_5 : Nonempty M] + [inst10227_6 : Fintype ι] [inst10227_7 : Fintype η] [inst10227_8 : DecidableEq ι] [inst10227_9 : DecidableEq η] + [inst10227_10 : Nonempty ι] [inst10227_11 : Nonempty η] + {d : Discussion O M} {A : ℕ → Type v10227_4} {B : ℕ → Type v10227_5} + [inst10227_12 : ∀ n, AddCommGroup (A n)] [inst10227_13 : ∀ n, Module ℂ (A n)] [inst10227_14 : ∀ n, One (A n)] [inst10227_15 : ∀ n, LE (A n)] + [inst10227_16 : ∀ n, AddCommGroup (B n)] [inst10227_17 : ∀ n, Module ℂ (B n)] [inst10227_18 : ∀ n, One (B n)] [inst10227_19 : ∀ n, LE (B n)] + {TA : Type v10227_6} {TB : Type v10227_7} {CA : Type v10227_8} {CB : Type v10227_9} + [inst10227_20 : AddCommGroup TA] [inst10227_21 : Module ℂ TA] [inst10227_22 : One TA] [inst10227_23 : LE TA] + [inst10227_24 : AddCommGroup TB] [inst10227_25 : Module ℂ TB] [inst10227_26 : One TB] [inst10227_27 : LE TB] + [inst10227_28 : AddCommGroup CA] [inst10227_29 : Module ℂ CA] [inst10227_30 : One CA] [inst10227_31 : LE CA] + [inst10227_32 : AddCommGroup CB] [inst10227_33 : Module ℂ CB] [inst10227_34 : One CB] [inst10227_35 : LE CB] + {κ : Type v10227_10} [inst10227_36 : Fintype κ] [inst10227_37 : DecidableEq κ] + +namespace BitProtocol + +variable (p : BitProtocol (ι := ι) (η := η) d A B TA TB CA CB) + (R : Matrix (ι × η) (ι × η) ℂ) (hR : Density R) + (P : Matrix (ι × η) κ ℂ) (hP : P * Pᴴ = R) + +include hR hP + +lemma purifiedDensity_recovery (ν : Measure (ℕ → M)) [SigmaFinite ν] + (hμν : d.transcriptLaw ≪ ν) + (L : Matrix κ κ ℂ →ₗ[ℂ] Matrix (ι × η) (ι × η) ℂ) + (he : ∀ i j S, L ((p.purifiedOutput P i j).value S) = (p.canonicalOutput R i j).value S) + (i j : Bool) : + (p.outputDensity R hR ν hμν).block i j =ᵐ[ν] + fun t => L ((p.purifiedDensity R hR P hP ν hμν).block i j t) := by + have hAC (S : Set (ℕ → M)) (hS : MeasurableSet S) (hz : ν S = 0) : + (p.purifiedOutput P i j).value S = 0 := p.purifiedOutput_ac P i j S hS (hμν hz) + let LC := L.toContinuousLinearMap + apply (p.canonicalOutput R i j).positiveDensity_eq_ae ν + (LC.integrable_comp ((p.purifiedOutput P i j).positiveDensity_integrable ν hAC)) + intro S hS + rw [LC.integral_comp_comm ((p.purifiedOutput P i j).positiveDensity_integrable ν hAC).integrableOn, + (p.purifiedOutput P i j).positiveDensity_integral ν hAC S hS] + exact (he i j S).symm + +end BitProtocol + +theorem BitProtocol.uniform_gap_purification {a b : ℕ} [Nonempty (Fin a)] [Nonempty (Fin b)] + (p : BitProtocol (ι := Fin a) (η := Fin b) d A B TA TB CA CB) + (R : Matrix (Fin a × Fin b) (Fin a × Fin b) ℂ) (hR : InClass R) + (P : Matrix (Fin a × Fin b) κ ℂ) (hP : P * Pᴴ = R) + (sigma : PositiveMatrixMeasure (ℕ → M) κ) + (hsigma : (trace (sigma.value Set.univ)).re = 1) : + 1/5 ≤ p.purifiedSecretBitError R hR.1 P hP sigma := by + let ν := d.transcriptLaw + sigma.traceMeasure + have hμν : d.transcriptLaw ≪ ν := Measure.AbsolutelyContinuous.rfl.add_right _ + have hsν : sigma.traceMeasure ≪ ν := Measure.AbsolutelyContinuous.rfl.add_right' _ + have hsAC (S : Set (ℕ → M)) (hS : MeasurableSet S) (hz : ν S = 0) : + sigma.value S = 0 := sigma.value_zero_of_traceMeasure_zero S hS (hsν hz) + obtain ⟨L,hpos,htr,hrec⟩ := p.purifiedOutput_recovery R hR.1 P hP + let tp := p.purifiedDensity R hR.1 P hP ν hμν + let tc := p.outputDensity R hR.1 ν hμν + let sp := sigma.positiveDensity ν + have hspm := sigma.measurable_positiveDensity ν + have hspp := sigma.positiveDensity_pos ν + have hspi := sigma.integrable_positiveDensity_trace ν hsAC + have hspn := (sigma.integral_positiveDensity_trace ν hsAC).trans hsigma + obtain ⟨τ,X,Y,hX,hY,hτ,hi,he⟩ := p.canonical_density_representation R hR.1 + have hg := class_factor_gap_dominating_measure hμν R hR τ X Y hX hY hτ + (fun t => L (sp t)) (L.continuous_of_finiteDimensional.measurable.comp hspm) + (fun t => hpos _ (hspp t)) + (show Integrable (fun t => (trace (L (sp t))).re) ν by simpa only [htr] using hspi) + (show (∫ t, (trace (L (sp t))).re ∂ν) = 1 by simpa only [htr] using hspn) + have heq := BitDensity.idealBitError_congr tc (τ.changeMeasure hμν) + (fun t => L (sp t)) (fun t => L (sp t)) + (p.outputDensity_eq R hR.1 ν hμν τ hi he) Filter.EventuallyEq.rfl + have hrc := BitDensity.idealBitError_congr tc (tp.mapReference L hpos htr) + (fun t => L (sp t)) (fun t => L (sp t)) + (p.purifiedDensity_recovery R hR.1 P hP ν hμν L hrec) Filter.EventuallyEq.rfl + have hcontract := tp.idealBitError_mapReference_le L hpos htr sp hspm hspp hspi + change 1/5 ≤ tp.idealBitError sp + rw [← heq,hrc] at hg + exact hg.trans hcontract + +end ZeroKey + +namespace UnrestrictedQuantum + +open Matrix MeasureTheory Filter + +open scoped ComplexOrder MatrixOrder Matrix.Norms.L2Operator + +universe v10518_0 v10518_1 v10518_2 v10518_3 v10518_4 + +variable {A : Type v10518_0} {B : Type v10518_1} {K : Type v10518_2} {ι : Type v10518_3} {Ω : Type v10518_4} [inst10518_0 : AddCommGroup A] [inst10518_1 : Module ℂ A] [inst10518_2 : One A] [inst10518_3 : LE A] + [inst10518_4 : AddCommGroup B] [inst10518_5 : Module ℂ B] [inst10518_6 : One B] [inst10518_7 : LE B] + [inst10518_8 : MeasurableSpace K] [inst10518_9 : MeasurableSingletonClass K] [inst10518_10 : Fintype K] [inst10518_11 : DecidableEq K] [inst10518_12 : Nonempty K] + [inst10518_13 : Fintype ι] [inst10518_14 : DecidableEq ι] + +variable {L : MeasurableSpace Ω} {mΩ : MeasurableSpace Ω} + {μ : Measure Ω} {F : Filtration ℕ mΩ} {U : ℕ → Ω → Matrix ι ι ℂ} + (e : IncomingObservableProcess (L := L) (A := A) μ F U) + +namespace IncomingObservableProcess + +namespace FiniteReadout + +variable {e} (b : e.FiniteReadout (B := B) (K := K)) + +lemma postprocess_value (f : K → Bool) (i : Bool) (x : Ω) : + (b.postprocess f).value i x = ∑ k ∈ Finset.univ.filter (fun k => f k = i), b.value k x := by + have hs : ((Finset.univ.filter (fun k => f k = i) : Finset K) : Set K) = f ⁻¹' {i} := by + ext k; simp + change e.state x ((b.instrument x).operation (f ⁻¹' {i}) 1) = _ + rw [← hs] + exact b.event_finset _ x + +end FiniteReadout + +end IncomingObservableProcess + +end UnrestrictedQuantum + +namespace ZeroKey + +section + +open Matrix MeasureTheory ProbabilityTheory Function unitInterval Filter + +open scoped ComplexOrder MatrixOrder Matrix.Norms.L2Operator Kronecker + +section + +open UnrestrictedQuantum + +universe v10619_0 v10619_1 v10619_2 v10619_3 v10619_4 v10619_5 v10619_6 v10619_7 v10619_8 v10619_9 v10619_10 + +variable {O : Type v10619_0} {M : Type v10619_1} {ι : Type v10619_2} {η : Type v10619_3} [inst10619_0 : MeasurableSpace O] [inst10619_1 : MeasurableSpace M] + [inst10619_2 : StandardBorelSpace O] [inst10619_3 : Nonempty O] [inst10619_4 : StandardBorelSpace M] [inst10619_5 : Nonempty M] + [inst10619_6 : Fintype ι] [inst10619_7 : Fintype η] [inst10619_8 : DecidableEq ι] [inst10619_9 : DecidableEq η] + {K : Type v10619_4} [inst10619_10 : MeasurableSpace K] [inst10619_11 : MeasurableSingletonClass K] + [inst10619_12 : Fintype K] [inst10619_13 : DecidableEq K] [inst10619_14 : Nonempty K] + (d : Discussion O M) + (A : ℕ → Type v10619_5) (B : ℕ → Type v10619_6) + [inst10619_15 : ∀ n, AddCommGroup (A n)] [inst10619_16 : ∀ n, Module ℂ (A n)] [inst10619_17 : ∀ n, One (A n)] [inst10619_18 : ∀ n, LE (A n)] + [inst10619_19 : ∀ n, AddCommGroup (B n)] [inst10619_20 : ∀ n, Module ℂ (B n)] [inst10619_21 : ∀ n, One (B n)] [inst10619_22 : ∀ n, LE (B n)] + (TA : Type v10619_7) (TB : Type v10619_8) (CA : Type v10619_9) (CB : Type v10619_10) + [inst10619_23 : AddCommGroup TA] [inst10619_24 : Module ℂ TA] [inst10619_25 : One TA] [inst10619_26 : LE TA] + [inst10619_27 : AddCommGroup TB] [inst10619_28 : Module ℂ TB] [inst10619_29 : One TB] [inst10619_30 : LE TB] + [inst10619_31 : AddCommGroup CA] [inst10619_32 : Module ℂ CA] [inst10619_33 : One CA] [inst10619_34 : LE CA] + [inst10619_35 : AddCommGroup CB] [inst10619_36 : Module ℂ CB] [inst10619_37 : One CB] [inst10619_38 : LE CB] + +variable {d A B TA TB CA CB} + +namespace FiniteProtocol + +variable (p : FiniteProtocol (ι := ι) (η := η) (K := K) d A B TA TB CA CB) + +lemma canonicalOutput_ac (R : Matrix (ι × η) (ι × η) ℂ) (i j : K) + (S : Set (ℕ → M)) (hS : MeasurableSet S) (hz : d.transcriptLaw S = 0) : + (p.canonicalOutput R i j).value S = 0 := by + have hp : d.probeLaw (d.sampler.publicRecord ⁻¹' S) = 0 := by + simpa only [Discussion.transcriptLaw,Measure.map_apply d.sampler.measurable_publicRecord hS] using hz + rw [p.canonicalOutput_event R i j S hS,Measure.restrict_eq_zero.mpr hp,integral_zero_measure] + +def outputDensity (R : Matrix (ι × η) (ι × η) ℂ) (ν : Measure (ℕ → M)) (i j : K) : + (ℕ → M) → Matrix (ι × η) (ι × η) ℂ := (p.canonicalOutput R i j).positiveDensity ν + +end FiniteProtocol + +end + +section + +open UnrestrictedQuantum + +universe v10740_0 v10740_1 v10740_2 v10740_3 v10740_4 v10740_5 v10740_6 v10740_7 v10740_8 v10740_9 v10740_10 + +variable {O : Type v10740_0} {M : Type v10740_1} {ι : Type v10740_2} {η : Type v10740_3} [inst10740_0 : MeasurableSpace O] [inst10740_1 : MeasurableSpace M] + [inst10740_2 : StandardBorelSpace O] [inst10740_3 : Nonempty O] [inst10740_4 : StandardBorelSpace M] [inst10740_5 : Nonempty M] + [inst10740_6 : Fintype ι] [inst10740_7 : Fintype η] [inst10740_8 : DecidableEq ι] [inst10740_9 : DecidableEq η] [inst10740_10 : Nonempty ι] [inst10740_11 : Nonempty η] + {Λ : Type v10740_4} [inst10740_12 : MeasurableSpace Λ] [inst10740_13 : MeasurableSingletonClass Λ] + [inst10740_14 : Fintype Λ] [inst10740_15 : DecidableEq Λ] [inst10740_16 : Nonempty Λ] + (d : Discussion O M) + (A : ℕ → Type v10740_5) (B : ℕ → Type v10740_6) + [inst10740_17 : ∀ n, AddCommGroup (A n)] [inst10740_18 : ∀ n, Module ℂ (A n)] [inst10740_19 : ∀ n, One (A n)] [inst10740_20 : ∀ n, LE (A n)] + [inst10740_21 : ∀ n, AddCommGroup (B n)] [inst10740_22 : ∀ n, Module ℂ (B n)] [inst10740_23 : ∀ n, One (B n)] [inst10740_24 : ∀ n, LE (B n)] + (TA : Type v10740_7) (TB : Type v10740_8) (CA : Type v10740_9) (CB : Type v10740_10) + [inst10740_25 : AddCommGroup TA] [inst10740_26 : Module ℂ TA] [inst10740_27 : One TA] [inst10740_28 : LE TA] + [inst10740_29 : AddCommGroup TB] [inst10740_30 : Module ℂ TB] [inst10740_31 : One TB] [inst10740_32 : LE TB] + [inst10740_33 : AddCommGroup CA] [inst10740_34 : Module ℂ CA] [inst10740_35 : One CA] [inst10740_36 : LE CA] + [inst10740_37 : AddCommGroup CB] [inst10740_38 : Module ℂ CB] [inst10740_39 : One CB] [inst10740_40 : LE CB] + +variable {d A B TA TB CA CB} + +namespace FiniteProtocol + +variable (p : FiniteProtocol (ι := ι) (η := η) (K := Bool × Λ) d A B TA TB CA CB) + +def firstBit : BitProtocol (ι := ι) (η := η) d A B TA TB CA CB := p.toBit Prod.fst + +omit inst10740_4 inst10740_5 inst10740_10 inst10740_11 in +lemma firstBit_completeReference [StandardBorelSpace M] [Nonempty M] [Nonempty ι] [Nonempty η] (i j : Bool) (x : ℕ → O) : + p.firstBit.completeReference i j x = + ∑ a : Λ, ∑ b : Λ, p.completeReference (i,a) (j,b) x := by + have ha : (p.readoutA.postprocess Prod.fst).value i x = ∑ a : Λ, p.readoutA.value (i,a) x := by + rw [IncomingObservableProcess.FiniteReadout.postprocess_value] + cases i <;> simp [Finset.sum_filter,Fintype.sum_prod_type] + have hb : (p.readoutB.postprocess Prod.fst).value j x = ∑ b : Λ, p.readoutB.value (j,b) x := by + rw [IncomingObservableProcess.FiniteReadout.postprocess_value] + cases j <;> simp [Finset.sum_filter,Fintype.sum_prod_type] + change (p.readoutA.postprocess Prod.fst).value i x ⊗ₖ + (p.readoutB.postprocess Prod.fst).value j x = _ + rw [ha,hb] + ext k l + simp only [Matrix.kroneckerMap_apply,Matrix.sum_apply,Finset.sum_mul,Finset.mul_sum,completeReference,Matrix.kroneckerMap_apply] + rw [Finset.sum_comm] + +lemma firstBit_output_event (R : Matrix (ι × η) (ι × η) ℂ) + (i j : Bool) (S : Set (ℕ → M)) (hS : MeasurableSet S) : + (p.firstBit.canonicalOutput R i j).value S = + ∑ a : Λ, ∑ b : Λ, (p.canonicalOutput R (i,a) (j,b)).value S := by + rw [p.firstBit.canonicalOutput_event R i j S hS] + simp_rw [p.firstBit_completeReference,Matrix.mul_sum,Matrix.sum_mul] + rw [integral_finsetSum _ (fun a _ => integrable_finsetSum _ (fun b _ => + (integrable_filter (preparationFilter R) (p.completeReference_integrable (i,a) (j,b))).integrableOn))] + apply Finset.sum_congr rfl + intro a _ + rw [integral_finsetSum _ (fun b _ => + (integrable_filter (preparationFilter R) (p.completeReference_integrable (i,a) (j,b))).integrableOn)] + apply Finset.sum_congr rfl + intro b _ + exact (p.canonicalOutput_event R (i,a) (j,b) S hS).symm + +lemma firstBit_outputDensity (R : Matrix (ι × η) (ι × η) ℂ) (hR : Density R) + (ν : Measure (ℕ → M)) [SigmaFinite ν] (hμν : d.transcriptLaw ≪ ν) (i j : Bool) : + (p.firstBit.outputDensity R hR ν hμν).block i j =ᵐ[ν] + fun t => ∑ a : Λ, ∑ b : Λ, p.outputDensity R ν (i,a) (j,b) t := by + have hAC (a b : Bool × Λ) (S : Set (ℕ → M)) (hS : MeasurableSet S) (hz : ν S = 0) : + (p.canonicalOutput R a b).value S = 0 := p.canonicalOutput_ac R a b S hS (hμν hz) + have hi (a b : Bool × Λ) : Integrable (p.outputDensity R ν a b) ν := + (p.canonicalOutput R a b).positiveDensity_integrable ν (hAC a b) + apply (p.firstBit.canonicalOutput R i j).positiveDensity_eq_ae ν + (integrable_finsetSum _ (fun a _ => integrable_finsetSum _ (fun b _ => hi (i,a) (j,b)))) + intro S hS + rw [p.firstBit_output_event R i j S hS] + rw [integral_finsetSum _ (fun a _ => integrable_finsetSum _ (fun b _ => (hi (i,a) (j,b)).integrableOn))] + apply Finset.sum_congr rfl + intro a _ + rw [integral_finsetSum _ (fun b _ => (hi (i,a) (j,b)).integrableOn)] + apply Finset.sum_congr rfl + intro b _ + exact ((p.canonicalOutput R (i,a) (j,b)).positiveDensity_integral ν (hAC (i,a) (j,b)) S hS).symm + +end FiniteProtocol + +end + +open UnrestrictedQuantum + +universe v10829_0 v10829_1 v10829_2 v10829_3 v10829_4 v10829_5 v10829_6 v10829_7 v10829_8 v10829_9 v10829_10 + +variable {O : Type v10829_0} {M : Type v10829_1} {ι : Type v10829_2} {η : Type v10829_3} [inst10829_0 : MeasurableSpace O] [inst10829_1 : MeasurableSpace M] + [inst10829_2 : StandardBorelSpace O] [inst10829_3 : Nonempty O] [inst10829_4 : StandardBorelSpace M] [inst10829_5 : Nonempty M] + [inst10829_6 : Fintype ι] [inst10829_7 : Fintype η] [inst10829_8 : DecidableEq ι] [inst10829_9 : DecidableEq η] [inst10829_10 : Nonempty ι] [inst10829_11 : Nonempty η] + {K : Type v10829_4} [inst10829_12 : MeasurableSpace K] [inst10829_13 : MeasurableSingletonClass K] + [inst10829_14 : Fintype K] [inst10829_15 : DecidableEq K] [inst10829_16 : Nonempty K] + (d : Discussion O M) + (A : ℕ → Type v10829_5) (B : ℕ → Type v10829_6) + [inst10829_17 : ∀ n, AddCommGroup (A n)] [inst10829_18 : ∀ n, Module ℂ (A n)] [inst10829_19 : ∀ n, One (A n)] [inst10829_20 : ∀ n, LE (A n)] + [inst10829_21 : ∀ n, AddCommGroup (B n)] [inst10829_22 : ∀ n, Module ℂ (B n)] [inst10829_23 : ∀ n, One (B n)] [inst10829_24 : ∀ n, LE (B n)] + (TA : Type v10829_7) (TB : Type v10829_8) (CA : Type v10829_9) (CB : Type v10829_10) + [inst10829_25 : AddCommGroup TA] [inst10829_26 : Module ℂ TA] [inst10829_27 : One TA] [inst10829_28 : LE TA] + [inst10829_29 : AddCommGroup TB] [inst10829_30 : Module ℂ TB] [inst10829_31 : One TB] [inst10829_32 : LE TB] + [inst10829_33 : AddCommGroup CA] [inst10829_34 : Module ℂ CA] [inst10829_35 : One CA] [inst10829_36 : LE CA] + [inst10829_37 : AddCommGroup CB] [inst10829_38 : Module ℂ CB] [inst10829_39 : One CB] [inst10829_40 : LE CB] + +variable {d A B TA TB CA CB} + +namespace FiniteProtocol + +variable (p : FiniteProtocol (ι := ι) (η := η) (K := K) d A B TA TB CA CB) + +def secretKeyError (R : Matrix (ι × η) (ι × η) ℂ) + (sigma : PositiveMatrixMeasure (ℕ → M) (ι × η)) : ℝ := + let ν := d.transcriptLaw + sigma.traceMeasure + cqDistance (p.outputDensity R ν) + (fun a b t => idealFiniteBlocks (sigma.positiveDensity ν t) a b) ν + +omit inst10829_10 inst10829_11 in +lemma secretKeyError_nonneg [Nonempty ι] [Nonempty η] (R : Matrix (ι × η) (ι × η) ℂ) + (sigma : PositiveMatrixMeasure (ℕ → M) (ι × η)) : 0 ≤ p.secretKeyError R sigma := by + exact Finset.sum_nonneg fun a _ => Finset.sum_nonneg fun b _ => + integral_nonneg fun t => traceNorm_nonneg _ + +end FiniteProtocol + +universe v10864_0 + +variable {Λ : Type v10864_0} [inst10864_0 : MeasurableSpace Λ] [inst10864_1 : MeasurableSingletonClass Λ] + [inst10864_2 : Fintype Λ] [inst10864_3 : DecidableEq Λ] [inst10864_4 : Nonempty Λ] + +namespace FiniteProtocol + +variable (p : FiniteProtocol (ι := ι) (η := η) (K := Bool × Λ) d A B TA TB CA CB) + +theorem firstBit_error_le (R : Matrix (ι × η) (ι × η) ℂ) (hR : Density R) + (sigma : PositiveMatrixMeasure (ℕ → M) (ι × η)) : + p.firstBit.secretBitError R hR sigma ≤ p.secretKeyError R sigma := by + let ν := d.transcriptLaw + sigma.traceMeasure + have hμν : d.transcriptLaw ≪ ν := Measure.AbsolutelyContinuous.rfl.add_right _ + have hsν : sigma.traceMeasure ≪ ν := Measure.AbsolutelyContinuous.rfl.add_right' _ + have hsAC (S : Set (ℕ → M)) (hS : MeasurableSet S) (hz : ν S = 0) : + sigma.value S = 0 := sigma.value_zero_of_traceMeasure_zero S hS (hsν hz) + have hAC (a b : Bool × Λ) (S : Set (ℕ → M)) (hS : MeasurableSet S) (hz : ν S = 0) : + (p.canonicalOutput R a b).value S = 0 := p.canonicalOutput_ac R a b S hS (hμν hz) + have h := cqFirstBit_ideal_le (p.outputDensity R ν) + (fun a b => (p.canonicalOutput R a b).measurable_positiveDensity ν) + (fun a b => (p.canonicalOutput R a b).positiveDensity_pos ν) + (fun a b => (p.canonicalOutput R a b).integrable_positiveDensity_trace ν (hAC a b)) + (sigma.positiveDensity ν) (sigma.measurable_positiveDensity ν) + (sigma.positiveDensity_pos ν) (sigma.integrable_positiveDensity_trace ν hsAC) + apply le_trans (le_of_eq ?_) h + change (p.firstBit.outputDensity R hR ν hμν).idealBitError (sigma.positiveDensity ν) = _ + rw [BitDensity.idealBitError_eq_cq] + unfold cqBitError + apply Finset.sum_congr rfl + intro i _ + apply Finset.sum_congr rfl + intro j _ + apply integral_congr_ae + filter_upwards [p.firstBit_outputDensity R hR ν hμν i j] with t ht + rw [ht] + rfl + +theorem uniform_key_gap {a b : ℕ} [Nonempty (Fin a)] [Nonempty (Fin b)] + (p : FiniteProtocol (ι := Fin a) (η := Fin b) (K := Bool × Λ) d A B TA TB CA CB) + (R : Matrix (Fin a × Fin b) (Fin a × Fin b) ℂ) (hR : InClass R) + (sigma : PositiveMatrixMeasure (ℕ → M) (Fin a × Fin b)) + (hsigma : (trace (sigma.value Set.univ)).re = 1) : + 1/5 ≤ p.secretKeyError R sigma := + (p.firstBit.uniform_gap R hR sigma hsigma).trans (p.firstBit_error_le R hR.1 sigma) + +end FiniteProtocol + +end + +section + +open Matrix MeasureTheory ProbabilityTheory Function Filter + +open scoped ComplexOrder MatrixOrder Matrix.Norms.L2Operator Kronecker + +open UnrestrictedQuantum + +universe v11008_0 v11008_1 v11008_2 v11008_3 v11008_4 v11008_5 v11008_6 v11008_7 v11008_8 v11008_9 v11008_10 v11008_11 + +variable {O : Type v11008_0} {M : Type v11008_1} {ι : Type v11008_2} {η : Type v11008_3} [inst11008_0 : MeasurableSpace O] [inst11008_1 : MeasurableSpace M] + [inst11008_2 : StandardBorelSpace O] [inst11008_3 : Nonempty O] [inst11008_4 : StandardBorelSpace M] [inst11008_5 : Nonempty M] + [inst11008_6 : Fintype ι] [inst11008_7 : Fintype η] [inst11008_8 : DecidableEq ι] [inst11008_9 : DecidableEq η] [inst11008_10 : Nonempty ι] [inst11008_11 : Nonempty η] + {K : Type v11008_4} [inst11008_12 : MeasurableSpace K] [inst11008_13 : MeasurableSingletonClass K] + [inst11008_14 : Fintype K] [inst11008_15 : DecidableEq K] [inst11008_16 : Nonempty K] + {d : Discussion O M} {A : ℕ → Type v11008_5} {B : ℕ → Type v11008_6} + [inst11008_17 : ∀ n, AddCommGroup (A n)] [inst11008_18 : ∀ n, Module ℂ (A n)] [inst11008_19 : ∀ n, One (A n)] [inst11008_20 : ∀ n, LE (A n)] + [inst11008_21 : ∀ n, AddCommGroup (B n)] [inst11008_22 : ∀ n, Module ℂ (B n)] [inst11008_23 : ∀ n, One (B n)] [inst11008_24 : ∀ n, LE (B n)] + {TA : Type v11008_7} {TB : Type v11008_8} {CA : Type v11008_9} {CB : Type v11008_10} + [inst11008_25 : AddCommGroup TA] [inst11008_26 : Module ℂ TA] [inst11008_27 : One TA] [inst11008_28 : LE TA] + [inst11008_29 : AddCommGroup TB] [inst11008_30 : Module ℂ TB] [inst11008_31 : One TB] [inst11008_32 : LE TB] + [inst11008_33 : AddCommGroup CA] [inst11008_34 : Module ℂ CA] [inst11008_35 : One CA] [inst11008_36 : LE CA] + [inst11008_37 : AddCommGroup CB] [inst11008_38 : Module ℂ CB] [inst11008_39 : One CB] [inst11008_40 : LE CB] + {κ : Type v11008_11} [inst11008_41 : Fintype κ] [inst11008_42 : DecidableEq κ] + +namespace FiniteProtocol + +variable (p : FiniteProtocol (ι := ι) (η := η) (K := K) d A B TA TB CA CB) + +def purifiedSecretKeyError (P : Matrix (ι × η) κ ℂ) + (sigma : PositiveMatrixMeasure (ℕ → M) κ) : ℝ := + let ν := d.transcriptLaw + sigma.traceMeasure + cqDistance (p.purifiedOutputDensity P ν) + (fun a b t => idealFiniteBlocks (sigma.positiveDensity ν t) a b) ν + +end FiniteProtocol + +universe v11066_0 + +variable {Λ : Type v11066_0} [inst11066_0 : MeasurableSpace Λ] [inst11066_1 : MeasurableSingletonClass Λ] + [inst11066_2 : Fintype Λ] [inst11066_3 : DecidableEq Λ] [inst11066_4 : Nonempty Λ] + +namespace FiniteProtocol + +variable (p : FiniteProtocol (ι := ι) (η := η) (K := Bool × Λ) d A B TA TB CA CB) + +lemma firstBit_purifiedOutput_event (P : Matrix (ι × η) κ ℂ) + (i j : Bool) (S : Set (ℕ → M)) (hS : MeasurableSet S) : + (p.firstBit.purifiedOutput P i j).value S = + ∑ a : Λ, ∑ b : Λ, (p.purifiedOutput P (i,a) (j,b)).value S := by + rw [BitProtocol.purifiedOutput,PositiveMatrixMeasure.filter_value, + p.firstBit.probeOutput_event i j S hS, + ← integral_filter _ (p.firstBit.completeReference_integrable i j).integrableOn] + simp_rw [p.firstBit_completeReference,Matrix.mul_sum,Matrix.sum_mul] + rw [integral_finsetSum _ (fun a _ => integrable_finsetSum _ (fun b _ => + (integrable_filter (purificationFilter P) (p.completeReference_integrable (i,a) (j,b))).integrableOn))] + apply Finset.sum_congr rfl + intro a _ + rw [integral_finsetSum _ (fun b _ => + (integrable_filter (purificationFilter P) (p.completeReference_integrable (i,a) (j,b))).integrableOn)] + apply Finset.sum_congr rfl + intro b _ + exact (p.purifiedOutput_event P (i,a) (j,b) S hS).symm + +lemma firstBit_purifiedOutputDensity (R : Matrix (ι × η) (ι × η) ℂ) (hR : Density R) + (P : Matrix (ι × η) κ ℂ) (hP : P * Pᴴ = R) + (ν : Measure (ℕ → M)) [SigmaFinite ν] (hμν : d.transcriptLaw ≪ ν) (i j : Bool) : + (p.firstBit.purifiedDensity R hR P hP ν hμν).block i j =ᵐ[ν] + fun t => ∑ a : Λ, ∑ b : Λ, p.purifiedOutputDensity P ν (i,a) (j,b) t := by + have hAC (a b : Bool × Λ) (S : Set (ℕ → M)) (hS : MeasurableSet S) (hz : ν S = 0) : + (p.purifiedOutput P a b).value S = 0 := p.purifiedOutput_ac P a b S hS (hμν hz) + have hi (a b : Bool × Λ) : Integrable (p.purifiedOutputDensity P ν a b) ν := + (p.purifiedOutput P a b).positiveDensity_integrable ν (hAC a b) + apply (p.firstBit.purifiedOutput P i j).positiveDensity_eq_ae ν + (integrable_finsetSum _ (fun a _ => integrable_finsetSum _ (fun b _ => hi (i,a) (j,b)))) + intro S hS + rw [p.firstBit_purifiedOutput_event P i j S hS] + rw [integral_finsetSum _ (fun a _ => integrable_finsetSum _ (fun b _ => (hi (i,a) (j,b)).integrableOn))] + apply Finset.sum_congr rfl + intro a _ + rw [integral_finsetSum _ (fun b _ => (hi (i,a) (j,b)).integrableOn)] + apply Finset.sum_congr rfl + intro b _ + exact ((p.purifiedOutput P (i,a) (j,b)).positiveDensity_integral ν (hAC (i,a) (j,b)) S hS).symm + +theorem firstBit_purified_error_le (R : Matrix (ι × η) (ι × η) ℂ) (hR : Density R) + (P : Matrix (ι × η) κ ℂ) (hP : P * Pᴴ = R) + (sigma : PositiveMatrixMeasure (ℕ → M) κ) : + p.firstBit.purifiedSecretBitError R hR P hP sigma ≤ p.purifiedSecretKeyError P sigma := by + let ν := d.transcriptLaw + sigma.traceMeasure + have hμν : d.transcriptLaw ≪ ν := Measure.AbsolutelyContinuous.rfl.add_right _ + have hsν : sigma.traceMeasure ≪ ν := Measure.AbsolutelyContinuous.rfl.add_right' _ + have hsAC (S : Set (ℕ → M)) (hS : MeasurableSet S) (hz : ν S = 0) : + sigma.value S = 0 := sigma.value_zero_of_traceMeasure_zero S hS (hsν hz) + have hAC (a b : Bool × Λ) (S : Set (ℕ → M)) (hS : MeasurableSet S) (hz : ν S = 0) : + (p.purifiedOutput P a b).value S = 0 := p.purifiedOutput_ac P a b S hS (hμν hz) + have h := cqFirstBit_ideal_le (p.purifiedOutputDensity P ν) + (fun a b => (p.purifiedOutput P a b).measurable_positiveDensity ν) + (fun a b => (p.purifiedOutput P a b).positiveDensity_pos ν) + (fun a b => (p.purifiedOutput P a b).integrable_positiveDensity_trace ν (hAC a b)) + (sigma.positiveDensity ν) (sigma.measurable_positiveDensity ν) + (sigma.positiveDensity_pos ν) (sigma.integrable_positiveDensity_trace ν hsAC) + apply le_trans (le_of_eq ?_) h + change (p.firstBit.purifiedDensity R hR P hP ν hμν).idealBitError (sigma.positiveDensity ν) = _ + rw [BitDensity.idealBitError_eq_cq] + unfold cqBitError + apply Finset.sum_congr rfl + intro i _ + apply Finset.sum_congr rfl + intro j _ + apply integral_congr_ae + filter_upwards [p.firstBit_purifiedOutputDensity R hR P hP ν hμν i j] with t ht + rw [ht] + rfl + +theorem uniform_purified_key_gap {a b : ℕ} [Nonempty (Fin a)] [Nonempty (Fin b)] + (p : FiniteProtocol (ι := Fin a) (η := Fin b) (K := Bool × Λ) d A B TA TB CA CB) + (R : Matrix (Fin a × Fin b) (Fin a × Fin b) ℂ) (hR : InClass R) + (P : Matrix (Fin a × Fin b) κ ℂ) (hP : P * Pᴴ = R) + (sigma : PositiveMatrixMeasure (ℕ → M) κ) + (hsigma : (trace (sigma.value Set.univ)).re = 1) : + 1/5 ≤ p.purifiedSecretKeyError P sigma := + (p.firstBit.uniform_gap_purification R hR P hP sigma hsigma).trans + (p.firstBit_purified_error_le R hR.1 P hP sigma) + +end FiniteProtocol + +end + +open Matrix MeasureTheory Filter + +open scoped ComplexOrder MatrixOrder Matrix.Norms.L2Operator + +universe v11165_0 v11165_1 v11165_2 + +variable {Ω : Type v11165_0} {ι : Type v11165_1} {K : Type v11165_2} [inst11165_0 : MeasurableSpace Ω] [inst11165_1 : Fintype ι] [inst11165_2 : DecidableEq ι] + [inst11165_3 : Fintype K] [inst11165_4 : DecidableEq K] {μ : Measure Ω} + +namespace KeyDensity + +variable (τ υ : KeyDensity μ K ι) (sigma : EveDensity μ ι) + +lemma idealError_nonneg : 0 ≤ τ.idealError sigma := cqDistance_nonneg _ _ + +lemma distance_nonneg : 0 ≤ τ.distance υ := cqDistance_nonneg _ _ + +omit inst11165_4 in +lemma distance_self [DecidableEq K] : τ.distance τ = 0 := by + have hz : traceNorm (0 : Matrix ι ι ℂ) = 0 := by + rw [traceNorm_posSemidef (Matrix.PosSemidef.zero)]; simp + simp [distance,cqDistance,hz] + +lemma idealError_triangle : τ.idealError sigma ≤ τ.distance υ + υ.idealError sigma := + cqDistance_triangle τ.block υ.block (fun a b t => idealFiniteBlocks (sigma.block t) a b) + τ.measurable υ.measurable (idealFinite_measurable sigma.block sigma.measurable) + τ.positive υ.positive (fun a b t => idealFinite_positive (sigma.block t) (sigma.positive t) a b) + τ.integrable υ.integrable (idealFinite_trace_integrable sigma.block sigma.integrable) + +theorem gap_of_traceNorm_limit (τ : ℕ → KeyDensity μ K ι) (υ : KeyDensity μ K ι) + (sigma : EveDensity μ ι) (hgap : ∀ n, 1/5 ≤ (τ n).idealError sigma) + (hlim : Tendsto (fun n => (τ n).distance υ) atTop (nhds 0)) : + 1/5 ≤ υ.idealError sigma := by + have hle (n : ℕ) := (hgap n).trans ((τ n).idealError_triangle υ sigma) + have ht : Tendsto (fun n => (τ n).distance υ + υ.idealError sigma) + atTop (nhds (υ.idealError sigma)) := by simpa using hlim.add_const (υ.idealError sigma) + exact ge_of_tendsto ht (Filter.Eventually.of_forall hle) + +end KeyDensity + +namespace PositiveMatrixMeasure + +def toEveDensity (W : PositiveMatrixMeasure Ω ι) (μ : Measure Ω) [SigmaFinite μ] + (hAC : ∀ S, MeasurableSet S → μ S = 0 → W.value S = 0) + (hn : (trace (W.value Set.univ)).re = 1) : EveDensity μ ι where + block := W.positiveDensity μ + measurable := W.measurable_positiveDensity μ + positive := W.positiveDensity_pos μ + integrable := W.integrable_positiveDensity_trace μ hAC + normalized := (W.integral_positiveDensity_trace μ hAC).trans hn + +end PositiveMatrixMeasure + +end ZeroKey + +open Matrix MeasureTheory ProbabilityTheory Filter + +open scoped ComplexOrder MatrixOrder Matrix.Norms.L2Operator + +namespace ZeroKey + +open UnrestrictedQuantum + +universe v11244_0 v11244_1 v11244_2 v11244_3 v11244_4 v11244_5 v11244_6 v11244_7 v11244_8 v11244_9 v11244_10 v11244_11 + +variable {O : Type v11244_0} {M : Type v11244_1} {ι : Type v11244_2} {η : Type v11244_3} [inst11244_0 : MeasurableSpace O] [inst11244_1 : MeasurableSpace M] + [inst11244_2 : StandardBorelSpace O] [inst11244_3 : Nonempty O] [inst11244_4 : StandardBorelSpace M] [inst11244_5 : Nonempty M] + [inst11244_6 : Fintype ι] [inst11244_7 : Fintype η] [inst11244_8 : DecidableEq ι] [inst11244_9 : DecidableEq η] [inst11244_10 : Nonempty ι] [inst11244_11 : Nonempty η] + {K : Type v11244_4} [inst11244_12 : MeasurableSpace K] [inst11244_13 : MeasurableSingletonClass K] + [inst11244_14 : Fintype K] [inst11244_15 : DecidableEq K] [inst11244_16 : Nonempty K] + {d : Discussion O M} {A : ℕ → Type v11244_5} {B : ℕ → Type v11244_6} + [inst11244_17 : ∀ n, AddCommGroup (A n)] [inst11244_18 : ∀ n, Module ℂ (A n)] [inst11244_19 : ∀ n, One (A n)] [inst11244_20 : ∀ n, LE (A n)] + [inst11244_21 : ∀ n, AddCommGroup (B n)] [inst11244_22 : ∀ n, Module ℂ (B n)] [inst11244_23 : ∀ n, One (B n)] [inst11244_24 : ∀ n, LE (B n)] + {TA : Type v11244_7} {TB : Type v11244_8} {CA : Type v11244_9} {CB : Type v11244_10} + [inst11244_25 : AddCommGroup TA] [inst11244_26 : Module ℂ TA] [inst11244_27 : One TA] [inst11244_28 : LE TA] + [inst11244_29 : AddCommGroup TB] [inst11244_30 : Module ℂ TB] [inst11244_31 : One TB] [inst11244_32 : LE TB] + [inst11244_33 : AddCommGroup CA] [inst11244_34 : Module ℂ CA] [inst11244_35 : One CA] [inst11244_36 : LE CA] + [inst11244_37 : AddCommGroup CB] [inst11244_38 : Module ℂ CB] [inst11244_39 : One CB] [inst11244_40 : LE CB] + {κ : Type v11244_11} [inst11244_41 : Fintype κ] [inst11244_42 : DecidableEq κ] + +theorem BitProtocol.uniform_gap_purification_dominated + {a b : ℕ} [Nonempty (Fin a)] [Nonempty (Fin b)] + (p : BitProtocol (ι := Fin a) (η := Fin b) d A B TA TB CA CB) + (R : Matrix (Fin a × Fin b) (Fin a × Fin b) ℂ) (hR : InClass R) + (P : Matrix (Fin a × Fin b) κ ℂ) (hP : P * Pᴴ = R) + (ν : Measure (ℕ → M)) [SigmaFinite ν] (hμν : d.transcriptLaw ≪ ν) + (sigma : EveDensity ν κ) : + 1/5 ≤ (p.purifiedDensity R hR.1 P hP ν hμν).idealBitError sigma.block := by + obtain ⟨L,hpos,htr,hrec⟩ := p.purifiedOutput_recovery R hR.1 P hP + let tp := p.purifiedDensity R hR.1 P hP ν hμν + let tc := p.outputDensity R hR.1 ν hμν + have hg := p.uniform_gap_dominated R hR ν hμν + (fun t => L (sigma.block t)) (L.continuous_of_finiteDimensional.measurable.comp sigma.measurable) + (fun t => hpos _ (sigma.positive t)) + (show Integrable (fun t => (trace (L (sigma.block t))).re) ν by simpa only [htr] using sigma.integrable) + (show (∫ t, (trace (L (sigma.block t))).re ∂ν) = 1 by simpa only [htr] using sigma.normalized) + have hrc := BitDensity.idealBitError_congr tc (tp.mapReference L hpos htr) + (fun t => L (sigma.block t)) (fun t => L (sigma.block t)) + (p.purifiedDensity_recovery R hR.1 P hP ν hμν L hrec) Filter.EventuallyEq.rfl + have hc := tp.idealBitError_mapReference_le L hpos htr sigma.block + sigma.measurable sigma.positive sigma.integrable + change 1/5 ≤ tp.idealBitError sigma.block + rw [hrc] at hg + exact hg.trans hc + +universe v11305_0 + +variable {Λ : Type v11305_0} [inst11305_0 : MeasurableSpace Λ] [inst11305_1 : MeasurableSingletonClass Λ] + [inst11305_2 : Fintype Λ] [inst11305_3 : DecidableEq Λ] [inst11305_4 : Nonempty Λ] + +theorem FiniteProtocol.uniform_purified_key_gap_dominated + {a b : ℕ} [Nonempty (Fin a)] [Nonempty (Fin b)] + (p : FiniteProtocol (ι := Fin a) (η := Fin b) (K := Bool × Λ) d A B TA TB CA CB) + (R : Matrix (Fin a × Fin b) (Fin a × Fin b) ℂ) (hR : InClass R) + (P : Matrix (Fin a × Fin b) κ ℂ) (hP : P * Pᴴ = R) + (ν : Measure (ℕ → M)) [SigmaFinite ν] (hμν : d.transcriptLaw ≪ ν) + (sigma : EveDensity ν κ) : + 1/5 ≤ (p.purifiedKeyDensity R hR.1 P hP ν hμν).idealError sigma := by + let τ := p.purifiedKeyDensity R hR.1 P hP ν hμν + have hc := cqFirstBit_ideal_le τ.block τ.measurable τ.positive τ.integrable + sigma.block sigma.measurable sigma.positive sigma.integrable + have he : (p.firstBit.purifiedDensity R hR.1 P hP ν hμν).idealBitError sigma.block = + cqBitError (fun i j t => firstBitBlocks (fun a b => τ.block a b t) i j) sigma.block ν := by + rw [BitDensity.idealBitError_eq_cq] + unfold cqBitError + apply Finset.sum_congr rfl + intro i _ + apply Finset.sum_congr rfl + intro j _ + apply integral_congr_ae + filter_upwards [p.firstBit_purifiedOutputDensity R hR.1 P hP ν hμν i j] with t ht + rw [ht] + rfl + have hg := p.firstBit.uniform_gap_purification_dominated R hR P hP ν hμν sigma + rw [he] at hg + exact hg.trans hc + +end ZeroKey + +end + +end OAI diff --git a/lean/OAI/InformationTheory/SecretKey/Sampling.lean b/lean/OAI/InformationTheory/SecretKey/Sampling.lean new file mode 100644 index 0000000000000000000000000000000000000000..afa68be42f6e7fbdbd9c609c873c99a07e4965cd --- /dev/null +++ b/lean/OAI/InformationTheory/SecretKey/Sampling.lean @@ -0,0 +1,834 @@ +import OAI.InformationTheory.SecretKey.Construction + +namespace OAI + +noncomputable section + +namespace UnrestrictedQuantum + +open Matrix MeasureTheory + +open scoped ComplexOrder MatrixOrder + +universe v3096_0 v3096_1 v3096_2 v3096_3 v3096_4 + +variable {A : Type v3096_0} {B : Type v3096_1} {C : Type v3096_2} [inst3096_0 : AddCommGroup A] [inst3096_1 : Module ℂ A] [inst3096_2 : One A] + [inst3096_3 : AddCommGroup B] [inst3096_4 : Module ℂ B] [inst3096_5 : One B] + [inst3096_6 : AddCommGroup C] [inst3096_7 : Module ℂ C] [inst3096_8 : One C] + {ι : Type v3096_3} {κ : Type v3096_4} [inst3096_9 : Fintype ι] [inst3096_10 : Fintype κ] [inst3096_11 : DecidableEq ι] [inst3096_12 : DecidableEq κ] + +def filterFunctional (K : Matrix κ ι ℂ) (S : ReferenceFunctional A ι) : + ReferenceFunctional A κ where + toFun x := K * S x * Kᴴ + map_add' x y := by rw [map_add, Matrix.mul_add, Matrix.add_mul] + map_smul' z x := by simp only [map_smul, Matrix.mul_smul, Matrix.smul_mul, + RingHom.id_apply] + +omit inst3096_2 inst3096_5 inst3096_10 inst3096_11 inst3096_12 in +theorem filter_precompose [One A] [One B] [Fintype κ] [DecidableEq ι] [DecidableEq κ] (K : Matrix κ ι ℂ) (S : ReferenceFunctional A ι) + (L : B →ₗ[ℂ] A) : + filterFunctional K (S.comp L) = (filterFunctional K S).comp L := rfl + +omit inst3096_2 inst3096_5 inst3096_8 inst3096_10 inst3096_11 inst3096_12 in +theorem filter_precompose_two [One A] [One B] [One C] [Fintype κ] [DecidableEq ι] [DecidableEq κ] (K : Matrix κ ι ℂ) (S : ReferenceFunctional A ι) + (L : B →ₗ[ℂ] A) (M : C →ₗ[ℂ] B) : + filterFunctional K ((S.comp L).comp M) = + ((filterFunctional K S).comp L).comp M := rfl + +omit inst3096_2 inst3096_11 inst3096_12 in +lemma filter_positive [One A] [DecidableEq ι] [DecidableEq κ] [LE A] (K : Matrix κ ι ℂ) + {S : ReferenceFunctional A ι} (hS : PositiveFunctional S) : + PositiveFunctional (filterFunctional K S) := by + intro x hx + exact (hS x hx).mul_mul_conjTranspose_same K + +universe v3147_0 + +variable {O : Type v3147_0} [inst3147_0 : MeasurableSpace O] [inst3147_1 : LE A] [inst3147_2 : LE B] + (J : ObservableInstrument O A B) (S : ReferenceFunctional A ι) + +namespace InstrumentRun + +variable (r : InstrumentRun J S) + +omit inst3096_11 in +theorem event_reference [DecidableEq ι] (E : Set O) (hE : MeasurableSet E) : + (fun i j => ∫ o in E, r.posterior o 1 i j ∂r.law) = + S (J.operation E 1) := by + ext i j + exact r.update E hE 1 i j + +omit inst3096_10 inst3096_11 inst3096_12 in +theorem filter_event [Fintype κ] [DecidableEq ι] [DecidableEq κ] (K : Matrix κ ι ℂ) (E : Set O) (hE : MeasurableSet E) : + (fun i j => ∫ o in E, filterFunctional K (r.posterior o) 1 i j ∂r.law) = + filterFunctional K S (J.operation E 1) := by + ext i j + simp only [filterFunctional, LinearMap.coe_mk, AddHom.coe_mk, + Matrix.mul_apply, Finset.sum_mul] + rw [integral_finsetSum _ (fun k _ => + integrable_finsetSum _ (fun l _ => + (((r.integrable 1 l k).const_mul (K i l)).mul_const (Kᴴ k j)).integrableOn))] + simp_rw [integral_finsetSum _ (fun l _ => + (((r.integrable 1 l _).const_mul (K i l)).mul_const _).integrableOn), + integral_mul_const, integral_const_mul, r.update E hE] + +end InstrumentRun + +end UnrestrictedQuantum + +open MeasureTheory ProbabilityTheory Set Function unitInterval + +open scoped ENNReal + +namespace ZeroKey + +universe v3238_0 v3238_1 v3238_2 + +theorem sample_instrument_update {S : Type v3238_0} {O : Type v3238_1} {Z : Type v3238_2} [MeasurableSpace S] + [MeasurableSpace O] [StandardBorelSpace O] [Nonempty O] [MeasurableSpace Z] + (κ : Kernel S O) [IsMarkovKernel κ] + (update : S × O → Z) (hu : Measurable update) : + ∃ f : S → I → O, Measurable (uncurry f) ∧ + ∀ (μ : Measure S) [IsFiniteMeasure μ], + (μ.prod (volume : Measure I)).map (fun p => update (p.1, f p.1 p.2)) = + (μ ⊗ₘ κ).map update := by + obtain ⟨f,hf,_,hLaw⟩ := sample_instrument_kernel κ + change Measurable (fun p : S × I => f p.1 p.2) at hf + refine ⟨f,hf,?_⟩ + intro μ hμ + rw [← hLaw μ, Measure.map_map hu (measurable_fst.prodMk hf)] + rfl + +lemma uniform_prefix_fresh_independent (n : ℕ) : + IndepFun (fun u : UniformTape => fun i : Fin n => u i) (fun u => u n) uniformTapeLaw := by + have h := iIndepFun_infinitePi (P := fun _ : ℕ => (volume : Measure I)) + (X := fun _ x => x) (fun _ => measurable_id) + have hd : Disjoint (Finset.range n) {n} := by simp + have hh := h.indepFun_finset (Finset.range n) {n} hd (fun i => measurable_pi_apply i) + have hh' := hh.comp + (show Measurable (fun x : (i : Finset.range n) → I => fun j : Fin n => + x ⟨j,Finset.mem_range.mpr j.isLt⟩) from by fun_prop) + (show Measurable (fun x : (i : ({n} : Finset ℕ)) → I => x ⟨n,by simp⟩) from by fun_prop) + exact hh' + +lemma uniform_tape_eval (n : ℕ) : uniformTapeLaw.map (fun u => u n) = volume := + Measure.infinitePi_map_eval _ _ + +universe v3280_0 + +structure CausalSampler (O : Type v3280_0) [MeasurableSpace O] where + step : (n : ℕ) → (Fin n → O) × I → O + measurable_step : ∀ n, Measurable (step n) + +namespace CausalSampler + +universe v3285_0 + +variable {O : Type v3285_0} [inst3285_0 : MeasurableSpace O] (f : CausalSampler O) + +def finiteHistory : (n : ℕ) → (Fin n → I) → (Fin n → O) + | 0, _ => Fin.elim0 + | n+1, u => Fin.snoc (finiteHistory n (fun i => u i.castSucc)) + (f.step n (finiteHistory n (fun i => u i.castSucc), u (Fin.last n))) + +lemma measurable_finiteHistory : ∀ n, Measurable (f.finiteHistory n) := by + intro n + induction n with + | zero => exact Measurable.of_eval (fun i => Fin.elim0 i) + | succ n ih => + have hr : Measurable (fun u : Fin (n+1) → I => fun i : Fin n => u i.castSucc) := by fun_prop + apply Measurable.of_eval + intro i + refine Fin.lastCases ?_ (fun j => ?_) i + · simpa only [finiteHistory, Fin.snoc_last,Function.comp_def] using + (f.measurable_step n).comp ((ih.comp hr).prodMk (measurable_pi_apply (Fin.last n))) + · simpa only [finiteHistory, Fin.snoc_castSucc,Function.comp_def] using (ih.comp hr).eval (a := j) + +def history (n : ℕ) (u : UniformTape) : Fin n → O := + f.finiteHistory n (fun i => u i) + +lemma measurable_prefix (n : ℕ) : Measurable (f.history n) := + (f.measurable_finiteHistory n).comp (by fun_prop) + +lemma prefix_succ (n : ℕ) (u : UniformTape) : + f.history (n+1) u = Fin.snoc (f.history n u) (f.step n (f.history n u,u n)) := rfl + +lemma prefix_fresh_independent (n : ℕ) : + IndepFun (f.history n) (fun u => u n) uniformTapeLaw := + (uniform_prefix_fresh_independent n).comp (f.measurable_finiteHistory n) measurable_id + +lemma prefix_fresh_law (n : ℕ) : + uniformTapeLaw.map (fun u => (f.history n u,u n)) = + (uniformTapeLaw.map (f.history n)).prod volume := by + rw [(f.prefix_fresh_independent n).map_prod_eq_prod_map_map + (f.measurable_prefix n).aemeasurable (measurable_pi_apply n).aemeasurable, + uniform_tape_eval] + +theorem prefix_law_succ (κ : (n : ℕ) → Kernel (Fin n → O) O) + [∀ n, IsMarkovKernel (κ n)] + (hlaw : ∀ n s, volume.map (fun u => f.step n (s,u)) = κ n s) + (n : ℕ) : + uniformTapeLaw.map (f.history (n+1)) = + ((uniformTapeLaw.map (f.history n)) ⊗ₘ κ n).map (fun p : (Fin n → O) × O => Fin.snoc (α := fun _ : Fin (n+1) => O) p.1 p.2) := by + have hfresh := f.prefix_fresh_law n + have hsample : ((uniformTapeLaw.map (f.history n)).prod (volume : Measure I)).map + (fun p => (p.1, f.step n p)) = (uniformTapeLaw.map (f.history n)) ⊗ₘ κ n := by + ext B hB + rw [Measure.map_apply (measurable_fst.prodMk (f.measurable_step n)) hB, + Measure.prod_apply (hB.preimage (measurable_fst.prodMk (f.measurable_step n))), + Measure.compProd_apply hB] + congr 1 + funext s + have hm : Measurable (fun u : I => f.step n (s,u)) := by + simpa only [Function.comp_def, id_eq] using + ((f.measurable_step n).comp ((measurable_const (a := s)).prodMk measurable_id)) + rw [← hlaw n s, Measure.map_apply hm (measurable_prodMk_left hB)] + rfl + have hs : Measurable (fun p : (Fin n → O) × O => Fin.snoc (α := fun _ : Fin (n+1) => O) p.1 p.2) := by + apply Measurable.of_eval + intro i + refine Fin.lastCases ?_ (fun j => ?_) i + · simpa only [Fin.snoc_last] using measurable_snd + · simpa only [Fin.snoc_castSucc, Function.comp_def] using (measurable_pi_apply j).comp measurable_fst + rw [← hsample, ← hfresh, + Measure.map_map (measurable_fst.prodMk (f.measurable_step n)) + ((f.measurable_prefix n).prodMk (measurable_pi_apply n)), + Measure.map_map hs ((measurable_fst.prodMk (f.measurable_step n)).comp + ((f.measurable_prefix n).prodMk (measurable_pi_apply n)))] + rfl + +def record (u : UniformTape) (n : ℕ) : O := f.step n (f.history n u,u n) + +lemma measurable_record : Measurable f.record := + Measurable.of_eval (fun n => + (f.measurable_step n).comp ((f.measurable_prefix n).prodMk (measurable_pi_apply n))) + +lemma prefix_eq_record (n : ℕ) (u : UniformTape) (i : Fin n) : + f.history n u i = f.record u i := by + induction n with + | zero => exact Fin.elim0 i + | succ n ih => + rw [f.prefix_succ] + refine Fin.lastCases ?_ (fun j => ?_) i + · simp only [Fin.snoc_last,record, Fin.val_last] + · simpa only [Fin.snoc_castSucc, Fin.val_castSucc] using ih j + +theorem finite_law_unique (κ : (n : ℕ) → Kernel (Fin n → O) O) + [∀ n, IsMarkovKernel (κ n)] + (hlaw : ∀ n s, volume.map (fun u => f.step n (s,u)) = κ n s) + (P : Measure (ℕ → O)) [IsProbabilityMeasure P] + (hP : ∀ n, P.map (fun x => fun i : Fin (n+1) => x i) = + ((P.map (fun x => fun i : Fin n => x i)) ⊗ₘ κ n).map + (fun p : (Fin n → O) × O => Fin.snoc (α := fun _ : Fin (n+1) => O) p.1 p.2)) : + ∀ n, P.map (fun x => fun i : Fin n => x i) = uniformTapeLaw.map (f.history n) := by + intro n + induction n with + | zero => + have ht : (fun x : ℕ → O => fun i : Fin 0 => x i) = fun _ => Fin.elim0 := by + funext x i + exact Fin.elim0 i + rw [ht] + change P.map (fun _ : ℕ → O => Fin.elim0) = + uniformTapeLaw.map (fun _ : UniformTape => Fin.elim0) + simp + | succ n ih => rw [hP n, ih, f.prefix_law_succ κ hlaw] + +theorem record_law_unique (κ : (n : ℕ) → Kernel (Fin n → O) O) + [∀ n, IsMarkovKernel (κ n)] + (hlaw : ∀ n s, volume.map (fun u => f.step n (s,u)) = κ n s) + (P : Measure (ℕ → O)) [IsProbabilityMeasure P] + (hP : ∀ n, P.map (fun x => fun i : Fin (n+1) => x i) = + ((P.map (fun x => fun i : Fin n => x i)) ⊗ₘ κ n).map + (fun p : (Fin n → O) × O => Fin.snoc (α := fun _ : Fin (n+1) => O) p.1 p.2)) : + P = uniformTapeLaw.map f.record := by + let Q := uniformTapeLaw.map f.record + have hQ : IsProbabilityMeasure Q := inferInstance + apply IsProjectiveLimit.unique (P := fun J : Finset ℕ => Q.map J.restrict) ?_ + (show IsProjectiveLimit Q (fun J : Finset ℕ => Q.map J.restrict) from fun _ => rfl) + intro J + let n := J.sup id + 1 + let index : J → Fin n := fun j => ⟨j.1,Nat.lt_succ_of_le (Finset.le_sup (f := id) j.2)⟩ + let cut : (Fin n → O) → (J → O) := fun x j => x (index j) + have hc : Measurable cut := by fun_prop + have h := congrArg (fun ν : Measure (Fin n → O) => ν.map cut) + (f.finite_law_unique κ hlaw P hP n) + rw [Measure.map_map hc (by fun_prop), Measure.map_map hc (f.measurable_prefix n)] at h + change P.map J.restrict = (uniformTapeLaw.map f.record).map J.restrict + rw [Measure.map_map (Finset.measurable_restrict J) f.measurable_record] + have heL : cut ∘ (fun x : ℕ → O => fun i : Fin n => x i) = J.restrict := rfl + have heR : cut ∘ f.history n = J.restrict ∘ f.record := by + funext u j + exact f.prefix_eq_record n u (index j) + rwa [heL,heR] at h + +end CausalSampler + +universe v3434_0 + +theorem exists_causal_sampler {O : Type v3434_0} [MeasurableSpace O] + [StandardBorelSpace O] [Nonempty O] + (κ : (n : ℕ) → Kernel (Fin n → O) O) [∀ n, IsMarkovKernel (κ n)] : + ∃ f : CausalSampler O, ∀ n s, volume.map (fun u => f.step n (s,u)) = κ n s := by + have h (n : ℕ) := sample_instrument_kernel (κ n) + choose sample hmeas hlaw hrest using h + exact ⟨⟨fun n p => sample n p.1 p.2, hmeas⟩, hlaw⟩ + +end ZeroKey + +open MeasureTheory ProbabilityTheory Filter + +open scoped ENNReal + +namespace ZeroKey + +section + +universe v3447_0 + +variable {Ω : Type v3447_0} {mΩ : MeasurableSpace Ω} [inst3447_0 : StandardBorelSpace Ω] + {μ : Measure Ω} [inst3447_1 : IsFiniteMeasure μ] + +lemma condIndep_public_prefixes (ℱ : Filtration ℕ mΩ) + (A B : MeasurableSpace Ω) (hA : A ≤ mΩ) (hB : B ≤ mΩ) + (hinitial : CondIndep (ℱ 0) A B (ℱ.le 0) μ) + (hlocal : ∀ n, ℱ (n+1) ≤ A ⊔ ℱ n ∨ ℱ (n+1) ≤ B ⊔ ℱ n) : + ∀ n, CondIndep (ℱ n) A B (ℱ.le n) μ := by + intro n + induction n with + | zero => exact hinitial + | succ n ih => + rcases hlocal n with h | h + · exact condIndep_local_message (ℱ.le n) hA hB (ℱ.mono (Nat.le_succ n)) h ih + · exact (condIndep_local_message (ℱ.le n) hB hA (ℱ.mono (Nat.le_succ n)) h ih.symm).symm + +end + +open MeasureTheory ProbabilityTheory + +universe v3676_0 + +variable {Ω : Type v3676_0} {mΩ : MeasurableSpace Ω} [inst3676_0 : StandardBorelSpace Ω] + {μ : Measure Ω} [inst3676_1 : IsFiniteMeasure μ] + +theorem independent_tapes_given_full_transcript (ℱ : Filtration ℕ mΩ) + (A B : MeasurableSpace Ω) (hA : A ≤ mΩ) (hB : B ≤ mΩ) + (hinitial : CondIndep (ℱ 0) A B (ℱ.le 0) μ) + (hlocal : ∀ n, ℱ (n+1) ≤ A ⊔ ℱ n ∨ ℱ (n+1) ≤ B ⊔ ℱ n) : + CondIndep (⨆ n, ℱ n) (A ⊔ ⨆ n, ℱ n) (B ⊔ ⨆ n, ℱ n) + (iSup_le fun n => ℱ.le n) μ := by + have h := condIndep_full_transcript ℱ A B hA hB + (condIndep_public_prefixes ℱ A B hA hB hinitial hlocal) + have hC := iSup_le fun n => ℱ.le n + have h1 := (condIndep_join_public_right hC hB hA h.symm).symm + exact condIndep_join_public_right hC (sup_le hA hC) hB h1 + +end ZeroKey + +open MeasureTheory ProbabilityTheory Function Set + +namespace ZeroKey + +namespace LocalTapeProgram + +universe v3724_0 v3724_1 v3724_2 + +variable {U : Type v3724_0} {V : Type v3724_1} {M : Type v3724_2} [inst3724_0 : MeasurableSpace U] [inst3724_1 : MeasurableSpace V] [inst3724_2 : MeasurableSpace M] + (p : LocalTapeProgram U V M) + +def message (n : ℕ) (ω : U × V) : M := + if p.alice n then p.sendA n (ω.1,p.publicPrefix n ω) else p.sendB n (ω.2,p.publicPrefix n ω) + +lemma prefix_succ (n : ℕ) (ω : U × V) : + p.publicPrefix (n+1) ω = Fin.snoc (p.publicPrefix n ω) (p.message n ω) := rfl + +lemma measurable_prefix : ∀ n, Measurable (p.publicPrefix n) := by + intro n + induction n with + | zero => exact Measurable.of_eval (fun i => Fin.elim0 i) + | succ n ih => + apply Measurable.of_eval + intro i + refine Fin.lastCases ?_ (fun j => ?_) i + · simp only [publicPrefix, Fin.snoc_last] + split + · exact (p.measA n).comp (measurable_fst.prodMk ih) + · exact (p.measB n).comp (measurable_snd.prodMk ih) + · simpa only [publicPrefix, Fin.snoc_castSucc] using ih.eval (a := j) + +lemma measurable_message (n : ℕ) : Measurable (p.message n) := by + unfold message + split + · exact (p.measA n).comp (measurable_fst.prodMk (p.measurable_prefix n)) + · exact (p.measB n).comp (measurable_snd.prodMk (p.measurable_prefix n)) + +@[instance_reducible] +def field (n : ℕ) : MeasurableSpace (U × V) := + MeasurableSpace.comap (p.publicPrefix n) inferInstance + +lemma field_le (n : ℕ) : p.field n ≤ (inferInstance : MeasurableSpace (U × V)) := (p.measurable_prefix n).comap_le + +lemma field_mono : Monotone p.field := by + apply monotone_nat_of_le_succ + intro n + have h : @Measurable (U × V) (Fin n → M) (p.field (n+1)) _ (p.publicPrefix n) := by + let : MeasurableSpace (U × V) := p.field (n+1) + apply Measurable.of_eval + intro i + have hh := (@Measurable.of_comap_le (U × V) (Fin (n+1) → M) + (p.field (n+1)) _ (p.publicPrefix (n+1)) le_rfl).eval (a := i.castSucc) + simpa only [publicPrefix, Fin.snoc_castSucc] using hh + exact h.comap_le + +def filtration : Filtration ℕ (inferInstance : MeasurableSpace (U × V)) where + seq := p.field + mono' := p.field_mono + le' := p.field_le + +lemma field_zero : p.field 0 = ⊥ := by + exact MeasurableSpace.comap_const Fin.elim0 + +lemma field_local (n : ℕ) : + p.field (n+1) ≤ MeasurableSpace.comap Prod.fst ‹MeasurableSpace U› ⊔ p.field n ∨ + p.field (n+1) ≤ MeasurableSpace.comap Prod.snd ‹MeasurableSpace V› ⊔ p.field n := by + have hp {C : MeasurableSpace (U × V)} (hC : p.field n ≤ C) : + @Measurable (U × V) (Fin n → M) C _ (p.publicPrefix n) := Measurable.of_comap_le hC + have hf {C : MeasurableSpace (U × V)} + (hC : MeasurableSpace.comap Prod.fst ‹MeasurableSpace U› ≤ C) : + @Measurable (U × V) U C _ Prod.fst := Measurable.of_comap_le hC + have hg {C : MeasurableSpace (U × V)} + (hC : MeasurableSpace.comap Prod.snd ‹MeasurableSpace V› ≤ C) : + @Measurable (U × V) V C _ Prod.snd := Measurable.of_comap_le hC + cases ha : p.alice n + · right + let : MeasurableSpace (U × V) := MeasurableSpace.comap Prod.snd ‹MeasurableSpace V› ⊔ p.field n + apply Measurable.comap_le + apply Measurable.of_eval + intro i + refine Fin.lastCases ?_ (fun j => ?_) i + · simpa only [publicPrefix, Fin.snoc_last, ha, Bool.false_eq_true, ↓reduceIte, Function.comp_def] using + (p.measB n).comp ((hg le_sup_left).prodMk (hp le_sup_right)) + · simpa only [publicPrefix, Fin.snoc_castSucc] using (hp le_sup_right).eval (a := j) + · left + let : MeasurableSpace (U × V) := MeasurableSpace.comap Prod.fst ‹MeasurableSpace U› ⊔ p.field n + apply Measurable.comap_le + apply Measurable.of_eval + intro i + refine Fin.lastCases ?_ (fun j => ?_) i + · simpa only [publicPrefix, Fin.snoc_last, ha, ↓reduceIte, Function.comp_def] using + (p.measA n).comp ((hf le_sup_left).prodMk (hp le_sup_right)) + · simpa only [publicPrefix, Fin.snoc_castSucc] using (hp le_sup_right).eval (a := j) + +theorem tapes_conditionally_independent [StandardBorelSpace U] [StandardBorelSpace V] + (μ : Measure U) (ν : Measure V) [IsProbabilityMeasure μ] [IsProbabilityMeasure ν] : + CondIndep (⨆ n, p.field n) + (MeasurableSpace.comap Prod.fst ‹MeasurableSpace U› ⊔ ⨆ n, p.field n) + (MeasurableSpace.comap Prod.snd ‹MeasurableSpace V› ⊔ ⨆ n, p.field n) + (iSup_le p.field_le) (μ.prod ν) := by + apply independent_tapes_given_full_transcript p.filtration _ _ + measurable_fst.comap_le measurable_snd.comap_le + · change CondIndep (p.field 0) _ _ _ _ + have h0 := indep_condIndep_bot measurable_fst.comap_le measurable_snd.comap_le + (P := μ.prod ν) (indepFun_prod (μ := μ) (ν := ν) measurable_id measurable_id) + simpa only [p.field_zero] using h0 + · exact p.field_local + +def record (ω : U × V) (n : ℕ) : M := p.message n ω + +lemma measurable_record : Measurable p.record := + Measurable.of_eval p.measurable_message + +lemma prefix_eq_record (n : ℕ) (ω : U × V) (i : Fin n) : + p.publicPrefix n ω i = p.record ω i := by + induction n with + | zero => exact Fin.elim0 i + | succ n ih => + refine Fin.lastCases ?_ (fun j => ?_) i + · simp only [publicPrefix, Fin.snoc_last, record, message, Fin.val_last] + · simpa only [publicPrefix, Fin.snoc_castSucc, Fin.val_castSucc] using ih j + +lemma full_record_field : + MeasurableSpace.comap p.record inferInstance = ⨆ n, p.field n := by + apply le_antisymm + · let : MeasurableSpace (U × V) := ⨆ n, p.field n + apply Measurable.comap_le + apply Measurable.of_eval + intro n + have h : @Measurable (U × V) (Fin (n+1) → M) (⨆ n, p.field n) _ + (p.publicPrefix (n+1)) := Measurable.of_comap_le (le_iSup p.field (n+1)) + simpa only [publicPrefix, Fin.snoc_last, record, message] using h.eval (a := Fin.last n) + · apply iSup_le + intro n + let : MeasurableSpace (U × V) := MeasurableSpace.comap p.record inferInstance + apply Measurable.comap_le + apply Measurable.of_eval + intro i + simp_rw [prefix_eq_record] + exact (Measurable.of_comap_le (f := p.record) le_rfl).eval + +universe v3866_0 v3866_1 + +theorem final_records_conditionally_independent + [StandardBorelSpace U] [StandardBorelSpace V] + (μ : Measure U) (ν : Measure V) [IsProbabilityMeasure μ] [IsProbabilityMeasure ν] + {A : Type v3866_0} {B : Type v3866_1} [MeasurableSpace A] [MeasurableSpace B] + (readA : U × (ℕ → M) → A) (readB : V × (ℕ → M) → B) + (ha : Measurable readA) (hb : Measurable readB) : + CondIndepFun (MeasurableSpace.comap p.record inferInstance) + p.measurable_record.comap_le + (fun ω => readA (ω.1,p.record ω)) + (fun ω => readB (ω.2,p.record ω)) (μ.prod ν) := by + have h := p.tapes_conditionally_independent μ ν + rw [condIndepFun_iff_condIndep] + have hA : MeasurableSpace.comap (fun ω => readA (ω.1,p.record ω)) inferInstance ≤ + MeasurableSpace.comap Prod.fst ‹MeasurableSpace U› ⊔ ⨆ n, p.field n := by + apply Measurable.comap_le + exact ha.comp ((Measurable.of_comap_le le_sup_left).prodMk + (Measurable.of_comap_le (p.full_record_field ▸ le_sup_right))) + have hB : MeasurableSpace.comap (fun ω => readB (ω.2,p.record ω)) inferInstance ≤ + MeasurableSpace.comap Prod.snd ‹MeasurableSpace V› ⊔ ⨆ n, p.field n := by + apply Measurable.comap_le + exact hb.comp ((Measurable.of_comap_le le_sup_left).prodMk + (Measurable.of_comap_le (p.full_record_field ▸ le_sup_right))) + have h' := condIndep_of_condIndep_of_le_right + (condIndep_of_condIndep_of_le_left h hA) hB + simpa only [p.full_record_field] using h' + +end LocalTapeProgram + +end ZeroKey + +open MeasureTheory ProbabilityTheory Function Set unitInterval + +namespace ZeroKey + +theorem selected_tapes_law (alice : ℕ → Bool) : + (uniformTapeLaw.prod uniformTapeLaw).map + (fun uv : UniformTape × UniformTape => fun n => if alice n then uv.1 n else uv.2 n) = + uniformTapeLaw := by + let ν : Measure ((Fin 2 × ℕ) → I) := + Measure.infinitePi (fun _ => (volume : Measure I)) + let split : ((Fin 2 × ℕ) → I) → UniformTape × UniformTape := + fun u => (fun n => u (0,n), fun n => u (1,n)) + have hs : Measurable split := by fun_prop + have hsplit : ν.map split = uniformTapeLaw.prod uniformTapeLaw := by + have hc := Measure.infinitePi_map_curry (fun (_ : Fin 2) (_ : ℕ) => (volume : Measure I)) + change ν.map (MeasurableEquiv.curry (Fin 2) ℕ I) = + Measure.infinitePi (fun _ : Fin 2 => uniformTapeLaw) at hc + rw [Measure.infinitePi_eq_pi (fun _ : Fin 2 => uniformTapeLaw)] at hc + have h := congrArg (fun P : Measure (Fin 2 → UniformTape) => + P.map MeasurableEquiv.finTwoArrow) hc + rw [Measure.map_map (MeasurableEquiv.measurable _) (MeasurableEquiv.measurable _), + (measurePreserving_finTwoArrow uniformTapeLaw).map_eq] at h + exact h + let chooseTape : UniformTape × UniformTape → UniformTape := + fun uv n => if alice n then uv.1 n else uv.2 n + have hm : Measurable chooseTape := by + apply Measurable.of_eval + intro n + dsimp [chooseTape] + split <;> fun_prop + rw [← hsplit, Measure.map_map hm hs] + let index : ℕ → Fin 2 × ℕ := fun n => (if alice n then 0 else 1,n) + have hi : Injective index := by intro a b hab; exact congrArg Prod.snd hab + have h := Measure.map_infinitePi_infinitePi_of_inj + (P := fun _ : Fin 2 × ℕ => (volume : Measure I)) hi + have he : chooseTape ∘ split = fun u n => u (index n) := by + funext u n + dsimp [chooseTape,split,index] + split <;> rfl + rw [he] + exact h + +namespace LocalOutcomeSampler + +universe v3955_0 v3955_1 + +variable {O : Type v3955_0} {M : Type v3955_1} [inst3955_0 : MeasurableSpace O] [inst3955_1 : MeasurableSpace M] + (p : LocalOutcomeSampler O M) + +lemma measurable_privatePrefix (a : Bool) : ∀ n, Measurable (p.privatePrefix a n) := by + intro n + induction n with + | zero => exact Measurable.of_eval (fun i => Fin.elim0 i) + | succ n ih => + have hr : Measurable (fun pair : UniformTape × (Fin (n+1) → M) => + (pair.1,fun i : Fin n => pair.2 i.castSucc)) := by fun_prop + have hv : Measurable (fun pair : UniformTape × (Fin (n+1) → M) => + fun i : Fin n => pair.2 i.castSucc) := by fun_prop + apply Measurable.of_eval + intro i + refine Fin.lastCases ?_ (fun j => ?_) i + · simp only [privatePrefix,Fin.snoc_last] + split + · apply measurable_inl.comp + split + · exact (p.sampleA_meas n).comp (((ih.comp hr).prodMk hv).prodMk + ((measurable_pi_apply n).comp measurable_fst)) + · exact (p.sampleB_meas n).comp (((ih.comp hr).prodMk hv).prodMk + ((measurable_pi_apply n).comp measurable_fst)) + · exact measurable_const + · simpa only [privatePrefix,Fin.snoc_castSucc,Function.comp_def] using + (ih.comp hr).eval (a := j) + +def tapeProgram : LocalTapeProgram UniformTape UniformTape M where + alice := p.alice + sendA n pair := p.sendA n ((p.privatePrefix true n pair,pair.2), + p.sampleA n ((p.privatePrefix true n pair,pair.2),pair.1 n)) + sendB n pair := p.sendB n ((p.privatePrefix false n pair,pair.2), + p.sampleB n ((p.privatePrefix false n pair,pair.2),pair.1 n)) + measA n := (p.sendA_meas n).comp + (((p.measurable_privatePrefix true n).prodMk measurable_snd).prodMk + ((p.sampleA_meas n).comp (((p.measurable_privatePrefix true n).prodMk measurable_snd).prodMk + ((measurable_pi_apply n).comp measurable_fst)))) + measB n := (p.sendB_meas n).comp + (((p.measurable_privatePrefix false n).prodMk measurable_snd).prodMk + ((p.sampleB_meas n).comp (((p.measurable_privatePrefix false n).prodMk measurable_snd).prodMk + ((measurable_pi_apply n).comp measurable_fst)))) + +def privateRecord (a : Bool) (pair : UniformTape × (ℕ → M)) (n : ℕ) : (O ⊕ Unit) := + if p.alice n = a then + let past := fun i : Fin n => pair.2 i + let privatePast := p.privatePrefix a n (pair.1,past) + Sum.inl (if a then p.sampleA n ((privatePast,past),pair.1 n) + else p.sampleB n ((privatePast,past),pair.1 n)) + else Sum.inr () + +lemma measurable_privateRecord (a : Bool) : Measurable (p.privateRecord a) := by + apply Measurable.of_eval + intro n + have hp : Measurable (fun pair : UniformTape × (ℕ → M) => fun i : Fin n => pair.2 i) := by fun_prop + have hl := (p.measurable_privatePrefix a n).comp (measurable_fst.prodMk hp) + simp only [privateRecord] + split + · apply measurable_inl.comp + split + · exact (p.sampleA_meas n).comp ((hl.prodMk hp).prodMk + ((measurable_pi_apply n).comp measurable_fst)) + · exact (p.sampleB_meas n).comp ((hl.prodMk hp).prodMk + ((measurable_pi_apply n).comp measurable_fst)) + · exact measurable_const + +universe v4032_0 v4032_1 + +theorem final_records_independent {A : Type v4032_0} {B : Type v4032_1} [MeasurableSpace A] [MeasurableSpace B] + (readA : (ℕ → (O ⊕ Unit)) × (ℕ → M) → A) + (readB : (ℕ → (O ⊕ Unit)) × (ℕ → M) → B) + (ha : Measurable readA) (hb : Measurable readB) : + CondIndepFun (MeasurableSpace.comap p.tapeProgram.record inferInstance) + p.tapeProgram.measurable_record.comap_le + (fun uv => readA (p.privateRecord true (uv.1,p.tapeProgram.record uv),p.tapeProgram.record uv)) + (fun uv => readB (p.privateRecord false (uv.2,p.tapeProgram.record uv),p.tapeProgram.record uv)) + (uniformTapeLaw.prod uniformTapeLaw) := by + exact p.tapeProgram.final_records_conditionally_independent uniformTapeLaw uniformTapeLaw + (fun pair => readA (p.privateRecord true pair,pair.2)) + (fun pair => readB (p.privateRecord false pair,pair.2)) + (ha.comp ((p.measurable_privateRecord true).prodMk measurable_snd)) + (hb.comp ((p.measurable_privateRecord false).prodMk measurable_snd)) + +lemma measurable_extractPrivate (a : Bool) (n : ℕ) : + Measurable (p.extractPrivate a n) := by + apply Measurable.of_eval + intro i + unfold extractPrivate + split + · exact measurable_inl.comp (measurable_pi_apply i) + · exact measurable_const + +lemma extractPrivate_snoc (a : Bool) (n : ℕ) (x : Fin n → O) (z : O) : + p.extractPrivate a (n+1) (Fin.snoc (α := fun _ => O) x z) = + Fin.snoc (p.extractPrivate a n x) (if p.alice n = a then Sum.inl z else Sum.inr ()) := by + funext i + refine Fin.lastCases ?_ (fun j => ?_) i + · simp only [extractPrivate,Fin.snoc_last,Fin.val_last] + · simp only [extractPrivate,Fin.snoc_castSucc,Fin.val_castSucc] + +lemma measurable_publicFrom : ∀ n, Measurable (p.publicFrom n) := by + intro n + induction n with + | zero => exact Measurable.of_eval (fun i => Fin.elim0 i) + | succ n ih => + have hr : Measurable (fun x : Fin (n+1) → O => fun i : Fin n => x i.castSucc) := by fun_prop + apply Measurable.of_eval + intro i + refine Fin.lastCases ?_ (fun j => ?_) i + · simp only [publicFrom,Fin.snoc_last] + split + · exact (p.sendA_meas n).comp ((((p.measurable_extractPrivate true n).comp hr).prodMk + (ih.comp hr)).prodMk (measurable_pi_apply (Fin.last n))) + · exact (p.sendB_meas n).comp ((((p.measurable_extractPrivate false n).comp hr).prodMk + (ih.comp hr)).prodMk (measurable_pi_apply (Fin.last n))) + · simpa only [publicFrom,Fin.snoc_castSucc,Function.comp_def] using (ih.comp hr).eval (a := j) + +lemma publicFrom_snoc (n : ℕ) (x : Fin n → O) (z : O) : + p.publicFrom (n+1) (Fin.snoc (α := fun _ => O) x z) = + Fin.snoc (p.publicFrom n x) (if p.alice n then + p.sendA n ((p.extractPrivate true n x,p.publicFrom n x),z) else + p.sendB n ((p.extractPrivate false n x,p.publicFrom n x),z)) := by + simp only [publicFrom,Fin.snoc_castSucc,Fin.snoc_last] + +lemma privatePrefix_snoc (a : Bool) (n : ℕ) (u : UniformTape) (h : Fin n → M) (z : M) : + p.privatePrefix a (n+1) (u,Fin.snoc (α := fun _ => M) h z) = + Fin.snoc (p.privatePrefix a n (u,h)) (if p.alice n = a then Sum.inl + (if a then p.sampleA n ((p.privatePrefix a n (u,h),h),u n) + else p.sampleB n ((p.privatePrefix a n (u,h),h),u n)) else Sum.inr ()) := by + simp only [privatePrefix,Fin.snoc_castSucc] + +def causal : CausalSampler O where + step n pair := if p.alice n then + p.sampleA n ((p.extractPrivate true n pair.1,p.publicFrom n pair.1),pair.2) else + p.sampleB n ((p.extractPrivate false n pair.1,p.publicFrom n pair.1),pair.2) + measurable_step n := by + split + · exact (p.sampleA_meas n).comp ((((p.measurable_extractPrivate true n).comp measurable_fst).prodMk + ((p.measurable_publicFrom n).comp measurable_fst)).prodMk measurable_snd) + · exact (p.sampleB_meas n).comp ((((p.measurable_extractPrivate false n).comp measurable_fst).prodMk + ((p.measurable_publicFrom n).comp measurable_fst)).prodMk measurable_snd) + +def selectedTape (uv : UniformTape × UniformTape) (n : ℕ) : I := + if p.alice n then uv.1 n else uv.2 n + +lemma measurable_selectedTape : Measurable p.selectedTape := by + apply Measurable.of_eval + intro n + unfold selectedTape + split <;> fun_prop + +theorem replay_matches (n : ℕ) (uv : UniformTape × UniformTape) : + p.publicFrom n (p.causal.history n (p.selectedTape uv)) = p.tapeProgram.publicPrefix n uv ∧ + ∀ a : Bool, p.extractPrivate a n (p.causal.history n (p.selectedTape uv)) = + p.privatePrefix a n ((if a then uv.1 else uv.2),p.tapeProgram.publicPrefix n uv) := by + induction n with + | zero => + constructor + · rfl + · intro a; funext i; exact Fin.elim0 i + | succ n ih => + have hs : p.causal.step n (p.causal.history n (p.selectedTape uv),p.selectedTape uv n) = + if p.alice n then + p.sampleA n ((p.privatePrefix true n (uv.1,p.tapeProgram.publicPrefix n uv), + p.tapeProgram.publicPrefix n uv),uv.1 n) else + p.sampleB n ((p.privatePrefix false n (uv.2,p.tapeProgram.publicPrefix n uv), + p.tapeProgram.publicPrefix n uv),uv.2 n) := by + change (if p.alice n then + p.sampleA n ((p.extractPrivate true n (p.causal.history n (p.selectedTape uv)), + p.publicFrom n (p.causal.history n (p.selectedTape uv))),p.selectedTape uv n) + else p.sampleB n ((p.extractPrivate false n (p.causal.history n (p.selectedTape uv)), + p.publicFrom n (p.causal.history n (p.selectedTape uv))),p.selectedTape uv n)) = _ + rw [ih.1,ih.2 true,ih.2 false] + simp only [Bool.false_eq_true,↓reduceIte,selectedTape] + split <;> simp_all only [] + rw [p.causal.prefix_succ,p.publicFrom_snoc,hs,ih.1,ih.2 true,ih.2 false] + simp only [Bool.false_eq_true,↓reduceIte] + constructor + · rw [p.tapeProgram.prefix_succ] + congr 1 + unfold LocalTapeProgram.message tapeProgram + split <;> simp_all only [↓reduceIte] + · intro a + rw [p.extractPrivate_snoc,ih.2 a,p.tapeProgram.prefix_succ,p.privatePrefix_snoc] + congr 1 + cases a <;> cases hrole : p.alice n <;> + simp only [Bool.false_eq_true,Bool.true_eq_false,↓reduceIte] + +def outcomeRecord (uv : UniformTape × UniformTape) : ℕ → O := + p.causal.record (p.selectedTape uv) + +lemma measurable_outcomeRecord : Measurable p.outcomeRecord := + p.causal.measurable_record.comp p.measurable_selectedTape + +lemma outcomeRecord_law (κ : (n : ℕ) → Kernel (Fin n → O) O) + [∀ n, IsMarkovKernel (κ n)] + (hlaw : ∀ n s, volume.map (fun u => p.causal.step n (s,u)) = κ n s) + (P : Measure (ℕ → O)) [IsProbabilityMeasure P] + (hP : ∀ n, P.map (fun x => fun i : Fin (n+1) => x i) = + ((P.map (fun x => fun i : Fin n => x i)) ⊗ₘ κ n).map + (fun pair : (Fin n → O) × O => Fin.snoc (α := fun _ : Fin (n+1) => O) pair.1 pair.2)) : + (uniformTapeLaw.prod uniformTapeLaw).map p.outcomeRecord = P := by + rw [p.causal.record_law_unique κ hlaw P hP] + change (uniformTapeLaw.prod uniformTapeLaw).map (p.causal.record ∘ p.selectedTape) = _ + rw [← Measure.map_map p.causal.measurable_record p.measurable_selectedTape] + congr 1 + exact selected_tapes_law p.alice + +def publicRecord (x : ℕ → O) (n : ℕ) : M := + p.publicFrom (n+1) (fun i => x i) (Fin.last n) + +def localRecord (a : Bool) (x : ℕ → O) (n : ℕ) : O ⊕ Unit := + if p.alice n = a then Sum.inl (x n) else Sum.inr () + +lemma measurable_publicRecord : Measurable p.publicRecord := by + apply Measurable.of_eval + intro n + exact ((p.measurable_publicFrom (n+1)).comp (by fun_prop)).eval (a := Fin.last n) + +lemma measurable_localRecord (a : Bool) : Measurable (p.localRecord a) := by + apply Measurable.of_eval + intro n + unfold localRecord + split + · exact measurable_inl.comp (measurable_pi_apply n) + · exact measurable_const + +lemma publicRecord_replay (uv : UniformTape × UniformTape) : + p.publicRecord (p.outcomeRecord uv) = p.tapeProgram.record uv := by + funext n + have h := congrFun (p.replay_matches (n+1) uv).1 (Fin.last n) + have he : (fun i : Fin (n+1) => p.outcomeRecord uv i) = + p.causal.history (n+1) (p.selectedTape uv) := by + funext i + exact (p.causal.prefix_eq_record (n+1) (p.selectedTape uv) i).symm + change p.publicFrom (n+1) (fun i => p.outcomeRecord uv i) (Fin.last n) = _ + rw [he,h,p.tapeProgram.prefix_eq_record] + rfl + +lemma localRecord_replay (a : Bool) (uv : UniformTape × UniformTape) : + p.localRecord a (p.outcomeRecord uv) = + p.privateRecord a ((if a then uv.1 else uv.2),p.tapeProgram.record uv) := by + funext n + have h := congrFun ((p.replay_matches (n+1) uv).2 a) (Fin.last n) + rw [p.causal.prefix_succ,p.extractPrivate_snoc,p.tapeProgram.prefix_succ, + p.privatePrefix_snoc] at h + simp only [Fin.snoc_last] at h + have he : p.tapeProgram.publicPrefix n uv = fun i : Fin n => p.tapeProgram.record uv i := by + funext i; exact p.tapeProgram.prefix_eq_record n uv i + rw [he] at h + exact h + +universe v4239_0 v4239_1 + +theorem full_readout_law {A : Type v4239_0} {B : Type v4239_1} [MeasurableSpace A] [MeasurableSpace B] + (κ : (n : ℕ) → Kernel (Fin n → O) O) [∀ n, IsMarkovKernel (κ n)] + (hlaw : ∀ n s, volume.map (fun u => p.causal.step n (s,u)) = κ n s) + (P : Measure (ℕ → O)) [IsProbabilityMeasure P] + (hP : ∀ n, P.map (fun x => fun i : Fin (n+1) => x i) = + ((P.map (fun x => fun i : Fin n => x i)) ⊗ₘ κ n).map + (fun pair : (Fin n → O) × O => Fin.snoc (α := fun _ : Fin (n+1) => O) pair.1 pair.2)) + (readA : (ℕ → (O ⊕ Unit)) × (ℕ → M) → A) + (readB : (ℕ → (O ⊕ Unit)) × (ℕ → M) → B) + (ha : Measurable readA) (hb : Measurable readB) : + P.map (fun x => (p.publicRecord x, + readA (p.localRecord true x,p.publicRecord x), + readB (p.localRecord false x,p.publicRecord x))) = + (uniformTapeLaw.prod uniformTapeLaw).map (fun uv => (p.tapeProgram.record uv, + readA (p.privateRecord true (uv.1,p.tapeProgram.record uv),p.tapeProgram.record uv), + readB (p.privateRecord false (uv.2,p.tapeProgram.record uv),p.tapeProgram.record uv))) := by + rw [← p.outcomeRecord_law κ hlaw P hP] + have hm : Measurable (fun x => (p.publicRecord x, + readA (p.localRecord true x,p.publicRecord x), + readB (p.localRecord false x,p.publicRecord x))) := by + exact p.measurable_publicRecord.prodMk + ((ha.comp ((p.measurable_localRecord true).prodMk p.measurable_publicRecord)).prodMk + (hb.comp ((p.measurable_localRecord false).prodMk p.measurable_publicRecord))) + rw [Measure.map_map hm p.measurable_outcomeRecord] + congr 1 + funext uv + simp only [Function.comp_def,p.publicRecord_replay,p.localRecord_replay, + Bool.false_eq_true,↓reduceIte] + +end LocalOutcomeSampler + +end ZeroKey + +end + +end OAI diff --git a/lean/OAI/InformationTheory/SoftChannel/Canonical.lean b/lean/OAI/InformationTheory/SoftChannel/Canonical.lean new file mode 100644 index 0000000000000000000000000000000000000000..3a3a1c546acca67136ce22a0768c4172b5c4fadd --- /dev/null +++ b/lean/OAI/InformationTheory/SoftChannel/Canonical.lean @@ -0,0 +1,688 @@ +import OAI.InformationTheory.BooleanNoise.EntropyScalars +import OAI.InformationTheory.BooleanNoise.FiniteNoise +import OAI.InformationTheory.SoftChannel.Model + +namespace OAI + +section + +noncomputable section +open Set Filter +open scoped Topology +namespace LeanBlast.CourtadeKumar + +def bose (z : ℝ) : ℝ := (Real.exp z - 1)⁻¹ + +def canonicalQ (z : ℝ) : ℝ := z * bose z - Real.log (1 - Real.exp (-z)) + +def normalizedEntropy (z w : ℝ) : ℝ := + let u := bose z + let v := bose w + let n := 1 + u + v + n * Real.log n - ((u + 1) * Real.log (u + 1) + u * Real.log u + + (v + 1) * Real.log (v + 1) + v * Real.log v) / 2 + +lemma bose_pos {z : ℝ} (hz : 0 < z) : 0 < bose z := by + exact inv_pos.mpr (sub_pos.mpr (Real.one_lt_exp_iff.mpr hz)) + +lemma exp_neg_lt_one {z : ℝ} (hz : 0 < z) : Real.exp (-z) < 1 := + Real.exp_lt_one_iff.mpr (neg_neg_iff_pos.mpr hz) + +lemma bose_eq_exp_neg {z : ℝ} (hz : 0 < z) : + bose z = Real.exp (-z) / (1 - Real.exp (-z)) := by + have he := (Real.one_lt_exp_iff.mpr hz : 1 < Real.exp z) + rw [Real.exp_neg] + unfold bose + field_simp + +lemma hasDerivAt_bose {z : ℝ} (hz : 0 < z) : + HasDerivAt bose (-(bose z * (bose z + 1))) z := by + have he : Real.exp z - 1 ≠ 0 := ne_of_gt (sub_pos.mpr (Real.one_lt_exp_iff.mpr hz)) + convert! (((Real.hasDerivAt_exp z).sub_const 1).inv he) using 1 + unfold bose + field_simp + ring + +lemma hasDerivAt_canonicalQ {z : ℝ} (hz : 0 < z) : + HasDerivAt canonicalQ (-z * bose z * (bose z + 1)) z := by + have hneg : HasDerivAt (fun t : ℝ => Real.exp (-t)) (-Real.exp (-z)) z := by + convert! (Real.hasDerivAt_exp (-z)).comp z (hasDerivAt_id z).neg using 1; ring + have hd := ((hasDerivAt_id z).mul (hasDerivAt_bose hz)).sub + ((hneg.const_sub 1).log (ne_of_gt (sub_pos.mpr (exp_neg_lt_one hz)))) + convert! hd using 1 + simp only [id_eq, neg_neg] + rw [bose_eq_exp_neg hz] + ring + +lemma hasDerivAt_canonicalQ_deriv {z : ℝ} (hz : 0 < z) : + HasDerivAt (fun t => -t * bose t * (bose t + 1)) + (bose z * (bose z + 1) * (z * (2 * bose z + 1) - 1)) z := by + convert! (((hasDerivAt_id z).neg.mul (hasDerivAt_bose hz)).mul + ((hasDerivAt_bose hz).add_const 1)) using 1 + simp only [Pi.mul_apply, Pi.neg_apply, id_eq] + ring + +lemma canonicalQ_second_pos {z : ℝ} (hz : 0 < z) : + 0 < bose z * (bose z + 1) * (z * (2 * bose z + 1) - 1) := by + have hb := bose_pos hz + apply mul_pos (mul_pos hb (by linarith)) + have hexp : 1 - z < Real.exp (-z) := by + have h := Real.add_one_lt_exp (neg_ne_zero.mpr hz.ne') + linarith + have he : 0 < 1 - Real.exp (-z) := sub_pos.mpr (exp_neg_lt_one hz) + rw [bose_eq_exp_neg hz] + rw [show z * (2 * (Real.exp (-z) / (1 - Real.exp (-z))) + 1) - 1 = + (z * (1 + Real.exp (-z)) - (1 - Real.exp (-z))) / (1 - Real.exp (-z)) by + field_simp; ring] + apply div_pos _ he + nlinarith [Real.exp_pos (-z)] + +lemma convexOn_canonicalQ : ConvexOn ℝ (Ioi 0) canonicalQ := by + apply convexOn_of_hasDerivWithinAt2_nonneg (convex_Ioi 0) + (fun z hz => (hasDerivAt_canonicalQ hz).continuousAt.continuousWithinAt) + (f' := fun z => -z * bose z * (bose z + 1)) + (f'' := fun z => bose z * (bose z + 1) * (z * (2 * bose z + 1) - 1)) + · intro z hz + exact (hasDerivAt_canonicalQ (by simpa using hz)).hasDerivWithinAt + · intro z hz + exact (hasDerivAt_canonicalQ_deriv (by simpa using hz)).hasDerivWithinAt + · intro z hz + exact (canonicalQ_second_pos (by simpa using hz)).le + +def canonicalGroup (z w : ℝ) (n : ℕ) : ℝ := + ((∑ j ∈ Finset.range (n + 1), Real.exp (-((n + 1 : ℕ) * z + (j + 1 : ℕ) * w))) + + ∑ i ∈ Finset.range n, Real.exp (-((i + 1 : ℕ) * z + (n + 1 : ℕ) * w))) / + (n + 1 : ℕ) + +lemma exp_pair (z w : ℝ) (i j : ℕ) : + Real.exp (-((i : ℝ) * z + (j : ℝ) * w)) = + Real.exp (-z) ^ i * Real.exp (-w) ^ j := by + rw [show -((i : ℝ) * z + (j : ℝ) * w) = (i : ℝ) * (-z) + (j : ℝ) * (-w) by ring, + Real.exp_add, Real.exp_nat_mul, Real.exp_nat_mul] + +lemma geom_positive_sum {x : ℝ} (hx : x ≠ 1) (n : ℕ) : + ∑ i ∈ Finset.range n, x ^ (i + 1) = x / (1 - x) * (1 - x ^ n) := by + simp_rw [pow_succ] + rw [← Finset.sum_mul, geom_sum_eq hx] + field_simp + ring + +lemma canonicalGroup_eq {z w : ℝ} (hz : 0 < z) (hw : 0 < w) (k : ℕ) : + canonicalGroup z w k = + bose w * (Real.exp (-z) ^ (k + 1) / (k + 1 : ℕ)) + + bose z * (Real.exp (-w) ^ (k + 1) / (k + 1 : ℕ)) - + (1 + bose z + bose w) * ((Real.exp (-z) * Real.exp (-w)) ^ (k + 1) / + (k + 1 : ℕ)) := by + have hz1 := (exp_neg_lt_one hz).ne + have hw1 := (exp_neg_lt_one hw).ne + unfold canonicalGroup + simp_rw [exp_pair, ← Finset.mul_sum, ← Finset.sum_mul] + rw [geom_positive_sum hw1, geom_positive_sum hz1, + bose_eq_exp_neg hz, bose_eq_exp_neg hw] + simp only [mul_pow, pow_succ] + field_simp + ring + +lemma hasSum_canonicalGroup {z w : ℝ} (hz : 0 < z) (hw : 0 < w) : + HasSum (canonicalGroup z w) + ((1 + bose z + bose w) * Real.log (1 - Real.exp (-z) * Real.exp (-w)) - + bose w * Real.log (1 - Real.exp (-z)) - + bose z * Real.log (1 - Real.exp (-w))) := by + have hx : |Real.exp (-z)| < 1 := by rw [abs_of_pos (Real.exp_pos _)]; exact exp_neg_lt_one hz + have hy : |Real.exp (-w)| < 1 := by rw [abs_of_pos (Real.exp_pos _)]; exact exp_neg_lt_one hw + have hxy : |Real.exp (-z) * Real.exp (-w)| < 1 := by + rw [abs_mul] + nlinarith [abs_nonneg (Real.exp (-z)), abs_nonneg (Real.exp (-w))] + convert! (((Real.hasSum_pow_div_log_of_abs_lt_one hx).mul_left (bose w)).add + ((Real.hasSum_pow_div_log_of_abs_lt_one hy).mul_left (bose z))).sub + ((Real.hasSum_pow_div_log_of_abs_lt_one hxy).mul_left (1 + bose z + bose w)) using 1 + · ext k + simpa only [Nat.cast_add, Nat.cast_one] using canonicalGroup_eq hz hw k + · ring + +lemma log_bose {z : ℝ} (hz : 0 < z) : + Real.log (bose z) = -z - Real.log (1 - Real.exp (-z)) := by + rw [bose_eq_exp_neg hz, Real.log_div (Real.exp_ne_zero _) + (ne_of_gt (sub_pos.mpr (exp_neg_lt_one hz))), Real.log_exp] + +lemma log_bose_add_one {z : ℝ} (hz : 0 < z) : + Real.log (bose z + 1) = -Real.log (1 - Real.exp (-z)) := by + rw [bose_eq_exp_neg hz] + have he := (sub_pos.mpr (exp_neg_lt_one hz)).ne' + rw [show Real.exp (-z) / (1 - Real.exp (-z)) + 1 = + (1 - Real.exp (-z))⁻¹ by field_simp; ring, Real.log_inv] + +lemma log_one_add_bose_add_bose {z w : ℝ} (hz : 0 < z) (hw : 0 < w) : + Real.log (1 + bose z + bose w) = + Real.log (1 - Real.exp (-z) * Real.exp (-w)) - + Real.log (1 - Real.exp (-z)) - Real.log (1 - Real.exp (-w)) := by + have hx := (sub_pos.mpr (exp_neg_lt_one hz)).ne' + have hy := (sub_pos.mpr (exp_neg_lt_one hw)).ne' + have hxy : 0 < 1 - Real.exp (-z) * Real.exp (-w) := by + have hz1 := exp_neg_lt_one hz + have hw1 := exp_neg_lt_one hw + nlinarith [Real.exp_pos (-z), Real.exp_pos (-w)] + rw [bose_eq_exp_neg hz, bose_eq_exp_neg hw] + rw [show 1 + Real.exp (-z) / (1 - Real.exp (-z)) + + Real.exp (-w) / (1 - Real.exp (-w)) = + (1 - Real.exp (-z) * Real.exp (-w)) / ((1 - Real.exp (-z)) * (1 - Real.exp (-w))) by + field_simp; ring] + rw [Real.log_div hxy.ne' (mul_ne_zero hx hy), Real.log_mul hx hy] + ring + +lemma normalizedEntropy_series_identity {z w : ℝ} (hz : 0 < z) (hw : 0 < w) : + normalizedEntropy z w = (canonicalQ z + canonicalQ w) / 2 + + ((1 + bose z + bose w) * Real.log (1 - Real.exp (-z) * Real.exp (-w)) - + bose w * Real.log (1 - Real.exp (-z)) - + bose z * Real.log (1 - Real.exp (-w))) := by + unfold normalizedEntropy canonicalQ + dsimp only + rw [log_bose hz, log_bose hw, log_bose_add_one hz, log_bose_add_one hw, + log_one_add_bose_add_bose hz hw] + ring + +lemma hasSum_normalizedEntropy {z w : ℝ} (hz : 0 < z) (hw : 0 < w) : + HasSum (canonicalGroup z w) + (normalizedEntropy z w - (canonicalQ z + canonicalQ w) / 2) := by + rw [normalizedEntropy_series_identity hz hw] + convert! hasSum_canonicalGroup hz hw using 1; ring + +lemma canonicalExp_jensen (z₁ w₁ z₂ w₂ i j : ℝ) {a b : ℝ} + (ha : 0 ≤ a) (hb : 0 ≤ b) (hab : a + b = 1) : + Real.exp (-(i * (a * z₁ + b * z₂) + j * (a * w₁ + b * w₂))) ≤ + a * Real.exp (-(i * z₁ + j * w₁)) + b * Real.exp (-(i * z₂ + j * w₂)) := by + convert! convexOn_exp.2 (mem_univ (-(i*z₁+j*w₁))) + (mem_univ (-(i*z₂+j*w₂))) ha hb hab using 1; + simp only [smul_eq_mul]; congr 1; ring + +lemma canonicalGroup_jensen (z₁ w₁ z₂ w₂ : ℝ) {a b : ℝ} + (ha : 0 ≤ a) (hb : 0 ≤ b) (hab : a + b = 1) (n : ℕ) : + canonicalGroup (a*z₁+b*z₂) (a*w₁+b*w₂) n ≤ + a * canonicalGroup z₁ w₁ n + b * canonicalGroup z₂ w₂ n := by + unfold canonicalGroup + have h₁ := Finset.sum_le_sum (s := Finset.range (n+1)) (fun j _ => + canonicalExp_jensen z₁ w₁ z₂ w₂ (n+1 : ℕ) (j+1 : ℕ) ha hb hab) + have h₂ := Finset.sum_le_sum (s := Finset.range n) (fun i _ => + canonicalExp_jensen z₁ w₁ z₂ w₂ (i+1 : ℕ) (n+1 : ℕ) ha hb hab) + have h := div_le_div_of_nonneg_right (add_le_add h₁ h₂) + (show (0 : ℝ) ≤ (n+1 : ℕ) by positivity) + simp only [Finset.sum_add_distrib, ← Finset.mul_sum] at h + convert! h using 1; ring + +lemma normalizedEntropy_jensen {z₁ w₁ z₂ w₂ a b : ℝ} + (hz₁ : 0 < z₁) (hw₁ : 0 < w₁) (hz₂ : 0 < z₂) (hw₂ : 0 < w₂) + (ha : 0 ≤ a) (hb : 0 ≤ b) (hab : a + b = 1) : + normalizedEntropy (a*z₁+b*z₂) (a*w₁+b*w₂) ≤ + a * normalizedEntropy z₁ w₁ + b * normalizedEntropy z₂ w₂ := by + have hz : 0 < a*z₁+b*z₂ := by + simpa only [mem_Ioi, smul_eq_mul] using (convex_Ioi (0 : ℝ)) hz₁ hz₂ ha hb hab + have hw : 0 < a*w₁+b*w₂ := by + simpa only [mem_Ioi, smul_eq_mul] using (convex_Ioi (0 : ℝ)) hw₁ hw₂ ha hb hab + have hseries := hasSum_le (canonicalGroup_jensen z₁ w₁ z₂ w₂ ha hb hab) + (hasSum_normalizedEntropy hz hw) + (((hasSum_normalizedEntropy hz₁ hw₁).mul_left a).add + ((hasSum_normalizedEntropy hz₂ hw₂).mul_left b)) + have hqz := convexOn_canonicalQ.2 hz₁ hz₂ ha hb hab + have hqw := convexOn_canonicalQ.2 hw₁ hw₂ ha hb hab + simp only [smul_eq_mul] at hqz hqw + linarith + +def normalizedEntropyDz (z w : ℝ) : ℝ := + -bose z * (bose z + 1) * (Real.log (1 + bose z + bose w) - + (Real.log (bose z + 1) + Real.log (bose z)) / 2) + +lemma normalizedEntropy_symm (z w : ℝ) : normalizedEntropy z w = normalizedEntropy w z := by + unfold normalizedEntropy + dsimp only + rw [show 1 + bose w + bose z = 1 + bose z + bose w by ring] + ring + +lemma normalizedEntropyDz_neg {z w : ℝ} (hz : 0 < z) (hw : 0 < w) : + normalizedEntropyDz z w < 0 := by + have hu := bose_pos hz + have hv := bose_pos hw + have h₁ := Real.log_lt_log (by linarith : 0 < bose z + 1) + (show bose z + 1 < 1 + bose z + bose w by linarith) + have h₂ := Real.log_lt_log hu (show bose z < 1 + bose z + bose w by linarith) + unfold normalizedEntropyDz + exact mul_neg_of_neg_of_pos (mul_neg_of_neg_of_pos (neg_neg_of_pos hu) (by linarith)) + (by linarith) + +lemma hasDerivAt_normalizedEntropy_comp {z w : ℝ → ℝ} {t z' w' : ℝ} + (hzD : HasDerivAt z z' t) (hwD : HasDerivAt w w' t) + (hz : 0 < z t) (hw : 0 < w t) : + HasDerivAt (fun s => normalizedEntropy (z s) (w s)) + (normalizedEntropyDz (z t) (w t) * z' + normalizedEntropyDz (w t) (z t) * w') t := by + have hu := bose_pos hz + have hv := bose_pos hw + have huD := (hasDerivAt_bose hz).comp t hzD + have hvD := (hasDerivAt_bose hw).comp t hwD + have hnD := (huD.const_add 1).add hvD + have h₁ := (Real.hasDerivAt_mul_log (by linarith : 1 + bose (z t) + bose (w t) ≠ 0)).comp t hnD + have h₂ := (Real.hasDerivAt_mul_log (by linarith : bose (z t) + 1 ≠ 0)).comp t (huD.add_const 1) + have h₃ := (Real.hasDerivAt_mul_log hu.ne').comp t huD + have h₄ := (Real.hasDerivAt_mul_log (by linarith : bose (w t) + 1 ≠ 0)).comp t (hvD.add_const 1) + have h₅ := (Real.hasDerivAt_mul_log hv.ne').comp t hvD + convert! h₁.sub ((((h₂.add h₃).add h₄).add h₅).div_const 2) using 1 + unfold normalizedEntropyDz + rw [show 1 + bose (w t) + bose (z t) = 1 + bose (z t) + bose (w t) by ring] + ring + +lemma positive_line {x y t : ℝ} (hx : 0 < x) (hy : 0 < y) (ht : t ∈ Icc 0 1) : + 0 < x + t * (y - x) := by + have h := (convex_Ioi (0 : ℝ)) hx hy (sub_nonneg.mpr ht.2) ht.1 (by ring : 1-t+t=1) + simp only [smul_eq_mul, mem_Ioi] at h + nlinarith + +lemma normalizedEntropy_tangent {z w Z W : ℝ} + (hz : 0 < z) (hw : 0 < w) (hZ : 0 < Z) (hW : 0 < W) : + normalizedEntropy z w + normalizedEntropyDz z w * (Z-z) + + normalizedEntropyDz w z * (W-w) ≤ normalizedEntropy Z W := by + let f : ℝ → ℝ := fun t => normalizedEntropy (z+t*(Z-z)) (w+t*(W-w)) + have hc : ConvexOn ℝ (Icc 0 1) f := by + refine ⟨convex_Icc _ _, ?_⟩ + intro x hx y hy a b ha hb hab + have h := normalizedEntropy_jensen (positive_line hz hZ hx) (positive_line hw hW hx) + (positive_line hz hZ hy) (positive_line hw hW hy) ha hb hab + convert! h using 1; simp only [f, smul_eq_mul] + congr 1 <;> nlinarith [congrArg (fun q : ℝ => q*z) hab, congrArg (fun q : ℝ => q*w) hab] + have hd : HasDerivAt f (normalizedEntropyDz z w * (Z-z) + + normalizedEntropyDz w z * (W-w)) 0 := by + convert! hasDerivAt_normalizedEntropy_comp + (((hasDerivAt_id (0 : ℝ)).mul_const (Z-z)).const_add z) + (((hasDerivAt_id (0 : ℝ)).mul_const (W-w)).const_add w) + (by simpa using hz) (by simpa using hw) using 1; simp + have h := hc.le_slope_of_hasDerivAt (y := 1) (by norm_num) (by norm_num) (by norm_num) hd + simp only [slope_def_field, f, zero_mul, add_zero, one_mul, sub_zero, div_one] at h + rw [show z+(Z-z)=Z by ring, show w+(W-w)=W by ring] at h + linarith + +lemma normalizedEntropyDz_order {z w : ℝ} (hz : 0 < z) (hw : 0 < w) (hzw : z ≤ w) : + normalizedEntropyDz z w ≤ normalizedEntropyDz w z := by + rcases hzw.eq_or_lt with rfl | hzw + · rfl + · have ht := normalizedEntropy_tangent hz hw hw hz + rw [normalizedEntropy_symm w z] at ht + nlinarith + +lemma hasDerivAt_bose_deriv {z : ℝ} (hz : 0 < z) : + HasDerivAt (fun t => -(bose t * (bose t + 1))) + (bose z * (bose z + 1) * (2 * bose z + 1)) z := by + convert! ((hasDerivAt_bose hz).mul ((hasDerivAt_bose hz).add_const 1)).neg using 1; ring + +lemma convexOn_bose : ConvexOn ℝ (Ioi 0) bose := by + apply convexOn_of_hasDerivWithinAt2_nonneg (convex_Ioi 0) + (fun z hz => (hasDerivAt_bose hz).continuousAt.continuousWithinAt) + (f' := fun z => -(bose z * (bose z + 1))) + (f'' := fun z => bose z * (bose z + 1) * (2 * bose z + 1)) + · intro z hz + exact (hasDerivAt_bose (by simpa using hz)).hasDerivWithinAt + · intro z hz + exact (hasDerivAt_bose_deriv (by simpa using hz)).hasDerivWithinAt + · intro z hz + have hb := bose_pos (show 0 < z by simpa using hz) + positivity + +lemma bose_tangent {z Z : ℝ} (hz : 0 < z) (hZ : 0 < Z) : + bose z - bose z * (bose z + 1) * (Z-z) ≤ bose Z := by + rcases lt_trichotomy z Z with hlt | rfl | hgt + · have h := convexOn_bose.le_slope_of_hasDerivAt hz hZ hlt (hasDerivAt_bose hz) + rw [slope_def_field] at h + have hh := (le_div_iff₀ (sub_pos.mpr hlt)).mp h + nlinarith + · simp + · have h := convexOn_bose.slope_le_of_hasDerivAt hZ hz hgt (hasDerivAt_bose hz) + rw [slope_def_field] at h + have hh := (div_le_iff₀ (sub_pos.mpr hgt)).mp h + nlinarith + +def canonicalPrice (z w : ℝ) : ℝ := -(8 * normalizedEntropyDz z w)⁻¹ + +def canonicalGamma (z w : ℝ) : ℝ := + (1/8 + canonicalPrice z w * normalizedEntropyDz w z) / (2 * bose w * (bose w + 1)) + +lemma canonicalPrice_pos {z w : ℝ} (hz : 0 < z) (hw : 0 < w) : + 0 < canonicalPrice z w := by + unfold canonicalPrice + exact neg_pos.mpr (inv_neg''.mpr (mul_neg_of_pos_of_neg (by norm_num) (normalizedEntropyDz_neg hz hw))) + +lemma canonicalPrice_gradient {z w : ℝ} (hz : 0 < z) (hw : 0 < w) : + 1/8 + canonicalPrice z w * normalizedEntropyDz z w = 0 := by + unfold canonicalPrice + have h := (normalizedEntropyDz_neg hz hw).ne + field_simp + ring + +lemma canonicalGamma_nonneg {z w : ℝ} (hz : 0 < z) (hw : 0 < w) (hzw : z ≤ w) : + 0 ≤ canonicalGamma z w := by + have horder := mul_le_mul_of_nonneg_left (normalizedEntropyDz_order hz hw hzw) + (canonicalPrice_pos hz hw).le + have hzero := canonicalPrice_gradient hz hw + unfold canonicalGamma + apply div_nonneg (by linarith) + have h := bose_pos hw + positivity + +lemma canonicalGamma_gradient {z w : ℝ} (_hz : 0 < z) (hw : 0 < w) : + 1/8 + canonicalPrice z w * normalizedEntropyDz w z = + 2 * canonicalGamma z w * bose w * (bose w + 1) := by + unfold canonicalGamma + have h := (bose_pos hw).ne' + have h₁ : bose w + 1 ≠ 0 := by linarith [bose_pos hw] + field_simp + +lemma canonicalGamma_self {z : ℝ} (hz : 0 < z) : canonicalGamma z z = 0 := by + unfold canonicalGamma + rw [canonicalPrice_gradient hz hz, zero_div] + +lemma canonical_support_normalized {z w Z W : ℝ} + (hz : 0 < z) (hw : 0 < w) (hzw : z ≤ w) (hZ : 0 < Z) (hW : 0 < W) : + (z+w)/8 + canonicalPrice z w * normalizedEntropy z w + + canonicalGamma z w * (1 + 2*bose w) ≤ + (Z+W)/8 + canonicalPrice z w * normalizedEntropy Z W + + canonicalGamma z w * (1 + 2*bose W) := by + have h₁ := mul_le_mul_of_nonneg_left (normalizedEntropy_tangent hz hw hZ hW) + (canonicalPrice_pos hz hw).le + have h₂ := mul_le_mul_of_nonneg_left (bose_tangent hw hW) + (mul_nonneg (by norm_num : (0:ℝ) ≤ 2) (canonicalGamma_nonneg hz hw hzw)) + have hzG := canonicalPrice_gradient hz hw + have hwG := canonicalGamma_gradient hz hw + nlinarith [congrArg (fun q : ℝ => q * (Z-z)) hzG, + congrArg (fun q : ℝ => q * (W-w)) hwG] + +lemma entropy_degree {s t : ℝ} (hs : 0 < s) (ht : 0 < t) : + (s+t) * entropy ((s-t)/(s+t)) = + (s+t)*Real.log (s+t) - s*Real.log s - t*Real.log t := by + have hst : s+t ≠ 0 := ne_of_gt (add_pos hs ht) + rw [entropy_eq_binEntropy] + rw [show (1+(s-t)/(s+t))/2 = s/(s+t) by field_simp; ring] + unfold Real.binEntropy + rw [show 1-s/(s+t)=t/(s+t) by field_simp; ring] + rw [Real.log_inv, Real.log_inv, Real.log_div hs.ne' hst, Real.log_div ht.ne' hst] + field_simp + ring + +def joiningZ (x y : ℝ) : ℝ := Real.log ((1+x)/(1+y)) +def joiningW (x y : ℝ) : ℝ := Real.log ((1-y)/(1-x)) +def joiningCost (x y : ℝ) : ℝ := (x-y)/4 * (Real.artanh x - Real.artanh y) + +lemma joiningZ_pos {x y : ℝ} (hy : -1 < y) (hxy : y < x) : 0 < joiningZ x y := by + apply Real.log_pos + apply (lt_div_iff₀ (by linarith : 0 < 1+y)).mpr + linarith + +lemma joiningW_pos {x y : ℝ} (hx : x < 1) (hxy : y < x) : 0 < joiningW x y := by + apply Real.log_pos + apply (lt_div_iff₀ (by linarith : 0 < 1-x)).mpr + linarith + +lemma bose_joiningZ {x y : ℝ} (hy : -1 < y) (hxy : y < x) : + bose (joiningZ x y) = (1+y)/(x-y) := by + have hp : 0 < (1+x)/(1+y) := div_pos (by linarith) (by linarith) + unfold bose joiningZ + rw [Real.exp_log hp] + have hd : 1+y ≠ 0 := by linarith + rw [show (1+x)/(1+y)-1=(x-y)/(1+y) by field_simp; ring, inv_div] + +lemma bose_joiningW {x y : ℝ} (hx : x < 1) (hxy : y < x) : + bose (joiningW x y) = (1-x)/(x-y) := by + have hp : 0 < (1-y)/(1-x) := div_pos (by linarith) (by linarith) + unfold bose joiningW + rw [Real.exp_log hp] + have hd : 1-x ≠ 0 := by linarith + rw [show (1-y)/(1-x)-1=(x-y)/(1-x) by field_simp; ring, inv_div] + +lemma joining_order {x y : ℝ} (hx : x ∈ Ioo (-1) 1) (hy : y ∈ Ioo (-1) 1) + (hxy : y < x) (hm : 0 ≤ x+y) : joiningZ x y ≤ joiningW x y := by + apply Real.log_le_log (div_pos (by linarith [hx.1]) (by linarith [hy.1])) + apply (div_le_div_iff₀ (by linarith [hy.1] : 0 < 1+y) (by linarith [hx.2] : 0 < 1-x)).mpr + nlinarith [mul_nonneg (sub_nonneg.mpr hxy.le) hm] + +lemma normalizedEntropy_actual {x y : ℝ} (hx : x ∈ Ioo (-1) 1) (hy : y ∈ Ioo (-1) 1) + (hxy : y < x) : + normalizedEntropy (joiningZ x y) (joiningW x y) = (entropy x + entropy y)/(x-y) := by + let u := bose (joiningZ x y) + let v := bose (joiningW x y) + have hu : 0 < u := bose_pos (joiningZ_pos hy.1 hxy) + have hv : 0 < v := bose_pos (joiningW_pos hx.2 hxy) + have hU : u = (1+y)/(x-y) := bose_joiningZ hy.1 hxy + have hV : v = (1-x)/(x-y) := bose_joiningW hx.2 hxy + have hd : x-y ≠ 0 := ne_of_gt (sub_pos.mpr hxy) + have hn : 1+u+v = 2/(x-y) := by rw [hU, hV]; field_simp; ring + have hn' : 1+u+v ≠ 0 := by linarith + have hX : (u+1-v)/(u+1+v) = x := by + rw [hU, hV] + field_simp + ring + have hY : (u-(v+1))/(u+(v+1)) = y := by + rw [hU, hV] + field_simp + ring + have h₁ := entropy_degree (s := u+1) (t := v) (by linarith) hv + have h₂ := entropy_degree (s := u) (t := v+1) hu (by linarith) + rw [hX, show u+1+v=1+u+v by ring] at h₁ + rw [hY, show u+(v+1)=1+u+v by ring] at h₂ + change (1+u+v)*Real.log (1+u+v) - + ((u+1)*Real.log (u+1)+u*Real.log u+(v+1)*Real.log (v+1)+v*Real.log v)/2 = _ + calc + _ = (1+u+v)*(entropy x+entropy y)/2 := by nlinarith [h₁,h₂] + _ = _ := by rw [hn]; field_simp + +lemma joiningCost_coordinates {x y : ℝ} (hx : x ∈ Ioo (-1) 1) (hy : y ∈ Ioo (-1) 1) : + joiningCost x y = (x-y)*(joiningZ x y + joiningW x y)/8 := by + unfold joiningCost joiningZ joiningW + rw [artanh_eq_log_sub hx, artanh_eq_log_sub hy, + Real.log_div (by linarith [hx.1]) (by linarith [hy.1]), + Real.log_div (by linarith [hy.2]) (by linarith [hx.2])] + ring + +lemma joiningCost_nonneg {x y : ℝ} (hx : x ∈ Ioo (-1) 1) (hy : y ∈ Ioo (-1) 1) : + 0 ≤ joiningCost x y := by + unfold joiningCost + rcases le_total y x with h | h + · apply mul_nonneg (div_nonneg (sub_nonneg.mpr h) (by norm_num)) + exact sub_nonneg.mpr (Real.strictMonoOn_artanh.monotoneOn hy hx h) + · apply mul_nonneg_of_nonpos_of_nonpos (div_nonpos_of_nonpos_of_nonneg (sub_nonpos.mpr h) (by norm_num)) + exact sub_nonpos.mpr (Real.strictMonoOn_artanh.monotoneOn hx hy h) + +def coreKappa (z w : ℝ) : ℝ := + (z+w)/8 + canonicalPrice z w * normalizedEntropy z w + canonicalGamma z w * (1+2*bose w) + +lemma normalizedEntropy_nonneg {z w : ℝ} (hz : 0 < z) (hw : 0 < w) : + 0 ≤ normalizedEntropy z w := by + have hgroups : 0 ≤ normalizedEntropy z w - (canonicalQ z + canonicalQ w)/2 := by + apply hasSum_le (g := canonicalGroup z w) _ hasSum_zero (hasSum_normalizedEntropy hz hw) + intro n + unfold canonicalGroup + positivity + have hq (t : ℝ) (ht : 0 < t) : 0 ≤ canonicalQ t := by + unfold canonicalQ + have hlog : Real.log (1-Real.exp (-t)) ≤ 0 := + Real.log_nonpos (by linarith [exp_neg_lt_one ht]) (by linarith [Real.exp_pos (-t)]) + nlinarith [bose_pos ht] + linarith [hq z hz, hq w hw] + +lemma coreKappa_pos {z w : ℝ} (hz : 0 < z) (hw : 0 < w) (hzw : z ≤ w) : + 0 < coreKappa z w := by + have h₁ := mul_nonneg (canonicalPrice_pos hz hw).le (normalizedEntropy_nonneg hz hw) + have h₂ := mul_nonneg (canonicalGamma_nonneg hz hw hzw) (by linarith [bose_pos hw] : 0 ≤ 1+2*bose w) + unfold coreKappa + linarith + +lemma canonical_support {z w A B : ℝ} (hz : 0 < z) (hw : 0 < w) (hzw : z ≤ w) + (hA : A ∈ Ioo (-1) 1) (hB : B ∈ Ioo (-1) 1) : + coreKappa z w * (A-B) ≤ joiningCost A B + + canonicalPrice z w * (entropy A + entropy B) + canonicalGamma z w * (2-A-B) := by + by_cases hAB : B < A + · have h := canonical_support_normalized hz hw hzw (joiningZ_pos hB.1 hAB) (joiningW_pos hA.2 hAB) + have hh := mul_le_mul_of_nonneg_right h (sub_nonneg.mpr hAB.le) + rw [normalizedEntropy_actual hA hB hAB, bose_joiningW hA.2 hAB] at hh + change coreKappa z w * (A-B) ≤ _ at hh + rw [joiningCost_coordinates hA hB] + convert! hh using 1 + have hd : A-B ≠ 0 := ne_of_gt (sub_pos.mpr hAB) + field_simp + ring + · have hleft := mul_nonpos_of_nonneg_of_nonpos (coreKappa_pos hz hw hzw).le + (sub_nonpos.mpr (le_of_not_gt hAB)) + have hcost := joiningCost_nonneg hA hB + have hent := mul_nonneg (canonicalPrice_pos hz hw).le + (add_nonneg (entropy_nonneg ⟨hA.1.le,hA.2.le⟩) (entropy_nonneg ⟨hB.1.le,hB.2.le⟩)) + have hcorner := mul_nonneg (canonicalGamma_nonneg hz hw hzw) + (show 0 ≤ 2-A-B by linarith [hA.2,hB.2]) + linarith + +lemma canonical_core_contact {x y : ℝ} (hx : x ∈ Ioo (-1) 1) (hy : y ∈ Ioo (-1) 1) + (hxy : y < x) : + coreKappa (joiningZ x y) (joiningW x y) * (x-y) = joiningCost x y + + canonicalPrice (joiningZ x y) (joiningW x y) * (entropy x+entropy y) + + canonicalGamma (joiningZ x y) (joiningW x y) * (2-x-y) := by + unfold coreKappa + rw [normalizedEntropy_actual hx hy hxy, bose_joiningW hx.2 hxy, joiningCost_coordinates hx hy] + have hd : x-y ≠ 0 := ne_of_gt (sub_pos.mpr hxy) + field_simp + ring + +lemma averaged_canonical_support {n : ℕ} (A B : Cube n → ℝ) + (hA : IsInterior A) (hB : IsInterior B) {z w : ℝ} + (hz : 0 < z) (hw : 0 < w) (hzw : z ≤ w) : + coreKappa z w * (cubeAverage A-cubeAverage B) ≤ + cubeAverage (fun t => joiningCost (A t) (B t)) + + canonicalPrice z w * (entropyAverage A+entropyAverage B) + + canonicalGamma z w * (2-cubeAverage A-cubeAverage B) := by + have h := cubeAverage_mono (fun t => canonical_support hz hw hzw (hA t) (hB t)) + simpa only [cubeAverage_add, cubeAverage_sub, cubeAverage_smul, cubeAverage_const, + entropyAverage] using h + +lemma canonical_core_lower {n : ℕ} (A B : Cube n → ℝ) + (hA : IsInterior A) (hB : IsInterior B) {x y k : ℝ} + (hx : x ∈ Ioo (-1) 1) (hy : y ∈ Ioo (-1) 1) (hxy : y < x) (hm : 0 ≤ x+y) + (hd : cubeAverage A-cubeAverage B = k*(x-y)) + (he : entropyAverage A+entropyAverage B = k*(entropy x+entropy y)) + (hc : canonicalGamma (joiningZ x y) (joiningW x y) * + (2-cubeAverage A-cubeAverage B) = + k*canonicalGamma (joiningZ x y) (joiningW x y)*(2-x-y)) : + k * joiningCost x y ≤ cubeAverage (fun t => joiningCost (A t) (B t)) := by + have h := averaged_canonical_support A B hA hB (joiningZ_pos hy.1 hxy) (joiningW_pos hx.2 hxy) + (joining_order hx hy hxy hm) + rw [hd, he, hc] at h + have heq := congrArg (fun q : ℝ => k*q) (canonical_core_contact hx hy hxy) + nlinarith + +def onecornerX (m d k : ℝ) : ℝ := 1-(1-m-d)/k +def onecornerY (m d k : ℝ) : ℝ := 1-(1-m+d)/k +def onecornerEntropy (m d k : ℝ) : ℝ := + k*(entropy (onecornerX m d k)+entropy (onecornerY m d k))/2 + +def reflectedEntropy (d r : ℝ) : ℝ := (d/r)*entropy r + +lemma onecorner_domain {m d k : ℝ} (_hm : 0 ≤ m) (hd : 0 < d) (hmd : m+d < 1) + (hk : k ∈ Icc (1-m) 1) : + onecornerX m d k ∈ Ioo (-1) 1 ∧ onecornerY m d k ∈ Ioo (-1) 1 ∧ + onecornerY m d k < onecornerX m d k ∧ 0 ≤ onecornerX m d k+onecornerY m d k := by + have hk0 : 0 < k := by linarith [hk.1] + have hL : 0 < (1-m-d)/k := div_pos (by linarith) hk0 + have hU : (1-m+d)/k < 2 := (div_lt_iff₀ hk0).mpr (by linarith [hk.1]) + have hXY : (1-m-d)/k < (1-m+d)/k := (div_lt_div_iff_of_pos_right hk0).mpr (by linarith) + have hsum : (1-m-d)/k+(1-m+d)/k ≤ 2 := by + rw [← add_div] + exact (div_le_iff₀ hk0).mpr (by linarith [hk.1]) + unfold onecornerX onecornerY + exact ⟨⟨by linarith,by linarith⟩,⟨by linarith,by linarith⟩,by linarith,by linarith⟩ + +lemma onecorner_means {m d k : ℝ} (hk : k ≠ 0) : + m+d = 1-k+k*onecornerX m d k ∧ m-d = 1-k+k*onecornerY m d k := by + unfold onecornerX onecornerY + constructor <;> field_simp <;> ring + +lemma onecorner_entropy_left {m d : ℝ} (hm : m < 1) : + onecornerEntropy m d (1-m) = (1-m)*entropy (d/(1-m)) := by + have hm0 : 1-m ≠ 0 := by linarith + unfold onecornerEntropy onecornerX onecornerY + rw [show 1-(1-m-d)/(1-m)=d/(1-m) by field_simp; ring, + show 1-(1-m+d)/(1-m)=-(d/(1-m)) by field_simp; ring, entropy_neg] + ring + +lemma onecorner_entropy_right (m d : ℝ) : + onecornerEntropy m d 1 = (entropy (m+d)+entropy (m-d))/2 := by + unfold onecornerEntropy onecornerX onecornerY + ring_nf + +lemma continuousOn_onecornerEntropy {m d : ℝ} (hm : m < 1) : + ContinuousOn (onecornerEntropy m d) (Icc (1-m) 1) := by + intro k hk + have hk0 : k ≠ 0 := by linarith [hk.1] + unfold onecornerEntropy onecornerX onecornerY + have h₁ : ContinuousAt (fun k : ℝ => 1-(1-m-d)/k) k := by fun_prop + have h₂ : ContinuousAt (fun k : ℝ => 1-(1-m+d)/k) k := by fun_prop + exact ((continuousAt_id.mul ((continuous_entropy.continuousAt.comp h₁).add + (continuous_entropy.continuousAt.comp h₂))).div_const 2).continuousWithinAt + +lemma exists_onecorner_entropy {m d e : ℝ} (hm : 0 ≤ m) (hd : 0 < d) (hmd : m+d < 1) + (he0 : (1-m)*entropy (d/(1-m)) ≤ e) + (he1 : e ≤ (entropy (m+d)+entropy (m-d))/2) : + ∃ k ∈ Icc (1-m) 1, onecornerEntropy m d k = e := by + apply intermediate_value_Icc (by linarith : 1-m ≤ 1) (continuousOn_onecornerEntropy (by linarith)) + simpa only [onecorner_entropy_left (by linarith : m<1), onecorner_entropy_right] using ⟨he0,he1⟩ + +lemma exists_reflected_entropy {m d e : ℝ} (_hm : 0 ≤ m) (hd : 0 < d) (hmd : m+d < 1) + (he : 0 < e) (he0 : e ≤ (1-m)*entropy (d/(1-m))) : + ∃ r ∈ Ico (d/(1-m)) 1, reflectedEntropy d r = e := by + have hm0 : 0 < 1-m := by linarith + have hr0 : 0 < d/(1-m) := div_pos hd hm0 + have hr1 : d/(1-m) < 1 := (div_lt_one hm0).mpr (by linarith) + have hc : ContinuousOn (reflectedEntropy d) (Icc (d/(1-m)) 1) := by + intro r hr + have hnr : r ≠ 0 := by linarith [hr.1] + unfold reflectedEntropy + exact ((continuousAt_const.div continuousAt_id hnr).mul continuous_entropy.continuousAt).continuousWithinAt + have hleft : reflectedEntropy d (d/(1-m)) = (1-m)*entropy (d/(1-m)) := by + unfold reflectedEntropy + field_simp + have hright : reflectedEntropy d 1 = 0 := by simp [reflectedEntropy] + obtain ⟨r,hr,hre⟩ := intermediate_value_Icc' hr1.le hc + (show e ∈ Icc (reflectedEntropy d 1) (reflectedEntropy d (d/(1-m))) by + rw [hleft,hright]; exact ⟨he.le,he0⟩) + refine ⟨r,⟨hr.1,lt_of_le_of_ne hr.2 ?_⟩,hre⟩ + intro hrEq + subst r + rw [hright] at hre + linarith + +lemma onecorner_cost_lower {n : ℕ} (A B : Cube n → ℝ) (hA : IsInterior A) (hB : IsInterior B) + {m d k : ℝ} (hm : 0 ≤ m) (hd : 0 < d) (hmd : m+d < 1) (hk : k ∈ Icc (1-m) 1) + (ha : cubeAverage A = m+d) (hb : cubeAverage B = m-d) + (he : (entropyAverage A+entropyAverage B)/2 = onecornerEntropy m d k) : + k*joiningCost (onecornerX m d k) (onecornerY m d k) ≤ + cubeAverage (fun t => joiningCost (A t) (B t)) := by + obtain ⟨hx,hy,hxy,hcenter⟩ := onecorner_domain hm hd hmd hk + have hk0 : k ≠ 0 := by linarith [hk.1] + obtain ⟨hamean,hbmean⟩ := onecorner_means (m := m) (d := d) hk0 + apply canonical_core_lower A B hA hB hx hy hxy hcenter + · rw [ha,hb]; nlinarith + · unfold onecornerEntropy at he; linarith + · rw [ha,hb] + rw [hamean,hbmean] + ring + +lemma reflected_cost_lower {n : ℕ} (A B : Cube n → ℝ) (hA : IsInterior A) (hB : IsInterior B) + {r k : ℝ} (hr : r ∈ Ioo 0 1) + (hd : cubeAverage A-cubeAverage B = 2*k*r) + (he : (entropyAverage A+entropyAverage B)/2 = k*entropy r) : + k*joiningCost r (-r) ≤ cubeAverage (fun t => joiningCost (A t) (B t)) := by + have hx : r ∈ Ioo (-1) 1 := ⟨by linarith [hr.1],hr.2⟩ + have hy : -r ∈ Ioo (-1) 1 := by constructor <;> linarith [hr.1,hr.2] + have hzw : joiningZ r (-r) = joiningW r (-r) := by simp [joiningZ,joiningW,sub_eq_add_neg] + have hc : canonicalGamma (joiningZ r (-r)) (joiningW r (-r)) = 0 := by + rw [← hzw] + exact canonicalGamma_self (joiningZ_pos hy.1 (by linarith [hr.1])) + apply canonical_core_lower A B hA hB hx hy (by linarith [hr.1]) (by linarith) + · rw [hd]; ring + · rw [entropy_neg]; linarith + · rw [hc]; ring + +end LeanBlast.CourtadeKumar +end +end + +end OAI diff --git a/lean/OAI/InformationTheory/SoftChannel/Comparison.lean b/lean/OAI/InformationTheory/SoftChannel/Comparison.lean new file mode 100644 index 0000000000000000000000000000000000000000..74316b7427d2218f9b72ba3192568e702cfaefd4 --- /dev/null +++ b/lean/OAI/InformationTheory/SoftChannel/Comparison.lean @@ -0,0 +1,37 @@ +import OAI.InformationTheory.BooleanNoise.Comparison +import OAI.InformationTheory.SoftChannel.Production + +namespace OAI + +section + +noncomputable section + +open Set Filter MeasureTheory +open scoped Topology BigOperators + +namespace LeanBlast.CourtadeKumar + +theorem Comparison_sq_lt_one_of_mem {u : ℝ} (hu : u ∈ Ioo (-1) 1) : u ^ 2 < 1 := by + have hp : 0 < (1 - u) * (u + 1) := mul_pos (by linarith [hu.2]) (by linarith [hu.1]) + nlinarith + +theorem Comparison_hasDerivAt_artanh_cubic_gap {u : ℝ} (hu : u ∈ Ioo (-1) 1) : + HasDerivAt (fun x : ℝ => Real.artanh x - x - x ^ 3 / 3) + (u ^ 4 / (1 - u ^ 2)) u := by + have hden : 1 - u ^ 2 ≠ 0 := ne_of_gt (sub_pos.mpr (Comparison_sq_lt_one_of_mem hu)) + convert! ((hasDerivAt_artanh hu).sub (hasDerivAt_id u)).sub + (((hasDerivAt_id u).pow 3).div_const 3) using 1 + simp only [id_eq] + field_simp [hden] + ring + +theorem Comparison_exp_neg_log_five : Real.exp (-Real.log 5) = (1 / 5 : ℝ) := by + rw [Real.exp_neg, Real.exp_log (by norm_num)] + norm_num + +end LeanBlast.CourtadeKumar +end +end + +end OAI diff --git a/lean/OAI/InformationTheory/SoftChannel/Contraction.lean b/lean/OAI/InformationTheory/SoftChannel/Contraction.lean new file mode 100644 index 0000000000000000000000000000000000000000..2f14e909da99e203f4eb669ac6641fe3c888abda --- /dev/null +++ b/lean/OAI/InformationTheory/SoftChannel/Contraction.lean @@ -0,0 +1,150 @@ +import OAI.InformationTheory.SoftChannel.Comparison + +namespace OAI + +section + +noncomputable section +open Set Filter +open scoped BigOperators Topology +namespace LeanBlast.CourtadeKumar + +def IsClosedSoft {n : ℕ} (g : Cube n → ℝ) : Prop := ∀ x, g x ∈ Icc (-1) 1 + +lemma closed_information_mem {n : ℕ} (g : Cube n → ℝ) (hg : IsClosedSoft g) : + informationDeficit g ∈ Icc 0 ell := by + constructor + · rw [informationDeficit_eq_average_psi] + exact sub_nonneg.mpr (convexOn_cubeAverage_le psi convexOn_psi g hg) + · have he : 0 ≤ entropyAverage g := cubeAverage_nonneg (fun x => entropy_nonneg (hg x)) + unfold informationDeficit + linarith [entropy_le_ell (cubeAverage g)] + +lemma soft_noise_interior {n : ℕ} (g : Cube n → ℝ) (hg : IsClosedSoft g) + (hl : ∃ x, -1 < g x) (hu : ∃ x, g x < 1) + {ρ : ℝ} (hρ : ρ ∈ Ico 0 1) : IsInterior (noiseOperator ρ g) := by + intro x + constructor + · simpa only [noiseOperator_const] using + noiseOperator_strict_mono hρ.1 hρ.2 (fun y => (hg y).1) hl x + · simpa only [noiseOperator_const] using + noiseOperator_strict_mono hρ.1 hρ.2 (fun y => (hg y).2) hu x + +lemma soft_flow_interior {n : ℕ} (g : Cube n → ℝ) (hg : IsClosedSoft g) + (hl : ∃ x, -1 < g x) (hu : ∃ x, g x < 1) + {t : ℝ} (ht : 0 < t) : IsInterior (noiseFlow g t) := + soft_noise_interior g hg hl hu ⟨(Real.exp_pos _).le,Real.exp_lt_one_iff.mpr (by linarith)⟩ + +lemma soft_model_domain {a t : ℝ} (ha : a ∈ Icc 0 1) (ht : 0 < t) : + Real.exp (-t)*a ∈ Ioo (-1) 1 := by + have he := Real.exp_pos (-t) + have he1 : Real.exp (-t)<1 := Real.exp_lt_one_iff.mpr (by linarith) + constructor + · nlinarith [mul_nonneg he.le ha.1] + · exact (mul_le_of_le_one_right he.le ha.2).trans_lt he1 + +lemma hasDerivAt_soft_model {a t : ℝ} (ha : a ∈ Icc 0 1) (ht : 0 < t) : + HasDerivAt (fun s => psi (Real.exp (-s)*a)) + (-r (psi (Real.exp (-t)*a))) t := by + have hd := soft_model_domain ha ht + have h := (hasDerivAt_psi hd).comp t (((hasDerivAt_id t).neg.exp).mul_const a) + rw [r_psi hd] + convert! h using 1; simp only [Pi.neg_apply, id_eq]; ring + +theorem all_soft_flow_contraction {n : ℕ} (g : Cube n → ℝ) (hg : IsClosedSoft g) + (hl : ∃ x, -1 < g x) (hu : ∃ x, g x < 1) + {t : ℝ} (ht : 0 < t) : + informationDeficit (noiseFlow g t) ≤ psi (Real.exp (-t)*psiInv (informationDeficit g)) := by + have hI := closed_information_mem g hg + have ha := psiInv_mem_Icc hI + have hderiv : ∀ s, 0 < s → psi (Real.exp (-s)*psiInv (informationDeficit g)) ≤ + informationDeficit (noiseFlow g s) → + -dissipation (noiseFlow g s) ≤ -r (psi (Real.exp (-s)*psiInv (informationDeficit g))) := by + intro s hs hcomp + have hinterior := soft_flow_interior g hg hl hu hs + have hr := monotoneOn_r + ⟨psi_nonneg _,psi_lt_ell (soft_model_domain ha hs)⟩ hinterior.information_mem hcomp + exact neg_le_neg (hr.trans (all_soft_sharp_production _ hinterior)) + have hf0 : Tendsto (fun s => informationDeficit (noiseFlow g s)) (𝓝[>] 0) (𝓝 (informationDeficit g)) := by + simpa only [noiseFlow_zero] using + ((continuous_informationDeficit_noiseFlow g).continuousAt (x := 0)).tendsto.mono_left nhdsWithin_le_nhds + have hmodel : Continuous (fun s : ℝ => psi (Real.exp (-s)*psiInv (informationDeficit g))) := + continuous_psi.comp ((Real.continuous_exp.comp continuous_neg).mul continuous_const) + have hg0 : Tendsto (fun s : ℝ => psi (Real.exp (-s)*psiInv (informationDeficit g))) + (𝓝[>] 0) (𝓝 (informationDeficit g)) := by + simpa only [neg_zero,Real.exp_zero,one_mul,psi_psiInv_Icc hI] using + (hmodel.continuousAt (x := 0)).tendsto.mono_left nhdsWithin_le_nhds + exact le_of_deriv_le_on_above_of_tendsto + (fun s hs => hasDerivAt_informationDeficit_noiseFlow_of_isInterior g s (soft_flow_interior g hg hl hu hs)) + (fun s hs => hasDerivAt_soft_model ha hs) hderiv hf0 hg0 t ht + +theorem all_soft_nonnegative_contraction {n : ℕ} (g : Cube n → ℝ) (hg : IsClosedSoft g) + {ρ : ℝ} (hρ : ρ ∈ Icc 0 1) : + informationDeficit (noiseOperator ρ g) ≤ psi (ρ*psiInv (informationDeficit g)) := by + by_cases h0 : ρ=0 + · simp [h0] + by_cases h1 : ρ=1 + · have hnoise : noiseOperator 1 g=g := funext (noiseOperator_one g) + rw [h1,hnoise,one_mul,psi_psiInv_Icc (closed_information_mem g hg)] + have hr0 : 0 < ρ := lt_of_le_of_ne hρ.1 (Ne.symm h0) + have hr1 : ρ < 1 := lt_of_le_of_ne hρ.2 h1 + by_cases hl : ∃ x, -1 < g x + · by_cases hu : ∃ x, g x < 1 + · have ht : 0 < -Real.log ρ := neg_pos.mpr (Real.log_neg hr0 hr1) + have h := all_soft_flow_contraction g hg hl hu ht + simpa only [noiseFlow,neg_neg,Real.exp_log hr0] using h + · have hc : g=fun _ => 1 := by + funext x + exact le_antisymm (hg x).2 (not_lt.mp (fun hx => hu ⟨x,hx⟩)) + simp only [hc,informationDeficit_noise_const,informationDeficit_const,psiInv_zero,mul_zero,psi_zero,le_refl] + · have hc : g=fun _ => -1 := by + funext x + exact le_antisymm (not_lt.mp (fun hx => hl ⟨x,hx⟩)) (hg x).1 + simp only [hc,informationDeficit_noise_const,informationDeficit_const,psiInv_zero,mul_zero,psi_zero,le_refl] + +def antipodeEquiv (n : ℕ) : Cube n ≃ Cube n where + toFun x i := !(x i) + invFun x i := !(x i) + left_inv x := by funext i; simp + right_inv x := by funext i; simp + +lemma cubeAverage_antipode {n : ℕ} (g : Cube n → ℝ) : + cubeAverage (fun x => g (antipodeEquiv n x))=cubeAverage g := by + unfold cubeAverage + rw [(antipodeEquiv n).sum_comp g] + +lemma information_antipode {n : ℕ} (g : Cube n → ℝ) : + informationDeficit (fun x => g (antipodeEquiv n x))=informationDeficit g := by + simp only [informationDeficit,entropyAverage,cubeAverage_antipode] + rw [cubeAverage_antipode (fun x => entropy (g x))] + +lemma kernel_negative_correlation {n : ℕ} (ρ : ℝ) (x y : Cube n) : + noiseKernel (-ρ) x y=noiseKernel ρ (antipodeEquiv n x) y := by + unfold noiseKernel + apply Finset.prod_congr rfl + intro i _ + change (if x i=y i then _ else _)=(if (!(x i))=y i then _ else _) + cases x i <;> cases y i <;> simp <;> ring + +lemma information_negative_correlation {n : ℕ} (g : Cube n → ℝ) (ρ : ℝ) : + informationDeficit (noiseOperator (-ρ) g)=informationDeficit (noiseOperator ρ g) := by + have he : noiseOperator (-ρ) g=fun x => noiseOperator ρ g (antipodeEquiv n x) := by + funext x + simp only [noiseOperator,kernel_negative_correlation] + rw [he,information_antipode] + +theorem all_soft_contraction {n : ℕ} (g : Cube n → ℝ) (hg : IsClosedSoft g) + {ρ : ℝ} (hρ : ρ ∈ Icc (-1) 1) : + informationDeficit (noiseOperator ρ g) ≤ psi (|ρ| *psiInv (informationDeficit g)) := by + have ha : |ρ| ∈ Icc 0 1 := ⟨abs_nonneg _,abs_le.mpr hρ⟩ + have h := all_soft_nonnegative_contraction g hg ha + by_cases hpos : 0 ≤ ρ + · simpa only [abs_of_nonneg hpos] using h + · rw [abs_of_neg (lt_of_not_ge hpos),information_negative_correlation] at h + simpa only [abs_of_neg (lt_of_not_ge hpos)] using h + +end LeanBlast.CourtadeKumar +end +end + +end OAI diff --git a/lean/OAI/InformationTheory/SoftChannel/CurvatureBounds.lean b/lean/OAI/InformationTheory/SoftChannel/CurvatureBounds.lean new file mode 100644 index 0000000000000000000000000000000000000000..d3214926213a83f32bbc51abb76cbc612ea4b38e --- /dev/null +++ b/lean/OAI/InformationTheory/SoftChannel/CurvatureBounds.lean @@ -0,0 +1,69 @@ +import OAI.InformationTheory.BooleanNoise.CurvatureBounds +import OAI.InformationTheory.SoftChannel.CurvatureCertificates + +namespace OAI + +section + +noncomputable section + +open Set Filter +open scoped Topology + +namespace LeanBlast.CourtadeKumar + +def CurvatureBounds_smallCoarseBound (z : ℝ) : ℝ := + ((4 / 3) + (2 / 3) * (z / (1 - z))) / ((1 - z) ^ 2 * (1 + z / 3) ^ 3) + +theorem CurvatureBounds_smallCoarseBound_lt_ten_sevenths {z : ℝ} + (hz0 : 0 ≤ z) (hz25 : z ≤ 1 / 25) : CurvatureBounds_smallCoarseBound z < 10 / 7 := by + have hz1 : 0 < 1 - z := by linarith + have hratio : z / (1 - z) ≤ 1 / 24 := (div_le_iff₀ hz1).mpr (by linarith) + have hnum : (4 / 3 : ℝ) + (2 / 3) * (z / (1 - z)) ≤ 49 / 36 := by linarith + have hzsq : z ^ 2 ≤ 1 / 625 := by + nlinarith [mul_nonneg hz0 (show 0 ≤ 1 / 25 - z by linarith)] + have hcube : 1 + z ≤ (1 + z / 3) ^ 3 := by + nlinarith [sq_nonneg z, pow_nonneg hz0 3] + have hbase : (599 / 625 : ℝ) ≤ (1 - z) ^ 2 * (1 + z) := by + nlinarith [pow_nonneg hz0 3] + have hden : (599 / 625 : ℝ) ≤ (1 - z) ^ 2 * (1 + z / 3) ^ 3 := + hbase.trans (mul_le_mul_of_nonneg_left hcube (sq_nonneg _)) + have hden0 : 0 < (1 - z) ^ 2 * (1 + z / 3) ^ 3 := by linarith + apply (div_lt_iff₀ hden0).mpr + calc + (4 / 3 : ℝ) + (2 / 3) * (z / (1 - z)) ≤ 49 / 36 := hnum + _ < (10 / 7) * (599 / 625) := by norm_num + _ ≤ (10 / 7) * ((1 - z) ^ 2 * (1 + z / 3) ^ 3) := + mul_le_mul_of_nonneg_left hden (by norm_num) + +theorem CurvatureBounds_normalized_small_curvature_le {z a : ℝ} + (hz0 : 0 < z) (hz25 : z ≤ 1 / 25) + (hal : 1 + z / 3 ≤ a) (hau : a ≤ 1 + z / (3 * (1 - z))) : + (((1 + z) * a - 1) / z) / ((1 - z) ^ 2 * a ^ 3) ≤ CurvatureBounds_smallCoarseBound z := by + have hz1 : 0 < 1 - z := by linarith + have ha0 : 0 < a := by linarith + have hnum : ((1 + z) * a - 1) / z ≤ (4 / 3) + (2 / 3) * (z / (1 - z)) := by + calc + ((1 + z) * a - 1) / z ≤ + ((1 + z) * (1 + z / (3 * (1 - z))) - 1) / z := + div_le_div_of_nonneg_right + (sub_le_sub_right (mul_le_mul_of_nonneg_left hau (by linarith)) 1) hz0.le + _ = (4 / 3) + (2 / 3) * (z / (1 - z)) := by + field_simp [hz0.ne', hz1.ne'] + ring + have hupper0 : 0 ≤ (4 / 3 : ℝ) + (2 / 3) * (z / (1 - z)) := by positivity + have hden0 : 0 < (1 - z) ^ 2 * (1 + z / 3) ^ 3 := by positivity + have hdena0 : 0 < (1 - z) ^ 2 * a ^ 3 := by positivity + have hdencmp : (1 - z) ^ 2 * (1 + z / 3) ^ 3 ≤ (1 - z) ^ 2 * a ^ 3 := + mul_le_mul_of_nonneg_left (pow_le_pow_left₀ (by positivity) hal 3) (sq_nonneg _) + calc + (((1 + z) * a - 1) / z) / ((1 - z) ^ 2 * a ^ 3) ≤ + ((4 / 3) + (2 / 3) * (z / (1 - z))) / ((1 - z) ^ 2 * a ^ 3) := + div_le_div_of_nonneg_right hnum hdena0.le + _ ≤ CurvatureBounds_smallCoarseBound z := div_le_div_of_nonneg_left hupper0 hden0 hdencmp + +end LeanBlast.CourtadeKumar +end +end + +end OAI diff --git a/lean/OAI/InformationTheory/SoftChannel/CurvatureCertificates.lean b/lean/OAI/InformationTheory/SoftChannel/CurvatureCertificates.lean new file mode 100644 index 0000000000000000000000000000000000000000..9e7f6017c32574ce6273be2c40e00202bc71b4d0 --- /dev/null +++ b/lean/OAI/InformationTheory/SoftChannel/CurvatureCertificates.lean @@ -0,0 +1,153 @@ +import OAI.InformationTheory.BooleanNoise.CurvatureCertificates +import OAI.InformationTheory.BooleanNoise.InverseRegularity +import OAI.InformationTheory.SoftChannel.EndpointLimits + +namespace OAI + +section + +noncomputable section + +open scoped BigOperators + +namespace LeanBlast.CourtadeKumar + +def CurvatureCertificates_curvatureBernstein : Fin 19 → ℝ := + ![(4591 / 62500 : ℝ), + (49876 / 703125 : ℝ), + (616620509 / 9036562500 : ℝ), + (425343109 / 6506325000 : ℝ), + (1239780551 / 19880437500 : ℝ), + (8677345901149 / 146538704812500 : ℝ), + (243668974553 / 4355288437500 : ℝ), + (9012669336346771 / 171450284630625000 : ℝ), + (1633213857973883 / 33281525840062500 : ℝ), + (270017981574109469 / 5940752362451156250 : ℝ), + (49027630438590434159 / 1176268967765328937500 : ℝ), + (363078011510202773129 / 9624018827170873125000 : ℝ), + (10171907529149910232987 / 303156593055882503437500 : ℝ), + (4117638512237582389 / 141331745014397437500 : ℝ), + (29341211329970780039 / 1199300807693601112500 : ℝ), + (7749647417493214337891 / 395769266538888367125000 : ℝ), + (14423931694547701552427 / 989423166347220917812500 : ℝ), + (140069602865401114033 / 14550340681576778203125 : ℝ), + (2753371080520712929 / 554298692631496312500 : ℝ)] + +theorem CurvatureCertificates_curvatureBernstein_pos (i : Fin 19) : 0 < CurvatureCertificates_curvatureBernstein i := by + fin_cases i <;> norm_num [CurvatureCertificates_curvatureBernstein] + +def CurvatureCertificates_curvatureChunk0 (t : ℝ) : ℝ := + (4591 / 62500 : ℝ) * (1 : ℝ) * t ^ 0 * (1-t) ^ 18 +(49876 / 703125 : ℝ) * (18 : ℝ) * t ^ 1 * (1-t) ^ 17 +(616620509 / 9036562500 : ℝ) * (153 : ℝ) * t ^ 2 * (1-t) ^ 16 +(425343109 / 6506325000 : ℝ) * (816 : ℝ) * t ^ 3 * (1-t) ^ 15 +(1239780551 / 19880437500 : ℝ) * (3060 : ℝ) * t ^ 4 * (1-t) ^ 14 + +def CurvatureCertificates_curvatureExpanded0 (t : ℝ) : ℝ := + (4591 / 62500 : ℝ) * t ^ 0 + + (-7091 / 156250 : ℝ) * t ^ 1 + + (-80123 / 2953125 : ℝ) * t ^ 2 + + (4396034 / 398671875 : ℝ) * t ^ 3 + + (665564 / 292359375 : ℝ) * t ^ 4 + + (-21190077014 / 41765625 : ℝ) * t ^ 5 + + (3481363453321 / 626484375 : ℝ) * t ^ 6 + + (-1202154535478 / 41765625 : ℝ) * t ^ 7 + + (3523885857661 / 37968750 : ℝ) * t ^ 8 + + (-16505912944859 / 79734375 : ℝ) * t ^ 9 + + (2979568874243 / 8859375 : ℝ) * t ^ 10 + + (-18099037012498 / 44296875 : ℝ) * t ^ 11 + + (4274088181922 / 11390625 : ℝ) * t ^ 12 + + (-4939200917498 / 18984375 : ℝ) * t ^ 13 + + (510258530647 / 3796875 : ℝ) * t ^ 14 + + (-1258664754982 / 25059375 : ℝ) * t ^ 15 + + (75162420503017 / 5847187500 : ℝ) * t ^ 16 + + (-47199998281 / 23388750 : ℝ) * t ^ 17 + + (643419989006 / 4385390625 : ℝ) * t ^ 18 + +lemma CurvatureCertificates_curvatureChunk0_eq (t : ℝ) : CurvatureCertificates_curvatureChunk0 t=CurvatureCertificates_curvatureExpanded0 t := by + unfold CurvatureCertificates_curvatureChunk0 CurvatureCertificates_curvatureExpanded0 + ring + +def CurvatureCertificates_curvatureChunk1 (t : ℝ) : ℝ := + (8677345901149 / 146538704812500 : ℝ) * (8568 : ℝ) * t ^ 5 * (1-t) ^ 13 +(243668974553 / 4355288437500 : ℝ) * (18564 : ℝ) * t ^ 6 * (1-t) ^ 12 +(9012669336346771 / 171450284630625000 : ℝ) * (31824 : ℝ) * t ^ 7 * (1-t) ^ 11 +(1633213857973883 / 33281525840062500 : ℝ) * (43758 : ℝ) * t ^ 8 * (1-t) ^ 10 +(270017981574109469 / 5940752362451156250 : ℝ) * (48620 : ℝ) * t ^ 9 * (1-t) ^ 9 + +def CurvatureCertificates_curvatureExpanded1 (t : ℝ) : ℝ := + (17354691802298 / 34206046875 : ℝ) * t ^ 5 + + (-950420284700233 / 171030234375 : ℝ) * t ^ 6 + + (4771358404978582 / 165767765625 : ℝ) * t ^ 7 + + (-857160603363297823 / 9235632656250 : ℝ) * t ^ 8 + + (252941709148261987031 / 1221874200421875 : ℝ) * t ^ 9 + + (-18362979380827089383 / 54305520018750 : ℝ) * t ^ 10 + + (286444817585035096264 / 678819000234375 : ℝ) * t ^ 11 + + (-170287429402159339 / 406884515625 : ℝ) * t ^ 12 + + (33027763533426162188 / 96974142890625 : ℝ) * t ^ 13 + + (-4426061793805223332 / 19394828578125 : ℝ) * t ^ 14 + + (7016317227043613942 / 58184485734375 : ℝ) * t ^ 15 + + (-62397657252485608649 / 1357638000468750 : ℝ) * t ^ 16 + + (27028693110521981 / 2468432728125 : ℝ) * t ^ 17 + + (-14713644059062616159 / 12218742004218750 : ℝ) * t ^ 18 + +lemma CurvatureCertificates_curvatureChunk1_eq (t : ℝ) : CurvatureCertificates_curvatureChunk1 t=CurvatureCertificates_curvatureExpanded1 t := by + unfold CurvatureCertificates_curvatureChunk1 CurvatureCertificates_curvatureExpanded1 + ring + +def CurvatureCertificates_curvatureChunk2 (t : ℝ) : ℝ := + (49027630438590434159 / 1176268967765328937500 : ℝ) * (43758 : ℝ) * t ^ 10 * (1-t) ^ 8 +(363078011510202773129 / 9624018827170873125000 : ℝ) * (31824 : ℝ) * t ^ 11 * (1-t) ^ 7 +(10171907529149910232987 / 303156593055882503437500 : ℝ) * (18564 : ℝ) * t ^ 12 * (1-t) ^ 6 +(4117638512237582389 / 141331745014397437500 : ℝ) * (8568 : ℝ) * t ^ 13 * (1-t) ^ 5 +(29341211329970780039 / 1199300807693601112500 : ℝ) * (3060 : ℝ) * t ^ 14 * (1-t) ^ 4 + +def CurvatureCertificates_curvatureExpanded2 (t : ℝ) : ℝ := + (49027630438590434159 / 26881232409281250 : ℝ) * t ^ 10 + + (-8098817455925872602362 / 604827729208828125 : ℝ) * t ^ 11 + + (12852516598885755400633 / 296915430702515625 : ℝ) * t ^ 12 + + (-62530690738860041913986 / 777635651839921875 : ℝ) * t ^ 13 + + (131322976750331117820161 / 1399744173311859375 : ℝ) * t ^ 14 + + (-689559766180042758734306 / 9798209213183015625 : ℝ) * t ^ 15 + + (541378823206442623169759 / 16330348688638359375 : ℝ) * t ^ 16 + + (-17588415841001370441862 / 1959641842636603125 : ℝ) * t ^ 17 + + (104976412464057351032771 / 97982092131830156250 : ℝ) * t ^ 18 + +lemma CurvatureCertificates_curvatureChunk2_eq (t : ℝ) : CurvatureCertificates_curvatureChunk2 t=CurvatureCertificates_curvatureExpanded2 t := by + unfold CurvatureCertificates_curvatureChunk2 CurvatureCertificates_curvatureExpanded2 + ring + +def CurvatureCertificates_curvatureChunk3 (t : ℝ) : ℝ := + (7749647417493214337891 / 395769266538888367125000 : ℝ) * (816 : ℝ) * t ^ 15 * (1-t) ^ 3 +(14423931694547701552427 / 989423166347220917812500 : ℝ) * (153 : ℝ) * t ^ 16 * (1-t) ^ 2 +(140069602865401114033 / 14550340681576778203125 : ℝ) * (18 : ℝ) * t ^ 17 * (1-t) ^ 1 +(2753371080520712929 / 554298692631496312500 : ℝ) * (1 : ℝ) * t ^ 18 * (1-t) ^ 0 + +def CurvatureCertificates_curvatureExpanded3 (t : ℝ) : ℝ := + (15499294834986428675782 / 970022712105118546875 : ℝ) * t ^ 15 + + (-98520655001726957321071 / 2155606026900263437500 : ℝ) * t ^ 16 + + (268817704889101313641 / 6158874362572181250 : ℝ) * t ^ 17 + + (-7499427891584357517851 / 538901506725065859375 : ℝ) * t ^ 18 + +lemma CurvatureCertificates_curvatureChunk3_eq (t : ℝ) : CurvatureCertificates_curvatureChunk3 t=CurvatureCertificates_curvatureExpanded3 t := by + unfold CurvatureCertificates_curvatureChunk3 CurvatureCertificates_curvatureExpanded3 + ring + +def CurvatureCertificates_lambdaBernsteinLow : Fin 9 → ℝ := + ![4, + (241 / 64 : ℝ), + (1537 / 448 : ℝ), + (42755 / 14336 : ℝ), + (217187 / 89600 : ℝ), + (510487 / 286720 : ℝ), + (8901163 / 8028160 : ℝ), + (19161827 / 36700160 : ℝ), + (1316227 / 4587520 : ℝ)] + +def CurvatureCertificates_lambdaBernsteinHigh : Fin 9 → ℝ := + ![(1316227 / 4587520 : ℝ), + (7652479 / 36700160 : ℝ), + (5432143 / 32112640 : ℝ), + (2869523 / 16056320 : ℝ), + (3747241 / 15052800 : ℝ), + (1185781 / 3010560 : ℝ), + (79071 / 125440 : ℝ), + (5261 / 5376 : ℝ), + (1229 / 840 : ℝ)] + +theorem CurvatureCertificates_lambdaBernsteinLow_pos (i : Fin 9) : 0 < CurvatureCertificates_lambdaBernsteinLow i := by + fin_cases i <;> norm_num [CurvatureCertificates_lambdaBernsteinLow] + +theorem CurvatureCertificates_lambdaBernsteinHigh_pos (i : Fin 9) : 0 < CurvatureCertificates_lambdaBernsteinHigh i := by + fin_cases i <;> norm_num [CurvatureCertificates_lambdaBernsteinHigh] + +end LeanBlast.CourtadeKumar +end +end + +end OAI diff --git a/lean/OAI/InformationTheory/SoftChannel/EndpointLimits.lean b/lean/OAI/InformationTheory/SoftChannel/EndpointLimits.lean new file mode 100644 index 0000000000000000000000000000000000000000..1d8d31f92b2c88d5daeafcc183d741b12e28549f --- /dev/null +++ b/lean/OAI/InformationTheory/SoftChannel/EndpointLimits.lean @@ -0,0 +1,26 @@ +import OAI.InformationTheory.BooleanNoise.EndpointLimits +import OAI.InformationTheory.BooleanNoise.EntropyBounds +import OAI.InformationTheory.BooleanNoise.InverseScalars +import OAI.InformationTheory.SoftChannel.Thinning + +namespace OAI + +section + +noncomputable section + +open Filter Set +open scoped Topology + +namespace LeanBlast.CourtadeKumar + +theorem EndpointLimits_endpoint_one_sub_sq_pos {u : ℝ} (hu : u ∈ Ioo 0 1) : + 0 < 1 - u ^ 2 := by + have h := mul_pos (show 0 < 1 + u by linarith [hu.1]) (sub_pos.mpr hu.2) + nlinarith + +end LeanBlast.CourtadeKumar +end +end + +end OAI diff --git a/lean/OAI/InformationTheory/SoftChannel/HighReserve.lean b/lean/OAI/InformationTheory/SoftChannel/HighReserve.lean new file mode 100644 index 0000000000000000000000000000000000000000..f999f97a329e50e63b73f43bbfa32781f0266d6a --- /dev/null +++ b/lean/OAI/InformationTheory/SoftChannel/HighReserve.lean @@ -0,0 +1,123 @@ +import OAI.InformationTheory.SoftChannel.Payment + +namespace OAI + +section + +noncomputable section +open Set Filter +open scoped BigOperators Topology +namespace LeanBlast.CourtadeKumar + +def softCutoff : ℝ := psi (77/100) +def centeredRate (I : ℝ) : ℝ := (I-(ell-1/2))*(rDeriv I-2)-rGap I + +def meanReserve (m I : ℝ) : ℝ := + 2*I+(1-m^2)*L ((entropy m-I)/(1-m^2)) + +lemma softCutoff_pos : 0 < softCutoff := psi_pos_of_pos (by norm_num) (by norm_num) +lemma softCutoff_lt_ell : softCutoff < ell := psi_lt_ell (by norm_num) + +lemma artanh_77_upper : Real.artanh (77/100:ℝ) < 1021/1000 := by + have he : (177/23:ℝ) < Real.exp (1021/500) := by + refine lt_of_lt_of_le ?_ (Real.sum_le_exp_of_nonneg (by norm_num : (0:ℝ) ≤ 1021/500) 8) + norm_num [Finset.sum_range_succ, Nat.factorial] + have hl := (Real.log_lt_iff_lt_exp (by norm_num : (0:ℝ)<177/23)).mpr he + rw [artanh_eq_log_sub (by norm_num : (77/100:ℝ) ∈ Ioo (-1) 1)] + rw [← Real.log_div (by norm_num : (1+(77/100:ℝ)) ≠ 0) (by norm_num : (1-(77/100:ℝ)) ≠ 0)] + norm_num at * + linarith + +lemma softCutoff_lower : (336/1000:ℝ) ≤ softCutoff := by + have h := sum_range_psi_le (by norm_num : |(77/100:ℝ)| < 1) 6 + norm_num [psiCoeff, Finset.sum_range_succ] at h + exact le_trans (by norm_num) h + +lemma softCutoff_above_center : ell-1/2 < softCutoff := by + linarith [ell_lt_347_div_500,softCutoff_lower] + +lemma centeredRate_cutoff_pos : 0 < centeredRate softCutoff := by + have hv0 := Real.artanh_pos (show (77/100:ℝ) ∈ Ioo 0 1 by norm_num) + have hv := artanh_77_upper + have hs := softCutoff_lower + have hL := ell_lt_347_div_500 + have hD : (185/100:ℝ) ≤ (77/100)/((1-(77/100:ℝ)^2)*Real.artanh (77/100)) := by + apply (le_div_iff₀ (by positivity)).mpr + nlinarith + unfold centeredRate rGap + rw [show softCutoff = psi (77/100) from rfl, rDeriv_psi (by norm_num), r_psi (by norm_num)] + change 0 < (softCutoff-(ell-1/2))*(1+(77/100)/((1-(77/100:ℝ)^2)*Real.artanh (77/100))-2)- + ((77/100)*Real.artanh (77/100)-2*softCutoff) + have hmul := mul_le_mul_of_nonneg_left (show (85/100:ℝ) ≤ 1+(77/100)/((1-(77/100:ℝ)^2)*Real.artanh (77/100))-2 by linarith) + (sub_nonneg.mpr softCutoff_above_center.le) + nlinarith + +lemma hasDerivAt_centeredRate {I : ℝ} (hI : I ∈ Ioo 0 ell) : + HasDerivAt centeredRate ((I-(ell-1/2))*rSecondDeriv I) I := by + have h := (((hasDerivAt_id I).sub_const (ell-1/2)).mul + ((hasDerivAt_rDeriv hI).sub_const 2)).sub (hasDerivAt_rGap hI) + convert! h using 1; dsimp [centeredRate]; ring + +lemma centeredRate_nonneg {I : ℝ} (hI : I ∈ Ico softCutoff ell) : 0 ≤ centeredRate I := by + have hm : MonotoneOn centeredRate (Ico softCutoff ell) := by + apply monotoneOn_of_hasDerivWithinAt_nonneg (f' := fun I => (I-(ell-1/2))*rSecondDeriv I) + (convex_Ico _ _) + · intro x hx + exact (hasDerivAt_centeredRate ⟨softCutoff_pos.trans_le hx.1,hx.2⟩).continuousAt.continuousWithinAt + · intro x hx + exact (hasDerivAt_centeredRate ⟨by simp only [interior_Ico,mem_Ioo] at hx; exact softCutoff_pos.trans hx.1, + by simp only [interior_Ico,mem_Ioo] at hx; exact hx.2⟩).hasDerivWithinAt + · intro x hx + simp only [interior_Ico,mem_Ioo] at hx + exact mul_nonneg (by linarith [softCutoff_above_center]) + (rSecondDeriv_nonneg (by linarith [softCutoff_pos]) hx.2) + exact centeredRate_cutoff_pos.le.trans (hm ⟨le_rfl,softCutoff_lt_ell⟩ hI hI.1) + +lemma rGap_tangent {I s : ℝ} (hI : I ∈ Ioo 0 ell) (hs : s ∈ Ico I ell) : + rGap I+(s-I)*(rDeriv I-2) ≤ rGap s := by + rcases hs.1.eq_or_lt with he | hlt + · rw [← he]; simp + · have h := convexOn_rGap.le_slope_of_hasDerivAt ⟨hI.1.le,hI.2⟩ ⟨hI.1.le.trans hs.1,hs.2⟩ hlt + (hasDerivAt_rGap hI) + rw [slope_def_field] at h + have hh := (le_div_iff₀ (sub_pos.mpr hlt)).mp h + nlinarith + +lemma high_information_reserve {m I : ℝ} (hm : |m| < 1) + (hI : softCutoff ≤ I) (hIe : I < entropy m) : r I ≤ meanReserve m I := by + have hm2 : m^2 < 1 := by nlinarith [abs_lt.mp hm, sq_abs m] + have ha : 0 < 1-m^2 := by linarith + have hI0 : 0 < I := softCutoff_pos.trans_le hI + have hIL : I < ell := hIe.trans_le (entropy_le_ell m) + have hc := half_sq_le_psi hm.le + let c := entropy m-(1-m^2)*ell + have hcub : c ≤ m^2*(ell-1/2) := by dsimp [c,entropy]; nlinarith + let s := ell-(entropy m-I)/(1-m^2) + have hsline : (1-m^2)*s = I-c := by dsimp [s,c]; field_simp; ring + have hsI : I ≤ s := by + have hp := mul_nonneg (sq_nonneg m) (show 0 ≤ I-(ell-1/2) by linarith [softCutoff_above_center]) + nlinarith + have hsL : s < ell := by dsimp [s]; exact sub_lt_self _ (div_pos (sub_pos.mpr hIe) ha) + have hL : L ((entropy m-I)/(1-m^2)) = rGap s := by + rw [L_eq_rGap ⟨div_pos (sub_pos.mpr hIe) ha,by dsimp [s] at hsI; linarith⟩] + have htan := mul_le_mul_of_nonneg_left (rGap_tangent ⟨hI0,hIL⟩ ⟨hsI,hsL⟩) ha.le + have hcd := mul_le_mul_of_nonneg_right hcub (sub_nonneg.mpr (rDeriv_ge_two hI0.le hIL)) + have hxi := mul_nonneg (sq_nonneg m) (centeredRate_nonneg ⟨hI,hIL⟩) + have hident := congrArg (fun t => t*(rDeriv I-2)) hsline + unfold centeredRate at hxi + unfold meanReserve + rw [hL] + dsimp [rGap] at * + nlinarith + +lemma meanReserve_zero_mean {I : ℝ} (hI : I ∈ Ico 0 ell) : meanReserve 0 I = r I := by + simp only [meanReserve, entropy_zero, ne_eq, OfNat.ofNat_ne_zero, not_false_eq_true, + zero_pow, sub_zero, div_one, one_mul] + rw [L_ell_sub hI.1 hI.2] + ring + +end LeanBlast.CourtadeKumar +end +end + +end OAI diff --git a/lean/OAI/InformationTheory/SoftChannel/JensenGaps.lean b/lean/OAI/InformationTheory/SoftChannel/JensenGaps.lean new file mode 100644 index 0000000000000000000000000000000000000000..92821c0f53ae10d1ca2442de73ec41c3d1894d74 --- /dev/null +++ b/lean/OAI/InformationTheory/SoftChannel/JensenGaps.lean @@ -0,0 +1,172 @@ +import OAI.InformationTheory.BooleanNoise.CubeSplits +import OAI.InformationTheory.BooleanNoise.JensenGaps +import OAI.InformationTheory.BooleanNoise.PerspectiveJensen +import OAI.InformationTheory.SoftChannel.SemigroupFlow + +namespace OAI + +section + +noncomputable section + +open scoped BigOperators + +namespace LeanBlast.CourtadeKumar + +section Weighted + +universe u + +variable {ι : Type u} [Fintype ι] + +abbrev JensenGaps_entropySeriesCoeff (j : ℕ) : ℝ := psiCoeff j + +theorem JensenGaps_entropy_series_gap_lower (F : ℝ → ℝ) (w x : ι → ℝ) (y : ℝ) + (hw : ∀ i, 0 ≤ w i) (hprob : ∑ i, w i = 1) (hmean : ∑ i, w i * x i = y) + (hx : ∀ i, HasSum (fun j => JensenGaps_entropySeriesCoeff j * (x i) ^ (2 * (j + 1))) (F (x i))) + (hy : HasSum (fun j => JensenGaps_entropySeriesCoeff j * y ^ (2 * (j + 1))) (F y)) : + (∑ i, w i * (x i) ^ 2) - y ^ 2 ≤ 2 * ((∑ i, w i * F (x i)) - F y) := by + have hsum := weighted_series_gap_hasSum JensenGaps_entropySeriesCoeff (fun j => 2 * (j + 1)) F w x y hx hy + apply hasSum_le _ (hasSum_ite_eq (0 : ℕ) ((∑ i, w i * (x i) ^ 2) - y ^ 2)) hsum + intro j + by_cases hj : j = 0 + · subst j + norm_num [JensenGaps_entropySeriesCoeff] + · simp only [ite_eq_right hj] + have hp := weighted_even_pow_jensen w x (j + 1) hw hprob + rw [hmean] at hp + exact mul_nonneg (mul_nonneg (by norm_num) (psiCoeff_nonneg j)) (sub_nonneg.mpr hp) + +theorem JensenGaps_entropy_series_gap_strengthened (F : ℝ → ℝ) (w x : ι → ℝ) (y : ℝ) + (hw : ∀ i, 0 ≤ w i) (hprob : ∑ i, w i = 1) (hmean : ∑ i, w i * x i = y) + (hx0 : ∀ i, 0 ≤ x i) (hy0 : 0 ≤ y) (hy1 : y < 1) + (hx : ∀ i, HasSum (fun j => JensenGaps_entropySeriesCoeff j * (x i) ^ (2 * (j + 1))) (F (x i))) + (hy : HasSum (fun j => JensenGaps_entropySeriesCoeff j * y ^ (2 * (j + 1))) (F y)) : + ((∑ i, w i * (x i) ^ 2) - y ^ 2) * lambda (y ^ 2) ≤ + 2 * ((∑ i, w i * F (x i)) - F y) := by + have hsum := weighted_series_gap_hasSum JensenGaps_entropySeriesCoeff (fun j => 2 * (j + 1)) F w x y hx hy + have hlambda := (hasSum_lambda (sq_nonneg y) (by nlinarith : y ^ 2 < 1)).mul_left + ((∑ i, w i * (x i) ^ 2) - y ^ 2) + apply hasSum_le _ hlambda hsum + intro j + have hp := weighted_pow_gap_lower w x y (2 * j) hw hprob hx0 hy0 hmean + have hc : 0 ≤ 2 * JensenGaps_entropySeriesCoeff j := mul_nonneg (by norm_num) (psiCoeff_nonneg j) + have h := mul_le_mul_of_nonneg_left hp hc + have heq : 2 * JensenGaps_entropySeriesCoeff j * + ((2 * j + 1 : ℝ) * y ^ (2 * j) * ((∑ i, w i * (x i) ^ 2) - y ^ 2)) = + ((∑ i, w i * (x i) ^ 2) - y ^ 2) * ((y ^ 2) ^ j / ((j : ℝ) + 1)) := by + simp only [JensenGaps_entropySeriesCoeff, psiCoeff, pow_mul] + field_simp + rw [show 2 * j + 2 = 2 * (j + 1) by omega] at h + push_cast at h + rwa [heq] at h + +theorem JensenGaps_normalized_ratio_weights_data (w t b : ι → ℝ) (T k : ℝ) + (hw : ∀ i, 0 ≤ w i) (ht : ∀ i, 0 < t i) (hT : 0 < T) + (hmass : ∑ i, w i * t i = T) (hmean : ∑ i, w i * b i = k) : + (∀ i, 0 ≤ w i * t i / T) ∧ (∑ i, w i * t i / T) = 1 ∧ + (∑ i, (w i * t i / T) * (b i / t i)) = k / T := by + refine ⟨fun i => div_nonneg (mul_nonneg (hw i) (ht i).le) hT.le, ?_, ?_⟩ + · rw [← Finset.sum_div, hmass, div_self hT.ne'] + · calc + _ = ∑ i, (w i * b i) / T := by + apply Finset.sum_congr rfl + intro i _ + field_simp [(ht i).ne'] + _ = k / T := by rw [← Finset.sum_div, hmean] + +theorem JensenGaps_rescale_perspective_gap (w t b : ι → ℝ) (T k C : ℝ) + (ht : ∀ i, 0 < t i) (hT : 0 < T) + (hgap : ((∑ i, (w i * t i / T) * (b i / t i) ^ 2) - (k / T) ^ 2) * C ≤ + 2 * ((∑ i, (w i * t i / T) * psi (b i / t i)) - psi (k / T))) : + ((∑ i, w i * (b i) ^ 2 / t i) - k ^ 2 / T) * C ≤ + 2 * ((∑ i, w i * t i * psi (b i / t i)) - T * psi (k / T)) := by + have hsecond : (∑ i, (w i * t i / T) * (b i / t i) ^ 2) = + (∑ i, w i * (b i) ^ 2 / t i) / T := by + rw [Finset.sum_div] + apply Finset.sum_congr rfl + intro i _ + field_simp [(ht i).ne'] + have hentropy : (∑ i, (w i * t i / T) * psi (b i / t i)) = + (∑ i, w i * t i * psi (b i / t i)) / T := by + rw [Finset.sum_div] + apply Finset.sum_congr rfl + intro i _ + ring + rw [hsecond, hentropy] at hgap + have h := mul_le_mul_of_nonneg_left hgap hT.le + convert! h using 1 <;> field_simp + +theorem JensenGaps_pair_reciprocal_square_identity (a b : ℝ) (h : |a| + |b| < 1) : + b ^ 2 / (1 + a) + b ^ 2 / (1 - a) = 2 * (b ^ 2 / (1 - a ^ 2)) := by + have hp := (pair_denom_add_pos a b h).ne' + have hm := (pair_denom_sub_pos a b h).ne' + have hv := (pair_variance_pos a b h).ne' + field_simp + ring + +theorem JensenGaps_weighted_pair_gap_combine (w a b : ι → ℝ) (m k C : ℝ) + (hdom : ∀ i, |a i| + |b i| < 1) (hcenter : |m| + |k| < 1) + (hp : ((∑ i, w i * (b i) ^ 2 / (1 + a i)) - k ^ 2 / (1 + m)) * C ≤ + 2 * ((∑ i, w i * (1 + a i) * psi (b i / (1 + a i))) - + (1 + m) * psi (k / (1 + m)))) + (hm : ((∑ i, w i * (b i) ^ 2 / (1 - a i)) - k ^ 2 / (1 - m)) * C ≤ + 2 * ((∑ i, w i * (1 - a i) * psi (b i / (1 - a i))) - + (1 - m) * psi (k / (1 - m)))) : + ((∑ i, w i * (b i) ^ 2 / (1 - (a i) ^ 2)) - k ^ 2 / (1 - m ^ 2)) * C ≤ + 2 * ((∑ i, w i * pairEntropyGap (a i) (b i)) - pairEntropyGap m k) := by + have hv : (∑ i, w i * (b i) ^ 2 / (1 + a i)) + + (∑ i, w i * (b i) ^ 2 / (1 - a i)) = + 2 * (∑ i, w i * (b i) ^ 2 / (1 - (a i) ^ 2)) := by + rw [← Finset.sum_add_distrib, Finset.mul_sum] + apply Finset.sum_congr rfl + intro i _ + calc + _ = w i * ((b i) ^ 2 / (1 + a i) + (b i) ^ 2 / (1 - a i)) := by ring + _ = _ := by rw [JensenGaps_pair_reciprocal_square_identity (a i) (b i) (hdom i)]; ring + have hvc := JensenGaps_pair_reciprocal_square_identity m k hcenter + have he : (∑ i, w i * (1 + a i) * psi (b i / (1 + a i))) + + (∑ i, w i * (1 - a i) * psi (b i / (1 - a i))) = + 2 * (∑ i, w i * pairEntropyGap (a i) (b i)) := by + rw [← Finset.sum_add_distrib, Finset.mul_sum] + apply Finset.sum_congr rfl + intro i _ + rw [pairEntropyGap_weighted (a i) (b i) (hdom i)] + ring + have hec : (1 + m) * psi (k / (1 + m)) + (1 - m) * psi (k / (1 - m)) = + 2 * pairEntropyGap m k := by + rw [pairEntropyGap_weighted m k hcenter] + ring + have hvC := congrArg (fun z : ℝ => z * C) hv + have hvcC := congrArg (fun z : ℝ => z * C) hvc + nlinarith only [hp, hm, hvC, hvcC, he, hec] + +theorem JensenGaps_lambda_ratio_min_le (m k t : ℝ) (hk : 0 ≤ k) + (ht : 0 < t) (htmax : t ≤ 1 + |m|) (hkt : k < t) : + lambda ((k / (1 + |m|)) ^ 2) ≤ lambda ((k / t) ^ 2) := by + have hmax : 0 < 1 + |m| := by positivity + have hx : 0 ≤ k / (1 + |m|) := div_nonneg hk hmax.le + have hy : 0 ≤ k / t := div_nonneg hk ht.le + have hxy := div_le_div_of_nonneg_left hk ht htmax + have hy1 : k / t < 1 := (div_lt_one ht).mpr hkt + apply monotoneOn_lambda + · exact ⟨sq_nonneg _, by nlinarith⟩ + · exact ⟨sq_nonneg _, by nlinarith⟩ + · exact pow_le_pow_left₀ hx hxy 2 + +end Weighted + +theorem JensenGaps_cube_uniform_weights_sum_one (n : ℕ) : + ∑ _ : Cube n, ((2 : ℝ) ^ n)⁻¹ = 1 := by + simp [Cube, LeanBlast.GotsmanLinial.Cube] + +theorem JensenGaps_cubeAverage_as_weighted_sum {n : ℕ} (f : Cube n → ℝ) : + cubeAverage f = ∑ x, ((2 : ℝ) ^ n)⁻¹ * f x := by + rw [cubeAverage, ← Finset.mul_sum] + ring + +end LeanBlast.CourtadeKumar +end +end + +end OAI diff --git a/lean/OAI/InformationTheory/SoftChannel/Joining.lean b/lean/OAI/InformationTheory/SoftChannel/Joining.lean new file mode 100644 index 0000000000000000000000000000000000000000..b082c9c0767268c8d4ed03ef3262c4c4ad10c6d2 --- /dev/null +++ b/lean/OAI/InformationTheory/SoftChannel/Joining.lean @@ -0,0 +1,115 @@ +import OAI.InformationTheory.SoftChannel.SoftReserve + +namespace OAI + +section + +noncomputable section +open Set Filter +open scoped Topology +namespace LeanBlast.CourtadeKumar + +lemma joiningCost_pair (c d : ℝ) : joiningCost (c+d) (c-d) = pairDissipation c d := by + unfold joiningCost pairDissipation + ring + +lemma joiningCost_symm (a b : ℝ) : joiningCost a b = joiningCost b a := by + unfold joiningCost; ring + +lemma onecorner_payment {m d k : ℝ} (_hm : 0 ≤ m) (hd : 0 < d) (hmd : m+d<1) + (hk : k ∈ Icc (1-m) 1) : + wallDemand m d (onecornerEntropy m d k) ≤ k*joiningCost (onecornerX m d k) (onecornerY m d k) := by + have hk0 : 0 < k := by linarith [hk.1] + let c := 1-(1-m)/k + let v := d/k + have hc : 0 ≤ c := by dsimp [c]; exact sub_nonneg.mpr ((div_le_one hk0).mpr hk.1) + have hv : 0 < v := div_pos hd hk0 + have hcv : c+v<1 := by + dsimp [c,v] + rw [show 1-(1-m)/k+d/k=1-(1-m-d)/k by ring] + exact sub_lt_self _ (div_pos (by linarith : 0<1-m-d) hk0) + have hx : c+v=onecornerX m d k := by dsimp [c,v,onecornerX]; ring + have hy : c-v=onecornerY m d k := by dsimp [c,v,onecornerY]; ring + have hthin : thinX c k=m := by dsimp [thinX,c]; field_simp; ring + have hkv : k*v=d := by dsimp [v]; field_simp + have he : k*pairH c v=onecornerEntropy m d k := by dsimp [pairH,onecornerEntropy]; rw [hx,hy]; ring + have h := common_output_payment hc hv hcv ⟨hk0,hk.2⟩ + have hcap := mul_le_mul_of_nonneg_left + (r_pairEntropyGap_le_pairDissipation c v (wall_domain hc hv.le hcv)) hk0.le + have hI : thinI c v k=entropy m-onecornerEntropy m d k := by dsimp [thinI]; rw [hthin,he] + have hJ : thinJ c v k=pairH m d-onecornerEntropy m d k := by dsimp [thinJ]; rw [hthin,he,hkv] + rw [hI,hJ] at h + rw [← joiningCost_pair,hx,hy] at hcap + exact h.trans hcap + +lemma high_value_joining {n : ℕ} (A B : Cube n → ℝ) (hA : IsInterior A) (hB : IsInterior B) + {m d : ℝ} (hm : 0 ≤ m) (hd : 0 < d) (hmd : m+d<1) + (ha : cubeAverage A=m+d) (hb : cubeAverage B=m-d) + (he : (1-m)*entropy (d/(1-m)) ≤ (entropyAverage A+entropyAverage B)/2) + (hphys : (entropyAverage A+entropyAverage B)/2 ≤ pairH m d) : + wallDemand m d ((entropyAverage A+entropyAverage B)/2) ≤ + cubeAverage (fun x => joiningCost (A x) (B x)) := by + obtain ⟨k,hk,hke⟩ := exists_onecorner_entropy hm hd hmd he hphys + exact (hke ▸ onecorner_payment hm hd hmd hk).trans + (onecorner_cost_lower A B hA hB hm hd hmd hk ha hb hke.symm) + +lemma reflected_payment {m r k : ℝ} (hm : 0 < m) (hr : r ∈ Ioo 0 1) + (hk : 0 < k) (hkm : k ≤ 1-m) (hI : entropy m-k*entropy r ≤ softCutoff) : + wallDemand m (k*r) (k*entropy r) ≤ k*joiningCost r (-r) := by + have hk1 : k < 1 := by linarith + have hw : 0 ≤ 1-k := by linarith + have hd : 0 < k*r := mul_pos hk hr.1 + have hwd : (1-k)+k*r<1 := by nlinarith [mul_pos hk (sub_pos.mpr hr.2)] + have he : 0 < k*entropy r := mul_pos hk (entropy_pos ⟨by linarith [hr.1],hr.2⟩) + have hX : thinX 0 k=1-k := by simp [thinX] + have hH : pairH 0 r=entropy r := by simp [pairH,entropy_neg] + have hj := thinJ_pos (by norm_num : (0:ℝ) ≤ 0) hr.1.le (by linarith [hr.2] : 0+r<1) ⟨hk,hk1⟩ + have hje : k*entropy r < pairH (1-k) (k*r) := by + dsimp [thinJ] at hj + rw [hX,hH] at hj + linarith + have hwall := wall_comparison hm.le (by linarith : m ≤ 1-k) hd.le hwd he hje hI + have hpay := common_output_payment (by norm_num : (0:ℝ) ≤ 0) hr.1 (by linarith [hr.2] : 0+r<1) ⟨hk,hk1.le⟩ + have hI' : thinI 0 r k=entropy (1-k)-k*entropy r := by dsimp [thinI]; rw [hX,hH] + have hJ' : thinJ 0 r k=pairH (1-k) (k*r)-k*entropy r := by dsimp [thinJ]; rw [hX,hH] + rw [hI',hJ'] at hpay + have hcap := mul_le_mul_of_nonneg_left (r_pairEntropyGap_le_pairDissipation 0 r + (by simpa only [abs_zero,zero_add,abs_of_pos hr.1] using hr.2)) hk.le + have hcost : pairDissipation 0 r=joiningCost r (-r) := by + simpa using (joiningCost_pair 0 r).symm + rw [hcost] at hcap + exact hwall.trans (hpay.trans hcap) + +lemma low_information_joining {n : ℕ} (A B : Cube n → ℝ) (hA : IsInterior A) (hB : IsInterior B) + {m d : ℝ} (hm : 0 < m) (hd : 0 < d) (hmd : m+d<1) + (ha : cubeAverage A=m+d) (hb : cubeAverage B=m-d) + (hphys : (entropyAverage A+entropyAverage B)/2 ≤ pairH m d) + (hI : entropy m-(entropyAverage A+entropyAverage B)/2 ≤ softCutoff) : + wallDemand m d ((entropyAverage A+entropyAverage B)/2) ≤ + cubeAverage (fun x => joiningCost (A x) (B x)) := by + by_cases he : (1-m)*entropy (d/(1-m)) ≤ (entropyAverage A+entropyAverage B)/2 + · exact high_value_joining A B hA hB hm.le hd hmd ha hb he hphys + · have hep : 0 < (entropyAverage A+entropyAverage B)/2 := by + linarith [hA.entropyAverage_pos,hB.entropyAverage_pos] + obtain ⟨r,hr,hre⟩ := exists_reflected_entropy hm.le hd hmd hep (le_of_not_ge he) + have hm1 : 0 < 1-m := by linarith + have hr0 : 0 < r := (div_pos hd hm1).trans_le hr.1 + let k := d/r + have hk : 0 < k := div_pos hd hr0 + have hkr : k*r=d := by dsimp [k]; field_simp + have hkm : k ≤ 1-m := by + apply (div_le_iff₀ hr0).mpr + have h := (div_le_iff₀ hm1).mp hr.1 + nlinarith + have heq : k*entropy r=(entropyAverage A+entropyAverage B)/2 := hre + have hpay := reflected_payment hm ⟨hr0,hr.2⟩ hk hkm (by rwa [heq]) + rw [hkr,heq] at hpay + have hcost := reflected_cost_lower A B hA hB ⟨hr0,hr.2⟩ + (show cubeAverage A-cubeAverage B=2*k*r by rw [ha,hb]; nlinarith [hkr]) heq.symm + exact hpay.trans hcost + +end LeanBlast.CourtadeKumar +end +end + +end OAI diff --git a/lean/OAI/InformationTheory/SoftChannel/LRegularity.lean b/lean/OAI/InformationTheory/SoftChannel/LRegularity.lean new file mode 100644 index 0000000000000000000000000000000000000000..86a50255ab177204007b6afd3d879b4cb2f5a360 --- /dev/null +++ b/lean/OAI/InformationTheory/SoftChannel/LRegularity.lean @@ -0,0 +1,38 @@ +import OAI.InformationTheory.BooleanNoise.LRegularity +import OAI.InformationTheory.SoftChannel.JensenGaps + +namespace OAI + +section + +noncomputable section + +open Set Filter +open scoped Topology + +namespace LeanBlast.CourtadeKumar + +theorem LRegularity_L_eq_rGap_on_left {x : ℝ} (hx : x ∈ Ioc 0 ell) : + L x = rGap (ell - x) := by + rcases hx.2.lt_or_eq with hlt | rfl + · exact L_eq_rGap ⟨hx.1, hlt⟩ + · simp [L] + +theorem LRegularity_LDeriv_eq_formula_on_left {x : ℝ} (hx : x ∈ Ioc 0 ell) : + LDeriv x = 2 - rDeriv (ell - x) := by + rcases hx.2.lt_or_eq with hlt | rfl + · exact ite_eq_left ⟨hx.1, hlt⟩ + · simp [LDeriv] + +theorem LRegularity_L_join_neighborhood : Ioc (0 : ℝ) ell ∪ Ici ell ∈ 𝓝 ell := by + apply mem_of_superset (Ioi_mem_nhds ell_pos) + intro x hx + rcases le_total x ell with h | h + · exact Or.inl ⟨hx, h⟩ + · exact Or.inr h + +end LeanBlast.CourtadeKumar +end +end + +end OAI diff --git a/lean/OAI/InformationTheory/SoftChannel/Main.lean b/lean/OAI/InformationTheory/SoftChannel/Main.lean new file mode 100644 index 0000000000000000000000000000000000000000..e73e88e2a2f060bf17604275ad72eba9a9221505 --- /dev/null +++ b/lean/OAI/InformationTheory/SoftChannel/Main.lean @@ -0,0 +1,121 @@ +import OAI.InformationTheory.SoftChannel.SoftInformation + +namespace OAI + +section + +noncomputable section +open scoped BigOperators + +namespace SoftChannel204 + +open LeanBlast +open Set + +lemma production_eq {n : ℕ} (g : Cube n → ℝ) : + production g = CourtadeKumar.dissipation g := by + unfold production numberOperator + change CourtadeKumar.cubeAverage + (fun x => Real.artanh (g x) * ((1/2:ℝ) * ∑ i, (g x-g (flip i x)))) = _ + have h : (fun x => Real.artanh (g x) * ((1/2:ℝ) * ∑ i, (g x-g (flip i x)))) = + (fun x => ∑ i, Real.artanh (g x) * CourtadeKumar.cubeDerivative i g x) := by + funext x + simp only [CourtadeKumar.cubeDerivative, Finset.mul_sum] + apply Finset.sum_congr rfl + intro i _ + change Real.artanh (g x) * (1/2*(g x-g (flip i x))) = Real.artanh (g x) * ((g x-g (flip i x))/2) + ring + rw [h,CourtadeKumar.cubeAverage_sum] + rfl + +lemma S_eq_L {x : ℝ} (hx : 0 < x) : + S (L-x)=CourtadeKumar.L x := by + change (if CourtadeKumar.ell-x < 0 then 0 else CourtadeKumar.rGap (CourtadeKumar.ell-x)) = + (if 0 < x ∧ x < CourtadeKumar.ell then CourtadeKumar.rGap (CourtadeKumar.ell-x) else 0) + rcases lt_trichotomy x CourtadeKumar.ell with h | h | h + · rw [ite_eq_right (by linarith),ite_eq_left ⟨hx,h⟩] + · rw [h,sub_self,ite_eq_right (lt_irrefl 0),CourtadeKumar.rGap_zero,ite_eq_right (by simp)] + · rw [ite_eq_left (by linarith),ite_eq_right (fun hh => (not_lt_of_ge h.le) hh.2)] + +lemma reserve_eq {m I : ℝ} (hm : |m| < 1) (hI : I < H m) : + reserve m I=CourtadeKumar.meanReserve m I := by + unfold reserve CourtadeKumar.meanReserve + rw [S_eq_L (div_pos (sub_pos.mpr hI) (CourtadeKumar.scalar_meanVariance_pos hm))] + rfl + +lemma softJoint_eq {n : ℕ} (ρ : ℝ) (g : Cube n → ℝ) : + softJoint ρ g=CourtadeKumar.softJointNat ρ g := by + funext b y + unfold softJoint CourtadeKumar.softJointNat + change CourtadeKumar.cubeAverage _=CourtadeKumar.cubeAverage _ + congr 1 + funext x + cases b <;> simp only [sign,CourtadeKumar.signProbability,Bool.false_eq_true,ite_false,ite_true] + · change (1 + -1*g x)/2*kernel ρ x y = (1-g x)/2*kernel ρ x y + ring + · change (1 + 1*g x)/2*kernel ρ x y = (1+g x)/2*kernel ρ x y + ring + +theorem softContraction : SoftContraction := by + intro n u hu ρ hρ + exact CourtadeKumar.all_soft_contraction u hu hρ + +theorem softAttainment : SoftAttainment := by + intro n i a ha ρ _ + exact CourtadeKumar.all_soft_coordinate_attainment i a ha ρ + +theorem softInformationIdentity : SoftInformationIdentity := by + intro n u hu ρ hρ + rw [softJoint_eq] + exact CourtadeKumar.soft_information_identity u hu hρ + +theorem refinedBoolean : RefinedBoolean := by + intro n f ρ hρ + have hρa : |ρ| ∈ Icc (0:ℝ) 1 := ⟨abs_nonneg _, abs_le.mpr hρ⟩ + have hm : avg (sign ∘ f) ∈ Icc (-1:ℝ) 1 := + ⟨CourtadeKumar.cubeAverage_mono (fun x => (CourtadeKumar.signEncoding_closed f x).1) |>.trans' + (CourtadeKumar.cubeAverage_const n (-1)).ge, + (CourtadeKumar.cubeAverage_mono (fun x => (CourtadeKumar.signEncoding_closed f x).2)).trans + (CourtadeKumar.cubeAverage_const n 1).le⟩ + exact ⟨CourtadeKumar.bool_information_identity f hρ, + CourtadeKumar.refined_boolean_bound f hρ, + CourtadeKumar.refined_curve_le hm hρa, + fun hm0 hm1 hρ0 => CourtadeKumar.refined_curve_strict hm0 hm1 ⟨hρ0,hρa.2⟩⟩ + +theorem booleanAttainment : BooleanAttainment := by + intro n i ρ hρ + change CourtadeKumar.mutualInformationNat (CourtadeKumar.boolJointNat ρ (CourtadeKumar.dictator i)) = _ ∧ + CourtadeKumar.mutualInformationNat (CourtadeKumar.boolJointNat ρ (CourtadeKumar.complementDictator i)) = _ + rw [CourtadeKumar.bool_information_identity _ hρ,CourtadeKumar.bool_information_identity _ hρ, + CourtadeKumar.informationDeficit_noise_dictator,CourtadeKumar.informationDeficit_noise_complementDictator] + exact ⟨(CourtadeKumar.psi_abs_soft ρ).symm,(CourtadeKumar.psi_abs_soft ρ).symm⟩ + +theorem bitsConversion : BitsConversion := by + intro n f ε hε + have h : psi (1-2*ε)/L=1-binaryEntropyBits ε := + (CourtadeKumar.one_sub_binaryEntropy_eq_psi ε).symm + refine ⟨h,?_⟩ + rw [← h] + apply div_le_div_of_nonneg_right _ CourtadeKumar.ell_pos.le + have hρ : (1-2*ε) ∈ Icc (-1:ℝ) 1 := by constructor <;> linarith [hε.1,hε.2] + have hb := (refinedBoolean n f (1-2*ε) hρ).2.1.trans (refinedBoolean n f (1-2*ε) hρ).2.2.1 + rwa [abs_of_nonneg (by linarith [hε.2] : 0 ≤ 1-2*ε)] at hb + +theorem sharpProduction : SharpProduction := by + intro n g hg + refine ⟨?_,le_max_right _ _⟩ + unfold hybrid + have hm : |avg g| < 1 := abs_lt.mpr (CourtadeKumar.IsInterior.cubeAverage hg) + have hI : info g < H (avg g) := CourtadeKumar.IsInterior.information_lt_entropy hg + rw [reserve_eq hm hI,production_eq] + exact CourtadeKumar.all_soft_max_production g hg + +theorem fullMain : FullMain := + ⟨softContraction,softAttainment,softInformationIdentity,refinedBoolean, + booleanAttainment,bitsConversion,sharpProduction⟩ + +end SoftChannel204 +end +end + +end OAI diff --git a/lean/OAI/InformationTheory/SoftChannel/Model.lean b/lean/OAI/InformationTheory/SoftChannel/Model.lean new file mode 100644 index 0000000000000000000000000000000000000000..bfdd3bb6aaa898767c5577756ab2ac15ccd1e4eb --- /dev/null +++ b/lean/OAI/InformationTheory/SoftChannel/Model.lean @@ -0,0 +1,117 @@ +import Mathlib + +namespace OAI + +section +noncomputable section +open scoped BigOperators +namespace SoftChannel204 + +abbrev Cube (n : ℕ) := Fin n → Bool + +def sign (b : Bool) : ℝ := if b then 1 else -1 + +def avg {n : ℕ} (g : Cube n → ℝ) : ℝ := (∑ x, g x) / (2 : ℝ) ^ n + +def L : ℝ := Real.log 2 + +def psi (r : ℝ) : ℝ := + (1 + r) / 2 * Real.log (1 + r) + (1 - r) / 2 * Real.log (1 - r) + +def H (r : ℝ) : ℝ := L - psi r + +def info {n : ℕ} (u : Cube n → ℝ) : ℝ := H (avg u) - avg (H ∘ u) + +def psiInv (s : ℝ) : ℝ := Function.invFunOn psi (Set.Icc 0 1) s + +def kernel {n : ℕ} (ρ : ℝ) (x y : Cube n) : ℝ := + ∏ i, if x i = y i then (1 + ρ) / 2 else (1 - ρ) / 2 + +def noise {n : ℕ} (ρ : ℝ) (u : Cube n → ℝ) (y : Cube n) : ℝ := + ∑ x, kernel ρ y x * u x + +def Closed {n : ℕ} (u : Cube n → ℝ) : Prop := ∀ x, u x ∈ Set.Icc (-1) 1 + +def Interior {n : ℕ} (g : Cube n → ℝ) : Prop := ∀ x, g x ∈ Set.Ioo (-1) 1 + +def softCoordinate {n : ℕ} (i : Fin n) (a : ℝ) (x : Cube n) : ℝ := a * sign (x i) + +def flip {n : ℕ} (i : Fin n) (x : Cube n) : Cube n := Function.update x i (!(x i)) + +def numberOperator {n : ℕ} (g : Cube n → ℝ) (x : Cube n) : ℝ := + (1 / 2 : ℝ) * ∑ i, (g x - g (flip i x)) + +def production {n : ℕ} (g : Cube n → ℝ) : ℝ := + avg (fun x => Real.artanh (g x) * numberOperator g x) + +/-- Defined by this formula on `[0, L)`; no finite endpoint value at `L` is asserted. -/ +def F (s : ℝ) : ℝ := psiInv s * Real.artanh (psiInv s) + +/-- The excess `F s - 2 * s`, used for `s < L`, is extended by zero to negative arguments. -/ +def S (s : ℝ) : ℝ := if s < 0 then 0 else F s - 2 * s + +/-- The reserve is used for `|m| < 1` and `0 ≤ I < H m`. -/ +def reserve (m I : ℝ) : ℝ := + 2 * I + (1 - m ^ 2) * S (L - (H m - I) / (1 - m ^ 2)) + +def hybrid (m I : ℝ) : ℝ := max (reserve m I) (F I) + +def softJoint {n : ℕ} (ρ : ℝ) (u : Cube n → ℝ) (b : Bool) (y : Cube n) : ℝ := + avg (fun x => (1 + sign b * u x) / 2 * kernel ρ x y) + +def boolJoint {n : ℕ} (ρ : ℝ) (f : Cube n → Bool) (b : Bool) (y : Cube n) : ℝ := + avg (fun x => if f x = b then kernel ρ x y else 0) + +def leftMarginal {n : ℕ} (p : Bool → Cube n → ℝ) (b : Bool) : ℝ := ∑ y, p b y + +def rightMarginal {n : ℕ} (p : Bool → Cube n → ℝ) (y : Cube n) : ℝ := ∑ b, p b y + +def mutualInformation {n : ℕ} (p : Bool → Cube n → ℝ) : ℝ := + ∑ b, ∑ y, if 0 < p b y then + p b y * Real.log (p b y / (leftMarginal p b * rightMarginal p y)) else 0 + +def binaryEntropyBits (ε : ℝ) : ℝ := + -(ε * Real.log ε + (1 - ε) * Real.log (1 - ε)) / L + +def SoftContraction : Prop := ∀ (n : ℕ) (u : Cube n → ℝ), Closed u → + ∀ ρ ∈ Set.Icc (-1 : ℝ) 1, + info (noise ρ u) ≤ psi (|ρ| * psiInv (info u)) + +def SoftAttainment : Prop := ∀ (n : ℕ) (i : Fin n) (a : ℝ), |a| ≤ 1 → + ∀ ρ ∈ Set.Icc (-1 : ℝ) 1, + info (noise ρ (softCoordinate i a)) = + psi (|ρ| * psiInv (info (softCoordinate i a))) + +def SoftInformationIdentity : Prop := ∀ (n : ℕ) (u : Cube n → ℝ), Closed u → + ∀ ρ ∈ Set.Icc (-1 : ℝ) 1, + mutualInformation (softJoint ρ u) = info (noise ρ u) + +def RefinedBoolean : Prop := ∀ (n : ℕ) (f : Cube n → Bool) + (ρ : ℝ), ρ ∈ Set.Icc (-1 : ℝ) 1 → + let m := avg (sign ∘ f) + let bound := psi (|ρ| * psiInv (H m)) + mutualInformation (boolJoint ρ f) = info (noise ρ (sign ∘ f)) ∧ + mutualInformation (boolJoint ρ f) ≤ bound ∧ bound ≤ psi |ρ| ∧ + (0 < |m| → |m| < 1 → 0 < |ρ| → bound < psi |ρ|) + +def BooleanAttainment : Prop := ∀ (n : ℕ) (i : Fin n) + (ρ : ℝ), ρ ∈ Set.Icc (-1 : ℝ) 1 → + mutualInformation (boolJoint ρ (fun x => x i)) = psi |ρ| ∧ + mutualInformation (boolJoint ρ (fun x => !(x i))) = psi |ρ| + +def BitsConversion : Prop := ∀ (n : ℕ) (f : Cube n → Bool) + (ε : ℝ), ε ∈ Set.Icc (0 : ℝ) (1/2) → + psi (1 - 2 * ε) / L = 1 - binaryEntropyBits ε ∧ + mutualInformation (boolJoint (1 - 2 * ε) f) / L ≤ 1 - binaryEntropyBits ε + +def SharpProduction : Prop := ∀ (n : ℕ) (g : Cube n → ℝ), Interior g → + hybrid (avg g) (info g) ≤ production g ∧ F (info g) ≤ hybrid (avg g) (info g) + +def FullMain : Prop := SoftContraction ∧ SoftAttainment ∧ SoftInformationIdentity ∧ + RefinedBoolean ∧ BooleanAttainment ∧ BitsConversion ∧ SharpProduction + +end SoftChannel204 +end +end + +end OAI diff --git a/lean/OAI/InformationTheory/SoftChannel/NormalizedPair.lean b/lean/OAI/InformationTheory/SoftChannel/NormalizedPair.lean new file mode 100644 index 0000000000000000000000000000000000000000..6a0c21f34a5c8eeb3f644d1e346a9137a4553202 --- /dev/null +++ b/lean/OAI/InformationTheory/SoftChannel/NormalizedPair.lean @@ -0,0 +1,52 @@ +import OAI.InformationTheory.BooleanNoise.NormalizedPair +import OAI.InformationTheory.SoftChannel.LRegularity + +namespace OAI + +section + +open scoped BigOperators + +namespace LeanBlast.CourtadeKumar + +theorem NormalizedPair_normalized_pair_bound_of_antitone + (hanti : AntitoneOn L (Set.Ioi 0)) {a b : ℝ} (hab : |a| + |b| < 1) : + (1 - a ^ 2) * + L (((entropy (a + b) + entropy (a - b)) / 2) / (1 - a ^ 2)) ≤ + pairDissipation a b - 2 * pairEntropyGap a b := by + have hA := normalized_pair_scale_pos hab + have hs0 := pairEntropyGap_div_variance_nonneg a b hab + have hs1 := pairEntropyGap_div_variance_lt_ell a b hab + have hlow : 0 < ell - pairEntropyGap a b / (1 - a ^ 2) := sub_pos.mpr hs1 + have ha : |a| ≤ 1 := + (lt_of_le_of_lt (le_add_of_nonneg_right (abs_nonneg b)) hab).le + have hH := ell_mul_one_sub_sq_le_entropy ha + have hratio : ell - pairEntropyGap a b / (1 - a ^ 2) ≤ + ((entropy (a + b) + entropy (a - b)) / 2) / (1 - a ^ 2) := by + apply (le_div_iff₀ hA).mpr + calc + (ell - pairEntropyGap a b / (1 - a ^ 2)) * (1 - a ^ 2) = + ell * (1 - a ^ 2) - pairEntropyGap a b := by + field_simp + _ ≤ entropy a - pairEntropyGap a b := sub_le_sub_right hH _ + _ = (entropy (a + b) + entropy (a - b)) / 2 := by + unfold pairEntropyGap + ring + have hL := hanti hlow (hlow.trans_le hratio) hratio + rw [L_ell_sub hs0 hs1] at hL + have hr := normalized_pair_dissipation_ge_r hab + have hbound : + L (((entropy (a + b) + entropy (a - b)) / 2) / (1 - a ^ 2)) ≤ + (pairDissipation a b - 2 * pairEntropyGap a b) / (1 - a ^ 2) := by + calc + _ ≤ r (pairEntropyGap a b / (1 - a ^ 2)) - + 2 * (pairEntropyGap a b / (1 - a ^ 2)) := hL + _ ≤ pairDissipation a b / (1 - a ^ 2) - + 2 * (pairEntropyGap a b / (1 - a ^ 2)) := sub_le_sub_right hr _ + _ = _ := by ring + simpa only [mul_comm] using (le_div_iff₀ hA).mp hbound + +end LeanBlast.CourtadeKumar +end + +end OAI diff --git a/lean/OAI/InformationTheory/SoftChannel/PairEntropy.lean b/lean/OAI/InformationTheory/SoftChannel/PairEntropy.lean new file mode 100644 index 0000000000000000000000000000000000000000..957df0715338fec1483170546b422b42c9d85aed --- /dev/null +++ b/lean/OAI/InformationTheory/SoftChannel/PairEntropy.lean @@ -0,0 +1,57 @@ +import OAI.InformationTheory.BooleanNoise.PairEntropy +import OAI.InformationTheory.SoftChannel.CurvatureBounds + +namespace OAI + +section + +noncomputable section + +namespace LeanBlast.CourtadeKumar + +theorem PairEntropy_div_mem_Ioo (s b : ℝ) (hs : 0 < s) (hb : |b| < s) : + b / s ∈ Set.Ioo (-1) 1 := by + obtain ⟨hlo, hhi⟩ := abs_lt.mp hb + constructor + · apply (lt_div_iff₀ hs).2 + linarith + · apply (div_lt_iff₀ hs).2 + linarith + +theorem PairEntropy_weighted_psi_div (s b : ℝ) (hs : 0 < s) (hb : |b| < s) : + s / 2 * psi (b / s) = + (s + b) / 4 * Real.log (s + b) + (s - b) / 4 * Real.log (s - b) - + s / 2 * Real.log s := by + obtain ⟨hlo, hhi⟩ := abs_lt.mp hb + have hs0 : s ≠ 0 := ne_of_gt hs + have hp : s + b ≠ 0 := ne_of_gt (by linarith) + have hm : s - b ≠ 0 := ne_of_gt (by linarith) + have hplus : 1 + b / s = (s + b) / s := by field_simp + have hminus : 1 - b / s = (s - b) / s := by field_simp + rw [psi, hplus, hminus, Real.log_div hp hs0, Real.log_div hm hs0] + field_simp + ring + +theorem PairEntropy_pair_artanh_eq_log_sub (x : ℝ) (hx : x ∈ Set.Ioo (-1) 1) : + Real.artanh x = (Real.log (1 + x) - Real.log (1 - x)) / 2 := by + rw [Real.artanh_eq_half_log ⟨le_of_lt hx.1, le_of_lt hx.2⟩, + Real.log_div (ne_of_gt (by linarith [hx.1])) (ne_of_gt (by linarith [hx.2]))] + ring + +theorem PairEntropy_artanh_div (s b : ℝ) (hs : 0 < s) (hb : |b| < s) : + Real.artanh (b / s) = (Real.log (s + b) - Real.log (s - b)) / 2 := by + obtain ⟨hlo, hhi⟩ := abs_lt.mp hb + have hs0 : s ≠ 0 := ne_of_gt hs + have hp : s + b ≠ 0 := ne_of_gt (by linarith) + have hm : s - b ≠ 0 := ne_of_gt (by linarith) + have hplus : 1 + b / s = (s + b) / s := by field_simp + have hminus : 1 - b / s = (s - b) / s := by field_simp + rw [PairEntropy_pair_artanh_eq_log_sub _ (PairEntropy_div_mem_Ioo s b hs hb), hplus, hminus, + Real.log_div hp hs0, Real.log_div hm hs0] + ring + +end LeanBlast.CourtadeKumar +end +end + +end OAI diff --git a/lean/OAI/InformationTheory/SoftChannel/Payment.lean b/lean/OAI/InformationTheory/SoftChannel/Payment.lean new file mode 100644 index 0000000000000000000000000000000000000000..6d09f4cd50253b170e706a9fe76a56072a6b2cd3 --- /dev/null +++ b/lean/OAI/InformationTheory/SoftChannel/Payment.lean @@ -0,0 +1,284 @@ +import OAI.InformationTheory.SoftChannel.RateWindow + +namespace OAI + +section + +noncomputable section +open Set Filter MeasureTheory +open scoped Topology +namespace LeanBlast.CourtadeKumar +open SoftChannel204 + +def pairH (c d : ℝ) : ℝ := (entropy (c+d)+entropy (c-d))/2 +def thinX (c l : ℝ) : ℝ := 1-l*(1-c) +def thinI (c d l : ℝ) : ℝ := entropy (thinX c l)-l*pairH c d +def thinJ (c d l : ℝ) : ℝ := pairH (thinX c l) (l*d)-l*pairH c d + +lemma thinX_mem {c l : ℝ} (hc : c ∈ Ioo (-1) 1) (hl : l ∈ Ioc (0:ℝ) 1) : + thinX c l ∈ Ioo (-1) 1 := by + dsimp [thinX] + constructor + · have := mul_le_mul_of_nonneg_right hl.2 (show 0 ≤ 1-c by linarith [hc.2]) + nlinarith [hc.1] + · nlinarith [mul_pos hl.1 (show 0 < 1-c by linarith [hc.2])] + +lemma thinX_add (c d l : ℝ) : thinX c l+l*d=thinX (c+d) l := by unfold thinX; ring +lemma thinX_sub (c d l : ℝ) : thinX c l-l*d=thinX (c-d) l := by unfold thinX; ring + +lemma entropy_thinX {a l : ℝ} (ha : a ∈ Icc (-1) 1) (hl : l ∈ Icc (0:ℝ) 1) : + l*entropy a ≤ entropy (thinX a l) := by + have h := entropy_common_output ha hl + convert! h using 1 + congr 1 + unfold thinX + ring + +lemma entropy_thinX_strict {a l : ℝ} (ha : a ∈ Ioo (-1) 1) (hl : l ∈ Ioo (0:ℝ) 1) : + l*entropy a < entropy (thinX a l) := by + have hap : (1+a)/2 ∈ Icc (0:ℝ) 1 := by constructor <;> linarith [ha.1,ha.2] + have h := Real.strictConcave_binEntropy.2 (by norm_num : (1:ℝ) ∈ Icc 0 1) hap + (by linarith [ha.2] : (1:ℝ) ≠ (1+a)/2) (by linarith [hl.2] : 0 < 1-l) hl.1 + (by ring : 1-l+l=1) + rw [entropy_eq_binEntropy,entropy_eq_binEntropy] + simp only [smul_eq_mul,Real.binEntropy_one,mul_zero,zero_add,mul_one] at h + convert! h using 1 + congr 1 + unfold thinX + ring + +lemma thinJ_nonneg {c d l : ℝ} (hc : 0 ≤ c) (hd : 0 ≤ d) (hcd : c+d < 1) + (hl : l ∈ Ioc (0:ℝ) 1) : 0 ≤ thinJ c d l := by + have hh : |c|+|d| < 1 := by rw [abs_of_nonneg hc,abs_of_nonneg hd]; exact hcd + have ha := pair_add_mem_Ioo c d hh + have hb := pair_sub_mem_Ioo c d hh + have h₁ := entropy_thinX ⟨ha.1.le,ha.2.le⟩ ⟨hl.1.le,hl.2⟩ + have h₂ := entropy_thinX ⟨hb.1.le,hb.2.le⟩ ⟨hl.1.le,hl.2⟩ + dsimp [thinJ,pairH] + rw [thinX_add,thinX_sub] + linarith + +lemma thinJ_pos {c d l : ℝ} (hc : 0 ≤ c) (hd : 0 ≤ d) (hcd : c+d < 1) + (hl : l ∈ Ioo (0:ℝ) 1) : 0 < thinJ c d l := by + have hh : |c|+|d| < 1 := by rw [abs_of_nonneg hc,abs_of_nonneg hd]; exact hcd + have h₁ := entropy_thinX_strict (pair_add_mem_Ioo c d hh) hl + have h₂ := entropy_thinX_strict (pair_sub_mem_Ioo c d hh) hl + dsimp [thinJ,pairH] + rw [thinX_add,thinX_sub] + linarith + +lemma thinning_domain {c d l : ℝ} (hc : 0 ≤ c) (hd : 0 < d) (hcd : c+d < 1) + (hl : l ∈ Ioc (0:ℝ) 1) : + 0 ≤ thinX c l ∧ 0 < l*d ∧ thinX c l+l*d < 1 ∧ 0 < l*pairH c d := by + have hc1 : c < 1 := by linarith + have hh : |c|+|d| < 1 := by rw [abs_of_nonneg hc,abs_of_pos hd]; exact hcd + refine ⟨?_,mul_pos hl.1 hd,?_,mul_pos hl.1 (pair_entropyAverage_pos c d hh)⟩ + · dsimp [thinX] + have := mul_le_mul_of_nonneg_right hl.2 (show 0 ≤ 1-c by linarith) + nlinarith + · rw [thinX_add] + exact (thinX_mem (pair_add_mem_Ioo c d hh) hl).2 + +lemma thinJ_le_thinI {c d l : ℝ} (hc : 0 ≤ c) (hd : 0 < d) (hcd : c+d < 1) + (hl : l ∈ Ioc (0:ℝ) 1) : thinJ c d l ≤ thinI c d l := by + obtain ⟨hx,hy,hxy,_⟩ := thinning_domain hc hd hcd hl + have hh : |thinX c l|+|l*d| < 1 := by rw [abs_of_nonneg hx,abs_of_pos hy]; exact hxy + have h := pairEntropyGap_nonneg (thinX c l) (l*d) hh + dsimp [thinJ,thinI,pairH] + unfold pairEntropyGap at h + linarith + +lemma thinI_lt_ell {c d l : ℝ} (hc : 0 ≤ c) (hd : 0 < d) (hcd : c+d < 1) + (hl : l ∈ Ioc (0:ℝ) 1) : thinI c d l < ell := by + have hpos := (thinning_domain hc hd hcd hl).2.2.2 + have h := entropy_le_ell (thinX c l) + dsimp [thinI] + linarith + +lemma thinning_entropy_floor {c d l : ℝ} (hc : 0 ≤ c) (hd : 0 < d) (hcd : c+d < 1) + (hl : l ∈ Ioc (0:ℝ) 1) : + (1-thinX c l)*entropy (l*d/(1-thinX c l)) ≤ l*pairH c d := by + have hc0 : 1-c ≠ 0 := by linarith + have h := mul_le_mul_of_nonneg_left (pair_entropy_floor hc hd.le hcd) hl.1.le + have he : l*d/(1-thinX c l) = d/(1-c) := by + rw [show 1-thinX c l=l*(1-c) by dsimp [thinX]; ring] + field_simp [hl.1.ne',hc0] + rw [he] + dsimp [thinX,pairH] at * + nlinarith + +lemma thinning_path_window {c d l : ℝ} (hc : 0 ≤ c) (hd : 0 < d) (hcd : c+d < 1) + (hl : l ∈ Ioc (0:ℝ) 1) : + (∫ h in (ell-thinI c d l)..(ell-thinJ c d l), + clipKernel (Real.log (1+thinX c l)) h) ≤ + -(3/2:ℝ)*Real.log (1-(l*d)^2/(1+thinX c l)^2) := by + obtain ⟨hx,hy,hxy,_⟩ := thinning_domain hc hd hcd hl + have H := thinning_window hx hy hxy (thinning_entropy_floor hc hd hcd hl) + (show l*pairH c d ≤ (entropy (thinX c l+l*d)+entropy (thinX c l-l*d))/2 by + have := thinJ_nonneg hc hd.le hcd hl + dsimp [thinJ,pairH] at this ⊢ + linarith) + convert! H using 1; congr 1 <;> simp only [thinI,thinJ,entropy,pairH] <;> ring + +lemma entropy_euler {x : ℝ} (hx : x ∈ Ioo (-1) 1) : + entropy x-(1-x)*Real.artanh x = ell-Real.log (1+x) := by + rw [Real.artanh_eq_half_log ⟨hx.1.le,hx.2.le⟩, + Real.log_div (by linarith [hx.1] : 1+x ≠ 0) (by linarith [hx.2] : 1-x ≠ 0)] + unfold entropy psi + ring + +lemma log_pair_defect {x d : ℝ} (hx : 0 ≤ x) (hd : 0 < d) (hxd : x+d < 1) : + (Real.log (1+(x+d))+Real.log (1+(x-d)))/2 = + Real.log (1+x)+(1/2:ℝ)*Real.log (1-d^2/(1+x)^2) := by + have hp : 0 < 1+x := by linarith + have hpm : 0 < 1+(x-d) := by linarith + have hpp : 0 < 1+(x+d) := by linarith + have hr : 1-d^2/(1+x)^2 = ((1+(x+d))*(1+(x-d)))/(1+x)^2 := by field_simp; ring + rw [hr,Real.log_div (mul_ne_zero hpp.ne' hpm.ne') (pow_ne_zero _ hp.ne'), + Real.log_mul hpp.ne' hpm.ne',Real.log_pow] + ring + +lemma thinning_defect_nonneg {x d : ℝ} (hx : 0 ≤ x) (hd : 0 < d) (hxd : x+d < 1) : + 0 ≤ -(1/2:ℝ)*Real.log (1-d^2/(1+x)^2) := by + have hr : 0 < 1-d^2/(1+x)^2 := by + have hp : 0 < (1+x)^2 := sq_pos_of_pos (by linarith) + have hs : d^2 < (1+x)^2 := by + nlinarith [mul_pos (show 0 < 1+x-d by linarith) (show 0 < 1+x+d by linarith)] + linarith [(div_lt_one hp).mpr hs] + have hle : 1-d^2/(1+x)^2 ≤ 1 := sub_le_self _ (div_nonneg (sq_nonneg _) (sq_nonneg _)) + have hlog := Real.log_nonpos hr.le hle + linarith + +def thinIDeriv (c d l : ℝ) : ℝ := (1-c)*Real.artanh (thinX c l)-pairH c d +def thinJDeriv (c d l : ℝ) : ℝ := + ((1-(c+d))*Real.artanh (thinX (c+d) l)+(1-(c-d))*Real.artanh (thinX (c-d) l))/2-pairH c d + +def thinA (c l : ℝ) : ℝ := ell-Real.log (1+thinX c l) +def thinK (c d l : ℝ) : ℝ := -(1/2:ℝ)*Real.log (1-(l*d)^2/(1+thinX c l)^2) + +lemma hasDerivAt_thinX (c l : ℝ) : HasDerivAt (thinX c) (-(1-c)) l := by + convert! (((hasDerivAt_id l).mul_const (1-c)).const_sub 1) using 1; simp + +lemma hasDerivAt_entropy_thinX {c l : ℝ} (hc : c ∈ Ioo (-1) 1) (hl : l ∈ Ioc (0:ℝ) 1) : + HasDerivAt (fun z => entropy (thinX c z)) ((1-c)*Real.artanh (thinX c l)) l := by + convert! (hasDerivAt_entropy (thinX_mem hc hl)).comp l (hasDerivAt_thinX c l) using 1; ring + +lemma hasDerivAt_thinI {c d l : ℝ} (hc : 0 ≤ c) (hd : 0 < d) (hcd : c+d < 1) + (hl : l ∈ Ioc (0:ℝ) 1) : HasDerivAt (thinI c d) (thinIDeriv c d l) l := by + convert! + (hasDerivAt_entropy_thinX (show c ∈ Ioo (-1) 1 from ⟨by linarith,by linarith⟩) hl).sub + ((hasDerivAt_id l).mul_const (pairH c d)) using 1; simp [thinIDeriv] + +lemma hasDerivAt_thinJ {c d l : ℝ} (hc : 0 ≤ c) (hd : 0 < d) (hcd : c+d < 1) + (hl : l ∈ Ioc (0:ℝ) 1) : HasDerivAt (thinJ c d) (thinJDeriv c d l) l := by + have hh : |c|+|d| < 1 := by rw [abs_of_nonneg hc,abs_of_pos hd]; exact hcd + have h := (((hasDerivAt_entropy_thinX (pair_add_mem_Ioo c d hh) hl).add + (hasDerivAt_entropy_thinX (pair_sub_mem_Ioo c d hh) hl)).div_const 2).sub + ((hasDerivAt_id l).mul_const (pairH c d)) + convert! h using 1 + · ext z + simp [thinJ,pairH,thinX_add,thinX_sub] + · simp [thinJDeriv] + +lemma thinI_euler {c d l : ℝ} (hc : 0 ≤ c) (hd : 0 < d) (hcd : c+d < 1) + (hl : l ∈ Ioc (0:ℝ) 1) : l*thinIDeriv c d l = thinI c d l-thinA c l := by + have hx := thinX_mem (show c ∈ Ioo (-1) 1 by constructor <;> linarith) hl + have h := entropy_euler hx + dsimp [thinIDeriv,thinI,thinA,thinX] at * + nlinarith + +lemma thinJ_euler {c d l : ℝ} (hc : 0 ≤ c) (hd : 0 < d) (hcd : c+d < 1) + (hl : l ∈ Ioc (0:ℝ) 1) : l*thinJDeriv c d l = thinJ c d l-thinA c l-thinK c d l := by + have hh : |c|+|d| < 1 := by rw [abs_of_nonneg hc,abs_of_pos hd]; exact hcd + have h₁ := entropy_euler (thinX_mem (pair_add_mem_Ioo c d hh) hl) + have h₂ := entropy_euler (thinX_mem (pair_sub_mem_Ioo c d hh) hl) + obtain ⟨hx,hy,hxy,_⟩ := thinning_domain hc hd hcd hl + have hlog := log_pair_defect hx hy hxy + rw [thinX_add,thinX_sub] at hlog + dsimp [thinJDeriv,thinJ,thinA,thinK,pairH] + rw [thinX_add,thinX_sub] + simp only [thinX] at h₁ h₂ hlog ⊢ + nlinarith + +lemma continuous_thinI (c d : ℝ) : Continuous (thinI c d) := by + unfold thinI thinX + exact (continuous_entropy.comp (continuous_const.sub (continuous_id.mul continuous_const))).sub + (continuous_id.mul continuous_const) + +lemma continuous_thinJ (c d : ℝ) : Continuous (thinJ c d) := by + unfold thinJ pairH thinX + have he := continuous_entropy + fun_prop + +def normalizedDemand (c d l : ℝ) : ℝ := (r (thinI c d l)-r (thinJ c d l))/l + +def normalizedDemandDeriv (c d l : ℝ) : ℝ := + ((rDeriv (thinI c d l)*thinIDeriv c d l-rDeriv (thinJ c d l)*thinJDeriv c d l)*l- + (r (thinI c d l)-r (thinJ c d l)))/l^2 + +lemma hasDerivAt_normalizedDemand {c d l : ℝ} (hc : 0 ≤ c) (hd : 0 < d) (hcd : c+d < 1) + (hl : l ∈ Ioo (0:ℝ) 1) : HasDerivAt (normalizedDemand c d) (normalizedDemandDeriv c d l) l := by + have hl' : l ∈ Ioc (0:ℝ) 1 := ⟨hl.1,hl.2.le⟩ + have hj := thinJ_pos hc hd.le hcd hl + have hjI := thinJ_le_thinI hc hd hcd hl' + have hI := thinI_lt_ell hc hd hcd hl' + have h := (((hasDerivAt_r ⟨hj.trans_le hjI,hI⟩).comp l (hasDerivAt_thinI hc hd hcd hl')).sub + ((hasDerivAt_r ⟨hj,hjI.trans_lt hI⟩).comp l (hasDerivAt_thinJ hc hd hcd hl'))).div + (hasDerivAt_id l) hl.1.ne' + convert! h using 1; dsimp [normalizedDemand,normalizedDemandDeriv]; ring + +lemma normalizedDemandDeriv_nonneg {c d l : ℝ} (hc : 0 ≤ c) (hd : 0 < d) (hcd : c+d < 1) + (hl : l ∈ Ioo (0:ℝ) 1) : 0 ≤ normalizedDemandDeriv c d l := by + have hl' : l ∈ Ioc (0:ℝ) 1 := ⟨hl.1,hl.2.le⟩ + obtain ⟨hx,hy,hxy,_⟩ := thinning_domain hc hd hcd hl' + have hk : 0 ≤ thinK c d l := thinning_defect_nonneg hx hy hxy + have hw : (∫ h in (ell-thinI c d l)..(ell-thinJ c d l), + clipKernel (Real.log (1+thinX c l)) h) ≤ 3*thinK c d l := by + convert! thinning_path_window hc hd hcd hl' using 1; unfold thinK; ring + have H := rate_window_euler (thinJ_pos hc hd.le hcd hl) (thinJ_le_thinI hc hd hcd hl') + (thinI_lt_ell hc hd hcd hl') hk hw + have hI := thinI_euler hc hd hcd hl' + have hJ := thinJ_euler hc hd hcd hl' + change 0 ≤ ((thinI c d l-thinA c l)*rDeriv (thinI c d l)-r (thinI c d l))- + ((thinJ c d l-thinA c l)*rDeriv (thinJ c d l)-r (thinJ c d l))+ + rDeriv (thinJ c d l)*thinK c d l at H + unfold normalizedDemandDeriv + apply div_nonneg _ (sq_nonneg l) + nlinarith [congrArg (fun z => z*rDeriv (thinI c d l)) hI, + congrArg (fun z => z*rDeriv (thinJ c d l)) hJ] + +lemma common_output_payment {c d l : ℝ} (hc : 0 ≤ c) (hd : 0 < d) (hcd : c+d < 1) + (hl : l ∈ Ioc (0:ℝ) 1) : + r (thinI c d l)-r (thinJ c d l) ≤ l*r (pairEntropyGap c d) := by + have hdom (z : ℝ) (hz : z ∈ Icc l 1) : z ∈ Ioc (0:ℝ) 1 := ⟨hl.1.trans_le hz.1,hz.2⟩ + have hci : ContinuousOn (fun z => r (thinI c d z)) (Icc l 1) := by + apply continuousOn_r.comp (continuous_thinI c d).continuousOn + intro z hz + have h := hdom z hz + exact ⟨(thinJ_nonneg hc hd.le hcd h).trans (thinJ_le_thinI hc hd hcd h),thinI_lt_ell hc hd hcd h⟩ + have hcj : ContinuousOn (fun z => r (thinJ c d z)) (Icc l 1) := by + apply continuousOn_r.comp (continuous_thinJ c d).continuousOn + intro z hz + have h := hdom z hz + exact ⟨thinJ_nonneg hc hd.le hcd h,(thinJ_le_thinI hc hd hcd h).trans_lt (thinI_lt_ell hc hd hcd h)⟩ + have hmono : MonotoneOn (normalizedDemand c d) (Icc l 1) := by + apply monotoneOn_of_hasDerivWithinAt_nonneg (f' := normalizedDemandDeriv c d) (convex_Icc l 1) + · exact (hci.sub hcj).div continuousOn_id (fun z hz => (hdom z hz).1.ne') + · intro z hz + have hz' : z ∈ Ioo (0:ℝ) 1 := by rw [interior_Icc] at hz; exact ⟨hl.1.trans hz.1,hz.2⟩ + exact (hasDerivAt_normalizedDemand hc hd hcd hz').hasDerivWithinAt + · intro z hz + have hz' : z ∈ Ioo (0:ℝ) 1 := by rw [interior_Icc] at hz; exact ⟨hl.1.trans hz.1,hz.2⟩ + exact normalizedDemandDeriv_nonneg hc hd hcd hz' + have H := hmono ⟨le_rfl,hl.2⟩ ⟨hl.2,le_rfl⟩ hl.2 + have hI : thinI c d 1 = pairEntropyGap c d := by simp [thinI,thinX,pairH,pairEntropyGap] + have hJ : thinJ c d 1 = 0 := by simp [thinJ,thinX] + unfold normalizedDemand at H + rw [hI,hJ,r_zero,sub_zero,div_one] at H + exact (div_le_iff₀ hl.1).mp H |>.trans_eq (by ring) + +end LeanBlast.CourtadeKumar +end +end + +end OAI diff --git a/lean/OAI/InformationTheory/SoftChannel/PerspectiveCalculus.lean b/lean/OAI/InformationTheory/SoftChannel/PerspectiveCalculus.lean new file mode 100644 index 0000000000000000000000000000000000000000..8c678364c2d15697c7b66ad2ce94abd2afda0a32 --- /dev/null +++ b/lean/OAI/InformationTheory/SoftChannel/PerspectiveCalculus.lean @@ -0,0 +1,23 @@ +import OAI.InformationTheory.BooleanNoise.PerspectiveCalculus +import OAI.InformationTheory.SoftChannel.PerspectiveLogTrapezoid + +namespace OAI + +section + +noncomputable section + +open Set + +namespace LeanBlast.CourtadeKumar + +theorem PerspectiveCalculus_hasDerivAt_const_quotient (x v : ℝ) (hv : 0 < v) : + HasDerivAt (fun w : ℝ => x / w) (-x / v ^ 2) v := by + convert! (hasDerivAt_const v x).div (hasDerivAt_id v) (ne_of_gt hv) using 1; + simp + +end LeanBlast.CourtadeKumar +end +end + +end OAI diff --git a/lean/OAI/InformationTheory/SoftChannel/PerspectiveInequality.lean b/lean/OAI/InformationTheory/SoftChannel/PerspectiveInequality.lean new file mode 100644 index 0000000000000000000000000000000000000000..1d149d96e6a4638d6a15c48639cb39200dfeb018 --- /dev/null +++ b/lean/OAI/InformationTheory/SoftChannel/PerspectiveInequality.lean @@ -0,0 +1,23 @@ +import OAI.InformationTheory.BooleanNoise.PerspectiveInequality +import OAI.InformationTheory.SoftChannel.PerspectiveCalculus + +namespace OAI + +section + +noncomputable section + +open scoped BigOperators Topology +open Set Filter + +namespace LeanBlast.CourtadeKumar + +theorem PerspectiveInequality_sq_lt_one_of_nonneg {b : ℝ} (hb0 : 0 ≤ b) (hb1 : b < 1) : b ^ 2 < 1 := by + have h := mul_pos (sub_pos.mpr hb1) (show 0 < 1 + b by linarith) + nlinarith + +end LeanBlast.CourtadeKumar +end +end + +end OAI diff --git a/lean/OAI/InformationTheory/SoftChannel/PerspectiveLogTrapezoid.lean b/lean/OAI/InformationTheory/SoftChannel/PerspectiveLogTrapezoid.lean new file mode 100644 index 0000000000000000000000000000000000000000..b3d760ab418380dbeb5d07eac249a7b0eadb4ce9 --- /dev/null +++ b/lean/OAI/InformationTheory/SoftChannel/PerspectiveLogTrapezoid.lean @@ -0,0 +1,81 @@ +import OAI.InformationTheory.BooleanNoise.PerspectiveLogTrapezoid +import OAI.InformationTheory.SoftChannel.NormalizedPair + +namespace OAI + +section + +noncomputable section + +namespace LeanBlast.CourtadeKumar + +def PerspectiveLogTrapezoid_trapezoidGap (q w : ℝ) : ℝ := + (1 + w - 2 * q) * (Real.log (1 - q) - Real.log (w - q)) + + (1 + w) * Real.log w + +def PerspectiveLogTrapezoid_trapezoidGapDeriv (q w : ℝ) : ℝ := + Real.log (1 - q) - Real.log (w - q) - (1 + w - 2 * q) / (w - q) + + Real.log w + (1 + w) / w + +theorem PerspectiveLogTrapezoid_hasDerivAt_trapezoidGap (q w : ℝ) (hw0 : 0 < w) (hqw : q < w) : + HasDerivAt (PerspectiveLogTrapezoid_trapezoidGap q) (PerspectiveLogTrapezoid_trapezoidGapDeriv q w) w := by + have ha := ((hasDerivAt_id w).const_add (1 : ℝ)).sub_const (2 * q) + have hb := HasDerivAt.const_sub (Real.log (1 - q)) + (((hasDerivAt_id w).sub_const q).log (ne_of_gt (sub_pos.mpr hqw))) + have hc := ((hasDerivAt_id w).const_add (1 : ℝ)).mul + (Real.hasDerivAt_log (ne_of_gt hw0)) + convert! (ha.mul hb).add hc using 1 + dsimp [PerspectiveLogTrapezoid_trapezoidGap, PerspectiveLogTrapezoid_trapezoidGapDeriv] + ring + +theorem PerspectiveLogTrapezoid_trapezoidGapDeriv_nonpos (q w : ℝ) + (hq0 : 0 ≤ q) (hqw : q < w) (hw1 : w ≤ 1) : PerspectiveLogTrapezoid_trapezoidGapDeriv q w ≤ 0 := by + have hw0 : 0 < w := lt_of_le_of_lt hq0 hqw + have hd : 0 < w - q := sub_pos.mpr hqw + have hq1 : q < 1 := lt_of_lt_of_le hqw hw1 + have h1q : 0 < 1 - q := sub_pos.mpr hq1 + let r : ℝ := (1 - q) * w / (w - q) + have hr : 0 < r := div_pos (mul_pos h1q hw0) hd + have hlog := Real.log_le_sub_one_of_pos hr + have hlogeq : Real.log r = Real.log (1 - q) + Real.log w - Real.log (w - q) := by + dsimp [r] + rw [Real.log_div (ne_of_gt (mul_pos h1q hw0)) (ne_of_gt hd), + Real.log_mul (ne_of_gt h1q) (ne_of_gt hw0)] + rw [hlogeq] at hlog + have hrem : r - 1 + (1 + w) / w - (1 + w - 2 * q) / (w - q) = + -q * (1 - w) ^ 2 / (w * (w - q)) := by + dsimp [r] + field_simp [ne_of_gt hw0, ne_of_gt hd] + ring + have hrest : r - 1 + (1 + w) / w - (1 + w - 2 * q) / (w - q) ≤ 0 := by + rw [hrem] + exact div_nonpos_of_nonpos_of_nonneg + (mul_nonpos_of_nonpos_of_nonneg (neg_nonpos.mpr hq0) (sq_nonneg _)) + (mul_nonneg hw0.le hd.le) + unfold PerspectiveLogTrapezoid_trapezoidGapDeriv + linarith + +theorem PerspectiveLogTrapezoid_trapezoidGap_nonneg (q w : ℝ) + (hq0 : 0 ≤ q) (hqw : q < w) (hw1 : w ≤ 1) : 0 ≤ PerspectiveLogTrapezoid_trapezoidGap q w := by + have hw0 : 0 < w := lt_of_le_of_lt hq0 hqw + have hd (v : ℝ) (hv : v ∈ Set.Icc w 1) : + HasDerivAt (PerspectiveLogTrapezoid_trapezoidGap q) (PerspectiveLogTrapezoid_trapezoidGapDeriv q v) v := + PerspectiveLogTrapezoid_hasDerivAt_trapezoidGap q v (lt_of_lt_of_le hw0 hv.1) (lt_of_lt_of_le hqw hv.1) + have hanti : AntitoneOn (PerspectiveLogTrapezoid_trapezoidGap q) (Set.Icc w 1) := by + apply antitoneOn_of_deriv_nonpos (convex_Icc w 1) + · intro v hv + exact (hd v hv).continuousAt.continuousWithinAt + · intro v hv + exact (hd v (interior_subset hv)).differentiableAt.differentiableWithinAt + · intro v hv + have hvm : v ∈ Set.Icc w 1 := interior_subset hv + rw [(hd v hvm).deriv] + exact PerspectiveLogTrapezoid_trapezoidGapDeriv_nonpos q v hq0 (lt_of_lt_of_le hqw hvm.1) hvm.2 + have h := hanti ⟨le_refl w, hw1⟩ ⟨hw1, le_refl 1⟩ hw1 + simpa [PerspectiveLogTrapezoid_trapezoidGap] using h + +end LeanBlast.CourtadeKumar +end +end + +end OAI diff --git a/lean/OAI/InformationTheory/SoftChannel/Production.lean b/lean/OAI/InformationTheory/SoftChannel/Production.lean new file mode 100644 index 0000000000000000000000000000000000000000..6bb4caec49120da687a990ceaf550a7f67da8de2 --- /dev/null +++ b/lean/OAI/InformationTheory/SoftChannel/Production.lean @@ -0,0 +1,139 @@ +import OAI.InformationTheory.BooleanNoise.Attainment +import OAI.InformationTheory.BooleanNoise.CubeVariance +import OAI.InformationTheory.SoftChannel.Joining + +namespace OAI + +section + +noncomputable section +open Set Filter +open scoped BigOperators Topology +namespace LeanBlast.CourtadeKumar + +lemma IsInterior.neg_soft {n : ℕ} {g : Cube n → ℝ} (hg : IsInterior g) : + IsInterior (fun x => -g x) := by + intro x + constructor <;> linarith [(hg x).1,(hg x).2] + +lemma dissipation_neg_soft {n : ℕ} (g : Cube n → ℝ) (hg : IsInterior g) : + dissipation (fun x => -g x)=dissipation g := by + unfold dissipation cubeDerivative + congr 1 + funext i + congr 1 + funext x + dsimp only + rw [artanh_neg_interior (hg x)] + ring + +lemma IsInterior.information_lt_entropy {n : ℕ} {g : Cube n → ℝ} (hg : IsInterior g) : + informationDeficit g < entropy (CourtadeKumar.cubeAverage g) := by + unfold informationDeficit + linarith [hg.entropyAverage_pos] + +lemma IsInterior.information_mem {n : ℕ} {g : Cube n → ℝ} (hg : IsInterior g) : + informationDeficit g ∈ Ico 0 ell := + ⟨informationDeficit_nonneg hg,hg.information_lt_entropy.trans_le (entropy_le_ell _)⟩ + +lemma r_pooled_child_information {n : ℕ} (A B : Cube n → ℝ) + (hA : IsInterior A) (hB : IsInterior B) : + r ((informationDeficit A+informationDeficit B)/2) ≤ + (r (informationDeficit A)+r (informationDeficit B))/2 := by + have h := convexOn_r.2 hA.information_mem hB.information_mem + (by norm_num : (0:ℝ) ≤ 1/2) (by norm_num : (0:ℝ) ≤ 1/2) (by norm_num) + simpa only [smul_eq_mul, ← add_div, one_div_mul_eq_div] using h + +lemma ordered_positive_joining {n : ℕ} (A B : Cube n → ℝ) + (hA : IsInterior A) (hB : IsInterior B) (horder : cubeAverage B ≤ cubeAverage A) + (hm : 0 < (cubeAverage A+cubeAverage B)/2) + (hI : entropy ((cubeAverage A+cubeAverage B)/2)-(entropyAverage A+entropyAverage B)/2 ≤ softCutoff) : + r (entropy ((cubeAverage A+cubeAverage B)/2)-(entropyAverage A+entropyAverage B)/2) ≤ + (r (informationDeficit A)+r (informationDeficit B))/2+ + cubeAverage (fun x => joiningCost (A x) (B x)) := by + let m := (cubeAverage A+cubeAverage B)/2 + let d := (cubeAverage A-cubeAverage B)/2 + let e := (entropyAverage A+entropyAverage B)/2 + have hd : 0 ≤ d := by dsimp [d]; linarith + have ha : cubeAverage A=m+d := by dsimp [m,d]; ring + have hb : cubeAverage B=m-d := by dsimp [m,d]; ring + have herr : entropy m-e = entropy ((cubeAverage A+cubeAverage B)/2)-(entropyAverage A+entropyAverage B)/2 := rfl + have hj : pairH m d-e=(informationDeficit A+informationDeficit B)/2 := by + dsimp [pairH,informationDeficit,e]; rw [← ha,← hb]; ring + have hp : e ≤ pairH m d := by + have h1 := informationDeficit_nonneg hA + have h2 := informationDeficit_nonneg hB + nlinarith [hj] + have hc : wallDemand m d e ≤ cubeAverage (fun x => joiningCost (A x) (B x)) := by + rcases hd.eq_or_lt with hd | hd + · have hd0 : d=0 := hd.symm + simp only [wallDemand,hd0,pairH,add_zero,sub_zero,add_self_div_two,sub_self] + exact cubeAverage_nonneg (fun x => joiningCost_nonneg (hA x) (hB x)) + · exact low_information_joining A B hA hB hm hd + (by rw [← ha]; exact hA.cubeAverage.2) ha hb hp hI + have hpool := r_pooled_child_information A B hA hB + dsimp [wallDemand] at hc + rw [hj] at hc + linarith + +lemma positive_joining {n : ℕ} (A B : Cube n → ℝ) + (hA : IsInterior A) (hB : IsInterior B) + (hm : 0 < (cubeAverage A+cubeAverage B)/2) + (hI : entropy ((cubeAverage A+cubeAverage B)/2)-(entropyAverage A+entropyAverage B)/2 ≤ softCutoff) : + r (entropy ((cubeAverage A+cubeAverage B)/2)-(entropyAverage A+entropyAverage B)/2) ≤ + (r (informationDeficit A)+r (informationDeficit B))/2+ + cubeAverage (fun x => joiningCost (A x) (B x)) := by + rcases le_total (cubeAverage B) (cubeAverage A) with hab | hab + · exact ordered_positive_joining A B hA hB hab hm hI + · have h := ordered_positive_joining B A hB hA hab + (by simpa only [add_comm] using hm) (by simpa only [add_comm] using hI) + simpa only [add_comm, joiningCost_symm] using h + +lemma all_soft_meanReserve {n : ℕ} (g : Cube n → ℝ) (hg : IsInterior g) : + meanReserve (cubeAverage g) (informationDeficit g) ≤ dissipation g := by + have h := all_soft_reserve g hg + convert! h using 1 + simp only [meanReserve,meanVariance,informationDeficit] + ring_nf + +theorem all_soft_sharp_production {n : ℕ} (g : Cube n → ℝ) (hg : IsInterior g) : + r (informationDeficit g) ≤ dissipation g := by + induction n with + | zero => simp only [informationDeficit_dim_zero,dissipation_dim_zero,r_zero]; exact le_rfl + | succ n ih => + have positive (G : Cube (n+1) → ℝ) (hG : IsInterior G) (hm : 0 < cubeAverage G) : + r (informationDeficit G) ≤ dissipation G := by + by_cases hI : softCutoff ≤ informationDeficit G + · exact (high_information_reserve (abs_lt.mpr hG.cubeAverage) hI hG.information_lt_entropy).trans + (all_soft_meanReserve G hG) + · have hj := positive_joining (restrict G true) (restrict G false) + (hG.restrict true) (hG.restrict false) + (by rwa [← cubeAverage_split]) + (by rw [← cubeAverage_split, ← entropyAverage_split]; exact (le_of_not_ge hI)) + have hc : (fun x => joiningCost (restrict G true x) (restrict G false x))= + (fun x => pairDissipation (pairMean G x) (pairHalfDifference G x)) := by + funext x + rw [← pairMean_add_halfDifference G x,← pairMean_sub_halfDifference G x,joiningCost_pair] + rw [← cubeAverage_split, ← entropyAverage_split,hc] at hj + have ht := ih (restrict G true) (hG.restrict true) + have hf := ih (restrict G false) (hG.restrict false) + rw [dissipation_split] + change r (entropy (cubeAverage G)-entropyAverage G) ≤ _ + linarith + rcases lt_trichotomy 0 (cubeAverage g) with hm | hm | hm + · exact positive g hg hm + · have h := all_soft_meanReserve g hg + rw [← hm,meanReserve_zero_mean hg.information_mem] at h + exact h + · have h := positive (fun x => -g x) hg.neg_soft (by rw [cubeAverage_neg]; linarith) + rwa [informationDeficit_neg,dissipation_neg_soft g hg] at h + +theorem all_soft_max_production {n : ℕ} (g : Cube n → ℝ) (hg : IsInterior g) : + max (meanReserve (cubeAverage g) (informationDeficit g)) (r (informationDeficit g)) ≤ dissipation g := + max_le (all_soft_meanReserve g hg) (all_soft_sharp_production g hg) + +end LeanBlast.CourtadeKumar +end +end + +end OAI diff --git a/lean/OAI/InformationTheory/SoftChannel/RateSlope.lean b/lean/OAI/InformationTheory/SoftChannel/RateSlope.lean new file mode 100644 index 0000000000000000000000000000000000000000..c62353e6101072510dffbb301b40ee2e6f020546 --- /dev/null +++ b/lean/OAI/InformationTheory/SoftChannel/RateSlope.lean @@ -0,0 +1,92 @@ +import OAI.InformationTheory.SoftChannel.HighReserve + +namespace OAI + +section + +noncomputable section +open Set Filter +open scoped Topology BigOperators +namespace LeanBlast.CourtadeKumar + +def slopeT (z : ℝ) : ℝ := 1+z/3+z^2/5 +def slopePolynomial (z : ℝ) : ℝ := + 2*(1-z)^2*slopeT z^2*((1-z)*slopeT z+1)-curvatureN z +def RateSlope_slopeBernstein : Fin 10 → ℝ := + ![(8/3:ℝ), + (512/225:ℝ), + (334/175:ℝ), + (5861/3750:ℝ), + (93828088/75796875:ℝ), + (102326753/109484375:ℝ), + (8980934524/13685546875:ℝ), + (71721266999/175957031250:ℝ), + (9531748404/48876953125:ℝ), + (18341751592/733154296875:ℝ)] + +lemma RateSlope_slopeBernstein_pos (i : Fin 10) : 0 < RateSlope_slopeBernstein i := by + fin_cases i <;> norm_num [RateSlope_slopeBernstein] + +lemma slopePolynomial_bernstein (t : ℝ) : + slopePolynomial ((3/5)*t) = bernsteinSum 9 RateSlope_slopeBernstein t := by + unfold bernsteinSum + simp_rw [Nat.choose_eq_descFactorial_div_factorial] + norm_num [slopePolynomial,slopeT,curvatureN,RateSlope_slopeBernstein,Fin.sum_univ_succ, + Nat.descFactorial,Nat.factorial] + ring + +lemma slopePolynomial_pos {z : ℝ} (hz : z ∈ Icc 0 (3/5:ℝ)) : 0 < slopePolynomial z := by + have h := bernsteinSum_pos 9 RateSlope_slopeBernstein RateSlope_slopeBernstein_pos (by linarith [hz.1] : 0 ≤ (5/3:ℝ)*z) + (by linarith [hz.2] : (5/3:ℝ)*z ≤ 1) + rw [← slopePolynomial_bernstein] at h + convert! h using 1; congr 1; ring + +lemma slopeT_lower {u : ℝ} (hu : u ∈ Ioo 0 1) : u*slopeT (u^2) ≤ Real.artanh u := by + have h := sum_range_artanh_le hu.1.le hu.2 3 + norm_num [Finset.sum_range_succ] at h + convert! h using 1; unfold slopeT; ring + +lemma r_slope_bound_psi {u : ℝ} (hu : u ∈ Ioo 0 1) (hu2 : u^2 ≤ (3/5:ℝ)) : + rSecondDeriv (psi u) < 2*rDeriv (psi u) := by + have ha : 0 < 1-u^2 := by linarith + have hv := Real.artanh_pos hu + have ht : 0 < slopeT (u^2) := by unfold slopeT; positivity + have hT := slopeT_lower hu + have hN := curvatureNumerator_upper hu.1 hu.2 + have hP := slopePolynomial_pos ⟨sq_nonneg u,hu2⟩ + unfold slopePolynomial at hP + have hn := (div_le_iff₀ (pow_pos hu.1 3)).mp hN + have hn' := (mul_le_mul_of_nonneg_right hn ha.le) + have hcancel : (curvatureN (u^2)/(1-u^2)*u^3)*(1-u^2) = curvatureN (u^2)*u^3 := by field_simp + rw [hcancel] at hn' + have hc := mul_pos hP (pow_pos hu.1 3) + have hp2 := pow_le_pow_left₀ (mul_pos hu.1 ht).le hT 2 + have hp3 := pow_le_pow_left₀ (mul_pos hu.1 ht).le hT 3 + have hm2 := mul_le_mul_of_nonneg_left hp2 (show 0 ≤ 2*(1-u^2)^2*u by exact mul_nonneg (by positivity) hu.1.le) + have hm3 := mul_le_mul_of_nonneg_left hp3 (show 0 ≤ 2*(1-u^2)^3 by positivity) + rw [rSecondDeriv_psi hu,rDeriv_psi hu] + apply (div_lt_iff₀ (mul_pos (sq_pos_of_pos ha) (pow_pos hv 3))).mpr + have hden : (1+u/((1-u^2)*Real.artanh u))*((1-u^2)^2*Real.artanh u^3) = + (1-u^2)^2*Real.artanh u^3+u*(1-u^2)*Real.artanh u^2 := by field_simp + rw [mul_assoc,hden] + have hcore : ((1+u^2)*Real.artanh u-u)*(1-u^2) < + (2*((1-u^2)^2*Real.artanh u^3+u*(1-u^2)*Real.artanh u^2))*(1-u^2) := by + nlinarith + exact (mul_lt_mul_iff_left₀ ha).mp (by simpa only [mul_comm (1-u^2)] using hcore) + +lemma r_slope_bound {I : ℝ} (hI : I ∈ Icc 0 softCutoff) : rSecondDeriv I < 2*rDeriv I := by + rcases hI.1.eq_or_lt with rfl | hI0 + · norm_num + have hIL := hI.2.trans_lt softCutoff_lt_ell + have hu := psiInv_mem_Ioo ⟨hI0,hIL⟩ + have hule : psiInv I ≤ (77/100:ℝ) := by + apply (strictMonoOn_psi.le_iff_le ⟨hu.1.le,hu.2.le⟩ (by norm_num)).mp + rw [psi_psiInv hI0.le hIL]; exact hI.2 + have h := r_slope_bound_psi hu (by nlinarith [hu.1]) + rwa [psi_psiInv hI0.le hIL] at h + +end LeanBlast.CourtadeKumar +end +end + +end OAI diff --git a/lean/OAI/InformationTheory/SoftChannel/RateWindow.lean b/lean/OAI/InformationTheory/SoftChannel/RateWindow.lean new file mode 100644 index 0000000000000000000000000000000000000000..8bb2a1222102044c67f9ed39d907ff5b7b958c11 --- /dev/null +++ b/lean/OAI/InformationTheory/SoftChannel/RateWindow.lean @@ -0,0 +1,75 @@ +import OAI.InformationTheory.SoftChannel.Window + +namespace OAI + +section + +noncomputable section +open Set Filter MeasureTheory +open scoped Topology +namespace LeanBlast.CourtadeKumar +open SoftChannel204 + +lemma continuousAt_rSecondDeriv {s : ℝ} (hs : s ∈ Ioo (0:ℝ) ell) : + ContinuousAt rSecondDeriv s := by + have hu := psiInv_mem_Ioo hs + have hi := continuousAt_psiInv hs + have ht := (hasDerivAt_artanh ⟨by linarith [hu.1],hu.2⟩).continuousAt.comp hi + have ht0 : Real.artanh (psiInv s) ≠ 0 := (Real.artanh_pos hu).ne' + have hq0 : 1-(psiInv s)^2 ≠ 0 := by nlinarith [hu.1,hu.2] + have hc := (((continuousAt_const (y := (1:ℝ))).add (hi.pow 2)).mul ht |>.sub hi).div + (((continuousAt_const.sub (hi.pow 2)).pow 2).mul (ht.pow 3)) + (mul_ne_zero (pow_ne_zero _ hq0) (pow_ne_zero _ ht0)) + apply hc.congr_of_eventuallyEq + filter_upwards [Ioi_mem_nhds hs.1] with x hx + simp [rSecondDeriv,ite_eq_right (not_le.mpr (show 0 ring + +lemma rate_window_euler {v I b k : ℝ} (hv : 0 < v) (hvI : v ≤ I) (hI : I < ell) + (hk : 0 ≤ k) + (hwindow : (∫ h in (ell-I)..(ell-v), clipKernel b h) ≤ 3*k) : + 0 ≤ ((I-(ell-b))*rDeriv I-r I)-((v-(ell-b))*rDeriv v-r v)+rDeriv v*k := by + have hdom : ∀ u ∈ uIcc v I, u ∈ Ioo (0:ℝ) ell := by + intro u hu + rw [uIcc_of_le hvI] at hu + exact ⟨hv.trans_le hu.1,hu.2.trans_lt hI⟩ + have hfc : ContinuousOn (fun u => (u-(ell-b))*rSecondDeriv u) (uIcc v I) := by + intro u hu + exact ((continuousAt_id.sub continuousAt_const).mul + (continuousAt_rSecondDeriv (hdom u hu))).continuousWithinAt + have hkc : ContinuousOn (fun u => -(2/3:ℝ)*clipKernel b (ell-u)) (uIcc v I) := by + intro u hu + exact (continuousAt_const.mul ((continuousAt_clipKernel b (by dsimp; linarith [(hdom u hu).2])).comp + (continuousAt_const.sub continuousAt_id))).continuousWithinAt + have hder : ∀ u ∈ uIcc v I, + HasDerivAt (fun z => (z-(ell-b))*rDeriv z-r z) ((u-(ell-b))*rSecondDeriv u) u := by + intro u hu + convert! (((hasDerivAt_id u).sub_const (ell-b)).mul (hasDerivAt_rDeriv (hdom u hu))).sub + (hasDerivAt_r (hdom u hu)) using 1; dsimp; ring + have heq := intervalIntegral.integral_eq_sub_of_hasDerivAt hder hfc.intervalIntegrable + have hcomp := intervalIntegral.integral_mono_on (μ := volume) hvI hkc.intervalIntegrable hfc.intervalIntegrable + (fun u hu => rate_window_point (hdom u (by rwa [uIcc_of_le hvI]))) + rw [intervalIntegral.integral_const_mul, intervalIntegral.integral_comp_sub_left] at hcomp + rw [heq] at hcomp + have hsl := mul_le_mul_of_nonneg_right (rDeriv_ge_two hv.le (hvI.trans_lt hI)) hk + nlinarith + +end LeanBlast.CourtadeKumar +end +end + +end OAI diff --git a/lean/OAI/InformationTheory/SoftChannel/Rearrangement.lean b/lean/OAI/InformationTheory/SoftChannel/Rearrangement.lean new file mode 100644 index 0000000000000000000000000000000000000000..f58402c0c81d0a54a40503326c4c0f64aba5b8aa --- /dev/null +++ b/lean/OAI/InformationTheory/SoftChannel/Rearrangement.lean @@ -0,0 +1,25 @@ +import OAI.InformationTheory.BooleanNoise.Rearrangement +import OAI.InformationTheory.SoftChannel.Wall + +namespace OAI + +section + +noncomputable section + +open scoped BigOperators + +namespace LeanBlast.CourtadeKumar + +variable {n : ℕ} + +theorem Rearrangement_rearrangement_sign_bounds {F : Cube n → ℝ} (hF : IsSignValued F) : + ∀ y, -1 ≤ F y ∧ F y ≤ 1 := by + intro y + rcases hF y with h | h <;> rw [h] <;> norm_num + +end LeanBlast.CourtadeKumar +end +end + +end OAI diff --git a/lean/OAI/InformationTheory/SoftChannel/SemigroupFlow.lean b/lean/OAI/InformationTheory/SoftChannel/SemigroupFlow.lean new file mode 100644 index 0000000000000000000000000000000000000000..228774d9f5a7df86fe064cf28fb6b791e1a2352b --- /dev/null +++ b/lean/OAI/InformationTheory/SoftChannel/SemigroupFlow.lean @@ -0,0 +1,51 @@ +import OAI.InformationTheory.BooleanNoise.SemigroupFlow +import OAI.InformationTheory.SoftChannel.Rearrangement + +namespace OAI + +section + +noncomputable section + +open scoped BigOperators Topology +open Filter + +namespace LeanBlast.CourtadeKumar + +variable {n : ℕ} + +theorem SemigroupFlow_noiseKernel_flip_derivative_term (u : ℝ) + (x y : Cube n) (i : Fin n) : + (∏ j ∈ Finset.univ.erase i, + if x j = y j then (1 + u) / 2 else (1 - u) / 2) * + (if x i = y i then -u / 2 else u / 2) = + -((noiseKernel u x y - noiseKernel u (flip i x) y) / 2) := by + have hrest : (∏ j ∈ Finset.univ.erase i, + if (flip i x) j = y j then (1 + u) / 2 else (1 - u) / 2) = + ∏ j ∈ Finset.univ.erase i, + if x j = y j then (1 + u) / 2 else (1 - u) / 2 := by + apply Finset.prod_congr rfl + intro j hj + have hji := (Finset.mem_erase.mp hj).1 + simp only [flip, LeanBlast.GotsmanLinial.flip, Function.update_of_ne hji] + rw [noiseKernel_split_coord u x y i, noiseKernel_split_coord u (flip i x) y i, hrest] + cases hx : x i <;> cases hy : y i <;> + simp [flip, LeanBlast.GotsmanLinial.flip, hx] <;> ring + +theorem SemigroupFlow_hasDerivAt_noise_factor (x y : Cube n) (i : Fin n) (t : ℝ) : + HasDerivAt (fun s : ℝ => + if x i = y i then (1 + Real.exp (-s)) / 2 else (1 - Real.exp (-s)) / 2) + (if x i = y i then -Real.exp (-t) / 2 else Real.exp (-t) / 2) t := by + have hu : HasDerivAt (fun s : ℝ => Real.exp (-s)) (-Real.exp (-t)) t := by + simpa using (hasDerivAt_id t).neg.exp + by_cases hxy : x i = y i + · simp only [ite_eq_left hxy] + exact (hu.const_add 1).div_const 2 + · simp only [ite_eq_right hxy] + simpa using (hu.const_sub 1).div_const 2 + +end LeanBlast.CourtadeKumar +end +end + +end OAI diff --git a/lean/OAI/InformationTheory/SoftChannel/SoftInformation.lean b/lean/OAI/InformationTheory/SoftChannel/SoftInformation.lean new file mode 100644 index 0000000000000000000000000000000000000000..d205369ca5054a64de05692fcedc729b9d843409 --- /dev/null +++ b/lean/OAI/InformationTheory/SoftChannel/SoftInformation.lean @@ -0,0 +1,168 @@ +import OAI.InformationTheory.SoftChannel.Contraction + +namespace OAI + +section + +noncomputable section +open Set Filter +open scoped BigOperators Topology +namespace LeanBlast.CourtadeKumar + +def softJointNat {n : ℕ} (ρ : ℝ) (g : Cube n → ℝ) (b : Bool) (y : Cube n) : ℝ := + cubeAverage (fun x => signProbability (g x) b * noiseKernel ρ x y) + +def boolJointNat {n : ℕ} (ρ : ℝ) (f : Cube n → Bool) (b : Bool) (y : Cube n) : ℝ := + cubeAverage (fun x => if f x=b then noiseKernel ρ x y else 0) + +universe u v + +def mutualInformationNat {A : Type u} {B : Type v} [Fintype A] [Fintype B] (p : A → B → ℝ) : ℝ := + ∑ a, ∑ b, if 0 < p a b then p a b * Real.log (p a b / ((∑ y, p a y)*(∑ x, p x b))) else 0 + +lemma noiseKernel_nonneg_closed {n : ℕ} {ρ : ℝ} (hρ : ρ ∈ Icc (-1) 1) (x y : Cube n) : + 0 ≤ noiseKernel ρ x y := by + apply Finset.prod_nonneg + intro i _ + split_ifs <;> linarith [hρ.1,hρ.2] + +lemma signProbability_nonneg_soft {v : ℝ} (hv : v ∈ Icc (-1) 1) (b : Bool) : + 0 ≤ signProbability v b := by + cases b <;> simp only [signProbability, Bool.false_eq_true, ite_false, ite_true] <;> linarith [hv.1,hv.2] + +lemma softJointNat_nonneg {n : ℕ} {ρ : ℝ} (hρ : ρ ∈ Icc (-1) 1) + (g : Cube n → ℝ) (hg : IsClosedSoft g) (b : Bool) (y : Cube n) : + 0 ≤ softJointNat ρ g b y := + cubeAverage_nonneg (fun x => mul_nonneg (signProbability_nonneg_soft (hg x) b) (noiseKernel_nonneg_closed hρ x y)) + +lemma softJointNat_posterior {n : ℕ} (ρ : ℝ) (g : Cube n → ℝ) (b : Bool) (y : Cube n) : + softJointNat ρ g b y=signProbability (noiseOperator ρ g y) b / (2:ℝ)^n := by + unfold softJointNat cubeAverage + simp_rw [noiseKernel_symm ρ _ y,mul_comm (signProbability _ b)] + change noiseOperator ρ (fun x => signProbability (g x) b) y / (2:ℝ)^n = _ + rw [noiseOperator_signProbability] + +lemma softJointNat_left {n : ℕ} (ρ : ℝ) (g : Cube n → ℝ) (b : Bool) : + (∑ y, softJointNat ρ g b y)=signProbability (cubeAverage g) b := by + simp_rw [softJointNat_posterior] + rw [← Finset.sum_div] + change cubeAverage (fun y => signProbability (noiseOperator ρ g y) b)=_ + rw [cubeAverage_signProbability,cubeAverage_noiseOperator] + +lemma softJointNat_right {n : ℕ} (ρ : ℝ) (g : Cube n → ℝ) (y : Cube n) : + (∑ b, softJointNat ρ g b y)=1/(2:ℝ)^n := by + simp_rw [softJointNat_posterior] + rw [← Finset.sum_div,sum_signProbability] + +lemma softJointNat_total {n : ℕ} (ρ : ℝ) (g : Cube n → ℝ) : + (∑ b, ∑ y, softJointNat ρ g b y)=1 := by + simp_rw [softJointNat_left] + exact sum_signProbability _ + +lemma softJointNat_xlogx_bool {n : ℕ} (ρ : ℝ) (g : Cube n → ℝ) (y : Cube n) : + (∑ b, xlogx (softJointNat ρ g b y))=xlogx (((2:ℝ)^n)⁻¹)- + entropy (noiseOperator ρ g y)/(2:ℝ)^n := by + simp_rw [softJointNat_posterior,div_eq_mul_inv,xlogx_mul] + rw [Finset.sum_add_distrib,← Finset.sum_mul,← Finset.mul_sum, + sum_signProbability,sum_xlogx_signProbability] + ring + +theorem soft_information_identity {n : ℕ} (g : Cube n → ℝ) (hg : IsClosedSoft g) + {ρ : ℝ} (hρ : ρ ∈ Icc (-1) 1) : + mutualInformationNat (softJointNat ρ g)=informationDeficit (noiseOperator ρ g) := by + unfold mutualInformationNat + rw [finite_kl_eq_entropy_sums _ (softJointNat_nonneg hρ g hg)] + have hj : (∑ b, ∑ y, xlogx (softJointNat ρ g b y))= + (2:ℝ)^n*xlogx (((2:ℝ)^n)⁻¹)-entropyAverage (noiseOperator ρ g) := by + rw [Finset.sum_comm] + simp_rw [softJointNat_xlogx_bool] + simp [Finset.sum_sub_distrib,entropyAverage,cubeAverage,Finset.sum_div] + rw [hj] + simp_rw [softJointNat_left,softJointNat_right] + rw [sum_xlogx_signProbability] + simp only [Finset.sum_const,Finset.card_univ,card_cube,nsmul_eq_mul,Nat.cast_pow,Nat.cast_ofNat] + unfold informationDeficit + rw [cubeAverage_noiseOperator] + simp only [one_div] + ring + +lemma boolJointNat_eq_soft {n : ℕ} (ρ : ℝ) (f : Cube n → Bool) : + boolJointNat ρ f=softJointNat ρ (signEncoding f) := by + funext b y + unfold boolJointNat softJointNat + congr 1 + funext x + rw [signProbability_signEncoding] + split_ifs <;> simp + +lemma signEncoding_closed {n : ℕ} (f : Cube n → Bool) : IsClosedSoft (signEncoding f) := by + intro x + cases hfx : f x <;> simp [signEncoding,hfx] + +lemma information_signEncoding {n : ℕ} (f : Cube n → Bool) : + informationDeficit (signEncoding f)=entropy (cubeAverage (signEncoding f)) := by + rw [informationDeficit,entropyAverage_eq_zero_of_signValued _ (isSignValued_signEncoding f),sub_zero] + +lemma bool_information_identity {n : ℕ} (f : Cube n → Bool) + {ρ : ℝ} (hρ : ρ ∈ Icc (-1) 1) : + mutualInformationNat (boolJointNat ρ f)=informationDeficit (noiseOperator ρ (signEncoding f)) := by + rw [boolJointNat_eq_soft] + exact soft_information_identity _ (signEncoding_closed f) hρ + +lemma psi_abs_soft (v : ℝ) : psi |v|=psi v := by + by_cases hv : 0 ≤ v + · rw [abs_of_nonneg hv] + · rw [abs_of_neg (lt_of_not_ge hv),psi_neg] + +lemma psiInv_psi_abs {v : ℝ} (hv : |v| ≤ 1) : psiInv (psi v)=|v| := by + rw [← psi_abs_soft v] + exact psiInv_psi ⟨abs_nonneg _,hv⟩ + +lemma refined_curve_le {m ρ : ℝ} (hm : m ∈ Icc (-1) 1) (hρ : ρ ∈ Icc 0 1) : + psi (ρ*psiInv (entropy m)) ≤ psi ρ := by + have ha := psiInv_mem_Icc ⟨entropy_nonneg hm,entropy_le_ell m⟩ + have har : ρ*psiInv (entropy m) ≤ ρ := mul_le_of_le_one_right hρ.1 ha.2 + exact strictMonoOn_psi.monotoneOn ⟨mul_nonneg hρ.1 ha.1,har.trans hρ.2⟩ hρ har + +lemma refined_curve_strict {m ρ : ℝ} (hm : 0 < |m|) (hm1 : |m| < 1) (hρ : ρ ∈ Ioc 0 1) : + psi (ρ*psiInv (entropy m)) < psi ρ := by + have hp : 0 < psi m := by rw [← psi_abs_soft]; exact psi_pos_of_pos hm hm1.le + have he : entropy m < ell := by dsimp [entropy]; linarith + have ha := psiInv_mem_Ico (entropy_nonneg (abs_le.mp hm1.le)) he + have har : ρ*psiInv (entropy m)<ρ := mul_lt_of_lt_one_right hρ.1 ha.2 + exact strictMonoOn_psi ⟨mul_nonneg hρ.1.le ha.1,har.le.trans hρ.2⟩ ⟨hρ.1.le,hρ.2⟩ har + +theorem refined_boolean_bound {n : ℕ} (f : Cube n → Bool) + {ρ : ℝ} (hρ : ρ ∈ Icc (-1) 1) : + mutualInformationNat (boolJointNat ρ f) ≤ + psi (|ρ| * psiInv (entropy (cubeAverage (signEncoding f)))) := by + rw [bool_information_identity f hρ] + have h := all_soft_contraction (signEncoding f) (signEncoding_closed f) hρ + rwa [information_signEncoding] at h + +lemma information_scaled_coordinate {n : ℕ} (i : Fin n) (a : ℝ) : + informationDeficit (fun x => a*signEncoding (dictator i) x)=psi a := by + have he : (fun x => a*signEncoding (dictator i) x)=noiseOperator a (signEncoding (dictator i)) := by + funext x + rw [noiseOperator_dictator] + rw [he,informationDeficit_noise_dictator] + +lemma information_noise_scaled_coordinate {n : ℕ} (i : Fin n) (a ρ : ℝ) : + informationDeficit (noiseOperator ρ (fun x => a*signEncoding (dictator i) x))=psi (ρ*a) := by + have he : noiseOperator ρ (fun x => a*signEncoding (dictator i) x)= + fun x => (ρ*a)*signEncoding (dictator i) x := by + funext x + rw [noiseOperator_smul,noiseOperator_dictator] + ring + rw [he,information_scaled_coordinate] + +theorem all_soft_coordinate_attainment {n : ℕ} (i : Fin n) (a : ℝ) (ha : |a| ≤ 1) (ρ : ℝ) : + informationDeficit (noiseOperator ρ (fun x => a*signEncoding (dictator i) x))= + psi (|ρ| * psiInv (informationDeficit (fun x => a*signEncoding (dictator i) x))) := by + rw [information_noise_scaled_coordinate,information_scaled_coordinate,psiInv_psi_abs ha,← abs_mul,psi_abs_soft] + +end LeanBlast.CourtadeKumar +end +end + +end OAI diff --git a/lean/OAI/InformationTheory/SoftChannel/SoftReserve.lean b/lean/OAI/InformationTheory/SoftChannel/SoftReserve.lean new file mode 100644 index 0000000000000000000000000000000000000000..7ffead24889175e78d6be632409bc6876e4ac1aa --- /dev/null +++ b/lean/OAI/InformationTheory/SoftChannel/SoftReserve.lean @@ -0,0 +1,190 @@ +import OAI.InformationTheory.BooleanNoise.MonotoneDissipation +import OAI.InformationTheory.SoftChannel.PerspectiveInequality + +namespace OAI + +section + +noncomputable section +open Set Filter +open scoped BigOperators Topology +namespace LeanBlast.CourtadeKumar +variable {n : ℕ} + +theorem sortCoordinate_property (i : Fin n) (F : Cube n → ℝ) + (P : ℝ → Prop) (hF : ∀ x, P (F x)) : ∀ x, P (sortCoordinate i F x) := by + intro x + unfold sortCoordinate + split <;> first | exact (max_rec (fun _ => hF _) (fun _ => hF _)) | exact (min_rec (fun _ => hF _) (fun _ => hF _)) + +theorem sortCoordinate_interior (i : Fin n) {F : Cube n → ℝ} (hF : IsInterior F) : + IsInterior (sortCoordinate i F) := sortCoordinate_property i F (fun v => v ∈ Ioo (-1 : ℝ) 1) hF + +theorem sortCoordinate_closed (i : Fin n) {F : Cube n → ℝ} + (hF : ∀ x, F x ∈ Icc (-1 : ℝ) 1) : ∀ x, sortCoordinate i F x ∈ Icc (-1 : ℝ) 1 := + sortCoordinate_property i F _ hF + +theorem cubeAverage_comp_sortCoordinate (i : Fin n) (F : Cube n → ℝ) (h : ℝ → ℝ) : + cubeAverage (fun x => h (sortCoordinate i F x)) = cubeAverage (fun x => h (F x)) := by + have hp (x : Cube n) : h (sortCoordinate i F (setBit i false x)) + + h (sortCoordinate i F (setBit i true x)) = + h (F (setBit i false x)) + h (F (setBit i true x)) := by + simp only [sortCoordinate_false, sortCoordinate_true] + rcases le_total (F (setBit i false x)) (F (setBit i true x)) with hz | hz + · rw [min_eq_left hz, max_eq_right hz] + · rw [min_eq_right hz, max_eq_left hz, add_comm] + have hh := congrArg (fun f : Cube n → ℝ => ∑ x, f x) (funext hp) + rw [sum_setBit_pair i (fun x => h (sortCoordinate i F x)), + sum_setBit_pair i (fun x => h (F x))] at hh + unfold cubeAverage + have hs : (∑ x, h (sortCoordinate i F x)) = ∑ x, h (F x) := by linarith + rw [hs] + +theorem psi_noise_sortCoordinate_pair_closed (i : Fin n) {u : ℝ} + (hu : u ∈ Set.Icc 0 1) {F : Cube n → ℝ} (hF : ∀ x, F x ∈ Icc (-1 : ℝ) 1) (x : Cube n) : + psi (noiseOperator u F (setBit i false x)) + + psi (noiseOperator u F (setBit i true x)) ≤ + psi (noiseOperator u (sortCoordinate i F) (setBit i false x)) + + psi (noiseOperator u (sortCoordinate i F) (setBit i true x)) := by + let A := coordinateOffNoise i u (coordinatePairMean i F) x + let B := u * coordinateOffNoise i u (coordinatePairDifference i F) x + let C := u * coordinateOffNoise i u (fun y => |coordinatePairDifference i F y|) x + have hc : 0 ≤ C := mul_nonneg hu.1 + (coordinateOffNoise_nonneg i hu (fun y => abs_nonneg _) x) + have hbound := coordinateOffNoise_abs_bound i hu (coordinatePairDifference i F) x + have hb : -C ≤ B ∧ B ≤ C := by + dsimp only [B, C] + constructor + · have h := mul_le_mul_of_nonneg_left hbound.1 hu.1 + nlinarith + · exact mul_le_mul_of_nonneg_left hbound.2 hu.1 + have hfminus : noiseOperator u F (setBit i false x) = A - B := by + rw [noiseOperator_setBit] + dsimp [A, B] + ring + have hfplus : noiseOperator u F (setBit i true x) = A + B := by + rw [noiseOperator_setBit] + rfl + have hsminus : noiseOperator u (sortCoordinate i F) (setBit i false x) = A - C := by + rw [noiseOperator_setBit, coordinatePairMean_sortCoordinate, coordinatePairDifference_sortCoordinate] + dsimp [A, C] + ring + have hsplus : noiseOperator u (sortCoordinate i F) (setBit i true x) = A + C := by + rw [noiseOperator_setBit, coordinatePairMean_sortCoordinate, coordinatePairDifference_sortCoordinate] + rfl + have hsort := sortCoordinate_closed i hF + have hminus : A - C ∈ Set.Icc (-1 : ℝ) 1 := by + rw [← hsminus] + exact noiseOperator_bounds hu.1 hu.2 hsort _ + have hplus : A + C ∈ Set.Icc (-1 : ℝ) 1 := by + rw [← hsplus] + exact noiseOperator_bounds hu.1 hu.2 hsort _ + rw [hfminus, hfplus, hsminus, hsplus] + simpa only [add_comm] using psi_symmetric_pair_mono A B C hc hb hminus hplus + +theorem cubeAverage_psi_noise_sortCoordinate_closed (i : Fin n) {u : ℝ} + (hu : u ∈ Set.Icc 0 1) {F : Cube n → ℝ} (hF : ∀ x, F x ∈ Icc (-1 : ℝ) 1) : + cubeAverage (fun x => psi (noiseOperator u F x)) ≤ + cubeAverage (fun x => psi (noiseOperator u (sortCoordinate i F) x)) := by + have h := Finset.sum_le_sum (fun x (_ : x ∈ (Finset.univ : Finset (Cube n))) => + psi_noise_sortCoordinate_pair_closed i hu hF x) + rw [sum_setBit_pair i (fun x => psi (noiseOperator u F x)), + sum_setBit_pair i (fun x => psi (noiseOperator u (sortCoordinate i F) x))] at h + have hs : (∑ x, psi (noiseOperator u F x)) ≤ + ∑ x, psi (noiseOperator u (sortCoordinate i F) x) := by linarith + exact div_le_div_of_nonneg_right hs (cube_denominator_pos n).le + +theorem informationDeficit_noise_sortCoordinate_closed (i : Fin n) {u : ℝ} + (hu : u ∈ Set.Icc 0 1) {F : Cube n → ℝ} (hF : ∀ x, F x ∈ Icc (-1 : ℝ) 1) : + informationDeficit (noiseOperator u F) ≤ + informationDeficit (noiseOperator u (sortCoordinate i F)) := by + rw [informationDeficit_eq_psi_difference, informationDeficit_eq_psi_difference, + cubeAverage_noiseOperator, cubeAverage_noiseOperator, cubeAverage_sortCoordinate] + exact sub_le_sub_right (cubeAverage_psi_noise_sortCoordinate_closed i hu hF) _ + +theorem sortCoordinates_interior (is : List (Fin n)) {F : Cube n → ℝ} + (hF : IsInterior F) : IsInterior (sortCoordinates is F) := by + induction is generalizing F with + | nil => exact hF + | cons i is ih => exact ih (sortCoordinate_interior i hF) + +theorem sortCoordinates_closed (is : List (Fin n)) {F : Cube n → ℝ} + (hF : ∀ x, F x ∈ Icc (-1 : ℝ) 1) : ∀ x, sortCoordinates is F x ∈ Icc (-1 : ℝ) 1 := by + induction is generalizing F with + | nil => exact hF + | cons i is ih => exact ih (sortCoordinate_closed i hF) + +theorem cubeAverage_comp_sortCoordinates (is : List (Fin n)) (F : Cube n → ℝ) (h : ℝ → ℝ) : + cubeAverage (fun x => h (sortCoordinates is F x)) = cubeAverage (fun x => h (F x)) := by + induction is generalizing F with + | nil => rfl + | cons i is ih => rw [sortCoordinates, ih, cubeAverage_comp_sortCoordinate] + +theorem informationDeficit_noise_sortCoordinates_closed (is : List (Fin n)) {u : ℝ} + (hu : u ∈ Icc 0 1) {F : Cube n → ℝ} (hF : ∀ x, F x ∈ Icc (-1 : ℝ) 1) : + informationDeficit (noiseOperator u F) ≤ + informationDeficit (noiseOperator u (sortCoordinates is F)) := by + induction is generalizing F with + | nil => exact le_rfl + | cons i is ih => + exact (informationDeficit_noise_sortCoordinate_closed i hu hF).trans + (ih (sortCoordinate_closed i hF)) + +theorem exists_increasing_dissipation_le (F : Cube n → ℝ) (hF : IsInterior F) : + ∃ G : Cube n → ℝ, IsInterior G ∧ IsIncreasing G ∧ + (∀ h : ℝ → ℝ, cubeAverage (fun x => h (G x)) = cubeAverage (fun x => h (F x))) ∧ + dissipation G ≤ dissipation F := by + classical + let is : List (Fin n) := Finset.univ.toList + let G := sortCoordinates is F + have hG : IsInterior G := sortCoordinates_interior is hF + have hlaw (h : ℝ → ℝ) : cubeAverage (fun x => h (G x)) = + cubeAverage (fun x => h (F x)) := cubeAverage_comp_sortCoordinates is F h + have hinc : IsIncreasing G := by + apply isIncreasing_of_forall_increasingIn + intro j + apply sortCoordinates_increasingIn is j + exact Or.inl (by simp [is]) + have heq : informationDeficit G = informationDeficit F := by + unfold informationDeficit entropyAverage + have hm : cubeAverage G = cubeAverage F := hlaw id + rw [hlaw entropy, hm] + let f : ℝ → ℝ := fun t => + informationDeficit (noiseFlow G t) - informationDeficit (noiseFlow F t) + have hf0 : f 0 = 0 := by simp [f, noiseFlow_zero, heq] + have hd : HasDerivAt f (dissipation F - dissipation G) 0 := by + have h1 := hasDerivAt_informationDeficit_noiseFlow_of_isInterior G 0 + (by simpa only [noiseFlow_zero] using hG) + have h2 := hasDerivAt_informationDeficit_noiseFlow_of_isInterior F 0 + (by simpa only [noiseFlow_zero] using hF) + convert! h1.sub h2 using 1; simp [noiseFlow_zero]; ring + have hnonneg (t : ℝ) (ht : 0 < t) : 0 ≤ f t := by + have hu : Real.exp (-t) ∈ Icc (0 : ℝ) 1 := + ⟨(Real.exp_pos _).le, Real.exp_le_one_iff.mpr (by linarith)⟩ + exact sub_nonneg.mpr (informationDeficit_noise_sortCoordinates_closed is hu + (fun x => ⟨(hF x).1.le, (hF x).2.le⟩)) + have hderiv : 0 ≤ dissipation F - dissipation G := by + apply ge_of_tendsto hd.tendsto_slope_zero_right + filter_upwards [self_mem_nhdsWithin] with t ht + simp only [zero_add, hf0, sub_zero, smul_eq_mul] + exact mul_nonneg (inv_nonneg.mpr ht.le) (hnonneg t ht) + exact ⟨G, hG, hinc, hlaw, by linarith⟩ + +theorem all_soft_reserve {n : ℕ} (g : Cube n → ℝ) (hg : IsInterior g) : + 2 * informationDeficit g + meanVariance g * L (entropyAverage g / meanVariance g) ≤ + dissipation g := by + obtain ⟨G, hG, hinc, hlaw, hD⟩ := exists_increasing_dissipation_le g hg + have hmean : cubeAverage G = cubeAverage g := hlaw id + have hent : entropyAverage G = entropyAverage g := hlaw entropy + have hI : informationDeficit G = informationDeficit g := by + simp only [informationDeficit, hent, hmean] + have hv : meanVariance G = meanVariance g := by simp only [meanVariance, hmean] + have h := monotone_dissipation G hG hinc + rw [hI, hent, hv] at h + exact h.trans hD + +end LeanBlast.CourtadeKumar +end +end + +end OAI diff --git a/lean/OAI/InformationTheory/SoftChannel/Thinning.lean b/lean/OAI/InformationTheory/SoftChannel/Thinning.lean new file mode 100644 index 0000000000000000000000000000000000000000..ab8241785ad49cb6464148338efeaf4e2821ac5e --- /dev/null +++ b/lean/OAI/InformationTheory/SoftChannel/Thinning.lean @@ -0,0 +1,454 @@ +import OAI.InformationTheory.SoftChannel.Canonical + +namespace OAI + +section + +noncomputable section +open Set +namespace SoftChannel204 + +def thinningPolynomial (t u : ℝ) : ℝ := + 3 * (2 - t * u - t ^ 2 * u ^ 2) - + (2 * (2 + t * u) * (1 - t) - 3 * t * u ^ 2 * (1 - t * u)) * + (1 + t * (3 - u)) + +theorem thinningPolynomial_pos (t u : ℝ) (hu0 : 0 ≤ u) (hu1 : u ≤ 1) + (ht0 : 0 ≤ t) (htu : t * (1 + u) ≤ 1) : 0 < thinningPolynomial t u := by + let a := 12 - 8 * u + 8 * u ^ 2 - 6 * u ^ 3 + let b := 3 * u ^ 2 - u - 8 + let c := u * (3 - u) * (2 - 3 * u ^ 2) + have hc : -u * (1 + u) ≤ c := by + have h : 0 ≤ u * (1 - u) * (7 + 6 * u - 3 * u ^ 2) := by + have : u ^ 2 ≤ u := by nlinarith + apply mul_nonneg (mul_nonneg hu0 (sub_nonneg.mpr hu1)) + nlinarith + dsimp [c] + nlinarith + have hct : -u ≤ c * t := by + calc + -u ≤ -u * (t * (1 + u)) := by nlinarith + _ = (-u * (1 + u)) * t := by ring + _ ≤ c * t := mul_le_mul_of_nonneg_right hc ht0 + have hp : 2 + b * t + (a - u) * t ^ 2 ≤ thinningPolynomial t u := by + have h := mul_nonneg (show 0 ≤ c * t + u by linarith) (sq_nonneg t) + dsimp [thinningPolynomial, a, b, c] at * + nlinarith + have hd : 4 ≤ 8 * (a - u) - b ^ 2 := by + have h : 0 ≤ (1 - u) * (2 * (5 * u - 3) ^ 2 + u ^ 2 * (1 + 9 * u) + 10) := + mul_nonneg (sub_nonneg.mpr hu1) (by positivity) + dsimp [a, b] + nlinarith + have hd' := mul_le_mul_of_nonneg_right hd (sq_nonneg t) + by_cases ht : t = 0 + · subst t + norm_num [thinningPolynomial] + · have hs : 0 < t ^ 2 := sq_pos_of_ne_zero ht + nlinarith [sq_nonneg (4 + b * t)] + +theorem thinning_cutoff_bound {x : ℝ} (hx : x ∈ Icc (0 : ℝ) 1) : + 4 * Real.log 2 * x ≤ (3 + x) * Real.log (1 + x) := by + let f : ℝ → ℝ := fun y => (3 + y) * Real.log (1 + y) - 4 * Real.log 2 * y + let f' : ℝ → ℝ := fun y => + Real.log (1 + y) + (3 + y) / (1 + y) - 4 * Real.log 2 + let f'' : ℝ → ℝ := fun y => (y - 1) / (1 + y) ^ 2 + have hd (y : ℝ) (hy : -1 < y) : HasDerivAt f (f' y) y := by + have hn : 1 + y ≠ 0 := by linarith + convert! ((((hasDerivAt_id y).const_add 3).mul + (((hasDerivAt_id y).const_add 1).log hn)).sub + ((hasDerivAt_id y).const_mul (4 * Real.log 2))) using 1; + simp [f', div_eq_mul_inv] + have hd' (y : ℝ) (hy : -1 < y) : HasDerivAt f' (f'' y) y := by + have hn : 1 + y ≠ 0 := by linarith + convert! ((((hasDerivAt_id y).const_add 1).log hn).add + (((hasDerivAt_id y).const_add 3).div + ((hasDerivAt_id y).const_add 1) hn)).sub_const (4 * Real.log 2) using 1 + dsimp [f''] + field_simp + ring + have hc : ConcaveOn ℝ (Icc (0 : ℝ) 1) f := by + apply concaveOn_of_hasDerivWithinAt2_nonpos (f' := f') (f'' := f'') (convex_Icc 0 1) + · intro y hy + exact (hd y (by linarith [hy.1])).continuousAt.continuousWithinAt + · intro y hy + rw [interior_Icc] at hy + exact (hd y (by linarith [hy.1])).hasDerivWithinAt + · intro y hy + rw [interior_Icc] at hy + exact (hd' y (by linarith [hy.1])).hasDerivWithinAt + · intro y hy + rw [interior_Icc] at hy + exact div_nonpos_of_nonpos_of_nonneg (by linarith [hy.2]) (sq_nonneg _) + have h := hc.2 (show (0 : ℝ) ∈ Icc 0 1 by norm_num) + (show (1 : ℝ) ∈ Icc 0 1 by norm_num) + (show 0 ≤ 1 - x by linarith [hx.2]) hx.1 (by ring : 1 - x + x = 1) + simp only [smul_eq_mul, mul_zero, mul_one, zero_add] at h + have hf0 : f 0 = 0 := by simp [f] + have hf1 : f 1 = 0 := by norm_num [f] + rw [hf0, hf1] at h + dsimp [f] at h + linarith + +def clipKernel (β v : ℝ) : ℝ := max (v - β) 0 / v ^ 2 + +theorem clipKernel_nonneg (β v : ℝ) : 0 ≤ clipKernel β v := + div_nonneg (le_max_right _ _) (sq_nonneg _) + +theorem clipKernel_of_le {β v : ℝ} (h : v ≤ β) : clipKernel β v = 0 := by + simp [clipKernel, max_eq_right (sub_nonpos.mpr h)] + +theorem clipKernel_eq {β v : ℝ} (h : β ≤ v) : + clipKernel β v = (v - β) / v ^ 2 := by + rw [clipKernel, max_eq_left (sub_nonneg.mpr h)] + +theorem clipKernel_min {β u v : ℝ} (hβ0 : 0 ≤ β) (hu0 : 0 < u) + (huv : u ≤ v) (hv1 : v ≤ 1) : + min (clipKernel β u) (1 - β) ≤ clipKernel β v := by + by_cases huβ : u ≤ β + · rw [clipKernel_of_le huβ] + exact (min_le_left _ _).trans (clipKernel_nonneg _ _) + have hβu : β < u := lt_of_not_ge huβ + have hv0 : 0 < v := hu0.trans_le huv + have hβv : β ≤ v := hβu.le.trans huv + have hc : ConcaveOn ℝ (Ici (0 : ℝ)) (fun t => t - β * t ^ 2) := by + convert! (concaveOn_id (convex_Ici (0 : ℝ))).sub + ((convexOn_pow (𝕜 := ℝ) 2).smul hβ0) using 1 + have hi : (1 / v : ℝ) ∈ Icc 1 (1 / u) := by + constructor + · exact (le_div_iff₀ hv0).mpr (by simpa using hv1) + · exact one_div_le_one_div_of_le hu0 huv + have h := hc.min_le_of_mem_Icc (show (1 : ℝ) ∈ Ici 0 by norm_num) + (show 1 / u ∈ Ici (0 : ℝ) from (one_div_pos.mpr hu0).le) hi + have he (w : ℝ) (hw : w ≠ 0) : + 1 / w - β * (1 / w) ^ 2 = (w - β) / w ^ 2 := by + field_simp + simp only [one_pow, mul_one] at h + rw [he u hu0.ne', he v hv0.ne', min_comm] at h + rwa [clipKernel_eq hβu.le, clipKernel_eq hβv] + +theorem thinning_endpoint_algebra {t u : ℝ} (ht0 : 0 ≤ t) (hu0 : 0 < u) + (hu1 : u ≤ 1) (htu : t * (1 + u) ≤ 1) : + let b := t * u + let x := 3 * b / (4 - b) + ((1 + x) * ((u - b) / u ^ 2) - x * (1 - b)) * + ((4 * x + (1 - x) * u) / ((1 - x) * (1 + x))) ≤ 3 / 2 := by + dsimp only + have ht : t * u < 1 := by + by_cases he : t = 0 + · simp [he] + · have : 0 < t := lt_of_le_of_ne ht0 (Ne.symm he) + nlinarith + have h4 : 4 - t * u ≠ 0 := by linarith + have h1 : 1 - t * u ≠ 0 := by linarith + have h2 : 2 + t * u ≠ 0 := by positivity + have hp := (thinningPolynomial_pos t u hu0.le hu1 ht0 htu).le + have hd : 0 < 2 * (1 - t * u) * (2 + t * u) := by positivity + have hf : 1 - 3 * (t * u) / (4 - t * u) ≠ 0 := by + intro he + have he' := (div_eq_iff h4).mp (show 3 * (t * u) / (4 - t * u) = 1 by linarith) + nlinarith + have hf' : 1 + 3 * (t * u) / (4 - t * u) ≠ 0 := by + have : 0 ≤ 3 * (t * u) / (4 - t * u) := div_nonneg (by positivity) (by linarith) + positivity + have hid : 3 / 2 - + ((1 + 3 * (t * u) / (4 - t * u)) * ((u - t * u) / u ^ 2) - + 3 * (t * u) / (4 - t * u) * (1 - t * u)) * + ((4 * (3 * (t * u) / (4 - t * u)) + + (1 - 3 * (t * u) / (4 - t * u)) * u) / + ((1 - 3 * (t * u) / (4 - t * u)) * (1 + 3 * (t * u) / (4 - t * u)))) = + thinningPolynomial t u / (2 * (1 - t * u) * (2 + t * u)) := by + unfold thinningPolynomial + have hden : 16 - t * u * 8 - t ^ 2 * u ^ 2 * 8 ≠ 0 := by + have he : 16 - t * u * 8 - t ^ 2 * u ^ 2 * 8 = + 8 * (1 - t * u) * (2 + t * u) := by ring + rw [he] + exact mul_ne_zero (mul_ne_zero (by norm_num) h1) h2 + field_simp [hu0.ne', h4, hf, hf', h1, h2, hden] + ring_nf + field_simp [hden] + ring + have hnonneg := div_nonneg hp hd.le + rw [← hid] at hnonneg + linarith + +theorem thinning_hard_bound {x u β : ℝ} (hx0 : 0 ≤ x) (hx1 : x < 1) + (hu0 : 0 < u) (hu1 : u ≤ 1) (hβ1 : β ≤ 1) + (hcut : 4 * x / (3 + x) ≤ β) (hh : 1 - β < clipKernel β u) : + ((1 + x) * clipKernel β u - x * (1 - β)) * + ((4 * x + (1 - x) * u) / ((1 - x) * (1 + x))) ≤ 3 / 2 := by + let b : ℝ := 4 * x / (3 + x) + have hb0 : 0 ≤ b := div_nonneg (by positivity) (by positivity) + have hbβ : b ≤ β := hcut + have hβ0 : 0 ≤ β := hb0.trans hbβ + have hbu : β < u := by + by_contra hn + rw [clipKernel_of_le (le_of_not_gt hn)] at hh + linarith + have hk : clipKernel β u * u ^ 2 = u - β := by + rw [clipKernel_eq hbu.le, div_mul_cancel₀ _ (pow_ne_zero _ hu0.ne')] + have hp : 0 < (1 - u) * (u - β * (1 + u)) := by + have hm := mul_lt_mul_of_pos_right hh (sq_pos_of_pos hu0) + rw [hk] at hm + nlinarith + have hcore : β * (1 + u) < u := by + by_contra hn + have := mul_nonpos_of_nonneg_of_nonpos (sub_nonneg.mpr hu1) + (show u - β * (1 + u) ≤ 0 by linarith) + linarith + have hbcore : b * (1 + u) ≤ u := + (mul_le_mul_of_nonneg_right hbβ (by positivity)).trans hcore.le + have hb1 : b < 1 := by nlinarith + let t := b / u + have ht0 : 0 ≤ t := div_nonneg hb0 hu0.le + have htu : t * u = b := div_mul_cancel₀ _ hu0.ne' + have ht : t * (1 + u) ≤ 1 := by + dsimp [t] + rw [div_mul_eq_mul_div, div_le_iff₀ hu0] + simpa using hbcore + have h4 : 4 - b ≠ 0 := by linarith + have hbx : 3 * b / (4 - b) = x := by + apply (div_eq_iff h4).mpr + dsimp [b] + field_simp + ring + have hend := thinning_endpoint_algebra ht0 hu0 hu1 ht + dsimp only at hend + rw [htu, hbx] at hend + have hcoeff : 0 ≤ (1 + x) / u ^ 2 - x := by + have hsq : u ^ 2 ≤ 1 := by nlinarith + have hle : x ≤ (1 + x) / u ^ 2 := by + apply (le_div_iff₀ (sq_pos_of_pos hu0)).mpr + nlinarith [mul_le_mul_of_nonneg_left hsq hx0] + linarith + have hcomp : (1 + x) * clipKernel β u - x * (1 - β) ≤ + (1 + x) * ((u - b) / u ^ 2) - x * (1 - b) := by + rw [clipKernel_eq hbu.le] + have h := mul_nonneg (sub_nonneg.mpr hbβ) hcoeff + simp only [div_eq_mul_inv] at * + nlinarith + have hfac : 0 ≤ (4 * x + (1 - x) * u) / ((1 - x) * (1 + x)) := by + apply div_nonneg <;> positivity + exact (mul_le_mul_of_nonneg_right hcomp hfac).trans hend + +theorem thinning_derivative_product {x a s β : ℝ} (hx0 : 0 ≤ x) (hx1 : x < 1) + (ha1 : 1 ≤ a) (hap : a ≤ 1 + x) (hs0 : 0 ≤ s) + (hsg : s < (1 - x) / (1 + x)) (hβ1 : β ≤ 1) + (hcut : 4 * x / (3 + x) ≤ β) : + let u := 2 - a * (1 + s) + let v := u + s + (a * clipKernel β u - (a - 1) * clipKernel β v) * + ((1 + x) / (1 - x) - s) ≤ 3 / 2 := by + let u := 2 - a * (1 + s) + let v := u + s + let Y := (1 + x) / (1 - x) - s + change (a * clipKernel β u - (a - 1) * clipKernel β v) * Y ≤ 3 / 2 + have hp : 0 < 1 + x := by positivity + have hσ : 0 < 1 - x := by linarith + have ha : 0 < a := by linarith + have hs : (1 + x) * s < 1 - x := by + have := (lt_div_iff₀ hp).mp hsg + nlinarith + have hu0 : 0 < u := by + have hh := mul_le_mul_of_nonneg_right hap (show 0 ≤ 1 + s by positivity) + dsimp [u] + nlinarith + have huv : u ≤ v := by dsimp [v]; linarith + have hv1 : v ≤ 1 := by + have hh := mul_le_mul_of_nonneg_right ha1 (show 0 ≤ 1 + s by positivity) + dsimp [v, u] + nlinarith + have hu1 : u ≤ 1 := huv.trans hv1 + have hs1 : s < 1 := by nlinarith [mul_nonneg hx0 hs0] + have hratio : 1 ≤ (1 + x) / (1 - x) := by + apply (le_div_iff₀ hσ).mpr + linarith + have hY : 0 < Y := by dsimp [Y]; linarith + have hb0 : 0 ≤ β := + (div_nonneg (show 0 ≤ 4 * x by positivity) (show 0 ≤ 3 + x by positivity)).trans hcut + have hc0 : 0 ≤ 1 - β := by linarith + have hmin := clipKernel_min hb0 hu0 huv hv1 + by_cases heasy : clipKernel β u ≤ 1 - β + · rw [min_eq_left heasy] at hmin + have hD : a * clipKernel β u - (a - 1) * clipKernel β v ≤ 1 - β := by + have := mul_nonneg (show 0 ≤ a - 1 by linarith) (sub_nonneg.mpr hmin) + nlinarith + have hc : (1 - β) * (2 * (1 + x)) ≤ 3 * (1 - x) := by + have hb := (div_le_iff₀ (show 0 < 3 + x by positivity)).mp hcut + have hh := mul_le_mul_of_nonneg_left + (show 2 * (1 + x) ≤ 3 + x by linarith) hc0 + nlinarith + calc + _ ≤ (1 - β) * Y := mul_le_mul_of_nonneg_right hD hY.le + _ ≤ (1 - β) * ((1 + x) / (1 - x)) := + mul_le_mul_of_nonneg_left (by dsimp [Y]; linarith) hc0 + _ = ((1 - β) * (1 + x)) / (1 - x) := by ring + _ ≤ 3 / 2 := (div_le_iff₀ hσ).mpr (by nlinarith) + · have hhard : 1 - β < clipKernel β u := lt_of_not_ge heasy + rw [min_eq_right hhard.le] at hmin + have hD : a * clipKernel β u - (a - 1) * clipKernel β v ≤ + a * (clipKernel β u - (1 - β)) + (1 - β) := by + have := mul_nonneg (show 0 ≤ a - 1 by linarith) (sub_nonneg.mpr hmin) + nlinarith + have hfirst : a * (clipKernel β u - (1 - β)) + (1 - β) ≤ + (1 + x) * (clipKernel β u - (1 - β)) + (1 - β) := by + nlinarith [mul_nonneg (sub_nonneg.mpr hap) (sub_nonneg.mpr hhard.le)] + have hid : Y = 2 / (1 - x) - (2 - u) / a := by + dsimp [Y, u] + field_simp + ring + have hidp : 2 / (1 - x) - (2 - u) / (1 + x) = + (4 * x + (1 - x) * u) / ((1 - x) * (1 + x)) := by + field_simp + ring + have hYle : Y ≤ (4 * x + (1 - x) * u) / ((1 - x) * (1 + x)) := by + rw [hid, ← hidp] + exact sub_le_sub_left (div_le_div_of_nonneg_left (by linarith) ha hap) _ + have hbound := thinning_hard_bound hx0 hx1 hu0 hu1 hβ1 hcut hhard + calc + _ ≤ (a * (clipKernel β u - (1 - β)) + (1 - β)) * Y := + mul_le_mul_of_nonneg_right hD hY.le + _ ≤ ((1 + x) * (clipKernel β u - (1 - β)) + (1 - β)) * + ((4 * x + (1 - x) * u) / ((1 - x) * (1 + x))) := + mul_le_mul hfirst hYle hY.le + (add_nonneg (mul_nonneg hp.le (sub_nonneg.mpr hhard.le)) hc0) + _ = ((1 + x) * clipKernel β u - x * (1 - β)) * + ((4 * x + (1 - x) * u) / ((1 - x) * (1 + x))) := by ring + _ ≤ 3 / 2 := hbound + +open MeasureTheory + +theorem continuousAt_clipKernel (β : ℝ) {v : ℝ} (hv : 0 < v) : + ContinuousAt (clipKernel β) v := by + unfold clipKernel + exact ((continuousAt_id.sub continuousAt_const).max continuousAt_const).div + (continuousAt_id.pow 2) (pow_ne_zero _ hv.ne') + +theorem intervalIntegrable_clipKernel (β : ℝ) {u v : ℝ} (hu : 0 < u) (hv : 0 < v) : + IntervalIntegrable (clipKernel β) volume u v := by + apply ContinuousOn.intervalIntegrable + intro w hw + exact (continuousAt_clipKernel β + (lt_of_lt_of_le (lt_min hu hv) hw.1)).continuousWithinAt + +def clipPrimitive (β w : ℝ) : ℝ := ∫ v in (1 : ℝ)..w, clipKernel β v + +theorem hasDerivAt_clipPrimitive (β : ℝ) {w : ℝ} (hw : 0 < w) : + HasDerivAt (clipPrimitive β) (clipKernel β w) w := by + apply intervalIntegral.integral_hasDerivAt_right + (intervalIntegrable_clipKernel β (by norm_num) hw) + · exact ContinuousAt.stronglyMeasurableAtFilter isOpen_Ioi + (fun v hv => continuousAt_clipKernel β hv) w hw + · exact continuousAt_clipKernel β hw + +theorem thinning_interval_aux {x β u z : ℝ} (hx0 : 0 ≤ x) (hx1 : x < 1) + (hβ1 : β ≤ 1) (hcut : 4 * x / (3 + x) ≤ β) + (hz0 : 0 ≤ z) (hzg : z < (1 - x) / (1 + x)) + (hulo : 1 - x - (1 + x) * z ≤ u) (huhi : u ≤ 1 - z) : + (∫ v in u..u+z, clipKernel β v) ≤ + -(3 / 2 : ℝ) * Real.log (1 - ((1 - x) / (1 + x)) * z) := by + let γ := (1 - x) / (1 + x) + let a := (2 - u) / (1 + z) + let U : ℝ → ℝ := fun s => 2 - a * (1 + s) + let V : ℝ → ℝ := fun s => U s + s + let f : ℝ → ℝ := fun s => clipPrimitive β (V s) - clipPrimitive β (U s) + + (3 / 2) * Real.log (1 - γ * s) + let f' : ℝ → ℝ := fun s => + a * clipKernel β (U s) - (a - 1) * clipKernel β (V s) - + (3 / 2) * γ / (1 - γ * s) + have hp : 0 < 1 + x := by positivity + have hσ : 0 < 1 - x := by linarith + have hγ0 : 0 < γ := div_pos hσ hp + have hγ1 : γ ≤ 1 := by dsimp [γ]; exact (div_le_one hp).mpr (by linarith) + have hz1 : z < 1 := hzg.trans_le hγ1 + have ha1 : 1 ≤ a := (le_div_iff₀ (by positivity : 0 < 1 + z)).mpr (by linarith) + have hap : a ≤ 1 + x := by + apply (div_le_iff₀ (by positivity : 0 < 1 + z)).mpr + nlinarith + have bounds (s : ℝ) (hs : s ∈ Icc 0 z) : + 0 < U s ∧ U s ≤ V s ∧ V s ≤ 1 ∧ 0 < 1 - γ * s := by + have hsγ : s < γ := hs.2.trans_lt hzg + have hps := (lt_div_iff₀ hp).mp hsγ + have ha := mul_le_mul_of_nonneg_right hap (show 0 ≤ 1 + s by linarith [hs.1]) + have hb := mul_le_mul_of_nonneg_right ha1 (show 0 ≤ 1 + s by linarith [hs.1]) + have hγs := mul_le_mul_of_nonneg_right hγ1 hs.1 + dsimp [U, V] + exact ⟨by nlinarith, by linarith [hs.1], by nlinarith, + by nlinarith [hs.2]⟩ + have hd (s : ℝ) (hs : s ∈ Icc 0 z) : HasDerivAt f (f' s) s := by + obtain ⟨hu0, huv, hv1, hlog⟩ := bounds s hs + have hu : HasDerivAt U (-a) s := by + convert! (((hasDerivAt_id s).const_add 1).const_mul a).const_sub 2 using 1; + simp + have hv : HasDerivAt V (1 - a) s := by + convert! hu.add (hasDerivAt_id s) using 1; ring + have hl := ((((hasDerivAt_id s).const_mul γ).const_sub 1).log hlog.ne').const_mul + (3 / 2 : ℝ) + convert! (((hasDerivAt_clipPrimitive β (hu0.trans_le huv)).comp s hv).sub + ((hasDerivAt_clipPrimitive β hu0).comp s hu)).add hl using 1; + simp [f']; ring + have hnonpos (s : ℝ) (hs : s ∈ Icc 0 z) : f' s ≤ 0 := by + have hb := thinning_derivative_product hx0 hx1 ha1 hap hs.1 + (hs.2.trans_lt hzg) hβ1 hcut + change (a * clipKernel β (U s) - (a - 1) * clipKernel β (V s)) * + ((1 + x) / (1 - x) - s) ≤ 3 / 2 at hb + have hY : 0 < (1 + x) / (1 - x) - s := by + have hr : 1 ≤ (1 + x) / (1 - x) := (le_div_iff₀ hσ).mpr (by linarith) + linarith [hs.2] + have hid : (3 / 2 : ℝ) * γ / (1 - γ * s) = + (3 / 2 : ℝ) / ((1 + x) / (1 - x) - s) := by + dsimp [γ] + field_simp + have hb' := (le_div_iff₀ hY).mpr hb + dsimp [f'] + rw [hid] + linarith + have hanti : AntitoneOn f (Icc 0 z) := by + apply antitoneOn_of_hasDerivWithinAt_nonpos (f' := f') (convex_Icc _ _) + · exact fun s hs => (hd s hs).continuousAt.continuousWithinAt + · intro s hs + rw [interior_Icc] at hs + exact (hd s ⟨hs.1.le, hs.2.le⟩).hasDerivWithinAt + · intro s hs + rw [interior_Icc] at hs + exact hnonpos s ⟨hs.1.le, hs.2.le⟩ + have hle := hanti (show (0 : ℝ) ∈ Icc 0 z from ⟨le_rfl, hz0⟩) + (show z ∈ Icc 0 z from ⟨hz0, le_rfl⟩) hz0 + have hU : U z = u := by + dsimp [U, a] + field_simp + ring + have hV : V z = u + z := by simp [V, hU] + have hu0 : 0 < u := hU ▸ (bounds z ⟨hz0, le_rfl⟩).1 + have hv0 : 0 < u + z := by linarith + have hprim : clipPrimitive β (u + z) - clipPrimitive β u = + ∫ v in u..u+z, clipKernel β v := by + have hh := intervalIntegral.integral_add_adjacent_intervals + (intervalIntegrable_clipKernel β (show (0 : ℝ) < 1 by norm_num) hu0) + (intervalIntegrable_clipKernel β hu0 hv0) + dsimp [clipPrimitive] + linarith + dsimp [f] at hle + rw [hU, hV, hprim] at hle + simp [V] at hle + linarith + +theorem thinning_interval {x u z : ℝ} (hx0 : 0 ≤ x) (hx1 : x < 1) + (hz0 : 0 ≤ z) (hzg : z < (1 - x) / (1 + x)) + (hulo : 1 - x - (1 + x) * z ≤ u) (huhi : u ≤ 1 - z) : + (∫ v in u..u+z, clipKernel (Real.log (1 + x) / Real.log 2) v) ≤ + -(3 / 2 : ℝ) * Real.log (1 - ((1 - x) / (1 + x)) * z) := by + have hL : 0 < Real.log 2 := Real.log_pos (by norm_num) + have hβ1 : Real.log (1 + x) / Real.log 2 ≤ 1 := by + apply (div_le_one hL).mpr + exact Real.log_le_log (by positivity) (by linarith) + have hb := thinning_cutoff_bound ⟨hx0, hx1.le⟩ + have hcut : 4 * x / (3 + x) ≤ Real.log (1 + x) / Real.log 2 := by + apply (div_le_div_iff₀ (by positivity : 0 < 3 + x) hL).mpr + nlinarith + exact thinning_interval_aux hx0 hx1 hβ1 hcut hz0 hzg hulo huhi + +end SoftChannel204 +end +end + +end OAI diff --git a/lean/OAI/InformationTheory/SoftChannel/Wall.lean b/lean/OAI/InformationTheory/SoftChannel/Wall.lean new file mode 100644 index 0000000000000000000000000000000000000000..2074b1f63b5f294eb49249c00ce251ba841b3600 --- /dev/null +++ b/lean/OAI/InformationTheory/SoftChannel/Wall.lean @@ -0,0 +1,209 @@ +import OAI.InformationTheory.SoftChannel.RateSlope + +namespace OAI + +section + +noncomputable section +open Set Filter +open scoped Topology +namespace LeanBlast.CourtadeKumar + +def wallA (m d : ℝ) : ℝ := (Real.artanh (m+d)+Real.artanh (m-d))/2 +def wallC (m d : ℝ) : ℝ := (Real.artanh (m+d)-Real.artanh (m-d))/2 +def wallADeriv (m d : ℝ) : ℝ := (1/(1-(m+d)^2)-1/(1-(m-d)^2))/2 + +def entropySlopeAux (u : ℝ) : ℝ := 1/(1-u^2)-Real.artanh u^2 + +lemma artanh_neg_interior {u : ℝ} (hu : u ∈ Ioo (-1) 1) : Real.artanh (-u) = -Real.artanh u := by + rw [artanh_eq_log_sub (show -u ∈ Ioo (-1) 1 by constructor <;> linarith [hu.1,hu.2]), + artanh_eq_log_sub hu] + simp only [← sub_eq_add_neg,sub_neg_eq_add] + ring + +lemma entropySlopeAux_neg {u : ℝ} (hu : u ∈ Ioo (-1) 1) : entropySlopeAux (-u) = entropySlopeAux u := by + simp [entropySlopeAux,artanh_neg_interior hu] + +lemma hasDerivAt_entropySlopeAux {u : ℝ} (hu : u ∈ Ioo (-1) 1) : + HasDerivAt entropySlopeAux (2*(u-(1-u^2)*Real.artanh u)/(1-u^2)^2) u := by + have hd : 1-u^2 ≠ 0 := by nlinarith [hu.1,hu.2] + have h := ((hasDerivAt_const u (1:ℝ)).div (((hasDerivAt_id u).pow 2).const_sub 1) hd).sub + ((hasDerivAt_artanh hu).pow 2) + convert! h using 1; dsimp [entropySlopeAux]; field_simp; ring + +lemma monotoneOn_entropySlopeAux : MonotoneOn entropySlopeAux (Ico 0 1) := by + apply monotoneOn_of_hasDerivWithinAt_nonneg + (f' := fun u => 2*(u-(1-u^2)*Real.artanh u)/(1-u^2)^2) (convex_Ico _ _) + · intro u hu + exact (hasDerivAt_entropySlopeAux ⟨by linarith [hu.1],hu.2⟩).continuousAt.continuousWithinAt + · intro u hu + simp only [interior_Ico,mem_Ioo] at hu + exact (hasDerivAt_entropySlopeAux ⟨by linarith [hu.1],hu.2⟩).hasDerivWithinAt + · intro u hu + simp only [interior_Ico,mem_Ioo] at hu + exact div_nonneg (mul_nonneg (by norm_num) (sub_nonneg.mpr (one_sub_sq_mul_artanh_le_self ⟨hu.1.le,hu.2⟩))) (sq_nonneg _) + +lemma wall_domain {m d : ℝ} (hm : 0 ≤ m) (hd : 0 ≤ d) (hmd : m+d < 1) : |m|+|d|<1 := by + rwa [abs_of_nonneg hm,abs_of_nonneg hd] + +lemma wallA_nonneg {m d : ℝ} (hm : 0 ≤ m) (hd : 0 ≤ d) (hmd : m+d < 1) : 0 ≤ wallA m d := by + have hh := wall_domain hm hd hmd + have hp := pair_add_mem_Ioo m d hh + have hn := pair_sub_mem_Ioo m d hh + have h := Real.strictMonoOn_artanh.monotoneOn + (show -(m-d) ∈ Ioo (-1) 1 by constructor <;> linarith [hn.1,hn.2]) hp (by linarith : -(m-d) ≤ m+d) + rw [artanh_neg_interior hn] at h + unfold wallA; linarith + +lemma wallC_nonneg {m d : ℝ} (hm : 0 ≤ m) (hd : 0 ≤ d) (hmd : m+d < 1) : 0 ≤ wallC m d := by + have hh := wall_domain hm hd hmd + have h := Real.strictMonoOn_artanh.monotoneOn (pair_sub_mem_Ioo m d hh) (pair_add_mem_Ioo m d hh) + (by linarith : m-d ≤ m+d) + unfold wallC; linarith + +lemma wallADeriv_lower {m d : ℝ} (hm : 0 ≤ m) (hd : 0 ≤ d) (hmd : m+d < 1) : + 2*wallA m d*wallC m d ≤ wallADeriv m d := by + have hh := wall_domain hm hd hmd + have hn := pair_sub_mem_Ioo m d hh + have h := monotoneOn_entropySlopeAux + (show |m-d| ∈ Ico 0 1 by exact ⟨abs_nonneg _,by rw [abs_lt]; exact hn⟩) + (show m+d ∈ Ico 0 1 by exact ⟨by linarith,hmd⟩) + (show |m-d| ≤ m+d by rw [abs_le]; constructor <;> linarith) + have he : entropySlopeAux |m-d| = entropySlopeAux (m-d) := by + rcases le_total 0 (m-d) with hpos | hneg + · rw [abs_of_nonneg hpos] + · rw [abs_of_nonpos hneg,entropySlopeAux_neg hn] + rw [he] at h + dsimp [entropySlopeAux,wallA,wallC,wallADeriv] at * + nlinarith + +lemma hasDerivAt_wallA_d {m d : ℝ} (hh : |m|+|d|<1) : + HasDerivAt (wallA m) (wallADeriv m d) d := by + have h := (((hasDerivAt_artanh (pair_add_mem_Ioo m d hh)).comp d + ((hasDerivAt_id d).const_add m)).add ((hasDerivAt_artanh (pair_sub_mem_Ioo m d hh)).comp d + ((hasDerivAt_id d).const_sub m))).div_const 2 + convert! h using 1; dsimp [wallA,wallADeriv]; ring + +lemma hasDerivAt_pairH_d {m d : ℝ} (hh : |m|+|d|<1) : + HasDerivAt (pairH m) (-wallC m d) d := by + have h := (hasDerivAt_pairEntropyGap m d hh).const_sub (entropy m) + convert! h using 1 + ext t; dsimp [pairH,pairEntropyGap]; ring + +lemma hasDerivAt_pairH_m {m d : ℝ} (hh : |m|+|d|<1) : + HasDerivAt (fun x => pairH x d) (-wallA m d) m := by + have h := (((hasDerivAt_entropy (pair_add_mem_Ioo m d hh)).comp m + ((hasDerivAt_id m).add_const d)).add ((hasDerivAt_entropy (pair_sub_mem_Ioo m d hh)).comp m + ((hasDerivAt_id m).sub_const d))).div_const 2 + convert! h using 1; dsimp [pairH,wallA]; ring + +lemma pairH_antitone_d {m d : ℝ} (hm : 0 ≤ m) (_hd : 0 ≤ d) (hmd : m+d<1) : + AntitoneOn (pairH m) (Icc 0 d) := by + apply antitoneOn_of_hasDerivWithinAt_nonpos (f' := fun t => -wallC m t) (convex_Icc _ _) + · intro t ht + exact (hasDerivAt_pairH_d (wall_domain hm ht.1 (by linarith [ht.2]))).continuousAt.continuousWithinAt + · intro t ht + simp only [interior_Icc,mem_Ioo] at ht + exact (hasDerivAt_pairH_d (wall_domain hm ht.1.le (by linarith [ht.2]))).hasDerivWithinAt + · intro t ht + simp only [interior_Icc,mem_Ioo] at ht + exact neg_nonpos.mpr (wallC_nonneg hm ht.1.le (by linarith [ht.2])) + +lemma pairH_le_entropy {m d : ℝ} (hm : 0 ≤ m) (hd : 0 ≤ d) (hmd : m+d<1) : + pairH m d ≤ entropy m := by + have h := pairEntropyGap_nonneg m d (wall_domain hm hd hmd) + dsimp [pairEntropyGap,pairH] at * + linarith + +lemma rate_entropy_slope {m d e : ℝ} (hm : 0 ≤ m) (hd : 0 ≤ d) (hmd : m+d<1) + (he : 0 < e) (hj : e < pairH m d) (hI : entropy m-e ≤ softCutoff) : + rDeriv (entropy m-e)*Real.artanh m ≤ rDeriv (pairH m d-e)*wallA m d := by + have hdom (t : ℝ) (ht : t ∈ Icc 0 d) : |m|+|t|<1 := + wall_domain hm ht.1 (by linarith [ht.2]) + have hjdom (t : ℝ) (ht : t ∈ Icc 0 d) : pairH m t-e ∈ Ioo 0 ell := by + have ha := pairH_antitone_d hm hd hmd ht ⟨hd,le_rfl⟩ ht.2 + have hb := pairH_le_entropy hm ht.1 (by linarith [ht.2]) + constructor <;> linarith [entropy_le_ell m] + have hjcut (t : ℝ) (ht : t ∈ Icc 0 d) : pairH m t-e ≤ softCutoff := by + linarith [pairH_le_entropy hm ht.1 (by linarith [ht.2])] + let f := fun t => rDeriv (pairH m t-e)*wallA m t + let f' := fun t => -rSecondDeriv (pairH m t-e)*wallC m t*wallA m t+ + rDeriv (pairH m t-e)*wallADeriv m t + have hf (t : ℝ) (ht : t ∈ Icc 0 d) : HasDerivAt f (f' t) t := by + have h := (((hasDerivAt_rDeriv (hjdom t ht)).comp t + ((hasDerivAt_pairH_d (hdom t ht)).sub_const e)).mul (hasDerivAt_wallA_d (hdom t ht))) + convert! h using 1; dsimp [f,f']; ring + have hf' (t : ℝ) (ht : t ∈ Icc 0 d) : 0 ≤ f' t := by + have hs := r_slope_bound ⟨(hjdom t ht).1.le,hjcut t ht⟩ + have ha := wallA_nonneg hm ht.1 (by linarith [ht.2]) + have hc := wallC_nonneg hm ht.1 (by linarith [ht.2]) + have hb := wallADeriv_lower hm ht.1 (by linarith [ht.2]) + have hr := rDeriv_ge_two (hjdom t ht).1.le (hjdom t ht).2 + have h1 := mul_le_mul_of_nonneg_right hs.le (mul_nonneg hc ha) + have h2 := mul_le_mul_of_nonneg_left hb (show 0 ≤ rDeriv (pairH m t-e) by linarith) + dsimp [f']; nlinarith + have hmono : MonotoneOn f (Icc 0 d) := by + apply monotoneOn_of_hasDerivWithinAt_nonneg (f' := f') (convex_Icc _ _) + · intro t ht; exact (hf t ht).continuousAt.continuousWithinAt + · intro t ht; exact (hf t (interior_subset ht)).hasDerivWithinAt + · intro t ht; exact hf' t (interior_subset ht) + have h := hmono ⟨le_rfl,hd⟩ ⟨hd,le_rfl⟩ hd + simpa [f,pairH,wallA] using h + +def wallDemand (m d e : ℝ) : ℝ := r (entropy m-e)-r (pairH m d-e) +def wallDemandDeriv (m d e : ℝ) : ℝ := + -rDeriv (entropy m-e)*Real.artanh m+rDeriv (pairH m d-e)*wallA m d + +lemma hasDerivAt_wallDemand {m d e : ℝ} (hm : 0 ≤ m) (hd : 0 ≤ d) (hmd : m+d<1) + (he : 0 < e) (hj : e < pairH m d) : + HasDerivAt (fun x => wallDemand x d e) (wallDemandDeriv m d e) m := by + have hp := pairH_le_entropy hm hd hmd + have hI : entropy m-e ∈ Ioo 0 ell := by constructor <;> linarith [entropy_le_ell m] + have hJ : pairH m d-e ∈ Ioo 0 ell := by constructor <;> linarith [entropy_le_ell m] + have hh := wall_domain hm hd hmd + have h := (((hasDerivAt_r hI).comp m + ((hasDerivAt_entropy (pair_mean_mem_Ioo m d hh)).sub_const e)).sub + ((hasDerivAt_r hJ).comp m ((hasDerivAt_pairH_m hh).sub_const e))) + convert! h using 1; dsimp [wallDemand,wallDemandDeriv]; ring + +lemma pairH_antitone_m {m d : ℝ} (_hm : 0 ≤ m) (hd : 0 ≤ d) (hmd : m+d<1) : + AntitoneOn (fun x => pairH x d) (Icc 0 m) := by + apply antitoneOn_of_hasDerivWithinAt_nonpos (f' := fun t => -wallA t d) (convex_Icc _ _) + · intro t ht + exact (hasDerivAt_pairH_m (wall_domain ht.1 hd (by linarith [ht.2]))).continuousAt.continuousWithinAt + · intro t ht + simp only [interior_Icc,mem_Ioo] at ht + exact (hasDerivAt_pairH_m (wall_domain ht.1.le hd (by linarith [ht.2]))).hasDerivWithinAt + · intro t ht + simp only [interior_Icc,mem_Ioo] at ht + exact neg_nonpos.mpr (wallA_nonneg ht.1.le hd (by linarith [ht.2])) + +lemma wall_comparison {m w d e : ℝ} (hm : 0 ≤ m) (hmw : m ≤ w) (hd : 0 ≤ d) (hwd : w+d<1) + (he : 0 < e) (hj : e < pairH w d) (hI : entropy m-e ≤ softCutoff) : + wallDemand m d e ≤ wallDemand w d e := by + have hdom (t : ℝ) (ht : t ∈ Icc m w) : 0 ≤ t ∧ t+d<1 ∧ e < pairH t d := by + have h := pairH_antitone_m (hm.trans hmw) hd hwd ⟨hm.trans ht.1,ht.2⟩ ⟨hm.trans hmw,le_rfl⟩ ht.2 + exact ⟨hm.trans ht.1,by linarith [ht.2],hj.trans_le h⟩ + have hcut (t : ℝ) (ht : t ∈ Icc m w) : entropy t-e ≤ softCutoff := by + have h := strictMonoOn_psi.monotoneOn (show m ∈ Icc 0 1 by constructor; exact hm; linarith) + (show t ∈ Icc 0 1 by constructor; exact hm.trans ht.1; linarith [ht.2]) ht.1 + dsimp [entropy] at *; linarith + have hmono : MonotoneOn (fun x => wallDemand x d e) (Icc m w) := by + apply monotoneOn_of_hasDerivWithinAt_nonneg (f' := fun t => wallDemandDeriv t d e) (convex_Icc _ _) + · intro t ht + obtain ⟨ht0,htd,htj⟩ := hdom t ht + exact (hasDerivAt_wallDemand ht0 hd htd he htj).continuousAt.continuousWithinAt + · intro t ht + obtain ⟨ht0,htd,htj⟩ := hdom t (interior_subset ht) + exact (hasDerivAt_wallDemand ht0 hd htd he htj).hasDerivWithinAt + · intro t ht + obtain ⟨ht0,htd,htj⟩ := hdom t (interior_subset ht) + have h := rate_entropy_slope ht0 hd htd he htj (hcut t (interior_subset ht)) + unfold wallDemandDeriv; linarith + exact hmono ⟨le_rfl,hmw⟩ ⟨hmw,le_rfl⟩ hmw + +end LeanBlast.CourtadeKumar +end +end + +end OAI diff --git a/lean/OAI/InformationTheory/SoftChannel/Window.lean b/lean/OAI/InformationTheory/SoftChannel/Window.lean new file mode 100644 index 0000000000000000000000000000000000000000..bc9763d3b45a7d2d617606088b9e450f9ccda297 --- /dev/null +++ b/lean/OAI/InformationTheory/SoftChannel/Window.lean @@ -0,0 +1,135 @@ +import OAI.InformationTheory.SoftChannel.PairEntropy + +namespace OAI + +section + +noncomputable section +open Set MeasureTheory +open scoped Topology +namespace LeanBlast.CourtadeKumar +open SoftChannel204 + +lemma clipKernel_scaled (b v : ℝ) : + ell * clipKernel b (ell*v) = clipKernel (b/ell) v := by + have hL := ell_pos + have he : ell*v-b = ell*(v-b/ell) := by field_simp + have hm : max (ell*(v-b/ell)) 0 = ell*max (v-b/ell) 0 := by + simpa using (mul_max_of_nonneg (v-b/ell) 0 hL.le).symm + rw [clipKernel,clipKernel,he,hm] + simp only [mul_pow] + field_simp + +lemma clipKernel_integral_scaled (b q s : ℝ) : + (∫ h in q..s, clipKernel b h) = ∫ v in q/ell..s/ell, clipKernel (b/ell) v := by + have h := intervalIntegral.smul_integral_comp_mul_left (a := q/ell) (b := s/ell) + (clipKernel b) ell + simp only [smul_eq_mul, mul_div_cancel₀ _ ell_pos.ne'] at h + rw [← h, ← intervalIntegral.integral_const_mul] + apply intervalIntegral.integral_congr + intro v _ + exact clipKernel_scaled b v + +lemma entropy_interval_bound {x z q s : ℝ} (hx0 : 0 ≤ x) (hx1 : x < 1) + (hz0 : 0 ≤ z) (hzg : z < (1-x)/(1+x)) + (hql : ell*(1-x-(1+x)*z) ≤ q) (hqs : q ≤ s) + (hsL : s ≤ ell) (hJ : s-q ≤ ell*z) : + (∫ h in q..s, clipKernel (Real.log (1+x)) h) ≤ + -(3/2:ℝ)*Real.log (1-((1-x)/(1+x))*z) := by + have hL := ell_pos + have hp : 0 < 1+x := by linarith + have hlo : 0 < 1-x-(1+x)*z := by + have := (lt_div_iff₀ hp).mp hzg + nlinarith + have hq0 : 0 < q := (mul_pos hL hlo).trans_le hql + let u := min (q/ell) (1-z) + have hzl : 1-x-(1+x)*z ≤ 1-z := by nlinarith + have hul : 1-x-(1+x)*z ≤ u := le_min ((le_div_iff₀ hL).mpr (by simpa only [mul_comm] using hql)) hzl + have huh : u ≤ 1-z := min_le_right _ _ + have huq : u ≤ q/ell := min_le_left _ _ + have hss : s/ell ≤ u+z := by + dsimp [u] + rw [← min_add_add_right] + apply le_min + · apply (div_le_iff₀ hL).mpr + have : q/ell*ell = q := div_mul_cancel₀ q hL.ne' + nlinarith + · simpa using (div_le_one hL).mpr hsL + have hu0 : 0 < u := hlo.trans_le hul + have huz0 : 0 < u+z := by linarith + rw [clipKernel_integral_scaled] + calc + _ ≤ ∫ v in u..u+z, clipKernel (Real.log (1+x)/ell) v := + intervalIntegral.integral_mono_interval huq ((div_le_div_iff_of_pos_right hL).mpr hqs) + hss (Filter.Eventually.of_forall (fun v => clipKernel_nonneg _ v)) + (intervalIntegrable_clipKernel _ hu0 huz0) + _ ≤ _ := by + exact thinning_interval hx0 hx1 hz0 hzg hul huh + +lemma entropy_common_output {a k : ℝ} (ha : a ∈ Icc (-1) 1) (hk : k ∈ Icc (0:ℝ) 1) : + k*entropy a ≤ entropy (1-k+k*a) := by + have h := concaveOn_entropy.2 (by norm_num : (1:ℝ) ∈ Icc (-1) 1) ha + (by linarith [hk.2] : 0 ≤ 1-k) hk.1 (by ring : 1-k+k=1) + simpa only [smul_eq_mul,mul_one,entropy_one,mul_zero,zero_add] using h + +lemma pair_entropy_floor {x d : ℝ} (hx : 0 ≤ x) (hd : 0 ≤ d) (hxd : x+d < 1) : + (1-x)*entropy (d/(1-x)) ≤ (entropy (x+d)+entropy (x-d))/2 := by + have hs : 0 < 1-x := by linarith + have hr : d/(1-x) ∈ Icc (-1) 1 := by + constructor + · linarith [div_nonneg hd hs.le] + · exact (div_le_one hs).mpr (by linarith) + have hnr : -(d/(1-x)) ∈ Icc (-1) 1 := by constructor <;> linarith [hr.1,hr.2] + have hk : 1-x ∈ Icc (0:ℝ) 1 := ⟨hs.le,by linarith⟩ + have h₁ := entropy_common_output hr hk + have h₂ := entropy_common_output hnr hk + have he₁ : 1-(1-x)+(1-x)*(d/(1-x)) = x+d := by field_simp; ring + have he₂ : 1-(1-x)+(1-x)*(-(d/(1-x))) = x-d := by field_simp; ring + rw [he₁] at h₁ + rw [he₂,entropy_neg] at h₂ + linarith + +lemma thinning_window {x d e : ℝ} (hx : 0 ≤ x) (hd : 0 < d) (hxd : x+d < 1) + (hefloor : (1-x)*entropy (d/(1-x)) ≤ e) + (hehi : e ≤ (entropy (x+d)+entropy (x-d))/2) : + (∫ h in (e+psi x)..(e+ell-(entropy (x+d)+entropy (x-d))/2), + clipKernel (Real.log (1+x)) h) ≤ + -(3/2:ℝ)*Real.log (1-d^2/(1+x)^2) := by + have hs : 0 < 1-x := by linarith + have hp : 0 < 1+x := by linarith + have hh : |x|+|d| < 1 := by rw [abs_of_nonneg hx,abs_of_pos hd]; exact hxd + let z := d^2/((1-x)*(1+x)) + have hz : 0 ≤ z := by dsimp [z]; positivity + have hdz : z < (1-x)/(1+x) := by + dsimp [z] + apply (div_lt_div_iff₀ (mul_pos hs hp) hp).mpr + nlinarith [mul_pos (show 0 < 1-x-d by linarith) (show 0 < 1-x+d by linarith)] + have hratio : |d/(1-x)| ≤ 1 := by + rw [abs_of_pos (div_pos hd hs)] + exact (div_le_one hs).mpr (by linarith) + have hfloor := mul_le_mul_of_nonneg_left (ell_mul_one_sub_sq_le_entropy hratio) hs.le + have hfloorEq : (1-x)*(ell*(1-(d/(1-x))^2)) = ell*(1-x-(1+x)*z) := by + dsimp [z]; field_simp + rw [hfloorEq] at hfloor + have hql : ell*(1-x-(1+x)*z) ≤ e+psi x := by linarith [psi_nonneg x] + have hqs : e+psi x ≤ e+ell-(entropy (x+d)+entropy (x-d))/2 := by + have h := pairEntropyGap_nonneg x d hh + simp only [pairEntropyGap,entropy] at h ⊢ + linarith + have hJ : e+ell-(entropy (x+d)+entropy (x-d))/2-(e+psi x) ≤ ell*z := by + have h := pairEntropyGap_le_quadratic x d hh + have heq : 1-x^2 = (1-x)*(1+x) := by ring + rw [heq] at h + change pairEntropyGap x d ≤ ell*z at h + simp only [pairEntropyGap,entropy] at h ⊢ + linarith + have hzEq : ((1-x)/(1+x))*z = d^2/(1+x)^2 := by + dsimp [z]; field_simp + have H := entropy_interval_bound hx (by linarith) hz hdz hql hqs (by linarith) hJ + rwa [hzEq] at H + +end LeanBlast.CourtadeKumar +end +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/Barker/Main.lean b/lean/OAI/LinearAlgebra/Barker/Main.lean new file mode 100644 index 0000000000000000000000000000000000000000..b1dc0c7bd1505fafaf890909bc606b5cdd8d233b --- /dev/null +++ b/lean/OAI/LinearAlgebra/Barker/Main.lean @@ -0,0 +1,77 @@ +import OAI.LinearAlgebra.Barker.Parity +import OAI.LinearAlgebra.Barker.Wraparound +import OAI.LinearAlgebra.Barker.PeriodicModFour +import OAI.LinearAlgebra.CirculantHadamard.Main + +namespace OAI + +namespace CirculantHadamard.Barker + +theorem four_dvd_length {n : ℕ} [NeZero n] {h : Fin n → ℤ} + (hb : IsBarker h) (hn : Even n) (hnlarge : 2 < n) : (4 : ℤ) ∣ (n : ℤ) := by + let a : Fin n := ⟨2, hnlarge⟩ + have ha : a ≠ 0 := by + intro heq + have hv := congrArg Fin.val heq + change 2 = 0 at hv + omega + have ht : aperiodic h 2 = 0 := + aperiodic_even_shift_zero hb hn 2 (by decide) (by omega) hnlarge + have hnsub : Even (n - 2) := by + obtain ⟨u, hu⟩ := hn + exact ⟨u - 1, by omega⟩ + have ht' : aperiodic h (n - 2) = 0 := + aperiodic_even_shift_zero hb hn (n - 2) hnsub (by omega) (by omega) + have hpa : periodic h a = 0 := by + rw [periodic_eq_aperiodic_add h a ha] + change aperiodic h 2 + aperiodic h (n - 2) = 0 + rw [ht, ht', add_zero] + have hd := periodic_mod_four h hb.1 a + rw [hpa, zero_sub] at hd + exact dvd_neg.mp hd + +theorem periodic_offpeak_zero {n : ℕ} [NeZero n] {h : Fin n → ℤ} + (hb : IsBarker h) (hn : Even n) (hnlarge : 2 < n) + (a : Fin n) (ha : a ≠ 0) : periodic h a = 0 := by + have ha0 : 0 < a.val := by + by_contra hnot + have hz : a.val = 0 := by omega + apply ha + apply Fin.ext + simpa using hz + have hab := aperiodic_bounds hb a.val ha0 a.isLt + have hac := aperiodic_bounds hb (n - a.val) (by omega) (by omega) + have hp := periodic_eq_aperiodic_add h a ha + obtain ⟨u, hu⟩ := periodic_mod_four h hb.1 a + obtain ⟨v, hv⟩ := four_dvd_length hb hn hnlarge + omega + +theorem existsRealCirculantHadamard_of_even_barker {n : ℕ} {h : Fin n → ℤ} + (hb : IsBarker h) (hn : Even n) (hnlarge : 2 < n) : + ExistsRealCirculantHadamard n := by + let : NeZero n := ⟨by omega⟩ + apply existsReal_iff_integer_autocorrelation.mpr + refine ⟨h, hb.1, ?_⟩ + intro a + change periodic h a = if a = 0 then (n : ℤ) else 0 + by_cases ha : a = 0 + · subst a + simp [periodic_zero h hb.1] + · rw [ite_eq_right ha] + exact periodic_offpeak_zero hb hn hnlarge a ha + +theorem even_length_eq_two_or_four {n : ℕ} (h : Fin n → ℤ) + (hnpos : 0 < n) (hn : Even n) (hb : IsBarker h) : n = 2 ∨ n = 4 := by + by_cases hsmall : n ≤ 2 + · left + obtain ⟨u, hu⟩ := hn + omega + · have hnlarge : 2 < n := by omega + have hH := existsRealCirculantHadamard_of_even_barker hb hn hnlarge + have hc := (exists_iff_order_one_or_four n hnpos).mp hH + right + omega + +end CirculantHadamard.Barker + +end OAI diff --git a/lean/OAI/LinearAlgebra/Barker/Model.lean b/lean/OAI/LinearAlgebra/Barker/Model.lean new file mode 100644 index 0000000000000000000000000000000000000000..dcb6a2ff0d2db9a160307f02f1b92a5242e7c01b --- /dev/null +++ b/lean/OAI/LinearAlgebra/Barker/Model.lean @@ -0,0 +1,21 @@ +import OAI.LinearAlgebra.CirculantHadamard.Model +import Lean.Elab.Tactic.Omega + +namespace OAI + +namespace CirculantHadamard.Barker + +open scoped BigOperators + +def aperiodic {n : ℕ} (h : Fin n → ℤ) (k : ℕ) : ℤ := + ∑ j : Fin (n - k), h ⟨j.val, by omega⟩ * h ⟨j.val + k, by omega⟩ + +def periodic {n : ℕ} [NeZero n] (h : Fin n → ℤ) (a : Fin n) : ℤ := + ∑ j : Fin n, h j * h (j - a) + +def IsBarker {n : ℕ} (h : Fin n → ℤ) : Prop := + (∀ j, IsSign (h j)) ∧ ∀ k : ℕ, 0 < k → k < n → |aperiodic h k| ≤ 1 + +end CirculantHadamard.Barker + +end OAI diff --git a/lean/OAI/LinearAlgebra/Barker/Parity.lean b/lean/OAI/LinearAlgebra/Barker/Parity.lean new file mode 100644 index 0000000000000000000000000000000000000000..021327247e10a3bc3435865bc84b2258b4be9f83 --- /dev/null +++ b/lean/OAI/LinearAlgebra/Barker/Parity.lean @@ -0,0 +1,45 @@ +import OAI.LinearAlgebra.Barker.Model +import Mathlib.Tactic.NormNum + +namespace OAI + +namespace CirculantHadamard.Barker + +open scoped BigOperators + +theorem aperiodic_parity {n : ℕ} (h : Fin n → ℤ) + (hs : ∀ j, IsSign (h j)) (k : ℕ) : + (2 : ℤ) ∣ aperiodic h k - ((n - k : ℕ) : ℤ) := by + have hp (j : Fin (n - k)) : + (2 : ℤ) ∣ h ⟨j.val, by omega⟩ * h ⟨j.val + k, by omega⟩ - 1 := by + rcases hs ⟨j.val, by omega⟩ with hx | hx + all_goals rcases hs ⟨j.val + k, by omega⟩ with hy | hy + all_goals norm_num [hx, hy] + have hsum : (2 : ℤ) ∣ ∑ j : Fin (n - k), + (h ⟨j.val, by omega⟩ * h ⟨j.val + k, by omega⟩ - 1) := + Finset.dvd_sum (fun j _ => hp j) + simpa [aperiodic, Finset.sum_sub_distrib] using hsum + +theorem aperiodic_bounds {n : ℕ} {h : Fin n → ℤ} (hb : IsBarker h) + (k : ℕ) (hk0 : 0 < k) (hkn : k < n) : + -1 ≤ aperiodic h k ∧ aperiodic h k ≤ 1 := + abs_le.mp (hb.2 k hk0 hkn) + +theorem aperiodic_even_shift_zero {n : ℕ} {h : Fin n → ℤ} (hb : IsBarker h) + (hn : Even n) (k : ℕ) (hk : Even k) (hk0 : 0 < k) (hkn : k < n) : + aperiodic h k = 0 := by + obtain ⟨u, hu⟩ := hn + obtain ⟨v, hv⟩ := hk + obtain ⟨d, hd⟩ := aperiodic_parity h hb.1 k + have hbnd := aperiodic_bounds hb k hk0 hkn + omega + +theorem periodic_zero {n : ℕ} [NeZero n] (h : Fin n → ℤ) + (hs : ∀ j, IsSign (h j)) : periodic h 0 = (n : ℤ) := by + have hp (j : Fin n) : h j * h j = 1 := by + rcases hs j with hj | hj <;> simp [hj] + simp [periodic, hp] + +end CirculantHadamard.Barker + +end OAI diff --git a/lean/OAI/LinearAlgebra/Barker/PeriodicModFour.lean b/lean/OAI/LinearAlgebra/Barker/PeriodicModFour.lean new file mode 100644 index 0000000000000000000000000000000000000000..e68aa363f708cb4de524ded1e356b884a8e2884e --- /dev/null +++ b/lean/OAI/LinearAlgebra/Barker/PeriodicModFour.lean @@ -0,0 +1,61 @@ +import OAI.LinearAlgebra.Barker.Model +import Mathlib.Tactic.NormNum +import Mathlib.Tactic.Ring + +namespace OAI + +namespace CirculantHadamard.Barker + +open scoped BigOperators + +def negativeBit {n : ℕ} (h : Fin n → ℤ) (j : Fin n) : ℤ := + if h j = -1 then 1 else 0 + +theorem sign_eq_one_sub_two_bit {n : ℕ} (h : Fin n → ℤ) + (hs : ∀ j, IsSign (h j)) (j : Fin n) : + h j = 1 - 2 * negativeBit h j := by + rcases hs j with hj | hj <;> norm_num [negativeBit, hj] + +def cyclicSubtractEquiv {n : ℕ} [NeZero n] (a : Fin n) : Fin n ≃ Fin n where + toFun j := j - a + invFun j := j + a + left_inv j := sub_add_cancel j a + right_inv j := add_sub_cancel_right j a + +theorem sum_negativeBit_shift {n : ℕ} [NeZero n] (h : Fin n → ℤ) (a : Fin n) : + (∑ j, negativeBit h (j - a)) = ∑ j, negativeBit h j := by + exact (cyclicSubtractEquiv a).sum_comp (negativeBit h) + +theorem periodic_bit_identity {n : ℕ} [NeZero n] (h : Fin n → ℤ) + (hs : ∀ j, IsSign (h j)) (a : Fin n) : + periodic h a = (n : ℤ) + 4 * + ((∑ j, negativeBit h j * negativeBit h (j - a)) - ∑ j, negativeBit h j) := by + have hterm (j : Fin n) : h j * h (j - a) = + 1 - 2 * negativeBit h j - 2 * negativeBit h (j - a) + + 4 * (negativeBit h j * negativeBit h (j - a)) := by + rw [sign_eq_one_sub_two_bit h hs j, sign_eq_one_sub_two_bit h hs (j - a)] + ring + calc + periodic h a = ∑ j : Fin n, + (1 - 2 * negativeBit h j - 2 * negativeBit h (j - a) + + 4 * (negativeBit h j * negativeBit h (j - a))) := by + unfold periodic + exact Finset.sum_congr rfl (fun j _ => hterm j) + _ = (n : ℤ) - 2 * (∑ j, negativeBit h j) - + 2 * (∑ j, negativeBit h (j - a)) + + 4 * (∑ j, negativeBit h j * negativeBit h (j - a)) := by + simp only [Finset.sum_add_distrib, Finset.sum_sub_distrib, ← Finset.mul_sum] + simp + _ = _ := by rw [sum_negativeBit_shift]; ring + +theorem periodic_mod_four {n : ℕ} [NeZero n] (h : Fin n → ℤ) + (hs : ∀ j, IsSign (h j)) (a : Fin n) : + (4 : ℤ) ∣ periodic h a - (n : ℤ) := by + refine ⟨(∑ j, negativeBit h j * negativeBit h (j - a)) - + ∑ j, negativeBit h j, ?_⟩ + rw [periodic_bit_identity h hs a] + ring + +end CirculantHadamard.Barker + +end OAI diff --git a/lean/OAI/LinearAlgebra/Barker/Wraparound.lean b/lean/OAI/LinearAlgebra/Barker/Wraparound.lean new file mode 100644 index 0000000000000000000000000000000000000000..98cc7a74b5ea4ce42ab2c434a592dd6b341f89df --- /dev/null +++ b/lean/OAI/LinearAlgebra/Barker/Wraparound.lean @@ -0,0 +1,73 @@ +import OAI.LinearAlgebra.Barker.Model +import Mathlib.Algebra.BigOperators.Fin + +namespace OAI + +namespace CirculantHadamard.Barker +open scoped BigOperators + +theorem periodic_eq_aperiodic_add {n : ℕ} [NeZero n] + (h : Fin n → ℤ) (a : Fin n) (_ : a ≠ 0) : + periodic h a = aperiodic h a.val + aperiodic h (n - a.val) := by + have ha_le : a.val ≤ n := Nat.le_of_lt a.isLt + have hn : a.val + (n - a.val) = n := Nat.add_sub_of_le ha_le + let f : Fin n → ℤ := fun j => h j * h (j - a) + have split := Fin.sum_univ_add + (fun j : Fin (a.val + (n - a.val)) => f (j.cast hn)) + rw [Fin.sum_congr' f hn] at split + have low : + (∑ j : Fin a.val, f ((Fin.castAdd (n - a.val) j).cast hn)) = + aperiodic h (n - a.val) := by + have hc : n - (n - a.val) = a.val := by omega + have reindex : aperiodic h (n - a.val) = + ∑ j : Fin a.val, + h ⟨j.val, by omega⟩ * h ⟨j.val + (n - a.val), by omega⟩ := by + unfold aperiodic + apply Fintype.sum_equiv (finCongr hc) + intro j + rfl + rw [reindex] + apply Finset.sum_congr rfl + intro j _ + have hsub : ((Fin.castAdd (n - a.val) j).cast hn - a) = + (⟨j.val + (n - a.val), by omega⟩ : Fin n) := by + apply Fin.ext + have hlt : (Fin.castAdd (n - a.val) j).cast hn < a := by + change j.val < a.val + exact j.isLt + rw [Fin.coe_sub_iff_lt.mpr hlt] + dsimp only [Fin.val_cast, Fin.val_castAdd] + omega + change h ((Fin.castAdd (n - a.val) j).cast hn) * + h ((Fin.castAdd (n - a.val) j).cast hn - a) = _ + rw [hsub] + rfl + have high : + (∑ j : Fin (n - a.val), f ((Fin.natAdd a.val j).cast hn)) = + aperiodic h a.val := by + unfold aperiodic + apply Finset.sum_congr rfl + intro j _ + have hsub : ((Fin.natAdd a.val j).cast hn - a) = + (⟨j.val, by omega⟩ : Fin n) := by + apply Fin.ext + have hle : a ≤ (Fin.natAdd a.val j).cast hn := by + change a.val ≤ a.val + j.val + omega + rw [Fin.sub_val_of_le hle] + dsimp only [Fin.val_cast, Fin.val_natAdd] + omega + change h ((Fin.natAdd a.val j).cast hn) * + h ((Fin.natAdd a.val j).cast hn - a) = _ + rw [hsub, mul_comm] + congr 1 + apply congrArg h + apply Fin.ext + change a.val + j.val = j.val + a.val + omega + change (∑ j : Fin n, f j) = _ + rw [split, low, high, add_comm] + +end CirculantHadamard.Barker + +end OAI diff --git a/lean/OAI/LinearAlgebra/CirculantHadamard.lean b/lean/OAI/LinearAlgebra/CirculantHadamard.lean new file mode 100644 index 0000000000000000000000000000000000000000..831c16abd2ec83d0062df71f11f7cf52237d4752 --- /dev/null +++ b/lean/OAI/LinearAlgebra/CirculantHadamard.lean @@ -0,0 +1 @@ +import OAI.LinearAlgebra.CirculantHadamard.Main diff --git a/lean/OAI/LinearAlgebra/CirculantHadamard/AlternatingField.lean b/lean/OAI/LinearAlgebra/CirculantHadamard/AlternatingField.lean new file mode 100644 index 0000000000000000000000000000000000000000..6f4b616da4492a25d1ff93f627acf76b4ffe9e0d --- /dev/null +++ b/lean/OAI/LinearAlgebra/CirculantHadamard/AlternatingField.lean @@ -0,0 +1,70 @@ +import OAI.LinearAlgebra.CirculantHadamard.AlternatingProducts +import OAI.LinearAlgebra.CirculantHadamard.AlternatingNorm + +namespace OAI + +universe uI uK uR + +/-! +# Clearing the actual alternating fraction + +The field formula for an integral alternating product is first converted to +an identity in its coefficient ring. Arbitrary complex homomorphisms are then +applied to that identity, without extending them to the field of fractions. +The only nonvanishing inputs are the individual character values. +-/ + +namespace CirculantHadamard + +open scoped BigOperators + +theorem oddSubsetProduct_ne_zero {I : Type uI} {K : Type uK} [Field K] + (t : Finset I) (x : Finset I → K) + (hx : ∀ S ⊆ t, x S ≠ 0) : oddSubsetProduct t x ≠ 0 := by + classical + apply Finset.prod_ne_zero_iff.mpr + intro S hS + exact hx S (Finset.mem_powerset.mp (Finset.mem_filter.mp hS).1) + +/-- An equality in the fraction field genuinely clears to the coefficient +ring. The field embedding is used only to reflect this polynomial identity. -/ +theorem cleared_alternatingProduct_identity {I : Type uI} {R : Type uR} {K : Type uK} + [CommRing R] [Field K] (f : R →+* K) (hf : Function.Injective f) + (t : Finset I) (x : Finset I → R) (z : R) + (hx : ∀ S ⊆ t, f (x S) ≠ 0) + (hz : f z = alternatingProduct t (fun S => f (x S))) : + z * oddSubsetProduct t x = evenSubsetProduct t x := by + have hodd : f (oddSubsetProduct t x) = + oddSubsetProduct t (fun S => f (x S)) := + map_oddSubsetProduct f.toMonoidHom t x + have heven : f (evenSubsetProduct t x) = + evenSubsetProduct t (fun S => f (x S)) := + map_evenSubsetProduct f.toMonoidHom t x + apply hf + rw [map_mul, hodd, heven, hz, alternatingProduct_eq_even_div_odd] + exact div_mul_cancel₀ _ (oddSubsetProduct_ne_zero t (fun S => f (x S)) hx) + +/-- Once the actual alternating fraction belongs to the coefficient ring, +every complex homomorphism has modulus one if each character value has the +same positive modulus. Subset parity supplies the equal factor counts. -/ +theorem norm_hom_integral_alternatingProduct {I : Type uI} {R : Type uR} {K : Type uK} + [CommRing R] [Field K] (f : R →+* K) (hf : Function.Injective f) + (t : Finset I) (ht : t.Nonempty) (x : Finset I → R) (z : R) + (hx : ∀ S ⊆ t, f (x S) ≠ 0) + (hz : f z = alternatingProduct t (fun S => f (x S))) + (σ : R →+* ℂ) (c : ℝ) (hc : 0 < c) + (hnorm : ∀ S ⊆ t, ‖σ (x S)‖ = c) : ‖σ z‖ = 1 := by + classical + apply AlternatingNorm.norm_eq_one_of_balanced_products σ x + (t.powerset.filter (fun S => Even S.card)) + (t.powerset.filter (fun S => Odd S.card)) z c hc + (card_even_subsets_eq_card_odd_subsets t ht) + · intro S hS + exact hnorm S (Finset.mem_powerset.mp (Finset.mem_filter.mp hS).1) + · intro S hS + exact hnorm S (Finset.mem_powerset.mp (Finset.mem_filter.mp hS).1) + · exact cleared_alternatingProduct_identity f hf t x z hx hz + +end CirculantHadamard + +end OAI diff --git a/lean/OAI/LinearAlgebra/CirculantHadamard/AlternatingLocalization.lean b/lean/OAI/LinearAlgebra/CirculantHadamard/AlternatingLocalization.lean new file mode 100644 index 0000000000000000000000000000000000000000..3165303b499374fa54ff3f201ebe5e6f8da77995 --- /dev/null +++ b/lean/OAI/LinearAlgebra/CirculantHadamard/AlternatingLocalization.lean @@ -0,0 +1,585 @@ +import OAI.LinearAlgebra.CirculantHadamard.AlternatingProducts +import OAI.LinearAlgebra.CirculantHadamard.LocalizationIntersection +import OAI.LinearAlgebra.CirculantHadamard.LocalizationMaps +import OAI.LinearAlgebra.CirculantHadamard.ResidueOneAssociation +import OAI.LinearAlgebra.CirculantHadamard.CyclotomicAwayLocal +import OAI.LinearAlgebra.CirculantHadamard.PrimeCharacterEvaluations +import OAI.LinearAlgebra.CirculantHadamard.LocalComparison +import OAI.LinearAlgebra.CirculantHadamard.CoefficientEvaluation +import Mathlib.RingTheory.AdjoinRoot +import Mathlib.RingTheory.Polynomial.Cyclotomic.Roots +import Mathlib.RingTheory.LocalRing.ResidueField.Basic +import Mathlib.Algebra.CharP.Lemmas +import Mathlib.Data.Nat.PrimeFin +import Mathlib.Algebra.BigOperators.Group.List.Lemmas +import Mathlib.Algebra.BigOperators.Ring.Finset + +namespace OAI + +universe uR uK uAZero uS uL uI uk + +/-! +# Local representatives of the fixed alternating product + +All local rings are actual localizations at maximal ideals. Their maps +into the common fraction field are canonical. The adjoined-root comparison +map is constructed from the actual base-ring inclusion and cyclotomic relation. +Membership in every maximal localization implies membership in the base ring. +-/ + +noncomputable section + +namespace CirculantHadamard.AlternatingLocalization + +open scoped BigOperators + +abbrev AtMaximal (R : Type uR) [CommRing R] (m : MaximalSpectrum R) := + Localization.AtPrime m.asIdeal + +def toFraction {R : Type uR} [CommRing R] [IsDomain R] + (K : Type uK) [Field K] [Algebra R K] [IsFractionRing R K] + (m : MaximalSpectrum R) : AtMaximal R m →ₐ[R] K := + Localization.mapToFractionRing K m.asIdeal.primeCompl (AtMaximal R m) + m.asIdeal.primeCompl_le_nonZeroDivisors + +theorem toFraction_injective {R : Type uR} [CommRing R] [IsDomain R] + (K : Type uK) [Field K] [Algebra R K] [IsFractionRing R K] + (m : MaximalSpectrum R) : Function.Injective (toFraction K m) := by + apply IsLocalization.injective_of_map_algebraMap_zero + (M := m.asIdeal.primeCompl) (AtMaximal R m) (toFraction K m).toRingHom + intro a ha + change toFraction K m (algebraMap R (AtMaximal R m) a) = 0 at ha + rw [AlgHom.commutes] at ha + have ha0 : a = 0 := IsFractionRing.injective R K (by simpa only [map_zero] using ha) + rw [ha0, map_zero] + +/-- The integral representative and a local representative of the same fixed +fraction agree under the actual coefficient localization map. -/ +theorem local_representative_eq {R : Type uR} [CommRing R] [IsDomain R] + (K : Type uK) [Field K] [Algebra R K] [IsFractionRing R K] + (m : MaximalSpectrum R) (b : R) (v : AtMaximal R m) + (h : algebraMap R K b = toFraction K m v) : + algebraMap R (AtMaximal R m) b = v := by + apply toFraction_injective K m + simpa only [AlgHom.commutes] using h + +section ActualComparisonMap + +variable {A₀ : Type uAZero} {R : Type uR} [CommRing A₀] [CommRing R] + +/-- The actual coefficient localization at the contracted prime. Maximality +of the contraction is a separate input to the local comparison theorem, not +an assumption needed to construct this map. -/ +abbrev AtComap (f : A₀ →+* R) (m : MaximalSpectrum R) := + Localization.AtPrime (m.asIdeal.comap f) + +def baseToLocal (f : A₀ →+* R) (m : MaximalSpectrum R) : + AtComap f m →+* AtMaximal R m := + localizationAtComapMap f m.asIdeal + +@[simp] theorem baseToLocal_algebraMap (f : A₀ →+* R) (m : MaximalSpectrum R) + (a : A₀) : + baseToLocal f m (algebraMap A₀ (AtComap f m) a) = + algebraMap R (AtMaximal R m) (f a) := + localizationAtComapMap_algebraMap f m.asIdeal a + +/-- The comparison algebra is mapped by the universal property of its actual +cyclotomic quotient, rather than by assuming an arbitrary extension map. -/ +def comparisonToLocal (f : A₀ →+* R) (m : MaximalSpectrum R) (p : ℕ) (rho : R) + (hroot : (Polynomial.cyclotomic p R).eval rho = 0) : + AdjoinRoot (Polynomial.cyclotomic p (AtComap f m)) →+* AtMaximal R m := + AdjoinRoot.lift (baseToLocal f m) (algebraMap R (AtMaximal R m) rho) (by + rw [Polynomial.eval₂_eq_eval_map, Polynomial.map_cyclotomic, + Polynomial.cyclotomic.eval_apply, hroot, map_zero]) + +@[simp] theorem comparisonToLocal_root (f : A₀ →+* R) (m : MaximalSpectrum R) + (p : ℕ) (rho : R) (hroot : (Polynomial.cyclotomic p R).eval rho = 0) : + comparisonToLocal f m p rho hroot + (AdjoinRoot.root (Polynomial.cyclotomic p (AtComap f m))) = + algebraMap R (AtMaximal R m) rho := + AdjoinRoot.lift_root _ + +@[simp] theorem comparisonToLocal_of (f : A₀ →+* R) (m : MaximalSpectrum R) + (p : ℕ) (rho : R) (hroot : (Polynomial.cyclotomic p R).eval rho = 0) + (a : AtComap f m) : + comparisonToLocal f m p rho hroot + (AdjoinRoot.of (Polynomial.cyclotomic p (AtComap f m)) a) = + baseToLocal f m a := + AdjoinRoot.lift_of _ + +/-- Residue characteristic is derived from membership of the rational prime, +not assumed as an independent property of the chosen maximal ideal. -/ +theorem residue_charP (m : MaximalSpectrum R) (p : ℕ) (hp : p.Prime) + (hpm : (p : R) ∈ m.asIdeal) : + CharP (IsLocalRing.ResidueField (AtMaximal R m)) p := by + let k := IsLocalRing.ResidueField (AtMaximal R m) + have hpzero : (p : k) = 0 := by + have hm : algebraMap R (AtMaximal R m) (p : R) ∈ + IsLocalRing.maximalIdeal (AtMaximal R m) := + (IsLocalization.AtPrime.to_map_mem_maximal_iff (AtMaximal R m) m.asIdeal _).mpr hpm + simpa only [map_natCast] using (IsLocalRing.residue_eq_zero_iff _).mpr hm + exact (CharP.charP_iff_prime_eq_zero hp).mpr hpzero + +/-- A p-th root has residue one at every maximal ideal containing p. -/ +theorem residue_root_eq_one (m : MaximalSpectrum R) (p : ℕ) (hp : p.Prime) + (hpm : (p : R) ∈ m.asIdeal) (rho : R) (hrho : rho ^ p = 1) : + IsLocalRing.residue (AtMaximal R m) (algebraMap R (AtMaximal R m) rho) = 1 := by + let k := IsLocalRing.ResidueField (AtMaximal R m) + let : Fact p.Prime := ⟨hp⟩ + let : CharP k p := residue_charP m p hp hpm + let r : k := IsLocalRing.residue (AtMaximal R m) + (algebraMap R (AtMaximal R m) rho) + have hpow : r ^ p = 1 := by + dsimp [r] + rw [← map_pow, ← map_pow, hrho, map_one, map_one] + have hnil : (r - 1) ^ p = 0 := by rw [sub_pow_char, hpow, one_pow, sub_self] + exact sub_eq_zero.mp (eq_zero_of_pow_eq_zero hnil) + +theorem residue_unit_eq_one_of_span {S : Type uS} {L : Type uL} [CommRing S] [CommRing L] + [IsLocalRing L] (f : S →+* L) (rho : S) (v : Sˣ) + (hv : (v : S) - 1 ∈ Ideal.span ({rho - 1} : Set S)) + (hrho : IsLocalRing.residue L (f rho) = 1) : + IsLocalRing.residue L ((Units.map f.toMonoidHom v : Lˣ) : L) = 1 := by + let g : S →+* IsLocalRing.ResidueField L := (IsLocalRing.residue L).comp f + have hspan : Ideal.span ({rho - 1} : Set S) ≤ RingHom.ker g := by + apply Ideal.span_le.mpr + intro a ha + have ha' : a = rho - 1 := Set.mem_singleton_iff.mp ha + subst a + change g (rho - 1) = 0 + simp only [map_sub, map_one, RingHom.comp_apply, g, hrho, sub_self] + have hz := hspan hv + change g ((v : S) - 1) = 0 at hz + have hval : g (v : S) = 1 := sub_eq_zero.mp (by simpa only [map_sub, map_one] using hz) + exact hval + +theorem map_residueOneAssociated {S : Type uS} {L : Type uL} [CommRing S] [CommRing L] + [IsLocalRing S] [IsLocalRing L] (f : S →+* L) (rho : S) + (hmax : IsLocalRing.maximalIdeal S = Ideal.span ({rho - 1} : Set S)) + (hrho : IsLocalRing.residue L (f rho) = 1) {a b : S} + (hab : LocalComparison.ResidueOneAssociated (IsLocalRing.residue S) a b) : + LocalComparison.ResidueOneAssociated (IsLocalRing.residue L) (f a) (f b) := by + obtain ⟨v, hv, hres⟩ := hab + have hspan : (v : S) - 1 ∈ Ideal.span ({rho - 1} : Set S) := by + rw [← hmax] + apply (IsLocalRing.residue_eq_zero_iff _).mp + rw [map_sub, map_one, hres, sub_self] + refine ⟨Units.map f.toMonoidHom v, ?_, + residue_unit_eq_one_of_span f rho v hspan hrho⟩ + change f a = f (v : S) * f b + simpa only [map_mul, Units.coe_map] using congrArg f hv + +end ActualComparisonMap + +/-- The local association is converted to the actual fraction-field quotient +only after the augmentation image is known to be nonzero. -/ +theorem local_edge_of_associated {R : Type uR} {K : Type uK} [CommRing R] [IsDomain R] + [Field K] [Algebra R K] [IsFractionRing R K] (m : MaximalSpectrum R) + (a b : R) (hb : algebraMap R K b ≠ 0) + (h : LocalComparison.ResidueOneAssociated (IsLocalRing.residue (AtMaximal R m)) + (algebraMap R (AtMaximal R m) a) (algebraMap R (AtMaximal R m) b)) : + ∃ v : (AtMaximal R m)ˣ, + toFraction K m (v : AtMaximal R m) = algebraMap R K a / algebraMap R K b ∧ + IsLocalRing.residue (AtMaximal R m) (v : AtMaximal R m) = 1 := by + obtain ⟨v, hv, hres⟩ := h + refine ⟨v, ?_, hres⟩ + apply (eq_div_iff hb).mpr + have hmap := congrArg (toFraction K m) hv + simpa only [map_mul, AlgHom.commutes] using hmap.symm + +/-- A finite prime factorization supplies the away-from-u unit, including u=1. -/ +theorem natCast_isUnit_of_primeFactors {R : Type uR} [CommRing R] + (u : ℕ) (hu : u ≠ 0) (hprime : ∀ p ∈ u.primeFactors, IsUnit (p : R)) : + IsUnit (u : R) := by + rw [← Nat.prod_primeFactorsList hu, Nat.cast_list_prod] + apply List.prod_isUnit + intro a ha + obtain ⟨p, hp, rfl⟩ := List.mem_map.mp ha + exact hprime p (Nat.mem_primeFactors_iff_mem_primeFactorsList.mpr hp) + +theorem local_norm_factor_isUnit {R : Type uR} [CommRing R] + (m : MaximalSpectrum R) (u : ℕ) (hu : u ≠ 0) + (havoid : ∀ p ∈ u.primeFactors, (p : R) ∉ m.asIdeal) + (x y : R) (hnorm : x * y = (u : R) ^ 2) : + IsUnit (algebraMap R (AtMaximal R m) x) := by + have huunit : IsUnit (u : AtMaximal R m) := + natCast_isUnit_of_primeFactors u hu (fun p hp => by + have h := (IsLocalization.AtPrime.isUnit_to_map_iff + (AtMaximal R m) m.asIdeal (p : R)).mpr (havoid p hp) + simpa only [map_natCast] using h) + apply isUnit_of_mul_isUnit_left (y := algebraMap R (AtMaximal R m) y) + rw [← map_mul, hnorm, map_pow, map_natCast] + exact huunit.pow 2 + +section AlternatingUnits + +variable {I : Type uI} {R : Type uR} {K : Type uK} {k : Type uk} [DecidableEq I] [CommRing R] [Field K] [Field k] + +theorem exists_unit_of_edges (f : R →+* K) (res : R →+* k) + (t : Finset I) (p : I) (hp : p ∈ t) (x : Finset I → K) + (hedge : ∀ S ∈ (t.erase p).powerset, ∃ v : Rˣ, + f (v : R) = x (insert p S) / x S ∧ res (v : R) = 1) : + ∃ v : Rˣ, f (v : R) = alternatingProduct t x ∧ res (v : R) = 1 := by + classical + let edge : Finset I → Rˣ := fun S => + if hS : S ∈ (t.erase p).powerset then Classical.choose (hedge S hS) else 1 + have hedge' : ∀ S ∈ (t.erase p).powerset, + f (edge S : R) = x (insert p S) / x S ∧ res (edge S : R) = 1 := by + intro S hS + simpa only [edge, dite_eq_left hS] using Classical.choose_spec (hedge S hS) + let v : Rˣ := ∏ S ∈ (t.erase p).powerset, (edge S)⁻¹ ^ subsetSign S + let toK : Rˣ →* K := f.toMonoidHom.comp (Units.coeHom R) + let tok : Rˣ →* k := res.toMonoidHom.comp (Units.coeHom R) + refine ⟨v, ?_, ?_⟩ + · change toK v = alternatingProduct t x + rw [alternatingProduct_pair t x p hp] + simp only [v, map_prod, map_zpow, map_inv] + apply Finset.prod_congr rfl + intro S hS + change (f (edge S : R))⁻¹ ^ subsetSign S = _ + rw [(hedge' S hS).1, inv_div] + · change tok v = 1 + simp only [v, map_prod, map_zpow, map_inv] + apply Finset.prod_eq_one + intro S hS + change (res (edge S : R))⁻¹ ^ subsetSign S = 1 + rw [(hedge' S hS).2, inv_one, one_zpow] + +/-- Ordinary local units give an actual local unit representative of the fixed +field product. The representatives are not independently chosen field values. -/ +theorem exists_unit_of_factor_units (f : R →+* K) (t : Finset I) + (x : Finset I → R) (hx : ∀ S ⊆ t, IsUnit (x S)) : + ∃ v : Rˣ, f (v : R) = alternatingProduct t (fun S => f (x S)) := by + classical + let units : Finset I → Rˣ := fun S => if hS : S ⊆ t then (hx S hS).unit else 1 + have hval : ∀ S ⊆ t, (units S : R) = x S := by + intro S hS + simp only [units, dite_eq_left hS, IsUnit.unit_spec] + let toK : Rˣ →* K := f.toMonoidHom.comp (Units.coeHom R) + refine ⟨alternatingProduct t units, ?_⟩ + change toK (alternatingProduct t units) = _ + rw [map_alternatingProduct] + apply alternatingProduct_congr + intro S hS + change f (units S : R) = f (x S) + rw [hval S hS] + +end AlternatingUnits + +section MaximalCover + +variable {I : Type uI} {R : Type uR} {K : Type uK} [DecidableEq I] [CommRing R] [IsDomain R] [Field K] + [Algebra R K] [IsFractionRing R K] + +/-- The away-from-u case uses only the evaluated norm identity and avoidance +of the actual rational prime factors of u. -/ +theorem exists_local_unit_away (m : MaximalSpectrum R) (u : ℕ) (hu : u ≠ 0) + (t : Finset I) (x y : Finset I → R) + (hnorm : ∀ S ⊆ t, x S * y S = (u : R) ^ 2) + (havoid : ∀ p ∈ u.primeFactors, (p : R) ∉ m.asIdeal) : + ∃ v : (AtMaximal R m)ˣ, + toFraction K m (v : AtMaximal R m) = + alternatingProduct t (fun S => algebraMap R K (x S)) := by + obtain ⟨v, hv⟩ := exists_unit_of_factor_units (toFraction K m).toRingHom t + (fun S => algebraMap R (AtMaximal R m) (x S)) + (fun S hS => local_norm_factor_isUnit m u hu havoid (x S) (y S) (hnorm S hS)) + refine ⟨v, ?_⟩ + change toFraction K m (v : AtMaximal R m) = alternatingProduct t + (fun S => toFraction K m (algebraMap R (AtMaximal R m) (x S))) at hv + simpa only [AlgHom.commutes] using hv + +/-- Every maximal ideal is covered either by a genuine prime-direction edge +comparison or by the norm argument. Local character comparison supplies the +edge hypotheses, without assuming that the product belongs to the base ring. -/ +theorem exists_base_of_edges_and_norm (u : ℕ) (hu : u ≠ 0) + (t : Finset I) (prime : I → ℕ) + (hcover : ∀ p ∈ u.primeFactors, ∃ i ∈ t, prime i = p) + (x y : Finset I → R) (hnorm : ∀ S ⊆ t, x S * y S = (u : R) ^ 2) + (hedge : ∀ m : MaximalSpectrum R, ∀ i ∈ t, (prime i : R) ∈ m.asIdeal → + ∀ S ∈ (t.erase i).powerset, ∃ v : (AtMaximal R m)ˣ, + toFraction K m (v : AtMaximal R m) = + algebraMap R K (x (insert i S)) / algebraMap R K (x S) ∧ + IsLocalRing.residue (AtMaximal R m) (v : AtMaximal R m) = 1) : + ∃ b : R, algebraMap R K b = + alternatingProduct t (fun S => algebraMap R K (x S)) := by + classical + apply exists_base_of_localization_images + intro m + by_cases hm : ∃ p ∈ u.primeFactors, (p : R) ∈ m.asIdeal + · obtain ⟨p, hp, hpm⟩ := hm + obtain ⟨i, hi, hpi⟩ := hcover p hp + have him : (prime i : R) ∈ m.asIdeal := by rw [hpi]; exact hpm + obtain ⟨v, hv, _⟩ := exists_unit_of_edges (toFraction K m).toRingHom + (IsLocalRing.residue (AtMaximal R m)) t i hi + (fun S => algebraMap R K (x S)) (hedge m i hi him) + exact ⟨v, hv⟩ + · have havoid : ∀ p ∈ u.primeFactors, (p : R) ∉ m.asIdeal := by + intro p hp hpm + exact hm ⟨p, hp, hpm⟩ + obtain ⟨v, hv⟩ := exists_local_unit_away (K := K) m u hu t x y hnorm havoid + exact ⟨v, hv⟩ + +end MaximalCover + +section ConcreteComparison + +open CyclicRing + +/-- Bezout makes the complementary integer factor a unit in the actual +localization at any prime containing `p`. -/ +theorem coprime_natCast_isUnit {R : Type uR} [CommRing R] + (I : Ideal R) [I.IsPrime] (p c : ℕ) (hpc : Nat.Coprime p c) + (hpI : (p : R) ∈ I) : IsUnit (c : Localization.AtPrime I) := by + have hcI : (c : R) ∉ I := by + intro hc + obtain ⟨a, b, hab⟩ := hpc.cast (R := R) + have hone : (1 : R) ∈ I := by + rw [← hab] + exact I.add_mem (I.mul_mem_left a hpI) (I.mul_mem_left b hc) + exact (inferInstance : I.IsPrime).ne_top (I.eq_top_iff_one.mpr hone) + simpa only [map_natCast] using + (IsLocalization.AtPrime.isUnit_to_map_iff (Localization.AtPrime I) I (c : R)).mpr hcI + +variable {A₀ : Type uAZero} {R : Type uR} [CommRing A₀] [CommRing R] + +/-- Apply the proved DVR comparison after coefficient localization and map its +actual unit through the cyclotomic quotient into the target maximal localization. +The group order and scalar prime exponent are the same `p ^ (e + 1)`. -/ +theorem actual_local_character_association + (f : A₀ →+* R) (m : MaximalSpectrum R) + [IsDomain (AtComap f m)] [CharZero (AtComap f m)] + [IsDiscreteValuationRing (AtComap f m)] + (p : ℕ) [NeZero p] (hp : p.Prime) (hpm : (p : R) ∈ m.asIdeal) + (hmax : IsLocalRing.maximalIdeal (AtComap f m) = + Ideal.span {(p : AtComap f m)}) + (rho : R) (hrho : rho ^ p = 1) + (hroot : (Polynomial.cyclotomic p R).eval rho = 0) + (n e c : ℕ) [NeZero n] (hn : n = p ^ (e + 1)) + (hrhon : rho ^ n = 1) (hc : IsUnit (c : AtComap f m)) + (F K : Elem A₀ n) + (hFK : F * K = scalar n ((p : A₀) ^ (e + 1) * (c : A₀))) : + LocalComparison.ResidueOneAssociated (IsLocalRing.residue (AtMaximal R m)) + (algebraMap R (AtMaximal R m) + (evaluate f (CyclicPolynomial.powerCharacter n rho hrhon) F)) + (algebraMap R (AtMaximal R m) (evaluate f 1 F)) := by + subst n + let A := AtComap f m + let L := AtMaximal R m + let φ : A₀ →+* A := algebraMap A₀ A + let FA := coefficientMap φ (p ^ (e + 1)) F + let KA := coefficientMap φ (p ^ (e + 1)) K + have hFA : FA * KA = scalar (p ^ (e + 1)) + ((p : A) ^ (e + 1) * (hc.unit : A)) := by + dsimp [FA, KA] + rw [← map_mul, hFK, coefficientMap_scalar, map_mul, map_pow, + map_natCast, map_natCast] + obtain ⟨v, hv, hvspan⟩ := + (LocalComparison.local_character_comparison A p hp hmax e hc.unit FA KA hFA).1 + let j : RamifiedLocal.Extension A p 0 →+* L := + comparisonToLocal f m (p ^ (0 + 1)) rho (by simpa only [Nat.zero_add, pow_one] using hroot) + have jroot : j (LocalComparison.orderPRoot A p) = algebraMap R L rho := by + exact comparisonToLocal_root f m _ rho _ + have jcoeff (a : A) : j (algebraMap A (RamifiedLocal.Extension A p 0) a) = + baseToLocal f m a := by + exact comparisonToLocal_of f m _ rho _ a + have evalRoot : + (j.comp (LocalComparison.orderPValue A p e).toRingHom).comp + (coefficientMap φ (p ^ (e + 1))) = + (algebraMap R L).comp + (evaluate f (CyclicPolynomial.powerCharacter (p ^ (e + 1)) rho hrhon)) := by + apply AddMonoidAlgebra.ringHom_ext + · intro r + change j (evaluateAt (p ^ (e + 1)) (LocalComparison.orderPRoot A p) + (LocalComparison.orderPRoot_pow_level A p e) + (coefficientMap φ (p ^ (e + 1)) (AddMonoidAlgebra.single 0 r))) = + algebraMap R L (evaluate f + (CyclicPolynomial.powerCharacter (p ^ (e + 1)) rho hrhon) + (AddMonoidAlgebra.single 0 r)) + simp only [coefficientMap_single, evaluateAt_single, evaluate_single, + CyclicPolynomial.powerCharacter_apply, map_mul, map_pow, jroot, + jcoeff, φ] + exact congrArg (fun z : L => z * (algebraMap R L rho) ^ (0 : ZMod (p ^ (e + 1))).val) + (baseToLocal_algebraMap f m r) + · intro a + change j (evaluateAt (p ^ (e + 1)) (LocalComparison.orderPRoot A p) + (LocalComparison.orderPRoot_pow_level A p e) + (coefficientMap φ (p ^ (e + 1)) (AddMonoidAlgebra.single a 1))) = + algebraMap R L (evaluate f + (CyclicPolynomial.powerCharacter (p ^ (e + 1)) rho hrhon) + (AddMonoidAlgebra.single a 1)) + simp only [coefficientMap_single, evaluateAt_single, evaluate_single, + CyclicPolynomial.powerCharacter_apply, map_mul, map_pow, jroot, + jcoeff, φ] + exact congrArg (fun z : L => z * (algebraMap R L rho) ^ a.val) + (baseToLocal_algebraMap f m (1 : A₀)) + have evalOne : j (algebraMap A (RamifiedLocal.Extension A p 0) + (augmentation (p ^ (e + 1)) FA)) = + algebraMap R L (evaluate f 1 F) := by + rw [jcoeff] + dsimp [FA] + rw [augmentation_coefficientMap, baseToLocal_algebraMap, + evaluate_trivial_eq_augmentation] + have hres : IsLocalRing.residue L + ((Units.map j.toMonoidHom v : Lˣ) : L) = 1 := by + apply residue_unit_eq_one_of_span j (LocalComparison.orderPRoot A p) v + · exact hvspan + · rw [jroot] + exact residue_root_eq_one m p hp hpm rho hrho + refine ⟨Units.map j.toMonoidHom v, ?_, hres⟩ + have heval := DFunLike.congr_fun evalRoot F + change j (LocalComparison.orderPValue A p e FA) = + algebraMap R L (evaluate f + (CyclicPolynomial.powerCharacter (p ^ (e + 1)) rho hrhon) F) at heval + rw [← heval] + change j (LocalComparison.orderPValue A p e FA) = + j (v : RamifiedLocal.Extension A p 0) * algebraMap R L (evaluate f 1 F) + simpa only [map_mul, evalOne, Units.coe_map] using congrArg j hv + +end ConcreteComparison + +section ActualAlternatingProduct + +open CyclotomicRings PrimeComponents PrimeCharacterEvaluations CyclicRing + +/-- Name the canonical algebra structures directly to avoid searching through +iterated-localization algebra instances for the concrete coefficient ring. -/ +instance B_local_algebra (u : ℕ) (m : MaximalSpectrum (B u)) : + Algebra (B u) (AtMaximal (B u) m) := + OreLocalization.instAlgebra (R := B u) (R₀ := B u) (S := m.asIdeal.primeCompl) + +instance B_fraction_algebra (u : ℕ) : Algebra (B u) (FractionRing (B u)) := + OreLocalization.instAlgebra (R := B u) (R₀ := B u) (S := nonZeroDivisors (B u)) + +/-- The selected element of B satisfies the actual cyclotomic relation. -/ +theorem rhoB_cyclotomic_root (u : ℕ) (p : PrimeIndex u) : + (Polynomial.cyclotomic p.val (B u)).eval (rhoB u p) = 0 := by + have hp := prime_of_mem p.property + apply Subtype.val_injective + change (B u).val ((Polynomial.cyclotomic p.val (B u)).eval (rhoB u p)) = + (B u).val (0 : B u) + rw [map_zero] + change (B u).val.toRingHom + ((Polynomial.cyclotomic p.val (B u)).eval (rhoB u p)) = 0 + rw [← Polynomial.cyclotomic.eval_apply] + exact (rho_isPrimitiveRoot p.val hp.ne_zero).isRoot_cyclotomic hp.pos + +theorem subset_evaluations_local_associated (u : ℕ) [NeZero (u ^ 2)] + (hu : 0 < u) (huodd : Odd u) + (x : Elem GaussianRing (u ^ 2)) + (hx : x * ringStar x = scalar (u ^ 2) ((u ^ 2 : ℕ) : GaussianRing)) + (p : PrimeIndex u) (m : MaximalSpectrum (B u)) + (hpm : (p.val : B u) ∈ m.asIdeal) + (S : Finset (PrimeIndex u)) (hpS : p ∉ S) : + LocalComparison.ResidueOneAssociated (IsLocalRing.residue (AtMaximal (B u) m)) + (algebraMap (B u) (AtMaximal (B u) m) (subsetEvaluation u hu (insert p S) x)) + (algebraMap (B u) (AtMaximal (B u) m) (subsetEvaluation u hu S x)) := by + let f := (awayInclusion u p.val).toRingHom + let A := AtComap f m + let : NeZero p.val := ⟨(prime_of_mem p.property).ne_zero⟩ + let : CharZero A := CyclotomicAwayLocal.awayLocal_charZero u p.val m.asIdeal + let : IsDiscreteValuationRing A := + CyclotomicAwayLocal.awayLocal_isDiscreteValuationRing u p.val huodd p.property m.asIdeal hpm + have hmax : IsLocalRing.maximalIdeal A = Ideal.span {(p.val : A)} := + CyclotomicAwayLocal.awayLocal_maximalIdeal_eq_span u p.val huodd p.property m.asIdeal hpm + let e := exponent u p.val - 1 + have he : exponent u p.val = e + 1 := by + dsimp [e] + have hpos := exponent_pos hu p.property + omega + have hn : order u p.val = p.val ^ (e + 1) := by rw [order, he] + have hc : IsUnit (cofactor u p.val : A) := + coprime_natCast_isUnit (m.asIdeal.comap f) p.val (cofactor u p.val) + (cofactor_coprime hu p.property) + (CyclotomicAwayLocal.prime_mem_awayPrime u p.val m.asIdeal hpm) + let F := partialEvaluation u hu p S x + let K := partialEvaluation u hu p S (ringStar x) + have hnum : u ^ 2 = p.val ^ (e + 1) * cofactor u p.val := by + rw [← hn] + exact (order_mul_cofactor u p.val).symm + have hFK : F * K = scalar (order u p.val) + ((p.val : awayRing u p.val) ^ (e + 1) * (cofactor u p.val : awayRing u p.val)) := by + dsimp [F, K] + rw [partialEvaluation_product u hu p S x (ringStar x) hx] + apply congrArg (scalar (order u p.val)) + exact_mod_cast hnum + have h := actual_local_character_association f m p.val (prime_of_mem p.property) + hpm hmax (rhoB u p) (rhoB_pow u p) (rhoB_cyclotomic_root u p) + (order u p.val) e (cofactor u p.val) hn + (root_order_pow u hu p (rhoB u p) (rhoB_pow u p)) hc F K hFK + change LocalComparison.ResidueOneAssociated _ + (algebraMap (B u) (AtMaximal (B u) m) (partialAtRoot u hu p F)) + (algebraMap (B u) (AtMaximal (B u) m) (partialAtOne u p F)) at h + simpa only [F, partialEvaluation_at_root_apply, + partialEvaluation_at_one_apply u hu p S hpS x] using h + +/-- The denominator is nonzero because it is an actual evaluated norm factor. -/ +theorem exists_local_edge_unit (u : ℕ) [NeZero (u ^ 2)] + (hu : 0 < u) (huodd : Odd u) + (x : Elem GaussianRing (u ^ 2)) + (hx : x * ringStar x = scalar (u ^ 2) ((u ^ 2 : ℕ) : GaussianRing)) + (p : PrimeIndex u) (m : MaximalSpectrum (B u)) + (hpm : (p.val : B u) ∈ m.asIdeal) + (S : Finset (PrimeIndex u)) (hpS : p ∉ S) : + ∃ v : (AtMaximal (B u) m)ˣ, + toFraction (FractionRing (B u)) m (v : AtMaximal (B u) m) = + algebraMap (B u) (FractionRing (B u)) (subsetEvaluation u hu (insert p S) x) / + algebraMap (B u) (FractionRing (B u)) (subsetEvaluation u hu S x) ∧ + IsLocalRing.residue (AtMaximal (B u) m) (v : AtMaximal (B u) m) = 1 := by + apply local_edge_of_associated m _ _ + · intro hz + apply subsetEvaluation_ne_zero u hu S x hx + apply IsFractionRing.injective (B u) (FractionRing (B u)) + simpa only [map_zero] using hz + · exact subset_evaluations_local_associated u hu huodd x hx p m hpm S hpS + +/-- At every maximal ideal over p, the one fixed global alternating product +is the image of a unit with residue one. No edge comparison is an input. -/ +theorem exists_local_unit_alternatingProduct (u : ℕ) [NeZero (u ^ 2)] + (hu : 0 < u) (huodd : Odd u) + (x : Elem GaussianRing (u ^ 2)) + (hx : x * ringStar x = scalar (u ^ 2) ((u ^ 2 : ℕ) : GaussianRing)) + (p : PrimeIndex u) (m : MaximalSpectrum (B u)) + (hpm : (p.val : B u) ∈ m.asIdeal) : + ∃ v : (AtMaximal (B u) m)ˣ, + toFraction (FractionRing (B u)) m (v : AtMaximal (B u) m) = + alternatingProduct (Finset.univ : Finset (PrimeIndex u)) + (fun S => algebraMap (B u) (FractionRing (B u)) (subsetEvaluation u hu S x)) ∧ + IsLocalRing.residue (AtMaximal (B u) m) (v : AtMaximal (B u) m) = 1 := by + classical + apply exists_unit_of_edges (toFraction (FractionRing (B u)) m).toRingHom + (IsLocalRing.residue (AtMaximal (B u) m)) Finset.univ p (Finset.mem_univ p) + intro S hS + have hpS : p ∉ S := fun hp => + (Finset.mem_erase.mp ((Finset.mem_powerset.mp hS) hp)).1 rfl + exact exists_local_edge_unit u hu huodd x hx p m hpm S hpS + +/-- Integrality of the actual subset-character alternating product. The +maximal ideals over prime divisors use the proved local comparison; every +other maximal ideal uses the actual norm identity. -/ +theorem exists_integral_alternatingProduct (u : ℕ) [NeZero (u ^ 2)] + (hu : 0 < u) (huodd : Odd u) + (x : Elem GaussianRing (u ^ 2)) + (hx : x * ringStar x = scalar (u ^ 2) ((u ^ 2 : ℕ) : GaussianRing)) : + ∃ z : B u, algebraMap (B u) (FractionRing (B u)) z = + alternatingProduct (Finset.univ : Finset (PrimeIndex u)) + (fun S => algebraMap (B u) (FractionRing (B u)) (subsetEvaluation u hu S x)) := by + classical + refine exists_base_of_edges_and_norm u hu.ne' Finset.univ + (fun p : PrimeIndex u => p.val) ?_ + (fun S => subsetEvaluation u hu S x) (fun S => star (subsetEvaluation u hu S x)) ?_ ?_ + · intro p hp + exact ⟨⟨p, hp⟩, Finset.mem_univ _, rfl⟩ + · intro S _ + simpa only [Nat.cast_pow] using subsetEvaluation_norm u hu S x hx + · intro m p _ hpm S hS + have hpS : p ∉ S := fun hp => + (Finset.mem_erase.mp ((Finset.mem_powerset.mp hS) hp)).1 rfl + exact exists_local_edge_unit u hu huodd x hx p m hpm S hpS + +end ActualAlternatingProduct + +end CirculantHadamard.AlternatingLocalization + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/CirculantHadamard/AlternatingNorm.lean b/lean/OAI/LinearAlgebra/CirculantHadamard/AlternatingNorm.lean new file mode 100644 index 0000000000000000000000000000000000000000..c518334e39743a4c89e1372eb89dff96fa72bf81 --- /dev/null +++ b/lean/OAI/LinearAlgebra/CirculantHadamard/AlternatingNorm.lean @@ -0,0 +1,56 @@ +import Mathlib.Analysis.Complex.Basic +import Mathlib.Tactic.Linarith + +namespace OAI + +universe uR uIota + +/-! +# Complex norms after clearing an alternating-product denominator + +The integral alternating product is related to its character values by a +polynomial identity in the coefficient ring. Applying an arbitrary complex +ring homomorphism to that identity is legitimate even before knowing that the +homomorphism extends to the fraction field. Equal numbers of numerator and +denominator factors, all of the same positive norm, then force norm one. +-/ + +namespace CirculantHadamard.AlternatingNorm + +open scoped BigOperators + +theorem norm_map_prod_of_const {R : Type uR} {ι : Type uIota} [CommRing R] + (σ : R →+* ℂ) (x : ι → R) (s : Finset ι) (c : ℝ) + (hx : ∀ i ∈ s, ‖σ (x i)‖ = c) : + ‖σ (∏ i ∈ s, x i)‖ = c ^ s.card := by + classical + rw [map_prod, norm_prod] + calc + (∏ i ∈ s, ‖σ (x i)‖) = ∏ _i ∈ s, c := Finset.prod_congr rfl hx + _ = c ^ s.card := by simp + +/-- The numerator and denominator have equally many character factors. +Only a genuine cleared identity in `R` is required; there is no assumed norm +bound on `z`, no injectivity assumption on `σ`, and no fraction-field extension. +-/ +theorem norm_eq_one_of_balanced_products {R : Type uR} {ι : Type uIota} [CommRing R] + (σ : R →+* ℂ) (x : ι → R) (numerator denominator : Finset ι) + (z : R) (c : ℝ) (hc : 0 < c) + (hcard : numerator.card = denominator.card) + (hnumerator : ∀ i ∈ numerator, ‖σ (x i)‖ = c) + (hdenominator : ∀ i ∈ denominator, ‖σ (x i)‖ = c) + (hclear : z * (∏ i ∈ denominator, x i) = ∏ i ∈ numerator, x i) : + ‖σ z‖ = 1 := by + have hmap := congrArg σ hclear + rw [map_mul] at hmap + have hnorm := congrArg norm hmap + rw [norm_mul, + norm_map_prod_of_const σ x denominator c hdenominator, + norm_map_prod_of_const σ x numerator c hnumerator, + hcard] at hnorm + have hpositive : 0 < c ^ denominator.card := pow_pos hc _ + nlinarith + +end CirculantHadamard.AlternatingNorm + +end OAI diff --git a/lean/OAI/LinearAlgebra/CirculantHadamard/AlternatingProducts.lean b/lean/OAI/LinearAlgebra/CirculantHadamard/AlternatingProducts.lean new file mode 100644 index 0000000000000000000000000000000000000000..b24938b1ea40ef2ef3c91dd220b1c05236f8fa01 --- /dev/null +++ b/lean/OAI/LinearAlgebra/CirculantHadamard/AlternatingProducts.lean @@ -0,0 +1,253 @@ +import Mathlib.Algebra.BigOperators.Group.Finset.Powerset +import Mathlib.Algebra.Group.Hom.Defs +import Mathlib.Algebra.Ring.Parity +import Mathlib.Algebra.Ring.Int.Defs +import Mathlib.Data.Fintype.Basic + +namespace OAI + +universe uI uG uH + +/-! +# Alternating products over literal finite subsets + +The exponent is `(-1)^card S`. Pairing subsets along `p` follows from the +powerset decomposition, with the quotient orientation `x S / x (insert p S)`. + +The definition and pairing are valid in a division commutative monoid, so they +apply both to actual field values and to units. Cancellation of a constant +family is stated in a commutative group. No local comparison, nonvanishing, +integrality, or torsion statement is assumed or inferred. +-/ + +namespace CirculantHadamard + +open scoped BigOperators + +variable {I : Type uI} + +def subsetSign (S : Finset I) : ℤ := (-1) ^ S.card + +@[simp] theorem subsetSign_empty : subsetSign (∅ : Finset I) = 1 := by + simp [subsetSign] + +theorem subsetSign_of_even (S : Finset I) (h : Even S.card) : subsetSign S = 1 := by + simpa only [subsetSign] using (h.neg_one_pow : (-1 : ℤ) ^ S.card = 1) + +theorem subsetSign_of_odd (S : Finset I) (h : Odd S.card) : subsetSign S = -1 := by + simpa only [subsetSign] using (h.neg_one_pow : (-1 : ℤ) ^ S.card = -1) + +theorem subsetSign_insert [DecidableEq I] (p : I) (S : Finset I) (hp : p ∉ S) : + subsetSign (insert p S) = -subsetSign S := by + simp only [subsetSign, Finset.card_insert_of_notMem hp, pow_succ, mul_neg_one] + +/-- The signed subset count vanishes by pairing along an actual element of `t`. -/ +theorem sum_subsetSign_eq_zero (t : Finset I) (ht : t.Nonempty) : + ∑ S ∈ t.powerset, subsetSign S = 0 := by + classical + obtain ⟨p, hp⟩ := ht + have hpaired : + (∑ S ∈ (t.erase p).powerset, subsetSign (insert p S)) = + -(∑ S ∈ (t.erase p).powerset, subsetSign S) := by + rw [← Finset.sum_neg_distrib] + apply Finset.sum_congr rfl + intro S hS + exact subsetSign_insert p S + (fun h => (Finset.notMem_erase p t) ((Finset.mem_powerset.mp hS) h)) + calc + _ = ∑ S ∈ (insert p (t.erase p)).powerset, subsetSign S := by + rw [Finset.insert_erase hp] + _ = (∑ S ∈ (t.erase p).powerset, subsetSign S) + + ∑ S ∈ (t.erase p).powerset, subsetSign (insert p S) := + Finset.sum_powerset_insert (Finset.notMem_erase p t) subsetSign + _ = 0 := by rw [hpaired, add_neg_cancel] + +/-- The even-cardinality and odd-cardinality subset filters have equal size. -/ +theorem card_even_subsets_eq_card_odd_subsets (t : Finset I) (ht : t.Nonempty) : + (t.powerset.filter (fun S => Even S.card)).card = + (t.powerset.filter (fun S => Odd S.card)).card := by + classical + have heven : (∑ S ∈ t.powerset.filter (fun S => Even S.card), subsetSign S) = + ((t.powerset.filter (fun S => Even S.card)).card : ℤ) := by + calc + _ = ∑ _S ∈ t.powerset.filter (fun S => Even S.card), (1 : ℤ) := by + apply Finset.sum_congr rfl + intro S hS + exact subsetSign_of_even S (Finset.mem_filter.mp hS).2 + _ = _ := by simp + have hodd : (∑ S ∈ t.powerset.filter (fun S => ¬ Even S.card), subsetSign S) = + -((t.powerset.filter (fun S => Odd S.card)).card : ℤ) := by + have hfilter : t.powerset.filter (fun S => ¬ Even S.card) = + t.powerset.filter (fun S => Odd S.card) := by + ext S + simp only [Finset.mem_filter, Nat.not_even_iff_odd] + rw [hfilter] + calc + _ = ∑ _S ∈ t.powerset.filter (fun S => Odd S.card), (-1 : ℤ) := by + apply Finset.sum_congr rfl + intro S hS + exact subsetSign_of_odd S (Finset.mem_filter.mp hS).2 + _ = _ := by simp + have hsum := Finset.sum_filter_add_sum_filter_not t.powerset + (fun S : Finset I => Even S.card) subsetSign + rw [heven, hodd, sum_subsetSign_eq_zero t ht] at hsum + exact Int.natCast_inj.mp (sub_eq_zero.mp (by simpa only [sub_eq_add_neg] using hsum)) + +/-- Numerator before introducing any inverse, available in a coefficient ring. -/ +def evenSubsetProduct {G : Type uG} [CommMonoid G] (t : Finset I) + (x : Finset I → G) : G := + ∏ S ∈ t.powerset.filter (fun S => Even S.card), x S + +/-- Denominator before introducing any inverse, available in a coefficient ring. -/ +def oddSubsetProduct {G : Type uG} [CommMonoid G] (t : Finset I) + (x : Finset I → G) : G := + ∏ S ∈ t.powerset.filter (fun S => Odd S.card), x S + +theorem map_evenSubsetProduct {G : Type uG} {H : Type uH} [CommMonoid G] [CommMonoid H] + (f : G →* H) (t : Finset I) (x : Finset I → G) : + f (evenSubsetProduct t x) = evenSubsetProduct t (fun S => f (x S)) := by + simp only [evenSubsetProduct, map_prod] + +theorem map_oddSubsetProduct {G : Type uG} {H : Type uH} [CommMonoid G] [CommMonoid H] + (f : G →* H) (t : Finset I) (x : Finset I → G) : + f (oddSubsetProduct t x) = oddSubsetProduct t (fun S => f (x S)) := by + simp only [oddSubsetProduct, map_prod] + +section DivisionCommMonoid + +variable {G : Type uG} [DivisionCommMonoid G] + +/-- The alternating product of the actual family indexed by subsets of `t`. -/ +def alternatingProduct (t : Finset I) (x : Finset I → G) : G := + ∏ S ∈ t.powerset, (x S) ^ subsetSign S + +@[simp] theorem alternatingProduct_empty (x : Finset I → G) : + alternatingProduct ∅ x = x ∅ := by + simp [alternatingProduct] + +@[simp] theorem alternatingProduct_one (t : Finset I) : + alternatingProduct t (fun _ => (1 : G)) = 1 := by + simp [alternatingProduct] + +theorem alternatingProduct_congr (t : Finset I) (x y : Finset I → G) + (h : ∀ S ⊆ t, x S = y S) : + alternatingProduct t x = alternatingProduct t y := by + apply Finset.prod_congr rfl + intro S hS + rw [h S (Finset.mem_powerset.mp hS)] + +theorem alternatingProduct_mul (t : Finset I) (x y : Finset I → G) : + alternatingProduct t (fun S => x S * y S) = + alternatingProduct t x * alternatingProduct t y := by + simp only [alternatingProduct, mul_zpow, Finset.prod_mul_distrib] + +theorem alternatingProduct_inv (t : Finset I) (x : Finset I → G) : + alternatingProduct t (fun S => (x S)⁻¹) = (alternatingProduct t x)⁻¹ := by + simp only [alternatingProduct, inv_zpow, Finset.prod_inv_distrib] + +theorem alternatingProduct_div (t : Finset I) (x y : Finset I → G) : + alternatingProduct t (fun S => x S / y S) = + alternatingProduct t x / alternatingProduct t y := by + simp only [alternatingProduct, div_zpow, Finset.prod_div_distrib] + +/-- A single direction pairs each omitted-`p` subset with its insertion. +The exponent at the inserted subset is the negative of the original one. -/ +theorem alternatingProduct_insert [DecidableEq I] (t : Finset I) + (x : Finset I → G) (p : I) (hp : p ∉ t) : + alternatingProduct (insert p t) x = + ∏ S ∈ t.powerset, (x S / x (insert p S)) ^ subsetSign S := by + unfold alternatingProduct + rw [Finset.prod_powerset_insert hp, ← Finset.prod_mul_distrib] + apply Finset.prod_congr rfl + intro S hS + have hpS : p ∉ S := fun h => hp ((Finset.mem_powerset.mp hS) h) + rw [subsetSign_insert p S hpS, zpow_neg, div_zpow, div_eq_mul_inv] + +theorem alternatingProduct_pair [DecidableEq I] (t : Finset I) + (x : Finset I → G) (p : I) (hp : p ∈ t) : + alternatingProduct t x = + ∏ S ∈ (t.erase p).powerset, (x S / x (insert p S)) ^ subsetSign S := by + calc + alternatingProduct t x = alternatingProduct (insert p (t.erase p)) x := by + rw [Finset.insert_erase hp] + _ = _ := alternatingProduct_insert (t.erase p) x p (Finset.notMem_erase p t) + +/-- Even subsets contribute the value itself; odd subsets contribute its inverse. -/ +theorem alternatingProduct_eq_parity (t : Finset I) (x : Finset I → G) : + alternatingProduct t x = + ∏ S ∈ t.powerset, if Even S.card then x S else (x S)⁻¹ := by + classical + apply Finset.prod_congr rfl + intro S _ + by_cases h : Even S.card + · simp only [subsetSign_of_even S h, zpow_one, ite_eq_left h] + · have ho : Odd S.card := Nat.not_even_iff_odd.mp h + simp only [subsetSign_of_odd S ho, zpow_neg_one, ite_eq_right h] + +/-- Collect the signed powers as a quotient of two ordinary products. +Both products themselves make sense before passing to a fraction field. -/ +theorem alternatingProduct_eq_even_div_odd (t : Finset I) (x : Finset I → G) : + alternatingProduct t x = evenSubsetProduct t x / oddSubsetProduct t x := by + classical + rw [alternatingProduct_eq_parity, evenSubsetProduct, oddSubsetProduct, + Finset.prod_filter, Finset.prod_filter, div_eq_mul_inv, + ← Finset.prod_inv_distrib, ← Finset.prod_mul_distrib] + apply Finset.prod_congr rfl + intro S _ + by_cases h : Even S.card + · simp [h, Nat.not_odd_iff_even.mpr h] + · simp [h, Nat.not_even_iff_odd.mp h] + +end DivisionCommMonoid + +section CommGroup + +variable {G : Type uG} {H : Type uH} [CommGroup G] [DivisionCommMonoid H] + +/-- In particular this applies to the homomorphism from local units to the +fraction field, retaining the single fixed alternating product. -/ +theorem map_alternatingProduct (f : G →* H) (t : Finset I) (x : Finset I → G) : + f (alternatingProduct t x) = alternatingProduct t (fun S => f (x S)) := by + simp only [alternatingProduct, map_prod, map_zpow] + +/-- A nonempty index set cancels every constant family, by actual subset pairing. -/ +theorem alternatingProduct_const (t : Finset I) (ht : t.Nonempty) (c : G) : + alternatingProduct t (fun _ => c) = 1 := by + classical + obtain ⟨p, hp⟩ := ht + rw [alternatingProduct_pair t (fun _ => c) p hp] + simp + +/-- Clearing the odd-subset denominator inside the group of units. +Mapping this equality into the fraction field gives the polynomial identity +needed before applying a homomorphism defined only on the coefficient ring. -/ +theorem alternatingProduct_mul_oddSubsetProduct (t : Finset I) (x : Finset I → G) : + alternatingProduct t x * oddSubsetProduct t x = evenSubsetProduct t x := by + rw [alternatingProduct_eq_even_div_odd, div_mul_cancel] + +end CommGroup + +section FiniteUniverse + +variable [Fintype I] {G : Type uG} [DivisionCommMonoid G] + +/-- The full prime-index product, using all subsets of the finite index type. -/ +def fullAlternatingProduct (x : Finset I → G) : G := + alternatingProduct Finset.univ x + +theorem fullAlternatingProduct_pair [DecidableEq I] (x : Finset I → G) (p : I) : + fullAlternatingProduct x = + ∏ S ∈ ((Finset.univ : Finset I).erase p).powerset, + (x S / x (insert p S)) ^ subsetSign S := + alternatingProduct_pair Finset.univ x p (Finset.mem_univ p) + +end FiniteUniverse + +theorem fullAlternatingProduct_const [Fintype I] [Nonempty I] + {G : Type uG} [CommGroup G] (c : G) : + fullAlternatingProduct (fun _ : Finset I => c) = 1 := + alternatingProduct_const Finset.univ Finset.univ_nonempty c + +end CirculantHadamard + +end OAI diff --git a/lean/OAI/LinearAlgebra/CirculantHadamard/AlternatingTorsion.lean b/lean/OAI/LinearAlgebra/CirculantHadamard/AlternatingTorsion.lean new file mode 100644 index 0000000000000000000000000000000000000000..25a0bf595a778cf908ec2c6d0739d878050f0167 --- /dev/null +++ b/lean/OAI/LinearAlgebra/CirculantHadamard/AlternatingTorsion.lean @@ -0,0 +1,133 @@ +import OAI.LinearAlgebra.CirculantHadamard.AlternatingField +import OAI.LinearAlgebra.CirculantHadamard.AlternatingLocalization +import OAI.LinearAlgebra.CirculantHadamard.CyclotomicTorsion +import OAI.LinearAlgebra.CirculantHadamard.PrimeCharacterEvaluations +import OAI.LinearAlgebra.CirculantHadamard.ResidueTorsion + +namespace OAI + +/-! +# The actual alternating character product has odd torsion + +The index is the full set of prime divisors of u. The local comparison and +all-maximal-ideal argument are applied to the actual partial evaluations of +the given constant-norm group-ring element. No edge-comparison, integrality, +complex-norm, or torsion conclusion is assumed. +-/ + +noncomputable section + +namespace CirculantHadamard + +open CyclotomicRings PrimeComponents PrimeCharacterEvaluations +open AlternatingLocalization + +/-- The single fixed field element used for every prime-direction comparison. -/ +abbrev alternatingValue (u : ℕ) (hu : 0 < u) + (x : CyclicRing.Elem GaussianRing (u ^ 2)) : FractionRing (B u) := + alternatingProduct (Finset.univ : Finset (PrimeIndex u)) + (fun S => algebraMap (B u) (FractionRing (B u)) (subsetEvaluation u hu S x)) + +/-- Denominator removal and all complex homomorphisms are discharged for the +actual character values before invoking Kronecker's criterion. -/ +theorem exists_integral_alternating_root_of_unity (u : ℕ) [NeZero (u ^ 2)] + (hu : 1 < u) (huodd : Odd u) (x : CyclicRing.Elem GaussianRing (u ^ 2)) + (hx : x * CyclicRing.ringStar x = + CyclicRing.scalar (u ^ 2) ((u ^ 2 : ℕ) : GaussianRing)) : + ∃ z : B u, + algebraMap (B u) (FractionRing (B u)) z = + alternatingValue u (lt_trans Nat.zero_lt_one hu) x ∧ + ∃ n : ℕ, 0 < n ∧ z ^ n = 1 := by + classical + let hu0 : 0 < u := lt_trans Nat.zero_lt_one hu + obtain ⟨z, hz⟩ := exists_integral_alternatingProduct u hu0 huodd x hx + refine ⟨z, hz, B_root_of_unity u z ?_⟩ + intro σ + have ht : (Finset.univ : Finset (PrimeIndex u)).Nonempty := by + obtain ⟨p, hp⟩ := primes_nonempty hu + exact ⟨⟨p, hp⟩, Finset.mem_univ _⟩ + have hne : ∀ S ⊆ (Finset.univ : Finset (PrimeIndex u)), + algebraMap (B u) (FractionRing (B u)) (subsetEvaluation u hu0 S x) ≠ 0 := by + intro S _ hS + apply subsetEvaluation_ne_zero u hu0 S x hx + apply IsFractionRing.injective (B u) (FractionRing (B u)) + simpa only [map_zero] using hS + exact norm_hom_integral_alternatingProduct + (algebraMap (B u) (FractionRing (B u))) + (IsFractionRing.injective (B u) (FractionRing (B u))) + Finset.univ ht (fun S => subsetEvaluation u hu0 S x) z hne hz σ (u : ℝ) + (by exact_mod_cast hu0) (fun S _ => subsetEvaluation_map_norm u hu0 S x hx σ) + +/-- The same alternating product is killed by a power of every actual prime +dividing u. The maximal ideal and characteristic-p residue field are built +from the concrete integral coefficient ring. -/ +theorem alternatingProduct_prime_power_torsion (u : ℕ) [NeZero (u ^ 2)] + (hu : 1 < u) (huodd : Odd u) (x : CyclicRing.Elem GaussianRing (u ^ 2)) + (hx : x * CyclicRing.ringStar x = + CyclicRing.scalar (u ^ 2) ((u ^ 2 : ℕ) : GaussianRing)) + (p : PrimeIndex u) : + ∃ a : ℕ, (alternatingValue u (lt_trans Nat.zero_lt_one hu) x) ^ (p.val ^ a) = 1 := by + classical + let hu0 : 0 < u := lt_trans Nat.zero_lt_one hu + obtain ⟨z, hz, hfinite⟩ := exists_integral_alternating_root_of_unity u hu huodd x hx + have hp : p.val.Prime := prime_of_mem p.property + obtain ⟨m, hm, _, hpm⟩ := exists_maximal_ideal_over_nat_prime_of_charZero (B u) hp + let M : MaximalSpectrum (B u) := ⟨m, hm⟩ + let : Algebra (B u) (AtMaximal (B u) M) := B_local_algebra u M + obtain ⟨v, hv, hvres⟩ := + exists_local_unit_alternatingProduct u hu0 huodd x hx p M hpm + have hlocal : algebraMap (B u) (AtMaximal (B u) M) z = + (v : AtMaximal (B u) M) := + local_representative_eq (FractionRing (B u)) M z v (hz.trans hv.symm) + let : CharP (IsLocalRing.ResidueField (AtMaximal (B u) M)) p.val := + residue_charP M p.val hp hpm + let f : B u →+* IsLocalRing.ResidueField (AtMaximal (B u) M) := + (IsLocalRing.residue (AtMaximal (B u) M)).comp + (algebraMap (B u) (AtMaximal (B u) M)) + have hres : f z = 1 := by + change IsLocalRing.residue (AtMaximal (B u) M) + (algebraMap (B u) (AtMaximal (B u) M) z) = 1 + rw [hlocal] + exact hvres + obtain ⟨a, ha⟩ := exists_prime_power_of_residue_one f z hp hres hfinite + refine ⟨a, ?_⟩ + have h := congrArg (algebraMap (B u) (FractionRing (B u))) ha + simpa only [map_pow, map_one, hz] using h + +/-- The actual subset-character product has a positive odd torsion exponent. -/ +theorem alternatingProduct_odd_torsion (u : ℕ) [NeZero (u ^ 2)] + (hu : 1 < u) (huodd : Odd u) (x : CyclicRing.Elem GaussianRing (u ^ 2)) + (hx : x * CyclicRing.ringStar x = + CyclicRing.scalar (u ^ 2) ((u : GaussianRing) ^ 2)) : + ∃ m : ℕ, 0 < m ∧ Odd m ∧ + (alternatingValue u (lt_trans Nat.zero_lt_one hu) x) ^ m = 1 := by + classical + have hx' : x * CyclicRing.ringStar x = + CyclicRing.scalar (u ^ 2) ((u ^ 2 : ℕ) : GaussianRing) := by + simpa only [Nat.cast_pow] using hx + obtain ⟨p, hp⟩ := primes_nonempty hu + obtain ⟨a, ha⟩ := alternatingProduct_prime_power_torsion u hu huodd x hx' ⟨p, hp⟩ + exact ⟨p ^ a, pow_pos (prime_of_mem hp).pos _, (odd_of_mem huodd hp).pow, ha⟩ + +/-- With two distinct prime directions the single fixed product is one. -/ +theorem alternatingProduct_eq_one_of_two_primes (u : ℕ) [NeZero (u ^ 2)] + (hu : 1 < u) (huodd : Odd u) (x : CyclicRing.Elem GaussianRing (u ^ 2)) + (hx : x * CyclicRing.ringStar x = + CyclicRing.scalar (u ^ 2) ((u ^ 2 : ℕ) : GaussianRing)) + (p q : PrimeIndex u) (hpq : p ≠ q) : + alternatingValue u (lt_trans Nat.zero_lt_one hu) x = 1 := by + obtain ⟨a, ha⟩ := alternatingProduct_prime_power_torsion u hu huodd x hx p + obtain ⟨b, hb⟩ := alternatingProduct_prime_power_torsion u hu huodd x hx q + have hcop : Nat.Coprime (p.val ^ a) (q.val ^ b) := + Nat.coprime_pow_primes a b (prime_of_mem p.property) (prime_of_mem q.property) + (fun h => hpq (Subtype.ext h)) + have hd := Nat.dvd_gcd (orderOf_dvd_of_pow_eq_one ha) (orderOf_dvd_of_pow_eq_one hb) + have hd1 : orderOf (alternatingValue u (lt_trans Nat.zero_lt_one hu) x) ∣ 1 := by + simpa only [hcop.gcd_eq_one] using hd + exact orderOf_eq_one_iff.mp (Nat.dvd_one.mp hd1) + +end CirculantHadamard + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/CirculantHadamard/Basic.lean b/lean/OAI/LinearAlgebra/CirculantHadamard/Basic.lean new file mode 100644 index 0000000000000000000000000000000000000000..d1ebb2ad475b4a212848389ff9ffbb17298897f0 --- /dev/null +++ b/lean/OAI/LinearAlgebra/CirculantHadamard/Basic.lean @@ -0,0 +1,24 @@ +import OAI.LinearAlgebra.CirculantHadamard.Model + +namespace OAI + +universe uR + +namespace CirculantHadamard + +def rowCirculant {n : ℕ} {R : Type uR} (h : Fin n → R) : + Matrix (Fin n) (Fin n) R := fun i j => h (j - i) + +@[simp] theorem rowCirculant_apply {n : ℕ} {R : Type uR} + (h : Fin n → R) (i j : Fin n) : rowCirculant h i j = h (j - i) := rfl + +theorem rowCirculant_isCirculant {n : ℕ} (h : Fin n → ℝ) : + IsCirculant (rowCirculant h) := ⟨h, fun _ _ => rfl⟩ + +@[simp] theorem rowCirculant_zero_row {n : ℕ} [NeZero n] + {R : Type uR} (h : Fin n → R) (j : Fin n) : rowCirculant h 0 j = h j := by + simp [rowCirculant] + +end CirculantHadamard + +end OAI diff --git a/lean/OAI/LinearAlgebra/CirculantHadamard/BinaryBlocks.lean b/lean/OAI/LinearAlgebra/CirculantHadamard/BinaryBlocks.lean new file mode 100644 index 0000000000000000000000000000000000000000..df7bb7ff9e8a24e3c1bf321656cd3b123e49b84f --- /dev/null +++ b/lean/OAI/LinearAlgebra/CirculantHadamard/BinaryBlocks.lean @@ -0,0 +1,282 @@ +import OAI.LinearAlgebra.CirculantHadamard.Basic +import OAI.LinearAlgebra.CirculantHadamard.CyclicRing +import OAI.LinearAlgebra.CirculantHadamard.CyclicPolynomial +import Mathlib.Data.Nat.Prime.Basic +import Mathlib.Basic.Complex.Basic +import Mathlib.Tactic.FinCases +import Mathlib.Tactic.NormNum +import Mathlib.Tactic.Ring + +namespace OAI + +universe uR uS + +/-! +# The actual four-block decomposition and partial evaluations + +The Chinese remainder equivalence transports the actual cyclic group ring, +not just a coefficient count. Coefficients of its four slices are the original +signs. Partial evaluation is a ring homomorphism defined on the product group +algebra and intertwines coefficient conjugation with index reversal. +-/ + +noncomputable section + +namespace CirculantHadamard.BinaryBlocks + +open CyclicRing +open scoped BigOperators + +abbrev ProductElem (R : Type uR) [Semiring R] (m : ℕ) := + AddMonoidAlgebra R (ZMod 4 × ZMod m) + +theorem four_coprime_sq {u : ℕ} (hu : Odd u) : Nat.Coprime 4 (u ^ 2) := by + simpa using (hu.coprime_two_left.pow_left 2).pow_right 2 + +/-- The concrete CRT map on the exponent group. -/ +def crtIndex (u : ℕ) (hu : Odd u) : + ZMod (4 * u ^ 2) ≃+ ZMod 4 × ZMod (u ^ 2) := + (ZMod.chineseRemainder (four_coprime_sq hu)).toAddEquiv + +/-- The resulting algebra equivalence preserves the actual convolution. -/ +def crt (R : Type uR) [CommRing R] (u : ℕ) (hu : Odd u) : + Elem R (4 * u ^ 2) ≃ₐ[R] ProductElem R (u ^ 2) := + AddMonoidAlgebra.domCongr R R (crtIndex u hu) + +@[simp] theorem crt_apply {R : Type uR} [CommRing R] {u : ℕ} (hu : Odd u) + (f : Elem R (4 * u ^ 2)) (a : ZMod 4 × ZMod (u ^ 2)) : + (crt R u hu f).coeff a = f.coeff ((crtIndex u hu).symm a) := by + exact AddMonoidAlgebra.coeff_domCongr (R := R) (A := R) (crtIndex u hu) f a + +theorem crt_ringStar {R : Type uR} [CommRing R] [StarRing R] + {u : ℕ} [NeZero u] (hu : Odd u) (f : Elem R (4 * u ^ 2)) : + crt R u hu (ringStar f) = groupStar (crt R u hu f) := by + ext a + simp only [crt_apply, ringStar_apply, groupStar_apply, map_neg] + +theorem crt_norm {R : Type uR} [CommRing R] [StarRing R] + {u : ℕ} [NeZero u] (hu : Odd u) (f : Elem R (4 * u ^ 2)) (N : ℕ) + (hnorm : f * ringStar f = (N : Elem R (4 * u ^ 2))) : + crt R u hu f * groupStar (crt R u hu f) = (N : ProductElem R (u ^ 2)) := by + rw [← crt_ringStar hu, ← map_mul, hnorm, map_natCast] + +def block {R : Type uR} [Semiring R] {m : ℕ} [NeZero m] + (f : ProductElem R m) (j : ZMod 4) : Elem R m := + ofCoeffs fun b => f.coeff (j, b) + +@[simp] theorem block_apply {R : Type uR} [Semiring R] {m : ℕ} [NeZero m] + (f : ProductElem R m) (j : ZMod 4) (b : ZMod m) : (block f j).coeff b = f.coeff (j, b) := rfl + +/-- Fin-four indexing agrees with the coefficient arithmetic used by the halves. -/ +def blocks {R : Type uR} [Semiring R] {m : ℕ} [NeZero m] + (f : ProductElem R m) : Fin 4 → Elem R m := fun j => block f j + +@[simp] theorem blocks_apply {R : Type uR} [Semiring R] {m : ℕ} [NeZero m] + (f : ProductElem R m) (j : Fin 4) (b : ZMod m) : (blocks f j).coeff b = f.coeff (j, b) := rfl + +theorem blocks_signs {m : ℕ} [NeZero m] (f : ProductElem ℤ m) + (hf : ∀ a, IsSign (f.coeff a)) : ∀ j b, IsSign ((blocks f j).coeff b) := + fun j b => hf (j, b) + +theorem crt_blocks_signs {u : ℕ} [NeZero u] (hu : Odd u) + (f : Elem ℤ (4 * u ^ 2)) (hf : ∀ a, IsSign (f.coeff a)) : + ∀ j b, IsSign ((blocks (crt ℤ u hu f) j).coeff b) := by + intro j b + rw [blocks_apply, crt_apply] + exact hf ((crtIndex u hu).symm (j, b)) + +section Evaluation + +variable {R : Type uR} {S : Type uS} [CommRing R] [CommRing S] (m : ℕ) + +/-- A fourth-root character on the first factor, retaining the second factor. -/ +def partialCharacter (z : S) (hz : z ^ 4 = 1) : + Multiplicative (ZMod 4 × ZMod m) →* Elem S m where + toFun a := AddMonoidAlgebra.single a.toAdd.2 + (CyclicPolynomial.powerCharacter 4 z hz (Multiplicative.ofAdd a.toAdd.1)) + map_one' := by + change AddMonoidAlgebra.single 0 + (CyclicPolynomial.powerCharacter 4 z hz 1) = 1 + rw [map_one] + rfl + map_mul' a b := by + change AddMonoidAlgebra.single (a.toAdd.2 + b.toAdd.2) + (CyclicPolynomial.powerCharacter 4 z hz + (Multiplicative.ofAdd a.toAdd.1 * Multiplicative.ofAdd b.toAdd.1)) = + AddMonoidAlgebra.single a.toAdd.2 + (CyclicPolynomial.powerCharacter 4 z hz (Multiplicative.ofAdd a.toAdd.1)) * + AddMonoidAlgebra.single b.toAdd.2 + (CyclicPolynomial.powerCharacter 4 z hz (Multiplicative.ofAdd b.toAdd.1)) + rw [map_mul, AddMonoidAlgebra.single_mul_single] + +/-- Actual partial evaluation, allowing the integer-to-complex coefficient map. -/ +def partialEval (φ : R →+* S) (z : S) (hz : z ^ 4 = 1) : + ProductElem R m →+* Elem S m := + AddMonoidAlgebra.liftNCRingHom + (AddMonoidAlgebra.singleZeroRingHom.comp φ) (partialCharacter m z hz) + (fun _ _ => Commute.all _ _) + +@[simp] theorem partialEval_single (φ : R →+* S) (z : S) (hz : z ^ 4 = 1) + (a : ZMod 4 × ZMod m) (r : R) : + partialEval m φ z hz (AddMonoidAlgebra.single a r) = + AddMonoidAlgebra.single a.2 (φ r * z ^ a.1.val) := by + simp [partialEval, AddMonoidAlgebra.liftNCRingHom, + AddMonoidAlgebra.liftNC_single, partialCharacter, + AddMonoidAlgebra.single_mul_single] + +variable [NeZero m] + +/-- The four coefficients are summed, with no loss of the second coordinate. -/ +theorem partialEval_apply (φ : R →+* S) (z : S) (hz : z ^ 4 = 1) + (f : ProductElem R m) (b : ZMod m) : + (partialEval m φ z hz f).coeff b = + ∑ j : ZMod 4, φ (f.coeff (j, b)) * z ^ j.val := by + classical + have hexp : f = ∑ a : ZMod 4 × ZMod m, AddMonoidAlgebra.single a (f.coeff a) := by + simpa only [AddMonoidAlgebra.sum_coeff_single] using + (Finsupp.sum_fintype f.coeff AddMonoidAlgebra.single + (fun a => AddMonoidAlgebra.single_zero a)) + calc + (partialEval m φ z hz f).coeff b = + (partialEval m φ z hz (∑ a : ZMod 4 × ZMod m, + AddMonoidAlgebra.single a (f.coeff a))).coeff b := + congrArg (fun g => (partialEval m φ z hz g).coeff b) hexp + _ = ∑ a : ZMod 4 × ZMod m, + (AddMonoidAlgebra.single a.2 (φ (f.coeff a) * z ^ a.1.val)).coeff b := by + rw [map_sum] + simp only [partialEval_single, AddMonoidAlgebra.coeff_sum, Finsupp.finsetSum_apply] + _ = _ := by + rw [Fintype.sum_prod_type] + simp [AddMonoidAlgebra.coeff_single, Finsupp.single_apply] + +def mappedBlock (φ : R →+* S) (f : ProductElem R m) (j : ZMod 4) : Elem S m := + ofCoeffs fun b => φ (f.coeff (j, b)) + +@[simp] theorem mappedBlock_apply (φ : R →+* S) (f : ProductElem R m) + (j : ZMod 4) (b : ZMod m) : (mappedBlock m φ f j).coeff b = φ (f.coeff (j, b)) := rfl + +theorem partialEval_four (φ : R →+* S) (z : S) (hz : z ^ 4 = 1) + (f : ProductElem R m) : + partialEval m φ z hz f = mappedBlock m φ f 0 + z • mappedBlock m φ f 1 + + z ^ 2 • mappedBlock m φ f 2 + z ^ 3 • mappedBlock m φ f 3 := by + ext b + rw [partialEval_apply] + change (∑ j : Fin 4, φ (f.coeff (j, b)) * z ^ j.val) = + φ (f.coeff (0, b)) + z * φ (f.coeff (1, b)) + + z ^ 2 * φ (f.coeff (2, b)) + z ^ 3 * φ (f.coeff (3, b)) + rw [Fin.sum_univ_four] + change φ (f.coeff (0, b)) * z ^ 0 + φ (f.coeff (1, b)) * z ^ 1 + + φ (f.coeff (2, b)) * z ^ 2 + φ (f.coeff (3, b)) * z ^ 3 = _ + simp only [pow_zero, pow_one, one_mul, mul_comm] + +theorem partialEval_one (φ : R →+* S) (f : ProductElem R m) : + partialEval m φ 1 (by simp) f = mappedBlock m φ f 0 + mappedBlock m φ f 1 + + mappedBlock m φ f 2 + mappedBlock m φ f 3 := by + simpa using partialEval_four m φ 1 (by simp) f + +theorem partialEval_neg_one (φ : R →+* S) (f : ProductElem R m) : + partialEval m φ (-1) (by norm_num) f = mappedBlock m φ f 0 - mappedBlock m φ f 1 + + mappedBlock m φ f 2 - mappedBlock m φ f 3 := by + have hn2 : (-1 : S) ^ 2 = 1 := by norm_num + have hn3 : (-1 : S) ^ 3 = -1 := by norm_num + simpa only [hn2, hn3, one_smul, neg_one_smul, sub_eq_add_neg] + using partialEval_four m φ (-1) (by norm_num) f + +theorem fourthRoot_pow_four (i : S) (hi : i ^ 2 = -1) : i ^ 4 = 1 := by + calc + i ^ 4 = (i ^ 2) ^ 2 := by ring + _ = 1 := by rw [hi]; norm_num + +/-- The Gaussian coefficient ring can use its actual imaginary unit directly. -/ +theorem partialEval_fourthRoot (φ : R →+* S) (i : S) (hi : i ^ 2 = -1) + (f : ProductElem R m) : + partialEval m φ i (fourthRoot_pow_four i hi) f = + mappedBlock m φ f 0 + i • mappedBlock m φ f 1 - + mappedBlock m φ f 2 - i • mappedBlock m φ f 3 := by + have hi3 : i ^ 3 = -i := by + rw [pow_succ, hi] + ring + simpa only [hi, hi3, neg_one_smul, neg_smul, one_smul, sub_eq_add_neg] + using partialEval_four m φ i (fourthRoot_pow_four i hi) f + +end Evaluation + +theorem partialEval_I {R : Type uR} [CommRing R] (m : ℕ) [NeZero m] + (φ : R →+* ℂ) (f : ProductElem R m) : + partialEval m φ Complex.I (by norm_num [pow_succ, Complex.I_sq]) f = + mappedBlock m φ f 0 + Complex.I • mappedBlock m φ f 1 - + mappedBlock m φ f 2 - Complex.I • mappedBlock m φ f 3 := by + exact partialEval_fourthRoot m φ Complex.I Complex.I_sq f + +section Star + +variable {R : Type uR} {S : Type uS} [CommRing R] [StarRing R] [CommRing S] [StarRing S] +variable (m : ℕ) [NeZero m] + +/-- Intertwining is proved on the actual ring maps, with both parts of the star. -/ +theorem partialEval_groupStar (φ : R →+* S) (z : S) (hz : z ^ 4 = 1) + (hφ : ∀ r, φ (star r) = star (φ r)) + (hchar : ∀ a : ZMod 4, z ^ (-a).val = star (z ^ a.val)) + (f : ProductElem R m) : + partialEval m φ z hz (groupStar f) = ringStar (partialEval m φ z hz f) := by + have hs (a : ZMod 4 × ZMod m) (r : R) : + partialEval m φ z hz (groupStar (AddMonoidAlgebra.single a r)) = + ringStar (partialEval m φ z hz (AddMonoidAlgebra.single a r)) := by + rw [groupStar_single, partialEval_single, partialEval_single, ringStar_single] + change AddMonoidAlgebra.single (-a.2) (φ (star r) * z ^ (-a.1).val) = + AddMonoidAlgebra.single (-a.2) (star (φ r * z ^ a.1.val)) + rw [hφ, hchar, star_mul, mul_comm] + have he : (partialEval m φ z hz).comp groupStarRingHom = + (ringStarRingHom m).comp (partialEval m φ z hz) := by + apply AddMonoidAlgebra.ringHom_ext + · intro r + exact hs 0 r + · intro a + exact hs a 1 + exact RingHom.congr_fun he f + +theorem one_character_star : ∀ a : ZMod 4, (1 : S) ^ (-a).val = star ((1 : S) ^ a.val) := by + intro a + simp + +theorem neg_one_character_star : + ∀ a : ZMod 4, (-1 : S) ^ (-a).val = star ((-1 : S) ^ a.val) := by + intro a + fin_cases a + · change (-1 : S) ^ 0 = star ((-1 : S) ^ 0) + simp + · change (-1 : S) ^ 3 = star ((-1 : S) ^ 1) + norm_num + · change (-1 : S) ^ 2 = star ((-1 : S) ^ 2) + norm_num + · change (-1 : S) ^ 1 = star ((-1 : S) ^ 3) + norm_num + +theorem fourthRoot_character_star (i : S) (hi : i ^ 2 = -1) (hstar : star i = -i) : + ∀ a : ZMod 4, i ^ (-a).val = star (i ^ a.val) := by + have hi3 : i ^ 3 = -i := by + rw [pow_succ, hi] + ring + intro a + fin_cases a + · change i ^ 0 = star (i ^ 0) + simp + · change i ^ 3 = star (i ^ 1) + simp [hi3, hstar] + · change i ^ 2 = star (i ^ 2) + rw [hi] + simp + · change i ^ 1 = star (i ^ 3) + simp [hi3, hstar] + +end Star + +theorem I_character_star : + ∀ a : ZMod 4, Complex.I ^ (-a).val = star (Complex.I ^ a.val) := by + exact fourthRoot_character_star Complex.I Complex.I_sq (by simp) + +end CirculantHadamard.BinaryBlocks + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/CirculantHadamard/BinaryCharacterSum.lean b/lean/OAI/LinearAlgebra/CirculantHadamard/BinaryCharacterSum.lean new file mode 100644 index 0000000000000000000000000000000000000000..3bacc2045ee39a7151de6bb2f72f693afe1876df --- /dev/null +++ b/lean/OAI/LinearAlgebra/CirculantHadamard/BinaryCharacterSum.lean @@ -0,0 +1,334 @@ +import Mathlib.Algebra.BigOperators.Ring.Finset +import Mathlib.Algebra.CharP.Two +import Mathlib.Algebra.Group.TypeTags.Finite +import Mathlib.Data.Fintype.Powerset +import OAI.LinearAlgebra.CirculantHadamard.AlternatingProducts +import OAI.LinearAlgebra.CirculantHadamard.BinaryCoefficients +import OAI.LinearAlgebra.CirculantHadamard.CyclicEvaluation +import OAI.LinearAlgebra.CirculantHadamard.PrimeCharacterEvaluations + +namespace OAI + +universe uG uR uA uI uT uK uk uB + +/-! +# Finite character sums and the surviving empty subset + +Translation of a finite group permutes its elements. Consequently a character +with one value different from `1` has zero total sum in a domain. In a family +indexed by subsets, this removes every nonempty subset once its actual +character has such a witness. + +The unit-denominator formulation takes place in the coefficient ring itself, +so it can subsequently be mapped to a residue field of characteristic two. +It does not require a map from a characteristic-zero field to that residue +field. Nontriviality of the actual subset characters is supplied by their +primitive primary components, rather than assumed of all characters. +-/ + +namespace CirculantHadamard.BinaryCharacterSum + +open scoped BigOperators + +section CharacterSum + +variable {G : Type uG} {R : Type uR} [Group G] [Fintype G] [CommRing R] + +/-- A nontrivial value of a character forces its finite sum to vanish. +The proof uses the permutation of `G` given by left translation. -/ +theorem character_sum_eq_zero [IsDomain R] (χ : G →* R) + (hχ : ∃ g : G, χ g ≠ 1) : (∑ g : G, χ g) = 0 := by + classical + obtain ⟨g, hg⟩ := hχ + apply eq_zero_of_mul_eq_self_left hg + simpa only [Finset.mul_sum, ← map_mul] using + (Group.mulLeft_bijective g).sum_comp (fun h : G => χ h) + +/-- The trivial character sums to the cardinality of the group. -/ +theorem character_sum_trivial (χ : G →* R) (hχ : ∀ g : G, χ g = 1) : + (∑ g : G, χ g) = (Fintype.card G : R) := by + simp [hχ] + +end CharacterSum + +section ActualGroupRing + +variable {A : Type uA} {R : Type uR} [CommRing A] [CommRing R] {n : ℕ} [NeZero n] + +/-- The coefficientwise all-ones element is literally the sum of the basis +elements, with coefficient one at each group element. -/ +theorem JOver_eq_sum_single {G : Type uG} [Fintype G] : + (BinaryCoefficients.JOver A : G →₀ A) = ∑ g : G, Finsupp.single g 1 := by + classical + ext g + simp + +/-- Evaluation of the actual all-ones group-ring element is the complete +character sum. `JOver` is not the scalar unit of the group ring. -/ +theorem evaluate_J_eq_sum (φ : A →+* R) + (χ : Multiplicative (ZMod n) →* R) : + CyclicRing.evaluate φ χ (AddMonoidAlgebra.ofCoeff (BinaryCoefficients.JOver A) : CyclicRing.Elem A n) = + ∑ g : Multiplicative (ZMod n), χ g := by + rw [CyclicRing.evaluate_apply] + simp only [BinaryCoefficients.JOver_apply, map_one, one_mul] + exact (Multiplicative.ofAdd : ZMod n ≃ Multiplicative (ZMod n)).sum_comp _ + +/-- A witnessed nontrivial character annihilates the actual group-ring `J`. -/ +theorem evaluate_J_eq_zero [IsDomain R] (φ : A →+* R) + (χ : Multiplicative (ZMod n) →* R) + (hχ : ∃ g : Multiplicative (ZMod n), χ g ≠ 1) : + CyclicRing.evaluate φ χ (AddMonoidAlgebra.ofCoeff (BinaryCoefficients.JOver A) : CyclicRing.Elem A n) = 0 := by + rw [evaluate_J_eq_sum] + exact character_sum_eq_zero χ hχ + +/-- At the trivial character, the actual group-ring `J` evaluates to `n`. -/ +theorem evaluate_J_trivial (φ : A →+* R) : + CyclicRing.evaluate φ (1 : Multiplicative (ZMod n) →* R) + (AddMonoidAlgebra.ofCoeff (BinaryCoefficients.JOver A) : CyclicRing.Elem A n) = (n : R) := by + rw [CyclicRing.evaluate_apply] + simp + +end ActualGroupRing + +/-- Collapse written directly with evaluations of the actual group-ring `J`. +Only character witnesses for nonempty subsets are used. -/ +theorem subset_evaluate_J_mul + {I : Type uI} {A : Type uA} {R : Type uR} [Fintype I] [DecidableEq I] [CommRing A] + [CommRing R] [IsDomain R] {n : ℕ} [NeZero n] + (φ : A →+* R) (χ : Finset I → Multiplicative (ZMod n) →* R) + (ε d : Finset I → R) (hε : ε ∅ = 1) (htrivial : χ ∅ = 1) + (hnonempty : ∀ S : Finset I, S.Nonempty → + ∃ g : Multiplicative (ZMod n), χ S g ≠ 1) : + (∑ S : Finset I, ε S * CyclicRing.evaluate φ (χ S) + (AddMonoidAlgebra.ofCoeff (BinaryCoefficients.JOver A) : CyclicRing.Elem A n) * d S) = + (n : R) * d ∅ := by + classical + calc + (∑ S : Finset I, ε S * CyclicRing.evaluate φ (χ S) + (AddMonoidAlgebra.ofCoeff (BinaryCoefficients.JOver A) : CyclicRing.Elem A n) * d S) = + ε ∅ * CyclicRing.evaluate φ (χ ∅) + (AddMonoidAlgebra.ofCoeff (BinaryCoefficients.JOver A) : CyclicRing.Elem A n) * d ∅ := by + apply Finset.sum_eq_single ∅ + · intro S _ hS + rw [evaluate_J_eq_zero φ (χ S) + (hnonempty S (Finset.nonempty_iff_ne_empty.mpr hS))] + simp + · simp + _ = (n : R) * d ∅ := by + rw [hε, one_mul, htrivial, evaluate_J_trivial] + +/-- First prove the character sum in its domain, then change coefficient +rings. This does not assume nontriviality of the reduced characters and also +allows the coefficients `d S` to lie in a localization of the original ring. -/ +theorem subset_map_evaluate_J_mul + {I : Type uI} {A : Type uA} {R : Type uR} {T : Type uT} [Fintype I] [DecidableEq I] [CommRing A] + [CommRing R] [IsDomain R] [CommRing T] {n : ℕ} [NeZero n] + (φ : A →+* R) (ψ : R →+* T) + (χ : Finset I → Multiplicative (ZMod n) →* R) + (ε d : Finset I → T) (hε : ε ∅ = 1) (htrivial : χ ∅ = 1) + (hnonempty : ∀ S : Finset I, S.Nonempty → + ∃ g : Multiplicative (ZMod n), χ S g ≠ 1) : + (∑ S : Finset I, ε S * ψ (CyclicRing.evaluate φ (χ S) + (AddMonoidAlgebra.ofCoeff (BinaryCoefficients.JOver A) : CyclicRing.Elem A n)) * d S) = + (n : T) * d ∅ := by + classical + calc + (∑ S : Finset I, ε S * ψ (CyclicRing.evaluate φ (χ S) + (AddMonoidAlgebra.ofCoeff (BinaryCoefficients.JOver A) : CyclicRing.Elem A n)) * d S) = + ε ∅ * ψ (CyclicRing.evaluate φ (χ ∅) + (AddMonoidAlgebra.ofCoeff (BinaryCoefficients.JOver A) : CyclicRing.Elem A n)) * d ∅ := by + apply Finset.sum_eq_single ∅ + · intro S _ hS + rw [evaluate_J_eq_zero φ (χ S) + (hnonempty S (Finset.nonempty_iff_ne_empty.mpr hS))] + simp + · simp + _ = (n : T) * d ∅ := by + rw [hε, one_mul, htrivial, evaluate_J_trivial, map_natCast] + +section SubsetSum + +variable {I : Type uI} {G : Type uG} {R : Type uR} [Fintype I] [DecidableEq I] + [Group G] [Fintype G] [CommRing R] [IsDomain R] + +omit [DecidableEq I] in +/-- Only the empty subset survives. The coefficients `d S` are arbitrary; +in particular they may be inverses of specified units. -/ +theorem subset_character_sum_mul [DecidableEq I] + (χ : Finset I → G →* R) (ε d : Finset I → R) + (hε : ε ∅ = 1) (htrivial : ∀ g : G, χ ∅ g = 1) + (hnonempty : ∀ S : Finset I, S.Nonempty → ∃ g : G, χ S g ≠ 1) : + (∑ S : Finset I, ε S * (∑ g : G, χ S g) * d S) = + (Fintype.card G : R) * d ∅ := by + classical + calc + (∑ S : Finset I, ε S * (∑ g : G, χ S g) * d S) = + ε ∅ * (∑ g : G, χ ∅ g) * d ∅ := by + apply Finset.sum_eq_single ∅ + · intro S _ hS + rw [character_sum_eq_zero (χ S) + (hnonempty S (Finset.nonempty_iff_ne_empty.mpr hS))] + simp + · simp + _ = (Fintype.card G : R) * d ∅ := by + rw [hε, one_mul, character_sum_trivial (χ ∅) htrivial] + +/-- Ring-valued version of the quotient by each specified denominator unit. -/ +theorem subset_character_sum_mul_unit_inv + (χ : Finset I → G →* R) (ε : Finset I → R) (c : Finset I → Rˣ) + (hε : ε ∅ = 1) (htrivial : ∀ g : G, χ ∅ g = 1) + (hnonempty : ∀ S : Finset I, S.Nonempty → ∃ g : G, χ S g ≠ 1) : + (∑ S : Finset I, ε S * (∑ g : G, χ S g) * ↑((c S)⁻¹)) = + (Fintype.card G : R) * ↑((c ∅)⁻¹) := + subset_character_sum_mul χ ε (fun S => ↑((c S)⁻¹)) hε htrivial hnonempty + +end SubsetSum + +/-- In a field, the same collapse is expressed using division. No +nonvanishing assumption on nonempty-subset denominators is needed. -/ +theorem subset_character_sum_div + {I : Type uI} {G : Type uG} {K : Type uK} [Fintype I] [DecidableEq I] [Group G] [Fintype G] [Field K] + (χ : Finset I → G →* K) (ε c : Finset I → K) + (hε : ε ∅ = 1) (htrivial : ∀ g : G, χ ∅ g = 1) + (hnonempty : ∀ S : Finset I, S.Nonempty → ∃ g : G, χ S g ≠ 1) : + (∑ S : Finset I, ε S * (∑ g : G, χ S g) / c S) = + (Fintype.card G : K) / c ∅ := by + simpa only [div_eq_mul_inv] using + subset_character_sum_mul χ ε (fun S => (c S)⁻¹) hε htrivial hnonempty + +section Residue + +variable {R : Type uR} {k : Type uk} [CommRing R] [CommRing k] [Nontrivial k] [CharP k 2] + +/-- An odd cardinal times the inverse of a unit stays nonzero in any +nontrivial characteristic-two residue ring. -/ +theorem residue_odd_mul_unit_inv_ne_zero (φ : R →+* k) {n : ℕ} + (hn : Odd n) (c : Rˣ) : φ ((n : R) * ↑(c⁻¹)) ≠ 0 := by + rw [map_mul, map_natCast, + natCast_eq_one_of_odd_of_two_eq_zero hn (CharTwo.two_eq_zero (R := k)), one_mul] + exact (IsUnit.map φ (c⁻¹).isUnit).ne_zero + +/-- The weighted sum is nonzero after reduction when the finite group has +odd order and the empty-subset denominator is the specified unit. -/ +theorem residue_subset_character_sum_ne_zero + {I : Type uI} {G : Type uG} [Fintype I] [DecidableEq I] [Group G] [Fintype G] [IsDomain R] + (φ : R →+* k) (χ : Finset I → G →* R) + (ε : Finset I → R) (c : Finset I → Rˣ) + (hε : ε ∅ = 1) (htrivial : ∀ g : G, χ ∅ g = 1) + (hnonempty : ∀ S : Finset I, S.Nonempty → ∃ g : G, χ S g ≠ 1) + (hodd : Odd (Fintype.card G)) : + φ (∑ S : Finset I, ε S * (∑ g : G, χ S g) * ↑((c S)⁻¹)) ≠ 0 := by + rw [subset_character_sum_mul_unit_inv χ ε c hε htrivial hnonempty] + exact residue_odd_mul_unit_inv_ne_zero φ hodd (c ∅) + +/-- The residue of the actual `J` expression is nonzero. Only the denominator +at the surviving empty subset needs to be a unit; the other coefficients are +arbitrary because their character evaluations vanish. -/ +theorem residue_subset_evaluate_J_ne_zero + {I : Type uI} {A : Type uA} [Fintype I] [DecidableEq I] [CommRing A] [IsDomain R] + {n : ℕ} [NeZero n] (φ : A →+* R) (residue : R →+* k) + (χ : Finset I → Multiplicative (ZMod n) →* R) + (ε d : Finset I → R) (c₀ : Rˣ) + (hε : ε ∅ = 1) (htrivial : χ ∅ = 1) + (hnonempty : ∀ S : Finset I, S.Nonempty → + ∃ g : Multiplicative (ZMod n), χ S g ≠ 1) + (hd : d ∅ = ↑(c₀⁻¹)) (hodd : Odd n) : + residue (∑ S : Finset I, ε S * CyclicRing.evaluate φ (χ S) + (AddMonoidAlgebra.ofCoeff (BinaryCoefficients.JOver A) : CyclicRing.Elem A n) * d S) ≠ 0 := by + rw [subset_evaluate_J_mul φ χ ε d hε htrivial hnonempty, hd] + exact residue_odd_mul_unit_inv_ne_zero residue hodd c₀ + +/-- Localization and residue reduction may follow the domain-valued +character-sum proof. Only the empty-subset coefficient is constrained. -/ +theorem residue_subset_map_evaluate_J_ne_zero + {I : Type uI} {A : Type uA} {B : Type uB} [Fintype I] [DecidableEq I] [CommRing A] + [CommRing B] [IsDomain B] {n : ℕ} [NeZero n] + (φ : A →+* B) (ψ : B →+* R) (residue : R →+* k) + (χ : Finset I → Multiplicative (ZMod n) →* B) + (ε d : Finset I → R) (c₀ : Rˣ) + (hε : ε ∅ = 1) (htrivial : χ ∅ = 1) + (hnonempty : ∀ S : Finset I, S.Nonempty → + ∃ g : Multiplicative (ZMod n), χ S g ≠ 1) + (hd : d ∅ = ↑(c₀⁻¹)) (hodd : Odd n) : + residue (∑ S : Finset I, ε S * ψ (CyclicRing.evaluate φ (χ S) + (AddMonoidAlgebra.ofCoeff (BinaryCoefficients.JOver A) : CyclicRing.Elem A n)) * d S) ≠ 0 := by + rw [subset_map_evaluate_J_mul φ ψ χ ε d hε htrivial hnonempty, hd] + exact residue_odd_mul_unit_inv_ne_zero residue hodd c₀ + +end Residue + +section ActualSubsetCharacters + +open CyclotomicRings PrimeComponents PrimeCharacterEvaluations + +/-- The witness is the actual CRT generator of a prime in the nonempty +subset. Its value is the corresponding primitive prime root, hence not one. -/ +theorem actual_subsetCharacter_nontrivial (u : ℕ) (hu : 0 < u) + (S : Finset (PrimeIndex u)) (hS : S.Nonempty) : + ∃ g : Multiplicative (ZMod (u ^ 2)), subsetCharacter u hu S g ≠ 1 := by + obtain ⟨a, ha⟩ := subsetCharacter_nonempty u hu S hS + exact ⟨Multiplicative.ofAdd a, ha⟩ + +variable (u : ℕ) [NeZero (u ^ 2)] (hu : 0 < u) + +/-- The actual empty-subset evaluation of `J` is the order `u²`. -/ +theorem actual_subsetEvaluation_J_empty : + subsetEvaluation u hu ∅ + (AddMonoidAlgebra.ofCoeff (BinaryCoefficients.JOver GaussianRing) : CyclicRing.Elem GaussianRing (u ^ 2)) = + (u ^ 2 : ℕ) := by + simp only [subsetEvaluation, subsetCharacter_empty, evaluate_J_trivial] + +/-- Every actual nonempty-subset evaluation of `J` vanishes. No +nontrivial-character hypothesis is an input to this theorem. -/ +theorem actual_subsetEvaluation_J_nonempty + (S : Finset (PrimeIndex u)) (hS : S.Nonempty) : + subsetEvaluation u hu S + (AddMonoidAlgebra.ofCoeff (BinaryCoefficients.JOver GaussianRing) : CyclicRing.Elem GaussianRing (u ^ 2)) = 0 := by + exact evaluate_J_eq_zero (gaussianToB u).toRingHom (subsetCharacter u hu S) + (actual_subsetCharacter_nontrivial u hu S hS) + +/-- The actual prime-subset sum, with the literal parity signs. The target +may be a localization: its coefficients need not belong to the original `B`. -/ +theorem actual_subset_J_sum + {T : Type uT} [CommRing T] (ψ : B u →+* T) + (d : Finset (PrimeIndex u) → T) : + (∑ S : Finset (PrimeIndex u), (subsetSign S : T) * + ψ (subsetEvaluation u hu S + (AddMonoidAlgebra.ofCoeff (BinaryCoefficients.JOver GaussianRing) : CyclicRing.Elem GaussianRing (u ^ 2))) * + d S) = ((u ^ 2 : ℕ) : T) * d ∅ := by + exact subset_map_evaluate_J_mul (gaussianToB u).toRingHom ψ + (subsetCharacter u hu) (fun S => (subsetSign S : T)) d (by simp) + (subsetCharacter_empty u hu) (actual_subsetCharacter_nontrivial u hu) + +/-- In a field the concrete sum is exactly `|P| / c_empty`, with +`|P| = u²`. Values at every nonempty subset were proved zero using its +actual primitive primary component. -/ +theorem actual_subset_J_sum_div + {K : Type uK} [Field K] (ψ : B u →+* K) + (c : Finset (PrimeIndex u) → K) : + (∑ S : Finset (PrimeIndex u), (subsetSign S : K) * + ψ (subsetEvaluation u hu S + (AddMonoidAlgebra.ofCoeff (BinaryCoefficients.JOver GaussianRing) : CyclicRing.Elem GaussianRing (u ^ 2))) / + c S) = ((u ^ 2 : ℕ) : K) / c ∅ := by + simpa only [div_eq_mul_inv] using actual_subset_J_sum u hu ψ (fun S => (c S)⁻¹) + +/-- The concrete prime-character sum has nonzero characteristic-two residue. +Oddness comes from the actual `u`; only the surviving denominator must be a +unit. There is no assumption on reduced-character nontriviality. -/ +theorem actual_subset_J_residue_ne_zero + {T : Type uT} {k : Type uk} [CommRing T] [CommRing k] [Nontrivial k] [CharP k 2] + (ψ : B u →+* T) (residue : T →+* k) + (d : Finset (PrimeIndex u) → T) (c₀ : Tˣ) + (hd : d ∅ = ↑(c₀⁻¹)) (hodd : Odd u) : + residue (∑ S : Finset (PrimeIndex u), (subsetSign S : T) * + ψ (subsetEvaluation u hu S + (AddMonoidAlgebra.ofCoeff (BinaryCoefficients.JOver GaussianRing) : CyclicRing.Elem GaussianRing (u ^ 2))) * + d S) ≠ 0 := by + rw [actual_subset_J_sum u hu ψ d, hd] + exact residue_odd_mul_unit_inv_ne_zero residue hodd.pow c₀ + +end ActualSubsetCharacters + +end CirculantHadamard.BinaryCharacterSum + +end OAI diff --git a/lean/OAI/LinearAlgebra/CirculantHadamard/BinaryCoefficients.lean b/lean/OAI/LinearAlgebra/CirculantHadamard/BinaryCoefficients.lean new file mode 100644 index 0000000000000000000000000000000000000000..a5112e9b7cffc6052beeec181a84ef717c910e78 --- /dev/null +++ b/lean/OAI/LinearAlgebra/CirculantHadamard/BinaryCoefficients.lean @@ -0,0 +1,211 @@ +import OAI.LinearAlgebra.CirculantHadamard.Basic +import Mathlib.Data.Finsupp.Basic +import Mathlib.Data.Finsupp.SMulWithZero +import Mathlib.Basic.Complex.Basic +import Mathlib.Tactic.NormNum +import Mathlib.Tactic.Ring +import Mathlib.Tactic.Linarith +import Mathlib.Tactic.Abel + +namespace OAI + +universe uG uR + +namespace CirculantHadamard +namespace BinaryCoefficients + +def halfSum (x y : ℤ) : ℤ := (x + y) / 2 + +def halfDiff (x y : ℤ) : ℤ := (x - y) / 2 + +def signOffset (x : ℤ) : ℤ := (x - 1) / 2 + +theorem two_halfSum {x y : ℤ} (hx : IsSign x) (hy : IsSign y) : + 2 * halfSum x y = x + y := by + rcases hx with rfl | rfl <;> rcases hy with rfl | rfl <;> norm_num [halfSum] + +theorem two_halfDiff {x y : ℤ} (hx : IsSign x) (hy : IsSign y) : + 2 * halfDiff x y = x - y := by + rcases hx with rfl | rfl <;> rcases hy with rfl | rfl <;> norm_num [halfDiff] + +theorem halfDiff_eq {x y : ℤ} (hx : IsSign x) (hy : IsSign y) : + halfDiff x y = halfSum x y - y := by + linarith [two_halfSum hx hy, two_halfDiff hx hy] + +theorem two_signOffset {x : ℤ} (hx : IsSign x) : + 2 * signOffset x = x - 1 := by + rcases hx with rfl | rfl <;> norm_num [signOffset] + +theorem sign_eq_one_add {x : ℤ} (hx : IsSign x) : + x = 1 + 2 * signOffset x := by + linarith [two_signOffset hx] + +variable {G : Type uG} + +/-- The canonical coefficient map, with no change to the index. -/ +noncomputable def castCoeffs {R : Type uR} [Ring R] (f : G →₀ ℤ) : G →₀ R := + Finsupp.mapRange (fun z : ℤ => (z : R)) (by simp) f + +@[simp] theorem castCoeffs_apply {R : Type uR} [Ring R] (f : G →₀ ℤ) (x : G) : + castCoeffs (R := R) f x = (f x : R) := rfl + +noncomputable def complexify (f : G →₀ ℤ) : G →₀ ℂ := castCoeffs f + +@[simp] theorem complexify_apply (f : G →₀ ℤ) (x : G) : + complexify f x = (f x : ℂ) := rfl + +theorem complexify_add (f h : G →₀ ℤ) : + complexify (f + h) = complexify f + complexify h := by + ext x + simp + +theorem complexify_sub (f h : G →₀ ℤ) : + complexify (f - h) = complexify f - complexify h := by + ext x + simp + +theorem complexify_int_smul (z : ℤ) (f : G →₀ ℤ) : + complexify (z • f) = (z : ℂ) • complexify f := by + ext x + simp [Finsupp.smul_apply, smul_eq_mul] + +/-- Integer real and imaginary parts interpreted in any coefficient ring. +The linear identities do not require an equation such as `i^2 = -1`. -/ +noncomputable def liftPair {R : Type uR} [CommRing R] (i : R) (f h : G →₀ ℤ) : G →₀ R := + castCoeffs f + i • castCoeffs h + +variable [Finite G] + +noncomputable def ofCoeffs {R : Type uR} [Zero R] (f : G → R) : G →₀ R := + Finsupp.equivFunOnFinite.symm f + +@[simp] theorem ofCoeffs_apply {R : Type uR} [Zero R] (f : G → R) (x : G) : + ofCoeffs f x = f x := rfl + +/-- Literal sign hypotheses for the four blocks, without a norm premise. -/ +def Signs (H : Fin 4 → (G →₀ ℤ)) : Prop := ∀ j x, IsSign (H j x) + +noncomputable def a (H : Fin 4 → (G →₀ ℤ)) : G →₀ ℤ := + ofCoeffs fun x => halfSum (H 0 x) (H 2 x) + +noncomputable def b (H : Fin 4 → (G →₀ ℤ)) : G →₀ ℤ := + ofCoeffs fun x => halfSum (H 1 x) (H 3 x) + +noncomputable def c (H : Fin 4 → (G →₀ ℤ)) : G →₀ ℤ := a H + b H + +noncomputable def d (H : Fin 4 → (G →₀ ℤ)) : G →₀ ℤ := a H - b H + +noncomputable def gReal (H : Fin 4 → (G →₀ ℤ)) : G →₀ ℤ := + ofCoeffs fun x => halfDiff (H 0 x) (H 2 x) + +noncomputable def gImag (H : Fin 4 → (G →₀ ℤ)) : G →₀ ℤ := + ofCoeffs fun x => halfDiff (H 1 x) (H 3 x) + +noncomputable def gOver {R : Type uR} [CommRing R] (i : R) + (H : Fin 4 → (G →₀ ℤ)) : G →₀ R := liftPair i (gReal H) (gImag H) + +noncomputable def g (H : Fin 4 → (G →₀ ℤ)) : G →₀ ℂ := gOver Complex.I H + +noncomputable def UReal (H : Fin 4 → (G →₀ ℤ)) : G →₀ ℤ := + ofCoeffs fun x => signOffset (H 2 x) + +noncomputable def UImag (H : Fin 4 → (G →₀ ℤ)) : G →₀ ℤ := + ofCoeffs fun x => signOffset (H 3 x) + +noncomputable def UOver {R : Type uR} [CommRing R] (i : R) + (H : Fin 4 → (G →₀ ℤ)) : G →₀ R := liftPair i (UReal H) (UImag H) + +noncomputable def U (H : Fin 4 → (G →₀ ℤ)) : G →₀ ℂ := UOver Complex.I H + +/-- This is the sum of all group elements (every coefficient is one), +not the scalar one in a convolution ring. -/ +noncomputable def JOver (R : Type uR) [CommRing R] : G →₀ R := ofCoeffs fun _ => 1 + +@[simp] theorem JOver_apply {R : Type uR} [CommRing R] (x : G) : + (JOver R : G →₀ R) x = 1 := rfl + +noncomputable def J : G →₀ ℂ := JOver ℂ + +@[simp] theorem J_apply (x : G) : (J : G →₀ ℂ) x = 1 := rfl + +theorem two_a {H : Fin 4 → (G →₀ ℤ)} (hH : Signs H) : + (2 : ℤ) • a H = H 0 + H 2 := by + ext x + change 2 * halfSum (H 0 x) (H 2 x) = H 0 x + H 2 x + exact two_halfSum (hH 0 x) (hH 2 x) + +theorem two_b {H : Fin 4 → (G →₀ ℤ)} (hH : Signs H) : + (2 : ℤ) • b H = H 1 + H 3 := by + ext x + change 2 * halfSum (H 1 x) (H 3 x) = H 1 x + H 3 x + exact two_halfSum (hH 1 x) (hH 3 x) + +theorem two_c {H : Fin 4 → (G →₀ ℤ)} (hH : Signs H) : + (2 : ℤ) • c H = H 0 + H 1 + H 2 + H 3 := by + rw [c, smul_add, two_a hH, two_b hH] + abel + +theorem two_d {H : Fin 4 → (G →₀ ℤ)} (hH : Signs H) : + (2 : ℤ) • d H = H 0 - H 1 + H 2 - H 3 := by + rw [d, smul_sub, two_a hH, two_b hH] + abel + +theorem gOver_eq_ab {R : Type uR} [CommRing R] (i : R) + {H : Fin 4 → (G →₀ ℤ)} (hH : Signs H) : + gOver i H = castCoeffs (a H) + i • castCoeffs (b H) - + castCoeffs (H 2) - i • castCoeffs (H 3) := by + ext x + simp only [gOver, liftPair, gReal, gImag, a, b, Finsupp.add_apply, Finsupp.sub_apply, + Finsupp.smul_apply, castCoeffs_apply, ofCoeffs_apply, smul_eq_mul] + rw [halfDiff_eq (hH 0 x) (hH 2 x), halfDiff_eq (hH 1 x) (hH 3 x)] + push_cast + ring + +theorem two_gOver {R : Type uR} [CommRing R] (i : R) + {H : Fin 4 → (G →₀ ℤ)} (hH : Signs H) : + (2 : R) • gOver i H = castCoeffs (H 0) + i • castCoeffs (H 1) - + castCoeffs (H 2) - i • castCoeffs (H 3) := by + ext x + have h0 := congrArg (fun z : ℤ => (z : R)) (two_halfDiff (hH 0 x) (hH 2 x)) + have h1 := congrArg (fun z : ℤ => (z : R)) (two_halfDiff (hH 1 x) (hH 3 x)) + push_cast at h0 h1 + simp only [gOver, liftPair, gReal, gImag, Finsupp.add_apply, Finsupp.sub_apply, + Finsupp.smul_apply, castCoeffs_apply, ofCoeffs_apply, smul_eq_mul] + calc + _ = 2 * (halfDiff (H 0 x) (H 2 x) : R) + + i * (2 * (halfDiff (H 1 x) (H 3 x) : R)) := by ring + _ = _ := by rw [h0, h1]; ring + +/-- The binary identity with an explicitly constructed integral-pair `U`. -/ +theorem binary_identity_over {R : Type uR} [CommRing R] (i : R) + {H : Fin 4 → (G →₀ ℤ)} (hH : Signs H) : + castCoeffs (H 2) + i • castCoeffs (H 3) = + (1 + i) • (JOver R : G →₀ R) + (2 : R) • UOver i H := by + ext x + have h2 := congrArg (fun z : ℤ => (z : R)) (sign_eq_one_add (hH 2 x)) + have h3 := congrArg (fun z : ℤ => (z : R)) (sign_eq_one_add (hH 3 x)) + push_cast at h2 h3 + simp only [UOver, liftPair, UReal, UImag, Finsupp.add_apply, Finsupp.smul_apply, + castCoeffs_apply, ofCoeffs_apply, JOver_apply, smul_eq_mul] + rw [h2, h3] + ring + +theorem g_eq_ab {H : Fin 4 → (G →₀ ℤ)} (hH : Signs H) : + g H = complexify (a H) + Complex.I • complexify (b H) - + complexify (H 2) - Complex.I • complexify (H 3) := + gOver_eq_ab Complex.I hH + +theorem two_g {H : Fin 4 → (G →₀ ℤ)} (hH : Signs H) : + (2 : ℂ) • g H = complexify (H 0) + Complex.I • complexify (H 1) - + complexify (H 2) - Complex.I • complexify (H 3) := + two_gOver Complex.I hH + +theorem binary_identity {H : Fin 4 → (G →₀ ℤ)} (hH : Signs H) : + complexify (H 2) + Complex.I • complexify (H 3) = + (1 + Complex.I) • (J : G →₀ ℂ) + (2 : ℂ) • U H := + binary_identity_over Complex.I hH + +end BinaryCoefficients +end CirculantHadamard + +end OAI diff --git a/lean/OAI/LinearAlgebra/CirculantHadamard/BinaryContradiction.lean b/lean/OAI/LinearAlgebra/CirculantHadamard/BinaryContradiction.lean new file mode 100644 index 0000000000000000000000000000000000000000..529baa7db336306f7e34cf237519bce4e563a177 --- /dev/null +++ b/lean/OAI/LinearAlgebra/CirculantHadamard/BinaryContradiction.lean @@ -0,0 +1,55 @@ +import OAI.LinearAlgebra.CirculantHadamard.CyclicNorm +import OAI.LinearAlgebra.CirculantHadamard.BinaryEvaluation +import OAI.LinearAlgebra.CirculantHadamard.BinaryLocalFamily +import OAI.LinearAlgebra.CirculantHadamard.AlternatingTorsion + +namespace OAI + +noncomputable section + +namespace CirculantHadamard + +open CyclicRing BinaryEvaluation + +/-- The binary contradiction starts with the original integer sign row and +its full cyclic norm equation. -/ +theorem binary_sign_norm_impossible {u : ℕ} [NeZero u] + (hu : 1 < u) (hodd : Odd u) + (f : Elem ℤ (4 * u ^ 2)) (hsign : ∀ a, IsSign (f.coeff a)) + (hnorm : f * ringStar f = scalar (4 * u ^ 2) ((4 * u ^ 2 : ℕ) : ℤ)) : + False := by + let hu0 : 0 < u := lt_trans Nat.zero_lt_one hu + let H := BinaryBlocks.blocks (BinaryBlocks.crt ℤ u hodd f) + have hH : BinaryCoefficients.Signs (fun j => (H j).coeff) := + BinaryBlocks.crt_blocks_signs hodd f hsign + obtain ⟨hc, hd, hg⟩ := gaussian_norms_of_cyclic_norm hodd f hsign hnorm + apply BinaryLocalFamily.contradiction_of_evaluated_data u hu0 hodd + (cG H) (dG H) (gG H) hc hd hg + (aValue u hu0 H) (bValue u hu0 H) (UValue u hu0 H) + · exact fun S => cValue_eq u hu0 H S + · exact fun S => dValue_eq u hu0 H S + · exact fun S => gValue_eq u hu0 hH S + · exact alternatingProduct_odd_torsion u hu hodd (cG H) + (by simpa only [Nat.cast_pow] using hc) + · exact alternatingProduct_odd_torsion u hu hodd (dG H) + (by simpa only [Nat.cast_pow] using hd) + · exact alternatingProduct_odd_torsion u hu hodd (gG H) + (by simpa only [Nat.cast_pow] using hg) + +/-- No real circulant sign Hadamard matrix has order `4u²` for odd `u > 1`. +The original real-matrix predicate is converted by the proved integer-row +equivalence; every subsequent construction is made from that actual row. -/ +theorem not_exists_four_mul_odd_square {u : ℕ} + (hu : 1 < u) (hodd : Odd u) : + ¬ ExistsRealCirculantHadamard (4 * u ^ 2) := by + let : NeZero u := ⟨(lt_trans Nat.zero_lt_one hu).ne'⟩ + intro hH + obtain ⟨f, hsign, hnorm⟩ := + (exists_cyclicSignRow_iff_real (n := 4 * u ^ 2)).mpr hH + exact binary_sign_norm_impossible hu hodd f hsign hnorm + +end CirculantHadamard + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/CirculantHadamard/BinaryEvaluation.lean b/lean/OAI/LinearAlgebra/CirculantHadamard/BinaryEvaluation.lean new file mode 100644 index 0000000000000000000000000000000000000000..3d60e938d51335f35c4ce96f48e0ec731a0ce687 --- /dev/null +++ b/lean/OAI/LinearAlgebra/CirculantHadamard/BinaryEvaluation.lean @@ -0,0 +1,274 @@ +import OAI.LinearAlgebra.CirculantHadamard.BinaryNorms +import OAI.LinearAlgebra.CirculantHadamard.PrimeCharacterEvaluations + +namespace OAI + +universe uR + +/-! +# Evaluation of the actual binary coefficient construction + +The integral `c,d` are mapped coefficientwise into the Gaussian subring, with +their proved convolution norms preserved. All values are taken by the +constructed prime-subset character map into the actual cyclotomic ring `B u`. +The norm equations follow from the original cyclic sign row. +-/ + +noncomputable section + +namespace CirculantHadamard.BinaryEvaluation + +open scoped BigOperators +open CyclicRing BinaryCoefficients CyclotomicRings PrimeComponents +open PrimeCharacterEvaluations + +/- Select the canonical multiplication action directly. This avoids searching +through the concrete subalgebra's unrelated inherited scalar actions. -/ +local instance gaussianSelfScalar : SMulZeroClass GaussianRing GaussianRing where + smul r x := r * x + smul_zero := mul_zero + +local instance gaussianCoeffScalar (n : ℕ) : + SMulZeroClass GaussianRing (ZMod n →₀ GaussianRing) := Finsupp.smulZeroClass + +/-- The canonical coefficient action, with its group-algebra result type fixed. -/ +def gaussianScale {n : ℕ} (r : GaussianRing) (x : Elem GaussianRing n) : + Elem GaussianRing n := + AddMonoidAlgebra.ofCoeff + (@SMul.smul GaussianRing (ZMod n →₀ GaussianRing) + (gaussianCoeffScalar n).toSMul r x.coeff) + +@[simp] theorem gaussianScale_apply {n : ℕ} (r : GaussianRing) + (x : Elem GaussianRing n) (a : ZMod n) : (gaussianScale r x).coeff a = r * x.coeff a := rfl + +section CoefficientCast + +variable {R : Type uR} [CommRing R] {n : ℕ} [NeZero n] + +omit [NeZero n] in +theorem castCoeffs_add [NeZero n] (f g : Elem ℤ n) : + AddMonoidAlgebra.ofCoeff (castCoeffs (R := R) (f + g).coeff) = + AddMonoidAlgebra.ofCoeff (castCoeffs f.coeff) + + AddMonoidAlgebra.ofCoeff (castCoeffs g.coeff) := by + apply AddMonoidAlgebra.coeff_injective + apply Finsupp.ext + intro x + change ((f.coeff x + g.coeff x : ℤ) : R) = (f.coeff x : R) + (g.coeff x : R) + exact Int.cast_add _ _ + +omit [NeZero n] in +theorem castCoeffs_sub [NeZero n] (f g : Elem ℤ n) : + AddMonoidAlgebra.ofCoeff (castCoeffs (R := R) (f - g).coeff) = + AddMonoidAlgebra.ofCoeff (castCoeffs f.coeff) - + AddMonoidAlgebra.ofCoeff (castCoeffs g.coeff) := by + apply AddMonoidAlgebra.coeff_injective + apply Finsupp.ext + intro x + change ((f.coeff x - g.coeff x : ℤ) : R) = (f.coeff x : R) - (g.coeff x : R) + exact Int.cast_sub _ _ + +theorem castCoeffs_mul (f g : Elem ℤ n) : + AddMonoidAlgebra.ofCoeff (castCoeffs (R := R) (f * g).coeff) = + Mul.mul (α := Elem R n) (AddMonoidAlgebra.ofCoeff (castCoeffs f.coeff)) + (AddMonoidAlgebra.ofCoeff (castCoeffs g.coeff)) := by + apply AddMonoidAlgebra.coeff_injective + apply Finsupp.ext + intro x + calc + (((f * g).coeff x : ℤ) : R) = ∑ j, (f.coeff j : R) * (g.coeff (x - j) : R) := by + rw [CyclicRing.mul_apply] + simp only [Int.cast_sum, Int.cast_mul] + _ = _ := (CyclicRing.mul_apply (AddMonoidAlgebra.ofCoeff (castCoeffs (R := R) f.coeff)) + (AddMonoidAlgebra.ofCoeff (castCoeffs g.coeff)) x).symm + +theorem castCoeffs_ringStar [StarRing R] (f : Elem ℤ n) : + AddMonoidAlgebra.ofCoeff (castCoeffs (R := R) (ringStar f).coeff) = + ringStar (AddMonoidAlgebra.ofCoeff (castCoeffs f.coeff)) := by + apply AddMonoidAlgebra.coeff_injective + apply Finsupp.ext + intro x + simp + +omit [NeZero n] in +theorem castCoeffs_scalar [NeZero n] (r : ℤ) : + AddMonoidAlgebra.ofCoeff (castCoeffs (R := R) (scalar n r).coeff) = + scalar n (r : R) := by + classical + apply AddMonoidAlgebra.coeff_injective + apply Finsupp.ext + intro x + simp [scalar_apply] + +/-- Coefficient maps preserve the norm equation. -/ +theorem castCoeffs_norm [StarRing R] (f : Elem ℤ n) (r : ℕ) + (hf : f * ringStar f = scalar n (r : ℤ)) : + Mul.mul (α := Elem R n) (AddMonoidAlgebra.ofCoeff (castCoeffs f.coeff)) + (ringStar (AddMonoidAlgebra.ofCoeff (castCoeffs f.coeff))) = scalar n (r : R) := by + have h := congrArg (fun z : Elem ℤ n => + AddMonoidAlgebra.ofCoeff (castCoeffs (R := R) z.coeff)) hf + simpa only [castCoeffs_mul, castCoeffs_ringStar, castCoeffs_scalar, + Int.cast_natCast] using h + +end CoefficientCast + +section GaussianBlocks + +variable {n : ℕ} [NeZero n] + +def aG (H : Fin 4 → Elem ℤ n) : Elem GaussianRing n := + AddMonoidAlgebra.ofCoeff (castCoeffs (a (fun j => (H j).coeff))) +def bG (H : Fin 4 → Elem ℤ n) : Elem GaussianRing n := + AddMonoidAlgebra.ofCoeff (castCoeffs (b (fun j => (H j).coeff))) +def cG (H : Fin 4 → Elem ℤ n) : Elem GaussianRing n := + AddMonoidAlgebra.ofCoeff (castCoeffs (c (fun j => (H j).coeff))) +def dG (H : Fin 4 → Elem ℤ n) : Elem GaussianRing n := + AddMonoidAlgebra.ofCoeff (castCoeffs (d (fun j => (H j).coeff))) +def gG (H : Fin 4 → Elem ℤ n) : Elem GaussianRing n := + AddMonoidAlgebra.ofCoeff (gOver gaussianI (fun j => (H j).coeff)) +def UG (H : Fin 4 → Elem ℤ n) : Elem GaussianRing n := + AddMonoidAlgebra.ofCoeff (UOver gaussianI (fun j => (H j).coeff)) +def JG : Elem GaussianRing n := AddMonoidAlgebra.ofCoeff (JOver GaussianRing) + +theorem cG_eq (H : Fin 4 → Elem ℤ n) : cG H = aG H + bG H := + castCoeffs_add (AddMonoidAlgebra.ofCoeff (a (fun j => (H j).coeff))) + (AddMonoidAlgebra.ofCoeff (b (fun j => (H j).coeff))) + +theorem dG_eq (H : Fin 4 → Elem ℤ n) : dG H = aG H - bG H := + castCoeffs_sub (AddMonoidAlgebra.ofCoeff (a (fun j => (H j).coeff))) + (AddMonoidAlgebra.ofCoeff (b (fun j => (H j).coeff))) + +theorem gG_eq {H : Fin 4 → Elem ℤ n} (hH : Signs (fun j => (H j).coeff)) : + gG H = aG H + gaussianScale gaussianI (bG H) - + (gaussianScale (1 + gaussianI) JG + gaussianScale 2 (UG H)) := by + calc + gG H = aG H + gaussianScale gaussianI (bG H) - + Add.add (α := Elem GaussianRing n) + (AddMonoidAlgebra.ofCoeff (castCoeffs (H 2).coeff)) + (gaussianScale gaussianI (AddMonoidAlgebra.ofCoeff (castCoeffs (H 3).coeff))) := by + apply AddMonoidAlgebra.coeff_injective + have h := gOver_eq_ab gaussianI hH + rw [sub_sub] at h + simp only [gG, aG, bG, gaussianScale, AddMonoidAlgebra.coeff_sub, + AddMonoidAlgebra.coeff_add, AddMonoidAlgebra.coeff_ofCoeff] + convert h using 1; rfl + _ = _ := by + apply congrArg + (fun z : Elem GaussianRing n => aG H + gaussianScale gaussianI (bG H) - z) + apply AddMonoidAlgebra.coeff_injective + have h := binary_identity_over gaussianI hH + simp only [gaussianScale, JG, UG, AddMonoidAlgebra.coeff_add, + AddMonoidAlgebra.coeff_ofCoeff] + convert h using 1; rfl + +theorem cG_norm (H : Fin 4 → Elem ℤ n) (r : ℕ) + (hc : Mul.mul (α := Elem ℤ n) + (AddMonoidAlgebra.ofCoeff (c (fun j => (H j).coeff))) + (ringStar (AddMonoidAlgebra.ofCoeff (c (fun j => (H j).coeff)))) = + scalar n (r : ℤ)) : + cG H * ringStar (cG H) = scalar n (r : GaussianRing) := + castCoeffs_norm (AddMonoidAlgebra.ofCoeff (c (fun j => (H j).coeff))) r hc + +theorem dG_norm (H : Fin 4 → Elem ℤ n) (r : ℕ) + (hd : Mul.mul (α := Elem ℤ n) + (AddMonoidAlgebra.ofCoeff (d (fun j => (H j).coeff))) + (ringStar (AddMonoidAlgebra.ofCoeff (d (fun j => (H j).coeff)))) = + scalar n (r : ℤ)) : + dG H * ringStar (dG H) = scalar n (r : GaussianRing) := + castCoeffs_norm (AddMonoidAlgebra.ofCoeff (d (fun j => (H j).coeff))) r hd + +end GaussianBlocks + +section Values + +variable (u : ℕ) [NeZero u] (hu : 0 < u) + +def iB : B u := gaussianToB u gaussianI + +def aValue (H : Fin 4 → Elem ℤ (u ^ 2)) (S : Finset (PrimeIndex u)) : B u := + subsetEvaluation u hu S (aG H) +def bValue (H : Fin 4 → Elem ℤ (u ^ 2)) (S : Finset (PrimeIndex u)) : B u := + subsetEvaluation u hu S (bG H) +def cValue (H : Fin 4 → Elem ℤ (u ^ 2)) (S : Finset (PrimeIndex u)) : B u := + subsetEvaluation u hu S (cG H) +def dValue (H : Fin 4 → Elem ℤ (u ^ 2)) (S : Finset (PrimeIndex u)) : B u := + subsetEvaluation u hu S (dG H) +def gValue (H : Fin 4 → Elem ℤ (u ^ 2)) (S : Finset (PrimeIndex u)) : B u := + subsetEvaluation u hu S (gG H) +def UValue (H : Fin 4 → Elem ℤ (u ^ 2)) (S : Finset (PrimeIndex u)) : B u := + subsetEvaluation u hu S (UG H) +def JValue (S : Finset (PrimeIndex u)) : B u := subsetEvaluation u hu S JG + +theorem subsetEvaluation_smul (S : Finset (PrimeIndex u)) (r : GaussianRing) + (x : Elem GaussianRing (u ^ 2)) : + subsetEvaluation u hu S (gaussianScale r x) = + gaussianToB u r * subsetEvaluation u hu S x := by + change evaluate (gaussianToB u).toRingHom (subsetCharacter u hu S) _ = + gaussianToB u r * evaluate (gaussianToB u).toRingHom (subsetCharacter u hu S) x + rw [evaluate_apply, evaluate_apply, Finset.mul_sum] + apply Finset.sum_congr rfl + intro a _ + change gaussianToB u (r * x.coeff a) * subsetCharacter u hu S (Multiplicative.ofAdd a) = + gaussianToB u r * + (gaussianToB u (x.coeff a) * subsetCharacter u hu S (Multiplicative.ofAdd a)) + rw [map_mul, mul_assoc] + +theorem cValue_eq (H : Fin 4 → Elem ℤ (u ^ 2)) (S : Finset (PrimeIndex u)) : + cValue u hu H S = aValue u hu H S + bValue u hu H S := by + exact congrArg (subsetEvaluation u hu S) (cG_eq H) |>.trans (map_add _ _ _) + +theorem dValue_eq (H : Fin 4 → Elem ℤ (u ^ 2)) (S : Finset (PrimeIndex u)) : + dValue u hu H S = aValue u hu H S - bValue u hu H S := by + exact congrArg (subsetEvaluation u hu S) (dG_eq H) |>.trans (map_sub _ _ _) + +theorem gValue_eq {H : Fin 4 → Elem ℤ (u ^ 2)} (hH : Signs (fun j => (H j).coeff)) + (S : Finset (PrimeIndex u)) : + gValue u hu H S = aValue u hu H S + iB u * bValue u hu H S - + ((1 + iB u) * JValue u hu S + 2 * UValue u hu H S) := by + have h := congrArg (subsetEvaluation u hu S) (gG_eq hH) + simpa [map_add, map_sub, map_ofNat, subsetEvaluation_smul, iB, gValue, aValue, bValue, + JValue, UValue] using h + +theorem evaluated_norms (H : Fin 4 → Elem ℤ (u ^ 2)) + (hc : cG H * ringStar (cG H) = scalar (u ^ 2) ((u ^ 2 : ℕ) : GaussianRing)) + (hd : dG H * ringStar (dG H) = scalar (u ^ 2) ((u ^ 2 : ℕ) : GaussianRing)) + (hg : gG H * ringStar (gG H) = scalar (u ^ 2) ((u ^ 2 : ℕ) : GaussianRing)) + (S : Finset (PrimeIndex u)) : + cValue u hu H S * star (cValue u hu H S) = ((u ^ 2 : ℕ) : B u) ∧ + dValue u hu H S * star (dValue u hu H S) = ((u ^ 2 : ℕ) : B u) ∧ + gValue u hu H S * star (gValue u hu H S) = ((u ^ 2 : ℕ) : B u) := + ⟨subsetEvaluation_norm u hu S (cG H) hc, + subsetEvaluation_norm u hu S (dG H) hd, + subsetEvaluation_norm u hu S (gG H) hg⟩ + +end Values + +/-- All three Gaussian norm equations come from the original cyclic sign row. -/ +theorem gaussian_norms_of_cyclic_norm {u : ℕ} [NeZero u] (hu : Odd u) + (f : Elem ℤ (4 * u ^ 2)) (hsign : ∀ a, IsSign (f.coeff a)) + (hnorm : f * ringStar f = scalar (4 * u ^ 2) ((4 * u ^ 2 : ℕ) : ℤ)) : + let H := BinaryBlocks.blocks (BinaryBlocks.crt ℤ u hu f) + cG H * ringStar (cG H) = scalar (u ^ 2) ((u ^ 2 : ℕ) : GaussianRing) ∧ + dG H * ringStar (dG H) = scalar (u ^ 2) ((u ^ 2 : ℕ) : GaussianRing) ∧ + gG H * ringStar (gG H) = scalar (u ^ 2) ((u ^ 2 : ℕ) : GaussianRing) := by + obtain ⟨hc, hd, hg⟩ := BinaryNorms.binary_norms_of_cyclic_norm hu f hsign hnorm + exact ⟨cG_norm _ (u ^ 2) hc, dG_norm _ (u ^ 2) hd, hg⟩ + +/-- Actual subset evaluations of `c,d,g` all have star norm `u²`, +without independent binary-element norm assumptions. -/ +theorem binary_evaluation_of_cyclic_norm {u : ℕ} [NeZero u] (hu : Odd u) + (f : Elem ℤ (4 * u ^ 2)) (hsign : ∀ a, IsSign (f.coeff a)) + (hnorm : f * ringStar f = scalar (4 * u ^ 2) ((4 * u ^ 2 : ℕ) : ℤ)) + (S : Finset (PrimeIndex u)) : + let hp : 0 < u := Nat.pos_of_ne_zero (NeZero.ne u) + let H := BinaryBlocks.blocks (BinaryBlocks.crt ℤ u hu f) + cValue u hp H S * star (cValue u hp H S) = ((u ^ 2 : ℕ) : B u) ∧ + dValue u hp H S * star (dValue u hp H S) = ((u ^ 2 : ℕ) : B u) ∧ + gValue u hp H S * star (gValue u hp H S) = ((u ^ 2 : ℕ) : B u) := by + obtain ⟨hc, hd, hg⟩ := gaussian_norms_of_cyclic_norm hu f hsign hnorm + exact evaluated_norms u (Nat.pos_of_ne_zero (NeZero.ne u)) _ hc hd hg S + +end CirculantHadamard.BinaryEvaluation + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/CirculantHadamard/BinaryLocalFamily.lean b/lean/OAI/LinearAlgebra/CirculantHadamard/BinaryLocalFamily.lean new file mode 100644 index 0000000000000000000000000000000000000000..084a7838f73ada59cdd8c846d4ff8b897224a23f --- /dev/null +++ b/lean/OAI/LinearAlgebra/CirculantHadamard/BinaryLocalFamily.lean @@ -0,0 +1,109 @@ +import OAI.LinearAlgebra.CirculantHadamard.BinaryLocalRing +import OAI.LinearAlgebra.CirculantHadamard.BinaryProductTransport +import OAI.LinearAlgebra.CirculantHadamard.BinaryCharacterSum +import OAI.LinearAlgebra.CirculantHadamard.BinaryResidue + +namespace OAI + +noncomputable section + +namespace CirculantHadamard.BinaryLocalFamily + +open scoped BigOperators +open CyclotomicRings PrimeComponents PrimeCharacterEvaluations CyclicRing +open BinaryLocalRing BinaryProductTransport + +variable (u : ℕ) [NeZero (u ^ 2)] (hu : 0 < u) (hodd : Odd u) + +/-- The actual local unit attached to one evaluated Gaussian norm element. -/ +def evaluationUnit (x : Elem GaussianRing (u ^ 2)) + (hx : x * ringStar x = scalar (u ^ 2) ((u ^ 2 : ℕ) : GaussianRing)) + (S : Finset (PrimeIndex u)) : (O u)ˣ := + normUnit u hodd (subsetEvaluation u hu S x) (star (subsetEvaluation u hu S x)) + (by simpa only [Nat.cast_pow] using subsetEvaluation_norm u hu S x hx) + +@[simp] theorem evaluationUnit_val (x : Elem GaussianRing (u ^ 2)) + (hx : x * ringStar x = scalar (u ^ 2) ((u ^ 2 : ℕ) : GaussianRing)) + (S : Finset (PrimeIndex u)) : + (evaluationUnit u hu hodd x hx S : O u) = toLocal u (subsetEvaluation u hu S x) := + normUnit_val _ _ _ _ _ + +include hodd in +/-- The concrete local argument. In particular, neither local units nor a +nonzero residue sum are assumptions of this theorem. -/ +theorem contradiction_of_evaluated_data + (C D G : Elem GaussianRing (u ^ 2)) + (hC : C * ringStar C = scalar (u ^ 2) ((u ^ 2 : ℕ) : GaussianRing)) + (hD : D * ringStar D = scalar (u ^ 2) ((u ^ 2 : ℕ) : GaussianRing)) + (hG : G * ringStar G = scalar (u ^ 2) ((u ^ 2 : ℕ) : GaussianRing)) + (a b U : Finset (PrimeIndex u) → B u) + (hc : ∀ S, subsetEvaluation u hu S C = a S + b S) + (hd : ∀ S, subsetEvaluation u hu S D = a S - b S) + (hg : ∀ S, subsetEvaluation u hu S G = + a S + gaussianToB u gaussianI * b S - + ((1 + gaussianToB u gaussianI) * + subsetEvaluation u hu S (AddMonoidAlgebra.ofCoeff (BinaryCoefficients.JOver GaussianRing)) + 2 * U S)) + (hCodd : ∃ m : ℕ, 0 < m ∧ Odd m ∧ + (alternatingProduct (Finset.univ : Finset (PrimeIndex u)) + (fun S => algebraMap (B u) (FractionRing (B u)) (subsetEvaluation u hu S C))) ^ m = 1) + (hDodd : ∃ m : ℕ, 0 < m ∧ Odd m ∧ + (alternatingProduct (Finset.univ : Finset (PrimeIndex u)) + (fun S => algebraMap (B u) (FractionRing (B u)) (subsetEvaluation u hu S D))) ^ m = 1) + (hGodd : ∃ m : ℕ, 0 < m ∧ Odd m ∧ + (alternatingProduct (Finset.univ : Finset (PrimeIndex u)) + (fun S => algebraMap (B u) (FractionRing (B u)) (subsetEvaluation u hu S G))) ^ m = 1) : + False := by + classical + let c := evaluationUnit u hu hodd C hC + let d := evaluationUnit u hu hodd D hD + let g := evaluationUnit u hu hodd G hG + have cval (S) : (c S : O u) = toLocal u (subsetEvaluation u hu S C) := + evaluationUnit_val u hu hodd C hC S + have dval (S) : (d S : O u) = toLocal u (subsetEvaluation u hu S D) := + evaluationUnit_val u hu hodd D hD S + have gval (S) : (g S : O u) = toLocal u (subsetEvaluation u hu S G) := + evaluationUnit_val u hu hodd G hG S + have hr := local_alternatingProduct_ratio_has_odd_power u Finset.univ + (fun S => subsetEvaluation u hu S D) (fun S => subsetEvaluation u hu S C) + d c (fun S _ => dval S) (fun S _ => cval S) hDodd hCodd + have hw := local_alternatingProduct_ratio_has_odd_power u Finset.univ + (fun S => subsetEvaluation u hu S G) (fun S => subsetEvaluation u hu S C) + g c (fun S _ => gval S) (fun S _ => cval S) hGodd hCodd + apply binary_residue_contradiction (residue u) (imaginary u) + (imaginary_sq u) (residue_imaginary u) (two_ne_zero u) + (Finset.univ : Finset (Finset (PrimeIndex u))) subsetSign c d g + (fun S => toLocal u (a S)) (fun S => toLocal u (b S)) + (fun S => toLocal u (subsetEvaluation u hu S (AddMonoidAlgebra.ofCoeff (BinaryCoefficients.JOver GaussianRing)))) + (fun S => toLocal u (U S)) + · intro S _ + rw [cval, hc, map_add] + · intro S _ + rw [dval, hd, map_sub] + · intro S _ + rw [gval, hg] + have hi_local : toLocal u (gaussianToB u gaussianI) = imaginary u := by + change toLocal u ((gaussianToB u).toRingHom gaussianI) = + ((toLocal u).comp (gaussianToB u).toRingHom) gaussianI + exact (RingHom.comp_apply _ _ _).symm + simp only [map_sub, map_add, map_mul, map_one, map_ofNat, hi_local] + · simpa only [alternatingProduct, Finset.powerset_univ] using hr + · simpa only [alternatingProduct, Finset.powerset_univ] using hw + · have hnonzero := BinaryCharacterSum.actual_subset_J_residue_ne_zero u hu + (toLocal u) (residue u) (fun S => (↑((c S)⁻¹) : O u)) (c ∅) rfl hodd + have hsum : (residue u) + (∑ S : Finset (PrimeIndex u), (subsetSign S : O u) * + toLocal u (subsetEvaluation u hu S (AddMonoidAlgebra.ofCoeff (BinaryCoefficients.JOver GaussianRing))) * + (↑((c S)⁻¹) : O u)) = + ∑ S : Finset (PrimeIndex u), (residue u) + ((subsetSign S : O u) * + toLocal u (subsetEvaluation u hu S (AddMonoidAlgebra.ofCoeff (BinaryCoefficients.JOver GaussianRing))) * + (↑((c S)⁻¹) : O u)) := + map_sum (residue u).toAddMonoidHom _ _ + rw [hsum] at hnonzero + simpa only [map_mul, map_intCast, mul_assoc] using hnonzero + +end CirculantHadamard.BinaryLocalFamily + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/CirculantHadamard/BinaryLocalRing.lean b/lean/OAI/LinearAlgebra/CirculantHadamard/BinaryLocalRing.lean new file mode 100644 index 0000000000000000000000000000000000000000..c3859de16cc248ba9724f3654566a6d967ea4d14 --- /dev/null +++ b/lean/OAI/LinearAlgebra/CirculantHadamard/BinaryLocalRing.lean @@ -0,0 +1,119 @@ +import OAI.LinearAlgebra.CirculantHadamard.BinaryLocalization +import OAI.LinearAlgebra.CirculantHadamard.CyclotomicRings +import Mathlib.RingTheory.Localization.AsSubring + +namespace OAI + +/-! +# One concrete local ring and residue field + +For the actual cyclotomic coefficient algebra `B u`, choose a maximal ideal +containing two. Both first-order calculations use the same localization and +the same residue field. The choices depend only on `u`, not on a character or +on which of the three norm elements is being considered. +-/ + +noncomputable section + +namespace CirculantHadamard.BinaryLocalRing + +open CyclotomicRings + +def twoIdeal (u : ℕ) : Ideal (B u) := + Classical.choose (BinaryLocalization.exists_maximal_two_mem (B u)) + +instance twoIdeal_isMaximal (u : ℕ) : (twoIdeal u).IsMaximal := + (Classical.choose_spec (BinaryLocalization.exists_maximal_two_mem (B u))).1 + +theorem two_mem (u : ℕ) : (2 : B u) ∈ twoIdeal u := + (Classical.choose_spec (BinaryLocalization.exists_maximal_two_mem (B u))).2 + +abbrev O (u : ℕ) := Localization.AtPrime (twoIdeal u) + +/- Name the canonical localization algebra directly. This avoids searching +through iterated-localization algebra instances for these concrete carriers. -/ +instance local_algebra (u : ℕ) : Algebra (B u) (O u) := + OreLocalization.instAlgebra (R := B u) (R₀ := B u) (S := (twoIdeal u).primeCompl) + +instance fraction_algebra (u : ℕ) : Algebra (B u) (FractionRing (B u)) := + OreLocalization.instAlgebra (R := B u) (R₀ := B u) (S := nonZeroDivisors (B u)) + +abbrev k (u : ℕ) := IsLocalRing.ResidueField (O u) + +def toLocal (u : ℕ) : B u →+* O u := algebraMap (B u) (O u) + +theorem toLocal_injective (u : ℕ) : Function.Injective (toLocal u) := + IsLocalization.injective (O u) (twoIdeal u).primeCompl_le_nonZeroDivisors + +/-- The same localization embeds into the fraction field used for the +alternating products. -/ +def toFraction (u : ℕ) : O u →ₐ[B u] FractionRing (B u) := + Localization.mapToFractionRing (FractionRing (B u)) (twoIdeal u).primeCompl + (O u) (twoIdeal u).primeCompl_le_nonZeroDivisors + +@[simp] theorem toFraction_toLocal (u : ℕ) (x : B u) : + toFraction u (toLocal u x) = algebraMap (B u) (FractionRing (B u)) x := + (toFraction u).commutes x + +theorem toFraction_injective (u : ℕ) : Function.Injective (toFraction u) := by + apply (IsLocalization.injective_iff_map_algebraMap_eq + (twoIdeal u).primeCompl (toFraction u).toRingHom).2 + intro a b + change toLocal u a = toLocal u b ↔ + toFraction u (toLocal u a) = toFraction u (toLocal u b) + rw [toFraction_toLocal, toFraction_toLocal] + constructor + · intro h + exact congrArg (algebraMap (B u) (FractionRing (B u))) (toLocal_injective u h) + · intro h + exact congrArg (toLocal u) (IsFractionRing.injective (B u) (FractionRing (B u)) h) + +instance local_charZero (u : ℕ) : CharZero (O u) where + cast_injective a b hab := by + apply (Nat.cast_injective (R := B u)) + apply toLocal_injective u + simpa only [map_natCast] using hab + +instance residue_charTwo (u : ℕ) : CharP (k u) 2 := + BinaryLocalization.residue_char_two (twoIdeal u) (two_mem u) + +def residue (u : ℕ) : O u →+* k u := IsLocalRing.residue (O u) + +def gaussianToLocal (u : ℕ) : GaussianRing →+* O u := + (toLocal u).comp (gaussianToB u).toRingHom + +def imaginary (u : ℕ) : O u := gaussianToLocal u gaussianI + +theorem imaginary_sq (u : ℕ) : imaginary u ^ 2 = -1 := by + unfold imaginary + rw [← map_pow, gaussianI_sq, map_neg, map_one] + +theorem residue_imaginary (u : ℕ) : residue u (imaginary u) = 1 := + BinaryLocalization.map_i_eq_one (residue u) (imaginary u) (imaginary_sq u) + +theorem two_ne_zero (u : ℕ) : (2 : O u) ≠ 0 := + Nat.cast_ne_zero.mpr (by decide) + +/-- Every one of the actual character norms supplies its own local unit. -/ +theorem norm_isUnit (u : ℕ) (hu : Odd u) (x y : B u) + (hxy : x * y = (u : B u) ^ 2) : IsUnit (toLocal u x) := by + apply BinaryLocalization.isUnit_of_mul_eq_odd_square hu + (y := toLocal u y) + have h := congrArg (toLocal u) hxy + simpa only [map_mul, map_pow, map_natCast] using h + +/-- The unit value is the localized character value, not an unrelated witness. -/ +def normUnit (u : ℕ) (hu : Odd u) (x y : B u) + (hxy : x * y = (u : B u) ^ 2) : (O u)ˣ := + (norm_isUnit u hu x y hxy).unit + +@[simp] theorem normUnit_val (u : ℕ) (hu : Odd u) (x y : B u) + (hxy : x * y = (u : B u) ^ 2) : + (normUnit u hu x y hxy : O u) = toLocal u x := + (norm_isUnit u hu x y hxy).unit_spec + +end CirculantHadamard.BinaryLocalRing + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/CirculantHadamard/BinaryLocalization.lean b/lean/OAI/LinearAlgebra/CirculantHadamard/BinaryLocalization.lean new file mode 100644 index 0000000000000000000000000000000000000000..23324a27ca95ef70cfc7196b7861e155d5bfac47 --- /dev/null +++ b/lean/OAI/LinearAlgebra/CirculantHadamard/BinaryLocalization.lean @@ -0,0 +1,87 @@ +import OAI.LinearAlgebra.CirculantHadamard.LocalizationMaps +import Mathlib.RingTheory.IntegralClosure.Algebra.Basic +import Mathlib.RingTheory.LocalRing.ResidueField.Basic +import Mathlib.Algebra.CharP.Two +import Mathlib.Tactic.Ring +import Mathlib.Tactic.NormNum + +namespace OAI + +universe uB uO uk uF + +/-! +# The characteristic-two local ring for the binary contradiction + +The maximal ideal is constructed from an actual finite characteristic-zero +integer algebra. Unit denominators follow from the odd norm identity, not +from an assumed extension of complex conjugation to a localization. +-/ + +namespace CirculantHadamard.BinaryLocalization + +/-- A finite characteristic-zero integer algebra has a maximal ideal over two. -/ +theorem exists_maximal_two_mem (B : Type uB) [CommRing B] [CharZero B] + [Module.Finite ℤ B] : + ∃ m : Ideal B, m.IsMaximal ∧ (2 : B) ∈ m := by + let : Algebra.IsIntegral ℤ B := Algebra.IsIntegral.of_finite ℤ B + obtain ⟨m, hm, _, htwo⟩ := + exists_maximal_ideal_over_nat_prime_of_charZero B Nat.prime_two + exact ⟨m, hm, htwo⟩ + +/-- The one residue field used by both first-order maps has characteristic two. -/ +theorem residue_char_two {B : Type uB} [CommRing B] (m : Ideal B) [m.IsPrime] + (htwo : (2 : B) ∈ m) : + CharP (IsLocalRing.ResidueField (Localization.AtPrime m)) 2 := by + let O := Localization.AtPrime m + apply CharTwo.of_one_ne_zero_of_two_eq_zero one_ne_zero + have hmem : (2 : O) ∈ IsLocalRing.maximalIdeal O := by + simpa only [map_ofNat] using + (IsLocalization.AtPrime.to_map_mem_maximal_iff O m (2 : B)).mpr htwo + have hz := (IsLocalRing.residue_eq_zero_iff (2 : O)).mpr hmem + simpa only [map_ofNat] using hz + +/-- A square root of minus one reduces to one in a field of characteristic two. -/ +theorem map_i_eq_one {O : Type uO} {k : Type uk} [CommRing O] [Field k] [CharP k 2] + (φ : O →+* k) (i : O) (hi : i ^ 2 = -1) : φ i = 1 := by + have htwo : (2 : k) = 0 := CharTwo.two_eq_zero + have hsquare : (φ i) ^ 2 = -1 := by + simpa using congrArg φ hi + have hsq : (φ i - 1) ^ 2 = 0 := by + calc + (φ i - 1) ^ 2 = (φ i) ^ 2 - 2 * φ i + 1 := by ring + _ = 0 := by rw [hsquare, htwo]; ring + exact sub_eq_zero.mp (eq_zero_of_pow_eq_zero hsq) + +/-- An odd scalar is one in the common characteristic-two residue field. -/ +theorem map_odd_nat_eq_one {O : Type uO} {k : Type uk} [CommRing O] [Field k] [CharP k 2] + (φ : O →+* k) {u : ℕ} (hu : Odd u) : φ (u : O) = 1 := by + rw [map_natCast] + exact natCast_eq_one_of_odd_of_two_eq_zero hu CharTwo.two_eq_zero + +/-- The odd norm supplies a unit without requiring the second factor to be a +conjugation operation on the local ring. -/ +theorem isUnit_of_mul_eq_odd_square {O : Type uO} [CommRing O] [IsLocalRing O] + [CharP (IsLocalRing.ResidueField O) 2] {x y : O} {u : ℕ} + (hu : Odd u) (hxy : x * y = (u : O) ^ 2) : IsUnit x := by + apply (IsLocalRing.residue_ne_zero_iff_isUnit x).mp + intro hx + have h := congrArg (IsLocalRing.residue O) hxy + have hu' := map_odd_nat_eq_one (IsLocalRing.residue O) hu + have hbad : (0 : IsLocalRing.ResidueField O) = 1 := by + simpa only [map_mul, map_pow, hx, zero_mul, hu', one_pow] using h + exact zero_ne_one hbad + +/-- A faithful ring embedding reflects the odd-power witness for an actual unit. -/ +theorem odd_power_of_map {O : Type uO} {F : Type uF} [CommRing O] [CommRing F] + (f : O →+* F) (hf : Function.Injective f) (u : Oˣ) + (h : ∃ m : ℕ, 0 < m ∧ Odd m ∧ (f (u : O)) ^ m = 1) : + ∃ m : ℕ, 0 < m ∧ Odd m ∧ u ^ m = 1 := by + obtain ⟨m, hm, hodd, hpow⟩ := h + refine ⟨m, hm, hodd, ?_⟩ + apply Units.ext + apply hf + simpa only [Units.val_pow_eq_pow_val, Units.val_one, map_pow, map_one] using hpow + +end CirculantHadamard.BinaryLocalization + +end OAI diff --git a/lean/OAI/LinearAlgebra/CirculantHadamard/BinaryNorms.lean b/lean/OAI/LinearAlgebra/CirculantHadamard/BinaryNorms.lean new file mode 100644 index 0000000000000000000000000000000000000000..47b76622ccdb8e2e8e03a6f1cbf39b676d1e6167 --- /dev/null +++ b/lean/OAI/LinearAlgebra/CirculantHadamard/BinaryNorms.lean @@ -0,0 +1,260 @@ +import OAI.LinearAlgebra.CirculantHadamard.CyclicRing +import OAI.LinearAlgebra.CirculantHadamard.BinaryBlocks +import OAI.LinearAlgebra.CirculantHadamard.BinaryCoefficients +import OAI.LinearAlgebra.CirculantHadamard.CyclotomicRings +import Mathlib.Algebra.MonoidAlgebra.Basic +import Mathlib.Tactic.NormNum +import Mathlib.Tactic.Ring + +namespace OAI + +universe uR uA + +/-! +# Cancelling the factor four in the binary norm identities + +The coefficient ring may be a domain; the finite cyclic group algebra is not +assumed to be a domain. Cancellation is performed separately at every +coefficient. In particular these statements apply both to complex coefficients +and to the actual Gaussian subring of `ℂ`. + +`CyclicRing.ringStar` conjugates coefficients as well as reversing exponents. +The evaluation bridge requires compatibility with this full operation, +including at the fourth root `i`; an inversion-only operation would not suffice. +-/ + +noncomputable section + +namespace CirculantHadamard.BinaryNorms + +open CyclicRing + +section CoefficientCancellation + +variable {R : Type uR} [CommRing R] [IsDomain R] [CharZero R] +variable {n : ℕ} + +/-- Cancel four coefficientwise, without any domain assumption on the group +algebra. -/ +theorem four_nsmul_cancel {f g : Elem R n} + (h : (4 : ℕ) • f = (4 : ℕ) • g) : f = g := by + apply AddMonoidAlgebra.coeff_injective + apply Finsupp.ext + intro a + let coeff : Elem R n →+ R := + { toFun := fun p => p.coeff a + map_zero' := rfl + map_add' := fun _ _ => rfl } + have ha := congrArg coeff h + rw [map_nsmul, map_nsmul] at ha + have hc : (4 : R) * f.coeff a = (4 : R) * g.coeff a := by + simp only [coeff, nsmul_eq_mul, Nat.cast_ofNat] at ha + convert ha using 1 + exact mul_left_cancel₀ (by norm_num : (4 : R) ≠ 0) hc + +end CoefficientCancellation + +section NormCancellation + +variable {R : Type uR} [CommRing R] [StarRing R] +variable {n : ℕ} [NeZero n] + +/-- Coefficient conjugation fixes natural scalar multiples. -/ +theorem ringStar_nsmul (k : ℕ) (x : Elem R n) : + ringStar (k • x) = k • ringStar x := by + exact map_nsmul (ringStarRingHom n) k x + +/-- The exact factor four before cancellation; this is valid even when the +coefficient ring itself has zero divisors. -/ +theorem two_nsmul_norm (x : Elem R n) : + ((2 : ℕ) • x) * ringStar ((2 : ℕ) • x) = + (4 : ℕ) • (x * ringStar x) := by + rw [ringStar_nsmul] + simp only [nsmul_eq_mul] + ring + +variable [IsDomain R] [CharZero R] + +theorem norm_of_two_nsmul (u : ℕ) (x : Elem R n) + (h : ((2 : ℕ) • x) * ringStar ((2 : ℕ) • x) = + ((4 * u ^ 2 : ℕ) : Elem R n)) : + x * ringStar x = scalar n ((u ^ 2 : ℕ) : R) := by + rw [scalar_natCast] + apply four_nsmul_cancel + calc + (4 : ℕ) • (x * ringStar x) = + ((2 : ℕ) • x) * ringStar ((2 : ℕ) • x) := + (two_nsmul_norm x).symm + _ = ((4 * u ^ 2 : ℕ) : Elem R n) := h + _ = (4 : ℕ) • ((u ^ 2 : ℕ) : Elem R n) := by + simp only [Nat.cast_mul, nsmul_eq_mul, Nat.cast_ofNat] + +theorem norm_of_evaluation + {A : Type uA} [CommRing A] (sigma : A → A) + (eval : A →+* Elem R n) (u : ℕ) (h : A) (x : Elem R n) + (hnorm : h * sigma h = ((4 * u ^ 2 : ℕ) : A)) + (hstar : eval (sigma h) = ringStar (eval h)) + (hvalue : eval h = (2 : ℕ) • x) : + x * ringStar x = scalar n ((u ^ 2 : ℕ) : R) := by + apply norm_of_two_nsmul u x + rw [← hvalue, ← hstar, ← map_mul, hnorm, map_natCast] + +end NormCancellation + +section ActualBinaryElements + +open BinaryBlocks BinaryCoefficients + +variable {m : ℕ} [NeZero m] + +/-- The partial evaluation uses the same literal coefficient cast as the +constructed Gaussian element. -/ +theorem mappedBlock_intCast {R : Type uR} [CommRing R] + (f : ProductElem ℤ m) (j : ZMod 4) : + mappedBlock m (Int.castRingHom R) f j = + AddMonoidAlgebra.ofCoeff (castCoeffs (block f j).coeff) := by + apply AddMonoidAlgebra.coeff_injective + apply Finsupp.ext + intro a + rfl + +/-- The value at one is twice the actual integral `c`, not a freely chosen +element with a prescribed evaluation. -/ +theorem evaluation_one_eq_two_c (f : ProductElem ℤ m) + (hsign : ∀ a, IsSign (f.coeff a)) : + partialEval m (RingHom.id ℤ) 1 (by simp) f = + (2 : ℕ) • AddMonoidAlgebra.ofCoeff (c (fun j => (blocks f j).coeff)) := by + rw [partialEval_one] + apply AddMonoidAlgebra.coeff_injective + have hv := (two_c (H := fun j => (blocks f j).coeff) (blocks_signs f hsign)).symm + simp only [AddMonoidAlgebra.coeff_add, two_smul, mappedBlock, blocks, block, + RingHom.id_apply] at hv ⊢ + convert hv using 1 + +/-- The value at minus one is twice the actual integral `d`. -/ +theorem evaluation_neg_one_eq_two_d (f : ProductElem ℤ m) + (hsign : ∀ a, IsSign (f.coeff a)) : + partialEval m (RingHom.id ℤ) (-1) (by norm_num) f = + (2 : ℕ) • AddMonoidAlgebra.ofCoeff (d (fun j => (blocks f j).coeff)) := by + rw [partialEval_neg_one] + apply AddMonoidAlgebra.coeff_injective + have hv := (two_d (H := fun j => (blocks f j).coeff) (blocks_signs f hsign)).symm + simp only [AddMonoidAlgebra.coeff_add, AddMonoidAlgebra.coeff_sub, + two_smul, mappedBlock, blocks, block, RingHom.id_apply] at hv ⊢ + convert hv using 1 + +/-- The fourth-root evaluation is twice the constructed Gaussian pair. +The coefficient ring is arbitrary, including the actual Gaussian ring, +without assuming a group-algebra domain. -/ +theorem evaluation_fourthRoot_eq_two_gOver {R : Type uR} [CommRing R] + (i : R) (hi : i ^ 2 = -1) (f : ProductElem ℤ m) + (hsign : ∀ a, IsSign (f.coeff a)) : + partialEval m (Int.castRingHom R) i (fourthRoot_pow_four i hi) f = + (2 : ℕ) • AddMonoidAlgebra.ofCoeff (gOver i (fun j => (blocks f j).coeff)) := by + rw [partialEval_fourthRoot m (Int.castRingHom R) i hi f] + simp only [mappedBlock_intCast] + apply AddMonoidAlgebra.coeff_injective + have hv := (two_gOver i (H := fun j => (blocks f j).coeff) (blocks_signs f hsign)).symm + simp only [AddMonoidAlgebra.coeff_add, AddMonoidAlgebra.coeff_sub, + AddMonoidAlgebra.coeff_smul, two_smul, blocks] at hv ⊢ + convert hv using 1 + +theorem c_norm_of_product_norm (u : ℕ) (f : ProductElem ℤ m) + (hsign : ∀ a, IsSign (f.coeff a)) + (hnorm : f * groupStar f = ((4 * u ^ 2 : ℕ) : ProductElem ℤ m)) : + Mul.mul (α := Elem ℤ m) (AddMonoidAlgebra.ofCoeff (c (fun j => (blocks f j).coeff))) (ringStar (AddMonoidAlgebra.ofCoeff (c (fun j => (blocks f j).coeff)))) = + scalar m ((u ^ 2 : ℕ) : ℤ) := by + exact norm_of_evaluation groupStar + (partialEval m (RingHom.id ℤ) 1 (by simp)) u f (AddMonoidAlgebra.ofCoeff (c (fun j => (blocks f j).coeff))) hnorm + (partialEval_groupStar m (RingHom.id ℤ) 1 (by simp) + (fun _ => by simp) one_character_star f) + (evaluation_one_eq_two_c f hsign) + +/-- The second norm uses the real fourth root `-1` and its genuine star law. -/ +theorem d_norm_of_product_norm (u : ℕ) (f : ProductElem ℤ m) + (hsign : ∀ a, IsSign (f.coeff a)) + (hnorm : f * groupStar f = ((4 * u ^ 2 : ℕ) : ProductElem ℤ m)) : + Mul.mul (α := Elem ℤ m) (AddMonoidAlgebra.ofCoeff (d (fun j => (blocks f j).coeff))) (ringStar (AddMonoidAlgebra.ofCoeff (d (fun j => (blocks f j).coeff)))) = + scalar m ((u ^ 2 : ℕ) : ℤ) := by + exact norm_of_evaluation groupStar + (partialEval m (RingHom.id ℤ) (-1) (by norm_num)) u f (AddMonoidAlgebra.ofCoeff (d (fun j => (blocks f j).coeff))) hnorm + (partialEval_groupStar m (RingHom.id ℤ) (-1) (by norm_num) + (fun _ => by simp) neg_one_character_star f) + (evaluation_neg_one_eq_two_d f hsign) + +/-- The third norm uses conjugation of the fourth root, not exponent reversal +alone. Both the square equation and the conjugation equation are explicit. -/ +theorem gOver_norm_of_product_norm {R : Type uR} [CommRing R] [StarRing R] + [IsDomain R] [CharZero R] (i : R) (hi : i ^ 2 = -1) (hstar : star i = -i) + (u : ℕ) (f : ProductElem ℤ m) (hsign : ∀ a, IsSign (f.coeff a)) + (hnorm : f * groupStar f = ((4 * u ^ 2 : ℕ) : ProductElem ℤ m)) : + Mul.mul (α := Elem R m) (AddMonoidAlgebra.ofCoeff (gOver i (fun j => (blocks f j).coeff))) (ringStar (AddMonoidAlgebra.ofCoeff (gOver i (fun j => (blocks f j).coeff)))) = + scalar m ((u ^ 2 : ℕ) : R) := by + exact norm_of_evaluation groupStar + (partialEval m (Int.castRingHom R) i (fourthRoot_pow_four i hi)) + u f (AddMonoidAlgebra.ofCoeff (gOver i (fun j => (blocks f j).coeff))) hnorm + (partialEval_groupStar m (Int.castRingHom R) i (fourthRoot_pow_four i hi) + (fun _ => by simp) (fourthRoot_character_star i hi hstar) f) + (evaluation_fourthRoot_eq_two_gOver i hi f hsign) + +/-- The same cancellation is valid in `ℂ[C_m]`, despite that ring having zero +divisors. This specializes the actual coefficient construction `g`. -/ +theorem g_norm_of_product_norm (u : ℕ) (f : ProductElem ℤ m) + (hsign : ∀ a, IsSign (f.coeff a)) + (hnorm : f * groupStar f = ((4 * u ^ 2 : ℕ) : ProductElem ℤ m)) : + Mul.mul (α := Elem ℂ m) (AddMonoidAlgebra.ofCoeff (g (fun j => (blocks f j).coeff))) (ringStar (AddMonoidAlgebra.ofCoeff (g (fun j => (blocks f j).coeff)))) = + scalar m ((u ^ 2 : ℕ) : ℂ) := + gOver_norm_of_product_norm Complex.I Complex.I_sq (by simp) u f hsign hnorm + +/-- Conjugation negates the imaginary unit in the actual Gaussian subring. -/ +theorem star_gaussianI : star CyclotomicRings.gaussianI = -CyclotomicRings.gaussianI := by + apply Subtype.ext + change star Complex.I = -Complex.I + simp + +/-- The integral Gaussian norm, before any character evaluation or localization. -/ +theorem gaussian_g_norm_of_product_norm (u : ℕ) (f : ProductElem ℤ m) + (hsign : ∀ a, IsSign (f.coeff a)) + (hnorm : f * groupStar f = ((4 * u ^ 2 : ℕ) : ProductElem ℤ m)) : + Mul.mul (α := Elem CyclotomicRings.GaussianRing m) + (AddMonoidAlgebra.ofCoeff (gOver CyclotomicRings.gaussianI (fun j => (blocks f j).coeff))) + (ringStar (AddMonoidAlgebra.ofCoeff (gOver CyclotomicRings.gaussianI (fun j => (blocks f j).coeff)))) = + scalar m ((u ^ 2 : ℕ) : CyclotomicRings.GaussianRing) := + gOver_norm_of_product_norm CyclotomicRings.gaussianI CyclotomicRings.gaussianI_sq + star_gaussianI u f hsign hnorm + +end ActualBinaryElements + +/-- The complete binary norm step starts from the original cyclic sign row. +The CRT transport, block signs, doubled evaluation values, full-star +compatibility, and scalar cancellation are all proved in the construction. +No separate norm premise for `c`, `d`, or `g` is accepted. -/ +theorem binary_norms_of_cyclic_norm {u : ℕ} [NeZero u] (hu : Odd u) + (f : Elem ℤ (4 * u ^ 2)) (hsign : ∀ a, IsSign (f.coeff a)) + (hnorm : f * ringStar f = scalar (4 * u ^ 2) ((4 * u ^ 2 : ℕ) : ℤ)) : + let H := BinaryBlocks.blocks (BinaryBlocks.crt ℤ u hu f) + Mul.mul (α := Elem ℤ (u ^ 2)) (AddMonoidAlgebra.ofCoeff (BinaryCoefficients.c (fun j => (H j).coeff))) + (ringStar (AddMonoidAlgebra.ofCoeff (BinaryCoefficients.c (fun j => (H j).coeff)))) = + scalar (u ^ 2) ((u ^ 2 : ℕ) : ℤ) ∧ + Mul.mul (α := Elem ℤ (u ^ 2)) (AddMonoidAlgebra.ofCoeff (BinaryCoefficients.d (fun j => (H j).coeff))) + (ringStar (AddMonoidAlgebra.ofCoeff (BinaryCoefficients.d (fun j => (H j).coeff)))) = + scalar (u ^ 2) ((u ^ 2 : ℕ) : ℤ) ∧ + Mul.mul (α := Elem CyclotomicRings.GaussianRing (u ^ 2)) + (AddMonoidAlgebra.ofCoeff (BinaryCoefficients.gOver CyclotomicRings.gaussianI (fun j => (H j).coeff))) + (ringStar (AddMonoidAlgebra.ofCoeff (BinaryCoefficients.gOver CyclotomicRings.gaussianI (fun j => (H j).coeff)))) = + scalar (u ^ 2) ((u ^ 2 : ℕ) : CyclotomicRings.GaussianRing) := by + let F := BinaryBlocks.crt ℤ u hu f + have hs : ∀ a, IsSign (F.coeff a) := by + intro a + simpa only [F, BinaryBlocks.crt_apply] using + hsign ((BinaryBlocks.crtIndex u hu).symm a) + have hn : F * groupStar F = ((4 * u ^ 2 : ℕ) : BinaryBlocks.ProductElem ℤ (u ^ 2)) := + BinaryBlocks.crt_norm hu f (4 * u ^ 2) (by simpa only [scalar_natCast] using hnorm) + exact ⟨c_norm_of_product_norm u F hs hn, d_norm_of_product_norm u F hs hn, + gaussian_g_norm_of_product_norm u F hs hn⟩ + +end CirculantHadamard.BinaryNorms + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/CirculantHadamard/BinaryProductTransport.lean b/lean/OAI/LinearAlgebra/CirculantHadamard/BinaryProductTransport.lean new file mode 100644 index 0000000000000000000000000000000000000000..da0712e0c71dafa90a0a28cfa3ad74136e70987b --- /dev/null +++ b/lean/OAI/LinearAlgebra/CirculantHadamard/BinaryProductTransport.lean @@ -0,0 +1,109 @@ +import OAI.LinearAlgebra.CirculantHadamard.AlternatingProducts +import OAI.LinearAlgebra.CirculantHadamard.BinaryLocalRing +import Mathlib.Algebra.Group.Units.Hom + +namespace OAI + +universe uG uI + +/-! +# Odd-power products in the concrete binary local ring + +The local units are supplied with their actual coefficient-ring values. +Their alternating product maps to the fixed alternating product in the +fraction field. Injectivity transports each exact power identity back to +the local units, with the same exponent. +-/ + +noncomputable section + +namespace CirculantHadamard.BinaryProductTransport + +open CyclotomicRings BinaryLocalRing + +/-- Odd-power torsion is closed under taking a quotient in a commutative +group. The product of the two supplied exponents is an explicit witness. -/ +theorem odd_power_mul_inv {G : Type uG} [CommGroup G] (x y : G) + (hx : ∃ m : ℕ, 0 < m ∧ Odd m ∧ x ^ m = 1) + (hy : ∃ n : ℕ, 0 < n ∧ Odd n ∧ y ^ n = 1) : + ∃ r : ℕ, 0 < r ∧ Odd r ∧ (x * y⁻¹) ^ r = 1 := by + obtain ⟨m, hm, hmOdd, hxm⟩ := hx + obtain ⟨n, hn, hnOdd, hyn⟩ := hy + refine ⟨m * n, Nat.mul_pos hm hn, hmOdd.mul hnOdd, ?_⟩ + have hxmn : x ^ (m * n) = 1 := by rw [pow_mul, hxm, one_pow] + have hymn : y ^ (m * n) = 1 := by rw [Nat.mul_comm m n, pow_mul, hyn, one_pow] + simp only [mul_pow, inv_pow, hxmn, hymn, inv_one, mul_one] + +/-- The actual map from local units to the fraction field of `B u`. -/ +def localUnitToFraction (u : ℕ) : (O u)ˣ →* FractionRing (B u) := + (toFraction u).toRingHom.toMonoidHom.comp (Units.coeHom (O u)) + +@[simp] theorem localUnitToFraction_apply (u : ℕ) (X : (O u)ˣ) : + localUnitToFraction u X = toFraction u (X : O u) := rfl + +theorem localUnitToFraction_injective (u : ℕ) : + Function.Injective (localUnitToFraction u) := by + intro X Y h + apply Units.ext + exact toFraction_injective u h + +/-- Transport of the literal signed subset product, using the supplied +value equality only for subsets that occur in the product. -/ +theorem local_alternatingProduct_toFraction {I : Type uI} (u : ℕ) (t : Finset I) + (x : Finset I → B u) (X : Finset I → (O u)ˣ) + (hX : ∀ S ⊆ t, (X S : O u) = toLocal u (x S)) : + localUnitToFraction u (alternatingProduct t X) = + alternatingProduct t (fun S => algebraMap (B u) (FractionRing (B u)) (x S)) := by + rw [map_alternatingProduct] + apply alternatingProduct_congr + intro S hS + change toFraction u (X S : O u) = _ + rw [hX S hS, toFraction_toLocal] + +/-- An exact fraction-field power identity holds for the actual local +alternating product with precisely the same exponent. -/ +theorem local_alternatingProduct_pow_eq_one {I : Type uI} (u : ℕ) (t : Finset I) + (x : Finset I → B u) (X : Finset I → (O u)ˣ) + (hX : ∀ S ⊆ t, (X S : O u) = toLocal u (x S)) (m : ℕ) + (hpow : (alternatingProduct t + (fun S => algebraMap (B u) (FractionRing (B u)) (x S))) ^ m = 1) : + (alternatingProduct t X) ^ m = 1 := by + apply localUnitToFraction_injective u + rw [map_pow, map_one, local_alternatingProduct_toFraction u t x X hX] + exact hpow + +theorem local_alternatingProduct_has_odd_power {I : Type uI} (u : ℕ) (t : Finset I) + (x : Finset I → B u) (X : Finset I → (O u)ˣ) + (hX : ∀ S ⊆ t, (X S : O u) = toLocal u (x S)) + (hodd : ∃ m : ℕ, 0 < m ∧ Odd m ∧ + (alternatingProduct t + (fun S => algebraMap (B u) (FractionRing (B u)) (x S))) ^ m = 1) : + ∃ m : ℕ, 0 < m ∧ Odd m ∧ (alternatingProduct t X) ^ m = 1 := by + obtain ⟨m, hm, hmOdd, hpow⟩ := hodd + exact ⟨m, hm, hmOdd, local_alternatingProduct_pow_eq_one u t x X hX m hpow⟩ + +/-- The two concrete unit families produce an odd-power quotient family. +No torsion of individual factors is assumed or inferred. -/ +theorem local_alternatingProduct_ratio_has_odd_power {I : Type uI} + (u : ℕ) (t : Finset I) (x y : Finset I → B u) + (X Y : Finset I → (O u)ˣ) + (hX : ∀ S ⊆ t, (X S : O u) = toLocal u (x S)) + (hY : ∀ S ⊆ t, (Y S : O u) = toLocal u (y S)) + (hx : ∃ m : ℕ, 0 < m ∧ Odd m ∧ + (alternatingProduct t + (fun S => algebraMap (B u) (FractionRing (B u)) (x S))) ^ m = 1) + (hy : ∃ m : ℕ, 0 < m ∧ Odd m ∧ + (alternatingProduct t + (fun S => algebraMap (B u) (FractionRing (B u)) (y S))) ^ m = 1) : + ∃ m : ℕ, 0 < m ∧ Odd m ∧ + (alternatingProduct t (fun S => X S * (Y S)⁻¹)) ^ m = 1 := by + simpa only [alternatingProduct_mul, alternatingProduct_inv] using + odd_power_mul_inv (alternatingProduct t X) (alternatingProduct t Y) + (local_alternatingProduct_has_odd_power u t x X hX hx) + (local_alternatingProduct_has_odd_power u t y Y hY hy) + +end CirculantHadamard.BinaryProductTransport + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/CirculantHadamard/BinaryResidue.lean b/lean/OAI/LinearAlgebra/CirculantHadamard/BinaryResidue.lean new file mode 100644 index 0000000000000000000000000000000000000000..0f98fea6925fbb6bc1f464ca4481b5480dc809e2 --- /dev/null +++ b/lean/OAI/LinearAlgebra/CirculantHadamard/BinaryResidue.lean @@ -0,0 +1,204 @@ +import OAI.LinearAlgebra.CirculantHadamard.FirstOrderResidue +import OAI.LinearAlgebra.CirculantHadamard.ResidueTorsion +import Mathlib.Algebra.CharP.Two +import Mathlib.Algebra.Group.Units.Hom +import Mathlib.Tactic.Ring + +namespace OAI + +universe uO uk uIota + +namespace CirculantHadamard + +open scoped BigOperators + +variable {O : Type uO} [CommRing O] + +/-- The coefficient of the ratio `d / c` along `2`. Division by `c` means +multiplication by the inverse of the supplied unit. -/ +def binaryLr (c : Oˣ) (b : O) : O := + -b * (↑(c⁻¹) : O) + +/-- The coefficient of the ratio `g / c` along `1 + i`. -/ +def binaryLw (c : Oˣ) (i b J U : O) : O := + i * b * (↑(c⁻¹) : O) - J * (↑(c⁻¹) : O) - + (1 - i) * U * (↑(c⁻¹) : O) + +theorem binary_ratio_r (c d : Oˣ) (a b : O) + (hc : (c : O) = a + b) (hd : (d : O) = a - b) : + ((d * c⁻¹ : Oˣ) : O) = 1 + (2 : O) * binaryLr c b := by + have hc' : (a + b) * (↑(c⁻¹) : O) = 1 := by + rw [← hc] + exact c.mul_inv + calc + ((d * c⁻¹ : Oˣ) : O) = + (a + b) * (↑(c⁻¹) : O) + 2 * (-b * (↑(c⁻¹) : O)) := by + change (d : O) * (↑(c⁻¹) : O) = _ + rw [hd] + ring + _ = 1 + (2 : O) * binaryLr c b := by rw [hc']; rfl + +theorem binary_ratio_w (c g : Oˣ) (a b J U i : O) + (hc : (c : O) = a + b) + (hg : (g : O) = a + i * b - ((1 + i) * J + 2 * U)) + (hi : i ^ 2 = -1) : + ((g * c⁻¹ : Oˣ) : O) = 1 + (1 + i) * binaryLw c i b J U := by + have hc' : (a + b) * (↑(c⁻¹) : O) = 1 := by + rw [← hc] + exact c.mul_inv + have hi' : i * i = -1 := by simpa only [pow_two] using hi + calc + ((g * c⁻¹ : Oˣ) : O) = + (a + b) * (↑(c⁻¹) : O) + (1 + i) * binaryLw c i b J U - + (i * i + 1) * (b + U) * (↑(c⁻¹) : O) := by + change (g : O) * (↑(c⁻¹) : O) = _ + rw [hg] + unfold binaryLw + ring + _ = 1 + (1 + i) * binaryLw c i b J U := by rw [hc', hi']; ring + +/-- This identity is exact before applying the residue map. -/ +theorem binaryLr_add_binaryLw (c : Oˣ) (i b J U : O) : + binaryLr c b + binaryLw c i b J U = + -J * (↑(c⁻¹) : O) - (1 - i) * (b + U) * (↑(c⁻¹) : O) := by + unfold binaryLr binaryLw + ring + +/-- Nonvanishing of `2` also makes the second first-order parameter nonzero. -/ +theorem binary_one_add_i_ne_zero (i : O) (hi : i ^ 2 = -1) + (h2 : (2 : O) ≠ 0) : 1 + i ≠ 0 := by + have hi' : i * i = -1 := by simpa only [pow_two] using hi + have hfactor : (1 + i) * (1 - i) = (2 : O) := by + calc + (1 + i) * (1 - i) = 1 - i * i := by ring + _ = 2 := by rw [hi']; ring + intro hzero + apply h2 + rw [← hfactor, hzero, zero_mul] + +section Domain + +variable [IsDomain O] + +/-- The displayed coefficient is the unique coefficient along `2`. -/ +theorem binaryLr_unique (c d : Oˣ) (a b L : O) + (hc : (c : O) = a + b) (hd : (d : O) = a - b) + (h2 : (2 : O) ≠ 0) + (hL : ((d * c⁻¹ : Oˣ) : O) = 1 + (2 : O) * L) : + L = binaryLr c b := by + apply mul_left_cancel₀ h2 + exact add_left_cancel (hL.symm.trans (binary_ratio_r c d a b hc hd)) + +/-- The displayed coefficient is the unique coefficient along `1 + i`. -/ +theorem binaryLw_unique (c g : Oˣ) (a b J U i L : O) + (hc : (c : O) = a + b) + (hg : (g : O) = a + i * b - ((1 + i) * J + 2 * U)) + (hi : i ^ 2 = -1) (h2 : (2 : O) ≠ 0) + (hL : ((g * c⁻¹ : Oˣ) : O) = 1 + (1 + i) * L) : + L = binaryLw c i b J U := by + apply mul_left_cancel₀ (binary_one_add_i_ne_zero i hi h2) + exact add_left_cancel (hL.symm.trans (binary_ratio_w c g a b J U i hc hg hi)) + +end Domain + +section Residue + +variable {k : Type uk} [Field k] [charTwo : CharP k 2] + +/-- The two coefficients have residues summing to the residue of `J / c`. -/ +theorem binary_residue_sum (φ : O →+* k) (c : Oˣ) (i b J U : O) + (hi : φ i = 1) : + φ (binaryLr c b) + φ (binaryLw c i b J U) = + φ (J * (↑(c⁻¹) : O)) := by + rw [← map_add, binaryLr_add_binaryLw] + simp [hi, CharTwo.neg_eq] + +omit charTwo in +/-- A signed product of units with residue one again has residue one. +The powers are formed in the unit group, including for negative exponents. -/ +theorem binary_signed_product_residue_one [CharP k 2] {ι : Type uIota} + (φ : O →+* k) (s : Finset ι) (u : ι → Oˣ) (ε : ι → ℤ) + (hu : ∀ j ∈ s, φ (u j : O) = 1) : + φ ((∏ j ∈ s, (u j) ^ (ε j) : Oˣ) : O) = 1 := by + let f : Oˣ →* kˣ := Units.map φ.toMonoidHom + have hf (j : ι) (hj : j ∈ s) : f (u j) = 1 := by + apply Units.ext + change φ (u j : O) = 1 + exact hu j hj + have hp : f (∏ j ∈ s, (u j) ^ (ε j)) = 1 := by + rw [map_prod] + apply Finset.prod_eq_one + intro j hj + rw [map_zpow, hf j hj, one_zpow] + have hval := congrArg (fun z : kˣ => (z : k)) hp + change φ ((∏ j ∈ s, (u j) ^ (ε j) : Oˣ) : O) = 1 at hval + exact hval + +variable [IsDomain O] + +/-- The same-residue-field contradiction for a finite signed family of +binary decompositions. All arithmetic input to the concrete application is +explicit: unit decompositions, a square root of `-1`, odd torsion of both +signed products, and a nonzero signed `J / c` residue sum. -/ +theorem binary_residue_contradiction {ι : Type uIota} + (φ : O →+* k) (i : O) (hi : i ^ 2 = -1) (hφi : φ i = 1) + (h2 : (2 : O) ≠ 0) (s : Finset ι) (ε : ι → ℤ) + (c d g : ι → Oˣ) (a b J U : ι → O) + (hc : ∀ j ∈ s, (c j : O) = a j + b j) + (hd : ∀ j ∈ s, (d j : O) = a j - b j) + (hg : ∀ j ∈ s, + (g j : O) = a j + i * b j - ((1 + i) * J j + 2 * U j)) + (hrOdd : ∃ m : ℕ, 0 < m ∧ Odd m ∧ + (∏ j ∈ s, (d j * (c j)⁻¹) ^ (ε j)) ^ m = 1) + (hwOdd : ∃ m : ℕ, 0 < m ∧ Odd m ∧ + (∏ j ∈ s, (g j * (c j)⁻¹) ^ (ε j)) ^ m = 1) + (hnonzero : (∑ j ∈ s, (ε j : k) * φ (J j * (↑((c j)⁻¹) : O))) ≠ 0) : + False := by + have hφ2 : φ (2 : O) = 0 := by + calc + φ (2 : O) = φ (1 + 1) := by congr 1; ring + _ = (1 : k) + 1 := by simp only [map_add, map_one] + _ = 0 := CharTwo.add_self_eq_zero 1 + have hφpi : φ (1 + i) = 0 := by + rw [map_add, map_one, hφi] + exact CharTwo.add_self_eq_zero 1 + have hr (j : ι) (hj : j ∈ s) : + ((d j * (c j)⁻¹ : Oˣ) : O) = 1 + (2 : O) * binaryLr (c j) (b j) := + binary_ratio_r (c j) (d j) (a j) (b j) (hc j hj) (hd j hj) + have hw (j : ι) (hj : j ∈ s) : + ((g j * (c j)⁻¹ : Oˣ) : O) = + 1 + (1 + i) * binaryLw (c j) i (b j) (J j) (U j) := + binary_ratio_w (c j) (g j) (a j) (b j) (J j) (U j) i (hc j hj) (hg j hj) hi + have hrMap (j : ι) (hj : j ∈ s) : φ ((d j * (c j)⁻¹ : Oˣ) : O) = 1 := by + rw [hr j hj, map_add, map_one, map_mul, hφ2, zero_mul, add_zero] + have hwMap (j : ι) (hj : j ∈ s) : φ ((g j * (c j)⁻¹ : Oˣ) : O) = 1 := by + rw [hw j hj, map_add, map_one, map_mul, hφpi, zero_mul, add_zero] + have hrOne : (∏ j ∈ s, (d j * (c j)⁻¹) ^ (ε j)) = 1 := + units_eq_one_of_residue_one_of_odd φ _ + (binary_signed_product_residue_one φ s (fun j => d j * (c j)⁻¹) ε hrMap) hrOdd + have hwOne : (∏ j ∈ s, (g j * (c j)⁻¹) ^ (ε j)) = 1 := + units_eq_one_of_residue_one_of_odd φ _ + (binary_signed_product_residue_one φ s (fun j => g j * (c j)⁻¹) ε hwMap) hwOdd + have hrSum := first_order_sum_eq_zero_of_prod_eq_one φ (2 : O) h2 hφ2 s + (fun j => d j * (c j)⁻¹) (fun j => binaryLr (c j) (b j)) ε hr hrOne + have hwSum := first_order_sum_eq_zero_of_prod_eq_one φ (1 + i) + (binary_one_add_i_ne_zero i hi h2) hφpi s + (fun j => g j * (c j)⁻¹) (fun j => binaryLw (c j) i (b j) (J j) (U j)) ε hw hwOne + apply hnonzero + calc + (∑ j ∈ s, (ε j : k) * φ (J j * (↑((c j)⁻¹) : O))) = + ∑ j ∈ s, ((ε j : k) * φ (binaryLr (c j) (b j)) + + (ε j : k) * φ (binaryLw (c j) i (b j) (J j) (U j))) := by + apply Finset.sum_congr rfl + intro j hj + rw [← mul_add, binary_residue_sum φ (c j) i (b j) (J j) (U j) hφi] + _ = (∑ j ∈ s, (ε j : k) * φ (binaryLr (c j) (b j))) + + ∑ j ∈ s, (ε j : k) * φ (binaryLw (c j) i (b j) (J j) (U j)) := + Finset.sum_add_distrib + _ = 0 := by rw [hrSum, hwSum, add_zero] + +end Residue + +end CirculantHadamard + +end OAI diff --git a/lean/OAI/LinearAlgebra/CirculantHadamard/CoefficientEvaluation.lean b/lean/OAI/LinearAlgebra/CirculantHadamard/CoefficientEvaluation.lean new file mode 100644 index 0000000000000000000000000000000000000000..df746235cb15a2e290c1efd8feb1ee3a3e4216b0 --- /dev/null +++ b/lean/OAI/LinearAlgebra/CirculantHadamard/CoefficientEvaluation.lean @@ -0,0 +1,70 @@ +import OAI.LinearAlgebra.CirculantHadamard.PrimeCharacterEvaluations + +namespace OAI + +universe uR uS uT + +/-! +# Changing coefficients in an actual cyclic group ring + +The group coordinate is retained unchanged. Character evaluation and augmentation +commute with this coefficient map, including localization of the away ring. +-/ + +noncomputable section + +namespace CirculantHadamard.CyclicRing + +open PrimeCharacterEvaluations + +variable {R : Type uR} {S : Type uS} {T : Type uT} [Semiring R] [CommSemiring S] [CommSemiring T] + +/-- Map coefficients and retain the same cyclic basis. -/ +def coefficientMap (φ : R →+* S) (n : ℕ) : Elem R n →+* Elem S n := + weightedProjection φ (AddMonoidHom.id (ZMod n)) 1 + +@[simp] theorem coefficientMap_single (φ : R →+* S) (n : ℕ) + (a : ZMod n) (r : R) : + coefficientMap φ n (AddMonoidAlgebra.single a r) = + AddMonoidAlgebra.single a (φ r) := by + simp [coefficientMap, weightedProjection_single] + +@[simp] theorem coefficientMap_scalar (φ : R →+* S) (n : ℕ) (r : R) : + coefficientMap φ n (scalar n r) = scalar n (φ r) := + weightedProjection_scalar φ (AddMonoidHom.id (ZMod n)) 1 r + +/-- Bundled naturality; no root-of-unity or nonzero-modulus premise is needed. -/ +theorem evaluate_coefficientMap_hom (φ : R →+* S) (ψ : S →+* T) (n : ℕ) + (χ : Multiplicative (ZMod n) →* T) : + (evaluate ψ χ).comp (coefficientMap φ n) = evaluate (ψ.comp φ) χ := by + apply AddMonoidAlgebra.ringHom_ext + · intro r + simp only [RingHom.comp_apply, coefficientMap_single, evaluate_single] + · intro a + simp only [RingHom.comp_apply, coefficientMap_single, evaluate_single] + +theorem evaluate_coefficientMap (φ : R →+* S) (ψ : S →+* T) {n : ℕ} + (χ : Multiplicative (ZMod n) →* T) (F : Elem R n) : + evaluate ψ χ (coefficientMap φ n F) = evaluate (ψ.comp φ) χ F := + congrArg (fun f : Elem R n →+* T => f F) (evaluate_coefficientMap_hom φ ψ n χ) + +@[simp] theorem augmentation_coefficientMap (φ : R →+* S) (n : ℕ) [NeZero n] + (F : Elem R n) : + augmentation n (coefficientMap φ n F) = φ (augmentation n F) := by + calc + augmentation n (coefficientMap φ n F) = + evaluate (RingHom.id S) (1 : Multiplicative (ZMod n) →* S) + (coefficientMap φ n F) := by + simpa only [RingHom.id_apply] using + (evaluate_trivial_eq_augmentation (R := S) (S := S) (n := n) + (RingHom.id S) (coefficientMap φ n F)).symm + _ = evaluate ((RingHom.id S).comp φ) (1 : Multiplicative (ZMod n) →* S) F := + evaluate_coefficientMap φ (RingHom.id S) 1 F + _ = φ (augmentation n F) := by + simpa only [RingHom.id_comp] using evaluate_trivial_eq_augmentation φ F + +end CirculantHadamard.CyclicRing + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/CirculantHadamard/CyclicEvaluation.lean b/lean/OAI/LinearAlgebra/CirculantHadamard/CyclicEvaluation.lean new file mode 100644 index 0000000000000000000000000000000000000000..75a56392b7ee4531e9bbc2811338fa2d50bee07d --- /dev/null +++ b/lean/OAI/LinearAlgebra/CirculantHadamard/CyclicEvaluation.lean @@ -0,0 +1,136 @@ +import OAI.LinearAlgebra.CirculantHadamard.CyclicRing + +namespace OAI + +universe uR uS uT uA + +/-! +# Evaluation of the finite cyclic group ring + +Evaluation is a ring homomorphism obtained from a coefficient homomorphism and +an actual character of the cyclic group. Its compatibility with the group-ring +involution is proved from the coefficient and character identities. +-/ + +noncomputable section + +namespace CirculantHadamard.CyclicRing + +open scoped BigOperators + +variable {R : Type uR} {S : Type uS} {T : Type uT} [Semiring R] [CommSemiring S] [CommSemiring T] +variable {n : ℕ} + +/-- Evaluation at a multiplicative character of the additive cyclic group. -/ +def evaluate (φ : R →+* S) (χ : Multiplicative (ZMod n) →* S) : Elem R n →+* S := + AddMonoidAlgebra.liftNCRingHom φ χ (fun _ _ => Commute.all _ _) + +@[simp] theorem evaluate_single (φ : R →+* S) + (χ : Multiplicative (ZMod n) →* S) (a : ZMod n) (r : R) : + evaluate φ χ (AddMonoidAlgebra.single a r) = φ r * χ (Multiplicative.ofAdd a) := + AddMonoidAlgebra.liftNC_single _ _ _ _ + +@[simp] theorem evaluate_scalar (φ : R →+* S) + (χ : Multiplicative (ZMod n) →* S) (r : R) : + evaluate φ χ (scalar n r) = φ r := by + simp only [scalar, evaluate_single] + change φ r * χ 1 = φ r + simp + +/-- The full finite sum, rather than a sum over an unspecified support. -/ +theorem evaluate_apply [NeZero n] (φ : R →+* S) + (χ : Multiplicative (ZMod n) →* S) (f : Elem R n) : + evaluate φ χ f = ∑ a : ZMod n, φ (f.coeff a) * χ (Multiplicative.ofAdd a) := by + change f.coeff.sum (fun a r => φ r * χ (Multiplicative.ofAdd a)) = _ + exact Finsupp.sum_fintype f.coeff _ (fun _ => by simp) + +@[simp] theorem evaluate_ofCoeffs [NeZero n] (φ : R →+* S) + (χ : Multiplicative (ZMod n) →* S) (c : ZMod n → R) : + evaluate φ χ (ofCoeffs c) = ∑ a : ZMod n, φ (c a) * χ (Multiplicative.ofAdd a) := + evaluate_apply φ χ (ofCoeffs c) + +/-- The trivial character recovers augmentation followed by the coefficient map. -/ +theorem evaluate_trivial_eq_augmentation [NeZero n] (φ : R →+* S) + (f : Elem R n) : + evaluate φ (1 : Multiplicative (ZMod n) →* S) f = φ (augmentation n f) := by + simp [evaluate_apply, augmentation_apply, map_sum] + +/-- Evaluation commutes with a change of target coefficient ring. -/ +theorem map_evaluate [NeZero n] (φ : R →+* S) + (χ : Multiplicative (ZMod n) →* S) (ψ : S →+* T) (f : Elem R n) : + ψ (evaluate φ χ f) = evaluate (ψ.comp φ) (ψ.toMonoidHom.comp χ) f := by + rw [evaluate_apply, evaluate_apply, map_sum] + apply Finset.sum_congr rfl + intro a _ + exact map_mul ψ (φ (f.coeff a)) (χ (Multiplicative.ofAdd a)) + +/-- Bundled naturality of character evaluation. -/ +theorem map_evaluate_hom [NeZero n] (φ : R →+* S) + (χ : Multiplicative (ZMod n) →* S) (ψ : S →+* T) : + ψ.comp (evaluate φ χ) = evaluate (ψ.comp φ) (ψ.toMonoidHom.comp χ) := by + apply RingHom.ext + intro f + exact map_evaluate φ χ ψ f + +/-- A target endomorphism intertwines evaluation and the full group-ring star +when it intertwines the coefficient involution and character inversion. -/ +theorem evaluate_ringStar_intertwining [StarRing R] [NeZero n] + (φ : R →+* S) (χ : Multiplicative (ZMod n) →* S) (τ : S →+* S) + (hφ : ∀ r, φ (star r) = τ (φ r)) + (hχ : ∀ a : ZMod n, + χ (Multiplicative.ofAdd (-a)) = τ (χ (Multiplicative.ofAdd a))) + (f : Elem R n) : + evaluate φ χ (ringStar f) = τ (evaluate φ χ f) := by + rw [evaluate_apply, evaluate_apply, map_sum] + refine Fintype.sum_equiv (Equiv.neg (ZMod n)) _ _ ?_ + intro a + simp only [ringStar_apply, Equiv.neg_apply, map_mul, hφ] + rw [← hχ] + simp only [neg_neg] + +/-- Character evaluation carries the full group-ring involution to target star. -/ +theorem evaluate_ringStar [StarRing R] [StarRing S] [NeZero n] + (φ : R →+* S) (χ : Multiplicative (ZMod n) →* S) + (hφ : ∀ r, φ (star r) = star (φ r)) + (hχ : ∀ a : ZMod n, + χ (Multiplicative.ofAdd (-a)) = star (χ (Multiplicative.ofAdd a))) + (f : Elem R n) : + evaluate φ χ (ringStar f) = star (evaluate φ χ f) := + evaluate_ringStar_intertwining φ χ (starRingEnd S) hφ hχ f + +/-- The group-ring norm product becomes the usual star norm product. -/ +theorem evaluate_mul_ringStar [StarRing R] [StarRing S] [NeZero n] + (φ : R →+* S) (χ : Multiplicative (ZMod n) →* S) + (hφ : ∀ r, φ (star r) = star (φ r)) + (hχ : ∀ a : ZMod n, + χ (Multiplicative.ofAdd (-a)) = star (χ (Multiplicative.ofAdd a))) + (f : Elem R n) : + evaluate φ χ (f * ringStar f) = evaluate φ χ f * star (evaluate φ χ f) := by + rw [map_mul, evaluate_ringStar φ χ hφ hχ] + +/-- A proved scalar group-ring norm equation transfers to every compatible +character; the norm equation is not built into the evaluation definition. -/ +theorem evaluate_norm_eq [StarRing R] [StarRing S] [NeZero n] + (φ : R →+* S) (χ : Multiplicative (ZMod n) →* S) + (hφ : ∀ r, φ (star r) = star (φ r)) + (hχ : ∀ a : ZMod n, + χ (Multiplicative.ofAdd (-a)) = star (χ (Multiplicative.ofAdd a))) + (f : Elem R n) (r : R) (hf : f * ringStar f = scalar n r) : + evaluate φ χ f * star (evaluate φ χ f) = φ r := by + rw [← evaluate_mul_ringStar φ χ hφ hχ, hf, evaluate_scalar] + +/-- For integer coefficients, coefficient-star compatibility is automatic. -/ +theorem evaluate_int_ringStar {A : Type uA} [CommRing A] [StarRing A] [NeZero n] + (χ : Multiplicative (ZMod n) →* A) + (hχ : ∀ a : ZMod n, + χ (Multiplicative.ofAdd (-a)) = star (χ (Multiplicative.ofAdd a))) + (f : Elem ℤ n) : + evaluate (Int.castRingHom A) χ (ringStar f) = + star (evaluate (Int.castRingHom A) χ f) := by + exact evaluate_ringStar (Int.castRingHom A) χ (fun r => by simp) hχ f + +end CirculantHadamard.CyclicRing + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/CirculantHadamard/CyclicEvaluationAt.lean b/lean/OAI/LinearAlgebra/CirculantHadamard/CyclicEvaluationAt.lean new file mode 100644 index 0000000000000000000000000000000000000000..e1b5478e6744420fa1262b03a091ff8e3378fb84 --- /dev/null +++ b/lean/OAI/LinearAlgebra/CirculantHadamard/CyclicEvaluationAt.lean @@ -0,0 +1,116 @@ +import OAI.LinearAlgebra.CirculantHadamard.CyclicEvaluation +import OAI.LinearAlgebra.CirculantHadamard.CyclicPolynomial + +namespace OAI + +universe uA uS uT + +/-! +# Evaluation at an actual root of unity + +The algebra map factors through the proved polynomial presentation of the +cyclic group ring and the universal property of `AdjoinRoot (X ^ n - 1)`. +-/ + +noncomputable section + +namespace CirculantHadamard.CyclicRing + +open Polynomial +open scoped BigOperators + +variable {A : Type uA} {S : Type uS} {T : Type uT} [CommRing A] [CommRing S] [CommRing T] +variable [Algebra A S] [Algebra A T] + +/-- Evaluate the polynomial quotient at a proved `n`th root of unity. -/ +def evaluateAt (n : ℕ) [NeZero n] (x : S) (hx : x ^ n = 1) : Elem A n →ₐ[A] S := + (AdjoinRoot.liftAlgHom (CyclicPolynomial.relation A n) (Algebra.ofId A S) x + (by simp [CyclicPolynomial.relation, hx])).comp + (CyclicPolynomial.cyclicEquiv A n).toAlgHom + +@[simp] theorem evaluateAt_single (n : ℕ) [NeZero n] (x : S) (hx : x ^ n = 1) + (a : ZMod n) (r : A) : + evaluateAt n x hx (AddMonoidAlgebra.single a r) = algebraMap A S r * x ^ a.val := by + change (AdjoinRoot.liftAlgHom (CyclicPolynomial.relation A n) (Algebra.ofId A S) x + (by simp [CyclicPolynomial.relation, hx])) + (CyclicPolynomial.cyclicEquiv A n (AddMonoidAlgebra.single a r)) = _ + rw [CyclicPolynomial.cyclicEquiv_single, map_mul, map_pow, AlgHom.commutes, + AdjoinRoot.liftAlgHom_root (CyclicPolynomial.relation A n) (Algebra.ofId A S) x + (by simp [CyclicPolynomial.relation, hx])] + +@[simp] theorem evaluateAt_scalar (n : ℕ) [NeZero n] (x : S) (hx : x ^ n = 1) + (r : A) : evaluateAt n x hx (scalar n r) = algebraMap A S r := by + simp [scalar] + +@[simp] theorem evaluateAt_generator (n : ℕ) [NeZero n] (x : S) (hx : x ^ n = 1) : + evaluateAt (A := A) n x hx (CyclicPolynomial.generator A n) = x := by + change (AdjoinRoot.liftAlgHom (CyclicPolynomial.relation A n) (Algebra.ofId A S) x + (by simp [CyclicPolynomial.relation, hx])) + (CyclicPolynomial.cyclicEquiv A n (CyclicPolynomial.generator A n)) = x + rw [CyclicPolynomial.cyclicEquiv_generator] + exact AdjoinRoot.liftAlgHom_root (CyclicPolynomial.relation A n) (Algebra.ofId A S) x + (by simp [CyclicPolynomial.relation, hx]) + +/-- Evaluation agrees with evaluation of every polynomial in the cyclic generator. -/ +@[simp] theorem evaluateAt_aeval (n : ℕ) [NeZero n] (x : S) (hx : x ^ n = 1) + (p : A[X]) : + evaluateAt n x hx (aeval (CyclicPolynomial.generator A n) p) = aeval x p := by + change (AdjoinRoot.liftAlgHom (CyclicPolynomial.relation A n) (Algebra.ofId A S) x + (by simp [CyclicPolynomial.relation, hx])) + (CyclicPolynomial.cyclicEquiv A n (aeval (CyclicPolynomial.generator A n) p)) = _ + rw [CyclicPolynomial.cyclicEquiv_aeval] + exact AdjoinRoot.liftAlgHom_mk (CyclicPolynomial.relation A n) (Algebra.ofId A S) x + (by simp [CyclicPolynomial.relation, hx]) p + +/-- The quotient construction and the finite-character construction are the same +ring homomorphism. -/ +theorem evaluateAt_eq_evaluate (n : ℕ) [NeZero n] (x : S) (hx : x ^ n = 1) : + (evaluateAt (A := A) n x hx).toRingHom = + evaluate (algebraMap A S) (CyclicPolynomial.powerCharacter n x hx) := by + apply AddMonoidAlgebra.ringHom_ext + · intro r + simp [evaluateAt_single] + · intro a + simp [evaluateAt_single, CyclicPolynomial.powerCharacter_apply] + +theorem evaluateAt_apply (n : ℕ) [NeZero n] (x : S) (hx : x ^ n = 1) + (f : Elem A n) : + evaluateAt n x hx f = ∑ a : ZMod n, algebraMap A S (f.coeff a) * x ^ a.val := by + change (evaluateAt n x hx).toRingHom f = _ + rw [evaluateAt_eq_evaluate, evaluate_apply] + rfl + +/-- Evaluation at one is the actual augmentation followed by the coefficient map. -/ +@[simp] theorem evaluateAt_one (n : ℕ) [NeZero n] (f : Elem A n) : + evaluateAt n (1 : S) (one_pow n) f = algebraMap A S (augmentation n f) := by + simp [evaluateAt_apply, augmentation_apply, map_sum] + +/-- Naturality under an algebra homomorphism that sends the chosen root to the +chosen target root. Both root equations remain explicit proved hypotheses. -/ +theorem map_evaluateAt_hom (n : ℕ) [NeZero n] + (x : S) (hx : x ^ n = 1) (y : T) (hy : y ^ n = 1) + (ψ : S →ₐ[A] T) (hxy : ψ x = y) : + ψ.comp (evaluateAt n x hx) = evaluateAt n y hy := by + apply AddMonoidAlgebra.algHom_ext + · intro a + simp [AlgHom.comp_apply, evaluateAt_single, hxy] + · exact Subsingleton.elim _ _ + +theorem map_evaluateAt (n : ℕ) [NeZero n] + (x : S) (hx : x ^ n = 1) (y : T) (hy : y ^ n = 1) + (ψ : S →ₐ[A] T) (hxy : ψ x = y) (f : Elem A n) : + ψ (evaluateAt n x hx f) = evaluateAt n y hy f := + DFunLike.congr_fun (map_evaluateAt_hom n x hx y hy ψ hxy) f + +/-- In particular, a residue map sending the root to one sends evaluation to +the residue of augmentation. -/ +theorem map_evaluateAt_of_map_eq_one (n : ℕ) [NeZero n] + (x : S) (hx : x ^ n = 1) (ψ : S →ₐ[A] T) (hx1 : ψ x = 1) (f : Elem A n) : + ψ (evaluateAt n x hx f) = algebraMap A T (augmentation n f) := by + rw [map_evaluateAt n x hx 1 (one_pow n) ψ hx1, evaluateAt_one] + +end CirculantHadamard.CyclicRing + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/CirculantHadamard/CyclicEvaluationProjection.lean b/lean/OAI/LinearAlgebra/CirculantHadamard/CyclicEvaluationProjection.lean new file mode 100644 index 0000000000000000000000000000000000000000..abd8a3ec34ba01e83c84589a39e7e9aab65c0ae5 --- /dev/null +++ b/lean/OAI/LinearAlgebra/CirculantHadamard/CyclicEvaluationProjection.lean @@ -0,0 +1,39 @@ +import OAI.LinearAlgebra.CirculantHadamard.CyclicProjection +import OAI.LinearAlgebra.CirculantHadamard.CyclicEvaluationAt + +namespace OAI + +universe uR uS + +/-! Evaluation at a root of smaller order factors through the cyclic quotient. -/ + +noncomputable section + +namespace CirculantHadamard + +open CyclicRing + +variable {R : Type uR} {S : Type uS} [CommRing R] [CommRing S] [Algebra R S] +variable {m n : ℕ} [NeZero m] [NeZero n] + +/-- The actual root evaluation is unchanged after reducing the cyclic index. +Both root equations are stated explicitly to match the two evaluation maps. -/ +theorem evaluateAt_cyclicProjection (h : m ∣ n) + (x : S) (hm : x ^ m = 1) (hn : x ^ n = 1) (F : Elem R n) : + evaluateAt m x hm (cyclicProjection R h F) = evaluateAt n x hn F := by + refine AddMonoidAlgebra.induction_linear F ?_ ?_ ?_ + · simp + · intro F G hF hG + change evaluateAt m x hm (cyclicProjection R h ((F : Elem R n) + G)) = + evaluateAt n x hn ((F : Elem R n) + G) + simp only [map_add, hF, hG] + · intro a r + simp only [cyclicProjection_single, evaluateAt_single] + rw [ZMod.castHom_apply, ZMod.cast_eq_val, ZMod.val_natCast] + rw [← pow_eq_pow_mod _ hm] + +end CirculantHadamard + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/CirculantHadamard/CyclicNorm.lean b/lean/OAI/LinearAlgebra/CirculantHadamard/CyclicNorm.lean new file mode 100644 index 0000000000000000000000000000000000000000..211f179188ff8fb417c584eaeaea26d2dc7ebda7 --- /dev/null +++ b/lean/OAI/LinearAlgebra/CirculantHadamard/CyclicNorm.lean @@ -0,0 +1,148 @@ +import OAI.LinearAlgebra.CirculantHadamard.MatrixBridge +import OAI.LinearAlgebra.CirculantHadamard.CyclicRing + +namespace OAI + +noncomputable section + +namespace CirculantHadamard + +open scoped BigOperators + +/-- Every literal integer coefficient is a sign. -/ +def CyclicSignRow {n : ℕ} (f : CyclicRing.Elem ℤ n) : Prop := + ∀ a, IsSign (f.coeff a) + +section PositiveOrder + +variable {n : ℕ} [NeZero n] + +/-- The cyclic group-ring element whose coefficients are the given first row. -/ +def cyclicRow (h : Fin n → ℤ) : CyclicRing.Elem ℤ n := + CyclicRing.ofCoeffs (fun a => h ((ZMod.finEquiv n).symm a)) + +/-- Recover the integer first row without changing the cyclic orientation. -/ +def integerRow (f : CyclicRing.Elem ℤ n) : Fin n → ℤ := + fun j => f.coeff (ZMod.finEquiv n j) + +@[simp] theorem cyclicRow_apply (h : Fin n → ℤ) (a : ZMod n) : + (cyclicRow h).coeff a = h ((ZMod.finEquiv n).symm a) := by + simp [cyclicRow] + +@[simp] theorem integerRow_apply (f : CyclicRing.Elem ℤ n) (j : Fin n) : + integerRow f j = f.coeff (ZMod.finEquiv n j) := rfl + +@[simp] theorem cyclicRow_integerRow (f : CyclicRing.Elem ℤ n) : + cyclicRow (integerRow f) = f := by + apply AddMonoidAlgebra.coeff_injective + apply Finsupp.ext + intro a + simp [integerRow] + +@[simp] theorem integerRow_cyclicRow (h : Fin n → ℤ) : + integerRow (cyclicRow h) = h := by + funext j + simp [integerRow] + +theorem sum_cyclicRow (h : Fin n → ℤ) : + (∑ a : ZMod n, (cyclicRow h).coeff a) = ∑ j : Fin n, h j := by + simpa only [cyclicRow_apply, RingEquiv.toEquiv_eq_coe, RingEquiv.coe_toEquiv, + RingEquiv.symm_apply_apply] using + ((ZMod.finEquiv n).toEquiv.sum_comp (fun a : ZMod n => (cyclicRow h).coeff a)).symm + +theorem cyclicSignRow_cyclicRow_iff (h : Fin n → ℤ) : + CyclicSignRow (cyclicRow h) ↔ ∀ j, IsSign (h j) := by + constructor + · intro hf j + simpa using hf (ZMod.finEquiv n j) + · intro hh a + simpa using hh ((ZMod.finEquiv n).symm a) + +/-- The norm coefficient uses the same `j - a` orientation as the row Gram. -/ +theorem cyclicRow_norm_apply (h : Fin n → ℤ) (a : Fin n) : + (cyclicRow h * CyclicRing.ringStar (cyclicRow h)).coeff (ZMod.finEquiv n a) = + ∑ j : Fin n, h j * h (j - a) := by + rw [CyclicRing.mul_ringStar_apply] + simpa only [cyclicRow_apply, map_sub, RingEquiv.toEquiv_eq_coe, + RingEquiv.coe_toEquiv, RingEquiv.symm_apply_apply, star_trivial] using + ((ZMod.finEquiv n).toEquiv.sum_comp + (fun j : ZMod n => + (cyclicRow h).coeff j * star ((cyclicRow h).coeff (j - ZMod.finEquiv n a)))).symm + +theorem cyclicRow_norm_iff_autocorrelation (h : Fin n → ℤ) : + cyclicRow h * CyclicRing.ringStar (cyclicRow h) = + CyclicRing.scalar n (n : ℤ) ↔ + ∀ a : Fin n, (∑ j : Fin n, h j * h (j - a)) = + if a = 0 then (n : ℤ) else 0 := by + constructor + · intro hn a + have ha := congrArg + (fun f : CyclicRing.Elem ℤ n => f.coeff (ZMod.finEquiv n a)) hn + simpa only [cyclicRow_norm_apply, CyclicRing.scalar_apply, + RingEquiv.map_eq_zero_iff] using ha + · intro hh + apply AddMonoidAlgebra.coeff_injective + apply Finsupp.ext + intro x + obtain ⟨a, rfl⟩ := (ZMod.finEquiv n).surjective x + simpa only [cyclicRow_norm_apply, CyclicRing.scalar_apply, + RingEquiv.map_eq_zero_iff] using hh a + +theorem cyclicRow_norm_iff_gram (h : Fin n → ℤ) : + cyclicRow h * CyclicRing.ringStar (cyclicRow h) = + CyclicRing.scalar n (n : ℤ) ↔ + rowCirculant h * (rowCirculant h).transpose = + (n : ℤ) • (1 : Matrix (Fin n) (Fin n) ℤ) := + (cyclicRow_norm_iff_autocorrelation h).trans (gram_eq_iff_autocorrelation h).symm + +theorem integerSignRow_iff_cyclicSignNorm (h : Fin n → ℤ) : + IsIntegerSignRow h ↔ + CyclicSignRow (cyclicRow h) ∧ + cyclicRow h * CyclicRing.ringStar (cyclicRow h) = + CyclicRing.scalar n (n : ℤ) := by + exact and_congr (cyclicSignRow_cyclicRow_iff h).symm (cyclicRow_norm_iff_gram h).symm + +/-- The literal sign norm equation is equivalent to the public real-matrix +existence predicate. Neither direction assumes a mathematical bridge. -/ +theorem exists_cyclicSignRow_iff_real : + (∃ f : CyclicRing.Elem ℤ n, + CyclicSignRow f ∧ f * CyclicRing.ringStar f = CyclicRing.scalar n (n : ℤ)) ↔ + ExistsRealCirculantHadamard n := by + rw [← integerSignRow_iff_real] + constructor + · rintro ⟨f, hf, hn⟩ + refine ⟨integerRow f, (integerSignRow_iff_cyclicSignNorm _).2 ?_⟩ + simpa only [cyclicRow_integerRow] using And.intro hf hn + · rintro ⟨h, hh⟩ + exact ⟨cyclicRow h, (integerSignRow_iff_cyclicSignNorm h).1 hh⟩ + +/-- The identity coefficient is the sum of the actual coefficient squares. -/ +theorem cyclicNorm_identity_coeff (f : CyclicRing.Elem ℤ n) : + (f * CyclicRing.ringStar f).coeff 0 = ∑ a : ZMod n, f.coeff a ^ 2 := by + simp [CyclicRing.mul_ringStar_apply, pow_two] + +theorem cyclicSignRow_identity_coeff (f : CyclicRing.Elem ℤ n) + (hf : CyclicSignRow f) : (f * CyclicRing.ringStar f).coeff 0 = (n : ℤ) := by + rw [cyclicNorm_identity_coeff] + calc + (∑ a : ZMod n, f.coeff a ^ 2) = ∑ _a : ZMod n, (1 : ℤ) := by + apply Finset.sum_congr rfl + intro a _ + rcases hf a with ha | ha <;> simp [ha] + _ = (n : ℤ) := by simp + +/-- Evaluating the actual cyclic norm at the trivial character gives the +square of the coefficient sum. -/ +theorem augmentation_sum_sq_of_norm (f : CyclicRing.Elem ℤ n) + (hf : f * CyclicRing.ringStar f = CyclicRing.scalar n (n : ℤ)) : + (∑ a : ZMod n, f.coeff a) ^ 2 = (n : ℤ) := by + simpa only [CyclicRing.augmentation_apply] using + CyclicRing.augmentation_norm f (n : ℤ) hf + +end PositiveOrder + +end CirculantHadamard + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/CirculantHadamard/CyclicPolynomial.lean b/lean/OAI/LinearAlgebra/CirculantHadamard/CyclicPolynomial.lean new file mode 100644 index 0000000000000000000000000000000000000000..6ad0873cf46a9a2b55cf75916d4edb9406bab706 --- /dev/null +++ b/lean/OAI/LinearAlgebra/CirculantHadamard/CyclicPolynomial.lean @@ -0,0 +1,172 @@ +import Mathlib.Algebra.MonoidAlgebra.Basic +import Mathlib.Data.ZMod.Basic +import Mathlib.RingTheory.AdjoinRoot + +namespace OAI + +universe uR uA + +/-! +# The polynomial presentation of the actual cyclic group algebra + +For a commutative coefficient ring and a positive integer `n`, the cyclic group +algebra is the quotient of `R[X]` by `X ^ n - 1`. The two maps are defined +by their universal properties, and both inverse identities are proved explicitly. +No domain property of the finite group algebra is used. +-/ + +noncomputable section + +namespace CirculantHadamard.CyclicPolynomial + +open Polynomial + +variable (R : Type uR) [CommRing R] (n : ℕ) + +/-- The defining polynomial of the cyclic group algebra. -/ +def relation : R[X] := X ^ n - 1 + +/-- The basis element at the distinguished generator of the cyclic group. -/ +def generator : AddMonoidAlgebra R (ZMod n) := AddMonoidAlgebra.single 1 1 + +theorem generator_pow : generator R n ^ n = 1 := by + simp [generator, AddMonoidAlgebra.single_pow, nsmul_eq_mul, + AddMonoidAlgebra.one_def] + +theorem root_pow : AdjoinRoot.root (relation R n) ^ n = 1 := by + have h : AdjoinRoot.mk (relation R n) (X ^ n - 1) = 0 := + AdjoinRoot.mk_self (f := relation R n) + rw [map_sub, map_pow, AdjoinRoot.mk_X, map_one] at h + exact sub_eq_zero.mp h + +variable {R} + +/-- A genuine cyclic character associated to an element whose `n`th power is one. -/ +def powerCharacter {A : Type uA} [Monoid A] [NeZero n] + (x : A) (hx : x ^ n = 1) : Multiplicative (ZMod n) →* A where + toFun a := x ^ a.toAdd.val + map_one' := by + change x ^ (0 : ZMod n).val = 1 + simp + map_mul' a b := by + change x ^ (a.toAdd + b.toAdd).val = + x ^ a.toAdd.val * x ^ b.toAdd.val + rw [ZMod.val_add, ← pow_eq_pow_mod _ hx, pow_add] + +@[simp] +theorem powerCharacter_apply {A : Type uA} [Monoid A] [NeZero n] + (x : A) (hx : x ^ n = 1) (i : ZMod n) : + powerCharacter n x hx (Multiplicative.ofAdd i) = x ^ i.val := rfl + +@[simp] +theorem powerCharacter_generator {A : Type uA} [Monoid A] [NeZero n] + (x : A) (hx : x ^ n = 1) : + powerCharacter n x hx (Multiplicative.ofAdd 1) = x := by + change x ^ (1 : ZMod n).val = x + rw [ZMod.val_one_eq_one_mod, ← pow_eq_pow_mod _ hx, pow_one] + +variable (R) + +/-- Send the cyclic basis element at `i` to the `i.val`th power of the root. -/ +def toPolynomial [NeZero n] : + AddMonoidAlgebra R (ZMod n) →ₐ[R] AdjoinRoot (relation R n) := + AddMonoidAlgebra.lift R (AdjoinRoot (relation R n)) (ZMod n) + (powerCharacter n (AdjoinRoot.root (relation R n)) (root_pow R n)) + +@[simp] +theorem toPolynomial_single [NeZero n] (i : ZMod n) (r : R) : + toPolynomial R n (AddMonoidAlgebra.single i r) = + algebraMap R (AdjoinRoot (relation R n)) r * + AdjoinRoot.root (relation R n) ^ i.val := by + simp [toPolynomial, Algebra.smul_def] + +@[simp] +theorem toPolynomial_generator [NeZero n] : + toPolynomial R n (generator R n) = AdjoinRoot.root (relation R n) := by + simp only [generator, toPolynomial, AddMonoidAlgebra.lift_single, + powerCharacter_generator, one_smul] + +theorem generator_isRoot : aeval (generator R n) (relation R n) = 0 := by + simp [relation, generator_pow] + +/-- Evaluate the polynomial quotient at the actual cyclic group-ring generator. -/ +def fromPolynomial : + AdjoinRoot (relation R n) →ₐ[R] AddMonoidAlgebra R (ZMod n) := + AdjoinRoot.liftAlgHom (relation R n) + (Algebra.ofId R (AddMonoidAlgebra R (ZMod n))) + (generator R n) (generator_isRoot R n) + +@[simp] +theorem fromPolynomial_root : + fromPolynomial R n (AdjoinRoot.root (relation R n)) = generator R n := by + exact AdjoinRoot.liftAlgHom_root (relation R n) + (Algebra.ofId R (AddMonoidAlgebra R (ZMod n))) + (generator R n) (generator_isRoot R n) + +@[simp] +theorem fromPolynomial_mk (p : R[X]) : + fromPolynomial R n (AdjoinRoot.mk (relation R n) p) = + aeval (generator R n) p := by + exact AdjoinRoot.liftAlgHom_mk (relation R n) + (Algebra.ofId R (AddMonoidAlgebra R (ZMod n))) + (generator R n) (generator_isRoot R n) p + +theorem generator_pow_val [NeZero n] (i : ZMod n) : + generator R n ^ i.val = AddMonoidAlgebra.single i 1 := by + simp [generator, AddMonoidAlgebra.single_pow, nsmul_eq_mul] + +theorem toPolynomial_comp_fromPolynomial [NeZero n] : + (toPolynomial R n).comp (fromPolynomial R n) = + AlgHom.id R (AdjoinRoot (relation R n)) := by + apply AdjoinRoot.algHom_ext + simp + +theorem fromPolynomial_comp_toPolynomial [NeZero n] : + (fromPolynomial R n).comp (toPolynomial R n) = + AlgHom.id R (AddMonoidAlgebra R (ZMod n)) := by + apply AddMonoidAlgebra.algHom_ext + · intro i + simp [generator_pow_val] + · exact Subsingleton.elim _ _ + +/-- The actual cyclic group algebra is the polynomial quotient by `X ^ n - 1`. -/ +def cyclicEquiv [NeZero n] : + AddMonoidAlgebra R (ZMod n) ≃ₐ[R] AdjoinRoot (relation R n) := + AlgEquiv.ofAlgHom (toPolynomial R n) (fromPolynomial R n) + (toPolynomial_comp_fromPolynomial R n) (fromPolynomial_comp_toPolynomial R n) + +@[simp] +theorem cyclicEquiv_single [NeZero n] (i : ZMod n) (r : R) : + cyclicEquiv R n (AddMonoidAlgebra.single i r) = + algebraMap R (AdjoinRoot (relation R n)) r * + AdjoinRoot.root (relation R n) ^ i.val := + toPolynomial_single R n i r + +@[simp] +theorem cyclicEquiv_generator [NeZero n] : + cyclicEquiv R n (generator R n) = AdjoinRoot.root (relation R n) := + toPolynomial_generator R n + +@[simp] +theorem cyclicEquiv_symm_root [NeZero n] : + (cyclicEquiv R n).symm (AdjoinRoot.root (relation R n)) = generator R n := + fromPolynomial_root R n + +@[simp] +theorem cyclicEquiv_symm_mk [NeZero n] (p : R[X]) : + (cyclicEquiv R n).symm (AdjoinRoot.mk (relation R n) p) = + aeval (generator R n) p := + fromPolynomial_mk R n p + +@[simp] +theorem cyclicEquiv_aeval [NeZero n] (p : R[X]) : + cyclicEquiv R n (aeval (generator R n) p) = + AdjoinRoot.mk (relation R n) p := by + rw [← Polynomial.aeval_algHom_apply, cyclicEquiv_generator, + AdjoinRoot.aeval_eq] + +end CirculantHadamard.CyclicPolynomial + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/CirculantHadamard/CyclicProjection.lean b/lean/OAI/LinearAlgebra/CirculantHadamard/CyclicProjection.lean new file mode 100644 index 0000000000000000000000000000000000000000..138c82f6d198da82b93bfe53d7784b77014ccfaa --- /dev/null +++ b/lean/OAI/LinearAlgebra/CirculantHadamard/CyclicProjection.lean @@ -0,0 +1,130 @@ +import OAI.LinearAlgebra.CirculantHadamard.CyclicRing + +namespace OAI + +universe uR uS + +/-! +# Quotients of actual cyclic group rings + +For `m ∣ n`, reduction of indices defines the quotient map from the cyclic +group ring of order `n` to that of order `m`. In particular it sends the +distinguished generator to the distinguished generator and fixes scalars. +The definition is the convolution ring homomorphism induced by `ZMod.castHom`. +-/ + +noncomputable section + +namespace CirculantHadamard + +open CyclicRing + +variable (R : Type uR) [Semiring R] {m n l : ℕ} + +/-- The quotient of cyclic group rings induced by reduction of indices. -/ +def cyclicProjection (h : m ∣ n) : Elem R n →+* Elem R m := + AddMonoidAlgebra.mapDomainRingHom R (ZMod.castHom h (ZMod m)).toAddMonoidHom + +variable {R} + +theorem cyclicProjection_apply (h : m ∣ n) (F : Elem R n) : + cyclicProjection R h F = AddMonoidAlgebra.mapDomain (ZMod.castHom h (ZMod m)) F := rfl + +@[simp] theorem cyclicProjection_single (h : m ∣ n) (a : ZMod n) (r : R) : + cyclicProjection R h (AddMonoidAlgebra.single a r) = + AddMonoidAlgebra.single (ZMod.castHom h (ZMod m) a) r := + AddMonoidAlgebra.mapDomain_single + +@[simp] theorem cyclicProjection_single_zero (h : m ∣ n) (r : R) : + cyclicProjection R h (AddMonoidAlgebra.single 0 r) = AddMonoidAlgebra.single 0 r := by + simp + +@[simp] theorem cyclicProjection_scalar (h : m ∣ n) (r : R) : + cyclicProjection R h (scalar n r) = scalar m r := by + exact cyclicProjection_single_zero h r + +@[simp] theorem cyclicProjection_generator (h : m ∣ n) : + cyclicProjection R h (AddMonoidAlgebra.single 1 1) = AddMonoidAlgebra.single 1 1 := by + simp only [cyclicProjection_single, map_one] + +@[simp] theorem cyclicProjection_single_natCast (h : m ∣ n) (a : ℕ) (r : R) : + cyclicProjection R h (AddMonoidAlgebra.single (a : ZMod n) r) = + AddMonoidAlgebra.single (a : ZMod m) r := by + simp + +@[simp] theorem cyclicProjection_self (F : Elem R n) : + cyclicProjection R (dvd_refl n) F = F := by + apply AddMonoidAlgebra.coeff_injective + change Finsupp.mapDomain (ZMod.castHom (dvd_refl n) (ZMod n)) F.coeff = F.coeff + simp [ZMod.castHom_self] + +theorem cyclicProjection_comp (h₁ : l ∣ m) (h₂ : m ∣ n) (F : Elem R n) : + cyclicProjection R h₁ (cyclicProjection R h₂ F) = + cyclicProjection R (dvd_trans h₁ h₂) F := by + apply AddMonoidAlgebra.coeff_injective + change Finsupp.mapDomain (ZMod.castHom h₁ (ZMod l)) + (Finsupp.mapDomain (ZMod.castHom h₂ (ZMod m)) F.coeff) = + Finsupp.mapDomain (ZMod.castHom (dvd_trans h₁ h₂) (ZMod l)) F.coeff + rw [← Finsupp.mapDomain_comp] + have hcomp : (ZMod.castHom h₁ (ZMod l) : ZMod m → ZMod l) ∘ + (ZMod.castHom h₂ (ZMod m) : ZMod n → ZMod m) = + (ZMod.castHom (dvd_trans h₁ h₂) (ZMod l) : ZMod n → ZMod l) := + congrArg (fun f : ZMod n →+* ZMod l => (f : ZMod n → ZMod l)) + (ZMod.castHom_comp h₁ h₂) + rw [hcomp] + +/-- Any additive coefficient evaluation factors through the quotient exactly +when its index function is pulled back along reduction. -/ +theorem sum_cyclicProjection {S : Type uS} [AddCommMonoid S] + (h : m ∣ n) (F : Elem R n) (v : ZMod m → R →+ S) : + (cyclicProjection R h F).coeff.sum (fun a r => v a r) = + F.coeff.sum (fun a r => v (ZMod.castHom h (ZMod m) a) r) := + Finsupp.sum_mapDomain_index_addMonoidHom v + +/-- Evaluation at the trivial character is unchanged by the cyclic quotient. -/ +@[simp] theorem augmentation_cyclicProjection (h : m ∣ n) (F : Elem R n) : + augmentation m (cyclicProjection R h F) = augmentation n F := by + change (cyclicProjection R h F).coeff.sum (fun _ r => r * 1) = + F.coeff.sum (fun _ r => r * 1) + simp only [mul_one] + exact sum_cyclicProjection h F (fun _ => AddMonoidHom.id R) + +section Star + +variable [StarRing R] [NeZero m] [NeZero n] + +/-- Quotienting the indices commutes with conjugation and index reversal. -/ +@[simp] theorem cyclicProjection_ringStar (h : m ∣ n) (F : Elem R n) : + cyclicProjection R h (ringStar F) = ringStar (cyclicProjection R h F) := by + refine AddMonoidAlgebra.induction_linear F ?_ ?_ ?_ + · simp + · intro F G hF hG + change cyclicProjection R h (ringStar ((F : Elem R n) + G)) = + ringStar (cyclicProjection R h ((F : Elem R n) + G)) + calc + _ = cyclicProjection R h (ringStar F + ringStar G) := + congrArg (cyclicProjection R h) (ringStar_add F G) + _ = cyclicProjection R h (ringStar F) + cyclicProjection R h (ringStar G) := + (cyclicProjection R h).map_add _ _ + _ = ringStar (cyclicProjection R h F) + ringStar (cyclicProjection R h G) := + congrArg₂ (· + ·) hF hG + _ = ringStar (cyclicProjection R h F + cyclicProjection R h G) := + (ringStar_add _ _).symm + _ = _ := congrArg ringStar ((cyclicProjection R h).map_add F G).symm + · intro a r + simp only [ringStar_single, cyclicProjection_single, map_neg] + +/-- A scalar convolution norm descends to the quotient cyclic group. -/ +theorem cyclicProjection_norm (h : m ∣ n) {F : Elem R n} {r : R} + (hnorm : F * ringStar F = scalar n r) : + cyclicProjection R h F * ringStar (cyclicProjection R h F) = scalar m r := by + have hq := congrArg (cyclicProjection R h) hnorm + simpa only [map_mul, cyclicProjection_ringStar, cyclicProjection_scalar] using hq + +end Star + +end CirculantHadamard + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/CirculantHadamard/CyclicProjectionPolynomial.lean b/lean/OAI/LinearAlgebra/CirculantHadamard/CyclicProjectionPolynomial.lean new file mode 100644 index 0000000000000000000000000000000000000000..205420cabf6c22e09b97a4c0e6aa28e573b06161 --- /dev/null +++ b/lean/OAI/LinearAlgebra/CirculantHadamard/CyclicProjectionPolynomial.lean @@ -0,0 +1,40 @@ +import OAI.LinearAlgebra.CirculantHadamard.CyclicProjection +import OAI.LinearAlgebra.CirculantHadamard.CyclicPolynomial + +namespace OAI + +universe uR + +/-! Polynomial evaluation commutes with the concrete cyclic quotient map. -/ + +noncomputable section + +namespace CirculantHadamard + +open CyclicRing + +variable (R : Type uR) [CommRing R] {m n : ℕ} + +/-- The cyclic quotient also preserves the coefficient algebra structure. -/ +def cyclicProjectionAlgHom (h : m ∣ n) : Elem R n →ₐ[R] Elem R m := + { cyclicProjection R h with + commutes' := fun r => cyclicProjection_scalar h r } + +@[simp] theorem cyclicProjectionAlgHom_apply (h : m ∣ n) (F : Elem R n) : + cyclicProjectionAlgHom R h F = cyclicProjection R h F := rfl + +/-- Polynomial evaluation at the generator commutes with the cyclic quotient. -/ +theorem cyclicProjection_aeval (h : m ∣ n) (F : Polynomial R) : + cyclicProjection R h (Polynomial.aeval (CyclicPolynomial.generator R n) F) = + Polynomial.aeval (CyclicPolynomial.generator R m) F := by + change cyclicProjectionAlgHom R h + (Polynomial.aeval (CyclicPolynomial.generator R n) F) = _ + have hgen : cyclicProjectionAlgHom R h (CyclicPolynomial.generator R n) = + CyclicPolynomial.generator R m := cyclicProjection_generator (R := R) h + rw [← Polynomial.aeval_algHom_apply, hgen] + +end CirculantHadamard + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/CirculantHadamard/CyclicRing.lean b/lean/OAI/LinearAlgebra/CirculantHadamard/CyclicRing.lean new file mode 100644 index 0000000000000000000000000000000000000000..228c9f7422281772f86c1d7b062b98b5f654f69d --- /dev/null +++ b/lean/OAI/LinearAlgebra/CirculantHadamard/CyclicRing.lean @@ -0,0 +1,223 @@ +import Mathlib.Algebra.MonoidAlgebra.MapDomain +import Mathlib.Algebra.MonoidAlgebra.Lift +import Mathlib.Algebra.BigOperators.Finsupp.Basic +import Mathlib.Algebra.Star.BigOperators +import Mathlib.Data.ZMod.Basic +import Mathlib.Tactic.Abel + +namespace OAI + +universe uR uG + +/-! The finite cyclic group ring, with coefficient conjugation and index reversal. -/ + +namespace CirculantHadamard.CyclicRing + +open scoped BigOperators + +abbrev Elem (R : Type uR) [Semiring R] (n : ℕ) := AddMonoidAlgebra R (ZMod n) + +noncomputable def groupStar {R : Type uR} {G : Type uG} [Semiring R] [StarRing R] + [AddGroup G] [Fintype G] (f : AddMonoidAlgebra R G) : AddMonoidAlgebra R G := + AddMonoidAlgebra.ofCoeff (Finsupp.equivFunOnFinite.symm fun a => star (f.coeff (-a))) + +@[simp] theorem groupStar_apply {R : Type uR} {G : Type uG} [Semiring R] [StarRing R] + [AddGroup G] [Fintype G] (f : AddMonoidAlgebra R G) (a : G) : + (groupStar f).coeff a = star (f.coeff (-a)) := rfl + +@[simp] theorem groupStar_groupStar {R : Type uR} {G : Type uG} [Semiring R] [StarRing R] + [AddGroup G] [Fintype G] (f : AddMonoidAlgebra R G) : + groupStar (groupStar f) = f := by + ext a + simp + +@[simp] theorem groupStar_single {R : Type uR} {G : Type uG} [Semiring R] [StarRing R] + [AddGroup G] [Fintype G] (a : G) (r : R) : + groupStar (AddMonoidAlgebra.single a r) = AddMonoidAlgebra.single (-a) (star r) := by + classical + ext b + change star (Finsupp.single a r (-b)) = Finsupp.single (-a) (star r) b + by_cases hb : b = -a + · subst b + simp + · have hab : a ≠ -b := by + intro h + apply hb + simpa using (congrArg (fun x : G => -x) h).symm + simp [hab, Ne.symm hb] + +noncomputable def ofCoeffs {R : Type uR} [Semiring R] {n : ℕ} [NeZero n] + (c : ZMod n → R) : Elem R n := + AddMonoidAlgebra.ofCoeff (Finsupp.equivFunOnFinite.symm c) + +@[simp] theorem ofCoeffs_apply {R : Type uR} [Semiring R] {n : ℕ} [NeZero n] + (c : ZMod n → R) (a : ZMod n) : (ofCoeffs c).coeff a = c a := rfl + +@[simp] theorem ofCoeffs_coeffs {R : Type uR} [Semiring R] {n : ℕ} [NeZero n] + (f : Elem R n) : ofCoeffs (fun a => f.coeff a) = f := by + exact AddMonoidAlgebra.coeff_injective (Finsupp.ext fun _ => rfl) + +noncomputable def scalar {R : Type uR} [Semiring R] (n : ℕ) (r : R) : Elem R n := + AddMonoidAlgebra.single 0 r + +@[simp] theorem scalar_apply {R : Type uR} [Semiring R] {n : ℕ} + (r : R) (a : ZMod n) : (scalar n r).coeff a = if a = 0 then r else 0 := by + classical + simp [scalar, AddMonoidAlgebra.coeff_single, Finsupp.single_apply, eq_comm] + +@[simp] theorem scalar_natCast {R : Type uR} [Semiring R] (n m : ℕ) : + scalar n (m : R) = (m : Elem R n) := rfl + +noncomputable def ringStar {R : Type uR} [Semiring R] [StarRing R] + {n : ℕ} [NeZero n] (f : Elem R n) : Elem R n := + ofCoeffs fun a => star (f.coeff (-a)) + +@[simp] theorem ringStar_apply {R : Type uR} [Semiring R] [StarRing R] + {n : ℕ} [NeZero n] (f : Elem R n) (a : ZMod n) : + (ringStar f).coeff a = star (f.coeff (-a)) := rfl + +theorem ringStar_eq_groupStar {R : Type uR} [Semiring R] [StarRing R] + {n : ℕ} [NeZero n] (f : Elem R n) : ringStar f = groupStar f := rfl + +@[simp] theorem ringStar_single {R : Type uR} [Semiring R] [StarRing R] + {n : ℕ} [NeZero n] (a : ZMod n) (r : R) : + ringStar (AddMonoidAlgebra.single a r) = AddMonoidAlgebra.single (-a) (star r) := + groupStar_single a r + +section Convolution + +variable {R : Type uR} {G : Type uG} [Semiring R] [AddCommGroup G] [Fintype G] + +theorem group_mul_apply (f g : AddMonoidAlgebra R G) (a : G) : + (f * g).coeff a = ∑ j, f.coeff j * g.coeff (a - j) := by + classical + calc + (f * g).coeff a = f.coeff.sum (fun j r => r * g.coeff (-j + a)) := + AddMonoidAlgebra.coeff_mul_apply_left f g a + _ = ∑ j, f.coeff j * g.coeff (-j + a) := Finsupp.sum_fintype _ _ (fun _ => zero_mul _) + _ = _ := by simp only [sub_eq_add_neg, add_comm] + +theorem group_mul_apply_right (f g : AddMonoidAlgebra R G) (a : G) : + (f * g).coeff a = ∑ j, f.coeff (a - j) * g.coeff j := by + classical + calc + (f * g).coeff a = g.coeff.sum (fun j r => f.coeff (a - j) * r) := by + simpa only [sub_eq_add_neg] using AddMonoidAlgebra.coeff_mul_apply_right f g a + _ = _ := Finsupp.sum_fintype _ _ (fun _ => mul_zero _) + +@[simp] theorem groupStar_zero [StarRing R] : + groupStar (0 : AddMonoidAlgebra R G) = 0 := by + ext a + simp + +@[simp] theorem groupStar_add [StarRing R] (f g : AddMonoidAlgebra R G) : + groupStar (f + g) = groupStar f + groupStar g := by + ext a + change star (f.coeff (-a) + g.coeff (-a)) = star (f.coeff (-a)) + star (g.coeff (-a)) + exact star_add _ _ + +@[simp] theorem groupStar_one [StarRing R] : + groupStar (1 : AddMonoidAlgebra R G) = 1 := by + classical + ext a + simp [AddMonoidAlgebra.one_def, AddMonoidAlgebra.coeff_single, Finsupp.single_apply] + +theorem groupStar_mul [StarRing R] (f g : AddMonoidAlgebra R G) : + groupStar (f * g) = groupStar g * groupStar f := by + ext a + rw [groupStar_apply, group_mul_apply_right, star_sum, group_mul_apply] + apply Fintype.sum_equiv (Equiv.neg G) + intro j + simp only [star_mul, groupStar_apply, Equiv.neg_apply, neg_neg] + congr 2 + congr 1 + abel + +end Convolution + +theorem mul_apply {R : Type uR} [Semiring R] {n : ℕ} [NeZero n] + (f g : Elem R n) (a : ZMod n) : (f * g).coeff a = ∑ j, f.coeff j * g.coeff (a - j) := + group_mul_apply f g a + +theorem mul_apply_right {R : Type uR} [Semiring R] {n : ℕ} [NeZero n] + (f g : Elem R n) (a : ZMod n) : (f * g).coeff a = ∑ j, f.coeff (a - j) * g.coeff j := + group_mul_apply_right f g a + +@[simp] theorem ringStar_ringStar {R : Type uR} [Semiring R] [StarRing R] + {n : ℕ} [NeZero n] (f : Elem R n) : ringStar (ringStar f) = f := + groupStar_groupStar f + +@[simp] theorem ringStar_zero {R : Type uR} [Semiring R] [StarRing R] + {n : ℕ} [NeZero n] : ringStar (0 : Elem R n) = 0 := groupStar_zero + +@[simp] theorem ringStar_add {R : Type uR} [Semiring R] [StarRing R] + {n : ℕ} [NeZero n] (f g : Elem R n) : ringStar (f + g) = ringStar f + ringStar g := + groupStar_add f g + +@[simp] theorem ringStar_one {R : Type uR} [Semiring R] [StarRing R] + {n : ℕ} [NeZero n] : ringStar (1 : Elem R n) = 1 := groupStar_one + +theorem ringStar_mul {R : Type uR} [Semiring R] [StarRing R] + {n : ℕ} [NeZero n] (f g : Elem R n) : + ringStar (f * g) = ringStar g * ringStar f := groupStar_mul f g + +@[simp] theorem ringStar_scalar {R : Type uR} [Semiring R] [StarRing R] + {n : ℕ} [NeZero n] (r : R) : ringStar (scalar n r) = scalar n (star r) := by + classical + ext a + by_cases ha : a = 0 <;> simp [scalar_apply, ha] + +theorem mul_ringStar_apply {R : Type uR} [Semiring R] [StarRing R] + {n : ℕ} [NeZero n] (f : Elem R n) (a : ZMod n) : + (f * ringStar f).coeff a = ∑ j, f.coeff j * star (f.coeff (j - a)) := by + simp only [mul_apply, ringStar_apply, neg_sub] + +noncomputable def groupStarRingHom {R : Type uR} {G : Type uG} [CommSemiring R] [StarRing R] + [AddCommGroup G] [Fintype G] : AddMonoidAlgebra R G →+* AddMonoidAlgebra R G where + toFun := groupStar + map_zero' := groupStar_zero + map_one' := groupStar_one + map_add' := groupStar_add + map_mul' f g := by rw [groupStar_mul, mul_comm] + +noncomputable def ringStarRingHom {R : Type uR} [CommSemiring R] [StarRing R] + (n : ℕ) [NeZero n] : Elem R n →+* Elem R n := groupStarRingHom + +@[simp] theorem ringStarRingHom_apply {R : Type uR} [CommSemiring R] [StarRing R] + {n : ℕ} [NeZero n] (f : Elem R n) : ringStarRingHom n f = ringStar f := rfl + +noncomputable def augmentation {R : Type uR} [Semiring R] (n : ℕ) : Elem R n →+* R := + AddMonoidAlgebra.liftNCRingHom (RingHom.id R) 1 (fun _ _ => Commute.one_right _) + +theorem augmentation_apply {R : Type uR} [Semiring R] {n : ℕ} [NeZero n] + (f : Elem R n) : augmentation n f = ∑ a, f.coeff a := by + change f.coeff.sum (fun _ r => r * 1) = _ + rw [Finsupp.sum_fintype _ _ (fun _ => zero_mul _)] + simp + +@[simp] theorem augmentation_scalar {R : Type uR} [Semiring R] (n : ℕ) (r : R) : + augmentation n (scalar n r) = r := by + change AddMonoidAlgebra.liftNC (RingHom.id R).toAddMonoidHom + (1 : Multiplicative (ZMod n) →* R) (AddMonoidAlgebra.single 0 r) = r + simp + +theorem augmentation_ringStar {R : Type uR} [Semiring R] [StarRing R] + {n : ℕ} [NeZero n] (f : Elem R n) : + augmentation n (ringStar f) = star (augmentation n f) := by + simp only [augmentation_apply, ringStar_apply, star_sum] + exact Fintype.sum_equiv (Equiv.neg (ZMod n)) _ _ (fun _ => rfl) + +theorem augmentation_norm_star {R : Type uR} [Semiring R] [StarRing R] + {n : ℕ} [NeZero n] (f : Elem R n) (r : R) + (h : f * ringStar f = scalar n r) : + augmentation n f * star (augmentation n f) = r := by + have he := congrArg (augmentation n) h + simpa only [map_mul, augmentation_ringStar, augmentation_scalar] using he + +theorem augmentation_norm {n : ℕ} [NeZero n] (f : Elem ℤ n) (r : ℤ) + (h : f * ringStar f = scalar n r) : (augmentation n f) ^ 2 = r := by + simpa only [star_trivial, pow_two] using augmentation_norm_star f r h + +end CirculantHadamard.CyclicRing + +end OAI diff --git a/lean/OAI/LinearAlgebra/CirculantHadamard/CyclicScalarDivision.lean b/lean/OAI/LinearAlgebra/CirculantHadamard/CyclicScalarDivision.lean new file mode 100644 index 0000000000000000000000000000000000000000..42551a1245e92198932d2adf654a4f7897f53669 --- /dev/null +++ b/lean/OAI/LinearAlgebra/CirculantHadamard/CyclicScalarDivision.lean @@ -0,0 +1,133 @@ +import Mathlib.Algebra.MonoidAlgebra.Basic + +namespace OAI + +universe uR uG uH + +/-! +# Division by regular coefficient scalars in an additive monoid algebra + +A finite group algebra usually has zero divisors. A nonzero scalar from a +domain nevertheless acts injectively, as is seen separately at each coefficient. +This is the cancellation needed when the projected norm equation is divided by +one power of the residue characteristic. +-/ + +noncomputable section + +namespace CirculantHadamard + +section DivisionExists + +variable {R : Type uR} {G : Type uG} [CommRing R] [AddMonoid G] [finiteG : Finite G] + +/-- Coefficientwise divisibility produces an actual element of the finite +group algebra whose scalar multiple is the original element. -/ +theorem scalar_division_exists (p : R) (F : AddMonoidAlgebra R G) + (hF : ∀ g, p ∣ F.coeff g) : + ∃ F' : AddMonoidAlgebra R G, F = AddMonoidAlgebra.single (0 : G) p * F' := by + classical + let d : G → R := fun g => Classical.choose (hF g) + refine ⟨AddMonoidAlgebra.ofCoeff (Finsupp.equivFunOnFinite.symm d), ?_⟩ + apply AddMonoidAlgebra.coeff_injective + apply Finsupp.ext + intro g + rw [AddMonoidAlgebra.coeff_single_zero_mul] + exact Classical.choose_spec (hF g) + +omit finiteG in +/-- Multiplication by a scalar makes every coefficient divisible by that scalar. -/ +theorem scalar_division_coefficients [Finite G] (p : R) (F : AddMonoidAlgebra R G) : + ∀ g, p ∣ (AddMonoidAlgebra.single (0 : G) p * F).coeff g := by + intro g + rw [AddMonoidAlgebra.coeff_single_zero_mul] + exact dvd_mul_right p (F.coeff g) + +theorem scalar_division_iff (p : R) (F : AddMonoidAlgebra R G) : + (∀ g, p ∣ F.coeff g) ↔ + ∃ F' : AddMonoidAlgebra R G, F = AddMonoidAlgebra.single (0 : G) p * F' := by + constructor + · exact scalar_division_exists p F + · rintro ⟨F', rfl⟩ + exact scalar_division_coefficients p F' + +end DivisionExists + +section Cancellation + +variable {R : Type uR} {G : Type uG} [CommRing R] [IsDomain R] [AddMonoid G] + +/-- A scalar is cancellable because its action at each coefficient is +injective. No domain structure is asserted for the group algebra. -/ +theorem scalar_mul_left_cancel (p : R) (hp : p ≠ 0) + {F K : AddMonoidAlgebra R G} + (h : AddMonoidAlgebra.single (0 : G) p * F = + AddMonoidAlgebra.single (0 : G) p * K) : F = K := by + apply AddMonoidAlgebra.coeff_injective + apply Finsupp.ext + intro g + apply mul_left_cancel₀ hp + simpa only [AddMonoidAlgebra.coeff_single_zero_mul] using + congrArg (fun H : AddMonoidAlgebra R G => H.coeff g) h + +theorem scalar_mul_left_injective (p : R) (hp : p ≠ 0) : + Function.Injective + (fun F : AddMonoidAlgebra R G => AddMonoidAlgebra.single (0 : G) p * F) := + fun _ _ h => scalar_mul_left_cancel p hp h + +/-- The element obtained by coefficientwise division is unique. -/ +theorem scalar_division_unique (p : R) (hp : p ≠ 0) + {F F₁ F₂ : AddMonoidAlgebra R G} + (h₁ : F = AddMonoidAlgebra.single (0 : G) p * F₁) + (h₂ : F = AddMonoidAlgebra.single (0 : G) p * F₂) : F₁ = F₂ := + scalar_mul_left_cancel p hp (h₁.symm.trans h₂) + +/-- Cancelling one regular scalar lowers the exponent of the norm equation +by exactly one. This is valid although the group algebra has zero divisors. -/ +theorem scalar_mul_norm_division (p : R) (hp : p ≠ 0) (e : ℕ) (b : R) + (F K : AddMonoidAlgebra R G) + (h : (AddMonoidAlgebra.single (0 : G) p * F) * K = + AddMonoidAlgebra.single (0 : G) (p ^ (e + 1) * b)) : + F * K = AddMonoidAlgebra.single (0 : G) (p ^ e * b) := by + apply scalar_mul_left_cancel p hp + calc + AddMonoidAlgebra.single (0 : G) p * (F * K) = + (AddMonoidAlgebra.single (0 : G) p * F) * K := (mul_assoc _ _ _).symm + _ = AddMonoidAlgebra.single (0 : G) (p ^ (e + 1) * b) := h + _ = AddMonoidAlgebra.single (0 : G) p * + AddMonoidAlgebra.single (0 : G) (p ^ e * b) := by + rw [AddMonoidAlgebra.single_mul_single, zero_add] + rw [pow_succ', mul_assoc] + +end Cancellation + +section Quotient + +variable {R : Type uR} {G : Type uG} {H : Type uH} [CommRing R] [IsDomain R] + [AddMonoid G] [AddMonoid H] + +/-- Project the norm equation along a genuine ring homomorphism and then +divide the chosen projected factor by one coefficient scalar. -/ +theorem quotient_scalar_norm_division + (q : AddMonoidAlgebra R G →+* AddMonoidAlgebra R H) + (hscalar : ∀ r : R, q (AddMonoidAlgebra.single (0 : G) r) = + AddMonoidAlgebra.single (0 : H) r) + (p : R) (hp : p ≠ 0) (e : ℕ) (b : R) + (F K : AddMonoidAlgebra R G) (F' : AddMonoidAlgebra R H) + (hFK : F * K = AddMonoidAlgebra.single (0 : G) (p ^ (e + 1) * b)) + (hF : q F = AddMonoidAlgebra.single (0 : H) p * F') : + F' * q K = AddMonoidAlgebra.single (0 : H) (p ^ e * b) := by + apply scalar_mul_norm_division p hp e b F' (q K) + calc + (AddMonoidAlgebra.single (0 : H) p * F') * q K = q F * q K := by rw [hF] + _ = q (F * K) := (q.map_mul F K).symm + _ = q (AddMonoidAlgebra.single (0 : G) (p ^ (e + 1) * b)) := congrArg q hFK + _ = AddMonoidAlgebra.single (0 : H) (p ^ (e + 1) * b) := hscalar _ + +end Quotient + +end CirculantHadamard + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/CirculantHadamard/CyclotomicAdjoin.lean b/lean/OAI/LinearAlgebra/CirculantHadamard/CyclotomicAdjoin.lean new file mode 100644 index 0000000000000000000000000000000000000000..7aea70b9ec0fc1f1b24ba409a13f581181c5c9cf --- /dev/null +++ b/lean/OAI/LinearAlgebra/CirculantHadamard/CyclotomicAdjoin.lean @@ -0,0 +1,106 @@ +import Mathlib.Basic.Complex.Basic +import Mathlib.FieldTheory.IntermediateField.Adjoin.Basic +import Mathlib.NumberTheory.NumberField.Basic +import Mathlib.RingTheory.IntegralClosure.IsIntegralClosure.Basic + +namespace OAI + +universe uR + +/-! +# The integral algebra and number field generated by roots of unity + +Both objects are concrete subobjects of `ℂ`. The integer algebra includes +literally into the rationally generated intermediate field. Integrality is +proved from positive power-equals-one witnesses for the generators; finite +generation then supplies the finite-dimensional and number-field structures. +-/ + +noncomputable section + +namespace CirculantHadamard.CyclotomicAdjoin + +/-- The actual integer algebra generated by `s`. -/ +abbrev Ring (s : Set ℂ) : Type := Algebra.adjoin ℤ s + +/-- The actual intermediate field generated over the rationals by `s`. -/ +abbrev Field (s : Set ℂ) : Type := IntermediateField.adjoin ℚ s + +/-- Each generator's positive power relation is a monic integral relation +over both the integers and the rationals. -/ +theorem root_integral (R : Type uR) [CommRing R] [Algebra R ℂ] {ζ : ℂ} + (hζ : ∃ n : ℕ, 0 < n ∧ ζ ^ n = 1) : IsIntegral R ζ := by + obtain ⟨n, hn, hpow⟩ := hζ + apply IsIntegral.of_pow hn + rw [hpow] + exact isIntegral_one + +/-- Containment of the integer algebra in the rationally generated field, +with the latter viewed as an integer subalgebra of `ℂ`. -/ +theorem ring_le_field (s : Set ℂ) : + Algebra.adjoin ℤ s ≤ + (IntermediateField.adjoin ℚ s).toSubalgebra.restrictScalars ℤ := by + apply Algebra.adjoin_le + intro ζ hζ + exact IntermediateField.subset_adjoin ℚ s hζ + +/-- The concrete inclusion preserves the underlying complex number. -/ +def inclusion (s : Set ℂ) : Ring s →+* Field s where + toFun z := ⟨(z : ℂ), ring_le_field s z.property⟩ + map_zero' := rfl + map_one' := rfl + map_add' _ _ := rfl + map_mul' _ _ := rfl + +@[simp] theorem inclusion_coe (s : Set ℂ) (z : Ring s) : + ((inclusion s z : Field s) : ℂ) = (z : ℂ) := rfl + +theorem inclusion_injective (s : Set ℂ) : Function.Injective (inclusion s) := by + intro x y hxy + apply Subtype.ext + exact congrArg (fun z : Field s => (z : ℂ)) hxy + +/-- Every element of the integer algebra is integral over the integers. +Finiteness of the generator set is not needed for this conclusion. -/ +theorem integral {s : Set ℂ} + (hroots : ∀ ζ ∈ s, ∃ n : ℕ, 0 < n ∧ ζ ^ n = 1) + (z : Ring s) : IsIntegral ℤ z := by + have hA : Algebra.IsIntegral ℤ (Algebra.adjoin ℤ s) := + Algebra.IsIntegral.adjoin (fun ζ hζ => root_integral ℤ (hroots ζ hζ)) + exact Algebra.isIntegral_def.mp hA z + +/-- In particular the corresponding actual complex number is integral. -/ +theorem integral_coe {s : Set ℂ} + (hroots : ∀ ζ ∈ s, ∃ n : ℕ, 0 < n ∧ ζ ^ n = 1) + (z : Ring s) : IsIntegral ℤ (z : ℂ) := + map_isIntegral_int (Algebra.adjoin ℤ s).val (integral hroots z) + +/-- Integrality of the element after its literal inclusion into the field. -/ +theorem inclusion_integral {s : Set ℂ} + (hroots : ∀ ζ ∈ s, ∃ n : ℕ, 0 < n ∧ ζ ^ n = 1) + (z : Ring s) : IsIntegral ℤ (inclusion s z) := + map_isIntegral_int (inclusion s) (integral hroots z) + +/-- A finite set of roots of unity generates a finite-dimensional extension +of `ℚ`. -/ +theorem finiteDimensional {s : Set ℂ} (hs : s.Finite) + (hroots : ∀ ζ ∈ s, ∃ n : ℕ, 0 < n ∧ ζ ^ n = 1) : + FiniteDimensional ℚ (Field s) := by + classical + let : Fintype s := hs.fintype + exact IntermediateField.finiteDimensional_adjoin + (fun ζ hζ => root_integral ℚ (hroots ζ hζ)) + +/-- The number-field structure for the concrete rational adjoin follows +from its finite dimension. -/ +theorem numberField {s : Set ℂ} (hs : s.Finite) + (hroots : ∀ ζ ∈ s, ∃ n : ℕ, 0 < n ∧ ζ ^ n = 1) : + NumberField (Field s) := by + let : FiniteDimensional ℚ (Field s) := finiteDimensional hs hroots + exact NumberField.of_module_finite ℚ (Field s) + +end CirculantHadamard.CyclotomicAdjoin + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/CirculantHadamard/CyclotomicAwayLocal.lean b/lean/OAI/LinearAlgebra/CirculantHadamard/CyclotomicAwayLocal.lean new file mode 100644 index 0000000000000000000000000000000000000000..c89ffaf35729fac1d5e2f90422dcbd732c9de233 --- /dev/null +++ b/lean/OAI/LinearAlgebra/CirculantHadamard/CyclotomicAwayLocal.lean @@ -0,0 +1,114 @@ +import OAI.LinearAlgebra.CirculantHadamard.CyclotomicLocalBase +import OAI.LinearAlgebra.CirculantHadamard.CyclotomicRings +import OAI.LinearAlgebra.CirculantHadamard.LocalizationMaps + +namespace OAI + +universe uR uS + +/-! +# The actual away coefficient localization + +The prime ideal is the contraction of a maximal ideal of the actual global +root ring. Its maximality follows from integrality of the coefficient +inclusion, and the single-generator theorem identifies its localization +with the unramified cyclotomic construction. +-/ + +noncomputable section + +namespace CirculantHadamard.CyclotomicAwayLocal + +open CyclotomicRings IsLocalRing + +/-- The actual prime ideal on the coefficient ring with one direction omitted. -/ +abbrev awayPrime (u p : ℕ) (m : Ideal (B u)) : Ideal (awayRing u p) := + m.comap (awayInclusion u p).toRingHom + +/-- The coefficient localization used in the prime-direction comparison. -/ +abbrev AwayLocal (u p : ℕ) (m : Ideal (B u)) [m.IsPrime] := + Localization.AtPrime (awayPrime u p m) + +instance awayLocal_algebra (u p : ℕ) (m : Ideal (B u)) [m.IsPrime] : + Algebra (awayRing u p) (AwayLocal u p m) := + OreLocalization.instAlgebra (R := awayRing u p) (R₀ := awayRing u p) + (S := (awayPrime u p m).primeCompl) + +/-- Integrality follows from the genuine finite integer module structure of +the global root ring, through the coefficient inclusion. -/ +theorem awayInclusion_isIntegral (u p : ℕ) : + (awayInclusion u p).toRingHom.IsIntegral := by + apply RingHom.IsIntegral.tower_top (algebraMap ℤ (awayRing u p)) + (awayInclusion u p).toRingHom + rw [show (awayInclusion u p).toRingHom.comp (algebraMap ℤ (awayRing u p)) = + algebraMap ℤ (B u) from Subsingleton.elim _ _] + exact Algebra.IsIntegral.isIntegral + +theorem awayMaximal (u p : ℕ) (m : Ideal (B u)) [m.IsMaximal] : + (awayPrime u p m).IsMaximal := + maximal_comap_of_integral (awayInclusion u p).toRingHom + (awayInclusion_isIntegral u p) m + +private theorem natCast_mem_comap_of_mem {R : Type uR} {S : Type uS} [CommRing R] [CommRing S] + (f : R →+* S) (m : Ideal S) (p : ℕ) (h : (p : S) ∈ m) : + (p : R) ∈ m.comap f := by + change f (p : R) ∈ m + simpa only [map_natCast] using h + +theorem prime_mem_awayPrime (u p : ℕ) (m : Ideal (B u)) + (hpm : (p : B u) ∈ m) : (p : awayRing u p) ∈ awayPrime u p m := + natCast_mem_comap_of_mem (awayInclusion u p).toRingHom m p hpm + +instance awayLocal_charZero (u p : ℕ) (m : Ideal (B u)) [m.IsPrime] : + CharZero (AwayLocal u p m) := + charZero_of_injective_algebraMap + (IsLocalization.injective (AwayLocal u p m) + (awayPrime u p m).primeCompl_le_nonZeroDivisors) + +instance awayLocal_noetherian (u p : ℕ) (m : Ideal (B u)) [m.IsPrime] : + IsNoetherianRing (AwayLocal u p m) := + IsLocalization.isNoetherianRing (awayPrime u p m).primeCompl (AwayLocal u p m) + (IsNoetherianRing.of_finite ℤ (awayRing u p)) + +private theorem maximalIdeal_eq_span_of_eq (S : Subalgebra ℤ ℂ) {z : ℂ} {L p : ℕ} + (hS : S = CyclotomicLocalBase.Order z) (hz : IsPrimitiveRoot z L) + (hp : p.Prime) (hpL : ¬ p ∣ L) (m : Ideal S) [m.IsMaximal] + (hpm : (p : S) ∈ m) : + maximalIdeal (Localization.AtPrime m) = Ideal.span {(p : Localization.AtPrime m)} := by + subst S + exact CyclotomicLocalBase.maximalIdeal_eq_span hz hp hpL m hpm + +/-- The maximal ideal of the exact contracted localization is generated by +the rational prime; no ring-property premise is assumed. -/ +theorem awayLocal_maximalIdeal_eq_span (u p : ℕ) (hu : Odd u) + (hp : p ∈ u.primeFactors) (m : Ideal (B u)) [m.IsMaximal] + (hpm : (p : B u) ∈ m) : + maximalIdeal (AwayLocal u p m) = Ideal.span {(p : AwayLocal u p m)} := by + let := awayMaximal u p m + exact maximalIdeal_eq_span_of_eq (awayRing u p) (awayRing_eq_singleton u p hu) + (eta_isPrimitiveRoot u p hu) (Nat.prime_of_mem_primeFactors hp) + (prime_not_dvd_awayOrder u p hu hp) (awayPrime u p m) + (prime_mem_awayPrime u p m hpm) + +theorem awayLocal_prime_ne_zero (u p : ℕ) (hp : p ∈ u.primeFactors) + (m : Ideal (B u)) [m.IsPrime] : (p : AwayLocal u p m) ≠ 0 := + Nat.cast_ne_zero.mpr (Nat.prime_of_mem_primeFactors hp).ne_zero + +theorem awayLocal_prime_not_isUnit (u p : ℕ) (m : Ideal (B u)) [m.IsMaximal] + (hpm : (p : B u) ∈ m) : ¬ IsUnit (p : AwayLocal u p m) := by + have hmem := (IsLocalization.AtPrime.to_map_mem_maximal_iff (AwayLocal u p m) + (awayPrime u p m) (p : awayRing u p)).mpr (prime_mem_awayPrime u p m hpm) + simpa only [map_natCast, IsLocalRing.mem_maximalIdeal, mem_nonunits_iff] using hmem + +theorem awayLocal_isDiscreteValuationRing (u p : ℕ) (hu : Odd u) + (hp : p ∈ u.primeFactors) (m : Ideal (B u)) [m.IsMaximal] + (hpm : (p : B u) ∈ m) : IsDiscreteValuationRing (AwayLocal u p m) := + LocalDVR.isDiscreteValuationRing_of_maximalIdeal_eq_span + (awayLocal_prime_ne_zero u p hp m) + (awayLocal_maximalIdeal_eq_span u p hu hp m hpm) + +end CirculantHadamard.CyclotomicAwayLocal + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/CirculantHadamard/CyclotomicFactorDivision.lean b/lean/OAI/LinearAlgebra/CirculantHadamard/CyclotomicFactorDivision.lean new file mode 100644 index 0000000000000000000000000000000000000000..eadb58d516cef66f93f43cb87a60233b8b74648d --- /dev/null +++ b/lean/OAI/LinearAlgebra/CirculantHadamard/CyclotomicFactorDivision.lean @@ -0,0 +1,67 @@ +import OAI.LinearAlgebra.CirculantHadamard.CyclotomicProjection +import OAI.LinearAlgebra.CirculantHadamard.LocalDVR + +namespace OAI + +universe uA + +/-! +# A projected factor is integrally divisible by the residue prime + +The primitive-character values live in the actual cyclotomic quotient. Their +product is evaluated from the actual group-ring product. The DVR inequality +chooses a factor, and the monic remainder theorem transfers its divisibility +to the smaller cyclic group ring. +-/ + +noncomputable section + +namespace CirculantHadamard.LocalComparison + +open CyclicRing Polynomial IsDiscreteValuationRing + +variable {A : Type uA} [CommRing A] + +/-- The ramified DVR and its value of `p` imply the concrete choice of a +divisible projected factor. These are local-ring properties, independent of +the input factors. The scalar and group exponents are both `e + 2`. -/ +theorem projected_factor_divisible {p e D : ℕ} [NeZero p] (hp : p.Prime) + [IsDomain (AdjoinRoot (cyclotomic (p ^ (e + 2)) A))] + [IsDiscreteValuationRing (AdjoinRoot (cyclotomic (p ^ (e + 2)) A))] + (hpS : (p : AdjoinRoot (cyclotomic (p ^ (e + 2)) A)) ≠ 0) + (hD : 0 < D) + (hpval : addVal (AdjoinRoot (cyclotomic (p ^ (e + 2)) A)) + (p : AdjoinRoot (cyclotomic (p ^ (e + 2)) A)) = (D : ℕ∞)) + (b : Aˣ) (F K : Elem A (p ^ (e + 2))) + (hFK : F * K = scalar (p ^ (e + 2)) ((p : A) ^ (e + 2) * (b : A))) : + (∃ F', cyclicProjection A (pow_dvd_pow p (Nat.le_succ (e + 1))) F = + scalar (p ^ (e + 1)) (p : A) * F') ∨ + (∃ K', cyclicProjection A (pow_dvd_pow p (Nat.le_succ (e + 1))) K = + scalar (p ^ (e + 1)) (p : A) * K') := by + let v := cyclicCyclotomicEvaluation A (p ^ (e + 2)) + have hscalar : ∀ a : A, v (scalar (p ^ (e + 2)) a) = + algebraMap A (AdjoinRoot (cyclotomic (p ^ (e + 2)) A)) a := by + intro a + exact v.commutes a + have hv : v F * v K = + (p : AdjoinRoot (cyclotomic (p ^ (e + 2)) A)) ^ (e + 2) * + algebraMap A (AdjoinRoot (cyclotomic (p ^ (e + 2)) A)) (b : A) := by + have h := congrArg v hFK + simpa only [map_mul, hscalar, map_pow, map_natCast] using h + have hb : IsUnit (algebraMap A (AdjoinRoot (cyclotomic (p ^ (e + 2)) A)) + (b : A)) := b.isUnit.map _ + have hchoose := LocalDVR.dvd_or_dvd_of_mul_eq_pow_mul_unit + hpS hD hpval (Nat.le_add_left 2 e) hb hv + rcases hchoose with hF | hK + · left + simpa only [scalar_natCast] using + cyclicProjection_divisible_of_cyclotomicEvaluation (e := e + 1) hp F hF + · right + simpa only [scalar_natCast] using + cyclicProjection_divisible_of_cyclotomicEvaluation (e := e + 1) hp K hK + +end CirculantHadamard.LocalComparison + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/CirculantHadamard/CyclotomicIntegerEvaluation.lean b/lean/OAI/LinearAlgebra/CirculantHadamard/CyclotomicIntegerEvaluation.lean new file mode 100644 index 0000000000000000000000000000000000000000..99e3f9249212eb7c2de4903d8983ceec4229982b --- /dev/null +++ b/lean/OAI/LinearAlgebra/CirculantHadamard/CyclotomicIntegerEvaluation.lean @@ -0,0 +1,109 @@ +import OAI.LinearAlgebra.CirculantHadamard.CyclicEvaluation +import OAI.LinearAlgebra.CirculantHadamard.CyclicPolynomial +import OAI.LinearAlgebra.CirculantHadamard.RamifiedConjugation + +namespace OAI + +universe uA + +/-! +# Integer cyclic evaluation and actual cyclotomic conjugation + +The coefficient map is the integer cast into the cyclotomic quotient. The +character sends the cyclic generator to its adjoined root. The root-inverting +automorphism therefore carries evaluation to evaluation of the actual cyclic +group-ring involution. +-/ + +noncomputable section + +namespace CirculantHadamard + +open Polynomial +open scoped BigOperators + +variable (A : Type uA) [CommRing A] (n : ℕ) [NeZero n] + +/-- Integer cyclic group-ring evaluation in the actual cyclotomic quotient. -/ +def integerCyclotomicEvaluation : + CyclicRing.Elem ℤ n →+* AdjoinRoot (cyclotomic n A) := + CyclicRing.evaluate (Int.castRingHom (AdjoinRoot (cyclotomic n A))) + (CyclicPolynomial.powerCharacter n (AdjoinRoot.root (cyclotomic n A)) + (RamifiedConjugation.root_pow_order A n)) + +theorem integerCyclotomicEvaluation_apply (T : CyclicRing.Elem ℤ n) : + integerCyclotomicEvaluation A n T = + ∑ a : ZMod n, (T.coeff a : AdjoinRoot (cyclotomic n A)) * + AdjoinRoot.root (cyclotomic n A) ^ a.val := by + rw [integerCyclotomicEvaluation, CyclicRing.evaluate_apply] + rfl + +@[simp] theorem integerCyclotomicEvaluation_scalar (a : ℤ) : + integerCyclotomicEvaluation A n (CyclicRing.scalar n a) = + (a : AdjoinRoot (cyclotomic n A)) := + CyclicRing.evaluate_scalar _ _ a + +variable (hn : 0 < n) +variable [IsDomain (AdjoinRoot (cyclotomic n A))] +variable [CharZero (AdjoinRoot (cyclotomic n A))] + +/-- The actual character intertwines negation of its index and the proved +cyclotomic conjugation. -/ +theorem cyclotomicPowerCharacter_neg (a : ZMod n) : + CyclicPolynomial.powerCharacter n (AdjoinRoot.root (cyclotomic n A)) + (RamifiedConjugation.root_pow_order A n) (Multiplicative.ofAdd (-a)) = + RamifiedConjugation.cyclotomicConjugation A n hn + (CyclicPolynomial.powerCharacter n (AdjoinRoot.root (cyclotomic n A)) + (RamifiedConjugation.root_pow_order A n) (Multiplicative.ofAdd a)) := by + let χ := CyclicPolynomial.powerCharacter n (AdjoinRoot.root (cyclotomic n A)) + (RamifiedConjugation.root_pow_order A n) + have hnonzero : χ (Multiplicative.ofAdd a) ≠ 0 := + pow_ne_zero a.val + ((RamifiedConjugation.root_isPrimitiveRoot A n hn).isUnit (ne_of_gt hn)).ne_zero + apply mul_right_cancel₀ hnonzero + have hleft : χ (Multiplicative.ofAdd (-a)) * χ (Multiplicative.ofAdd a) = 1 := by + rw [← map_mul] + change χ (Multiplicative.ofAdd (-a + a)) = 1 + simp + change χ (Multiplicative.ofAdd (-a)) * χ (Multiplicative.ofAdd a) = + RamifiedConjugation.cyclotomicConjugation A n hn + (χ (Multiplicative.ofAdd a)) * χ (Multiplicative.ofAdd a) + rw [hleft] + symm + change RamifiedConjugation.cyclotomicConjugation A n hn + (AdjoinRoot.root (cyclotomic n A) ^ a.val) * + AdjoinRoot.root (cyclotomic n A) ^ a.val = 1 + rw [map_pow, RamifiedConjugation.cyclotomicConjugation_root, ← mul_pow, + RamifiedConjugation.root_pow_pred_mul_root A n hn, one_pow] + +/-- Evaluating the integer cyclic involution is exactly the cyclotomic +conjugate of the evaluated element. -/ +theorem integerCyclotomicEvaluation_ringStar (T : CyclicRing.Elem ℤ n) : + integerCyclotomicEvaluation A n (CyclicRing.ringStar T) = + RamifiedConjugation.cyclotomicConjugation A n hn + (integerCyclotomicEvaluation A n T) := by + apply CyclicRing.evaluate_ringStar_intertwining + (Int.castRingHom (AdjoinRoot (cyclotomic n A))) + (CyclicPolynomial.powerCharacter n (AdjoinRoot.root (cyclotomic n A)) + (RamifiedConjugation.root_pow_order A n)) + (RamifiedConjugation.cyclotomicConjugation A n hn).toRingHom + · intro r + simp + · exact cyclotomicPowerCharacter_neg A n hn + +/-- A proved scalar norm equation in the integer group ring transfers to +the actual cyclotomic norm equation. -/ +theorem integerCyclotomicEvaluation_norm (T : CyclicRing.Elem ℤ n) (a : ℤ) + (hT : T * CyclicRing.ringStar T = CyclicRing.scalar n a) : + integerCyclotomicEvaluation A n T * + RamifiedConjugation.cyclotomicConjugation A n hn + (integerCyclotomicEvaluation A n T) = + (a : AdjoinRoot (cyclotomic n A)) := by + rw [← integerCyclotomicEvaluation_ringStar A n hn, ← map_mul, hT, + integerCyclotomicEvaluation_scalar] + +end CirculantHadamard + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/CirculantHadamard/CyclotomicLocalBase.lean b/lean/OAI/LinearAlgebra/CirculantHadamard/CyclotomicLocalBase.lean new file mode 100644 index 0000000000000000000000000000000000000000..2e65c0b1ace1a76152d02e94f70fdd158b11b2b8 --- /dev/null +++ b/lean/OAI/LinearAlgebra/CirculantHadamard/CyclotomicLocalBase.lean @@ -0,0 +1,218 @@ +import OAI.LinearAlgebra.CirculantHadamard.LocalDVR +import Mathlib.Basic.Complex.Basic +import Mathlib.Algebra.CharP.Algebra +import Mathlib.Algebra.Module.End +import Mathlib.RingTheory.RootsOfUnity.Minpoly +import Mathlib.RingTheory.Coprime.Lemmas +import Mathlib.RingTheory.Localization.Submodule +import Mathlib.RingTheory.Unramified.LocalRing +import Mathlib.RingTheory.Noetherian.Basic + +namespace OAI + +universe uK uR uA + +/-! +# The unramified cyclotomic coefficient ring + +We use the actual subring `ℤ[eta]` of `ℂ`. At a maximal ideal above a +rational prime not dividing the order of `eta`, its localization has maximal +ideal generated by that prime. The central argument proves the vanishing of +the universal derivation by differentiating `eta ^ L = 1`. +-/ + +noncomputable section + +namespace CirculantHadamard.CyclotomicLocalBase + +open IsLocalRing + +/-- The cyclotomic order as an actual subalgebra of the complex numbers. -/ +abbrev Order (eta : ℂ) := Algebra.adjoin ℤ ({eta} : Set ℂ) + +/-- The distinguished root in its integral order. -/ +def generator (eta : ℂ) : Order eta := + ⟨eta, Algebra.subset_adjoin (Set.mem_singleton eta)⟩ + +/-- Localization of the actual cyclotomic order at the chosen prime ideal. -/ +abbrev Local (eta : ℂ) (m : Ideal (Order eta)) [m.IsPrime] := + Localization.AtPrime m + +variable {eta : ℂ} {L p : ℕ} + +theorem order_pos (hpL : ¬ p ∣ L) : 0 < L := by + apply Nat.pos_of_ne_zero + intro h + apply hpL + rw [h] + exact dvd_zero p + +/-- The genuine finite integral power basis of `ℤ[eta]`. -/ +def powerBasis (hη : IsPrimitiveRoot eta L) (hL : 0 < L) : + PowerBasis ℤ (Order eta) := + Algebra.adjoin.powerBasis' (hη.isIntegral hL) + +@[simp] theorem powerBasis_gen (hη : IsPrimitiveRoot eta L) (hL : 0 < L) : + (powerBasis hη hL).gen = generator eta := by + simp [powerBasis, generator] + +theorem order_finite (hη : IsPrimitiveRoot eta L) (hL : 0 < L) : + Module.Finite ℤ (Order eta) := (powerBasis hη hL).finite + +theorem order_free (hη : IsPrimitiveRoot eta L) (hL : 0 < L) : + Module.Free ℤ (Order eta) := Module.Free.of_basis (powerBasis hη hL).basis + +theorem order_noetherian (hη : IsPrimitiveRoot eta L) (hL : 0 < L) : + IsNoetherianRing (Order eta) := by + let := order_finite hη hL + exact IsNoetherianRing.of_finite ℤ (Order eta) + +theorem generator_pow (hη : IsPrimitiveRoot eta L) : + generator eta ^ L = 1 := by + apply Subtype.ext + exact hη.pow_eq_one + +theorem local_noetherian (hη : IsPrimitiveRoot eta L) (hL : 0 < L) + (m : Ideal (Order eta)) [m.IsPrime] : IsNoetherianRing (Local eta m) := + IsLocalization.isNoetherianRing m.primeCompl (Local eta m) (order_noetherian hη hL) + +instance local_charZero (m : Ideal (Order eta)) [m.IsPrime] : CharZero (Local eta m) := + charZero_of_injective_algebraMap + (IsLocalization.injective (Local eta m) m.primeCompl_le_nonZeroDivisors) + +theorem prime_ne_zero (hp : p.Prime) (m : Ideal (Order eta)) [m.IsPrime] : + (p : Local eta m) ≠ 0 := Nat.cast_ne_zero.mpr hp.ne_zero + +theorem order_not_mem (hp : p.Prime) (hpL : ¬ p ∣ L) + (m : Ideal (Order eta)) [hm : m.IsMaximal] (hpm : (p : Order eta) ∈ m) : + (L : Order eta) ∉ m := by + intro hLm + obtain ⟨a, b, hab⟩ := (hp.coprime_iff_not_dvd.mpr hpL).cast (R := Order eta) + have hone : (1 : Order eta) ∈ m := by + rw [← hab] + exact m.add_mem (m.mul_mem_left a hpm) (m.mul_mem_left b hLm) + exact hm.ne_top (m.eq_top_iff_one.mpr hone) + +theorem order_isUnit (hp : p.Prime) (hpL : ¬ p ∣ L) + (m : Ideal (Order eta)) [m.IsMaximal] (hpm : (p : Order eta) ∈ m) : + IsUnit (L : Local eta m) := by + simpa only [map_natCast] using + (IsLocalization.AtPrime.isUnit_to_map_iff (Local eta m) m (L : Order eta)).mpr + (order_not_mem hp hpL m hpm) + +private theorem formallyUnramified_of_powerBasis + {K : Type uK} {R : Type uR} {A : Type uA} [CommRing K] [CommRing R] [CommRing A] [Algebra K R] [Algebra K A] + [Algebra R A] [IsScalarTower K R A] (M : Submonoid R) [IsLocalization M A] + (pb : PowerBasis K R) {L : ℕ} (hL : 0 < L) (hroot : pb.gen ^ L = 1) + (hLu : IsUnit (L : A)) : Algebra.FormallyUnramified K A := by + let z : A := algebraMap R A pb.gen + let D : Derivation K A (KaehlerDifferential K A) := KaehlerDifferential.D K A + have hzpow : z ^ L = 1 := by + dsimp [z] + rw [← map_pow, hroot, map_one] + have hzunit : IsUnit z := by + apply IsUnit.of_mul_eq_one (z ^ (L - 1)) + rw [← pow_succ', Nat.sub_add_cancel hL, hzpow] + have hDroot : D z = 0 := by + have hpow := congrArg D hzpow + have hzero : (L : A) • (z ^ (L - 1) • D z : KaehlerDifferential K A) = + (0 : KaehlerDifferential K A) := by + simpa only [Derivation.leibniz_pow, Derivation.map_one_eq_zero, + Nat.cast_smul_eq_nsmul A] using hpow + have hcancel : z ^ (L - 1) • D z = (0 : KaehlerDifferential K A) := + hLu.smul_eq_zero.mp hzero + exact (hzunit.pow (L - 1)).smul_eq_zero.mp hcancel + have hDorder (a : R) : D (algebraMap R A a) = 0 := by + obtain ⟨f, hf⟩ := pb.exists_eq_aeval' a + rw [hf] + change D ((IsScalarTower.toAlgHom K R A) (Polynomial.aeval pb.gen f)) = 0 + rw [← Polynomial.aeval_algHom_apply, Derivation.map_aeval] + change Polynomial.aeval z (Polynomial.derivative f) • D z = 0 + rw [hDroot, smul_zero] + have hD (x : A) : D x = 0 := by + obtain ⟨⟨a, s⟩, hxs⟩ := IsLocalization.surj M x + have hd := congrArg D hxs + rw [Derivation.leibniz, hDorder, hDorder, smul_zero, zero_add] at hd + exact (IsLocalization.map_units A s).smul_eq_zero.mp hd + have hspan : Submodule.span A (Set.range D) = ⊥ := by + apply Submodule.span_eq_bot.mpr + rintro x ⟨y, rfl⟩ + exact hD y + have htop : (⊤ : Submodule A (KaehlerDifferential K A)) = ⊥ := + (KaehlerDifferential.span_range_derivation K A).symm.trans hspan + have hall (x : KaehlerDifferential K A) : x = 0 := by + have hx : x ∈ (⊤ : Submodule A (KaehlerDifferential K A)) := trivial + rw [htop, Submodule.mem_bot] at hx + exact hx + exact ⟨⟨fun x y => (hall x).trans (hall y).symm⟩⟩ + +/-- Every absolute differential vanishes: the root has invertible derivative, +and the same vanishing extends across the localization denominators. -/ +theorem formallyUnramified (hη : IsPrimitiveRoot eta L) (hp : p.Prime) + (hpL : ¬ p ∣ L) (m : Ideal (Order eta)) [m.IsMaximal] + (hpm : (p : Order eta) ∈ m) : Algebra.FormallyUnramified ℤ (Local eta m) := by + let : Algebra (Order eta) (Local eta m) := + OreLocalization.instAlgebra (R := Order eta) (S := m.primeCompl) (R₀ := Order eta) + let : SMul (Order eta) (Local eta m) := + (inferInstance : Algebra (Order eta) (Local eta m)).toSMul + let : Module (Order eta) (Local eta m) := Algebra.toModule + let : IsScalarTower ℤ (Order eta) (Local eta m) := + AddCommGroup.intIsScalarTower + apply formallyUnramified_of_powerBasis m.primeCompl + (powerBasis hη (order_pos hpL)) (order_pos hpL) + · simpa only [powerBasis_gen] using generator_pow hη + · exact order_isUnit hp hpL m hpm + +/-- The rational prime ideal lies under the chosen maximal ideal. -/ +theorem liesOver_prime (hp : p.Prime) (m : Ideal (Order eta)) [hm : m.IsMaximal] + (hpm : (p : Order eta) ∈ m) : m.LiesOver (Ideal.span {(p : ℤ)}) := by + have hpz : Prime (p : ℤ) := Nat.prime_iff_prime_int.mp hp + have hmax : (Ideal.span {(p : ℤ)}).IsMaximal := + PrincipalIdealRing.isMaximal_of_irreducible hpz.irreducible + constructor + apply hmax.eq_of_le + · apply (Ideal.ne_top_iff_one _).mpr + change algebraMap ℤ (Order eta) 1 ∉ m + simpa only [map_one] using (m.ne_top_iff_one.mp hm.ne_top) + · apply Ideal.span_le.mpr + intro x hx + rcases Set.mem_singleton_iff.mp hx with rfl + change algebraMap ℤ (Order eta) (p : ℤ) ∈ m + simpa only [Ideal.mem_under, map_natCast, map_intCast, Int.cast_natCast] using hpm + +/-- The maximal ideal is generated by the actual rational prime. -/ +theorem maximalIdeal_eq_span (hη : IsPrimitiveRoot eta L) (hp : p.Prime) + (hpL : ¬ p ∣ L) (m : Ideal (Order eta)) [m.IsMaximal] + (hpm : (p : Order eta) ∈ m) : + maximalIdeal (Local eta m) = Ideal.span {(p : Local eta m)} := by + let := order_finite hη (order_pos hpL) + let P : Ideal ℤ := Ideal.span {(p : ℤ)} + let : P.IsPrime := (Ideal.span_singleton_prime (Int.natCast_ne_zero.mpr hp.ne_zero)).mpr + (Nat.prime_iff_prime_int.mp hp) + let : m.LiesOver P := liesOver_prime hp m hpm + let := Localization.AtPrime.algebraOfLiesOver P m + have hU : Algebra.IsUnramifiedAt ℤ m := formallyUnramified hη hp hpL m hpm + have hmap := ((Algebra.isUnramifiedAt_iff_map_eq ℤ P m).mp hU).2 + simpa only [P, Ideal.map_span, Set.image_singleton, map_natCast, map_intCast, + Int.cast_natCast] using + hmap.symm + +theorem prime_not_isUnit (m : Ideal (Order eta)) [m.IsMaximal] + (hpm : (p : Order eta) ∈ m) : ¬ IsUnit (p : Local eta m) := by + have hmem := (IsLocalization.AtPrime.to_map_mem_maximal_iff (Local eta m) m + (p : Order eta)).mpr hpm + simpa only [map_natCast, IsLocalRing.mem_maximalIdeal, mem_nonunits_iff] using hmem + +/-- The concrete unramified localization is a discrete valuation ring. -/ +theorem isDiscreteValuationRing (hη : IsPrimitiveRoot eta L) (hp : p.Prime) + (hpL : ¬ p ∣ L) (m : Ideal (Order eta)) [m.IsMaximal] + (hpm : (p : Order eta) ∈ m) : IsDiscreteValuationRing (Local eta m) := by + let := local_noetherian hη (order_pos hpL) m + exact LocalDVR.isDiscreteValuationRing_of_maximalIdeal_eq_span + (prime_ne_zero hp m) (maximalIdeal_eq_span hη hp hpL m hpm) + +end CirculantHadamard.CyclotomicLocalBase + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/CirculantHadamard/CyclotomicProjection.lean b/lean/OAI/LinearAlgebra/CirculantHadamard/CyclotomicProjection.lean new file mode 100644 index 0000000000000000000000000000000000000000..a596149eae0e4d04414d419bc2488035167f0edf --- /dev/null +++ b/lean/OAI/LinearAlgebra/CirculantHadamard/CyclotomicProjection.lean @@ -0,0 +1,133 @@ +import OAI.LinearAlgebra.CirculantHadamard.CyclicPolynomial +import OAI.LinearAlgebra.CirculantHadamard.CyclicProjectionPolynomial +import OAI.LinearAlgebra.CirculantHadamard.CyclicEvaluationAt +import OAI.LinearAlgebra.CirculantHadamard.CyclotomicRemainder +import Mathlib.RingTheory.Polynomial.Cyclotomic.Basic + +namespace OAI + +universe uR uS + +/-! +# Integral division after projection to a smaller cyclic group + +At an element of order dividing `p ^ e`, the prime-power cyclotomic polynomial +`cyclotomic (p ^ (e + 1)) R` evaluates to the scalar `p`. Consequently, if all +coefficients of a polynomial's monic remainder are divisible by `p`, its image +in the group algebra of `ZMod (p ^ e)` is divisible by the same scalar. + +All divisions are witnessed inside the coefficient ring or group algebra. +No domain instance or cancellation assumption on a finite group algebra is used. +-/ + +noncomputable section + +namespace CirculantHadamard + +open Polynomial + +variable {R : Type uR} {S : Type uS} [CommRing R] [CommRing S] [Algebra R S] + +/-- Every actual cyclic group-ring element has a polynomial representative. -/ +theorem exists_cyclic_polynomial (n : ℕ) [NeZero n] + (F : AddMonoidAlgebra R (ZMod n)) : + ∃ P : R[X], aeval (CyclicPolynomial.generator R n) P = F := by + obtain ⟨P, hP⟩ := AdjoinRoot.mk_surjective (CyclicPolynomial.cyclicEquiv R n F) + refine ⟨P, ?_⟩ + apply (CyclicPolynomial.cyclicEquiv R n).injective + rw [CyclicPolynomial.cyclicEquiv_aeval, hP] + +/-- The actual root in the cyclotomic quotient satisfies its `n`th-power +relation, directly because the cyclotomic polynomial divides `X ^ n - 1`. -/ +theorem cyclotomicAdjoinRoot_pow (n : ℕ) : + AdjoinRoot.root (cyclotomic n R) ^ n = 1 := by + have h : AdjoinRoot.mk (cyclotomic n R) ((X : R[X]) ^ n - 1) = 0 := + AdjoinRoot.mk_eq_zero.mpr (cyclotomic.dvd_X_pow_sub_one n R) + simpa only [map_sub, map_pow, AdjoinRoot.mk_X, map_one, sub_eq_zero] using h + +/-- Evaluation of the actual cyclic group ring at the root in its cyclotomic +quotient, using the root's proved power relation. -/ +def cyclicCyclotomicEvaluation (R : Type uR) [CommRing R] (n : ℕ) [NeZero n] : + AddMonoidAlgebra R (ZMod n) →ₐ[R] AdjoinRoot (cyclotomic n R) := + CyclicRing.evaluateAt n (AdjoinRoot.root (cyclotomic n R)) + (cyclotomicAdjoinRoot_pow n) + +@[simp] +theorem cyclicCyclotomicEvaluation_aeval (n : ℕ) [NeZero n] (P : R[X]) : + cyclicCyclotomicEvaluation R n (aeval (CyclicPolynomial.generator R n) P) = + AdjoinRoot.mk (cyclotomic n R) P := by + rw [cyclicCyclotomicEvaluation, CyclicRing.evaluateAt_aeval, AdjoinRoot.aeval_eq] + +/-- A prime-power cyclotomic polynomial becomes `p` at every element whose +`p ^ e`th power is one. -/ +theorem aeval_cyclotomic_prime_pow_of_pow_eq_one {p e : ℕ} (hp : p.Prime) + (x : S) (hx : x ^ (p ^ e) = 1) : + aeval x (cyclotomic (p ^ (e + 1)) R) = (p : S) := by + rw [cyclotomic_prime_pow_eq_geom_sum hp] + simp [hx] + +/-- Evaluating a monic division identity preserves integral divisibility if +both the divisor's evaluation and the remainder have the stated scalar factor. -/ +theorem aeval_divisible_of_modByMonic_coeff (x : S) (F Q : R[X]) (a : R) + (_hQ : Q.Monic) (hQx : aeval x Q = algebraMap R S a) + (hcoeff : ∀ i, a ∣ (F %ₘ Q).coeff i) : + ∃ G : S, aeval x F = algebraMap R S a * G := by + obtain ⟨T, hT⟩ := (C_dvd_iff_dvd_coeff a (F %ₘ Q)).2 hcoeff + refine ⟨aeval x T + aeval x (F /ₘ Q), ?_⟩ + calc + aeval x F = aeval x (F %ₘ Q) + aeval x Q * aeval x (F /ₘ Q) := by + rw [← map_mul, ← map_add, modByMonic_add_div F Q] + _ = algebraMap R S a * (aeval x T + aeval x (F /ₘ Q)) := by + rw [hT, map_mul, aeval_C, hQx, mul_add] + +/-- Integral divisibility at a `p ^ e`th root follows from coefficientwise +divisibility of the remainder modulo the next cyclotomic polynomial. -/ +theorem aeval_divisible_of_cyclotomic_remainder_coeff {p e : ℕ} (hp : p.Prime) + (x : S) (hx : x ^ (p ^ e) = 1) (F : R[X]) + (hcoeff : ∀ i, (p : R) ∣ (F %ₘ cyclotomic (p ^ (e + 1)) R).coeff i) : + ∃ G : S, aeval x F = (p : S) * G := by + have hQx : aeval x (cyclotomic (p ^ (e + 1)) R) = + algebraMap R S (p : R) := by + simpa only [map_natCast] using aeval_cyclotomic_prime_pow_of_pow_eq_one hp x hx + simpa only [map_natCast] using aeval_divisible_of_modByMonic_coeff x F + (cyclotomic (p ^ (e + 1)) R) (p : R) (cyclotomic.monic _ _) hQx hcoeff + +/-- The concrete `p`-division step in the cyclic group algebra: project from +order `p ^ (e + 1)` to order `p ^ e`, then divide integrally by `p`. -/ +theorem cyclicProjection_divisible_of_remainder_coeff {p e : ℕ} (hp : p.Prime) + (F : R[X]) + (hcoeff : ∀ i, (p : R) ∣ (F %ₘ cyclotomic (p ^ (e + 1)) R).coeff i) : + ∃ G : AddMonoidAlgebra R (ZMod (p ^ e)), + cyclicProjection R (pow_dvd_pow p (Nat.le_succ e)) + (aeval (CyclicPolynomial.generator R (p ^ (e + 1))) F) = + (p : AddMonoidAlgebra R (ZMod (p ^ e))) * G := by + rw [cyclicProjection_aeval] + exact aeval_divisible_of_cyclotomic_remainder_coeff hp + (CyclicPolynomial.generator R (p ^ e)) (CyclicPolynomial.generator_pow R (p ^ e)) + F hcoeff + +/-- Divisibility at the actual primitive-root quotient forces integral +divisibility after projecting the actual cyclic group-ring element. + +The concrete monic quotient's linear remainder map supplies coefficientwise +divisibility of the remainder. -/ +theorem cyclicProjection_divisible_of_cyclotomicEvaluation {p e : ℕ} + [NeZero p] (hp : p.Prime) (F : AddMonoidAlgebra R (ZMod (p ^ (e + 1)))) + (hdiv : (p : AdjoinRoot (cyclotomic (p ^ (e + 1)) R)) ∣ + cyclicCyclotomicEvaluation R (p ^ (e + 1)) F) : + ∃ G : AddMonoidAlgebra R (ZMod (p ^ e)), + cyclicProjection R (pow_dvd_pow p (Nat.le_succ e)) F = + (p : AddMonoidAlgebra R (ZMod (p ^ e))) * G := by + obtain ⟨P, rfl⟩ := exists_cyclic_polynomial (p ^ (e + 1)) F + rw [cyclicCyclotomicEvaluation_aeval] at hdiv + apply cyclicProjection_divisible_of_remainder_coeff hp P + intro i + exact CyclotomicRemainder.adjoinRoot_dvd_coeff_modByMonic + (cyclotomic (p ^ (e + 1)) R) (cyclotomic.monic _ _) (p : R) P + (by simpa only [map_natCast] using hdiv) i + +end CirculantHadamard + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/CirculantHadamard/CyclotomicRemainder.lean b/lean/OAI/LinearAlgebra/CirculantHadamard/CyclotomicRemainder.lean new file mode 100644 index 0000000000000000000000000000000000000000..ef6940ba38a7b772788a236fee5edea53092b099 --- /dev/null +++ b/lean/OAI/LinearAlgebra/CirculantHadamard/CyclotomicRemainder.lean @@ -0,0 +1,100 @@ +import Mathlib.RingTheory.IsAdjoinRoot + +namespace OAI + +universe uR uS + +/-! +# Scalar divisibility and monic remainders + +The canonical remainder map for a monic root extension is linear over the +coefficient ring. Consequently, divisibility by a scalar in the extension is +equivalent to divisibility of every coefficient of the monic remainder. + +The actual polynomial quotient `AdjoinRoot f` is such an extension; +no additional representation hypothesis is required. +-/ + +noncomputable section + +namespace CirculantHadamard.CyclotomicRemainder + +open Polynomial + +variable {R : Type uR} {S : Type uS} [CommRing R] [Ring S] [Algebra R S] {f : R[X]} + +/-- Scalar divisibility in a monic root extension gives a constant-polynomial +factor of the canonical remainder. -/ +theorem C_dvd_modByMonic_of_dvd_map (h : IsAdjoinRootMonic S f) + (a : R) (F : R[X]) (hdiv : algebraMap R S a ∣ h.map F) : + C a ∣ F %ₘ f := by + obtain ⟨x, hx⟩ := hdiv + refine ⟨h.modByMonicHom x, ?_⟩ + calc + F %ₘ f = h.modByMonicHom (h.map F) := (h.modByMonicHom_map F).symm + _ = h.modByMonicHom (a • x) := by rw [hx, Algebra.smul_def] + _ = a • h.modByMonicHom x := h.modByMonicHom.map_smul a x + _ = C a * h.modByMonicHom x := Polynomial.smul_eq_C_mul a + +/-- A constant factor of the canonical remainder gives scalar divisibility +after passing to the monic root extension. -/ +theorem dvd_map_of_C_dvd_modByMonic (h : IsAdjoinRootMonic S f) + (a : R) (F : R[X]) (hdiv : C a ∣ F %ₘ f) : + algebraMap R S a ∣ h.map F := by + obtain ⟨G, hG⟩ := hdiv + refine ⟨h.map G, ?_⟩ + calc + h.map F = h.map (F %ₘ f) := (h.map_modByMonic F).symm + _ = h.map (C a * G) := congrArg h.map hG + _ = algebraMap R S a * h.map G := by rw [map_mul, ← h.algebraMap_apply] + +/-- Exact divisibility equivalence for a monic root extension. -/ +theorem map_dvd_iff_C_dvd_modByMonic (h : IsAdjoinRootMonic S f) + (a : R) (F : R[X]) : + algebraMap R S a ∣ h.map F ↔ C a ∣ F %ₘ f := + ⟨C_dvd_modByMonic_of_dvd_map h a F, dvd_map_of_C_dvd_modByMonic h a F⟩ + +/-- Scalar divisibility is equivalent to divisibility of every coefficient +of the canonical remainder. -/ +theorem map_dvd_iff_dvd_coeff_modByMonic (h : IsAdjoinRootMonic S f) + (a : R) (F : R[X]) : + algebraMap R S a ∣ h.map F ↔ ∀ i, a ∣ (F %ₘ f).coeff i := + (map_dvd_iff_C_dvd_modByMonic h a F).trans (C_dvd_iff_dvd_coeff a (F %ₘ f)) + +/-- Coefficient form of the forward divisibility bridge. -/ +theorem dvd_coeff_modByMonic_of_dvd_map (h : IsAdjoinRootMonic S f) + (a : R) (F : R[X]) (hdiv : algebraMap R S a ∣ h.map F) (i : ℕ) : + a ∣ (F %ₘ f).coeff i := + (map_dvd_iff_dvd_coeff_modByMonic h a F).mp hdiv i + +/-- The actual quotient by a monic polynomial satisfies the constant-factor +criterion, using its concrete `IsAdjoinRootMonic` constructor. -/ +theorem adjoinRoot_dvd_iff_C_dvd_modByMonic (f : R[X]) (hf : f.Monic) + (a : R) (F : R[X]) : + algebraMap R (AdjoinRoot f) a ∣ AdjoinRoot.mk f F ↔ C a ∣ F %ₘ f := by + simpa only [AdjoinRoot.isAdjoinRootMonic_toAdjoinRoot, + AdjoinRoot.isAdjoinRoot_map_eq_mkₐ, AdjoinRoot.coe_mkₐ] using + map_dvd_iff_C_dvd_modByMonic (AdjoinRoot.isAdjoinRootMonic f hf) a F + +/-- The concrete monic quotient has scalar divisibility exactly when all +coefficients of the monic remainder have that scalar factor. -/ +theorem adjoinRoot_dvd_iff_dvd_coeff_modByMonic (f : R[X]) (hf : f.Monic) + (a : R) (F : R[X]) : + algebraMap R (AdjoinRoot f) a ∣ AdjoinRoot.mk f F ↔ + ∀ i, a ∣ (F %ₘ f).coeff i := + (adjoinRoot_dvd_iff_C_dvd_modByMonic f hf a F).trans + (C_dvd_iff_dvd_coeff a (F %ₘ f)) + +/-- Scalar divisibility in a monic quotient implies coefficientwise +divisibility of the remainder. -/ +theorem adjoinRoot_dvd_coeff_modByMonic (f : R[X]) (hf : f.Monic) + (a : R) (F : R[X]) + (hdiv : algebraMap R (AdjoinRoot f) a ∣ AdjoinRoot.mk f F) (i : ℕ) : + a ∣ (F %ₘ f).coeff i := + (adjoinRoot_dvd_iff_dvd_coeff_modByMonic f hf a F).mp hdiv i + +end CirculantHadamard.CyclotomicRemainder + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/CirculantHadamard/CyclotomicRings.lean b/lean/OAI/LinearAlgebra/CirculantHadamard/CyclotomicRings.lean new file mode 100644 index 0000000000000000000000000000000000000000..d57ae60055b7314782135465887e86c5446650d7 --- /dev/null +++ b/lean/OAI/LinearAlgebra/CirculantHadamard/CyclotomicRings.lean @@ -0,0 +1,421 @@ +import Mathlib.RingTheory.RootsOfUnity.Complex +import Mathlib.RingTheory.Adjoin.Basic +import Mathlib.RingTheory.IntegralClosure.IsIntegral.Basic +import Mathlib.Data.Nat.PrimeFin +import Mathlib.Data.Nat.GCD.BigOperators +import Mathlib.Tactic.IntervalCases +import Mathlib.Tactic.NormNum + +namespace OAI + +/-! +# The concrete coefficient rings for the prime comparisons + +The chosen roots and all coefficient rings live in `ℂ`. The away ring is +proved to be generated by one actual primitive root of order prime to the +omitted prime. No equality of root-generated rings is an input hypothesis. +-/ + +noncomputable section + +namespace CirculantHadamard.CyclotomicRings + +open scoped BigOperators + +/-- The fixed primitive root used in the `p`-direction. -/ +def rho (p : ℕ) : ℂ := Complex.exp (2 * Real.pi * Complex.I / p) + +theorem rho_isPrimitiveRoot (p : ℕ) (hp : p ≠ 0) : IsPrimitiveRoot (rho p) p := + Complex.isPrimitiveRoot_exp p hp + +@[simp] theorem rho_zero : rho 0 = 1 := by simp [rho] + +theorem rho_pow (p : ℕ) (hp : p ≠ 0) : rho p ^ p = 1 := + (rho_isPrimitiveRoot p hp).pow_eq_one + +theorem I_isPrimitiveRoot : IsPrimitiveRoot Complex.I 4 := by + apply IsPrimitiveRoot.mk_of_lt _ (by norm_num) Complex.I_pow_four + intro j hj0 hj4 + interval_cases j <;> + norm_num [pow_one, Complex.I_sq, Complex.I_pow_three, Complex.ext_iff] + +/-- Conjugation of a complex root is an explicit nonnegative power. -/ +theorem star_eq_pow_pred_of_pow_eq_one {z : ℂ} {n : ℕ} + (hn : n ≠ 0) (hz : z ^ n = 1) : star z = z ^ (n - 1) := by + have hz0 : z ≠ 0 := by + intro h + simp [h, hn] at hz + have hnorm : ‖z‖ = 1 := Complex.norm_eq_one_of_pow_eq_one hz hn + have hs : star z * z = 1 := by + change (starRingEnd ℂ) z * z = 1 + rw [Complex.conj_mul', hnorm] + norm_num + have hp : z ^ (n - 1) * z = 1 := by + rw [← pow_succ, Nat.sub_add_cancel (Nat.one_le_iff_ne_zero.mpr hn), hz] + exact mul_right_cancel₀ hz0 (hs.trans hp.symm) + +theorem star_rho (p : ℕ) (hp : p ≠ 0) : star (rho p) = rho p ^ (p - 1) := + star_eq_pow_pred_of_pow_eq_one hp (rho_pow p hp) + +theorem rho_mul_star (p : ℕ) : rho p * star (rho p) = 1 := by + by_cases hp : p = 0 + · simp [hp] + · rw [star_rho p hp, ← pow_succ', Nat.sub_add_cancel (Nat.one_le_iff_ne_zero.mpr hp)] + exact rho_pow p hp + +def GaussianRing : Subalgebra ℤ ℂ := Algebra.adjoin ℤ ({Complex.I} : Set ℂ) + +def gaussianI : GaussianRing := ⟨Complex.I, Algebra.subset_adjoin (by simp)⟩ + +@[simp] theorem coe_gaussianI : (gaussianI : ℂ) = Complex.I := rfl + +theorem gaussianI_sq : gaussianI ^ 2 = -1 := + Subtype.ext Complex.I_sq + +/-- A finite list of prime directions, keeping `i` in the coefficient ring. -/ +def rootRing (s : Finset ℕ) : Subalgebra ℤ ℂ := + Algebra.adjoin ℤ (({Complex.I} : Set ℂ) ∪ rho '' (s : Set ℕ)) + +/-- The literal global ring in the alternating products. -/ +abbrev B (u : ℕ) : Subalgebra ℤ ℂ := rootRing u.primeFactors + +/-- The literal coefficient ring with the `p`-direction omitted. -/ +abbrev awayRing (u p : ℕ) : Subalgebra ℤ ℂ := rootRing (u.primeFactors.erase p) + +theorem I_mem_rootRing (s : Finset ℕ) : Complex.I ∈ rootRing s := + Algebra.subset_adjoin (Or.inl (by simp)) + +theorem rho_mem_rootRing (s : Finset ℕ) (p : ℕ) (hp : p ∈ s) : rho p ∈ rootRing s := + Algebra.subset_adjoin (Or.inr ⟨p, hp, rfl⟩) + +theorem I_mem_B (u : ℕ) : Complex.I ∈ B u := I_mem_rootRing _ + +theorem rho_mem_B (u p : ℕ) (hp : p ∈ u.primeFactors) : rho p ∈ B u := + rho_mem_rootRing _ _ hp + +theorem I_mem_awayRing (u p : ℕ) : Complex.I ∈ awayRing u p := I_mem_rootRing _ + +theorem rho_mem_awayRing (u p q : ℕ) (hq : q ∈ u.primeFactors) (hne : q ≠ p) : + rho q ∈ awayRing u p := + rho_mem_rootRing _ _ (Finset.mem_erase.mpr ⟨hne, hq⟩) + +theorem rootRing_mono {s t : Finset ℕ} (hst : s ⊆ t) : rootRing s ≤ rootRing t := by + apply Algebra.adjoin_mono + exact Set.union_subset_union_right _ (Set.image_mono hst) + +theorem GaussianRing_le_rootRing (s : Finset ℕ) : GaussianRing ≤ rootRing s := + Algebra.adjoin_mono Set.subset_union_left + +theorem awayRing_le_B (u p : ℕ) : awayRing u p ≤ B u := + rootRing_mono (Finset.erase_subset _ _) + +def awayInclusion (u p : ℕ) : awayRing u p →ₐ[ℤ] B u := + Subalgebra.inclusion (awayRing_le_B u p) + +def gaussianToB (u : ℕ) : GaussianRing →ₐ[ℤ] B u := + Subalgebra.inclusion (GaussianRing_le_rootRing _) + +def gaussianToAway (u p : ℕ) : GaussianRing →ₐ[ℤ] awayRing u p := + Subalgebra.inclusion (GaussianRing_le_rootRing _) + +@[simp] theorem coe_awayInclusion (u p : ℕ) (x : awayRing u p) : + (awayInclusion u p x).val = x.val := by + exact Subalgebra.coe_inclusion (R := ℤ) (A := ℂ) + (S := awayRing u p) (T := B u) (awayRing_le_B u p) x + +@[simp] theorem coe_gaussianToB (u : ℕ) (x : GaussianRing) : + (gaussianToB u x).val = x.val := by + exact Subalgebra.coe_inclusion (R := ℤ) (A := ℂ) + (S := GaussianRing) (T := B u) (GaussianRing_le_rootRing _) x + +@[simp] theorem coe_gaussianToAway (u p : ℕ) (x : GaussianRing) : + (gaussianToAway u p x).val = x.val := by + exact Subalgebra.coe_inclusion (R := ℤ) (A := ℂ) + (S := GaussianRing) (T := awayRing u p) (GaussianRing_le_rootRing _) x + +theorem gaussian_mem (s : Finset ℕ) (a b : ℤ) : + (a : ℂ) + (b : ℂ) * Complex.I ∈ rootRing s := + (rootRing s).add_mem ((rootRing s).algebraMap_mem a) + ((rootRing s).mul_mem ((rootRing s).algebraMap_mem b) (I_mem_rootRing s)) + +private theorem star_mem_adjoin {S : Set ℂ} + (hS : ∀ z ∈ S, star z ∈ Algebra.adjoin ℤ S) {z : ℂ} + (hz : z ∈ Algebra.adjoin ℤ S) : star z ∈ Algebra.adjoin ℤ S := by + refine Algebra.adjoin_induction (p := fun z _ => star z ∈ Algebra.adjoin ℤ S) + hS ?_ ?_ ?_ hz + · intro a + simp + · intro x y _ _ hx hy + simpa only [star_add] using (Algebra.adjoin ℤ S).add_mem hx hy + · intro x y _ _ hx hy + simpa only [star_mul] using (Algebra.adjoin ℤ S).mul_mem hy hx + +theorem star_mem_GaussianRing {z : ℂ} (hz : z ∈ GaussianRing) : + star z ∈ GaussianRing := by + apply star_mem_adjoin (S := ({Complex.I} : Set ℂ)) ?_ hz + rintro z (rfl : z = Complex.I) + simp + +theorem star_mem_rootRing (s : Finset ℕ) {z : ℂ} (hz : z ∈ rootRing s) : + star z ∈ rootRing s := by + apply star_mem_adjoin ?_ hz + rintro z (hI | ⟨p, hp, rfl⟩) + · rcases hI with rfl + simpa [rootRing] using (rootRing s).neg_mem (I_mem_rootRing s) + · by_cases hp0 : p = 0 + · simpa only [hp0, rho_zero, star_one, rootRing] using (rootRing s).one_mem + · rw [star_rho p hp0] + exact (rootRing s).pow_mem (rho_mem_rootRing s p hp) _ + +instance GaussianRingStarRing : StarRing GaussianRing where + star x := ⟨star (x : ℂ), star_mem_GaussianRing x.property⟩ + star_involutive x := Subtype.ext (star_star (x : ℂ)) + star_mul x y := Subtype.ext (star_mul (x : ℂ) (y : ℂ)) + star_add x y := Subtype.ext (star_add (x : ℂ) (y : ℂ)) + +instance rootRingStarRing (s : Finset ℕ) : StarRing (rootRing s) where + star x := ⟨star (x : ℂ), star_mem_rootRing s x.property⟩ + star_involutive x := Subtype.ext (star_star (x : ℂ)) + star_mul x y := Subtype.ext (star_mul (x : ℂ) (y : ℂ)) + star_add x y := Subtype.ext (star_add (x : ℂ) (y : ℂ)) + +@[simp] theorem coe_star_GaussianRing (x : GaussianRing) : + ((star x : GaussianRing) : ℂ) = star (x : ℂ) := rfl + +@[simp] theorem coe_star_rootRing (s : Finset ℕ) (x : rootRing s) : + ((star x : rootRing s) : ℂ) = star (x : ℂ) := rfl + +@[simp] theorem gaussianToB_star (u : ℕ) (x : GaussianRing) : + gaussianToB u (star x) = star (gaussianToB u x) := by + apply Subtype.ext + exact (coe_gaussianToB u (star x)).trans + ((coe_star_GaussianRing x).trans + ((congrArg (star : ℂ → ℂ) (coe_gaussianToB u x).symm).trans + (coe_star_rootRing u.primeFactors (gaussianToB u x)).symm)) + +@[simp] theorem gaussianToAway_star (u p : ℕ) (x : GaussianRing) : + gaussianToAway u p (star x) = star (gaussianToAway u p x) := by + apply Subtype.ext + exact (coe_gaussianToAway u p (star x)).trans + ((coe_star_GaussianRing x).trans + ((congrArg (star : ℂ → ℂ) (coe_gaussianToAway u p x).symm).trans + (coe_star_rootRing (u.primeFactors.erase p) (gaussianToAway u p x)).symm)) + +private theorem rho_finite_order (p : ℕ) : ∃ n : ℕ, n ≠ 0 ∧ rho p ^ n = 1 := by + by_cases hp : p = 0 + · exact ⟨1, by decide, by simp [hp]⟩ + · exact ⟨p, hp, rho_pow p hp⟩ + +private theorem map_star_of_pow_eq_one (S : Subalgebra ℤ ℂ) [StarRing S] + (hstar : ∀ x : S, ((star x : S) : ℂ) = star (x : ℂ)) + (σ : S →+* ℂ) (x : S) (n : ℕ) (hn : n ≠ 0) (hx : (x : ℂ) ^ n = 1) : + σ (star x) = star (σ x) := by + have hxS : x ^ n = 1 := Subtype.ext hx + have hsource : star x = x ^ (n - 1) := by + apply Subtype.ext + simpa only [hstar, Subalgebra.coe_pow] using star_eq_pow_pred_of_pow_eq_one hn hx + have htarget : σ x ^ n = 1 := by rw [← map_pow, hxS, map_one] + rw [hsource, map_pow, star_eq_pow_pred_of_pow_eq_one hn htarget] + +private theorem map_star_adjoin (S : Set ℂ) [StarRing (Algebra.adjoin ℤ S)] + (hstar : ∀ x : Algebra.adjoin ℤ S, ((star x : Algebra.adjoin ℤ S) : ℂ) = star (x : ℂ)) + (hS : ∀ z ∈ S, ∃ n : ℕ, n ≠ 0 ∧ z ^ n = 1) + (σ : Algebra.adjoin ℤ S →+* ℂ) (x : Algebra.adjoin ℤ S) : + σ (star x) = star (σ x) := by + rcases x with ⟨x, hx⟩ + refine Algebra.adjoin_induction + (p := fun z hz => σ (star (⟨z, hz⟩ : Algebra.adjoin ℤ S)) = + star (σ (⟨z, hz⟩ : Algebra.adjoin ℤ S))) ?_ ?_ ?_ ?_ hx + · intro z hz + obtain ⟨n, hn, hzn⟩ := hS z hz + exact map_star_of_pow_eq_one _ hstar σ ⟨z, Algebra.subset_adjoin hz⟩ n hn hzn + · intro a + change σ (star (a : Algebra.adjoin ℤ S)) = star (σ (a : Algebra.adjoin ℤ S)) + simp + · intro z w hz hw hzp hwp + change σ (star ((⟨z, hz⟩ : Algebra.adjoin ℤ S) + ⟨w, hw⟩)) = + star (σ ((⟨z, hz⟩ : Algebra.adjoin ℤ S) + ⟨w, hw⟩)) + simpa only [star_add, map_add] using congrArg₂ (· + ·) hzp hwp + · intro z w hz hw hzp hwp + change σ (star ((⟨z, hz⟩ : Algebra.adjoin ℤ S) * ⟨w, hw⟩)) = + star (σ ((⟨z, hz⟩ : Algebra.adjoin ℤ S) * ⟨w, hw⟩)) + simpa only [star_mul, map_mul] using congrArg₂ (· * ·) hwp hzp + +/-- Every complex-valued ring map respects the actual conjugation. -/ +theorem map_star_rootRing (s : Finset ℕ) (σ : rootRing s →+* ℂ) (x : rootRing s) : + σ (star x) = star (σ x) := by + apply @map_star_adjoin (({Complex.I} : Set ℂ) ∪ rho '' (s : Set ℕ)) + (rootRingStarRing s) (coe_star_rootRing s) ?_ σ x + rintro z (hI | ⟨p, _, rfl⟩) + · rcases hI with rfl + exact ⟨4, by decide, Complex.I_pow_four⟩ + · exact rho_finite_order p + +theorem map_star_B (u : ℕ) (σ : B u →+* ℂ) (x : B u) : + σ (star x) = star (σ x) := map_star_rootRing _ σ x + +theorem map_star_awayRing (u p : ℕ) (σ : awayRing u p →+* ℂ) (x : awayRing u p) : + σ (star x) = star (σ x) := map_star_rootRing _ σ x + +theorem map_star_GaussianRing (σ : GaussianRing →+* ℂ) (x : GaussianRing) : + σ (star x) = star (σ x) := by + apply @map_star_adjoin ({Complex.I} : Set ℂ) GaussianRingStarRing + coe_star_GaussianRing ?_ σ x + rintro z (rfl : z = Complex.I) + exact ⟨4, by decide, Complex.I_pow_four⟩ + +private theorem integral_of_finite_order {z : ℂ} (h : ∃ n : ℕ, n ≠ 0 ∧ z ^ n = 1) : + IsIntegral ℤ z := by + obtain ⟨n, hn, hz⟩ := h + apply IsIntegral.of_pow (Nat.pos_of_ne_zero hn) + rw [hz] + exact isIntegral_one + +instance rootRing_finite (s : Finset ℕ) : Module.Finite ℤ (rootRing s) := by + apply Algebra.finite_adjoin_of_finite_of_isIntegral + ((Set.finite_singleton Complex.I).union (s.finite_toSet.image rho)) + rintro z (hI | ⟨p, _, rfl⟩) + · rcases hI with rfl + exact integral_of_finite_order ⟨4, by decide, Complex.I_pow_four⟩ + · exact integral_of_finite_order (rho_finite_order p) + +instance GaussianRing_finite : Module.Finite ℤ GaussianRing := + Algebra.finite_adjoin_simple_of_isIntegral + (integral_of_finite_order ⟨4, by decide, Complex.I_pow_four⟩) + +private theorem primitive_mul {z w : ℂ} {m n : ℕ} + (hz : IsPrimitiveRoot z m) (hw : IsPrimitiveRoot w n) (hcop : m.Coprime n) : + IsPrimitiveRoot (z * w) (m * n) := by + have horder := (Commute.all z w).orderOf_mul_eq_mul_orderOf_of_coprime + (by simpa only [← hz.eq_orderOf, ← hw.eq_orderOf] using hcop) + rw [← hz.eq_orderOf, ← hw.eq_orderOf] at horder + rw [← horder] + exact IsPrimitiveRoot.orderOf _ + +theorem prime_roots_prod_primitive (s : Finset ℕ) (hs : ∀ p ∈ s, Nat.Prime p) : + IsPrimitiveRoot (∏ p ∈ s, rho p) (∏ p ∈ s, p) := by + classical + revert hs + induction s using Finset.induction_on with + | empty => + intro _ + simp + | @insert p s hp ih => + intro hs + have hpp := hs p (Finset.mem_insert_self p s) + have hsp : ∀ q ∈ s, Nat.Prime q := fun q hq => hs q (Finset.mem_insert_of_mem hq) + rw [Finset.prod_insert hp, Finset.prod_insert hp] + apply primitive_mul (rho_isPrimitiveRoot p hpp.ne_zero) (ih hsp) + apply Nat.coprime_prod_right_iff.mpr + intro q hq + apply (Nat.coprime_primes hpp (hsp q hq)).mpr + intro heq + exact hp (heq.symm ▸ hq) + +/-- The single generator of a finite prime-root ring. -/ +def etaOf (s : Finset ℕ) : ℂ := Complex.I * ∏ q ∈ s, rho q + +def orderOfSet (s : Finset ℕ) : ℕ := 4 * ∏ q ∈ s, q + +theorem etaOf_isPrimitiveRoot (s : Finset ℕ) + (hs : ∀ p ∈ s, Nat.Prime p) (hodd : ∀ p ∈ s, Odd p) : + IsPrimitiveRoot (etaOf s) (orderOfSet s) := by + apply primitive_mul I_isPrimitiveRoot (prime_roots_prod_primitive s hs) + apply Nat.coprime_prod_right_iff.mpr + intro p hp + simpa using ((hodd p hp).coprime_two_left.pow_left 2) + +theorem orderOfSet_pos (s : Finset ℕ) (hs : ∀ p ∈ s, Nat.Prime p) : + 0 < orderOfSet s := + Nat.mul_pos (by decide) (Finset.prod_pos (fun p hp => (hs p hp).pos)) + +theorem rootRing_eq_singleton (s : Finset ℕ) + (hs : ∀ p ∈ s, Nat.Prime p) (hodd : ∀ p ∈ s, Odd p) : + rootRing s = Algebra.adjoin ℤ ({etaOf s} : Set ℂ) := by + classical + have hη := etaOf_isPrimitiveRoot s hs hodd + let : NeZero (orderOfSet s) := ⟨(orderOfSet_pos s hs).ne'⟩ + have hηmem : etaOf s ∈ rootRing s := + (rootRing s).mul_mem (I_mem_rootRing s) + ((rootRing s).prod_mem (fun q hq => rho_mem_rootRing s q hq)) + have hpower {z : ℂ} (hz : z ^ orderOfSet s = 1) : + z ∈ Algebra.adjoin ℤ ({etaOf s} : Set ℂ) := by + obtain ⟨j, _, hj⟩ := hη.eq_pow_of_pow_eq_one hz + rw [← hj] + exact (Algebra.adjoin ℤ ({etaOf s} : Set ℂ)).pow_mem + (Algebra.subset_adjoin (by simp)) j + apply le_antisymm + · apply Algebra.adjoin_le + rintro z (hI | ⟨q, hq, rfl⟩) + · rcases hI with rfl + apply hpower + exact (I_isPrimitiveRoot.pow_eq_one_iff_dvd _).mpr (dvd_mul_right 4 _) + · apply hpower + apply ((rho_isPrimitiveRoot q (hs q hq).ne_zero).pow_eq_one_iff_dvd _).mpr + exact (Finset.dvd_prod_of_mem (fun q : ℕ => q) hq).trans (dvd_mul_left _ 4) + · apply Algebra.adjoin_le + simpa using hηmem + +def eta (u p : ℕ) : ℂ := etaOf (u.primeFactors.erase p) + +def awayOrder (u p : ℕ) : ℕ := orderOfSet (u.primeFactors.erase p) + +theorem eta_isPrimitiveRoot (u p : ℕ) (hu : Odd u) : + IsPrimitiveRoot (eta u p) (awayOrder u p) := by + apply etaOf_isPrimitiveRoot + · intro q hq + exact Nat.prime_of_mem_primeFactors (Finset.mem_of_mem_erase hq) + · intro q hq + exact hu.of_dvd_nat (Nat.dvd_of_mem_primeFactors (Finset.mem_of_mem_erase hq)) + +theorem awayOrder_pos (u p : ℕ) : 0 < awayOrder u p := + orderOfSet_pos _ (fun _q hq => Nat.prime_of_mem_primeFactors (Finset.mem_of_mem_erase hq)) + +theorem awayRing_eq_singleton (u p : ℕ) (hu : Odd u) : + awayRing u p = Algebra.adjoin ℤ ({eta u p} : Set ℂ) := by + apply rootRing_eq_singleton + · intro q hq + exact Nat.prime_of_mem_primeFactors (Finset.mem_of_mem_erase hq) + · intro q hq + exact hu.of_dvd_nat (Nat.dvd_of_mem_primeFactors (Finset.mem_of_mem_erase hq)) + +theorem prime_not_dvd_awayOrder (u p : ℕ) (hu : Odd u) (hp : p ∈ u.primeFactors) : + ¬p ∣ awayOrder u p := by + have hpp := Nat.prime_of_mem_primeFactors hp + apply hpp.coprime_iff_not_dvd.mp + change p.Coprime (4 * ∏ q ∈ u.primeFactors.erase p, q) + apply Nat.coprime_mul_iff_right.mpr + constructor + · have hodd := hu.of_dvd_nat (Nat.dvd_of_mem_primeFactors hp) + simpa using hodd.coprime_two_right.pow_right 2 + · apply Nat.coprime_prod_right_iff.mpr + intro q hq + apply (Nat.coprime_primes hpp + (Nat.prime_of_mem_primeFactors (Finset.mem_of_mem_erase hq))).mpr + exact (Finset.ne_of_mem_erase hq).symm + +theorem B_eq_adjoin_away (u p : ℕ) (hp : p ∈ u.primeFactors) : + B u = (Algebra.adjoin (awayRing u p) ({rho p} : Set ℂ)).restrictScalars ℤ := by + change Algebra.adjoin ℤ (({Complex.I} : Set ℂ) ∪ rho '' (u.primeFactors : Set ℕ)) = + (Algebra.adjoin + (Algebra.adjoin ℤ (({Complex.I} : Set ℂ) ∪ rho '' ((u.primeFactors.erase p : Finset ℕ) : Set ℕ))) + ({rho p} : Set ℂ)).restrictScalars ℤ + rw [← Algebra.adjoin_union_eq_adjoin_adjoin] + congr 1 + ext z + constructor + · rintro (hI | ⟨q, hq, rfl⟩) + · exact Or.inl (Or.inl hI) + · by_cases heq : q = p + · exact Or.inr (by simp [heq]) + · exact Or.inl (Or.inr ⟨q, Finset.mem_erase.mpr ⟨heq, hq⟩, rfl⟩) + · rintro ((hI | ⟨q, hq, rfl⟩) | heq) + · exact Or.inl hI + · exact Or.inr ⟨q, Finset.mem_of_mem_erase hq, rfl⟩ + · exact Or.inr ⟨p, hp, (Set.mem_singleton_iff.mp heq).symm⟩ + +end CirculantHadamard.CyclotomicRings + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/CirculantHadamard/CyclotomicTorsion.lean b/lean/OAI/LinearAlgebra/CirculantHadamard/CyclotomicTorsion.lean new file mode 100644 index 0000000000000000000000000000000000000000..fe455746bbd781ad8db4e9cfd97f0b7ff5c570cb --- /dev/null +++ b/lean/OAI/LinearAlgebra/CirculantHadamard/CyclotomicTorsion.lean @@ -0,0 +1,34 @@ +import OAI.LinearAlgebra.CirculantHadamard.CyclotomicRings +import OAI.LinearAlgebra.CirculantHadamard.Kronecker + +namespace OAI + +/-! +# Kronecker's criterion in the actual alternating coefficient ring + +The finite generator and root-of-unity hypotheses are discharged for the +literal ring `B u = ℤ[i, rho_p : p ∣ u]`. The modulus-one hypothesis follows +for alternating products by clearing the actual product denominator and +evaluating the norm identities. +-/ + +namespace CirculantHadamard + +theorem B_root_of_unity (u : ℕ) (z : CyclotomicRings.B u) + (hz : ∀ σ : CyclotomicRings.B u →+* ℂ, ‖σ z‖ = 1) : + ∃ n : ℕ, 0 < n ∧ z ^ n = 1 := by + apply finite_adjoin_root_of_unity + (({Complex.I} : Set ℂ) ∪ CyclotomicRings.rho '' (u.primeFactors : Set ℕ)) + ((Set.finite_singleton Complex.I).union + (u.primeFactors.finite_toSet.image CyclotomicRings.rho)) ?_ z hz + intro ζ hζ + rcases hζ with hI | ⟨p, hp, rfl⟩ + · have hζI : ζ = Complex.I := Set.mem_singleton_iff.mp hI + subst ζ + exact ⟨4, by decide, CyclotomicRings.I_isPrimitiveRoot.pow_eq_one⟩ + · have hprime : p.Prime := (Nat.mem_primeFactors.mp hp).1 + exact ⟨p, hprime.pos, CyclotomicRings.rho_pow p hprime.ne_zero⟩ + +end CirculantHadamard + +end OAI diff --git a/lean/OAI/LinearAlgebra/CirculantHadamard/DyadicRemainder.lean b/lean/OAI/LinearAlgebra/CirculantHadamard/DyadicRemainder.lean new file mode 100644 index 0000000000000000000000000000000000000000..b6f2057fc5a3a4e7bd7ea6ab2382fe7c9545cce6 --- /dev/null +++ b/lean/OAI/LinearAlgebra/CirculantHadamard/DyadicRemainder.lean @@ -0,0 +1,136 @@ +import Mathlib.Algebra.Polynomial.Div +import Mathlib.RingTheory.Polynomial.Cyclotomic.Basic + +namespace OAI + +universe uR + +/-! +# Paired coefficients in a dyadic cyclotomic remainder + +Reducing a polynomial of length `2 * m` modulo `X ^ m + 1` subtracts +the upper block of coefficients from the lower block. The construction +and the coefficient formulas work over every commutative ring. +-/ + +noncomputable section + +namespace CirculantHadamard.DyadicRemainder + +open Polynomial Finset + +variable {R : Type uR} [CommRing R] + +/-- The polynomial with the first `n` entries of a coefficient function. -/ +def coefficientPolynomial (n : ℕ) (c : ℕ → R) : R[X] := + ∑ i ∈ range n, monomial i (c i) + +/-- The difference between coefficient blocks at distance `m`. -/ +def remainder (m : ℕ) (c : ℕ → R) : R[X] := + coefficientPolynomial m (fun i => c i - c (i + m)) + +@[simp] +theorem coefficientPolynomial_coeff (n : ℕ) (c : ℕ → R) (j : ℕ) : + (coefficientPolynomial n c).coeff j = if j < n then c j else 0 := by + classical + simp [coefficientPolynomial, coeff_monomial] + +theorem degree_coefficientPolynomial_lt (n : ℕ) (c : ℕ → R) : + (coefficientPolynomial n c).degree < (n : WithBot ℕ) := by + rw [degree_lt_iff_coeff_zero] + intro j hj + simp only [coefficientPolynomial_coeff, ite_eq_right (not_lt.mpr hj)] + +theorem natDegree_coefficientPolynomial_lt {n : ℕ} (hn : 0 < n) (c : ℕ → R) : + (coefficientPolynomial n c).natDegree < n := by + by_cases hzero : coefficientPolynomial n c = 0 + · simpa only [hzero, natDegree_zero] using hn + · exact (natDegree_lt_iff_degree_lt hzero).mpr (degree_coefficientPolynomial_lt n c) + +@[simp] +theorem remainder_coeff (m : ℕ) (c : ℕ → R) (j : ℕ) (hj : j < m) : + (remainder m c).coeff j = c j - c (j + m) := by + simp only [remainder, coefficientPolynomial_coeff, ite_eq_left hj] + +theorem remainder_coeff_eq_zero (m : ℕ) (c : ℕ → R) (j : ℕ) (hj : m ≤ j) : + (remainder m c).coeff j = 0 := by + simp only [remainder, coefficientPolynomial_coeff, ite_eq_right (not_lt.mpr hj)] + +theorem degree_remainder_lt (m : ℕ) (c : ℕ → R) : + (remainder m c).degree < (m : WithBot ℕ) := + degree_coefficientPolynomial_lt m _ + +theorem natDegree_remainder_lt {m : ℕ} (hm : 0 < m) (c : ℕ → R) : + (remainder m c).natDegree < m := + natDegree_coefficientPolynomial_lt hm _ + +theorem remainder_eq_sub (m : ℕ) (c : ℕ → R) : + remainder m c = coefficientPolynomial m c - + coefficientPolynomial m (fun i => c (i + m)) := by + simp only [remainder, coefficientPolynomial, monomial_sub, sum_sub_distrib] + +/-- Split the coefficient polynomial into its lower and upper blocks. -/ +theorem coefficientPolynomial_two_mul (m : ℕ) (c : ℕ → R) : + coefficientPolynomial (2 * m) c = coefficientPolynomial m c + + X ^ m * coefficientPolynomial m (fun i => c (i + m)) := by + classical + calc + coefficientPolynomial (2 * m) c = coefficientPolynomial m c + + ∑ i ∈ range m, monomial (m + i) (c (m + i)) := by + rw [two_mul] + exact sum_range_add (fun i => monomial i (c i)) m m + _ = coefficientPolynomial m c + + X ^ m * coefficientPolynomial m (fun i => c (i + m)) := by + congr 1 + simp only [coefficientPolynomial, mul_sum, X_pow_mul_monomial] + apply sum_congr rfl + intro i _ + rw [Nat.add_comm m i] + +/-- The explicit quotient/remainder equation before applying monic division. -/ +theorem remainder_add_mul (m : ℕ) (c : ℕ → R) : + remainder m c + (X ^ m + 1) * + coefficientPolynomial m (fun i => c (i + m)) = coefficientPolynomial (2 * m) c := by + rw [remainder_eq_sub, add_mul, one_mul, + add_comm (X ^ m * coefficientPolynomial m (fun i => c (i + m))) + (coefficientPolynomial m (fun i => c (i + m))), + ← add_assoc, sub_add_cancel] + exact (coefficientPolynomial_two_mul m c).symm + +/-- The canonical monic remainder is exactly the paired coefficient difference. -/ +theorem coefficientPolynomial_modByMonic {m : ℕ} (hm : 0 < m) (c : ℕ → R) : + coefficientPolynomial (2 * m) c %ₘ (X ^ m + 1) = remainder m c := by + nontriviality R + have hmonic : (X ^ m + (1 : R[X])).Monic := by + simpa only [C_1] using (monic_X_pow_add_C (1 : R) hm.ne') + apply (div_modByMonic_unique + (coefficientPolynomial m (fun i => c (i + m))) (remainder m c) hmonic ?_).2 + refine ⟨remainder_add_mul m c, ?_⟩ + have hdegree : (X ^ m + (1 : R[X])).degree = (m : WithBot ℕ) := by + simpa only [C_1] using (degree_X_pow_add_C hm (1 : R)) + rw [hdegree] + exact degree_remainder_lt m c + +/-- Coefficients below the half-length in the canonical monic remainder. -/ +theorem coefficientPolynomial_modByMonic_coeff {m : ℕ} (hm : 0 < m) + (c : ℕ → R) (j : ℕ) (hj : j < m) : + (coefficientPolynomial (2 * m) c %ₘ (X ^ m + 1)).coeff j = c j - c (j + m) := by + rw [coefficientPolynomial_modByMonic hm, remainder_coeff m c j hj] + +/-- The dyadic cyclotomic polynomial has the expected two terms. -/ +theorem cyclotomic_two_pow_succ (R : Type uR) [CommRing R] (k : ℕ) : + cyclotomic (2 ^ (k + 1)) R = (X : R[X]) ^ (2 ^ k) + 1 := by + rw [cyclotomic_prime_pow_eq_geom_sum Nat.prime_two, geom_sum_two] + +/-- The remainder statement specialized to the dyadic cyclotomic polynomial. -/ +theorem coefficientPolynomial_modByMonic_cyclotomic (k : ℕ) (c : ℕ → R) : + coefficientPolynomial (2 ^ (k + 1)) c %ₘ cyclotomic (2 ^ (k + 1)) R = + remainder (2 ^ k) c := by + rw [cyclotomic_two_pow_succ, pow_succ, Nat.mul_comm (2 ^ k) 2] + exact coefficientPolynomial_modByMonic (pow_pos (by decide : 0 < (2 : ℕ)) k) c + +end CirculantHadamard.DyadicRemainder + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/CirculantHadamard/FirstOrderResidue.lean b/lean/OAI/LinearAlgebra/CirculantHadamard/FirstOrderResidue.lean new file mode 100644 index 0000000000000000000000000000000000000000..a7a78b4da0a6ce5deea097d9ce1496558fd7bfff --- /dev/null +++ b/lean/OAI/LinearAlgebra/CirculantHadamard/FirstOrderResidue.lean @@ -0,0 +1,150 @@ +import Mathlib.Algebra.BigOperators.Group.Finset.Basic +import Mathlib.Algebra.Group.Subgroup.Defs +import Mathlib.Algebra.Ring.Hom.Defs +import Mathlib.Tactic.LinearCombination +import Mathlib.Tactic.Ring + +namespace OAI + +universe uO uK uIota + +/-! +# First-order residues of principal units + +For a nonzero element `t` of a domain, a unit of the form `1 + t * a` has a +unique coefficient `a`. A ring homomorphism killing `t` sends the coefficient +of a product to the sum of the coefficients. This constructs the actual +first-order homomorphism without identifying any quotient rings. +-/ + +namespace CirculantHadamard + +open scoped BigOperators + +variable {O : Type uO} [CommRing O] + +/-- Units whose difference from one is a multiple of the specified element. -/ +def principalUnits (t : O) : Subgroup Oˣ where + carrier := {u | ∃ a : O, (u : O) = 1 + t * a} + one_mem' := ⟨0, by simp⟩ + mul_mem' := by + rintro u v ⟨a, ha⟩ ⟨b, hb⟩ + refine ⟨a + b + t * a * b, ?_⟩ + change (u : O) * (v : O) = _ + rw [ha, hb] + ring + inv_mem' := by + rintro u ⟨a, ha⟩ + refine ⟨-a * (↑u⁻¹ : O), ?_⟩ + have h := u.mul_inv + rw [ha] at h + linear_combination h + +@[simp] +theorem mem_principalUnits (t : O) (u : Oˣ) : + u ∈ principalUnits t ↔ ∃ a : O, (u : O) = 1 + t * a := + Iff.rfl + +/-- The coefficient of a principal unit. Its uniqueness is proved separately +using the domain assumption and `t ≠ 0`. -/ +noncomputable def principalUnitCoeff (t : O) (u : principalUnits t) : O := + Classical.choose u.property + +theorem principalUnitCoeff_spec (t : O) (u : principalUnits t) : + ((u : Oˣ) : O) = 1 + t * principalUnitCoeff t u := + Classical.choose_spec u.property + +section Domain + +variable [IsDomain O] + +theorem principalUnitCoeff_eq (t : O) (ht : t ≠ 0) (u : principalUnits t) + {a : O} (ha : ((u : Oˣ) : O) = 1 + t * a) : + principalUnitCoeff t u = a := by + apply mul_left_cancel₀ ht + exact add_left_cancel ((principalUnitCoeff_spec t u).symm.trans ha) + +theorem principalUnitCoeff_mul (t : O) (ht : t ≠ 0) + (u v : principalUnits t) : + principalUnitCoeff t (u * v) = + principalUnitCoeff t u + principalUnitCoeff t v + + t * principalUnitCoeff t u * principalUnitCoeff t v := by + apply principalUnitCoeff_eq t ht + change ((u : Oˣ) : O) * ((v : Oˣ) : O) = _ + rw [principalUnitCoeff_spec, principalUnitCoeff_spec] + ring + +variable {K : Type uK} [Field K] + +/-- The actual first-order homomorphism associated with a nonzero element +killed by the given residue map. `Multiplicative K` uses addition in `K`. -/ +noncomputable def actualFirstOrder (φ : O →+* K) (t : O) (ht : t ≠ 0) + (hφt : φ t = 0) : principalUnits t →* Multiplicative K where + toFun u := Multiplicative.ofAdd (φ (principalUnitCoeff t u)) + map_one' := by + apply Multiplicative.toAdd.injective + change φ (principalUnitCoeff t 1) = 0 + rw [principalUnitCoeff_eq t ht 1 (a := 0) (by simp), map_zero] + map_mul' u v := by + apply Multiplicative.toAdd.injective + change φ (principalUnitCoeff t (u * v)) = + φ (principalUnitCoeff t u) + φ (principalUnitCoeff t v) + rw [principalUnitCoeff_mul t ht] + simp [hφt] + +theorem actualFirstOrder_apply_of_eq (φ : O →+* K) (t : O) (ht : t ≠ 0) + (hφt : φ t = 0) (u : principalUnits t) {a : O} + (ha : ((u : Oˣ) : O) = 1 + t * a) : + (actualFirstOrder φ t ht hφt u).toAdd = φ a := by + change φ (principalUnitCoeff t u) = φ a + rw [principalUnitCoeff_eq t ht u ha] + +/-- An exact signed product identity among principal units gives a vanishing +sum of their first-order residues. Representations are required only on `s`. -/ +theorem first_order_sum_eq_zero_of_prod_eq_one {ι : Type uIota} + (φ : O →+* K) (t : O) (ht : t ≠ 0) (hφt : φ t = 0) + (s : Finset ι) (u : ι → Oˣ) (L : ι → O) (ε : ι → ℤ) + (hrep : ∀ i ∈ s, (u i : O) = 1 + t * L i) + (hprod : (∏ i ∈ s, (u i) ^ (ε i)) = 1) : + ∑ i ∈ s, (ε i : K) * φ (L i) = 0 := by + classical + let v : ι → principalUnits t := fun i => + if hi : i ∈ s then ⟨u i, ⟨L i, hrep i hi⟩⟩ else 1 + have hv (i : ι) (hi : i ∈ s) : (v i : Oˣ) = u i := by + simp only [v, dite_eq_left hi] + have hp : (∏ i ∈ s, (v i) ^ (ε i)) = 1 := by + apply Subtype.ext + change (principalUnits t).subtype (∏ i ∈ s, (v i) ^ (ε i)) = + (principalUnits t).subtype 1 + rw [map_prod, map_one] + calc + (∏ i ∈ s, (principalUnits t).subtype ((v i) ^ (ε i))) = + ∏ i ∈ s, (u i) ^ (ε i) := by + apply Finset.prod_congr rfl + intro i hi + rw [map_zpow] + change (v i : Oˣ) ^ (ε i) = (u i) ^ (ε i) + rw [hv i hi] + _ = 1 := hprod + have hmap := congrArg + (fun z : principalUnits t => (actualFirstOrder φ t ht hφt z).toAdd) hp + have hsum : + (∑ i ∈ s, (ε i) • (actualFirstOrder φ t ht hφt (v i)).toAdd) = 0 := by + simpa only [map_prod, map_zpow, toAdd_prod, + toAdd_zpow, map_one, toAdd_one] using hmap + calc + (∑ i ∈ s, (ε i : K) * φ (L i)) = + ∑ i ∈ s, (ε i) • (actualFirstOrder φ t ht hφt (v i)).toAdd := by + apply Finset.sum_congr rfl + intro i hi + have hvi : ((v i : Oˣ) : O) = 1 + t * L i := by + rw [hv i hi] + exact hrep i hi + rw [actualFirstOrder_apply_of_eq φ t ht hφt (v i) hvi, zsmul_eq_mul] + _ = 0 := hsum + +end Domain + +end CirculantHadamard + +end OAI diff --git a/lean/OAI/LinearAlgebra/CirculantHadamard/IntegerLocalDivisibility.lean b/lean/OAI/LinearAlgebra/CirculantHadamard/IntegerLocalDivisibility.lean new file mode 100644 index 0000000000000000000000000000000000000000..b7d5cd6bae1f8a24b1b3024f4e010670d2be6657 --- /dev/null +++ b/lean/OAI/LinearAlgebra/CirculantHadamard/IntegerLocalDivisibility.lean @@ -0,0 +1,58 @@ +import Mathlib.RingTheory.Localization.AtPrime.Basic +import Mathlib.Algebra.Prime.Lemmas +import Mathlib.Data.Nat.Prime.Int + +namespace OAI + +universe uA + +/-! +# Reflecting prime-power divisibility from the localized integers + +A denominator inverted in the localization at `(p)` is not divisible by `p`. +Clearing that denominator and using primality therefore reflects divisibility +by every power of `p` back to the integers. The argument includes the zeroth +power and the zero numerator, without any nonzero numerator hypothesis. +-/ + +namespace CirculantHadamard + +/-- Divisibility by a rational prime power in its actual integer localization +implies the same divisibility in the integers. -/ +theorem integer_prime_pow_dvd_of_localization + {A : Type uA} [CommRing A] [Algebra ℤ A] + {P : Ideal ℤ} [P.IsPrime] [IsLocalization.AtPrime A P] + {p : ℕ} (hp : p.Prime) (hP : P = Ideal.span ({(p : ℤ)} : Set ℤ)) + (t : ℕ) (x : ℤ) (hx : (p : A) ^ t ∣ algebraMap ℤ A x) : + (p : ℤ) ^ t ∣ x := by + obtain ⟨y, hy⟩ := hx + obtain ⟨⟨a, s⟩, hs⟩ := IsLocalization.surj P.primeCompl y + have hinj : Function.Injective (algebraMap ℤ A) := + IsLocalization.injective A P.primeCompl_le_nonZeroDivisors + have hclear : x * (s : ℤ) = (p : ℤ) ^ t * a := by + apply hinj + rw [map_mul, map_mul, map_pow, map_natCast, hy, mul_assoc, hs] + have hsprime : ¬ (p : ℤ) ∣ (s : ℤ) := by + intro hdiv + have hmem : (s : ℤ) ∈ Ideal.span ({(p : ℤ)} : Set ℤ) := + Ideal.mem_span_singleton.mpr hdiv + exact s.property (hP.symm ▸ hmem) + exact (Nat.prime_iff_prime_int.mp hp).pow_dvd_of_dvd_mul_right t hsprime + ⟨a, hclear⟩ + +/-- Prime-power divisibility of integer coefficients is unchanged by +localization at that prime. -/ +theorem integer_prime_pow_dvd_localization_iff + {A : Type uA} [CommRing A] [Algebra ℤ A] + {P : Ideal ℤ} [P.IsPrime] [IsLocalization.AtPrime A P] + {p : ℕ} (hp : p.Prime) (hP : P = Ideal.span ({(p : ℤ)} : Set ℤ)) + (t : ℕ) (x : ℤ) : + (p : A) ^ t ∣ algebraMap ℤ A x ↔ (p : ℤ) ^ t ∣ x := by + constructor + · exact integer_prime_pow_dvd_of_localization hp hP t x + · intro hx + simpa only [map_pow, map_natCast] using map_dvd (algebraMap ℤ A) hx + +end CirculantHadamard + +end OAI diff --git a/lean/OAI/LinearAlgebra/CirculantHadamard/IntegerTwoLocal.lean b/lean/OAI/LinearAlgebra/CirculantHadamard/IntegerTwoLocal.lean new file mode 100644 index 0000000000000000000000000000000000000000..1976947e7e46b4e2689f8c01eeaccd796cc105b8 --- /dev/null +++ b/lean/OAI/LinearAlgebra/CirculantHadamard/IntegerTwoLocal.lean @@ -0,0 +1,93 @@ +import OAI.LinearAlgebra.CirculantHadamard.LocalDVR +import Mathlib.RingTheory.Localization.AtPrime.Basic +import Mathlib.RingTheory.Localization.Submodule +import Mathlib.RingTheory.Int.Basic +import Mathlib.Algebra.CharP.Algebra +import Mathlib.Algebra.Ring.Int.Parity + +namespace OAI + +/-! +# The integers localized at the prime two + +The ring is the actual localization of `ℤ` at the complement of `(2)`. Its +maximal ideal is generated by the image of two, and its nonzero generator makes +it a discrete valuation ring. The characteristic-zero and odd-unit interfaces +refer to this concrete localization, without assuming any valuation facts. +-/ + +noncomputable section + +namespace CirculantHadamard.IntegerTwoLocal + +/-- The prime ideal `(2)` in the integers. -/ +def ideal : Ideal ℤ := Ideal.span {(2 : ℤ)} + +instance ideal_isPrime : ideal.IsPrime := by + apply (Ideal.span_singleton_prime (by norm_num : (2 : ℤ) ≠ 0)).mpr + exact Nat.prime_iff_prime_int.mp Nat.prime_two + +/-- The actual ring `ℤ_(2)`. -/ +abbrev Ring := Localization.AtPrime ideal + +/-- The localization has no zero divisors. -/ +theorem isDomain : IsDomain Ring := inferInstance + +/-- The complement-of-prime localization is local. -/ +theorem isLocalRing : IsLocalRing Ring := inferInstance + +/-- Integer coefficients embed faithfully in the concrete localization. -/ +theorem algebraMap_injective : Function.Injective (algebraMap ℤ Ring) := + IsLocalization.injective Ring ideal.primeCompl_le_nonZeroDivisors + +instance charZero : CharZero Ring := + charZero_of_injective_algebraMap algebraMap_injective + +/-- Noetherianity is inherited from the integer ring by localization. -/ +instance isNoetherianRing : IsNoetherianRing Ring := + IsLocalization.isNoetherianRing ideal.primeCompl Ring + (inferInstance : IsNoetherianRing ℤ) + +/-- The maximal ideal is exactly the principal ideal generated by two. -/ +theorem maximalIdeal_eq_span : + IsLocalRing.maximalIdeal Ring = Ideal.span {(2 : Ring)} := by + calc + IsLocalRing.maximalIdeal Ring = Ideal.map (algebraMap ℤ Ring) ideal := + (Localization.AtPrime.map_eq_maximalIdeal (I := ideal)).symm + _ = Ideal.span {(2 : Ring)} := by + simp only [ideal, Ideal.map_span, Set.image_singleton, map_ofNat] + +theorem two_ne_zero : (2 : Ring) ≠ 0 := by norm_num + +theorem two_not_isUnit : ¬ IsUnit (2 : Ring) := by + rw [← mem_nonunits_iff, ← IsLocalRing.mem_maximalIdeal, maximalIdeal_eq_span] + exact Ideal.mem_span_singleton_self _ + +/-- The concrete localization is a discrete valuation ring with uniformizer +(two); this conclusion is obtained from its proved principal maximal ideal. -/ +instance isDiscreteValuationRing : IsDiscreteValuationRing Ring := + LocalDVR.isDiscreteValuationRing_of_maximalIdeal_eq_span two_ne_zero + maximalIdeal_eq_span + +@[simp] theorem mem_ideal_iff_even (z : ℤ) : z ∈ ideal ↔ Even z := by + simp only [ideal, Ideal.mem_span_singleton, even_iff_two_dvd] + +/-- Exactly the odd integers become units. -/ +theorem isUnit_algebraMap_iff_odd (z : ℤ) : + IsUnit (algebraMap ℤ Ring z) ↔ Odd z := by + rw [IsLocalization.AtPrime.isUnit_to_map_iff Ring ideal z] + change z ∉ ideal ↔ Odd z + rw [mem_ideal_iff_even, Int.not_even_iff_odd] + +theorem isUnit_intCast_of_odd (z : ℤ) (hz : Odd z) : IsUnit (z : Ring) := by + simpa using (isUnit_algebraMap_iff_odd z).mpr hz + +theorem isUnit_natCast_of_odd (u : ℕ) (hu : Odd u) : IsUnit (u : Ring) := by + simpa only [Int.cast_natCast] using + isUnit_intCast_of_odd (u : ℤ) ((Int.odd_coe_nat u).mpr hu) + +end CirculantHadamard.IntegerTwoLocal + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/CirculantHadamard/Kronecker.lean b/lean/OAI/LinearAlgebra/CirculantHadamard/Kronecker.lean new file mode 100644 index 0000000000000000000000000000000000000000..d81831f9bb1152fd19dfdb0b599cc8482d943151 --- /dev/null +++ b/lean/OAI/LinearAlgebra/CirculantHadamard/Kronecker.lean @@ -0,0 +1,46 @@ +import Mathlib.NumberTheory.NumberField.InfinitePlace.Embeddings +import OAI.LinearAlgebra.CirculantHadamard.CyclotomicAdjoin + +namespace OAI + +universe uK + +/-! +# Kronecker's criterion for the actual finite cyclotomic adjoin + +Every embedding of the field generated by the chosen roots restricts to a +unital ring homomorphism of their integral adjoin. This supplies the norm +hypothesis in Kronecker's theorem. The field, its finite dimension, and the +integrality of the selected element are constructed from the generators. +-/ + +namespace CirculantHadamard + +/-- An algebraic integer in a number field with all embedding norms equal to +one is a root of unity, with a positive exponent. -/ +theorem root_of_unity_of_norm_embeddings (K : Type uK) [Field K] [NumberField K] + {z : K} (hzi : IsIntegral ℤ z) + (hz : ∀ σ : K →+* ℂ, ‖σ z‖ = 1) : + ∃ n : ℕ, 0 < n ∧ z ^ n = 1 := by + obtain ⟨n, hn, hpow⟩ := + NumberField.Embeddings.pow_eq_one_of_norm_eq_one K ℂ hzi hz + exact ⟨n, hn, hpow⟩ + +theorem finite_adjoin_root_of_unity (s : Set ℂ) (hs : s.Finite) + (hroots : ∀ ζ ∈ s, ∃ n : ℕ, 0 < n ∧ ζ ^ n = 1) + (z : Algebra.adjoin ℤ s) + (hz : ∀ σ : Algebra.adjoin ℤ s →+* ℂ, ‖σ z‖ = 1) : + ∃ n : ℕ, 0 < n ∧ z ^ n = 1 := by + let : NumberField (CyclotomicAdjoin.Field s) := + CyclotomicAdjoin.numberField hs hroots + have hnorm (σ : CyclotomicAdjoin.Field s →+* ℂ) : + ‖σ (CyclotomicAdjoin.inclusion s z)‖ = 1 := + hz (σ.comp (CyclotomicAdjoin.inclusion s)) + obtain ⟨n, hn, hpow⟩ := root_of_unity_of_norm_embeddings + (CyclotomicAdjoin.Field s) (CyclotomicAdjoin.inclusion_integral hroots z) hnorm + refine ⟨n, hn, CyclotomicAdjoin.inclusion_injective s ?_⟩ + simpa only [map_pow, map_one] using hpow + +end CirculantHadamard + +end OAI diff --git a/lean/OAI/LinearAlgebra/CirculantHadamard/LocalComparison.lean b/lean/OAI/LinearAlgebra/CirculantHadamard/LocalComparison.lean new file mode 100644 index 0000000000000000000000000000000000000000..b7960af36f96af00716f2b24ba3b7fd5bd6378cb --- /dev/null +++ b/lean/OAI/LinearAlgebra/CirculantHadamard/LocalComparison.lean @@ -0,0 +1,158 @@ +import OAI.LinearAlgebra.CirculantHadamard.LocalComparisonInduction +import OAI.LinearAlgebra.CirculantHadamard.CyclotomicFactorDivision +import OAI.LinearAlgebra.CirculantHadamard.CyclicEvaluationProjection +import OAI.LinearAlgebra.CirculantHadamard.RamifiedLocal + +namespace OAI + +universe uA + +/-! +# Local character comparison in the actual cyclotomic quotient + +Starting with a characteristic-zero DVR whose maximal ideal is generated by +the rational prime `p`, all ramified rings needed by the induction are +constructed as the actual cyclotomic quotients. No projection-divisibility, +comparison, or existence-of-valuation premise is taken from the caller. + +The conclusion uses membership in the ideal generated by `root - 1` to state +residue one. This is independent of how a local-ring instance is installed and +can be transported directly to a later localization. +-/ + +noncomputable section + +namespace CirculantHadamard.LocalComparison + +open CyclicRing Polynomial + +variable (A : Type uA) [CommRing A] + +/-- The fixed primitive-order-`p` root used at every induction level. -/ +def orderPRoot (p : ℕ) : RamifiedLocal.Extension A p 0 := + AdjoinRoot.root (cyclotomic (p ^ (0 + 1)) A) + +theorem orderPRoot_pow (p : ℕ) : orderPRoot A p ^ p = 1 := by + calc + orderPRoot A p ^ p = orderPRoot A p ^ (p ^ (0 + 1)) := + congrArg (fun n : ℕ => orderPRoot A p ^ n) (by simp) + _ = 1 := cyclotomicAdjoinRoot_pow (R := A) (p ^ (0 + 1)) + +theorem orderPRoot_pow_level (p e : ℕ) : orderPRoot A p ^ (p ^ (e + 1)) = 1 := by + calc + orderPRoot A p ^ (p ^ (e + 1)) = orderPRoot A p ^ (p * p ^ e) := + congrArg (fun n : ℕ => orderPRoot A p ^ n) (pow_succ' p e) + _ = (orderPRoot A p ^ p) ^ (p ^ e) := pow_mul _ _ _ + _ = 1 := by rw [orderPRoot_pow, one_pow] + +/-- Actual order-`p` evaluation of an element of the cyclic group ring of +order `p ^ (e + 1)`. -/ +def orderPValue (p e : ℕ) [NeZero p] : + Elem A (p ^ (e + 1)) →ₐ[A] RamifiedLocal.Extension A p 0 := + evaluateAt (p ^ (e + 1)) (orderPRoot A p) (orderPRoot_pow_level A p e) + +@[simp] theorem orderPValue_scalar (p e : ℕ) [NeZero p] (a : A) : + orderPValue A p e (scalar (p ^ (e + 1)) a) = + algebraMap A (RamifiedLocal.Extension A p 0) a := + (orderPValue A p e).commutes a + +theorem orderPValue_projection (p e : ℕ) [NeZero p] + (F : Elem A (p ^ (e + 2))) : + orderPValue A p e + (cyclicProjection A (pow_dvd_pow p (Nat.le_succ (e + 1))) F) = + orderPValue A p (e + 1) F := + evaluateAt_cyclicProjection _ _ _ _ F + +/-- The conclusion of comparison, expressed by an actual unit and membership +in the actual ramified maximal ideal. -/ +def OrderPCompared (p e : ℕ) [NeZero p] (F : Elem A (p ^ (e + 1))) : Prop := + ∃ u : (RamifiedLocal.Extension A p 0)ˣ, + orderPValue A p e F = (u : RamifiedLocal.Extension A p 0) * + algebraMap A (RamifiedLocal.Extension A p 0) (augmentation (p ^ (e + 1)) F) ∧ + (u : RamifiedLocal.Extension A p 0) - 1 ∈ + Ideal.span {RamifiedLocal.uniformizer A p 0} + +section DVR + +variable [IsDomain A] [CharZero A] [IsDiscreteValuationRing A] + +/-- Character comparison with every ramified extension constructed from the +input DVR. Both factors are compared, with matching group/scalar exponents. -/ +theorem local_character_comparison (p : ℕ) [NeZero p] (hp : p.Prime) + (hmax : IsLocalRing.maximalIdeal A = Ideal.span {(p : A)}) + (e : ℕ) (b : Aˣ) (F K : Elem A (p ^ (e + 1))) + (hFK : F * K = scalar (p ^ (e + 1)) ((p : A) ^ (e + 1) * (b : A))) : + OrderPCompared A p e F ∧ OrderPCompared A p e K := by + let : IsDomain (RamifiedLocal.Extension A p 0) := + RamifiedLocal.isDomain A hp 0 hmax + let : IsLocalRing (RamifiedLocal.Extension A p 0) := + RamifiedLocal.isLocalRing A hp 0 hmax + have hpA : Prime (p : A) := + ((IsDiscreteValuationRing.irreducible_iff_uniformizer (p : A)).mpr hmax).prime + have hpS : algebraMap A (RamifiedLocal.Extension A p 0) (p : A) ≠ 0 := by + intro h + exact hpA.ne_zero (RamifiedLocal.algebraMap_injective A hp 0 + (by simpa only [map_zero] using h)) + have hroot : IsLocalRing.residue (RamifiedLocal.Extension A p 0) (orderPRoot A p) = 1 := by + have hpi : RamifiedLocal.uniformizer A p 0 ∈ + IsLocalRing.maximalIdeal (RamifiedLocal.Extension A p 0) := by + rw [RamifiedLocal.maximalIdeal_eq_span A hp 0 hmax] + exact Ideal.subset_span (Set.mem_singleton _) + have hz := (IsLocalRing.residue_eq_zero_iff _).mpr hpi + simpa only [RamifiedLocal.uniformizer, orderPRoot, map_sub, map_one, sub_eq_zero] using hz + have hc := comparison_induction p (algebraMap A (RamifiedLocal.Extension A p 0)) + hpA hpS (fun k => (orderPValue A p k).toRingHom) + (fun k a => orderPValue_scalar A p k a) + (by + intro U + change IsLocalRing.residue (RamifiedLocal.Extension A p 0) (orderPValue A p 0 U) = + IsLocalRing.residue (RamifiedLocal.Extension A p 0) + (algebraMap A (RamifiedLocal.Extension A p 0) (augmentation (p ^ 1) U)) + simp only [orderPValue, evaluateAt_apply, + augmentation_apply, map_sum, map_mul, map_pow, hroot, one_pow, mul_one]) + (fun k U => orderPValue_projection A p k U) + (by + intro k c U V hUV + let : IsDomain (RamifiedLocal.Extension A p (k + 1)) := + RamifiedLocal.isDomain A hp (k + 1) hmax + let : IsLocalRing (RamifiedLocal.Extension A p (k + 1)) := + RamifiedLocal.isLocalRing A hp (k + 1) hmax + let : IsDiscreteValuationRing (RamifiedLocal.Extension A p (k + 1)) := + RamifiedLocal.isDiscreteValuationRing A hp (k + 1) hmax + have hpR : (p : RamifiedLocal.Extension A p (k + 1)) ≠ 0 := by + intro h + apply hpA.ne_zero + apply RamifiedLocal.algebraMap_injective A hp (k + 1) + simpa only [map_natCast, map_zero] using h + exact projected_factor_divisible hp hpR + (Nat.mul_pos (Nat.sub_pos_of_lt hp.one_lt) (pow_pos hp.pos (k + 1))) + (RamifiedLocal.addVal_prime A hp (k + 1) hmax) c U V hUV) + e b F K hFK + have toCompared {U : Elem A (p ^ (e + 1))} + (hU : ResidueOneAssociated (IsLocalRing.residue (RamifiedLocal.Extension A p 0)) + (orderPValue A p e U) + (algebraMap A (RamifiedLocal.Extension A p 0) (augmentation (p ^ (e + 1)) U))) : + OrderPCompared A p e U := by + obtain ⟨u, hu, hres⟩ := hU + refine ⟨u, hu, ?_⟩ + rw [← RamifiedLocal.maximalIdeal_eq_span A hp 0 hmax] + apply (IsLocalRing.residue_eq_zero_iff _).mp + rw [map_sub, hres, map_one, sub_self] + exact ⟨toCompared hc.1, toCompared hc.2⟩ + +omit [IsDiscreteValuationRing A] in +/-- The augmentation denominators used in the corresponding ratio statement +are nonzero in the coefficient DVR. -/ +theorem local_character_comparison_denominators [IsDiscreteValuationRing A] (p : ℕ) (hp : p.Prime) + (e : ℕ) (b : Aˣ) (F K : Elem A (p ^ (e + 1))) + (hFK : F * K = scalar (p ^ (e + 1)) ((p : A) ^ (e + 1) * (b : A))) : + augmentation (p ^ (e + 1)) F ≠ 0 ∧ augmentation (p ^ (e + 1)) K ≠ 0 := + augmentation_ne_zero_of_scalar_product (Nat.cast_ne_zero.mpr hp.ne_zero) b F K hFK + +end DVR + +end CirculantHadamard.LocalComparison + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/CirculantHadamard/LocalComparisonInduction.lean b/lean/OAI/LinearAlgebra/CirculantHadamard/LocalComparisonInduction.lean new file mode 100644 index 0000000000000000000000000000000000000000..ffb80d540c9e10fee445f9f95026f24e94bb813a --- /dev/null +++ b/lean/OAI/LinearAlgebra/CirculantHadamard/LocalComparisonInduction.lean @@ -0,0 +1,177 @@ +import OAI.LinearAlgebra.CirculantHadamard.CyclicProjection +import OAI.LinearAlgebra.CirculantHadamard.CyclicScalarDivision +import OAI.LinearAlgebra.CirculantHadamard.ResidueOneAssociation +import Mathlib.Algebra.Prime.Defs + +namespace OAI + +universe uA uS + +noncomputable section + +namespace CirculantHadamard.LocalComparison + +open CyclicRing + +variable {A : Type uA} {S : Type uS} [CommRing A] [IsDomain A] + [CommRing S] [domainS : IsDomain S] [IsLocalRing S] + +/-- If the product has exactly one prime factor up to a unit, at least one +factor is a unit. This elementary base step does not use a valuation. -/ +theorem isUnit_or_isUnit_of_mul_prime_unit {p x y : A} (hp : Prime p) + (b : Aˣ) (hxy : x * y = p * (b : A)) : IsUnit x ∨ IsUnit y := by + have hdvd : p ∣ x * y := ⟨(b : A), hxy⟩ + rcases hp.dvd_or_dvd hdvd with hx | hy + · obtain ⟨z, hz⟩ := hx + have hzy : z * y = (b : A) := by + apply mul_left_cancel₀ hp.ne_zero + calc + p * (z * y) = (p * z) * y := (mul_assoc _ _ _).symm + _ = x * y := by rw [← hz] + _ = p * (b : A) := hxy + exact Or.inr (isUnit_of_mul_isUnit_right (hzy.symm ▸ b.isUnit)) + · obtain ⟨z, hz⟩ := hy + have hxz : x * z = (b : A) := by + apply mul_left_cancel₀ hp.ne_zero + calc + p * (x * z) = x * (p * z) := by ac_rfl + _ = x * y := by rw [← hz] + _ = p * (b : A) := hxy + exact Or.inl (isUnit_of_mul_isUnit_left (hxz.symm ▸ b.isUnit)) + +/-- Both augmentations in the comparison theorem are nonzero. -/ +theorem augmentation_ne_zero_of_scalar_product {p : ℕ} {e : ℕ} + (hp : (p : A) ≠ 0) (b : Aˣ) (F K : Elem A (p ^ e)) + (hFK : F * K = scalar (p ^ e) ((p : A) ^ e * (b : A))) : + augmentation (p ^ e) F ≠ 0 ∧ augmentation (p ^ e) K ≠ 0 := by + have haug : augmentation (p ^ e) F * augmentation (p ^ e) K = + (p : A) ^ e * (b : A) := by + simpa only [map_mul, augmentation_scalar] using + congrArg (augmentation (p ^ e)) hFK + have hne : augmentation (p ^ e) F * augmentation (p ^ e) K ≠ 0 := by + rw [haug] + exact mul_ne_zero (pow_ne_zero _ hp) b.ne_zero + exact mul_ne_zero_iff.mp hne + +/-- The exponent-one base case, using the actual residue field of `S`. -/ +theorem comparison_base (n p : ℕ) (φ : A →+* S) (hp : Prime (p : A)) + (hpS : φ (p : A) ≠ 0) + (v : Elem A n →+* S) + (vscalar : ∀ a : A, v (scalar n a) = φ a) + (vres : ∀ F : Elem A n, + IsLocalRing.residue S (v F) = + IsLocalRing.residue S (φ (augmentation n F))) + (b : Aˣ) (F K : Elem A n) + (hFK : F * K = scalar n ((p : A) * (b : A))) : + ResidueOneAssociated (IsLocalRing.residue S) (v F) (φ (augmentation n F)) ∧ + ResidueOneAssociated (IsLocalRing.residue S) (v K) (φ (augmentation n K)) := by + have haug : augmentation n F * augmentation n K = (p : A) * (b : A) := by + simpa only [map_mul, augmentation_scalar] using congrArg (augmentation n) hFK + have hv : v F * v K = φ ((p : A) * (b : A)) := by + simpa only [map_mul, vscalar] using congrArg v hFK + have hprod : v F * v K = φ (augmentation n F) * φ (augmentation n K) := by + calc + v F * v K = φ ((p : A) * (b : A)) := hv + _ = φ (augmentation n F * augmentation n K) := congrArg φ haug.symm + _ = φ (augmentation n F) * φ (augmentation n K) := φ.map_mul _ _ + have hne : φ (augmentation n F) * φ (augmentation n K) ≠ 0 := by + rw [← map_mul, haug, map_mul] + exact mul_ne_zero hpS (b.isUnit.map φ).ne_zero + rcases isUnit_or_isUnit_of_mul_prime_unit hp b haug with hF | hK + · have h := residueOneAssociated_of_isUnit_residue_eq (hF.map φ) (vres F) + exact ⟨h, h.product_complement hprod hne⟩ + · have h := residueOneAssociated_of_isUnit_residue_eq (hK.map φ) (vres K) + have hprod' : v K * v F = φ (augmentation n K) * φ (augmentation n F) := by + simpa only [mul_comm] using hprod + have hne' : φ (augmentation n K) * φ (augmentation n F) ≠ 0 := by + simpa only [mul_comm] using hne + exact ⟨h.product_complement hprod' hne', h⟩ + +omit domainS in +/-- Induction step when the first projected factor is divisible by `p`. +The other factor is left intact. The two output associations are both +transported, so the next step may divide either factor. -/ +theorem comparison_step_left [IsDomain S] (p e : ℕ) (φ : A →+* S) + (hp : (p : A) ≠ 0) + (v : Elem A (p ^ (e + 1)) →+* S) + (v' : Elem A (p ^ (e + 2)) →+* S) + (vscalar : ∀ a : A, v (scalar (p ^ (e + 1)) a) = φ a) + (vq : ∀ F : Elem A (p ^ (e + 2)), + v (cyclicProjection A (pow_dvd_pow p (Nat.le_succ (e + 1))) F) = v' F) + (b : Aˣ) (F K : Elem A (p ^ (e + 2))) + (hFK : F * K = scalar (p ^ (e + 2)) ((p : A) ^ (e + 2) * (b : A))) + (F' : Elem A (p ^ (e + 1))) + (hF : cyclicProjection A (pow_dvd_pow p (Nat.le_succ (e + 1))) F = + scalar (p ^ (e + 1)) (p : A) * F') + (ih : ∀ U V : Elem A (p ^ (e + 1)), + U * V = scalar (p ^ (e + 1)) ((p : A) ^ (e + 1) * (b : A)) → + ResidueOneAssociated (IsLocalRing.residue S) (v U) + (φ (augmentation (p ^ (e + 1)) U)) ∧ + ResidueOneAssociated (IsLocalRing.residue S) (v V) + (φ (augmentation (p ^ (e + 1)) V))) : + ResidueOneAssociated (IsLocalRing.residue S) (v' F) + (φ (augmentation (p ^ (e + 2)) F)) ∧ + ResidueOneAssociated (IsLocalRing.residue S) (v' K) + (φ (augmentation (p ^ (e + 2)) K)) := by + let q := cyclicProjection A (pow_dvd_pow p (Nat.le_succ (e + 1))) + have hdiv : F' * q K = scalar (p ^ (e + 1)) ((p : A) ^ (e + 1) * (b : A)) := + quotient_scalar_norm_division q (fun a => cyclicProjection_single_zero _ a) + (p : A) hp (e + 1) (b : A) F K F' hFK hF + obtain ⟨hiF, hiK⟩ := ih F' (q K) hdiv + have heval : v' F = φ (p : A) * v F' := by + rw [← vq F, hF, map_mul, vscalar] + have haug : augmentation (p ^ (e + 2)) F = + (p : A) * augmentation (p ^ (e + 1)) F' := by + rw [← augmentation_cyclicProjection (pow_dvd_pow p (Nat.le_succ (e + 1))) F, + hF, map_mul, augmentation_scalar] + constructor + · rw [heval, haug, map_mul] + exact hiF.mul_left (φ (p : A)) + · simpa only [q, vq, augmentation_cyclicProjection] using hiK + +/-- The integral induction with its projection-divisibility input exposed. +The concrete cyclotomic theorem discharges `hdivide`; it is not a definition +of the comparison conclusion. -/ +theorem comparison_induction (p : ℕ) (φ : A →+* S) + (hp : Prime (p : A)) (hpS : φ (p : A) ≠ 0) + (v : (e : ℕ) → Elem A (p ^ (e + 1)) →+* S) + (vscalar : ∀ e a, v e (scalar (p ^ (e + 1)) a) = φ a) + (vres : ∀ F : Elem A (p ^ 1), + IsLocalRing.residue S (v 0 F) = + IsLocalRing.residue S (φ (augmentation (p ^ 1) F))) + (vq : ∀ e F, + v e (cyclicProjection A (pow_dvd_pow p (Nat.le_succ (e + 1))) F) = v (e + 1) F) + (hdivide : ∀ e (b : Aˣ) (F K : Elem A (p ^ (e + 2))), + F * K = scalar (p ^ (e + 2)) ((p : A) ^ (e + 2) * (b : A)) → + (∃ F', cyclicProjection A (pow_dvd_pow p (Nat.le_succ (e + 1))) F = + scalar (p ^ (e + 1)) (p : A) * F') ∨ + (∃ K', cyclicProjection A (pow_dvd_pow p (Nat.le_succ (e + 1))) K = + scalar (p ^ (e + 1)) (p : A) * K')) : + ∀ e (b : Aˣ) (F K : Elem A (p ^ (e + 1))), + F * K = scalar (p ^ (e + 1)) ((p : A) ^ (e + 1) * (b : A)) → + ResidueOneAssociated (IsLocalRing.residue S) (v e F) + (φ (augmentation (p ^ (e + 1)) F)) ∧ + ResidueOneAssociated (IsLocalRing.residue S) (v e K) + (φ (augmentation (p ^ (e + 1)) K)) := by + intro e + induction e with + | zero => + intro b F K hFK + exact comparison_base (p ^ (0 + 1)) p φ hp hpS (v 0) (vscalar 0) vres + b F K (by simpa only [Nat.zero_add, pow_one] using hFK) + | succ e ih => + intro b F K hFK + rcases hdivide e b F K hFK with ⟨F', hF⟩ | ⟨K', hK⟩ + · exact comparison_step_left p e φ hp.ne_zero (v e) (v (e + 1)) + (vscalar e) (vq e) b F K hFK F' hF (ih b) + · have hKF : K * F = scalar (p ^ (e + 2)) + ((p : A) ^ (e + 2) * (b : A)) := by + simpa only [mul_comm] using hFK + exact (comparison_step_left p e φ hp.ne_zero (v e) (v (e + 1)) + (vscalar e) (vq e) b K F hKF K' hK (ih b)).symm + +end CirculantHadamard.LocalComparison + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/CirculantHadamard/LocalDVR.lean b/lean/OAI/LinearAlgebra/CirculantHadamard/LocalDVR.lean new file mode 100644 index 0000000000000000000000000000000000000000..57b3a07d1978542a1ab79532f3126be02d667f53 --- /dev/null +++ b/lean/OAI/LinearAlgebra/CirculantHadamard/LocalDVR.lean @@ -0,0 +1,129 @@ +import Mathlib.RingTheory.DiscreteValuationRing.TFAE +import Mathlib.Tactic.NormNum +import Lean.Elab.Tactic.Omega + +namespace OAI + +universe uR + +/-! +# Principal maximal ideals and local factor divisibility + +A nonzero principal maximal ideal in a Noetherian local domain gives a DVR +and uniformizer factorizations. Its canonical additive valuation, valued in +`ℕ∞`, splits a product of a prime power and a unit. +-/ + +noncomputable section + +namespace CirculantHadamard.LocalDVR + +open IsLocalRing IsDiscreteValuationRing + +section PrincipalMaximalIdeal + +variable {R : Type uR} [CommRing R] [IsDomain R] [IsNoetherianRing R] [IsLocalRing R] + +/-- A nonzero generator of the maximal ideal of a Noetherian local domain +proves that the ring is a DVR. -/ +theorem isDiscreteValuationRing_of_maximalIdeal_eq_span {π : R} + (hπ : π ≠ 0) (hspan : maximalIdeal R = Ideal.span {π}) : + IsDiscreteValuationRing R := by + have hmax : maximalIdeal R ≠ ⊥ := by + intro hzero + apply hπ + exact Ideal.span_singleton_eq_bot.mp (hspan.symm.trans hzero) + have hfield : ¬ IsField R := isField_iff_maximalIdeal_eq.not.mpr hmax + have hprincipal : (maximalIdeal R).IsPrincipal := ⟨⟨π, hspan⟩⟩ + exact ((IsDiscreteValuationRing.TFAE R hfield).out 5 1).mp hprincipal + +/-- The actual chosen generator factors every nonzero element into a unit +times a natural power. -/ +theorem eq_unit_mul_pow_of_maximalIdeal_eq_span {π x : R} + (hπ : π ≠ 0) (hspan : maximalIdeal R = Ideal.span {π}) (hx : x ≠ 0) : + ∃ (n : ℕ) (u : Rˣ), x = (u : R) * π ^ n := by + let : IsDiscreteValuationRing R := + isDiscreteValuationRing_of_maximalIdeal_eq_span hπ hspan + exact eq_unit_mul_pow_irreducible hx ((irreducible_iff_uniformizer π).mpr hspan) + +end PrincipalMaximalIdeal + +section Valuation + +variable {R : Type uR} [CommRing R] [IsDomain R] [IsDiscreteValuationRing R] + +/-- Normalize the additive valuation using the concrete uniformizer relation. -/ +theorem addVal_eq_of_unit_mul_uniformizer_pow {π p : R} {u : Rˣ} {D : ℕ} + (hspan : maximalIdeal R = Ideal.span {π}) (hp : p = (u : R) * π ^ D) : + addVal R p = (D : ℕ∞) := + addVal_def p u ((irreducible_iff_uniformizer π).mpr hspan) D hp + +/-- Right-unit version, convenient for the factorization of a rational prime. -/ +theorem addVal_eq_of_uniformizer_pow_mul_unit {π p b : R} {D : ℕ} + (hspan : maximalIdeal R = Ideal.span {π}) (hb : IsUnit b) + (hp : p = π ^ D * b) : addVal R p = (D : ℕ∞) := by + obtain ⟨u, rfl⟩ := hb + exact addVal_eq_of_unit_mul_uniformizer_pow hspan (hp.trans (mul_comm _ _)) + +private theorem finite_add_eq {a b : ℕ∞} {N : ℕ} (h : a + b = (N : ℕ∞)) : + ∃ m n : ℕ, a = (m : ℕ∞) ∧ b = (n : ℕ∞) ∧ m + n = N := by + have ha : a ≤ (N : ℕ∞) := by + rw [← h] + exact le_add_of_nonneg_right zero_le + have hb : b ≤ (N : ℕ∞) := by + rw [← h] + exact le_add_of_nonneg_left zero_le + obtain ⟨m, hm, _⟩ := ENat.le_natCast_iff.mp ha + obtain ⟨n, hn, _⟩ := ENat.le_natCast_iff.mp hb + refine ⟨m, n, hm, hn, ?_⟩ + rw [hm, hn, ← Nat.cast_add] at h + exact_mod_cast h + +/-- If the valuation of a product is at least twice that of `p`, one factor +is divisible by `p`. The value of `p` is allowed to be ramified. -/ +theorem dvd_or_dvd_of_mul_eq_pow_mul_unit {p x y b : R} {D e : ℕ} + (_hp : p ≠ 0) (_hD : 0 < D) (hpval : addVal R p = (D : ℕ∞)) + (he : 2 ≤ e) (hb : IsUnit b) (hxy : x * y = p ^ e * b) : + p ∣ x ∨ p ∣ y := by + have hv := congrArg (addVal R) hxy + rw [addVal_mul, addVal_mul, addVal_pow, hpval, + addVal_eq_zero_iff.mpr hb, add_zero] at hv + have hv' : addVal R x + addVal R y = ((e * D : ℕ) : ℕ∞) := by + simpa only [nsmul_eq_mul, Nat.cast_mul] using hv + obtain ⟨m, n, hm, hn, hmn⟩ := finite_add_eq hv' + have heD : 2 * D ≤ e * D := Nat.mul_le_mul_right D he + have hsplit : D ≤ m ∨ D ≤ n := by omega + rcases hsplit with hx | hy + · left + apply addVal_le_iff_dvd.mp + rw [hpval, hm] + exact_mod_cast hx + · right + apply addVal_le_iff_dvd.mp + rw [hpval, hn] + exact_mod_cast hy + +/-- A product with valuation one has a unit factor. This is the unramified +base case of the integral division argument. -/ +theorem isUnit_or_isUnit_of_mul_eq_uniformizer_mul_unit {p x y b : R} + (hpval : addVal R p = 1) (hb : IsUnit b) (hxy : x * y = p * b) : + IsUnit x ∨ IsUnit y := by + have hv := congrArg (addVal R) hxy + rw [addVal_mul, addVal_mul, hpval, addVal_eq_zero_iff.mpr hb, add_zero] at hv + obtain ⟨m, n, hm, hn, hmn⟩ := finite_add_eq (N := 1) hv + have hsplit : m = 0 ∨ n = 0 := by omega + rcases hsplit with hx | hy + · left + apply addVal_eq_zero_iff.mp + simpa only [hx, Nat.cast_zero] using hm + · right + apply addVal_eq_zero_iff.mp + simpa only [hy, Nat.cast_zero] using hn + +end Valuation + +end CirculantHadamard.LocalDVR + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/CirculantHadamard/LocalizationIntersection.lean b/lean/OAI/LinearAlgebra/CirculantHadamard/LocalizationIntersection.lean new file mode 100644 index 0000000000000000000000000000000000000000..1726bcd925c76a9dacdd7cce7badda0e204a5a85 --- /dev/null +++ b/lean/OAI/LinearAlgebra/CirculantHadamard/LocalizationIntersection.lean @@ -0,0 +1,83 @@ +import Mathlib.RingTheory.Spectrum.Maximal.Localization +import Mathlib.RingTheory.Localization.AtPrime.Basic + +namespace OAI + +universe uR uK + +/-! +# Recovering a global coefficient from its local representations + +The denominator-ideal argument works in any commutative algebra. It identifies +the intersection of maximal localizations inside a fraction field with the +base ring, both as subalgebra membership and through actual local elements. +-/ + +namespace CirculantHadamard + +/-- If every maximal ideal admits a denominator outside it taking `z` into the +base ring's image, then `z` itself lies in that image. -/ +theorem exists_base_of_local_denominators + {R : Type uR} {K : Type uK} [CommRing R] [CommRing K] [Algebra R K] + (z : K) + (hz : ∀ m : MaximalSpectrum R, ∃ a s : R, + s ∉ m.asIdeal ∧ algebraMap R K s * z = algebraMap R K a) : + ∃ r : R, algebraMap R K r = z := by + classical + by_contra h + let denom : Ideal R := + (1 : Submodule R K).comap (LinearMap.toSpanSingleton R K z) + have hdenom : (1 : R) ∉ denom := by + simpa [denom] using h + obtain ⟨m, hm, hle⟩ := + denom.exists_le_maximal (denom.ne_top_iff_one.mpr hdenom) + obtain ⟨a, s, hs, hsa⟩ := hz ⟨m, hm⟩ + apply hs + apply hle + change s • z ∈ (1 : Submodule R K) + apply Submodule.mem_one.mpr + exact ⟨a, by simpa only [Algebra.smul_def] using hsa.symm⟩ + +section FractionField + +variable {R : Type uR} {K : Type uK} [CommRing R] [IsDomain R] [Field K] + [Algebra R K] [IsFractionRing R K] + +/-- Membership in every maximal localization, realized inside a common fraction +field, gives a base-ring representative. -/ +theorem exists_base_of_mem_all_maximal_localizations + {z : K} + (hz : ∀ m : MaximalSpectrum R, + z ∈ Localization.subalgebra.ofField K m.asIdeal.primeCompl + m.asIdeal.primeCompl_le_nonZeroDivisors) : + ∃ r : R, algebraMap R K r = z := by + have hzall : z ∈ (⨅ m : MaximalSpectrum R, + Localization.subalgebra.ofField K m.asIdeal.primeCompl + m.asIdeal.primeCompl_le_nonZeroDivisors) := + Algebra.mem_iInf.mpr hz + rw [MaximalSpectrum.iInf_localization_eq_bot R K] at hzall + exact Algebra.mem_bot.mp hzall + +/-- A fraction-field element represented by an actual element of each maximal +local ring is the image of a base-ring element. -/ +theorem exists_base_of_localization_images + {z : K} + (hz : ∀ m : MaximalSpectrum R, ∃ y : Localization.AtPrime m.asIdeal, + Localization.mapToFractionRing K m.asIdeal.primeCompl + (Localization.AtPrime m.asIdeal) + m.asIdeal.primeCompl_le_nonZeroDivisors y = z) : + ∃ r : R, algebraMap R K r = z := by + apply exists_base_of_mem_all_maximal_localizations + intro m + obtain ⟨y, hy⟩ := hz m + change ∃ (a s : R) (_ : s ∈ m.asIdeal.primeCompl), + z = algebraMap R K a * (algebraMap R K s)⁻¹ + exact (Localization.subalgebra.mem_range_mapToFractionRing_iff_ofField + K m.asIdeal.primeCompl m.asIdeal.primeCompl_le_nonZeroDivisors + (Localization.AtPrime m.asIdeal) z).mp ⟨y, hy⟩ + +end FractionField + +end CirculantHadamard + +end OAI diff --git a/lean/OAI/LinearAlgebra/CirculantHadamard/LocalizationMaps.lean b/lean/OAI/LinearAlgebra/CirculantHadamard/LocalizationMaps.lean new file mode 100644 index 0000000000000000000000000000000000000000..6fc32a9687fa8668f4e2528e79b30d545cf3ca2c --- /dev/null +++ b/lean/OAI/LinearAlgebra/CirculantHadamard/LocalizationMaps.lean @@ -0,0 +1,109 @@ +import Mathlib.RingTheory.Localization.AtPrime.Basic +import Mathlib.RingTheory.Ideal.GoingUp +import Mathlib.RingTheory.PrincipalIdealDomain +import Mathlib.Algebra.EuclideanDomain.Int +import Mathlib.Data.Nat.Prime.Int + +namespace OAI + +universe uA uB + +/-! +# Maps between coefficient localizations and maximal ideals over primes + +The localization map uses the actual contraction of the target prime ideal. +Its denominator condition follows from the definition of contraction; no +integrality is needed for this map. Integrality is used separately to prove +maximality of contractions and existence of maximal ideals over rational primes. +-/ + +namespace CirculantHadamard + +section LocalizationMap + +variable {A : Type uA} {B : Type uB} [CommRing A] [CommRing B] + +/-- The actual map from the localization at a contracted prime ideal. -/ +noncomputable def localizationAtComapMap (f : A →+* B) (m : Ideal B) [m.IsPrime] : + Localization.AtPrime (m.comap f) →+* Localization.AtPrime m := + Localization.localRingHom (m.comap f) m f rfl + +/-- The induced map agrees with the original ring map on coefficients. -/ +@[simp] theorem localizationAtComapMap_algebraMap (f : A →+* B) + (m : Ideal B) [m.IsPrime] (a : A) : + localizationAtComapMap f m (algebraMap A (Localization.AtPrime (m.comap f)) a) = + algebraMap B (Localization.AtPrime m) (f a) := + Localization.localRingHom_to_map (m.comap f) m f rfl a + +/-- Both numerator and denominator follow the coefficient inclusion. -/ +theorem localizationAtComapMap_mk' (f : A →+* B) (m : Ideal B) [m.IsPrime] + (a : A) (s : (m.comap f).primeCompl) : + localizationAtComapMap f m (IsLocalization.mk' (Localization.AtPrime (m.comap f)) a s) = + IsLocalization.mk' (Localization.AtPrime m) (f a) + (⟨f s, s.2⟩ : m.primeCompl) := + Localization.localRingHom_mk' (m.comap f) m f rfl a s + +/-- An inclusion into a domain remains injective after the two prime +localizations, even though the target inverts additional denominators. -/ +theorem localizationAtComapMap_injective [IsDomain B] (f : A →+* B) + (hf : Function.Injective f) (m : Ideal B) [m.IsPrime] : + Function.Injective (localizationAtComapMap f m) := by + apply IsLocalization.injective_of_map_algebraMap_zero + (M := (m.comap f).primeCompl) (Localization.AtPrime (m.comap f)) + (localizationAtComapMap f m) + intro a ha + rw [localizationAtComapMap_algebraMap] at ha + have hB : Function.Injective (algebraMap B (Localization.AtPrime m)) := + IsLocalization.injective (Localization.AtPrime m) m.primeCompl_le_nonZeroDivisors + have hfa : f a = 0 := hB (by simpa only [map_zero] using ha) + have haz : a = 0 := hf (by simpa only [map_zero] using hfa) + rw [haz, map_zero] + +/-- Units used by the local comparison remain units in the larger +coefficient localization. -/ +theorem localizationAtComapMap_isUnit (f : A →+* B) (m : Ideal B) [m.IsPrime] + {x : Localization.AtPrime (m.comap f)} (hx : IsUnit x) : + IsUnit (localizationAtComapMap f m x) := + hx.map (localizationAtComapMap f m) + +/-- Integral coefficient extensions preserve maximality on contraction. -/ +theorem maximal_comap_of_integral (f : A →+* B) (hf : f.IsIntegral) + (m : Ideal B) [m.IsMaximal] : (m.comap f).IsMaximal := + Ideal.isMaximal_comap_of_isIntegral_of_isMaximal f hf m + +end LocalizationMap + +/-- Every rational prime has a maximal ideal above it in an integral +integer algebra with injective integer map. The conclusion retains the exact +contraction as well as membership of the prime in the maximal ideal. -/ +theorem exists_maximal_ideal_over_nat_prime (B : Type uB) [CommRing B] + [Algebra ℤ B] [Algebra.IsIntegral ℤ B] + (hB : Function.Injective (algebraMap ℤ B)) {p : ℕ} (hp : p.Prime) : + ∃ m : Ideal B, m.IsMaximal ∧ + m.comap (algebraMap ℤ B) = Ideal.span ({(p : ℤ)} : Set ℤ) ∧ (p : B) ∈ m := by + let P : Ideal ℤ := Ideal.span ({(p : ℤ)} : Set ℤ) + have hpZ : Prime (p : ℤ) := Nat.prime_iff_prime_int.mp hp + let : P.IsMaximal := PrincipalIdealRing.isMaximal_of_irreducible hpZ.irreducible + have hker : RingHom.ker (algebraMap ℤ B) = ⊥ := + (RingHom.injective_iff_ker_eq_bot _).mp hB + obtain ⟨m, hm, hcomap⟩ := + Ideal.exists_ideal_over_maximal_of_isIntegral (S := B) P + (by rw [hker]; exact bot_le) + refine ⟨m, hm, hcomap, ?_⟩ + have hpP : (p : ℤ) ∈ P := Ideal.subset_span (Set.mem_singleton _) + have hpcomap : (p : ℤ) ∈ m.comap (algebraMap ℤ B) := by + change (p : ℤ) ∈ m.under ℤ + rwa [hcomap] + have hpm := Ideal.mem_comap.mp hpcomap + simpa only [map_natCast] using hpm + +/-- Characteristic zero supplies the injective integer map automatically. -/ +theorem exists_maximal_ideal_over_nat_prime_of_charZero (B : Type uB) [CommRing B] + [CharZero B] [Algebra ℤ B] [Algebra.IsIntegral ℤ B] {p : ℕ} (hp : p.Prime) : + ∃ m : Ideal B, m.IsMaximal ∧ + m.comap (algebraMap ℤ B) = Ideal.span ({(p : ℤ)} : Set ℤ) ∧ (p : B) ∈ m := + exists_maximal_ideal_over_nat_prime B (algebraMap ℤ B).injective_int hp + +end CirculantHadamard + +end OAI diff --git a/lean/OAI/LinearAlgebra/CirculantHadamard/Main.lean b/lean/OAI/LinearAlgebra/CirculantHadamard/Main.lean new file mode 100644 index 0000000000000000000000000000000000000000..48df5c378fbae1c48a17d82a9303a70009526fbf --- /dev/null +++ b/lean/OAI/LinearAlgebra/CirculantHadamard/Main.lean @@ -0,0 +1,38 @@ +import OAI.LinearAlgebra.CirculantHadamard.Witnesses +import OAI.LinearAlgebra.CirculantHadamard.OrderReduction +import OAI.LinearAlgebra.CirculantHadamard.BinaryContradiction +import Lean.Elab.Tactic.Omega + +namespace OAI + +/-! +# Classification of positive real circulant sign Hadamard orders + +The existence predicate retains the actual real matrix, its sign entries, +literal cyclic rows, and full Gram identity. Square-order and two-adic descent +reduce every nontrivial order to `4 * u^2` with `u` positive and odd. The binary +contradiction excludes `u > 1`, while explicit matrices realize orders one and four. +-/ + +namespace CirculantHadamard + +/-- An actual real circulant sign Hadamard matrix of positive order exists +exactly at orders one and four. -/ +theorem exists_iff_order_one_or_four (n : ℕ) (hn : 0 < n) : + ExistsRealCirculantHadamard n ↔ n = 1 ∨ n = 4 := by + constructor + · intro hH + by_cases hn1 : n = 1 + · exact Or.inl hn1 + · have hnlarge : 1 < n := by omega + rcases order_reduction hnlarge hH with ⟨u, hu, hodd, rfl⟩ + by_cases hu1 : u = 1 + · right + simp [hu1] + · have hul : 1 < u := by omega + exact (not_exists_four_mul_odd_square hul hodd hH).elim + · exact exists_of_order_one_or_four + +end CirculantHadamard + +end OAI diff --git a/lean/OAI/LinearAlgebra/CirculantHadamard/MatrixBridge.lean b/lean/OAI/LinearAlgebra/CirculantHadamard/MatrixBridge.lean new file mode 100644 index 0000000000000000000000000000000000000000..722d655d8f46161efa1ba9a20bfe3513f0657636 --- /dev/null +++ b/lean/OAI/LinearAlgebra/CirculantHadamard/MatrixBridge.lean @@ -0,0 +1,153 @@ +import OAI.LinearAlgebra.CirculantHadamard.Basic + +namespace OAI + +universe uR + +/-! +# From real sign matrices to integer cyclic autocorrelation + +The Gram entry is reindexed using translation in `Fin n`. The real/integer +bridge uses the injective coefficient map `ℤ → ℝ`; it does not assume any +classification or any group-ring norm statement. +-/ + +namespace CirculantHadamard + +open scoped BigOperators + +variable {n : ℕ} + +/-- An integer sign row with the full Hadamard Gram equation. -/ +def IsIntegerSignRow (h : Fin n → ℤ) : Prop := + (∀ j, IsSign (h j)) ∧ + rowCirculant h * (rowCirculant h).transpose = + (n : ℤ) • (1 : Matrix (Fin n) (Fin n) ℤ) + +/-- The Gram entry at `(i,a)` is the cyclic autocorrelation at `a-i`. -/ +theorem rowCirculant_gram_apply [NeZero n] {R : Type uR} [CommRing R] + (h : Fin n → R) (i a : Fin n) : + (rowCirculant h * (rowCirculant h).transpose) i a = + ∑ j, h j * h (j - (a - i)) := by + classical + let e : Fin n ≃ Fin n := + { toFun := fun j => j - i + invFun := fun j => j + i + left_inv := fun j => sub_add_cancel j i + right_inv := fun j => add_sub_cancel_right j i } + simp only [Matrix.mul_apply, Matrix.transpose_apply, rowCirculant_apply] + apply Fintype.sum_equiv e + intro j + change h (j - i) * h (j - a) = h (j - i) * h ((j - i) - (a - i)) + simp only [sub_sub_sub_cancel_right] + +/-- The full Gram equation is exactly the cyclic autocorrelation system. -/ +theorem gram_eq_iff_autocorrelation [NeZero n] {R : Type uR} [CommRing R] + (h : Fin n → R) : + rowCirculant h * (rowCirculant h).transpose = + (n : R) • (1 : Matrix (Fin n) (Fin n) R) ↔ + ∀ a : Fin n, ∑ j, h j * h (j - a) = if a = 0 then (n : R) else 0 := by + classical + constructor + · intro hGram a + have ha := congrArg (fun M : Matrix (Fin n) (Fin n) R => M 0 a) hGram + rw [rowCirculant_gram_apply] at ha + simpa [Matrix.smul_apply, Matrix.one_apply, eq_comm] using ha + · intro hCorr + ext i a + rw [rowCirculant_gram_apply, hCorr] + by_cases hia : i = a + · subst a + simp + · have hai : a - i ≠ 0 := sub_ne_zero.mpr (Ne.symm hia) + simp [hia, hai, Matrix.smul_apply] + +/-- Casting the integer Gram matrix agrees entry by entry with taking the +Gram matrix after casting the row. -/ +theorem intCast_gram_apply (h : Fin n → ℤ) (i j : Fin n) : + ((rowCirculant h * (rowCirculant h).transpose) i j : ℝ) = + (rowCirculant (fun a => (h a : ℝ)) * + (rowCirculant (fun a => (h a : ℝ))).transpose) i j := by + simp [Matrix.mul_apply, Matrix.transpose_apply, rowCirculant, Int.cast_sum, + Int.cast_mul] + +private theorem intCast_scaled_identity_apply (i j : Fin n) : + (((n : ℤ) • (1 : Matrix (Fin n) (Fin n) ℤ)) i j : ℝ) = + ((n : ℝ) • (1 : Matrix (Fin n) (Fin n) ℝ)) i j := by + by_cases hij : i = j <;> simp [Matrix.smul_apply, hij] + +/-- The real coefficient embedding preserves and reflects the entire Gram +identity, including the diagonal value. -/ +theorem gram_intCast_iff (h : Fin n → ℤ) : + rowCirculant (fun a => (h a : ℝ)) * + (rowCirculant (fun a => (h a : ℝ))).transpose = + (n : ℝ) • (1 : Matrix (Fin n) (Fin n) ℝ) ↔ + rowCirculant h * (rowCirculant h).transpose = + (n : ℤ) • (1 : Matrix (Fin n) (Fin n) ℤ) := by + constructor + · intro hGram + ext i j + apply Int.cast_injective (α := ℝ) + rw [intCast_gram_apply, intCast_scaled_identity_apply] + exact congrArg (fun M : Matrix (Fin n) (Fin n) ℝ => M i j) hGram + · intro hGram + ext i j + rw [← intCast_gram_apply, ← intCast_scaled_identity_apply] + exact congrArg (fun M : Matrix (Fin n) (Fin n) ℤ => (M i j : ℝ)) hGram + +/-- Every integer sign row gives the actual real circulant Hadamard matrix. -/ +theorem IsIntegerSignRow.exists_real {h : Fin n → ℤ} (hh : IsIntegerSignRow h) : + ExistsRealCirculantHadamard n := by + refine ⟨rowCirculant (fun a => (h a : ℝ)), rowCirculant_isCirculant _, ?_, + (gram_intCast_iff h).mpr hh.2⟩ + intro i j + rcases hh.1 (j - i) with hpos | hneg + · left + simp only [rowCirculant_apply, hpos, Int.cast_one] + · right + simp only [rowCirculant_apply, hneg, Int.cast_neg, Int.cast_one] + +/-- A real sign matrix determines an integer sign row without approximation. -/ +theorem ExistsRealCirculantHadamard.exists_integerSignRow [NeZero n] + (hH : ExistsRealCirculantHadamard n) : ∃ h : Fin n → ℤ, IsIntegerSignRow h := by + classical + rcases hH with ⟨H, ⟨h, hrow⟩, hsign, hGram⟩ + have hsignRow : ∀ j, IsSign (h j) := by + intro j + simpa only [hrow, sub_zero] using hsign 0 j + let z : Fin n → ℤ := fun j => if h j = 1 then 1 else -1 + have hzcast : ∀ j, (z j : ℝ) = h j := by + intro j + by_cases hj : h j = 1 + · simp [z, hj] + · have hneg := (hsignRow j).resolve_left hj + simp only [z, ite_eq_right hj, Int.cast_neg, Int.cast_one, hneg] + have hzsign : ∀ j, IsSign (z j) := by + intro j + dsimp [z, IsSign] + split_ifs <;> simp + have hzH : rowCirculant (fun j => (z j : ℝ)) = H := by + ext i j + rw [rowCirculant_apply, hzcast, hrow] + refine ⟨z, hzsign, (gram_intCast_iff z).mp ?_⟩ + simpa only [hzH] using hGram + +/-- Equivalence between the public real matrix problem and integer sign rows. -/ +theorem integerSignRow_iff_real [NeZero n] : + (∃ h : Fin n → ℤ, IsIntegerSignRow h) ↔ ExistsRealCirculantHadamard n := by + constructor + · rintro ⟨h, hh⟩ + exact hh.exists_real + · exact ExistsRealCirculantHadamard.exists_integerSignRow + +/-- A direct integer autocorrelation presentation of the real matrix problem. -/ +theorem existsReal_iff_integer_autocorrelation [NeZero n] : + ExistsRealCirculantHadamard n ↔ + ∃ h : Fin n → ℤ, (∀ j, IsSign (h j)) ∧ + ∀ a : Fin n, ∑ j, h j * h (j - a) = if a = 0 then (n : ℤ) else 0 := by + rw [← integerSignRow_iff_real] + simp only [IsIntegerSignRow, gram_eq_iff_autocorrelation] + +end CirculantHadamard + +end OAI diff --git a/lean/OAI/LinearAlgebra/CirculantHadamard/ModEight.lean b/lean/OAI/LinearAlgebra/CirculantHadamard/ModEight.lean new file mode 100644 index 0000000000000000000000000000000000000000..267767e7c5d61de83278f738f12e56a7102c4399 --- /dev/null +++ b/lean/OAI/LinearAlgebra/CirculantHadamard/ModEight.lean @@ -0,0 +1,102 @@ +import OAI.LinearAlgebra.CirculantHadamard.CyclicNorm +import Mathlib.Algebra.Ring.Int.Parity +import Mathlib.Data.Int.ModEq +import Mathlib.Tactic.Linarith +import Mathlib.Tactic.NormNum + +namespace OAI + +universe uIota + +/-! +# The odd-coefficient obstruction modulo eight + +The identity coefficient of an integer cyclic norm is the sum of the actual +coefficient squares. Every odd square is one modulo eight. Consequently an +odd-coefficient element in a cyclic group of order divisible by eight cannot +have norm scalar `4 * u^2` with `u` odd. The divisibility hypothesis excludes +order four, so the explicit order-four example is not ruled out. +-/ + +namespace CirculantHadamard + +open scoped BigOperators + +/-- Every odd integer square is congruent to one modulo eight. -/ +theorem odd_sq_mod_eight {a : ℤ} (ha : Odd a) : + Int.ModEq 8 (a ^ 2) 1 := by + rcases ha with ⟨k, rfl⟩ + obtain ⟨m, hm⟩ := Int.even_mul_succ_self k + rw [Int.modEq_iff_dvd] + refine ⟨-m, ?_⟩ + nlinarith [hm] + +/-- A finite sum of odd integer squares is congruent to the number of terms. -/ +theorem sum_odd_sq_mod_eight {ι : Type uIota} (s : Finset ι) (a : ι → ℤ) + (ha : ∀ i ∈ s, Odd (a i)) : + Int.ModEq 8 (∑ i ∈ s, a i ^ 2) (s.card : ℤ) := by + classical + revert ha + refine Finset.induction_on s ?_ ?_ + · intro _ + simp [Int.ModEq] + · intro i s hi ih ha + have hiOdd : Odd (a i) := ha i (Finset.mem_insert_self i s) + have hsOdd : ∀ j ∈ s, Odd (a j) := + fun j hj => ha j (Finset.mem_insert_of_mem hj) + simpa only [Finset.sum_insert hi, Finset.card_insert_of_notMem hi, + Nat.cast_add, Nat.cast_one, add_comm (s.card : ℤ) 1] using + (odd_sq_mod_eight hiOdd).add (ih hsOdd) + +/-- The same congruence for all members of a finite type. -/ +theorem sum_univ_odd_sq_mod_eight {ι : Type uIota} [Fintype ι] (a : ι → ℤ) + (ha : ∀ i, Odd (a i)) : + Int.ModEq 8 (∑ i, a i ^ 2) (Fintype.card ι : ℤ) := by + simpa using sum_odd_sq_mod_eight Finset.univ a (fun i _ => ha i) + +/-- A multiple of eight odd squares cannot sum to four times an odd square. -/ +theorem odd_sq_sum_ne_four_mul_sq {ι : Type uIota} [Fintype ι] (a : ι → ℤ) + (ha : ∀ i, Odd (a i)) (hcard : 8 ∣ Fintype.card ι) + {u : ℤ} (hu : Odd u) : (∑ i, a i ^ 2) ≠ 4 * u ^ 2 := by + have hc : (8 : ℤ) ∣ (Fintype.card ι : ℤ) := + Int.natCast_dvd_natCast.mpr hcard + have hzero : Int.ModEq 8 (∑ i, a i ^ 2) 0 := + (sum_univ_odd_sq_mod_eight a ha).trans (Int.modEq_zero_iff_dvd.mpr hc) + have hfour : Int.ModEq 8 (4 * u ^ 2) 4 := by + simpa using (odd_sq_mod_eight hu).mul_left 4 + intro hsum + rw [hsum] at hzero + have hbad : Int.ModEq 8 (0 : ℤ) 4 := hzero.symm.trans hfour + norm_num [Int.ModEq] at hbad + +/-- Natural norm parameters are cast only after forming the literal scalar. -/ +theorem odd_sq_sum_ne_four_mul_nat_sq {ι : Type uIota} [Fintype ι] (a : ι → ℤ) + (ha : ∀ i, Odd (a i)) (hcard : 8 ∣ Fintype.card ι) + {u : ℕ} (hu : Odd u) : (∑ i, a i ^ 2) ≠ ((4 * u ^ 2 : ℕ) : ℤ) := by + simpa using odd_sq_sum_ne_four_mul_sq a ha hcard ((Int.odd_coe_nat u).mpr hu) + +/-- The actual cyclic norm equation is impossible for an all-odd row when +the cyclic order is divisible by eight and the norm parameter is odd. -/ +theorem odd_norm_four_impossible {n u : ℕ} [NeZero n] + (hcard : 8 ∣ n) (hu : Odd u) (T : CyclicRing.Elem ℤ n) + (hodd : ∀ a, Odd (T.coeff a)) + (hnorm : T * CyclicRing.ringStar T = + CyclicRing.scalar n ((4 * u ^ 2 : ℕ) : ℤ)) : False := by + have hsum : (∑ a : ZMod n, T.coeff a ^ 2) = ((4 * u ^ 2 : ℕ) : ℤ) := by + rw [← cyclicNorm_identity_coeff T, hnorm] + simp + exact odd_sq_sum_ne_four_mul_nat_sq (fun a : ZMod n => T.coeff a) hodd + (by simpa using hcard) hu hsum + +/-- For `k ≥ 3`, the order `2^k` meets the exact modulo-eight obstruction. -/ +theorem odd_norm_four_impossible_two_pow {k u : ℕ} [NeZero (2 ^ k)] + (hk : 3 ≤ k) (hu : Odd u) (T : CyclicRing.Elem ℤ (2 ^ k)) + (hodd : ∀ a, Odd (T.coeff a)) + (hnorm : T * CyclicRing.ringStar T = + CyclicRing.scalar (2 ^ k) ((4 * u ^ 2 : ℕ) : ℤ)) : False := by + apply odd_norm_four_impossible (u := u) ?_ hu T hodd hnorm + exact (show 8 ∣ 2 ^ k from pow_dvd_pow 2 hk) + +end CirculantHadamard + +end OAI diff --git a/lean/OAI/LinearAlgebra/CirculantHadamard/Model.lean b/lean/OAI/LinearAlgebra/CirculantHadamard/Model.lean new file mode 100644 index 0000000000000000000000000000000000000000..1d561c3847d262300b05a17f0553fec990178b5f --- /dev/null +++ b/lean/OAI/LinearAlgebra/CirculantHadamard/Model.lean @@ -0,0 +1,26 @@ +import Mathlib + +namespace OAI + +namespace CirculantHadamard + +universe u + +def IsSign {R : Type u} [One R] [Neg R] (x : R) : Prop := + x = 1 ∨ x = -1 + +abbrev RealMatrix (n : ℕ) := Matrix (Fin n) (Fin n) ℝ + +def IsCirculant {n : ℕ} (H : RealMatrix n) : Prop := + ∃ h : Fin n → ℝ, ∀ i j, H i j = h (j - i) + +def IsSignHadamard {n : ℕ} (H : RealMatrix n) : Prop := + (∀ i j, IsSign (H i j)) ∧ + H * H.transpose = (n : ℝ) • (1 : RealMatrix n) + +def ExistsRealCirculantHadamard (n : ℕ) : Prop := + ∃ H : RealMatrix n, IsCirculant H ∧ IsSignHadamard H + +end CirculantHadamard + +end OAI diff --git a/lean/OAI/LinearAlgebra/CirculantHadamard/OrderCyclotomicDivisibility.lean b/lean/OAI/LinearAlgebra/CirculantHadamard/OrderCyclotomicDivisibility.lean new file mode 100644 index 0000000000000000000000000000000000000000..0058ba447f7cc0db67d7bcdca11e32ee23b34ab3 --- /dev/null +++ b/lean/OAI/LinearAlgebra/CirculantHadamard/OrderCyclotomicDivisibility.lean @@ -0,0 +1,118 @@ +import OAI.LinearAlgebra.CirculantHadamard.IntegerLocalDivisibility +import OAI.LinearAlgebra.CirculantHadamard.IntegerTwoLocal +import OAI.LinearAlgebra.CirculantHadamard.CyclotomicIntegerEvaluation +import OAI.LinearAlgebra.CirculantHadamard.CyclotomicRemainder +import OAI.LinearAlgebra.CirculantHadamard.DyadicRemainder +import OAI.LinearAlgebra.CirculantHadamard.RamifiedLocal + +namespace OAI + +universe uA + +/-! +# Dyadic divisibility of opposite coefficient differences + +We evaluate the actual integer cyclic group ring in the cyclotomic extension +of the integers localized at two. The norm identity forces divisibility in +that DVR. Its free monic presentation then transfers this divisibility to the +paired coefficient differences, and localization reflects it to the integers. +-/ + +noncomputable section + +namespace CirculantHadamard + +open Polynomial +open scoped BigOperators + +/-- The canonical polynomial with the literal integer coefficients of a cyclic +element evaluates to the same element in the cyclotomic quotient. -/ +theorem integerCyclotomicEvaluation_coefficientPolynomial + (A : Type uA) [CommRing A] (n : ℕ) [NeZero n] (T : CyclicRing.Elem ℤ n) : + integerCyclotomicEvaluation A n T = + AdjoinRoot.mk (cyclotomic n A) + (DyadicRemainder.coefficientPolynomial n + (fun i => algebraMap ℤ A (T.coeff (i : ZMod n)))) := by + classical + rw [integerCyclotomicEvaluation_apply] + simp only [DyadicRemainder.coefficientPolynomial, map_sum, + ← C_mul_X_pow_eq_monomial, map_mul, map_pow, AdjoinRoot.mk_X, + algebraMap_int_eq, Int.coe_castRingHom, map_intCast] + cases n with + | zero => exact (NeZero.ne 0 rfl).elim + | succ n => + rw [← Fin.sum_univ_eq_sum_range] + change (∑ a : Fin (n + 1), (T.coeff a : AdjoinRoot (cyclotomic (n + 1) A)) * + AdjoinRoot.root (cyclotomic (n + 1) A) ^ a.val) = + ∑ a : Fin (n + 1), (T.coeff (Fin.ofNat (n + 1) a.val) : + AdjoinRoot (cyclotomic (n + 1) A)) * + AdjoinRoot.root (cyclotomic (n + 1) A) ^ a.val + simp only [Fin.ofNat_eq_cast, Fin.cast_val_eq_self] + +/-- A scalar norm of the stated dyadic size forces each opposite coefficient +difference to be divisible by its square-root dyadic factor. No condition on +the parity of the coefficients, or separate positivity of `u`, is required. -/ +theorem dyadic_difference_dvd (k t u : ℕ) + (T : CyclicRing.Elem ℤ (2 ^ (k + 1))) (hu : Odd u) + (hnorm : T * CyclicRing.ringStar T = + CyclicRing.scalar (2 ^ (k + 1)) ((2 ^ (2 * t) * u ^ 2 : ℕ) : ℤ)) : + ∀ j : ZMod (2 ^ k), (2 : ℤ) ^ t ∣ + T.coeff (j.val : ZMod (2 ^ (k + 1))) - + T.coeff ((j.val + 2 ^ k : ℕ) : ZMod (2 ^ (k + 1))) := by + let A := IntegerTwoLocal.Ring + let S := RamifiedLocal.Extension A 2 k + let : IsDomain S := RamifiedLocal.isDomain A Nat.prime_two k + IntegerTwoLocal.maximalIdeal_eq_span + let : IsLocalRing S := RamifiedLocal.isLocalRing A Nat.prime_two k + IntegerTwoLocal.maximalIdeal_eq_span + let : IsDiscreteValuationRing S := RamifiedLocal.isDiscreteValuationRing A + Nat.prime_two k IntegerTwoLocal.maximalIdeal_eq_span + let : CharZero S := charZero_of_injective_algebraMap + (RamifiedLocal.algebraMap_injective A Nat.prime_two k) + have hn : 0 < 2 ^ (k + 1) := pow_pos (by decide) _ + let : NeZero (2 ^ (k + 1)) := ⟨hn.ne'⟩ + let x : S := integerCyclotomicEvaluation A (2 ^ (k + 1)) T + have huS : IsUnit ((u : S) ^ 2) := by + have hunit := (IntegerTwoLocal.isUnit_natCast_of_odd u hu).map + (algebraMap A S) + have huS' : IsUnit (u : S) := by simpa only [map_natCast] using hunit + exact huS'.pow 2 + have hnormS : x * RamifiedConjugation.cyclotomicConjugation A (2 ^ (k + 1)) hn x = + (2 : S) ^ (2 * t) * (u : S) ^ 2 := by + have hcast : (((2 ^ (2 * t) * u ^ 2 : ℕ) : ℤ) : S) = + (2 : S) ^ (2 * t) * (u : S) ^ 2 := by + exact (Int.cast_natCast (R := S) (2 ^ (2 * t) * u ^ 2)).trans + (show ((2 ^ (2 * t) * u ^ 2 : ℕ) : S) = + (2 : S) ^ (2 * t) * (u : S) ^ 2 by + exact (Nat.cast_mul (α := S) (2 ^ (2 * t)) (u ^ 2)).trans + (congrArg₂ (fun a b : S => a * b) + ((Nat.cast_pow (α := S) 2 (2 * t)).trans + (congrArg (fun a : S => a ^ (2 * t)) (Nat.cast_two (R := S)))) + (Nat.cast_pow (α := S) u 2))) + exact (integerCyclotomicEvaluation_norm A (2 ^ (k + 1)) hn T + ((2 ^ (2 * t) * u ^ 2 : ℕ) : ℤ) hnorm).trans hcast + have hdiv : (2 : S) ^ t ∣ x := + RamifiedConjugation.cyclotomic_pow_dvd_of_norm_eq A (2 ^ (k + 1)) hn + 2 x ((u : S) ^ 2) t huS hnormS + let c : ℕ → A := fun i => algebraMap ℤ A (T.coeff (i : ZMod (2 ^ (k + 1)))) + have hpoly : algebraMap A S ((2 : A) ^ t) ∣ + AdjoinRoot.mk (cyclotomic (2 ^ (k + 1)) A) + (DyadicRemainder.coefficientPolynomial (2 ^ (k + 1)) c) := by + simpa only [x, map_pow, map_ofNat, + integerCyclotomicEvaluation_coefficientPolynomial, c, + eq_intCast] using hdiv + intro j + have hcoeff := CyclotomicRemainder.adjoinRoot_dvd_coeff_modByMonic + (cyclotomic (2 ^ (k + 1)) A) (cyclotomic.monic _ _) ((2 : A) ^ t) + (DyadicRemainder.coefficientPolynomial (2 ^ (k + 1)) c) hpoly j.val + rw [DyadicRemainder.coefficientPolynomial_modByMonic_cyclotomic, + DyadicRemainder.remainder_coeff _ _ _ j.val_lt] at hcoeff + apply integer_prime_pow_dvd_of_localization (A := A) (P := IntegerTwoLocal.ideal) + Nat.prime_two rfl t + simpa only [c, map_sub, Nat.cast_ofNat] using hcoeff + +end CirculantHadamard + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/CirculantHadamard/OrderDescent.lean b/lean/OAI/LinearAlgebra/CirculantHadamard/OrderDescent.lean new file mode 100644 index 0000000000000000000000000000000000000000..8064065c5de3c87dedb9e3a36ee36c52dfafd24f --- /dev/null +++ b/lean/OAI/LinearAlgebra/CirculantHadamard/OrderDescent.lean @@ -0,0 +1,67 @@ +import OAI.LinearAlgebra.CirculantHadamard.OrderHalving +import OAI.LinearAlgebra.CirculantHadamard.ModEight + +namespace OAI + +/-! +# Finite descent of an odd dyadic cyclic norm + +The invariant `1 ≤ t` and `t + 2 ≤ k` records exactly the range needed to +halve an odd row until its norm is `4*u^2` while retaining a group order +divisible by eight. Every step invokes the concrete cyclotomic halving +theorem. The final step is the coefficient-square contradiction modulo eight. +-/ + +noncomputable section + +namespace CirculantHadamard + +open CyclicRing + +/-- An odd-coefficient dyadic cyclic norm cannot have two more group +exponents than norm half-exponents. No halving is performed when `t = 1`. -/ +theorem odd_norm_impossible {k t u : ℕ} + (ht : 1 ≤ t) (hkt : t + 2 ≤ k) (hu : Odd u) + (T : Elem ℤ (2 ^ k)) (hodd : ∀ a, Odd (T.coeff a)) + (hnorm : T * ringStar T = scalar (2 ^ k) ((2 ^ (2 * t) * u ^ 2 : ℕ) : ℤ)) : + False := by + suffices main : ∀ t k : ℕ, 1 ≤ t → t + 2 ≤ k → + ∀ T : Elem ℤ (2 ^ k), (∀ a, Odd (T.coeff a)) → + T * ringStar T = scalar (2 ^ k) ((2 ^ (2 * t) * u ^ 2 : ℕ) : ℤ) → + False by + exact main t k ht hkt T hodd hnorm + intro t + induction t with + | zero => + intro k ht + omega + | succ t ih => + intro k ht hkt T hodd hnorm + cases t with + | zero => + have hcard : 8 ∣ 2 ^ k := by + have hpow : (2 : ℕ) ^ 3 ∣ 2 ^ k := pow_dvd_pow 2 (by omega) + norm_num at hpow + exact hpow + apply odd_norm_four_impossible hcard hu T hodd + simpa only [Nat.zero_add, Nat.mul_one, Nat.reducePow] using hnorm + | succ t => + cases k with + | zero => omega + | succ k => + obtain ⟨U, hUodd, hUnorm⟩ := exists_odd_halving + k (t + 1 + 1) u T (by omega) hu hodd hnorm + apply ih k (by omega) (by omega) U hUodd + simpa only [Nat.add_sub_cancel] using hUnorm + +theorem initial_even_power_norm_impossible {s u : ℕ} (hs : 2 ≤ s) (hu : Odd u) + (T : Elem ℤ (2 ^ (2 * s))) (hodd : ∀ a, Odd (T.coeff a)) + (hnorm : T * ringStar T = + scalar (2 ^ (2 * s)) ((2 ^ (2 * s) * u ^ 2 : ℕ) : ℤ)) : False := + odd_norm_impossible (by omega) (by omega) hu T hodd hnorm + +end CirculantHadamard + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/CirculantHadamard/OrderHalving.lean b/lean/OAI/LinearAlgebra/CirculantHadamard/OrderHalving.lean new file mode 100644 index 0000000000000000000000000000000000000000..be83c1f1db991dab1dcd09ccdcb49bd98a041940 --- /dev/null +++ b/lean/OAI/LinearAlgebra/CirculantHadamard/OrderHalving.lean @@ -0,0 +1,177 @@ +import OAI.LinearAlgebra.CirculantHadamard.CyclicRing +import OAI.LinearAlgebra.CirculantHadamard.ProjectionCoefficients +import OAI.LinearAlgebra.CirculantHadamard.OrderCyclotomicDivisibility +import Mathlib.Algebra.Ring.Parity +import Mathlib.Data.Int.Basic +import Mathlib.Tactic.Ring +import Lean.Elab.Tactic.Omega + +namespace OAI + +/-! +# Halving an odd-coefficient dyadic group-ring element + +The integer averaging lemmas retain the original paired coefficients. +The group-ring step uses their actual quotient fiber sums and the concrete +cyclotomic divisibility theorem; the ring is not assumed to be a domain. +-/ + +namespace CirculantHadamard + +open CyclicRing + +/-- The coefficient obtained by projecting a pair and dividing by two. -/ +def pairAverage (a b : ℤ) : ℤ := (a + b) / 2 + +theorem two_mul_pairAverage {a b : ℤ} (ha : Odd a) (hb : Odd b) : + 2 * pairAverage a b = a + b := by + obtain ⟨r, hr⟩ := ha + obtain ⟨s, hs⟩ := hb + dsimp [pairAverage] + omega + +/-- Congruent odd coefficients modulo four have an odd integral average. -/ +theorem odd_pairAverage {a b : ℤ} (hb : Odd b) (hab : (4 : ℤ) ∣ a - b) : + Odd (pairAverage a b) := by + obtain ⟨r, hr⟩ := hb + obtain ⟨s, hs⟩ := hab + refine ⟨r + s, ?_⟩ + dsimp [pairAverage] + omega + +theorem odd_pairAverage_of_two_pow_dvd {a b : ℤ} {t : ℕ} + (hb : Odd b) (ht : 2 ≤ t) (hab : (2 : ℤ) ^ t ∣ a - b) : + Odd (pairAverage a b) := by + apply odd_pairAverage hb + have hpow : (2 : ℤ) ^ 2 ∣ (2 : ℤ) ^ t := pow_dvd_pow 2 ht + exact (show (4 : ℤ) ∣ (2 : ℤ) ^ t from hpow).trans hab + +theorem normScalar_halving (u : ℤ) {t : ℕ} (ht : 1 ≤ t) : + (2 : ℤ) ^ (2 * t) * u ^ 2 = + 4 * ((2 : ℤ) ^ (2 * (t - 1)) * u ^ 2) := by + have hexp : 2 * t = 2 * (t - 1) + 2 := by omega + rw [hexp, pow_add] + ring + +/-- Literal paired coefficients on the quotient of a cyclic group of even +order. Integer divisibility is proved separately before this is used. -/ +noncomputable def halvePairs {m : ℕ} [NeZero m] (T : Elem ℤ (2 * m)) : Elem ℤ m := + ofCoeffs fun j => pairAverage (T.coeff (j.val : ZMod (2 * m))) + (T.coeff ((j.val + m : ℕ) : ZMod (2 * m))) + +@[simp] theorem halvePairs_apply {m : ℕ} [NeZero m] (T : Elem ℤ (2 * m)) + (j : ZMod m) : + (halvePairs T).coeff j = pairAverage (T.coeff (j.val : ZMod (2 * m))) + (T.coeff ((j.val + m : ℕ) : ZMod (2 * m))) := rfl + +theorem halvePairs_odd {m : ℕ} [NeZero m] (T : Elem ℤ (2 * m)) + (hodd : ∀ j, Odd (T.coeff j)) + (hpair : ∀ j : ZMod m, (4 : ℤ) ∣ + T.coeff (j.val : ZMod (2 * m)) - T.coeff ((j.val + m : ℕ) : ZMod (2 * m))) : + ∀ j, Odd ((halvePairs T).coeff j) := by + intro j + exact odd_pairAverage (hodd _) (hpair j) + +/-- Cancellation takes place in each integer coefficient. A cyclic group +ring has zero divisors, which are irrelevant to this scalar cancellation. -/ +theorem four_smul_cancel {m : ℕ} {S T : Elem ℤ m} + (h : (4 : ℤ) • S = (4 : ℤ) • T) : S = T := by + apply AddMonoidAlgebra.coeff_injective + apply Finsupp.ext + intro j + have hj := congrArg (fun f : Elem ℤ m => f.coeff j) h + change 4 * S.coeff j = 4 * T.coeff j at hj + omega + +theorem norm_of_double_norm {m : ℕ} [NeZero m] (T : Elem ℤ m) (c : ℤ) + (h : ((2 : ℤ) • T) * ringStar ((2 : ℤ) • T) = scalar m (4 * c)) : + T * ringStar T = scalar m c := by + have hstar : ringStar ((2 : ℤ) • T) = (2 : ℤ) • ringStar T := by + apply AddMonoidAlgebra.coeff_injective + apply Finsupp.ext + intro j + change star ((2 : ℤ) * T.coeff (-j)) = (2 : ℤ) * star (T.coeff (-j)) + simp only [star_trivial] + have hfour : ((2 : ℤ) • T) * ringStar ((2 : ℤ) • T) = + (4 : ℤ) • (T * ringStar T) := by + rw [hstar, smul_mul_assoc, mul_smul_comm, smul_smul] + rfl + have hscalar : scalar m (4 * c) = (4 : ℤ) • scalar m c := by + apply AddMonoidAlgebra.coeff_injective + apply Finsupp.ext + intro j + change (scalar m (4 * c)).coeff j = (4 : ℤ) * (scalar m c).coeff j + by_cases hj : j = 0 <;> simp [scalar_apply, hj] + apply four_smul_cancel + rw [← hfour, h, hscalar] + +/-- Odd coefficients make the literal projected fiber sums exactly twice the +integer averages. This is an identity for the actual cyclic quotient map. -/ +theorem cyclicProjection_eq_two_smul_halvePairs {m : ℕ} [NeZero m] + (h : m ∣ 2 * m) (T : Elem ℤ (2 * m)) (hodd : ∀ j, Odd (T.coeff j)) : + cyclicProjection ℤ h T = (2 : ℤ) • halvePairs T := by + apply AddMonoidAlgebra.coeff_injective + apply Finsupp.ext + intro j + rw [cyclicProjection_double_apply (NeZero.pos m) h] + change _ = 2 * pairAverage _ _ + exact (two_mul_pairAverage (hodd _) (hodd _)).symm + +/-- Projecting and dividing by two divides the scalar norm by four. All +coefficient and star identities are consequences of the actual quotient. -/ +theorem halvePairs_norm {m : ℕ} [NeZero m] [NeZero (2 * m)] + (T : Elem ℤ (2 * m)) (c : ℤ) (hodd : ∀ j, Odd (T.coeff j)) + (hnorm : T * ringStar T = scalar (2 * m) (4 * c)) : + halvePairs T * ringStar (halvePairs T) = scalar m c := by + have hdiv : m ∣ 2 * m := ⟨2, Nat.mul_comm 2 m⟩ + have hproj := cyclicProjection_norm hdiv hnorm + rw [cyclicProjection_eq_two_smul_halvePairs hdiv T hodd] at hproj + exact norm_of_double_norm (halvePairs T) c hproj + +/-- Algebraic halving with paired divisibility. In the dyadic case, cyclotomic +evaluation supplies this divisibility from the norm equation. -/ +theorem halvePairs_odd_norm_of_pair_divisibility {m : ℕ} [NeZero m] [NeZero (2 * m)] + (t u : ℕ) (T : Elem ℤ (2 * m)) (ht : 2 ≤ t) + (hodd : ∀ j, Odd (T.coeff j)) + (hnorm : T * ringStar T = scalar (2 * m) ((2 ^ (2 * t) * u ^ 2 : ℕ) : ℤ)) + (hpair : ∀ j : ZMod m, (2 : ℤ) ^ t ∣ + T.coeff (j.val : ZMod (2 * m)) - T.coeff ((j.val + m : ℕ) : ZMod (2 * m))) : + (∀ j, Odd ((halvePairs T).coeff j)) ∧ + halvePairs T * ringStar (halvePairs T) = + scalar m ((2 ^ (2 * (t - 1)) * u ^ 2 : ℕ) : ℤ) := by + constructor + · intro j + exact odd_pairAverage_of_two_pow_dvd (hodd _) ht (hpair j) + · apply halvePairs_norm T _ hodd + have hs : ((2 ^ (2 * t) * u ^ 2 : ℕ) : ℤ) = + 4 * ((2 ^ (2 * (t - 1)) * u ^ 2 : ℕ) : ℤ) := by + simpa only [Nat.cast_mul, Nat.cast_pow, Nat.cast_ofNat] using + normScalar_halving (u : ℤ) (show 1 ≤ t by omega) + rw [← hs] + exact hnorm + +/-- The actual dyadic order-halving step. The paired divisibility is supplied +by cyclotomic evaluation and localization, not assumed in this statement. +The constructed witness is the literal paired average `halvePairs`. -/ +theorem exists_odd_halving (k t u : ℕ) (T : Elem ℤ (2 ^ (k + 1))) + (ht : 2 ≤ t) (hu : Odd u) (hodd : ∀ j, Odd (T.coeff j)) + (hnorm : T * ringStar T = + scalar (2 ^ (k + 1)) ((2 ^ (2 * t) * u ^ 2 : ℕ) : ℤ)) : + ∃ U : Elem ℤ (2 ^ k), (∀ j, Odd (U.coeff j)) ∧ + U * ringStar U = scalar (2 ^ k) ((2 ^ (2 * (t - 1)) * u ^ 2 : ℕ) : ℤ) := by + have hstep (n : ℕ) [NeZero n] (hn : n = 2 * 2 ^ k) (S : Elem ℤ n) + (hS : ∀ j, Odd (S.coeff j)) + (hnormS : S * ringStar S = scalar n ((2 ^ (2 * t) * u ^ 2 : ℕ) : ℤ)) + (hpair : ∀ j : ZMod (2 ^ k), (2 : ℤ) ^ t ∣ + S.coeff (j.val : ZMod n) - S.coeff ((j.val + 2 ^ k : ℕ) : ZMod n)) : + ∃ U : Elem ℤ (2 ^ k), (∀ j, Odd (U.coeff j)) ∧ + U * ringStar U = scalar (2 ^ k) ((2 ^ (2 * (t - 1)) * u ^ 2 : ℕ) : ℤ) := by + subst n + exact ⟨halvePairs S, + halvePairs_odd_norm_of_pair_divisibility t u S ht hS hnormS hpair⟩ + exact hstep (2 ^ (k + 1)) (pow_succ' 2 k) T hodd hnorm + (dyadic_difference_dvd k t u T hu hnorm) + +end CirculantHadamard + +end OAI diff --git a/lean/OAI/LinearAlgebra/CirculantHadamard/OrderProjection.lean b/lean/OAI/LinearAlgebra/CirculantHadamard/OrderProjection.lean new file mode 100644 index 0000000000000000000000000000000000000000..735c53d56dc47b8b3433f97ae48508637564241c --- /dev/null +++ b/lean/OAI/LinearAlgebra/CirculantHadamard/OrderProjection.lean @@ -0,0 +1,105 @@ +import OAI.LinearAlgebra.CirculantHadamard.CyclicNorm +import OAI.LinearAlgebra.CirculantHadamard.ProjectionCoefficients +import Mathlib.GroupTheory.Index +import Mathlib.Algebra.Ring.Int.Parity +import Mathlib.Tactic.NormNum + +namespace OAI + +universe uα + +/-! +# The first order projection + +The quotient sends the original cyclic generator to the cyclic generator of +the smaller order. Its coefficients are the sums over the actual reduction +fibers. When `n = m * d`, every fiber contains exactly `d` original indices; +an odd number of signs therefore produces an odd integer coefficient. + +The norm scalar is preserved by the quotient map. In particular, projecting +from `2^(2*s) * u^2` to `2^(2*s)` does not divide the original norm scalar. +-/ + +noncomputable section + +namespace CirculantHadamard + +open scoped BigOperators + +/-- Every fiber of reduction modulo a divisor has the exact quotient size. -/ +theorem cyclic_reduction_fiber_card {n m d : ℕ} [NeZero n] [NeZero m] + (hdiv : m ∣ n) (hn : n = m * d) (a : ZMod m) : + Fintype.card {x : ZMod n // ZMod.castHom hdiv (ZMod m) x = a} = d := by + classical + let q : ZMod n →+ ZMod m := (ZMod.castHom hdiv (ZMod m)).toAddMonoidHom + have hsurj : Function.Surjective q := by + intro b + refine ⟨(b.val : ZMod n), ?_⟩ + change ZMod.castHom hdiv (ZMod m) (b.val : ZMod n) = b + simp only [map_natCast, ZMod.natCast_zmod_val] + have hcards (b : ZMod m) : + (Finset.univ.filter (fun x : ZMod n => q x = b)).card = + (Finset.univ.filter (fun x : ZMod n => q x = a)).card := + AddMonoidHom.card_fiber_eq_of_mem_range q (hsurj b) (hsurj a) + have htotal : n = m * (Finset.univ.filter (fun x : ZMod n => q x = a)).card := by + calc + n = (Finset.univ : Finset (ZMod n)).card := by simp + _ = ∑ b : ZMod m, (Finset.univ.filter (fun x : ZMod n => q x = b)).card := + Finset.card_eq_sum_card_fiberwise (fun _ _ => Finset.mem_univ _) + _ = m * (Finset.univ.filter (fun x : ZMod n => q x = a)).card := by + simp only [hcards, Finset.sum_const, Finset.card_univ, ZMod.card, smul_eq_mul] + rw [Fintype.card_subtype] + exact Nat.eq_of_mul_eq_mul_left (NeZero.pos m) (htotal.symm.trans hn) + +/-- An odd finite family of actual integer signs has odd sum. -/ +theorem odd_sum_of_signs {α : Type uα} [Fintype α] (f : α → ℤ) + (hf : ∀ x, IsSign (f x)) (hcard : Odd (Fintype.card α)) : + Odd (∑ x, f x) := by + classical + apply Int.odd_iff.mpr + have hmod (x : α) : f x % 2 = 1 := by + rcases hf x with hx | hx <;> norm_num [hx] + calc + (∑ x, f x) % 2 = (∑ _x : α, (1 : ℤ)) % 2 := by + rw [Finset.sum_int_mod] + simp only [hmod] + _ = (Fintype.card α : ℤ) % 2 := by simp + _ = 1 := Int.odd_iff.mp ((Int.odd_coe_nat _).mpr hcard) + +/-- The actual quotient coefficient is odd because its fiber consists of +exactly the specified odd number of original signs. -/ +theorem cyclicProjection_odd_coefficients {n m d : ℕ} [NeZero n] [NeZero m] + (hdiv : m ∣ n) (hn : n = m * d) (hd : Odd d) + (f : CyclicRing.Elem ℤ n) (hf : CyclicSignRow f) (a : ZMod m) : + Odd ((cyclicProjection ℤ hdiv f).coeff a) := by + classical + rw [cyclicProjection_apply_fiber] + apply odd_sum_of_signs + (α := {x : ZMod n // ZMod.castHom hdiv (ZMod m) x = a}) + (fun x => f.coeff x.val) (fun x => hf x.val) + rw [cyclic_reduction_fiber_card hdiv hn a] + exact hd + +/-- First projection in the order reduction: every coefficient is odd and +the scalar on the right of the norm equation remains the original order. -/ +theorem exists_odd_cyclic_projection {n s u : ℕ} [NeZero n] + (hu : Odd u) (heq : n = 2 ^ (2 * s) * u ^ 2) + (f : CyclicRing.Elem ℤ n) (hsign : CyclicSignRow f) + (hnorm : f * CyclicRing.ringStar f = CyclicRing.scalar n (n : ℤ)) : + ∃ T : CyclicRing.Elem ℤ (2 ^ (2 * s)), + (∀ a, Odd (T.coeff a)) ∧ + T * CyclicRing.ringStar T = + CyclicRing.scalar _ ((2 ^ (2 * s) * u ^ 2 : ℕ) : ℤ) := by + let : NeZero (2 ^ (2 * s)) := ⟨pow_ne_zero _ (by decide)⟩ + have hdiv : 2 ^ (2 * s) ∣ n := ⟨u ^ 2, heq⟩ + refine ⟨cyclicProjection ℤ hdiv f, ?_, ?_⟩ + · exact cyclicProjection_odd_coefficients hdiv heq hu.pow f hsign + · calc + _ = CyclicRing.scalar _ (n : ℤ) := cyclicProjection_norm hdiv hnorm + _ = CyclicRing.scalar _ ((2 ^ (2 * s) * u ^ 2 : ℕ) : ℤ) := by rw [heq] + +end CirculantHadamard + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/CirculantHadamard/OrderReduction.lean b/lean/OAI/LinearAlgebra/CirculantHadamard/OrderReduction.lean new file mode 100644 index 0000000000000000000000000000000000000000..651526d5d82e6ad5e1034f92e3d409c8eacfa36a --- /dev/null +++ b/lean/OAI/LinearAlgebra/CirculantHadamard/OrderReduction.lean @@ -0,0 +1,48 @@ +import OAI.LinearAlgebra.CirculantHadamard.OrderSquareEven +import OAI.LinearAlgebra.CirculantHadamard.TwoAdicDecomposition +import OAI.LinearAlgebra.CirculantHadamard.OrderProjection +import OAI.LinearAlgebra.CirculantHadamard.OrderDescent + +namespace OAI + +/-! +# The order of an actual circulant sign Hadamard matrix + +The matrix supplies its literal integer sign row. Its positive even square +order has a two-adic decomposition. Projecting the actual row gives odd +coefficients, and the proved cyclotomic halving descent excludes every +two-adic exponent except two, without any coefficient-divisibility or descent +assumption. +-/ + +namespace CirculantHadamard + +/-- Every nontrivial actual real circulant sign Hadamard matrix has order +`4 * u^2` for a positive odd natural number `u`. -/ +theorem order_reduction {n : ℕ} (hn : 1 < n) + (h : ExistsRealCirculantHadamard n) : + ∃ u : ℕ, 0 < u ∧ Odd u ∧ n = 4 * u ^ 2 := by + let : NeZero n := ⟨by omega⟩ + obtain ⟨hsquare, heven⟩ := order_square_even hn h + obtain ⟨s, u, hs, huPos, hu, horder⟩ := + exists_two_adic_square_decomposition_of_positive_square hsquare heven + obtain ⟨f, hf, hnorm⟩ := (exists_cyclicSignRow_iff_real (n := n)).2 h + have hsOne : s = 1 := by + by_contra hsOne + have hsTwo : 2 ≤ s := by omega + obtain ⟨T, hodd, hTnorm⟩ := + exists_odd_cyclic_projection hu horder f hf hnorm + exact odd_norm_impossible (by omega : 1 ≤ s) (by omega : s + 2 ≤ 2 * s) + hu T hodd hTnorm + refine ⟨u, huPos, hu, ?_⟩ + simpa [hsOne] using horder + +/-- The order restriction stated directly for the supplied real matrix. -/ +theorem order_reduction_of_matrix {n : ℕ} (hn : 1 < n) (H : RealMatrix n) + (hc : IsCirculant H) (hh : IsSignHadamard H) : + ∃ u : ℕ, 0 < u ∧ Odd u ∧ n = 4 * u ^ 2 := + order_reduction hn ⟨H, hc, hh⟩ + +end CirculantHadamard + +end OAI diff --git a/lean/OAI/LinearAlgebra/CirculantHadamard/OrderSquareEven.lean b/lean/OAI/LinearAlgebra/CirculantHadamard/OrderSquareEven.lean new file mode 100644 index 0000000000000000000000000000000000000000..728e4637fe512ced4686161f8f262e0543d0f43a --- /dev/null +++ b/lean/OAI/LinearAlgebra/CirculantHadamard/OrderSquareEven.lean @@ -0,0 +1,88 @@ +import OAI.LinearAlgebra.CirculantHadamard.CyclicNorm +import Mathlib.Algebra.Ring.Parity +import Mathlib.Tactic.NormNum + +namespace OAI + +universe uIota + +/-! +# Square and even order from actual circulant sign rows + +Augmentation of the cyclic norm identity gives an integer square. A +nonidentity correlation is a zero sum of signs; reduction modulo two makes +its number of summands even. Both conclusions follow from the actual real +circulant Hadamard matrix predicate. +-/ + +namespace CirculantHadamard + +open scoped BigOperators + +private theorem positive_nat_square_of_int_square {n : ℕ} (hn : 0 < n) + (z : ℤ) (hz : z ^ 2 = (n : ℤ)) : + ∃ m : ℕ, 0 < m ∧ n = m ^ 2 := by + have hsq : z.natAbs ^ 2 = n := by + simpa only [Int.natAbs_pow, Int.natAbs_natCast] using congrArg Int.natAbs hz + have hm : z.natAbs ≠ 0 := by + intro hm + have hzero : n = 0 := by simpa only [hm, zero_pow (by decide : (2 : ℕ) ≠ 0)] using hsq.symm + exact (Nat.ne_of_gt hn) hzero + exact ⟨z.natAbs, Nat.pos_of_ne_zero hm, hsq.symm⟩ + +private theorem even_card_of_sign_sum_zero {ι : Type uIota} [Fintype ι] + (f : ι → ℤ) (hsign : ∀ i, IsSign (f i)) (hsum : ∑ i, f i = 0) : + Even (Fintype.card ι) := by + classical + let φ : ℤ →+* ZMod 2 := Int.castRingHom (ZMod 2) + have hcast (i : ι) : φ (f i) = 1 := by + rcases hsign i with h | h + · rw [h, map_one] + · rw [h, map_neg, map_one] + exact ZMod.neg_eq_self_mod_two (1 : ZMod 2) + have hcard : (Fintype.card ι : ZMod 2) = 0 := by + have h := congrArg φ hsum + simpa only [map_sum, hcast, map_zero, Finset.sum_const, Finset.card_univ, + nsmul_eq_mul, mul_one] using h + exact even_iff_two_dvd.mpr ((ZMod.natCast_eq_zero_iff _ _).mp hcard) + +/-- A nonidentity norm coefficient is a zero sum of exactly `n` signs. -/ +theorem order_even_of_sign_norm {n : ℕ} [NeZero n] (hn : 1 < n) + (f : CyclicRing.Elem ℤ n) (hsign : CyclicSignRow f) + (hnorm : f * CyclicRing.ringStar f = CyclicRing.scalar n (n : ℤ)) : + Even n := by + classical + let : Fact (1 < n) := ⟨hn⟩ + have hcorr : (∑ a : ZMod n, f.coeff a * f.coeff (a - 1)) = 0 := by + have h := congrArg (fun g : CyclicRing.Elem ℤ n => g.coeff 1) hnorm + simpa only [CyclicRing.mul_ringStar_apply, star_trivial, CyclicRing.scalar_apply, + ite_eq_right (one_ne_zero : (1 : ZMod n) ≠ 0)] using h + have heven := even_card_of_sign_sum_zero (fun a : ZMod n => f.coeff a * f.coeff (a - 1)) + (fun a => by + rcases hsign a with ha | ha <;> rcases hsign (a - 1) with hb | hb <;> + simp [IsSign, ha, hb]) hcorr + simpa only [ZMod.card] using heven + +/-- Square and even order from the actual integer sign norm equation. -/ +theorem order_square_even_of_sign_norm {n : ℕ} [NeZero n] (hn : 1 < n) + (f : CyclicRing.Elem ℤ n) (hsign : CyclicSignRow f) + (hnorm : f * CyclicRing.ringStar f = CyclicRing.scalar n (n : ℤ)) : + (∃ m : ℕ, 0 < m ∧ n = m ^ 2) ∧ Even n := by + constructor + · exact positive_nat_square_of_int_square (lt_trans Nat.zero_lt_one hn) + (CyclicRing.augmentation n f) (CyclicRing.augmentation_norm f (n : ℤ) hnorm) + · exact order_even_of_sign_norm hn f hsign hnorm + +/-- A nontrivial actual real circulant sign Hadamard matrix has positive +square order and even order. The integer row and its norm identity are +obtained from the proved matrix correspondence. -/ +theorem order_square_even {n : ℕ} (hn : 1 < n) + (h : ExistsRealCirculantHadamard n) : + (∃ m : ℕ, 0 < m ∧ n = m ^ 2) ∧ Even n := by + let : NeZero n := ⟨Nat.ne_of_gt (lt_trans Nat.zero_lt_one hn)⟩ + obtain ⟨f, hsign, hnorm⟩ := exists_cyclicSignRow_iff_real.mpr h + exact order_square_even_of_sign_norm hn f hsign hnorm + +end CirculantHadamard + +end OAI diff --git a/lean/OAI/LinearAlgebra/CirculantHadamard/PrimeCharacterEvaluations.lean b/lean/OAI/LinearAlgebra/CirculantHadamard/PrimeCharacterEvaluations.lean new file mode 100644 index 0000000000000000000000000000000000000000..b3f5a3fc4799cface5ddaac058173b59b1a88360 --- /dev/null +++ b/lean/OAI/LinearAlgebra/CirculantHadamard/PrimeCharacterEvaluations.lean @@ -0,0 +1,425 @@ +import OAI.LinearAlgebra.CirculantHadamard.CyclicEvaluation +import OAI.LinearAlgebra.CirculantHadamard.CyclicPolynomial +import OAI.LinearAlgebra.CirculantHadamard.PrimeComponents +import OAI.LinearAlgebra.CirculantHadamard.CyclotomicRings +import Mathlib.Algebra.Star.BigOperators +import Mathlib.Tactic.Linarith + +namespace OAI + +universe uR uS uT uA + +/-! +# Actual prime-component character evaluations + +The partial-evaluation homomorphism retains one cyclic coordinate and evaluates +the others. Its multiplication and subsequent evaluation laws follow from its +construction, rather than assumptions attached to the factors of a norm equation. +-/ + +noncomputable section + +namespace CirculantHadamard.PrimeCharacterEvaluations + +open scoped BigOperators +open CyclicRing + +section WeightedProjection + +variable {R : Type uR} {S : Type uS} {T : Type uT} [Semiring R] [CommSemiring S] [CommSemiring T] +variable {n m : ℕ} + +/-- A character with values in the actual residual cyclic group algebra. -/ +def weightedCharacter (f : ZMod n →+ ZMod m) + (χ : Multiplicative (ZMod n) →* S) : + Multiplicative (ZMod n) →* Elem S m where + toFun g := AddMonoidAlgebra.single (f g.toAdd) (χ g) + map_one' := by + change AddMonoidAlgebra.single (f 0) (χ 1) = 1 + simp only [map_zero, map_one, AddMonoidAlgebra.one_def] + map_mul' g h := by + change AddMonoidAlgebra.single (f (g.toAdd + h.toAdd)) (χ (g * h)) = _ + simp only [map_add, map_mul, AddMonoidAlgebra.single_mul_single] + +@[simp] theorem weightedCharacter_apply (f : ZMod n →+ ZMod m) + (χ : Multiplicative (ZMod n) →* S) (g : ZMod n) : + weightedCharacter f χ (Multiplicative.ofAdd g) = + AddMonoidAlgebra.single (f g) (χ (Multiplicative.ofAdd g)) := rfl + +/-- Coefficients are mapped by `φ`, the coordinate `f` is kept as a variable, +and all other character values become coefficients. -/ +def weightedProjection (φ : R →+* S) (f : ZMod n →+ ZMod m) + (χ : Multiplicative (ZMod n) →* S) : Elem R n →+* Elem S m := + evaluate (AddMonoidAlgebra.singleZeroRingHom.comp φ) (weightedCharacter f χ) + +@[simp] theorem weightedProjection_single (φ : R →+* S) + (f : ZMod n →+ ZMod m) (χ : Multiplicative (ZMod n) →* S) + (g : ZMod n) (r : R) : + weightedProjection φ f χ (AddMonoidAlgebra.single g r) = + AddMonoidAlgebra.single (f g) (φ r * χ (Multiplicative.ofAdd g)) := by + simp only [weightedProjection, evaluate_single, RingHom.comp_apply, + AddMonoidAlgebra.singleZeroRingHom_apply, AddMonoidAlgebra.singleAddHom, + weightedCharacter_apply, + AddMonoidAlgebra.single_mul_single, zero_add] + +@[simp] theorem weightedProjection_scalar (φ : R →+* S) + (f : ZMod n →+ ZMod m) (χ : Multiplicative (ZMod n) →* S) (r : R) : + weightedProjection φ f χ (scalar n r) = scalar m (φ r) := by + rw [scalar, weightedProjection_single, map_zero] + change AddMonoidAlgebra.single 0 (φ r * χ 1) = _ + simp only [map_one, mul_one, scalar] + +private theorem toMultiplicative_apply (f : ZMod n →+ ZMod m) (a : ZMod n) : + f.toMultiplicative (Multiplicative.ofAdd a) = Multiplicative.ofAdd (f a) := rfl + +/-- Subsequent evaluation is exactly the product of the evaluated coefficients +and the character of the retained coordinate. -/ +theorem evaluate_weightedProjection (φ : R →+* S) (ψ : S →+* T) + (f : ZMod n →+ ZMod m) (χ : Multiplicative (ZMod n) →* S) + (θ : Multiplicative (ZMod m) →* T) : + (evaluate ψ θ).comp (weightedProjection φ f χ) = + evaluate (ψ.comp φ) + ((ψ.toMonoidHom.comp χ) * (θ.comp f.toMultiplicative)) := by + apply AddMonoidAlgebra.ringHom_ext + · intro r + simp only [RingHom.comp_apply, weightedProjection_single, evaluate_single, + map_zero, map_mul, MonoidHom.mul_apply, MonoidHom.comp_apply, + toMultiplicative_apply, RingHom.toMonoidHom_eq_coe] + simp + · intro g + simp only [RingHom.comp_apply, weightedProjection_single, evaluate_single, + map_one, one_mul, MonoidHom.mul_apply, MonoidHom.comp_apply, + toMultiplicative_apply, RingHom.toMonoidHom_eq_coe] + rfl + +/-- Norm preservation is a consequence of the constructed ring homomorphism. +In particular it does not require the residual group algebra to be a domain. -/ +theorem weightedProjection_product (φ : R →+* S) (f : ZMod n →+ ZMod m) + (χ : Multiplicative (ZMod n) →* S) (x y : Elem R n) (r : R) + (hxy : x * y = scalar n r) : + weightedProjection φ f χ x * weightedProjection φ f χ y = scalar m (φ r) := by + rw [← map_mul, hxy, weightedProjection_scalar] + +end WeightedProjection + +open PrimeComponents CyclotomicRings + +/-- The actual CRT coordinate, without a chosen-decomposition hypothesis. -/ +def coordinate (u : ℕ) (hu : 0 < u) (p : PrimeIndex u) : + ZMod (u ^ 2) →+ Component u p where + toFun a := crt u hu a p + map_zero' := by simp + map_add' a b := by simp + +@[simp] theorem coordinate_generator (u : ℕ) (hu : 0 < u) (p : PrimeIndex u) : + coordinate u hu p (primaryGenerator u hu p) = 1 := + crt_primaryGenerator_same u hu p + +@[simp] theorem coordinate_generator_ne (u : ℕ) (hu : 0 < u) + (p q : PrimeIndex u) (h : q ≠ p) : + coordinate u hu q (primaryGenerator u hu p) = 0 := + crt_primaryGenerator_ne u hu p q h + +section RootCharacters +variable {A : Type uA} [CommMonoid A] + +theorem root_order_pow (u : ℕ) (hu : 0 < u) (p : PrimeIndex u) + (r : A) (hr : r ^ p.val = 1) : r ^ order u p.val = 1 := by + obtain ⟨t, ht⟩ := prime_dvd_order hu p.property + rw [ht, pow_mul, hr, one_pow] + +def componentCharacter (u : ℕ) (hu : 0 < u) (p : PrimeIndex u) + (r : A) (hr : r ^ p.val = 1) : Multiplicative (ZMod (u ^ 2)) →* A := + (CyclicPolynomial.powerCharacter (order u p.val) r (root_order_pow u hu p r hr)).comp + (coordinate u hu p).toMultiplicative + +@[simp] theorem componentCharacter_apply (u : ℕ) (hu : 0 < u) (p : PrimeIndex u) + (r : A) (hr : r ^ p.val = 1) (a : ZMod (u ^ 2)) : + componentCharacter u hu p r hr (Multiplicative.ofAdd a) = + r ^ (coordinate u hu p a).val := rfl + +@[simp] theorem componentCharacter_generator (u : ℕ) (hu : 0 < u) + (p : PrimeIndex u) (r : A) (hr : r ^ p.val = 1) : + componentCharacter u hu p r hr (Multiplicative.ofAdd (primaryGenerator u hu p)) = r := by + change CyclicPolynomial.powerCharacter (order u p.val) r (root_order_pow u hu p r hr) (Multiplicative.ofAdd + (coordinate u hu p (primaryGenerator u hu p))) = r + rw [coordinate_generator, CyclicPolynomial.powerCharacter_generator] + +@[simp] theorem componentCharacter_generator_ne (u : ℕ) (hu : 0 < u) + (p q : PrimeIndex u) (h : q ≠ p) (r : A) (hr : r ^ q.val = 1) : + componentCharacter u hu q r hr (Multiplicative.ofAdd (primaryGenerator u hu p)) = 1 := by + rw [componentCharacter_apply, coordinate_generator_ne u hu p q h] + simp + +/-- A finite product of the actual primary-coordinate characters. -/ +def rootsCharacter (u : ℕ) (hu : 0 < u) (r : PrimeIndex u → A) + (hr : ∀ p, r p ^ p.val = 1) (S : Finset (PrimeIndex u)) : + Multiplicative (ZMod (u ^ 2)) →* A := + ∏ p ∈ S, componentCharacter u hu p (r p) (hr p) + +@[simp] theorem rootsCharacter_apply (u : ℕ) (hu : 0 < u) (r : PrimeIndex u → A) + (hr : ∀ p, r p ^ p.val = 1) (S : Finset (PrimeIndex u)) (a : ZMod (u ^ 2)) : + rootsCharacter u hu r hr S (Multiplicative.ofAdd a) = + ∏ p ∈ S, r p ^ (coordinate u hu p a).val := by + simp [rootsCharacter] + +@[simp] theorem rootsCharacter_empty (u : ℕ) (hu : 0 < u) (r : PrimeIndex u → A) + (hr : ∀ p, r p ^ p.val = 1) : rootsCharacter u hu r hr ∅ = 1 := by + simp [rootsCharacter] + +theorem rootsCharacter_generator (u : ℕ) (hu : 0 < u) (r : PrimeIndex u → A) + (hr : ∀ p, r p ^ p.val = 1) (S : Finset (PrimeIndex u)) (p : PrimeIndex u) : + rootsCharacter u hu r hr S (Multiplicative.ofAdd (primaryGenerator u hu p)) = + if p ∈ S then r p else 1 := by + classical + simp only [rootsCharacter, MonoidHom.finsetProd_apply] + have heq : ∀ q ∈ S, componentCharacter u hu q (r q) (hr q) + (Multiplicative.ofAdd (primaryGenerator u hu p)) = if q = p then r p else 1 := by + intro q _ + by_cases h : q = p + · subst q + simp only [componentCharacter_generator, ite_true] + · simp [h, componentCharacter_generator_ne u hu p q h] + rw [Finset.prod_congr rfl heq] + simp + +end RootCharacters + +/-- The chosen primitive prime root in the literal global coefficient ring. -/ +def rhoB (u : ℕ) (p : PrimeIndex u) : B u := + ⟨rho p.val, rho_mem_B u p.val p.property⟩ + +@[simp] theorem coe_rhoB (u : ℕ) (p : PrimeIndex u) : + (rhoB u p : ℂ) = rho p.val := rfl + +theorem rhoB_pow (u : ℕ) (p : PrimeIndex u) : rhoB u p ^ p.val = 1 := + Subtype.ext (rho_pow p.val (prime_of_mem p.property).ne_zero) + +theorem rhoB_ne_one (u : ℕ) (p : PrimeIndex u) : rhoB u p ≠ 1 := by + intro h + exact (rho_isPrimitiveRoot p.val (prime_of_mem p.property).ne_zero).ne_one + (prime_of_mem p.property).one_lt (congrArg Subtype.val h) + +def subsetCharacter (u : ℕ) (hu : 0 < u) (S : Finset (PrimeIndex u)) : + Multiplicative (ZMod (u ^ 2)) →* B u := + rootsCharacter u hu (rhoB u) (rhoB_pow u) S + +@[simp] theorem subsetCharacter_empty (u : ℕ) (hu : 0 < u) : + subsetCharacter u hu ∅ = 1 := rootsCharacter_empty _ _ _ _ + +theorem subsetCharacter_generator (u : ℕ) (hu : 0 < u) + (S : Finset (PrimeIndex u)) (p : PrimeIndex u) : + subsetCharacter u hu S (Multiplicative.ofAdd (primaryGenerator u hu p)) = + if p ∈ S then rhoB u p else 1 := rootsCharacter_generator _ _ _ _ _ _ + +theorem subsetCharacter_nonempty (u : ℕ) (hu : 0 < u) + (S : Finset (PrimeIndex u)) (hS : S.Nonempty) : + ∃ a : ZMod (u ^ 2), subsetCharacter u hu S (Multiplicative.ofAdd a) ≠ 1 := by + obtain ⟨p, hp⟩ := hS + refine ⟨primaryGenerator u hu p, ?_⟩ + rw [subsetCharacter_generator, ite_eq_left hp] + exact rhoB_ne_one u p + +def subsetEvaluation (u : ℕ) (hu : 0 < u) (S : Finset (PrimeIndex u)) : + Elem GaussianRing (u ^ 2) →+* B u := + evaluate (gaussianToB u).toRingHom (subsetCharacter u hu S) + +/-- The omitted root is replaced by one; all remaining roots lie in the actual away ring. -/ +def rhoAway (u : ℕ) (p q : PrimeIndex u) : awayRing u p.val := by + classical + exact if h : q = p then 1 else + ⟨rho q.val, rho_mem_awayRing u p.val q.val q.property + (fun he => h (Subtype.ext he))⟩ + +theorem rhoAway_pow (u : ℕ) (p q : PrimeIndex u) : rhoAway u p q ^ q.val = 1 := by + classical + by_cases h : q = p + · simp [rhoAway, h] + · apply Subtype.ext + simpa [rhoAway, h] using rho_pow q.val (prime_of_mem q.property).ne_zero + +def awayCharacter (u : ℕ) (hu : 0 < u) (p : PrimeIndex u) + (S : Finset (PrimeIndex u)) : Multiplicative (ZMod (u ^ 2)) →* awayRing u p.val := + rootsCharacter u hu (rhoAway u p) (rhoAway_pow u p) (S.erase p) + +/-- Leave precisely the full p-primary cyclic coordinate unevaluated. -/ +def partialEvaluation (u : ℕ) (hu : 0 < u) (p : PrimeIndex u) + (S : Finset (PrimeIndex u)) : + Elem GaussianRing (u ^ 2) →+* Elem (awayRing u p.val) (order u p.val) := + weightedProjection (gaussianToAway u p.val).toRingHom (coordinate u hu p) + (awayCharacter u hu p S) + +theorem partialEvaluation_product (u : ℕ) (hu : 0 < u) (p : PrimeIndex u) + (S : Finset (PrimeIndex u)) (x y : Elem GaussianRing (u ^ 2)) + (hxy : x * y = scalar (u ^ 2) ((u ^ 2 : ℕ) : GaussianRing)) : + partialEvaluation u hu p S x * partialEvaluation u hu p S y = + scalar (order u p.val) ((u ^ 2 : ℕ) : awayRing u p.val) := by + unfold partialEvaluation + simpa only [map_natCast] using weightedProjection_product + (gaussianToAway u p.val).toRingHom (coordinate u hu p) (awayCharacter u hu p S) + x y ((u ^ 2 : ℕ) : GaussianRing) hxy + +theorem awayCharacter_map (u : ℕ) (hu : 0 < u) (p : PrimeIndex u) + (S : Finset (PrimeIndex u)) : + (awayInclusion u p.val).toMonoidHom.comp (awayCharacter u hu p S) = + subsetCharacter u hu (S.erase p) := by + classical + apply MonoidHom.ext + intro a + change awayInclusion u p.val + (rootsCharacter u hu (rhoAway u p) (rhoAway_pow u p) (S.erase p) + (Multiplicative.ofAdd a.toAdd)) = + rootsCharacter u hu (rhoB u) (rhoB_pow u) (S.erase p) + (Multiplicative.ofAdd a.toAdd) + simp only [rootsCharacter_apply, map_prod, map_pow] + apply Finset.prod_congr rfl + intro q hq + have hqp := (Finset.mem_erase.mp hq).1 + congr 1 + apply Subtype.ext + simp [rhoAway, hqp, rhoB] + +theorem subsetCharacter_insert (u : ℕ) (hu : 0 < u) (p : PrimeIndex u) + (S : Finset (PrimeIndex u)) : + subsetCharacter u hu (insert p S) = + subsetCharacter u hu (S.erase p) * componentCharacter u hu p (rhoB u p) (rhoB_pow u p) := by + classical + have hi : insert p (S.erase p) = insert p S := by + ext q + by_cases h : q = p <;> simp [h] + calc + subsetCharacter u hu (insert p S) = subsetCharacter u hu (insert p (S.erase p)) := + congrArg (subsetCharacter u hu) hi.symm + _ = _ := by + simp only [subsetCharacter, rootsCharacter, Finset.prod_insert (Finset.notMem_erase p S), + mul_comm] + +/-- Evaluate the remaining p-primary variable at one. -/ +def partialAtOne (u : ℕ) (p : PrimeIndex u) : + Elem (awayRing u p.val) (order u p.val) →+* B u := + evaluate (awayInclusion u p.val).toRingHom 1 + +/-- Evaluate the remaining full p-primary variable at the selected pth root. -/ +def partialAtRoot (u : ℕ) (hu : 0 < u) (p : PrimeIndex u) : + Elem (awayRing u p.val) (order u p.val) →+* B u := + evaluate (awayInclusion u p.val).toRingHom + (CyclicPolynomial.powerCharacter (order u p.val) (rhoB u p) + (root_order_pow u hu p (rhoB u p) (rhoB_pow u p))) + +private theorem gaussian_away_comp (u p : ℕ) : + (awayInclusion u p).toRingHom.comp (gaussianToAway u p).toRingHom = + (gaussianToB u).toRingHom := by + apply RingHom.ext + intro r + apply Subtype.ext + exact (coe_awayInclusion u p (gaussianToAway u p r)).trans + ((coe_gaussianToAway u p r).trans (coe_gaussianToB u r).symm) + +theorem partialEvaluation_at_one (u : ℕ) (hu : 0 < u) (p : PrimeIndex u) + (S : Finset (PrimeIndex u)) : + (partialAtOne u p).comp (partialEvaluation u hu p S) = + subsetEvaluation u hu (S.erase p) := by + unfold partialAtOne partialEvaluation + rw [evaluate_weightedProjection] + rw [gaussian_away_comp] + have ht : (1 : Multiplicative (Component u p) →* B u).comp + (coordinate u hu p).toMultiplicative = 1 := by ext; rfl + rw [ht, mul_one] + exact congrArg (evaluate (gaussianToB u).toRingHom) (awayCharacter_map u hu p S) + +theorem partialEvaluation_at_root (u : ℕ) (hu : 0 < u) (p : PrimeIndex u) + (S : Finset (PrimeIndex u)) : + (partialAtRoot u hu p).comp (partialEvaluation u hu p S) = + subsetEvaluation u hu (insert p S) := by + unfold partialAtRoot partialEvaluation + rw [evaluate_weightedProjection] + rw [gaussian_away_comp] + change evaluate (gaussianToB u).toRingHom + (((awayInclusion u p.val).toMonoidHom.comp (awayCharacter u hu p S)) * + componentCharacter u hu p (rhoB u p) (rhoB_pow u p)) = _ + rw [awayCharacter_map, ← subsetCharacter_insert] + rfl + +@[simp] theorem partialEvaluation_at_one_apply (u : ℕ) (hu : 0 < u) (p : PrimeIndex u) + (S : Finset (PrimeIndex u)) (hp : p ∉ S) (x : Elem GaussianRing (u ^ 2)) : + partialAtOne u p (partialEvaluation u hu p S x) = subsetEvaluation u hu S x := by + have h := congrArg (fun f : Elem GaussianRing (u ^ 2) →+* B u => f x) + (partialEvaluation_at_one u hu p S) + simpa only [RingHom.comp_apply, Finset.erase_eq_of_notMem hp] using h + +@[simp] theorem partialEvaluation_at_root_apply (u : ℕ) (hu : 0 < u) (p : PrimeIndex u) + (S : Finset (PrimeIndex u)) (x : Elem GaussianRing (u ^ 2)) : + partialAtRoot u hu p (partialEvaluation u hu p S x) = + subsetEvaluation u hu (insert p S) x := + congrArg (fun f : Elem GaussianRing (u ^ 2) →+* B u => f x) + (partialEvaluation_at_root u hu p S) + +theorem rhoB_mul_star (u : ℕ) (p : PrimeIndex u) : rhoB u p * star (rhoB u p) = 1 := + Subtype.ext (rho_mul_star p.val) + +theorem subsetCharacter_mul_star (u : ℕ) (hu : 0 < u) + (S : Finset (PrimeIndex u)) (a : ZMod (u ^ 2)) : + subsetCharacter u hu S (Multiplicative.ofAdd a) * + star (subsetCharacter u hu S (Multiplicative.ofAdd a)) = 1 := by + unfold subsetCharacter + rw [rootsCharacter_apply, star_prod, ← Finset.prod_mul_distrib] + apply Finset.prod_eq_one + intro p _ + rw [star_pow, ← mul_pow, rhoB_mul_star, one_pow] + +theorem subsetCharacter_neg (u : ℕ) (hu : 0 < u) + (S : Finset (PrimeIndex u)) (a : ZMod (u ^ 2)) : + subsetCharacter u hu S (Multiplicative.ofAdd (-a)) = + star (subsetCharacter u hu S (Multiplicative.ofAdd a)) := by + let χ := subsetCharacter u hu S + have hi : χ (Multiplicative.ofAdd (-a)) * χ (Multiplicative.ofAdd a) = 1 := by + rw [← map_mul] + change χ (Multiplicative.ofAdd (-a + a)) = 1 + simp + have hs := subsetCharacter_mul_star u hu S a + change χ (Multiplicative.ofAdd a) * star (χ (Multiplicative.ofAdd a)) = 1 at hs + calc + χ (Multiplicative.ofAdd (-a)) = χ (Multiplicative.ofAdd (-a)) * 1 := (mul_one _).symm + _ = χ (Multiplicative.ofAdd (-a)) * + (χ (Multiplicative.ofAdd a) * star (χ (Multiplicative.ofAdd a))) := by rw [hs] + _ = star (χ (Multiplicative.ofAdd a)) := by rw [← mul_assoc, hi, one_mul] + +theorem subsetEvaluation_star (u : ℕ) [NeZero (u ^ 2)] (hu : 0 < u) + (S : Finset (PrimeIndex u)) (x : Elem GaussianRing (u ^ 2)) : + subsetEvaluation u hu S (ringStar x) = star (subsetEvaluation u hu S x) := by + exact evaluate_ringStar (gaussianToB u).toRingHom (subsetCharacter u hu S) + (gaussianToB_star u) (subsetCharacter_neg u hu S) x + +theorem subsetEvaluation_norm (u : ℕ) [NeZero (u ^ 2)] (hu : 0 < u) + (S : Finset (PrimeIndex u)) (x : Elem GaussianRing (u ^ 2)) + (hx : x * ringStar x = scalar (u ^ 2) ((u ^ 2 : ℕ) : GaussianRing)) : + subsetEvaluation u hu S x * star (subsetEvaluation u hu S x) = ((u ^ 2 : ℕ) : B u) := by + simpa only [subsetEvaluation, map_natCast] using evaluate_norm_eq + (gaussianToB u).toRingHom (subsetCharacter u hu S) + (gaussianToB_star u) (subsetCharacter_neg u hu S) x ((u ^ 2 : ℕ) : GaussianRing) hx + +theorem subsetEvaluation_ne_zero (u : ℕ) [NeZero (u ^ 2)] (hu : 0 < u) + (S : Finset (PrimeIndex u)) (x : Elem GaussianRing (u ^ 2)) + (hx : x * ringStar x = scalar (u ^ 2) ((u ^ 2 : ℕ) : GaussianRing)) : + subsetEvaluation u hu S x ≠ 0 := by + intro h + have hn := subsetEvaluation_norm u hu S x hx + rw [h, zero_mul] at hn + exact (Nat.cast_ne_zero.mpr (pow_ne_zero 2 hu.ne')) hn.symm + +/-- Every complex embedding has the required norm. Compatibility with conjugation +is derived from the actual adjoined roots in `map_star_B`. -/ +theorem subsetEvaluation_map_norm (u : ℕ) [NeZero (u ^ 2)] (hu : 0 < u) + (S : Finset (PrimeIndex u)) (x : Elem GaussianRing (u ^ 2)) + (hx : x * ringStar x = scalar (u ^ 2) ((u ^ 2 : ℕ) : GaussianRing)) + (σ : B u →+* ℂ) : ‖σ (subsetEvaluation u hu S x)‖ = (u : ℝ) := by + have hn := congrArg (fun z : B u => ‖σ z‖) (subsetEvaluation_norm u hu S x hx) + simp only [map_mul, map_star_B, norm_mul, norm_star, map_natCast] at hn + rw [RCLike.norm_natCast, Nat.cast_pow] at hn + nlinarith [norm_nonneg (σ (subsetEvaluation u hu S x)), (show (0 : ℝ) ≤ (u : ℝ) from Nat.cast_nonneg u)] + +end CirculantHadamard.PrimeCharacterEvaluations + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/CirculantHadamard/PrimeComponents.lean b/lean/OAI/LinearAlgebra/CirculantHadamard/PrimeComponents.lean new file mode 100644 index 0000000000000000000000000000000000000000..eb34204f96e69c5e8acc8414973009ba80ddf7d3 --- /dev/null +++ b/lean/OAI/LinearAlgebra/CirculantHadamard/PrimeComponents.lean @@ -0,0 +1,168 @@ +import Mathlib.Data.Nat.Factorization.Basic +import Mathlib.Data.ZMod.QuotientRing +import Mathlib.Algebra.Ring.Parity +import Mathlib.Algebra.Group.Pi.Lemmas + +namespace OAI + +/-! +# Actual primary components of the cyclic group of order u² + +The prime set is the literal finite set of prime factors of `u`. The exponent +of each component is `(u ^ 2).factorization p`, hence twice the exponent in u. +Factorization and coprimality supply the hypotheses of the finite Chinese +remainder theorem. Its coordinates are the canonical reduction maps. + +The generator of each primary component is the inverse image of its unit +coordinate vector. Its additive order is proved to be the full prime power, +and the complementary integer factor of u² is proved prime to p. +-/ + +noncomputable section + +namespace CirculantHadamard.PrimeComponents + +open scoped BigOperators + +def primes (u : ℕ) : Finset ℕ := u.primeFactors + +abbrev PrimeIndex (u : ℕ) := {p : ℕ // p ∈ primes u} + +def exponent (u p : ℕ) : ℕ := (u ^ 2).factorization p + +def order (u p : ℕ) : ℕ := p ^ exponent u p + +abbrev Component (u : ℕ) (p : PrimeIndex u) := ZMod (order u p.val) + +abbrev PrimaryProduct (u : ℕ) := (p : PrimeIndex u) → Component u p + +theorem mem_primes {u p : ℕ} : p ∈ primes u ↔ p.Prime ∧ p ∣ u ∧ u ≠ 0 := + Nat.mem_primeFactors + +theorem prime_of_mem {u p : ℕ} (hp : p ∈ primes u) : p.Prime := + (mem_primes.mp hp).1 + +theorem dvd_of_mem {u p : ℕ} (hp : p ∈ primes u) : p ∣ u := + (mem_primes.mp hp).2.1 + +theorem primes_nonempty {u : ℕ} (hu : 1 < u) : (primes u).Nonempty := + Nat.nonempty_primeFactors.mpr hu + +theorem prime_ne_two_of_odd {u p : ℕ} (hu : Odd u) (hp : p ∈ primes u) : p ≠ 2 := by + intro h + apply hu.not_two_dvd_nat + simpa only [h] using dvd_of_mem hp + +theorem odd_of_mem {u p : ℕ} (hu : Odd u) (hp : p ∈ primes u) : Odd p := + (prime_of_mem hp).odd_of_ne_two (prime_ne_two_of_odd hu hp) + +/-- The scalar exponent in local comparison is the exponent in u². -/ +theorem exponent_eq_two_mul (u p : ℕ) : exponent u p = 2 * u.factorization p := by + simp only [exponent, Nat.factorization_pow, Finsupp.smul_apply, smul_eq_mul] + +theorem exponent_pos {u p : ℕ} (hu : 0 < u) (hp : p ∈ primes u) : + 0 < exponent u p := by + apply (prime_of_mem hp).factorization_pos_of_dvd (pow_ne_zero 2 hu.ne') + exact (dvd_of_mem hp).trans (dvd_pow_self u (by decide : 2 ≠ 0)) + +theorem order_pos {u p : ℕ} (hp : p ∈ primes u) : 0 < order u p := + pow_pos (prime_of_mem hp).pos _ + +instance componentOrder_neZero (u : ℕ) (p : PrimeIndex u) : NeZero (order u p.val) := + ⟨(order_pos p.property).ne'⟩ + +theorem prime_dvd_order {u p : ℕ} (hu : 0 < u) (hp : p ∈ primes u) : + p ∣ order u p := dvd_pow_self p (exponent_pos hu hp).ne' + +theorem order_dvd_square (u p : ℕ) : order u p ∣ u ^ 2 := + Nat.ordProj_dvd (u ^ 2) p + +/-- This is the full primary factor: the next power does not divide u². -/ +theorem next_power_not_dvd {u p : ℕ} (hu : 0 < u) (hp : p ∈ primes u) : + ¬p ^ (exponent u p + 1) ∣ u ^ 2 := + Nat.pow_succ_factorization_not_dvd (pow_ne_zero 2 hu.ne') (prime_of_mem hp) + +def cofactor (u p : ℕ) : ℕ := u ^ 2 / order u p + +theorem order_mul_cofactor (u p : ℕ) : order u p * cofactor u p = u ^ 2 := by + exact Nat.mul_div_cancel' (order_dvd_square u p) + +theorem cofactor_not_dvd {u p : ℕ} (hu : 0 < u) (hp : p ∈ primes u) : + ¬p ∣ cofactor u p := + Nat.not_dvd_ordCompl (prime_of_mem hp) (pow_ne_zero 2 hu.ne') + +theorem cofactor_coprime {u p : ℕ} (hu : 0 < u) (hp : p ∈ primes u) : + Nat.Coprime p (cofactor u p) := + Nat.coprime_ordCompl (prime_of_mem hp) (pow_ne_zero 2 hu.ne') + +theorem prod_order_finset (u : ℕ) (hu : 0 < u) : + (∏ p ∈ primes u, order u p) = u ^ 2 := by + have h := Nat.prod_factorization_pow_eq_self (pow_ne_zero 2 hu.ne') + simpa only [Nat.prod_factorization_eq_prod_primeFactors, + Nat.primeFactors_pow u (by decide : 2 ≠ 0), primes, order, exponent] using h + +theorem prod_order (u : ℕ) (hu : 0 < u) : + (∏ p : PrimeIndex u, order u p.val) = u ^ 2 := by + change (∏ p : (primes u), order u p.val) = u ^ 2 + rw [Finset.prod_coe_sort] + exact prod_order_finset u hu + +theorem pairwise_coprime (u : ℕ) : + Pairwise (fun p q : PrimeIndex u => Nat.Coprime (order u p.val) (order u q.val)) := by + intro p q hpq + exact Nat.coprime_pow_primes _ _ (prime_of_mem p.property) (prime_of_mem q.property) + (fun h => hpq (Subtype.ext h)) + +/-- The actual finite Chinese remainder equivalence, with no chosen-map premise. -/ +def crtRing (u : ℕ) (hu : 0 < u) : ZMod (u ^ 2) ≃+* PrimaryProduct u := + (ZMod.ringEquivCongr (prod_order u hu).symm).trans + (ZMod.prodEquivPi (fun p : PrimeIndex u => order u p.val) (pairwise_coprime u)) + +def crt (u : ℕ) (hu : 0 < u) : ZMod (u ^ 2) ≃+ PrimaryProduct u := + (crtRing u hu).toAddEquiv + +@[simp] theorem crt_intCast (u : ℕ) (hu : 0 < u) (z : ℤ) (p : PrimeIndex u) : + crt u hu (z : ZMod (u ^ 2)) p = (z : Component u p) := by + change (crtRing u hu (z : ZMod (u ^ 2))) p = _ + exact congrArg (fun y : PrimaryProduct u => y p) (map_intCast (crtRing u hu) z) + +@[simp] theorem crt_natCast (u : ℕ) (hu : 0 < u) (z : ℕ) (p : PrimeIndex u) : + crt u hu (z : ZMod (u ^ 2)) p = (z : Component u p) := by + change (crtRing u hu (z : ZMod (u ^ 2))) p = _ + exact congrArg (fun y : PrimaryProduct u => y p) (map_natCast (crtRing u hu) z) + +/-- Every CRT coordinate is literal reduction from ZMod(u²) to the full p-power. -/ +theorem crt_apply (u : ℕ) (hu : 0 < u) (x : ZMod (u ^ 2)) (p : PrimeIndex u) : + crt u hu x p = (ZMod.cast x : Component u p) := by + obtain ⟨z, rfl⟩ := ZMod.intCast_surjective x + rw [crt_intCast, ZMod.cast_intCast (order_dvd_square u p.val)] + +def primaryGenerator (u : ℕ) (hu : 0 < u) (p : PrimeIndex u) : ZMod (u ^ 2) := + (crt u hu).symm (Pi.single p (1 : Component u p)) + +@[simp] theorem crt_primaryGenerator (u : ℕ) (hu : 0 < u) (p : PrimeIndex u) : + crt u hu (primaryGenerator u hu p) = Pi.single p (1 : Component u p) := + (crt u hu).apply_symm_apply _ + +@[simp] theorem crt_primaryGenerator_same (u : ℕ) (hu : 0 < u) (p : PrimeIndex u) : + crt u hu (primaryGenerator u hu p) p = 1 := by + rw [crt_primaryGenerator, Pi.single_eq_same] + +@[simp] theorem crt_primaryGenerator_ne (u : ℕ) (hu : 0 < u) + (p q : PrimeIndex u) (hqp : q ≠ p) : + crt u hu (primaryGenerator u hu p) q = 0 := by + rw [crt_primaryGenerator, Pi.single_eq_of_ne hqp] + +/-- The chosen primary generator has exactly the full primary order. -/ +theorem primaryGenerator_addOrderOf (u : ℕ) (hu : 0 < u) (p : PrimeIndex u) : + addOrderOf (primaryGenerator u hu p) = order u p.val := by + rw [primaryGenerator, AddEquiv.addOrderOf_eq] + have h := addOrderOf_injective (AddMonoidHom.single (Component u) p) + (Pi.single_injective p) (1 : Component u p) + exact h.trans (ZMod.addOrderOf_one (order u p.val)) + +end CirculantHadamard.PrimeComponents + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/CirculantHadamard/ProjectionCoefficients.lean b/lean/OAI/LinearAlgebra/CirculantHadamard/ProjectionCoefficients.lean new file mode 100644 index 0000000000000000000000000000000000000000..c6a53195cf7c21b0757e3880a8a4e3b6a79b023b --- /dev/null +++ b/lean/OAI/LinearAlgebra/CirculantHadamard/ProjectionCoefficients.lean @@ -0,0 +1,88 @@ +import OAI.LinearAlgebra.CirculantHadamard.CyclicProjection +import OAI.LinearAlgebra.CirculantHadamard.ProjectionPairFiber + +namespace OAI + +universe uA uB uR + +/-! +# Coefficients of cyclic quotient maps + +The coefficient at an element of the quotient is the sum over its entire +fiber. For the quotient of order `2 * m` onto order `m`, the fiber consists +of the two representatives `j.val` and `j.val + m`. +-/ + +namespace CirculantHadamard + +open scoped BigOperators + +section Fiber + +variable {A : Type uA} {B : Type uB} {R : Type uR} [Fintype A] [DecidableEq B] [AddCommMonoid R] + +/-- Mapping the domain adds precisely the coefficients in a quotient fiber. -/ +theorem mapDomain_apply_sum (q : A → B) (f : A →₀ R) (b : B) : + Finsupp.mapDomain q f b = ∑ a ∈ Finset.univ.filter (fun a => q a = b), f a := by + classical + rw [Finsupp.mapDomain, Finsupp.sum_apply] + simp only [Finsupp.sum, Finsupp.single_apply, Finset.sum_filter] + apply Finset.sum_subset (Finset.subset_univ _) + intro a _ ha + have hzero : f a = 0 := Finsupp.notMem_support_iff.mp ha + simp [hzero] + +/-- The same coefficient formula, indexed by the subtype of the fiber. -/ +theorem mapDomain_apply_fiber (q : A → B) (f : A →₀ R) (b : B) : + Finsupp.mapDomain q f b = ∑ a : {a : A // q a = b}, f a.val := by + classical + rw [mapDomain_apply_sum] + exact Finset.sum_subtype _ (by intro a; simp) _ + +end Fiber + +section Cyclic + +variable {R : Type uR} [Semiring R] + +/-- Coefficients of the actual cyclic group-ring quotient as a finite filter sum. -/ +theorem cyclicProjection_apply_sum {m n : ℕ} [NeZero n] (h : m ∣ n) + (f : CyclicRing.Elem R n) (a : ZMod m) : + (cyclicProjection R h f).coeff a = + ∑ x ∈ Finset.univ.filter (fun x : ZMod n => + ZMod.castHom h (ZMod m) x = a), f.coeff x := by + change Finsupp.mapDomain (ZMod.castHom h (ZMod m)) f.coeff a = _ + exact mapDomain_apply_sum _ _ _ + +/-- Coefficients of the actual cyclic group-ring quotient as a fiber subtype sum. -/ +theorem cyclicProjection_apply_fiber {m n : ℕ} [NeZero n] (h : m ∣ n) + (f : CyclicRing.Elem R n) (a : ZMod m) : + (cyclicProjection R h f).coeff a = + ∑ x : {x : ZMod n // ZMod.castHom h (ZMod m) x = a}, f.coeff x.val := by + change Finsupp.mapDomain (ZMod.castHom h (ZMod m)) f.coeff a = _ + exact mapDomain_apply_fiber _ _ _ + +/-- A quotient by the subgroup of order two adds opposite coefficients. -/ +theorem cyclicProjection_double_apply {m : ℕ} (hm : 0 < m) (h : m ∣ 2 * m) + (f : CyclicRing.Elem R (2 * m)) (j : ZMod m) : + (cyclicProjection R h f).coeff j = + f.coeff (j.val : ZMod (2 * m)) + f.coeff ((j.val + m : ℕ) : ZMod (2 * m)) := by + classical + let : NeZero (2 * m) := ⟨(Nat.mul_pos (by decide) hm).ne'⟩ + rw [cyclicProjection_apply_sum] + refine Finset.sum_eq_add_of_mem _ _ ?_ ?_ (zmod_double_lifts_ne hm j) ?_ + · simp only [Finset.mem_filter, Finset.mem_univ, true_and] + exact (zmod_double_cast_eq_iff hm h _ j).mpr (Or.inl rfl) + · simp only [Finset.mem_filter, Finset.mem_univ, true_and] + exact (zmod_double_cast_eq_iff hm h _ j).mpr (Or.inr rfl) + · intro x hx hne + have hx' := (Finset.mem_filter.mp hx).2 + rcases (zmod_double_cast_eq_iff hm h x j).mp hx' with hxj | hxj + · exact (hne.1 hxj).elim + · exact (hne.2 hxj).elim + +end Cyclic + +end CirculantHadamard + +end OAI diff --git a/lean/OAI/LinearAlgebra/CirculantHadamard/ProjectionPairFiber.lean b/lean/OAI/LinearAlgebra/CirculantHadamard/ProjectionPairFiber.lean new file mode 100644 index 0000000000000000000000000000000000000000..ce1c00c8664dfea6e31f9d3ff51f6cf7da29703c --- /dev/null +++ b/lean/OAI/LinearAlgebra/CirculantHadamard/ProjectionPairFiber.lean @@ -0,0 +1,59 @@ +import Mathlib.Data.ZMod.Basic +import Lean.Elab.Tactic.Omega + +namespace OAI + +/-! +# The two fibers of reduction modulo half the order + +Reduction from `ZMod (2 * m)` to `ZMod m` has exactly the two usual lifts +of each element when `m` is positive. +-/ + +namespace CirculantHadamard + +/-- The fiber of reduction modulo `m` consists of its two canonical lifts. -/ +theorem zmod_double_cast_eq_iff {m : ℕ} (hm : 0 < m) (h : m ∣ 2 * m) + (x : ZMod (2 * m)) (j : ZMod m) : + ZMod.castHom h (ZMod m) x = j ↔ + x = (j.val : ZMod (2 * m)) ∨ x = ((j.val + m : ℕ) : ZMod (2 * m)) := by + let : NeZero m := ⟨by omega⟩ + let : NeZero (2 * m) := ⟨by omega⟩ + have hxlt : x.val < 2 * m := ZMod.val_lt x + have hjlt : j.val < m := ZMod.val_lt j + constructor + · intro hx + have hmod : x.val % m = j.val := by + simpa only [ZMod.castHom_apply, ZMod.cast_eq_val, ZMod.val_natCast] using + congrArg ZMod.val hx + by_cases hsmall : x.val < m + · left + have hval : x.val = j.val := by + simpa only [Nat.mod_eq_of_lt hsmall] using hmod + rw [← hval, ZMod.natCast_zmod_val] + · right + have hmle : m ≤ x.val := by omega + have hsub : x.val - m < m := by omega + rw [Nat.mod_eq_sub_mod hmle, Nat.mod_eq_of_lt hsub] at hmod + have hval : x.val = j.val + m := by omega + rw [← hval, ZMod.natCast_zmod_val] + · rintro (rfl | rfl) + · simp only [map_natCast, ZMod.natCast_zmod_val] + · rw [map_natCast] + simp only [Nat.cast_add, ZMod.natCast_self, add_zero, ZMod.natCast_zmod_val] + +/-- The two canonical lifts into the group of twice the order are distinct. -/ +theorem zmod_double_lifts_ne {m : ℕ} (hm : 0 < m) (j : ZMod m) : + (j.val : ZMod (2 * m)) ≠ ((j.val + m : ℕ) : ZMod (2 * m)) := by + let : NeZero m := ⟨by omega⟩ + have hjlt : j.val < m := ZMod.val_lt j + intro h + have hv := congrArg ZMod.val h + rw [ZMod.val_natCast, ZMod.val_natCast, + Nat.mod_eq_of_lt (show j.val < 2 * m by omega), + Nat.mod_eq_of_lt (show j.val + m < 2 * m by omega)] at hv + omega + +end CirculantHadamard + +end OAI diff --git a/lean/OAI/LinearAlgebra/CirculantHadamard/RamifiedConjugation.lean b/lean/OAI/LinearAlgebra/CirculantHadamard/RamifiedConjugation.lean new file mode 100644 index 0000000000000000000000000000000000000000..69925ef80c37cdd817e00fad06683a6b22a7e79e --- /dev/null +++ b/lean/OAI/LinearAlgebra/CirculantHadamard/RamifiedConjugation.lean @@ -0,0 +1,182 @@ +import Mathlib.RingTheory.AdjoinRoot +import Mathlib.RingTheory.DiscreteValuationRing.Basic +import Mathlib.RingTheory.Polynomial.Cyclotomic.Roots +import Lean.Elab.Tactic.Omega + +namespace OAI + +universe uR uA + +/-! +# Cyclotomic conjugation and norm divisibility in a DVR + +The conjugation fixes the coefficient ring and sends the actual +adjoined root to its multiplicative inverse. In a DVR every ring +automorphism preserves the canonical additive valuation, because it sends +units to units and uniformizers to uniformizers. Consequently a norm equal +to a unit times an even scalar power forces the corresponding half-power +to divide the element. +-/ + +noncomputable section + +namespace CirculantHadamard.RamifiedConjugation + +open Polynomial IsDiscreteValuationRing + +section Valuation + +variable {R : Type uR} [CommRing R] [IsDomain R] [IsDiscreteValuationRing R] + +/-- Ring automorphisms of a DVR preserve its integer-valued order. -/ +theorem addVal_ringEquiv (e : R ≃+* R) (x : R) : + addVal R (e x) = addVal R x := by + by_cases hx : x = 0 + · simp only [hx, map_zero] + obtain ⟨π, hπ⟩ := exists_irreducible R + obtain ⟨m, u, hu⟩ := eq_unit_mul_pow_irreducible hx hπ + have heπ : Irreducible (e π) := (MulEquiv.irreducible_iff e).mpr hπ + have heu : e x = (Units.map e.toMonoidHom u : R) * (e π) ^ m := by + simpa only [map_mul, map_pow, Units.coe_map, + show e.toMonoidHom (u : R) = e (u : R) from rfl] using congrArg e hu + rw [addVal_def x u hπ m hu, + addVal_def (e x) (Units.map e.toMonoidHom u) heπ m heu] + +private theorem enat_add_self_injective {a b : ℕ∞} (h : a + a = b + b) : a = b := by + cases a using ENat.recTopCoe with + | top => + cases b using ENat.recTopCoe with + | top => rfl + | coe b => simp only [← ENat.natCast_add, top_add, ENat.top_ne_natCast] at h + | coe a => + cases b using ENat.recTopCoe with + | top => simp only [← ENat.natCast_add, top_add, ENat.natCast_ne_top] at h + | coe b => + have hab : a + a = b + b := ENat.natCast_inj.mp h + have : a = b := by omega + exact congrArg (fun n : ℕ => (n : ℕ∞)) this + +/-- A norm with an even scalar exponent gives divisibility by half that +power. The statement includes zero and needs no normalization assumption +on the scalar's valuation. -/ +theorem pow_dvd_of_norm_eq (e : R ≃+* R) (a x b : R) (t : ℕ) + (hb : IsUnit b) (h : x * e x = a ^ (2 * t) * b) : a ^ t ∣ x := by + have hsq : x * e x = (a ^ t * a ^ t) * b := by + rw [← pow_two, ← pow_mul, Nat.mul_comm t 2] + exact h + have hv := congrArg (addVal R) hsq + have hbval : addVal R b = 0 := addVal_eq_zero_iff.mpr hb + simp only [addVal_mul, addVal_ringEquiv, hbval, add_zero] at hv + exact addVal_le_iff_dvd.mp (enat_add_self_injective hv).symm.le + +end Valuation + +section Cyclotomic + +variable (A : Type uA) [CommRing A] (n : ℕ) + +/-- The actual cyclotomic quotient used by the ramified construction. -/ +abbrev CyclotomicRing := AdjoinRoot (cyclotomic n A) + +/-- The adjoined root satisfies the stated order relation even before +domainhood or characteristic zero has been established. -/ +theorem root_pow_order : AdjoinRoot.root (cyclotomic n A) ^ n = 1 := by + have h : AdjoinRoot.mk (cyclotomic n A) (X ^ n - 1) = 0 := + AdjoinRoot.mk_eq_zero.mpr (cyclotomic.dvd_X_pow_sub_one n A) + simpa only [map_sub, map_pow, map_one, AdjoinRoot.mk_X, sub_eq_zero] using h + +variable (hn : 0 < n) +variable [domain : IsDomain (CyclotomicRing A n)] [charZero : CharZero (CyclotomicRing A n)] + +include hn + +/-- The quotient root is a primitive root of the exact specified order. -/ +theorem root_isPrimitiveRoot : + IsPrimitiveRoot (AdjoinRoot.root (cyclotomic n A)) n := by + apply (isRoot_cyclotomic_iff_charZero hn).mp + simpa only [map_cyclotomic] using AdjoinRoot.isRoot_root (cyclotomic n A) + +omit domain charZero in +theorem root_pow_pred_mul_root [IsDomain (CyclotomicRing A n)] + [CharZero (CyclotomicRing A n)] : + AdjoinRoot.root (cyclotomic n A) ^ (n - 1) * + AdjoinRoot.root (cyclotomic n A) = 1 := by + rw [← pow_succ, Nat.sub_add_cancel hn, root_pow_order] + +private theorem inverse_root_aeval : + aeval (AdjoinRoot.root (cyclotomic n A) ^ (n - 1)) (cyclotomic n A) = 0 := by + have hcoprime : (n - 1).Coprime n := + (Nat.coprime_self_sub_left hn).mpr (Nat.coprime_one_left n) + have hroot := + ((root_isPrimitiveRoot A n hn).pow_of_coprime (n - 1) hcoprime).isRoot_cyclotomic hn + rw [aeval_def, ← eval_map, map_cyclotomic] + exact hroot + +/-- The root-inverting endomorphism fixes the coefficient algebra. -/ +def conjugationHom : CyclotomicRing A n →ₐ[A] CyclotomicRing A n := + AdjoinRoot.liftAlgHom (cyclotomic n A) + (Algebra.ofId A (CyclotomicRing A n)) + (AdjoinRoot.root (cyclotomic n A) ^ (n - 1)) (inverse_root_aeval A n hn) + +@[simp] theorem conjugationHom_root : + conjugationHom A n hn (AdjoinRoot.root (cyclotomic n A)) = + AdjoinRoot.root (cyclotomic n A) ^ (n - 1) := by + exact AdjoinRoot.liftAlgHom_root (cyclotomic n A) + (Algebra.ofId A (CyclotomicRing A n)) + (AdjoinRoot.root (cyclotomic n A) ^ (n - 1)) (inverse_root_aeval A n hn) + +theorem conjugationHom_comp_self : + (conjugationHom A n hn).comp (conjugationHom A n hn) = + AlgHom.id A (CyclotomicRing A n) := by + apply AdjoinRoot.algHom_ext + change conjugationHom A n hn + (conjugationHom A n hn (AdjoinRoot.root (cyclotomic n A))) = + AdjoinRoot.root (cyclotomic n A) + rw [conjugationHom_root] + have hzero : AdjoinRoot.root (cyclotomic n A) ≠ 0 := + ((root_isPrimitiveRoot A n hn).isUnit (ne_of_gt hn)).ne_zero + apply mul_right_cancel₀ (pow_ne_zero (n - 1) hzero) + calc + conjugationHom A n hn (AdjoinRoot.root (cyclotomic n A) ^ (n - 1)) * + AdjoinRoot.root (cyclotomic n A) ^ (n - 1) = + conjugationHom A n hn (AdjoinRoot.root (cyclotomic n A) ^ (n - 1) * + AdjoinRoot.root (cyclotomic n A)) := by rw [map_mul, conjugationHom_root] + _ = 1 := by rw [root_pow_pred_mul_root A n hn, map_one] + _ = AdjoinRoot.root (cyclotomic n A) * + AdjoinRoot.root (cyclotomic n A) ^ (n - 1) := by + simpa only [mul_comm] using (root_pow_pred_mul_root A n hn).symm + +/-- The actual involutive algebra automorphism inverting the cyclotomic root. -/ +def cyclotomicConjugation : CyclotomicRing A n ≃ₐ[A] CyclotomicRing A n := + AlgEquiv.ofAlgHom (conjugationHom A n hn) (conjugationHom A n hn) + (conjugationHom_comp_self A n hn) (conjugationHom_comp_self A n hn) + +@[simp] theorem cyclotomicConjugation_root : + cyclotomicConjugation A n hn (AdjoinRoot.root (cyclotomic n A)) = + AdjoinRoot.root (cyclotomic n A) ^ (n - 1) := + conjugationHom_root A n hn + +theorem cyclotomicConjugation_involutive : + Function.Involutive (cyclotomicConjugation A n hn) := by + intro x + exact DFunLike.congr_fun (conjugationHom_comp_self A n hn) x + +variable [IsDiscreteValuationRing (CyclotomicRing A n)] + +@[simp] theorem cyclotomicConjugation_addVal (x : CyclotomicRing A n) : + addVal (CyclotomicRing A n) (cyclotomicConjugation A n hn x) = + addVal (CyclotomicRing A n) x := + addVal_ringEquiv (cyclotomicConjugation A n hn).toRingEquiv x + +theorem cyclotomic_pow_dvd_of_norm_eq (a x b : CyclotomicRing A n) (t : ℕ) + (hb : IsUnit b) + (h : x * cyclotomicConjugation A n hn x = a ^ (2 * t) * b) : a ^ t ∣ x := + pow_dvd_of_norm_eq (cyclotomicConjugation A n hn).toRingEquiv a x b t hb h + +end Cyclotomic + +end CirculantHadamard.RamifiedConjugation + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/CirculantHadamard/RamifiedEisenstein.lean b/lean/OAI/LinearAlgebra/CirculantHadamard/RamifiedEisenstein.lean new file mode 100644 index 0000000000000000000000000000000000000000..7116ec4b615abe170fd081f5a0d31b031eae5e9e --- /dev/null +++ b/lean/OAI/LinearAlgebra/CirculantHadamard/RamifiedEisenstein.lean @@ -0,0 +1,153 @@ +import Mathlib.RingTheory.DiscreteValuationRing.Basic +import Mathlib.RingTheory.Polynomial.Eisenstein.IsIntegral +import Mathlib.RingTheory.Polynomial.RationalRoot +import Mathlib.RingTheory.Polynomial.UniqueFactorization + +namespace OAI + +universe uA uB + +/-! +# Eisenstein polynomials for the ramified cyclotomic extension + +The maximal ideal is generated by the actual natural prime `p`. We transport +the integer coefficient divisibilities and prove separately that the constant +term `p` is outside the square of the maximal ideal. This yields irreducibility +over the local base, and hence the minimal polynomial of an actual primitive +root in any faithful domain extension. +-/ + +noncomputable section + +namespace CirculantHadamard.RamifiedEisenstein + +open Polynomial + +/-- The prime-power cyclotomic polynomial translated to put the root at `ξ - 1`. -/ +def shifted (A : Type uA) [CommRing A] (p k : ℕ) : A[X] := + (cyclotomic (p ^ (k + 1)) A).comp (X + 1) + +theorem shifted_monic (A : Type uA) [CommRing A] (p k : ℕ) : + (shifted A p k).Monic := by + simpa only [shifted, C_1] using + (cyclotomic.monic (p ^ (k + 1)) A).comp_X_add_C (1 : A) + +theorem shifted_natDegree (A : Type uA) [CommRing A] [IsDomain A] + {p : ℕ} (hp : p.Prime) (k : ℕ) : + (shifted A p k).natDegree = (p - 1) * p ^ k := by + rw [shifted, natDegree_comp, show (X + 1 : A[X]) = X + C 1 by simp, + natDegree_X_add_C, mul_one, natDegree_cyclotomic, + Nat.totient_prime_pow_succ hp, Nat.mul_comm] + +theorem cyclotomic_natDegree (A : Type uA) [CommRing A] [Nontrivial A] + {p : ℕ} (hp : p.Prime) (k : ℕ) : + (cyclotomic (p ^ (k + 1)) A).natDegree = (p - 1) * p ^ k := by + rw [natDegree_cyclotomic, Nat.totient_prime_pow_succ hp, Nat.mul_comm] + +theorem shifted_coeff_zero (A : Type uA) [CommRing A] + {p : ℕ} (hp : p.Prime) (k : ℕ) : + (shifted A p k).coeff 0 = (p : A) := by + rw [shifted, coeff_zero_eq_eval_zero, eval_comp, + cyclotomic_prime_pow_eq_geom_sum hp, eval_add, eval_X, eval_one, zero_add, + eval_finsetSum] + simp only [eval_pow, eval_X, one_pow, Finset.sum_const, Finset.card_range, + Nat.smul_one_eq_cast] + +theorem shifted_isWeaklyEisensteinAt (A : Type uA) [CommRing A] + {p : ℕ} (hp : p.Prime) (k : ℕ) : + (shifted A p k).IsWeaklyEisensteinAt (Ideal.span {(p : A)}) := by + let : Fact p.Prime := ⟨hp⟩ + have h := (cyclotomic_prime_pow_comp_X_add_one_isEisensteinAt p k).isWeaklyEisensteinAt.map + (Int.castRingHom A) + simpa [shifted, Ideal.submodule_span_eq, Ideal.map_span, Polynomial.map_comp] using h + +section Local + +variable (A : Type uA) [CommRing A] [IsDomain A] [CharZero A] [IsLocalRing A] + {p : ℕ} (hp : p.Prime) (k : ℕ) + (hmax : IsLocalRing.maximalIdeal A = Ideal.span {(p : A)}) + +include hp hmax + +theorem shifted_isEisensteinAt : + (shifted A p k).IsEisensteinAt (IsLocalRing.maximalIdeal A) := by + have hp0 : (p : A) ≠ 0 := Nat.cast_ne_zero.mpr hp.ne_zero + have hpu : ¬ IsUnit (p : A) := + (IsDiscreteValuationRing.irreducible_of_span_eq_maximalIdeal (p : A) hp0 hmax).not_isUnit + apply (shifted_monic A p k).isEisensteinAt_of_mem_of_notMem + (Ideal.IsPrime.ne_top inferInstance) + · intro i hi + rw [hmax] + exact (shifted_isWeaklyEisensteinAt A hp k).mem hi + · rw [shifted_coeff_zero A hp k, hmax, Ideal.span_singleton_pow, + Ideal.mem_span_singleton] + intro h + have h21 : (2 : ℕ) ≤ 1 := (pow_dvd_pow_iff hp0 hpu).mp (by simpa using h) + exact (by decide : ¬ (2 : ℕ) ≤ 1) h21 + +theorem shifted_irreducible : Irreducible (shifted A p k) := by + apply (shifted_isEisensteinAt A hp k hmax).irreducible inferInstance + (shifted_monic A p k).isPrimitive + rw [shifted_natDegree A hp k] + exact Nat.mul_pos (Nat.sub_pos_of_lt hp.one_lt) (pow_pos hp.pos k) + +theorem cyclotomic_irreducible : Irreducible (cyclotomic (p ^ (k + 1)) A) := by + apply (MulEquiv.irreducible_iff (Polynomial.algEquivAevalXAddC (1 : A))).mp + change Irreducible ((cyclotomic (p ^ (k + 1)) A).comp (X + C (1 : A))) + simpa only [shifted, C_1] using shifted_irreducible A hp k hmax + +/-- Modulo the maximal ideal, the translated polynomial is exactly a pure power. -/ +theorem mod_maximal_shifted : + (shifted A p k).map (Ideal.Quotient.mk (IsLocalRing.maximalIdeal A)) = + (X : (A ⧸ IsLocalRing.maximalIdeal A)[X]) ^ ((p - 1) * p ^ k) := by + ext i + rw [coeff_map, coeff_X_pow] + by_cases hi : i = (p - 1) * p ^ k + · subst i + rw [ite_eq_left rfl, ← shifted_natDegree A hp k, + (shifted_monic A p k).coeff_natDegree, map_one] + · rw [ite_eq_right hi] + apply Ideal.Quotient.eq_zero_iff_mem.mpr + apply (shifted_isEisensteinAt A hp k hmax).coeff_mem + simpa only [shifted_natDegree A hp k] using hi + +end Local + +section DVR + +variable (A : Type uA) [CommRing A] [IsDomain A] [CharZero A] + [IsDiscreteValuationRing A] {p : ℕ} (hp : p.Prime) (k : ℕ) + (hmax : IsLocalRing.maximalIdeal A = Ideal.span {(p : A)}) + +include hp hmax + +theorem cyclotomic_prime : Prime (cyclotomic (p ^ (k + 1)) A) := + irreducible_iff_prime.mp (cyclotomic_irreducible A hp k hmax) + +theorem cyclotomic_adjoinRoot_isDomain : + IsDomain (AdjoinRoot (cyclotomic (p ^ (k + 1)) A)) := + AdjoinRoot.isDomain_of_prime (cyclotomic_prime A hp k hmax) + +/-- The minimal polynomial equality is for the actual primitive root in a +faithful domain extension, not merely for the formal quotient root. -/ +theorem cyclotomic_eq_minpoly {B : Type uB} [CommRing B] [IsDomain B] + [Algebra A B] [NoZeroSMulDivisors A B] {ξ : B} + (hξ : IsPrimitiveRoot ξ (p ^ (k + 1))) : + cyclotomic (p ^ (k + 1)) A = minpoly A ξ := by + have hroot : aeval ξ (cyclotomic (p ^ (k + 1)) A) = 0 := by + rw [aeval_def, eval₂_eq_eval_map, map_cyclotomic, ← IsRoot.def] + exact hξ.isRoot_cyclotomic (pow_pos hp.pos (k + 1)) + have hi : IsIntegral A ξ := ⟨_, cyclotomic.monic _ A, hroot⟩ + have hd : minpoly A ξ ∣ cyclotomic (p ^ (k + 1)) A := + minpoly.isIntegrallyClosed_dvd hi hroot + exact Polynomial.eq_of_monic_of_associated (cyclotomic.monic _ A) (minpoly.monic hi) + ((minpoly.irreducible hi).associated_of_dvd + (cyclotomic_irreducible A hp k hmax) hd).symm + +end DVR + +end CirculantHadamard.RamifiedEisenstein + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/CirculantHadamard/RamifiedLocal.lean b/lean/OAI/LinearAlgebra/CirculantHadamard/RamifiedLocal.lean new file mode 100644 index 0000000000000000000000000000000000000000..469de1b87337ec7bbbaa69ff3dd3dc44dcf4a48a --- /dev/null +++ b/lean/OAI/LinearAlgebra/CirculantHadamard/RamifiedLocal.lean @@ -0,0 +1,219 @@ +import OAI.LinearAlgebra.CirculantHadamard.RamifiedEisenstein +import OAI.LinearAlgebra.CirculantHadamard.RamifiedUnit +import OAI.LinearAlgebra.CirculantHadamard.LocalDVR +import Mathlib.RingTheory.Ideal.GoingUp +import Mathlib.RingTheory.Polynomial.Cyclotomic.Eval + +namespace OAI + +universe uA + +/-! +# The actual ramified cyclotomic local ring + +We adjoin a root of the prime-power cyclotomic polynomial to the given +characteristic-zero DVR. Every maximal ideal of this finite integral extension +is shown to be generated by the actual element `root - 1`. +-/ + +noncomputable section + +namespace CirculantHadamard.RamifiedLocal + +open Polynomial + +/-- The genuine monic cyclotomic quotient, with no additional ring-data premise. -/ +abbrev Extension (A : Type uA) [CommRing A] (p k : ℕ) := + AdjoinRoot (cyclotomic (p ^ (k + 1)) A) + +/-- The actual ramified parameter in the cyclotomic quotient. -/ +def uniformizer (A : Type uA) [CommRing A] (p k : ℕ) : Extension A p k := + AdjoinRoot.root (cyclotomic (p ^ (k + 1)) A) - 1 + +instance extensionFinite (A : Type uA) [CommRing A] (p k : ℕ) : + Module.Finite A (Extension A p k) := + (cyclotomic.monic (p ^ (k + 1)) A).finite_adjoinRoot + +theorem uniformizer_aeval_shifted (A : Type uA) [CommRing A] (p k : ℕ) : + aeval (uniformizer A p k) (RamifiedEisenstein.shifted A p k) = 0 := by + simp only [RamifiedEisenstein.shifted, aeval_comp, map_add, aeval_X, map_one, + uniformizer, sub_add_cancel, AdjoinRoot.aeval_eq, AdjoinRoot.mk_self] + +/-- Every element is a scalar modulo the actual root-minus-one parameter. -/ +theorem exists_scalar_add_uniformizer_mul (A : Type uA) [CommRing A] (p k : ℕ) + (x : Extension A p k) : + ∃ a : A, ∃ b : Extension A p k, + x = algebraMap A (Extension A p k) a + uniformizer A p k * b := by + obtain ⟨q, rfl⟩ := AdjoinRoot.mk_surjective x + have hroot : (q.map (algebraMap A (Extension A p k))).eval + (AdjoinRoot.root (cyclotomic (p ^ (k + 1)) A)) = + AdjoinRoot.mk (cyclotomic (p ^ (k + 1)) A) q := by + rw [eval_map, ← aeval_def, AdjoinRoot.aeval_eq] + have hone : (q.map (algebraMap A (Extension A p k))).eval 1 = + algebraMap A (Extension A p k) (q.eval 1) := by + rw [eval_map, eval₂_at_one] + have hdiv := sub_dvd_eval_sub + (AdjoinRoot.root (cyclotomic (p ^ (k + 1)) A)) (1 : Extension A p k) + (q.map (algebraMap A (Extension A p k))) + rw [hroot, hone] at hdiv + obtain ⟨b, hb⟩ := hdiv + refine ⟨q.eval 1, b, ?_⟩ + change _ = _ + (AdjoinRoot.root _ - 1) * b + rw [← hb] + simp + +theorem prime_mem_span_uniformizer (A : Type uA) [CommRing A] + {p : ℕ} (hp : p.Prime) (k : ℕ) : + (p : Extension A p k) ∈ Ideal.span {uniformizer A p k} := by + let : Fact p.Prime := ⟨hp⟩ + have hdiv := sub_dvd_eval_sub + (AdjoinRoot.root (cyclotomic (p ^ (k + 1)) A)) (1 : Extension A p k) + ((cyclotomic (p ^ (k + 1)) A).map (algebraMap A (Extension A p k))) + have hdiv' : uniformizer A p k ∣ -(p : Extension A p k) := by + simpa only [uniformizer, eval_map, AdjoinRoot.algebraMap_eq, + AdjoinRoot.eval₂_root, eval₂_one_cyclotomic_prime_pow, zero_sub] using hdiv + exact (Ideal.neg_mem_iff (Ideal.span {uniformizer A p k})).mp + (Ideal.mem_span_singleton.mpr hdiv') + +section LocalBase + +variable (A : Type uA) [CommRing A] [IsDomain A] [CharZero A] + [IsDiscreteValuationRing A] {p : ℕ} (hp : p.Prime) (k : ℕ) + (hmax : IsLocalRing.maximalIdeal A = Ideal.span {(p : A)}) + +include hp hmax + +theorem isDomain : IsDomain (Extension A p k) := + RamifiedEisenstein.cyclotomic_adjoinRoot_isDomain A hp k hmax + +omit [CharZero A] in +/-- Every maximal ideal of the genuine quotient is the same principal ideal. -/ +theorem maximal_eq_span_uniformizer [CharZero A] (M : Ideal (Extension A p k)) [M.IsMaximal] : + M = Ideal.span {uniformizer A p k} := by + have hcomap : M.comap (algebraMap A (Extension A p k)) = Ideal.span {(p : A)} := + (IsLocalRing.eq_maximalIdeal + (Ideal.isMaximal_under_of_isIntegral_of_isMaximal (R := A) M)).trans hmax + have hmap : (Ideal.span {(p : A)}).map (algebraMap A (Extension A p k)) ≤ M := by + apply Ideal.map_le_iff_le_comap.mpr + rw [hcomap] + have hpow := Polynomial.IsWeaklyEisensteinAt.pow_natDegree_le_of_aeval_zero_of_monic_mem_map + (RamifiedEisenstein.shifted_isWeaklyEisensteinAt A hp k) + (uniformizer_aeval_shifted A p k) (RamifiedEisenstein.shifted_monic A p k) + _ (le_refl _) + have hpi : uniformizer A p k ∈ M := + (inferInstance : M.IsPrime).mem_of_pow_mem _ (hmap hpow) + apply le_antisymm + · intro x hx + obtain ⟨a, b, hxform⟩ := exists_scalar_add_uniformizer_mul A p k x + have haM : algebraMap A (Extension A p k) a ∈ M := by + have hh := M.sub_mem hx (Ideal.mul_mem_right b M hpi) + simpa [hxform] using hh + have ha : a ∈ Ideal.span {(p : A)} := by + rw [← hcomap] + exact haM + obtain ⟨c, hc⟩ := Ideal.mem_span_singleton.mp ha + have hap : algebraMap A (Extension A p k) a ∈ + Ideal.span {uniformizer A p k} := by + rw [hc, map_mul, map_natCast] + exact Ideal.mul_mem_right _ _ (prime_mem_span_uniformizer A hp k) + rw [hxform] + exact (Ideal.span {uniformizer A p k}).add_mem hap + (Ideal.mul_mem_right b _ (Ideal.subset_span (Set.mem_singleton _))) + · exact (Ideal.span_singleton_le_iff_mem M).mpr hpi + +theorem isLocalRing : IsLocalRing (Extension A p k) := by + let : IsDomain (Extension A p k) := isDomain A hp k hmax + obtain ⟨M, hM⟩ := Ideal.exists_maximal (Extension A p k) + let : M.IsMaximal := hM + apply IsLocalRing.of_unique_max_ideal + refine ⟨M, hM, ?_⟩ + intro N hN + let : N.IsMaximal := hN + exact (maximal_eq_span_uniformizer A hp k hmax N).trans + (maximal_eq_span_uniformizer A hp k hmax M).symm + +variable [IsLocalRing (Extension A p k)] + +theorem maximalIdeal_eq_span : + IsLocalRing.maximalIdeal (Extension A p k) = Ideal.span {uniformizer A p k} := + maximal_eq_span_uniformizer A hp k hmax _ + +theorem root_residue_eq_one : + Ideal.Quotient.mk (IsLocalRing.maximalIdeal (Extension A p k)) + (AdjoinRoot.root (cyclotomic (p ^ (k + 1)) A)) = 1 := by + apply sub_eq_zero.mp + rw [← map_one (Ideal.Quotient.mk (IsLocalRing.maximalIdeal (Extension A p k))), + ← map_sub] + apply Ideal.Quotient.eq_zero_iff_mem.mpr + change uniformizer A p k ∈ IsLocalRing.maximalIdeal (Extension A p k) + rw [maximalIdeal_eq_span A hp k hmax] + exact Ideal.subset_span (Set.mem_singleton _) + +theorem exists_unit_mul_uniformizer_pow : + ∃ u : (Extension A p k)ˣ, + (p : Extension A p k) = (u : Extension A p k) * + uniformizer A p k ^ ((p - 1) * p ^ k) := by + have hd : 0 < (RamifiedEisenstein.shifted A p k).natDegree := by + rw [RamifiedEisenstein.shifted_natDegree A hp k] + exact Nat.mul_pos (Nat.sub_pos_of_lt hp.one_lt) (pow_pos hp.pos k) + have hcoeff : ∀ i < (RamifiedEisenstein.shifted A p k).natDegree, + (p : A) ∣ (RamifiedEisenstein.shifted A p k).coeff i := by + intro i hi + exact Ideal.mem_span_singleton.mp + ((RamifiedEisenstein.shifted_isWeaklyEisensteinAt A hp k).mem hi) + have hpi : uniformizer A p k ∈ IsLocalRing.maximalIdeal (Extension A p k) := by + rw [maximalIdeal_eq_span A hp k hmax] + exact Ideal.subset_span (Set.mem_singleton _) + obtain ⟨u, hu⟩ := RamifiedUnit.exists_unit_mul_root_pow + (RamifiedEisenstein.shifted A p k) (p : A) (Nat.cast_ne_zero.mpr hp.ne_zero) + (RamifiedEisenstein.shifted_monic A p k) hd + (RamifiedEisenstein.shifted_coeff_zero A hp k) hcoeff + (uniformizer A p k) hpi (uniformizer_aeval_shifted A p k) + exact ⟨u, by simpa only [map_natCast, RamifiedEisenstein.shifted_natDegree A hp k] using hu⟩ + +omit hmax [CharZero A] [IsLocalRing (Extension A p k)] in +theorem algebraMap_injective [CharZero A] [IsLocalRing (Extension A p k)] : Function.Injective (algebraMap A (Extension A p k)) := by + apply AdjoinRoot.of.injective_of_degree_ne_zero + apply Polynomial.degree_ne_of_natDegree_ne + rw [RamifiedEisenstein.cyclotomic_natDegree A hp k] + exact Nat.ne_of_gt (Nat.mul_pos (Nat.sub_pos_of_lt hp.one_lt) (pow_pos hp.pos k)) + +omit hmax in +theorem charZero : CharZero (Extension A p k) where + cast_injective m n h := + Nat.cast_injective (algebraMap_injective A hp k (by simpa only [map_natCast] using h)) + +theorem uniformizer_ne_zero : uniformizer A p k ≠ 0 := by + intro hzero + have hpS : (p : Extension A p k) ≠ 0 := by + intro hpzero + have : algebraMap A (Extension A p k) (p : A) = + algebraMap A (Extension A p k) 0 := by simpa using hpzero + exact (Nat.cast_ne_zero.mpr hp.ne_zero : (p : A) ≠ 0) + (algebraMap_injective A hp k this) + obtain ⟨u, hu⟩ := exists_unit_mul_uniformizer_pow A hp k hmax + have hd : (p - 1) * p ^ k ≠ 0 := + Nat.ne_of_gt (Nat.mul_pos (Nat.sub_pos_of_lt hp.one_lt) (pow_pos hp.pos k)) + exact hpS (by simpa only [hzero, zero_pow hd, mul_zero] using hu) + +variable [IsDomain (Extension A p k)] + +theorem isDiscreteValuationRing : IsDiscreteValuationRing (Extension A p k) := + LocalDVR.isDiscreteValuationRing_of_maximalIdeal_eq_span + (uniformizer_ne_zero A hp k hmax) (maximalIdeal_eq_span A hp k hmax) + +omit [IsLocalRing (Extension A p k)] in +theorem addVal_prime [IsDiscreteValuationRing (Extension A p k)] : + IsDiscreteValuationRing.addVal (Extension A p k) (p : Extension A p k) = + (((p - 1) * p ^ k : ℕ) : ℕ∞) := by + obtain ⟨u, hu⟩ := exists_unit_mul_uniformizer_pow A hp k hmax + exact LocalDVR.addVal_eq_of_unit_mul_uniformizer_pow + (maximalIdeal_eq_span A hp k hmax) hu + +end LocalBase + +end CirculantHadamard.RamifiedLocal + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/CirculantHadamard/RamifiedUnit.lean b/lean/OAI/LinearAlgebra/CirculantHadamard/RamifiedUnit.lean new file mode 100644 index 0000000000000000000000000000000000000000..ef9597080f0aa3b400339f5d7e67a4c46cb54530 --- /dev/null +++ b/lean/OAI/LinearAlgebra/CirculantHadamard/RamifiedUnit.lean @@ -0,0 +1,93 @@ +import Mathlib.Algebra.Polynomial.EraseLead +import Mathlib.Algebra.Polynomial.Inductions +import Mathlib.Algebra.Polynomial.Coeff +import Mathlib.Algebra.Polynomial.AlgebraMap +import Mathlib.RingTheory.LocalRing.Basic +import Mathlib.RingTheory.LocalRing.MaximalIdeal.Basic + +namespace OAI + +universe uR uS + +/-! +# The unit factor in a ramified polynomial relation + +The exact constant coefficient, together with divisibility of the other +nonleading coefficients, gives a factor with constant coefficient one. +At a root in the maximal ideal this factor is a unit. +-/ + +noncomputable section + +namespace CirculantHadamard.RamifiedUnit + +open Polynomial + +variable {R : Type uR} {S : Type uS} [CommRing R] [IsDomain R] + +/-- The polynomial form of the unit factor in an Eisenstein relation. -/ +theorem exists_polynomial_unit_factor (f : R[X]) (a : R) (ha : a ≠ 0) + (hf : f.Monic) (hdeg : 0 < f.natDegree) (hzero : f.coeff 0 = a) + (hcoeff : ∀ i < f.natDegree, a ∣ f.coeff i) : + ∃ q : R[X], f = X ^ f.natDegree + C a * (1 + X * q) := by + have hdvd : C a ∣ f.eraseLead := by + apply (C_dvd_iff_dvd_coeff _ _).2 + intro i + by_cases hi : i = f.natDegree + · simp [eraseLead_coeff, hi] + · rw [eraseLead_coeff_of_ne _ hi] + by_cases hilt : i < f.natDegree + · exact hcoeff i hilt + · rw [coeff_eq_zero_of_natDegree_lt + (lt_of_le_of_ne (Nat.le_of_not_gt hilt) (Ne.symm hi))] + exact dvd_zero a + obtain ⟨q, hq⟩ := hdvd + have hqzero : q.coeff 0 = 1 := by + apply mul_left_cancel₀ ha + have hh := congrArg (fun g : R[X] => g.coeff 0) hq + simpa [eraseLead_coeff_of_ne _ (Nat.ne_of_lt hdeg), hzero] using hh.symm + have hqrepr : 1 + X * q.divX = q := by + simpa [hqzero, add_comm] using X_mul_divX_add q + refine ⟨q.divX, ?_⟩ + calc + f = f.eraseLead + X ^ f.natDegree := by + simpa [hf] using (eraseLead_add_C_mul_X_pow f).symm + _ = X ^ f.natDegree + C a * (1 + X * q.divX) := by + rw [hq, hqrepr] + exact add_comm _ _ + +variable [CommRing S] [Algebra R S] [IsLocalRing S] + +/-- A root in the maximal ideal turns the normalized polynomial factor into +a unit, and therefore expresses the constant coefficient as a unit times +the ramified power. -/ +theorem exists_unit_mul_root_pow (f : R[X]) (a : R) (ha : a ≠ 0) + (hf : f.Monic) (hdeg : 0 < f.natDegree) (hzero : f.coeff 0 = a) + (hcoeff : ∀ i < f.natDegree, a ∣ f.coeff i) + (z : S) (hz : z ∈ IsLocalRing.maximalIdeal S) (hroot : aeval z f = 0) : + ∃ u : Sˣ, algebraMap R S a = (u : S) * z ^ f.natDegree := by + obtain ⟨q, hq⟩ := exists_polynomial_unit_factor f a ha hf hdeg hzero hcoeff + have hrel : z ^ f.natDegree + algebraMap R S a * (1 + z * aeval z q) = 0 := by + rw [hq] at hroot + simpa only [map_add, map_mul, map_pow, aeval_X, map_one, aeval_C] using hroot + have hn : -(z * aeval z q) ∈ IsLocalRing.maximalIdeal S := + (IsLocalRing.maximalIdeal S).neg_mem + ((IsLocalRing.maximalIdeal S).mul_mem_right _ hz) + have hu : IsUnit (1 + z * aeval z q) := by + simpa only [sub_neg_eq_add] using + IsLocalRing.isUnit_one_sub_self_of_mem_nonunits (-(z * aeval z q)) hn + obtain ⟨v, hv⟩ := hu + have hpow : z ^ f.natDegree = -(algebraMap R S a * (v : S)) := by + rw [← hv] at hrel + exact eq_neg_of_add_eq_zero_left hrel + refine ⟨-v⁻¹, ?_⟩ + rw [Units.val_neg, hpow, neg_mul_neg] + calc + algebraMap R S a = algebraMap R S a * ((v : S) * ↑v⁻¹) := by simp + _ = ↑v⁻¹ * (algebraMap R S a * (v : S)) := by ac_rfl + +end CirculantHadamard.RamifiedUnit + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/CirculantHadamard/ResidueOneAssociation.lean b/lean/OAI/LinearAlgebra/CirculantHadamard/ResidueOneAssociation.lean new file mode 100644 index 0000000000000000000000000000000000000000..dc4abf8094688d0390e7e472246381a011e31e71 --- /dev/null +++ b/lean/OAI/LinearAlgebra/CirculantHadamard/ResidueOneAssociation.lean @@ -0,0 +1,150 @@ +import Mathlib.Algebra.Regular.Basic +import Mathlib.RingTheory.LocalRing.ResidueField.Basic + +namespace OAI + +universe uS uk + +/-! +# Association by a unit with residue one + +This algebraic relation expresses the local comparison conclusion without +introducing division in the coefficient ring. The scalar-cancellation lemmas +require regularity explicitly; they do not give group rings a domain instance. +For a local ring, the residue map is the quotient by its maximal ideal. +-/ + +namespace CirculantHadamard.LocalComparison + +variable {S : Type uS} {k : Type uk} [CommRing S] [CommRing k] + +/-- `x` differs from `y` by multiplication by a unit whose residue is one. -/ +def ResidueOneAssociated (residue : S →+* k) (x y : S) : Prop := + ∃ u : Sˣ, x = (u : S) * y ∧ residue (u : S) = 1 + +theorem residue_inv_eq_one (residue : S →+* k) {u : Sˣ} + (hu : residue (u : S) = 1) : residue (↑u⁻¹ : S) = 1 := by + have h : residue (u : S) * residue (↑u⁻¹ : S) = 1 := by + rw [← map_mul, Units.mul_inv, map_one] + simpa only [hu, one_mul] using h + +namespace ResidueOneAssociated + +variable {residue : S →+* k} {x y z c x' y' : S} + +@[refl] theorem refl (residue : S →+* k) (x : S) : + ResidueOneAssociated residue x x := by + exact ⟨1, by simp, by simp⟩ + +@[symm] theorem symm (h : ResidueOneAssociated residue x y) : + ResidueOneAssociated residue y x := by + obtain ⟨u, hxy, hu⟩ := h + refine ⟨u⁻¹, ?_, residue_inv_eq_one residue hu⟩ + rw [hxy, Units.inv_mul_cancel_left] + +@[trans] theorem trans (hxy : ResidueOneAssociated residue x y) + (hyz : ResidueOneAssociated residue y z) : ResidueOneAssociated residue x z := by + obtain ⟨u, hxy, hu⟩ := hxy + obtain ⟨v, hyz, hv⟩ := hyz + refine ⟨u * v, ?_, ?_⟩ + · simp only [Units.val_mul, hxy, hyz, mul_assoc] + · simp only [Units.val_mul, map_mul, hu, hv, one_mul] + +theorem residue_eq (h : ResidueOneAssociated residue x y) : residue x = residue y := by + obtain ⟨u, hxy, hu⟩ := h + rw [hxy, map_mul, hu, one_mul] + +theorem mul_left (h : ResidueOneAssociated residue x y) (c : S) : + ResidueOneAssociated residue (c * x) (c * y) := by + obtain ⟨u, hxy, hu⟩ := h + refine ⟨u, ?_, hu⟩ + rw [hxy] + ac_rfl + +/-- A common regular scalar can be cancelled even if the ambient ring has +zero divisors. This is the form used when comparing scalar-divided factors. -/ +theorem mul_left_iff (residue : S →+* k) (hc : IsLeftRegular c) : + ResidueOneAssociated residue (c * x) (c * y) ↔ + ResidueOneAssociated residue x y := by + constructor + · rintro ⟨u, hxy, hu⟩ + refine ⟨u, hc ?_, hu⟩ + calc + c * x = (u : S) * (c * y) := hxy + _ = c * ((u : S) * y) := by ac_rfl + · exact fun h => h.mul_left c + +theorem mul (h : ResidueOneAssociated residue x y) + (h' : ResidueOneAssociated residue x' y') : + ResidueOneAssociated residue (x * x') (y * y') := by + obtain ⟨u, hxy, hu⟩ := h + obtain ⟨v, hxy', hv⟩ := h' + refine ⟨u * v, ?_, ?_⟩ + · rw [hxy, hxy', Units.val_mul] + ac_rfl + · simp only [Units.val_mul, map_mul, hu, hv, one_mul] + +/-- With equal nonzero products, a comparison for one factor gives the inverse +unit as comparison for the other factor. Only regularity of `y` is needed. -/ +theorem product_complement_of_regular (h : ResidueOneAssociated residue x y) + (hprod : x * x' = y * y') (hy : IsLeftRegular y) : + ResidueOneAssociated residue x' y' := by + obtain ⟨u, hxy, hu⟩ := h + have hcancel : (u : S) * x' = y' := by + apply hy + calc + y * ((u : S) * x') = ((u : S) * y) * x' := by ac_rfl + _ = x * x' := by rw [← hxy] + _ = y * y' := hprod + refine ⟨u⁻¹, ?_, residue_inv_eq_one residue hu⟩ + rw [← hcancel, Units.inv_mul_cancel_left] + +/-- The two-factor step used in the character-comparison base case. -/ +theorem product_complement [IsDomain S] (h : ResidueOneAssociated residue x y) + (hprod : x * x' = y * y') (hne : y * y' ≠ 0) : + ResidueOneAssociated residue x' y' := by + have hy : y ≠ 0 := fun hz => hne (by rw [hz, zero_mul]) + exact h.product_complement_of_regular hprod (fun _ _ h => mul_left_cancel₀ hy h) + +theorem mul_left_iff_of_ne_zero [IsDomain S] (residue : S →+* k) (hc : c ≠ 0) : + ResidueOneAssociated residue (c * x) (c * y) ↔ + ResidueOneAssociated residue x y := + mul_left_iff residue (fun _ _ h => mul_left_cancel₀ hc h) + +/-- Two units with the same residue differ by a unit with residue one. -/ +theorem of_isUnit_of_residue_eq (residue : S →+* k) + (hx : IsUnit x) (hy : IsUnit y) (hres : residue x = residue y) : + ResidueOneAssociated residue x y := by + obtain ⟨u, rfl⟩ := hx + obtain ⟨v, rfl⟩ := hy + refine ⟨u * v⁻¹, ?_, ?_⟩ + · simp only [Units.val_mul, mul_assoc, Units.inv_mul, mul_one] + · rw [Units.val_mul, map_mul, hres, ← map_mul, Units.mul_inv, map_one] + +end ResidueOneAssociated + +section ActualResidueField + +variable [IsLocalRing S] {x y : S} + +/-- Equality to the residue of a unit forces an element of a local ring to be +a unit. The residue map is the actual quotient by the maximal ideal. -/ +theorem isUnit_of_residue_eq (hy : IsUnit y) + (hres : IsLocalRing.residue S x = IsLocalRing.residue S y) : IsUnit x := by + apply (IsLocalRing.residue_ne_zero_iff_isUnit x).mp + rw [hres] + exact (IsLocalRing.residue_ne_zero_iff_isUnit y).mpr hy + +/-- Concrete local-ring base case: an augmentation unit and agreement in the +residue field suffice to construct the comparison unit. -/ +theorem residueOneAssociated_of_isUnit_residue_eq (hy : IsUnit y) + (hres : IsLocalRing.residue S x = IsLocalRing.residue S y) : + ResidueOneAssociated (IsLocalRing.residue S) x y := + ResidueOneAssociated.of_isUnit_of_residue_eq (IsLocalRing.residue S) + (isUnit_of_residue_eq hy hres) hy hres + +end ActualResidueField + +end CirculantHadamard.LocalComparison + +end OAI diff --git a/lean/OAI/LinearAlgebra/CirculantHadamard/ResidueTorsion.lean b/lean/OAI/LinearAlgebra/CirculantHadamard/ResidueTorsion.lean new file mode 100644 index 0000000000000000000000000000000000000000..91c2e6b4dcf2a78748546909576b55988bf46a68 --- /dev/null +++ b/lean/OAI/LinearAlgebra/CirculantHadamard/ResidueTorsion.lean @@ -0,0 +1,85 @@ +import Mathlib.Algebra.Ring.GeomSum +import Mathlib.Algebra.CharP.Defs +import Mathlib.Data.Nat.Factorization.Basic +import Mathlib.GroupTheory.OrderOfElement + +namespace OAI + +universe uR uK + +/-! +# Torsion in the kernel of a residue map + +The geometric-sum argument works for any ring homomorphism from a domain +to a field of characteristic `p`. In a local-ring application the map is +the residue homomorphism; the domain itself need not have characteristic `p`. +-/ + +namespace CirculantHadamard + +open scoped BigOperators + +variable {R : Type uR} {K : Type uK} [CommRing R] [IsDomain R] [Field K] + +/-- A root whose image is one is trivial if one of its torsion exponents +is not divisible by the target characteristic. -/ +theorem eq_one_of_residue_one_of_not_dvd {p m : ℕ} [CharP K p] + (f : R →+* K) (z : R) (hmap : f z = 1) (hpow : z ^ m = 1) + (hm : ¬ p ∣ m) : z = 1 := by + by_contra hne + have hprod : (∑ i ∈ Finset.range m, z ^ i) * (z - 1) = 0 := by + rw [geom_sum_mul, hpow, sub_self] + have hsum : (∑ i ∈ Finset.range m, z ^ i) = 0 := + (mul_eq_zero.mp hprod).resolve_right (sub_ne_zero.mpr hne) + have hcast : (m : K) = 0 := by + have h := congrArg f hsum + simpa only [map_sum, map_pow, hmap, one_pow, Finset.sum_const, + Finset.card_range, nsmul_eq_mul, mul_one, map_zero] using h + exact hm ((CharP.cast_eq_zero_iff K p m).mp hcast) + +/-- Coprime-order torsion in the residue-one subgroup is trivial. The +exponent need not be the exact order. -/ +theorem eq_one_of_residue_one_of_coprime {p m : ℕ} [CharP K p] + (f : R →+* K) (z : R) (hp : p.Prime) (hmap : f z = 1) + (hpow : z ^ m = 1) (hcop : m.Coprime p) : z = 1 := by + exact eq_one_of_residue_one_of_not_dvd f z hmap hpow + (hp.coprime_iff_not_dvd.mp hcop.symm) + +theorem exists_prime_power_of_residue_one {p : ℕ} [CharP K p] + (f : R →+* K) (z : R) (hp : p.Prime) (hmap : f z = 1) + (hfinite : ∃ N : ℕ, 0 < N ∧ z ^ N = 1) : + ∃ a : ℕ, z ^ (p ^ a) = 1 := by + obtain ⟨N, hN, hpow⟩ := hfinite + obtain ⟨a, m, hm, hNm⟩ := + Nat.exists_eq_pow_mul_and_not_dvd hN.ne' p hp.ne_one + refine ⟨a, eq_one_of_residue_one_of_not_dvd f (z ^ (p ^ a)) ?_ ?_ hm⟩ + · rw [map_pow, hmap, one_pow] + · rw [← pow_mul, ← hNm] + exact hpow + +/-- The exact order is a power of the residue characteristic, including +the zeroth power for the identity element. -/ +theorem orderOf_eq_prime_power_of_residue_one {p : ℕ} [CharP K p] + (f : R →+* K) (z : R) (hp : p.Prime) (hmap : f z = 1) + (hfinite : IsOfFinOrder z) : ∃ a : ℕ, orderOf z = p ^ a := by + obtain ⟨a, ha⟩ := exists_prime_power_of_residue_one f z hp hmap + hfinite.exists_pow_eq_one + obtain ⟨b, _, hb⟩ := (Nat.dvd_prime_pow hp).mp (orderOf_dvd_of_pow_eq_one ha) + exact ⟨b, hb⟩ + +/-- The characteristic-two consequence needed for the two alternating +products: a unit of odd torsion exponent and residue one equals one. -/ +theorem units_eq_one_of_residue_one_of_odd [CharP K 2] + (f : R →+* K) (u : Rˣ) (hmap : f (u : R) = 1) + (hfinite : ∃ m : ℕ, 0 < m ∧ Odd m ∧ u ^ m = 1) : u = 1 := by + obtain ⟨m, _, hm, hu⟩ := hfinite + have hpow : (u : R) ^ m = 1 := by + simpa only [Units.val_pow_eq_pow_val, Units.val_one] using + congrArg (fun v : Rˣ => (v : R)) hu + apply Units.ext + exact eq_one_of_residue_one_of_coprime f (u : R) Nat.prime_two hmap hpow + hm.coprime_two_right + +end CirculantHadamard + +end OAI diff --git a/lean/OAI/LinearAlgebra/CirculantHadamard/TwoAdicDecomposition.lean b/lean/OAI/LinearAlgebra/CirculantHadamard/TwoAdicDecomposition.lean new file mode 100644 index 0000000000000000000000000000000000000000..c9e21ba72e3241cf5b9c646a70b8c094761c240b --- /dev/null +++ b/lean/OAI/LinearAlgebra/CirculantHadamard/TwoAdicDecomposition.lean @@ -0,0 +1,56 @@ +import Mathlib.Data.Nat.Factorization.Basic +import Mathlib.Algebra.Group.Nat.Even + +namespace OAI + +/-! +# The two-adic form of a positive even square + +Extract the power of two from an actual positive square root. Evenness of the +square forces a positive exponent in that root, so squaring gives the precise +form used at the start of the circulant Hadamard order reduction. +-/ + +namespace CirculantHadamard + +/-- Extract the two-adic part from a specified positive square root. -/ +theorem exists_two_adic_square_decomposition_of_eq_sq {n m : ℕ} + (hm : 0 < m) (hnm : n = m ^ 2) (heven : Even n) : + ∃ s u : ℕ, 1 ≤ s ∧ 0 < u ∧ Odd u ∧ n = 2 ^ (2 * s) * u ^ 2 := by + obtain ⟨s, u, hu, hroot⟩ := Nat.exists_eq_two_pow_mul_odd hm.ne' + have hmEven : Even m := (Nat.even_pow.mp (hnm ▸ heven)).1 + have hs : s ≠ 0 := by + intro hs0 + have hmu : m = u := by simpa only [hs0, pow_zero, one_mul] using hroot + exact (Nat.not_even_iff_odd.mpr hu) (hmu ▸ hmEven) + have huPos : 0 < u := by + apply Nat.pos_of_ne_zero + intro hu0 + have hm0 : m = 0 := by simpa only [hu0, mul_zero] using hroot + exact hm.ne' hm0 + refine ⟨s, u, Nat.succ_le_of_lt (Nat.pos_of_ne_zero hs), huPos, hu, ?_⟩ + rw [hnm, hroot, mul_pow, ← pow_mul, Nat.mul_comm s 2] + +/-- Every positive even natural square has a positive odd part and a +nonzero, even power of two. -/ +theorem exists_two_adic_square_decomposition {n : ℕ} + (hn : 0 < n) (hsquare : IsSquare n) (heven : Even n) : + ∃ s u : ℕ, 1 ≤ s ∧ 0 < u ∧ Odd u ∧ n = 2 ^ (2 * s) * u ^ 2 := by + obtain ⟨m, hnm⟩ := hsquare.exists_sq + have hm : 0 < m := by + apply Nat.pos_of_ne_zero + intro hm0 + have hn0 : n = 0 := by simpa only [hm0, zero_pow (by decide : 2 ≠ 0)] using hnm + exact hn.ne' hn0 + exact exists_two_adic_square_decomposition_of_eq_sq hm hnm heven + +/-- Interface for an order theorem that already supplies its positive root. -/ +theorem exists_two_adic_square_decomposition_of_positive_square {n : ℕ} + (hsquare : ∃ m : ℕ, 0 < m ∧ n = m ^ 2) (heven : Even n) : + ∃ s u : ℕ, 1 ≤ s ∧ 0 < u ∧ Odd u ∧ n = 2 ^ (2 * s) * u ^ 2 := by + obtain ⟨m, hm, hnm⟩ := hsquare + exact exists_two_adic_square_decomposition_of_eq_sq hm hnm heven + +end CirculantHadamard + +end OAI diff --git a/lean/OAI/LinearAlgebra/CirculantHadamard/Witnesses.lean b/lean/OAI/LinearAlgebra/CirculantHadamard/Witnesses.lean new file mode 100644 index 0000000000000000000000000000000000000000..09044d41aca74a1e19acd5db8318b93e489f20c2 --- /dev/null +++ b/lean/OAI/LinearAlgebra/CirculantHadamard/Witnesses.lean @@ -0,0 +1,83 @@ +import OAI.LinearAlgebra.CirculantHadamard.Basic +import Mathlib.LinearAlgebra.Matrix.Notation +import Mathlib.Tactic.NormNum + +namespace OAI + +namespace CirculantHadamard + +def firstRow_one : Fin 1 → ℝ := ![1] + +def firstRow_four : Fin 4 → ℝ := ![1, 1, 1, -1] + +def witness_one : Matrix (Fin 1) (Fin 1) ℝ := !![1] + +def witness_four : Matrix (Fin 4) (Fin 4) ℝ := + !![1, 1, 1, -1; + -1, 1, 1, 1; + 1, -1, 1, 1; + 1, 1, -1, 1] + +@[simp] theorem witness_one_first_row : witness_one 0 = firstRow_one := rfl + +@[simp] theorem witness_four_first_row : witness_four 0 = firstRow_four := rfl + +theorem witness_one_eq_rowCirculant : witness_one = rowCirculant firstRow_one := by + ext i j + fin_cases i; fin_cases j; rfl + +theorem witness_four_eq_rowCirculant : witness_four = rowCirculant firstRow_four := by + ext i j + fin_cases i <;> fin_cases j <;> rfl + +theorem witness_one_signs (i j : Fin 1) : IsSign (witness_one i j) := by + fin_cases i; fin_cases j; norm_num [IsSign, witness_one] + +theorem witness_four_signs (i j : Fin 4) : IsSign (witness_four i j) := by + fin_cases i <;> fin_cases j <;> norm_num [IsSign, witness_four] + +theorem witness_one_gram : + witness_one * witness_one.transpose = (1 : ℝ) • (1 : Matrix (Fin 1) (Fin 1) ℝ) := by + ext i j + fin_cases i; fin_cases j + norm_num [Matrix.mul_apply, Fin.sum_univ_one, witness_one, + Matrix.transpose_apply, Matrix.smul_apply, Matrix.one_apply] + +theorem witness_four_gram : + witness_four * witness_four.transpose = (4 : ℝ) • (1 : Matrix (Fin 4) (Fin 4) ℝ) := by + ext i j + fin_cases i <;> fin_cases j <;> + norm_num [Matrix.mul_apply, Fin.sum_univ_four, witness_four, + Matrix.transpose_apply, Matrix.smul_apply, Matrix.one_apply, + Matrix.cons_val_two, Matrix.cons_val_three] + +theorem witness_one_isCirculant : IsCirculant witness_one := by + rw [witness_one_eq_rowCirculant] + exact rowCirculant_isCirculant firstRow_one + +theorem witness_four_isCirculant : IsCirculant witness_four := by + rw [witness_four_eq_rowCirculant] + exact rowCirculant_isCirculant firstRow_four + +theorem witness_one_isSignHadamard : IsSignHadamard witness_one := by + exact ⟨witness_one_signs, by simpa using witness_one_gram⟩ + +theorem witness_four_isSignHadamard : IsSignHadamard witness_four := by + exact ⟨witness_four_signs, by simpa using witness_four_gram⟩ + +theorem exists_one : ExistsRealCirculantHadamard 1 := + ⟨witness_one, witness_one_isCirculant, witness_one_isSignHadamard⟩ + +theorem exists_four : ExistsRealCirculantHadamard 4 := + ⟨witness_four, witness_four_isCirculant, witness_four_isSignHadamard⟩ + +/-- The explicit matrices of orders one and four establish existence. -/ +theorem exists_of_order_one_or_four {n : ℕ} (hn : n = 1 ∨ n = 4) : + ExistsRealCirculantHadamard n := by + rcases hn with rfl | rfl + · exact exists_one + · exact exists_four + +end CirculantHadamard + +end OAI diff --git a/lean/OAI/LinearAlgebra/CliffordAlgebra/KugaSatake.lean b/lean/OAI/LinearAlgebra/CliffordAlgebra/KugaSatake.lean new file mode 100644 index 0000000000000000000000000000000000000000..e416cf0b4514dd77aba1291cb04e8ef1e5dd5835 --- /dev/null +++ b/lean/OAI/LinearAlgebra/CliffordAlgebra/KugaSatake.lean @@ -0,0 +1,287 @@ +import Mathlib + +namespace OAI + +/-! Rational even-Clifford operators, functorial transport, and their tensor forms in output-first order. -/ + +namespace KugaSatake + +section CliffordOperator + +variable {T : Type*} [AddCommGroup T] [Module ℚ T] +variable (q : QuadraticForm ℚ T) + +theorem sandwich_mem_even (v w : T) (a : CliffordAlgebra.even q) : + CliffordAlgebra.ι q v * (a : CliffordAlgebra q) * CliffordAlgebra.ι q w ∈ + CliffordAlgebra.even q := by + change _ ∈ CliffordAlgebra.evenOdd q 0 + have h := SetLike.mul_mem_graded + (SetLike.mul_mem_graded (CliffordAlgebra.ι_mem_evenOdd_one q v) a.property) + (CliffordAlgebra.ι_mem_evenOdd_one q w) + simpa only [add_zero, show (1 : ZMod 2) + 1 = 0 from rfl] using h + +def cliffordOperator (w : T) : T →ₗ[ℚ] Module.End ℚ (CliffordAlgebra.even q) where + toFun v := + { toFun := fun a => + ⟨CliffordAlgebra.ι q v * (a : CliffordAlgebra q) * CliffordAlgebra.ι q w, + sandwich_mem_even q v w a⟩ + map_add' a b := Subtype.ext (by simp [mul_add, add_mul]) + map_smul' c a := Subtype.ext (by simp) } + map_add' v v' := by + ext a + simp [add_mul] + map_smul' c v := by + ext a + simp + +@[simp] +theorem cliffordOperator_apply (w v : T) (a : CliffordAlgebra.even q) : + (cliffordOperator q w v a : CliffordAlgebra q) = + CliffordAlgebra.ι q v * (a : CliffordAlgebra q) * CliffordAlgebra.ι q w := rfl + +theorem clifford_ι_injective : Function.Injective (CliffordAlgebra.ι q) := by + intro v v' h + apply (ExteriorAlgebra.ι_inj ℚ v v').mp + have hh := congrArg (CliffordAlgebra.equivExterior q) h + simpa [CliffordAlgebra.equivExterior, CliffordAlgebra.changeFormEquiv_apply] using hh + +theorem cliffordOperator_injective (w : T) (hw : q w ≠ 0) : + Function.Injective (cliffordOperator q w) := by + intro v v' h + have he := congrArg + (fun f : Module.End ℚ (CliffordAlgebra.even q) => (f 1 : CliffordAlgebra q)) h + simp only [cliffordOperator_apply, OneMemClass.coe_one, mul_one] at he + have hu : IsUnit (CliffordAlgebra.ι q w) := + CliffordAlgebra.isUnit_ι_of_isUnit q (isUnit_iff_ne_zero.mpr hw) + exact clifford_ι_injective q (hu.mul_left_inj.mp he) + +theorem vector_mul_inverse (w : T) (hw : q w ≠ 0) : + CliffordAlgebra.ι q w * CliffordAlgebra.ι q ((q w)⁻¹ • w) = 1 := by + rw [map_smul, mul_smul_comm, CliffordAlgebra.ι_sq_scalar, + Algebra.smul_def, ← map_mul, inv_mul_cancel₀ hw, map_one] + +theorem inverse_mul_vector (w : T) (hw : q w ≠ 0) : + CliffordAlgebra.ι q ((q w)⁻¹ • w) * CliffordAlgebra.ι q w = 1 := by + rw [map_smul, smul_mul_assoc, CliffordAlgebra.ι_sq_scalar, + Algebra.smul_def, ← map_mul, inv_mul_cancel₀ hw, map_one] + +def changeRightFactor (w₀ w : T) : CliffordAlgebra.even q := + ⟨CliffordAlgebra.ι q ((q w₀)⁻¹ • w₀) * CliffordAlgebra.ι q w, + CliffordAlgebra.ι_mul_ι_mem_evenOdd_zero q _ _⟩ + +@[simp] +theorem changeRightFactor_coe (w₀ w : T) : + (changeRightFactor q w₀ w : CliffordAlgebra q) = + CliffordAlgebra.ι q ((q w₀)⁻¹ • w₀) * CliffordAlgebra.ι q w := rfl + +theorem cliffordOperator_change_right (w₀ w : T) (hw₀ : q w₀ ≠ 0) (v : T) : + (LinearMap.mulRight ℚ (changeRightFactor q w₀ w)).comp + (cliffordOperator q w₀ v) = cliffordOperator q w v := by + ext a + change (CliffordAlgebra.ι q v * (a : CliffordAlgebra q) * CliffordAlgebra.ι q w₀) * + (CliffordAlgebra.ι q ((q w₀)⁻¹ • w₀) * CliffordAlgebra.ι q w) = _ + calc + _ = (CliffordAlgebra.ι q v * (a : CliffordAlgebra q)) * + (CliffordAlgebra.ι q w₀ * CliffordAlgebra.ι q ((q w₀)⁻¹ • w₀)) * + CliffordAlgebra.ι q w := by simp only [mul_assoc] + _ = _ := by rw [vector_mul_inverse q w₀ hw₀, mul_one]; rfl + +theorem changeRightFactor_mul_reverse (w₀ w : T) (hw₀ : q w₀ ≠ 0) (hw : q w ≠ 0) : + changeRightFactor q w₀ w * changeRightFactor q w w₀ = 1 := by + apply Subtype.ext + change (CliffordAlgebra.ι q ((q w₀)⁻¹ • w₀) * CliffordAlgebra.ι q w) * + (CliffordAlgebra.ι q ((q w)⁻¹ • w) * CliffordAlgebra.ι q w₀) = 1 + calc + _ = CliffordAlgebra.ι q ((q w₀)⁻¹ • w₀) * + (CliffordAlgebra.ι q w * CliffordAlgebra.ι q ((q w)⁻¹ • w)) * + CliffordAlgebra.ι q w₀ := by simp only [mul_assoc] + _ = 1 := by rw [vector_mul_inverse q w hw, mul_one, inverse_mul_vector q w₀ hw₀] + +def changeRightUnit (w₀ w : T) (hw₀ : q w₀ ≠ 0) (hw : q w ≠ 0) : + (CliffordAlgebra.even q)ˣ where + val := changeRightFactor q w₀ w + inv := changeRightFactor q w w₀ + val_inv := changeRightFactor_mul_reverse q w₀ w hw₀ hw + inv_val := changeRightFactor_mul_reverse q w w₀ hw hw₀ + +end CliffordOperator + +section CliffordTransport + +variable {T T' : Type*} + [AddCommGroup T] [Module ℚ T] [AddCommGroup T'] [Module ℚ T'] + {q : QuadraticForm ℚ T} {q' : QuadraticForm ℚ T'} + +theorem cliffordMap_mem_even (f : q →qᵢ q') (a : CliffordAlgebra q) + (ha : a ∈ CliffordAlgebra.even q) : + CliffordAlgebra.map f a ∈ CliffordAlgebra.even q' := by + induction a, ha using CliffordAlgebra.even_induction with + | algebraMap r => + rw [AlgHom.commutes] + exact (CliffordAlgebra.even q').algebraMap_mem r + | add a b ha hb ia ib => + rw [map_add] + exact (CliffordAlgebra.even q').add_mem ia ib + | ι_mul_ι_mul v w a ha ia => + simp only [map_mul, CliffordAlgebra.map_apply_ι] + exact (CliffordAlgebra.even q').mul_mem + (CliffordAlgebra.ι_mul_ι_mem_evenOdd_zero q' (f v) (f w)) ia + +def evenCliffordMap (f : q →qᵢ q') : + CliffordAlgebra.even q →ₐ[ℚ] CliffordAlgebra.even q' where + toFun a := ⟨CliffordAlgebra.map f a, cliffordMap_mem_even f a a.property⟩ + map_one' := Subtype.ext (map_one _) + map_mul' a b := Subtype.ext (map_mul (CliffordAlgebra.map f) (a : CliffordAlgebra q) (b : CliffordAlgebra q)) + map_zero' := Subtype.ext (map_zero _) + map_add' a b := Subtype.ext (map_add (CliffordAlgebra.map f) (a : CliffordAlgebra q) (b : CliffordAlgebra q)) + commutes' r := Subtype.ext (AlgHom.commutes _ r) + +@[simp] +theorem evenCliffordMap_coe (f : q →qᵢ q') (a : CliffordAlgebra.even q) : + (evenCliffordMap f a : CliffordAlgebra q') = + CliffordAlgebra.map f (a : CliffordAlgebra q) := rfl + +theorem evenCliffordMap_operator (f : q →qᵢ q') (w v : T) + (a : CliffordAlgebra.even q) : + evenCliffordMap f (cliffordOperator q w v a) = + cliffordOperator q' (f w) (f v) (evenCliffordMap f a) := by + apply Subtype.ext + simp only [evenCliffordMap_coe, cliffordOperator_apply, map_mul, + CliffordAlgebra.map_apply_ι] + +def evenCliffordEquiv (e : q.IsometryEquiv q') : + CliffordAlgebra.even q ≃ₐ[ℚ] CliffordAlgebra.even q' := + AlgEquiv.ofAlgHom (evenCliffordMap e.toIsometry) (evenCliffordMap e.symm.toIsometry) + (by + apply AlgHom.ext + intro a + apply Subtype.ext + change CliffordAlgebra.map e.toIsometry + (CliffordAlgebra.map e.symm.toIsometry (a : CliffordAlgebra q')) = _ + exact CliffordAlgebra.leftInverse_map_of_leftInverse e.symm.toIsometry e.toIsometry + (fun v => e.toLinearEquiv.apply_symm_apply v) a) + (by + apply AlgHom.ext + intro a + apply Subtype.ext + change CliffordAlgebra.map e.symm.toIsometry + (CliffordAlgebra.map e.toIsometry (a : CliffordAlgebra q)) = _ + exact CliffordAlgebra.leftInverse_map_of_leftInverse e.toIsometry e.symm.toIsometry + (fun v => e.toLinearEquiv.symm_apply_apply v) a) + +end CliffordTransport + +section TensorConversion + +open scoped TensorProduct + +variable (W : Type*) [AddCommGroup W] [Module ℚ W] [FiniteDimensional ℚ W] + +noncomputable def tensorEndEquiv : + W ⊗[ℚ] Module.Dual ℚ W ≃ₗ[ℚ] Module.End ℚ W := + (TensorProduct.comm ℚ W (Module.Dual ℚ W)).trans (dualTensorHomEquiv ℚ W W) + +@[simp] +theorem tensorEndEquiv_tmul_apply (u : W) (f : Module.Dual ℚ W) (a : W) : + tensorEndEquiv W (u ⊗ₜ[ℚ] f) a = f a • u := rfl + +noncomputable def tensorForm (Eflat : W ≃ₗ[ℚ] Module.Dual ℚ W) : + Module.End ℚ W ≃ₗ[ℚ] W ⊗[ℚ] W := + (tensorEndEquiv W).symm.trans + (TensorProduct.congr (LinearEquiv.refl ℚ W) Eflat.symm) + +@[simp] +theorem tensorForm_tensorEndEquiv (Eflat : W ≃ₗ[ℚ] Module.Dual ℚ W) + (z : W ⊗[ℚ] Module.Dual ℚ W) : + tensorForm W Eflat (tensorEndEquiv W z) = + TensorProduct.map LinearMap.id Eflat.symm.toLinearMap z := by + simp only [tensorForm, LinearEquiv.trans_apply, LinearEquiv.symm_apply_apply] + rfl + +variable {U V : Type*} + [AddCommGroup U] [Module ℚ U] [FiniteDimensional ℚ U] + [AddCommGroup V] [Module ℚ V] [FiniteDimensional ℚ V] + +theorem tensorEndEquiv_naturality (p : U →ₗ[ℚ] V) (i : V →ₗ[ℚ] U) + (z : U ⊗[ℚ] Module.Dual ℚ U) : + tensorEndEquiv V (TensorProduct.map p i.dualMap z) = + p.comp ((tensorEndEquiv U z).comp i) := by + induction z using TensorProduct.inductionOn with + | tmul u f => + ext a + simp + | add z z' hz hz' => + simp only [map_add, hz, hz', LinearMap.add_comp, LinearMap.comp_add] + +theorem tensorForm_compression (p : U →ₗ[ℚ] V) (i : V →ₗ[ℚ] U) + (EU : U ≃ₗ[ℚ] Module.Dual ℚ U) (EV : V ≃ₗ[ℚ] Module.Dual ℚ V) + (f : Module.End ℚ U) : + TensorProduct.map p (EV.symm.toLinearMap.comp (i.dualMap.comp EU.toLinearMap)) + (tensorForm U EU f) = tensorForm V EV (p.comp (f.comp i)) := by + obtain ⟨z, rfl⟩ := (tensorEndEquiv U).surjective f + rw [tensorForm_tensorEndEquiv, ← tensorEndEquiv_naturality, + tensorForm_tensorEndEquiv] + induction z using TensorProduct.inductionOn with + | tmul u f => simp + | add z z' hz hz' => simp only [map_add, hz, hz'] + +theorem tensorForm_postcomp (E : U ≃ₗ[ℚ] Module.Dual ℚ U) + (p f : Module.End ℚ U) : + TensorProduct.map p LinearMap.id (tensorForm U E f) = + tensorForm U E (p.comp f) := by + have h := tensorForm_compression p (LinearMap.id : U →ₗ[ℚ] U) E E f + have hid : E.symm.toLinearMap.comp + ((LinearMap.id : U →ₗ[ℚ] U).dualMap.comp E.toLinearMap) = LinearMap.id := by + ext u + simp + rw [hid] at h + simpa only [LinearMap.comp_id] using h + +end TensorConversion + +section SpecifiedTensor + +open scoped TensorProduct + +variable {T : Type*} [AddCommGroup T] [Module ℚ T] [FiniteDimensional ℚ T] +variable (q : QuadraticForm ℚ T) + +instance clifford_finite : FiniteDimensional ℚ (CliffordAlgebra q) := by + exact Module.Finite.of_basis + ((Module.finBasis ℚ T).ExteriorAlgebra.map (CliffordAlgebra.equivExterior q).symm) + +instance evenClifford_finite : FiniteDimensional ℚ (CliffordAlgebra.even q) := by + exact FiniteDimensional.of_injective + (CliffordAlgebra.even q).val.toLinearMap Subtype.val_injective + +noncomputable def cliffordTensor + (Eflat : CliffordAlgebra.even q ≃ₗ[ℚ] Module.Dual ℚ (CliffordAlgebra.even q)) + (w : T) : T →ₗ[ℚ] CliffordAlgebra.even q ⊗[ℚ] CliffordAlgebra.even q := + (tensorForm (CliffordAlgebra.even q) Eflat).toLinearMap.comp (cliffordOperator q w) + +@[simp] +theorem cliffordTensor_apply + (Eflat : CliffordAlgebra.even q ≃ₗ[ℚ] Module.Dual ℚ (CliffordAlgebra.even q)) + (w v : T) : + cliffordTensor q Eflat w v = + tensorForm (CliffordAlgebra.even q) Eflat (cliffordOperator q w v) := rfl + +theorem cliffordTensor_injective + (Eflat : CliffordAlgebra.even q ≃ₗ[ℚ] Module.Dual ℚ (CliffordAlgebra.even q)) + (w : T) (hw : q w ≠ 0) : Function.Injective (cliffordTensor q Eflat w) := + (tensorForm (CliffordAlgebra.even q) Eflat).injective.comp + (cliffordOperator_injective q w hw) + +theorem cliffordTensor_change_right + (Eflat : CliffordAlgebra.even q ≃ₗ[ℚ] Module.Dual ℚ (CliffordAlgebra.even q)) + (w₀ w : T) (hw₀ : q w₀ ≠ 0) (v : T) : + TensorProduct.map (LinearMap.mulRight ℚ (changeRightFactor q w₀ w)) LinearMap.id + (cliffordTensor q Eflat w₀ v) = cliffordTensor q Eflat w v := by + rw [cliffordTensor_apply, tensorForm_postcomp, cliffordOperator_change_right q w₀ w hw₀, + cliffordTensor_apply] + +end SpecifiedTensor + +end KugaSatake + +end OAI diff --git a/lean/OAI/LinearAlgebra/Descent/Rational.lean b/lean/OAI/LinearAlgebra/Descent/Rational.lean new file mode 100644 index 0000000000000000000000000000000000000000..c85ce4706446ccf4a91bb63e8cfad96c9210dd12 --- /dev/null +++ b/lean/OAI/LinearAlgebra/Descent/Rational.lean @@ -0,0 +1,431 @@ +import Mathlib + +namespace OAI + +/-! +# Rational descent of automorphism-invariant subspaces + +Over an algebraically closed field of characteristic zero, a coefficient-invariant subspace +of finitely supported vectors is obtained by scalar extension from its rational intersection. +The coordinate index set is arbitrary, and the intersection is given both as a pullback and +as a literal subspace of the ambient space. + +`CoefficientStable` is a hypothesis on an arbitrary subspace, not a definition of the Arthur +filtration. The trace-defined Arthur filtration, its geometric setup and characteristic +hypotheses, and coefficient independence for that filtration are not formalized here. +-/ + +noncomputable section +open scoped TensorProduct Classical + +namespace ArthurLinearDescent + +theorem exists_extension_ringAut (F E : Type*) [Field F] [Field E] [Algebra F E] + [IsAlgClosed E] (σ : F ≃+* F) : + ∃ τ : E ≃+* E, ∀ a : F, τ (algebraMap F E a) = algebraMap F E (σ a) := by + classical + obtain ⟨s, hs⟩ := exists_isTranscendenceBasis F E + let v : s → E := Subtype.val + let A := Algebra.adjoin F (Set.range v) + let e : MvPolynomial s F ≃ₐ[F] A := hs.1.aevalEquiv + let α : A ≃+* A := e.symm.toRingEquiv.trans + ((MvPolynomial.mapEquiv s σ).trans e.toRingEquiv) + let : IsAlgClosure A E := IsAlgClosed.isAlgClosure_of_transcendence_basis v hs + let τ : E ≃+* E := IsAlgClosure.equivOfEquiv E E α + refine ⟨τ, fun a => ?_⟩ + have hea : algebraMap A E (e (MvPolynomial.C a)) = algebraMap F E a := by + change MvPolynomial.aeval v (MvPolynomial.C a) = algebraMap F E a + simp + calc + τ (algebraMap F E a) = τ (algebraMap A E (e (MvPolynomial.C a))) := by rw [hea] + _ = algebraMap A E (α (e (MvPolynomial.C a))) := + IsAlgClosure.equivOfEquiv_algebraMap E E α _ + _ = algebraMap F E (σ a) := by + have heα (p : MvPolynomial s F) : α (e p) = e (MvPolynomial.mapEquiv s σ p) := by + simp [α] + rw [heα] + change algebraMap A E (e (MvPolynomial.mapEquiv s σ (MvPolynomial.C a))) = _ + rw [MvPolynomial.mapEquiv_apply, MvPolynomial.map_C] + change MvPolynomial.aeval v (MvPolynomial.C (σ a)) = _ + simp + +def translateVariables (ι : Type*) (F : Type*) [CommRing F] : + MvPolynomial ι F ≃ₐ[F] MvPolynomial ι F := + AlgEquiv.ofAlgHom + (MvPolynomial.aeval fun i : ι => MvPolynomial.X i + 1) + (MvPolynomial.aeval fun i : ι => MvPolynomial.X i - 1) + (by ext i; simp) (by ext i; simp) + +@[simp] theorem translateVariables_X (ι : Type*) (F : Type*) [CommRing F] (i : ι) : + translateVariables ι F (MvPolynomial.X i) = MvPolynomial.X i + 1 := by + simp [translateVariables] + +theorem exists_move_transcendental (E : Type*) [Field E] [CharZero E] [IsAlgClosed E] + {x : E} (hx : Transcendental ℚ x) : + ∃ τ : E ≃ₐ[ℚ] E, τ x ≠ x := by + classical + have hi : AlgebraicIndepOn ℚ id ({x} : Set E) := + (algebraicIndependent_singleton_iff (⟨x, rfl⟩ : ({x} : Set E))).mpr hx + obtain ⟨s, hxs, hs⟩ := exists_isTranscendenceBasis_superset hi + let v : s → E := Subtype.val + let j : s := ⟨x, hxs rfl⟩ + let A := Algebra.adjoin ℚ (Set.range v) + let e : MvPolynomial s ℚ ≃ₐ[ℚ] A := hs.1.aevalEquiv + let α : A ≃+* A := e.symm.toRingEquiv.trans + ((translateVariables s ℚ).toRingEquiv.trans e.toRingEquiv) + let : IsAlgClosure A E := IsAlgClosed.isAlgClosure_of_transcendence_basis v hs + let τ : E ≃+* E := IsAlgClosure.equivOfEquiv E E α + have hej : algebraMap A E (e (MvPolynomial.X j)) = x := by + change MvPolynomial.aeval v (MvPolynomial.X j) = x + simp [v, j] + have hτ : τ x = x + 1 := by + calc + τ x = τ (algebraMap A E (e (MvPolynomial.X j))) := by rw [hej] + _ = algebraMap A E (α (e (MvPolynomial.X j))) := + IsAlgClosure.equivOfEquiv_algebraMap E E α _ + _ = x + 1 := by + have heα (p : MvPolynomial s ℚ) : α (e p) = e (translateVariables s ℚ p) := by + simp [α] + rw [heα] + change algebraMap A E (e (translateVariables s ℚ (MvPolynomial.X j))) = _ + rw [translateVariables_X, map_add, map_one, map_add, map_one, hej] + refine ⟨τ.toRatAlgEquiv, ?_⟩ + change τ x ≠ x + rw [hτ] + simp + +theorem fixedField_rat (E : Type*) [Field E] [CharZero E] [IsAlgClosed E] + (x : E) (hx : ∀ σ : E ≃ₐ[ℚ] E, σ x = x) : + ∃ q : ℚ, algebraMap ℚ E q = x := by + classical + by_cases halg : IsAlgebraic ℚ x + · let F := algebraicClosure ℚ E + let : IsAlgClosure ℚ F := algebraicClosure.isAlgClosure ℚ E + let y : F := ⟨x, mem_algebraicClosure_iff.mpr halg⟩ + have hy : ∀ σ : F ≃ₐ[ℚ] F, σ y = y := by + intro σ + obtain ⟨τ, hτ⟩ := exists_extension_ringAut F E σ.toRingEquiv + apply (algebraMap F E).injective + exact (hτ y).symm.trans (hx τ.toRatAlgEquiv) + obtain ⟨q, hq⟩ := (InfiniteGalois.mem_range_algebraMap_iff_fixed y).mpr hy + refine ⟨q, ?_⟩ + have heq := congrArg (algebraMap F E) hq + rw [← IsScalarTower.algebraMap_apply ℚ F E] at heq + exact heq + · obtain ⟨σ, hσ⟩ := exists_move_transcendental E halg + exact False.elim (hσ (hx σ)) + +variable {k K I : Type*} [Field k] [Field K] [Algebra k K] + +def coefficientInclusion : (I →₀ k) →ₗ[k] (I →₀ K) := + Finsupp.mapRange.linearMap (Algebra.linearMap k K) + +@[simp] theorem coefficientInclusion_apply (f : I →₀ k) (i : I) : + coefficientInclusion (K := K) f i = algebraMap k K (f i) := rfl + +def coefficientIntersection (W : Submodule K (I →₀ K)) : Submodule k (I →₀ k) := + (W.restrictScalars k).comap coefficientInclusion + +@[simp] theorem mem_coefficientIntersection (W : Submodule K (I →₀ K)) (f : I →₀ k) : + f ∈ coefficientIntersection (k := k) W ↔ coefficientInclusion f ∈ W := Iff.rfl + +theorem coefficientInclusion_injective : + Function.Injective (coefficientInclusion (k := k) (K := K) (I := I)) := by + intro f g h + ext i + apply (algebraMap k K).injective + exact congrArg (fun v : I →₀ K => v i) h + +def ambientIntersection (W : Submodule K (I →₀ K)) : Submodule k (I →₀ K) := + LinearMap.range (coefficientInclusion (k := k)) ⊓ W.restrictScalars k + +def intersectionToAmbient (W : Submodule K (I →₀ K)) : + coefficientIntersection (k := k) W →ₗ[k] ambientIntersection (k := k) W := + (coefficientInclusion.comp (coefficientIntersection W).subtype).codRestrict + (ambientIntersection W) (fun q => ⟨⟨q.val, rfl⟩, q.property⟩) + +@[simp] theorem intersectionToAmbient_apply (W : Submodule K (I →₀ K)) + (q : coefficientIntersection (k := k) W) : + (intersectionToAmbient W q : I →₀ K) = coefficientInclusion q.val := rfl + +def intersectionEquiv (W : Submodule K (I →₀ K)) : + coefficientIntersection (k := k) W ≃ₗ[k] ambientIntersection (k := k) W := + LinearEquiv.ofBijective (intersectionToAmbient W) (by + constructor + · intro x y h + apply Subtype.ext + apply coefficientInclusion_injective (K := K) + exact congrArg Subtype.val h + · rintro ⟨v, ⟨⟨q, hq⟩, hv⟩⟩ + have hqW : q ∈ coefficientIntersection (k := k) W := by + rw [mem_coefficientIntersection, hq] + exact hv + exact ⟨⟨q, hqW⟩, Subtype.ext hq⟩) + +@[simp] theorem intersectionEquiv_apply (W : Submodule K (I →₀ K)) + (q : coefficientIntersection (k := k) W) : + (intersectionEquiv W q : I →₀ K) = coefficientInclusion q.val := rfl + +def coefficientAction (σ : K ≃ₐ[k] K) : + (I →₀ K) ≃ₗ[k] (I →₀ K) := + Finsupp.mapRange.linearEquiv σ.toLinearEquiv + +@[simp] theorem coefficientAction_apply (σ : K ≃ₐ[k] K) (f : I →₀ K) (i : I) : + coefficientAction σ f i = σ (f i) := rfl + +def CoefficientStable (W : Submodule K (I →₀ K)) : Prop := + ∀ (σ : K ≃ₐ[k] K) (f : I →₀ K), f ∈ W → coefficientAction σ f ∈ W + +private theorem elimination_support {f g : I →₀ K} {i : I} (hgi : g i ≠ 0) + (hgf : g.support ⊆ f.support) : + (f - (f i / g i) • g).support ⊆ f.support.erase i := by + classical + intro j hj + rw [Finset.mem_erase] + have hj' : (f - (f i / g i) • g) j ≠ 0 := Finsupp.mem_support_iff.mp hj + constructor + · intro hji + subst j + simp [div_mul_cancel₀ _ hgi] at hj' + · by_contra hjf + have hg : j ∉ g.support := fun h => hjf (hgf h) + exact hj' (by simp [Finsupp.notMem_support_iff.mp hjf, + Finsupp.notMem_support_iff.mp hg]) + +private theorem minimal_support_fixed (W : Submodule K (I →₀ K)) + (hW : CoefficientStable (k := k) W) {g : I →₀ K} (hgW : g ∈ W) + (hmin : ∀ f : I →₀ K, f ∈ W → f ≠ 0 → f.support ⊆ g.support → + g.support.card ≤ f.support.card) + {i : I} (hgi : g i ≠ 0) (σ : K ≃ₐ[k] K) : + coefficientAction σ ((g i)⁻¹ • g) = (g i)⁻¹ • g := by + classical + let v : I →₀ K := (g i)⁻¹ • g + have hvi : v i = 1 := by simp [v, hgi] + have hvW : v ∈ W := W.smul_mem _ hgW + let d : I →₀ K := coefficientAction σ v - v + have hdW : d ∈ W := W.sub_mem (hW σ v hvW) hvW + have hd : d.support ⊆ g.support.erase i := by + intro j hj + rw [Finset.mem_erase] + have hj' : d j ≠ 0 := Finsupp.mem_support_iff.mp hj + constructor + · intro hji + subst j + simp [d, hvi] at hj' + · by_contra hjg + have hvj : v j = 0 := by simp [v, Finsupp.notMem_support_iff.mp hjg] + exact hj' (by simp [d, hvj]) + have hdz : d = 0 := by + by_contra hdne + have hle := hmin d hdW hdne (hd.trans (Finset.erase_subset _ _)) + have hlt : (g.support.erase i).card < g.support.card := + Finset.card_erase_lt_of_mem (Finsupp.mem_support_iff.mpr hgi) + exact (Nat.not_lt_of_ge hle) ((Finset.card_le_card hd).trans_lt hlt) + exact sub_eq_zero.mp hdz + +theorem span_fixedVectors (W : Submodule K (I →₀ K)) + (hW : CoefficientStable (k := k) W) : + Submodule.span K {f : I →₀ K | f ∈ W ∧ + ∀ σ : K ≃ₐ[k] K, coefficientAction σ f = f} = W := by + classical + apply le_antisymm + · apply Submodule.span_le.mpr + intro f hf + exact hf.1 + · intro f hf + suffices aux : ∀ (n : ℕ) (f : I →₀ K), f.support.card = n → f ∈ W → + f ∈ Submodule.span K {g : I →₀ K | g ∈ W ∧ + ∀ σ : K ≃ₐ[k] K, coefficientAction σ g = g} from + aux f.support.card f rfl hf + intro n + induction n using Nat.strong_induction_on with + | h n ih => + intro f hcard hf + by_cases hfz : f = 0 + · subst f + exact Submodule.zero_mem _ + have hex : ∃ m : ℕ, ∃ g : I →₀ K, + g ∈ W ∧ g ≠ 0 ∧ g.support ⊆ f.support ∧ g.support.card = m := + ⟨f.support.card, f, hf, hfz, Finset.Subset.refl _, rfl⟩ + obtain ⟨g, hgW, hgne, hgf, hgcard⟩ := Nat.find_spec hex + have hmin : ∀ v : I →₀ K, v ∈ W → v ≠ 0 → v.support ⊆ g.support → + g.support.card ≤ v.support.card := by + intro v hvW hvz hvg + rw [hgcard] + exact Nat.find_min' hex ⟨v, hvW, hvz, hvg.trans hgf, rfl⟩ + obtain ⟨i, hgi⟩ := Finsupp.support_nonempty_iff.mpr hgne + have hgi' : g i ≠ 0 := Finsupp.mem_support_iff.mp hgi + have hnorm : (g i)⁻¹ • g ∈ Submodule.span K {g : I →₀ K | g ∈ W ∧ + ∀ σ : K ≃ₐ[k] K, coefficientAction σ g = g} := + Submodule.subset_span ⟨W.smul_mem _ hgW, fun σ => + minimal_support_fixed W hW hgW hmin hgi' σ⟩ + have hgspan : g ∈ Submodule.span K {g : I →₀ K | g ∈ W ∧ + ∀ σ : K ≃ₐ[k] K, coefficientAction σ g = g} := by + simpa [smul_smul, hgi'] using + (Submodule.smul_mem _ (g i) hnorm) + have hdf := elimination_support hgi' hgf + have hlt : (f - (f i / g i) • g).support.card < n := by + rw [← hcard] + exact (Finset.card_le_card hdf).trans_lt + (Finset.card_erase_lt_of_mem (hgf hgi)) + have hsub := ih _ hlt _ rfl (W.sub_mem hf (W.smul_mem _ hgW)) + convert Submodule.add_mem _ hsub (Submodule.smul_mem _ (f i / g i) hgspan) using 1 + exact (sub_add_cancel _ _).symm + +theorem exists_preimage_coefficientInclusion {f : I →₀ K} + (hf : ∀ i, ∃ a : k, algebraMap k K a = f i) : + ∃ q : I →₀ k, coefficientInclusion q = f := by + classical + choose q hq using hf + have hqfin : ∀ i, q i ≠ 0 → i ∈ f.support := by + intro i hi + apply Finsupp.mem_support_iff.mpr + rw [← hq] + simpa using (algebraMap k K).injective.ne hi + refine ⟨Finsupp.onFinset f.support q hqfin, ?_⟩ + ext i + exact hq i + +def intersectionInclusion (W : Submodule K (I →₀ K)) : + coefficientIntersection (k := k) W →ₗ[k] W := + ((coefficientInclusion (k := k) (K := K) (I := I)).comp + (coefficientIntersection W).subtype).codRestrict (W.restrictScalars k) + (fun f => f.property) + +def naturalMap (W : Submodule K (I →₀ K)) : + K ⊗[k] coefficientIntersection (k := k) W →ₗ[K] W := + (intersectionInclusion W).liftBaseChange K + +@[simp] theorem naturalMap_tmul (W : Submodule K (I →₀ K)) (a : K) + (q : coefficientIntersection (k := k) W) : + (naturalMap W (a ⊗ₜ[k] q) : I →₀ K) = a • coefficientInclusion q.val := rfl + +def ambientIntersectionInclusion (W : Submodule K (I →₀ K)) : + ambientIntersection (k := k) W →ₗ[k] W := + (ambientIntersection W).subtype.codRestrict (W.restrictScalars k) + (fun x => x.property.2) + +def ambientNaturalMap (W : Submodule K (I →₀ K)) : + K ⊗[k] ambientIntersection (k := k) W →ₗ[K] W := + (ambientIntersectionInclusion W).liftBaseChange K + +@[simp] theorem ambientNaturalMap_tmul (W : Submodule K (I →₀ K)) (a : K) + (q : ambientIntersection (k := k) W) : + (ambientNaturalMap W (a ⊗ₜ[k] q) : I →₀ K) = a • q.val := rfl + +theorem naturalMap_eq_ambientNaturalMap (W : Submodule K (I →₀ K)) + (z : K ⊗[k] coefficientIntersection (k := k) W) : + ambientNaturalMap W ((intersectionEquiv W).baseChange k K _ _ z) = + naturalMap W z := by + induction z using TensorProduct.inductionOn with + | tmul a q => rfl + | add x y hx hy => simp [hx, hy] + +theorem subtype_naturalMap (W : Submodule K (I →₀ K)) + (z : K ⊗[k] coefficientIntersection (k := k) W) : + (naturalMap W z : I →₀ K) = + TensorProduct.finsuppScalarRight k K K I + ((coefficientIntersection (k := k) W).subtype.lTensor K z) := by + induction z using TensorProduct.inductionOn with + | tmul a q => + ext i + simp [Algebra.smul_def, mul_comm] + | add x y hx hy => simp [hx, hy] + +theorem naturalMap_injective (W : Submodule K (I →₀ K)) : + Function.Injective (naturalMap (k := k) W) := by + intro x y hxy + apply Module.Flat.lTensor_preserves_injective_linearMap + (M := K) (coefficientIntersection (k := k) W).subtype + (coefficientIntersection W).injective_subtype + apply (TensorProduct.finsuppScalarRight k K K I).injective + rw [← subtype_naturalMap, ← subtype_naturalMap, hxy] + +theorem naturalMap_bijective_of_fixedField + (hfixed : ∀ a : K, (∀ σ : K ≃ₐ[k] K, σ a = a) → + ∃ b : k, algebraMap k K b = a) + (W : Submodule K (I →₀ K)) (hW : CoefficientStable (k := k) W) : + Function.Bijective (naturalMap (k := k) W) := by + refine ⟨naturalMap_injective W, ?_⟩ + have hspan : W ≤ LinearMap.range (W.subtype.comp (naturalMap (k := k) W)) := by + nth_rw 1 [← span_fixedVectors W hW] + apply Submodule.span_le.mpr + rintro f ⟨hfW, hf⟩ + have hcoeff : ∀ i, ∃ a : k, algebraMap k K a = f i := by + intro i + apply hfixed + intro σ + exact congrArg (fun g : I →₀ K => g i) (hf σ) + obtain ⟨q, hq⟩ := exists_preimage_coefficientInclusion hcoeff + have hqW : q ∈ coefficientIntersection (k := k) W := by + rw [mem_coefficientIntersection, hq] + exact hfW + refine ⟨1 ⊗ₜ[k] (⟨q, hqW⟩ : coefficientIntersection (k := k) W), ?_⟩ + simpa only [LinearMap.comp_apply, Submodule.subtype_apply, + naturalMap_tmul, one_smul] using hq + intro f + obtain ⟨z, hz⟩ := hspan f.property + exact ⟨z, Subtype.ext hz⟩ + +def naturalEquiv_of_fixedField + (hfixed : ∀ a : K, (∀ σ : K ≃ₐ[k] K, σ a = a) → + ∃ b : k, algebraMap k K b = a) + (W : Submodule K (I →₀ K)) (hW : CoefficientStable (k := k) W) : + K ⊗[k] coefficientIntersection (k := k) W ≃ₗ[K] W := + LinearEquiv.ofBijective (naturalMap W) + (naturalMap_bijective_of_fixedField hfixed W hW) + +theorem rational_descent (E : Type*) [Field E] [CharZero E] [IsAlgClosed E] + (W : Submodule E (I →₀ E)) (hW : CoefficientStable (k := ℚ) W) : + Function.Bijective (naturalMap (k := ℚ) W) := + naturalMap_bijective_of_fixedField (fixedField_rat E) W hW + +def rationalDescentEquiv (E : Type*) [Field E] [CharZero E] [IsAlgClosed E] + (W : Submodule E (I →₀ E)) (hW : CoefficientStable (k := ℚ) W) : + E ⊗[ℚ] coefficientIntersection (k := ℚ) W ≃ₗ[E] W := + LinearEquiv.ofBijective (naturalMap W) (rational_descent E W hW) + +@[simp] theorem rationalDescentEquiv_apply + (E : Type*) [Field E] [CharZero E] [IsAlgClosed E] + (W : Submodule E (I →₀ E)) (hW : CoefficientStable (k := ℚ) W) + (z : E ⊗[ℚ] coefficientIntersection (k := ℚ) W) : + rationalDescentEquiv E W hW z = naturalMap (k := ℚ) W z := rfl + +@[simp] theorem rationalDescentEquiv_tmul + (E : Type*) [Field E] [CharZero E] [IsAlgClosed E] + (W : Submodule E (I →₀ E)) (hW : CoefficientStable (k := ℚ) W) + (a : E) (q : coefficientIntersection (k := ℚ) W) : + (rationalDescentEquiv E W hW (a ⊗ₜ[ℚ] q) : I →₀ E) = + a • coefficientInclusion q.val := rfl + +def ambientRationalDescentEquiv + (E : Type*) [Field E] [CharZero E] [IsAlgClosed E] + (W : Submodule E (I →₀ E)) (hW : CoefficientStable (k := ℚ) W) : + E ⊗[ℚ] ambientIntersection (k := ℚ) W ≃ₗ[E] W := + ((intersectionEquiv W).baseChange ℚ E _ _).symm.trans (rationalDescentEquiv E W hW) + +@[simp] theorem ambientRationalDescentEquiv_apply + (E : Type*) [Field E] [CharZero E] [IsAlgClosed E] + (W : Submodule E (I →₀ E)) (hW : CoefficientStable (k := ℚ) W) + (z : E ⊗[ℚ] ambientIntersection (k := ℚ) W) : + ambientRationalDescentEquiv E W hW z = ambientNaturalMap (k := ℚ) W z := by + change naturalMap W (((intersectionEquiv W).baseChange ℚ E _ _).symm z) = _ + rw [← naturalMap_eq_ambientNaturalMap] + simp + +theorem ambient_rational_descent + (E : Type*) [Field E] [CharZero E] [IsAlgClosed E] + (W : Submodule E (I →₀ E)) (hW : CoefficientStable (k := ℚ) W) : + Function.Bijective (ambientNaturalMap (k := ℚ) W) := by + have heq : (ambientRationalDescentEquiv E W hW : + E ⊗[ℚ] ambientIntersection (k := ℚ) W → W) = ambientNaturalMap W := by + funext z + exact ambientRationalDescentEquiv_apply E W hW z + rw [← heq] + exact (ambientRationalDescentEquiv E W hW).bijective + +end ArthurLinearDescent + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/Hadamard/Basic.lean b/lean/OAI/LinearAlgebra/Hadamard/Basic.lean new file mode 100644 index 0000000000000000000000000000000000000000..569794b17887ff8eee3fa68f8b1af9cef8653254 --- /dev/null +++ b/lean/OAI/LinearAlgebra/Hadamard/Basic.lean @@ -0,0 +1,122 @@ +import Mathlib + +namespace OAI + +/-! Unit entries, orthogonality, characters and the cubic matrix. -/ + +open scoped BigOperators Matrix + +namespace HadamardSix + +abbrev Index := Fin 6 +abbrev Matrix6 := Matrix Index Index ℂ +abbrev Charge := Index → ℤ + +def Unimodular (H : Matrix6) : Prop := ∀ i j, ‖H i j‖ = 1 + +def IsComplexHadamard (H : Matrix6) : Prop := + Unimodular H ∧ H.conjTranspose * H = (6 : ℂ) • (1 : Matrix6) + +def HadamardEquivalent (H K : Matrix6) : Prop := + ∃ (r c : Equiv.Perm Index) (u v : Index → ℂ), + (∀ i, ‖u i‖ = 1) ∧ (∀ j, ‖v j‖ = 1) ∧ + ∀ i j, K i j = u i * H (r i) (c j) * v j + +def Balanced (a : Charge) : Prop := ∑ i, a i = 0 + +noncomputable def character (x : Index → ℂ) (a : Charge) : ℂ := + ∏ i, x i ^ a i + +noncomputable def g (H : Matrix6) (a : Charge) : ℂ := + (6 : ℂ)⁻¹ * ∑ k, character (fun i => H i k) a + +def permuteCharge (p : Equiv.Perm Index) (a : Charge) : Charge := fun i => a (p i) + +def alpha : Charge := ![1, 1, 1, -1, -1, -1] + +noncomputable def omega : ℂ := Complex.exp (2 * (Real.pi : ℂ) * Complex.I / 3) + +def taoExponent (i j : Index) : ℤ := + if i = 0 ∨ j = 0 ∨ i = j then 0 + else if ((i.val : ℤ) - (j.val : ℤ)) % 5 = 1 ∨ + ((i.val : ℤ) - (j.val : ℤ)) % 5 = 4 then 1 + else -1 + +noncomputable def taoMatrix : Matrix6 := fun i j => omega ^ taoExponent i j + +lemma unit_ne_zero {z : ℂ} (hz : ‖z‖ = 1) : z ≠ 0 := by + intro h + simp [h] at hz + +lemma unit_mul_star {z : ℂ} (hz : ‖z‖ = 1) : z * star z = 1 := by + rw [Complex.star_def, Complex.mul_conj, Complex.normSq_eq_norm_sq, hz] + norm_num + +lemma unit_star_mul {z : ℂ} (hz : ‖z‖ = 1) : star z * z = 1 := by + rw [mul_comm] + exact unit_mul_star hz + +lemma unit_inv {z : ℂ} (hz : ‖z‖ = 1) : z⁻¹ = star z := by + apply inv_eq_of_mul_eq_one_right + exact unit_mul_star hz + +lemma Unimodular.entry_ne_zero {H : Matrix6} (hH : Unimodular H) (i j : Index) : + H i j ≠ 0 := unit_ne_zero (hH i j) + +lemma IsComplexHadamard.unimodular {H : Matrix6} (hH : IsComplexHadamard H) : + Unimodular H := hH.1 + +lemma IsComplexHadamard.mul_conjTranspose {H : Matrix6} (hH : IsComplexHadamard H) : + H * H.conjTranspose = (6 : ℂ) • (1 : Matrix6) := by + have hleft : ((6 : ℂ)⁻¹ • H.conjTranspose) * H = 1 := by + rw [Matrix.smul_mul, hH.2, smul_smul] + norm_num + have hright := mul_eq_one_comm.mp hleft + rw [Matrix.mul_smul] at hright + have h := congrArg (fun K : Matrix6 => (6 : ℂ) • K) hright + simpa only [smul_smul, mul_inv_cancel₀ (by norm_num : (6 : ℂ) ≠ 0), one_smul] using h + +lemma IsComplexHadamard.column_orthogonality {H : Matrix6} (hH : IsComplexHadamard H) + (j k : Index) : + ∑ i, star (H i j) * H i k = if j = k then 6 else 0 := by + have h := congr_fun (congr_fun hH.2 j) k + simpa [Matrix.mul_apply, Matrix.one_apply, Matrix.smul_apply] using h + +lemma IsComplexHadamard.row_orthogonality {H : Matrix6} (hH : IsComplexHadamard H) + (i j : Index) : + ∑ k, H i k * star (H j k) = if i = j then 6 else 0 := by + have h := congr_fun (congr_fun hH.mul_conjTranspose i) j + simpa [Matrix.mul_apply, Matrix.one_apply, Matrix.smul_apply] using h + +lemma isComplexHadamard_of_rows {H : Matrix6} (hu : Unimodular H) + (hr : ∀ i j, ∑ k, H i k * star (H j k) = if i = j then 6 else 0) : + IsComplexHadamard H := by + have heq : H * H.conjTranspose = (6 : ℂ) • (1 : Matrix6) := by + ext i j + simpa [Matrix.mul_apply, Matrix.one_apply, Matrix.smul_apply] using hr i j + have hleft : H * ((6 : ℂ)⁻¹ • H.conjTranspose) = 1 := by + rw [Matrix.mul_smul, heq, smul_smul] + norm_num + have hright := mul_eq_one_comm.mp hleft + rw [Matrix.smul_mul] at hright + have h := congrArg (fun K : Matrix6 => (6 : ℂ) • K) hright + refine ⟨hu, ?_⟩ + simpa only [smul_smul, mul_inv_cancel₀ (by norm_num : (6 : ℂ) ≠ 0), one_smul] using h + +lemma IsComplexHadamard.transpose {H : Matrix6} (hH : IsComplexHadamard H) : + IsComplexHadamard H.transpose := by + refine isComplexHadamard_of_rows (fun i j => hH.1 j i) ?_ + intro i j + simpa [mul_comm, eq_comm] using hH.column_orthogonality j i + +lemma IsComplexHadamard.conjugate {H : Matrix6} (hH : IsComplexHadamard H) : + IsComplexHadamard (fun i j => star (H i j)) := by + refine isComplexHadamard_of_rows (fun i j => by simpa using hH.1 i j) ?_ + intro i j + have h := congrArg star (hH.row_orthogonality i j) + simpa only [star_sum, star_mul, star_star, apply_ite star, star_ofNat, star_zero, mul_comm] + using h + +end HadamardSix + +end OAI diff --git a/lean/OAI/LinearAlgebra/Hadamard/CubeFibers.lean b/lean/OAI/LinearAlgebra/Hadamard/CubeFibers.lean new file mode 100644 index 0000000000000000000000000000000000000000..bca9eee495054610dd221ca08e874fd9d215a5a5 --- /dev/null +++ b/lean/OAI/LinearAlgebra/Hadamard/CubeFibers.lean @@ -0,0 +1,182 @@ +import OAI.LinearAlgebra.Hadamard.Polynomials + +namespace OAI + +/-! Cubic values, their multiplicities, and cancellation on each fibre. -/ + +open scoped BigOperators Matrix + +namespace HadamardSix + +noncomputable def cubeFiber (v : Index → ℂ) (z : ℂ) : Finset Index := by + classical + exact Finset.univ.filter (fun i => v i ^ 3 = z) + +@[simp] lemma mem_cubeFiber (v : Index → ℂ) (z : ℂ) (i : Index) : + i ∈ cubeFiber v z ↔ v i ^ 3 = z := by + classical + simp [cubeFiber] + +lemma sum_cubes_of_two_values (v : Index → ℂ) (a b : ℂ) + (hab : ∀ i, v i ^ 3 = a ∨ v i ^ 3 = b) : + (∑ i, v i ^ 3) = (cubeFiber v a).card * a + + (6 - ((cubeFiber v a).card : ℂ)) * b := by + classical + have hfirst : (∑ i ∈ cubeFiber v a, v i ^ 3) = (cubeFiber v a).card * a := by + calc + _ = ∑ _i ∈ cubeFiber v a, a := Finset.sum_congr rfl (fun i hi => (mem_cubeFiber v a i).mp hi) + _ = _ := by rw [Finset.sum_const, nsmul_eq_mul] + have hlast : (∑ i ∈ (cubeFiber v a)ᶜ, v i ^ 3) = ((cubeFiber v a)ᶜ).card * b := by + calc + _ = ∑ _i ∈ (cubeFiber v a)ᶜ, b := by + apply Finset.sum_congr rfl + intro i hi + exact (hab i).resolve_left (by simpa using hi) + _ = _ := by rw [Finset.sum_const, nsmul_eq_mul] + have hle : (cubeFiber v a).card ≤ 6 := + (Finset.card_le_card (Finset.subset_univ (cubeFiber v a))) + rw [← Finset.sum_add_sum_compl (cubeFiber v a), hfirst, hlast, + Finset.card_compl, Fintype.card_fin, Nat.cast_sub hle, Nat.cast_ofNat] + +lemma cubeFiber_card_three (v : Index → ℂ) (a b : ℂ) (hne : a ≠ b) + (hab : ∀ i, v i ^ 3 = a ∨ v i ^ 3 = b) + (hsum : ∑ i, v i ^ 3 = 3 * (a + b)) : (cubeFiber v a).card = 3 := by + have hprod : (((cubeFiber v a).card : ℂ) - 3) * (a - b) = 0 := by + linear_combination hsum - sum_cubes_of_two_values v a b hab + have hcast : ((cubeFiber v a).card : ℂ) = 3 := + sub_eq_zero.mp ((mul_eq_zero.mp hprod).resolve_right (sub_ne_zero.mpr hne)) + exact_mod_cast hcast + +lemma ratio_cube_multiplicities (v : Index → ℂ) (hv : ∀ i, ‖v i‖ = 1) + (h1 : ∑ i, v i = 0) (h2 : ∑ i, v i ^ 2 = 0) : + (∀ i, v i ^ 3 = v 0 ^ 3) ∨ + ∃ b : ℂ, b ≠ v 0 ^ 3 ∧ (∀ i, v i ^ 3 = v 0 ^ 3 ∨ v i ^ 3 = b) ∧ + (cubeFiber v (v 0 ^ 3)).card = 3 ∧ (cubeFiber v b).card = 3 := by + let a := v 0 ^ 3 + let b := elementary v 3 - a + have hab (i : Index) : v i ^ 3 = a ∨ v i ^ 3 = b := + ratio_cubes_two_values v hv h1 h2 i + by_cases heq : a = b + · left + intro i + exact (hab i).elim id (fun hi => hi.trans heq.symm) + · right + have hsum : ∑ i, v i ^ 3 = 3 * (a + b) := by + rw [← three_mul_elementary_three v h1 h2] + dsimp [b] + ring + refine ⟨b, Ne.symm heq, hab, cubeFiber_card_three v a b heq hab hsum, ?_⟩ + exact cubeFiber_card_three v b a (Ne.symm heq) (fun i => (hab i).symm) + (by simpa only [add_comm] using hsum) + +lemma ratio_cubeFiber_sum_zero (v : Index → ℂ) (hv : ∀ i, ‖v i‖ = 1) + (h1 : ∑ i, v i = 0) (h2 : ∑ i, v i ^ 2 = 0) + (a b : ℂ) (hne : a ≠ b) (hab : ∀ i, v i ^ 3 = a ∨ v i ^ 3 = b) : + ∑ i ∈ cubeFiber v a, v i = 0 := by + classical + have hf : (∑ i ∈ cubeFiber v a, v i ^ 4) = a * ∑ i ∈ cubeFiber v a, v i := by + rw [Finset.mul_sum] + apply Finset.sum_congr rfl + intro i hi + rw [← (mem_cubeFiber v a i).mp hi] + ring + have hl : (∑ i ∈ (cubeFiber v a)ᶜ, v i ^ 4) = b * ∑ i ∈ (cubeFiber v a)ᶜ, v i := by + rw [Finset.mul_sum] + apply Finset.sum_congr rfl + intro i hi + rw [← (hab i).resolve_left (by simpa using hi)] + ring + have h4 := fourth_power_sum_zero v hv h1 h2 + rw [← Finset.sum_add_sum_compl (cubeFiber v a), hf, hl] at h4 + rw [← Finset.sum_add_sum_compl (cubeFiber v a)] at h1 + have he : (a - b) * ∑ i ∈ cubeFiber v a, v i = 0 := by + linear_combination h4 - b * h1 + exact (mul_eq_zero.mp he).resolve_left (sub_ne_zero.mpr hne) + +noncomputable def rowRatio (H : Matrix6) (i j : Index) : Index → ℂ := + fun k => H i k * star (H j k) + +lemma rowRatio_norm {H : Matrix6} (hu : Unimodular H) (i j k : Index) : + ‖rowRatio H i j k‖ = 1 := by simp [rowRatio, hu i k, hu j k] + +lemma rowRatio_first_sum {H : Matrix6} (hH : IsComplexHadamard H) + {i j : Index} (hij : i ≠ j) : ∑ k, rowRatio H i j k = 0 := by + simpa only [rowRatio, ite_eq_right hij] using hH.row_orthogonality i j + +lemma rowRatio_second_sum {H : Matrix6} (hs : IsComplexHadamard (entrywiseSquare H)) + {i j : Index} (hij : i ≠ j) : ∑ k, rowRatio H i j k ^ 2 = 0 := by + simpa only [rowRatio, entrywiseSquare, mul_pow, star_pow, ite_eq_right hij] + using hs.row_orthogonality i j + +lemma rowRatio_polynomial {H : Matrix6} (hH : IsComplexHadamard H) + (hs : IsComplexHadamard (entrywiseSquare H)) {i j : Index} (hij : i ≠ j) : + ratioPolynomial (rowRatio H i j) = Polynomial.X ^ 6 - + Polynomial.C (elementary (rowRatio H i j) 3) * Polynomial.X ^ 3 + + Polynomial.C (elementary (rowRatio H i j) 6) := + ratioPolynomial_of_power_sums (rowRatio H i j) (rowRatio_norm hH.1 i j) + (rowRatio_first_sum hH hij) (rowRatio_second_sum hs hij) + +lemma rowRatio_cube_multiplicities {H : Matrix6} (hH : IsComplexHadamard H) + (hs : IsComplexHadamard (entrywiseSquare H)) {i j : Index} (hij : i ≠ j) : + (∀ k, rowRatio H i j k ^ 3 = rowRatio H i j 0 ^ 3) ∨ + ∃ b : ℂ, b ≠ rowRatio H i j 0 ^ 3 ∧ + (∀ k, rowRatio H i j k ^ 3 = rowRatio H i j 0 ^ 3 ∨ rowRatio H i j k ^ 3 = b) ∧ + (cubeFiber (rowRatio H i j) (rowRatio H i j 0 ^ 3)).card = 3 ∧ + (cubeFiber (rowRatio H i j) b).card = 3 := + ratio_cube_multiplicities (rowRatio H i j) (rowRatio_norm hH.1 i j) + (rowRatio_first_sum hH hij) (rowRatio_second_sum hs hij) + +def IsDephased (H : Matrix6) : Prop := (∀ j, H 0 j = 1) ∧ (∀ i, H i 0 = 1) + +lemma dephase_isDephased {H : Matrix6} (hH : Unimodular H) : IsDephased (dephase H) := + ⟨dephase_first_row hH, dephase_first_column hH⟩ + +lemma dephased_row_cube_multiplicities {H : Matrix6} (hH : IsComplexHadamard H) + (hs : IsComplexHadamard (entrywiseSquare H)) (hd : IsDephased H) (i : Index) : + (∀ k, H i k ^ 3 = 1) ∨ + ∃ x : ℂ, x ≠ 1 ∧ (∀ k, H i k ^ 3 = 1 ∨ H i k ^ 3 = x) ∧ + (cubeFiber (H i) 1).card = 3 ∧ (cubeFiber (H i) x).card = 3 := by + by_cases hi : i = 0 + · subst i + exact Or.inl (fun k => by rw [hd.1, one_pow]) + · have hr := rowRatio_cube_multiplicities hH hs hi + have heq : rowRatio H i 0 = H i := by + funext k + simp only [rowRatio, hd.1, star_one, mul_one] + rw [heq] at hr + simpa only [hd.2, one_pow] using hr + +lemma dephased_column_cube_multiplicities {H : Matrix6} (hH : IsComplexHadamard H) + (hs : IsComplexHadamard (entrywiseSquare H)) (hd : IsDephased H) (j : Index) : + (∀ i, H i j ^ 3 = 1) ∨ + ∃ x : ℂ, x ≠ 1 ∧ (∀ i, H i j ^ 3 = 1 ∨ H i j ^ 3 = x) ∧ + (cubeFiber (fun i => H i j) 1).card = 3 ∧ + (cubeFiber (fun i => H i j) x).card = 3 := by + have hsT : IsComplexHadamard (entrywiseSquare H.transpose) := hs.transpose + exact dephased_row_cube_multiplicities hH.transpose hsT ⟨hd.2, hd.1⟩ j + +lemma dephased_row_cube_support {H : Matrix6} (hH : IsComplexHadamard H) + (hs : IsComplexHadamard (entrywiseSquare H)) (hd : IsDephased H) + (i : Index) (hn : ¬ ∀ k, H i k ^ 3 = 1) : + ∃ (S : Finset Index) (x : ℂ), S.card = 3 ∧ 0 ∉ S ∧ x ≠ 1 ∧ + ∀ k, H i k ^ 3 = if k ∈ S then x else 1 := by + classical + obtain ⟨x, hx, hc, _, hsx⟩ := (dephased_row_cube_multiplicities hH hs hd i).resolve_left hn + refine ⟨cubeFiber (H i) x, x, hsx, ?_, hx, ?_⟩ + · simpa only [mem_cubeFiber, hd.2, one_pow, ne_eq, eq_comm] using hx + · intro k + split_ifs with hk + · exact (mem_cubeFiber (H i) x k).mp hk + · exact (hc k).resolve_right ((mem_cubeFiber (H i) x k).not.mp hk) + +lemma rowRatio_cubeFiber_sum_zero {H : Matrix6} (hH : IsComplexHadamard H) + (hs : IsComplexHadamard (entrywiseSquare H)) {i j : Index} (hij : i ≠ j) + (a b : ℂ) (hne : a ≠ b) + (hab : ∀ k, rowRatio H i j k ^ 3 = a ∨ rowRatio H i j k ^ 3 = b) : + ∑ k ∈ cubeFiber (rowRatio H i j) a, H i k * star (H j k) = 0 := + ratio_cubeFiber_sum_zero (rowRatio H i j) (rowRatio_norm hH.1 i j) + (rowRatio_first_sum hH hij) (rowRatio_second_sum hs hij) a b hne hab + +end HadamardSix + +end OAI diff --git a/lean/OAI/LinearAlgebra/Hadamard/Equivalence.lean b/lean/OAI/LinearAlgebra/Hadamard/Equivalence.lean new file mode 100644 index 0000000000000000000000000000000000000000..f3180ea3ac61be0707ceaee4ea279d5bbd300d82 --- /dev/null +++ b/lean/OAI/LinearAlgebra/Hadamard/Equivalence.lean @@ -0,0 +1,177 @@ +import OAI.LinearAlgebra.Hadamard.Fourier + +namespace OAI + +/-! Rephasing, permutation equivalence and dephasing. -/ + +open scoped BigOperators Matrix + +namespace HadamardSix + +def rephase (H : Matrix6) (u v : Index → ℂ) : Matrix6 := + fun i j => u i * H i j * v j + +lemma IsComplexHadamard.rephase {H : Matrix6} (hH : IsComplexHadamard H) + (u v : Index → ℂ) (hu : ∀ i, ‖u i‖ = 1) (hv : ∀ j, ‖v j‖ = 1) : + IsComplexHadamard (HadamardSix.rephase H u v) := by + refine isComplexHadamard_of_rows ?_ ?_ + · intro i j + simp [HadamardSix.rephase, hu, hv, hH.1 i j] + · intro i j + have hf (k : Index) : + HadamardSix.rephase H u v i k * star (HadamardSix.rephase H u v j k) = + (u i * star (u j)) * (H i k * star (H j k)) := by + calc + _ = (u i * star (u j)) * (H i k * star (H j k)) * (v k * star (v k)) := by + simp only [HadamardSix.rephase, star_mul] + ring + _ = _ := by rw [unit_mul_star (hv k), mul_one] + simp only [hf, ← Finset.mul_sum, hH.row_orthogonality i j] + by_cases hij : i = j + · subst j + rw [ite_eq_left rfl, unit_mul_star (hu i), one_mul] + · rw [ite_eq_right hij, mul_zero] + +lemma IsComplexHadamard.permute_rows {H : Matrix6} (hH : IsComplexHadamard H) + (p : Equiv.Perm Index) : IsComplexHadamard (fun i k => H (p i) k) := by + apply isComplexHadamard_of_rows (fun i j => hH.1 (p i) j) + intro i j + simpa only [Equiv.apply_eq_iff_eq] using hH.row_orthogonality (p i) (p j) + +lemma IsComplexHadamard.permute_columns {H : Matrix6} (hH : IsComplexHadamard H) + (p : Equiv.Perm Index) : IsComplexHadamard (fun i k => H i (p k)) := by + apply isComplexHadamard_of_rows (fun i j => hH.1 i (p j)) + intro i j + rw [Equiv.sum_comp p (fun k => H i k * star (H j k))] + exact hH.row_orthogonality i j + +lemma HadamardEquivalent.refl (H : Matrix6) : HadamardEquivalent H H := by + refine ⟨Equiv.refl _, Equiv.refl _, fun _ => 1, fun _ => 1, ?_, ?_, ?_⟩ <;> simp + +lemma HadamardEquivalent.symm {H K : Matrix6} (h : HadamardEquivalent H K) : + HadamardEquivalent K H := by + obtain ⟨r, c, u, v, hu, hv, he⟩ := h + refine ⟨r.symm, c.symm, fun i => (u (r.symm i))⁻¹, + fun j => (v (c.symm j))⁻¹, ?_, ?_, ?_⟩ + · intro i + simp [norm_inv, hu] + · intro j + simp [norm_inv, hv] + · intro i j + rw [he, r.apply_symm_apply, c.apply_symm_apply] + have hune := unit_ne_zero (hu (r.symm i)) + have hvne := unit_ne_zero (hv (c.symm j)) + field_simp + +lemma HadamardEquivalent.trans {H K L : Matrix6} + (hHK : HadamardEquivalent H K) (hKL : HadamardEquivalent K L) : + HadamardEquivalent H L := by + obtain ⟨r, c, u, v, hu, hv, hHK⟩ := hHK + obtain ⟨r', c', u', v', hu', hv', hKL⟩ := hKL + refine ⟨r'.trans r, c'.trans c, fun i => u' i * u (r' i), + fun j => v (c' j) * v' j, ?_, ?_, ?_⟩ + · intro i + simp [hu', hu] + · intro j + simp [hv', hv] + · intro i j + rw [hKL, hHK] + simp only [Equiv.trans_apply] + ring + +lemma HadamardEquivalent.hadamard {H K : Matrix6} (h : HadamardEquivalent H K) + (hH : IsComplexHadamard H) : IsComplexHadamard K := by + obtain ⟨r, c, u, v, hu, hv, he⟩ := h + have hK : K = rephase (fun i j => H (r i) (c j)) u v := by + ext i j + exact he i j + rw [hK] + exact ((hH.permute_rows r).permute_columns c).rephase u v hu hv + +noncomputable def dephase (H : Matrix6) : Matrix6 := + rephase H (fun i => star (H i 0)) (fun j => H 0 0 * star (H 0 j)) + +lemma dephase_equivalent {H : Matrix6} (hH : Unimodular H) : + HadamardEquivalent H (dephase H) := by + refine ⟨Equiv.refl _, Equiv.refl _, fun i => star (H i 0), + fun j => H 0 0 * star (H 0 j), ?_, ?_, ?_⟩ + · intro i + simpa using hH i 0 + · intro j + simp [hH 0 0, hH 0 j] + · intro i j + rfl + +lemma dephase_first_row {H : Matrix6} (hH : Unimodular H) (j : Index) : + dephase H 0 j = 1 := by + calc + dephase H 0 j = (star (H 0 0) * H 0 0) * (H 0 j * star (H 0 j)) := by + unfold dephase rephase + ring + _ = 1 := by rw [unit_star_mul (hH 0 0), unit_mul_star (hH 0 j), mul_one] + +lemma dephase_first_column {H : Matrix6} (hH : Unimodular H) (i : Index) : + dephase H i 0 = 1 := by + dsimp [dephase, rephase] + erw [unit_star_mul (hH i 0), unit_mul_star (hH 0 0), mul_one] + +lemma IsComplexHadamard.dephase {H : Matrix6} (hH : IsComplexHadamard H) : + IsComplexHadamard (dephase H) := (dephase_equivalent hH.1).hadamard hH + +lemma entrywiseSquare_rephase (H : Matrix6) (u v : Index → ℂ) : + entrywiseSquare (rephase H u v) = + rephase (entrywiseSquare H) (fun i => u i ^ 2) (fun j => v j ^ 2) := by + ext i j + simp [entrywiseSquare, rephase, mul_pow] + +lemma HadamardEquivalent.entrywiseSquare {H K : Matrix6} (h : HadamardEquivalent H K) : + HadamardEquivalent (entrywiseSquare H) (entrywiseSquare K) := by + obtain ⟨r, c, u, v, hu, hv, he⟩ := h + refine ⟨r, c, fun i => u i ^ 2, fun j => v j ^ 2, ?_, ?_, ?_⟩ + · intro i + simp [norm_pow, hu] + · intro j + simp [norm_pow, hv] + · intro i j + simp only [HadamardSix.entrywiseSquare, he, mul_pow] + +lemma dephase_square_hadamard {H : Matrix6} (hu : Unimodular H) + (hs : IsComplexHadamard (entrywiseSquare H)) : + IsComplexHadamard (entrywiseSquare (dephase H)) := + (dephase_equivalent hu).entrywiseSquare.hadamard hs + +lemma permuteCharge_trans (p q : Equiv.Perm Index) (a : Charge) : + permuteCharge p (permuteCharge q a) = permuteCharge (p.trans q) a := rfl + +lemma g_equivalence_covariance (H : Matrix6) {a : Charge} (ha : Balanced a) + (r c : Equiv.Perm Index) (u v : Index → ℂ) (hv : ∀ j, v j ≠ 0) : + g (fun i j => u i * H (r i) (c j) * v j) a = + character u a * g H (permuteCharge r.symm a) := by + calc + _ = g (fun i j => u i * H (r i) (c j)) a := + g_column_phases (fun i j => u i * H (r i) (c j)) ha v hv + _ = character u a * g (fun i j => H (r i) (c j)) a := + g_row_phases (fun i j => H (r i) (c j)) a u + _ = character u a * g (fun i j => H (r i) j) a := by + rw [g_permute_columns (fun i j => H (r i) j) a c] + _ = _ := by rw [g_permuteCharge]; rfl + +lemma HadamardEquivalent.fourier_vanishing_iff {H K : Matrix6} + (hHK : HadamardEquivalent H K) : + (∀ p : Equiv.Perm Index, g H (permuteCharge p alpha) = 0) ↔ + (∀ p : Equiv.Perm Index, g K (permuteCharge p alpha) = 0) := by + have himpl {M N : Matrix6} (hMN : HadamardEquivalent M N) + (hM : ∀ p : Equiv.Perm Index, g M (permuteCharge p alpha) = 0) : + ∀ p : Equiv.Perm Index, g N (permuteCharge p alpha) = 0 := by + obtain ⟨r, c, u, v, hu, hv, he⟩ := hMN + have hN : N = fun i j => u i * M (r i) (c j) * v j := by + ext i j + exact he i j + intro p + rw [hN, g_equivalence_covariance M (alpha_balanced.permute p) r c u v + (fun j => unit_ne_zero (hv j)), permuteCharge_trans, hM, mul_zero] + exact ⟨himpl hHK, himpl hHK.symm⟩ + +end HadamardSix + +end OAI diff --git a/lean/OAI/LinearAlgebra/Hadamard/Fourier.lean b/lean/OAI/LinearAlgebra/Hadamard/Fourier.lean new file mode 100644 index 0000000000000000000000000000000000000000..1fe624df345033dc9760ffee3c0a25df1dece384 --- /dev/null +++ b/lean/OAI/LinearAlgebra/Hadamard/Fourier.lean @@ -0,0 +1,169 @@ +import OAI.LinearAlgebra.Hadamard.Basic + +namespace OAI + +/-! Fourier identities and the entrywise square of a Hadamard matrix. -/ + +open scoped BigOperators Matrix + +namespace HadamardSix + +lemma alpha_balanced : Balanced alpha := by + norm_num [Balanced, alpha, Fin.sum_univ_succ] + +lemma Balanced.permute {a : Charge} (ha : Balanced a) (p : Equiv.Perm Index) : + Balanced (permuteCharge p a) := by + unfold Balanced permuteCharge + rw [Equiv.sum_comp] + exact ha + +lemma character_zero (x : Index → ℂ) : character x 0 = 1 := by + simp [character] + +lemma character_add (x : Index → ℂ) (hx : ∀ i, x i ≠ 0) (a b : Charge) : + character x (a + b) = character x a * character x b := by + simp only [character, Pi.add_apply] + simp_rw [zpow_add₀ (hx _)] + exact Finset.prod_mul_distrib + +lemma character_mul (x y : Index → ℂ) (a : Charge) : + character (fun i => x i * y i) a = character x a * character y a := by + simp only [character, mul_zpow, Finset.prod_mul_distrib] + +lemma character_perm (x : Index → ℂ) (a : Charge) (p : Equiv.Perm Index) : + character (fun i => x (p i)) (permuteCharge p a) = character x a := by + exact Equiv.prod_comp p (fun i => x i ^ a i) + +lemma character_norm (x : Index → ℂ) (hx : ∀ i, ‖x i‖ = 1) (a : Charge) : + ‖character x a‖ = 1 := by + simp [character, norm_prod, norm_zpow, hx] + +lemma character_neg (x : Index → ℂ) (hx : ∀ i, ‖x i‖ = 1) (a : Charge) : + character x (-a) = star (character x a) := by + simp only [character, Pi.neg_apply, star_prod] + apply Finset.prod_congr rfl + intro i _ + rw [zpow_neg, ← inv_zpow, unit_inv (hx i)] + exact (map_zpow₀ (starRingEnd ℂ) (x i) (a i)).symm + +lemma character_constant {z : ℂ} (hz : z ≠ 0) {a : Charge} (ha : Balanced a) : + character (fun _ => z) a = 1 := by + have hp : ∀ s : Finset Index, ∏ i ∈ s, z ^ a i = z ^ ∑ i ∈ s, a i := by + intro s + induction s using Finset.induction_on with + | empty => simp + | @insert i s hi ih => + rw [Finset.prod_insert hi, Finset.sum_insert hi, ih, zpow_add₀ hz] + calc + character (fun _ => z) a = z ^ ∑ i, a i := hp Finset.univ + _ = 1 := by rw [ha, zpow_zero] + +lemma g_zero (H : Matrix6) : g H 0 = 1 := by + norm_num [g, character_zero] + +lemma g_neg {H : Matrix6} (hH : Unimodular H) (a : Charge) : + g H (-a) = star (g H a) := by + simp only [g, character_neg _ (fun i => hH i _) a, star_mul, star_sum, + star_inv₀, star_ofNat] + ring + +lemma g_norm_le_one {H : Matrix6} (hH : Unimodular H) (a : Charge) : ‖g H a‖ ≤ 1 := by + calc + ‖g H a‖ = (6 : ℝ)⁻¹ * ‖∑ k, character (fun i => H i k) a‖ := by + simp [g] + _ ≤ (6 : ℝ)⁻¹ * ∑ k, ‖character (fun i => H i k) a‖ := by + exact mul_le_mul_of_nonneg_left (norm_sum_le _ _) (by positivity) + _ = 1 := by simp [character_norm _ (fun i => hH i _)] + +lemma g_permuteCharge (H : Matrix6) (a : Charge) (p : Equiv.Perm Index) : + g H (permuteCharge p a) = g (fun i k => H (p.symm i) k) a := by + unfold g + congr 1 + apply Finset.sum_congr rfl + intro k _ + simpa using (character_perm (fun i => H (p.symm i) k) a p) + +lemma g_permute_columns (H : Matrix6) (a : Charge) (p : Equiv.Perm Index) : + g (fun i k => H i (p k)) a = g H a := by + unfold g + rw [Equiv.sum_comp p (fun k => character (fun i => H i k) a)] + +lemma g_row_phases (H : Matrix6) (a : Charge) (u : Index → ℂ) : + g (fun i k => u i * H i k) a = character u a * g H a := by + simp only [g, character_mul, ← Finset.mul_sum] + ring + +lemma g_column_phases (H : Matrix6) {a : Charge} (ha : Balanced a) + (v : Index → ℂ) (hv : ∀ k, v k ≠ 0) : + g (fun i k => H i k * v k) a = g H a := by + simp only [g, character_mul, character_constant (hv _) ha, mul_one] + +def differenceCharge (n : ℤ) (i j : Index) : Charge := + Pi.single i n - Pi.single j n + +lemma differenceCharge_balanced (n : ℤ) (i j : Index) : + Balanced (differenceCharge n i j) := by + simp [Balanced, differenceCharge, Finset.sum_sub_distrib] + +lemma character_single (x : Index → ℂ) (n : ℤ) (i : Index) : + character x (Pi.single i n) = x i ^ n := by + classical + unfold character + rw [Finset.prod_eq_single i] + · simp + · intro j _ hj + simp [hj] + · simp + +lemma character_difference (x : Index → ℂ) (hx : ∀ i, ‖x i‖ = 1) + (n : ℤ) (i j : Index) : + character x (differenceCharge n i j) = x i ^ n * star (x j ^ n) := by + rw [differenceCharge, sub_eq_add_neg, + character_add x (fun k => unit_ne_zero (hx k)), character_neg x hx, + character_single, character_single] + +lemma g_difference {H : Matrix6} (hH : IsComplexHadamard H) {i j : Index} (hij : i ≠ j) : + g H (differenceCharge 1 i j) = 0 := by + simp only [g, character_difference _ (fun k => hH.1 k _) 1 i j, zpow_one] + rw [hH.row_orthogonality, ite_eq_right hij, mul_zero] + +def entrywiseSquare (H : Matrix6) : Matrix6 := fun i j => H i j ^ 2 + +lemma Unimodular.entrywiseSquare {H : Matrix6} (hH : Unimodular H) : + Unimodular (entrywiseSquare H) := by + intro i j + simp [HadamardSix.entrywiseSquare, norm_pow, hH i j] + +lemma six_mul_g_double_difference {H : Matrix6} (hH : Unimodular H) (i j : Index) : + (6 : ℂ) * g H (differenceCharge 2 i j) = + ∑ k, (H i k ^ 2) * star (H j k ^ 2) := by + simp [g, character_difference _ (fun l => hH l _) 2 i j, zpow_ofNat] + +lemma square_hadamard_iff {H : Matrix6} (hH : Unimodular H) : + IsComplexHadamard (entrywiseSquare H) ↔ + ∀ i j : Index, i ≠ j → g H (differenceCharge 2 i j) = 0 := by + constructor + · intro hs i j hij + have hz := hs.row_orthogonality i j + rw [ite_eq_right hij] at hz + have hzero : (6 : ℂ) * g H (differenceCharge 2 i j) = 0 := by + rw [six_mul_g_double_difference hH] + exact hz + exact (mul_eq_zero.mp hzero).resolve_left (by norm_num) + · intro hg + refine isComplexHadamard_of_rows hH.entrywiseSquare ?_ + intro i j + by_cases hij : i = j + · subst j + rw [ite_eq_left rfl] + have hu (k : Index) : entrywiseSquare H i k * star (entrywiseSquare H i k) = 1 := + unit_mul_star (hH.entrywiseSquare i k) + simp only [hu, Finset.sum_const, Finset.card_univ, Fintype.card_fin, nsmul_eq_mul] + norm_num + · rw [ite_eq_right hij] + change ∑ k, (H i k ^ 2) * star (H j k ^ 2) = 0 + rw [← six_mul_g_double_difference hH, hg i j hij, mul_zero] + +end HadamardSix + +end OAI diff --git a/lean/OAI/LinearAlgebra/Hadamard/Main.lean b/lean/OAI/LinearAlgebra/Hadamard/Main.lean new file mode 100644 index 0000000000000000000000000000000000000000..b500e234334003ebdd4e2eaee29dfe8120e6f18e --- /dev/null +++ b/lean/OAI/LinearAlgebra/Hadamard/Main.lean @@ -0,0 +1,117 @@ +import OAI.LinearAlgebra.Hadamard.CubeFibers + +namespace OAI + +/-! The dichotomy implied by the two Fourier product identities. -/ + +open scoped BigOperators Matrix + +namespace HadamardSix + +def crossCharge : Charge := differenceCharge 2 0 3 + +def sameCharge : Charge := differenceCharge 2 0 1 + +lemma crossCharge_eq : crossCharge = ![2, 0, 0, -2, 0, 0] := by decide +lemma sameCharge_eq : sameCharge = ![2, -2, 0, 0, 0, 0] := by decide + +private def pairOrdering : Index → Index → Index → Index := + ![ ![![0, 1, 2, 3, 4, 5], + ![0, 1, 2, 3, 4, 5], + ![0, 2, 1, 3, 4, 5], + ![0, 1, 2, 3, 4, 5], + ![0, 1, 2, 4, 3, 5], + ![0, 1, 2, 4, 5, 3]], + ![![1, 0, 2, 3, 4, 5], + ![0, 1, 2, 3, 4, 5], + ![2, 0, 1, 3, 4, 5], + ![1, 0, 2, 3, 4, 5], + ![1, 0, 2, 4, 3, 5], + ![1, 0, 2, 4, 5, 3]], + ![![1, 2, 0, 3, 4, 5], + ![2, 1, 0, 3, 4, 5], + ![0, 1, 2, 3, 4, 5], + ![1, 2, 0, 3, 4, 5], + ![1, 2, 0, 4, 3, 5], + ![1, 2, 0, 4, 5, 3]], + ![![3, 4, 5, 0, 1, 2], + ![4, 3, 5, 0, 1, 2], + ![4, 5, 3, 0, 1, 2], + ![0, 1, 2, 3, 4, 5], + ![3, 4, 5, 0, 1, 2], + ![3, 4, 5, 0, 2, 1]], + ![![3, 4, 5, 1, 0, 2], + ![4, 3, 5, 1, 0, 2], + ![4, 5, 3, 1, 0, 2], + ![3, 4, 5, 1, 0, 2], + ![0, 1, 2, 3, 4, 5], + ![3, 4, 5, 2, 0, 1]], + ![![3, 4, 5, 1, 2, 0], + ![4, 3, 5, 1, 2, 0], + ![4, 5, 3, 1, 2, 0], + ![3, 4, 5, 1, 2, 0], + ![3, 4, 5, 2, 1, 0], + ![0, 1, 2, 3, 4, 5]]] + +private lemma pairOrdering_bijective (i j : Index) : + Function.Bijective (pairOrdering i j) := by + fin_cases i <;> fin_cases j <;> decide + +lemma double_difference_transport (i j : Index) (hij : i ≠ j) : + ∃ (p : Equiv.Perm Index) (q : Charge), + (q = crossCharge ∨ q = sameCharge) ∧ + (permuteCharge p alpha = alpha ∨ permuteCharge p alpha = -alpha) ∧ + permuteCharge p q = differenceCharge 2 i j := by + let p := Equiv.ofBijective (pairOrdering i j) (pairOrdering_bijective i j) + refine ⟨p, if i.val / 3 = j.val / 3 then sameCharge else crossCharge, ?_, ?_, ?_⟩ + · split_ifs <;> simp + · fin_cases i <;> fin_cases j <;> decide + · fin_cases i <;> fin_cases j <;> first | exact (hij rfl).elim | decide + +lemma dichotomy_of_product_identities {H : Matrix6} (hH : IsComplexHadamard H) + (hcross : ∀ p : Equiv.Perm Index, + g H (permuteCharge p alpha) * g H (permuteCharge p crossCharge) = 0) + (hsame : ∀ p : Equiv.Perm Index, + g H (permuteCharge p alpha) * g H (permuteCharge p sameCharge) = 0) : + (∀ p : Equiv.Perm Index, g H (permuteCharge p alpha) = 0) ∨ + IsComplexHadamard (entrywiseSquare H) := by + classical + by_cases hvanish : ∀ p : Equiv.Perm Index, g H (permuteCharge p alpha) = 0 + · exact Or.inl hvanish + right + push Not at hvanish + obtain ⟨p, hp⟩ := hvanish + let K : Matrix6 := fun i k => H (p.symm i) k + have hK : IsComplexHadamard K := hH.permute_rows p.symm + have hnonzero : g K alpha ≠ 0 := by + simpa [K, ← g_permuteCharge] using hp + have hnegative : g K (-alpha) ≠ 0 := by + rw [g_neg hK.1] + exact star_ne_zero.mpr hnonzero + have hc (q : Equiv.Perm Index) : + g K (permuteCharge q alpha) * g K (permuteCharge q crossCharge) = 0 := by + simpa only [K, ← g_permuteCharge, permuteCharge_trans] using hcross (p.trans q) + have hs (q : Equiv.Perm Index) : + g K (permuteCharge q alpha) * g K (permuteCharge q sameCharge) = 0 := by + simpa only [K, ← g_permuteCharge, permuteCharge_trans] using hsame (p.trans q) + have hKs : IsComplexHadamard (entrywiseSquare K) := by + apply (square_hadamard_iff hK.1).mpr + intro i j hij + obtain ⟨q, a, ha, hqa, hqx⟩ := double_difference_transport i j hij + have hprod : g K (permuteCharge q alpha) * g K (permuteCharge q a) = 0 := by + rcases ha with rfl | rfl + · exact hc q + · exact hs q + rw [hqx] at hprod + have hfirst : g K (permuteCharge q alpha) ≠ 0 := by + rcases hqa with hqa | hqa + · simpa only [hqa] using hnonzero + · simpa only [hqa] using hnegative + exact (mul_eq_zero.mp hprod).resolve_left hfirst + have hback := hKs.permute_rows p + change IsComplexHadamard (fun i k => H i k ^ 2) + simpa only [K, entrywiseSquare, Equiv.symm_apply_apply] using hback + +end HadamardSix + +end OAI diff --git a/lean/OAI/LinearAlgebra/Hadamard/Polynomials.lean b/lean/OAI/LinearAlgebra/Hadamard/Polynomials.lean new file mode 100644 index 0000000000000000000000000000000000000000..db2a24d4bea70b1b511c9a3508eb89b9169f9f23 --- /dev/null +++ b/lean/OAI/LinearAlgebra/Hadamard/Polynomials.lean @@ -0,0 +1,213 @@ +import OAI.LinearAlgebra.Hadamard.Equivalence + +namespace OAI + +/-! Fourier kernel identities and symmetric polynomials of row ratios. -/ + +open scoped BigOperators Matrix + +namespace HadamardSix + +lemma character_sub (x : Index → ℂ) (hx : ∀ i, ‖x i‖ = 1) (a b : Charge) : + character x (a - b) = character x a * star (character x b) := by + rw [sub_eq_add_neg, character_add x (fun k => unit_ne_zero (hx k)), character_neg x hx] + +lemma column_kernel_identity {H : Matrix6} (hH : IsComplexHadamard H) + (A B : Index → ℂ) (i : Index) : + (∑ j, (∑ k, A k * H i k * star (H j k)) * + (∑ l, B l * star (H i l) * H j l)) = 6 * ∑ k, A k * B k := by + have hexpand : + (∑ j, (∑ k, A k * H i k * star (H j k)) * + (∑ l, B l * star (H i l) * H j l)) = + ∑ k, ∑ l, A k * B l * H i k * star (H i l) * + ∑ j, star (H j k) * H j l := by + simp only [Finset.sum_mul, Finset.mul_sum] + conv_rhs => rw [Finset.sum_comm] + rw [Finset.sum_comm] + apply Finset.sum_congr rfl + intro k _ + rw [Finset.sum_comm] + apply Finset.sum_congr rfl + intro l _ + apply Finset.sum_congr rfl + intro j _ + ring + rw [hexpand] + simp_rw [hH.column_orthogonality] + simp only [mul_ite, mul_zero, Finset.sum_ite_eq, Finset.mem_univ, ite_true] + rw [Finset.mul_sum] + apply Finset.sum_congr rfl + intro k _ + calc + A k * B k * H i k * star (H i k) * 6 = 6 * (A k * B k) * + (H i k * star (H i k)) := by ring + _ = 6 * (A k * B k) := by rw [unit_mul_star (hH.1 i k), mul_one] + +lemma same_matrix_identity {H : Matrix6} (hH : IsComplexHadamard H) + (a b : Charge) (i : Index) : + ∑ j, g H (a + differenceCharge 1 i j) * g H (b - differenceCharge 1 i j) = + g H (a + b) := by + have hplus (j : Index) : + g H (a + differenceCharge 1 i j) = (6 : ℂ)⁻¹ * + ∑ k, character (fun t => H t k) a * H i k * star (H j k) := by + unfold g + congr 1 + apply Finset.sum_congr rfl + intro k _ + rw [character_add _ (fun t => hH.1.entry_ne_zero t k), + character_difference _ (fun t => hH.1 t k)] + simp [mul_assoc] + have hminus (j : Index) : + g H (b - differenceCharge 1 i j) = (6 : ℂ)⁻¹ * + ∑ k, character (fun t => H t k) b * star (H i k) * H j k := by + unfold g + congr 1 + apply Finset.sum_congr rfl + intro k _ + rw [character_sub _ (fun t => hH.1 t k), + character_difference _ (fun t => hH.1 t k)] + simp only [zpow_one, star_mul, star_star] + ring + simp_rw [hplus, hminus] + have hscale (x y : ℂ) : (6 : ℂ)⁻¹ * x * ((6 : ℂ)⁻¹ * y) = + (6 : ℂ)⁻¹ ^ 2 * (x * y) := by ring + simp_rw [hscale] + rw [← Finset.mul_sum, column_kernel_identity hH] + unfold g + simp_rw [character_add _ (fun t => hH.1.entry_ne_zero t _)] + ring + +noncomputable def elementary (v : Index → ℂ) (k : ℕ) : ℂ := + (Finset.univ.val.map v).esymm k + +lemma elementary_eq_sum (v : Index → ℂ) (k : ℕ) : + elementary v k = ∑ s ∈ Finset.univ.powersetCard k, ∏ i ∈ s, v i := + Finset.esymm_map_val v Finset.univ k + +lemma elementary_zero (v : Index → ℂ) : elementary v 0 = 1 := by + simp [elementary_eq_sum] + +lemma elementary_one (v : Index → ℂ) : elementary v 1 = ∑ i, v i := by + simp [elementary_eq_sum, Finset.powersetCard_one] + +lemma elementary_six (v : Index → ℂ) : elementary v 6 = ∏ i, v i := by + rw [elementary_eq_sum] + have hcard : (Finset.univ : Finset Index).card = 6 := by decide + rw [show Finset.univ.powersetCard 6 = ({Finset.univ} : Finset (Finset Index)) by + simpa only [hcard] using Finset.powersetCard_self (Finset.univ : Finset Index)] + rw [Finset.sum_singleton] + +lemma elementary_two_of_power_sums (v : Index → ℂ) + (h1 : ∑ i, v i = 0) (h2 : ∑ i, v i ^ 2 = 0) : elementary v 2 = 0 := by + have ha : (Finset.HasAntidiagonal.antidiagonal 2 : Finset (ℕ × ℕ)) = + {(0, 2), (1, 1), (2, 0)} := by decide + have hnpoly := MvPolynomial.mul_esymm_eq_sum Index ℂ 2 + rw [ha] at hnpoly + norm_num [Finset.sum_filter] at hnpoly + have hn := congrArg (MvPolynomial.aeval v : MvPolynomial Index ℂ →ₐ[ℂ] ℂ) hnpoly + simp only [map_mul, map_ofNat, map_neg, map_add, map_sum, + MvPolynomial.aeval_esymm_eq_multiset_esymm] at hn + simp [MvPolynomial.psum, h1, h2] at hn + exact hn + +lemma elementary_complement (v : Index → ℂ) (hv : ∀ i, ‖v i‖ = 1) + (k : ℕ) (hk : k ≤ 6) : + elementary v (6 - k) = elementary v 6 * star (elementary v k) := by + rw [elementary_eq_sum, elementary_six, elementary_eq_sum, star_sum, Finset.mul_sum] + refine Finset.sum_bij' (fun s _ => sᶜ) (fun s _ => sᶜ) ?_ ?_ ?_ ?_ ?_ + · intro s hs + rw [Finset.mem_powersetCard_univ] at hs ⊢ + rw [Finset.card_compl, Fintype.card_fin, hs, Nat.sub_sub_self hk] + · intro s hs + rw [Finset.mem_powersetCard_univ] at hs ⊢ + rw [Finset.card_compl, Fintype.card_fin, hs] + · intro s hs + exact compl_compl s + · intro s hs + exact compl_compl s + · intro s hs + have hunit : ‖∏ i ∈ sᶜ, v i‖ = 1 := by + simp [norm_prod, hv] + rw [← Finset.prod_mul_prod_compl s v, mul_assoc, unit_mul_star hunit, mul_one] + +noncomputable def ratioPolynomial (v : Index → ℂ) : Polynomial ℂ := + ∏ i, (Polynomial.X - Polynomial.C (v i)) + +lemma ratioPolynomial_vieta (v : Index → ℂ) : + ratioPolynomial v = ∑ k ∈ Finset.range 7, + (-1) ^ k * (Polynomial.C (elementary v k) * Polynomial.X ^ (6 - k)) := by + have h := Multiset.prod_X_sub_X_eq_sum_esymm (Finset.univ.val.map v) + simp only [Multiset.card_map, ← Finset.card_def, + Finset.card_univ, Fintype.card_fin] at h + simpa only [ratioPolynomial, Finset.prod_eq_multiset_prod, Multiset.map_map, + Function.comp_apply, elementary] using h + +lemma ratioPolynomial_of_power_sums (v : Index → ℂ) (hv : ∀ i, ‖v i‖ = 1) + (h1 : ∑ i, v i = 0) (h2 : ∑ i, v i ^ 2 = 0) : + ratioPolynomial v = Polynomial.X ^ 6 - + Polynomial.C (elementary v 3) * Polynomial.X ^ 3 + + Polynomial.C (elementary v 6) := by + have e1 : elementary v 1 = 0 := by rw [elementary_one, h1] + have e2 := elementary_two_of_power_sums v h1 h2 + have e4 : elementary v 4 = 0 := by + simpa only [e2, star_zero, mul_zero] using elementary_complement v hv 2 (by decide) + have e5 : elementary v 5 = 0 := by + simpa only [e1, star_zero, mul_zero] using elementary_complement v hv 1 (by decide) + rw [ratioPolynomial_vieta] + norm_num [Finset.sum_range_succ, elementary_zero, e1, e2, e4, e5, sub_eq_add_neg] + +lemma ratioPolynomial_eval (v : Index → ℂ) (i : Index) : + (ratioPolynomial v).eval (v i) = 0 := by + classical + rw [ratioPolynomial, Polynomial.eval_prod] + apply Finset.prod_eq_zero (Finset.mem_univ i) + simp + +lemma ratio_power_six (v : Index → ℂ) (hv : ∀ i, ‖v i‖ = 1) + (h1 : ∑ i, v i = 0) (h2 : ∑ i, v i ^ 2 = 0) (i : Index) : + v i ^ 6 - elementary v 3 * v i ^ 3 + elementary v 6 = 0 := by + have h := ratioPolynomial_eval v i + rw [ratioPolynomial_of_power_sums v hv h1 h2] at h + simpa using h + +lemma ratio_cubes_two_values (v : Index → ℂ) (hv : ∀ i, ‖v i‖ = 1) + (h1 : ∑ i, v i = 0) (h2 : ∑ i, v i ^ 2 = 0) (i : Index) : + v i ^ 3 = v 0 ^ 3 ∨ v i ^ 3 = elementary v 3 - v 0 ^ 3 := by + have hz : (v i ^ 3 - v 0 ^ 3) * (v i ^ 3 - (elementary v 3 - v 0 ^ 3)) = 0 := by + linear_combination ratio_power_six v hv h1 h2 i - ratio_power_six v hv h1 h2 0 + simpa only [sub_eq_zero] using mul_eq_zero.mp hz + +lemma three_mul_elementary_three (v : Index → ℂ) + (h1 : ∑ i, v i = 0) (h2 : ∑ i, v i ^ 2 = 0) : + 3 * elementary v 3 = ∑ i, v i ^ 3 := by + have ha : (Finset.HasAntidiagonal.antidiagonal 3 : Finset (ℕ × ℕ)) = + {(0, 3), (1, 2), (2, 1), (3, 0)} := by decide + have hnpoly := MvPolynomial.mul_esymm_eq_sum Index ℂ 3 + rw [ha] at hnpoly + norm_num [Finset.sum_filter] at hnpoly + have hn := congrArg (MvPolynomial.aeval v : MvPolynomial Index ℂ →ₐ[ℂ] ℂ) hnpoly + simp only [map_mul, map_ofNat, map_neg, map_add, map_sum, + MvPolynomial.aeval_esymm_eq_multiset_esymm] at hn + simpa [elementary, MvPolynomial.psum, h1, h2] using hn + +lemma fourth_power_sum_zero (v : Index → ℂ) (hv : ∀ i, ‖v i‖ = 1) + (h1 : ∑ i, v i = 0) (h2 : ∑ i, v i ^ 2 = 0) : ∑ i, v i ^ 4 = 0 := by + have ha : (Finset.HasAntidiagonal.antidiagonal 4 : Finset (ℕ × ℕ)) = + {(0, 4), (1, 3), (2, 2), (3, 1), (4, 0)} := by decide + have he4 : elementary v 4 = 0 := by + simpa only [elementary_two_of_power_sums v h1 h2, star_zero, mul_zero] + using elementary_complement v hv 2 (by decide) + have hnpoly := MvPolynomial.mul_esymm_eq_sum Index ℂ 4 + rw [ha] at hnpoly + norm_num [Finset.sum_filter] at hnpoly + have hn := congrArg (MvPolynomial.aeval v : MvPolynomial Index ℂ →ₐ[ℂ] ℂ) hnpoly + simp only [map_mul, map_ofNat, map_neg, map_add, map_sum, + MvPolynomial.aeval_esymm_eq_multiset_esymm] at hn + have hn' : 4 * elementary v 4 = -(∑ i, v i ^ 4) := by + simpa [elementary, MvPolynomial.psum, h1, h2] using hn + rw [he4] at hn' + simpa using hn'.symm + +end HadamardSix + +end OAI diff --git a/lean/OAI/LinearAlgebra/Hadamard/TaoExponents.lean b/lean/OAI/LinearAlgebra/Hadamard/TaoExponents.lean new file mode 100644 index 0000000000000000000000000000000000000000..16224751e7ee6c54d1153d2eee53959de8fb6404 --- /dev/null +++ b/lean/OAI/LinearAlgebra/Hadamard/TaoExponents.lean @@ -0,0 +1,106 @@ +import OAI.LinearAlgebra.Hadamard.Basic +import Mathlib.GroupTheory.Perm.Sign +import Mathlib.Data.ZMod.Basic +import Mathlib.Tactic.FinCases +import Mathlib.Tactic.Ring + +namespace OAI + +/-! Cubic exponent symmetries of Tao’s order-six complex Hadamard matrix. -/ + +namespace HadamardSix.TaoSymmetry + +abbrev I := Fin 6 +abbrev Exponents := I → I → ZMod 3 + +def exponent : Exponents := + fun i j => (HadamardSix.taoExponent i j : ZMod 3) + +def RowSymmetry (t : Exponents) (p : Equiv.Perm I) : Prop := + ∃ (q : Equiv.Perm I) (s : (ZMod 3)ˣ) (u v : I → ZMod 3), + ∀ i j, t (p i) (q j) = (s : ZMod 3) * t i j + u i + v j + +theorem rowSymmetry_one (t : Exponents) : RowSymmetry t 1 := by + refine ⟨1, 1, fun _ => 0, fun _ => 0, ?_⟩ + intro i j + simp + +theorem rowSymmetry_mul {t : Exponents} {p p' : Equiv.Perm I} + (hp : RowSymmetry t p) (hp' : RowSymmetry t p') : + RowSymmetry t (p * p') := by + obtain ⟨q, s, u, v, h⟩ := hp + obtain ⟨q', s', u', v', h'⟩ := hp' + refine ⟨q * q', s * s', + (fun i => (s : ZMod 3) * u' i + u (p' i)), + (fun j => (s : ZMod 3) * v' j + v (q' j)), ?_⟩ + intro i j + change t (p (p' i)) (q (q' j)) = + ((s * s' : (ZMod 3)ˣ) : ZMod 3) * t i j + + ((s : ZMod 3) * u' i + u (p' i)) + + ((s : ZMod 3) * v' j + v (q' j)) + rw [h, h'] + simp only [Units.val_mul] + ring + +def symmetryMonoid (t : Exponents) : Submonoid (Equiv.Perm I) where + carrier := RowSymmetry t + one_mem' := rowSymmetry_one t + mul_mem' := fun hp hp' => rowSymmetry_mul hp hp' + +def columnMap : Fin 5 → I → I := + ![![1, 0, 5, 4, 3, 2], + ![4, 5, 3, 2, 0, 1], + ![5, 2, 1, 4, 3, 0], + ![1, 0, 3, 2, 5, 4], + ![2, 5, 0, 4, 3, 1]] + +theorem columnMap_bijective (a : Fin 5) : + Function.Bijective (columnMap a) := by + fin_cases a <;> decide + +noncomputable def columnPerm (a : Fin 5) : Equiv.Perm I := + Equiv.ofBijective (columnMap a) (columnMap_bijective a) + +def rowPhase : Fin 5 → I → ZMod 3 := + ![![0, 0, 1, 2, 2, 1], + ![0, 2, 2, 1, 0, 1], + ![0, 1, 2, 2, 1, 0], + ![0, 0, 1, 2, 2, 1], + ![0, 1, 0, 1, 2, 2]] + +def columnPhase : Fin 5 → I → ZMod 3 := + ![![0, 0, 1, 2, 2, 1], + ![0, 0, 0, 0, 0, 0], + ![0, 0, 0, 0, 0, 0], + ![0, 0, 0, 0, 0, 0], + ![0, 0, 0, 0, 0, 0]] + +theorem adjacent_certificate (a : Fin 5) : + ∀ i j, + exponent (Equiv.swap a.castSucc a.succ i) (columnMap a j) = + (-1 : ZMod 3) * exponent i j + rowPhase a i + columnPhase a j := by + fin_cases a <;> decide + +theorem adjacent_symmetry (a : Fin 5) : + RowSymmetry exponent (Equiv.swap a.castSucc a.succ) := by + refine ⟨columnPerm a, -1, rowPhase a, columnPhase a, ?_⟩ + intro i j + change exponent (Equiv.swap a.castSucc a.succ i) (columnMap a j) = + (-1 : ZMod 3) * exponent i j + rowPhase a i + columnPhase a j + exact adjacent_certificate a i j + +theorem every_row_permutation (p : Equiv.Perm I) : + RowSymmetry exponent p := by + have hclosure : + Submonoid.closure + (Set.range fun a : Fin 5 => Equiv.swap a.castSucc a.succ) ≤ + symmetryMonoid exponent := by + apply Submonoid.closure_le.mpr + rintro _ ⟨a, rfl⟩ + exact adjacent_symmetry a + rw [Equiv.Perm.mclosure_swap_castSucc_succ] at hclosure + exact hclosure (by simp) + +end HadamardSix.TaoSymmetry + +end OAI diff --git a/lean/OAI/LinearAlgebra/Hadamard/TaoFourier.lean b/lean/OAI/LinearAlgebra/Hadamard/TaoFourier.lean new file mode 100644 index 0000000000000000000000000000000000000000..905403a5e181407fd0566c06b6f189f406c5039b --- /dev/null +++ b/lean/OAI/LinearAlgebra/Hadamard/TaoFourier.lean @@ -0,0 +1,114 @@ +import OAI.LinearAlgebra.Hadamard.Fourier +import OAI.LinearAlgebra.Hadamard.TaoSymmetry + +namespace OAI + +/-! Fourier norm invariance for the cubic matrix under permutations and negation. -/ + +namespace HadamardSix.CubicSymmetry + +lemma character_star (x : Index → ℂ) (a : Charge) : + character (fun i => star (x i)) a = star (character x a) := by + unfold character + rw [star_prod] + apply Finset.prod_congr rfl + intro i _ + exact (map_zpow₀ (starRingEnd ℂ) (x i) (a i)).symm + +lemma g_star (H : Matrix6) (a : Charge) : + g (fun i j => star (H i j)) a = star (g H a) := by + simp only [g, character_star, star_mul, star_sum, star_inv₀, star_ofNat] + ring + +lemma norm_g_phases_columns (H : Matrix6) {a : Charge} + (ha : Balanced a) (q : Equiv.Perm Index) + (U V : Index → ℂ) + (hU : ∀ i, ‖U i‖ = 1) + (hV : ∀ j, ‖V j‖ = 1) : + ‖g (fun i j => U i * H i (q j) * V j) a‖ = ‖g H a‖ := by + have hc := g_column_phases (fun i j => U i * H i (q j)) + ha V (fun j => unit_ne_zero (hV j)) + have hr := g_row_phases (fun i j => H i (q j)) a U + have hp := g_permute_columns H a q + have heq : g (fun i j => U i * H i (q j) * V j) a = + character U a * g H a := + hc.trans (hr.trans (congrArg (fun z : ℂ => character U a * z) hp)) + calc + ‖g (fun i j => U i * H i (q j) * V j) a‖ = + ‖character U a * g H a‖ := congrArg (fun z : ℂ => ‖z‖) heq + _ = ‖g H a‖ := by + rw [norm_mul, character_norm U hU a, one_mul] + +/-- The Fourier norm of the cubic matrix is invariant under all permutations of a balanced +charge. -/ +theorem norm_g_permute (a : Charge) (ha : Balanced a) + (p : Equiv.Perm Index) : + ‖g taoMatrix (permuteCharge p a)‖ = ‖g taoMatrix a‖ := by + classical + obtain ⟨q, conjugate, U, V, hU, hV, he⟩ := + every_row_permutation_complex p.symm + let K : Matrix6 := fun i j => + if conjugate then star (taoMatrix i j) else taoMatrix i j + have hrow : + (fun i j => taoMatrix (p.symm i) j) = + (fun i j => U i * K i (q.symm j) * V (q.symm j)) := by + funext i j + calc + taoMatrix (p.symm i) j = + U i * V (q.symm j) * K i (q.symm j) := by + simpa [K] using he i (q.symm j) + _ = U i * K i (q.symm j) * V (q.symm j) := by ring + calc + ‖g taoMatrix (permuteCharge p a)‖ = + ‖g (fun i j => U i * K i (q.symm j) * V (q.symm j)) a‖ := by + rw [g_permuteCharge, hrow] + _ = ‖g K a‖ := + norm_g_phases_columns K ha q.symm U + (fun j => V (q.symm j)) hU (fun j => hV (q.symm j)) + _ = ‖g taoMatrix a‖ := by + cases conjugate with + | false => rfl + | true => + change ‖g (fun i j => star (taoMatrix i j)) a‖ = ‖g taoMatrix a‖ + rw [g_star] + simp + +/-- Negation preserves the Fourier norm even without a balance assumption. -/ +theorem norm_g_neg (a : Charge) : + ‖g taoMatrix (-a)‖ = ‖g taoMatrix a‖ := by + rw [g_neg tao_unimodular] + simp + +/-- Signed permutations preserve the Fourier norm of every balanced charge. -/ +theorem norm_g_signed_permute (a : Charge) (ha : Balanced a) + (p : Equiv.Perm Index) (negate : Bool) : + ‖g taoMatrix + (if negate then -(permuteCharge p a) else permuteCharge p a)‖ = + ‖g taoMatrix a‖ := by + cases negate with + | false => exact norm_g_permute a ha p + | true => + exact (norm_g_neg (permuteCharge p a)).trans (norm_g_permute a ha p) + +/-- Every row permutation of the cubic matrix extends using column permutations, unit +phases and optional conjugation, and its Fourier norm is invariant under signed permutations +of balanced charges. -/ +def FullCubicSymmetry : Prop := + (∀ p : Equiv.Perm Index, + ∃ (q : Equiv.Perm Index) (conjugate : Bool) (U V : Index → ℂ), + (∀ i, ‖U i‖ = 1) ∧ (∀ j, ‖V j‖ = 1) ∧ + ∀ i j, taoMatrix (p i) (q j) = + U i * V j * (if conjugate then star (taoMatrix i j) else taoMatrix i j)) ∧ + (∀ (a : Charge), Balanced a → ∀ (p : Equiv.Perm Index) (negate : Bool), + ‖g taoMatrix (if negate then -(permuteCharge p a) else permuteCharge p a)‖ = + ‖g taoMatrix a‖) + +theorem cubic_symmetry : FullCubicSymmetry := by + constructor + · exact every_row_permutation_complex + · intro a ha p negate + exact norm_g_signed_permute a ha p negate + +end HadamardSix.CubicSymmetry + +end OAI diff --git a/lean/OAI/LinearAlgebra/Hadamard/TaoSymmetry.lean b/lean/OAI/LinearAlgebra/Hadamard/TaoSymmetry.lean new file mode 100644 index 0000000000000000000000000000000000000000..9a07cbec4c0bc9434bd5a95016ef27b18ab04fc9 --- /dev/null +++ b/lean/OAI/LinearAlgebra/Hadamard/TaoSymmetry.lean @@ -0,0 +1,129 @@ +import OAI.LinearAlgebra.Hadamard.TaoExponents + +namespace OAI + +/-! Cubic roots of unity and complex symmetries of Tao's matrix. -/ + +namespace HadamardSix.CubicSymmetry + +lemma omega_ne_zero : omega ≠ 0 := by + exact Complex.exp_ne_zero _ + +lemma omega_norm : ‖omega‖ = 1 := by + rw [omega, Complex.norm_exp] + simp [Complex.mul_re, Complex.mul_im] + +lemma omega_cube : omega ^ (3 : ℕ) = 1 := by + let z : ℂ := 2 * (Real.pi : ℂ) * Complex.I / 3 + have h : (3 : ℂ) * z = 2 * (Real.pi : ℂ) * Complex.I := by + dsimp [z] + ring + calc + omega ^ (3 : ℕ) = Complex.exp ((3 : ℂ) * z) := by + simpa only [omega, z, Nat.cast_ofNat] using + (Complex.exp_nat_mul z 3).symm + _ = Complex.exp (2 * (Real.pi : ℂ) * Complex.I) := + congrArg Complex.exp h + _ = 1 := Complex.exp_two_pi_mul_I + +lemma omega_zpow_three : omega ^ (3 : ℤ) = 1 := by + simpa using omega_cube + +lemma omega_zpow_mod_three (m : ℤ) : + omega ^ m = omega ^ (m % 3) := by + calc + omega ^ m = omega ^ (m % 3 + 3 * (m / 3)) := by + rw [Int.emod_add_mul_ediv] + _ = omega ^ (m % 3) := by + rw [zpow_add₀ omega_ne_zero, zpow_mul, omega_zpow_three] + simp + +lemma omega_zpow_eq_of_zmod_eq {m n : ℤ} + (h : (m : ZMod 3) = (n : ZMod 3)) : + omega ^ m = omega ^ n := by + have hm : m % 3 = n % 3 := + (ZMod.intCast_eq_intCast_iff' m n 3).mp h + rw [omega_zpow_mod_three m, omega_zpow_mod_three n, hm] + +lemma omega_zpow_neg_star (m : ℤ) : + omega ^ (-m) = star (omega ^ m) := by + rw [zpow_neg, ← inv_zpow, unit_inv omega_norm] + exact (map_zpow₀ (starRingEnd ℂ) omega m).symm + +lemma tao_unimodular : Unimodular taoMatrix := by + intro i j + simp [taoMatrix, norm_zpow, omega_norm] + +private lemma zmod_three_nonzero_sign : + ∀ x : ZMod 3, x ≠ 0 → x = 1 ∨ x = -1 := by + decide + +/-- Every specified row permutation extends on the literal cubic matrix. -/ +theorem every_row_permutation_complex (p : Equiv.Perm Index) : + ∃ (q : Equiv.Perm Index) (conjugate : Bool) + (U V : Index → ℂ), + (∀ i, ‖U i‖ = 1) ∧ + (∀ j, ‖V j‖ = 1) ∧ + ∀ i j, + taoMatrix (p i) (q j) = + U i * V j * + (if conjugate then star (taoMatrix i j) + else taoMatrix i j) := by + classical + obtain ⟨q, s, u, v, he⟩ := + TaoSymmetry.every_row_permutation p + let U : Index → ℂ := fun i => omega ^ ((u i).val : ℤ) + let V : Index → ℂ := fun j => omega ^ ((v j).val : ℤ) + have hU : ∀ i, ‖U i‖ = 1 := by + intro i + simp [U, norm_zpow, omega_norm] + have hV : ∀ j, ‖V j‖ = 1 := by + intro j + simp [V, norm_zpow, omega_norm] + have hs : (s : ZMod 3) = 1 ∨ (s : ZMod 3) = -1 := + zmod_three_nonzero_sign s (Units.ne_zero s) + rcases hs with hs | hs + · refine ⟨q, false, U, V, hU, hV, ?_⟩ + intro i j + change taoMatrix (p i) (q j) = + U i * V j * taoMatrix i j + have hc : + (taoExponent (p i) (q j) : ZMod 3) = + ((taoExponent i j + ((u i).val : ℤ) + + ((v j).val : ℤ) : ℤ) : ZMod 3) := by + simpa [TaoSymmetry.exponent, hs, + ZMod.natCast_zmod_val] using he i j + calc + taoMatrix (p i) (q j) = + omega ^ (taoExponent i j + ((u i).val : ℤ) + + ((v j).val : ℤ)) := + omega_zpow_eq_of_zmod_eq hc + _ = U i * V j * taoMatrix i j := by + dsimp [U, V, taoMatrix] + rw [zpow_add₀ omega_ne_zero, zpow_add₀ omega_ne_zero] + ring + · refine ⟨q, true, U, V, hU, hV, ?_⟩ + intro i j + change taoMatrix (p i) (q j) = + U i * V j * star (taoMatrix i j) + have hc : + (taoExponent (p i) (q j) : ZMod 3) = + ((-taoExponent i j + ((u i).val : ℤ) + + ((v j).val : ℤ) : ℤ) : ZMod 3) := by + simpa [TaoSymmetry.exponent, hs, + ZMod.natCast_zmod_val] using he i j + calc + taoMatrix (p i) (q j) = + omega ^ (-taoExponent i j + ((u i).val : ℤ) + + ((v j).val : ℤ)) := + omega_zpow_eq_of_zmod_eq hc + _ = U i * V j * star (taoMatrix i j) := by + dsimp [U, V, taoMatrix] + rw [zpow_add₀ omega_ne_zero, zpow_add₀ omega_ne_zero, + omega_zpow_neg_star] + simp only [starRingEnd_apply] + ring + +end HadamardSix.CubicSymmetry + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/Arithmetic/ArithmeticComplexity.lean b/lean/OAI/LinearAlgebra/MatrixFields/Arithmetic/ArithmeticComplexity.lean new file mode 100644 index 0000000000000000000000000000000000000000..938c124a3f1dc18e88b23f9b69f5bc64291383b9 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/Arithmetic/ArithmeticComplexity.lean @@ -0,0 +1,127 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Model + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section + +open scoped BigOperators + +namespace MatrixMultiplication.Arithmetic + +namespace Gate + +variable {F Input Register : Type*} + +end Gate + +namespace Program + +variable {F Input : Type*} + +@[simp] theorem eval_step_zero [Field F] {r : ℕ} (p : Program F Input r) + (g : Gate F Input (Fin r)) (inputs : Input → F) : + (p.step g).eval inputs 0 = g.eval inputs (p.eval inputs) := rfl + +@[simp] theorem eval_step_succ [Field F] {r : ℕ} (p : Program F Input r) + (g : Gate F Input (Fin r)) (inputs : Input → F) (i : Fin r) : + (p.step g).eval inputs i.succ = p.eval inputs i := rfl + +@[simp] theorem cost_step {r : ℕ} (p : Program F Input r) + (g : Gate F Input (Fin r)) : (p.step g).cost = p.cost + g.cost := rfl + +end Program + +namespace MatrixAlgorithm + +variable {F : Type*} [Field F] {a b c : ℕ} + +theorem correct_iff_entries (P : MatrixAlgorithm F a b c) : + P.Correct ↔ ∀ (A : Matrix (Fin a) (Fin b) F) (B : Matrix (Fin b) (Fin c) F) + (i : Fin a) (k : Fin c), + P.program.eval (matrixInputs A B) (P.output i k) = ∑ j, A i j * B j k := by + constructor + · intro h A B i k + exact congrFun (congrFun (h A B) i) k + · intro h A B + funext i k + exact h A B i k + +end MatrixAlgorithm + +def scalarAlgorithm (F : Type*) [Field F] : MatrixAlgorithm F 1 1 1 where + registers := 3 + program := ((Program.nil.step (.input (.inl (0, 0)))).step + (.input (.inr (0, 0)))).step (.mul 1 0) + output := fun _ _ => 0 + +theorem scalarAlgorithm_correct (F : Type*) [Field F] : (scalarAlgorithm F).Correct := by + intro A B + funext i k + have hi : i = 0 := Subsingleton.elim _ _ + have hk : k = 0 := Subsingleton.elim _ _ + subst i + subst k + change A 0 0 * B 0 0 = (A * B) 0 0 + simp [Matrix.mul_apply] + +@[simp] theorem scalarAlgorithm_cost (F : Type*) [Field F] : (scalarAlgorithm F).cost = 1 := rfl + +def innerSize (n : ℕ) (k : ℝ) : ℕ := ⌈(n : ℝ) ^ k⌉₊ + +theorem one_le_innerSize {n : ℕ} (hn : 1 ≤ n) (k : ℝ) : 1 ≤ innerSize n k := by + apply Nat.one_le_ceil_iff.mpr + exact Real.rpow_pos_of_pos (by exact_mod_cast (lt_of_lt_of_le Nat.zero_lt_one hn)) k + +@[simp] theorem innerSize_zero (n : ℕ) : innerSize n 0 = 1 := by + simp [innerSize] + +@[simp] theorem innerSize_one (n : ℕ) : innerSize n 1 = n := by + simp [innerSize] + +theorem innerSize_mono {n : ℕ} (hn : 1 ≤ n) {k l : ℝ} (hkl : k ≤ l) : + innerSize n k ≤ innerSize n l := by + exact Nat.ceil_mono (Real.rpow_le_rpow_of_exponent_le (by exact_mod_cast hn) hkl) + +theorem innerSize_le_pow {a b n t : ℕ} {k : ℝ} (hk : 0 ≤ k) + (hn : n ≤ a ^ t) (hab : (a : ℝ) ^ k ≤ b) : innerSize n k ≤ b ^ t := by + apply Nat.ceil_le.mpr + calc + (n : ℝ) ^ k ≤ ((a ^ t : ℕ) : ℝ) ^ k := + Real.rpow_le_rpow (Nat.cast_nonneg n) (by exact_mod_cast hn) hk + _ = ((a : ℝ) ^ k) ^ t := by + rw [Nat.cast_pow, ← Real.rpow_pow_comm (Nat.cast_nonneg a)] + _ ≤ (b : ℝ) ^ t := pow_le_pow_left₀ (Real.rpow_nonneg (Nat.cast_nonneg a) k) hab t + _ = ((b ^ t : ℕ) : ℝ) := by rw [Nat.cast_pow] + +theorem innerSize_cast_le {n : ℕ} (hn : 1 ≤ n) {k : ℝ} (hk : 0 ≤ k) : + (innerSize n k : ℝ) ≤ 2 * (n : ℝ) ^ k := by + have hpow : 1 ≤ (n : ℝ) ^ k := Real.one_le_rpow (by exact_mod_cast hn) hk + have hceil := (Nat.ceil_lt_add_one (Real.rpow_nonneg (Nat.cast_nonneg n) k)).le + change (⌈(n : ℝ) ^ k⌉₊ : ℝ) ≤ _ + linarith + +def RectangularAdmissibleExponent (F : Type*) [Field F] (k τ : ℝ) : Prop := + ∀ ε : ℝ, 0 < ε → ∃ C : ℝ, 0 < C ∧ + ∀ n : ℕ, 1 ≤ n → ∃ P : MatrixAlgorithm F n (innerSize n k) n, + P.Correct ∧ (P.cost : ℝ) ≤ C * (n : ℝ) ^ (τ + ε) + +def rectangularOmega (F : Type*) [Field F] (k : ℝ) : ℝ := + sInf {τ : ℝ | RectangularAdmissibleExponent F k τ} + +def complexAlpha : ℝ := + sSup {k : ℝ | k ∈ Set.Icc 0 1 ∧ rectangularOmega ℂ k = 2} + +end MatrixMultiplication.Arithmetic + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/Arithmetic/ArithmeticExponent.lean b/lean/OAI/LinearAlgebra/MatrixFields/Arithmetic/ArithmeticExponent.lean new file mode 100644 index 0000000000000000000000000000000000000000..f59b7435a7bd63cef39bb1a8b5a13b6f74dad455 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/Arithmetic/ArithmeticExponent.lean @@ -0,0 +1,467 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Arithmetic.RecursiveBlockPrograms + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +noncomputable section + +open scoped BigOperators + +namespace MatrixMultiplication.Arithmetic +section + +namespace Program + +variable {F Input : Type*} + +def registerCost : {r : ℕ} → Program F Input r → Fin r → ℕ + | 0, .nil => Fin.elim0 + | _ + 1, .step p g => Fin.cases g.cost p.registerCost + +theorem sum_registerCost {r : ℕ} (p : Program F Input r) : + ∑ i, p.registerCost i = p.cost := by + induction p with + | nil => simp [registerCost, cost] + | step p g ih => simp [registerCost, Fin.sum_univ_succ, ih, Nat.add_comm] + +theorem eval_eq_constant_or_input_of_registerCost_eq_zero [Field F] + {r : ℕ} (p : Program F Input r) (i : Fin r) (hi : p.registerCost i = 0) : + (∃ z : F, ∀ inputs, p.eval inputs i = z) ∨ + (∃ a : Input, ∀ inputs, p.eval inputs i = inputs a) := by + revert i + induction p with + | nil => intro i; exact Fin.elim0 i + | @step r p g ih => + intro i hi + revert hi + refine Fin.cases ?_ (fun j => ?_) i + · intro hi + change g.cost = 0 at hi + cases g with + | constant z => exact Or.inl ⟨z, fun _ => rfl⟩ + | input a => exact Or.inr ⟨a, fun _ => rfl⟩ + | add a b => simp [Gate.cost] at hi + | sub a b => simp [Gate.cost] at hi + | mul a b => simp [Gate.cost] at hi + · intro hi + simpa only [eval_step_succ] using ih j hi + +end Program + +section ElementaryMatrices + +variable {F : Type*} [Field F] {a b c : ℕ} + +def elementaryLeft (i : Fin a) (j : Fin b) : Matrix (Fin a) (Fin b) F := + fun x y => if x = i then if y = j then 1 else 0 else 0 + +def elementaryRight (j : Fin b) (k : Fin c) : Matrix (Fin b) (Fin c) F := + fun y z => if z = k then if y = j then 1 else 0 else 0 + +theorem elementaryProduct (i x : Fin a) (j : Fin b) (k z : Fin c) : + (elementaryLeft (F := F) i j * elementaryRight (F := F) j k) x z = + if (x, z) = (i, k) then 1 else 0 := by + by_cases hi : x = i <;> by_cases hk : z = k <;> + simp [Matrix.mul_apply, elementaryLeft, elementaryRight, hi, hk] + +end ElementaryMatrices + +namespace MatrixAlgorithm + +variable {F : Type*} [Field F] {a b c : ℕ} + +theorem output_injective (P : MatrixAlgorithm F a b c) (hb : 1 ≤ b) + (hP : P.Correct) : Function.Injective (fun o : Fin a × Fin c => P.output o.1 o.2) := by + classical + intro x y hxy + change P.output x.1 x.2 = P.output y.1 y.2 at hxy + let j : Fin b := ⟨0, by omega⟩ + let A := elementaryLeft (F := F) x.1 j + let B := elementaryRight (F := F) j x.2 + have hx := congrFun (congrFun (hP A B) x.1) x.2 + have hy := congrFun (congrFun (hP A B) y.1) y.2 + have heq : (A * B) x.1 x.2 = (A * B) y.1 y.2 := by + rw [← hx, ← hy] + change P.program.eval (matrixInputs A B) (P.output x.1 x.2) = + P.program.eval (matrixInputs A B) (P.output y.1 y.2) + rw [hxy] + simp only [A, B, elementaryProduct, Prod.eta, ite_true] at heq + by_contra hne + have hyx : y ≠ x := Ne.symm hne + simp [hyx] at heq + +theorem one_le_output_registerCost (P : MatrixAlgorithm F a b c) (hb : 1 ≤ b) + (hP : P.Correct) (i : Fin a) (k : Fin c) : + 1 ≤ P.program.registerCost (P.output i k) := by + by_contra hn + have hzero : P.program.registerCost (P.output i k) = 0 := by omega + let j : Fin b := ⟨0, by omega⟩ + have hentry (A : Matrix (Fin a) (Fin b) F) (B : Matrix (Fin b) (Fin c) F) : + P.program.eval (matrixInputs A B) (P.output i k) = (A * B) i k := + congrFun (congrFun (hP A B) i) k + rcases P.program.eval_eq_constant_or_input_of_registerCost_eq_zero + (P.output i k) hzero with ⟨z, hz⟩ | ⟨u, hu⟩ + · have hz0 : z = 0 := by + have h := hentry 0 0 + rw [hz] at h + simpa using h + have hz1 : z = 1 := by + have h := hentry (elementaryLeft i j) (elementaryRight j k) + rw [hz] at h + simpa only [elementaryProduct, ite_true] using h + exact (zero_ne_one : (0 : F) ≠ 1) (hz0.symm.trans hz1) + · rcases u with ⟨x, y⟩ | ⟨y, z⟩ + · have h := hentry (fun _ _ => 1) 0 + rw [hu] at h + change (1 : F) = ∑ _ : Fin b, (1 : F) * 0 at h + simp at h + · have h := hentry 0 (fun _ _ => 1) + rw [hu] at h + change (1 : F) = ∑ _ : Fin b, (0 : F) * 1 at h + simp at h + +theorem output_size_le_cost (P : MatrixAlgorithm F a b c) (hb : 1 ≤ b) + (hP : P.Correct) : a * c ≤ P.cost := by + classical + let f : Fin a × Fin c → Fin P.registers := fun o => P.output o.1 o.2 + have hf : Function.Injective f := P.output_injective hb hP + calc + a * c = ∑ _o : Fin a × Fin c, (1 : ℕ) := by simp + _ ≤ ∑ o : Fin a × Fin c, P.program.registerCost (f o) := by + apply Finset.sum_le_sum + intro o ho + exact P.one_le_output_registerCost hb hP o.1 o.2 + _ = ∑ r ∈ Finset.univ.image f, P.program.registerCost r := by + rw [Finset.sum_image] + exact fun _ _ _ _ h => hf h + _ ≤ ∑ r, P.program.registerCost r := + Finset.sum_le_sum_of_subset (Finset.subset_univ _) + _ = P.cost := P.program.sum_registerCost + +end MatrixAlgorithm + +theorem rectangularAdmissibleExponent_two_le {F : Type*} [Field F] {k τ : ℝ} + (hτ : RectangularAdmissibleExponent F k τ) : 2 ≤ τ := by + by_contra hneg + have hτlt : τ < 2 := lt_of_not_ge hneg + let ε : ℝ := (2 - τ) / 2 + have hε : 0 < ε := by dsimp [ε]; linarith + obtain ⟨C, hC, hbound⟩ := hτ ε hε + obtain ⟨n, hn⟩ := exists_nat_gt (max (C ^ ε⁻¹) 1) + have hnreal : 1 < (n : ℝ) := lt_of_le_of_lt (le_max_right _ _) hn + have hnpos : 0 < (n : ℝ) := lt_trans zero_lt_one hnreal + have hn1 : 1 ≤ n := (Nat.one_le_cast (α := ℝ)).mp hnreal.le + have hpow : C < (n : ℝ) ^ ε := + (Real.rpow_inv_lt_iff_of_pos hC.le (Nat.cast_nonneg n) hε).mp + (lt_of_le_of_lt (le_max_left _ _) hn) + obtain ⟨P, hP, hcost⟩ := hbound n hn1 + have hlower : (n : ℝ) ^ (2 : ℕ) ≤ P.cost := by + have h : n ^ 2 ≤ P.cost := by + simpa [pow_two] using P.output_size_le_cost (one_le_innerSize hn1 k) hP + exact_mod_cast h + have hstrict : (n : ℝ) ^ (2 : ℕ) < (n : ℝ) ^ (2 : ℕ) := calc + (n : ℝ) ^ (2 : ℕ) ≤ C * (n : ℝ) ^ (τ + ε) := hlower.trans hcost + _ < (n : ℝ) ^ ε * (n : ℝ) ^ (τ + ε) := + mul_lt_mul_of_pos_right hpow (Real.rpow_pos_of_pos hnpos _) + _ = (n : ℝ) ^ (2 : ℕ) := by + rw [← Real.rpow_add hnpos] + have he : ε + (τ + ε) = 2 := by dsimp [ε]; ring + rw [he] + norm_num + exact (lt_irrefl _ hstrict) + +theorem rectangularAdmissibleExponent_bddBelow (F : Type*) [Field F] (k : ℝ) : + BddBelow {τ : ℝ | RectangularAdmissibleExponent F k τ} := + ⟨2, fun _ h => rectangularAdmissibleExponent_two_le h⟩ + +theorem rectangularOmega_le_of_admissibleExponent {F : Type*} [Field F] {k τ : ℝ} + (hτ : RectangularAdmissibleExponent F k τ) : rectangularOmega F k ≤ τ := + csInf_le (rectangularAdmissibleExponent_bddBelow F k) hτ + +theorem admissibleExponent_iff_rectangular_one (F : Type*) [Field F] (τ : ℝ) : + AdmissibleExponent F τ ↔ RectangularAdmissibleExponent F 1 τ := by + constructor + · intro h ε hε + obtain ⟨C, hC, hbound⟩ := h ε hε + refine ⟨C, hC, ?_⟩ + intro n hn + rw [innerSize_one] + exact hbound n hn + · intro h ε hε + obtain ⟨C, hC, hbound⟩ := h ε hε + refine ⟨C, hC, ?_⟩ + intro n hn + have hnBound := hbound n hn + rw [innerSize_one] at hnBound + exact hnBound + +theorem admissibleExponent_two_le {F : Type*} [Field F] {τ : ℝ} + (hτ : AdmissibleExponent F τ) : 2 ≤ τ := + rectangularAdmissibleExponent_two_le ((admissibleExponent_iff_rectangular_one F τ).mp hτ) + +theorem admissibleExponent_bddBelow (F : Type*) [Field F] : + BddBelow {τ : ℝ | AdmissibleExponent F τ} := + ⟨2, fun _ h => admissibleExponent_two_le h⟩ + +theorem omega_le_of_admissibleExponent {F : Type*} [Field F] {τ : ℝ} + (hτ : AdmissibleExponent F τ) : omega F ≤ τ := + csInf_le (admissibleExponent_bddBelow F) hτ + +@[simp] theorem rectangularOmega_one (F : Type*) [Field F] : + rectangularOmega F 1 = omega F := by + unfold rectangularOmega omega + congr 1 + ext τ + exact (admissibleExponent_iff_rectangular_one F τ).symm + +end + +variable {F : Type*} [Field F] + +namespace Expression + +variable {Input : Type*} + +def sumFin : {n : ℕ} → (Fin n → Expression F Input) → Expression F Input + | 0, _ => .constant 0 + | n + 1, f => .add (f 0) (sumFin (fun i : Fin n => f i.succ)) + +theorem sumFin_eval {n : ℕ} (f : Fin n → Expression F Input) (inputs : Input → F) : + (sumFin f).eval inputs = ∑ i, (f i).eval inputs := by + induction n with + | zero => simp [sumFin, eval] + | succ n ih => simp [sumFin, eval, ih, Fin.sum_univ_succ] + +theorem sumFin_cost {n : ℕ} (f : Fin n → Expression F Input) : + (sumFin f).cost = (∑ i, (f i).cost) + n := by + induction n with + | zero => simp [sumFin, cost] + | succ n ih => + simp only [sumFin, cost, ih, Fin.sum_univ_succ] + omega + +end Expression + +def naiveEntry {a b c : ℕ} (i : Fin a) (k : Fin c) : Expression F (MatrixInput a b c) := + Expression.sumFin fun j : Fin b => + .mul (.input (.inl (i, j))) (.input (.inr (j, k))) + +theorem naiveEntry_eval {a b c : ℕ} (i : Fin a) (k : Fin c) + (A : Matrix (Fin a) (Fin b) F) (B : Matrix (Fin b) (Fin c) F) : + (naiveEntry i k).eval (matrixInputs A B) = ∑ j, A i j * B j k := by + simp [naiveEntry, Expression.sumFin_eval, Expression.eval, matrixInputs] + +@[simp] theorem naiveEntry_cost {a b c : ℕ} (i : Fin a) (k : Fin c) : + (naiveEntry (F := F) (b := b) i k).cost = 2 * b := by + simp [naiveEntry, Expression.sumFin_cost, Expression.cost, two_mul] + +def naiveAlgorithm (a b c : ℕ) : MatrixAlgorithm F a b c := + let p := Expression.compileFamily (fun ik : Fin a × Fin c => naiveEntry (b := b) ik.1 ik.2) + { registers := p.registers + program := p.program + output := fun i k => p.output (i, k) } + +theorem naiveAlgorithm_correct (a b c : ℕ) : (naiveAlgorithm (F := F) a b c).Correct := by + apply (MatrixAlgorithm.correct_iff_entries _).2 + intro A B i k + let p := Expression.compileFamily (fun ik : Fin a × Fin c => naiveEntry (F := F) (b := b) ik.1 ik.2) + change p.program.eval (matrixInputs A B) (p.output (i, k)) = _ + rw [p.correct] + exact naiveEntry_eval i k A B + +@[simp] theorem naiveAlgorithm_cost (a b c : ℕ) : + (naiveAlgorithm (F := F) a b c).cost = 2 * a * b * c := by + let p := Expression.compileFamily (fun ik : Fin a × Fin c => naiveEntry (F := F) (b := b) ik.1 ik.2) + change p.program.cost = _ + rw [p.cost_eq] + simp only [naiveEntry_cost, Finset.sum_const, Finset.card_univ, + Fintype.card_prod, Fintype.card_fin, nsmul_eq_mul, Nat.cast_id] + ring + +theorem naiveAlgorithm_cost_le (a b c : ℕ) : + (naiveAlgorithm (F := F) a b c).cost ≤ 2 * a * b * c := + (naiveAlgorithm_cost a b c).le + +theorem admissibleExponent_three : AdmissibleExponent F 3 := by + intro ε hε + refine ⟨2, by norm_num, ?_⟩ + intro n hn + refine ⟨naiveAlgorithm n n n, naiveAlgorithm_correct n n n, ?_⟩ + rw [naiveAlgorithm_cost] + have hnR : (1 : ℝ) ≤ (n : ℝ) := by exact_mod_cast hn + have hpow : (n : ℝ) ^ (3 : ℝ) ≤ (n : ℝ) ^ (3 + ε) := + Real.rpow_le_rpow_of_exponent_le hnR (le_add_of_nonneg_right hε.le) + calc + ((2 * n * n * n : ℕ) : ℝ) = 2 * (n : ℝ) ^ (3 : ℝ) := by + calc + ((2 * n * n * n : ℕ) : ℝ) = 2 * (n : ℝ) ^ (3 : ℕ) := by + push_cast + ring + _ = 2 * (n : ℝ) ^ (3 : ℝ) := + congrArg (fun t : ℝ => 2 * t) (Real.rpow_natCast (n : ℝ) 3).symm + _ ≤ 2 * (n : ℝ) ^ (3 + ε) := mul_le_mul_of_nonneg_left hpow (by norm_num) + +theorem admissibleExponent_nonempty : Set.Nonempty {τ : ℝ | AdmissibleExponent F τ} := + ⟨3, admissibleExponent_three⟩ + +end MatrixMultiplication.Arithmetic + +end + +noncomputable section + +namespace MatrixMultiplication.Arithmetic + +variable {F : Type*} [Field F] + +theorem AdmissibleExponent.mono {τ σ : ℝ} (hτ : AdmissibleExponent F τ) + (hτσ : τ ≤ σ) : AdmissibleExponent F σ := by + intro ε hε + obtain ⟨C, hC, hbound⟩ := hτ ε hε + refine ⟨C, hC, ?_⟩ + intro n hn + obtain ⟨P, hP, hcost⟩ := hbound n hn + refine ⟨P, hP, hcost.trans ?_⟩ + apply mul_le_mul_of_nonneg_left _ hC.le + exact Real.rpow_le_rpow_of_exponent_le (by exact_mod_cast hn) + (add_le_add hτσ le_rfl) + +theorem omega_two_le : 2 ≤ omega F := + le_csInf admissibleExponent_nonempty (fun _ hτ => admissibleExponent_two_le hτ) + +theorem omega_nonneg : 0 ≤ omega F := le_trans (by norm_num) omega_two_le + +theorem omega_le_three : omega F ≤ 3 := + omega_le_of_admissibleExponent admissibleExponent_three + +theorem omega_admissibleExponent : AdmissibleExponent F (omega F) := by + intro ε hε + have hhalf : 0 < ε / 2 := half_pos hε + obtain ⟨τ, hτ, hclose⟩ := exists_lt_of_csInf_lt admissibleExponent_nonempty + (show sInf {σ : ℝ | AdmissibleExponent F σ} < omega F + ε / 2 from + lt_add_of_pos_right (omega F) hhalf) + obtain ⟨C, hC, hbound⟩ := hτ (ε / 2) hhalf + refine ⟨C, hC, ?_⟩ + intro n hn + obtain ⟨P, hP, hcost⟩ := hbound n hn + refine ⟨P, hP, hcost.trans ?_⟩ + apply mul_le_mul_of_nonneg_left _ hC.le + exact Real.rpow_le_rpow_of_exponent_le (by exact_mod_cast hn) (by linarith) + +theorem admissibleExponent_iff_omega_le {τ : ℝ} : + AdmissibleExponent F τ ↔ omega F ≤ τ := + ⟨omega_le_of_admissibleExponent, omega_admissibleExponent.mono⟩ + +theorem RectangularAdmissibleExponent.mono {k τ σ : ℝ} + (hτ : RectangularAdmissibleExponent F k τ) (hτσ : τ ≤ σ) : + RectangularAdmissibleExponent F k σ := by + intro ε hε + obtain ⟨C, hC, hbound⟩ := hτ ε hε + refine ⟨C, hC, ?_⟩ + intro n hn + obtain ⟨P, hP, hcost⟩ := hbound n hn + refine ⟨P, hP, hcost.trans ?_⟩ + apply mul_le_mul_of_nonneg_left _ hC.le + exact Real.rpow_le_rpow_of_exponent_le (by exact_mod_cast hn) + (add_le_add hτσ le_rfl) + +theorem rectangularAdmissibleExponent_of_uniform_costs {k τ C : ℝ} (hC : 0 < C) + (hbound : ∀ n : ℕ, 1 ≤ n → ∃ P : MatrixAlgorithm F n (innerSize n k) n, + P.Correct ∧ (P.cost : ℝ) ≤ C * (n : ℝ) ^ τ) : + RectangularAdmissibleExponent F k τ := by + intro ε hε + refine ⟨C, hC, ?_⟩ + intro n hn + obtain ⟨P, hP, hcost⟩ := hbound n hn + refine ⟨P, hP, hcost.trans ?_⟩ + apply mul_le_mul_of_nonneg_left _ hC.le + exact Real.rpow_le_rpow_of_exponent_le (by exact_mod_cast hn) + (le_add_of_nonneg_right hε.le) + +theorem rectangularAdmissibleExponent_naive (k : ℝ) : + RectangularAdmissibleExponent F k (2 + max k 0) := by + apply rectangularAdmissibleExponent_of_uniform_costs (C := 4) (by norm_num) + intro n hn + refine ⟨naiveAlgorithm n (innerSize n k) n, + naiveAlgorithm_correct n (innerSize n k) n, ?_⟩ + have hnpos : 0 < (n : ℝ) := by exact_mod_cast (lt_of_lt_of_le Nat.zero_lt_one hn) + have hinner : (innerSize n k : ℝ) ≤ 2 * (n : ℝ) ^ max k 0 := + (Nat.cast_le.mpr (innerSize_mono hn (le_max_left k 0))).trans + (innerSize_cast_le hn (le_max_right k 0)) + rw [naiveAlgorithm_cost] + push_cast + calc + 2 * (n : ℝ) * innerSize n k * n = 2 * (n : ℝ) ^ 2 * innerSize n k := by ring + _ ≤ 2 * (n : ℝ) ^ 2 * (2 * (n : ℝ) ^ max k 0) := + mul_le_mul_of_nonneg_left hinner (by positivity) + _ = 4 * (n : ℝ) ^ (2 + max k 0) := by + rw [Real.rpow_add hnpos] + norm_num + ring + +theorem rectangularAdmissibleExponent_nonempty (k : ℝ) : + Set.Nonempty {τ : ℝ | RectangularAdmissibleExponent F k τ} := + ⟨2 + max k 0, rectangularAdmissibleExponent_naive k⟩ + +theorem rectangularOmega_two_le (k : ℝ) : 2 ≤ rectangularOmega F k := + le_csInf (rectangularAdmissibleExponent_nonempty k) + (fun _ hτ => rectangularAdmissibleExponent_two_le hτ) + +theorem rectangularOmega_admissibleExponent (k : ℝ) : + RectangularAdmissibleExponent F k (rectangularOmega F k) := by + intro ε hε + have hhalf : 0 < ε / 2 := half_pos hε + obtain ⟨τ, hτ, hclose⟩ := exists_lt_of_csInf_lt (rectangularAdmissibleExponent_nonempty k) + (show sInf {σ : ℝ | RectangularAdmissibleExponent F k σ} < + rectangularOmega F k + ε / 2 from lt_add_of_pos_right (rectangularOmega F k) hhalf) + obtain ⟨C, hC, hbound⟩ := hτ (ε / 2) hhalf + refine ⟨C, hC, ?_⟩ + intro n hn + obtain ⟨P, hP, hcost⟩ := hbound n hn + refine ⟨P, hP, hcost.trans ?_⟩ + apply mul_le_mul_of_nonneg_left _ hC.le + exact Real.rpow_le_rpow_of_exponent_le (by exact_mod_cast hn) (by linarith) + +theorem rectangularAdmissibleExponent_iff_omega_le {k τ : ℝ} : + RectangularAdmissibleExponent F k τ ↔ rectangularOmega F k ≤ τ := + ⟨rectangularOmega_le_of_admissibleExponent, (rectangularOmega_admissibleExponent k).mono⟩ + +theorem rectangularOmega_mono {k l : ℝ} (hkl : k ≤ l) : + rectangularOmega F k ≤ rectangularOmega F l := + rectangularOmega_le_of_admissibleExponent + ((rectangularOmega_admissibleExponent l).mono_aspect hkl) + +@[simp] theorem rectangularOmega_zero : rectangularOmega F 0 = 2 := by + apply le_antisymm _ (rectangularOmega_two_le 0) + apply rectangularOmega_le_of_admissibleExponent + simpa using (rectangularAdmissibleExponent_naive (F := F) 0) + +theorem complexAlpha_set_nonempty : + Set.Nonempty {k : ℝ | k ∈ Set.Icc 0 1 ∧ rectangularOmega ℂ k = 2} := + ⟨0, ⟨by norm_num, by norm_num⟩, rectangularOmega_zero⟩ + +theorem complexAlpha_set_bddAbove : + BddAbove {k : ℝ | k ∈ Set.Icc 0 1 ∧ rectangularOmega ℂ k = 2} := + ⟨1, fun _ h => h.1.2⟩ + +theorem le_complexAlpha {k : ℝ} (hk : k ∈ Set.Icc 0 1) + (hω : rectangularOmega ℂ k = 2) : k ≤ complexAlpha := + le_csSup complexAlpha_set_bddAbove ⟨hk, hω⟩ + +theorem complexAlpha_le_one : complexAlpha ≤ 1 := + csSup_le complexAlpha_set_nonempty (fun _ h => h.1.2) + +theorem complexAlpha_nonneg : 0 ≤ complexAlpha := + le_complexAlpha ⟨le_refl 0, by norm_num⟩ rectangularOmega_zero + +end MatrixMultiplication.Arithmetic + +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/Arithmetic/ArithmeticPrograms.lean b/lean/OAI/LinearAlgebra/MatrixFields/Arithmetic/ArithmeticPrograms.lean new file mode 100644 index 0000000000000000000000000000000000000000..4fcaa572f69dc89d1ad3eb51185e28ebded17e26 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/Arithmetic/ArithmeticPrograms.lean @@ -0,0 +1,194 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Arithmetic.ArithmeticComplexity + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section + +namespace MatrixMultiplication.Arithmetic + +variable {F : Type*} [Field F] + +namespace Gate + +variable {Input R S : Type*} + +def mapRegister (f : R → S) : Gate F Input R → Gate F Input S + | .constant z => .constant z + | .input i => .input i + | .add i j => .add (f i) (f j) + | .sub i j => .sub (f i) (f j) + | .mul i j => .mul (f i) (f j) + +theorem eval_mapRegister (g : Gate F Input R) (f : R → S) + (inputs : Input → F) (registers : S → F) : + (g.mapRegister f).eval inputs registers = g.eval inputs (fun i => registers (f i)) := by + cases g <;> rfl + +omit [Field F] in +@[simp] theorem cost_mapRegister (g : Gate F Input R) (f : R → S) : + (g.mapRegister f).cost = g.cost := by + cases g <;> rfl + +end Gate + +namespace Program + +variable {Input : Type*} + +def oldIndex (r s : ℕ) (i : Fin r) : Fin (r + s) := ⟨s + i.val, by omega⟩ + +def newIndex (r s : ℕ) (i : Fin s) : Fin (r + s) := ⟨i.val, by omega⟩ + +@[simp] theorem oldIndex_zero (r : ℕ) (i : Fin r) : oldIndex r 0 i = i := by + apply Fin.ext + simp [oldIndex] + +@[simp] theorem oldIndex_succ (r s : ℕ) (i : Fin r) : + oldIndex r (s + 1) i = (oldIndex r s i).succ := by + apply Fin.ext + simp only [oldIndex, Fin.val_succ] + omega + +@[simp] theorem newIndex_zero (r s : ℕ) : newIndex r (s + 1) 0 = 0 := by + apply Fin.ext + rfl + +@[simp] theorem newIndex_succ (r s : ℕ) (i : Fin s) : + newIndex r (s + 1) i.succ = (newIndex r s i).succ := by + apply Fin.ext + rfl + +def append {r : ℕ} (p : Program F Input r) : {s : ℕ} → Program F Input s → Program F Input (r + s) + | 0, .nil => p + | s + 1, .step q g => (p.append q).step (g.mapRegister (newIndex r s)) + +theorem eval_append_new {r s : ℕ} (p : Program F Input r) (q : Program F Input s) + (inputs : Input → F) : + ∀ i : Fin s, (p.append q).eval inputs (newIndex r s i) = q.eval inputs i := by + induction q with + | nil => intro i; exact Fin.elim0 i + | @step s q g ih => + intro i + refine Fin.cases ?_ (fun j => ?_) i + · simp only [append, newIndex_zero, eval_step_zero, Gate.eval_mapRegister] + rw [funext ih] + · simpa only [append, newIndex_succ, eval_step_succ] using ih j + +theorem eval_append_old {r s : ℕ} (p : Program F Input r) (q : Program F Input s) + (inputs : Input → F) : + ∀ i : Fin r, (p.append q).eval inputs (oldIndex r s i) = p.eval inputs i := by + induction q with + | nil => intro i; simp [append] + | @step s q g ih => + intro i + simpa only [append, oldIndex_succ, eval_step_succ] using ih i + +omit [Field F] in +@[simp] theorem cost_append {r s : ℕ} (p : Program F Input r) (q : Program F Input s) : + (p.append q).cost = p.cost + q.cost := by + induction q with + | nil => simp [append, cost] + | @step s q g ih => simp [append, ih, Nat.add_assoc] + +end Program + +inductive Expression (F Input : Type*) where + | constant : F → Expression F Input + | input : Input → Expression F Input + | add : Expression F Input → Expression F Input → Expression F Input + | sub : Expression F Input → Expression F Input → Expression F Input + | mul : Expression F Input → Expression F Input → Expression F Input + +namespace Expression + +variable {Input : Type*} + +def eval (inputs : Input → F) : Expression F Input → F + | .constant z => z + | .input i => inputs i + | .add e f => e.eval inputs + f.eval inputs + | .sub e f => e.eval inputs - f.eval inputs + | .mul e f => e.eval inputs * f.eval inputs + +def cost : Expression F Input → ℕ + | .constant _ => 0 + | .input _ => 0 + | .add e f => e.cost + f.cost + 1 + | .sub e f => e.cost + f.cost + 1 + | .mul e f => e.cost + f.cost + 1 + +structure Compiled (e : Expression F Input) where + registers : ℕ + program : Program F Input registers + output : Fin registers + correct : ∀ inputs, program.eval inputs output = e.eval inputs + cost_eq : program.cost = e.cost + +def compile : (e : Expression F Input) → Compiled e + | .constant z => + { registers := 1 + program := Program.nil.step (.constant z) + output := 0 + correct := fun _ => rfl + cost_eq := rfl } + | .input i => + { registers := 1 + program := Program.nil.step (.input i) + output := 0 + correct := fun _ => rfl + cost_eq := rfl } + | .add e f => + let p := compile e + let q := compile f + { registers := p.registers + q.registers + 1 + program := (p.program.append q.program).step + (.add (Program.oldIndex _ _ p.output) (Program.newIndex _ _ q.output)) + output := 0 + correct := by + intro inputs + simp only [Program.eval_step_zero, Gate.eval, Program.eval_append_old, + Program.eval_append_new, p.correct, q.correct, eval] + cost_eq := by + simp only [Program.cost_step, Program.cost_append, Gate.cost, p.cost_eq, q.cost_eq, cost] } + | .sub e f => + let p := compile e + let q := compile f + { registers := p.registers + q.registers + 1 + program := (p.program.append q.program).step + (.sub (Program.oldIndex _ _ p.output) (Program.newIndex _ _ q.output)) + output := 0 + correct := by + intro inputs + simp only [Program.eval_step_zero, Gate.eval, Program.eval_append_old, + Program.eval_append_new, p.correct, q.correct, eval] + cost_eq := by + simp only [Program.cost_step, Program.cost_append, Gate.cost, p.cost_eq, q.cost_eq, cost] } + | .mul e f => + let p := compile e + let q := compile f + { registers := p.registers + q.registers + 1 + program := (p.program.append q.program).step + (.mul (Program.oldIndex _ _ p.output) (Program.newIndex _ _ q.output)) + output := 0 + correct := by + intro inputs + simp only [Program.eval_step_zero, Gate.eval, Program.eval_append_old, + Program.eval_append_new, p.correct, q.correct, eval] + cost_eq := by + simp only [Program.cost_step, Program.cost_append, Gate.cost, p.cost_eq, q.cost_eq, cost] } + +end Expression +end MatrixMultiplication.Arithmetic + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/Arithmetic/CommonDimensions.lean b/lean/OAI/LinearAlgebra/MatrixFields/Arithmetic/CommonDimensions.lean new file mode 100644 index 0000000000000000000000000000000000000000..aeb6ae1ad73c830b759fc32ffee2ec4e5a546652 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/Arithmetic/CommonDimensions.lean @@ -0,0 +1,91 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Tensors.TerminalRelabel + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +open scoped BigOperators +open MatrixMultiplication.Foundation + +namespace MatrixMultiplication.CommonDimensions + +variable {K H : Type*} [CommSemiring K] [Fintype H] [DecidableEq H] + +def familyProduct {X Y Z : H → Type*} (T : ∀ h, Tensor K (X h) (Y h) (Z h)) : + Tensor K (∀ h, X h) (∀ h, Y h) (∀ h, Z h) := + fun x y z => ∏ h, T h (x h) (y h) (z h) + +def pairWords (A B : H → Type*) : + ((∀ h, A h) × (∀ h, B h)) ≃ (∀ h, A h × B h) where + toFun x h := (x.1 h, x.2 h) + invFun x := (fun h => (x h).1, fun h => (x h).2) + left_inv _ := rfl + right_inv _ := rfl + +omit [DecidableEq H] in +theorem matrix_familyProduct (A B C : H → Type*) + [∀ h, DecidableEq (A h)] [∀ h, DecidableEq (B h)] [∀ h, DecidableEq (C h)] : + Tensor.pullback (pairWords A B) (pairWords B C) (pairWords C A) + (familyProduct (fun h => Tensor.matrixCoefficients (K := K) (A h) (B h) (C h))) = + Tensor.matrixCoefficients (∀ h, A h) (∀ h, B h) (∀ h, C h) := by + classical + funext x y z + simp only [Tensor.pullback, pairWords, familyProduct, Tensor.matrixCoefficients, + Equiv.coe_fn_mk] + by_cases matched : x.2 = y.1 ∧ y.2 = z.1 ∧ z.2 = x.1 + · simp [matched.1, matched.2.1, matched.2.2] + · have mismatch : ¬ ∀ index : H, + x.2 index = y.1 index ∧ y.2 index = z.1 index ∧ z.2 index = x.1 index := by + intro pointwise + exact matched ⟨funext (fun index => (pointwise index).1), + funext (fun index => (pointwise index).2.1), + funext (fun index => (pointwise index).2.2)⟩ + obtain ⟨index, mismatch⟩ := not_forall.mp mismatch + simp only [matched, ite_false] + apply Finset.prod_eq_zero (Finset.mem_univ index) + simp only [mismatch, ite_false] + +theorem matrix_familyProduct_restrict (A B C : H → Type*) + [∀ h, Fintype (A h)] [∀ h, Fintype (B h)] [∀ h, Fintype (C h)] + [∀ h, DecidableEq (A h)] [∀ h, DecidableEq (B h)] [∀ h, DecidableEq (C h)] : + ∃ (a : ((∀ h, A h) × (∀ h, B h)) → (∀ h, A h × B h) → K) + (b : ((∀ h, B h) × (∀ h, C h)) → (∀ h, B h × C h) → K) + (c : ((∀ h, C h) × (∀ h, A h)) → (∀ h, C h × A h) → K), + Tensor.restrict a b c + (familyProduct (fun h => Tensor.matrixCoefficients (K := K) (A h) (B h) (C h))) = + Tensor.matrixCoefficients (∀ h, A h) (∀ h, B h) (∀ h, C h) := by + classical + refine ⟨(fun x s => if s = pairWords A B x then 1 else 0), + (fun y s => if s = pairWords B C y then 1 else 0), + (fun z s => if s = pairWords C A z then 1 else 0), ?_⟩ + rw [← Tensor.pullback_eq_restrict] + exact matrix_familyProduct A B C + +theorem dimension_card (a : H → ℕ) : + Fintype.card (∀ h, Fin (a h)) = ∏ h, a h := by simp + +theorem volume_card (a b c : H → ℕ) : + Fintype.card (∀ h, Fin (a h)) * Fintype.card (∀ h, Fin (b h)) * + Fintype.card (∀ h, Fin (c h)) = ∏ h, a h * b h * c h := by + simp [Finset.prod_mul_distrib] + +theorem common_oriented_dimensions {S : Type*} + (a b c : S → H → ℕ) (a₀ b₀ c₀ : H → ℕ) + (ha : ∀ s h, a s h = a₀ h) (hb : ∀ s h, b s h = b₀ h) + (hc : ∀ s h, c s h = c₀ h) (s : S) : + (Fintype.card (∀ h, Fin (a s h)), Fintype.card (∀ h, Fin (b s h)), + Fintype.card (∀ h, Fin (c s h))) = + (∏ h, a₀ h, ∏ h, b₀ h, ∏ h, c₀ h) := by + simp [ha, hb, hc] + +end MatrixMultiplication.CommonDimensions + +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/Arithmetic/ComplexArithmeticExponent.lean b/lean/OAI/LinearAlgebra/MatrixFields/Arithmetic/ComplexArithmeticExponent.lean new file mode 100644 index 0000000000000000000000000000000000000000..1bbaaceed1d4592ed06147585c874fd577612cdb --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/Arithmetic/ComplexArithmeticExponent.lean @@ -0,0 +1,153 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Construction.ComplexExpressionFamily + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +noncomputable section + +open scoped BigOperators + +namespace MatrixMultiplication.Foundation.Arithmetic + +namespace Expression + +variable {Input : Type*} + +def sumFin : {n : ℕ} → (Fin n → Expression Input) → Expression Input + | 0, _ => .constant 0 + | n + 1, f => .add (f 0) (sumFin (fun i : Fin n => f i.succ)) + +theorem sumFin_eval {n : ℕ} (f : Fin n → Expression Input) (inputs : Input → ℂ) : + (sumFin f).eval inputs = ∑ i, (f i).eval inputs := by + induction n with + | zero => simp [sumFin, eval] + | succ n ih => simp [sumFin, eval, ih, Fin.sum_univ_succ] + +theorem sumFin_cost {n : ℕ} (f : Fin n → Expression Input) : + (sumFin f).cost = (∑ i, (f i).cost) + n := by + induction n with + | zero => simp [sumFin, cost] + | succ n ih => + simp only [sumFin, cost, ih, Fin.sum_univ_succ] + omega + +end Expression + +def naiveEntry {n : ℕ} (i k : Fin n) : Expression (MatrixInput n) := + Expression.sumFin fun j : Fin n => + .mul (.input (.inl (i, j))) (.input (.inr (j, k))) + +theorem naiveEntry_eval {n : ℕ} (i k : Fin n) + (A B : Matrix (Fin n) (Fin n) ℂ) : + (naiveEntry i k).eval (matrixInputs A B) = ∑ j, A i j * B j k := by + simp [naiveEntry, Expression.sumFin_eval, Expression.eval, matrixInputs] + +@[simp] theorem naiveEntry_cost {n : ℕ} (i k : Fin n) : + (naiveEntry i k).cost = 2 * n := by + simp [naiveEntry, Expression.sumFin_cost, Expression.cost, two_mul] + +def naiveAlgorithm (n : ℕ) : MatrixAlgorithm n := + let p := Expression.compileFamily (fun ik : Fin n × Fin n => naiveEntry ik.1 ik.2) + { registers := p.registers + program := p.program + output := fun i k => p.output (i, k) } + +theorem naiveAlgorithm_correct (n : ℕ) : (naiveAlgorithm n).Correct := by + apply (MatrixAlgorithm.correct_iff_entries _).2 + intro A B i k + let p := Expression.compileFamily (fun ik : Fin n × Fin n => naiveEntry ik.1 ik.2) + change p.program.eval (matrixInputs A B) (p.output (i, k)) = _ + rw [p.correct] + exact naiveEntry_eval i k A B + +@[simp] theorem naiveAlgorithm_cost (n : ℕ) : (naiveAlgorithm n).cost = 2 * n ^ 3 := by + let p := Expression.compileFamily (fun ik : Fin n × Fin n => naiveEntry ik.1 ik.2) + change p.program.cost = _ + rw [p.cost_eq] + simp only [naiveEntry_cost, Finset.sum_const, Finset.card_univ, + Fintype.card_prod, Fintype.card_fin, nsmul_eq_mul, Nat.cast_id] + ring + +theorem naiveAlgorithm_cost_le (n : ℕ) : (naiveAlgorithm n).cost ≤ 2 * n ^ 3 := + (naiveAlgorithm_cost n).le + +theorem admissibleExponent_three : AdmissibleExponent 3 := by + intro ε hε + refine ⟨2, by norm_num, ?_⟩ + intro n hn + refine ⟨naiveAlgorithm n, naiveAlgorithm_correct n, ?_⟩ + rw [naiveAlgorithm_cost] + have hnR : (1 : ℝ) ≤ (n : ℝ) := by exact_mod_cast hn + have hpow : (n : ℝ) ^ (3 : ℝ) ≤ (n : ℝ) ^ (3 + ε) := + Real.rpow_le_rpow_of_exponent_le hnR (le_add_of_nonneg_right hε.le) + calc + ((2 * n ^ 3 : ℕ) : ℝ) = 2 * (n : ℝ) ^ (3 : ℝ) := by + calc + ((2 * n ^ 3 : ℕ) : ℝ) = 2 * (n : ℝ) ^ (3 : ℕ) := by + simp only [Nat.cast_mul, Nat.cast_pow, Nat.cast_ofNat] + _ = 2 * (n : ℝ) ^ (3 : ℝ) := + congrArg (fun t : ℝ => 2 * t) (Real.rpow_natCast (n : ℝ) 3).symm + _ ≤ 2 * (n : ℝ) ^ (3 + ε) := mul_le_mul_of_nonneg_left hpow (by norm_num) + +theorem admissibleExponent_nonempty : Set.Nonempty {τ : ℝ | AdmissibleExponent τ} := + ⟨3, admissibleExponent_three⟩ + +end MatrixMultiplication.Foundation.Arithmetic + +end + +noncomputable section + +namespace MatrixMultiplication.Foundation.Arithmetic + +theorem AdmissibleExponent.mono {τ σ : ℝ} (hτ : AdmissibleExponent τ) + (hτσ : τ ≤ σ) : AdmissibleExponent σ := by + intro ε hε + obtain ⟨C, hC, hbound⟩ := hτ ε hε + refine ⟨C, hC, ?_⟩ + intro n hn + obtain ⟨P, hP, hcost⟩ := hbound n hn + refine ⟨P, hP, hcost.trans ?_⟩ + apply mul_le_mul_of_nonneg_left _ hC.le + exact Real.rpow_le_rpow_of_exponent_le (by exact_mod_cast hn) + (add_le_add hτσ le_rfl) + +theorem omega_le_of_admissibleExponent {τ : ℝ} (hτ : AdmissibleExponent τ) : + omega ≤ τ := + csInf_le admissibleExponent_bddBelow hτ + +theorem omega_nonneg : 0 ≤ omega := + le_csInf admissibleExponent_nonempty (fun _ hτ => admissibleExponent_nonneg hτ) + +theorem omega_le_three : omega ≤ 3 := + omega_le_of_admissibleExponent admissibleExponent_three + +theorem omega_admissibleExponent : AdmissibleExponent omega := by + intro ε hε + have hhalf : 0 < ε / 2 := half_pos hε + obtain ⟨τ, hτ, hclose⟩ := exists_lt_of_csInf_lt admissibleExponent_nonempty + (show sInf {σ : ℝ | AdmissibleExponent σ} < omega + ε / 2 from + lt_add_of_pos_right omega hhalf) + obtain ⟨C, hC, hbound⟩ := hτ (ε / 2) hhalf + refine ⟨C, hC, ?_⟩ + intro n hn + obtain ⟨P, hP, hcost⟩ := hbound n hn + refine ⟨P, hP, hcost.trans ?_⟩ + apply mul_le_mul_of_nonneg_left _ hC.le + exact Real.rpow_le_rpow_of_exponent_le (by exact_mod_cast hn) (by linarith) + +theorem admissibleExponent_iff_omega_le {τ : ℝ} : + AdmissibleExponent τ ↔ omega ≤ τ := + ⟨omega_le_of_admissibleExponent, omega_admissibleExponent.mono⟩ + +end MatrixMultiplication.Foundation.Arithmetic + +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/Arithmetic/ComplexArithmeticGrowth.lean b/lean/OAI/LinearAlgebra/MatrixFields/Arithmetic/ComplexArithmeticGrowth.lean new file mode 100644 index 0000000000000000000000000000000000000000..c6a1aadbba96b086e723a9b9507c4fd79b945a14 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/Arithmetic/ComplexArithmeticGrowth.lean @@ -0,0 +1,578 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Construction.ComplexExpressionFamily +import OAI.LinearAlgebra.MatrixFields.Tensors.TerminalRelabel + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +noncomputable section + +open scoped BigOperators + +namespace MatrixMultiplication.Foundation.Arithmetic.RecursiveBlock + +namespace LinearExpression + +variable {Input : Type*} + +def sumFin : (n : ℕ) → (Fin n → Expression Input) → Expression Input + | 0, _ => .constant 0 + | n + 1, f => .add (f 0) (sumFin n (fun i => f i.succ)) + +theorem eval_sumFin (n : ℕ) (f : Fin n → Expression Input) (inputs : Input → ℂ) : + (sumFin n f).eval inputs = ∑ i, (f i).eval inputs := by + induction n with + | zero => simp [sumFin, Expression.eval] + | succ n ih => + simp only [sumFin, Expression.eval, ih, Fin.sum_univ_succ] + +theorem cost_sumFin (n : ℕ) (f : Fin n → Expression Input) : + (sumFin n f).cost = (∑ i, (f i).cost) + n := by + induction n with + | zero => simp [sumFin, Expression.cost] + | succ n ih => + simp only [sumFin, Expression.cost, ih, Fin.sum_univ_succ] + omega + +def linear {Term : Type*} [Fintype Term] (a : Term → ℂ) (wire : Term → Input) : + Expression Input := + sumFin (Fintype.card Term) (fun i => + .mul (.constant (a ((Fintype.equivFin Term).symm i))) + (.input (wire ((Fintype.equivFin Term).symm i)))) + +theorem eval_linear {Term : Type*} [Fintype Term] + (a : Term → ℂ) (wire : Term → Input) (inputs : Input → ℂ) : + (linear a wire).eval inputs = ∑ i, a i * inputs (wire i) := by + rw [linear, eval_sumFin] + exact (Fintype.equivFin Term).symm.sum_comp (fun i => a i * inputs (wire i)) + +theorem cost_linear {Term : Type*} [Fintype Term] + (a : Term → ℂ) (wire : Term → Input) : + (linear a wire).cost = 2 * Fintype.card Term := by + simp [linear, cost_sumFin, Expression.cost, two_mul] + +end LinearExpression + +structure Family (Input Output : Type*) where + registers : ℕ + program : Program Input registers + output : Output → Fin registers + +namespace Family + +variable {Input Mid Output : Type*} + +def eval (p : Family Input Output) (inputs : Input → ℂ) (o : Output) : ℂ := + p.program.eval inputs (p.output o) + +def cost (p : Family Input Output) : ℕ := p.program.cost + +def expressions [Fintype Output] (e : Output → Expression Input) : Family Input Output := + let p := Expression.compileFamily e + ⟨p.registers, p.program, p.output⟩ + +theorem eval_expressions [Fintype Output] (e : Output → Expression Input) + (inputs : Input → ℂ) (o : Output) : + (expressions e).eval inputs o = (e o).eval inputs := + (Expression.compileFamily e).correct inputs o + +theorem cost_expressions [Fintype Output] (e : Output → Expression Input) : + (expressions e).cost = ∑ o, (e o).cost := + (Expression.compileFamily e).cost_eq + +def compose (p : Family Input Mid) (q : Family Mid Output) : Family Input Output := + let s := p.program.substitute q.program p.output + ⟨s.registers, s.program, fun o => s.output (q.output o)⟩ + +theorem eval_compose (p : Family Input Mid) (q : Family Mid Output) + (inputs : Input → ℂ) (o : Output) : + (compose p q).eval inputs o = q.eval (p.eval inputs) o := + (p.program.substitute q.program p.output).correct inputs (q.output o) + +theorem cost_compose (p : Family Input Mid) (q : Family Mid Output) : + (compose p q).cost = p.cost + q.cost := + (p.program.substitute q.program p.output).cost_eq + +def mapInputs {NewInput : Type*} (f : Input → NewInput) (p : Family Input Output) : + Family NewInput Output := + ⟨p.registers, p.program.mapInput f, p.output⟩ + +theorem eval_mapInputs {NewInput : Type*} (f : Input → NewInput) + (p : Family Input Output) (inputs : NewInput → ℂ) (o : Output) : + (p.mapInputs f).eval inputs o = p.eval (fun i => inputs (f i)) o := by + exact Program.eval_mapInput f p.program inputs (p.output o) + +theorem cost_mapInputs {NewInput : Type*} (f : Input → NewInput) + (p : Family Input Output) : (p.mapInputs f).cost = p.cost := by + exact Program.cost_mapInput f p.program + +def parallel : (r : ℕ) → (Fin r → Family Input Output) → Family Input (Fin r × Output) + | 0, _ => ⟨0, Program.nil, fun o => Fin.elim0 o.1⟩ + | r + 1, p => + let head := p 0 + let tail := parallel r (fun i => p i.succ) + { registers := head.registers + tail.registers + program := head.program.append tail.program + output := fun o => Fin.cases + (Program.oldIndex _ _ (head.output o.2)) + (fun i => Program.newIndex _ _ (tail.output (i, o.2))) o.1 } + +theorem eval_parallel (r : ℕ) (p : Fin r → Family Input Output) + (inputs : Input → ℂ) (o : Fin r × Output) : + (parallel r p).eval inputs o = (p o.1).eval inputs o.2 := by + induction r with + | zero => exact Fin.elim0 o.1 + | succ r ih => + rcases o with ⟨i, o⟩ + refine Fin.cases ?_ (fun j => ?_) i + · exact Program.eval_append_old _ _ inputs _ + · exact (Program.eval_append_new _ _ inputs _).trans + (ih (fun j => p j.succ) (j, o)) + +theorem cost_parallel (r : ℕ) (p : Fin r → Family Input Output) : + (parallel r p).cost = ∑ i, (p i).cost := by + induction r with + | zero => simp [parallel, cost, Program.cost] + | succ r ih => + change ((p 0).program.append (parallel r (fun i => p i.succ)).program).cost = _ + rw [Program.cost_append] + change (p 0).cost + (parallel r (fun i => p i.succ)).cost = _ + rw [ih, Fin.sum_univ_succ] + +def copies (r : ℕ) (p : Family Input Output) : + Family (Fin r × Input) (Fin r × Output) := + parallel r (fun i => p.mapInputs (fun x => (i, x))) + +theorem eval_copies (r : ℕ) (p : Family Input Output) + (inputs : Fin r × Input → ℂ) (o : Fin r × Output) : + (copies r p).eval inputs o = p.eval (fun x => inputs (o.1, x)) o.2 := by + rw [copies, eval_parallel, eval_mapInputs] + +theorem cost_copies (r : ℕ) (p : Family Input Output) : + (copies r p).cost = r * p.cost := by + simp [copies, cost_parallel, cost_mapInputs] + +def ofMatrix {m : ℕ} (p : MatrixAlgorithm m) : + Family (MatrixInput m) (Fin m × Fin m) := + ⟨p.registers, p.program, fun o => p.output o.1 o.2⟩ + +@[simp] theorem cost_ofMatrix {m : ℕ} (p : MatrixAlgorithm m) : + (ofMatrix p).cost = p.cost := rfl + +theorem eval_ofMatrix {m : ℕ} (p : MatrixAlgorithm m) (hp : p.Correct) + (inputs : MatrixInput m → ℂ) (o : Fin m × Fin m) : + (ofMatrix p).eval inputs o = + ∑ j, inputs (.inl (o.1, j)) * inputs (.inr (j, o.2)) := by + have h := (MatrixAlgorithm.correct_iff_entries p).mp hp + (fun i j => inputs (.inl (i, j))) (fun j k => inputs (.inr (j, k))) o.1 o.2 + have hi : matrixInputs (fun i j => inputs (.inl (i, j))) + (fun j k => inputs (.inr (j, k))) = inputs := by + funext x + cases x <;> rfl + rw [hi] at h + exact h + +end Family + +section BlockIdentities + +variable {n r m : ℕ} + +def join (i : Fin n) (j : Fin m) : Fin (n * m) := finProdFinEquiv (i, j) + +theorem rank_bilinear_identity + (a b c : Fin r → Fin n × Fin n → ℂ) + (h : Tensor.matrixMultiplication n n n = + fun x y z => ∑ q, Tensor.rankOne (a q) (b q) (c q) x y z) + (left right : Fin n × Fin n → ℂ) (i k : Fin n) : + (∑ q, c q (k, i) * (∑ x, a q x * left x) * (∑ y, b q y * right y)) = + ∑ j, left (i, j) * right (j, k) := by + rw [← Tensor.contract_matrixCoefficients left right i k] + change _ = Tensor.contract (Tensor.matrixMultiplication n n n) left right (k, i) + rw [h] + simp only [Tensor.contract, Tensor.rankOne, Finset.sum_mul, Finset.mul_sum] + calc + (∑ q, ∑ y, ∑ x, c q (k, i) * (a q x * left x) * (b q y * right y)) = + ∑ q, ∑ x, ∑ y, c q (k, i) * (a q x * left x) * (b q y * right y) := by + apply Finset.sum_congr rfl + intro q hq + exact Finset.sum_comm + _ = + ∑ x, ∑ q, ∑ y, c q (k, i) * (a q x * left x) * (b q y * right y) := + Finset.sum_comm + _ = ∑ x, ∑ y, ∑ q, a q x * b q y * c q (k, i) * left x * right y := by + apply Finset.sum_congr rfl + intro x hx + rw [Finset.sum_comm] + apply Finset.sum_congr rfl + intro y hy + apply Finset.sum_congr rfl + intro q hq + ring + +def leftBlock (a : Fin r → Fin n × Fin n → ℂ) + (A : Matrix (Fin (n * m)) (Fin (n * m)) ℂ) (q : Fin r) : + Matrix (Fin m) (Fin m) ℂ := + fun s t => ∑ x, a q x * A (join x.1 s) (join x.2 t) + +def rightBlock (b : Fin r → Fin n × Fin n → ℂ) + (B : Matrix (Fin (n * m)) (Fin (n * m)) ℂ) (q : Fin r) : + Matrix (Fin m) (Fin m) ℂ := + fun t u => ∑ y, b q y * B (join y.1 t) (join y.2 u) + +theorem block_identity + (a b c : Fin r → Fin n × Fin n → ℂ) + (h : Tensor.matrixMultiplication n n n = + fun x y z => ∑ q, Tensor.rankOne (a q) (b q) (c q) x y z) + (A B : Matrix (Fin (n * m)) (Fin (n * m)) ℂ) + (i k : Fin n) (s u : Fin m) : + (∑ q, c q (k, i) * ((leftBlock a A q) * (rightBlock b B q)) s u) = + (A * B) (join i s) (join k u) := by + simp only [Matrix.mul_apply, Finset.mul_sum] + rw [Finset.sum_comm] + have hlocal (t : Fin m) := rank_bilinear_identity a b c h + (fun x => A (join x.1 s) (join x.2 t)) + (fun y => B (join y.1 t) (join y.2 u)) i k + simp only [leftBlock, rightBlock] + simp_rw [← mul_assoc, hlocal] + rw [Finset.sum_comm] + exact (Fintype.sum_prod_type _).symm.trans + (finProdFinEquiv.sum_comp (fun j => A (join i s) j * B j (join k u))) + +end BlockIdentities + +variable {n r m : ℕ} + +def inputExpressions (a b : Fin r → Fin n × Fin n → ℂ) : + Fin r × MatrixInput m → Expression (MatrixInput (n * m)) + | (q, .inl (s, t)) => LinearExpression.linear (a q) + (fun x => .inl (join x.1 s, join x.2 t)) + | (q, .inr (t, u)) => LinearExpression.linear (b q) + (fun y => .inr (join y.1 t, join y.2 u)) + +def inputFamily (a b : Fin r → Fin n × Fin n → ℂ) : + Family (MatrixInput (n * m)) (Fin r × MatrixInput m) := + Family.expressions (inputExpressions a b) + +theorem inputFamily_eval (a b : Fin r → Fin n × Fin n → ℂ) + (A B : Matrix (Fin (n * m)) (Fin (n * m)) ℂ) (q : Fin r) (x : MatrixInput m) : + (inputFamily a b).eval (matrixInputs A B) (q, x) = + matrixInputs (leftBlock a A q) (rightBlock b B q) x := by + cases x with + | inl x => + simp only [inputFamily, Family.eval_expressions, inputExpressions, + LinearExpression.eval_linear, matrixInputs, leftBlock] + | inr x => + simp only [inputFamily, Family.eval_expressions, inputExpressions, + LinearExpression.eval_linear, matrixInputs, rightBlock] + +theorem inputFamily_cost (a b : Fin r → Fin n × Fin n → ℂ) : + (inputFamily (m := m) a b).cost = 4 * r * n ^ 2 * m ^ 2 := by + rw [inputFamily, Family.cost_expressions] + have hc (o : Fin r × MatrixInput m) : (inputExpressions a b o).cost = 2 * n ^ 2 := by + rcases o with ⟨q, o⟩ + cases o <;> simp [inputExpressions, LinearExpression.cost_linear, pow_two] + simp_rw [hc] + simp only [Finset.sum_const, Finset.card_univ, Fintype.card_prod, + Fintype.card_fin, Fintype.card_sum, smul_eq_mul] + ring + +def recursiveProducts (a b : Fin r → Fin n × Fin n → ℂ) (p : MatrixAlgorithm m) : + Family (MatrixInput (n * m)) (Fin r × (Fin m × Fin m)) := + (inputFamily a b).compose (Family.copies r (Family.ofMatrix p)) + +theorem recursiveProducts_eval (a b : Fin r → Fin n × Fin n → ℂ) + (p : MatrixAlgorithm m) (hp : p.Correct) + (A B : Matrix (Fin (n * m)) (Fin (n * m)) ℂ) (q : Fin r) (s u : Fin m) : + (recursiveProducts a b p).eval (matrixInputs A B) (q, (s, u)) = + ((leftBlock a A q) * (rightBlock b B q)) s u := by + rw [recursiveProducts, Family.eval_compose, Family.eval_copies, + Family.eval_ofMatrix _ hp] + simp only [inputFamily_eval, matrixInputs, Matrix.mul_apply] + +theorem recursiveProducts_cost (a b : Fin r → Fin n × Fin n → ℂ) + (p : MatrixAlgorithm m) : + (recursiveProducts a b p).cost = 4 * r * n ^ 2 * m ^ 2 + r * p.cost := by + rw [recursiveProducts, Family.cost_compose, inputFamily_cost, + Family.cost_copies, Family.cost_ofMatrix] + +def outputExpressions (c : Fin r → Fin n × Fin n → ℂ) : + Fin (n * m) × Fin (n * m) → Expression (Fin r × (Fin m × Fin m)) := + fun o => LinearExpression.linear + (fun q => c q ((finProdFinEquiv.symm o.2).1, (finProdFinEquiv.symm o.1).1)) + (fun q => (q, ((finProdFinEquiv.symm o.1).2, (finProdFinEquiv.symm o.2).2))) + +def outputFamily (c : Fin r → Fin n × Fin n → ℂ) : + Family (Fin r × (Fin m × Fin m)) (Fin (n * m) × Fin (n * m)) := + Family.expressions (outputExpressions c) + +theorem outputFamily_eval (c : Fin r → Fin n × Fin n → ℂ) + (inputs : Fin r × (Fin m × Fin m) → ℂ) (i k : Fin n) (s u : Fin m) : + (outputFamily c).eval inputs (join i s, join k u) = + ∑ q, c q (k, i) * inputs (q, (s, u)) := by + simp only [outputFamily, Family.eval_expressions, outputExpressions, + LinearExpression.eval_linear, join, Equiv.symm_apply_apply] + +theorem outputFamily_cost (c : Fin r → Fin n × Fin n → ℂ) : + (outputFamily (m := m) c).cost = 2 * r * n ^ 2 * m ^ 2 := by + simp only [outputFamily, Family.cost_expressions, outputExpressions, + LinearExpression.cost_linear, Fintype.card_fin, Finset.sum_const, + Finset.card_univ, Fintype.card_prod, smul_eq_mul] + ring + +def algorithm (a b c : Fin r → Fin n × Fin n → ℂ) (p : MatrixAlgorithm m) : + MatrixAlgorithm (n * m) := + let f := (recursiveProducts a b p).compose (outputFamily c) + ⟨f.registers, f.program, fun i k => f.output (i, k)⟩ + +theorem algorithm_correct + (a b c : Fin r → Fin n × Fin n → ℂ) + (h : Tensor.matrixMultiplication n n n = + fun x y z => ∑ q, Tensor.rankOne (a q) (b q) (c q) x y z) + (p : MatrixAlgorithm m) (hp : p.Correct) : (algorithm a b c p).Correct := by + intro A B + funext i k + obtain ⟨⟨i, s⟩, rfl⟩ := finProdFinEquiv.surjective i + obtain ⟨⟨k, u⟩, rfl⟩ := finProdFinEquiv.surjective k + change ((recursiveProducts a b p).compose (outputFamily c)).eval + (matrixInputs A B) (join i s, join k u) = _ + rw [Family.eval_compose, outputFamily_eval] + simp_rw [recursiveProducts_eval a b p hp A B] + exact block_identity a b c h A B i k s u + +theorem algorithm_cost (a b c : Fin r → Fin n × Fin n → ℂ) + (p : MatrixAlgorithm m) : + (algorithm a b c p).cost = r * p.cost + (6 * r * n ^ 2) * m ^ 2 := by + change ((recursiveProducts a b p).compose (outputFamily c)).cost = _ + rw [Family.cost_compose, recursiveProducts_cost, outputFamily_cost] + ring + +theorem rank_block_step (h : Tensor.RankAtMost (Tensor.matrixMultiplication n n n) r) + (p : MatrixAlgorithm m) (hp : p.Correct) : + ∃ q : MatrixAlgorithm (n * m), q.Correct ∧ + q.cost = r * p.cost + (6 * r * n ^ 2) * m ^ 2 := by + rcases h with ⟨a, b, c, h⟩ + exact ⟨algorithm a b c p, algorithm_correct a b c h p hp, algorithm_cost a b c p⟩ + +end MatrixMultiplication.Foundation.Arithmetic.RecursiveBlock + +end + +noncomputable section + +namespace MatrixMultiplication.Foundation.Arithmetic + +theorem exists_power_cover {b n : ℕ} (hb : 2 ≤ b) (hn : 1 ≤ n) : + ∃ k : ℕ, n ≤ b ^ k ∧ b ^ k ≤ b * n := by + refine ⟨Nat.log b n + 1, (Nat.lt_pow_succ_log_self (by omega) n).le, ?_⟩ + rw [pow_succ'] + exact Nat.mul_le_mul_left b (Nat.pow_log_le_self b (by omega)) + +theorem geometric_cost_recurrence_bound (x : ℕ → ℝ) (a b d q : ℝ) + (hx : 0 ≤ x 0) (ha : 0 ≤ a) (hb : 0 ≤ b) (hd : 0 ≤ d) + (haq : a < q) (hdq : d ≤ q) + (hstep : ∀ k, x (k + 1) ≤ a * x k + b * d ^ k) : + ∃ C : ℝ, 0 < C ∧ ∀ k, x k ≤ C * q ^ k := by + let C := x 0 + b / (q - a) + 1 + have hgap : 0 < q - a := sub_pos.mpr haq + have hfrac : 0 ≤ b / (q - a) := div_nonneg hb hgap.le + have hC : 0 < C := by dsimp [C]; linarith + have hcancel : (q - a) * (b / (q - a)) = b := by + field_simp [ne_of_gt hgap] + have hCfrac : b / (q - a) ≤ C := by dsimp [C]; linarith + have hcoeff : a * C + b ≤ C * q := by + have hmul := mul_le_mul_of_nonneg_left hCfrac hgap.le + rw [hcancel] at hmul + calc + a * C + b ≤ a * C + (q - a) * C := add_le_add (le_refl _) hmul + _ = C * q := by ring + refine ⟨C, hC, ?_⟩ + intro k + induction k with + | zero => simp only [pow_zero, mul_one]; dsimp [C]; linarith + | succ k ih => + calc + x (k + 1) ≤ a * x k + b * d ^ k := hstep k + _ ≤ a * (C * q ^ k) + b * q ^ k := + add_le_add (mul_le_mul_of_nonneg_left ih ha) + (mul_le_mul_of_nonneg_left (pow_le_pow_left₀ hd hdq k) hb) + _ = (a * C + b) * q ^ k := by ring + _ ≤ (C * q) * q ^ k := + mul_le_mul_of_nonneg_right hcoeff (pow_nonneg (hd.trans hdq) k) + _ = C * q ^ (k + 1) := by rw [pow_succ]; ring + +theorem power_cost_padding_bound + (hpad : ∀ {n m : ℕ}, n ≤ m → ∀ P : MatrixAlgorithm m, P.Correct → + ∃ Q : MatrixAlgorithm n, Q.Correct ∧ Q.cost ≤ P.cost) + {b : ℕ} (hb : 2 ≤ b) {s C : ℝ} (hs : 0 ≤ s) (hC : 0 < C) + (hpower : ∀ k : ℕ, ∃ P : MatrixAlgorithm (b ^ k), + P.Correct ∧ (P.cost : ℝ) ≤ C * ((b : ℝ) ^ s) ^ k) : + ∃ D : ℝ, 0 < D ∧ ∀ n : ℕ, 1 ≤ n → ∃ P : MatrixAlgorithm n, + P.Correct ∧ (P.cost : ℝ) ≤ D * (n : ℝ) ^ s := by + have hbpos : 0 < (b : ℝ) := by exact_mod_cast (by omega : 0 < b) + refine ⟨C * (b : ℝ) ^ s, mul_pos hC (Real.rpow_pos_of_pos hbpos s), ?_⟩ + intro n hn + obtain ⟨k, hnk, hkn⟩ := exists_power_cover hb hn + obtain ⟨P, hP, hcost⟩ := hpower k + obtain ⟨Q, hQ, hQP⟩ := hpad hnk P hP + refine ⟨Q, hQ, ?_⟩ + calc + (Q.cost : ℝ) ≤ (P.cost : ℝ) := by exact_mod_cast hQP + _ ≤ C * ((b : ℝ) ^ s) ^ k := hcost + _ = C * ((b ^ k : ℕ) : ℝ) ^ s := by + rw [Real.rpow_pow_comm hbpos.le, Nat.cast_pow] + _ ≤ C * ((b : ℝ) * (n : ℝ)) ^ s := + mul_le_mul_of_nonneg_left + (Real.rpow_le_rpow (Nat.cast_nonneg _) (by exact_mod_cast hkn) hs) hC.le + _ = (C * (b : ℝ) ^ s) * (n : ℝ) ^ s := by + rw [Real.mul_rpow hbpos.le (Nat.cast_nonneg n)] + ring + +theorem admissibleExponent_of_uniform_power_costs + (hpad : ∀ {n m : ℕ}, n ≤ m → ∀ P : MatrixAlgorithm m, P.Correct → + ∃ Q : MatrixAlgorithm n, Q.Correct ∧ Q.cost ≤ P.cost) + {b : ℕ} (hb : 2 ≤ b) {τ C : ℝ} (hτ : 0 ≤ τ) (hC : 0 < C) + (hpower : ∀ k : ℕ, ∃ P : MatrixAlgorithm (b ^ k), + P.Correct ∧ (P.cost : ℝ) ≤ C * ((b : ℝ) ^ τ) ^ k) : + AdmissibleExponent τ := by + obtain ⟨D, hD, hall⟩ := power_cost_padding_bound hpad hb hτ hC hpower + intro ε hε + refine ⟨D, hD, ?_⟩ + intro n hn + obtain ⟨P, hP, hcost⟩ := hall n hn + refine ⟨P, hP, hcost.trans ?_⟩ + exact mul_le_mul_of_nonneg_left + (Real.rpow_le_rpow_of_exponent_le (by exact_mod_cast hn) (by linarith)) hD.le + +theorem admissibleExponent_of_power_costs + (hpad : ∀ {n m : ℕ}, n ≤ m → ∀ P : MatrixAlgorithm m, P.Correct → + ∃ Q : MatrixAlgorithm n, Q.Correct ∧ Q.cost ≤ P.cost) + {b : ℕ} (hb : 2 ≤ b) {τ : ℝ} (hτ : 0 ≤ τ) + (hpower : ∀ ε : ℝ, 0 < ε → ∃ C : ℝ, 0 < C ∧ + ∀ k : ℕ, ∃ P : MatrixAlgorithm (b ^ k), + P.Correct ∧ (P.cost : ℝ) ≤ C * ((b : ℝ) ^ (τ + ε)) ^ k) : + AdmissibleExponent τ := by + intro ε hε + obtain ⟨C, hC, hcost⟩ := hpower ε hε + exact power_cost_padding_bound hpad hb (by linarith) hC hcost + +theorem admissibleExponent_of_recursive_costs + (hpad : ∀ {n m : ℕ}, n ≤ m → ∀ P : MatrixAlgorithm m, P.Correct → + ∃ Q : MatrixAlgorithm n, Q.Correct ∧ Q.cost ≤ P.cost) + {b R K : ℕ} (hb : 2 ≤ b) {τ : ℝ} (hτ : 2 ≤ τ) + (hR : (R : ℝ) ≤ (b : ℝ) ^ τ) + (P : ∀ k : ℕ, MatrixAlgorithm (b ^ k)) + (hP : ∀ k, (P k).Correct) + (hstep : ∀ k, (P (k + 1)).cost ≤ R * (P k).cost + K * (b ^ k) ^ 2) : + AdmissibleExponent τ := by + apply admissibleExponent_of_power_costs hpad hb (by linarith) + intro ε hε + have hbpos : 0 < (b : ℝ) := by exact_mod_cast (by omega : 0 < b) + have hbone : 1 < (b : ℝ) := by exact_mod_cast (by omega : 1 < b) + have hrate : (R : ℝ) < (b : ℝ) ^ (τ + ε) := + hR.trans_lt (Real.rpow_lt_rpow_of_exponent_lt hbone (by linarith)) + have hquad : (b : ℝ) ^ (2 : ℕ) ≤ (b : ℝ) ^ (τ + ε) := by + rw [← Real.rpow_natCast] + change (b : ℝ) ^ (2 : ℝ) ≤ (b : ℝ) ^ (τ + ε) + exact Real.rpow_le_rpow_of_exponent_le hbone.le (by linarith) + obtain ⟨C, hC, hbound⟩ := geometric_cost_recurrence_bound + (fun k => ((P k).cost : ℝ)) (R : ℝ) (K : ℝ) ((b : ℝ) ^ (2 : ℕ)) + ((b : ℝ) ^ (τ + ε)) (Nat.cast_nonneg _) (Nat.cast_nonneg _) + (Nat.cast_nonneg _) (sq_nonneg _) hrate hquad (fun k => by + have h := hstep k + have hcast : ((P (k + 1)).cost : ℝ) ≤ + (R : ℝ) * ((P k).cost : ℝ) + (K : ℝ) * ((b : ℝ) ^ k) ^ 2 := by + exact_mod_cast h + simpa only [← pow_mul, Nat.mul_comm k 2] using hcast) + exact ⟨C, hC, fun k => ⟨P k, hP k, hbound k⟩⟩ + +def blockRecurrenceCost (b R K : ℕ) : ℕ → ℕ + | 0 => 1 + | k + 1 => R * blockRecurrenceCost b R K k + K * (b ^ k) ^ 2 + +@[simp] theorem blockRecurrenceCost_zero (b R K : ℕ) : + blockRecurrenceCost b R K 0 = 1 := rfl + +@[simp] theorem blockRecurrenceCost_succ (b R K k : ℕ) : + blockRecurrenceCost b R K (k + 1) = + R * blockRecurrenceCost b R K k + K * (b ^ k) ^ 2 := rfl + +theorem power_programs_of_block_step {b R K : ℕ} + (hstep : ∀ m : ℕ, ∀ P : MatrixAlgorithm m, P.Correct → + ∃ Q : MatrixAlgorithm (b * m), Q.Correct ∧ + Q.cost ≤ R * P.cost + K * m ^ 2) : + ∀ k : ℕ, ∃ P : MatrixAlgorithm (b ^ k), P.Correct ∧ + P.cost ≤ blockRecurrenceCost b R K k := by + intro k + induction k with + | zero => + exact ⟨scalarAlgorithm, scalarAlgorithm_correct, by simp⟩ + | succ k ih => + obtain ⟨P, hP, hcost⟩ := ih + obtain ⟨Q, hQ, hQcost⟩ := hstep (b ^ k) P hP + have hbound : Q.cost ≤ blockRecurrenceCost b R K (k + 1) := by + exact hQcost.trans (Nat.add_le_add_right (Nat.mul_le_mul_left R hcost) _) + have hresult : ∃ Q : MatrixAlgorithm (b * b ^ k), Q.Correct ∧ + Q.cost ≤ blockRecurrenceCost b R K (k + 1) := ⟨Q, hQ, hbound⟩ + exact (pow_succ' b k).symm ▸ hresult + +theorem admissibleExponent_of_block_step_of_padding + (hpad : ∀ {n m : ℕ}, n ≤ m → ∀ P : MatrixAlgorithm m, P.Correct → + ∃ Q : MatrixAlgorithm n, Q.Correct ∧ Q.cost ≤ P.cost) + {b R K : ℕ} (hb : 2 ≤ b) {τ : ℝ} (hτ : 2 ≤ τ) + (hR : (R : ℝ) ≤ (b : ℝ) ^ τ) + (hstep : ∀ m : ℕ, ∀ P : MatrixAlgorithm m, P.Correct → + ∃ Q : MatrixAlgorithm (b * m), Q.Correct ∧ + Q.cost ≤ R * P.cost + K * m ^ 2) : + AdmissibleExponent τ := by + apply admissibleExponent_of_power_costs hpad hb (by linarith) + intro ε hε + have hbone : 1 < (b : ℝ) := by exact_mod_cast (by omega : 1 < b) + have hrate : (R : ℝ) < (b : ℝ) ^ (τ + ε) := + hR.trans_lt (Real.rpow_lt_rpow_of_exponent_lt hbone (by linarith)) + have hquad : (b : ℝ) ^ (2 : ℕ) ≤ (b : ℝ) ^ (τ + ε) := by + rw [← Real.rpow_natCast] + change (b : ℝ) ^ (2 : ℝ) ≤ (b : ℝ) ^ (τ + ε) + exact Real.rpow_le_rpow_of_exponent_le hbone.le (by linarith) + obtain ⟨C, hC, hbound⟩ := geometric_cost_recurrence_bound + (fun k => (blockRecurrenceCost b R K k : ℝ)) + (R : ℝ) (K : ℝ) ((b : ℝ) ^ (2 : ℕ)) ((b : ℝ) ^ (τ + ε)) + (Nat.cast_nonneg _) (Nat.cast_nonneg _) (Nat.cast_nonneg _) + (sq_nonneg _) hrate hquad (fun k => by + simp only [blockRecurrenceCost_succ, Nat.cast_add, Nat.cast_mul, Nat.cast_pow] + rw [← pow_mul, ← pow_mul, Nat.mul_comm k 2]) + refine ⟨C, hC, ?_⟩ + intro k + obtain ⟨P, hP, hcost⟩ := power_programs_of_block_step hstep k + exact ⟨P, hP, (by exact_mod_cast hcost : (P.cost : ℝ) ≤ + (blockRecurrenceCost b R K k : ℝ)).trans (hbound k)⟩ + +theorem admissibleExponent_of_block_step + {b R K : ℕ} (hb : 2 ≤ b) {τ : ℝ} (hτ : 2 ≤ τ) + (hR : (R : ℝ) ≤ (b : ℝ) ^ τ) + (hstep : ∀ m : ℕ, ∀ P : MatrixAlgorithm m, P.Correct → + ∃ Q : MatrixAlgorithm (b * m), Q.Correct ∧ + Q.cost ≤ R * P.cost + K * m ^ 2) : + AdmissibleExponent τ := + admissibleExponent_of_block_step_of_padding + (fun h P hP => MatrixAlgorithm.exists_restrict h P hP) hb hτ hR hstep + +theorem admissibleExponent_of_rankAtMost {n R : ℕ} (hn : 2 ≤ n) + (hRank : Tensor.RankAtMost (Tensor.matrixMultiplication n n n) R) + {τ : ℝ} (hτ : 2 ≤ τ) (hR : (R : ℝ) ≤ (n : ℝ) ^ τ) : + AdmissibleExponent τ := by + apply admissibleExponent_of_block_step (K := 6 * R * n ^ 2) hn hτ hR + intro m P hP + obtain ⟨Q, hQ, hcost⟩ := RecursiveBlock.rank_block_step hRank P hP + exact ⟨Q, hQ, hcost.le⟩ + +end MatrixMultiplication.Foundation.Arithmetic + +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/Arithmetic/ComplexArithmeticLowerBound.lean b/lean/OAI/LinearAlgebra/MatrixFields/Arithmetic/ComplexArithmeticLowerBound.lean new file mode 100644 index 0000000000000000000000000000000000000000..062bf11632c0a0bc58adc1981f6425cc55f74d43 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/Arithmetic/ComplexArithmeticLowerBound.lean @@ -0,0 +1,695 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Tensors.ComplexDotPairing + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +noncomputable section + +open scoped BigOperators + +namespace MatrixMultiplication.Foundation + +namespace Arithmetic + +inductive Gate (Input Register : Type*) where + | constant : ℂ → Gate Input Register + | input : Input → Gate Input Register + | add : Register → Register → Gate Input Register + | sub : Register → Register → Gate Input Register + | mul : Register → Register → Gate Input Register + +namespace Gate + +variable {Input Register : Type*} + +def eval (inputs : Input → ℂ) (registers : Register → ℂ) : Gate Input Register → ℂ + | .constant z => z + | .input i => inputs i + | .add i j => registers i + registers j + | .sub i j => registers i - registers j + | .mul i j => registers i * registers j + +def cost : Gate Input Register → ℕ + | .constant _ => 0 + | .input _ => 0 + | .add _ _ => 1 + | .sub _ _ => 1 + | .mul _ _ => 1 + +end Gate + +inductive Program (Input : Type*) : ℕ → Type _ where + | nil : Program Input 0 + | step {r : ℕ} : Program Input r → Gate Input (Fin r) → Program Input (r + 1) + +namespace Program + +variable {Input : Type*} + +def eval : {r : ℕ} → Program Input r → (Input → ℂ) → Fin r → ℂ + | 0, .nil, _ => Fin.elim0 + | _ + 1, .step p g, inputs => + Fin.cases (g.eval inputs (p.eval inputs)) (p.eval inputs) + +def cost : {r : ℕ} → Program Input r → ℕ + | 0, .nil => 0 + | _ + 1, .step p g => p.cost + g.cost + +@[simp] theorem eval_step_zero {r : ℕ} (p : Program Input r) + (g : Gate Input (Fin r)) (inputs : Input → ℂ) : + (p.step g).eval inputs 0 = g.eval inputs (p.eval inputs) := rfl + +@[simp] theorem eval_step_succ {r : ℕ} (p : Program Input r) + (g : Gate Input (Fin r)) (inputs : Input → ℂ) (i : Fin r) : + (p.step g).eval inputs i.succ = p.eval inputs i := rfl + +@[simp] theorem cost_step {r : ℕ} (p : Program Input r) + (g : Gate Input (Fin r)) : (p.step g).cost = p.cost + g.cost := rfl + +end Program + +abbrev MatrixInput (n : ℕ) := (Fin n × Fin n) ⊕ (Fin n × Fin n) + +def matrixInputs {n : ℕ} (A B : Matrix (Fin n) (Fin n) ℂ) : MatrixInput n → ℂ + | .inl (i, j) => A i j + | .inr (j, k) => B j k + +structure MatrixAlgorithm (n : ℕ) where + registers : ℕ + program : Program (MatrixInput n) registers + output : Fin n → Fin n → Fin registers + +namespace MatrixAlgorithm + +def eval {n : ℕ} (P : MatrixAlgorithm n) + (A B : Matrix (Fin n) (Fin n) ℂ) : Matrix (Fin n) (Fin n) ℂ := + fun i k => P.program.eval (matrixInputs A B) (P.output i k) + +def Correct {n : ℕ} (P : MatrixAlgorithm n) : Prop := + ∀ A B : Matrix (Fin n) (Fin n) ℂ, P.eval A B = A * B + +def cost {n : ℕ} (P : MatrixAlgorithm n) : ℕ := P.program.cost + +theorem correct_iff_entries {n : ℕ} (P : MatrixAlgorithm n) : + P.Correct ↔ ∀ (A B : Matrix (Fin n) (Fin n) ℂ) (i k : Fin n), + P.program.eval (matrixInputs A B) (P.output i k) = ∑ j, A i j * B j k := by + constructor + · intro h A B i k + exact congrFun (congrFun (h A B) i) k + · intro h A B + funext i k + exact h A B i k + +end MatrixAlgorithm + +def scalarAlgorithm : MatrixAlgorithm 1 where + registers := 3 + program := ((Program.nil.step (.input (.inl (0, 0)))).step + (.input (.inr (0, 0)))).step (.mul 1 0) + output := fun _ _ => 0 + +theorem scalarAlgorithm_correct : scalarAlgorithm.Correct := by + intro A B + funext i k + have hi : i = 0 := Subsingleton.elim _ _ + have hk : k = 0 := Subsingleton.elim _ _ + subst i + subst k + change A 0 0 * B 0 0 = (A * B) 0 0 + simp [Matrix.mul_apply] + +@[simp] theorem scalarAlgorithm_cost : scalarAlgorithm.cost = 1 := rfl + +def AdmissibleExponent (τ : ℝ) : Prop := + ∀ ε : ℝ, 0 < ε → ∃ C : ℝ, 0 < C ∧ + ∀ n : ℕ, 1 ≤ n → ∃ P : MatrixAlgorithm n, + P.Correct ∧ (P.cost : ℝ) ≤ C * (n : ℝ) ^ (τ + ε) + +noncomputable def omega : ℝ := sInf {τ : ℝ | AdmissibleExponent τ} + +end Arithmetic + +namespace Tensor + +def matrixMultiplication (a b c : ℕ) : + Tensor ℂ (Fin a × Fin b) (Fin b × Fin c) (Fin c × Fin a) := + fun x y z => if x.2 = y.1 ∧ y.2 = z.1 ∧ z.2 = x.1 then 1 else 0 + +@[simp] theorem matrixMultiplication_matching (a b c : ℕ) + (i : Fin a) (j : Fin b) (k : Fin c) : + matrixMultiplication a b c (i, j) (j, k) (k, i) = 1 := by + simp [matrixMultiplication] + +end Tensor +end MatrixMultiplication.Foundation + +end + +noncomputable section + +namespace MatrixMultiplication.Foundation.Arithmetic + +namespace Gate + +variable {Input R S : Type*} + +def mapRegister (f : R → S) : Gate Input R → Gate Input S + | .constant z => .constant z + | .input i => .input i + | .add i j => .add (f i) (f j) + | .sub i j => .sub (f i) (f j) + | .mul i j => .mul (f i) (f j) + +theorem eval_mapRegister (g : Gate Input R) (f : R → S) + (inputs : Input → ℂ) (registers : S → ℂ) : + (g.mapRegister f).eval inputs registers = g.eval inputs (fun i => registers (f i)) := by + cases g <;> rfl + +@[simp] theorem cost_mapRegister (g : Gate Input R) (f : R → S) : + (g.mapRegister f).cost = g.cost := by + cases g <;> rfl + +end Gate + +namespace Program + +variable {Input : Type*} + +def oldIndex (r s : ℕ) (i : Fin r) : Fin (r + s) := ⟨s + i.val, by omega⟩ + +def newIndex (r s : ℕ) (i : Fin s) : Fin (r + s) := ⟨i.val, by omega⟩ + +@[simp] theorem oldIndex_zero (r : ℕ) (i : Fin r) : oldIndex r 0 i = i := by + apply Fin.ext + simp [oldIndex] + +@[simp] theorem oldIndex_succ (r s : ℕ) (i : Fin r) : + oldIndex r (s + 1) i = (oldIndex r s i).succ := by + apply Fin.ext + simp only [oldIndex, Fin.val_succ] + omega + +@[simp] theorem newIndex_zero (r s : ℕ) : newIndex r (s + 1) 0 = 0 := by + apply Fin.ext + rfl + +@[simp] theorem newIndex_succ (r s : ℕ) (i : Fin s) : + newIndex r (s + 1) i.succ = (newIndex r s i).succ := by + apply Fin.ext + rfl + +def append {r : ℕ} (p : Program Input r) : {s : ℕ} → Program Input s → Program Input (r + s) + | 0, .nil => p + | s + 1, .step q g => (p.append q).step (g.mapRegister (newIndex r s)) + +theorem eval_append_new {r s : ℕ} (p : Program Input r) (q : Program Input s) + (inputs : Input → ℂ) : + ∀ i : Fin s, (p.append q).eval inputs (newIndex r s i) = q.eval inputs i := by + induction q with + | nil => intro i; exact Fin.elim0 i + | @step s q g ih => + intro i + refine Fin.cases ?_ (fun j => ?_) i + · simp only [append, newIndex_zero, eval_step_zero, Gate.eval_mapRegister] + rw [funext ih] + · simpa only [append, newIndex_succ, eval_step_succ] using ih j + +theorem eval_append_old {r s : ℕ} (p : Program Input r) (q : Program Input s) + (inputs : Input → ℂ) : + ∀ i : Fin r, (p.append q).eval inputs (oldIndex r s i) = p.eval inputs i := by + induction q with + | nil => intro i; simp [append] + | @step s q g ih => + intro i + simpa only [append, oldIndex_succ, eval_step_succ] using ih i + +@[simp] theorem cost_append {r s : ℕ} (p : Program Input r) (q : Program Input s) : + (p.append q).cost = p.cost + q.cost := by + induction q with + | nil => simp [append, cost] + | @step s q g ih => simp [append, ih, Nat.add_assoc] + +end Program + +inductive Expression (Input : Type*) where + | constant : ℂ → Expression Input + | input : Input → Expression Input + | add : Expression Input → Expression Input → Expression Input + | sub : Expression Input → Expression Input → Expression Input + | mul : Expression Input → Expression Input → Expression Input + +namespace Expression + +variable {Input : Type*} + +def eval (inputs : Input → ℂ) : Expression Input → ℂ + | .constant z => z + | .input i => inputs i + | .add e f => e.eval inputs + f.eval inputs + | .sub e f => e.eval inputs - f.eval inputs + | .mul e f => e.eval inputs * f.eval inputs + +def cost : Expression Input → ℕ + | .constant _ => 0 + | .input _ => 0 + | .add e f => e.cost + f.cost + 1 + | .sub e f => e.cost + f.cost + 1 + | .mul e f => e.cost + f.cost + 1 + +structure Compiled (e : Expression Input) where + registers : ℕ + program : Program Input registers + output : Fin registers + correct : ∀ inputs, program.eval inputs output = e.eval inputs + cost_eq : program.cost = e.cost + +def compile : (e : Expression Input) → Compiled e + | .constant z => + { registers := 1 + program := Program.nil.step (.constant z) + output := 0 + correct := fun _ => rfl + cost_eq := rfl } + | .input i => + { registers := 1 + program := Program.nil.step (.input i) + output := 0 + correct := fun _ => rfl + cost_eq := rfl } + | .add e f => + let p := compile e + let q := compile f + { registers := p.registers + q.registers + 1 + program := (p.program.append q.program).step + (.add (Program.oldIndex _ _ p.output) (Program.newIndex _ _ q.output)) + output := 0 + correct := by + intro inputs + simp only [Program.eval_step_zero, Gate.eval, Program.eval_append_old, + Program.eval_append_new, p.correct, q.correct, eval] + cost_eq := by + simp only [Program.cost_step, Program.cost_append, Gate.cost, p.cost_eq, q.cost_eq, cost] } + | .sub e f => + let p := compile e + let q := compile f + { registers := p.registers + q.registers + 1 + program := (p.program.append q.program).step + (.sub (Program.oldIndex _ _ p.output) (Program.newIndex _ _ q.output)) + output := 0 + correct := by + intro inputs + simp only [Program.eval_step_zero, Gate.eval, Program.eval_append_old, + Program.eval_append_new, p.correct, q.correct, eval] + cost_eq := by + simp only [Program.cost_step, Program.cost_append, Gate.cost, p.cost_eq, q.cost_eq, cost] } + | .mul e f => + let p := compile e + let q := compile f + { registers := p.registers + q.registers + 1 + program := (p.program.append q.program).step + (.mul (Program.oldIndex _ _ p.output) (Program.newIndex _ _ q.output)) + output := 0 + correct := by + intro inputs + simp only [Program.eval_step_zero, Gate.eval, Program.eval_append_old, + Program.eval_append_new, p.correct, q.correct, eval] + cost_eq := by + simp only [Program.cost_step, Program.cost_append, Gate.cost, p.cost_eq, q.cost_eq, cost] } + +end Expression + +namespace Gate + +variable {Input Input' Register : Type*} + +def mapInput (f : Input → Input') : Gate Input Register → Gate Input' Register + | .constant z => .constant z + | .input i => .input (f i) + | .add i j => .add i j + | .sub i j => .sub i j + | .mul i j => .mul i j + +@[simp] theorem eval_mapInput (f : Input → Input') (g : Gate Input Register) + (inputs : Input' → ℂ) (registers : Register → ℂ) : + (g.mapInput f).eval inputs registers = g.eval (inputs ∘ f) registers := by + cases g <;> rfl + +@[simp] theorem cost_mapInput (f : Input → Input') (g : Gate Input Register) : + (g.mapInput f).cost = g.cost := by + cases g <;> rfl + +def mapSource (f : Input → Input' ⊕ ℂ) : Gate Input Register → Gate Input' Register + | .constant z => .constant z + | .input i => match f i with + | .inl j => .input j + | .inr z => .constant z + | .add i j => .add i j + | .sub i j => .sub i j + | .mul i j => .mul i j + +@[simp] theorem eval_mapSource (f : Input → Input' ⊕ ℂ) (g : Gate Input Register) + (inputs : Input' → ℂ) (registers : Register → ℂ) : + (g.mapSource f).eval inputs registers = + g.eval (fun i => Sum.elim inputs id (f i)) registers := by + cases g with + | input i => cases h : f i <;> simp [mapSource, h, eval] + | constant => rfl + | add => rfl + | sub => rfl + | mul => rfl + +@[simp] theorem cost_mapSource (f : Input → Input' ⊕ ℂ) (g : Gate Input Register) : + (g.mapSource f).cost = g.cost := by + cases g with + | input i => cases h : f i <;> simp [mapSource, h, cost] + | constant => rfl + | add => rfl + | sub => rfl + | mul => rfl + +end Gate + +namespace Program + +variable {Input Input' Mid : Type*} + +def mapInput (f : Input → Input') : {r : ℕ} → Program Input r → Program Input' r + | 0, .nil => .nil + | _ + 1, .step p g => (p.mapInput f).step (g.mapInput f) + +@[simp] theorem eval_mapInput (f : Input → Input') {r : ℕ} (p : Program Input r) + (inputs : Input' → ℂ) : + ∀ i : Fin r, (p.mapInput f).eval inputs i = p.eval (inputs ∘ f) i := by + induction p with + | nil => intro i; exact Fin.elim0 i + | @step r p g ih => + intro i + refine Fin.cases ?_ (fun j => ?_) i + · simp only [mapInput, eval_step_zero, Gate.eval_mapInput] + rw [funext ih] + · exact ih j + +@[simp] theorem cost_mapInput (f : Input → Input') {r : ℕ} (p : Program Input r) : + (p.mapInput f).cost = p.cost := by + induction p with + | nil => rfl + | step p g ih => simp only [mapInput, cost_step, Gate.cost_mapInput, ih] + +def mapSource (f : Input → Input' ⊕ ℂ) : {r : ℕ} → Program Input r → Program Input' r + | 0, .nil => .nil + | _ + 1, .step p g => (p.mapSource f).step (g.mapSource f) + +@[simp] theorem eval_mapSource (f : Input → Input' ⊕ ℂ) {r : ℕ} + (p : Program Input r) (inputs : Input' → ℂ) : + ∀ i : Fin r, (p.mapSource f).eval inputs i = + p.eval (fun j => Sum.elim inputs id (f j)) i := by + induction p with + | nil => intro i; exact Fin.elim0 i + | @step r p g ih => + intro i + refine Fin.cases ?_ (fun j => ?_) i + · simp only [mapSource, eval_step_zero, Gate.eval_mapSource] + rw [funext ih] + · exact ih j + +@[simp] theorem cost_mapSource (f : Input → Input' ⊕ ℂ) {r : ℕ} + (p : Program Input r) : (p.mapSource f).cost = p.cost := by + induction p with + | nil => rfl + | step p g ih => simp only [mapSource, cost_step, Gate.cost_mapSource, ih] + +structure Substituted {r s : ℕ} (p : Program Input r) (q : Program Mid s) + (wires : Mid → Fin r) where + registers : ℕ + program : Program Input registers + oldOutput : Fin r → Fin registers + output : Fin s → Fin registers + correctOld : ∀ inputs i, program.eval inputs (oldOutput i) = p.eval inputs i + correct : ∀ inputs i, program.eval inputs (output i) = + q.eval (fun j => p.eval inputs (wires j)) i + cost_eq : program.cost = p.cost + q.cost + +namespace Substituted + +def step {r s : ℕ} {p : Program Input r} {q : Program Mid s} + {wires : Mid → Fin r} (a : Substituted p q wires) + (g : Gate Mid (Fin s)) (h : Gate Input (Fin a.registers)) + (heval : ∀ inputs, h.eval inputs (a.program.eval inputs) = + g.eval (fun j => p.eval inputs (wires j)) + (q.eval (fun j => p.eval inputs (wires j)))) + (hcost : h.cost = g.cost) : Substituted p (q.step g) wires where + registers := a.registers + 1 + program := a.program.step h + oldOutput := fun i => (a.oldOutput i).succ + output := Fin.cases 0 (fun i => (a.output i).succ) + correctOld := by + intro inputs i + exact a.correctOld inputs i + correct := by + intro inputs i + refine Fin.cases ?_ (fun j => ?_) i + · exact heval inputs + · exact a.correct inputs j + cost_eq := by + simp only [cost_step, a.cost_eq, hcost, Nat.add_assoc] + +end Substituted + +def substitute {r : ℕ} (p : Program Input r) : + {s : ℕ} → (q : Program Mid s) → (wires : Mid → Fin r) → Substituted p q wires + | 0, .nil, wires => + { registers := r + program := p + oldOutput := id + output := Fin.elim0 + correctOld := fun _ _ => rfl + correct := fun _ i => Fin.elim0 i + cost_eq := by simp only [cost, Nat.add_zero] } + | _ + 1, .step q g, wires => + let a := substitute p q wires + match g with + | .input j => + { registers := a.registers + program := a.program + oldOutput := a.oldOutput + output := Fin.cases (a.oldOutput (wires j)) a.output + correctOld := a.correctOld + correct := by + intro inputs i + refine Fin.cases ?_ (fun k => ?_) i + · exact a.correctOld inputs (wires j) + · exact a.correct inputs k + cost_eq := by + simpa only [cost_step, Gate.cost, Nat.add_zero] using a.cost_eq } + | .constant z => + a.step (.constant z) (.constant z) (fun _ => rfl) rfl + | .add i j => + a.step (.add i j) (.add (a.output i) (a.output j)) + (by intro inputs; simp only [Gate.eval, a.correct]) rfl + | .sub i j => + a.step (.sub i j) (.sub (a.output i) (a.output j)) + (by intro inputs; simp only [Gate.eval, a.correct]) rfl + | .mul i j => + a.step (.mul i j) (.mul (a.output i) (a.output j)) + (by intro inputs; simp only [Gate.eval, a.correct]) rfl + +end Program + +end MatrixMultiplication.Foundation.Arithmetic + +open scoped BigOperators + +namespace MatrixMultiplication.Foundation.Arithmetic + +def zeroPadMatrix {n : ℕ} (m : ℕ) (A : Matrix (Fin n) (Fin n) ℂ) : + Matrix (Fin m) (Fin m) ℂ := + fun i j => if hi : i.val < n then + if hj : j.val < n then A ⟨i.val, hi⟩ ⟨j.val, hj⟩ else 0 + else 0 + +@[simp] theorem zeroPadMatrix_castLE {n m : ℕ} (h : n ≤ m) + (A : Matrix (Fin n) (Fin n) ℂ) (i j : Fin n) : + zeroPadMatrix m A (Fin.castLE h i) (Fin.castLE h j) = A i j := by + simp [zeroPadMatrix, i.is_lt, j.is_lt] + +theorem sum_fin_castLE_of_zero {n m : ℕ} (h : n ≤ m) (f : Fin m → ℂ) + (hf : ∀ j : Fin m, n ≤ j.val → f j = 0) : + (∑ j : Fin m, f j) = ∑ j : Fin n, f (Fin.castLE h j) := by + symm + refine Fintype.sum_of_injective (Fin.castLE h) ?_ + (fun j : Fin n => f (Fin.castLE h j)) f ?_ (fun _ => rfl) + · intro i j hij + exact Fin.ext (congrArg (fun v : Fin m => v.val) hij) + · intro j hj + exact hf j (le_of_not_gt fun hsmall => hj ⟨⟨j.val, hsmall⟩, Fin.ext rfl⟩) + +theorem zeroPadMatrix_mul {n m : ℕ} (h : n ≤ m) + (A B : Matrix (Fin n) (Fin n) ℂ) (i k : Fin n) : + (zeroPadMatrix m A * zeroPadMatrix m B) (Fin.castLE h i) (Fin.castLE h k) = + (A * B) i k := by + rw [Matrix.mul_apply, Matrix.mul_apply] + calc + (∑ j : Fin m, + zeroPadMatrix m A (Fin.castLE h i) j * + zeroPadMatrix m B j (Fin.castLE h k)) = + ∑ j : Fin n, + zeroPadMatrix m A (Fin.castLE h i) (Fin.castLE h j) * + zeroPadMatrix m B (Fin.castLE h j) (Fin.castLE h k) := by + apply sum_fin_castLE_of_zero h + intro j hj + simp [zeroPadMatrix, not_lt_of_ge hj] + _ = ∑ j : Fin n, A i j * B j k := by simp + +def padSource {n m : ℕ} : MatrixInput m → MatrixInput n ⊕ ℂ + | .inl (i, j) => if hi : i.val < n then + if hj : j.val < n then .inl (.inl (⟨i.val, hi⟩, ⟨j.val, hj⟩)) else .inr 0 + else .inr 0 + | .inr (i, j) => if hi : i.val < n then + if hj : j.val < n then .inl (.inr (⟨i.val, hi⟩, ⟨j.val, hj⟩)) else .inr 0 + else .inr 0 + +theorem padSource_eval {n m : ℕ} (A B : Matrix (Fin n) (Fin n) ℂ) : + (fun x : MatrixInput m => Sum.elim (matrixInputs A B) id (padSource x)) = + matrixInputs (zeroPadMatrix m A) (zeroPadMatrix m B) := by + funext x + rcases x with ⟨i, j⟩ | ⟨i, j⟩ + all_goals + by_cases hi : i.val < n <;> by_cases hj : j.val < n <;> + simp [padSource, matrixInputs, zeroPadMatrix, hi, hj] + +namespace MatrixAlgorithm + +def pad {n m : ℕ} (h : n ≤ m) (P : MatrixAlgorithm m) : MatrixAlgorithm n where + registers := P.registers + program := P.program.mapSource (padSource (n := n)) + output := fun i k => P.output (Fin.castLE h i) (Fin.castLE h k) + +theorem pad_correct {n m : ℕ} (h : n ≤ m) {P : MatrixAlgorithm m} + (hP : P.Correct) : (pad h P).Correct := by + intro A B + funext i k + change (P.program.mapSource (padSource (n := n))).eval (matrixInputs A B) + (P.output (Fin.castLE h i) (Fin.castLE h k)) = (A * B) i k + rw [Program.eval_mapSource, padSource_eval] + have hentry := congrFun (congrFun + (hP (zeroPadMatrix m A) (zeroPadMatrix m B)) (Fin.castLE h i)) (Fin.castLE h k) + exact hentry.trans (zeroPadMatrix_mul h A B i k) + +@[simp] theorem pad_cost_eq {n m : ℕ} (h : n ≤ m) (P : MatrixAlgorithm m) : + (pad h P).cost = P.cost := + Program.cost_mapSource (padSource (n := n)) P.program + +theorem exists_restrict {n m : ℕ} (h : n ≤ m) (P : MatrixAlgorithm m) + (hP : P.Correct) : ∃ Q : MatrixAlgorithm n, Q.Correct ∧ Q.cost ≤ P.cost := + ⟨pad h P, pad_correct h hP, (pad_cost_eq h P).le⟩ + +end MatrixAlgorithm + +end MatrixMultiplication.Foundation.Arithmetic + +end + +noncomputable section + +namespace MatrixMultiplication.Foundation.Arithmetic + +namespace Program + +theorem eval_eq_constant_or_input_of_cost_eq_zero {Input : Type*} {r : ℕ} + (p : Program Input r) (hp : p.cost = 0) (i : Fin r) : + (∃ z : ℂ, ∀ inputs, p.eval inputs i = z) ∨ + (∃ a : Input, ∀ inputs, p.eval inputs i = inputs a) := by + revert hp i + induction p with + | nil => + intro _ i + exact Fin.elim0 i + | @step r p g ih => + intro hp i + have hcost : p.cost + g.cost = 0 := hp + have hp0 : p.cost = 0 := by omega + have hg0 : g.cost = 0 := by omega + refine Fin.cases ?_ (fun j => ?_) i + · cases g with + | constant z => exact Or.inl ⟨z, fun _ => rfl⟩ + | input a => exact Or.inr ⟨a, fun _ => rfl⟩ + | add a b => simp [Gate.cost] at hg0 + | sub a b => simp [Gate.cost] at hg0 + | mul a b => simp [Gate.cost] at hg0 + · simpa only [eval_step_succ] using ih hp0 j + +end Program + +namespace MatrixAlgorithm + +theorem one_le_cost {n : ℕ} (P : MatrixAlgorithm n) (hn : 1 ≤ n) + (hP : P.Correct) : 1 ≤ P.cost := by + by_contra hcost + have hzero : P.program.cost = 0 := by + change ¬ 1 ≤ P.program.cost at hcost + omega + let i : Fin n := ⟨0, by omega⟩ + have hentry (A B : Matrix (Fin n) (Fin n) ℂ) : + P.program.eval (matrixInputs A B) (P.output i i) = (A * B) i i := + congrFun (congrFun (hP A B) i) i + rcases P.program.eval_eq_constant_or_input_of_cost_eq_zero hzero (P.output i i) + with ⟨z, hz⟩ | ⟨a, ha⟩ + · have hz0 : z = 0 := by + have h := hentry 0 0 + rw [hz] at h + simpa using h + have hz1 : z = 1 := by + have h := hentry 1 1 + rw [hz] at h + simpa using h + exact (zero_ne_one : (0 : ℂ) ≠ 1) (hz0.symm.trans hz1) + · rcases a with ⟨j, k⟩ | ⟨j, k⟩ + · have h := hentry (fun _ _ => 1) 0 + rw [ha] at h + change (1 : ℂ) = ∑ index : Fin n, (1 : ℂ) * 0 at h + simp at h + · have h := hentry 0 (fun _ _ => 1) + rw [ha] at h + change (1 : ℂ) = ∑ index : Fin n, (0 : ℂ) * 1 at h + simp at h + +end MatrixAlgorithm + +theorem admissibleExponent_nonneg {τ : ℝ} (hτ : AdmissibleExponent τ) : 0 ≤ τ := by + by_contra hneg + have hτneg : τ < 0 := lt_of_not_ge hneg + let ε : ℝ := -τ / 2 + have hε : 0 < ε := by dsimp [ε]; linarith + have hsum : τ + ε = -ε := by dsimp [ε]; ring + obtain ⟨C, hC, hbound⟩ := hτ ε hε + obtain ⟨n, hn⟩ := exists_nat_gt (max (C ^ ε⁻¹) 1) + have hnreal : 1 < (n : ℝ) := lt_of_le_of_lt (le_max_right _ _) hn + have hnpos : 0 < (n : ℝ) := lt_trans zero_lt_one hnreal + have hn1 : 1 ≤ n := (Nat.one_le_cast (α := ℝ)).mp hnreal.le + have hpow : C < (n : ℝ) ^ ε := + (Real.rpow_inv_lt_iff_of_pos hC.le (Nat.cast_nonneg n) hε).mp + (lt_of_le_of_lt (le_max_left _ _) hn) + obtain ⟨P, hP, hcost⟩ := hbound n hn1 + have hcostone : (1 : ℝ) ≤ P.cost := + (Nat.one_le_cast (α := ℝ)).mpr (P.one_le_cost hn1 hP) + rw [hsum, Real.rpow_neg (Nat.cast_nonneg n), ← div_eq_mul_inv] at hcost + have hsmall : C / (n : ℝ) ^ ε < 1 := + (div_lt_one (Real.rpow_pos_of_pos hnpos ε)).mpr hpow + exact (not_lt_of_ge (hcostone.trans hcost)) hsmall + +theorem admissibleExponent_bddBelow : BddBelow {τ : ℝ | AdmissibleExponent τ} := by + refine ⟨0, ?_⟩ + intro τ hτ + exact admissibleExponent_nonneg hτ + +end MatrixMultiplication.Foundation.Arithmetic + +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/Arithmetic/MatrixMapDecidable.lean b/lean/OAI/LinearAlgebra/MatrixFields/Arithmetic/MatrixMapDecidable.lean new file mode 100644 index 0000000000000000000000000000000000000000..1de8a1d8dcf4ba697796c261f7dc43e535b1acda --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/Arithmetic/MatrixMapDecidable.lean @@ -0,0 +1,52 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Construction.InitialState + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +noncomputable section + +namespace MatrixMultiplication.AllFieldFiniteFamily + +open MatrixMultiplication.Foundation + +variable {F : Type*} [Field F] + +private theorem matrixCoefficients_decidable (A B C : Type) + (dA eA : DecidableEq A) (dB eB : DecidableEq B) (dC eC : DecidableEq C) : + @Tensor.matrixCoefficients F _ A B C dA dB dC = + @Tensor.matrixCoefficients F _ A B C eA eB eC := by + have hA : dA = eA := Subsingleton.elim _ _ + have hB : dB = eB := Subsingleton.elim _ _ + have hC : dC = eC := Subsingleton.elim _ _ + cases hA + cases hB + cases hC + rfl + +namespace LocalMap + +def redecideMatrix {X Y Z A B C : Type} + [Fintype X] [Fintype Y] [Fintype Z] + {source : Tensor F X Y Z} + {dA : DecidableEq A} {dB : DecidableEq B} {dC : DecidableEq C} + (map : LocalMap source (@Tensor.matrixCoefficients F _ A B C dA dB dC)) + (eA : DecidableEq A) (eB : DecidableEq B) (eC : DecidableEq C) : + LocalMap source (@Tensor.matrixCoefficients F _ A B C eA eB eC) where + x := map.x + y := map.y + z := map.z + coefficient := map.coefficient.trans + (matrixCoefficients_decidable A B C dA eA dB eB dC eC) + +end LocalMap +end MatrixMultiplication.AllFieldFiniteFamily + +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/Arithmetic/RecursiveBlockPrograms.lean b/lean/OAI/LinearAlgebra/MatrixFields/Arithmetic/RecursiveBlockPrograms.lean new file mode 100644 index 0000000000000000000000000000000000000000..d752acf6d488ed4bb48e7c74cfc3ac0a4d86b1a7 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/Arithmetic/RecursiveBlockPrograms.lean @@ -0,0 +1,711 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Construction.ExpressionFamily +import OAI.LinearAlgebra.MatrixFields.Tensors.TerminalRelabel + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section + +namespace MatrixMultiplication.Arithmetic + +variable {F : Type*} [Field F] + +namespace Gate + +variable {Input Input' Register : Type*} + +def mapInput (f : Input → Input') : Gate F Input Register → Gate F Input' Register + | .constant z => .constant z + | .input i => .input (f i) + | .add i j => .add i j + | .sub i j => .sub i j + | .mul i j => .mul i j + +@[simp] theorem eval_mapInput (f : Input → Input') (g : Gate F Input Register) + (inputs : Input' → F) (registers : Register → F) : + (g.mapInput f).eval inputs registers = g.eval (inputs ∘ f) registers := by + cases g <;> rfl + +omit [Field F] in +@[simp] theorem cost_mapInput (f : Input → Input') (g : Gate F Input Register) : + (g.mapInput f).cost = g.cost := by + cases g <;> rfl + +def mapSource (f : Input → Input' ⊕ F) : Gate F Input Register → Gate F Input' Register + | .constant z => .constant z + | .input i => match f i with + | .inl j => .input j + | .inr z => .constant z + | .add i j => .add i j + | .sub i j => .sub i j + | .mul i j => .mul i j + +@[simp] theorem eval_mapSource (f : Input → Input' ⊕ F) (g : Gate F Input Register) + (inputs : Input' → F) (registers : Register → F) : + (g.mapSource f).eval inputs registers = + g.eval (fun i => Sum.elim inputs id (f i)) registers := by + cases g with + | input i => cases h : f i <;> simp [mapSource, h, eval] + | constant => rfl + | add => rfl + | sub => rfl + | mul => rfl + +omit [Field F] in +@[simp] theorem cost_mapSource (f : Input → Input' ⊕ F) (g : Gate F Input Register) : + (g.mapSource f).cost = g.cost := by + cases g with + | input i => cases h : f i <;> simp [mapSource, h, cost] + | constant => rfl + | add => rfl + | sub => rfl + | mul => rfl + +end Gate + +namespace Program + +variable {Input Input' Mid : Type*} + +def mapInput (f : Input → Input') : {r : ℕ} → Program F Input r → Program F Input' r + | 0, .nil => .nil + | _ + 1, .step p g => (p.mapInput f).step (g.mapInput f) + +@[simp] theorem eval_mapInput (f : Input → Input') {r : ℕ} (p : Program F Input r) + (inputs : Input' → F) : + ∀ i : Fin r, (p.mapInput f).eval inputs i = p.eval (inputs ∘ f) i := by + induction p with + | nil => intro i; exact Fin.elim0 i + | @step r p g ih => + intro i + refine Fin.cases ?_ (fun j => ?_) i + · simp only [mapInput, eval_step_zero, Gate.eval_mapInput] + rw [funext ih] + · exact ih j + +omit [Field F] in +@[simp] theorem cost_mapInput (f : Input → Input') {r : ℕ} (p : Program F Input r) : + (p.mapInput f).cost = p.cost := by + induction p with + | nil => rfl + | step p g ih => simp only [mapInput, cost_step, Gate.cost_mapInput, ih] + +def mapSource (f : Input → Input' ⊕ F) : {r : ℕ} → Program F Input r → Program F Input' r + | 0, .nil => .nil + | _ + 1, .step p g => (p.mapSource f).step (g.mapSource f) + +@[simp] theorem eval_mapSource (f : Input → Input' ⊕ F) {r : ℕ} + (p : Program F Input r) (inputs : Input' → F) : + ∀ i : Fin r, (p.mapSource f).eval inputs i = + p.eval (fun j => Sum.elim inputs id (f j)) i := by + induction p with + | nil => intro i; exact Fin.elim0 i + | @step r p g ih => + intro i + refine Fin.cases ?_ (fun j => ?_) i + · simp only [mapSource, eval_step_zero, Gate.eval_mapSource] + rw [funext ih] + · exact ih j + +omit [Field F] in +@[simp] theorem cost_mapSource (f : Input → Input' ⊕ F) {r : ℕ} + (p : Program F Input r) : (p.mapSource f).cost = p.cost := by + induction p with + | nil => rfl + | step p g ih => simp only [mapSource, cost_step, Gate.cost_mapSource, ih] + +structure Substituted {r s : ℕ} (p : Program F Input r) (q : Program F Mid s) + (wires : Mid → Fin r) where + registers : ℕ + program : Program F Input registers + oldOutput : Fin r → Fin registers + output : Fin s → Fin registers + correctOld : ∀ inputs i, program.eval inputs (oldOutput i) = p.eval inputs i + correct : ∀ inputs i, program.eval inputs (output i) = + q.eval (fun j => p.eval inputs (wires j)) i + cost_eq : program.cost = p.cost + q.cost + +namespace Substituted + +def step {r s : ℕ} {p : Program F Input r} {q : Program F Mid s} + {wires : Mid → Fin r} (a : Substituted p q wires) + (g : Gate F Mid (Fin s)) (h : Gate F Input (Fin a.registers)) + (heval : ∀ inputs, h.eval inputs (a.program.eval inputs) = + g.eval (fun j => p.eval inputs (wires j)) + (q.eval (fun j => p.eval inputs (wires j)))) + (hcost : h.cost = g.cost) : Substituted p (q.step g) wires where + registers := a.registers + 1 + program := a.program.step h + oldOutput := fun i => (a.oldOutput i).succ + output := Fin.cases 0 (fun i => (a.output i).succ) + correctOld := by + intro inputs i + exact a.correctOld inputs i + correct := by + intro inputs i + refine Fin.cases ?_ (fun j => ?_) i + · exact heval inputs + · exact a.correct inputs j + cost_eq := by + simp only [cost_step, a.cost_eq, hcost, Nat.add_assoc] + +end Substituted + +def substitute {r : ℕ} (p : Program F Input r) : + {s : ℕ} → (q : Program F Mid s) → (wires : Mid → Fin r) → Substituted p q wires + | 0, .nil, wires => + { registers := r + program := p + oldOutput := id + output := Fin.elim0 + correctOld := fun _ _ => rfl + correct := fun _ i => Fin.elim0 i + cost_eq := by simp only [cost, Nat.add_zero] } + | _ + 1, .step q g, wires => + let a := substitute p q wires + match g with + | .input j => + { registers := a.registers + program := a.program + oldOutput := a.oldOutput + output := Fin.cases (a.oldOutput (wires j)) a.output + correctOld := a.correctOld + correct := by + intro inputs i + refine Fin.cases ?_ (fun k => ?_) i + · exact a.correctOld inputs (wires j) + · exact a.correct inputs k + cost_eq := by + simpa only [cost_step, Gate.cost, Nat.add_zero] using a.cost_eq } + | .constant z => + a.step (.constant z) (.constant z) (fun _ => rfl) rfl + | .add i j => + a.step (.add i j) (.add (a.output i) (a.output j)) + (by intro inputs; simp only [Gate.eval, a.correct]) rfl + | .sub i j => + a.step (.sub i j) (.sub (a.output i) (a.output j)) + (by intro inputs; simp only [Gate.eval, a.correct]) rfl + | .mul i j => + a.step (.mul i j) (.mul (a.output i) (a.output j)) + (by intro inputs; simp only [Gate.eval, a.correct]) rfl + +end Program + +end MatrixMultiplication.Arithmetic + +end + + + + +noncomputable section + +open scoped BigOperators + +namespace MatrixMultiplication.Arithmetic + +variable {F : Type*} [Field F] + +def zeroPadMatrix {a b : ℕ} (A B : ℕ) (M : Matrix (Fin a) (Fin b) F) : + Matrix (Fin A) (Fin B) F := + fun i j => if hi : i.val < a then + if hj : j.val < b then M ⟨i.val, hi⟩ ⟨j.val, hj⟩ else 0 + else 0 + +@[simp] theorem zeroPadMatrix_castLE {a b A B : ℕ} (ha : a ≤ A) (hb : b ≤ B) + (M : Matrix (Fin a) (Fin b) F) (i : Fin a) (j : Fin b) : + zeroPadMatrix A B M (Fin.castLE ha i) (Fin.castLE hb j) = M i j := by + simp [zeroPadMatrix, i.is_lt, j.is_lt] + +theorem sum_fin_castLE_of_zero {n m : ℕ} (h : n ≤ m) (f : Fin m → F) + (hf : ∀ j : Fin m, n ≤ j.val → f j = 0) : + (∑ j : Fin m, f j) = ∑ j : Fin n, f (Fin.castLE h j) := by + symm + refine Fintype.sum_of_injective (Fin.castLE h) ?_ + (fun j : Fin n => f (Fin.castLE h j)) f ?_ (fun _ => rfl) + · intro i j hij + exact Fin.ext (congrArg (fun v : Fin m => v.val) hij) + · intro j hj + exact hf j (le_of_not_gt fun hsmall => hj ⟨⟨j.val, hsmall⟩, Fin.ext rfl⟩) + +theorem zeroPadMatrix_mul {a b c A B C : ℕ} (ha : a ≤ A) (hb : b ≤ B) (hc : c ≤ C) + (M : Matrix (Fin a) (Fin b) F) (N : Matrix (Fin b) (Fin c) F) + (i : Fin a) (k : Fin c) : + (zeroPadMatrix A B M * zeroPadMatrix B C N) (Fin.castLE ha i) (Fin.castLE hc k) = + (M * N) i k := by + rw [Matrix.mul_apply, Matrix.mul_apply] + calc + (∑ j : Fin B, + zeroPadMatrix A B M (Fin.castLE ha i) j * + zeroPadMatrix B C N j (Fin.castLE hc k)) = + ∑ j : Fin b, + zeroPadMatrix A B M (Fin.castLE ha i) (Fin.castLE hb j) * + zeroPadMatrix B C N (Fin.castLE hb j) (Fin.castLE hc k) := by + apply sum_fin_castLE_of_zero hb + intro j hj + simp [zeroPadMatrix, not_lt_of_ge hj] + _ = ∑ j : Fin b, M i j * N j k := by simp + +def padSource {a b c A B C : ℕ} : MatrixInput A B C → MatrixInput a b c ⊕ F + | .inl (i, j) => if hi : i.val < a then + if hj : j.val < b then .inl (.inl (⟨i.val, hi⟩, ⟨j.val, hj⟩)) else .inr 0 + else .inr 0 + | .inr (j, k) => if hj : j.val < b then + if hk : k.val < c then .inl (.inr (⟨j.val, hj⟩, ⟨k.val, hk⟩)) else .inr 0 + else .inr 0 + +theorem padSource_eval {a b c A B C : ℕ} + (M : Matrix (Fin a) (Fin b) F) (N : Matrix (Fin b) (Fin c) F) : + (fun x : MatrixInput A B C => Sum.elim (matrixInputs M N) id (padSource x)) = + matrixInputs (zeroPadMatrix A B M) (zeroPadMatrix B C N) := by + funext x + rcases x with ⟨i, j⟩ | ⟨j, k⟩ + · by_cases hi : i.val < a <;> by_cases hj : j.val < b <;> + simp [padSource, matrixInputs, zeroPadMatrix, hi, hj] + · by_cases hj : j.val < b <;> by_cases hk : k.val < c <;> + simp [padSource, matrixInputs, zeroPadMatrix, hj, hk] + +namespace MatrixAlgorithm + +def pad {a b c A B C : ℕ} (ha : a ≤ A) (_hb : b ≤ B) (hc : c ≤ C) + (P : MatrixAlgorithm F A B C) : MatrixAlgorithm F a b c where + registers := P.registers + program := P.program.mapSource (padSource (a := a) (b := b) (c := c)) + output := fun i k => P.output (Fin.castLE ha i) (Fin.castLE hc k) + +theorem pad_correct {a b c A B C : ℕ} (ha : a ≤ A) (hb : b ≤ B) (hc : c ≤ C) + {P : MatrixAlgorithm F A B C} (hP : P.Correct) : (pad ha hb hc P).Correct := by + intro M N + funext i k + change (P.program.mapSource (padSource (a := a) (b := b) (c := c))).eval + (matrixInputs M N) (P.output (Fin.castLE ha i) (Fin.castLE hc k)) = (M * N) i k + rw [Program.eval_mapSource, padSource_eval] + have hentry := congrFun (congrFun + (hP (zeroPadMatrix A B M) (zeroPadMatrix B C N)) (Fin.castLE ha i)) (Fin.castLE hc k) + exact hentry.trans (zeroPadMatrix_mul ha hb hc M N i k) + +@[simp] theorem pad_cost_eq {a b c A B C : ℕ} (ha : a ≤ A) (hb : b ≤ B) (hc : c ≤ C) + (P : MatrixAlgorithm F A B C) : (pad ha hb hc P).cost = P.cost := + Program.cost_mapSource (padSource (a := a) (b := b) (c := c)) P.program + +theorem exists_restrict {a b c A B C : ℕ} (ha : a ≤ A) (hb : b ≤ B) (hc : c ≤ C) + (P : MatrixAlgorithm F A B C) (hP : P.Correct) : + ∃ Q : MatrixAlgorithm F a b c, Q.Correct ∧ Q.cost ≤ P.cost := + ⟨pad ha hb hc P, pad_correct ha hb hc hP, (pad_cost_eq ha hb hc P).le⟩ + +end MatrixAlgorithm + +theorem RectangularAdmissibleExponent.mono_aspect {k l τ : ℝ} + (h : RectangularAdmissibleExponent F l τ) (hkl : k ≤ l) : + RectangularAdmissibleExponent F k τ := by + intro ε hε + obtain ⟨C, hC, hbound⟩ := h ε hε + refine ⟨C, hC, ?_⟩ + intro n hn + obtain ⟨P, hP, hcost⟩ := hbound n hn + obtain ⟨Q, hQ, hcostQ⟩ := MatrixAlgorithm.exists_restrict (le_refl n) + (innerSize_mono hn hkl) (le_refl n) P hP + exact ⟨Q, hQ, (Nat.cast_le.mpr hcostQ).trans hcost⟩ + +end MatrixMultiplication.Arithmetic + + + + + + + +namespace MatrixMultiplication.Arithmetic.RecursiveBlock + +open MatrixMultiplication.Foundation + +variable {F : Type*} [Field F] + +namespace LinearExpression + +variable {Input : Type*} + +def sumFin : (n : ℕ) → (Fin n → Expression F Input) → Expression F Input + | 0, _ => .constant 0 + | n + 1, f => .add (f 0) (sumFin n (fun i => f i.succ)) + +theorem eval_sumFin (n : ℕ) (f : Fin n → Expression F Input) (inputs : Input → F) : + (sumFin n f).eval inputs = ∑ i, (f i).eval inputs := by + induction n with + | zero => simp [sumFin, Expression.eval] + | succ n ih => + simp only [sumFin, Expression.eval, ih, Fin.sum_univ_succ] + +theorem cost_sumFin (n : ℕ) (f : Fin n → Expression F Input) : + (sumFin n f).cost = (∑ i, (f i).cost) + n := by + induction n with + | zero => simp [sumFin, Expression.cost] + | succ n ih => + simp only [sumFin, Expression.cost, ih, Fin.sum_univ_succ] + omega + +def linear {Term : Type*} [Fintype Term] (a : Term → F) (wire : Term → Input) : + Expression F Input := + sumFin (Fintype.card Term) (fun i => + .mul (.constant (a ((Fintype.equivFin Term).symm i))) + (.input (wire ((Fintype.equivFin Term).symm i)))) + +theorem eval_linear {Term : Type*} [Fintype Term] + (a : Term → F) (wire : Term → Input) (inputs : Input → F) : + (linear a wire).eval inputs = ∑ i, a i * inputs (wire i) := by + rw [linear, eval_sumFin] + exact (Fintype.equivFin Term).symm.sum_comp (fun i => a i * inputs (wire i)) + +theorem cost_linear {Term : Type*} [Fintype Term] + (a : Term → F) (wire : Term → Input) : + (linear a wire).cost = 2 * Fintype.card Term := by + simp [linear, cost_sumFin, Expression.cost, two_mul] + +end LinearExpression + +structure Family (F Input Output : Type*) where + registers : ℕ + program : Program F Input registers + output : Output → Fin registers + +namespace Family + +variable {Input Mid Output : Type*} + +def eval (p : Family F Input Output) (inputs : Input → F) (o : Output) : F := + p.program.eval inputs (p.output o) + +def cost (p : Family F Input Output) : ℕ := p.program.cost + +def expressions [Fintype Output] (e : Output → Expression F Input) : Family F Input Output := + let p := Expression.compileFamily e + ⟨p.registers, p.program, p.output⟩ + +theorem eval_expressions [Fintype Output] (e : Output → Expression F Input) + (inputs : Input → F) (o : Output) : + (expressions e).eval inputs o = (e o).eval inputs := + (Expression.compileFamily e).correct inputs o + +theorem cost_expressions [Fintype Output] (e : Output → Expression F Input) : + (expressions e).cost = ∑ o, (e o).cost := + (Expression.compileFamily e).cost_eq + +def compose (p : Family F Input Mid) (q : Family F Mid Output) : Family F Input Output := + let s := p.program.substitute q.program p.output + ⟨s.registers, s.program, fun o => s.output (q.output o)⟩ + +theorem eval_compose (p : Family F Input Mid) (q : Family F Mid Output) + (inputs : Input → F) (o : Output) : + (compose p q).eval inputs o = q.eval (p.eval inputs) o := + (p.program.substitute q.program p.output).correct inputs (q.output o) + +theorem cost_compose (p : Family F Input Mid) (q : Family F Mid Output) : + (compose p q).cost = p.cost + q.cost := + (p.program.substitute q.program p.output).cost_eq + +def mapInputs {NewInput : Type*} (f : Input → NewInput) (p : Family F Input Output) : + Family F NewInput Output := + ⟨p.registers, p.program.mapInput f, p.output⟩ + +theorem eval_mapInputs {NewInput : Type*} (f : Input → NewInput) + (p : Family F Input Output) (inputs : NewInput → F) (o : Output) : + (p.mapInputs f).eval inputs o = p.eval (fun i => inputs (f i)) o := by + exact Program.eval_mapInput f p.program inputs (p.output o) + +omit [Field F] in +theorem cost_mapInputs {NewInput : Type*} (f : Input → NewInput) + (p : Family F Input Output) : (p.mapInputs f).cost = p.cost := by + exact Program.cost_mapInput f p.program + +def parallel : (r : ℕ) → (Fin r → Family F Input Output) → Family F Input (Fin r × Output) + | 0, _ => ⟨0, Program.nil, fun o => Fin.elim0 o.1⟩ + | r + 1, p => + let head := p 0 + let tail := parallel r (fun i => p i.succ) + { registers := head.registers + tail.registers + program := head.program.append tail.program + output := fun o => Fin.cases + (Program.oldIndex _ _ (head.output o.2)) + (fun i => Program.newIndex _ _ (tail.output (i, o.2))) o.1 } + +theorem eval_parallel (r : ℕ) (p : Fin r → Family F Input Output) + (inputs : Input → F) (o : Fin r × Output) : + (parallel r p).eval inputs o = (p o.1).eval inputs o.2 := by + induction r with + | zero => exact Fin.elim0 o.1 + | succ r ih => + rcases o with ⟨i, o⟩ + refine Fin.cases ?_ (fun j => ?_) i + · exact Program.eval_append_old _ _ inputs _ + · exact (Program.eval_append_new _ _ inputs _).trans + (ih (fun j => p j.succ) (j, o)) + +omit [Field F] in +theorem cost_parallel (r : ℕ) (p : Fin r → Family F Input Output) : + (parallel r p).cost = ∑ i, (p i).cost := by + induction r with + | zero => simp [parallel, cost, Program.cost] + | succ r ih => + change ((p 0).program.append (parallel r (fun i => p i.succ)).program).cost = _ + rw [Program.cost_append] + change (p 0).cost + (parallel r (fun i => p i.succ)).cost = _ + rw [ih, Fin.sum_univ_succ] + +def copies (r : ℕ) (p : Family F Input Output) : + Family F (Fin r × Input) (Fin r × Output) := + parallel r (fun i => p.mapInputs (fun x => (i, x))) + +theorem eval_copies (r : ℕ) (p : Family F Input Output) + (inputs : Fin r × Input → F) (o : Fin r × Output) : + (copies r p).eval inputs o = p.eval (fun x => inputs (o.1, x)) o.2 := by + rw [copies, eval_parallel, eval_mapInputs] + +omit [Field F] in +theorem cost_copies (r : ℕ) (p : Family F Input Output) : + (copies r p).cost = r * p.cost := by + simp [copies, cost_parallel, cost_mapInputs] + +def ofMatrix {m l q : ℕ} (p : MatrixAlgorithm F m l q) : + Family F (MatrixInput m l q) (Fin m × Fin q) := + ⟨p.registers, p.program, fun o => p.output o.1 o.2⟩ + +omit [Field F] in +@[simp] theorem cost_ofMatrix {m l q : ℕ} (p : MatrixAlgorithm F m l q) : + (ofMatrix p).cost = p.cost := rfl + +theorem eval_ofMatrix {m l q : ℕ} (p : MatrixAlgorithm F m l q) (hp : p.Correct) + (inputs : MatrixInput m l q → F) (o : Fin m × Fin q) : + (ofMatrix p).eval inputs o = + ∑ j, inputs (.inl (o.1, j)) * inputs (.inr (j, o.2)) := by + have h := (MatrixAlgorithm.correct_iff_entries p).mp hp + (fun i j => inputs (.inl (i, j))) (fun j k => inputs (.inr (j, k))) o.1 o.2 + have hi : matrixInputs (fun i j => inputs (.inl (i, j))) + (fun j k => inputs (.inr (j, k))) = inputs := by + funext x + cases x <;> rfl + rw [hi] at h + exact h + +end Family + +section BlockIdentities + +variable {n₁ n₂ n₃ r m₁ m₂ m₃ : ℕ} + +def join {n m : ℕ} (i : Fin n) (j : Fin m) : Fin (n * m) := finProdFinEquiv (i, j) + +theorem rank_bilinear_identity + (a : Fin r → Fin n₁ × Fin n₂ → F) + (b : Fin r → Fin n₂ × Fin n₃ → F) + (c : Fin r → Fin n₃ × Fin n₁ → F) + (h : Tensor.matrixCoefficients (K := F) (Fin n₁) (Fin n₂) (Fin n₃) = + fun x y z => ∑ q, Tensor.rankOne (a q) (b q) (c q) x y z) + (left : Fin n₁ × Fin n₂ → F) (right : Fin n₂ × Fin n₃ → F) + (i : Fin n₁) (k : Fin n₃) : + (∑ q, c q (k, i) * (∑ x, a q x * left x) * (∑ y, b q y * right y)) = + ∑ j, left (i, j) * right (j, k) := by + rw [← Tensor.contract_matrixCoefficients left right i k] + rw [h] + simp only [Tensor.contract, Tensor.rankOne, Finset.sum_mul, Finset.mul_sum] + calc + (∑ q, ∑ y, ∑ x, c q (k, i) * (a q x * left x) * (b q y * right y)) = + ∑ q, ∑ x, ∑ y, c q (k, i) * (a q x * left x) * (b q y * right y) := by + apply Finset.sum_congr rfl + intro q hq + exact Finset.sum_comm + _ = ∑ x, ∑ q, ∑ y, c q (k, i) * (a q x * left x) * (b q y * right y) := + Finset.sum_comm + _ = ∑ x, ∑ y, ∑ q, a q x * b q y * c q (k, i) * left x * right y := by + apply Finset.sum_congr rfl + intro x hx + rw [Finset.sum_comm] + apply Finset.sum_congr rfl + intro y hy + apply Finset.sum_congr rfl + intro q hq + ring + +def leftBlock (a : Fin r → Fin n₁ × Fin n₂ → F) + (A : Matrix (Fin (n₁ * m₁)) (Fin (n₂ * m₂)) F) (q : Fin r) : + Matrix (Fin m₁) (Fin m₂) F := + fun s t => ∑ x, a q x * A (join x.1 s) (join x.2 t) + +def rightBlock (b : Fin r → Fin n₂ × Fin n₃ → F) + (B : Matrix (Fin (n₂ * m₂)) (Fin (n₃ * m₃)) F) (q : Fin r) : + Matrix (Fin m₂) (Fin m₃) F := + fun t u => ∑ y, b q y * B (join y.1 t) (join y.2 u) + +theorem block_identity + (a : Fin r → Fin n₁ × Fin n₂ → F) + (b : Fin r → Fin n₂ × Fin n₃ → F) + (c : Fin r → Fin n₃ × Fin n₁ → F) + (h : Tensor.matrixCoefficients (K := F) (Fin n₁) (Fin n₂) (Fin n₃) = + fun x y z => ∑ q, Tensor.rankOne (a q) (b q) (c q) x y z) + (A : Matrix (Fin (n₁ * m₁)) (Fin (n₂ * m₂)) F) + (B : Matrix (Fin (n₂ * m₂)) (Fin (n₃ * m₃)) F) + (i : Fin n₁) (k : Fin n₃) (s : Fin m₁) (u : Fin m₃) : + (∑ q, c q (k, i) * ((leftBlock a A q) * (rightBlock b B q)) s u) = + (A * B) (join i s) (join k u) := by + simp only [Matrix.mul_apply, Finset.mul_sum] + rw [Finset.sum_comm] + have hlocal (t : Fin m₂) := rank_bilinear_identity a b c h + (fun x => A (join x.1 s) (join x.2 t)) + (fun y => B (join y.1 t) (join y.2 u)) i k + simp only [leftBlock, rightBlock] + simp_rw [← mul_assoc, hlocal] + rw [Finset.sum_comm] + exact (Fintype.sum_prod_type _).symm.trans + (finProdFinEquiv.sum_comp (fun j => A (join i s) j * B j (join k u))) + +end BlockIdentities + +section BlockPrograms + +variable {n₁ n₂ n₃ r m₁ m₂ m₃ : ℕ} + +def inputExpressions (a : Fin r → Fin n₁ × Fin n₂ → F) + (b : Fin r → Fin n₂ × Fin n₃ → F) : + Fin r × MatrixInput m₁ m₂ m₃ → + Expression F (MatrixInput (n₁ * m₁) (n₂ * m₂) (n₃ * m₃)) + | (q, .inl (s, t)) => LinearExpression.linear (a q) + (fun x => .inl (join x.1 s, join x.2 t)) + | (q, .inr (t, u)) => LinearExpression.linear (b q) + (fun y => .inr (join y.1 t, join y.2 u)) + +def inputFamily (a : Fin r → Fin n₁ × Fin n₂ → F) + (b : Fin r → Fin n₂ × Fin n₃ → F) : + Family F (MatrixInput (n₁ * m₁) (n₂ * m₂) (n₃ * m₃)) + (Fin r × MatrixInput m₁ m₂ m₃) := + Family.expressions (inputExpressions a b) + +theorem inputFamily_eval (a : Fin r → Fin n₁ × Fin n₂ → F) + (b : Fin r → Fin n₂ × Fin n₃ → F) + (A : Matrix (Fin (n₁ * m₁)) (Fin (n₂ * m₂)) F) + (B : Matrix (Fin (n₂ * m₂)) (Fin (n₃ * m₃)) F) + (q : Fin r) (x : MatrixInput m₁ m₂ m₃) : + (inputFamily a b).eval (matrixInputs A B) (q, x) = + matrixInputs (leftBlock a A q) (rightBlock b B q) x := by + cases x with + | inl x => + simp only [inputFamily, Family.eval_expressions, inputExpressions, + LinearExpression.eval_linear, matrixInputs, leftBlock] + | inr x => + simp only [inputFamily, Family.eval_expressions, inputExpressions, + LinearExpression.eval_linear, matrixInputs, rightBlock] + +theorem inputFamily_cost (a : Fin r → Fin n₁ × Fin n₂ → F) + (b : Fin r → Fin n₂ × Fin n₃ → F) : + (inputFamily (m₁ := m₁) (m₂ := m₂) (m₃ := m₃) a b).cost = + 2 * r * (n₁ * n₂ * m₁ * m₂ + n₂ * n₃ * m₂ * m₃) := by + rw [inputFamily, Family.cost_expressions] + simp only [Fintype.sum_prod_type, Fintype.sum_sum_type, + inputExpressions, LinearExpression.cost_linear, Fintype.card_prod, + Fintype.card_fin, Finset.sum_const, Finset.card_univ, smul_eq_mul] + ring + +def recursiveProducts (a : Fin r → Fin n₁ × Fin n₂ → F) + (b : Fin r → Fin n₂ × Fin n₃ → F) (p : MatrixAlgorithm F m₁ m₂ m₃) : + Family F (MatrixInput (n₁ * m₁) (n₂ * m₂) (n₃ * m₃)) + (Fin r × (Fin m₁ × Fin m₃)) := + (inputFamily a b).compose (Family.copies r (Family.ofMatrix p)) + +theorem recursiveProducts_eval (a : Fin r → Fin n₁ × Fin n₂ → F) + (b : Fin r → Fin n₂ × Fin n₃ → F) + (p : MatrixAlgorithm F m₁ m₂ m₃) (hp : p.Correct) + (A : Matrix (Fin (n₁ * m₁)) (Fin (n₂ * m₂)) F) + (B : Matrix (Fin (n₂ * m₂)) (Fin (n₃ * m₃)) F) + (q : Fin r) (s : Fin m₁) (u : Fin m₃) : + (recursiveProducts a b p).eval (matrixInputs A B) (q, (s, u)) = + ((leftBlock a A q) * (rightBlock b B q)) s u := by + rw [recursiveProducts, Family.eval_compose, Family.eval_copies, + Family.eval_ofMatrix _ hp] + simp only [inputFamily_eval, matrixInputs, Matrix.mul_apply] + +theorem recursiveProducts_cost (a : Fin r → Fin n₁ × Fin n₂ → F) + (b : Fin r → Fin n₂ × Fin n₃ → F) (p : MatrixAlgorithm F m₁ m₂ m₃) : + (recursiveProducts a b p).cost = + 2 * r * (n₁ * n₂ * m₁ * m₂ + n₂ * n₃ * m₂ * m₃) + r * p.cost := by + rw [recursiveProducts, Family.cost_compose, inputFamily_cost, + Family.cost_copies, Family.cost_ofMatrix] + +def outputExpressions (c : Fin r → Fin n₃ × Fin n₁ → F) : + Fin (n₁ * m₁) × Fin (n₃ * m₃) → Expression F (Fin r × (Fin m₁ × Fin m₃)) := + fun o => LinearExpression.linear + (fun q => c q ((finProdFinEquiv.symm o.2).1, (finProdFinEquiv.symm o.1).1)) + (fun q => (q, ((finProdFinEquiv.symm o.1).2, (finProdFinEquiv.symm o.2).2))) + +def outputFamily (c : Fin r → Fin n₃ × Fin n₁ → F) : + Family F (Fin r × (Fin m₁ × Fin m₃)) (Fin (n₁ * m₁) × Fin (n₃ * m₃)) := + Family.expressions (outputExpressions c) + +theorem outputFamily_eval (c : Fin r → Fin n₃ × Fin n₁ → F) + (inputs : Fin r × (Fin m₁ × Fin m₃) → F) + (i : Fin n₁) (k : Fin n₃) (s : Fin m₁) (u : Fin m₃) : + (outputFamily c).eval inputs (join i s, join k u) = + ∑ q, c q (k, i) * inputs (q, (s, u)) := by + simp only [outputFamily, Family.eval_expressions, outputExpressions, + LinearExpression.eval_linear, join, Equiv.symm_apply_apply] + +theorem outputFamily_cost (c : Fin r → Fin n₃ × Fin n₁ → F) : + (outputFamily (m₁ := m₁) (m₃ := m₃) c).cost = 2 * r * n₁ * n₃ * m₁ * m₃ := by + simp only [outputFamily, Family.cost_expressions, outputExpressions, + LinearExpression.cost_linear, Fintype.card_fin, Finset.sum_const, + Finset.card_univ, Fintype.card_prod, smul_eq_mul] + ring + +def algorithm (a : Fin r → Fin n₁ × Fin n₂ → F) + (b : Fin r → Fin n₂ × Fin n₃ → F) (c : Fin r → Fin n₃ × Fin n₁ → F) + (p : MatrixAlgorithm F m₁ m₂ m₃) : + MatrixAlgorithm F (n₁ * m₁) (n₂ * m₂) (n₃ * m₃) := + let f := (recursiveProducts a b p).compose (outputFamily c) + ⟨f.registers, f.program, fun i k => f.output (i, k)⟩ + +theorem algorithm_correct + (a : Fin r → Fin n₁ × Fin n₂ → F) + (b : Fin r → Fin n₂ × Fin n₃ → F) (c : Fin r → Fin n₃ × Fin n₁ → F) + (h : Tensor.matrixCoefficients (K := F) (Fin n₁) (Fin n₂) (Fin n₃) = + fun x y z => ∑ q, Tensor.rankOne (a q) (b q) (c q) x y z) + (p : MatrixAlgorithm F m₁ m₂ m₃) (hp : p.Correct) : (algorithm a b c p).Correct := by + intro A B + funext i k + obtain ⟨⟨i, s⟩, rfl⟩ := finProdFinEquiv.surjective i + obtain ⟨⟨k, u⟩, rfl⟩ := finProdFinEquiv.surjective k + change ((recursiveProducts a b p).compose (outputFamily c)).eval + (matrixInputs A B) (join i s, join k u) = _ + rw [Family.eval_compose, outputFamily_eval] + simp_rw [recursiveProducts_eval a b p hp A B] + exact block_identity a b c h A B i k s u + +theorem algorithm_cost (a : Fin r → Fin n₁ × Fin n₂ → F) + (b : Fin r → Fin n₂ × Fin n₃ → F) (c : Fin r → Fin n₃ × Fin n₁ → F) + (p : MatrixAlgorithm F m₁ m₂ m₃) : + (algorithm a b c p).cost = r * p.cost + + 2 * r * (n₁ * n₂ * m₁ * m₂ + n₂ * n₃ * m₂ * m₃ + n₁ * n₃ * m₁ * m₃) := by + change ((recursiveProducts a b p).compose (outputFamily c)).cost = _ + rw [Family.cost_compose, recursiveProducts_cost, outputFamily_cost] + ring + +theorem rank_block_step + (h : Tensor.RankAtMost (Tensor.matrixCoefficients (K := F) (Fin n₁) (Fin n₂) (Fin n₃)) r) + (p : MatrixAlgorithm F m₁ m₂ m₃) (hp : p.Correct) : + ∃ q : MatrixAlgorithm F (n₁ * m₁) (n₂ * m₂) (n₃ * m₃), q.Correct ∧ + q.cost = r * p.cost + + 2 * r * (n₁ * n₂ * m₁ * m₂ + n₂ * n₃ * m₂ * m₃ + n₁ * n₃ * m₁ * m₃) := by + rcases h with ⟨a, b, c, h⟩ + exact ⟨algorithm a b c p, algorithm_correct a b c h p hp, algorithm_cost a b c p⟩ + +end BlockPrograms + +end MatrixMultiplication.Arithmetic.RecursiveBlock + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA1_1_14I0.lean b/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA1_1_14I0.lean new file mode 100644 index 0000000000000000000000000000000000000000..ef241f7aae589fbb5e89b967e538c065f6550bb0 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA1_1_14I0.lean @@ -0,0 +1,70 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Certificates.SplitA1_1_14 + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CA1_1_14I0Value (a : Fin 17) : ℝ := marginal (below (shape 1 1 14)) (fun u => (stageALaw (shape 1 1 14) u : ℝ)) ((Equiv.refl (Fin 3)) 0) a +def CA1_1_14I0Raw (a : Fin 17) : Ball := marginalBall (below (shape 1 1 14)) A1_1_14Law ((Equiv.refl (Fin 3)) 0) a +lemma CA1_1_14I0Raw_sound (a : Fin 17) : + (CA1_1_14I0Raw a).Encloses (CA1_1_14I0Value a) := by + exact marginalBall_sound (below (shape 1 1 14)) A1_1_14Law (fun u => (stageALaw (shape 1 1 14) u : ℝ)) (fun u _ => A1_1_14Law_sound u) ((Equiv.refl (Fin 3)) 0) a +def CA1_1_14I0Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(1 / 2), (47 / 100000000000000000000000000000000)⟩ ⟨(6931471805599453094172319305033 / 20000000000000000000000000000000), (21175823763 / 100000000000000000000000000000000)⟩ ⟨(-6931471805599453094172319305033 / 10000000000000000000000000000000), (42351647459 / 100000000000000000000000000000000)⟩ ⟨-1, 1, 1⟩] +lemma CA1_1_14I0Certificates_valid : + CA1_1_14I0Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_1_14I0CertificateIndex (a : Fin 17) : ℕ := + match a.val with + | 0 => 1 + | 1 => 1 + | _ => 0 +def CA1_1_14I0P (a : Fin 17) : Ball := + (CompactCertificate.entropyLookup CA1_1_14I0Certificates (CA1_1_14I0CertificateIndex a)).input +lemma CA1_1_14I0P_check : ∀ a : Fin 17, contains (CA1_1_14I0Raw a) (CA1_1_14I0P a) = true := by + decide +kernel +lemma CA1_1_14I0P_sound (a : Fin 17) : + (CA1_1_14I0P a).Encloses (CA1_1_14I0Value a) := + contains_sound (CA1_1_14I0Raw_sound a) (CA1_1_14I0P_check a) +def CA1_1_14I0Terms (a : Fin 17) : Ball := + (CompactCertificate.entropyLookup CA1_1_14I0Certificates (CA1_1_14I0CertificateIndex a)).output +lemma CA1_1_14I0Terms_sound (a : Fin 17) : + (CA1_1_14I0Terms a).Encloses (Foundation.entropyTerm (CA1_1_14I0Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_1_14I0Certificates_valid + (CA1_1_14I0CertificateIndex a) (CA1_1_14I0P_sound a) +def CA1_1_14I0Entropy : Ball := ⟨(6931471805599453094172319305033 / 10000000000000000000000000000000), (21175823763 / 50000000000000000000000000000000)⟩ +lemma CA1_1_14I0Entropy_sound : CA1_1_14I0Entropy.Encloses (Foundation.finiteEntropy CA1_1_14I0Value) := by + exact contains_sound (entropyFin_enclosed 17 CA1_1_14I0Value CA1_1_14I0Terms CA1_1_14I0Terms_sound) (by decide +kernel) +def CA1_1_14I0Mass : Ball := ⟨1, (47 / 50000000000000000000000000000000)⟩ +lemma CA1_1_14I0Mass_sound : CA1_1_14I0Mass.Encloses (∑ a, CA1_1_14I0Value a) := by + exact contains_sound (finSumBall_sound 17 CA1_1_14I0P CA1_1_14I0Value CA1_1_14I0P_sound) (by decide +kernel) +def CA1_1_14I0MassTermLogWitness : LogWitness := ⟨0, 1, 1⟩ +def CA1_1_14I0MassTermLog : Ball := ⟨0, (661744493 / 3125000000000000000000000000000)⟩ +lemma CA1_1_14I0MassTermLog_sound : CA1_1_14I0MassTermLog.Encloses (Real.log ((∑ a, CA1_1_14I0Value a))) := by + exact checkLog_sound logTwoBall_sound (CA1_1_14I0Mass_sound) (w := CA1_1_14I0MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA1_1_14I0MassTerm : Ball := ⟨0, (21175823777 / 100000000000000000000000000000000)⟩ +lemma CA1_1_14I0MassTerm_sound : CA1_1_14I0MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_1_14I0Value a))) := by + exact contains_sound (entropyTerm_ball (CA1_1_14I0Mass_sound) CA1_1_14I0MassTermLog_sound) (by decide +kernel) +def CA1_1_14I0H : Ball := ⟨(6931471805599453094172319305033 / 10000000000000000000000000000000), (63527471303 / 100000000000000000000000000000000)⟩ +lemma CA1_1_14I0H_sound : CA1_1_14I0H.Encloses (homogeneousEntropy CA1_1_14I0Value) := by + exact contains_sound (homogeneous_enclosed CA1_1_14I0Value CA1_1_14I0MassTerm_sound CA1_1_14I0Entropy_sound) (by decide +kernel) +lemma CA1_1_14I0_sound : CA1_1_14I0H.Encloses (stageACapacity (shape 1 1 14) 0) := by + exact CA1_1_14I0H_sound + +end MatrixMultiplication.NativeNumerics + +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA1_1_14I1.lean b/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA1_1_14I1.lean new file mode 100644 index 0000000000000000000000000000000000000000..68bf8cacda8daf152416f4108d8ab9afcb787780 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA1_1_14I1.lean @@ -0,0 +1,907 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Certificates.SupportedContraction + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CA1_1_14I1PairValue (a : PairSlot × PairSlot) : ℝ := pairLaw (below (shape 1 1 14)) (shape 1 1 14) (fun u => (stageALaw (shape 1 1 14) u : ℝ)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) a +def CA1_1_14I1PairRaw (a : PairSlot × PairSlot) : Ball := stageAPairBall (shape 1 1 14) A1_1_14Law 1 a +lemma CA1_1_14I1PairRaw_sound (a : PairSlot × PairSlot) : + (CA1_1_14I1PairRaw a).Encloses (CA1_1_14I1PairValue a) := by + exact stageAPairBall_sound (shape 1 1 14) (by decide +kernel) A1_1_14Law (fun u => (stageALaw (shape 1 1 14) u : ℝ)) (fun u _ => A1_1_14Law_sound u) 1 a +def CA1_1_14I1PairCertificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(1 / 4), (1 / 4000000000000000000000000000000)⟩ ⟨(6931471805599453094172319305033 / 20000000000000000000000000000000), (7940933911 / 50000000000000000000000000000000)⟩ ⟨(-6931471805599453094172319305033 / 5000000000000000000000000000000), (15881867787 / 25000000000000000000000000000000)⟩ ⟨-2, 1, 1⟩] +lemma CA1_1_14I1PairCertificates_valid : + CA1_1_14I1PairCertificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_1_14I1PairCertificateIndex (a : PairSlot × PairSlot) : ℕ := + match a.1.1.val, a.1.2.val, a.2.1.val, a.2.2.val with + | 0, 0, 0, 1 => 1 + | 0, 0, 1, 0 => 1 + | 1, 0, 0, 0 => 1 + | 0, 1, 0, 0 => 1 + | _, _, _, _ => 0 +def CA1_1_14I1PairP (a : PairSlot × PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_1_14I1PairCertificates (CA1_1_14I1PairCertificateIndex a)).input +lemma CA1_1_14I1PairP_check_0_0 : ∀ k l : Fin 6, contains (CA1_1_14I1PairRaw ((0,0),(k,l))) (CA1_1_14I1PairP ((0,0),(k,l))) = true := by + decide +kernel +lemma CA1_1_14I1PairP_check_0_1 : ∀ k l : Fin 6, contains (CA1_1_14I1PairRaw ((0,1),(k,l))) (CA1_1_14I1PairP ((0,1),(k,l))) = true := by + decide +kernel +lemma CA1_1_14I1PairP_check_0_2 : ∀ k l : Fin 6, contains (CA1_1_14I1PairRaw ((0,2),(k,l))) (CA1_1_14I1PairP ((0,2),(k,l))) = true := by + decide +kernel +lemma CA1_1_14I1PairP_check_0_3 : ∀ k l : Fin 6, contains (CA1_1_14I1PairRaw ((0,3),(k,l))) (CA1_1_14I1PairP ((0,3),(k,l))) = true := by + decide +kernel +lemma CA1_1_14I1PairP_check_0_4 : ∀ k l : Fin 6, contains (CA1_1_14I1PairRaw ((0,4),(k,l))) (CA1_1_14I1PairP ((0,4),(k,l))) = true := by + decide +kernel +lemma CA1_1_14I1PairP_check_0_5 : ∀ k l : Fin 6, contains (CA1_1_14I1PairRaw ((0,5),(k,l))) (CA1_1_14I1PairP ((0,5),(k,l))) = true := by + decide +kernel +lemma CA1_1_14I1PairP_check_1_0 : ∀ k l : Fin 6, contains (CA1_1_14I1PairRaw ((1,0),(k,l))) (CA1_1_14I1PairP ((1,0),(k,l))) = true := by + decide +kernel +lemma CA1_1_14I1PairP_check_1_1 : ∀ k l : Fin 6, contains (CA1_1_14I1PairRaw ((1,1),(k,l))) (CA1_1_14I1PairP ((1,1),(k,l))) = true := by + decide +kernel +lemma CA1_1_14I1PairP_check_1_2 : ∀ k l : Fin 6, contains (CA1_1_14I1PairRaw ((1,2),(k,l))) (CA1_1_14I1PairP ((1,2),(k,l))) = true := by + decide +kernel +lemma CA1_1_14I1PairP_check_1_3 : ∀ k l : Fin 6, contains (CA1_1_14I1PairRaw ((1,3),(k,l))) (CA1_1_14I1PairP ((1,3),(k,l))) = true := by + decide +kernel +lemma CA1_1_14I1PairP_check_1_4 : ∀ k l : Fin 6, contains (CA1_1_14I1PairRaw ((1,4),(k,l))) (CA1_1_14I1PairP ((1,4),(k,l))) = true := by + decide +kernel +lemma CA1_1_14I1PairP_check_1_5 : ∀ k l : Fin 6, contains (CA1_1_14I1PairRaw ((1,5),(k,l))) (CA1_1_14I1PairP ((1,5),(k,l))) = true := by + decide +kernel +lemma CA1_1_14I1PairP_check_2_0 : ∀ k l : Fin 6, contains (CA1_1_14I1PairRaw ((2,0),(k,l))) (CA1_1_14I1PairP ((2,0),(k,l))) = true := by + decide +kernel +lemma CA1_1_14I1PairP_check_2_1 : ∀ k l : Fin 6, contains (CA1_1_14I1PairRaw ((2,1),(k,l))) (CA1_1_14I1PairP ((2,1),(k,l))) = true := by + decide +kernel +lemma CA1_1_14I1PairP_check_2_2 : ∀ k l : Fin 6, contains (CA1_1_14I1PairRaw ((2,2),(k,l))) (CA1_1_14I1PairP ((2,2),(k,l))) = true := by + decide +kernel +lemma CA1_1_14I1PairP_check_2_3 : ∀ k l : Fin 6, contains (CA1_1_14I1PairRaw ((2,3),(k,l))) (CA1_1_14I1PairP ((2,3),(k,l))) = true := by + decide +kernel +lemma CA1_1_14I1PairP_check_2_4 : ∀ k l : Fin 6, contains (CA1_1_14I1PairRaw ((2,4),(k,l))) (CA1_1_14I1PairP ((2,4),(k,l))) = true := by + decide +kernel +lemma CA1_1_14I1PairP_check_2_5 : ∀ k l : Fin 6, contains (CA1_1_14I1PairRaw ((2,5),(k,l))) (CA1_1_14I1PairP ((2,5),(k,l))) = true := by + decide +kernel +lemma CA1_1_14I1PairP_check_3_0 : ∀ k l : Fin 6, contains (CA1_1_14I1PairRaw ((3,0),(k,l))) (CA1_1_14I1PairP ((3,0),(k,l))) = true := by + decide +kernel +lemma CA1_1_14I1PairP_check_3_1 : ∀ k l : Fin 6, contains (CA1_1_14I1PairRaw ((3,1),(k,l))) (CA1_1_14I1PairP ((3,1),(k,l))) = true := by + decide +kernel +lemma CA1_1_14I1PairP_check_3_2 : ∀ k l : Fin 6, contains (CA1_1_14I1PairRaw ((3,2),(k,l))) (CA1_1_14I1PairP ((3,2),(k,l))) = true := by + decide +kernel +lemma CA1_1_14I1PairP_check_3_3 : ∀ k l : Fin 6, contains (CA1_1_14I1PairRaw ((3,3),(k,l))) (CA1_1_14I1PairP ((3,3),(k,l))) = true := by + decide +kernel +lemma CA1_1_14I1PairP_check_3_4 : ∀ k l : Fin 6, contains (CA1_1_14I1PairRaw ((3,4),(k,l))) (CA1_1_14I1PairP ((3,4),(k,l))) = true := by + decide +kernel +lemma CA1_1_14I1PairP_check_3_5 : ∀ k l : Fin 6, contains (CA1_1_14I1PairRaw ((3,5),(k,l))) (CA1_1_14I1PairP ((3,5),(k,l))) = true := by + decide +kernel +lemma CA1_1_14I1PairP_check_4_0 : ∀ k l : Fin 6, contains (CA1_1_14I1PairRaw ((4,0),(k,l))) (CA1_1_14I1PairP ((4,0),(k,l))) = true := by + decide +kernel +lemma CA1_1_14I1PairP_check_4_1 : ∀ k l : Fin 6, contains (CA1_1_14I1PairRaw ((4,1),(k,l))) (CA1_1_14I1PairP ((4,1),(k,l))) = true := by + decide +kernel +lemma CA1_1_14I1PairP_check_4_2 : ∀ k l : Fin 6, contains (CA1_1_14I1PairRaw ((4,2),(k,l))) (CA1_1_14I1PairP ((4,2),(k,l))) = true := by + decide +kernel +lemma CA1_1_14I1PairP_check_4_3 : ∀ k l : Fin 6, contains (CA1_1_14I1PairRaw ((4,3),(k,l))) (CA1_1_14I1PairP ((4,3),(k,l))) = true := by + decide +kernel +lemma CA1_1_14I1PairP_check_4_4 : ∀ k l : Fin 6, contains (CA1_1_14I1PairRaw ((4,4),(k,l))) (CA1_1_14I1PairP ((4,4),(k,l))) = true := by + decide +kernel +lemma CA1_1_14I1PairP_check_4_5 : ∀ k l : Fin 6, contains (CA1_1_14I1PairRaw ((4,5),(k,l))) (CA1_1_14I1PairP ((4,5),(k,l))) = true := by + decide +kernel +lemma CA1_1_14I1PairP_check_5_0 : ∀ k l : Fin 6, contains (CA1_1_14I1PairRaw ((5,0),(k,l))) (CA1_1_14I1PairP ((5,0),(k,l))) = true := by + decide +kernel +lemma CA1_1_14I1PairP_check_5_1 : ∀ k l : Fin 6, contains (CA1_1_14I1PairRaw ((5,1),(k,l))) (CA1_1_14I1PairP ((5,1),(k,l))) = true := by + decide +kernel +lemma CA1_1_14I1PairP_check_5_2 : ∀ k l : Fin 6, contains (CA1_1_14I1PairRaw ((5,2),(k,l))) (CA1_1_14I1PairP ((5,2),(k,l))) = true := by + decide +kernel +lemma CA1_1_14I1PairP_check_5_3 : ∀ k l : Fin 6, contains (CA1_1_14I1PairRaw ((5,3),(k,l))) (CA1_1_14I1PairP ((5,3),(k,l))) = true := by + decide +kernel +lemma CA1_1_14I1PairP_check_5_4 : ∀ k l : Fin 6, contains (CA1_1_14I1PairRaw ((5,4),(k,l))) (CA1_1_14I1PairP ((5,4),(k,l))) = true := by + decide +kernel +lemma CA1_1_14I1PairP_check_5_5 : ∀ k l : Fin 6, contains (CA1_1_14I1PairRaw ((5,5),(k,l))) (CA1_1_14I1PairP ((5,5),(k,l))) = true := by + decide +kernel +lemma CA1_1_14I1PairP_check (a : PairSlot × PairSlot) : contains (CA1_1_14I1PairRaw a) (CA1_1_14I1PairP a) = true := by + rcases a with ⟨⟨i,j⟩,⟨k,l⟩⟩ + revert j i + apply forall_fin6 + · exact forall_fin6 (CA1_1_14I1PairP_check_0_0 k l) (CA1_1_14I1PairP_check_0_1 k l) (CA1_1_14I1PairP_check_0_2 k l) (CA1_1_14I1PairP_check_0_3 k l) (CA1_1_14I1PairP_check_0_4 k l) (CA1_1_14I1PairP_check_0_5 k l) + · exact forall_fin6 (CA1_1_14I1PairP_check_1_0 k l) (CA1_1_14I1PairP_check_1_1 k l) (CA1_1_14I1PairP_check_1_2 k l) (CA1_1_14I1PairP_check_1_3 k l) (CA1_1_14I1PairP_check_1_4 k l) (CA1_1_14I1PairP_check_1_5 k l) + · exact forall_fin6 (CA1_1_14I1PairP_check_2_0 k l) (CA1_1_14I1PairP_check_2_1 k l) (CA1_1_14I1PairP_check_2_2 k l) (CA1_1_14I1PairP_check_2_3 k l) (CA1_1_14I1PairP_check_2_4 k l) (CA1_1_14I1PairP_check_2_5 k l) + · exact forall_fin6 (CA1_1_14I1PairP_check_3_0 k l) (CA1_1_14I1PairP_check_3_1 k l) (CA1_1_14I1PairP_check_3_2 k l) (CA1_1_14I1PairP_check_3_3 k l) (CA1_1_14I1PairP_check_3_4 k l) (CA1_1_14I1PairP_check_3_5 k l) + · exact forall_fin6 (CA1_1_14I1PairP_check_4_0 k l) (CA1_1_14I1PairP_check_4_1 k l) (CA1_1_14I1PairP_check_4_2 k l) (CA1_1_14I1PairP_check_4_3 k l) (CA1_1_14I1PairP_check_4_4 k l) (CA1_1_14I1PairP_check_4_5 k l) + · exact forall_fin6 (CA1_1_14I1PairP_check_5_0 k l) (CA1_1_14I1PairP_check_5_1 k l) (CA1_1_14I1PairP_check_5_2 k l) (CA1_1_14I1PairP_check_5_3 k l) (CA1_1_14I1PairP_check_5_4 k l) (CA1_1_14I1PairP_check_5_5 k l) +lemma CA1_1_14I1PairP_sound (a : PairSlot × PairSlot) : + (CA1_1_14I1PairP a).Encloses (CA1_1_14I1PairValue a) := + contains_sound (CA1_1_14I1PairRaw_sound a) (CA1_1_14I1PairP_check a) +def CA1_1_14I1PairTerms (a : PairSlot × PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_1_14I1PairCertificates (CA1_1_14I1PairCertificateIndex a)).output +lemma CA1_1_14I1PairTerms_sound (a : PairSlot × PairSlot) : + (CA1_1_14I1PairTerms a).Encloses (Foundation.entropyTerm (CA1_1_14I1PairValue a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_1_14I1PairCertificates_valid + (CA1_1_14I1PairCertificateIndex a) (CA1_1_14I1PairP_sound a) +def CA1_1_14I1PairEntropy : Ball := ⟨(6931471805599453094172319305033 / 5000000000000000000000000000000), (7940933911 / 12500000000000000000000000000000)⟩ +lemma CA1_1_14I1PairEntropy_sound : CA1_1_14I1PairEntropy.Encloses (Foundation.finiteEntropy CA1_1_14I1PairValue) := by + exact contains_sound (entropyDoublePair_enclosed CA1_1_14I1PairValue CA1_1_14I1PairTerms CA1_1_14I1PairTerms_sound) (by decide +kernel) +def CA1_1_14I1PairMass : Ball := ⟨1, (1 / 1000000000000000000000000000000)⟩ +lemma CA1_1_14I1PairMass_sound : CA1_1_14I1PairMass.Encloses (∑ a, CA1_1_14I1PairValue a) := by + exact contains_sound (doublePairSumBall_sound CA1_1_14I1PairP CA1_1_14I1PairValue CA1_1_14I1PairP_sound) (by decide +kernel) +def CA1_1_14I1PairMassTermLogWitness : LogWitness := ⟨0, 1, 1⟩ +def CA1_1_14I1PairMassTermLog : Ball := ⟨0, (10587911891 / 50000000000000000000000000000000)⟩ +lemma CA1_1_14I1PairMassTermLog_sound : CA1_1_14I1PairMassTermLog.Encloses (Real.log ((∑ a, CA1_1_14I1PairValue a))) := by + exact checkLog_sound logTwoBall_sound (CA1_1_14I1PairMass_sound) (w := CA1_1_14I1PairMassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA1_1_14I1PairMassTerm : Ball := ⟨0, (21175823783 / 100000000000000000000000000000000)⟩ +lemma CA1_1_14I1PairMassTerm_sound : CA1_1_14I1PairMassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_1_14I1PairValue a))) := by + exact contains_sound (entropyTerm_ball (CA1_1_14I1PairMass_sound) CA1_1_14I1PairMassTermLog_sound) (by decide +kernel) +def CA1_1_14I1PairH : Ball := ⟨(6931471805599453094172319305033 / 5000000000000000000000000000000), (84703295071 / 100000000000000000000000000000000)⟩ +lemma CA1_1_14I1PairH_sound : CA1_1_14I1PairH.Encloses (homogeneousEntropy CA1_1_14I1PairValue) := by + exact contains_sound (homogeneous_enclosed CA1_1_14I1PairValue CA1_1_14I1PairMassTerm_sound CA1_1_14I1PairEntropy_sound) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CA1_1_14I1R0Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 1 14)) (fun u => (stageALaw (shape 1 1 14) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 0 a +def CA1_1_14I1R0Raw (a : PairSlot) : Ball := residualBall (below (shape 1 1 14)) A1_1_14Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 0 a +lemma CA1_1_14I1R0Raw_sound (a : PairSlot) : + (CA1_1_14I1R0Raw a).Encloses (CA1_1_14I1R0Value a) := by + exact residualBall_sound_on (below (shape 1 1 14)) A1_1_14Law (fun u => (stageALaw (shape 1 1 14) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A1_1_14Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 1 14) (show (shape 1 1 14) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 0 a +def CA1_1_14I1R0Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(1 / 2), (47 / 100000000000000000000000000000000)⟩ ⟨(6931471805599453094172319305033 / 20000000000000000000000000000000), (21175823763 / 100000000000000000000000000000000)⟩ ⟨(-6931471805599453094172319305033 / 10000000000000000000000000000000), (42351647459 / 100000000000000000000000000000000)⟩ ⟨-1, 1, 1⟩] +lemma CA1_1_14I1R0Certificates_valid : + CA1_1_14I1R0Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_1_14I1R0CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 0, 0 => 1 + | _, _ => 0 +def CA1_1_14I1R0P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_1_14I1R0Certificates (CA1_1_14I1R0CertificateIndex a)).input +lemma CA1_1_14I1R0P_check : ∀ a : PairSlot, contains (CA1_1_14I1R0Raw a) (CA1_1_14I1R0P a) = true := by + decide +kernel +lemma CA1_1_14I1R0P_sound (a : PairSlot) : + (CA1_1_14I1R0P a).Encloses (CA1_1_14I1R0Value a) := + contains_sound (CA1_1_14I1R0Raw_sound a) (CA1_1_14I1R0P_check a) +def CA1_1_14I1R0Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_1_14I1R0Certificates (CA1_1_14I1R0CertificateIndex a)).output +lemma CA1_1_14I1R0Terms_sound (a : PairSlot) : + (CA1_1_14I1R0Terms a).Encloses (Foundation.entropyTerm (CA1_1_14I1R0Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_1_14I1R0Certificates_valid + (CA1_1_14I1R0CertificateIndex a) (CA1_1_14I1R0P_sound a) +def CA1_1_14I1R0Entropy : Ball := ⟨(6931471805599453094172319305033 / 20000000000000000000000000000000), (21175823763 / 100000000000000000000000000000000)⟩ +lemma CA1_1_14I1R0Entropy_sound : CA1_1_14I1R0Entropy.Encloses (Foundation.finiteEntropy CA1_1_14I1R0Value) := by + exact contains_sound (entropyPair_enclosed CA1_1_14I1R0Value CA1_1_14I1R0Terms CA1_1_14I1R0Terms_sound) (by decide +kernel) +def CA1_1_14I1R0Mass : Ball := ⟨(1 / 2), (47 / 100000000000000000000000000000000)⟩ +lemma CA1_1_14I1R0Mass_sound : CA1_1_14I1R0Mass.Encloses (∑ a, CA1_1_14I1R0Value a) := by + exact contains_sound (pairSumBall_sound CA1_1_14I1R0P CA1_1_14I1R0Value CA1_1_14I1R0P_sound) (by decide +kernel) +def CA1_1_14I1R0MassTermLogWitness : LogWitness := ⟨-1, 1, 1⟩ +def CA1_1_14I1R0MassTermLog : Ball := ⟨(-6931471805599453094172319305033 / 10000000000000000000000000000000), (42351647459 / 100000000000000000000000000000000)⟩ +lemma CA1_1_14I1R0MassTermLog_sound : CA1_1_14I1R0MassTermLog.Encloses (Real.log ((∑ a, CA1_1_14I1R0Value a))) := by + exact checkLog_sound logTwoBall_sound (CA1_1_14I1R0Mass_sound) (w := CA1_1_14I1R0MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA1_1_14I1R0MassTerm : Ball := ⟨(6931471805599453094172319305033 / 20000000000000000000000000000000), (21175823763 / 100000000000000000000000000000000)⟩ +lemma CA1_1_14I1R0MassTerm_sound : CA1_1_14I1R0MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_1_14I1R0Value a))) := by + exact contains_sound (entropyTerm_ball (CA1_1_14I1R0Mass_sound) CA1_1_14I1R0MassTermLog_sound) (by decide +kernel) +def CA1_1_14I1R0H : Ball := ⟨0, (21175823763 / 50000000000000000000000000000000)⟩ +lemma CA1_1_14I1R0H_sound : CA1_1_14I1R0H.Encloses (homogeneousEntropy CA1_1_14I1R0Value) := by + exact contains_sound (homogeneous_enclosed CA1_1_14I1R0Value CA1_1_14I1R0MassTerm_sound CA1_1_14I1R0Entropy_sound) (by decide +kernel) +def CA1_1_14I1R1Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 1 14)) (fun u => (stageALaw (shape 1 1 14) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 1 a +def CA1_1_14I1R1Raw (a : PairSlot) : Ball := residualBall (below (shape 1 1 14)) A1_1_14Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 1 a +lemma CA1_1_14I1R1Raw_sound (a : PairSlot) : + (CA1_1_14I1R1Raw a).Encloses (CA1_1_14I1R1Value a) := by + exact residualBall_sound_on (below (shape 1 1 14)) A1_1_14Law (fun u => (stageALaw (shape 1 1 14) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A1_1_14Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 1 14) (show (shape 1 1 14) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 1 a +def CA1_1_14I1R1Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(1 / 4), (1 / 4000000000000000000000000000000)⟩ ⟨(6931471805599453094172319305033 / 20000000000000000000000000000000), (7940933911 / 50000000000000000000000000000000)⟩ ⟨(-6931471805599453094172319305033 / 5000000000000000000000000000000), (15881867787 / 25000000000000000000000000000000)⟩ ⟨-2, 1, 1⟩] +lemma CA1_1_14I1R1Certificates_valid : + CA1_1_14I1R1Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_1_14I1R1CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 1, 0 => 1 + | 0, 1 => 1 + | _, _ => 0 +def CA1_1_14I1R1P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_1_14I1R1Certificates (CA1_1_14I1R1CertificateIndex a)).input +lemma CA1_1_14I1R1P_check : ∀ a : PairSlot, contains (CA1_1_14I1R1Raw a) (CA1_1_14I1R1P a) = true := by + decide +kernel +lemma CA1_1_14I1R1P_sound (a : PairSlot) : + (CA1_1_14I1R1P a).Encloses (CA1_1_14I1R1Value a) := + contains_sound (CA1_1_14I1R1Raw_sound a) (CA1_1_14I1R1P_check a) +def CA1_1_14I1R1Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_1_14I1R1Certificates (CA1_1_14I1R1CertificateIndex a)).output +lemma CA1_1_14I1R1Terms_sound (a : PairSlot) : + (CA1_1_14I1R1Terms a).Encloses (Foundation.entropyTerm (CA1_1_14I1R1Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_1_14I1R1Certificates_valid + (CA1_1_14I1R1CertificateIndex a) (CA1_1_14I1R1P_sound a) +def CA1_1_14I1R1Entropy : Ball := ⟨(6931471805599453094172319305033 / 10000000000000000000000000000000), (7940933911 / 25000000000000000000000000000000)⟩ +lemma CA1_1_14I1R1Entropy_sound : CA1_1_14I1R1Entropy.Encloses (Foundation.finiteEntropy CA1_1_14I1R1Value) := by + exact contains_sound (entropyPair_enclosed CA1_1_14I1R1Value CA1_1_14I1R1Terms CA1_1_14I1R1Terms_sound) (by decide +kernel) +def CA1_1_14I1R1Mass : Ball := ⟨(1 / 2), (1 / 2000000000000000000000000000000)⟩ +lemma CA1_1_14I1R1Mass_sound : CA1_1_14I1R1Mass.Encloses (∑ a, CA1_1_14I1R1Value a) := by + exact contains_sound (pairSumBall_sound CA1_1_14I1R1P CA1_1_14I1R1Value CA1_1_14I1R1P_sound) (by decide +kernel) +def CA1_1_14I1R1MassTermLogWitness : LogWitness := ⟨-1, 1, 1⟩ +def CA1_1_14I1R1MassTermLog : Ball := ⟨(-6931471805599453094172319305033 / 10000000000000000000000000000000), (8470329493 / 20000000000000000000000000000000)⟩ +lemma CA1_1_14I1R1MassTermLog_sound : CA1_1_14I1R1MassTermLog.Encloses (Real.log ((∑ a, CA1_1_14I1R1Value a))) := by + exact checkLog_sound logTwoBall_sound (CA1_1_14I1R1Mass_sound) (w := CA1_1_14I1R1MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA1_1_14I1R1MassTerm : Ball := ⟨(6931471805599453094172319305033 / 20000000000000000000000000000000), (2646977971 / 12500000000000000000000000000000)⟩ +lemma CA1_1_14I1R1MassTerm_sound : CA1_1_14I1R1MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_1_14I1R1Value a))) := by + exact contains_sound (entropyTerm_ball (CA1_1_14I1R1Mass_sound) CA1_1_14I1R1MassTermLog_sound) (by decide +kernel) +def CA1_1_14I1R1H : Ball := ⟨(6931471805599453094172319305033 / 20000000000000000000000000000000), (13234889853 / 25000000000000000000000000000000)⟩ +lemma CA1_1_14I1R1H_sound : CA1_1_14I1R1H.Encloses (homogeneousEntropy CA1_1_14I1R1Value) := by + exact contains_sound (homogeneous_enclosed CA1_1_14I1R1Value CA1_1_14I1R1MassTerm_sound CA1_1_14I1R1Entropy_sound) (by decide +kernel) +def CA1_1_14I1R2Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 1 14)) (fun u => (stageALaw (shape 1 1 14) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 2 a +def CA1_1_14I1R2Raw (a : PairSlot) : Ball := residualBall (below (shape 1 1 14)) A1_1_14Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 2 a +lemma CA1_1_14I1R2Raw_sound (a : PairSlot) : + (CA1_1_14I1R2Raw a).Encloses (CA1_1_14I1R2Value a) := by + exact residualBall_sound_on (below (shape 1 1 14)) A1_1_14Law (fun u => (stageALaw (shape 1 1 14) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A1_1_14Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 1 14) (show (shape 1 1 14) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 2 a +def CA1_1_14I1R2Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA1_1_14I1R2Certificates_valid : + CA1_1_14I1R2Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_1_14I1R2CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA1_1_14I1R2P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_1_14I1R2Certificates (CA1_1_14I1R2CertificateIndex a)).input +lemma CA1_1_14I1R2P_check : ∀ a : PairSlot, contains (CA1_1_14I1R2Raw a) (CA1_1_14I1R2P a) = true := by + decide +kernel +lemma CA1_1_14I1R2P_sound (a : PairSlot) : + (CA1_1_14I1R2P a).Encloses (CA1_1_14I1R2Value a) := + contains_sound (CA1_1_14I1R2Raw_sound a) (CA1_1_14I1R2P_check a) +def CA1_1_14I1R2Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_1_14I1R2Certificates (CA1_1_14I1R2CertificateIndex a)).output +lemma CA1_1_14I1R2Terms_sound (a : PairSlot) : + (CA1_1_14I1R2Terms a).Encloses (Foundation.entropyTerm (CA1_1_14I1R2Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_1_14I1R2Certificates_valid + (CA1_1_14I1R2CertificateIndex a) (CA1_1_14I1R2P_sound a) +def CA1_1_14I1R2Entropy : Ball := ⟨0, 0⟩ +lemma CA1_1_14I1R2Entropy_sound : CA1_1_14I1R2Entropy.Encloses (Foundation.finiteEntropy CA1_1_14I1R2Value) := by + exact contains_sound (entropyPair_enclosed CA1_1_14I1R2Value CA1_1_14I1R2Terms CA1_1_14I1R2Terms_sound) (by decide +kernel) +def CA1_1_14I1R2Mass : Ball := ⟨0, 0⟩ +lemma CA1_1_14I1R2Mass_sound : CA1_1_14I1R2Mass.Encloses (∑ a, CA1_1_14I1R2Value a) := by + exact contains_sound (pairSumBall_sound CA1_1_14I1R2P CA1_1_14I1R2Value CA1_1_14I1R2P_sound) (by decide +kernel) +def CA1_1_14I1R2MassTerm : Ball := .exact 0 +lemma CA1_1_14I1R2MassTerm_sound : CA1_1_14I1R2MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_1_14I1R2Value a))) := + entropyTerm_zero_ball (CA1_1_14I1R2Mass_sound) +def CA1_1_14I1R2H : Ball := ⟨0, 0⟩ +lemma CA1_1_14I1R2H_sound : CA1_1_14I1R2H.Encloses (homogeneousEntropy CA1_1_14I1R2Value) := by + exact contains_sound (homogeneous_enclosed CA1_1_14I1R2Value CA1_1_14I1R2MassTerm_sound CA1_1_14I1R2Entropy_sound) (by decide +kernel) +def CA1_1_14I1R3Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 1 14)) (fun u => (stageALaw (shape 1 1 14) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 3 a +def CA1_1_14I1R3Raw (a : PairSlot) : Ball := residualBall (below (shape 1 1 14)) A1_1_14Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 3 a +lemma CA1_1_14I1R3Raw_sound (a : PairSlot) : + (CA1_1_14I1R3Raw a).Encloses (CA1_1_14I1R3Value a) := by + exact residualBall_sound_on (below (shape 1 1 14)) A1_1_14Law (fun u => (stageALaw (shape 1 1 14) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A1_1_14Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 1 14) (show (shape 1 1 14) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 3 a +def CA1_1_14I1R3Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA1_1_14I1R3Certificates_valid : + CA1_1_14I1R3Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_1_14I1R3CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA1_1_14I1R3P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_1_14I1R3Certificates (CA1_1_14I1R3CertificateIndex a)).input +lemma CA1_1_14I1R3P_check : ∀ a : PairSlot, contains (CA1_1_14I1R3Raw a) (CA1_1_14I1R3P a) = true := by + decide +kernel +lemma CA1_1_14I1R3P_sound (a : PairSlot) : + (CA1_1_14I1R3P a).Encloses (CA1_1_14I1R3Value a) := + contains_sound (CA1_1_14I1R3Raw_sound a) (CA1_1_14I1R3P_check a) +def CA1_1_14I1R3Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_1_14I1R3Certificates (CA1_1_14I1R3CertificateIndex a)).output +lemma CA1_1_14I1R3Terms_sound (a : PairSlot) : + (CA1_1_14I1R3Terms a).Encloses (Foundation.entropyTerm (CA1_1_14I1R3Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_1_14I1R3Certificates_valid + (CA1_1_14I1R3CertificateIndex a) (CA1_1_14I1R3P_sound a) +def CA1_1_14I1R3Entropy : Ball := ⟨0, 0⟩ +lemma CA1_1_14I1R3Entropy_sound : CA1_1_14I1R3Entropy.Encloses (Foundation.finiteEntropy CA1_1_14I1R3Value) := by + exact contains_sound (entropyPair_enclosed CA1_1_14I1R3Value CA1_1_14I1R3Terms CA1_1_14I1R3Terms_sound) (by decide +kernel) +def CA1_1_14I1R3Mass : Ball := ⟨0, 0⟩ +lemma CA1_1_14I1R3Mass_sound : CA1_1_14I1R3Mass.Encloses (∑ a, CA1_1_14I1R3Value a) := by + exact contains_sound (pairSumBall_sound CA1_1_14I1R3P CA1_1_14I1R3Value CA1_1_14I1R3P_sound) (by decide +kernel) +def CA1_1_14I1R3MassTerm : Ball := .exact 0 +lemma CA1_1_14I1R3MassTerm_sound : CA1_1_14I1R3MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_1_14I1R3Value a))) := + entropyTerm_zero_ball (CA1_1_14I1R3Mass_sound) +def CA1_1_14I1R3H : Ball := ⟨0, 0⟩ +lemma CA1_1_14I1R3H_sound : CA1_1_14I1R3H.Encloses (homogeneousEntropy CA1_1_14I1R3Value) := by + exact contains_sound (homogeneous_enclosed CA1_1_14I1R3Value CA1_1_14I1R3MassTerm_sound CA1_1_14I1R3Entropy_sound) (by decide +kernel) +def CA1_1_14I1R4Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 1 14)) (fun u => (stageALaw (shape 1 1 14) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 4 a +def CA1_1_14I1R4Raw (a : PairSlot) : Ball := residualBall (below (shape 1 1 14)) A1_1_14Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 4 a +lemma CA1_1_14I1R4Raw_sound (a : PairSlot) : + (CA1_1_14I1R4Raw a).Encloses (CA1_1_14I1R4Value a) := by + exact residualBall_sound_on (below (shape 1 1 14)) A1_1_14Law (fun u => (stageALaw (shape 1 1 14) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A1_1_14Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 1 14) (show (shape 1 1 14) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 4 a +def CA1_1_14I1R4Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA1_1_14I1R4Certificates_valid : + CA1_1_14I1R4Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_1_14I1R4CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA1_1_14I1R4P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_1_14I1R4Certificates (CA1_1_14I1R4CertificateIndex a)).input +lemma CA1_1_14I1R4P_check : ∀ a : PairSlot, contains (CA1_1_14I1R4Raw a) (CA1_1_14I1R4P a) = true := by + decide +kernel +lemma CA1_1_14I1R4P_sound (a : PairSlot) : + (CA1_1_14I1R4P a).Encloses (CA1_1_14I1R4Value a) := + contains_sound (CA1_1_14I1R4Raw_sound a) (CA1_1_14I1R4P_check a) +def CA1_1_14I1R4Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_1_14I1R4Certificates (CA1_1_14I1R4CertificateIndex a)).output +lemma CA1_1_14I1R4Terms_sound (a : PairSlot) : + (CA1_1_14I1R4Terms a).Encloses (Foundation.entropyTerm (CA1_1_14I1R4Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_1_14I1R4Certificates_valid + (CA1_1_14I1R4CertificateIndex a) (CA1_1_14I1R4P_sound a) +def CA1_1_14I1R4Entropy : Ball := ⟨0, 0⟩ +lemma CA1_1_14I1R4Entropy_sound : CA1_1_14I1R4Entropy.Encloses (Foundation.finiteEntropy CA1_1_14I1R4Value) := by + exact contains_sound (entropyPair_enclosed CA1_1_14I1R4Value CA1_1_14I1R4Terms CA1_1_14I1R4Terms_sound) (by decide +kernel) +def CA1_1_14I1R4Mass : Ball := ⟨0, 0⟩ +lemma CA1_1_14I1R4Mass_sound : CA1_1_14I1R4Mass.Encloses (∑ a, CA1_1_14I1R4Value a) := by + exact contains_sound (pairSumBall_sound CA1_1_14I1R4P CA1_1_14I1R4Value CA1_1_14I1R4P_sound) (by decide +kernel) +def CA1_1_14I1R4MassTerm : Ball := .exact 0 +lemma CA1_1_14I1R4MassTerm_sound : CA1_1_14I1R4MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_1_14I1R4Value a))) := + entropyTerm_zero_ball (CA1_1_14I1R4Mass_sound) +def CA1_1_14I1R4H : Ball := ⟨0, 0⟩ +lemma CA1_1_14I1R4H_sound : CA1_1_14I1R4H.Encloses (homogeneousEntropy CA1_1_14I1R4Value) := by + exact contains_sound (homogeneous_enclosed CA1_1_14I1R4Value CA1_1_14I1R4MassTerm_sound CA1_1_14I1R4Entropy_sound) (by decide +kernel) +def CA1_1_14I1R5Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 1 14)) (fun u => (stageALaw (shape 1 1 14) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 5 a +def CA1_1_14I1R5Raw (a : PairSlot) : Ball := residualBall (below (shape 1 1 14)) A1_1_14Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 5 a +lemma CA1_1_14I1R5Raw_sound (a : PairSlot) : + (CA1_1_14I1R5Raw a).Encloses (CA1_1_14I1R5Value a) := by + exact residualBall_sound_on (below (shape 1 1 14)) A1_1_14Law (fun u => (stageALaw (shape 1 1 14) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A1_1_14Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 1 14) (show (shape 1 1 14) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 5 a +def CA1_1_14I1R5Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA1_1_14I1R5Certificates_valid : + CA1_1_14I1R5Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_1_14I1R5CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA1_1_14I1R5P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_1_14I1R5Certificates (CA1_1_14I1R5CertificateIndex a)).input +lemma CA1_1_14I1R5P_check : ∀ a : PairSlot, contains (CA1_1_14I1R5Raw a) (CA1_1_14I1R5P a) = true := by + decide +kernel +lemma CA1_1_14I1R5P_sound (a : PairSlot) : + (CA1_1_14I1R5P a).Encloses (CA1_1_14I1R5Value a) := + contains_sound (CA1_1_14I1R5Raw_sound a) (CA1_1_14I1R5P_check a) +def CA1_1_14I1R5Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_1_14I1R5Certificates (CA1_1_14I1R5CertificateIndex a)).output +lemma CA1_1_14I1R5Terms_sound (a : PairSlot) : + (CA1_1_14I1R5Terms a).Encloses (Foundation.entropyTerm (CA1_1_14I1R5Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_1_14I1R5Certificates_valid + (CA1_1_14I1R5CertificateIndex a) (CA1_1_14I1R5P_sound a) +def CA1_1_14I1R5Entropy : Ball := ⟨0, 0⟩ +lemma CA1_1_14I1R5Entropy_sound : CA1_1_14I1R5Entropy.Encloses (Foundation.finiteEntropy CA1_1_14I1R5Value) := by + exact contains_sound (entropyPair_enclosed CA1_1_14I1R5Value CA1_1_14I1R5Terms CA1_1_14I1R5Terms_sound) (by decide +kernel) +def CA1_1_14I1R5Mass : Ball := ⟨0, 0⟩ +lemma CA1_1_14I1R5Mass_sound : CA1_1_14I1R5Mass.Encloses (∑ a, CA1_1_14I1R5Value a) := by + exact contains_sound (pairSumBall_sound CA1_1_14I1R5P CA1_1_14I1R5Value CA1_1_14I1R5P_sound) (by decide +kernel) +def CA1_1_14I1R5MassTerm : Ball := .exact 0 +lemma CA1_1_14I1R5MassTerm_sound : CA1_1_14I1R5MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_1_14I1R5Value a))) := + entropyTerm_zero_ball (CA1_1_14I1R5Mass_sound) +def CA1_1_14I1R5H : Ball := ⟨0, 0⟩ +lemma CA1_1_14I1R5H_sound : CA1_1_14I1R5H.Encloses (homogeneousEntropy CA1_1_14I1R5Value) := by + exact contains_sound (homogeneous_enclosed CA1_1_14I1R5Value CA1_1_14I1R5MassTerm_sound CA1_1_14I1R5Entropy_sound) (by decide +kernel) +def CA1_1_14I1R6Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 1 14)) (fun u => (stageALaw (shape 1 1 14) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 6 a +def CA1_1_14I1R6Raw (a : PairSlot) : Ball := residualBall (below (shape 1 1 14)) A1_1_14Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 6 a +lemma CA1_1_14I1R6Raw_sound (a : PairSlot) : + (CA1_1_14I1R6Raw a).Encloses (CA1_1_14I1R6Value a) := by + exact residualBall_sound_on (below (shape 1 1 14)) A1_1_14Law (fun u => (stageALaw (shape 1 1 14) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A1_1_14Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 1 14) (show (shape 1 1 14) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 6 a +def CA1_1_14I1R6Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA1_1_14I1R6Certificates_valid : + CA1_1_14I1R6Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_1_14I1R6CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA1_1_14I1R6P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_1_14I1R6Certificates (CA1_1_14I1R6CertificateIndex a)).input +lemma CA1_1_14I1R6P_check : ∀ a : PairSlot, contains (CA1_1_14I1R6Raw a) (CA1_1_14I1R6P a) = true := by + decide +kernel +lemma CA1_1_14I1R6P_sound (a : PairSlot) : + (CA1_1_14I1R6P a).Encloses (CA1_1_14I1R6Value a) := + contains_sound (CA1_1_14I1R6Raw_sound a) (CA1_1_14I1R6P_check a) +def CA1_1_14I1R6Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_1_14I1R6Certificates (CA1_1_14I1R6CertificateIndex a)).output +lemma CA1_1_14I1R6Terms_sound (a : PairSlot) : + (CA1_1_14I1R6Terms a).Encloses (Foundation.entropyTerm (CA1_1_14I1R6Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_1_14I1R6Certificates_valid + (CA1_1_14I1R6CertificateIndex a) (CA1_1_14I1R6P_sound a) +def CA1_1_14I1R6Entropy : Ball := ⟨0, 0⟩ +lemma CA1_1_14I1R6Entropy_sound : CA1_1_14I1R6Entropy.Encloses (Foundation.finiteEntropy CA1_1_14I1R6Value) := by + exact contains_sound (entropyPair_enclosed CA1_1_14I1R6Value CA1_1_14I1R6Terms CA1_1_14I1R6Terms_sound) (by decide +kernel) +def CA1_1_14I1R6Mass : Ball := ⟨0, 0⟩ +lemma CA1_1_14I1R6Mass_sound : CA1_1_14I1R6Mass.Encloses (∑ a, CA1_1_14I1R6Value a) := by + exact contains_sound (pairSumBall_sound CA1_1_14I1R6P CA1_1_14I1R6Value CA1_1_14I1R6P_sound) (by decide +kernel) +def CA1_1_14I1R6MassTerm : Ball := .exact 0 +lemma CA1_1_14I1R6MassTerm_sound : CA1_1_14I1R6MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_1_14I1R6Value a))) := + entropyTerm_zero_ball (CA1_1_14I1R6Mass_sound) +def CA1_1_14I1R6H : Ball := ⟨0, 0⟩ +lemma CA1_1_14I1R6H_sound : CA1_1_14I1R6H.Encloses (homogeneousEntropy CA1_1_14I1R6Value) := by + exact contains_sound (homogeneous_enclosed CA1_1_14I1R6Value CA1_1_14I1R6MassTerm_sound CA1_1_14I1R6Entropy_sound) (by decide +kernel) +def CA1_1_14I1R7Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 1 14)) (fun u => (stageALaw (shape 1 1 14) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 7 a +def CA1_1_14I1R7Raw (a : PairSlot) : Ball := residualBall (below (shape 1 1 14)) A1_1_14Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 7 a +lemma CA1_1_14I1R7Raw_sound (a : PairSlot) : + (CA1_1_14I1R7Raw a).Encloses (CA1_1_14I1R7Value a) := by + exact residualBall_sound_on (below (shape 1 1 14)) A1_1_14Law (fun u => (stageALaw (shape 1 1 14) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A1_1_14Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 1 14) (show (shape 1 1 14) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 7 a +def CA1_1_14I1R7Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA1_1_14I1R7Certificates_valid : + CA1_1_14I1R7Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_1_14I1R7CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA1_1_14I1R7P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_1_14I1R7Certificates (CA1_1_14I1R7CertificateIndex a)).input +lemma CA1_1_14I1R7P_check : ∀ a : PairSlot, contains (CA1_1_14I1R7Raw a) (CA1_1_14I1R7P a) = true := by + decide +kernel +lemma CA1_1_14I1R7P_sound (a : PairSlot) : + (CA1_1_14I1R7P a).Encloses (CA1_1_14I1R7Value a) := + contains_sound (CA1_1_14I1R7Raw_sound a) (CA1_1_14I1R7P_check a) +def CA1_1_14I1R7Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_1_14I1R7Certificates (CA1_1_14I1R7CertificateIndex a)).output +lemma CA1_1_14I1R7Terms_sound (a : PairSlot) : + (CA1_1_14I1R7Terms a).Encloses (Foundation.entropyTerm (CA1_1_14I1R7Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_1_14I1R7Certificates_valid + (CA1_1_14I1R7CertificateIndex a) (CA1_1_14I1R7P_sound a) +def CA1_1_14I1R7Entropy : Ball := ⟨0, 0⟩ +lemma CA1_1_14I1R7Entropy_sound : CA1_1_14I1R7Entropy.Encloses (Foundation.finiteEntropy CA1_1_14I1R7Value) := by + exact contains_sound (entropyPair_enclosed CA1_1_14I1R7Value CA1_1_14I1R7Terms CA1_1_14I1R7Terms_sound) (by decide +kernel) +def CA1_1_14I1R7Mass : Ball := ⟨0, 0⟩ +lemma CA1_1_14I1R7Mass_sound : CA1_1_14I1R7Mass.Encloses (∑ a, CA1_1_14I1R7Value a) := by + exact contains_sound (pairSumBall_sound CA1_1_14I1R7P CA1_1_14I1R7Value CA1_1_14I1R7P_sound) (by decide +kernel) +def CA1_1_14I1R7MassTerm : Ball := .exact 0 +lemma CA1_1_14I1R7MassTerm_sound : CA1_1_14I1R7MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_1_14I1R7Value a))) := + entropyTerm_zero_ball (CA1_1_14I1R7Mass_sound) +def CA1_1_14I1R7H : Ball := ⟨0, 0⟩ +lemma CA1_1_14I1R7H_sound : CA1_1_14I1R7H.Encloses (homogeneousEntropy CA1_1_14I1R7Value) := by + exact contains_sound (homogeneous_enclosed CA1_1_14I1R7Value CA1_1_14I1R7MassTerm_sound CA1_1_14I1R7Entropy_sound) (by decide +kernel) +def CA1_1_14I1R8Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 1 14)) (fun u => (stageALaw (shape 1 1 14) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 8 a +def CA1_1_14I1R8Raw (a : PairSlot) : Ball := residualBall (below (shape 1 1 14)) A1_1_14Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 8 a +lemma CA1_1_14I1R8Raw_sound (a : PairSlot) : + (CA1_1_14I1R8Raw a).Encloses (CA1_1_14I1R8Value a) := by + exact residualBall_sound_on (below (shape 1 1 14)) A1_1_14Law (fun u => (stageALaw (shape 1 1 14) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A1_1_14Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 1 14) (show (shape 1 1 14) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 8 a +def CA1_1_14I1R8Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA1_1_14I1R8Certificates_valid : + CA1_1_14I1R8Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_1_14I1R8CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA1_1_14I1R8P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_1_14I1R8Certificates (CA1_1_14I1R8CertificateIndex a)).input +lemma CA1_1_14I1R8P_check : ∀ a : PairSlot, contains (CA1_1_14I1R8Raw a) (CA1_1_14I1R8P a) = true := by + decide +kernel +lemma CA1_1_14I1R8P_sound (a : PairSlot) : + (CA1_1_14I1R8P a).Encloses (CA1_1_14I1R8Value a) := + contains_sound (CA1_1_14I1R8Raw_sound a) (CA1_1_14I1R8P_check a) +def CA1_1_14I1R8Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_1_14I1R8Certificates (CA1_1_14I1R8CertificateIndex a)).output +lemma CA1_1_14I1R8Terms_sound (a : PairSlot) : + (CA1_1_14I1R8Terms a).Encloses (Foundation.entropyTerm (CA1_1_14I1R8Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_1_14I1R8Certificates_valid + (CA1_1_14I1R8CertificateIndex a) (CA1_1_14I1R8P_sound a) +def CA1_1_14I1R8Entropy : Ball := ⟨0, 0⟩ +lemma CA1_1_14I1R8Entropy_sound : CA1_1_14I1R8Entropy.Encloses (Foundation.finiteEntropy CA1_1_14I1R8Value) := by + exact contains_sound (entropyPair_enclosed CA1_1_14I1R8Value CA1_1_14I1R8Terms CA1_1_14I1R8Terms_sound) (by decide +kernel) +def CA1_1_14I1R8Mass : Ball := ⟨0, 0⟩ +lemma CA1_1_14I1R8Mass_sound : CA1_1_14I1R8Mass.Encloses (∑ a, CA1_1_14I1R8Value a) := by + exact contains_sound (pairSumBall_sound CA1_1_14I1R8P CA1_1_14I1R8Value CA1_1_14I1R8P_sound) (by decide +kernel) +def CA1_1_14I1R8MassTerm : Ball := .exact 0 +lemma CA1_1_14I1R8MassTerm_sound : CA1_1_14I1R8MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_1_14I1R8Value a))) := + entropyTerm_zero_ball (CA1_1_14I1R8Mass_sound) +def CA1_1_14I1R8H : Ball := ⟨0, 0⟩ +lemma CA1_1_14I1R8H_sound : CA1_1_14I1R8H.Encloses (homogeneousEntropy CA1_1_14I1R8Value) := by + exact contains_sound (homogeneous_enclosed CA1_1_14I1R8Value CA1_1_14I1R8MassTerm_sound CA1_1_14I1R8Entropy_sound) (by decide +kernel) +def CA1_1_14I1R9Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 1 14)) (fun u => (stageALaw (shape 1 1 14) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 9 a +def CA1_1_14I1R9Raw (a : PairSlot) : Ball := residualBall (below (shape 1 1 14)) A1_1_14Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 9 a +lemma CA1_1_14I1R9Raw_sound (a : PairSlot) : + (CA1_1_14I1R9Raw a).Encloses (CA1_1_14I1R9Value a) := by + exact residualBall_sound_on (below (shape 1 1 14)) A1_1_14Law (fun u => (stageALaw (shape 1 1 14) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A1_1_14Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 1 14) (show (shape 1 1 14) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 9 a +def CA1_1_14I1R9Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA1_1_14I1R9Certificates_valid : + CA1_1_14I1R9Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_1_14I1R9CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA1_1_14I1R9P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_1_14I1R9Certificates (CA1_1_14I1R9CertificateIndex a)).input +lemma CA1_1_14I1R9P_check : ∀ a : PairSlot, contains (CA1_1_14I1R9Raw a) (CA1_1_14I1R9P a) = true := by + decide +kernel +lemma CA1_1_14I1R9P_sound (a : PairSlot) : + (CA1_1_14I1R9P a).Encloses (CA1_1_14I1R9Value a) := + contains_sound (CA1_1_14I1R9Raw_sound a) (CA1_1_14I1R9P_check a) +def CA1_1_14I1R9Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_1_14I1R9Certificates (CA1_1_14I1R9CertificateIndex a)).output +lemma CA1_1_14I1R9Terms_sound (a : PairSlot) : + (CA1_1_14I1R9Terms a).Encloses (Foundation.entropyTerm (CA1_1_14I1R9Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_1_14I1R9Certificates_valid + (CA1_1_14I1R9CertificateIndex a) (CA1_1_14I1R9P_sound a) +def CA1_1_14I1R9Entropy : Ball := ⟨0, 0⟩ +lemma CA1_1_14I1R9Entropy_sound : CA1_1_14I1R9Entropy.Encloses (Foundation.finiteEntropy CA1_1_14I1R9Value) := by + exact contains_sound (entropyPair_enclosed CA1_1_14I1R9Value CA1_1_14I1R9Terms CA1_1_14I1R9Terms_sound) (by decide +kernel) +def CA1_1_14I1R9Mass : Ball := ⟨0, 0⟩ +lemma CA1_1_14I1R9Mass_sound : CA1_1_14I1R9Mass.Encloses (∑ a, CA1_1_14I1R9Value a) := by + exact contains_sound (pairSumBall_sound CA1_1_14I1R9P CA1_1_14I1R9Value CA1_1_14I1R9P_sound) (by decide +kernel) +def CA1_1_14I1R9MassTerm : Ball := .exact 0 +lemma CA1_1_14I1R9MassTerm_sound : CA1_1_14I1R9MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_1_14I1R9Value a))) := + entropyTerm_zero_ball (CA1_1_14I1R9Mass_sound) +def CA1_1_14I1R9H : Ball := ⟨0, 0⟩ +lemma CA1_1_14I1R9H_sound : CA1_1_14I1R9H.Encloses (homogeneousEntropy CA1_1_14I1R9Value) := by + exact contains_sound (homogeneous_enclosed CA1_1_14I1R9Value CA1_1_14I1R9MassTerm_sound CA1_1_14I1R9Entropy_sound) (by decide +kernel) +def CA1_1_14I1R10Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 1 14)) (fun u => (stageALaw (shape 1 1 14) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 10 a +def CA1_1_14I1R10Raw (a : PairSlot) : Ball := residualBall (below (shape 1 1 14)) A1_1_14Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 10 a +lemma CA1_1_14I1R10Raw_sound (a : PairSlot) : + (CA1_1_14I1R10Raw a).Encloses (CA1_1_14I1R10Value a) := by + exact residualBall_sound_on (below (shape 1 1 14)) A1_1_14Law (fun u => (stageALaw (shape 1 1 14) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A1_1_14Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 1 14) (show (shape 1 1 14) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 10 a +def CA1_1_14I1R10Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA1_1_14I1R10Certificates_valid : + CA1_1_14I1R10Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_1_14I1R10CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA1_1_14I1R10P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_1_14I1R10Certificates (CA1_1_14I1R10CertificateIndex a)).input +lemma CA1_1_14I1R10P_check : ∀ a : PairSlot, contains (CA1_1_14I1R10Raw a) (CA1_1_14I1R10P a) = true := by + decide +kernel +lemma CA1_1_14I1R10P_sound (a : PairSlot) : + (CA1_1_14I1R10P a).Encloses (CA1_1_14I1R10Value a) := + contains_sound (CA1_1_14I1R10Raw_sound a) (CA1_1_14I1R10P_check a) +def CA1_1_14I1R10Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_1_14I1R10Certificates (CA1_1_14I1R10CertificateIndex a)).output +lemma CA1_1_14I1R10Terms_sound (a : PairSlot) : + (CA1_1_14I1R10Terms a).Encloses (Foundation.entropyTerm (CA1_1_14I1R10Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_1_14I1R10Certificates_valid + (CA1_1_14I1R10CertificateIndex a) (CA1_1_14I1R10P_sound a) +def CA1_1_14I1R10Entropy : Ball := ⟨0, 0⟩ +lemma CA1_1_14I1R10Entropy_sound : CA1_1_14I1R10Entropy.Encloses (Foundation.finiteEntropy CA1_1_14I1R10Value) := by + exact contains_sound (entropyPair_enclosed CA1_1_14I1R10Value CA1_1_14I1R10Terms CA1_1_14I1R10Terms_sound) (by decide +kernel) +def CA1_1_14I1R10Mass : Ball := ⟨0, 0⟩ +lemma CA1_1_14I1R10Mass_sound : CA1_1_14I1R10Mass.Encloses (∑ a, CA1_1_14I1R10Value a) := by + exact contains_sound (pairSumBall_sound CA1_1_14I1R10P CA1_1_14I1R10Value CA1_1_14I1R10P_sound) (by decide +kernel) +def CA1_1_14I1R10MassTerm : Ball := .exact 0 +lemma CA1_1_14I1R10MassTerm_sound : CA1_1_14I1R10MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_1_14I1R10Value a))) := + entropyTerm_zero_ball (CA1_1_14I1R10Mass_sound) +def CA1_1_14I1R10H : Ball := ⟨0, 0⟩ +lemma CA1_1_14I1R10H_sound : CA1_1_14I1R10H.Encloses (homogeneousEntropy CA1_1_14I1R10Value) := by + exact contains_sound (homogeneous_enclosed CA1_1_14I1R10Value CA1_1_14I1R10MassTerm_sound CA1_1_14I1R10Entropy_sound) (by decide +kernel) +def CA1_1_14I1R11Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 1 14)) (fun u => (stageALaw (shape 1 1 14) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 11 a +def CA1_1_14I1R11Raw (a : PairSlot) : Ball := residualBall (below (shape 1 1 14)) A1_1_14Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 11 a +lemma CA1_1_14I1R11Raw_sound (a : PairSlot) : + (CA1_1_14I1R11Raw a).Encloses (CA1_1_14I1R11Value a) := by + exact residualBall_sound_on (below (shape 1 1 14)) A1_1_14Law (fun u => (stageALaw (shape 1 1 14) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A1_1_14Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 1 14) (show (shape 1 1 14) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 11 a +def CA1_1_14I1R11Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA1_1_14I1R11Certificates_valid : + CA1_1_14I1R11Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_1_14I1R11CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA1_1_14I1R11P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_1_14I1R11Certificates (CA1_1_14I1R11CertificateIndex a)).input +lemma CA1_1_14I1R11P_check : ∀ a : PairSlot, contains (CA1_1_14I1R11Raw a) (CA1_1_14I1R11P a) = true := by + decide +kernel +lemma CA1_1_14I1R11P_sound (a : PairSlot) : + (CA1_1_14I1R11P a).Encloses (CA1_1_14I1R11Value a) := + contains_sound (CA1_1_14I1R11Raw_sound a) (CA1_1_14I1R11P_check a) +def CA1_1_14I1R11Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_1_14I1R11Certificates (CA1_1_14I1R11CertificateIndex a)).output +lemma CA1_1_14I1R11Terms_sound (a : PairSlot) : + (CA1_1_14I1R11Terms a).Encloses (Foundation.entropyTerm (CA1_1_14I1R11Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_1_14I1R11Certificates_valid + (CA1_1_14I1R11CertificateIndex a) (CA1_1_14I1R11P_sound a) +def CA1_1_14I1R11Entropy : Ball := ⟨0, 0⟩ +lemma CA1_1_14I1R11Entropy_sound : CA1_1_14I1R11Entropy.Encloses (Foundation.finiteEntropy CA1_1_14I1R11Value) := by + exact contains_sound (entropyPair_enclosed CA1_1_14I1R11Value CA1_1_14I1R11Terms CA1_1_14I1R11Terms_sound) (by decide +kernel) +def CA1_1_14I1R11Mass : Ball := ⟨0, 0⟩ +lemma CA1_1_14I1R11Mass_sound : CA1_1_14I1R11Mass.Encloses (∑ a, CA1_1_14I1R11Value a) := by + exact contains_sound (pairSumBall_sound CA1_1_14I1R11P CA1_1_14I1R11Value CA1_1_14I1R11P_sound) (by decide +kernel) +def CA1_1_14I1R11MassTerm : Ball := .exact 0 +lemma CA1_1_14I1R11MassTerm_sound : CA1_1_14I1R11MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_1_14I1R11Value a))) := + entropyTerm_zero_ball (CA1_1_14I1R11Mass_sound) +def CA1_1_14I1R11H : Ball := ⟨0, 0⟩ +lemma CA1_1_14I1R11H_sound : CA1_1_14I1R11H.Encloses (homogeneousEntropy CA1_1_14I1R11Value) := by + exact contains_sound (homogeneous_enclosed CA1_1_14I1R11Value CA1_1_14I1R11MassTerm_sound CA1_1_14I1R11Entropy_sound) (by decide +kernel) +def CA1_1_14I1R12Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 1 14)) (fun u => (stageALaw (shape 1 1 14) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 12 a +def CA1_1_14I1R12Raw (a : PairSlot) : Ball := residualBall (below (shape 1 1 14)) A1_1_14Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 12 a +lemma CA1_1_14I1R12Raw_sound (a : PairSlot) : + (CA1_1_14I1R12Raw a).Encloses (CA1_1_14I1R12Value a) := by + exact residualBall_sound_on (below (shape 1 1 14)) A1_1_14Law (fun u => (stageALaw (shape 1 1 14) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A1_1_14Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 1 14) (show (shape 1 1 14) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 12 a +def CA1_1_14I1R12Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA1_1_14I1R12Certificates_valid : + CA1_1_14I1R12Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_1_14I1R12CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA1_1_14I1R12P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_1_14I1R12Certificates (CA1_1_14I1R12CertificateIndex a)).input +lemma CA1_1_14I1R12P_check : ∀ a : PairSlot, contains (CA1_1_14I1R12Raw a) (CA1_1_14I1R12P a) = true := by + decide +kernel +lemma CA1_1_14I1R12P_sound (a : PairSlot) : + (CA1_1_14I1R12P a).Encloses (CA1_1_14I1R12Value a) := + contains_sound (CA1_1_14I1R12Raw_sound a) (CA1_1_14I1R12P_check a) +def CA1_1_14I1R12Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_1_14I1R12Certificates (CA1_1_14I1R12CertificateIndex a)).output +lemma CA1_1_14I1R12Terms_sound (a : PairSlot) : + (CA1_1_14I1R12Terms a).Encloses (Foundation.entropyTerm (CA1_1_14I1R12Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_1_14I1R12Certificates_valid + (CA1_1_14I1R12CertificateIndex a) (CA1_1_14I1R12P_sound a) +def CA1_1_14I1R12Entropy : Ball := ⟨0, 0⟩ +lemma CA1_1_14I1R12Entropy_sound : CA1_1_14I1R12Entropy.Encloses (Foundation.finiteEntropy CA1_1_14I1R12Value) := by + exact contains_sound (entropyPair_enclosed CA1_1_14I1R12Value CA1_1_14I1R12Terms CA1_1_14I1R12Terms_sound) (by decide +kernel) +def CA1_1_14I1R12Mass : Ball := ⟨0, 0⟩ +lemma CA1_1_14I1R12Mass_sound : CA1_1_14I1R12Mass.Encloses (∑ a, CA1_1_14I1R12Value a) := by + exact contains_sound (pairSumBall_sound CA1_1_14I1R12P CA1_1_14I1R12Value CA1_1_14I1R12P_sound) (by decide +kernel) +def CA1_1_14I1R12MassTerm : Ball := .exact 0 +lemma CA1_1_14I1R12MassTerm_sound : CA1_1_14I1R12MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_1_14I1R12Value a))) := + entropyTerm_zero_ball (CA1_1_14I1R12Mass_sound) +def CA1_1_14I1R12H : Ball := ⟨0, 0⟩ +lemma CA1_1_14I1R12H_sound : CA1_1_14I1R12H.Encloses (homogeneousEntropy CA1_1_14I1R12Value) := by + exact contains_sound (homogeneous_enclosed CA1_1_14I1R12Value CA1_1_14I1R12MassTerm_sound CA1_1_14I1R12Entropy_sound) (by decide +kernel) +def CA1_1_14I1R13Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 1 14)) (fun u => (stageALaw (shape 1 1 14) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 13 a +def CA1_1_14I1R13Raw (a : PairSlot) : Ball := residualBall (below (shape 1 1 14)) A1_1_14Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 13 a +lemma CA1_1_14I1R13Raw_sound (a : PairSlot) : + (CA1_1_14I1R13Raw a).Encloses (CA1_1_14I1R13Value a) := by + exact residualBall_sound_on (below (shape 1 1 14)) A1_1_14Law (fun u => (stageALaw (shape 1 1 14) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A1_1_14Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 1 14) (show (shape 1 1 14) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 13 a +def CA1_1_14I1R13Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA1_1_14I1R13Certificates_valid : + CA1_1_14I1R13Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_1_14I1R13CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA1_1_14I1R13P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_1_14I1R13Certificates (CA1_1_14I1R13CertificateIndex a)).input +lemma CA1_1_14I1R13P_check : ∀ a : PairSlot, contains (CA1_1_14I1R13Raw a) (CA1_1_14I1R13P a) = true := by + decide +kernel +lemma CA1_1_14I1R13P_sound (a : PairSlot) : + (CA1_1_14I1R13P a).Encloses (CA1_1_14I1R13Value a) := + contains_sound (CA1_1_14I1R13Raw_sound a) (CA1_1_14I1R13P_check a) +def CA1_1_14I1R13Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_1_14I1R13Certificates (CA1_1_14I1R13CertificateIndex a)).output +lemma CA1_1_14I1R13Terms_sound (a : PairSlot) : + (CA1_1_14I1R13Terms a).Encloses (Foundation.entropyTerm (CA1_1_14I1R13Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_1_14I1R13Certificates_valid + (CA1_1_14I1R13CertificateIndex a) (CA1_1_14I1R13P_sound a) +def CA1_1_14I1R13Entropy : Ball := ⟨0, 0⟩ +lemma CA1_1_14I1R13Entropy_sound : CA1_1_14I1R13Entropy.Encloses (Foundation.finiteEntropy CA1_1_14I1R13Value) := by + exact contains_sound (entropyPair_enclosed CA1_1_14I1R13Value CA1_1_14I1R13Terms CA1_1_14I1R13Terms_sound) (by decide +kernel) +def CA1_1_14I1R13Mass : Ball := ⟨0, 0⟩ +lemma CA1_1_14I1R13Mass_sound : CA1_1_14I1R13Mass.Encloses (∑ a, CA1_1_14I1R13Value a) := by + exact contains_sound (pairSumBall_sound CA1_1_14I1R13P CA1_1_14I1R13Value CA1_1_14I1R13P_sound) (by decide +kernel) +def CA1_1_14I1R13MassTerm : Ball := .exact 0 +lemma CA1_1_14I1R13MassTerm_sound : CA1_1_14I1R13MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_1_14I1R13Value a))) := + entropyTerm_zero_ball (CA1_1_14I1R13Mass_sound) +def CA1_1_14I1R13H : Ball := ⟨0, 0⟩ +lemma CA1_1_14I1R13H_sound : CA1_1_14I1R13H.Encloses (homogeneousEntropy CA1_1_14I1R13Value) := by + exact contains_sound (homogeneous_enclosed CA1_1_14I1R13Value CA1_1_14I1R13MassTerm_sound CA1_1_14I1R13Entropy_sound) (by decide +kernel) +def CA1_1_14I1R14Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 1 14)) (fun u => (stageALaw (shape 1 1 14) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 14 a +def CA1_1_14I1R14Raw (a : PairSlot) : Ball := residualBall (below (shape 1 1 14)) A1_1_14Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 14 a +lemma CA1_1_14I1R14Raw_sound (a : PairSlot) : + (CA1_1_14I1R14Raw a).Encloses (CA1_1_14I1R14Value a) := by + exact residualBall_sound_on (below (shape 1 1 14)) A1_1_14Law (fun u => (stageALaw (shape 1 1 14) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A1_1_14Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 1 14) (show (shape 1 1 14) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 14 a +def CA1_1_14I1R14Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA1_1_14I1R14Certificates_valid : + CA1_1_14I1R14Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_1_14I1R14CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA1_1_14I1R14P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_1_14I1R14Certificates (CA1_1_14I1R14CertificateIndex a)).input +lemma CA1_1_14I1R14P_check : ∀ a : PairSlot, contains (CA1_1_14I1R14Raw a) (CA1_1_14I1R14P a) = true := by + decide +kernel +lemma CA1_1_14I1R14P_sound (a : PairSlot) : + (CA1_1_14I1R14P a).Encloses (CA1_1_14I1R14Value a) := + contains_sound (CA1_1_14I1R14Raw_sound a) (CA1_1_14I1R14P_check a) +def CA1_1_14I1R14Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_1_14I1R14Certificates (CA1_1_14I1R14CertificateIndex a)).output +lemma CA1_1_14I1R14Terms_sound (a : PairSlot) : + (CA1_1_14I1R14Terms a).Encloses (Foundation.entropyTerm (CA1_1_14I1R14Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_1_14I1R14Certificates_valid + (CA1_1_14I1R14CertificateIndex a) (CA1_1_14I1R14P_sound a) +def CA1_1_14I1R14Entropy : Ball := ⟨0, 0⟩ +lemma CA1_1_14I1R14Entropy_sound : CA1_1_14I1R14Entropy.Encloses (Foundation.finiteEntropy CA1_1_14I1R14Value) := by + exact contains_sound (entropyPair_enclosed CA1_1_14I1R14Value CA1_1_14I1R14Terms CA1_1_14I1R14Terms_sound) (by decide +kernel) +def CA1_1_14I1R14Mass : Ball := ⟨0, 0⟩ +lemma CA1_1_14I1R14Mass_sound : CA1_1_14I1R14Mass.Encloses (∑ a, CA1_1_14I1R14Value a) := by + exact contains_sound (pairSumBall_sound CA1_1_14I1R14P CA1_1_14I1R14Value CA1_1_14I1R14P_sound) (by decide +kernel) +def CA1_1_14I1R14MassTerm : Ball := .exact 0 +lemma CA1_1_14I1R14MassTerm_sound : CA1_1_14I1R14MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_1_14I1R14Value a))) := + entropyTerm_zero_ball (CA1_1_14I1R14Mass_sound) +def CA1_1_14I1R14H : Ball := ⟨0, 0⟩ +lemma CA1_1_14I1R14H_sound : CA1_1_14I1R14H.Encloses (homogeneousEntropy CA1_1_14I1R14Value) := by + exact contains_sound (homogeneous_enclosed CA1_1_14I1R14Value CA1_1_14I1R14MassTerm_sound CA1_1_14I1R14Entropy_sound) (by decide +kernel) +def CA1_1_14I1R15Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 1 14)) (fun u => (stageALaw (shape 1 1 14) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 15 a +def CA1_1_14I1R15Raw (a : PairSlot) : Ball := residualBall (below (shape 1 1 14)) A1_1_14Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 15 a +lemma CA1_1_14I1R15Raw_sound (a : PairSlot) : + (CA1_1_14I1R15Raw a).Encloses (CA1_1_14I1R15Value a) := by + exact residualBall_sound_on (below (shape 1 1 14)) A1_1_14Law (fun u => (stageALaw (shape 1 1 14) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A1_1_14Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 1 14) (show (shape 1 1 14) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 15 a +def CA1_1_14I1R15Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA1_1_14I1R15Certificates_valid : + CA1_1_14I1R15Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_1_14I1R15CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA1_1_14I1R15P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_1_14I1R15Certificates (CA1_1_14I1R15CertificateIndex a)).input +lemma CA1_1_14I1R15P_check : ∀ a : PairSlot, contains (CA1_1_14I1R15Raw a) (CA1_1_14I1R15P a) = true := by + decide +kernel +lemma CA1_1_14I1R15P_sound (a : PairSlot) : + (CA1_1_14I1R15P a).Encloses (CA1_1_14I1R15Value a) := + contains_sound (CA1_1_14I1R15Raw_sound a) (CA1_1_14I1R15P_check a) +def CA1_1_14I1R15Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_1_14I1R15Certificates (CA1_1_14I1R15CertificateIndex a)).output +lemma CA1_1_14I1R15Terms_sound (a : PairSlot) : + (CA1_1_14I1R15Terms a).Encloses (Foundation.entropyTerm (CA1_1_14I1R15Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_1_14I1R15Certificates_valid + (CA1_1_14I1R15CertificateIndex a) (CA1_1_14I1R15P_sound a) +def CA1_1_14I1R15Entropy : Ball := ⟨0, 0⟩ +lemma CA1_1_14I1R15Entropy_sound : CA1_1_14I1R15Entropy.Encloses (Foundation.finiteEntropy CA1_1_14I1R15Value) := by + exact contains_sound (entropyPair_enclosed CA1_1_14I1R15Value CA1_1_14I1R15Terms CA1_1_14I1R15Terms_sound) (by decide +kernel) +def CA1_1_14I1R15Mass : Ball := ⟨0, 0⟩ +lemma CA1_1_14I1R15Mass_sound : CA1_1_14I1R15Mass.Encloses (∑ a, CA1_1_14I1R15Value a) := by + exact contains_sound (pairSumBall_sound CA1_1_14I1R15P CA1_1_14I1R15Value CA1_1_14I1R15P_sound) (by decide +kernel) +def CA1_1_14I1R15MassTerm : Ball := .exact 0 +lemma CA1_1_14I1R15MassTerm_sound : CA1_1_14I1R15MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_1_14I1R15Value a))) := + entropyTerm_zero_ball (CA1_1_14I1R15Mass_sound) +def CA1_1_14I1R15H : Ball := ⟨0, 0⟩ +lemma CA1_1_14I1R15H_sound : CA1_1_14I1R15H.Encloses (homogeneousEntropy CA1_1_14I1R15Value) := by + exact contains_sound (homogeneous_enclosed CA1_1_14I1R15Value CA1_1_14I1R15MassTerm_sound CA1_1_14I1R15Entropy_sound) (by decide +kernel) +def CA1_1_14I1R16Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 1 14)) (fun u => (stageALaw (shape 1 1 14) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 16 a +def CA1_1_14I1R16Raw (a : PairSlot) : Ball := residualBall (below (shape 1 1 14)) A1_1_14Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 16 a +lemma CA1_1_14I1R16Raw_sound (a : PairSlot) : + (CA1_1_14I1R16Raw a).Encloses (CA1_1_14I1R16Value a) := by + exact residualBall_sound_on (below (shape 1 1 14)) A1_1_14Law (fun u => (stageALaw (shape 1 1 14) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A1_1_14Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 1 14) (show (shape 1 1 14) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 16 a +def CA1_1_14I1R16Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA1_1_14I1R16Certificates_valid : + CA1_1_14I1R16Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_1_14I1R16CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA1_1_14I1R16P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_1_14I1R16Certificates (CA1_1_14I1R16CertificateIndex a)).input +lemma CA1_1_14I1R16P_check : ∀ a : PairSlot, contains (CA1_1_14I1R16Raw a) (CA1_1_14I1R16P a) = true := by + decide +kernel +lemma CA1_1_14I1R16P_sound (a : PairSlot) : + (CA1_1_14I1R16P a).Encloses (CA1_1_14I1R16Value a) := + contains_sound (CA1_1_14I1R16Raw_sound a) (CA1_1_14I1R16P_check a) +def CA1_1_14I1R16Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_1_14I1R16Certificates (CA1_1_14I1R16CertificateIndex a)).output +lemma CA1_1_14I1R16Terms_sound (a : PairSlot) : + (CA1_1_14I1R16Terms a).Encloses (Foundation.entropyTerm (CA1_1_14I1R16Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_1_14I1R16Certificates_valid + (CA1_1_14I1R16CertificateIndex a) (CA1_1_14I1R16P_sound a) +def CA1_1_14I1R16Entropy : Ball := ⟨0, 0⟩ +lemma CA1_1_14I1R16Entropy_sound : CA1_1_14I1R16Entropy.Encloses (Foundation.finiteEntropy CA1_1_14I1R16Value) := by + exact contains_sound (entropyPair_enclosed CA1_1_14I1R16Value CA1_1_14I1R16Terms CA1_1_14I1R16Terms_sound) (by decide +kernel) +def CA1_1_14I1R16Mass : Ball := ⟨0, 0⟩ +lemma CA1_1_14I1R16Mass_sound : CA1_1_14I1R16Mass.Encloses (∑ a, CA1_1_14I1R16Value a) := by + exact contains_sound (pairSumBall_sound CA1_1_14I1R16P CA1_1_14I1R16Value CA1_1_14I1R16P_sound) (by decide +kernel) +def CA1_1_14I1R16MassTerm : Ball := .exact 0 +lemma CA1_1_14I1R16MassTerm_sound : CA1_1_14I1R16MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_1_14I1R16Value a))) := + entropyTerm_zero_ball (CA1_1_14I1R16Mass_sound) +def CA1_1_14I1R16H : Ball := ⟨0, 0⟩ +lemma CA1_1_14I1R16H_sound : CA1_1_14I1R16H.Encloses (homogeneousEntropy CA1_1_14I1R16Value) := by + exact contains_sound (homogeneous_enclosed CA1_1_14I1R16Value CA1_1_14I1R16MassTerm_sound CA1_1_14I1R16Entropy_sound) (by decide +kernel) +def CA1_1_14I1ResidualEntropies (a : Fin 17) : Ball := + match a.val with + | 0 => CA1_1_14I1R0H + | 1 => CA1_1_14I1R1H + | 2 => CA1_1_14I1R2H + | 3 => CA1_1_14I1R3H + | 4 => CA1_1_14I1R4H + | 5 => CA1_1_14I1R5H + | 6 => CA1_1_14I1R6H + | 7 => CA1_1_14I1R7H + | 8 => CA1_1_14I1R8H + | 9 => CA1_1_14I1R9H + | 10 => CA1_1_14I1R10H + | 11 => CA1_1_14I1R11H + | 12 => CA1_1_14I1R12H + | 13 => CA1_1_14I1R13H + | 14 => CA1_1_14I1R14H + | 15 => CA1_1_14I1R15H + | 16 => CA1_1_14I1R16H + | _ => (.exact 0) +lemma CA1_1_14I1ResidualEntropies_sound (k : Fin 17) : + (CA1_1_14I1ResidualEntropies k).Encloses (homogeneousEntropy + (residualLaw (below (shape 1 1 14)) (fun u => (stageALaw (shape 1 1 14) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) k)) := by + fin_cases k + · exact CA1_1_14I1R0H_sound + · exact CA1_1_14I1R1H_sound + · exact CA1_1_14I1R2H_sound + · exact CA1_1_14I1R3H_sound + · exact CA1_1_14I1R4H_sound + · exact CA1_1_14I1R5H_sound + · exact CA1_1_14I1R6H_sound + · exact CA1_1_14I1R7H_sound + · exact CA1_1_14I1R8H_sound + · exact CA1_1_14I1R9H_sound + · exact CA1_1_14I1R10H_sound + · exact CA1_1_14I1R11H_sound + · exact CA1_1_14I1R12H_sound + · exact CA1_1_14I1R13H_sound + · exact CA1_1_14I1R14H_sound + · exact CA1_1_14I1R15H_sound + · exact CA1_1_14I1R16H_sound +def CA1_1_14I1Singles (s : Shape) : Ball := + match s 0, s 1, s 2 with + | _, _, _ => (.exact 0) +lemma CA1_1_14I1Singles_sound (u : Shape) (hu : u ∈ below (shape 1 1 14)) + (hd : designated (Equiv.refl (Fin 3)) 1 u) : + (CA1_1_14I1Singles u).Encloses (homogeneousEntropy ((fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) u)) := by + rw [A1_1_14_below] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 0 0 8) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 0 1 7) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 1 0 7) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 1 1 6) by decide +kernel) hd |>.elim +def CA1_1_14I1Singleton : Ball := ⟨0, 0⟩ +lemma CA1_1_14I1Singleton_sound : CA1_1_14I1Singleton.Encloses + (singletonEntropy (below (shape 1 1 14)) (fun u => (stageALaw (shape 1 1 14) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ))) := by + exact contains_sound (singletonBall_sound (below (shape 1 1 14)) A1_1_14Law (fun u => (stageALaw (shape 1 1 14) u : ℝ)) (Equiv.refl (Fin 3)) 1 + CA1_1_14I1Singles (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A1_1_14Law_sound u) CA1_1_14I1Singles_sound) (by decide +kernel) +def CA1_1_14I1Group : Ball := ⟨(6931471805599453094172319305033 / 20000000000000000000000000000000), (47645603469 / 50000000000000000000000000000000)⟩ +lemma CA1_1_14I1Group_sound : CA1_1_14I1Group.Encloses + (groupedEntropy (below (shape 1 1 14)) (fun u => (stageALaw (shape 1 1 14) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ))) := by + exact contains_sound (Ball.add_sound CA1_1_14I1Singleton_sound + (finSumBall_sound 17 CA1_1_14I1ResidualEntropies _ CA1_1_14I1ResidualEntropies_sound)) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CA1_1_14I1H : Ball := ⟨(6931471805599453094172319305033 / 10000000000000000000000000000000), (275285708947 / 100000000000000000000000000000000)⟩ +lemma CA1_1_14I1_sound : CA1_1_14I1H.Encloses (stageACapacity (shape 1 1 14) 1) := by + have hb := contains_sound (Ball.add_sound CA1_1_14I1PairH_sound + (Ball.neg_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) CA1_1_14I1Group_sound))) + (show contains (.add CA1_1_14I1PairH (.neg (.mul (.exact 2) CA1_1_14I1Group))) CA1_1_14I1H = true by decide +kernel) + simp only [stageACapacity, nativeCapacity, + show (1 : Fin 3) ≠ 0 by decide, ite_false, sub_eq_add_neg] + exact hb + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA1_1_14I2.lean b/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA1_1_14I2.lean new file mode 100644 index 0000000000000000000000000000000000000000..4bf45e0a0b5ef8195fd6ead8267b003bb86281f6 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA1_1_14I2.lean @@ -0,0 +1,920 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Certificates.SupportedContraction + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CA1_1_14I2PairValue (a : PairSlot × PairSlot) : ℝ := pairLaw (below (shape 1 1 14)) (shape 1 1 14) (fun u => (stageALaw (shape 1 1 14) u : ℝ)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) a +def CA1_1_14I2PairRaw (a : PairSlot × PairSlot) : Ball := stageAPairBall (shape 1 1 14) A1_1_14Law 2 a +lemma CA1_1_14I2PairRaw_sound (a : PairSlot × PairSlot) : + (CA1_1_14I2PairRaw a).Encloses (CA1_1_14I2PairValue a) := by + exact stageAPairBall_sound (shape 1 1 14) (by decide +kernel) A1_1_14Law (fun u => (stageALaw (shape 1 1 14) u : ℝ)) (fun u _ => A1_1_14Law_sound u) 2 a +def CA1_1_14I2PairCertificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(99160889261267990055839696027 / 50000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ ⟨(246832658306324730164379568689 / 20000000000000000000000000000000), (419962717 / 100000000000000000000000000000000)⟩ ⟨(-622303460934010062153369001144639 / 100000000000000000000000000000000), (105879118919 / 50000000000000000000000000000000)⟩ ⟨-9, 99160889261267990055839696027, 97656250000000000000000000000⟩, + .log ⟨(3123764808912903199660529 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(99306653910335874506069959 / 50000000000000000000000000000000), (397 / 625000000000000000000000000000)⟩ ⟨(-198691842986603233560091926417359 / 12500000000000000000000000000000), (101645554311 / 20000000000000000000000000000000)⟩ ⟨-23, 3123764808912903199660529, 2980232238769531250000000⟩, + .log ⟨(32493265803550027484685499559 / 156250000000000000000000000000), (7 / 20000000000000000000000000000000)⟩ ⟨(1632902986376198777931005263743 / 5000000000000000000000000000000), (880731739 / 5000000000000000000000000000000)⟩ ⟨(-31408488535911439183560405759753 / 20000000000000000000000000000000), (847032949 / 1000000000000000000000000000000)⟩ ⟨-3, 32493265803550027484685499559, 19531250000000000000000000000⟩, + .log ⟨(288076413385644391463523242139 / 2000000000000000000000000000000), (7 / 100000000000000000000000000000000)⟩ ⟨(1744371722671518147497689894767 / 6250000000000000000000000000000), (2440102139 / 20000000000000000000000000000000)⟩ ⟨(-24220958629283528807120842185559 / 12500000000000000000000000000000), (4235164739 / 5000000000000000000000000000000)⟩ ⟨-3, 288076413385644391463523242139, 250000000000000000000000000000⟩] +lemma CA1_1_14I2PairCertificates_valid : + CA1_1_14I2PairCertificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_1_14I2PairCertificateIndex (a : PairSlot × PairSlot) : ℕ := + match a.1.1.val, a.1.2.val, a.2.1.val, a.2.2.val with + | 5, 5, 5, 2 => 1 + | 5, 5, 5, 3 => 2 + | 5, 5, 4, 4 => 3 + | 5, 5, 2, 5 => 1 + | 5, 5, 3, 5 => 2 + | 4, 5, 4, 5 => 4 + | 4, 5, 5, 4 => 4 + | 5, 4, 4, 5 => 4 + | 5, 4, 5, 4 => 4 + | 5, 2, 5, 5 => 1 + | 5, 3, 5, 5 => 2 + | 4, 4, 5, 5 => 3 + | 2, 5, 5, 5 => 1 + | 3, 5, 5, 5 => 2 + | _, _, _, _ => 0 +def CA1_1_14I2PairP (a : PairSlot × PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_1_14I2PairCertificates (CA1_1_14I2PairCertificateIndex a)).input +lemma CA1_1_14I2PairP_check_0_0 : ∀ k l : Fin 6, contains (CA1_1_14I2PairRaw ((0,0),(k,l))) (CA1_1_14I2PairP ((0,0),(k,l))) = true := by + decide +kernel +lemma CA1_1_14I2PairP_check_0_1 : ∀ k l : Fin 6, contains (CA1_1_14I2PairRaw ((0,1),(k,l))) (CA1_1_14I2PairP ((0,1),(k,l))) = true := by + decide +kernel +lemma CA1_1_14I2PairP_check_0_2 : ∀ k l : Fin 6, contains (CA1_1_14I2PairRaw ((0,2),(k,l))) (CA1_1_14I2PairP ((0,2),(k,l))) = true := by + decide +kernel +lemma CA1_1_14I2PairP_check_0_3 : ∀ k l : Fin 6, contains (CA1_1_14I2PairRaw ((0,3),(k,l))) (CA1_1_14I2PairP ((0,3),(k,l))) = true := by + decide +kernel +lemma CA1_1_14I2PairP_check_0_4 : ∀ k l : Fin 6, contains (CA1_1_14I2PairRaw ((0,4),(k,l))) (CA1_1_14I2PairP ((0,4),(k,l))) = true := by + decide +kernel +lemma CA1_1_14I2PairP_check_0_5 : ∀ k l : Fin 6, contains (CA1_1_14I2PairRaw ((0,5),(k,l))) (CA1_1_14I2PairP ((0,5),(k,l))) = true := by + decide +kernel +lemma CA1_1_14I2PairP_check_1_0 : ∀ k l : Fin 6, contains (CA1_1_14I2PairRaw ((1,0),(k,l))) (CA1_1_14I2PairP ((1,0),(k,l))) = true := by + decide +kernel +lemma CA1_1_14I2PairP_check_1_1 : ∀ k l : Fin 6, contains (CA1_1_14I2PairRaw ((1,1),(k,l))) (CA1_1_14I2PairP ((1,1),(k,l))) = true := by + decide +kernel +lemma CA1_1_14I2PairP_check_1_2 : ∀ k l : Fin 6, contains (CA1_1_14I2PairRaw ((1,2),(k,l))) (CA1_1_14I2PairP ((1,2),(k,l))) = true := by + decide +kernel +lemma CA1_1_14I2PairP_check_1_3 : ∀ k l : Fin 6, contains (CA1_1_14I2PairRaw ((1,3),(k,l))) (CA1_1_14I2PairP ((1,3),(k,l))) = true := by + decide +kernel +lemma CA1_1_14I2PairP_check_1_4 : ∀ k l : Fin 6, contains (CA1_1_14I2PairRaw ((1,4),(k,l))) (CA1_1_14I2PairP ((1,4),(k,l))) = true := by + decide +kernel +lemma CA1_1_14I2PairP_check_1_5 : ∀ k l : Fin 6, contains (CA1_1_14I2PairRaw ((1,5),(k,l))) (CA1_1_14I2PairP ((1,5),(k,l))) = true := by + decide +kernel +lemma CA1_1_14I2PairP_check_2_0 : ∀ k l : Fin 6, contains (CA1_1_14I2PairRaw ((2,0),(k,l))) (CA1_1_14I2PairP ((2,0),(k,l))) = true := by + decide +kernel +lemma CA1_1_14I2PairP_check_2_1 : ∀ k l : Fin 6, contains (CA1_1_14I2PairRaw ((2,1),(k,l))) (CA1_1_14I2PairP ((2,1),(k,l))) = true := by + decide +kernel +lemma CA1_1_14I2PairP_check_2_2 : ∀ k l : Fin 6, contains (CA1_1_14I2PairRaw ((2,2),(k,l))) (CA1_1_14I2PairP ((2,2),(k,l))) = true := by + decide +kernel +lemma CA1_1_14I2PairP_check_2_3 : ∀ k l : Fin 6, contains (CA1_1_14I2PairRaw ((2,3),(k,l))) (CA1_1_14I2PairP ((2,3),(k,l))) = true := by + decide +kernel +lemma CA1_1_14I2PairP_check_2_4 : ∀ k l : Fin 6, contains (CA1_1_14I2PairRaw ((2,4),(k,l))) (CA1_1_14I2PairP ((2,4),(k,l))) = true := by + decide +kernel +lemma CA1_1_14I2PairP_check_2_5 : ∀ k l : Fin 6, contains (CA1_1_14I2PairRaw ((2,5),(k,l))) (CA1_1_14I2PairP ((2,5),(k,l))) = true := by + decide +kernel +lemma CA1_1_14I2PairP_check_3_0 : ∀ k l : Fin 6, contains (CA1_1_14I2PairRaw ((3,0),(k,l))) (CA1_1_14I2PairP ((3,0),(k,l))) = true := by + decide +kernel +lemma CA1_1_14I2PairP_check_3_1 : ∀ k l : Fin 6, contains (CA1_1_14I2PairRaw ((3,1),(k,l))) (CA1_1_14I2PairP ((3,1),(k,l))) = true := by + decide +kernel +lemma CA1_1_14I2PairP_check_3_2 : ∀ k l : Fin 6, contains (CA1_1_14I2PairRaw ((3,2),(k,l))) (CA1_1_14I2PairP ((3,2),(k,l))) = true := by + decide +kernel +lemma CA1_1_14I2PairP_check_3_3 : ∀ k l : Fin 6, contains (CA1_1_14I2PairRaw ((3,3),(k,l))) (CA1_1_14I2PairP ((3,3),(k,l))) = true := by + decide +kernel +lemma CA1_1_14I2PairP_check_3_4 : ∀ k l : Fin 6, contains (CA1_1_14I2PairRaw ((3,4),(k,l))) (CA1_1_14I2PairP ((3,4),(k,l))) = true := by + decide +kernel +lemma CA1_1_14I2PairP_check_3_5 : ∀ k l : Fin 6, contains (CA1_1_14I2PairRaw ((3,5),(k,l))) (CA1_1_14I2PairP ((3,5),(k,l))) = true := by + decide +kernel +lemma CA1_1_14I2PairP_check_4_0 : ∀ k l : Fin 6, contains (CA1_1_14I2PairRaw ((4,0),(k,l))) (CA1_1_14I2PairP ((4,0),(k,l))) = true := by + decide +kernel +lemma CA1_1_14I2PairP_check_4_1 : ∀ k l : Fin 6, contains (CA1_1_14I2PairRaw ((4,1),(k,l))) (CA1_1_14I2PairP ((4,1),(k,l))) = true := by + decide +kernel +lemma CA1_1_14I2PairP_check_4_2 : ∀ k l : Fin 6, contains (CA1_1_14I2PairRaw ((4,2),(k,l))) (CA1_1_14I2PairP ((4,2),(k,l))) = true := by + decide +kernel +lemma CA1_1_14I2PairP_check_4_3 : ∀ k l : Fin 6, contains (CA1_1_14I2PairRaw ((4,3),(k,l))) (CA1_1_14I2PairP ((4,3),(k,l))) = true := by + decide +kernel +lemma CA1_1_14I2PairP_check_4_4 : ∀ k l : Fin 6, contains (CA1_1_14I2PairRaw ((4,4),(k,l))) (CA1_1_14I2PairP ((4,4),(k,l))) = true := by + decide +kernel +lemma CA1_1_14I2PairP_check_4_5 : ∀ k l : Fin 6, contains (CA1_1_14I2PairRaw ((4,5),(k,l))) (CA1_1_14I2PairP ((4,5),(k,l))) = true := by + decide +kernel +lemma CA1_1_14I2PairP_check_5_0 : ∀ k l : Fin 6, contains (CA1_1_14I2PairRaw ((5,0),(k,l))) (CA1_1_14I2PairP ((5,0),(k,l))) = true := by + decide +kernel +lemma CA1_1_14I2PairP_check_5_1 : ∀ k l : Fin 6, contains (CA1_1_14I2PairRaw ((5,1),(k,l))) (CA1_1_14I2PairP ((5,1),(k,l))) = true := by + decide +kernel +lemma CA1_1_14I2PairP_check_5_2 : ∀ k l : Fin 6, contains (CA1_1_14I2PairRaw ((5,2),(k,l))) (CA1_1_14I2PairP ((5,2),(k,l))) = true := by + decide +kernel +lemma CA1_1_14I2PairP_check_5_3 : ∀ k l : Fin 6, contains (CA1_1_14I2PairRaw ((5,3),(k,l))) (CA1_1_14I2PairP ((5,3),(k,l))) = true := by + decide +kernel +lemma CA1_1_14I2PairP_check_5_4 : ∀ k l : Fin 6, contains (CA1_1_14I2PairRaw ((5,4),(k,l))) (CA1_1_14I2PairP ((5,4),(k,l))) = true := by + decide +kernel +lemma CA1_1_14I2PairP_check_5_5 : ∀ k l : Fin 6, contains (CA1_1_14I2PairRaw ((5,5),(k,l))) (CA1_1_14I2PairP ((5,5),(k,l))) = true := by + decide +kernel +lemma CA1_1_14I2PairP_check (a : PairSlot × PairSlot) : contains (CA1_1_14I2PairRaw a) (CA1_1_14I2PairP a) = true := by + rcases a with ⟨⟨i,j⟩,⟨k,l⟩⟩ + revert j i + apply forall_fin6 + · exact forall_fin6 (CA1_1_14I2PairP_check_0_0 k l) (CA1_1_14I2PairP_check_0_1 k l) (CA1_1_14I2PairP_check_0_2 k l) (CA1_1_14I2PairP_check_0_3 k l) (CA1_1_14I2PairP_check_0_4 k l) (CA1_1_14I2PairP_check_0_5 k l) + · exact forall_fin6 (CA1_1_14I2PairP_check_1_0 k l) (CA1_1_14I2PairP_check_1_1 k l) (CA1_1_14I2PairP_check_1_2 k l) (CA1_1_14I2PairP_check_1_3 k l) (CA1_1_14I2PairP_check_1_4 k l) (CA1_1_14I2PairP_check_1_5 k l) + · exact forall_fin6 (CA1_1_14I2PairP_check_2_0 k l) (CA1_1_14I2PairP_check_2_1 k l) (CA1_1_14I2PairP_check_2_2 k l) (CA1_1_14I2PairP_check_2_3 k l) (CA1_1_14I2PairP_check_2_4 k l) (CA1_1_14I2PairP_check_2_5 k l) + · exact forall_fin6 (CA1_1_14I2PairP_check_3_0 k l) (CA1_1_14I2PairP_check_3_1 k l) (CA1_1_14I2PairP_check_3_2 k l) (CA1_1_14I2PairP_check_3_3 k l) (CA1_1_14I2PairP_check_3_4 k l) (CA1_1_14I2PairP_check_3_5 k l) + · exact forall_fin6 (CA1_1_14I2PairP_check_4_0 k l) (CA1_1_14I2PairP_check_4_1 k l) (CA1_1_14I2PairP_check_4_2 k l) (CA1_1_14I2PairP_check_4_3 k l) (CA1_1_14I2PairP_check_4_4 k l) (CA1_1_14I2PairP_check_4_5 k l) + · exact forall_fin6 (CA1_1_14I2PairP_check_5_0 k l) (CA1_1_14I2PairP_check_5_1 k l) (CA1_1_14I2PairP_check_5_2 k l) (CA1_1_14I2PairP_check_5_3 k l) (CA1_1_14I2PairP_check_5_4 k l) (CA1_1_14I2PairP_check_5_5 k l) +lemma CA1_1_14I2PairP_sound (a : PairSlot × PairSlot) : + (CA1_1_14I2PairP a).Encloses (CA1_1_14I2PairValue a) := + contains_sound (CA1_1_14I2PairRaw_sound a) (CA1_1_14I2PairP_check a) +def CA1_1_14I2PairTerms (a : PairSlot × PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_1_14I2PairCertificates (CA1_1_14I2PairCertificateIndex a)).output +lemma CA1_1_14I2PairTerms_sound (a : PairSlot × PairSlot) : + (CA1_1_14I2PairTerms a).Encloses (Foundation.entropyTerm (CA1_1_14I2PairValue a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_1_14I2PairCertificates_valid + (CA1_1_14I2PairCertificateIndex a) (CA1_1_14I2PairP_sound a) +def CA1_1_14I2PairEntropy : Ball := ⟨(9094667866269144492368800187413 / 5000000000000000000000000000000), (10713927161 / 12500000000000000000000000000000)⟩ +lemma CA1_1_14I2PairEntropy_sound : CA1_1_14I2PairEntropy.Encloses (Foundation.finiteEntropy CA1_1_14I2PairValue) := by + exact contains_sound (entropyDoublePair_enclosed CA1_1_14I2PairValue CA1_1_14I2PairTerms CA1_1_14I2PairTerms_sound) (by decide +kernel) +def CA1_1_14I2PairMass : Ball := ⟨1, (11 / 10000000000000000000000000000000)⟩ +lemma CA1_1_14I2PairMass_sound : CA1_1_14I2PairMass.Encloses (∑ a, CA1_1_14I2PairValue a) := by + exact contains_sound (doublePairSumBall_sound CA1_1_14I2PairP CA1_1_14I2PairValue CA1_1_14I2PairP_sound) (by decide +kernel) +def CA1_1_14I2PairMassTermLogWitness : LogWitness := ⟨0, 1, 1⟩ +def CA1_1_14I2PairMassTermLog : Ball := ⟨0, (1323488987 / 6250000000000000000000000000000)⟩ +lemma CA1_1_14I2PairMassTermLog_sound : CA1_1_14I2PairMassTermLog.Encloses (Real.log ((∑ a, CA1_1_14I2PairValue a))) := by + exact checkLog_sound logTwoBall_sound (CA1_1_14I2PairMass_sound) (w := CA1_1_14I2PairMassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA1_1_14I2PairMassTerm : Ball := ⟨0, (21175823793 / 100000000000000000000000000000000)⟩ +lemma CA1_1_14I2PairMassTerm_sound : CA1_1_14I2PairMassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_1_14I2PairValue a))) := by + exact contains_sound (entropyTerm_ball (CA1_1_14I2PairMass_sound) CA1_1_14I2PairMassTermLog_sound) (by decide +kernel) +def CA1_1_14I2PairH : Ball := ⟨(9094667866269144492368800187413 / 5000000000000000000000000000000), (106887241081 / 100000000000000000000000000000000)⟩ +lemma CA1_1_14I2PairH_sound : CA1_1_14I2PairH.Encloses (homogeneousEntropy CA1_1_14I2PairValue) := by + exact contains_sound (homogeneous_enclosed CA1_1_14I2PairValue CA1_1_14I2PairMassTerm_sound CA1_1_14I2PairEntropy_sound) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CA1_1_14I2R0Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 1 14)) (fun u => (stageALaw (shape 1 1 14) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 0 a +def CA1_1_14I2R0Raw (a : PairSlot) : Ball := residualBall (below (shape 1 1 14)) A1_1_14Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 0 a +lemma CA1_1_14I2R0Raw_sound (a : PairSlot) : + (CA1_1_14I2R0Raw a).Encloses (CA1_1_14I2R0Value a) := by + exact residualBall_sound_on (below (shape 1 1 14)) A1_1_14Law (fun u => (stageALaw (shape 1 1 14) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A1_1_14Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 1 14) (show (shape 1 1 14) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 0 a +def CA1_1_14I2R0Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA1_1_14I2R0Certificates_valid : + CA1_1_14I2R0Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_1_14I2R0CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA1_1_14I2R0P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_1_14I2R0Certificates (CA1_1_14I2R0CertificateIndex a)).input +lemma CA1_1_14I2R0P_check : ∀ a : PairSlot, contains (CA1_1_14I2R0Raw a) (CA1_1_14I2R0P a) = true := by + decide +kernel +lemma CA1_1_14I2R0P_sound (a : PairSlot) : + (CA1_1_14I2R0P a).Encloses (CA1_1_14I2R0Value a) := + contains_sound (CA1_1_14I2R0Raw_sound a) (CA1_1_14I2R0P_check a) +def CA1_1_14I2R0Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_1_14I2R0Certificates (CA1_1_14I2R0CertificateIndex a)).output +lemma CA1_1_14I2R0Terms_sound (a : PairSlot) : + (CA1_1_14I2R0Terms a).Encloses (Foundation.entropyTerm (CA1_1_14I2R0Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_1_14I2R0Certificates_valid + (CA1_1_14I2R0CertificateIndex a) (CA1_1_14I2R0P_sound a) +def CA1_1_14I2R0Entropy : Ball := ⟨0, 0⟩ +lemma CA1_1_14I2R0Entropy_sound : CA1_1_14I2R0Entropy.Encloses (Foundation.finiteEntropy CA1_1_14I2R0Value) := by + exact contains_sound (entropyPair_enclosed CA1_1_14I2R0Value CA1_1_14I2R0Terms CA1_1_14I2R0Terms_sound) (by decide +kernel) +def CA1_1_14I2R0Mass : Ball := ⟨0, 0⟩ +lemma CA1_1_14I2R0Mass_sound : CA1_1_14I2R0Mass.Encloses (∑ a, CA1_1_14I2R0Value a) := by + exact contains_sound (pairSumBall_sound CA1_1_14I2R0P CA1_1_14I2R0Value CA1_1_14I2R0P_sound) (by decide +kernel) +def CA1_1_14I2R0MassTerm : Ball := .exact 0 +lemma CA1_1_14I2R0MassTerm_sound : CA1_1_14I2R0MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_1_14I2R0Value a))) := + entropyTerm_zero_ball (CA1_1_14I2R0Mass_sound) +def CA1_1_14I2R0H : Ball := ⟨0, 0⟩ +lemma CA1_1_14I2R0H_sound : CA1_1_14I2R0H.Encloses (homogeneousEntropy CA1_1_14I2R0Value) := by + exact contains_sound (homogeneous_enclosed CA1_1_14I2R0Value CA1_1_14I2R0MassTerm_sound CA1_1_14I2R0Entropy_sound) (by decide +kernel) +def CA1_1_14I2R1Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 1 14)) (fun u => (stageALaw (shape 1 1 14) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 1 a +def CA1_1_14I2R1Raw (a : PairSlot) : Ball := residualBall (below (shape 1 1 14)) A1_1_14Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 1 a +lemma CA1_1_14I2R1Raw_sound (a : PairSlot) : + (CA1_1_14I2R1Raw a).Encloses (CA1_1_14I2R1Value a) := by + exact residualBall_sound_on (below (shape 1 1 14)) A1_1_14Law (fun u => (stageALaw (shape 1 1 14) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A1_1_14Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 1 14) (show (shape 1 1 14) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 1 a +def CA1_1_14I2R1Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA1_1_14I2R1Certificates_valid : + CA1_1_14I2R1Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_1_14I2R1CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA1_1_14I2R1P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_1_14I2R1Certificates (CA1_1_14I2R1CertificateIndex a)).input +lemma CA1_1_14I2R1P_check : ∀ a : PairSlot, contains (CA1_1_14I2R1Raw a) (CA1_1_14I2R1P a) = true := by + decide +kernel +lemma CA1_1_14I2R1P_sound (a : PairSlot) : + (CA1_1_14I2R1P a).Encloses (CA1_1_14I2R1Value a) := + contains_sound (CA1_1_14I2R1Raw_sound a) (CA1_1_14I2R1P_check a) +def CA1_1_14I2R1Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_1_14I2R1Certificates (CA1_1_14I2R1CertificateIndex a)).output +lemma CA1_1_14I2R1Terms_sound (a : PairSlot) : + (CA1_1_14I2R1Terms a).Encloses (Foundation.entropyTerm (CA1_1_14I2R1Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_1_14I2R1Certificates_valid + (CA1_1_14I2R1CertificateIndex a) (CA1_1_14I2R1P_sound a) +def CA1_1_14I2R1Entropy : Ball := ⟨0, 0⟩ +lemma CA1_1_14I2R1Entropy_sound : CA1_1_14I2R1Entropy.Encloses (Foundation.finiteEntropy CA1_1_14I2R1Value) := by + exact contains_sound (entropyPair_enclosed CA1_1_14I2R1Value CA1_1_14I2R1Terms CA1_1_14I2R1Terms_sound) (by decide +kernel) +def CA1_1_14I2R1Mass : Ball := ⟨0, 0⟩ +lemma CA1_1_14I2R1Mass_sound : CA1_1_14I2R1Mass.Encloses (∑ a, CA1_1_14I2R1Value a) := by + exact contains_sound (pairSumBall_sound CA1_1_14I2R1P CA1_1_14I2R1Value CA1_1_14I2R1P_sound) (by decide +kernel) +def CA1_1_14I2R1MassTerm : Ball := .exact 0 +lemma CA1_1_14I2R1MassTerm_sound : CA1_1_14I2R1MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_1_14I2R1Value a))) := + entropyTerm_zero_ball (CA1_1_14I2R1Mass_sound) +def CA1_1_14I2R1H : Ball := ⟨0, 0⟩ +lemma CA1_1_14I2R1H_sound : CA1_1_14I2R1H.Encloses (homogeneousEntropy CA1_1_14I2R1Value) := by + exact contains_sound (homogeneous_enclosed CA1_1_14I2R1Value CA1_1_14I2R1MassTerm_sound CA1_1_14I2R1Entropy_sound) (by decide +kernel) +def CA1_1_14I2R2Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 1 14)) (fun u => (stageALaw (shape 1 1 14) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 2 a +def CA1_1_14I2R2Raw (a : PairSlot) : Ball := residualBall (below (shape 1 1 14)) A1_1_14Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 2 a +lemma CA1_1_14I2R2Raw_sound (a : PairSlot) : + (CA1_1_14I2R2Raw a).Encloses (CA1_1_14I2R2Value a) := by + exact residualBall_sound_on (below (shape 1 1 14)) A1_1_14Law (fun u => (stageALaw (shape 1 1 14) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A1_1_14Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 1 14) (show (shape 1 1 14) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 2 a +def CA1_1_14I2R2Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA1_1_14I2R2Certificates_valid : + CA1_1_14I2R2Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_1_14I2R2CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA1_1_14I2R2P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_1_14I2R2Certificates (CA1_1_14I2R2CertificateIndex a)).input +lemma CA1_1_14I2R2P_check : ∀ a : PairSlot, contains (CA1_1_14I2R2Raw a) (CA1_1_14I2R2P a) = true := by + decide +kernel +lemma CA1_1_14I2R2P_sound (a : PairSlot) : + (CA1_1_14I2R2P a).Encloses (CA1_1_14I2R2Value a) := + contains_sound (CA1_1_14I2R2Raw_sound a) (CA1_1_14I2R2P_check a) +def CA1_1_14I2R2Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_1_14I2R2Certificates (CA1_1_14I2R2CertificateIndex a)).output +lemma CA1_1_14I2R2Terms_sound (a : PairSlot) : + (CA1_1_14I2R2Terms a).Encloses (Foundation.entropyTerm (CA1_1_14I2R2Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_1_14I2R2Certificates_valid + (CA1_1_14I2R2CertificateIndex a) (CA1_1_14I2R2P_sound a) +def CA1_1_14I2R2Entropy : Ball := ⟨0, 0⟩ +lemma CA1_1_14I2R2Entropy_sound : CA1_1_14I2R2Entropy.Encloses (Foundation.finiteEntropy CA1_1_14I2R2Value) := by + exact contains_sound (entropyPair_enclosed CA1_1_14I2R2Value CA1_1_14I2R2Terms CA1_1_14I2R2Terms_sound) (by decide +kernel) +def CA1_1_14I2R2Mass : Ball := ⟨0, 0⟩ +lemma CA1_1_14I2R2Mass_sound : CA1_1_14I2R2Mass.Encloses (∑ a, CA1_1_14I2R2Value a) := by + exact contains_sound (pairSumBall_sound CA1_1_14I2R2P CA1_1_14I2R2Value CA1_1_14I2R2P_sound) (by decide +kernel) +def CA1_1_14I2R2MassTerm : Ball := .exact 0 +lemma CA1_1_14I2R2MassTerm_sound : CA1_1_14I2R2MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_1_14I2R2Value a))) := + entropyTerm_zero_ball (CA1_1_14I2R2Mass_sound) +def CA1_1_14I2R2H : Ball := ⟨0, 0⟩ +lemma CA1_1_14I2R2H_sound : CA1_1_14I2R2H.Encloses (homogeneousEntropy CA1_1_14I2R2Value) := by + exact contains_sound (homogeneous_enclosed CA1_1_14I2R2Value CA1_1_14I2R2MassTerm_sound CA1_1_14I2R2Entropy_sound) (by decide +kernel) +def CA1_1_14I2R3Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 1 14)) (fun u => (stageALaw (shape 1 1 14) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 3 a +def CA1_1_14I2R3Raw (a : PairSlot) : Ball := residualBall (below (shape 1 1 14)) A1_1_14Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 3 a +lemma CA1_1_14I2R3Raw_sound (a : PairSlot) : + (CA1_1_14I2R3Raw a).Encloses (CA1_1_14I2R3Value a) := by + exact residualBall_sound_on (below (shape 1 1 14)) A1_1_14Law (fun u => (stageALaw (shape 1 1 14) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A1_1_14Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 1 14) (show (shape 1 1 14) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 3 a +def CA1_1_14I2R3Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA1_1_14I2R3Certificates_valid : + CA1_1_14I2R3Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_1_14I2R3CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA1_1_14I2R3P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_1_14I2R3Certificates (CA1_1_14I2R3CertificateIndex a)).input +lemma CA1_1_14I2R3P_check : ∀ a : PairSlot, contains (CA1_1_14I2R3Raw a) (CA1_1_14I2R3P a) = true := by + decide +kernel +lemma CA1_1_14I2R3P_sound (a : PairSlot) : + (CA1_1_14I2R3P a).Encloses (CA1_1_14I2R3Value a) := + contains_sound (CA1_1_14I2R3Raw_sound a) (CA1_1_14I2R3P_check a) +def CA1_1_14I2R3Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_1_14I2R3Certificates (CA1_1_14I2R3CertificateIndex a)).output +lemma CA1_1_14I2R3Terms_sound (a : PairSlot) : + (CA1_1_14I2R3Terms a).Encloses (Foundation.entropyTerm (CA1_1_14I2R3Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_1_14I2R3Certificates_valid + (CA1_1_14I2R3CertificateIndex a) (CA1_1_14I2R3P_sound a) +def CA1_1_14I2R3Entropy : Ball := ⟨0, 0⟩ +lemma CA1_1_14I2R3Entropy_sound : CA1_1_14I2R3Entropy.Encloses (Foundation.finiteEntropy CA1_1_14I2R3Value) := by + exact contains_sound (entropyPair_enclosed CA1_1_14I2R3Value CA1_1_14I2R3Terms CA1_1_14I2R3Terms_sound) (by decide +kernel) +def CA1_1_14I2R3Mass : Ball := ⟨0, 0⟩ +lemma CA1_1_14I2R3Mass_sound : CA1_1_14I2R3Mass.Encloses (∑ a, CA1_1_14I2R3Value a) := by + exact contains_sound (pairSumBall_sound CA1_1_14I2R3P CA1_1_14I2R3Value CA1_1_14I2R3P_sound) (by decide +kernel) +def CA1_1_14I2R3MassTerm : Ball := .exact 0 +lemma CA1_1_14I2R3MassTerm_sound : CA1_1_14I2R3MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_1_14I2R3Value a))) := + entropyTerm_zero_ball (CA1_1_14I2R3Mass_sound) +def CA1_1_14I2R3H : Ball := ⟨0, 0⟩ +lemma CA1_1_14I2R3H_sound : CA1_1_14I2R3H.Encloses (homogeneousEntropy CA1_1_14I2R3Value) := by + exact contains_sound (homogeneous_enclosed CA1_1_14I2R3Value CA1_1_14I2R3MassTerm_sound CA1_1_14I2R3Entropy_sound) (by decide +kernel) +def CA1_1_14I2R4Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 1 14)) (fun u => (stageALaw (shape 1 1 14) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 4 a +def CA1_1_14I2R4Raw (a : PairSlot) : Ball := residualBall (below (shape 1 1 14)) A1_1_14Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 4 a +lemma CA1_1_14I2R4Raw_sound (a : PairSlot) : + (CA1_1_14I2R4Raw a).Encloses (CA1_1_14I2R4Value a) := by + exact residualBall_sound_on (below (shape 1 1 14)) A1_1_14Law (fun u => (stageALaw (shape 1 1 14) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A1_1_14Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 1 14) (show (shape 1 1 14) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 4 a +def CA1_1_14I2R4Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA1_1_14I2R4Certificates_valid : + CA1_1_14I2R4Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_1_14I2R4CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA1_1_14I2R4P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_1_14I2R4Certificates (CA1_1_14I2R4CertificateIndex a)).input +lemma CA1_1_14I2R4P_check : ∀ a : PairSlot, contains (CA1_1_14I2R4Raw a) (CA1_1_14I2R4P a) = true := by + decide +kernel +lemma CA1_1_14I2R4P_sound (a : PairSlot) : + (CA1_1_14I2R4P a).Encloses (CA1_1_14I2R4Value a) := + contains_sound (CA1_1_14I2R4Raw_sound a) (CA1_1_14I2R4P_check a) +def CA1_1_14I2R4Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_1_14I2R4Certificates (CA1_1_14I2R4CertificateIndex a)).output +lemma CA1_1_14I2R4Terms_sound (a : PairSlot) : + (CA1_1_14I2R4Terms a).Encloses (Foundation.entropyTerm (CA1_1_14I2R4Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_1_14I2R4Certificates_valid + (CA1_1_14I2R4CertificateIndex a) (CA1_1_14I2R4P_sound a) +def CA1_1_14I2R4Entropy : Ball := ⟨0, 0⟩ +lemma CA1_1_14I2R4Entropy_sound : CA1_1_14I2R4Entropy.Encloses (Foundation.finiteEntropy CA1_1_14I2R4Value) := by + exact contains_sound (entropyPair_enclosed CA1_1_14I2R4Value CA1_1_14I2R4Terms CA1_1_14I2R4Terms_sound) (by decide +kernel) +def CA1_1_14I2R4Mass : Ball := ⟨0, 0⟩ +lemma CA1_1_14I2R4Mass_sound : CA1_1_14I2R4Mass.Encloses (∑ a, CA1_1_14I2R4Value a) := by + exact contains_sound (pairSumBall_sound CA1_1_14I2R4P CA1_1_14I2R4Value CA1_1_14I2R4P_sound) (by decide +kernel) +def CA1_1_14I2R4MassTerm : Ball := .exact 0 +lemma CA1_1_14I2R4MassTerm_sound : CA1_1_14I2R4MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_1_14I2R4Value a))) := + entropyTerm_zero_ball (CA1_1_14I2R4Mass_sound) +def CA1_1_14I2R4H : Ball := ⟨0, 0⟩ +lemma CA1_1_14I2R4H_sound : CA1_1_14I2R4H.Encloses (homogeneousEntropy CA1_1_14I2R4Value) := by + exact contains_sound (homogeneous_enclosed CA1_1_14I2R4Value CA1_1_14I2R4MassTerm_sound CA1_1_14I2R4Entropy_sound) (by decide +kernel) +def CA1_1_14I2R5Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 1 14)) (fun u => (stageALaw (shape 1 1 14) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 5 a +def CA1_1_14I2R5Raw (a : PairSlot) : Ball := residualBall (below (shape 1 1 14)) A1_1_14Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 5 a +lemma CA1_1_14I2R5Raw_sound (a : PairSlot) : + (CA1_1_14I2R5Raw a).Encloses (CA1_1_14I2R5Value a) := by + exact residualBall_sound_on (below (shape 1 1 14)) A1_1_14Law (fun u => (stageALaw (shape 1 1 14) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A1_1_14Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 1 14) (show (shape 1 1 14) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 5 a +def CA1_1_14I2R5Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA1_1_14I2R5Certificates_valid : + CA1_1_14I2R5Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_1_14I2R5CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA1_1_14I2R5P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_1_14I2R5Certificates (CA1_1_14I2R5CertificateIndex a)).input +lemma CA1_1_14I2R5P_check : ∀ a : PairSlot, contains (CA1_1_14I2R5Raw a) (CA1_1_14I2R5P a) = true := by + decide +kernel +lemma CA1_1_14I2R5P_sound (a : PairSlot) : + (CA1_1_14I2R5P a).Encloses (CA1_1_14I2R5Value a) := + contains_sound (CA1_1_14I2R5Raw_sound a) (CA1_1_14I2R5P_check a) +def CA1_1_14I2R5Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_1_14I2R5Certificates (CA1_1_14I2R5CertificateIndex a)).output +lemma CA1_1_14I2R5Terms_sound (a : PairSlot) : + (CA1_1_14I2R5Terms a).Encloses (Foundation.entropyTerm (CA1_1_14I2R5Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_1_14I2R5Certificates_valid + (CA1_1_14I2R5CertificateIndex a) (CA1_1_14I2R5P_sound a) +def CA1_1_14I2R5Entropy : Ball := ⟨0, 0⟩ +lemma CA1_1_14I2R5Entropy_sound : CA1_1_14I2R5Entropy.Encloses (Foundation.finiteEntropy CA1_1_14I2R5Value) := by + exact contains_sound (entropyPair_enclosed CA1_1_14I2R5Value CA1_1_14I2R5Terms CA1_1_14I2R5Terms_sound) (by decide +kernel) +def CA1_1_14I2R5Mass : Ball := ⟨0, 0⟩ +lemma CA1_1_14I2R5Mass_sound : CA1_1_14I2R5Mass.Encloses (∑ a, CA1_1_14I2R5Value a) := by + exact contains_sound (pairSumBall_sound CA1_1_14I2R5P CA1_1_14I2R5Value CA1_1_14I2R5P_sound) (by decide +kernel) +def CA1_1_14I2R5MassTerm : Ball := .exact 0 +lemma CA1_1_14I2R5MassTerm_sound : CA1_1_14I2R5MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_1_14I2R5Value a))) := + entropyTerm_zero_ball (CA1_1_14I2R5Mass_sound) +def CA1_1_14I2R5H : Ball := ⟨0, 0⟩ +lemma CA1_1_14I2R5H_sound : CA1_1_14I2R5H.Encloses (homogeneousEntropy CA1_1_14I2R5Value) := by + exact contains_sound (homogeneous_enclosed CA1_1_14I2R5Value CA1_1_14I2R5MassTerm_sound CA1_1_14I2R5Entropy_sound) (by decide +kernel) +def CA1_1_14I2R6Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 1 14)) (fun u => (stageALaw (shape 1 1 14) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 6 a +def CA1_1_14I2R6Raw (a : PairSlot) : Ball := residualBall (below (shape 1 1 14)) A1_1_14Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 6 a +lemma CA1_1_14I2R6Raw_sound (a : PairSlot) : + (CA1_1_14I2R6Raw a).Encloses (CA1_1_14I2R6Value a) := by + exact residualBall_sound_on (below (shape 1 1 14)) A1_1_14Law (fun u => (stageALaw (shape 1 1 14) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A1_1_14Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 1 14) (show (shape 1 1 14) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 6 a +def CA1_1_14I2R6Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(99160889261267990055839696027 / 50000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ ⟨(246832658306324730164379568689 / 20000000000000000000000000000000), (419962717 / 100000000000000000000000000000000)⟩ ⟨(-622303460934010062153369001144639 / 100000000000000000000000000000000), (105879118919 / 50000000000000000000000000000000)⟩ ⟨-9, 99160889261267990055839696027, 97656250000000000000000000000⟩, + .log ⟨(3123764808912903199660529 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(99306653910335874506069959 / 50000000000000000000000000000000), (397 / 625000000000000000000000000000)⟩ ⟨(-198691842986603233560091926417359 / 12500000000000000000000000000000), (101645554311 / 20000000000000000000000000000000)⟩ ⟨-23, 3123764808912903199660529, 2980232238769531250000000⟩, + .log ⟨(32493265803550027484685499559 / 156250000000000000000000000000), (7 / 20000000000000000000000000000000)⟩ ⟨(1632902986376198777931005263743 / 5000000000000000000000000000000), (880731739 / 5000000000000000000000000000000)⟩ ⟨(-31408488535911439183560405759753 / 20000000000000000000000000000000), (847032949 / 1000000000000000000000000000000)⟩ ⟨-3, 32493265803550027484685499559, 19531250000000000000000000000⟩] +lemma CA1_1_14I2R6Certificates_valid : + CA1_1_14I2R6Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_1_14I2R6CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 5, 2 => 1 + | 5, 3 => 2 + | 4, 4 => 3 + | 2, 5 => 1 + | 3, 5 => 2 + | _, _ => 0 +def CA1_1_14I2R6P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_1_14I2R6Certificates (CA1_1_14I2R6CertificateIndex a)).input +lemma CA1_1_14I2R6P_check : ∀ a : PairSlot, contains (CA1_1_14I2R6Raw a) (CA1_1_14I2R6P a) = true := by + decide +kernel +lemma CA1_1_14I2R6P_sound (a : PairSlot) : + (CA1_1_14I2R6P a).Encloses (CA1_1_14I2R6Value a) := + contains_sound (CA1_1_14I2R6Raw_sound a) (CA1_1_14I2R6P_check a) +def CA1_1_14I2R6Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_1_14I2R6Certificates (CA1_1_14I2R6CertificateIndex a)).output +lemma CA1_1_14I2R6Terms_sound (a : PairSlot) : + (CA1_1_14I2R6Terms a).Encloses (Foundation.entropyTerm (CA1_1_14I2R6Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_1_14I2R6Certificates_valid + (CA1_1_14I2R6CertificateIndex a) (CA1_1_14I2R6P_sound a) +def CA1_1_14I2R6Entropy : Ball := ⟨(17563391768601432101880962620793 / 50000000000000000000000000000000), (9227343627 / 50000000000000000000000000000000)⟩ +lemma CA1_1_14I2R6Entropy_sound : CA1_1_14I2R6Entropy.Encloses (Foundation.finiteEntropy CA1_1_14I2R6Value) := by + exact contains_sound (entropyPair_enclosed CA1_1_14I2R6Value CA1_1_14I2R6Terms CA1_1_14I2R6Terms_sound) (by decide +kernel) +def CA1_1_14I2R6Mass : Ball := ⟨(211923586614355608536476757861 / 1000000000000000000000000000000), (41 / 100000000000000000000000000000000)⟩ +lemma CA1_1_14I2R6Mass_sound : CA1_1_14I2R6Mass.Encloses (∑ a, CA1_1_14I2R6Value a) := by + exact contains_sound (pairSumBall_sound CA1_1_14I2R6P CA1_1_14I2R6Value CA1_1_14I2R6P_sound) (by decide +kernel) +def CA1_1_14I2R6MassTermLogWitness : LogWitness := ⟨-3, 211923586614355608536476757861, 125000000000000000000000000000⟩ +def CA1_1_14I2R6MassTermLog : Ball := ⟨(-155152950978273699515243525338701 / 100000000000000000000000000000000), (3388131797 / 4000000000000000000000000000000)⟩ +lemma CA1_1_14I2R6MassTermLog_sound : CA1_1_14I2R6MassTermLog.Encloses (Real.log ((∑ a, CA1_1_14I2R6Value a))) := by + exact checkLog_sound logTwoBall_sound (CA1_1_14I2R6Mass_sound) (w := CA1_1_14I2R6MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA1_1_14I2R6MassTerm : Ball := ⟨(32880569845117056105244355122547 / 100000000000000000000000000000000), (17950626123 / 100000000000000000000000000000000)⟩ +lemma CA1_1_14I2R6MassTerm_sound : CA1_1_14I2R6MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_1_14I2R6Value a))) := by + exact contains_sound (entropyTerm_ball (CA1_1_14I2R6Mass_sound) CA1_1_14I2R6MassTermLog_sound) (by decide +kernel) +def CA1_1_14I2R6H : Ball := ⟨(2246213692085808098517570119039 / 100000000000000000000000000000000), (36405313377 / 100000000000000000000000000000000)⟩ +lemma CA1_1_14I2R6H_sound : CA1_1_14I2R6H.Encloses (homogeneousEntropy CA1_1_14I2R6Value) := by + exact contains_sound (homogeneous_enclosed CA1_1_14I2R6Value CA1_1_14I2R6MassTerm_sound CA1_1_14I2R6Entropy_sound) (by decide +kernel) +def CA1_1_14I2R7Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 1 14)) (fun u => (stageALaw (shape 1 1 14) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 7 a +def CA1_1_14I2R7Raw (a : PairSlot) : Ball := residualBall (below (shape 1 1 14)) A1_1_14Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 7 a +lemma CA1_1_14I2R7Raw_sound (a : PairSlot) : + (CA1_1_14I2R7Raw a).Encloses (CA1_1_14I2R7Value a) := by + exact residualBall_sound_on (below (shape 1 1 14)) A1_1_14Law (fun u => (stageALaw (shape 1 1 14) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A1_1_14Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 1 14) (show (shape 1 1 14) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 7 a +def CA1_1_14I2R7Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA1_1_14I2R7Certificates_valid : + CA1_1_14I2R7Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_1_14I2R7CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA1_1_14I2R7P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_1_14I2R7Certificates (CA1_1_14I2R7CertificateIndex a)).input +lemma CA1_1_14I2R7P_check : ∀ a : PairSlot, contains (CA1_1_14I2R7Raw a) (CA1_1_14I2R7P a) = true := by + decide +kernel +lemma CA1_1_14I2R7P_sound (a : PairSlot) : + (CA1_1_14I2R7P a).Encloses (CA1_1_14I2R7Value a) := + contains_sound (CA1_1_14I2R7Raw_sound a) (CA1_1_14I2R7P_check a) +def CA1_1_14I2R7Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_1_14I2R7Certificates (CA1_1_14I2R7CertificateIndex a)).output +lemma CA1_1_14I2R7Terms_sound (a : PairSlot) : + (CA1_1_14I2R7Terms a).Encloses (Foundation.entropyTerm (CA1_1_14I2R7Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_1_14I2R7Certificates_valid + (CA1_1_14I2R7CertificateIndex a) (CA1_1_14I2R7P_sound a) +def CA1_1_14I2R7Entropy : Ball := ⟨0, 0⟩ +lemma CA1_1_14I2R7Entropy_sound : CA1_1_14I2R7Entropy.Encloses (Foundation.finiteEntropy CA1_1_14I2R7Value) := by + exact contains_sound (entropyPair_enclosed CA1_1_14I2R7Value CA1_1_14I2R7Terms CA1_1_14I2R7Terms_sound) (by decide +kernel) +def CA1_1_14I2R7Mass : Ball := ⟨0, 0⟩ +lemma CA1_1_14I2R7Mass_sound : CA1_1_14I2R7Mass.Encloses (∑ a, CA1_1_14I2R7Value a) := by + exact contains_sound (pairSumBall_sound CA1_1_14I2R7P CA1_1_14I2R7Value CA1_1_14I2R7P_sound) (by decide +kernel) +def CA1_1_14I2R7MassTerm : Ball := .exact 0 +lemma CA1_1_14I2R7MassTerm_sound : CA1_1_14I2R7MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_1_14I2R7Value a))) := + entropyTerm_zero_ball (CA1_1_14I2R7Mass_sound) +def CA1_1_14I2R7H : Ball := ⟨0, 0⟩ +lemma CA1_1_14I2R7H_sound : CA1_1_14I2R7H.Encloses (homogeneousEntropy CA1_1_14I2R7Value) := by + exact contains_sound (homogeneous_enclosed CA1_1_14I2R7Value CA1_1_14I2R7MassTerm_sound CA1_1_14I2R7Entropy_sound) (by decide +kernel) +def CA1_1_14I2R8Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 1 14)) (fun u => (stageALaw (shape 1 1 14) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 8 a +def CA1_1_14I2R8Raw (a : PairSlot) : Ball := residualBall (below (shape 1 1 14)) A1_1_14Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 8 a +lemma CA1_1_14I2R8Raw_sound (a : PairSlot) : + (CA1_1_14I2R8Raw a).Encloses (CA1_1_14I2R8Value a) := by + exact residualBall_sound_on (below (shape 1 1 14)) A1_1_14Law (fun u => (stageALaw (shape 1 1 14) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A1_1_14Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 1 14) (show (shape 1 1 14) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 8 a +def CA1_1_14I2R8Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA1_1_14I2R8Certificates_valid : + CA1_1_14I2R8Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_1_14I2R8CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA1_1_14I2R8P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_1_14I2R8Certificates (CA1_1_14I2R8CertificateIndex a)).input +lemma CA1_1_14I2R8P_check : ∀ a : PairSlot, contains (CA1_1_14I2R8Raw a) (CA1_1_14I2R8P a) = true := by + decide +kernel +lemma CA1_1_14I2R8P_sound (a : PairSlot) : + (CA1_1_14I2R8P a).Encloses (CA1_1_14I2R8Value a) := + contains_sound (CA1_1_14I2R8Raw_sound a) (CA1_1_14I2R8P_check a) +def CA1_1_14I2R8Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_1_14I2R8Certificates (CA1_1_14I2R8CertificateIndex a)).output +lemma CA1_1_14I2R8Terms_sound (a : PairSlot) : + (CA1_1_14I2R8Terms a).Encloses (Foundation.entropyTerm (CA1_1_14I2R8Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_1_14I2R8Certificates_valid + (CA1_1_14I2R8CertificateIndex a) (CA1_1_14I2R8P_sound a) +def CA1_1_14I2R8Entropy : Ball := ⟨0, 0⟩ +lemma CA1_1_14I2R8Entropy_sound : CA1_1_14I2R8Entropy.Encloses (Foundation.finiteEntropy CA1_1_14I2R8Value) := by + exact contains_sound (entropyPair_enclosed CA1_1_14I2R8Value CA1_1_14I2R8Terms CA1_1_14I2R8Terms_sound) (by decide +kernel) +def CA1_1_14I2R8Mass : Ball := ⟨0, 0⟩ +lemma CA1_1_14I2R8Mass_sound : CA1_1_14I2R8Mass.Encloses (∑ a, CA1_1_14I2R8Value a) := by + exact contains_sound (pairSumBall_sound CA1_1_14I2R8P CA1_1_14I2R8Value CA1_1_14I2R8P_sound) (by decide +kernel) +def CA1_1_14I2R8MassTerm : Ball := .exact 0 +lemma CA1_1_14I2R8MassTerm_sound : CA1_1_14I2R8MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_1_14I2R8Value a))) := + entropyTerm_zero_ball (CA1_1_14I2R8Mass_sound) +def CA1_1_14I2R8H : Ball := ⟨0, 0⟩ +lemma CA1_1_14I2R8H_sound : CA1_1_14I2R8H.Encloses (homogeneousEntropy CA1_1_14I2R8Value) := by + exact contains_sound (homogeneous_enclosed CA1_1_14I2R8Value CA1_1_14I2R8MassTerm_sound CA1_1_14I2R8Entropy_sound) (by decide +kernel) +def CA1_1_14I2R9Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 1 14)) (fun u => (stageALaw (shape 1 1 14) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 9 a +def CA1_1_14I2R9Raw (a : PairSlot) : Ball := residualBall (below (shape 1 1 14)) A1_1_14Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 9 a +lemma CA1_1_14I2R9Raw_sound (a : PairSlot) : + (CA1_1_14I2R9Raw a).Encloses (CA1_1_14I2R9Value a) := by + exact residualBall_sound_on (below (shape 1 1 14)) A1_1_14Law (fun u => (stageALaw (shape 1 1 14) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A1_1_14Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 1 14) (show (shape 1 1 14) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 9 a +def CA1_1_14I2R9Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA1_1_14I2R9Certificates_valid : + CA1_1_14I2R9Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_1_14I2R9CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA1_1_14I2R9P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_1_14I2R9Certificates (CA1_1_14I2R9CertificateIndex a)).input +lemma CA1_1_14I2R9P_check : ∀ a : PairSlot, contains (CA1_1_14I2R9Raw a) (CA1_1_14I2R9P a) = true := by + decide +kernel +lemma CA1_1_14I2R9P_sound (a : PairSlot) : + (CA1_1_14I2R9P a).Encloses (CA1_1_14I2R9Value a) := + contains_sound (CA1_1_14I2R9Raw_sound a) (CA1_1_14I2R9P_check a) +def CA1_1_14I2R9Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_1_14I2R9Certificates (CA1_1_14I2R9CertificateIndex a)).output +lemma CA1_1_14I2R9Terms_sound (a : PairSlot) : + (CA1_1_14I2R9Terms a).Encloses (Foundation.entropyTerm (CA1_1_14I2R9Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_1_14I2R9Certificates_valid + (CA1_1_14I2R9CertificateIndex a) (CA1_1_14I2R9P_sound a) +def CA1_1_14I2R9Entropy : Ball := ⟨0, 0⟩ +lemma CA1_1_14I2R9Entropy_sound : CA1_1_14I2R9Entropy.Encloses (Foundation.finiteEntropy CA1_1_14I2R9Value) := by + exact contains_sound (entropyPair_enclosed CA1_1_14I2R9Value CA1_1_14I2R9Terms CA1_1_14I2R9Terms_sound) (by decide +kernel) +def CA1_1_14I2R9Mass : Ball := ⟨0, 0⟩ +lemma CA1_1_14I2R9Mass_sound : CA1_1_14I2R9Mass.Encloses (∑ a, CA1_1_14I2R9Value a) := by + exact contains_sound (pairSumBall_sound CA1_1_14I2R9P CA1_1_14I2R9Value CA1_1_14I2R9P_sound) (by decide +kernel) +def CA1_1_14I2R9MassTerm : Ball := .exact 0 +lemma CA1_1_14I2R9MassTerm_sound : CA1_1_14I2R9MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_1_14I2R9Value a))) := + entropyTerm_zero_ball (CA1_1_14I2R9Mass_sound) +def CA1_1_14I2R9H : Ball := ⟨0, 0⟩ +lemma CA1_1_14I2R9H_sound : CA1_1_14I2R9H.Encloses (homogeneousEntropy CA1_1_14I2R9Value) := by + exact contains_sound (homogeneous_enclosed CA1_1_14I2R9Value CA1_1_14I2R9MassTerm_sound CA1_1_14I2R9Entropy_sound) (by decide +kernel) +def CA1_1_14I2R10Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 1 14)) (fun u => (stageALaw (shape 1 1 14) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 10 a +def CA1_1_14I2R10Raw (a : PairSlot) : Ball := residualBall (below (shape 1 1 14)) A1_1_14Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 10 a +lemma CA1_1_14I2R10Raw_sound (a : PairSlot) : + (CA1_1_14I2R10Raw a).Encloses (CA1_1_14I2R10Value a) := by + exact residualBall_sound_on (below (shape 1 1 14)) A1_1_14Law (fun u => (stageALaw (shape 1 1 14) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A1_1_14Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 1 14) (show (shape 1 1 14) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 10 a +def CA1_1_14I2R10Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA1_1_14I2R10Certificates_valid : + CA1_1_14I2R10Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_1_14I2R10CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA1_1_14I2R10P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_1_14I2R10Certificates (CA1_1_14I2R10CertificateIndex a)).input +lemma CA1_1_14I2R10P_check : ∀ a : PairSlot, contains (CA1_1_14I2R10Raw a) (CA1_1_14I2R10P a) = true := by + decide +kernel +lemma CA1_1_14I2R10P_sound (a : PairSlot) : + (CA1_1_14I2R10P a).Encloses (CA1_1_14I2R10Value a) := + contains_sound (CA1_1_14I2R10Raw_sound a) (CA1_1_14I2R10P_check a) +def CA1_1_14I2R10Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_1_14I2R10Certificates (CA1_1_14I2R10CertificateIndex a)).output +lemma CA1_1_14I2R10Terms_sound (a : PairSlot) : + (CA1_1_14I2R10Terms a).Encloses (Foundation.entropyTerm (CA1_1_14I2R10Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_1_14I2R10Certificates_valid + (CA1_1_14I2R10CertificateIndex a) (CA1_1_14I2R10P_sound a) +def CA1_1_14I2R10Entropy : Ball := ⟨0, 0⟩ +lemma CA1_1_14I2R10Entropy_sound : CA1_1_14I2R10Entropy.Encloses (Foundation.finiteEntropy CA1_1_14I2R10Value) := by + exact contains_sound (entropyPair_enclosed CA1_1_14I2R10Value CA1_1_14I2R10Terms CA1_1_14I2R10Terms_sound) (by decide +kernel) +def CA1_1_14I2R10Mass : Ball := ⟨0, 0⟩ +lemma CA1_1_14I2R10Mass_sound : CA1_1_14I2R10Mass.Encloses (∑ a, CA1_1_14I2R10Value a) := by + exact contains_sound (pairSumBall_sound CA1_1_14I2R10P CA1_1_14I2R10Value CA1_1_14I2R10P_sound) (by decide +kernel) +def CA1_1_14I2R10MassTerm : Ball := .exact 0 +lemma CA1_1_14I2R10MassTerm_sound : CA1_1_14I2R10MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_1_14I2R10Value a))) := + entropyTerm_zero_ball (CA1_1_14I2R10Mass_sound) +def CA1_1_14I2R10H : Ball := ⟨0, 0⟩ +lemma CA1_1_14I2R10H_sound : CA1_1_14I2R10H.Encloses (homogeneousEntropy CA1_1_14I2R10Value) := by + exact contains_sound (homogeneous_enclosed CA1_1_14I2R10Value CA1_1_14I2R10MassTerm_sound CA1_1_14I2R10Entropy_sound) (by decide +kernel) +def CA1_1_14I2R11Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 1 14)) (fun u => (stageALaw (shape 1 1 14) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 11 a +def CA1_1_14I2R11Raw (a : PairSlot) : Ball := residualBall (below (shape 1 1 14)) A1_1_14Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 11 a +lemma CA1_1_14I2R11Raw_sound (a : PairSlot) : + (CA1_1_14I2R11Raw a).Encloses (CA1_1_14I2R11Value a) := by + exact residualBall_sound_on (below (shape 1 1 14)) A1_1_14Law (fun u => (stageALaw (shape 1 1 14) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A1_1_14Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 1 14) (show (shape 1 1 14) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 11 a +def CA1_1_14I2R11Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA1_1_14I2R11Certificates_valid : + CA1_1_14I2R11Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_1_14I2R11CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA1_1_14I2R11P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_1_14I2R11Certificates (CA1_1_14I2R11CertificateIndex a)).input +lemma CA1_1_14I2R11P_check : ∀ a : PairSlot, contains (CA1_1_14I2R11Raw a) (CA1_1_14I2R11P a) = true := by + decide +kernel +lemma CA1_1_14I2R11P_sound (a : PairSlot) : + (CA1_1_14I2R11P a).Encloses (CA1_1_14I2R11Value a) := + contains_sound (CA1_1_14I2R11Raw_sound a) (CA1_1_14I2R11P_check a) +def CA1_1_14I2R11Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_1_14I2R11Certificates (CA1_1_14I2R11CertificateIndex a)).output +lemma CA1_1_14I2R11Terms_sound (a : PairSlot) : + (CA1_1_14I2R11Terms a).Encloses (Foundation.entropyTerm (CA1_1_14I2R11Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_1_14I2R11Certificates_valid + (CA1_1_14I2R11CertificateIndex a) (CA1_1_14I2R11P_sound a) +def CA1_1_14I2R11Entropy : Ball := ⟨0, 0⟩ +lemma CA1_1_14I2R11Entropy_sound : CA1_1_14I2R11Entropy.Encloses (Foundation.finiteEntropy CA1_1_14I2R11Value) := by + exact contains_sound (entropyPair_enclosed CA1_1_14I2R11Value CA1_1_14I2R11Terms CA1_1_14I2R11Terms_sound) (by decide +kernel) +def CA1_1_14I2R11Mass : Ball := ⟨0, 0⟩ +lemma CA1_1_14I2R11Mass_sound : CA1_1_14I2R11Mass.Encloses (∑ a, CA1_1_14I2R11Value a) := by + exact contains_sound (pairSumBall_sound CA1_1_14I2R11P CA1_1_14I2R11Value CA1_1_14I2R11P_sound) (by decide +kernel) +def CA1_1_14I2R11MassTerm : Ball := .exact 0 +lemma CA1_1_14I2R11MassTerm_sound : CA1_1_14I2R11MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_1_14I2R11Value a))) := + entropyTerm_zero_ball (CA1_1_14I2R11Mass_sound) +def CA1_1_14I2R11H : Ball := ⟨0, 0⟩ +lemma CA1_1_14I2R11H_sound : CA1_1_14I2R11H.Encloses (homogeneousEntropy CA1_1_14I2R11Value) := by + exact contains_sound (homogeneous_enclosed CA1_1_14I2R11Value CA1_1_14I2R11MassTerm_sound CA1_1_14I2R11Entropy_sound) (by decide +kernel) +def CA1_1_14I2R12Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 1 14)) (fun u => (stageALaw (shape 1 1 14) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 12 a +def CA1_1_14I2R12Raw (a : PairSlot) : Ball := residualBall (below (shape 1 1 14)) A1_1_14Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 12 a +lemma CA1_1_14I2R12Raw_sound (a : PairSlot) : + (CA1_1_14I2R12Raw a).Encloses (CA1_1_14I2R12Value a) := by + exact residualBall_sound_on (below (shape 1 1 14)) A1_1_14Law (fun u => (stageALaw (shape 1 1 14) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A1_1_14Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 1 14) (show (shape 1 1 14) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 12 a +def CA1_1_14I2R12Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA1_1_14I2R12Certificates_valid : + CA1_1_14I2R12Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_1_14I2R12CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA1_1_14I2R12P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_1_14I2R12Certificates (CA1_1_14I2R12CertificateIndex a)).input +lemma CA1_1_14I2R12P_check : ∀ a : PairSlot, contains (CA1_1_14I2R12Raw a) (CA1_1_14I2R12P a) = true := by + decide +kernel +lemma CA1_1_14I2R12P_sound (a : PairSlot) : + (CA1_1_14I2R12P a).Encloses (CA1_1_14I2R12Value a) := + contains_sound (CA1_1_14I2R12Raw_sound a) (CA1_1_14I2R12P_check a) +def CA1_1_14I2R12Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_1_14I2R12Certificates (CA1_1_14I2R12CertificateIndex a)).output +lemma CA1_1_14I2R12Terms_sound (a : PairSlot) : + (CA1_1_14I2R12Terms a).Encloses (Foundation.entropyTerm (CA1_1_14I2R12Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_1_14I2R12Certificates_valid + (CA1_1_14I2R12CertificateIndex a) (CA1_1_14I2R12P_sound a) +def CA1_1_14I2R12Entropy : Ball := ⟨0, 0⟩ +lemma CA1_1_14I2R12Entropy_sound : CA1_1_14I2R12Entropy.Encloses (Foundation.finiteEntropy CA1_1_14I2R12Value) := by + exact contains_sound (entropyPair_enclosed CA1_1_14I2R12Value CA1_1_14I2R12Terms CA1_1_14I2R12Terms_sound) (by decide +kernel) +def CA1_1_14I2R12Mass : Ball := ⟨0, 0⟩ +lemma CA1_1_14I2R12Mass_sound : CA1_1_14I2R12Mass.Encloses (∑ a, CA1_1_14I2R12Value a) := by + exact contains_sound (pairSumBall_sound CA1_1_14I2R12P CA1_1_14I2R12Value CA1_1_14I2R12P_sound) (by decide +kernel) +def CA1_1_14I2R12MassTerm : Ball := .exact 0 +lemma CA1_1_14I2R12MassTerm_sound : CA1_1_14I2R12MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_1_14I2R12Value a))) := + entropyTerm_zero_ball (CA1_1_14I2R12Mass_sound) +def CA1_1_14I2R12H : Ball := ⟨0, 0⟩ +lemma CA1_1_14I2R12H_sound : CA1_1_14I2R12H.Encloses (homogeneousEntropy CA1_1_14I2R12Value) := by + exact contains_sound (homogeneous_enclosed CA1_1_14I2R12Value CA1_1_14I2R12MassTerm_sound CA1_1_14I2R12Entropy_sound) (by decide +kernel) +def CA1_1_14I2R13Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 1 14)) (fun u => (stageALaw (shape 1 1 14) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 13 a +def CA1_1_14I2R13Raw (a : PairSlot) : Ball := residualBall (below (shape 1 1 14)) A1_1_14Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 13 a +lemma CA1_1_14I2R13Raw_sound (a : PairSlot) : + (CA1_1_14I2R13Raw a).Encloses (CA1_1_14I2R13Value a) := by + exact residualBall_sound_on (below (shape 1 1 14)) A1_1_14Law (fun u => (stageALaw (shape 1 1 14) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A1_1_14Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 1 14) (show (shape 1 1 14) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 13 a +def CA1_1_14I2R13Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA1_1_14I2R13Certificates_valid : + CA1_1_14I2R13Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_1_14I2R13CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA1_1_14I2R13P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_1_14I2R13Certificates (CA1_1_14I2R13CertificateIndex a)).input +lemma CA1_1_14I2R13P_check : ∀ a : PairSlot, contains (CA1_1_14I2R13Raw a) (CA1_1_14I2R13P a) = true := by + decide +kernel +lemma CA1_1_14I2R13P_sound (a : PairSlot) : + (CA1_1_14I2R13P a).Encloses (CA1_1_14I2R13Value a) := + contains_sound (CA1_1_14I2R13Raw_sound a) (CA1_1_14I2R13P_check a) +def CA1_1_14I2R13Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_1_14I2R13Certificates (CA1_1_14I2R13CertificateIndex a)).output +lemma CA1_1_14I2R13Terms_sound (a : PairSlot) : + (CA1_1_14I2R13Terms a).Encloses (Foundation.entropyTerm (CA1_1_14I2R13Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_1_14I2R13Certificates_valid + (CA1_1_14I2R13CertificateIndex a) (CA1_1_14I2R13P_sound a) +def CA1_1_14I2R13Entropy : Ball := ⟨0, 0⟩ +lemma CA1_1_14I2R13Entropy_sound : CA1_1_14I2R13Entropy.Encloses (Foundation.finiteEntropy CA1_1_14I2R13Value) := by + exact contains_sound (entropyPair_enclosed CA1_1_14I2R13Value CA1_1_14I2R13Terms CA1_1_14I2R13Terms_sound) (by decide +kernel) +def CA1_1_14I2R13Mass : Ball := ⟨0, 0⟩ +lemma CA1_1_14I2R13Mass_sound : CA1_1_14I2R13Mass.Encloses (∑ a, CA1_1_14I2R13Value a) := by + exact contains_sound (pairSumBall_sound CA1_1_14I2R13P CA1_1_14I2R13Value CA1_1_14I2R13P_sound) (by decide +kernel) +def CA1_1_14I2R13MassTerm : Ball := .exact 0 +lemma CA1_1_14I2R13MassTerm_sound : CA1_1_14I2R13MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_1_14I2R13Value a))) := + entropyTerm_zero_ball (CA1_1_14I2R13Mass_sound) +def CA1_1_14I2R13H : Ball := ⟨0, 0⟩ +lemma CA1_1_14I2R13H_sound : CA1_1_14I2R13H.Encloses (homogeneousEntropy CA1_1_14I2R13Value) := by + exact contains_sound (homogeneous_enclosed CA1_1_14I2R13Value CA1_1_14I2R13MassTerm_sound CA1_1_14I2R13Entropy_sound) (by decide +kernel) +def CA1_1_14I2R14Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 1 14)) (fun u => (stageALaw (shape 1 1 14) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 14 a +def CA1_1_14I2R14Raw (a : PairSlot) : Ball := residualBall (below (shape 1 1 14)) A1_1_14Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 14 a +lemma CA1_1_14I2R14Raw_sound (a : PairSlot) : + (CA1_1_14I2R14Raw a).Encloses (CA1_1_14I2R14Value a) := by + exact residualBall_sound_on (below (shape 1 1 14)) A1_1_14Law (fun u => (stageALaw (shape 1 1 14) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A1_1_14Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 1 14) (show (shape 1 1 14) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 14 a +def CA1_1_14I2R14Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA1_1_14I2R14Certificates_valid : + CA1_1_14I2R14Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_1_14I2R14CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA1_1_14I2R14P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_1_14I2R14Certificates (CA1_1_14I2R14CertificateIndex a)).input +lemma CA1_1_14I2R14P_check : ∀ a : PairSlot, contains (CA1_1_14I2R14Raw a) (CA1_1_14I2R14P a) = true := by + decide +kernel +lemma CA1_1_14I2R14P_sound (a : PairSlot) : + (CA1_1_14I2R14P a).Encloses (CA1_1_14I2R14Value a) := + contains_sound (CA1_1_14I2R14Raw_sound a) (CA1_1_14I2R14P_check a) +def CA1_1_14I2R14Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_1_14I2R14Certificates (CA1_1_14I2R14CertificateIndex a)).output +lemma CA1_1_14I2R14Terms_sound (a : PairSlot) : + (CA1_1_14I2R14Terms a).Encloses (Foundation.entropyTerm (CA1_1_14I2R14Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_1_14I2R14Certificates_valid + (CA1_1_14I2R14CertificateIndex a) (CA1_1_14I2R14P_sound a) +def CA1_1_14I2R14Entropy : Ball := ⟨0, 0⟩ +lemma CA1_1_14I2R14Entropy_sound : CA1_1_14I2R14Entropy.Encloses (Foundation.finiteEntropy CA1_1_14I2R14Value) := by + exact contains_sound (entropyPair_enclosed CA1_1_14I2R14Value CA1_1_14I2R14Terms CA1_1_14I2R14Terms_sound) (by decide +kernel) +def CA1_1_14I2R14Mass : Ball := ⟨0, 0⟩ +lemma CA1_1_14I2R14Mass_sound : CA1_1_14I2R14Mass.Encloses (∑ a, CA1_1_14I2R14Value a) := by + exact contains_sound (pairSumBall_sound CA1_1_14I2R14P CA1_1_14I2R14Value CA1_1_14I2R14P_sound) (by decide +kernel) +def CA1_1_14I2R14MassTerm : Ball := .exact 0 +lemma CA1_1_14I2R14MassTerm_sound : CA1_1_14I2R14MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_1_14I2R14Value a))) := + entropyTerm_zero_ball (CA1_1_14I2R14Mass_sound) +def CA1_1_14I2R14H : Ball := ⟨0, 0⟩ +lemma CA1_1_14I2R14H_sound : CA1_1_14I2R14H.Encloses (homogeneousEntropy CA1_1_14I2R14Value) := by + exact contains_sound (homogeneous_enclosed CA1_1_14I2R14Value CA1_1_14I2R14MassTerm_sound CA1_1_14I2R14Entropy_sound) (by decide +kernel) +def CA1_1_14I2R15Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 1 14)) (fun u => (stageALaw (shape 1 1 14) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 15 a +def CA1_1_14I2R15Raw (a : PairSlot) : Ball := residualBall (below (shape 1 1 14)) A1_1_14Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 15 a +lemma CA1_1_14I2R15Raw_sound (a : PairSlot) : + (CA1_1_14I2R15Raw a).Encloses (CA1_1_14I2R15Value a) := by + exact residualBall_sound_on (below (shape 1 1 14)) A1_1_14Law (fun u => (stageALaw (shape 1 1 14) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A1_1_14Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 1 14) (show (shape 1 1 14) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 15 a +def CA1_1_14I2R15Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA1_1_14I2R15Certificates_valid : + CA1_1_14I2R15Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_1_14I2R15CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA1_1_14I2R15P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_1_14I2R15Certificates (CA1_1_14I2R15CertificateIndex a)).input +lemma CA1_1_14I2R15P_check : ∀ a : PairSlot, contains (CA1_1_14I2R15Raw a) (CA1_1_14I2R15P a) = true := by + decide +kernel +lemma CA1_1_14I2R15P_sound (a : PairSlot) : + (CA1_1_14I2R15P a).Encloses (CA1_1_14I2R15Value a) := + contains_sound (CA1_1_14I2R15Raw_sound a) (CA1_1_14I2R15P_check a) +def CA1_1_14I2R15Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_1_14I2R15Certificates (CA1_1_14I2R15CertificateIndex a)).output +lemma CA1_1_14I2R15Terms_sound (a : PairSlot) : + (CA1_1_14I2R15Terms a).Encloses (Foundation.entropyTerm (CA1_1_14I2R15Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_1_14I2R15Certificates_valid + (CA1_1_14I2R15CertificateIndex a) (CA1_1_14I2R15P_sound a) +def CA1_1_14I2R15Entropy : Ball := ⟨0, 0⟩ +lemma CA1_1_14I2R15Entropy_sound : CA1_1_14I2R15Entropy.Encloses (Foundation.finiteEntropy CA1_1_14I2R15Value) := by + exact contains_sound (entropyPair_enclosed CA1_1_14I2R15Value CA1_1_14I2R15Terms CA1_1_14I2R15Terms_sound) (by decide +kernel) +def CA1_1_14I2R15Mass : Ball := ⟨0, 0⟩ +lemma CA1_1_14I2R15Mass_sound : CA1_1_14I2R15Mass.Encloses (∑ a, CA1_1_14I2R15Value a) := by + exact contains_sound (pairSumBall_sound CA1_1_14I2R15P CA1_1_14I2R15Value CA1_1_14I2R15P_sound) (by decide +kernel) +def CA1_1_14I2R15MassTerm : Ball := .exact 0 +lemma CA1_1_14I2R15MassTerm_sound : CA1_1_14I2R15MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_1_14I2R15Value a))) := + entropyTerm_zero_ball (CA1_1_14I2R15Mass_sound) +def CA1_1_14I2R15H : Ball := ⟨0, 0⟩ +lemma CA1_1_14I2R15H_sound : CA1_1_14I2R15H.Encloses (homogeneousEntropy CA1_1_14I2R15Value) := by + exact contains_sound (homogeneous_enclosed CA1_1_14I2R15Value CA1_1_14I2R15MassTerm_sound CA1_1_14I2R15Entropy_sound) (by decide +kernel) +def CA1_1_14I2R16Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 1 14)) (fun u => (stageALaw (shape 1 1 14) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 16 a +def CA1_1_14I2R16Raw (a : PairSlot) : Ball := residualBall (below (shape 1 1 14)) A1_1_14Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 16 a +lemma CA1_1_14I2R16Raw_sound (a : PairSlot) : + (CA1_1_14I2R16Raw a).Encloses (CA1_1_14I2R16Value a) := by + exact residualBall_sound_on (below (shape 1 1 14)) A1_1_14Law (fun u => (stageALaw (shape 1 1 14) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A1_1_14Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 1 14) (show (shape 1 1 14) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 16 a +def CA1_1_14I2R16Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA1_1_14I2R16Certificates_valid : + CA1_1_14I2R16Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_1_14I2R16CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA1_1_14I2R16P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_1_14I2R16Certificates (CA1_1_14I2R16CertificateIndex a)).input +lemma CA1_1_14I2R16P_check : ∀ a : PairSlot, contains (CA1_1_14I2R16Raw a) (CA1_1_14I2R16P a) = true := by + decide +kernel +lemma CA1_1_14I2R16P_sound (a : PairSlot) : + (CA1_1_14I2R16P a).Encloses (CA1_1_14I2R16Value a) := + contains_sound (CA1_1_14I2R16Raw_sound a) (CA1_1_14I2R16P_check a) +def CA1_1_14I2R16Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_1_14I2R16Certificates (CA1_1_14I2R16CertificateIndex a)).output +lemma CA1_1_14I2R16Terms_sound (a : PairSlot) : + (CA1_1_14I2R16Terms a).Encloses (Foundation.entropyTerm (CA1_1_14I2R16Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_1_14I2R16Certificates_valid + (CA1_1_14I2R16CertificateIndex a) (CA1_1_14I2R16P_sound a) +def CA1_1_14I2R16Entropy : Ball := ⟨0, 0⟩ +lemma CA1_1_14I2R16Entropy_sound : CA1_1_14I2R16Entropy.Encloses (Foundation.finiteEntropy CA1_1_14I2R16Value) := by + exact contains_sound (entropyPair_enclosed CA1_1_14I2R16Value CA1_1_14I2R16Terms CA1_1_14I2R16Terms_sound) (by decide +kernel) +def CA1_1_14I2R16Mass : Ball := ⟨0, 0⟩ +lemma CA1_1_14I2R16Mass_sound : CA1_1_14I2R16Mass.Encloses (∑ a, CA1_1_14I2R16Value a) := by + exact contains_sound (pairSumBall_sound CA1_1_14I2R16P CA1_1_14I2R16Value CA1_1_14I2R16P_sound) (by decide +kernel) +def CA1_1_14I2R16MassTerm : Ball := .exact 0 +lemma CA1_1_14I2R16MassTerm_sound : CA1_1_14I2R16MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_1_14I2R16Value a))) := + entropyTerm_zero_ball (CA1_1_14I2R16Mass_sound) +def CA1_1_14I2R16H : Ball := ⟨0, 0⟩ +lemma CA1_1_14I2R16H_sound : CA1_1_14I2R16H.Encloses (homogeneousEntropy CA1_1_14I2R16Value) := by + exact contains_sound (homogeneous_enclosed CA1_1_14I2R16Value CA1_1_14I2R16MassTerm_sound CA1_1_14I2R16Entropy_sound) (by decide +kernel) +def CA1_1_14I2ResidualEntropies (a : Fin 17) : Ball := + match a.val with + | 0 => CA1_1_14I2R0H + | 1 => CA1_1_14I2R1H + | 2 => CA1_1_14I2R2H + | 3 => CA1_1_14I2R3H + | 4 => CA1_1_14I2R4H + | 5 => CA1_1_14I2R5H + | 6 => CA1_1_14I2R6H + | 7 => CA1_1_14I2R7H + | 8 => CA1_1_14I2R8H + | 9 => CA1_1_14I2R9H + | 10 => CA1_1_14I2R10H + | 11 => CA1_1_14I2R11H + | 12 => CA1_1_14I2R12H + | 13 => CA1_1_14I2R13H + | 14 => CA1_1_14I2R14H + | 15 => CA1_1_14I2R15H + | 16 => CA1_1_14I2R16H + | _ => (.exact 0) +lemma CA1_1_14I2ResidualEntropies_sound (k : Fin 17) : + (CA1_1_14I2ResidualEntropies k).Encloses (homogeneousEntropy + (residualLaw (below (shape 1 1 14)) (fun u => (stageALaw (shape 1 1 14) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) k)) := by + fin_cases k + · exact CA1_1_14I2R0H_sound + · exact CA1_1_14I2R1H_sound + · exact CA1_1_14I2R2H_sound + · exact CA1_1_14I2R3H_sound + · exact CA1_1_14I2R4H_sound + · exact CA1_1_14I2R5H_sound + · exact CA1_1_14I2R6H_sound + · exact CA1_1_14I2R7H_sound + · exact CA1_1_14I2R8H_sound + · exact CA1_1_14I2R9H_sound + · exact CA1_1_14I2R10H_sound + · exact CA1_1_14I2R11H_sound + · exact CA1_1_14I2R12H_sound + · exact CA1_1_14I2R13H_sound + · exact CA1_1_14I2R14H_sound + · exact CA1_1_14I2R15H_sound + · exact CA1_1_14I2R16H_sound +def CA1_1_14I2Singles (s : Shape) : Ball := + match s 0, s 1, s 2 with + | 0, 0, 8 => Z0_0_8H2H + | 0, 1, 7 => Z0_1_7H2H + | 1, 0, 7 => Z1_0_7H2H + | _, _, _ => (.exact 0) +lemma CA1_1_14I2Singles_sound (u : Shape) (hu : u ∈ below (shape 1 1 14)) + (hd : designated (Equiv.refl (Fin 3)) 2 u) : + (CA1_1_14I2Singles u).Encloses (homogeneousEntropy ((fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) u)) := by + rw [A1_1_14_below] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl + · exact Z0_0_8H2H_sound + · exact Z0_1_7H2H_sound + · exact Z1_0_7H2H_sound + · exact (show ¬ designated (Equiv.refl (Fin 3)) 2 (shape 1 1 6) by decide +kernel) hd |>.elim +def CA1_1_14I2Singleton : Ball := ⟨(1597434829792645590838306169477 / 4000000000000000000000000000000), (24401021369 / 100000000000000000000000000000000)⟩ +lemma CA1_1_14I2Singleton_sound : CA1_1_14I2Singleton.Encloses + (singletonEntropy (below (shape 1 1 14)) (fun u => (stageALaw (shape 1 1 14) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ))) := by + exact contains_sound (singletonBall_sound (below (shape 1 1 14)) A1_1_14Law (fun u => (stageALaw (shape 1 1 14) u : ℝ)) (Equiv.refl (Fin 3)) 2 + CA1_1_14I2Singles (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A1_1_14Law_sound u) CA1_1_14I2Singles_sound) (by decide +kernel) +def CA1_1_14I2Group : Ball := ⟨(10545521109225486967368806088991 / 25000000000000000000000000000000), (30403167373 / 50000000000000000000000000000000)⟩ +lemma CA1_1_14I2Group_sound : CA1_1_14I2Group.Encloses + (groupedEntropy (below (shape 1 1 14)) (fun u => (stageALaw (shape 1 1 14) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ))) := by + exact contains_sound (Ball.add_sound CA1_1_14I2Singleton_sound + (finSumBall_sound 17 CA1_1_14I2ResidualEntropies _ CA1_1_14I2ResidualEntropies_sound)) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CA1_1_14I2H : Ball := ⟨(24382297112894748527106388759083 / 25000000000000000000000000000000), (228499910573 / 100000000000000000000000000000000)⟩ +lemma CA1_1_14I2_sound : CA1_1_14I2H.Encloses (stageACapacity (shape 1 1 14) 2) := by + have hb := contains_sound (Ball.add_sound CA1_1_14I2PairH_sound + (Ball.neg_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) CA1_1_14I2Group_sound))) + (show contains (.add CA1_1_14I2PairH (.neg (.mul (.exact 2) CA1_1_14I2Group))) CA1_1_14I2H = true by decide +kernel) + simp only [stageACapacity, nativeCapacity, + show (2 : Fin 3) ≠ 0 by decide, ite_false, sub_eq_add_neg] + exact hb + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA1_2_13I0.lean b/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA1_2_13I0.lean new file mode 100644 index 0000000000000000000000000000000000000000..b8b0bf2aa1c2521b3d630766cb7dda5c51276502 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA1_2_13I0.lean @@ -0,0 +1,72 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Certificates.SplitB2_3_3 + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CA1_2_13I0Value (a : Fin 17) : ℝ := marginal (below (shape 1 2 13)) (fun u => (stageALaw (shape 1 2 13) u : ℝ)) ((Equiv.refl (Fin 3)) 0) a +def CA1_2_13I0Raw (a : Fin 17) : Ball := marginalBall (below (shape 1 2 13)) A1_2_13Law ((Equiv.refl (Fin 3)) 0) a +lemma CA1_2_13I0Raw_sound (a : Fin 17) : + (CA1_2_13I0Raw a).Encloses (CA1_2_13I0Value a) := by + exact marginalBall_sound (below (shape 1 2 13)) A1_2_13Law (fun u => (stageALaw (shape 1 2 13) u : ℝ)) (fun u _ => A1_2_13Law_sound u) ((Equiv.refl (Fin 3)) 0) a +def CA1_2_13I0Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(1 / 2), (77 / 100000000000000000000000000000000)⟩ ⟨(6931471805599453094172319305033 / 20000000000000000000000000000000), (21175823813 / 100000000000000000000000000000000)⟩ ⟨(-6931471805599453094172319305033 / 10000000000000000000000000000000), (42351647519 / 100000000000000000000000000000000)⟩ ⟨-1, 1, 1⟩] +lemma CA1_2_13I0Certificates_valid : + CA1_2_13I0Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_2_13I0CertificateIndex (a : Fin 17) : ℕ := + match a.val with + | 0 => 1 + | 1 => 1 + | _ => 0 +def CA1_2_13I0P (a : Fin 17) : Ball := + (CompactCertificate.entropyLookup CA1_2_13I0Certificates (CA1_2_13I0CertificateIndex a)).input +lemma CA1_2_13I0P_check : ∀ a : Fin 17, contains (CA1_2_13I0Raw a) (CA1_2_13I0P a) = true := by + decide +kernel +lemma CA1_2_13I0P_sound (a : Fin 17) : + (CA1_2_13I0P a).Encloses (CA1_2_13I0Value a) := + contains_sound (CA1_2_13I0Raw_sound a) (CA1_2_13I0P_check a) +def CA1_2_13I0Terms (a : Fin 17) : Ball := + (CompactCertificate.entropyLookup CA1_2_13I0Certificates (CA1_2_13I0CertificateIndex a)).output +lemma CA1_2_13I0Terms_sound (a : Fin 17) : + (CA1_2_13I0Terms a).Encloses (Foundation.entropyTerm (CA1_2_13I0Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_2_13I0Certificates_valid + (CA1_2_13I0CertificateIndex a) (CA1_2_13I0P_sound a) +def CA1_2_13I0Entropy : Ball := ⟨(6931471805599453094172319305033 / 10000000000000000000000000000000), (21175823813 / 50000000000000000000000000000000)⟩ +lemma CA1_2_13I0Entropy_sound : CA1_2_13I0Entropy.Encloses (Foundation.finiteEntropy CA1_2_13I0Value) := by + exact contains_sound (entropyFin_enclosed 17 CA1_2_13I0Value CA1_2_13I0Terms CA1_2_13I0Terms_sound) (by decide +kernel) +def CA1_2_13I0Mass : Ball := ⟨1, (77 / 50000000000000000000000000000000)⟩ +lemma CA1_2_13I0Mass_sound : CA1_2_13I0Mass.Encloses (∑ a, CA1_2_13I0Value a) := by + exact contains_sound (finSumBall_sound 17 CA1_2_13I0P CA1_2_13I0Value CA1_2_13I0P_sound) (by decide +kernel) +def CA1_2_13I0MassTermLogWitness : LogWitness := ⟨0, 1, 1⟩ +def CA1_2_13I0MassTermLog : Ball := ⟨0, (5293955959 / 25000000000000000000000000000000)⟩ +lemma CA1_2_13I0MassTermLog_sound : CA1_2_13I0MassTermLog.Encloses (Real.log ((∑ a, CA1_2_13I0Value a))) := by + exact checkLog_sound logTwoBall_sound (CA1_2_13I0Mass_sound) (w := CA1_2_13I0MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA1_2_13I0MassTerm : Ball := ⟨0, (21175823837 / 100000000000000000000000000000000)⟩ +lemma CA1_2_13I0MassTerm_sound : CA1_2_13I0MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_2_13I0Value a))) := by + exact contains_sound (entropyTerm_ball (CA1_2_13I0Mass_sound) CA1_2_13I0MassTermLog_sound) (by decide +kernel) +def CA1_2_13I0H : Ball := ⟨(6931471805599453094172319305033 / 10000000000000000000000000000000), (63527471463 / 100000000000000000000000000000000)⟩ +lemma CA1_2_13I0H_sound : CA1_2_13I0H.Encloses (homogeneousEntropy CA1_2_13I0Value) := by + exact contains_sound (homogeneous_enclosed CA1_2_13I0Value CA1_2_13I0MassTerm_sound CA1_2_13I0Entropy_sound) (by decide +kernel) +lemma CA1_2_13I0_sound : CA1_2_13I0H.Encloses (stageACapacity (shape 1 2 13) 0) := by + exact CA1_2_13I0H_sound + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA1_2_13I1.lean b/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA1_2_13I1.lean new file mode 100644 index 0000000000000000000000000000000000000000..d574a82b5217028935649f7cda79e60d7e727286 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA1_2_13I1.lean @@ -0,0 +1,936 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Certificates.SupportedContraction + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CA1_2_13I1PairValue (a : PairSlot × PairSlot) : ℝ := pairLaw (below (shape 1 2 13)) (shape 1 2 13) (fun u => (stageALaw (shape 1 2 13) u : ℝ)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) a +def CA1_2_13I1PairRaw (a : PairSlot × PairSlot) : Ball := stageAPairBall (shape 1 2 13) A1_2_13Law 1 a +lemma CA1_2_13I1PairRaw_sound (a : PairSlot × PairSlot) : + (CA1_2_13I1PairRaw a).Encloses (CA1_2_13I1PairValue a) := by + exact stageAPairBall_sound (shape 1 2 13) (by decide +kernel) A1_2_13Law (fun u => (stageALaw (shape 1 2 13) u : ℝ)) (fun u _ => A1_2_13Law_sound u) 1 a +def CA1_2_13I1PairCertificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(510415122544695217681462222771 / 10000000000000000000000000000000), (11 / 50000000000000000000000000000000)⟩ ⟨(7592721018162129621059103906471 / 50000000000000000000000000000000), (810634559 / 12500000000000000000000000000000)⟩ ⟨(-297511601157438760339021860675673 / 100000000000000000000000000000000), (127054942529 / 100000000000000000000000000000000)⟩ ⟨-5, 510415122544695217681462222771, 312500000000000000000000000000⟩, + .log ⟨(427003908687794775861357943063 / 100000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ ⟨(465957963508295875989960509367 / 20000000000000000000000000000000), (813794373 / 100000000000000000000000000000000)⟩ ⟨(-27280661489739575041697282179381 / 5000000000000000000000000000000), (190582413849 / 100000000000000000000000000000000)⟩ ⟨-8, 427003908687794775861357943063, 390625000000000000000000000000⟩, + .log ⟨(15810100296743071129626219885259 / 100000000000000000000000000000000), (9 / 20000000000000000000000000000000)⟩ ⟨(29162065027704732871389591738293 / 100000000000000000000000000000000), (669583799 / 5000000000000000000000000000000)⟩ ⟨(-92226059545340794549134603642549 / 50000000000000000000000000000000), (10587911877 / 12500000000000000000000000000000)⟩ ⟨-3, 15810100296743071129626219885259, 12500000000000000000000000000000⟩, + .log ⟨(11563794717493717482510909886597 / 100000000000000000000000000000000), (11 / 100000000000000000000000000000000)⟩ ⟨(24946471586450025296435508185089 / 100000000000000000000000000000000), (12243643937 / 100000000000000000000000000000000)⟩ ⟨(-43145822277026388272336325811803 / 20000000000000000000000000000000), (10587911851 / 10000000000000000000000000000000)⟩ ⟨-4, 11563794717493717482510909886597, 6250000000000000000000000000000⟩] +lemma CA1_2_13I1PairCertificates_valid : + CA1_2_13I1PairCertificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_2_13I1PairCertificateIndex (a : PairSlot × PairSlot) : ℕ := + match a.1.1.val, a.1.2.val, a.2.1.val, a.2.2.val with + | 0, 0, 0, 2 => 1 + | 0, 0, 0, 3 => 2 + | 0, 0, 1, 1 => 3 + | 0, 0, 2, 0 => 1 + | 0, 0, 3, 0 => 2 + | 1, 0, 0, 1 => 4 + | 1, 0, 1, 0 => 4 + | 0, 1, 0, 1 => 4 + | 0, 1, 1, 0 => 4 + | 2, 0, 0, 0 => 1 + | 3, 0, 0, 0 => 2 + | 1, 1, 0, 0 => 3 + | 0, 2, 0, 0 => 1 + | 0, 3, 0, 0 => 2 + | _, _, _, _ => 0 +def CA1_2_13I1PairP (a : PairSlot × PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_2_13I1PairCertificates (CA1_2_13I1PairCertificateIndex a)).input +lemma CA1_2_13I1PairP_check_0_0 : ∀ k l : Fin 6, contains (CA1_2_13I1PairRaw ((0,0),(k,l))) (CA1_2_13I1PairP ((0,0),(k,l))) = true := by + decide +kernel +lemma CA1_2_13I1PairP_check_0_1 : ∀ k l : Fin 6, contains (CA1_2_13I1PairRaw ((0,1),(k,l))) (CA1_2_13I1PairP ((0,1),(k,l))) = true := by + decide +kernel +lemma CA1_2_13I1PairP_check_0_2 : ∀ k l : Fin 6, contains (CA1_2_13I1PairRaw ((0,2),(k,l))) (CA1_2_13I1PairP ((0,2),(k,l))) = true := by + decide +kernel +lemma CA1_2_13I1PairP_check_0_3 : ∀ k l : Fin 6, contains (CA1_2_13I1PairRaw ((0,3),(k,l))) (CA1_2_13I1PairP ((0,3),(k,l))) = true := by + decide +kernel +lemma CA1_2_13I1PairP_check_0_4 : ∀ k l : Fin 6, contains (CA1_2_13I1PairRaw ((0,4),(k,l))) (CA1_2_13I1PairP ((0,4),(k,l))) = true := by + decide +kernel +lemma CA1_2_13I1PairP_check_0_5 : ∀ k l : Fin 6, contains (CA1_2_13I1PairRaw ((0,5),(k,l))) (CA1_2_13I1PairP ((0,5),(k,l))) = true := by + decide +kernel +lemma CA1_2_13I1PairP_check_1_0 : ∀ k l : Fin 6, contains (CA1_2_13I1PairRaw ((1,0),(k,l))) (CA1_2_13I1PairP ((1,0),(k,l))) = true := by + decide +kernel +lemma CA1_2_13I1PairP_check_1_1 : ∀ k l : Fin 6, contains (CA1_2_13I1PairRaw ((1,1),(k,l))) (CA1_2_13I1PairP ((1,1),(k,l))) = true := by + decide +kernel +lemma CA1_2_13I1PairP_check_1_2 : ∀ k l : Fin 6, contains (CA1_2_13I1PairRaw ((1,2),(k,l))) (CA1_2_13I1PairP ((1,2),(k,l))) = true := by + decide +kernel +lemma CA1_2_13I1PairP_check_1_3 : ∀ k l : Fin 6, contains (CA1_2_13I1PairRaw ((1,3),(k,l))) (CA1_2_13I1PairP ((1,3),(k,l))) = true := by + decide +kernel +lemma CA1_2_13I1PairP_check_1_4 : ∀ k l : Fin 6, contains (CA1_2_13I1PairRaw ((1,4),(k,l))) (CA1_2_13I1PairP ((1,4),(k,l))) = true := by + decide +kernel +lemma CA1_2_13I1PairP_check_1_5 : ∀ k l : Fin 6, contains (CA1_2_13I1PairRaw ((1,5),(k,l))) (CA1_2_13I1PairP ((1,5),(k,l))) = true := by + decide +kernel +lemma CA1_2_13I1PairP_check_2_0 : ∀ k l : Fin 6, contains (CA1_2_13I1PairRaw ((2,0),(k,l))) (CA1_2_13I1PairP ((2,0),(k,l))) = true := by + decide +kernel +lemma CA1_2_13I1PairP_check_2_1 : ∀ k l : Fin 6, contains (CA1_2_13I1PairRaw ((2,1),(k,l))) (CA1_2_13I1PairP ((2,1),(k,l))) = true := by + decide +kernel +lemma CA1_2_13I1PairP_check_2_2 : ∀ k l : Fin 6, contains (CA1_2_13I1PairRaw ((2,2),(k,l))) (CA1_2_13I1PairP ((2,2),(k,l))) = true := by + decide +kernel +lemma CA1_2_13I1PairP_check_2_3 : ∀ k l : Fin 6, contains (CA1_2_13I1PairRaw ((2,3),(k,l))) (CA1_2_13I1PairP ((2,3),(k,l))) = true := by + decide +kernel +lemma CA1_2_13I1PairP_check_2_4 : ∀ k l : Fin 6, contains (CA1_2_13I1PairRaw ((2,4),(k,l))) (CA1_2_13I1PairP ((2,4),(k,l))) = true := by + decide +kernel +lemma CA1_2_13I1PairP_check_2_5 : ∀ k l : Fin 6, contains (CA1_2_13I1PairRaw ((2,5),(k,l))) (CA1_2_13I1PairP ((2,5),(k,l))) = true := by + decide +kernel +lemma CA1_2_13I1PairP_check_3_0 : ∀ k l : Fin 6, contains (CA1_2_13I1PairRaw ((3,0),(k,l))) (CA1_2_13I1PairP ((3,0),(k,l))) = true := by + decide +kernel +lemma CA1_2_13I1PairP_check_3_1 : ∀ k l : Fin 6, contains (CA1_2_13I1PairRaw ((3,1),(k,l))) (CA1_2_13I1PairP ((3,1),(k,l))) = true := by + decide +kernel +lemma CA1_2_13I1PairP_check_3_2 : ∀ k l : Fin 6, contains (CA1_2_13I1PairRaw ((3,2),(k,l))) (CA1_2_13I1PairP ((3,2),(k,l))) = true := by + decide +kernel +lemma CA1_2_13I1PairP_check_3_3 : ∀ k l : Fin 6, contains (CA1_2_13I1PairRaw ((3,3),(k,l))) (CA1_2_13I1PairP ((3,3),(k,l))) = true := by + decide +kernel +lemma CA1_2_13I1PairP_check_3_4 : ∀ k l : Fin 6, contains (CA1_2_13I1PairRaw ((3,4),(k,l))) (CA1_2_13I1PairP ((3,4),(k,l))) = true := by + decide +kernel +lemma CA1_2_13I1PairP_check_3_5 : ∀ k l : Fin 6, contains (CA1_2_13I1PairRaw ((3,5),(k,l))) (CA1_2_13I1PairP ((3,5),(k,l))) = true := by + decide +kernel +lemma CA1_2_13I1PairP_check_4_0 : ∀ k l : Fin 6, contains (CA1_2_13I1PairRaw ((4,0),(k,l))) (CA1_2_13I1PairP ((4,0),(k,l))) = true := by + decide +kernel +lemma CA1_2_13I1PairP_check_4_1 : ∀ k l : Fin 6, contains (CA1_2_13I1PairRaw ((4,1),(k,l))) (CA1_2_13I1PairP ((4,1),(k,l))) = true := by + decide +kernel +lemma CA1_2_13I1PairP_check_4_2 : ∀ k l : Fin 6, contains (CA1_2_13I1PairRaw ((4,2),(k,l))) (CA1_2_13I1PairP ((4,2),(k,l))) = true := by + decide +kernel +lemma CA1_2_13I1PairP_check_4_3 : ∀ k l : Fin 6, contains (CA1_2_13I1PairRaw ((4,3),(k,l))) (CA1_2_13I1PairP ((4,3),(k,l))) = true := by + decide +kernel +lemma CA1_2_13I1PairP_check_4_4 : ∀ k l : Fin 6, contains (CA1_2_13I1PairRaw ((4,4),(k,l))) (CA1_2_13I1PairP ((4,4),(k,l))) = true := by + decide +kernel +lemma CA1_2_13I1PairP_check_4_5 : ∀ k l : Fin 6, contains (CA1_2_13I1PairRaw ((4,5),(k,l))) (CA1_2_13I1PairP ((4,5),(k,l))) = true := by + decide +kernel +lemma CA1_2_13I1PairP_check_5_0 : ∀ k l : Fin 6, contains (CA1_2_13I1PairRaw ((5,0),(k,l))) (CA1_2_13I1PairP ((5,0),(k,l))) = true := by + decide +kernel +lemma CA1_2_13I1PairP_check_5_1 : ∀ k l : Fin 6, contains (CA1_2_13I1PairRaw ((5,1),(k,l))) (CA1_2_13I1PairP ((5,1),(k,l))) = true := by + decide +kernel +lemma CA1_2_13I1PairP_check_5_2 : ∀ k l : Fin 6, contains (CA1_2_13I1PairRaw ((5,2),(k,l))) (CA1_2_13I1PairP ((5,2),(k,l))) = true := by + decide +kernel +lemma CA1_2_13I1PairP_check_5_3 : ∀ k l : Fin 6, contains (CA1_2_13I1PairRaw ((5,3),(k,l))) (CA1_2_13I1PairP ((5,3),(k,l))) = true := by + decide +kernel +lemma CA1_2_13I1PairP_check_5_4 : ∀ k l : Fin 6, contains (CA1_2_13I1PairRaw ((5,4),(k,l))) (CA1_2_13I1PairP ((5,4),(k,l))) = true := by + decide +kernel +lemma CA1_2_13I1PairP_check_5_5 : ∀ k l : Fin 6, contains (CA1_2_13I1PairRaw ((5,5),(k,l))) (CA1_2_13I1PairP ((5,5),(k,l))) = true := by + decide +kernel +lemma CA1_2_13I1PairP_check (a : PairSlot × PairSlot) : contains (CA1_2_13I1PairRaw a) (CA1_2_13I1PairP a) = true := by + rcases a with ⟨⟨i,j⟩,⟨k,l⟩⟩ + revert j i + apply forall_fin6 + · exact forall_fin6 (CA1_2_13I1PairP_check_0_0 k l) (CA1_2_13I1PairP_check_0_1 k l) (CA1_2_13I1PairP_check_0_2 k l) (CA1_2_13I1PairP_check_0_3 k l) (CA1_2_13I1PairP_check_0_4 k l) (CA1_2_13I1PairP_check_0_5 k l) + · exact forall_fin6 (CA1_2_13I1PairP_check_1_0 k l) (CA1_2_13I1PairP_check_1_1 k l) (CA1_2_13I1PairP_check_1_2 k l) (CA1_2_13I1PairP_check_1_3 k l) (CA1_2_13I1PairP_check_1_4 k l) (CA1_2_13I1PairP_check_1_5 k l) + · exact forall_fin6 (CA1_2_13I1PairP_check_2_0 k l) (CA1_2_13I1PairP_check_2_1 k l) (CA1_2_13I1PairP_check_2_2 k l) (CA1_2_13I1PairP_check_2_3 k l) (CA1_2_13I1PairP_check_2_4 k l) (CA1_2_13I1PairP_check_2_5 k l) + · exact forall_fin6 (CA1_2_13I1PairP_check_3_0 k l) (CA1_2_13I1PairP_check_3_1 k l) (CA1_2_13I1PairP_check_3_2 k l) (CA1_2_13I1PairP_check_3_3 k l) (CA1_2_13I1PairP_check_3_4 k l) (CA1_2_13I1PairP_check_3_5 k l) + · exact forall_fin6 (CA1_2_13I1PairP_check_4_0 k l) (CA1_2_13I1PairP_check_4_1 k l) (CA1_2_13I1PairP_check_4_2 k l) (CA1_2_13I1PairP_check_4_3 k l) (CA1_2_13I1PairP_check_4_4 k l) (CA1_2_13I1PairP_check_4_5 k l) + · exact forall_fin6 (CA1_2_13I1PairP_check_5_0 k l) (CA1_2_13I1PairP_check_5_1 k l) (CA1_2_13I1PairP_check_5_2 k l) (CA1_2_13I1PairP_check_5_3 k l) (CA1_2_13I1PairP_check_5_4 k l) (CA1_2_13I1PairP_check_5_5 k l) +lemma CA1_2_13I1PairP_sound (a : PairSlot × PairSlot) : + (CA1_2_13I1PairP a).Encloses (CA1_2_13I1PairValue a) := + contains_sound (CA1_2_13I1PairRaw_sound a) (CA1_2_13I1PairP_check a) +def CA1_2_13I1PairTerms (a : PairSlot × PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_2_13I1PairCertificates (CA1_2_13I1PairCertificateIndex a)).output +lemma CA1_2_13I1PairTerms_sound (a : PairSlot × PairSlot) : + (CA1_2_13I1PairTerms a).Encloses (Foundation.entropyTerm (CA1_2_13I1PairValue a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_2_13I1PairCertificates_valid + (CA1_2_13I1PairCertificateIndex a) (CA1_2_13I1PairP_sound a) +def CA1_2_13I1PairEntropy : Ball := ⟨(4563418876333450428335865153121 / 2000000000000000000000000000000), (6559588193 / 6250000000000000000000000000000)⟩ +lemma CA1_2_13I1PairEntropy_sound : CA1_2_13I1PairEntropy.Encloses (Foundation.finiteEntropy CA1_2_13I1PairValue) := by + exact contains_sound (entropyDoublePair_enclosed CA1_2_13I1PairValue CA1_2_13I1PairTerms CA1_2_13I1PairTerms_sound) (by decide +kernel) +def CA1_2_13I1PairMass : Ball := ⟨(49999999999999999999999999999999 / 50000000000000000000000000000000), (117 / 50000000000000000000000000000000)⟩ +lemma CA1_2_13I1PairMass_sound : CA1_2_13I1PairMass.Encloses (∑ a, CA1_2_13I1PairValue a) := by + exact contains_sound (doublePairSumBall_sound CA1_2_13I1PairP CA1_2_13I1PairValue CA1_2_13I1PairP_sound) (by decide +kernel) +def CA1_2_13I1PairMassTermLogWitness : LogWitness := ⟨-1, 49999999999999999999999999999999, 25000000000000000000000000000000⟩ +def CA1_2_13I1PairMassTermLog : Ball := ⟨(-1 / 100000000000000000000000000000000), (105879119 / 250000000000000000000000000000)⟩ +lemma CA1_2_13I1PairMassTermLog_sound : CA1_2_13I1PairMassTermLog.Encloses (Real.log ((∑ a, CA1_2_13I1PairValue a))) := by + exact checkLog_sound logTwoBall_sound (CA1_2_13I1PairMass_sound) (w := CA1_2_13I1PairMassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA1_2_13I1PairMassTerm : Ball := ⟨(1 / 100000000000000000000000000000000), (42351647601 / 100000000000000000000000000000000)⟩ +lemma CA1_2_13I1PairMassTerm_sound : CA1_2_13I1PairMassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_2_13I1PairValue a))) := by + exact contains_sound (entropyTerm_ball (CA1_2_13I1PairMass_sound) CA1_2_13I1PairMassTermLog_sound) (by decide +kernel) +def CA1_2_13I1PairH : Ball := ⟨(228170943816672521416793257656049 / 100000000000000000000000000000000), (147305058689 / 100000000000000000000000000000000)⟩ +lemma CA1_2_13I1PairH_sound : CA1_2_13I1PairH.Encloses (homogeneousEntropy CA1_2_13I1PairValue) := by + exact contains_sound (homogeneous_enclosed CA1_2_13I1PairValue CA1_2_13I1PairMassTerm_sound CA1_2_13I1PairEntropy_sound) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CA1_2_13I1R0Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 2 13)) (fun u => (stageALaw (shape 1 2 13) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 0 a +def CA1_2_13I1R0Raw (a : PairSlot) : Ball := residualBall (below (shape 1 2 13)) A1_2_13Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 0 a +lemma CA1_2_13I1R0Raw_sound (a : PairSlot) : + (CA1_2_13I1R0Raw a).Encloses (CA1_2_13I1R0Value a) := by + exact residualBall_sound_on (below (shape 1 2 13)) A1_2_13Law (fun u => (stageALaw (shape 1 2 13) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A1_2_13Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 2 13) (show (shape 1 2 13) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 0 a +def CA1_2_13I1R0Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(13436205282506282517489090113403 / 50000000000000000000000000000000), (59 / 100000000000000000000000000000000)⟩ ⟨(7062446007182092553122167611079 / 20000000000000000000000000000000), (17071362979 / 100000000000000000000000000000000)⟩ ⟨(-32851751381290671558890368327317 / 25000000000000000000000000000000), (15881867817 / 25000000000000000000000000000000)⟩ ⟨-2, 13436205282506282517489090113403, 12500000000000000000000000000000⟩] +lemma CA1_2_13I1R0Certificates_valid : + CA1_2_13I1R0Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_2_13I1R0CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 0, 0 => 1 + | _, _ => 0 +def CA1_2_13I1R0P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_2_13I1R0Certificates (CA1_2_13I1R0CertificateIndex a)).input +lemma CA1_2_13I1R0P_check : ∀ a : PairSlot, contains (CA1_2_13I1R0Raw a) (CA1_2_13I1R0P a) = true := by + decide +kernel +lemma CA1_2_13I1R0P_sound (a : PairSlot) : + (CA1_2_13I1R0P a).Encloses (CA1_2_13I1R0Value a) := + contains_sound (CA1_2_13I1R0Raw_sound a) (CA1_2_13I1R0P_check a) +def CA1_2_13I1R0Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_2_13I1R0Certificates (CA1_2_13I1R0CertificateIndex a)).output +lemma CA1_2_13I1R0Terms_sound (a : PairSlot) : + (CA1_2_13I1R0Terms a).Encloses (Foundation.entropyTerm (CA1_2_13I1R0Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_2_13I1R0Certificates_valid + (CA1_2_13I1R0CertificateIndex a) (CA1_2_13I1R0P_sound a) +def CA1_2_13I1R0Entropy : Ball := ⟨(7062446007182092553122167611079 / 20000000000000000000000000000000), (17071362979 / 100000000000000000000000000000000)⟩ +lemma CA1_2_13I1R0Entropy_sound : CA1_2_13I1R0Entropy.Encloses (Foundation.finiteEntropy CA1_2_13I1R0Value) := by + exact contains_sound (entropyPair_enclosed CA1_2_13I1R0Value CA1_2_13I1R0Terms CA1_2_13I1R0Terms_sound) (by decide +kernel) +def CA1_2_13I1R0Mass : Ball := ⟨(13436205282506282517489090113403 / 50000000000000000000000000000000), (59 / 100000000000000000000000000000000)⟩ +lemma CA1_2_13I1R0Mass_sound : CA1_2_13I1R0Mass.Encloses (∑ a, CA1_2_13I1R0Value a) := by + exact contains_sound (pairSumBall_sound CA1_2_13I1R0P CA1_2_13I1R0Value CA1_2_13I1R0P_sound) (by decide +kernel) +def CA1_2_13I1R0MassTermLogWitness : LogWitness := ⟨-2, 13436205282506282517489090113403, 12500000000000000000000000000000⟩ +def CA1_2_13I1R0MassTermLog : Ball := ⟨(-32851751381290671558890368327317 / 25000000000000000000000000000000), (15881867817 / 25000000000000000000000000000000)⟩ +lemma CA1_2_13I1R0MassTermLog_sound : CA1_2_13I1R0MassTermLog.Encloses (Real.log ((∑ a, CA1_2_13I1R0Value a))) := by + exact checkLog_sound logTwoBall_sound (CA1_2_13I1R0Mass_sound) (w := CA1_2_13I1R0MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA1_2_13I1R0MassTerm : Ball := ⟨(7062446007182092553122167611079 / 20000000000000000000000000000000), (17071362979 / 100000000000000000000000000000000)⟩ +lemma CA1_2_13I1R0MassTerm_sound : CA1_2_13I1R0MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_2_13I1R0Value a))) := by + exact contains_sound (entropyTerm_ball (CA1_2_13I1R0Mass_sound) CA1_2_13I1R0MassTermLog_sound) (by decide +kernel) +def CA1_2_13I1R0H : Ball := ⟨0, (17071362979 / 50000000000000000000000000000000)⟩ +lemma CA1_2_13I1R0H_sound : CA1_2_13I1R0H.Encloses (homogeneousEntropy CA1_2_13I1R0Value) := by + exact contains_sound (homogeneous_enclosed CA1_2_13I1R0Value CA1_2_13I1R0MassTerm_sound CA1_2_13I1R0Entropy_sound) (by decide +kernel) +def CA1_2_13I1R1Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 2 13)) (fun u => (stageALaw (shape 1 2 13) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 1 a +def CA1_2_13I1R1Raw (a : PairSlot) : Ball := residualBall (below (shape 1 2 13)) A1_2_13Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 1 a +lemma CA1_2_13I1R1Raw_sound (a : PairSlot) : + (CA1_2_13I1R1Raw a).Encloses (CA1_2_13I1R1Value a) := by + exact residualBall_sound_on (below (shape 1 2 13)) A1_2_13Law (fun u => (stageALaw (shape 1 2 13) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A1_2_13Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 2 13) (show (shape 1 2 13) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 1 a +def CA1_2_13I1R1Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(11563794717493717482510909886597 / 50000000000000000000000000000000), (1 / 5000000000000000000000000000000)⟩ ⟨(16931059881445265744591999942733 / 50000000000000000000000000000000), (19589830293 / 100000000000000000000000000000000)⟩ ⟨(-29282878665827482083991687201737 / 20000000000000000000000000000000), (42351647409 / 50000000000000000000000000000000)⟩ ⟨-3, 11563794717493717482510909886597, 6250000000000000000000000000000⟩] +lemma CA1_2_13I1R1Certificates_valid : + CA1_2_13I1R1Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_2_13I1R1CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 1, 0 => 1 + | 0, 1 => 1 + | _, _ => 0 +def CA1_2_13I1R1P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_2_13I1R1Certificates (CA1_2_13I1R1CertificateIndex a)).input +lemma CA1_2_13I1R1P_check : ∀ a : PairSlot, contains (CA1_2_13I1R1Raw a) (CA1_2_13I1R1P a) = true := by + decide +kernel +lemma CA1_2_13I1R1P_sound (a : PairSlot) : + (CA1_2_13I1R1P a).Encloses (CA1_2_13I1R1Value a) := + contains_sound (CA1_2_13I1R1Raw_sound a) (CA1_2_13I1R1P_check a) +def CA1_2_13I1R1Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_2_13I1R1Certificates (CA1_2_13I1R1CertificateIndex a)).output +lemma CA1_2_13I1R1Terms_sound (a : PairSlot) : + (CA1_2_13I1R1Terms a).Encloses (Foundation.entropyTerm (CA1_2_13I1R1Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_2_13I1R1Certificates_valid + (CA1_2_13I1R1CertificateIndex a) (CA1_2_13I1R1P_sound a) +def CA1_2_13I1R1Entropy : Ball := ⟨(16931059881445265744591999942733 / 25000000000000000000000000000000), (19589830293 / 50000000000000000000000000000000)⟩ +lemma CA1_2_13I1R1Entropy_sound : CA1_2_13I1R1Entropy.Encloses (Foundation.finiteEntropy CA1_2_13I1R1Value) := by + exact contains_sound (entropyPair_enclosed CA1_2_13I1R1Value CA1_2_13I1R1Terms CA1_2_13I1R1Terms_sound) (by decide +kernel) +def CA1_2_13I1R1Mass : Ball := ⟨(11563794717493717482510909886597 / 25000000000000000000000000000000), (1 / 2500000000000000000000000000000)⟩ +lemma CA1_2_13I1R1Mass_sound : CA1_2_13I1R1Mass.Encloses (∑ a, CA1_2_13I1R1Value a) := by + exact contains_sound (pairSumBall_sound CA1_2_13I1R1P CA1_2_13I1R1Value CA1_2_13I1R1P_sound) (by decide +kernel) +def CA1_2_13I1R1MassTermLogWitness : LogWitness := ⟨-2, 11563794717493717482510909886597, 6250000000000000000000000000000⟩ +def CA1_2_13I1R1MassTermLog : Ball := ⟨(-15419935054628575895647048591671 / 20000000000000000000000000000000), (12705494227 / 20000000000000000000000000000000)⟩ +lemma CA1_2_13I1R1MassTermLog_sound : CA1_2_13I1R1MassTermLog.Encloses (Real.log ((∑ a, CA1_2_13I1R1Value a))) := by + exact checkLog_sound logTwoBall_sound (CA1_2_13I1R1Mass_sound) (w := CA1_2_13I1R1MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA1_2_13I1R1MassTerm : Ball := ⟨(35662592705762024770993966801509 / 100000000000000000000000000000000), (29384745437 / 100000000000000000000000000000000)⟩ +lemma CA1_2_13I1R1MassTerm_sound : CA1_2_13I1R1MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_2_13I1R1Value a))) := by + exact contains_sound (entropyTerm_ball (CA1_2_13I1R1Mass_sound) CA1_2_13I1R1MassTermLog_sound) (by decide +kernel) +def CA1_2_13I1R1H : Ball := ⟨(32061646820019038207374032969423 / 100000000000000000000000000000000), (68564406023 / 100000000000000000000000000000000)⟩ +lemma CA1_2_13I1R1H_sound : CA1_2_13I1R1H.Encloses (homogeneousEntropy CA1_2_13I1R1Value) := by + exact contains_sound (homogeneous_enclosed CA1_2_13I1R1Value CA1_2_13I1R1MassTerm_sound CA1_2_13I1R1Entropy_sound) (by decide +kernel) +def CA1_2_13I1R2Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 2 13)) (fun u => (stageALaw (shape 1 2 13) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 2 a +def CA1_2_13I1R2Raw (a : PairSlot) : Ball := residualBall (below (shape 1 2 13)) A1_2_13Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 2 a +lemma CA1_2_13I1R2Raw_sound (a : PairSlot) : + (CA1_2_13I1R2Raw a).Encloses (CA1_2_13I1R2Value a) := by + exact residualBall_sound_on (below (shape 1 2 13)) A1_2_13Law (fun u => (stageALaw (shape 1 2 13) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A1_2_13Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 2 13) (show (shape 1 2 13) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 2 a +def CA1_2_13I1R2Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(510415122544695217681462222771 / 10000000000000000000000000000000), (11 / 50000000000000000000000000000000)⟩ ⟨(7592721018162129621059103906471 / 50000000000000000000000000000000), (810634559 / 12500000000000000000000000000000)⟩ ⟨(-297511601157438760339021860675673 / 100000000000000000000000000000000), (127054942529 / 100000000000000000000000000000000)⟩ ⟨-5, 510415122544695217681462222771, 312500000000000000000000000000⟩, + .log ⟨(427003908687794775861357943063 / 100000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ ⟨(465957963508295875989960509367 / 20000000000000000000000000000000), (813794373 / 100000000000000000000000000000000)⟩ ⟨(-27280661489739575041697282179381 / 5000000000000000000000000000000), (190582413849 / 100000000000000000000000000000000)⟩ ⟨-8, 427003908687794775861357943063, 390625000000000000000000000000⟩, + .log ⟨(15810100296743071129626219885259 / 100000000000000000000000000000000), (9 / 20000000000000000000000000000000)⟩ ⟨(29162065027704732871389591738293 / 100000000000000000000000000000000), (669583799 / 5000000000000000000000000000000)⟩ ⟨(-92226059545340794549134603642549 / 50000000000000000000000000000000), (10587911877 / 12500000000000000000000000000000)⟩ ⟨-3, 15810100296743071129626219885259, 12500000000000000000000000000000⟩] +lemma CA1_2_13I1R2Certificates_valid : + CA1_2_13I1R2Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_2_13I1R2CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 2, 0 => 1 + | 3, 0 => 2 + | 1, 1 => 3 + | 0, 2 => 1 + | 0, 3 => 2 + | _, _ => 0 +def CA1_2_13I1R2P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_2_13I1R2Certificates (CA1_2_13I1R2CertificateIndex a)).input +lemma CA1_2_13I1R2P_check : ∀ a : PairSlot, contains (CA1_2_13I1R2Raw a) (CA1_2_13I1R2P a) = true := by + decide +kernel +lemma CA1_2_13I1R2P_sound (a : PairSlot) : + (CA1_2_13I1R2P a).Encloses (CA1_2_13I1R2Value a) := + contains_sound (CA1_2_13I1R2Raw_sound a) (CA1_2_13I1R2P_check a) +def CA1_2_13I1R2Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_2_13I1R2Certificates (CA1_2_13I1R2CertificateIndex a)).output +lemma CA1_2_13I1R2Terms_sound (a : PairSlot) : + (CA1_2_13I1R2Terms a).Encloses (Foundation.entropyTerm (CA1_2_13I1R2Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_2_13I1R2Certificates_valid + (CA1_2_13I1R2CertificateIndex a) (CA1_2_13I1R2P_sound a) +def CA1_2_13I1R2Entropy : Ball := ⟨(64192528735436210115525612457847 / 100000000000000000000000000000000), (2798941767 / 10000000000000000000000000000000)⟩ +lemma CA1_2_13I1R2Entropy_sound : CA1_2_13I1R2Entropy.Encloses (Foundation.finiteEntropy CA1_2_13I1R2Value) := by + exact contains_sound (entropyPair_enclosed CA1_2_13I1R2Value CA1_2_13I1R2Terms CA1_2_13I1R2Terms_sound) (by decide +kernel) +def CA1_2_13I1R2Mass : Ball := ⟨(5374482113002513006995636045361 / 20000000000000000000000000000000), (19 / 20000000000000000000000000000000)⟩ +lemma CA1_2_13I1R2Mass_sound : CA1_2_13I1R2Mass.Encloses (∑ a, CA1_2_13I1R2Value a) := by + exact contains_sound (pairSumBall_sound CA1_2_13I1R2P CA1_2_13I1R2Value CA1_2_13I1R2P_sound) (by decide +kernel) +def CA1_2_13I1R2MassTermLogWitness : LogWitness := ⟨-2, 5374482113002513006995636045361, 5000000000000000000000000000000⟩ +def CA1_2_13I1R2MassTermLog : Ball := ⟨(-16425875690645335779445184163659 / 12500000000000000000000000000000), (63527471401 / 100000000000000000000000000000000)⟩ +lemma CA1_2_13I1R2MassTermLog_sound : CA1_2_13I1R2MassTermLog.Encloses (Real.log ((∑ a, CA1_2_13I1R2Value a))) := by + exact checkLog_sound logTwoBall_sound (CA1_2_13I1R2Mass_sound) (w := CA1_2_13I1R2MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA1_2_13I1R2MassTerm : Ball := ⟨(7062446007182092553122167611079 / 20000000000000000000000000000000), (8535681531 / 50000000000000000000000000000000)⟩ +lemma CA1_2_13I1R2MassTerm_sound : CA1_2_13I1R2MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_2_13I1R2Value a))) := by + exact contains_sound (entropyTerm_ball (CA1_2_13I1R2Mass_sound) CA1_2_13I1R2MassTermLog_sound) (by decide +kernel) +def CA1_2_13I1R2H : Ball := ⟨(7220074674881436837478693600613 / 25000000000000000000000000000000), (11265195183 / 25000000000000000000000000000000)⟩ +lemma CA1_2_13I1R2H_sound : CA1_2_13I1R2H.Encloses (homogeneousEntropy CA1_2_13I1R2Value) := by + exact contains_sound (homogeneous_enclosed CA1_2_13I1R2Value CA1_2_13I1R2MassTerm_sound CA1_2_13I1R2Entropy_sound) (by decide +kernel) +def CA1_2_13I1R3Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 2 13)) (fun u => (stageALaw (shape 1 2 13) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 3 a +def CA1_2_13I1R3Raw (a : PairSlot) : Ball := residualBall (below (shape 1 2 13)) A1_2_13Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 3 a +lemma CA1_2_13I1R3Raw_sound (a : PairSlot) : + (CA1_2_13I1R3Raw a).Encloses (CA1_2_13I1R3Value a) := by + exact residualBall_sound_on (below (shape 1 2 13)) A1_2_13Law (fun u => (stageALaw (shape 1 2 13) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A1_2_13Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 2 13) (show (shape 1 2 13) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 3 a +def CA1_2_13I1R3Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA1_2_13I1R3Certificates_valid : + CA1_2_13I1R3Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_2_13I1R3CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA1_2_13I1R3P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_2_13I1R3Certificates (CA1_2_13I1R3CertificateIndex a)).input +lemma CA1_2_13I1R3P_check : ∀ a : PairSlot, contains (CA1_2_13I1R3Raw a) (CA1_2_13I1R3P a) = true := by + decide +kernel +lemma CA1_2_13I1R3P_sound (a : PairSlot) : + (CA1_2_13I1R3P a).Encloses (CA1_2_13I1R3Value a) := + contains_sound (CA1_2_13I1R3Raw_sound a) (CA1_2_13I1R3P_check a) +def CA1_2_13I1R3Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_2_13I1R3Certificates (CA1_2_13I1R3CertificateIndex a)).output +lemma CA1_2_13I1R3Terms_sound (a : PairSlot) : + (CA1_2_13I1R3Terms a).Encloses (Foundation.entropyTerm (CA1_2_13I1R3Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_2_13I1R3Certificates_valid + (CA1_2_13I1R3CertificateIndex a) (CA1_2_13I1R3P_sound a) +def CA1_2_13I1R3Entropy : Ball := ⟨0, 0⟩ +lemma CA1_2_13I1R3Entropy_sound : CA1_2_13I1R3Entropy.Encloses (Foundation.finiteEntropy CA1_2_13I1R3Value) := by + exact contains_sound (entropyPair_enclosed CA1_2_13I1R3Value CA1_2_13I1R3Terms CA1_2_13I1R3Terms_sound) (by decide +kernel) +def CA1_2_13I1R3Mass : Ball := ⟨0, 0⟩ +lemma CA1_2_13I1R3Mass_sound : CA1_2_13I1R3Mass.Encloses (∑ a, CA1_2_13I1R3Value a) := by + exact contains_sound (pairSumBall_sound CA1_2_13I1R3P CA1_2_13I1R3Value CA1_2_13I1R3P_sound) (by decide +kernel) +def CA1_2_13I1R3MassTerm : Ball := .exact 0 +lemma CA1_2_13I1R3MassTerm_sound : CA1_2_13I1R3MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_2_13I1R3Value a))) := + entropyTerm_zero_ball (CA1_2_13I1R3Mass_sound) +def CA1_2_13I1R3H : Ball := ⟨0, 0⟩ +lemma CA1_2_13I1R3H_sound : CA1_2_13I1R3H.Encloses (homogeneousEntropy CA1_2_13I1R3Value) := by + exact contains_sound (homogeneous_enclosed CA1_2_13I1R3Value CA1_2_13I1R3MassTerm_sound CA1_2_13I1R3Entropy_sound) (by decide +kernel) +def CA1_2_13I1R4Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 2 13)) (fun u => (stageALaw (shape 1 2 13) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 4 a +def CA1_2_13I1R4Raw (a : PairSlot) : Ball := residualBall (below (shape 1 2 13)) A1_2_13Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 4 a +lemma CA1_2_13I1R4Raw_sound (a : PairSlot) : + (CA1_2_13I1R4Raw a).Encloses (CA1_2_13I1R4Value a) := by + exact residualBall_sound_on (below (shape 1 2 13)) A1_2_13Law (fun u => (stageALaw (shape 1 2 13) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A1_2_13Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 2 13) (show (shape 1 2 13) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 4 a +def CA1_2_13I1R4Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA1_2_13I1R4Certificates_valid : + CA1_2_13I1R4Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_2_13I1R4CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA1_2_13I1R4P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_2_13I1R4Certificates (CA1_2_13I1R4CertificateIndex a)).input +lemma CA1_2_13I1R4P_check : ∀ a : PairSlot, contains (CA1_2_13I1R4Raw a) (CA1_2_13I1R4P a) = true := by + decide +kernel +lemma CA1_2_13I1R4P_sound (a : PairSlot) : + (CA1_2_13I1R4P a).Encloses (CA1_2_13I1R4Value a) := + contains_sound (CA1_2_13I1R4Raw_sound a) (CA1_2_13I1R4P_check a) +def CA1_2_13I1R4Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_2_13I1R4Certificates (CA1_2_13I1R4CertificateIndex a)).output +lemma CA1_2_13I1R4Terms_sound (a : PairSlot) : + (CA1_2_13I1R4Terms a).Encloses (Foundation.entropyTerm (CA1_2_13I1R4Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_2_13I1R4Certificates_valid + (CA1_2_13I1R4CertificateIndex a) (CA1_2_13I1R4P_sound a) +def CA1_2_13I1R4Entropy : Ball := ⟨0, 0⟩ +lemma CA1_2_13I1R4Entropy_sound : CA1_2_13I1R4Entropy.Encloses (Foundation.finiteEntropy CA1_2_13I1R4Value) := by + exact contains_sound (entropyPair_enclosed CA1_2_13I1R4Value CA1_2_13I1R4Terms CA1_2_13I1R4Terms_sound) (by decide +kernel) +def CA1_2_13I1R4Mass : Ball := ⟨0, 0⟩ +lemma CA1_2_13I1R4Mass_sound : CA1_2_13I1R4Mass.Encloses (∑ a, CA1_2_13I1R4Value a) := by + exact contains_sound (pairSumBall_sound CA1_2_13I1R4P CA1_2_13I1R4Value CA1_2_13I1R4P_sound) (by decide +kernel) +def CA1_2_13I1R4MassTerm : Ball := .exact 0 +lemma CA1_2_13I1R4MassTerm_sound : CA1_2_13I1R4MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_2_13I1R4Value a))) := + entropyTerm_zero_ball (CA1_2_13I1R4Mass_sound) +def CA1_2_13I1R4H : Ball := ⟨0, 0⟩ +lemma CA1_2_13I1R4H_sound : CA1_2_13I1R4H.Encloses (homogeneousEntropy CA1_2_13I1R4Value) := by + exact contains_sound (homogeneous_enclosed CA1_2_13I1R4Value CA1_2_13I1R4MassTerm_sound CA1_2_13I1R4Entropy_sound) (by decide +kernel) +def CA1_2_13I1R5Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 2 13)) (fun u => (stageALaw (shape 1 2 13) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 5 a +def CA1_2_13I1R5Raw (a : PairSlot) : Ball := residualBall (below (shape 1 2 13)) A1_2_13Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 5 a +lemma CA1_2_13I1R5Raw_sound (a : PairSlot) : + (CA1_2_13I1R5Raw a).Encloses (CA1_2_13I1R5Value a) := by + exact residualBall_sound_on (below (shape 1 2 13)) A1_2_13Law (fun u => (stageALaw (shape 1 2 13) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A1_2_13Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 2 13) (show (shape 1 2 13) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 5 a +def CA1_2_13I1R5Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA1_2_13I1R5Certificates_valid : + CA1_2_13I1R5Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_2_13I1R5CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA1_2_13I1R5P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_2_13I1R5Certificates (CA1_2_13I1R5CertificateIndex a)).input +lemma CA1_2_13I1R5P_check : ∀ a : PairSlot, contains (CA1_2_13I1R5Raw a) (CA1_2_13I1R5P a) = true := by + decide +kernel +lemma CA1_2_13I1R5P_sound (a : PairSlot) : + (CA1_2_13I1R5P a).Encloses (CA1_2_13I1R5Value a) := + contains_sound (CA1_2_13I1R5Raw_sound a) (CA1_2_13I1R5P_check a) +def CA1_2_13I1R5Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_2_13I1R5Certificates (CA1_2_13I1R5CertificateIndex a)).output +lemma CA1_2_13I1R5Terms_sound (a : PairSlot) : + (CA1_2_13I1R5Terms a).Encloses (Foundation.entropyTerm (CA1_2_13I1R5Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_2_13I1R5Certificates_valid + (CA1_2_13I1R5CertificateIndex a) (CA1_2_13I1R5P_sound a) +def CA1_2_13I1R5Entropy : Ball := ⟨0, 0⟩ +lemma CA1_2_13I1R5Entropy_sound : CA1_2_13I1R5Entropy.Encloses (Foundation.finiteEntropy CA1_2_13I1R5Value) := by + exact contains_sound (entropyPair_enclosed CA1_2_13I1R5Value CA1_2_13I1R5Terms CA1_2_13I1R5Terms_sound) (by decide +kernel) +def CA1_2_13I1R5Mass : Ball := ⟨0, 0⟩ +lemma CA1_2_13I1R5Mass_sound : CA1_2_13I1R5Mass.Encloses (∑ a, CA1_2_13I1R5Value a) := by + exact contains_sound (pairSumBall_sound CA1_2_13I1R5P CA1_2_13I1R5Value CA1_2_13I1R5P_sound) (by decide +kernel) +def CA1_2_13I1R5MassTerm : Ball := .exact 0 +lemma CA1_2_13I1R5MassTerm_sound : CA1_2_13I1R5MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_2_13I1R5Value a))) := + entropyTerm_zero_ball (CA1_2_13I1R5Mass_sound) +def CA1_2_13I1R5H : Ball := ⟨0, 0⟩ +lemma CA1_2_13I1R5H_sound : CA1_2_13I1R5H.Encloses (homogeneousEntropy CA1_2_13I1R5Value) := by + exact contains_sound (homogeneous_enclosed CA1_2_13I1R5Value CA1_2_13I1R5MassTerm_sound CA1_2_13I1R5Entropy_sound) (by decide +kernel) +def CA1_2_13I1R6Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 2 13)) (fun u => (stageALaw (shape 1 2 13) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 6 a +def CA1_2_13I1R6Raw (a : PairSlot) : Ball := residualBall (below (shape 1 2 13)) A1_2_13Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 6 a +lemma CA1_2_13I1R6Raw_sound (a : PairSlot) : + (CA1_2_13I1R6Raw a).Encloses (CA1_2_13I1R6Value a) := by + exact residualBall_sound_on (below (shape 1 2 13)) A1_2_13Law (fun u => (stageALaw (shape 1 2 13) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A1_2_13Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 2 13) (show (shape 1 2 13) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 6 a +def CA1_2_13I1R6Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA1_2_13I1R6Certificates_valid : + CA1_2_13I1R6Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_2_13I1R6CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA1_2_13I1R6P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_2_13I1R6Certificates (CA1_2_13I1R6CertificateIndex a)).input +lemma CA1_2_13I1R6P_check : ∀ a : PairSlot, contains (CA1_2_13I1R6Raw a) (CA1_2_13I1R6P a) = true := by + decide +kernel +lemma CA1_2_13I1R6P_sound (a : PairSlot) : + (CA1_2_13I1R6P a).Encloses (CA1_2_13I1R6Value a) := + contains_sound (CA1_2_13I1R6Raw_sound a) (CA1_2_13I1R6P_check a) +def CA1_2_13I1R6Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_2_13I1R6Certificates (CA1_2_13I1R6CertificateIndex a)).output +lemma CA1_2_13I1R6Terms_sound (a : PairSlot) : + (CA1_2_13I1R6Terms a).Encloses (Foundation.entropyTerm (CA1_2_13I1R6Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_2_13I1R6Certificates_valid + (CA1_2_13I1R6CertificateIndex a) (CA1_2_13I1R6P_sound a) +def CA1_2_13I1R6Entropy : Ball := ⟨0, 0⟩ +lemma CA1_2_13I1R6Entropy_sound : CA1_2_13I1R6Entropy.Encloses (Foundation.finiteEntropy CA1_2_13I1R6Value) := by + exact contains_sound (entropyPair_enclosed CA1_2_13I1R6Value CA1_2_13I1R6Terms CA1_2_13I1R6Terms_sound) (by decide +kernel) +def CA1_2_13I1R6Mass : Ball := ⟨0, 0⟩ +lemma CA1_2_13I1R6Mass_sound : CA1_2_13I1R6Mass.Encloses (∑ a, CA1_2_13I1R6Value a) := by + exact contains_sound (pairSumBall_sound CA1_2_13I1R6P CA1_2_13I1R6Value CA1_2_13I1R6P_sound) (by decide +kernel) +def CA1_2_13I1R6MassTerm : Ball := .exact 0 +lemma CA1_2_13I1R6MassTerm_sound : CA1_2_13I1R6MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_2_13I1R6Value a))) := + entropyTerm_zero_ball (CA1_2_13I1R6Mass_sound) +def CA1_2_13I1R6H : Ball := ⟨0, 0⟩ +lemma CA1_2_13I1R6H_sound : CA1_2_13I1R6H.Encloses (homogeneousEntropy CA1_2_13I1R6Value) := by + exact contains_sound (homogeneous_enclosed CA1_2_13I1R6Value CA1_2_13I1R6MassTerm_sound CA1_2_13I1R6Entropy_sound) (by decide +kernel) +def CA1_2_13I1R7Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 2 13)) (fun u => (stageALaw (shape 1 2 13) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 7 a +def CA1_2_13I1R7Raw (a : PairSlot) : Ball := residualBall (below (shape 1 2 13)) A1_2_13Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 7 a +lemma CA1_2_13I1R7Raw_sound (a : PairSlot) : + (CA1_2_13I1R7Raw a).Encloses (CA1_2_13I1R7Value a) := by + exact residualBall_sound_on (below (shape 1 2 13)) A1_2_13Law (fun u => (stageALaw (shape 1 2 13) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A1_2_13Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 2 13) (show (shape 1 2 13) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 7 a +def CA1_2_13I1R7Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA1_2_13I1R7Certificates_valid : + CA1_2_13I1R7Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_2_13I1R7CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA1_2_13I1R7P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_2_13I1R7Certificates (CA1_2_13I1R7CertificateIndex a)).input +lemma CA1_2_13I1R7P_check : ∀ a : PairSlot, contains (CA1_2_13I1R7Raw a) (CA1_2_13I1R7P a) = true := by + decide +kernel +lemma CA1_2_13I1R7P_sound (a : PairSlot) : + (CA1_2_13I1R7P a).Encloses (CA1_2_13I1R7Value a) := + contains_sound (CA1_2_13I1R7Raw_sound a) (CA1_2_13I1R7P_check a) +def CA1_2_13I1R7Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_2_13I1R7Certificates (CA1_2_13I1R7CertificateIndex a)).output +lemma CA1_2_13I1R7Terms_sound (a : PairSlot) : + (CA1_2_13I1R7Terms a).Encloses (Foundation.entropyTerm (CA1_2_13I1R7Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_2_13I1R7Certificates_valid + (CA1_2_13I1R7CertificateIndex a) (CA1_2_13I1R7P_sound a) +def CA1_2_13I1R7Entropy : Ball := ⟨0, 0⟩ +lemma CA1_2_13I1R7Entropy_sound : CA1_2_13I1R7Entropy.Encloses (Foundation.finiteEntropy CA1_2_13I1R7Value) := by + exact contains_sound (entropyPair_enclosed CA1_2_13I1R7Value CA1_2_13I1R7Terms CA1_2_13I1R7Terms_sound) (by decide +kernel) +def CA1_2_13I1R7Mass : Ball := ⟨0, 0⟩ +lemma CA1_2_13I1R7Mass_sound : CA1_2_13I1R7Mass.Encloses (∑ a, CA1_2_13I1R7Value a) := by + exact contains_sound (pairSumBall_sound CA1_2_13I1R7P CA1_2_13I1R7Value CA1_2_13I1R7P_sound) (by decide +kernel) +def CA1_2_13I1R7MassTerm : Ball := .exact 0 +lemma CA1_2_13I1R7MassTerm_sound : CA1_2_13I1R7MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_2_13I1R7Value a))) := + entropyTerm_zero_ball (CA1_2_13I1R7Mass_sound) +def CA1_2_13I1R7H : Ball := ⟨0, 0⟩ +lemma CA1_2_13I1R7H_sound : CA1_2_13I1R7H.Encloses (homogeneousEntropy CA1_2_13I1R7Value) := by + exact contains_sound (homogeneous_enclosed CA1_2_13I1R7Value CA1_2_13I1R7MassTerm_sound CA1_2_13I1R7Entropy_sound) (by decide +kernel) +def CA1_2_13I1R8Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 2 13)) (fun u => (stageALaw (shape 1 2 13) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 8 a +def CA1_2_13I1R8Raw (a : PairSlot) : Ball := residualBall (below (shape 1 2 13)) A1_2_13Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 8 a +lemma CA1_2_13I1R8Raw_sound (a : PairSlot) : + (CA1_2_13I1R8Raw a).Encloses (CA1_2_13I1R8Value a) := by + exact residualBall_sound_on (below (shape 1 2 13)) A1_2_13Law (fun u => (stageALaw (shape 1 2 13) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A1_2_13Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 2 13) (show (shape 1 2 13) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 8 a +def CA1_2_13I1R8Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA1_2_13I1R8Certificates_valid : + CA1_2_13I1R8Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_2_13I1R8CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA1_2_13I1R8P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_2_13I1R8Certificates (CA1_2_13I1R8CertificateIndex a)).input +lemma CA1_2_13I1R8P_check : ∀ a : PairSlot, contains (CA1_2_13I1R8Raw a) (CA1_2_13I1R8P a) = true := by + decide +kernel +lemma CA1_2_13I1R8P_sound (a : PairSlot) : + (CA1_2_13I1R8P a).Encloses (CA1_2_13I1R8Value a) := + contains_sound (CA1_2_13I1R8Raw_sound a) (CA1_2_13I1R8P_check a) +def CA1_2_13I1R8Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_2_13I1R8Certificates (CA1_2_13I1R8CertificateIndex a)).output +lemma CA1_2_13I1R8Terms_sound (a : PairSlot) : + (CA1_2_13I1R8Terms a).Encloses (Foundation.entropyTerm (CA1_2_13I1R8Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_2_13I1R8Certificates_valid + (CA1_2_13I1R8CertificateIndex a) (CA1_2_13I1R8P_sound a) +def CA1_2_13I1R8Entropy : Ball := ⟨0, 0⟩ +lemma CA1_2_13I1R8Entropy_sound : CA1_2_13I1R8Entropy.Encloses (Foundation.finiteEntropy CA1_2_13I1R8Value) := by + exact contains_sound (entropyPair_enclosed CA1_2_13I1R8Value CA1_2_13I1R8Terms CA1_2_13I1R8Terms_sound) (by decide +kernel) +def CA1_2_13I1R8Mass : Ball := ⟨0, 0⟩ +lemma CA1_2_13I1R8Mass_sound : CA1_2_13I1R8Mass.Encloses (∑ a, CA1_2_13I1R8Value a) := by + exact contains_sound (pairSumBall_sound CA1_2_13I1R8P CA1_2_13I1R8Value CA1_2_13I1R8P_sound) (by decide +kernel) +def CA1_2_13I1R8MassTerm : Ball := .exact 0 +lemma CA1_2_13I1R8MassTerm_sound : CA1_2_13I1R8MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_2_13I1R8Value a))) := + entropyTerm_zero_ball (CA1_2_13I1R8Mass_sound) +def CA1_2_13I1R8H : Ball := ⟨0, 0⟩ +lemma CA1_2_13I1R8H_sound : CA1_2_13I1R8H.Encloses (homogeneousEntropy CA1_2_13I1R8Value) := by + exact contains_sound (homogeneous_enclosed CA1_2_13I1R8Value CA1_2_13I1R8MassTerm_sound CA1_2_13I1R8Entropy_sound) (by decide +kernel) +def CA1_2_13I1R9Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 2 13)) (fun u => (stageALaw (shape 1 2 13) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 9 a +def CA1_2_13I1R9Raw (a : PairSlot) : Ball := residualBall (below (shape 1 2 13)) A1_2_13Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 9 a +lemma CA1_2_13I1R9Raw_sound (a : PairSlot) : + (CA1_2_13I1R9Raw a).Encloses (CA1_2_13I1R9Value a) := by + exact residualBall_sound_on (below (shape 1 2 13)) A1_2_13Law (fun u => (stageALaw (shape 1 2 13) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A1_2_13Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 2 13) (show (shape 1 2 13) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 9 a +def CA1_2_13I1R9Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA1_2_13I1R9Certificates_valid : + CA1_2_13I1R9Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_2_13I1R9CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA1_2_13I1R9P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_2_13I1R9Certificates (CA1_2_13I1R9CertificateIndex a)).input +lemma CA1_2_13I1R9P_check : ∀ a : PairSlot, contains (CA1_2_13I1R9Raw a) (CA1_2_13I1R9P a) = true := by + decide +kernel +lemma CA1_2_13I1R9P_sound (a : PairSlot) : + (CA1_2_13I1R9P a).Encloses (CA1_2_13I1R9Value a) := + contains_sound (CA1_2_13I1R9Raw_sound a) (CA1_2_13I1R9P_check a) +def CA1_2_13I1R9Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_2_13I1R9Certificates (CA1_2_13I1R9CertificateIndex a)).output +lemma CA1_2_13I1R9Terms_sound (a : PairSlot) : + (CA1_2_13I1R9Terms a).Encloses (Foundation.entropyTerm (CA1_2_13I1R9Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_2_13I1R9Certificates_valid + (CA1_2_13I1R9CertificateIndex a) (CA1_2_13I1R9P_sound a) +def CA1_2_13I1R9Entropy : Ball := ⟨0, 0⟩ +lemma CA1_2_13I1R9Entropy_sound : CA1_2_13I1R9Entropy.Encloses (Foundation.finiteEntropy CA1_2_13I1R9Value) := by + exact contains_sound (entropyPair_enclosed CA1_2_13I1R9Value CA1_2_13I1R9Terms CA1_2_13I1R9Terms_sound) (by decide +kernel) +def CA1_2_13I1R9Mass : Ball := ⟨0, 0⟩ +lemma CA1_2_13I1R9Mass_sound : CA1_2_13I1R9Mass.Encloses (∑ a, CA1_2_13I1R9Value a) := by + exact contains_sound (pairSumBall_sound CA1_2_13I1R9P CA1_2_13I1R9Value CA1_2_13I1R9P_sound) (by decide +kernel) +def CA1_2_13I1R9MassTerm : Ball := .exact 0 +lemma CA1_2_13I1R9MassTerm_sound : CA1_2_13I1R9MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_2_13I1R9Value a))) := + entropyTerm_zero_ball (CA1_2_13I1R9Mass_sound) +def CA1_2_13I1R9H : Ball := ⟨0, 0⟩ +lemma CA1_2_13I1R9H_sound : CA1_2_13I1R9H.Encloses (homogeneousEntropy CA1_2_13I1R9Value) := by + exact contains_sound (homogeneous_enclosed CA1_2_13I1R9Value CA1_2_13I1R9MassTerm_sound CA1_2_13I1R9Entropy_sound) (by decide +kernel) +def CA1_2_13I1R10Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 2 13)) (fun u => (stageALaw (shape 1 2 13) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 10 a +def CA1_2_13I1R10Raw (a : PairSlot) : Ball := residualBall (below (shape 1 2 13)) A1_2_13Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 10 a +lemma CA1_2_13I1R10Raw_sound (a : PairSlot) : + (CA1_2_13I1R10Raw a).Encloses (CA1_2_13I1R10Value a) := by + exact residualBall_sound_on (below (shape 1 2 13)) A1_2_13Law (fun u => (stageALaw (shape 1 2 13) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A1_2_13Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 2 13) (show (shape 1 2 13) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 10 a +def CA1_2_13I1R10Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA1_2_13I1R10Certificates_valid : + CA1_2_13I1R10Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_2_13I1R10CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA1_2_13I1R10P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_2_13I1R10Certificates (CA1_2_13I1R10CertificateIndex a)).input +lemma CA1_2_13I1R10P_check : ∀ a : PairSlot, contains (CA1_2_13I1R10Raw a) (CA1_2_13I1R10P a) = true := by + decide +kernel +lemma CA1_2_13I1R10P_sound (a : PairSlot) : + (CA1_2_13I1R10P a).Encloses (CA1_2_13I1R10Value a) := + contains_sound (CA1_2_13I1R10Raw_sound a) (CA1_2_13I1R10P_check a) +def CA1_2_13I1R10Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_2_13I1R10Certificates (CA1_2_13I1R10CertificateIndex a)).output +lemma CA1_2_13I1R10Terms_sound (a : PairSlot) : + (CA1_2_13I1R10Terms a).Encloses (Foundation.entropyTerm (CA1_2_13I1R10Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_2_13I1R10Certificates_valid + (CA1_2_13I1R10CertificateIndex a) (CA1_2_13I1R10P_sound a) +def CA1_2_13I1R10Entropy : Ball := ⟨0, 0⟩ +lemma CA1_2_13I1R10Entropy_sound : CA1_2_13I1R10Entropy.Encloses (Foundation.finiteEntropy CA1_2_13I1R10Value) := by + exact contains_sound (entropyPair_enclosed CA1_2_13I1R10Value CA1_2_13I1R10Terms CA1_2_13I1R10Terms_sound) (by decide +kernel) +def CA1_2_13I1R10Mass : Ball := ⟨0, 0⟩ +lemma CA1_2_13I1R10Mass_sound : CA1_2_13I1R10Mass.Encloses (∑ a, CA1_2_13I1R10Value a) := by + exact contains_sound (pairSumBall_sound CA1_2_13I1R10P CA1_2_13I1R10Value CA1_2_13I1R10P_sound) (by decide +kernel) +def CA1_2_13I1R10MassTerm : Ball := .exact 0 +lemma CA1_2_13I1R10MassTerm_sound : CA1_2_13I1R10MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_2_13I1R10Value a))) := + entropyTerm_zero_ball (CA1_2_13I1R10Mass_sound) +def CA1_2_13I1R10H : Ball := ⟨0, 0⟩ +lemma CA1_2_13I1R10H_sound : CA1_2_13I1R10H.Encloses (homogeneousEntropy CA1_2_13I1R10Value) := by + exact contains_sound (homogeneous_enclosed CA1_2_13I1R10Value CA1_2_13I1R10MassTerm_sound CA1_2_13I1R10Entropy_sound) (by decide +kernel) +def CA1_2_13I1R11Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 2 13)) (fun u => (stageALaw (shape 1 2 13) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 11 a +def CA1_2_13I1R11Raw (a : PairSlot) : Ball := residualBall (below (shape 1 2 13)) A1_2_13Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 11 a +lemma CA1_2_13I1R11Raw_sound (a : PairSlot) : + (CA1_2_13I1R11Raw a).Encloses (CA1_2_13I1R11Value a) := by + exact residualBall_sound_on (below (shape 1 2 13)) A1_2_13Law (fun u => (stageALaw (shape 1 2 13) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A1_2_13Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 2 13) (show (shape 1 2 13) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 11 a +def CA1_2_13I1R11Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA1_2_13I1R11Certificates_valid : + CA1_2_13I1R11Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_2_13I1R11CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA1_2_13I1R11P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_2_13I1R11Certificates (CA1_2_13I1R11CertificateIndex a)).input +lemma CA1_2_13I1R11P_check : ∀ a : PairSlot, contains (CA1_2_13I1R11Raw a) (CA1_2_13I1R11P a) = true := by + decide +kernel +lemma CA1_2_13I1R11P_sound (a : PairSlot) : + (CA1_2_13I1R11P a).Encloses (CA1_2_13I1R11Value a) := + contains_sound (CA1_2_13I1R11Raw_sound a) (CA1_2_13I1R11P_check a) +def CA1_2_13I1R11Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_2_13I1R11Certificates (CA1_2_13I1R11CertificateIndex a)).output +lemma CA1_2_13I1R11Terms_sound (a : PairSlot) : + (CA1_2_13I1R11Terms a).Encloses (Foundation.entropyTerm (CA1_2_13I1R11Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_2_13I1R11Certificates_valid + (CA1_2_13I1R11CertificateIndex a) (CA1_2_13I1R11P_sound a) +def CA1_2_13I1R11Entropy : Ball := ⟨0, 0⟩ +lemma CA1_2_13I1R11Entropy_sound : CA1_2_13I1R11Entropy.Encloses (Foundation.finiteEntropy CA1_2_13I1R11Value) := by + exact contains_sound (entropyPair_enclosed CA1_2_13I1R11Value CA1_2_13I1R11Terms CA1_2_13I1R11Terms_sound) (by decide +kernel) +def CA1_2_13I1R11Mass : Ball := ⟨0, 0⟩ +lemma CA1_2_13I1R11Mass_sound : CA1_2_13I1R11Mass.Encloses (∑ a, CA1_2_13I1R11Value a) := by + exact contains_sound (pairSumBall_sound CA1_2_13I1R11P CA1_2_13I1R11Value CA1_2_13I1R11P_sound) (by decide +kernel) +def CA1_2_13I1R11MassTerm : Ball := .exact 0 +lemma CA1_2_13I1R11MassTerm_sound : CA1_2_13I1R11MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_2_13I1R11Value a))) := + entropyTerm_zero_ball (CA1_2_13I1R11Mass_sound) +def CA1_2_13I1R11H : Ball := ⟨0, 0⟩ +lemma CA1_2_13I1R11H_sound : CA1_2_13I1R11H.Encloses (homogeneousEntropy CA1_2_13I1R11Value) := by + exact contains_sound (homogeneous_enclosed CA1_2_13I1R11Value CA1_2_13I1R11MassTerm_sound CA1_2_13I1R11Entropy_sound) (by decide +kernel) +def CA1_2_13I1R12Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 2 13)) (fun u => (stageALaw (shape 1 2 13) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 12 a +def CA1_2_13I1R12Raw (a : PairSlot) : Ball := residualBall (below (shape 1 2 13)) A1_2_13Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 12 a +lemma CA1_2_13I1R12Raw_sound (a : PairSlot) : + (CA1_2_13I1R12Raw a).Encloses (CA1_2_13I1R12Value a) := by + exact residualBall_sound_on (below (shape 1 2 13)) A1_2_13Law (fun u => (stageALaw (shape 1 2 13) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A1_2_13Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 2 13) (show (shape 1 2 13) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 12 a +def CA1_2_13I1R12Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA1_2_13I1R12Certificates_valid : + CA1_2_13I1R12Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_2_13I1R12CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA1_2_13I1R12P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_2_13I1R12Certificates (CA1_2_13I1R12CertificateIndex a)).input +lemma CA1_2_13I1R12P_check : ∀ a : PairSlot, contains (CA1_2_13I1R12Raw a) (CA1_2_13I1R12P a) = true := by + decide +kernel +lemma CA1_2_13I1R12P_sound (a : PairSlot) : + (CA1_2_13I1R12P a).Encloses (CA1_2_13I1R12Value a) := + contains_sound (CA1_2_13I1R12Raw_sound a) (CA1_2_13I1R12P_check a) +def CA1_2_13I1R12Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_2_13I1R12Certificates (CA1_2_13I1R12CertificateIndex a)).output +lemma CA1_2_13I1R12Terms_sound (a : PairSlot) : + (CA1_2_13I1R12Terms a).Encloses (Foundation.entropyTerm (CA1_2_13I1R12Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_2_13I1R12Certificates_valid + (CA1_2_13I1R12CertificateIndex a) (CA1_2_13I1R12P_sound a) +def CA1_2_13I1R12Entropy : Ball := ⟨0, 0⟩ +lemma CA1_2_13I1R12Entropy_sound : CA1_2_13I1R12Entropy.Encloses (Foundation.finiteEntropy CA1_2_13I1R12Value) := by + exact contains_sound (entropyPair_enclosed CA1_2_13I1R12Value CA1_2_13I1R12Terms CA1_2_13I1R12Terms_sound) (by decide +kernel) +def CA1_2_13I1R12Mass : Ball := ⟨0, 0⟩ +lemma CA1_2_13I1R12Mass_sound : CA1_2_13I1R12Mass.Encloses (∑ a, CA1_2_13I1R12Value a) := by + exact contains_sound (pairSumBall_sound CA1_2_13I1R12P CA1_2_13I1R12Value CA1_2_13I1R12P_sound) (by decide +kernel) +def CA1_2_13I1R12MassTerm : Ball := .exact 0 +lemma CA1_2_13I1R12MassTerm_sound : CA1_2_13I1R12MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_2_13I1R12Value a))) := + entropyTerm_zero_ball (CA1_2_13I1R12Mass_sound) +def CA1_2_13I1R12H : Ball := ⟨0, 0⟩ +lemma CA1_2_13I1R12H_sound : CA1_2_13I1R12H.Encloses (homogeneousEntropy CA1_2_13I1R12Value) := by + exact contains_sound (homogeneous_enclosed CA1_2_13I1R12Value CA1_2_13I1R12MassTerm_sound CA1_2_13I1R12Entropy_sound) (by decide +kernel) +def CA1_2_13I1R13Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 2 13)) (fun u => (stageALaw (shape 1 2 13) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 13 a +def CA1_2_13I1R13Raw (a : PairSlot) : Ball := residualBall (below (shape 1 2 13)) A1_2_13Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 13 a +lemma CA1_2_13I1R13Raw_sound (a : PairSlot) : + (CA1_2_13I1R13Raw a).Encloses (CA1_2_13I1R13Value a) := by + exact residualBall_sound_on (below (shape 1 2 13)) A1_2_13Law (fun u => (stageALaw (shape 1 2 13) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A1_2_13Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 2 13) (show (shape 1 2 13) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 13 a +def CA1_2_13I1R13Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA1_2_13I1R13Certificates_valid : + CA1_2_13I1R13Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_2_13I1R13CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA1_2_13I1R13P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_2_13I1R13Certificates (CA1_2_13I1R13CertificateIndex a)).input +lemma CA1_2_13I1R13P_check : ∀ a : PairSlot, contains (CA1_2_13I1R13Raw a) (CA1_2_13I1R13P a) = true := by + decide +kernel +lemma CA1_2_13I1R13P_sound (a : PairSlot) : + (CA1_2_13I1R13P a).Encloses (CA1_2_13I1R13Value a) := + contains_sound (CA1_2_13I1R13Raw_sound a) (CA1_2_13I1R13P_check a) +def CA1_2_13I1R13Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_2_13I1R13Certificates (CA1_2_13I1R13CertificateIndex a)).output +lemma CA1_2_13I1R13Terms_sound (a : PairSlot) : + (CA1_2_13I1R13Terms a).Encloses (Foundation.entropyTerm (CA1_2_13I1R13Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_2_13I1R13Certificates_valid + (CA1_2_13I1R13CertificateIndex a) (CA1_2_13I1R13P_sound a) +def CA1_2_13I1R13Entropy : Ball := ⟨0, 0⟩ +lemma CA1_2_13I1R13Entropy_sound : CA1_2_13I1R13Entropy.Encloses (Foundation.finiteEntropy CA1_2_13I1R13Value) := by + exact contains_sound (entropyPair_enclosed CA1_2_13I1R13Value CA1_2_13I1R13Terms CA1_2_13I1R13Terms_sound) (by decide +kernel) +def CA1_2_13I1R13Mass : Ball := ⟨0, 0⟩ +lemma CA1_2_13I1R13Mass_sound : CA1_2_13I1R13Mass.Encloses (∑ a, CA1_2_13I1R13Value a) := by + exact contains_sound (pairSumBall_sound CA1_2_13I1R13P CA1_2_13I1R13Value CA1_2_13I1R13P_sound) (by decide +kernel) +def CA1_2_13I1R13MassTerm : Ball := .exact 0 +lemma CA1_2_13I1R13MassTerm_sound : CA1_2_13I1R13MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_2_13I1R13Value a))) := + entropyTerm_zero_ball (CA1_2_13I1R13Mass_sound) +def CA1_2_13I1R13H : Ball := ⟨0, 0⟩ +lemma CA1_2_13I1R13H_sound : CA1_2_13I1R13H.Encloses (homogeneousEntropy CA1_2_13I1R13Value) := by + exact contains_sound (homogeneous_enclosed CA1_2_13I1R13Value CA1_2_13I1R13MassTerm_sound CA1_2_13I1R13Entropy_sound) (by decide +kernel) +def CA1_2_13I1R14Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 2 13)) (fun u => (stageALaw (shape 1 2 13) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 14 a +def CA1_2_13I1R14Raw (a : PairSlot) : Ball := residualBall (below (shape 1 2 13)) A1_2_13Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 14 a +lemma CA1_2_13I1R14Raw_sound (a : PairSlot) : + (CA1_2_13I1R14Raw a).Encloses (CA1_2_13I1R14Value a) := by + exact residualBall_sound_on (below (shape 1 2 13)) A1_2_13Law (fun u => (stageALaw (shape 1 2 13) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A1_2_13Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 2 13) (show (shape 1 2 13) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 14 a +def CA1_2_13I1R14Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA1_2_13I1R14Certificates_valid : + CA1_2_13I1R14Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_2_13I1R14CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA1_2_13I1R14P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_2_13I1R14Certificates (CA1_2_13I1R14CertificateIndex a)).input +lemma CA1_2_13I1R14P_check : ∀ a : PairSlot, contains (CA1_2_13I1R14Raw a) (CA1_2_13I1R14P a) = true := by + decide +kernel +lemma CA1_2_13I1R14P_sound (a : PairSlot) : + (CA1_2_13I1R14P a).Encloses (CA1_2_13I1R14Value a) := + contains_sound (CA1_2_13I1R14Raw_sound a) (CA1_2_13I1R14P_check a) +def CA1_2_13I1R14Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_2_13I1R14Certificates (CA1_2_13I1R14CertificateIndex a)).output +lemma CA1_2_13I1R14Terms_sound (a : PairSlot) : + (CA1_2_13I1R14Terms a).Encloses (Foundation.entropyTerm (CA1_2_13I1R14Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_2_13I1R14Certificates_valid + (CA1_2_13I1R14CertificateIndex a) (CA1_2_13I1R14P_sound a) +def CA1_2_13I1R14Entropy : Ball := ⟨0, 0⟩ +lemma CA1_2_13I1R14Entropy_sound : CA1_2_13I1R14Entropy.Encloses (Foundation.finiteEntropy CA1_2_13I1R14Value) := by + exact contains_sound (entropyPair_enclosed CA1_2_13I1R14Value CA1_2_13I1R14Terms CA1_2_13I1R14Terms_sound) (by decide +kernel) +def CA1_2_13I1R14Mass : Ball := ⟨0, 0⟩ +lemma CA1_2_13I1R14Mass_sound : CA1_2_13I1R14Mass.Encloses (∑ a, CA1_2_13I1R14Value a) := by + exact contains_sound (pairSumBall_sound CA1_2_13I1R14P CA1_2_13I1R14Value CA1_2_13I1R14P_sound) (by decide +kernel) +def CA1_2_13I1R14MassTerm : Ball := .exact 0 +lemma CA1_2_13I1R14MassTerm_sound : CA1_2_13I1R14MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_2_13I1R14Value a))) := + entropyTerm_zero_ball (CA1_2_13I1R14Mass_sound) +def CA1_2_13I1R14H : Ball := ⟨0, 0⟩ +lemma CA1_2_13I1R14H_sound : CA1_2_13I1R14H.Encloses (homogeneousEntropy CA1_2_13I1R14Value) := by + exact contains_sound (homogeneous_enclosed CA1_2_13I1R14Value CA1_2_13I1R14MassTerm_sound CA1_2_13I1R14Entropy_sound) (by decide +kernel) +def CA1_2_13I1R15Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 2 13)) (fun u => (stageALaw (shape 1 2 13) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 15 a +def CA1_2_13I1R15Raw (a : PairSlot) : Ball := residualBall (below (shape 1 2 13)) A1_2_13Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 15 a +lemma CA1_2_13I1R15Raw_sound (a : PairSlot) : + (CA1_2_13I1R15Raw a).Encloses (CA1_2_13I1R15Value a) := by + exact residualBall_sound_on (below (shape 1 2 13)) A1_2_13Law (fun u => (stageALaw (shape 1 2 13) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A1_2_13Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 2 13) (show (shape 1 2 13) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 15 a +def CA1_2_13I1R15Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA1_2_13I1R15Certificates_valid : + CA1_2_13I1R15Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_2_13I1R15CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA1_2_13I1R15P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_2_13I1R15Certificates (CA1_2_13I1R15CertificateIndex a)).input +lemma CA1_2_13I1R15P_check : ∀ a : PairSlot, contains (CA1_2_13I1R15Raw a) (CA1_2_13I1R15P a) = true := by + decide +kernel +lemma CA1_2_13I1R15P_sound (a : PairSlot) : + (CA1_2_13I1R15P a).Encloses (CA1_2_13I1R15Value a) := + contains_sound (CA1_2_13I1R15Raw_sound a) (CA1_2_13I1R15P_check a) +def CA1_2_13I1R15Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_2_13I1R15Certificates (CA1_2_13I1R15CertificateIndex a)).output +lemma CA1_2_13I1R15Terms_sound (a : PairSlot) : + (CA1_2_13I1R15Terms a).Encloses (Foundation.entropyTerm (CA1_2_13I1R15Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_2_13I1R15Certificates_valid + (CA1_2_13I1R15CertificateIndex a) (CA1_2_13I1R15P_sound a) +def CA1_2_13I1R15Entropy : Ball := ⟨0, 0⟩ +lemma CA1_2_13I1R15Entropy_sound : CA1_2_13I1R15Entropy.Encloses (Foundation.finiteEntropy CA1_2_13I1R15Value) := by + exact contains_sound (entropyPair_enclosed CA1_2_13I1R15Value CA1_2_13I1R15Terms CA1_2_13I1R15Terms_sound) (by decide +kernel) +def CA1_2_13I1R15Mass : Ball := ⟨0, 0⟩ +lemma CA1_2_13I1R15Mass_sound : CA1_2_13I1R15Mass.Encloses (∑ a, CA1_2_13I1R15Value a) := by + exact contains_sound (pairSumBall_sound CA1_2_13I1R15P CA1_2_13I1R15Value CA1_2_13I1R15P_sound) (by decide +kernel) +def CA1_2_13I1R15MassTerm : Ball := .exact 0 +lemma CA1_2_13I1R15MassTerm_sound : CA1_2_13I1R15MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_2_13I1R15Value a))) := + entropyTerm_zero_ball (CA1_2_13I1R15Mass_sound) +def CA1_2_13I1R15H : Ball := ⟨0, 0⟩ +lemma CA1_2_13I1R15H_sound : CA1_2_13I1R15H.Encloses (homogeneousEntropy CA1_2_13I1R15Value) := by + exact contains_sound (homogeneous_enclosed CA1_2_13I1R15Value CA1_2_13I1R15MassTerm_sound CA1_2_13I1R15Entropy_sound) (by decide +kernel) +def CA1_2_13I1R16Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 2 13)) (fun u => (stageALaw (shape 1 2 13) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 16 a +def CA1_2_13I1R16Raw (a : PairSlot) : Ball := residualBall (below (shape 1 2 13)) A1_2_13Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 16 a +lemma CA1_2_13I1R16Raw_sound (a : PairSlot) : + (CA1_2_13I1R16Raw a).Encloses (CA1_2_13I1R16Value a) := by + exact residualBall_sound_on (below (shape 1 2 13)) A1_2_13Law (fun u => (stageALaw (shape 1 2 13) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A1_2_13Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 2 13) (show (shape 1 2 13) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 16 a +def CA1_2_13I1R16Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA1_2_13I1R16Certificates_valid : + CA1_2_13I1R16Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_2_13I1R16CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA1_2_13I1R16P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_2_13I1R16Certificates (CA1_2_13I1R16CertificateIndex a)).input +lemma CA1_2_13I1R16P_check : ∀ a : PairSlot, contains (CA1_2_13I1R16Raw a) (CA1_2_13I1R16P a) = true := by + decide +kernel +lemma CA1_2_13I1R16P_sound (a : PairSlot) : + (CA1_2_13I1R16P a).Encloses (CA1_2_13I1R16Value a) := + contains_sound (CA1_2_13I1R16Raw_sound a) (CA1_2_13I1R16P_check a) +def CA1_2_13I1R16Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_2_13I1R16Certificates (CA1_2_13I1R16CertificateIndex a)).output +lemma CA1_2_13I1R16Terms_sound (a : PairSlot) : + (CA1_2_13I1R16Terms a).Encloses (Foundation.entropyTerm (CA1_2_13I1R16Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_2_13I1R16Certificates_valid + (CA1_2_13I1R16CertificateIndex a) (CA1_2_13I1R16P_sound a) +def CA1_2_13I1R16Entropy : Ball := ⟨0, 0⟩ +lemma CA1_2_13I1R16Entropy_sound : CA1_2_13I1R16Entropy.Encloses (Foundation.finiteEntropy CA1_2_13I1R16Value) := by + exact contains_sound (entropyPair_enclosed CA1_2_13I1R16Value CA1_2_13I1R16Terms CA1_2_13I1R16Terms_sound) (by decide +kernel) +def CA1_2_13I1R16Mass : Ball := ⟨0, 0⟩ +lemma CA1_2_13I1R16Mass_sound : CA1_2_13I1R16Mass.Encloses (∑ a, CA1_2_13I1R16Value a) := by + exact contains_sound (pairSumBall_sound CA1_2_13I1R16P CA1_2_13I1R16Value CA1_2_13I1R16P_sound) (by decide +kernel) +def CA1_2_13I1R16MassTerm : Ball := .exact 0 +lemma CA1_2_13I1R16MassTerm_sound : CA1_2_13I1R16MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_2_13I1R16Value a))) := + entropyTerm_zero_ball (CA1_2_13I1R16Mass_sound) +def CA1_2_13I1R16H : Ball := ⟨0, 0⟩ +lemma CA1_2_13I1R16H_sound : CA1_2_13I1R16H.Encloses (homogeneousEntropy CA1_2_13I1R16Value) := by + exact contains_sound (homogeneous_enclosed CA1_2_13I1R16Value CA1_2_13I1R16MassTerm_sound CA1_2_13I1R16Entropy_sound) (by decide +kernel) +def CA1_2_13I1ResidualEntropies (a : Fin 17) : Ball := + match a.val with + | 0 => CA1_2_13I1R0H + | 1 => CA1_2_13I1R1H + | 2 => CA1_2_13I1R2H + | 3 => CA1_2_13I1R3H + | 4 => CA1_2_13I1R4H + | 5 => CA1_2_13I1R5H + | 6 => CA1_2_13I1R6H + | 7 => CA1_2_13I1R7H + | 8 => CA1_2_13I1R8H + | 9 => CA1_2_13I1R9H + | 10 => CA1_2_13I1R10H + | 11 => CA1_2_13I1R11H + | 12 => CA1_2_13I1R12H + | 13 => CA1_2_13I1R13H + | 14 => CA1_2_13I1R14H + | 15 => CA1_2_13I1R15H + | 16 => CA1_2_13I1R16H + | _ => (.exact 0) +lemma CA1_2_13I1ResidualEntropies_sound (k : Fin 17) : + (CA1_2_13I1ResidualEntropies k).Encloses (homogeneousEntropy + (residualLaw (below (shape 1 2 13)) (fun u => (stageALaw (shape 1 2 13) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) k)) := by + fin_cases k + · exact CA1_2_13I1R0H_sound + · exact CA1_2_13I1R1H_sound + · exact CA1_2_13I1R2H_sound + · exact CA1_2_13I1R3H_sound + · exact CA1_2_13I1R4H_sound + · exact CA1_2_13I1R5H_sound + · exact CA1_2_13I1R6H_sound + · exact CA1_2_13I1R7H_sound + · exact CA1_2_13I1R8H_sound + · exact CA1_2_13I1R9H_sound + · exact CA1_2_13I1R10H_sound + · exact CA1_2_13I1R11H_sound + · exact CA1_2_13I1R12H_sound + · exact CA1_2_13I1R13H_sound + · exact CA1_2_13I1R14H_sound + · exact CA1_2_13I1R15H_sound + · exact CA1_2_13I1R16H_sound +def CA1_2_13I1Singles (s : Shape) : Ball := + match s 0, s 1, s 2 with + | _, _, _ => (.exact 0) +lemma CA1_2_13I1Singles_sound (u : Shape) (hu : u ∈ below (shape 1 2 13)) + (hd : designated (Equiv.refl (Fin 3)) 1 u) : + (CA1_2_13I1Singles u).Encloses (homogeneousEntropy ((fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) u)) := by + rw [A1_2_13_below] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl | rfl | rfl + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 0 0 8) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 0 1 7) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 0 2 6) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 1 0 7) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 1 1 6) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 1 2 5) by decide +kernel) hd |>.elim +def CA1_2_13I1Singleton : Ball := ⟨0, 0⟩ +lemma CA1_2_13I1Singleton_sound : CA1_2_13I1Singleton.Encloses + (singletonEntropy (below (shape 1 2 13)) (fun u => (stageALaw (shape 1 2 13) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ))) := by + exact contains_sound (singletonBall_sound (below (shape 1 2 13)) A1_2_13Law (fun u => (stageALaw (shape 1 2 13) u : ℝ)) (Equiv.refl (Fin 3)) 1 + CA1_2_13I1Singles (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A1_2_13Law_sound u) CA1_2_13I1Singles_sound) (by decide +kernel) +def CA1_2_13I1Group : Ball := ⟨(19501422566254331378332418359 / 32000000000000000000000000000), (147767912713 / 100000000000000000000000000000000)⟩ +lemma CA1_2_13I1Group_sound : CA1_2_13I1Group.Encloses + (groupedEntropy (below (shape 1 2 13)) (fun u => (stageALaw (shape 1 2 13) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ))) := by + exact contains_sound (Ball.add_sound CA1_2_13I1Singleton_sound + (finSumBall_sound 17 CA1_2_13I1ResidualEntropies _ CA1_2_13I1ResidualEntropies_sound)) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CA1_2_13I1H : Ball := ⟨(106287052777582950302215642912299 / 100000000000000000000000000000000), (88568176823 / 20000000000000000000000000000000)⟩ +lemma CA1_2_13I1_sound : CA1_2_13I1H.Encloses (stageACapacity (shape 1 2 13) 1) := by + have hb := contains_sound (Ball.add_sound CA1_2_13I1PairH_sound + (Ball.neg_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) CA1_2_13I1Group_sound))) + (show contains (.add CA1_2_13I1PairH (.neg (.mul (.exact 2) CA1_2_13I1Group))) CA1_2_13I1H = true by decide +kernel) + simp only [stageACapacity, nativeCapacity, + show (1 : Fin 3) ≠ 0 by decide, ite_false, sub_eq_add_neg] + exact hb + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA1_2_13I2.lean b/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA1_2_13I2.lean new file mode 100644 index 0000000000000000000000000000000000000000..ae16ce2c865529b04e8f7efc876c15d5634912d0 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA1_2_13I2.lean @@ -0,0 +1,958 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Certificates.SupportedContraction + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CA1_2_13I2PairValue (a : PairSlot × PairSlot) : ℝ := pairLaw (below (shape 1 2 13)) (shape 1 2 13) (fun u => (stageALaw (shape 1 2 13) u : ℝ)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) a +def CA1_2_13I2PairRaw (a : PairSlot × PairSlot) : Ball := stageAPairBall (shape 1 2 13) A1_2_13Law 2 a +lemma CA1_2_13I2PairRaw_sound (a : PairSlot × PairSlot) : + (CA1_2_13I2PairRaw a).Encloses (CA1_2_13I2PairValue a) := by + exact stageAPairBall_sound (shape 1 2 13) (by decide +kernel) A1_2_13Law (fun u => (stageALaw (shape 1 2 13) u : ℝ)) (fun u _ => A1_2_13Law_sound u) 2 a +def CA1_2_13I2PairCertificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(442586390428493077743201299 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(23719548252484822547177113277 / 100000000000000000000000000000000), (1991581 / 25000000000000000000000000000000)⟩ ⟨(-1071860715351892212750556015805041 / 100000000000000000000000000000000), (1799945239 / 500000000000000000000000000000)⟩ ⟨-16, 442586390428493077743201299, 305175781250000000000000000⟩, + .log ⟨(73487247372078367653150166241 / 5000000000000000000000000000000), (7 / 100000000000000000000000000000000)⟩ ⟨(1240488635278793899698860727877 / 20000000000000000000000000000000), (2489844827 / 100000000000000000000000000000000)⟩ ⟨(-422008130539299575952973473557267 / 100000000000000000000000000000000), (8470329497 / 5000000000000000000000000000000)⟩ ⟨-7, 73487247372078367653150166241, 39062500000000000000000000000⟩, + .log ⟨(13559799966062424844924713757 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(407852833492994091090370054029 / 100000000000000000000000000000000), (137827177 / 100000000000000000000000000000000)⟩ ⟨(-751952157321220455269927703992753 / 100000000000000000000000000000000), (254109886039 / 100000000000000000000000000000000)⟩ ⟨-11, 13559799966062424844924713757, 12207031250000000000000000000⟩, + .log ⟨(602160777172434722019253310913 / 25000000000000000000000000000000), (1 / 10000000000000000000000000000000)⟩ ⟨(4487430519244414723671769540491 / 50000000000000000000000000000000), (3570350173 / 100000000000000000000000000000000)⟩ ⟨(-186305331124190541737476037081479 / 50000000000000000000000000000000), (29646153239 / 20000000000000000000000000000000)⟩ ⟨-6, 602160777172434722019253310913, 390625000000000000000000000000⟩, + .log ⟨(93171277412476765128264423973 / 50000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ ⟨(146403261066533712208140456213 / 12500000000000000000000000000000), (86811059 / 20000000000000000000000000000000)⟩ ⟨(-25141355169944859121021011035561 / 4000000000000000000000000000000), (116467030793 / 50000000000000000000000000000000)⟩ ⟨-10, 93171277412476765128264423973, 48828125000000000000000000000⟩, + .log ⟨(914191579685632782275074881523 / 5000000000000000000000000000000), (29 / 100000000000000000000000000000000)⟩ ⟨(3883378495598803084596402029963 / 12500000000000000000000000000000), (7743503921 / 50000000000000000000000000000000)⟩ ⟨(-169915303614334234657882374566849 / 100000000000000000000000000000000), (8470329489 / 10000000000000000000000000000000)⟩ ⟨-3, 914191579685632782275074881523, 625000000000000000000000000000⟩] +lemma CA1_2_13I2PairCertificates_valid : + CA1_2_13I2PairCertificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_2_13I2PairCertificateIndex (a : PairSlot × PairSlot) : ℕ := + match a.1.1.val, a.1.2.val, a.2.1.val, a.2.2.val with + | 5, 5, 5, 1 => 1 + | 5, 5, 4, 2 => 2 + | 5, 5, 4, 3 => 3 + | 5, 5, 2, 4 => 2 + | 5, 5, 3, 4 => 3 + | 5, 5, 1, 5 => 1 + | 4, 5, 5, 2 => 4 + | 4, 5, 5, 3 => 5 + | 4, 5, 4, 4 => 6 + | 4, 5, 2, 5 => 4 + | 4, 5, 3, 5 => 5 + | 5, 4, 5, 2 => 4 + | 5, 4, 5, 3 => 5 + | 5, 4, 4, 4 => 6 + | 5, 4, 2, 5 => 4 + | 5, 4, 3, 5 => 5 + | 2, 5, 4, 5 => 4 + | 2, 5, 5, 4 => 4 + | 3, 5, 4, 5 => 5 + | 3, 5, 5, 4 => 5 + | 4, 4, 4, 5 => 6 + | 4, 4, 5, 4 => 6 + | 5, 2, 4, 5 => 4 + | 5, 2, 5, 4 => 4 + | 5, 3, 4, 5 => 5 + | 5, 3, 5, 4 => 5 + | 5, 1, 5, 5 => 1 + | 4, 2, 5, 5 => 2 + | 4, 3, 5, 5 => 3 + | 2, 4, 5, 5 => 2 + | 3, 4, 5, 5 => 3 + | 1, 5, 5, 5 => 1 + | _, _, _, _ => 0 +def CA1_2_13I2PairP (a : PairSlot × PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_2_13I2PairCertificates (CA1_2_13I2PairCertificateIndex a)).input +lemma CA1_2_13I2PairP_check_0_0 : ∀ k l : Fin 6, contains (CA1_2_13I2PairRaw ((0,0),(k,l))) (CA1_2_13I2PairP ((0,0),(k,l))) = true := by + decide +kernel +lemma CA1_2_13I2PairP_check_0_1 : ∀ k l : Fin 6, contains (CA1_2_13I2PairRaw ((0,1),(k,l))) (CA1_2_13I2PairP ((0,1),(k,l))) = true := by + decide +kernel +lemma CA1_2_13I2PairP_check_0_2 : ∀ k l : Fin 6, contains (CA1_2_13I2PairRaw ((0,2),(k,l))) (CA1_2_13I2PairP ((0,2),(k,l))) = true := by + decide +kernel +lemma CA1_2_13I2PairP_check_0_3 : ∀ k l : Fin 6, contains (CA1_2_13I2PairRaw ((0,3),(k,l))) (CA1_2_13I2PairP ((0,3),(k,l))) = true := by + decide +kernel +lemma CA1_2_13I2PairP_check_0_4 : ∀ k l : Fin 6, contains (CA1_2_13I2PairRaw ((0,4),(k,l))) (CA1_2_13I2PairP ((0,4),(k,l))) = true := by + decide +kernel +lemma CA1_2_13I2PairP_check_0_5 : ∀ k l : Fin 6, contains (CA1_2_13I2PairRaw ((0,5),(k,l))) (CA1_2_13I2PairP ((0,5),(k,l))) = true := by + decide +kernel +lemma CA1_2_13I2PairP_check_1_0 : ∀ k l : Fin 6, contains (CA1_2_13I2PairRaw ((1,0),(k,l))) (CA1_2_13I2PairP ((1,0),(k,l))) = true := by + decide +kernel +lemma CA1_2_13I2PairP_check_1_1 : ∀ k l : Fin 6, contains (CA1_2_13I2PairRaw ((1,1),(k,l))) (CA1_2_13I2PairP ((1,1),(k,l))) = true := by + decide +kernel +lemma CA1_2_13I2PairP_check_1_2 : ∀ k l : Fin 6, contains (CA1_2_13I2PairRaw ((1,2),(k,l))) (CA1_2_13I2PairP ((1,2),(k,l))) = true := by + decide +kernel +lemma CA1_2_13I2PairP_check_1_3 : ∀ k l : Fin 6, contains (CA1_2_13I2PairRaw ((1,3),(k,l))) (CA1_2_13I2PairP ((1,3),(k,l))) = true := by + decide +kernel +lemma CA1_2_13I2PairP_check_1_4 : ∀ k l : Fin 6, contains (CA1_2_13I2PairRaw ((1,4),(k,l))) (CA1_2_13I2PairP ((1,4),(k,l))) = true := by + decide +kernel +lemma CA1_2_13I2PairP_check_1_5 : ∀ k l : Fin 6, contains (CA1_2_13I2PairRaw ((1,5),(k,l))) (CA1_2_13I2PairP ((1,5),(k,l))) = true := by + decide +kernel +lemma CA1_2_13I2PairP_check_2_0 : ∀ k l : Fin 6, contains (CA1_2_13I2PairRaw ((2,0),(k,l))) (CA1_2_13I2PairP ((2,0),(k,l))) = true := by + decide +kernel +lemma CA1_2_13I2PairP_check_2_1 : ∀ k l : Fin 6, contains (CA1_2_13I2PairRaw ((2,1),(k,l))) (CA1_2_13I2PairP ((2,1),(k,l))) = true := by + decide +kernel +lemma CA1_2_13I2PairP_check_2_2 : ∀ k l : Fin 6, contains (CA1_2_13I2PairRaw ((2,2),(k,l))) (CA1_2_13I2PairP ((2,2),(k,l))) = true := by + decide +kernel +lemma CA1_2_13I2PairP_check_2_3 : ∀ k l : Fin 6, contains (CA1_2_13I2PairRaw ((2,3),(k,l))) (CA1_2_13I2PairP ((2,3),(k,l))) = true := by + decide +kernel +lemma CA1_2_13I2PairP_check_2_4 : ∀ k l : Fin 6, contains (CA1_2_13I2PairRaw ((2,4),(k,l))) (CA1_2_13I2PairP ((2,4),(k,l))) = true := by + decide +kernel +lemma CA1_2_13I2PairP_check_2_5 : ∀ k l : Fin 6, contains (CA1_2_13I2PairRaw ((2,5),(k,l))) (CA1_2_13I2PairP ((2,5),(k,l))) = true := by + decide +kernel +lemma CA1_2_13I2PairP_check_3_0 : ∀ k l : Fin 6, contains (CA1_2_13I2PairRaw ((3,0),(k,l))) (CA1_2_13I2PairP ((3,0),(k,l))) = true := by + decide +kernel +lemma CA1_2_13I2PairP_check_3_1 : ∀ k l : Fin 6, contains (CA1_2_13I2PairRaw ((3,1),(k,l))) (CA1_2_13I2PairP ((3,1),(k,l))) = true := by + decide +kernel +lemma CA1_2_13I2PairP_check_3_2 : ∀ k l : Fin 6, contains (CA1_2_13I2PairRaw ((3,2),(k,l))) (CA1_2_13I2PairP ((3,2),(k,l))) = true := by + decide +kernel +lemma CA1_2_13I2PairP_check_3_3 : ∀ k l : Fin 6, contains (CA1_2_13I2PairRaw ((3,3),(k,l))) (CA1_2_13I2PairP ((3,3),(k,l))) = true := by + decide +kernel +lemma CA1_2_13I2PairP_check_3_4 : ∀ k l : Fin 6, contains (CA1_2_13I2PairRaw ((3,4),(k,l))) (CA1_2_13I2PairP ((3,4),(k,l))) = true := by + decide +kernel +lemma CA1_2_13I2PairP_check_3_5 : ∀ k l : Fin 6, contains (CA1_2_13I2PairRaw ((3,5),(k,l))) (CA1_2_13I2PairP ((3,5),(k,l))) = true := by + decide +kernel +lemma CA1_2_13I2PairP_check_4_0 : ∀ k l : Fin 6, contains (CA1_2_13I2PairRaw ((4,0),(k,l))) (CA1_2_13I2PairP ((4,0),(k,l))) = true := by + decide +kernel +lemma CA1_2_13I2PairP_check_4_1 : ∀ k l : Fin 6, contains (CA1_2_13I2PairRaw ((4,1),(k,l))) (CA1_2_13I2PairP ((4,1),(k,l))) = true := by + decide +kernel +lemma CA1_2_13I2PairP_check_4_2 : ∀ k l : Fin 6, contains (CA1_2_13I2PairRaw ((4,2),(k,l))) (CA1_2_13I2PairP ((4,2),(k,l))) = true := by + decide +kernel +lemma CA1_2_13I2PairP_check_4_3 : ∀ k l : Fin 6, contains (CA1_2_13I2PairRaw ((4,3),(k,l))) (CA1_2_13I2PairP ((4,3),(k,l))) = true := by + decide +kernel +lemma CA1_2_13I2PairP_check_4_4 : ∀ k l : Fin 6, contains (CA1_2_13I2PairRaw ((4,4),(k,l))) (CA1_2_13I2PairP ((4,4),(k,l))) = true := by + decide +kernel +lemma CA1_2_13I2PairP_check_4_5 : ∀ k l : Fin 6, contains (CA1_2_13I2PairRaw ((4,5),(k,l))) (CA1_2_13I2PairP ((4,5),(k,l))) = true := by + decide +kernel +lemma CA1_2_13I2PairP_check_5_0 : ∀ k l : Fin 6, contains (CA1_2_13I2PairRaw ((5,0),(k,l))) (CA1_2_13I2PairP ((5,0),(k,l))) = true := by + decide +kernel +lemma CA1_2_13I2PairP_check_5_1 : ∀ k l : Fin 6, contains (CA1_2_13I2PairRaw ((5,1),(k,l))) (CA1_2_13I2PairP ((5,1),(k,l))) = true := by + decide +kernel +lemma CA1_2_13I2PairP_check_5_2 : ∀ k l : Fin 6, contains (CA1_2_13I2PairRaw ((5,2),(k,l))) (CA1_2_13I2PairP ((5,2),(k,l))) = true := by + decide +kernel +lemma CA1_2_13I2PairP_check_5_3 : ∀ k l : Fin 6, contains (CA1_2_13I2PairRaw ((5,3),(k,l))) (CA1_2_13I2PairP ((5,3),(k,l))) = true := by + decide +kernel +lemma CA1_2_13I2PairP_check_5_4 : ∀ k l : Fin 6, contains (CA1_2_13I2PairRaw ((5,4),(k,l))) (CA1_2_13I2PairP ((5,4),(k,l))) = true := by + decide +kernel +lemma CA1_2_13I2PairP_check_5_5 : ∀ k l : Fin 6, contains (CA1_2_13I2PairRaw ((5,5),(k,l))) (CA1_2_13I2PairP ((5,5),(k,l))) = true := by + decide +kernel +lemma CA1_2_13I2PairP_check (a : PairSlot × PairSlot) : contains (CA1_2_13I2PairRaw a) (CA1_2_13I2PairP a) = true := by + rcases a with ⟨⟨i,j⟩,⟨k,l⟩⟩ + revert j i + apply forall_fin6 + · exact forall_fin6 (CA1_2_13I2PairP_check_0_0 k l) (CA1_2_13I2PairP_check_0_1 k l) (CA1_2_13I2PairP_check_0_2 k l) (CA1_2_13I2PairP_check_0_3 k l) (CA1_2_13I2PairP_check_0_4 k l) (CA1_2_13I2PairP_check_0_5 k l) + · exact forall_fin6 (CA1_2_13I2PairP_check_1_0 k l) (CA1_2_13I2PairP_check_1_1 k l) (CA1_2_13I2PairP_check_1_2 k l) (CA1_2_13I2PairP_check_1_3 k l) (CA1_2_13I2PairP_check_1_4 k l) (CA1_2_13I2PairP_check_1_5 k l) + · exact forall_fin6 (CA1_2_13I2PairP_check_2_0 k l) (CA1_2_13I2PairP_check_2_1 k l) (CA1_2_13I2PairP_check_2_2 k l) (CA1_2_13I2PairP_check_2_3 k l) (CA1_2_13I2PairP_check_2_4 k l) (CA1_2_13I2PairP_check_2_5 k l) + · exact forall_fin6 (CA1_2_13I2PairP_check_3_0 k l) (CA1_2_13I2PairP_check_3_1 k l) (CA1_2_13I2PairP_check_3_2 k l) (CA1_2_13I2PairP_check_3_3 k l) (CA1_2_13I2PairP_check_3_4 k l) (CA1_2_13I2PairP_check_3_5 k l) + · exact forall_fin6 (CA1_2_13I2PairP_check_4_0 k l) (CA1_2_13I2PairP_check_4_1 k l) (CA1_2_13I2PairP_check_4_2 k l) (CA1_2_13I2PairP_check_4_3 k l) (CA1_2_13I2PairP_check_4_4 k l) (CA1_2_13I2PairP_check_4_5 k l) + · exact forall_fin6 (CA1_2_13I2PairP_check_5_0 k l) (CA1_2_13I2PairP_check_5_1 k l) (CA1_2_13I2PairP_check_5_2 k l) (CA1_2_13I2PairP_check_5_3 k l) (CA1_2_13I2PairP_check_5_4 k l) (CA1_2_13I2PairP_check_5_5 k l) +lemma CA1_2_13I2PairP_sound (a : PairSlot × PairSlot) : + (CA1_2_13I2PairP a).Encloses (CA1_2_13I2PairValue a) := + contains_sound (CA1_2_13I2PairRaw_sound a) (CA1_2_13I2PairP_check a) +def CA1_2_13I2PairTerms (a : PairSlot × PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_2_13I2PairCertificates (CA1_2_13I2PairCertificateIndex a)).output +lemma CA1_2_13I2PairTerms_sound (a : PairSlot × PairSlot) : + (CA1_2_13I2PairTerms a).Encloses (Foundation.entropyTerm (CA1_2_13I2PairValue a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_2_13I2PairCertificates_valid + (CA1_2_13I2PairCertificateIndex a) (CA1_2_13I2PairP_sound a) +def CA1_2_13I2PairEntropy : Ball := ⟨(57993217776972071378920392507767 / 25000000000000000000000000000000), (13065728553 / 12500000000000000000000000000000)⟩ +lemma CA1_2_13I2PairEntropy_sound : CA1_2_13I2PairEntropy.Encloses (Foundation.finiteEntropy CA1_2_13I2PairValue) := by + exact contains_sound (entropyDoublePair_enclosed CA1_2_13I2PairValue CA1_2_13I2PairTerms CA1_2_13I2PairTerms_sound) (by decide +kernel) +def CA1_2_13I2PairMass : Ball := ⟨(24999999999999999999999999999999 / 25000000000000000000000000000000), (31 / 12500000000000000000000000000000)⟩ +lemma CA1_2_13I2PairMass_sound : CA1_2_13I2PairMass.Encloses (∑ a, CA1_2_13I2PairValue a) := by + exact contains_sound (doublePairSumBall_sound CA1_2_13I2PairP CA1_2_13I2PairValue CA1_2_13I2PairP_sound) (by decide +kernel) +def CA1_2_13I2PairMassTermLogWitness : LogWitness := ⟨-1, 24999999999999999999999999999999, 12500000000000000000000000000000⟩ +def CA1_2_13I2PairMassTermLog : Ball := ⟨(-1 / 25000000000000000000000000000000), (21175823807 / 50000000000000000000000000000000)⟩ +lemma CA1_2_13I2PairMassTermLog_sound : CA1_2_13I2PairMassTermLog.Encloses (Real.log ((∑ a, CA1_2_13I2PairValue a))) := by + exact checkLog_sound logTwoBall_sound (CA1_2_13I2PairMass_sound) (w := CA1_2_13I2PairMassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA1_2_13I2PairMassTerm : Ball := ⟨(1 / 25000000000000000000000000000000), (8470329523 / 20000000000000000000000000000000)⟩ +lemma CA1_2_13I2PairMassTerm_sound : CA1_2_13I2PairMassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_2_13I2PairValue a))) := by + exact contains_sound (entropyTerm_ball (CA1_2_13I2PairMass_sound) CA1_2_13I2PairMassTermLog_sound) (by decide +kernel) +def CA1_2_13I2PairH : Ball := ⟨(28996608888486035689460196253883 / 12500000000000000000000000000000), (146877476039 / 100000000000000000000000000000000)⟩ +lemma CA1_2_13I2PairH_sound : CA1_2_13I2PairH.Encloses (homogeneousEntropy CA1_2_13I2PairValue) := by + exact contains_sound (homogeneous_enclosed CA1_2_13I2PairValue CA1_2_13I2PairMassTerm_sound CA1_2_13I2PairEntropy_sound) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CA1_2_13I2R0Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 2 13)) (fun u => (stageALaw (shape 1 2 13) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 0 a +def CA1_2_13I2R0Raw (a : PairSlot) : Ball := residualBall (below (shape 1 2 13)) A1_2_13Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 0 a +lemma CA1_2_13I2R0Raw_sound (a : PairSlot) : + (CA1_2_13I2R0Raw a).Encloses (CA1_2_13I2R0Value a) := by + exact residualBall_sound_on (below (shape 1 2 13)) A1_2_13Law (fun u => (stageALaw (shape 1 2 13) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A1_2_13Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 2 13) (show (shape 1 2 13) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 0 a +def CA1_2_13I2R0Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA1_2_13I2R0Certificates_valid : + CA1_2_13I2R0Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_2_13I2R0CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA1_2_13I2R0P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_2_13I2R0Certificates (CA1_2_13I2R0CertificateIndex a)).input +lemma CA1_2_13I2R0P_check : ∀ a : PairSlot, contains (CA1_2_13I2R0Raw a) (CA1_2_13I2R0P a) = true := by + decide +kernel +lemma CA1_2_13I2R0P_sound (a : PairSlot) : + (CA1_2_13I2R0P a).Encloses (CA1_2_13I2R0Value a) := + contains_sound (CA1_2_13I2R0Raw_sound a) (CA1_2_13I2R0P_check a) +def CA1_2_13I2R0Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_2_13I2R0Certificates (CA1_2_13I2R0CertificateIndex a)).output +lemma CA1_2_13I2R0Terms_sound (a : PairSlot) : + (CA1_2_13I2R0Terms a).Encloses (Foundation.entropyTerm (CA1_2_13I2R0Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_2_13I2R0Certificates_valid + (CA1_2_13I2R0CertificateIndex a) (CA1_2_13I2R0P_sound a) +def CA1_2_13I2R0Entropy : Ball := ⟨0, 0⟩ +lemma CA1_2_13I2R0Entropy_sound : CA1_2_13I2R0Entropy.Encloses (Foundation.finiteEntropy CA1_2_13I2R0Value) := by + exact contains_sound (entropyPair_enclosed CA1_2_13I2R0Value CA1_2_13I2R0Terms CA1_2_13I2R0Terms_sound) (by decide +kernel) +def CA1_2_13I2R0Mass : Ball := ⟨0, 0⟩ +lemma CA1_2_13I2R0Mass_sound : CA1_2_13I2R0Mass.Encloses (∑ a, CA1_2_13I2R0Value a) := by + exact contains_sound (pairSumBall_sound CA1_2_13I2R0P CA1_2_13I2R0Value CA1_2_13I2R0P_sound) (by decide +kernel) +def CA1_2_13I2R0MassTerm : Ball := .exact 0 +lemma CA1_2_13I2R0MassTerm_sound : CA1_2_13I2R0MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_2_13I2R0Value a))) := + entropyTerm_zero_ball (CA1_2_13I2R0Mass_sound) +def CA1_2_13I2R0H : Ball := ⟨0, 0⟩ +lemma CA1_2_13I2R0H_sound : CA1_2_13I2R0H.Encloses (homogeneousEntropy CA1_2_13I2R0Value) := by + exact contains_sound (homogeneous_enclosed CA1_2_13I2R0Value CA1_2_13I2R0MassTerm_sound CA1_2_13I2R0Entropy_sound) (by decide +kernel) +def CA1_2_13I2R1Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 2 13)) (fun u => (stageALaw (shape 1 2 13) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 1 a +def CA1_2_13I2R1Raw (a : PairSlot) : Ball := residualBall (below (shape 1 2 13)) A1_2_13Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 1 a +lemma CA1_2_13I2R1Raw_sound (a : PairSlot) : + (CA1_2_13I2R1Raw a).Encloses (CA1_2_13I2R1Value a) := by + exact residualBall_sound_on (below (shape 1 2 13)) A1_2_13Law (fun u => (stageALaw (shape 1 2 13) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A1_2_13Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 2 13) (show (shape 1 2 13) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 1 a +def CA1_2_13I2R1Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA1_2_13I2R1Certificates_valid : + CA1_2_13I2R1Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_2_13I2R1CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA1_2_13I2R1P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_2_13I2R1Certificates (CA1_2_13I2R1CertificateIndex a)).input +lemma CA1_2_13I2R1P_check : ∀ a : PairSlot, contains (CA1_2_13I2R1Raw a) (CA1_2_13I2R1P a) = true := by + decide +kernel +lemma CA1_2_13I2R1P_sound (a : PairSlot) : + (CA1_2_13I2R1P a).Encloses (CA1_2_13I2R1Value a) := + contains_sound (CA1_2_13I2R1Raw_sound a) (CA1_2_13I2R1P_check a) +def CA1_2_13I2R1Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_2_13I2R1Certificates (CA1_2_13I2R1CertificateIndex a)).output +lemma CA1_2_13I2R1Terms_sound (a : PairSlot) : + (CA1_2_13I2R1Terms a).Encloses (Foundation.entropyTerm (CA1_2_13I2R1Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_2_13I2R1Certificates_valid + (CA1_2_13I2R1CertificateIndex a) (CA1_2_13I2R1P_sound a) +def CA1_2_13I2R1Entropy : Ball := ⟨0, 0⟩ +lemma CA1_2_13I2R1Entropy_sound : CA1_2_13I2R1Entropy.Encloses (Foundation.finiteEntropy CA1_2_13I2R1Value) := by + exact contains_sound (entropyPair_enclosed CA1_2_13I2R1Value CA1_2_13I2R1Terms CA1_2_13I2R1Terms_sound) (by decide +kernel) +def CA1_2_13I2R1Mass : Ball := ⟨0, 0⟩ +lemma CA1_2_13I2R1Mass_sound : CA1_2_13I2R1Mass.Encloses (∑ a, CA1_2_13I2R1Value a) := by + exact contains_sound (pairSumBall_sound CA1_2_13I2R1P CA1_2_13I2R1Value CA1_2_13I2R1P_sound) (by decide +kernel) +def CA1_2_13I2R1MassTerm : Ball := .exact 0 +lemma CA1_2_13I2R1MassTerm_sound : CA1_2_13I2R1MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_2_13I2R1Value a))) := + entropyTerm_zero_ball (CA1_2_13I2R1Mass_sound) +def CA1_2_13I2R1H : Ball := ⟨0, 0⟩ +lemma CA1_2_13I2R1H_sound : CA1_2_13I2R1H.Encloses (homogeneousEntropy CA1_2_13I2R1Value) := by + exact contains_sound (homogeneous_enclosed CA1_2_13I2R1Value CA1_2_13I2R1MassTerm_sound CA1_2_13I2R1Entropy_sound) (by decide +kernel) +def CA1_2_13I2R2Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 2 13)) (fun u => (stageALaw (shape 1 2 13) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 2 a +def CA1_2_13I2R2Raw (a : PairSlot) : Ball := residualBall (below (shape 1 2 13)) A1_2_13Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 2 a +lemma CA1_2_13I2R2Raw_sound (a : PairSlot) : + (CA1_2_13I2R2Raw a).Encloses (CA1_2_13I2R2Value a) := by + exact residualBall_sound_on (below (shape 1 2 13)) A1_2_13Law (fun u => (stageALaw (shape 1 2 13) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A1_2_13Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 2 13) (show (shape 1 2 13) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 2 a +def CA1_2_13I2R2Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA1_2_13I2R2Certificates_valid : + CA1_2_13I2R2Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_2_13I2R2CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA1_2_13I2R2P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_2_13I2R2Certificates (CA1_2_13I2R2CertificateIndex a)).input +lemma CA1_2_13I2R2P_check : ∀ a : PairSlot, contains (CA1_2_13I2R2Raw a) (CA1_2_13I2R2P a) = true := by + decide +kernel +lemma CA1_2_13I2R2P_sound (a : PairSlot) : + (CA1_2_13I2R2P a).Encloses (CA1_2_13I2R2Value a) := + contains_sound (CA1_2_13I2R2Raw_sound a) (CA1_2_13I2R2P_check a) +def CA1_2_13I2R2Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_2_13I2R2Certificates (CA1_2_13I2R2CertificateIndex a)).output +lemma CA1_2_13I2R2Terms_sound (a : PairSlot) : + (CA1_2_13I2R2Terms a).Encloses (Foundation.entropyTerm (CA1_2_13I2R2Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_2_13I2R2Certificates_valid + (CA1_2_13I2R2CertificateIndex a) (CA1_2_13I2R2P_sound a) +def CA1_2_13I2R2Entropy : Ball := ⟨0, 0⟩ +lemma CA1_2_13I2R2Entropy_sound : CA1_2_13I2R2Entropy.Encloses (Foundation.finiteEntropy CA1_2_13I2R2Value) := by + exact contains_sound (entropyPair_enclosed CA1_2_13I2R2Value CA1_2_13I2R2Terms CA1_2_13I2R2Terms_sound) (by decide +kernel) +def CA1_2_13I2R2Mass : Ball := ⟨0, 0⟩ +lemma CA1_2_13I2R2Mass_sound : CA1_2_13I2R2Mass.Encloses (∑ a, CA1_2_13I2R2Value a) := by + exact contains_sound (pairSumBall_sound CA1_2_13I2R2P CA1_2_13I2R2Value CA1_2_13I2R2P_sound) (by decide +kernel) +def CA1_2_13I2R2MassTerm : Ball := .exact 0 +lemma CA1_2_13I2R2MassTerm_sound : CA1_2_13I2R2MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_2_13I2R2Value a))) := + entropyTerm_zero_ball (CA1_2_13I2R2Mass_sound) +def CA1_2_13I2R2H : Ball := ⟨0, 0⟩ +lemma CA1_2_13I2R2H_sound : CA1_2_13I2R2H.Encloses (homogeneousEntropy CA1_2_13I2R2Value) := by + exact contains_sound (homogeneous_enclosed CA1_2_13I2R2Value CA1_2_13I2R2MassTerm_sound CA1_2_13I2R2Entropy_sound) (by decide +kernel) +def CA1_2_13I2R3Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 2 13)) (fun u => (stageALaw (shape 1 2 13) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 3 a +def CA1_2_13I2R3Raw (a : PairSlot) : Ball := residualBall (below (shape 1 2 13)) A1_2_13Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 3 a +lemma CA1_2_13I2R3Raw_sound (a : PairSlot) : + (CA1_2_13I2R3Raw a).Encloses (CA1_2_13I2R3Value a) := by + exact residualBall_sound_on (below (shape 1 2 13)) A1_2_13Law (fun u => (stageALaw (shape 1 2 13) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A1_2_13Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 2 13) (show (shape 1 2 13) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 3 a +def CA1_2_13I2R3Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA1_2_13I2R3Certificates_valid : + CA1_2_13I2R3Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_2_13I2R3CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA1_2_13I2R3P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_2_13I2R3Certificates (CA1_2_13I2R3CertificateIndex a)).input +lemma CA1_2_13I2R3P_check : ∀ a : PairSlot, contains (CA1_2_13I2R3Raw a) (CA1_2_13I2R3P a) = true := by + decide +kernel +lemma CA1_2_13I2R3P_sound (a : PairSlot) : + (CA1_2_13I2R3P a).Encloses (CA1_2_13I2R3Value a) := + contains_sound (CA1_2_13I2R3Raw_sound a) (CA1_2_13I2R3P_check a) +def CA1_2_13I2R3Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_2_13I2R3Certificates (CA1_2_13I2R3CertificateIndex a)).output +lemma CA1_2_13I2R3Terms_sound (a : PairSlot) : + (CA1_2_13I2R3Terms a).Encloses (Foundation.entropyTerm (CA1_2_13I2R3Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_2_13I2R3Certificates_valid + (CA1_2_13I2R3CertificateIndex a) (CA1_2_13I2R3P_sound a) +def CA1_2_13I2R3Entropy : Ball := ⟨0, 0⟩ +lemma CA1_2_13I2R3Entropy_sound : CA1_2_13I2R3Entropy.Encloses (Foundation.finiteEntropy CA1_2_13I2R3Value) := by + exact contains_sound (entropyPair_enclosed CA1_2_13I2R3Value CA1_2_13I2R3Terms CA1_2_13I2R3Terms_sound) (by decide +kernel) +def CA1_2_13I2R3Mass : Ball := ⟨0, 0⟩ +lemma CA1_2_13I2R3Mass_sound : CA1_2_13I2R3Mass.Encloses (∑ a, CA1_2_13I2R3Value a) := by + exact contains_sound (pairSumBall_sound CA1_2_13I2R3P CA1_2_13I2R3Value CA1_2_13I2R3P_sound) (by decide +kernel) +def CA1_2_13I2R3MassTerm : Ball := .exact 0 +lemma CA1_2_13I2R3MassTerm_sound : CA1_2_13I2R3MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_2_13I2R3Value a))) := + entropyTerm_zero_ball (CA1_2_13I2R3Mass_sound) +def CA1_2_13I2R3H : Ball := ⟨0, 0⟩ +lemma CA1_2_13I2R3H_sound : CA1_2_13I2R3H.Encloses (homogeneousEntropy CA1_2_13I2R3Value) := by + exact contains_sound (homogeneous_enclosed CA1_2_13I2R3Value CA1_2_13I2R3MassTerm_sound CA1_2_13I2R3Entropy_sound) (by decide +kernel) +def CA1_2_13I2R4Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 2 13)) (fun u => (stageALaw (shape 1 2 13) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 4 a +def CA1_2_13I2R4Raw (a : PairSlot) : Ball := residualBall (below (shape 1 2 13)) A1_2_13Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 4 a +lemma CA1_2_13I2R4Raw_sound (a : PairSlot) : + (CA1_2_13I2R4Raw a).Encloses (CA1_2_13I2R4Value a) := by + exact residualBall_sound_on (below (shape 1 2 13)) A1_2_13Law (fun u => (stageALaw (shape 1 2 13) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A1_2_13Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 2 13) (show (shape 1 2 13) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 4 a +def CA1_2_13I2R4Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA1_2_13I2R4Certificates_valid : + CA1_2_13I2R4Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_2_13I2R4CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA1_2_13I2R4P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_2_13I2R4Certificates (CA1_2_13I2R4CertificateIndex a)).input +lemma CA1_2_13I2R4P_check : ∀ a : PairSlot, contains (CA1_2_13I2R4Raw a) (CA1_2_13I2R4P a) = true := by + decide +kernel +lemma CA1_2_13I2R4P_sound (a : PairSlot) : + (CA1_2_13I2R4P a).Encloses (CA1_2_13I2R4Value a) := + contains_sound (CA1_2_13I2R4Raw_sound a) (CA1_2_13I2R4P_check a) +def CA1_2_13I2R4Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_2_13I2R4Certificates (CA1_2_13I2R4CertificateIndex a)).output +lemma CA1_2_13I2R4Terms_sound (a : PairSlot) : + (CA1_2_13I2R4Terms a).Encloses (Foundation.entropyTerm (CA1_2_13I2R4Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_2_13I2R4Certificates_valid + (CA1_2_13I2R4CertificateIndex a) (CA1_2_13I2R4P_sound a) +def CA1_2_13I2R4Entropy : Ball := ⟨0, 0⟩ +lemma CA1_2_13I2R4Entropy_sound : CA1_2_13I2R4Entropy.Encloses (Foundation.finiteEntropy CA1_2_13I2R4Value) := by + exact contains_sound (entropyPair_enclosed CA1_2_13I2R4Value CA1_2_13I2R4Terms CA1_2_13I2R4Terms_sound) (by decide +kernel) +def CA1_2_13I2R4Mass : Ball := ⟨0, 0⟩ +lemma CA1_2_13I2R4Mass_sound : CA1_2_13I2R4Mass.Encloses (∑ a, CA1_2_13I2R4Value a) := by + exact contains_sound (pairSumBall_sound CA1_2_13I2R4P CA1_2_13I2R4Value CA1_2_13I2R4P_sound) (by decide +kernel) +def CA1_2_13I2R4MassTerm : Ball := .exact 0 +lemma CA1_2_13I2R4MassTerm_sound : CA1_2_13I2R4MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_2_13I2R4Value a))) := + entropyTerm_zero_ball (CA1_2_13I2R4Mass_sound) +def CA1_2_13I2R4H : Ball := ⟨0, 0⟩ +lemma CA1_2_13I2R4H_sound : CA1_2_13I2R4H.Encloses (homogeneousEntropy CA1_2_13I2R4Value) := by + exact contains_sound (homogeneous_enclosed CA1_2_13I2R4Value CA1_2_13I2R4MassTerm_sound CA1_2_13I2R4Entropy_sound) (by decide +kernel) +def CA1_2_13I2R5Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 2 13)) (fun u => (stageALaw (shape 1 2 13) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 5 a +def CA1_2_13I2R5Raw (a : PairSlot) : Ball := residualBall (below (shape 1 2 13)) A1_2_13Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 5 a +lemma CA1_2_13I2R5Raw_sound (a : PairSlot) : + (CA1_2_13I2R5Raw a).Encloses (CA1_2_13I2R5Value a) := by + exact residualBall_sound_on (below (shape 1 2 13)) A1_2_13Law (fun u => (stageALaw (shape 1 2 13) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A1_2_13Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 2 13) (show (shape 1 2 13) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 5 a +def CA1_2_13I2R5Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(442586390428493077743201299 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(23719548252484822547177113277 / 100000000000000000000000000000000), (1991581 / 25000000000000000000000000000000)⟩ ⟨(-1071860715351892212750556015805041 / 100000000000000000000000000000000), (1799945239 / 500000000000000000000000000000)⟩ ⟨-16, 442586390428493077743201299, 305175781250000000000000000⟩, + .log ⟨(73487247372078367653150166241 / 5000000000000000000000000000000), (7 / 100000000000000000000000000000000)⟩ ⟨(1240488635278793899698860727877 / 20000000000000000000000000000000), (2489844827 / 100000000000000000000000000000000)⟩ ⟨(-422008130539299575952973473557267 / 100000000000000000000000000000000), (8470329497 / 5000000000000000000000000000000)⟩ ⟨-7, 73487247372078367653150166241, 39062500000000000000000000000⟩, + .log ⟨(13559799966062424844924713757 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(407852833492994091090370054029 / 100000000000000000000000000000000), (137827177 / 100000000000000000000000000000000)⟩ ⟨(-751952157321220455269927703992753 / 100000000000000000000000000000000), (254109886039 / 100000000000000000000000000000000)⟩ ⟨-11, 13559799966062424844924713757, 12207031250000000000000000000⟩] +lemma CA1_2_13I2R5Certificates_valid : + CA1_2_13I2R5Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_2_13I2R5CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 5, 1 => 1 + | 4, 2 => 2 + | 4, 3 => 3 + | 2, 4 => 2 + | 3, 4 => 3 + | 1, 5 => 1 + | _, _ => 0 +def CA1_2_13I2R5P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_2_13I2R5Certificates (CA1_2_13I2R5CertificateIndex a)).input +lemma CA1_2_13I2R5P_check : ∀ a : PairSlot, contains (CA1_2_13I2R5Raw a) (CA1_2_13I2R5P a) = true := by + decide +kernel +lemma CA1_2_13I2R5P_sound (a : PairSlot) : + (CA1_2_13I2R5P a).Encloses (CA1_2_13I2R5Value a) := + contains_sound (CA1_2_13I2R5Raw_sound a) (CA1_2_13I2R5P_check a) +def CA1_2_13I2R5Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_2_13I2R5Certificates (CA1_2_13I2R5CertificateIndex a)).output +lemma CA1_2_13I2R5Terms_sound (a : PairSlot) : + (CA1_2_13I2R5Terms a).Encloses (Foundation.entropyTerm (CA1_2_13I2R5Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_2_13I2R5Certificates_valid + (CA1_2_13I2R5CertificateIndex a) (CA1_2_13I2R5P_sound a) +def CA1_2_13I2R5Entropy : Ball := ⟨(6634015558139448412131850806691 / 50000000000000000000000000000000), (329454791 / 6250000000000000000000000000000)⟩ +lemma CA1_2_13I2R5Entropy_sound : CA1_2_13I2R5Entropy.Encloses (Foundation.finiteEntropy CA1_2_13I2R5Value) := by + exact contains_sound (entropyPair_enclosed CA1_2_13I2R5Value CA1_2_13I2R5Terms CA1_2_13I2R5Terms_sound) (by decide +kernel) +def CA1_2_13I2R5Mass : Ball := ⟨(1526197079257959517831418186343 / 50000000000000000000000000000000), (9 / 50000000000000000000000000000000)⟩ +lemma CA1_2_13I2R5Mass_sound : CA1_2_13I2R5Mass.Encloses (∑ a, CA1_2_13I2R5Value a) := by + exact contains_sound (pairSumBall_sound CA1_2_13I2R5P CA1_2_13I2R5Value CA1_2_13I2R5P_sound) (by decide +kernel) +def CA1_2_13I2R5MassTermLogWitness : LogWitness := ⟨-6, 1526197079257959517831418186343, 781250000000000000000000000000⟩ +def CA1_2_13I2R5MassTermLog : Ball := ⟨(-43615549166142176302494797824791 / 12500000000000000000000000000000), (148230766371 / 100000000000000000000000000000000)⟩ +lemma CA1_2_13I2R5MassTermLog_sound : CA1_2_13I2R5MassTermLog.Encloses (Real.log ((∑ a, CA1_2_13I2R5Value a))) := by + exact checkLog_sound logTwoBall_sound (CA1_2_13I2R5Mass_sound) (w := CA1_2_13I2R5MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA1_2_13I2R5MassTerm : Ball := ⟨(2130109559923139878541476166057 / 20000000000000000000000000000000), (4524587317 / 100000000000000000000000000000000)⟩ +lemma CA1_2_13I2R5MassTerm_sound : CA1_2_13I2R5MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_2_13I2R5Value a))) := by + exact contains_sound (entropyTerm_ball (CA1_2_13I2R5Mass_sound) CA1_2_13I2R5MassTermLog_sound) (by decide +kernel) +def CA1_2_13I2R5H : Ball := ⟨(2617483316663197431556320783097 / 100000000000000000000000000000000), (9795863973 / 100000000000000000000000000000000)⟩ +lemma CA1_2_13I2R5H_sound : CA1_2_13I2R5H.Encloses (homogeneousEntropy CA1_2_13I2R5Value) := by + exact contains_sound (homogeneous_enclosed CA1_2_13I2R5Value CA1_2_13I2R5MassTerm_sound CA1_2_13I2R5Entropy_sound) (by decide +kernel) +def CA1_2_13I2R6Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 2 13)) (fun u => (stageALaw (shape 1 2 13) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 6 a +def CA1_2_13I2R6Raw (a : PairSlot) : Ball := residualBall (below (shape 1 2 13)) A1_2_13Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 6 a +lemma CA1_2_13I2R6Raw_sound (a : PairSlot) : + (CA1_2_13I2R6Raw a).Encloses (CA1_2_13I2R6Value a) := by + exact residualBall_sound_on (below (shape 1 2 13)) A1_2_13Law (fun u => (stageALaw (shape 1 2 13) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A1_2_13Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 2 13) (show (shape 1 2 13) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 6 a +def CA1_2_13I2R6Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(216432004712731669553203427467 / 100000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ ⟨(663975410196592757437400918067 / 50000000000000000000000000000000), (114578153 / 25000000000000000000000000000000)⟩ ⟨(-76695612910609221632260488966757 / 12500000000000000000000000000000), (211758237753 / 100000000000000000000000000000000)⟩ ⟨-9, 216432004712731669553203427467, 195312500000000000000000000000⟩, + .log ⟨(13636075369650383155990643 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(53889639849187088294317631 / 25000000000000000000000000000000), (69319 / 100000000000000000000000000000000)⟩ ⟨(-1580796186243689579385450323206413 / 100000000000000000000000000000000), (12705677547 / 2500000000000000000000000000000)⟩ ⟨-23, 13636075369650383155990643, 11920928955078125000000000⟩, + .log ⟨(5673674538352808081287275234243 / 25000000000000000000000000000000), (1 / 5000000000000000000000000000000)⟩ ⟨(33657119057436050543472652170287 / 100000000000000000000000000000000), (4805789279 / 25000000000000000000000000000000)⟩ ⟨(-148303885030420906822516939407071 / 100000000000000000000000000000000), (4235164741 / 5000000000000000000000000000000)⟩ ⟨-3, 5673674538352808081287275234243, 3125000000000000000000000000000⟩] +lemma CA1_2_13I2R6Certificates_valid : + CA1_2_13I2R6Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_2_13I2R6CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 5, 2 => 1 + | 5, 3 => 2 + | 4, 4 => 3 + | 2, 5 => 1 + | 3, 5 => 2 + | _, _ => 0 +def CA1_2_13I2R6P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_2_13I2R6Certificates (CA1_2_13I2R6CertificateIndex a)).input +lemma CA1_2_13I2R6P_check : ∀ a : PairSlot, contains (CA1_2_13I2R6Raw a) (CA1_2_13I2R6P a) = true := by + decide +kernel +lemma CA1_2_13I2R6P_sound (a : PairSlot) : + (CA1_2_13I2R6P a).Encloses (CA1_2_13I2R6Value a) := + contains_sound (CA1_2_13I2R6Raw_sound a) (CA1_2_13I2R6P_check a) +def CA1_2_13I2R6Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_2_13I2R6Certificates (CA1_2_13I2R6CertificateIndex a)).output +lemma CA1_2_13I2R6Terms_sound (a : PairSlot) : + (CA1_2_13I2R6Terms a).Encloses (Foundation.entropyTerm (CA1_2_13I2R6Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_2_13I2R6Certificates_valid + (CA1_2_13I2R6CertificateIndex a) (CA1_2_13I2R6P_sound a) +def CA1_2_13I2R6Entropy : Ball := ⟨(36313451815341215069928610383603 / 100000000000000000000000000000000), (10069960489 / 50000000000000000000000000000000)⟩ +lemma CA1_2_13I2R6Entropy_sound : CA1_2_13I2R6Entropy.Encloses (Foundation.finiteEntropy CA1_2_13I2R6Value) := by + exact contains_sound (entropyPair_enclosed CA1_2_13I2R6Value CA1_2_13I2R6Terms CA1_2_13I2R6Terms_sound) (by decide +kernel) +def CA1_2_13I2R6Mass : Ball := ⟨(2890948679373429370627727471649 / 12500000000000000000000000000000), (13 / 50000000000000000000000000000000)⟩ +lemma CA1_2_13I2R6Mass_sound : CA1_2_13I2R6Mass.Encloses (∑ a, CA1_2_13I2R6Value a) := by + exact contains_sound (pairSumBall_sound CA1_2_13I2R6P CA1_2_13I2R6Value CA1_2_13I2R6P_sound) (by decide +kernel) +def CA1_2_13I2R6MassTermLogWitness : LogWitness := ⟨-3, 2890948679373429370627727471649, 1562500000000000000000000000000⟩ +def CA1_2_13I2R6MassTermLog : Ball := ⟨(-146414393329137410419958436008693 / 100000000000000000000000000000000), (21175823711 / 25000000000000000000000000000000)⟩ +lemma CA1_2_13I2R6MassTermLog_sound : CA1_2_13I2R6MassTermLog.Encloses (Real.log ((∑ a, CA1_2_13I2R6Value a))) := by + exact checkLog_sound logTwoBall_sound (CA1_2_13I2R6Mass_sound) (w := CA1_2_13I2R6MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA1_2_13I2R6MassTerm : Ball := ⟨(6772423952578106297836799977093 / 20000000000000000000000000000000), (4897457577 / 25000000000000000000000000000000)⟩ +lemma CA1_2_13I2R6MassTerm_sound : CA1_2_13I2R6MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_2_13I2R6Value a))) := by + exact contains_sound (entropyTerm_ball (CA1_2_13I2R6Mass_sound) CA1_2_13I2R6MassTermLog_sound) (by decide +kernel) +def CA1_2_13I2R6H : Ball := ⟨(1225666026225341790372305249069 / 50000000000000000000000000000000), (19864875643 / 50000000000000000000000000000000)⟩ +lemma CA1_2_13I2R6H_sound : CA1_2_13I2R6H.Encloses (homogeneousEntropy CA1_2_13I2R6Value) := by + exact contains_sound (homogeneous_enclosed CA1_2_13I2R6Value CA1_2_13I2R6MassTerm_sound CA1_2_13I2R6Entropy_sound) (by decide +kernel) +def CA1_2_13I2R7Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 2 13)) (fun u => (stageALaw (shape 1 2 13) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 7 a +def CA1_2_13I2R7Raw (a : PairSlot) : Ball := residualBall (below (shape 1 2 13)) A1_2_13Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 7 a +lemma CA1_2_13I2R7Raw_sound (a : PairSlot) : + (CA1_2_13I2R7Raw a).Encloses (CA1_2_13I2R7Value a) := by + exact residualBall_sound_on (below (shape 1 2 13)) A1_2_13Law (fun u => (stageALaw (shape 1 2 13) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A1_2_13Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 2 13) (show (shape 1 2 13) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 7 a +def CA1_2_13I2R7Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA1_2_13I2R7Certificates_valid : + CA1_2_13I2R7Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_2_13I2R7CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA1_2_13I2R7P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_2_13I2R7Certificates (CA1_2_13I2R7CertificateIndex a)).input +lemma CA1_2_13I2R7P_check : ∀ a : PairSlot, contains (CA1_2_13I2R7Raw a) (CA1_2_13I2R7P a) = true := by + decide +kernel +lemma CA1_2_13I2R7P_sound (a : PairSlot) : + (CA1_2_13I2R7P a).Encloses (CA1_2_13I2R7Value a) := + contains_sound (CA1_2_13I2R7Raw_sound a) (CA1_2_13I2R7P_check a) +def CA1_2_13I2R7Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_2_13I2R7Certificates (CA1_2_13I2R7CertificateIndex a)).output +lemma CA1_2_13I2R7Terms_sound (a : PairSlot) : + (CA1_2_13I2R7Terms a).Encloses (Foundation.entropyTerm (CA1_2_13I2R7Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_2_13I2R7Certificates_valid + (CA1_2_13I2R7CertificateIndex a) (CA1_2_13I2R7P_sound a) +def CA1_2_13I2R7Entropy : Ball := ⟨0, 0⟩ +lemma CA1_2_13I2R7Entropy_sound : CA1_2_13I2R7Entropy.Encloses (Foundation.finiteEntropy CA1_2_13I2R7Value) := by + exact contains_sound (entropyPair_enclosed CA1_2_13I2R7Value CA1_2_13I2R7Terms CA1_2_13I2R7Terms_sound) (by decide +kernel) +def CA1_2_13I2R7Mass : Ball := ⟨0, 0⟩ +lemma CA1_2_13I2R7Mass_sound : CA1_2_13I2R7Mass.Encloses (∑ a, CA1_2_13I2R7Value a) := by + exact contains_sound (pairSumBall_sound CA1_2_13I2R7P CA1_2_13I2R7Value CA1_2_13I2R7P_sound) (by decide +kernel) +def CA1_2_13I2R7MassTerm : Ball := .exact 0 +lemma CA1_2_13I2R7MassTerm_sound : CA1_2_13I2R7MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_2_13I2R7Value a))) := + entropyTerm_zero_ball (CA1_2_13I2R7Mass_sound) +def CA1_2_13I2R7H : Ball := ⟨0, 0⟩ +lemma CA1_2_13I2R7H_sound : CA1_2_13I2R7H.Encloses (homogeneousEntropy CA1_2_13I2R7Value) := by + exact contains_sound (homogeneous_enclosed CA1_2_13I2R7Value CA1_2_13I2R7MassTerm_sound CA1_2_13I2R7Entropy_sound) (by decide +kernel) +def CA1_2_13I2R8Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 2 13)) (fun u => (stageALaw (shape 1 2 13) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 8 a +def CA1_2_13I2R8Raw (a : PairSlot) : Ball := residualBall (below (shape 1 2 13)) A1_2_13Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 8 a +lemma CA1_2_13I2R8Raw_sound (a : PairSlot) : + (CA1_2_13I2R8Raw a).Encloses (CA1_2_13I2R8Value a) := by + exact residualBall_sound_on (below (shape 1 2 13)) A1_2_13Law (fun u => (stageALaw (shape 1 2 13) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A1_2_13Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 2 13) (show (shape 1 2 13) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 8 a +def CA1_2_13I2R8Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA1_2_13I2R8Certificates_valid : + CA1_2_13I2R8Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_2_13I2R8CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA1_2_13I2R8P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_2_13I2R8Certificates (CA1_2_13I2R8CertificateIndex a)).input +lemma CA1_2_13I2R8P_check : ∀ a : PairSlot, contains (CA1_2_13I2R8Raw a) (CA1_2_13I2R8P a) = true := by + decide +kernel +lemma CA1_2_13I2R8P_sound (a : PairSlot) : + (CA1_2_13I2R8P a).Encloses (CA1_2_13I2R8Value a) := + contains_sound (CA1_2_13I2R8Raw_sound a) (CA1_2_13I2R8P_check a) +def CA1_2_13I2R8Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_2_13I2R8Certificates (CA1_2_13I2R8CertificateIndex a)).output +lemma CA1_2_13I2R8Terms_sound (a : PairSlot) : + (CA1_2_13I2R8Terms a).Encloses (Foundation.entropyTerm (CA1_2_13I2R8Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_2_13I2R8Certificates_valid + (CA1_2_13I2R8CertificateIndex a) (CA1_2_13I2R8P_sound a) +def CA1_2_13I2R8Entropy : Ball := ⟨0, 0⟩ +lemma CA1_2_13I2R8Entropy_sound : CA1_2_13I2R8Entropy.Encloses (Foundation.finiteEntropy CA1_2_13I2R8Value) := by + exact contains_sound (entropyPair_enclosed CA1_2_13I2R8Value CA1_2_13I2R8Terms CA1_2_13I2R8Terms_sound) (by decide +kernel) +def CA1_2_13I2R8Mass : Ball := ⟨0, 0⟩ +lemma CA1_2_13I2R8Mass_sound : CA1_2_13I2R8Mass.Encloses (∑ a, CA1_2_13I2R8Value a) := by + exact contains_sound (pairSumBall_sound CA1_2_13I2R8P CA1_2_13I2R8Value CA1_2_13I2R8P_sound) (by decide +kernel) +def CA1_2_13I2R8MassTerm : Ball := .exact 0 +lemma CA1_2_13I2R8MassTerm_sound : CA1_2_13I2R8MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_2_13I2R8Value a))) := + entropyTerm_zero_ball (CA1_2_13I2R8Mass_sound) +def CA1_2_13I2R8H : Ball := ⟨0, 0⟩ +lemma CA1_2_13I2R8H_sound : CA1_2_13I2R8H.Encloses (homogeneousEntropy CA1_2_13I2R8Value) := by + exact contains_sound (homogeneous_enclosed CA1_2_13I2R8Value CA1_2_13I2R8MassTerm_sound CA1_2_13I2R8Entropy_sound) (by decide +kernel) +def CA1_2_13I2R9Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 2 13)) (fun u => (stageALaw (shape 1 2 13) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 9 a +def CA1_2_13I2R9Raw (a : PairSlot) : Ball := residualBall (below (shape 1 2 13)) A1_2_13Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 9 a +lemma CA1_2_13I2R9Raw_sound (a : PairSlot) : + (CA1_2_13I2R9Raw a).Encloses (CA1_2_13I2R9Value a) := by + exact residualBall_sound_on (below (shape 1 2 13)) A1_2_13Law (fun u => (stageALaw (shape 1 2 13) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A1_2_13Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 2 13) (show (shape 1 2 13) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 9 a +def CA1_2_13I2R9Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA1_2_13I2R9Certificates_valid : + CA1_2_13I2R9Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_2_13I2R9CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA1_2_13I2R9P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_2_13I2R9Certificates (CA1_2_13I2R9CertificateIndex a)).input +lemma CA1_2_13I2R9P_check : ∀ a : PairSlot, contains (CA1_2_13I2R9Raw a) (CA1_2_13I2R9P a) = true := by + decide +kernel +lemma CA1_2_13I2R9P_sound (a : PairSlot) : + (CA1_2_13I2R9P a).Encloses (CA1_2_13I2R9Value a) := + contains_sound (CA1_2_13I2R9Raw_sound a) (CA1_2_13I2R9P_check a) +def CA1_2_13I2R9Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_2_13I2R9Certificates (CA1_2_13I2R9CertificateIndex a)).output +lemma CA1_2_13I2R9Terms_sound (a : PairSlot) : + (CA1_2_13I2R9Terms a).Encloses (Foundation.entropyTerm (CA1_2_13I2R9Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_2_13I2R9Certificates_valid + (CA1_2_13I2R9CertificateIndex a) (CA1_2_13I2R9P_sound a) +def CA1_2_13I2R9Entropy : Ball := ⟨0, 0⟩ +lemma CA1_2_13I2R9Entropy_sound : CA1_2_13I2R9Entropy.Encloses (Foundation.finiteEntropy CA1_2_13I2R9Value) := by + exact contains_sound (entropyPair_enclosed CA1_2_13I2R9Value CA1_2_13I2R9Terms CA1_2_13I2R9Terms_sound) (by decide +kernel) +def CA1_2_13I2R9Mass : Ball := ⟨0, 0⟩ +lemma CA1_2_13I2R9Mass_sound : CA1_2_13I2R9Mass.Encloses (∑ a, CA1_2_13I2R9Value a) := by + exact contains_sound (pairSumBall_sound CA1_2_13I2R9P CA1_2_13I2R9Value CA1_2_13I2R9P_sound) (by decide +kernel) +def CA1_2_13I2R9MassTerm : Ball := .exact 0 +lemma CA1_2_13I2R9MassTerm_sound : CA1_2_13I2R9MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_2_13I2R9Value a))) := + entropyTerm_zero_ball (CA1_2_13I2R9Mass_sound) +def CA1_2_13I2R9H : Ball := ⟨0, 0⟩ +lemma CA1_2_13I2R9H_sound : CA1_2_13I2R9H.Encloses (homogeneousEntropy CA1_2_13I2R9Value) := by + exact contains_sound (homogeneous_enclosed CA1_2_13I2R9Value CA1_2_13I2R9MassTerm_sound CA1_2_13I2R9Entropy_sound) (by decide +kernel) +def CA1_2_13I2R10Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 2 13)) (fun u => (stageALaw (shape 1 2 13) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 10 a +def CA1_2_13I2R10Raw (a : PairSlot) : Ball := residualBall (below (shape 1 2 13)) A1_2_13Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 10 a +lemma CA1_2_13I2R10Raw_sound (a : PairSlot) : + (CA1_2_13I2R10Raw a).Encloses (CA1_2_13I2R10Value a) := by + exact residualBall_sound_on (below (shape 1 2 13)) A1_2_13Law (fun u => (stageALaw (shape 1 2 13) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A1_2_13Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 2 13) (show (shape 1 2 13) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 10 a +def CA1_2_13I2R10Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA1_2_13I2R10Certificates_valid : + CA1_2_13I2R10Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_2_13I2R10CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA1_2_13I2R10P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_2_13I2R10Certificates (CA1_2_13I2R10CertificateIndex a)).input +lemma CA1_2_13I2R10P_check : ∀ a : PairSlot, contains (CA1_2_13I2R10Raw a) (CA1_2_13I2R10P a) = true := by + decide +kernel +lemma CA1_2_13I2R10P_sound (a : PairSlot) : + (CA1_2_13I2R10P a).Encloses (CA1_2_13I2R10Value a) := + contains_sound (CA1_2_13I2R10Raw_sound a) (CA1_2_13I2R10P_check a) +def CA1_2_13I2R10Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_2_13I2R10Certificates (CA1_2_13I2R10CertificateIndex a)).output +lemma CA1_2_13I2R10Terms_sound (a : PairSlot) : + (CA1_2_13I2R10Terms a).Encloses (Foundation.entropyTerm (CA1_2_13I2R10Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_2_13I2R10Certificates_valid + (CA1_2_13I2R10CertificateIndex a) (CA1_2_13I2R10P_sound a) +def CA1_2_13I2R10Entropy : Ball := ⟨0, 0⟩ +lemma CA1_2_13I2R10Entropy_sound : CA1_2_13I2R10Entropy.Encloses (Foundation.finiteEntropy CA1_2_13I2R10Value) := by + exact contains_sound (entropyPair_enclosed CA1_2_13I2R10Value CA1_2_13I2R10Terms CA1_2_13I2R10Terms_sound) (by decide +kernel) +def CA1_2_13I2R10Mass : Ball := ⟨0, 0⟩ +lemma CA1_2_13I2R10Mass_sound : CA1_2_13I2R10Mass.Encloses (∑ a, CA1_2_13I2R10Value a) := by + exact contains_sound (pairSumBall_sound CA1_2_13I2R10P CA1_2_13I2R10Value CA1_2_13I2R10P_sound) (by decide +kernel) +def CA1_2_13I2R10MassTerm : Ball := .exact 0 +lemma CA1_2_13I2R10MassTerm_sound : CA1_2_13I2R10MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_2_13I2R10Value a))) := + entropyTerm_zero_ball (CA1_2_13I2R10Mass_sound) +def CA1_2_13I2R10H : Ball := ⟨0, 0⟩ +lemma CA1_2_13I2R10H_sound : CA1_2_13I2R10H.Encloses (homogeneousEntropy CA1_2_13I2R10Value) := by + exact contains_sound (homogeneous_enclosed CA1_2_13I2R10Value CA1_2_13I2R10MassTerm_sound CA1_2_13I2R10Entropy_sound) (by decide +kernel) +def CA1_2_13I2R11Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 2 13)) (fun u => (stageALaw (shape 1 2 13) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 11 a +def CA1_2_13I2R11Raw (a : PairSlot) : Ball := residualBall (below (shape 1 2 13)) A1_2_13Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 11 a +lemma CA1_2_13I2R11Raw_sound (a : PairSlot) : + (CA1_2_13I2R11Raw a).Encloses (CA1_2_13I2R11Value a) := by + exact residualBall_sound_on (below (shape 1 2 13)) A1_2_13Law (fun u => (stageALaw (shape 1 2 13) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A1_2_13Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 2 13) (show (shape 1 2 13) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 11 a +def CA1_2_13I2R11Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA1_2_13I2R11Certificates_valid : + CA1_2_13I2R11Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_2_13I2R11CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA1_2_13I2R11P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_2_13I2R11Certificates (CA1_2_13I2R11CertificateIndex a)).input +lemma CA1_2_13I2R11P_check : ∀ a : PairSlot, contains (CA1_2_13I2R11Raw a) (CA1_2_13I2R11P a) = true := by + decide +kernel +lemma CA1_2_13I2R11P_sound (a : PairSlot) : + (CA1_2_13I2R11P a).Encloses (CA1_2_13I2R11Value a) := + contains_sound (CA1_2_13I2R11Raw_sound a) (CA1_2_13I2R11P_check a) +def CA1_2_13I2R11Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_2_13I2R11Certificates (CA1_2_13I2R11CertificateIndex a)).output +lemma CA1_2_13I2R11Terms_sound (a : PairSlot) : + (CA1_2_13I2R11Terms a).Encloses (Foundation.entropyTerm (CA1_2_13I2R11Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_2_13I2R11Certificates_valid + (CA1_2_13I2R11CertificateIndex a) (CA1_2_13I2R11P_sound a) +def CA1_2_13I2R11Entropy : Ball := ⟨0, 0⟩ +lemma CA1_2_13I2R11Entropy_sound : CA1_2_13I2R11Entropy.Encloses (Foundation.finiteEntropy CA1_2_13I2R11Value) := by + exact contains_sound (entropyPair_enclosed CA1_2_13I2R11Value CA1_2_13I2R11Terms CA1_2_13I2R11Terms_sound) (by decide +kernel) +def CA1_2_13I2R11Mass : Ball := ⟨0, 0⟩ +lemma CA1_2_13I2R11Mass_sound : CA1_2_13I2R11Mass.Encloses (∑ a, CA1_2_13I2R11Value a) := by + exact contains_sound (pairSumBall_sound CA1_2_13I2R11P CA1_2_13I2R11Value CA1_2_13I2R11P_sound) (by decide +kernel) +def CA1_2_13I2R11MassTerm : Ball := .exact 0 +lemma CA1_2_13I2R11MassTerm_sound : CA1_2_13I2R11MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_2_13I2R11Value a))) := + entropyTerm_zero_ball (CA1_2_13I2R11Mass_sound) +def CA1_2_13I2R11H : Ball := ⟨0, 0⟩ +lemma CA1_2_13I2R11H_sound : CA1_2_13I2R11H.Encloses (homogeneousEntropy CA1_2_13I2R11Value) := by + exact contains_sound (homogeneous_enclosed CA1_2_13I2R11Value CA1_2_13I2R11MassTerm_sound CA1_2_13I2R11Entropy_sound) (by decide +kernel) +def CA1_2_13I2R12Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 2 13)) (fun u => (stageALaw (shape 1 2 13) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 12 a +def CA1_2_13I2R12Raw (a : PairSlot) : Ball := residualBall (below (shape 1 2 13)) A1_2_13Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 12 a +lemma CA1_2_13I2R12Raw_sound (a : PairSlot) : + (CA1_2_13I2R12Raw a).Encloses (CA1_2_13I2R12Value a) := by + exact residualBall_sound_on (below (shape 1 2 13)) A1_2_13Law (fun u => (stageALaw (shape 1 2 13) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A1_2_13Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 2 13) (show (shape 1 2 13) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 12 a +def CA1_2_13I2R12Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA1_2_13I2R12Certificates_valid : + CA1_2_13I2R12Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_2_13I2R12CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA1_2_13I2R12P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_2_13I2R12Certificates (CA1_2_13I2R12CertificateIndex a)).input +lemma CA1_2_13I2R12P_check : ∀ a : PairSlot, contains (CA1_2_13I2R12Raw a) (CA1_2_13I2R12P a) = true := by + decide +kernel +lemma CA1_2_13I2R12P_sound (a : PairSlot) : + (CA1_2_13I2R12P a).Encloses (CA1_2_13I2R12Value a) := + contains_sound (CA1_2_13I2R12Raw_sound a) (CA1_2_13I2R12P_check a) +def CA1_2_13I2R12Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_2_13I2R12Certificates (CA1_2_13I2R12CertificateIndex a)).output +lemma CA1_2_13I2R12Terms_sound (a : PairSlot) : + (CA1_2_13I2R12Terms a).Encloses (Foundation.entropyTerm (CA1_2_13I2R12Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_2_13I2R12Certificates_valid + (CA1_2_13I2R12CertificateIndex a) (CA1_2_13I2R12P_sound a) +def CA1_2_13I2R12Entropy : Ball := ⟨0, 0⟩ +lemma CA1_2_13I2R12Entropy_sound : CA1_2_13I2R12Entropy.Encloses (Foundation.finiteEntropy CA1_2_13I2R12Value) := by + exact contains_sound (entropyPair_enclosed CA1_2_13I2R12Value CA1_2_13I2R12Terms CA1_2_13I2R12Terms_sound) (by decide +kernel) +def CA1_2_13I2R12Mass : Ball := ⟨0, 0⟩ +lemma CA1_2_13I2R12Mass_sound : CA1_2_13I2R12Mass.Encloses (∑ a, CA1_2_13I2R12Value a) := by + exact contains_sound (pairSumBall_sound CA1_2_13I2R12P CA1_2_13I2R12Value CA1_2_13I2R12P_sound) (by decide +kernel) +def CA1_2_13I2R12MassTerm : Ball := .exact 0 +lemma CA1_2_13I2R12MassTerm_sound : CA1_2_13I2R12MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_2_13I2R12Value a))) := + entropyTerm_zero_ball (CA1_2_13I2R12Mass_sound) +def CA1_2_13I2R12H : Ball := ⟨0, 0⟩ +lemma CA1_2_13I2R12H_sound : CA1_2_13I2R12H.Encloses (homogeneousEntropy CA1_2_13I2R12Value) := by + exact contains_sound (homogeneous_enclosed CA1_2_13I2R12Value CA1_2_13I2R12MassTerm_sound CA1_2_13I2R12Entropy_sound) (by decide +kernel) +def CA1_2_13I2R13Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 2 13)) (fun u => (stageALaw (shape 1 2 13) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 13 a +def CA1_2_13I2R13Raw (a : PairSlot) : Ball := residualBall (below (shape 1 2 13)) A1_2_13Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 13 a +lemma CA1_2_13I2R13Raw_sound (a : PairSlot) : + (CA1_2_13I2R13Raw a).Encloses (CA1_2_13I2R13Value a) := by + exact residualBall_sound_on (below (shape 1 2 13)) A1_2_13Law (fun u => (stageALaw (shape 1 2 13) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A1_2_13Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 2 13) (show (shape 1 2 13) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 13 a +def CA1_2_13I2R13Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA1_2_13I2R13Certificates_valid : + CA1_2_13I2R13Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_2_13I2R13CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA1_2_13I2R13P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_2_13I2R13Certificates (CA1_2_13I2R13CertificateIndex a)).input +lemma CA1_2_13I2R13P_check : ∀ a : PairSlot, contains (CA1_2_13I2R13Raw a) (CA1_2_13I2R13P a) = true := by + decide +kernel +lemma CA1_2_13I2R13P_sound (a : PairSlot) : + (CA1_2_13I2R13P a).Encloses (CA1_2_13I2R13Value a) := + contains_sound (CA1_2_13I2R13Raw_sound a) (CA1_2_13I2R13P_check a) +def CA1_2_13I2R13Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_2_13I2R13Certificates (CA1_2_13I2R13CertificateIndex a)).output +lemma CA1_2_13I2R13Terms_sound (a : PairSlot) : + (CA1_2_13I2R13Terms a).Encloses (Foundation.entropyTerm (CA1_2_13I2R13Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_2_13I2R13Certificates_valid + (CA1_2_13I2R13CertificateIndex a) (CA1_2_13I2R13P_sound a) +def CA1_2_13I2R13Entropy : Ball := ⟨0, 0⟩ +lemma CA1_2_13I2R13Entropy_sound : CA1_2_13I2R13Entropy.Encloses (Foundation.finiteEntropy CA1_2_13I2R13Value) := by + exact contains_sound (entropyPair_enclosed CA1_2_13I2R13Value CA1_2_13I2R13Terms CA1_2_13I2R13Terms_sound) (by decide +kernel) +def CA1_2_13I2R13Mass : Ball := ⟨0, 0⟩ +lemma CA1_2_13I2R13Mass_sound : CA1_2_13I2R13Mass.Encloses (∑ a, CA1_2_13I2R13Value a) := by + exact contains_sound (pairSumBall_sound CA1_2_13I2R13P CA1_2_13I2R13Value CA1_2_13I2R13P_sound) (by decide +kernel) +def CA1_2_13I2R13MassTerm : Ball := .exact 0 +lemma CA1_2_13I2R13MassTerm_sound : CA1_2_13I2R13MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_2_13I2R13Value a))) := + entropyTerm_zero_ball (CA1_2_13I2R13Mass_sound) +def CA1_2_13I2R13H : Ball := ⟨0, 0⟩ +lemma CA1_2_13I2R13H_sound : CA1_2_13I2R13H.Encloses (homogeneousEntropy CA1_2_13I2R13Value) := by + exact contains_sound (homogeneous_enclosed CA1_2_13I2R13Value CA1_2_13I2R13MassTerm_sound CA1_2_13I2R13Entropy_sound) (by decide +kernel) +def CA1_2_13I2R14Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 2 13)) (fun u => (stageALaw (shape 1 2 13) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 14 a +def CA1_2_13I2R14Raw (a : PairSlot) : Ball := residualBall (below (shape 1 2 13)) A1_2_13Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 14 a +lemma CA1_2_13I2R14Raw_sound (a : PairSlot) : + (CA1_2_13I2R14Raw a).Encloses (CA1_2_13I2R14Value a) := by + exact residualBall_sound_on (below (shape 1 2 13)) A1_2_13Law (fun u => (stageALaw (shape 1 2 13) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A1_2_13Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 2 13) (show (shape 1 2 13) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 14 a +def CA1_2_13I2R14Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA1_2_13I2R14Certificates_valid : + CA1_2_13I2R14Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_2_13I2R14CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA1_2_13I2R14P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_2_13I2R14Certificates (CA1_2_13I2R14CertificateIndex a)).input +lemma CA1_2_13I2R14P_check : ∀ a : PairSlot, contains (CA1_2_13I2R14Raw a) (CA1_2_13I2R14P a) = true := by + decide +kernel +lemma CA1_2_13I2R14P_sound (a : PairSlot) : + (CA1_2_13I2R14P a).Encloses (CA1_2_13I2R14Value a) := + contains_sound (CA1_2_13I2R14Raw_sound a) (CA1_2_13I2R14P_check a) +def CA1_2_13I2R14Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_2_13I2R14Certificates (CA1_2_13I2R14CertificateIndex a)).output +lemma CA1_2_13I2R14Terms_sound (a : PairSlot) : + (CA1_2_13I2R14Terms a).Encloses (Foundation.entropyTerm (CA1_2_13I2R14Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_2_13I2R14Certificates_valid + (CA1_2_13I2R14CertificateIndex a) (CA1_2_13I2R14P_sound a) +def CA1_2_13I2R14Entropy : Ball := ⟨0, 0⟩ +lemma CA1_2_13I2R14Entropy_sound : CA1_2_13I2R14Entropy.Encloses (Foundation.finiteEntropy CA1_2_13I2R14Value) := by + exact contains_sound (entropyPair_enclosed CA1_2_13I2R14Value CA1_2_13I2R14Terms CA1_2_13I2R14Terms_sound) (by decide +kernel) +def CA1_2_13I2R14Mass : Ball := ⟨0, 0⟩ +lemma CA1_2_13I2R14Mass_sound : CA1_2_13I2R14Mass.Encloses (∑ a, CA1_2_13I2R14Value a) := by + exact contains_sound (pairSumBall_sound CA1_2_13I2R14P CA1_2_13I2R14Value CA1_2_13I2R14P_sound) (by decide +kernel) +def CA1_2_13I2R14MassTerm : Ball := .exact 0 +lemma CA1_2_13I2R14MassTerm_sound : CA1_2_13I2R14MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_2_13I2R14Value a))) := + entropyTerm_zero_ball (CA1_2_13I2R14Mass_sound) +def CA1_2_13I2R14H : Ball := ⟨0, 0⟩ +lemma CA1_2_13I2R14H_sound : CA1_2_13I2R14H.Encloses (homogeneousEntropy CA1_2_13I2R14Value) := by + exact contains_sound (homogeneous_enclosed CA1_2_13I2R14Value CA1_2_13I2R14MassTerm_sound CA1_2_13I2R14Entropy_sound) (by decide +kernel) +def CA1_2_13I2R15Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 2 13)) (fun u => (stageALaw (shape 1 2 13) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 15 a +def CA1_2_13I2R15Raw (a : PairSlot) : Ball := residualBall (below (shape 1 2 13)) A1_2_13Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 15 a +lemma CA1_2_13I2R15Raw_sound (a : PairSlot) : + (CA1_2_13I2R15Raw a).Encloses (CA1_2_13I2R15Value a) := by + exact residualBall_sound_on (below (shape 1 2 13)) A1_2_13Law (fun u => (stageALaw (shape 1 2 13) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A1_2_13Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 2 13) (show (shape 1 2 13) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 15 a +def CA1_2_13I2R15Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA1_2_13I2R15Certificates_valid : + CA1_2_13I2R15Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_2_13I2R15CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA1_2_13I2R15P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_2_13I2R15Certificates (CA1_2_13I2R15CertificateIndex a)).input +lemma CA1_2_13I2R15P_check : ∀ a : PairSlot, contains (CA1_2_13I2R15Raw a) (CA1_2_13I2R15P a) = true := by + decide +kernel +lemma CA1_2_13I2R15P_sound (a : PairSlot) : + (CA1_2_13I2R15P a).Encloses (CA1_2_13I2R15Value a) := + contains_sound (CA1_2_13I2R15Raw_sound a) (CA1_2_13I2R15P_check a) +def CA1_2_13I2R15Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_2_13I2R15Certificates (CA1_2_13I2R15CertificateIndex a)).output +lemma CA1_2_13I2R15Terms_sound (a : PairSlot) : + (CA1_2_13I2R15Terms a).Encloses (Foundation.entropyTerm (CA1_2_13I2R15Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_2_13I2R15Certificates_valid + (CA1_2_13I2R15CertificateIndex a) (CA1_2_13I2R15P_sound a) +def CA1_2_13I2R15Entropy : Ball := ⟨0, 0⟩ +lemma CA1_2_13I2R15Entropy_sound : CA1_2_13I2R15Entropy.Encloses (Foundation.finiteEntropy CA1_2_13I2R15Value) := by + exact contains_sound (entropyPair_enclosed CA1_2_13I2R15Value CA1_2_13I2R15Terms CA1_2_13I2R15Terms_sound) (by decide +kernel) +def CA1_2_13I2R15Mass : Ball := ⟨0, 0⟩ +lemma CA1_2_13I2R15Mass_sound : CA1_2_13I2R15Mass.Encloses (∑ a, CA1_2_13I2R15Value a) := by + exact contains_sound (pairSumBall_sound CA1_2_13I2R15P CA1_2_13I2R15Value CA1_2_13I2R15P_sound) (by decide +kernel) +def CA1_2_13I2R15MassTerm : Ball := .exact 0 +lemma CA1_2_13I2R15MassTerm_sound : CA1_2_13I2R15MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_2_13I2R15Value a))) := + entropyTerm_zero_ball (CA1_2_13I2R15Mass_sound) +def CA1_2_13I2R15H : Ball := ⟨0, 0⟩ +lemma CA1_2_13I2R15H_sound : CA1_2_13I2R15H.Encloses (homogeneousEntropy CA1_2_13I2R15Value) := by + exact contains_sound (homogeneous_enclosed CA1_2_13I2R15Value CA1_2_13I2R15MassTerm_sound CA1_2_13I2R15Entropy_sound) (by decide +kernel) +def CA1_2_13I2R16Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 2 13)) (fun u => (stageALaw (shape 1 2 13) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 16 a +def CA1_2_13I2R16Raw (a : PairSlot) : Ball := residualBall (below (shape 1 2 13)) A1_2_13Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 16 a +lemma CA1_2_13I2R16Raw_sound (a : PairSlot) : + (CA1_2_13I2R16Raw a).Encloses (CA1_2_13I2R16Value a) := by + exact residualBall_sound_on (below (shape 1 2 13)) A1_2_13Law (fun u => (stageALaw (shape 1 2 13) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A1_2_13Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 2 13) (show (shape 1 2 13) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 16 a +def CA1_2_13I2R16Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA1_2_13I2R16Certificates_valid : + CA1_2_13I2R16Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_2_13I2R16CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA1_2_13I2R16P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_2_13I2R16Certificates (CA1_2_13I2R16CertificateIndex a)).input +lemma CA1_2_13I2R16P_check : ∀ a : PairSlot, contains (CA1_2_13I2R16Raw a) (CA1_2_13I2R16P a) = true := by + decide +kernel +lemma CA1_2_13I2R16P_sound (a : PairSlot) : + (CA1_2_13I2R16P a).Encloses (CA1_2_13I2R16Value a) := + contains_sound (CA1_2_13I2R16Raw_sound a) (CA1_2_13I2R16P_check a) +def CA1_2_13I2R16Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_2_13I2R16Certificates (CA1_2_13I2R16CertificateIndex a)).output +lemma CA1_2_13I2R16Terms_sound (a : PairSlot) : + (CA1_2_13I2R16Terms a).Encloses (Foundation.entropyTerm (CA1_2_13I2R16Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_2_13I2R16Certificates_valid + (CA1_2_13I2R16CertificateIndex a) (CA1_2_13I2R16P_sound a) +def CA1_2_13I2R16Entropy : Ball := ⟨0, 0⟩ +lemma CA1_2_13I2R16Entropy_sound : CA1_2_13I2R16Entropy.Encloses (Foundation.finiteEntropy CA1_2_13I2R16Value) := by + exact contains_sound (entropyPair_enclosed CA1_2_13I2R16Value CA1_2_13I2R16Terms CA1_2_13I2R16Terms_sound) (by decide +kernel) +def CA1_2_13I2R16Mass : Ball := ⟨0, 0⟩ +lemma CA1_2_13I2R16Mass_sound : CA1_2_13I2R16Mass.Encloses (∑ a, CA1_2_13I2R16Value a) := by + exact contains_sound (pairSumBall_sound CA1_2_13I2R16P CA1_2_13I2R16Value CA1_2_13I2R16P_sound) (by decide +kernel) +def CA1_2_13I2R16MassTerm : Ball := .exact 0 +lemma CA1_2_13I2R16MassTerm_sound : CA1_2_13I2R16MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_2_13I2R16Value a))) := + entropyTerm_zero_ball (CA1_2_13I2R16Mass_sound) +def CA1_2_13I2R16H : Ball := ⟨0, 0⟩ +lemma CA1_2_13I2R16H_sound : CA1_2_13I2R16H.Encloses (homogeneousEntropy CA1_2_13I2R16Value) := by + exact contains_sound (homogeneous_enclosed CA1_2_13I2R16Value CA1_2_13I2R16MassTerm_sound CA1_2_13I2R16Entropy_sound) (by decide +kernel) +def CA1_2_13I2ResidualEntropies (a : Fin 17) : Ball := + match a.val with + | 0 => CA1_2_13I2R0H + | 1 => CA1_2_13I2R1H + | 2 => CA1_2_13I2R2H + | 3 => CA1_2_13I2R3H + | 4 => CA1_2_13I2R4H + | 5 => CA1_2_13I2R5H + | 6 => CA1_2_13I2R6H + | 7 => CA1_2_13I2R7H + | 8 => CA1_2_13I2R8H + | 9 => CA1_2_13I2R9H + | 10 => CA1_2_13I2R10H + | 11 => CA1_2_13I2R11H + | 12 => CA1_2_13I2R12H + | 13 => CA1_2_13I2R13H + | 14 => CA1_2_13I2R14H + | 15 => CA1_2_13I2R15H + | 16 => CA1_2_13I2R16H + | _ => (.exact 0) +lemma CA1_2_13I2ResidualEntropies_sound (k : Fin 17) : + (CA1_2_13I2ResidualEntropies k).Encloses (homogeneousEntropy + (residualLaw (below (shape 1 2 13)) (fun u => (stageALaw (shape 1 2 13) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) k)) := by + fin_cases k + · exact CA1_2_13I2R0H_sound + · exact CA1_2_13I2R1H_sound + · exact CA1_2_13I2R2H_sound + · exact CA1_2_13I2R3H_sound + · exact CA1_2_13I2R4H_sound + · exact CA1_2_13I2R5H_sound + · exact CA1_2_13I2R6H_sound + · exact CA1_2_13I2R7H_sound + · exact CA1_2_13I2R8H_sound + · exact CA1_2_13I2R9H_sound + · exact CA1_2_13I2R10H_sound + · exact CA1_2_13I2R11H_sound + · exact CA1_2_13I2R12H_sound + · exact CA1_2_13I2R13H_sound + · exact CA1_2_13I2R14H_sound + · exact CA1_2_13I2R15H_sound + · exact CA1_2_13I2R16H_sound +def CA1_2_13I2Singles (s : Shape) : Ball := + match s 0, s 1, s 2 with + | 0, 0, 8 => Z0_0_8H2H + | 0, 1, 7 => Z0_1_7H2H + | 0, 2, 6 => Z0_2_6H2H + | 1, 0, 7 => Z1_0_7H2H + | _, _, _ => (.exact 0) +lemma CA1_2_13I2Singles_sound (u : Shape) (hu : u ∈ below (shape 1 2 13)) + (hd : designated (Equiv.refl (Fin 3)) 2 u) : + (CA1_2_13I2Singles u).Encloses (homogeneousEntropy ((fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) u)) := by + rw [A1_2_13_below] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl | rfl | rfl + · exact Z0_0_8H2H_sound + · exact Z0_1_7H2H_sound + · exact Z0_2_6H2H_sound + · exact Z1_0_7H2H_sound + · exact (show ¬ designated (Equiv.refl (Fin 3)) 2 (shape 1 1 6) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 2 (shape 1 2 5) by decide +kernel) hd |>.elim +def CA1_2_13I2Singleton : Ball := ⟨(58270157785646687706346512918121 / 100000000000000000000000000000000), (44745661021 / 100000000000000000000000000000000)⟩ +lemma CA1_2_13I2Singleton_sound : CA1_2_13I2Singleton.Encloses + (singletonEntropy (below (shape 1 2 13)) (fun u => (stageALaw (shape 1 2 13) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ))) := by + exact contains_sound (singletonBall_sound (below (shape 1 2 13)) A1_2_13Law (fun u => (stageALaw (shape 1 2 13) u : ℝ)) (Equiv.refl (Fin 3)) 2 + CA1_2_13I2Singles (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A1_2_13Law_sound u) CA1_2_13I2Singles_sound) (by decide +kernel) +def CA1_2_13I2Group : Ball := ⟨(15834743288690142179661861049839 / 25000000000000000000000000000000), (2356781907 / 2500000000000000000000000000000)⟩ +lemma CA1_2_13I2Group_sound : CA1_2_13I2Group.Encloses + (groupedEntropy (below (shape 1 2 13)) (fun u => (stageALaw (shape 1 2 13) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ))) := by + exact contains_sound (Ball.add_sound CA1_2_13I2Singleton_sound + (finSumBall_sound 17 CA1_2_13I2ResidualEntropies _ CA1_2_13I2ResidualEntropies_sound)) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CA1_2_13I2H : Ball := ⟨(3290466399948973377449583801011 / 3125000000000000000000000000000), (335420028599 / 100000000000000000000000000000000)⟩ +lemma CA1_2_13I2_sound : CA1_2_13I2H.Encloses (stageACapacity (shape 1 2 13) 2) := by + have hb := contains_sound (Ball.add_sound CA1_2_13I2PairH_sound + (Ball.neg_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) CA1_2_13I2Group_sound))) + (show contains (.add CA1_2_13I2PairH (.neg (.mul (.exact 2) CA1_2_13I2Group))) CA1_2_13I2H = true by decide +kernel) + unfold CA1_2_13I2PairValue at hb + simpa only [stageACapacity, nativeCapacity, + show (2 : Fin 3) ≠ 0 by decide, ite_false, sub_eq_add_neg] using hb + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA1_3_12I0.lean b/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA1_3_12I0.lean new file mode 100644 index 0000000000000000000000000000000000000000..7764d76b8c469b00c52f958927bcfe5a4c6772ce --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA1_3_12I0.lean @@ -0,0 +1,72 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Certificates.SplitA1_3_12 + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CA1_3_12I0Value (a : Fin 17) : ℝ := marginal (below (shape 1 3 12)) (fun u => (stageALaw (shape 1 3 12) u : ℝ)) ((Equiv.refl (Fin 3)) 0) a +def CA1_3_12I0Raw (a : Fin 17) : Ball := marginalBall (below (shape 1 3 12)) A1_3_12Law ((Equiv.refl (Fin 3)) 0) a +lemma CA1_3_12I0Raw_sound (a : Fin 17) : + (CA1_3_12I0Raw a).Encloses (CA1_3_12I0Value a) := by + exact marginalBall_sound (below (shape 1 3 12)) A1_3_12Law (fun u => (stageALaw (shape 1 3 12) u : ℝ)) (fun u _ => A1_3_12Law_sound u) ((Equiv.refl (Fin 3)) 0) a +def CA1_3_12I0Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(1 / 2), (87 / 100000000000000000000000000000000)⟩ ⟨(6931471805599453094172319305033 / 20000000000000000000000000000000), (2117582383 / 10000000000000000000000000000000)⟩ ⟨(-6931471805599453094172319305033 / 10000000000000000000000000000000), (42351647539 / 100000000000000000000000000000000)⟩ ⟨-1, 1, 1⟩] +lemma CA1_3_12I0Certificates_valid : + CA1_3_12I0Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_3_12I0CertificateIndex (a : Fin 17) : ℕ := + match a.val with + | 0 => 1 + | 1 => 1 + | _ => 0 +def CA1_3_12I0P (a : Fin 17) : Ball := + (CompactCertificate.entropyLookup CA1_3_12I0Certificates (CA1_3_12I0CertificateIndex a)).input +lemma CA1_3_12I0P_check : ∀ a : Fin 17, contains (CA1_3_12I0Raw a) (CA1_3_12I0P a) = true := by + decide +kernel +lemma CA1_3_12I0P_sound (a : Fin 17) : + (CA1_3_12I0P a).Encloses (CA1_3_12I0Value a) := + contains_sound (CA1_3_12I0Raw_sound a) (CA1_3_12I0P_check a) +def CA1_3_12I0Terms (a : Fin 17) : Ball := + (CompactCertificate.entropyLookup CA1_3_12I0Certificates (CA1_3_12I0CertificateIndex a)).output +lemma CA1_3_12I0Terms_sound (a : Fin 17) : + (CA1_3_12I0Terms a).Encloses (Foundation.entropyTerm (CA1_3_12I0Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_3_12I0Certificates_valid + (CA1_3_12I0CertificateIndex a) (CA1_3_12I0P_sound a) +def CA1_3_12I0Entropy : Ball := ⟨(6931471805599453094172319305033 / 10000000000000000000000000000000), (2117582383 / 5000000000000000000000000000000)⟩ +lemma CA1_3_12I0Entropy_sound : CA1_3_12I0Entropy.Encloses (Foundation.finiteEntropy CA1_3_12I0Value) := by + exact contains_sound (entropyFin_enclosed 17 CA1_3_12I0Value CA1_3_12I0Terms CA1_3_12I0Terms_sound) (by decide +kernel) +def CA1_3_12I0Mass : Ball := ⟨1, (87 / 50000000000000000000000000000000)⟩ +lemma CA1_3_12I0Mass_sound : CA1_3_12I0Mass.Encloses (∑ a, CA1_3_12I0Value a) := by + exact contains_sound (finSumBall_sound 17 CA1_3_12I0P CA1_3_12I0Value CA1_3_12I0P_sound) (by decide +kernel) +def CA1_3_12I0MassTermLogWitness : LogWitness := ⟨0, 1, 1⟩ +def CA1_3_12I0MassTermLog : Ball := ⟨0, (1323488991 / 6250000000000000000000000000000)⟩ +lemma CA1_3_12I0MassTermLog_sound : CA1_3_12I0MassTermLog.Encloses (Real.log ((∑ a, CA1_3_12I0Value a))) := by + exact checkLog_sound logTwoBall_sound (CA1_3_12I0Mass_sound) (w := CA1_3_12I0MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA1_3_12I0MassTerm : Ball := ⟨0, (21175823857 / 100000000000000000000000000000000)⟩ +lemma CA1_3_12I0MassTerm_sound : CA1_3_12I0MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_3_12I0Value a))) := by + exact contains_sound (entropyTerm_ball (CA1_3_12I0Mass_sound) CA1_3_12I0MassTermLog_sound) (by decide +kernel) +def CA1_3_12I0H : Ball := ⟨(6931471805599453094172319305033 / 10000000000000000000000000000000), (63527471517 / 100000000000000000000000000000000)⟩ +lemma CA1_3_12I0H_sound : CA1_3_12I0H.Encloses (homogeneousEntropy CA1_3_12I0Value) := by + exact contains_sound (homogeneous_enclosed CA1_3_12I0Value CA1_3_12I0MassTerm_sound CA1_3_12I0Entropy_sound) (by decide +kernel) +lemma CA1_3_12I0_sound : CA1_3_12I0H.Encloses (stageACapacity (shape 1 3 12) 0) := by + exact CA1_3_12I0H_sound + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA1_3_12I1.lean b/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA1_3_12I1.lean new file mode 100644 index 0000000000000000000000000000000000000000..3fdcac5494b4219000cdb65bab35ad9449789f32 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA1_3_12I1.lean @@ -0,0 +1,974 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Certificates.SupportedContraction + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CA1_3_12I1PairValue (a : PairSlot × PairSlot) : ℝ := pairLaw (below (shape 1 3 12)) (shape 1 3 12) (fun u => (stageALaw (shape 1 3 12) u : ℝ)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) a +def CA1_3_12I1PairRaw (a : PairSlot × PairSlot) : Ball := stageAPairBall (shape 1 3 12) A1_3_12Law 1 a +lemma CA1_3_12I1PairRaw_sound (a : PairSlot × PairSlot) : + (CA1_3_12I1PairRaw a).Encloses (CA1_3_12I1PairValue a) := by + exact stageAPairBall_sound (shape 1 3 12) (by decide +kernel) A1_3_12Law (fun u => (stageALaw (shape 1 3 12) u : ℝ)) (fun u _ => A1_3_12Law_sound u) 1 a +def CA1_3_12I1PairCertificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(129165067930240297565270841043 / 50000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ ⟨(96206778032876131242691152417 / 6250000000000000000000000000000), (136758839 / 25000000000000000000000000000000)⟩ ⟨(-297934355083792968334169073309091 / 50000000000000000000000000000000), (52939559401 / 25000000000000000000000000000000)⟩ ⟨-9, 129165067930240297565270841043, 97656250000000000000000000000⟩, + .log ⟨(2162328515383313515631099877419 / 50000000000000000000000000000000), (1 / 4000000000000000000000000000000)⟩ ⟨(339576107987341944429779096823 / 2500000000000000000000000000000), (549469059 / 10000000000000000000000000000000)⟩ ⟨(-314083734799331057367608445873267 / 100000000000000000000000000000000), (5082197707 / 4000000000000000000000000000000)⟩ ⟨-5, 2162328515383313515631099877419, 1562500000000000000000000000000⟩, + .log ⟨(427947066201928425852550330863 / 100000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ ⟨(2333991611354785982686465723567 / 100000000000000000000000000000000), (407795933 / 50000000000000000000000000000000)⟩ ⟨(-545392595413537266791669348013853 / 100000000000000000000000000000000), (190582413847 / 100000000000000000000000000000000)⟩ ⟨-8, 427947066201928425852550330863, 390625000000000000000000000000⟩, + .log ⟨(92627022061849000538047060611 / 2500000000000000000000000000000), (13 / 100000000000000000000000000000000)⟩ ⟨(11923793680862421296193265431 / 97656250000000000000000000000), (4707488427 / 100000000000000000000000000000000)⟩ ⟨(-2059665685531922602957388588871 / 625000000000000000000000000000), (7940933903 / 6250000000000000000000000000000)⟩ ⟨-5, 92627022061849000538047060611, 78125000000000000000000000000⟩, + .log ⟨(162306731564696040567822146153 / 50000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ ⟨(1860129390280237914069036106119 / 100000000000000000000000000000000), (8592447 / 1250000000000000000000000000000)⟩ ⟨(-573029033468887186035218542802501 / 100000000000000000000000000000000), (105879118723 / 50000000000000000000000000000000)⟩ ⟨-9, 162306731564696040567822146153, 97656250000000000000000000000⟩, + .log ⟨(11929677075964259742439654798719 / 100000000000000000000000000000000), (3 / 12500000000000000000000000000000)⟩ ⟨(12682087884207895773931543275227 / 50000000000000000000000000000000), (12631036993 / 100000000000000000000000000000000)⟩ ⟨(-106307050923948162934637424394289 / 50000000000000000000000000000000), (13234889827 / 12500000000000000000000000000000)⟩ ⟨-4, 11929677075964259742439654798719, 6250000000000000000000000000000⟩] +lemma CA1_3_12I1PairCertificates_valid : + CA1_3_12I1PairCertificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_3_12I1PairCertificateIndex (a : PairSlot × PairSlot) : ℕ := + match a.1.1.val, a.1.2.val, a.2.1.val, a.2.2.val with + | 0, 0, 0, 4 => 1 + | 0, 0, 1, 2 => 2 + | 0, 0, 1, 3 => 3 + | 0, 0, 2, 1 => 2 + | 0, 0, 3, 1 => 3 + | 0, 0, 4, 0 => 1 + | 1, 0, 0, 2 => 4 + | 1, 0, 0, 3 => 5 + | 1, 0, 1, 1 => 6 + | 1, 0, 2, 0 => 4 + | 1, 0, 3, 0 => 5 + | 0, 1, 0, 2 => 4 + | 0, 1, 0, 3 => 5 + | 0, 1, 1, 1 => 6 + | 0, 1, 2, 0 => 4 + | 0, 1, 3, 0 => 5 + | 2, 0, 0, 1 => 4 + | 2, 0, 1, 0 => 4 + | 3, 0, 0, 1 => 5 + | 3, 0, 1, 0 => 5 + | 1, 1, 0, 1 => 6 + | 1, 1, 1, 0 => 6 + | 0, 2, 0, 1 => 4 + | 0, 2, 1, 0 => 4 + | 0, 3, 0, 1 => 5 + | 0, 3, 1, 0 => 5 + | 4, 0, 0, 0 => 1 + | 2, 1, 0, 0 => 2 + | 3, 1, 0, 0 => 3 + | 1, 2, 0, 0 => 2 + | 1, 3, 0, 0 => 3 + | 0, 4, 0, 0 => 1 + | _, _, _, _ => 0 +def CA1_3_12I1PairP (a : PairSlot × PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_3_12I1PairCertificates (CA1_3_12I1PairCertificateIndex a)).input +lemma CA1_3_12I1PairP_check_0_0 : ∀ k l : Fin 6, contains (CA1_3_12I1PairRaw ((0,0),(k,l))) (CA1_3_12I1PairP ((0,0),(k,l))) = true := by + decide +kernel +lemma CA1_3_12I1PairP_check_0_1 : ∀ k l : Fin 6, contains (CA1_3_12I1PairRaw ((0,1),(k,l))) (CA1_3_12I1PairP ((0,1),(k,l))) = true := by + decide +kernel +lemma CA1_3_12I1PairP_check_0_2 : ∀ k l : Fin 6, contains (CA1_3_12I1PairRaw ((0,2),(k,l))) (CA1_3_12I1PairP ((0,2),(k,l))) = true := by + decide +kernel +lemma CA1_3_12I1PairP_check_0_3 : ∀ k l : Fin 6, contains (CA1_3_12I1PairRaw ((0,3),(k,l))) (CA1_3_12I1PairP ((0,3),(k,l))) = true := by + decide +kernel +lemma CA1_3_12I1PairP_check_0_4 : ∀ k l : Fin 6, contains (CA1_3_12I1PairRaw ((0,4),(k,l))) (CA1_3_12I1PairP ((0,4),(k,l))) = true := by + decide +kernel +lemma CA1_3_12I1PairP_check_0_5 : ∀ k l : Fin 6, contains (CA1_3_12I1PairRaw ((0,5),(k,l))) (CA1_3_12I1PairP ((0,5),(k,l))) = true := by + decide +kernel +lemma CA1_3_12I1PairP_check_1_0 : ∀ k l : Fin 6, contains (CA1_3_12I1PairRaw ((1,0),(k,l))) (CA1_3_12I1PairP ((1,0),(k,l))) = true := by + decide +kernel +lemma CA1_3_12I1PairP_check_1_1 : ∀ k l : Fin 6, contains (CA1_3_12I1PairRaw ((1,1),(k,l))) (CA1_3_12I1PairP ((1,1),(k,l))) = true := by + decide +kernel +lemma CA1_3_12I1PairP_check_1_2 : ∀ k l : Fin 6, contains (CA1_3_12I1PairRaw ((1,2),(k,l))) (CA1_3_12I1PairP ((1,2),(k,l))) = true := by + decide +kernel +lemma CA1_3_12I1PairP_check_1_3 : ∀ k l : Fin 6, contains (CA1_3_12I1PairRaw ((1,3),(k,l))) (CA1_3_12I1PairP ((1,3),(k,l))) = true := by + decide +kernel +lemma CA1_3_12I1PairP_check_1_4 : ∀ k l : Fin 6, contains (CA1_3_12I1PairRaw ((1,4),(k,l))) (CA1_3_12I1PairP ((1,4),(k,l))) = true := by + decide +kernel +lemma CA1_3_12I1PairP_check_1_5 : ∀ k l : Fin 6, contains (CA1_3_12I1PairRaw ((1,5),(k,l))) (CA1_3_12I1PairP ((1,5),(k,l))) = true := by + decide +kernel +lemma CA1_3_12I1PairP_check_2_0 : ∀ k l : Fin 6, contains (CA1_3_12I1PairRaw ((2,0),(k,l))) (CA1_3_12I1PairP ((2,0),(k,l))) = true := by + decide +kernel +lemma CA1_3_12I1PairP_check_2_1 : ∀ k l : Fin 6, contains (CA1_3_12I1PairRaw ((2,1),(k,l))) (CA1_3_12I1PairP ((2,1),(k,l))) = true := by + decide +kernel +lemma CA1_3_12I1PairP_check_2_2 : ∀ k l : Fin 6, contains (CA1_3_12I1PairRaw ((2,2),(k,l))) (CA1_3_12I1PairP ((2,2),(k,l))) = true := by + decide +kernel +lemma CA1_3_12I1PairP_check_2_3 : ∀ k l : Fin 6, contains (CA1_3_12I1PairRaw ((2,3),(k,l))) (CA1_3_12I1PairP ((2,3),(k,l))) = true := by + decide +kernel +lemma CA1_3_12I1PairP_check_2_4 : ∀ k l : Fin 6, contains (CA1_3_12I1PairRaw ((2,4),(k,l))) (CA1_3_12I1PairP ((2,4),(k,l))) = true := by + decide +kernel +lemma CA1_3_12I1PairP_check_2_5 : ∀ k l : Fin 6, contains (CA1_3_12I1PairRaw ((2,5),(k,l))) (CA1_3_12I1PairP ((2,5),(k,l))) = true := by + decide +kernel +lemma CA1_3_12I1PairP_check_3_0 : ∀ k l : Fin 6, contains (CA1_3_12I1PairRaw ((3,0),(k,l))) (CA1_3_12I1PairP ((3,0),(k,l))) = true := by + decide +kernel +lemma CA1_3_12I1PairP_check_3_1 : ∀ k l : Fin 6, contains (CA1_3_12I1PairRaw ((3,1),(k,l))) (CA1_3_12I1PairP ((3,1),(k,l))) = true := by + decide +kernel +lemma CA1_3_12I1PairP_check_3_2 : ∀ k l : Fin 6, contains (CA1_3_12I1PairRaw ((3,2),(k,l))) (CA1_3_12I1PairP ((3,2),(k,l))) = true := by + decide +kernel +lemma CA1_3_12I1PairP_check_3_3 : ∀ k l : Fin 6, contains (CA1_3_12I1PairRaw ((3,3),(k,l))) (CA1_3_12I1PairP ((3,3),(k,l))) = true := by + decide +kernel +lemma CA1_3_12I1PairP_check_3_4 : ∀ k l : Fin 6, contains (CA1_3_12I1PairRaw ((3,4),(k,l))) (CA1_3_12I1PairP ((3,4),(k,l))) = true := by + decide +kernel +lemma CA1_3_12I1PairP_check_3_5 : ∀ k l : Fin 6, contains (CA1_3_12I1PairRaw ((3,5),(k,l))) (CA1_3_12I1PairP ((3,5),(k,l))) = true := by + decide +kernel +lemma CA1_3_12I1PairP_check_4_0 : ∀ k l : Fin 6, contains (CA1_3_12I1PairRaw ((4,0),(k,l))) (CA1_3_12I1PairP ((4,0),(k,l))) = true := by + decide +kernel +lemma CA1_3_12I1PairP_check_4_1 : ∀ k l : Fin 6, contains (CA1_3_12I1PairRaw ((4,1),(k,l))) (CA1_3_12I1PairP ((4,1),(k,l))) = true := by + decide +kernel +lemma CA1_3_12I1PairP_check_4_2 : ∀ k l : Fin 6, contains (CA1_3_12I1PairRaw ((4,2),(k,l))) (CA1_3_12I1PairP ((4,2),(k,l))) = true := by + decide +kernel +lemma CA1_3_12I1PairP_check_4_3 : ∀ k l : Fin 6, contains (CA1_3_12I1PairRaw ((4,3),(k,l))) (CA1_3_12I1PairP ((4,3),(k,l))) = true := by + decide +kernel +lemma CA1_3_12I1PairP_check_4_4 : ∀ k l : Fin 6, contains (CA1_3_12I1PairRaw ((4,4),(k,l))) (CA1_3_12I1PairP ((4,4),(k,l))) = true := by + decide +kernel +lemma CA1_3_12I1PairP_check_4_5 : ∀ k l : Fin 6, contains (CA1_3_12I1PairRaw ((4,5),(k,l))) (CA1_3_12I1PairP ((4,5),(k,l))) = true := by + decide +kernel +lemma CA1_3_12I1PairP_check_5_0 : ∀ k l : Fin 6, contains (CA1_3_12I1PairRaw ((5,0),(k,l))) (CA1_3_12I1PairP ((5,0),(k,l))) = true := by + decide +kernel +lemma CA1_3_12I1PairP_check_5_1 : ∀ k l : Fin 6, contains (CA1_3_12I1PairRaw ((5,1),(k,l))) (CA1_3_12I1PairP ((5,1),(k,l))) = true := by + decide +kernel +lemma CA1_3_12I1PairP_check_5_2 : ∀ k l : Fin 6, contains (CA1_3_12I1PairRaw ((5,2),(k,l))) (CA1_3_12I1PairP ((5,2),(k,l))) = true := by + decide +kernel +lemma CA1_3_12I1PairP_check_5_3 : ∀ k l : Fin 6, contains (CA1_3_12I1PairRaw ((5,3),(k,l))) (CA1_3_12I1PairP ((5,3),(k,l))) = true := by + decide +kernel +lemma CA1_3_12I1PairP_check_5_4 : ∀ k l : Fin 6, contains (CA1_3_12I1PairRaw ((5,4),(k,l))) (CA1_3_12I1PairP ((5,4),(k,l))) = true := by + decide +kernel +lemma CA1_3_12I1PairP_check_5_5 : ∀ k l : Fin 6, contains (CA1_3_12I1PairRaw ((5,5),(k,l))) (CA1_3_12I1PairP ((5,5),(k,l))) = true := by + decide +kernel +lemma CA1_3_12I1PairP_check (a : PairSlot × PairSlot) : contains (CA1_3_12I1PairRaw a) (CA1_3_12I1PairP a) = true := by + rcases a with ⟨⟨i,j⟩,⟨k,l⟩⟩ + revert j i + apply forall_fin6 + · exact forall_fin6 (CA1_3_12I1PairP_check_0_0 k l) (CA1_3_12I1PairP_check_0_1 k l) (CA1_3_12I1PairP_check_0_2 k l) (CA1_3_12I1PairP_check_0_3 k l) (CA1_3_12I1PairP_check_0_4 k l) (CA1_3_12I1PairP_check_0_5 k l) + · exact forall_fin6 (CA1_3_12I1PairP_check_1_0 k l) (CA1_3_12I1PairP_check_1_1 k l) (CA1_3_12I1PairP_check_1_2 k l) (CA1_3_12I1PairP_check_1_3 k l) (CA1_3_12I1PairP_check_1_4 k l) (CA1_3_12I1PairP_check_1_5 k l) + · exact forall_fin6 (CA1_3_12I1PairP_check_2_0 k l) (CA1_3_12I1PairP_check_2_1 k l) (CA1_3_12I1PairP_check_2_2 k l) (CA1_3_12I1PairP_check_2_3 k l) (CA1_3_12I1PairP_check_2_4 k l) (CA1_3_12I1PairP_check_2_5 k l) + · exact forall_fin6 (CA1_3_12I1PairP_check_3_0 k l) (CA1_3_12I1PairP_check_3_1 k l) (CA1_3_12I1PairP_check_3_2 k l) (CA1_3_12I1PairP_check_3_3 k l) (CA1_3_12I1PairP_check_3_4 k l) (CA1_3_12I1PairP_check_3_5 k l) + · exact forall_fin6 (CA1_3_12I1PairP_check_4_0 k l) (CA1_3_12I1PairP_check_4_1 k l) (CA1_3_12I1PairP_check_4_2 k l) (CA1_3_12I1PairP_check_4_3 k l) (CA1_3_12I1PairP_check_4_4 k l) (CA1_3_12I1PairP_check_4_5 k l) + · exact forall_fin6 (CA1_3_12I1PairP_check_5_0 k l) (CA1_3_12I1PairP_check_5_1 k l) (CA1_3_12I1PairP_check_5_2 k l) (CA1_3_12I1PairP_check_5_3 k l) (CA1_3_12I1PairP_check_5_4 k l) (CA1_3_12I1PairP_check_5_5 k l) +lemma CA1_3_12I1PairP_sound (a : PairSlot × PairSlot) : + (CA1_3_12I1PairP a).Encloses (CA1_3_12I1PairValue a) := + contains_sound (CA1_3_12I1PairRaw_sound a) (CA1_3_12I1PairP_check a) +def CA1_3_12I1PairTerms (a : PairSlot × PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_3_12I1PairCertificates (CA1_3_12I1PairCertificateIndex a)).output +lemma CA1_3_12I1PairTerms_sound (a : PairSlot × PairSlot) : + (CA1_3_12I1PairTerms a).Encloses (Foundation.entropyTerm (CA1_3_12I1PairValue a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_3_12I1PairCertificates_valid + (CA1_3_12I1PairCertificateIndex a) (CA1_3_12I1PairP_sound a) +def CA1_3_12I1PairEntropy : Ball := ⟨(70960708386756988050365654400539 / 25000000000000000000000000000000), (30278123179 / 25000000000000000000000000000000)⟩ +lemma CA1_3_12I1PairEntropy_sound : CA1_3_12I1PairEntropy.Encloses (Foundation.finiteEntropy CA1_3_12I1PairValue) := by + exact contains_sound (entropyDoublePair_enclosed CA1_3_12I1PairValue CA1_3_12I1PairTerms CA1_3_12I1PairTerms_sound) (by decide +kernel) +def CA1_3_12I1PairMass : Ball := ⟨(12499999999999999999999999999999 / 12500000000000000000000000000000), (21 / 6250000000000000000000000000000)⟩ +lemma CA1_3_12I1PairMass_sound : CA1_3_12I1PairMass.Encloses (∑ a, CA1_3_12I1PairValue a) := by + exact contains_sound (doublePairSumBall_sound CA1_3_12I1PairP CA1_3_12I1PairValue CA1_3_12I1PairP_sound) (by decide +kernel) +def CA1_3_12I1PairMassTermLogWitness : LogWitness := ⟨-1, 12499999999999999999999999999999, 6250000000000000000000000000000⟩ +def CA1_3_12I1PairMassTermLog : Ball := ⟨(-7 / 100000000000000000000000000000000), (21175823851 / 50000000000000000000000000000000)⟩ +lemma CA1_3_12I1PairMassTermLog_sound : CA1_3_12I1PairMassTermLog.Encloses (Real.log ((∑ a, CA1_3_12I1PairValue a))) := by + exact checkLog_sound logTwoBall_sound (CA1_3_12I1PairMass_sound) (w := CA1_3_12I1PairMassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA1_3_12I1PairMassTerm : Ball := ⟨(7 / 100000000000000000000000000000000), (42351647703 / 100000000000000000000000000000000)⟩ +lemma CA1_3_12I1PairMassTerm_sound : CA1_3_12I1PairMassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_3_12I1PairValue a))) := by + exact contains_sound (entropyTerm_ball (CA1_3_12I1PairMass_sound) CA1_3_12I1PairMassTermLog_sound) (by decide +kernel) +def CA1_3_12I1PairH : Ball := ⟨(283842833547027952201462617602149 / 100000000000000000000000000000000), (163464140419 / 100000000000000000000000000000000)⟩ +lemma CA1_3_12I1PairH_sound : CA1_3_12I1PairH.Encloses (homogeneousEntropy CA1_3_12I1PairValue) := by + exact contains_sound (homogeneous_enclosed CA1_3_12I1PairValue CA1_3_12I1PairMassTerm_sound CA1_3_12I1PairEntropy_sound) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CA1_3_12I1R0Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 3 12)) (fun u => (stageALaw (shape 1 3 12) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 0 a +def CA1_3_12I1R0Raw (a : PairSlot) : Ball := residualBall (below (shape 1 3 12)) A1_3_12Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 0 a +lemma CA1_3_12I1R0Raw_sound (a : PairSlot) : + (CA1_3_12I1R0Raw a).Encloses (CA1_3_12I1R0Value a) := by + exact residualBall_sound_on (below (shape 1 3 12)) A1_3_12Law (fun u => (stageALaw (shape 1 3 12) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A1_3_12Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 3 12) (show (shape 1 3 12) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 0 a +def CA1_3_12I1R0Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(400874738626322884179623341423 / 4000000000000000000000000000000), (37 / 100000000000000000000000000000000)⟩ ⟨(11527156286617510553316846465319 / 50000000000000000000000000000000), (10611066103 / 100000000000000000000000000000000)⟩ ⟨(-115020031704842334608420288281259 / 50000000000000000000000000000000), (1654361231 / 1562500000000000000000000000000)⟩ ⟨-4, 400874738626322884179623341423, 250000000000000000000000000000⟩] +lemma CA1_3_12I1R0Certificates_valid : + CA1_3_12I1R0Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_3_12I1R0CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 0, 0 => 1 + | _, _ => 0 +def CA1_3_12I1R0P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_3_12I1R0Certificates (CA1_3_12I1R0CertificateIndex a)).input +lemma CA1_3_12I1R0P_check : ∀ a : PairSlot, contains (CA1_3_12I1R0Raw a) (CA1_3_12I1R0P a) = true := by + decide +kernel +lemma CA1_3_12I1R0P_sound (a : PairSlot) : + (CA1_3_12I1R0P a).Encloses (CA1_3_12I1R0Value a) := + contains_sound (CA1_3_12I1R0Raw_sound a) (CA1_3_12I1R0P_check a) +def CA1_3_12I1R0Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_3_12I1R0Certificates (CA1_3_12I1R0CertificateIndex a)).output +lemma CA1_3_12I1R0Terms_sound (a : PairSlot) : + (CA1_3_12I1R0Terms a).Encloses (Foundation.entropyTerm (CA1_3_12I1R0Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_3_12I1R0Certificates_valid + (CA1_3_12I1R0CertificateIndex a) (CA1_3_12I1R0P_sound a) +def CA1_3_12I1R0Entropy : Ball := ⟨(11527156286617510553316846465319 / 50000000000000000000000000000000), (10611066103 / 100000000000000000000000000000000)⟩ +lemma CA1_3_12I1R0Entropy_sound : CA1_3_12I1R0Entropy.Encloses (Foundation.finiteEntropy CA1_3_12I1R0Value) := by + exact contains_sound (entropyPair_enclosed CA1_3_12I1R0Value CA1_3_12I1R0Terms CA1_3_12I1R0Terms_sound) (by decide +kernel) +def CA1_3_12I1R0Mass : Ball := ⟨(400874738626322884179623341423 / 4000000000000000000000000000000), (37 / 100000000000000000000000000000000)⟩ +lemma CA1_3_12I1R0Mass_sound : CA1_3_12I1R0Mass.Encloses (∑ a, CA1_3_12I1R0Value a) := by + exact contains_sound (pairSumBall_sound CA1_3_12I1R0P CA1_3_12I1R0Value CA1_3_12I1R0P_sound) (by decide +kernel) +def CA1_3_12I1R0MassTermLogWitness : LogWitness := ⟨-4, 400874738626322884179623341423, 250000000000000000000000000000⟩ +def CA1_3_12I1R0MassTermLog : Ball := ⟨(-115020031704842334608420288281259 / 50000000000000000000000000000000), (1654361231 / 1562500000000000000000000000000)⟩ +lemma CA1_3_12I1R0MassTermLog_sound : CA1_3_12I1R0MassTermLog.Encloses (Real.log ((∑ a, CA1_3_12I1R0Value a))) := by + exact checkLog_sound logTwoBall_sound (CA1_3_12I1R0Mass_sound) (w := CA1_3_12I1R0MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA1_3_12I1R0MassTerm : Ball := ⟨(11527156286617510553316846465319 / 50000000000000000000000000000000), (10611066103 / 100000000000000000000000000000000)⟩ +lemma CA1_3_12I1R0MassTerm_sound : CA1_3_12I1R0MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_3_12I1R0Value a))) := by + exact contains_sound (entropyTerm_ball (CA1_3_12I1R0Mass_sound) CA1_3_12I1R0MassTermLog_sound) (by decide +kernel) +def CA1_3_12I1R0H : Ball := ⟨0, (10611066103 / 50000000000000000000000000000000)⟩ +lemma CA1_3_12I1R0H_sound : CA1_3_12I1R0H.Encloses (homogeneousEntropy CA1_3_12I1R0Value) := by + exact contains_sound (homogeneous_enclosed CA1_3_12I1R0Value CA1_3_12I1R0MassTerm_sound CA1_3_12I1R0Entropy_sound) (by decide +kernel) +def CA1_3_12I1R1Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 3 12)) (fun u => (stageALaw (shape 1 3 12) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 1 a +def CA1_3_12I1R1Raw (a : PairSlot) : Ball := residualBall (below (shape 1 3 12)) A1_3_12Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 1 a +lemma CA1_3_12I1R1Raw_sound (a : PairSlot) : + (CA1_3_12I1R1Raw a).Encloses (CA1_3_12I1R1Value a) := by + exact residualBall_sound_on (below (shape 1 3 12)) A1_3_12Law (fun u => (stageALaw (shape 1 3 12) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A1_3_12Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 3 12) (show (shape 1 3 12) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 1 a +def CA1_3_12I1R1Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(4997266441792740986938677058053 / 25000000000000000000000000000000), (7 / 25000000000000000000000000000000)⟩ ⟨(32182091523171578015673626942937 / 100000000000000000000000000000000), (3386279473 / 20000000000000000000000000000000)⟩ ⟨(-80499238678842675556638879701571 / 50000000000000000000000000000000), (10587911859 / 12500000000000000000000000000000)⟩ ⟨-3, 4997266441792740986938677058053, 3125000000000000000000000000000⟩] +lemma CA1_3_12I1R1Certificates_valid : + CA1_3_12I1R1Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_3_12I1R1CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 1, 0 => 1 + | 0, 1 => 1 + | _, _ => 0 +def CA1_3_12I1R1P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_3_12I1R1Certificates (CA1_3_12I1R1CertificateIndex a)).input +lemma CA1_3_12I1R1P_check : ∀ a : PairSlot, contains (CA1_3_12I1R1Raw a) (CA1_3_12I1R1P a) = true := by + decide +kernel +lemma CA1_3_12I1R1P_sound (a : PairSlot) : + (CA1_3_12I1R1P a).Encloses (CA1_3_12I1R1Value a) := + contains_sound (CA1_3_12I1R1Raw_sound a) (CA1_3_12I1R1P_check a) +def CA1_3_12I1R1Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_3_12I1R1Certificates (CA1_3_12I1R1CertificateIndex a)).output +lemma CA1_3_12I1R1Terms_sound (a : PairSlot) : + (CA1_3_12I1R1Terms a).Encloses (Foundation.entropyTerm (CA1_3_12I1R1Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_3_12I1R1Certificates_valid + (CA1_3_12I1R1CertificateIndex a) (CA1_3_12I1R1P_sound a) +def CA1_3_12I1R1Entropy : Ball := ⟨(32182091523171578015673626942937 / 50000000000000000000000000000000), (3386279473 / 10000000000000000000000000000000)⟩ +lemma CA1_3_12I1R1Entropy_sound : CA1_3_12I1R1Entropy.Encloses (Foundation.finiteEntropy CA1_3_12I1R1Value) := by + exact contains_sound (entropyPair_enclosed CA1_3_12I1R1Value CA1_3_12I1R1Terms CA1_3_12I1R1Terms_sound) (by decide +kernel) +def CA1_3_12I1R1Mass : Ball := ⟨(4997266441792740986938677058053 / 12500000000000000000000000000000), (7 / 12500000000000000000000000000000)⟩ +lemma CA1_3_12I1R1Mass_sound : CA1_3_12I1R1Mass.Encloses (∑ a, CA1_3_12I1R1Value a) := by + exact contains_sound (pairSumBall_sound CA1_3_12I1R1P CA1_3_12I1R1Value CA1_3_12I1R1P_sound) (by decide +kernel) +def CA1_3_12I1R1MassTermLogWitness : LogWitness := ⟨-2, 4997266441792740986938677058053, 3125000000000000000000000000000⟩ +def CA1_3_12I1R1MassTermLog : Ball := ⟨(-22920939825422705042888641588203 / 25000000000000000000000000000000), (63527471189 / 100000000000000000000000000000000)⟩ +lemma CA1_3_12I1R1MassTermLog_sound : CA1_3_12I1R1MassTermLog.Encloses (Real.log ((∑ a, CA1_3_12I1R1Value a))) := by + exact checkLog_sound logTwoBall_sound (CA1_3_12I1R1Mass_sound) (w := CA1_3_12I1R1MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA1_3_12I1R1MassTerm : Ball := ⟨(36653453889259408322891679275017 / 100000000000000000000000000000000), (6349274011 / 25000000000000000000000000000000)⟩ +lemma CA1_3_12I1R1MassTerm_sound : CA1_3_12I1R1MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_3_12I1R1Value a))) := by + exact contains_sound (entropyTerm_ball (CA1_3_12I1R1Mass_sound) CA1_3_12I1R1MassTermLog_sound) (by decide +kernel) +def CA1_3_12I1R1H : Ball := ⟨(27710729157083747708455574610857 / 100000000000000000000000000000000), (29629945387 / 50000000000000000000000000000000)⟩ +lemma CA1_3_12I1R1H_sound : CA1_3_12I1R1H.Encloses (homogeneousEntropy CA1_3_12I1R1Value) := by + exact contains_sound (homogeneous_enclosed CA1_3_12I1R1Value CA1_3_12I1R1MassTerm_sound CA1_3_12I1R1Entropy_sound) (by decide +kernel) +def CA1_3_12I1R2Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 3 12)) (fun u => (stageALaw (shape 1 3 12) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 2 a +def CA1_3_12I1R2Raw (a : PairSlot) : Ball := residualBall (below (shape 1 3 12)) A1_3_12Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 2 a +lemma CA1_3_12I1R2Raw_sound (a : PairSlot) : + (CA1_3_12I1R2Raw a).Encloses (CA1_3_12I1R2Value a) := by + exact residualBall_sound_on (below (shape 1 3 12)) A1_3_12Law (fun u => (stageALaw (shape 1 3 12) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A1_3_12Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 3 12) (show (shape 1 3 12) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 2 a +def CA1_3_12I1R2Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(7410161764947920043043764848881 / 100000000000000000000000000000000), (3 / 12500000000000000000000000000000)⟩ ⟨(9641798361769739933798519412583 / 50000000000000000000000000000000), (7845814037 / 100000000000000000000000000000000)⟩ ⟨(-260231791629113085531458981169017 / 100000000000000000000000000000000), (52939559369 / 50000000000000000000000000000000)⟩ ⟨-4, 7410161764947920043043764848881, 6250000000000000000000000000000⟩, + .log ⟨(649226926258784162271288584613 / 100000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ ⟨(408781120885075007965636602421 / 12500000000000000000000000000000), (618656181 / 50000000000000000000000000000000)⟩ ⟨(-31482144713305790943343459359501 / 6250000000000000000000000000000), (190582413609 / 100000000000000000000000000000000)⟩ ⟨-8, 649226926258784162271288584613, 390625000000000000000000000000⟩, + .log ⟨(11929677075964259742439654798719 / 50000000000000000000000000000000), (9 / 20000000000000000000000000000000)⟩ ⟨(34190307476441104810110094830853 / 100000000000000000000000000000000), (20209659179 / 100000000000000000000000000000000)⟩ ⟨(-17912422973987724365943956967281 / 12500000000000000000000000000000), (2117582373 / 2500000000000000000000000000000)⟩ ⟨-3, 11929677075964259742439654798719, 6250000000000000000000000000000⟩] +lemma CA1_3_12I1R2Certificates_valid : + CA1_3_12I1R2Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_3_12I1R2CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 2, 0 => 1 + | 3, 0 => 2 + | 1, 1 => 3 + | 0, 2 => 1 + | 0, 3 => 2 + | _, _ => 0 +def CA1_3_12I1R2P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_3_12I1R2Certificates (CA1_3_12I1R2CertificateIndex a)).input +lemma CA1_3_12I1R2P_check : ∀ a : PairSlot, contains (CA1_3_12I1R2Raw a) (CA1_3_12I1R2P a) = true := by + decide +kernel +lemma CA1_3_12I1R2P_sound (a : PairSlot) : + (CA1_3_12I1R2P a).Encloses (CA1_3_12I1R2Value a) := + contains_sound (CA1_3_12I1R2Raw_sound a) (CA1_3_12I1R2P_check a) +def CA1_3_12I1R2Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_3_12I1R2Certificates (CA1_3_12I1R2CertificateIndex a)).output +lemma CA1_3_12I1R2Terms_sound (a : PairSlot) : + (CA1_3_12I1R2Terms a).Encloses (Foundation.entropyTerm (CA1_3_12I1R2Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_3_12I1R2Certificates_valid + (CA1_3_12I1R2CertificateIndex a) (CA1_3_12I1R2P_sound a) +def CA1_3_12I1R2Entropy : Ball := ⟨(79297998857681264672754358119921 / 100000000000000000000000000000000), (38375911977 / 100000000000000000000000000000000)⟩ +lemma CA1_3_12I1R2Entropy_sound : CA1_3_12I1R2Entropy.Encloses (Foundation.finiteEntropy CA1_3_12I1R2Value) := by + exact contains_sound (entropyPair_enclosed CA1_3_12I1R2Value CA1_3_12I1R2Terms CA1_3_12I1R2Terms_sound) (by decide +kernel) +def CA1_3_12I1R2Mass : Ball := ⟨(19989065767170963947754708232213 / 50000000000000000000000000000000), (99 / 100000000000000000000000000000000)⟩ +lemma CA1_3_12I1R2Mass_sound : CA1_3_12I1R2Mass.Encloses (∑ a, CA1_3_12I1R2Value a) := by + exact contains_sound (pairSumBall_sound CA1_3_12I1R2P CA1_3_12I1R2Value CA1_3_12I1R2P_sound) (by decide +kernel) +def CA1_3_12I1R2MassTermLogWitness : LogWitness := ⟨-2, 19989065767170963947754708232213, 12500000000000000000000000000000⟩ +def CA1_3_12I1R2MassTermLog : Ball := ⟨(-91683759301690820171554566352807 / 100000000000000000000000000000000), (992616739 / 1562500000000000000000000000000)⟩ +lemma CA1_3_12I1R2MassTermLog_sound : CA1_3_12I1R2MassTermLog.Encloses (Real.log ((∑ a, CA1_3_12I1R2Value a))) := by + exact checkLog_sound logTwoBall_sound (CA1_3_12I1R2Mass_sound) (w := CA1_3_12I1R2MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA1_3_12I1R2MassTerm : Ball := ⟨(36653453889259408322891679275017 / 100000000000000000000000000000000), (25397096127 / 100000000000000000000000000000000)⟩ +lemma CA1_3_12I1R2MassTerm_sound : CA1_3_12I1R2MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_3_12I1R2Value a))) := by + exact contains_sound (entropyTerm_ball (CA1_3_12I1R2Mass_sound) CA1_3_12I1R2MassTermLog_sound) (by decide +kernel) +def CA1_3_12I1R2H : Ball := ⟨(5330568121052732043732834855613 / 12500000000000000000000000000000), (7971626013 / 12500000000000000000000000000000)⟩ +lemma CA1_3_12I1R2H_sound : CA1_3_12I1R2H.Encloses (homogeneousEntropy CA1_3_12I1R2Value) := by + exact contains_sound (homogeneous_enclosed CA1_3_12I1R2Value CA1_3_12I1R2MassTerm_sound CA1_3_12I1R2Entropy_sound) (by decide +kernel) +def CA1_3_12I1R3Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 3 12)) (fun u => (stageALaw (shape 1 3 12) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 3 a +def CA1_3_12I1R3Raw (a : PairSlot) : Ball := residualBall (below (shape 1 3 12)) A1_3_12Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 3 a +lemma CA1_3_12I1R3Raw_sound (a : PairSlot) : + (CA1_3_12I1R3Raw a).Encloses (CA1_3_12I1R3Value a) := by + exact residualBall_sound_on (below (shape 1 3 12)) A1_3_12Law (fun u => (stageALaw (shape 1 3 12) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A1_3_12Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 3 12) (show (shape 1 3 12) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 3 a +def CA1_3_12I1R3Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(129165067930240297565270841043 / 50000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ ⟨(96206778032876131242691152417 / 6250000000000000000000000000000), (136758839 / 25000000000000000000000000000000)⟩ ⟨(-297934355083792968334169073309091 / 50000000000000000000000000000000), (52939559401 / 25000000000000000000000000000000)⟩ ⟨-9, 129165067930240297565270841043, 97656250000000000000000000000⟩, + .log ⟨(2162328515383313515631099877419 / 50000000000000000000000000000000), (1 / 4000000000000000000000000000000)⟩ ⟨(339576107987341944429779096823 / 2500000000000000000000000000000), (549469059 / 10000000000000000000000000000000)⟩ ⟨(-314083734799331057367608445873267 / 100000000000000000000000000000000), (5082197707 / 4000000000000000000000000000000)⟩ ⟨-5, 2162328515383313515631099877419, 1562500000000000000000000000000⟩, + .log ⟨(427947066201928425852550330863 / 100000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ ⟨(2333991611354785982686465723567 / 100000000000000000000000000000000), (407795933 / 50000000000000000000000000000000)⟩ ⟨(-545392595413537266791669348013853 / 100000000000000000000000000000000), (190582413847 / 100000000000000000000000000000000)⟩ ⟨-8, 427947066201928425852550330863, 390625000000000000000000000000⟩] +lemma CA1_3_12I1R3Certificates_valid : + CA1_3_12I1R3Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_3_12I1R3CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 4, 0 => 1 + | 2, 1 => 2 + | 3, 1 => 3 + | 1, 2 => 2 + | 1, 3 => 3 + | 0, 4 => 1 + | _, _ => 0 +def CA1_3_12I1R3P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_3_12I1R3Certificates (CA1_3_12I1R3CertificateIndex a)).input +lemma CA1_3_12I1R3P_check : ∀ a : PairSlot, contains (CA1_3_12I1R3Raw a) (CA1_3_12I1R3P a) = true := by + decide +kernel +lemma CA1_3_12I1R3P_sound (a : PairSlot) : + (CA1_3_12I1R3P a).Encloses (CA1_3_12I1R3Value a) := + contains_sound (CA1_3_12I1R3Raw_sound a) (CA1_3_12I1R3P_check a) +def CA1_3_12I1R3Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_3_12I1R3Certificates (CA1_3_12I1R3CertificateIndex a)).output +lemma CA1_3_12I1R3Terms_sound (a : PairSlot) : + (CA1_3_12I1R3Terms a).Encloses (Foundation.entropyTerm (CA1_3_12I1R3Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_3_12I1R3Certificates_valid + (CA1_3_12I1R3CertificateIndex a) (CA1_3_12I1R3P_sound a) +def CA1_3_12I1R3Entropy : Ball := ⟨(17456344379374481859760688035159 / 50000000000000000000000000000000), (1714329453 / 12500000000000000000000000000000)⟩ +lemma CA1_3_12I1R3Entropy_sound : CA1_3_12I1R3Entropy.Encloses (Foundation.finiteEntropy CA1_3_12I1R3Value) := by + exact contains_sound (entropyPair_enclosed CA1_3_12I1R3Value CA1_3_12I1R3Terms CA1_3_12I1R3Terms_sound) (by decide +kernel) +def CA1_3_12I1R3Mass : Ball := ⟨(5010934232829036052245291767787 / 50000000000000000000000000000000), (3 / 5000000000000000000000000000000)⟩ +lemma CA1_3_12I1R3Mass_sound : CA1_3_12I1R3Mass.Encloses (∑ a, CA1_3_12I1R3Value a) := by + exact contains_sound (pairSumBall_sound CA1_3_12I1R3P CA1_3_12I1R3Value CA1_3_12I1R3P_sound) (by decide +kernel) +def CA1_3_12I1R3MassTermLogWitness : LogWitness := ⟨-4, 5010934232829036052245291767787, 3125000000000000000000000000000⟩ +def CA1_3_12I1R3MassTermLog : Ball := ⟨(-7188751981552645913026268017579 / 3125000000000000000000000000000), (105879119013 / 100000000000000000000000000000000)⟩ +lemma CA1_3_12I1R3MassTermLog_sound : CA1_3_12I1R3MassTermLog.Encloses (Real.log ((∑ a, CA1_3_12I1R3Value a))) := by + exact checkLog_sound logTwoBall_sound (CA1_3_12I1R3Mass_sound) (w := CA1_3_12I1R3MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA1_3_12I1R3MassTerm : Ball := ⟨(23054312573235021106633692930637 / 100000000000000000000000000000000), (10611066179 / 100000000000000000000000000000000)⟩ +lemma CA1_3_12I1R3MassTerm_sound : CA1_3_12I1R3MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_3_12I1R3Value a))) := by + exact contains_sound (entropyTerm_ball (CA1_3_12I1R3Mass_sound) CA1_3_12I1R3MassTermLog_sound) (by decide +kernel) +def CA1_3_12I1R3H : Ball := ⟨(11858376185513942612887683139681 / 100000000000000000000000000000000), (24325701803 / 100000000000000000000000000000000)⟩ +lemma CA1_3_12I1R3H_sound : CA1_3_12I1R3H.Encloses (homogeneousEntropy CA1_3_12I1R3Value) := by + exact contains_sound (homogeneous_enclosed CA1_3_12I1R3Value CA1_3_12I1R3MassTerm_sound CA1_3_12I1R3Entropy_sound) (by decide +kernel) +def CA1_3_12I1R4Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 3 12)) (fun u => (stageALaw (shape 1 3 12) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 4 a +def CA1_3_12I1R4Raw (a : PairSlot) : Ball := residualBall (below (shape 1 3 12)) A1_3_12Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 4 a +lemma CA1_3_12I1R4Raw_sound (a : PairSlot) : + (CA1_3_12I1R4Raw a).Encloses (CA1_3_12I1R4Value a) := by + exact residualBall_sound_on (below (shape 1 3 12)) A1_3_12Law (fun u => (stageALaw (shape 1 3 12) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A1_3_12Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 3 12) (show (shape 1 3 12) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 4 a +def CA1_3_12I1R4Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA1_3_12I1R4Certificates_valid : + CA1_3_12I1R4Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_3_12I1R4CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA1_3_12I1R4P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_3_12I1R4Certificates (CA1_3_12I1R4CertificateIndex a)).input +lemma CA1_3_12I1R4P_check : ∀ a : PairSlot, contains (CA1_3_12I1R4Raw a) (CA1_3_12I1R4P a) = true := by + decide +kernel +lemma CA1_3_12I1R4P_sound (a : PairSlot) : + (CA1_3_12I1R4P a).Encloses (CA1_3_12I1R4Value a) := + contains_sound (CA1_3_12I1R4Raw_sound a) (CA1_3_12I1R4P_check a) +def CA1_3_12I1R4Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_3_12I1R4Certificates (CA1_3_12I1R4CertificateIndex a)).output +lemma CA1_3_12I1R4Terms_sound (a : PairSlot) : + (CA1_3_12I1R4Terms a).Encloses (Foundation.entropyTerm (CA1_3_12I1R4Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_3_12I1R4Certificates_valid + (CA1_3_12I1R4CertificateIndex a) (CA1_3_12I1R4P_sound a) +def CA1_3_12I1R4Entropy : Ball := ⟨0, 0⟩ +lemma CA1_3_12I1R4Entropy_sound : CA1_3_12I1R4Entropy.Encloses (Foundation.finiteEntropy CA1_3_12I1R4Value) := by + exact contains_sound (entropyPair_enclosed CA1_3_12I1R4Value CA1_3_12I1R4Terms CA1_3_12I1R4Terms_sound) (by decide +kernel) +def CA1_3_12I1R4Mass : Ball := ⟨0, 0⟩ +lemma CA1_3_12I1R4Mass_sound : CA1_3_12I1R4Mass.Encloses (∑ a, CA1_3_12I1R4Value a) := by + exact contains_sound (pairSumBall_sound CA1_3_12I1R4P CA1_3_12I1R4Value CA1_3_12I1R4P_sound) (by decide +kernel) +def CA1_3_12I1R4MassTerm : Ball := .exact 0 +lemma CA1_3_12I1R4MassTerm_sound : CA1_3_12I1R4MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_3_12I1R4Value a))) := + entropyTerm_zero_ball (CA1_3_12I1R4Mass_sound) +def CA1_3_12I1R4H : Ball := ⟨0, 0⟩ +lemma CA1_3_12I1R4H_sound : CA1_3_12I1R4H.Encloses (homogeneousEntropy CA1_3_12I1R4Value) := by + exact contains_sound (homogeneous_enclosed CA1_3_12I1R4Value CA1_3_12I1R4MassTerm_sound CA1_3_12I1R4Entropy_sound) (by decide +kernel) +def CA1_3_12I1R5Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 3 12)) (fun u => (stageALaw (shape 1 3 12) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 5 a +def CA1_3_12I1R5Raw (a : PairSlot) : Ball := residualBall (below (shape 1 3 12)) A1_3_12Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 5 a +lemma CA1_3_12I1R5Raw_sound (a : PairSlot) : + (CA1_3_12I1R5Raw a).Encloses (CA1_3_12I1R5Value a) := by + exact residualBall_sound_on (below (shape 1 3 12)) A1_3_12Law (fun u => (stageALaw (shape 1 3 12) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A1_3_12Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 3 12) (show (shape 1 3 12) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 5 a +def CA1_3_12I1R5Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA1_3_12I1R5Certificates_valid : + CA1_3_12I1R5Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_3_12I1R5CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA1_3_12I1R5P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_3_12I1R5Certificates (CA1_3_12I1R5CertificateIndex a)).input +lemma CA1_3_12I1R5P_check : ∀ a : PairSlot, contains (CA1_3_12I1R5Raw a) (CA1_3_12I1R5P a) = true := by + decide +kernel +lemma CA1_3_12I1R5P_sound (a : PairSlot) : + (CA1_3_12I1R5P a).Encloses (CA1_3_12I1R5Value a) := + contains_sound (CA1_3_12I1R5Raw_sound a) (CA1_3_12I1R5P_check a) +def CA1_3_12I1R5Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_3_12I1R5Certificates (CA1_3_12I1R5CertificateIndex a)).output +lemma CA1_3_12I1R5Terms_sound (a : PairSlot) : + (CA1_3_12I1R5Terms a).Encloses (Foundation.entropyTerm (CA1_3_12I1R5Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_3_12I1R5Certificates_valid + (CA1_3_12I1R5CertificateIndex a) (CA1_3_12I1R5P_sound a) +def CA1_3_12I1R5Entropy : Ball := ⟨0, 0⟩ +lemma CA1_3_12I1R5Entropy_sound : CA1_3_12I1R5Entropy.Encloses (Foundation.finiteEntropy CA1_3_12I1R5Value) := by + exact contains_sound (entropyPair_enclosed CA1_3_12I1R5Value CA1_3_12I1R5Terms CA1_3_12I1R5Terms_sound) (by decide +kernel) +def CA1_3_12I1R5Mass : Ball := ⟨0, 0⟩ +lemma CA1_3_12I1R5Mass_sound : CA1_3_12I1R5Mass.Encloses (∑ a, CA1_3_12I1R5Value a) := by + exact contains_sound (pairSumBall_sound CA1_3_12I1R5P CA1_3_12I1R5Value CA1_3_12I1R5P_sound) (by decide +kernel) +def CA1_3_12I1R5MassTerm : Ball := .exact 0 +lemma CA1_3_12I1R5MassTerm_sound : CA1_3_12I1R5MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_3_12I1R5Value a))) := + entropyTerm_zero_ball (CA1_3_12I1R5Mass_sound) +def CA1_3_12I1R5H : Ball := ⟨0, 0⟩ +lemma CA1_3_12I1R5H_sound : CA1_3_12I1R5H.Encloses (homogeneousEntropy CA1_3_12I1R5Value) := by + exact contains_sound (homogeneous_enclosed CA1_3_12I1R5Value CA1_3_12I1R5MassTerm_sound CA1_3_12I1R5Entropy_sound) (by decide +kernel) +def CA1_3_12I1R6Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 3 12)) (fun u => (stageALaw (shape 1 3 12) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 6 a +def CA1_3_12I1R6Raw (a : PairSlot) : Ball := residualBall (below (shape 1 3 12)) A1_3_12Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 6 a +lemma CA1_3_12I1R6Raw_sound (a : PairSlot) : + (CA1_3_12I1R6Raw a).Encloses (CA1_3_12I1R6Value a) := by + exact residualBall_sound_on (below (shape 1 3 12)) A1_3_12Law (fun u => (stageALaw (shape 1 3 12) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A1_3_12Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 3 12) (show (shape 1 3 12) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 6 a +def CA1_3_12I1R6Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA1_3_12I1R6Certificates_valid : + CA1_3_12I1R6Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_3_12I1R6CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA1_3_12I1R6P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_3_12I1R6Certificates (CA1_3_12I1R6CertificateIndex a)).input +lemma CA1_3_12I1R6P_check : ∀ a : PairSlot, contains (CA1_3_12I1R6Raw a) (CA1_3_12I1R6P a) = true := by + decide +kernel +lemma CA1_3_12I1R6P_sound (a : PairSlot) : + (CA1_3_12I1R6P a).Encloses (CA1_3_12I1R6Value a) := + contains_sound (CA1_3_12I1R6Raw_sound a) (CA1_3_12I1R6P_check a) +def CA1_3_12I1R6Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_3_12I1R6Certificates (CA1_3_12I1R6CertificateIndex a)).output +lemma CA1_3_12I1R6Terms_sound (a : PairSlot) : + (CA1_3_12I1R6Terms a).Encloses (Foundation.entropyTerm (CA1_3_12I1R6Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_3_12I1R6Certificates_valid + (CA1_3_12I1R6CertificateIndex a) (CA1_3_12I1R6P_sound a) +def CA1_3_12I1R6Entropy : Ball := ⟨0, 0⟩ +lemma CA1_3_12I1R6Entropy_sound : CA1_3_12I1R6Entropy.Encloses (Foundation.finiteEntropy CA1_3_12I1R6Value) := by + exact contains_sound (entropyPair_enclosed CA1_3_12I1R6Value CA1_3_12I1R6Terms CA1_3_12I1R6Terms_sound) (by decide +kernel) +def CA1_3_12I1R6Mass : Ball := ⟨0, 0⟩ +lemma CA1_3_12I1R6Mass_sound : CA1_3_12I1R6Mass.Encloses (∑ a, CA1_3_12I1R6Value a) := by + exact contains_sound (pairSumBall_sound CA1_3_12I1R6P CA1_3_12I1R6Value CA1_3_12I1R6P_sound) (by decide +kernel) +def CA1_3_12I1R6MassTerm : Ball := .exact 0 +lemma CA1_3_12I1R6MassTerm_sound : CA1_3_12I1R6MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_3_12I1R6Value a))) := + entropyTerm_zero_ball (CA1_3_12I1R6Mass_sound) +def CA1_3_12I1R6H : Ball := ⟨0, 0⟩ +lemma CA1_3_12I1R6H_sound : CA1_3_12I1R6H.Encloses (homogeneousEntropy CA1_3_12I1R6Value) := by + exact contains_sound (homogeneous_enclosed CA1_3_12I1R6Value CA1_3_12I1R6MassTerm_sound CA1_3_12I1R6Entropy_sound) (by decide +kernel) +def CA1_3_12I1R7Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 3 12)) (fun u => (stageALaw (shape 1 3 12) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 7 a +def CA1_3_12I1R7Raw (a : PairSlot) : Ball := residualBall (below (shape 1 3 12)) A1_3_12Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 7 a +lemma CA1_3_12I1R7Raw_sound (a : PairSlot) : + (CA1_3_12I1R7Raw a).Encloses (CA1_3_12I1R7Value a) := by + exact residualBall_sound_on (below (shape 1 3 12)) A1_3_12Law (fun u => (stageALaw (shape 1 3 12) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A1_3_12Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 3 12) (show (shape 1 3 12) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 7 a +def CA1_3_12I1R7Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA1_3_12I1R7Certificates_valid : + CA1_3_12I1R7Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_3_12I1R7CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA1_3_12I1R7P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_3_12I1R7Certificates (CA1_3_12I1R7CertificateIndex a)).input +lemma CA1_3_12I1R7P_check : ∀ a : PairSlot, contains (CA1_3_12I1R7Raw a) (CA1_3_12I1R7P a) = true := by + decide +kernel +lemma CA1_3_12I1R7P_sound (a : PairSlot) : + (CA1_3_12I1R7P a).Encloses (CA1_3_12I1R7Value a) := + contains_sound (CA1_3_12I1R7Raw_sound a) (CA1_3_12I1R7P_check a) +def CA1_3_12I1R7Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_3_12I1R7Certificates (CA1_3_12I1R7CertificateIndex a)).output +lemma CA1_3_12I1R7Terms_sound (a : PairSlot) : + (CA1_3_12I1R7Terms a).Encloses (Foundation.entropyTerm (CA1_3_12I1R7Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_3_12I1R7Certificates_valid + (CA1_3_12I1R7CertificateIndex a) (CA1_3_12I1R7P_sound a) +def CA1_3_12I1R7Entropy : Ball := ⟨0, 0⟩ +lemma CA1_3_12I1R7Entropy_sound : CA1_3_12I1R7Entropy.Encloses (Foundation.finiteEntropy CA1_3_12I1R7Value) := by + exact contains_sound (entropyPair_enclosed CA1_3_12I1R7Value CA1_3_12I1R7Terms CA1_3_12I1R7Terms_sound) (by decide +kernel) +def CA1_3_12I1R7Mass : Ball := ⟨0, 0⟩ +lemma CA1_3_12I1R7Mass_sound : CA1_3_12I1R7Mass.Encloses (∑ a, CA1_3_12I1R7Value a) := by + exact contains_sound (pairSumBall_sound CA1_3_12I1R7P CA1_3_12I1R7Value CA1_3_12I1R7P_sound) (by decide +kernel) +def CA1_3_12I1R7MassTerm : Ball := .exact 0 +lemma CA1_3_12I1R7MassTerm_sound : CA1_3_12I1R7MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_3_12I1R7Value a))) := + entropyTerm_zero_ball (CA1_3_12I1R7Mass_sound) +def CA1_3_12I1R7H : Ball := ⟨0, 0⟩ +lemma CA1_3_12I1R7H_sound : CA1_3_12I1R7H.Encloses (homogeneousEntropy CA1_3_12I1R7Value) := by + exact contains_sound (homogeneous_enclosed CA1_3_12I1R7Value CA1_3_12I1R7MassTerm_sound CA1_3_12I1R7Entropy_sound) (by decide +kernel) +def CA1_3_12I1R8Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 3 12)) (fun u => (stageALaw (shape 1 3 12) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 8 a +def CA1_3_12I1R8Raw (a : PairSlot) : Ball := residualBall (below (shape 1 3 12)) A1_3_12Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 8 a +lemma CA1_3_12I1R8Raw_sound (a : PairSlot) : + (CA1_3_12I1R8Raw a).Encloses (CA1_3_12I1R8Value a) := by + exact residualBall_sound_on (below (shape 1 3 12)) A1_3_12Law (fun u => (stageALaw (shape 1 3 12) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A1_3_12Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 3 12) (show (shape 1 3 12) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 8 a +def CA1_3_12I1R8Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA1_3_12I1R8Certificates_valid : + CA1_3_12I1R8Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_3_12I1R8CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA1_3_12I1R8P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_3_12I1R8Certificates (CA1_3_12I1R8CertificateIndex a)).input +lemma CA1_3_12I1R8P_check : ∀ a : PairSlot, contains (CA1_3_12I1R8Raw a) (CA1_3_12I1R8P a) = true := by + decide +kernel +lemma CA1_3_12I1R8P_sound (a : PairSlot) : + (CA1_3_12I1R8P a).Encloses (CA1_3_12I1R8Value a) := + contains_sound (CA1_3_12I1R8Raw_sound a) (CA1_3_12I1R8P_check a) +def CA1_3_12I1R8Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_3_12I1R8Certificates (CA1_3_12I1R8CertificateIndex a)).output +lemma CA1_3_12I1R8Terms_sound (a : PairSlot) : + (CA1_3_12I1R8Terms a).Encloses (Foundation.entropyTerm (CA1_3_12I1R8Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_3_12I1R8Certificates_valid + (CA1_3_12I1R8CertificateIndex a) (CA1_3_12I1R8P_sound a) +def CA1_3_12I1R8Entropy : Ball := ⟨0, 0⟩ +lemma CA1_3_12I1R8Entropy_sound : CA1_3_12I1R8Entropy.Encloses (Foundation.finiteEntropy CA1_3_12I1R8Value) := by + exact contains_sound (entropyPair_enclosed CA1_3_12I1R8Value CA1_3_12I1R8Terms CA1_3_12I1R8Terms_sound) (by decide +kernel) +def CA1_3_12I1R8Mass : Ball := ⟨0, 0⟩ +lemma CA1_3_12I1R8Mass_sound : CA1_3_12I1R8Mass.Encloses (∑ a, CA1_3_12I1R8Value a) := by + exact contains_sound (pairSumBall_sound CA1_3_12I1R8P CA1_3_12I1R8Value CA1_3_12I1R8P_sound) (by decide +kernel) +def CA1_3_12I1R8MassTerm : Ball := .exact 0 +lemma CA1_3_12I1R8MassTerm_sound : CA1_3_12I1R8MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_3_12I1R8Value a))) := + entropyTerm_zero_ball (CA1_3_12I1R8Mass_sound) +def CA1_3_12I1R8H : Ball := ⟨0, 0⟩ +lemma CA1_3_12I1R8H_sound : CA1_3_12I1R8H.Encloses (homogeneousEntropy CA1_3_12I1R8Value) := by + exact contains_sound (homogeneous_enclosed CA1_3_12I1R8Value CA1_3_12I1R8MassTerm_sound CA1_3_12I1R8Entropy_sound) (by decide +kernel) +def CA1_3_12I1R9Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 3 12)) (fun u => (stageALaw (shape 1 3 12) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 9 a +def CA1_3_12I1R9Raw (a : PairSlot) : Ball := residualBall (below (shape 1 3 12)) A1_3_12Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 9 a +lemma CA1_3_12I1R9Raw_sound (a : PairSlot) : + (CA1_3_12I1R9Raw a).Encloses (CA1_3_12I1R9Value a) := by + exact residualBall_sound_on (below (shape 1 3 12)) A1_3_12Law (fun u => (stageALaw (shape 1 3 12) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A1_3_12Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 3 12) (show (shape 1 3 12) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 9 a +def CA1_3_12I1R9Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA1_3_12I1R9Certificates_valid : + CA1_3_12I1R9Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_3_12I1R9CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA1_3_12I1R9P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_3_12I1R9Certificates (CA1_3_12I1R9CertificateIndex a)).input +lemma CA1_3_12I1R9P_check : ∀ a : PairSlot, contains (CA1_3_12I1R9Raw a) (CA1_3_12I1R9P a) = true := by + decide +kernel +lemma CA1_3_12I1R9P_sound (a : PairSlot) : + (CA1_3_12I1R9P a).Encloses (CA1_3_12I1R9Value a) := + contains_sound (CA1_3_12I1R9Raw_sound a) (CA1_3_12I1R9P_check a) +def CA1_3_12I1R9Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_3_12I1R9Certificates (CA1_3_12I1R9CertificateIndex a)).output +lemma CA1_3_12I1R9Terms_sound (a : PairSlot) : + (CA1_3_12I1R9Terms a).Encloses (Foundation.entropyTerm (CA1_3_12I1R9Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_3_12I1R9Certificates_valid + (CA1_3_12I1R9CertificateIndex a) (CA1_3_12I1R9P_sound a) +def CA1_3_12I1R9Entropy : Ball := ⟨0, 0⟩ +lemma CA1_3_12I1R9Entropy_sound : CA1_3_12I1R9Entropy.Encloses (Foundation.finiteEntropy CA1_3_12I1R9Value) := by + exact contains_sound (entropyPair_enclosed CA1_3_12I1R9Value CA1_3_12I1R9Terms CA1_3_12I1R9Terms_sound) (by decide +kernel) +def CA1_3_12I1R9Mass : Ball := ⟨0, 0⟩ +lemma CA1_3_12I1R9Mass_sound : CA1_3_12I1R9Mass.Encloses (∑ a, CA1_3_12I1R9Value a) := by + exact contains_sound (pairSumBall_sound CA1_3_12I1R9P CA1_3_12I1R9Value CA1_3_12I1R9P_sound) (by decide +kernel) +def CA1_3_12I1R9MassTerm : Ball := .exact 0 +lemma CA1_3_12I1R9MassTerm_sound : CA1_3_12I1R9MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_3_12I1R9Value a))) := + entropyTerm_zero_ball (CA1_3_12I1R9Mass_sound) +def CA1_3_12I1R9H : Ball := ⟨0, 0⟩ +lemma CA1_3_12I1R9H_sound : CA1_3_12I1R9H.Encloses (homogeneousEntropy CA1_3_12I1R9Value) := by + exact contains_sound (homogeneous_enclosed CA1_3_12I1R9Value CA1_3_12I1R9MassTerm_sound CA1_3_12I1R9Entropy_sound) (by decide +kernel) +def CA1_3_12I1R10Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 3 12)) (fun u => (stageALaw (shape 1 3 12) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 10 a +def CA1_3_12I1R10Raw (a : PairSlot) : Ball := residualBall (below (shape 1 3 12)) A1_3_12Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 10 a +lemma CA1_3_12I1R10Raw_sound (a : PairSlot) : + (CA1_3_12I1R10Raw a).Encloses (CA1_3_12I1R10Value a) := by + exact residualBall_sound_on (below (shape 1 3 12)) A1_3_12Law (fun u => (stageALaw (shape 1 3 12) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A1_3_12Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 3 12) (show (shape 1 3 12) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 10 a +def CA1_3_12I1R10Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA1_3_12I1R10Certificates_valid : + CA1_3_12I1R10Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_3_12I1R10CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA1_3_12I1R10P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_3_12I1R10Certificates (CA1_3_12I1R10CertificateIndex a)).input +lemma CA1_3_12I1R10P_check : ∀ a : PairSlot, contains (CA1_3_12I1R10Raw a) (CA1_3_12I1R10P a) = true := by + decide +kernel +lemma CA1_3_12I1R10P_sound (a : PairSlot) : + (CA1_3_12I1R10P a).Encloses (CA1_3_12I1R10Value a) := + contains_sound (CA1_3_12I1R10Raw_sound a) (CA1_3_12I1R10P_check a) +def CA1_3_12I1R10Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_3_12I1R10Certificates (CA1_3_12I1R10CertificateIndex a)).output +lemma CA1_3_12I1R10Terms_sound (a : PairSlot) : + (CA1_3_12I1R10Terms a).Encloses (Foundation.entropyTerm (CA1_3_12I1R10Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_3_12I1R10Certificates_valid + (CA1_3_12I1R10CertificateIndex a) (CA1_3_12I1R10P_sound a) +def CA1_3_12I1R10Entropy : Ball := ⟨0, 0⟩ +lemma CA1_3_12I1R10Entropy_sound : CA1_3_12I1R10Entropy.Encloses (Foundation.finiteEntropy CA1_3_12I1R10Value) := by + exact contains_sound (entropyPair_enclosed CA1_3_12I1R10Value CA1_3_12I1R10Terms CA1_3_12I1R10Terms_sound) (by decide +kernel) +def CA1_3_12I1R10Mass : Ball := ⟨0, 0⟩ +lemma CA1_3_12I1R10Mass_sound : CA1_3_12I1R10Mass.Encloses (∑ a, CA1_3_12I1R10Value a) := by + exact contains_sound (pairSumBall_sound CA1_3_12I1R10P CA1_3_12I1R10Value CA1_3_12I1R10P_sound) (by decide +kernel) +def CA1_3_12I1R10MassTerm : Ball := .exact 0 +lemma CA1_3_12I1R10MassTerm_sound : CA1_3_12I1R10MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_3_12I1R10Value a))) := + entropyTerm_zero_ball (CA1_3_12I1R10Mass_sound) +def CA1_3_12I1R10H : Ball := ⟨0, 0⟩ +lemma CA1_3_12I1R10H_sound : CA1_3_12I1R10H.Encloses (homogeneousEntropy CA1_3_12I1R10Value) := by + exact contains_sound (homogeneous_enclosed CA1_3_12I1R10Value CA1_3_12I1R10MassTerm_sound CA1_3_12I1R10Entropy_sound) (by decide +kernel) +def CA1_3_12I1R11Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 3 12)) (fun u => (stageALaw (shape 1 3 12) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 11 a +def CA1_3_12I1R11Raw (a : PairSlot) : Ball := residualBall (below (shape 1 3 12)) A1_3_12Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 11 a +lemma CA1_3_12I1R11Raw_sound (a : PairSlot) : + (CA1_3_12I1R11Raw a).Encloses (CA1_3_12I1R11Value a) := by + exact residualBall_sound_on (below (shape 1 3 12)) A1_3_12Law (fun u => (stageALaw (shape 1 3 12) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A1_3_12Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 3 12) (show (shape 1 3 12) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 11 a +def CA1_3_12I1R11Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA1_3_12I1R11Certificates_valid : + CA1_3_12I1R11Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_3_12I1R11CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA1_3_12I1R11P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_3_12I1R11Certificates (CA1_3_12I1R11CertificateIndex a)).input +lemma CA1_3_12I1R11P_check : ∀ a : PairSlot, contains (CA1_3_12I1R11Raw a) (CA1_3_12I1R11P a) = true := by + decide +kernel +lemma CA1_3_12I1R11P_sound (a : PairSlot) : + (CA1_3_12I1R11P a).Encloses (CA1_3_12I1R11Value a) := + contains_sound (CA1_3_12I1R11Raw_sound a) (CA1_3_12I1R11P_check a) +def CA1_3_12I1R11Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_3_12I1R11Certificates (CA1_3_12I1R11CertificateIndex a)).output +lemma CA1_3_12I1R11Terms_sound (a : PairSlot) : + (CA1_3_12I1R11Terms a).Encloses (Foundation.entropyTerm (CA1_3_12I1R11Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_3_12I1R11Certificates_valid + (CA1_3_12I1R11CertificateIndex a) (CA1_3_12I1R11P_sound a) +def CA1_3_12I1R11Entropy : Ball := ⟨0, 0⟩ +lemma CA1_3_12I1R11Entropy_sound : CA1_3_12I1R11Entropy.Encloses (Foundation.finiteEntropy CA1_3_12I1R11Value) := by + exact contains_sound (entropyPair_enclosed CA1_3_12I1R11Value CA1_3_12I1R11Terms CA1_3_12I1R11Terms_sound) (by decide +kernel) +def CA1_3_12I1R11Mass : Ball := ⟨0, 0⟩ +lemma CA1_3_12I1R11Mass_sound : CA1_3_12I1R11Mass.Encloses (∑ a, CA1_3_12I1R11Value a) := by + exact contains_sound (pairSumBall_sound CA1_3_12I1R11P CA1_3_12I1R11Value CA1_3_12I1R11P_sound) (by decide +kernel) +def CA1_3_12I1R11MassTerm : Ball := .exact 0 +lemma CA1_3_12I1R11MassTerm_sound : CA1_3_12I1R11MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_3_12I1R11Value a))) := + entropyTerm_zero_ball (CA1_3_12I1R11Mass_sound) +def CA1_3_12I1R11H : Ball := ⟨0, 0⟩ +lemma CA1_3_12I1R11H_sound : CA1_3_12I1R11H.Encloses (homogeneousEntropy CA1_3_12I1R11Value) := by + exact contains_sound (homogeneous_enclosed CA1_3_12I1R11Value CA1_3_12I1R11MassTerm_sound CA1_3_12I1R11Entropy_sound) (by decide +kernel) +def CA1_3_12I1R12Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 3 12)) (fun u => (stageALaw (shape 1 3 12) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 12 a +def CA1_3_12I1R12Raw (a : PairSlot) : Ball := residualBall (below (shape 1 3 12)) A1_3_12Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 12 a +lemma CA1_3_12I1R12Raw_sound (a : PairSlot) : + (CA1_3_12I1R12Raw a).Encloses (CA1_3_12I1R12Value a) := by + exact residualBall_sound_on (below (shape 1 3 12)) A1_3_12Law (fun u => (stageALaw (shape 1 3 12) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A1_3_12Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 3 12) (show (shape 1 3 12) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 12 a +def CA1_3_12I1R12Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA1_3_12I1R12Certificates_valid : + CA1_3_12I1R12Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_3_12I1R12CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA1_3_12I1R12P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_3_12I1R12Certificates (CA1_3_12I1R12CertificateIndex a)).input +lemma CA1_3_12I1R12P_check : ∀ a : PairSlot, contains (CA1_3_12I1R12Raw a) (CA1_3_12I1R12P a) = true := by + decide +kernel +lemma CA1_3_12I1R12P_sound (a : PairSlot) : + (CA1_3_12I1R12P a).Encloses (CA1_3_12I1R12Value a) := + contains_sound (CA1_3_12I1R12Raw_sound a) (CA1_3_12I1R12P_check a) +def CA1_3_12I1R12Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_3_12I1R12Certificates (CA1_3_12I1R12CertificateIndex a)).output +lemma CA1_3_12I1R12Terms_sound (a : PairSlot) : + (CA1_3_12I1R12Terms a).Encloses (Foundation.entropyTerm (CA1_3_12I1R12Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_3_12I1R12Certificates_valid + (CA1_3_12I1R12CertificateIndex a) (CA1_3_12I1R12P_sound a) +def CA1_3_12I1R12Entropy : Ball := ⟨0, 0⟩ +lemma CA1_3_12I1R12Entropy_sound : CA1_3_12I1R12Entropy.Encloses (Foundation.finiteEntropy CA1_3_12I1R12Value) := by + exact contains_sound (entropyPair_enclosed CA1_3_12I1R12Value CA1_3_12I1R12Terms CA1_3_12I1R12Terms_sound) (by decide +kernel) +def CA1_3_12I1R12Mass : Ball := ⟨0, 0⟩ +lemma CA1_3_12I1R12Mass_sound : CA1_3_12I1R12Mass.Encloses (∑ a, CA1_3_12I1R12Value a) := by + exact contains_sound (pairSumBall_sound CA1_3_12I1R12P CA1_3_12I1R12Value CA1_3_12I1R12P_sound) (by decide +kernel) +def CA1_3_12I1R12MassTerm : Ball := .exact 0 +lemma CA1_3_12I1R12MassTerm_sound : CA1_3_12I1R12MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_3_12I1R12Value a))) := + entropyTerm_zero_ball (CA1_3_12I1R12Mass_sound) +def CA1_3_12I1R12H : Ball := ⟨0, 0⟩ +lemma CA1_3_12I1R12H_sound : CA1_3_12I1R12H.Encloses (homogeneousEntropy CA1_3_12I1R12Value) := by + exact contains_sound (homogeneous_enclosed CA1_3_12I1R12Value CA1_3_12I1R12MassTerm_sound CA1_3_12I1R12Entropy_sound) (by decide +kernel) +def CA1_3_12I1R13Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 3 12)) (fun u => (stageALaw (shape 1 3 12) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 13 a +def CA1_3_12I1R13Raw (a : PairSlot) : Ball := residualBall (below (shape 1 3 12)) A1_3_12Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 13 a +lemma CA1_3_12I1R13Raw_sound (a : PairSlot) : + (CA1_3_12I1R13Raw a).Encloses (CA1_3_12I1R13Value a) := by + exact residualBall_sound_on (below (shape 1 3 12)) A1_3_12Law (fun u => (stageALaw (shape 1 3 12) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A1_3_12Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 3 12) (show (shape 1 3 12) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 13 a +def CA1_3_12I1R13Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA1_3_12I1R13Certificates_valid : + CA1_3_12I1R13Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_3_12I1R13CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA1_3_12I1R13P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_3_12I1R13Certificates (CA1_3_12I1R13CertificateIndex a)).input +lemma CA1_3_12I1R13P_check : ∀ a : PairSlot, contains (CA1_3_12I1R13Raw a) (CA1_3_12I1R13P a) = true := by + decide +kernel +lemma CA1_3_12I1R13P_sound (a : PairSlot) : + (CA1_3_12I1R13P a).Encloses (CA1_3_12I1R13Value a) := + contains_sound (CA1_3_12I1R13Raw_sound a) (CA1_3_12I1R13P_check a) +def CA1_3_12I1R13Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_3_12I1R13Certificates (CA1_3_12I1R13CertificateIndex a)).output +lemma CA1_3_12I1R13Terms_sound (a : PairSlot) : + (CA1_3_12I1R13Terms a).Encloses (Foundation.entropyTerm (CA1_3_12I1R13Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_3_12I1R13Certificates_valid + (CA1_3_12I1R13CertificateIndex a) (CA1_3_12I1R13P_sound a) +def CA1_3_12I1R13Entropy : Ball := ⟨0, 0⟩ +lemma CA1_3_12I1R13Entropy_sound : CA1_3_12I1R13Entropy.Encloses (Foundation.finiteEntropy CA1_3_12I1R13Value) := by + exact contains_sound (entropyPair_enclosed CA1_3_12I1R13Value CA1_3_12I1R13Terms CA1_3_12I1R13Terms_sound) (by decide +kernel) +def CA1_3_12I1R13Mass : Ball := ⟨0, 0⟩ +lemma CA1_3_12I1R13Mass_sound : CA1_3_12I1R13Mass.Encloses (∑ a, CA1_3_12I1R13Value a) := by + exact contains_sound (pairSumBall_sound CA1_3_12I1R13P CA1_3_12I1R13Value CA1_3_12I1R13P_sound) (by decide +kernel) +def CA1_3_12I1R13MassTerm : Ball := .exact 0 +lemma CA1_3_12I1R13MassTerm_sound : CA1_3_12I1R13MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_3_12I1R13Value a))) := + entropyTerm_zero_ball (CA1_3_12I1R13Mass_sound) +def CA1_3_12I1R13H : Ball := ⟨0, 0⟩ +lemma CA1_3_12I1R13H_sound : CA1_3_12I1R13H.Encloses (homogeneousEntropy CA1_3_12I1R13Value) := by + exact contains_sound (homogeneous_enclosed CA1_3_12I1R13Value CA1_3_12I1R13MassTerm_sound CA1_3_12I1R13Entropy_sound) (by decide +kernel) +def CA1_3_12I1R14Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 3 12)) (fun u => (stageALaw (shape 1 3 12) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 14 a +def CA1_3_12I1R14Raw (a : PairSlot) : Ball := residualBall (below (shape 1 3 12)) A1_3_12Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 14 a +lemma CA1_3_12I1R14Raw_sound (a : PairSlot) : + (CA1_3_12I1R14Raw a).Encloses (CA1_3_12I1R14Value a) := by + exact residualBall_sound_on (below (shape 1 3 12)) A1_3_12Law (fun u => (stageALaw (shape 1 3 12) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A1_3_12Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 3 12) (show (shape 1 3 12) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 14 a +def CA1_3_12I1R14Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA1_3_12I1R14Certificates_valid : + CA1_3_12I1R14Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_3_12I1R14CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA1_3_12I1R14P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_3_12I1R14Certificates (CA1_3_12I1R14CertificateIndex a)).input +lemma CA1_3_12I1R14P_check : ∀ a : PairSlot, contains (CA1_3_12I1R14Raw a) (CA1_3_12I1R14P a) = true := by + decide +kernel +lemma CA1_3_12I1R14P_sound (a : PairSlot) : + (CA1_3_12I1R14P a).Encloses (CA1_3_12I1R14Value a) := + contains_sound (CA1_3_12I1R14Raw_sound a) (CA1_3_12I1R14P_check a) +def CA1_3_12I1R14Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_3_12I1R14Certificates (CA1_3_12I1R14CertificateIndex a)).output +lemma CA1_3_12I1R14Terms_sound (a : PairSlot) : + (CA1_3_12I1R14Terms a).Encloses (Foundation.entropyTerm (CA1_3_12I1R14Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_3_12I1R14Certificates_valid + (CA1_3_12I1R14CertificateIndex a) (CA1_3_12I1R14P_sound a) +def CA1_3_12I1R14Entropy : Ball := ⟨0, 0⟩ +lemma CA1_3_12I1R14Entropy_sound : CA1_3_12I1R14Entropy.Encloses (Foundation.finiteEntropy CA1_3_12I1R14Value) := by + exact contains_sound (entropyPair_enclosed CA1_3_12I1R14Value CA1_3_12I1R14Terms CA1_3_12I1R14Terms_sound) (by decide +kernel) +def CA1_3_12I1R14Mass : Ball := ⟨0, 0⟩ +lemma CA1_3_12I1R14Mass_sound : CA1_3_12I1R14Mass.Encloses (∑ a, CA1_3_12I1R14Value a) := by + exact contains_sound (pairSumBall_sound CA1_3_12I1R14P CA1_3_12I1R14Value CA1_3_12I1R14P_sound) (by decide +kernel) +def CA1_3_12I1R14MassTerm : Ball := .exact 0 +lemma CA1_3_12I1R14MassTerm_sound : CA1_3_12I1R14MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_3_12I1R14Value a))) := + entropyTerm_zero_ball (CA1_3_12I1R14Mass_sound) +def CA1_3_12I1R14H : Ball := ⟨0, 0⟩ +lemma CA1_3_12I1R14H_sound : CA1_3_12I1R14H.Encloses (homogeneousEntropy CA1_3_12I1R14Value) := by + exact contains_sound (homogeneous_enclosed CA1_3_12I1R14Value CA1_3_12I1R14MassTerm_sound CA1_3_12I1R14Entropy_sound) (by decide +kernel) +def CA1_3_12I1R15Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 3 12)) (fun u => (stageALaw (shape 1 3 12) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 15 a +def CA1_3_12I1R15Raw (a : PairSlot) : Ball := residualBall (below (shape 1 3 12)) A1_3_12Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 15 a +lemma CA1_3_12I1R15Raw_sound (a : PairSlot) : + (CA1_3_12I1R15Raw a).Encloses (CA1_3_12I1R15Value a) := by + exact residualBall_sound_on (below (shape 1 3 12)) A1_3_12Law (fun u => (stageALaw (shape 1 3 12) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A1_3_12Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 3 12) (show (shape 1 3 12) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 15 a +def CA1_3_12I1R15Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA1_3_12I1R15Certificates_valid : + CA1_3_12I1R15Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_3_12I1R15CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA1_3_12I1R15P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_3_12I1R15Certificates (CA1_3_12I1R15CertificateIndex a)).input +lemma CA1_3_12I1R15P_check : ∀ a : PairSlot, contains (CA1_3_12I1R15Raw a) (CA1_3_12I1R15P a) = true := by + decide +kernel +lemma CA1_3_12I1R15P_sound (a : PairSlot) : + (CA1_3_12I1R15P a).Encloses (CA1_3_12I1R15Value a) := + contains_sound (CA1_3_12I1R15Raw_sound a) (CA1_3_12I1R15P_check a) +def CA1_3_12I1R15Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_3_12I1R15Certificates (CA1_3_12I1R15CertificateIndex a)).output +lemma CA1_3_12I1R15Terms_sound (a : PairSlot) : + (CA1_3_12I1R15Terms a).Encloses (Foundation.entropyTerm (CA1_3_12I1R15Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_3_12I1R15Certificates_valid + (CA1_3_12I1R15CertificateIndex a) (CA1_3_12I1R15P_sound a) +def CA1_3_12I1R15Entropy : Ball := ⟨0, 0⟩ +lemma CA1_3_12I1R15Entropy_sound : CA1_3_12I1R15Entropy.Encloses (Foundation.finiteEntropy CA1_3_12I1R15Value) := by + exact contains_sound (entropyPair_enclosed CA1_3_12I1R15Value CA1_3_12I1R15Terms CA1_3_12I1R15Terms_sound) (by decide +kernel) +def CA1_3_12I1R15Mass : Ball := ⟨0, 0⟩ +lemma CA1_3_12I1R15Mass_sound : CA1_3_12I1R15Mass.Encloses (∑ a, CA1_3_12I1R15Value a) := by + exact contains_sound (pairSumBall_sound CA1_3_12I1R15P CA1_3_12I1R15Value CA1_3_12I1R15P_sound) (by decide +kernel) +def CA1_3_12I1R15MassTerm : Ball := .exact 0 +lemma CA1_3_12I1R15MassTerm_sound : CA1_3_12I1R15MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_3_12I1R15Value a))) := + entropyTerm_zero_ball (CA1_3_12I1R15Mass_sound) +def CA1_3_12I1R15H : Ball := ⟨0, 0⟩ +lemma CA1_3_12I1R15H_sound : CA1_3_12I1R15H.Encloses (homogeneousEntropy CA1_3_12I1R15Value) := by + exact contains_sound (homogeneous_enclosed CA1_3_12I1R15Value CA1_3_12I1R15MassTerm_sound CA1_3_12I1R15Entropy_sound) (by decide +kernel) +def CA1_3_12I1R16Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 3 12)) (fun u => (stageALaw (shape 1 3 12) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 16 a +def CA1_3_12I1R16Raw (a : PairSlot) : Ball := residualBall (below (shape 1 3 12)) A1_3_12Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 16 a +lemma CA1_3_12I1R16Raw_sound (a : PairSlot) : + (CA1_3_12I1R16Raw a).Encloses (CA1_3_12I1R16Value a) := by + exact residualBall_sound_on (below (shape 1 3 12)) A1_3_12Law (fun u => (stageALaw (shape 1 3 12) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A1_3_12Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 3 12) (show (shape 1 3 12) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 16 a +def CA1_3_12I1R16Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA1_3_12I1R16Certificates_valid : + CA1_3_12I1R16Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_3_12I1R16CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA1_3_12I1R16P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_3_12I1R16Certificates (CA1_3_12I1R16CertificateIndex a)).input +lemma CA1_3_12I1R16P_check : ∀ a : PairSlot, contains (CA1_3_12I1R16Raw a) (CA1_3_12I1R16P a) = true := by + decide +kernel +lemma CA1_3_12I1R16P_sound (a : PairSlot) : + (CA1_3_12I1R16P a).Encloses (CA1_3_12I1R16Value a) := + contains_sound (CA1_3_12I1R16Raw_sound a) (CA1_3_12I1R16P_check a) +def CA1_3_12I1R16Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_3_12I1R16Certificates (CA1_3_12I1R16CertificateIndex a)).output +lemma CA1_3_12I1R16Terms_sound (a : PairSlot) : + (CA1_3_12I1R16Terms a).Encloses (Foundation.entropyTerm (CA1_3_12I1R16Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_3_12I1R16Certificates_valid + (CA1_3_12I1R16CertificateIndex a) (CA1_3_12I1R16P_sound a) +def CA1_3_12I1R16Entropy : Ball := ⟨0, 0⟩ +lemma CA1_3_12I1R16Entropy_sound : CA1_3_12I1R16Entropy.Encloses (Foundation.finiteEntropy CA1_3_12I1R16Value) := by + exact contains_sound (entropyPair_enclosed CA1_3_12I1R16Value CA1_3_12I1R16Terms CA1_3_12I1R16Terms_sound) (by decide +kernel) +def CA1_3_12I1R16Mass : Ball := ⟨0, 0⟩ +lemma CA1_3_12I1R16Mass_sound : CA1_3_12I1R16Mass.Encloses (∑ a, CA1_3_12I1R16Value a) := by + exact contains_sound (pairSumBall_sound CA1_3_12I1R16P CA1_3_12I1R16Value CA1_3_12I1R16P_sound) (by decide +kernel) +def CA1_3_12I1R16MassTerm : Ball := .exact 0 +lemma CA1_3_12I1R16MassTerm_sound : CA1_3_12I1R16MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_3_12I1R16Value a))) := + entropyTerm_zero_ball (CA1_3_12I1R16Mass_sound) +def CA1_3_12I1R16H : Ball := ⟨0, 0⟩ +lemma CA1_3_12I1R16H_sound : CA1_3_12I1R16H.Encloses (homogeneousEntropy CA1_3_12I1R16Value) := by + exact contains_sound (homogeneous_enclosed CA1_3_12I1R16Value CA1_3_12I1R16MassTerm_sound CA1_3_12I1R16Entropy_sound) (by decide +kernel) +def CA1_3_12I1ResidualEntropies (a : Fin 17) : Ball := + match a.val with + | 0 => CA1_3_12I1R0H + | 1 => CA1_3_12I1R1H + | 2 => CA1_3_12I1R2H + | 3 => CA1_3_12I1R3H + | 4 => CA1_3_12I1R4H + | 5 => CA1_3_12I1R5H + | 6 => CA1_3_12I1R6H + | 7 => CA1_3_12I1R7H + | 8 => CA1_3_12I1R8H + | 9 => CA1_3_12I1R9H + | 10 => CA1_3_12I1R10H + | 11 => CA1_3_12I1R11H + | 12 => CA1_3_12I1R12H + | 13 => CA1_3_12I1R13H + | 14 => CA1_3_12I1R14H + | 15 => CA1_3_12I1R15H + | 16 => CA1_3_12I1R16H + | _ => (.exact 0) +lemma CA1_3_12I1ResidualEntropies_sound (k : Fin 17) : + (CA1_3_12I1ResidualEntropies k).Encloses (homogeneousEntropy + (residualLaw (below (shape 1 3 12)) (fun u => (stageALaw (shape 1 3 12) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) k)) := by + fin_cases k + · exact CA1_3_12I1R0H_sound + · exact CA1_3_12I1R1H_sound + · exact CA1_3_12I1R2H_sound + · exact CA1_3_12I1R3H_sound + · exact CA1_3_12I1R4H_sound + · exact CA1_3_12I1R5H_sound + · exact CA1_3_12I1R6H_sound + · exact CA1_3_12I1R7H_sound + · exact CA1_3_12I1R8H_sound + · exact CA1_3_12I1R9H_sound + · exact CA1_3_12I1R10H_sound + · exact CA1_3_12I1R11H_sound + · exact CA1_3_12I1R12H_sound + · exact CA1_3_12I1R13H_sound + · exact CA1_3_12I1R14H_sound + · exact CA1_3_12I1R15H_sound + · exact CA1_3_12I1R16H_sound +def CA1_3_12I1Singles (s : Shape) : Ball := + match s 0, s 1, s 2 with + | _, _, _ => (.exact 0) +lemma CA1_3_12I1Singles_sound (u : Shape) (hu : u ∈ below (shape 1 3 12)) + (hd : designated (Equiv.refl (Fin 3)) 1 u) : + (CA1_3_12I1Singles u).Encloses (homogeneousEntropy ((fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) u)) := by + rw [A1_3_12_below] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 0 0 8) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 0 1 7) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 0 2 6) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 0 3 5) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 1 0 7) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 1 1 6) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 1 2 5) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 1 3 4) by decide +kernel) hd |>.elim +def CA1_3_12I1Singleton : Ball := ⟨0, 0⟩ +lemma CA1_3_12I1Singleton_sound : CA1_3_12I1Singleton.Encloses + (singletonEntropy (below (shape 1 3 12)) (fun u => (stageALaw (shape 1 3 12) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ))) := by + exact contains_sound (singletonBall_sound (below (shape 1 3 12)) A1_3_12Law (fun u => (stageALaw (shape 1 3 12) u : ℝ)) (Equiv.refl (Fin 3)) 1 + CA1_3_12I1Singles (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A1_3_12Law_sound u) CA1_3_12I1Singles_sound) (by decide +kernel) +def CA1_3_12I1Group : Ball := ⟨(41106825155509773335602968297721 / 50000000000000000000000000000000), (168580732887 / 100000000000000000000000000000000)⟩ +lemma CA1_3_12I1Group_sound : CA1_3_12I1Group.Encloses + (groupedEntropy (below (shape 1 3 12)) (fun u => (stageALaw (shape 1 3 12) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ))) := by + exact contains_sound (Ball.add_sound CA1_3_12I1Singleton_sound + (finSumBall_sound 17 CA1_3_12I1ResidualEntropies _ CA1_3_12I1ResidualEntropies_sound)) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CA1_3_12I1H : Ball := ⟨(23883106584997771771810148882253 / 20000000000000000000000000000000), (500625606193 / 100000000000000000000000000000000)⟩ +lemma CA1_3_12I1_sound : CA1_3_12I1H.Encloses (stageACapacity (shape 1 3 12) 1) := by + have hb := contains_sound (Ball.add_sound CA1_3_12I1PairH_sound + (Ball.neg_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) CA1_3_12I1Group_sound))) + (show contains (.add CA1_3_12I1PairH (.neg (.mul (.exact 2) CA1_3_12I1Group))) CA1_3_12I1H = true by decide +kernel) + simp only [stageACapacity, nativeCapacity, + show (1 : Fin 3) ≠ 0 by decide, ite_false] + change CA1_3_12I1H.Encloses (homogeneousEntropy CA1_3_12I1PairValue - _) + simpa only [sub_eq_add_neg] using hb + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA1_3_12I2.lean b/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA1_3_12I2.lean new file mode 100644 index 0000000000000000000000000000000000000000..c5c828d5d995ee178f8e7d08a183d269d5bd30a2 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA1_3_12I2.lean @@ -0,0 +1,1021 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Certificates.SupportedContraction + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CA1_3_12I2PairValue (a : PairSlot × PairSlot) : ℝ := pairLaw (below (shape 1 3 12)) (shape 1 3 12) (fun u => (stageALaw (shape 1 3 12) u : ℝ)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) a +def CA1_3_12I2PairRaw (a : PairSlot × PairSlot) : Ball := stageAPairBall (shape 1 3 12) A1_3_12Law 2 a +lemma CA1_3_12I2PairRaw_sound (a : PairSlot × PairSlot) : + (CA1_3_12I2PairRaw a).Encloses (CA1_3_12I2PairValue a) := by + exact stageAPairBall_sound (shape 1 3 12) (by decide +kernel) A1_3_12Law (fun u => (stageALaw (shape 1 3 12) u : ℝ)) (fun u _ => A1_3_12Law_sound u) 2 a +def CA1_3_12I2PairCertificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(50082087363917606319814311 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(1383654904061334667470463697 / 100000000000000000000000000000000), (222719 / 50000000000000000000000000000000)⟩ ⟨(-345346753921994490879955066322143 / 25000000000000000000000000000000), (444693295703 / 100000000000000000000000000000000)⟩ ⟨-20, 50082087363917606319814311, 47683715820312500000000000⟩, + .log ⟨(19841937830486887774354987443 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(77700835228309911776401415997 / 25000000000000000000000000000000), (6827753 / 6250000000000000000000000000000)⟩ ⟨(-31327922057662556035001420397059 / 4000000000000000000000000000000), (137642855199 / 50000000000000000000000000000000)⟩ ⟨-12, 19841937830486887774354987443, 12207031250000000000000000000⟩, + .log ⟨(421711917054587868544682972531 / 100000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ ⟨(1153087536871705885099378254267 / 50000000000000000000000000000000), (25115899 / 3125000000000000000000000000000)⟩ ⟨(-546860304506142847761138852694761 / 100000000000000000000000000000000), (95291206929 / 50000000000000000000000000000000)⟩ ⟨-8, 421711917054587868544682972531, 390625000000000000000000000000⟩, + .log ⟨(21865753501080039753838898887 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(184284654016386747338159941657 / 100000000000000000000000000000000), (32411779 / 50000000000000000000000000000000)⟩ ⟨(-84280038191816334236063582536979 / 10000000000000000000000000000000), (59292307227 / 20000000000000000000000000000000)⟩ ⟨-13, 21865753501080039753838898887, 12207031250000000000000000000⟩, + .log ⟨(13025852419139529812865781 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(753803492690890127858215639 / 100000000000000000000000000000000), (242749 / 100000000000000000000000000000000)⟩ ⟨(-1446745035248690017606643015894427 / 100000000000000000000000000000000), (93174008057 / 20000000000000000000000000000000)⟩ ⟨-21, 13025852419139529812865781, 11920928955078125000000000⟩, + .log ⟨(64772240606369986691359369003 / 50000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ ⟨(430664225608898488523443421233 / 50000000000000000000000000000000), (75438309 / 25000000000000000000000000000000)⟩ ⟨(-332445057926979506581545013063421 / 50000000000000000000000000000000), (29116757757 / 12500000000000000000000000000000)⟩ ⟨-10, 64772240606369986691359369003, 48828125000000000000000000000⟩, + .log ⟨(293481350991874384936816552981 / 6250000000000000000000000000000), (21 / 100000000000000000000000000000000)⟩ ⟨(14361909728850320975859891239579 / 100000000000000000000000000000000), (1193224211 / 20000000000000000000000000000000)⟩ ⟨(-152926132277140403151366427085823 / 50000000000000000000000000000000), (25410988509 / 20000000000000000000000000000000)⟩ ⟨-5, 293481350991874384936816552981, 195312500000000000000000000000⟩, + .log ⟨(37553822772837218665908832711 / 12500000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ ⟨(872406659762958900834523798143 / 50000000000000000000000000000000), (318093259 / 50000000000000000000000000000000)⟩ ⟨(-580770874539284580934396306637859 / 100000000000000000000000000000000), (42351647499 / 20000000000000000000000000000000)⟩ ⟨-9, 37553822772837218665908832711, 24414062500000000000000000000⟩, + .log ⟨(104664532945849915788600593467 / 100000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ ⟨(28729012432813792031117488589 / 4000000000000000000000000000000), (243799363 / 100000000000000000000000000000000)⟩ ⟨(-686216515380555533295159876857727 / 100000000000000000000000000000000), (232934062423 / 100000000000000000000000000000000)⟩ ⟨-10, 104664532945849915788600593467, 97656250000000000000000000000⟩, + .log ⟨(1060559171328409349906095801 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(42710138192577156114905265117 / 100000000000000000000000000000000), (14373269 / 100000000000000000000000000000000)⟩ ⟨(-1006783481469504726226195381566151 / 100000000000000000000000000000000), (135525281 / 40000000000000000000000000000)⟩ ⟨-15, 1060559171328409349906095801, 762939453125000000000000000⟩, + .log ⟨(282263577762860498035221176179 / 5000000000000000000000000000000), (9 / 50000000000000000000000000000000)⟩ ⟨(8113248465540511183166549320663 / 50000000000000000000000000000000), (224143643 / 3125000000000000000000000000000)⟩ ⟨(-4491174818898312952583896580601 / 1562500000000000000000000000000), (127054942417 / 100000000000000000000000000000000)⟩ ⟨-5, 282263577762860498035221176179, 156250000000000000000000000000⟩, + .log ⟨(133535008366915836782953 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(2543545192383634783147461 / 25000000000000000000000000000000), (3301 / 100000000000000000000000000000000)⟩ ⟨(-1904777798339371339622526189435513 / 100000000000000000000000000000000), (614286103629 / 100000000000000000000000000000000)⟩ ⟨-28, 133535008366915836782953, 93132257461547851562500⟩, + .log ⟨(17779922212048038852756426829 / 4000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ ⟨(481478496401180235881466494277 / 20000000000000000000000000000000), (423567567 / 50000000000000000000000000000000)⟩ ⟨(-67699747313140740500717943457123 / 12500000000000000000000000000000), (47645603399 / 25000000000000000000000000000000)⟩ ⟨-8, 17779922212048038852756426829, 15625000000000000000000000000⟩, + .log ⟨(16546391373770617564960410198009 / 50000000000000000000000000000000), (13 / 25000000000000000000000000000000)⟩ ⟨(914895457855740294931196810659 / 2500000000000000000000000000000), (21023008089 / 100000000000000000000000000000000)⟩ ⟨(-110585497126102667059592942702409 / 100000000000000000000000000000000), (12705494241 / 20000000000000000000000000000000)⟩ ⟨-2, 16546391373770617564960410198009, 12500000000000000000000000000000⟩] +lemma CA1_3_12I2PairCertificates_valid : + CA1_3_12I2PairCertificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_3_12I2PairCertificateIndex (a : PairSlot × PairSlot) : ℕ := + match a.1.1.val, a.1.2.val, a.2.1.val, a.2.2.val with + | 5, 5, 5, 0 => 1 + | 5, 5, 4, 1 => 2 + | 5, 5, 2, 2 => 3 + | 5, 5, 2, 3 => 4 + | 5, 5, 3, 2 => 4 + | 5, 5, 3, 3 => 5 + | 5, 5, 1, 4 => 2 + | 5, 5, 0, 5 => 1 + | 4, 5, 5, 1 => 6 + | 4, 5, 4, 2 => 7 + | 4, 5, 4, 3 => 8 + | 4, 5, 2, 4 => 7 + | 4, 5, 3, 4 => 8 + | 4, 5, 1, 5 => 6 + | 5, 4, 5, 1 => 6 + | 5, 4, 4, 2 => 7 + | 5, 4, 4, 3 => 8 + | 5, 4, 2, 4 => 7 + | 5, 4, 3, 4 => 8 + | 5, 4, 1, 5 => 6 + | 2, 5, 5, 2 => 9 + | 2, 5, 5, 3 => 10 + | 2, 5, 4, 4 => 11 + | 2, 5, 2, 5 => 9 + | 2, 5, 3, 5 => 10 + | 3, 5, 5, 2 => 10 + | 3, 5, 5, 3 => 12 + | 3, 5, 4, 4 => 13 + | 3, 5, 2, 5 => 10 + | 3, 5, 3, 5 => 12 + | 4, 4, 5, 2 => 11 + | 4, 4, 5, 3 => 13 + | 4, 4, 4, 4 => 14 + | 4, 4, 2, 5 => 11 + | 4, 4, 3, 5 => 13 + | 5, 2, 5, 2 => 9 + | 5, 2, 5, 3 => 10 + | 5, 2, 4, 4 => 11 + | 5, 2, 2, 5 => 9 + | 5, 2, 3, 5 => 10 + | 5, 3, 5, 2 => 10 + | 5, 3, 5, 3 => 12 + | 5, 3, 4, 4 => 13 + | 5, 3, 2, 5 => 10 + | 5, 3, 3, 5 => 12 + | 1, 5, 4, 5 => 6 + | 1, 5, 5, 4 => 6 + | 2, 4, 4, 5 => 7 + | 2, 4, 5, 4 => 7 + | 3, 4, 4, 5 => 8 + | 3, 4, 5, 4 => 8 + | 4, 2, 4, 5 => 7 + | 4, 2, 5, 4 => 7 + | 4, 3, 4, 5 => 8 + | 4, 3, 5, 4 => 8 + | 5, 1, 4, 5 => 6 + | 5, 1, 5, 4 => 6 + | 5, 0, 5, 5 => 1 + | 4, 1, 5, 5 => 2 + | 2, 2, 5, 5 => 3 + | 2, 3, 5, 5 => 4 + | 3, 2, 5, 5 => 4 + | 3, 3, 5, 5 => 5 + | 1, 4, 5, 5 => 2 + | 0, 5, 5, 5 => 1 + | _, _, _, _ => 0 +def CA1_3_12I2PairP (a : PairSlot × PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_3_12I2PairCertificates (CA1_3_12I2PairCertificateIndex a)).input +lemma CA1_3_12I2PairP_check_0_0 : ∀ k l : Fin 6, contains (CA1_3_12I2PairRaw ((0,0),(k,l))) (CA1_3_12I2PairP ((0,0),(k,l))) = true := by + decide +kernel +lemma CA1_3_12I2PairP_check_0_1 : ∀ k l : Fin 6, contains (CA1_3_12I2PairRaw ((0,1),(k,l))) (CA1_3_12I2PairP ((0,1),(k,l))) = true := by + decide +kernel +lemma CA1_3_12I2PairP_check_0_2 : ∀ k l : Fin 6, contains (CA1_3_12I2PairRaw ((0,2),(k,l))) (CA1_3_12I2PairP ((0,2),(k,l))) = true := by + decide +kernel +lemma CA1_3_12I2PairP_check_0_3 : ∀ k l : Fin 6, contains (CA1_3_12I2PairRaw ((0,3),(k,l))) (CA1_3_12I2PairP ((0,3),(k,l))) = true := by + decide +kernel +lemma CA1_3_12I2PairP_check_0_4 : ∀ k l : Fin 6, contains (CA1_3_12I2PairRaw ((0,4),(k,l))) (CA1_3_12I2PairP ((0,4),(k,l))) = true := by + decide +kernel +lemma CA1_3_12I2PairP_check_0_5 : ∀ k l : Fin 6, contains (CA1_3_12I2PairRaw ((0,5),(k,l))) (CA1_3_12I2PairP ((0,5),(k,l))) = true := by + decide +kernel +lemma CA1_3_12I2PairP_check_1_0 : ∀ k l : Fin 6, contains (CA1_3_12I2PairRaw ((1,0),(k,l))) (CA1_3_12I2PairP ((1,0),(k,l))) = true := by + decide +kernel +lemma CA1_3_12I2PairP_check_1_1 : ∀ k l : Fin 6, contains (CA1_3_12I2PairRaw ((1,1),(k,l))) (CA1_3_12I2PairP ((1,1),(k,l))) = true := by + decide +kernel +lemma CA1_3_12I2PairP_check_1_2 : ∀ k l : Fin 6, contains (CA1_3_12I2PairRaw ((1,2),(k,l))) (CA1_3_12I2PairP ((1,2),(k,l))) = true := by + decide +kernel +lemma CA1_3_12I2PairP_check_1_3 : ∀ k l : Fin 6, contains (CA1_3_12I2PairRaw ((1,3),(k,l))) (CA1_3_12I2PairP ((1,3),(k,l))) = true := by + decide +kernel +lemma CA1_3_12I2PairP_check_1_4 : ∀ k l : Fin 6, contains (CA1_3_12I2PairRaw ((1,4),(k,l))) (CA1_3_12I2PairP ((1,4),(k,l))) = true := by + decide +kernel +lemma CA1_3_12I2PairP_check_1_5 : ∀ k l : Fin 6, contains (CA1_3_12I2PairRaw ((1,5),(k,l))) (CA1_3_12I2PairP ((1,5),(k,l))) = true := by + decide +kernel +lemma CA1_3_12I2PairP_check_2_0 : ∀ k l : Fin 6, contains (CA1_3_12I2PairRaw ((2,0),(k,l))) (CA1_3_12I2PairP ((2,0),(k,l))) = true := by + decide +kernel +lemma CA1_3_12I2PairP_check_2_1 : ∀ k l : Fin 6, contains (CA1_3_12I2PairRaw ((2,1),(k,l))) (CA1_3_12I2PairP ((2,1),(k,l))) = true := by + decide +kernel +lemma CA1_3_12I2PairP_check_2_2 : ∀ k l : Fin 6, contains (CA1_3_12I2PairRaw ((2,2),(k,l))) (CA1_3_12I2PairP ((2,2),(k,l))) = true := by + decide +kernel +lemma CA1_3_12I2PairP_check_2_3 : ∀ k l : Fin 6, contains (CA1_3_12I2PairRaw ((2,3),(k,l))) (CA1_3_12I2PairP ((2,3),(k,l))) = true := by + decide +kernel +lemma CA1_3_12I2PairP_check_2_4 : ∀ k l : Fin 6, contains (CA1_3_12I2PairRaw ((2,4),(k,l))) (CA1_3_12I2PairP ((2,4),(k,l))) = true := by + decide +kernel +lemma CA1_3_12I2PairP_check_2_5 : ∀ k l : Fin 6, contains (CA1_3_12I2PairRaw ((2,5),(k,l))) (CA1_3_12I2PairP ((2,5),(k,l))) = true := by + decide +kernel +lemma CA1_3_12I2PairP_check_3_0 : ∀ k l : Fin 6, contains (CA1_3_12I2PairRaw ((3,0),(k,l))) (CA1_3_12I2PairP ((3,0),(k,l))) = true := by + decide +kernel +lemma CA1_3_12I2PairP_check_3_1 : ∀ k l : Fin 6, contains (CA1_3_12I2PairRaw ((3,1),(k,l))) (CA1_3_12I2PairP ((3,1),(k,l))) = true := by + decide +kernel +lemma CA1_3_12I2PairP_check_3_2 : ∀ k l : Fin 6, contains (CA1_3_12I2PairRaw ((3,2),(k,l))) (CA1_3_12I2PairP ((3,2),(k,l))) = true := by + decide +kernel +lemma CA1_3_12I2PairP_check_3_3 : ∀ k l : Fin 6, contains (CA1_3_12I2PairRaw ((3,3),(k,l))) (CA1_3_12I2PairP ((3,3),(k,l))) = true := by + decide +kernel +lemma CA1_3_12I2PairP_check_3_4 : ∀ k l : Fin 6, contains (CA1_3_12I2PairRaw ((3,4),(k,l))) (CA1_3_12I2PairP ((3,4),(k,l))) = true := by + decide +kernel +lemma CA1_3_12I2PairP_check_3_5 : ∀ k l : Fin 6, contains (CA1_3_12I2PairRaw ((3,5),(k,l))) (CA1_3_12I2PairP ((3,5),(k,l))) = true := by + decide +kernel +lemma CA1_3_12I2PairP_check_4_0 : ∀ k l : Fin 6, contains (CA1_3_12I2PairRaw ((4,0),(k,l))) (CA1_3_12I2PairP ((4,0),(k,l))) = true := by + decide +kernel +lemma CA1_3_12I2PairP_check_4_1 : ∀ k l : Fin 6, contains (CA1_3_12I2PairRaw ((4,1),(k,l))) (CA1_3_12I2PairP ((4,1),(k,l))) = true := by + decide +kernel +lemma CA1_3_12I2PairP_check_4_2 : ∀ k l : Fin 6, contains (CA1_3_12I2PairRaw ((4,2),(k,l))) (CA1_3_12I2PairP ((4,2),(k,l))) = true := by + decide +kernel +lemma CA1_3_12I2PairP_check_4_3 : ∀ k l : Fin 6, contains (CA1_3_12I2PairRaw ((4,3),(k,l))) (CA1_3_12I2PairP ((4,3),(k,l))) = true := by + decide +kernel +lemma CA1_3_12I2PairP_check_4_4 : ∀ k l : Fin 6, contains (CA1_3_12I2PairRaw ((4,4),(k,l))) (CA1_3_12I2PairP ((4,4),(k,l))) = true := by + decide +kernel +lemma CA1_3_12I2PairP_check_4_5 : ∀ k l : Fin 6, contains (CA1_3_12I2PairRaw ((4,5),(k,l))) (CA1_3_12I2PairP ((4,5),(k,l))) = true := by + decide +kernel +lemma CA1_3_12I2PairP_check_5_0 : ∀ k l : Fin 6, contains (CA1_3_12I2PairRaw ((5,0),(k,l))) (CA1_3_12I2PairP ((5,0),(k,l))) = true := by + decide +kernel +lemma CA1_3_12I2PairP_check_5_1 : ∀ k l : Fin 6, contains (CA1_3_12I2PairRaw ((5,1),(k,l))) (CA1_3_12I2PairP ((5,1),(k,l))) = true := by + decide +kernel +lemma CA1_3_12I2PairP_check_5_2 : ∀ k l : Fin 6, contains (CA1_3_12I2PairRaw ((5,2),(k,l))) (CA1_3_12I2PairP ((5,2),(k,l))) = true := by + decide +kernel +lemma CA1_3_12I2PairP_check_5_3 : ∀ k l : Fin 6, contains (CA1_3_12I2PairRaw ((5,3),(k,l))) (CA1_3_12I2PairP ((5,3),(k,l))) = true := by + decide +kernel +lemma CA1_3_12I2PairP_check_5_4 : ∀ k l : Fin 6, contains (CA1_3_12I2PairRaw ((5,4),(k,l))) (CA1_3_12I2PairP ((5,4),(k,l))) = true := by + decide +kernel +lemma CA1_3_12I2PairP_check_5_5 : ∀ k l : Fin 6, contains (CA1_3_12I2PairRaw ((5,5),(k,l))) (CA1_3_12I2PairP ((5,5),(k,l))) = true := by + decide +kernel +lemma CA1_3_12I2PairP_check (a : PairSlot × PairSlot) : contains (CA1_3_12I2PairRaw a) (CA1_3_12I2PairP a) = true := by + rcases a with ⟨⟨i,j⟩,⟨k,l⟩⟩ + revert j i + apply forall_fin6 + · exact forall_fin6 (CA1_3_12I2PairP_check_0_0 k l) (CA1_3_12I2PairP_check_0_1 k l) (CA1_3_12I2PairP_check_0_2 k l) (CA1_3_12I2PairP_check_0_3 k l) (CA1_3_12I2PairP_check_0_4 k l) (CA1_3_12I2PairP_check_0_5 k l) + · exact forall_fin6 (CA1_3_12I2PairP_check_1_0 k l) (CA1_3_12I2PairP_check_1_1 k l) (CA1_3_12I2PairP_check_1_2 k l) (CA1_3_12I2PairP_check_1_3 k l) (CA1_3_12I2PairP_check_1_4 k l) (CA1_3_12I2PairP_check_1_5 k l) + · exact forall_fin6 (CA1_3_12I2PairP_check_2_0 k l) (CA1_3_12I2PairP_check_2_1 k l) (CA1_3_12I2PairP_check_2_2 k l) (CA1_3_12I2PairP_check_2_3 k l) (CA1_3_12I2PairP_check_2_4 k l) (CA1_3_12I2PairP_check_2_5 k l) + · exact forall_fin6 (CA1_3_12I2PairP_check_3_0 k l) (CA1_3_12I2PairP_check_3_1 k l) (CA1_3_12I2PairP_check_3_2 k l) (CA1_3_12I2PairP_check_3_3 k l) (CA1_3_12I2PairP_check_3_4 k l) (CA1_3_12I2PairP_check_3_5 k l) + · exact forall_fin6 (CA1_3_12I2PairP_check_4_0 k l) (CA1_3_12I2PairP_check_4_1 k l) (CA1_3_12I2PairP_check_4_2 k l) (CA1_3_12I2PairP_check_4_3 k l) (CA1_3_12I2PairP_check_4_4 k l) (CA1_3_12I2PairP_check_4_5 k l) + · exact forall_fin6 (CA1_3_12I2PairP_check_5_0 k l) (CA1_3_12I2PairP_check_5_1 k l) (CA1_3_12I2PairP_check_5_2 k l) (CA1_3_12I2PairP_check_5_3 k l) (CA1_3_12I2PairP_check_5_4 k l) (CA1_3_12I2PairP_check_5_5 k l) +lemma CA1_3_12I2PairP_sound (a : PairSlot × PairSlot) : + (CA1_3_12I2PairP a).Encloses (CA1_3_12I2PairValue a) := + contains_sound (CA1_3_12I2PairRaw_sound a) (CA1_3_12I2PairP_check a) +def CA1_3_12I2PairTerms (a : PairSlot × PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_3_12I2PairCertificates (CA1_3_12I2PairCertificateIndex a)).output +lemma CA1_3_12I2PairTerms_sound (a : PairSlot × PairSlot) : + (CA1_3_12I2PairTerms a).Encloses (Foundation.entropyTerm (CA1_3_12I2PairValue a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_3_12I2PairCertificates_valid + (CA1_3_12I2PairCertificateIndex a) (CA1_3_12I2PairP_sound a) +def CA1_3_12I2PairEntropy : Ball := ⟨(128345077681340811422050948684389 / 50000000000000000000000000000000), (111730573419 / 100000000000000000000000000000000)⟩ +lemma CA1_3_12I2PairEntropy_sound : CA1_3_12I2PairEntropy.Encloses (Foundation.finiteEntropy CA1_3_12I2PairValue) := by + exact contains_sound (entropyDoublePair_enclosed CA1_3_12I2PairValue CA1_3_12I2PairTerms CA1_3_12I2PairTerms_sound) (by decide +kernel) +def CA1_3_12I2PairMass : Ball := ⟨(24999999999999999999999999999999 / 25000000000000000000000000000000), (93 / 25000000000000000000000000000000)⟩ +lemma CA1_3_12I2PairMass_sound : CA1_3_12I2PairMass.Encloses (∑ a, CA1_3_12I2PairValue a) := by + exact contains_sound (doublePairSumBall_sound CA1_3_12I2PairP CA1_3_12I2PairValue CA1_3_12I2PairP_sound) (by decide +kernel) +def CA1_3_12I2PairMassTermLogWitness : LogWitness := ⟨-1, 24999999999999999999999999999999, 12500000000000000000000000000000⟩ +def CA1_3_12I2PairMassTermLog : Ball := ⟨(-1 / 25000000000000000000000000000000), (21175823869 / 50000000000000000000000000000000)⟩ +lemma CA1_3_12I2PairMassTermLog_sound : CA1_3_12I2PairMassTermLog.Encloses (Real.log ((∑ a, CA1_3_12I2PairValue a))) := by + exact checkLog_sound logTwoBall_sound (CA1_3_12I2PairMass_sound) (w := CA1_3_12I2PairMassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA1_3_12I2PairMassTerm : Ball := ⟨(1 / 25000000000000000000000000000000), (42351647739 / 100000000000000000000000000000000)⟩ +lemma CA1_3_12I2PairMassTerm_sound : CA1_3_12I2PairMassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_3_12I2PairValue a))) := by + exact contains_sound (entropyTerm_ball (CA1_3_12I2PairMass_sound) CA1_3_12I2PairMassTermLog_sound) (by decide +kernel) +def CA1_3_12I2PairH : Ball := ⟨(128345077681340811422050948684387 / 50000000000000000000000000000000), (77041110579 / 50000000000000000000000000000000)⟩ +lemma CA1_3_12I2PairH_sound : CA1_3_12I2PairH.Encloses (homogeneousEntropy CA1_3_12I2PairValue) := by + exact contains_sound (homogeneous_enclosed CA1_3_12I2PairValue CA1_3_12I2PairMassTerm_sound CA1_3_12I2PairEntropy_sound) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CA1_3_12I2R0Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 3 12)) (fun u => (stageALaw (shape 1 3 12) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 0 a +def CA1_3_12I2R0Raw (a : PairSlot) : Ball := residualBall (below (shape 1 3 12)) A1_3_12Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 0 a +lemma CA1_3_12I2R0Raw_sound (a : PairSlot) : + (CA1_3_12I2R0Raw a).Encloses (CA1_3_12I2R0Value a) := by + exact residualBall_sound_on (below (shape 1 3 12)) A1_3_12Law (fun u => (stageALaw (shape 1 3 12) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A1_3_12Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 3 12) (show (shape 1 3 12) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 0 a +def CA1_3_12I2R0Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA1_3_12I2R0Certificates_valid : + CA1_3_12I2R0Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_3_12I2R0CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA1_3_12I2R0P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_3_12I2R0Certificates (CA1_3_12I2R0CertificateIndex a)).input +lemma CA1_3_12I2R0P_check : ∀ a : PairSlot, contains (CA1_3_12I2R0Raw a) (CA1_3_12I2R0P a) = true := by + decide +kernel +lemma CA1_3_12I2R0P_sound (a : PairSlot) : + (CA1_3_12I2R0P a).Encloses (CA1_3_12I2R0Value a) := + contains_sound (CA1_3_12I2R0Raw_sound a) (CA1_3_12I2R0P_check a) +def CA1_3_12I2R0Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_3_12I2R0Certificates (CA1_3_12I2R0CertificateIndex a)).output +lemma CA1_3_12I2R0Terms_sound (a : PairSlot) : + (CA1_3_12I2R0Terms a).Encloses (Foundation.entropyTerm (CA1_3_12I2R0Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_3_12I2R0Certificates_valid + (CA1_3_12I2R0CertificateIndex a) (CA1_3_12I2R0P_sound a) +def CA1_3_12I2R0Entropy : Ball := ⟨0, 0⟩ +lemma CA1_3_12I2R0Entropy_sound : CA1_3_12I2R0Entropy.Encloses (Foundation.finiteEntropy CA1_3_12I2R0Value) := by + exact contains_sound (entropyPair_enclosed CA1_3_12I2R0Value CA1_3_12I2R0Terms CA1_3_12I2R0Terms_sound) (by decide +kernel) +def CA1_3_12I2R0Mass : Ball := ⟨0, 0⟩ +lemma CA1_3_12I2R0Mass_sound : CA1_3_12I2R0Mass.Encloses (∑ a, CA1_3_12I2R0Value a) := by + exact contains_sound (pairSumBall_sound CA1_3_12I2R0P CA1_3_12I2R0Value CA1_3_12I2R0P_sound) (by decide +kernel) +def CA1_3_12I2R0MassTerm : Ball := .exact 0 +lemma CA1_3_12I2R0MassTerm_sound : CA1_3_12I2R0MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_3_12I2R0Value a))) := + entropyTerm_zero_ball (CA1_3_12I2R0Mass_sound) +def CA1_3_12I2R0H : Ball := ⟨0, 0⟩ +lemma CA1_3_12I2R0H_sound : CA1_3_12I2R0H.Encloses (homogeneousEntropy CA1_3_12I2R0Value) := by + exact contains_sound (homogeneous_enclosed CA1_3_12I2R0Value CA1_3_12I2R0MassTerm_sound CA1_3_12I2R0Entropy_sound) (by decide +kernel) +def CA1_3_12I2R1Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 3 12)) (fun u => (stageALaw (shape 1 3 12) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 1 a +def CA1_3_12I2R1Raw (a : PairSlot) : Ball := residualBall (below (shape 1 3 12)) A1_3_12Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 1 a +lemma CA1_3_12I2R1Raw_sound (a : PairSlot) : + (CA1_3_12I2R1Raw a).Encloses (CA1_3_12I2R1Value a) := by + exact residualBall_sound_on (below (shape 1 3 12)) A1_3_12Law (fun u => (stageALaw (shape 1 3 12) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A1_3_12Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 3 12) (show (shape 1 3 12) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 1 a +def CA1_3_12I2R1Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA1_3_12I2R1Certificates_valid : + CA1_3_12I2R1Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_3_12I2R1CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA1_3_12I2R1P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_3_12I2R1Certificates (CA1_3_12I2R1CertificateIndex a)).input +lemma CA1_3_12I2R1P_check : ∀ a : PairSlot, contains (CA1_3_12I2R1Raw a) (CA1_3_12I2R1P a) = true := by + decide +kernel +lemma CA1_3_12I2R1P_sound (a : PairSlot) : + (CA1_3_12I2R1P a).Encloses (CA1_3_12I2R1Value a) := + contains_sound (CA1_3_12I2R1Raw_sound a) (CA1_3_12I2R1P_check a) +def CA1_3_12I2R1Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_3_12I2R1Certificates (CA1_3_12I2R1CertificateIndex a)).output +lemma CA1_3_12I2R1Terms_sound (a : PairSlot) : + (CA1_3_12I2R1Terms a).Encloses (Foundation.entropyTerm (CA1_3_12I2R1Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_3_12I2R1Certificates_valid + (CA1_3_12I2R1CertificateIndex a) (CA1_3_12I2R1P_sound a) +def CA1_3_12I2R1Entropy : Ball := ⟨0, 0⟩ +lemma CA1_3_12I2R1Entropy_sound : CA1_3_12I2R1Entropy.Encloses (Foundation.finiteEntropy CA1_3_12I2R1Value) := by + exact contains_sound (entropyPair_enclosed CA1_3_12I2R1Value CA1_3_12I2R1Terms CA1_3_12I2R1Terms_sound) (by decide +kernel) +def CA1_3_12I2R1Mass : Ball := ⟨0, 0⟩ +lemma CA1_3_12I2R1Mass_sound : CA1_3_12I2R1Mass.Encloses (∑ a, CA1_3_12I2R1Value a) := by + exact contains_sound (pairSumBall_sound CA1_3_12I2R1P CA1_3_12I2R1Value CA1_3_12I2R1P_sound) (by decide +kernel) +def CA1_3_12I2R1MassTerm : Ball := .exact 0 +lemma CA1_3_12I2R1MassTerm_sound : CA1_3_12I2R1MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_3_12I2R1Value a))) := + entropyTerm_zero_ball (CA1_3_12I2R1Mass_sound) +def CA1_3_12I2R1H : Ball := ⟨0, 0⟩ +lemma CA1_3_12I2R1H_sound : CA1_3_12I2R1H.Encloses (homogeneousEntropy CA1_3_12I2R1Value) := by + exact contains_sound (homogeneous_enclosed CA1_3_12I2R1Value CA1_3_12I2R1MassTerm_sound CA1_3_12I2R1Entropy_sound) (by decide +kernel) +def CA1_3_12I2R2Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 3 12)) (fun u => (stageALaw (shape 1 3 12) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 2 a +def CA1_3_12I2R2Raw (a : PairSlot) : Ball := residualBall (below (shape 1 3 12)) A1_3_12Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 2 a +lemma CA1_3_12I2R2Raw_sound (a : PairSlot) : + (CA1_3_12I2R2Raw a).Encloses (CA1_3_12I2R2Value a) := by + exact residualBall_sound_on (below (shape 1 3 12)) A1_3_12Law (fun u => (stageALaw (shape 1 3 12) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A1_3_12Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 3 12) (show (shape 1 3 12) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 2 a +def CA1_3_12I2R2Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA1_3_12I2R2Certificates_valid : + CA1_3_12I2R2Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_3_12I2R2CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA1_3_12I2R2P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_3_12I2R2Certificates (CA1_3_12I2R2CertificateIndex a)).input +lemma CA1_3_12I2R2P_check : ∀ a : PairSlot, contains (CA1_3_12I2R2Raw a) (CA1_3_12I2R2P a) = true := by + decide +kernel +lemma CA1_3_12I2R2P_sound (a : PairSlot) : + (CA1_3_12I2R2P a).Encloses (CA1_3_12I2R2Value a) := + contains_sound (CA1_3_12I2R2Raw_sound a) (CA1_3_12I2R2P_check a) +def CA1_3_12I2R2Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_3_12I2R2Certificates (CA1_3_12I2R2CertificateIndex a)).output +lemma CA1_3_12I2R2Terms_sound (a : PairSlot) : + (CA1_3_12I2R2Terms a).Encloses (Foundation.entropyTerm (CA1_3_12I2R2Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_3_12I2R2Certificates_valid + (CA1_3_12I2R2CertificateIndex a) (CA1_3_12I2R2P_sound a) +def CA1_3_12I2R2Entropy : Ball := ⟨0, 0⟩ +lemma CA1_3_12I2R2Entropy_sound : CA1_3_12I2R2Entropy.Encloses (Foundation.finiteEntropy CA1_3_12I2R2Value) := by + exact contains_sound (entropyPair_enclosed CA1_3_12I2R2Value CA1_3_12I2R2Terms CA1_3_12I2R2Terms_sound) (by decide +kernel) +def CA1_3_12I2R2Mass : Ball := ⟨0, 0⟩ +lemma CA1_3_12I2R2Mass_sound : CA1_3_12I2R2Mass.Encloses (∑ a, CA1_3_12I2R2Value a) := by + exact contains_sound (pairSumBall_sound CA1_3_12I2R2P CA1_3_12I2R2Value CA1_3_12I2R2P_sound) (by decide +kernel) +def CA1_3_12I2R2MassTerm : Ball := .exact 0 +lemma CA1_3_12I2R2MassTerm_sound : CA1_3_12I2R2MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_3_12I2R2Value a))) := + entropyTerm_zero_ball (CA1_3_12I2R2Mass_sound) +def CA1_3_12I2R2H : Ball := ⟨0, 0⟩ +lemma CA1_3_12I2R2H_sound : CA1_3_12I2R2H.Encloses (homogeneousEntropy CA1_3_12I2R2Value) := by + exact contains_sound (homogeneous_enclosed CA1_3_12I2R2Value CA1_3_12I2R2MassTerm_sound CA1_3_12I2R2Entropy_sound) (by decide +kernel) +def CA1_3_12I2R3Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 3 12)) (fun u => (stageALaw (shape 1 3 12) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 3 a +def CA1_3_12I2R3Raw (a : PairSlot) : Ball := residualBall (below (shape 1 3 12)) A1_3_12Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 3 a +lemma CA1_3_12I2R3Raw_sound (a : PairSlot) : + (CA1_3_12I2R3Raw a).Encloses (CA1_3_12I2R3Value a) := by + exact residualBall_sound_on (below (shape 1 3 12)) A1_3_12Law (fun u => (stageALaw (shape 1 3 12) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A1_3_12Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 3 12) (show (shape 1 3 12) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 3 a +def CA1_3_12I2R3Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA1_3_12I2R3Certificates_valid : + CA1_3_12I2R3Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_3_12I2R3CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA1_3_12I2R3P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_3_12I2R3Certificates (CA1_3_12I2R3CertificateIndex a)).input +lemma CA1_3_12I2R3P_check : ∀ a : PairSlot, contains (CA1_3_12I2R3Raw a) (CA1_3_12I2R3P a) = true := by + decide +kernel +lemma CA1_3_12I2R3P_sound (a : PairSlot) : + (CA1_3_12I2R3P a).Encloses (CA1_3_12I2R3Value a) := + contains_sound (CA1_3_12I2R3Raw_sound a) (CA1_3_12I2R3P_check a) +def CA1_3_12I2R3Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_3_12I2R3Certificates (CA1_3_12I2R3CertificateIndex a)).output +lemma CA1_3_12I2R3Terms_sound (a : PairSlot) : + (CA1_3_12I2R3Terms a).Encloses (Foundation.entropyTerm (CA1_3_12I2R3Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_3_12I2R3Certificates_valid + (CA1_3_12I2R3CertificateIndex a) (CA1_3_12I2R3P_sound a) +def CA1_3_12I2R3Entropy : Ball := ⟨0, 0⟩ +lemma CA1_3_12I2R3Entropy_sound : CA1_3_12I2R3Entropy.Encloses (Foundation.finiteEntropy CA1_3_12I2R3Value) := by + exact contains_sound (entropyPair_enclosed CA1_3_12I2R3Value CA1_3_12I2R3Terms CA1_3_12I2R3Terms_sound) (by decide +kernel) +def CA1_3_12I2R3Mass : Ball := ⟨0, 0⟩ +lemma CA1_3_12I2R3Mass_sound : CA1_3_12I2R3Mass.Encloses (∑ a, CA1_3_12I2R3Value a) := by + exact contains_sound (pairSumBall_sound CA1_3_12I2R3P CA1_3_12I2R3Value CA1_3_12I2R3P_sound) (by decide +kernel) +def CA1_3_12I2R3MassTerm : Ball := .exact 0 +lemma CA1_3_12I2R3MassTerm_sound : CA1_3_12I2R3MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_3_12I2R3Value a))) := + entropyTerm_zero_ball (CA1_3_12I2R3Mass_sound) +def CA1_3_12I2R3H : Ball := ⟨0, 0⟩ +lemma CA1_3_12I2R3H_sound : CA1_3_12I2R3H.Encloses (homogeneousEntropy CA1_3_12I2R3Value) := by + exact contains_sound (homogeneous_enclosed CA1_3_12I2R3Value CA1_3_12I2R3MassTerm_sound CA1_3_12I2R3Entropy_sound) (by decide +kernel) +def CA1_3_12I2R4Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 3 12)) (fun u => (stageALaw (shape 1 3 12) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 4 a +def CA1_3_12I2R4Raw (a : PairSlot) : Ball := residualBall (below (shape 1 3 12)) A1_3_12Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 4 a +lemma CA1_3_12I2R4Raw_sound (a : PairSlot) : + (CA1_3_12I2R4Raw a).Encloses (CA1_3_12I2R4Value a) := by + exact residualBall_sound_on (below (shape 1 3 12)) A1_3_12Law (fun u => (stageALaw (shape 1 3 12) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A1_3_12Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 3 12) (show (shape 1 3 12) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 4 a +def CA1_3_12I2R4Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(50082087363917606319814311 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(1383654904061334667470463697 / 100000000000000000000000000000000), (222719 / 50000000000000000000000000000000)⟩ ⟨(-345346753921994490879955066322143 / 25000000000000000000000000000000), (444693295703 / 100000000000000000000000000000000)⟩ ⟨-20, 50082087363917606319814311, 47683715820312500000000000⟩, + .log ⟨(19841937830486887774354987443 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(77700835228309911776401415997 / 25000000000000000000000000000000), (6827753 / 6250000000000000000000000000000)⟩ ⟨(-31327922057662556035001420397059 / 4000000000000000000000000000000), (137642855199 / 50000000000000000000000000000000)⟩ ⟨-12, 19841937830486887774354987443, 12207031250000000000000000000⟩, + .log ⟨(421711917054587868544682972531 / 100000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ ⟨(1153087536871705885099378254267 / 50000000000000000000000000000000), (25115899 / 3125000000000000000000000000000)⟩ ⟨(-546860304506142847761138852694761 / 100000000000000000000000000000000), (95291206929 / 50000000000000000000000000000000)⟩ ⟨-8, 421711917054587868544682972531, 390625000000000000000000000000⟩, + .log ⟨(21865753501080039753838898887 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(184284654016386747338159941657 / 100000000000000000000000000000000), (32411779 / 50000000000000000000000000000000)⟩ ⟨(-84280038191816334236063582536979 / 10000000000000000000000000000000), (59292307227 / 20000000000000000000000000000000)⟩ ⟨-13, 21865753501080039753838898887, 12207031250000000000000000000⟩, + .log ⟨(13025852419139529812865781 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(753803492690890127858215639 / 100000000000000000000000000000000), (242749 / 100000000000000000000000000000000)⟩ ⟨(-1446745035248690017606643015894427 / 100000000000000000000000000000000), (93174008057 / 20000000000000000000000000000000)⟩ ⟨-21, 13025852419139529812865781, 11920928955078125000000000⟩] +lemma CA1_3_12I2R4Certificates_valid : + CA1_3_12I2R4Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_3_12I2R4CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 5, 0 => 1 + | 4, 1 => 2 + | 2, 2 => 3 + | 2, 3 => 4 + | 3, 2 => 4 + | 3, 3 => 5 + | 1, 4 => 2 + | 0, 5 => 1 + | _, _ => 0 +def CA1_3_12I2R4P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_3_12I2R4Certificates (CA1_3_12I2R4CertificateIndex a)).input +lemma CA1_3_12I2R4P_check : ∀ a : PairSlot, contains (CA1_3_12I2R4Raw a) (CA1_3_12I2R4P a) = true := by + decide +kernel +lemma CA1_3_12I2R4P_sound (a : PairSlot) : + (CA1_3_12I2R4P a).Encloses (CA1_3_12I2R4Value a) := + contains_sound (CA1_3_12I2R4Raw_sound a) (CA1_3_12I2R4P_check a) +def CA1_3_12I2R4Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_3_12I2R4Certificates (CA1_3_12I2R4CertificateIndex a)).output +lemma CA1_3_12I2R4Terms_sound (a : PairSlot) : + (CA1_3_12I2R4Terms a).Encloses (Foundation.entropyTerm (CA1_3_12I2R4Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_3_12I2R4Certificates_valid + (CA1_3_12I2R4CertificateIndex a) (CA1_3_12I2R4P_sound a) +def CA1_3_12I2R4Entropy : Ball := ⟨(3299872176903478118549086862857 / 100000000000000000000000000000000), (230595521 / 20000000000000000000000000000000)⟩ +lemma CA1_3_12I2R4Entropy_sound : CA1_3_12I2R4Entropy.Encloses (Foundation.finiteEntropy CA1_3_12I2R4Value) := by + exact contains_sound (entropyPair_enclosed CA1_3_12I2R4Value CA1_3_12I2R4Terms CA1_3_12I2R4Terms_sound) (by decide +kernel) +def CA1_3_12I2R4Mass : Ball := ⟨(109012721427565545538862288089 / 20000000000000000000000000000000), (1 / 10000000000000000000000000000000)⟩ +lemma CA1_3_12I2R4Mass_sound : CA1_3_12I2R4Mass.Encloses (∑ a, CA1_3_12I2R4Value a) := by + exact contains_sound (pairSumBall_sound CA1_3_12I2R4P CA1_3_12I2R4Value CA1_3_12I2R4P_sound) (by decide +kernel) +def CA1_3_12I2R4MassTermLogWitness : LogWitness := ⟨-8, 109012721427565545538862288089, 78125000000000000000000000000⟩ +def CA1_3_12I2R4MassTermLog : Ball := ⟨(-130300574169311717901852204431171 / 25000000000000000000000000000000), (190582414981 / 100000000000000000000000000000000)⟩ +lemma CA1_3_12I2R4MassTermLog_sound : CA1_3_12I2R4MassTermLog.Encloses (Real.log ((∑ a, CA1_3_12I2R4Value a))) := by + exact checkLog_sound logTwoBall_sound (CA1_3_12I2R4Mass_sound) (w := CA1_3_12I2R4MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA1_3_12I2R4MassTerm : Ball := ⟨(1420442019377102114439407222067 / 50000000000000000000000000000000), (1038795439 / 100000000000000000000000000000000)⟩ +lemma CA1_3_12I2R4MassTerm_sound : CA1_3_12I2R4MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_3_12I2R4Value a))) := by + exact contains_sound (entropyTerm_ball (CA1_3_12I2R4Mass_sound) CA1_3_12I2R4MassTermLog_sound) (by decide +kernel) +def CA1_3_12I2R4H : Ball := ⟨(458988138149273889670272418723 / 100000000000000000000000000000000), (547943261 / 25000000000000000000000000000000)⟩ +lemma CA1_3_12I2R4H_sound : CA1_3_12I2R4H.Encloses (homogeneousEntropy CA1_3_12I2R4Value) := by + exact contains_sound (homogeneous_enclosed CA1_3_12I2R4Value CA1_3_12I2R4MassTerm_sound CA1_3_12I2R4Entropy_sound) (by decide +kernel) +def CA1_3_12I2R5Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 3 12)) (fun u => (stageALaw (shape 1 3 12) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 5 a +def CA1_3_12I2R5Raw (a : PairSlot) : Ball := residualBall (below (shape 1 3 12)) A1_3_12Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 5 a +lemma CA1_3_12I2R5Raw_sound (a : PairSlot) : + (CA1_3_12I2R5Raw a).Encloses (CA1_3_12I2R5Value a) := by + exact residualBall_sound_on (below (shape 1 3 12)) A1_3_12Law (fun u => (stageALaw (shape 1 3 12) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A1_3_12Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 3 12) (show (shape 1 3 12) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 5 a +def CA1_3_12I2R5Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(7993584464142905026220688119 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(75413763494681339490575140203 / 100000000000000000000000000000000), (25390621 / 100000000000000000000000000000000)⟩ ⟨(-471714309350000836969003265641811 / 50000000000000000000000000000000), (158818683877 / 50000000000000000000000000000000)⟩ ⟨-14, 7993584464142905026220688119, 6103515625000000000000000000⟩, + .log ⟨(663629216363104967231169239211 / 12500000000000000000000000000000), (9 / 50000000000000000000000000000000)⟩ ⟨(3896512666233792155067174842187 / 25000000000000000000000000000000), (1686347451 / 25000000000000000000000000000000)⟩ ⟨(-36697004235926129642552998593163 / 12500000000000000000000000000000), (127054942437 / 100000000000000000000000000000000)⟩ ⟨-5, 663629216363104967231169239211, 390625000000000000000000000000⟩, + .log ⟨(6122612934429716628887432669 / 3125000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ ⟨(244324607253148222856294098721 / 20000000000000000000000000000000), (207442203 / 50000000000000000000000000000000)⟩ ⟨(-38970003791833119778586138716087 / 6250000000000000000000000000000), (4235164757 / 2000000000000000000000000000000)⟩ ⟨-9, 6122612934429716628887432669, 6103515625000000000000000000⟩] +lemma CA1_3_12I2R5Certificates_valid : + CA1_3_12I2R5Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_3_12I2R5CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 5, 1 => 1 + | 4, 2 => 2 + | 4, 3 => 3 + | 2, 4 => 2 + | 3, 4 => 3 + | 1, 5 => 1 + | _, _ => 0 +def CA1_3_12I2R5P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_3_12I2R5Certificates (CA1_3_12I2R5CertificateIndex a)).input +lemma CA1_3_12I2R5P_check : ∀ a : PairSlot, contains (CA1_3_12I2R5Raw a) (CA1_3_12I2R5P a) = true := by + decide +kernel +lemma CA1_3_12I2R5P_sound (a : PairSlot) : + (CA1_3_12I2R5P a).Encloses (CA1_3_12I2R5Value a) := + contains_sound (CA1_3_12I2R5Raw_sound a) (CA1_3_12I2R5P_check a) +def CA1_3_12I2R5Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_3_12I2R5Certificates (CA1_3_12I2R5CertificateIndex a)).output +lemma CA1_3_12I2R5Terms_sound (a : PairSlot) : + (CA1_3_12I2R5Terms a).Encloses (Foundation.entropyTerm (CA1_3_12I2R5Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_3_12I2R5Certificates_valid + (CA1_3_12I2R5CertificateIndex a) (CA1_3_12I2R5P_sound a) +def CA1_3_12I2R5Entropy : Ball := ⟨(4220771866173897768510186250639 / 12500000000000000000000000000000), (7185664831 / 50000000000000000000000000000000)⟩ +lemma CA1_3_12I2R5Entropy_sound : CA1_3_12I2R5Entropy.Encloses (Foundation.finiteEntropy CA1_3_12I2R5Value) := by + exact contains_sound (entropyPair_enclosed CA1_3_12I2R5Value CA1_3_12I2R5Terms CA1_3_12I2R5Terms_sound) (by decide +kernel) +def CA1_3_12I2R5Mass : Ball := ⟨(1102590185854146714999994489443 / 10000000000000000000000000000000), (21 / 50000000000000000000000000000000)⟩ +lemma CA1_3_12I2R5Mass_sound : CA1_3_12I2R5Mass.Encloses (∑ a, CA1_3_12I2R5Value a) := by + exact contains_sound (pairSumBall_sound CA1_3_12I2R5P CA1_3_12I2R5Value CA1_3_12I2R5P_sound) (by decide +kernel) +def CA1_3_12I2R5MassTermLogWitness : LogWitness := ⟨-4, 1102590185854146714999994489443, 625000000000000000000000000000⟩ +def CA1_3_12I2R5MassTermLog : Ball := ⟨(-220492296677246871607408894108321 / 100000000000000000000000000000000), (26469779699 / 25000000000000000000000000000000)⟩ +lemma CA1_3_12I2R5MassTermLog_sound : CA1_3_12I2R5MassTermLog.Encloses (Real.log ((∑ a, CA1_3_12I2R5Value a))) := by + exact checkLog_sound logTwoBall_sound (CA1_3_12I2R5Mass_sound) (w := CA1_3_12I2R5MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA1_3_12I2R5MassTerm : Ball := ⟨(24311264237277328434595883551767 / 100000000000000000000000000000000), (11674127821 / 100000000000000000000000000000000)⟩ +lemma CA1_3_12I2R5MassTerm_sound : CA1_3_12I2R5MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_3_12I2R5Value a))) := by + exact contains_sound (entropyTerm_ball (CA1_3_12I2R5Mass_sound) CA1_3_12I2R5MassTermLog_sound) (by decide +kernel) +def CA1_3_12I2R5H : Ball := ⟨(1890982138422770742697121290669 / 20000000000000000000000000000000), (26045457483 / 100000000000000000000000000000000)⟩ +lemma CA1_3_12I2R5H_sound : CA1_3_12I2R5H.Encloses (homogeneousEntropy CA1_3_12I2R5Value) := by + exact contains_sound (homogeneous_enclosed CA1_3_12I2R5Value CA1_3_12I2R5MassTerm_sound CA1_3_12I2R5Entropy_sound) (by decide +kernel) +def CA1_3_12I2R6Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 3 12)) (fun u => (stageALaw (shape 1 3 12) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 6 a +def CA1_3_12I2R6Raw (a : PairSlot) : Ball := residualBall (below (shape 1 3 12)) A1_3_12Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 6 a +lemma CA1_3_12I2R6Raw_sound (a : PairSlot) : + (CA1_3_12I2R6Raw a).Encloses (CA1_3_12I2R6Value a) := by + exact residualBall_sound_on (below (shape 1 3 12)) A1_3_12Law (fun u => (stageALaw (shape 1 3 12) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A1_3_12Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 3 12) (show (shape 1 3 12) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 6 a +def CA1_3_12I2R6Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(67735000303981522447707694109 / 25000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ ⟨(400383487869694504550284853249 / 25000000000000000000000000000000), (71717223 / 12500000000000000000000000000000)⟩ ⟨(-2364411226531932936982137556031 / 400000000000000000000000000000), (211758237567 / 100000000000000000000000000000000)⟩ ⟨-9, 67735000303981522447707694109, 48828125000000000000000000000⟩, + .log ⟨(17070295505220172527691583 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(266012234051902568026482893 / 100000000000000000000000000000000), (21693 / 25000000000000000000000000000000)⟩ ⟨(-1558334089591799040572900800822269 / 100000000000000000000000000000000), (508225626521 / 100000000000000000000000000000000)⟩ ⟨-23, 17070295505220172527691583, 11920928955078125000000000⟩, + .log ⟨(28410315532777598125582754633957 / 100000000000000000000000000000000), (27 / 100000000000000000000000000000000)⟩ ⟨(1787602457521536374185190330329 / 5000000000000000000000000000000), (4512088759 / 25000000000000000000000000000000)⟩ ⟨(-62920894189265184004983717878739 / 50000000000000000000000000000000), (63527471143 / 100000000000000000000000000000000)⟩ ⟨-2, 28410315532777598125582754633957, 25000000000000000000000000000000⟩] +lemma CA1_3_12I2R6Certificates_valid : + CA1_3_12I2R6Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_3_12I2R6CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 5, 2 => 1 + | 5, 3 => 2 + | 4, 4 => 3 + | 2, 5 => 1 + | 3, 5 => 2 + | _, _ => 0 +def CA1_3_12I2R6P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_3_12I2R6Certificates (CA1_3_12I2R6CertificateIndex a)).input +lemma CA1_3_12I2R6P_check : ∀ a : PairSlot, contains (CA1_3_12I2R6Raw a) (CA1_3_12I2R6P a) = true := by + decide +kernel +lemma CA1_3_12I2R6P_sound (a : PairSlot) : + (CA1_3_12I2R6P a).Encloses (CA1_3_12I2R6Value a) := + contains_sound (CA1_3_12I2R6Raw_sound a) (CA1_3_12I2R6P_check a) +def CA1_3_12I2R6Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_3_12I2R6Certificates (CA1_3_12I2R6CertificateIndex a)).output +lemma CA1_3_12I2R6Terms_sound (a : PairSlot) : + (CA1_3_12I2R6Terms a).Encloses (Foundation.entropyTerm (CA1_3_12I2R6Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_3_12I2R6Certificates_valid + (CA1_3_12I2R6CertificateIndex a) (CA1_3_12I2R6P_sound a) +def CA1_3_12I2R6Entropy : Ball := ⟨(19477824538928193662621069199179 / 50000000000000000000000000000000), (4799001037 / 25000000000000000000000000000000)⟩ +lemma CA1_3_12I2R6Entropy_sound : CA1_3_12I2R6Entropy.Encloses (Foundation.finiteEntropy CA1_3_12I2R6Value) := by + exact contains_sound (entropyPair_enclosed CA1_3_12I2R6Value CA1_3_12I2R6Terms CA1_3_12I2R6Terms_sound) (by decide +kernel) +def CA1_3_12I2R6Mass : Ball := ⟨(5790445935160092149101894313999 / 20000000000000000000000000000000), (33 / 100000000000000000000000000000000)⟩ +lemma CA1_3_12I2R6Mass_sound : CA1_3_12I2R6Mass.Encloses (∑ a, CA1_3_12I2R6Value a) := by + exact contains_sound (pairSumBall_sound CA1_3_12I2R6P CA1_3_12I2R6Value CA1_3_12I2R6P_sound) (by decide +kernel) +def CA1_3_12I2R6MassTermLogWitness : LogWitness := ⟨-2, 5790445935160092149101894313999, 5000000000000000000000000000000⟩ +def CA1_3_12I2R6MassTermLog : Ball := ⟨(-123952296677246871607408932297361 / 100000000000000000000000000000000), (31763735581 / 50000000000000000000000000000000)⟩ +lemma CA1_3_12I2R6MassTermLog_sound : CA1_3_12I2R6MassTermLog.Encloses (Real.log ((∑ a, CA1_3_12I2R6Value a))) := by + exact checkLog_sound logTwoBall_sound (CA1_3_12I2R6Mass_sound) (w := CA1_3_12I2R6MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA1_3_12I2R6MassTerm : Ball := ⟨(35886953622426097212588200661081 / 100000000000000000000000000000000), (91963097 / 500000000000000000000000000000)⟩ +lemma CA1_3_12I2R6MassTerm_sound : CA1_3_12I2R6MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_3_12I2R6Value a))) := by + exact contains_sound (entropyTerm_ball (CA1_3_12I2R6Mass_sound) CA1_3_12I2R6MassTermLog_sound) (by decide +kernel) +def CA1_3_12I2R6H : Ball := ⟨(3068695455430290112653937737277 / 100000000000000000000000000000000), (9397155887 / 25000000000000000000000000000000)⟩ +lemma CA1_3_12I2R6H_sound : CA1_3_12I2R6H.Encloses (homogeneousEntropy CA1_3_12I2R6Value) := by + exact contains_sound (homogeneous_enclosed CA1_3_12I2R6Value CA1_3_12I2R6MassTerm_sound CA1_3_12I2R6Entropy_sound) (by decide +kernel) +def CA1_3_12I2R7Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 3 12)) (fun u => (stageALaw (shape 1 3 12) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 7 a +def CA1_3_12I2R7Raw (a : PairSlot) : Ball := residualBall (below (shape 1 3 12)) A1_3_12Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 7 a +lemma CA1_3_12I2R7Raw_sound (a : PairSlot) : + (CA1_3_12I2R7Raw a).Encloses (CA1_3_12I2R7Value a) := by + exact residualBall_sound_on (below (shape 1 3 12)) A1_3_12Law (fun u => (stageALaw (shape 1 3 12) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A1_3_12Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 3 12) (show (shape 1 3 12) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 7 a +def CA1_3_12I2R7Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA1_3_12I2R7Certificates_valid : + CA1_3_12I2R7Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_3_12I2R7CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA1_3_12I2R7P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_3_12I2R7Certificates (CA1_3_12I2R7CertificateIndex a)).input +lemma CA1_3_12I2R7P_check : ∀ a : PairSlot, contains (CA1_3_12I2R7Raw a) (CA1_3_12I2R7P a) = true := by + decide +kernel +lemma CA1_3_12I2R7P_sound (a : PairSlot) : + (CA1_3_12I2R7P a).Encloses (CA1_3_12I2R7Value a) := + contains_sound (CA1_3_12I2R7Raw_sound a) (CA1_3_12I2R7P_check a) +def CA1_3_12I2R7Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_3_12I2R7Certificates (CA1_3_12I2R7CertificateIndex a)).output +lemma CA1_3_12I2R7Terms_sound (a : PairSlot) : + (CA1_3_12I2R7Terms a).Encloses (Foundation.entropyTerm (CA1_3_12I2R7Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_3_12I2R7Certificates_valid + (CA1_3_12I2R7CertificateIndex a) (CA1_3_12I2R7P_sound a) +def CA1_3_12I2R7Entropy : Ball := ⟨0, 0⟩ +lemma CA1_3_12I2R7Entropy_sound : CA1_3_12I2R7Entropy.Encloses (Foundation.finiteEntropy CA1_3_12I2R7Value) := by + exact contains_sound (entropyPair_enclosed CA1_3_12I2R7Value CA1_3_12I2R7Terms CA1_3_12I2R7Terms_sound) (by decide +kernel) +def CA1_3_12I2R7Mass : Ball := ⟨0, 0⟩ +lemma CA1_3_12I2R7Mass_sound : CA1_3_12I2R7Mass.Encloses (∑ a, CA1_3_12I2R7Value a) := by + exact contains_sound (pairSumBall_sound CA1_3_12I2R7P CA1_3_12I2R7Value CA1_3_12I2R7P_sound) (by decide +kernel) +def CA1_3_12I2R7MassTerm : Ball := .exact 0 +lemma CA1_3_12I2R7MassTerm_sound : CA1_3_12I2R7MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_3_12I2R7Value a))) := + entropyTerm_zero_ball (CA1_3_12I2R7Mass_sound) +def CA1_3_12I2R7H : Ball := ⟨0, 0⟩ +lemma CA1_3_12I2R7H_sound : CA1_3_12I2R7H.Encloses (homogeneousEntropy CA1_3_12I2R7Value) := by + exact contains_sound (homogeneous_enclosed CA1_3_12I2R7Value CA1_3_12I2R7MassTerm_sound CA1_3_12I2R7Entropy_sound) (by decide +kernel) +def CA1_3_12I2R8Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 3 12)) (fun u => (stageALaw (shape 1 3 12) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 8 a +def CA1_3_12I2R8Raw (a : PairSlot) : Ball := residualBall (below (shape 1 3 12)) A1_3_12Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 8 a +lemma CA1_3_12I2R8Raw_sound (a : PairSlot) : + (CA1_3_12I2R8Raw a).Encloses (CA1_3_12I2R8Value a) := by + exact residualBall_sound_on (below (shape 1 3 12)) A1_3_12Law (fun u => (stageALaw (shape 1 3 12) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A1_3_12Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 3 12) (show (shape 1 3 12) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 8 a +def CA1_3_12I2R8Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA1_3_12I2R8Certificates_valid : + CA1_3_12I2R8Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_3_12I2R8CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA1_3_12I2R8P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_3_12I2R8Certificates (CA1_3_12I2R8CertificateIndex a)).input +lemma CA1_3_12I2R8P_check : ∀ a : PairSlot, contains (CA1_3_12I2R8Raw a) (CA1_3_12I2R8P a) = true := by + decide +kernel +lemma CA1_3_12I2R8P_sound (a : PairSlot) : + (CA1_3_12I2R8P a).Encloses (CA1_3_12I2R8Value a) := + contains_sound (CA1_3_12I2R8Raw_sound a) (CA1_3_12I2R8P_check a) +def CA1_3_12I2R8Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_3_12I2R8Certificates (CA1_3_12I2R8CertificateIndex a)).output +lemma CA1_3_12I2R8Terms_sound (a : PairSlot) : + (CA1_3_12I2R8Terms a).Encloses (Foundation.entropyTerm (CA1_3_12I2R8Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_3_12I2R8Certificates_valid + (CA1_3_12I2R8CertificateIndex a) (CA1_3_12I2R8P_sound a) +def CA1_3_12I2R8Entropy : Ball := ⟨0, 0⟩ +lemma CA1_3_12I2R8Entropy_sound : CA1_3_12I2R8Entropy.Encloses (Foundation.finiteEntropy CA1_3_12I2R8Value) := by + exact contains_sound (entropyPair_enclosed CA1_3_12I2R8Value CA1_3_12I2R8Terms CA1_3_12I2R8Terms_sound) (by decide +kernel) +def CA1_3_12I2R8Mass : Ball := ⟨0, 0⟩ +lemma CA1_3_12I2R8Mass_sound : CA1_3_12I2R8Mass.Encloses (∑ a, CA1_3_12I2R8Value a) := by + exact contains_sound (pairSumBall_sound CA1_3_12I2R8P CA1_3_12I2R8Value CA1_3_12I2R8P_sound) (by decide +kernel) +def CA1_3_12I2R8MassTerm : Ball := .exact 0 +lemma CA1_3_12I2R8MassTerm_sound : CA1_3_12I2R8MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_3_12I2R8Value a))) := + entropyTerm_zero_ball (CA1_3_12I2R8Mass_sound) +def CA1_3_12I2R8H : Ball := ⟨0, 0⟩ +lemma CA1_3_12I2R8H_sound : CA1_3_12I2R8H.Encloses (homogeneousEntropy CA1_3_12I2R8Value) := by + exact contains_sound (homogeneous_enclosed CA1_3_12I2R8Value CA1_3_12I2R8MassTerm_sound CA1_3_12I2R8Entropy_sound) (by decide +kernel) +def CA1_3_12I2R9Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 3 12)) (fun u => (stageALaw (shape 1 3 12) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 9 a +def CA1_3_12I2R9Raw (a : PairSlot) : Ball := residualBall (below (shape 1 3 12)) A1_3_12Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 9 a +lemma CA1_3_12I2R9Raw_sound (a : PairSlot) : + (CA1_3_12I2R9Raw a).Encloses (CA1_3_12I2R9Value a) := by + exact residualBall_sound_on (below (shape 1 3 12)) A1_3_12Law (fun u => (stageALaw (shape 1 3 12) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A1_3_12Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 3 12) (show (shape 1 3 12) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 9 a +def CA1_3_12I2R9Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA1_3_12I2R9Certificates_valid : + CA1_3_12I2R9Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_3_12I2R9CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA1_3_12I2R9P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_3_12I2R9Certificates (CA1_3_12I2R9CertificateIndex a)).input +lemma CA1_3_12I2R9P_check : ∀ a : PairSlot, contains (CA1_3_12I2R9Raw a) (CA1_3_12I2R9P a) = true := by + decide +kernel +lemma CA1_3_12I2R9P_sound (a : PairSlot) : + (CA1_3_12I2R9P a).Encloses (CA1_3_12I2R9Value a) := + contains_sound (CA1_3_12I2R9Raw_sound a) (CA1_3_12I2R9P_check a) +def CA1_3_12I2R9Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_3_12I2R9Certificates (CA1_3_12I2R9CertificateIndex a)).output +lemma CA1_3_12I2R9Terms_sound (a : PairSlot) : + (CA1_3_12I2R9Terms a).Encloses (Foundation.entropyTerm (CA1_3_12I2R9Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_3_12I2R9Certificates_valid + (CA1_3_12I2R9CertificateIndex a) (CA1_3_12I2R9P_sound a) +def CA1_3_12I2R9Entropy : Ball := ⟨0, 0⟩ +lemma CA1_3_12I2R9Entropy_sound : CA1_3_12I2R9Entropy.Encloses (Foundation.finiteEntropy CA1_3_12I2R9Value) := by + exact contains_sound (entropyPair_enclosed CA1_3_12I2R9Value CA1_3_12I2R9Terms CA1_3_12I2R9Terms_sound) (by decide +kernel) +def CA1_3_12I2R9Mass : Ball := ⟨0, 0⟩ +lemma CA1_3_12I2R9Mass_sound : CA1_3_12I2R9Mass.Encloses (∑ a, CA1_3_12I2R9Value a) := by + exact contains_sound (pairSumBall_sound CA1_3_12I2R9P CA1_3_12I2R9Value CA1_3_12I2R9P_sound) (by decide +kernel) +def CA1_3_12I2R9MassTerm : Ball := .exact 0 +lemma CA1_3_12I2R9MassTerm_sound : CA1_3_12I2R9MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_3_12I2R9Value a))) := + entropyTerm_zero_ball (CA1_3_12I2R9Mass_sound) +def CA1_3_12I2R9H : Ball := ⟨0, 0⟩ +lemma CA1_3_12I2R9H_sound : CA1_3_12I2R9H.Encloses (homogeneousEntropy CA1_3_12I2R9Value) := by + exact contains_sound (homogeneous_enclosed CA1_3_12I2R9Value CA1_3_12I2R9MassTerm_sound CA1_3_12I2R9Entropy_sound) (by decide +kernel) +def CA1_3_12I2R10Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 3 12)) (fun u => (stageALaw (shape 1 3 12) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 10 a +def CA1_3_12I2R10Raw (a : PairSlot) : Ball := residualBall (below (shape 1 3 12)) A1_3_12Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 10 a +lemma CA1_3_12I2R10Raw_sound (a : PairSlot) : + (CA1_3_12I2R10Raw a).Encloses (CA1_3_12I2R10Value a) := by + exact residualBall_sound_on (below (shape 1 3 12)) A1_3_12Law (fun u => (stageALaw (shape 1 3 12) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A1_3_12Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 3 12) (show (shape 1 3 12) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 10 a +def CA1_3_12I2R10Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA1_3_12I2R10Certificates_valid : + CA1_3_12I2R10Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_3_12I2R10CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA1_3_12I2R10P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_3_12I2R10Certificates (CA1_3_12I2R10CertificateIndex a)).input +lemma CA1_3_12I2R10P_check : ∀ a : PairSlot, contains (CA1_3_12I2R10Raw a) (CA1_3_12I2R10P a) = true := by + decide +kernel +lemma CA1_3_12I2R10P_sound (a : PairSlot) : + (CA1_3_12I2R10P a).Encloses (CA1_3_12I2R10Value a) := + contains_sound (CA1_3_12I2R10Raw_sound a) (CA1_3_12I2R10P_check a) +def CA1_3_12I2R10Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_3_12I2R10Certificates (CA1_3_12I2R10CertificateIndex a)).output +lemma CA1_3_12I2R10Terms_sound (a : PairSlot) : + (CA1_3_12I2R10Terms a).Encloses (Foundation.entropyTerm (CA1_3_12I2R10Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_3_12I2R10Certificates_valid + (CA1_3_12I2R10CertificateIndex a) (CA1_3_12I2R10P_sound a) +def CA1_3_12I2R10Entropy : Ball := ⟨0, 0⟩ +lemma CA1_3_12I2R10Entropy_sound : CA1_3_12I2R10Entropy.Encloses (Foundation.finiteEntropy CA1_3_12I2R10Value) := by + exact contains_sound (entropyPair_enclosed CA1_3_12I2R10Value CA1_3_12I2R10Terms CA1_3_12I2R10Terms_sound) (by decide +kernel) +def CA1_3_12I2R10Mass : Ball := ⟨0, 0⟩ +lemma CA1_3_12I2R10Mass_sound : CA1_3_12I2R10Mass.Encloses (∑ a, CA1_3_12I2R10Value a) := by + exact contains_sound (pairSumBall_sound CA1_3_12I2R10P CA1_3_12I2R10Value CA1_3_12I2R10P_sound) (by decide +kernel) +def CA1_3_12I2R10MassTerm : Ball := .exact 0 +lemma CA1_3_12I2R10MassTerm_sound : CA1_3_12I2R10MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_3_12I2R10Value a))) := + entropyTerm_zero_ball (CA1_3_12I2R10Mass_sound) +def CA1_3_12I2R10H : Ball := ⟨0, 0⟩ +lemma CA1_3_12I2R10H_sound : CA1_3_12I2R10H.Encloses (homogeneousEntropy CA1_3_12I2R10Value) := by + exact contains_sound (homogeneous_enclosed CA1_3_12I2R10Value CA1_3_12I2R10MassTerm_sound CA1_3_12I2R10Entropy_sound) (by decide +kernel) +def CA1_3_12I2R11Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 3 12)) (fun u => (stageALaw (shape 1 3 12) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 11 a +def CA1_3_12I2R11Raw (a : PairSlot) : Ball := residualBall (below (shape 1 3 12)) A1_3_12Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 11 a +lemma CA1_3_12I2R11Raw_sound (a : PairSlot) : + (CA1_3_12I2R11Raw a).Encloses (CA1_3_12I2R11Value a) := by + exact residualBall_sound_on (below (shape 1 3 12)) A1_3_12Law (fun u => (stageALaw (shape 1 3 12) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A1_3_12Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 3 12) (show (shape 1 3 12) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 11 a +def CA1_3_12I2R11Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA1_3_12I2R11Certificates_valid : + CA1_3_12I2R11Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_3_12I2R11CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA1_3_12I2R11P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_3_12I2R11Certificates (CA1_3_12I2R11CertificateIndex a)).input +lemma CA1_3_12I2R11P_check : ∀ a : PairSlot, contains (CA1_3_12I2R11Raw a) (CA1_3_12I2R11P a) = true := by + decide +kernel +lemma CA1_3_12I2R11P_sound (a : PairSlot) : + (CA1_3_12I2R11P a).Encloses (CA1_3_12I2R11Value a) := + contains_sound (CA1_3_12I2R11Raw_sound a) (CA1_3_12I2R11P_check a) +def CA1_3_12I2R11Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_3_12I2R11Certificates (CA1_3_12I2R11CertificateIndex a)).output +lemma CA1_3_12I2R11Terms_sound (a : PairSlot) : + (CA1_3_12I2R11Terms a).Encloses (Foundation.entropyTerm (CA1_3_12I2R11Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_3_12I2R11Certificates_valid + (CA1_3_12I2R11CertificateIndex a) (CA1_3_12I2R11P_sound a) +def CA1_3_12I2R11Entropy : Ball := ⟨0, 0⟩ +lemma CA1_3_12I2R11Entropy_sound : CA1_3_12I2R11Entropy.Encloses (Foundation.finiteEntropy CA1_3_12I2R11Value) := by + exact contains_sound (entropyPair_enclosed CA1_3_12I2R11Value CA1_3_12I2R11Terms CA1_3_12I2R11Terms_sound) (by decide +kernel) +def CA1_3_12I2R11Mass : Ball := ⟨0, 0⟩ +lemma CA1_3_12I2R11Mass_sound : CA1_3_12I2R11Mass.Encloses (∑ a, CA1_3_12I2R11Value a) := by + exact contains_sound (pairSumBall_sound CA1_3_12I2R11P CA1_3_12I2R11Value CA1_3_12I2R11P_sound) (by decide +kernel) +def CA1_3_12I2R11MassTerm : Ball := .exact 0 +lemma CA1_3_12I2R11MassTerm_sound : CA1_3_12I2R11MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_3_12I2R11Value a))) := + entropyTerm_zero_ball (CA1_3_12I2R11Mass_sound) +def CA1_3_12I2R11H : Ball := ⟨0, 0⟩ +lemma CA1_3_12I2R11H_sound : CA1_3_12I2R11H.Encloses (homogeneousEntropy CA1_3_12I2R11Value) := by + exact contains_sound (homogeneous_enclosed CA1_3_12I2R11Value CA1_3_12I2R11MassTerm_sound CA1_3_12I2R11Entropy_sound) (by decide +kernel) +def CA1_3_12I2R12Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 3 12)) (fun u => (stageALaw (shape 1 3 12) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 12 a +def CA1_3_12I2R12Raw (a : PairSlot) : Ball := residualBall (below (shape 1 3 12)) A1_3_12Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 12 a +lemma CA1_3_12I2R12Raw_sound (a : PairSlot) : + (CA1_3_12I2R12Raw a).Encloses (CA1_3_12I2R12Value a) := by + exact residualBall_sound_on (below (shape 1 3 12)) A1_3_12Law (fun u => (stageALaw (shape 1 3 12) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A1_3_12Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 3 12) (show (shape 1 3 12) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 12 a +def CA1_3_12I2R12Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA1_3_12I2R12Certificates_valid : + CA1_3_12I2R12Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_3_12I2R12CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA1_3_12I2R12P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_3_12I2R12Certificates (CA1_3_12I2R12CertificateIndex a)).input +lemma CA1_3_12I2R12P_check : ∀ a : PairSlot, contains (CA1_3_12I2R12Raw a) (CA1_3_12I2R12P a) = true := by + decide +kernel +lemma CA1_3_12I2R12P_sound (a : PairSlot) : + (CA1_3_12I2R12P a).Encloses (CA1_3_12I2R12Value a) := + contains_sound (CA1_3_12I2R12Raw_sound a) (CA1_3_12I2R12P_check a) +def CA1_3_12I2R12Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_3_12I2R12Certificates (CA1_3_12I2R12CertificateIndex a)).output +lemma CA1_3_12I2R12Terms_sound (a : PairSlot) : + (CA1_3_12I2R12Terms a).Encloses (Foundation.entropyTerm (CA1_3_12I2R12Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_3_12I2R12Certificates_valid + (CA1_3_12I2R12CertificateIndex a) (CA1_3_12I2R12P_sound a) +def CA1_3_12I2R12Entropy : Ball := ⟨0, 0⟩ +lemma CA1_3_12I2R12Entropy_sound : CA1_3_12I2R12Entropy.Encloses (Foundation.finiteEntropy CA1_3_12I2R12Value) := by + exact contains_sound (entropyPair_enclosed CA1_3_12I2R12Value CA1_3_12I2R12Terms CA1_3_12I2R12Terms_sound) (by decide +kernel) +def CA1_3_12I2R12Mass : Ball := ⟨0, 0⟩ +lemma CA1_3_12I2R12Mass_sound : CA1_3_12I2R12Mass.Encloses (∑ a, CA1_3_12I2R12Value a) := by + exact contains_sound (pairSumBall_sound CA1_3_12I2R12P CA1_3_12I2R12Value CA1_3_12I2R12P_sound) (by decide +kernel) +def CA1_3_12I2R12MassTerm : Ball := .exact 0 +lemma CA1_3_12I2R12MassTerm_sound : CA1_3_12I2R12MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_3_12I2R12Value a))) := + entropyTerm_zero_ball (CA1_3_12I2R12Mass_sound) +def CA1_3_12I2R12H : Ball := ⟨0, 0⟩ +lemma CA1_3_12I2R12H_sound : CA1_3_12I2R12H.Encloses (homogeneousEntropy CA1_3_12I2R12Value) := by + exact contains_sound (homogeneous_enclosed CA1_3_12I2R12Value CA1_3_12I2R12MassTerm_sound CA1_3_12I2R12Entropy_sound) (by decide +kernel) +def CA1_3_12I2R13Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 3 12)) (fun u => (stageALaw (shape 1 3 12) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 13 a +def CA1_3_12I2R13Raw (a : PairSlot) : Ball := residualBall (below (shape 1 3 12)) A1_3_12Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 13 a +lemma CA1_3_12I2R13Raw_sound (a : PairSlot) : + (CA1_3_12I2R13Raw a).Encloses (CA1_3_12I2R13Value a) := by + exact residualBall_sound_on (below (shape 1 3 12)) A1_3_12Law (fun u => (stageALaw (shape 1 3 12) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A1_3_12Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 3 12) (show (shape 1 3 12) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 13 a +def CA1_3_12I2R13Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA1_3_12I2R13Certificates_valid : + CA1_3_12I2R13Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_3_12I2R13CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA1_3_12I2R13P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_3_12I2R13Certificates (CA1_3_12I2R13CertificateIndex a)).input +lemma CA1_3_12I2R13P_check : ∀ a : PairSlot, contains (CA1_3_12I2R13Raw a) (CA1_3_12I2R13P a) = true := by + decide +kernel +lemma CA1_3_12I2R13P_sound (a : PairSlot) : + (CA1_3_12I2R13P a).Encloses (CA1_3_12I2R13Value a) := + contains_sound (CA1_3_12I2R13Raw_sound a) (CA1_3_12I2R13P_check a) +def CA1_3_12I2R13Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_3_12I2R13Certificates (CA1_3_12I2R13CertificateIndex a)).output +lemma CA1_3_12I2R13Terms_sound (a : PairSlot) : + (CA1_3_12I2R13Terms a).Encloses (Foundation.entropyTerm (CA1_3_12I2R13Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_3_12I2R13Certificates_valid + (CA1_3_12I2R13CertificateIndex a) (CA1_3_12I2R13P_sound a) +def CA1_3_12I2R13Entropy : Ball := ⟨0, 0⟩ +lemma CA1_3_12I2R13Entropy_sound : CA1_3_12I2R13Entropy.Encloses (Foundation.finiteEntropy CA1_3_12I2R13Value) := by + exact contains_sound (entropyPair_enclosed CA1_3_12I2R13Value CA1_3_12I2R13Terms CA1_3_12I2R13Terms_sound) (by decide +kernel) +def CA1_3_12I2R13Mass : Ball := ⟨0, 0⟩ +lemma CA1_3_12I2R13Mass_sound : CA1_3_12I2R13Mass.Encloses (∑ a, CA1_3_12I2R13Value a) := by + exact contains_sound (pairSumBall_sound CA1_3_12I2R13P CA1_3_12I2R13Value CA1_3_12I2R13P_sound) (by decide +kernel) +def CA1_3_12I2R13MassTerm : Ball := .exact 0 +lemma CA1_3_12I2R13MassTerm_sound : CA1_3_12I2R13MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_3_12I2R13Value a))) := + entropyTerm_zero_ball (CA1_3_12I2R13Mass_sound) +def CA1_3_12I2R13H : Ball := ⟨0, 0⟩ +lemma CA1_3_12I2R13H_sound : CA1_3_12I2R13H.Encloses (homogeneousEntropy CA1_3_12I2R13Value) := by + exact contains_sound (homogeneous_enclosed CA1_3_12I2R13Value CA1_3_12I2R13MassTerm_sound CA1_3_12I2R13Entropy_sound) (by decide +kernel) +def CA1_3_12I2R14Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 3 12)) (fun u => (stageALaw (shape 1 3 12) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 14 a +def CA1_3_12I2R14Raw (a : PairSlot) : Ball := residualBall (below (shape 1 3 12)) A1_3_12Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 14 a +lemma CA1_3_12I2R14Raw_sound (a : PairSlot) : + (CA1_3_12I2R14Raw a).Encloses (CA1_3_12I2R14Value a) := by + exact residualBall_sound_on (below (shape 1 3 12)) A1_3_12Law (fun u => (stageALaw (shape 1 3 12) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A1_3_12Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 3 12) (show (shape 1 3 12) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 14 a +def CA1_3_12I2R14Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA1_3_12I2R14Certificates_valid : + CA1_3_12I2R14Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_3_12I2R14CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA1_3_12I2R14P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_3_12I2R14Certificates (CA1_3_12I2R14CertificateIndex a)).input +lemma CA1_3_12I2R14P_check : ∀ a : PairSlot, contains (CA1_3_12I2R14Raw a) (CA1_3_12I2R14P a) = true := by + decide +kernel +lemma CA1_3_12I2R14P_sound (a : PairSlot) : + (CA1_3_12I2R14P a).Encloses (CA1_3_12I2R14Value a) := + contains_sound (CA1_3_12I2R14Raw_sound a) (CA1_3_12I2R14P_check a) +def CA1_3_12I2R14Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_3_12I2R14Certificates (CA1_3_12I2R14CertificateIndex a)).output +lemma CA1_3_12I2R14Terms_sound (a : PairSlot) : + (CA1_3_12I2R14Terms a).Encloses (Foundation.entropyTerm (CA1_3_12I2R14Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_3_12I2R14Certificates_valid + (CA1_3_12I2R14CertificateIndex a) (CA1_3_12I2R14P_sound a) +def CA1_3_12I2R14Entropy : Ball := ⟨0, 0⟩ +lemma CA1_3_12I2R14Entropy_sound : CA1_3_12I2R14Entropy.Encloses (Foundation.finiteEntropy CA1_3_12I2R14Value) := by + exact contains_sound (entropyPair_enclosed CA1_3_12I2R14Value CA1_3_12I2R14Terms CA1_3_12I2R14Terms_sound) (by decide +kernel) +def CA1_3_12I2R14Mass : Ball := ⟨0, 0⟩ +lemma CA1_3_12I2R14Mass_sound : CA1_3_12I2R14Mass.Encloses (∑ a, CA1_3_12I2R14Value a) := by + exact contains_sound (pairSumBall_sound CA1_3_12I2R14P CA1_3_12I2R14Value CA1_3_12I2R14P_sound) (by decide +kernel) +def CA1_3_12I2R14MassTerm : Ball := .exact 0 +lemma CA1_3_12I2R14MassTerm_sound : CA1_3_12I2R14MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_3_12I2R14Value a))) := + entropyTerm_zero_ball (CA1_3_12I2R14Mass_sound) +def CA1_3_12I2R14H : Ball := ⟨0, 0⟩ +lemma CA1_3_12I2R14H_sound : CA1_3_12I2R14H.Encloses (homogeneousEntropy CA1_3_12I2R14Value) := by + exact contains_sound (homogeneous_enclosed CA1_3_12I2R14Value CA1_3_12I2R14MassTerm_sound CA1_3_12I2R14Entropy_sound) (by decide +kernel) +def CA1_3_12I2R15Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 3 12)) (fun u => (stageALaw (shape 1 3 12) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 15 a +def CA1_3_12I2R15Raw (a : PairSlot) : Ball := residualBall (below (shape 1 3 12)) A1_3_12Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 15 a +lemma CA1_3_12I2R15Raw_sound (a : PairSlot) : + (CA1_3_12I2R15Raw a).Encloses (CA1_3_12I2R15Value a) := by + exact residualBall_sound_on (below (shape 1 3 12)) A1_3_12Law (fun u => (stageALaw (shape 1 3 12) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A1_3_12Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 3 12) (show (shape 1 3 12) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 15 a +def CA1_3_12I2R15Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA1_3_12I2R15Certificates_valid : + CA1_3_12I2R15Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_3_12I2R15CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA1_3_12I2R15P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_3_12I2R15Certificates (CA1_3_12I2R15CertificateIndex a)).input +lemma CA1_3_12I2R15P_check : ∀ a : PairSlot, contains (CA1_3_12I2R15Raw a) (CA1_3_12I2R15P a) = true := by + decide +kernel +lemma CA1_3_12I2R15P_sound (a : PairSlot) : + (CA1_3_12I2R15P a).Encloses (CA1_3_12I2R15Value a) := + contains_sound (CA1_3_12I2R15Raw_sound a) (CA1_3_12I2R15P_check a) +def CA1_3_12I2R15Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_3_12I2R15Certificates (CA1_3_12I2R15CertificateIndex a)).output +lemma CA1_3_12I2R15Terms_sound (a : PairSlot) : + (CA1_3_12I2R15Terms a).Encloses (Foundation.entropyTerm (CA1_3_12I2R15Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_3_12I2R15Certificates_valid + (CA1_3_12I2R15CertificateIndex a) (CA1_3_12I2R15P_sound a) +def CA1_3_12I2R15Entropy : Ball := ⟨0, 0⟩ +lemma CA1_3_12I2R15Entropy_sound : CA1_3_12I2R15Entropy.Encloses (Foundation.finiteEntropy CA1_3_12I2R15Value) := by + exact contains_sound (entropyPair_enclosed CA1_3_12I2R15Value CA1_3_12I2R15Terms CA1_3_12I2R15Terms_sound) (by decide +kernel) +def CA1_3_12I2R15Mass : Ball := ⟨0, 0⟩ +lemma CA1_3_12I2R15Mass_sound : CA1_3_12I2R15Mass.Encloses (∑ a, CA1_3_12I2R15Value a) := by + exact contains_sound (pairSumBall_sound CA1_3_12I2R15P CA1_3_12I2R15Value CA1_3_12I2R15P_sound) (by decide +kernel) +def CA1_3_12I2R15MassTerm : Ball := .exact 0 +lemma CA1_3_12I2R15MassTerm_sound : CA1_3_12I2R15MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_3_12I2R15Value a))) := + entropyTerm_zero_ball (CA1_3_12I2R15Mass_sound) +def CA1_3_12I2R15H : Ball := ⟨0, 0⟩ +lemma CA1_3_12I2R15H_sound : CA1_3_12I2R15H.Encloses (homogeneousEntropy CA1_3_12I2R15Value) := by + exact contains_sound (homogeneous_enclosed CA1_3_12I2R15Value CA1_3_12I2R15MassTerm_sound CA1_3_12I2R15Entropy_sound) (by decide +kernel) +def CA1_3_12I2R16Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 3 12)) (fun u => (stageALaw (shape 1 3 12) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 16 a +def CA1_3_12I2R16Raw (a : PairSlot) : Ball := residualBall (below (shape 1 3 12)) A1_3_12Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 16 a +lemma CA1_3_12I2R16Raw_sound (a : PairSlot) : + (CA1_3_12I2R16Raw a).Encloses (CA1_3_12I2R16Value a) := by + exact residualBall_sound_on (below (shape 1 3 12)) A1_3_12Law (fun u => (stageALaw (shape 1 3 12) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A1_3_12Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 3 12) (show (shape 1 3 12) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 16 a +def CA1_3_12I2R16Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA1_3_12I2R16Certificates_valid : + CA1_3_12I2R16Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_3_12I2R16CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA1_3_12I2R16P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_3_12I2R16Certificates (CA1_3_12I2R16CertificateIndex a)).input +lemma CA1_3_12I2R16P_check : ∀ a : PairSlot, contains (CA1_3_12I2R16Raw a) (CA1_3_12I2R16P a) = true := by + decide +kernel +lemma CA1_3_12I2R16P_sound (a : PairSlot) : + (CA1_3_12I2R16P a).Encloses (CA1_3_12I2R16Value a) := + contains_sound (CA1_3_12I2R16Raw_sound a) (CA1_3_12I2R16P_check a) +def CA1_3_12I2R16Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_3_12I2R16Certificates (CA1_3_12I2R16CertificateIndex a)).output +lemma CA1_3_12I2R16Terms_sound (a : PairSlot) : + (CA1_3_12I2R16Terms a).Encloses (Foundation.entropyTerm (CA1_3_12I2R16Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_3_12I2R16Certificates_valid + (CA1_3_12I2R16CertificateIndex a) (CA1_3_12I2R16P_sound a) +def CA1_3_12I2R16Entropy : Ball := ⟨0, 0⟩ +lemma CA1_3_12I2R16Entropy_sound : CA1_3_12I2R16Entropy.Encloses (Foundation.finiteEntropy CA1_3_12I2R16Value) := by + exact contains_sound (entropyPair_enclosed CA1_3_12I2R16Value CA1_3_12I2R16Terms CA1_3_12I2R16Terms_sound) (by decide +kernel) +def CA1_3_12I2R16Mass : Ball := ⟨0, 0⟩ +lemma CA1_3_12I2R16Mass_sound : CA1_3_12I2R16Mass.Encloses (∑ a, CA1_3_12I2R16Value a) := by + exact contains_sound (pairSumBall_sound CA1_3_12I2R16P CA1_3_12I2R16Value CA1_3_12I2R16P_sound) (by decide +kernel) +def CA1_3_12I2R16MassTerm : Ball := .exact 0 +lemma CA1_3_12I2R16MassTerm_sound : CA1_3_12I2R16MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_3_12I2R16Value a))) := + entropyTerm_zero_ball (CA1_3_12I2R16Mass_sound) +def CA1_3_12I2R16H : Ball := ⟨0, 0⟩ +lemma CA1_3_12I2R16H_sound : CA1_3_12I2R16H.Encloses (homogeneousEntropy CA1_3_12I2R16Value) := by + exact contains_sound (homogeneous_enclosed CA1_3_12I2R16Value CA1_3_12I2R16MassTerm_sound CA1_3_12I2R16Entropy_sound) (by decide +kernel) +def CA1_3_12I2ResidualEntropies (a : Fin 17) : Ball := + match a.val with + | 0 => CA1_3_12I2R0H + | 1 => CA1_3_12I2R1H + | 2 => CA1_3_12I2R2H + | 3 => CA1_3_12I2R3H + | 4 => CA1_3_12I2R4H + | 5 => CA1_3_12I2R5H + | 6 => CA1_3_12I2R6H + | 7 => CA1_3_12I2R7H + | 8 => CA1_3_12I2R8H + | 9 => CA1_3_12I2R9H + | 10 => CA1_3_12I2R10H + | 11 => CA1_3_12I2R11H + | 12 => CA1_3_12I2R12H + | 13 => CA1_3_12I2R13H + | 14 => CA1_3_12I2R14H + | 15 => CA1_3_12I2R15H + | 16 => CA1_3_12I2R16H + | _ => (.exact 0) +lemma CA1_3_12I2ResidualEntropies_sound (k : Fin 17) : + (CA1_3_12I2ResidualEntropies k).Encloses (homogeneousEntropy + (residualLaw (below (shape 1 3 12)) (fun u => (stageALaw (shape 1 3 12) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) k)) := by + fin_cases k + · exact CA1_3_12I2R0H_sound + · exact CA1_3_12I2R1H_sound + · exact CA1_3_12I2R2H_sound + · exact CA1_3_12I2R3H_sound + · exact CA1_3_12I2R4H_sound + · exact CA1_3_12I2R5H_sound + · exact CA1_3_12I2R6H_sound + · exact CA1_3_12I2R7H_sound + · exact CA1_3_12I2R8H_sound + · exact CA1_3_12I2R9H_sound + · exact CA1_3_12I2R10H_sound + · exact CA1_3_12I2R11H_sound + · exact CA1_3_12I2R12H_sound + · exact CA1_3_12I2R13H_sound + · exact CA1_3_12I2R14H_sound + · exact CA1_3_12I2R15H_sound + · exact CA1_3_12I2R16H_sound +def CA1_3_12I2Singles (s : Shape) : Ball := + match s 0, s 1, s 2 with + | 0, 0, 8 => Z0_0_8H2H + | 0, 1, 7 => Z0_1_7H2H + | 0, 2, 6 => Z0_2_6H2H + | 0, 3, 5 => Z0_3_5H2H + | 1, 0, 7 => Z1_0_7H2H + | _, _, _ => (.exact 0) +lemma CA1_3_12I2Singles_sound (u : Shape) (hu : u ∈ below (shape 1 3 12)) + (hd : designated (Equiv.refl (Fin 3)) 2 u) : + (CA1_3_12I2Singles u).Encloses (homogeneousEntropy ((fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) u)) := by + rw [A1_3_12_below] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl + · exact Z0_0_8H2H_sound + · exact Z0_1_7H2H_sound + · exact Z0_2_6H2H_sound + · exact Z0_3_5H2H_sound + · exact Z1_0_7H2H_sound + · exact (show ¬ designated (Equiv.refl (Fin 3)) 2 (shape 1 1 6) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 2 (shape 1 2 5) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 2 (shape 1 3 4) by decide +kernel) hd |>.elim +def CA1_3_12I2Singleton : Ball := ⟨(56736239042590527820128214119539 / 100000000000000000000000000000000), (47869683083 / 100000000000000000000000000000000)⟩ +lemma CA1_3_12I2Singleton_sound : CA1_3_12I2Singleton.Encloses + (singletonEntropy (below (shape 1 3 12)) (fun u => (stageALaw (shape 1 3 12) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ))) := by + exact contains_sound (singletonBall_sound (below (shape 1 3 12)) A1_3_12Law (fun u => (stageALaw (shape 1 3 12) u : ℝ)) (Equiv.refl (Fin 3)) 2 + CA1_3_12I2Singles (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A1_3_12Law_sound u) CA1_3_12I2Singles_sound) (by decide +kernel) +def CA1_3_12I2Group : Ball := ⟨(17429708332070986383984507682221 / 25000000000000000000000000000000), (56847768579 / 50000000000000000000000000000000)⟩ +lemma CA1_3_12I2Group_sound : CA1_3_12I2Group.Encloses + (groupedEntropy (below (shape 1 3 12)) (fun u => (stageALaw (shape 1 3 12) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ))) := by + exact contains_sound (Ball.add_sound CA1_3_12I2Singleton_sound + (finSumBall_sound 17 CA1_3_12I2ResidualEntropies _ CA1_3_12I2ResidualEntropies_sound)) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CA1_3_12I2H : Ball := ⟨(58626244353056865886112917955503 / 50000000000000000000000000000000), (190736647737 / 50000000000000000000000000000000)⟩ +lemma CA1_3_12I2_sound : CA1_3_12I2H.Encloses (stageACapacity (shape 1 3 12) 2) := by + have hb := contains_sound (Ball.add_sound CA1_3_12I2PairH_sound + (Ball.neg_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) CA1_3_12I2Group_sound))) + (show contains (.add CA1_3_12I2PairH (.neg (.mul (.exact 2) CA1_3_12I2Group))) CA1_3_12I2H = true by decide +kernel) + simp only [stageACapacity, nativeCapacity, + show (2 : Fin 3) ≠ 0 by decide, ite_false, sub_eq_add_neg] + exact hb + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA1_4_11I0.lean b/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA1_4_11I0.lean new file mode 100644 index 0000000000000000000000000000000000000000..d4b5a72cb97f4a5951cf9afbf7a29785951bb225 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA1_4_11I0.lean @@ -0,0 +1,72 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Certificates.SplitA1_4_11 + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CA1_4_11I0Value (a : Fin 17) : ℝ := marginal (below (shape 1 4 11)) (fun u => (stageALaw (shape 1 4 11) u : ℝ)) ((Equiv.refl (Fin 3)) 0) a +def CA1_4_11I0Raw (a : Fin 17) : Ball := marginalBall (below (shape 1 4 11)) A1_4_11Law ((Equiv.refl (Fin 3)) 0) a +lemma CA1_4_11I0Raw_sound (a : Fin 17) : + (CA1_4_11I0Raw a).Encloses (CA1_4_11I0Value a) := by + exact marginalBall_sound (below (shape 1 4 11)) A1_4_11Law (fun u => (stageALaw (shape 1 4 11) u : ℝ)) (fun u _ => A1_4_11Law_sound u) ((Equiv.refl (Fin 3)) 0) a +def CA1_4_11I0Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(1 / 2), (17 / 20000000000000000000000000000000)⟩ ⟨(6931471805599453094172319305033 / 20000000000000000000000000000000), (21175823827 / 100000000000000000000000000000000)⟩ ⟨(-6931471805599453094172319305033 / 10000000000000000000000000000000), (8470329507 / 20000000000000000000000000000000)⟩ ⟨-1, 1, 1⟩] +lemma CA1_4_11I0Certificates_valid : + CA1_4_11I0Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_4_11I0CertificateIndex (a : Fin 17) : ℕ := + match a.val with + | 0 => 1 + | 1 => 1 + | _ => 0 +def CA1_4_11I0P (a : Fin 17) : Ball := + (CompactCertificate.entropyLookup CA1_4_11I0Certificates (CA1_4_11I0CertificateIndex a)).input +lemma CA1_4_11I0P_check : ∀ a : Fin 17, contains (CA1_4_11I0Raw a) (CA1_4_11I0P a) = true := by + decide +kernel +lemma CA1_4_11I0P_sound (a : Fin 17) : + (CA1_4_11I0P a).Encloses (CA1_4_11I0Value a) := + contains_sound (CA1_4_11I0Raw_sound a) (CA1_4_11I0P_check a) +def CA1_4_11I0Terms (a : Fin 17) : Ball := + (CompactCertificate.entropyLookup CA1_4_11I0Certificates (CA1_4_11I0CertificateIndex a)).output +lemma CA1_4_11I0Terms_sound (a : Fin 17) : + (CA1_4_11I0Terms a).Encloses (Foundation.entropyTerm (CA1_4_11I0Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_4_11I0Certificates_valid + (CA1_4_11I0CertificateIndex a) (CA1_4_11I0P_sound a) +def CA1_4_11I0Entropy : Ball := ⟨(6931471805599453094172319305033 / 10000000000000000000000000000000), (21175823827 / 50000000000000000000000000000000)⟩ +lemma CA1_4_11I0Entropy_sound : CA1_4_11I0Entropy.Encloses (Foundation.finiteEntropy CA1_4_11I0Value) := by + exact contains_sound (entropyFin_enclosed 17 CA1_4_11I0Value CA1_4_11I0Terms CA1_4_11I0Terms_sound) (by decide +kernel) +def CA1_4_11I0Mass : Ball := ⟨1, (17 / 10000000000000000000000000000000)⟩ +lemma CA1_4_11I0Mass_sound : CA1_4_11I0Mass.Encloses (∑ a, CA1_4_11I0Value a) := by + exact contains_sound (finSumBall_sound 17 CA1_4_11I0P CA1_4_11I0Value CA1_4_11I0P_sound) (by decide +kernel) +def CA1_4_11I0MassTermLogWitness : LogWitness := ⟨0, 1, 1⟩ +def CA1_4_11I0MassTermLog : Ball := ⟨0, (5293955963 / 25000000000000000000000000000000)⟩ +lemma CA1_4_11I0MassTermLog_sound : CA1_4_11I0MassTermLog.Encloses (Real.log ((∑ a, CA1_4_11I0Value a))) := by + exact checkLog_sound logTwoBall_sound (CA1_4_11I0Mass_sound) (w := CA1_4_11I0MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA1_4_11I0MassTerm : Ball := ⟨0, (21175823853 / 100000000000000000000000000000000)⟩ +lemma CA1_4_11I0MassTerm_sound : CA1_4_11I0MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_4_11I0Value a))) := by + exact contains_sound (entropyTerm_ball (CA1_4_11I0Mass_sound) CA1_4_11I0MassTermLog_sound) (by decide +kernel) +def CA1_4_11I0H : Ball := ⟨(6931471805599453094172319305033 / 10000000000000000000000000000000), (63527471507 / 100000000000000000000000000000000)⟩ +lemma CA1_4_11I0H_sound : CA1_4_11I0H.Encloses (homogeneousEntropy CA1_4_11I0Value) := by + exact contains_sound (homogeneous_enclosed CA1_4_11I0Value CA1_4_11I0MassTerm_sound CA1_4_11I0Entropy_sound) (by decide +kernel) +lemma CA1_4_11I0_sound : CA1_4_11I0H.Encloses (stageACapacity (shape 1 4 11) 0) := by + exact CA1_4_11I0H_sound + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA1_4_11I1.lean b/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA1_4_11I1.lean new file mode 100644 index 0000000000000000000000000000000000000000..8a3734dd36c1edec741105b1a39dbe1145d060d1 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA1_4_11I1.lean @@ -0,0 +1,1035 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Certificates.SupportedContraction + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CA1_4_11I1PairValue (a : PairSlot × PairSlot) : ℝ := pairLaw (below (shape 1 4 11)) (shape 1 4 11) (fun u => (stageALaw (shape 1 4 11) u : ℝ)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) a +def CA1_4_11I1PairRaw (a : PairSlot × PairSlot) : Ball := stageAPairBall (shape 1 4 11) A1_4_11Law 1 a +lemma CA1_4_11I1PairRaw_sound (a : PairSlot × PairSlot) : + (CA1_4_11I1PairRaw a).Encloses (CA1_4_11I1PairValue a) := by + exact stageAPairBall_sound (shape 1 4 11) (by decide +kernel) A1_4_11Law (fun u => (stageALaw (shape 1 4 11) u : ℝ)) (fun u _ => A1_4_11Law_sound u) 1 a +def CA1_4_11I1PairCertificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(11664977189338182042318946841 / 4000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ ⟨(34046911231915542261283174941 / 2000000000000000000000000000000), (123507753 / 20000000000000000000000000000000)⟩ ⟨(-583745869010948486140178427050387 / 100000000000000000000000000000000), (42351647503 / 20000000000000000000000000000000)⟩ ⟨-9, 11664977189338182042318946841, 7812500000000000000000000000⟩, + .log ⟨(1432041275913219638258759429603 / 100000000000000000000000000000000), (1 / 10000000000000000000000000000000)⟩ ⟨(6080546489257217219713937617783 / 100000000000000000000000000000000), (1212986169 / 50000000000000000000000000000000)⟩ ⟨(-106151732347582358530726446483411 / 25000000000000000000000000000000), (84703295081 / 50000000000000000000000000000000)⟩ ⟨-7, 1432041275913219638258759429603, 781250000000000000000000000000⟩, + .log ⟨(72646759446330440509803789261 / 50000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ ⟨(18987449595068623982609898379 / 2000000000000000000000000000000), (338438109 / 100000000000000000000000000000000)⟩ ⟨(-130683390007891982652220310067249 / 20000000000000000000000000000000), (232934061889 / 100000000000000000000000000000000)⟩ ⟨-10, 72646759446330440509803789261, 48828125000000000000000000000⟩, + .log ⟨(15442796055875565115581455813 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(135522624707020123450557332547 / 100000000000000000000000000000000), (1144549 / 2500000000000000000000000000000)⟩ ⟨(-27424321390834174728384894737699 / 3125000000000000000000000000000), (296461538037 / 100000000000000000000000000000000)⟩ ⟨-13, 15442796055875565115581455813, 12207031250000000000000000000⟩, + .log ⟨(858584694521010948985622169 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(8633891199949041081299899313 / 20000000000000000000000000000000), (7272501 / 50000000000000000000000000000000)⟩ ⟨(-201119150039489921776711304601741 / 20000000000000000000000000000000), (338813202221 / 100000000000000000000000000000000)⟩ ⟨-15, 858584694521010948985622169, 610351562500000000000000000⟩, + .log ⟨(137888861593042178984912356271 / 50000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ ⟨(1625249205084484155605066075167 / 100000000000000000000000000000000), (583982059 / 100000000000000000000000000000000)⟩ ⟨(-589333027449728988868004776662241 / 100000000000000000000000000000000), (42351647511 / 20000000000000000000000000000000)⟩ ⟨-9, 137888861593042178984912356271, 97656250000000000000000000000⟩, + .log ⟨(4904076801820583064126827285721 / 100000000000000000000000000000000), (21 / 100000000000000000000000000000000)⟩ ⟨(7393149139095214348214785328203 / 50000000000000000000000000000000), (3115436013 / 50000000000000000000000000000000)⟩ ⟨(-301510332642041467290155459800419 / 100000000000000000000000000000000), (63527471263 / 50000000000000000000000000000000)⟩ ⟨-5, 4904076801820583064126827285721, 3125000000000000000000000000000⟩, + .log ⟨(482992777307967784909064602021 / 100000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ ⟨(1287881830273238117754698756549 / 50000000000000000000000000000000), (115062413 / 12500000000000000000000000000000)⟩ ⟨(-533292376524319641417441294797923 / 100000000000000000000000000000000), (4764560339 / 2500000000000000000000000000000)⟩ ⟨-8, 482992777307967784909064602021, 390625000000000000000000000000⟩, + .log ⟨(1593584057043965232702681183837 / 100000000000000000000000000000000), (1 / 12500000000000000000000000000000)⟩ ⟨(6596138559921701501728336143231 / 100000000000000000000000000000000), (2362181893 / 100000000000000000000000000000000)⟩ ⟨(-82783691651098405640700492998221 / 20000000000000000000000000000000), (74115383141 / 50000000000000000000000000000000)⟩ ⟨-6, 1593584057043965232702681183837, 1562500000000000000000000000000⟩, + .log ⟨(150556659524634014410605017567 / 100000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ ⟨(978405396237944661934025336967 / 100000000000000000000000000000000), (87674439 / 25000000000000000000000000000000)⟩ ⟨(-649858597638358468854867514767903 / 100000000000000000000000000000000), (232934061841 / 100000000000000000000000000000000)⟩ ⟨-10, 150556659524634014410605017567, 97656250000000000000000000000⟩, + .log ⟨(5469334159468324195833199519871 / 100000000000000000000000000000000), (19 / 100000000000000000000000000000000)⟩ ⟨(397348945626970979222896666589 / 2500000000000000000000000000000), (217158107 / 3125000000000000000000000000000)⟩ ⟨(-58120266056751215685901505382233 / 20000000000000000000000000000000), (25410988489 / 20000000000000000000000000000000)⟩ ⟨-5, 5469334159468324195833199519871, 3125000000000000000000000000000⟩, + .log ⟨(2786939030381170203143835961 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(123719799583554885385098337861 / 100000000000000000000000000000000), (41311021 / 100000000000000000000000000000000)⟩ ⟨(-13872724501107235369479078733497 / 1562500000000000000000000000000), (148230769369 / 50000000000000000000000000000000)⟩ ⟨-13, 2786939030381170203143835961, 2441406250000000000000000000⟩, + .log ⟨(25388704041102548051955395779 / 5000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ ⟨(2682514024359832963349767317973 / 100000000000000000000000000000000), (241932029 / 25000000000000000000000000000000)⟩ ⟨(-52828888391014939480636882266497 / 10000000000000000000000000000000), (190582413737 / 100000000000000000000000000000000)⟩ ⟨-8, 25388704041102548051955395779, 19531250000000000000000000000⟩, + .log ⟨(18494448703007788912267876648421 / 100000000000000000000000000000000), (37 / 100000000000000000000000000000000)⟩ ⟨(31213073105727158527369908172863 / 100000000000000000000000000000000), (7832703747 / 50000000000000000000000000000000)⟩ ⟨(-168769956904154242112485802872997 / 100000000000000000000000000000000), (84703294931 / 100000000000000000000000000000000)⟩ ⟨-3, 18494448703007788912267876648421, 12500000000000000000000000000000⟩] +lemma CA1_4_11I1PairCertificates_valid : + CA1_4_11I1PairCertificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_4_11I1PairCertificateIndex (a : PairSlot × PairSlot) : ℕ := + match a.1.1.val, a.1.2.val, a.2.1.val, a.2.2.val with + | 0, 0, 1, 4 => 1 + | 0, 0, 2, 2 => 2 + | 0, 0, 2, 3 => 3 + | 0, 0, 3, 2 => 3 + | 0, 0, 3, 3 => 4 + | 0, 0, 4, 1 => 1 + | 0, 0, 5, 0 => 5 + | 0, 0, 0, 5 => 5 + | 1, 0, 0, 4 => 6 + | 1, 0, 1, 2 => 7 + | 1, 0, 1, 3 => 8 + | 1, 0, 2, 1 => 7 + | 1, 0, 3, 1 => 8 + | 1, 0, 4, 0 => 6 + | 0, 1, 0, 4 => 6 + | 0, 1, 1, 2 => 7 + | 0, 1, 1, 3 => 8 + | 0, 1, 2, 1 => 7 + | 0, 1, 3, 1 => 8 + | 0, 1, 4, 0 => 6 + | 2, 0, 0, 2 => 9 + | 2, 0, 0, 3 => 10 + | 2, 0, 1, 1 => 11 + | 2, 0, 2, 0 => 9 + | 2, 0, 3, 0 => 10 + | 3, 0, 0, 2 => 10 + | 3, 0, 0, 3 => 12 + | 3, 0, 1, 1 => 13 + | 3, 0, 2, 0 => 10 + | 3, 0, 3, 0 => 12 + | 1, 1, 0, 2 => 11 + | 1, 1, 0, 3 => 13 + | 1, 1, 1, 1 => 14 + | 1, 1, 2, 0 => 11 + | 1, 1, 3, 0 => 13 + | 0, 2, 0, 2 => 9 + | 0, 2, 0, 3 => 10 + | 0, 2, 1, 1 => 11 + | 0, 2, 2, 0 => 9 + | 0, 2, 3, 0 => 10 + | 0, 3, 0, 2 => 10 + | 0, 3, 0, 3 => 12 + | 0, 3, 1, 1 => 13 + | 0, 3, 2, 0 => 10 + | 0, 3, 3, 0 => 12 + | 4, 0, 0, 1 => 6 + | 4, 0, 1, 0 => 6 + | 2, 1, 0, 1 => 7 + | 2, 1, 1, 0 => 7 + | 3, 1, 0, 1 => 8 + | 3, 1, 1, 0 => 8 + | 1, 2, 0, 1 => 7 + | 1, 2, 1, 0 => 7 + | 1, 3, 0, 1 => 8 + | 1, 3, 1, 0 => 8 + | 0, 4, 0, 1 => 6 + | 0, 4, 1, 0 => 6 + | 0, 5, 0, 0 => 5 + | 1, 4, 0, 0 => 1 + | 2, 2, 0, 0 => 2 + | 2, 3, 0, 0 => 3 + | 3, 2, 0, 0 => 3 + | 3, 3, 0, 0 => 4 + | 4, 1, 0, 0 => 1 + | 5, 0, 0, 0 => 5 + | _, _, _, _ => 0 +def CA1_4_11I1PairP (a : PairSlot × PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_4_11I1PairCertificates (CA1_4_11I1PairCertificateIndex a)).input +lemma CA1_4_11I1PairP_check_0_0 : ∀ k l : Fin 6, contains (CA1_4_11I1PairRaw ((0,0),(k,l))) (CA1_4_11I1PairP ((0,0),(k,l))) = true := by + decide +kernel +lemma CA1_4_11I1PairP_check_0_1 : ∀ k l : Fin 6, contains (CA1_4_11I1PairRaw ((0,1),(k,l))) (CA1_4_11I1PairP ((0,1),(k,l))) = true := by + decide +kernel +lemma CA1_4_11I1PairP_check_0_2 : ∀ k l : Fin 6, contains (CA1_4_11I1PairRaw ((0,2),(k,l))) (CA1_4_11I1PairP ((0,2),(k,l))) = true := by + decide +kernel +lemma CA1_4_11I1PairP_check_0_3 : ∀ k l : Fin 6, contains (CA1_4_11I1PairRaw ((0,3),(k,l))) (CA1_4_11I1PairP ((0,3),(k,l))) = true := by + decide +kernel +lemma CA1_4_11I1PairP_check_0_4 : ∀ k l : Fin 6, contains (CA1_4_11I1PairRaw ((0,4),(k,l))) (CA1_4_11I1PairP ((0,4),(k,l))) = true := by + decide +kernel +lemma CA1_4_11I1PairP_check_0_5 : ∀ k l : Fin 6, contains (CA1_4_11I1PairRaw ((0,5),(k,l))) (CA1_4_11I1PairP ((0,5),(k,l))) = true := by + decide +kernel +lemma CA1_4_11I1PairP_check_1_0 : ∀ k l : Fin 6, contains (CA1_4_11I1PairRaw ((1,0),(k,l))) (CA1_4_11I1PairP ((1,0),(k,l))) = true := by + decide +kernel +lemma CA1_4_11I1PairP_check_1_1 : ∀ k l : Fin 6, contains (CA1_4_11I1PairRaw ((1,1),(k,l))) (CA1_4_11I1PairP ((1,1),(k,l))) = true := by + decide +kernel +lemma CA1_4_11I1PairP_check_1_2 : ∀ k l : Fin 6, contains (CA1_4_11I1PairRaw ((1,2),(k,l))) (CA1_4_11I1PairP ((1,2),(k,l))) = true := by + decide +kernel +lemma CA1_4_11I1PairP_check_1_3 : ∀ k l : Fin 6, contains (CA1_4_11I1PairRaw ((1,3),(k,l))) (CA1_4_11I1PairP ((1,3),(k,l))) = true := by + decide +kernel +lemma CA1_4_11I1PairP_check_1_4 : ∀ k l : Fin 6, contains (CA1_4_11I1PairRaw ((1,4),(k,l))) (CA1_4_11I1PairP ((1,4),(k,l))) = true := by + decide +kernel +lemma CA1_4_11I1PairP_check_1_5 : ∀ k l : Fin 6, contains (CA1_4_11I1PairRaw ((1,5),(k,l))) (CA1_4_11I1PairP ((1,5),(k,l))) = true := by + decide +kernel +lemma CA1_4_11I1PairP_check_2_0 : ∀ k l : Fin 6, contains (CA1_4_11I1PairRaw ((2,0),(k,l))) (CA1_4_11I1PairP ((2,0),(k,l))) = true := by + decide +kernel +lemma CA1_4_11I1PairP_check_2_1 : ∀ k l : Fin 6, contains (CA1_4_11I1PairRaw ((2,1),(k,l))) (CA1_4_11I1PairP ((2,1),(k,l))) = true := by + decide +kernel +lemma CA1_4_11I1PairP_check_2_2 : ∀ k l : Fin 6, contains (CA1_4_11I1PairRaw ((2,2),(k,l))) (CA1_4_11I1PairP ((2,2),(k,l))) = true := by + decide +kernel +lemma CA1_4_11I1PairP_check_2_3 : ∀ k l : Fin 6, contains (CA1_4_11I1PairRaw ((2,3),(k,l))) (CA1_4_11I1PairP ((2,3),(k,l))) = true := by + decide +kernel +lemma CA1_4_11I1PairP_check_2_4 : ∀ k l : Fin 6, contains (CA1_4_11I1PairRaw ((2,4),(k,l))) (CA1_4_11I1PairP ((2,4),(k,l))) = true := by + decide +kernel +lemma CA1_4_11I1PairP_check_2_5 : ∀ k l : Fin 6, contains (CA1_4_11I1PairRaw ((2,5),(k,l))) (CA1_4_11I1PairP ((2,5),(k,l))) = true := by + decide +kernel +lemma CA1_4_11I1PairP_check_3_0 : ∀ k l : Fin 6, contains (CA1_4_11I1PairRaw ((3,0),(k,l))) (CA1_4_11I1PairP ((3,0),(k,l))) = true := by + decide +kernel +lemma CA1_4_11I1PairP_check_3_1 : ∀ k l : Fin 6, contains (CA1_4_11I1PairRaw ((3,1),(k,l))) (CA1_4_11I1PairP ((3,1),(k,l))) = true := by + decide +kernel +lemma CA1_4_11I1PairP_check_3_2 : ∀ k l : Fin 6, contains (CA1_4_11I1PairRaw ((3,2),(k,l))) (CA1_4_11I1PairP ((3,2),(k,l))) = true := by + decide +kernel +lemma CA1_4_11I1PairP_check_3_3 : ∀ k l : Fin 6, contains (CA1_4_11I1PairRaw ((3,3),(k,l))) (CA1_4_11I1PairP ((3,3),(k,l))) = true := by + decide +kernel +lemma CA1_4_11I1PairP_check_3_4 : ∀ k l : Fin 6, contains (CA1_4_11I1PairRaw ((3,4),(k,l))) (CA1_4_11I1PairP ((3,4),(k,l))) = true := by + decide +kernel +lemma CA1_4_11I1PairP_check_3_5 : ∀ k l : Fin 6, contains (CA1_4_11I1PairRaw ((3,5),(k,l))) (CA1_4_11I1PairP ((3,5),(k,l))) = true := by + decide +kernel +lemma CA1_4_11I1PairP_check_4_0 : ∀ k l : Fin 6, contains (CA1_4_11I1PairRaw ((4,0),(k,l))) (CA1_4_11I1PairP ((4,0),(k,l))) = true := by + decide +kernel +lemma CA1_4_11I1PairP_check_4_1 : ∀ k l : Fin 6, contains (CA1_4_11I1PairRaw ((4,1),(k,l))) (CA1_4_11I1PairP ((4,1),(k,l))) = true := by + decide +kernel +lemma CA1_4_11I1PairP_check_4_2 : ∀ k l : Fin 6, contains (CA1_4_11I1PairRaw ((4,2),(k,l))) (CA1_4_11I1PairP ((4,2),(k,l))) = true := by + decide +kernel +lemma CA1_4_11I1PairP_check_4_3 : ∀ k l : Fin 6, contains (CA1_4_11I1PairRaw ((4,3),(k,l))) (CA1_4_11I1PairP ((4,3),(k,l))) = true := by + decide +kernel +lemma CA1_4_11I1PairP_check_4_4 : ∀ k l : Fin 6, contains (CA1_4_11I1PairRaw ((4,4),(k,l))) (CA1_4_11I1PairP ((4,4),(k,l))) = true := by + decide +kernel +lemma CA1_4_11I1PairP_check_4_5 : ∀ k l : Fin 6, contains (CA1_4_11I1PairRaw ((4,5),(k,l))) (CA1_4_11I1PairP ((4,5),(k,l))) = true := by + decide +kernel +lemma CA1_4_11I1PairP_check_5_0 : ∀ k l : Fin 6, contains (CA1_4_11I1PairRaw ((5,0),(k,l))) (CA1_4_11I1PairP ((5,0),(k,l))) = true := by + decide +kernel +lemma CA1_4_11I1PairP_check_5_1 : ∀ k l : Fin 6, contains (CA1_4_11I1PairRaw ((5,1),(k,l))) (CA1_4_11I1PairP ((5,1),(k,l))) = true := by + decide +kernel +lemma CA1_4_11I1PairP_check_5_2 : ∀ k l : Fin 6, contains (CA1_4_11I1PairRaw ((5,2),(k,l))) (CA1_4_11I1PairP ((5,2),(k,l))) = true := by + decide +kernel +lemma CA1_4_11I1PairP_check_5_3 : ∀ k l : Fin 6, contains (CA1_4_11I1PairRaw ((5,3),(k,l))) (CA1_4_11I1PairP ((5,3),(k,l))) = true := by + decide +kernel +lemma CA1_4_11I1PairP_check_5_4 : ∀ k l : Fin 6, contains (CA1_4_11I1PairRaw ((5,4),(k,l))) (CA1_4_11I1PairP ((5,4),(k,l))) = true := by + decide +kernel +lemma CA1_4_11I1PairP_check_5_5 : ∀ k l : Fin 6, contains (CA1_4_11I1PairRaw ((5,5),(k,l))) (CA1_4_11I1PairP ((5,5),(k,l))) = true := by + decide +kernel +lemma CA1_4_11I1PairP_check (a : PairSlot × PairSlot) : contains (CA1_4_11I1PairRaw a) (CA1_4_11I1PairP a) = true := by + rcases a with ⟨⟨i,j⟩,⟨k,l⟩⟩ + revert j i + apply forall_fin6 + · exact forall_fin6 (CA1_4_11I1PairP_check_0_0 k l) (CA1_4_11I1PairP_check_0_1 k l) (CA1_4_11I1PairP_check_0_2 k l) (CA1_4_11I1PairP_check_0_3 k l) (CA1_4_11I1PairP_check_0_4 k l) (CA1_4_11I1PairP_check_0_5 k l) + · exact forall_fin6 (CA1_4_11I1PairP_check_1_0 k l) (CA1_4_11I1PairP_check_1_1 k l) (CA1_4_11I1PairP_check_1_2 k l) (CA1_4_11I1PairP_check_1_3 k l) (CA1_4_11I1PairP_check_1_4 k l) (CA1_4_11I1PairP_check_1_5 k l) + · exact forall_fin6 (CA1_4_11I1PairP_check_2_0 k l) (CA1_4_11I1PairP_check_2_1 k l) (CA1_4_11I1PairP_check_2_2 k l) (CA1_4_11I1PairP_check_2_3 k l) (CA1_4_11I1PairP_check_2_4 k l) (CA1_4_11I1PairP_check_2_5 k l) + · exact forall_fin6 (CA1_4_11I1PairP_check_3_0 k l) (CA1_4_11I1PairP_check_3_1 k l) (CA1_4_11I1PairP_check_3_2 k l) (CA1_4_11I1PairP_check_3_3 k l) (CA1_4_11I1PairP_check_3_4 k l) (CA1_4_11I1PairP_check_3_5 k l) + · exact forall_fin6 (CA1_4_11I1PairP_check_4_0 k l) (CA1_4_11I1PairP_check_4_1 k l) (CA1_4_11I1PairP_check_4_2 k l) (CA1_4_11I1PairP_check_4_3 k l) (CA1_4_11I1PairP_check_4_4 k l) (CA1_4_11I1PairP_check_4_5 k l) + · exact forall_fin6 (CA1_4_11I1PairP_check_5_0 k l) (CA1_4_11I1PairP_check_5_1 k l) (CA1_4_11I1PairP_check_5_2 k l) (CA1_4_11I1PairP_check_5_3 k l) (CA1_4_11I1PairP_check_5_4 k l) (CA1_4_11I1PairP_check_5_5 k l) +lemma CA1_4_11I1PairP_sound (a : PairSlot × PairSlot) : + (CA1_4_11I1PairP a).Encloses (CA1_4_11I1PairValue a) := + contains_sound (CA1_4_11I1PairRaw_sound a) (CA1_4_11I1PairP_check a) +def CA1_4_11I1PairTerms (a : PairSlot × PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_4_11I1PairCertificates (CA1_4_11I1PairCertificateIndex a)).output +lemma CA1_4_11I1PairTerms_sound (a : PairSlot × PairSlot) : + (CA1_4_11I1PairTerms a).Encloses (Foundation.entropyTerm (CA1_4_11I1PairValue a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_4_11I1PairCertificates_valid + (CA1_4_11I1PairCertificateIndex a) (CA1_4_11I1PairP_sound a) +def CA1_4_11I1PairEntropy : Ball := ⟨(315335814479301831357444261227387 / 100000000000000000000000000000000), (13046053457 / 10000000000000000000000000000000)⟩ +lemma CA1_4_11I1PairEntropy_sound : CA1_4_11I1PairEntropy.Encloses (Foundation.finiteEntropy CA1_4_11I1PairValue) := by + exact contains_sound (entropyDoublePair_enclosed CA1_4_11I1PairValue CA1_4_11I1PairTerms CA1_4_11I1PairTerms_sound) (by decide +kernel) +def CA1_4_11I1PairMass : Ball := ⟨(100000000000000000000000000000001 / 100000000000000000000000000000000), (419 / 100000000000000000000000000000000)⟩ +lemma CA1_4_11I1PairMass_sound : CA1_4_11I1PairMass.Encloses (∑ a, CA1_4_11I1PairValue a) := by + exact contains_sound (doublePairSumBall_sound CA1_4_11I1PairP CA1_4_11I1PairValue CA1_4_11I1PairP_sound) (by decide +kernel) +def CA1_4_11I1PairMassTermLogWitness : LogWitness := ⟨0, 100000000000000000000000000000001, 100000000000000000000000000000000⟩ +def CA1_4_11I1PairMassTermLog : Ball := ⟨(1 / 100000000000000000000000000000000), (21175824101 / 100000000000000000000000000000000)⟩ +lemma CA1_4_11I1PairMassTermLog_sound : CA1_4_11I1PairMassTermLog.Encloses (Real.log ((∑ a, CA1_4_11I1PairValue a))) := by + exact checkLog_sound logTwoBall_sound (CA1_4_11I1PairMass_sound) (w := CA1_4_11I1PairMassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA1_4_11I1PairMassTerm : Ball := ⟨(-1 / 100000000000000000000000000000000), (10587912051 / 50000000000000000000000000000000)⟩ +lemma CA1_4_11I1PairMassTerm_sound : CA1_4_11I1PairMassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_4_11I1PairValue a))) := by + exact contains_sound (entropyTerm_ball (CA1_4_11I1PairMass_sound) CA1_4_11I1PairMassTermLog_sound) (by decide +kernel) +def CA1_4_11I1PairH : Ball := ⟨(78833953619825457839361065306847 / 25000000000000000000000000000000), (9477272417 / 6250000000000000000000000000000)⟩ +lemma CA1_4_11I1PairH_sound : CA1_4_11I1PairH.Encloses (homogeneousEntropy CA1_4_11I1PairValue) := by + exact contains_sound (homogeneous_enclosed CA1_4_11I1PairValue CA1_4_11I1PairMassTerm_sound CA1_4_11I1PairEntropy_sound) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CA1_4_11I1R0Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 4 11)) (fun u => (stageALaw (shape 1 4 11) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 0 a +def CA1_4_11I1R0Raw (a : PairSlot) : Ball := residualBall (below (shape 1 4 11)) A1_4_11Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 0 a +lemma CA1_4_11I1R0Raw_sound (a : PairSlot) : + (CA1_4_11I1R0Raw a).Encloses (CA1_4_11I1R0Value a) := by + exact residualBall_sound_on (below (shape 1 4 11)) A1_4_11Law (fun u => (stageALaw (shape 1 4 11) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A1_4_11Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 4 11) (show (shape 1 4 11) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 0 a +def CA1_4_11I1R0Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(11649529080832680885096798031 / 500000000000000000000000000000), (1 / 10000000000000000000000000000000)⟩ ⟨(437945679318023839001681305581 / 5000000000000000000000000000000), (1726818641 / 50000000000000000000000000000000)⟩ ⟨(-375934234147360499072534355300923 / 100000000000000000000000000000000), (148230766209 / 100000000000000000000000000000000)⟩ ⟨-6, 11649529080832680885096798031, 7812500000000000000000000000⟩] +lemma CA1_4_11I1R0Certificates_valid : + CA1_4_11I1R0Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_4_11I1R0CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 0, 0 => 1 + | _, _ => 0 +def CA1_4_11I1R0P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_4_11I1R0Certificates (CA1_4_11I1R0CertificateIndex a)).input +lemma CA1_4_11I1R0P_check : ∀ a : PairSlot, contains (CA1_4_11I1R0Raw a) (CA1_4_11I1R0P a) = true := by + decide +kernel +lemma CA1_4_11I1R0P_sound (a : PairSlot) : + (CA1_4_11I1R0P a).Encloses (CA1_4_11I1R0Value a) := + contains_sound (CA1_4_11I1R0Raw_sound a) (CA1_4_11I1R0P_check a) +def CA1_4_11I1R0Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_4_11I1R0Certificates (CA1_4_11I1R0CertificateIndex a)).output +lemma CA1_4_11I1R0Terms_sound (a : PairSlot) : + (CA1_4_11I1R0Terms a).Encloses (Foundation.entropyTerm (CA1_4_11I1R0Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_4_11I1R0Certificates_valid + (CA1_4_11I1R0CertificateIndex a) (CA1_4_11I1R0P_sound a) +def CA1_4_11I1R0Entropy : Ball := ⟨(437945679318023839001681305581 / 5000000000000000000000000000000), (1726818641 / 50000000000000000000000000000000)⟩ +lemma CA1_4_11I1R0Entropy_sound : CA1_4_11I1R0Entropy.Encloses (Foundation.finiteEntropy CA1_4_11I1R0Value) := by + exact contains_sound (entropyPair_enclosed CA1_4_11I1R0Value CA1_4_11I1R0Terms CA1_4_11I1R0Terms_sound) (by decide +kernel) +def CA1_4_11I1R0Mass : Ball := ⟨(11649529080832680885096798031 / 500000000000000000000000000000), (1 / 10000000000000000000000000000000)⟩ +lemma CA1_4_11I1R0Mass_sound : CA1_4_11I1R0Mass.Encloses (∑ a, CA1_4_11I1R0Value a) := by + exact contains_sound (pairSumBall_sound CA1_4_11I1R0P CA1_4_11I1R0Value CA1_4_11I1R0P_sound) (by decide +kernel) +def CA1_4_11I1R0MassTermLogWitness : LogWitness := ⟨-6, 11649529080832680885096798031, 7812500000000000000000000000⟩ +def CA1_4_11I1R0MassTermLog : Ball := ⟨(-375934234147360499072534355300923 / 100000000000000000000000000000000), (148230766209 / 100000000000000000000000000000000)⟩ +lemma CA1_4_11I1R0MassTermLog_sound : CA1_4_11I1R0MassTermLog.Encloses (Real.log ((∑ a, CA1_4_11I1R0Value a))) := by + exact checkLog_sound logTwoBall_sound (CA1_4_11I1R0Mass_sound) (w := CA1_4_11I1R0MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA1_4_11I1R0MassTerm : Ball := ⟨(437945679318023839001681305581 / 5000000000000000000000000000000), (1726818641 / 50000000000000000000000000000000)⟩ +lemma CA1_4_11I1R0MassTerm_sound : CA1_4_11I1R0MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_4_11I1R0Value a))) := by + exact contains_sound (entropyTerm_ball (CA1_4_11I1R0Mass_sound) CA1_4_11I1R0MassTermLog_sound) (by decide +kernel) +def CA1_4_11I1R0H : Ball := ⟨0, (1726818641 / 25000000000000000000000000000000)⟩ +lemma CA1_4_11I1R0H_sound : CA1_4_11I1R0H.Encloses (homogeneousEntropy CA1_4_11I1R0Value) := by + exact contains_sound (homogeneous_enclosed CA1_4_11I1R0Value CA1_4_11I1R0MassTerm_sound CA1_4_11I1R0Entropy_sound) (by decide +kernel) +def CA1_4_11I1R1Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 4 11)) (fun u => (stageALaw (shape 1 4 11) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 1 a +def CA1_4_11I1R1Raw (a : PairSlot) : Ball := residualBall (below (shape 1 4 11)) A1_4_11Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 1 a +lemma CA1_4_11I1R1Raw_sound (a : PairSlot) : + (CA1_4_11I1R1Raw a).Encloses (CA1_4_11I1R1Value a) := by + exact residualBall_sound_on (below (shape 1 4 11)) A1_4_11Law (fun u => (stageALaw (shape 1 4 11) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A1_4_11Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 4 11) (show (shape 1 4 11) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 1 a +def CA1_4_11I1R1Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(1415711825578658801751429150071 / 12500000000000000000000000000000), (29 / 100000000000000000000000000000000)⟩ ⟨(3083556523177856507528997814397 / 12500000000000000000000000000000), (2398309139 / 20000000000000000000000000000000)⟩ ⟨(-217809618275773177236479388037759 / 100000000000000000000000000000000), (105879118671 / 100000000000000000000000000000000)⟩ ⟨-4, 1415711825578658801751429150071, 781250000000000000000000000000⟩] +lemma CA1_4_11I1R1Certificates_valid : + CA1_4_11I1R1Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_4_11I1R1CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 1, 0 => 1 + | 0, 1 => 1 + | _, _ => 0 +def CA1_4_11I1R1P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_4_11I1R1Certificates (CA1_4_11I1R1CertificateIndex a)).input +lemma CA1_4_11I1R1P_check : ∀ a : PairSlot, contains (CA1_4_11I1R1Raw a) (CA1_4_11I1R1P a) = true := by + decide +kernel +lemma CA1_4_11I1R1P_sound (a : PairSlot) : + (CA1_4_11I1R1P a).Encloses (CA1_4_11I1R1Value a) := + contains_sound (CA1_4_11I1R1Raw_sound a) (CA1_4_11I1R1P_check a) +def CA1_4_11I1R1Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_4_11I1R1Certificates (CA1_4_11I1R1CertificateIndex a)).output +lemma CA1_4_11I1R1Terms_sound (a : PairSlot) : + (CA1_4_11I1R1Terms a).Encloses (Foundation.entropyTerm (CA1_4_11I1R1Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_4_11I1R1Certificates_valid + (CA1_4_11I1R1CertificateIndex a) (CA1_4_11I1R1P_sound a) +def CA1_4_11I1R1Entropy : Ball := ⟨(3083556523177856507528997814397 / 6250000000000000000000000000000), (2398309139 / 10000000000000000000000000000000)⟩ +lemma CA1_4_11I1R1Entropy_sound : CA1_4_11I1R1Entropy.Encloses (Foundation.finiteEntropy CA1_4_11I1R1Value) := by + exact contains_sound (entropyPair_enclosed CA1_4_11I1R1Value CA1_4_11I1R1Terms CA1_4_11I1R1Terms_sound) (by decide +kernel) +def CA1_4_11I1R1Mass : Ball := ⟨(1415711825578658801751429150071 / 6250000000000000000000000000000), (29 / 50000000000000000000000000000000)⟩ +lemma CA1_4_11I1R1Mass_sound : CA1_4_11I1R1Mass.Encloses (∑ a, CA1_4_11I1R1Value a) := by + exact contains_sound (pairSumBall_sound CA1_4_11I1R1P CA1_4_11I1R1Value CA1_4_11I1R1P_sound) (by decide +kernel) +def CA1_4_11I1R1MassTermLogWitness : LogWitness := ⟨-3, 1415711825578658801751429150071, 781250000000000000000000000000⟩ +def CA1_4_11I1R1MassTermLog : Ball := ⟨(-148494900219778646294756194987429 / 100000000000000000000000000000000), (21175823747 / 25000000000000000000000000000000)⟩ +lemma CA1_4_11I1R1MassTermLog_sound : CA1_4_11I1R1MassTermLog.Encloses (Real.log ((∑ a, CA1_4_11I1R1Value a))) := by + exact checkLog_sound logTwoBall_sound (CA1_4_11I1R1Mass_sound) (w := CA1_4_11I1R1MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA1_4_11I1R1MassTerm : Ball := ⟨(3363615780468217751509662805569 / 10000000000000000000000000000000), (4796618277 / 25000000000000000000000000000000)⟩ +lemma CA1_4_11I1R1MassTerm_sound : CA1_4_11I1R1MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_4_11I1R1Value a))) := by + exact contains_sound (entropyTerm_ball (CA1_4_11I1R1Mass_sound) CA1_4_11I1R1MassTermLog_sound) (by decide +kernel) +def CA1_4_11I1R1H : Ball := ⟨(7850373283081763302683668487331 / 50000000000000000000000000000000), (21584782249 / 50000000000000000000000000000000)⟩ +lemma CA1_4_11I1R1H_sound : CA1_4_11I1R1H.Encloses (homogeneousEntropy CA1_4_11I1R1Value) := by + exact contains_sound (homogeneous_enclosed CA1_4_11I1R1Value CA1_4_11I1R1MassTerm_sound CA1_4_11I1R1Entropy_sound) (by decide +kernel) +def CA1_4_11I1R2Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 4 11)) (fun u => (stageALaw (shape 1 4 11) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 2 a +def CA1_4_11I1R2Raw (a : PairSlot) : Ball := residualBall (below (shape 1 4 11)) A1_4_11Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 2 a +lemma CA1_4_11I1R2Raw_sound (a : PairSlot) : + (CA1_4_11I1R2Raw a).Encloses (CA1_4_11I1R2Value a) := by + exact residualBall_sound_on (below (shape 1 4 11)) A1_4_11Law (fun u => (stageALaw (shape 1 4 11) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A1_4_11Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 4 11) (show (shape 1 4 11) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 2 a +def CA1_4_11I1R2Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(223940389815138067251494298067 / 2500000000000000000000000000000), (13 / 50000000000000000000000000000000)⟩ ⟨(10805867789225661561870460519403 / 50000000000000000000000000000000), (948424451 / 10000000000000000000000000000000)⟩ ⟨(-15079163195708386909004244644217 / 6250000000000000000000000000000), (21175823741 / 20000000000000000000000000000000)⟩ ⟨-4, 223940389815138067251494298067, 156250000000000000000000000000⟩, + .log ⟨(209189197543782672972939077581 / 25000000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ ⟨(400253574441421611996235844733 / 10000000000000000000000000000000), (354380291 / 25000000000000000000000000000000)⟩ ⟨(-478339200997281105739975070413043 / 100000000000000000000000000000000), (169406589941 / 100000000000000000000000000000000)⟩ ⟨-7, 209189197543782672972939077581, 195312500000000000000000000000⟩, + .log ⟨(15224332591794269613006245759661 / 50000000000000000000000000000000), (43 / 100000000000000000000000000000000)⟩ ⟨(36207361219350480702515376712927 / 100000000000000000000000000000000), (9671633527 / 50000000000000000000000000000000)⟩ ⟨(-11891280291283773157913279044349 / 10000000000000000000000000000000), (63527471189 / 100000000000000000000000000000000)⟩ ⟨-2, 15224332591794269613006245759661, 12500000000000000000000000000000⟩] +lemma CA1_4_11I1R2Certificates_valid : + CA1_4_11I1R2Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_4_11I1R2CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 2, 0 => 1 + | 3, 0 => 2 + | 1, 1 => 3 + | 0, 2 => 1 + | 0, 3 => 2 + | _, _ => 0 +def CA1_4_11I1R2P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_4_11I1R2Certificates (CA1_4_11I1R2CertificateIndex a)).input +lemma CA1_4_11I1R2P_check : ∀ a : PairSlot, contains (CA1_4_11I1R2Raw a) (CA1_4_11I1R2P a) = true := by + decide +kernel +lemma CA1_4_11I1R2P_sound (a : PairSlot) : + (CA1_4_11I1R2P a).Encloses (CA1_4_11I1R2Value a) := + contains_sound (CA1_4_11I1R2Raw_sound a) (CA1_4_11I1R2P_check a) +def CA1_4_11I1R2Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_4_11I1R2Certificates (CA1_4_11I1R2CertificateIndex a)).output +lemma CA1_4_11I1R2Terms_sound (a : PairSlot) : + (CA1_4_11I1R2Terms a).Encloses (Foundation.entropyTerm (CA1_4_11I1R2Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_4_11I1R2Certificates_valid + (CA1_4_11I1R2CertificateIndex a) (CA1_4_11I1R2P_sound a) +def CA1_4_11I1R2Entropy : Ball := ⟨(87435903865081559189921935685199 / 100000000000000000000000000000000), (20573399201 / 50000000000000000000000000000000)⟩ +lemma CA1_4_11I1R2Entropy_sound : CA1_4_11I1R2Entropy.Encloses (Foundation.finiteEntropy CA1_4_11I1R2Value) := by + exact contains_sound (entropyPair_enclosed CA1_4_11I1R2Value CA1_4_11I1R2Terms CA1_4_11I1R2Terms_sound) (by decide +kernel) +def CA1_4_11I1R2Mass : Ball := ⟨(5003740994914984598991554798533 / 10000000000000000000000000000000), (103 / 100000000000000000000000000000000)⟩ +lemma CA1_4_11I1R2Mass_sound : CA1_4_11I1R2Mass.Encloses (∑ a, CA1_4_11I1R2Value a) := by + exact contains_sound (pairSumBall_sound CA1_4_11I1R2P CA1_4_11I1R2Value CA1_4_11I1R2P_sound) (by decide +kernel) +def CA1_4_11I1R2MassTermLogWitness : LogWitness := ⟨-1, 5003740994914984598991554798533, 5000000000000000000000000000000⟩ +def CA1_4_11I1R2MassTermLog : Ball := ⟨(-34619963066913570366131252995201 / 50000000000000000000000000000000), (42351647571 / 100000000000000000000000000000000)⟩ +lemma CA1_4_11I1R2MassTermLog_sound : CA1_4_11I1R2MassTermLog.Encloses (Real.log ((∑ a, CA1_4_11I1R2Value a))) := by + exact checkLog_sound logTwoBall_sound (CA1_4_11I1R2Mass_sound) (w := CA1_4_11I1R2MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA1_4_11I1R2MassTerm : Ball := ⟨(34645865688071626023959378116581 / 100000000000000000000000000000000), (21191667587 / 100000000000000000000000000000000)⟩ +lemma CA1_4_11I1R2MassTerm_sound : CA1_4_11I1R2MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_4_11I1R2Value a))) := by + exact contains_sound (entropyTerm_ball (CA1_4_11I1R2Mass_sound) CA1_4_11I1R2MassTermLog_sound) (by decide +kernel) +def CA1_4_11I1R2H : Ball := ⟨(26395019088504966582981278784309 / 50000000000000000000000000000000), (62338465989 / 100000000000000000000000000000000)⟩ +lemma CA1_4_11I1R2H_sound : CA1_4_11I1R2H.Encloses (homogeneousEntropy CA1_4_11I1R2Value) := by + exact contains_sound (homogeneous_enclosed CA1_4_11I1R2Value CA1_4_11I1R2MassTerm_sound CA1_4_11I1R2Entropy_sound) (by decide +kernel) +def CA1_4_11I1R3Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 4 11)) (fun u => (stageALaw (shape 1 4 11) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 3 a +def CA1_4_11I1R3Raw (a : PairSlot) : Ball := residualBall (below (shape 1 4 11)) A1_4_11Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 3 a +lemma CA1_4_11I1R3Raw_sound (a : PairSlot) : + (CA1_4_11I1R3Raw a).Encloses (CA1_4_11I1R3Value a) := by + exact residualBall_sound_on (below (shape 1 4 11)) A1_4_11Law (fun u => (stageALaw (shape 1 4 11) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A1_4_11Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 4 11) (show (shape 1 4 11) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 3 a +def CA1_4_11I1R3Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(137888861593042178984912356271 / 25000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ ⟨(2868189307593617450192719616833 / 100000000000000000000000000000000), (1051167699 / 100000000000000000000000000000000)⟩ ⟨(-520018309393734457926281583611911 / 100000000000000000000000000000000), (19058241369 / 10000000000000000000000000000000)⟩ ⟨-8, 137888861593042178984912356271, 97656250000000000000000000000⟩, + .log ⟨(4904076801820583064126827285721 / 50000000000000000000000000000000), (41 / 100000000000000000000000000000000)⟩ ⟨(22774102539518115754746011166397 / 100000000000000000000000000000000), (2076957341 / 20000000000000000000000000000000)⟩ ⟨(-232195614586046936348432266750089 / 100000000000000000000000000000000), (105879118833 / 100000000000000000000000000000000)⟩ ⟨-4, 4904076801820583064126827285721, 3125000000000000000000000000000⟩, + .log ⟨(482992777307967784909064602021 / 50000000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ ⟨(4481957157449281667465669218783 / 100000000000000000000000000000000), (818221603 / 50000000000000000000000000000000)⟩ ⟨(-463977658468325110475718101747593 / 100000000000000000000000000000000), (169406589877 / 100000000000000000000000000000000)⟩ ⟨-7, 482992777307967784909064602021, 390625000000000000000000000000⟩] +lemma CA1_4_11I1R3Certificates_valid : + CA1_4_11I1R3Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_4_11I1R3CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 4, 0 => 1 + | 2, 1 => 2 + | 3, 1 => 3 + | 1, 2 => 2 + | 1, 3 => 3 + | 0, 4 => 1 + | _, _ => 0 +def CA1_4_11I1R3P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_4_11I1R3Certificates (CA1_4_11I1R3CertificateIndex a)).input +lemma CA1_4_11I1R3P_check : ∀ a : PairSlot, contains (CA1_4_11I1R3Raw a) (CA1_4_11I1R3P a) = true := by + decide +kernel +lemma CA1_4_11I1R3P_sound (a : PairSlot) : + (CA1_4_11I1R3P a).Encloses (CA1_4_11I1R3Value a) := + contains_sound (CA1_4_11I1R3Raw_sound a) (CA1_4_11I1R3P_check a) +def CA1_4_11I1R3Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_4_11I1R3Certificates (CA1_4_11I1R3CertificateIndex a)).output +lemma CA1_4_11I1R3Terms_sound (a : PairSlot) : + (CA1_4_11I1R3Terms a).Encloses (Foundation.entropyTerm (CA1_4_11I1R3Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_4_11I1R3Certificates_valid + (CA1_4_11I1R3CertificateIndex a) (CA1_4_11I1R3P_sound a) +def CA1_4_11I1R3Entropy : Ball := ⟨(30124249004561014872404400002013 / 50000000000000000000000000000000), (1307239761 / 5000000000000000000000000000000)⟩ +lemma CA1_4_11I1R3Entropy_sound : CA1_4_11I1R3Entropy.Encloses (Foundation.finiteEntropy CA1_4_11I1R3Value) := by + exact contains_sound (entropyPair_enclosed CA1_4_11I1R3Value CA1_4_11I1R3Terms CA1_4_11I1R3Terms_sound) (by decide +kernel) +def CA1_4_11I1R3Mass : Ball := ⟨(1415711825578658801751429150071 / 6250000000000000000000000000000), (3 / 3125000000000000000000000000000)⟩ +lemma CA1_4_11I1R3Mass_sound : CA1_4_11I1R3Mass.Encloses (∑ a, CA1_4_11I1R3Value a) := by + exact contains_sound (pairSumBall_sound CA1_4_11I1R3P CA1_4_11I1R3Value CA1_4_11I1R3P_sound) (by decide +kernel) +def CA1_4_11I1R3MassTermLogWitness : LogWitness := ⟨-3, 1415711825578658801751429150071, 781250000000000000000000000000⟩ +def CA1_4_11I1R3MassTermLog : Ball := ⟨(-148494900219778646294756194987429 / 100000000000000000000000000000000), (21175823789 / 25000000000000000000000000000000)⟩ +lemma CA1_4_11I1R3MassTermLog_sound : CA1_4_11I1R3MassTermLog.Encloses (Real.log ((∑ a, CA1_4_11I1R3Value a))) := by + exact checkLog_sound logTwoBall_sound (CA1_4_11I1R3Mass_sound) (w := CA1_4_11I1R3MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA1_4_11I1R3MassTerm : Ball := ⟨(3363615780468217751509662805569 / 10000000000000000000000000000000), (9593236601 / 50000000000000000000000000000000)⟩ +lemma CA1_4_11I1R3MassTerm_sound : CA1_4_11I1R3MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_4_11I1R3Value a))) := by + exact contains_sound (entropyTerm_ball (CA1_4_11I1R3Mass_sound) CA1_4_11I1R3MassTermLog_sound) (by decide +kernel) +def CA1_4_11I1R3H : Ball := ⟨(1663271262777490764357010746771 / 6250000000000000000000000000000), (22665634211 / 50000000000000000000000000000000)⟩ +lemma CA1_4_11I1R3H_sound : CA1_4_11I1R3H.Encloses (homogeneousEntropy CA1_4_11I1R3Value) := by + exact contains_sound (homogeneous_enclosed CA1_4_11I1R3Value CA1_4_11I1R3MassTerm_sound CA1_4_11I1R3Entropy_sound) (by decide +kernel) +def CA1_4_11I1R4Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 4 11)) (fun u => (stageALaw (shape 1 4 11) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 4 a +def CA1_4_11I1R4Raw (a : PairSlot) : Ball := residualBall (below (shape 1 4 11)) A1_4_11Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 4 a +lemma CA1_4_11I1R4Raw_sound (a : PairSlot) : + (CA1_4_11I1R4Raw a).Encloses (CA1_4_11I1R4Value a) := by + exact residualBall_sound_on (below (shape 1 4 11)) A1_4_11Law (fun u => (stageALaw (shape 1 4 11) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A1_4_11Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 4 11) (show (shape 1 4 11) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 4 a +def CA1_4_11I1R4Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(858584694521010948985622169 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(8633891199949041081299899313 / 20000000000000000000000000000000), (7272501 / 50000000000000000000000000000000)⟩ ⟨(-201119150039489921776711304601741 / 20000000000000000000000000000000), (338813202221 / 100000000000000000000000000000000)⟩ ⟨-15, 858584694521010948985622169, 610351562500000000000000000⟩, + .log ⟨(11664977189338182042318946841 / 4000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ ⟨(34046911231915542261283174941 / 2000000000000000000000000000000), (123507753 / 20000000000000000000000000000000)⟩ ⟨(-583745869010948486140178427050387 / 100000000000000000000000000000000), (42351647503 / 20000000000000000000000000000000)⟩ ⟨-9, 11664977189338182042318946841, 7812500000000000000000000000⟩, + .log ⟨(1432041275913219638258759429603 / 100000000000000000000000000000000), (1 / 10000000000000000000000000000000)⟩ ⟨(6080546489257217219713937617783 / 100000000000000000000000000000000), (1212986169 / 50000000000000000000000000000000)⟩ ⟨(-106151732347582358530726446483411 / 25000000000000000000000000000000), (84703295081 / 50000000000000000000000000000000)⟩ ⟨-7, 1432041275913219638258759429603, 781250000000000000000000000000⟩, + .log ⟨(72646759446330440509803789261 / 50000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ ⟨(18987449595068623982609898379 / 2000000000000000000000000000000), (338438109 / 100000000000000000000000000000000)⟩ ⟨(-130683390007891982652220310067249 / 20000000000000000000000000000000), (232934061889 / 100000000000000000000000000000000)⟩ ⟨-10, 72646759446330440509803789261, 48828125000000000000000000000⟩, + .log ⟨(15442796055875565115581455813 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(135522624707020123450557332547 / 100000000000000000000000000000000), (1144549 / 2500000000000000000000000000000)⟩ ⟨(-27424321390834174728384894737699 / 3125000000000000000000000000000), (296461538037 / 100000000000000000000000000000000)⟩ ⟨-13, 15442796055875565115581455813, 12207031250000000000000000000⟩] +lemma CA1_4_11I1R4Certificates_valid : + CA1_4_11I1R4Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_4_11I1R4CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 0, 5 => 1 + | 1, 4 => 2 + | 2, 2 => 3 + | 2, 3 => 4 + | 3, 2 => 4 + | 3, 3 => 5 + | 4, 1 => 2 + | 5, 0 => 1 + | _, _ => 0 +def CA1_4_11I1R4P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_4_11I1R4Certificates (CA1_4_11I1R4CertificateIndex a)).input +lemma CA1_4_11I1R4P_check : ∀ a : PairSlot, contains (CA1_4_11I1R4Raw a) (CA1_4_11I1R4P a) = true := by + decide +kernel +lemma CA1_4_11I1R4P_sound (a : PairSlot) : + (CA1_4_11I1R4P a).Encloses (CA1_4_11I1R4Value a) := + contains_sound (CA1_4_11I1R4Raw_sound a) (CA1_4_11I1R4P_check a) +def CA1_4_11I1R4Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_4_11I1R4Certificates (CA1_4_11I1R4CertificateIndex a)).output +lemma CA1_4_11I1R4Terms_sound (a : PairSlot) : + (CA1_4_11I1R4Terms a).Encloses (Foundation.entropyTerm (CA1_4_11I1R4Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_4_11I1R4Certificates_valid + (CA1_4_11I1R4CertificateIndex a) (CA1_4_11I1R4P_sound a) +def CA1_4_11I1R4Entropy : Ball := ⟨(580292205433107218918340063773 / 5000000000000000000000000000000), (88255961 / 2000000000000000000000000000000)⟩ +lemma CA1_4_11I1R4Entropy_sound : CA1_4_11I1R4Entropy.Encloses (Foundation.finiteEntropy CA1_4_11I1R4Value) := by + exact contains_sound (entropyPair_enclosed CA1_4_11I1R4Value CA1_4_11I1R4Terms CA1_4_11I1R4Terms_sound) (by decide +kernel) +def CA1_4_11I1R4Mass : Ball := ⟨(11649529080832680885096798031 / 500000000000000000000000000000), (21 / 100000000000000000000000000000000)⟩ +lemma CA1_4_11I1R4Mass_sound : CA1_4_11I1R4Mass.Encloses (∑ a, CA1_4_11I1R4Value a) := by + exact contains_sound (pairSumBall_sound CA1_4_11I1R4P CA1_4_11I1R4Value CA1_4_11I1R4P_sound) (by decide +kernel) +def CA1_4_11I1R4MassTermLogWitness : LogWitness := ⟨-6, 11649529080832680885096798031, 7812500000000000000000000000⟩ +def CA1_4_11I1R4MassTermLog : Ball := ⟨(-375934234147360499072534355300923 / 100000000000000000000000000000000), (74115383341 / 50000000000000000000000000000000)⟩ +lemma CA1_4_11I1R4MassTermLog_sound : CA1_4_11I1R4MassTermLog.Encloses (Real.log ((∑ a, CA1_4_11I1R4Value a))) := by + exact checkLog_sound logTwoBall_sound (CA1_4_11I1R4Mass_sound) (w := CA1_4_11I1R4MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA1_4_11I1R4MassTerm : Ball := ⟨(437945679318023839001681305581 / 5000000000000000000000000000000), (1726818667 / 50000000000000000000000000000000)⟩ +lemma CA1_4_11I1R4MassTerm_sound : CA1_4_11I1R4MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_4_11I1R4Value a))) := by + exact contains_sound (entropyTerm_ball (CA1_4_11I1R4Mass_sound) CA1_4_11I1R4MassTermLog_sound) (by decide +kernel) +def CA1_4_11I1R4H : Ball := ⟨(8896657882192711244791172387 / 312500000000000000000000000000), (983304423 / 12500000000000000000000000000000)⟩ +lemma CA1_4_11I1R4H_sound : CA1_4_11I1R4H.Encloses (homogeneousEntropy CA1_4_11I1R4Value) := by + exact contains_sound (homogeneous_enclosed CA1_4_11I1R4Value CA1_4_11I1R4MassTerm_sound CA1_4_11I1R4Entropy_sound) (by decide +kernel) +def CA1_4_11I1R5Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 4 11)) (fun u => (stageALaw (shape 1 4 11) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 5 a +def CA1_4_11I1R5Raw (a : PairSlot) : Ball := residualBall (below (shape 1 4 11)) A1_4_11Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 5 a +lemma CA1_4_11I1R5Raw_sound (a : PairSlot) : + (CA1_4_11I1R5Raw a).Encloses (CA1_4_11I1R5Value a) := by + exact residualBall_sound_on (below (shape 1 4 11)) A1_4_11Law (fun u => (stageALaw (shape 1 4 11) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A1_4_11Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 4 11) (show (shape 1 4 11) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 5 a +def CA1_4_11I1R5Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA1_4_11I1R5Certificates_valid : + CA1_4_11I1R5Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_4_11I1R5CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA1_4_11I1R5P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_4_11I1R5Certificates (CA1_4_11I1R5CertificateIndex a)).input +lemma CA1_4_11I1R5P_check : ∀ a : PairSlot, contains (CA1_4_11I1R5Raw a) (CA1_4_11I1R5P a) = true := by + decide +kernel +lemma CA1_4_11I1R5P_sound (a : PairSlot) : + (CA1_4_11I1R5P a).Encloses (CA1_4_11I1R5Value a) := + contains_sound (CA1_4_11I1R5Raw_sound a) (CA1_4_11I1R5P_check a) +def CA1_4_11I1R5Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_4_11I1R5Certificates (CA1_4_11I1R5CertificateIndex a)).output +lemma CA1_4_11I1R5Terms_sound (a : PairSlot) : + (CA1_4_11I1R5Terms a).Encloses (Foundation.entropyTerm (CA1_4_11I1R5Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_4_11I1R5Certificates_valid + (CA1_4_11I1R5CertificateIndex a) (CA1_4_11I1R5P_sound a) +def CA1_4_11I1R5Entropy : Ball := ⟨0, 0⟩ +lemma CA1_4_11I1R5Entropy_sound : CA1_4_11I1R5Entropy.Encloses (Foundation.finiteEntropy CA1_4_11I1R5Value) := by + exact contains_sound (entropyPair_enclosed CA1_4_11I1R5Value CA1_4_11I1R5Terms CA1_4_11I1R5Terms_sound) (by decide +kernel) +def CA1_4_11I1R5Mass : Ball := ⟨0, 0⟩ +lemma CA1_4_11I1R5Mass_sound : CA1_4_11I1R5Mass.Encloses (∑ a, CA1_4_11I1R5Value a) := by + exact contains_sound (pairSumBall_sound CA1_4_11I1R5P CA1_4_11I1R5Value CA1_4_11I1R5P_sound) (by decide +kernel) +def CA1_4_11I1R5MassTerm : Ball := .exact 0 +lemma CA1_4_11I1R5MassTerm_sound : CA1_4_11I1R5MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_4_11I1R5Value a))) := + entropyTerm_zero_ball (CA1_4_11I1R5Mass_sound) +def CA1_4_11I1R5H : Ball := ⟨0, 0⟩ +lemma CA1_4_11I1R5H_sound : CA1_4_11I1R5H.Encloses (homogeneousEntropy CA1_4_11I1R5Value) := by + exact contains_sound (homogeneous_enclosed CA1_4_11I1R5Value CA1_4_11I1R5MassTerm_sound CA1_4_11I1R5Entropy_sound) (by decide +kernel) +def CA1_4_11I1R6Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 4 11)) (fun u => (stageALaw (shape 1 4 11) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 6 a +def CA1_4_11I1R6Raw (a : PairSlot) : Ball := residualBall (below (shape 1 4 11)) A1_4_11Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 6 a +lemma CA1_4_11I1R6Raw_sound (a : PairSlot) : + (CA1_4_11I1R6Raw a).Encloses (CA1_4_11I1R6Value a) := by + exact residualBall_sound_on (below (shape 1 4 11)) A1_4_11Law (fun u => (stageALaw (shape 1 4 11) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A1_4_11Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 4 11) (show (shape 1 4 11) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 6 a +def CA1_4_11I1R6Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA1_4_11I1R6Certificates_valid : + CA1_4_11I1R6Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_4_11I1R6CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA1_4_11I1R6P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_4_11I1R6Certificates (CA1_4_11I1R6CertificateIndex a)).input +lemma CA1_4_11I1R6P_check : ∀ a : PairSlot, contains (CA1_4_11I1R6Raw a) (CA1_4_11I1R6P a) = true := by + decide +kernel +lemma CA1_4_11I1R6P_sound (a : PairSlot) : + (CA1_4_11I1R6P a).Encloses (CA1_4_11I1R6Value a) := + contains_sound (CA1_4_11I1R6Raw_sound a) (CA1_4_11I1R6P_check a) +def CA1_4_11I1R6Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_4_11I1R6Certificates (CA1_4_11I1R6CertificateIndex a)).output +lemma CA1_4_11I1R6Terms_sound (a : PairSlot) : + (CA1_4_11I1R6Terms a).Encloses (Foundation.entropyTerm (CA1_4_11I1R6Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_4_11I1R6Certificates_valid + (CA1_4_11I1R6CertificateIndex a) (CA1_4_11I1R6P_sound a) +def CA1_4_11I1R6Entropy : Ball := ⟨0, 0⟩ +lemma CA1_4_11I1R6Entropy_sound : CA1_4_11I1R6Entropy.Encloses (Foundation.finiteEntropy CA1_4_11I1R6Value) := by + exact contains_sound (entropyPair_enclosed CA1_4_11I1R6Value CA1_4_11I1R6Terms CA1_4_11I1R6Terms_sound) (by decide +kernel) +def CA1_4_11I1R6Mass : Ball := ⟨0, 0⟩ +lemma CA1_4_11I1R6Mass_sound : CA1_4_11I1R6Mass.Encloses (∑ a, CA1_4_11I1R6Value a) := by + exact contains_sound (pairSumBall_sound CA1_4_11I1R6P CA1_4_11I1R6Value CA1_4_11I1R6P_sound) (by decide +kernel) +def CA1_4_11I1R6MassTerm : Ball := .exact 0 +lemma CA1_4_11I1R6MassTerm_sound : CA1_4_11I1R6MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_4_11I1R6Value a))) := + entropyTerm_zero_ball (CA1_4_11I1R6Mass_sound) +def CA1_4_11I1R6H : Ball := ⟨0, 0⟩ +lemma CA1_4_11I1R6H_sound : CA1_4_11I1R6H.Encloses (homogeneousEntropy CA1_4_11I1R6Value) := by + exact contains_sound (homogeneous_enclosed CA1_4_11I1R6Value CA1_4_11I1R6MassTerm_sound CA1_4_11I1R6Entropy_sound) (by decide +kernel) +def CA1_4_11I1R7Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 4 11)) (fun u => (stageALaw (shape 1 4 11) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 7 a +def CA1_4_11I1R7Raw (a : PairSlot) : Ball := residualBall (below (shape 1 4 11)) A1_4_11Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 7 a +lemma CA1_4_11I1R7Raw_sound (a : PairSlot) : + (CA1_4_11I1R7Raw a).Encloses (CA1_4_11I1R7Value a) := by + exact residualBall_sound_on (below (shape 1 4 11)) A1_4_11Law (fun u => (stageALaw (shape 1 4 11) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A1_4_11Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 4 11) (show (shape 1 4 11) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 7 a +def CA1_4_11I1R7Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA1_4_11I1R7Certificates_valid : + CA1_4_11I1R7Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_4_11I1R7CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA1_4_11I1R7P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_4_11I1R7Certificates (CA1_4_11I1R7CertificateIndex a)).input +lemma CA1_4_11I1R7P_check : ∀ a : PairSlot, contains (CA1_4_11I1R7Raw a) (CA1_4_11I1R7P a) = true := by + decide +kernel +lemma CA1_4_11I1R7P_sound (a : PairSlot) : + (CA1_4_11I1R7P a).Encloses (CA1_4_11I1R7Value a) := + contains_sound (CA1_4_11I1R7Raw_sound a) (CA1_4_11I1R7P_check a) +def CA1_4_11I1R7Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_4_11I1R7Certificates (CA1_4_11I1R7CertificateIndex a)).output +lemma CA1_4_11I1R7Terms_sound (a : PairSlot) : + (CA1_4_11I1R7Terms a).Encloses (Foundation.entropyTerm (CA1_4_11I1R7Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_4_11I1R7Certificates_valid + (CA1_4_11I1R7CertificateIndex a) (CA1_4_11I1R7P_sound a) +def CA1_4_11I1R7Entropy : Ball := ⟨0, 0⟩ +lemma CA1_4_11I1R7Entropy_sound : CA1_4_11I1R7Entropy.Encloses (Foundation.finiteEntropy CA1_4_11I1R7Value) := by + exact contains_sound (entropyPair_enclosed CA1_4_11I1R7Value CA1_4_11I1R7Terms CA1_4_11I1R7Terms_sound) (by decide +kernel) +def CA1_4_11I1R7Mass : Ball := ⟨0, 0⟩ +lemma CA1_4_11I1R7Mass_sound : CA1_4_11I1R7Mass.Encloses (∑ a, CA1_4_11I1R7Value a) := by + exact contains_sound (pairSumBall_sound CA1_4_11I1R7P CA1_4_11I1R7Value CA1_4_11I1R7P_sound) (by decide +kernel) +def CA1_4_11I1R7MassTerm : Ball := .exact 0 +lemma CA1_4_11I1R7MassTerm_sound : CA1_4_11I1R7MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_4_11I1R7Value a))) := + entropyTerm_zero_ball (CA1_4_11I1R7Mass_sound) +def CA1_4_11I1R7H : Ball := ⟨0, 0⟩ +lemma CA1_4_11I1R7H_sound : CA1_4_11I1R7H.Encloses (homogeneousEntropy CA1_4_11I1R7Value) := by + exact contains_sound (homogeneous_enclosed CA1_4_11I1R7Value CA1_4_11I1R7MassTerm_sound CA1_4_11I1R7Entropy_sound) (by decide +kernel) +def CA1_4_11I1R8Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 4 11)) (fun u => (stageALaw (shape 1 4 11) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 8 a +def CA1_4_11I1R8Raw (a : PairSlot) : Ball := residualBall (below (shape 1 4 11)) A1_4_11Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 8 a +lemma CA1_4_11I1R8Raw_sound (a : PairSlot) : + (CA1_4_11I1R8Raw a).Encloses (CA1_4_11I1R8Value a) := by + exact residualBall_sound_on (below (shape 1 4 11)) A1_4_11Law (fun u => (stageALaw (shape 1 4 11) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A1_4_11Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 4 11) (show (shape 1 4 11) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 8 a +def CA1_4_11I1R8Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA1_4_11I1R8Certificates_valid : + CA1_4_11I1R8Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_4_11I1R8CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA1_4_11I1R8P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_4_11I1R8Certificates (CA1_4_11I1R8CertificateIndex a)).input +lemma CA1_4_11I1R8P_check : ∀ a : PairSlot, contains (CA1_4_11I1R8Raw a) (CA1_4_11I1R8P a) = true := by + decide +kernel +lemma CA1_4_11I1R8P_sound (a : PairSlot) : + (CA1_4_11I1R8P a).Encloses (CA1_4_11I1R8Value a) := + contains_sound (CA1_4_11I1R8Raw_sound a) (CA1_4_11I1R8P_check a) +def CA1_4_11I1R8Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_4_11I1R8Certificates (CA1_4_11I1R8CertificateIndex a)).output +lemma CA1_4_11I1R8Terms_sound (a : PairSlot) : + (CA1_4_11I1R8Terms a).Encloses (Foundation.entropyTerm (CA1_4_11I1R8Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_4_11I1R8Certificates_valid + (CA1_4_11I1R8CertificateIndex a) (CA1_4_11I1R8P_sound a) +def CA1_4_11I1R8Entropy : Ball := ⟨0, 0⟩ +lemma CA1_4_11I1R8Entropy_sound : CA1_4_11I1R8Entropy.Encloses (Foundation.finiteEntropy CA1_4_11I1R8Value) := by + exact contains_sound (entropyPair_enclosed CA1_4_11I1R8Value CA1_4_11I1R8Terms CA1_4_11I1R8Terms_sound) (by decide +kernel) +def CA1_4_11I1R8Mass : Ball := ⟨0, 0⟩ +lemma CA1_4_11I1R8Mass_sound : CA1_4_11I1R8Mass.Encloses (∑ a, CA1_4_11I1R8Value a) := by + exact contains_sound (pairSumBall_sound CA1_4_11I1R8P CA1_4_11I1R8Value CA1_4_11I1R8P_sound) (by decide +kernel) +def CA1_4_11I1R8MassTerm : Ball := .exact 0 +lemma CA1_4_11I1R8MassTerm_sound : CA1_4_11I1R8MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_4_11I1R8Value a))) := + entropyTerm_zero_ball (CA1_4_11I1R8Mass_sound) +def CA1_4_11I1R8H : Ball := ⟨0, 0⟩ +lemma CA1_4_11I1R8H_sound : CA1_4_11I1R8H.Encloses (homogeneousEntropy CA1_4_11I1R8Value) := by + exact contains_sound (homogeneous_enclosed CA1_4_11I1R8Value CA1_4_11I1R8MassTerm_sound CA1_4_11I1R8Entropy_sound) (by decide +kernel) +def CA1_4_11I1R9Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 4 11)) (fun u => (stageALaw (shape 1 4 11) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 9 a +def CA1_4_11I1R9Raw (a : PairSlot) : Ball := residualBall (below (shape 1 4 11)) A1_4_11Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 9 a +lemma CA1_4_11I1R9Raw_sound (a : PairSlot) : + (CA1_4_11I1R9Raw a).Encloses (CA1_4_11I1R9Value a) := by + exact residualBall_sound_on (below (shape 1 4 11)) A1_4_11Law (fun u => (stageALaw (shape 1 4 11) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A1_4_11Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 4 11) (show (shape 1 4 11) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 9 a +def CA1_4_11I1R9Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA1_4_11I1R9Certificates_valid : + CA1_4_11I1R9Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_4_11I1R9CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA1_4_11I1R9P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_4_11I1R9Certificates (CA1_4_11I1R9CertificateIndex a)).input +lemma CA1_4_11I1R9P_check : ∀ a : PairSlot, contains (CA1_4_11I1R9Raw a) (CA1_4_11I1R9P a) = true := by + decide +kernel +lemma CA1_4_11I1R9P_sound (a : PairSlot) : + (CA1_4_11I1R9P a).Encloses (CA1_4_11I1R9Value a) := + contains_sound (CA1_4_11I1R9Raw_sound a) (CA1_4_11I1R9P_check a) +def CA1_4_11I1R9Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_4_11I1R9Certificates (CA1_4_11I1R9CertificateIndex a)).output +lemma CA1_4_11I1R9Terms_sound (a : PairSlot) : + (CA1_4_11I1R9Terms a).Encloses (Foundation.entropyTerm (CA1_4_11I1R9Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_4_11I1R9Certificates_valid + (CA1_4_11I1R9CertificateIndex a) (CA1_4_11I1R9P_sound a) +def CA1_4_11I1R9Entropy : Ball := ⟨0, 0⟩ +lemma CA1_4_11I1R9Entropy_sound : CA1_4_11I1R9Entropy.Encloses (Foundation.finiteEntropy CA1_4_11I1R9Value) := by + exact contains_sound (entropyPair_enclosed CA1_4_11I1R9Value CA1_4_11I1R9Terms CA1_4_11I1R9Terms_sound) (by decide +kernel) +def CA1_4_11I1R9Mass : Ball := ⟨0, 0⟩ +lemma CA1_4_11I1R9Mass_sound : CA1_4_11I1R9Mass.Encloses (∑ a, CA1_4_11I1R9Value a) := by + exact contains_sound (pairSumBall_sound CA1_4_11I1R9P CA1_4_11I1R9Value CA1_4_11I1R9P_sound) (by decide +kernel) +def CA1_4_11I1R9MassTerm : Ball := .exact 0 +lemma CA1_4_11I1R9MassTerm_sound : CA1_4_11I1R9MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_4_11I1R9Value a))) := + entropyTerm_zero_ball (CA1_4_11I1R9Mass_sound) +def CA1_4_11I1R9H : Ball := ⟨0, 0⟩ +lemma CA1_4_11I1R9H_sound : CA1_4_11I1R9H.Encloses (homogeneousEntropy CA1_4_11I1R9Value) := by + exact contains_sound (homogeneous_enclosed CA1_4_11I1R9Value CA1_4_11I1R9MassTerm_sound CA1_4_11I1R9Entropy_sound) (by decide +kernel) +def CA1_4_11I1R10Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 4 11)) (fun u => (stageALaw (shape 1 4 11) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 10 a +def CA1_4_11I1R10Raw (a : PairSlot) : Ball := residualBall (below (shape 1 4 11)) A1_4_11Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 10 a +lemma CA1_4_11I1R10Raw_sound (a : PairSlot) : + (CA1_4_11I1R10Raw a).Encloses (CA1_4_11I1R10Value a) := by + exact residualBall_sound_on (below (shape 1 4 11)) A1_4_11Law (fun u => (stageALaw (shape 1 4 11) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A1_4_11Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 4 11) (show (shape 1 4 11) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 10 a +def CA1_4_11I1R10Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA1_4_11I1R10Certificates_valid : + CA1_4_11I1R10Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_4_11I1R10CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA1_4_11I1R10P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_4_11I1R10Certificates (CA1_4_11I1R10CertificateIndex a)).input +lemma CA1_4_11I1R10P_check : ∀ a : PairSlot, contains (CA1_4_11I1R10Raw a) (CA1_4_11I1R10P a) = true := by + decide +kernel +lemma CA1_4_11I1R10P_sound (a : PairSlot) : + (CA1_4_11I1R10P a).Encloses (CA1_4_11I1R10Value a) := + contains_sound (CA1_4_11I1R10Raw_sound a) (CA1_4_11I1R10P_check a) +def CA1_4_11I1R10Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_4_11I1R10Certificates (CA1_4_11I1R10CertificateIndex a)).output +lemma CA1_4_11I1R10Terms_sound (a : PairSlot) : + (CA1_4_11I1R10Terms a).Encloses (Foundation.entropyTerm (CA1_4_11I1R10Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_4_11I1R10Certificates_valid + (CA1_4_11I1R10CertificateIndex a) (CA1_4_11I1R10P_sound a) +def CA1_4_11I1R10Entropy : Ball := ⟨0, 0⟩ +lemma CA1_4_11I1R10Entropy_sound : CA1_4_11I1R10Entropy.Encloses (Foundation.finiteEntropy CA1_4_11I1R10Value) := by + exact contains_sound (entropyPair_enclosed CA1_4_11I1R10Value CA1_4_11I1R10Terms CA1_4_11I1R10Terms_sound) (by decide +kernel) +def CA1_4_11I1R10Mass : Ball := ⟨0, 0⟩ +lemma CA1_4_11I1R10Mass_sound : CA1_4_11I1R10Mass.Encloses (∑ a, CA1_4_11I1R10Value a) := by + exact contains_sound (pairSumBall_sound CA1_4_11I1R10P CA1_4_11I1R10Value CA1_4_11I1R10P_sound) (by decide +kernel) +def CA1_4_11I1R10MassTerm : Ball := .exact 0 +lemma CA1_4_11I1R10MassTerm_sound : CA1_4_11I1R10MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_4_11I1R10Value a))) := + entropyTerm_zero_ball (CA1_4_11I1R10Mass_sound) +def CA1_4_11I1R10H : Ball := ⟨0, 0⟩ +lemma CA1_4_11I1R10H_sound : CA1_4_11I1R10H.Encloses (homogeneousEntropy CA1_4_11I1R10Value) := by + exact contains_sound (homogeneous_enclosed CA1_4_11I1R10Value CA1_4_11I1R10MassTerm_sound CA1_4_11I1R10Entropy_sound) (by decide +kernel) +def CA1_4_11I1R11Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 4 11)) (fun u => (stageALaw (shape 1 4 11) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 11 a +def CA1_4_11I1R11Raw (a : PairSlot) : Ball := residualBall (below (shape 1 4 11)) A1_4_11Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 11 a +lemma CA1_4_11I1R11Raw_sound (a : PairSlot) : + (CA1_4_11I1R11Raw a).Encloses (CA1_4_11I1R11Value a) := by + exact residualBall_sound_on (below (shape 1 4 11)) A1_4_11Law (fun u => (stageALaw (shape 1 4 11) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A1_4_11Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 4 11) (show (shape 1 4 11) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 11 a +def CA1_4_11I1R11Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA1_4_11I1R11Certificates_valid : + CA1_4_11I1R11Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_4_11I1R11CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA1_4_11I1R11P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_4_11I1R11Certificates (CA1_4_11I1R11CertificateIndex a)).input +lemma CA1_4_11I1R11P_check : ∀ a : PairSlot, contains (CA1_4_11I1R11Raw a) (CA1_4_11I1R11P a) = true := by + decide +kernel +lemma CA1_4_11I1R11P_sound (a : PairSlot) : + (CA1_4_11I1R11P a).Encloses (CA1_4_11I1R11Value a) := + contains_sound (CA1_4_11I1R11Raw_sound a) (CA1_4_11I1R11P_check a) +def CA1_4_11I1R11Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_4_11I1R11Certificates (CA1_4_11I1R11CertificateIndex a)).output +lemma CA1_4_11I1R11Terms_sound (a : PairSlot) : + (CA1_4_11I1R11Terms a).Encloses (Foundation.entropyTerm (CA1_4_11I1R11Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_4_11I1R11Certificates_valid + (CA1_4_11I1R11CertificateIndex a) (CA1_4_11I1R11P_sound a) +def CA1_4_11I1R11Entropy : Ball := ⟨0, 0⟩ +lemma CA1_4_11I1R11Entropy_sound : CA1_4_11I1R11Entropy.Encloses (Foundation.finiteEntropy CA1_4_11I1R11Value) := by + exact contains_sound (entropyPair_enclosed CA1_4_11I1R11Value CA1_4_11I1R11Terms CA1_4_11I1R11Terms_sound) (by decide +kernel) +def CA1_4_11I1R11Mass : Ball := ⟨0, 0⟩ +lemma CA1_4_11I1R11Mass_sound : CA1_4_11I1R11Mass.Encloses (∑ a, CA1_4_11I1R11Value a) := by + exact contains_sound (pairSumBall_sound CA1_4_11I1R11P CA1_4_11I1R11Value CA1_4_11I1R11P_sound) (by decide +kernel) +def CA1_4_11I1R11MassTerm : Ball := .exact 0 +lemma CA1_4_11I1R11MassTerm_sound : CA1_4_11I1R11MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_4_11I1R11Value a))) := + entropyTerm_zero_ball (CA1_4_11I1R11Mass_sound) +def CA1_4_11I1R11H : Ball := ⟨0, 0⟩ +lemma CA1_4_11I1R11H_sound : CA1_4_11I1R11H.Encloses (homogeneousEntropy CA1_4_11I1R11Value) := by + exact contains_sound (homogeneous_enclosed CA1_4_11I1R11Value CA1_4_11I1R11MassTerm_sound CA1_4_11I1R11Entropy_sound) (by decide +kernel) +def CA1_4_11I1R12Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 4 11)) (fun u => (stageALaw (shape 1 4 11) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 12 a +def CA1_4_11I1R12Raw (a : PairSlot) : Ball := residualBall (below (shape 1 4 11)) A1_4_11Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 12 a +lemma CA1_4_11I1R12Raw_sound (a : PairSlot) : + (CA1_4_11I1R12Raw a).Encloses (CA1_4_11I1R12Value a) := by + exact residualBall_sound_on (below (shape 1 4 11)) A1_4_11Law (fun u => (stageALaw (shape 1 4 11) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A1_4_11Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 4 11) (show (shape 1 4 11) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 12 a +def CA1_4_11I1R12Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA1_4_11I1R12Certificates_valid : + CA1_4_11I1R12Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_4_11I1R12CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA1_4_11I1R12P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_4_11I1R12Certificates (CA1_4_11I1R12CertificateIndex a)).input +lemma CA1_4_11I1R12P_check : ∀ a : PairSlot, contains (CA1_4_11I1R12Raw a) (CA1_4_11I1R12P a) = true := by + decide +kernel +lemma CA1_4_11I1R12P_sound (a : PairSlot) : + (CA1_4_11I1R12P a).Encloses (CA1_4_11I1R12Value a) := + contains_sound (CA1_4_11I1R12Raw_sound a) (CA1_4_11I1R12P_check a) +def CA1_4_11I1R12Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_4_11I1R12Certificates (CA1_4_11I1R12CertificateIndex a)).output +lemma CA1_4_11I1R12Terms_sound (a : PairSlot) : + (CA1_4_11I1R12Terms a).Encloses (Foundation.entropyTerm (CA1_4_11I1R12Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_4_11I1R12Certificates_valid + (CA1_4_11I1R12CertificateIndex a) (CA1_4_11I1R12P_sound a) +def CA1_4_11I1R12Entropy : Ball := ⟨0, 0⟩ +lemma CA1_4_11I1R12Entropy_sound : CA1_4_11I1R12Entropy.Encloses (Foundation.finiteEntropy CA1_4_11I1R12Value) := by + exact contains_sound (entropyPair_enclosed CA1_4_11I1R12Value CA1_4_11I1R12Terms CA1_4_11I1R12Terms_sound) (by decide +kernel) +def CA1_4_11I1R12Mass : Ball := ⟨0, 0⟩ +lemma CA1_4_11I1R12Mass_sound : CA1_4_11I1R12Mass.Encloses (∑ a, CA1_4_11I1R12Value a) := by + exact contains_sound (pairSumBall_sound CA1_4_11I1R12P CA1_4_11I1R12Value CA1_4_11I1R12P_sound) (by decide +kernel) +def CA1_4_11I1R12MassTerm : Ball := .exact 0 +lemma CA1_4_11I1R12MassTerm_sound : CA1_4_11I1R12MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_4_11I1R12Value a))) := + entropyTerm_zero_ball (CA1_4_11I1R12Mass_sound) +def CA1_4_11I1R12H : Ball := ⟨0, 0⟩ +lemma CA1_4_11I1R12H_sound : CA1_4_11I1R12H.Encloses (homogeneousEntropy CA1_4_11I1R12Value) := by + exact contains_sound (homogeneous_enclosed CA1_4_11I1R12Value CA1_4_11I1R12MassTerm_sound CA1_4_11I1R12Entropy_sound) (by decide +kernel) +def CA1_4_11I1R13Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 4 11)) (fun u => (stageALaw (shape 1 4 11) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 13 a +def CA1_4_11I1R13Raw (a : PairSlot) : Ball := residualBall (below (shape 1 4 11)) A1_4_11Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 13 a +lemma CA1_4_11I1R13Raw_sound (a : PairSlot) : + (CA1_4_11I1R13Raw a).Encloses (CA1_4_11I1R13Value a) := by + exact residualBall_sound_on (below (shape 1 4 11)) A1_4_11Law (fun u => (stageALaw (shape 1 4 11) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A1_4_11Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 4 11) (show (shape 1 4 11) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 13 a +def CA1_4_11I1R13Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA1_4_11I1R13Certificates_valid : + CA1_4_11I1R13Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_4_11I1R13CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA1_4_11I1R13P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_4_11I1R13Certificates (CA1_4_11I1R13CertificateIndex a)).input +lemma CA1_4_11I1R13P_check : ∀ a : PairSlot, contains (CA1_4_11I1R13Raw a) (CA1_4_11I1R13P a) = true := by + decide +kernel +lemma CA1_4_11I1R13P_sound (a : PairSlot) : + (CA1_4_11I1R13P a).Encloses (CA1_4_11I1R13Value a) := + contains_sound (CA1_4_11I1R13Raw_sound a) (CA1_4_11I1R13P_check a) +def CA1_4_11I1R13Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_4_11I1R13Certificates (CA1_4_11I1R13CertificateIndex a)).output +lemma CA1_4_11I1R13Terms_sound (a : PairSlot) : + (CA1_4_11I1R13Terms a).Encloses (Foundation.entropyTerm (CA1_4_11I1R13Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_4_11I1R13Certificates_valid + (CA1_4_11I1R13CertificateIndex a) (CA1_4_11I1R13P_sound a) +def CA1_4_11I1R13Entropy : Ball := ⟨0, 0⟩ +lemma CA1_4_11I1R13Entropy_sound : CA1_4_11I1R13Entropy.Encloses (Foundation.finiteEntropy CA1_4_11I1R13Value) := by + exact contains_sound (entropyPair_enclosed CA1_4_11I1R13Value CA1_4_11I1R13Terms CA1_4_11I1R13Terms_sound) (by decide +kernel) +def CA1_4_11I1R13Mass : Ball := ⟨0, 0⟩ +lemma CA1_4_11I1R13Mass_sound : CA1_4_11I1R13Mass.Encloses (∑ a, CA1_4_11I1R13Value a) := by + exact contains_sound (pairSumBall_sound CA1_4_11I1R13P CA1_4_11I1R13Value CA1_4_11I1R13P_sound) (by decide +kernel) +def CA1_4_11I1R13MassTerm : Ball := .exact 0 +lemma CA1_4_11I1R13MassTerm_sound : CA1_4_11I1R13MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_4_11I1R13Value a))) := + entropyTerm_zero_ball (CA1_4_11I1R13Mass_sound) +def CA1_4_11I1R13H : Ball := ⟨0, 0⟩ +lemma CA1_4_11I1R13H_sound : CA1_4_11I1R13H.Encloses (homogeneousEntropy CA1_4_11I1R13Value) := by + exact contains_sound (homogeneous_enclosed CA1_4_11I1R13Value CA1_4_11I1R13MassTerm_sound CA1_4_11I1R13Entropy_sound) (by decide +kernel) +def CA1_4_11I1R14Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 4 11)) (fun u => (stageALaw (shape 1 4 11) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 14 a +def CA1_4_11I1R14Raw (a : PairSlot) : Ball := residualBall (below (shape 1 4 11)) A1_4_11Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 14 a +lemma CA1_4_11I1R14Raw_sound (a : PairSlot) : + (CA1_4_11I1R14Raw a).Encloses (CA1_4_11I1R14Value a) := by + exact residualBall_sound_on (below (shape 1 4 11)) A1_4_11Law (fun u => (stageALaw (shape 1 4 11) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A1_4_11Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 4 11) (show (shape 1 4 11) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 14 a +def CA1_4_11I1R14Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA1_4_11I1R14Certificates_valid : + CA1_4_11I1R14Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_4_11I1R14CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA1_4_11I1R14P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_4_11I1R14Certificates (CA1_4_11I1R14CertificateIndex a)).input +lemma CA1_4_11I1R14P_check : ∀ a : PairSlot, contains (CA1_4_11I1R14Raw a) (CA1_4_11I1R14P a) = true := by + decide +kernel +lemma CA1_4_11I1R14P_sound (a : PairSlot) : + (CA1_4_11I1R14P a).Encloses (CA1_4_11I1R14Value a) := + contains_sound (CA1_4_11I1R14Raw_sound a) (CA1_4_11I1R14P_check a) +def CA1_4_11I1R14Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_4_11I1R14Certificates (CA1_4_11I1R14CertificateIndex a)).output +lemma CA1_4_11I1R14Terms_sound (a : PairSlot) : + (CA1_4_11I1R14Terms a).Encloses (Foundation.entropyTerm (CA1_4_11I1R14Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_4_11I1R14Certificates_valid + (CA1_4_11I1R14CertificateIndex a) (CA1_4_11I1R14P_sound a) +def CA1_4_11I1R14Entropy : Ball := ⟨0, 0⟩ +lemma CA1_4_11I1R14Entropy_sound : CA1_4_11I1R14Entropy.Encloses (Foundation.finiteEntropy CA1_4_11I1R14Value) := by + exact contains_sound (entropyPair_enclosed CA1_4_11I1R14Value CA1_4_11I1R14Terms CA1_4_11I1R14Terms_sound) (by decide +kernel) +def CA1_4_11I1R14Mass : Ball := ⟨0, 0⟩ +lemma CA1_4_11I1R14Mass_sound : CA1_4_11I1R14Mass.Encloses (∑ a, CA1_4_11I1R14Value a) := by + exact contains_sound (pairSumBall_sound CA1_4_11I1R14P CA1_4_11I1R14Value CA1_4_11I1R14P_sound) (by decide +kernel) +def CA1_4_11I1R14MassTerm : Ball := .exact 0 +lemma CA1_4_11I1R14MassTerm_sound : CA1_4_11I1R14MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_4_11I1R14Value a))) := + entropyTerm_zero_ball (CA1_4_11I1R14Mass_sound) +def CA1_4_11I1R14H : Ball := ⟨0, 0⟩ +lemma CA1_4_11I1R14H_sound : CA1_4_11I1R14H.Encloses (homogeneousEntropy CA1_4_11I1R14Value) := by + exact contains_sound (homogeneous_enclosed CA1_4_11I1R14Value CA1_4_11I1R14MassTerm_sound CA1_4_11I1R14Entropy_sound) (by decide +kernel) +def CA1_4_11I1R15Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 4 11)) (fun u => (stageALaw (shape 1 4 11) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 15 a +def CA1_4_11I1R15Raw (a : PairSlot) : Ball := residualBall (below (shape 1 4 11)) A1_4_11Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 15 a +lemma CA1_4_11I1R15Raw_sound (a : PairSlot) : + (CA1_4_11I1R15Raw a).Encloses (CA1_4_11I1R15Value a) := by + exact residualBall_sound_on (below (shape 1 4 11)) A1_4_11Law (fun u => (stageALaw (shape 1 4 11) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A1_4_11Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 4 11) (show (shape 1 4 11) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 15 a +def CA1_4_11I1R15Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA1_4_11I1R15Certificates_valid : + CA1_4_11I1R15Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_4_11I1R15CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA1_4_11I1R15P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_4_11I1R15Certificates (CA1_4_11I1R15CertificateIndex a)).input +lemma CA1_4_11I1R15P_check : ∀ a : PairSlot, contains (CA1_4_11I1R15Raw a) (CA1_4_11I1R15P a) = true := by + decide +kernel +lemma CA1_4_11I1R15P_sound (a : PairSlot) : + (CA1_4_11I1R15P a).Encloses (CA1_4_11I1R15Value a) := + contains_sound (CA1_4_11I1R15Raw_sound a) (CA1_4_11I1R15P_check a) +def CA1_4_11I1R15Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_4_11I1R15Certificates (CA1_4_11I1R15CertificateIndex a)).output +lemma CA1_4_11I1R15Terms_sound (a : PairSlot) : + (CA1_4_11I1R15Terms a).Encloses (Foundation.entropyTerm (CA1_4_11I1R15Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_4_11I1R15Certificates_valid + (CA1_4_11I1R15CertificateIndex a) (CA1_4_11I1R15P_sound a) +def CA1_4_11I1R15Entropy : Ball := ⟨0, 0⟩ +lemma CA1_4_11I1R15Entropy_sound : CA1_4_11I1R15Entropy.Encloses (Foundation.finiteEntropy CA1_4_11I1R15Value) := by + exact contains_sound (entropyPair_enclosed CA1_4_11I1R15Value CA1_4_11I1R15Terms CA1_4_11I1R15Terms_sound) (by decide +kernel) +def CA1_4_11I1R15Mass : Ball := ⟨0, 0⟩ +lemma CA1_4_11I1R15Mass_sound : CA1_4_11I1R15Mass.Encloses (∑ a, CA1_4_11I1R15Value a) := by + exact contains_sound (pairSumBall_sound CA1_4_11I1R15P CA1_4_11I1R15Value CA1_4_11I1R15P_sound) (by decide +kernel) +def CA1_4_11I1R15MassTerm : Ball := .exact 0 +lemma CA1_4_11I1R15MassTerm_sound : CA1_4_11I1R15MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_4_11I1R15Value a))) := + entropyTerm_zero_ball (CA1_4_11I1R15Mass_sound) +def CA1_4_11I1R15H : Ball := ⟨0, 0⟩ +lemma CA1_4_11I1R15H_sound : CA1_4_11I1R15H.Encloses (homogeneousEntropy CA1_4_11I1R15Value) := by + exact contains_sound (homogeneous_enclosed CA1_4_11I1R15Value CA1_4_11I1R15MassTerm_sound CA1_4_11I1R15Entropy_sound) (by decide +kernel) +def CA1_4_11I1R16Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 4 11)) (fun u => (stageALaw (shape 1 4 11) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 16 a +def CA1_4_11I1R16Raw (a : PairSlot) : Ball := residualBall (below (shape 1 4 11)) A1_4_11Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 16 a +lemma CA1_4_11I1R16Raw_sound (a : PairSlot) : + (CA1_4_11I1R16Raw a).Encloses (CA1_4_11I1R16Value a) := by + exact residualBall_sound_on (below (shape 1 4 11)) A1_4_11Law (fun u => (stageALaw (shape 1 4 11) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A1_4_11Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 4 11) (show (shape 1 4 11) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 16 a +def CA1_4_11I1R16Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA1_4_11I1R16Certificates_valid : + CA1_4_11I1R16Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_4_11I1R16CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA1_4_11I1R16P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_4_11I1R16Certificates (CA1_4_11I1R16CertificateIndex a)).input +lemma CA1_4_11I1R16P_check : ∀ a : PairSlot, contains (CA1_4_11I1R16Raw a) (CA1_4_11I1R16P a) = true := by + decide +kernel +lemma CA1_4_11I1R16P_sound (a : PairSlot) : + (CA1_4_11I1R16P a).Encloses (CA1_4_11I1R16Value a) := + contains_sound (CA1_4_11I1R16Raw_sound a) (CA1_4_11I1R16P_check a) +def CA1_4_11I1R16Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_4_11I1R16Certificates (CA1_4_11I1R16CertificateIndex a)).output +lemma CA1_4_11I1R16Terms_sound (a : PairSlot) : + (CA1_4_11I1R16Terms a).Encloses (Foundation.entropyTerm (CA1_4_11I1R16Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_4_11I1R16Certificates_valid + (CA1_4_11I1R16CertificateIndex a) (CA1_4_11I1R16P_sound a) +def CA1_4_11I1R16Entropy : Ball := ⟨0, 0⟩ +lemma CA1_4_11I1R16Entropy_sound : CA1_4_11I1R16Entropy.Encloses (Foundation.finiteEntropy CA1_4_11I1R16Value) := by + exact contains_sound (entropyPair_enclosed CA1_4_11I1R16Value CA1_4_11I1R16Terms CA1_4_11I1R16Terms_sound) (by decide +kernel) +def CA1_4_11I1R16Mass : Ball := ⟨0, 0⟩ +lemma CA1_4_11I1R16Mass_sound : CA1_4_11I1R16Mass.Encloses (∑ a, CA1_4_11I1R16Value a) := by + exact contains_sound (pairSumBall_sound CA1_4_11I1R16P CA1_4_11I1R16Value CA1_4_11I1R16P_sound) (by decide +kernel) +def CA1_4_11I1R16MassTerm : Ball := .exact 0 +lemma CA1_4_11I1R16MassTerm_sound : CA1_4_11I1R16MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_4_11I1R16Value a))) := + entropyTerm_zero_ball (CA1_4_11I1R16Mass_sound) +def CA1_4_11I1R16H : Ball := ⟨0, 0⟩ +lemma CA1_4_11I1R16H_sound : CA1_4_11I1R16H.Encloses (homogeneousEntropy CA1_4_11I1R16Value) := by + exact contains_sound (homogeneous_enclosed CA1_4_11I1R16Value CA1_4_11I1R16MassTerm_sound CA1_4_11I1R16Entropy_sound) (by decide +kernel) +def CA1_4_11I1ResidualEntropies (a : Fin 17) : Ball := + match a.val with + | 0 => CA1_4_11I1R0H + | 1 => CA1_4_11I1R1H + | 2 => CA1_4_11I1R2H + | 3 => CA1_4_11I1R3H + | 4 => CA1_4_11I1R4H + | 5 => CA1_4_11I1R5H + | 6 => CA1_4_11I1R6H + | 7 => CA1_4_11I1R7H + | 8 => CA1_4_11I1R8H + | 9 => CA1_4_11I1R9H + | 10 => CA1_4_11I1R10H + | 11 => CA1_4_11I1R11H + | 12 => CA1_4_11I1R12H + | 13 => CA1_4_11I1R13H + | 14 => CA1_4_11I1R14H + | 15 => CA1_4_11I1R15H + | 16 => CA1_4_11I1R16H + | _ => (.exact 0) +lemma CA1_4_11I1ResidualEntropies_sound (k : Fin 17) : + (CA1_4_11I1ResidualEntropies k).Encloses (homogeneousEntropy + (residualLaw (below (shape 1 4 11)) (fun u => (stageALaw (shape 1 4 11) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) k)) := by + fin_cases k + · exact CA1_4_11I1R0H_sound + · exact CA1_4_11I1R1H_sound + · exact CA1_4_11I1R2H_sound + · exact CA1_4_11I1R3H_sound + · exact CA1_4_11I1R4H_sound + · exact CA1_4_11I1R5H_sound + · exact CA1_4_11I1R6H_sound + · exact CA1_4_11I1R7H_sound + · exact CA1_4_11I1R8H_sound + · exact CA1_4_11I1R9H_sound + · exact CA1_4_11I1R10H_sound + · exact CA1_4_11I1R11H_sound + · exact CA1_4_11I1R12H_sound + · exact CA1_4_11I1R13H_sound + · exact CA1_4_11I1R14H_sound + · exact CA1_4_11I1R15H_sound + · exact CA1_4_11I1R16H_sound +def CA1_4_11I1Singles (s : Shape) : Ball := + match s 0, s 1, s 2 with + | _, _, _ => (.exact 0) +lemma CA1_4_11I1Singles_sound (u : Shape) (hu : u ∈ below (shape 1 4 11)) + (hd : designated (Equiv.refl (Fin 3)) 1 u) : + (CA1_4_11I1Singles u).Encloses (homogeneousEntropy ((fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) u)) := by + rw [A1_4_11_below] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 0 0 8) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 0 1 7) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 0 2 6) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 0 3 5) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 0 4 4) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 1 0 7) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 1 1 6) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 1 2 5) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 1 3 4) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 1 4 3) by decide +kernel) hd |>.elim +def CA1_4_11I1Singleton : Ball := ⟨0, 0⟩ +lemma CA1_4_11I1Singleton_sound : CA1_4_11I1Singleton.Encloses + (singletonEntropy (below (shape 1 4 11)) (fun u => (stageALaw (shape 1 4 11) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ))) := by + exact contains_sound (singletonBall_sound (below (shape 1 4 11)) A1_4_11Law (fun u => (stageALaw (shape 1 4 11) u : ℝ)) (Equiv.refl (Fin 3)) 1 + CA1_4_11I1Singles (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A1_4_11Law_sound u) CA1_4_11I1Singles_sound) (by decide +kernel) +def CA1_4_11I1Group : Ball := ⟨(3060939233434843112480476301733 / 3125000000000000000000000000000), (165613008857 / 100000000000000000000000000000000)⟩ +lemma CA1_4_11I1Group_sound : CA1_4_11I1Group.Encloses + (groupedEntropy (below (shape 1 4 11)) (fun u => (stageALaw (shape 1 4 11) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ))) := by + exact contains_sound (Ball.add_sound CA1_4_11I1Singleton_sound + (finSumBall_sound 17 CA1_4_11I1ResidualEntropies _ CA1_4_11I1ResidualEntropies_sound)) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CA1_4_11I1H : Ball := ⟨(29858925884867968039673444479119 / 25000000000000000000000000000000), (241431188193 / 50000000000000000000000000000000)⟩ +lemma CA1_4_11I1_sound : CA1_4_11I1H.Encloses (stageACapacity (shape 1 4 11) 1) := by + have hb := contains_sound (Ball.add_sound CA1_4_11I1PairH_sound + (Ball.neg_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) CA1_4_11I1Group_sound))) + (show contains (.add CA1_4_11I1PairH (.neg (.mul (.exact 2) CA1_4_11I1Group))) CA1_4_11I1H = true by decide +kernel) + unfold CA1_4_11I1PairValue at hb + simpa only [stageACapacity, nativeCapacity, + show (1 : Fin 3) ≠ 0 by decide, ite_false, sub_eq_add_neg] using hb + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA1_4_11I2.lean b/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA1_4_11I2.lean new file mode 100644 index 0000000000000000000000000000000000000000..0d3800fb47e841ff1897cda8bd70a7575f83f754 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA1_4_11I2.lean @@ -0,0 +1,1081 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Certificates.SupportedContraction + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CA1_4_11I2PairValue (a : PairSlot × PairSlot) : ℝ := pairLaw (below (shape 1 4 11)) (shape 1 4 11) (fun u => (stageALaw (shape 1 4 11) u : ℝ)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) a +def CA1_4_11I2PairRaw (a : PairSlot × PairSlot) : Ball := stageAPairBall (shape 1 4 11) A1_4_11Law 2 a +lemma CA1_4_11I2PairRaw_sound (a : PairSlot × PairSlot) : + (CA1_4_11I2PairRaw a).Encloses (CA1_4_11I2PairValue a) := by + exact stageAPairBall_sound (shape 1 4 11) (by decide +kernel) A1_4_11Law (fun u => (stageALaw (shape 1 4 11) u : ℝ)) (fun u _ => A1_4_11Law_sound u) 2 a +def CA1_4_11I2PairCertificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(61436712352474830488612391 / 10000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(7372459591722180802103669681 / 100000000000000000000000000000000), (1235931 / 50000000000000000000000000000000)⟩ ⟨(-1200008807343871317001204918543989 / 100000000000000000000000000000000), (201170406373 / 50000000000000000000000000000000)⟩ ⟨-18, 61436712352474830488612391, 38146972656250000000000000⟩, + .log ⟨(20890993075933606986049075471 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(44255518130701293310819022579 / 25000000000000000000000000000000), (7741721 / 12500000000000000000000000000000)⟩ ⟨(-847360735219113820046267163931973 / 100000000000000000000000000000000), (74115384087 / 25000000000000000000000000000000)⟩ ⟨-13, 20890993075933606986049075471, 12207031250000000000000000000⟩, + .log ⟨(12647475172166827455070439 / 625000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(2187112567878730349464064949 / 10000000000000000000000000000000), (3557 / 48828125000000000000000000000)⟩ ⟨(-1080804932459902736691495491288357 / 100000000000000000000000000000000), (359989052027 / 100000000000000000000000000000000)⟩ ⟨-16, 12647475172166827455070439, 9536743164062500000000000⟩, + .log ⟨(247638212185665772009484323 / 10000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(26264822769214557249286875369 / 100000000000000000000000000000000), (2228679 / 25000000000000000000000000000000)⟩ ⟨(-530306339587095105926029728199953 / 50000000000000000000000000000000), (22499315187 / 6250000000000000000000000000000)⟩ ⟨-16, 247638212185665772009484323, 152587890625000000000000000⟩, + .log ⟨(69447984709920411412613034571 / 25000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ ⟨(51096815302679477193995154419 / 3125000000000000000000000000000), (294123663 / 50000000000000000000000000000000)⟩ ⟨(-588605305292672876755862321341519 / 100000000000000000000000000000000), (211758237549 / 100000000000000000000000000000000)⟩ ⟨-9, 69447984709920411412613034571, 48828125000000000000000000000⟩, + .log ⟨(530086454874906741118217258983 / 25000000000000000000000000000000), (1 / 10000000000000000000000000000000)⟩ ⟨(163418910837898166576723149541 / 2000000000000000000000000000000), (628600979 / 20000000000000000000000000000000)⟩ ⟨(-38535909882016987914182026336639 / 10000000000000000000000000000000), (37057691563 / 25000000000000000000000000000000)⟩ ⟨-6, 530086454874906741118217258983, 390625000000000000000000000000⟩, + .log ⟨(36353911613803057996403498157 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(475024151536006995650968084953 / 50000000000000000000000000000000), (169361289 / 50000000000000000000000000000000)⟩ ⟨(-653332929592708737962053091580513 / 100000000000000000000000000000000), (582335153 / 250000000000000000000000000000)⟩ ⟨-10, 36353911613803057996403498157, 24414062500000000000000000000⟩, + .log ⟨(246603819537866388940074677 / 3125000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(74550597575614554248039379723 / 100000000000000000000000000000000), (12532899 / 50000000000000000000000000000000)⟩ ⟨(-472358088087160571858308357214297 / 50000000000000000000000000000000), (79409341979 / 25000000000000000000000000000000)⟩ ⟨-14, 246603819537866388940074677, 190734863281250000000000000⟩, + .log ⟨(4104145260099889041045443621 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(19305449453087283873116811937 / 25000000000000000000000000000000), (814769 / 3125000000000000000000000000000)⟩ ⟨(-470389039120350646964104214669537 / 50000000000000000000000000000000), (317637367427 / 100000000000000000000000000000000)⟩ ⟨-14, 4104145260099889041045443621, 3051757812500000000000000000⟩, + .log ⟨(600828099618234061392902613529 / 25000000000000000000000000000000), (1 / 10000000000000000000000000000000)⟩ ⟨(8960323050853044634501556597273 / 100000000000000000000000000000000), (178122421 / 5000000000000000000000000000000)⟩ ⟨(-372832223415750294598111936759829 / 100000000000000000000000000000000), (148230766197 / 100000000000000000000000000000000)⟩ ⟨-6, 600828099618234061392902613529, 390625000000000000000000000000⟩, + .log ⟨(93456021197746811342512607853 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(26075854183003606395757775073 / 4000000000000000000000000000000), (59370249 / 25000000000000000000000000000000)⟩ ⟨(-348771725042584591538500912392203 / 50000000000000000000000000000000), (127054942633 / 50000000000000000000000000000000)⟩ ⟨-11, 93456021197746811342512607853, 48828125000000000000000000000⟩, + .log ⟨(284072886806370408119373327 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(3628022640385256911008687731 / 100000000000000000000000000000000), (120311 / 10000000000000000000000000000000)⟩ ⟨(-63857249475170566733952604570697 / 5000000000000000000000000000000), (211758412841 / 50000000000000000000000000000000)⟩ ⟨-19, 284072886806370408119373327, 190734863281250000000000000⟩, + .log ⟨(94239156817735785123068899863 / 50000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ ⟨(591251052228123992924326317639 / 50000000000000000000000000000000), (87806041 / 20000000000000000000000000000000)⟩ ⟨(-313697125586362789199873511438207 / 50000000000000000000000000000000), (116467030787 / 50000000000000000000000000000000)⟩ ⟨-10, 94239156817735785123068899863, 48828125000000000000000000000⟩, + .log ⟨(3477934774897537944856216767 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(8323862696055864315472366073 / 12500000000000000000000000000000), (5523613 / 25000000000000000000000000000000)⟩ ⟨(-239333490556938070483060085432873 / 25000000000000000000000000000000), (15881868481 / 5000000000000000000000000000000)⟩ ⟨-14, 3477934774897537944856216767, 3051757812500000000000000000⟩, + .log ⟨(503911615790262895556819127379 / 100000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ ⟨(2665956788363537793012590795623 / 100000000000000000000000000000000), (960366937 / 100000000000000000000000000000000)⟩ ⟨(-132263114444317408776508448138551 / 25000000000000000000000000000000), (95291206871 / 50000000000000000000000000000000)⟩ ⟨-8, 503911615790262895556819127379, 390625000000000000000000000000⟩, + .log ⟨(15037030684492895073999860934781 / 100000000000000000000000000000000), (13 / 25000000000000000000000000000000)⟩ ⟨(28489975068915472258197911036001 / 100000000000000000000000000000000), (12736860571 / 100000000000000000000000000000000)⟩ ⟨(-23683178935632614221075250605851 / 12500000000000000000000000000000), (84703295077 / 100000000000000000000000000000000)⟩ ⟨-3, 15037030684492895073999860934781, 12500000000000000000000000000000⟩, + .log ⟨(527266867202792760023966491371 / 50000000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ ⟨(960062586291216178629491724419 / 20000000000000000000000000000000), (1786449657 / 100000000000000000000000000000000)⟩ ⟨(-227603573733082047463521721259441 / 50000000000000000000000000000000), (169406589843 / 100000000000000000000000000000000)⟩ ⟨-7, 527266867202792760023966491371, 390625000000000000000000000000⟩] +lemma CA1_4_11I2PairCertificates_valid : + CA1_4_11I2PairCertificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_4_11I2PairCertificateIndex (a : PairSlot × PairSlot) : ℕ := + match a.1.1.val, a.1.2.val, a.2.1.val, a.2.2.val with + | 5, 5, 4, 0 => 1 + | 5, 5, 2, 1 => 2 + | 5, 5, 3, 1 => 3 + | 5, 5, 1, 2 => 2 + | 5, 5, 1, 3 => 3 + | 5, 5, 0, 4 => 1 + | 4, 5, 5, 0 => 4 + | 4, 5, 4, 1 => 5 + | 4, 5, 2, 2 => 6 + | 4, 5, 2, 3 => 7 + | 4, 5, 3, 2 => 7 + | 4, 5, 3, 3 => 8 + | 4, 5, 1, 4 => 5 + | 4, 5, 0, 5 => 4 + | 5, 4, 5, 0 => 4 + | 5, 4, 4, 1 => 5 + | 5, 4, 2, 2 => 6 + | 5, 4, 2, 3 => 7 + | 5, 4, 3, 2 => 7 + | 5, 4, 3, 3 => 8 + | 5, 4, 1, 4 => 5 + | 5, 4, 0, 5 => 4 + | 2, 5, 5, 1 => 9 + | 2, 5, 4, 2 => 10 + | 2, 5, 4, 3 => 11 + | 2, 5, 2, 4 => 10 + | 2, 5, 3, 4 => 11 + | 2, 5, 1, 5 => 9 + | 3, 5, 5, 1 => 12 + | 3, 5, 4, 2 => 13 + | 3, 5, 4, 3 => 14 + | 3, 5, 2, 4 => 13 + | 3, 5, 3, 4 => 14 + | 3, 5, 1, 5 => 12 + | 4, 4, 5, 1 => 15 + | 4, 4, 4, 2 => 16 + | 4, 4, 4, 3 => 17 + | 4, 4, 2, 4 => 16 + | 4, 4, 3, 4 => 17 + | 4, 4, 1, 5 => 15 + | 5, 2, 5, 1 => 9 + | 5, 2, 4, 2 => 10 + | 5, 2, 4, 3 => 11 + | 5, 2, 2, 4 => 10 + | 5, 2, 3, 4 => 11 + | 5, 2, 1, 5 => 9 + | 5, 3, 5, 1 => 12 + | 5, 3, 4, 2 => 13 + | 5, 3, 4, 3 => 14 + | 5, 3, 2, 4 => 13 + | 5, 3, 3, 4 => 14 + | 5, 3, 1, 5 => 12 + | 1, 5, 5, 2 => 9 + | 1, 5, 5, 3 => 12 + | 1, 5, 4, 4 => 15 + | 1, 5, 2, 5 => 9 + | 1, 5, 3, 5 => 12 + | 2, 4, 5, 2 => 10 + | 2, 4, 5, 3 => 13 + | 2, 4, 4, 4 => 16 + | 2, 4, 2, 5 => 10 + | 2, 4, 3, 5 => 13 + | 3, 4, 5, 2 => 11 + | 3, 4, 5, 3 => 14 + | 3, 4, 4, 4 => 17 + | 3, 4, 2, 5 => 11 + | 3, 4, 3, 5 => 14 + | 4, 2, 5, 2 => 10 + | 4, 2, 5, 3 => 13 + | 4, 2, 4, 4 => 16 + | 4, 2, 2, 5 => 10 + | 4, 2, 3, 5 => 13 + | 4, 3, 5, 2 => 11 + | 4, 3, 5, 3 => 14 + | 4, 3, 4, 4 => 17 + | 4, 3, 2, 5 => 11 + | 4, 3, 3, 5 => 14 + | 5, 1, 5, 2 => 9 + | 5, 1, 5, 3 => 12 + | 5, 1, 4, 4 => 15 + | 5, 1, 2, 5 => 9 + | 5, 1, 3, 5 => 12 + | 5, 0, 4, 5 => 4 + | 5, 0, 5, 4 => 4 + | 4, 1, 4, 5 => 5 + | 4, 1, 5, 4 => 5 + | 2, 2, 4, 5 => 6 + | 2, 2, 5, 4 => 6 + | 2, 3, 4, 5 => 7 + | 2, 3, 5, 4 => 7 + | 3, 2, 4, 5 => 7 + | 3, 2, 5, 4 => 7 + | 3, 3, 4, 5 => 8 + | 3, 3, 5, 4 => 8 + | 1, 4, 4, 5 => 5 + | 1, 4, 5, 4 => 5 + | 0, 5, 4, 5 => 4 + | 0, 5, 5, 4 => 4 + | 4, 0, 5, 5 => 1 + | 2, 1, 5, 5 => 2 + | 3, 1, 5, 5 => 3 + | 1, 2, 5, 5 => 2 + | 1, 3, 5, 5 => 3 + | 0, 4, 5, 5 => 1 + | _, _, _, _ => 0 +def CA1_4_11I2PairP (a : PairSlot × PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_4_11I2PairCertificates (CA1_4_11I2PairCertificateIndex a)).input +lemma CA1_4_11I2PairP_check_0_0 : ∀ k l : Fin 6, contains (CA1_4_11I2PairRaw ((0,0),(k,l))) (CA1_4_11I2PairP ((0,0),(k,l))) = true := by + decide +kernel +lemma CA1_4_11I2PairP_check_0_1 : ∀ k l : Fin 6, contains (CA1_4_11I2PairRaw ((0,1),(k,l))) (CA1_4_11I2PairP ((0,1),(k,l))) = true := by + decide +kernel +lemma CA1_4_11I2PairP_check_0_2 : ∀ k l : Fin 6, contains (CA1_4_11I2PairRaw ((0,2),(k,l))) (CA1_4_11I2PairP ((0,2),(k,l))) = true := by + decide +kernel +lemma CA1_4_11I2PairP_check_0_3 : ∀ k l : Fin 6, contains (CA1_4_11I2PairRaw ((0,3),(k,l))) (CA1_4_11I2PairP ((0,3),(k,l))) = true := by + decide +kernel +lemma CA1_4_11I2PairP_check_0_4 : ∀ k l : Fin 6, contains (CA1_4_11I2PairRaw ((0,4),(k,l))) (CA1_4_11I2PairP ((0,4),(k,l))) = true := by + decide +kernel +lemma CA1_4_11I2PairP_check_0_5 : ∀ k l : Fin 6, contains (CA1_4_11I2PairRaw ((0,5),(k,l))) (CA1_4_11I2PairP ((0,5),(k,l))) = true := by + decide +kernel +lemma CA1_4_11I2PairP_check_1_0 : ∀ k l : Fin 6, contains (CA1_4_11I2PairRaw ((1,0),(k,l))) (CA1_4_11I2PairP ((1,0),(k,l))) = true := by + decide +kernel +lemma CA1_4_11I2PairP_check_1_1 : ∀ k l : Fin 6, contains (CA1_4_11I2PairRaw ((1,1),(k,l))) (CA1_4_11I2PairP ((1,1),(k,l))) = true := by + decide +kernel +lemma CA1_4_11I2PairP_check_1_2 : ∀ k l : Fin 6, contains (CA1_4_11I2PairRaw ((1,2),(k,l))) (CA1_4_11I2PairP ((1,2),(k,l))) = true := by + decide +kernel +lemma CA1_4_11I2PairP_check_1_3 : ∀ k l : Fin 6, contains (CA1_4_11I2PairRaw ((1,3),(k,l))) (CA1_4_11I2PairP ((1,3),(k,l))) = true := by + decide +kernel +lemma CA1_4_11I2PairP_check_1_4 : ∀ k l : Fin 6, contains (CA1_4_11I2PairRaw ((1,4),(k,l))) (CA1_4_11I2PairP ((1,4),(k,l))) = true := by + decide +kernel +lemma CA1_4_11I2PairP_check_1_5 : ∀ k l : Fin 6, contains (CA1_4_11I2PairRaw ((1,5),(k,l))) (CA1_4_11I2PairP ((1,5),(k,l))) = true := by + decide +kernel +lemma CA1_4_11I2PairP_check_2_0 : ∀ k l : Fin 6, contains (CA1_4_11I2PairRaw ((2,0),(k,l))) (CA1_4_11I2PairP ((2,0),(k,l))) = true := by + decide +kernel +lemma CA1_4_11I2PairP_check_2_1 : ∀ k l : Fin 6, contains (CA1_4_11I2PairRaw ((2,1),(k,l))) (CA1_4_11I2PairP ((2,1),(k,l))) = true := by + decide +kernel +lemma CA1_4_11I2PairP_check_2_2 : ∀ k l : Fin 6, contains (CA1_4_11I2PairRaw ((2,2),(k,l))) (CA1_4_11I2PairP ((2,2),(k,l))) = true := by + decide +kernel +lemma CA1_4_11I2PairP_check_2_3 : ∀ k l : Fin 6, contains (CA1_4_11I2PairRaw ((2,3),(k,l))) (CA1_4_11I2PairP ((2,3),(k,l))) = true := by + decide +kernel +lemma CA1_4_11I2PairP_check_2_4 : ∀ k l : Fin 6, contains (CA1_4_11I2PairRaw ((2,4),(k,l))) (CA1_4_11I2PairP ((2,4),(k,l))) = true := by + decide +kernel +lemma CA1_4_11I2PairP_check_2_5 : ∀ k l : Fin 6, contains (CA1_4_11I2PairRaw ((2,5),(k,l))) (CA1_4_11I2PairP ((2,5),(k,l))) = true := by + decide +kernel +lemma CA1_4_11I2PairP_check_3_0 : ∀ k l : Fin 6, contains (CA1_4_11I2PairRaw ((3,0),(k,l))) (CA1_4_11I2PairP ((3,0),(k,l))) = true := by + decide +kernel +lemma CA1_4_11I2PairP_check_3_1 : ∀ k l : Fin 6, contains (CA1_4_11I2PairRaw ((3,1),(k,l))) (CA1_4_11I2PairP ((3,1),(k,l))) = true := by + decide +kernel +lemma CA1_4_11I2PairP_check_3_2 : ∀ k l : Fin 6, contains (CA1_4_11I2PairRaw ((3,2),(k,l))) (CA1_4_11I2PairP ((3,2),(k,l))) = true := by + decide +kernel +lemma CA1_4_11I2PairP_check_3_3 : ∀ k l : Fin 6, contains (CA1_4_11I2PairRaw ((3,3),(k,l))) (CA1_4_11I2PairP ((3,3),(k,l))) = true := by + decide +kernel +lemma CA1_4_11I2PairP_check_3_4 : ∀ k l : Fin 6, contains (CA1_4_11I2PairRaw ((3,4),(k,l))) (CA1_4_11I2PairP ((3,4),(k,l))) = true := by + decide +kernel +lemma CA1_4_11I2PairP_check_3_5 : ∀ k l : Fin 6, contains (CA1_4_11I2PairRaw ((3,5),(k,l))) (CA1_4_11I2PairP ((3,5),(k,l))) = true := by + decide +kernel +lemma CA1_4_11I2PairP_check_4_0 : ∀ k l : Fin 6, contains (CA1_4_11I2PairRaw ((4,0),(k,l))) (CA1_4_11I2PairP ((4,0),(k,l))) = true := by + decide +kernel +lemma CA1_4_11I2PairP_check_4_1 : ∀ k l : Fin 6, contains (CA1_4_11I2PairRaw ((4,1),(k,l))) (CA1_4_11I2PairP ((4,1),(k,l))) = true := by + decide +kernel +lemma CA1_4_11I2PairP_check_4_2 : ∀ k l : Fin 6, contains (CA1_4_11I2PairRaw ((4,2),(k,l))) (CA1_4_11I2PairP ((4,2),(k,l))) = true := by + decide +kernel +lemma CA1_4_11I2PairP_check_4_3 : ∀ k l : Fin 6, contains (CA1_4_11I2PairRaw ((4,3),(k,l))) (CA1_4_11I2PairP ((4,3),(k,l))) = true := by + decide +kernel +lemma CA1_4_11I2PairP_check_4_4 : ∀ k l : Fin 6, contains (CA1_4_11I2PairRaw ((4,4),(k,l))) (CA1_4_11I2PairP ((4,4),(k,l))) = true := by + decide +kernel +lemma CA1_4_11I2PairP_check_4_5 : ∀ k l : Fin 6, contains (CA1_4_11I2PairRaw ((4,5),(k,l))) (CA1_4_11I2PairP ((4,5),(k,l))) = true := by + decide +kernel +lemma CA1_4_11I2PairP_check_5_0 : ∀ k l : Fin 6, contains (CA1_4_11I2PairRaw ((5,0),(k,l))) (CA1_4_11I2PairP ((5,0),(k,l))) = true := by + decide +kernel +lemma CA1_4_11I2PairP_check_5_1 : ∀ k l : Fin 6, contains (CA1_4_11I2PairRaw ((5,1),(k,l))) (CA1_4_11I2PairP ((5,1),(k,l))) = true := by + decide +kernel +lemma CA1_4_11I2PairP_check_5_2 : ∀ k l : Fin 6, contains (CA1_4_11I2PairRaw ((5,2),(k,l))) (CA1_4_11I2PairP ((5,2),(k,l))) = true := by + decide +kernel +lemma CA1_4_11I2PairP_check_5_3 : ∀ k l : Fin 6, contains (CA1_4_11I2PairRaw ((5,3),(k,l))) (CA1_4_11I2PairP ((5,3),(k,l))) = true := by + decide +kernel +lemma CA1_4_11I2PairP_check_5_4 : ∀ k l : Fin 6, contains (CA1_4_11I2PairRaw ((5,4),(k,l))) (CA1_4_11I2PairP ((5,4),(k,l))) = true := by + decide +kernel +lemma CA1_4_11I2PairP_check_5_5 : ∀ k l : Fin 6, contains (CA1_4_11I2PairRaw ((5,5),(k,l))) (CA1_4_11I2PairP ((5,5),(k,l))) = true := by + decide +kernel +lemma CA1_4_11I2PairP_check (a : PairSlot × PairSlot) : contains (CA1_4_11I2PairRaw a) (CA1_4_11I2PairP a) = true := by + rcases a with ⟨⟨i,j⟩,⟨k,l⟩⟩ + revert j i + apply forall_fin6 + · exact forall_fin6 (CA1_4_11I2PairP_check_0_0 k l) (CA1_4_11I2PairP_check_0_1 k l) (CA1_4_11I2PairP_check_0_2 k l) (CA1_4_11I2PairP_check_0_3 k l) (CA1_4_11I2PairP_check_0_4 k l) (CA1_4_11I2PairP_check_0_5 k l) + · exact forall_fin6 (CA1_4_11I2PairP_check_1_0 k l) (CA1_4_11I2PairP_check_1_1 k l) (CA1_4_11I2PairP_check_1_2 k l) (CA1_4_11I2PairP_check_1_3 k l) (CA1_4_11I2PairP_check_1_4 k l) (CA1_4_11I2PairP_check_1_5 k l) + · exact forall_fin6 (CA1_4_11I2PairP_check_2_0 k l) (CA1_4_11I2PairP_check_2_1 k l) (CA1_4_11I2PairP_check_2_2 k l) (CA1_4_11I2PairP_check_2_3 k l) (CA1_4_11I2PairP_check_2_4 k l) (CA1_4_11I2PairP_check_2_5 k l) + · exact forall_fin6 (CA1_4_11I2PairP_check_3_0 k l) (CA1_4_11I2PairP_check_3_1 k l) (CA1_4_11I2PairP_check_3_2 k l) (CA1_4_11I2PairP_check_3_3 k l) (CA1_4_11I2PairP_check_3_4 k l) (CA1_4_11I2PairP_check_3_5 k l) + · exact forall_fin6 (CA1_4_11I2PairP_check_4_0 k l) (CA1_4_11I2PairP_check_4_1 k l) (CA1_4_11I2PairP_check_4_2 k l) (CA1_4_11I2PairP_check_4_3 k l) (CA1_4_11I2PairP_check_4_4 k l) (CA1_4_11I2PairP_check_4_5 k l) + · exact forall_fin6 (CA1_4_11I2PairP_check_5_0 k l) (CA1_4_11I2PairP_check_5_1 k l) (CA1_4_11I2PairP_check_5_2 k l) (CA1_4_11I2PairP_check_5_3 k l) (CA1_4_11I2PairP_check_5_4 k l) (CA1_4_11I2PairP_check_5_5 k l) +lemma CA1_4_11I2PairP_sound (a : PairSlot × PairSlot) : + (CA1_4_11I2PairP a).Encloses (CA1_4_11I2PairValue a) := + contains_sound (CA1_4_11I2PairRaw_sound a) (CA1_4_11I2PairP_check a) +def CA1_4_11I2PairTerms (a : PairSlot × PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_4_11I2PairCertificates (CA1_4_11I2PairCertificateIndex a)).output +lemma CA1_4_11I2PairTerms_sound (a : PairSlot × PairSlot) : + (CA1_4_11I2PairTerms a).Encloses (Foundation.entropyTerm (CA1_4_11I2PairValue a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_4_11I2PairCertificates_valid + (CA1_4_11I2PairCertificateIndex a) (CA1_4_11I2PairP_sound a) +def CA1_4_11I2PairEntropy : Ball := ⟨(71515153480864000296843130640223 / 25000000000000000000000000000000), (14585933523 / 12500000000000000000000000000000)⟩ +lemma CA1_4_11I2PairEntropy_sound : CA1_4_11I2PairEntropy.Encloses (Foundation.finiteEntropy CA1_4_11I2PairValue) := by + exact contains_sound (entropyDoublePair_enclosed CA1_4_11I2PairValue CA1_4_11I2PairTerms CA1_4_11I2PairTerms_sound) (by decide +kernel) +def CA1_4_11I2PairMass : Ball := ⟨(24999999999999999999999999999999 / 25000000000000000000000000000000), (113 / 25000000000000000000000000000000)⟩ +lemma CA1_4_11I2PairMass_sound : CA1_4_11I2PairMass.Encloses (∑ a, CA1_4_11I2PairValue a) := by + exact contains_sound (doublePairSumBall_sound CA1_4_11I2PairP CA1_4_11I2PairValue CA1_4_11I2PairP_sound) (by decide +kernel) +def CA1_4_11I2PairMassTermLogWitness : LogWitness := ⟨-1, 24999999999999999999999999999999, 12500000000000000000000000000000⟩ +def CA1_4_11I2PairMassTermLog : Ball := ⟨(-1 / 25000000000000000000000000000000), (21175823909 / 50000000000000000000000000000000)⟩ +lemma CA1_4_11I2PairMassTermLog_sound : CA1_4_11I2PairMassTermLog.Encloses (Real.log ((∑ a, CA1_4_11I2PairValue a))) := by + exact checkLog_sound logTwoBall_sound (CA1_4_11I2PairMass_sound) (w := CA1_4_11I2PairMassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA1_4_11I2PairMassTerm : Ball := ⟨(1 / 25000000000000000000000000000000), (42351647819 / 100000000000000000000000000000000)⟩ +lemma CA1_4_11I2PairMassTerm_sound : CA1_4_11I2PairMassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_4_11I2PairValue a))) := by + exact contains_sound (entropyTerm_ball (CA1_4_11I2PairMass_sound) CA1_4_11I2PairMassTermLog_sound) (by decide +kernel) +def CA1_4_11I2PairH : Ball := ⟨(35757576740432000148421565320111 / 12500000000000000000000000000000), (159039116003 / 100000000000000000000000000000000)⟩ +lemma CA1_4_11I2PairH_sound : CA1_4_11I2PairH.Encloses (homogeneousEntropy CA1_4_11I2PairValue) := by + exact contains_sound (homogeneous_enclosed CA1_4_11I2PairValue CA1_4_11I2PairMassTerm_sound CA1_4_11I2PairEntropy_sound) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CA1_4_11I2R0Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 4 11)) (fun u => (stageALaw (shape 1 4 11) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 0 a +def CA1_4_11I2R0Raw (a : PairSlot) : Ball := residualBall (below (shape 1 4 11)) A1_4_11Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 0 a +lemma CA1_4_11I2R0Raw_sound (a : PairSlot) : + (CA1_4_11I2R0Raw a).Encloses (CA1_4_11I2R0Value a) := by + exact residualBall_sound_on (below (shape 1 4 11)) A1_4_11Law (fun u => (stageALaw (shape 1 4 11) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A1_4_11Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 4 11) (show (shape 1 4 11) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 0 a +def CA1_4_11I2R0Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA1_4_11I2R0Certificates_valid : + CA1_4_11I2R0Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_4_11I2R0CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA1_4_11I2R0P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_4_11I2R0Certificates (CA1_4_11I2R0CertificateIndex a)).input +lemma CA1_4_11I2R0P_check : ∀ a : PairSlot, contains (CA1_4_11I2R0Raw a) (CA1_4_11I2R0P a) = true := by + decide +kernel +lemma CA1_4_11I2R0P_sound (a : PairSlot) : + (CA1_4_11I2R0P a).Encloses (CA1_4_11I2R0Value a) := + contains_sound (CA1_4_11I2R0Raw_sound a) (CA1_4_11I2R0P_check a) +def CA1_4_11I2R0Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_4_11I2R0Certificates (CA1_4_11I2R0CertificateIndex a)).output +lemma CA1_4_11I2R0Terms_sound (a : PairSlot) : + (CA1_4_11I2R0Terms a).Encloses (Foundation.entropyTerm (CA1_4_11I2R0Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_4_11I2R0Certificates_valid + (CA1_4_11I2R0CertificateIndex a) (CA1_4_11I2R0P_sound a) +def CA1_4_11I2R0Entropy : Ball := ⟨0, 0⟩ +lemma CA1_4_11I2R0Entropy_sound : CA1_4_11I2R0Entropy.Encloses (Foundation.finiteEntropy CA1_4_11I2R0Value) := by + exact contains_sound (entropyPair_enclosed CA1_4_11I2R0Value CA1_4_11I2R0Terms CA1_4_11I2R0Terms_sound) (by decide +kernel) +def CA1_4_11I2R0Mass : Ball := ⟨0, 0⟩ +lemma CA1_4_11I2R0Mass_sound : CA1_4_11I2R0Mass.Encloses (∑ a, CA1_4_11I2R0Value a) := by + exact contains_sound (pairSumBall_sound CA1_4_11I2R0P CA1_4_11I2R0Value CA1_4_11I2R0P_sound) (by decide +kernel) +def CA1_4_11I2R0MassTerm : Ball := .exact 0 +lemma CA1_4_11I2R0MassTerm_sound : CA1_4_11I2R0MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_4_11I2R0Value a))) := + entropyTerm_zero_ball (CA1_4_11I2R0Mass_sound) +def CA1_4_11I2R0H : Ball := ⟨0, 0⟩ +lemma CA1_4_11I2R0H_sound : CA1_4_11I2R0H.Encloses (homogeneousEntropy CA1_4_11I2R0Value) := by + exact contains_sound (homogeneous_enclosed CA1_4_11I2R0Value CA1_4_11I2R0MassTerm_sound CA1_4_11I2R0Entropy_sound) (by decide +kernel) +def CA1_4_11I2R1Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 4 11)) (fun u => (stageALaw (shape 1 4 11) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 1 a +def CA1_4_11I2R1Raw (a : PairSlot) : Ball := residualBall (below (shape 1 4 11)) A1_4_11Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 1 a +lemma CA1_4_11I2R1Raw_sound (a : PairSlot) : + (CA1_4_11I2R1Raw a).Encloses (CA1_4_11I2R1Value a) := by + exact residualBall_sound_on (below (shape 1 4 11)) A1_4_11Law (fun u => (stageALaw (shape 1 4 11) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A1_4_11Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 4 11) (show (shape 1 4 11) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 1 a +def CA1_4_11I2R1Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA1_4_11I2R1Certificates_valid : + CA1_4_11I2R1Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_4_11I2R1CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA1_4_11I2R1P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_4_11I2R1Certificates (CA1_4_11I2R1CertificateIndex a)).input +lemma CA1_4_11I2R1P_check : ∀ a : PairSlot, contains (CA1_4_11I2R1Raw a) (CA1_4_11I2R1P a) = true := by + decide +kernel +lemma CA1_4_11I2R1P_sound (a : PairSlot) : + (CA1_4_11I2R1P a).Encloses (CA1_4_11I2R1Value a) := + contains_sound (CA1_4_11I2R1Raw_sound a) (CA1_4_11I2R1P_check a) +def CA1_4_11I2R1Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_4_11I2R1Certificates (CA1_4_11I2R1CertificateIndex a)).output +lemma CA1_4_11I2R1Terms_sound (a : PairSlot) : + (CA1_4_11I2R1Terms a).Encloses (Foundation.entropyTerm (CA1_4_11I2R1Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_4_11I2R1Certificates_valid + (CA1_4_11I2R1CertificateIndex a) (CA1_4_11I2R1P_sound a) +def CA1_4_11I2R1Entropy : Ball := ⟨0, 0⟩ +lemma CA1_4_11I2R1Entropy_sound : CA1_4_11I2R1Entropy.Encloses (Foundation.finiteEntropy CA1_4_11I2R1Value) := by + exact contains_sound (entropyPair_enclosed CA1_4_11I2R1Value CA1_4_11I2R1Terms CA1_4_11I2R1Terms_sound) (by decide +kernel) +def CA1_4_11I2R1Mass : Ball := ⟨0, 0⟩ +lemma CA1_4_11I2R1Mass_sound : CA1_4_11I2R1Mass.Encloses (∑ a, CA1_4_11I2R1Value a) := by + exact contains_sound (pairSumBall_sound CA1_4_11I2R1P CA1_4_11I2R1Value CA1_4_11I2R1P_sound) (by decide +kernel) +def CA1_4_11I2R1MassTerm : Ball := .exact 0 +lemma CA1_4_11I2R1MassTerm_sound : CA1_4_11I2R1MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_4_11I2R1Value a))) := + entropyTerm_zero_ball (CA1_4_11I2R1Mass_sound) +def CA1_4_11I2R1H : Ball := ⟨0, 0⟩ +lemma CA1_4_11I2R1H_sound : CA1_4_11I2R1H.Encloses (homogeneousEntropy CA1_4_11I2R1Value) := by + exact contains_sound (homogeneous_enclosed CA1_4_11I2R1Value CA1_4_11I2R1MassTerm_sound CA1_4_11I2R1Entropy_sound) (by decide +kernel) +def CA1_4_11I2R2Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 4 11)) (fun u => (stageALaw (shape 1 4 11) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 2 a +def CA1_4_11I2R2Raw (a : PairSlot) : Ball := residualBall (below (shape 1 4 11)) A1_4_11Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 2 a +lemma CA1_4_11I2R2Raw_sound (a : PairSlot) : + (CA1_4_11I2R2Raw a).Encloses (CA1_4_11I2R2Value a) := by + exact residualBall_sound_on (below (shape 1 4 11)) A1_4_11Law (fun u => (stageALaw (shape 1 4 11) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A1_4_11Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 4 11) (show (shape 1 4 11) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 2 a +def CA1_4_11I2R2Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA1_4_11I2R2Certificates_valid : + CA1_4_11I2R2Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_4_11I2R2CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA1_4_11I2R2P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_4_11I2R2Certificates (CA1_4_11I2R2CertificateIndex a)).input +lemma CA1_4_11I2R2P_check : ∀ a : PairSlot, contains (CA1_4_11I2R2Raw a) (CA1_4_11I2R2P a) = true := by + decide +kernel +lemma CA1_4_11I2R2P_sound (a : PairSlot) : + (CA1_4_11I2R2P a).Encloses (CA1_4_11I2R2Value a) := + contains_sound (CA1_4_11I2R2Raw_sound a) (CA1_4_11I2R2P_check a) +def CA1_4_11I2R2Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_4_11I2R2Certificates (CA1_4_11I2R2CertificateIndex a)).output +lemma CA1_4_11I2R2Terms_sound (a : PairSlot) : + (CA1_4_11I2R2Terms a).Encloses (Foundation.entropyTerm (CA1_4_11I2R2Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_4_11I2R2Certificates_valid + (CA1_4_11I2R2CertificateIndex a) (CA1_4_11I2R2P_sound a) +def CA1_4_11I2R2Entropy : Ball := ⟨0, 0⟩ +lemma CA1_4_11I2R2Entropy_sound : CA1_4_11I2R2Entropy.Encloses (Foundation.finiteEntropy CA1_4_11I2R2Value) := by + exact contains_sound (entropyPair_enclosed CA1_4_11I2R2Value CA1_4_11I2R2Terms CA1_4_11I2R2Terms_sound) (by decide +kernel) +def CA1_4_11I2R2Mass : Ball := ⟨0, 0⟩ +lemma CA1_4_11I2R2Mass_sound : CA1_4_11I2R2Mass.Encloses (∑ a, CA1_4_11I2R2Value a) := by + exact contains_sound (pairSumBall_sound CA1_4_11I2R2P CA1_4_11I2R2Value CA1_4_11I2R2P_sound) (by decide +kernel) +def CA1_4_11I2R2MassTerm : Ball := .exact 0 +lemma CA1_4_11I2R2MassTerm_sound : CA1_4_11I2R2MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_4_11I2R2Value a))) := + entropyTerm_zero_ball (CA1_4_11I2R2Mass_sound) +def CA1_4_11I2R2H : Ball := ⟨0, 0⟩ +lemma CA1_4_11I2R2H_sound : CA1_4_11I2R2H.Encloses (homogeneousEntropy CA1_4_11I2R2Value) := by + exact contains_sound (homogeneous_enclosed CA1_4_11I2R2Value CA1_4_11I2R2MassTerm_sound CA1_4_11I2R2Entropy_sound) (by decide +kernel) +def CA1_4_11I2R3Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 4 11)) (fun u => (stageALaw (shape 1 4 11) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 3 a +def CA1_4_11I2R3Raw (a : PairSlot) : Ball := residualBall (below (shape 1 4 11)) A1_4_11Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 3 a +lemma CA1_4_11I2R3Raw_sound (a : PairSlot) : + (CA1_4_11I2R3Raw a).Encloses (CA1_4_11I2R3Value a) := by + exact residualBall_sound_on (below (shape 1 4 11)) A1_4_11Law (fun u => (stageALaw (shape 1 4 11) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A1_4_11Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 4 11) (show (shape 1 4 11) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 3 a +def CA1_4_11I2R3Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(61436712352474830488612391 / 10000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(7372459591722180802103669681 / 100000000000000000000000000000000), (1235931 / 50000000000000000000000000000000)⟩ ⟨(-1200008807343871317001204918543989 / 100000000000000000000000000000000), (201170406373 / 50000000000000000000000000000000)⟩ ⟨-18, 61436712352474830488612391, 38146972656250000000000000⟩, + .log ⟨(20890993075933606986049075471 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(44255518130701293310819022579 / 25000000000000000000000000000000), (7741721 / 12500000000000000000000000000000)⟩ ⟨(-847360735219113820046267163931973 / 100000000000000000000000000000000), (74115384087 / 25000000000000000000000000000000)⟩ ⟨-13, 20890993075933606986049075471, 12207031250000000000000000000⟩, + .log ⟨(12647475172166827455070439 / 625000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(2187112567878730349464064949 / 10000000000000000000000000000000), (3557 / 48828125000000000000000000000)⟩ ⟨(-1080804932459902736691495491288357 / 100000000000000000000000000000000), (359989052027 / 100000000000000000000000000000000)⟩ ⟨-16, 12647475172166827455070439, 9536743164062500000000000⟩] +lemma CA1_4_11I2R3Certificates_valid : + CA1_4_11I2R3Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_4_11I2R3CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 4, 0 => 1 + | 2, 1 => 2 + | 3, 1 => 3 + | 1, 2 => 2 + | 1, 3 => 3 + | 0, 4 => 1 + | _, _ => 0 +def CA1_4_11I2R3P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_4_11I2R3Certificates (CA1_4_11I2R3CertificateIndex a)).input +lemma CA1_4_11I2R3P_check : ∀ a : PairSlot, contains (CA1_4_11I2R3Raw a) (CA1_4_11I2R3P a) = true := by + decide +kernel +lemma CA1_4_11I2R3P_sound (a : PairSlot) : + (CA1_4_11I2R3P a).Encloses (CA1_4_11I2R3Value a) := + contains_sound (CA1_4_11I2R3Raw_sound a) (CA1_4_11I2R3P_check a) +def CA1_4_11I2R3Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_4_11I2R3Certificates (CA1_4_11I2R3CertificateIndex a)).output +lemma CA1_4_11I2R3Terms_sound (a : PairSlot) : + (CA1_4_11I2R3Terms a).Encloses (Foundation.entropyTerm (CA1_4_11I2R3Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_4_11I2R3Certificates_valid + (CA1_4_11I2R3CertificateIndex a) (CA1_4_11I2R3P_sound a) +def CA1_4_11I2R3Entropy : Ball := ⟨(206265657793314657540020409487 / 50000000000000000000000000000000), (35845183 / 25000000000000000000000000000000)⟩ +lemma CA1_4_11I2R3Entropy_sound : CA1_4_11I2R3Entropy.Encloses (Foundation.finiteEntropy CA1_4_11I2R3Value) := by + exact contains_sound (entropyPair_enclosed CA1_4_11I2R3Value CA1_4_11I2R3Terms CA1_4_11I2R3Terms_sound) (by decide +kernel) +def CA1_4_11I2R3Mass : Ball := ⟨(23528956227005047683746469621 / 50000000000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ +lemma CA1_4_11I2R3Mass_sound : CA1_4_11I2R3Mass.Encloses (∑ a, CA1_4_11I2R3Value a) := by + exact contains_sound (pairSumBall_sound CA1_4_11I2R3P CA1_4_11I2R3Value CA1_4_11I2R3P_sound) (by decide +kernel) +def CA1_4_11I2R3MassTermLogWitness : LogWitness := ⟨-12, 23528956227005047683746469621, 12207031250000000000000000000⟩ +def CA1_4_11I2R3MassTermLog : Ball := ⟨(-383077322094910835836992754825221 / 50000000000000000000000000000000), (275285720629 / 100000000000000000000000000000000)⟩ +lemma CA1_4_11I2R3MassTermLog_sound : CA1_4_11I2R3MassTermLog.Encloses (Real.log ((∑ a, CA1_4_11I2R3Value a))) := by + exact checkLog_sound logTwoBall_sound (CA1_4_11I2R3Mass_sound) (w := CA1_4_11I2R3MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA1_4_11I2R3MassTerm : Ball := ⟨(180268190862589412980979300497 / 50000000000000000000000000000000), (1619297 / 1250000000000000000000000000000)⟩ +lemma CA1_4_11I2R3MassTerm_sound : CA1_4_11I2R3MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_4_11I2R3Value a))) := by + exact contains_sound (entropyTerm_ball (CA1_4_11I2R3Mass_sound) CA1_4_11I2R3MassTermLog_sound) (by decide +kernel) +def CA1_4_11I2R3H : Ball := ⟨(2599746693072524455904110899 / 5000000000000000000000000000000), (68231123 / 25000000000000000000000000000000)⟩ +lemma CA1_4_11I2R3H_sound : CA1_4_11I2R3H.Encloses (homogeneousEntropy CA1_4_11I2R3Value) := by + exact contains_sound (homogeneous_enclosed CA1_4_11I2R3Value CA1_4_11I2R3MassTerm_sound CA1_4_11I2R3Entropy_sound) (by decide +kernel) +def CA1_4_11I2R4Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 4 11)) (fun u => (stageALaw (shape 1 4 11) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 4 a +def CA1_4_11I2R4Raw (a : PairSlot) : Ball := residualBall (below (shape 1 4 11)) A1_4_11Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 4 a +lemma CA1_4_11I2R4Raw_sound (a : PairSlot) : + (CA1_4_11I2R4Raw a).Encloses (CA1_4_11I2R4Value a) := by + exact residualBall_sound_on (below (shape 1 4 11)) A1_4_11Law (fun u => (stageALaw (shape 1 4 11) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A1_4_11Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 4 11) (show (shape 1 4 11) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 4 a +def CA1_4_11I2R4Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(675590492357013698713995109 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(502685504275185179583228751 / 6250000000000000000000000000000), (2718189 / 100000000000000000000000000000000)⟩ ⟨(-595254681600276381793198535164501 / 50000000000000000000000000000000), (80468159599 / 20000000000000000000000000000000)⟩ ⟨-18, 675590492357013698713995109, 381469726562500000000000000⟩, + .log ⟨(133830529574469617999668594627 / 50000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ ⟨(1585411053395870048139682753047 / 100000000000000000000000000000000), (283397177 / 50000000000000000000000000000000)⟩ ⟨(-296160199477069350470806166977669 / 50000000000000000000000000000000), (211758237577 / 100000000000000000000000000000000)⟩ ⟨-9, 133830529574469617999668594627, 97656250000000000000000000000⟩, + .log ⟨(284437587041342969390806612487 / 10000000000000000000000000000000), (3 / 25000000000000000000000000000000)⟩ ⟨(405019386275128425873996955433 / 4000000000000000000000000000000), (421624019 / 10000000000000000000000000000000)⟩ ⟨(-355982652018717647827715657652457 / 100000000000000000000000000000000), (148230766203 / 100000000000000000000000000000000)⟩ ⟨-6, 284437587041342969390806612487, 156250000000000000000000000000⟩, + .log ⟨(147480825491657547530678195629 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(480730511466098859677777116159 / 50000000000000000000000000000000), (343533083 / 100000000000000000000000000000000)⟩ ⟨(-26076909177229525697088505975703 / 4000000000000000000000000000000), (232934061191 / 100000000000000000000000000000000)⟩ ⟨-10, 147480825491657547530678195629, 97656250000000000000000000000⟩, + .log ⟨(43928590602018655644399493 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(4413478728619861079566301109 / 100000000000000000000000000000000), (1488373 / 100000000000000000000000000000000)⟩ ⟨(-251173476552252963534643964200933 / 20000000000000000000000000000000), (105879189553 / 25000000000000000000000000000000)⟩ ⟨-19, 43928590602018655644399493, 23841857910156250000000000⟩] +lemma CA1_4_11I2R4Certificates_valid : + CA1_4_11I2R4Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_4_11I2R4CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 5, 0 => 1 + | 4, 1 => 2 + | 2, 2 => 3 + | 2, 3 => 4 + | 3, 2 => 4 + | 3, 3 => 5 + | 1, 4 => 2 + | 0, 5 => 1 + | _, _ => 0 +def CA1_4_11I2R4P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_4_11I2R4Certificates (CA1_4_11I2R4CertificateIndex a)).input +lemma CA1_4_11I2R4P_check : ∀ a : PairSlot, contains (CA1_4_11I2R4Raw a) (CA1_4_11I2R4P a) = true := by + decide +kernel +lemma CA1_4_11I2R4P_sound (a : PairSlot) : + (CA1_4_11I2R4P a).Encloses (CA1_4_11I2R4Value a) := + contains_sound (CA1_4_11I2R4Raw_sound a) (CA1_4_11I2R4P_check a) +def CA1_4_11I2R4Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_4_11I2R4Certificates (CA1_4_11I2R4CertificateIndex a)).output +lemma CA1_4_11I2R4Terms_sound (a : PairSlot) : + (CA1_4_11I2R4Terms a).Encloses (Foundation.entropyTerm (CA1_4_11I2R4Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_4_11I2R4Certificates_valid + (CA1_4_11I2R4CertificateIndex a) (CA1_4_11I2R4P_sound a) +def CA1_4_11I2R4Entropy : Ball := ⟨(238120753506246437010416054339 / 1562500000000000000000000000000), (1208763963 / 20000000000000000000000000000000)⟩ +lemma CA1_4_11I2R4Entropy_sound : CA1_4_11I2R4Entropy.Encloses (Foundation.finiteEntropy CA1_4_11I2R4Value) := by + exact contains_sound (entropyPair_enclosed CA1_4_11I2R4Value CA1_4_11I2R4Terms CA1_4_11I2R4Terms_sound) (by decide +kernel) +def CA1_4_11I2R4Mass : Ball := ⟨(1838181124702076718805340040399 / 50000000000000000000000000000000), (21 / 100000000000000000000000000000000)⟩ +lemma CA1_4_11I2R4Mass_sound : CA1_4_11I2R4Mass.Encloses (∑ a, CA1_4_11I2R4Value a) := by + exact contains_sound (pairSumBall_sound CA1_4_11I2R4P CA1_4_11I2R4Value CA1_4_11I2R4P_sound) (by decide +kernel) +def CA1_4_11I2R4MassTermLogWitness : LogWitness := ⟨-5, 1838181124702076718805340040399, 1562500000000000000000000000000⟩ +def CA1_4_11I2R4MassTermLog : Ball := ⟨(-330324644189821671673985641754329 / 100000000000000000000000000000000), (31763735667 / 25000000000000000000000000000000)⟩ +lemma CA1_4_11I2R4MassTermLog_sound : CA1_4_11I2R4MassTermLog.Encloses (Real.log ((∑ a, CA1_4_11I2R4Value a))) := by + exact checkLog_sound logTwoBall_sound (CA1_4_11I2R4Mass_sound) (w := CA1_4_11I2R4MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA1_4_11I2R4MassTerm : Ball := ⟨(3035982629868298560652886595353 / 25000000000000000000000000000000), (2335500009 / 50000000000000000000000000000000)⟩ +lemma CA1_4_11I2R4MassTerm_sound : CA1_4_11I2R4MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_4_11I2R4Value a))) := by + exact contains_sound (entropyTerm_ball (CA1_4_11I2R4Mass_sound) CA1_4_11I2R4MassTermLog_sound) (by decide +kernel) +def CA1_4_11I2R4H : Ball := ⟨(773949426231644431513770274071 / 25000000000000000000000000000000), (10714819833 / 100000000000000000000000000000000)⟩ +lemma CA1_4_11I2R4H_sound : CA1_4_11I2R4H.Encloses (homogeneousEntropy CA1_4_11I2R4Value) := by + exact contains_sound (homogeneous_enclosed CA1_4_11I2R4Value CA1_4_11I2R4MassTerm_sound CA1_4_11I2R4Entropy_sound) (by decide +kernel) +def CA1_4_11I2R5Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 4 11)) (fun u => (stageALaw (shape 1 4 11) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 5 a +def CA1_4_11I2R5Raw (a : PairSlot) : Ball := residualBall (below (shape 1 4 11)) A1_4_11Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 5 a +lemma CA1_4_11I2R5Raw_sound (a : PairSlot) : + (CA1_4_11I2R5Raw a).Encloses (CA1_4_11I2R5Value a) := by + exact residualBall_sound_on (below (shape 1 4 11)) A1_4_11Law (fun u => (stageALaw (shape 1 4 11) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A1_4_11Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 4 11) (show (shape 1 4 11) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 5 a +def CA1_4_11I2R5Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(18138120034399794853090260729 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(156258265537147701001751566529 / 100000000000000000000000000000000), (53772559 / 100000000000000000000000000000000)⟩ ⟨(-430745483106288237002291658559271 / 50000000000000000000000000000000), (11858461483 / 4000000000000000000000000000000)⟩ ⟨-13, 18138120034399794853090260729, 12207031250000000000000000000⟩, + .log ⟨(752915443548722822830379625787 / 6250000000000000000000000000000), (23 / 100000000000000000000000000000000)⟩ ⟨(25495328928592416167136082228937 / 100000000000000000000000000000000), (12754883817 / 100000000000000000000000000000000)⟩ ⟨(-211638381399983837207000776148451 / 100000000000000000000000000000000), (52939559303 / 50000000000000000000000000000000)⟩ ⟨-4, 752915443548722822830379625787, 390625000000000000000000000000⟩, + .log ⟨(111141817618374134334930680753 / 25000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ ⟨(481539625883784876366837532177 / 20000000000000000000000000000000), (423633523 / 50000000000000000000000000000000)⟩ ⟨(-27079120409095235826197750264821 / 5000000000000000000000000000000), (47645603399 / 25000000000000000000000000000000)⟩ ⟨-8, 111141817618374134334930680753, 97656250000000000000000000000⟩] +lemma CA1_4_11I2R5Certificates_valid : + CA1_4_11I2R5Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_4_11I2R5CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 5, 1 => 1 + | 4, 2 => 2 + | 4, 3 => 3 + | 2, 4 => 2 + | 3, 4 => 3 + | 1, 5 => 1 + | _, _ => 0 +def CA1_4_11I2R5P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_4_11I2R5Certificates (CA1_4_11I2R5CertificateIndex a)).input +lemma CA1_4_11I2R5P_check : ∀ a : PairSlot, contains (CA1_4_11I2R5Raw a) (CA1_4_11I2R5P a) = true := by + decide +kernel +lemma CA1_4_11I2R5P_sound (a : PairSlot) : + (CA1_4_11I2R5P a).Encloses (CA1_4_11I2R5Value a) := + contains_sound (CA1_4_11I2R5Raw_sound a) (CA1_4_11I2R5P_check a) +def CA1_4_11I2R5Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_4_11I2R5Certificates (CA1_4_11I2R5CertificateIndex a)).output +lemma CA1_4_11I2R5Terms_sound (a : PairSlot) : + (CA1_4_11I2R5Terms a).Encloses (Foundation.entropyTerm (CA1_4_11I2R5Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_4_11I2R5Certificates_valid + (CA1_4_11I2R5CertificateIndex a) (CA1_4_11I2R5P_sound a) +def CA1_4_11I2R5Entropy : Ball := ⟨(28059285323548488249972021456351 / 50000000000000000000000000000000), (6827961711 / 25000000000000000000000000000000)⟩ +lemma CA1_4_11I2R5Entropy_sound : CA1_4_11I2R5Entropy.Encloses (Foundation.finiteEntropy CA1_4_11I2R5Value) := by + exact contains_sound (entropyPair_enclosed CA1_4_11I2R5Value CA1_4_11I2R5Terms CA1_4_11I2R5Terms_sound) (by decide +kernel) +def CA1_4_11I2R5Mass : Ball := ⟨(12509352487287461497478886996333 / 50000000000000000000000000000000), (13 / 25000000000000000000000000000000)⟩ +lemma CA1_4_11I2R5Mass_sound : CA1_4_11I2R5Mass.Encloses (∑ a, CA1_4_11I2R5Value a) := by + exact contains_sound (pairSumBall_sound CA1_4_11I2R5P CA1_4_11I2R5Value CA1_4_11I2R5P_sound) (by decide +kernel) +def CA1_4_11I2R5MassTermLogWitness : LogWitness := ⟨-2, 12509352487287461497478886996333, 12500000000000000000000000000000⟩ +def CA1_4_11I2R5MassTermLog : Ball := ⟨(-17319330523727708959248212380091 / 12500000000000000000000000000000), (7940933907 / 12500000000000000000000000000000)⟩ +lemma CA1_4_11I2R5MassTermLog_sound : CA1_4_11I2R5MassTermLog.Encloses (Real.log ((∑ a, CA1_4_11I2R5Value a))) := by + exact checkLog_sound logTwoBall_sound (CA1_4_11I2R5Mass_sound) (w := CA1_4_11I2R5MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA1_4_11I2R5MassTerm : Ball := ⟨(34664577658423499082858619295681 / 100000000000000000000000000000000), (3973437671 / 25000000000000000000000000000000)⟩ +lemma CA1_4_11I2R5MassTerm_sound : CA1_4_11I2R5MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_4_11I2R5Value a))) := by + exact contains_sound (entropyTerm_ball (CA1_4_11I2R5Mass_sound) CA1_4_11I2R5MassTermLog_sound) (by decide +kernel) +def CA1_4_11I2R5H : Ball := ⟨(21453992988673477417085423617021 / 100000000000000000000000000000000), (5400699691 / 12500000000000000000000000000000)⟩ +lemma CA1_4_11I2R5H_sound : CA1_4_11I2R5H.Encloses (homogeneousEntropy CA1_4_11I2R5Value) := by + exact contains_sound (homogeneous_enclosed CA1_4_11I2R5Value CA1_4_11I2R5MassTerm_sound CA1_4_11I2R5Entropy_sound) (by decide +kernel) +def CA1_4_11I2R6Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 4 11)) (fun u => (stageALaw (shape 1 4 11) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 6 a +def CA1_4_11I2R6Raw (a : PairSlot) : Ball := residualBall (below (shape 1 4 11)) A1_4_11Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 6 a +lemma CA1_4_11I2R6Raw_sound (a : PairSlot) : + (CA1_4_11I2R6Raw a).Encloses (CA1_4_11I2R6Value a) := by + exact residualBall_sound_on (below (shape 1 4 11)) A1_4_11Law (fun u => (stageALaw (shape 1 4 11) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A1_4_11Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 4 11) (show (shape 1 4 11) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 6 a +def CA1_4_11I2R6Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(177571602779606609244244421869 / 100000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ ⟨(1124658898503515455075567975467 / 100000000000000000000000000000000), (10340619 / 2500000000000000000000000000000)⟩ ⟨(-158338788536389508578027784169353 / 25000000000000000000000000000000), (232934061639 / 100000000000000000000000000000000)⟩ ⟨-10, 177571602779606609244244421869, 97656250000000000000000000000⟩, + .log ⟨(1398464475151336582003091 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(179069061735961277107640157 / 100000000000000000000000000000000), (11849 / 20000000000000000000000000000000)⟩ ⟨(-400146609276093460159869386768671 / 25000000000000000000000000000000), (10588090609 / 2000000000000000000000000000000)⟩ ⟨-24, 1398464475151336582003091, 745058059692382812500000⟩, + .log ⟨(930993068943178587526919271357 / 5000000000000000000000000000000), (21 / 50000000000000000000000000000000)⟩ ⟨(31298895088922340799913625208817 / 100000000000000000000000000000000), (985727261 / 6250000000000000000000000000000)⟩ ⟨(-168094135891105168076544183405379 / 100000000000000000000000000000000), (84703294957 / 100000000000000000000000000000000)⟩ ⟨-3, 930993068943178587526919271357, 625000000000000000000000000000⟩] +lemma CA1_4_11I2R6Certificates_valid : + CA1_4_11I2R6Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_4_11I2R6CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 5, 2 => 1 + | 5, 3 => 2 + | 4, 4 => 3 + | 2, 5 => 1 + | 3, 5 => 2 + | _, _ => 0 +def CA1_4_11I2R6P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_4_11I2R6Certificates (CA1_4_11I2R6CertificateIndex a)).input +lemma CA1_4_11I2R6P_check : ∀ a : PairSlot, contains (CA1_4_11I2R6Raw a) (CA1_4_11I2R6P a) = true := by + decide +kernel +lemma CA1_4_11I2R6P_sound (a : PairSlot) : + (CA1_4_11I2R6P a).Encloses (CA1_4_11I2R6Value a) := + contains_sound (CA1_4_11I2R6Raw_sound a) (CA1_4_11I2R6P_check a) +def CA1_4_11I2R6Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_4_11I2R6Certificates (CA1_4_11I2R6CertificateIndex a)).output +lemma CA1_4_11I2R6Terms_sound (a : PairSlot) : + (CA1_4_11I2R6Terms a).Encloses (Foundation.entropyTerm (CA1_4_11I2R6Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_4_11I2R6Certificates_valid + (CA1_4_11I2R6CertificateIndex a) (CA1_4_11I2R6P_sound a) +def CA1_4_11I2R6Entropy : Ball := ⟨(6709714204810568726523795288013 / 20000000000000000000000000000000), (8299502093 / 50000000000000000000000000000000)⟩ +lemma CA1_4_11I2R6Entropy_sound : CA1_4_11I2R6Entropy.Encloses (Foundation.finiteEntropy CA1_4_11I2R6Value) := by + exact contains_sound (entropyPair_enclosed CA1_4_11I2R6Value CA1_4_11I2R6Terms CA1_4_11I2R6Terms_sound) (by decide +kernel) +def CA1_4_11I2R6Mass : Ball := ⟨(9487513479927193695206093160167 / 50000000000000000000000000000000), (3 / 6250000000000000000000000000000)⟩ +lemma CA1_4_11I2R6Mass_sound : CA1_4_11I2R6Mass.Encloses (∑ a, CA1_4_11I2R6Value a) := by + exact contains_sound (pairSumBall_sound CA1_4_11I2R6P CA1_4_11I2R6Value CA1_4_11I2R6P_sound) (by decide +kernel) +def CA1_4_11I2R6MassTermLogWitness : LogWitness := ⟨-3, 9487513479927193695206093160167, 6250000000000000000000000000000⟩ +def CA1_4_11I2R6MassTermLog : Ball := ⟨(-83102322094910835836992839972633 / 50000000000000000000000000000000), (10587911873 / 12500000000000000000000000000000)⟩ +lemma CA1_4_11I2R6MassTermLog_sound : CA1_4_11I2R6MassTermLog.Encloses (Real.log ((∑ a, CA1_4_11I2R6Value a))) := by + exact checkLog_sound logTwoBall_sound (CA1_4_11I2R6Mass_sound) (w := CA1_4_11I2R6MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA1_4_11I2R6MassTerm : Ball := ⟨(15768688021774360428200263096397 / 50000000000000000000000000000000), (803623657 / 5000000000000000000000000000000)⟩ +lemma CA1_4_11I2R6MassTerm_sound : CA1_4_11I2R6MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_4_11I2R6Value a))) := by + exact contains_sound (entropyTerm_ball (CA1_4_11I2R6Mass_sound) CA1_4_11I2R6MassTermLog_sound) (by decide +kernel) +def CA1_4_11I2R6H : Ball := ⟨(2011194980504122776218450247271 / 100000000000000000000000000000000), (16335738663 / 50000000000000000000000000000000)⟩ +lemma CA1_4_11I2R6H_sound : CA1_4_11I2R6H.Encloses (homogeneousEntropy CA1_4_11I2R6Value) := by + exact contains_sound (homogeneous_enclosed CA1_4_11I2R6Value CA1_4_11I2R6MassTerm_sound CA1_4_11I2R6Entropy_sound) (by decide +kernel) +def CA1_4_11I2R7Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 4 11)) (fun u => (stageALaw (shape 1 4 11) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 7 a +def CA1_4_11I2R7Raw (a : PairSlot) : Ball := residualBall (below (shape 1 4 11)) A1_4_11Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 7 a +lemma CA1_4_11I2R7Raw_sound (a : PairSlot) : + (CA1_4_11I2R7Raw a).Encloses (CA1_4_11I2R7Value a) := by + exact residualBall_sound_on (below (shape 1 4 11)) A1_4_11Law (fun u => (stageALaw (shape 1 4 11) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A1_4_11Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 4 11) (show (shape 1 4 11) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 7 a +def CA1_4_11I2R7Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA1_4_11I2R7Certificates_valid : + CA1_4_11I2R7Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_4_11I2R7CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA1_4_11I2R7P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_4_11I2R7Certificates (CA1_4_11I2R7CertificateIndex a)).input +lemma CA1_4_11I2R7P_check : ∀ a : PairSlot, contains (CA1_4_11I2R7Raw a) (CA1_4_11I2R7P a) = true := by + decide +kernel +lemma CA1_4_11I2R7P_sound (a : PairSlot) : + (CA1_4_11I2R7P a).Encloses (CA1_4_11I2R7Value a) := + contains_sound (CA1_4_11I2R7Raw_sound a) (CA1_4_11I2R7P_check a) +def CA1_4_11I2R7Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_4_11I2R7Certificates (CA1_4_11I2R7CertificateIndex a)).output +lemma CA1_4_11I2R7Terms_sound (a : PairSlot) : + (CA1_4_11I2R7Terms a).Encloses (Foundation.entropyTerm (CA1_4_11I2R7Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_4_11I2R7Certificates_valid + (CA1_4_11I2R7CertificateIndex a) (CA1_4_11I2R7P_sound a) +def CA1_4_11I2R7Entropy : Ball := ⟨0, 0⟩ +lemma CA1_4_11I2R7Entropy_sound : CA1_4_11I2R7Entropy.Encloses (Foundation.finiteEntropy CA1_4_11I2R7Value) := by + exact contains_sound (entropyPair_enclosed CA1_4_11I2R7Value CA1_4_11I2R7Terms CA1_4_11I2R7Terms_sound) (by decide +kernel) +def CA1_4_11I2R7Mass : Ball := ⟨0, 0⟩ +lemma CA1_4_11I2R7Mass_sound : CA1_4_11I2R7Mass.Encloses (∑ a, CA1_4_11I2R7Value a) := by + exact contains_sound (pairSumBall_sound CA1_4_11I2R7P CA1_4_11I2R7Value CA1_4_11I2R7P_sound) (by decide +kernel) +def CA1_4_11I2R7MassTerm : Ball := .exact 0 +lemma CA1_4_11I2R7MassTerm_sound : CA1_4_11I2R7MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_4_11I2R7Value a))) := + entropyTerm_zero_ball (CA1_4_11I2R7Mass_sound) +def CA1_4_11I2R7H : Ball := ⟨0, 0⟩ +lemma CA1_4_11I2R7H_sound : CA1_4_11I2R7H.Encloses (homogeneousEntropy CA1_4_11I2R7Value) := by + exact contains_sound (homogeneous_enclosed CA1_4_11I2R7Value CA1_4_11I2R7MassTerm_sound CA1_4_11I2R7Entropy_sound) (by decide +kernel) +def CA1_4_11I2R8Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 4 11)) (fun u => (stageALaw (shape 1 4 11) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 8 a +def CA1_4_11I2R8Raw (a : PairSlot) : Ball := residualBall (below (shape 1 4 11)) A1_4_11Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 8 a +lemma CA1_4_11I2R8Raw_sound (a : PairSlot) : + (CA1_4_11I2R8Raw a).Encloses (CA1_4_11I2R8Value a) := by + exact residualBall_sound_on (below (shape 1 4 11)) A1_4_11Law (fun u => (stageALaw (shape 1 4 11) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A1_4_11Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 4 11) (show (shape 1 4 11) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 8 a +def CA1_4_11I2R8Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA1_4_11I2R8Certificates_valid : + CA1_4_11I2R8Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_4_11I2R8CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA1_4_11I2R8P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_4_11I2R8Certificates (CA1_4_11I2R8CertificateIndex a)).input +lemma CA1_4_11I2R8P_check : ∀ a : PairSlot, contains (CA1_4_11I2R8Raw a) (CA1_4_11I2R8P a) = true := by + decide +kernel +lemma CA1_4_11I2R8P_sound (a : PairSlot) : + (CA1_4_11I2R8P a).Encloses (CA1_4_11I2R8Value a) := + contains_sound (CA1_4_11I2R8Raw_sound a) (CA1_4_11I2R8P_check a) +def CA1_4_11I2R8Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_4_11I2R8Certificates (CA1_4_11I2R8CertificateIndex a)).output +lemma CA1_4_11I2R8Terms_sound (a : PairSlot) : + (CA1_4_11I2R8Terms a).Encloses (Foundation.entropyTerm (CA1_4_11I2R8Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_4_11I2R8Certificates_valid + (CA1_4_11I2R8CertificateIndex a) (CA1_4_11I2R8P_sound a) +def CA1_4_11I2R8Entropy : Ball := ⟨0, 0⟩ +lemma CA1_4_11I2R8Entropy_sound : CA1_4_11I2R8Entropy.Encloses (Foundation.finiteEntropy CA1_4_11I2R8Value) := by + exact contains_sound (entropyPair_enclosed CA1_4_11I2R8Value CA1_4_11I2R8Terms CA1_4_11I2R8Terms_sound) (by decide +kernel) +def CA1_4_11I2R8Mass : Ball := ⟨0, 0⟩ +lemma CA1_4_11I2R8Mass_sound : CA1_4_11I2R8Mass.Encloses (∑ a, CA1_4_11I2R8Value a) := by + exact contains_sound (pairSumBall_sound CA1_4_11I2R8P CA1_4_11I2R8Value CA1_4_11I2R8P_sound) (by decide +kernel) +def CA1_4_11I2R8MassTerm : Ball := .exact 0 +lemma CA1_4_11I2R8MassTerm_sound : CA1_4_11I2R8MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_4_11I2R8Value a))) := + entropyTerm_zero_ball (CA1_4_11I2R8Mass_sound) +def CA1_4_11I2R8H : Ball := ⟨0, 0⟩ +lemma CA1_4_11I2R8H_sound : CA1_4_11I2R8H.Encloses (homogeneousEntropy CA1_4_11I2R8Value) := by + exact contains_sound (homogeneous_enclosed CA1_4_11I2R8Value CA1_4_11I2R8MassTerm_sound CA1_4_11I2R8Entropy_sound) (by decide +kernel) +def CA1_4_11I2R9Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 4 11)) (fun u => (stageALaw (shape 1 4 11) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 9 a +def CA1_4_11I2R9Raw (a : PairSlot) : Ball := residualBall (below (shape 1 4 11)) A1_4_11Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 9 a +lemma CA1_4_11I2R9Raw_sound (a : PairSlot) : + (CA1_4_11I2R9Raw a).Encloses (CA1_4_11I2R9Value a) := by + exact residualBall_sound_on (below (shape 1 4 11)) A1_4_11Law (fun u => (stageALaw (shape 1 4 11) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A1_4_11Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 4 11) (show (shape 1 4 11) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 9 a +def CA1_4_11I2R9Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA1_4_11I2R9Certificates_valid : + CA1_4_11I2R9Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_4_11I2R9CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA1_4_11I2R9P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_4_11I2R9Certificates (CA1_4_11I2R9CertificateIndex a)).input +lemma CA1_4_11I2R9P_check : ∀ a : PairSlot, contains (CA1_4_11I2R9Raw a) (CA1_4_11I2R9P a) = true := by + decide +kernel +lemma CA1_4_11I2R9P_sound (a : PairSlot) : + (CA1_4_11I2R9P a).Encloses (CA1_4_11I2R9Value a) := + contains_sound (CA1_4_11I2R9Raw_sound a) (CA1_4_11I2R9P_check a) +def CA1_4_11I2R9Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_4_11I2R9Certificates (CA1_4_11I2R9CertificateIndex a)).output +lemma CA1_4_11I2R9Terms_sound (a : PairSlot) : + (CA1_4_11I2R9Terms a).Encloses (Foundation.entropyTerm (CA1_4_11I2R9Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_4_11I2R9Certificates_valid + (CA1_4_11I2R9CertificateIndex a) (CA1_4_11I2R9P_sound a) +def CA1_4_11I2R9Entropy : Ball := ⟨0, 0⟩ +lemma CA1_4_11I2R9Entropy_sound : CA1_4_11I2R9Entropy.Encloses (Foundation.finiteEntropy CA1_4_11I2R9Value) := by + exact contains_sound (entropyPair_enclosed CA1_4_11I2R9Value CA1_4_11I2R9Terms CA1_4_11I2R9Terms_sound) (by decide +kernel) +def CA1_4_11I2R9Mass : Ball := ⟨0, 0⟩ +lemma CA1_4_11I2R9Mass_sound : CA1_4_11I2R9Mass.Encloses (∑ a, CA1_4_11I2R9Value a) := by + exact contains_sound (pairSumBall_sound CA1_4_11I2R9P CA1_4_11I2R9Value CA1_4_11I2R9P_sound) (by decide +kernel) +def CA1_4_11I2R9MassTerm : Ball := .exact 0 +lemma CA1_4_11I2R9MassTerm_sound : CA1_4_11I2R9MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_4_11I2R9Value a))) := + entropyTerm_zero_ball (CA1_4_11I2R9Mass_sound) +def CA1_4_11I2R9H : Ball := ⟨0, 0⟩ +lemma CA1_4_11I2R9H_sound : CA1_4_11I2R9H.Encloses (homogeneousEntropy CA1_4_11I2R9Value) := by + exact contains_sound (homogeneous_enclosed CA1_4_11I2R9Value CA1_4_11I2R9MassTerm_sound CA1_4_11I2R9Entropy_sound) (by decide +kernel) +def CA1_4_11I2R10Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 4 11)) (fun u => (stageALaw (shape 1 4 11) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 10 a +def CA1_4_11I2R10Raw (a : PairSlot) : Ball := residualBall (below (shape 1 4 11)) A1_4_11Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 10 a +lemma CA1_4_11I2R10Raw_sound (a : PairSlot) : + (CA1_4_11I2R10Raw a).Encloses (CA1_4_11I2R10Value a) := by + exact residualBall_sound_on (below (shape 1 4 11)) A1_4_11Law (fun u => (stageALaw (shape 1 4 11) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A1_4_11Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 4 11) (show (shape 1 4 11) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 10 a +def CA1_4_11I2R10Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA1_4_11I2R10Certificates_valid : + CA1_4_11I2R10Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_4_11I2R10CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA1_4_11I2R10P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_4_11I2R10Certificates (CA1_4_11I2R10CertificateIndex a)).input +lemma CA1_4_11I2R10P_check : ∀ a : PairSlot, contains (CA1_4_11I2R10Raw a) (CA1_4_11I2R10P a) = true := by + decide +kernel +lemma CA1_4_11I2R10P_sound (a : PairSlot) : + (CA1_4_11I2R10P a).Encloses (CA1_4_11I2R10Value a) := + contains_sound (CA1_4_11I2R10Raw_sound a) (CA1_4_11I2R10P_check a) +def CA1_4_11I2R10Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_4_11I2R10Certificates (CA1_4_11I2R10CertificateIndex a)).output +lemma CA1_4_11I2R10Terms_sound (a : PairSlot) : + (CA1_4_11I2R10Terms a).Encloses (Foundation.entropyTerm (CA1_4_11I2R10Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_4_11I2R10Certificates_valid + (CA1_4_11I2R10CertificateIndex a) (CA1_4_11I2R10P_sound a) +def CA1_4_11I2R10Entropy : Ball := ⟨0, 0⟩ +lemma CA1_4_11I2R10Entropy_sound : CA1_4_11I2R10Entropy.Encloses (Foundation.finiteEntropy CA1_4_11I2R10Value) := by + exact contains_sound (entropyPair_enclosed CA1_4_11I2R10Value CA1_4_11I2R10Terms CA1_4_11I2R10Terms_sound) (by decide +kernel) +def CA1_4_11I2R10Mass : Ball := ⟨0, 0⟩ +lemma CA1_4_11I2R10Mass_sound : CA1_4_11I2R10Mass.Encloses (∑ a, CA1_4_11I2R10Value a) := by + exact contains_sound (pairSumBall_sound CA1_4_11I2R10P CA1_4_11I2R10Value CA1_4_11I2R10P_sound) (by decide +kernel) +def CA1_4_11I2R10MassTerm : Ball := .exact 0 +lemma CA1_4_11I2R10MassTerm_sound : CA1_4_11I2R10MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_4_11I2R10Value a))) := + entropyTerm_zero_ball (CA1_4_11I2R10Mass_sound) +def CA1_4_11I2R10H : Ball := ⟨0, 0⟩ +lemma CA1_4_11I2R10H_sound : CA1_4_11I2R10H.Encloses (homogeneousEntropy CA1_4_11I2R10Value) := by + exact contains_sound (homogeneous_enclosed CA1_4_11I2R10Value CA1_4_11I2R10MassTerm_sound CA1_4_11I2R10Entropy_sound) (by decide +kernel) +def CA1_4_11I2R11Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 4 11)) (fun u => (stageALaw (shape 1 4 11) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 11 a +def CA1_4_11I2R11Raw (a : PairSlot) : Ball := residualBall (below (shape 1 4 11)) A1_4_11Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 11 a +lemma CA1_4_11I2R11Raw_sound (a : PairSlot) : + (CA1_4_11I2R11Raw a).Encloses (CA1_4_11I2R11Value a) := by + exact residualBall_sound_on (below (shape 1 4 11)) A1_4_11Law (fun u => (stageALaw (shape 1 4 11) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A1_4_11Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 4 11) (show (shape 1 4 11) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 11 a +def CA1_4_11I2R11Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA1_4_11I2R11Certificates_valid : + CA1_4_11I2R11Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_4_11I2R11CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA1_4_11I2R11P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_4_11I2R11Certificates (CA1_4_11I2R11CertificateIndex a)).input +lemma CA1_4_11I2R11P_check : ∀ a : PairSlot, contains (CA1_4_11I2R11Raw a) (CA1_4_11I2R11P a) = true := by + decide +kernel +lemma CA1_4_11I2R11P_sound (a : PairSlot) : + (CA1_4_11I2R11P a).Encloses (CA1_4_11I2R11Value a) := + contains_sound (CA1_4_11I2R11Raw_sound a) (CA1_4_11I2R11P_check a) +def CA1_4_11I2R11Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_4_11I2R11Certificates (CA1_4_11I2R11CertificateIndex a)).output +lemma CA1_4_11I2R11Terms_sound (a : PairSlot) : + (CA1_4_11I2R11Terms a).Encloses (Foundation.entropyTerm (CA1_4_11I2R11Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_4_11I2R11Certificates_valid + (CA1_4_11I2R11CertificateIndex a) (CA1_4_11I2R11P_sound a) +def CA1_4_11I2R11Entropy : Ball := ⟨0, 0⟩ +lemma CA1_4_11I2R11Entropy_sound : CA1_4_11I2R11Entropy.Encloses (Foundation.finiteEntropy CA1_4_11I2R11Value) := by + exact contains_sound (entropyPair_enclosed CA1_4_11I2R11Value CA1_4_11I2R11Terms CA1_4_11I2R11Terms_sound) (by decide +kernel) +def CA1_4_11I2R11Mass : Ball := ⟨0, 0⟩ +lemma CA1_4_11I2R11Mass_sound : CA1_4_11I2R11Mass.Encloses (∑ a, CA1_4_11I2R11Value a) := by + exact contains_sound (pairSumBall_sound CA1_4_11I2R11P CA1_4_11I2R11Value CA1_4_11I2R11P_sound) (by decide +kernel) +def CA1_4_11I2R11MassTerm : Ball := .exact 0 +lemma CA1_4_11I2R11MassTerm_sound : CA1_4_11I2R11MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_4_11I2R11Value a))) := + entropyTerm_zero_ball (CA1_4_11I2R11Mass_sound) +def CA1_4_11I2R11H : Ball := ⟨0, 0⟩ +lemma CA1_4_11I2R11H_sound : CA1_4_11I2R11H.Encloses (homogeneousEntropy CA1_4_11I2R11Value) := by + exact contains_sound (homogeneous_enclosed CA1_4_11I2R11Value CA1_4_11I2R11MassTerm_sound CA1_4_11I2R11Entropy_sound) (by decide +kernel) +def CA1_4_11I2R12Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 4 11)) (fun u => (stageALaw (shape 1 4 11) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 12 a +def CA1_4_11I2R12Raw (a : PairSlot) : Ball := residualBall (below (shape 1 4 11)) A1_4_11Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 12 a +lemma CA1_4_11I2R12Raw_sound (a : PairSlot) : + (CA1_4_11I2R12Raw a).Encloses (CA1_4_11I2R12Value a) := by + exact residualBall_sound_on (below (shape 1 4 11)) A1_4_11Law (fun u => (stageALaw (shape 1 4 11) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A1_4_11Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 4 11) (show (shape 1 4 11) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 12 a +def CA1_4_11I2R12Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA1_4_11I2R12Certificates_valid : + CA1_4_11I2R12Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_4_11I2R12CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA1_4_11I2R12P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_4_11I2R12Certificates (CA1_4_11I2R12CertificateIndex a)).input +lemma CA1_4_11I2R12P_check : ∀ a : PairSlot, contains (CA1_4_11I2R12Raw a) (CA1_4_11I2R12P a) = true := by + decide +kernel +lemma CA1_4_11I2R12P_sound (a : PairSlot) : + (CA1_4_11I2R12P a).Encloses (CA1_4_11I2R12Value a) := + contains_sound (CA1_4_11I2R12Raw_sound a) (CA1_4_11I2R12P_check a) +def CA1_4_11I2R12Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_4_11I2R12Certificates (CA1_4_11I2R12CertificateIndex a)).output +lemma CA1_4_11I2R12Terms_sound (a : PairSlot) : + (CA1_4_11I2R12Terms a).Encloses (Foundation.entropyTerm (CA1_4_11I2R12Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_4_11I2R12Certificates_valid + (CA1_4_11I2R12CertificateIndex a) (CA1_4_11I2R12P_sound a) +def CA1_4_11I2R12Entropy : Ball := ⟨0, 0⟩ +lemma CA1_4_11I2R12Entropy_sound : CA1_4_11I2R12Entropy.Encloses (Foundation.finiteEntropy CA1_4_11I2R12Value) := by + exact contains_sound (entropyPair_enclosed CA1_4_11I2R12Value CA1_4_11I2R12Terms CA1_4_11I2R12Terms_sound) (by decide +kernel) +def CA1_4_11I2R12Mass : Ball := ⟨0, 0⟩ +lemma CA1_4_11I2R12Mass_sound : CA1_4_11I2R12Mass.Encloses (∑ a, CA1_4_11I2R12Value a) := by + exact contains_sound (pairSumBall_sound CA1_4_11I2R12P CA1_4_11I2R12Value CA1_4_11I2R12P_sound) (by decide +kernel) +def CA1_4_11I2R12MassTerm : Ball := .exact 0 +lemma CA1_4_11I2R12MassTerm_sound : CA1_4_11I2R12MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_4_11I2R12Value a))) := + entropyTerm_zero_ball (CA1_4_11I2R12Mass_sound) +def CA1_4_11I2R12H : Ball := ⟨0, 0⟩ +lemma CA1_4_11I2R12H_sound : CA1_4_11I2R12H.Encloses (homogeneousEntropy CA1_4_11I2R12Value) := by + exact contains_sound (homogeneous_enclosed CA1_4_11I2R12Value CA1_4_11I2R12MassTerm_sound CA1_4_11I2R12Entropy_sound) (by decide +kernel) +def CA1_4_11I2R13Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 4 11)) (fun u => (stageALaw (shape 1 4 11) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 13 a +def CA1_4_11I2R13Raw (a : PairSlot) : Ball := residualBall (below (shape 1 4 11)) A1_4_11Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 13 a +lemma CA1_4_11I2R13Raw_sound (a : PairSlot) : + (CA1_4_11I2R13Raw a).Encloses (CA1_4_11I2R13Value a) := by + exact residualBall_sound_on (below (shape 1 4 11)) A1_4_11Law (fun u => (stageALaw (shape 1 4 11) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A1_4_11Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 4 11) (show (shape 1 4 11) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 13 a +def CA1_4_11I2R13Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA1_4_11I2R13Certificates_valid : + CA1_4_11I2R13Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_4_11I2R13CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA1_4_11I2R13P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_4_11I2R13Certificates (CA1_4_11I2R13CertificateIndex a)).input +lemma CA1_4_11I2R13P_check : ∀ a : PairSlot, contains (CA1_4_11I2R13Raw a) (CA1_4_11I2R13P a) = true := by + decide +kernel +lemma CA1_4_11I2R13P_sound (a : PairSlot) : + (CA1_4_11I2R13P a).Encloses (CA1_4_11I2R13Value a) := + contains_sound (CA1_4_11I2R13Raw_sound a) (CA1_4_11I2R13P_check a) +def CA1_4_11I2R13Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_4_11I2R13Certificates (CA1_4_11I2R13CertificateIndex a)).output +lemma CA1_4_11I2R13Terms_sound (a : PairSlot) : + (CA1_4_11I2R13Terms a).Encloses (Foundation.entropyTerm (CA1_4_11I2R13Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_4_11I2R13Certificates_valid + (CA1_4_11I2R13CertificateIndex a) (CA1_4_11I2R13P_sound a) +def CA1_4_11I2R13Entropy : Ball := ⟨0, 0⟩ +lemma CA1_4_11I2R13Entropy_sound : CA1_4_11I2R13Entropy.Encloses (Foundation.finiteEntropy CA1_4_11I2R13Value) := by + exact contains_sound (entropyPair_enclosed CA1_4_11I2R13Value CA1_4_11I2R13Terms CA1_4_11I2R13Terms_sound) (by decide +kernel) +def CA1_4_11I2R13Mass : Ball := ⟨0, 0⟩ +lemma CA1_4_11I2R13Mass_sound : CA1_4_11I2R13Mass.Encloses (∑ a, CA1_4_11I2R13Value a) := by + exact contains_sound (pairSumBall_sound CA1_4_11I2R13P CA1_4_11I2R13Value CA1_4_11I2R13P_sound) (by decide +kernel) +def CA1_4_11I2R13MassTerm : Ball := .exact 0 +lemma CA1_4_11I2R13MassTerm_sound : CA1_4_11I2R13MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_4_11I2R13Value a))) := + entropyTerm_zero_ball (CA1_4_11I2R13Mass_sound) +def CA1_4_11I2R13H : Ball := ⟨0, 0⟩ +lemma CA1_4_11I2R13H_sound : CA1_4_11I2R13H.Encloses (homogeneousEntropy CA1_4_11I2R13Value) := by + exact contains_sound (homogeneous_enclosed CA1_4_11I2R13Value CA1_4_11I2R13MassTerm_sound CA1_4_11I2R13Entropy_sound) (by decide +kernel) +def CA1_4_11I2R14Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 4 11)) (fun u => (stageALaw (shape 1 4 11) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 14 a +def CA1_4_11I2R14Raw (a : PairSlot) : Ball := residualBall (below (shape 1 4 11)) A1_4_11Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 14 a +lemma CA1_4_11I2R14Raw_sound (a : PairSlot) : + (CA1_4_11I2R14Raw a).Encloses (CA1_4_11I2R14Value a) := by + exact residualBall_sound_on (below (shape 1 4 11)) A1_4_11Law (fun u => (stageALaw (shape 1 4 11) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A1_4_11Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 4 11) (show (shape 1 4 11) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 14 a +def CA1_4_11I2R14Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA1_4_11I2R14Certificates_valid : + CA1_4_11I2R14Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_4_11I2R14CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA1_4_11I2R14P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_4_11I2R14Certificates (CA1_4_11I2R14CertificateIndex a)).input +lemma CA1_4_11I2R14P_check : ∀ a : PairSlot, contains (CA1_4_11I2R14Raw a) (CA1_4_11I2R14P a) = true := by + decide +kernel +lemma CA1_4_11I2R14P_sound (a : PairSlot) : + (CA1_4_11I2R14P a).Encloses (CA1_4_11I2R14Value a) := + contains_sound (CA1_4_11I2R14Raw_sound a) (CA1_4_11I2R14P_check a) +def CA1_4_11I2R14Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_4_11I2R14Certificates (CA1_4_11I2R14CertificateIndex a)).output +lemma CA1_4_11I2R14Terms_sound (a : PairSlot) : + (CA1_4_11I2R14Terms a).Encloses (Foundation.entropyTerm (CA1_4_11I2R14Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_4_11I2R14Certificates_valid + (CA1_4_11I2R14CertificateIndex a) (CA1_4_11I2R14P_sound a) +def CA1_4_11I2R14Entropy : Ball := ⟨0, 0⟩ +lemma CA1_4_11I2R14Entropy_sound : CA1_4_11I2R14Entropy.Encloses (Foundation.finiteEntropy CA1_4_11I2R14Value) := by + exact contains_sound (entropyPair_enclosed CA1_4_11I2R14Value CA1_4_11I2R14Terms CA1_4_11I2R14Terms_sound) (by decide +kernel) +def CA1_4_11I2R14Mass : Ball := ⟨0, 0⟩ +lemma CA1_4_11I2R14Mass_sound : CA1_4_11I2R14Mass.Encloses (∑ a, CA1_4_11I2R14Value a) := by + exact contains_sound (pairSumBall_sound CA1_4_11I2R14P CA1_4_11I2R14Value CA1_4_11I2R14P_sound) (by decide +kernel) +def CA1_4_11I2R14MassTerm : Ball := .exact 0 +lemma CA1_4_11I2R14MassTerm_sound : CA1_4_11I2R14MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_4_11I2R14Value a))) := + entropyTerm_zero_ball (CA1_4_11I2R14Mass_sound) +def CA1_4_11I2R14H : Ball := ⟨0, 0⟩ +lemma CA1_4_11I2R14H_sound : CA1_4_11I2R14H.Encloses (homogeneousEntropy CA1_4_11I2R14Value) := by + exact contains_sound (homogeneous_enclosed CA1_4_11I2R14Value CA1_4_11I2R14MassTerm_sound CA1_4_11I2R14Entropy_sound) (by decide +kernel) +def CA1_4_11I2R15Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 4 11)) (fun u => (stageALaw (shape 1 4 11) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 15 a +def CA1_4_11I2R15Raw (a : PairSlot) : Ball := residualBall (below (shape 1 4 11)) A1_4_11Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 15 a +lemma CA1_4_11I2R15Raw_sound (a : PairSlot) : + (CA1_4_11I2R15Raw a).Encloses (CA1_4_11I2R15Value a) := by + exact residualBall_sound_on (below (shape 1 4 11)) A1_4_11Law (fun u => (stageALaw (shape 1 4 11) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A1_4_11Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 4 11) (show (shape 1 4 11) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 15 a +def CA1_4_11I2R15Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA1_4_11I2R15Certificates_valid : + CA1_4_11I2R15Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_4_11I2R15CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA1_4_11I2R15P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_4_11I2R15Certificates (CA1_4_11I2R15CertificateIndex a)).input +lemma CA1_4_11I2R15P_check : ∀ a : PairSlot, contains (CA1_4_11I2R15Raw a) (CA1_4_11I2R15P a) = true := by + decide +kernel +lemma CA1_4_11I2R15P_sound (a : PairSlot) : + (CA1_4_11I2R15P a).Encloses (CA1_4_11I2R15Value a) := + contains_sound (CA1_4_11I2R15Raw_sound a) (CA1_4_11I2R15P_check a) +def CA1_4_11I2R15Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_4_11I2R15Certificates (CA1_4_11I2R15CertificateIndex a)).output +lemma CA1_4_11I2R15Terms_sound (a : PairSlot) : + (CA1_4_11I2R15Terms a).Encloses (Foundation.entropyTerm (CA1_4_11I2R15Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_4_11I2R15Certificates_valid + (CA1_4_11I2R15CertificateIndex a) (CA1_4_11I2R15P_sound a) +def CA1_4_11I2R15Entropy : Ball := ⟨0, 0⟩ +lemma CA1_4_11I2R15Entropy_sound : CA1_4_11I2R15Entropy.Encloses (Foundation.finiteEntropy CA1_4_11I2R15Value) := by + exact contains_sound (entropyPair_enclosed CA1_4_11I2R15Value CA1_4_11I2R15Terms CA1_4_11I2R15Terms_sound) (by decide +kernel) +def CA1_4_11I2R15Mass : Ball := ⟨0, 0⟩ +lemma CA1_4_11I2R15Mass_sound : CA1_4_11I2R15Mass.Encloses (∑ a, CA1_4_11I2R15Value a) := by + exact contains_sound (pairSumBall_sound CA1_4_11I2R15P CA1_4_11I2R15Value CA1_4_11I2R15P_sound) (by decide +kernel) +def CA1_4_11I2R15MassTerm : Ball := .exact 0 +lemma CA1_4_11I2R15MassTerm_sound : CA1_4_11I2R15MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_4_11I2R15Value a))) := + entropyTerm_zero_ball (CA1_4_11I2R15Mass_sound) +def CA1_4_11I2R15H : Ball := ⟨0, 0⟩ +lemma CA1_4_11I2R15H_sound : CA1_4_11I2R15H.Encloses (homogeneousEntropy CA1_4_11I2R15Value) := by + exact contains_sound (homogeneous_enclosed CA1_4_11I2R15Value CA1_4_11I2R15MassTerm_sound CA1_4_11I2R15Entropy_sound) (by decide +kernel) +def CA1_4_11I2R16Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 4 11)) (fun u => (stageALaw (shape 1 4 11) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 16 a +def CA1_4_11I2R16Raw (a : PairSlot) : Ball := residualBall (below (shape 1 4 11)) A1_4_11Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 16 a +lemma CA1_4_11I2R16Raw_sound (a : PairSlot) : + (CA1_4_11I2R16Raw a).Encloses (CA1_4_11I2R16Value a) := by + exact residualBall_sound_on (below (shape 1 4 11)) A1_4_11Law (fun u => (stageALaw (shape 1 4 11) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A1_4_11Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 4 11) (show (shape 1 4 11) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 16 a +def CA1_4_11I2R16Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA1_4_11I2R16Certificates_valid : + CA1_4_11I2R16Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_4_11I2R16CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA1_4_11I2R16P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_4_11I2R16Certificates (CA1_4_11I2R16CertificateIndex a)).input +lemma CA1_4_11I2R16P_check : ∀ a : PairSlot, contains (CA1_4_11I2R16Raw a) (CA1_4_11I2R16P a) = true := by + decide +kernel +lemma CA1_4_11I2R16P_sound (a : PairSlot) : + (CA1_4_11I2R16P a).Encloses (CA1_4_11I2R16Value a) := + contains_sound (CA1_4_11I2R16Raw_sound a) (CA1_4_11I2R16P_check a) +def CA1_4_11I2R16Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_4_11I2R16Certificates (CA1_4_11I2R16CertificateIndex a)).output +lemma CA1_4_11I2R16Terms_sound (a : PairSlot) : + (CA1_4_11I2R16Terms a).Encloses (Foundation.entropyTerm (CA1_4_11I2R16Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_4_11I2R16Certificates_valid + (CA1_4_11I2R16CertificateIndex a) (CA1_4_11I2R16P_sound a) +def CA1_4_11I2R16Entropy : Ball := ⟨0, 0⟩ +lemma CA1_4_11I2R16Entropy_sound : CA1_4_11I2R16Entropy.Encloses (Foundation.finiteEntropy CA1_4_11I2R16Value) := by + exact contains_sound (entropyPair_enclosed CA1_4_11I2R16Value CA1_4_11I2R16Terms CA1_4_11I2R16Terms_sound) (by decide +kernel) +def CA1_4_11I2R16Mass : Ball := ⟨0, 0⟩ +lemma CA1_4_11I2R16Mass_sound : CA1_4_11I2R16Mass.Encloses (∑ a, CA1_4_11I2R16Value a) := by + exact contains_sound (pairSumBall_sound CA1_4_11I2R16P CA1_4_11I2R16Value CA1_4_11I2R16P_sound) (by decide +kernel) +def CA1_4_11I2R16MassTerm : Ball := .exact 0 +lemma CA1_4_11I2R16MassTerm_sound : CA1_4_11I2R16MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_4_11I2R16Value a))) := + entropyTerm_zero_ball (CA1_4_11I2R16Mass_sound) +def CA1_4_11I2R16H : Ball := ⟨0, 0⟩ +lemma CA1_4_11I2R16H_sound : CA1_4_11I2R16H.Encloses (homogeneousEntropy CA1_4_11I2R16Value) := by + exact contains_sound (homogeneous_enclosed CA1_4_11I2R16Value CA1_4_11I2R16MassTerm_sound CA1_4_11I2R16Entropy_sound) (by decide +kernel) +def CA1_4_11I2ResidualEntropies (a : Fin 17) : Ball := + match a.val with + | 0 => CA1_4_11I2R0H + | 1 => CA1_4_11I2R1H + | 2 => CA1_4_11I2R2H + | 3 => CA1_4_11I2R3H + | 4 => CA1_4_11I2R4H + | 5 => CA1_4_11I2R5H + | 6 => CA1_4_11I2R6H + | 7 => CA1_4_11I2R7H + | 8 => CA1_4_11I2R8H + | 9 => CA1_4_11I2R9H + | 10 => CA1_4_11I2R10H + | 11 => CA1_4_11I2R11H + | 12 => CA1_4_11I2R12H + | 13 => CA1_4_11I2R13H + | 14 => CA1_4_11I2R14H + | 15 => CA1_4_11I2R15H + | 16 => CA1_4_11I2R16H + | _ => (.exact 0) +lemma CA1_4_11I2ResidualEntropies_sound (k : Fin 17) : + (CA1_4_11I2ResidualEntropies k).Encloses (homogeneousEntropy + (residualLaw (below (shape 1 4 11)) (fun u => (stageALaw (shape 1 4 11) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) k)) := by + fin_cases k + · exact CA1_4_11I2R0H_sound + · exact CA1_4_11I2R1H_sound + · exact CA1_4_11I2R2H_sound + · exact CA1_4_11I2R3H_sound + · exact CA1_4_11I2R4H_sound + · exact CA1_4_11I2R5H_sound + · exact CA1_4_11I2R6H_sound + · exact CA1_4_11I2R7H_sound + · exact CA1_4_11I2R8H_sound + · exact CA1_4_11I2R9H_sound + · exact CA1_4_11I2R10H_sound + · exact CA1_4_11I2R11H_sound + · exact CA1_4_11I2R12H_sound + · exact CA1_4_11I2R13H_sound + · exact CA1_4_11I2R14H_sound + · exact CA1_4_11I2R15H_sound + · exact CA1_4_11I2R16H_sound +def CA1_4_11I2Singles (s : Shape) : Ball := + match s 0, s 1, s 2 with + | 0, 0, 8 => Z0_0_8H2H + | 0, 1, 7 => Z0_1_7H2H + | 0, 2, 6 => Z0_2_6H2H + | 0, 3, 5 => Z0_3_5H2H + | 0, 4, 4 => Z0_4_4H2H + | 1, 0, 7 => Z1_0_7H2H + | _, _, _ => (.exact 0) +lemma CA1_4_11I2Singles_sound (u : Shape) (hu : u ∈ below (shape 1 4 11)) + (hd : designated (Equiv.refl (Fin 3)) 2 u) : + (CA1_4_11I2Singles u).Encloses (homogeneousEntropy ((fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) u)) := by + rw [A1_4_11_below] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl + · exact Z0_0_8H2H_sound + · exact Z0_1_7H2H_sound + · exact Z0_2_6H2H_sound + · exact Z0_3_5H2H_sound + · exact Z0_4_4H2H_sound + · exact Z1_0_7H2H_sound + · exact (show ¬ designated (Equiv.refl (Fin 3)) 2 (shape 1 1 6) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 2 (shape 1 2 5) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 2 (shape 1 3 4) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 2 (shape 1 4 3) by decide +kernel) hd |>.elim +def CA1_4_11I2Singleton : Ball := ⟨(56488132491887973451105759346661 / 100000000000000000000000000000000), (24495359647 / 50000000000000000000000000000000)⟩ +lemma CA1_4_11I2Singleton_sound : CA1_4_11I2Singleton.Encloses + (singletonEntropy (below (shape 1 4 11)) (fun u => (stageALaw (shape 1 4 11) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ))) := by + exact contains_sound (singletonBall_sound (below (shape 1 4 11)) A1_4_11Law (fun u => (stageALaw (shape 1 4 11) u : ℝ)) (Equiv.refl (Fin 3)) 2 + CA1_4_11I2Singles (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A1_4_11Law_sound u) CA1_4_11I2Singles_sound) (by decide +kernel) +def CA1_4_11I2Group : Ball := ⟨(83101113099853601859582796525217 / 100000000000000000000000000000000), (135855538473 / 100000000000000000000000000000000)⟩ +lemma CA1_4_11I2Group_sound : CA1_4_11I2Group.Encloses + (groupedEntropy (below (shape 1 4 11)) (fun u => (stageALaw (shape 1 4 11) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ))) := by + exact contains_sound (Ball.add_sound CA1_4_11I2Singleton_sound + (finSumBall_sound 17 CA1_4_11I2ResidualEntropies _ CA1_4_11I2ResidualEntropies_sound)) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CA1_4_11I2H : Ball := ⟨(59929193861874398734103464755227 / 50000000000000000000000000000000), (430750192949 / 100000000000000000000000000000000)⟩ +lemma CA1_4_11I2_sound : CA1_4_11I2H.Encloses (stageACapacity (shape 1 4 11) 2) := by + have hb := contains_sound (Ball.add_sound CA1_4_11I2PairH_sound + (Ball.neg_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) CA1_4_11I2Group_sound))) + (show contains (.add CA1_4_11I2PairH (.neg (.mul (.exact 2) CA1_4_11I2Group))) CA1_4_11I2H = true by decide +kernel) + unfold CA1_4_11I2PairValue at hb + simpa only [stageACapacity, nativeCapacity, + show (2 : Fin 3) ≠ 0 by decide, ite_false, sub_eq_add_neg] using hb + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA1_5_10I0.lean b/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA1_5_10I0.lean new file mode 100644 index 0000000000000000000000000000000000000000..6078e52849980f9e4f23e11bf4d88e427b051c5b --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA1_5_10I0.lean @@ -0,0 +1,72 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Certificates.SplitB1_3_4 + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CA1_5_10I0Value (a : Fin 17) : ℝ := marginal (below (shape 1 5 10)) (fun u => (stageALaw (shape 1 5 10) u : ℝ)) ((Equiv.refl (Fin 3)) 0) a +def CA1_5_10I0Raw (a : Fin 17) : Ball := marginalBall (below (shape 1 5 10)) A1_5_10Law ((Equiv.refl (Fin 3)) 0) a +lemma CA1_5_10I0Raw_sound (a : Fin 17) : + (CA1_5_10I0Raw a).Encloses (CA1_5_10I0Value a) := by + exact marginalBall_sound (below (shape 1 5 10)) A1_5_10Law (fun u => (stageALaw (shape 1 5 10) u : ℝ)) (fun u _ => A1_5_10Law_sound u) ((Equiv.refl (Fin 3)) 0) a +def CA1_5_10I0Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(49999999999999999999999999999999 / 100000000000000000000000000000000), (21 / 25000000000000000000000000000000)⟩ ⟨(6931471805599453094172319305033 / 20000000000000000000000000000000), (31763735667 / 100000000000000000000000000000000)⟩ ⟨(-69314718055994530941723193050331 / 100000000000000000000000000000000), (63527471217 / 100000000000000000000000000000000)⟩ ⟨-2, 49999999999999999999999999999999, 25000000000000000000000000000000⟩] +lemma CA1_5_10I0Certificates_valid : + CA1_5_10I0Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_5_10I0CertificateIndex (a : Fin 17) : ℕ := + match a.val with + | 0 => 1 + | 1 => 1 + | _ => 0 +def CA1_5_10I0P (a : Fin 17) : Ball := + (CompactCertificate.entropyLookup CA1_5_10I0Certificates (CA1_5_10I0CertificateIndex a)).input +lemma CA1_5_10I0P_check : ∀ a : Fin 17, contains (CA1_5_10I0Raw a) (CA1_5_10I0P a) = true := by + decide +kernel +lemma CA1_5_10I0P_sound (a : Fin 17) : + (CA1_5_10I0P a).Encloses (CA1_5_10I0Value a) := + contains_sound (CA1_5_10I0Raw_sound a) (CA1_5_10I0P_check a) +def CA1_5_10I0Terms (a : Fin 17) : Ball := + (CompactCertificate.entropyLookup CA1_5_10I0Certificates (CA1_5_10I0CertificateIndex a)).output +lemma CA1_5_10I0Terms_sound (a : Fin 17) : + (CA1_5_10I0Terms a).Encloses (Foundation.entropyTerm (CA1_5_10I0Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_5_10I0Certificates_valid + (CA1_5_10I0CertificateIndex a) (CA1_5_10I0P_sound a) +def CA1_5_10I0Entropy : Ball := ⟨(6931471805599453094172319305033 / 10000000000000000000000000000000), (31763735667 / 50000000000000000000000000000000)⟩ +lemma CA1_5_10I0Entropy_sound : CA1_5_10I0Entropy.Encloses (Foundation.finiteEntropy CA1_5_10I0Value) := by + exact contains_sound (entropyFin_enclosed 17 CA1_5_10I0Value CA1_5_10I0Terms CA1_5_10I0Terms_sound) (by decide +kernel) +def CA1_5_10I0Mass : Ball := ⟨(49999999999999999999999999999999 / 50000000000000000000000000000000), (21 / 12500000000000000000000000000000)⟩ +lemma CA1_5_10I0Mass_sound : CA1_5_10I0Mass.Encloses (∑ a, CA1_5_10I0Value a) := by + exact contains_sound (finSumBall_sound 17 CA1_5_10I0P CA1_5_10I0Value CA1_5_10I0P_sound) (by decide +kernel) +def CA1_5_10I0MassTermLogWitness : LogWitness := ⟨-1, 49999999999999999999999999999999, 25000000000000000000000000000000⟩ +def CA1_5_10I0MassTermLog : Ball := ⟨(-1 / 100000000000000000000000000000000), (21175823767 / 50000000000000000000000000000000)⟩ +lemma CA1_5_10I0MassTermLog_sound : CA1_5_10I0MassTermLog.Encloses (Real.log ((∑ a, CA1_5_10I0Value a))) := by + exact checkLog_sound logTwoBall_sound (CA1_5_10I0Mass_sound) (w := CA1_5_10I0MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA1_5_10I0MassTerm : Ball := ⟨(1 / 100000000000000000000000000000000), (8470329507 / 20000000000000000000000000000000)⟩ +lemma CA1_5_10I0MassTerm_sound : CA1_5_10I0MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_5_10I0Value a))) := by + exact contains_sound (entropyTerm_ball (CA1_5_10I0Mass_sound) CA1_5_10I0MassTermLog_sound) (by decide +kernel) +def CA1_5_10I0H : Ball := ⟨(69314718055994530941723193050329 / 100000000000000000000000000000000), (105879118869 / 100000000000000000000000000000000)⟩ +lemma CA1_5_10I0H_sound : CA1_5_10I0H.Encloses (homogeneousEntropy CA1_5_10I0Value) := by + exact contains_sound (homogeneous_enclosed CA1_5_10I0Value CA1_5_10I0MassTerm_sound CA1_5_10I0Entropy_sound) (by decide +kernel) +lemma CA1_5_10I0_sound : CA1_5_10I0H.Encloses (stageACapacity (shape 1 5 10) 0) := by + exact CA1_5_10I0H_sound + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA1_5_10I1.lean b/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA1_5_10I1.lean new file mode 100644 index 0000000000000000000000000000000000000000..90a9a3d9f073ad04206543bd45ca7b02393326e7 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA1_5_10I1.lean @@ -0,0 +1,1094 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Certificates.SupportedContraction + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CA1_5_10I1PairValue (a : PairSlot × PairSlot) : ℝ := pairLaw (below (shape 1 5 10)) (shape 1 5 10) (fun u => (stageALaw (shape 1 5 10) u : ℝ)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) a +def CA1_5_10I1PairRaw (a : PairSlot × PairSlot) : Ball := stageAPairBall (shape 1 5 10) A1_5_10Law 1 a +lemma CA1_5_10I1PairRaw_sound (a : PairSlot × PairSlot) : + (CA1_5_10I1PairRaw a).Encloses (CA1_5_10I1PairValue a) := by + exact stageAPairBall_sound (shape 1 5 10) (by decide +kernel) A1_5_10Law (fun u => (stageALaw (shape 1 5 10) u : ℝ)) (fun u _ => A1_5_10Law_sound u) 1 a +def CA1_5_10I1PairCertificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(22268884945206414182146674039 / 20000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ ⟨(47323448329967572271861989909 / 6250000000000000000000000000000), (129679553 / 50000000000000000000000000000000)⟩ ⟨(-170007428558399866366735946547719 / 25000000000000000000000000000000), (232934062309 / 100000000000000000000000000000000)⟩ ⟨-10, 22268884945206414182146674039, 19531250000000000000000000000⟩, + .log ⟨(5073240300123497419871639527 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(93304991677621678275312218259 / 100000000000000000000000000000000), (1007157 / 3125000000000000000000000000000)⟩ ⟨(-91957985585021828636861036394861 / 10000000000000000000000000000000), (3176373651 / 1000000000000000000000000000000)⟩ ⟨-14, 5073240300123497419871639527, 3051757812500000000000000000⟩, + .log ⟨(5438635077537771407403874419 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(53404118816045124414143044197 / 100000000000000000000000000000000), (2303353 / 12500000000000000000000000000000)⟩ ⟨(-122742466755608112311191459318267 / 12500000000000000000000000000000), (67762639463 / 20000000000000000000000000000000)⟩ ⟨-15, 5438635077537771407403874419, 3051757812500000000000000000⟩, + .log ⟨(503707182470066923959310737177 / 100000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ ⟨(1332539810352274052911456223889 / 50000000000000000000000000000000), (959977323 / 100000000000000000000000000000000)⟩ ⟨(-21163721411599461767867524868173 / 4000000000000000000000000000000), (95291206871 / 50000000000000000000000000000000)⟩ ⟨-8, 503707182470066923959310737177, 390625000000000000000000000000⟩, + .log ⟨(255193173092274822371952880777 / 10000000000000000000000000000000), (7 / 50000000000000000000000000000000)⟩ ⟨(9361301115128316629100104983021 / 100000000000000000000000000000000), (3782748013 / 100000000000000000000000000000000)⟩ ⟨(-73366391441383749399422062155569 / 20000000000000000000000000000000), (148230766329 / 100000000000000000000000000000000)⟩ ⟨-6, 255193173092274822371952880777, 156250000000000000000000000000⟩, + .log ⟨(125699728194725478810433817933 / 50000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ ⟨(60193902562488651779210685601 / 4000000000000000000000000000000), (532359071 / 100000000000000000000000000000000)⟩ ⟨(-74823529139369373198258005927601 / 12500000000000000000000000000000), (1694065901 / 800000000000000000000000000000)⟩ ⟨-9, 125699728194725478810433817933, 97656250000000000000000000000⟩, + .log ⟨(12924529061909621010619436253 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(106765027808725347330636653301 / 50000000000000000000000000000000), (71158773 / 100000000000000000000000000000000)⟩ ⟨(-413032565044774768934775549269317 / 50000000000000000000000000000000), (275285711747 / 100000000000000000000000000000000)⟩ ⟨-12, 12924529061909621010619436253, 12207031250000000000000000000⟩, + .log ⟨(7241760128070376296042527833 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(1380722846529755478347343081 / 2000000000000000000000000000000), (23002547 / 100000000000000000000000000000000)⟩ ⟨(-119163264706343902913200946417513 / 12500000000000000000000000000000), (317637369053 / 100000000000000000000000000000000)⟩ ⟨-14, 7241760128070376296042527833, 6103515625000000000000000000⟩, + .log ⟨(78309427042427579441955721699 / 50000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ ⟨(1011618452372932438045376250439 / 100000000000000000000000000000000), (22801167 / 6250000000000000000000000000000)⟩ ⟨(-161477757305139585549445375081577 / 25000000000000000000000000000000), (23293406179 / 10000000000000000000000000000000)⟩ ⟨-10, 78309427042427579441955721699, 48828125000000000000000000000⟩, + .log ⟨(3154898529883487505530600990651 / 100000000000000000000000000000000), (3 / 20000000000000000000000000000000)⟩ ⟨(5452002000629977185954074050957 / 50000000000000000000000000000000), (501056821 / 12500000000000000000000000000000)⟩ ⟨(-345621385219721994331378287963377 / 100000000000000000000000000000000), (127054942573 / 100000000000000000000000000000000)⟩ ⟨-5, 3154898529883487505530600990651, 3125000000000000000000000000000⟩, + .log ⟨(7698603852803860679159811007 / 2500000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ ⟨(1780843203845114424029959940873 / 100000000000000000000000000000000), (5216777 / 800000000000000000000000000000)⟩ ⟨(-144575175406359929211606310492157 / 25000000000000000000000000000000), (211758237479 / 100000000000000000000000000000000)⟩ ⟨-9, 7698603852803860679159811007, 4882812500000000000000000000⟩, + .log ⟨(15955597746132917085758812853 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(34875409454573142592713603831 / 25000000000000000000000000000000), (2365111 / 5000000000000000000000000000000)⟩ ⟨(-874311574143957871285697078124269 / 100000000000000000000000000000000), (296461537829 / 100000000000000000000000000000000)⟩ ⟨-13, 15955597746132917085758812853, 12207031250000000000000000000⟩, + .log ⟨(308702927519657890792613245011 / 100000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ ⟨(356894297667234668311633767527 / 20000000000000000000000000000000), (653703891 / 100000000000000000000000000000000)⟩ ⟨(-289027302506313290239710288398163 / 50000000000000000000000000000000), (105879118739 / 50000000000000000000000000000000)⟩ ⟨-9, 308702927519657890792613245011, 195312500000000000000000000000⟩, + .log ⟨(30216127494741087159206101773 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(244888105817775592438390103263 / 100000000000000000000000000000000), (8318069 / 10000000000000000000000000000000)⟩ ⟨(-810454966012427346008748038820529 / 100000000000000000000000000000000), (68821427797 / 25000000000000000000000000000000)⟩ ⟨-12, 30216127494741087159206101773, 24414062500000000000000000000⟩, + .log ⟨(573369051292370077537550288831 / 100000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ ⟨(2959384663076721829910329755453 / 100000000000000000000000000000000), (546370297 / 50000000000000000000000000000000)⟩ ⟨(-516139588700556513683282065940681 / 100000000000000000000000000000000), (19058241367 / 10000000000000000000000000000000)⟩ ⟨-8, 573369051292370077537550288831, 390625000000000000000000000000⟩, + .log ⟨(5578469393746635659764022855967 / 50000000000000000000000000000000), (19 / 50000000000000000000000000000000)⟩ ⟨(3058547257135294209203379630207 / 12500000000000000000000000000000), (1476608569 / 12500000000000000000000000000000)⟩ ⟨(-219310856885859833802796074616251 / 100000000000000000000000000000000), (21175823751 / 20000000000000000000000000000000)⟩ ⟨-4, 5578469393746635659764022855967, 3125000000000000000000000000000⟩, + .log ⟨(136451581513342476380793490701 / 12500000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ ⟨(1232843883026774969871488768507 / 25000000000000000000000000000000), (1849263787 / 100000000000000000000000000000000)⟩ ⟨(-451751408577930377411076121778643 / 100000000000000000000000000000000), (16940658983 / 10000000000000000000000000000000)⟩ ⟨-7, 136451581513342476380793490701, 97656250000000000000000000000⟩] +lemma CA1_5_10I1PairCertificates_valid : + CA1_5_10I1PairCertificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_5_10I1PairCertificateIndex (a : PairSlot × PairSlot) : ℕ := + match a.1.1.val, a.1.2.val, a.2.1.val, a.2.2.val with + | 0, 0, 2, 4 => 1 + | 0, 0, 3, 4 => 2 + | 0, 0, 4, 2 => 1 + | 0, 0, 4, 3 => 2 + | 0, 0, 5, 1 => 3 + | 0, 0, 1, 5 => 3 + | 1, 0, 1, 4 => 4 + | 1, 0, 2, 2 => 5 + | 1, 0, 2, 3 => 6 + | 1, 0, 3, 2 => 6 + | 1, 0, 3, 3 => 7 + | 1, 0, 4, 1 => 4 + | 1, 0, 5, 0 => 8 + | 1, 0, 0, 5 => 8 + | 0, 1, 1, 4 => 4 + | 0, 1, 2, 2 => 5 + | 0, 1, 2, 3 => 6 + | 0, 1, 3, 2 => 6 + | 0, 1, 3, 3 => 7 + | 0, 1, 4, 1 => 4 + | 0, 1, 5, 0 => 8 + | 0, 1, 0, 5 => 8 + | 2, 0, 0, 4 => 9 + | 2, 0, 1, 2 => 10 + | 2, 0, 1, 3 => 11 + | 2, 0, 2, 1 => 10 + | 2, 0, 3, 1 => 11 + | 2, 0, 4, 0 => 9 + | 3, 0, 0, 4 => 12 + | 3, 0, 1, 2 => 13 + | 3, 0, 1, 3 => 14 + | 3, 0, 2, 1 => 13 + | 3, 0, 3, 1 => 14 + | 3, 0, 4, 0 => 12 + | 1, 1, 0, 4 => 15 + | 1, 1, 1, 2 => 16 + | 1, 1, 1, 3 => 17 + | 1, 1, 2, 1 => 16 + | 1, 1, 3, 1 => 17 + | 1, 1, 4, 0 => 15 + | 0, 2, 0, 4 => 9 + | 0, 2, 1, 2 => 10 + | 0, 2, 1, 3 => 11 + | 0, 2, 2, 1 => 10 + | 0, 2, 3, 1 => 11 + | 0, 2, 4, 0 => 9 + | 0, 3, 0, 4 => 12 + | 0, 3, 1, 2 => 13 + | 0, 3, 1, 3 => 14 + | 0, 3, 2, 1 => 13 + | 0, 3, 3, 1 => 14 + | 0, 3, 4, 0 => 12 + | 4, 0, 0, 2 => 9 + | 4, 0, 0, 3 => 12 + | 4, 0, 1, 1 => 15 + | 4, 0, 2, 0 => 9 + | 4, 0, 3, 0 => 12 + | 2, 1, 0, 2 => 10 + | 2, 1, 0, 3 => 13 + | 2, 1, 1, 1 => 16 + | 2, 1, 2, 0 => 10 + | 2, 1, 3, 0 => 13 + | 3, 1, 0, 2 => 11 + | 3, 1, 0, 3 => 14 + | 3, 1, 1, 1 => 17 + | 3, 1, 2, 0 => 11 + | 3, 1, 3, 0 => 14 + | 1, 2, 0, 2 => 10 + | 1, 2, 0, 3 => 13 + | 1, 2, 1, 1 => 16 + | 1, 2, 2, 0 => 10 + | 1, 2, 3, 0 => 13 + | 1, 3, 0, 2 => 11 + | 1, 3, 0, 3 => 14 + | 1, 3, 1, 1 => 17 + | 1, 3, 2, 0 => 11 + | 1, 3, 3, 0 => 14 + | 0, 4, 0, 2 => 9 + | 0, 4, 0, 3 => 12 + | 0, 4, 1, 1 => 15 + | 0, 4, 2, 0 => 9 + | 0, 4, 3, 0 => 12 + | 0, 5, 0, 1 => 8 + | 0, 5, 1, 0 => 8 + | 1, 4, 0, 1 => 4 + | 1, 4, 1, 0 => 4 + | 2, 2, 0, 1 => 5 + | 2, 2, 1, 0 => 5 + | 2, 3, 0, 1 => 6 + | 2, 3, 1, 0 => 6 + | 3, 2, 0, 1 => 6 + | 3, 2, 1, 0 => 6 + | 3, 3, 0, 1 => 7 + | 3, 3, 1, 0 => 7 + | 4, 1, 0, 1 => 4 + | 4, 1, 1, 0 => 4 + | 5, 0, 0, 1 => 8 + | 5, 0, 1, 0 => 8 + | 1, 5, 0, 0 => 3 + | 2, 4, 0, 0 => 1 + | 3, 4, 0, 0 => 2 + | 4, 2, 0, 0 => 1 + | 4, 3, 0, 0 => 2 + | 5, 1, 0, 0 => 3 + | _, _, _, _ => 0 +def CA1_5_10I1PairP (a : PairSlot × PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_5_10I1PairCertificates (CA1_5_10I1PairCertificateIndex a)).input +lemma CA1_5_10I1PairP_check_0_0 : ∀ k l : Fin 6, contains (CA1_5_10I1PairRaw ((0,0),(k,l))) (CA1_5_10I1PairP ((0,0),(k,l))) = true := by + decide +kernel +lemma CA1_5_10I1PairP_check_0_1 : ∀ k l : Fin 6, contains (CA1_5_10I1PairRaw ((0,1),(k,l))) (CA1_5_10I1PairP ((0,1),(k,l))) = true := by + decide +kernel +lemma CA1_5_10I1PairP_check_0_2 : ∀ k l : Fin 6, contains (CA1_5_10I1PairRaw ((0,2),(k,l))) (CA1_5_10I1PairP ((0,2),(k,l))) = true := by + decide +kernel +lemma CA1_5_10I1PairP_check_0_3 : ∀ k l : Fin 6, contains (CA1_5_10I1PairRaw ((0,3),(k,l))) (CA1_5_10I1PairP ((0,3),(k,l))) = true := by + decide +kernel +lemma CA1_5_10I1PairP_check_0_4 : ∀ k l : Fin 6, contains (CA1_5_10I1PairRaw ((0,4),(k,l))) (CA1_5_10I1PairP ((0,4),(k,l))) = true := by + decide +kernel +lemma CA1_5_10I1PairP_check_0_5 : ∀ k l : Fin 6, contains (CA1_5_10I1PairRaw ((0,5),(k,l))) (CA1_5_10I1PairP ((0,5),(k,l))) = true := by + decide +kernel +lemma CA1_5_10I1PairP_check_1_0 : ∀ k l : Fin 6, contains (CA1_5_10I1PairRaw ((1,0),(k,l))) (CA1_5_10I1PairP ((1,0),(k,l))) = true := by + decide +kernel +lemma CA1_5_10I1PairP_check_1_1 : ∀ k l : Fin 6, contains (CA1_5_10I1PairRaw ((1,1),(k,l))) (CA1_5_10I1PairP ((1,1),(k,l))) = true := by + decide +kernel +lemma CA1_5_10I1PairP_check_1_2 : ∀ k l : Fin 6, contains (CA1_5_10I1PairRaw ((1,2),(k,l))) (CA1_5_10I1PairP ((1,2),(k,l))) = true := by + decide +kernel +lemma CA1_5_10I1PairP_check_1_3 : ∀ k l : Fin 6, contains (CA1_5_10I1PairRaw ((1,3),(k,l))) (CA1_5_10I1PairP ((1,3),(k,l))) = true := by + decide +kernel +lemma CA1_5_10I1PairP_check_1_4 : ∀ k l : Fin 6, contains (CA1_5_10I1PairRaw ((1,4),(k,l))) (CA1_5_10I1PairP ((1,4),(k,l))) = true := by + decide +kernel +lemma CA1_5_10I1PairP_check_1_5 : ∀ k l : Fin 6, contains (CA1_5_10I1PairRaw ((1,5),(k,l))) (CA1_5_10I1PairP ((1,5),(k,l))) = true := by + decide +kernel +lemma CA1_5_10I1PairP_check_2_0 : ∀ k l : Fin 6, contains (CA1_5_10I1PairRaw ((2,0),(k,l))) (CA1_5_10I1PairP ((2,0),(k,l))) = true := by + decide +kernel +lemma CA1_5_10I1PairP_check_2_1 : ∀ k l : Fin 6, contains (CA1_5_10I1PairRaw ((2,1),(k,l))) (CA1_5_10I1PairP ((2,1),(k,l))) = true := by + decide +kernel +lemma CA1_5_10I1PairP_check_2_2 : ∀ k l : Fin 6, contains (CA1_5_10I1PairRaw ((2,2),(k,l))) (CA1_5_10I1PairP ((2,2),(k,l))) = true := by + decide +kernel +lemma CA1_5_10I1PairP_check_2_3 : ∀ k l : Fin 6, contains (CA1_5_10I1PairRaw ((2,3),(k,l))) (CA1_5_10I1PairP ((2,3),(k,l))) = true := by + decide +kernel +lemma CA1_5_10I1PairP_check_2_4 : ∀ k l : Fin 6, contains (CA1_5_10I1PairRaw ((2,4),(k,l))) (CA1_5_10I1PairP ((2,4),(k,l))) = true := by + decide +kernel +lemma CA1_5_10I1PairP_check_2_5 : ∀ k l : Fin 6, contains (CA1_5_10I1PairRaw ((2,5),(k,l))) (CA1_5_10I1PairP ((2,5),(k,l))) = true := by + decide +kernel +lemma CA1_5_10I1PairP_check_3_0 : ∀ k l : Fin 6, contains (CA1_5_10I1PairRaw ((3,0),(k,l))) (CA1_5_10I1PairP ((3,0),(k,l))) = true := by + decide +kernel +lemma CA1_5_10I1PairP_check_3_1 : ∀ k l : Fin 6, contains (CA1_5_10I1PairRaw ((3,1),(k,l))) (CA1_5_10I1PairP ((3,1),(k,l))) = true := by + decide +kernel +lemma CA1_5_10I1PairP_check_3_2 : ∀ k l : Fin 6, contains (CA1_5_10I1PairRaw ((3,2),(k,l))) (CA1_5_10I1PairP ((3,2),(k,l))) = true := by + decide +kernel +lemma CA1_5_10I1PairP_check_3_3 : ∀ k l : Fin 6, contains (CA1_5_10I1PairRaw ((3,3),(k,l))) (CA1_5_10I1PairP ((3,3),(k,l))) = true := by + decide +kernel +lemma CA1_5_10I1PairP_check_3_4 : ∀ k l : Fin 6, contains (CA1_5_10I1PairRaw ((3,4),(k,l))) (CA1_5_10I1PairP ((3,4),(k,l))) = true := by + decide +kernel +lemma CA1_5_10I1PairP_check_3_5 : ∀ k l : Fin 6, contains (CA1_5_10I1PairRaw ((3,5),(k,l))) (CA1_5_10I1PairP ((3,5),(k,l))) = true := by + decide +kernel +lemma CA1_5_10I1PairP_check_4_0 : ∀ k l : Fin 6, contains (CA1_5_10I1PairRaw ((4,0),(k,l))) (CA1_5_10I1PairP ((4,0),(k,l))) = true := by + decide +kernel +lemma CA1_5_10I1PairP_check_4_1 : ∀ k l : Fin 6, contains (CA1_5_10I1PairRaw ((4,1),(k,l))) (CA1_5_10I1PairP ((4,1),(k,l))) = true := by + decide +kernel +lemma CA1_5_10I1PairP_check_4_2 : ∀ k l : Fin 6, contains (CA1_5_10I1PairRaw ((4,2),(k,l))) (CA1_5_10I1PairP ((4,2),(k,l))) = true := by + decide +kernel +lemma CA1_5_10I1PairP_check_4_3 : ∀ k l : Fin 6, contains (CA1_5_10I1PairRaw ((4,3),(k,l))) (CA1_5_10I1PairP ((4,3),(k,l))) = true := by + decide +kernel +lemma CA1_5_10I1PairP_check_4_4 : ∀ k l : Fin 6, contains (CA1_5_10I1PairRaw ((4,4),(k,l))) (CA1_5_10I1PairP ((4,4),(k,l))) = true := by + decide +kernel +lemma CA1_5_10I1PairP_check_4_5 : ∀ k l : Fin 6, contains (CA1_5_10I1PairRaw ((4,5),(k,l))) (CA1_5_10I1PairP ((4,5),(k,l))) = true := by + decide +kernel +lemma CA1_5_10I1PairP_check_5_0 : ∀ k l : Fin 6, contains (CA1_5_10I1PairRaw ((5,0),(k,l))) (CA1_5_10I1PairP ((5,0),(k,l))) = true := by + decide +kernel +lemma CA1_5_10I1PairP_check_5_1 : ∀ k l : Fin 6, contains (CA1_5_10I1PairRaw ((5,1),(k,l))) (CA1_5_10I1PairP ((5,1),(k,l))) = true := by + decide +kernel +lemma CA1_5_10I1PairP_check_5_2 : ∀ k l : Fin 6, contains (CA1_5_10I1PairRaw ((5,2),(k,l))) (CA1_5_10I1PairP ((5,2),(k,l))) = true := by + decide +kernel +lemma CA1_5_10I1PairP_check_5_3 : ∀ k l : Fin 6, contains (CA1_5_10I1PairRaw ((5,3),(k,l))) (CA1_5_10I1PairP ((5,3),(k,l))) = true := by + decide +kernel +lemma CA1_5_10I1PairP_check_5_4 : ∀ k l : Fin 6, contains (CA1_5_10I1PairRaw ((5,4),(k,l))) (CA1_5_10I1PairP ((5,4),(k,l))) = true := by + decide +kernel +lemma CA1_5_10I1PairP_check_5_5 : ∀ k l : Fin 6, contains (CA1_5_10I1PairRaw ((5,5),(k,l))) (CA1_5_10I1PairP ((5,5),(k,l))) = true := by + decide +kernel +lemma CA1_5_10I1PairP_check (a : PairSlot × PairSlot) : contains (CA1_5_10I1PairRaw a) (CA1_5_10I1PairP a) = true := by + rcases a with ⟨⟨i,j⟩,⟨k,l⟩⟩ + revert j i + apply forall_fin6 + · exact forall_fin6 (CA1_5_10I1PairP_check_0_0 k l) (CA1_5_10I1PairP_check_0_1 k l) (CA1_5_10I1PairP_check_0_2 k l) (CA1_5_10I1PairP_check_0_3 k l) (CA1_5_10I1PairP_check_0_4 k l) (CA1_5_10I1PairP_check_0_5 k l) + · exact forall_fin6 (CA1_5_10I1PairP_check_1_0 k l) (CA1_5_10I1PairP_check_1_1 k l) (CA1_5_10I1PairP_check_1_2 k l) (CA1_5_10I1PairP_check_1_3 k l) (CA1_5_10I1PairP_check_1_4 k l) (CA1_5_10I1PairP_check_1_5 k l) + · exact forall_fin6 (CA1_5_10I1PairP_check_2_0 k l) (CA1_5_10I1PairP_check_2_1 k l) (CA1_5_10I1PairP_check_2_2 k l) (CA1_5_10I1PairP_check_2_3 k l) (CA1_5_10I1PairP_check_2_4 k l) (CA1_5_10I1PairP_check_2_5 k l) + · exact forall_fin6 (CA1_5_10I1PairP_check_3_0 k l) (CA1_5_10I1PairP_check_3_1 k l) (CA1_5_10I1PairP_check_3_2 k l) (CA1_5_10I1PairP_check_3_3 k l) (CA1_5_10I1PairP_check_3_4 k l) (CA1_5_10I1PairP_check_3_5 k l) + · exact forall_fin6 (CA1_5_10I1PairP_check_4_0 k l) (CA1_5_10I1PairP_check_4_1 k l) (CA1_5_10I1PairP_check_4_2 k l) (CA1_5_10I1PairP_check_4_3 k l) (CA1_5_10I1PairP_check_4_4 k l) (CA1_5_10I1PairP_check_4_5 k l) + · exact forall_fin6 (CA1_5_10I1PairP_check_5_0 k l) (CA1_5_10I1PairP_check_5_1 k l) (CA1_5_10I1PairP_check_5_2 k l) (CA1_5_10I1PairP_check_5_3 k l) (CA1_5_10I1PairP_check_5_4 k l) (CA1_5_10I1PairP_check_5_5 k l) +lemma CA1_5_10I1PairP_sound (a : PairSlot × PairSlot) : + (CA1_5_10I1PairP a).Encloses (CA1_5_10I1PairValue a) := + contains_sound (CA1_5_10I1PairRaw_sound a) (CA1_5_10I1PairP_check a) +def CA1_5_10I1PairTerms (a : PairSlot × PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_5_10I1PairCertificates (CA1_5_10I1PairCertificateIndex a)).output +lemma CA1_5_10I1PairTerms_sound (a : PairSlot × PairSlot) : + (CA1_5_10I1PairTerms a).Encloses (Foundation.entropyTerm (CA1_5_10I1PairValue a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_5_10I1PairCertificates_valid + (CA1_5_10I1PairCertificateIndex a) (CA1_5_10I1PairP_sound a) +def CA1_5_10I1PairEntropy : Ball := ⟨(41523217069936040245483418022181 / 12500000000000000000000000000000), (33568586887 / 25000000000000000000000000000000)⟩ +lemma CA1_5_10I1PairEntropy_sound : CA1_5_10I1PairEntropy.Encloses (Foundation.finiteEntropy CA1_5_10I1PairValue) := by + exact contains_sound (entropyDoublePair_enclosed CA1_5_10I1PairValue CA1_5_10I1PairTerms CA1_5_10I1PairTerms_sound) (by decide +kernel) +def CA1_5_10I1PairMass : Ball := ⟨(25000000000000000000000000000001 / 25000000000000000000000000000000), (61 / 12500000000000000000000000000000)⟩ +lemma CA1_5_10I1PairMass_sound : CA1_5_10I1PairMass.Encloses (∑ a, CA1_5_10I1PairValue a) := by + exact contains_sound (doublePairSumBall_sound CA1_5_10I1PairP CA1_5_10I1PairValue CA1_5_10I1PairP_sound) (by decide +kernel) +def CA1_5_10I1PairMassTermLogWitness : LogWitness := ⟨0, 25000000000000000000000000000001, 25000000000000000000000000000000⟩ +def CA1_5_10I1PairMassTermLog : Ball := ⟨(1 / 25000000000000000000000000000000), (2117582417 / 10000000000000000000000000000000)⟩ +lemma CA1_5_10I1PairMassTermLog_sound : CA1_5_10I1PairMassTermLog.Encloses (Real.log ((∑ a, CA1_5_10I1PairValue a))) := by + exact checkLog_sound logTwoBall_sound (CA1_5_10I1PairMass_sound) (w := CA1_5_10I1PairMassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA1_5_10I1PairMassTerm : Ball := ⟨(-1 / 25000000000000000000000000000000), (21175824171 / 100000000000000000000000000000000)⟩ +lemma CA1_5_10I1PairMassTerm_sound : CA1_5_10I1PairMassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_5_10I1PairValue a))) := by + exact contains_sound (entropyTerm_ball (CA1_5_10I1PairMass_sound) CA1_5_10I1PairMassTermLog_sound) (by decide +kernel) +def CA1_5_10I1PairH : Ball := ⟨(83046434139872080490966836044363 / 25000000000000000000000000000000), (155450171719 / 100000000000000000000000000000000)⟩ +lemma CA1_5_10I1PairH_sound : CA1_5_10I1PairH.Encloses (homogeneousEntropy CA1_5_10I1PairValue) := by + exact contains_sound (homogeneous_enclosed CA1_5_10I1PairValue CA1_5_10I1PairMassTerm_sound CA1_5_10I1PairEntropy_sound) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CA1_5_10I1R0Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 5 10)) (fun u => (stageALaw (shape 1 5 10) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 0 a +def CA1_5_10I1R0Raw (a : PairSlot) : Ball := residualBall (below (shape 1 5 10)) A1_5_10Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 0 a +lemma CA1_5_10I1R0Raw_sound (a : PairSlot) : + (CA1_5_10I1R0Raw a).Encloses (CA1_5_10I1R0Value a) := by + exact residualBall_sound_on (below (shape 1 5 10)) A1_5_10Law (fun u => (stageALaw (shape 1 5 10) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A1_5_10Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 5 10) (show (shape 1 5 10) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 0 a +def CA1_5_10I1R0Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(50771816161526734863152209467 / 20000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ ⟨(758549484444178149680679190387 / 50000000000000000000000000000000), (107513507 / 20000000000000000000000000000000)⟩ ⟨(-59761461518800880570056690030777 / 10000000000000000000000000000000), (211758238011 / 100000000000000000000000000000000)⟩ ⟨-9, 50771816161526734863152209467, 39062500000000000000000000000⟩] +lemma CA1_5_10I1R0Certificates_valid : + CA1_5_10I1R0Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_5_10I1R0CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 0, 0 => 1 + | _, _ => 0 +def CA1_5_10I1R0P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_5_10I1R0Certificates (CA1_5_10I1R0CertificateIndex a)).input +lemma CA1_5_10I1R0P_check : ∀ a : PairSlot, contains (CA1_5_10I1R0Raw a) (CA1_5_10I1R0P a) = true := by + decide +kernel +lemma CA1_5_10I1R0P_sound (a : PairSlot) : + (CA1_5_10I1R0P a).Encloses (CA1_5_10I1R0Value a) := + contains_sound (CA1_5_10I1R0Raw_sound a) (CA1_5_10I1R0P_check a) +def CA1_5_10I1R0Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_5_10I1R0Certificates (CA1_5_10I1R0CertificateIndex a)).output +lemma CA1_5_10I1R0Terms_sound (a : PairSlot) : + (CA1_5_10I1R0Terms a).Encloses (Foundation.entropyTerm (CA1_5_10I1R0Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_5_10I1R0Certificates_valid + (CA1_5_10I1R0CertificateIndex a) (CA1_5_10I1R0P_sound a) +def CA1_5_10I1R0Entropy : Ball := ⟨(758549484444178149680679190387 / 50000000000000000000000000000000), (107513507 / 20000000000000000000000000000000)⟩ +lemma CA1_5_10I1R0Entropy_sound : CA1_5_10I1R0Entropy.Encloses (Foundation.finiteEntropy CA1_5_10I1R0Value) := by + exact contains_sound (entropyPair_enclosed CA1_5_10I1R0Value CA1_5_10I1R0Terms CA1_5_10I1R0Terms_sound) (by decide +kernel) +def CA1_5_10I1R0Mass : Ball := ⟨(50771816161526734863152209467 / 20000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +lemma CA1_5_10I1R0Mass_sound : CA1_5_10I1R0Mass.Encloses (∑ a, CA1_5_10I1R0Value a) := by + exact contains_sound (pairSumBall_sound CA1_5_10I1R0P CA1_5_10I1R0Value CA1_5_10I1R0P_sound) (by decide +kernel) +def CA1_5_10I1R0MassTermLogWitness : LogWitness := ⟨-9, 50771816161526734863152209467, 39062500000000000000000000000⟩ +def CA1_5_10I1R0MassTermLog : Ball := ⟨(-59761461518800880570056690030777 / 10000000000000000000000000000000), (211758238011 / 100000000000000000000000000000000)⟩ +lemma CA1_5_10I1R0MassTermLog_sound : CA1_5_10I1R0MassTermLog.Encloses (Real.log ((∑ a, CA1_5_10I1R0Value a))) := by + exact checkLog_sound logTwoBall_sound (CA1_5_10I1R0Mass_sound) (w := CA1_5_10I1R0MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA1_5_10I1R0MassTerm : Ball := ⟨(758549484444178149680679190387 / 50000000000000000000000000000000), (107513507 / 20000000000000000000000000000000)⟩ +lemma CA1_5_10I1R0MassTerm_sound : CA1_5_10I1R0MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_5_10I1R0Value a))) := by + exact contains_sound (entropyTerm_ball (CA1_5_10I1R0Mass_sound) CA1_5_10I1R0MassTermLog_sound) (by decide +kernel) +def CA1_5_10I1R0H : Ball := ⟨0, (107513507 / 10000000000000000000000000000000)⟩ +lemma CA1_5_10I1R0H_sound : CA1_5_10I1R0H.Encloses (homogeneousEntropy CA1_5_10I1R0Value) := by + exact contains_sound (homogeneous_enclosed CA1_5_10I1R0Value CA1_5_10I1R0MassTerm_sound CA1_5_10I1R0Entropy_sound) (by decide +kernel) +def CA1_5_10I1R1Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 5 10)) (fun u => (stageALaw (shape 1 5 10) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 1 a +def CA1_5_10I1R1Raw (a : PairSlot) : Ball := residualBall (below (shape 1 5 10)) A1_5_10Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 1 a +lemma CA1_5_10I1R1Raw_sound (a : PairSlot) : + (CA1_5_10I1R1Raw a).Encloses (CA1_5_10I1R1Value a) := by + exact residualBall_sound_on (below (shape 1 5 10)) A1_5_10Law (fun u => (stageALaw (shape 1 5 10) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A1_5_10Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 5 10) (show (shape 1 5 10) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 1 a +def CA1_5_10I1R1Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(1025619396755435995373302370507 / 25000000000000000000000000000000), (1 / 6250000000000000000000000000000)⟩ ⟨(13101586701749977828114928045673 / 100000000000000000000000000000000), (5212400591 / 100000000000000000000000000000000)⟩ ⟨(-319357910526971922324675037272351 / 100000000000000000000000000000000), (127054942487 / 100000000000000000000000000000000)⟩ ⟨-5, 1025619396755435995373302370507, 781250000000000000000000000000⟩] +lemma CA1_5_10I1R1Certificates_valid : + CA1_5_10I1R1Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_5_10I1R1CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 1, 0 => 1 + | 0, 1 => 1 + | _, _ => 0 +def CA1_5_10I1R1P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_5_10I1R1Certificates (CA1_5_10I1R1CertificateIndex a)).input +lemma CA1_5_10I1R1P_check : ∀ a : PairSlot, contains (CA1_5_10I1R1Raw a) (CA1_5_10I1R1P a) = true := by + decide +kernel +lemma CA1_5_10I1R1P_sound (a : PairSlot) : + (CA1_5_10I1R1P a).Encloses (CA1_5_10I1R1Value a) := + contains_sound (CA1_5_10I1R1Raw_sound a) (CA1_5_10I1R1P_check a) +def CA1_5_10I1R1Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_5_10I1R1Certificates (CA1_5_10I1R1CertificateIndex a)).output +lemma CA1_5_10I1R1Terms_sound (a : PairSlot) : + (CA1_5_10I1R1Terms a).Encloses (Foundation.entropyTerm (CA1_5_10I1R1Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_5_10I1R1Certificates_valid + (CA1_5_10I1R1CertificateIndex a) (CA1_5_10I1R1P_sound a) +def CA1_5_10I1R1Entropy : Ball := ⟨(13101586701749977828114928045673 / 50000000000000000000000000000000), (5212400591 / 50000000000000000000000000000000)⟩ +lemma CA1_5_10I1R1Entropy_sound : CA1_5_10I1R1Entropy.Encloses (Foundation.finiteEntropy CA1_5_10I1R1Value) := by + exact contains_sound (entropyPair_enclosed CA1_5_10I1R1Value CA1_5_10I1R1Terms CA1_5_10I1R1Terms_sound) (by decide +kernel) +def CA1_5_10I1R1Mass : Ball := ⟨(1025619396755435995373302370507 / 12500000000000000000000000000000), (1 / 3125000000000000000000000000000)⟩ +lemma CA1_5_10I1R1Mass_sound : CA1_5_10I1R1Mass.Encloses (∑ a, CA1_5_10I1R1Value a) := by + exact contains_sound (pairSumBall_sound CA1_5_10I1R1P CA1_5_10I1R1Value CA1_5_10I1R1P_sound) (by decide +kernel) +def CA1_5_10I1R1MassTermLogWitness : LogWitness := ⟨-4, 1025619396755435995373302370507, 781250000000000000000000000000⟩ +def CA1_5_10I1R1MassTermLog : Ball := ⟨(-250043192470977391382951844222021 / 100000000000000000000000000000000), (26469779701 / 25000000000000000000000000000000)⟩ +lemma CA1_5_10I1R1MassTermLog_sound : CA1_5_10I1R1MassTermLog.Encloses (Real.log ((∑ a, CA1_5_10I1R1Value a))) := by + exact checkLog_sound logTwoBall_sound (CA1_5_10I1R1Mass_sound) (w := CA1_5_10I1R1MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA1_5_10I1R1MassTerm : Ball := ⟨(20515931857990976613637576474281 / 100000000000000000000000000000000), (8687334317 / 100000000000000000000000000000000)⟩ +lemma CA1_5_10I1R1MassTerm_sound : CA1_5_10I1R1MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_5_10I1R1Value a))) := by + exact contains_sound (entropyTerm_ball (CA1_5_10I1R1Mass_sound) CA1_5_10I1R1MassTermLog_sound) (by decide +kernel) +def CA1_5_10I1R1H : Ball := ⟨(1137448309101795808518455923413 / 20000000000000000000000000000000), (19112135499 / 100000000000000000000000000000000)⟩ +lemma CA1_5_10I1R1H_sound : CA1_5_10I1R1H.Encloses (homogeneousEntropy CA1_5_10I1R1Value) := by + exact contains_sound (homogeneous_enclosed CA1_5_10I1R1Value CA1_5_10I1R1MassTerm_sound CA1_5_10I1R1Entropy_sound) (by decide +kernel) +def CA1_5_10I1R2Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 5 10)) (fun u => (stageALaw (shape 1 5 10) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 2 a +def CA1_5_10I1R2Raw (a : PairSlot) : Ball := residualBall (below (shape 1 5 10)) A1_5_10Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 2 a +lemma CA1_5_10I1R2Raw_sound (a : PairSlot) : + (CA1_5_10I1R2Raw a).Encloses (CA1_5_10I1R2Value a) := by + exact residualBall_sound_on (below (shape 1 5 10)) A1_5_10Law (fun u => (stageALaw (shape 1 5 10) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A1_5_10Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 5 10) (show (shape 1 5 10) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 2 a +def CA1_5_10I1R2Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(3619461538080497091580904874329 / 50000000000000000000000000000000), (3 / 12500000000000000000000000000000)⟩ ⟨(19007223939689147579515642461891 / 100000000000000000000000000000000), (7664508023 / 100000000000000000000000000000000)⟩ ⟨(-262569773704091029867312389988677 / 100000000000000000000000000000000), (52939559373 / 50000000000000000000000000000000)⟩ ⟨-4, 3619461538080497091580904874329, 3125000000000000000000000000000⟩, + .log ⟨(354874652760531895037578159637 / 50000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ ⟨(1755924625224395990092778958639 / 50000000000000000000000000000000), (338164343 / 25000000000000000000000000000000)⟩ ⟨(-247400682405075496013496227375001 / 50000000000000000000000000000000), (19058241357 / 10000000000000000000000000000000)⟩ ⟨-8, 354874652760531895037578159637, 195312500000000000000000000000⟩, + .log ⟨(5128768196356952483244777570549 / 20000000000000000000000000000000), (23 / 50000000000000000000000000000000)⟩ ⟨(34897850813233620737731844437989 / 100000000000000000000000000000000), (4072720941 / 25000000000000000000000000000000)⟩ ⟨(-136086676087338601525818244277431 / 100000000000000000000000000000000), (63527471227 / 100000000000000000000000000000000)⟩ ⟨-2, 5128768196356952483244777570549, 5000000000000000000000000000000⟩] +lemma CA1_5_10I1R2Certificates_valid : + CA1_5_10I1R2Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_5_10I1R2CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 2, 0 => 1 + | 3, 0 => 2 + | 1, 1 => 3 + | 0, 2 => 1 + | 0, 3 => 2 + | _, _ => 0 +def CA1_5_10I1R2P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_5_10I1R2Certificates (CA1_5_10I1R2CertificateIndex a)).input +lemma CA1_5_10I1R2P_check : ∀ a : PairSlot, contains (CA1_5_10I1R2Raw a) (CA1_5_10I1R2P a) = true := by + decide +kernel +lemma CA1_5_10I1R2P_sound (a : PairSlot) : + (CA1_5_10I1R2P a).Encloses (CA1_5_10I1R2Value a) := + contains_sound (CA1_5_10I1R2Raw_sound a) (CA1_5_10I1R2P_check a) +def CA1_5_10I1R2Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_5_10I1R2Certificates (CA1_5_10I1R2CertificateIndex a)).output +lemma CA1_5_10I1R2Terms_sound (a : PairSlot) : + (CA1_5_10I1R2Terms a).Encloses (Foundation.entropyTerm (CA1_5_10I1R2Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_5_10I1R2Certificates_valid + (CA1_5_10I1R2CertificateIndex a) (CA1_5_10I1R2P_sound a) +def CA1_5_10I1R2Entropy : Ball := ⟨(79935997193509499857134245196327 / 100000000000000000000000000000000), (17162607277 / 50000000000000000000000000000000)⟩ +lemma CA1_5_10I1R2Entropy_sound : CA1_5_10I1R2Entropy.Encloses (Foundation.finiteEntropy CA1_5_10I1R2Value) := by + exact contains_sound (entropyPair_enclosed CA1_5_10I1R2Value CA1_5_10I1R2Terms CA1_5_10I1R2Terms_sound) (by decide +kernel) +def CA1_5_10I1R2Mass : Ball := ⟨(41541185745148878362697819988609 / 100000000000000000000000000000000), (1 / 1000000000000000000000000000000)⟩ +lemma CA1_5_10I1R2Mass_sound : CA1_5_10I1R2Mass.Encloses (∑ a, CA1_5_10I1R2Value a) := by + exact contains_sound (pairSumBall_sound CA1_5_10I1R2P CA1_5_10I1R2Value CA1_5_10I1R2P_sound) (by decide +kernel) +def CA1_5_10I1R2MassTermLogWitness : LogWitness := ⟨-2, 41541185745148878362697819988609, 25000000000000000000000000000000⟩ +def CA1_5_10I1R2MassTermLog : Ball := ⟨(-43924241164408934512891830914001 / 50000000000000000000000000000000), (6352747129 / 10000000000000000000000000000000)⟩ +lemma CA1_5_10I1R2MassTermLog_sound : CA1_5_10I1R2MassTermLog.Encloses (Real.log ((∑ a, CA1_5_10I1R2Value a))) := by + exact checkLog_sound logTwoBall_sound (CA1_5_10I1R2Mass_sound) (w := CA1_5_10I1R2MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA1_5_10I1R2MassTerm : Ball := ⟨(18246650609254260008448820334291 / 50000000000000000000000000000000), (3298758117 / 12500000000000000000000000000000)⟩ +lemma CA1_5_10I1R2MassTerm_sound : CA1_5_10I1R2MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_5_10I1R2Value a))) := by + exact contains_sound (entropyTerm_ball (CA1_5_10I1R2Mass_sound) CA1_5_10I1R2MassTermLog_sound) (by decide +kernel) +def CA1_5_10I1R2H : Ball := ⟨(8688539195000195968047320905549 / 20000000000000000000000000000000), (6071527949 / 10000000000000000000000000000000)⟩ +lemma CA1_5_10I1R2H_sound : CA1_5_10I1R2H.Encloses (homogeneousEntropy CA1_5_10I1R2Value) := by + exact contains_sound (homogeneous_enclosed CA1_5_10I1R2Value CA1_5_10I1R2MassTerm_sound CA1_5_10I1R2Entropy_sound) (by decide +kernel) +def CA1_5_10I1R3Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 5 10)) (fun u => (stageALaw (shape 1 5 10) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 3 a +def CA1_5_10I1R3Raw (a : PairSlot) : Ball := residualBall (below (shape 1 5 10)) A1_5_10Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 3 a +lemma CA1_5_10I1R3Raw_sound (a : PairSlot) : + (CA1_5_10I1R3Raw a).Encloses (CA1_5_10I1R3Value a) := by + exact residualBall_sound_on (below (shape 1 5 10)) A1_5_10Law (fun u => (stageALaw (shape 1 5 10) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A1_5_10Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 5 10) (show (shape 1 5 10) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 3 a +def CA1_5_10I1R3Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(459258977477173114738445400667 / 50000000000000000000000000000000), (1 / 20000000000000000000000000000000)⟩ ⟨(134624995532851081425096845973 / 3125000000000000000000000000000), (155602997 / 10000000000000000000000000000000)⟩ ⟨(-469016401237944039661153399430267 / 100000000000000000000000000000000), (169406590007 / 100000000000000000000000000000000)⟩ ⟨-7, 459258977477173114738445400667, 390625000000000000000000000000⟩, + .log ⟨(9042070851149781056087237091629 / 50000000000000000000000000000000), (51 / 100000000000000000000000000000000)⟩ ⟨(3092631970608047946983192993897 / 10000000000000000000000000000000), (3063572797 / 20000000000000000000000000000000)⟩ ⟨(-171013478080344384390576475007727 / 100000000000000000000000000000000), (84703295013 / 100000000000000000000000000000000)⟩ ⟨-3, 9042070851149781056087237091629, 6250000000000000000000000000000⟩, + .log ⟨(1767933215320530839697545009713 / 100000000000000000000000000000000), (1 / 20000000000000000000000000000000)⟩ ⟨(142684904117555242456412765777 / 2000000000000000000000000000000), (262062097 / 10000000000000000000000000000000)⟩ ⟨(-403535899662607171230223242518487 / 100000000000000000000000000000000), (148230766063 / 100000000000000000000000000000000)⟩ ⟨-6, 1767933215320530839697545009713, 1562500000000000000000000000000⟩] +lemma CA1_5_10I1R3Certificates_valid : + CA1_5_10I1R3Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_5_10I1R3CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 4, 0 => 1 + | 2, 1 => 2 + | 3, 1 => 3 + | 1, 2 => 2 + | 1, 3 => 3 + | 0, 4 => 1 + | _, _ => 0 +def CA1_5_10I1R3P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_5_10I1R3Certificates (CA1_5_10I1R3CertificateIndex a)).input +lemma CA1_5_10I1R3P_check : ∀ a : PairSlot, contains (CA1_5_10I1R3Raw a) (CA1_5_10I1R3P a) = true := by + decide +kernel +lemma CA1_5_10I1R3P_sound (a : PairSlot) : + (CA1_5_10I1R3P a).Encloses (CA1_5_10I1R3Value a) := + contains_sound (CA1_5_10I1R3Raw_sound a) (CA1_5_10I1R3P_check a) +def CA1_5_10I1R3Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_5_10I1R3Certificates (CA1_5_10I1R3CertificateIndex a)).output +lemma CA1_5_10I1R3Terms_sound (a : PairSlot) : + (CA1_5_10I1R3Terms a).Encloses (Foundation.entropyTerm (CA1_5_10I1R3Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_5_10I1R3Certificates_valid + (CA1_5_10I1R3CertificateIndex a) (CA1_5_10I1R3P_sound a) +def CA1_5_10I1R3Entropy : Ball := ⟨(10592141192252369049563916824739 / 12500000000000000000000000000000), (779780597 / 2000000000000000000000000000000)⟩ +lemma CA1_5_10I1R3Entropy_sound : CA1_5_10I1R3Entropy.Encloses (Foundation.finiteEntropy CA1_5_10I1R3Value) := by + exact contains_sound (entropyPair_enclosed CA1_5_10I1R3Value CA1_5_10I1R3Terms CA1_5_10I1R3Terms_sound) (by decide +kernel) +def CA1_5_10I1R3Mass : Ball := ⟨(4154118574514887836269781998861 / 10000000000000000000000000000000), (61 / 50000000000000000000000000000000)⟩ +lemma CA1_5_10I1R3Mass_sound : CA1_5_10I1R3Mass.Encloses (∑ a, CA1_5_10I1R3Value a) := by + exact contains_sound (pairSumBall_sound CA1_5_10I1R3P CA1_5_10I1R3Value CA1_5_10I1R3P_sound) (by decide +kernel) +def CA1_5_10I1R3MassTermLogWitness : LogWitness := ⟨-2, 4154118574514887836269781998861, 2500000000000000000000000000000⟩ +def CA1_5_10I1R3MassTermLog : Ball := ⟨(-87848482328817869025783661827999 / 100000000000000000000000000000000), (31763735671 / 50000000000000000000000000000000)⟩ +lemma CA1_5_10I1R3MassTermLog_sound : CA1_5_10I1R3MassTermLog.Encloses (Real.log ((∑ a, CA1_5_10I1R3Value a))) := by + exact checkLog_sound logTwoBall_sound (CA1_5_10I1R3Mass_sound) (w := CA1_5_10I1R3MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA1_5_10I1R3MassTerm : Ball := ⟨(18246650609254260008448820334291 / 50000000000000000000000000000000), (26390064977 / 100000000000000000000000000000000)⟩ +lemma CA1_5_10I1R3MassTerm_sound : CA1_5_10I1R3MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_5_10I1R3Value a))) := by + exact contains_sound (entropyTerm_ball (CA1_5_10I1R3Mass_sound) CA1_5_10I1R3MassTermLog_sound) (by decide +kernel) +def CA1_5_10I1R3H : Ball := ⟨(4824382831951043237961369392933 / 10000000000000000000000000000000), (65379094827 / 100000000000000000000000000000000)⟩ +lemma CA1_5_10I1R3H_sound : CA1_5_10I1R3H.Encloses (homogeneousEntropy CA1_5_10I1R3Value) := by + exact contains_sound (homogeneous_enclosed CA1_5_10I1R3Value CA1_5_10I1R3MassTerm_sound CA1_5_10I1R3Entropy_sound) (by decide +kernel) +def CA1_5_10I1R4Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 5 10)) (fun u => (stageALaw (shape 1 5 10) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 4 a +def CA1_5_10I1R4Raw (a : PairSlot) : Ball := residualBall (below (shape 1 5 10)) A1_5_10Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 4 a +lemma CA1_5_10I1R4Raw_sound (a : PairSlot) : + (CA1_5_10I1R4Raw a).Encloses (CA1_5_10I1R4Value a) := by + exact residualBall_sound_on (below (shape 1 5 10)) A1_5_10Law (fun u => (stageALaw (shape 1 5 10) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A1_5_10Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 5 10) (show (shape 1 5 10) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 4 a +def CA1_5_10I1R4Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(2896704051228150518417011133 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(128033073422848728261177381463 / 100000000000000000000000000000000), (10734519 / 25000000000000000000000000000000)⟩ ⟨(-883991399594756692363884378296679 / 100000000000000000000000000000000), (148230769233 / 50000000000000000000000000000000)⟩ ⟨-13, 2896704051228150518417011133, 2441406250000000000000000000⟩, + .log ⟨(503707182470066923959310737177 / 50000000000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ ⟨(1157968203673813654462679024211 / 25000000000000000000000000000000), (106664147 / 6250000000000000000000000000000)⟩ ⟨(-91955663446798402650992985730799 / 20000000000000000000000000000000), (169406590059 / 100000000000000000000000000000000)⟩ ⟨-7, 503707182470066923959310737177, 390625000000000000000000000000⟩, + .log ⟨(255193173092274822371952880777 / 5000000000000000000000000000000), (7 / 25000000000000000000000000000000)⟩ ⟨(15184873661715505394591427934243 / 100000000000000000000000000000000), (3242355439 / 50000000000000000000000000000000)⟩ ⟨(-59503447830184843211077423545503 / 20000000000000000000000000000000), (63527471323 / 50000000000000000000000000000000)⟩ ⟨-5, 255193173092274822371952880777, 156250000000000000000000000000⟩, + .log ⟨(502798912778901915241735271733 / 100000000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ ⟨(2661181479343130870123496415501 / 100000000000000000000000000000000), (958246327 / 100000000000000000000000000000000)⟩ ⟨(-529273515058960454644340854370279 / 100000000000000000000000000000000), (95291206971 / 50000000000000000000000000000000)⟩ ⟨-8, 502798912778901915241735271733, 390625000000000000000000000000⟩, + .log ⟨(51698116247638484042477745011 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(97806426929397618687614051929 / 25000000000000000000000000000000), (131370033 / 100000000000000000000000000000000)⟩ ⟨(-756750412033555006927827905490239 / 100000000000000000000000000000000), (25410988613 / 10000000000000000000000000000000)⟩ ⟨-11, 51698116247638484042477745011, 48828125000000000000000000000⟩] +lemma CA1_5_10I1R4Certificates_valid : + CA1_5_10I1R4Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_5_10I1R4CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 0, 5 => 1 + | 1, 4 => 2 + | 2, 2 => 3 + | 2, 3 => 4 + | 3, 2 => 4 + | 3, 3 => 5 + | 4, 1 => 2 + | 5, 0 => 1 + | _, _ => 0 +def CA1_5_10I1R4P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_5_10I1R4Certificates (CA1_5_10I1R4CertificateIndex a)).input +lemma CA1_5_10I1R4P_check : ∀ a : PairSlot, contains (CA1_5_10I1R4Raw a) (CA1_5_10I1R4P a) = true := by + decide +kernel +lemma CA1_5_10I1R4P_sound (a : PairSlot) : + (CA1_5_10I1R4P a).Encloses (CA1_5_10I1R4Value a) := + contains_sound (CA1_5_10I1R4Raw_sound a) (CA1_5_10I1R4P_check a) +def CA1_5_10I1R4Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_5_10I1R4Certificates (CA1_5_10I1R4CertificateIndex a)).output +lemma CA1_5_10I1R4Terms_sound (a : PairSlot) : + (CA1_5_10I1R4Terms a).Encloses (Foundation.entropyTerm (CA1_5_10I1R4Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_5_10I1R4Certificates_valid + (CA1_5_10I1R4CertificateIndex a) (CA1_5_10I1R4P_sound a) +def CA1_5_10I1R4Entropy : Ball := ⟨(1216730964174222572072506557183 / 4000000000000000000000000000000), (12031702421 / 100000000000000000000000000000000)⟩ +lemma CA1_5_10I1R4Entropy_sound : CA1_5_10I1R4Entropy.Encloses (Foundation.finiteEntropy CA1_5_10I1R4Value) := by + exact contains_sound (entropyPair_enclosed CA1_5_10I1R4Value CA1_5_10I1R4Terms CA1_5_10I1R4Terms_sound) (by decide +kernel) +def CA1_5_10I1R4Mass : Ball := ⟨(1640991034808697592597283792811 / 20000000000000000000000000000000), (51 / 100000000000000000000000000000000)⟩ +lemma CA1_5_10I1R4Mass_sound : CA1_5_10I1R4Mass.Encloses (∑ a, CA1_5_10I1R4Value a) := by + exact contains_sound (pairSumBall_sound CA1_5_10I1R4P CA1_5_10I1R4Value CA1_5_10I1R4P_sound) (by decide +kernel) +def CA1_5_10I1R4MassTermLogWitness : LogWitness := ⟨-4, 1640991034808697592597283792811, 1250000000000000000000000000000⟩ +def CA1_5_10I1R4MassTermLog : Ball := ⟨(-250043192470977391382951844222033 / 100000000000000000000000000000000), (26469779759 / 25000000000000000000000000000000)⟩ +lemma CA1_5_10I1R4MassTermLog_sound : CA1_5_10I1R4MassTermLog.Encloses (Real.log ((∑ a, CA1_5_10I1R4Value a))) := by + exact checkLog_sound logTwoBall_sound (CA1_5_10I1R4Mass_sound) (w := CA1_5_10I1R4MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA1_5_10I1R4MassTerm : Ball := ⟨(512898296449774415340939411857 / 2500000000000000000000000000000), (542958399 / 6250000000000000000000000000000)⟩ +lemma CA1_5_10I1R4MassTerm_sound : CA1_5_10I1R4MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_5_10I1R4Value a))) := by + exact contains_sound (entropyTerm_ball (CA1_5_10I1R4Mass_sound) CA1_5_10I1R4MassTermLog_sound) (by decide +kernel) +def CA1_5_10I1R4H : Ball := ⟨(1980468449272917537635017491059 / 20000000000000000000000000000000), (4143807361 / 20000000000000000000000000000000)⟩ +lemma CA1_5_10I1R4H_sound : CA1_5_10I1R4H.Encloses (homogeneousEntropy CA1_5_10I1R4Value) := by + exact contains_sound (homogeneous_enclosed CA1_5_10I1R4Value CA1_5_10I1R4MassTerm_sound CA1_5_10I1R4Entropy_sound) (by decide +kernel) +def CA1_5_10I1R5Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 5 10)) (fun u => (stageALaw (shape 1 5 10) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 5 a +def CA1_5_10I1R5Raw (a : PairSlot) : Ball := residualBall (below (shape 1 5 10)) A1_5_10Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 5 a +lemma CA1_5_10I1R5Raw_sound (a : PairSlot) : + (CA1_5_10I1R5Raw a).Encloses (CA1_5_10I1R5Value a) := by + exact residualBall_sound_on (below (shape 1 5 10)) A1_5_10Law (fun u => (stageALaw (shape 1 5 10) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A1_5_10Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 5 10) (show (shape 1 5 10) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 5 a +def CA1_5_10I1R5Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(5438635077537771407403874419 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(53404118816045124414143044197 / 100000000000000000000000000000000), (2303353 / 12500000000000000000000000000000)⟩ ⟨(-122742466755608112311191459318267 / 12500000000000000000000000000000), (67762639463 / 20000000000000000000000000000000)⟩ ⟨-15, 5438635077537771407403874419, 3051757812500000000000000000⟩, + .log ⟨(22268884945206414182146674039 / 20000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ ⟨(47323448329967572271861989909 / 6250000000000000000000000000000), (129679553 / 50000000000000000000000000000000)⟩ ⟨(-170007428558399866366735946547719 / 25000000000000000000000000000000), (232934062309 / 100000000000000000000000000000000)⟩ ⟨-10, 22268884945206414182146674039, 19531250000000000000000000000⟩, + .log ⟨(5073240300123497419871639527 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(93304991677621678275312218259 / 100000000000000000000000000000000), (1007157 / 3125000000000000000000000000000)⟩ ⟨(-91957985585021828636861036394861 / 10000000000000000000000000000000), (3176373651 / 1000000000000000000000000000000)⟩ ⟨-14, 5073240300123497419871639527, 3051757812500000000000000000⟩] +lemma CA1_5_10I1R5Certificates_valid : + CA1_5_10I1R5Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_5_10I1R5CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 1, 5 => 1 + | 2, 4 => 2 + | 3, 4 => 3 + | 4, 2 => 2 + | 4, 3 => 3 + | 5, 1 => 1 + | _, _ => 0 +def CA1_5_10I1R5P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_5_10I1R5Certificates (CA1_5_10I1R5CertificateIndex a)).input +lemma CA1_5_10I1R5P_check : ∀ a : PairSlot, contains (CA1_5_10I1R5Raw a) (CA1_5_10I1R5P a) = true := by + decide +kernel +lemma CA1_5_10I1R5P_sound (a : PairSlot) : + (CA1_5_10I1R5P a).Encloses (CA1_5_10I1R5Value a) := + contains_sound (CA1_5_10I1R5Raw_sound a) (CA1_5_10I1R5P_check a) +def CA1_5_10I1R5Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_5_10I1R5Certificates (CA1_5_10I1R5CertificateIndex a)).output +lemma CA1_5_10I1R5Terms_sound (a : PairSlot) : + (CA1_5_10I1R5Terms a).Encloses (Foundation.entropyTerm (CA1_5_10I1R5Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_5_10I1R5Certificates_valid + (CA1_5_10I1R5CertificateIndex a) (CA1_5_10I1R5P_sound a) +def CA1_5_10I1R5Entropy : Ball := ⟨(903884283773147959039247101 / 50000000000000000000000000000), (155007477 / 25000000000000000000000000000000)⟩ +lemma CA1_5_10I1R5Entropy_sound : CA1_5_10I1R5Entropy.Encloses (Foundation.finiteEntropy CA1_5_10I1R5Value) := by + exact contains_sound (entropyPair_enclosed CA1_5_10I1R5Value CA1_5_10I1R5Terms CA1_5_10I1R5Terms_sound) (by decide +kernel) +def CA1_5_10I1R5Mass : Ball := ⟨(31732385100954209289470130917 / 12500000000000000000000000000000), (1 / 12500000000000000000000000000000)⟩ +lemma CA1_5_10I1R5Mass_sound : CA1_5_10I1R5Mass.Encloses (∑ a, CA1_5_10I1R5Value a) := by + exact contains_sound (pairSumBall_sound CA1_5_10I1R5P CA1_5_10I1R5Value CA1_5_10I1R5P_sound) (by decide +kernel) +def CA1_5_10I1R5MassTermLogWitness : LogWitness := ⟨-9, 31732385100954209289470130917, 24414062500000000000000000000⟩ +def CA1_5_10I1R5MassTermLog : Ball := ⟨(-37350913449250550356285431269211 / 6250000000000000000000000000000), (211758239981 / 100000000000000000000000000000000)⟩ +lemma CA1_5_10I1R5MassTermLog_sound : CA1_5_10I1R5MassTermLog.Encloses (Real.log ((∑ a, CA1_5_10I1R5Value a))) := by + exact checkLog_sound logTwoBall_sound (CA1_5_10I1R5Mass_sound) (w := CA1_5_10I1R5MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA1_5_10I1R5MassTerm : Ball := ⟨(758549484444178149680679190389 / 50000000000000000000000000000000), (53756757 / 10000000000000000000000000000000)⟩ +lemma CA1_5_10I1R5MassTerm_sound : CA1_5_10I1R5MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_5_10I1R5Value a))) := by + exact contains_sound (entropyTerm_ball (CA1_5_10I1R5Mass_sound) CA1_5_10I1R5MassTermLog_sound) (by decide +kernel) +def CA1_5_10I1R5H : Ball := ⟨(145334799328969809358567910611 / 50000000000000000000000000000000), (578798739 / 50000000000000000000000000000000)⟩ +lemma CA1_5_10I1R5H_sound : CA1_5_10I1R5H.Encloses (homogeneousEntropy CA1_5_10I1R5Value) := by + exact contains_sound (homogeneous_enclosed CA1_5_10I1R5Value CA1_5_10I1R5MassTerm_sound CA1_5_10I1R5Entropy_sound) (by decide +kernel) +def CA1_5_10I1R6Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 5 10)) (fun u => (stageALaw (shape 1 5 10) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 6 a +def CA1_5_10I1R6Raw (a : PairSlot) : Ball := residualBall (below (shape 1 5 10)) A1_5_10Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 6 a +lemma CA1_5_10I1R6Raw_sound (a : PairSlot) : + (CA1_5_10I1R6Raw a).Encloses (CA1_5_10I1R6Value a) := by + exact residualBall_sound_on (below (shape 1 5 10)) A1_5_10Law (fun u => (stageALaw (shape 1 5 10) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A1_5_10Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 5 10) (show (shape 1 5 10) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 6 a +def CA1_5_10I1R6Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA1_5_10I1R6Certificates_valid : + CA1_5_10I1R6Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_5_10I1R6CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA1_5_10I1R6P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_5_10I1R6Certificates (CA1_5_10I1R6CertificateIndex a)).input +lemma CA1_5_10I1R6P_check : ∀ a : PairSlot, contains (CA1_5_10I1R6Raw a) (CA1_5_10I1R6P a) = true := by + decide +kernel +lemma CA1_5_10I1R6P_sound (a : PairSlot) : + (CA1_5_10I1R6P a).Encloses (CA1_5_10I1R6Value a) := + contains_sound (CA1_5_10I1R6Raw_sound a) (CA1_5_10I1R6P_check a) +def CA1_5_10I1R6Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_5_10I1R6Certificates (CA1_5_10I1R6CertificateIndex a)).output +lemma CA1_5_10I1R6Terms_sound (a : PairSlot) : + (CA1_5_10I1R6Terms a).Encloses (Foundation.entropyTerm (CA1_5_10I1R6Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_5_10I1R6Certificates_valid + (CA1_5_10I1R6CertificateIndex a) (CA1_5_10I1R6P_sound a) +def CA1_5_10I1R6Entropy : Ball := ⟨0, 0⟩ +lemma CA1_5_10I1R6Entropy_sound : CA1_5_10I1R6Entropy.Encloses (Foundation.finiteEntropy CA1_5_10I1R6Value) := by + exact contains_sound (entropyPair_enclosed CA1_5_10I1R6Value CA1_5_10I1R6Terms CA1_5_10I1R6Terms_sound) (by decide +kernel) +def CA1_5_10I1R6Mass : Ball := ⟨0, 0⟩ +lemma CA1_5_10I1R6Mass_sound : CA1_5_10I1R6Mass.Encloses (∑ a, CA1_5_10I1R6Value a) := by + exact contains_sound (pairSumBall_sound CA1_5_10I1R6P CA1_5_10I1R6Value CA1_5_10I1R6P_sound) (by decide +kernel) +def CA1_5_10I1R6MassTerm : Ball := .exact 0 +lemma CA1_5_10I1R6MassTerm_sound : CA1_5_10I1R6MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_5_10I1R6Value a))) := + entropyTerm_zero_ball (CA1_5_10I1R6Mass_sound) +def CA1_5_10I1R6H : Ball := ⟨0, 0⟩ +lemma CA1_5_10I1R6H_sound : CA1_5_10I1R6H.Encloses (homogeneousEntropy CA1_5_10I1R6Value) := by + exact contains_sound (homogeneous_enclosed CA1_5_10I1R6Value CA1_5_10I1R6MassTerm_sound CA1_5_10I1R6Entropy_sound) (by decide +kernel) +def CA1_5_10I1R7Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 5 10)) (fun u => (stageALaw (shape 1 5 10) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 7 a +def CA1_5_10I1R7Raw (a : PairSlot) : Ball := residualBall (below (shape 1 5 10)) A1_5_10Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 7 a +lemma CA1_5_10I1R7Raw_sound (a : PairSlot) : + (CA1_5_10I1R7Raw a).Encloses (CA1_5_10I1R7Value a) := by + exact residualBall_sound_on (below (shape 1 5 10)) A1_5_10Law (fun u => (stageALaw (shape 1 5 10) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A1_5_10Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 5 10) (show (shape 1 5 10) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 7 a +def CA1_5_10I1R7Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA1_5_10I1R7Certificates_valid : + CA1_5_10I1R7Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_5_10I1R7CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA1_5_10I1R7P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_5_10I1R7Certificates (CA1_5_10I1R7CertificateIndex a)).input +lemma CA1_5_10I1R7P_check : ∀ a : PairSlot, contains (CA1_5_10I1R7Raw a) (CA1_5_10I1R7P a) = true := by + decide +kernel +lemma CA1_5_10I1R7P_sound (a : PairSlot) : + (CA1_5_10I1R7P a).Encloses (CA1_5_10I1R7Value a) := + contains_sound (CA1_5_10I1R7Raw_sound a) (CA1_5_10I1R7P_check a) +def CA1_5_10I1R7Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_5_10I1R7Certificates (CA1_5_10I1R7CertificateIndex a)).output +lemma CA1_5_10I1R7Terms_sound (a : PairSlot) : + (CA1_5_10I1R7Terms a).Encloses (Foundation.entropyTerm (CA1_5_10I1R7Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_5_10I1R7Certificates_valid + (CA1_5_10I1R7CertificateIndex a) (CA1_5_10I1R7P_sound a) +def CA1_5_10I1R7Entropy : Ball := ⟨0, 0⟩ +lemma CA1_5_10I1R7Entropy_sound : CA1_5_10I1R7Entropy.Encloses (Foundation.finiteEntropy CA1_5_10I1R7Value) := by + exact contains_sound (entropyPair_enclosed CA1_5_10I1R7Value CA1_5_10I1R7Terms CA1_5_10I1R7Terms_sound) (by decide +kernel) +def CA1_5_10I1R7Mass : Ball := ⟨0, 0⟩ +lemma CA1_5_10I1R7Mass_sound : CA1_5_10I1R7Mass.Encloses (∑ a, CA1_5_10I1R7Value a) := by + exact contains_sound (pairSumBall_sound CA1_5_10I1R7P CA1_5_10I1R7Value CA1_5_10I1R7P_sound) (by decide +kernel) +def CA1_5_10I1R7MassTerm : Ball := .exact 0 +lemma CA1_5_10I1R7MassTerm_sound : CA1_5_10I1R7MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_5_10I1R7Value a))) := + entropyTerm_zero_ball (CA1_5_10I1R7Mass_sound) +def CA1_5_10I1R7H : Ball := ⟨0, 0⟩ +lemma CA1_5_10I1R7H_sound : CA1_5_10I1R7H.Encloses (homogeneousEntropy CA1_5_10I1R7Value) := by + exact contains_sound (homogeneous_enclosed CA1_5_10I1R7Value CA1_5_10I1R7MassTerm_sound CA1_5_10I1R7Entropy_sound) (by decide +kernel) +def CA1_5_10I1R8Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 5 10)) (fun u => (stageALaw (shape 1 5 10) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 8 a +def CA1_5_10I1R8Raw (a : PairSlot) : Ball := residualBall (below (shape 1 5 10)) A1_5_10Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 8 a +lemma CA1_5_10I1R8Raw_sound (a : PairSlot) : + (CA1_5_10I1R8Raw a).Encloses (CA1_5_10I1R8Value a) := by + exact residualBall_sound_on (below (shape 1 5 10)) A1_5_10Law (fun u => (stageALaw (shape 1 5 10) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A1_5_10Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 5 10) (show (shape 1 5 10) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 8 a +def CA1_5_10I1R8Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA1_5_10I1R8Certificates_valid : + CA1_5_10I1R8Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_5_10I1R8CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA1_5_10I1R8P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_5_10I1R8Certificates (CA1_5_10I1R8CertificateIndex a)).input +lemma CA1_5_10I1R8P_check : ∀ a : PairSlot, contains (CA1_5_10I1R8Raw a) (CA1_5_10I1R8P a) = true := by + decide +kernel +lemma CA1_5_10I1R8P_sound (a : PairSlot) : + (CA1_5_10I1R8P a).Encloses (CA1_5_10I1R8Value a) := + contains_sound (CA1_5_10I1R8Raw_sound a) (CA1_5_10I1R8P_check a) +def CA1_5_10I1R8Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_5_10I1R8Certificates (CA1_5_10I1R8CertificateIndex a)).output +lemma CA1_5_10I1R8Terms_sound (a : PairSlot) : + (CA1_5_10I1R8Terms a).Encloses (Foundation.entropyTerm (CA1_5_10I1R8Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_5_10I1R8Certificates_valid + (CA1_5_10I1R8CertificateIndex a) (CA1_5_10I1R8P_sound a) +def CA1_5_10I1R8Entropy : Ball := ⟨0, 0⟩ +lemma CA1_5_10I1R8Entropy_sound : CA1_5_10I1R8Entropy.Encloses (Foundation.finiteEntropy CA1_5_10I1R8Value) := by + exact contains_sound (entropyPair_enclosed CA1_5_10I1R8Value CA1_5_10I1R8Terms CA1_5_10I1R8Terms_sound) (by decide +kernel) +def CA1_5_10I1R8Mass : Ball := ⟨0, 0⟩ +lemma CA1_5_10I1R8Mass_sound : CA1_5_10I1R8Mass.Encloses (∑ a, CA1_5_10I1R8Value a) := by + exact contains_sound (pairSumBall_sound CA1_5_10I1R8P CA1_5_10I1R8Value CA1_5_10I1R8P_sound) (by decide +kernel) +def CA1_5_10I1R8MassTerm : Ball := .exact 0 +lemma CA1_5_10I1R8MassTerm_sound : CA1_5_10I1R8MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_5_10I1R8Value a))) := + entropyTerm_zero_ball (CA1_5_10I1R8Mass_sound) +def CA1_5_10I1R8H : Ball := ⟨0, 0⟩ +lemma CA1_5_10I1R8H_sound : CA1_5_10I1R8H.Encloses (homogeneousEntropy CA1_5_10I1R8Value) := by + exact contains_sound (homogeneous_enclosed CA1_5_10I1R8Value CA1_5_10I1R8MassTerm_sound CA1_5_10I1R8Entropy_sound) (by decide +kernel) +def CA1_5_10I1R9Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 5 10)) (fun u => (stageALaw (shape 1 5 10) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 9 a +def CA1_5_10I1R9Raw (a : PairSlot) : Ball := residualBall (below (shape 1 5 10)) A1_5_10Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 9 a +lemma CA1_5_10I1R9Raw_sound (a : PairSlot) : + (CA1_5_10I1R9Raw a).Encloses (CA1_5_10I1R9Value a) := by + exact residualBall_sound_on (below (shape 1 5 10)) A1_5_10Law (fun u => (stageALaw (shape 1 5 10) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A1_5_10Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 5 10) (show (shape 1 5 10) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 9 a +def CA1_5_10I1R9Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA1_5_10I1R9Certificates_valid : + CA1_5_10I1R9Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_5_10I1R9CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA1_5_10I1R9P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_5_10I1R9Certificates (CA1_5_10I1R9CertificateIndex a)).input +lemma CA1_5_10I1R9P_check : ∀ a : PairSlot, contains (CA1_5_10I1R9Raw a) (CA1_5_10I1R9P a) = true := by + decide +kernel +lemma CA1_5_10I1R9P_sound (a : PairSlot) : + (CA1_5_10I1R9P a).Encloses (CA1_5_10I1R9Value a) := + contains_sound (CA1_5_10I1R9Raw_sound a) (CA1_5_10I1R9P_check a) +def CA1_5_10I1R9Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_5_10I1R9Certificates (CA1_5_10I1R9CertificateIndex a)).output +lemma CA1_5_10I1R9Terms_sound (a : PairSlot) : + (CA1_5_10I1R9Terms a).Encloses (Foundation.entropyTerm (CA1_5_10I1R9Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_5_10I1R9Certificates_valid + (CA1_5_10I1R9CertificateIndex a) (CA1_5_10I1R9P_sound a) +def CA1_5_10I1R9Entropy : Ball := ⟨0, 0⟩ +lemma CA1_5_10I1R9Entropy_sound : CA1_5_10I1R9Entropy.Encloses (Foundation.finiteEntropy CA1_5_10I1R9Value) := by + exact contains_sound (entropyPair_enclosed CA1_5_10I1R9Value CA1_5_10I1R9Terms CA1_5_10I1R9Terms_sound) (by decide +kernel) +def CA1_5_10I1R9Mass : Ball := ⟨0, 0⟩ +lemma CA1_5_10I1R9Mass_sound : CA1_5_10I1R9Mass.Encloses (∑ a, CA1_5_10I1R9Value a) := by + exact contains_sound (pairSumBall_sound CA1_5_10I1R9P CA1_5_10I1R9Value CA1_5_10I1R9P_sound) (by decide +kernel) +def CA1_5_10I1R9MassTerm : Ball := .exact 0 +lemma CA1_5_10I1R9MassTerm_sound : CA1_5_10I1R9MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_5_10I1R9Value a))) := + entropyTerm_zero_ball (CA1_5_10I1R9Mass_sound) +def CA1_5_10I1R9H : Ball := ⟨0, 0⟩ +lemma CA1_5_10I1R9H_sound : CA1_5_10I1R9H.Encloses (homogeneousEntropy CA1_5_10I1R9Value) := by + exact contains_sound (homogeneous_enclosed CA1_5_10I1R9Value CA1_5_10I1R9MassTerm_sound CA1_5_10I1R9Entropy_sound) (by decide +kernel) +def CA1_5_10I1R10Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 5 10)) (fun u => (stageALaw (shape 1 5 10) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 10 a +def CA1_5_10I1R10Raw (a : PairSlot) : Ball := residualBall (below (shape 1 5 10)) A1_5_10Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 10 a +lemma CA1_5_10I1R10Raw_sound (a : PairSlot) : + (CA1_5_10I1R10Raw a).Encloses (CA1_5_10I1R10Value a) := by + exact residualBall_sound_on (below (shape 1 5 10)) A1_5_10Law (fun u => (stageALaw (shape 1 5 10) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A1_5_10Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 5 10) (show (shape 1 5 10) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 10 a +def CA1_5_10I1R10Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA1_5_10I1R10Certificates_valid : + CA1_5_10I1R10Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_5_10I1R10CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA1_5_10I1R10P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_5_10I1R10Certificates (CA1_5_10I1R10CertificateIndex a)).input +lemma CA1_5_10I1R10P_check : ∀ a : PairSlot, contains (CA1_5_10I1R10Raw a) (CA1_5_10I1R10P a) = true := by + decide +kernel +lemma CA1_5_10I1R10P_sound (a : PairSlot) : + (CA1_5_10I1R10P a).Encloses (CA1_5_10I1R10Value a) := + contains_sound (CA1_5_10I1R10Raw_sound a) (CA1_5_10I1R10P_check a) +def CA1_5_10I1R10Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_5_10I1R10Certificates (CA1_5_10I1R10CertificateIndex a)).output +lemma CA1_5_10I1R10Terms_sound (a : PairSlot) : + (CA1_5_10I1R10Terms a).Encloses (Foundation.entropyTerm (CA1_5_10I1R10Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_5_10I1R10Certificates_valid + (CA1_5_10I1R10CertificateIndex a) (CA1_5_10I1R10P_sound a) +def CA1_5_10I1R10Entropy : Ball := ⟨0, 0⟩ +lemma CA1_5_10I1R10Entropy_sound : CA1_5_10I1R10Entropy.Encloses (Foundation.finiteEntropy CA1_5_10I1R10Value) := by + exact contains_sound (entropyPair_enclosed CA1_5_10I1R10Value CA1_5_10I1R10Terms CA1_5_10I1R10Terms_sound) (by decide +kernel) +def CA1_5_10I1R10Mass : Ball := ⟨0, 0⟩ +lemma CA1_5_10I1R10Mass_sound : CA1_5_10I1R10Mass.Encloses (∑ a, CA1_5_10I1R10Value a) := by + exact contains_sound (pairSumBall_sound CA1_5_10I1R10P CA1_5_10I1R10Value CA1_5_10I1R10P_sound) (by decide +kernel) +def CA1_5_10I1R10MassTerm : Ball := .exact 0 +lemma CA1_5_10I1R10MassTerm_sound : CA1_5_10I1R10MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_5_10I1R10Value a))) := + entropyTerm_zero_ball (CA1_5_10I1R10Mass_sound) +def CA1_5_10I1R10H : Ball := ⟨0, 0⟩ +lemma CA1_5_10I1R10H_sound : CA1_5_10I1R10H.Encloses (homogeneousEntropy CA1_5_10I1R10Value) := by + exact contains_sound (homogeneous_enclosed CA1_5_10I1R10Value CA1_5_10I1R10MassTerm_sound CA1_5_10I1R10Entropy_sound) (by decide +kernel) +def CA1_5_10I1R11Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 5 10)) (fun u => (stageALaw (shape 1 5 10) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 11 a +def CA1_5_10I1R11Raw (a : PairSlot) : Ball := residualBall (below (shape 1 5 10)) A1_5_10Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 11 a +lemma CA1_5_10I1R11Raw_sound (a : PairSlot) : + (CA1_5_10I1R11Raw a).Encloses (CA1_5_10I1R11Value a) := by + exact residualBall_sound_on (below (shape 1 5 10)) A1_5_10Law (fun u => (stageALaw (shape 1 5 10) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A1_5_10Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 5 10) (show (shape 1 5 10) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 11 a +def CA1_5_10I1R11Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA1_5_10I1R11Certificates_valid : + CA1_5_10I1R11Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_5_10I1R11CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA1_5_10I1R11P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_5_10I1R11Certificates (CA1_5_10I1R11CertificateIndex a)).input +lemma CA1_5_10I1R11P_check : ∀ a : PairSlot, contains (CA1_5_10I1R11Raw a) (CA1_5_10I1R11P a) = true := by + decide +kernel +lemma CA1_5_10I1R11P_sound (a : PairSlot) : + (CA1_5_10I1R11P a).Encloses (CA1_5_10I1R11Value a) := + contains_sound (CA1_5_10I1R11Raw_sound a) (CA1_5_10I1R11P_check a) +def CA1_5_10I1R11Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_5_10I1R11Certificates (CA1_5_10I1R11CertificateIndex a)).output +lemma CA1_5_10I1R11Terms_sound (a : PairSlot) : + (CA1_5_10I1R11Terms a).Encloses (Foundation.entropyTerm (CA1_5_10I1R11Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_5_10I1R11Certificates_valid + (CA1_5_10I1R11CertificateIndex a) (CA1_5_10I1R11P_sound a) +def CA1_5_10I1R11Entropy : Ball := ⟨0, 0⟩ +lemma CA1_5_10I1R11Entropy_sound : CA1_5_10I1R11Entropy.Encloses (Foundation.finiteEntropy CA1_5_10I1R11Value) := by + exact contains_sound (entropyPair_enclosed CA1_5_10I1R11Value CA1_5_10I1R11Terms CA1_5_10I1R11Terms_sound) (by decide +kernel) +def CA1_5_10I1R11Mass : Ball := ⟨0, 0⟩ +lemma CA1_5_10I1R11Mass_sound : CA1_5_10I1R11Mass.Encloses (∑ a, CA1_5_10I1R11Value a) := by + exact contains_sound (pairSumBall_sound CA1_5_10I1R11P CA1_5_10I1R11Value CA1_5_10I1R11P_sound) (by decide +kernel) +def CA1_5_10I1R11MassTerm : Ball := .exact 0 +lemma CA1_5_10I1R11MassTerm_sound : CA1_5_10I1R11MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_5_10I1R11Value a))) := + entropyTerm_zero_ball (CA1_5_10I1R11Mass_sound) +def CA1_5_10I1R11H : Ball := ⟨0, 0⟩ +lemma CA1_5_10I1R11H_sound : CA1_5_10I1R11H.Encloses (homogeneousEntropy CA1_5_10I1R11Value) := by + exact contains_sound (homogeneous_enclosed CA1_5_10I1R11Value CA1_5_10I1R11MassTerm_sound CA1_5_10I1R11Entropy_sound) (by decide +kernel) +def CA1_5_10I1R12Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 5 10)) (fun u => (stageALaw (shape 1 5 10) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 12 a +def CA1_5_10I1R12Raw (a : PairSlot) : Ball := residualBall (below (shape 1 5 10)) A1_5_10Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 12 a +lemma CA1_5_10I1R12Raw_sound (a : PairSlot) : + (CA1_5_10I1R12Raw a).Encloses (CA1_5_10I1R12Value a) := by + exact residualBall_sound_on (below (shape 1 5 10)) A1_5_10Law (fun u => (stageALaw (shape 1 5 10) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A1_5_10Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 5 10) (show (shape 1 5 10) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 12 a +def CA1_5_10I1R12Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA1_5_10I1R12Certificates_valid : + CA1_5_10I1R12Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_5_10I1R12CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA1_5_10I1R12P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_5_10I1R12Certificates (CA1_5_10I1R12CertificateIndex a)).input +lemma CA1_5_10I1R12P_check : ∀ a : PairSlot, contains (CA1_5_10I1R12Raw a) (CA1_5_10I1R12P a) = true := by + decide +kernel +lemma CA1_5_10I1R12P_sound (a : PairSlot) : + (CA1_5_10I1R12P a).Encloses (CA1_5_10I1R12Value a) := + contains_sound (CA1_5_10I1R12Raw_sound a) (CA1_5_10I1R12P_check a) +def CA1_5_10I1R12Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_5_10I1R12Certificates (CA1_5_10I1R12CertificateIndex a)).output +lemma CA1_5_10I1R12Terms_sound (a : PairSlot) : + (CA1_5_10I1R12Terms a).Encloses (Foundation.entropyTerm (CA1_5_10I1R12Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_5_10I1R12Certificates_valid + (CA1_5_10I1R12CertificateIndex a) (CA1_5_10I1R12P_sound a) +def CA1_5_10I1R12Entropy : Ball := ⟨0, 0⟩ +lemma CA1_5_10I1R12Entropy_sound : CA1_5_10I1R12Entropy.Encloses (Foundation.finiteEntropy CA1_5_10I1R12Value) := by + exact contains_sound (entropyPair_enclosed CA1_5_10I1R12Value CA1_5_10I1R12Terms CA1_5_10I1R12Terms_sound) (by decide +kernel) +def CA1_5_10I1R12Mass : Ball := ⟨0, 0⟩ +lemma CA1_5_10I1R12Mass_sound : CA1_5_10I1R12Mass.Encloses (∑ a, CA1_5_10I1R12Value a) := by + exact contains_sound (pairSumBall_sound CA1_5_10I1R12P CA1_5_10I1R12Value CA1_5_10I1R12P_sound) (by decide +kernel) +def CA1_5_10I1R12MassTerm : Ball := .exact 0 +lemma CA1_5_10I1R12MassTerm_sound : CA1_5_10I1R12MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_5_10I1R12Value a))) := + entropyTerm_zero_ball (CA1_5_10I1R12Mass_sound) +def CA1_5_10I1R12H : Ball := ⟨0, 0⟩ +lemma CA1_5_10I1R12H_sound : CA1_5_10I1R12H.Encloses (homogeneousEntropy CA1_5_10I1R12Value) := by + exact contains_sound (homogeneous_enclosed CA1_5_10I1R12Value CA1_5_10I1R12MassTerm_sound CA1_5_10I1R12Entropy_sound) (by decide +kernel) +def CA1_5_10I1R13Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 5 10)) (fun u => (stageALaw (shape 1 5 10) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 13 a +def CA1_5_10I1R13Raw (a : PairSlot) : Ball := residualBall (below (shape 1 5 10)) A1_5_10Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 13 a +lemma CA1_5_10I1R13Raw_sound (a : PairSlot) : + (CA1_5_10I1R13Raw a).Encloses (CA1_5_10I1R13Value a) := by + exact residualBall_sound_on (below (shape 1 5 10)) A1_5_10Law (fun u => (stageALaw (shape 1 5 10) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A1_5_10Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 5 10) (show (shape 1 5 10) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 13 a +def CA1_5_10I1R13Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA1_5_10I1R13Certificates_valid : + CA1_5_10I1R13Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_5_10I1R13CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA1_5_10I1R13P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_5_10I1R13Certificates (CA1_5_10I1R13CertificateIndex a)).input +lemma CA1_5_10I1R13P_check : ∀ a : PairSlot, contains (CA1_5_10I1R13Raw a) (CA1_5_10I1R13P a) = true := by + decide +kernel +lemma CA1_5_10I1R13P_sound (a : PairSlot) : + (CA1_5_10I1R13P a).Encloses (CA1_5_10I1R13Value a) := + contains_sound (CA1_5_10I1R13Raw_sound a) (CA1_5_10I1R13P_check a) +def CA1_5_10I1R13Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_5_10I1R13Certificates (CA1_5_10I1R13CertificateIndex a)).output +lemma CA1_5_10I1R13Terms_sound (a : PairSlot) : + (CA1_5_10I1R13Terms a).Encloses (Foundation.entropyTerm (CA1_5_10I1R13Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_5_10I1R13Certificates_valid + (CA1_5_10I1R13CertificateIndex a) (CA1_5_10I1R13P_sound a) +def CA1_5_10I1R13Entropy : Ball := ⟨0, 0⟩ +lemma CA1_5_10I1R13Entropy_sound : CA1_5_10I1R13Entropy.Encloses (Foundation.finiteEntropy CA1_5_10I1R13Value) := by + exact contains_sound (entropyPair_enclosed CA1_5_10I1R13Value CA1_5_10I1R13Terms CA1_5_10I1R13Terms_sound) (by decide +kernel) +def CA1_5_10I1R13Mass : Ball := ⟨0, 0⟩ +lemma CA1_5_10I1R13Mass_sound : CA1_5_10I1R13Mass.Encloses (∑ a, CA1_5_10I1R13Value a) := by + exact contains_sound (pairSumBall_sound CA1_5_10I1R13P CA1_5_10I1R13Value CA1_5_10I1R13P_sound) (by decide +kernel) +def CA1_5_10I1R13MassTerm : Ball := .exact 0 +lemma CA1_5_10I1R13MassTerm_sound : CA1_5_10I1R13MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_5_10I1R13Value a))) := + entropyTerm_zero_ball (CA1_5_10I1R13Mass_sound) +def CA1_5_10I1R13H : Ball := ⟨0, 0⟩ +lemma CA1_5_10I1R13H_sound : CA1_5_10I1R13H.Encloses (homogeneousEntropy CA1_5_10I1R13Value) := by + exact contains_sound (homogeneous_enclosed CA1_5_10I1R13Value CA1_5_10I1R13MassTerm_sound CA1_5_10I1R13Entropy_sound) (by decide +kernel) +def CA1_5_10I1R14Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 5 10)) (fun u => (stageALaw (shape 1 5 10) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 14 a +def CA1_5_10I1R14Raw (a : PairSlot) : Ball := residualBall (below (shape 1 5 10)) A1_5_10Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 14 a +lemma CA1_5_10I1R14Raw_sound (a : PairSlot) : + (CA1_5_10I1R14Raw a).Encloses (CA1_5_10I1R14Value a) := by + exact residualBall_sound_on (below (shape 1 5 10)) A1_5_10Law (fun u => (stageALaw (shape 1 5 10) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A1_5_10Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 5 10) (show (shape 1 5 10) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 14 a +def CA1_5_10I1R14Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA1_5_10I1R14Certificates_valid : + CA1_5_10I1R14Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_5_10I1R14CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA1_5_10I1R14P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_5_10I1R14Certificates (CA1_5_10I1R14CertificateIndex a)).input +lemma CA1_5_10I1R14P_check : ∀ a : PairSlot, contains (CA1_5_10I1R14Raw a) (CA1_5_10I1R14P a) = true := by + decide +kernel +lemma CA1_5_10I1R14P_sound (a : PairSlot) : + (CA1_5_10I1R14P a).Encloses (CA1_5_10I1R14Value a) := + contains_sound (CA1_5_10I1R14Raw_sound a) (CA1_5_10I1R14P_check a) +def CA1_5_10I1R14Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_5_10I1R14Certificates (CA1_5_10I1R14CertificateIndex a)).output +lemma CA1_5_10I1R14Terms_sound (a : PairSlot) : + (CA1_5_10I1R14Terms a).Encloses (Foundation.entropyTerm (CA1_5_10I1R14Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_5_10I1R14Certificates_valid + (CA1_5_10I1R14CertificateIndex a) (CA1_5_10I1R14P_sound a) +def CA1_5_10I1R14Entropy : Ball := ⟨0, 0⟩ +lemma CA1_5_10I1R14Entropy_sound : CA1_5_10I1R14Entropy.Encloses (Foundation.finiteEntropy CA1_5_10I1R14Value) := by + exact contains_sound (entropyPair_enclosed CA1_5_10I1R14Value CA1_5_10I1R14Terms CA1_5_10I1R14Terms_sound) (by decide +kernel) +def CA1_5_10I1R14Mass : Ball := ⟨0, 0⟩ +lemma CA1_5_10I1R14Mass_sound : CA1_5_10I1R14Mass.Encloses (∑ a, CA1_5_10I1R14Value a) := by + exact contains_sound (pairSumBall_sound CA1_5_10I1R14P CA1_5_10I1R14Value CA1_5_10I1R14P_sound) (by decide +kernel) +def CA1_5_10I1R14MassTerm : Ball := .exact 0 +lemma CA1_5_10I1R14MassTerm_sound : CA1_5_10I1R14MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_5_10I1R14Value a))) := + entropyTerm_zero_ball (CA1_5_10I1R14Mass_sound) +def CA1_5_10I1R14H : Ball := ⟨0, 0⟩ +lemma CA1_5_10I1R14H_sound : CA1_5_10I1R14H.Encloses (homogeneousEntropy CA1_5_10I1R14Value) := by + exact contains_sound (homogeneous_enclosed CA1_5_10I1R14Value CA1_5_10I1R14MassTerm_sound CA1_5_10I1R14Entropy_sound) (by decide +kernel) +def CA1_5_10I1R15Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 5 10)) (fun u => (stageALaw (shape 1 5 10) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 15 a +def CA1_5_10I1R15Raw (a : PairSlot) : Ball := residualBall (below (shape 1 5 10)) A1_5_10Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 15 a +lemma CA1_5_10I1R15Raw_sound (a : PairSlot) : + (CA1_5_10I1R15Raw a).Encloses (CA1_5_10I1R15Value a) := by + exact residualBall_sound_on (below (shape 1 5 10)) A1_5_10Law (fun u => (stageALaw (shape 1 5 10) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A1_5_10Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 5 10) (show (shape 1 5 10) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 15 a +def CA1_5_10I1R15Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA1_5_10I1R15Certificates_valid : + CA1_5_10I1R15Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_5_10I1R15CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA1_5_10I1R15P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_5_10I1R15Certificates (CA1_5_10I1R15CertificateIndex a)).input +lemma CA1_5_10I1R15P_check : ∀ a : PairSlot, contains (CA1_5_10I1R15Raw a) (CA1_5_10I1R15P a) = true := by + decide +kernel +lemma CA1_5_10I1R15P_sound (a : PairSlot) : + (CA1_5_10I1R15P a).Encloses (CA1_5_10I1R15Value a) := + contains_sound (CA1_5_10I1R15Raw_sound a) (CA1_5_10I1R15P_check a) +def CA1_5_10I1R15Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_5_10I1R15Certificates (CA1_5_10I1R15CertificateIndex a)).output +lemma CA1_5_10I1R15Terms_sound (a : PairSlot) : + (CA1_5_10I1R15Terms a).Encloses (Foundation.entropyTerm (CA1_5_10I1R15Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_5_10I1R15Certificates_valid + (CA1_5_10I1R15CertificateIndex a) (CA1_5_10I1R15P_sound a) +def CA1_5_10I1R15Entropy : Ball := ⟨0, 0⟩ +lemma CA1_5_10I1R15Entropy_sound : CA1_5_10I1R15Entropy.Encloses (Foundation.finiteEntropy CA1_5_10I1R15Value) := by + exact contains_sound (entropyPair_enclosed CA1_5_10I1R15Value CA1_5_10I1R15Terms CA1_5_10I1R15Terms_sound) (by decide +kernel) +def CA1_5_10I1R15Mass : Ball := ⟨0, 0⟩ +lemma CA1_5_10I1R15Mass_sound : CA1_5_10I1R15Mass.Encloses (∑ a, CA1_5_10I1R15Value a) := by + exact contains_sound (pairSumBall_sound CA1_5_10I1R15P CA1_5_10I1R15Value CA1_5_10I1R15P_sound) (by decide +kernel) +def CA1_5_10I1R15MassTerm : Ball := .exact 0 +lemma CA1_5_10I1R15MassTerm_sound : CA1_5_10I1R15MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_5_10I1R15Value a))) := + entropyTerm_zero_ball (CA1_5_10I1R15Mass_sound) +def CA1_5_10I1R15H : Ball := ⟨0, 0⟩ +lemma CA1_5_10I1R15H_sound : CA1_5_10I1R15H.Encloses (homogeneousEntropy CA1_5_10I1R15Value) := by + exact contains_sound (homogeneous_enclosed CA1_5_10I1R15Value CA1_5_10I1R15MassTerm_sound CA1_5_10I1R15Entropy_sound) (by decide +kernel) +def CA1_5_10I1R16Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 5 10)) (fun u => (stageALaw (shape 1 5 10) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 16 a +def CA1_5_10I1R16Raw (a : PairSlot) : Ball := residualBall (below (shape 1 5 10)) A1_5_10Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 16 a +lemma CA1_5_10I1R16Raw_sound (a : PairSlot) : + (CA1_5_10I1R16Raw a).Encloses (CA1_5_10I1R16Value a) := by + exact residualBall_sound_on (below (shape 1 5 10)) A1_5_10Law (fun u => (stageALaw (shape 1 5 10) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A1_5_10Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 5 10) (show (shape 1 5 10) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 16 a +def CA1_5_10I1R16Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA1_5_10I1R16Certificates_valid : + CA1_5_10I1R16Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_5_10I1R16CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA1_5_10I1R16P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_5_10I1R16Certificates (CA1_5_10I1R16CertificateIndex a)).input +lemma CA1_5_10I1R16P_check : ∀ a : PairSlot, contains (CA1_5_10I1R16Raw a) (CA1_5_10I1R16P a) = true := by + decide +kernel +lemma CA1_5_10I1R16P_sound (a : PairSlot) : + (CA1_5_10I1R16P a).Encloses (CA1_5_10I1R16Value a) := + contains_sound (CA1_5_10I1R16Raw_sound a) (CA1_5_10I1R16P_check a) +def CA1_5_10I1R16Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_5_10I1R16Certificates (CA1_5_10I1R16CertificateIndex a)).output +lemma CA1_5_10I1R16Terms_sound (a : PairSlot) : + (CA1_5_10I1R16Terms a).Encloses (Foundation.entropyTerm (CA1_5_10I1R16Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_5_10I1R16Certificates_valid + (CA1_5_10I1R16CertificateIndex a) (CA1_5_10I1R16P_sound a) +def CA1_5_10I1R16Entropy : Ball := ⟨0, 0⟩ +lemma CA1_5_10I1R16Entropy_sound : CA1_5_10I1R16Entropy.Encloses (Foundation.finiteEntropy CA1_5_10I1R16Value) := by + exact contains_sound (entropyPair_enclosed CA1_5_10I1R16Value CA1_5_10I1R16Terms CA1_5_10I1R16Terms_sound) (by decide +kernel) +def CA1_5_10I1R16Mass : Ball := ⟨0, 0⟩ +lemma CA1_5_10I1R16Mass_sound : CA1_5_10I1R16Mass.Encloses (∑ a, CA1_5_10I1R16Value a) := by + exact contains_sound (pairSumBall_sound CA1_5_10I1R16P CA1_5_10I1R16Value CA1_5_10I1R16P_sound) (by decide +kernel) +def CA1_5_10I1R16MassTerm : Ball := .exact 0 +lemma CA1_5_10I1R16MassTerm_sound : CA1_5_10I1R16MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_5_10I1R16Value a))) := + entropyTerm_zero_ball (CA1_5_10I1R16Mass_sound) +def CA1_5_10I1R16H : Ball := ⟨0, 0⟩ +lemma CA1_5_10I1R16H_sound : CA1_5_10I1R16H.Encloses (homogeneousEntropy CA1_5_10I1R16Value) := by + exact contains_sound (homogeneous_enclosed CA1_5_10I1R16Value CA1_5_10I1R16MassTerm_sound CA1_5_10I1R16Entropy_sound) (by decide +kernel) +def CA1_5_10I1ResidualEntropies (a : Fin 17) : Ball := + match a.val with + | 0 => CA1_5_10I1R0H + | 1 => CA1_5_10I1R1H + | 2 => CA1_5_10I1R2H + | 3 => CA1_5_10I1R3H + | 4 => CA1_5_10I1R4H + | 5 => CA1_5_10I1R5H + | 6 => CA1_5_10I1R6H + | 7 => CA1_5_10I1R7H + | 8 => CA1_5_10I1R8H + | 9 => CA1_5_10I1R9H + | 10 => CA1_5_10I1R10H + | 11 => CA1_5_10I1R11H + | 12 => CA1_5_10I1R12H + | 13 => CA1_5_10I1R13H + | 14 => CA1_5_10I1R14H + | 15 => CA1_5_10I1R15H + | 16 => CA1_5_10I1R16H + | _ => (.exact 0) +lemma CA1_5_10I1ResidualEntropies_sound (k : Fin 17) : + (CA1_5_10I1ResidualEntropies k).Encloses (homogeneousEntropy + (residualLaw (below (shape 1 5 10)) (fun u => (stageALaw (shape 1 5 10) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) k)) := by + fin_cases k + · exact CA1_5_10I1R0H_sound + · exact CA1_5_10I1R1H_sound + · exact CA1_5_10I1R2H_sound + · exact CA1_5_10I1R3H_sound + · exact CA1_5_10I1R4H_sound + · exact CA1_5_10I1R5H_sound + · exact CA1_5_10I1R6H_sound + · exact CA1_5_10I1R7H_sound + · exact CA1_5_10I1R8H_sound + · exact CA1_5_10I1R9H_sound + · exact CA1_5_10I1R10H_sound + · exact CA1_5_10I1R11H_sound + · exact CA1_5_10I1R12H_sound + · exact CA1_5_10I1R13H_sound + · exact CA1_5_10I1R14H_sound + · exact CA1_5_10I1R15H_sound + · exact CA1_5_10I1R16H_sound +def CA1_5_10I1Singles (s : Shape) : Ball := + match s 0, s 1, s 2 with + | _, _, _ => (.exact 0) +lemma CA1_5_10I1Singles_sound (u : Shape) (hu : u ∈ below (shape 1 5 10)) + (hd : designated (Equiv.refl (Fin 3)) 1 u) : + (CA1_5_10I1Singles u).Encloses (homogeneousEntropy ((fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) u)) := by + rw [A1_5_10_below] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 0 0 8) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 0 1 7) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 0 2 6) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 0 3 5) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 0 4 4) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 0 5 3) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 1 0 7) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 1 1 6) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 1 2 5) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 1 3 4) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 1 4 3) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 1 5 2) by decide +kernel) hd |>.elim +def CA1_5_10I1Singleton : Ball := ⟨0, 0⟩ +lemma CA1_5_10I1Singleton_sound : CA1_5_10I1Singleton.Encloses + (singletonEntropy (below (shape 1 5 10)) (fun u => (stageALaw (shape 1 5 10) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ))) := by + exact contains_sound (singletonBall_sound (below (shape 1 5 10)) A1_5_10Law (fun u => (stageALaw (shape 1 5 10) u : ℝ)) (Equiv.refl (Fin 3)) 1 + CA1_5_10I1Singles (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A1_5_10Law_sound u) CA1_5_10I1Singles_sound) (by decide +kernel) +def CA1_5_10I1Group : Ball := ⟨(107566777685042918569334801350657 / 100000000000000000000000000000000), (168158279169 / 100000000000000000000000000000000)⟩ +lemma CA1_5_10I1Group_sound : CA1_5_10I1Group.Encloses + (groupedEntropy (below (shape 1 5 10)) (fun u => (stageALaw (shape 1 5 10) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ))) := by + exact contains_sound (Ball.add_sound CA1_5_10I1Singleton_sound + (finSumBall_sound 17 CA1_5_10I1ResidualEntropies _ CA1_5_10I1ResidualEntropies_sound)) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CA1_5_10I1H : Ball := ⟨(58526090594701242412598870738069 / 50000000000000000000000000000000), (491766730057 / 100000000000000000000000000000000)⟩ +lemma CA1_5_10I1_sound : CA1_5_10I1H.Encloses (stageACapacity (shape 1 5 10) 1) := by + have hb := contains_sound (Ball.add_sound CA1_5_10I1PairH_sound + (Ball.neg_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) CA1_5_10I1Group_sound))) + (show contains (.add CA1_5_10I1PairH (.neg (.mul (.exact 2) CA1_5_10I1Group))) CA1_5_10I1H = true by decide +kernel) + simp only [stageACapacity, nativeCapacity, + show (1 : Fin 3) ≠ 0 by decide, ite_false, sub_eq_add_neg] + exact hb + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA1_5_10I2.lean b/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA1_5_10I2.lean new file mode 100644 index 0000000000000000000000000000000000000000..a8fbc7cdb48c5036331f97ba92f64daa46adb804 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA1_5_10I2.lean @@ -0,0 +1,836 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.CapacityA.CapA1_5_10I2Pair + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CA1_5_10I2R0Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 5 10)) (fun u => (stageALaw (shape 1 5 10) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 0 a +def CA1_5_10I2R0Raw (a : PairSlot) : Ball := residualBall (below (shape 1 5 10)) A1_5_10Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 0 a +lemma CA1_5_10I2R0Raw_sound (a : PairSlot) : + (CA1_5_10I2R0Raw a).Encloses (CA1_5_10I2R0Value a) := by + exact residualBall_sound_on (below (shape 1 5 10)) A1_5_10Law (fun u => (stageALaw (shape 1 5 10) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A1_5_10Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 5 10) (show (shape 1 5 10) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 0 a +def CA1_5_10I2R0Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA1_5_10I2R0Certificates_valid : + CA1_5_10I2R0Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_5_10I2R0CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA1_5_10I2R0P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_5_10I2R0Certificates (CA1_5_10I2R0CertificateIndex a)).input +lemma CA1_5_10I2R0P_check : ∀ a : PairSlot, contains (CA1_5_10I2R0Raw a) (CA1_5_10I2R0P a) = true := by + decide +kernel +lemma CA1_5_10I2R0P_sound (a : PairSlot) : + (CA1_5_10I2R0P a).Encloses (CA1_5_10I2R0Value a) := + contains_sound (CA1_5_10I2R0Raw_sound a) (CA1_5_10I2R0P_check a) +def CA1_5_10I2R0Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_5_10I2R0Certificates (CA1_5_10I2R0CertificateIndex a)).output +lemma CA1_5_10I2R0Terms_sound (a : PairSlot) : + (CA1_5_10I2R0Terms a).Encloses (Foundation.entropyTerm (CA1_5_10I2R0Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_5_10I2R0Certificates_valid + (CA1_5_10I2R0CertificateIndex a) (CA1_5_10I2R0P_sound a) +def CA1_5_10I2R0Entropy : Ball := ⟨0, 0⟩ +lemma CA1_5_10I2R0Entropy_sound : CA1_5_10I2R0Entropy.Encloses (Foundation.finiteEntropy CA1_5_10I2R0Value) := by + exact contains_sound (entropyPair_enclosed CA1_5_10I2R0Value CA1_5_10I2R0Terms CA1_5_10I2R0Terms_sound) (by decide +kernel) +def CA1_5_10I2R0Mass : Ball := ⟨0, 0⟩ +lemma CA1_5_10I2R0Mass_sound : CA1_5_10I2R0Mass.Encloses (∑ a, CA1_5_10I2R0Value a) := by + exact contains_sound (pairSumBall_sound CA1_5_10I2R0P CA1_5_10I2R0Value CA1_5_10I2R0P_sound) (by decide +kernel) +def CA1_5_10I2R0MassTerm : Ball := .exact 0 +lemma CA1_5_10I2R0MassTerm_sound : CA1_5_10I2R0MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_5_10I2R0Value a))) := + entropyTerm_zero_ball (CA1_5_10I2R0Mass_sound) +def CA1_5_10I2R0H : Ball := ⟨0, 0⟩ +lemma CA1_5_10I2R0H_sound : CA1_5_10I2R0H.Encloses (homogeneousEntropy CA1_5_10I2R0Value) := by + exact contains_sound (homogeneous_enclosed CA1_5_10I2R0Value CA1_5_10I2R0MassTerm_sound CA1_5_10I2R0Entropy_sound) (by decide +kernel) +def CA1_5_10I2R1Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 5 10)) (fun u => (stageALaw (shape 1 5 10) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 1 a +def CA1_5_10I2R1Raw (a : PairSlot) : Ball := residualBall (below (shape 1 5 10)) A1_5_10Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 1 a +lemma CA1_5_10I2R1Raw_sound (a : PairSlot) : + (CA1_5_10I2R1Raw a).Encloses (CA1_5_10I2R1Value a) := by + exact residualBall_sound_on (below (shape 1 5 10)) A1_5_10Law (fun u => (stageALaw (shape 1 5 10) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A1_5_10Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 5 10) (show (shape 1 5 10) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 1 a +def CA1_5_10I2R1Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA1_5_10I2R1Certificates_valid : + CA1_5_10I2R1Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_5_10I2R1CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA1_5_10I2R1P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_5_10I2R1Certificates (CA1_5_10I2R1CertificateIndex a)).input +lemma CA1_5_10I2R1P_check : ∀ a : PairSlot, contains (CA1_5_10I2R1Raw a) (CA1_5_10I2R1P a) = true := by + decide +kernel +lemma CA1_5_10I2R1P_sound (a : PairSlot) : + (CA1_5_10I2R1P a).Encloses (CA1_5_10I2R1Value a) := + contains_sound (CA1_5_10I2R1Raw_sound a) (CA1_5_10I2R1P_check a) +def CA1_5_10I2R1Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_5_10I2R1Certificates (CA1_5_10I2R1CertificateIndex a)).output +lemma CA1_5_10I2R1Terms_sound (a : PairSlot) : + (CA1_5_10I2R1Terms a).Encloses (Foundation.entropyTerm (CA1_5_10I2R1Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_5_10I2R1Certificates_valid + (CA1_5_10I2R1CertificateIndex a) (CA1_5_10I2R1P_sound a) +def CA1_5_10I2R1Entropy : Ball := ⟨0, 0⟩ +lemma CA1_5_10I2R1Entropy_sound : CA1_5_10I2R1Entropy.Encloses (Foundation.finiteEntropy CA1_5_10I2R1Value) := by + exact contains_sound (entropyPair_enclosed CA1_5_10I2R1Value CA1_5_10I2R1Terms CA1_5_10I2R1Terms_sound) (by decide +kernel) +def CA1_5_10I2R1Mass : Ball := ⟨0, 0⟩ +lemma CA1_5_10I2R1Mass_sound : CA1_5_10I2R1Mass.Encloses (∑ a, CA1_5_10I2R1Value a) := by + exact contains_sound (pairSumBall_sound CA1_5_10I2R1P CA1_5_10I2R1Value CA1_5_10I2R1P_sound) (by decide +kernel) +def CA1_5_10I2R1MassTerm : Ball := .exact 0 +lemma CA1_5_10I2R1MassTerm_sound : CA1_5_10I2R1MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_5_10I2R1Value a))) := + entropyTerm_zero_ball (CA1_5_10I2R1Mass_sound) +def CA1_5_10I2R1H : Ball := ⟨0, 0⟩ +lemma CA1_5_10I2R1H_sound : CA1_5_10I2R1H.Encloses (homogeneousEntropy CA1_5_10I2R1Value) := by + exact contains_sound (homogeneous_enclosed CA1_5_10I2R1Value CA1_5_10I2R1MassTerm_sound CA1_5_10I2R1Entropy_sound) (by decide +kernel) +def CA1_5_10I2R2Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 5 10)) (fun u => (stageALaw (shape 1 5 10) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 2 a +def CA1_5_10I2R2Raw (a : PairSlot) : Ball := residualBall (below (shape 1 5 10)) A1_5_10Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 2 a +lemma CA1_5_10I2R2Raw_sound (a : PairSlot) : + (CA1_5_10I2R2Raw a).Encloses (CA1_5_10I2R2Value a) := by + exact residualBall_sound_on (below (shape 1 5 10)) A1_5_10Law (fun u => (stageALaw (shape 1 5 10) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A1_5_10Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 5 10) (show (shape 1 5 10) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 2 a +def CA1_5_10I2R2Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(447236789237316840707946291 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(688610068444994029318992737 / 12500000000000000000000000000000), (179943 / 10000000000000000000000000000000)⟩ ⟨(-615879627987935948080324132652163 / 50000000000000000000000000000000), (402340873571 / 100000000000000000000000000000000)⟩ ⟨-18, 447236789237316840707946291, 381469726562500000000000000⟩, + .log ⟨(53769237716673631681010297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(194052899722326233188264489 / 25000000000000000000000000000000), (25051 / 10000000000000000000000000000000)⟩ ⟨(-180449740374644722766312628984091 / 12500000000000000000000000000000), (18634799233 / 4000000000000000000000000000000)⟩ ⟨-21, 53769237716673631681010297, 47683715820312500000000000⟩, + .log ⟨(1706374619138283140882338411 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(18733526669721479089924408983 / 100000000000000000000000000000000), (3071387 / 50000000000000000000000000000000)⟩ ⟨(-137231930635356939885690339142263 / 12500000000000000000000000000000), (179994530607 / 50000000000000000000000000000000)⟩ ⟨-16, 1706374619138283140882338411, 1525878906250000000000000000⟩] +lemma CA1_5_10I2R2Certificates_valid : + CA1_5_10I2R2Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_5_10I2R2CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 2, 0 => 1 + | 3, 0 => 2 + | 1, 1 => 3 + | 0, 2 => 1 + | 0, 3 => 2 + | _, _ => 0 +def CA1_5_10I2R2P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_5_10I2R2Certificates (CA1_5_10I2R2CertificateIndex a)).input +lemma CA1_5_10I2R2P_check : ∀ a : PairSlot, contains (CA1_5_10I2R2Raw a) (CA1_5_10I2R2P a) = true := by + decide +kernel +lemma CA1_5_10I2R2P_sound (a : PairSlot) : + (CA1_5_10I2R2P a).Encloses (CA1_5_10I2R2Value a) := + contains_sound (CA1_5_10I2R2Raw_sound a) (CA1_5_10I2R2P_check a) +def CA1_5_10I2R2Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_5_10I2R2Certificates (CA1_5_10I2R2CertificateIndex a)).output +lemma CA1_5_10I2R2Terms_sound (a : PairSlot) : + (CA1_5_10I2R2Terms a).Encloses (Foundation.entropyTerm (CA1_5_10I2R2Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_5_10I2R2Certificates_valid + (CA1_5_10I2R2CertificateIndex a) (CA1_5_10I2R2P_sound a) +def CA1_5_10I2R2Entropy : Ball := ⟨(31303710962619993424534408687 / 100000000000000000000000000000000), (5121327 / 50000000000000000000000000000000)⟩ +lemma CA1_5_10I2R2Entropy_sound : CA1_5_10I2R2Entropy.Encloses (Foundation.finiteEntropy CA1_5_10I2R2Value) := by + exact contains_sound (entropyPair_enclosed CA1_5_10I2R2Value CA1_5_10I2R2Terms CA1_5_10I2R2Terms_sound) (by decide +kernel) +def CA1_5_10I2R2Mass : Ball := ⟨(2708386673046264085660251587 / 100000000000000000000000000000000), (1 / 20000000000000000000000000000000)⟩ +lemma CA1_5_10I2R2Mass_sound : CA1_5_10I2R2Mass.Encloses (∑ a, CA1_5_10I2R2Value a) := by + exact contains_sound (pairSumBall_sound CA1_5_10I2R2P CA1_5_10I2R2Value CA1_5_10I2R2P_sound) (by decide +kernel) +def CA1_5_10I2R2MassTermLogWitness : LogWitness := ⟨-16, 2708386673046264085660251587, 1525878906250000000000000000⟩ +def CA1_5_10I2R2MassTermLog : Ball := ⟨(-262914308273830957315809376714093 / 25000000000000000000000000000000), (359989187223 / 100000000000000000000000000000000)⟩ +lemma CA1_5_10I2R2MassTermLog_sound : CA1_5_10I2R2MassTermLog.Encloses (Real.log ((∑ a, CA1_5_10I2R2Value a))) := by + exact checkLog_sound logTwoBall_sound (CA1_5_10I2R2Mass_sound) (w := CA1_5_10I2R2MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA1_5_10I2R2MassTerm : Ball := ⟨(28482944347280835581130251043 / 100000000000000000000000000000000), (9749953 / 100000000000000000000000000000000)⟩ +lemma CA1_5_10I2R2MassTerm_sound : CA1_5_10I2R2MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_5_10I2R2Value a))) := by + exact contains_sound (entropyTerm_ball (CA1_5_10I2R2Mass_sound) CA1_5_10I2R2MassTermLog_sound) (by decide +kernel) +def CA1_5_10I2R2H : Ball := ⟨(705191653834789460851039411 / 25000000000000000000000000000000), (19992607 / 100000000000000000000000000000000)⟩ +lemma CA1_5_10I2R2H_sound : CA1_5_10I2R2H.Encloses (homogeneousEntropy CA1_5_10I2R2Value) := by + exact contains_sound (homogeneous_enclosed CA1_5_10I2R2Value CA1_5_10I2R2MassTerm_sound CA1_5_10I2R2Entropy_sound) (by decide +kernel) +def CA1_5_10I2R3Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 5 10)) (fun u => (stageALaw (shape 1 5 10) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 3 a +def CA1_5_10I2R3Raw (a : PairSlot) : Ball := residualBall (below (shape 1 5 10)) A1_5_10Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 3 a +lemma CA1_5_10I2R3Raw_sound (a : PairSlot) : + (CA1_5_10I2R3Raw a).Encloses (CA1_5_10I2R3Value a) := by + exact residualBall_sound_on (below (shape 1 5 10)) A1_5_10Law (fun u => (stageALaw (shape 1 5 10) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A1_5_10Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 5 10) (show (shape 1 5 10) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 3 a +def CA1_5_10I2R3Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(7545199268018009738646353009 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(71619136801824455550077378629 / 100000000000000000000000000000000), (23966383 / 100000000000000000000000000000000)⟩ ⟨(-949201396249373474590457070135581 / 100000000000000000000000000000000), (158818684249 / 50000000000000000000000000000000)⟩ ⟨-14, 7545199268018009738646353009, 6103515625000000000000000000⟩, + .log ⟨(16035475738875733852218175097 / 6250000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ ⟨(191320327118919030770614562963 / 12500000000000000000000000000000), (271651533 / 50000000000000000000000000000000)⟩ ⟨(-149138331031153994408879828874169 / 25000000000000000000000000000000), (211758237609 / 100000000000000000000000000000000)⟩ ⟨-9, 16035475738875733852218175097, 12207031250000000000000000000⟩, + .log ⟨(24852298700834377326952470709 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(206273463219252053923611048123 / 100000000000000000000000000000000), (17103709 / 25000000000000000000000000000000)⟩ ⟨(-829997521365404894280747642876339 / 100000000000000000000000000000000), (137642855951 / 50000000000000000000000000000000)⟩ ⟨-12, 24852298700834377326952470709, 24414062500000000000000000000⟩] +lemma CA1_5_10I2R3Certificates_valid : + CA1_5_10I2R3Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_5_10I2R3CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 4, 0 => 1 + | 2, 1 => 2 + | 3, 1 => 3 + | 1, 2 => 2 + | 1, 3 => 3 + | 0, 4 => 1 + | _, _ => 0 +def CA1_5_10I2R3P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_5_10I2R3Certificates (CA1_5_10I2R3CertificateIndex a)).input +lemma CA1_5_10I2R3P_check : ∀ a : PairSlot, contains (CA1_5_10I2R3Raw a) (CA1_5_10I2R3P a) = true := by + decide +kernel +lemma CA1_5_10I2R3P_sound (a : PairSlot) : + (CA1_5_10I2R3P a).Encloses (CA1_5_10I2R3Value a) := + contains_sound (CA1_5_10I2R3Raw_sound a) (CA1_5_10I2R3P_check a) +def CA1_5_10I2R3Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_5_10I2R3Certificates (CA1_5_10I2R3CertificateIndex a)).output +lemma CA1_5_10I2R3Terms_sound (a : PairSlot) : + (CA1_5_10I2R3Terms a).Encloses (Foundation.entropyTerm (CA1_5_10I2R3Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_5_10I2R3Certificates_valid + (CA1_5_10I2R3CertificateIndex a) (CA1_5_10I2R3P_sound a) +def CA1_5_10I2R3Entropy : Ball := ⟨(226056902121553594454825616307 / 6250000000000000000000000000000), (127136857 / 10000000000000000000000000000000)⟩ +lemma CA1_5_10I2R3Entropy_sound : CA1_5_10I2R3Entropy.Encloses (Foundation.finiteEntropy CA1_5_10I2R3Value) := by + exact contains_sound (entropyPair_enclosed CA1_5_10I2R3Value CA1_5_10I2R3Terms CA1_5_10I2R3Terms_sound) (by decide +kernel) +def CA1_5_10I2R3Mass : Ball := ⟨(28896510979086412870108962527 / 5000000000000000000000000000000), (1 / 12500000000000000000000000000000)⟩ +lemma CA1_5_10I2R3Mass_sound : CA1_5_10I2R3Mass.Encloses (∑ a, CA1_5_10I2R3Value a) := by + exact contains_sound (pairSumBall_sound CA1_5_10I2R3P CA1_5_10I2R3Value CA1_5_10I2R3P_sound) (by decide +kernel) +def CA1_5_10I2R3MassTermLogWitness : LogWitness := ⟨-8, 28896510979086412870108962527, 19531250000000000000000000000⟩ +def CA1_5_10I2R3MassTermLog : Ball := ⟨(-128836808273830957315809414912993 / 25000000000000000000000000000000), (190582414531 / 100000000000000000000000000000000)⟩ +lemma CA1_5_10I2R3MassTermLog_sound : CA1_5_10I2R3MassTermLog.Encloses (Real.log ((∑ a, CA1_5_10I2R3Value a))) := by + exact checkLog_sound logTwoBall_sound (CA1_5_10I2R3Mass_sound) (w := CA1_5_10I2R3MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA1_5_10I2R3MassTerm : Ball := ⟨(2978347395836165963875989593137 / 100000000000000000000000000000000), (1101433409 / 100000000000000000000000000000000)⟩ +lemma CA1_5_10I2R3MassTerm_sound : CA1_5_10I2R3MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_5_10I2R3Value a))) := by + exact contains_sound (entropyTerm_ball (CA1_5_10I2R3Mass_sound) CA1_5_10I2R3MassTermLog_sound) (by decide +kernel) +def CA1_5_10I2R3H : Ball := ⟨(25542521524347661896048810711 / 4000000000000000000000000000000), (2372801979 / 100000000000000000000000000000000)⟩ +lemma CA1_5_10I2R3H_sound : CA1_5_10I2R3H.Encloses (homogeneousEntropy CA1_5_10I2R3Value) := by + exact contains_sound (homogeneous_enclosed CA1_5_10I2R3Value CA1_5_10I2R3MassTerm_sound CA1_5_10I2R3Entropy_sound) (by decide +kernel) +def CA1_5_10I2R4Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 5 10)) (fun u => (stageALaw (shape 1 5 10) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 4 a +def CA1_5_10I2R4Raw (a : PairSlot) : Ball := residualBall (below (shape 1 5 10)) A1_5_10Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 4 a +lemma CA1_5_10I2R4Raw_sound (a : PairSlot) : + (CA1_5_10I2R4Raw a).Encloses (CA1_5_10I2R4Value a) := by + exact residualBall_sound_on (below (shape 1 5 10)) A1_5_10Law (fun u => (stageALaw (shape 1 5 10) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A1_5_10Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 5 10) (show (shape 1 5 10) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 4 a +def CA1_5_10I2R4Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(632871159398230728670782241 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(13396767985006072636062921341 / 50000000000000000000000000000000), (9113079 / 100000000000000000000000000000000)⟩ ⟨(-105841195210605492117564918365433 / 10000000000000000000000000000000), (359989042113 / 100000000000000000000000000000000)⟩ ⟨-16, 632871159398230728670782241, 381469726562500000000000000⟩, + .log ⟨(20058892686705406523311807527 / 2000000000000000000000000000000), (1 / 20000000000000000000000000000000)⟩ ⟨(1153945440678932638698219878697 / 25000000000000000000000000000000), (212381791 / 12500000000000000000000000000000)⟩ ⟨(-115055746964910214632716111832649 / 25000000000000000000000000000000), (84703294981 / 50000000000000000000000000000000)⟩ ⟨-7, 20058892686705406523311807527, 15625000000000000000000000000⟩, + .log ⟨(1065807453028293525913333569141 / 10000000000000000000000000000000), (13 / 50000000000000000000000000000000)⟩ ⟨(5965463960001714492232909133471 / 25000000000000000000000000000000), (5642337719 / 50000000000000000000000000000000)⟩ ⟨(-223885240924219805416967771004573 / 100000000000000000000000000000000), (105879118659 / 100000000000000000000000000000000)⟩ ⟨-4, 1065807453028293525913333569141, 625000000000000000000000000000⟩, + .log ⟨(3453880792944542478296706953 / 625000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ ⟨(359082936537564572837174392869 / 12500000000000000000000000000000), (1053198311 / 100000000000000000000000000000000)⟩ ⟨(-6497816479203003750205809534597 / 1250000000000000000000000000000), (190582413509 / 100000000000000000000000000000000)⟩ ⟨-8, 3453880792944542478296706953, 2441406250000000000000000000⟩, + .log ⟨(1316827912981976963120678709 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(3699529166154410349622448903 / 25000000000000000000000000000000), (2509649 / 50000000000000000000000000000000)⟩ ⟨(-224753994333353395052494386894243 / 20000000000000000000000000000000), (190582451117 / 50000000000000000000000000000000)⟩ ⟨-17, 1316827912981976963120678709, 762939453125000000000000000⟩] +lemma CA1_5_10I2R4Certificates_valid : + CA1_5_10I2R4Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_5_10I2R4CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 5, 0 => 1 + | 4, 1 => 2 + | 2, 2 => 3 + | 2, 3 => 4 + | 3, 2 => 4 + | 3, 3 => 5 + | 1, 4 => 2 + | 0, 5 => 1 + | _, _ => 0 +def CA1_5_10I2R4P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_5_10I2R4Certificates (CA1_5_10I2R4CertificateIndex a)).input +lemma CA1_5_10I2R4P_check : ∀ a : PairSlot, contains (CA1_5_10I2R4Raw a) (CA1_5_10I2R4P a) = true := by + decide +kernel +lemma CA1_5_10I2R4P_sound (a : PairSlot) : + (CA1_5_10I2R4P a).Encloses (CA1_5_10I2R4Value a) := + contains_sound (CA1_5_10I2R4Raw_sound a) (CA1_5_10I2R4P_check a) +def CA1_5_10I2R4Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_5_10I2R4Certificates (CA1_5_10I2R4CertificateIndex a)).output +lemma CA1_5_10I2R4Terms_sound (a : PairSlot) : + (CA1_5_10I2R4Terms a).Encloses (Foundation.entropyTerm (CA1_5_10I2R4Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_5_10I2R4Certificates_valid + (CA1_5_10I2R4CertificateIndex a) (CA1_5_10I2R4P_sound a) +def CA1_5_10I2R4Entropy : Ball := ⟨(1945356576932199708792746366517 / 5000000000000000000000000000000), (4203106543 / 25000000000000000000000000000000)⟩ +lemma CA1_5_10I2R4Entropy_sound : CA1_5_10I2R4Entropy.Encloses (Foundation.finiteEntropy CA1_5_10I2R4Value) := by + exact contains_sound (entropyPair_enclosed CA1_5_10I2R4Value CA1_5_10I2R4Terms CA1_5_10I2R4Terms_sound) (by decide +kernel) +def CA1_5_10I2R4Mass : Ball := ⟨(13775585449883897327311949605707 / 100000000000000000000000000000000), (43 / 100000000000000000000000000000000)⟩ +lemma CA1_5_10I2R4Mass_sound : CA1_5_10I2R4Mass.Encloses (∑ a, CA1_5_10I2R4Value a) := by + exact contains_sound (pairSumBall_sound CA1_5_10I2R4P CA1_5_10I2R4Value CA1_5_10I2R4P_sound) (by decide +kernel) +def CA1_5_10I2R4MassTermLogWitness : LogWitness := ⟨-3, 13775585449883897327311949605707, 12500000000000000000000000000000⟩ +def CA1_5_10I2R4MassTermLog : Ball := ⟨(-39645446619064765852647551025943 / 20000000000000000000000000000000), (84703295043 / 100000000000000000000000000000000)⟩ +lemma CA1_5_10I2R4MassTermLog_sound : CA1_5_10I2R4MassTermLog.Encloses (Real.log ((∑ a, CA1_5_10I2R4Value a))) := by + exact checkLog_sound logTwoBall_sound (CA1_5_10I2R4Mass_sound) (w := CA1_5_10I2R4MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA1_5_10I2R4MassTerm : Ball := ⟨(1365348093999343346937508993141 / 5000000000000000000000000000000), (11668374873 / 100000000000000000000000000000000)⟩ +lemma CA1_5_10I2R4MassTerm_sound : CA1_5_10I2R4MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_5_10I2R4Value a))) := by + exact contains_sound (entropyTerm_ball (CA1_5_10I2R4Mass_sound) CA1_5_10I2R4MassTermLog_sound) (by decide +kernel) +def CA1_5_10I2R4H : Ball := ⟨(9062632545825880653988083959 / 78125000000000000000000000000), (5696160209 / 20000000000000000000000000000000)⟩ +lemma CA1_5_10I2R4H_sound : CA1_5_10I2R4H.Encloses (homogeneousEntropy CA1_5_10I2R4Value) := by + exact contains_sound (homogeneous_enclosed CA1_5_10I2R4Value CA1_5_10I2R4MassTerm_sound CA1_5_10I2R4Entropy_sound) (by decide +kernel) +def CA1_5_10I2R5Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 5 10)) (fun u => (stageALaw (shape 1 5 10) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 5 a +def CA1_5_10I2R5Raw (a : PairSlot) : Ball := residualBall (below (shape 1 5 10)) A1_5_10Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 5 a +lemma CA1_5_10I2R5Raw_sound (a : PairSlot) : + (CA1_5_10I2R5Raw a).Encloses (CA1_5_10I2R5Value a) := by + exact residualBall_sound_on (below (shape 1 5 10)) A1_5_10Law (fun u => (stageALaw (shape 1 5 10) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A1_5_10Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 5 10) (show (shape 1 5 10) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 5 a +def CA1_5_10I2R5Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(1258098169685637449695465587 / 6250000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(171317453113904513126502808813 / 100000000000000000000000000000000), (14919111 / 25000000000000000000000000000000)⟩ ⟨(-851073555118078631593835392303337 / 100000000000000000000000000000000), (29646153653 / 10000000000000000000000000000000)⟩ ⟨-13, 1258098169685637449695465587, 762939453125000000000000000⟩, + .log ⟨(6684646318168966297530337967463 / 50000000000000000000000000000000), (1 / 4000000000000000000000000000000)⟩ ⟨(13450910182909538526533189477777 / 50000000000000000000000000000000), (11324231421 / 100000000000000000000000000000000)⟩ ⟨(-50305242576371498699063217216007 / 25000000000000000000000000000000), (42351647459 / 50000000000000000000000000000000)⟩ ⟨-3, 6684646318168966297530337967463, 6250000000000000000000000000000⟩, + .log ⟨(493377940579587723437131807133 / 100000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ ⟨(524130184741895029846388666731 / 20000000000000000000000000000000), (470145799 / 50000000000000000000000000000000)⟩ ⟨(-531164997087406874113207080480883 / 100000000000000000000000000000000), (11911400847 / 6250000000000000000000000000000)⟩ ⟨-8, 493377940579587723437131807133, 390625000000000000000000000000⟩] +lemma CA1_5_10I2R5Certificates_valid : + CA1_5_10I2R5Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_5_10I2R5CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 5, 1 => 1 + | 4, 2 => 2 + | 4, 3 => 3 + | 2, 4 => 2 + | 3, 4 => 3 + | 1, 5 => 1 + | _, _ => 0 +def CA1_5_10I2R5P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_5_10I2R5Certificates (CA1_5_10I2R5CertificateIndex a)).input +lemma CA1_5_10I2R5P_check : ∀ a : PairSlot, contains (CA1_5_10I2R5Raw a) (CA1_5_10I2R5P a) = true := by + decide +kernel +lemma CA1_5_10I2R5P_sound (a : PairSlot) : + (CA1_5_10I2R5P a).Encloses (CA1_5_10I2R5Value a) := + contains_sound (CA1_5_10I2R5Raw_sound a) (CA1_5_10I2R5P_check a) +def CA1_5_10I2R5Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_5_10I2R5Certificates (CA1_5_10I2R5CertificateIndex a)).output +lemma CA1_5_10I2R5Terms_sound (a : PairSlot) : + (CA1_5_10I2R5Terms a).Encloses (Foundation.entropyTerm (CA1_5_10I2R5Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_5_10I2R5Certificates_valid + (CA1_5_10I2R5CertificateIndex a) (CA1_5_10I2R5P_sound a) +def CA1_5_10I2R5Entropy : Ball := ⟨(14846894371321228357712412549011 / 25000000000000000000000000000000), (12324199463 / 50000000000000000000000000000000)⟩ +lemma CA1_5_10I2R5Entropy_sound : CA1_5_10I2R5Entropy.Encloses (Foundation.finiteEntropy CA1_5_10I2R5Value) := by + exact contains_sound (entropyPair_enclosed CA1_5_10I2R5Value CA1_5_10I2R5Terms CA1_5_10I2R5Terms_sound) (by decide +kernel) +def CA1_5_10I2R5Mass : Ball := ⟨(13882800147632490517692935191451 / 50000000000000000000000000000000), (7 / 12500000000000000000000000000000)⟩ +lemma CA1_5_10I2R5Mass_sound : CA1_5_10I2R5Mass.Encloses (∑ a, CA1_5_10I2R5Value a) := by + exact contains_sound (pairSumBall_sound CA1_5_10I2R5P CA1_5_10I2R5Value CA1_5_10I2R5P_sound) (by decide +kernel) +def CA1_5_10I2R5MassTermLogWitness : LogWitness := ⟨-2, 13882800147632490517692935191451, 12500000000000000000000000000000⟩ +def CA1_5_10I2R5MassTermLog : Ball := ⟨(-32034308273830957315809443556301 / 25000000000000000000000000000000), (50821977 / 80000000000000000000000000000)⟩ +lemma CA1_5_10I2R5MassTermLog_sound : CA1_5_10I2R5MassTermLog.Encloses (Real.log ((∑ a, CA1_5_10I2R5Value a))) := by + exact checkLog_sound logTwoBall_sound (CA1_5_10I2R5Mass_sound) (w := CA1_5_10I2R5MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA1_5_10I2R5MassTerm : Ball := ⟨(35578071970659610136089639018193 / 100000000000000000000000000000000), (17638783817 / 100000000000000000000000000000000)⟩ +lemma CA1_5_10I2R5MassTerm_sound : CA1_5_10I2R5MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_5_10I2R5Value a))) := by + exact contains_sound (entropyTerm_ball (CA1_5_10I2R5Mass_sound) CA1_5_10I2R5MassTermLog_sound) (by decide +kernel) +def CA1_5_10I2R5H : Ball := ⟨(23809505514625303294760011177851 / 100000000000000000000000000000000), (42287182743 / 100000000000000000000000000000000)⟩ +lemma CA1_5_10I2R5H_sound : CA1_5_10I2R5H.Encloses (homogeneousEntropy CA1_5_10I2R5Value) := by + exact contains_sound (homogeneous_enclosed CA1_5_10I2R5Value CA1_5_10I2R5MassTerm_sound CA1_5_10I2R5Entropy_sound) (by decide +kernel) +def CA1_5_10I2R6Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 5 10)) (fun u => (stageALaw (shape 1 5 10) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 6 a +def CA1_5_10I2R6Raw (a : PairSlot) : Ball := residualBall (below (shape 1 5 10)) A1_5_10Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 6 a +lemma CA1_5_10I2R6Raw_sound (a : PairSlot) : + (CA1_5_10I2R6Raw a).Encloses (CA1_5_10I2R6Value a) := by + exact residualBall_sound_on (below (shape 1 5 10)) A1_5_10Law (fun u => (stageALaw (shape 1 5 10) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A1_5_10Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 5 10) (show (shape 1 5 10) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 6 a +def CA1_5_10I2R6Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(35687513078880597433602857623 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(103422090723016740293707659229 / 20000000000000000000000000000000), (36274201 / 20000000000000000000000000000000)⟩ ⟨(-362248871525530095950681596372239 / 50000000000000000000000000000000), (63527471399 / 25000000000000000000000000000000)⟩ ⟨-11, 35687513078880597433602857623, 24414062500000000000000000000⟩, + .log ⟨(2248454976633005517664593 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(7607553095292825842435907 / 10000000000000000000000000000000), (12389 / 50000000000000000000000000000000)⟩ ⟨(-845864513004937999114364798625629 / 50000000000000000000000000000000), (2202374613 / 400000000000000000000000000000)⟩ ⟨-25, 2248454976633005517664593, 1490116119384765625000000⟩, + .log ⟨(3742132954163165391913878812327 / 50000000000000000000000000000000), (27 / 100000000000000000000000000000000)⟩ ⟨(19401965815814233651433897567907 / 100000000000000000000000000000000), (3962137431 / 50000000000000000000000000000000)⟩ ⟨(-64809181199151831416449059873581 / 25000000000000000000000000000000), (4235164751 / 4000000000000000000000000000000)⟩ ⟨-4, 3742132954163165391913878812327, 3125000000000000000000000000000⟩] +lemma CA1_5_10I2R6Certificates_valid : + CA1_5_10I2R6Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_5_10I2R6CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 5, 2 => 1 + | 5, 3 => 2 + | 4, 4 => 3 + | 2, 5 => 1 + | 3, 5 => 2 + | _, _ => 0 +def CA1_5_10I2R6P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_5_10I2R6Certificates (CA1_5_10I2R6CertificateIndex a)).input +lemma CA1_5_10I2R6P_check : ∀ a : PairSlot, contains (CA1_5_10I2R6Raw a) (CA1_5_10I2R6P a) = true := by + decide +kernel +lemma CA1_5_10I2R6P_sound (a : PairSlot) : + (CA1_5_10I2R6P a).Encloses (CA1_5_10I2R6Value a) := + contains_sound (CA1_5_10I2R6Raw_sound a) (CA1_5_10I2R6P_check a) +def CA1_5_10I2R6Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_5_10I2R6Certificates (CA1_5_10I2R6CertificateIndex a)).output +lemma CA1_5_10I2R6Terms_sound (a : PairSlot) : + (CA1_5_10I2R6Terms a).Encloses (Foundation.entropyTerm (CA1_5_10I2R6Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_5_10I2R6Certificates_valid + (CA1_5_10I2R6CertificateIndex a) (CA1_5_10I2R6P_sound a) +def CA1_5_10I2R6Entropy : Ball := ⟨(20436338874106306910887822878337 / 100000000000000000000000000000000), (2071766607 / 25000000000000000000000000000000)⟩ +lemma CA1_5_10I2R6Entropy_sound : CA1_5_10I2R6Entropy.Encloses (Foundation.finiteEntropy CA1_5_10I2R6Value) := by + exact contains_sound (entropyPair_enclosed CA1_5_10I2R6Value CA1_5_10I2R6Terms CA1_5_10I2R6Terms_sound) (by decide +kernel) +def CA1_5_10I2R6Mass : Ball := ⟨(3813512477230879852792119856759 / 50000000000000000000000000000000), (31 / 100000000000000000000000000000000)⟩ +lemma CA1_5_10I2R6Mass_sound : CA1_5_10I2R6Mass.Encloses (∑ a, CA1_5_10I2R6Value a) := by + exact contains_sound (pairSumBall_sound CA1_5_10I2R6P CA1_5_10I2R6Value CA1_5_10I2R6P_sound) (by decide +kernel) +def CA1_5_10I2R6MassTermLogWitness : LogWitness := ⟨-4, 3813512477230879852792119856759, 3125000000000000000000000000000⟩ +def CA1_5_10I2R6MassTermLog : Ball := ⟨(-257347233095323829263237736034197 / 100000000000000000000000000000000), (105879118821 / 100000000000000000000000000000000)⟩ +lemma CA1_5_10I2R6MassTermLog_sound : CA1_5_10I2R6MassTermLog.Encloses (Real.log ((∑ a, CA1_5_10I2R6Value a))) := by + exact checkLog_sound logTwoBall_sound (CA1_5_10I2R6Mass_sound) (w := CA1_5_10I2R6MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA1_5_10I2R6MassTerm : Ball := ⟨(1226746105487326305680353180991 / 6250000000000000000000000000000), (4037713447 / 50000000000000000000000000000000)⟩ +lemma CA1_5_10I2R6MassTerm_sound : CA1_5_10I2R6MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_5_10I2R6Value a))) := by + exact contains_sound (entropyTerm_ball (CA1_5_10I2R6Mass_sound) CA1_5_10I2R6MassTermLog_sound) (by decide +kernel) +def CA1_5_10I2R6H : Ball := ⟨(808401186309086020002171982481 / 100000000000000000000000000000000), (8181246661 / 50000000000000000000000000000000)⟩ +lemma CA1_5_10I2R6H_sound : CA1_5_10I2R6H.Encloses (homogeneousEntropy CA1_5_10I2R6Value) := by + exact contains_sound (homogeneous_enclosed CA1_5_10I2R6Value CA1_5_10I2R6MassTerm_sound CA1_5_10I2R6Entropy_sound) (by decide +kernel) +def CA1_5_10I2R7Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 5 10)) (fun u => (stageALaw (shape 1 5 10) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 7 a +def CA1_5_10I2R7Raw (a : PairSlot) : Ball := residualBall (below (shape 1 5 10)) A1_5_10Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 7 a +lemma CA1_5_10I2R7Raw_sound (a : PairSlot) : + (CA1_5_10I2R7Raw a).Encloses (CA1_5_10I2R7Value a) := by + exact residualBall_sound_on (below (shape 1 5 10)) A1_5_10Law (fun u => (stageALaw (shape 1 5 10) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A1_5_10Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 5 10) (show (shape 1 5 10) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 7 a +def CA1_5_10I2R7Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA1_5_10I2R7Certificates_valid : + CA1_5_10I2R7Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_5_10I2R7CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA1_5_10I2R7P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_5_10I2R7Certificates (CA1_5_10I2R7CertificateIndex a)).input +lemma CA1_5_10I2R7P_check : ∀ a : PairSlot, contains (CA1_5_10I2R7Raw a) (CA1_5_10I2R7P a) = true := by + decide +kernel +lemma CA1_5_10I2R7P_sound (a : PairSlot) : + (CA1_5_10I2R7P a).Encloses (CA1_5_10I2R7Value a) := + contains_sound (CA1_5_10I2R7Raw_sound a) (CA1_5_10I2R7P_check a) +def CA1_5_10I2R7Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_5_10I2R7Certificates (CA1_5_10I2R7CertificateIndex a)).output +lemma CA1_5_10I2R7Terms_sound (a : PairSlot) : + (CA1_5_10I2R7Terms a).Encloses (Foundation.entropyTerm (CA1_5_10I2R7Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_5_10I2R7Certificates_valid + (CA1_5_10I2R7CertificateIndex a) (CA1_5_10I2R7P_sound a) +def CA1_5_10I2R7Entropy : Ball := ⟨0, 0⟩ +lemma CA1_5_10I2R7Entropy_sound : CA1_5_10I2R7Entropy.Encloses (Foundation.finiteEntropy CA1_5_10I2R7Value) := by + exact contains_sound (entropyPair_enclosed CA1_5_10I2R7Value CA1_5_10I2R7Terms CA1_5_10I2R7Terms_sound) (by decide +kernel) +def CA1_5_10I2R7Mass : Ball := ⟨0, 0⟩ +lemma CA1_5_10I2R7Mass_sound : CA1_5_10I2R7Mass.Encloses (∑ a, CA1_5_10I2R7Value a) := by + exact contains_sound (pairSumBall_sound CA1_5_10I2R7P CA1_5_10I2R7Value CA1_5_10I2R7P_sound) (by decide +kernel) +def CA1_5_10I2R7MassTerm : Ball := .exact 0 +lemma CA1_5_10I2R7MassTerm_sound : CA1_5_10I2R7MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_5_10I2R7Value a))) := + entropyTerm_zero_ball (CA1_5_10I2R7Mass_sound) +def CA1_5_10I2R7H : Ball := ⟨0, 0⟩ +lemma CA1_5_10I2R7H_sound : CA1_5_10I2R7H.Encloses (homogeneousEntropy CA1_5_10I2R7Value) := by + exact contains_sound (homogeneous_enclosed CA1_5_10I2R7Value CA1_5_10I2R7MassTerm_sound CA1_5_10I2R7Entropy_sound) (by decide +kernel) +def CA1_5_10I2R8Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 5 10)) (fun u => (stageALaw (shape 1 5 10) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 8 a +def CA1_5_10I2R8Raw (a : PairSlot) : Ball := residualBall (below (shape 1 5 10)) A1_5_10Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 8 a +lemma CA1_5_10I2R8Raw_sound (a : PairSlot) : + (CA1_5_10I2R8Raw a).Encloses (CA1_5_10I2R8Value a) := by + exact residualBall_sound_on (below (shape 1 5 10)) A1_5_10Law (fun u => (stageALaw (shape 1 5 10) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A1_5_10Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 5 10) (show (shape 1 5 10) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 8 a +def CA1_5_10I2R8Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA1_5_10I2R8Certificates_valid : + CA1_5_10I2R8Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_5_10I2R8CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA1_5_10I2R8P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_5_10I2R8Certificates (CA1_5_10I2R8CertificateIndex a)).input +lemma CA1_5_10I2R8P_check : ∀ a : PairSlot, contains (CA1_5_10I2R8Raw a) (CA1_5_10I2R8P a) = true := by + decide +kernel +lemma CA1_5_10I2R8P_sound (a : PairSlot) : + (CA1_5_10I2R8P a).Encloses (CA1_5_10I2R8Value a) := + contains_sound (CA1_5_10I2R8Raw_sound a) (CA1_5_10I2R8P_check a) +def CA1_5_10I2R8Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_5_10I2R8Certificates (CA1_5_10I2R8CertificateIndex a)).output +lemma CA1_5_10I2R8Terms_sound (a : PairSlot) : + (CA1_5_10I2R8Terms a).Encloses (Foundation.entropyTerm (CA1_5_10I2R8Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_5_10I2R8Certificates_valid + (CA1_5_10I2R8CertificateIndex a) (CA1_5_10I2R8P_sound a) +def CA1_5_10I2R8Entropy : Ball := ⟨0, 0⟩ +lemma CA1_5_10I2R8Entropy_sound : CA1_5_10I2R8Entropy.Encloses (Foundation.finiteEntropy CA1_5_10I2R8Value) := by + exact contains_sound (entropyPair_enclosed CA1_5_10I2R8Value CA1_5_10I2R8Terms CA1_5_10I2R8Terms_sound) (by decide +kernel) +def CA1_5_10I2R8Mass : Ball := ⟨0, 0⟩ +lemma CA1_5_10I2R8Mass_sound : CA1_5_10I2R8Mass.Encloses (∑ a, CA1_5_10I2R8Value a) := by + exact contains_sound (pairSumBall_sound CA1_5_10I2R8P CA1_5_10I2R8Value CA1_5_10I2R8P_sound) (by decide +kernel) +def CA1_5_10I2R8MassTerm : Ball := .exact 0 +lemma CA1_5_10I2R8MassTerm_sound : CA1_5_10I2R8MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_5_10I2R8Value a))) := + entropyTerm_zero_ball (CA1_5_10I2R8Mass_sound) +def CA1_5_10I2R8H : Ball := ⟨0, 0⟩ +lemma CA1_5_10I2R8H_sound : CA1_5_10I2R8H.Encloses (homogeneousEntropy CA1_5_10I2R8Value) := by + exact contains_sound (homogeneous_enclosed CA1_5_10I2R8Value CA1_5_10I2R8MassTerm_sound CA1_5_10I2R8Entropy_sound) (by decide +kernel) +def CA1_5_10I2R9Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 5 10)) (fun u => (stageALaw (shape 1 5 10) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 9 a +def CA1_5_10I2R9Raw (a : PairSlot) : Ball := residualBall (below (shape 1 5 10)) A1_5_10Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 9 a +lemma CA1_5_10I2R9Raw_sound (a : PairSlot) : + (CA1_5_10I2R9Raw a).Encloses (CA1_5_10I2R9Value a) := by + exact residualBall_sound_on (below (shape 1 5 10)) A1_5_10Law (fun u => (stageALaw (shape 1 5 10) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A1_5_10Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 5 10) (show (shape 1 5 10) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 9 a +def CA1_5_10I2R9Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA1_5_10I2R9Certificates_valid : + CA1_5_10I2R9Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_5_10I2R9CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA1_5_10I2R9P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_5_10I2R9Certificates (CA1_5_10I2R9CertificateIndex a)).input +lemma CA1_5_10I2R9P_check : ∀ a : PairSlot, contains (CA1_5_10I2R9Raw a) (CA1_5_10I2R9P a) = true := by + decide +kernel +lemma CA1_5_10I2R9P_sound (a : PairSlot) : + (CA1_5_10I2R9P a).Encloses (CA1_5_10I2R9Value a) := + contains_sound (CA1_5_10I2R9Raw_sound a) (CA1_5_10I2R9P_check a) +def CA1_5_10I2R9Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_5_10I2R9Certificates (CA1_5_10I2R9CertificateIndex a)).output +lemma CA1_5_10I2R9Terms_sound (a : PairSlot) : + (CA1_5_10I2R9Terms a).Encloses (Foundation.entropyTerm (CA1_5_10I2R9Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_5_10I2R9Certificates_valid + (CA1_5_10I2R9CertificateIndex a) (CA1_5_10I2R9P_sound a) +def CA1_5_10I2R9Entropy : Ball := ⟨0, 0⟩ +lemma CA1_5_10I2R9Entropy_sound : CA1_5_10I2R9Entropy.Encloses (Foundation.finiteEntropy CA1_5_10I2R9Value) := by + exact contains_sound (entropyPair_enclosed CA1_5_10I2R9Value CA1_5_10I2R9Terms CA1_5_10I2R9Terms_sound) (by decide +kernel) +def CA1_5_10I2R9Mass : Ball := ⟨0, 0⟩ +lemma CA1_5_10I2R9Mass_sound : CA1_5_10I2R9Mass.Encloses (∑ a, CA1_5_10I2R9Value a) := by + exact contains_sound (pairSumBall_sound CA1_5_10I2R9P CA1_5_10I2R9Value CA1_5_10I2R9P_sound) (by decide +kernel) +def CA1_5_10I2R9MassTerm : Ball := .exact 0 +lemma CA1_5_10I2R9MassTerm_sound : CA1_5_10I2R9MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_5_10I2R9Value a))) := + entropyTerm_zero_ball (CA1_5_10I2R9Mass_sound) +def CA1_5_10I2R9H : Ball := ⟨0, 0⟩ +lemma CA1_5_10I2R9H_sound : CA1_5_10I2R9H.Encloses (homogeneousEntropy CA1_5_10I2R9Value) := by + exact contains_sound (homogeneous_enclosed CA1_5_10I2R9Value CA1_5_10I2R9MassTerm_sound CA1_5_10I2R9Entropy_sound) (by decide +kernel) +def CA1_5_10I2R10Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 5 10)) (fun u => (stageALaw (shape 1 5 10) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 10 a +def CA1_5_10I2R10Raw (a : PairSlot) : Ball := residualBall (below (shape 1 5 10)) A1_5_10Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 10 a +lemma CA1_5_10I2R10Raw_sound (a : PairSlot) : + (CA1_5_10I2R10Raw a).Encloses (CA1_5_10I2R10Value a) := by + exact residualBall_sound_on (below (shape 1 5 10)) A1_5_10Law (fun u => (stageALaw (shape 1 5 10) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A1_5_10Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 5 10) (show (shape 1 5 10) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 10 a +def CA1_5_10I2R10Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA1_5_10I2R10Certificates_valid : + CA1_5_10I2R10Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_5_10I2R10CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA1_5_10I2R10P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_5_10I2R10Certificates (CA1_5_10I2R10CertificateIndex a)).input +lemma CA1_5_10I2R10P_check : ∀ a : PairSlot, contains (CA1_5_10I2R10Raw a) (CA1_5_10I2R10P a) = true := by + decide +kernel +lemma CA1_5_10I2R10P_sound (a : PairSlot) : + (CA1_5_10I2R10P a).Encloses (CA1_5_10I2R10Value a) := + contains_sound (CA1_5_10I2R10Raw_sound a) (CA1_5_10I2R10P_check a) +def CA1_5_10I2R10Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_5_10I2R10Certificates (CA1_5_10I2R10CertificateIndex a)).output +lemma CA1_5_10I2R10Terms_sound (a : PairSlot) : + (CA1_5_10I2R10Terms a).Encloses (Foundation.entropyTerm (CA1_5_10I2R10Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_5_10I2R10Certificates_valid + (CA1_5_10I2R10CertificateIndex a) (CA1_5_10I2R10P_sound a) +def CA1_5_10I2R10Entropy : Ball := ⟨0, 0⟩ +lemma CA1_5_10I2R10Entropy_sound : CA1_5_10I2R10Entropy.Encloses (Foundation.finiteEntropy CA1_5_10I2R10Value) := by + exact contains_sound (entropyPair_enclosed CA1_5_10I2R10Value CA1_5_10I2R10Terms CA1_5_10I2R10Terms_sound) (by decide +kernel) +def CA1_5_10I2R10Mass : Ball := ⟨0, 0⟩ +lemma CA1_5_10I2R10Mass_sound : CA1_5_10I2R10Mass.Encloses (∑ a, CA1_5_10I2R10Value a) := by + exact contains_sound (pairSumBall_sound CA1_5_10I2R10P CA1_5_10I2R10Value CA1_5_10I2R10P_sound) (by decide +kernel) +def CA1_5_10I2R10MassTerm : Ball := .exact 0 +lemma CA1_5_10I2R10MassTerm_sound : CA1_5_10I2R10MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_5_10I2R10Value a))) := + entropyTerm_zero_ball (CA1_5_10I2R10Mass_sound) +def CA1_5_10I2R10H : Ball := ⟨0, 0⟩ +lemma CA1_5_10I2R10H_sound : CA1_5_10I2R10H.Encloses (homogeneousEntropy CA1_5_10I2R10Value) := by + exact contains_sound (homogeneous_enclosed CA1_5_10I2R10Value CA1_5_10I2R10MassTerm_sound CA1_5_10I2R10Entropy_sound) (by decide +kernel) +def CA1_5_10I2R11Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 5 10)) (fun u => (stageALaw (shape 1 5 10) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 11 a +def CA1_5_10I2R11Raw (a : PairSlot) : Ball := residualBall (below (shape 1 5 10)) A1_5_10Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 11 a +lemma CA1_5_10I2R11Raw_sound (a : PairSlot) : + (CA1_5_10I2R11Raw a).Encloses (CA1_5_10I2R11Value a) := by + exact residualBall_sound_on (below (shape 1 5 10)) A1_5_10Law (fun u => (stageALaw (shape 1 5 10) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A1_5_10Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 5 10) (show (shape 1 5 10) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 11 a +def CA1_5_10I2R11Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA1_5_10I2R11Certificates_valid : + CA1_5_10I2R11Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_5_10I2R11CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA1_5_10I2R11P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_5_10I2R11Certificates (CA1_5_10I2R11CertificateIndex a)).input +lemma CA1_5_10I2R11P_check : ∀ a : PairSlot, contains (CA1_5_10I2R11Raw a) (CA1_5_10I2R11P a) = true := by + decide +kernel +lemma CA1_5_10I2R11P_sound (a : PairSlot) : + (CA1_5_10I2R11P a).Encloses (CA1_5_10I2R11Value a) := + contains_sound (CA1_5_10I2R11Raw_sound a) (CA1_5_10I2R11P_check a) +def CA1_5_10I2R11Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_5_10I2R11Certificates (CA1_5_10I2R11CertificateIndex a)).output +lemma CA1_5_10I2R11Terms_sound (a : PairSlot) : + (CA1_5_10I2R11Terms a).Encloses (Foundation.entropyTerm (CA1_5_10I2R11Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_5_10I2R11Certificates_valid + (CA1_5_10I2R11CertificateIndex a) (CA1_5_10I2R11P_sound a) +def CA1_5_10I2R11Entropy : Ball := ⟨0, 0⟩ +lemma CA1_5_10I2R11Entropy_sound : CA1_5_10I2R11Entropy.Encloses (Foundation.finiteEntropy CA1_5_10I2R11Value) := by + exact contains_sound (entropyPair_enclosed CA1_5_10I2R11Value CA1_5_10I2R11Terms CA1_5_10I2R11Terms_sound) (by decide +kernel) +def CA1_5_10I2R11Mass : Ball := ⟨0, 0⟩ +lemma CA1_5_10I2R11Mass_sound : CA1_5_10I2R11Mass.Encloses (∑ a, CA1_5_10I2R11Value a) := by + exact contains_sound (pairSumBall_sound CA1_5_10I2R11P CA1_5_10I2R11Value CA1_5_10I2R11P_sound) (by decide +kernel) +def CA1_5_10I2R11MassTerm : Ball := .exact 0 +lemma CA1_5_10I2R11MassTerm_sound : CA1_5_10I2R11MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_5_10I2R11Value a))) := + entropyTerm_zero_ball (CA1_5_10I2R11Mass_sound) +def CA1_5_10I2R11H : Ball := ⟨0, 0⟩ +lemma CA1_5_10I2R11H_sound : CA1_5_10I2R11H.Encloses (homogeneousEntropy CA1_5_10I2R11Value) := by + exact contains_sound (homogeneous_enclosed CA1_5_10I2R11Value CA1_5_10I2R11MassTerm_sound CA1_5_10I2R11Entropy_sound) (by decide +kernel) +def CA1_5_10I2R12Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 5 10)) (fun u => (stageALaw (shape 1 5 10) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 12 a +def CA1_5_10I2R12Raw (a : PairSlot) : Ball := residualBall (below (shape 1 5 10)) A1_5_10Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 12 a +lemma CA1_5_10I2R12Raw_sound (a : PairSlot) : + (CA1_5_10I2R12Raw a).Encloses (CA1_5_10I2R12Value a) := by + exact residualBall_sound_on (below (shape 1 5 10)) A1_5_10Law (fun u => (stageALaw (shape 1 5 10) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A1_5_10Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 5 10) (show (shape 1 5 10) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 12 a +def CA1_5_10I2R12Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA1_5_10I2R12Certificates_valid : + CA1_5_10I2R12Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_5_10I2R12CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA1_5_10I2R12P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_5_10I2R12Certificates (CA1_5_10I2R12CertificateIndex a)).input +lemma CA1_5_10I2R12P_check : ∀ a : PairSlot, contains (CA1_5_10I2R12Raw a) (CA1_5_10I2R12P a) = true := by + decide +kernel +lemma CA1_5_10I2R12P_sound (a : PairSlot) : + (CA1_5_10I2R12P a).Encloses (CA1_5_10I2R12Value a) := + contains_sound (CA1_5_10I2R12Raw_sound a) (CA1_5_10I2R12P_check a) +def CA1_5_10I2R12Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_5_10I2R12Certificates (CA1_5_10I2R12CertificateIndex a)).output +lemma CA1_5_10I2R12Terms_sound (a : PairSlot) : + (CA1_5_10I2R12Terms a).Encloses (Foundation.entropyTerm (CA1_5_10I2R12Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_5_10I2R12Certificates_valid + (CA1_5_10I2R12CertificateIndex a) (CA1_5_10I2R12P_sound a) +def CA1_5_10I2R12Entropy : Ball := ⟨0, 0⟩ +lemma CA1_5_10I2R12Entropy_sound : CA1_5_10I2R12Entropy.Encloses (Foundation.finiteEntropy CA1_5_10I2R12Value) := by + exact contains_sound (entropyPair_enclosed CA1_5_10I2R12Value CA1_5_10I2R12Terms CA1_5_10I2R12Terms_sound) (by decide +kernel) +def CA1_5_10I2R12Mass : Ball := ⟨0, 0⟩ +lemma CA1_5_10I2R12Mass_sound : CA1_5_10I2R12Mass.Encloses (∑ a, CA1_5_10I2R12Value a) := by + exact contains_sound (pairSumBall_sound CA1_5_10I2R12P CA1_5_10I2R12Value CA1_5_10I2R12P_sound) (by decide +kernel) +def CA1_5_10I2R12MassTerm : Ball := .exact 0 +lemma CA1_5_10I2R12MassTerm_sound : CA1_5_10I2R12MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_5_10I2R12Value a))) := + entropyTerm_zero_ball (CA1_5_10I2R12Mass_sound) +def CA1_5_10I2R12H : Ball := ⟨0, 0⟩ +lemma CA1_5_10I2R12H_sound : CA1_5_10I2R12H.Encloses (homogeneousEntropy CA1_5_10I2R12Value) := by + exact contains_sound (homogeneous_enclosed CA1_5_10I2R12Value CA1_5_10I2R12MassTerm_sound CA1_5_10I2R12Entropy_sound) (by decide +kernel) +def CA1_5_10I2R13Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 5 10)) (fun u => (stageALaw (shape 1 5 10) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 13 a +def CA1_5_10I2R13Raw (a : PairSlot) : Ball := residualBall (below (shape 1 5 10)) A1_5_10Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 13 a +lemma CA1_5_10I2R13Raw_sound (a : PairSlot) : + (CA1_5_10I2R13Raw a).Encloses (CA1_5_10I2R13Value a) := by + exact residualBall_sound_on (below (shape 1 5 10)) A1_5_10Law (fun u => (stageALaw (shape 1 5 10) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A1_5_10Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 5 10) (show (shape 1 5 10) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 13 a +def CA1_5_10I2R13Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA1_5_10I2R13Certificates_valid : + CA1_5_10I2R13Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_5_10I2R13CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA1_5_10I2R13P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_5_10I2R13Certificates (CA1_5_10I2R13CertificateIndex a)).input +lemma CA1_5_10I2R13P_check : ∀ a : PairSlot, contains (CA1_5_10I2R13Raw a) (CA1_5_10I2R13P a) = true := by + decide +kernel +lemma CA1_5_10I2R13P_sound (a : PairSlot) : + (CA1_5_10I2R13P a).Encloses (CA1_5_10I2R13Value a) := + contains_sound (CA1_5_10I2R13Raw_sound a) (CA1_5_10I2R13P_check a) +def CA1_5_10I2R13Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_5_10I2R13Certificates (CA1_5_10I2R13CertificateIndex a)).output +lemma CA1_5_10I2R13Terms_sound (a : PairSlot) : + (CA1_5_10I2R13Terms a).Encloses (Foundation.entropyTerm (CA1_5_10I2R13Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_5_10I2R13Certificates_valid + (CA1_5_10I2R13CertificateIndex a) (CA1_5_10I2R13P_sound a) +def CA1_5_10I2R13Entropy : Ball := ⟨0, 0⟩ +lemma CA1_5_10I2R13Entropy_sound : CA1_5_10I2R13Entropy.Encloses (Foundation.finiteEntropy CA1_5_10I2R13Value) := by + exact contains_sound (entropyPair_enclosed CA1_5_10I2R13Value CA1_5_10I2R13Terms CA1_5_10I2R13Terms_sound) (by decide +kernel) +def CA1_5_10I2R13Mass : Ball := ⟨0, 0⟩ +lemma CA1_5_10I2R13Mass_sound : CA1_5_10I2R13Mass.Encloses (∑ a, CA1_5_10I2R13Value a) := by + exact contains_sound (pairSumBall_sound CA1_5_10I2R13P CA1_5_10I2R13Value CA1_5_10I2R13P_sound) (by decide +kernel) +def CA1_5_10I2R13MassTerm : Ball := .exact 0 +lemma CA1_5_10I2R13MassTerm_sound : CA1_5_10I2R13MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_5_10I2R13Value a))) := + entropyTerm_zero_ball (CA1_5_10I2R13Mass_sound) +def CA1_5_10I2R13H : Ball := ⟨0, 0⟩ +lemma CA1_5_10I2R13H_sound : CA1_5_10I2R13H.Encloses (homogeneousEntropy CA1_5_10I2R13Value) := by + exact contains_sound (homogeneous_enclosed CA1_5_10I2R13Value CA1_5_10I2R13MassTerm_sound CA1_5_10I2R13Entropy_sound) (by decide +kernel) +def CA1_5_10I2R14Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 5 10)) (fun u => (stageALaw (shape 1 5 10) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 14 a +def CA1_5_10I2R14Raw (a : PairSlot) : Ball := residualBall (below (shape 1 5 10)) A1_5_10Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 14 a +lemma CA1_5_10I2R14Raw_sound (a : PairSlot) : + (CA1_5_10I2R14Raw a).Encloses (CA1_5_10I2R14Value a) := by + exact residualBall_sound_on (below (shape 1 5 10)) A1_5_10Law (fun u => (stageALaw (shape 1 5 10) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A1_5_10Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 5 10) (show (shape 1 5 10) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 14 a +def CA1_5_10I2R14Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA1_5_10I2R14Certificates_valid : + CA1_5_10I2R14Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_5_10I2R14CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA1_5_10I2R14P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_5_10I2R14Certificates (CA1_5_10I2R14CertificateIndex a)).input +lemma CA1_5_10I2R14P_check : ∀ a : PairSlot, contains (CA1_5_10I2R14Raw a) (CA1_5_10I2R14P a) = true := by + decide +kernel +lemma CA1_5_10I2R14P_sound (a : PairSlot) : + (CA1_5_10I2R14P a).Encloses (CA1_5_10I2R14Value a) := + contains_sound (CA1_5_10I2R14Raw_sound a) (CA1_5_10I2R14P_check a) +def CA1_5_10I2R14Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_5_10I2R14Certificates (CA1_5_10I2R14CertificateIndex a)).output +lemma CA1_5_10I2R14Terms_sound (a : PairSlot) : + (CA1_5_10I2R14Terms a).Encloses (Foundation.entropyTerm (CA1_5_10I2R14Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_5_10I2R14Certificates_valid + (CA1_5_10I2R14CertificateIndex a) (CA1_5_10I2R14P_sound a) +def CA1_5_10I2R14Entropy : Ball := ⟨0, 0⟩ +lemma CA1_5_10I2R14Entropy_sound : CA1_5_10I2R14Entropy.Encloses (Foundation.finiteEntropy CA1_5_10I2R14Value) := by + exact contains_sound (entropyPair_enclosed CA1_5_10I2R14Value CA1_5_10I2R14Terms CA1_5_10I2R14Terms_sound) (by decide +kernel) +def CA1_5_10I2R14Mass : Ball := ⟨0, 0⟩ +lemma CA1_5_10I2R14Mass_sound : CA1_5_10I2R14Mass.Encloses (∑ a, CA1_5_10I2R14Value a) := by + exact contains_sound (pairSumBall_sound CA1_5_10I2R14P CA1_5_10I2R14Value CA1_5_10I2R14P_sound) (by decide +kernel) +def CA1_5_10I2R14MassTerm : Ball := .exact 0 +lemma CA1_5_10I2R14MassTerm_sound : CA1_5_10I2R14MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_5_10I2R14Value a))) := + entropyTerm_zero_ball (CA1_5_10I2R14Mass_sound) +def CA1_5_10I2R14H : Ball := ⟨0, 0⟩ +lemma CA1_5_10I2R14H_sound : CA1_5_10I2R14H.Encloses (homogeneousEntropy CA1_5_10I2R14Value) := by + exact contains_sound (homogeneous_enclosed CA1_5_10I2R14Value CA1_5_10I2R14MassTerm_sound CA1_5_10I2R14Entropy_sound) (by decide +kernel) +def CA1_5_10I2R15Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 5 10)) (fun u => (stageALaw (shape 1 5 10) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 15 a +def CA1_5_10I2R15Raw (a : PairSlot) : Ball := residualBall (below (shape 1 5 10)) A1_5_10Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 15 a +lemma CA1_5_10I2R15Raw_sound (a : PairSlot) : + (CA1_5_10I2R15Raw a).Encloses (CA1_5_10I2R15Value a) := by + exact residualBall_sound_on (below (shape 1 5 10)) A1_5_10Law (fun u => (stageALaw (shape 1 5 10) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A1_5_10Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 5 10) (show (shape 1 5 10) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 15 a +def CA1_5_10I2R15Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA1_5_10I2R15Certificates_valid : + CA1_5_10I2R15Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_5_10I2R15CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA1_5_10I2R15P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_5_10I2R15Certificates (CA1_5_10I2R15CertificateIndex a)).input +lemma CA1_5_10I2R15P_check : ∀ a : PairSlot, contains (CA1_5_10I2R15Raw a) (CA1_5_10I2R15P a) = true := by + decide +kernel +lemma CA1_5_10I2R15P_sound (a : PairSlot) : + (CA1_5_10I2R15P a).Encloses (CA1_5_10I2R15Value a) := + contains_sound (CA1_5_10I2R15Raw_sound a) (CA1_5_10I2R15P_check a) +def CA1_5_10I2R15Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_5_10I2R15Certificates (CA1_5_10I2R15CertificateIndex a)).output +lemma CA1_5_10I2R15Terms_sound (a : PairSlot) : + (CA1_5_10I2R15Terms a).Encloses (Foundation.entropyTerm (CA1_5_10I2R15Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_5_10I2R15Certificates_valid + (CA1_5_10I2R15CertificateIndex a) (CA1_5_10I2R15P_sound a) +def CA1_5_10I2R15Entropy : Ball := ⟨0, 0⟩ +lemma CA1_5_10I2R15Entropy_sound : CA1_5_10I2R15Entropy.Encloses (Foundation.finiteEntropy CA1_5_10I2R15Value) := by + exact contains_sound (entropyPair_enclosed CA1_5_10I2R15Value CA1_5_10I2R15Terms CA1_5_10I2R15Terms_sound) (by decide +kernel) +def CA1_5_10I2R15Mass : Ball := ⟨0, 0⟩ +lemma CA1_5_10I2R15Mass_sound : CA1_5_10I2R15Mass.Encloses (∑ a, CA1_5_10I2R15Value a) := by + exact contains_sound (pairSumBall_sound CA1_5_10I2R15P CA1_5_10I2R15Value CA1_5_10I2R15P_sound) (by decide +kernel) +def CA1_5_10I2R15MassTerm : Ball := .exact 0 +lemma CA1_5_10I2R15MassTerm_sound : CA1_5_10I2R15MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_5_10I2R15Value a))) := + entropyTerm_zero_ball (CA1_5_10I2R15Mass_sound) +def CA1_5_10I2R15H : Ball := ⟨0, 0⟩ +lemma CA1_5_10I2R15H_sound : CA1_5_10I2R15H.Encloses (homogeneousEntropy CA1_5_10I2R15Value) := by + exact contains_sound (homogeneous_enclosed CA1_5_10I2R15Value CA1_5_10I2R15MassTerm_sound CA1_5_10I2R15Entropy_sound) (by decide +kernel) +def CA1_5_10I2R16Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 5 10)) (fun u => (stageALaw (shape 1 5 10) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 16 a +def CA1_5_10I2R16Raw (a : PairSlot) : Ball := residualBall (below (shape 1 5 10)) A1_5_10Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 16 a +lemma CA1_5_10I2R16Raw_sound (a : PairSlot) : + (CA1_5_10I2R16Raw a).Encloses (CA1_5_10I2R16Value a) := by + exact residualBall_sound_on (below (shape 1 5 10)) A1_5_10Law (fun u => (stageALaw (shape 1 5 10) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A1_5_10Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 5 10) (show (shape 1 5 10) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 16 a +def CA1_5_10I2R16Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA1_5_10I2R16Certificates_valid : + CA1_5_10I2R16Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_5_10I2R16CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA1_5_10I2R16P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_5_10I2R16Certificates (CA1_5_10I2R16CertificateIndex a)).input +lemma CA1_5_10I2R16P_check : ∀ a : PairSlot, contains (CA1_5_10I2R16Raw a) (CA1_5_10I2R16P a) = true := by + decide +kernel +lemma CA1_5_10I2R16P_sound (a : PairSlot) : + (CA1_5_10I2R16P a).Encloses (CA1_5_10I2R16Value a) := + contains_sound (CA1_5_10I2R16Raw_sound a) (CA1_5_10I2R16P_check a) +def CA1_5_10I2R16Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_5_10I2R16Certificates (CA1_5_10I2R16CertificateIndex a)).output +lemma CA1_5_10I2R16Terms_sound (a : PairSlot) : + (CA1_5_10I2R16Terms a).Encloses (Foundation.entropyTerm (CA1_5_10I2R16Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_5_10I2R16Certificates_valid + (CA1_5_10I2R16CertificateIndex a) (CA1_5_10I2R16P_sound a) +def CA1_5_10I2R16Entropy : Ball := ⟨0, 0⟩ +lemma CA1_5_10I2R16Entropy_sound : CA1_5_10I2R16Entropy.Encloses (Foundation.finiteEntropy CA1_5_10I2R16Value) := by + exact contains_sound (entropyPair_enclosed CA1_5_10I2R16Value CA1_5_10I2R16Terms CA1_5_10I2R16Terms_sound) (by decide +kernel) +def CA1_5_10I2R16Mass : Ball := ⟨0, 0⟩ +lemma CA1_5_10I2R16Mass_sound : CA1_5_10I2R16Mass.Encloses (∑ a, CA1_5_10I2R16Value a) := by + exact contains_sound (pairSumBall_sound CA1_5_10I2R16P CA1_5_10I2R16Value CA1_5_10I2R16P_sound) (by decide +kernel) +def CA1_5_10I2R16MassTerm : Ball := .exact 0 +lemma CA1_5_10I2R16MassTerm_sound : CA1_5_10I2R16MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_5_10I2R16Value a))) := + entropyTerm_zero_ball (CA1_5_10I2R16Mass_sound) +def CA1_5_10I2R16H : Ball := ⟨0, 0⟩ +lemma CA1_5_10I2R16H_sound : CA1_5_10I2R16H.Encloses (homogeneousEntropy CA1_5_10I2R16Value) := by + exact contains_sound (homogeneous_enclosed CA1_5_10I2R16Value CA1_5_10I2R16MassTerm_sound CA1_5_10I2R16Entropy_sound) (by decide +kernel) +def CA1_5_10I2ResidualEntropies (a : Fin 17) : Ball := + match a.val with + | 0 => CA1_5_10I2R0H + | 1 => CA1_5_10I2R1H + | 2 => CA1_5_10I2R2H + | 3 => CA1_5_10I2R3H + | 4 => CA1_5_10I2R4H + | 5 => CA1_5_10I2R5H + | 6 => CA1_5_10I2R6H + | 7 => CA1_5_10I2R7H + | 8 => CA1_5_10I2R8H + | 9 => CA1_5_10I2R9H + | 10 => CA1_5_10I2R10H + | 11 => CA1_5_10I2R11H + | 12 => CA1_5_10I2R12H + | 13 => CA1_5_10I2R13H + | 14 => CA1_5_10I2R14H + | 15 => CA1_5_10I2R15H + | 16 => CA1_5_10I2R16H + | _ => (.exact 0) +lemma CA1_5_10I2ResidualEntropies_sound (k : Fin 17) : + (CA1_5_10I2ResidualEntropies k).Encloses (homogeneousEntropy + (residualLaw (below (shape 1 5 10)) (fun u => (stageALaw (shape 1 5 10) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) k)) := by + fin_cases k + · exact CA1_5_10I2R0H_sound + · exact CA1_5_10I2R1H_sound + · exact CA1_5_10I2R2H_sound + · exact CA1_5_10I2R3H_sound + · exact CA1_5_10I2R4H_sound + · exact CA1_5_10I2R5H_sound + · exact CA1_5_10I2R6H_sound + · exact CA1_5_10I2R7H_sound + · exact CA1_5_10I2R8H_sound + · exact CA1_5_10I2R9H_sound + · exact CA1_5_10I2R10H_sound + · exact CA1_5_10I2R11H_sound + · exact CA1_5_10I2R12H_sound + · exact CA1_5_10I2R13H_sound + · exact CA1_5_10I2R14H_sound + · exact CA1_5_10I2R15H_sound + · exact CA1_5_10I2R16H_sound +def CA1_5_10I2Singles (s : Shape) : Ball := + match s 0, s 1, s 2 with + | 0, 0, 8 => Z0_0_8H2H + | 0, 1, 7 => Z0_1_7H2H + | 0, 2, 6 => Z0_2_6H2H + | 0, 3, 5 => Z0_3_5H2H + | 0, 4, 4 => Z0_4_4H2H + | 0, 5, 3 => Z0_5_3H2H + | 1, 0, 7 => Z1_0_7H2H + | _, _, _ => (.exact 0) +lemma CA1_5_10I2Singles_sound (u : Shape) (hu : u ∈ below (shape 1 5 10)) + (hd : designated (Equiv.refl (Fin 3)) 2 u) : + (CA1_5_10I2Singles u).Encloses (homogeneousEntropy ((fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) u)) := by + rw [A1_5_10_below] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl + · exact Z0_0_8H2H_sound + · exact Z0_1_7H2H_sound + · exact Z0_2_6H2H_sound + · exact Z0_3_5H2H_sound + · exact Z0_4_4H2H_sound + · exact Z0_5_3H2H_sound + · exact Z1_0_7H2H_sound + · exact (show ¬ designated (Equiv.refl (Fin 3)) 2 (shape 1 1 6) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 2 (shape 1 2 5) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 2 (shape 1 3 4) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 2 (shape 1 4 3) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 2 (shape 1 5 2) by decide +kernel) hd |>.elim +def CA1_5_10I2Singleton : Ball := ⟨(58076349994733647690213708595139 / 100000000000000000000000000000000), (4925097331 / 10000000000000000000000000000000)⟩ +lemma CA1_5_10I2Singleton_sound : CA1_5_10I2Singleton.Encloses + (singletonEntropy (below (shape 1 5 10)) (fun u => (stageALaw (shape 1 5 10) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ))) := by + exact contains_sound (singletonBall_sound (below (shape 1 5 10)) A1_5_10Law (fun u => (stageALaw (shape 1 5 10) u : ℝ)) (Equiv.refl (Fin 3)) 2 + CA1_5_10I2Singles (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A1_5_10Law_sound u) CA1_5_10I2Singles_sound) (by decide +kernel) +def CA1_5_10I2Group : Ball := ⟨(9493581015904919494732526364841 / 10000000000000000000000000000000), (69387122503 / 50000000000000000000000000000000)⟩ +lemma CA1_5_10I2Group_sound : CA1_5_10I2Group.Encloses + (groupedEntropy (below (shape 1 5 10)) (fun u => (stageALaw (shape 1 5 10) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ))) := by + exact contains_sound (Ball.add_sound CA1_5_10I2Singleton_sound + (finSumBall_sound 17 CA1_5_10I2ResidualEntropies _ CA1_5_10I2ResidualEntropies_sound)) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CA1_5_10I2H : Ball := ⟨(22944437233655845349730535613301 / 20000000000000000000000000000000), (449433388731 / 100000000000000000000000000000000)⟩ +lemma CA1_5_10I2_sound : CA1_5_10I2H.Encloses (stageACapacity (shape 1 5 10) 2) := by + have hb := contains_sound (Ball.add_sound CA1_5_10I2PairH_sound + (Ball.neg_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) CA1_5_10I2Group_sound))) + (show contains (.add CA1_5_10I2PairH (.neg (.mul (.exact 2) CA1_5_10I2Group))) CA1_5_10I2H = true by decide +kernel) + unfold CA1_5_10I2PairValue at hb + simpa only [stageACapacity, nativeCapacity, + show (2 : Fin 3) ≠ 0 by decide, ite_false, sub_eq_add_neg] using hb + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA1_5_10I2Pair.lean b/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA1_5_10I2Pair.lean new file mode 100644 index 0000000000000000000000000000000000000000..664f0f15cd5ec5d87324112a78a13a42cb3a035c --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA1_5_10I2Pair.lean @@ -0,0 +1,324 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Certificates.SupportedContraction + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CA1_5_10I2PairValue (a : PairSlot × PairSlot) : ℝ := pairLaw (below (shape 1 5 10)) (shape 1 5 10) (fun u => (stageALaw (shape 1 5 10) u : ℝ)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) a +def CA1_5_10I2PairRaw (a : PairSlot × PairSlot) : Ball := stageAPairBall (shape 1 5 10) A1_5_10Law 2 a +lemma CA1_5_10I2PairRaw_sound (a : PairSlot × PairSlot) : + (CA1_5_10I2PairRaw a).Encloses (CA1_5_10I2PairValue a) := by + exact stageAPairBall_sound (shape 1 5 10) (by decide +kernel) A1_5_10Law (fun u => (stageALaw (shape 1 5 10) u : ℝ)) (fun u _ => A1_5_10Law_sound u) 2 a +def CA1_5_10I2PairCertificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(447236789237316840707946291 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(688610068444994029318992737 / 12500000000000000000000000000000), (179943 / 10000000000000000000000000000000)⟩ ⟨(-615879627987935948080324132652163 / 50000000000000000000000000000000), (402340873571 / 100000000000000000000000000000000)⟩ ⟨-18, 447236789237316840707946291, 381469726562500000000000000⟩, + .log ⟨(53769237716673631681010297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(194052899722326233188264489 / 25000000000000000000000000000000), (25051 / 10000000000000000000000000000000)⟩ ⟨(-180449740374644722766312628984091 / 12500000000000000000000000000000), (18634799233 / 4000000000000000000000000000000)⟩ ⟨-21, 53769237716673631681010297, 47683715820312500000000000⟩, + .log ⟨(1706374619138283140882338411 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(18733526669721479089924408983 / 100000000000000000000000000000000), (3071387 / 50000000000000000000000000000000)⟩ ⟨(-137231930635356939885690339142263 / 12500000000000000000000000000000), (179994530607 / 50000000000000000000000000000000)⟩ ⟨-16, 1706374619138283140882338411, 1525878906250000000000000000⟩, + .log ⟨(3241139016201081741900431197 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(62514139484452513978237592137 / 100000000000000000000000000000000), (5147537 / 25000000000000000000000000000000)⟩ ⟨(-9643853468174428385920786865427 / 1000000000000000000000000000000), (317637370671 / 100000000000000000000000000000000)⟩ ⟨-14, 3241139016201081741900431197, 3051757812500000000000000000⟩, + .log ⟨(183316638080722186838854373789 / 100000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ ⟨(1155208391188910650998770499159 / 100000000000000000000000000000000), (53375863 / 12500000000000000000000000000000)⟩ ⟨(-315085527228636714092310458820519 / 50000000000000000000000000000000), (58233515401 / 25000000000000000000000000000000)⟩ ⟨-10, 183316638080722186838854373789, 97656250000000000000000000000⟩, + .log ⟨(17471312315954566585414775389 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(377920437811155753835039869 / 250000000000000000000000000000), (51795731 / 100000000000000000000000000000000)⟩ ⟨(-86523652253882248114946805809359 / 10000000000000000000000000000000), (59292307457 / 20000000000000000000000000000000)⟩ ⟨-13, 17471312315954566585414775389, 12207031250000000000000000000⟩, + .log ⟨(622687359809091706509760327 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(3731963418358488179025749239 / 50000000000000000000000000000000), (1252669 / 50000000000000000000000000000000)⟩ ⟨(-1198663618128578138491381959184577 / 100000000000000000000000000000000), (402340810571 / 100000000000000000000000000000000)⟩ ⟨-18, 622687359809091706509760327, 381469726562500000000000000⟩, + .log ⟨(20272164809224285723253563167 / 10000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ ⟨(314273878220142774199993200043 / 25000000000000000000000000000000), (429279803 / 100000000000000000000000000000000)⟩ ⟨(-31005458092678999135442646726649 / 5000000000000000000000000000000), (26469779727 / 12500000000000000000000000000000)⟩ ⟨-9, 20272164809224285723253563167, 19531250000000000000000000000⟩, + .log ⟨(2102272074250790204621278602629 / 100000000000000000000000000000000), (1 / 10000000000000000000000000000000)⟩ ⟨(507455825973427320434676662231 / 6250000000000000000000000000000), (779053511 / 25000000000000000000000000000000)⟩ ⟨(-96553787150366810293970918202207 / 25000000000000000000000000000000), (9264422891 / 6250000000000000000000000000000)⟩ ⟨-6, 2102272074250790204621278602629, 1562500000000000000000000000000⟩, + .log ⟨(111221115180691714779777314009 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(756459872970579363643185617631 / 100000000000000000000000000000000), (64767967 / 25000000000000000000000000000000)⟩ ⟨(-170035130411527926187555275089797 / 25000000000000000000000000000000), (58233515353 / 25000000000000000000000000000000)⟩ ⟨-10, 111221115180691714779777314009, 97656250000000000000000000000⟩, + .log ⟨(92101918036391963270099979 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(4353968393005264559923740189 / 50000000000000000000000000000000), (2964521 / 100000000000000000000000000000000)⟩ ⟨(-295458585841074292239596126826253 / 25000000000000000000000000000000), (12573149553 / 3125000000000000000000000000000)⟩ ⟨-18, 92101918036391963270099979, 47683715820312500000000000⟩, + .log ⟨(1980714011568923376047003 / 5000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(11679471172473652795728637 / 2000000000000000000000000000000), (38591 / 20000000000000000000000000000000)⟩ ⟨(-1474149107879327921652579442921641 / 100000000000000000000000000000000), (487046469051 / 100000000000000000000000000000000)⟩ ⟨-22, 1980714011568923376047003, 1192092895507812500000000⟩, + .log ⟨(3922986013242751549869149831 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(27491589264612354155404833677 / 20000000000000000000000000000000), (11630147 / 25000000000000000000000000000000)⟩ ⟨(-175195560039020679566071876309813 / 20000000000000000000000000000000), (148230768967 / 50000000000000000000000000000000)⟩ ⟨-13, 3922986013242751549869149831, 3051757812500000000000000000⟩, + .log ⟨(83375800235145745215086008987 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(1066613302661959727727064752781 / 100000000000000000000000000000000), (194210641 / 50000000000000000000000000000000)⟩ ⟨(-127928403643956369452961201085279 / 20000000000000000000000000000000), (29116757639 / 12500000000000000000000000000000)⟩ ⟨-10, 83375800235145745215086008987, 48828125000000000000000000000⟩, + .log ⟨(8646206533355745804790161179 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(5055763781945299190277427299 / 6250000000000000000000000000000), (27463593 / 100000000000000000000000000000000)⟩ ⟨(-29236889972735058948765842287483 / 3125000000000000000000000000000), (31763736681 / 10000000000000000000000000000000)⟩ ⟨-14, 8646206533355745804790161179, 6103515625000000000000000000⟩, + .log ⟨(2063257465845684282331253 / 10000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(31761392632433117809477861 / 10000000000000000000000000000000), (26219 / 25000000000000000000000000000000)⟩ ⟨(-384845240574651391920675325717799 / 25000000000000000000000000000000), (63528076887 / 12500000000000000000000000000000)⟩ ⟨-23, 2063257465845684282331253, 1192092895507812500000000⟩, + .log ⟨(3874243817958301501429918271 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(135943815595302065538285069041 / 100000000000000000000000000000000), (45942581 / 100000000000000000000000000000000)⟩ ⟨(-877228060384074343634582168844643 / 100000000000000000000000000000000), (148230769007 / 50000000000000000000000000000000)⟩ ⟨-13, 3874243817958301501429918271, 3051757812500000000000000000⟩, + .log ⟨(191008923016041377412620830947 / 12500000000000000000000000000000), (9 / 100000000000000000000000000000000)⟩ ⟨(1597279180750824162549435636669 / 25000000000000000000000000000000), (80895427 / 3125000000000000000000000000000)⟩ ⟨(-418116377897351138445099644060711 / 100000000000000000000000000000000), (169406590053 / 100000000000000000000000000000000)⟩ ⟨-7, 191008923016041377412620830947, 97656250000000000000000000000⟩, + .log ⟨(10785136579497245115988190180163 / 100000000000000000000000000000000), (11 / 25000000000000000000000000000000)⟩ ⟨(6004628140468174260369868483247 / 25000000000000000000000000000000), (11419207673 / 100000000000000000000000000000000)⟩ ⟨(-222700124238874801461167822386801 / 100000000000000000000000000000000), (105879118823 / 100000000000000000000000000000000)⟩ ⟨-4, 10785136579497245115988190180163, 6250000000000000000000000000000⟩, + .log ⟨(791822085718177342495688877343 / 100000000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ ⟨(957825356541796192309550353611 / 25000000000000000000000000000000), (670699407 / 50000000000000000000000000000000)⟩ ⟨(-30241179610223140974066025271459 / 6250000000000000000000000000000), (10587911873 / 6250000000000000000000000000000)⟩ ⟨-7, 791822085718177342495688877343, 781250000000000000000000000000⟩, + .log ⟨(51357827334459029339937650851 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(97247434120707804012571941123 / 25000000000000000000000000000000), (5220213 / 4000000000000000000000000000000)⟩ ⟨(-189352702729032115077831268942829 / 25000000000000000000000000000000), (127054943071 / 50000000000000000000000000000000)⟩ ⟨-11, 51357827334459029339937650851, 48828125000000000000000000000⟩, + .log ⟨(266674382470302839354079003 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(6105967605224781648922340161 / 50000000000000000000000000000000), (4065889 / 100000000000000000000000000000000)⟩ ⟨(-1144835800998760933257542476011351 / 100000000000000000000000000000000), (381164920041 / 100000000000000000000000000000000)⟩ ⟨-17, 266674382470302839354079003, 190734863281250000000000000⟩, + .log ⟨(181450604106123642236082066657 / 50000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ ⟨(2039067429394094057333460199957 / 100000000000000000000000000000000), (384236607 / 50000000000000000000000000000000)⟩ ⟨(-561879482143118166329838591190561 / 100000000000000000000000000000000), (211758237381 / 100000000000000000000000000000000)⟩ ⟨-9, 181450604106123642236082066657, 97656250000000000000000000000⟩, + .log ⟨(13932558651992671363474219161 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(123702966911870126753310137091 / 100000000000000000000000000000000), (41304687 / 100000000000000000000000000000000)⟩ ⟨(-22196742536981497197388235948923 / 2500000000000000000000000000000), (296461538739 / 100000000000000000000000000000000)⟩ ⟨-13, 13932558651992671363474219161, 12207031250000000000000000000⟩, + .log ⟨(11518310933089731091894286224663 / 100000000000000000000000000000000), (9 / 20000000000000000000000000000000)⟩ ⟨(12446872019458289123324161673441 / 50000000000000000000000000000000), (2439097243 / 20000000000000000000000000000000)⟩ ⟨(-216123216186168296459960009943243 / 100000000000000000000000000000000), (21175823761 / 20000000000000000000000000000000)⟩ ⟨-4, 11518310933089731091894286224663, 6250000000000000000000000000000⟩, + .log ⟨(783795781330155054539950519379 / 100000000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ ⟨(380045092707268734121915779943 / 10000000000000000000000000000000), (663900863 / 50000000000000000000000000000000)⟩ ⟨(-19395107846194640943222960864133 / 4000000000000000000000000000000), (169406589973 / 100000000000000000000000000000000)⟩ ⟨-7, 783795781330155054539950519379, 781250000000000000000000000000⟩, + .log ⟨(21081710312044096845027453533 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(32766764457907768728959956557 / 10000000000000000000000000000000), (116069881 / 100000000000000000000000000000000)⟩ ⟨(-777137242968089175776914164213739 / 100000000000000000000000000000000), (1101142841 / 400000000000000000000000000000)⟩ ⟨-12, 21081710312044096845027453533, 12207031250000000000000000000⟩] +lemma CA1_5_10I2PairCertificates_valid : + CA1_5_10I2PairCertificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_5_10I2PairCertificateIndex (a : PairSlot × PairSlot) : ℕ := + match a.1.1.val, a.1.2.val, a.2.1.val, a.2.2.val with + | 5, 5, 2, 0 => 1 + | 5, 5, 3, 0 => 2 + | 5, 5, 1, 1 => 3 + | 5, 5, 0, 2 => 1 + | 5, 5, 0, 3 => 2 + | 4, 5, 4, 0 => 4 + | 4, 5, 2, 1 => 5 + | 4, 5, 3, 1 => 6 + | 4, 5, 1, 2 => 5 + | 4, 5, 1, 3 => 6 + | 4, 5, 0, 4 => 4 + | 5, 4, 4, 0 => 4 + | 5, 4, 2, 1 => 5 + | 5, 4, 3, 1 => 6 + | 5, 4, 1, 2 => 5 + | 5, 4, 1, 3 => 6 + | 5, 4, 0, 4 => 4 + | 2, 5, 5, 0 => 7 + | 2, 5, 4, 1 => 8 + | 2, 5, 2, 2 => 9 + | 2, 5, 2, 3 => 10 + | 2, 5, 3, 2 => 10 + | 2, 5, 3, 3 => 11 + | 2, 5, 1, 4 => 8 + | 2, 5, 0, 5 => 7 + | 3, 5, 5, 0 => 12 + | 3, 5, 4, 1 => 13 + | 3, 5, 2, 2 => 14 + | 3, 5, 2, 3 => 15 + | 3, 5, 3, 2 => 15 + | 3, 5, 3, 3 => 16 + | 3, 5, 1, 4 => 13 + | 3, 5, 0, 5 => 12 + | 4, 4, 5, 0 => 17 + | 4, 4, 4, 1 => 18 + | 4, 4, 2, 2 => 19 + | 4, 4, 2, 3 => 20 + | 4, 4, 3, 2 => 20 + | 4, 4, 3, 3 => 21 + | 4, 4, 1, 4 => 18 + | 4, 4, 0, 5 => 17 + | 5, 2, 5, 0 => 7 + | 5, 2, 4, 1 => 8 + | 5, 2, 2, 2 => 9 + | 5, 2, 2, 3 => 10 + | 5, 2, 3, 2 => 10 + | 5, 2, 3, 3 => 11 + | 5, 2, 1, 4 => 8 + | 5, 2, 0, 5 => 7 + | 5, 3, 5, 0 => 12 + | 5, 3, 4, 1 => 13 + | 5, 3, 2, 2 => 14 + | 5, 3, 2, 3 => 15 + | 5, 3, 3, 2 => 15 + | 5, 3, 3, 3 => 16 + | 5, 3, 1, 4 => 13 + | 5, 3, 0, 5 => 12 + | 1, 5, 5, 1 => 22 + | 1, 5, 4, 2 => 23 + | 1, 5, 4, 3 => 24 + | 1, 5, 2, 4 => 23 + | 1, 5, 3, 4 => 24 + | 1, 5, 1, 5 => 22 + | 2, 4, 5, 1 => 23 + | 2, 4, 4, 2 => 25 + | 2, 4, 4, 3 => 26 + | 2, 4, 2, 4 => 25 + | 2, 4, 3, 4 => 26 + | 2, 4, 1, 5 => 23 + | 3, 4, 5, 1 => 24 + | 3, 4, 4, 2 => 26 + | 3, 4, 4, 3 => 27 + | 3, 4, 2, 4 => 26 + | 3, 4, 3, 4 => 27 + | 3, 4, 1, 5 => 24 + | 4, 2, 5, 1 => 23 + | 4, 2, 4, 2 => 25 + | 4, 2, 4, 3 => 26 + | 4, 2, 2, 4 => 25 + | 4, 2, 3, 4 => 26 + | 4, 2, 1, 5 => 23 + | 4, 3, 5, 1 => 24 + | 4, 3, 4, 2 => 26 + | 4, 3, 4, 3 => 27 + | 4, 3, 2, 4 => 26 + | 4, 3, 3, 4 => 27 + | 4, 3, 1, 5 => 24 + | 5, 1, 5, 1 => 22 + | 5, 1, 4, 2 => 23 + | 5, 1, 4, 3 => 24 + | 5, 1, 2, 4 => 23 + | 5, 1, 3, 4 => 24 + | 5, 1, 1, 5 => 22 + | 5, 0, 5, 2 => 7 + | 5, 0, 5, 3 => 12 + | 5, 0, 4, 4 => 17 + | 5, 0, 2, 5 => 7 + | 5, 0, 3, 5 => 12 + | 4, 1, 5, 2 => 8 + | 4, 1, 5, 3 => 13 + | 4, 1, 4, 4 => 18 + | 4, 1, 2, 5 => 8 + | 4, 1, 3, 5 => 13 + | 2, 2, 5, 2 => 9 + | 2, 2, 5, 3 => 14 + | 2, 2, 4, 4 => 19 + | 2, 2, 2, 5 => 9 + | 2, 2, 3, 5 => 14 + | 2, 3, 5, 2 => 10 + | 2, 3, 5, 3 => 15 + | 2, 3, 4, 4 => 20 + | 2, 3, 2, 5 => 10 + | 2, 3, 3, 5 => 15 + | 3, 2, 5, 2 => 10 + | 3, 2, 5, 3 => 15 + | 3, 2, 4, 4 => 20 + | 3, 2, 2, 5 => 10 + | 3, 2, 3, 5 => 15 + | 3, 3, 5, 2 => 11 + | 3, 3, 5, 3 => 16 + | 3, 3, 4, 4 => 21 + | 3, 3, 2, 5 => 11 + | 3, 3, 3, 5 => 16 + | 1, 4, 5, 2 => 8 + | 1, 4, 5, 3 => 13 + | 1, 4, 4, 4 => 18 + | 1, 4, 2, 5 => 8 + | 1, 4, 3, 5 => 13 + | 0, 5, 5, 2 => 7 + | 0, 5, 5, 3 => 12 + | 0, 5, 4, 4 => 17 + | 0, 5, 2, 5 => 7 + | 0, 5, 3, 5 => 12 + | 4, 0, 4, 5 => 4 + | 4, 0, 5, 4 => 4 + | 2, 1, 4, 5 => 5 + | 2, 1, 5, 4 => 5 + | 3, 1, 4, 5 => 6 + | 3, 1, 5, 4 => 6 + | 1, 2, 4, 5 => 5 + | 1, 2, 5, 4 => 5 + | 1, 3, 4, 5 => 6 + | 1, 3, 5, 4 => 6 + | 0, 4, 4, 5 => 4 + | 0, 4, 5, 4 => 4 + | 2, 0, 5, 5 => 1 + | 3, 0, 5, 5 => 2 + | 1, 1, 5, 5 => 3 + | 0, 2, 5, 5 => 1 + | 0, 3, 5, 5 => 2 + | _, _, _, _ => 0 +def CA1_5_10I2PairP (a : PairSlot × PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_5_10I2PairCertificates (CA1_5_10I2PairCertificateIndex a)).input +lemma CA1_5_10I2PairP_check_0_0 : ∀ k l : Fin 6, contains (CA1_5_10I2PairRaw ((0,0),(k,l))) (CA1_5_10I2PairP ((0,0),(k,l))) = true := by + decide +kernel +lemma CA1_5_10I2PairP_check_0_1 : ∀ k l : Fin 6, contains (CA1_5_10I2PairRaw ((0,1),(k,l))) (CA1_5_10I2PairP ((0,1),(k,l))) = true := by + decide +kernel +lemma CA1_5_10I2PairP_check_0_2 : ∀ k l : Fin 6, contains (CA1_5_10I2PairRaw ((0,2),(k,l))) (CA1_5_10I2PairP ((0,2),(k,l))) = true := by + decide +kernel +lemma CA1_5_10I2PairP_check_0_3 : ∀ k l : Fin 6, contains (CA1_5_10I2PairRaw ((0,3),(k,l))) (CA1_5_10I2PairP ((0,3),(k,l))) = true := by + decide +kernel +lemma CA1_5_10I2PairP_check_0_4 : ∀ k l : Fin 6, contains (CA1_5_10I2PairRaw ((0,4),(k,l))) (CA1_5_10I2PairP ((0,4),(k,l))) = true := by + decide +kernel +lemma CA1_5_10I2PairP_check_0_5 : ∀ k l : Fin 6, contains (CA1_5_10I2PairRaw ((0,5),(k,l))) (CA1_5_10I2PairP ((0,5),(k,l))) = true := by + decide +kernel +lemma CA1_5_10I2PairP_check_1_0 : ∀ k l : Fin 6, contains (CA1_5_10I2PairRaw ((1,0),(k,l))) (CA1_5_10I2PairP ((1,0),(k,l))) = true := by + decide +kernel +lemma CA1_5_10I2PairP_check_1_1 : ∀ k l : Fin 6, contains (CA1_5_10I2PairRaw ((1,1),(k,l))) (CA1_5_10I2PairP ((1,1),(k,l))) = true := by + decide +kernel +lemma CA1_5_10I2PairP_check_1_2 : ∀ k l : Fin 6, contains (CA1_5_10I2PairRaw ((1,2),(k,l))) (CA1_5_10I2PairP ((1,2),(k,l))) = true := by + decide +kernel +lemma CA1_5_10I2PairP_check_1_3 : ∀ k l : Fin 6, contains (CA1_5_10I2PairRaw ((1,3),(k,l))) (CA1_5_10I2PairP ((1,3),(k,l))) = true := by + decide +kernel +lemma CA1_5_10I2PairP_check_1_4 : ∀ k l : Fin 6, contains (CA1_5_10I2PairRaw ((1,4),(k,l))) (CA1_5_10I2PairP ((1,4),(k,l))) = true := by + decide +kernel +lemma CA1_5_10I2PairP_check_1_5 : ∀ k l : Fin 6, contains (CA1_5_10I2PairRaw ((1,5),(k,l))) (CA1_5_10I2PairP ((1,5),(k,l))) = true := by + decide +kernel +lemma CA1_5_10I2PairP_check_2_0 : ∀ k l : Fin 6, contains (CA1_5_10I2PairRaw ((2,0),(k,l))) (CA1_5_10I2PairP ((2,0),(k,l))) = true := by + decide +kernel +lemma CA1_5_10I2PairP_check_2_1 : ∀ k l : Fin 6, contains (CA1_5_10I2PairRaw ((2,1),(k,l))) (CA1_5_10I2PairP ((2,1),(k,l))) = true := by + decide +kernel +lemma CA1_5_10I2PairP_check_2_2 : ∀ k l : Fin 6, contains (CA1_5_10I2PairRaw ((2,2),(k,l))) (CA1_5_10I2PairP ((2,2),(k,l))) = true := by + decide +kernel +lemma CA1_5_10I2PairP_check_2_3 : ∀ k l : Fin 6, contains (CA1_5_10I2PairRaw ((2,3),(k,l))) (CA1_5_10I2PairP ((2,3),(k,l))) = true := by + decide +kernel +lemma CA1_5_10I2PairP_check_2_4 : ∀ k l : Fin 6, contains (CA1_5_10I2PairRaw ((2,4),(k,l))) (CA1_5_10I2PairP ((2,4),(k,l))) = true := by + decide +kernel +lemma CA1_5_10I2PairP_check_2_5 : ∀ k l : Fin 6, contains (CA1_5_10I2PairRaw ((2,5),(k,l))) (CA1_5_10I2PairP ((2,5),(k,l))) = true := by + decide +kernel +lemma CA1_5_10I2PairP_check_3_0 : ∀ k l : Fin 6, contains (CA1_5_10I2PairRaw ((3,0),(k,l))) (CA1_5_10I2PairP ((3,0),(k,l))) = true := by + decide +kernel +lemma CA1_5_10I2PairP_check_3_1 : ∀ k l : Fin 6, contains (CA1_5_10I2PairRaw ((3,1),(k,l))) (CA1_5_10I2PairP ((3,1),(k,l))) = true := by + decide +kernel +lemma CA1_5_10I2PairP_check_3_2 : ∀ k l : Fin 6, contains (CA1_5_10I2PairRaw ((3,2),(k,l))) (CA1_5_10I2PairP ((3,2),(k,l))) = true := by + decide +kernel +lemma CA1_5_10I2PairP_check_3_3 : ∀ k l : Fin 6, contains (CA1_5_10I2PairRaw ((3,3),(k,l))) (CA1_5_10I2PairP ((3,3),(k,l))) = true := by + decide +kernel +lemma CA1_5_10I2PairP_check_3_4 : ∀ k l : Fin 6, contains (CA1_5_10I2PairRaw ((3,4),(k,l))) (CA1_5_10I2PairP ((3,4),(k,l))) = true := by + decide +kernel +lemma CA1_5_10I2PairP_check_3_5 : ∀ k l : Fin 6, contains (CA1_5_10I2PairRaw ((3,5),(k,l))) (CA1_5_10I2PairP ((3,5),(k,l))) = true := by + decide +kernel +lemma CA1_5_10I2PairP_check_4_0 : ∀ k l : Fin 6, contains (CA1_5_10I2PairRaw ((4,0),(k,l))) (CA1_5_10I2PairP ((4,0),(k,l))) = true := by + decide +kernel +lemma CA1_5_10I2PairP_check_4_1 : ∀ k l : Fin 6, contains (CA1_5_10I2PairRaw ((4,1),(k,l))) (CA1_5_10I2PairP ((4,1),(k,l))) = true := by + decide +kernel +lemma CA1_5_10I2PairP_check_4_2 : ∀ k l : Fin 6, contains (CA1_5_10I2PairRaw ((4,2),(k,l))) (CA1_5_10I2PairP ((4,2),(k,l))) = true := by + decide +kernel +lemma CA1_5_10I2PairP_check_4_3 : ∀ k l : Fin 6, contains (CA1_5_10I2PairRaw ((4,3),(k,l))) (CA1_5_10I2PairP ((4,3),(k,l))) = true := by + decide +kernel +lemma CA1_5_10I2PairP_check_4_4 : ∀ k l : Fin 6, contains (CA1_5_10I2PairRaw ((4,4),(k,l))) (CA1_5_10I2PairP ((4,4),(k,l))) = true := by + decide +kernel +lemma CA1_5_10I2PairP_check_4_5 : ∀ k l : Fin 6, contains (CA1_5_10I2PairRaw ((4,5),(k,l))) (CA1_5_10I2PairP ((4,5),(k,l))) = true := by + decide +kernel +lemma CA1_5_10I2PairP_check_5_0 : ∀ k l : Fin 6, contains (CA1_5_10I2PairRaw ((5,0),(k,l))) (CA1_5_10I2PairP ((5,0),(k,l))) = true := by + decide +kernel +lemma CA1_5_10I2PairP_check_5_1 : ∀ k l : Fin 6, contains (CA1_5_10I2PairRaw ((5,1),(k,l))) (CA1_5_10I2PairP ((5,1),(k,l))) = true := by + decide +kernel +lemma CA1_5_10I2PairP_check_5_2 : ∀ k l : Fin 6, contains (CA1_5_10I2PairRaw ((5,2),(k,l))) (CA1_5_10I2PairP ((5,2),(k,l))) = true := by + decide +kernel +lemma CA1_5_10I2PairP_check_5_3 : ∀ k l : Fin 6, contains (CA1_5_10I2PairRaw ((5,3),(k,l))) (CA1_5_10I2PairP ((5,3),(k,l))) = true := by + decide +kernel +lemma CA1_5_10I2PairP_check_5_4 : ∀ k l : Fin 6, contains (CA1_5_10I2PairRaw ((5,4),(k,l))) (CA1_5_10I2PairP ((5,4),(k,l))) = true := by + decide +kernel +lemma CA1_5_10I2PairP_check_5_5 : ∀ k l : Fin 6, contains (CA1_5_10I2PairRaw ((5,5),(k,l))) (CA1_5_10I2PairP ((5,5),(k,l))) = true := by + decide +kernel +lemma CA1_5_10I2PairP_check (a : PairSlot × PairSlot) : contains (CA1_5_10I2PairRaw a) (CA1_5_10I2PairP a) = true := by + rcases a with ⟨⟨i,j⟩,⟨k,l⟩⟩ + revert j i + apply forall_fin6 + · exact forall_fin6 (CA1_5_10I2PairP_check_0_0 k l) (CA1_5_10I2PairP_check_0_1 k l) (CA1_5_10I2PairP_check_0_2 k l) (CA1_5_10I2PairP_check_0_3 k l) (CA1_5_10I2PairP_check_0_4 k l) (CA1_5_10I2PairP_check_0_5 k l) + · exact forall_fin6 (CA1_5_10I2PairP_check_1_0 k l) (CA1_5_10I2PairP_check_1_1 k l) (CA1_5_10I2PairP_check_1_2 k l) (CA1_5_10I2PairP_check_1_3 k l) (CA1_5_10I2PairP_check_1_4 k l) (CA1_5_10I2PairP_check_1_5 k l) + · exact forall_fin6 (CA1_5_10I2PairP_check_2_0 k l) (CA1_5_10I2PairP_check_2_1 k l) (CA1_5_10I2PairP_check_2_2 k l) (CA1_5_10I2PairP_check_2_3 k l) (CA1_5_10I2PairP_check_2_4 k l) (CA1_5_10I2PairP_check_2_5 k l) + · exact forall_fin6 (CA1_5_10I2PairP_check_3_0 k l) (CA1_5_10I2PairP_check_3_1 k l) (CA1_5_10I2PairP_check_3_2 k l) (CA1_5_10I2PairP_check_3_3 k l) (CA1_5_10I2PairP_check_3_4 k l) (CA1_5_10I2PairP_check_3_5 k l) + · exact forall_fin6 (CA1_5_10I2PairP_check_4_0 k l) (CA1_5_10I2PairP_check_4_1 k l) (CA1_5_10I2PairP_check_4_2 k l) (CA1_5_10I2PairP_check_4_3 k l) (CA1_5_10I2PairP_check_4_4 k l) (CA1_5_10I2PairP_check_4_5 k l) + · exact forall_fin6 (CA1_5_10I2PairP_check_5_0 k l) (CA1_5_10I2PairP_check_5_1 k l) (CA1_5_10I2PairP_check_5_2 k l) (CA1_5_10I2PairP_check_5_3 k l) (CA1_5_10I2PairP_check_5_4 k l) (CA1_5_10I2PairP_check_5_5 k l) +lemma CA1_5_10I2PairP_sound (a : PairSlot × PairSlot) : + (CA1_5_10I2PairP a).Encloses (CA1_5_10I2PairValue a) := + contains_sound (CA1_5_10I2PairRaw_sound a) (CA1_5_10I2PairP_check a) +def CA1_5_10I2PairTerms (a : PairSlot × PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_5_10I2PairCertificates (CA1_5_10I2PairCertificateIndex a)).output +lemma CA1_5_10I2PairTerms_sound (a : PairSlot × PairSlot) : + (CA1_5_10I2PairTerms a).Encloses (Foundation.entropyTerm (CA1_5_10I2PairValue a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_5_10I2PairCertificates_valid + (CA1_5_10I2PairCertificateIndex a) (CA1_5_10I2PairP_sound a) +def CA1_5_10I2PairEntropy : Ball := ⟨(152296903243188808321651602681663 / 50000000000000000000000000000000), (32383312703 / 25000000000000000000000000000000)⟩ +lemma CA1_5_10I2PairEntropy_sound : CA1_5_10I2PairEntropy.Encloses (Foundation.finiteEntropy CA1_5_10I2PairValue) := by + exact contains_sound (entropyDoublePair_enclosed CA1_5_10I2PairValue CA1_5_10I2PairTerms CA1_5_10I2PairTerms_sound) (by decide +kernel) +def CA1_5_10I2PairMass : Ball := ⟨(49999999999999999999999999999999 / 50000000000000000000000000000000), (27 / 5000000000000000000000000000000)⟩ +lemma CA1_5_10I2PairMass_sound : CA1_5_10I2PairMass.Encloses (∑ a, CA1_5_10I2PairValue a) := by + exact contains_sound (doublePairSumBall_sound CA1_5_10I2PairP CA1_5_10I2PairValue CA1_5_10I2PairP_sound) (by decide +kernel) +def CA1_5_10I2PairMassTermLogWitness : LogWitness := ⟨-1, 49999999999999999999999999999999, 25000000000000000000000000000000⟩ +def CA1_5_10I2PairMassTermLog : Ball := ⟨(-1 / 100000000000000000000000000000000), (21175823953 / 50000000000000000000000000000000)⟩ +lemma CA1_5_10I2PairMassTermLog_sound : CA1_5_10I2PairMassTermLog.Encloses (Real.log ((∑ a, CA1_5_10I2PairValue a))) := by + exact checkLog_sound logTwoBall_sound (CA1_5_10I2PairMass_sound) (w := CA1_5_10I2PairMassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA1_5_10I2PairMassTerm : Ball := ⟨(1 / 100000000000000000000000000000000), (42351647907 / 100000000000000000000000000000000)⟩ +lemma CA1_5_10I2PairMassTerm_sound : CA1_5_10I2PairMassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_5_10I2PairValue a))) := by + exact contains_sound (entropyTerm_ball (CA1_5_10I2PairMass_sound) CA1_5_10I2PairMassTermLog_sound) (by decide +kernel) +def CA1_5_10I2PairH : Ball := ⟨(12183752259455104665732128214533 / 4000000000000000000000000000000), (171884898719 / 100000000000000000000000000000000)⟩ +lemma CA1_5_10I2PairH_sound : CA1_5_10I2PairH.Encloses (homogeneousEntropy CA1_5_10I2PairValue) := by + exact contains_sound (homogeneous_enclosed CA1_5_10I2PairValue CA1_5_10I2PairMassTerm_sound CA1_5_10I2PairEntropy_sound) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA1_6_9I0.lean b/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA1_6_9I0.lean new file mode 100644 index 0000000000000000000000000000000000000000..ada7fd878cd650f5827055fca974fe479ce59435 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA1_6_9I0.lean @@ -0,0 +1,72 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Certificates.SplitB1_3_4 + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CA1_6_9I0Value (a : Fin 17) : ℝ := marginal (below (shape 1 6 9)) (fun u => (stageALaw (shape 1 6 9) u : ℝ)) ((Equiv.refl (Fin 3)) 0) a +def CA1_6_9I0Raw (a : Fin 17) : Ball := marginalBall (below (shape 1 6 9)) A1_6_9Law ((Equiv.refl (Fin 3)) 0) a +lemma CA1_6_9I0Raw_sound (a : Fin 17) : + (CA1_6_9I0Raw a).Encloses (CA1_6_9I0Value a) := by + exact marginalBall_sound (below (shape 1 6 9)) A1_6_9Law (fun u => (stageALaw (shape 1 6 9) u : ℝ)) (fun u _ => A1_6_9Law_sound u) ((Equiv.refl (Fin 3)) 0) a +def CA1_6_9I0Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(1 / 2), (37 / 50000000000000000000000000000000)⟩ ⟨(6931471805599453094172319305033 / 20000000000000000000000000000000), (330872247 / 1562500000000000000000000000000)⟩ ⟨(-6931471805599453094172319305033 / 10000000000000000000000000000000), (42351647513 / 100000000000000000000000000000000)⟩ ⟨-1, 1, 1⟩] +lemma CA1_6_9I0Certificates_valid : + CA1_6_9I0Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_6_9I0CertificateIndex (a : Fin 17) : ℕ := + match a.val with + | 0 => 1 + | 1 => 1 + | _ => 0 +def CA1_6_9I0P (a : Fin 17) : Ball := + (CompactCertificate.entropyLookup CA1_6_9I0Certificates (CA1_6_9I0CertificateIndex a)).input +lemma CA1_6_9I0P_check : ∀ a : Fin 17, contains (CA1_6_9I0Raw a) (CA1_6_9I0P a) = true := by + decide +kernel +lemma CA1_6_9I0P_sound (a : Fin 17) : + (CA1_6_9I0P a).Encloses (CA1_6_9I0Value a) := + contains_sound (CA1_6_9I0Raw_sound a) (CA1_6_9I0P_check a) +def CA1_6_9I0Terms (a : Fin 17) : Ball := + (CompactCertificate.entropyLookup CA1_6_9I0Certificates (CA1_6_9I0CertificateIndex a)).output +lemma CA1_6_9I0Terms_sound (a : Fin 17) : + (CA1_6_9I0Terms a).Encloses (Foundation.entropyTerm (CA1_6_9I0Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_6_9I0Certificates_valid + (CA1_6_9I0CertificateIndex a) (CA1_6_9I0P_sound a) +def CA1_6_9I0Entropy : Ball := ⟨(6931471805599453094172319305033 / 10000000000000000000000000000000), (330872247 / 781250000000000000000000000000)⟩ +lemma CA1_6_9I0Entropy_sound : CA1_6_9I0Entropy.Encloses (Foundation.finiteEntropy CA1_6_9I0Value) := by + exact contains_sound (entropyFin_enclosed 17 CA1_6_9I0Value CA1_6_9I0Terms CA1_6_9I0Terms_sound) (by decide +kernel) +def CA1_6_9I0Mass : Ball := ⟨1, (37 / 25000000000000000000000000000000)⟩ +lemma CA1_6_9I0Mass_sound : CA1_6_9I0Mass.Encloses (∑ a, CA1_6_9I0Value a) := by + exact contains_sound (finSumBall_sound 17 CA1_6_9I0P CA1_6_9I0Value CA1_6_9I0P_sound) (by decide +kernel) +def CA1_6_9I0MassTermLogWitness : LogWitness := ⟨0, 1, 1⟩ +def CA1_6_9I0MassTermLog : Ball := ⟨0, (2117582383 / 10000000000000000000000000000000)⟩ +lemma CA1_6_9I0MassTermLog_sound : CA1_6_9I0MassTermLog.Encloses (Real.log ((∑ a, CA1_6_9I0Value a))) := by + exact checkLog_sound logTwoBall_sound (CA1_6_9I0Mass_sound) (w := CA1_6_9I0MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA1_6_9I0MassTerm : Ball := ⟨0, (21175823831 / 100000000000000000000000000000000)⟩ +lemma CA1_6_9I0MassTerm_sound : CA1_6_9I0MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_6_9I0Value a))) := by + exact contains_sound (entropyTerm_ball (CA1_6_9I0Mass_sound) CA1_6_9I0MassTermLog_sound) (by decide +kernel) +def CA1_6_9I0H : Ball := ⟨(6931471805599453094172319305033 / 10000000000000000000000000000000), (63527471447 / 100000000000000000000000000000000)⟩ +lemma CA1_6_9I0H_sound : CA1_6_9I0H.Encloses (homogeneousEntropy CA1_6_9I0Value) := by + exact contains_sound (homogeneous_enclosed CA1_6_9I0Value CA1_6_9I0MassTerm_sound CA1_6_9I0Entropy_sound) (by decide +kernel) +lemma CA1_6_9I0_sound : CA1_6_9I0H.Encloses (stageACapacity (shape 1 6 9) 0) := by + exact CA1_6_9I0H_sound + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA1_6_9I1.lean b/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA1_6_9I1.lean new file mode 100644 index 0000000000000000000000000000000000000000..30808444399cb95dbb3dca5277f97d2c5613eaf4 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA1_6_9I1.lean @@ -0,0 +1,848 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.CapacityA.CapA1_6_9I1Pair + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CA1_6_9I1R0Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 6 9)) (fun u => (stageALaw (shape 1 6 9) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 0 a +def CA1_6_9I1R0Raw (a : PairSlot) : Ball := residualBall (below (shape 1 6 9)) A1_6_9Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 0 a +lemma CA1_6_9I1R0Raw_sound (a : PairSlot) : + (CA1_6_9I1R0Raw a).Encloses (CA1_6_9I1R0Value a) := by + exact residualBall_sound_on (below (shape 1 6 9)) A1_6_9Law (fun u => (stageALaw (shape 1 6 9) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A1_6_9Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 6 9) (show (shape 1 6 9) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 0 a +def CA1_6_9I1R0Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(8339999762212914871827795077 / 50000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ ⟨(1450945636735909530787380563 / 1000000000000000000000000000000), (24724901 / 50000000000000000000000000000000)⟩ ⟨(-54366969353445431436392639182027 / 6250000000000000000000000000000), (2316105809 / 781250000000000000000000000000)⟩ ⟨-13, 8339999762212914871827795077, 6103515625000000000000000000⟩] +lemma CA1_6_9I1R0Certificates_valid : + CA1_6_9I1R0Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_6_9I1R0CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 0, 0 => 1 + | _, _ => 0 +def CA1_6_9I1R0P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_6_9I1R0Certificates (CA1_6_9I1R0CertificateIndex a)).input +lemma CA1_6_9I1R0P_check : ∀ a : PairSlot, contains (CA1_6_9I1R0Raw a) (CA1_6_9I1R0P a) = true := by + decide +kernel +lemma CA1_6_9I1R0P_sound (a : PairSlot) : + (CA1_6_9I1R0P a).Encloses (CA1_6_9I1R0Value a) := + contains_sound (CA1_6_9I1R0Raw_sound a) (CA1_6_9I1R0P_check a) +def CA1_6_9I1R0Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_6_9I1R0Certificates (CA1_6_9I1R0CertificateIndex a)).output +lemma CA1_6_9I1R0Terms_sound (a : PairSlot) : + (CA1_6_9I1R0Terms a).Encloses (Foundation.entropyTerm (CA1_6_9I1R0Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_6_9I1R0Certificates_valid + (CA1_6_9I1R0CertificateIndex a) (CA1_6_9I1R0P_sound a) +def CA1_6_9I1R0Entropy : Ball := ⟨(1450945636735909530787380563 / 1000000000000000000000000000000), (24724901 / 50000000000000000000000000000000)⟩ +lemma CA1_6_9I1R0Entropy_sound : CA1_6_9I1R0Entropy.Encloses (Foundation.finiteEntropy CA1_6_9I1R0Value) := by + exact contains_sound (entropyPair_enclosed CA1_6_9I1R0Value CA1_6_9I1R0Terms CA1_6_9I1R0Terms_sound) (by decide +kernel) +def CA1_6_9I1R0Mass : Ball := ⟨(8339999762212914871827795077 / 50000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ +lemma CA1_6_9I1R0Mass_sound : CA1_6_9I1R0Mass.Encloses (∑ a, CA1_6_9I1R0Value a) := by + exact contains_sound (pairSumBall_sound CA1_6_9I1R0P CA1_6_9I1R0Value CA1_6_9I1R0P_sound) (by decide +kernel) +def CA1_6_9I1R0MassTermLogWitness : LogWitness := ⟨-13, 8339999762212914871827795077, 6103515625000000000000000000⟩ +def CA1_6_9I1R0MassTermLog : Ball := ⟨(-54366969353445431436392639182027 / 6250000000000000000000000000000), (2316105809 / 781250000000000000000000000000)⟩ +lemma CA1_6_9I1R0MassTermLog_sound : CA1_6_9I1R0MassTermLog.Encloses (Real.log ((∑ a, CA1_6_9I1R0Value a))) := by + exact checkLog_sound logTwoBall_sound (CA1_6_9I1R0Mass_sound) (w := CA1_6_9I1R0MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA1_6_9I1R0MassTerm : Ball := ⟨(1450945636735909530787380563 / 1000000000000000000000000000000), (24724901 / 50000000000000000000000000000000)⟩ +lemma CA1_6_9I1R0MassTerm_sound : CA1_6_9I1R0MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_6_9I1R0Value a))) := by + exact contains_sound (entropyTerm_ball (CA1_6_9I1R0Mass_sound) CA1_6_9I1R0MassTermLog_sound) (by decide +kernel) +def CA1_6_9I1R0H : Ball := ⟨0, (24724901 / 25000000000000000000000000000000)⟩ +lemma CA1_6_9I1R0H_sound : CA1_6_9I1R0H.Encloses (homogeneousEntropy CA1_6_9I1R0Value) := by + exact contains_sound (homogeneous_enclosed CA1_6_9I1R0Value CA1_6_9I1R0MassTerm_sound CA1_6_9I1R0Entropy_sound) (by decide +kernel) +def CA1_6_9I1R1Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 6 9)) (fun u => (stageALaw (shape 1 6 9) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 1 a +def CA1_6_9I1R1Raw (a : PairSlot) : Ball := residualBall (below (shape 1 6 9)) A1_6_9Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 1 a +lemma CA1_6_9I1R1Raw_sound (a : PairSlot) : + (CA1_6_9I1R1Raw a).Encloses (CA1_6_9I1R1Value a) := by + exact residualBall_sound_on (below (shape 1 6 9)) A1_6_9Law (fun u => (stageALaw (shape 1 6 9) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A1_6_9Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 6 9) (show (shape 1 6 9) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 1 a +def CA1_6_9I1R1Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(352950608149296318805341356721 / 50000000000000000000000000000000), (1 / 20000000000000000000000000000000)⟩ ⟨(3496646491070427809635638237251 / 100000000000000000000000000000000), (1345323603 / 100000000000000000000000000000000)⟩ ⟨(-247672507876184481726943786438277 / 50000000000000000000000000000000), (38116482771 / 20000000000000000000000000000000)⟩ ⟨-8, 352950608149296318805341356721, 195312500000000000000000000000⟩] +lemma CA1_6_9I1R1Certificates_valid : + CA1_6_9I1R1Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_6_9I1R1CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 1, 0 => 1 + | 0, 1 => 1 + | _, _ => 0 +def CA1_6_9I1R1P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_6_9I1R1Certificates (CA1_6_9I1R1CertificateIndex a)).input +lemma CA1_6_9I1R1P_check : ∀ a : PairSlot, contains (CA1_6_9I1R1Raw a) (CA1_6_9I1R1P a) = true := by + decide +kernel +lemma CA1_6_9I1R1P_sound (a : PairSlot) : + (CA1_6_9I1R1P a).Encloses (CA1_6_9I1R1Value a) := + contains_sound (CA1_6_9I1R1Raw_sound a) (CA1_6_9I1R1P_check a) +def CA1_6_9I1R1Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_6_9I1R1Certificates (CA1_6_9I1R1CertificateIndex a)).output +lemma CA1_6_9I1R1Terms_sound (a : PairSlot) : + (CA1_6_9I1R1Terms a).Encloses (Foundation.entropyTerm (CA1_6_9I1R1Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_6_9I1R1Certificates_valid + (CA1_6_9I1R1CertificateIndex a) (CA1_6_9I1R1P_sound a) +def CA1_6_9I1R1Entropy : Ball := ⟨(3496646491070427809635638237251 / 50000000000000000000000000000000), (1345323603 / 50000000000000000000000000000000)⟩ +lemma CA1_6_9I1R1Entropy_sound : CA1_6_9I1R1Entropy.Encloses (Foundation.finiteEntropy CA1_6_9I1R1Value) := by + exact contains_sound (entropyPair_enclosed CA1_6_9I1R1Value CA1_6_9I1R1Terms CA1_6_9I1R1Terms_sound) (by decide +kernel) +def CA1_6_9I1R1Mass : Ball := ⟨(352950608149296318805341356721 / 25000000000000000000000000000000), (1 / 10000000000000000000000000000000)⟩ +lemma CA1_6_9I1R1Mass_sound : CA1_6_9I1R1Mass.Encloses (∑ a, CA1_6_9I1R1Value a) := by + exact contains_sound (pairSumBall_sound CA1_6_9I1R1P CA1_6_9I1R1Value CA1_6_9I1R1P_sound) (by decide +kernel) +def CA1_6_9I1R1MassTermLogWitness : LogWitness := ⟨-7, 352950608149296318805341356721, 195312500000000000000000000000⟩ +def CA1_6_9I1R1MassTermLog : Ball := ⟨(-26626893606023402032010273739139 / 6250000000000000000000000000000), (42351647543 / 25000000000000000000000000000000)⟩ +lemma CA1_6_9I1R1MassTermLog_sound : CA1_6_9I1R1MassTermLog.Encloses (Real.log ((∑ a, CA1_6_9I1R1Value a))) := by + exact checkLog_sound logTwoBall_sound (CA1_6_9I1R1Mass_sound) (w := CA1_6_9I1R1MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA1_6_9I1R1MassTerm : Ball := ⟨(6014706106478444419857431517203 / 100000000000000000000000000000000), (478337281 / 20000000000000000000000000000000)⟩ +lemma CA1_6_9I1R1MassTerm_sound : CA1_6_9I1R1MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_6_9I1R1Value a))) := by + exact contains_sound (entropyTerm_ball (CA1_6_9I1R1Mass_sound) CA1_6_9I1R1MassTermLog_sound) (by decide +kernel) +def CA1_6_9I1R1H : Ball := ⟨(978586875662411199413844957299 / 100000000000000000000000000000000), (5082333611 / 100000000000000000000000000000000)⟩ +lemma CA1_6_9I1R1H_sound : CA1_6_9I1R1H.Encloses (homogeneousEntropy CA1_6_9I1R1Value) := by + exact contains_sound (homogeneous_enclosed CA1_6_9I1R1Value CA1_6_9I1R1MassTerm_sound CA1_6_9I1R1Entropy_sound) (by decide +kernel) +def CA1_6_9I1R2Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 6 9)) (fun u => (stageALaw (shape 1 6 9) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 2 a +def CA1_6_9I1R2Raw (a : PairSlot) : Ball := residualBall (below (shape 1 6 9)) A1_6_9Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 2 a +lemma CA1_6_9I1R2Raw_sound (a : PairSlot) : + (CA1_6_9I1R2Raw a).Encloses (CA1_6_9I1R2Value a) := by + exact residualBall_sound_on (below (shape 1 6 9)) A1_6_9Law (fun u => (stageALaw (shape 1 6 9) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A1_6_9Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 6 9) (show (shape 1 6 9) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 2 a +def CA1_6_9I1R2Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(3750256193599697178331260570691 / 100000000000000000000000000000000), (1 / 6250000000000000000000000000000)⟩ ⟨(12313388784911392649224959762473 / 100000000000000000000000000000000), (952977181 / 20000000000000000000000000000000)⟩ ⟨(-328334603004610765255022211056333 / 100000000000000000000000000000000), (31763735631 / 25000000000000000000000000000000)⟩ ⟨-5, 3750256193599697178331260570691, 3125000000000000000000000000000⟩, + .log ⟨(96463806186056584059676008661 / 25000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ ⟨(428875244823396362642940222883 / 20000000000000000000000000000000), (817080241 / 100000000000000000000000000000000)⟩ ⟨(-69468290391118668442947267645409 / 12500000000000000000000000000000), (211758237607 / 100000000000000000000000000000000)⟩ ⟨-9, 96463806186056584059676008661, 48828125000000000000000000000⟩, + .log ⟨(13846809169340604683773678740841 / 100000000000000000000000000000000), (9 / 25000000000000000000000000000000)⟩ ⟨(3422092395239441090087522368893 / 12500000000000000000000000000000), (1172870369 / 10000000000000000000000000000000)⟩ ⟨(-98855768239128658880322037043519 / 50000000000000000000000000000000), (84703294991 / 100000000000000000000000000000000)⟩ ⟨-3, 13846809169340604683773678740841, 12500000000000000000000000000000⟩] +lemma CA1_6_9I1R2Certificates_valid : + CA1_6_9I1R2Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_6_9I1R2CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 2, 0 => 1 + | 3, 0 => 2 + | 1, 1 => 3 + | 0, 2 => 1 + | 0, 3 => 2 + | _, _ => 0 +def CA1_6_9I1R2P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_6_9I1R2Certificates (CA1_6_9I1R2CertificateIndex a)).input +lemma CA1_6_9I1R2P_check : ∀ a : PairSlot, contains (CA1_6_9I1R2Raw a) (CA1_6_9I1R2P a) = true := by + decide +kernel +lemma CA1_6_9I1R2P_sound (a : PairSlot) : + (CA1_6_9I1R2P a).Encloses (CA1_6_9I1R2Value a) := + contains_sound (CA1_6_9I1R2Raw_sound a) (CA1_6_9I1R2P_check a) +def CA1_6_9I1R2Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_6_9I1R2Certificates (CA1_6_9I1R2CertificateIndex a)).output +lemma CA1_6_9I1R2Terms_sound (a : PairSlot) : + (CA1_6_9I1R2Terms a).Encloses (Foundation.entropyTerm (CA1_6_9I1R2Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_6_9I1R2Certificates_valid + (CA1_6_9I1R2CertificateIndex a) (CA1_6_9I1R2P_sound a) +def CA1_6_9I1R2Entropy : Ball := ⟨(1407306729499306941139487517623 / 2500000000000000000000000000000), (11446317991 / 50000000000000000000000000000000)⟩ +lemma CA1_6_9I1R2Entropy_sound : CA1_6_9I1R2Entropy.Encloses (Foundation.finiteEntropy CA1_6_9I1R2Value) := by + exact contains_sound (entropyPair_enclosed CA1_6_9I1R2Value CA1_6_9I1R2Terms CA1_6_9I1R2Terms_sound) (by decide +kernel) +def CA1_6_9I1R2Mass : Ball := ⟨(22119032006028451712913607951511 / 100000000000000000000000000000000), (37 / 50000000000000000000000000000000)⟩ +lemma CA1_6_9I1R2Mass_sound : CA1_6_9I1R2Mass.Encloses (∑ a, CA1_6_9I1R2Value a) := by + exact contains_sound (pairSumBall_sound CA1_6_9I1R2P CA1_6_9I1R2Value CA1_6_9I1R2P_sound) (by decide +kernel) +def CA1_6_9I1R2MassTermLogWitness : LogWitness := ⟨-3, 22119032006028451712913607951511, 12500000000000000000000000000000⟩ +def CA1_6_9I1R2MassTermLog : Ball := ⟨(-4714786785377982092429811765109 / 3125000000000000000000000000000), (42351647533 / 50000000000000000000000000000000)⟩ +lemma CA1_6_9I1R2MassTermLog_sound : CA1_6_9I1R2MassTermLog.Encloses (Real.log ((∑ a, CA1_6_9I1R2Value a))) := by + exact checkLog_sound logTwoBall_sound (CA1_6_9I1R2Mass_sound) (w := CA1_6_9I1R2MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA1_6_9I1R2MassTerm : Ball := ⟨(1668584316918009319523460857527 / 5000000000000000000000000000000), (9367774529 / 50000000000000000000000000000000)⟩ +lemma CA1_6_9I1R2MassTerm_sound : CA1_6_9I1R2MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_6_9I1R2Value a))) := by + exact contains_sound (entropyTerm_ball (CA1_6_9I1R2Mass_sound) CA1_6_9I1R2MassTermLog_sound) (by decide +kernel) +def CA1_6_9I1R2H : Ball := ⟨(1146029142080604562755514177719 / 5000000000000000000000000000000), (520352313 / 1250000000000000000000000000000)⟩ +lemma CA1_6_9I1R2H_sound : CA1_6_9I1R2H.Encloses (homogeneousEntropy CA1_6_9I1R2Value) := by + exact contains_sound (homogeneous_enclosed CA1_6_9I1R2Value CA1_6_9I1R2MassTerm_sound CA1_6_9I1R2Entropy_sound) (by decide +kernel) +def CA1_6_9I1R3Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 6 9)) (fun u => (stageALaw (shape 1 6 9) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 3 a +def CA1_6_9I1R3Raw (a : PairSlot) : Ball := residualBall (below (shape 1 6 9)) A1_6_9Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 3 a +lemma CA1_6_9I1R3Raw_sound (a : PairSlot) : + (CA1_6_9I1R3Raw a).Encloses (CA1_6_9I1R3Value a) := by + exact residualBall_sound_on (below (shape 1 6 9)) A1_6_9Law (fun u => (stageALaw (shape 1 6 9) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A1_6_9Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 6 9) (show (shape 1 6 9) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 3 a +def CA1_6_9I1R3Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(262997359306142918070847892299 / 25000000000000000000000000000000), (1 / 20000000000000000000000000000000)⟩ ⟨(2395636167101722520226825879023 / 50000000000000000000000000000000), (27845929 / 1562500000000000000000000000000)⟩ ⟨(-1821794844953613827296409995907 / 400000000000000000000000000000), (169406589939 / 100000000000000000000000000000000)⟩ ⟨-7, 262997359306142918070847892299, 195312500000000000000000000000⟩, + .log ⟨(5788381024642755450801079594891 / 25000000000000000000000000000000), (23 / 50000000000000000000000000000000)⟩ ⟨(3387414264386620807997353345651 / 10000000000000000000000000000000), (1225737367 / 6250000000000000000000000000000)⟩ ⟨(-3657557970403826810673592756509 / 2500000000000000000000000000000), (8470329493 / 10000000000000000000000000000000)⟩ ⟨-3, 5788381024642755450801079594891, 3125000000000000000000000000000⟩, + .log ⟨(561743006513585926658415270673 / 25000000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ ⟨(341143080310919619072648549763 / 4000000000000000000000000000000), (3330703861 / 100000000000000000000000000000000)⟩ ⟨(-379558664232641596305435459734451 / 100000000000000000000000000000000), (74115382979 / 50000000000000000000000000000000)⟩ ⟨-6, 561743006513585926658415270673, 390625000000000000000000000000⟩] +lemma CA1_6_9I1R3Certificates_valid : + CA1_6_9I1R3Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_6_9I1R3CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 4, 0 => 1 + | 2, 1 => 2 + | 3, 1 => 3 + | 1, 2 => 2 + | 1, 3 => 3 + | 0, 4 => 1 + | _, _ => 0 +def CA1_6_9I1R3P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_6_9I1R3Certificates (CA1_6_9I1R3CertificateIndex a)).input +lemma CA1_6_9I1R3P_check : ∀ a : PairSlot, contains (CA1_6_9I1R3Raw a) (CA1_6_9I1R3P a) = true := by + decide +kernel +lemma CA1_6_9I1R3P_sound (a : PairSlot) : + (CA1_6_9I1R3P a).Encloses (CA1_6_9I1R3Value a) := + contains_sound (CA1_6_9I1R3Raw_sound a) (CA1_6_9I1R3P_check a) +def CA1_6_9I1R3Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_6_9I1R3Certificates (CA1_6_9I1R3CertificateIndex a)).output +lemma CA1_6_9I1R3Terms_sound (a : PairSlot) : + (CA1_6_9I1R3Terms a).Encloses (Foundation.entropyTerm (CA1_6_9I1R3Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_6_9I1R3Certificates_valid + (CA1_6_9I1R3CertificateIndex a) (CA1_6_9I1R3P_sound a) +def CA1_6_9I1R3Entropy : Ball := ⟨(47193991985842643597243398958631 / 50000000000000000000000000000000), (24724641189 / 50000000000000000000000000000000)⟩ +lemma CA1_6_9I1R3Entropy_sound : CA1_6_9I1R3Entropy.Encloses (Foundation.finiteEntropy CA1_6_9I1R3Value) := by + exact contains_sound (entropyPair_enclosed CA1_6_9I1R3Value CA1_6_9I1R3Terms CA1_6_9I1R3Terms_sound) (by decide +kernel) +def CA1_6_9I1R3Mass : Ball := ⟨(6613121390462484295530342757863 / 12500000000000000000000000000000), (11 / 10000000000000000000000000000000)⟩ +lemma CA1_6_9I1R3Mass_sound : CA1_6_9I1R3Mass.Encloses (∑ a, CA1_6_9I1R3Value a) := by + exact contains_sound (pairSumBall_sound CA1_6_9I1R3P CA1_6_9I1R3Value CA1_6_9I1R3P_sound) (by decide +kernel) +def CA1_6_9I1R3MassTermLogWitness : LogWitness := ⟨-1, 6613121390462484295530342757863, 6250000000000000000000000000000⟩ +def CA1_6_9I1R3MassTermLog : Ball := ⟨(-795841099307891183778313920487 / 1250000000000000000000000000000), (42351647573 / 100000000000000000000000000000000)⟩ +lemma CA1_6_9I1R3MassTermLog_sound : CA1_6_9I1R3MassTermLog.Encloses (Real.log ((∑ a, CA1_6_9I1R3Value a))) := by + exact checkLog_sound logTwoBall_sound (CA1_6_9I1R3Mass_sound) (w := CA1_6_9I1R3MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA1_6_9I1R3MassTerm : Ball := ⟨(33683160302350037717787471431689 / 100000000000000000000000000000000), (2240612699 / 10000000000000000000000000000000)⟩ +lemma CA1_6_9I1R3MassTerm_sound : CA1_6_9I1R3MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_6_9I1R3Value a))) := by + exact contains_sound (entropyTerm_ball (CA1_6_9I1R3Mass_sound) CA1_6_9I1R3MassTermLog_sound) (by decide +kernel) +def CA1_6_9I1R3H : Ball := ⟨(60704823669335249476699326485573 / 100000000000000000000000000000000), (8981926171 / 12500000000000000000000000000000)⟩ +lemma CA1_6_9I1R3H_sound : CA1_6_9I1R3H.Encloses (homogeneousEntropy CA1_6_9I1R3Value) := by + exact contains_sound (homogeneous_enclosed CA1_6_9I1R3Value CA1_6_9I1R3MassTerm_sound CA1_6_9I1R3Entropy_sound) (by decide +kernel) +def CA1_6_9I1R4Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 6 9)) (fun u => (stageALaw (shape 1 6 9) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 4 a +def CA1_6_9I1R4Raw (a : PairSlot) : Ball := residualBall (below (shape 1 6 9)) A1_6_9Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 4 a +lemma CA1_6_9I1R4Raw_sound (a : PairSlot) : + (CA1_6_9I1R4Raw a).Encloses (CA1_6_9I1R4Value a) := by + exact residualBall_sound_on (below (shape 1 6 9)) A1_6_9Law (fun u => (stageALaw (shape 1 6 9) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A1_6_9Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 6 9) (show (shape 1 6 9) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 4 a +def CA1_6_9I1R4Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(35826987774826412940031031201 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(142129673252656233185977844649 / 50000000000000000000000000000000), (98626587 / 100000000000000000000000000000000)⟩ ⟨(-396711200355288234932394326306789 / 50000000000000000000000000000000), (275285710669 / 100000000000000000000000000000000)⟩ ⟨-12, 35826987774826412940031031201, 24414062500000000000000000000⟩, + .log ⟨(163534707329622154185550545721 / 6250000000000000000000000000000), (11 / 100000000000000000000000000000000)⟩ ⟨(9532926071727824250208934309911 / 100000000000000000000000000000000), (969635009 / 25000000000000000000000000000000)⟩ ⟨(-72866229953507402120495250057111 / 20000000000000000000000000000000), (148230766201 / 100000000000000000000000000000000)⟩ ⟨-6, 163534707329622154185550545721, 97656250000000000000000000000⟩, + .log ⟨(879221464663087013174741520473 / 6250000000000000000000000000000), (13 / 25000000000000000000000000000000)⟩ ⟨(3448833987306901485794990391481 / 12500000000000000000000000000000), (2978918233 / 25000000000000000000000000000000)⟩ ⟨(-39225998521640691723875329727651 / 20000000000000000000000000000000), (84703295101 / 100000000000000000000000000000000)⟩ ⟨-3, 879221464663087013174741520473, 781250000000000000000000000000⟩, + .log ⟨(1310487633486652602794470143421 / 100000000000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ ⟨(2840331815290867417715528693877 / 50000000000000000000000000000000), (1110026219 / 50000000000000000000000000000000)⟩ ⟨(-27092317992100651631905078306153 / 6250000000000000000000000000000), (169406589921 / 100000000000000000000000000000000)⟩ ⟨-7, 1310487633486652602794470143421, 781250000000000000000000000000⟩, + .log ⟨(31437173587048134177780952907 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(419915132460468872428984587311 / 50000000000000000000000000000000), (73227887 / 25000000000000000000000000000000)⟩ ⟨(-166966000974031016161403637963159 / 25000000000000000000000000000000), (58233515327 / 25000000000000000000000000000000)⟩ ⟨-10, 31437173587048134177780952907, 24414062500000000000000000000⟩] +lemma CA1_6_9I1R4Certificates_valid : + CA1_6_9I1R4Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_6_9I1R4CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 0, 5 => 1 + | 1, 4 => 2 + | 2, 2 => 3 + | 2, 3 => 4 + | 3, 2 => 4 + | 3, 3 => 5 + | 4, 1 => 2 + | 5, 0 => 1 + | _, _ => 0 +def CA1_6_9I1R4P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_6_9I1R4Certificates (CA1_6_9I1R4CertificateIndex a)).input +lemma CA1_6_9I1R4P_check : ∀ a : PairSlot, contains (CA1_6_9I1R4Raw a) (CA1_6_9I1R4P a) = true := by + decide +kernel +lemma CA1_6_9I1R4P_sound (a : PairSlot) : + (CA1_6_9I1R4P a).Encloses (CA1_6_9I1R4Value a) := + contains_sound (CA1_6_9I1R4Raw_sound a) (CA1_6_9I1R4P_check a) +def CA1_6_9I1R4Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_6_9I1R4Certificates (CA1_6_9I1R4CertificateIndex a)).output +lemma CA1_6_9I1R4Terms_sound (a : PairSlot) : + (CA1_6_9I1R4Terms a).Encloses (Foundation.entropyTerm (CA1_6_9I1R4Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_6_9I1R4Certificates_valid + (CA1_6_9I1R4CertificateIndex a) (CA1_6_9I1R4P_sound a) +def CA1_6_9I1R4Entropy : Ball := ⟨(14856550065251473183810446770099 / 25000000000000000000000000000000), (12301511301 / 50000000000000000000000000000000)⟩ +lemma CA1_6_9I1R4Entropy_sound : CA1_6_9I1R4Entropy.Encloses (Foundation.finiteEntropy CA1_6_9I1R4Value) := by + exact contains_sound (entropyPair_enclosed CA1_6_9I1R4Value CA1_6_9I1R4Terms CA1_6_9I1R4Terms_sound) (by decide +kernel) +def CA1_6_9I1R4Mass : Ball := ⟨(2764879000753556464114200993939 / 12500000000000000000000000000000), (89 / 100000000000000000000000000000000)⟩ +lemma CA1_6_9I1R4Mass_sound : CA1_6_9I1R4Mass.Encloses (∑ a, CA1_6_9I1R4Value a) := by + exact contains_sound (pairSumBall_sound CA1_6_9I1R4P CA1_6_9I1R4Value CA1_6_9I1R4P_sound) (by decide +kernel) +def CA1_6_9I1R4MassTermLogWitness : LogWitness := ⟨-3, 2764879000753556464114200993939, 1562500000000000000000000000000⟩ +def CA1_6_9I1R4MassTermLog : Ball := ⟨(-150873177132095426957753976483483 / 100000000000000000000000000000000), (42351647567 / 50000000000000000000000000000000)⟩ +lemma CA1_6_9I1R4MassTermLog_sound : CA1_6_9I1R4MassTermLog.Encloses (Real.log ((∑ a, CA1_6_9I1R4Value a))) := by + exact checkLog_sound logTwoBall_sound (CA1_6_9I1R4Mass_sound) (w := CA1_6_9I1R4MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA1_6_9I1R4MassTerm : Ball := ⟨(1668584316918009319523460857527 / 5000000000000000000000000000000), (2341943637 / 12500000000000000000000000000000)⟩ +lemma CA1_6_9I1R4MassTerm_sound : CA1_6_9I1R4MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_6_9I1R4Value a))) := by + exact contains_sound (entropyTerm_ball (CA1_6_9I1R4Mass_sound) CA1_6_9I1R4MassTermLog_sound) (by decide +kernel) +def CA1_6_9I1R4H : Ball := ⟨(203550890020669580818535702577 / 781250000000000000000000000000), (21669285849 / 50000000000000000000000000000000)⟩ +lemma CA1_6_9I1R4H_sound : CA1_6_9I1R4H.Encloses (homogeneousEntropy CA1_6_9I1R4Value) := by + exact contains_sound (homogeneous_enclosed CA1_6_9I1R4Value CA1_6_9I1R4MassTerm_sound CA1_6_9I1R4Entropy_sound) (by decide +kernel) +def CA1_6_9I1R5Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 6 9)) (fun u => (stageALaw (shape 1 6 9) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 5 a +def CA1_6_9I1R5Raw (a : PairSlot) : Ball := residualBall (below (shape 1 6 9)) A1_6_9Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 5 a +lemma CA1_6_9I1R5Raw_sound (a : PairSlot) : + (CA1_6_9I1R5Raw a).Encloses (CA1_6_9I1R5Value a) := by + exact residualBall_sound_on (below (shape 1 6 9)) A1_6_9Law (fun u => (stageALaw (shape 1 6 9) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A1_6_9Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 6 9) (show (shape 1 6 9) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 5 a +def CA1_6_9I1R5Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(18501565179107019817172619 / 62500000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(4810446319640869613227379209 / 2000000000000000000000000000000), (81491473 / 100000000000000000000000000000000)⟩ ⟨(-812506650294289851993150014054797 / 100000000000000000000000000000000), (34410713907 / 12500000000000000000000000000000)⟩ ⟨-12, 18501565179107019817172619, 15258789062500000000000000⟩, + .log ⟨(620735982479902521471775500981 / 100000000000000000000000000000000), (1 / 20000000000000000000000000000000)⟩ ⟨(1577296221653711324887320429691 / 50000000000000000000000000000000), (591506823 / 50000000000000000000000000000000)⟩ ⟨(-254100981121193375479592091504871 / 50000000000000000000000000000000), (1488925109 / 781250000000000000000000000000)⟩ ⟨-8, 620735982479902521471775500981, 390625000000000000000000000000⟩, + .log ⟨(55562729532118884431431022061 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(83293119056991338824175993333 / 20000000000000000000000000000000), (141190397 / 100000000000000000000000000000000)⟩ ⟨(-14990825641285761383223078064461 / 2000000000000000000000000000000), (50821977199 / 20000000000000000000000000000000)⟩ ⟨-11, 55562729532118884431431022061, 48828125000000000000000000000⟩] +lemma CA1_6_9I1R5Certificates_valid : + CA1_6_9I1R5Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_6_9I1R5CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 1, 5 => 1 + | 2, 4 => 2 + | 3, 4 => 3 + | 4, 2 => 2 + | 4, 3 => 3 + | 5, 1 => 1 + | _, _ => 0 +def CA1_6_9I1R5P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_6_9I1R5Certificates (CA1_6_9I1R5CertificateIndex a)).input +lemma CA1_6_9I1R5P_check : ∀ a : PairSlot, contains (CA1_6_9I1R5Raw a) (CA1_6_9I1R5P a) = true := by + decide +kernel +lemma CA1_6_9I1R5P_sound (a : PairSlot) : + (CA1_6_9I1R5P a).Encloses (CA1_6_9I1R5Value a) := + contains_sound (CA1_6_9I1R5Raw_sound a) (CA1_6_9I1R5P_check a) +def CA1_6_9I1R5Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_6_9I1R5Certificates (CA1_6_9I1R5CertificateIndex a)).output +lemma CA1_6_9I1R5Terms_sound (a : PairSlot) : + (CA1_6_9I1R5Terms a).Encloses (Foundation.entropyTerm (CA1_6_9I1R5Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_6_9I1R5Certificates_valid + (CA1_6_9I1R5CertificateIndex a) (CA1_6_9I1R5P_sound a) +def CA1_6_9I1R5Entropy : Ball := ⟨(3811580354574422824556889786497 / 50000000000000000000000000000000), (351423879 / 12500000000000000000000000000000)⟩ +lemma CA1_6_9I1R5Entropy_sound : CA1_6_9I1R5Entropy.Encloses (Foundation.finiteEntropy CA1_6_9I1R5Value) := by + exact contains_sound (entropyPair_enclosed CA1_6_9I1R5Value CA1_6_9I1R5Terms CA1_6_9I1R5Terms_sound) (by decide +kernel) +def CA1_6_9I1R5Mass : Ball := ⟨(352950608149296318805341356721 / 25000000000000000000000000000000), (7 / 50000000000000000000000000000000)⟩ +lemma CA1_6_9I1R5Mass_sound : CA1_6_9I1R5Mass.Encloses (∑ a, CA1_6_9I1R5Value a) := by + exact contains_sound (pairSumBall_sound CA1_6_9I1R5P CA1_6_9I1R5Value CA1_6_9I1R5P_sound) (by decide +kernel) +def CA1_6_9I1R5MassTermLogWitness : LogWitness := ⟨-7, 352950608149296318805341356721, 195312500000000000000000000000⟩ +def CA1_6_9I1R5MassTermLog : Ball := ⟨(-26626893606023402032010273739139 / 6250000000000000000000000000000), (33881318091 / 20000000000000000000000000000000)⟩ +lemma CA1_6_9I1R5MassTermLog_sound : CA1_6_9I1R5MassTermLog.Encloses (Real.log ((∑ a, CA1_6_9I1R5Value a))) := by + exact checkLog_sound logTwoBall_sound (CA1_6_9I1R5Mass_sound) (w := CA1_6_9I1R5MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA1_6_9I1R5MassTerm : Ball := ⟨(6014706106478444419857431517203 / 100000000000000000000000000000000), (1195843213 / 50000000000000000000000000000000)⟩ +lemma CA1_6_9I1R5MassTerm_sound : CA1_6_9I1R5MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_6_9I1R5Value a))) := by + exact contains_sound (entropyTerm_ball (CA1_6_9I1R5Mass_sound) CA1_6_9I1R5MassTermLog_sound) (by decide +kernel) +def CA1_6_9I1R5H : Ball := ⟨(1608454602670401229256348055791 / 100000000000000000000000000000000), (2601538729 / 50000000000000000000000000000000)⟩ +lemma CA1_6_9I1R5H_sound : CA1_6_9I1R5H.Encloses (homogeneousEntropy CA1_6_9I1R5Value) := by + exact contains_sound (homogeneous_enclosed CA1_6_9I1R5Value CA1_6_9I1R5MassTerm_sound CA1_6_9I1R5Entropy_sound) (by decide +kernel) +def CA1_6_9I1R6Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 6 9)) (fun u => (stageALaw (shape 1 6 9) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 6 a +def CA1_6_9I1R6Raw (a : PairSlot) : Ball := residualBall (below (shape 1 6 9)) A1_6_9Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 6 a +lemma CA1_6_9I1R6Raw_sound (a : PairSlot) : + (CA1_6_9I1R6Raw a).Encloses (CA1_6_9I1R6Value a) := by + exact residualBall_sound_on (below (shape 1 6 9)) A1_6_9Law (fun u => (stageALaw (shape 1 6 9) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A1_6_9Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 6 9) (show (shape 1 6 9) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 6 a +def CA1_6_9I1R6Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(657080921971796282931564339 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(27719823945490765311282689673 / 100000000000000000000000000000000), (9461689 / 100000000000000000000000000000000)⟩ ⟨(-131832240037821096251951760685329 / 12500000000000000000000000000000), (179994520329 / 50000000000000000000000000000000)⟩ ⟨-16, 657080921971796282931564339, 381469726562500000000000000⟩, + .log ⟨(94111745008810675585318067 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(1240679906901828064584075781 / 50000000000000000000000000000000), (83703 / 10000000000000000000000000000000)⟩ ⟨(-1318305071046845939950790763193751 / 100000000000000000000000000000000), (222346414313 / 50000000000000000000000000000000)⟩ ⟨-20, 94111745008810675585318067, 47683715820312500000000000⟩, + .log ⟨(441876206744648671114472127 / 4000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ ⟨(100645869110909624952901605809 / 100000000000000000000000000000000), (17544559 / 50000000000000000000000000000000)⟩ ⟨(-911077515147321236108554608474889 / 100000000000000000000000000000000), (317637373349 / 100000000000000000000000000000000)⟩ ⟨-14, 441876206744648671114472127, 244140625000000000000000000⟩] +lemma CA1_6_9I1R6Certificates_valid : + CA1_6_9I1R6Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_6_9I1R6CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 2, 5 => 1 + | 3, 5 => 2 + | 4, 4 => 3 + | 5, 2 => 1 + | 5, 3 => 2 + | _, _ => 0 +def CA1_6_9I1R6P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_6_9I1R6Certificates (CA1_6_9I1R6CertificateIndex a)).input +lemma CA1_6_9I1R6P_check : ∀ a : PairSlot, contains (CA1_6_9I1R6Raw a) (CA1_6_9I1R6P a) = true := by + decide +kernel +lemma CA1_6_9I1R6P_sound (a : PairSlot) : + (CA1_6_9I1R6P a).Encloses (CA1_6_9I1R6Value a) := + contains_sound (CA1_6_9I1R6Raw_sound a) (CA1_6_9I1R6P_check a) +def CA1_6_9I1R6Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_6_9I1R6Certificates (CA1_6_9I1R6CertificateIndex a)).output +lemma CA1_6_9I1R6Terms_sound (a : PairSlot) : + (CA1_6_9I1R6Terms a).Encloses (Foundation.entropyTerm (CA1_6_9I1R6Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_6_9I1R6Certificates_valid + (CA1_6_9I1R6CertificateIndex a) (CA1_6_9I1R6P_sound a) +def CA1_6_9I1R6Entropy : Ball := ⟨(161048236629498467833803288279 / 100000000000000000000000000000000), (13921639 / 25000000000000000000000000000000)⟩ +lemma CA1_6_9I1R6Entropy_sound : CA1_6_9I1R6Entropy.Encloses (Foundation.finiteEntropy CA1_6_9I1R6Value) := by + exact contains_sound (entropyPair_enclosed CA1_6_9I1R6Value CA1_6_9I1R6Terms CA1_6_9I1R6Terms_sound) (by decide +kernel) +def CA1_6_9I1R6Mass : Ball := ⟨(3335999904885165948731118031 / 20000000000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ +lemma CA1_6_9I1R6Mass_sound : CA1_6_9I1R6Mass.Encloses (∑ a, CA1_6_9I1R6Value a) := by + exact contains_sound (pairSumBall_sound CA1_6_9I1R6P CA1_6_9I1R6Value CA1_6_9I1R6P_sound) (by decide +kernel) +def CA1_6_9I1R6MassTermLogWitness : LogWitness := ⟨-13, 3335999904885165948731118031, 2441406250000000000000000000⟩ +def CA1_6_9I1R6MassTermLog : Ball := ⟨(-869871509655126902982282226906437 / 100000000000000000000000000000000), (74115391883 / 25000000000000000000000000000000)⟩ +lemma CA1_6_9I1R6MassTermLog_sound : CA1_6_9I1R6MassTermLog.Encloses (Real.log ((∑ a, CA1_6_9I1R6Value a))) := by + exact checkLog_sound logTwoBall_sound (CA1_6_9I1R6Mass_sound) (w := CA1_6_9I1R6MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA1_6_9I1R6MassTerm : Ball := ⟨(36273640918397738269684514077 / 25000000000000000000000000000000), (49449841 / 100000000000000000000000000000000)⟩ +lemma CA1_6_9I1R6MassTerm_sound : CA1_6_9I1R6MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_6_9I1R6Value a))) := by + exact contains_sound (entropyTerm_ball (CA1_6_9I1R6Mass_sound) CA1_6_9I1R6MassTermLog_sound) (by decide +kernel) +def CA1_6_9I1R6H : Ball := ⟨(15953672955907514755065231971 / 100000000000000000000000000000000), (105136397 / 100000000000000000000000000000000)⟩ +lemma CA1_6_9I1R6H_sound : CA1_6_9I1R6H.Encloses (homogeneousEntropy CA1_6_9I1R6Value) := by + exact contains_sound (homogeneous_enclosed CA1_6_9I1R6Value CA1_6_9I1R6MassTerm_sound CA1_6_9I1R6Entropy_sound) (by decide +kernel) +def CA1_6_9I1R7Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 6 9)) (fun u => (stageALaw (shape 1 6 9) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 7 a +def CA1_6_9I1R7Raw (a : PairSlot) : Ball := residualBall (below (shape 1 6 9)) A1_6_9Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 7 a +lemma CA1_6_9I1R7Raw_sound (a : PairSlot) : + (CA1_6_9I1R7Raw a).Encloses (CA1_6_9I1R7Value a) := by + exact residualBall_sound_on (below (shape 1 6 9)) A1_6_9Law (fun u => (stageALaw (shape 1 6 9) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A1_6_9Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 6 9) (show (shape 1 6 9) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 7 a +def CA1_6_9I1R7Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA1_6_9I1R7Certificates_valid : + CA1_6_9I1R7Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_6_9I1R7CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA1_6_9I1R7P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_6_9I1R7Certificates (CA1_6_9I1R7CertificateIndex a)).input +lemma CA1_6_9I1R7P_check : ∀ a : PairSlot, contains (CA1_6_9I1R7Raw a) (CA1_6_9I1R7P a) = true := by + decide +kernel +lemma CA1_6_9I1R7P_sound (a : PairSlot) : + (CA1_6_9I1R7P a).Encloses (CA1_6_9I1R7Value a) := + contains_sound (CA1_6_9I1R7Raw_sound a) (CA1_6_9I1R7P_check a) +def CA1_6_9I1R7Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_6_9I1R7Certificates (CA1_6_9I1R7CertificateIndex a)).output +lemma CA1_6_9I1R7Terms_sound (a : PairSlot) : + (CA1_6_9I1R7Terms a).Encloses (Foundation.entropyTerm (CA1_6_9I1R7Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_6_9I1R7Certificates_valid + (CA1_6_9I1R7CertificateIndex a) (CA1_6_9I1R7P_sound a) +def CA1_6_9I1R7Entropy : Ball := ⟨0, 0⟩ +lemma CA1_6_9I1R7Entropy_sound : CA1_6_9I1R7Entropy.Encloses (Foundation.finiteEntropy CA1_6_9I1R7Value) := by + exact contains_sound (entropyPair_enclosed CA1_6_9I1R7Value CA1_6_9I1R7Terms CA1_6_9I1R7Terms_sound) (by decide +kernel) +def CA1_6_9I1R7Mass : Ball := ⟨0, 0⟩ +lemma CA1_6_9I1R7Mass_sound : CA1_6_9I1R7Mass.Encloses (∑ a, CA1_6_9I1R7Value a) := by + exact contains_sound (pairSumBall_sound CA1_6_9I1R7P CA1_6_9I1R7Value CA1_6_9I1R7P_sound) (by decide +kernel) +def CA1_6_9I1R7MassTerm : Ball := .exact 0 +lemma CA1_6_9I1R7MassTerm_sound : CA1_6_9I1R7MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_6_9I1R7Value a))) := + entropyTerm_zero_ball (CA1_6_9I1R7Mass_sound) +def CA1_6_9I1R7H : Ball := ⟨0, 0⟩ +lemma CA1_6_9I1R7H_sound : CA1_6_9I1R7H.Encloses (homogeneousEntropy CA1_6_9I1R7Value) := by + exact contains_sound (homogeneous_enclosed CA1_6_9I1R7Value CA1_6_9I1R7MassTerm_sound CA1_6_9I1R7Entropy_sound) (by decide +kernel) +def CA1_6_9I1R8Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 6 9)) (fun u => (stageALaw (shape 1 6 9) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 8 a +def CA1_6_9I1R8Raw (a : PairSlot) : Ball := residualBall (below (shape 1 6 9)) A1_6_9Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 8 a +lemma CA1_6_9I1R8Raw_sound (a : PairSlot) : + (CA1_6_9I1R8Raw a).Encloses (CA1_6_9I1R8Value a) := by + exact residualBall_sound_on (below (shape 1 6 9)) A1_6_9Law (fun u => (stageALaw (shape 1 6 9) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A1_6_9Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 6 9) (show (shape 1 6 9) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 8 a +def CA1_6_9I1R8Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA1_6_9I1R8Certificates_valid : + CA1_6_9I1R8Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_6_9I1R8CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA1_6_9I1R8P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_6_9I1R8Certificates (CA1_6_9I1R8CertificateIndex a)).input +lemma CA1_6_9I1R8P_check : ∀ a : PairSlot, contains (CA1_6_9I1R8Raw a) (CA1_6_9I1R8P a) = true := by + decide +kernel +lemma CA1_6_9I1R8P_sound (a : PairSlot) : + (CA1_6_9I1R8P a).Encloses (CA1_6_9I1R8Value a) := + contains_sound (CA1_6_9I1R8Raw_sound a) (CA1_6_9I1R8P_check a) +def CA1_6_9I1R8Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_6_9I1R8Certificates (CA1_6_9I1R8CertificateIndex a)).output +lemma CA1_6_9I1R8Terms_sound (a : PairSlot) : + (CA1_6_9I1R8Terms a).Encloses (Foundation.entropyTerm (CA1_6_9I1R8Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_6_9I1R8Certificates_valid + (CA1_6_9I1R8CertificateIndex a) (CA1_6_9I1R8P_sound a) +def CA1_6_9I1R8Entropy : Ball := ⟨0, 0⟩ +lemma CA1_6_9I1R8Entropy_sound : CA1_6_9I1R8Entropy.Encloses (Foundation.finiteEntropy CA1_6_9I1R8Value) := by + exact contains_sound (entropyPair_enclosed CA1_6_9I1R8Value CA1_6_9I1R8Terms CA1_6_9I1R8Terms_sound) (by decide +kernel) +def CA1_6_9I1R8Mass : Ball := ⟨0, 0⟩ +lemma CA1_6_9I1R8Mass_sound : CA1_6_9I1R8Mass.Encloses (∑ a, CA1_6_9I1R8Value a) := by + exact contains_sound (pairSumBall_sound CA1_6_9I1R8P CA1_6_9I1R8Value CA1_6_9I1R8P_sound) (by decide +kernel) +def CA1_6_9I1R8MassTerm : Ball := .exact 0 +lemma CA1_6_9I1R8MassTerm_sound : CA1_6_9I1R8MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_6_9I1R8Value a))) := + entropyTerm_zero_ball (CA1_6_9I1R8Mass_sound) +def CA1_6_9I1R8H : Ball := ⟨0, 0⟩ +lemma CA1_6_9I1R8H_sound : CA1_6_9I1R8H.Encloses (homogeneousEntropy CA1_6_9I1R8Value) := by + exact contains_sound (homogeneous_enclosed CA1_6_9I1R8Value CA1_6_9I1R8MassTerm_sound CA1_6_9I1R8Entropy_sound) (by decide +kernel) +def CA1_6_9I1R9Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 6 9)) (fun u => (stageALaw (shape 1 6 9) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 9 a +def CA1_6_9I1R9Raw (a : PairSlot) : Ball := residualBall (below (shape 1 6 9)) A1_6_9Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 9 a +lemma CA1_6_9I1R9Raw_sound (a : PairSlot) : + (CA1_6_9I1R9Raw a).Encloses (CA1_6_9I1R9Value a) := by + exact residualBall_sound_on (below (shape 1 6 9)) A1_6_9Law (fun u => (stageALaw (shape 1 6 9) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A1_6_9Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 6 9) (show (shape 1 6 9) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 9 a +def CA1_6_9I1R9Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA1_6_9I1R9Certificates_valid : + CA1_6_9I1R9Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_6_9I1R9CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA1_6_9I1R9P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_6_9I1R9Certificates (CA1_6_9I1R9CertificateIndex a)).input +lemma CA1_6_9I1R9P_check : ∀ a : PairSlot, contains (CA1_6_9I1R9Raw a) (CA1_6_9I1R9P a) = true := by + decide +kernel +lemma CA1_6_9I1R9P_sound (a : PairSlot) : + (CA1_6_9I1R9P a).Encloses (CA1_6_9I1R9Value a) := + contains_sound (CA1_6_9I1R9Raw_sound a) (CA1_6_9I1R9P_check a) +def CA1_6_9I1R9Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_6_9I1R9Certificates (CA1_6_9I1R9CertificateIndex a)).output +lemma CA1_6_9I1R9Terms_sound (a : PairSlot) : + (CA1_6_9I1R9Terms a).Encloses (Foundation.entropyTerm (CA1_6_9I1R9Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_6_9I1R9Certificates_valid + (CA1_6_9I1R9CertificateIndex a) (CA1_6_9I1R9P_sound a) +def CA1_6_9I1R9Entropy : Ball := ⟨0, 0⟩ +lemma CA1_6_9I1R9Entropy_sound : CA1_6_9I1R9Entropy.Encloses (Foundation.finiteEntropy CA1_6_9I1R9Value) := by + exact contains_sound (entropyPair_enclosed CA1_6_9I1R9Value CA1_6_9I1R9Terms CA1_6_9I1R9Terms_sound) (by decide +kernel) +def CA1_6_9I1R9Mass : Ball := ⟨0, 0⟩ +lemma CA1_6_9I1R9Mass_sound : CA1_6_9I1R9Mass.Encloses (∑ a, CA1_6_9I1R9Value a) := by + exact contains_sound (pairSumBall_sound CA1_6_9I1R9P CA1_6_9I1R9Value CA1_6_9I1R9P_sound) (by decide +kernel) +def CA1_6_9I1R9MassTerm : Ball := .exact 0 +lemma CA1_6_9I1R9MassTerm_sound : CA1_6_9I1R9MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_6_9I1R9Value a))) := + entropyTerm_zero_ball (CA1_6_9I1R9Mass_sound) +def CA1_6_9I1R9H : Ball := ⟨0, 0⟩ +lemma CA1_6_9I1R9H_sound : CA1_6_9I1R9H.Encloses (homogeneousEntropy CA1_6_9I1R9Value) := by + exact contains_sound (homogeneous_enclosed CA1_6_9I1R9Value CA1_6_9I1R9MassTerm_sound CA1_6_9I1R9Entropy_sound) (by decide +kernel) +def CA1_6_9I1R10Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 6 9)) (fun u => (stageALaw (shape 1 6 9) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 10 a +def CA1_6_9I1R10Raw (a : PairSlot) : Ball := residualBall (below (shape 1 6 9)) A1_6_9Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 10 a +lemma CA1_6_9I1R10Raw_sound (a : PairSlot) : + (CA1_6_9I1R10Raw a).Encloses (CA1_6_9I1R10Value a) := by + exact residualBall_sound_on (below (shape 1 6 9)) A1_6_9Law (fun u => (stageALaw (shape 1 6 9) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A1_6_9Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 6 9) (show (shape 1 6 9) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 10 a +def CA1_6_9I1R10Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA1_6_9I1R10Certificates_valid : + CA1_6_9I1R10Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_6_9I1R10CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA1_6_9I1R10P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_6_9I1R10Certificates (CA1_6_9I1R10CertificateIndex a)).input +lemma CA1_6_9I1R10P_check : ∀ a : PairSlot, contains (CA1_6_9I1R10Raw a) (CA1_6_9I1R10P a) = true := by + decide +kernel +lemma CA1_6_9I1R10P_sound (a : PairSlot) : + (CA1_6_9I1R10P a).Encloses (CA1_6_9I1R10Value a) := + contains_sound (CA1_6_9I1R10Raw_sound a) (CA1_6_9I1R10P_check a) +def CA1_6_9I1R10Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_6_9I1R10Certificates (CA1_6_9I1R10CertificateIndex a)).output +lemma CA1_6_9I1R10Terms_sound (a : PairSlot) : + (CA1_6_9I1R10Terms a).Encloses (Foundation.entropyTerm (CA1_6_9I1R10Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_6_9I1R10Certificates_valid + (CA1_6_9I1R10CertificateIndex a) (CA1_6_9I1R10P_sound a) +def CA1_6_9I1R10Entropy : Ball := ⟨0, 0⟩ +lemma CA1_6_9I1R10Entropy_sound : CA1_6_9I1R10Entropy.Encloses (Foundation.finiteEntropy CA1_6_9I1R10Value) := by + exact contains_sound (entropyPair_enclosed CA1_6_9I1R10Value CA1_6_9I1R10Terms CA1_6_9I1R10Terms_sound) (by decide +kernel) +def CA1_6_9I1R10Mass : Ball := ⟨0, 0⟩ +lemma CA1_6_9I1R10Mass_sound : CA1_6_9I1R10Mass.Encloses (∑ a, CA1_6_9I1R10Value a) := by + exact contains_sound (pairSumBall_sound CA1_6_9I1R10P CA1_6_9I1R10Value CA1_6_9I1R10P_sound) (by decide +kernel) +def CA1_6_9I1R10MassTerm : Ball := .exact 0 +lemma CA1_6_9I1R10MassTerm_sound : CA1_6_9I1R10MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_6_9I1R10Value a))) := + entropyTerm_zero_ball (CA1_6_9I1R10Mass_sound) +def CA1_6_9I1R10H : Ball := ⟨0, 0⟩ +lemma CA1_6_9I1R10H_sound : CA1_6_9I1R10H.Encloses (homogeneousEntropy CA1_6_9I1R10Value) := by + exact contains_sound (homogeneous_enclosed CA1_6_9I1R10Value CA1_6_9I1R10MassTerm_sound CA1_6_9I1R10Entropy_sound) (by decide +kernel) +def CA1_6_9I1R11Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 6 9)) (fun u => (stageALaw (shape 1 6 9) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 11 a +def CA1_6_9I1R11Raw (a : PairSlot) : Ball := residualBall (below (shape 1 6 9)) A1_6_9Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 11 a +lemma CA1_6_9I1R11Raw_sound (a : PairSlot) : + (CA1_6_9I1R11Raw a).Encloses (CA1_6_9I1R11Value a) := by + exact residualBall_sound_on (below (shape 1 6 9)) A1_6_9Law (fun u => (stageALaw (shape 1 6 9) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A1_6_9Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 6 9) (show (shape 1 6 9) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 11 a +def CA1_6_9I1R11Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA1_6_9I1R11Certificates_valid : + CA1_6_9I1R11Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_6_9I1R11CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA1_6_9I1R11P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_6_9I1R11Certificates (CA1_6_9I1R11CertificateIndex a)).input +lemma CA1_6_9I1R11P_check : ∀ a : PairSlot, contains (CA1_6_9I1R11Raw a) (CA1_6_9I1R11P a) = true := by + decide +kernel +lemma CA1_6_9I1R11P_sound (a : PairSlot) : + (CA1_6_9I1R11P a).Encloses (CA1_6_9I1R11Value a) := + contains_sound (CA1_6_9I1R11Raw_sound a) (CA1_6_9I1R11P_check a) +def CA1_6_9I1R11Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_6_9I1R11Certificates (CA1_6_9I1R11CertificateIndex a)).output +lemma CA1_6_9I1R11Terms_sound (a : PairSlot) : + (CA1_6_9I1R11Terms a).Encloses (Foundation.entropyTerm (CA1_6_9I1R11Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_6_9I1R11Certificates_valid + (CA1_6_9I1R11CertificateIndex a) (CA1_6_9I1R11P_sound a) +def CA1_6_9I1R11Entropy : Ball := ⟨0, 0⟩ +lemma CA1_6_9I1R11Entropy_sound : CA1_6_9I1R11Entropy.Encloses (Foundation.finiteEntropy CA1_6_9I1R11Value) := by + exact contains_sound (entropyPair_enclosed CA1_6_9I1R11Value CA1_6_9I1R11Terms CA1_6_9I1R11Terms_sound) (by decide +kernel) +def CA1_6_9I1R11Mass : Ball := ⟨0, 0⟩ +lemma CA1_6_9I1R11Mass_sound : CA1_6_9I1R11Mass.Encloses (∑ a, CA1_6_9I1R11Value a) := by + exact contains_sound (pairSumBall_sound CA1_6_9I1R11P CA1_6_9I1R11Value CA1_6_9I1R11P_sound) (by decide +kernel) +def CA1_6_9I1R11MassTerm : Ball := .exact 0 +lemma CA1_6_9I1R11MassTerm_sound : CA1_6_9I1R11MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_6_9I1R11Value a))) := + entropyTerm_zero_ball (CA1_6_9I1R11Mass_sound) +def CA1_6_9I1R11H : Ball := ⟨0, 0⟩ +lemma CA1_6_9I1R11H_sound : CA1_6_9I1R11H.Encloses (homogeneousEntropy CA1_6_9I1R11Value) := by + exact contains_sound (homogeneous_enclosed CA1_6_9I1R11Value CA1_6_9I1R11MassTerm_sound CA1_6_9I1R11Entropy_sound) (by decide +kernel) +def CA1_6_9I1R12Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 6 9)) (fun u => (stageALaw (shape 1 6 9) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 12 a +def CA1_6_9I1R12Raw (a : PairSlot) : Ball := residualBall (below (shape 1 6 9)) A1_6_9Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 12 a +lemma CA1_6_9I1R12Raw_sound (a : PairSlot) : + (CA1_6_9I1R12Raw a).Encloses (CA1_6_9I1R12Value a) := by + exact residualBall_sound_on (below (shape 1 6 9)) A1_6_9Law (fun u => (stageALaw (shape 1 6 9) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A1_6_9Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 6 9) (show (shape 1 6 9) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 12 a +def CA1_6_9I1R12Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA1_6_9I1R12Certificates_valid : + CA1_6_9I1R12Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_6_9I1R12CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA1_6_9I1R12P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_6_9I1R12Certificates (CA1_6_9I1R12CertificateIndex a)).input +lemma CA1_6_9I1R12P_check : ∀ a : PairSlot, contains (CA1_6_9I1R12Raw a) (CA1_6_9I1R12P a) = true := by + decide +kernel +lemma CA1_6_9I1R12P_sound (a : PairSlot) : + (CA1_6_9I1R12P a).Encloses (CA1_6_9I1R12Value a) := + contains_sound (CA1_6_9I1R12Raw_sound a) (CA1_6_9I1R12P_check a) +def CA1_6_9I1R12Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_6_9I1R12Certificates (CA1_6_9I1R12CertificateIndex a)).output +lemma CA1_6_9I1R12Terms_sound (a : PairSlot) : + (CA1_6_9I1R12Terms a).Encloses (Foundation.entropyTerm (CA1_6_9I1R12Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_6_9I1R12Certificates_valid + (CA1_6_9I1R12CertificateIndex a) (CA1_6_9I1R12P_sound a) +def CA1_6_9I1R12Entropy : Ball := ⟨0, 0⟩ +lemma CA1_6_9I1R12Entropy_sound : CA1_6_9I1R12Entropy.Encloses (Foundation.finiteEntropy CA1_6_9I1R12Value) := by + exact contains_sound (entropyPair_enclosed CA1_6_9I1R12Value CA1_6_9I1R12Terms CA1_6_9I1R12Terms_sound) (by decide +kernel) +def CA1_6_9I1R12Mass : Ball := ⟨0, 0⟩ +lemma CA1_6_9I1R12Mass_sound : CA1_6_9I1R12Mass.Encloses (∑ a, CA1_6_9I1R12Value a) := by + exact contains_sound (pairSumBall_sound CA1_6_9I1R12P CA1_6_9I1R12Value CA1_6_9I1R12P_sound) (by decide +kernel) +def CA1_6_9I1R12MassTerm : Ball := .exact 0 +lemma CA1_6_9I1R12MassTerm_sound : CA1_6_9I1R12MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_6_9I1R12Value a))) := + entropyTerm_zero_ball (CA1_6_9I1R12Mass_sound) +def CA1_6_9I1R12H : Ball := ⟨0, 0⟩ +lemma CA1_6_9I1R12H_sound : CA1_6_9I1R12H.Encloses (homogeneousEntropy CA1_6_9I1R12Value) := by + exact contains_sound (homogeneous_enclosed CA1_6_9I1R12Value CA1_6_9I1R12MassTerm_sound CA1_6_9I1R12Entropy_sound) (by decide +kernel) +def CA1_6_9I1R13Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 6 9)) (fun u => (stageALaw (shape 1 6 9) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 13 a +def CA1_6_9I1R13Raw (a : PairSlot) : Ball := residualBall (below (shape 1 6 9)) A1_6_9Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 13 a +lemma CA1_6_9I1R13Raw_sound (a : PairSlot) : + (CA1_6_9I1R13Raw a).Encloses (CA1_6_9I1R13Value a) := by + exact residualBall_sound_on (below (shape 1 6 9)) A1_6_9Law (fun u => (stageALaw (shape 1 6 9) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A1_6_9Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 6 9) (show (shape 1 6 9) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 13 a +def CA1_6_9I1R13Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA1_6_9I1R13Certificates_valid : + CA1_6_9I1R13Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_6_9I1R13CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA1_6_9I1R13P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_6_9I1R13Certificates (CA1_6_9I1R13CertificateIndex a)).input +lemma CA1_6_9I1R13P_check : ∀ a : PairSlot, contains (CA1_6_9I1R13Raw a) (CA1_6_9I1R13P a) = true := by + decide +kernel +lemma CA1_6_9I1R13P_sound (a : PairSlot) : + (CA1_6_9I1R13P a).Encloses (CA1_6_9I1R13Value a) := + contains_sound (CA1_6_9I1R13Raw_sound a) (CA1_6_9I1R13P_check a) +def CA1_6_9I1R13Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_6_9I1R13Certificates (CA1_6_9I1R13CertificateIndex a)).output +lemma CA1_6_9I1R13Terms_sound (a : PairSlot) : + (CA1_6_9I1R13Terms a).Encloses (Foundation.entropyTerm (CA1_6_9I1R13Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_6_9I1R13Certificates_valid + (CA1_6_9I1R13CertificateIndex a) (CA1_6_9I1R13P_sound a) +def CA1_6_9I1R13Entropy : Ball := ⟨0, 0⟩ +lemma CA1_6_9I1R13Entropy_sound : CA1_6_9I1R13Entropy.Encloses (Foundation.finiteEntropy CA1_6_9I1R13Value) := by + exact contains_sound (entropyPair_enclosed CA1_6_9I1R13Value CA1_6_9I1R13Terms CA1_6_9I1R13Terms_sound) (by decide +kernel) +def CA1_6_9I1R13Mass : Ball := ⟨0, 0⟩ +lemma CA1_6_9I1R13Mass_sound : CA1_6_9I1R13Mass.Encloses (∑ a, CA1_6_9I1R13Value a) := by + exact contains_sound (pairSumBall_sound CA1_6_9I1R13P CA1_6_9I1R13Value CA1_6_9I1R13P_sound) (by decide +kernel) +def CA1_6_9I1R13MassTerm : Ball := .exact 0 +lemma CA1_6_9I1R13MassTerm_sound : CA1_6_9I1R13MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_6_9I1R13Value a))) := + entropyTerm_zero_ball (CA1_6_9I1R13Mass_sound) +def CA1_6_9I1R13H : Ball := ⟨0, 0⟩ +lemma CA1_6_9I1R13H_sound : CA1_6_9I1R13H.Encloses (homogeneousEntropy CA1_6_9I1R13Value) := by + exact contains_sound (homogeneous_enclosed CA1_6_9I1R13Value CA1_6_9I1R13MassTerm_sound CA1_6_9I1R13Entropy_sound) (by decide +kernel) +def CA1_6_9I1R14Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 6 9)) (fun u => (stageALaw (shape 1 6 9) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 14 a +def CA1_6_9I1R14Raw (a : PairSlot) : Ball := residualBall (below (shape 1 6 9)) A1_6_9Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 14 a +lemma CA1_6_9I1R14Raw_sound (a : PairSlot) : + (CA1_6_9I1R14Raw a).Encloses (CA1_6_9I1R14Value a) := by + exact residualBall_sound_on (below (shape 1 6 9)) A1_6_9Law (fun u => (stageALaw (shape 1 6 9) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A1_6_9Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 6 9) (show (shape 1 6 9) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 14 a +def CA1_6_9I1R14Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA1_6_9I1R14Certificates_valid : + CA1_6_9I1R14Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_6_9I1R14CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA1_6_9I1R14P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_6_9I1R14Certificates (CA1_6_9I1R14CertificateIndex a)).input +lemma CA1_6_9I1R14P_check : ∀ a : PairSlot, contains (CA1_6_9I1R14Raw a) (CA1_6_9I1R14P a) = true := by + decide +kernel +lemma CA1_6_9I1R14P_sound (a : PairSlot) : + (CA1_6_9I1R14P a).Encloses (CA1_6_9I1R14Value a) := + contains_sound (CA1_6_9I1R14Raw_sound a) (CA1_6_9I1R14P_check a) +def CA1_6_9I1R14Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_6_9I1R14Certificates (CA1_6_9I1R14CertificateIndex a)).output +lemma CA1_6_9I1R14Terms_sound (a : PairSlot) : + (CA1_6_9I1R14Terms a).Encloses (Foundation.entropyTerm (CA1_6_9I1R14Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_6_9I1R14Certificates_valid + (CA1_6_9I1R14CertificateIndex a) (CA1_6_9I1R14P_sound a) +def CA1_6_9I1R14Entropy : Ball := ⟨0, 0⟩ +lemma CA1_6_9I1R14Entropy_sound : CA1_6_9I1R14Entropy.Encloses (Foundation.finiteEntropy CA1_6_9I1R14Value) := by + exact contains_sound (entropyPair_enclosed CA1_6_9I1R14Value CA1_6_9I1R14Terms CA1_6_9I1R14Terms_sound) (by decide +kernel) +def CA1_6_9I1R14Mass : Ball := ⟨0, 0⟩ +lemma CA1_6_9I1R14Mass_sound : CA1_6_9I1R14Mass.Encloses (∑ a, CA1_6_9I1R14Value a) := by + exact contains_sound (pairSumBall_sound CA1_6_9I1R14P CA1_6_9I1R14Value CA1_6_9I1R14P_sound) (by decide +kernel) +def CA1_6_9I1R14MassTerm : Ball := .exact 0 +lemma CA1_6_9I1R14MassTerm_sound : CA1_6_9I1R14MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_6_9I1R14Value a))) := + entropyTerm_zero_ball (CA1_6_9I1R14Mass_sound) +def CA1_6_9I1R14H : Ball := ⟨0, 0⟩ +lemma CA1_6_9I1R14H_sound : CA1_6_9I1R14H.Encloses (homogeneousEntropy CA1_6_9I1R14Value) := by + exact contains_sound (homogeneous_enclosed CA1_6_9I1R14Value CA1_6_9I1R14MassTerm_sound CA1_6_9I1R14Entropy_sound) (by decide +kernel) +def CA1_6_9I1R15Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 6 9)) (fun u => (stageALaw (shape 1 6 9) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 15 a +def CA1_6_9I1R15Raw (a : PairSlot) : Ball := residualBall (below (shape 1 6 9)) A1_6_9Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 15 a +lemma CA1_6_9I1R15Raw_sound (a : PairSlot) : + (CA1_6_9I1R15Raw a).Encloses (CA1_6_9I1R15Value a) := by + exact residualBall_sound_on (below (shape 1 6 9)) A1_6_9Law (fun u => (stageALaw (shape 1 6 9) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A1_6_9Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 6 9) (show (shape 1 6 9) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 15 a +def CA1_6_9I1R15Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA1_6_9I1R15Certificates_valid : + CA1_6_9I1R15Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_6_9I1R15CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA1_6_9I1R15P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_6_9I1R15Certificates (CA1_6_9I1R15CertificateIndex a)).input +lemma CA1_6_9I1R15P_check : ∀ a : PairSlot, contains (CA1_6_9I1R15Raw a) (CA1_6_9I1R15P a) = true := by + decide +kernel +lemma CA1_6_9I1R15P_sound (a : PairSlot) : + (CA1_6_9I1R15P a).Encloses (CA1_6_9I1R15Value a) := + contains_sound (CA1_6_9I1R15Raw_sound a) (CA1_6_9I1R15P_check a) +def CA1_6_9I1R15Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_6_9I1R15Certificates (CA1_6_9I1R15CertificateIndex a)).output +lemma CA1_6_9I1R15Terms_sound (a : PairSlot) : + (CA1_6_9I1R15Terms a).Encloses (Foundation.entropyTerm (CA1_6_9I1R15Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_6_9I1R15Certificates_valid + (CA1_6_9I1R15CertificateIndex a) (CA1_6_9I1R15P_sound a) +def CA1_6_9I1R15Entropy : Ball := ⟨0, 0⟩ +lemma CA1_6_9I1R15Entropy_sound : CA1_6_9I1R15Entropy.Encloses (Foundation.finiteEntropy CA1_6_9I1R15Value) := by + exact contains_sound (entropyPair_enclosed CA1_6_9I1R15Value CA1_6_9I1R15Terms CA1_6_9I1R15Terms_sound) (by decide +kernel) +def CA1_6_9I1R15Mass : Ball := ⟨0, 0⟩ +lemma CA1_6_9I1R15Mass_sound : CA1_6_9I1R15Mass.Encloses (∑ a, CA1_6_9I1R15Value a) := by + exact contains_sound (pairSumBall_sound CA1_6_9I1R15P CA1_6_9I1R15Value CA1_6_9I1R15P_sound) (by decide +kernel) +def CA1_6_9I1R15MassTerm : Ball := .exact 0 +lemma CA1_6_9I1R15MassTerm_sound : CA1_6_9I1R15MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_6_9I1R15Value a))) := + entropyTerm_zero_ball (CA1_6_9I1R15Mass_sound) +def CA1_6_9I1R15H : Ball := ⟨0, 0⟩ +lemma CA1_6_9I1R15H_sound : CA1_6_9I1R15H.Encloses (homogeneousEntropy CA1_6_9I1R15Value) := by + exact contains_sound (homogeneous_enclosed CA1_6_9I1R15Value CA1_6_9I1R15MassTerm_sound CA1_6_9I1R15Entropy_sound) (by decide +kernel) +def CA1_6_9I1R16Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 6 9)) (fun u => (stageALaw (shape 1 6 9) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 16 a +def CA1_6_9I1R16Raw (a : PairSlot) : Ball := residualBall (below (shape 1 6 9)) A1_6_9Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 16 a +lemma CA1_6_9I1R16Raw_sound (a : PairSlot) : + (CA1_6_9I1R16Raw a).Encloses (CA1_6_9I1R16Value a) := by + exact residualBall_sound_on (below (shape 1 6 9)) A1_6_9Law (fun u => (stageALaw (shape 1 6 9) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A1_6_9Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 6 9) (show (shape 1 6 9) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 16 a +def CA1_6_9I1R16Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA1_6_9I1R16Certificates_valid : + CA1_6_9I1R16Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_6_9I1R16CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA1_6_9I1R16P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_6_9I1R16Certificates (CA1_6_9I1R16CertificateIndex a)).input +lemma CA1_6_9I1R16P_check : ∀ a : PairSlot, contains (CA1_6_9I1R16Raw a) (CA1_6_9I1R16P a) = true := by + decide +kernel +lemma CA1_6_9I1R16P_sound (a : PairSlot) : + (CA1_6_9I1R16P a).Encloses (CA1_6_9I1R16Value a) := + contains_sound (CA1_6_9I1R16Raw_sound a) (CA1_6_9I1R16P_check a) +def CA1_6_9I1R16Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_6_9I1R16Certificates (CA1_6_9I1R16CertificateIndex a)).output +lemma CA1_6_9I1R16Terms_sound (a : PairSlot) : + (CA1_6_9I1R16Terms a).Encloses (Foundation.entropyTerm (CA1_6_9I1R16Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_6_9I1R16Certificates_valid + (CA1_6_9I1R16CertificateIndex a) (CA1_6_9I1R16P_sound a) +def CA1_6_9I1R16Entropy : Ball := ⟨0, 0⟩ +lemma CA1_6_9I1R16Entropy_sound : CA1_6_9I1R16Entropy.Encloses (Foundation.finiteEntropy CA1_6_9I1R16Value) := by + exact contains_sound (entropyPair_enclosed CA1_6_9I1R16Value CA1_6_9I1R16Terms CA1_6_9I1R16Terms_sound) (by decide +kernel) +def CA1_6_9I1R16Mass : Ball := ⟨0, 0⟩ +lemma CA1_6_9I1R16Mass_sound : CA1_6_9I1R16Mass.Encloses (∑ a, CA1_6_9I1R16Value a) := by + exact contains_sound (pairSumBall_sound CA1_6_9I1R16P CA1_6_9I1R16Value CA1_6_9I1R16P_sound) (by decide +kernel) +def CA1_6_9I1R16MassTerm : Ball := .exact 0 +lemma CA1_6_9I1R16MassTerm_sound : CA1_6_9I1R16MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_6_9I1R16Value a))) := + entropyTerm_zero_ball (CA1_6_9I1R16Mass_sound) +def CA1_6_9I1R16H : Ball := ⟨0, 0⟩ +lemma CA1_6_9I1R16H_sound : CA1_6_9I1R16H.Encloses (homogeneousEntropy CA1_6_9I1R16Value) := by + exact contains_sound (homogeneous_enclosed CA1_6_9I1R16Value CA1_6_9I1R16MassTerm_sound CA1_6_9I1R16Entropy_sound) (by decide +kernel) +def CA1_6_9I1ResidualEntropies (a : Fin 17) : Ball := + match a.val with + | 0 => CA1_6_9I1R0H + | 1 => CA1_6_9I1R1H + | 2 => CA1_6_9I1R2H + | 3 => CA1_6_9I1R3H + | 4 => CA1_6_9I1R4H + | 5 => CA1_6_9I1R5H + | 6 => CA1_6_9I1R6H + | 7 => CA1_6_9I1R7H + | 8 => CA1_6_9I1R8H + | 9 => CA1_6_9I1R9H + | 10 => CA1_6_9I1R10H + | 11 => CA1_6_9I1R11H + | 12 => CA1_6_9I1R12H + | 13 => CA1_6_9I1R13H + | 14 => CA1_6_9I1R14H + | 15 => CA1_6_9I1R15H + | 16 => CA1_6_9I1R16H + | _ => (.exact 0) +lemma CA1_6_9I1ResidualEntropies_sound (k : Fin 17) : + (CA1_6_9I1ResidualEntropies k).Encloses (homogeneousEntropy + (residualLaw (below (shape 1 6 9)) (fun u => (stageALaw (shape 1 6 9) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) k)) := by + fin_cases k + · exact CA1_6_9I1R0H_sound + · exact CA1_6_9I1R1H_sound + · exact CA1_6_9I1R2H_sound + · exact CA1_6_9I1R3H_sound + · exact CA1_6_9I1R4H_sound + · exact CA1_6_9I1R5H_sound + · exact CA1_6_9I1R6H_sound + · exact CA1_6_9I1R7H_sound + · exact CA1_6_9I1R8H_sound + · exact CA1_6_9I1R9H_sound + · exact CA1_6_9I1R10H_sound + · exact CA1_6_9I1R11H_sound + · exact CA1_6_9I1R12H_sound + · exact CA1_6_9I1R13H_sound + · exact CA1_6_9I1R14H_sound + · exact CA1_6_9I1R15H_sound + · exact CA1_6_9I1R16H_sound +def CA1_6_9I1Singles (s : Shape) : Ball := + match s 0, s 1, s 2 with + | _, _, _ => (.exact 0) +lemma CA1_6_9I1Singles_sound (u : Shape) (hu : u ∈ below (shape 1 6 9)) + (hd : designated (Equiv.refl (Fin 3)) 1 u) : + (CA1_6_9I1Singles u).Encloses (homogeneousEntropy ((fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) u)) := by + rw [A1_6_9_below] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 0 0 8) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 0 1 7) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 0 2 6) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 0 3 5) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 0 4 4) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 0 5 3) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 0 6 2) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 1 0 7) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 1 1 6) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 1 2 5) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 1 3 4) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 1 4 3) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 1 5 2) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 1 6 1) by decide +kernel) hd |>.elim +def CA1_6_9I1Singleton : Ball := ⟨0, 0⟩ +lemma CA1_6_9I1Singleton_sound : CA1_6_9I1Singleton.Encloses + (singletonEntropy (below (shape 1 6 9)) (fun u => (stageALaw (shape 1 6 9) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ))) := by + exact contains_sound (singletonBall_sound (below (shape 1 6 9)) A1_6_9Law (fun u => (stageALaw (shape 1 6 9) u : ℝ)) (Equiv.refl (Fin 3)) 1 + CA1_6_9I1Singles (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A1_6_9Law_sound u) CA1_6_9I1Singles_sound) (by decide +kernel) +def CA1_6_9I1Group : Ball := ⟨(11228291558488176702000743821487 / 10000000000000000000000000000000), (20913951647 / 12500000000000000000000000000000)⟩ +lemma CA1_6_9I1Group_sound : CA1_6_9I1Group.Encloses + (groupedEntropy (below (shape 1 6 9)) (fun u => (stageALaw (shape 1 6 9) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ))) := by + exact contains_sound (Ball.add_sound CA1_6_9I1Singleton_sound + (finSumBall_sound 17 CA1_6_9I1ResidualEntropies _ CA1_6_9I1ResidualEntropies_sound)) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CA1_6_9I1H : Ball := ⟨(56372479975836900762362253769597 / 50000000000000000000000000000000), (19637771163 / 4000000000000000000000000000000)⟩ +lemma CA1_6_9I1_sound : CA1_6_9I1H.Encloses (stageACapacity (shape 1 6 9) 1) := by + have hb := contains_sound (Ball.add_sound CA1_6_9I1PairH_sound + (Ball.neg_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) CA1_6_9I1Group_sound))) + (show contains (.add CA1_6_9I1PairH (.neg (.mul (.exact 2) CA1_6_9I1Group))) CA1_6_9I1H = true by decide +kernel) + unfold CA1_6_9I1PairValue at hb + simpa only [stageACapacity, nativeCapacity, + show (1 : Fin 3) ≠ 0 by decide, ite_false, sub_eq_add_neg] using hb + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA1_6_9I1Pair.lean b/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA1_6_9I1Pair.lean new file mode 100644 index 0000000000000000000000000000000000000000..7fb9e555c60e1db20000768987538a0b5f134e02 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA1_6_9I1Pair.lean @@ -0,0 +1,324 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Certificates.SupportedContraction + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CA1_6_9I1PairValue (a : PairSlot × PairSlot) : ℝ := pairLaw (below (shape 1 6 9)) (shape 1 6 9) (fun u => (stageALaw (shape 1 6 9) u : ℝ)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) a +def CA1_6_9I1PairRaw (a : PairSlot × PairSlot) : Ball := stageAPairBall (shape 1 6 9) A1_6_9Law 1 a +lemma CA1_6_9I1PairRaw_sound (a : PairSlot × PairSlot) : + (CA1_6_9I1PairRaw a).Encloses (CA1_6_9I1PairValue a) := by + exact stageAPairBall_sound (shape 1 6 9) (by decide +kernel) A1_6_9Law (fun u => (stageALaw (shape 1 6 9) u : ℝ)) (fun u _ => A1_6_9Law_sound u) 1 a +def CA1_6_9I1PairCertificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(441876206744648671114472127 / 4000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ ⟨(100645869110909624952901605809 / 100000000000000000000000000000000), (17544559 / 50000000000000000000000000000000)⟩ ⟨(-911077515147321236108554608474889 / 100000000000000000000000000000000), (317637373349 / 100000000000000000000000000000000)⟩ ⟨-14, 441876206744648671114472127, 244140625000000000000000000⟩, + .log ⟨(657080921971796282931564339 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(27719823945490765311282689673 / 100000000000000000000000000000000), (9461689 / 100000000000000000000000000000000)⟩ ⟨(-131832240037821096251951760685329 / 12500000000000000000000000000000), (179994520329 / 50000000000000000000000000000000)⟩ ⟨-16, 657080921971796282931564339, 381469726562500000000000000⟩, + .log ⟨(94111745008810675585318067 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(1240679906901828064584075781 / 50000000000000000000000000000000), (83703 / 10000000000000000000000000000000)⟩ ⟨(-1318305071046845939950790763193751 / 100000000000000000000000000000000), (222346414313 / 50000000000000000000000000000000)⟩ ⟨-20, 94111745008810675585318067, 47683715820312500000000000⟩, + .log ⟨(31036799123995126073588775049 / 10000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ ⟨(1792426919717737345491904986727 / 100000000000000000000000000000000), (657229807 / 100000000000000000000000000000000)⟩ ⟨(-577516680298381281900907376060233 / 100000000000000000000000000000000), (52939559449 / 25000000000000000000000000000000)⟩ ⟨-9, 31036799123995126073588775049, 19531250000000000000000000000⟩, + .log ⟨(2778136476605944221571551103 / 10000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(227489372302179854034600281019 / 100000000000000000000000000000000), (76478137 / 100000000000000000000000000000000)⟩ ⟨(-40942800006014130005143854813759 / 5000000000000000000000000000000), (137642855739 / 50000000000000000000000000000000)⟩ ⟨-12, 2778136476605944221571551103, 2441406250000000000000000000⟩, + .log ⟨(18501565179107019817172619 / 125000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(65260302091448506302700432411 / 50000000000000000000000000000000), (4388003 / 10000000000000000000000000000000)⟩ ⟨(-881821368350284382934873207105127 / 100000000000000000000000000000000), (296461538317 / 100000000000000000000000000000000)⟩ ⟨-13, 18501565179107019817172619, 15258789062500000000000000⟩, + .log ⟨(87909239679064740202376269349 / 20000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ ⟨(2385497496339457151402690193659 / 100000000000000000000000000000000), (209424443 / 25000000000000000000000000000000)⟩ ⟨(-542718263756649130440773595054797 / 100000000000000000000000000000000), (190582413829 / 100000000000000000000000000000000)⟩ ⟨-8, 87909239679064740202376269349, 78125000000000000000000000000⟩, + .log ⟨(2397841103861224198183981936807 / 100000000000000000000000000000000), (7 / 50000000000000000000000000000000)⟩ ⟨(894538936350652942746544141601 / 10000000000000000000000000000000), (1777169149 / 50000000000000000000000000000000)⟩ ⟨(-373060139352096394253289417342207 / 100000000000000000000000000000000), (37057691591 / 25000000000000000000000000000000)⟩ ⟨-6, 2397841103861224198183981936807, 1562500000000000000000000000000⟩, + .log ⟨(55084917588553862649425208577 / 25000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ ⟨(1347984153750061927306891099159 / 100000000000000000000000000000000), (58323427 / 12500000000000000000000000000000)⟩ ⟨(-19117984853553869366385232630869 / 3125000000000000000000000000000), (211758237737 / 100000000000000000000000000000000)⟩ ⟨-9, 55084917588553862649425208577, 48828125000000000000000000000⟩, + .log ⟨(20759577999412165650052381717 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(176039513637130230288747536003 / 100000000000000000000000000000000), (61544173 / 100000000000000000000000000000000)⟩ ⟨(-423995886723022542215919261641731 / 50000000000000000000000000000000), (296461536379 / 100000000000000000000000000000000)⟩ ⟨-13, 20759577999412165650052381717, 12207031250000000000000000000⟩, + .log ⟨(5941887119991255639030945031 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(57819901562831230535228103283 / 100000000000000000000000000000000), (5032977 / 25000000000000000000000000000000)⟩ ⟨(-243272467127061145794215990352467 / 25000000000000000000000000000000), (338813195757 / 100000000000000000000000000000000)⟩ ⟨-15, 5941887119991255639030945031, 3051757812500000000000000000⟩, + .log ⟨(22978040129733690400522318527 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(353183474154743719903286073019 / 100000000000000000000000000000000), (12651053 / 10000000000000000000000000000000)⟩ ⟨(-768523930153909575193722362133089 / 100000000000000000000000000000000), (55057142011 / 20000000000000000000000000000000)⟩ ⟨-12, 22978040129733690400522318527, 12207031250000000000000000000⟩, + .log ⟨(7638517967839454208914260439 / 3125000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ ⟨(735007037152254525790532510527 / 50000000000000000000000000000000), (258803063 / 50000000000000000000000000000000)⟩ ⟨(-601398596107634736869781960612483 / 100000000000000000000000000000000), (211758237647 / 100000000000000000000000000000000)⟩ ⟨-9, 7638517967839454208914260439, 6103515625000000000000000000⟩, + .log ⟨(11500982753340549434368253601 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(96347709517186786552843229153 / 50000000000000000000000000000000), (68191989 / 100000000000000000000000000000000)⟩ ⟨(-837734579588008240364578866892303 / 100000000000000000000000000000000), (296461535909 / 100000000000000000000000000000000)⟩ ⟨-13, 11500982753340549434368253601, 6103515625000000000000000000⟩, + .log ⟨(2236384514690918206764343199 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(23947350656693576188507800821 / 100000000000000000000000000000000), (8050751 / 100000000000000000000000000000000)⟩ ⟨(-214161299180729161041706543576697 / 20000000000000000000000000000000), (14399561893 / 4000000000000000000000000000000)⟩ ⟨-16, 2236384514690918206764343199, 1525878906250000000000000000⟩, + .log ⟨(635086863187962003560534443 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(190000825639915592944604079 / 2500000000000000000000000000000), (1277613 / 50000000000000000000000000000000)⟩ ⟨(-29917297404982291584739580036251 / 2500000000000000000000000000000), (80468161487 / 20000000000000000000000000000000)⟩ ⟨-18, 635086863187962003560534443, 381469726562500000000000000⟩, + .log ⟨(1645550759964372303342956763939 / 100000000000000000000000000000000), (1 / 12500000000000000000000000000000)⟩ ⟨(6758433379650538845905004137789 / 100000000000000000000000000000000), (1219606267 / 50000000000000000000000000000000)⟩ ⟨(-410709504931763100547790863935819 / 100000000000000000000000000000000), (148230766267 / 100000000000000000000000000000000)⟩ ⟨-6, 1645550759964372303342956763939, 1562500000000000000000000000000⟩, + .log ⟨(4391498038472609372528693892929 / 50000000000000000000000000000000), (37 / 100000000000000000000000000000000)⟩ ⟨(10681671661751321671614349256369 / 50000000000000000000000000000000), (1859871789 / 20000000000000000000000000000000)⟩ ⟨(-12161762988588825866894782910377 / 5000000000000000000000000000000), (26469779709 / 25000000000000000000000000000000)⟩ ⟨-4, 4391498038472609372528693892929, 3125000000000000000000000000000⟩, + .log ⟨(823804361764859503861595460401 / 100000000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ ⟨(988357715388072645073744957439 / 25000000000000000000000000000000), (1395578897 / 100000000000000000000000000000000)⟩ ⟨(-119974809707329761366408847648449 / 25000000000000000000000000000000), (169406589949 / 100000000000000000000000000000000)⟩ ⟨-7, 823804361764859503861595460401, 781250000000000000000000000000⟩, + .log ⟨(39878384659993184498745180899 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(568980313599541517712456220437 / 100000000000000000000000000000000), (202669843 / 100000000000000000000000000000000)⟩ ⟨(-713394384515221184637262973130497 / 100000000000000000000000000000000), (254109885449 / 100000000000000000000000000000000)⟩ ⟨-11, 39878384659993184498745180899, 24414062500000000000000000000⟩, + .log ⟨(5668259952116994413712018063 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(9513322866248222045037957383 / 5000000000000000000000000000000), (67216851 / 100000000000000000000000000000000)⟩ ⟨(-104896861499523819122737507663813 / 12500000000000000000000000000000), (74115383993 / 25000000000000000000000000000000)⟩ ⟨-13, 5668259952116994413712018063, 3051757812500000000000000000⟩, + .log ⟨(2325734267941421170719201531 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(159814190682024003393280260257 / 100000000000000000000000000000000), (5515927 / 10000000000000000000000000000000)⟩ ⟨(-429472405997075849922385931581039 / 50000000000000000000000000000000), (37057692117 / 12500000000000000000000000000000)⟩ ⟨-13, 2325734267941421170719201531, 1525878906250000000000000000⟩, + .log ⟨(462798965777906867780188403881 / 100000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ ⟨(2487837255979488470899503004741 / 100000000000000000000000000000000), (882013457 / 100000000000000000000000000000000)⟩ ⟨(-107512654087190833346588335835551 / 20000000000000000000000000000000), (95291206897 / 50000000000000000000000000000000)⟩ ⟨-8, 462798965777906867780188403881, 390625000000000000000000000000⟩, + .log ⟨(44589878690847598995753768469 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(68805915589264588615596475629 / 20000000000000000000000000000000), (122749573 / 100000000000000000000000000000000)⟩ ⟨(-385770928344034212093159577348853 / 50000000000000000000000000000000), (137642855061 / 50000000000000000000000000000000)⟩ ⟨-12, 44589878690847598995753768469, 24414062500000000000000000000⟩, + .log ⟨(10130496501763004045361752623573 / 100000000000000000000000000000000), (33 / 100000000000000000000000000000000)⟩ ⟨(2899373242597345393296920604419 / 12500000000000000000000000000000), (670380031 / 6250000000000000000000000000000)⟩ ⟨(-228961985592139082996034395848633 / 100000000000000000000000000000000), (5293955937 / 5000000000000000000000000000000)⟩ ⟨-4, 10130496501763004045361752623573, 6250000000000000000000000000000⟩, + .log ⟨(122933322718074998557527270291 / 12500000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ ⟨(2272713481463272385856994160607 / 50000000000000000000000000000000), (833028609 / 50000000000000000000000000000000)⟩ ⟨(-18487367226503129813357539367781 / 4000000000000000000000000000000), (16940658987 / 10000000000000000000000000000000)⟩ ⟨-7, 122933322718074998557527270291, 97656250000000000000000000000⟩, + .log ⟨(1908591051834485317217172211 / 2000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(132733673911115935362865028459 / 20000000000000000000000000000000), (121247967 / 50000000000000000000000000000000)⟩ ⟨(-347726857944597330849319412249363 / 50000000000000000000000000000000), (254109885243 / 100000000000000000000000000000000)⟩ ⟨-11, 1908591051834485317217172211, 976562500000000000000000000⟩] +lemma CA1_6_9I1PairCertificates_valid : + CA1_6_9I1PairCertificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_6_9I1PairCertificateIndex (a : PairSlot × PairSlot) : ℕ := + match a.1.1.val, a.1.2.val, a.2.1.val, a.2.2.val with + | 0, 0, 4, 4 => 1 + | 0, 0, 5, 2 => 2 + | 0, 0, 5, 3 => 3 + | 0, 0, 2, 5 => 2 + | 0, 0, 3, 5 => 3 + | 1, 0, 2, 4 => 4 + | 1, 0, 3, 4 => 5 + | 1, 0, 4, 2 => 4 + | 1, 0, 4, 3 => 5 + | 1, 0, 5, 1 => 6 + | 1, 0, 1, 5 => 6 + | 0, 1, 2, 4 => 4 + | 0, 1, 3, 4 => 5 + | 0, 1, 4, 2 => 4 + | 0, 1, 4, 3 => 5 + | 0, 1, 5, 1 => 6 + | 0, 1, 1, 5 => 6 + | 2, 0, 1, 4 => 7 + | 2, 0, 2, 2 => 8 + | 2, 0, 2, 3 => 9 + | 2, 0, 3, 2 => 9 + | 2, 0, 3, 3 => 10 + | 2, 0, 4, 1 => 7 + | 2, 0, 5, 0 => 11 + | 2, 0, 0, 5 => 11 + | 3, 0, 1, 4 => 12 + | 3, 0, 2, 2 => 13 + | 3, 0, 2, 3 => 14 + | 3, 0, 3, 2 => 14 + | 3, 0, 3, 3 => 15 + | 3, 0, 4, 1 => 12 + | 3, 0, 5, 0 => 16 + | 3, 0, 0, 5 => 16 + | 1, 1, 1, 4 => 17 + | 1, 1, 2, 2 => 18 + | 1, 1, 2, 3 => 19 + | 1, 1, 3, 2 => 19 + | 1, 1, 3, 3 => 20 + | 1, 1, 4, 1 => 17 + | 1, 1, 5, 0 => 21 + | 1, 1, 0, 5 => 21 + | 0, 2, 1, 4 => 7 + | 0, 2, 2, 2 => 8 + | 0, 2, 2, 3 => 9 + | 0, 2, 3, 2 => 9 + | 0, 2, 3, 3 => 10 + | 0, 2, 4, 1 => 7 + | 0, 2, 5, 0 => 11 + | 0, 2, 0, 5 => 11 + | 0, 3, 1, 4 => 12 + | 0, 3, 2, 2 => 13 + | 0, 3, 2, 3 => 14 + | 0, 3, 3, 2 => 14 + | 0, 3, 3, 3 => 15 + | 0, 3, 4, 1 => 12 + | 0, 3, 5, 0 => 16 + | 0, 3, 0, 5 => 16 + | 4, 0, 0, 4 => 22 + | 4, 0, 1, 2 => 23 + | 4, 0, 1, 3 => 24 + | 4, 0, 2, 1 => 23 + | 4, 0, 3, 1 => 24 + | 4, 0, 4, 0 => 22 + | 2, 1, 0, 4 => 23 + | 2, 1, 1, 2 => 25 + | 2, 1, 1, 3 => 26 + | 2, 1, 2, 1 => 25 + | 2, 1, 3, 1 => 26 + | 2, 1, 4, 0 => 23 + | 3, 1, 0, 4 => 24 + | 3, 1, 1, 2 => 26 + | 3, 1, 1, 3 => 27 + | 3, 1, 2, 1 => 26 + | 3, 1, 3, 1 => 27 + | 3, 1, 4, 0 => 24 + | 1, 2, 0, 4 => 23 + | 1, 2, 1, 2 => 25 + | 1, 2, 1, 3 => 26 + | 1, 2, 2, 1 => 25 + | 1, 2, 3, 1 => 26 + | 1, 2, 4, 0 => 23 + | 1, 3, 0, 4 => 24 + | 1, 3, 1, 2 => 26 + | 1, 3, 1, 3 => 27 + | 1, 3, 2, 1 => 26 + | 1, 3, 3, 1 => 27 + | 1, 3, 4, 0 => 24 + | 0, 4, 0, 4 => 22 + | 0, 4, 1, 2 => 23 + | 0, 4, 1, 3 => 24 + | 0, 4, 2, 1 => 23 + | 0, 4, 3, 1 => 24 + | 0, 4, 4, 0 => 22 + | 0, 5, 0, 2 => 11 + | 0, 5, 0, 3 => 16 + | 0, 5, 1, 1 => 21 + | 0, 5, 2, 0 => 11 + | 0, 5, 3, 0 => 16 + | 1, 4, 0, 2 => 7 + | 1, 4, 0, 3 => 12 + | 1, 4, 1, 1 => 17 + | 1, 4, 2, 0 => 7 + | 1, 4, 3, 0 => 12 + | 2, 2, 0, 2 => 8 + | 2, 2, 0, 3 => 13 + | 2, 2, 1, 1 => 18 + | 2, 2, 2, 0 => 8 + | 2, 2, 3, 0 => 13 + | 2, 3, 0, 2 => 9 + | 2, 3, 0, 3 => 14 + | 2, 3, 1, 1 => 19 + | 2, 3, 2, 0 => 9 + | 2, 3, 3, 0 => 14 + | 3, 2, 0, 2 => 9 + | 3, 2, 0, 3 => 14 + | 3, 2, 1, 1 => 19 + | 3, 2, 2, 0 => 9 + | 3, 2, 3, 0 => 14 + | 3, 3, 0, 2 => 10 + | 3, 3, 0, 3 => 15 + | 3, 3, 1, 1 => 20 + | 3, 3, 2, 0 => 10 + | 3, 3, 3, 0 => 15 + | 4, 1, 0, 2 => 7 + | 4, 1, 0, 3 => 12 + | 4, 1, 1, 1 => 17 + | 4, 1, 2, 0 => 7 + | 4, 1, 3, 0 => 12 + | 5, 0, 0, 2 => 11 + | 5, 0, 0, 3 => 16 + | 5, 0, 1, 1 => 21 + | 5, 0, 2, 0 => 11 + | 5, 0, 3, 0 => 16 + | 1, 5, 0, 1 => 6 + | 1, 5, 1, 0 => 6 + | 2, 4, 0, 1 => 4 + | 2, 4, 1, 0 => 4 + | 3, 4, 0, 1 => 5 + | 3, 4, 1, 0 => 5 + | 4, 2, 0, 1 => 4 + | 4, 2, 1, 0 => 4 + | 4, 3, 0, 1 => 5 + | 4, 3, 1, 0 => 5 + | 5, 1, 0, 1 => 6 + | 5, 1, 1, 0 => 6 + | 2, 5, 0, 0 => 2 + | 3, 5, 0, 0 => 3 + | 4, 4, 0, 0 => 1 + | 5, 2, 0, 0 => 2 + | 5, 3, 0, 0 => 3 + | _, _, _, _ => 0 +def CA1_6_9I1PairP (a : PairSlot × PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_6_9I1PairCertificates (CA1_6_9I1PairCertificateIndex a)).input +lemma CA1_6_9I1PairP_check_0_0 : ∀ k l : Fin 6, contains (CA1_6_9I1PairRaw ((0,0),(k,l))) (CA1_6_9I1PairP ((0,0),(k,l))) = true := by + decide +kernel +lemma CA1_6_9I1PairP_check_0_1 : ∀ k l : Fin 6, contains (CA1_6_9I1PairRaw ((0,1),(k,l))) (CA1_6_9I1PairP ((0,1),(k,l))) = true := by + decide +kernel +lemma CA1_6_9I1PairP_check_0_2 : ∀ k l : Fin 6, contains (CA1_6_9I1PairRaw ((0,2),(k,l))) (CA1_6_9I1PairP ((0,2),(k,l))) = true := by + decide +kernel +lemma CA1_6_9I1PairP_check_0_3 : ∀ k l : Fin 6, contains (CA1_6_9I1PairRaw ((0,3),(k,l))) (CA1_6_9I1PairP ((0,3),(k,l))) = true := by + decide +kernel +lemma CA1_6_9I1PairP_check_0_4 : ∀ k l : Fin 6, contains (CA1_6_9I1PairRaw ((0,4),(k,l))) (CA1_6_9I1PairP ((0,4),(k,l))) = true := by + decide +kernel +lemma CA1_6_9I1PairP_check_0_5 : ∀ k l : Fin 6, contains (CA1_6_9I1PairRaw ((0,5),(k,l))) (CA1_6_9I1PairP ((0,5),(k,l))) = true := by + decide +kernel +lemma CA1_6_9I1PairP_check_1_0 : ∀ k l : Fin 6, contains (CA1_6_9I1PairRaw ((1,0),(k,l))) (CA1_6_9I1PairP ((1,0),(k,l))) = true := by + decide +kernel +lemma CA1_6_9I1PairP_check_1_1 : ∀ k l : Fin 6, contains (CA1_6_9I1PairRaw ((1,1),(k,l))) (CA1_6_9I1PairP ((1,1),(k,l))) = true := by + decide +kernel +lemma CA1_6_9I1PairP_check_1_2 : ∀ k l : Fin 6, contains (CA1_6_9I1PairRaw ((1,2),(k,l))) (CA1_6_9I1PairP ((1,2),(k,l))) = true := by + decide +kernel +lemma CA1_6_9I1PairP_check_1_3 : ∀ k l : Fin 6, contains (CA1_6_9I1PairRaw ((1,3),(k,l))) (CA1_6_9I1PairP ((1,3),(k,l))) = true := by + decide +kernel +lemma CA1_6_9I1PairP_check_1_4 : ∀ k l : Fin 6, contains (CA1_6_9I1PairRaw ((1,4),(k,l))) (CA1_6_9I1PairP ((1,4),(k,l))) = true := by + decide +kernel +lemma CA1_6_9I1PairP_check_1_5 : ∀ k l : Fin 6, contains (CA1_6_9I1PairRaw ((1,5),(k,l))) (CA1_6_9I1PairP ((1,5),(k,l))) = true := by + decide +kernel +lemma CA1_6_9I1PairP_check_2_0 : ∀ k l : Fin 6, contains (CA1_6_9I1PairRaw ((2,0),(k,l))) (CA1_6_9I1PairP ((2,0),(k,l))) = true := by + decide +kernel +lemma CA1_6_9I1PairP_check_2_1 : ∀ k l : Fin 6, contains (CA1_6_9I1PairRaw ((2,1),(k,l))) (CA1_6_9I1PairP ((2,1),(k,l))) = true := by + decide +kernel +lemma CA1_6_9I1PairP_check_2_2 : ∀ k l : Fin 6, contains (CA1_6_9I1PairRaw ((2,2),(k,l))) (CA1_6_9I1PairP ((2,2),(k,l))) = true := by + decide +kernel +lemma CA1_6_9I1PairP_check_2_3 : ∀ k l : Fin 6, contains (CA1_6_9I1PairRaw ((2,3),(k,l))) (CA1_6_9I1PairP ((2,3),(k,l))) = true := by + decide +kernel +lemma CA1_6_9I1PairP_check_2_4 : ∀ k l : Fin 6, contains (CA1_6_9I1PairRaw ((2,4),(k,l))) (CA1_6_9I1PairP ((2,4),(k,l))) = true := by + decide +kernel +lemma CA1_6_9I1PairP_check_2_5 : ∀ k l : Fin 6, contains (CA1_6_9I1PairRaw ((2,5),(k,l))) (CA1_6_9I1PairP ((2,5),(k,l))) = true := by + decide +kernel +lemma CA1_6_9I1PairP_check_3_0 : ∀ k l : Fin 6, contains (CA1_6_9I1PairRaw ((3,0),(k,l))) (CA1_6_9I1PairP ((3,0),(k,l))) = true := by + decide +kernel +lemma CA1_6_9I1PairP_check_3_1 : ∀ k l : Fin 6, contains (CA1_6_9I1PairRaw ((3,1),(k,l))) (CA1_6_9I1PairP ((3,1),(k,l))) = true := by + decide +kernel +lemma CA1_6_9I1PairP_check_3_2 : ∀ k l : Fin 6, contains (CA1_6_9I1PairRaw ((3,2),(k,l))) (CA1_6_9I1PairP ((3,2),(k,l))) = true := by + decide +kernel +lemma CA1_6_9I1PairP_check_3_3 : ∀ k l : Fin 6, contains (CA1_6_9I1PairRaw ((3,3),(k,l))) (CA1_6_9I1PairP ((3,3),(k,l))) = true := by + decide +kernel +lemma CA1_6_9I1PairP_check_3_4 : ∀ k l : Fin 6, contains (CA1_6_9I1PairRaw ((3,4),(k,l))) (CA1_6_9I1PairP ((3,4),(k,l))) = true := by + decide +kernel +lemma CA1_6_9I1PairP_check_3_5 : ∀ k l : Fin 6, contains (CA1_6_9I1PairRaw ((3,5),(k,l))) (CA1_6_9I1PairP ((3,5),(k,l))) = true := by + decide +kernel +lemma CA1_6_9I1PairP_check_4_0 : ∀ k l : Fin 6, contains (CA1_6_9I1PairRaw ((4,0),(k,l))) (CA1_6_9I1PairP ((4,0),(k,l))) = true := by + decide +kernel +lemma CA1_6_9I1PairP_check_4_1 : ∀ k l : Fin 6, contains (CA1_6_9I1PairRaw ((4,1),(k,l))) (CA1_6_9I1PairP ((4,1),(k,l))) = true := by + decide +kernel +lemma CA1_6_9I1PairP_check_4_2 : ∀ k l : Fin 6, contains (CA1_6_9I1PairRaw ((4,2),(k,l))) (CA1_6_9I1PairP ((4,2),(k,l))) = true := by + decide +kernel +lemma CA1_6_9I1PairP_check_4_3 : ∀ k l : Fin 6, contains (CA1_6_9I1PairRaw ((4,3),(k,l))) (CA1_6_9I1PairP ((4,3),(k,l))) = true := by + decide +kernel +lemma CA1_6_9I1PairP_check_4_4 : ∀ k l : Fin 6, contains (CA1_6_9I1PairRaw ((4,4),(k,l))) (CA1_6_9I1PairP ((4,4),(k,l))) = true := by + decide +kernel +lemma CA1_6_9I1PairP_check_4_5 : ∀ k l : Fin 6, contains (CA1_6_9I1PairRaw ((4,5),(k,l))) (CA1_6_9I1PairP ((4,5),(k,l))) = true := by + decide +kernel +lemma CA1_6_9I1PairP_check_5_0 : ∀ k l : Fin 6, contains (CA1_6_9I1PairRaw ((5,0),(k,l))) (CA1_6_9I1PairP ((5,0),(k,l))) = true := by + decide +kernel +lemma CA1_6_9I1PairP_check_5_1 : ∀ k l : Fin 6, contains (CA1_6_9I1PairRaw ((5,1),(k,l))) (CA1_6_9I1PairP ((5,1),(k,l))) = true := by + decide +kernel +lemma CA1_6_9I1PairP_check_5_2 : ∀ k l : Fin 6, contains (CA1_6_9I1PairRaw ((5,2),(k,l))) (CA1_6_9I1PairP ((5,2),(k,l))) = true := by + decide +kernel +lemma CA1_6_9I1PairP_check_5_3 : ∀ k l : Fin 6, contains (CA1_6_9I1PairRaw ((5,3),(k,l))) (CA1_6_9I1PairP ((5,3),(k,l))) = true := by + decide +kernel +lemma CA1_6_9I1PairP_check_5_4 : ∀ k l : Fin 6, contains (CA1_6_9I1PairRaw ((5,4),(k,l))) (CA1_6_9I1PairP ((5,4),(k,l))) = true := by + decide +kernel +lemma CA1_6_9I1PairP_check_5_5 : ∀ k l : Fin 6, contains (CA1_6_9I1PairRaw ((5,5),(k,l))) (CA1_6_9I1PairP ((5,5),(k,l))) = true := by + decide +kernel +lemma CA1_6_9I1PairP_check (a : PairSlot × PairSlot) : contains (CA1_6_9I1PairRaw a) (CA1_6_9I1PairP a) = true := by + rcases a with ⟨⟨i,j⟩,⟨k,l⟩⟩ + revert j i + apply forall_fin6 + · exact forall_fin6 (CA1_6_9I1PairP_check_0_0 k l) (CA1_6_9I1PairP_check_0_1 k l) (CA1_6_9I1PairP_check_0_2 k l) (CA1_6_9I1PairP_check_0_3 k l) (CA1_6_9I1PairP_check_0_4 k l) (CA1_6_9I1PairP_check_0_5 k l) + · exact forall_fin6 (CA1_6_9I1PairP_check_1_0 k l) (CA1_6_9I1PairP_check_1_1 k l) (CA1_6_9I1PairP_check_1_2 k l) (CA1_6_9I1PairP_check_1_3 k l) (CA1_6_9I1PairP_check_1_4 k l) (CA1_6_9I1PairP_check_1_5 k l) + · exact forall_fin6 (CA1_6_9I1PairP_check_2_0 k l) (CA1_6_9I1PairP_check_2_1 k l) (CA1_6_9I1PairP_check_2_2 k l) (CA1_6_9I1PairP_check_2_3 k l) (CA1_6_9I1PairP_check_2_4 k l) (CA1_6_9I1PairP_check_2_5 k l) + · exact forall_fin6 (CA1_6_9I1PairP_check_3_0 k l) (CA1_6_9I1PairP_check_3_1 k l) (CA1_6_9I1PairP_check_3_2 k l) (CA1_6_9I1PairP_check_3_3 k l) (CA1_6_9I1PairP_check_3_4 k l) (CA1_6_9I1PairP_check_3_5 k l) + · exact forall_fin6 (CA1_6_9I1PairP_check_4_0 k l) (CA1_6_9I1PairP_check_4_1 k l) (CA1_6_9I1PairP_check_4_2 k l) (CA1_6_9I1PairP_check_4_3 k l) (CA1_6_9I1PairP_check_4_4 k l) (CA1_6_9I1PairP_check_4_5 k l) + · exact forall_fin6 (CA1_6_9I1PairP_check_5_0 k l) (CA1_6_9I1PairP_check_5_1 k l) (CA1_6_9I1PairP_check_5_2 k l) (CA1_6_9I1PairP_check_5_3 k l) (CA1_6_9I1PairP_check_5_4 k l) (CA1_6_9I1PairP_check_5_5 k l) +lemma CA1_6_9I1PairP_sound (a : PairSlot × PairSlot) : + (CA1_6_9I1PairP a).Encloses (CA1_6_9I1PairValue a) := + contains_sound (CA1_6_9I1PairRaw_sound a) (CA1_6_9I1PairP_check a) +def CA1_6_9I1PairTerms (a : PairSlot × PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_6_9I1PairCertificates (CA1_6_9I1PairCertificateIndex a)).output +lemma CA1_6_9I1PairTerms_sound (a : PairSlot × PairSlot) : + (CA1_6_9I1PairTerms a).Encloses (Foundation.entropyTerm (CA1_6_9I1PairValue a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_6_9I1PairCertificates_valid + (CA1_6_9I1PairCertificateIndex a) (CA1_6_9I1PairP_sound a) +def CA1_6_9I1PairEntropy : Ball := ⟨(10540962222544916736398105749029 / 3125000000000000000000000000000), (4223288391 / 3125000000000000000000000000000)⟩ +lemma CA1_6_9I1PairEntropy_sound : CA1_6_9I1PairEntropy.Encloses (Foundation.finiteEntropy CA1_6_9I1PairValue) := by + exact contains_sound (entropyDoublePair_enclosed CA1_6_9I1PairValue CA1_6_9I1PairTerms CA1_6_9I1PairTerms_sound) (by decide +kernel) +def CA1_6_9I1PairMass : Ball := ⟨(50000000000000000000000000000003 / 50000000000000000000000000000000), (33 / 6250000000000000000000000000000)⟩ +lemma CA1_6_9I1PairMass_sound : CA1_6_9I1PairMass.Encloses (∑ a, CA1_6_9I1PairValue a) := by + exact contains_sound (doublePairSumBall_sound CA1_6_9I1PairP CA1_6_9I1PairValue CA1_6_9I1PairP_sound) (by decide +kernel) +def CA1_6_9I1PairMassTermLogWitness : LogWitness := ⟨0, 50000000000000000000000000000003, 50000000000000000000000000000000⟩ +def CA1_6_9I1PairMassTermLog : Ball := ⟨(3 / 50000000000000000000000000000000), (2117582421 / 10000000000000000000000000000000)⟩ +lemma CA1_6_9I1PairMassTermLog_sound : CA1_6_9I1PairMassTermLog.Encloses (Real.log ((∑ a, CA1_6_9I1PairValue a))) := by + exact checkLog_sound logTwoBall_sound (CA1_6_9I1PairMass_sound) (w := CA1_6_9I1PairMassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA1_6_9I1PairMassTerm : Ball := ⟨(-3 / 50000000000000000000000000000000), (21175824211 / 100000000000000000000000000000000)⟩ +lemma CA1_6_9I1PairMassTerm_sound : CA1_6_9I1PairMassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_6_9I1PairValue a))) := by + exact contains_sound (entropyTerm_ball (CA1_6_9I1PairMass_sound) CA1_6_9I1PairMassTermLog_sound) (by decide +kernel) +def CA1_6_9I1PairH : Ball := ⟨(168655395560718667782369691984467 / 50000000000000000000000000000000), (156321052723 / 100000000000000000000000000000000)⟩ +lemma CA1_6_9I1PairH_sound : CA1_6_9I1PairH.Encloses (homogeneousEntropy CA1_6_9I1PairValue) := by + exact contains_sound (homogeneous_enclosed CA1_6_9I1PairValue CA1_6_9I1PairMassTerm_sound CA1_6_9I1PairEntropy_sound) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA1_6_9I2.lean b/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA1_6_9I2.lean new file mode 100644 index 0000000000000000000000000000000000000000..84acad842941209aba62a9b88b86cde1b0dc5481 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA1_6_9I2.lean @@ -0,0 +1,848 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.CapacityA.CapA1_6_9I2Pair + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CA1_6_9I2R0Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 6 9)) (fun u => (stageALaw (shape 1 6 9) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 0 a +def CA1_6_9I2R0Raw (a : PairSlot) : Ball := residualBall (below (shape 1 6 9)) A1_6_9Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 0 a +lemma CA1_6_9I2R0Raw_sound (a : PairSlot) : + (CA1_6_9I2R0Raw a).Encloses (CA1_6_9I2R0Value a) := by + exact residualBall_sound_on (below (shape 1 6 9)) A1_6_9Law (fun u => (stageALaw (shape 1 6 9) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A1_6_9Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 6 9) (show (shape 1 6 9) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 0 a +def CA1_6_9I2R0Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA1_6_9I2R0Certificates_valid : + CA1_6_9I2R0Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_6_9I2R0CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA1_6_9I2R0P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_6_9I2R0Certificates (CA1_6_9I2R0CertificateIndex a)).input +lemma CA1_6_9I2R0P_check : ∀ a : PairSlot, contains (CA1_6_9I2R0Raw a) (CA1_6_9I2R0P a) = true := by + decide +kernel +lemma CA1_6_9I2R0P_sound (a : PairSlot) : + (CA1_6_9I2R0P a).Encloses (CA1_6_9I2R0Value a) := + contains_sound (CA1_6_9I2R0Raw_sound a) (CA1_6_9I2R0P_check a) +def CA1_6_9I2R0Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_6_9I2R0Certificates (CA1_6_9I2R0CertificateIndex a)).output +lemma CA1_6_9I2R0Terms_sound (a : PairSlot) : + (CA1_6_9I2R0Terms a).Encloses (Foundation.entropyTerm (CA1_6_9I2R0Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_6_9I2R0Certificates_valid + (CA1_6_9I2R0CertificateIndex a) (CA1_6_9I2R0P_sound a) +def CA1_6_9I2R0Entropy : Ball := ⟨0, 0⟩ +lemma CA1_6_9I2R0Entropy_sound : CA1_6_9I2R0Entropy.Encloses (Foundation.finiteEntropy CA1_6_9I2R0Value) := by + exact contains_sound (entropyPair_enclosed CA1_6_9I2R0Value CA1_6_9I2R0Terms CA1_6_9I2R0Terms_sound) (by decide +kernel) +def CA1_6_9I2R0Mass : Ball := ⟨0, 0⟩ +lemma CA1_6_9I2R0Mass_sound : CA1_6_9I2R0Mass.Encloses (∑ a, CA1_6_9I2R0Value a) := by + exact contains_sound (pairSumBall_sound CA1_6_9I2R0P CA1_6_9I2R0Value CA1_6_9I2R0P_sound) (by decide +kernel) +def CA1_6_9I2R0MassTerm : Ball := .exact 0 +lemma CA1_6_9I2R0MassTerm_sound : CA1_6_9I2R0MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_6_9I2R0Value a))) := + entropyTerm_zero_ball (CA1_6_9I2R0Mass_sound) +def CA1_6_9I2R0H : Ball := ⟨0, 0⟩ +lemma CA1_6_9I2R0H_sound : CA1_6_9I2R0H.Encloses (homogeneousEntropy CA1_6_9I2R0Value) := by + exact contains_sound (homogeneous_enclosed CA1_6_9I2R0Value CA1_6_9I2R0MassTerm_sound CA1_6_9I2R0Entropy_sound) (by decide +kernel) +def CA1_6_9I2R1Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 6 9)) (fun u => (stageALaw (shape 1 6 9) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 1 a +def CA1_6_9I2R1Raw (a : PairSlot) : Ball := residualBall (below (shape 1 6 9)) A1_6_9Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 1 a +lemma CA1_6_9I2R1Raw_sound (a : PairSlot) : + (CA1_6_9I2R1Raw a).Encloses (CA1_6_9I2R1Value a) := by + exact residualBall_sound_on (below (shape 1 6 9)) A1_6_9Law (fun u => (stageALaw (shape 1 6 9) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A1_6_9Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 6 9) (show (shape 1 6 9) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 1 a +def CA1_6_9I2R1Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(15382325296305947711052937 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(175988165289010751885124581 / 20000000000000000000000000000000), (286661 / 100000000000000000000000000000000)⟩ ⟨(-715058362028310178292855577849303 / 50000000000000000000000000000000), (465869746267 / 100000000000000000000000000000000)⟩ ⟨-21, 15382325296305947711052937, 11920928955078125000000000⟩] +lemma CA1_6_9I2R1Certificates_valid : + CA1_6_9I2R1Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_6_9I2R1CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 1, 0 => 1 + | 0, 1 => 1 + | _, _ => 0 +def CA1_6_9I2R1P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_6_9I2R1Certificates (CA1_6_9I2R1CertificateIndex a)).input +lemma CA1_6_9I2R1P_check : ∀ a : PairSlot, contains (CA1_6_9I2R1Raw a) (CA1_6_9I2R1P a) = true := by + decide +kernel +lemma CA1_6_9I2R1P_sound (a : PairSlot) : + (CA1_6_9I2R1P a).Encloses (CA1_6_9I2R1Value a) := + contains_sound (CA1_6_9I2R1Raw_sound a) (CA1_6_9I2R1P_check a) +def CA1_6_9I2R1Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_6_9I2R1Certificates (CA1_6_9I2R1CertificateIndex a)).output +lemma CA1_6_9I2R1Terms_sound (a : PairSlot) : + (CA1_6_9I2R1Terms a).Encloses (Foundation.entropyTerm (CA1_6_9I2R1Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_6_9I2R1Certificates_valid + (CA1_6_9I2R1CertificateIndex a) (CA1_6_9I2R1P_sound a) +def CA1_6_9I2R1Entropy : Ball := ⟨(175988165289010751885124581 / 10000000000000000000000000000000), (286661 / 50000000000000000000000000000000)⟩ +lemma CA1_6_9I2R1Entropy_sound : CA1_6_9I2R1Entropy.Encloses (Foundation.finiteEntropy CA1_6_9I2R1Value) := by + exact contains_sound (entropyPair_enclosed CA1_6_9I2R1Value CA1_6_9I2R1Terms CA1_6_9I2R1Terms_sound) (by decide +kernel) +def CA1_6_9I2R1Mass : Ball := ⟨(15382325296305947711052937 / 12500000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ +lemma CA1_6_9I2R1Mass_sound : CA1_6_9I2R1Mass.Encloses (∑ a, CA1_6_9I2R1Value a) := by + exact contains_sound (pairSumBall_sound CA1_6_9I2R1P CA1_6_9I2R1Value CA1_6_9I2R1P_sound) (by decide +kernel) +def CA1_6_9I2R1MassTermLogWitness : LogWitness := ⟨-20, 15382325296305947711052937, 11920928955078125000000000⟩ +def CA1_6_9I2R1MassTermLog : Ball := ⟨(-340200501500156456410996990662069 / 25000000000000000000000000000000), (55586740323 / 12500000000000000000000000000000)⟩ +lemma CA1_6_9I2R1MassTermLog_sound : CA1_6_9I2R1MassTermLog.Encloses (Real.log ((∑ a, CA1_6_9I2R1Value a))) := by + exact checkLog_sound logTwoBall_sound (CA1_6_9I2R1Mass_sound) (w := CA1_6_9I2R1MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA1_6_9I2R1MassTerm : Ball := ⟨(1674583929613384375085323043 / 100000000000000000000000000000000), (273631 / 50000000000000000000000000000000)⟩ +lemma CA1_6_9I2R1MassTerm_sound : CA1_6_9I2R1MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_6_9I2R1Value a))) := by + exact contains_sound (entropyTerm_ball (CA1_6_9I2R1Mass_sound) CA1_6_9I2R1MassTermLog_sound) (by decide +kernel) +def CA1_6_9I2R1H : Ball := ⟨(85297723276723143765922767 / 100000000000000000000000000000000), (140073 / 12500000000000000000000000000000)⟩ +lemma CA1_6_9I2R1H_sound : CA1_6_9I2R1H.Encloses (homogeneousEntropy CA1_6_9I2R1Value) := by + exact contains_sound (homogeneous_enclosed CA1_6_9I2R1Value CA1_6_9I2R1MassTerm_sound CA1_6_9I2R1Entropy_sound) (by decide +kernel) +def CA1_6_9I2R2Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 6 9)) (fun u => (stageALaw (shape 1 6 9) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 2 a +def CA1_6_9I2R2Raw (a : PairSlot) : Ball := residualBall (below (shape 1 6 9)) A1_6_9Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 2 a +lemma CA1_6_9I2R2Raw_sound (a : PairSlot) : + (CA1_6_9I2R2Raw a).Encloses (CA1_6_9I2R2Value a) := by + exact residualBall_sound_on (below (shape 1 6 9)) A1_6_9Law (fun u => (stageALaw (shape 1 6 9) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A1_6_9Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 6 9) (show (shape 1 6 9) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 2 a +def CA1_6_9I2R2Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(1967664415920849334251689419 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(9077465887398263442569774983 / 10000000000000000000000000000000), (31250197 / 100000000000000000000000000000000)⟩ ⟨(-230666007220293473135349718557659 / 25000000000000000000000000000000), (317637365409 / 100000000000000000000000000000000)⟩ ⟨-14, 1967664415920849334251689419, 1220703125000000000000000000⟩, + .log ⟨(236563311141533721982429851 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(1677385714010515046244526493 / 12500000000000000000000000000000), (2254247 / 50000000000000000000000000000000)⟩ ⟨(-28362567397561494462781291018621 / 2500000000000000000000000000000), (381164910837 / 100000000000000000000000000000000)⟩ ⟨-17, 236563311141533721982429851, 152587890625000000000000000⟩, + .log ⟨(37536856304181027501326567191 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(148037894805379859615916769287 / 50000000000000000000000000000000), (10333361 / 10000000000000000000000000000000)⟩ ⟨(-394380108994078757733136660996807 / 50000000000000000000000000000000), (275285710543 / 100000000000000000000000000000000)⟩ ⟨-12, 37536856304181027501326567191, 24414062500000000000000000000⟩] +lemma CA1_6_9I2R2Certificates_valid : + CA1_6_9I2R2Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_6_9I2R2CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 2, 0 => 1 + | 3, 0 => 2 + | 1, 1 => 3 + | 0, 2 => 1 + | 0, 3 => 2 + | _, _ => 0 +def CA1_6_9I2R2P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_6_9I2R2Certificates (CA1_6_9I2R2CertificateIndex a)).input +lemma CA1_6_9I2R2P_check : ∀ a : PairSlot, contains (CA1_6_9I2R2Raw a) (CA1_6_9I2R2P a) = true := by + decide +kernel +lemma CA1_6_9I2R2P_sound (a : PairSlot) : + (CA1_6_9I2R2P a).Encloses (CA1_6_9I2R2Value a) := + contains_sound (CA1_6_9I2R2Raw_sound a) (CA1_6_9I2R2P_check a) +def CA1_6_9I2R2Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_6_9I2R2Certificates (CA1_6_9I2R2CertificateIndex a)).output +lemma CA1_6_9I2R2Terms_sound (a : PairSlot) : + (CA1_6_9I2R2Terms a).Encloses (Foundation.entropyTerm (CA1_6_9I2R2Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_6_9I2R2Certificates_valid + (CA1_6_9I2R2CertificateIndex a) (CA1_6_9I2R2P_sound a) +def CA1_6_9I2R2Entropy : Ball := ⟨(252231639391446614411570731061 / 50000000000000000000000000000000), (10928187 / 6250000000000000000000000000000)⟩ +lemma CA1_6_9I2R2Entropy_sound : CA1_6_9I2R2Entropy.Encloses (Foundation.finiteEntropy CA1_6_9I2R2Value) := by + exact contains_sound (entropyPair_enclosed CA1_6_9I2R2Value CA1_6_9I2R2Terms CA1_6_9I2R2Terms_sound) (by decide +kernel) +def CA1_6_9I2R2Mass : Ball := ⟨(59579133574804858063667759891 / 100000000000000000000000000000000), (1 / 20000000000000000000000000000000)⟩ +lemma CA1_6_9I2R2Mass_sound : CA1_6_9I2R2Mass.Encloses (∑ a, CA1_6_9I2R2Value a) := by + exact contains_sound (pairSumBall_sound CA1_6_9I2R2P CA1_6_9I2R2Value CA1_6_9I2R2P_sound) (by decide +kernel) +def CA1_6_9I2R2MassTermLogWitness : LogWitness := ⟨-11, 59579133574804858063667759891, 48828125000000000000000000000⟩ +def CA1_6_9I2R2MassTermLog : Ball := ⟨(-742562006000625825643988134828249 / 100000000000000000000000000000000), (254109892587 / 100000000000000000000000000000000)⟩ +lemma CA1_6_9I2R2MassTermLog_sound : CA1_6_9I2R2MassTermLog.Encloses (Real.log ((∑ a, CA1_6_9I2R2Value a))) := by + exact checkLog_sound logTwoBall_sound (CA1_6_9I2R2Mass_sound) (w := CA1_6_9I2R2MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA1_6_9I2R2MassTerm : Ball := ⟨(22120600471543166305970057429 / 5000000000000000000000000000000), (15139651 / 10000000000000000000000000000000)⟩ +lemma CA1_6_9I2R2MassTerm_sound : CA1_6_9I2R2MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_6_9I2R2Value a))) := by + exact contains_sound (entropyTerm_ball (CA1_6_9I2R2Mass_sound) CA1_6_9I2R2MassTermLog_sound) (by decide +kernel) +def CA1_6_9I2R2H : Ball := ⟨(31025634676014951351870156771 / 50000000000000000000000000000000), (163123751 / 50000000000000000000000000000000)⟩ +lemma CA1_6_9I2R2H_sound : CA1_6_9I2R2H.Encloses (homogeneousEntropy CA1_6_9I2R2Value) := by + exact contains_sound (homogeneous_enclosed CA1_6_9I2R2Value CA1_6_9I2R2MassTerm_sound CA1_6_9I2R2Entropy_sound) (by decide +kernel) +def CA1_6_9I2R3Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 6 9)) (fun u => (stageALaw (shape 1 6 9) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 3 a +def CA1_6_9I2R3Raw (a : PairSlot) : Ball := residualBall (below (shape 1 6 9)) A1_6_9Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 3 a +lemma CA1_6_9I2R3Raw_sound (a : PairSlot) : + (CA1_6_9I2R3Raw a).Encloses (CA1_6_9I2R3Value a) := by + exact residualBall_sound_on (below (shape 1 6 9)) A1_6_9Law (fun u => (stageALaw (shape 1 6 9) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A1_6_9Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 6 9) (show (shape 1 6 9) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 3 a +def CA1_6_9I2R3Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(47639572620445901729347554581 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(45550944730904560016893522953 / 12500000000000000000000000000000), (8196559 / 6250000000000000000000000000000)⟩ ⟨(-382463084577337735485603822228969 / 50000000000000000000000000000000), (137642854989 / 50000000000000000000000000000000)⟩ ⟨-12, 47639572620445901729347554581, 24414062500000000000000000000⟩, + .log ⟨(404985042186294983709925891827 / 25000000000000000000000000000000), (7 / 100000000000000000000000000000000)⟩ ⟨(3339329250362934946673635828707 / 50000000000000000000000000000000), (1200624877 / 50000000000000000000000000000000)⟩ ⟨(-103069524257479493504067476311811 / 25000000000000000000000000000000), (37057691553 / 25000000000000000000000000000000)⟩ ⟨-6, 404985042186294983709925891827, 390625000000000000000000000000⟩, + .log ⟨(78457363860611206788924191831 / 50000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ ⟨(15831771560782973034392613207 / 1562500000000000000000000000000), (365507863 / 100000000000000000000000000000000)⟩ ⟨(-645722294270706890661498213531627 / 100000000000000000000000000000000), (232934061787 / 100000000000000000000000000000000)⟩ ⟨-10, 78457363860611206788924191831, 48828125000000000000000000000⟩] +lemma CA1_6_9I2R3Certificates_valid : + CA1_6_9I2R3Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_6_9I2R3CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 4, 0 => 1 + | 2, 1 => 2 + | 3, 1 => 3 + | 1, 2 => 2 + | 1, 3 => 3 + | 0, 4 => 1 + | _, _ => 0 +def CA1_6_9I2R3P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_6_9I2R3Certificates (CA1_6_9I2R3CertificateIndex a)).input +lemma CA1_6_9I2R3P_check : ∀ a : PairSlot, contains (CA1_6_9I2R3Raw a) (CA1_6_9I2R3P a) = true := by + decide +kernel +lemma CA1_6_9I2R3P_sound (a : PairSlot) : + (CA1_6_9I2R3P a).Encloses (CA1_6_9I2R3Value a) := + contains_sound (CA1_6_9I2R3Raw_sound a) (CA1_6_9I2R3P_check a) +def CA1_6_9I2R3Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_6_9I2R3Certificates (CA1_6_9I2R3CertificateIndex a)).output +lemma CA1_6_9I2R3Terms_sound (a : PairSlot) : + (CA1_6_9I2R3Terms a).Encloses (Foundation.entropyTerm (CA1_6_9I2R3Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_6_9I2R3Certificates_valid + (CA1_6_9I2R3CertificateIndex a) (CA1_6_9I2R3P_sound a) +def CA1_6_9I2R3Entropy : Ball := ⟨(4028149719231608323841773543143 / 25000000000000000000000000000000), (2897902561 / 50000000000000000000000000000000)⟩ +lemma CA1_6_9I2R3Entropy_sound : CA1_6_9I2R3Entropy.Encloses (Foundation.finiteEntropy CA1_6_9I2R3Value) := by + exact contains_sound (entropyPair_enclosed CA1_6_9I2R3Value CA1_6_9I2R3Terms CA1_6_9I2R3Terms_sound) (by decide +kernel) +def CA1_6_9I2R3Mass : Ball := ⟨(1824494469086848250146899505551 / 50000000000000000000000000000000), (1 / 5000000000000000000000000000000)⟩ +lemma CA1_6_9I2R3Mass_sound : CA1_6_9I2R3Mass.Encloses (∑ a, CA1_6_9I2R3Value a) := by + exact contains_sound (pairSumBall_sound CA1_6_9I2R3P CA1_6_9I2R3Value CA1_6_9I2R3P_sound) (by decide +kernel) +def CA1_6_9I2R3MassTermLogWitness : LogWitness := ⟨-5, 1824494469086848250146899505551, 1562500000000000000000000000000⟩ +def CA1_6_9I2R3MassTermLog : Ball := ⟨(-165536003000312912821994124701353 / 50000000000000000000000000000000), (25410988529 / 20000000000000000000000000000000)⟩ +lemma CA1_6_9I2R3MassTermLog_sound : CA1_6_9I2R3MassTermLog.Encloses (Real.log ((∑ a, CA1_6_9I2R3Value a))) := by + exact checkLog_sound logTwoBall_sound (CA1_6_9I2R3Mass_sound) (w := CA1_6_9I2R3MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA1_6_9I2R3MassTerm : Ball := ⟨(1208078087635259307639586179963 / 10000000000000000000000000000000), (463622087 / 10000000000000000000000000000000)⟩ +lemma CA1_6_9I2R3MassTerm_sound : CA1_6_9I2R3MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_6_9I2R3Value a))) := by + exact contains_sound (entropyTerm_ball (CA1_6_9I2R3Mass_sound) CA1_6_9I2R3MassTermLog_sound) (by decide +kernel) +def CA1_6_9I2R3H : Ball := ⟨(2015909000286920109485616186471 / 50000000000000000000000000000000), (1304003249 / 12500000000000000000000000000000)⟩ +lemma CA1_6_9I2R3H_sound : CA1_6_9I2R3H.Encloses (homogeneousEntropy CA1_6_9I2R3Value) := by + exact contains_sound (homogeneous_enclosed CA1_6_9I2R3Value CA1_6_9I2R3MassTerm_sound CA1_6_9I2R3Entropy_sound) (by decide +kernel) +def CA1_6_9I2R4Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 6 9)) (fun u => (stageALaw (shape 1 6 9) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 4 a +def CA1_6_9I2R4Raw (a : PairSlot) : Ball := residualBall (below (shape 1 6 9)) A1_6_9Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 4 a +lemma CA1_6_9I2R4Raw_sound (a : PairSlot) : + (CA1_6_9I2R4Raw a).Encloses (CA1_6_9I2R4Value a) := by + exact residualBall_sound_on (below (shape 1 6 9)) A1_6_9Law (fun u => (stageALaw (shape 1 6 9) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A1_6_9Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 6 9) (show (shape 1 6 9) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 4 a +def CA1_6_9I2R4Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(2430534116665658559357617653 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(48278512173544068138928239363 / 100000000000000000000000000000000), (257343 / 1562500000000000000000000000000)⟩ ⟨(-993166725011356917556399735208013 / 100000000000000000000000000000000), (338813199499 / 100000000000000000000000000000000)⟩ ⟨-15, 2430534116665658559357617653, 1525878906250000000000000000⟩, + .log ⟨(962949217498128365494858418103 / 50000000000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ ⟨(3803435256577646695635444709003 / 50000000000000000000000000000000), (2854774029 / 100000000000000000000000000000000)⟩ ⟨(-197488880382471427455807499445087 / 50000000000000000000000000000000), (37057691523 / 25000000000000000000000000000000)⟩ ⟨-6, 962949217498128365494858418103, 781250000000000000000000000000⟩, + .log ⟨(4093220773158589283453798912321 / 20000000000000000000000000000000), (21 / 100000000000000000000000000000000)⟩ ⟨(32467430003058226294756699721411 / 100000000000000000000000000000000), (4333866083 / 25000000000000000000000000000000)⟩ ⟨(-39660003457380450449429580641009 / 25000000000000000000000000000000), (42351647417 / 50000000000000000000000000000000)⟩ ⟨-3, 4093220773158589283453798912321, 2500000000000000000000000000000⟩, + .log ⟨(1061167029337240682905698619983 / 100000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ ⟨(2411927025093196302256514455281 / 50000000000000000000000000000000), (359537377 / 20000000000000000000000000000000)⟩ ⟨(-227290045620771148198607657163703 / 50000000000000000000000000000000), (42351647413 / 25000000000000000000000000000000)⟩ ⟨-7, 1061167029337240682905698619983, 781250000000000000000000000000⟩, + .log ⟨(1264315461666651412057543429 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(13383092011192096452737170241 / 50000000000000000000000000000000), (4551403 / 50000000000000000000000000000000)⟩ ⟨(-211704948914413794328644497200899 / 20000000000000000000000000000000), (179994521079 / 50000000000000000000000000000000)⟩ ⟨-16, 1264315461666651412057543429, 762939453125000000000000000⟩] +lemma CA1_6_9I2R4Certificates_valid : + CA1_6_9I2R4Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_6_9I2R4CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 5, 0 => 1 + | 4, 1 => 2 + | 2, 2 => 3 + | 2, 3 => 4 + | 3, 2 => 4 + | 3, 3 => 5 + | 1, 4 => 2 + | 0, 5 => 1 + | _, _ => 0 +def CA1_6_9I2R4P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_6_9I2R4Certificates (CA1_6_9I2R4CertificateIndex a)).input +lemma CA1_6_9I2R4P_check : ∀ a : PairSlot, contains (CA1_6_9I2R4Raw a) (CA1_6_9I2R4P a) = true := by + decide +kernel +lemma CA1_6_9I2R4P_sound (a : PairSlot) : + (CA1_6_9I2R4P a).Encloses (CA1_6_9I2R4Value a) := + contains_sound (CA1_6_9I2R4Raw_sound a) (CA1_6_9I2R4P_check a) +def CA1_6_9I2R4Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_6_9I2R4Certificates (CA1_6_9I2R4CertificateIndex a)).output +lemma CA1_6_9I2R4Terms_sound (a : PairSlot) : + (CA1_6_9I2R4Terms a).Encloses (Foundation.entropyTerm (CA1_6_9I2R4Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_6_9I2R4Certificates_valid + (CA1_6_9I2R4CertificateIndex a) (CA1_6_9I2R4P_sound a) +def CA1_6_9I2R4Entropy : Ball := ⟨(11490440467622214123101573439551 / 20000000000000000000000000000000), (2668242887 / 10000000000000000000000000000000)⟩ +lemma CA1_6_9I2R4Entropy_sound : CA1_6_9I2R4Entropy.Encloses (Foundation.finiteEntropy CA1_6_9I2R4Value) := by + exact contains_sound (entropyPair_enclosed CA1_6_9I2R4Value CA1_6_9I2R4Terms CA1_6_9I2R4Terms_sound) (by decide +kernel) +def CA1_6_9I2R4Mass : Ball := ⟨(26452485561849937182121371031453 / 100000000000000000000000000000000), (1 / 2500000000000000000000000000000)⟩ +lemma CA1_6_9I2R4Mass_sound : CA1_6_9I2R4Mass.Encloses (∑ a, CA1_6_9I2R4Value a) := by + exact contains_sound (pairSumBall_sound CA1_6_9I2R4P CA1_6_9I2R4Value CA1_6_9I2R4P_sound) (by decide +kernel) +def CA1_6_9I2R4MassTermLogWitness : LogWitness := ⟨-2, 26452485561849937182121371031453, 25000000000000000000000000000000⟩ +def CA1_6_9I2R4MassTermLog : Ball := ⟨(-132982006000625825643988306689287 / 100000000000000000000000000000000), (79409339 / 125000000000000000000000000000)⟩ +lemma CA1_6_9I2R4MassTermLog_sound : CA1_6_9I2R4MassTermLog.Encloses (Real.log ((∑ a, CA1_6_9I2R4Value a))) := by + exact checkLog_sound logTwoBall_sound (CA1_6_9I2R4Mass_sound) (w := CA1_6_9I2R4MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA1_6_9I2R4MassTerm : Ball := ⟨(7035409187434792722528646753737 / 20000000000000000000000000000000), (16804595201 / 100000000000000000000000000000000)⟩ +lemma CA1_6_9I2R4MassTerm_sound : CA1_6_9I2R4MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_6_9I2R4Value a))) := by + exact contains_sound (entropyTerm_ball (CA1_6_9I2R4Mass_sound) CA1_6_9I2R4MassTermLog_sound) (by decide +kernel) +def CA1_6_9I2R4H : Ball := ⟨(2227515640093710700286463342907 / 10000000000000000000000000000000), (43487024071 / 100000000000000000000000000000000)⟩ +lemma CA1_6_9I2R4H_sound : CA1_6_9I2R4H.Encloses (homogeneousEntropy CA1_6_9I2R4Value) := by + exact contains_sound (homogeneous_enclosed CA1_6_9I2R4Value CA1_6_9I2R4MassTerm_sound CA1_6_9I2R4Entropy_sound) (by decide +kernel) +def CA1_6_9I2R5Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 6 9)) (fun u => (stageALaw (shape 1 6 9) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 5 a +def CA1_6_9I2R5Raw (a : PairSlot) : Ball := residualBall (below (shape 1 6 9)) A1_6_9Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 5 a +lemma CA1_6_9I2R5Raw_sound (a : PairSlot) : + (CA1_6_9I2R5Raw a).Encloses (CA1_6_9I2R5Value a) := by + exact residualBall_sound_on (below (shape 1 6 9)) A1_6_9Law (fun u => (stageALaw (shape 1 6 9) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A1_6_9Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 6 9) (show (shape 1 6 9) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 5 a +def CA1_6_9I2R5Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(5230646719901306559878843 / 39062500000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(119421215364038691133498363387 / 100000000000000000000000000000000), (992439 / 2500000000000000000000000000000)⟩ ⟨(-178367665604676125594917184952803 / 20000000000000000000000000000000), (296461539029 / 100000000000000000000000000000000)⟩ ⟨-13, 5230646719901306559878843, 4768371582031250000000000⟩, + .log ⟨(4446714786534358028185757328621 / 50000000000000000000000000000000), (13 / 50000000000000000000000000000000)⟩ ⟨(10760415824659170996692001674603 / 50000000000000000000000000000000), (4708142459 / 50000000000000000000000000000000)⟩ ⟨(-241985743210787991177003382232591 / 100000000000000000000000000000000), (105879118707 / 100000000000000000000000000000000)⟩ ⟨-4, 4446714786534358028185757328621, 3125000000000000000000000000000⟩, + .log ⟨(82050376313928551286274993721 / 25000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ ⟨(938541057060807284277361877919 / 50000000000000000000000000000000), (138998747 / 20000000000000000000000000000000)⟩ ⟨(-71491221249088608811744699231191 / 12500000000000000000000000000000), (211758237439 / 100000000000000000000000000000000)⟩ ⟨-9, 82050376313928551286274993721, 48828125000000000000000000000⟩] +lemma CA1_6_9I2R5Certificates_valid : + CA1_6_9I2R5Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_6_9I2R5CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 5, 1 => 1 + | 4, 2 => 2 + | 4, 3 => 3 + | 2, 4 => 2 + | 3, 4 => 3 + | 1, 5 => 1 + | _, _ => 0 +def CA1_6_9I2R5P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_6_9I2R5Certificates (CA1_6_9I2R5CertificateIndex a)).input +lemma CA1_6_9I2R5P_check : ∀ a : PairSlot, contains (CA1_6_9I2R5Raw a) (CA1_6_9I2R5P a) = true := by + decide +kernel +lemma CA1_6_9I2R5P_sound (a : PairSlot) : + (CA1_6_9I2R5P a).Encloses (CA1_6_9I2R5Value a) := + contains_sound (CA1_6_9I2R5Raw_sound a) (CA1_6_9I2R5P_check a) +def CA1_6_9I2R5Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_6_9I2R5Certificates (CA1_6_9I2R5CertificateIndex a)).output +lemma CA1_6_9I2R5Terms_sound (a : PairSlot) : + (CA1_6_9I2R5Terms a).Encloses (Foundation.entropyTerm (CA1_6_9I2R5Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_6_9I2R5Certificates_valid + (CA1_6_9I2R5CertificateIndex a) (CA1_6_9I2R5P_sound a) +def CA1_6_9I2R5Entropy : Ball := ⟨(23517334978803995253072225468431 / 50000000000000000000000000000000), (10150976213 / 50000000000000000000000000000000)⟩ +lemma CA1_6_9I2R5Entropy_sound : CA1_6_9I2R5Entropy.Encloses (Foundation.finiteEntropy CA1_6_9I2R5Value) := by + exact contains_sound (entropyPair_enclosed CA1_6_9I2R5Value CA1_6_9I2R5Terms CA1_6_9I2R5Terms_sound) (by decide +kernel) +def CA1_6_9I2R5Mass : Ball := ⟨(4617510766963688803154952235103 / 25000000000000000000000000000000), (29 / 50000000000000000000000000000000)⟩ +lemma CA1_6_9I2R5Mass_sound : CA1_6_9I2R5Mass.Encloses (∑ a, CA1_6_9I2R5Value a) := by + exact contains_sound (pairSumBall_sound CA1_6_9I2R5P CA1_6_9I2R5Value CA1_6_9I2R5P_sound) (by decide +kernel) +def CA1_6_9I2R5MassTermLogWitness : LogWitness := ⟨-3, 4617510766963688803154952235103, 3125000000000000000000000000000⟩ +def CA1_6_9I2R5MassTermLog : Ball := ⟨(-42225501500156456410997071898441 / 25000000000000000000000000000000), (16940659009 / 20000000000000000000000000000000)⟩ +lemma CA1_6_9I2R5MassTermLog_sound : CA1_6_9I2R5MassTermLog.Encloses (Real.log ((∑ a, CA1_6_9I2R5Value a))) := by + exact checkLog_sound logTwoBall_sound (CA1_6_9I2R5Mass_sound) (w := CA1_6_9I2R5MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA1_6_9I2R5MassTerm : Ball := ⟨(31196273250786212986478738546041 / 100000000000000000000000000000000), (15644735173 / 100000000000000000000000000000000)⟩ +lemma CA1_6_9I2R5MassTerm_sound : CA1_6_9I2R5MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_6_9I2R5Value a))) := by + exact contains_sound (entropyTerm_ball (CA1_6_9I2R5Mass_sound) CA1_6_9I2R5MassTermLog_sound) (by decide +kernel) +def CA1_6_9I2R5H : Ball := ⟨(15838396706821777519665712390821 / 100000000000000000000000000000000), (35946687599 / 100000000000000000000000000000000)⟩ +lemma CA1_6_9I2R5H_sound : CA1_6_9I2R5H.Encloses (homogeneousEntropy CA1_6_9I2R5Value) := by + exact contains_sound (homogeneous_enclosed CA1_6_9I2R5Value CA1_6_9I2R5MassTerm_sound CA1_6_9I2R5Entropy_sound) (by decide +kernel) +def CA1_6_9I2R6Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 6 9)) (fun u => (stageALaw (shape 1 6 9) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 6 a +def CA1_6_9I2R6Raw (a : PairSlot) : Ball := residualBall (below (shape 1 6 9)) A1_6_9Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 6 a +lemma CA1_6_9I2R6Raw_sound (a : PairSlot) : + (CA1_6_9I2R6Raw a).Encloses (CA1_6_9I2R6Value a) := by + exact residualBall_sound_on (below (shape 1 6 9)) A1_6_9Law (fun u => (stageALaw (shape 1 6 9) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A1_6_9Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 6 9) (show (shape 1 6 9) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 6 a +def CA1_6_9I2R6Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(6327170418027537211250852597 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(28392940486801011288001427499 / 25000000000000000000000000000000), (37515263 / 100000000000000000000000000000000)⟩ ⟨(-179498503191272437656422737403447 / 20000000000000000000000000000000), (37057692433 / 12500000000000000000000000000000)⟩ ⟨-13, 6327170418027537211250852597, 6103515625000000000000000000⟩, + .log ⟨(398636850457313655069073 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(7433476221723436291366273 / 50000000000000000000000000000000), (1187 / 25000000000000000000000000000000)⟩ ⟨(-932361899457588997304740056174253 / 50000000000000000000000000000000), (148262122641 / 25000000000000000000000000000000)⟩ ⟨-27, 398636850457313655069073, 372529029846191406250000⟩, + .log ⟨(1326913022802868439058073980313 / 100000000000000000000000000000000), (7 / 100000000000000000000000000000000)⟩ ⟨(89614625494726809618503117817 / 1562500000000000000000000000000), (449575627 / 20000000000000000000000000000000)⟩ ⟨(-432231497701909322046546714671963 / 100000000000000000000000000000000), (169406589991 / 100000000000000000000000000000000)⟩ ⟨-7, 1326913022802868439058073980313, 781250000000000000000000000000⟩] +lemma CA1_6_9I2R6Certificates_valid : + CA1_6_9I2R6Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_6_9I2R6CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 5, 2 => 1 + | 5, 3 => 2 + | 4, 4 => 3 + | 2, 5 => 1 + | 3, 5 => 2 + | _, _ => 0 +def CA1_6_9I2R6P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_6_9I2R6Certificates (CA1_6_9I2R6CertificateIndex a)).input +lemma CA1_6_9I2R6P_check : ∀ a : PairSlot, contains (CA1_6_9I2R6Raw a) (CA1_6_9I2R6P a) = true := by + decide +kernel +lemma CA1_6_9I2R6P_sound (a : PairSlot) : + (CA1_6_9I2R6P a).Encloses (CA1_6_9I2R6Value a) := + contains_sound (CA1_6_9I2R6Raw_sound a) (CA1_6_9I2R6P_check a) +def CA1_6_9I2R6Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_6_9I2R6Certificates (CA1_6_9I2R6CertificateIndex a)).output +lemma CA1_6_9I2R6Terms_sound (a : PairSlot) : + (CA1_6_9I2R6Terms a).Encloses (Foundation.entropyTerm (CA1_6_9I2R6Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_6_9I2R6Certificates_valid + (CA1_6_9I2R6CertificateIndex a) (CA1_6_9I2R6P_sound a) +def CA1_6_9I2R6Entropy : Ball := ⟨(1490627322365452699908344106343 / 25000000000000000000000000000000), (2322918157 / 100000000000000000000000000000000)⟩ +lemma CA1_6_9I2R6Entropy_sound : CA1_6_9I2R6Entropy.Encloses (Foundation.finiteEntropy CA1_6_9I2R6Value) := by + exact contains_sound (entropyPair_enclosed CA1_6_9I2R6Value CA1_6_9I2R6Terms CA1_6_9I2R6Terms_sound) (by decide +kernel) +def CA1_6_9I2R6Mass : Ball := ⟨(1352223299022380417157697666993 / 100000000000000000000000000000000), (11 / 100000000000000000000000000000000)⟩ +lemma CA1_6_9I2R6Mass_sound : CA1_6_9I2R6Mass.Encloses (∑ a, CA1_6_9I2R6Value a) := by + exact contains_sound (pairSumBall_sound CA1_6_9I2R6P CA1_6_9I2R6Value CA1_6_9I2R6P_sound) (by decide +kernel) +def CA1_6_9I2R6MassTermLogWitness : LogWitness := ⟨-7, 1352223299022380417157697666993, 781250000000000000000000000000⟩ +def CA1_6_9I2R6MassTermLog : Ball := ⟨(-430342006000625825643988211212169 / 100000000000000000000000000000000), (169406590277 / 100000000000000000000000000000000)⟩ +lemma CA1_6_9I2R6MassTermLog_sound : CA1_6_9I2R6MassTermLog.Encloses (Real.log ((∑ a, CA1_6_9I2R6Value a))) := by + exact checkLog_sound logTwoBall_sound (CA1_6_9I2R6Mass_sound) (w := CA1_6_9I2R6MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA1_6_9I2R6MassTerm : Ball := ⟨(5819184870620752836316869770767 / 100000000000000000000000000000000), (286344429 / 12500000000000000000000000000000)⟩ +lemma CA1_6_9I2R6MassTerm_sound : CA1_6_9I2R6MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_6_9I2R6Value a))) := by + exact contains_sound (entropyTerm_ball (CA1_6_9I2R6Mass_sound) CA1_6_9I2R6MassTermLog_sound) (by decide +kernel) +def CA1_6_9I2R6H : Ball := ⟨(28664883768211592663301330921 / 20000000000000000000000000000000), (4613673589 / 100000000000000000000000000000000)⟩ +lemma CA1_6_9I2R6H_sound : CA1_6_9I2R6H.Encloses (homogeneousEntropy CA1_6_9I2R6Value) := by + exact contains_sound (homogeneous_enclosed CA1_6_9I2R6Value CA1_6_9I2R6MassTerm_sound CA1_6_9I2R6Entropy_sound) (by decide +kernel) +def CA1_6_9I2R7Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 6 9)) (fun u => (stageALaw (shape 1 6 9) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 7 a +def CA1_6_9I2R7Raw (a : PairSlot) : Ball := residualBall (below (shape 1 6 9)) A1_6_9Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 7 a +lemma CA1_6_9I2R7Raw_sound (a : PairSlot) : + (CA1_6_9I2R7Raw a).Encloses (CA1_6_9I2R7Value a) := by + exact residualBall_sound_on (below (shape 1 6 9)) A1_6_9Law (fun u => (stageALaw (shape 1 6 9) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A1_6_9Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 6 9) (show (shape 1 6 9) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 7 a +def CA1_6_9I2R7Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA1_6_9I2R7Certificates_valid : + CA1_6_9I2R7Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_6_9I2R7CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA1_6_9I2R7P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_6_9I2R7Certificates (CA1_6_9I2R7CertificateIndex a)).input +lemma CA1_6_9I2R7P_check : ∀ a : PairSlot, contains (CA1_6_9I2R7Raw a) (CA1_6_9I2R7P a) = true := by + decide +kernel +lemma CA1_6_9I2R7P_sound (a : PairSlot) : + (CA1_6_9I2R7P a).Encloses (CA1_6_9I2R7Value a) := + contains_sound (CA1_6_9I2R7Raw_sound a) (CA1_6_9I2R7P_check a) +def CA1_6_9I2R7Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_6_9I2R7Certificates (CA1_6_9I2R7CertificateIndex a)).output +lemma CA1_6_9I2R7Terms_sound (a : PairSlot) : + (CA1_6_9I2R7Terms a).Encloses (Foundation.entropyTerm (CA1_6_9I2R7Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_6_9I2R7Certificates_valid + (CA1_6_9I2R7CertificateIndex a) (CA1_6_9I2R7P_sound a) +def CA1_6_9I2R7Entropy : Ball := ⟨0, 0⟩ +lemma CA1_6_9I2R7Entropy_sound : CA1_6_9I2R7Entropy.Encloses (Foundation.finiteEntropy CA1_6_9I2R7Value) := by + exact contains_sound (entropyPair_enclosed CA1_6_9I2R7Value CA1_6_9I2R7Terms CA1_6_9I2R7Terms_sound) (by decide +kernel) +def CA1_6_9I2R7Mass : Ball := ⟨0, 0⟩ +lemma CA1_6_9I2R7Mass_sound : CA1_6_9I2R7Mass.Encloses (∑ a, CA1_6_9I2R7Value a) := by + exact contains_sound (pairSumBall_sound CA1_6_9I2R7P CA1_6_9I2R7Value CA1_6_9I2R7P_sound) (by decide +kernel) +def CA1_6_9I2R7MassTerm : Ball := .exact 0 +lemma CA1_6_9I2R7MassTerm_sound : CA1_6_9I2R7MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_6_9I2R7Value a))) := + entropyTerm_zero_ball (CA1_6_9I2R7Mass_sound) +def CA1_6_9I2R7H : Ball := ⟨0, 0⟩ +lemma CA1_6_9I2R7H_sound : CA1_6_9I2R7H.Encloses (homogeneousEntropy CA1_6_9I2R7Value) := by + exact contains_sound (homogeneous_enclosed CA1_6_9I2R7Value CA1_6_9I2R7MassTerm_sound CA1_6_9I2R7Entropy_sound) (by decide +kernel) +def CA1_6_9I2R8Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 6 9)) (fun u => (stageALaw (shape 1 6 9) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 8 a +def CA1_6_9I2R8Raw (a : PairSlot) : Ball := residualBall (below (shape 1 6 9)) A1_6_9Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 8 a +lemma CA1_6_9I2R8Raw_sound (a : PairSlot) : + (CA1_6_9I2R8Raw a).Encloses (CA1_6_9I2R8Value a) := by + exact residualBall_sound_on (below (shape 1 6 9)) A1_6_9Law (fun u => (stageALaw (shape 1 6 9) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A1_6_9Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 6 9) (show (shape 1 6 9) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 8 a +def CA1_6_9I2R8Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA1_6_9I2R8Certificates_valid : + CA1_6_9I2R8Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_6_9I2R8CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA1_6_9I2R8P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_6_9I2R8Certificates (CA1_6_9I2R8CertificateIndex a)).input +lemma CA1_6_9I2R8P_check : ∀ a : PairSlot, contains (CA1_6_9I2R8Raw a) (CA1_6_9I2R8P a) = true := by + decide +kernel +lemma CA1_6_9I2R8P_sound (a : PairSlot) : + (CA1_6_9I2R8P a).Encloses (CA1_6_9I2R8Value a) := + contains_sound (CA1_6_9I2R8Raw_sound a) (CA1_6_9I2R8P_check a) +def CA1_6_9I2R8Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_6_9I2R8Certificates (CA1_6_9I2R8CertificateIndex a)).output +lemma CA1_6_9I2R8Terms_sound (a : PairSlot) : + (CA1_6_9I2R8Terms a).Encloses (Foundation.entropyTerm (CA1_6_9I2R8Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_6_9I2R8Certificates_valid + (CA1_6_9I2R8CertificateIndex a) (CA1_6_9I2R8P_sound a) +def CA1_6_9I2R8Entropy : Ball := ⟨0, 0⟩ +lemma CA1_6_9I2R8Entropy_sound : CA1_6_9I2R8Entropy.Encloses (Foundation.finiteEntropy CA1_6_9I2R8Value) := by + exact contains_sound (entropyPair_enclosed CA1_6_9I2R8Value CA1_6_9I2R8Terms CA1_6_9I2R8Terms_sound) (by decide +kernel) +def CA1_6_9I2R8Mass : Ball := ⟨0, 0⟩ +lemma CA1_6_9I2R8Mass_sound : CA1_6_9I2R8Mass.Encloses (∑ a, CA1_6_9I2R8Value a) := by + exact contains_sound (pairSumBall_sound CA1_6_9I2R8P CA1_6_9I2R8Value CA1_6_9I2R8P_sound) (by decide +kernel) +def CA1_6_9I2R8MassTerm : Ball := .exact 0 +lemma CA1_6_9I2R8MassTerm_sound : CA1_6_9I2R8MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_6_9I2R8Value a))) := + entropyTerm_zero_ball (CA1_6_9I2R8Mass_sound) +def CA1_6_9I2R8H : Ball := ⟨0, 0⟩ +lemma CA1_6_9I2R8H_sound : CA1_6_9I2R8H.Encloses (homogeneousEntropy CA1_6_9I2R8Value) := by + exact contains_sound (homogeneous_enclosed CA1_6_9I2R8Value CA1_6_9I2R8MassTerm_sound CA1_6_9I2R8Entropy_sound) (by decide +kernel) +def CA1_6_9I2R9Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 6 9)) (fun u => (stageALaw (shape 1 6 9) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 9 a +def CA1_6_9I2R9Raw (a : PairSlot) : Ball := residualBall (below (shape 1 6 9)) A1_6_9Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 9 a +lemma CA1_6_9I2R9Raw_sound (a : PairSlot) : + (CA1_6_9I2R9Raw a).Encloses (CA1_6_9I2R9Value a) := by + exact residualBall_sound_on (below (shape 1 6 9)) A1_6_9Law (fun u => (stageALaw (shape 1 6 9) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A1_6_9Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 6 9) (show (shape 1 6 9) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 9 a +def CA1_6_9I2R9Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA1_6_9I2R9Certificates_valid : + CA1_6_9I2R9Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_6_9I2R9CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA1_6_9I2R9P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_6_9I2R9Certificates (CA1_6_9I2R9CertificateIndex a)).input +lemma CA1_6_9I2R9P_check : ∀ a : PairSlot, contains (CA1_6_9I2R9Raw a) (CA1_6_9I2R9P a) = true := by + decide +kernel +lemma CA1_6_9I2R9P_sound (a : PairSlot) : + (CA1_6_9I2R9P a).Encloses (CA1_6_9I2R9Value a) := + contains_sound (CA1_6_9I2R9Raw_sound a) (CA1_6_9I2R9P_check a) +def CA1_6_9I2R9Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_6_9I2R9Certificates (CA1_6_9I2R9CertificateIndex a)).output +lemma CA1_6_9I2R9Terms_sound (a : PairSlot) : + (CA1_6_9I2R9Terms a).Encloses (Foundation.entropyTerm (CA1_6_9I2R9Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_6_9I2R9Certificates_valid + (CA1_6_9I2R9CertificateIndex a) (CA1_6_9I2R9P_sound a) +def CA1_6_9I2R9Entropy : Ball := ⟨0, 0⟩ +lemma CA1_6_9I2R9Entropy_sound : CA1_6_9I2R9Entropy.Encloses (Foundation.finiteEntropy CA1_6_9I2R9Value) := by + exact contains_sound (entropyPair_enclosed CA1_6_9I2R9Value CA1_6_9I2R9Terms CA1_6_9I2R9Terms_sound) (by decide +kernel) +def CA1_6_9I2R9Mass : Ball := ⟨0, 0⟩ +lemma CA1_6_9I2R9Mass_sound : CA1_6_9I2R9Mass.Encloses (∑ a, CA1_6_9I2R9Value a) := by + exact contains_sound (pairSumBall_sound CA1_6_9I2R9P CA1_6_9I2R9Value CA1_6_9I2R9P_sound) (by decide +kernel) +def CA1_6_9I2R9MassTerm : Ball := .exact 0 +lemma CA1_6_9I2R9MassTerm_sound : CA1_6_9I2R9MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_6_9I2R9Value a))) := + entropyTerm_zero_ball (CA1_6_9I2R9Mass_sound) +def CA1_6_9I2R9H : Ball := ⟨0, 0⟩ +lemma CA1_6_9I2R9H_sound : CA1_6_9I2R9H.Encloses (homogeneousEntropy CA1_6_9I2R9Value) := by + exact contains_sound (homogeneous_enclosed CA1_6_9I2R9Value CA1_6_9I2R9MassTerm_sound CA1_6_9I2R9Entropy_sound) (by decide +kernel) +def CA1_6_9I2R10Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 6 9)) (fun u => (stageALaw (shape 1 6 9) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 10 a +def CA1_6_9I2R10Raw (a : PairSlot) : Ball := residualBall (below (shape 1 6 9)) A1_6_9Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 10 a +lemma CA1_6_9I2R10Raw_sound (a : PairSlot) : + (CA1_6_9I2R10Raw a).Encloses (CA1_6_9I2R10Value a) := by + exact residualBall_sound_on (below (shape 1 6 9)) A1_6_9Law (fun u => (stageALaw (shape 1 6 9) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A1_6_9Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 6 9) (show (shape 1 6 9) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 10 a +def CA1_6_9I2R10Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA1_6_9I2R10Certificates_valid : + CA1_6_9I2R10Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_6_9I2R10CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA1_6_9I2R10P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_6_9I2R10Certificates (CA1_6_9I2R10CertificateIndex a)).input +lemma CA1_6_9I2R10P_check : ∀ a : PairSlot, contains (CA1_6_9I2R10Raw a) (CA1_6_9I2R10P a) = true := by + decide +kernel +lemma CA1_6_9I2R10P_sound (a : PairSlot) : + (CA1_6_9I2R10P a).Encloses (CA1_6_9I2R10Value a) := + contains_sound (CA1_6_9I2R10Raw_sound a) (CA1_6_9I2R10P_check a) +def CA1_6_9I2R10Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_6_9I2R10Certificates (CA1_6_9I2R10CertificateIndex a)).output +lemma CA1_6_9I2R10Terms_sound (a : PairSlot) : + (CA1_6_9I2R10Terms a).Encloses (Foundation.entropyTerm (CA1_6_9I2R10Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_6_9I2R10Certificates_valid + (CA1_6_9I2R10CertificateIndex a) (CA1_6_9I2R10P_sound a) +def CA1_6_9I2R10Entropy : Ball := ⟨0, 0⟩ +lemma CA1_6_9I2R10Entropy_sound : CA1_6_9I2R10Entropy.Encloses (Foundation.finiteEntropy CA1_6_9I2R10Value) := by + exact contains_sound (entropyPair_enclosed CA1_6_9I2R10Value CA1_6_9I2R10Terms CA1_6_9I2R10Terms_sound) (by decide +kernel) +def CA1_6_9I2R10Mass : Ball := ⟨0, 0⟩ +lemma CA1_6_9I2R10Mass_sound : CA1_6_9I2R10Mass.Encloses (∑ a, CA1_6_9I2R10Value a) := by + exact contains_sound (pairSumBall_sound CA1_6_9I2R10P CA1_6_9I2R10Value CA1_6_9I2R10P_sound) (by decide +kernel) +def CA1_6_9I2R10MassTerm : Ball := .exact 0 +lemma CA1_6_9I2R10MassTerm_sound : CA1_6_9I2R10MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_6_9I2R10Value a))) := + entropyTerm_zero_ball (CA1_6_9I2R10Mass_sound) +def CA1_6_9I2R10H : Ball := ⟨0, 0⟩ +lemma CA1_6_9I2R10H_sound : CA1_6_9I2R10H.Encloses (homogeneousEntropy CA1_6_9I2R10Value) := by + exact contains_sound (homogeneous_enclosed CA1_6_9I2R10Value CA1_6_9I2R10MassTerm_sound CA1_6_9I2R10Entropy_sound) (by decide +kernel) +def CA1_6_9I2R11Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 6 9)) (fun u => (stageALaw (shape 1 6 9) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 11 a +def CA1_6_9I2R11Raw (a : PairSlot) : Ball := residualBall (below (shape 1 6 9)) A1_6_9Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 11 a +lemma CA1_6_9I2R11Raw_sound (a : PairSlot) : + (CA1_6_9I2R11Raw a).Encloses (CA1_6_9I2R11Value a) := by + exact residualBall_sound_on (below (shape 1 6 9)) A1_6_9Law (fun u => (stageALaw (shape 1 6 9) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A1_6_9Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 6 9) (show (shape 1 6 9) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 11 a +def CA1_6_9I2R11Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA1_6_9I2R11Certificates_valid : + CA1_6_9I2R11Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_6_9I2R11CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA1_6_9I2R11P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_6_9I2R11Certificates (CA1_6_9I2R11CertificateIndex a)).input +lemma CA1_6_9I2R11P_check : ∀ a : PairSlot, contains (CA1_6_9I2R11Raw a) (CA1_6_9I2R11P a) = true := by + decide +kernel +lemma CA1_6_9I2R11P_sound (a : PairSlot) : + (CA1_6_9I2R11P a).Encloses (CA1_6_9I2R11Value a) := + contains_sound (CA1_6_9I2R11Raw_sound a) (CA1_6_9I2R11P_check a) +def CA1_6_9I2R11Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_6_9I2R11Certificates (CA1_6_9I2R11CertificateIndex a)).output +lemma CA1_6_9I2R11Terms_sound (a : PairSlot) : + (CA1_6_9I2R11Terms a).Encloses (Foundation.entropyTerm (CA1_6_9I2R11Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_6_9I2R11Certificates_valid + (CA1_6_9I2R11CertificateIndex a) (CA1_6_9I2R11P_sound a) +def CA1_6_9I2R11Entropy : Ball := ⟨0, 0⟩ +lemma CA1_6_9I2R11Entropy_sound : CA1_6_9I2R11Entropy.Encloses (Foundation.finiteEntropy CA1_6_9I2R11Value) := by + exact contains_sound (entropyPair_enclosed CA1_6_9I2R11Value CA1_6_9I2R11Terms CA1_6_9I2R11Terms_sound) (by decide +kernel) +def CA1_6_9I2R11Mass : Ball := ⟨0, 0⟩ +lemma CA1_6_9I2R11Mass_sound : CA1_6_9I2R11Mass.Encloses (∑ a, CA1_6_9I2R11Value a) := by + exact contains_sound (pairSumBall_sound CA1_6_9I2R11P CA1_6_9I2R11Value CA1_6_9I2R11P_sound) (by decide +kernel) +def CA1_6_9I2R11MassTerm : Ball := .exact 0 +lemma CA1_6_9I2R11MassTerm_sound : CA1_6_9I2R11MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_6_9I2R11Value a))) := + entropyTerm_zero_ball (CA1_6_9I2R11Mass_sound) +def CA1_6_9I2R11H : Ball := ⟨0, 0⟩ +lemma CA1_6_9I2R11H_sound : CA1_6_9I2R11H.Encloses (homogeneousEntropy CA1_6_9I2R11Value) := by + exact contains_sound (homogeneous_enclosed CA1_6_9I2R11Value CA1_6_9I2R11MassTerm_sound CA1_6_9I2R11Entropy_sound) (by decide +kernel) +def CA1_6_9I2R12Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 6 9)) (fun u => (stageALaw (shape 1 6 9) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 12 a +def CA1_6_9I2R12Raw (a : PairSlot) : Ball := residualBall (below (shape 1 6 9)) A1_6_9Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 12 a +lemma CA1_6_9I2R12Raw_sound (a : PairSlot) : + (CA1_6_9I2R12Raw a).Encloses (CA1_6_9I2R12Value a) := by + exact residualBall_sound_on (below (shape 1 6 9)) A1_6_9Law (fun u => (stageALaw (shape 1 6 9) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A1_6_9Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 6 9) (show (shape 1 6 9) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 12 a +def CA1_6_9I2R12Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA1_6_9I2R12Certificates_valid : + CA1_6_9I2R12Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_6_9I2R12CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA1_6_9I2R12P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_6_9I2R12Certificates (CA1_6_9I2R12CertificateIndex a)).input +lemma CA1_6_9I2R12P_check : ∀ a : PairSlot, contains (CA1_6_9I2R12Raw a) (CA1_6_9I2R12P a) = true := by + decide +kernel +lemma CA1_6_9I2R12P_sound (a : PairSlot) : + (CA1_6_9I2R12P a).Encloses (CA1_6_9I2R12Value a) := + contains_sound (CA1_6_9I2R12Raw_sound a) (CA1_6_9I2R12P_check a) +def CA1_6_9I2R12Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_6_9I2R12Certificates (CA1_6_9I2R12CertificateIndex a)).output +lemma CA1_6_9I2R12Terms_sound (a : PairSlot) : + (CA1_6_9I2R12Terms a).Encloses (Foundation.entropyTerm (CA1_6_9I2R12Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_6_9I2R12Certificates_valid + (CA1_6_9I2R12CertificateIndex a) (CA1_6_9I2R12P_sound a) +def CA1_6_9I2R12Entropy : Ball := ⟨0, 0⟩ +lemma CA1_6_9I2R12Entropy_sound : CA1_6_9I2R12Entropy.Encloses (Foundation.finiteEntropy CA1_6_9I2R12Value) := by + exact contains_sound (entropyPair_enclosed CA1_6_9I2R12Value CA1_6_9I2R12Terms CA1_6_9I2R12Terms_sound) (by decide +kernel) +def CA1_6_9I2R12Mass : Ball := ⟨0, 0⟩ +lemma CA1_6_9I2R12Mass_sound : CA1_6_9I2R12Mass.Encloses (∑ a, CA1_6_9I2R12Value a) := by + exact contains_sound (pairSumBall_sound CA1_6_9I2R12P CA1_6_9I2R12Value CA1_6_9I2R12P_sound) (by decide +kernel) +def CA1_6_9I2R12MassTerm : Ball := .exact 0 +lemma CA1_6_9I2R12MassTerm_sound : CA1_6_9I2R12MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_6_9I2R12Value a))) := + entropyTerm_zero_ball (CA1_6_9I2R12Mass_sound) +def CA1_6_9I2R12H : Ball := ⟨0, 0⟩ +lemma CA1_6_9I2R12H_sound : CA1_6_9I2R12H.Encloses (homogeneousEntropy CA1_6_9I2R12Value) := by + exact contains_sound (homogeneous_enclosed CA1_6_9I2R12Value CA1_6_9I2R12MassTerm_sound CA1_6_9I2R12Entropy_sound) (by decide +kernel) +def CA1_6_9I2R13Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 6 9)) (fun u => (stageALaw (shape 1 6 9) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 13 a +def CA1_6_9I2R13Raw (a : PairSlot) : Ball := residualBall (below (shape 1 6 9)) A1_6_9Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 13 a +lemma CA1_6_9I2R13Raw_sound (a : PairSlot) : + (CA1_6_9I2R13Raw a).Encloses (CA1_6_9I2R13Value a) := by + exact residualBall_sound_on (below (shape 1 6 9)) A1_6_9Law (fun u => (stageALaw (shape 1 6 9) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A1_6_9Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 6 9) (show (shape 1 6 9) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 13 a +def CA1_6_9I2R13Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA1_6_9I2R13Certificates_valid : + CA1_6_9I2R13Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_6_9I2R13CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA1_6_9I2R13P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_6_9I2R13Certificates (CA1_6_9I2R13CertificateIndex a)).input +lemma CA1_6_9I2R13P_check : ∀ a : PairSlot, contains (CA1_6_9I2R13Raw a) (CA1_6_9I2R13P a) = true := by + decide +kernel +lemma CA1_6_9I2R13P_sound (a : PairSlot) : + (CA1_6_9I2R13P a).Encloses (CA1_6_9I2R13Value a) := + contains_sound (CA1_6_9I2R13Raw_sound a) (CA1_6_9I2R13P_check a) +def CA1_6_9I2R13Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_6_9I2R13Certificates (CA1_6_9I2R13CertificateIndex a)).output +lemma CA1_6_9I2R13Terms_sound (a : PairSlot) : + (CA1_6_9I2R13Terms a).Encloses (Foundation.entropyTerm (CA1_6_9I2R13Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_6_9I2R13Certificates_valid + (CA1_6_9I2R13CertificateIndex a) (CA1_6_9I2R13P_sound a) +def CA1_6_9I2R13Entropy : Ball := ⟨0, 0⟩ +lemma CA1_6_9I2R13Entropy_sound : CA1_6_9I2R13Entropy.Encloses (Foundation.finiteEntropy CA1_6_9I2R13Value) := by + exact contains_sound (entropyPair_enclosed CA1_6_9I2R13Value CA1_6_9I2R13Terms CA1_6_9I2R13Terms_sound) (by decide +kernel) +def CA1_6_9I2R13Mass : Ball := ⟨0, 0⟩ +lemma CA1_6_9I2R13Mass_sound : CA1_6_9I2R13Mass.Encloses (∑ a, CA1_6_9I2R13Value a) := by + exact contains_sound (pairSumBall_sound CA1_6_9I2R13P CA1_6_9I2R13Value CA1_6_9I2R13P_sound) (by decide +kernel) +def CA1_6_9I2R13MassTerm : Ball := .exact 0 +lemma CA1_6_9I2R13MassTerm_sound : CA1_6_9I2R13MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_6_9I2R13Value a))) := + entropyTerm_zero_ball (CA1_6_9I2R13Mass_sound) +def CA1_6_9I2R13H : Ball := ⟨0, 0⟩ +lemma CA1_6_9I2R13H_sound : CA1_6_9I2R13H.Encloses (homogeneousEntropy CA1_6_9I2R13Value) := by + exact contains_sound (homogeneous_enclosed CA1_6_9I2R13Value CA1_6_9I2R13MassTerm_sound CA1_6_9I2R13Entropy_sound) (by decide +kernel) +def CA1_6_9I2R14Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 6 9)) (fun u => (stageALaw (shape 1 6 9) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 14 a +def CA1_6_9I2R14Raw (a : PairSlot) : Ball := residualBall (below (shape 1 6 9)) A1_6_9Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 14 a +lemma CA1_6_9I2R14Raw_sound (a : PairSlot) : + (CA1_6_9I2R14Raw a).Encloses (CA1_6_9I2R14Value a) := by + exact residualBall_sound_on (below (shape 1 6 9)) A1_6_9Law (fun u => (stageALaw (shape 1 6 9) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A1_6_9Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 6 9) (show (shape 1 6 9) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 14 a +def CA1_6_9I2R14Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA1_6_9I2R14Certificates_valid : + CA1_6_9I2R14Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_6_9I2R14CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA1_6_9I2R14P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_6_9I2R14Certificates (CA1_6_9I2R14CertificateIndex a)).input +lemma CA1_6_9I2R14P_check : ∀ a : PairSlot, contains (CA1_6_9I2R14Raw a) (CA1_6_9I2R14P a) = true := by + decide +kernel +lemma CA1_6_9I2R14P_sound (a : PairSlot) : + (CA1_6_9I2R14P a).Encloses (CA1_6_9I2R14Value a) := + contains_sound (CA1_6_9I2R14Raw_sound a) (CA1_6_9I2R14P_check a) +def CA1_6_9I2R14Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_6_9I2R14Certificates (CA1_6_9I2R14CertificateIndex a)).output +lemma CA1_6_9I2R14Terms_sound (a : PairSlot) : + (CA1_6_9I2R14Terms a).Encloses (Foundation.entropyTerm (CA1_6_9I2R14Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_6_9I2R14Certificates_valid + (CA1_6_9I2R14CertificateIndex a) (CA1_6_9I2R14P_sound a) +def CA1_6_9I2R14Entropy : Ball := ⟨0, 0⟩ +lemma CA1_6_9I2R14Entropy_sound : CA1_6_9I2R14Entropy.Encloses (Foundation.finiteEntropy CA1_6_9I2R14Value) := by + exact contains_sound (entropyPair_enclosed CA1_6_9I2R14Value CA1_6_9I2R14Terms CA1_6_9I2R14Terms_sound) (by decide +kernel) +def CA1_6_9I2R14Mass : Ball := ⟨0, 0⟩ +lemma CA1_6_9I2R14Mass_sound : CA1_6_9I2R14Mass.Encloses (∑ a, CA1_6_9I2R14Value a) := by + exact contains_sound (pairSumBall_sound CA1_6_9I2R14P CA1_6_9I2R14Value CA1_6_9I2R14P_sound) (by decide +kernel) +def CA1_6_9I2R14MassTerm : Ball := .exact 0 +lemma CA1_6_9I2R14MassTerm_sound : CA1_6_9I2R14MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_6_9I2R14Value a))) := + entropyTerm_zero_ball (CA1_6_9I2R14Mass_sound) +def CA1_6_9I2R14H : Ball := ⟨0, 0⟩ +lemma CA1_6_9I2R14H_sound : CA1_6_9I2R14H.Encloses (homogeneousEntropy CA1_6_9I2R14Value) := by + exact contains_sound (homogeneous_enclosed CA1_6_9I2R14Value CA1_6_9I2R14MassTerm_sound CA1_6_9I2R14Entropy_sound) (by decide +kernel) +def CA1_6_9I2R15Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 6 9)) (fun u => (stageALaw (shape 1 6 9) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 15 a +def CA1_6_9I2R15Raw (a : PairSlot) : Ball := residualBall (below (shape 1 6 9)) A1_6_9Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 15 a +lemma CA1_6_9I2R15Raw_sound (a : PairSlot) : + (CA1_6_9I2R15Raw a).Encloses (CA1_6_9I2R15Value a) := by + exact residualBall_sound_on (below (shape 1 6 9)) A1_6_9Law (fun u => (stageALaw (shape 1 6 9) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A1_6_9Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 6 9) (show (shape 1 6 9) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 15 a +def CA1_6_9I2R15Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA1_6_9I2R15Certificates_valid : + CA1_6_9I2R15Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_6_9I2R15CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA1_6_9I2R15P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_6_9I2R15Certificates (CA1_6_9I2R15CertificateIndex a)).input +lemma CA1_6_9I2R15P_check : ∀ a : PairSlot, contains (CA1_6_9I2R15Raw a) (CA1_6_9I2R15P a) = true := by + decide +kernel +lemma CA1_6_9I2R15P_sound (a : PairSlot) : + (CA1_6_9I2R15P a).Encloses (CA1_6_9I2R15Value a) := + contains_sound (CA1_6_9I2R15Raw_sound a) (CA1_6_9I2R15P_check a) +def CA1_6_9I2R15Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_6_9I2R15Certificates (CA1_6_9I2R15CertificateIndex a)).output +lemma CA1_6_9I2R15Terms_sound (a : PairSlot) : + (CA1_6_9I2R15Terms a).Encloses (Foundation.entropyTerm (CA1_6_9I2R15Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_6_9I2R15Certificates_valid + (CA1_6_9I2R15CertificateIndex a) (CA1_6_9I2R15P_sound a) +def CA1_6_9I2R15Entropy : Ball := ⟨0, 0⟩ +lemma CA1_6_9I2R15Entropy_sound : CA1_6_9I2R15Entropy.Encloses (Foundation.finiteEntropy CA1_6_9I2R15Value) := by + exact contains_sound (entropyPair_enclosed CA1_6_9I2R15Value CA1_6_9I2R15Terms CA1_6_9I2R15Terms_sound) (by decide +kernel) +def CA1_6_9I2R15Mass : Ball := ⟨0, 0⟩ +lemma CA1_6_9I2R15Mass_sound : CA1_6_9I2R15Mass.Encloses (∑ a, CA1_6_9I2R15Value a) := by + exact contains_sound (pairSumBall_sound CA1_6_9I2R15P CA1_6_9I2R15Value CA1_6_9I2R15P_sound) (by decide +kernel) +def CA1_6_9I2R15MassTerm : Ball := .exact 0 +lemma CA1_6_9I2R15MassTerm_sound : CA1_6_9I2R15MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_6_9I2R15Value a))) := + entropyTerm_zero_ball (CA1_6_9I2R15Mass_sound) +def CA1_6_9I2R15H : Ball := ⟨0, 0⟩ +lemma CA1_6_9I2R15H_sound : CA1_6_9I2R15H.Encloses (homogeneousEntropy CA1_6_9I2R15Value) := by + exact contains_sound (homogeneous_enclosed CA1_6_9I2R15Value CA1_6_9I2R15MassTerm_sound CA1_6_9I2R15Entropy_sound) (by decide +kernel) +def CA1_6_9I2R16Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 6 9)) (fun u => (stageALaw (shape 1 6 9) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 16 a +def CA1_6_9I2R16Raw (a : PairSlot) : Ball := residualBall (below (shape 1 6 9)) A1_6_9Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 16 a +lemma CA1_6_9I2R16Raw_sound (a : PairSlot) : + (CA1_6_9I2R16Raw a).Encloses (CA1_6_9I2R16Value a) := by + exact residualBall_sound_on (below (shape 1 6 9)) A1_6_9Law (fun u => (stageALaw (shape 1 6 9) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A1_6_9Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 6 9) (show (shape 1 6 9) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 16 a +def CA1_6_9I2R16Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA1_6_9I2R16Certificates_valid : + CA1_6_9I2R16Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_6_9I2R16CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA1_6_9I2R16P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_6_9I2R16Certificates (CA1_6_9I2R16CertificateIndex a)).input +lemma CA1_6_9I2R16P_check : ∀ a : PairSlot, contains (CA1_6_9I2R16Raw a) (CA1_6_9I2R16P a) = true := by + decide +kernel +lemma CA1_6_9I2R16P_sound (a : PairSlot) : + (CA1_6_9I2R16P a).Encloses (CA1_6_9I2R16Value a) := + contains_sound (CA1_6_9I2R16Raw_sound a) (CA1_6_9I2R16P_check a) +def CA1_6_9I2R16Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_6_9I2R16Certificates (CA1_6_9I2R16CertificateIndex a)).output +lemma CA1_6_9I2R16Terms_sound (a : PairSlot) : + (CA1_6_9I2R16Terms a).Encloses (Foundation.entropyTerm (CA1_6_9I2R16Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_6_9I2R16Certificates_valid + (CA1_6_9I2R16CertificateIndex a) (CA1_6_9I2R16P_sound a) +def CA1_6_9I2R16Entropy : Ball := ⟨0, 0⟩ +lemma CA1_6_9I2R16Entropy_sound : CA1_6_9I2R16Entropy.Encloses (Foundation.finiteEntropy CA1_6_9I2R16Value) := by + exact contains_sound (entropyPair_enclosed CA1_6_9I2R16Value CA1_6_9I2R16Terms CA1_6_9I2R16Terms_sound) (by decide +kernel) +def CA1_6_9I2R16Mass : Ball := ⟨0, 0⟩ +lemma CA1_6_9I2R16Mass_sound : CA1_6_9I2R16Mass.Encloses (∑ a, CA1_6_9I2R16Value a) := by + exact contains_sound (pairSumBall_sound CA1_6_9I2R16P CA1_6_9I2R16Value CA1_6_9I2R16P_sound) (by decide +kernel) +def CA1_6_9I2R16MassTerm : Ball := .exact 0 +lemma CA1_6_9I2R16MassTerm_sound : CA1_6_9I2R16MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_6_9I2R16Value a))) := + entropyTerm_zero_ball (CA1_6_9I2R16Mass_sound) +def CA1_6_9I2R16H : Ball := ⟨0, 0⟩ +lemma CA1_6_9I2R16H_sound : CA1_6_9I2R16H.Encloses (homogeneousEntropy CA1_6_9I2R16Value) := by + exact contains_sound (homogeneous_enclosed CA1_6_9I2R16Value CA1_6_9I2R16MassTerm_sound CA1_6_9I2R16Entropy_sound) (by decide +kernel) +def CA1_6_9I2ResidualEntropies (a : Fin 17) : Ball := + match a.val with + | 0 => CA1_6_9I2R0H + | 1 => CA1_6_9I2R1H + | 2 => CA1_6_9I2R2H + | 3 => CA1_6_9I2R3H + | 4 => CA1_6_9I2R4H + | 5 => CA1_6_9I2R5H + | 6 => CA1_6_9I2R6H + | 7 => CA1_6_9I2R7H + | 8 => CA1_6_9I2R8H + | 9 => CA1_6_9I2R9H + | 10 => CA1_6_9I2R10H + | 11 => CA1_6_9I2R11H + | 12 => CA1_6_9I2R12H + | 13 => CA1_6_9I2R13H + | 14 => CA1_6_9I2R14H + | 15 => CA1_6_9I2R15H + | 16 => CA1_6_9I2R16H + | _ => (.exact 0) +lemma CA1_6_9I2ResidualEntropies_sound (k : Fin 17) : + (CA1_6_9I2ResidualEntropies k).Encloses (homogeneousEntropy + (residualLaw (below (shape 1 6 9)) (fun u => (stageALaw (shape 1 6 9) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) k)) := by + fin_cases k + · exact CA1_6_9I2R0H_sound + · exact CA1_6_9I2R1H_sound + · exact CA1_6_9I2R2H_sound + · exact CA1_6_9I2R3H_sound + · exact CA1_6_9I2R4H_sound + · exact CA1_6_9I2R5H_sound + · exact CA1_6_9I2R6H_sound + · exact CA1_6_9I2R7H_sound + · exact CA1_6_9I2R8H_sound + · exact CA1_6_9I2R9H_sound + · exact CA1_6_9I2R10H_sound + · exact CA1_6_9I2R11H_sound + · exact CA1_6_9I2R12H_sound + · exact CA1_6_9I2R13H_sound + · exact CA1_6_9I2R14H_sound + · exact CA1_6_9I2R15H_sound + · exact CA1_6_9I2R16H_sound +def CA1_6_9I2Singles (s : Shape) : Ball := + match s 0, s 1, s 2 with + | 0, 0, 8 => Z0_0_8H2H + | 0, 1, 7 => Z0_1_7H2H + | 0, 2, 6 => Z0_2_6H2H + | 0, 3, 5 => Z0_3_5H2H + | 0, 4, 4 => Z0_4_4H2H + | 0, 5, 3 => Z0_5_3H2H + | 0, 6, 2 => Z0_6_2H2H + | 1, 0, 7 => Z1_0_7H2H + | _, _, _ => (.exact 0) +lemma CA1_6_9I2Singles_sound (u : Shape) (hu : u ∈ below (shape 1 6 9)) + (hd : designated (Equiv.refl (Fin 3)) 2 u) : + (CA1_6_9I2Singles u).Encloses (homogeneousEntropy ((fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) u)) := by + rw [A1_6_9_below] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl + · exact Z0_0_8H2H_sound + · exact Z0_1_7H2H_sound + · exact Z0_2_6H2H_sound + · exact Z0_3_5H2H_sound + · exact Z0_4_4H2H_sound + · exact Z0_5_3H2H_sound + · exact Z0_6_2H2H_sound + · exact Z1_0_7H2H_sound + · exact (show ¬ designated (Equiv.refl (Fin 3)) 2 (shape 1 1 6) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 2 (shape 1 2 5) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 2 (shape 1 3 4) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 2 (shape 1 4 3) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 2 (shape 1 5 2) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 2 (shape 1 6 1) by decide +kernel) hd |>.elim +def CA1_6_9I2Singleton : Ball := ⟨(29824973448744012139609014923727 / 50000000000000000000000000000000), (4955604441 / 10000000000000000000000000000000)⟩ +lemma CA1_6_9I2Singleton_sound : CA1_6_9I2Singleton.Encloses + (singletonEntropy (below (shape 1 6 9)) (fun u => (stageALaw (shape 1 6 9) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ))) := by + exact contains_sound (singletonBall_sound (below (shape 1 6 9)) A1_6_9Law (fun u => (stageALaw (shape 1 6 9) u : ℝ)) (Equiv.refl (Fin 3)) 2 + CA1_6_9I2Singles (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A1_6_9Law_sound u) CA1_6_9I2Singles_sound) (by decide +kernel) +def CA1_6_9I2Group : Ball := ⟨(102000778991737113609883620931201 / 100000000000000000000000000000000), (144362823747 / 100000000000000000000000000000000)⟩ +lemma CA1_6_9I2Group_sound : CA1_6_9I2Group.Encloses + (groupedEntropy (below (shape 1 6 9)) (fun u => (stageALaw (shape 1 6 9) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ))) := by + exact contains_sound (Ball.add_sound CA1_6_9I2Singleton_sound + (finSumBall_sound 17 CA1_6_9I2ResidualEntropies _ CA1_6_9I2ResidualEntropies_sound)) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CA1_6_9I2H : Ball := ⟨(53639880102499874118198500923321 / 50000000000000000000000000000000), (86553573677 / 20000000000000000000000000000000)⟩ +lemma CA1_6_9I2_sound : CA1_6_9I2H.Encloses (stageACapacity (shape 1 6 9) 2) := by + have hb := contains_sound (Ball.add_sound CA1_6_9I2PairH_sound + (Ball.neg_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) CA1_6_9I2Group_sound))) + (show contains (.add CA1_6_9I2PairH (.neg (.mul (.exact 2) CA1_6_9I2Group))) CA1_6_9I2H = true by decide +kernel) + unfold CA1_6_9I2PairValue at hb + simpa only [stageACapacity, nativeCapacity, + show (2 : Fin 3) ≠ 0 by decide, ite_false, sub_eq_add_neg] using hb + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA1_6_9I2Pair.lean b/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA1_6_9I2Pair.lean new file mode 100644 index 0000000000000000000000000000000000000000..58e0233ae894ce3ba85561b0b92a629dacc85dd6 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA1_6_9I2Pair.lean @@ -0,0 +1,355 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Certificates.SupportedContraction + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CA1_6_9I2PairValue (a : PairSlot × PairSlot) : ℝ := pairLaw (below (shape 1 6 9)) (shape 1 6 9) (fun u => (stageALaw (shape 1 6 9) u : ℝ)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) a +def CA1_6_9I2PairRaw (a : PairSlot × PairSlot) : Ball := stageAPairBall (shape 1 6 9) A1_6_9Law 2 a +lemma CA1_6_9I2PairRaw_sound (a : PairSlot × PairSlot) : + (CA1_6_9I2PairRaw a).Encloses (CA1_6_9I2PairValue a) := by + exact stageAPairBall_sound (shape 1 6 9) (by decide +kernel) A1_6_9Law (fun u => (stageALaw (shape 1 6 9) u : ℝ)) (fun u _ => A1_6_9Law_sound u) 2 a +def CA1_6_9I2PairCertificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(15382325296305947711052937 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(175988165289010751885124581 / 20000000000000000000000000000000), (286661 / 100000000000000000000000000000000)⟩ ⟨(-715058362028310178292855577849303 / 50000000000000000000000000000000), (465869746267 / 100000000000000000000000000000000)⟩ ⟨-21, 15382325296305947711052937, 11920928955078125000000000⟩, + .log ⟨(6226335706449779537353750263 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(15074172735630747876133272261 / 25000000000000000000000000000000), (19777179 / 100000000000000000000000000000000)⟩ ⟨(-968413747431935605170589777226543 / 100000000000000000000000000000000), (63527474261 / 20000000000000000000000000000000)⟩ ⟨-14, 6226335706449779537353750263, 6103515625000000000000000000⟩, + .log ⟨(342606882096507439542287723 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(8147842533859288928978793351 / 100000000000000000000000000000000), (2756907 / 100000000000000000000000000000000)⟩ ⟨(-594547494492839658850412314384079 / 50000000000000000000000000000000), (402340795917 / 100000000000000000000000000000000)⟩ ⟨-18, 342606882096507439542287723, 190734863281250000000000000⟩, + .log ⟨(4848987661428906255988162371 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(100916132305787689610145032321 / 50000000000000000000000000000000), (35938463 / 50000000000000000000000000000000)⟩ ⟨(-416235879948803940527519713672229 / 50000000000000000000000000000000), (148230767843 / 50000000000000000000000000000000)⟩ ⟨-13, 4848987661428906255988162371, 2441406250000000000000000000⟩, + .log ⟨(4737338135872602269787180813 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(87776270682348121503801448821 / 100000000000000000000000000000000), (15047561 / 50000000000000000000000000000000)⟩ ⟨(-185286057623117117983845186243957 / 20000000000000000000000000000000), (317637365799 / 100000000000000000000000000000000)⟩ ⟨-14, 4737338135872602269787180813, 3051757812500000000000000000⟩, + .log ⟨(63687675754500145968777020077 / 20000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ ⟨(915430169230102673745754071591 / 50000000000000000000000000000000), (674319517 / 100000000000000000000000000000000)⟩ ⟨(-574949648191812834499145785296517 / 100000000000000000000000000000000), (52939559443 / 25000000000000000000000000000000)⟩ ⟨-9, 63687675754500145968777020077, 39062500000000000000000000000⟩, + .log ⟨(1926037758707577547733257983 / 6250000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(31143536817820740457061622193 / 12500000000000000000000000000000), (84833717 / 100000000000000000000000000000000)⟩ ⟨(-808487182481793093123173808489277 / 100000000000000000000000000000000), (275285711123 / 100000000000000000000000000000000)⟩ ⟨-12, 1926037758707577547733257983, 1525878906250000000000000000⟩, + .log ⟨(745352950953317971129148323 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(1760050054713893608885333159 / 20000000000000000000000000000000), (374859 / 12500000000000000000000000000000)⟩ ⟨(-36896321494039382670997571929413 / 3125000000000000000000000000000), (402340784141 / 100000000000000000000000000000000)⟩ ⟨-18, 745352950953317971129148323, 381469726562500000000000000⟩, + .log ⟨(25344810945492483299140114449 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(209863942121195473423506241851 / 100000000000000000000000000000000), (17442663 / 25000000000000000000000000000000)⟩ ⟨(-20700878630791216839182244331193 / 2500000000000000000000000000000), (17205356989 / 6250000000000000000000000000000)⟩ ⟨-12, 25344810945492483299140114449, 24414062500000000000000000000⟩, + .log ⟨(613752786732258206193098113 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(1042377519723812072682208939 / 4000000000000000000000000000000), (4418891 / 50000000000000000000000000000000)⟩ ⟨(-265369854080835704800594088824069 / 25000000000000000000000000000000), (22499315209 / 6250000000000000000000000000000)⟩ ⟨-16, 613752786732258206193098113, 381469726562500000000000000⟩, + .log ⟨(56377934531724064289994371141 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(21087736853236610075098739749 / 5000000000000000000000000000000), (143261913 / 100000000000000000000000000000000)⟩ ⟨(-74808476147243264264817864413913 / 10000000000000000000000000000000), (254109885969 / 100000000000000000000000000000000)⟩ ⟨-11, 56377934531724064289994371141, 48828125000000000000000000000⟩, + .log ⟨(762489790123402996718232859737 / 50000000000000000000000000000000), (9 / 100000000000000000000000000000000)⟩ ⟨(1275855611698172811965041065931 / 20000000000000000000000000000000), (322926993 / 12500000000000000000000000000000)⟩ ⟨(-83663783320409154619275173927341 / 20000000000000000000000000000000), (84703295027 / 50000000000000000000000000000000)⟩ ⟨-7, 762489790123402996718232859737, 390625000000000000000000000000⟩, + .log ⟨(72349467682812191257410879253 / 50000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ ⟨(236520183866236689533900377189 / 25000000000000000000000000000000), (337053121 / 100000000000000000000000000000000)⟩ ⟨(-653827018888836851223697498706783 / 100000000000000000000000000000000), (116467030947 / 50000000000000000000000000000000)⟩ ⟨-10, 72349467682812191257410879253, 48828125000000000000000000000⟩, + .log ⟨(76943174393262685915838669 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(205968666611901182584570333 / 10000000000000000000000000000000), (42771 / 6250000000000000000000000000000)⟩ ⟨(-334611660222092834191803288480327 / 25000000000000000000000000000000), (444692947173 / 100000000000000000000000000000000)⟩ ⟨-20, 76943174393262685915838669, 47683715820312500000000000⟩, + .log ⟨(26358526396010114870494420443 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(198953800853284028623422469103 / 50000000000000000000000000000000), (133959251 / 100000000000000000000000000000000)⟩ ⟨(-188699661984328178940973045112769 / 25000000000000000000000000000000), (63527471523 / 25000000000000000000000000000000)⟩ ⟨-11, 26358526396010114870494420443, 24414062500000000000000000000⟩, + .log ⟨(550455816402850908417426700823 / 100000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ ⟨(286356956349767743028331270219 / 10000000000000000000000000000000), (1049071997 / 100000000000000000000000000000000)⟩ ⟨(-130054469321928964135056721764399 / 25000000000000000000000000000000), (190582413691 / 100000000000000000000000000000000)⟩ ⟨-8, 550455816402850908417426700823, 390625000000000000000000000000⟩, + .log ⟨(28957300769441999238566808663 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(235918115076921582966970067213 / 100000000000000000000000000000000), (1992883 / 2500000000000000000000000000000)⟩ ⟨(-81471031072716821010628465750691 / 10000000000000000000000000000000), (68821427833 / 25000000000000000000000000000000)⟩ ⟨-12, 28957300769441999238566808663, 24414062500000000000000000000⟩, + .log ⟨(19689079404143149674604937 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(210455389433134465561052483 / 10000000000000000000000000000000), (350231 / 50000000000000000000000000000000)⟩ ⟨(-1336117506520191765936931925094769 / 100000000000000000000000000000000), (111173233053 / 25000000000000000000000000000000)⟩ ⟨-20, 19689079404143149674604937, 11920928955078125000000000⟩, + .log ⟨(9378436151494651010943408041 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(80479786154311032743584320341 / 50000000000000000000000000000000), (55606921 / 100000000000000000000000000000000)⟩ ⟨(-858136525688079525786533197999267 / 100000000000000000000000000000000), (296461536893 / 100000000000000000000000000000000)⟩ ⟨-13, 9378436151494651010943408041, 6103515625000000000000000000⟩, + .log ⟨(1951307127089419443435558990573 / 100000000000000000000000000000000), (1 / 10000000000000000000000000000000)⟩ ⟨(1536330725180484812921627487951 / 20000000000000000000000000000000), (723109387 / 25000000000000000000000000000000)⟩ ⟨(-393667071639328315750019128968207 / 100000000000000000000000000000000), (148230766293 / 100000000000000000000000000000000)⟩ ⟨-6, 1951307127089419443435558990573, 1562500000000000000000000000000⟩, + .log ⟨(14255995847542891161702836950437 / 100000000000000000000000000000000), (53 / 100000000000000000000000000000000)⟩ ⟨(27770574509843364130905529712391 / 100000000000000000000000000000000), (377353073 / 3125000000000000000000000000000)⟩ ⟨(-38959852130750717048457105236329 / 20000000000000000000000000000000), (84703295103 / 100000000000000000000000000000000)⟩ ⟨-3, 14255995847542891161702836950437, 12500000000000000000000000000000⟩, + .log ⟨(507791623282321165366669052699 / 50000000000000000000000000000000), (1 / 20000000000000000000000000000000)⟩ ⟨(2330614824474012886417718092051 / 50000000000000000000000000000000), (172046497 / 10000000000000000000000000000000)⟩ ⟨(-114742677784300580419553326817553 / 25000000000000000000000000000000), (42351647489 / 25000000000000000000000000000000)⟩ ⟨-7, 507791623282321165366669052699, 390625000000000000000000000000⟩, + .log ⟨(12241119468788011590882701819 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(113210261591126181949786434073 / 25000000000000000000000000000000), (77764741 / 50000000000000000000000000000000)⟩ ⟨(-369934340988292258812805607769191 / 50000000000000000000000000000000), (254109885829 / 100000000000000000000000000000000)⟩ ⟨-11, 12241119468788011590882701819, 9765625000000000000000000000⟩, + .log ⟨(822632844869934256519228197 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(30098518191277290190080009 / 312500000000000000000000000000), (3135601 / 100000000000000000000000000000000)⟩ ⟨(-1170817076083506584961781994871647 / 100000000000000000000000000000000), (190582473927 / 50000000000000000000000000000000)⟩ ⟨-17, 822632844869934256519228197, 762939453125000000000000000⟩, + .log ⟨(30921643234970006981442145569 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(3312412873721680821850943249 / 400000000000000000000000000000), (57621633 / 20000000000000000000000000000000)⟩ ⟨(-334758736840794321171873112615973 / 50000000000000000000000000000000), (232934061321 / 100000000000000000000000000000000)⟩ ⟨-10, 30921643234970006981442145569, 24414062500000000000000000000⟩, + .log ⟨(1075249121150515256573728972547 / 100000000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ ⟨(1218423329353426124792353050669 / 25000000000000000000000000000000), (1821542887 / 100000000000000000000000000000000)⟩ ⟨(-226630890532552054346139617414233 / 50000000000000000000000000000000), (42351647459 / 25000000000000000000000000000000)⟩ ⟨-7, 1075249121150515256573728972547, 781250000000000000000000000000⟩, + .log ⟨(65952233894931532302825687803 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(483033812411536635888223661249 / 100000000000000000000000000000000), (83795577 / 50000000000000000000000000000000)⟩ ⟨(-146479894276532782162373245233183 / 20000000000000000000000000000000), (15881867857 / 6250000000000000000000000000000)⟩ ⟨-11, 65952233894931532302825687803, 48828125000000000000000000000⟩, + .log ⟨(2326568682953017470217539103 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(24821070003932187680571462483 / 100000000000000000000000000000000), (2093851 / 25000000000000000000000000000000)⟩ ⟨(-1066853095109482407389405272679123 / 100000000000000000000000000000000), (44998630699 / 12500000000000000000000000000000)⟩ ⟨-16, 2326568682953017470217539103, 1525878906250000000000000000⟩] +lemma CA1_6_9I2PairCertificates_valid : + CA1_6_9I2PairCertificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_6_9I2PairCertificateIndex (a : PairSlot × PairSlot) : ℕ := + match a.1.1.val, a.1.2.val, a.2.1.val, a.2.2.val with + | 5, 5, 1, 0 => 1 + | 5, 5, 0, 1 => 1 + | 4, 5, 2, 0 => 2 + | 4, 5, 3, 0 => 3 + | 4, 5, 1, 1 => 4 + | 4, 5, 0, 2 => 2 + | 4, 5, 0, 3 => 3 + | 5, 4, 2, 0 => 2 + | 5, 4, 3, 0 => 3 + | 5, 4, 1, 1 => 4 + | 5, 4, 0, 2 => 2 + | 5, 4, 0, 3 => 3 + | 2, 5, 4, 0 => 5 + | 2, 5, 2, 1 => 6 + | 2, 5, 3, 1 => 7 + | 2, 5, 1, 2 => 6 + | 2, 5, 1, 3 => 7 + | 2, 5, 0, 4 => 5 + | 3, 5, 4, 0 => 8 + | 3, 5, 2, 1 => 9 + | 3, 5, 3, 1 => 10 + | 3, 5, 1, 2 => 9 + | 3, 5, 1, 3 => 10 + | 3, 5, 0, 4 => 8 + | 4, 4, 4, 0 => 11 + | 4, 4, 2, 1 => 12 + | 4, 4, 3, 1 => 13 + | 4, 4, 1, 2 => 12 + | 4, 4, 1, 3 => 13 + | 4, 4, 0, 4 => 11 + | 5, 2, 4, 0 => 5 + | 5, 2, 2, 1 => 6 + | 5, 2, 3, 1 => 7 + | 5, 2, 1, 2 => 6 + | 5, 2, 1, 3 => 7 + | 5, 2, 0, 4 => 5 + | 5, 3, 4, 0 => 8 + | 5, 3, 2, 1 => 9 + | 5, 3, 3, 1 => 10 + | 5, 3, 1, 2 => 9 + | 5, 3, 1, 3 => 10 + | 5, 3, 0, 4 => 8 + | 1, 5, 5, 0 => 14 + | 1, 5, 4, 1 => 15 + | 1, 5, 2, 2 => 16 + | 1, 5, 2, 3 => 17 + | 1, 5, 3, 2 => 17 + | 1, 5, 3, 3 => 18 + | 1, 5, 1, 4 => 15 + | 1, 5, 0, 5 => 14 + | 2, 4, 5, 0 => 19 + | 2, 4, 4, 1 => 20 + | 2, 4, 2, 2 => 21 + | 2, 4, 2, 3 => 22 + | 2, 4, 3, 2 => 22 + | 2, 4, 3, 3 => 23 + | 2, 4, 1, 4 => 20 + | 2, 4, 0, 5 => 19 + | 3, 4, 5, 0 => 24 + | 3, 4, 4, 1 => 25 + | 3, 4, 2, 2 => 26 + | 3, 4, 2, 3 => 27 + | 3, 4, 3, 2 => 27 + | 3, 4, 3, 3 => 28 + | 3, 4, 1, 4 => 25 + | 3, 4, 0, 5 => 24 + | 4, 2, 5, 0 => 19 + | 4, 2, 4, 1 => 20 + | 4, 2, 2, 2 => 21 + | 4, 2, 2, 3 => 22 + | 4, 2, 3, 2 => 22 + | 4, 2, 3, 3 => 23 + | 4, 2, 1, 4 => 20 + | 4, 2, 0, 5 => 19 + | 4, 3, 5, 0 => 24 + | 4, 3, 4, 1 => 25 + | 4, 3, 2, 2 => 26 + | 4, 3, 2, 3 => 27 + | 4, 3, 3, 2 => 27 + | 4, 3, 3, 3 => 28 + | 4, 3, 1, 4 => 25 + | 4, 3, 0, 5 => 24 + | 5, 1, 5, 0 => 14 + | 5, 1, 4, 1 => 15 + | 5, 1, 2, 2 => 16 + | 5, 1, 2, 3 => 17 + | 5, 1, 3, 2 => 17 + | 5, 1, 3, 3 => 18 + | 5, 1, 1, 4 => 15 + | 5, 1, 0, 5 => 14 + | 5, 0, 5, 1 => 14 + | 5, 0, 4, 2 => 19 + | 5, 0, 4, 3 => 24 + | 5, 0, 2, 4 => 19 + | 5, 0, 3, 4 => 24 + | 5, 0, 1, 5 => 14 + | 4, 1, 5, 1 => 15 + | 4, 1, 4, 2 => 20 + | 4, 1, 4, 3 => 25 + | 4, 1, 2, 4 => 20 + | 4, 1, 3, 4 => 25 + | 4, 1, 1, 5 => 15 + | 2, 2, 5, 1 => 16 + | 2, 2, 4, 2 => 21 + | 2, 2, 4, 3 => 26 + | 2, 2, 2, 4 => 21 + | 2, 2, 3, 4 => 26 + | 2, 2, 1, 5 => 16 + | 2, 3, 5, 1 => 17 + | 2, 3, 4, 2 => 22 + | 2, 3, 4, 3 => 27 + | 2, 3, 2, 4 => 22 + | 2, 3, 3, 4 => 27 + | 2, 3, 1, 5 => 17 + | 3, 2, 5, 1 => 17 + | 3, 2, 4, 2 => 22 + | 3, 2, 4, 3 => 27 + | 3, 2, 2, 4 => 22 + | 3, 2, 3, 4 => 27 + | 3, 2, 1, 5 => 17 + | 3, 3, 5, 1 => 18 + | 3, 3, 4, 2 => 23 + | 3, 3, 4, 3 => 28 + | 3, 3, 2, 4 => 23 + | 3, 3, 3, 4 => 28 + | 3, 3, 1, 5 => 18 + | 1, 4, 5, 1 => 15 + | 1, 4, 4, 2 => 20 + | 1, 4, 4, 3 => 25 + | 1, 4, 2, 4 => 20 + | 1, 4, 3, 4 => 25 + | 1, 4, 1, 5 => 15 + | 0, 5, 5, 1 => 14 + | 0, 5, 4, 2 => 19 + | 0, 5, 4, 3 => 24 + | 0, 5, 2, 4 => 19 + | 0, 5, 3, 4 => 24 + | 0, 5, 1, 5 => 14 + | 4, 0, 5, 2 => 5 + | 4, 0, 5, 3 => 8 + | 4, 0, 4, 4 => 11 + | 4, 0, 2, 5 => 5 + | 4, 0, 3, 5 => 8 + | 2, 1, 5, 2 => 6 + | 2, 1, 5, 3 => 9 + | 2, 1, 4, 4 => 12 + | 2, 1, 2, 5 => 6 + | 2, 1, 3, 5 => 9 + | 3, 1, 5, 2 => 7 + | 3, 1, 5, 3 => 10 + | 3, 1, 4, 4 => 13 + | 3, 1, 2, 5 => 7 + | 3, 1, 3, 5 => 10 + | 1, 2, 5, 2 => 6 + | 1, 2, 5, 3 => 9 + | 1, 2, 4, 4 => 12 + | 1, 2, 2, 5 => 6 + | 1, 2, 3, 5 => 9 + | 1, 3, 5, 2 => 7 + | 1, 3, 5, 3 => 10 + | 1, 3, 4, 4 => 13 + | 1, 3, 2, 5 => 7 + | 1, 3, 3, 5 => 10 + | 0, 4, 5, 2 => 5 + | 0, 4, 5, 3 => 8 + | 0, 4, 4, 4 => 11 + | 0, 4, 2, 5 => 5 + | 0, 4, 3, 5 => 8 + | 2, 0, 4, 5 => 2 + | 2, 0, 5, 4 => 2 + | 3, 0, 4, 5 => 3 + | 3, 0, 5, 4 => 3 + | 1, 1, 4, 5 => 4 + | 1, 1, 5, 4 => 4 + | 0, 2, 4, 5 => 2 + | 0, 2, 5, 4 => 2 + | 0, 3, 4, 5 => 3 + | 0, 3, 5, 4 => 3 + | 1, 0, 5, 5 => 1 + | 0, 1, 5, 5 => 1 + | _, _, _, _ => 0 +def CA1_6_9I2PairP (a : PairSlot × PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_6_9I2PairCertificates (CA1_6_9I2PairCertificateIndex a)).input +lemma CA1_6_9I2PairP_check_0_0 : ∀ k l : Fin 6, contains (CA1_6_9I2PairRaw ((0,0),(k,l))) (CA1_6_9I2PairP ((0,0),(k,l))) = true := by + decide +kernel +lemma CA1_6_9I2PairP_check_0_1 : ∀ k l : Fin 6, contains (CA1_6_9I2PairRaw ((0,1),(k,l))) (CA1_6_9I2PairP ((0,1),(k,l))) = true := by + decide +kernel +lemma CA1_6_9I2PairP_check_0_2 : ∀ k l : Fin 6, contains (CA1_6_9I2PairRaw ((0,2),(k,l))) (CA1_6_9I2PairP ((0,2),(k,l))) = true := by + decide +kernel +lemma CA1_6_9I2PairP_check_0_3 : ∀ k l : Fin 6, contains (CA1_6_9I2PairRaw ((0,3),(k,l))) (CA1_6_9I2PairP ((0,3),(k,l))) = true := by + decide +kernel +lemma CA1_6_9I2PairP_check_0_4 : ∀ k l : Fin 6, contains (CA1_6_9I2PairRaw ((0,4),(k,l))) (CA1_6_9I2PairP ((0,4),(k,l))) = true := by + decide +kernel +lemma CA1_6_9I2PairP_check_0_5 : ∀ k l : Fin 6, contains (CA1_6_9I2PairRaw ((0,5),(k,l))) (CA1_6_9I2PairP ((0,5),(k,l))) = true := by + decide +kernel +lemma CA1_6_9I2PairP_check_1_0 : ∀ k l : Fin 6, contains (CA1_6_9I2PairRaw ((1,0),(k,l))) (CA1_6_9I2PairP ((1,0),(k,l))) = true := by + decide +kernel +lemma CA1_6_9I2PairP_check_1_1 : ∀ k l : Fin 6, contains (CA1_6_9I2PairRaw ((1,1),(k,l))) (CA1_6_9I2PairP ((1,1),(k,l))) = true := by + decide +kernel +lemma CA1_6_9I2PairP_check_1_2 : ∀ k l : Fin 6, contains (CA1_6_9I2PairRaw ((1,2),(k,l))) (CA1_6_9I2PairP ((1,2),(k,l))) = true := by + decide +kernel +lemma CA1_6_9I2PairP_check_1_3 : ∀ k l : Fin 6, contains (CA1_6_9I2PairRaw ((1,3),(k,l))) (CA1_6_9I2PairP ((1,3),(k,l))) = true := by + decide +kernel +lemma CA1_6_9I2PairP_check_1_4 : ∀ k l : Fin 6, contains (CA1_6_9I2PairRaw ((1,4),(k,l))) (CA1_6_9I2PairP ((1,4),(k,l))) = true := by + decide +kernel +lemma CA1_6_9I2PairP_check_1_5 : ∀ k l : Fin 6, contains (CA1_6_9I2PairRaw ((1,5),(k,l))) (CA1_6_9I2PairP ((1,5),(k,l))) = true := by + decide +kernel +lemma CA1_6_9I2PairP_check_2_0 : ∀ k l : Fin 6, contains (CA1_6_9I2PairRaw ((2,0),(k,l))) (CA1_6_9I2PairP ((2,0),(k,l))) = true := by + decide +kernel +lemma CA1_6_9I2PairP_check_2_1 : ∀ k l : Fin 6, contains (CA1_6_9I2PairRaw ((2,1),(k,l))) (CA1_6_9I2PairP ((2,1),(k,l))) = true := by + decide +kernel +lemma CA1_6_9I2PairP_check_2_2 : ∀ k l : Fin 6, contains (CA1_6_9I2PairRaw ((2,2),(k,l))) (CA1_6_9I2PairP ((2,2),(k,l))) = true := by + decide +kernel +lemma CA1_6_9I2PairP_check_2_3 : ∀ k l : Fin 6, contains (CA1_6_9I2PairRaw ((2,3),(k,l))) (CA1_6_9I2PairP ((2,3),(k,l))) = true := by + decide +kernel +lemma CA1_6_9I2PairP_check_2_4 : ∀ k l : Fin 6, contains (CA1_6_9I2PairRaw ((2,4),(k,l))) (CA1_6_9I2PairP ((2,4),(k,l))) = true := by + decide +kernel +lemma CA1_6_9I2PairP_check_2_5 : ∀ k l : Fin 6, contains (CA1_6_9I2PairRaw ((2,5),(k,l))) (CA1_6_9I2PairP ((2,5),(k,l))) = true := by + decide +kernel +lemma CA1_6_9I2PairP_check_3_0 : ∀ k l : Fin 6, contains (CA1_6_9I2PairRaw ((3,0),(k,l))) (CA1_6_9I2PairP ((3,0),(k,l))) = true := by + decide +kernel +lemma CA1_6_9I2PairP_check_3_1 : ∀ k l : Fin 6, contains (CA1_6_9I2PairRaw ((3,1),(k,l))) (CA1_6_9I2PairP ((3,1),(k,l))) = true := by + decide +kernel +lemma CA1_6_9I2PairP_check_3_2 : ∀ k l : Fin 6, contains (CA1_6_9I2PairRaw ((3,2),(k,l))) (CA1_6_9I2PairP ((3,2),(k,l))) = true := by + decide +kernel +lemma CA1_6_9I2PairP_check_3_3 : ∀ k l : Fin 6, contains (CA1_6_9I2PairRaw ((3,3),(k,l))) (CA1_6_9I2PairP ((3,3),(k,l))) = true := by + decide +kernel +lemma CA1_6_9I2PairP_check_3_4 : ∀ k l : Fin 6, contains (CA1_6_9I2PairRaw ((3,4),(k,l))) (CA1_6_9I2PairP ((3,4),(k,l))) = true := by + decide +kernel +lemma CA1_6_9I2PairP_check_3_5 : ∀ k l : Fin 6, contains (CA1_6_9I2PairRaw ((3,5),(k,l))) (CA1_6_9I2PairP ((3,5),(k,l))) = true := by + decide +kernel +lemma CA1_6_9I2PairP_check_4_0 : ∀ k l : Fin 6, contains (CA1_6_9I2PairRaw ((4,0),(k,l))) (CA1_6_9I2PairP ((4,0),(k,l))) = true := by + decide +kernel +lemma CA1_6_9I2PairP_check_4_1 : ∀ k l : Fin 6, contains (CA1_6_9I2PairRaw ((4,1),(k,l))) (CA1_6_9I2PairP ((4,1),(k,l))) = true := by + decide +kernel +lemma CA1_6_9I2PairP_check_4_2 : ∀ k l : Fin 6, contains (CA1_6_9I2PairRaw ((4,2),(k,l))) (CA1_6_9I2PairP ((4,2),(k,l))) = true := by + decide +kernel +lemma CA1_6_9I2PairP_check_4_3 : ∀ k l : Fin 6, contains (CA1_6_9I2PairRaw ((4,3),(k,l))) (CA1_6_9I2PairP ((4,3),(k,l))) = true := by + decide +kernel +lemma CA1_6_9I2PairP_check_4_4 : ∀ k l : Fin 6, contains (CA1_6_9I2PairRaw ((4,4),(k,l))) (CA1_6_9I2PairP ((4,4),(k,l))) = true := by + decide +kernel +lemma CA1_6_9I2PairP_check_4_5 : ∀ k l : Fin 6, contains (CA1_6_9I2PairRaw ((4,5),(k,l))) (CA1_6_9I2PairP ((4,5),(k,l))) = true := by + decide +kernel +lemma CA1_6_9I2PairP_check_5_0 : ∀ k l : Fin 6, contains (CA1_6_9I2PairRaw ((5,0),(k,l))) (CA1_6_9I2PairP ((5,0),(k,l))) = true := by + decide +kernel +lemma CA1_6_9I2PairP_check_5_1 : ∀ k l : Fin 6, contains (CA1_6_9I2PairRaw ((5,1),(k,l))) (CA1_6_9I2PairP ((5,1),(k,l))) = true := by + decide +kernel +lemma CA1_6_9I2PairP_check_5_2 : ∀ k l : Fin 6, contains (CA1_6_9I2PairRaw ((5,2),(k,l))) (CA1_6_9I2PairP ((5,2),(k,l))) = true := by + decide +kernel +lemma CA1_6_9I2PairP_check_5_3 : ∀ k l : Fin 6, contains (CA1_6_9I2PairRaw ((5,3),(k,l))) (CA1_6_9I2PairP ((5,3),(k,l))) = true := by + decide +kernel +lemma CA1_6_9I2PairP_check_5_4 : ∀ k l : Fin 6, contains (CA1_6_9I2PairRaw ((5,4),(k,l))) (CA1_6_9I2PairP ((5,4),(k,l))) = true := by + decide +kernel +lemma CA1_6_9I2PairP_check_5_5 : ∀ k l : Fin 6, contains (CA1_6_9I2PairRaw ((5,5),(k,l))) (CA1_6_9I2PairP ((5,5),(k,l))) = true := by + decide +kernel +lemma CA1_6_9I2PairP_check (a : PairSlot × PairSlot) : contains (CA1_6_9I2PairRaw a) (CA1_6_9I2PairP a) = true := by + rcases a with ⟨⟨i,j⟩,⟨k,l⟩⟩ + revert j i + apply forall_fin6 + · exact forall_fin6 (CA1_6_9I2PairP_check_0_0 k l) (CA1_6_9I2PairP_check_0_1 k l) (CA1_6_9I2PairP_check_0_2 k l) (CA1_6_9I2PairP_check_0_3 k l) (CA1_6_9I2PairP_check_0_4 k l) (CA1_6_9I2PairP_check_0_5 k l) + · exact forall_fin6 (CA1_6_9I2PairP_check_1_0 k l) (CA1_6_9I2PairP_check_1_1 k l) (CA1_6_9I2PairP_check_1_2 k l) (CA1_6_9I2PairP_check_1_3 k l) (CA1_6_9I2PairP_check_1_4 k l) (CA1_6_9I2PairP_check_1_5 k l) + · exact forall_fin6 (CA1_6_9I2PairP_check_2_0 k l) (CA1_6_9I2PairP_check_2_1 k l) (CA1_6_9I2PairP_check_2_2 k l) (CA1_6_9I2PairP_check_2_3 k l) (CA1_6_9I2PairP_check_2_4 k l) (CA1_6_9I2PairP_check_2_5 k l) + · exact forall_fin6 (CA1_6_9I2PairP_check_3_0 k l) (CA1_6_9I2PairP_check_3_1 k l) (CA1_6_9I2PairP_check_3_2 k l) (CA1_6_9I2PairP_check_3_3 k l) (CA1_6_9I2PairP_check_3_4 k l) (CA1_6_9I2PairP_check_3_5 k l) + · exact forall_fin6 (CA1_6_9I2PairP_check_4_0 k l) (CA1_6_9I2PairP_check_4_1 k l) (CA1_6_9I2PairP_check_4_2 k l) (CA1_6_9I2PairP_check_4_3 k l) (CA1_6_9I2PairP_check_4_4 k l) (CA1_6_9I2PairP_check_4_5 k l) + · exact forall_fin6 (CA1_6_9I2PairP_check_5_0 k l) (CA1_6_9I2PairP_check_5_1 k l) (CA1_6_9I2PairP_check_5_2 k l) (CA1_6_9I2PairP_check_5_3 k l) (CA1_6_9I2PairP_check_5_4 k l) (CA1_6_9I2PairP_check_5_5 k l) +lemma CA1_6_9I2PairP_sound (a : PairSlot × PairSlot) : + (CA1_6_9I2PairP a).Encloses (CA1_6_9I2PairValue a) := + contains_sound (CA1_6_9I2PairRaw_sound a) (CA1_6_9I2PairP_check a) +def CA1_6_9I2PairTerms (a : PairSlot × PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_6_9I2PairCertificates (CA1_6_9I2PairCertificateIndex a)).output +lemma CA1_6_9I2PairTerms_sound (a : PairSlot × PairSlot) : + (CA1_6_9I2PairTerms a).Encloses (Foundation.entropyTerm (CA1_6_9I2PairValue a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_6_9I2PairCertificates_valid + (CA1_6_9I2PairCertificateIndex a) (CA1_6_9I2PairP_sound a) +def CA1_6_9I2PairEntropy : Ball := ⟨(3891016477355924693202053046363 / 1250000000000000000000000000000), (30716599161 / 25000000000000000000000000000000)⟩ +lemma CA1_6_9I2PairEntropy_sound : CA1_6_9I2PairEntropy.Encloses (Foundation.finiteEntropy CA1_6_9I2PairValue) := by + exact contains_sound (entropyDoublePair_enclosed CA1_6_9I2PairValue CA1_6_9I2PairTerms CA1_6_9I2PairTerms_sound) (by decide +kernel) +def CA1_6_9I2PairMass : Ball := ⟨(25000000000000000000000000000001 / 25000000000000000000000000000000), (141 / 25000000000000000000000000000000)⟩ +lemma CA1_6_9I2PairMass_sound : CA1_6_9I2PairMass.Encloses (∑ a, CA1_6_9I2PairValue a) := by + exact contains_sound (doublePairSumBall_sound CA1_6_9I2PairP CA1_6_9I2PairValue CA1_6_9I2PairP_sound) (by decide +kernel) +def CA1_6_9I2PairMassTermLogWitness : LogWitness := ⟨0, 25000000000000000000000000000001, 25000000000000000000000000000000⟩ +def CA1_6_9I2PairMassTermLog : Ball := ⟨(1 / 25000000000000000000000000000000), (10587912123 / 50000000000000000000000000000000)⟩ +lemma CA1_6_9I2PairMassTermLog_sound : CA1_6_9I2PairMassTermLog.Encloses (Real.log ((∑ a, CA1_6_9I2PairValue a))) := by + exact checkLog_sound logTwoBall_sound (CA1_6_9I2PairMass_sound) (w := CA1_6_9I2PairMassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA1_6_9I2PairMassTerm : Ball := ⟨(-1 / 25000000000000000000000000000000), (21175824247 / 100000000000000000000000000000000)⟩ +lemma CA1_6_9I2PairMassTerm_sound : CA1_6_9I2PairMassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_6_9I2PairValue a))) := by + exact contains_sound (entropyTerm_ball (CA1_6_9I2PairMass_sound) CA1_6_9I2PairMassTermLog_sound) (by decide +kernel) +def CA1_6_9I2PairH : Ball := ⟨(77820329547118493864041060927261 / 25000000000000000000000000000000), (144042220891 / 100000000000000000000000000000000)⟩ +lemma CA1_6_9I2PairH_sound : CA1_6_9I2PairH.Encloses (homogeneousEntropy CA1_6_9I2PairValue) := by + exact contains_sound (homogeneous_enclosed CA1_6_9I2PairValue CA1_6_9I2PairMassTerm_sound CA1_6_9I2PairEntropy_sound) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA1_7_8I0.lean b/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA1_7_8I0.lean new file mode 100644 index 0000000000000000000000000000000000000000..b2e3535a52ecbc83e59332e36a285c4b33d7d7ea --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA1_7_8I0.lean @@ -0,0 +1,72 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Certificates.SplitA1_7_8 + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CA1_7_8I0Value (a : Fin 17) : ℝ := marginal (below (shape 1 7 8)) (fun u => (stageALaw (shape 1 7 8) u : ℝ)) ((Equiv.refl (Fin 3)) 0) a +def CA1_7_8I0Raw (a : Fin 17) : Ball := marginalBall (below (shape 1 7 8)) A1_7_8Law ((Equiv.refl (Fin 3)) 0) a +lemma CA1_7_8I0Raw_sound (a : Fin 17) : + (CA1_7_8I0Raw a).Encloses (CA1_7_8I0Value a) := by + exact marginalBall_sound (below (shape 1 7 8)) A1_7_8Law (fun u => (stageALaw (shape 1 7 8) u : ℝ)) (fun u _ => A1_7_8Law_sound u) ((Equiv.refl (Fin 3)) 0) a +def CA1_7_8I0Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(50000000000000000000000000000001 / 100000000000000000000000000000000), (69 / 100000000000000000000000000000000)⟩ ⟨(6931471805599453094172319305033 / 20000000000000000000000000000000), (105879119 / 500000000000000000000000000000)⟩ ⟨(-8664339756999316367715399131291 / 12500000000000000000000000000000), (42351647503 / 100000000000000000000000000000000)⟩ ⟨-1, 50000000000000000000000000000001, 50000000000000000000000000000000⟩] +lemma CA1_7_8I0Certificates_valid : + CA1_7_8I0Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_7_8I0CertificateIndex (a : Fin 17) : ℕ := + match a.val with + | 0 => 1 + | 1 => 1 + | _ => 0 +def CA1_7_8I0P (a : Fin 17) : Ball := + (CompactCertificate.entropyLookup CA1_7_8I0Certificates (CA1_7_8I0CertificateIndex a)).input +lemma CA1_7_8I0P_check : ∀ a : Fin 17, contains (CA1_7_8I0Raw a) (CA1_7_8I0P a) = true := by + decide +kernel +lemma CA1_7_8I0P_sound (a : Fin 17) : + (CA1_7_8I0P a).Encloses (CA1_7_8I0Value a) := + contains_sound (CA1_7_8I0Raw_sound a) (CA1_7_8I0P_check a) +def CA1_7_8I0Terms (a : Fin 17) : Ball := + (CompactCertificate.entropyLookup CA1_7_8I0Certificates (CA1_7_8I0CertificateIndex a)).output +lemma CA1_7_8I0Terms_sound (a : Fin 17) : + (CA1_7_8I0Terms a).Encloses (Foundation.entropyTerm (CA1_7_8I0Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_7_8I0Certificates_valid + (CA1_7_8I0CertificateIndex a) (CA1_7_8I0P_sound a) +def CA1_7_8I0Entropy : Ball := ⟨(6931471805599453094172319305033 / 10000000000000000000000000000000), (105879119 / 250000000000000000000000000000)⟩ +lemma CA1_7_8I0Entropy_sound : CA1_7_8I0Entropy.Encloses (Foundation.finiteEntropy CA1_7_8I0Value) := by + exact contains_sound (entropyFin_enclosed 17 CA1_7_8I0Value CA1_7_8I0Terms CA1_7_8I0Terms_sound) (by decide +kernel) +def CA1_7_8I0Mass : Ball := ⟨(50000000000000000000000000000001 / 50000000000000000000000000000000), (69 / 50000000000000000000000000000000)⟩ +lemma CA1_7_8I0Mass_sound : CA1_7_8I0Mass.Encloses (∑ a, CA1_7_8I0Value a) := by + exact contains_sound (finSumBall_sound 17 CA1_7_8I0P CA1_7_8I0Value CA1_7_8I0P_sound) (by decide +kernel) +def CA1_7_8I0MassTermLogWitness : LogWitness := ⟨0, 50000000000000000000000000000001, 50000000000000000000000000000000⟩ +def CA1_7_8I0MassTermLog : Ball := ⟨(1 / 50000000000000000000000000000000), (1058791191 / 5000000000000000000000000000000)⟩ +lemma CA1_7_8I0MassTermLog_sound : CA1_7_8I0MassTermLog.Encloses (Real.log ((∑ a, CA1_7_8I0Value a))) := by + exact checkLog_sound logTwoBall_sound (CA1_7_8I0Mass_sound) (w := CA1_7_8I0MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA1_7_8I0MassTerm : Ball := ⟨(-1 / 50000000000000000000000000000000), (21175823821 / 100000000000000000000000000000000)⟩ +lemma CA1_7_8I0MassTerm_sound : CA1_7_8I0MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_7_8I0Value a))) := by + exact contains_sound (entropyTerm_ball (CA1_7_8I0Mass_sound) CA1_7_8I0MassTermLog_sound) (by decide +kernel) +def CA1_7_8I0H : Ball := ⟨(17328679513998632735430798262583 / 25000000000000000000000000000000), (63527471421 / 100000000000000000000000000000000)⟩ +lemma CA1_7_8I0H_sound : CA1_7_8I0H.Encloses (homogeneousEntropy CA1_7_8I0Value) := by + exact contains_sound (homogeneous_enclosed CA1_7_8I0Value CA1_7_8I0MassTerm_sound CA1_7_8I0Entropy_sound) (by decide +kernel) +lemma CA1_7_8I0_sound : CA1_7_8I0H.Encloses (stageACapacity (shape 1 7 8) 0) := by + exact CA1_7_8I0H_sound + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA1_7_8I1.lean b/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA1_7_8I1.lean new file mode 100644 index 0000000000000000000000000000000000000000..2a0b9eec200cb2054dcd58941f5999ec4edfde2d --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA1_7_8I1.lean @@ -0,0 +1,860 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.CapacityA.CapA1_7_8I1Pair + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CA1_7_8I1R0Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 7 8)) (fun u => (stageALaw (shape 1 7 8) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 0 a +def CA1_7_8I1R0Raw (a : PairSlot) : Ball := residualBall (below (shape 1 7 8)) A1_7_8Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 0 a +lemma CA1_7_8I1R0Raw_sound (a : PairSlot) : + (CA1_7_8I1R0Raw a).Encloses (CA1_7_8I1R0Value a) := by + exact residualBall_sound_on (below (shape 1 7 8)) A1_7_8Law (fun u => (stageALaw (shape 1 7 8) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A1_7_8Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 7 8) (show (shape 1 7 8) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 0 a +def CA1_7_8I1R0Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(584532371534609447407610401 / 100000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ ⟨(7043538258496618443777008947 / 100000000000000000000000000000000), (1175919 / 50000000000000000000000000000000)⟩ ⟨(-1204986858128109531200624689824771 / 100000000000000000000000000000000), (40234099213 / 10000000000000000000000000000000)⟩ ⟨-18, 584532371534609447407610401, 381469726562500000000000000⟩] +lemma CA1_7_8I1R0Certificates_valid : + CA1_7_8I1R0Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_7_8I1R0CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 0, 0 => 1 + | _, _ => 0 +def CA1_7_8I1R0P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_7_8I1R0Certificates (CA1_7_8I1R0CertificateIndex a)).input +lemma CA1_7_8I1R0P_check : ∀ a : PairSlot, contains (CA1_7_8I1R0Raw a) (CA1_7_8I1R0P a) = true := by + decide +kernel +lemma CA1_7_8I1R0P_sound (a : PairSlot) : + (CA1_7_8I1R0P a).Encloses (CA1_7_8I1R0Value a) := + contains_sound (CA1_7_8I1R0Raw_sound a) (CA1_7_8I1R0P_check a) +def CA1_7_8I1R0Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_7_8I1R0Certificates (CA1_7_8I1R0CertificateIndex a)).output +lemma CA1_7_8I1R0Terms_sound (a : PairSlot) : + (CA1_7_8I1R0Terms a).Encloses (Foundation.entropyTerm (CA1_7_8I1R0Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_7_8I1R0Certificates_valid + (CA1_7_8I1R0CertificateIndex a) (CA1_7_8I1R0P_sound a) +def CA1_7_8I1R0Entropy : Ball := ⟨(7043538258496618443777008947 / 100000000000000000000000000000000), (1175919 / 50000000000000000000000000000000)⟩ +lemma CA1_7_8I1R0Entropy_sound : CA1_7_8I1R0Entropy.Encloses (Foundation.finiteEntropy CA1_7_8I1R0Value) := by + exact contains_sound (entropyPair_enclosed CA1_7_8I1R0Value CA1_7_8I1R0Terms CA1_7_8I1R0Terms_sound) (by decide +kernel) +def CA1_7_8I1R0Mass : Ball := ⟨(584532371534609447407610401 / 100000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ +lemma CA1_7_8I1R0Mass_sound : CA1_7_8I1R0Mass.Encloses (∑ a, CA1_7_8I1R0Value a) := by + exact contains_sound (pairSumBall_sound CA1_7_8I1R0P CA1_7_8I1R0Value CA1_7_8I1R0P_sound) (by decide +kernel) +def CA1_7_8I1R0MassTermLogWitness : LogWitness := ⟨-18, 584532371534609447407610401, 381469726562500000000000000⟩ +def CA1_7_8I1R0MassTermLog : Ball := ⟨(-1204986858128109531200624689824771 / 100000000000000000000000000000000), (40234099213 / 10000000000000000000000000000000)⟩ +lemma CA1_7_8I1R0MassTermLog_sound : CA1_7_8I1R0MassTermLog.Encloses (Real.log ((∑ a, CA1_7_8I1R0Value a))) := by + exact checkLog_sound logTwoBall_sound (CA1_7_8I1R0Mass_sound) (w := CA1_7_8I1R0MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA1_7_8I1R0MassTerm : Ball := ⟨(7043538258496618443777008947 / 100000000000000000000000000000000), (1175919 / 50000000000000000000000000000000)⟩ +lemma CA1_7_8I1R0MassTerm_sound : CA1_7_8I1R0MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_7_8I1R0Value a))) := by + exact contains_sound (entropyTerm_ball (CA1_7_8I1R0Mass_sound) CA1_7_8I1R0MassTermLog_sound) (by decide +kernel) +def CA1_7_8I1R0H : Ball := ⟨0, (1175919 / 25000000000000000000000000000000)⟩ +lemma CA1_7_8I1R0H_sound : CA1_7_8I1R0H.Encloses (homogeneousEntropy CA1_7_8I1R0Value) := by + exact contains_sound (homogeneous_enclosed CA1_7_8I1R0Value CA1_7_8I1R0MassTerm_sound CA1_7_8I1R0Entropy_sound) (by decide +kernel) +def CA1_7_8I1R1Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 7 8)) (fun u => (stageALaw (shape 1 7 8) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 1 a +def CA1_7_8I1R1Raw (a : PairSlot) : Ball := residualBall (below (shape 1 7 8)) A1_7_8Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 1 a +lemma CA1_7_8I1R1Raw_sound (a : PairSlot) : + (CA1_7_8I1R1Raw a).Encloses (CA1_7_8I1R1Value a) := by + exact residualBall_sound_on (below (shape 1 7 8)) A1_7_8Law (fun u => (stageALaw (shape 1 7 8) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A1_7_8Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 7 8) (show (shape 1 7 8) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 1 a +def CA1_7_8I1R1Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(37035762938464593102856286141 / 50000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ ⟨(533899727137404610567259234731 / 100000000000000000000000000000000), (94111543 / 50000000000000000000000000000000)⟩ ⟨(-28831577090742589774638387234999 / 4000000000000000000000000000000), (15881867931 / 6250000000000000000000000000000)⟩ ⟨-11, 37035762938464593102856286141, 24414062500000000000000000000⟩] +lemma CA1_7_8I1R1Certificates_valid : + CA1_7_8I1R1Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_7_8I1R1CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 1, 0 => 1 + | 0, 1 => 1 + | _, _ => 0 +def CA1_7_8I1R1P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_7_8I1R1Certificates (CA1_7_8I1R1CertificateIndex a)).input +lemma CA1_7_8I1R1P_check : ∀ a : PairSlot, contains (CA1_7_8I1R1Raw a) (CA1_7_8I1R1P a) = true := by + decide +kernel +lemma CA1_7_8I1R1P_sound (a : PairSlot) : + (CA1_7_8I1R1P a).Encloses (CA1_7_8I1R1Value a) := + contains_sound (CA1_7_8I1R1Raw_sound a) (CA1_7_8I1R1P_check a) +def CA1_7_8I1R1Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_7_8I1R1Certificates (CA1_7_8I1R1CertificateIndex a)).output +lemma CA1_7_8I1R1Terms_sound (a : PairSlot) : + (CA1_7_8I1R1Terms a).Encloses (Foundation.entropyTerm (CA1_7_8I1R1Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_7_8I1R1Certificates_valid + (CA1_7_8I1R1CertificateIndex a) (CA1_7_8I1R1P_sound a) +def CA1_7_8I1R1Entropy : Ball := ⟨(533899727137404610567259234731 / 50000000000000000000000000000000), (94111543 / 25000000000000000000000000000000)⟩ +lemma CA1_7_8I1R1Entropy_sound : CA1_7_8I1R1Entropy.Encloses (Foundation.finiteEntropy CA1_7_8I1R1Value) := by + exact contains_sound (entropyPair_enclosed CA1_7_8I1R1Value CA1_7_8I1R1Terms CA1_7_8I1R1Terms_sound) (by decide +kernel) +def CA1_7_8I1R1Mass : Ball := ⟨(37035762938464593102856286141 / 25000000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ +lemma CA1_7_8I1R1Mass_sound : CA1_7_8I1R1Mass.Encloses (∑ a, CA1_7_8I1R1Value a) := by + exact contains_sound (pairSumBall_sound CA1_7_8I1R1P CA1_7_8I1R1Value CA1_7_8I1R1P_sound) (by decide +kernel) +def CA1_7_8I1R1MassTermLogWitness : LogWitness := ⟨-10, 37035762938464593102856286141, 24414062500000000000000000000⟩ +def CA1_7_8I1R1MassTermLog : Ball := ⟨(-130294941842514042684847297564929 / 20000000000000000000000000000000), (232934063213 / 100000000000000000000000000000000)⟩ +lemma CA1_7_8I1R1MassTermLog_sound : CA1_7_8I1R1MassTermLog.Encloses (Real.log ((∑ a, CA1_7_8I1R1Value a))) := by + exact checkLog_sound logTwoBall_sound (CA1_7_8I1R1Mass_sound) (w := CA1_7_8I1R1MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA1_7_8I1R1MassTerm : Ball := ⟨(965114515632076229225822100971 / 100000000000000000000000000000000), (345075657 / 100000000000000000000000000000000)⟩ +lemma CA1_7_8I1R1MassTerm_sound : CA1_7_8I1R1MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_7_8I1R1Value a))) := by + exact contains_sound (entropyTerm_ball (CA1_7_8I1R1Mass_sound) CA1_7_8I1R1MassTermLog_sound) (by decide +kernel) +def CA1_7_8I1R1H : Ball := ⟨(102684938642732991908696368491 / 100000000000000000000000000000000), (721521829 / 100000000000000000000000000000000)⟩ +lemma CA1_7_8I1R1H_sound : CA1_7_8I1R1H.Encloses (homogeneousEntropy CA1_7_8I1R1Value) := by + exact contains_sound (homogeneous_enclosed CA1_7_8I1R1Value CA1_7_8I1R1MassTerm_sound CA1_7_8I1R1Entropy_sound) (by decide +kernel) +def CA1_7_8I1R2Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 7 8)) (fun u => (stageALaw (shape 1 7 8) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 2 a +def CA1_7_8I1R2Raw (a : PairSlot) : Ball := residualBall (below (shape 1 7 8)) A1_7_8Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 2 a +lemma CA1_7_8I1R2Raw_sound (a : PairSlot) : + (CA1_7_8I1R2Raw a).Encloses (CA1_7_8I1R2Value a) := by + exact residualBall_sound_on (below (shape 1 7 8)) A1_7_8Law (fun u => (stageALaw (shape 1 7 8) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A1_7_8Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 7 8) (show (shape 1 7 8) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 2 a +def CA1_7_8I1R2Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(191222039936786006968920366603 / 20000000000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ ⟨(889192484118741395146123232667 / 20000000000000000000000000000000), (404928429 / 25000000000000000000000000000000)⟩ ⟨(-116251307173154539090529363913951 / 25000000000000000000000000000000), (169406590091 / 100000000000000000000000000000000)⟩ ⟨-7, 191222039936786006968920366603, 156250000000000000000000000000⟩, + .log ⟨(99733771788650035743636910389 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(344601181037491046007893380543 / 50000000000000000000000000000000), (232313933 / 100000000000000000000000000000000)⟩ ⟨(-691042111127110831503848470013037 / 100000000000000000000000000000000), (46586812303 / 20000000000000000000000000000000)⟩ ⟨-10, 99733771788650035743636910389, 97656250000000000000000000000⟩, + .log ⟨(893074147967023893622413206403 / 25000000000000000000000000000000), (3 / 20000000000000000000000000000000)⟩ ⟨(11902754689191070752310359424387 / 100000000000000000000000000000000), (567347429 / 12500000000000000000000000000000)⟩ ⟨(-333196149398296411637838059992123 / 100000000000000000000000000000000), (127054942517 / 100000000000000000000000000000000)⟩ ⟨-5, 893074147967023893622413206403, 781250000000000000000000000000⟩] +lemma CA1_7_8I1R2Certificates_valid : + CA1_7_8I1R2Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_7_8I1R2CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 2, 0 => 1 + | 3, 0 => 2 + | 1, 1 => 3 + | 0, 2 => 1 + | 0, 3 => 2 + | _, _ => 0 +def CA1_7_8I1R2P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_7_8I1R2Certificates (CA1_7_8I1R2CertificateIndex a)).input +lemma CA1_7_8I1R2P_check : ∀ a : PairSlot, contains (CA1_7_8I1R2Raw a) (CA1_7_8I1R2P a) = true := by + decide +kernel +lemma CA1_7_8I1R2P_sound (a : PairSlot) : + (CA1_7_8I1R2P a).Encloses (CA1_7_8I1R2Value a) := + contains_sound (CA1_7_8I1R2Raw_sound a) (CA1_7_8I1R2P_check a) +def CA1_7_8I1R2Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_7_8I1R2Certificates (CA1_7_8I1R2CertificateIndex a)).output +lemma CA1_7_8I1R2Terms_sound (a : PairSlot) : + (CA1_7_8I1R2Terms a).Encloses (Foundation.entropyTerm (CA1_7_8I1R2Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_7_8I1R2Certificates_valid + (CA1_7_8I1R2CertificateIndex a) (CA1_7_8I1R2P_sound a) +def CA1_7_8I1R2Entropy : Ball := ⟨(22173084254528448887803165273229 / 100000000000000000000000000000000), (824283473 / 10000000000000000000000000000000)⟩ +lemma CA1_7_8I1R2Entropy_sound : CA1_7_8I1R2Entropy.Encloses (Foundation.finiteEntropy CA1_7_8I1R2Value) := by + exact contains_sound (entropyPair_enclosed CA1_7_8I1R2Value CA1_7_8I1R2Terms CA1_7_8I1R2Terms_sound) (by decide +kernel) +def CA1_7_8I1R2Mass : Ball := ⟨(284199226740662785783306515621 / 5000000000000000000000000000000), (29 / 100000000000000000000000000000000)⟩ +lemma CA1_7_8I1R2Mass_sound : CA1_7_8I1R2Mass.Encloses (∑ a, CA1_7_8I1R2Value a) := by + exact contains_sound (pairSumBall_sound CA1_7_8I1R2P CA1_7_8I1R2Value CA1_7_8I1R2P_sound) (by decide +kernel) +def CA1_7_8I1R2MassTermLogWitness : LogWitness := ⟨-5, 284199226740662785783306515621, 156250000000000000000000000000⟩ +def CA1_7_8I1R2MassTermLog : Ball := ⟨(-286751769658500763880690399379981 / 100000000000000000000000000000000), (7940933913 / 6250000000000000000000000000000)⟩ +lemma CA1_7_8I1R2MassTermLog_sound : CA1_7_8I1R2MassTermLog.Encloses (Real.log ((∑ a, CA1_7_8I1R2Value a))) := by + exact checkLog_sound logTwoBall_sound (CA1_7_8I1R2Mass_sound) (w := CA1_7_8I1R2MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA1_7_8I1R2MassTerm : Ball := ⟨(3259785248138502638354366883571 / 20000000000000000000000000000000), (7221783373 / 100000000000000000000000000000000)⟩ +lemma CA1_7_8I1R2MassTerm_sound : CA1_7_8I1R2MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_7_8I1R2Value a))) := by + exact contains_sound (entropyTerm_ball (CA1_7_8I1R2Mass_sound) CA1_7_8I1R2MassTermLog_sound) (by decide +kernel) +def CA1_7_8I1R2H : Ball := ⟨(2937079006917967848015665427687 / 50000000000000000000000000000000), (15464618103 / 100000000000000000000000000000000)⟩ +lemma CA1_7_8I1R2H_sound : CA1_7_8I1R2H.Encloses (homogeneousEntropy CA1_7_8I1R2Value) := by + exact contains_sound (homogeneous_enclosed CA1_7_8I1R2Value CA1_7_8I1R2MassTerm_sound CA1_7_8I1R2Entropy_sound) (by decide +kernel) +def CA1_7_8I1R3Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 7 8)) (fun u => (stageALaw (shape 1 7 8) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 3 a +def CA1_7_8I1R3Raw (a : PairSlot) : Ball := residualBall (below (shape 1 7 8)) A1_7_8Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 3 a +lemma CA1_7_8I1R3Raw_sound (a : PairSlot) : + (CA1_7_8I1R3Raw a).Encloses (CA1_7_8I1R3Value a) := by + exact residualBall_sound_on (below (shape 1 7 8)) A1_7_8Law (fun u => (stageALaw (shape 1 7 8) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A1_7_8Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 7 8) (show (shape 1 7 8) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 3 a +def CA1_7_8I1R3Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(23755725364738632673182145927 / 3125000000000000000000000000000), (1 / 20000000000000000000000000000000)⟩ ⟨(92730302782309864385551828973 / 2500000000000000000000000000000), (72438777 / 5000000000000000000000000000000)⟩ ⟨(-487936599275307531018982220159061 / 100000000000000000000000000000000), (38116482761 / 20000000000000000000000000000000)⟩ ⟨-8, 23755725364738632673182145927, 12207031250000000000000000000⟩, + .log ⟨(19452192305358146935978508749949 / 100000000000000000000000000000000), (19 / 50000000000000000000000000000000)⟩ ⟨(31847331688048502861394488834571 / 100000000000000000000000000000000), (16476647881 / 100000000000000000000000000000000)⟩ ⟨(-40930260183676172240128151715623 / 25000000000000000000000000000000), (84703294927 / 100000000000000000000000000000000)⟩ ⟨-3, 19452192305358146935978508749949, 12500000000000000000000000000000⟩, + .log ⟨(935634211750446234858590523347 / 50000000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ ⟨(7444941879560739999523215666747 / 100000000000000000000000000000000), (554759107 / 20000000000000000000000000000000)⟩ ⟨(-79571073674531966587660539103193 / 20000000000000000000000000000000), (74115382997 / 50000000000000000000000000000000)⟩ ⟨-6, 935634211750446234858590523347, 781250000000000000000000000000⟩] +lemma CA1_7_8I1R3Certificates_valid : + CA1_7_8I1R3Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_7_8I1R3CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 4, 0 => 1 + | 2, 1 => 2 + | 3, 1 => 3 + | 1, 2 => 2 + | 1, 3 => 3 + | 0, 4 => 1 + | _, _ => 0 +def CA1_7_8I1R3P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_7_8I1R3Certificates (CA1_7_8I1R3CertificateIndex a)).input +lemma CA1_7_8I1R3P_check : ∀ a : PairSlot, contains (CA1_7_8I1R3Raw a) (CA1_7_8I1R3P a) = true := by + decide +kernel +lemma CA1_7_8I1R3P_sound (a : PairSlot) : + (CA1_7_8I1R3P a).Encloses (CA1_7_8I1R3Value a) := + contains_sound (CA1_7_8I1R3Raw_sound a) (CA1_7_8I1R3P_check a) +def CA1_7_8I1R3Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_7_8I1R3Certificates (CA1_7_8I1R3CertificateIndex a)).output +lemma CA1_7_8I1R3Terms_sound (a : PairSlot) : + (CA1_7_8I1R3Terms a).Encloses (Foundation.entropyTerm (CA1_7_8I1R3Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_7_8I1R3Certificates_valid + (CA1_7_8I1R3CertificateIndex a) (CA1_7_8I1R3P_sound a) +def CA1_7_8I1R3Entropy : Ball := ⟨(21500742839450818718169888830119 / 25000000000000000000000000000000), (5174804739 / 12500000000000000000000000000000)⟩ +lemma CA1_7_8I1R3Entropy_sound : CA1_7_8I1R3Entropy.Encloses (Foundation.finiteEntropy CA1_7_8I1R3Value) := by + exact contains_sound (entropyPair_enclosed CA1_7_8I1R3Value CA1_7_8I1R3Terms CA1_7_8I1R3Terms_sound) (by decide +kernel) +def CA1_7_8I1R3Mass : Ball := ⟨(22083643940530675651237518466307 / 50000000000000000000000000000000), (47 / 50000000000000000000000000000000)⟩ +lemma CA1_7_8I1R3Mass_sound : CA1_7_8I1R3Mass.Encloses (∑ a, CA1_7_8I1R3Value a) := by + exact contains_sound (pairSumBall_sound CA1_7_8I1R3P CA1_7_8I1R3Value CA1_7_8I1R3P_sound) (by decide +kernel) +def CA1_7_8I1R3MassTermLogWitness : LogWitness := ⟨-2, 22083643940530675651237518466307, 12500000000000000000000000000000⟩ +def CA1_7_8I1R3MassTermLog : Ball := ⟨(-81718576409726083693032108385419 / 100000000000000000000000000000000), (31763735631 / 50000000000000000000000000000000)⟩ +lemma CA1_7_8I1R3MassTermLog_sound : CA1_7_8I1R3MassTermLog.Encloses (Real.log ((∑ a, CA1_7_8I1R3Value a))) := by + exact checkLog_sound logTwoBall_sound (CA1_7_8I1R3Mass_sound) (w := CA1_7_8I1R3MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA1_7_8I1R3MassTerm : Ball := ⟨(9023219723797202219809978218521 / 25000000000000000000000000000000), (28058361193 / 100000000000000000000000000000000)⟩ +lemma CA1_7_8I1R3MassTerm_sound : CA1_7_8I1R3MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_7_8I1R3Value a))) := by + exact contains_sound (entropyTerm_ball (CA1_7_8I1R3Mass_sound) CA1_7_8I1R3MassTermLog_sound) (by decide +kernel) +def CA1_7_8I1R3H : Ball := ⟨(6238761557826808249179955305799 / 12500000000000000000000000000000), (13891359821 / 20000000000000000000000000000000)⟩ +lemma CA1_7_8I1R3H_sound : CA1_7_8I1R3H.Encloses (homogeneousEntropy CA1_7_8I1R3Value) := by + exact contains_sound (homogeneous_enclosed CA1_7_8I1R3Value CA1_7_8I1R3MassTerm_sound CA1_7_8I1R3Entropy_sound) (by decide +kernel) +def CA1_7_8I1R4Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 7 8)) (fun u => (stageALaw (shape 1 7 8) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 4 a +def CA1_7_8I1R4Raw (a : PairSlot) : Ball := residualBall (below (shape 1 7 8)) A1_7_8Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 4 a +lemma CA1_7_8I1R4Raw_sound (a : PairSlot) : + (CA1_7_8I1R4Raw a).Encloses (CA1_7_8I1R4Value a) := by + exact residualBall_sound_on (below (shape 1 7 8)) A1_7_8Law (fun u => (stageALaw (shape 1 7 8) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A1_7_8Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 7 8) (show (shape 1 7 8) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 4 a +def CA1_7_8I1R4Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(15627028006695398584059032451 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(230580833894447540330567428909 / 50000000000000000000000000000000), (1588393 / 1000000000000000000000000000000)⟩ ⟨(-737762912422167558497093805111299 / 100000000000000000000000000000000), (50821977159 / 20000000000000000000000000000000)⟩ ⟨-11, 15627028006695398584059032451, 12207031250000000000000000000⟩, + .log ⟨(2473098266048731246033486140617 / 50000000000000000000000000000000), (3 / 20000000000000000000000000000000)⟩ ⟨(7435496762584514584666307602159 / 50000000000000000000000000000000), (6284387201 / 100000000000000000000000000000000)⟩ ⟨(-300655128211472434651138191805343 / 100000000000000000000000000000000), (127054942401 / 100000000000000000000000000000000)⟩ ⟨-5, 2473098266048731246033486140617, 1562500000000000000000000000000⟩, + .log ⟨(28955837401340539615145743394389 / 100000000000000000000000000000000), (69 / 100000000000000000000000000000000)⟩ ⟨(17943908765390744531566152093057 / 50000000000000000000000000000000), (18394911377 / 100000000000000000000000000000000)⟩ ⟨(-123939836494316087214867202179321 / 100000000000000000000000000000000), (31763735643 / 50000000000000000000000000000000)⟩ ⟨-2, 28955837401340539615145743394389, 25000000000000000000000000000000⟩, + .log ⟨(311323194051302437148547523701 / 12500000000000000000000000000000), (1 / 12500000000000000000000000000000)⟩ ⟨(459843328596575980405811384097 / 5000000000000000000000000000000), (147672563 / 4000000000000000000000000000000)⟩ ⟨(-369265234154702230875504734955431 / 100000000000000000000000000000000), (74115383051 / 50000000000000000000000000000000)⟩ ⟨-6, 311323194051302437148547523701, 195312500000000000000000000000⟩, + .log ⟨(42574017330296904029223267387 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(1309628587183769853925035297047 / 100000000000000000000000000000000), (9015399 / 2000000000000000000000000000000)⟩ ⟨(-76903042589535015149302725245349 / 12500000000000000000000000000000), (211758237299 / 100000000000000000000000000000000)⟩ ⟨-9, 42574017330296904029223267387, 39062500000000000000000000000⟩] +lemma CA1_7_8I1R4Certificates_valid : + CA1_7_8I1R4Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_7_8I1R4CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 0, 5 => 1 + | 1, 4 => 2 + | 2, 2 => 3 + | 2, 3 => 4 + | 3, 2 => 4 + | 3, 3 => 5 + | 4, 1 => 2 + | 5, 0 => 1 + | _, _ => 0 +def CA1_7_8I1R4P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_7_8I1R4Certificates (CA1_7_8I1R4CertificateIndex a)).input +lemma CA1_7_8I1R4P_check : ∀ a : PairSlot, contains (CA1_7_8I1R4Raw a) (CA1_7_8I1R4P a) = true := by + decide +kernel +lemma CA1_7_8I1R4P_sound (a : PairSlot) : + (CA1_7_8I1R4P a).Encloses (CA1_7_8I1R4Value a) := + contains_sound (CA1_7_8I1R4Raw_sound a) (CA1_7_8I1R4P_check a) +def CA1_7_8I1R4Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_7_8I1R4Certificates (CA1_7_8I1R4CertificateIndex a)).output +lemma CA1_7_8I1R4Terms_sound (a : PairSlot) : + (CA1_7_8I1R4Terms a).Encloses (Foundation.entropyTerm (CA1_7_8I1R4Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_7_8I1R4Certificates_valid + (CA1_7_8I1R4CertificateIndex a) (CA1_7_8I1R4P_sound a) +def CA1_7_8I1R4Entropy : Ball := ⟨(86255489647744146633277294971313 / 100000000000000000000000000000000), (39115762479 / 100000000000000000000000000000000)⟩ +lemma CA1_7_8I1R4Entropy_sound : CA1_7_8I1R4Entropy.Encloses (Foundation.finiteEntropy CA1_7_8I1R4Value) := by + exact contains_sound (entropyPair_enclosed CA1_7_8I1R4Value CA1_7_8I1R4Terms CA1_7_8I1R4Terms_sound) (by decide +kernel) +def CA1_7_8I1R4Mass : Ball := ⟨(5520910985132668912809379616577 / 12500000000000000000000000000000), (59 / 50000000000000000000000000000000)⟩ +lemma CA1_7_8I1R4Mass_sound : CA1_7_8I1R4Mass.Encloses (∑ a, CA1_7_8I1R4Value a) := by + exact contains_sound (pairSumBall_sound CA1_7_8I1R4P CA1_7_8I1R4Value CA1_7_8I1R4P_sound) (by decide +kernel) +def CA1_7_8I1R4MassTermLogWitness : LogWitness := ⟨-2, 5520910985132668912809379616577, 3125000000000000000000000000000⟩ +def CA1_7_8I1R4MassTermLog : Ball := ⟨(-16343715281945216738606421677083 / 20000000000000000000000000000000), (15881867829 / 25000000000000000000000000000000)⟩ +lemma CA1_7_8I1R4MassTermLog_sound : CA1_7_8I1R4MassTermLog.Encloses (Real.log ((∑ a, CA1_7_8I1R4Value a))) := by + exact checkLog_sound logTwoBall_sound (CA1_7_8I1R4Mass_sound) (w := CA1_7_8I1R4MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA1_7_8I1R4MassTerm : Ball := ⟨(9023219723797202219809978218521 / 25000000000000000000000000000000), (28058361237 / 100000000000000000000000000000000)⟩ +lemma CA1_7_8I1R4MassTerm_sound : CA1_7_8I1R4MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_7_8I1R4Value a))) := by + exact contains_sound (entropyTerm_ball (CA1_7_8I1R4Mass_sound) CA1_7_8I1R4MassTermLog_sound) (by decide +kernel) +def CA1_7_8I1R4H : Ball := ⟨(50162610752555337754037382097229 / 100000000000000000000000000000000), (16793530929 / 25000000000000000000000000000000)⟩ +lemma CA1_7_8I1R4H_sound : CA1_7_8I1R4H.Encloses (homogeneousEntropy CA1_7_8I1R4Value) := by + exact contains_sound (homogeneous_enclosed CA1_7_8I1R4Value CA1_7_8I1R4MassTerm_sound CA1_7_8I1R4Entropy_sound) (by decide +kernel) +def CA1_7_8I1R5Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 7 8)) (fun u => (stageALaw (shape 1 7 8) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 5 a +def CA1_7_8I1R5Raw (a : PairSlot) : Ball := residualBall (below (shape 1 7 8)) A1_7_8Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 5 a +lemma CA1_7_8I1R5Raw_sound (a : PairSlot) : + (CA1_7_8I1R5Raw a).Encloses (CA1_7_8I1R5Value a) := by + exact residualBall_sound_on (below (shape 1 7 8)) A1_7_8Law (fun u => (stageALaw (shape 1 7 8) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A1_7_8Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 7 8) (show (shape 1 7 8) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 5 a +def CA1_7_8I1R5Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(56490034731352553689181797071 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(383325221697784832231938850641 / 50000000000000000000000000000000), (16448067 / 6250000000000000000000000000000)⟩ ⟨(-67857140382502786554008324328631 / 10000000000000000000000000000000), (232934061397 / 100000000000000000000000000000000)⟩ ⟨-10, 56490034731352553689181797071, 48828125000000000000000000000⟩, + .log ⟨(1256825878128021407454329983707 / 50000000000000000000000000000000), (7 / 50000000000000000000000000000000)⟩ ⟨(92588693557674396110477875221 / 1000000000000000000000000000000), (1863002657 / 50000000000000000000000000000000)⟩ ⟨(-92085840179767555893425843607037 / 25000000000000000000000000000000), (74115383169 / 50000000000000000000000000000000)⟩ ⟨-6, 1256825878128021407454329983707, 781250000000000000000000000000⟩, + .log ⟨(107680220843939967773020797327 / 50000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ ⟨(66122249585888860257413042173 / 5000000000000000000000000000000), (456043489 / 100000000000000000000000000000000)⟩ ⟨(-122812247351756970586692448402091 / 20000000000000000000000000000000), (105879118879 / 50000000000000000000000000000000)⟩ ⟨-9, 107680220843939967773020797327, 97656250000000000000000000000⟩] +lemma CA1_7_8I1R5Certificates_valid : + CA1_7_8I1R5Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_7_8I1R5CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 1, 5 => 1 + | 2, 4 => 2 + | 3, 4 => 3 + | 4, 2 => 2 + | 4, 3 => 3 + | 5, 1 => 1 + | _, _ => 0 +def CA1_7_8I1R5P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_7_8I1R5Certificates (CA1_7_8I1R5CertificateIndex a)).input +lemma CA1_7_8I1R5P_check : ∀ a : PairSlot, contains (CA1_7_8I1R5Raw a) (CA1_7_8I1R5P a) = true := by + decide +kernel +lemma CA1_7_8I1R5P_sound (a : PairSlot) : + (CA1_7_8I1R5P a).Encloses (CA1_7_8I1R5Value a) := + contains_sound (CA1_7_8I1R5Raw_sound a) (CA1_7_8I1R5P_check a) +def CA1_7_8I1R5Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_7_8I1R5Certificates (CA1_7_8I1R5CertificateIndex a)).output +lemma CA1_7_8I1R5Terms_sound (a : PairSlot) : + (CA1_7_8I1R5Terms a).Encloses (Foundation.entropyTerm (CA1_7_8I1R5Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_7_8I1R5Certificates_valid + (CA1_7_8I1R5CertificateIndex a) (CA1_7_8I1R5P_sound a) +def CA1_7_8I1R5Entropy : Ball := ⟨(5673982395440393240329963033421 / 25000000000000000000000000000000), (35561743 / 400000000000000000000000000000)⟩ +lemma CA1_7_8I1R5Entropy_sound : CA1_7_8I1R5Entropy.Encloses (Foundation.finiteEntropy CA1_7_8I1R5Value) := by + exact contains_sound (entropyPair_enclosed CA1_7_8I1R5Value CA1_7_8I1R5Terms CA1_7_8I1R5Terms_sound) (by decide +kernel) +def CA1_7_8I1R5Mass : Ball := ⟨(284199226740662785783306515621 / 5000000000000000000000000000000), (17 / 50000000000000000000000000000000)⟩ +lemma CA1_7_8I1R5Mass_sound : CA1_7_8I1R5Mass.Encloses (∑ a, CA1_7_8I1R5Value a) := by + exact contains_sound (pairSumBall_sound CA1_7_8I1R5P CA1_7_8I1R5Value CA1_7_8I1R5P_sound) (by decide +kernel) +def CA1_7_8I1R5MassTermLogWitness : LogWitness := ⟨-5, 284199226740662785783306515621, 156250000000000000000000000000⟩ +def CA1_7_8I1R5MassTermLog : Ball := ⟨(-286751769658500763880690399379981 / 100000000000000000000000000000000), (15881867837 / 12500000000000000000000000000000)⟩ +lemma CA1_7_8I1R5MassTermLog_sound : CA1_7_8I1R5MassTermLog.Encloses (Real.log ((∑ a, CA1_7_8I1R5Value a))) := by + exact checkLog_sound logTwoBall_sound (CA1_7_8I1R5Mass_sound) (w := CA1_7_8I1R5MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA1_7_8I1R5MassTerm : Ball := ⟨(3259785248138502638354366883571 / 20000000000000000000000000000000), (225680731 / 3125000000000000000000000000000)⟩ +lemma CA1_7_8I1R5MassTerm_sound : CA1_7_8I1R5MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_7_8I1R5Value a))) := by + exact contains_sound (entropyTerm_ball (CA1_7_8I1R5Mass_sound) CA1_7_8I1R5MassTermLog_sound) (by decide +kernel) +def CA1_7_8I1R5H : Ball := ⟨(6397003341069059769548017715829 / 100000000000000000000000000000000), (8056109571 / 50000000000000000000000000000000)⟩ +lemma CA1_7_8I1R5H_sound : CA1_7_8I1R5H.Encloses (homogeneousEntropy CA1_7_8I1R5Value) := by + exact contains_sound (homogeneous_enclosed CA1_7_8I1R5Value CA1_7_8I1R5MassTerm_sound CA1_7_8I1R5Entropy_sound) (by decide +kernel) +def CA1_7_8I1R6Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 7 8)) (fun u => (stageALaw (shape 1 7 8) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 6 a +def CA1_7_8I1R6Raw (a : PairSlot) : Ball := residualBall (below (shape 1 7 8)) A1_7_8Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 6 a +lemma CA1_7_8I1R6Raw_sound (a : PairSlot) : + (CA1_7_8I1R6Raw a).Encloses (CA1_7_8I1R6Value a) := by + exact residualBall_sound_on (below (shape 1 7 8)) A1_7_8Law (fun u => (stageALaw (shape 1 7 8) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A1_7_8Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 7 8) (show (shape 1 7 8) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 6 a +def CA1_7_8I1R6Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(23170151427983124544007071961 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(96967785677755872974651188937 / 50000000000000000000000000000000), (17172649 / 25000000000000000000000000000000)⟩ ⟨(-167401211820559185461068287890547 / 20000000000000000000000000000000), (148230767939 / 50000000000000000000000000000000)⟩ ⟨-13, 23170151427983124544007071961, 12207031250000000000000000000⟩, + .log ⟨(329375579851911397821806799 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(9069392947503710307608253179 / 50000000000000000000000000000000), (370537 / 6250000000000000000000000000000)⟩ ⟨(-13767555189703721075067192798127 / 1250000000000000000000000000000), (359989063331 / 100000000000000000000000000000000)⟩ ⟨-16, 329375579851911397821806799, 305175781250000000000000000⟩, + .log ⟨(98508993099373009345192932651 / 100000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ ⟨(681955852842247518025916899597 / 100000000000000000000000000000000), (114730511 / 50000000000000000000000000000000)⟩ ⟨(-138455552409171469827814519028301 / 20000000000000000000000000000000), (232934063557 / 100000000000000000000000000000000)⟩ ⟨-10, 98508993099373009345192932651, 97656250000000000000000000000⟩] +lemma CA1_7_8I1R6Certificates_valid : + CA1_7_8I1R6Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_7_8I1R6CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 2, 5 => 1 + | 3, 5 => 2 + | 4, 4 => 3 + | 5, 2 => 1 + | 5, 3 => 2 + | _, _ => 0 +def CA1_7_8I1R6P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_7_8I1R6Certificates (CA1_7_8I1R6CertificateIndex a)).input +lemma CA1_7_8I1R6P_check : ∀ a : PairSlot, contains (CA1_7_8I1R6Raw a) (CA1_7_8I1R6P a) = true := by + decide +kernel +lemma CA1_7_8I1R6P_sound (a : PairSlot) : + (CA1_7_8I1R6P a).Encloses (CA1_7_8I1R6Value a) := + contains_sound (CA1_7_8I1R6Raw_sound a) (CA1_7_8I1R6P_check a) +def CA1_7_8I1R6Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_7_8I1R6Certificates (CA1_7_8I1R6CertificateIndex a)).output +lemma CA1_7_8I1R6Terms_sound (a : PairSlot) : + (CA1_7_8I1R6Terms a).Encloses (Foundation.entropyTerm (CA1_7_8I1R6Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_7_8I1R6Certificates_valid + (CA1_7_8I1R6CertificateIndex a) (CA1_7_8I1R6P_sound a) +def CA1_7_8I1R6Entropy : Ball := ⟨(1106104567343285851154954668061 / 100000000000000000000000000000000), (189349699 / 50000000000000000000000000000000)⟩ +lemma CA1_7_8I1R6Entropy_sound : CA1_7_8I1R6Entropy.Encloses (Foundation.finiteEntropy CA1_7_8I1R6Value) := by + exact contains_sound (entropyPair_enclosed CA1_7_8I1R6Value CA1_7_8I1R6Terms CA1_7_8I1R6Terms_sound) (by decide +kernel) +def CA1_7_8I1R6Mass : Ball := ⟨(148143051753858372411425144563 / 100000000000000000000000000000000), (7 / 100000000000000000000000000000000)⟩ +lemma CA1_7_8I1R6Mass_sound : CA1_7_8I1R6Mass.Encloses (∑ a, CA1_7_8I1R6Value a) := by + exact contains_sound (pairSumBall_sound CA1_7_8I1R6P CA1_7_8I1R6Value CA1_7_8I1R6P_sound) (by decide +kernel) +def CA1_7_8I1R6MassTermLogWitness : LogWitness := ⟨-10, 148143051753858372411425144563, 97656250000000000000000000000⟩ +def CA1_7_8I1R6MassTermLog : Ball := ⟨(-16286867730314255335605912195633 / 2500000000000000000000000000000), (116467032619 / 50000000000000000000000000000000)⟩ +lemma CA1_7_8I1R6MassTermLog_sound : CA1_7_8I1R6MassTermLog.Encloses (Real.log ((∑ a, CA1_7_8I1R6Value a))) := by + exact checkLog_sound logTwoBall_sound (CA1_7_8I1R6Mass_sound) (w := CA1_7_8I1R6MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA1_7_8I1R6MassTerm : Ball := ⟨(482557257816038114612911050483 / 50000000000000000000000000000000), (345075679 / 100000000000000000000000000000000)⟩ +lemma CA1_7_8I1R6MassTerm_sound : CA1_7_8I1R6MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_7_8I1R6Value a))) := by + exact contains_sound (entropyTerm_ball (CA1_7_8I1R6Mass_sound) CA1_7_8I1R6MassTermLog_sound) (by decide +kernel) +def CA1_7_8I1R6H : Ball := ⟨(28198010342241924385826513419 / 20000000000000000000000000000000), (723775077 / 100000000000000000000000000000000)⟩ +lemma CA1_7_8I1R6H_sound : CA1_7_8I1R6H.Encloses (homogeneousEntropy CA1_7_8I1R6Value) := by + exact contains_sound (homogeneous_enclosed CA1_7_8I1R6Value CA1_7_8I1R6MassTerm_sound CA1_7_8I1R6Entropy_sound) (by decide +kernel) +def CA1_7_8I1R7Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 7 8)) (fun u => (stageALaw (shape 1 7 8) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 7 a +def CA1_7_8I1R7Raw (a : PairSlot) : Ball := residualBall (below (shape 1 7 8)) A1_7_8Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 7 a +lemma CA1_7_8I1R7Raw_sound (a : PairSlot) : + (CA1_7_8I1R7Raw a).Encloses (CA1_7_8I1R7Value a) := by + exact residualBall_sound_on (below (shape 1 7 8)) A1_7_8Law (fun u => (stageALaw (shape 1 7 8) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A1_7_8Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 7 8) (show (shape 1 7 8) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 7 a +def CA1_7_8I1R7Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(35279809335985405792837309 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(72128460287202064852396239 / 2000000000000000000000000000000), (1195341 / 100000000000000000000000000000000)⟩ ⟨(-1277792837545734601079131937105397 / 100000000000000000000000000000000), (42351682797 / 10000000000000000000000000000000)⟩ ⟨-19, 35279809335985405792837309, 23841857910156250000000000⟩] +lemma CA1_7_8I1R7Certificates_valid : + CA1_7_8I1R7Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_7_8I1R7CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 4, 5 => 1 + | 5, 4 => 1 + | _, _ => 0 +def CA1_7_8I1R7P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_7_8I1R7Certificates (CA1_7_8I1R7CertificateIndex a)).input +lemma CA1_7_8I1R7P_check : ∀ a : PairSlot, contains (CA1_7_8I1R7Raw a) (CA1_7_8I1R7P a) = true := by + decide +kernel +lemma CA1_7_8I1R7P_sound (a : PairSlot) : + (CA1_7_8I1R7P a).Encloses (CA1_7_8I1R7Value a) := + contains_sound (CA1_7_8I1R7Raw_sound a) (CA1_7_8I1R7P_check a) +def CA1_7_8I1R7Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_7_8I1R7Certificates (CA1_7_8I1R7CertificateIndex a)).output +lemma CA1_7_8I1R7Terms_sound (a : PairSlot) : + (CA1_7_8I1R7Terms a).Encloses (Foundation.entropyTerm (CA1_7_8I1R7Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_7_8I1R7Certificates_valid + (CA1_7_8I1R7CertificateIndex a) (CA1_7_8I1R7P_sound a) +def CA1_7_8I1R7Entropy : Ball := ⟨(72128460287202064852396239 / 1000000000000000000000000000000), (1195341 / 50000000000000000000000000000000)⟩ +lemma CA1_7_8I1R7Entropy_sound : CA1_7_8I1R7Entropy.Encloses (Foundation.finiteEntropy CA1_7_8I1R7Value) := by + exact contains_sound (entropyPair_enclosed CA1_7_8I1R7Value CA1_7_8I1R7Terms CA1_7_8I1R7Terms_sound) (by decide +kernel) +def CA1_7_8I1R7Mass : Ball := ⟨(35279809335985405792837309 / 6250000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ +lemma CA1_7_8I1R7Mass_sound : CA1_7_8I1R7Mass.Encloses (∑ a, CA1_7_8I1R7Value a) := by + exact contains_sound (pairSumBall_sound CA1_7_8I1R7P CA1_7_8I1R7Value CA1_7_8I1R7P_sound) (by decide +kernel) +def CA1_7_8I1R7MassTermLogWitness : LogWitness := ⟨-18, 35279809335985405792837309, 23841857910156250000000000⟩ +def CA1_7_8I1R7MassTermLog : Ball := ⟨(-1208478119489740070137408744055067 / 100000000000000000000000000000000), (402341004287 / 100000000000000000000000000000000)⟩ +lemma CA1_7_8I1R7MassTermLog_sound : CA1_7_8I1R7MassTermLog.Encloses (Real.log ((∑ a, CA1_7_8I1R7Value a))) := by + exact checkLog_sound logTwoBall_sound (CA1_7_8I1R7Mass_sound) (w := CA1_7_8I1R7MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA1_7_8I1R7MassTerm : Ball := ⟨(6821580422769314960419141647 / 100000000000000000000000000000000), (2271147 / 100000000000000000000000000000000)⟩ +lemma CA1_7_8I1R7MassTerm_sound : CA1_7_8I1R7MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_7_8I1R7Value a))) := by + exact contains_sound (entropyTerm_ball (CA1_7_8I1R7Mass_sound) CA1_7_8I1R7MassTermLog_sound) (by decide +kernel) +def CA1_7_8I1R7H : Ball := ⟨(391265605950891524820482253 / 100000000000000000000000000000000), (4661829 / 100000000000000000000000000000000)⟩ +lemma CA1_7_8I1R7H_sound : CA1_7_8I1R7H.Encloses (homogeneousEntropy CA1_7_8I1R7Value) := by + exact contains_sound (homogeneous_enclosed CA1_7_8I1R7Value CA1_7_8I1R7MassTerm_sound CA1_7_8I1R7Entropy_sound) (by decide +kernel) +def CA1_7_8I1R8Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 7 8)) (fun u => (stageALaw (shape 1 7 8) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 8 a +def CA1_7_8I1R8Raw (a : PairSlot) : Ball := residualBall (below (shape 1 7 8)) A1_7_8Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 8 a +lemma CA1_7_8I1R8Raw_sound (a : PairSlot) : + (CA1_7_8I1R8Raw a).Encloses (CA1_7_8I1R8Value a) := by + exact residualBall_sound_on (below (shape 1 7 8)) A1_7_8Law (fun u => (stageALaw (shape 1 7 8) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A1_7_8Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 7 8) (show (shape 1 7 8) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 8 a +def CA1_7_8I1R8Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA1_7_8I1R8Certificates_valid : + CA1_7_8I1R8Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_7_8I1R8CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA1_7_8I1R8P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_7_8I1R8Certificates (CA1_7_8I1R8CertificateIndex a)).input +lemma CA1_7_8I1R8P_check : ∀ a : PairSlot, contains (CA1_7_8I1R8Raw a) (CA1_7_8I1R8P a) = true := by + decide +kernel +lemma CA1_7_8I1R8P_sound (a : PairSlot) : + (CA1_7_8I1R8P a).Encloses (CA1_7_8I1R8Value a) := + contains_sound (CA1_7_8I1R8Raw_sound a) (CA1_7_8I1R8P_check a) +def CA1_7_8I1R8Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_7_8I1R8Certificates (CA1_7_8I1R8CertificateIndex a)).output +lemma CA1_7_8I1R8Terms_sound (a : PairSlot) : + (CA1_7_8I1R8Terms a).Encloses (Foundation.entropyTerm (CA1_7_8I1R8Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_7_8I1R8Certificates_valid + (CA1_7_8I1R8CertificateIndex a) (CA1_7_8I1R8P_sound a) +def CA1_7_8I1R8Entropy : Ball := ⟨0, 0⟩ +lemma CA1_7_8I1R8Entropy_sound : CA1_7_8I1R8Entropy.Encloses (Foundation.finiteEntropy CA1_7_8I1R8Value) := by + exact contains_sound (entropyPair_enclosed CA1_7_8I1R8Value CA1_7_8I1R8Terms CA1_7_8I1R8Terms_sound) (by decide +kernel) +def CA1_7_8I1R8Mass : Ball := ⟨0, 0⟩ +lemma CA1_7_8I1R8Mass_sound : CA1_7_8I1R8Mass.Encloses (∑ a, CA1_7_8I1R8Value a) := by + exact contains_sound (pairSumBall_sound CA1_7_8I1R8P CA1_7_8I1R8Value CA1_7_8I1R8P_sound) (by decide +kernel) +def CA1_7_8I1R8MassTerm : Ball := .exact 0 +lemma CA1_7_8I1R8MassTerm_sound : CA1_7_8I1R8MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_7_8I1R8Value a))) := + entropyTerm_zero_ball (CA1_7_8I1R8Mass_sound) +def CA1_7_8I1R8H : Ball := ⟨0, 0⟩ +lemma CA1_7_8I1R8H_sound : CA1_7_8I1R8H.Encloses (homogeneousEntropy CA1_7_8I1R8Value) := by + exact contains_sound (homogeneous_enclosed CA1_7_8I1R8Value CA1_7_8I1R8MassTerm_sound CA1_7_8I1R8Entropy_sound) (by decide +kernel) +def CA1_7_8I1R9Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 7 8)) (fun u => (stageALaw (shape 1 7 8) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 9 a +def CA1_7_8I1R9Raw (a : PairSlot) : Ball := residualBall (below (shape 1 7 8)) A1_7_8Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 9 a +lemma CA1_7_8I1R9Raw_sound (a : PairSlot) : + (CA1_7_8I1R9Raw a).Encloses (CA1_7_8I1R9Value a) := by + exact residualBall_sound_on (below (shape 1 7 8)) A1_7_8Law (fun u => (stageALaw (shape 1 7 8) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A1_7_8Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 7 8) (show (shape 1 7 8) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 9 a +def CA1_7_8I1R9Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA1_7_8I1R9Certificates_valid : + CA1_7_8I1R9Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_7_8I1R9CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA1_7_8I1R9P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_7_8I1R9Certificates (CA1_7_8I1R9CertificateIndex a)).input +lemma CA1_7_8I1R9P_check : ∀ a : PairSlot, contains (CA1_7_8I1R9Raw a) (CA1_7_8I1R9P a) = true := by + decide +kernel +lemma CA1_7_8I1R9P_sound (a : PairSlot) : + (CA1_7_8I1R9P a).Encloses (CA1_7_8I1R9Value a) := + contains_sound (CA1_7_8I1R9Raw_sound a) (CA1_7_8I1R9P_check a) +def CA1_7_8I1R9Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_7_8I1R9Certificates (CA1_7_8I1R9CertificateIndex a)).output +lemma CA1_7_8I1R9Terms_sound (a : PairSlot) : + (CA1_7_8I1R9Terms a).Encloses (Foundation.entropyTerm (CA1_7_8I1R9Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_7_8I1R9Certificates_valid + (CA1_7_8I1R9CertificateIndex a) (CA1_7_8I1R9P_sound a) +def CA1_7_8I1R9Entropy : Ball := ⟨0, 0⟩ +lemma CA1_7_8I1R9Entropy_sound : CA1_7_8I1R9Entropy.Encloses (Foundation.finiteEntropy CA1_7_8I1R9Value) := by + exact contains_sound (entropyPair_enclosed CA1_7_8I1R9Value CA1_7_8I1R9Terms CA1_7_8I1R9Terms_sound) (by decide +kernel) +def CA1_7_8I1R9Mass : Ball := ⟨0, 0⟩ +lemma CA1_7_8I1R9Mass_sound : CA1_7_8I1R9Mass.Encloses (∑ a, CA1_7_8I1R9Value a) := by + exact contains_sound (pairSumBall_sound CA1_7_8I1R9P CA1_7_8I1R9Value CA1_7_8I1R9P_sound) (by decide +kernel) +def CA1_7_8I1R9MassTerm : Ball := .exact 0 +lemma CA1_7_8I1R9MassTerm_sound : CA1_7_8I1R9MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_7_8I1R9Value a))) := + entropyTerm_zero_ball (CA1_7_8I1R9Mass_sound) +def CA1_7_8I1R9H : Ball := ⟨0, 0⟩ +lemma CA1_7_8I1R9H_sound : CA1_7_8I1R9H.Encloses (homogeneousEntropy CA1_7_8I1R9Value) := by + exact contains_sound (homogeneous_enclosed CA1_7_8I1R9Value CA1_7_8I1R9MassTerm_sound CA1_7_8I1R9Entropy_sound) (by decide +kernel) +def CA1_7_8I1R10Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 7 8)) (fun u => (stageALaw (shape 1 7 8) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 10 a +def CA1_7_8I1R10Raw (a : PairSlot) : Ball := residualBall (below (shape 1 7 8)) A1_7_8Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 10 a +lemma CA1_7_8I1R10Raw_sound (a : PairSlot) : + (CA1_7_8I1R10Raw a).Encloses (CA1_7_8I1R10Value a) := by + exact residualBall_sound_on (below (shape 1 7 8)) A1_7_8Law (fun u => (stageALaw (shape 1 7 8) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A1_7_8Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 7 8) (show (shape 1 7 8) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 10 a +def CA1_7_8I1R10Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA1_7_8I1R10Certificates_valid : + CA1_7_8I1R10Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_7_8I1R10CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA1_7_8I1R10P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_7_8I1R10Certificates (CA1_7_8I1R10CertificateIndex a)).input +lemma CA1_7_8I1R10P_check : ∀ a : PairSlot, contains (CA1_7_8I1R10Raw a) (CA1_7_8I1R10P a) = true := by + decide +kernel +lemma CA1_7_8I1R10P_sound (a : PairSlot) : + (CA1_7_8I1R10P a).Encloses (CA1_7_8I1R10Value a) := + contains_sound (CA1_7_8I1R10Raw_sound a) (CA1_7_8I1R10P_check a) +def CA1_7_8I1R10Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_7_8I1R10Certificates (CA1_7_8I1R10CertificateIndex a)).output +lemma CA1_7_8I1R10Terms_sound (a : PairSlot) : + (CA1_7_8I1R10Terms a).Encloses (Foundation.entropyTerm (CA1_7_8I1R10Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_7_8I1R10Certificates_valid + (CA1_7_8I1R10CertificateIndex a) (CA1_7_8I1R10P_sound a) +def CA1_7_8I1R10Entropy : Ball := ⟨0, 0⟩ +lemma CA1_7_8I1R10Entropy_sound : CA1_7_8I1R10Entropy.Encloses (Foundation.finiteEntropy CA1_7_8I1R10Value) := by + exact contains_sound (entropyPair_enclosed CA1_7_8I1R10Value CA1_7_8I1R10Terms CA1_7_8I1R10Terms_sound) (by decide +kernel) +def CA1_7_8I1R10Mass : Ball := ⟨0, 0⟩ +lemma CA1_7_8I1R10Mass_sound : CA1_7_8I1R10Mass.Encloses (∑ a, CA1_7_8I1R10Value a) := by + exact contains_sound (pairSumBall_sound CA1_7_8I1R10P CA1_7_8I1R10Value CA1_7_8I1R10P_sound) (by decide +kernel) +def CA1_7_8I1R10MassTerm : Ball := .exact 0 +lemma CA1_7_8I1R10MassTerm_sound : CA1_7_8I1R10MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_7_8I1R10Value a))) := + entropyTerm_zero_ball (CA1_7_8I1R10Mass_sound) +def CA1_7_8I1R10H : Ball := ⟨0, 0⟩ +lemma CA1_7_8I1R10H_sound : CA1_7_8I1R10H.Encloses (homogeneousEntropy CA1_7_8I1R10Value) := by + exact contains_sound (homogeneous_enclosed CA1_7_8I1R10Value CA1_7_8I1R10MassTerm_sound CA1_7_8I1R10Entropy_sound) (by decide +kernel) +def CA1_7_8I1R11Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 7 8)) (fun u => (stageALaw (shape 1 7 8) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 11 a +def CA1_7_8I1R11Raw (a : PairSlot) : Ball := residualBall (below (shape 1 7 8)) A1_7_8Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 11 a +lemma CA1_7_8I1R11Raw_sound (a : PairSlot) : + (CA1_7_8I1R11Raw a).Encloses (CA1_7_8I1R11Value a) := by + exact residualBall_sound_on (below (shape 1 7 8)) A1_7_8Law (fun u => (stageALaw (shape 1 7 8) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A1_7_8Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 7 8) (show (shape 1 7 8) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 11 a +def CA1_7_8I1R11Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA1_7_8I1R11Certificates_valid : + CA1_7_8I1R11Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_7_8I1R11CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA1_7_8I1R11P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_7_8I1R11Certificates (CA1_7_8I1R11CertificateIndex a)).input +lemma CA1_7_8I1R11P_check : ∀ a : PairSlot, contains (CA1_7_8I1R11Raw a) (CA1_7_8I1R11P a) = true := by + decide +kernel +lemma CA1_7_8I1R11P_sound (a : PairSlot) : + (CA1_7_8I1R11P a).Encloses (CA1_7_8I1R11Value a) := + contains_sound (CA1_7_8I1R11Raw_sound a) (CA1_7_8I1R11P_check a) +def CA1_7_8I1R11Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_7_8I1R11Certificates (CA1_7_8I1R11CertificateIndex a)).output +lemma CA1_7_8I1R11Terms_sound (a : PairSlot) : + (CA1_7_8I1R11Terms a).Encloses (Foundation.entropyTerm (CA1_7_8I1R11Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_7_8I1R11Certificates_valid + (CA1_7_8I1R11CertificateIndex a) (CA1_7_8I1R11P_sound a) +def CA1_7_8I1R11Entropy : Ball := ⟨0, 0⟩ +lemma CA1_7_8I1R11Entropy_sound : CA1_7_8I1R11Entropy.Encloses (Foundation.finiteEntropy CA1_7_8I1R11Value) := by + exact contains_sound (entropyPair_enclosed CA1_7_8I1R11Value CA1_7_8I1R11Terms CA1_7_8I1R11Terms_sound) (by decide +kernel) +def CA1_7_8I1R11Mass : Ball := ⟨0, 0⟩ +lemma CA1_7_8I1R11Mass_sound : CA1_7_8I1R11Mass.Encloses (∑ a, CA1_7_8I1R11Value a) := by + exact contains_sound (pairSumBall_sound CA1_7_8I1R11P CA1_7_8I1R11Value CA1_7_8I1R11P_sound) (by decide +kernel) +def CA1_7_8I1R11MassTerm : Ball := .exact 0 +lemma CA1_7_8I1R11MassTerm_sound : CA1_7_8I1R11MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_7_8I1R11Value a))) := + entropyTerm_zero_ball (CA1_7_8I1R11Mass_sound) +def CA1_7_8I1R11H : Ball := ⟨0, 0⟩ +lemma CA1_7_8I1R11H_sound : CA1_7_8I1R11H.Encloses (homogeneousEntropy CA1_7_8I1R11Value) := by + exact contains_sound (homogeneous_enclosed CA1_7_8I1R11Value CA1_7_8I1R11MassTerm_sound CA1_7_8I1R11Entropy_sound) (by decide +kernel) +def CA1_7_8I1R12Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 7 8)) (fun u => (stageALaw (shape 1 7 8) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 12 a +def CA1_7_8I1R12Raw (a : PairSlot) : Ball := residualBall (below (shape 1 7 8)) A1_7_8Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 12 a +lemma CA1_7_8I1R12Raw_sound (a : PairSlot) : + (CA1_7_8I1R12Raw a).Encloses (CA1_7_8I1R12Value a) := by + exact residualBall_sound_on (below (shape 1 7 8)) A1_7_8Law (fun u => (stageALaw (shape 1 7 8) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A1_7_8Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 7 8) (show (shape 1 7 8) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 12 a +def CA1_7_8I1R12Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA1_7_8I1R12Certificates_valid : + CA1_7_8I1R12Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_7_8I1R12CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA1_7_8I1R12P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_7_8I1R12Certificates (CA1_7_8I1R12CertificateIndex a)).input +lemma CA1_7_8I1R12P_check : ∀ a : PairSlot, contains (CA1_7_8I1R12Raw a) (CA1_7_8I1R12P a) = true := by + decide +kernel +lemma CA1_7_8I1R12P_sound (a : PairSlot) : + (CA1_7_8I1R12P a).Encloses (CA1_7_8I1R12Value a) := + contains_sound (CA1_7_8I1R12Raw_sound a) (CA1_7_8I1R12P_check a) +def CA1_7_8I1R12Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_7_8I1R12Certificates (CA1_7_8I1R12CertificateIndex a)).output +lemma CA1_7_8I1R12Terms_sound (a : PairSlot) : + (CA1_7_8I1R12Terms a).Encloses (Foundation.entropyTerm (CA1_7_8I1R12Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_7_8I1R12Certificates_valid + (CA1_7_8I1R12CertificateIndex a) (CA1_7_8I1R12P_sound a) +def CA1_7_8I1R12Entropy : Ball := ⟨0, 0⟩ +lemma CA1_7_8I1R12Entropy_sound : CA1_7_8I1R12Entropy.Encloses (Foundation.finiteEntropy CA1_7_8I1R12Value) := by + exact contains_sound (entropyPair_enclosed CA1_7_8I1R12Value CA1_7_8I1R12Terms CA1_7_8I1R12Terms_sound) (by decide +kernel) +def CA1_7_8I1R12Mass : Ball := ⟨0, 0⟩ +lemma CA1_7_8I1R12Mass_sound : CA1_7_8I1R12Mass.Encloses (∑ a, CA1_7_8I1R12Value a) := by + exact contains_sound (pairSumBall_sound CA1_7_8I1R12P CA1_7_8I1R12Value CA1_7_8I1R12P_sound) (by decide +kernel) +def CA1_7_8I1R12MassTerm : Ball := .exact 0 +lemma CA1_7_8I1R12MassTerm_sound : CA1_7_8I1R12MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_7_8I1R12Value a))) := + entropyTerm_zero_ball (CA1_7_8I1R12Mass_sound) +def CA1_7_8I1R12H : Ball := ⟨0, 0⟩ +lemma CA1_7_8I1R12H_sound : CA1_7_8I1R12H.Encloses (homogeneousEntropy CA1_7_8I1R12Value) := by + exact contains_sound (homogeneous_enclosed CA1_7_8I1R12Value CA1_7_8I1R12MassTerm_sound CA1_7_8I1R12Entropy_sound) (by decide +kernel) +def CA1_7_8I1R13Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 7 8)) (fun u => (stageALaw (shape 1 7 8) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 13 a +def CA1_7_8I1R13Raw (a : PairSlot) : Ball := residualBall (below (shape 1 7 8)) A1_7_8Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 13 a +lemma CA1_7_8I1R13Raw_sound (a : PairSlot) : + (CA1_7_8I1R13Raw a).Encloses (CA1_7_8I1R13Value a) := by + exact residualBall_sound_on (below (shape 1 7 8)) A1_7_8Law (fun u => (stageALaw (shape 1 7 8) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A1_7_8Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 7 8) (show (shape 1 7 8) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 13 a +def CA1_7_8I1R13Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA1_7_8I1R13Certificates_valid : + CA1_7_8I1R13Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_7_8I1R13CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA1_7_8I1R13P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_7_8I1R13Certificates (CA1_7_8I1R13CertificateIndex a)).input +lemma CA1_7_8I1R13P_check : ∀ a : PairSlot, contains (CA1_7_8I1R13Raw a) (CA1_7_8I1R13P a) = true := by + decide +kernel +lemma CA1_7_8I1R13P_sound (a : PairSlot) : + (CA1_7_8I1R13P a).Encloses (CA1_7_8I1R13Value a) := + contains_sound (CA1_7_8I1R13Raw_sound a) (CA1_7_8I1R13P_check a) +def CA1_7_8I1R13Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_7_8I1R13Certificates (CA1_7_8I1R13CertificateIndex a)).output +lemma CA1_7_8I1R13Terms_sound (a : PairSlot) : + (CA1_7_8I1R13Terms a).Encloses (Foundation.entropyTerm (CA1_7_8I1R13Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_7_8I1R13Certificates_valid + (CA1_7_8I1R13CertificateIndex a) (CA1_7_8I1R13P_sound a) +def CA1_7_8I1R13Entropy : Ball := ⟨0, 0⟩ +lemma CA1_7_8I1R13Entropy_sound : CA1_7_8I1R13Entropy.Encloses (Foundation.finiteEntropy CA1_7_8I1R13Value) := by + exact contains_sound (entropyPair_enclosed CA1_7_8I1R13Value CA1_7_8I1R13Terms CA1_7_8I1R13Terms_sound) (by decide +kernel) +def CA1_7_8I1R13Mass : Ball := ⟨0, 0⟩ +lemma CA1_7_8I1R13Mass_sound : CA1_7_8I1R13Mass.Encloses (∑ a, CA1_7_8I1R13Value a) := by + exact contains_sound (pairSumBall_sound CA1_7_8I1R13P CA1_7_8I1R13Value CA1_7_8I1R13P_sound) (by decide +kernel) +def CA1_7_8I1R13MassTerm : Ball := .exact 0 +lemma CA1_7_8I1R13MassTerm_sound : CA1_7_8I1R13MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_7_8I1R13Value a))) := + entropyTerm_zero_ball (CA1_7_8I1R13Mass_sound) +def CA1_7_8I1R13H : Ball := ⟨0, 0⟩ +lemma CA1_7_8I1R13H_sound : CA1_7_8I1R13H.Encloses (homogeneousEntropy CA1_7_8I1R13Value) := by + exact contains_sound (homogeneous_enclosed CA1_7_8I1R13Value CA1_7_8I1R13MassTerm_sound CA1_7_8I1R13Entropy_sound) (by decide +kernel) +def CA1_7_8I1R14Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 7 8)) (fun u => (stageALaw (shape 1 7 8) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 14 a +def CA1_7_8I1R14Raw (a : PairSlot) : Ball := residualBall (below (shape 1 7 8)) A1_7_8Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 14 a +lemma CA1_7_8I1R14Raw_sound (a : PairSlot) : + (CA1_7_8I1R14Raw a).Encloses (CA1_7_8I1R14Value a) := by + exact residualBall_sound_on (below (shape 1 7 8)) A1_7_8Law (fun u => (stageALaw (shape 1 7 8) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A1_7_8Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 7 8) (show (shape 1 7 8) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 14 a +def CA1_7_8I1R14Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA1_7_8I1R14Certificates_valid : + CA1_7_8I1R14Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_7_8I1R14CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA1_7_8I1R14P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_7_8I1R14Certificates (CA1_7_8I1R14CertificateIndex a)).input +lemma CA1_7_8I1R14P_check : ∀ a : PairSlot, contains (CA1_7_8I1R14Raw a) (CA1_7_8I1R14P a) = true := by + decide +kernel +lemma CA1_7_8I1R14P_sound (a : PairSlot) : + (CA1_7_8I1R14P a).Encloses (CA1_7_8I1R14Value a) := + contains_sound (CA1_7_8I1R14Raw_sound a) (CA1_7_8I1R14P_check a) +def CA1_7_8I1R14Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_7_8I1R14Certificates (CA1_7_8I1R14CertificateIndex a)).output +lemma CA1_7_8I1R14Terms_sound (a : PairSlot) : + (CA1_7_8I1R14Terms a).Encloses (Foundation.entropyTerm (CA1_7_8I1R14Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_7_8I1R14Certificates_valid + (CA1_7_8I1R14CertificateIndex a) (CA1_7_8I1R14P_sound a) +def CA1_7_8I1R14Entropy : Ball := ⟨0, 0⟩ +lemma CA1_7_8I1R14Entropy_sound : CA1_7_8I1R14Entropy.Encloses (Foundation.finiteEntropy CA1_7_8I1R14Value) := by + exact contains_sound (entropyPair_enclosed CA1_7_8I1R14Value CA1_7_8I1R14Terms CA1_7_8I1R14Terms_sound) (by decide +kernel) +def CA1_7_8I1R14Mass : Ball := ⟨0, 0⟩ +lemma CA1_7_8I1R14Mass_sound : CA1_7_8I1R14Mass.Encloses (∑ a, CA1_7_8I1R14Value a) := by + exact contains_sound (pairSumBall_sound CA1_7_8I1R14P CA1_7_8I1R14Value CA1_7_8I1R14P_sound) (by decide +kernel) +def CA1_7_8I1R14MassTerm : Ball := .exact 0 +lemma CA1_7_8I1R14MassTerm_sound : CA1_7_8I1R14MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_7_8I1R14Value a))) := + entropyTerm_zero_ball (CA1_7_8I1R14Mass_sound) +def CA1_7_8I1R14H : Ball := ⟨0, 0⟩ +lemma CA1_7_8I1R14H_sound : CA1_7_8I1R14H.Encloses (homogeneousEntropy CA1_7_8I1R14Value) := by + exact contains_sound (homogeneous_enclosed CA1_7_8I1R14Value CA1_7_8I1R14MassTerm_sound CA1_7_8I1R14Entropy_sound) (by decide +kernel) +def CA1_7_8I1R15Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 7 8)) (fun u => (stageALaw (shape 1 7 8) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 15 a +def CA1_7_8I1R15Raw (a : PairSlot) : Ball := residualBall (below (shape 1 7 8)) A1_7_8Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 15 a +lemma CA1_7_8I1R15Raw_sound (a : PairSlot) : + (CA1_7_8I1R15Raw a).Encloses (CA1_7_8I1R15Value a) := by + exact residualBall_sound_on (below (shape 1 7 8)) A1_7_8Law (fun u => (stageALaw (shape 1 7 8) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A1_7_8Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 7 8) (show (shape 1 7 8) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 15 a +def CA1_7_8I1R15Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA1_7_8I1R15Certificates_valid : + CA1_7_8I1R15Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_7_8I1R15CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA1_7_8I1R15P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_7_8I1R15Certificates (CA1_7_8I1R15CertificateIndex a)).input +lemma CA1_7_8I1R15P_check : ∀ a : PairSlot, contains (CA1_7_8I1R15Raw a) (CA1_7_8I1R15P a) = true := by + decide +kernel +lemma CA1_7_8I1R15P_sound (a : PairSlot) : + (CA1_7_8I1R15P a).Encloses (CA1_7_8I1R15Value a) := + contains_sound (CA1_7_8I1R15Raw_sound a) (CA1_7_8I1R15P_check a) +def CA1_7_8I1R15Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_7_8I1R15Certificates (CA1_7_8I1R15CertificateIndex a)).output +lemma CA1_7_8I1R15Terms_sound (a : PairSlot) : + (CA1_7_8I1R15Terms a).Encloses (Foundation.entropyTerm (CA1_7_8I1R15Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_7_8I1R15Certificates_valid + (CA1_7_8I1R15CertificateIndex a) (CA1_7_8I1R15P_sound a) +def CA1_7_8I1R15Entropy : Ball := ⟨0, 0⟩ +lemma CA1_7_8I1R15Entropy_sound : CA1_7_8I1R15Entropy.Encloses (Foundation.finiteEntropy CA1_7_8I1R15Value) := by + exact contains_sound (entropyPair_enclosed CA1_7_8I1R15Value CA1_7_8I1R15Terms CA1_7_8I1R15Terms_sound) (by decide +kernel) +def CA1_7_8I1R15Mass : Ball := ⟨0, 0⟩ +lemma CA1_7_8I1R15Mass_sound : CA1_7_8I1R15Mass.Encloses (∑ a, CA1_7_8I1R15Value a) := by + exact contains_sound (pairSumBall_sound CA1_7_8I1R15P CA1_7_8I1R15Value CA1_7_8I1R15P_sound) (by decide +kernel) +def CA1_7_8I1R15MassTerm : Ball := .exact 0 +lemma CA1_7_8I1R15MassTerm_sound : CA1_7_8I1R15MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_7_8I1R15Value a))) := + entropyTerm_zero_ball (CA1_7_8I1R15Mass_sound) +def CA1_7_8I1R15H : Ball := ⟨0, 0⟩ +lemma CA1_7_8I1R15H_sound : CA1_7_8I1R15H.Encloses (homogeneousEntropy CA1_7_8I1R15Value) := by + exact contains_sound (homogeneous_enclosed CA1_7_8I1R15Value CA1_7_8I1R15MassTerm_sound CA1_7_8I1R15Entropy_sound) (by decide +kernel) +def CA1_7_8I1R16Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 7 8)) (fun u => (stageALaw (shape 1 7 8) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 16 a +def CA1_7_8I1R16Raw (a : PairSlot) : Ball := residualBall (below (shape 1 7 8)) A1_7_8Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 16 a +lemma CA1_7_8I1R16Raw_sound (a : PairSlot) : + (CA1_7_8I1R16Raw a).Encloses (CA1_7_8I1R16Value a) := by + exact residualBall_sound_on (below (shape 1 7 8)) A1_7_8Law (fun u => (stageALaw (shape 1 7 8) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A1_7_8Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 7 8) (show (shape 1 7 8) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 16 a +def CA1_7_8I1R16Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA1_7_8I1R16Certificates_valid : + CA1_7_8I1R16Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_7_8I1R16CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA1_7_8I1R16P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_7_8I1R16Certificates (CA1_7_8I1R16CertificateIndex a)).input +lemma CA1_7_8I1R16P_check : ∀ a : PairSlot, contains (CA1_7_8I1R16Raw a) (CA1_7_8I1R16P a) = true := by + decide +kernel +lemma CA1_7_8I1R16P_sound (a : PairSlot) : + (CA1_7_8I1R16P a).Encloses (CA1_7_8I1R16Value a) := + contains_sound (CA1_7_8I1R16Raw_sound a) (CA1_7_8I1R16P_check a) +def CA1_7_8I1R16Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_7_8I1R16Certificates (CA1_7_8I1R16CertificateIndex a)).output +lemma CA1_7_8I1R16Terms_sound (a : PairSlot) : + (CA1_7_8I1R16Terms a).Encloses (Foundation.entropyTerm (CA1_7_8I1R16Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_7_8I1R16Certificates_valid + (CA1_7_8I1R16CertificateIndex a) (CA1_7_8I1R16P_sound a) +def CA1_7_8I1R16Entropy : Ball := ⟨0, 0⟩ +lemma CA1_7_8I1R16Entropy_sound : CA1_7_8I1R16Entropy.Encloses (Foundation.finiteEntropy CA1_7_8I1R16Value) := by + exact contains_sound (entropyPair_enclosed CA1_7_8I1R16Value CA1_7_8I1R16Terms CA1_7_8I1R16Terms_sound) (by decide +kernel) +def CA1_7_8I1R16Mass : Ball := ⟨0, 0⟩ +lemma CA1_7_8I1R16Mass_sound : CA1_7_8I1R16Mass.Encloses (∑ a, CA1_7_8I1R16Value a) := by + exact contains_sound (pairSumBall_sound CA1_7_8I1R16P CA1_7_8I1R16Value CA1_7_8I1R16P_sound) (by decide +kernel) +def CA1_7_8I1R16MassTerm : Ball := .exact 0 +lemma CA1_7_8I1R16MassTerm_sound : CA1_7_8I1R16MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_7_8I1R16Value a))) := + entropyTerm_zero_ball (CA1_7_8I1R16Mass_sound) +def CA1_7_8I1R16H : Ball := ⟨0, 0⟩ +lemma CA1_7_8I1R16H_sound : CA1_7_8I1R16H.Encloses (homogeneousEntropy CA1_7_8I1R16Value) := by + exact contains_sound (homogeneous_enclosed CA1_7_8I1R16Value CA1_7_8I1R16MassTerm_sound CA1_7_8I1R16Entropy_sound) (by decide +kernel) +def CA1_7_8I1ResidualEntropies (a : Fin 17) : Ball := + match a.val with + | 0 => CA1_7_8I1R0H + | 1 => CA1_7_8I1R1H + | 2 => CA1_7_8I1R2H + | 3 => CA1_7_8I1R3H + | 4 => CA1_7_8I1R4H + | 5 => CA1_7_8I1R5H + | 6 => CA1_7_8I1R6H + | 7 => CA1_7_8I1R7H + | 8 => CA1_7_8I1R8H + | 9 => CA1_7_8I1R9H + | 10 => CA1_7_8I1R10H + | 11 => CA1_7_8I1R11H + | 12 => CA1_7_8I1R12H + | 13 => CA1_7_8I1R13H + | 14 => CA1_7_8I1R14H + | 15 => CA1_7_8I1R15H + | 16 => CA1_7_8I1R16H + | _ => (.exact 0) +lemma CA1_7_8I1ResidualEntropies_sound (k : Fin 17) : + (CA1_7_8I1ResidualEntropies k).Encloses (homogeneousEntropy + (residualLaw (below (shape 1 7 8)) (fun u => (stageALaw (shape 1 7 8) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) k)) := by + fin_cases k + · exact CA1_7_8I1R0H_sound + · exact CA1_7_8I1R1H_sound + · exact CA1_7_8I1R2H_sound + · exact CA1_7_8I1R3H_sound + · exact CA1_7_8I1R4H_sound + · exact CA1_7_8I1R5H_sound + · exact CA1_7_8I1R6H_sound + · exact CA1_7_8I1R7H_sound + · exact CA1_7_8I1R8H_sound + · exact CA1_7_8I1R9H_sound + · exact CA1_7_8I1R10H_sound + · exact CA1_7_8I1R11H_sound + · exact CA1_7_8I1R12H_sound + · exact CA1_7_8I1R13H_sound + · exact CA1_7_8I1R14H_sound + · exact CA1_7_8I1R15H_sound + · exact CA1_7_8I1R16H_sound +def CA1_7_8I1Singles (s : Shape) : Ball := + match s 0, s 1, s 2 with + | 1, 7, 0 => Z1_7_0H1H + | _, _, _ => (.exact 0) +lemma CA1_7_8I1Singles_sound (u : Shape) (hu : u ∈ below (shape 1 7 8)) + (hd : designated (Equiv.refl (Fin 3)) 1 u) : + (CA1_7_8I1Singles u).Encloses (homogeneousEntropy ((fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) u)) := by + rw [A1_7_8_below] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 0 0 8) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 0 1 7) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 0 2 6) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 0 3 5) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 0 4 4) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 0 5 3) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 0 6 2) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 0 7 1) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 1 0 7) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 1 1 6) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 1 2 5) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 1 3 4) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 1 4 3) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 1 5 2) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 1 6 1) by decide +kernel) hd |>.elim + · exact Z1_7_0H1H_sound +def CA1_7_8I1Singleton : Ball := ⟨(13901359324341445694796469 / 100000000000000000000000000000000), (1699 / 20000000000000000000000000000000)⟩ +lemma CA1_7_8I1Singleton_sound : CA1_7_8I1Singleton.Encloses + (singletonEntropy (below (shape 1 7 8)) (fun u => (stageALaw (shape 1 7 8) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ))) := by + exact contains_sound (singletonBall_sound (below (shape 1 7 8)) A1_7_8Law (fun u => (stageALaw (shape 1 7 8) u : ℝ)) (Equiv.refl (Fin 3)) 1 + CA1_7_8I1Singles (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A1_7_8Law_sound u) CA1_7_8I1Singles_sound) (by decide +kernel) +def CA1_7_8I1Group : Ball := ⟨(28146986181848504264966179332283 / 25000000000000000000000000000000), (42415607743 / 25000000000000000000000000000000)⟩ +lemma CA1_7_8I1Group_sound : CA1_7_8I1Group.Encloses + (groupedEntropy (below (shape 1 7 8)) (fun u => (stageALaw (shape 1 7 8) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ))) := by + exact contains_sound (Ball.add_sound CA1_7_8I1Singleton_sound + (finSumBall_sound 17 CA1_7_8I1ResidualEntropies _ CA1_7_8I1ResidualEntropies_sound)) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CA1_7_8I1H : Ball := ⟨(21344728096657900435901341739 / 20000000000000000000000000000), (97509509711 / 20000000000000000000000000000000)⟩ +lemma CA1_7_8I1_sound : CA1_7_8I1H.Encloses (stageACapacity (shape 1 7 8) 1) := by + have hb := contains_sound (Ball.add_sound CA1_7_8I1PairH_sound + (Ball.neg_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) CA1_7_8I1Group_sound))) + (show contains (.add CA1_7_8I1PairH (.neg (.mul (.exact 2) CA1_7_8I1Group))) CA1_7_8I1H = true by decide +kernel) + unfold CA1_7_8I1PairValue at hb + simpa only [stageACapacity, nativeCapacity, + show (1 : Fin 3) ≠ 0 by decide, ite_false, sub_eq_add_neg] using hb + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA1_7_8I1Pair.lean b/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA1_7_8I1Pair.lean new file mode 100644 index 0000000000000000000000000000000000000000..1e6795fa83e4d5bd3ecc576bea3972c98aec79a3 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA1_7_8I1Pair.lean @@ -0,0 +1,355 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Certificates.SupportedContraction + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CA1_7_8I1PairValue (a : PairSlot × PairSlot) : ℝ := pairLaw (below (shape 1 7 8)) (shape 1 7 8) (fun u => (stageALaw (shape 1 7 8) u : ℝ)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) a +def CA1_7_8I1PairRaw (a : PairSlot × PairSlot) : Ball := stageAPairBall (shape 1 7 8) A1_7_8Law 1 a +lemma CA1_7_8I1PairRaw_sound (a : PairSlot × PairSlot) : + (CA1_7_8I1PairRaw a).Encloses (CA1_7_8I1PairValue a) := by + exact stageAPairBall_sound (shape 1 7 8) (by decide +kernel) A1_7_8Law (fun u => (stageALaw (shape 1 7 8) u : ℝ)) (fun u _ => A1_7_8Law_sound u) 1 a +def CA1_7_8I1PairCertificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(730665464418261809259513 / 250000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ ⟨(931088152971481426786535957 / 25000000000000000000000000000000), (19341 / 1562500000000000000000000000000)⟩ ⟨(-1274301576184104062142347883046177 / 100000000000000000000000000000000), (423517157967 / 100000000000000000000000000000000)⟩ ⟨-19, 730665464418261809259513, 476837158203125000000000⟩, + .log ⟨(24627248274843252336298233163 / 50000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ ⟨(375118541834438513921529706107 / 100000000000000000000000000000000), (62580281 / 50000000000000000000000000000000)⟩ ⟨(-38079624005092594004039789409541 / 5000000000000000000000000000000), (50821977651 / 20000000000000000000000000000000)⟩ ⟨-11, 24627248274843252336298233163, 24414062500000000000000000000⟩, + .log ⟨(11585075713991562272003535981 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(104997948245482619712577897321 / 100000000000000000000000000000000), (36798539 / 100000000000000000000000000000000)⟩ ⟨(-906320777158790458247064632498749 / 100000000000000000000000000000000), (317637363877 / 100000000000000000000000000000000)⟩ ⟨-14, 11585075713991562272003535981, 6103515625000000000000000000⟩, + .log ⟨(411719474814889247277258499 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(385606293352113363702800351 / 4000000000000000000000000000000), (3138673 / 100000000000000000000000000000000)⟩ ⟨(-1170719133232292216947098616839769 / 100000000000000000000000000000000), (76232989547 / 20000000000000000000000000000000)⟩ ⟨-17, 411719474814889247277258499, 381469726562500000000000000⟩, + .log ⟨(105847483336578572145685412119 / 25000000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ ⟨(2313670128411170587317793683121 / 100000000000000000000000000000000), (403453389 / 50000000000000000000000000000000)⟩ ⟨(-68307898528809921084934034883011 / 12500000000000000000000000000000), (190582414091 / 100000000000000000000000000000000)⟩ ⟨-8, 105847483336578572145685412119, 97656250000000000000000000000⟩, + .log ⟨(8975450176013071842212355741 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(35597254757294540257854171467 / 12500000000000000000000000000000), (12354067 / 12500000000000000000000000000000)⟩ ⟨(-793213801184665980805405054966873 / 100000000000000000000000000000000), (34410713833 / 12500000000000000000000000000000)⟩ ⟨-12, 8975450176013071842212355741, 6103515625000000000000000000⟩, + .log ⟨(4690841447899610367677461267 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(161008800693690486681546808073 / 100000000000000000000000000000000), (13906543 / 25000000000000000000000000000000)⟩ ⟨(-858101912428656169434156139176797 / 100000000000000000000000000000000), (296461536891 / 100000000000000000000000000000000)⟩ ⟨-13, 4690841447899610367677461267, 3051757812500000000000000000⟩, + .log ⟨(5507821664200256394185640107 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(85121342847815187352618857199 / 25000000000000000000000000000000), (15162247 / 12500000000000000000000000000000)⟩ ⟨(-48295717003402043035942154245511 / 6250000000000000000000000000000), (68821427537 / 25000000000000000000000000000000)⟩ ⟨-12, 5507821664200256394185640107, 3051757812500000000000000000⟩, + .log ⟨(950882440184237970846360301 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(7741701390325819581268410473 / 20000000000000000000000000000000), (1610859 / 12500000000000000000000000000000)⟩ ⟨(-1017699594497957643888222279664431 / 100000000000000000000000000000000), (169406602609 / 50000000000000000000000000000000)⟩ ⟨-15, 950882440184237970846360301, 762939453125000000000000000⟩, + .log ⟨(1000391409993007417473946567 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(4329448706867607751672766767 / 20000000000000000000000000000000), (7202611 / 100000000000000000000000000000000)⟩ ⟨(-1081938695099818463586975157456759 / 100000000000000000000000000000000), (359989052591 / 100000000000000000000000000000000)⟩ ⟨-16, 1000391409993007417473946567, 762939453125000000000000000⟩, + .log ⟨(1578746742936210135436206428751 / 100000000000000000000000000000000), (1 / 10000000000000000000000000000000)⟩ ⟨(6549492204285067841014881646303 / 100000000000000000000000000000000), (2340188439 / 100000000000000000000000000000000)⟩ ⟨(-414853885437260570973855399809643 / 100000000000000000000000000000000), (74115383207 / 50000000000000000000000000000000)⟩ ⟨-6, 1578746742936210135436206428751, 1562500000000000000000000000000⟩, + .log ⟨(135949780758301457041571866317 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(11216944352011924706554489869 / 1250000000000000000000000000000), (316673353 / 100000000000000000000000000000000)⟩ ⟨(-660063990655725311195979413133877 / 100000000000000000000000000000000), (3639594707 / 1562500000000000000000000000000)⟩ ⟨-10, 135949780758301457041571866317, 97656250000000000000000000000⟩, + .log ⟨(35725886119768097383524058869 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(51758968991777141703995470659 / 10000000000000000000000000000000), (7262641 / 4000000000000000000000000000000)⟩ ⟨(-90548784462370386588895521376777 / 12500000000000000000000000000000), (50821977119 / 20000000000000000000000000000000)⟩ ⟨-11, 35725886119768097383524058869, 24414062500000000000000000000⟩, + .log ⟨(79334316240827357645360797657 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(566387889336236328499850734603 / 100000000000000000000000000000000), (50399087 / 25000000000000000000000000000000)⟩ ⟨(-713925469045335294553647517720187 / 100000000000000000000000000000000), (15881867841 / 6250000000000000000000000000000)⟩ ⟨-11, 79334316240827357645360797657, 48828125000000000000000000000⟩, + .log ⟨(516390018809534652097675198493 / 100000000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ ⟨(108773697645000455039606634313 / 4000000000000000000000000000000), (196829717 / 20000000000000000000000000000000)⟩ ⟨(-526606313459364891984124944131477 / 100000000000000000000000000000000), (190582413921 / 100000000000000000000000000000000)⟩ ⟨-8, 516390018809534652097675198493, 390625000000000000000000000000⟩, + .log ⟨(10060059959174411870824199901 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(157300264066888738085035850009 / 50000000000000000000000000000000), (110775639 / 100000000000000000000000000000000)⟩ ⟨(-156361159580800082832153415130487 / 20000000000000000000000000000000), (68821427591 / 25000000000000000000000000000000)⟩ ⟨-12, 10060059959174411870824199901, 6103515625000000000000000000⟩, + .log ⟨(1434139663713017351152207857 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(14999972433193807800217725587 / 50000000000000000000000000000000), (5162751 / 50000000000000000000000000000000)⟩ ⟨(-261480328811884469565489548396473 / 25000000000000000000000000000000), (14399561499 / 4000000000000000000000000000000)⟩ ⟨-16, 1434139663713017351152207857, 762939453125000000000000000⟩, + .log ⟨(221975172453193560566732617 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(1032790175028781442321284729 / 10000000000000000000000000000000), (3384379 / 100000000000000000000000000000000)⟩ ⟨(-116318208430107097837268704571581 / 10000000000000000000000000000000), (381164938919 / 100000000000000000000000000000000)⟩ ⟨-17, 221975172453193560566732617, 190734863281250000000000000⟩, + .log ⟨(1092215259559074759252539027189 / 50000000000000000000000000000000), (9 / 100000000000000000000000000000000)⟩ ⟨(8352858236563233443959971089089 / 100000000000000000000000000000000), (3237998131 / 100000000000000000000000000000000)⟩ ⟨(-95595375584837399217062780880073 / 25000000000000000000000000000000), (9264422887 / 6250000000000000000000000000000)⟩ ⟨-6, 1092215259559074759252539027189, 781250000000000000000000000000⟩, + .log ⟨(12734033397323640159900778196839 / 100000000000000000000000000000000), (43 / 100000000000000000000000000000000)⟩ ⟨(1312173366167020011866901499391 / 5000000000000000000000000000000), (2696536493 / 25000000000000000000000000000000)⟩ ⟨(-41217839634150934097538346384771 / 20000000000000000000000000000000), (84703295069 / 100000000000000000000000000000000)⟩ ⟨-3, 12734033397323640159900778196839, 12500000000000000000000000000000⟩, + .log ⟨(1099634326919959407428995339847 / 100000000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ ⟨(39676499877568561210969390091 / 800000000000000000000000000000), (232856629 / 12500000000000000000000000000000)⟩ ⟨(-18040769966094623857634531984259 / 4000000000000000000000000000000), (169406589827 / 100000000000000000000000000000000)⟩ ⟨-7, 1099634326919959407428995339847, 781250000000000000000000000000⟩, + .log ⟨(47289460373809820371502906871 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(164649862042873790390254024927 / 25000000000000000000000000000000), (48066879 / 20000000000000000000000000000000)⟩ ⟨(-174087270970490211329725541857367 / 25000000000000000000000000000000), (254109885253 / 100000000000000000000000000000000)⟩ ⟨-11, 47289460373809820371502906871, 24414062500000000000000000000⟩, + .log ⟨(27725147605334641733288975459 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(45417038990301474681277165297 / 20000000000000000000000000000000), (76323379 / 100000000000000000000000000000000)⟩ ⟨(-409529280392024916763155219095267 / 50000000000000000000000000000000), (55057142297 / 20000000000000000000000000000000)⟩ ⟨-12, 27725147605334641733288975459, 24414062500000000000000000000⟩, + .log ⟨(104666715344877184941523644291 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(645688665741349324685065322839 / 50000000000000000000000000000000), (44328079 / 10000000000000000000000000000000)⟩ ⟨(-308449856104590157102801694746843 / 50000000000000000000000000000000), (211758237307 / 100000000000000000000000000000000)⟩ ⟨-9, 104666715344877184941523644291, 97656250000000000000000000000⟩, + .log ⟨(1227495284537094995574418301863 / 100000000000000000000000000000000), (1 / 20000000000000000000000000000000)⟩ ⟨(540121793452592951016841247639 / 10000000000000000000000000000000), (83178317 / 4000000000000000000000000000000)⟩ ⟨(-440019444682657297543109279780381 / 100000000000000000000000000000000), (169406589871 / 100000000000000000000000000000000)⟩ ⟨-7, 1227495284537094995574418301863, 781250000000000000000000000000⟩, + .log ⟨(13177276181069086710237244419 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(361320389937783931017039011623 / 50000000000000000000000000000000), (61388731 / 25000000000000000000000000000000)⟩ ⟨(-171374751965465377311383839063983 / 25000000000000000000000000000000), (232934061461 / 100000000000000000000000000000000)⟩ ⟨-10, 13177276181069086710237244419, 12207031250000000000000000000⟩, + .log ⟨(8987843250696584627747939011 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(83740207883669620750590065681 / 100000000000000000000000000000000), (28548759 / 100000000000000000000000000000000)⟩ ⟨(-931705255064161306639314075294251 / 100000000000000000000000000000000), (317637366371 / 100000000000000000000000000000000)⟩ ⟨-14, 8987843250696584627747939011, 6103515625000000000000000000⟩, + .log ⟨(105640308729735247702486359 / 4000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(27840882489076604418879541879 / 100000000000000000000000000000000), (190147 / 2000000000000000000000000000000)⟩ ⟨(-527088245459473077987632961832877 / 50000000000000000000000000000000), (14399561619 / 4000000000000000000000000000000)⟩ ⟨-16, 105640308729735247702486359, 61035156250000000000000000⟩] +lemma CA1_7_8I1PairCertificates_valid : + CA1_7_8I1PairCertificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_7_8I1PairCertificateIndex (a : PairSlot × PairSlot) : ℕ := + match a.1.1.val, a.1.2.val, a.2.1.val, a.2.2.val with + | 0, 0, 4, 5 => 1 + | 0, 0, 5, 4 => 1 + | 1, 0, 4, 4 => 2 + | 1, 0, 5, 2 => 3 + | 1, 0, 5, 3 => 4 + | 1, 0, 2, 5 => 3 + | 1, 0, 3, 5 => 4 + | 0, 1, 4, 4 => 2 + | 0, 1, 5, 2 => 3 + | 0, 1, 5, 3 => 4 + | 0, 1, 2, 5 => 3 + | 0, 1, 3, 5 => 4 + | 2, 0, 2, 4 => 5 + | 2, 0, 3, 4 => 6 + | 2, 0, 4, 2 => 5 + | 2, 0, 4, 3 => 6 + | 2, 0, 5, 1 => 7 + | 2, 0, 1, 5 => 7 + | 3, 0, 2, 4 => 8 + | 3, 0, 3, 4 => 9 + | 3, 0, 4, 2 => 8 + | 3, 0, 4, 3 => 9 + | 3, 0, 5, 1 => 10 + | 3, 0, 1, 5 => 10 + | 1, 1, 2, 4 => 11 + | 1, 1, 3, 4 => 12 + | 1, 1, 4, 2 => 11 + | 1, 1, 4, 3 => 12 + | 1, 1, 5, 1 => 13 + | 1, 1, 1, 5 => 13 + | 0, 2, 2, 4 => 5 + | 0, 2, 3, 4 => 6 + | 0, 2, 4, 2 => 5 + | 0, 2, 4, 3 => 6 + | 0, 2, 5, 1 => 7 + | 0, 2, 1, 5 => 7 + | 0, 3, 2, 4 => 8 + | 0, 3, 3, 4 => 9 + | 0, 3, 4, 2 => 8 + | 0, 3, 4, 3 => 9 + | 0, 3, 5, 1 => 10 + | 0, 3, 1, 5 => 10 + | 4, 0, 1, 4 => 14 + | 4, 0, 2, 2 => 15 + | 4, 0, 2, 3 => 16 + | 4, 0, 3, 2 => 16 + | 4, 0, 3, 3 => 17 + | 4, 0, 4, 1 => 14 + | 4, 0, 5, 0 => 18 + | 4, 0, 0, 5 => 18 + | 2, 1, 1, 4 => 19 + | 2, 1, 2, 2 => 20 + | 2, 1, 2, 3 => 21 + | 2, 1, 3, 2 => 21 + | 2, 1, 3, 3 => 22 + | 2, 1, 4, 1 => 19 + | 2, 1, 5, 0 => 23 + | 2, 1, 0, 5 => 23 + | 3, 1, 1, 4 => 24 + | 3, 1, 2, 2 => 25 + | 3, 1, 2, 3 => 26 + | 3, 1, 3, 2 => 26 + | 3, 1, 3, 3 => 27 + | 3, 1, 4, 1 => 24 + | 3, 1, 5, 0 => 28 + | 3, 1, 0, 5 => 28 + | 1, 2, 1, 4 => 19 + | 1, 2, 2, 2 => 20 + | 1, 2, 2, 3 => 21 + | 1, 2, 3, 2 => 21 + | 1, 2, 3, 3 => 22 + | 1, 2, 4, 1 => 19 + | 1, 2, 5, 0 => 23 + | 1, 2, 0, 5 => 23 + | 1, 3, 1, 4 => 24 + | 1, 3, 2, 2 => 25 + | 1, 3, 2, 3 => 26 + | 1, 3, 3, 2 => 26 + | 1, 3, 3, 3 => 27 + | 1, 3, 4, 1 => 24 + | 1, 3, 5, 0 => 28 + | 1, 3, 0, 5 => 28 + | 0, 4, 1, 4 => 14 + | 0, 4, 2, 2 => 15 + | 0, 4, 2, 3 => 16 + | 0, 4, 3, 2 => 16 + | 0, 4, 3, 3 => 17 + | 0, 4, 4, 1 => 14 + | 0, 4, 5, 0 => 18 + | 0, 4, 0, 5 => 18 + | 0, 5, 0, 4 => 18 + | 0, 5, 1, 2 => 23 + | 0, 5, 1, 3 => 28 + | 0, 5, 2, 1 => 23 + | 0, 5, 3, 1 => 28 + | 0, 5, 4, 0 => 18 + | 1, 4, 0, 4 => 14 + | 1, 4, 1, 2 => 19 + | 1, 4, 1, 3 => 24 + | 1, 4, 2, 1 => 19 + | 1, 4, 3, 1 => 24 + | 1, 4, 4, 0 => 14 + | 2, 2, 0, 4 => 15 + | 2, 2, 1, 2 => 20 + | 2, 2, 1, 3 => 25 + | 2, 2, 2, 1 => 20 + | 2, 2, 3, 1 => 25 + | 2, 2, 4, 0 => 15 + | 2, 3, 0, 4 => 16 + | 2, 3, 1, 2 => 21 + | 2, 3, 1, 3 => 26 + | 2, 3, 2, 1 => 21 + | 2, 3, 3, 1 => 26 + | 2, 3, 4, 0 => 16 + | 3, 2, 0, 4 => 16 + | 3, 2, 1, 2 => 21 + | 3, 2, 1, 3 => 26 + | 3, 2, 2, 1 => 21 + | 3, 2, 3, 1 => 26 + | 3, 2, 4, 0 => 16 + | 3, 3, 0, 4 => 17 + | 3, 3, 1, 2 => 22 + | 3, 3, 1, 3 => 27 + | 3, 3, 2, 1 => 22 + | 3, 3, 3, 1 => 27 + | 3, 3, 4, 0 => 17 + | 4, 1, 0, 4 => 14 + | 4, 1, 1, 2 => 19 + | 4, 1, 1, 3 => 24 + | 4, 1, 2, 1 => 19 + | 4, 1, 3, 1 => 24 + | 4, 1, 4, 0 => 14 + | 5, 0, 0, 4 => 18 + | 5, 0, 1, 2 => 23 + | 5, 0, 1, 3 => 28 + | 5, 0, 2, 1 => 23 + | 5, 0, 3, 1 => 28 + | 5, 0, 4, 0 => 18 + | 1, 5, 0, 2 => 7 + | 1, 5, 0, 3 => 10 + | 1, 5, 1, 1 => 13 + | 1, 5, 2, 0 => 7 + | 1, 5, 3, 0 => 10 + | 2, 4, 0, 2 => 5 + | 2, 4, 0, 3 => 8 + | 2, 4, 1, 1 => 11 + | 2, 4, 2, 0 => 5 + | 2, 4, 3, 0 => 8 + | 3, 4, 0, 2 => 6 + | 3, 4, 0, 3 => 9 + | 3, 4, 1, 1 => 12 + | 3, 4, 2, 0 => 6 + | 3, 4, 3, 0 => 9 + | 4, 2, 0, 2 => 5 + | 4, 2, 0, 3 => 8 + | 4, 2, 1, 1 => 11 + | 4, 2, 2, 0 => 5 + | 4, 2, 3, 0 => 8 + | 4, 3, 0, 2 => 6 + | 4, 3, 0, 3 => 9 + | 4, 3, 1, 1 => 12 + | 4, 3, 2, 0 => 6 + | 4, 3, 3, 0 => 9 + | 5, 1, 0, 2 => 7 + | 5, 1, 0, 3 => 10 + | 5, 1, 1, 1 => 13 + | 5, 1, 2, 0 => 7 + | 5, 1, 3, 0 => 10 + | 2, 5, 0, 1 => 3 + | 2, 5, 1, 0 => 3 + | 3, 5, 0, 1 => 4 + | 3, 5, 1, 0 => 4 + | 4, 4, 0, 1 => 2 + | 4, 4, 1, 0 => 2 + | 5, 2, 0, 1 => 3 + | 5, 2, 1, 0 => 3 + | 5, 3, 0, 1 => 4 + | 5, 3, 1, 0 => 4 + | 4, 5, 0, 0 => 1 + | 5, 4, 0, 0 => 1 + | _, _, _, _ => 0 +def CA1_7_8I1PairP (a : PairSlot × PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_7_8I1PairCertificates (CA1_7_8I1PairCertificateIndex a)).input +lemma CA1_7_8I1PairP_check_0_0 : ∀ k l : Fin 6, contains (CA1_7_8I1PairRaw ((0,0),(k,l))) (CA1_7_8I1PairP ((0,0),(k,l))) = true := by + decide +kernel +lemma CA1_7_8I1PairP_check_0_1 : ∀ k l : Fin 6, contains (CA1_7_8I1PairRaw ((0,1),(k,l))) (CA1_7_8I1PairP ((0,1),(k,l))) = true := by + decide +kernel +lemma CA1_7_8I1PairP_check_0_2 : ∀ k l : Fin 6, contains (CA1_7_8I1PairRaw ((0,2),(k,l))) (CA1_7_8I1PairP ((0,2),(k,l))) = true := by + decide +kernel +lemma CA1_7_8I1PairP_check_0_3 : ∀ k l : Fin 6, contains (CA1_7_8I1PairRaw ((0,3),(k,l))) (CA1_7_8I1PairP ((0,3),(k,l))) = true := by + decide +kernel +lemma CA1_7_8I1PairP_check_0_4 : ∀ k l : Fin 6, contains (CA1_7_8I1PairRaw ((0,4),(k,l))) (CA1_7_8I1PairP ((0,4),(k,l))) = true := by + decide +kernel +lemma CA1_7_8I1PairP_check_0_5 : ∀ k l : Fin 6, contains (CA1_7_8I1PairRaw ((0,5),(k,l))) (CA1_7_8I1PairP ((0,5),(k,l))) = true := by + decide +kernel +lemma CA1_7_8I1PairP_check_1_0 : ∀ k l : Fin 6, contains (CA1_7_8I1PairRaw ((1,0),(k,l))) (CA1_7_8I1PairP ((1,0),(k,l))) = true := by + decide +kernel +lemma CA1_7_8I1PairP_check_1_1 : ∀ k l : Fin 6, contains (CA1_7_8I1PairRaw ((1,1),(k,l))) (CA1_7_8I1PairP ((1,1),(k,l))) = true := by + decide +kernel +lemma CA1_7_8I1PairP_check_1_2 : ∀ k l : Fin 6, contains (CA1_7_8I1PairRaw ((1,2),(k,l))) (CA1_7_8I1PairP ((1,2),(k,l))) = true := by + decide +kernel +lemma CA1_7_8I1PairP_check_1_3 : ∀ k l : Fin 6, contains (CA1_7_8I1PairRaw ((1,3),(k,l))) (CA1_7_8I1PairP ((1,3),(k,l))) = true := by + decide +kernel +lemma CA1_7_8I1PairP_check_1_4 : ∀ k l : Fin 6, contains (CA1_7_8I1PairRaw ((1,4),(k,l))) (CA1_7_8I1PairP ((1,4),(k,l))) = true := by + decide +kernel +lemma CA1_7_8I1PairP_check_1_5 : ∀ k l : Fin 6, contains (CA1_7_8I1PairRaw ((1,5),(k,l))) (CA1_7_8I1PairP ((1,5),(k,l))) = true := by + decide +kernel +lemma CA1_7_8I1PairP_check_2_0 : ∀ k l : Fin 6, contains (CA1_7_8I1PairRaw ((2,0),(k,l))) (CA1_7_8I1PairP ((2,0),(k,l))) = true := by + decide +kernel +lemma CA1_7_8I1PairP_check_2_1 : ∀ k l : Fin 6, contains (CA1_7_8I1PairRaw ((2,1),(k,l))) (CA1_7_8I1PairP ((2,1),(k,l))) = true := by + decide +kernel +lemma CA1_7_8I1PairP_check_2_2 : ∀ k l : Fin 6, contains (CA1_7_8I1PairRaw ((2,2),(k,l))) (CA1_7_8I1PairP ((2,2),(k,l))) = true := by + decide +kernel +lemma CA1_7_8I1PairP_check_2_3 : ∀ k l : Fin 6, contains (CA1_7_8I1PairRaw ((2,3),(k,l))) (CA1_7_8I1PairP ((2,3),(k,l))) = true := by + decide +kernel +lemma CA1_7_8I1PairP_check_2_4 : ∀ k l : Fin 6, contains (CA1_7_8I1PairRaw ((2,4),(k,l))) (CA1_7_8I1PairP ((2,4),(k,l))) = true := by + decide +kernel +lemma CA1_7_8I1PairP_check_2_5 : ∀ k l : Fin 6, contains (CA1_7_8I1PairRaw ((2,5),(k,l))) (CA1_7_8I1PairP ((2,5),(k,l))) = true := by + decide +kernel +lemma CA1_7_8I1PairP_check_3_0 : ∀ k l : Fin 6, contains (CA1_7_8I1PairRaw ((3,0),(k,l))) (CA1_7_8I1PairP ((3,0),(k,l))) = true := by + decide +kernel +lemma CA1_7_8I1PairP_check_3_1 : ∀ k l : Fin 6, contains (CA1_7_8I1PairRaw ((3,1),(k,l))) (CA1_7_8I1PairP ((3,1),(k,l))) = true := by + decide +kernel +lemma CA1_7_8I1PairP_check_3_2 : ∀ k l : Fin 6, contains (CA1_7_8I1PairRaw ((3,2),(k,l))) (CA1_7_8I1PairP ((3,2),(k,l))) = true := by + decide +kernel +lemma CA1_7_8I1PairP_check_3_3 : ∀ k l : Fin 6, contains (CA1_7_8I1PairRaw ((3,3),(k,l))) (CA1_7_8I1PairP ((3,3),(k,l))) = true := by + decide +kernel +lemma CA1_7_8I1PairP_check_3_4 : ∀ k l : Fin 6, contains (CA1_7_8I1PairRaw ((3,4),(k,l))) (CA1_7_8I1PairP ((3,4),(k,l))) = true := by + decide +kernel +lemma CA1_7_8I1PairP_check_3_5 : ∀ k l : Fin 6, contains (CA1_7_8I1PairRaw ((3,5),(k,l))) (CA1_7_8I1PairP ((3,5),(k,l))) = true := by + decide +kernel +lemma CA1_7_8I1PairP_check_4_0 : ∀ k l : Fin 6, contains (CA1_7_8I1PairRaw ((4,0),(k,l))) (CA1_7_8I1PairP ((4,0),(k,l))) = true := by + decide +kernel +lemma CA1_7_8I1PairP_check_4_1 : ∀ k l : Fin 6, contains (CA1_7_8I1PairRaw ((4,1),(k,l))) (CA1_7_8I1PairP ((4,1),(k,l))) = true := by + decide +kernel +lemma CA1_7_8I1PairP_check_4_2 : ∀ k l : Fin 6, contains (CA1_7_8I1PairRaw ((4,2),(k,l))) (CA1_7_8I1PairP ((4,2),(k,l))) = true := by + decide +kernel +lemma CA1_7_8I1PairP_check_4_3 : ∀ k l : Fin 6, contains (CA1_7_8I1PairRaw ((4,3),(k,l))) (CA1_7_8I1PairP ((4,3),(k,l))) = true := by + decide +kernel +lemma CA1_7_8I1PairP_check_4_4 : ∀ k l : Fin 6, contains (CA1_7_8I1PairRaw ((4,4),(k,l))) (CA1_7_8I1PairP ((4,4),(k,l))) = true := by + decide +kernel +lemma CA1_7_8I1PairP_check_4_5 : ∀ k l : Fin 6, contains (CA1_7_8I1PairRaw ((4,5),(k,l))) (CA1_7_8I1PairP ((4,5),(k,l))) = true := by + decide +kernel +lemma CA1_7_8I1PairP_check_5_0 : ∀ k l : Fin 6, contains (CA1_7_8I1PairRaw ((5,0),(k,l))) (CA1_7_8I1PairP ((5,0),(k,l))) = true := by + decide +kernel +lemma CA1_7_8I1PairP_check_5_1 : ∀ k l : Fin 6, contains (CA1_7_8I1PairRaw ((5,1),(k,l))) (CA1_7_8I1PairP ((5,1),(k,l))) = true := by + decide +kernel +lemma CA1_7_8I1PairP_check_5_2 : ∀ k l : Fin 6, contains (CA1_7_8I1PairRaw ((5,2),(k,l))) (CA1_7_8I1PairP ((5,2),(k,l))) = true := by + decide +kernel +lemma CA1_7_8I1PairP_check_5_3 : ∀ k l : Fin 6, contains (CA1_7_8I1PairRaw ((5,3),(k,l))) (CA1_7_8I1PairP ((5,3),(k,l))) = true := by + decide +kernel +lemma CA1_7_8I1PairP_check_5_4 : ∀ k l : Fin 6, contains (CA1_7_8I1PairRaw ((5,4),(k,l))) (CA1_7_8I1PairP ((5,4),(k,l))) = true := by + decide +kernel +lemma CA1_7_8I1PairP_check_5_5 : ∀ k l : Fin 6, contains (CA1_7_8I1PairRaw ((5,5),(k,l))) (CA1_7_8I1PairP ((5,5),(k,l))) = true := by + decide +kernel +lemma CA1_7_8I1PairP_check (a : PairSlot × PairSlot) : contains (CA1_7_8I1PairRaw a) (CA1_7_8I1PairP a) = true := by + rcases a with ⟨⟨i,j⟩,⟨k,l⟩⟩ + revert j i + apply forall_fin6 + · exact forall_fin6 (CA1_7_8I1PairP_check_0_0 k l) (CA1_7_8I1PairP_check_0_1 k l) (CA1_7_8I1PairP_check_0_2 k l) (CA1_7_8I1PairP_check_0_3 k l) (CA1_7_8I1PairP_check_0_4 k l) (CA1_7_8I1PairP_check_0_5 k l) + · exact forall_fin6 (CA1_7_8I1PairP_check_1_0 k l) (CA1_7_8I1PairP_check_1_1 k l) (CA1_7_8I1PairP_check_1_2 k l) (CA1_7_8I1PairP_check_1_3 k l) (CA1_7_8I1PairP_check_1_4 k l) (CA1_7_8I1PairP_check_1_5 k l) + · exact forall_fin6 (CA1_7_8I1PairP_check_2_0 k l) (CA1_7_8I1PairP_check_2_1 k l) (CA1_7_8I1PairP_check_2_2 k l) (CA1_7_8I1PairP_check_2_3 k l) (CA1_7_8I1PairP_check_2_4 k l) (CA1_7_8I1PairP_check_2_5 k l) + · exact forall_fin6 (CA1_7_8I1PairP_check_3_0 k l) (CA1_7_8I1PairP_check_3_1 k l) (CA1_7_8I1PairP_check_3_2 k l) (CA1_7_8I1PairP_check_3_3 k l) (CA1_7_8I1PairP_check_3_4 k l) (CA1_7_8I1PairP_check_3_5 k l) + · exact forall_fin6 (CA1_7_8I1PairP_check_4_0 k l) (CA1_7_8I1PairP_check_4_1 k l) (CA1_7_8I1PairP_check_4_2 k l) (CA1_7_8I1PairP_check_4_3 k l) (CA1_7_8I1PairP_check_4_4 k l) (CA1_7_8I1PairP_check_4_5 k l) + · exact forall_fin6 (CA1_7_8I1PairP_check_5_0 k l) (CA1_7_8I1PairP_check_5_1 k l) (CA1_7_8I1PairP_check_5_2 k l) (CA1_7_8I1PairP_check_5_3 k l) (CA1_7_8I1PairP_check_5_4 k l) (CA1_7_8I1PairP_check_5_5 k l) +lemma CA1_7_8I1PairP_sound (a : PairSlot × PairSlot) : + (CA1_7_8I1PairP a).Encloses (CA1_7_8I1PairValue a) := + contains_sound (CA1_7_8I1PairRaw_sound a) (CA1_7_8I1PairP_check a) +def CA1_7_8I1PairTerms (a : PairSlot × PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_7_8I1PairCertificates (CA1_7_8I1PairCertificateIndex a)).output +lemma CA1_7_8I1PairTerms_sound (a : PairSlot × PairSlot) : + (CA1_7_8I1PairTerms a).Encloses (Foundation.entropyTerm (CA1_7_8I1PairValue a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_7_8I1PairCertificates_valid + (CA1_7_8I1PairCertificateIndex a) (CA1_7_8I1PairP_sound a) +def CA1_7_8I1PairEntropy : Ball := ⟨(20743720621129846018702258959579 / 6250000000000000000000000000000), (31761715599 / 25000000000000000000000000000000)⟩ +lemma CA1_7_8I1PairEntropy_sound : CA1_7_8I1PairEntropy.Encloses (Foundation.finiteEntropy CA1_7_8I1PairValue) := by + exact contains_sound (entropyDoublePair_enclosed CA1_7_8I1PairValue CA1_7_8I1PairTerms CA1_7_8I1PairTerms_sound) (by decide +kernel) +def CA1_7_8I1PairMass : Ball := ⟨1, (133 / 25000000000000000000000000000000)⟩ +lemma CA1_7_8I1PairMass_sound : CA1_7_8I1PairMass.Encloses (∑ a, CA1_7_8I1PairValue a) := by + exact contains_sound (doublePairSumBall_sound CA1_7_8I1PairP CA1_7_8I1PairValue CA1_7_8I1PairP_sound) (by decide +kernel) +def CA1_7_8I1PairMassTermLogWitness : LogWitness := ⟨0, 1, 1⟩ +def CA1_7_8I1PairMassTermLog : Ball := ⟨0, (10587912107 / 50000000000000000000000000000000)⟩ +lemma CA1_7_8I1PairMassTermLog_sound : CA1_7_8I1PairMassTermLog.Encloses (Real.log ((∑ a, CA1_7_8I1PairValue a))) := by + exact checkLog_sound logTwoBall_sound (CA1_7_8I1PairMass_sound) (w := CA1_7_8I1PairMassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA1_7_8I1PairMassTerm : Ball := ⟨0, (4235164843 / 20000000000000000000000000000000)⟩ +lemma CA1_7_8I1PairMassTerm_sound : CA1_7_8I1PairMassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_7_8I1PairValue a))) := by + exact contains_sound (entropyTerm_ball (CA1_7_8I1PairMass_sound) CA1_7_8I1PairMassTermLog_sound) (by decide +kernel) +def CA1_7_8I1PairH : Ball := ⟨(20743720621129846018702258959579 / 6250000000000000000000000000000), (148222686611 / 100000000000000000000000000000000)⟩ +lemma CA1_7_8I1PairH_sound : CA1_7_8I1PairH.Encloses (homogeneousEntropy CA1_7_8I1PairValue) := by + exact contains_sound (homogeneous_enclosed CA1_7_8I1PairValue CA1_7_8I1PairMassTerm_sound CA1_7_8I1PairEntropy_sound) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA1_7_8I2.lean b/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA1_7_8I2.lean new file mode 100644 index 0000000000000000000000000000000000000000..55d98f9746f24bf5b1b8f27e1d124ffc2dbb6b85 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA1_7_8I2.lean @@ -0,0 +1,860 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.CapacityA.CapA1_7_8I2Pair + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CA1_7_8I2R0Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 7 8)) (fun u => (stageALaw (shape 1 7 8) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 0 a +def CA1_7_8I2R0Raw (a : PairSlot) : Ball := residualBall (below (shape 1 7 8)) A1_7_8Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 0 a +lemma CA1_7_8I2R0Raw_sound (a : PairSlot) : + (CA1_7_8I2R0Raw a).Encloses (CA1_7_8I2R0Value a) := by + exact residualBall_sound_on (below (shape 1 7 8)) A1_7_8Law (fun u => (stageALaw (shape 1 7 8) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A1_7_8Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 7 8) (show (shape 1 7 8) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 0 a +def CA1_7_8I2R0Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(20055422158842954722213457 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(154649177236918223514006467 / 50000000000000000000000000000000), (101943 / 100000000000000000000000000000000)⟩ ⟨(-1542218119489740070137408646605969 / 100000000000000000000000000000000), (254112377287 / 50000000000000000000000000000000)⟩ ⟨-23, 20055422158842954722213457, 11920928955078125000000000⟩] +lemma CA1_7_8I2R0Certificates_valid : + CA1_7_8I2R0Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_7_8I2R0CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 0, 0 => 1 + | _, _ => 0 +def CA1_7_8I2R0P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_7_8I2R0Certificates (CA1_7_8I2R0CertificateIndex a)).input +lemma CA1_7_8I2R0P_check : ∀ a : PairSlot, contains (CA1_7_8I2R0Raw a) (CA1_7_8I2R0P a) = true := by + decide +kernel +lemma CA1_7_8I2R0P_sound (a : PairSlot) : + (CA1_7_8I2R0P a).Encloses (CA1_7_8I2R0Value a) := + contains_sound (CA1_7_8I2R0Raw_sound a) (CA1_7_8I2R0P_check a) +def CA1_7_8I2R0Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_7_8I2R0Certificates (CA1_7_8I2R0CertificateIndex a)).output +lemma CA1_7_8I2R0Terms_sound (a : PairSlot) : + (CA1_7_8I2R0Terms a).Encloses (Foundation.entropyTerm (CA1_7_8I2R0Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_7_8I2R0Certificates_valid + (CA1_7_8I2R0CertificateIndex a) (CA1_7_8I2R0P_sound a) +def CA1_7_8I2R0Entropy : Ball := ⟨(154649177236918223514006467 / 50000000000000000000000000000000), (101943 / 100000000000000000000000000000000)⟩ +lemma CA1_7_8I2R0Entropy_sound : CA1_7_8I2R0Entropy.Encloses (Foundation.finiteEntropy CA1_7_8I2R0Value) := by + exact contains_sound (entropyPair_enclosed CA1_7_8I2R0Value CA1_7_8I2R0Terms CA1_7_8I2R0Terms_sound) (by decide +kernel) +def CA1_7_8I2R0Mass : Ball := ⟨(20055422158842954722213457 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ +lemma CA1_7_8I2R0Mass_sound : CA1_7_8I2R0Mass.Encloses (∑ a, CA1_7_8I2R0Value a) := by + exact contains_sound (pairSumBall_sound CA1_7_8I2R0P CA1_7_8I2R0Value CA1_7_8I2R0P_sound) (by decide +kernel) +def CA1_7_8I2R0MassTermLogWitness : LogWitness := ⟨-23, 20055422158842954722213457, 11920928955078125000000000⟩ +def CA1_7_8I2R0MassTermLog : Ball := ⟨(-1542218119489740070137408646605969 / 100000000000000000000000000000000), (254112377287 / 50000000000000000000000000000000)⟩ +lemma CA1_7_8I2R0MassTermLog_sound : CA1_7_8I2R0MassTermLog.Encloses (Real.log ((∑ a, CA1_7_8I2R0Value a))) := by + exact checkLog_sound logTwoBall_sound (CA1_7_8I2R0Mass_sound) (w := CA1_7_8I2R0MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA1_7_8I2R0MassTerm : Ball := ⟨(154649177236918223514006467 / 50000000000000000000000000000000), (101943 / 100000000000000000000000000000000)⟩ +lemma CA1_7_8I2R0MassTerm_sound : CA1_7_8I2R0MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_7_8I2R0Value a))) := by + exact contains_sound (entropyTerm_ball (CA1_7_8I2R0Mass_sound) CA1_7_8I2R0MassTermLog_sound) (by decide +kernel) +def CA1_7_8I2R0H : Ball := ⟨0, (101943 / 50000000000000000000000000000000)⟩ +lemma CA1_7_8I2R0H_sound : CA1_7_8I2R0H.Encloses (homogeneousEntropy CA1_7_8I2R0Value) := by + exact contains_sound (homogeneous_enclosed CA1_7_8I2R0Value CA1_7_8I2R0MassTerm_sound CA1_7_8I2R0Entropy_sound) (by decide +kernel) +def CA1_7_8I2R1Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 7 8)) (fun u => (stageALaw (shape 1 7 8) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 1 a +def CA1_7_8I2R1Raw (a : PairSlot) : Ball := residualBall (below (shape 1 7 8)) A1_7_8Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 1 a +lemma CA1_7_8I2R1Raw_sound (a : PairSlot) : + (CA1_7_8I2R1Raw a).Encloses (CA1_7_8I2R1Value a) := by + exact residualBall_sound_on (below (shape 1 7 8)) A1_7_8Law (fun u => (stageALaw (shape 1 7 8) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A1_7_8Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 7 8) (show (shape 1 7 8) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 1 a +def CA1_7_8I2R1Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(500003178829468586018862723 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(26491739363016102819996227157 / 100000000000000000000000000000000), (4499897 / 50000000000000000000000000000000)⟩ ⟨(-1059662837545734601079131994385727 / 100000000000000000000000000000000), (35998904261 / 10000000000000000000000000000000)⟩ ⟨-16, 500003178829468586018862723, 305175781250000000000000000⟩] +lemma CA1_7_8I2R1Certificates_valid : + CA1_7_8I2R1Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_7_8I2R1CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 1, 0 => 1 + | 0, 1 => 1 + | _, _ => 0 +def CA1_7_8I2R1P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_7_8I2R1Certificates (CA1_7_8I2R1CertificateIndex a)).input +lemma CA1_7_8I2R1P_check : ∀ a : PairSlot, contains (CA1_7_8I2R1Raw a) (CA1_7_8I2R1P a) = true := by + decide +kernel +lemma CA1_7_8I2R1P_sound (a : PairSlot) : + (CA1_7_8I2R1P a).Encloses (CA1_7_8I2R1Value a) := + contains_sound (CA1_7_8I2R1Raw_sound a) (CA1_7_8I2R1P_check a) +def CA1_7_8I2R1Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_7_8I2R1Certificates (CA1_7_8I2R1CertificateIndex a)).output +lemma CA1_7_8I2R1Terms_sound (a : PairSlot) : + (CA1_7_8I2R1Terms a).Encloses (Foundation.entropyTerm (CA1_7_8I2R1Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_7_8I2R1Certificates_valid + (CA1_7_8I2R1CertificateIndex a) (CA1_7_8I2R1P_sound a) +def CA1_7_8I2R1Entropy : Ball := ⟨(26491739363016102819996227157 / 50000000000000000000000000000000), (4499897 / 25000000000000000000000000000000)⟩ +lemma CA1_7_8I2R1Entropy_sound : CA1_7_8I2R1Entropy.Encloses (Foundation.finiteEntropy CA1_7_8I2R1Value) := by + exact contains_sound (entropyPair_enclosed CA1_7_8I2R1Value CA1_7_8I2R1Terms CA1_7_8I2R1Terms_sound) (by decide +kernel) +def CA1_7_8I2R1Mass : Ball := ⟨(500003178829468586018862723 / 10000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ +lemma CA1_7_8I2R1Mass_sound : CA1_7_8I2R1Mass.Encloses (∑ a, CA1_7_8I2R1Value a) := by + exact contains_sound (pairSumBall_sound CA1_7_8I2R1P CA1_7_8I2R1Value CA1_7_8I2R1P_sound) (by decide +kernel) +def CA1_7_8I2R1MassTermLogWitness : LogWitness := ⟨-15, 500003178829468586018862723, 305175781250000000000000000⟩ +def CA1_7_8I2R1MassTermLog : Ball := ⟨(-990348119489740070137408801335397 / 100000000000000000000000000000000), (338813218927 / 100000000000000000000000000000000)⟩ +lemma CA1_7_8I2R1MassTermLog_sound : CA1_7_8I2R1MassTermLog.Encloses (Real.log ((∑ a, CA1_7_8I2R1Value a))) := by + exact checkLog_sound logTwoBall_sound (CA1_7_8I2R1Mass_sound) (w := CA1_7_8I2R1MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA1_7_8I2R1MassTerm : Ball := ⟨(49517720789265642780224169709 / 100000000000000000000000000000000), (16940789 / 100000000000000000000000000000000)⟩ +lemma CA1_7_8I2R1MassTerm_sound : CA1_7_8I2R1MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_7_8I2R1Value a))) := by + exact contains_sound (entropyTerm_ball (CA1_7_8I2R1Mass_sound) CA1_7_8I2R1MassTermLog_sound) (by decide +kernel) +def CA1_7_8I2R1H : Ball := ⟨(693151587353312571953656921 / 20000000000000000000000000000000), (34940377 / 100000000000000000000000000000000)⟩ +lemma CA1_7_8I2R1H_sound : CA1_7_8I2R1H.Encloses (homogeneousEntropy CA1_7_8I2R1Value) := by + exact contains_sound (homogeneous_enclosed CA1_7_8I2R1Value CA1_7_8I2R1MassTerm_sound CA1_7_8I2R1Entropy_sound) (by decide +kernel) +def CA1_7_8I2R2Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 7 8)) (fun u => (stageALaw (shape 1 7 8) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 2 a +def CA1_7_8I2R2Raw (a : PairSlot) : Ball := residualBall (below (shape 1 7 8)) A1_7_8Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 2 a +lemma CA1_7_8I2R2Raw_sound (a : PairSlot) : + (CA1_7_8I2R2Raw a).Encloses (CA1_7_8I2R2Value a) := by + exact residualBall_sound_on (below (shape 1 7 8)) A1_7_8Law (fun u => (stageALaw (shape 1 7 8) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A1_7_8Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 7 8) (show (shape 1 7 8) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 2 a +def CA1_7_8I2R2Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(6901476119098818328803909913 / 6250000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ ⟨(93978800260295301886260632691 / 12500000000000000000000000000000), (257214233 / 100000000000000000000000000000000)⟩ ⟨(-170215035592572034258704923374733 / 25000000000000000000000000000000), (232934062323 / 100000000000000000000000000000000)⟩ ⟨-10, 6901476119098818328803909913, 6103515625000000000000000000⟩, + .log ⟨(6637863771029997909709427399 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(118512261706038857164985553271 / 100000000000000000000000000000000), (9839359 / 25000000000000000000000000000000)⟩ ⟨(-223174702347893505751168115009279 / 25000000000000000000000000000000), (148230769547 / 50000000000000000000000000000000)⟩ ⟨-13, 6637863771029997909709427399, 6103515625000000000000000000⟩, + .log ⟨(26331697140349175004496990337 / 6250000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ ⟨(115218307755647618049893427511 / 5000000000000000000000000000000), (802937361 / 100000000000000000000000000000000)⟩ ⟨(-273478165738635879979847070629751 / 50000000000000000000000000000000), (95291206929 / 50000000000000000000000000000000)⟩ ⟨-8, 26331697140349175004496990337, 24414062500000000000000000000⟩] +lemma CA1_7_8I2R2Certificates_valid : + CA1_7_8I2R2Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_7_8I2R2CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 2, 0 => 1 + | 3, 0 => 2 + | 1, 1 => 3 + | 0, 2 => 1 + | 0, 3 => 2 + | _, _ => 0 +def CA1_7_8I2R2P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_7_8I2R2Certificates (CA1_7_8I2R2CertificateIndex a)).input +lemma CA1_7_8I2R2P_check : ∀ a : PairSlot, contains (CA1_7_8I2R2Raw a) (CA1_7_8I2R2P a) = true := by + decide +kernel +lemma CA1_7_8I2R2P_sound (a : PairSlot) : + (CA1_7_8I2R2P a).Encloses (CA1_7_8I2R2Value a) := + contains_sound (CA1_7_8I2R2Raw_sound a) (CA1_7_8I2R2P_check a) +def CA1_7_8I2R2Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_7_8I2R2Certificates (CA1_7_8I2R2CertificateIndex a)).output +lemma CA1_7_8I2R2Terms_sound (a : PairSlot) : + (CA1_7_8I2R2Terms a).Encloses (Foundation.entropyTerm (CA1_7_8I2R2Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_7_8I2R2Certificates_valid + (CA1_7_8I2R2CertificateIndex a) (CA1_7_8I2R2P_sound a) +def CA1_7_8I2R2Entropy : Ball := ⟨(2022525741344877452754004889909 / 50000000000000000000000000000000), (1396080699 / 100000000000000000000000000000000)⟩ +lemma CA1_7_8I2R2Entropy_sound : CA1_7_8I2R2Entropy.Encloses (Foundation.finiteEntropy CA1_7_8I2R2Value) := by + exact contains_sound (entropyPair_enclosed CA1_7_8I2R2Value CA1_7_8I2R2Terms CA1_7_8I2R2Terms_sound) (by decide +kernel) +def CA1_7_8I2R2Mass : Ball := ⟨(167176461285217244558128668051 / 25000000000000000000000000000000), (9 / 100000000000000000000000000000000)⟩ +lemma CA1_7_8I2R2Mass_sound : CA1_7_8I2R2Mass.Encloses (∑ a, CA1_7_8I2R2Value a) := by + exact contains_sound (pairSumBall_sound CA1_7_8I2R2P CA1_7_8I2R2Value CA1_7_8I2R2P_sound) (by decide +kernel) +def CA1_7_8I2R2MassTermLogWitness : LogWitness := ⟨-8, 167176461285217244558128668051, 97656250000000000000000000000⟩ +def CA1_7_8I2R2MassTermLog : Ball := ⟨(-500758119489740070137408935000643 / 100000000000000000000000000000000), (47645603623 / 25000000000000000000000000000000)⟩ +lemma CA1_7_8I2R2MassTermLog_sound : CA1_7_8I2R2MassTermLog.Encloses (Real.log ((∑ a, CA1_7_8I2R2Value a))) := by + exact checkLog_sound logTwoBall_sound (CA1_7_8I2R2Mass_sound) (w := CA1_7_8I2R2MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA1_7_8I2R2MassTerm : Ball := ⟨(3348598815045388870657504831627 / 100000000000000000000000000000000), (1274435791 / 100000000000000000000000000000000)⟩ +lemma CA1_7_8I2R2MassTerm_sound : CA1_7_8I2R2MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_7_8I2R2Value a))) := by + exact contains_sound (entropyTerm_ball (CA1_7_8I2R2Mass_sound) CA1_7_8I2R2MassTermLog_sound) (by decide +kernel) +def CA1_7_8I2R2H : Ball := ⟨(696452667644366034850504948191 / 100000000000000000000000000000000), (267051649 / 10000000000000000000000000000000)⟩ +lemma CA1_7_8I2R2H_sound : CA1_7_8I2R2H.Encloses (homogeneousEntropy CA1_7_8I2R2Value) := by + exact contains_sound (homogeneous_enclosed CA1_7_8I2R2Value CA1_7_8I2R2MassTerm_sound CA1_7_8I2R2Entropy_sound) (by decide +kernel) +def CA1_7_8I2R3Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 7 8)) (fun u => (stageALaw (shape 1 7 8) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 3 a +def CA1_7_8I2R3Raw (a : PairSlot) : Ball := residualBall (below (shape 1 7 8)) A1_7_8Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 3 a +lemma CA1_7_8I2R3Raw_sound (a : PairSlot) : + (CA1_7_8I2R3Raw a).Encloses (CA1_7_8I2R3Value a) := by + exact residualBall_sound_on (below (shape 1 7 8)) A1_7_8Law (fun u => (stageALaw (shape 1 7 8) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A1_7_8Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 7 8) (show (shape 1 7 8) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 3 a +def CA1_7_8I2R3Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(171743595120508560595316956867 / 100000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ ⟨(1093478216067274206814721842293 / 100000000000000000000000000000000), (80009869 / 20000000000000000000000000000000)⟩ ⟨(-636692282643789715464628421873219 / 100000000000000000000000000000000), (232934061677 / 100000000000000000000000000000000)⟩ ⟨-10, 171743595120508560595316956867, 97656250000000000000000000000⟩, + .log ⟨(1167996827666824018164785371949 / 20000000000000000000000000000000), (7 / 50000000000000000000000000000000)⟩ ⟨(16588136840167857806241731428483 / 100000000000000000000000000000000), (185499713 / 2500000000000000000000000000000)⟩ ⟨(-56808842103806443701938133479403 / 20000000000000000000000000000000), (63527471169 / 50000000000000000000000000000000)⟩ ⟨-5, 1167996827666824018164785371949, 625000000000000000000000000000⟩, + .log ⟨(141421815855210237963391325627 / 25000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ ⟨(731841503094153733525420656171 / 25000000000000000000000000000000), (1078100451 / 100000000000000000000000000000000)⟩ ⟨(-51748840775982113515491899460717 / 10000000000000000000000000000000), (381164827 / 200000000000000000000000000000)⟩ ⟨-8, 141421815855210237963391325627, 97656250000000000000000000000⟩] +lemma CA1_7_8I2R3Certificates_valid : + CA1_7_8I2R3Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_7_8I2R3CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 4, 0 => 1 + | 2, 1 => 2 + | 3, 1 => 3 + | 1, 2 => 2 + | 1, 3 => 3 + | 0, 4 => 1 + | _, _ => 0 +def CA1_7_8I2R3P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_7_8I2R3Certificates (CA1_7_8I2R3CertificateIndex a)).input +lemma CA1_7_8I2R3P_check : ∀ a : PairSlot, contains (CA1_7_8I2R3Raw a) (CA1_7_8I2R3P a) = true := by + decide +kernel +lemma CA1_7_8I2R3P_sound (a : PairSlot) : + (CA1_7_8I2R3P a).Encloses (CA1_7_8I2R3Value a) := + contains_sound (CA1_7_8I2R3Raw_sound a) (CA1_7_8I2R3P_check a) +def CA1_7_8I2R3Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_7_8I2R3Certificates (CA1_7_8I2R3CertificateIndex a)).output +lemma CA1_7_8I2R3Terms_sound (a : PairSlot) : + (CA1_7_8I2R3Terms a).Encloses (Foundation.entropyTerm (CA1_7_8I2R3Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_7_8I2R3Certificates_valid + (CA1_7_8I2R3CertificateIndex a) (CA1_7_8I2R3P_sound a) +def CA1_7_8I2R3Entropy : Ball := ⟨(1030449053430587347357906794773 / 2500000000000000000000000000000), (2224534579 / 12500000000000000000000000000000)⟩ +lemma CA1_7_8I2R3Entropy_sound : CA1_7_8I2R3Entropy.Encloses (Foundation.finiteEntropy CA1_7_8I2R3Value) := by + exact contains_sound (entropyPair_enclosed CA1_7_8I2R3Value CA1_7_8I2R3Terms CA1_7_8I2R3Terms_sound) (by decide +kernel) +def CA1_7_8I2R3Mass : Ball := ⟨(82217687460943370040910113989 / 625000000000000000000000000000), (9 / 25000000000000000000000000000000)⟩ +lemma CA1_7_8I2R3Mass_sound : CA1_7_8I2R3Mass.Encloses (∑ a, CA1_7_8I2R3Value a) := by + exact contains_sound (pairSumBall_sound CA1_7_8I2R3P CA1_7_8I2R3Value CA1_7_8I2R3P_sound) (by decide +kernel) +def CA1_7_8I2R3MassTermLogWitness : LogWitness := ⟨-3, 82217687460943370040910113989, 78125000000000000000000000000⟩ +def CA1_7_8I2R3MassTermLog : Ball := ⟨(-4056762389794801402748180609559 / 2000000000000000000000000000000), (16940659001 / 20000000000000000000000000000000)⟩ +lemma CA1_7_8I2R3MassTermLog_sound : CA1_7_8I2R3MassTermLog.Encloses (Real.log ((∑ a, CA1_7_8I2R3Value a))) := by + exact checkLog_sound logTwoBall_sound (CA1_7_8I2R3Mass_sound) (w := CA1_7_8I2R3MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA1_7_8I2R3MassTerm : Ball := ⟨(26683009781396696269243426562597 / 100000000000000000000000000000000), (11142574531 / 100000000000000000000000000000000)⟩ +lemma CA1_7_8I2R3MassTerm_sound : CA1_7_8I2R3MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_7_8I2R3Value a))) := by + exact contains_sound (entropyTerm_ball (CA1_7_8I2R3Mass_sound) CA1_7_8I2R3MassTermLog_sound) (by decide +kernel) +def CA1_7_8I2R3H : Ball := ⟨(14534952355826797625072845228323 / 100000000000000000000000000000000), (28938851163 / 100000000000000000000000000000000)⟩ +lemma CA1_7_8I2R3H_sound : CA1_7_8I2R3H.Encloses (homogeneousEntropy CA1_7_8I2R3Value) := by + exact contains_sound (homogeneous_enclosed CA1_7_8I2R3Value CA1_7_8I2R3MassTerm_sound CA1_7_8I2R3Entropy_sound) (by decide +kernel) +def CA1_7_8I2R4Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 7 8)) (fun u => (stageALaw (shape 1 7 8) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 4 a +def CA1_7_8I2R4Raw (a : PairSlot) : Ball := residualBall (below (shape 1 7 8)) A1_7_8Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 4 a +lemma CA1_7_8I2R4Raw_sound (a : PairSlot) : + (CA1_7_8I2R4Raw a).Encloses (CA1_7_8I2R4Value a) := by + exact residualBall_sound_on (below (shape 1 7 8)) A1_7_8Law (fun u => (stageALaw (shape 1 7 8) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A1_7_8Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 7 8) (show (shape 1 7 8) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 4 a +def CA1_7_8I2R4Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(5699036240698246021355651399 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(6961820416627277872998155103 / 12500000000000000000000000000000), (9654549 / 50000000000000000000000000000000)⟩ ⟨(-30539463703139723814056889945813 / 3125000000000000000000000000000), (169406598237 / 50000000000000000000000000000000)⟩ ⟨-15, 5699036240698246021355651399, 3051757812500000000000000000⟩, + .log ⟨(2257891568295462797970246580127 / 100000000000000000000000000000000), (7 / 100000000000000000000000000000000)⟩ ⟨(8559077044393300420616931473893 / 100000000000000000000000000000000), (3346889997 / 100000000000000000000000000000000)⟩ ⟨(-75814774850811419881007148354869 / 20000000000000000000000000000000), (148230766091 / 100000000000000000000000000000000)⟩ ⟨-6, 2257891568295462797970246580127, 1562500000000000000000000000000⟩, + .log ⟨(23994122698647338646957836425373 / 100000000000000000000000000000000), (23 / 100000000000000000000000000000000)⟩ ⟨(34248281524131016482456459253889 / 100000000000000000000000000000000), (812952501 / 4000000000000000000000000000000)⟩ ⟨(-142736127318636046291139066619667 / 100000000000000000000000000000000), (21175823707 / 25000000000000000000000000000000)⟩ ⟨-3, 23994122698647338646957836425373, 12500000000000000000000000000000⟩, + .log ⟨(311023681798977723241057577217 / 25000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ ⟨(109150950650344740952208527501 / 2000000000000000000000000000000), (2107578459 / 100000000000000000000000000000000)⟩ ⟨(-109669051182664135222659014302887 / 25000000000000000000000000000000), (21175823703 / 12500000000000000000000000000000)⟩ ⟨-7, 311023681798977723241057577217, 195312500000000000000000000000⟩, + .log ⟨(1482262599464787529958594107 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(7727189516629883541337234119 / 25000000000000000000000000000000), (10671977 / 100000000000000000000000000000000)⟩ ⟨(-208524171612236643227328646315203 / 20000000000000000000000000000000), (359989036343 / 100000000000000000000000000000000)⟩ ⟨-16, 1482262599464787529958594107, 762939453125000000000000000⟩] +lemma CA1_7_8I2R4Certificates_valid : + CA1_7_8I2R4Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_7_8I2R4CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 5, 0 => 1 + | 4, 1 => 2 + | 2, 2 => 3 + | 2, 3 => 4 + | 3, 2 => 4 + | 3, 3 => 5 + | 1, 4 => 2 + | 0, 5 => 1 + | _, _ => 0 +def CA1_7_8I2R4P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_7_8I2R4Certificates (CA1_7_8I2R4CertificateIndex a)).input +lemma CA1_7_8I2R4P_check : ∀ a : PairSlot, contains (CA1_7_8I2R4Raw a) (CA1_7_8I2R4P a) = true := by + decide +kernel +lemma CA1_7_8I2R4P_sound (a : PairSlot) : + (CA1_7_8I2R4P a).Encloses (CA1_7_8I2R4Value a) := + contains_sound (CA1_7_8I2R4Raw_sound a) (CA1_7_8I2R4P_check a) +def CA1_7_8I2R4Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_7_8I2R4Certificates (CA1_7_8I2R4CertificateIndex a)).output +lemma CA1_7_8I2R4Terms_sound (a : PairSlot) : + (CA1_7_8I2R4Terms a).Encloses (Foundation.entropyTerm (CA1_7_8I2R4Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_7_8I2R4Certificates_valid + (CA1_7_8I2R4CertificateIndex a) (CA1_7_8I2R4P_sound a) +def CA1_7_8I2R4Entropy : Ball := ⟨(62423828562684647399044494369899 / 100000000000000000000000000000000), (3128203961 / 10000000000000000000000000000000)⟩ +lemma CA1_7_8I2R4Entropy_sound : CA1_7_8I2R4Entropy.Encloses (Foundation.finiteEntropy CA1_7_8I2R4Value) := by + exact contains_sound (entropyPair_enclosed CA1_7_8I2R4Value CA1_7_8I2R4Terms CA1_7_8I2R4Terms_sound) (by decide +kernel) +def CA1_7_8I2R4Mass : Ball := ⟨(49619932619696659353487069911 / 160000000000000000000000000000), (11 / 25000000000000000000000000000000)⟩ +lemma CA1_7_8I2R4Mass_sound : CA1_7_8I2R4Mass.Encloses (∑ a, CA1_7_8I2R4Value a) := by + exact contains_sound (pairSumBall_sound CA1_7_8I2R4P CA1_7_8I2R4Value CA1_7_8I2R4P_sound) (by decide +kernel) +def CA1_7_8I2R4MassTermLogWitness : LogWitness := ⟨-2, 49619932619696659353487069911, 40000000000000000000000000000⟩ +def CA1_7_8I2R4MassTermLog : Ball := ⟨(-117078119489740070137409049573447 / 100000000000000000000000000000000), (6352747119 / 10000000000000000000000000000000)⟩ +lemma CA1_7_8I2R4MassTermLog_sound : CA1_7_8I2R4MassTermLog.Encloses (Real.log ((∑ a, CA1_7_8I2R4Value a))) := by + exact checkLog_sound logTwoBall_sound (CA1_7_8I2R4Mass_sound) (w := CA1_7_8I2R4MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA1_7_8I2R4MassTerm : Ball := ⟨(36308802502010603181711095923221 / 100000000000000000000000000000000), (9850715151 / 50000000000000000000000000000000)⟩ +lemma CA1_7_8I2R4MassTerm_sound : CA1_7_8I2R4MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_7_8I2R4Value a))) := by + exact contains_sound (entropyTerm_ball (CA1_7_8I2R4Mass_sound) CA1_7_8I2R4MassTermLog_sound) (by decide +kernel) +def CA1_7_8I2R4H : Ball := ⟨(13057513030337022108666699223339 / 50000000000000000000000000000000), (6372933739 / 12500000000000000000000000000000)⟩ +lemma CA1_7_8I2R4H_sound : CA1_7_8I2R4H.Encloses (homogeneousEntropy CA1_7_8I2R4Value) := by + exact contains_sound (homogeneous_enclosed CA1_7_8I2R4Value CA1_7_8I2R4MassTerm_sound CA1_7_8I2R4Entropy_sound) (by decide +kernel) +def CA1_7_8I2R5Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 7 8)) (fun u => (stageALaw (shape 1 7 8) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 5 a +def CA1_7_8I2R5Raw (a : PairSlot) : Ball := residualBall (below (shape 1 7 8)) A1_7_8Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 5 a +lemma CA1_7_8I2R5Raw_sound (a : PairSlot) : + (CA1_7_8I2R5Raw a).Encloses (CA1_7_8I2R5Value a) := by + exact residualBall_sound_on (below (shape 1 7 8)) A1_7_8Law (fun u => (stageALaw (shape 1 7 8) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A1_7_8Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 7 8) (show (shape 1 7 8) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 5 a +def CA1_7_8I2R5Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(908997158043255639612862667 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(18583618645481023349914450091 / 50000000000000000000000000000000), (12319221 / 100000000000000000000000000000000)⟩ ⟨(-255551110378123718117001657366033 / 25000000000000000000000000000000), (33881320643 / 10000000000000000000000000000000)⟩ ⟨-15, 908997158043255639612862667, 762939453125000000000000000⟩, + .log ⟨(2414884884244844550619283217397 / 100000000000000000000000000000000), (11 / 100000000000000000000000000000000)⟩ ⟨(4495934351825481781121280185721 / 50000000000000000000000000000000), (3579602409 / 100000000000000000000000000000000)⟩ ⟨(-37235185669990223567042408692579 / 10000000000000000000000000000000), (37057691559 / 25000000000000000000000000000000)⟩ ⟨-6, 2414884884244844550619283217397, 1562500000000000000000000000000⟩, + .log ⟨(89118471959175795539073152043 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(6258753599911944504262624821 / 1000000000000000000000000000000), (45291771 / 20000000000000000000000000000000)⟩ ⟨(-702295883481823114987378298571253 / 100000000000000000000000000000000), (127054942659 / 50000000000000000000000000000000)⟩ ⟨-11, 89118471959175795539073152043, 48828125000000000000000000000⟩] +lemma CA1_7_8I2R5Certificates_valid : + CA1_7_8I2R5Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_7_8I2R5CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 5, 1 => 1 + | 4, 2 => 2 + | 4, 3 => 3 + | 2, 4 => 2 + | 3, 4 => 3 + | 1, 5 => 1 + | _, _ => 0 +def CA1_7_8I2R5P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_7_8I2R5Certificates (CA1_7_8I2R5CertificateIndex a)).input +lemma CA1_7_8I2R5P_check : ∀ a : PairSlot, contains (CA1_7_8I2R5Raw a) (CA1_7_8I2R5P a) = true := by + decide +kernel +lemma CA1_7_8I2R5P_sound (a : PairSlot) : + (CA1_7_8I2R5P a).Encloses (CA1_7_8I2R5Value a) := + contains_sound (CA1_7_8I2R5Raw_sound a) (CA1_7_8I2R5P_check a) +def CA1_7_8I2R5Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_7_8I2R5Certificates (CA1_7_8I2R5CertificateIndex a)).output +lemma CA1_7_8I2R5Terms_sound (a : PairSlot) : + (CA1_7_8I2R5Terms a).Encloses (Foundation.entropyTerm (CA1_7_8I2R5Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_7_8I2R5Certificates_valid + (CA1_7_8I2R5CertificateIndex a) (CA1_7_8I2R5P_sound a) +def CA1_7_8I2R5Entropy : Ball := ⟨(2413727825233280014842162938431 / 12500000000000000000000000000000), (763676097 / 10000000000000000000000000000000)⟩ +lemma CA1_7_8I2R5Entropy_sound : CA1_7_8I2R5Entropy.Encloses (Foundation.finiteEntropy CA1_7_8I2R5Value) := by + exact contains_sound (entropyPair_enclosed CA1_7_8I2R5Value CA1_7_8I2R5Terms CA1_7_8I2R5Terms_sound) (by decide +kernel) +def CA1_7_8I2R5Mass : Ball := ⟨(626909836209048342179201955027 / 12500000000000000000000000000000), (13 / 50000000000000000000000000000000)⟩ +lemma CA1_7_8I2R5Mass_sound : CA1_7_8I2R5Mass.Encloses (∑ a, CA1_7_8I2R5Value a) := by + exact contains_sound (pairSumBall_sound CA1_7_8I2R5P CA1_7_8I2R5Value CA1_7_8I2R5P_sound) (by decide +kernel) +def CA1_7_8I2R5MassTermLogWitness : LogWitness := ⟨-5, 626909836209048342179201955027, 390625000000000000000000000000⟩ +def CA1_7_8I2R5MassTermLog : Ball := ⟨(-29926811948974007013740899228697 / 10000000000000000000000000000000), (15881867827 / 12500000000000000000000000000000)⟩ +lemma CA1_7_8I2R5MassTermLog_sound : CA1_7_8I2R5MassTermLog.Encloses (Real.log ((∑ a, CA1_7_8I2R5Value a))) := by + exact checkLog_sound logTwoBall_sound (CA1_7_8I2R5Mass_sound) (w := CA1_7_8I2R5MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA1_7_8I2R5MassTerm : Ball := ⟨(3752282555438057105977780971651 / 25000000000000000000000000000000), (318607977 / 5000000000000000000000000000000)⟩ +lemma CA1_7_8I2R5MassTerm_sound : CA1_7_8I2R5MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_7_8I2R5Value a))) := by + exact contains_sound (entropyTerm_ball (CA1_7_8I2R5Mass_sound) CA1_7_8I2R5MassTermLog_sound) (by decide +kernel) +def CA1_7_8I2R5H : Ball := ⟨(1075173095028502923706544905211 / 25000000000000000000000000000000), (1400892051 / 10000000000000000000000000000000)⟩ +lemma CA1_7_8I2R5H_sound : CA1_7_8I2R5H.Encloses (homogeneousEntropy CA1_7_8I2R5Value) := by + exact contains_sound (homogeneous_enclosed CA1_7_8I2R5Value CA1_7_8I2R5MassTerm_sound CA1_7_8I2R5Entropy_sound) (by decide +kernel) +def CA1_7_8I2R6Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 7 8)) (fun u => (stageALaw (shape 1 7 8) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 6 a +def CA1_7_8I2R6Raw (a : PairSlot) : Ball := residualBall (below (shape 1 7 8)) A1_7_8Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 6 a +lemma CA1_7_8I2R6Raw_sound (a : PairSlot) : + (CA1_7_8I2R6Raw a).Encloses (CA1_7_8I2R6Value a) := by + exact residualBall_sound_on (below (shape 1 7 8)) A1_7_8Law (fun u => (stageALaw (shape 1 7 8) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A1_7_8Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 7 8) (show (shape 1 7 8) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 6 a +def CA1_7_8I2R6Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(267911455786341918508038917 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(15030618044618258481487988127 / 100000000000000000000000000000000), (2552967 / 50000000000000000000000000000000)⟩ ⟨(-1122058629445476432775534353488101 / 100000000000000000000000000000000), (76232980189 / 20000000000000000000000000000000)⟩ ⟨-17, 267911455786341918508038917, 152587890625000000000000000⟩, + .log ⟨(21099356402627791633381 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(881653449804663227882189 / 50000000000000000000000000000000), (119 / 20000000000000000000000000000000)⟩ ⟨(-1044644956202146119551450304729979 / 50000000000000000000000000000000), (16970280703 / 2500000000000000000000000000000)⟩ ⟨-31, 42198712805255583266762, 23283064365386962890625⟩, + .log ⟨(140463736612849046343823061117 / 100000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ ⟨(230640616665710923698920740229 / 25000000000000000000000000000000), (327187909 / 100000000000000000000000000000000)⟩ ⟨(-656797611191023566539967400269571 / 100000000000000000000000000000000), (29116757831 / 12500000000000000000000000000000)⟩ ⟨-10, 140463736612849046343823061117, 97656250000000000000000000000⟩] +lemma CA1_7_8I2R6Certificates_valid : + CA1_7_8I2R6Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_7_8I2R6CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 5, 2 => 1 + | 5, 3 => 2 + | 4, 4 => 3 + | 2, 5 => 1 + | 3, 5 => 2 + | _, _ => 0 +def CA1_7_8I2R6P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_7_8I2R6Certificates (CA1_7_8I2R6CertificateIndex a)).input +lemma CA1_7_8I2R6P_check : ∀ a : PairSlot, contains (CA1_7_8I2R6Raw a) (CA1_7_8I2R6P a) = true := by + decide +kernel +lemma CA1_7_8I2R6P_sound (a : PairSlot) : + (CA1_7_8I2R6P a).Encloses (CA1_7_8I2R6Value a) := + contains_sound (CA1_7_8I2R6Raw_sound a) (CA1_7_8I2R6P_check a) +def CA1_7_8I2R6Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_7_8I2R6Certificates (CA1_7_8I2R6CertificateIndex a)).output +lemma CA1_7_8I2R6Terms_sound (a : PairSlot) : + (CA1_7_8I2R6Terms a).Encloses (Foundation.entropyTerm (CA1_7_8I2R6Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_7_8I2R6Certificates_valid + (CA1_7_8I2R6CertificateIndex a) (CA1_7_8I2R6P_sound a) +def CA1_7_8I2R6Entropy : Ball := ⟨(476313614682939715205785232963 / 50000000000000000000000000000000), (337400967 / 100000000000000000000000000000000)⟩ +lemma CA1_7_8I2R6Entropy_sound : CA1_7_8I2R6Entropy.Encloses (Foundation.finiteEntropy CA1_7_8I2R6Value) := by + exact contains_sound (entropyPair_enclosed CA1_7_8I2R6Value CA1_7_8I2R6Terms CA1_7_8I2R6Terms_sound) (by decide +kernel) +def CA1_7_8I2R6Mass : Ball := ⟨(28628603993112737310247303467 / 20000000000000000000000000000000), (7 / 100000000000000000000000000000000)⟩ +lemma CA1_7_8I2R6Mass_sound : CA1_7_8I2R6Mass.Encloses (∑ a, CA1_7_8I2R6Value a) := by + exact contains_sound (pairSumBall_sound CA1_7_8I2R6P CA1_7_8I2R6Value CA1_7_8I2R6P_sound) (by decide +kernel) +def CA1_7_8I2R6MassTermLogWitness : LogWitness := ⟨-10, 28628603993112737310247303467, 19531250000000000000000000000⟩ +def CA1_7_8I2R6MassTermLog : Ball := ⟨(-163727029872435017534352224202163 / 25000000000000000000000000000000), (232934065403 / 100000000000000000000000000000000)⟩ +lemma CA1_7_8I2R6MassTermLog_sound : CA1_7_8I2R6MassTermLog.Encloses (Real.log ((∑ a, CA1_7_8I2R6Value a))) := by + exact checkLog_sound logTwoBall_sound (CA1_7_8I2R6Mass_sound) (w := CA1_7_8I2R6MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA1_7_8I2R6MassTerm : Ball := ⟨(234363815059324078428978966481 / 25000000000000000000000000000000), (166714451 / 50000000000000000000000000000000)⟩ +lemma CA1_7_8I2R6MassTerm_sound : CA1_7_8I2R6MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_7_8I2R6Value a))) := by + exact contains_sound (entropyTerm_ball (CA1_7_8I2R6Mass_sound) CA1_7_8I2R6MassTermLog_sound) (by decide +kernel) +def CA1_7_8I2R6H : Ball := ⟨(7585984564291558347827300001 / 50000000000000000000000000000000), (670829869 / 100000000000000000000000000000000)⟩ +lemma CA1_7_8I2R6H_sound : CA1_7_8I2R6H.Encloses (homogeneousEntropy CA1_7_8I2R6Value) := by + exact contains_sound (homogeneous_enclosed CA1_7_8I2R6Value CA1_7_8I2R6MassTerm_sound CA1_7_8I2R6Entropy_sound) (by decide +kernel) +def CA1_7_8I2R7Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 7 8)) (fun u => (stageALaw (shape 1 7 8) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 7 a +def CA1_7_8I2R7Raw (a : PairSlot) : Ball := residualBall (below (shape 1 7 8)) A1_7_8Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 7 a +lemma CA1_7_8I2R7Raw_sound (a : PairSlot) : + (CA1_7_8I2R7Raw a).Encloses (CA1_7_8I2R7Value a) := by + exact residualBall_sound_on (below (shape 1 7 8)) A1_7_8Law (fun u => (stageALaw (shape 1 7 8) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A1_7_8Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 7 8) (show (shape 1 7 8) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 7 a +def CA1_7_8I2R7Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA1_7_8I2R7Certificates_valid : + CA1_7_8I2R7Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_7_8I2R7CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA1_7_8I2R7P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_7_8I2R7Certificates (CA1_7_8I2R7CertificateIndex a)).input +lemma CA1_7_8I2R7P_check : ∀ a : PairSlot, contains (CA1_7_8I2R7Raw a) (CA1_7_8I2R7P a) = true := by + decide +kernel +lemma CA1_7_8I2R7P_sound (a : PairSlot) : + (CA1_7_8I2R7P a).Encloses (CA1_7_8I2R7Value a) := + contains_sound (CA1_7_8I2R7Raw_sound a) (CA1_7_8I2R7P_check a) +def CA1_7_8I2R7Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_7_8I2R7Certificates (CA1_7_8I2R7CertificateIndex a)).output +lemma CA1_7_8I2R7Terms_sound (a : PairSlot) : + (CA1_7_8I2R7Terms a).Encloses (Foundation.entropyTerm (CA1_7_8I2R7Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_7_8I2R7Certificates_valid + (CA1_7_8I2R7CertificateIndex a) (CA1_7_8I2R7P_sound a) +def CA1_7_8I2R7Entropy : Ball := ⟨0, 0⟩ +lemma CA1_7_8I2R7Entropy_sound : CA1_7_8I2R7Entropy.Encloses (Foundation.finiteEntropy CA1_7_8I2R7Value) := by + exact contains_sound (entropyPair_enclosed CA1_7_8I2R7Value CA1_7_8I2R7Terms CA1_7_8I2R7Terms_sound) (by decide +kernel) +def CA1_7_8I2R7Mass : Ball := ⟨0, 0⟩ +lemma CA1_7_8I2R7Mass_sound : CA1_7_8I2R7Mass.Encloses (∑ a, CA1_7_8I2R7Value a) := by + exact contains_sound (pairSumBall_sound CA1_7_8I2R7P CA1_7_8I2R7Value CA1_7_8I2R7P_sound) (by decide +kernel) +def CA1_7_8I2R7MassTerm : Ball := .exact 0 +lemma CA1_7_8I2R7MassTerm_sound : CA1_7_8I2R7MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_7_8I2R7Value a))) := + entropyTerm_zero_ball (CA1_7_8I2R7Mass_sound) +def CA1_7_8I2R7H : Ball := ⟨0, 0⟩ +lemma CA1_7_8I2R7H_sound : CA1_7_8I2R7H.Encloses (homogeneousEntropy CA1_7_8I2R7Value) := by + exact contains_sound (homogeneous_enclosed CA1_7_8I2R7Value CA1_7_8I2R7MassTerm_sound CA1_7_8I2R7Entropy_sound) (by decide +kernel) +def CA1_7_8I2R8Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 7 8)) (fun u => (stageALaw (shape 1 7 8) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 8 a +def CA1_7_8I2R8Raw (a : PairSlot) : Ball := residualBall (below (shape 1 7 8)) A1_7_8Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 8 a +lemma CA1_7_8I2R8Raw_sound (a : PairSlot) : + (CA1_7_8I2R8Raw a).Encloses (CA1_7_8I2R8Value a) := by + exact residualBall_sound_on (below (shape 1 7 8)) A1_7_8Law (fun u => (stageALaw (shape 1 7 8) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A1_7_8Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 7 8) (show (shape 1 7 8) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 8 a +def CA1_7_8I2R8Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA1_7_8I2R8Certificates_valid : + CA1_7_8I2R8Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_7_8I2R8CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA1_7_8I2R8P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_7_8I2R8Certificates (CA1_7_8I2R8CertificateIndex a)).input +lemma CA1_7_8I2R8P_check : ∀ a : PairSlot, contains (CA1_7_8I2R8Raw a) (CA1_7_8I2R8P a) = true := by + decide +kernel +lemma CA1_7_8I2R8P_sound (a : PairSlot) : + (CA1_7_8I2R8P a).Encloses (CA1_7_8I2R8Value a) := + contains_sound (CA1_7_8I2R8Raw_sound a) (CA1_7_8I2R8P_check a) +def CA1_7_8I2R8Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_7_8I2R8Certificates (CA1_7_8I2R8CertificateIndex a)).output +lemma CA1_7_8I2R8Terms_sound (a : PairSlot) : + (CA1_7_8I2R8Terms a).Encloses (Foundation.entropyTerm (CA1_7_8I2R8Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_7_8I2R8Certificates_valid + (CA1_7_8I2R8CertificateIndex a) (CA1_7_8I2R8P_sound a) +def CA1_7_8I2R8Entropy : Ball := ⟨0, 0⟩ +lemma CA1_7_8I2R8Entropy_sound : CA1_7_8I2R8Entropy.Encloses (Foundation.finiteEntropy CA1_7_8I2R8Value) := by + exact contains_sound (entropyPair_enclosed CA1_7_8I2R8Value CA1_7_8I2R8Terms CA1_7_8I2R8Terms_sound) (by decide +kernel) +def CA1_7_8I2R8Mass : Ball := ⟨0, 0⟩ +lemma CA1_7_8I2R8Mass_sound : CA1_7_8I2R8Mass.Encloses (∑ a, CA1_7_8I2R8Value a) := by + exact contains_sound (pairSumBall_sound CA1_7_8I2R8P CA1_7_8I2R8Value CA1_7_8I2R8P_sound) (by decide +kernel) +def CA1_7_8I2R8MassTerm : Ball := .exact 0 +lemma CA1_7_8I2R8MassTerm_sound : CA1_7_8I2R8MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_7_8I2R8Value a))) := + entropyTerm_zero_ball (CA1_7_8I2R8Mass_sound) +def CA1_7_8I2R8H : Ball := ⟨0, 0⟩ +lemma CA1_7_8I2R8H_sound : CA1_7_8I2R8H.Encloses (homogeneousEntropy CA1_7_8I2R8Value) := by + exact contains_sound (homogeneous_enclosed CA1_7_8I2R8Value CA1_7_8I2R8MassTerm_sound CA1_7_8I2R8Entropy_sound) (by decide +kernel) +def CA1_7_8I2R9Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 7 8)) (fun u => (stageALaw (shape 1 7 8) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 9 a +def CA1_7_8I2R9Raw (a : PairSlot) : Ball := residualBall (below (shape 1 7 8)) A1_7_8Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 9 a +lemma CA1_7_8I2R9Raw_sound (a : PairSlot) : + (CA1_7_8I2R9Raw a).Encloses (CA1_7_8I2R9Value a) := by + exact residualBall_sound_on (below (shape 1 7 8)) A1_7_8Law (fun u => (stageALaw (shape 1 7 8) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A1_7_8Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 7 8) (show (shape 1 7 8) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 9 a +def CA1_7_8I2R9Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA1_7_8I2R9Certificates_valid : + CA1_7_8I2R9Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_7_8I2R9CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA1_7_8I2R9P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_7_8I2R9Certificates (CA1_7_8I2R9CertificateIndex a)).input +lemma CA1_7_8I2R9P_check : ∀ a : PairSlot, contains (CA1_7_8I2R9Raw a) (CA1_7_8I2R9P a) = true := by + decide +kernel +lemma CA1_7_8I2R9P_sound (a : PairSlot) : + (CA1_7_8I2R9P a).Encloses (CA1_7_8I2R9Value a) := + contains_sound (CA1_7_8I2R9Raw_sound a) (CA1_7_8I2R9P_check a) +def CA1_7_8I2R9Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_7_8I2R9Certificates (CA1_7_8I2R9CertificateIndex a)).output +lemma CA1_7_8I2R9Terms_sound (a : PairSlot) : + (CA1_7_8I2R9Terms a).Encloses (Foundation.entropyTerm (CA1_7_8I2R9Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_7_8I2R9Certificates_valid + (CA1_7_8I2R9CertificateIndex a) (CA1_7_8I2R9P_sound a) +def CA1_7_8I2R9Entropy : Ball := ⟨0, 0⟩ +lemma CA1_7_8I2R9Entropy_sound : CA1_7_8I2R9Entropy.Encloses (Foundation.finiteEntropy CA1_7_8I2R9Value) := by + exact contains_sound (entropyPair_enclosed CA1_7_8I2R9Value CA1_7_8I2R9Terms CA1_7_8I2R9Terms_sound) (by decide +kernel) +def CA1_7_8I2R9Mass : Ball := ⟨0, 0⟩ +lemma CA1_7_8I2R9Mass_sound : CA1_7_8I2R9Mass.Encloses (∑ a, CA1_7_8I2R9Value a) := by + exact contains_sound (pairSumBall_sound CA1_7_8I2R9P CA1_7_8I2R9Value CA1_7_8I2R9P_sound) (by decide +kernel) +def CA1_7_8I2R9MassTerm : Ball := .exact 0 +lemma CA1_7_8I2R9MassTerm_sound : CA1_7_8I2R9MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_7_8I2R9Value a))) := + entropyTerm_zero_ball (CA1_7_8I2R9Mass_sound) +def CA1_7_8I2R9H : Ball := ⟨0, 0⟩ +lemma CA1_7_8I2R9H_sound : CA1_7_8I2R9H.Encloses (homogeneousEntropy CA1_7_8I2R9Value) := by + exact contains_sound (homogeneous_enclosed CA1_7_8I2R9Value CA1_7_8I2R9MassTerm_sound CA1_7_8I2R9Entropy_sound) (by decide +kernel) +def CA1_7_8I2R10Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 7 8)) (fun u => (stageALaw (shape 1 7 8) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 10 a +def CA1_7_8I2R10Raw (a : PairSlot) : Ball := residualBall (below (shape 1 7 8)) A1_7_8Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 10 a +lemma CA1_7_8I2R10Raw_sound (a : PairSlot) : + (CA1_7_8I2R10Raw a).Encloses (CA1_7_8I2R10Value a) := by + exact residualBall_sound_on (below (shape 1 7 8)) A1_7_8Law (fun u => (stageALaw (shape 1 7 8) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A1_7_8Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 7 8) (show (shape 1 7 8) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 10 a +def CA1_7_8I2R10Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA1_7_8I2R10Certificates_valid : + CA1_7_8I2R10Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_7_8I2R10CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA1_7_8I2R10P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_7_8I2R10Certificates (CA1_7_8I2R10CertificateIndex a)).input +lemma CA1_7_8I2R10P_check : ∀ a : PairSlot, contains (CA1_7_8I2R10Raw a) (CA1_7_8I2R10P a) = true := by + decide +kernel +lemma CA1_7_8I2R10P_sound (a : PairSlot) : + (CA1_7_8I2R10P a).Encloses (CA1_7_8I2R10Value a) := + contains_sound (CA1_7_8I2R10Raw_sound a) (CA1_7_8I2R10P_check a) +def CA1_7_8I2R10Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_7_8I2R10Certificates (CA1_7_8I2R10CertificateIndex a)).output +lemma CA1_7_8I2R10Terms_sound (a : PairSlot) : + (CA1_7_8I2R10Terms a).Encloses (Foundation.entropyTerm (CA1_7_8I2R10Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_7_8I2R10Certificates_valid + (CA1_7_8I2R10CertificateIndex a) (CA1_7_8I2R10P_sound a) +def CA1_7_8I2R10Entropy : Ball := ⟨0, 0⟩ +lemma CA1_7_8I2R10Entropy_sound : CA1_7_8I2R10Entropy.Encloses (Foundation.finiteEntropy CA1_7_8I2R10Value) := by + exact contains_sound (entropyPair_enclosed CA1_7_8I2R10Value CA1_7_8I2R10Terms CA1_7_8I2R10Terms_sound) (by decide +kernel) +def CA1_7_8I2R10Mass : Ball := ⟨0, 0⟩ +lemma CA1_7_8I2R10Mass_sound : CA1_7_8I2R10Mass.Encloses (∑ a, CA1_7_8I2R10Value a) := by + exact contains_sound (pairSumBall_sound CA1_7_8I2R10P CA1_7_8I2R10Value CA1_7_8I2R10P_sound) (by decide +kernel) +def CA1_7_8I2R10MassTerm : Ball := .exact 0 +lemma CA1_7_8I2R10MassTerm_sound : CA1_7_8I2R10MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_7_8I2R10Value a))) := + entropyTerm_zero_ball (CA1_7_8I2R10Mass_sound) +def CA1_7_8I2R10H : Ball := ⟨0, 0⟩ +lemma CA1_7_8I2R10H_sound : CA1_7_8I2R10H.Encloses (homogeneousEntropy CA1_7_8I2R10Value) := by + exact contains_sound (homogeneous_enclosed CA1_7_8I2R10Value CA1_7_8I2R10MassTerm_sound CA1_7_8I2R10Entropy_sound) (by decide +kernel) +def CA1_7_8I2R11Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 7 8)) (fun u => (stageALaw (shape 1 7 8) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 11 a +def CA1_7_8I2R11Raw (a : PairSlot) : Ball := residualBall (below (shape 1 7 8)) A1_7_8Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 11 a +lemma CA1_7_8I2R11Raw_sound (a : PairSlot) : + (CA1_7_8I2R11Raw a).Encloses (CA1_7_8I2R11Value a) := by + exact residualBall_sound_on (below (shape 1 7 8)) A1_7_8Law (fun u => (stageALaw (shape 1 7 8) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A1_7_8Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 7 8) (show (shape 1 7 8) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 11 a +def CA1_7_8I2R11Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA1_7_8I2R11Certificates_valid : + CA1_7_8I2R11Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_7_8I2R11CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA1_7_8I2R11P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_7_8I2R11Certificates (CA1_7_8I2R11CertificateIndex a)).input +lemma CA1_7_8I2R11P_check : ∀ a : PairSlot, contains (CA1_7_8I2R11Raw a) (CA1_7_8I2R11P a) = true := by + decide +kernel +lemma CA1_7_8I2R11P_sound (a : PairSlot) : + (CA1_7_8I2R11P a).Encloses (CA1_7_8I2R11Value a) := + contains_sound (CA1_7_8I2R11Raw_sound a) (CA1_7_8I2R11P_check a) +def CA1_7_8I2R11Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_7_8I2R11Certificates (CA1_7_8I2R11CertificateIndex a)).output +lemma CA1_7_8I2R11Terms_sound (a : PairSlot) : + (CA1_7_8I2R11Terms a).Encloses (Foundation.entropyTerm (CA1_7_8I2R11Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_7_8I2R11Certificates_valid + (CA1_7_8I2R11CertificateIndex a) (CA1_7_8I2R11P_sound a) +def CA1_7_8I2R11Entropy : Ball := ⟨0, 0⟩ +lemma CA1_7_8I2R11Entropy_sound : CA1_7_8I2R11Entropy.Encloses (Foundation.finiteEntropy CA1_7_8I2R11Value) := by + exact contains_sound (entropyPair_enclosed CA1_7_8I2R11Value CA1_7_8I2R11Terms CA1_7_8I2R11Terms_sound) (by decide +kernel) +def CA1_7_8I2R11Mass : Ball := ⟨0, 0⟩ +lemma CA1_7_8I2R11Mass_sound : CA1_7_8I2R11Mass.Encloses (∑ a, CA1_7_8I2R11Value a) := by + exact contains_sound (pairSumBall_sound CA1_7_8I2R11P CA1_7_8I2R11Value CA1_7_8I2R11P_sound) (by decide +kernel) +def CA1_7_8I2R11MassTerm : Ball := .exact 0 +lemma CA1_7_8I2R11MassTerm_sound : CA1_7_8I2R11MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_7_8I2R11Value a))) := + entropyTerm_zero_ball (CA1_7_8I2R11Mass_sound) +def CA1_7_8I2R11H : Ball := ⟨0, 0⟩ +lemma CA1_7_8I2R11H_sound : CA1_7_8I2R11H.Encloses (homogeneousEntropy CA1_7_8I2R11Value) := by + exact contains_sound (homogeneous_enclosed CA1_7_8I2R11Value CA1_7_8I2R11MassTerm_sound CA1_7_8I2R11Entropy_sound) (by decide +kernel) +def CA1_7_8I2R12Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 7 8)) (fun u => (stageALaw (shape 1 7 8) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 12 a +def CA1_7_8I2R12Raw (a : PairSlot) : Ball := residualBall (below (shape 1 7 8)) A1_7_8Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 12 a +lemma CA1_7_8I2R12Raw_sound (a : PairSlot) : + (CA1_7_8I2R12Raw a).Encloses (CA1_7_8I2R12Value a) := by + exact residualBall_sound_on (below (shape 1 7 8)) A1_7_8Law (fun u => (stageALaw (shape 1 7 8) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A1_7_8Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 7 8) (show (shape 1 7 8) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 12 a +def CA1_7_8I2R12Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA1_7_8I2R12Certificates_valid : + CA1_7_8I2R12Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_7_8I2R12CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA1_7_8I2R12P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_7_8I2R12Certificates (CA1_7_8I2R12CertificateIndex a)).input +lemma CA1_7_8I2R12P_check : ∀ a : PairSlot, contains (CA1_7_8I2R12Raw a) (CA1_7_8I2R12P a) = true := by + decide +kernel +lemma CA1_7_8I2R12P_sound (a : PairSlot) : + (CA1_7_8I2R12P a).Encloses (CA1_7_8I2R12Value a) := + contains_sound (CA1_7_8I2R12Raw_sound a) (CA1_7_8I2R12P_check a) +def CA1_7_8I2R12Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_7_8I2R12Certificates (CA1_7_8I2R12CertificateIndex a)).output +lemma CA1_7_8I2R12Terms_sound (a : PairSlot) : + (CA1_7_8I2R12Terms a).Encloses (Foundation.entropyTerm (CA1_7_8I2R12Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_7_8I2R12Certificates_valid + (CA1_7_8I2R12CertificateIndex a) (CA1_7_8I2R12P_sound a) +def CA1_7_8I2R12Entropy : Ball := ⟨0, 0⟩ +lemma CA1_7_8I2R12Entropy_sound : CA1_7_8I2R12Entropy.Encloses (Foundation.finiteEntropy CA1_7_8I2R12Value) := by + exact contains_sound (entropyPair_enclosed CA1_7_8I2R12Value CA1_7_8I2R12Terms CA1_7_8I2R12Terms_sound) (by decide +kernel) +def CA1_7_8I2R12Mass : Ball := ⟨0, 0⟩ +lemma CA1_7_8I2R12Mass_sound : CA1_7_8I2R12Mass.Encloses (∑ a, CA1_7_8I2R12Value a) := by + exact contains_sound (pairSumBall_sound CA1_7_8I2R12P CA1_7_8I2R12Value CA1_7_8I2R12P_sound) (by decide +kernel) +def CA1_7_8I2R12MassTerm : Ball := .exact 0 +lemma CA1_7_8I2R12MassTerm_sound : CA1_7_8I2R12MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_7_8I2R12Value a))) := + entropyTerm_zero_ball (CA1_7_8I2R12Mass_sound) +def CA1_7_8I2R12H : Ball := ⟨0, 0⟩ +lemma CA1_7_8I2R12H_sound : CA1_7_8I2R12H.Encloses (homogeneousEntropy CA1_7_8I2R12Value) := by + exact contains_sound (homogeneous_enclosed CA1_7_8I2R12Value CA1_7_8I2R12MassTerm_sound CA1_7_8I2R12Entropy_sound) (by decide +kernel) +def CA1_7_8I2R13Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 7 8)) (fun u => (stageALaw (shape 1 7 8) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 13 a +def CA1_7_8I2R13Raw (a : PairSlot) : Ball := residualBall (below (shape 1 7 8)) A1_7_8Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 13 a +lemma CA1_7_8I2R13Raw_sound (a : PairSlot) : + (CA1_7_8I2R13Raw a).Encloses (CA1_7_8I2R13Value a) := by + exact residualBall_sound_on (below (shape 1 7 8)) A1_7_8Law (fun u => (stageALaw (shape 1 7 8) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A1_7_8Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 7 8) (show (shape 1 7 8) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 13 a +def CA1_7_8I2R13Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA1_7_8I2R13Certificates_valid : + CA1_7_8I2R13Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_7_8I2R13CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA1_7_8I2R13P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_7_8I2R13Certificates (CA1_7_8I2R13CertificateIndex a)).input +lemma CA1_7_8I2R13P_check : ∀ a : PairSlot, contains (CA1_7_8I2R13Raw a) (CA1_7_8I2R13P a) = true := by + decide +kernel +lemma CA1_7_8I2R13P_sound (a : PairSlot) : + (CA1_7_8I2R13P a).Encloses (CA1_7_8I2R13Value a) := + contains_sound (CA1_7_8I2R13Raw_sound a) (CA1_7_8I2R13P_check a) +def CA1_7_8I2R13Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_7_8I2R13Certificates (CA1_7_8I2R13CertificateIndex a)).output +lemma CA1_7_8I2R13Terms_sound (a : PairSlot) : + (CA1_7_8I2R13Terms a).Encloses (Foundation.entropyTerm (CA1_7_8I2R13Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_7_8I2R13Certificates_valid + (CA1_7_8I2R13CertificateIndex a) (CA1_7_8I2R13P_sound a) +def CA1_7_8I2R13Entropy : Ball := ⟨0, 0⟩ +lemma CA1_7_8I2R13Entropy_sound : CA1_7_8I2R13Entropy.Encloses (Foundation.finiteEntropy CA1_7_8I2R13Value) := by + exact contains_sound (entropyPair_enclosed CA1_7_8I2R13Value CA1_7_8I2R13Terms CA1_7_8I2R13Terms_sound) (by decide +kernel) +def CA1_7_8I2R13Mass : Ball := ⟨0, 0⟩ +lemma CA1_7_8I2R13Mass_sound : CA1_7_8I2R13Mass.Encloses (∑ a, CA1_7_8I2R13Value a) := by + exact contains_sound (pairSumBall_sound CA1_7_8I2R13P CA1_7_8I2R13Value CA1_7_8I2R13P_sound) (by decide +kernel) +def CA1_7_8I2R13MassTerm : Ball := .exact 0 +lemma CA1_7_8I2R13MassTerm_sound : CA1_7_8I2R13MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_7_8I2R13Value a))) := + entropyTerm_zero_ball (CA1_7_8I2R13Mass_sound) +def CA1_7_8I2R13H : Ball := ⟨0, 0⟩ +lemma CA1_7_8I2R13H_sound : CA1_7_8I2R13H.Encloses (homogeneousEntropy CA1_7_8I2R13Value) := by + exact contains_sound (homogeneous_enclosed CA1_7_8I2R13Value CA1_7_8I2R13MassTerm_sound CA1_7_8I2R13Entropy_sound) (by decide +kernel) +def CA1_7_8I2R14Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 7 8)) (fun u => (stageALaw (shape 1 7 8) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 14 a +def CA1_7_8I2R14Raw (a : PairSlot) : Ball := residualBall (below (shape 1 7 8)) A1_7_8Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 14 a +lemma CA1_7_8I2R14Raw_sound (a : PairSlot) : + (CA1_7_8I2R14Raw a).Encloses (CA1_7_8I2R14Value a) := by + exact residualBall_sound_on (below (shape 1 7 8)) A1_7_8Law (fun u => (stageALaw (shape 1 7 8) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A1_7_8Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 7 8) (show (shape 1 7 8) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 14 a +def CA1_7_8I2R14Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA1_7_8I2R14Certificates_valid : + CA1_7_8I2R14Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_7_8I2R14CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA1_7_8I2R14P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_7_8I2R14Certificates (CA1_7_8I2R14CertificateIndex a)).input +lemma CA1_7_8I2R14P_check : ∀ a : PairSlot, contains (CA1_7_8I2R14Raw a) (CA1_7_8I2R14P a) = true := by + decide +kernel +lemma CA1_7_8I2R14P_sound (a : PairSlot) : + (CA1_7_8I2R14P a).Encloses (CA1_7_8I2R14Value a) := + contains_sound (CA1_7_8I2R14Raw_sound a) (CA1_7_8I2R14P_check a) +def CA1_7_8I2R14Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_7_8I2R14Certificates (CA1_7_8I2R14CertificateIndex a)).output +lemma CA1_7_8I2R14Terms_sound (a : PairSlot) : + (CA1_7_8I2R14Terms a).Encloses (Foundation.entropyTerm (CA1_7_8I2R14Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_7_8I2R14Certificates_valid + (CA1_7_8I2R14CertificateIndex a) (CA1_7_8I2R14P_sound a) +def CA1_7_8I2R14Entropy : Ball := ⟨0, 0⟩ +lemma CA1_7_8I2R14Entropy_sound : CA1_7_8I2R14Entropy.Encloses (Foundation.finiteEntropy CA1_7_8I2R14Value) := by + exact contains_sound (entropyPair_enclosed CA1_7_8I2R14Value CA1_7_8I2R14Terms CA1_7_8I2R14Terms_sound) (by decide +kernel) +def CA1_7_8I2R14Mass : Ball := ⟨0, 0⟩ +lemma CA1_7_8I2R14Mass_sound : CA1_7_8I2R14Mass.Encloses (∑ a, CA1_7_8I2R14Value a) := by + exact contains_sound (pairSumBall_sound CA1_7_8I2R14P CA1_7_8I2R14Value CA1_7_8I2R14P_sound) (by decide +kernel) +def CA1_7_8I2R14MassTerm : Ball := .exact 0 +lemma CA1_7_8I2R14MassTerm_sound : CA1_7_8I2R14MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_7_8I2R14Value a))) := + entropyTerm_zero_ball (CA1_7_8I2R14Mass_sound) +def CA1_7_8I2R14H : Ball := ⟨0, 0⟩ +lemma CA1_7_8I2R14H_sound : CA1_7_8I2R14H.Encloses (homogeneousEntropy CA1_7_8I2R14Value) := by + exact contains_sound (homogeneous_enclosed CA1_7_8I2R14Value CA1_7_8I2R14MassTerm_sound CA1_7_8I2R14Entropy_sound) (by decide +kernel) +def CA1_7_8I2R15Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 7 8)) (fun u => (stageALaw (shape 1 7 8) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 15 a +def CA1_7_8I2R15Raw (a : PairSlot) : Ball := residualBall (below (shape 1 7 8)) A1_7_8Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 15 a +lemma CA1_7_8I2R15Raw_sound (a : PairSlot) : + (CA1_7_8I2R15Raw a).Encloses (CA1_7_8I2R15Value a) := by + exact residualBall_sound_on (below (shape 1 7 8)) A1_7_8Law (fun u => (stageALaw (shape 1 7 8) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A1_7_8Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 7 8) (show (shape 1 7 8) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 15 a +def CA1_7_8I2R15Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA1_7_8I2R15Certificates_valid : + CA1_7_8I2R15Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_7_8I2R15CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA1_7_8I2R15P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_7_8I2R15Certificates (CA1_7_8I2R15CertificateIndex a)).input +lemma CA1_7_8I2R15P_check : ∀ a : PairSlot, contains (CA1_7_8I2R15Raw a) (CA1_7_8I2R15P a) = true := by + decide +kernel +lemma CA1_7_8I2R15P_sound (a : PairSlot) : + (CA1_7_8I2R15P a).Encloses (CA1_7_8I2R15Value a) := + contains_sound (CA1_7_8I2R15Raw_sound a) (CA1_7_8I2R15P_check a) +def CA1_7_8I2R15Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_7_8I2R15Certificates (CA1_7_8I2R15CertificateIndex a)).output +lemma CA1_7_8I2R15Terms_sound (a : PairSlot) : + (CA1_7_8I2R15Terms a).Encloses (Foundation.entropyTerm (CA1_7_8I2R15Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_7_8I2R15Certificates_valid + (CA1_7_8I2R15CertificateIndex a) (CA1_7_8I2R15P_sound a) +def CA1_7_8I2R15Entropy : Ball := ⟨0, 0⟩ +lemma CA1_7_8I2R15Entropy_sound : CA1_7_8I2R15Entropy.Encloses (Foundation.finiteEntropy CA1_7_8I2R15Value) := by + exact contains_sound (entropyPair_enclosed CA1_7_8I2R15Value CA1_7_8I2R15Terms CA1_7_8I2R15Terms_sound) (by decide +kernel) +def CA1_7_8I2R15Mass : Ball := ⟨0, 0⟩ +lemma CA1_7_8I2R15Mass_sound : CA1_7_8I2R15Mass.Encloses (∑ a, CA1_7_8I2R15Value a) := by + exact contains_sound (pairSumBall_sound CA1_7_8I2R15P CA1_7_8I2R15Value CA1_7_8I2R15P_sound) (by decide +kernel) +def CA1_7_8I2R15MassTerm : Ball := .exact 0 +lemma CA1_7_8I2R15MassTerm_sound : CA1_7_8I2R15MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_7_8I2R15Value a))) := + entropyTerm_zero_ball (CA1_7_8I2R15Mass_sound) +def CA1_7_8I2R15H : Ball := ⟨0, 0⟩ +lemma CA1_7_8I2R15H_sound : CA1_7_8I2R15H.Encloses (homogeneousEntropy CA1_7_8I2R15Value) := by + exact contains_sound (homogeneous_enclosed CA1_7_8I2R15Value CA1_7_8I2R15MassTerm_sound CA1_7_8I2R15Entropy_sound) (by decide +kernel) +def CA1_7_8I2R16Value (a : PairSlot) : ℝ := residualLaw (below (shape 1 7 8)) (fun u => (stageALaw (shape 1 7 8) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 16 a +def CA1_7_8I2R16Raw (a : PairSlot) : Ball := residualBall (below (shape 1 7 8)) A1_7_8Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 16 a +lemma CA1_7_8I2R16Raw_sound (a : PairSlot) : + (CA1_7_8I2R16Raw a).Encloses (CA1_7_8I2R16Value a) := by + exact residualBall_sound_on (below (shape 1 7 8)) A1_7_8Law (fun u => (stageALaw (shape 1 7 8) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A1_7_8Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 1 7 8) (show (shape 1 7 8) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 16 a +def CA1_7_8I2R16Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA1_7_8I2R16Certificates_valid : + CA1_7_8I2R16Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_7_8I2R16CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA1_7_8I2R16P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_7_8I2R16Certificates (CA1_7_8I2R16CertificateIndex a)).input +lemma CA1_7_8I2R16P_check : ∀ a : PairSlot, contains (CA1_7_8I2R16Raw a) (CA1_7_8I2R16P a) = true := by + decide +kernel +lemma CA1_7_8I2R16P_sound (a : PairSlot) : + (CA1_7_8I2R16P a).Encloses (CA1_7_8I2R16Value a) := + contains_sound (CA1_7_8I2R16Raw_sound a) (CA1_7_8I2R16P_check a) +def CA1_7_8I2R16Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_7_8I2R16Certificates (CA1_7_8I2R16CertificateIndex a)).output +lemma CA1_7_8I2R16Terms_sound (a : PairSlot) : + (CA1_7_8I2R16Terms a).Encloses (Foundation.entropyTerm (CA1_7_8I2R16Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_7_8I2R16Certificates_valid + (CA1_7_8I2R16CertificateIndex a) (CA1_7_8I2R16P_sound a) +def CA1_7_8I2R16Entropy : Ball := ⟨0, 0⟩ +lemma CA1_7_8I2R16Entropy_sound : CA1_7_8I2R16Entropy.Encloses (Foundation.finiteEntropy CA1_7_8I2R16Value) := by + exact contains_sound (entropyPair_enclosed CA1_7_8I2R16Value CA1_7_8I2R16Terms CA1_7_8I2R16Terms_sound) (by decide +kernel) +def CA1_7_8I2R16Mass : Ball := ⟨0, 0⟩ +lemma CA1_7_8I2R16Mass_sound : CA1_7_8I2R16Mass.Encloses (∑ a, CA1_7_8I2R16Value a) := by + exact contains_sound (pairSumBall_sound CA1_7_8I2R16P CA1_7_8I2R16Value CA1_7_8I2R16P_sound) (by decide +kernel) +def CA1_7_8I2R16MassTerm : Ball := .exact 0 +lemma CA1_7_8I2R16MassTerm_sound : CA1_7_8I2R16MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_7_8I2R16Value a))) := + entropyTerm_zero_ball (CA1_7_8I2R16Mass_sound) +def CA1_7_8I2R16H : Ball := ⟨0, 0⟩ +lemma CA1_7_8I2R16H_sound : CA1_7_8I2R16H.Encloses (homogeneousEntropy CA1_7_8I2R16Value) := by + exact contains_sound (homogeneous_enclosed CA1_7_8I2R16Value CA1_7_8I2R16MassTerm_sound CA1_7_8I2R16Entropy_sound) (by decide +kernel) +def CA1_7_8I2ResidualEntropies (a : Fin 17) : Ball := + match a.val with + | 0 => CA1_7_8I2R0H + | 1 => CA1_7_8I2R1H + | 2 => CA1_7_8I2R2H + | 3 => CA1_7_8I2R3H + | 4 => CA1_7_8I2R4H + | 5 => CA1_7_8I2R5H + | 6 => CA1_7_8I2R6H + | 7 => CA1_7_8I2R7H + | 8 => CA1_7_8I2R8H + | 9 => CA1_7_8I2R9H + | 10 => CA1_7_8I2R10H + | 11 => CA1_7_8I2R11H + | 12 => CA1_7_8I2R12H + | 13 => CA1_7_8I2R13H + | 14 => CA1_7_8I2R14H + | 15 => CA1_7_8I2R15H + | 16 => CA1_7_8I2R16H + | _ => (.exact 0) +lemma CA1_7_8I2ResidualEntropies_sound (k : Fin 17) : + (CA1_7_8I2ResidualEntropies k).Encloses (homogeneousEntropy + (residualLaw (below (shape 1 7 8)) (fun u => (stageALaw (shape 1 7 8) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) k)) := by + fin_cases k + · exact CA1_7_8I2R0H_sound + · exact CA1_7_8I2R1H_sound + · exact CA1_7_8I2R2H_sound + · exact CA1_7_8I2R3H_sound + · exact CA1_7_8I2R4H_sound + · exact CA1_7_8I2R5H_sound + · exact CA1_7_8I2R6H_sound + · exact CA1_7_8I2R7H_sound + · exact CA1_7_8I2R8H_sound + · exact CA1_7_8I2R9H_sound + · exact CA1_7_8I2R10H_sound + · exact CA1_7_8I2R11H_sound + · exact CA1_7_8I2R12H_sound + · exact CA1_7_8I2R13H_sound + · exact CA1_7_8I2R14H_sound + · exact CA1_7_8I2R15H_sound + · exact CA1_7_8I2R16H_sound +def CA1_7_8I2Singles (s : Shape) : Ball := + match s 0, s 1, s 2 with + | 0, 0, 8 => Z0_0_8H2H + | 0, 1, 7 => Z0_1_7H2H + | 0, 2, 6 => Z0_2_6H2H + | 0, 3, 5 => Z0_3_5H2H + | 0, 4, 4 => Z0_4_4H2H + | 0, 5, 3 => Z0_5_3H2H + | 0, 6, 2 => Z0_6_2H2H + | 0, 7, 1 => Z0_7_1H2H + | 1, 0, 7 => Z1_0_7H2H + | _, _, _ => (.exact 0) +lemma CA1_7_8I2Singles_sound (u : Shape) (hu : u ∈ below (shape 1 7 8)) + (hd : designated (Equiv.refl (Fin 3)) 2 u) : + (CA1_7_8I2Singles u).Encloses (homogeneousEntropy ((fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) u)) := by + rw [A1_7_8_below] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl + · exact Z0_0_8H2H_sound + · exact Z0_1_7H2H_sound + · exact Z0_2_6H2H_sound + · exact Z0_3_5H2H_sound + · exact Z0_4_4H2H_sound + · exact Z0_5_3H2H_sound + · exact Z0_6_2H2H_sound + · exact Z0_7_1H2H_sound + · exact Z1_0_7H2H_sound + · exact (show ¬ designated (Equiv.refl (Fin 3)) 2 (shape 1 1 6) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 2 (shape 1 2 5) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 2 (shape 1 3 4) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 2 (shape 1 4 3) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 2 (shape 1 5 2) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 2 (shape 1 6 1) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 2 (shape 1 7 0) by decide +kernel) hd |>.elim +def CA1_7_8I2Singleton : Ball := ⟨(30157846868231622175255511891177 / 50000000000000000000000000000000), (50537614749 / 100000000000000000000000000000000)⟩ +lemma CA1_7_8I2Singleton_sound : CA1_7_8I2Singleton.Encloses + (singletonEntropy (below (shape 1 7 8)) (fun u => (stageALaw (shape 1 7 8) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ))) := by + exact contains_sound (singletonBall_sound (below (shape 1 7 8)) A1_7_8Law (fun u => (stageALaw (shape 1 7 8) u : ℝ)) (Equiv.refl (Fin 3)) 2 + CA1_7_8I2Singles (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A1_7_8Law_sound u) CA1_7_8I2Singles_sound) (by decide +kernel) +def CA1_7_8I2Group : Ball := ⟨(105981454927787813602149374910997 / 100000000000000000000000000000000), (36961336739 / 25000000000000000000000000000000)⟩ +lemma CA1_7_8I2Group_sound : CA1_7_8I2Group.Encloses + (groupedEntropy (below (shape 1 7 8)) (fun u => (stageALaw (shape 1 7 8) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ))) := by + exact contains_sound (Ball.add_sound CA1_7_8I2Singleton_sound + (finSumBall_sound 17 CA1_7_8I2ResidualEntropies _ CA1_7_8I2ResidualEntropies_sound)) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CA1_7_8I2H : Ball := ⟨(102374380155238156114601489213779 / 100000000000000000000000000000000), (88327499021 / 20000000000000000000000000000000)⟩ +lemma CA1_7_8I2_sound : CA1_7_8I2H.Encloses (stageACapacity (shape 1 7 8) 2) := by + have hb := contains_sound (Ball.add_sound CA1_7_8I2PairH_sound + (Ball.neg_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) CA1_7_8I2Group_sound))) + (show contains (.add CA1_7_8I2PairH (.neg (.mul (.exact 2) CA1_7_8I2Group))) CA1_7_8I2H = true by decide +kernel) + simp only [stageACapacity, nativeCapacity, + show (2 : Fin 3) ≠ 0 by decide, ite_false] + change CA1_7_8I2H.Encloses (homogeneousEntropy CA1_7_8I2PairValue - _) + simpa only [sub_eq_add_neg] using hb + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA1_7_8I2Pair.lean b/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA1_7_8I2Pair.lean new file mode 100644 index 0000000000000000000000000000000000000000..b352b8e8b8df868bd32a182792fc0cb4b2e1352e --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA1_7_8I2Pair.lean @@ -0,0 +1,378 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Certificates.SupportedContraction + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CA1_7_8I2PairValue (a : PairSlot × PairSlot) : ℝ := pairLaw (below (shape 1 7 8)) (shape 1 7 8) (fun u => (stageALaw (shape 1 7 8) u : ℝ)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) a +def CA1_7_8I2PairRaw (a : PairSlot × PairSlot) : Ball := stageAPairBall (shape 1 7 8) A1_7_8Law 2 a +lemma CA1_7_8I2PairRaw_sound (a : PairSlot × PairSlot) : + (CA1_7_8I2PairRaw a).Encloses (CA1_7_8I2PairValue a) := by + exact stageAPairBall_sound (shape 1 7 8) (by decide +kernel) A1_7_8Law (fun u => (stageALaw (shape 1 7 8) u : ℝ)) (fun u _ => A1_7_8Law_sound u) 2 a +def CA1_7_8I2PairCertificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(20055422158842954722213457 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(154649177236918223514006467 / 50000000000000000000000000000000), (101943 / 100000000000000000000000000000000)⟩ ⟨(-1542218119489740070137408646605969 / 100000000000000000000000000000000), (254112377287 / 50000000000000000000000000000000)⟩ ⟨-23, 20055422158842954722213457, 11920928955078125000000000⟩, + .log ⟨(347781796104403272054626511 / 25000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ ⟨(1555671255058862173379436977 / 10000000000000000000000000000000), (331407 / 6250000000000000000000000000000)⟩ ⟨(-1118281112240743434857753688928043 / 100000000000000000000000000000000), (190582485031 / 50000000000000000000000000000000)⟩ ⟨-17, 347781796104403272054626511, 190734863281250000000000000⟩, + .log ⟨(2692490276953045753890013243 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(1818619381561111881844843109 / 1000000000000000000000000000000), (63857593 / 100000000000000000000000000000000)⟩ ⟨(-26384429388775019845895730857497 / 3125000000000000000000000000000), (74115384051 / 25000000000000000000000000000000)⟩ ⟨-13, 2692490276953045753890013243, 1525878906250000000000000000⟩, + .log ⟨(2579395700570794938087513521 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(425816730833332809278205047 / 1562500000000000000000000000000), (9285553 / 100000000000000000000000000000000)⟩ ⟨(-264134257951413192412067623475979 / 25000000000000000000000000000000), (17999452069 / 5000000000000000000000000000000)⟩ ⟨-16, 2579395700570794938087513521, 1525878906250000000000000000⟩, + .log ⟨(16452392396538046132357191701 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(584308085744761198038003273349 / 100000000000000000000000000000000), (41807157 / 20000000000000000000000000000000)⟩ ⟨(-710301665145930725406546179038933 / 100000000000000000000000000000000), (254109885411 / 100000000000000000000000000000000)⟩ ⟨-11, 16452392396538046132357191701, 9765625000000000000000000000⟩, + .log ⟨(863812373908676145448400811 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(9472720231880271869657406741 / 50000000000000000000000000000000), (777409 / 12500000000000000000000000000000)⟩ ⟨(-1096617797799889529286498499062691 / 100000000000000000000000000000000), (359989060493 / 100000000000000000000000000000000)⟩ ⟨-16, 863812373908676145448400811, 762939453125000000000000000⟩, + .log ⟨(103851895842883915105867329 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(543542867166577486535738501 / 20000000000000000000000000000000), (35187 / 4000000000000000000000000000000)⟩ ⟨(-1308456775764825492404145065831477 / 100000000000000000000000000000000), (211758477557 / 50000000000000000000000000000000)⟩ ⟨-19, 103851895842883915105867329, 95367431640625000000000000⟩, + .log ⟨(6591535674842896687080542791 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(63457630906847264919670492993 / 100000000000000000000000000000000), (20937191 / 100000000000000000000000000000000)⟩ ⟨(-962713911251943885871235612503701 / 100000000000000000000000000000000), (63527474083 / 20000000000000000000000000000000)⟩ ⟨-14, 6591535674842896687080542791, 6103515625000000000000000000⟩, + .log ⟨(17298175824470997481022517081 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(610010353758037312774592812061 / 100000000000000000000000000000000), (109890941 / 50000000000000000000000000000000)⟩ ⟨(-705288650026416628122234906949957 / 100000000000000000000000000000000), (31763735669 / 12500000000000000000000000000000)⟩ ⟨-11, 17298175824470997481022517081, 9765625000000000000000000000⟩, + .log ⟨(4661759538534368768329541353 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(43262924806190856998941070991 / 50000000000000000000000000000000), (29614991 / 100000000000000000000000000000000)⟩ ⟨(-928038532416291887332533209376031 / 100000000000000000000000000000000), (31763736597 / 10000000000000000000000000000000)⟩ ⟨-14, 4661759538534368768329541353, 3051757812500000000000000000⟩, + .log ⟨(10571702736553932370037819617 / 3125000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ ⟨(962280138736143696134939356159 / 50000000000000000000000000000000), (71636647 / 10000000000000000000000000000000)⟩ ⟨(-284450434190952713452460834725359 / 50000000000000000000000000000000), (52939559503 / 25000000000000000000000000000000)⟩ ⟨-9, 10571702736553932370037819617, 6103515625000000000000000000⟩, + .log ⟨(4628939016984281679375625699 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(9239915692677609639365247171 / 20000000000000000000000000000000), (15683467 / 100000000000000000000000000000000)⟩ ⟨(-499029888856547517924560482228831 / 50000000000000000000000000000000), (338813200531 / 100000000000000000000000000000000)⟩ ⟨-15, 4628939016984281679375625699, 3051757812500000000000000000⟩, + .log ⟨(6253136643879660450119683003 / 4000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ ⟨(505016324949861310369113625167 / 50000000000000000000000000000000), (364142143 / 100000000000000000000000000000000)⟩ ⟨(-646096643922409935787373985514127 / 100000000000000000000000000000000), (7279189431 / 3125000000000000000000000000000)⟩ ⟨-10, 6253136643879660450119683003, 3906250000000000000000000000⟩, + .log ⟨(15134408611233607866112052263 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(133121571004567297394739358393 / 100000000000000000000000000000000), (4486771 / 10000000000000000000000000000000)⟩ ⟨(-3435919764652140107363951401671 / 390625000000000000000000000000), (296461538169 / 100000000000000000000000000000000)⟩ ⟨-13, 15134408611233607866112052263, 12207031250000000000000000000⟩, + .log ⟨(15761434227596519824758437099 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(84177631938960260065417367651 / 10000000000000000000000000000000), (146854999 / 50000000000000000000000000000000)⟩ ⟨(-166897945967804481424178639006569 / 25000000000000000000000000000000), (46586812261 / 20000000000000000000000000000000)⟩ ⟨-10, 15761434227596519824758437099, 12207031250000000000000000000⟩, + .log ⟨(357403094246118838887313460991 / 10000000000000000000000000000000), (9 / 50000000000000000000000000000000)⟩ ⟨(119067987070455956842439341651 / 1000000000000000000000000000000), (4540983023 / 100000000000000000000000000000000)⟩ ⟨(-333147611163271165203882802172807 / 100000000000000000000000000000000), (127054942601 / 100000000000000000000000000000000)⟩ ⟨-5, 357403094246118838887313460991, 312500000000000000000000000000⟩, + .log ⟨(170352599633090340583334747683 / 50000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ ⟨(967927778213154600749277833877 / 50000000000000000000000000000000), (721471337 / 100000000000000000000000000000000)⟩ ⟨(-284095393993957675372317354978589 / 50000000000000000000000000000000), (211758237417 / 100000000000000000000000000000000)⟩ ⟨-9, 170352599633090340583334747683, 97656250000000000000000000000⟩, + .log ⟨(578843579703736076282549773 / 6250000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(86012078445606574945300023473 / 100000000000000000000000000000000), (14708993 / 50000000000000000000000000000000)⟩ ⟨(-464352986829518925600061657873457 / 50000000000000000000000000000000), (158818683021 / 50000000000000000000000000000000)⟩ ⟨-14, 578843579703736076282549773, 381469726562500000000000000⟩, + .log ⟨(461751035509925183658146339 / 160000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ ⟨(1687672108248379098503252324051 / 100000000000000000000000000000000), (305561211 / 50000000000000000000000000000000)⟩ ⟨(-18274697601756684663724463007867 / 3125000000000000000000000000000), (211758237523 / 100000000000000000000000000000000)⟩ ⟨-9, 461751035509925183658146339, 312500000000000000000000000⟩, + .log ⟨(13875948556758919775797428133 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(113638763340056841661525897671 / 50000000000000000000000000000000), (9549627 / 12500000000000000000000000000000)⟩ ⟨(-204740531566585854328890021855919 / 25000000000000000000000000000000), (275285711481 / 100000000000000000000000000000000)⟩ ⟨-12, 13875948556758919775797428133, 12207031250000000000000000000⟩, + .log ⟨(5338894496015538793514423 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(10250255509201701235807399 / 3125000000000000000000000000000), (108551 / 100000000000000000000000000000000)⟩ ⟨(-1535936777451069972260020993343403 / 100000000000000000000000000000000), (508224451009 / 100000000000000000000000000000000)⟩ ⟨-23, 5338894496015538793514423, 2980232238769531250000000⟩, + .log ⟨(123730068791233253944215387 / 2500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(12266226544985637156735056613 / 25000000000000000000000000000000), (16768563 / 100000000000000000000000000000000)⟩ ⟨(-991369896163409065318201244679157 / 100000000000000000000000000000000), (338813199133 / 100000000000000000000000000000000)⟩ ⟨-15, 123730068791233253944215387, 76293945312500000000000000⟩, + .log ⟨(9688309570012558062783029849 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(18486669413347809555191488331 / 5000000000000000000000000000000), (133352667 / 100000000000000000000000000000000)⟩ ⟨(-381628379641544566983419915561561 / 50000000000000000000000000000000), (275285709943 / 100000000000000000000000000000000)⟩ ⟨-12, 9688309570012558062783029849, 4882812500000000000000000000⟩, + .log ⟨(107552830135050130224241659 / 4000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(353708412658530958777015939 / 1250000000000000000000000000000), (9679471 / 100000000000000000000000000000000)⟩ ⟨(-131547784363979013309224974292483 / 12500000000000000000000000000000), (179994519901 / 50000000000000000000000000000000)⟩ ⟨-16, 107552830135050130224241659, 61035156250000000000000000⟩, + .log ⟨(44077770954746790018838991 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(645066063084057748618502959 / 100000000000000000000000000000000), (42939 / 20000000000000000000000000000000)⟩ ⟨(-1463472514856357048506440937917973 / 100000000000000000000000000000000), (243523106713 / 50000000000000000000000000000000)⟩ ⟨-22, 44077770954746790018838991, 23841857910156250000000000⟩, + .log ⟨(71193803934821248017894662907 / 12500000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ ⟨(588696226004415942996933798729 / 20000000000000000000000000000000), (542731491 / 50000000000000000000000000000000)⟩ ⟨(-32300488325290994350952273172629 / 6250000000000000000000000000000), (190582413849 / 100000000000000000000000000000000)⟩ ⟨-8, 71193803934821248017894662907, 48828125000000000000000000000⟩, + .log ⟨(1101823846845545262773523770261 / 25000000000000000000000000000000), (1 / 6250000000000000000000000000000)⟩ ⟨(11007340022081332261992469423 / 80000000000000000000000000000), (5599686669 / 100000000000000000000000000000000)⟩ ⟨(-156095448775606776385660819804849 / 50000000000000000000000000000000), (6352747123 / 5000000000000000000000000000000)⟩ ⟨-5, 1101823846845545262773523770261, 781250000000000000000000000000⟩, + .log ⟨(59738808788813614780350227383 / 20000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ ⟨(173645952101310115719566371953 / 10000000000000000000000000000000), (79063657 / 12500000000000000000000000000000)⟩ ⟨(-290675283993654344050809936460719 / 50000000000000000000000000000000), (211758237499 / 100000000000000000000000000000000)⟩ ⟨-9, 59738808788813614780350227383, 39062500000000000000000000000⟩, + .log ⟨(3127283799172667587155251871 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(68513492927074691390184513663 / 50000000000000000000000000000000), (23177989 / 50000000000000000000000000000000)⟩ ⟨(-219083068013207319775276554099563 / 25000000000000000000000000000000), (296461537957 / 100000000000000000000000000000000)⟩ ⟨-13, 3127283799172667587155251871, 2441406250000000000000000000⟩, + .log ⟨(29352259362543440217713823471967 / 100000000000000000000000000000000), (81 / 100000000000000000000000000000000)⟩ ⟨(17990009489061720836094520961877 / 50000000000000000000000000000000), (18646748249 / 100000000000000000000000000000000)⟩ ⟨(-7661254141827178531333734482649 / 6250000000000000000000000000000), (15881867831 / 25000000000000000000000000000000)⟩ ⟨-2, 29352259362543440217713823471967, 25000000000000000000000000000000⟩, + .log ⟨(566914442803409292567081915433 / 25000000000000000000000000000000), (1 / 12500000000000000000000000000000)⟩ ⟨(68690486995518938745374176627 / 800000000000000000000000000000), (1680683259 / 50000000000000000000000000000000)⟩ ⟨(-378642270603492519278153757531351 / 100000000000000000000000000000000), (148230766133 / 100000000000000000000000000000000)⟩ ⟨-6, 566914442803409292567081915433, 390625000000000000000000000000⟩, + .log ⟨(20500593588729748299706587463 / 12500000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ ⟨(1051767387069902132330274365011 / 100000000000000000000000000000000), (47752867 / 12500000000000000000000000000000)⟩ ⟨(-641303008201744117922391110335167 / 100000000000000000000000000000000), (58233515433 / 25000000000000000000000000000000)⟩ ⟨-10, 20500593588729748299706587463, 12207031250000000000000000000⟩, + .log ⟨(15624480313973233720492648479 / 10000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(100957601998187506887326929081 / 10000000000000000000000000000000), (90986843 / 25000000000000000000000000000000)⟩ ⟨(-129230028736251070220167333420729 / 20000000000000000000000000000000), (7279189411 / 3125000000000000000000000000000)⟩ ⟨-10, 15624480313973233720492648479, 9765625000000000000000000000⟩, + .log ⟨(8595780804967282641342069527 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(80470725637064610538911455231 / 100000000000000000000000000000000), (13651711 / 50000000000000000000000000000000)⟩ ⟨(-936165398616989269888768645656099 / 100000000000000000000000000000000), (158818683439 / 50000000000000000000000000000000)⟩ ⟨-14, 8595780804967282641342069527, 6103515625000000000000000000⟩, + .log ⟨(40078209147692641770543887 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(590345927660097914728907381 / 100000000000000000000000000000000), (39043 / 20000000000000000000000000000000)⟩ ⟨(-1472984797011782026346843780667873 / 100000000000000000000000000000000), (48704643983 / 10000000000000000000000000000000)⟩ ⟨-22, 40078209147692641770543887, 23841857910156250000000000⟩] +lemma CA1_7_8I2PairCertificates_valid : + CA1_7_8I2PairCertificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA1_7_8I2PairCertificateIndex (a : PairSlot × PairSlot) : ℕ := + match a.1.1.val, a.1.2.val, a.2.1.val, a.2.2.val with + | 5, 5, 0, 0 => 1 + | 4, 5, 1, 0 => 2 + | 4, 5, 0, 1 => 2 + | 5, 4, 1, 0 => 2 + | 5, 4, 0, 1 => 2 + | 2, 5, 2, 0 => 3 + | 2, 5, 3, 0 => 4 + | 2, 5, 1, 1 => 5 + | 2, 5, 0, 2 => 3 + | 2, 5, 0, 3 => 4 + | 3, 5, 2, 0 => 6 + | 3, 5, 3, 0 => 7 + | 3, 5, 1, 1 => 8 + | 3, 5, 0, 2 => 6 + | 3, 5, 0, 3 => 7 + | 4, 4, 2, 0 => 9 + | 4, 4, 3, 0 => 10 + | 4, 4, 1, 1 => 11 + | 4, 4, 0, 2 => 9 + | 4, 4, 0, 3 => 10 + | 5, 2, 2, 0 => 3 + | 5, 2, 3, 0 => 4 + | 5, 2, 1, 1 => 5 + | 5, 2, 0, 2 => 3 + | 5, 2, 0, 3 => 4 + | 5, 3, 2, 0 => 6 + | 5, 3, 3, 0 => 7 + | 5, 3, 1, 1 => 8 + | 5, 3, 0, 2 => 6 + | 5, 3, 0, 3 => 7 + | 1, 5, 4, 0 => 12 + | 1, 5, 2, 1 => 13 + | 1, 5, 3, 1 => 14 + | 1, 5, 1, 2 => 13 + | 1, 5, 1, 3 => 14 + | 1, 5, 0, 4 => 12 + | 2, 4, 4, 0 => 15 + | 2, 4, 2, 1 => 16 + | 2, 4, 3, 1 => 17 + | 2, 4, 1, 2 => 16 + | 2, 4, 1, 3 => 17 + | 2, 4, 0, 4 => 15 + | 3, 4, 4, 0 => 18 + | 3, 4, 2, 1 => 19 + | 3, 4, 3, 1 => 20 + | 3, 4, 1, 2 => 19 + | 3, 4, 1, 3 => 20 + | 3, 4, 0, 4 => 18 + | 4, 2, 4, 0 => 15 + | 4, 2, 2, 1 => 16 + | 4, 2, 3, 1 => 17 + | 4, 2, 1, 2 => 16 + | 4, 2, 1, 3 => 17 + | 4, 2, 0, 4 => 15 + | 4, 3, 4, 0 => 18 + | 4, 3, 2, 1 => 19 + | 4, 3, 3, 1 => 20 + | 4, 3, 1, 2 => 19 + | 4, 3, 1, 3 => 20 + | 4, 3, 0, 4 => 18 + | 5, 1, 4, 0 => 12 + | 5, 1, 2, 1 => 13 + | 5, 1, 3, 1 => 14 + | 5, 1, 1, 2 => 13 + | 5, 1, 1, 3 => 14 + | 5, 1, 0, 4 => 12 + | 5, 0, 5, 0 => 21 + | 5, 0, 4, 1 => 22 + | 5, 0, 2, 2 => 23 + | 5, 0, 2, 3 => 24 + | 5, 0, 3, 2 => 24 + | 5, 0, 3, 3 => 25 + | 5, 0, 1, 4 => 22 + | 5, 0, 0, 5 => 21 + | 4, 1, 5, 0 => 22 + | 4, 1, 4, 1 => 26 + | 4, 1, 2, 2 => 27 + | 4, 1, 2, 3 => 28 + | 4, 1, 3, 2 => 28 + | 4, 1, 3, 3 => 29 + | 4, 1, 1, 4 => 26 + | 4, 1, 0, 5 => 22 + | 2, 2, 5, 0 => 23 + | 2, 2, 4, 1 => 27 + | 2, 2, 2, 2 => 30 + | 2, 2, 2, 3 => 31 + | 2, 2, 3, 2 => 31 + | 2, 2, 3, 3 => 32 + | 2, 2, 1, 4 => 27 + | 2, 2, 0, 5 => 23 + | 2, 3, 5, 0 => 24 + | 2, 3, 4, 1 => 28 + | 2, 3, 2, 2 => 31 + | 2, 3, 2, 3 => 33 + | 2, 3, 3, 2 => 33 + | 2, 3, 3, 3 => 34 + | 2, 3, 1, 4 => 28 + | 2, 3, 0, 5 => 24 + | 3, 2, 5, 0 => 24 + | 3, 2, 4, 1 => 28 + | 3, 2, 2, 2 => 31 + | 3, 2, 2, 3 => 33 + | 3, 2, 3, 2 => 33 + | 3, 2, 3, 3 => 34 + | 3, 2, 1, 4 => 28 + | 3, 2, 0, 5 => 24 + | 3, 3, 5, 0 => 25 + | 3, 3, 4, 1 => 29 + | 3, 3, 2, 2 => 32 + | 3, 3, 2, 3 => 34 + | 3, 3, 3, 2 => 34 + | 3, 3, 3, 3 => 35 + | 3, 3, 1, 4 => 29 + | 3, 3, 0, 5 => 25 + | 1, 4, 5, 0 => 22 + | 1, 4, 4, 1 => 26 + | 1, 4, 2, 2 => 27 + | 1, 4, 2, 3 => 28 + | 1, 4, 3, 2 => 28 + | 1, 4, 3, 3 => 29 + | 1, 4, 1, 4 => 26 + | 1, 4, 0, 5 => 22 + | 0, 5, 5, 0 => 21 + | 0, 5, 4, 1 => 22 + | 0, 5, 2, 2 => 23 + | 0, 5, 2, 3 => 24 + | 0, 5, 3, 2 => 24 + | 0, 5, 3, 3 => 25 + | 0, 5, 1, 4 => 22 + | 0, 5, 0, 5 => 21 + | 4, 0, 5, 1 => 12 + | 4, 0, 4, 2 => 15 + | 4, 0, 4, 3 => 18 + | 4, 0, 2, 4 => 15 + | 4, 0, 3, 4 => 18 + | 4, 0, 1, 5 => 12 + | 2, 1, 5, 1 => 13 + | 2, 1, 4, 2 => 16 + | 2, 1, 4, 3 => 19 + | 2, 1, 2, 4 => 16 + | 2, 1, 3, 4 => 19 + | 2, 1, 1, 5 => 13 + | 3, 1, 5, 1 => 14 + | 3, 1, 4, 2 => 17 + | 3, 1, 4, 3 => 20 + | 3, 1, 2, 4 => 17 + | 3, 1, 3, 4 => 20 + | 3, 1, 1, 5 => 14 + | 1, 2, 5, 1 => 13 + | 1, 2, 4, 2 => 16 + | 1, 2, 4, 3 => 19 + | 1, 2, 2, 4 => 16 + | 1, 2, 3, 4 => 19 + | 1, 2, 1, 5 => 13 + | 1, 3, 5, 1 => 14 + | 1, 3, 4, 2 => 17 + | 1, 3, 4, 3 => 20 + | 1, 3, 2, 4 => 17 + | 1, 3, 3, 4 => 20 + | 1, 3, 1, 5 => 14 + | 0, 4, 5, 1 => 12 + | 0, 4, 4, 2 => 15 + | 0, 4, 4, 3 => 18 + | 0, 4, 2, 4 => 15 + | 0, 4, 3, 4 => 18 + | 0, 4, 1, 5 => 12 + | 2, 0, 5, 2 => 3 + | 2, 0, 5, 3 => 6 + | 2, 0, 4, 4 => 9 + | 2, 0, 2, 5 => 3 + | 2, 0, 3, 5 => 6 + | 3, 0, 5, 2 => 4 + | 3, 0, 5, 3 => 7 + | 3, 0, 4, 4 => 10 + | 3, 0, 2, 5 => 4 + | 3, 0, 3, 5 => 7 + | 1, 1, 5, 2 => 5 + | 1, 1, 5, 3 => 8 + | 1, 1, 4, 4 => 11 + | 1, 1, 2, 5 => 5 + | 1, 1, 3, 5 => 8 + | 0, 2, 5, 2 => 3 + | 0, 2, 5, 3 => 6 + | 0, 2, 4, 4 => 9 + | 0, 2, 2, 5 => 3 + | 0, 2, 3, 5 => 6 + | 0, 3, 5, 2 => 4 + | 0, 3, 5, 3 => 7 + | 0, 3, 4, 4 => 10 + | 0, 3, 2, 5 => 4 + | 0, 3, 3, 5 => 7 + | 1, 0, 4, 5 => 2 + | 1, 0, 5, 4 => 2 + | 0, 1, 4, 5 => 2 + | 0, 1, 5, 4 => 2 + | 0, 0, 5, 5 => 1 + | _, _, _, _ => 0 +def CA1_7_8I2PairP (a : PairSlot × PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_7_8I2PairCertificates (CA1_7_8I2PairCertificateIndex a)).input +lemma CA1_7_8I2PairP_check_0_0 : ∀ k l : Fin 6, contains (CA1_7_8I2PairRaw ((0,0),(k,l))) (CA1_7_8I2PairP ((0,0),(k,l))) = true := by + decide +kernel +lemma CA1_7_8I2PairP_check_0_1 : ∀ k l : Fin 6, contains (CA1_7_8I2PairRaw ((0,1),(k,l))) (CA1_7_8I2PairP ((0,1),(k,l))) = true := by + decide +kernel +lemma CA1_7_8I2PairP_check_0_2 : ∀ k l : Fin 6, contains (CA1_7_8I2PairRaw ((0,2),(k,l))) (CA1_7_8I2PairP ((0,2),(k,l))) = true := by + decide +kernel +lemma CA1_7_8I2PairP_check_0_3 : ∀ k l : Fin 6, contains (CA1_7_8I2PairRaw ((0,3),(k,l))) (CA1_7_8I2PairP ((0,3),(k,l))) = true := by + decide +kernel +lemma CA1_7_8I2PairP_check_0_4 : ∀ k l : Fin 6, contains (CA1_7_8I2PairRaw ((0,4),(k,l))) (CA1_7_8I2PairP ((0,4),(k,l))) = true := by + decide +kernel +lemma CA1_7_8I2PairP_check_0_5 : ∀ k l : Fin 6, contains (CA1_7_8I2PairRaw ((0,5),(k,l))) (CA1_7_8I2PairP ((0,5),(k,l))) = true := by + decide +kernel +lemma CA1_7_8I2PairP_check_1_0 : ∀ k l : Fin 6, contains (CA1_7_8I2PairRaw ((1,0),(k,l))) (CA1_7_8I2PairP ((1,0),(k,l))) = true := by + decide +kernel +lemma CA1_7_8I2PairP_check_1_1 : ∀ k l : Fin 6, contains (CA1_7_8I2PairRaw ((1,1),(k,l))) (CA1_7_8I2PairP ((1,1),(k,l))) = true := by + decide +kernel +lemma CA1_7_8I2PairP_check_1_2 : ∀ k l : Fin 6, contains (CA1_7_8I2PairRaw ((1,2),(k,l))) (CA1_7_8I2PairP ((1,2),(k,l))) = true := by + decide +kernel +lemma CA1_7_8I2PairP_check_1_3 : ∀ k l : Fin 6, contains (CA1_7_8I2PairRaw ((1,3),(k,l))) (CA1_7_8I2PairP ((1,3),(k,l))) = true := by + decide +kernel +lemma CA1_7_8I2PairP_check_1_4 : ∀ k l : Fin 6, contains (CA1_7_8I2PairRaw ((1,4),(k,l))) (CA1_7_8I2PairP ((1,4),(k,l))) = true := by + decide +kernel +lemma CA1_7_8I2PairP_check_1_5 : ∀ k l : Fin 6, contains (CA1_7_8I2PairRaw ((1,5),(k,l))) (CA1_7_8I2PairP ((1,5),(k,l))) = true := by + decide +kernel +lemma CA1_7_8I2PairP_check_2_0 : ∀ k l : Fin 6, contains (CA1_7_8I2PairRaw ((2,0),(k,l))) (CA1_7_8I2PairP ((2,0),(k,l))) = true := by + decide +kernel +lemma CA1_7_8I2PairP_check_2_1 : ∀ k l : Fin 6, contains (CA1_7_8I2PairRaw ((2,1),(k,l))) (CA1_7_8I2PairP ((2,1),(k,l))) = true := by + decide +kernel +lemma CA1_7_8I2PairP_check_2_2 : ∀ k l : Fin 6, contains (CA1_7_8I2PairRaw ((2,2),(k,l))) (CA1_7_8I2PairP ((2,2),(k,l))) = true := by + decide +kernel +lemma CA1_7_8I2PairP_check_2_3 : ∀ k l : Fin 6, contains (CA1_7_8I2PairRaw ((2,3),(k,l))) (CA1_7_8I2PairP ((2,3),(k,l))) = true := by + decide +kernel +lemma CA1_7_8I2PairP_check_2_4 : ∀ k l : Fin 6, contains (CA1_7_8I2PairRaw ((2,4),(k,l))) (CA1_7_8I2PairP ((2,4),(k,l))) = true := by + decide +kernel +lemma CA1_7_8I2PairP_check_2_5 : ∀ k l : Fin 6, contains (CA1_7_8I2PairRaw ((2,5),(k,l))) (CA1_7_8I2PairP ((2,5),(k,l))) = true := by + decide +kernel +lemma CA1_7_8I2PairP_check_3_0 : ∀ k l : Fin 6, contains (CA1_7_8I2PairRaw ((3,0),(k,l))) (CA1_7_8I2PairP ((3,0),(k,l))) = true := by + decide +kernel +lemma CA1_7_8I2PairP_check_3_1 : ∀ k l : Fin 6, contains (CA1_7_8I2PairRaw ((3,1),(k,l))) (CA1_7_8I2PairP ((3,1),(k,l))) = true := by + decide +kernel +lemma CA1_7_8I2PairP_check_3_2 : ∀ k l : Fin 6, contains (CA1_7_8I2PairRaw ((3,2),(k,l))) (CA1_7_8I2PairP ((3,2),(k,l))) = true := by + decide +kernel +lemma CA1_7_8I2PairP_check_3_3 : ∀ k l : Fin 6, contains (CA1_7_8I2PairRaw ((3,3),(k,l))) (CA1_7_8I2PairP ((3,3),(k,l))) = true := by + decide +kernel +lemma CA1_7_8I2PairP_check_3_4 : ∀ k l : Fin 6, contains (CA1_7_8I2PairRaw ((3,4),(k,l))) (CA1_7_8I2PairP ((3,4),(k,l))) = true := by + decide +kernel +lemma CA1_7_8I2PairP_check_3_5 : ∀ k l : Fin 6, contains (CA1_7_8I2PairRaw ((3,5),(k,l))) (CA1_7_8I2PairP ((3,5),(k,l))) = true := by + decide +kernel +lemma CA1_7_8I2PairP_check_4_0 : ∀ k l : Fin 6, contains (CA1_7_8I2PairRaw ((4,0),(k,l))) (CA1_7_8I2PairP ((4,0),(k,l))) = true := by + decide +kernel +lemma CA1_7_8I2PairP_check_4_1 : ∀ k l : Fin 6, contains (CA1_7_8I2PairRaw ((4,1),(k,l))) (CA1_7_8I2PairP ((4,1),(k,l))) = true := by + decide +kernel +lemma CA1_7_8I2PairP_check_4_2 : ∀ k l : Fin 6, contains (CA1_7_8I2PairRaw ((4,2),(k,l))) (CA1_7_8I2PairP ((4,2),(k,l))) = true := by + decide +kernel +lemma CA1_7_8I2PairP_check_4_3 : ∀ k l : Fin 6, contains (CA1_7_8I2PairRaw ((4,3),(k,l))) (CA1_7_8I2PairP ((4,3),(k,l))) = true := by + decide +kernel +lemma CA1_7_8I2PairP_check_4_4 : ∀ k l : Fin 6, contains (CA1_7_8I2PairRaw ((4,4),(k,l))) (CA1_7_8I2PairP ((4,4),(k,l))) = true := by + decide +kernel +lemma CA1_7_8I2PairP_check_4_5 : ∀ k l : Fin 6, contains (CA1_7_8I2PairRaw ((4,5),(k,l))) (CA1_7_8I2PairP ((4,5),(k,l))) = true := by + decide +kernel +lemma CA1_7_8I2PairP_check_5_0 : ∀ k l : Fin 6, contains (CA1_7_8I2PairRaw ((5,0),(k,l))) (CA1_7_8I2PairP ((5,0),(k,l))) = true := by + decide +kernel +lemma CA1_7_8I2PairP_check_5_1 : ∀ k l : Fin 6, contains (CA1_7_8I2PairRaw ((5,1),(k,l))) (CA1_7_8I2PairP ((5,1),(k,l))) = true := by + decide +kernel +lemma CA1_7_8I2PairP_check_5_2 : ∀ k l : Fin 6, contains (CA1_7_8I2PairRaw ((5,2),(k,l))) (CA1_7_8I2PairP ((5,2),(k,l))) = true := by + decide +kernel +lemma CA1_7_8I2PairP_check_5_3 : ∀ k l : Fin 6, contains (CA1_7_8I2PairRaw ((5,3),(k,l))) (CA1_7_8I2PairP ((5,3),(k,l))) = true := by + decide +kernel +lemma CA1_7_8I2PairP_check_5_4 : ∀ k l : Fin 6, contains (CA1_7_8I2PairRaw ((5,4),(k,l))) (CA1_7_8I2PairP ((5,4),(k,l))) = true := by + decide +kernel +lemma CA1_7_8I2PairP_check_5_5 : ∀ k l : Fin 6, contains (CA1_7_8I2PairRaw ((5,5),(k,l))) (CA1_7_8I2PairP ((5,5),(k,l))) = true := by + decide +kernel +lemma CA1_7_8I2PairP_check (a : PairSlot × PairSlot) : contains (CA1_7_8I2PairRaw a) (CA1_7_8I2PairP a) = true := by + rcases a with ⟨⟨i,j⟩,⟨k,l⟩⟩ + revert j i + apply forall_fin6 + · exact forall_fin6 (CA1_7_8I2PairP_check_0_0 k l) (CA1_7_8I2PairP_check_0_1 k l) (CA1_7_8I2PairP_check_0_2 k l) (CA1_7_8I2PairP_check_0_3 k l) (CA1_7_8I2PairP_check_0_4 k l) (CA1_7_8I2PairP_check_0_5 k l) + · exact forall_fin6 (CA1_7_8I2PairP_check_1_0 k l) (CA1_7_8I2PairP_check_1_1 k l) (CA1_7_8I2PairP_check_1_2 k l) (CA1_7_8I2PairP_check_1_3 k l) (CA1_7_8I2PairP_check_1_4 k l) (CA1_7_8I2PairP_check_1_5 k l) + · exact forall_fin6 (CA1_7_8I2PairP_check_2_0 k l) (CA1_7_8I2PairP_check_2_1 k l) (CA1_7_8I2PairP_check_2_2 k l) (CA1_7_8I2PairP_check_2_3 k l) (CA1_7_8I2PairP_check_2_4 k l) (CA1_7_8I2PairP_check_2_5 k l) + · exact forall_fin6 (CA1_7_8I2PairP_check_3_0 k l) (CA1_7_8I2PairP_check_3_1 k l) (CA1_7_8I2PairP_check_3_2 k l) (CA1_7_8I2PairP_check_3_3 k l) (CA1_7_8I2PairP_check_3_4 k l) (CA1_7_8I2PairP_check_3_5 k l) + · exact forall_fin6 (CA1_7_8I2PairP_check_4_0 k l) (CA1_7_8I2PairP_check_4_1 k l) (CA1_7_8I2PairP_check_4_2 k l) (CA1_7_8I2PairP_check_4_3 k l) (CA1_7_8I2PairP_check_4_4 k l) (CA1_7_8I2PairP_check_4_5 k l) + · exact forall_fin6 (CA1_7_8I2PairP_check_5_0 k l) (CA1_7_8I2PairP_check_5_1 k l) (CA1_7_8I2PairP_check_5_2 k l) (CA1_7_8I2PairP_check_5_3 k l) (CA1_7_8I2PairP_check_5_4 k l) (CA1_7_8I2PairP_check_5_5 k l) +lemma CA1_7_8I2PairP_sound (a : PairSlot × PairSlot) : + (CA1_7_8I2PairP a).Encloses (CA1_7_8I2PairValue a) := + contains_sound (CA1_7_8I2PairRaw_sound a) (CA1_7_8I2PairP_check a) +def CA1_7_8I2PairTerms (a : PairSlot × PairSlot) : Ball := + (CompactCertificate.entropyLookup CA1_7_8I2PairCertificates (CA1_7_8I2PairCertificateIndex a)).output +lemma CA1_7_8I2PairTerms_sound (a : PairSlot × PairSlot) : + (CA1_7_8I2PairTerms a).Encloses (Foundation.entropyTerm (CA1_7_8I2PairValue a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA1_7_8I2PairCertificates_valid + (CA1_7_8I2PairCertificateIndex a) (CA1_7_8I2PairP_sound a) +def CA1_7_8I2PairEntropy : Ball := ⟨(314337290010813783318900239035769 / 100000000000000000000000000000000), (2495419539 / 2000000000000000000000000000000)⟩ +lemma CA1_7_8I2PairEntropy_sound : CA1_7_8I2PairEntropy.Encloses (Foundation.finiteEntropy CA1_7_8I2PairValue) := by + exact contains_sound (entropyDoublePair_enclosed CA1_7_8I2PairValue CA1_7_8I2PairTerms CA1_7_8I2PairTerms_sound) (by decide +kernel) +def CA1_7_8I2PairMass : Ball := ⟨(25000000000000000000000000000001 / 25000000000000000000000000000000), (7 / 1250000000000000000000000000000)⟩ +lemma CA1_7_8I2PairMass_sound : CA1_7_8I2PairMass.Encloses (∑ a, CA1_7_8I2PairValue a) := by + exact contains_sound (doublePairSumBall_sound CA1_7_8I2PairP CA1_7_8I2PairValue CA1_7_8I2PairP_sound) (by decide +kernel) +def CA1_7_8I2PairMassTermLogWitness : LogWitness := ⟨0, 25000000000000000000000000000001, 25000000000000000000000000000000⟩ +def CA1_7_8I2PairMassTermLog : Ball := ⟨(1 / 25000000000000000000000000000000), (10587912121 / 50000000000000000000000000000000)⟩ +lemma CA1_7_8I2PairMassTermLog_sound : CA1_7_8I2PairMassTermLog.Encloses (Real.log ((∑ a, CA1_7_8I2PairValue a))) := by + exact checkLog_sound logTwoBall_sound (CA1_7_8I2PairMass_sound) (w := CA1_7_8I2PairMassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA1_7_8I2PairMassTerm : Ball := ⟨(-1 / 25000000000000000000000000000000), (21175824243 / 100000000000000000000000000000000)⟩ +lemma CA1_7_8I2PairMassTerm_sound : CA1_7_8I2PairMassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA1_7_8I2PairValue a))) := by + exact contains_sound (entropyTerm_ball (CA1_7_8I2PairMass_sound) CA1_7_8I2PairMassTermLog_sound) (by decide +kernel) +def CA1_7_8I2PairH : Ball := ⟨(314337290010813783318900239035773 / 100000000000000000000000000000000), (145946801193 / 100000000000000000000000000000000)⟩ +lemma CA1_7_8I2PairH_sound : CA1_7_8I2PairH.Encloses (homogeneousEntropy CA1_7_8I2PairValue) := by + exact contains_sound (homogeneous_enclosed CA1_7_8I2PairValue CA1_7_8I2PairMassTerm_sound CA1_7_8I2PairEntropy_sound) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA2_2_12I0.lean b/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA2_2_12I0.lean new file mode 100644 index 0000000000000000000000000000000000000000..5670df9751b683dfae5094e2add5a35f09ed6eb4 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA2_2_12I0.lean @@ -0,0 +1,74 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Certificates.SplitA2_2_12 + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CA2_2_12I0Value (a : Fin 17) : ℝ := marginal (below (shape 2 2 12)) (fun u => (stageALaw (shape 2 2 12) u : ℝ)) ((Equiv.refl (Fin 3)) 0) a +def CA2_2_12I0Raw (a : Fin 17) : Ball := marginalBall (below (shape 2 2 12)) A2_2_12Law ((Equiv.refl (Fin 3)) 0) a +lemma CA2_2_12I0Raw_sound (a : Fin 17) : + (CA2_2_12I0Raw a).Encloses (CA2_2_12I0Value a) := by + exact marginalBall_sound (below (shape 2 2 12)) A2_2_12Law (fun u => (stageALaw (shape 2 2 12) u : ℝ)) (fun u _ => A2_2_12Law_sound u) ((Equiv.refl (Fin 3)) 0) a +def CA2_2_12I0Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(13304581949811756576850221805683 / 50000000000000000000000000000000), (121 / 100000000000000000000000000000000)⟩ ⟨(17614129252825866852505103836653 / 50000000000000000000000000000000), (8452064587 / 50000000000000000000000000000000)⟩ ⟨(-26478290440497583697605424591511 / 20000000000000000000000000000000), (63527471503 / 100000000000000000000000000000000)⟩ ⟨-2, 13304581949811756576850221805683, 12500000000000000000000000000000⟩, + .log ⟨(4678167220075297369259911277727 / 10000000000000000000000000000000), (141 / 100000000000000000000000000000000)⟩ ⟨(888475973950925703876602594341 / 2500000000000000000000000000000), (3714901689 / 12500000000000000000000000000000)⟩ ⟨(-37983933970475952861129556443821 / 50000000000000000000000000000000), (1270549427 / 2000000000000000000000000000000)⟩ ⟨-2, 4678167220075297369259911277727, 2500000000000000000000000000000⟩] +lemma CA2_2_12I0Certificates_valid : + CA2_2_12I0Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_2_12I0CertificateIndex (a : Fin 17) : ℕ := + match a.val with + | 0 => 1 + | 1 => 2 + | 2 => 1 + | _ => 0 +def CA2_2_12I0P (a : Fin 17) : Ball := + (CompactCertificate.entropyLookup CA2_2_12I0Certificates (CA2_2_12I0CertificateIndex a)).input +lemma CA2_2_12I0P_check : ∀ a : Fin 17, contains (CA2_2_12I0Raw a) (CA2_2_12I0P a) = true := by + decide +kernel +lemma CA2_2_12I0P_sound (a : Fin 17) : + (CA2_2_12I0P a).Encloses (CA2_2_12I0Value a) := + contains_sound (CA2_2_12I0Raw_sound a) (CA2_2_12I0P_check a) +def CA2_2_12I0Terms (a : Fin 17) : Ball := + (CompactCertificate.entropyLookup CA2_2_12I0Certificates (CA2_2_12I0CertificateIndex a)).output +lemma CA2_2_12I0Terms_sound (a : Fin 17) : + (CA2_2_12I0Terms a).Encloses (Foundation.entropyTerm (CA2_2_12I0Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_2_12I0Certificates_valid + (CA2_2_12I0CertificateIndex a) (CA2_2_12I0P_sound a) +def CA2_2_12I0Entropy : Ball := ⟨(26498888992335123891271129780063 / 25000000000000000000000000000000), (3176373593 / 5000000000000000000000000000000)⟩ +lemma CA2_2_12I0Entropy_sound : CA2_2_12I0Entropy.Encloses (Foundation.finiteEntropy CA2_2_12I0Value) := by + exact contains_sound (entropyFin_enclosed 17 CA2_2_12I0Value CA2_2_12I0Terms CA2_2_12I0Terms_sound) (by decide +kernel) +def CA2_2_12I0Mass : Ball := ⟨(50000000000000000000000000000001 / 50000000000000000000000000000000), (383 / 100000000000000000000000000000000)⟩ +lemma CA2_2_12I0Mass_sound : CA2_2_12I0Mass.Encloses (∑ a, CA2_2_12I0Value a) := by + exact contains_sound (finSumBall_sound 17 CA2_2_12I0P CA2_2_12I0Value CA2_2_12I0P_sound) (by decide +kernel) +def CA2_2_12I0MassTermLogWitness : LogWitness := ⟨0, 50000000000000000000000000000001, 50000000000000000000000000000000⟩ +def CA2_2_12I0MassTermLog : Ball := ⟨(1 / 50000000000000000000000000000000), (4235164813 / 20000000000000000000000000000000)⟩ +lemma CA2_2_12I0MassTermLog_sound : CA2_2_12I0MassTermLog.Encloses (Real.log ((∑ a, CA2_2_12I0Value a))) := by + exact checkLog_sound logTwoBall_sound (CA2_2_12I0Mass_sound) (w := CA2_2_12I0MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA2_2_12I0MassTerm : Ball := ⟨(-1 / 50000000000000000000000000000000), (10587912033 / 50000000000000000000000000000000)⟩ +lemma CA2_2_12I0MassTerm_sound : CA2_2_12I0MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_2_12I0Value a))) := by + exact contains_sound (entropyTerm_ball (CA2_2_12I0Mass_sound) CA2_2_12I0MassTermLog_sound) (by decide +kernel) +def CA2_2_12I0H : Ball := ⟨(52997777984670247782542259560127 / 50000000000000000000000000000000), (42351647963 / 50000000000000000000000000000000)⟩ +lemma CA2_2_12I0H_sound : CA2_2_12I0H.Encloses (homogeneousEntropy CA2_2_12I0Value) := by + exact contains_sound (homogeneous_enclosed CA2_2_12I0Value CA2_2_12I0MassTerm_sound CA2_2_12I0Entropy_sound) (by decide +kernel) +lemma CA2_2_12I0_sound : CA2_2_12I0H.Encloses (stageACapacity (shape 2 2 12) 0) := by + exact CA2_2_12I0H_sound + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA2_2_12I1.lean b/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA2_2_12I1.lean new file mode 100644 index 0000000000000000000000000000000000000000..276feba57b06b1f813ec2622f7465c6ed97bc7c8 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA2_2_12I1.lean @@ -0,0 +1,939 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Certificates.SupportedContraction + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CA2_2_12I1PairValue (a : PairSlot × PairSlot) : ℝ := pairLaw (below (shape 2 2 12)) (shape 2 2 12) (fun u => (stageALaw (shape 2 2 12) u : ℝ)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) a +def CA2_2_12I1PairRaw (a : PairSlot × PairSlot) : Ball := stageAPairBall (shape 2 2 12) A2_2_12Law 1 a +lemma CA2_2_12I1PairRaw_sound (a : PairSlot × PairSlot) : + (CA2_2_12I1PairRaw a).Encloses (CA2_2_12I1PairValue a) := by + exact stageAPairBall_sound (shape 2 2 12) (by decide +kernel) A2_2_12Law (fun u => (stageALaw (shape 2 2 12) u : ℝ)) (fun u _ => A2_2_12Law_sound u) 1 a +def CA2_2_12I1PairCertificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(302482925649111920125581269257 / 6250000000000000000000000000000), (33 / 100000000000000000000000000000000)⟩ ⟨(183202529322725425551350669373 / 1250000000000000000000000000000), (614911223 / 10000000000000000000000000000000)⟩ ⟨(-302831191098774837778472172403237 / 100000000000000000000000000000000), (127054942779 / 100000000000000000000000000000000)⟩ ⟨-5, 302482925649111920125581269257, 195312500000000000000000000000⟩, + .log ⟨(438298311601115271502955321633 / 100000000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ ⟨(2379971100514961686425459230633 / 100000000000000000000000000000000), (417659763 / 50000000000000000000000000000000)⟩ ⟨(-543002570970639744871677242332053 / 100000000000000000000000000000000), (190582414059 / 100000000000000000000000000000000)⟩ ⟨-8, 438298311601115271502955321633, 390625000000000000000000000000⟩, + .log ⟨(80190106418530052814542057723 / 500000000000000000000000000000), (83 / 100000000000000000000000000000000)⟩ ⟨(2935291409619310609458147751239 / 10000000000000000000000000000000), (13584732673 / 100000000000000000000000000000000)⟩ ⟨(-4575519881310809697685997306137 / 2500000000000000000000000000000), (84703295249 / 100000000000000000000000000000000)⟩ ⟨-3, 80190106418530052814542057723, 62500000000000000000000000000⟩, + .log ⟨(2925741059040022181258384649489 / 25000000000000000000000000000000), (43 / 100000000000000000000000000000000)⟩ ⟨(25106697125133889086545315919143 / 100000000000000000000000000000000), (6195497749 / 50000000000000000000000000000000)⟩ ⟨(-107266401137750371993035220349159 / 50000000000000000000000000000000), (52939559391 / 50000000000000000000000000000000)⟩ ⟨-4, 2925741059040022181258384649489, 1562500000000000000000000000000⟩] +lemma CA2_2_12I1PairCertificates_valid : + CA2_2_12I1PairCertificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_2_12I1PairCertificateIndex (a : PairSlot × PairSlot) : ℕ := + match a.1.1.val, a.1.2.val, a.2.1.val, a.2.2.val with + | 0, 0, 0, 2 => 1 + | 0, 0, 0, 3 => 2 + | 0, 0, 1, 1 => 3 + | 0, 0, 2, 0 => 1 + | 0, 0, 3, 0 => 2 + | 1, 0, 0, 1 => 4 + | 1, 0, 1, 0 => 4 + | 0, 1, 0, 1 => 4 + | 0, 1, 1, 0 => 4 + | 2, 0, 0, 0 => 1 + | 3, 0, 0, 0 => 2 + | 1, 1, 0, 0 => 3 + | 0, 2, 0, 0 => 1 + | 0, 3, 0, 0 => 2 + | _, _, _, _ => 0 +def CA2_2_12I1PairP (a : PairSlot × PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_2_12I1PairCertificates (CA2_2_12I1PairCertificateIndex a)).input +lemma CA2_2_12I1PairP_check_0_0 : ∀ k l : Fin 6, contains (CA2_2_12I1PairRaw ((0,0),(k,l))) (CA2_2_12I1PairP ((0,0),(k,l))) = true := by + decide +kernel +lemma CA2_2_12I1PairP_check_0_1 : ∀ k l : Fin 6, contains (CA2_2_12I1PairRaw ((0,1),(k,l))) (CA2_2_12I1PairP ((0,1),(k,l))) = true := by + decide +kernel +lemma CA2_2_12I1PairP_check_0_2 : ∀ k l : Fin 6, contains (CA2_2_12I1PairRaw ((0,2),(k,l))) (CA2_2_12I1PairP ((0,2),(k,l))) = true := by + decide +kernel +lemma CA2_2_12I1PairP_check_0_3 : ∀ k l : Fin 6, contains (CA2_2_12I1PairRaw ((0,3),(k,l))) (CA2_2_12I1PairP ((0,3),(k,l))) = true := by + decide +kernel +lemma CA2_2_12I1PairP_check_0_4 : ∀ k l : Fin 6, contains (CA2_2_12I1PairRaw ((0,4),(k,l))) (CA2_2_12I1PairP ((0,4),(k,l))) = true := by + decide +kernel +lemma CA2_2_12I1PairP_check_0_5 : ∀ k l : Fin 6, contains (CA2_2_12I1PairRaw ((0,5),(k,l))) (CA2_2_12I1PairP ((0,5),(k,l))) = true := by + decide +kernel +lemma CA2_2_12I1PairP_check_1_0 : ∀ k l : Fin 6, contains (CA2_2_12I1PairRaw ((1,0),(k,l))) (CA2_2_12I1PairP ((1,0),(k,l))) = true := by + decide +kernel +lemma CA2_2_12I1PairP_check_1_1 : ∀ k l : Fin 6, contains (CA2_2_12I1PairRaw ((1,1),(k,l))) (CA2_2_12I1PairP ((1,1),(k,l))) = true := by + decide +kernel +lemma CA2_2_12I1PairP_check_1_2 : ∀ k l : Fin 6, contains (CA2_2_12I1PairRaw ((1,2),(k,l))) (CA2_2_12I1PairP ((1,2),(k,l))) = true := by + decide +kernel +lemma CA2_2_12I1PairP_check_1_3 : ∀ k l : Fin 6, contains (CA2_2_12I1PairRaw ((1,3),(k,l))) (CA2_2_12I1PairP ((1,3),(k,l))) = true := by + decide +kernel +lemma CA2_2_12I1PairP_check_1_4 : ∀ k l : Fin 6, contains (CA2_2_12I1PairRaw ((1,4),(k,l))) (CA2_2_12I1PairP ((1,4),(k,l))) = true := by + decide +kernel +lemma CA2_2_12I1PairP_check_1_5 : ∀ k l : Fin 6, contains (CA2_2_12I1PairRaw ((1,5),(k,l))) (CA2_2_12I1PairP ((1,5),(k,l))) = true := by + decide +kernel +lemma CA2_2_12I1PairP_check_2_0 : ∀ k l : Fin 6, contains (CA2_2_12I1PairRaw ((2,0),(k,l))) (CA2_2_12I1PairP ((2,0),(k,l))) = true := by + decide +kernel +lemma CA2_2_12I1PairP_check_2_1 : ∀ k l : Fin 6, contains (CA2_2_12I1PairRaw ((2,1),(k,l))) (CA2_2_12I1PairP ((2,1),(k,l))) = true := by + decide +kernel +lemma CA2_2_12I1PairP_check_2_2 : ∀ k l : Fin 6, contains (CA2_2_12I1PairRaw ((2,2),(k,l))) (CA2_2_12I1PairP ((2,2),(k,l))) = true := by + decide +kernel +lemma CA2_2_12I1PairP_check_2_3 : ∀ k l : Fin 6, contains (CA2_2_12I1PairRaw ((2,3),(k,l))) (CA2_2_12I1PairP ((2,3),(k,l))) = true := by + decide +kernel +lemma CA2_2_12I1PairP_check_2_4 : ∀ k l : Fin 6, contains (CA2_2_12I1PairRaw ((2,4),(k,l))) (CA2_2_12I1PairP ((2,4),(k,l))) = true := by + decide +kernel +lemma CA2_2_12I1PairP_check_2_5 : ∀ k l : Fin 6, contains (CA2_2_12I1PairRaw ((2,5),(k,l))) (CA2_2_12I1PairP ((2,5),(k,l))) = true := by + decide +kernel +lemma CA2_2_12I1PairP_check_3_0 : ∀ k l : Fin 6, contains (CA2_2_12I1PairRaw ((3,0),(k,l))) (CA2_2_12I1PairP ((3,0),(k,l))) = true := by + decide +kernel +lemma CA2_2_12I1PairP_check_3_1 : ∀ k l : Fin 6, contains (CA2_2_12I1PairRaw ((3,1),(k,l))) (CA2_2_12I1PairP ((3,1),(k,l))) = true := by + decide +kernel +lemma CA2_2_12I1PairP_check_3_2 : ∀ k l : Fin 6, contains (CA2_2_12I1PairRaw ((3,2),(k,l))) (CA2_2_12I1PairP ((3,2),(k,l))) = true := by + decide +kernel +lemma CA2_2_12I1PairP_check_3_3 : ∀ k l : Fin 6, contains (CA2_2_12I1PairRaw ((3,3),(k,l))) (CA2_2_12I1PairP ((3,3),(k,l))) = true := by + decide +kernel +lemma CA2_2_12I1PairP_check_3_4 : ∀ k l : Fin 6, contains (CA2_2_12I1PairRaw ((3,4),(k,l))) (CA2_2_12I1PairP ((3,4),(k,l))) = true := by + decide +kernel +lemma CA2_2_12I1PairP_check_3_5 : ∀ k l : Fin 6, contains (CA2_2_12I1PairRaw ((3,5),(k,l))) (CA2_2_12I1PairP ((3,5),(k,l))) = true := by + decide +kernel +lemma CA2_2_12I1PairP_check_4_0 : ∀ k l : Fin 6, contains (CA2_2_12I1PairRaw ((4,0),(k,l))) (CA2_2_12I1PairP ((4,0),(k,l))) = true := by + decide +kernel +lemma CA2_2_12I1PairP_check_4_1 : ∀ k l : Fin 6, contains (CA2_2_12I1PairRaw ((4,1),(k,l))) (CA2_2_12I1PairP ((4,1),(k,l))) = true := by + decide +kernel +lemma CA2_2_12I1PairP_check_4_2 : ∀ k l : Fin 6, contains (CA2_2_12I1PairRaw ((4,2),(k,l))) (CA2_2_12I1PairP ((4,2),(k,l))) = true := by + decide +kernel +lemma CA2_2_12I1PairP_check_4_3 : ∀ k l : Fin 6, contains (CA2_2_12I1PairRaw ((4,3),(k,l))) (CA2_2_12I1PairP ((4,3),(k,l))) = true := by + decide +kernel +lemma CA2_2_12I1PairP_check_4_4 : ∀ k l : Fin 6, contains (CA2_2_12I1PairRaw ((4,4),(k,l))) (CA2_2_12I1PairP ((4,4),(k,l))) = true := by + decide +kernel +lemma CA2_2_12I1PairP_check_4_5 : ∀ k l : Fin 6, contains (CA2_2_12I1PairRaw ((4,5),(k,l))) (CA2_2_12I1PairP ((4,5),(k,l))) = true := by + decide +kernel +lemma CA2_2_12I1PairP_check_5_0 : ∀ k l : Fin 6, contains (CA2_2_12I1PairRaw ((5,0),(k,l))) (CA2_2_12I1PairP ((5,0),(k,l))) = true := by + decide +kernel +lemma CA2_2_12I1PairP_check_5_1 : ∀ k l : Fin 6, contains (CA2_2_12I1PairRaw ((5,1),(k,l))) (CA2_2_12I1PairP ((5,1),(k,l))) = true := by + decide +kernel +lemma CA2_2_12I1PairP_check_5_2 : ∀ k l : Fin 6, contains (CA2_2_12I1PairRaw ((5,2),(k,l))) (CA2_2_12I1PairP ((5,2),(k,l))) = true := by + decide +kernel +lemma CA2_2_12I1PairP_check_5_3 : ∀ k l : Fin 6, contains (CA2_2_12I1PairRaw ((5,3),(k,l))) (CA2_2_12I1PairP ((5,3),(k,l))) = true := by + decide +kernel +lemma CA2_2_12I1PairP_check_5_4 : ∀ k l : Fin 6, contains (CA2_2_12I1PairRaw ((5,4),(k,l))) (CA2_2_12I1PairP ((5,4),(k,l))) = true := by + decide +kernel +lemma CA2_2_12I1PairP_check_5_5 : ∀ k l : Fin 6, contains (CA2_2_12I1PairRaw ((5,5),(k,l))) (CA2_2_12I1PairP ((5,5),(k,l))) = true := by + decide +kernel +lemma CA2_2_12I1PairP_check (a : PairSlot × PairSlot) : contains (CA2_2_12I1PairRaw a) (CA2_2_12I1PairP a) = true := by + rcases a with ⟨⟨i,j⟩,⟨k,l⟩⟩ + revert j i + apply forall_fin6 + · exact forall_fin6 (CA2_2_12I1PairP_check_0_0 k l) (CA2_2_12I1PairP_check_0_1 k l) (CA2_2_12I1PairP_check_0_2 k l) (CA2_2_12I1PairP_check_0_3 k l) (CA2_2_12I1PairP_check_0_4 k l) (CA2_2_12I1PairP_check_0_5 k l) + · exact forall_fin6 (CA2_2_12I1PairP_check_1_0 k l) (CA2_2_12I1PairP_check_1_1 k l) (CA2_2_12I1PairP_check_1_2 k l) (CA2_2_12I1PairP_check_1_3 k l) (CA2_2_12I1PairP_check_1_4 k l) (CA2_2_12I1PairP_check_1_5 k l) + · exact forall_fin6 (CA2_2_12I1PairP_check_2_0 k l) (CA2_2_12I1PairP_check_2_1 k l) (CA2_2_12I1PairP_check_2_2 k l) (CA2_2_12I1PairP_check_2_3 k l) (CA2_2_12I1PairP_check_2_4 k l) (CA2_2_12I1PairP_check_2_5 k l) + · exact forall_fin6 (CA2_2_12I1PairP_check_3_0 k l) (CA2_2_12I1PairP_check_3_1 k l) (CA2_2_12I1PairP_check_3_2 k l) (CA2_2_12I1PairP_check_3_3 k l) (CA2_2_12I1PairP_check_3_4 k l) (CA2_2_12I1PairP_check_3_5 k l) + · exact forall_fin6 (CA2_2_12I1PairP_check_4_0 k l) (CA2_2_12I1PairP_check_4_1 k l) (CA2_2_12I1PairP_check_4_2 k l) (CA2_2_12I1PairP_check_4_3 k l) (CA2_2_12I1PairP_check_4_4 k l) (CA2_2_12I1PairP_check_4_5 k l) + · exact forall_fin6 (CA2_2_12I1PairP_check_5_0 k l) (CA2_2_12I1PairP_check_5_1 k l) (CA2_2_12I1PairP_check_5_2 k l) (CA2_2_12I1PairP_check_5_3 k l) (CA2_2_12I1PairP_check_5_4 k l) (CA2_2_12I1PairP_check_5_5 k l) +lemma CA2_2_12I1PairP_sound (a : PairSlot × PairSlot) : + (CA2_2_12I1PairP a).Encloses (CA2_2_12I1PairValue a) := + contains_sound (CA2_2_12I1PairRaw_sound a) (CA2_2_12I1PairP_check a) +def CA2_2_12I1PairTerms (a : PairSlot × PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_2_12I1PairCertificates (CA2_2_12I1PairCertificateIndex a)).output +lemma CA2_2_12I1PairTerms_sound (a : PairSlot × PairSlot) : + (CA2_2_12I1PairTerms a).Encloses (Foundation.entropyTerm (CA2_2_12I1PairValue a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_2_12I1PairCertificates_valid + (CA2_2_12I1PairCertificateIndex a) (CA2_2_12I1PairP_sound a) +def CA2_2_12I1PairEntropy : Ball := ⟨(56819327619563437864369567455811 / 25000000000000000000000000000000), (52335587181 / 50000000000000000000000000000000)⟩ +lemma CA2_2_12I1PairEntropy_sound : CA2_2_12I1PairEntropy.Encloses (Foundation.finiteEntropy CA2_2_12I1PairValue) := by + exact contains_sound (entropyDoublePair_enclosed CA2_2_12I1PairValue CA2_2_12I1PairTerms CA2_2_12I1PairTerms_sound) (by decide +kernel) +def CA2_2_12I1PairMass : Ball := ⟨(25000000000000000000000000000001 / 25000000000000000000000000000000), (243 / 50000000000000000000000000000000)⟩ +lemma CA2_2_12I1PairMass_sound : CA2_2_12I1PairMass.Encloses (∑ a, CA2_2_12I1PairValue a) := by + exact contains_sound (doublePairSumBall_sound CA2_2_12I1PairP CA2_2_12I1PairValue CA2_2_12I1PairP_sound) (by decide +kernel) +def CA2_2_12I1PairMassTermLogWitness : LogWitness := ⟨0, 25000000000000000000000000000001, 25000000000000000000000000000000⟩ +def CA2_2_12I1PairMassTermLog : Ball := ⟨(1 / 25000000000000000000000000000000), (2646978021 / 12500000000000000000000000000000)⟩ +lemma CA2_2_12I1PairMassTermLog_sound : CA2_2_12I1PairMassTermLog.Encloses (Real.log ((∑ a, CA2_2_12I1PairValue a))) := by + exact checkLog_sound logTwoBall_sound (CA2_2_12I1PairMass_sound) (w := CA2_2_12I1PairMassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA2_2_12I1PairMassTerm : Ball := ⟨(-1 / 25000000000000000000000000000000), (21175824169 / 100000000000000000000000000000000)⟩ +lemma CA2_2_12I1PairMassTerm_sound : CA2_2_12I1PairMassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_2_12I1PairValue a))) := by + exact contains_sound (entropyTerm_ball (CA2_2_12I1PairMass_sound) CA2_2_12I1PairMassTermLog_sound) (by decide +kernel) +def CA2_2_12I1PairH : Ball := ⟨(14204831904890859466092391863953 / 6250000000000000000000000000000), (125846998531 / 100000000000000000000000000000000)⟩ +lemma CA2_2_12I1PairH_sound : CA2_2_12I1PairH.Encloses (homogeneousEntropy CA2_2_12I1PairValue) := by + exact contains_sound (homogeneous_enclosed CA2_2_12I1PairValue CA2_2_12I1PairMassTerm_sound CA2_2_12I1PairEntropy_sound) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CA2_2_12I1R0Value (a : PairSlot) : ℝ := residualLaw (below (shape 2 2 12)) (fun u => (stageALaw (shape 2 2 12) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 0 a +def CA2_2_12I1R0Raw (a : PairSlot) : Ball := residualBall (below (shape 2 2 12)) A2_2_12Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 0 a +lemma CA2_2_12I1R0Raw_sound (a : PairSlot) : + (CA2_2_12I1R0Raw a).Encloses (CA2_2_12I1R0Value a) := by + exact residualBall_sound_on (below (shape 2 2 12)) A2_2_12Law (fun u => (stageALaw (shape 2 2 12) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A2_2_12Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 2 2 12) (show (shape 2 2 12) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 0 a +def CA2_2_12I1R0Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(3324258940959977818741615350511 / 12500000000000000000000000000000), (3 / 2500000000000000000000000000000)⟩ ⟨(17611682793149662795593791067173 / 50000000000000000000000000000000), (1689454137 / 10000000000000000000000000000000)⟩ ⟨(-132448186993999404944990127695899 / 100000000000000000000000000000000), (63527471499 / 100000000000000000000000000000000)⟩ ⟨-2, 3324258940959977818741615350511, 3125000000000000000000000000000⟩] +lemma CA2_2_12I1R0Certificates_valid : + CA2_2_12I1R0Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_2_12I1R0CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 0, 0 => 1 + | _, _ => 0 +def CA2_2_12I1R0P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_2_12I1R0Certificates (CA2_2_12I1R0CertificateIndex a)).input +lemma CA2_2_12I1R0P_check : ∀ a : PairSlot, contains (CA2_2_12I1R0Raw a) (CA2_2_12I1R0P a) = true := by + decide +kernel +lemma CA2_2_12I1R0P_sound (a : PairSlot) : + (CA2_2_12I1R0P a).Encloses (CA2_2_12I1R0Value a) := + contains_sound (CA2_2_12I1R0Raw_sound a) (CA2_2_12I1R0P_check a) +def CA2_2_12I1R0Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_2_12I1R0Certificates (CA2_2_12I1R0CertificateIndex a)).output +lemma CA2_2_12I1R0Terms_sound (a : PairSlot) : + (CA2_2_12I1R0Terms a).Encloses (Foundation.entropyTerm (CA2_2_12I1R0Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_2_12I1R0Certificates_valid + (CA2_2_12I1R0CertificateIndex a) (CA2_2_12I1R0P_sound a) +def CA2_2_12I1R0Entropy : Ball := ⟨(17611682793149662795593791067173 / 50000000000000000000000000000000), (1689454137 / 10000000000000000000000000000000)⟩ +lemma CA2_2_12I1R0Entropy_sound : CA2_2_12I1R0Entropy.Encloses (Foundation.finiteEntropy CA2_2_12I1R0Value) := by + exact contains_sound (entropyPair_enclosed CA2_2_12I1R0Value CA2_2_12I1R0Terms CA2_2_12I1R0Terms_sound) (by decide +kernel) +def CA2_2_12I1R0Mass : Ball := ⟨(3324258940959977818741615350511 / 12500000000000000000000000000000), (3 / 2500000000000000000000000000000)⟩ +lemma CA2_2_12I1R0Mass_sound : CA2_2_12I1R0Mass.Encloses (∑ a, CA2_2_12I1R0Value a) := by + exact contains_sound (pairSumBall_sound CA2_2_12I1R0P CA2_2_12I1R0Value CA2_2_12I1R0P_sound) (by decide +kernel) +def CA2_2_12I1R0MassTermLogWitness : LogWitness := ⟨-2, 3324258940959977818741615350511, 3125000000000000000000000000000⟩ +def CA2_2_12I1R0MassTermLog : Ball := ⟨(-132448186993999404944990127695899 / 100000000000000000000000000000000), (63527471499 / 100000000000000000000000000000000)⟩ +lemma CA2_2_12I1R0MassTermLog_sound : CA2_2_12I1R0MassTermLog.Encloses (Real.log ((∑ a, CA2_2_12I1R0Value a))) := by + exact checkLog_sound logTwoBall_sound (CA2_2_12I1R0Mass_sound) (w := CA2_2_12I1R0MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA2_2_12I1R0MassTerm : Ball := ⟨(17611682793149662795593791067173 / 50000000000000000000000000000000), (1689454137 / 10000000000000000000000000000000)⟩ +lemma CA2_2_12I1R0MassTerm_sound : CA2_2_12I1R0MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_2_12I1R0Value a))) := by + exact contains_sound (entropyTerm_ball (CA2_2_12I1R0Mass_sound) CA2_2_12I1R0MassTermLog_sound) (by decide +kernel) +def CA2_2_12I1R0H : Ball := ⟨0, (1689454137 / 5000000000000000000000000000000)⟩ +lemma CA2_2_12I1R0H_sound : CA2_2_12I1R0H.Encloses (homogeneousEntropy CA2_2_12I1R0Value) := by + exact contains_sound (homogeneous_enclosed CA2_2_12I1R0Value CA2_2_12I1R0MassTerm_sound CA2_2_12I1R0Entropy_sound) (by decide +kernel) +def CA2_2_12I1R1Value (a : PairSlot) : ℝ := residualLaw (below (shape 2 2 12)) (fun u => (stageALaw (shape 2 2 12) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 1 a +def CA2_2_12I1R1Raw (a : PairSlot) : Ball := residualBall (below (shape 2 2 12)) A2_2_12Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 1 a +lemma CA2_2_12I1R1Raw_sound (a : PairSlot) : + (CA2_2_12I1R1Raw a).Encloses (CA2_2_12I1R1Value a) := by + exact residualBall_sound_on (below (shape 2 2 12)) A2_2_12Law (fun u => (stageALaw (shape 2 2 12) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A2_2_12Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 2 2 12) (show (shape 2 2 12) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 1 a +def CA2_2_12I1R1Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(23405928472320177450067077195913 / 100000000000000000000000000000000), (79 / 100000000000000000000000000000000)⟩ ⟨(16994820460645649627923063019079 / 50000000000000000000000000000000), (19825592773 / 100000000000000000000000000000000)⟩ ⟨(-9076130263719138315271702977999 / 6250000000000000000000000000000), (84703295069 / 100000000000000000000000000000000)⟩ ⟨-3, 23405928472320177450067077195913, 12500000000000000000000000000000⟩] +lemma CA2_2_12I1R1Certificates_valid : + CA2_2_12I1R1Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_2_12I1R1CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 1, 0 => 1 + | 0, 1 => 1 + | _, _ => 0 +def CA2_2_12I1R1P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_2_12I1R1Certificates (CA2_2_12I1R1CertificateIndex a)).input +lemma CA2_2_12I1R1P_check : ∀ a : PairSlot, contains (CA2_2_12I1R1Raw a) (CA2_2_12I1R1P a) = true := by + decide +kernel +lemma CA2_2_12I1R1P_sound (a : PairSlot) : + (CA2_2_12I1R1P a).Encloses (CA2_2_12I1R1Value a) := + contains_sound (CA2_2_12I1R1Raw_sound a) (CA2_2_12I1R1P_check a) +def CA2_2_12I1R1Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_2_12I1R1Certificates (CA2_2_12I1R1CertificateIndex a)).output +lemma CA2_2_12I1R1Terms_sound (a : PairSlot) : + (CA2_2_12I1R1Terms a).Encloses (Foundation.entropyTerm (CA2_2_12I1R1Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_2_12I1R1Certificates_valid + (CA2_2_12I1R1CertificateIndex a) (CA2_2_12I1R1P_sound a) +def CA2_2_12I1R1Entropy : Ball := ⟨(16994820460645649627923063019079 / 25000000000000000000000000000000), (19825592773 / 50000000000000000000000000000000)⟩ +lemma CA2_2_12I1R1Entropy_sound : CA2_2_12I1R1Entropy.Encloses (Foundation.finiteEntropy CA2_2_12I1R1Value) := by + exact contains_sound (entropyPair_enclosed CA2_2_12I1R1Value CA2_2_12I1R1Terms CA2_2_12I1R1Terms_sound) (by decide +kernel) +def CA2_2_12I1R1Mass : Ball := ⟨(23405928472320177450067077195913 / 50000000000000000000000000000000), (79 / 50000000000000000000000000000000)⟩ +lemma CA2_2_12I1R1Mass_sound : CA2_2_12I1R1Mass.Encloses (∑ a, CA2_2_12I1R1Value a) := by + exact contains_sound (pairSumBall_sound CA2_2_12I1R1P CA2_2_12I1R1Value CA2_2_12I1R1P_sound) (by decide +kernel) +def CA2_2_12I1R1MassTermLogWitness : LogWitness := ⟨-2, 23405928472320177450067077195913, 12500000000000000000000000000000⟩ +def CA2_2_12I1R1MassTermLog : Ball := ⟨(-37951683081755841051312027298827 / 50000000000000000000000000000000), (31763735693 / 50000000000000000000000000000000)⟩ +lemma CA2_2_12I1R1MassTermLog_sound : CA2_2_12I1R1MassTermLog.Encloses (Real.log ((∑ a, CA2_2_12I1R1Value a))) := by + exact checkLog_sound logTwoBall_sound (CA2_2_12I1R1Mass_sound) (w := CA2_2_12I1R1MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA2_2_12I1R1MassTerm : Ball := ⟨(7106355036925928135440648095211 / 20000000000000000000000000000000), (14869194573 / 50000000000000000000000000000000)⟩ +lemma CA2_2_12I1R1MassTerm_sound : CA2_2_12I1R1MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_2_12I1R1Value a))) := by + exact contains_sound (entropyTerm_ball (CA2_2_12I1R1Mass_sound) CA2_2_12I1R1MassTermLog_sound) (by decide +kernel) +def CA2_2_12I1R1H : Ball := ⟨(32447506657952957834489011600261 / 100000000000000000000000000000000), (17347393673 / 25000000000000000000000000000000)⟩ +lemma CA2_2_12I1R1H_sound : CA2_2_12I1R1H.Encloses (homogeneousEntropy CA2_2_12I1R1Value) := by + exact contains_sound (homogeneous_enclosed CA2_2_12I1R1Value CA2_2_12I1R1MassTerm_sound CA2_2_12I1R1Entropy_sound) (by decide +kernel) +def CA2_2_12I1R2Value (a : PairSlot) : ℝ := residualLaw (below (shape 2 2 12)) (fun u => (stageALaw (shape 2 2 12) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 2 a +def CA2_2_12I1R2Raw (a : PairSlot) : Ball := residualBall (below (shape 2 2 12)) A2_2_12Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 2 a +lemma CA2_2_12I1R2Raw_sound (a : PairSlot) : + (CA2_2_12I1R2Raw a).Encloses (CA2_2_12I1R2Value a) := by + exact residualBall_sound_on (below (shape 2 2 12)) A2_2_12Law (fun u => (stageALaw (shape 2 2 12) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A2_2_12Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 2 2 12) (show (shape 2 2 12) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 2 a +def CA2_2_12I1R2Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(302482925649111920125581269257 / 6250000000000000000000000000000), (33 / 100000000000000000000000000000000)⟩ ⟨(183202529322725425551350669373 / 1250000000000000000000000000000), (614911223 / 10000000000000000000000000000000)⟩ ⟨(-302831191098774837778472172403237 / 100000000000000000000000000000000), (127054942779 / 100000000000000000000000000000000)⟩ ⟨-5, 302482925649111920125581269257, 195312500000000000000000000000⟩, + .log ⟨(438298311601115271502955321633 / 100000000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ ⟨(2379971100514961686425459230633 / 100000000000000000000000000000000), (417659763 / 50000000000000000000000000000000)⟩ ⟨(-543002570970639744871677242332053 / 100000000000000000000000000000000), (190582414059 / 100000000000000000000000000000000)⟩ ⟨-8, 438298311601115271502955321633, 390625000000000000000000000000⟩, + .log ⟨(80190106418530052814542057723 / 500000000000000000000000000000), (83 / 100000000000000000000000000000000)⟩ ⟨(2935291409619310609458147751239 / 10000000000000000000000000000000), (13584732673 / 100000000000000000000000000000000)⟩ ⟨(-4575519881310809697685997306137 / 2500000000000000000000000000000), (84703295249 / 100000000000000000000000000000000)⟩ ⟨-3, 80190106418530052814542057723, 62500000000000000000000000000⟩] +lemma CA2_2_12I1R2Certificates_valid : + CA2_2_12I1R2Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_2_12I1R2CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 2, 0 => 1 + | 3, 0 => 2 + | 1, 1 => 3 + | 0, 2 => 1 + | 0, 3 => 2 + | _, _ => 0 +def CA2_2_12I1R2P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_2_12I1R2Certificates (CA2_2_12I1R2CertificateIndex a)).input +lemma CA2_2_12I1R2P_check : ∀ a : PairSlot, contains (CA2_2_12I1R2Raw a) (CA2_2_12I1R2P a) = true := by + decide +kernel +lemma CA2_2_12I1R2P_sound (a : PairSlot) : + (CA2_2_12I1R2P a).Encloses (CA2_2_12I1R2Value a) := + contains_sound (CA2_2_12I1R2Raw_sound a) (CA2_2_12I1R2P_check a) +def CA2_2_12I1R2Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_2_12I1R2Certificates (CA2_2_12I1R2CertificateIndex a)).output +lemma CA2_2_12I1R2Terms_sound (a : PairSlot) : + (CA2_2_12I1R2Terms a).Encloses (Foundation.entropyTerm (CA2_2_12I1R2Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_2_12I1R2Certificates_valid + (CA2_2_12I1R2CertificateIndex a) (CA2_2_12I1R2P_sound a) +def CA2_2_12I1R2Entropy : Ball := ⟨(7928157623607387194456062884167 / 12500000000000000000000000000000), (5510719237 / 20000000000000000000000000000000)⟩ +lemma CA2_2_12I1R2Entropy_sound : CA2_2_12I1R2Entropy.Encloses (Foundation.finiteEntropy CA2_2_12I1R2Value) := by + exact contains_sound (entropyPair_enclosed CA2_2_12I1R2Value CA2_2_12I1R2Terms CA2_2_12I1R2Terms_sound) (by decide +kernel) +def CA2_2_12I1R2Mass : Ball := ⟨(2659407152767982254993292280409 / 10000000000000000000000000000000), (157 / 100000000000000000000000000000000)⟩ +lemma CA2_2_12I1R2Mass_sound : CA2_2_12I1R2Mass.Encloses (∑ a, CA2_2_12I1R2Value a) := by + exact contains_sound (pairSumBall_sound CA2_2_12I1R2P CA2_2_12I1R2Value CA2_2_12I1R2P_sound) (by decide +kernel) +def CA2_2_12I1R2MassTermLogWitness : LogWitness := ⟨-2, 2659407152767982254993292280409, 2500000000000000000000000000000⟩ +def CA2_2_12I1R2MassTermLog : Ball := ⟨(-33112046748499851236247531923973 / 25000000000000000000000000000000), (63527471639 / 100000000000000000000000000000000)⟩ +lemma CA2_2_12I1R2MassTermLog_sound : CA2_2_12I1R2MassTermLog.Encloses (Real.log ((∑ a, CA2_2_12I1R2Value a))) := by + exact checkLog_sound logTwoBall_sound (CA2_2_12I1R2Mass_sound) (w := CA2_2_12I1R2MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA2_2_12I1R2MassTerm : Ball := ⟨(35223365586299325591187582134347 / 100000000000000000000000000000000), (1055908841 / 6250000000000000000000000000000)⟩ +lemma CA2_2_12I1R2MassTerm_sound : CA2_2_12I1R2MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_2_12I1R2Value a))) := by + exact contains_sound (entropyTerm_ball (CA2_2_12I1R2Mass_sound) CA2_2_12I1R2MassTermLog_sound) (by decide +kernel) +def CA2_2_12I1R2H : Ball := ⟨(28201895402559771964460920938989 / 100000000000000000000000000000000), (44448137641 / 100000000000000000000000000000000)⟩ +lemma CA2_2_12I1R2H_sound : CA2_2_12I1R2H.Encloses (homogeneousEntropy CA2_2_12I1R2Value) := by + exact contains_sound (homogeneous_enclosed CA2_2_12I1R2Value CA2_2_12I1R2MassTerm_sound CA2_2_12I1R2Entropy_sound) (by decide +kernel) +def CA2_2_12I1R3Value (a : PairSlot) : ℝ := residualLaw (below (shape 2 2 12)) (fun u => (stageALaw (shape 2 2 12) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 3 a +def CA2_2_12I1R3Raw (a : PairSlot) : Ball := residualBall (below (shape 2 2 12)) A2_2_12Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 3 a +lemma CA2_2_12I1R3Raw_sound (a : PairSlot) : + (CA2_2_12I1R3Raw a).Encloses (CA2_2_12I1R3Value a) := by + exact residualBall_sound_on (below (shape 2 2 12)) A2_2_12Law (fun u => (stageALaw (shape 2 2 12) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A2_2_12Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 2 2 12) (show (shape 2 2 12) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 3 a +def CA2_2_12I1R3Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA2_2_12I1R3Certificates_valid : + CA2_2_12I1R3Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_2_12I1R3CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA2_2_12I1R3P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_2_12I1R3Certificates (CA2_2_12I1R3CertificateIndex a)).input +lemma CA2_2_12I1R3P_check : ∀ a : PairSlot, contains (CA2_2_12I1R3Raw a) (CA2_2_12I1R3P a) = true := by + decide +kernel +lemma CA2_2_12I1R3P_sound (a : PairSlot) : + (CA2_2_12I1R3P a).Encloses (CA2_2_12I1R3Value a) := + contains_sound (CA2_2_12I1R3Raw_sound a) (CA2_2_12I1R3P_check a) +def CA2_2_12I1R3Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_2_12I1R3Certificates (CA2_2_12I1R3CertificateIndex a)).output +lemma CA2_2_12I1R3Terms_sound (a : PairSlot) : + (CA2_2_12I1R3Terms a).Encloses (Foundation.entropyTerm (CA2_2_12I1R3Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_2_12I1R3Certificates_valid + (CA2_2_12I1R3CertificateIndex a) (CA2_2_12I1R3P_sound a) +def CA2_2_12I1R3Entropy : Ball := ⟨0, 0⟩ +lemma CA2_2_12I1R3Entropy_sound : CA2_2_12I1R3Entropy.Encloses (Foundation.finiteEntropy CA2_2_12I1R3Value) := by + exact contains_sound (entropyPair_enclosed CA2_2_12I1R3Value CA2_2_12I1R3Terms CA2_2_12I1R3Terms_sound) (by decide +kernel) +def CA2_2_12I1R3Mass : Ball := ⟨0, 0⟩ +lemma CA2_2_12I1R3Mass_sound : CA2_2_12I1R3Mass.Encloses (∑ a, CA2_2_12I1R3Value a) := by + exact contains_sound (pairSumBall_sound CA2_2_12I1R3P CA2_2_12I1R3Value CA2_2_12I1R3P_sound) (by decide +kernel) +def CA2_2_12I1R3MassTerm : Ball := .exact 0 +lemma CA2_2_12I1R3MassTerm_sound : CA2_2_12I1R3MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_2_12I1R3Value a))) := + entropyTerm_zero_ball (CA2_2_12I1R3Mass_sound) +def CA2_2_12I1R3H : Ball := ⟨0, 0⟩ +lemma CA2_2_12I1R3H_sound : CA2_2_12I1R3H.Encloses (homogeneousEntropy CA2_2_12I1R3Value) := by + exact contains_sound (homogeneous_enclosed CA2_2_12I1R3Value CA2_2_12I1R3MassTerm_sound CA2_2_12I1R3Entropy_sound) (by decide +kernel) +def CA2_2_12I1R4Value (a : PairSlot) : ℝ := residualLaw (below (shape 2 2 12)) (fun u => (stageALaw (shape 2 2 12) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 4 a +def CA2_2_12I1R4Raw (a : PairSlot) : Ball := residualBall (below (shape 2 2 12)) A2_2_12Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 4 a +lemma CA2_2_12I1R4Raw_sound (a : PairSlot) : + (CA2_2_12I1R4Raw a).Encloses (CA2_2_12I1R4Value a) := by + exact residualBall_sound_on (below (shape 2 2 12)) A2_2_12Law (fun u => (stageALaw (shape 2 2 12) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A2_2_12Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 2 2 12) (show (shape 2 2 12) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 4 a +def CA2_2_12I1R4Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA2_2_12I1R4Certificates_valid : + CA2_2_12I1R4Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_2_12I1R4CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA2_2_12I1R4P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_2_12I1R4Certificates (CA2_2_12I1R4CertificateIndex a)).input +lemma CA2_2_12I1R4P_check : ∀ a : PairSlot, contains (CA2_2_12I1R4Raw a) (CA2_2_12I1R4P a) = true := by + decide +kernel +lemma CA2_2_12I1R4P_sound (a : PairSlot) : + (CA2_2_12I1R4P a).Encloses (CA2_2_12I1R4Value a) := + contains_sound (CA2_2_12I1R4Raw_sound a) (CA2_2_12I1R4P_check a) +def CA2_2_12I1R4Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_2_12I1R4Certificates (CA2_2_12I1R4CertificateIndex a)).output +lemma CA2_2_12I1R4Terms_sound (a : PairSlot) : + (CA2_2_12I1R4Terms a).Encloses (Foundation.entropyTerm (CA2_2_12I1R4Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_2_12I1R4Certificates_valid + (CA2_2_12I1R4CertificateIndex a) (CA2_2_12I1R4P_sound a) +def CA2_2_12I1R4Entropy : Ball := ⟨0, 0⟩ +lemma CA2_2_12I1R4Entropy_sound : CA2_2_12I1R4Entropy.Encloses (Foundation.finiteEntropy CA2_2_12I1R4Value) := by + exact contains_sound (entropyPair_enclosed CA2_2_12I1R4Value CA2_2_12I1R4Terms CA2_2_12I1R4Terms_sound) (by decide +kernel) +def CA2_2_12I1R4Mass : Ball := ⟨0, 0⟩ +lemma CA2_2_12I1R4Mass_sound : CA2_2_12I1R4Mass.Encloses (∑ a, CA2_2_12I1R4Value a) := by + exact contains_sound (pairSumBall_sound CA2_2_12I1R4P CA2_2_12I1R4Value CA2_2_12I1R4P_sound) (by decide +kernel) +def CA2_2_12I1R4MassTerm : Ball := .exact 0 +lemma CA2_2_12I1R4MassTerm_sound : CA2_2_12I1R4MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_2_12I1R4Value a))) := + entropyTerm_zero_ball (CA2_2_12I1R4Mass_sound) +def CA2_2_12I1R4H : Ball := ⟨0, 0⟩ +lemma CA2_2_12I1R4H_sound : CA2_2_12I1R4H.Encloses (homogeneousEntropy CA2_2_12I1R4Value) := by + exact contains_sound (homogeneous_enclosed CA2_2_12I1R4Value CA2_2_12I1R4MassTerm_sound CA2_2_12I1R4Entropy_sound) (by decide +kernel) +def CA2_2_12I1R5Value (a : PairSlot) : ℝ := residualLaw (below (shape 2 2 12)) (fun u => (stageALaw (shape 2 2 12) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 5 a +def CA2_2_12I1R5Raw (a : PairSlot) : Ball := residualBall (below (shape 2 2 12)) A2_2_12Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 5 a +lemma CA2_2_12I1R5Raw_sound (a : PairSlot) : + (CA2_2_12I1R5Raw a).Encloses (CA2_2_12I1R5Value a) := by + exact residualBall_sound_on (below (shape 2 2 12)) A2_2_12Law (fun u => (stageALaw (shape 2 2 12) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A2_2_12Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 2 2 12) (show (shape 2 2 12) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 5 a +def CA2_2_12I1R5Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA2_2_12I1R5Certificates_valid : + CA2_2_12I1R5Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_2_12I1R5CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA2_2_12I1R5P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_2_12I1R5Certificates (CA2_2_12I1R5CertificateIndex a)).input +lemma CA2_2_12I1R5P_check : ∀ a : PairSlot, contains (CA2_2_12I1R5Raw a) (CA2_2_12I1R5P a) = true := by + decide +kernel +lemma CA2_2_12I1R5P_sound (a : PairSlot) : + (CA2_2_12I1R5P a).Encloses (CA2_2_12I1R5Value a) := + contains_sound (CA2_2_12I1R5Raw_sound a) (CA2_2_12I1R5P_check a) +def CA2_2_12I1R5Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_2_12I1R5Certificates (CA2_2_12I1R5CertificateIndex a)).output +lemma CA2_2_12I1R5Terms_sound (a : PairSlot) : + (CA2_2_12I1R5Terms a).Encloses (Foundation.entropyTerm (CA2_2_12I1R5Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_2_12I1R5Certificates_valid + (CA2_2_12I1R5CertificateIndex a) (CA2_2_12I1R5P_sound a) +def CA2_2_12I1R5Entropy : Ball := ⟨0, 0⟩ +lemma CA2_2_12I1R5Entropy_sound : CA2_2_12I1R5Entropy.Encloses (Foundation.finiteEntropy CA2_2_12I1R5Value) := by + exact contains_sound (entropyPair_enclosed CA2_2_12I1R5Value CA2_2_12I1R5Terms CA2_2_12I1R5Terms_sound) (by decide +kernel) +def CA2_2_12I1R5Mass : Ball := ⟨0, 0⟩ +lemma CA2_2_12I1R5Mass_sound : CA2_2_12I1R5Mass.Encloses (∑ a, CA2_2_12I1R5Value a) := by + exact contains_sound (pairSumBall_sound CA2_2_12I1R5P CA2_2_12I1R5Value CA2_2_12I1R5P_sound) (by decide +kernel) +def CA2_2_12I1R5MassTerm : Ball := .exact 0 +lemma CA2_2_12I1R5MassTerm_sound : CA2_2_12I1R5MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_2_12I1R5Value a))) := + entropyTerm_zero_ball (CA2_2_12I1R5Mass_sound) +def CA2_2_12I1R5H : Ball := ⟨0, 0⟩ +lemma CA2_2_12I1R5H_sound : CA2_2_12I1R5H.Encloses (homogeneousEntropy CA2_2_12I1R5Value) := by + exact contains_sound (homogeneous_enclosed CA2_2_12I1R5Value CA2_2_12I1R5MassTerm_sound CA2_2_12I1R5Entropy_sound) (by decide +kernel) +def CA2_2_12I1R6Value (a : PairSlot) : ℝ := residualLaw (below (shape 2 2 12)) (fun u => (stageALaw (shape 2 2 12) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 6 a +def CA2_2_12I1R6Raw (a : PairSlot) : Ball := residualBall (below (shape 2 2 12)) A2_2_12Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 6 a +lemma CA2_2_12I1R6Raw_sound (a : PairSlot) : + (CA2_2_12I1R6Raw a).Encloses (CA2_2_12I1R6Value a) := by + exact residualBall_sound_on (below (shape 2 2 12)) A2_2_12Law (fun u => (stageALaw (shape 2 2 12) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A2_2_12Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 2 2 12) (show (shape 2 2 12) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 6 a +def CA2_2_12I1R6Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA2_2_12I1R6Certificates_valid : + CA2_2_12I1R6Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_2_12I1R6CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA2_2_12I1R6P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_2_12I1R6Certificates (CA2_2_12I1R6CertificateIndex a)).input +lemma CA2_2_12I1R6P_check : ∀ a : PairSlot, contains (CA2_2_12I1R6Raw a) (CA2_2_12I1R6P a) = true := by + decide +kernel +lemma CA2_2_12I1R6P_sound (a : PairSlot) : + (CA2_2_12I1R6P a).Encloses (CA2_2_12I1R6Value a) := + contains_sound (CA2_2_12I1R6Raw_sound a) (CA2_2_12I1R6P_check a) +def CA2_2_12I1R6Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_2_12I1R6Certificates (CA2_2_12I1R6CertificateIndex a)).output +lemma CA2_2_12I1R6Terms_sound (a : PairSlot) : + (CA2_2_12I1R6Terms a).Encloses (Foundation.entropyTerm (CA2_2_12I1R6Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_2_12I1R6Certificates_valid + (CA2_2_12I1R6CertificateIndex a) (CA2_2_12I1R6P_sound a) +def CA2_2_12I1R6Entropy : Ball := ⟨0, 0⟩ +lemma CA2_2_12I1R6Entropy_sound : CA2_2_12I1R6Entropy.Encloses (Foundation.finiteEntropy CA2_2_12I1R6Value) := by + exact contains_sound (entropyPair_enclosed CA2_2_12I1R6Value CA2_2_12I1R6Terms CA2_2_12I1R6Terms_sound) (by decide +kernel) +def CA2_2_12I1R6Mass : Ball := ⟨0, 0⟩ +lemma CA2_2_12I1R6Mass_sound : CA2_2_12I1R6Mass.Encloses (∑ a, CA2_2_12I1R6Value a) := by + exact contains_sound (pairSumBall_sound CA2_2_12I1R6P CA2_2_12I1R6Value CA2_2_12I1R6P_sound) (by decide +kernel) +def CA2_2_12I1R6MassTerm : Ball := .exact 0 +lemma CA2_2_12I1R6MassTerm_sound : CA2_2_12I1R6MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_2_12I1R6Value a))) := + entropyTerm_zero_ball (CA2_2_12I1R6Mass_sound) +def CA2_2_12I1R6H : Ball := ⟨0, 0⟩ +lemma CA2_2_12I1R6H_sound : CA2_2_12I1R6H.Encloses (homogeneousEntropy CA2_2_12I1R6Value) := by + exact contains_sound (homogeneous_enclosed CA2_2_12I1R6Value CA2_2_12I1R6MassTerm_sound CA2_2_12I1R6Entropy_sound) (by decide +kernel) +def CA2_2_12I1R7Value (a : PairSlot) : ℝ := residualLaw (below (shape 2 2 12)) (fun u => (stageALaw (shape 2 2 12) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 7 a +def CA2_2_12I1R7Raw (a : PairSlot) : Ball := residualBall (below (shape 2 2 12)) A2_2_12Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 7 a +lemma CA2_2_12I1R7Raw_sound (a : PairSlot) : + (CA2_2_12I1R7Raw a).Encloses (CA2_2_12I1R7Value a) := by + exact residualBall_sound_on (below (shape 2 2 12)) A2_2_12Law (fun u => (stageALaw (shape 2 2 12) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A2_2_12Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 2 2 12) (show (shape 2 2 12) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 7 a +def CA2_2_12I1R7Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA2_2_12I1R7Certificates_valid : + CA2_2_12I1R7Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_2_12I1R7CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA2_2_12I1R7P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_2_12I1R7Certificates (CA2_2_12I1R7CertificateIndex a)).input +lemma CA2_2_12I1R7P_check : ∀ a : PairSlot, contains (CA2_2_12I1R7Raw a) (CA2_2_12I1R7P a) = true := by + decide +kernel +lemma CA2_2_12I1R7P_sound (a : PairSlot) : + (CA2_2_12I1R7P a).Encloses (CA2_2_12I1R7Value a) := + contains_sound (CA2_2_12I1R7Raw_sound a) (CA2_2_12I1R7P_check a) +def CA2_2_12I1R7Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_2_12I1R7Certificates (CA2_2_12I1R7CertificateIndex a)).output +lemma CA2_2_12I1R7Terms_sound (a : PairSlot) : + (CA2_2_12I1R7Terms a).Encloses (Foundation.entropyTerm (CA2_2_12I1R7Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_2_12I1R7Certificates_valid + (CA2_2_12I1R7CertificateIndex a) (CA2_2_12I1R7P_sound a) +def CA2_2_12I1R7Entropy : Ball := ⟨0, 0⟩ +lemma CA2_2_12I1R7Entropy_sound : CA2_2_12I1R7Entropy.Encloses (Foundation.finiteEntropy CA2_2_12I1R7Value) := by + exact contains_sound (entropyPair_enclosed CA2_2_12I1R7Value CA2_2_12I1R7Terms CA2_2_12I1R7Terms_sound) (by decide +kernel) +def CA2_2_12I1R7Mass : Ball := ⟨0, 0⟩ +lemma CA2_2_12I1R7Mass_sound : CA2_2_12I1R7Mass.Encloses (∑ a, CA2_2_12I1R7Value a) := by + exact contains_sound (pairSumBall_sound CA2_2_12I1R7P CA2_2_12I1R7Value CA2_2_12I1R7P_sound) (by decide +kernel) +def CA2_2_12I1R7MassTerm : Ball := .exact 0 +lemma CA2_2_12I1R7MassTerm_sound : CA2_2_12I1R7MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_2_12I1R7Value a))) := + entropyTerm_zero_ball (CA2_2_12I1R7Mass_sound) +def CA2_2_12I1R7H : Ball := ⟨0, 0⟩ +lemma CA2_2_12I1R7H_sound : CA2_2_12I1R7H.Encloses (homogeneousEntropy CA2_2_12I1R7Value) := by + exact contains_sound (homogeneous_enclosed CA2_2_12I1R7Value CA2_2_12I1R7MassTerm_sound CA2_2_12I1R7Entropy_sound) (by decide +kernel) +def CA2_2_12I1R8Value (a : PairSlot) : ℝ := residualLaw (below (shape 2 2 12)) (fun u => (stageALaw (shape 2 2 12) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 8 a +def CA2_2_12I1R8Raw (a : PairSlot) : Ball := residualBall (below (shape 2 2 12)) A2_2_12Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 8 a +lemma CA2_2_12I1R8Raw_sound (a : PairSlot) : + (CA2_2_12I1R8Raw a).Encloses (CA2_2_12I1R8Value a) := by + exact residualBall_sound_on (below (shape 2 2 12)) A2_2_12Law (fun u => (stageALaw (shape 2 2 12) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A2_2_12Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 2 2 12) (show (shape 2 2 12) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 8 a +def CA2_2_12I1R8Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA2_2_12I1R8Certificates_valid : + CA2_2_12I1R8Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_2_12I1R8CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA2_2_12I1R8P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_2_12I1R8Certificates (CA2_2_12I1R8CertificateIndex a)).input +lemma CA2_2_12I1R8P_check : ∀ a : PairSlot, contains (CA2_2_12I1R8Raw a) (CA2_2_12I1R8P a) = true := by + decide +kernel +lemma CA2_2_12I1R8P_sound (a : PairSlot) : + (CA2_2_12I1R8P a).Encloses (CA2_2_12I1R8Value a) := + contains_sound (CA2_2_12I1R8Raw_sound a) (CA2_2_12I1R8P_check a) +def CA2_2_12I1R8Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_2_12I1R8Certificates (CA2_2_12I1R8CertificateIndex a)).output +lemma CA2_2_12I1R8Terms_sound (a : PairSlot) : + (CA2_2_12I1R8Terms a).Encloses (Foundation.entropyTerm (CA2_2_12I1R8Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_2_12I1R8Certificates_valid + (CA2_2_12I1R8CertificateIndex a) (CA2_2_12I1R8P_sound a) +def CA2_2_12I1R8Entropy : Ball := ⟨0, 0⟩ +lemma CA2_2_12I1R8Entropy_sound : CA2_2_12I1R8Entropy.Encloses (Foundation.finiteEntropy CA2_2_12I1R8Value) := by + exact contains_sound (entropyPair_enclosed CA2_2_12I1R8Value CA2_2_12I1R8Terms CA2_2_12I1R8Terms_sound) (by decide +kernel) +def CA2_2_12I1R8Mass : Ball := ⟨0, 0⟩ +lemma CA2_2_12I1R8Mass_sound : CA2_2_12I1R8Mass.Encloses (∑ a, CA2_2_12I1R8Value a) := by + exact contains_sound (pairSumBall_sound CA2_2_12I1R8P CA2_2_12I1R8Value CA2_2_12I1R8P_sound) (by decide +kernel) +def CA2_2_12I1R8MassTerm : Ball := .exact 0 +lemma CA2_2_12I1R8MassTerm_sound : CA2_2_12I1R8MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_2_12I1R8Value a))) := + entropyTerm_zero_ball (CA2_2_12I1R8Mass_sound) +def CA2_2_12I1R8H : Ball := ⟨0, 0⟩ +lemma CA2_2_12I1R8H_sound : CA2_2_12I1R8H.Encloses (homogeneousEntropy CA2_2_12I1R8Value) := by + exact contains_sound (homogeneous_enclosed CA2_2_12I1R8Value CA2_2_12I1R8MassTerm_sound CA2_2_12I1R8Entropy_sound) (by decide +kernel) +def CA2_2_12I1R9Value (a : PairSlot) : ℝ := residualLaw (below (shape 2 2 12)) (fun u => (stageALaw (shape 2 2 12) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 9 a +def CA2_2_12I1R9Raw (a : PairSlot) : Ball := residualBall (below (shape 2 2 12)) A2_2_12Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 9 a +lemma CA2_2_12I1R9Raw_sound (a : PairSlot) : + (CA2_2_12I1R9Raw a).Encloses (CA2_2_12I1R9Value a) := by + exact residualBall_sound_on (below (shape 2 2 12)) A2_2_12Law (fun u => (stageALaw (shape 2 2 12) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A2_2_12Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 2 2 12) (show (shape 2 2 12) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 9 a +def CA2_2_12I1R9Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA2_2_12I1R9Certificates_valid : + CA2_2_12I1R9Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_2_12I1R9CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA2_2_12I1R9P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_2_12I1R9Certificates (CA2_2_12I1R9CertificateIndex a)).input +lemma CA2_2_12I1R9P_check : ∀ a : PairSlot, contains (CA2_2_12I1R9Raw a) (CA2_2_12I1R9P a) = true := by + decide +kernel +lemma CA2_2_12I1R9P_sound (a : PairSlot) : + (CA2_2_12I1R9P a).Encloses (CA2_2_12I1R9Value a) := + contains_sound (CA2_2_12I1R9Raw_sound a) (CA2_2_12I1R9P_check a) +def CA2_2_12I1R9Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_2_12I1R9Certificates (CA2_2_12I1R9CertificateIndex a)).output +lemma CA2_2_12I1R9Terms_sound (a : PairSlot) : + (CA2_2_12I1R9Terms a).Encloses (Foundation.entropyTerm (CA2_2_12I1R9Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_2_12I1R9Certificates_valid + (CA2_2_12I1R9CertificateIndex a) (CA2_2_12I1R9P_sound a) +def CA2_2_12I1R9Entropy : Ball := ⟨0, 0⟩ +lemma CA2_2_12I1R9Entropy_sound : CA2_2_12I1R9Entropy.Encloses (Foundation.finiteEntropy CA2_2_12I1R9Value) := by + exact contains_sound (entropyPair_enclosed CA2_2_12I1R9Value CA2_2_12I1R9Terms CA2_2_12I1R9Terms_sound) (by decide +kernel) +def CA2_2_12I1R9Mass : Ball := ⟨0, 0⟩ +lemma CA2_2_12I1R9Mass_sound : CA2_2_12I1R9Mass.Encloses (∑ a, CA2_2_12I1R9Value a) := by + exact contains_sound (pairSumBall_sound CA2_2_12I1R9P CA2_2_12I1R9Value CA2_2_12I1R9P_sound) (by decide +kernel) +def CA2_2_12I1R9MassTerm : Ball := .exact 0 +lemma CA2_2_12I1R9MassTerm_sound : CA2_2_12I1R9MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_2_12I1R9Value a))) := + entropyTerm_zero_ball (CA2_2_12I1R9Mass_sound) +def CA2_2_12I1R9H : Ball := ⟨0, 0⟩ +lemma CA2_2_12I1R9H_sound : CA2_2_12I1R9H.Encloses (homogeneousEntropy CA2_2_12I1R9Value) := by + exact contains_sound (homogeneous_enclosed CA2_2_12I1R9Value CA2_2_12I1R9MassTerm_sound CA2_2_12I1R9Entropy_sound) (by decide +kernel) +def CA2_2_12I1R10Value (a : PairSlot) : ℝ := residualLaw (below (shape 2 2 12)) (fun u => (stageALaw (shape 2 2 12) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 10 a +def CA2_2_12I1R10Raw (a : PairSlot) : Ball := residualBall (below (shape 2 2 12)) A2_2_12Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 10 a +lemma CA2_2_12I1R10Raw_sound (a : PairSlot) : + (CA2_2_12I1R10Raw a).Encloses (CA2_2_12I1R10Value a) := by + exact residualBall_sound_on (below (shape 2 2 12)) A2_2_12Law (fun u => (stageALaw (shape 2 2 12) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A2_2_12Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 2 2 12) (show (shape 2 2 12) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 10 a +def CA2_2_12I1R10Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA2_2_12I1R10Certificates_valid : + CA2_2_12I1R10Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_2_12I1R10CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA2_2_12I1R10P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_2_12I1R10Certificates (CA2_2_12I1R10CertificateIndex a)).input +lemma CA2_2_12I1R10P_check : ∀ a : PairSlot, contains (CA2_2_12I1R10Raw a) (CA2_2_12I1R10P a) = true := by + decide +kernel +lemma CA2_2_12I1R10P_sound (a : PairSlot) : + (CA2_2_12I1R10P a).Encloses (CA2_2_12I1R10Value a) := + contains_sound (CA2_2_12I1R10Raw_sound a) (CA2_2_12I1R10P_check a) +def CA2_2_12I1R10Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_2_12I1R10Certificates (CA2_2_12I1R10CertificateIndex a)).output +lemma CA2_2_12I1R10Terms_sound (a : PairSlot) : + (CA2_2_12I1R10Terms a).Encloses (Foundation.entropyTerm (CA2_2_12I1R10Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_2_12I1R10Certificates_valid + (CA2_2_12I1R10CertificateIndex a) (CA2_2_12I1R10P_sound a) +def CA2_2_12I1R10Entropy : Ball := ⟨0, 0⟩ +lemma CA2_2_12I1R10Entropy_sound : CA2_2_12I1R10Entropy.Encloses (Foundation.finiteEntropy CA2_2_12I1R10Value) := by + exact contains_sound (entropyPair_enclosed CA2_2_12I1R10Value CA2_2_12I1R10Terms CA2_2_12I1R10Terms_sound) (by decide +kernel) +def CA2_2_12I1R10Mass : Ball := ⟨0, 0⟩ +lemma CA2_2_12I1R10Mass_sound : CA2_2_12I1R10Mass.Encloses (∑ a, CA2_2_12I1R10Value a) := by + exact contains_sound (pairSumBall_sound CA2_2_12I1R10P CA2_2_12I1R10Value CA2_2_12I1R10P_sound) (by decide +kernel) +def CA2_2_12I1R10MassTerm : Ball := .exact 0 +lemma CA2_2_12I1R10MassTerm_sound : CA2_2_12I1R10MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_2_12I1R10Value a))) := + entropyTerm_zero_ball (CA2_2_12I1R10Mass_sound) +def CA2_2_12I1R10H : Ball := ⟨0, 0⟩ +lemma CA2_2_12I1R10H_sound : CA2_2_12I1R10H.Encloses (homogeneousEntropy CA2_2_12I1R10Value) := by + exact contains_sound (homogeneous_enclosed CA2_2_12I1R10Value CA2_2_12I1R10MassTerm_sound CA2_2_12I1R10Entropy_sound) (by decide +kernel) +def CA2_2_12I1R11Value (a : PairSlot) : ℝ := residualLaw (below (shape 2 2 12)) (fun u => (stageALaw (shape 2 2 12) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 11 a +def CA2_2_12I1R11Raw (a : PairSlot) : Ball := residualBall (below (shape 2 2 12)) A2_2_12Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 11 a +lemma CA2_2_12I1R11Raw_sound (a : PairSlot) : + (CA2_2_12I1R11Raw a).Encloses (CA2_2_12I1R11Value a) := by + exact residualBall_sound_on (below (shape 2 2 12)) A2_2_12Law (fun u => (stageALaw (shape 2 2 12) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A2_2_12Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 2 2 12) (show (shape 2 2 12) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 11 a +def CA2_2_12I1R11Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA2_2_12I1R11Certificates_valid : + CA2_2_12I1R11Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_2_12I1R11CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA2_2_12I1R11P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_2_12I1R11Certificates (CA2_2_12I1R11CertificateIndex a)).input +lemma CA2_2_12I1R11P_check : ∀ a : PairSlot, contains (CA2_2_12I1R11Raw a) (CA2_2_12I1R11P a) = true := by + decide +kernel +lemma CA2_2_12I1R11P_sound (a : PairSlot) : + (CA2_2_12I1R11P a).Encloses (CA2_2_12I1R11Value a) := + contains_sound (CA2_2_12I1R11Raw_sound a) (CA2_2_12I1R11P_check a) +def CA2_2_12I1R11Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_2_12I1R11Certificates (CA2_2_12I1R11CertificateIndex a)).output +lemma CA2_2_12I1R11Terms_sound (a : PairSlot) : + (CA2_2_12I1R11Terms a).Encloses (Foundation.entropyTerm (CA2_2_12I1R11Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_2_12I1R11Certificates_valid + (CA2_2_12I1R11CertificateIndex a) (CA2_2_12I1R11P_sound a) +def CA2_2_12I1R11Entropy : Ball := ⟨0, 0⟩ +lemma CA2_2_12I1R11Entropy_sound : CA2_2_12I1R11Entropy.Encloses (Foundation.finiteEntropy CA2_2_12I1R11Value) := by + exact contains_sound (entropyPair_enclosed CA2_2_12I1R11Value CA2_2_12I1R11Terms CA2_2_12I1R11Terms_sound) (by decide +kernel) +def CA2_2_12I1R11Mass : Ball := ⟨0, 0⟩ +lemma CA2_2_12I1R11Mass_sound : CA2_2_12I1R11Mass.Encloses (∑ a, CA2_2_12I1R11Value a) := by + exact contains_sound (pairSumBall_sound CA2_2_12I1R11P CA2_2_12I1R11Value CA2_2_12I1R11P_sound) (by decide +kernel) +def CA2_2_12I1R11MassTerm : Ball := .exact 0 +lemma CA2_2_12I1R11MassTerm_sound : CA2_2_12I1R11MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_2_12I1R11Value a))) := + entropyTerm_zero_ball (CA2_2_12I1R11Mass_sound) +def CA2_2_12I1R11H : Ball := ⟨0, 0⟩ +lemma CA2_2_12I1R11H_sound : CA2_2_12I1R11H.Encloses (homogeneousEntropy CA2_2_12I1R11Value) := by + exact contains_sound (homogeneous_enclosed CA2_2_12I1R11Value CA2_2_12I1R11MassTerm_sound CA2_2_12I1R11Entropy_sound) (by decide +kernel) +def CA2_2_12I1R12Value (a : PairSlot) : ℝ := residualLaw (below (shape 2 2 12)) (fun u => (stageALaw (shape 2 2 12) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 12 a +def CA2_2_12I1R12Raw (a : PairSlot) : Ball := residualBall (below (shape 2 2 12)) A2_2_12Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 12 a +lemma CA2_2_12I1R12Raw_sound (a : PairSlot) : + (CA2_2_12I1R12Raw a).Encloses (CA2_2_12I1R12Value a) := by + exact residualBall_sound_on (below (shape 2 2 12)) A2_2_12Law (fun u => (stageALaw (shape 2 2 12) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A2_2_12Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 2 2 12) (show (shape 2 2 12) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 12 a +def CA2_2_12I1R12Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA2_2_12I1R12Certificates_valid : + CA2_2_12I1R12Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_2_12I1R12CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA2_2_12I1R12P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_2_12I1R12Certificates (CA2_2_12I1R12CertificateIndex a)).input +lemma CA2_2_12I1R12P_check : ∀ a : PairSlot, contains (CA2_2_12I1R12Raw a) (CA2_2_12I1R12P a) = true := by + decide +kernel +lemma CA2_2_12I1R12P_sound (a : PairSlot) : + (CA2_2_12I1R12P a).Encloses (CA2_2_12I1R12Value a) := + contains_sound (CA2_2_12I1R12Raw_sound a) (CA2_2_12I1R12P_check a) +def CA2_2_12I1R12Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_2_12I1R12Certificates (CA2_2_12I1R12CertificateIndex a)).output +lemma CA2_2_12I1R12Terms_sound (a : PairSlot) : + (CA2_2_12I1R12Terms a).Encloses (Foundation.entropyTerm (CA2_2_12I1R12Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_2_12I1R12Certificates_valid + (CA2_2_12I1R12CertificateIndex a) (CA2_2_12I1R12P_sound a) +def CA2_2_12I1R12Entropy : Ball := ⟨0, 0⟩ +lemma CA2_2_12I1R12Entropy_sound : CA2_2_12I1R12Entropy.Encloses (Foundation.finiteEntropy CA2_2_12I1R12Value) := by + exact contains_sound (entropyPair_enclosed CA2_2_12I1R12Value CA2_2_12I1R12Terms CA2_2_12I1R12Terms_sound) (by decide +kernel) +def CA2_2_12I1R12Mass : Ball := ⟨0, 0⟩ +lemma CA2_2_12I1R12Mass_sound : CA2_2_12I1R12Mass.Encloses (∑ a, CA2_2_12I1R12Value a) := by + exact contains_sound (pairSumBall_sound CA2_2_12I1R12P CA2_2_12I1R12Value CA2_2_12I1R12P_sound) (by decide +kernel) +def CA2_2_12I1R12MassTerm : Ball := .exact 0 +lemma CA2_2_12I1R12MassTerm_sound : CA2_2_12I1R12MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_2_12I1R12Value a))) := + entropyTerm_zero_ball (CA2_2_12I1R12Mass_sound) +def CA2_2_12I1R12H : Ball := ⟨0, 0⟩ +lemma CA2_2_12I1R12H_sound : CA2_2_12I1R12H.Encloses (homogeneousEntropy CA2_2_12I1R12Value) := by + exact contains_sound (homogeneous_enclosed CA2_2_12I1R12Value CA2_2_12I1R12MassTerm_sound CA2_2_12I1R12Entropy_sound) (by decide +kernel) +def CA2_2_12I1R13Value (a : PairSlot) : ℝ := residualLaw (below (shape 2 2 12)) (fun u => (stageALaw (shape 2 2 12) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 13 a +def CA2_2_12I1R13Raw (a : PairSlot) : Ball := residualBall (below (shape 2 2 12)) A2_2_12Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 13 a +lemma CA2_2_12I1R13Raw_sound (a : PairSlot) : + (CA2_2_12I1R13Raw a).Encloses (CA2_2_12I1R13Value a) := by + exact residualBall_sound_on (below (shape 2 2 12)) A2_2_12Law (fun u => (stageALaw (shape 2 2 12) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A2_2_12Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 2 2 12) (show (shape 2 2 12) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 13 a +def CA2_2_12I1R13Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA2_2_12I1R13Certificates_valid : + CA2_2_12I1R13Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_2_12I1R13CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA2_2_12I1R13P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_2_12I1R13Certificates (CA2_2_12I1R13CertificateIndex a)).input +lemma CA2_2_12I1R13P_check : ∀ a : PairSlot, contains (CA2_2_12I1R13Raw a) (CA2_2_12I1R13P a) = true := by + decide +kernel +lemma CA2_2_12I1R13P_sound (a : PairSlot) : + (CA2_2_12I1R13P a).Encloses (CA2_2_12I1R13Value a) := + contains_sound (CA2_2_12I1R13Raw_sound a) (CA2_2_12I1R13P_check a) +def CA2_2_12I1R13Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_2_12I1R13Certificates (CA2_2_12I1R13CertificateIndex a)).output +lemma CA2_2_12I1R13Terms_sound (a : PairSlot) : + (CA2_2_12I1R13Terms a).Encloses (Foundation.entropyTerm (CA2_2_12I1R13Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_2_12I1R13Certificates_valid + (CA2_2_12I1R13CertificateIndex a) (CA2_2_12I1R13P_sound a) +def CA2_2_12I1R13Entropy : Ball := ⟨0, 0⟩ +lemma CA2_2_12I1R13Entropy_sound : CA2_2_12I1R13Entropy.Encloses (Foundation.finiteEntropy CA2_2_12I1R13Value) := by + exact contains_sound (entropyPair_enclosed CA2_2_12I1R13Value CA2_2_12I1R13Terms CA2_2_12I1R13Terms_sound) (by decide +kernel) +def CA2_2_12I1R13Mass : Ball := ⟨0, 0⟩ +lemma CA2_2_12I1R13Mass_sound : CA2_2_12I1R13Mass.Encloses (∑ a, CA2_2_12I1R13Value a) := by + exact contains_sound (pairSumBall_sound CA2_2_12I1R13P CA2_2_12I1R13Value CA2_2_12I1R13P_sound) (by decide +kernel) +def CA2_2_12I1R13MassTerm : Ball := .exact 0 +lemma CA2_2_12I1R13MassTerm_sound : CA2_2_12I1R13MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_2_12I1R13Value a))) := + entropyTerm_zero_ball (CA2_2_12I1R13Mass_sound) +def CA2_2_12I1R13H : Ball := ⟨0, 0⟩ +lemma CA2_2_12I1R13H_sound : CA2_2_12I1R13H.Encloses (homogeneousEntropy CA2_2_12I1R13Value) := by + exact contains_sound (homogeneous_enclosed CA2_2_12I1R13Value CA2_2_12I1R13MassTerm_sound CA2_2_12I1R13Entropy_sound) (by decide +kernel) +def CA2_2_12I1R14Value (a : PairSlot) : ℝ := residualLaw (below (shape 2 2 12)) (fun u => (stageALaw (shape 2 2 12) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 14 a +def CA2_2_12I1R14Raw (a : PairSlot) : Ball := residualBall (below (shape 2 2 12)) A2_2_12Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 14 a +lemma CA2_2_12I1R14Raw_sound (a : PairSlot) : + (CA2_2_12I1R14Raw a).Encloses (CA2_2_12I1R14Value a) := by + exact residualBall_sound_on (below (shape 2 2 12)) A2_2_12Law (fun u => (stageALaw (shape 2 2 12) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A2_2_12Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 2 2 12) (show (shape 2 2 12) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 14 a +def CA2_2_12I1R14Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA2_2_12I1R14Certificates_valid : + CA2_2_12I1R14Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_2_12I1R14CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA2_2_12I1R14P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_2_12I1R14Certificates (CA2_2_12I1R14CertificateIndex a)).input +lemma CA2_2_12I1R14P_check : ∀ a : PairSlot, contains (CA2_2_12I1R14Raw a) (CA2_2_12I1R14P a) = true := by + decide +kernel +lemma CA2_2_12I1R14P_sound (a : PairSlot) : + (CA2_2_12I1R14P a).Encloses (CA2_2_12I1R14Value a) := + contains_sound (CA2_2_12I1R14Raw_sound a) (CA2_2_12I1R14P_check a) +def CA2_2_12I1R14Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_2_12I1R14Certificates (CA2_2_12I1R14CertificateIndex a)).output +lemma CA2_2_12I1R14Terms_sound (a : PairSlot) : + (CA2_2_12I1R14Terms a).Encloses (Foundation.entropyTerm (CA2_2_12I1R14Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_2_12I1R14Certificates_valid + (CA2_2_12I1R14CertificateIndex a) (CA2_2_12I1R14P_sound a) +def CA2_2_12I1R14Entropy : Ball := ⟨0, 0⟩ +lemma CA2_2_12I1R14Entropy_sound : CA2_2_12I1R14Entropy.Encloses (Foundation.finiteEntropy CA2_2_12I1R14Value) := by + exact contains_sound (entropyPair_enclosed CA2_2_12I1R14Value CA2_2_12I1R14Terms CA2_2_12I1R14Terms_sound) (by decide +kernel) +def CA2_2_12I1R14Mass : Ball := ⟨0, 0⟩ +lemma CA2_2_12I1R14Mass_sound : CA2_2_12I1R14Mass.Encloses (∑ a, CA2_2_12I1R14Value a) := by + exact contains_sound (pairSumBall_sound CA2_2_12I1R14P CA2_2_12I1R14Value CA2_2_12I1R14P_sound) (by decide +kernel) +def CA2_2_12I1R14MassTerm : Ball := .exact 0 +lemma CA2_2_12I1R14MassTerm_sound : CA2_2_12I1R14MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_2_12I1R14Value a))) := + entropyTerm_zero_ball (CA2_2_12I1R14Mass_sound) +def CA2_2_12I1R14H : Ball := ⟨0, 0⟩ +lemma CA2_2_12I1R14H_sound : CA2_2_12I1R14H.Encloses (homogeneousEntropy CA2_2_12I1R14Value) := by + exact contains_sound (homogeneous_enclosed CA2_2_12I1R14Value CA2_2_12I1R14MassTerm_sound CA2_2_12I1R14Entropy_sound) (by decide +kernel) +def CA2_2_12I1R15Value (a : PairSlot) : ℝ := residualLaw (below (shape 2 2 12)) (fun u => (stageALaw (shape 2 2 12) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 15 a +def CA2_2_12I1R15Raw (a : PairSlot) : Ball := residualBall (below (shape 2 2 12)) A2_2_12Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 15 a +lemma CA2_2_12I1R15Raw_sound (a : PairSlot) : + (CA2_2_12I1R15Raw a).Encloses (CA2_2_12I1R15Value a) := by + exact residualBall_sound_on (below (shape 2 2 12)) A2_2_12Law (fun u => (stageALaw (shape 2 2 12) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A2_2_12Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 2 2 12) (show (shape 2 2 12) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 15 a +def CA2_2_12I1R15Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA2_2_12I1R15Certificates_valid : + CA2_2_12I1R15Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_2_12I1R15CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA2_2_12I1R15P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_2_12I1R15Certificates (CA2_2_12I1R15CertificateIndex a)).input +lemma CA2_2_12I1R15P_check : ∀ a : PairSlot, contains (CA2_2_12I1R15Raw a) (CA2_2_12I1R15P a) = true := by + decide +kernel +lemma CA2_2_12I1R15P_sound (a : PairSlot) : + (CA2_2_12I1R15P a).Encloses (CA2_2_12I1R15Value a) := + contains_sound (CA2_2_12I1R15Raw_sound a) (CA2_2_12I1R15P_check a) +def CA2_2_12I1R15Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_2_12I1R15Certificates (CA2_2_12I1R15CertificateIndex a)).output +lemma CA2_2_12I1R15Terms_sound (a : PairSlot) : + (CA2_2_12I1R15Terms a).Encloses (Foundation.entropyTerm (CA2_2_12I1R15Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_2_12I1R15Certificates_valid + (CA2_2_12I1R15CertificateIndex a) (CA2_2_12I1R15P_sound a) +def CA2_2_12I1R15Entropy : Ball := ⟨0, 0⟩ +lemma CA2_2_12I1R15Entropy_sound : CA2_2_12I1R15Entropy.Encloses (Foundation.finiteEntropy CA2_2_12I1R15Value) := by + exact contains_sound (entropyPair_enclosed CA2_2_12I1R15Value CA2_2_12I1R15Terms CA2_2_12I1R15Terms_sound) (by decide +kernel) +def CA2_2_12I1R15Mass : Ball := ⟨0, 0⟩ +lemma CA2_2_12I1R15Mass_sound : CA2_2_12I1R15Mass.Encloses (∑ a, CA2_2_12I1R15Value a) := by + exact contains_sound (pairSumBall_sound CA2_2_12I1R15P CA2_2_12I1R15Value CA2_2_12I1R15P_sound) (by decide +kernel) +def CA2_2_12I1R15MassTerm : Ball := .exact 0 +lemma CA2_2_12I1R15MassTerm_sound : CA2_2_12I1R15MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_2_12I1R15Value a))) := + entropyTerm_zero_ball (CA2_2_12I1R15Mass_sound) +def CA2_2_12I1R15H : Ball := ⟨0, 0⟩ +lemma CA2_2_12I1R15H_sound : CA2_2_12I1R15H.Encloses (homogeneousEntropy CA2_2_12I1R15Value) := by + exact contains_sound (homogeneous_enclosed CA2_2_12I1R15Value CA2_2_12I1R15MassTerm_sound CA2_2_12I1R15Entropy_sound) (by decide +kernel) +def CA2_2_12I1R16Value (a : PairSlot) : ℝ := residualLaw (below (shape 2 2 12)) (fun u => (stageALaw (shape 2 2 12) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 16 a +def CA2_2_12I1R16Raw (a : PairSlot) : Ball := residualBall (below (shape 2 2 12)) A2_2_12Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 16 a +lemma CA2_2_12I1R16Raw_sound (a : PairSlot) : + (CA2_2_12I1R16Raw a).Encloses (CA2_2_12I1R16Value a) := by + exact residualBall_sound_on (below (shape 2 2 12)) A2_2_12Law (fun u => (stageALaw (shape 2 2 12) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A2_2_12Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 2 2 12) (show (shape 2 2 12) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 16 a +def CA2_2_12I1R16Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA2_2_12I1R16Certificates_valid : + CA2_2_12I1R16Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_2_12I1R16CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA2_2_12I1R16P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_2_12I1R16Certificates (CA2_2_12I1R16CertificateIndex a)).input +lemma CA2_2_12I1R16P_check : ∀ a : PairSlot, contains (CA2_2_12I1R16Raw a) (CA2_2_12I1R16P a) = true := by + decide +kernel +lemma CA2_2_12I1R16P_sound (a : PairSlot) : + (CA2_2_12I1R16P a).Encloses (CA2_2_12I1R16Value a) := + contains_sound (CA2_2_12I1R16Raw_sound a) (CA2_2_12I1R16P_check a) +def CA2_2_12I1R16Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_2_12I1R16Certificates (CA2_2_12I1R16CertificateIndex a)).output +lemma CA2_2_12I1R16Terms_sound (a : PairSlot) : + (CA2_2_12I1R16Terms a).Encloses (Foundation.entropyTerm (CA2_2_12I1R16Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_2_12I1R16Certificates_valid + (CA2_2_12I1R16CertificateIndex a) (CA2_2_12I1R16P_sound a) +def CA2_2_12I1R16Entropy : Ball := ⟨0, 0⟩ +lemma CA2_2_12I1R16Entropy_sound : CA2_2_12I1R16Entropy.Encloses (Foundation.finiteEntropy CA2_2_12I1R16Value) := by + exact contains_sound (entropyPair_enclosed CA2_2_12I1R16Value CA2_2_12I1R16Terms CA2_2_12I1R16Terms_sound) (by decide +kernel) +def CA2_2_12I1R16Mass : Ball := ⟨0, 0⟩ +lemma CA2_2_12I1R16Mass_sound : CA2_2_12I1R16Mass.Encloses (∑ a, CA2_2_12I1R16Value a) := by + exact contains_sound (pairSumBall_sound CA2_2_12I1R16P CA2_2_12I1R16Value CA2_2_12I1R16P_sound) (by decide +kernel) +def CA2_2_12I1R16MassTerm : Ball := .exact 0 +lemma CA2_2_12I1R16MassTerm_sound : CA2_2_12I1R16MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_2_12I1R16Value a))) := + entropyTerm_zero_ball (CA2_2_12I1R16Mass_sound) +def CA2_2_12I1R16H : Ball := ⟨0, 0⟩ +lemma CA2_2_12I1R16H_sound : CA2_2_12I1R16H.Encloses (homogeneousEntropy CA2_2_12I1R16Value) := by + exact contains_sound (homogeneous_enclosed CA2_2_12I1R16Value CA2_2_12I1R16MassTerm_sound CA2_2_12I1R16Entropy_sound) (by decide +kernel) +def CA2_2_12I1ResidualEntropies (a : Fin 17) : Ball := + match a.val with + | 0 => CA2_2_12I1R0H + | 1 => CA2_2_12I1R1H + | 2 => CA2_2_12I1R2H + | 3 => CA2_2_12I1R3H + | 4 => CA2_2_12I1R4H + | 5 => CA2_2_12I1R5H + | 6 => CA2_2_12I1R6H + | 7 => CA2_2_12I1R7H + | 8 => CA2_2_12I1R8H + | 9 => CA2_2_12I1R9H + | 10 => CA2_2_12I1R10H + | 11 => CA2_2_12I1R11H + | 12 => CA2_2_12I1R12H + | 13 => CA2_2_12I1R13H + | 14 => CA2_2_12I1R14H + | 15 => CA2_2_12I1R15H + | 16 => CA2_2_12I1R16H + | _ => (.exact 0) +lemma CA2_2_12I1ResidualEntropies_sound (k : Fin 17) : + (CA2_2_12I1ResidualEntropies k).Encloses (homogeneousEntropy + (residualLaw (below (shape 2 2 12)) (fun u => (stageALaw (shape 2 2 12) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) k)) := by + fin_cases k + · exact CA2_2_12I1R0H_sound + · exact CA2_2_12I1R1H_sound + · exact CA2_2_12I1R2H_sound + · exact CA2_2_12I1R3H_sound + · exact CA2_2_12I1R4H_sound + · exact CA2_2_12I1R5H_sound + · exact CA2_2_12I1R6H_sound + · exact CA2_2_12I1R7H_sound + · exact CA2_2_12I1R8H_sound + · exact CA2_2_12I1R9H_sound + · exact CA2_2_12I1R10H_sound + · exact CA2_2_12I1R11H_sound + · exact CA2_2_12I1R12H_sound + · exact CA2_2_12I1R13H_sound + · exact CA2_2_12I1R14H_sound + · exact CA2_2_12I1R15H_sound + · exact CA2_2_12I1R16H_sound +def CA2_2_12I1Singles (s : Shape) : Ball := + match s 0, s 1, s 2 with + | _, _, _ => (.exact 0) +lemma CA2_2_12I1Singles_sound (u : Shape) (hu : u ∈ below (shape 2 2 12)) + (hd : designated (Equiv.refl (Fin 3)) 1 u) : + (CA2_2_12I1Singles u).Encloses (homogeneousEntropy ((fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) u)) := by + rw [A2_2_12_below] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 0 0 8) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 0 1 7) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 0 2 6) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 1 0 7) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 1 1 6) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 1 2 5) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 2 0 6) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 2 1 5) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 2 2 4) by decide +kernel) hd |>.elim +def CA2_2_12I1Singleton : Ball := ⟨0, 0⟩ +lemma CA2_2_12I1Singleton_sound : CA2_2_12I1Singleton.Encloses + (singletonEntropy (below (shape 2 2 12)) (fun u => (stageALaw (shape 2 2 12) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ))) := by + exact contains_sound (singletonBall_sound (below (shape 2 2 12)) A2_2_12Law (fun u => (stageALaw (shape 2 2 12) u : ℝ)) (Equiv.refl (Fin 3)) 1 + CA2_2_12I1Singles (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A2_2_12Law_sound u) CA2_2_12I1Singles_sound) (by decide +kernel) +def CA2_2_12I1Group : Ball := ⟨(242597608242050919195799730157 / 400000000000000000000000000000), (147626795073 / 100000000000000000000000000000000)⟩ +lemma CA2_2_12I1Group_sound : CA2_2_12I1Group.Encloses + (groupedEntropy (below (shape 2 2 12)) (fun u => (stageALaw (shape 2 2 12) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ))) := by + exact contains_sound (Ball.add_sound CA2_2_12I1Singleton_sound + (finSumBall_sound 17 CA2_2_12I1ResidualEntropies _ CA2_2_12I1ResidualEntropies_sound)) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CA2_2_12I1H : Ball := ⟨(26494626589307072964894601186187 / 25000000000000000000000000000000), (421100588677 / 100000000000000000000000000000000)⟩ +lemma CA2_2_12I1_sound : CA2_2_12I1H.Encloses (stageACapacity (shape 2 2 12) 1) := by + have hb := contains_sound (Ball.add_sound CA2_2_12I1PairH_sound + (Ball.neg_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) CA2_2_12I1Group_sound))) + (show contains (.add CA2_2_12I1PairH (.neg (.mul (.exact 2) CA2_2_12I1Group))) CA2_2_12I1H = true by decide +kernel) + simp only [stageACapacity, nativeCapacity, + show (1 : Fin 3) ≠ 0 by decide, ite_false, sub_eq_add_neg] + exact hb + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA2_2_12I2.lean b/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA2_2_12I2.lean new file mode 100644 index 0000000000000000000000000000000000000000..1c527a434fca0f0b54d57a0677502b4a4631fdfb --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA2_2_12I2.lean @@ -0,0 +1,1022 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Certificates.SupportedContraction + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CA2_2_12I2PairValue (a : PairSlot × PairSlot) : ℝ := pairLaw (below (shape 2 2 12)) (shape 2 2 12) (fun u => (stageALaw (shape 2 2 12) u : ℝ)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) a +def CA2_2_12I2PairRaw (a : PairSlot × PairSlot) : Ball := stageAPairBall (shape 2 2 12) A2_2_12Law 2 a +lemma CA2_2_12I2PairRaw_sound (a : PairSlot × PairSlot) : + (CA2_2_12I2PairRaw a).Encloses (CA2_2_12I2PairValue a) := by + exact stageAPairBall_sound (shape 2 2 12) (by decide +kernel) A2_2_12Law (fun u => (stageALaw (shape 2 2 12) u : ℝ)) (fun u _ => A2_2_12Law_sound u) 2 a +def CA2_2_12I2PairCertificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(110546059455540355306581711 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(47380208567494042334297599 / 3125000000000000000000000000000), (98321 / 20000000000000000000000000000000)⟩ ⟨(-685762424109556084673323391669271 / 50000000000000000000000000000000), (444693201943 / 100000000000000000000000000000000)⟩ ⟨-20, 110546059455540355306581711, 95367431640625000000000000⟩, + .log ⟨(37446908756512204496871500049 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(295456158830945190165451277953 / 100000000000000000000000000000000), (103085997 / 100000000000000000000000000000000)⟩ ⟨(-394500065081558819202461862021939 / 50000000000000000000000000000000), (275285710549 / 100000000000000000000000000000000)⟩ ⟨-12, 37446908756512204496871500049, 24414062500000000000000000000⟩, + .log ⟨(389801076500725599121299973679 / 100000000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ ⟨(2162339191205464455787627598227 / 100000000000000000000000000000000), (412717957 / 50000000000000000000000000000000)⟩ ⟨(-554728891622606729210614912321173 / 100000000000000000000000000000000), (6617444933 / 3125000000000000000000000000000)⟩ ⟨-9, 389801076500725599121299973679, 195312500000000000000000000000⟩, + .log ⟨(8026577649666181438563019887 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(70128369800682554750220086371 / 50000000000000000000000000000000), (47591441 / 100000000000000000000000000000000)⟩ ⟨(-873702004285713652968556505794723 / 100000000000000000000000000000000), (296461537791 / 100000000000000000000000000000000)⟩ ⟨-13, 8026577649666181438563019887, 6103515625000000000000000000⟩, + .log ⟨(1590344396020470775076345577 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(4392918816935459876190947519 / 25000000000000000000000000000000), (2862539 / 50000000000000000000000000000000)⟩ ⟨(-220979497418440407109869188274747 / 20000000000000000000000000000000), (35998906549 / 10000000000000000000000000000000)⟩ ⟨-16, 1590344396020470775076345577, 1525878906250000000000000000⟩, + .log ⟨(4110672278428271414847386989 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(38665771458076961788731966569 / 50000000000000000000000000000000), (26114073 / 100000000000000000000000000000000)⟩ ⟨(-58788698111779635346110901689581 / 6250000000000000000000000000000), (19852335463 / 6250000000000000000000000000000)⟩ ⟨-14, 4110672278428271414847386989, 3051757812500000000000000000⟩, + .log ⟨(4840897131347966399403049539407 / 100000000000000000000000000000000), (27 / 100000000000000000000000000000000)⟩ ⟨(732928799013791158931189995359 / 5000000000000000000000000000000), (6150599157 / 100000000000000000000000000000000)⟩ ⟨(-302807012471964806975055731973201 / 100000000000000000000000000000000), (25410988531 / 20000000000000000000000000000000)⟩ ⟨-5, 4840897131347966399403049539407, 3125000000000000000000000000000⟩, + .log ⟨(45418278816314022048019714781 / 25000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ ⟨(1146487519340282309425416626921 / 100000000000000000000000000000000), (21158929 / 5000000000000000000000000000000)⟩ ⟨(-631071646273212383038481202529713 / 100000000000000000000000000000000), (232934061613 / 100000000000000000000000000000000)⟩ ⟨-10, 45418278816314022048019714781, 24414062500000000000000000000⟩, + .log ⟨(649229789077578320289369905301 / 50000000000000000000000000000000), (11 / 100000000000000000000000000000000)⟩ ⟨(5640497453697866229522802590111 / 100000000000000000000000000000000), (1099838073 / 50000000000000000000000000000000)⟩ ⟨(-217199578199879360886448447234481 / 50000000000000000000000000000000), (169406590311 / 100000000000000000000000000000000)⟩ ⟨-7, 649229789077578320289369905301, 390625000000000000000000000000⟩, + .log ⟨(105419018849959486327554935579 / 100000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ ⟨(722645518909666967360976101907 / 100000000000000000000000000000000), (122778409 / 50000000000000000000000000000000)⟩ ⟨(-685498240064434718339794611312457 / 100000000000000000000000000000000), (232934062409 / 100000000000000000000000000000000)⟩ ⟨-10, 105419018849959486327554935579, 97656250000000000000000000000⟩, + .log ⟨(3895484149800359315890583610359 / 100000000000000000000000000000000), (27 / 100000000000000000000000000000000)⟩ ⟨(12642218110375323571676249971519 / 100000000000000000000000000000000), (2474702623 / 50000000000000000000000000000000)⟩ ⟨(-324535221405617268597189220326917 / 100000000000000000000000000000000), (12705494279 / 10000000000000000000000000000000)⟩ ⟨-5, 3895484149800359315890583610359, 3125000000000000000000000000000⟩, + .log ⟨(133968602120849285361327349 / 1562500000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(40144247651491939790634595767 / 50000000000000000000000000000000), (851069 / 3125000000000000000000000000000)⟩ ⟨(-936419220062822767252056947869411 / 100000000000000000000000000000000), (79409341727 / 25000000000000000000000000000000)⟩ ⟨-14, 133968602120849285361327349, 95367431640625000000000000⟩, + .log ⟨(37126782027156281050057118179 / 12500000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ ⟨(1728369120996635891968983074791 / 100000000000000000000000000000000), (314476087 / 50000000000000000000000000000000)⟩ ⟨(-145478633164701118276404567650121 / 25000000000000000000000000000000), (2646977973 / 1250000000000000000000000000000)⟩ ⟨-9, 37126782027156281050057118179, 24414062500000000000000000000⟩, + .log ⟨(17957480969375498529369692371871 / 50000000000000000000000000000000), (11 / 10000000000000000000000000000000)⟩ ⟨(7355500642950349931271796463037 / 20000000000000000000000000000000), (22815867271 / 100000000000000000000000000000000)⟩ ⟨(-102401621022101378049862349468687 / 100000000000000000000000000000000), (12705494271 / 20000000000000000000000000000000)⟩ ⟨-2, 17957480969375498529369692371871, 12500000000000000000000000000000⟩] +lemma CA2_2_12I2PairCertificates_valid : + CA2_2_12I2PairCertificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_2_12I2PairCertificateIndex (a : PairSlot × PairSlot) : ℕ := + match a.1.1.val, a.1.2.val, a.2.1.val, a.2.2.val with + | 5, 5, 5, 0 => 1 + | 5, 5, 4, 1 => 2 + | 5, 5, 2, 2 => 3 + | 5, 5, 2, 3 => 4 + | 5, 5, 3, 2 => 4 + | 5, 5, 3, 3 => 5 + | 5, 5, 1, 4 => 2 + | 5, 5, 0, 5 => 1 + | 4, 5, 5, 1 => 6 + | 4, 5, 4, 2 => 7 + | 4, 5, 4, 3 => 8 + | 4, 5, 2, 4 => 7 + | 4, 5, 3, 4 => 8 + | 4, 5, 1, 5 => 6 + | 5, 4, 5, 1 => 6 + | 5, 4, 4, 2 => 7 + | 5, 4, 4, 3 => 8 + | 5, 4, 2, 4 => 7 + | 5, 4, 3, 4 => 8 + | 5, 4, 1, 5 => 6 + | 2, 5, 2, 5 => 9 + | 2, 5, 3, 5 => 10 + | 2, 5, 4, 4 => 11 + | 2, 5, 5, 2 => 9 + | 2, 5, 5, 3 => 10 + | 3, 5, 2, 5 => 10 + | 3, 5, 3, 5 => 12 + | 3, 5, 4, 4 => 13 + | 3, 5, 5, 2 => 10 + | 3, 5, 5, 3 => 12 + | 4, 4, 2, 5 => 11 + | 4, 4, 3, 5 => 13 + | 4, 4, 4, 4 => 14 + | 4, 4, 5, 2 => 11 + | 4, 4, 5, 3 => 13 + | 5, 2, 2, 5 => 9 + | 5, 2, 3, 5 => 10 + | 5, 2, 4, 4 => 11 + | 5, 2, 5, 2 => 9 + | 5, 2, 5, 3 => 10 + | 5, 3, 2, 5 => 10 + | 5, 3, 3, 5 => 12 + | 5, 3, 4, 4 => 13 + | 5, 3, 5, 2 => 10 + | 5, 3, 5, 3 => 12 + | 5, 1, 4, 5 => 6 + | 5, 1, 5, 4 => 6 + | 4, 2, 4, 5 => 7 + | 4, 2, 5, 4 => 7 + | 4, 3, 4, 5 => 8 + | 4, 3, 5, 4 => 8 + | 2, 4, 4, 5 => 7 + | 2, 4, 5, 4 => 7 + | 3, 4, 4, 5 => 8 + | 3, 4, 5, 4 => 8 + | 1, 5, 4, 5 => 6 + | 1, 5, 5, 4 => 6 + | 5, 0, 5, 5 => 1 + | 4, 1, 5, 5 => 2 + | 2, 2, 5, 5 => 3 + | 2, 3, 5, 5 => 4 + | 3, 2, 5, 5 => 4 + | 3, 3, 5, 5 => 5 + | 1, 4, 5, 5 => 2 + | 0, 5, 5, 5 => 1 + | _, _, _, _ => 0 +def CA2_2_12I2PairP (a : PairSlot × PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_2_12I2PairCertificates (CA2_2_12I2PairCertificateIndex a)).input +lemma CA2_2_12I2PairP_check_0_0 : ∀ k l : Fin 6, contains (CA2_2_12I2PairRaw ((0,0),(k,l))) (CA2_2_12I2PairP ((0,0),(k,l))) = true := by + decide +kernel +lemma CA2_2_12I2PairP_check_0_1 : ∀ k l : Fin 6, contains (CA2_2_12I2PairRaw ((0,1),(k,l))) (CA2_2_12I2PairP ((0,1),(k,l))) = true := by + decide +kernel +lemma CA2_2_12I2PairP_check_0_2 : ∀ k l : Fin 6, contains (CA2_2_12I2PairRaw ((0,2),(k,l))) (CA2_2_12I2PairP ((0,2),(k,l))) = true := by + decide +kernel +lemma CA2_2_12I2PairP_check_0_3 : ∀ k l : Fin 6, contains (CA2_2_12I2PairRaw ((0,3),(k,l))) (CA2_2_12I2PairP ((0,3),(k,l))) = true := by + decide +kernel +lemma CA2_2_12I2PairP_check_0_4 : ∀ k l : Fin 6, contains (CA2_2_12I2PairRaw ((0,4),(k,l))) (CA2_2_12I2PairP ((0,4),(k,l))) = true := by + decide +kernel +lemma CA2_2_12I2PairP_check_0_5 : ∀ k l : Fin 6, contains (CA2_2_12I2PairRaw ((0,5),(k,l))) (CA2_2_12I2PairP ((0,5),(k,l))) = true := by + decide +kernel +lemma CA2_2_12I2PairP_check_1_0 : ∀ k l : Fin 6, contains (CA2_2_12I2PairRaw ((1,0),(k,l))) (CA2_2_12I2PairP ((1,0),(k,l))) = true := by + decide +kernel +lemma CA2_2_12I2PairP_check_1_1 : ∀ k l : Fin 6, contains (CA2_2_12I2PairRaw ((1,1),(k,l))) (CA2_2_12I2PairP ((1,1),(k,l))) = true := by + decide +kernel +lemma CA2_2_12I2PairP_check_1_2 : ∀ k l : Fin 6, contains (CA2_2_12I2PairRaw ((1,2),(k,l))) (CA2_2_12I2PairP ((1,2),(k,l))) = true := by + decide +kernel +lemma CA2_2_12I2PairP_check_1_3 : ∀ k l : Fin 6, contains (CA2_2_12I2PairRaw ((1,3),(k,l))) (CA2_2_12I2PairP ((1,3),(k,l))) = true := by + decide +kernel +lemma CA2_2_12I2PairP_check_1_4 : ∀ k l : Fin 6, contains (CA2_2_12I2PairRaw ((1,4),(k,l))) (CA2_2_12I2PairP ((1,4),(k,l))) = true := by + decide +kernel +lemma CA2_2_12I2PairP_check_1_5 : ∀ k l : Fin 6, contains (CA2_2_12I2PairRaw ((1,5),(k,l))) (CA2_2_12I2PairP ((1,5),(k,l))) = true := by + decide +kernel +lemma CA2_2_12I2PairP_check_2_0 : ∀ k l : Fin 6, contains (CA2_2_12I2PairRaw ((2,0),(k,l))) (CA2_2_12I2PairP ((2,0),(k,l))) = true := by + decide +kernel +lemma CA2_2_12I2PairP_check_2_1 : ∀ k l : Fin 6, contains (CA2_2_12I2PairRaw ((2,1),(k,l))) (CA2_2_12I2PairP ((2,1),(k,l))) = true := by + decide +kernel +lemma CA2_2_12I2PairP_check_2_2 : ∀ k l : Fin 6, contains (CA2_2_12I2PairRaw ((2,2),(k,l))) (CA2_2_12I2PairP ((2,2),(k,l))) = true := by + decide +kernel +lemma CA2_2_12I2PairP_check_2_3 : ∀ k l : Fin 6, contains (CA2_2_12I2PairRaw ((2,3),(k,l))) (CA2_2_12I2PairP ((2,3),(k,l))) = true := by + decide +kernel +lemma CA2_2_12I2PairP_check_2_4 : ∀ k l : Fin 6, contains (CA2_2_12I2PairRaw ((2,4),(k,l))) (CA2_2_12I2PairP ((2,4),(k,l))) = true := by + decide +kernel +lemma CA2_2_12I2PairP_check_2_5 : ∀ k l : Fin 6, contains (CA2_2_12I2PairRaw ((2,5),(k,l))) (CA2_2_12I2PairP ((2,5),(k,l))) = true := by + decide +kernel +lemma CA2_2_12I2PairP_check_3_0 : ∀ k l : Fin 6, contains (CA2_2_12I2PairRaw ((3,0),(k,l))) (CA2_2_12I2PairP ((3,0),(k,l))) = true := by + decide +kernel +lemma CA2_2_12I2PairP_check_3_1 : ∀ k l : Fin 6, contains (CA2_2_12I2PairRaw ((3,1),(k,l))) (CA2_2_12I2PairP ((3,1),(k,l))) = true := by + decide +kernel +lemma CA2_2_12I2PairP_check_3_2 : ∀ k l : Fin 6, contains (CA2_2_12I2PairRaw ((3,2),(k,l))) (CA2_2_12I2PairP ((3,2),(k,l))) = true := by + decide +kernel +lemma CA2_2_12I2PairP_check_3_3 : ∀ k l : Fin 6, contains (CA2_2_12I2PairRaw ((3,3),(k,l))) (CA2_2_12I2PairP ((3,3),(k,l))) = true := by + decide +kernel +lemma CA2_2_12I2PairP_check_3_4 : ∀ k l : Fin 6, contains (CA2_2_12I2PairRaw ((3,4),(k,l))) (CA2_2_12I2PairP ((3,4),(k,l))) = true := by + decide +kernel +lemma CA2_2_12I2PairP_check_3_5 : ∀ k l : Fin 6, contains (CA2_2_12I2PairRaw ((3,5),(k,l))) (CA2_2_12I2PairP ((3,5),(k,l))) = true := by + decide +kernel +lemma CA2_2_12I2PairP_check_4_0 : ∀ k l : Fin 6, contains (CA2_2_12I2PairRaw ((4,0),(k,l))) (CA2_2_12I2PairP ((4,0),(k,l))) = true := by + decide +kernel +lemma CA2_2_12I2PairP_check_4_1 : ∀ k l : Fin 6, contains (CA2_2_12I2PairRaw ((4,1),(k,l))) (CA2_2_12I2PairP ((4,1),(k,l))) = true := by + decide +kernel +lemma CA2_2_12I2PairP_check_4_2 : ∀ k l : Fin 6, contains (CA2_2_12I2PairRaw ((4,2),(k,l))) (CA2_2_12I2PairP ((4,2),(k,l))) = true := by + decide +kernel +lemma CA2_2_12I2PairP_check_4_3 : ∀ k l : Fin 6, contains (CA2_2_12I2PairRaw ((4,3),(k,l))) (CA2_2_12I2PairP ((4,3),(k,l))) = true := by + decide +kernel +lemma CA2_2_12I2PairP_check_4_4 : ∀ k l : Fin 6, contains (CA2_2_12I2PairRaw ((4,4),(k,l))) (CA2_2_12I2PairP ((4,4),(k,l))) = true := by + decide +kernel +lemma CA2_2_12I2PairP_check_4_5 : ∀ k l : Fin 6, contains (CA2_2_12I2PairRaw ((4,5),(k,l))) (CA2_2_12I2PairP ((4,5),(k,l))) = true := by + decide +kernel +lemma CA2_2_12I2PairP_check_5_0 : ∀ k l : Fin 6, contains (CA2_2_12I2PairRaw ((5,0),(k,l))) (CA2_2_12I2PairP ((5,0),(k,l))) = true := by + decide +kernel +lemma CA2_2_12I2PairP_check_5_1 : ∀ k l : Fin 6, contains (CA2_2_12I2PairRaw ((5,1),(k,l))) (CA2_2_12I2PairP ((5,1),(k,l))) = true := by + decide +kernel +lemma CA2_2_12I2PairP_check_5_2 : ∀ k l : Fin 6, contains (CA2_2_12I2PairRaw ((5,2),(k,l))) (CA2_2_12I2PairP ((5,2),(k,l))) = true := by + decide +kernel +lemma CA2_2_12I2PairP_check_5_3 : ∀ k l : Fin 6, contains (CA2_2_12I2PairRaw ((5,3),(k,l))) (CA2_2_12I2PairP ((5,3),(k,l))) = true := by + decide +kernel +lemma CA2_2_12I2PairP_check_5_4 : ∀ k l : Fin 6, contains (CA2_2_12I2PairRaw ((5,4),(k,l))) (CA2_2_12I2PairP ((5,4),(k,l))) = true := by + decide +kernel +lemma CA2_2_12I2PairP_check_5_5 : ∀ k l : Fin 6, contains (CA2_2_12I2PairRaw ((5,5),(k,l))) (CA2_2_12I2PairP ((5,5),(k,l))) = true := by + decide +kernel +lemma CA2_2_12I2PairP_check (a : PairSlot × PairSlot) : contains (CA2_2_12I2PairRaw a) (CA2_2_12I2PairP a) = true := by + rcases a with ⟨⟨i,j⟩,⟨k,l⟩⟩ + revert j i + apply forall_fin6 + · exact forall_fin6 (CA2_2_12I2PairP_check_0_0 k l) (CA2_2_12I2PairP_check_0_1 k l) (CA2_2_12I2PairP_check_0_2 k l) (CA2_2_12I2PairP_check_0_3 k l) (CA2_2_12I2PairP_check_0_4 k l) (CA2_2_12I2PairP_check_0_5 k l) + · exact forall_fin6 (CA2_2_12I2PairP_check_1_0 k l) (CA2_2_12I2PairP_check_1_1 k l) (CA2_2_12I2PairP_check_1_2 k l) (CA2_2_12I2PairP_check_1_3 k l) (CA2_2_12I2PairP_check_1_4 k l) (CA2_2_12I2PairP_check_1_5 k l) + · exact forall_fin6 (CA2_2_12I2PairP_check_2_0 k l) (CA2_2_12I2PairP_check_2_1 k l) (CA2_2_12I2PairP_check_2_2 k l) (CA2_2_12I2PairP_check_2_3 k l) (CA2_2_12I2PairP_check_2_4 k l) (CA2_2_12I2PairP_check_2_5 k l) + · exact forall_fin6 (CA2_2_12I2PairP_check_3_0 k l) (CA2_2_12I2PairP_check_3_1 k l) (CA2_2_12I2PairP_check_3_2 k l) (CA2_2_12I2PairP_check_3_3 k l) (CA2_2_12I2PairP_check_3_4 k l) (CA2_2_12I2PairP_check_3_5 k l) + · exact forall_fin6 (CA2_2_12I2PairP_check_4_0 k l) (CA2_2_12I2PairP_check_4_1 k l) (CA2_2_12I2PairP_check_4_2 k l) (CA2_2_12I2PairP_check_4_3 k l) (CA2_2_12I2PairP_check_4_4 k l) (CA2_2_12I2PairP_check_4_5 k l) + · exact forall_fin6 (CA2_2_12I2PairP_check_5_0 k l) (CA2_2_12I2PairP_check_5_1 k l) (CA2_2_12I2PairP_check_5_2 k l) (CA2_2_12I2PairP_check_5_3 k l) (CA2_2_12I2PairP_check_5_4 k l) (CA2_2_12I2PairP_check_5_5 k l) +lemma CA2_2_12I2PairP_sound (a : PairSlot × PairSlot) : + (CA2_2_12I2PairP a).Encloses (CA2_2_12I2PairValue a) := + contains_sound (CA2_2_12I2PairRaw_sound a) (CA2_2_12I2PairP_check a) +def CA2_2_12I2PairTerms (a : PairSlot × PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_2_12I2PairCertificates (CA2_2_12I2PairCertificateIndex a)).output +lemma CA2_2_12I2PairTerms_sound (a : PairSlot × PairSlot) : + (CA2_2_12I2PairTerms a).Encloses (Foundation.entropyTerm (CA2_2_12I2PairValue a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_2_12I2PairCertificates_valid + (CA2_2_12I2PairCertificateIndex a) (CA2_2_12I2PairP_sound a) +def CA2_2_12I2PairEntropy : Ball := ⟨(256092058421150692005924592852231 / 100000000000000000000000000000000), (111067525547 / 100000000000000000000000000000000)⟩ +lemma CA2_2_12I2PairEntropy_sound : CA2_2_12I2PairEntropy.Encloses (Foundation.finiteEntropy CA2_2_12I2PairValue) := by + exact contains_sound (entropyDoublePair_enclosed CA2_2_12I2PairValue CA2_2_12I2PairTerms CA2_2_12I2PairTerms_sound) (by decide +kernel) +def CA2_2_12I2PairMass : Ball := ⟨(10000000000000000000000000000001 / 10000000000000000000000000000000), (139 / 25000000000000000000000000000000)⟩ +lemma CA2_2_12I2PairMass_sound : CA2_2_12I2PairMass.Encloses (∑ a, CA2_2_12I2PairValue a) := by + exact contains_sound (doublePairSumBall_sound CA2_2_12I2PairP CA2_2_12I2PairValue CA2_2_12I2PairP_sound) (by decide +kernel) +def CA2_2_12I2PairMassTermLogWitness : LogWitness := ⟨0, 10000000000000000000000000000001, 10000000000000000000000000000000⟩ +def CA2_2_12I2PairMassTermLog : Ball := ⟨(1 / 10000000000000000000000000000000), (10587912119 / 50000000000000000000000000000000)⟩ +lemma CA2_2_12I2PairMassTermLog_sound : CA2_2_12I2PairMassTermLog.Encloses (Real.log ((∑ a, CA2_2_12I2PairValue a))) := by + exact checkLog_sound logTwoBall_sound (CA2_2_12I2PairMass_sound) (w := CA2_2_12I2PairMassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA2_2_12I2PairMassTerm : Ball := ⟨(-1 / 10000000000000000000000000000000), (21175824239 / 100000000000000000000000000000000)⟩ +lemma CA2_2_12I2PairMassTerm_sound : CA2_2_12I2PairMassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_2_12I2PairValue a))) := by + exact contains_sound (entropyTerm_ball (CA2_2_12I2PairMass_sound) CA2_2_12I2PairMassTermLog_sound) (by decide +kernel) +def CA2_2_12I2PairH : Ball := ⟨(256092058421150692005924592852241 / 100000000000000000000000000000000), (66121674893 / 50000000000000000000000000000000)⟩ +lemma CA2_2_12I2PairH_sound : CA2_2_12I2PairH.Encloses (homogeneousEntropy CA2_2_12I2PairValue) := by + exact contains_sound (homogeneous_enclosed CA2_2_12I2PairValue CA2_2_12I2PairMassTerm_sound CA2_2_12I2PairEntropy_sound) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CA2_2_12I2R0Value (a : PairSlot) : ℝ := residualLaw (below (shape 2 2 12)) (fun u => (stageALaw (shape 2 2 12) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 0 a +def CA2_2_12I2R0Raw (a : PairSlot) : Ball := residualBall (below (shape 2 2 12)) A2_2_12Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 0 a +lemma CA2_2_12I2R0Raw_sound (a : PairSlot) : + (CA2_2_12I2R0Raw a).Encloses (CA2_2_12I2R0Value a) := by + exact residualBall_sound_on (below (shape 2 2 12)) A2_2_12Law (fun u => (stageALaw (shape 2 2 12) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A2_2_12Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 2 2 12) (show (shape 2 2 12) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 0 a +def CA2_2_12I2R0Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA2_2_12I2R0Certificates_valid : + CA2_2_12I2R0Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_2_12I2R0CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA2_2_12I2R0P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_2_12I2R0Certificates (CA2_2_12I2R0CertificateIndex a)).input +lemma CA2_2_12I2R0P_check : ∀ a : PairSlot, contains (CA2_2_12I2R0Raw a) (CA2_2_12I2R0P a) = true := by + decide +kernel +lemma CA2_2_12I2R0P_sound (a : PairSlot) : + (CA2_2_12I2R0P a).Encloses (CA2_2_12I2R0Value a) := + contains_sound (CA2_2_12I2R0Raw_sound a) (CA2_2_12I2R0P_check a) +def CA2_2_12I2R0Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_2_12I2R0Certificates (CA2_2_12I2R0CertificateIndex a)).output +lemma CA2_2_12I2R0Terms_sound (a : PairSlot) : + (CA2_2_12I2R0Terms a).Encloses (Foundation.entropyTerm (CA2_2_12I2R0Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_2_12I2R0Certificates_valid + (CA2_2_12I2R0CertificateIndex a) (CA2_2_12I2R0P_sound a) +def CA2_2_12I2R0Entropy : Ball := ⟨0, 0⟩ +lemma CA2_2_12I2R0Entropy_sound : CA2_2_12I2R0Entropy.Encloses (Foundation.finiteEntropy CA2_2_12I2R0Value) := by + exact contains_sound (entropyPair_enclosed CA2_2_12I2R0Value CA2_2_12I2R0Terms CA2_2_12I2R0Terms_sound) (by decide +kernel) +def CA2_2_12I2R0Mass : Ball := ⟨0, 0⟩ +lemma CA2_2_12I2R0Mass_sound : CA2_2_12I2R0Mass.Encloses (∑ a, CA2_2_12I2R0Value a) := by + exact contains_sound (pairSumBall_sound CA2_2_12I2R0P CA2_2_12I2R0Value CA2_2_12I2R0P_sound) (by decide +kernel) +def CA2_2_12I2R0MassTerm : Ball := .exact 0 +lemma CA2_2_12I2R0MassTerm_sound : CA2_2_12I2R0MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_2_12I2R0Value a))) := + entropyTerm_zero_ball (CA2_2_12I2R0Mass_sound) +def CA2_2_12I2R0H : Ball := ⟨0, 0⟩ +lemma CA2_2_12I2R0H_sound : CA2_2_12I2R0H.Encloses (homogeneousEntropy CA2_2_12I2R0Value) := by + exact contains_sound (homogeneous_enclosed CA2_2_12I2R0Value CA2_2_12I2R0MassTerm_sound CA2_2_12I2R0Entropy_sound) (by decide +kernel) +def CA2_2_12I2R1Value (a : PairSlot) : ℝ := residualLaw (below (shape 2 2 12)) (fun u => (stageALaw (shape 2 2 12) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 1 a +def CA2_2_12I2R1Raw (a : PairSlot) : Ball := residualBall (below (shape 2 2 12)) A2_2_12Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 1 a +lemma CA2_2_12I2R1Raw_sound (a : PairSlot) : + (CA2_2_12I2R1Raw a).Encloses (CA2_2_12I2R1Value a) := by + exact residualBall_sound_on (below (shape 2 2 12)) A2_2_12Law (fun u => (stageALaw (shape 2 2 12) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A2_2_12Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 2 2 12) (show (shape 2 2 12) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 1 a +def CA2_2_12I2R1Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA2_2_12I2R1Certificates_valid : + CA2_2_12I2R1Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_2_12I2R1CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA2_2_12I2R1P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_2_12I2R1Certificates (CA2_2_12I2R1CertificateIndex a)).input +lemma CA2_2_12I2R1P_check : ∀ a : PairSlot, contains (CA2_2_12I2R1Raw a) (CA2_2_12I2R1P a) = true := by + decide +kernel +lemma CA2_2_12I2R1P_sound (a : PairSlot) : + (CA2_2_12I2R1P a).Encloses (CA2_2_12I2R1Value a) := + contains_sound (CA2_2_12I2R1Raw_sound a) (CA2_2_12I2R1P_check a) +def CA2_2_12I2R1Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_2_12I2R1Certificates (CA2_2_12I2R1CertificateIndex a)).output +lemma CA2_2_12I2R1Terms_sound (a : PairSlot) : + (CA2_2_12I2R1Terms a).Encloses (Foundation.entropyTerm (CA2_2_12I2R1Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_2_12I2R1Certificates_valid + (CA2_2_12I2R1CertificateIndex a) (CA2_2_12I2R1P_sound a) +def CA2_2_12I2R1Entropy : Ball := ⟨0, 0⟩ +lemma CA2_2_12I2R1Entropy_sound : CA2_2_12I2R1Entropy.Encloses (Foundation.finiteEntropy CA2_2_12I2R1Value) := by + exact contains_sound (entropyPair_enclosed CA2_2_12I2R1Value CA2_2_12I2R1Terms CA2_2_12I2R1Terms_sound) (by decide +kernel) +def CA2_2_12I2R1Mass : Ball := ⟨0, 0⟩ +lemma CA2_2_12I2R1Mass_sound : CA2_2_12I2R1Mass.Encloses (∑ a, CA2_2_12I2R1Value a) := by + exact contains_sound (pairSumBall_sound CA2_2_12I2R1P CA2_2_12I2R1Value CA2_2_12I2R1P_sound) (by decide +kernel) +def CA2_2_12I2R1MassTerm : Ball := .exact 0 +lemma CA2_2_12I2R1MassTerm_sound : CA2_2_12I2R1MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_2_12I2R1Value a))) := + entropyTerm_zero_ball (CA2_2_12I2R1Mass_sound) +def CA2_2_12I2R1H : Ball := ⟨0, 0⟩ +lemma CA2_2_12I2R1H_sound : CA2_2_12I2R1H.Encloses (homogeneousEntropy CA2_2_12I2R1Value) := by + exact contains_sound (homogeneous_enclosed CA2_2_12I2R1Value CA2_2_12I2R1MassTerm_sound CA2_2_12I2R1Entropy_sound) (by decide +kernel) +def CA2_2_12I2R2Value (a : PairSlot) : ℝ := residualLaw (below (shape 2 2 12)) (fun u => (stageALaw (shape 2 2 12) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 2 a +def CA2_2_12I2R2Raw (a : PairSlot) : Ball := residualBall (below (shape 2 2 12)) A2_2_12Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 2 a +lemma CA2_2_12I2R2Raw_sound (a : PairSlot) : + (CA2_2_12I2R2Raw a).Encloses (CA2_2_12I2R2Value a) := by + exact residualBall_sound_on (below (shape 2 2 12)) A2_2_12Law (fun u => (stageALaw (shape 2 2 12) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A2_2_12Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 2 2 12) (show (shape 2 2 12) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 2 a +def CA2_2_12I2R2Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA2_2_12I2R2Certificates_valid : + CA2_2_12I2R2Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_2_12I2R2CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA2_2_12I2R2P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_2_12I2R2Certificates (CA2_2_12I2R2CertificateIndex a)).input +lemma CA2_2_12I2R2P_check : ∀ a : PairSlot, contains (CA2_2_12I2R2Raw a) (CA2_2_12I2R2P a) = true := by + decide +kernel +lemma CA2_2_12I2R2P_sound (a : PairSlot) : + (CA2_2_12I2R2P a).Encloses (CA2_2_12I2R2Value a) := + contains_sound (CA2_2_12I2R2Raw_sound a) (CA2_2_12I2R2P_check a) +def CA2_2_12I2R2Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_2_12I2R2Certificates (CA2_2_12I2R2CertificateIndex a)).output +lemma CA2_2_12I2R2Terms_sound (a : PairSlot) : + (CA2_2_12I2R2Terms a).Encloses (Foundation.entropyTerm (CA2_2_12I2R2Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_2_12I2R2Certificates_valid + (CA2_2_12I2R2CertificateIndex a) (CA2_2_12I2R2P_sound a) +def CA2_2_12I2R2Entropy : Ball := ⟨0, 0⟩ +lemma CA2_2_12I2R2Entropy_sound : CA2_2_12I2R2Entropy.Encloses (Foundation.finiteEntropy CA2_2_12I2R2Value) := by + exact contains_sound (entropyPair_enclosed CA2_2_12I2R2Value CA2_2_12I2R2Terms CA2_2_12I2R2Terms_sound) (by decide +kernel) +def CA2_2_12I2R2Mass : Ball := ⟨0, 0⟩ +lemma CA2_2_12I2R2Mass_sound : CA2_2_12I2R2Mass.Encloses (∑ a, CA2_2_12I2R2Value a) := by + exact contains_sound (pairSumBall_sound CA2_2_12I2R2P CA2_2_12I2R2Value CA2_2_12I2R2P_sound) (by decide +kernel) +def CA2_2_12I2R2MassTerm : Ball := .exact 0 +lemma CA2_2_12I2R2MassTerm_sound : CA2_2_12I2R2MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_2_12I2R2Value a))) := + entropyTerm_zero_ball (CA2_2_12I2R2Mass_sound) +def CA2_2_12I2R2H : Ball := ⟨0, 0⟩ +lemma CA2_2_12I2R2H_sound : CA2_2_12I2R2H.Encloses (homogeneousEntropy CA2_2_12I2R2Value) := by + exact contains_sound (homogeneous_enclosed CA2_2_12I2R2Value CA2_2_12I2R2MassTerm_sound CA2_2_12I2R2Entropy_sound) (by decide +kernel) +def CA2_2_12I2R3Value (a : PairSlot) : ℝ := residualLaw (below (shape 2 2 12)) (fun u => (stageALaw (shape 2 2 12) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 3 a +def CA2_2_12I2R3Raw (a : PairSlot) : Ball := residualBall (below (shape 2 2 12)) A2_2_12Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 3 a +lemma CA2_2_12I2R3Raw_sound (a : PairSlot) : + (CA2_2_12I2R3Raw a).Encloses (CA2_2_12I2R3Value a) := by + exact residualBall_sound_on (below (shape 2 2 12)) A2_2_12Law (fun u => (stageALaw (shape 2 2 12) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A2_2_12Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 2 2 12) (show (shape 2 2 12) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 3 a +def CA2_2_12I2R3Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA2_2_12I2R3Certificates_valid : + CA2_2_12I2R3Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_2_12I2R3CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA2_2_12I2R3P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_2_12I2R3Certificates (CA2_2_12I2R3CertificateIndex a)).input +lemma CA2_2_12I2R3P_check : ∀ a : PairSlot, contains (CA2_2_12I2R3Raw a) (CA2_2_12I2R3P a) = true := by + decide +kernel +lemma CA2_2_12I2R3P_sound (a : PairSlot) : + (CA2_2_12I2R3P a).Encloses (CA2_2_12I2R3Value a) := + contains_sound (CA2_2_12I2R3Raw_sound a) (CA2_2_12I2R3P_check a) +def CA2_2_12I2R3Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_2_12I2R3Certificates (CA2_2_12I2R3CertificateIndex a)).output +lemma CA2_2_12I2R3Terms_sound (a : PairSlot) : + (CA2_2_12I2R3Terms a).Encloses (Foundation.entropyTerm (CA2_2_12I2R3Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_2_12I2R3Certificates_valid + (CA2_2_12I2R3CertificateIndex a) (CA2_2_12I2R3P_sound a) +def CA2_2_12I2R3Entropy : Ball := ⟨0, 0⟩ +lemma CA2_2_12I2R3Entropy_sound : CA2_2_12I2R3Entropy.Encloses (Foundation.finiteEntropy CA2_2_12I2R3Value) := by + exact contains_sound (entropyPair_enclosed CA2_2_12I2R3Value CA2_2_12I2R3Terms CA2_2_12I2R3Terms_sound) (by decide +kernel) +def CA2_2_12I2R3Mass : Ball := ⟨0, 0⟩ +lemma CA2_2_12I2R3Mass_sound : CA2_2_12I2R3Mass.Encloses (∑ a, CA2_2_12I2R3Value a) := by + exact contains_sound (pairSumBall_sound CA2_2_12I2R3P CA2_2_12I2R3Value CA2_2_12I2R3P_sound) (by decide +kernel) +def CA2_2_12I2R3MassTerm : Ball := .exact 0 +lemma CA2_2_12I2R3MassTerm_sound : CA2_2_12I2R3MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_2_12I2R3Value a))) := + entropyTerm_zero_ball (CA2_2_12I2R3Mass_sound) +def CA2_2_12I2R3H : Ball := ⟨0, 0⟩ +lemma CA2_2_12I2R3H_sound : CA2_2_12I2R3H.Encloses (homogeneousEntropy CA2_2_12I2R3Value) := by + exact contains_sound (homogeneous_enclosed CA2_2_12I2R3Value CA2_2_12I2R3MassTerm_sound CA2_2_12I2R3Entropy_sound) (by decide +kernel) +def CA2_2_12I2R4Value (a : PairSlot) : ℝ := residualLaw (below (shape 2 2 12)) (fun u => (stageALaw (shape 2 2 12) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 4 a +def CA2_2_12I2R4Raw (a : PairSlot) : Ball := residualBall (below (shape 2 2 12)) A2_2_12Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 4 a +lemma CA2_2_12I2R4Raw_sound (a : PairSlot) : + (CA2_2_12I2R4Raw a).Encloses (CA2_2_12I2R4Value a) := by + exact residualBall_sound_on (below (shape 2 2 12)) A2_2_12Law (fun u => (stageALaw (shape 2 2 12) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A2_2_12Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 2 2 12) (show (shape 2 2 12) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 4 a +def CA2_2_12I2R4Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(110546059455540355306581711 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(47380208567494042334297599 / 3125000000000000000000000000000), (98321 / 20000000000000000000000000000000)⟩ ⟨(-685762424109556084673323391669271 / 50000000000000000000000000000000), (444693201943 / 100000000000000000000000000000000)⟩ ⟨-20, 110546059455540355306581711, 95367431640625000000000000⟩, + .log ⟨(37446908756512204496871500049 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(295456158830945190165451277953 / 100000000000000000000000000000000), (103085997 / 100000000000000000000000000000000)⟩ ⟨(-394500065081558819202461862021939 / 50000000000000000000000000000000), (275285710549 / 100000000000000000000000000000000)⟩ ⟨-12, 37446908756512204496871500049, 24414062500000000000000000000⟩, + .log ⟨(389801076500725599121299973679 / 100000000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ ⟨(2162339191205464455787627598227 / 100000000000000000000000000000000), (412717957 / 50000000000000000000000000000000)⟩ ⟨(-554728891622606729210614912321173 / 100000000000000000000000000000000), (6617444933 / 3125000000000000000000000000000)⟩ ⟨-9, 389801076500725599121299973679, 195312500000000000000000000000⟩, + .log ⟨(8026577649666181438563019887 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(70128369800682554750220086371 / 50000000000000000000000000000000), (47591441 / 100000000000000000000000000000000)⟩ ⟨(-873702004285713652968556505794723 / 100000000000000000000000000000000), (296461537791 / 100000000000000000000000000000000)⟩ ⟨-13, 8026577649666181438563019887, 6103515625000000000000000000⟩, + .log ⟨(1590344396020470775076345577 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(4392918816935459876190947519 / 25000000000000000000000000000000), (2862539 / 50000000000000000000000000000000)⟩ ⟨(-220979497418440407109869188274747 / 20000000000000000000000000000000), (35998906549 / 10000000000000000000000000000000)⟩ ⟨-16, 1590344396020470775076345577, 1525878906250000000000000000⟩] +lemma CA2_2_12I2R4Certificates_valid : + CA2_2_12I2R4Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_2_12I2R4CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 5, 0 => 1 + | 4, 1 => 2 + | 2, 2 => 3 + | 2, 3 => 4 + | 3, 2 => 4 + | 3, 3 => 5 + | 1, 4 => 2 + | 0, 5 => 1 + | _, _ => 0 +def CA2_2_12I2R4P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_2_12I2R4Certificates (CA2_2_12I2R4CertificateIndex a)).input +lemma CA2_2_12I2R4P_check : ∀ a : PairSlot, contains (CA2_2_12I2R4Raw a) (CA2_2_12I2R4P a) = true := by + decide +kernel +lemma CA2_2_12I2R4P_sound (a : PairSlot) : + (CA2_2_12I2R4P a).Encloses (CA2_2_12I2R4Value a) := + contains_sound (CA2_2_12I2R4Raw_sound a) (CA2_2_12I2R4P_check a) +def CA2_2_12I2R4Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_2_12I2R4Certificates (CA2_2_12I2R4CertificateIndex a)).output +lemma CA2_2_12I2R4Terms_sound (a : PairSlot) : + (CA2_2_12I2R4Terms a).Encloses (Foundation.entropyTerm (CA2_2_12I2R4Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_2_12I2R4Certificates_valid + (CA2_2_12I2R4CertificateIndex a) (CA2_2_12I2R4P_sound a) +def CA2_2_12I2R4Entropy : Ball := ⟨(3054368996686146513333569336029 / 100000000000000000000000000000000), (566749539 / 50000000000000000000000000000000)⟩ +lemma CA2_2_12I2R4Entropy_sound : CA2_2_12I2R4Entropy.Encloses (Foundation.finiteEntropy CA2_2_12I2R4Value) := by + exact contains_sound (entropyPair_enclosed CA2_2_12I2R4Value CA2_2_12I2R4Terms CA2_2_12I2R4Terms_sound) (by decide +kernel) +def CA2_2_12I2R4Mass : Ball := ⟨(124653160281836571338746140581 / 25000000000000000000000000000000), (11 / 100000000000000000000000000000000)⟩ +lemma CA2_2_12I2R4Mass_sound : CA2_2_12I2R4Mass.Encloses (∑ a, CA2_2_12I2R4Value a) := by + exact contains_sound (pairSumBall_sound CA2_2_12I2R4P CA2_2_12I2R4Value CA2_2_12I2R4P_sound) (by decide +kernel) +def CA2_2_12I2R4MassTermLogWitness : LogWitness := ⟨-8, 124653160281836571338746140581, 97656250000000000000000000000⟩ +def CA2_2_12I2R4MassTermLog : Ball := ⟨(-530109594095838382374500639063209 / 100000000000000000000000000000000), (190582415353 / 100000000000000000000000000000000)⟩ +lemma CA2_2_12I2R4MassTermLog_sound : CA2_2_12I2R4MassTermLog.Encloses (Real.log ((∑ a, CA2_2_12I2R4Value a))) := by + exact checkLog_sound logTwoBall_sound (CA2_2_12I2R4Mass_sound) (w := CA2_2_12I2R4MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA2_2_12I2R4MassTerm : Ball := ⟨(82599795249709834557519152781 / 3125000000000000000000000000000), (475134037 / 50000000000000000000000000000000)⟩ +lemma CA2_2_12I2R4MassTerm_sound : CA2_2_12I2R4MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_2_12I2R4Value a))) := by + exact contains_sound (entropyTerm_ball (CA2_2_12I2R4Mass_sound) CA2_2_12I2R4MassTermLog_sound) (by decide +kernel) +def CA2_2_12I2R4H : Ball := ⟨(411175548695431807492956447037 / 100000000000000000000000000000000), (130235447 / 6250000000000000000000000000000)⟩ +lemma CA2_2_12I2R4H_sound : CA2_2_12I2R4H.Encloses (homogeneousEntropy CA2_2_12I2R4Value) := by + exact contains_sound (homogeneous_enclosed CA2_2_12I2R4Value CA2_2_12I2R4MassTerm_sound CA2_2_12I2R4Entropy_sound) (by decide +kernel) +def CA2_2_12I2R5Value (a : PairSlot) : ℝ := residualLaw (below (shape 2 2 12)) (fun u => (stageALaw (shape 2 2 12) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 5 a +def CA2_2_12I2R5Raw (a : PairSlot) : Ball := residualBall (below (shape 2 2 12)) A2_2_12Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 5 a +lemma CA2_2_12I2R5Raw_sound (a : PairSlot) : + (CA2_2_12I2R5Raw a).Encloses (CA2_2_12I2R5Value a) := by + exact residualBall_sound_on (below (shape 2 2 12)) A2_2_12Law (fun u => (stageALaw (shape 2 2 12) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A2_2_12Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 2 2 12) (show (shape 2 2 12) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 5 a +def CA2_2_12I2R5Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(4110672278428271414847386989 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(7163294111615695792879706789 / 5000000000000000000000000000000), (48746259 / 100000000000000000000000000000000)⟩ ⟨(-435652225866239817298025616991483 / 50000000000000000000000000000000), (296461537643 / 100000000000000000000000000000000)⟩ ⟨-13, 4110672278428271414847386989, 3051757812500000000000000000⟩, + .log ⟨(4840897131347966399403049539407 / 50000000000000000000000000000000), (27 / 50000000000000000000000000000000)⟩ ⟨(22606243564602506056146389896049 / 100000000000000000000000000000000), (10250998593 / 100000000000000000000000000000000)⟩ ⟨(-233492294415970276033332538922871 / 100000000000000000000000000000000), (26469779743 / 25000000000000000000000000000000)⟩ ⟨-4, 4840897131347966399403049539407, 3125000000000000000000000000000⟩, + .log ⟨(363346230530512176384157718247 / 100000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ ⟨(102056131171062809117724960551 / 5000000000000000000000000000000), (96176949 / 12500000000000000000000000000000)⟩ ⟨(-280878464108608926048379004739829 / 50000000000000000000000000000000), (42351647531 / 20000000000000000000000000000000)⟩ ⟨-9, 363346230530512176384157718247, 195312500000000000000000000000⟩] +lemma CA2_2_12I2R5Certificates_valid : + CA2_2_12I2R5Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_2_12I2R5CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 5, 1 => 1 + | 4, 2 => 2 + | 4, 3 => 3 + | 2, 4 => 2 + | 3, 4 => 3 + | 1, 5 => 1 + | _, _ => 0 +def CA2_2_12I2R5P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_2_12I2R5Certificates (CA2_2_12I2R5CertificateIndex a)).input +lemma CA2_2_12I2R5P_check : ∀ a : PairSlot, contains (CA2_2_12I2R5Raw a) (CA2_2_12I2R5P a) = true := by + decide +kernel +lemma CA2_2_12I2R5P_sound (a : PairSlot) : + (CA2_2_12I2R5P a).Encloses (CA2_2_12I2R5Value a) := + contains_sound (CA2_2_12I2R5Raw_sound a) (CA2_2_12I2R5P_check a) +def CA2_2_12I2R5Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_2_12I2R5Certificates (CA2_2_12I2R5CertificateIndex a)).output +lemma CA2_2_12I2R5Terms_sound (a : PairSlot) : + (CA2_2_12I2R5Terms a).Encloses (Foundation.entropyTerm (CA2_2_12I2R5Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_2_12I2R5Certificates_valid + (CA2_2_12I2R5CertificateIndex a) (CA2_2_12I2R5P_sound a) +def CA2_2_12I2R5Entropy : Ball := ⟨(24790632070256076154358483242849 / 50000000000000000000000000000000), (2767290111 / 12500000000000000000000000000000)⟩ +lemma CA2_2_12I2R5Entropy_sound : CA2_2_12I2R5Entropy.Encloses (Foundation.finiteEntropy CA2_2_12I2R5Value) := by + exact contains_sound (entropyPair_enclosed CA2_2_12I2R5Value CA2_2_12I2R5Terms CA2_2_12I2R5Terms_sound) (by decide +kernel) +def CA2_2_12I2R5Mass : Ball := ⟨(10061583182340158060849646345017 / 50000000000000000000000000000000), (29 / 25000000000000000000000000000000)⟩ +lemma CA2_2_12I2R5Mass_sound : CA2_2_12I2R5Mass.Encloses (∑ a, CA2_2_12I2R5Value a) := by + exact contains_sound (pairSumBall_sound CA2_2_12I2R5P CA2_2_12I2R5Value CA2_2_12I2R5P_sound) (by decide +kernel) +def CA2_2_12I2R5MassTermLogWitness : LogWitness := ⟨-3, 10061583182340158060849646345017, 6250000000000000000000000000000⟩ +def CA2_2_12I2R5MassTermLog : Ball := ⟨(-16032984791484648815113201465007 / 10000000000000000000000000000000), (21175823827 / 25000000000000000000000000000000)⟩ +lemma CA2_2_12I2R5MassTermLog_sound : CA2_2_12I2R5MassTermLog.Encloses (Real.log ((∑ a, CA2_2_12I2R5Value a))) := by + exact checkLog_sound logTwoBall_sound (CA2_2_12I2R5Mass_sound) (w := CA2_2_12I2R5MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA2_2_12I2R5MassTerm : Ball := ⟨(8065860507035873417281125243751 / 25000000000000000000000000000000), (8522492609 / 50000000000000000000000000000000)⟩ +lemma CA2_2_12I2R5MassTerm_sound : CA2_2_12I2R5MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_2_12I2R5Value a))) := by + exact contains_sound (entropyTerm_ball (CA2_2_12I2R5Mass_sound) CA2_2_12I2R5MassTermLog_sound) (by decide +kernel) +def CA2_2_12I2R5H : Ball := ⟨(8658911056184329319796232755347 / 50000000000000000000000000000000), (19591653053 / 50000000000000000000000000000000)⟩ +lemma CA2_2_12I2R5H_sound : CA2_2_12I2R5H.Encloses (homogeneousEntropy CA2_2_12I2R5Value) := by + exact contains_sound (homogeneous_enclosed CA2_2_12I2R5Value CA2_2_12I2R5MassTerm_sound CA2_2_12I2R5Entropy_sound) (by decide +kernel) +def CA2_2_12I2R6Value (a : PairSlot) : ℝ := residualLaw (below (shape 2 2 12)) (fun u => (stageALaw (shape 2 2 12) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 6 a +def CA2_2_12I2R6Raw (a : PairSlot) : Ball := residualBall (below (shape 2 2 12)) A2_2_12Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 6 a +lemma CA2_2_12I2R6Raw_sound (a : PairSlot) : + (CA2_2_12I2R6Raw a).Encloses (CA2_2_12I2R6Value a) := by + exact residualBall_sound_on (below (shape 2 2 12)) A2_2_12Law (fun u => (stageALaw (shape 2 2 12) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A2_2_12Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 2 2 12) (show (shape 2 2 12) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 6 a +def CA2_2_12I2R6Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(24961617159847518366857742807 / 10000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ ⟨(299189995223843828430433720899 / 20000000000000000000000000000000), (264291409 / 50000000000000000000000000000000)⟩ ⟨(-599300104051574745012626210346839 / 100000000000000000000000000000000), (211758237631 / 100000000000000000000000000000000)⟩ ⟨-9, 24961617159847518366857742807, 19531250000000000000000000000⟩, + .log ⟨(15726809599708718220368261 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(123182704277400116861528629 / 50000000000000000000000000000000), (9993 / 12500000000000000000000000000000)⟩ ⟨(-1566531387010390551339992620392563 / 100000000000000000000000000000000), (6352826587 / 1250000000000000000000000000000)⟩ ⟨-23, 15726809599708718220368261, 11920928955078125000000000⟩, + .log ⟨(6543583602800049597473436325463 / 25000000000000000000000000000000), (13 / 25000000000000000000000000000000)⟩ ⟨(35083838558254229655947660945703 / 100000000000000000000000000000000), (8313946419 / 50000000000000000000000000000000)⟩ ⟨(-33509771449280469694264814274123 / 25000000000000000000000000000000), (63527471247 / 100000000000000000000000000000000)⟩ ⟨-2, 6543583602800049597473436325463, 6250000000000000000000000000000⟩] +lemma CA2_2_12I2R6Certificates_valid : + CA2_2_12I2R6Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_2_12I2R6CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 5, 2 => 1 + | 5, 3 => 2 + | 4, 4 => 3 + | 2, 5 => 1 + | 3, 5 => 2 + | _, _ => 0 +def CA2_2_12I2R6P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_2_12I2R6Certificates (CA2_2_12I2R6CertificateIndex a)).input +lemma CA2_2_12I2R6P_check : ∀ a : PairSlot, contains (CA2_2_12I2R6Raw a) (CA2_2_12I2R6P a) = true := by + decide +kernel +lemma CA2_2_12I2R6P_sound (a : PairSlot) : + (CA2_2_12I2R6P a).Encloses (CA2_2_12I2R6Value a) := + contains_sound (CA2_2_12I2R6Raw_sound a) (CA2_2_12I2R6P_check a) +def CA2_2_12I2R6Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_2_12I2R6Certificates (CA2_2_12I2R6CertificateIndex a)).output +lemma CA2_2_12I2R6Terms_sound (a : PairSlot) : + (CA2_2_12I2R6Terms a).Encloses (Foundation.entropyTerm (CA2_2_12I2R6Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_2_12I2R6Certificates_valid + (CA2_2_12I2R6CertificateIndex a) (CA2_2_12I2R6P_sound a) +def CA2_2_12I2R6Entropy : Ball := ⟨(38076231241309777540719444269209 / 100000000000000000000000000000000), (8842609181 / 50000000000000000000000000000000)⟩ +lemma CA2_2_12I2R6Entropy_sound : CA2_2_12I2R6Entropy.Encloses (Foundation.finiteEntropy CA2_2_12I2R6Value) := by + exact contains_sound (entropyPair_enclosed CA2_2_12I2R6Value CA2_2_12I2R6Terms CA2_2_12I2R6Terms_sound) (by decide +kernel) +def CA2_2_12I2R6Mass : Ball := ⟨(13336799104008174087333670447257 / 50000000000000000000000000000000), (29 / 50000000000000000000000000000000)⟩ +lemma CA2_2_12I2R6Mass_sound : CA2_2_12I2R6Mass.Encloses (∑ a, CA2_2_12I2R6Value a) := by + exact contains_sound (pairSumBall_sound CA2_2_12I2R6P CA2_2_12I2R6Value CA2_2_12I2R6P_sound) (by decide +kernel) +def CA2_2_12I2R6MassTermLogWitness : LogWitness := ⟨-2, 13336799104008174087333670447257, 12500000000000000000000000000000⟩ +def CA2_2_12I2R6MassTermLog : Ball := ⟨(-66074797047919191187250376818187 / 50000000000000000000000000000000), (31763735633 / 50000000000000000000000000000000)⟩ +lemma CA2_2_12I2R6MassTermLog_sound : CA2_2_12I2R6MassTermLog.Encloses (Real.log ((∑ a, CA2_2_12I2R6Value a))) := by + exact checkLog_sound logTwoBall_sound (CA2_2_12I2R6Mass_sound) (w := CA2_2_12I2R6MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA2_2_12I2R6MassTerm : Ball := ⟨(1101532867582763269065187204367 / 3125000000000000000000000000000), (3389012503 / 20000000000000000000000000000000)⟩ +lemma CA2_2_12I2R6MassTerm_sound : CA2_2_12I2R6MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_2_12I2R6Value a))) := by + exact contains_sound (entropyTerm_ball (CA2_2_12I2R6Mass_sound) CA2_2_12I2R6MassTermLog_sound) (by decide +kernel) +def CA2_2_12I2R6H : Ball := ⟨(565435895732270586126690745893 / 20000000000000000000000000000000), (34630280877 / 100000000000000000000000000000000)⟩ +lemma CA2_2_12I2R6H_sound : CA2_2_12I2R6H.Encloses (homogeneousEntropy CA2_2_12I2R6Value) := by + exact contains_sound (homogeneous_enclosed CA2_2_12I2R6Value CA2_2_12I2R6MassTerm_sound CA2_2_12I2R6Entropy_sound) (by decide +kernel) +def CA2_2_12I2R7Value (a : PairSlot) : ℝ := residualLaw (below (shape 2 2 12)) (fun u => (stageALaw (shape 2 2 12) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 7 a +def CA2_2_12I2R7Raw (a : PairSlot) : Ball := residualBall (below (shape 2 2 12)) A2_2_12Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 7 a +lemma CA2_2_12I2R7Raw_sound (a : PairSlot) : + (CA2_2_12I2R7Raw a).Encloses (CA2_2_12I2R7Value a) := by + exact residualBall_sound_on (below (shape 2 2 12)) A2_2_12Law (fun u => (stageALaw (shape 2 2 12) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A2_2_12Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 2 2 12) (show (shape 2 2 12) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 7 a +def CA2_2_12I2R7Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA2_2_12I2R7Certificates_valid : + CA2_2_12I2R7Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_2_12I2R7CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA2_2_12I2R7P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_2_12I2R7Certificates (CA2_2_12I2R7CertificateIndex a)).input +lemma CA2_2_12I2R7P_check : ∀ a : PairSlot, contains (CA2_2_12I2R7Raw a) (CA2_2_12I2R7P a) = true := by + decide +kernel +lemma CA2_2_12I2R7P_sound (a : PairSlot) : + (CA2_2_12I2R7P a).Encloses (CA2_2_12I2R7Value a) := + contains_sound (CA2_2_12I2R7Raw_sound a) (CA2_2_12I2R7P_check a) +def CA2_2_12I2R7Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_2_12I2R7Certificates (CA2_2_12I2R7CertificateIndex a)).output +lemma CA2_2_12I2R7Terms_sound (a : PairSlot) : + (CA2_2_12I2R7Terms a).Encloses (Foundation.entropyTerm (CA2_2_12I2R7Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_2_12I2R7Certificates_valid + (CA2_2_12I2R7CertificateIndex a) (CA2_2_12I2R7P_sound a) +def CA2_2_12I2R7Entropy : Ball := ⟨0, 0⟩ +lemma CA2_2_12I2R7Entropy_sound : CA2_2_12I2R7Entropy.Encloses (Foundation.finiteEntropy CA2_2_12I2R7Value) := by + exact contains_sound (entropyPair_enclosed CA2_2_12I2R7Value CA2_2_12I2R7Terms CA2_2_12I2R7Terms_sound) (by decide +kernel) +def CA2_2_12I2R7Mass : Ball := ⟨0, 0⟩ +lemma CA2_2_12I2R7Mass_sound : CA2_2_12I2R7Mass.Encloses (∑ a, CA2_2_12I2R7Value a) := by + exact contains_sound (pairSumBall_sound CA2_2_12I2R7P CA2_2_12I2R7Value CA2_2_12I2R7P_sound) (by decide +kernel) +def CA2_2_12I2R7MassTerm : Ball := .exact 0 +lemma CA2_2_12I2R7MassTerm_sound : CA2_2_12I2R7MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_2_12I2R7Value a))) := + entropyTerm_zero_ball (CA2_2_12I2R7Mass_sound) +def CA2_2_12I2R7H : Ball := ⟨0, 0⟩ +lemma CA2_2_12I2R7H_sound : CA2_2_12I2R7H.Encloses (homogeneousEntropy CA2_2_12I2R7Value) := by + exact contains_sound (homogeneous_enclosed CA2_2_12I2R7Value CA2_2_12I2R7MassTerm_sound CA2_2_12I2R7Entropy_sound) (by decide +kernel) +def CA2_2_12I2R8Value (a : PairSlot) : ℝ := residualLaw (below (shape 2 2 12)) (fun u => (stageALaw (shape 2 2 12) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 8 a +def CA2_2_12I2R8Raw (a : PairSlot) : Ball := residualBall (below (shape 2 2 12)) A2_2_12Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 8 a +lemma CA2_2_12I2R8Raw_sound (a : PairSlot) : + (CA2_2_12I2R8Raw a).Encloses (CA2_2_12I2R8Value a) := by + exact residualBall_sound_on (below (shape 2 2 12)) A2_2_12Law (fun u => (stageALaw (shape 2 2 12) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A2_2_12Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 2 2 12) (show (shape 2 2 12) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 8 a +def CA2_2_12I2R8Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA2_2_12I2R8Certificates_valid : + CA2_2_12I2R8Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_2_12I2R8CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA2_2_12I2R8P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_2_12I2R8Certificates (CA2_2_12I2R8CertificateIndex a)).input +lemma CA2_2_12I2R8P_check : ∀ a : PairSlot, contains (CA2_2_12I2R8Raw a) (CA2_2_12I2R8P a) = true := by + decide +kernel +lemma CA2_2_12I2R8P_sound (a : PairSlot) : + (CA2_2_12I2R8P a).Encloses (CA2_2_12I2R8Value a) := + contains_sound (CA2_2_12I2R8Raw_sound a) (CA2_2_12I2R8P_check a) +def CA2_2_12I2R8Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_2_12I2R8Certificates (CA2_2_12I2R8CertificateIndex a)).output +lemma CA2_2_12I2R8Terms_sound (a : PairSlot) : + (CA2_2_12I2R8Terms a).Encloses (Foundation.entropyTerm (CA2_2_12I2R8Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_2_12I2R8Certificates_valid + (CA2_2_12I2R8CertificateIndex a) (CA2_2_12I2R8P_sound a) +def CA2_2_12I2R8Entropy : Ball := ⟨0, 0⟩ +lemma CA2_2_12I2R8Entropy_sound : CA2_2_12I2R8Entropy.Encloses (Foundation.finiteEntropy CA2_2_12I2R8Value) := by + exact contains_sound (entropyPair_enclosed CA2_2_12I2R8Value CA2_2_12I2R8Terms CA2_2_12I2R8Terms_sound) (by decide +kernel) +def CA2_2_12I2R8Mass : Ball := ⟨0, 0⟩ +lemma CA2_2_12I2R8Mass_sound : CA2_2_12I2R8Mass.Encloses (∑ a, CA2_2_12I2R8Value a) := by + exact contains_sound (pairSumBall_sound CA2_2_12I2R8P CA2_2_12I2R8Value CA2_2_12I2R8P_sound) (by decide +kernel) +def CA2_2_12I2R8MassTerm : Ball := .exact 0 +lemma CA2_2_12I2R8MassTerm_sound : CA2_2_12I2R8MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_2_12I2R8Value a))) := + entropyTerm_zero_ball (CA2_2_12I2R8Mass_sound) +def CA2_2_12I2R8H : Ball := ⟨0, 0⟩ +lemma CA2_2_12I2R8H_sound : CA2_2_12I2R8H.Encloses (homogeneousEntropy CA2_2_12I2R8Value) := by + exact contains_sound (homogeneous_enclosed CA2_2_12I2R8Value CA2_2_12I2R8MassTerm_sound CA2_2_12I2R8Entropy_sound) (by decide +kernel) +def CA2_2_12I2R9Value (a : PairSlot) : ℝ := residualLaw (below (shape 2 2 12)) (fun u => (stageALaw (shape 2 2 12) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 9 a +def CA2_2_12I2R9Raw (a : PairSlot) : Ball := residualBall (below (shape 2 2 12)) A2_2_12Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 9 a +lemma CA2_2_12I2R9Raw_sound (a : PairSlot) : + (CA2_2_12I2R9Raw a).Encloses (CA2_2_12I2R9Value a) := by + exact residualBall_sound_on (below (shape 2 2 12)) A2_2_12Law (fun u => (stageALaw (shape 2 2 12) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A2_2_12Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 2 2 12) (show (shape 2 2 12) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 9 a +def CA2_2_12I2R9Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA2_2_12I2R9Certificates_valid : + CA2_2_12I2R9Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_2_12I2R9CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA2_2_12I2R9P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_2_12I2R9Certificates (CA2_2_12I2R9CertificateIndex a)).input +lemma CA2_2_12I2R9P_check : ∀ a : PairSlot, contains (CA2_2_12I2R9Raw a) (CA2_2_12I2R9P a) = true := by + decide +kernel +lemma CA2_2_12I2R9P_sound (a : PairSlot) : + (CA2_2_12I2R9P a).Encloses (CA2_2_12I2R9Value a) := + contains_sound (CA2_2_12I2R9Raw_sound a) (CA2_2_12I2R9P_check a) +def CA2_2_12I2R9Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_2_12I2R9Certificates (CA2_2_12I2R9CertificateIndex a)).output +lemma CA2_2_12I2R9Terms_sound (a : PairSlot) : + (CA2_2_12I2R9Terms a).Encloses (Foundation.entropyTerm (CA2_2_12I2R9Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_2_12I2R9Certificates_valid + (CA2_2_12I2R9CertificateIndex a) (CA2_2_12I2R9P_sound a) +def CA2_2_12I2R9Entropy : Ball := ⟨0, 0⟩ +lemma CA2_2_12I2R9Entropy_sound : CA2_2_12I2R9Entropy.Encloses (Foundation.finiteEntropy CA2_2_12I2R9Value) := by + exact contains_sound (entropyPair_enclosed CA2_2_12I2R9Value CA2_2_12I2R9Terms CA2_2_12I2R9Terms_sound) (by decide +kernel) +def CA2_2_12I2R9Mass : Ball := ⟨0, 0⟩ +lemma CA2_2_12I2R9Mass_sound : CA2_2_12I2R9Mass.Encloses (∑ a, CA2_2_12I2R9Value a) := by + exact contains_sound (pairSumBall_sound CA2_2_12I2R9P CA2_2_12I2R9Value CA2_2_12I2R9P_sound) (by decide +kernel) +def CA2_2_12I2R9MassTerm : Ball := .exact 0 +lemma CA2_2_12I2R9MassTerm_sound : CA2_2_12I2R9MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_2_12I2R9Value a))) := + entropyTerm_zero_ball (CA2_2_12I2R9Mass_sound) +def CA2_2_12I2R9H : Ball := ⟨0, 0⟩ +lemma CA2_2_12I2R9H_sound : CA2_2_12I2R9H.Encloses (homogeneousEntropy CA2_2_12I2R9Value) := by + exact contains_sound (homogeneous_enclosed CA2_2_12I2R9Value CA2_2_12I2R9MassTerm_sound CA2_2_12I2R9Entropy_sound) (by decide +kernel) +def CA2_2_12I2R10Value (a : PairSlot) : ℝ := residualLaw (below (shape 2 2 12)) (fun u => (stageALaw (shape 2 2 12) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 10 a +def CA2_2_12I2R10Raw (a : PairSlot) : Ball := residualBall (below (shape 2 2 12)) A2_2_12Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 10 a +lemma CA2_2_12I2R10Raw_sound (a : PairSlot) : + (CA2_2_12I2R10Raw a).Encloses (CA2_2_12I2R10Value a) := by + exact residualBall_sound_on (below (shape 2 2 12)) A2_2_12Law (fun u => (stageALaw (shape 2 2 12) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A2_2_12Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 2 2 12) (show (shape 2 2 12) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 10 a +def CA2_2_12I2R10Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA2_2_12I2R10Certificates_valid : + CA2_2_12I2R10Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_2_12I2R10CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA2_2_12I2R10P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_2_12I2R10Certificates (CA2_2_12I2R10CertificateIndex a)).input +lemma CA2_2_12I2R10P_check : ∀ a : PairSlot, contains (CA2_2_12I2R10Raw a) (CA2_2_12I2R10P a) = true := by + decide +kernel +lemma CA2_2_12I2R10P_sound (a : PairSlot) : + (CA2_2_12I2R10P a).Encloses (CA2_2_12I2R10Value a) := + contains_sound (CA2_2_12I2R10Raw_sound a) (CA2_2_12I2R10P_check a) +def CA2_2_12I2R10Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_2_12I2R10Certificates (CA2_2_12I2R10CertificateIndex a)).output +lemma CA2_2_12I2R10Terms_sound (a : PairSlot) : + (CA2_2_12I2R10Terms a).Encloses (Foundation.entropyTerm (CA2_2_12I2R10Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_2_12I2R10Certificates_valid + (CA2_2_12I2R10CertificateIndex a) (CA2_2_12I2R10P_sound a) +def CA2_2_12I2R10Entropy : Ball := ⟨0, 0⟩ +lemma CA2_2_12I2R10Entropy_sound : CA2_2_12I2R10Entropy.Encloses (Foundation.finiteEntropy CA2_2_12I2R10Value) := by + exact contains_sound (entropyPair_enclosed CA2_2_12I2R10Value CA2_2_12I2R10Terms CA2_2_12I2R10Terms_sound) (by decide +kernel) +def CA2_2_12I2R10Mass : Ball := ⟨0, 0⟩ +lemma CA2_2_12I2R10Mass_sound : CA2_2_12I2R10Mass.Encloses (∑ a, CA2_2_12I2R10Value a) := by + exact contains_sound (pairSumBall_sound CA2_2_12I2R10P CA2_2_12I2R10Value CA2_2_12I2R10P_sound) (by decide +kernel) +def CA2_2_12I2R10MassTerm : Ball := .exact 0 +lemma CA2_2_12I2R10MassTerm_sound : CA2_2_12I2R10MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_2_12I2R10Value a))) := + entropyTerm_zero_ball (CA2_2_12I2R10Mass_sound) +def CA2_2_12I2R10H : Ball := ⟨0, 0⟩ +lemma CA2_2_12I2R10H_sound : CA2_2_12I2R10H.Encloses (homogeneousEntropy CA2_2_12I2R10Value) := by + exact contains_sound (homogeneous_enclosed CA2_2_12I2R10Value CA2_2_12I2R10MassTerm_sound CA2_2_12I2R10Entropy_sound) (by decide +kernel) +def CA2_2_12I2R11Value (a : PairSlot) : ℝ := residualLaw (below (shape 2 2 12)) (fun u => (stageALaw (shape 2 2 12) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 11 a +def CA2_2_12I2R11Raw (a : PairSlot) : Ball := residualBall (below (shape 2 2 12)) A2_2_12Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 11 a +lemma CA2_2_12I2R11Raw_sound (a : PairSlot) : + (CA2_2_12I2R11Raw a).Encloses (CA2_2_12I2R11Value a) := by + exact residualBall_sound_on (below (shape 2 2 12)) A2_2_12Law (fun u => (stageALaw (shape 2 2 12) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A2_2_12Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 2 2 12) (show (shape 2 2 12) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 11 a +def CA2_2_12I2R11Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA2_2_12I2R11Certificates_valid : + CA2_2_12I2R11Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_2_12I2R11CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA2_2_12I2R11P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_2_12I2R11Certificates (CA2_2_12I2R11CertificateIndex a)).input +lemma CA2_2_12I2R11P_check : ∀ a : PairSlot, contains (CA2_2_12I2R11Raw a) (CA2_2_12I2R11P a) = true := by + decide +kernel +lemma CA2_2_12I2R11P_sound (a : PairSlot) : + (CA2_2_12I2R11P a).Encloses (CA2_2_12I2R11Value a) := + contains_sound (CA2_2_12I2R11Raw_sound a) (CA2_2_12I2R11P_check a) +def CA2_2_12I2R11Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_2_12I2R11Certificates (CA2_2_12I2R11CertificateIndex a)).output +lemma CA2_2_12I2R11Terms_sound (a : PairSlot) : + (CA2_2_12I2R11Terms a).Encloses (Foundation.entropyTerm (CA2_2_12I2R11Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_2_12I2R11Certificates_valid + (CA2_2_12I2R11CertificateIndex a) (CA2_2_12I2R11P_sound a) +def CA2_2_12I2R11Entropy : Ball := ⟨0, 0⟩ +lemma CA2_2_12I2R11Entropy_sound : CA2_2_12I2R11Entropy.Encloses (Foundation.finiteEntropy CA2_2_12I2R11Value) := by + exact contains_sound (entropyPair_enclosed CA2_2_12I2R11Value CA2_2_12I2R11Terms CA2_2_12I2R11Terms_sound) (by decide +kernel) +def CA2_2_12I2R11Mass : Ball := ⟨0, 0⟩ +lemma CA2_2_12I2R11Mass_sound : CA2_2_12I2R11Mass.Encloses (∑ a, CA2_2_12I2R11Value a) := by + exact contains_sound (pairSumBall_sound CA2_2_12I2R11P CA2_2_12I2R11Value CA2_2_12I2R11P_sound) (by decide +kernel) +def CA2_2_12I2R11MassTerm : Ball := .exact 0 +lemma CA2_2_12I2R11MassTerm_sound : CA2_2_12I2R11MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_2_12I2R11Value a))) := + entropyTerm_zero_ball (CA2_2_12I2R11Mass_sound) +def CA2_2_12I2R11H : Ball := ⟨0, 0⟩ +lemma CA2_2_12I2R11H_sound : CA2_2_12I2R11H.Encloses (homogeneousEntropy CA2_2_12I2R11Value) := by + exact contains_sound (homogeneous_enclosed CA2_2_12I2R11Value CA2_2_12I2R11MassTerm_sound CA2_2_12I2R11Entropy_sound) (by decide +kernel) +def CA2_2_12I2R12Value (a : PairSlot) : ℝ := residualLaw (below (shape 2 2 12)) (fun u => (stageALaw (shape 2 2 12) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 12 a +def CA2_2_12I2R12Raw (a : PairSlot) : Ball := residualBall (below (shape 2 2 12)) A2_2_12Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 12 a +lemma CA2_2_12I2R12Raw_sound (a : PairSlot) : + (CA2_2_12I2R12Raw a).Encloses (CA2_2_12I2R12Value a) := by + exact residualBall_sound_on (below (shape 2 2 12)) A2_2_12Law (fun u => (stageALaw (shape 2 2 12) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A2_2_12Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 2 2 12) (show (shape 2 2 12) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 12 a +def CA2_2_12I2R12Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA2_2_12I2R12Certificates_valid : + CA2_2_12I2R12Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_2_12I2R12CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA2_2_12I2R12P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_2_12I2R12Certificates (CA2_2_12I2R12CertificateIndex a)).input +lemma CA2_2_12I2R12P_check : ∀ a : PairSlot, contains (CA2_2_12I2R12Raw a) (CA2_2_12I2R12P a) = true := by + decide +kernel +lemma CA2_2_12I2R12P_sound (a : PairSlot) : + (CA2_2_12I2R12P a).Encloses (CA2_2_12I2R12Value a) := + contains_sound (CA2_2_12I2R12Raw_sound a) (CA2_2_12I2R12P_check a) +def CA2_2_12I2R12Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_2_12I2R12Certificates (CA2_2_12I2R12CertificateIndex a)).output +lemma CA2_2_12I2R12Terms_sound (a : PairSlot) : + (CA2_2_12I2R12Terms a).Encloses (Foundation.entropyTerm (CA2_2_12I2R12Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_2_12I2R12Certificates_valid + (CA2_2_12I2R12CertificateIndex a) (CA2_2_12I2R12P_sound a) +def CA2_2_12I2R12Entropy : Ball := ⟨0, 0⟩ +lemma CA2_2_12I2R12Entropy_sound : CA2_2_12I2R12Entropy.Encloses (Foundation.finiteEntropy CA2_2_12I2R12Value) := by + exact contains_sound (entropyPair_enclosed CA2_2_12I2R12Value CA2_2_12I2R12Terms CA2_2_12I2R12Terms_sound) (by decide +kernel) +def CA2_2_12I2R12Mass : Ball := ⟨0, 0⟩ +lemma CA2_2_12I2R12Mass_sound : CA2_2_12I2R12Mass.Encloses (∑ a, CA2_2_12I2R12Value a) := by + exact contains_sound (pairSumBall_sound CA2_2_12I2R12P CA2_2_12I2R12Value CA2_2_12I2R12P_sound) (by decide +kernel) +def CA2_2_12I2R12MassTerm : Ball := .exact 0 +lemma CA2_2_12I2R12MassTerm_sound : CA2_2_12I2R12MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_2_12I2R12Value a))) := + entropyTerm_zero_ball (CA2_2_12I2R12Mass_sound) +def CA2_2_12I2R12H : Ball := ⟨0, 0⟩ +lemma CA2_2_12I2R12H_sound : CA2_2_12I2R12H.Encloses (homogeneousEntropy CA2_2_12I2R12Value) := by + exact contains_sound (homogeneous_enclosed CA2_2_12I2R12Value CA2_2_12I2R12MassTerm_sound CA2_2_12I2R12Entropy_sound) (by decide +kernel) +def CA2_2_12I2R13Value (a : PairSlot) : ℝ := residualLaw (below (shape 2 2 12)) (fun u => (stageALaw (shape 2 2 12) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 13 a +def CA2_2_12I2R13Raw (a : PairSlot) : Ball := residualBall (below (shape 2 2 12)) A2_2_12Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 13 a +lemma CA2_2_12I2R13Raw_sound (a : PairSlot) : + (CA2_2_12I2R13Raw a).Encloses (CA2_2_12I2R13Value a) := by + exact residualBall_sound_on (below (shape 2 2 12)) A2_2_12Law (fun u => (stageALaw (shape 2 2 12) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A2_2_12Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 2 2 12) (show (shape 2 2 12) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 13 a +def CA2_2_12I2R13Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA2_2_12I2R13Certificates_valid : + CA2_2_12I2R13Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_2_12I2R13CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA2_2_12I2R13P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_2_12I2R13Certificates (CA2_2_12I2R13CertificateIndex a)).input +lemma CA2_2_12I2R13P_check : ∀ a : PairSlot, contains (CA2_2_12I2R13Raw a) (CA2_2_12I2R13P a) = true := by + decide +kernel +lemma CA2_2_12I2R13P_sound (a : PairSlot) : + (CA2_2_12I2R13P a).Encloses (CA2_2_12I2R13Value a) := + contains_sound (CA2_2_12I2R13Raw_sound a) (CA2_2_12I2R13P_check a) +def CA2_2_12I2R13Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_2_12I2R13Certificates (CA2_2_12I2R13CertificateIndex a)).output +lemma CA2_2_12I2R13Terms_sound (a : PairSlot) : + (CA2_2_12I2R13Terms a).Encloses (Foundation.entropyTerm (CA2_2_12I2R13Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_2_12I2R13Certificates_valid + (CA2_2_12I2R13CertificateIndex a) (CA2_2_12I2R13P_sound a) +def CA2_2_12I2R13Entropy : Ball := ⟨0, 0⟩ +lemma CA2_2_12I2R13Entropy_sound : CA2_2_12I2R13Entropy.Encloses (Foundation.finiteEntropy CA2_2_12I2R13Value) := by + exact contains_sound (entropyPair_enclosed CA2_2_12I2R13Value CA2_2_12I2R13Terms CA2_2_12I2R13Terms_sound) (by decide +kernel) +def CA2_2_12I2R13Mass : Ball := ⟨0, 0⟩ +lemma CA2_2_12I2R13Mass_sound : CA2_2_12I2R13Mass.Encloses (∑ a, CA2_2_12I2R13Value a) := by + exact contains_sound (pairSumBall_sound CA2_2_12I2R13P CA2_2_12I2R13Value CA2_2_12I2R13P_sound) (by decide +kernel) +def CA2_2_12I2R13MassTerm : Ball := .exact 0 +lemma CA2_2_12I2R13MassTerm_sound : CA2_2_12I2R13MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_2_12I2R13Value a))) := + entropyTerm_zero_ball (CA2_2_12I2R13Mass_sound) +def CA2_2_12I2R13H : Ball := ⟨0, 0⟩ +lemma CA2_2_12I2R13H_sound : CA2_2_12I2R13H.Encloses (homogeneousEntropy CA2_2_12I2R13Value) := by + exact contains_sound (homogeneous_enclosed CA2_2_12I2R13Value CA2_2_12I2R13MassTerm_sound CA2_2_12I2R13Entropy_sound) (by decide +kernel) +def CA2_2_12I2R14Value (a : PairSlot) : ℝ := residualLaw (below (shape 2 2 12)) (fun u => (stageALaw (shape 2 2 12) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 14 a +def CA2_2_12I2R14Raw (a : PairSlot) : Ball := residualBall (below (shape 2 2 12)) A2_2_12Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 14 a +lemma CA2_2_12I2R14Raw_sound (a : PairSlot) : + (CA2_2_12I2R14Raw a).Encloses (CA2_2_12I2R14Value a) := by + exact residualBall_sound_on (below (shape 2 2 12)) A2_2_12Law (fun u => (stageALaw (shape 2 2 12) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A2_2_12Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 2 2 12) (show (shape 2 2 12) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 14 a +def CA2_2_12I2R14Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA2_2_12I2R14Certificates_valid : + CA2_2_12I2R14Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_2_12I2R14CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA2_2_12I2R14P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_2_12I2R14Certificates (CA2_2_12I2R14CertificateIndex a)).input +lemma CA2_2_12I2R14P_check : ∀ a : PairSlot, contains (CA2_2_12I2R14Raw a) (CA2_2_12I2R14P a) = true := by + decide +kernel +lemma CA2_2_12I2R14P_sound (a : PairSlot) : + (CA2_2_12I2R14P a).Encloses (CA2_2_12I2R14Value a) := + contains_sound (CA2_2_12I2R14Raw_sound a) (CA2_2_12I2R14P_check a) +def CA2_2_12I2R14Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_2_12I2R14Certificates (CA2_2_12I2R14CertificateIndex a)).output +lemma CA2_2_12I2R14Terms_sound (a : PairSlot) : + (CA2_2_12I2R14Terms a).Encloses (Foundation.entropyTerm (CA2_2_12I2R14Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_2_12I2R14Certificates_valid + (CA2_2_12I2R14CertificateIndex a) (CA2_2_12I2R14P_sound a) +def CA2_2_12I2R14Entropy : Ball := ⟨0, 0⟩ +lemma CA2_2_12I2R14Entropy_sound : CA2_2_12I2R14Entropy.Encloses (Foundation.finiteEntropy CA2_2_12I2R14Value) := by + exact contains_sound (entropyPair_enclosed CA2_2_12I2R14Value CA2_2_12I2R14Terms CA2_2_12I2R14Terms_sound) (by decide +kernel) +def CA2_2_12I2R14Mass : Ball := ⟨0, 0⟩ +lemma CA2_2_12I2R14Mass_sound : CA2_2_12I2R14Mass.Encloses (∑ a, CA2_2_12I2R14Value a) := by + exact contains_sound (pairSumBall_sound CA2_2_12I2R14P CA2_2_12I2R14Value CA2_2_12I2R14P_sound) (by decide +kernel) +def CA2_2_12I2R14MassTerm : Ball := .exact 0 +lemma CA2_2_12I2R14MassTerm_sound : CA2_2_12I2R14MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_2_12I2R14Value a))) := + entropyTerm_zero_ball (CA2_2_12I2R14Mass_sound) +def CA2_2_12I2R14H : Ball := ⟨0, 0⟩ +lemma CA2_2_12I2R14H_sound : CA2_2_12I2R14H.Encloses (homogeneousEntropy CA2_2_12I2R14Value) := by + exact contains_sound (homogeneous_enclosed CA2_2_12I2R14Value CA2_2_12I2R14MassTerm_sound CA2_2_12I2R14Entropy_sound) (by decide +kernel) +def CA2_2_12I2R15Value (a : PairSlot) : ℝ := residualLaw (below (shape 2 2 12)) (fun u => (stageALaw (shape 2 2 12) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 15 a +def CA2_2_12I2R15Raw (a : PairSlot) : Ball := residualBall (below (shape 2 2 12)) A2_2_12Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 15 a +lemma CA2_2_12I2R15Raw_sound (a : PairSlot) : + (CA2_2_12I2R15Raw a).Encloses (CA2_2_12I2R15Value a) := by + exact residualBall_sound_on (below (shape 2 2 12)) A2_2_12Law (fun u => (stageALaw (shape 2 2 12) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A2_2_12Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 2 2 12) (show (shape 2 2 12) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 15 a +def CA2_2_12I2R15Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA2_2_12I2R15Certificates_valid : + CA2_2_12I2R15Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_2_12I2R15CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA2_2_12I2R15P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_2_12I2R15Certificates (CA2_2_12I2R15CertificateIndex a)).input +lemma CA2_2_12I2R15P_check : ∀ a : PairSlot, contains (CA2_2_12I2R15Raw a) (CA2_2_12I2R15P a) = true := by + decide +kernel +lemma CA2_2_12I2R15P_sound (a : PairSlot) : + (CA2_2_12I2R15P a).Encloses (CA2_2_12I2R15Value a) := + contains_sound (CA2_2_12I2R15Raw_sound a) (CA2_2_12I2R15P_check a) +def CA2_2_12I2R15Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_2_12I2R15Certificates (CA2_2_12I2R15CertificateIndex a)).output +lemma CA2_2_12I2R15Terms_sound (a : PairSlot) : + (CA2_2_12I2R15Terms a).Encloses (Foundation.entropyTerm (CA2_2_12I2R15Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_2_12I2R15Certificates_valid + (CA2_2_12I2R15CertificateIndex a) (CA2_2_12I2R15P_sound a) +def CA2_2_12I2R15Entropy : Ball := ⟨0, 0⟩ +lemma CA2_2_12I2R15Entropy_sound : CA2_2_12I2R15Entropy.Encloses (Foundation.finiteEntropy CA2_2_12I2R15Value) := by + exact contains_sound (entropyPair_enclosed CA2_2_12I2R15Value CA2_2_12I2R15Terms CA2_2_12I2R15Terms_sound) (by decide +kernel) +def CA2_2_12I2R15Mass : Ball := ⟨0, 0⟩ +lemma CA2_2_12I2R15Mass_sound : CA2_2_12I2R15Mass.Encloses (∑ a, CA2_2_12I2R15Value a) := by + exact contains_sound (pairSumBall_sound CA2_2_12I2R15P CA2_2_12I2R15Value CA2_2_12I2R15P_sound) (by decide +kernel) +def CA2_2_12I2R15MassTerm : Ball := .exact 0 +lemma CA2_2_12I2R15MassTerm_sound : CA2_2_12I2R15MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_2_12I2R15Value a))) := + entropyTerm_zero_ball (CA2_2_12I2R15Mass_sound) +def CA2_2_12I2R15H : Ball := ⟨0, 0⟩ +lemma CA2_2_12I2R15H_sound : CA2_2_12I2R15H.Encloses (homogeneousEntropy CA2_2_12I2R15Value) := by + exact contains_sound (homogeneous_enclosed CA2_2_12I2R15Value CA2_2_12I2R15MassTerm_sound CA2_2_12I2R15Entropy_sound) (by decide +kernel) +def CA2_2_12I2R16Value (a : PairSlot) : ℝ := residualLaw (below (shape 2 2 12)) (fun u => (stageALaw (shape 2 2 12) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 16 a +def CA2_2_12I2R16Raw (a : PairSlot) : Ball := residualBall (below (shape 2 2 12)) A2_2_12Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 16 a +lemma CA2_2_12I2R16Raw_sound (a : PairSlot) : + (CA2_2_12I2R16Raw a).Encloses (CA2_2_12I2R16Value a) := by + exact residualBall_sound_on (below (shape 2 2 12)) A2_2_12Law (fun u => (stageALaw (shape 2 2 12) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A2_2_12Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 2 2 12) (show (shape 2 2 12) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 16 a +def CA2_2_12I2R16Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA2_2_12I2R16Certificates_valid : + CA2_2_12I2R16Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_2_12I2R16CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA2_2_12I2R16P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_2_12I2R16Certificates (CA2_2_12I2R16CertificateIndex a)).input +lemma CA2_2_12I2R16P_check : ∀ a : PairSlot, contains (CA2_2_12I2R16Raw a) (CA2_2_12I2R16P a) = true := by + decide +kernel +lemma CA2_2_12I2R16P_sound (a : PairSlot) : + (CA2_2_12I2R16P a).Encloses (CA2_2_12I2R16Value a) := + contains_sound (CA2_2_12I2R16Raw_sound a) (CA2_2_12I2R16P_check a) +def CA2_2_12I2R16Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_2_12I2R16Certificates (CA2_2_12I2R16CertificateIndex a)).output +lemma CA2_2_12I2R16Terms_sound (a : PairSlot) : + (CA2_2_12I2R16Terms a).Encloses (Foundation.entropyTerm (CA2_2_12I2R16Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_2_12I2R16Certificates_valid + (CA2_2_12I2R16CertificateIndex a) (CA2_2_12I2R16P_sound a) +def CA2_2_12I2R16Entropy : Ball := ⟨0, 0⟩ +lemma CA2_2_12I2R16Entropy_sound : CA2_2_12I2R16Entropy.Encloses (Foundation.finiteEntropy CA2_2_12I2R16Value) := by + exact contains_sound (entropyPair_enclosed CA2_2_12I2R16Value CA2_2_12I2R16Terms CA2_2_12I2R16Terms_sound) (by decide +kernel) +def CA2_2_12I2R16Mass : Ball := ⟨0, 0⟩ +lemma CA2_2_12I2R16Mass_sound : CA2_2_12I2R16Mass.Encloses (∑ a, CA2_2_12I2R16Value a) := by + exact contains_sound (pairSumBall_sound CA2_2_12I2R16P CA2_2_12I2R16Value CA2_2_12I2R16P_sound) (by decide +kernel) +def CA2_2_12I2R16MassTerm : Ball := .exact 0 +lemma CA2_2_12I2R16MassTerm_sound : CA2_2_12I2R16MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_2_12I2R16Value a))) := + entropyTerm_zero_ball (CA2_2_12I2R16Mass_sound) +def CA2_2_12I2R16H : Ball := ⟨0, 0⟩ +lemma CA2_2_12I2R16H_sound : CA2_2_12I2R16H.Encloses (homogeneousEntropy CA2_2_12I2R16Value) := by + exact contains_sound (homogeneous_enclosed CA2_2_12I2R16Value CA2_2_12I2R16MassTerm_sound CA2_2_12I2R16Entropy_sound) (by decide +kernel) +def CA2_2_12I2ResidualEntropies (a : Fin 17) : Ball := + match a.val with + | 0 => CA2_2_12I2R0H + | 1 => CA2_2_12I2R1H + | 2 => CA2_2_12I2R2H + | 3 => CA2_2_12I2R3H + | 4 => CA2_2_12I2R4H + | 5 => CA2_2_12I2R5H + | 6 => CA2_2_12I2R6H + | 7 => CA2_2_12I2R7H + | 8 => CA2_2_12I2R8H + | 9 => CA2_2_12I2R9H + | 10 => CA2_2_12I2R10H + | 11 => CA2_2_12I2R11H + | 12 => CA2_2_12I2R12H + | 13 => CA2_2_12I2R13H + | 14 => CA2_2_12I2R14H + | 15 => CA2_2_12I2R15H + | 16 => CA2_2_12I2R16H + | _ => (.exact 0) +lemma CA2_2_12I2ResidualEntropies_sound (k : Fin 17) : + (CA2_2_12I2ResidualEntropies k).Encloses (homogeneousEntropy + (residualLaw (below (shape 2 2 12)) (fun u => (stageALaw (shape 2 2 12) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) k)) := by + fin_cases k + · exact CA2_2_12I2R0H_sound + · exact CA2_2_12I2R1H_sound + · exact CA2_2_12I2R2H_sound + · exact CA2_2_12I2R3H_sound + · exact CA2_2_12I2R4H_sound + · exact CA2_2_12I2R5H_sound + · exact CA2_2_12I2R6H_sound + · exact CA2_2_12I2R7H_sound + · exact CA2_2_12I2R8H_sound + · exact CA2_2_12I2R9H_sound + · exact CA2_2_12I2R10H_sound + · exact CA2_2_12I2R11H_sound + · exact CA2_2_12I2R12H_sound + · exact CA2_2_12I2R13H_sound + · exact CA2_2_12I2R14H_sound + · exact CA2_2_12I2R15H_sound + · exact CA2_2_12I2R16H_sound +def CA2_2_12I2Singles (s : Shape) : Ball := + match s 0, s 1, s 2 with + | 0, 0, 8 => Z0_0_8H2H + | 0, 1, 7 => Z0_1_7H2H + | 0, 2, 6 => Z0_2_6H2H + | 1, 0, 7 => Z1_0_7H2H + | 2, 0, 6 => Z2_0_6H2H + | _, _, _ => (.exact 0) +lemma CA2_2_12I2Singles_sound (u : Shape) (hu : u ∈ below (shape 2 2 12)) + (hd : designated (Equiv.refl (Fin 3)) 2 u) : + (CA2_2_12I2Singles u).Encloses (homogeneousEntropy ((fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) u)) := by + rw [A2_2_12_below] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl + · exact Z0_0_8H2H_sound + · exact Z0_1_7H2H_sound + · exact Z0_2_6H2H_sound + · exact Z1_0_7H2H_sound + · exact (show ¬ designated (Equiv.refl (Fin 3)) 2 (shape 1 1 6) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 2 (shape 1 2 5) by decide +kernel) hd |>.elim + · exact Z2_0_6H2H_sound + · exact (show ¬ designated (Equiv.refl (Fin 3)) 2 (shape 2 1 5) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 2 (shape 2 2 4) by decide +kernel) hd |>.elim +def CA2_2_12I2Singleton : Ball := ⟨(49295386069855886010487108668437 / 100000000000000000000000000000000), (9719736623 / 25000000000000000000000000000000)⟩ +lemma CA2_2_12I2Singleton_sound : CA2_2_12I2Singleton.Encloses + (singletonEntropy (below (shape 2 2 12)) (fun u => (stageALaw (shape 2 2 12) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ))) := by + exact contains_sound (singletonBall_sound (below (shape 2 2 12)) A2_2_12Law (fun u => (stageALaw (shape 2 2 12) u : ℝ)) (Equiv.refl (Fin 3)) 2 + CA2_2_12I2Singles (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A2_2_12Law_sound u) CA2_2_12I2Singles_sound) (by decide +kernel) +def CA2_2_12I2Group : Ball := ⟨(69851563209581329388205984355633 / 100000000000000000000000000000000), (114776300627 / 100000000000000000000000000000000)⟩ +lemma CA2_2_12I2Group_sound : CA2_2_12I2Group.Encloses + (groupedEntropy (below (shape 2 2 12)) (fun u => (stageALaw (shape 2 2 12) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ))) := by + exact contains_sound (Ball.add_sound CA2_2_12I2Singleton_sound + (finSumBall_sound 17 CA2_2_12I2ResidualEntropies _ CA2_2_12I2ResidualEntropies_sound)) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CA2_2_12I2H : Ball := ⟨(4655557280079521329180504965639 / 4000000000000000000000000000000), (1130612347 / 312500000000000000000000000000)⟩ +lemma CA2_2_12I2_sound : CA2_2_12I2H.Encloses (stageACapacity (shape 2 2 12) 2) := by + have hb := contains_sound (Ball.add_sound CA2_2_12I2PairH_sound + (Ball.neg_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) CA2_2_12I2Group_sound))) + (show contains (.add CA2_2_12I2PairH (.neg (.mul (.exact 2) CA2_2_12I2Group))) CA2_2_12I2H = true by decide +kernel) + unfold CA2_2_12I2PairValue at hb + simpa only [stageACapacity, nativeCapacity, + show (2 : Fin 3) ≠ 0 by decide, ite_false, sub_eq_add_neg] using hb + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA2_3_11I0.lean b/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA2_3_11I0.lean new file mode 100644 index 0000000000000000000000000000000000000000..90be327d09b07a0f0b2dd3de3c80bafd702a5e44 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA2_3_11I0.lean @@ -0,0 +1,74 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Certificates.SplitA2_3_11 + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CA2_3_11I0Value (a : Fin 17) : ℝ := marginal (below (shape 2 3 11)) (fun u => (stageALaw (shape 2 3 11) u : ℝ)) ((Equiv.refl (Fin 3)) 0) a +def CA2_3_11I0Raw (a : Fin 17) : Ball := marginalBall (below (shape 2 3 11)) A2_3_11Law ((Equiv.refl (Fin 3)) 0) a +lemma CA2_3_11I0Raw_sound (a : Fin 17) : + (CA2_3_11I0Raw a).Encloses (CA2_3_11I0Value a) := by + exact marginalBall_sound (below (shape 2 3 11)) A2_3_11Law (fun u => (stageALaw (shape 2 3 11) u : ℝ)) (fun u _ => A2_3_11Law_sound u) ((Equiv.refl (Fin 3)) 0) a +def CA2_3_11I0Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(26533248109664728192207347509433 / 100000000000000000000000000000000), (1 / 1250000000000000000000000000000)⟩ ⟨(17601779941022551087002795414573 / 50000000000000000000000000000000), (8427950849 / 50000000000000000000000000000000)⟩ ⟨(-66338579687916564099797439552099 / 50000000000000000000000000000000), (1270549427 / 2000000000000000000000000000000)⟩ ⟨-2, 26533248109664728192207347509433, 25000000000000000000000000000000⟩, + .log ⟨(23466751890335271807792652490567 / 50000000000000000000000000000000), (7 / 10000000000000000000000000000000)⟩ ⟨(17751152235485283878421062996329 / 50000000000000000000000000000000), (596313363 / 2000000000000000000000000000000)⟩ ⟨(-18910959981210752265746631219023 / 25000000000000000000000000000000), (31763735599 / 50000000000000000000000000000000)⟩ ⟨-2, 23466751890335271807792652490567, 12500000000000000000000000000000⟩] +lemma CA2_3_11I0Certificates_valid : + CA2_3_11I0Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_3_11I0CertificateIndex (a : Fin 17) : ℕ := + match a.val with + | 0 => 1 + | 1 => 2 + | 2 => 1 + | _ => 0 +def CA2_3_11I0P (a : Fin 17) : Ball := + (CompactCertificate.entropyLookup CA2_3_11I0Certificates (CA2_3_11I0CertificateIndex a)).input +lemma CA2_3_11I0P_check : ∀ a : Fin 17, contains (CA2_3_11I0Raw a) (CA2_3_11I0P a) = true := by + decide +kernel +lemma CA2_3_11I0P_sound (a : Fin 17) : + (CA2_3_11I0P a).Encloses (CA2_3_11I0Value a) := + contains_sound (CA2_3_11I0Raw_sound a) (CA2_3_11I0P_check a) +def CA2_3_11I0Terms (a : Fin 17) : Ball := + (CompactCertificate.entropyLookup CA2_3_11I0Certificates (CA2_3_11I0CertificateIndex a)).output +lemma CA2_3_11I0Terms_sound (a : Fin 17) : + (CA2_3_11I0Terms a).Encloses (Foundation.entropyTerm (CA2_3_11I0Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_3_11I0Certificates_valid + (CA2_3_11I0CertificateIndex a) (CA2_3_11I0P_sound a) +def CA2_3_11I0Entropy : Ball := ⟨(2118188484701215442097066153019 / 2000000000000000000000000000000), (31763735773 / 50000000000000000000000000000000)⟩ +lemma CA2_3_11I0Entropy_sound : CA2_3_11I0Entropy.Encloses (Foundation.finiteEntropy CA2_3_11I0Value) := by + exact contains_sound (entropyFin_enclosed 17 CA2_3_11I0Value CA2_3_11I0Terms CA2_3_11I0Terms_sound) (by decide +kernel) +def CA2_3_11I0Mass : Ball := ⟨1, (23 / 10000000000000000000000000000000)⟩ +lemma CA2_3_11I0Mass_sound : CA2_3_11I0Mass.Encloses (∑ a, CA2_3_11I0Value a) := by + exact contains_sound (finSumBall_sound 17 CA2_3_11I0P CA2_3_11I0Value CA2_3_11I0P_sound) (by decide +kernel) +def CA2_3_11I0MassTermLogWitness : LogWitness := ⟨0, 1, 1⟩ +def CA2_3_11I0MassTermLog : Ball := ⟨0, (2646977989 / 12500000000000000000000000000000)⟩ +lemma CA2_3_11I0MassTermLog_sound : CA2_3_11I0MassTermLog.Encloses (Real.log ((∑ a, CA2_3_11I0Value a))) := by + exact checkLog_sound logTwoBall_sound (CA2_3_11I0Mass_sound) (w := CA2_3_11I0MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA2_3_11I0MassTerm : Ball := ⟨0, (21175823913 / 100000000000000000000000000000000)⟩ +lemma CA2_3_11I0MassTerm_sound : CA2_3_11I0MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_3_11I0Value a))) := by + exact contains_sound (entropyTerm_ball (CA2_3_11I0Mass_sound) CA2_3_11I0MassTermLog_sound) (by decide +kernel) +def CA2_3_11I0H : Ball := ⟨(2118188484701215442097066153019 / 2000000000000000000000000000000), (84703295459 / 100000000000000000000000000000000)⟩ +lemma CA2_3_11I0H_sound : CA2_3_11I0H.Encloses (homogeneousEntropy CA2_3_11I0Value) := by + exact contains_sound (homogeneous_enclosed CA2_3_11I0Value CA2_3_11I0MassTerm_sound CA2_3_11I0Entropy_sound) (by decide +kernel) +lemma CA2_3_11I0_sound : CA2_3_11I0H.Encloses (stageACapacity (shape 2 3 11) 0) := by + exact CA2_3_11I0H_sound + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA2_3_11I1.lean b/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA2_3_11I1.lean new file mode 100644 index 0000000000000000000000000000000000000000..40695b00d3e4279e767de06749ae0c0c66903dfc --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA2_3_11I1.lean @@ -0,0 +1,977 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Certificates.SupportedContraction + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CA2_3_11I1PairValue (a : PairSlot × PairSlot) : ℝ := pairLaw (below (shape 2 3 11)) (shape 2 3 11) (fun u => (stageALaw (shape 2 3 11) u : ℝ)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) a +def CA2_3_11I1PairRaw (a : PairSlot × PairSlot) : Ball := stageAPairBall (shape 2 3 11) A2_3_11Law 1 a +lemma CA2_3_11I1PairRaw_sound (a : PairSlot × PairSlot) : + (CA2_3_11I1PairRaw a).Encloses (CA2_3_11I1PairValue a) := by + exact stageAPairBall_sound (shape 2 3 11) (by decide +kernel) A2_3_11Law (fun u => (stageALaw (shape 2 3 11) u : ℝ)) (fun u _ => A2_3_11Law_sound u) 1 a +def CA2_3_11I1PairCertificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(2271560897363885769568661563241 / 50000000000000000000000000000000), (13 / 50000000000000000000000000000000)⟩ ⟨(14045314490315458940368407925559 / 100000000000000000000000000000000), (5772260873 / 100000000000000000000000000000000)⟩ ⟨(-77288894756326186137499818697887 / 25000000000000000000000000000000), (12705494267 / 10000000000000000000000000000000)⟩ ⟨-5, 2271560897363885769568661563241, 1562500000000000000000000000000⟩, + .log ⟨(445631426468121811824369066183 / 100000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ ⟨(1206197991236156335588169110941 / 50000000000000000000000000000000), (424647573 / 50000000000000000000000000000000)⟩ ⟨(-541343325265881605206048859565183 / 100000000000000000000000000000000), (9529120691 / 5000000000000000000000000000000)⟩ ⟨-8, 445631426468121811824369066183, 390625000000000000000000000000⟩, + .log ⟨(245112486634681690138917478609 / 100000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ ⟨(736711098549424427900092923637 / 50000000000000000000000000000000), (259522951 / 50000000000000000000000000000000)⟩ ⟨(-601120823067187632449041235450239 / 100000000000000000000000000000000), (211758238053 / 100000000000000000000000000000000)⟩ ⟨-9, 245112486634681690138917478609, 195312500000000000000000000000⟩, + .log ⟨(3478219192845429210452448196343 / 100000000000000000000000000000000), (1 / 6250000000000000000000000000000)⟩ ⟨(1460265002538934125775794000921 / 12500000000000000000000000000000), (1104812363 / 25000000000000000000000000000000)⟩ ⟨(-41983121867151049577989038803243 / 12500000000000000000000000000000), (127054942557 / 100000000000000000000000000000000)⟩ ⟨-5, 3478219192845429210452448196343, 3125000000000000000000000000000⟩, + .log ⟨(333792101685443411124955538513 / 100000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ ⟨(1903418455862116071835962862411 / 100000000000000000000000000000000), (706832283 / 100000000000000000000000000000000)⟩ ⟨(-14256017789598911799381317146333 / 2500000000000000000000000000000), (211758237429 / 100000000000000000000000000000000)⟩ ⟨-9, 333792101685443411124955538513, 195312500000000000000000000000⟩, + .log ⟨(12142111703107679715744582859013 / 100000000000000000000000000000000), (7 / 20000000000000000000000000000000)⟩ ⟨(25601526806740030244864750152551 / 100000000000000000000000000000000), (6427980469 / 50000000000000000000000000000000)⟩ ⟨(-210849046959331770779779818286681 / 100000000000000000000000000000000), (105879118703 / 100000000000000000000000000000000)⟩ ⟨-4, 12142111703107679715744582859013, 6250000000000000000000000000000⟩] +lemma CA2_3_11I1PairCertificates_valid : + CA2_3_11I1PairCertificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_3_11I1PairCertificateIndex (a : PairSlot × PairSlot) : ℕ := + match a.1.1.val, a.1.2.val, a.2.1.val, a.2.2.val with + | 0, 0, 1, 2 => 1 + | 0, 0, 1, 3 => 2 + | 0, 0, 2, 1 => 1 + | 0, 0, 3, 1 => 2 + | 0, 0, 4, 0 => 3 + | 0, 0, 0, 4 => 3 + | 1, 0, 0, 2 => 4 + | 1, 0, 0, 3 => 5 + | 1, 0, 1, 1 => 6 + | 1, 0, 2, 0 => 4 + | 1, 0, 3, 0 => 5 + | 0, 1, 0, 2 => 4 + | 0, 1, 0, 3 => 5 + | 0, 1, 1, 1 => 6 + | 0, 1, 2, 0 => 4 + | 0, 1, 3, 0 => 5 + | 2, 0, 0, 1 => 4 + | 2, 0, 1, 0 => 4 + | 3, 0, 0, 1 => 5 + | 3, 0, 1, 0 => 5 + | 1, 1, 0, 1 => 6 + | 1, 1, 1, 0 => 6 + | 0, 2, 0, 1 => 4 + | 0, 2, 1, 0 => 4 + | 0, 3, 0, 1 => 5 + | 0, 3, 1, 0 => 5 + | 4, 0, 0, 0 => 3 + | 2, 1, 0, 0 => 1 + | 3, 1, 0, 0 => 2 + | 1, 2, 0, 0 => 1 + | 1, 3, 0, 0 => 2 + | 0, 4, 0, 0 => 3 + | _, _, _, _ => 0 +def CA2_3_11I1PairP (a : PairSlot × PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_3_11I1PairCertificates (CA2_3_11I1PairCertificateIndex a)).input +lemma CA2_3_11I1PairP_check_0_0 : ∀ k l : Fin 6, contains (CA2_3_11I1PairRaw ((0,0),(k,l))) (CA2_3_11I1PairP ((0,0),(k,l))) = true := by + decide +kernel +lemma CA2_3_11I1PairP_check_0_1 : ∀ k l : Fin 6, contains (CA2_3_11I1PairRaw ((0,1),(k,l))) (CA2_3_11I1PairP ((0,1),(k,l))) = true := by + decide +kernel +lemma CA2_3_11I1PairP_check_0_2 : ∀ k l : Fin 6, contains (CA2_3_11I1PairRaw ((0,2),(k,l))) (CA2_3_11I1PairP ((0,2),(k,l))) = true := by + decide +kernel +lemma CA2_3_11I1PairP_check_0_3 : ∀ k l : Fin 6, contains (CA2_3_11I1PairRaw ((0,3),(k,l))) (CA2_3_11I1PairP ((0,3),(k,l))) = true := by + decide +kernel +lemma CA2_3_11I1PairP_check_0_4 : ∀ k l : Fin 6, contains (CA2_3_11I1PairRaw ((0,4),(k,l))) (CA2_3_11I1PairP ((0,4),(k,l))) = true := by + decide +kernel +lemma CA2_3_11I1PairP_check_0_5 : ∀ k l : Fin 6, contains (CA2_3_11I1PairRaw ((0,5),(k,l))) (CA2_3_11I1PairP ((0,5),(k,l))) = true := by + decide +kernel +lemma CA2_3_11I1PairP_check_1_0 : ∀ k l : Fin 6, contains (CA2_3_11I1PairRaw ((1,0),(k,l))) (CA2_3_11I1PairP ((1,0),(k,l))) = true := by + decide +kernel +lemma CA2_3_11I1PairP_check_1_1 : ∀ k l : Fin 6, contains (CA2_3_11I1PairRaw ((1,1),(k,l))) (CA2_3_11I1PairP ((1,1),(k,l))) = true := by + decide +kernel +lemma CA2_3_11I1PairP_check_1_2 : ∀ k l : Fin 6, contains (CA2_3_11I1PairRaw ((1,2),(k,l))) (CA2_3_11I1PairP ((1,2),(k,l))) = true := by + decide +kernel +lemma CA2_3_11I1PairP_check_1_3 : ∀ k l : Fin 6, contains (CA2_3_11I1PairRaw ((1,3),(k,l))) (CA2_3_11I1PairP ((1,3),(k,l))) = true := by + decide +kernel +lemma CA2_3_11I1PairP_check_1_4 : ∀ k l : Fin 6, contains (CA2_3_11I1PairRaw ((1,4),(k,l))) (CA2_3_11I1PairP ((1,4),(k,l))) = true := by + decide +kernel +lemma CA2_3_11I1PairP_check_1_5 : ∀ k l : Fin 6, contains (CA2_3_11I1PairRaw ((1,5),(k,l))) (CA2_3_11I1PairP ((1,5),(k,l))) = true := by + decide +kernel +lemma CA2_3_11I1PairP_check_2_0 : ∀ k l : Fin 6, contains (CA2_3_11I1PairRaw ((2,0),(k,l))) (CA2_3_11I1PairP ((2,0),(k,l))) = true := by + decide +kernel +lemma CA2_3_11I1PairP_check_2_1 : ∀ k l : Fin 6, contains (CA2_3_11I1PairRaw ((2,1),(k,l))) (CA2_3_11I1PairP ((2,1),(k,l))) = true := by + decide +kernel +lemma CA2_3_11I1PairP_check_2_2 : ∀ k l : Fin 6, contains (CA2_3_11I1PairRaw ((2,2),(k,l))) (CA2_3_11I1PairP ((2,2),(k,l))) = true := by + decide +kernel +lemma CA2_3_11I1PairP_check_2_3 : ∀ k l : Fin 6, contains (CA2_3_11I1PairRaw ((2,3),(k,l))) (CA2_3_11I1PairP ((2,3),(k,l))) = true := by + decide +kernel +lemma CA2_3_11I1PairP_check_2_4 : ∀ k l : Fin 6, contains (CA2_3_11I1PairRaw ((2,4),(k,l))) (CA2_3_11I1PairP ((2,4),(k,l))) = true := by + decide +kernel +lemma CA2_3_11I1PairP_check_2_5 : ∀ k l : Fin 6, contains (CA2_3_11I1PairRaw ((2,5),(k,l))) (CA2_3_11I1PairP ((2,5),(k,l))) = true := by + decide +kernel +lemma CA2_3_11I1PairP_check_3_0 : ∀ k l : Fin 6, contains (CA2_3_11I1PairRaw ((3,0),(k,l))) (CA2_3_11I1PairP ((3,0),(k,l))) = true := by + decide +kernel +lemma CA2_3_11I1PairP_check_3_1 : ∀ k l : Fin 6, contains (CA2_3_11I1PairRaw ((3,1),(k,l))) (CA2_3_11I1PairP ((3,1),(k,l))) = true := by + decide +kernel +lemma CA2_3_11I1PairP_check_3_2 : ∀ k l : Fin 6, contains (CA2_3_11I1PairRaw ((3,2),(k,l))) (CA2_3_11I1PairP ((3,2),(k,l))) = true := by + decide +kernel +lemma CA2_3_11I1PairP_check_3_3 : ∀ k l : Fin 6, contains (CA2_3_11I1PairRaw ((3,3),(k,l))) (CA2_3_11I1PairP ((3,3),(k,l))) = true := by + decide +kernel +lemma CA2_3_11I1PairP_check_3_4 : ∀ k l : Fin 6, contains (CA2_3_11I1PairRaw ((3,4),(k,l))) (CA2_3_11I1PairP ((3,4),(k,l))) = true := by + decide +kernel +lemma CA2_3_11I1PairP_check_3_5 : ∀ k l : Fin 6, contains (CA2_3_11I1PairRaw ((3,5),(k,l))) (CA2_3_11I1PairP ((3,5),(k,l))) = true := by + decide +kernel +lemma CA2_3_11I1PairP_check_4_0 : ∀ k l : Fin 6, contains (CA2_3_11I1PairRaw ((4,0),(k,l))) (CA2_3_11I1PairP ((4,0),(k,l))) = true := by + decide +kernel +lemma CA2_3_11I1PairP_check_4_1 : ∀ k l : Fin 6, contains (CA2_3_11I1PairRaw ((4,1),(k,l))) (CA2_3_11I1PairP ((4,1),(k,l))) = true := by + decide +kernel +lemma CA2_3_11I1PairP_check_4_2 : ∀ k l : Fin 6, contains (CA2_3_11I1PairRaw ((4,2),(k,l))) (CA2_3_11I1PairP ((4,2),(k,l))) = true := by + decide +kernel +lemma CA2_3_11I1PairP_check_4_3 : ∀ k l : Fin 6, contains (CA2_3_11I1PairRaw ((4,3),(k,l))) (CA2_3_11I1PairP ((4,3),(k,l))) = true := by + decide +kernel +lemma CA2_3_11I1PairP_check_4_4 : ∀ k l : Fin 6, contains (CA2_3_11I1PairRaw ((4,4),(k,l))) (CA2_3_11I1PairP ((4,4),(k,l))) = true := by + decide +kernel +lemma CA2_3_11I1PairP_check_4_5 : ∀ k l : Fin 6, contains (CA2_3_11I1PairRaw ((4,5),(k,l))) (CA2_3_11I1PairP ((4,5),(k,l))) = true := by + decide +kernel +lemma CA2_3_11I1PairP_check_5_0 : ∀ k l : Fin 6, contains (CA2_3_11I1PairRaw ((5,0),(k,l))) (CA2_3_11I1PairP ((5,0),(k,l))) = true := by + decide +kernel +lemma CA2_3_11I1PairP_check_5_1 : ∀ k l : Fin 6, contains (CA2_3_11I1PairRaw ((5,1),(k,l))) (CA2_3_11I1PairP ((5,1),(k,l))) = true := by + decide +kernel +lemma CA2_3_11I1PairP_check_5_2 : ∀ k l : Fin 6, contains (CA2_3_11I1PairRaw ((5,2),(k,l))) (CA2_3_11I1PairP ((5,2),(k,l))) = true := by + decide +kernel +lemma CA2_3_11I1PairP_check_5_3 : ∀ k l : Fin 6, contains (CA2_3_11I1PairRaw ((5,3),(k,l))) (CA2_3_11I1PairP ((5,3),(k,l))) = true := by + decide +kernel +lemma CA2_3_11I1PairP_check_5_4 : ∀ k l : Fin 6, contains (CA2_3_11I1PairRaw ((5,4),(k,l))) (CA2_3_11I1PairP ((5,4),(k,l))) = true := by + decide +kernel +lemma CA2_3_11I1PairP_check_5_5 : ∀ k l : Fin 6, contains (CA2_3_11I1PairRaw ((5,5),(k,l))) (CA2_3_11I1PairP ((5,5),(k,l))) = true := by + decide +kernel +lemma CA2_3_11I1PairP_check (a : PairSlot × PairSlot) : contains (CA2_3_11I1PairRaw a) (CA2_3_11I1PairP a) = true := by + rcases a with ⟨⟨i,j⟩,⟨k,l⟩⟩ + revert j i + apply forall_fin6 + · exact forall_fin6 (CA2_3_11I1PairP_check_0_0 k l) (CA2_3_11I1PairP_check_0_1 k l) (CA2_3_11I1PairP_check_0_2 k l) (CA2_3_11I1PairP_check_0_3 k l) (CA2_3_11I1PairP_check_0_4 k l) (CA2_3_11I1PairP_check_0_5 k l) + · exact forall_fin6 (CA2_3_11I1PairP_check_1_0 k l) (CA2_3_11I1PairP_check_1_1 k l) (CA2_3_11I1PairP_check_1_2 k l) (CA2_3_11I1PairP_check_1_3 k l) (CA2_3_11I1PairP_check_1_4 k l) (CA2_3_11I1PairP_check_1_5 k l) + · exact forall_fin6 (CA2_3_11I1PairP_check_2_0 k l) (CA2_3_11I1PairP_check_2_1 k l) (CA2_3_11I1PairP_check_2_2 k l) (CA2_3_11I1PairP_check_2_3 k l) (CA2_3_11I1PairP_check_2_4 k l) (CA2_3_11I1PairP_check_2_5 k l) + · exact forall_fin6 (CA2_3_11I1PairP_check_3_0 k l) (CA2_3_11I1PairP_check_3_1 k l) (CA2_3_11I1PairP_check_3_2 k l) (CA2_3_11I1PairP_check_3_3 k l) (CA2_3_11I1PairP_check_3_4 k l) (CA2_3_11I1PairP_check_3_5 k l) + · exact forall_fin6 (CA2_3_11I1PairP_check_4_0 k l) (CA2_3_11I1PairP_check_4_1 k l) (CA2_3_11I1PairP_check_4_2 k l) (CA2_3_11I1PairP_check_4_3 k l) (CA2_3_11I1PairP_check_4_4 k l) (CA2_3_11I1PairP_check_4_5 k l) + · exact forall_fin6 (CA2_3_11I1PairP_check_5_0 k l) (CA2_3_11I1PairP_check_5_1 k l) (CA2_3_11I1PairP_check_5_2 k l) (CA2_3_11I1PairP_check_5_3 k l) (CA2_3_11I1PairP_check_5_4 k l) (CA2_3_11I1PairP_check_5_5 k l) +lemma CA2_3_11I1PairP_sound (a : PairSlot × PairSlot) : + (CA2_3_11I1PairP a).Encloses (CA2_3_11I1PairValue a) := + contains_sound (CA2_3_11I1PairRaw_sound a) (CA2_3_11I1PairP_check a) +def CA2_3_11I1PairTerms (a : PairSlot × PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_3_11I1PairCertificates (CA2_3_11I1PairCertificateIndex a)).output +lemma CA2_3_11I1PairTerms_sound (a : PairSlot × PairSlot) : + (CA2_3_11I1PairTerms a).Encloses (Foundation.entropyTerm (CA2_3_11I1PairValue a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_3_11I1PairCertificates_valid + (CA2_3_11I1PairCertificateIndex a) (CA2_3_11I1PairP_sound a) +def CA2_3_11I1PairEntropy : Ball := ⟨(8837967053621728608536788985853 / 3125000000000000000000000000000), (30248726329 / 25000000000000000000000000000000)⟩ +lemma CA2_3_11I1PairEntropy_sound : CA2_3_11I1PairEntropy.Encloses (Foundation.finiteEntropy CA2_3_11I1PairValue) := by + exact contains_sound (entropyDoublePair_enclosed CA2_3_11I1PairValue CA2_3_11I1PairTerms CA2_3_11I1PairTerms_sound) (by decide +kernel) +def CA2_3_11I1PairMass : Ball := ⟨(24999999999999999999999999999999 / 25000000000000000000000000000000), (103 / 25000000000000000000000000000000)⟩ +lemma CA2_3_11I1PairMass_sound : CA2_3_11I1PairMass.Encloses (∑ a, CA2_3_11I1PairValue a) := by + exact contains_sound (doublePairSumBall_sound CA2_3_11I1PairP CA2_3_11I1PairValue CA2_3_11I1PairP_sound) (by decide +kernel) +def CA2_3_11I1PairMassTermLogWitness : LogWitness := ⟨-1, 24999999999999999999999999999999, 12500000000000000000000000000000⟩ +def CA2_3_11I1PairMassTermLog : Ball := ⟨(-1 / 25000000000000000000000000000000), (21175823889 / 50000000000000000000000000000000)⟩ +lemma CA2_3_11I1PairMassTermLog_sound : CA2_3_11I1PairMassTermLog.Encloses (Real.log ((∑ a, CA2_3_11I1PairValue a))) := by + exact checkLog_sound logTwoBall_sound (CA2_3_11I1PairMass_sound) (w := CA2_3_11I1PairMassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA2_3_11I1PairMassTerm : Ball := ⟨(1 / 25000000000000000000000000000000), (42351647779 / 100000000000000000000000000000000)⟩ +lemma CA2_3_11I1PairMassTerm_sound : CA2_3_11I1PairMassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_3_11I1PairValue a))) := by + exact contains_sound (entropyTerm_ball (CA2_3_11I1PairMass_sound) CA2_3_11I1PairMassTermLog_sound) (by decide +kernel) +def CA2_3_11I1PairH : Ball := ⟨(70703736428973828868294311886823 / 25000000000000000000000000000000), (32669310619 / 20000000000000000000000000000000)⟩ +lemma CA2_3_11I1PairH_sound : CA2_3_11I1PairH.Encloses (homogeneousEntropy CA2_3_11I1PairValue) := by + exact contains_sound (homogeneous_enclosed CA2_3_11I1PairValue CA2_3_11I1PairMassTerm_sound CA2_3_11I1PairEntropy_sound) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CA2_3_11I1R0Value (a : PairSlot) : ℝ := residualLaw (below (shape 2 3 11)) (fun u => (stageALaw (shape 2 3 11) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 0 a +def CA2_3_11I1R0Raw (a : PairSlot) : Ball := residualBall (below (shape 2 3 11)) A2_3_11Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 0 a +lemma CA2_3_11I1R0Raw_sound (a : PairSlot) : + (CA2_3_11I1R0Raw a).Encloses (CA2_3_11I1R0Value a) := by + exact residualBall_sound_on (below (shape 2 3 11)) A2_3_11Law (fun u => (stageALaw (shape 2 3 11) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A2_3_11Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 2 3 11) (show (shape 2 3 11) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 0 a +def CA2_3_11I1R0Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(2616932853915287520550304835637 / 25000000000000000000000000000000), (21 / 50000000000000000000000000000000)⟩ ⟨(23624338930499515612716987850007 / 100000000000000000000000000000000), (5541570939 / 50000000000000000000000000000000)⟩ ⟨(-225687285930495800137701698295113 / 100000000000000000000000000000000), (3308722463 / 3125000000000000000000000000000)⟩ ⟨-4, 2616932853915287520550304835637, 1562500000000000000000000000000⟩] +lemma CA2_3_11I1R0Certificates_valid : + CA2_3_11I1R0Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_3_11I1R0CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 0, 0 => 1 + | _, _ => 0 +def CA2_3_11I1R0P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_3_11I1R0Certificates (CA2_3_11I1R0CertificateIndex a)).input +lemma CA2_3_11I1R0P_check : ∀ a : PairSlot, contains (CA2_3_11I1R0Raw a) (CA2_3_11I1R0P a) = true := by + decide +kernel +lemma CA2_3_11I1R0P_sound (a : PairSlot) : + (CA2_3_11I1R0P a).Encloses (CA2_3_11I1R0Value a) := + contains_sound (CA2_3_11I1R0Raw_sound a) (CA2_3_11I1R0P_check a) +def CA2_3_11I1R0Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_3_11I1R0Certificates (CA2_3_11I1R0CertificateIndex a)).output +lemma CA2_3_11I1R0Terms_sound (a : PairSlot) : + (CA2_3_11I1R0Terms a).Encloses (Foundation.entropyTerm (CA2_3_11I1R0Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_3_11I1R0Certificates_valid + (CA2_3_11I1R0CertificateIndex a) (CA2_3_11I1R0P_sound a) +def CA2_3_11I1R0Entropy : Ball := ⟨(23624338930499515612716987850007 / 100000000000000000000000000000000), (5541570939 / 50000000000000000000000000000000)⟩ +lemma CA2_3_11I1R0Entropy_sound : CA2_3_11I1R0Entropy.Encloses (Foundation.finiteEntropy CA2_3_11I1R0Value) := by + exact contains_sound (entropyPair_enclosed CA2_3_11I1R0Value CA2_3_11I1R0Terms CA2_3_11I1R0Terms_sound) (by decide +kernel) +def CA2_3_11I1R0Mass : Ball := ⟨(2616932853915287520550304835637 / 25000000000000000000000000000000), (21 / 50000000000000000000000000000000)⟩ +lemma CA2_3_11I1R0Mass_sound : CA2_3_11I1R0Mass.Encloses (∑ a, CA2_3_11I1R0Value a) := by + exact contains_sound (pairSumBall_sound CA2_3_11I1R0P CA2_3_11I1R0Value CA2_3_11I1R0P_sound) (by decide +kernel) +def CA2_3_11I1R0MassTermLogWitness : LogWitness := ⟨-4, 2616932853915287520550304835637, 1562500000000000000000000000000⟩ +def CA2_3_11I1R0MassTermLog : Ball := ⟨(-225687285930495800137701698295113 / 100000000000000000000000000000000), (3308722463 / 3125000000000000000000000000000)⟩ +lemma CA2_3_11I1R0MassTermLog_sound : CA2_3_11I1R0MassTermLog.Encloses (Real.log ((∑ a, CA2_3_11I1R0Value a))) := by + exact checkLog_sound logTwoBall_sound (CA2_3_11I1R0Mass_sound) (w := CA2_3_11I1R0MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA2_3_11I1R0MassTerm : Ball := ⟨(23624338930499515612716987850007 / 100000000000000000000000000000000), (5541570939 / 50000000000000000000000000000000)⟩ +lemma CA2_3_11I1R0MassTerm_sound : CA2_3_11I1R0MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_3_11I1R0Value a))) := by + exact contains_sound (entropyTerm_ball (CA2_3_11I1R0Mass_sound) CA2_3_11I1R0MassTermLog_sound) (by decide +kernel) +def CA2_3_11I1R0H : Ball := ⟨0, (5541570939 / 25000000000000000000000000000000)⟩ +lemma CA2_3_11I1R0H_sound : CA2_3_11I1R0H.Encloses (homogeneousEntropy CA2_3_11I1R0Value) := by + exact contains_sound (homogeneous_enclosed CA2_3_11I1R0Value CA2_3_11I1R0MassTerm_sound CA2_3_11I1R0Entropy_sound) (by decide +kernel) +def CA2_3_11I1R1Value (a : PairSlot) : ℝ := residualLaw (below (shape 2 3 11)) (fun u => (stageALaw (shape 2 3 11) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 1 a +def CA2_3_11I1R1Raw (a : PairSlot) : Ball := residualBall (below (shape 2 3 11)) A2_3_11Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 1 a +lemma CA2_3_11I1R1Raw_sound (a : PairSlot) : + (CA2_3_11I1R1Raw a).Encloses (CA2_3_11I1R1Value a) := by + exact residualBall_sound_on (below (shape 2 3 11)) A2_3_11Law (fun u => (stageALaw (shape 2 3 11) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A2_3_11Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 2 3 11) (show (shape 2 3 11) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 1 a +def CA2_3_11I1R1Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(9883067146084712479449695164363 / 50000000000000000000000000000000), (23 / 50000000000000000000000000000000)⟩ ⟨(32044858929775539194174820947917 / 100000000000000000000000000000000), (4185641777 / 25000000000000000000000000000000)⟩ ⟨(-4053000254894360938496064162113 / 2500000000000000000000000000000), (21175823741 / 25000000000000000000000000000000)⟩ ⟨-3, 9883067146084712479449695164363, 6250000000000000000000000000000⟩] +lemma CA2_3_11I1R1Certificates_valid : + CA2_3_11I1R1Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_3_11I1R1CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 1, 0 => 1 + | 0, 1 => 1 + | _, _ => 0 +def CA2_3_11I1R1P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_3_11I1R1Certificates (CA2_3_11I1R1CertificateIndex a)).input +lemma CA2_3_11I1R1P_check : ∀ a : PairSlot, contains (CA2_3_11I1R1Raw a) (CA2_3_11I1R1P a) = true := by + decide +kernel +lemma CA2_3_11I1R1P_sound (a : PairSlot) : + (CA2_3_11I1R1P a).Encloses (CA2_3_11I1R1Value a) := + contains_sound (CA2_3_11I1R1Raw_sound a) (CA2_3_11I1R1P_check a) +def CA2_3_11I1R1Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_3_11I1R1Certificates (CA2_3_11I1R1CertificateIndex a)).output +lemma CA2_3_11I1R1Terms_sound (a : PairSlot) : + (CA2_3_11I1R1Terms a).Encloses (Foundation.entropyTerm (CA2_3_11I1R1Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_3_11I1R1Certificates_valid + (CA2_3_11I1R1CertificateIndex a) (CA2_3_11I1R1P_sound a) +def CA2_3_11I1R1Entropy : Ball := ⟨(32044858929775539194174820947917 / 50000000000000000000000000000000), (4185641777 / 12500000000000000000000000000000)⟩ +lemma CA2_3_11I1R1Entropy_sound : CA2_3_11I1R1Entropy.Encloses (Foundation.finiteEntropy CA2_3_11I1R1Value) := by + exact contains_sound (entropyPair_enclosed CA2_3_11I1R1Value CA2_3_11I1R1Terms CA2_3_11I1R1Terms_sound) (by decide +kernel) +def CA2_3_11I1R1Mass : Ball := ⟨(9883067146084712479449695164363 / 25000000000000000000000000000000), (23 / 25000000000000000000000000000000)⟩ +lemma CA2_3_11I1R1Mass_sound : CA2_3_11I1R1Mass.Encloses (∑ a, CA2_3_11I1R1Value a) := by + exact contains_sound (pairSumBall_sound CA2_3_11I1R1P CA2_3_11I1R1Value CA2_3_11I1R1P_sound) (by decide +kernel) +def CA2_3_11I1R1MassTermLogWitness : LogWitness := ⟨-2, 9883067146084712479449695164363, 6250000000000000000000000000000⟩ +def CA2_3_11I1R1MassTermLog : Ball := ⟨(-9280529213977990659811937343419 / 10000000000000000000000000000000), (63527471281 / 100000000000000000000000000000000)⟩ +lemma CA2_3_11I1R1MassTermLog_sound : CA2_3_11I1R1MassTermLog.Encloses (Real.log ((∑ a, CA2_3_11I1R1Value a))) := by + exact checkLog_sound logTwoBall_sound (CA2_3_11I1R1Mass_sound) (w := CA2_3_11I1R1MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA2_3_11I1R1MassTerm : Ball := ⟨(36688037349178104038961450659137 / 100000000000000000000000000000000), (12556925329 / 50000000000000000000000000000000)⟩ +lemma CA2_3_11I1R1MassTerm_sound : CA2_3_11I1R1MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_3_11I1R1Value a))) := by + exact contains_sound (entropyTerm_ball (CA2_3_11I1R1Mass_sound) CA2_3_11I1R1MassTermLog_sound) (by decide +kernel) +def CA2_3_11I1R1H : Ball := ⟨(27401680510372974349388191236697 / 100000000000000000000000000000000), (29299492437 / 50000000000000000000000000000000)⟩ +lemma CA2_3_11I1R1H_sound : CA2_3_11I1R1H.Encloses (homogeneousEntropy CA2_3_11I1R1Value) := by + exact contains_sound (homogeneous_enclosed CA2_3_11I1R1Value CA2_3_11I1R1MassTerm_sound CA2_3_11I1R1Entropy_sound) (by decide +kernel) +def CA2_3_11I1R2Value (a : PairSlot) : ℝ := residualLaw (below (shape 2 3 11)) (fun u => (stageALaw (shape 2 3 11) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 2 a +def CA2_3_11I1R2Raw (a : PairSlot) : Ball := residualBall (below (shape 2 3 11)) A2_3_11Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 2 a +lemma CA2_3_11I1R2Raw_sound (a : PairSlot) : + (CA2_3_11I1R2Raw a).Encloses (CA2_3_11I1R2Value a) := by + exact residualBall_sound_on (below (shape 2 3 11)) A2_3_11Law (fun u => (stageALaw (shape 2 3 11) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A2_3_11Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 2 3 11) (show (shape 2 3 11) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 2 a +def CA2_3_11I1R2Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(3478219192845429210452448196343 / 50000000000000000000000000000000), (29 / 100000000000000000000000000000000)⟩ ⟨(2317800548355293762733205614737 / 12500000000000000000000000000000), (7365415743 / 100000000000000000000000000000000)⟩ ⟨(-133275128440606932841094558687807 / 50000000000000000000000000000000), (105879118831 / 100000000000000000000000000000000)⟩ ⟨-4, 3478219192845429210452448196343, 3125000000000000000000000000000⟩, + .log ⟨(667584203370886822249911077027 / 100000000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ ⟨(33441028033713448054116710973 / 1000000000000000000000000000000), (127229811 / 10000000000000000000000000000000)⟩ ⟨(-12523149838199048525838237320071 / 2500000000000000000000000000000), (95291206873 / 50000000000000000000000000000000)⟩ ⟨-8, 667584203370886822249911077027, 390625000000000000000000000000⟩, + .log ⟨(12142111703107679715744582859013 / 50000000000000000000000000000000), (3 / 5000000000000000000000000000000)⟩ ⟨(34370512627374052637955936517139 / 100000000000000000000000000000000), (20569537471 / 100000000000000000000000000000000)⟩ ⟨(-141534328903337239838056625236351 / 100000000000000000000000000000000), (84703294979 / 100000000000000000000000000000000)⟩ ⟨-3, 12142111703107679715744582859013, 6250000000000000000000000000000⟩] +lemma CA2_3_11I1R2Certificates_valid : + CA2_3_11I1R2Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_3_11I1R2CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 2, 0 => 1 + | 3, 0 => 2 + | 1, 1 => 3 + | 0, 2 => 1 + | 0, 3 => 2 + | _, _ => 0 +def CA2_3_11I1R2P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_3_11I1R2Certificates (CA2_3_11I1R2CertificateIndex a)).input +lemma CA2_3_11I1R2P_check : ∀ a : PairSlot, contains (CA2_3_11I1R2Raw a) (CA2_3_11I1R2P a) = true := by + decide +kernel +lemma CA2_3_11I1R2P_sound (a : PairSlot) : + (CA2_3_11I1R2P a).Encloses (CA2_3_11I1R2Value a) := + contains_sound (CA2_3_11I1R2Raw_sound a) (CA2_3_11I1R2P_check a) +def CA2_3_11I1R2Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_3_11I1R2Certificates (CA2_3_11I1R2CertificateIndex a)).output +lemma CA2_3_11I1R2Terms_sound (a : PairSlot) : + (CA2_3_11I1R2Terms a).Encloses (Foundation.entropyTerm (CA2_3_11I1R2Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_3_11I1R2Certificates_valid + (CA2_3_11I1R2CertificateIndex a) (CA2_3_11I1R2P_sound a) +def CA2_3_11I1R2Entropy : Ball := ⟨(78143527007801442452510568547531 / 100000000000000000000000000000000), (37844965177 / 100000000000000000000000000000000)⟩ +lemma CA2_3_11I1R2Entropy_sound : CA2_3_11I1R2Entropy.Encloses (Foundation.finiteEntropy CA2_3_11I1R2Value) := by + exact contains_sound (entropyPair_enclosed CA2_3_11I1R2Value CA2_3_11I1R2Terms CA2_3_11I1R2Terms_sound) (by decide +kernel) +def CA2_3_11I1R2Mass : Ball := ⟨(9883067146084712479449695164363 / 25000000000000000000000000000000), (63 / 50000000000000000000000000000000)⟩ +lemma CA2_3_11I1R2Mass_sound : CA2_3_11I1R2Mass.Encloses (∑ a, CA2_3_11I1R2Value a) := by + exact contains_sound (pairSumBall_sound CA2_3_11I1R2P CA2_3_11I1R2Value CA2_3_11I1R2P_sound) (by decide +kernel) +def CA2_3_11I1R2MassTermLogWitness : LogWitness := ⟨-2, 9883067146084712479449695164363, 6250000000000000000000000000000⟩ +def CA2_3_11I1R2MassTermLog : Ball := ⟨(-9280529213977990659811937343419 / 10000000000000000000000000000000), (63527471367 / 100000000000000000000000000000000)⟩ +lemma CA2_3_11I1R2MassTermLog_sound : CA2_3_11I1R2MassTermLog.Encloses (Real.log ((∑ a, CA2_3_11I1R2Value a))) := by + exact checkLog_sound logTwoBall_sound (CA2_3_11I1R2Mass_sound) (w := CA2_3_11I1R2MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA2_3_11I1R2MassTerm : Ball := ⟨(36688037349178104038961450659137 / 100000000000000000000000000000000), (25113850723 / 100000000000000000000000000000000)⟩ +lemma CA2_3_11I1R2MassTerm_sound : CA2_3_11I1R2MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_3_11I1R2Value a))) := by + exact contains_sound (entropyTerm_ball (CA2_3_11I1R2Mass_sound) CA2_3_11I1R2MassTermLog_sound) (by decide +kernel) +def CA2_3_11I1R2H : Ball := ⟨(20727744829311669206774558944197 / 50000000000000000000000000000000), (629588159 / 1000000000000000000000000000000)⟩ +lemma CA2_3_11I1R2H_sound : CA2_3_11I1R2H.Encloses (homogeneousEntropy CA2_3_11I1R2Value) := by + exact contains_sound (homogeneous_enclosed CA2_3_11I1R2Value CA2_3_11I1R2MassTerm_sound CA2_3_11I1R2Entropy_sound) (by decide +kernel) +def CA2_3_11I1R3Value (a : PairSlot) : ℝ := residualLaw (below (shape 2 3 11)) (fun u => (stageALaw (shape 2 3 11) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 3 a +def CA2_3_11I1R3Raw (a : PairSlot) : Ball := residualBall (below (shape 2 3 11)) A2_3_11Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 3 a +lemma CA2_3_11I1R3Raw_sound (a : PairSlot) : + (CA2_3_11I1R3Raw a).Encloses (CA2_3_11I1R3Value a) := by + exact residualBall_sound_on (below (shape 2 3 11)) A2_3_11Law (fun u => (stageALaw (shape 2 3 11) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A2_3_11Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 2 3 11) (show (shape 2 3 11) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 3 a +def CA2_3_11I1R3Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(245112486634681690138917478609 / 100000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ ⟨(736711098549424427900092923637 / 50000000000000000000000000000000), (259522951 / 50000000000000000000000000000000)⟩ ⟨(-601120823067187632449041235450239 / 100000000000000000000000000000000), (211758238053 / 100000000000000000000000000000000)⟩ ⟨-9, 245112486634681690138917478609, 195312500000000000000000000000⟩, + .log ⟨(2271560897363885769568661563241 / 50000000000000000000000000000000), (13 / 50000000000000000000000000000000)⟩ ⟨(14045314490315458940368407925559 / 100000000000000000000000000000000), (5772260873 / 100000000000000000000000000000000)⟩ ⟨(-77288894756326186137499818697887 / 25000000000000000000000000000000), (12705494267 / 10000000000000000000000000000000)⟩ ⟨-5, 2271560897363885769568661563241, 1562500000000000000000000000000⟩, + .log ⟨(445631426468121811824369066183 / 100000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ ⟨(1206197991236156335588169110941 / 50000000000000000000000000000000), (424647573 / 50000000000000000000000000000000)⟩ ⟨(-541343325265881605206048859565183 / 100000000000000000000000000000000), (9529120691 / 5000000000000000000000000000000)⟩ ⟨-8, 445631426468121811824369066183, 390625000000000000000000000000⟩] +lemma CA2_3_11I1R3Certificates_valid : + CA2_3_11I1R3Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_3_11I1R3CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 4, 0 => 1 + | 2, 1 => 2 + | 3, 1 => 3 + | 1, 2 => 2 + | 1, 3 => 3 + | 0, 4 => 1 + | _, _ => 0 +def CA2_3_11I1R3P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_3_11I1R3Certificates (CA2_3_11I1R3CertificateIndex a)).input +lemma CA2_3_11I1R3P_check : ∀ a : PairSlot, contains (CA2_3_11I1R3Raw a) (CA2_3_11I1R3P a) = true := by + decide +kernel +lemma CA2_3_11I1R3P_sound (a : PairSlot) : + (CA2_3_11I1R3P a).Encloses (CA2_3_11I1R3Value a) := + contains_sound (CA2_3_11I1R3Raw_sound a) (CA2_3_11I1R3P_check a) +def CA2_3_11I1R3Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_3_11I1R3Certificates (CA2_3_11I1R3CertificateIndex a)).output +lemma CA2_3_11I1R3Terms_sound (a : PairSlot) : + (CA2_3_11I1R3Terms a).Encloses (Foundation.entropyTerm (CA2_3_11I1R3Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_3_11I1R3Certificates_valid + (CA2_3_11I1R3CertificateIndex a) (CA2_3_11I1R3P_sound a) +def CA2_3_11I1R3Entropy : Ball := ⟨(3586226533977324093468986398943 / 10000000000000000000000000000000), (7140601921 / 50000000000000000000000000000000)⟩ +lemma CA2_3_11I1R3Entropy_sound : CA2_3_11I1R3Entropy.Encloses (Foundation.finiteEntropy CA2_3_11I1R3Value) := by + exact contains_sound (entropyPair_enclosed CA2_3_11I1R3Value CA2_3_11I1R3Terms CA2_3_11I1R3Terms_sound) (by decide +kernel) +def CA2_3_11I1R3Mass : Ball := ⟨(2616932853915287520550304835637 / 25000000000000000000000000000000), (1 / 1562500000000000000000000000000)⟩ +lemma CA2_3_11I1R3Mass_sound : CA2_3_11I1R3Mass.Encloses (∑ a, CA2_3_11I1R3Value a) := by + exact contains_sound (pairSumBall_sound CA2_3_11I1R3P CA2_3_11I1R3Value CA2_3_11I1R3P_sound) (by decide +kernel) +def CA2_3_11I1R3MassTermLogWitness : LogWitness := ⟨-4, 2616932853915287520550304835637, 1562500000000000000000000000000⟩ +def CA2_3_11I1R3MassTermLog : Ball := ⟨(-225687285930495800137701698295113 / 100000000000000000000000000000000), (52939559513 / 50000000000000000000000000000000)⟩ +lemma CA2_3_11I1R3MassTermLog_sound : CA2_3_11I1R3MassTermLog.Encloses (Real.log ((∑ a, CA2_3_11I1R3Value a))) := by + exact checkLog_sound logTwoBall_sound (CA2_3_11I1R3Mass_sound) (w := CA2_3_11I1R3MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA2_3_11I1R3MassTerm : Ball := ⟨(23624338930499515612716987850007 / 100000000000000000000000000000000), (221662839 / 2000000000000000000000000000000)⟩ +lemma CA2_3_11I1R3MassTerm_sound : CA2_3_11I1R3MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_3_11I1R3Value a))) := by + exact contains_sound (entropyTerm_ball (CA2_3_11I1R3Mass_sound) CA2_3_11I1R3MassTermLog_sound) (by decide +kernel) +def CA2_3_11I1R3H : Ball := ⟨(12237926409273725321972876139423 / 100000000000000000000000000000000), (396317903 / 1562500000000000000000000000000)⟩ +lemma CA2_3_11I1R3H_sound : CA2_3_11I1R3H.Encloses (homogeneousEntropy CA2_3_11I1R3Value) := by + exact contains_sound (homogeneous_enclosed CA2_3_11I1R3Value CA2_3_11I1R3MassTerm_sound CA2_3_11I1R3Entropy_sound) (by decide +kernel) +def CA2_3_11I1R4Value (a : PairSlot) : ℝ := residualLaw (below (shape 2 3 11)) (fun u => (stageALaw (shape 2 3 11) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 4 a +def CA2_3_11I1R4Raw (a : PairSlot) : Ball := residualBall (below (shape 2 3 11)) A2_3_11Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 4 a +lemma CA2_3_11I1R4Raw_sound (a : PairSlot) : + (CA2_3_11I1R4Raw a).Encloses (CA2_3_11I1R4Value a) := by + exact residualBall_sound_on (below (shape 2 3 11)) A2_3_11Law (fun u => (stageALaw (shape 2 3 11) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A2_3_11Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 2 3 11) (show (shape 2 3 11) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 4 a +def CA2_3_11I1R4Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA2_3_11I1R4Certificates_valid : + CA2_3_11I1R4Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_3_11I1R4CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA2_3_11I1R4P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_3_11I1R4Certificates (CA2_3_11I1R4CertificateIndex a)).input +lemma CA2_3_11I1R4P_check : ∀ a : PairSlot, contains (CA2_3_11I1R4Raw a) (CA2_3_11I1R4P a) = true := by + decide +kernel +lemma CA2_3_11I1R4P_sound (a : PairSlot) : + (CA2_3_11I1R4P a).Encloses (CA2_3_11I1R4Value a) := + contains_sound (CA2_3_11I1R4Raw_sound a) (CA2_3_11I1R4P_check a) +def CA2_3_11I1R4Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_3_11I1R4Certificates (CA2_3_11I1R4CertificateIndex a)).output +lemma CA2_3_11I1R4Terms_sound (a : PairSlot) : + (CA2_3_11I1R4Terms a).Encloses (Foundation.entropyTerm (CA2_3_11I1R4Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_3_11I1R4Certificates_valid + (CA2_3_11I1R4CertificateIndex a) (CA2_3_11I1R4P_sound a) +def CA2_3_11I1R4Entropy : Ball := ⟨0, 0⟩ +lemma CA2_3_11I1R4Entropy_sound : CA2_3_11I1R4Entropy.Encloses (Foundation.finiteEntropy CA2_3_11I1R4Value) := by + exact contains_sound (entropyPair_enclosed CA2_3_11I1R4Value CA2_3_11I1R4Terms CA2_3_11I1R4Terms_sound) (by decide +kernel) +def CA2_3_11I1R4Mass : Ball := ⟨0, 0⟩ +lemma CA2_3_11I1R4Mass_sound : CA2_3_11I1R4Mass.Encloses (∑ a, CA2_3_11I1R4Value a) := by + exact contains_sound (pairSumBall_sound CA2_3_11I1R4P CA2_3_11I1R4Value CA2_3_11I1R4P_sound) (by decide +kernel) +def CA2_3_11I1R4MassTerm : Ball := .exact 0 +lemma CA2_3_11I1R4MassTerm_sound : CA2_3_11I1R4MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_3_11I1R4Value a))) := + entropyTerm_zero_ball (CA2_3_11I1R4Mass_sound) +def CA2_3_11I1R4H : Ball := ⟨0, 0⟩ +lemma CA2_3_11I1R4H_sound : CA2_3_11I1R4H.Encloses (homogeneousEntropy CA2_3_11I1R4Value) := by + exact contains_sound (homogeneous_enclosed CA2_3_11I1R4Value CA2_3_11I1R4MassTerm_sound CA2_3_11I1R4Entropy_sound) (by decide +kernel) +def CA2_3_11I1R5Value (a : PairSlot) : ℝ := residualLaw (below (shape 2 3 11)) (fun u => (stageALaw (shape 2 3 11) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 5 a +def CA2_3_11I1R5Raw (a : PairSlot) : Ball := residualBall (below (shape 2 3 11)) A2_3_11Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 5 a +lemma CA2_3_11I1R5Raw_sound (a : PairSlot) : + (CA2_3_11I1R5Raw a).Encloses (CA2_3_11I1R5Value a) := by + exact residualBall_sound_on (below (shape 2 3 11)) A2_3_11Law (fun u => (stageALaw (shape 2 3 11) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A2_3_11Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 2 3 11) (show (shape 2 3 11) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 5 a +def CA2_3_11I1R5Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA2_3_11I1R5Certificates_valid : + CA2_3_11I1R5Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_3_11I1R5CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA2_3_11I1R5P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_3_11I1R5Certificates (CA2_3_11I1R5CertificateIndex a)).input +lemma CA2_3_11I1R5P_check : ∀ a : PairSlot, contains (CA2_3_11I1R5Raw a) (CA2_3_11I1R5P a) = true := by + decide +kernel +lemma CA2_3_11I1R5P_sound (a : PairSlot) : + (CA2_3_11I1R5P a).Encloses (CA2_3_11I1R5Value a) := + contains_sound (CA2_3_11I1R5Raw_sound a) (CA2_3_11I1R5P_check a) +def CA2_3_11I1R5Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_3_11I1R5Certificates (CA2_3_11I1R5CertificateIndex a)).output +lemma CA2_3_11I1R5Terms_sound (a : PairSlot) : + (CA2_3_11I1R5Terms a).Encloses (Foundation.entropyTerm (CA2_3_11I1R5Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_3_11I1R5Certificates_valid + (CA2_3_11I1R5CertificateIndex a) (CA2_3_11I1R5P_sound a) +def CA2_3_11I1R5Entropy : Ball := ⟨0, 0⟩ +lemma CA2_3_11I1R5Entropy_sound : CA2_3_11I1R5Entropy.Encloses (Foundation.finiteEntropy CA2_3_11I1R5Value) := by + exact contains_sound (entropyPair_enclosed CA2_3_11I1R5Value CA2_3_11I1R5Terms CA2_3_11I1R5Terms_sound) (by decide +kernel) +def CA2_3_11I1R5Mass : Ball := ⟨0, 0⟩ +lemma CA2_3_11I1R5Mass_sound : CA2_3_11I1R5Mass.Encloses (∑ a, CA2_3_11I1R5Value a) := by + exact contains_sound (pairSumBall_sound CA2_3_11I1R5P CA2_3_11I1R5Value CA2_3_11I1R5P_sound) (by decide +kernel) +def CA2_3_11I1R5MassTerm : Ball := .exact 0 +lemma CA2_3_11I1R5MassTerm_sound : CA2_3_11I1R5MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_3_11I1R5Value a))) := + entropyTerm_zero_ball (CA2_3_11I1R5Mass_sound) +def CA2_3_11I1R5H : Ball := ⟨0, 0⟩ +lemma CA2_3_11I1R5H_sound : CA2_3_11I1R5H.Encloses (homogeneousEntropy CA2_3_11I1R5Value) := by + exact contains_sound (homogeneous_enclosed CA2_3_11I1R5Value CA2_3_11I1R5MassTerm_sound CA2_3_11I1R5Entropy_sound) (by decide +kernel) +def CA2_3_11I1R6Value (a : PairSlot) : ℝ := residualLaw (below (shape 2 3 11)) (fun u => (stageALaw (shape 2 3 11) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 6 a +def CA2_3_11I1R6Raw (a : PairSlot) : Ball := residualBall (below (shape 2 3 11)) A2_3_11Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 6 a +lemma CA2_3_11I1R6Raw_sound (a : PairSlot) : + (CA2_3_11I1R6Raw a).Encloses (CA2_3_11I1R6Value a) := by + exact residualBall_sound_on (below (shape 2 3 11)) A2_3_11Law (fun u => (stageALaw (shape 2 3 11) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A2_3_11Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 2 3 11) (show (shape 2 3 11) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 6 a +def CA2_3_11I1R6Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA2_3_11I1R6Certificates_valid : + CA2_3_11I1R6Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_3_11I1R6CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA2_3_11I1R6P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_3_11I1R6Certificates (CA2_3_11I1R6CertificateIndex a)).input +lemma CA2_3_11I1R6P_check : ∀ a : PairSlot, contains (CA2_3_11I1R6Raw a) (CA2_3_11I1R6P a) = true := by + decide +kernel +lemma CA2_3_11I1R6P_sound (a : PairSlot) : + (CA2_3_11I1R6P a).Encloses (CA2_3_11I1R6Value a) := + contains_sound (CA2_3_11I1R6Raw_sound a) (CA2_3_11I1R6P_check a) +def CA2_3_11I1R6Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_3_11I1R6Certificates (CA2_3_11I1R6CertificateIndex a)).output +lemma CA2_3_11I1R6Terms_sound (a : PairSlot) : + (CA2_3_11I1R6Terms a).Encloses (Foundation.entropyTerm (CA2_3_11I1R6Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_3_11I1R6Certificates_valid + (CA2_3_11I1R6CertificateIndex a) (CA2_3_11I1R6P_sound a) +def CA2_3_11I1R6Entropy : Ball := ⟨0, 0⟩ +lemma CA2_3_11I1R6Entropy_sound : CA2_3_11I1R6Entropy.Encloses (Foundation.finiteEntropy CA2_3_11I1R6Value) := by + exact contains_sound (entropyPair_enclosed CA2_3_11I1R6Value CA2_3_11I1R6Terms CA2_3_11I1R6Terms_sound) (by decide +kernel) +def CA2_3_11I1R6Mass : Ball := ⟨0, 0⟩ +lemma CA2_3_11I1R6Mass_sound : CA2_3_11I1R6Mass.Encloses (∑ a, CA2_3_11I1R6Value a) := by + exact contains_sound (pairSumBall_sound CA2_3_11I1R6P CA2_3_11I1R6Value CA2_3_11I1R6P_sound) (by decide +kernel) +def CA2_3_11I1R6MassTerm : Ball := .exact 0 +lemma CA2_3_11I1R6MassTerm_sound : CA2_3_11I1R6MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_3_11I1R6Value a))) := + entropyTerm_zero_ball (CA2_3_11I1R6Mass_sound) +def CA2_3_11I1R6H : Ball := ⟨0, 0⟩ +lemma CA2_3_11I1R6H_sound : CA2_3_11I1R6H.Encloses (homogeneousEntropy CA2_3_11I1R6Value) := by + exact contains_sound (homogeneous_enclosed CA2_3_11I1R6Value CA2_3_11I1R6MassTerm_sound CA2_3_11I1R6Entropy_sound) (by decide +kernel) +def CA2_3_11I1R7Value (a : PairSlot) : ℝ := residualLaw (below (shape 2 3 11)) (fun u => (stageALaw (shape 2 3 11) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 7 a +def CA2_3_11I1R7Raw (a : PairSlot) : Ball := residualBall (below (shape 2 3 11)) A2_3_11Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 7 a +lemma CA2_3_11I1R7Raw_sound (a : PairSlot) : + (CA2_3_11I1R7Raw a).Encloses (CA2_3_11I1R7Value a) := by + exact residualBall_sound_on (below (shape 2 3 11)) A2_3_11Law (fun u => (stageALaw (shape 2 3 11) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A2_3_11Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 2 3 11) (show (shape 2 3 11) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 7 a +def CA2_3_11I1R7Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA2_3_11I1R7Certificates_valid : + CA2_3_11I1R7Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_3_11I1R7CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA2_3_11I1R7P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_3_11I1R7Certificates (CA2_3_11I1R7CertificateIndex a)).input +lemma CA2_3_11I1R7P_check : ∀ a : PairSlot, contains (CA2_3_11I1R7Raw a) (CA2_3_11I1R7P a) = true := by + decide +kernel +lemma CA2_3_11I1R7P_sound (a : PairSlot) : + (CA2_3_11I1R7P a).Encloses (CA2_3_11I1R7Value a) := + contains_sound (CA2_3_11I1R7Raw_sound a) (CA2_3_11I1R7P_check a) +def CA2_3_11I1R7Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_3_11I1R7Certificates (CA2_3_11I1R7CertificateIndex a)).output +lemma CA2_3_11I1R7Terms_sound (a : PairSlot) : + (CA2_3_11I1R7Terms a).Encloses (Foundation.entropyTerm (CA2_3_11I1R7Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_3_11I1R7Certificates_valid + (CA2_3_11I1R7CertificateIndex a) (CA2_3_11I1R7P_sound a) +def CA2_3_11I1R7Entropy : Ball := ⟨0, 0⟩ +lemma CA2_3_11I1R7Entropy_sound : CA2_3_11I1R7Entropy.Encloses (Foundation.finiteEntropy CA2_3_11I1R7Value) := by + exact contains_sound (entropyPair_enclosed CA2_3_11I1R7Value CA2_3_11I1R7Terms CA2_3_11I1R7Terms_sound) (by decide +kernel) +def CA2_3_11I1R7Mass : Ball := ⟨0, 0⟩ +lemma CA2_3_11I1R7Mass_sound : CA2_3_11I1R7Mass.Encloses (∑ a, CA2_3_11I1R7Value a) := by + exact contains_sound (pairSumBall_sound CA2_3_11I1R7P CA2_3_11I1R7Value CA2_3_11I1R7P_sound) (by decide +kernel) +def CA2_3_11I1R7MassTerm : Ball := .exact 0 +lemma CA2_3_11I1R7MassTerm_sound : CA2_3_11I1R7MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_3_11I1R7Value a))) := + entropyTerm_zero_ball (CA2_3_11I1R7Mass_sound) +def CA2_3_11I1R7H : Ball := ⟨0, 0⟩ +lemma CA2_3_11I1R7H_sound : CA2_3_11I1R7H.Encloses (homogeneousEntropy CA2_3_11I1R7Value) := by + exact contains_sound (homogeneous_enclosed CA2_3_11I1R7Value CA2_3_11I1R7MassTerm_sound CA2_3_11I1R7Entropy_sound) (by decide +kernel) +def CA2_3_11I1R8Value (a : PairSlot) : ℝ := residualLaw (below (shape 2 3 11)) (fun u => (stageALaw (shape 2 3 11) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 8 a +def CA2_3_11I1R8Raw (a : PairSlot) : Ball := residualBall (below (shape 2 3 11)) A2_3_11Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 8 a +lemma CA2_3_11I1R8Raw_sound (a : PairSlot) : + (CA2_3_11I1R8Raw a).Encloses (CA2_3_11I1R8Value a) := by + exact residualBall_sound_on (below (shape 2 3 11)) A2_3_11Law (fun u => (stageALaw (shape 2 3 11) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A2_3_11Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 2 3 11) (show (shape 2 3 11) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 8 a +def CA2_3_11I1R8Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA2_3_11I1R8Certificates_valid : + CA2_3_11I1R8Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_3_11I1R8CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA2_3_11I1R8P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_3_11I1R8Certificates (CA2_3_11I1R8CertificateIndex a)).input +lemma CA2_3_11I1R8P_check : ∀ a : PairSlot, contains (CA2_3_11I1R8Raw a) (CA2_3_11I1R8P a) = true := by + decide +kernel +lemma CA2_3_11I1R8P_sound (a : PairSlot) : + (CA2_3_11I1R8P a).Encloses (CA2_3_11I1R8Value a) := + contains_sound (CA2_3_11I1R8Raw_sound a) (CA2_3_11I1R8P_check a) +def CA2_3_11I1R8Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_3_11I1R8Certificates (CA2_3_11I1R8CertificateIndex a)).output +lemma CA2_3_11I1R8Terms_sound (a : PairSlot) : + (CA2_3_11I1R8Terms a).Encloses (Foundation.entropyTerm (CA2_3_11I1R8Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_3_11I1R8Certificates_valid + (CA2_3_11I1R8CertificateIndex a) (CA2_3_11I1R8P_sound a) +def CA2_3_11I1R8Entropy : Ball := ⟨0, 0⟩ +lemma CA2_3_11I1R8Entropy_sound : CA2_3_11I1R8Entropy.Encloses (Foundation.finiteEntropy CA2_3_11I1R8Value) := by + exact contains_sound (entropyPair_enclosed CA2_3_11I1R8Value CA2_3_11I1R8Terms CA2_3_11I1R8Terms_sound) (by decide +kernel) +def CA2_3_11I1R8Mass : Ball := ⟨0, 0⟩ +lemma CA2_3_11I1R8Mass_sound : CA2_3_11I1R8Mass.Encloses (∑ a, CA2_3_11I1R8Value a) := by + exact contains_sound (pairSumBall_sound CA2_3_11I1R8P CA2_3_11I1R8Value CA2_3_11I1R8P_sound) (by decide +kernel) +def CA2_3_11I1R8MassTerm : Ball := .exact 0 +lemma CA2_3_11I1R8MassTerm_sound : CA2_3_11I1R8MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_3_11I1R8Value a))) := + entropyTerm_zero_ball (CA2_3_11I1R8Mass_sound) +def CA2_3_11I1R8H : Ball := ⟨0, 0⟩ +lemma CA2_3_11I1R8H_sound : CA2_3_11I1R8H.Encloses (homogeneousEntropy CA2_3_11I1R8Value) := by + exact contains_sound (homogeneous_enclosed CA2_3_11I1R8Value CA2_3_11I1R8MassTerm_sound CA2_3_11I1R8Entropy_sound) (by decide +kernel) +def CA2_3_11I1R9Value (a : PairSlot) : ℝ := residualLaw (below (shape 2 3 11)) (fun u => (stageALaw (shape 2 3 11) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 9 a +def CA2_3_11I1R9Raw (a : PairSlot) : Ball := residualBall (below (shape 2 3 11)) A2_3_11Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 9 a +lemma CA2_3_11I1R9Raw_sound (a : PairSlot) : + (CA2_3_11I1R9Raw a).Encloses (CA2_3_11I1R9Value a) := by + exact residualBall_sound_on (below (shape 2 3 11)) A2_3_11Law (fun u => (stageALaw (shape 2 3 11) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A2_3_11Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 2 3 11) (show (shape 2 3 11) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 9 a +def CA2_3_11I1R9Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA2_3_11I1R9Certificates_valid : + CA2_3_11I1R9Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_3_11I1R9CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA2_3_11I1R9P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_3_11I1R9Certificates (CA2_3_11I1R9CertificateIndex a)).input +lemma CA2_3_11I1R9P_check : ∀ a : PairSlot, contains (CA2_3_11I1R9Raw a) (CA2_3_11I1R9P a) = true := by + decide +kernel +lemma CA2_3_11I1R9P_sound (a : PairSlot) : + (CA2_3_11I1R9P a).Encloses (CA2_3_11I1R9Value a) := + contains_sound (CA2_3_11I1R9Raw_sound a) (CA2_3_11I1R9P_check a) +def CA2_3_11I1R9Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_3_11I1R9Certificates (CA2_3_11I1R9CertificateIndex a)).output +lemma CA2_3_11I1R9Terms_sound (a : PairSlot) : + (CA2_3_11I1R9Terms a).Encloses (Foundation.entropyTerm (CA2_3_11I1R9Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_3_11I1R9Certificates_valid + (CA2_3_11I1R9CertificateIndex a) (CA2_3_11I1R9P_sound a) +def CA2_3_11I1R9Entropy : Ball := ⟨0, 0⟩ +lemma CA2_3_11I1R9Entropy_sound : CA2_3_11I1R9Entropy.Encloses (Foundation.finiteEntropy CA2_3_11I1R9Value) := by + exact contains_sound (entropyPair_enclosed CA2_3_11I1R9Value CA2_3_11I1R9Terms CA2_3_11I1R9Terms_sound) (by decide +kernel) +def CA2_3_11I1R9Mass : Ball := ⟨0, 0⟩ +lemma CA2_3_11I1R9Mass_sound : CA2_3_11I1R9Mass.Encloses (∑ a, CA2_3_11I1R9Value a) := by + exact contains_sound (pairSumBall_sound CA2_3_11I1R9P CA2_3_11I1R9Value CA2_3_11I1R9P_sound) (by decide +kernel) +def CA2_3_11I1R9MassTerm : Ball := .exact 0 +lemma CA2_3_11I1R9MassTerm_sound : CA2_3_11I1R9MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_3_11I1R9Value a))) := + entropyTerm_zero_ball (CA2_3_11I1R9Mass_sound) +def CA2_3_11I1R9H : Ball := ⟨0, 0⟩ +lemma CA2_3_11I1R9H_sound : CA2_3_11I1R9H.Encloses (homogeneousEntropy CA2_3_11I1R9Value) := by + exact contains_sound (homogeneous_enclosed CA2_3_11I1R9Value CA2_3_11I1R9MassTerm_sound CA2_3_11I1R9Entropy_sound) (by decide +kernel) +def CA2_3_11I1R10Value (a : PairSlot) : ℝ := residualLaw (below (shape 2 3 11)) (fun u => (stageALaw (shape 2 3 11) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 10 a +def CA2_3_11I1R10Raw (a : PairSlot) : Ball := residualBall (below (shape 2 3 11)) A2_3_11Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 10 a +lemma CA2_3_11I1R10Raw_sound (a : PairSlot) : + (CA2_3_11I1R10Raw a).Encloses (CA2_3_11I1R10Value a) := by + exact residualBall_sound_on (below (shape 2 3 11)) A2_3_11Law (fun u => (stageALaw (shape 2 3 11) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A2_3_11Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 2 3 11) (show (shape 2 3 11) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 10 a +def CA2_3_11I1R10Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA2_3_11I1R10Certificates_valid : + CA2_3_11I1R10Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_3_11I1R10CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA2_3_11I1R10P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_3_11I1R10Certificates (CA2_3_11I1R10CertificateIndex a)).input +lemma CA2_3_11I1R10P_check : ∀ a : PairSlot, contains (CA2_3_11I1R10Raw a) (CA2_3_11I1R10P a) = true := by + decide +kernel +lemma CA2_3_11I1R10P_sound (a : PairSlot) : + (CA2_3_11I1R10P a).Encloses (CA2_3_11I1R10Value a) := + contains_sound (CA2_3_11I1R10Raw_sound a) (CA2_3_11I1R10P_check a) +def CA2_3_11I1R10Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_3_11I1R10Certificates (CA2_3_11I1R10CertificateIndex a)).output +lemma CA2_3_11I1R10Terms_sound (a : PairSlot) : + (CA2_3_11I1R10Terms a).Encloses (Foundation.entropyTerm (CA2_3_11I1R10Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_3_11I1R10Certificates_valid + (CA2_3_11I1R10CertificateIndex a) (CA2_3_11I1R10P_sound a) +def CA2_3_11I1R10Entropy : Ball := ⟨0, 0⟩ +lemma CA2_3_11I1R10Entropy_sound : CA2_3_11I1R10Entropy.Encloses (Foundation.finiteEntropy CA2_3_11I1R10Value) := by + exact contains_sound (entropyPair_enclosed CA2_3_11I1R10Value CA2_3_11I1R10Terms CA2_3_11I1R10Terms_sound) (by decide +kernel) +def CA2_3_11I1R10Mass : Ball := ⟨0, 0⟩ +lemma CA2_3_11I1R10Mass_sound : CA2_3_11I1R10Mass.Encloses (∑ a, CA2_3_11I1R10Value a) := by + exact contains_sound (pairSumBall_sound CA2_3_11I1R10P CA2_3_11I1R10Value CA2_3_11I1R10P_sound) (by decide +kernel) +def CA2_3_11I1R10MassTerm : Ball := .exact 0 +lemma CA2_3_11I1R10MassTerm_sound : CA2_3_11I1R10MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_3_11I1R10Value a))) := + entropyTerm_zero_ball (CA2_3_11I1R10Mass_sound) +def CA2_3_11I1R10H : Ball := ⟨0, 0⟩ +lemma CA2_3_11I1R10H_sound : CA2_3_11I1R10H.Encloses (homogeneousEntropy CA2_3_11I1R10Value) := by + exact contains_sound (homogeneous_enclosed CA2_3_11I1R10Value CA2_3_11I1R10MassTerm_sound CA2_3_11I1R10Entropy_sound) (by decide +kernel) +def CA2_3_11I1R11Value (a : PairSlot) : ℝ := residualLaw (below (shape 2 3 11)) (fun u => (stageALaw (shape 2 3 11) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 11 a +def CA2_3_11I1R11Raw (a : PairSlot) : Ball := residualBall (below (shape 2 3 11)) A2_3_11Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 11 a +lemma CA2_3_11I1R11Raw_sound (a : PairSlot) : + (CA2_3_11I1R11Raw a).Encloses (CA2_3_11I1R11Value a) := by + exact residualBall_sound_on (below (shape 2 3 11)) A2_3_11Law (fun u => (stageALaw (shape 2 3 11) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A2_3_11Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 2 3 11) (show (shape 2 3 11) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 11 a +def CA2_3_11I1R11Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA2_3_11I1R11Certificates_valid : + CA2_3_11I1R11Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_3_11I1R11CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA2_3_11I1R11P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_3_11I1R11Certificates (CA2_3_11I1R11CertificateIndex a)).input +lemma CA2_3_11I1R11P_check : ∀ a : PairSlot, contains (CA2_3_11I1R11Raw a) (CA2_3_11I1R11P a) = true := by + decide +kernel +lemma CA2_3_11I1R11P_sound (a : PairSlot) : + (CA2_3_11I1R11P a).Encloses (CA2_3_11I1R11Value a) := + contains_sound (CA2_3_11I1R11Raw_sound a) (CA2_3_11I1R11P_check a) +def CA2_3_11I1R11Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_3_11I1R11Certificates (CA2_3_11I1R11CertificateIndex a)).output +lemma CA2_3_11I1R11Terms_sound (a : PairSlot) : + (CA2_3_11I1R11Terms a).Encloses (Foundation.entropyTerm (CA2_3_11I1R11Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_3_11I1R11Certificates_valid + (CA2_3_11I1R11CertificateIndex a) (CA2_3_11I1R11P_sound a) +def CA2_3_11I1R11Entropy : Ball := ⟨0, 0⟩ +lemma CA2_3_11I1R11Entropy_sound : CA2_3_11I1R11Entropy.Encloses (Foundation.finiteEntropy CA2_3_11I1R11Value) := by + exact contains_sound (entropyPair_enclosed CA2_3_11I1R11Value CA2_3_11I1R11Terms CA2_3_11I1R11Terms_sound) (by decide +kernel) +def CA2_3_11I1R11Mass : Ball := ⟨0, 0⟩ +lemma CA2_3_11I1R11Mass_sound : CA2_3_11I1R11Mass.Encloses (∑ a, CA2_3_11I1R11Value a) := by + exact contains_sound (pairSumBall_sound CA2_3_11I1R11P CA2_3_11I1R11Value CA2_3_11I1R11P_sound) (by decide +kernel) +def CA2_3_11I1R11MassTerm : Ball := .exact 0 +lemma CA2_3_11I1R11MassTerm_sound : CA2_3_11I1R11MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_3_11I1R11Value a))) := + entropyTerm_zero_ball (CA2_3_11I1R11Mass_sound) +def CA2_3_11I1R11H : Ball := ⟨0, 0⟩ +lemma CA2_3_11I1R11H_sound : CA2_3_11I1R11H.Encloses (homogeneousEntropy CA2_3_11I1R11Value) := by + exact contains_sound (homogeneous_enclosed CA2_3_11I1R11Value CA2_3_11I1R11MassTerm_sound CA2_3_11I1R11Entropy_sound) (by decide +kernel) +def CA2_3_11I1R12Value (a : PairSlot) : ℝ := residualLaw (below (shape 2 3 11)) (fun u => (stageALaw (shape 2 3 11) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 12 a +def CA2_3_11I1R12Raw (a : PairSlot) : Ball := residualBall (below (shape 2 3 11)) A2_3_11Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 12 a +lemma CA2_3_11I1R12Raw_sound (a : PairSlot) : + (CA2_3_11I1R12Raw a).Encloses (CA2_3_11I1R12Value a) := by + exact residualBall_sound_on (below (shape 2 3 11)) A2_3_11Law (fun u => (stageALaw (shape 2 3 11) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A2_3_11Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 2 3 11) (show (shape 2 3 11) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 12 a +def CA2_3_11I1R12Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA2_3_11I1R12Certificates_valid : + CA2_3_11I1R12Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_3_11I1R12CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA2_3_11I1R12P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_3_11I1R12Certificates (CA2_3_11I1R12CertificateIndex a)).input +lemma CA2_3_11I1R12P_check : ∀ a : PairSlot, contains (CA2_3_11I1R12Raw a) (CA2_3_11I1R12P a) = true := by + decide +kernel +lemma CA2_3_11I1R12P_sound (a : PairSlot) : + (CA2_3_11I1R12P a).Encloses (CA2_3_11I1R12Value a) := + contains_sound (CA2_3_11I1R12Raw_sound a) (CA2_3_11I1R12P_check a) +def CA2_3_11I1R12Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_3_11I1R12Certificates (CA2_3_11I1R12CertificateIndex a)).output +lemma CA2_3_11I1R12Terms_sound (a : PairSlot) : + (CA2_3_11I1R12Terms a).Encloses (Foundation.entropyTerm (CA2_3_11I1R12Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_3_11I1R12Certificates_valid + (CA2_3_11I1R12CertificateIndex a) (CA2_3_11I1R12P_sound a) +def CA2_3_11I1R12Entropy : Ball := ⟨0, 0⟩ +lemma CA2_3_11I1R12Entropy_sound : CA2_3_11I1R12Entropy.Encloses (Foundation.finiteEntropy CA2_3_11I1R12Value) := by + exact contains_sound (entropyPair_enclosed CA2_3_11I1R12Value CA2_3_11I1R12Terms CA2_3_11I1R12Terms_sound) (by decide +kernel) +def CA2_3_11I1R12Mass : Ball := ⟨0, 0⟩ +lemma CA2_3_11I1R12Mass_sound : CA2_3_11I1R12Mass.Encloses (∑ a, CA2_3_11I1R12Value a) := by + exact contains_sound (pairSumBall_sound CA2_3_11I1R12P CA2_3_11I1R12Value CA2_3_11I1R12P_sound) (by decide +kernel) +def CA2_3_11I1R12MassTerm : Ball := .exact 0 +lemma CA2_3_11I1R12MassTerm_sound : CA2_3_11I1R12MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_3_11I1R12Value a))) := + entropyTerm_zero_ball (CA2_3_11I1R12Mass_sound) +def CA2_3_11I1R12H : Ball := ⟨0, 0⟩ +lemma CA2_3_11I1R12H_sound : CA2_3_11I1R12H.Encloses (homogeneousEntropy CA2_3_11I1R12Value) := by + exact contains_sound (homogeneous_enclosed CA2_3_11I1R12Value CA2_3_11I1R12MassTerm_sound CA2_3_11I1R12Entropy_sound) (by decide +kernel) +def CA2_3_11I1R13Value (a : PairSlot) : ℝ := residualLaw (below (shape 2 3 11)) (fun u => (stageALaw (shape 2 3 11) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 13 a +def CA2_3_11I1R13Raw (a : PairSlot) : Ball := residualBall (below (shape 2 3 11)) A2_3_11Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 13 a +lemma CA2_3_11I1R13Raw_sound (a : PairSlot) : + (CA2_3_11I1R13Raw a).Encloses (CA2_3_11I1R13Value a) := by + exact residualBall_sound_on (below (shape 2 3 11)) A2_3_11Law (fun u => (stageALaw (shape 2 3 11) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A2_3_11Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 2 3 11) (show (shape 2 3 11) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 13 a +def CA2_3_11I1R13Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA2_3_11I1R13Certificates_valid : + CA2_3_11I1R13Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_3_11I1R13CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA2_3_11I1R13P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_3_11I1R13Certificates (CA2_3_11I1R13CertificateIndex a)).input +lemma CA2_3_11I1R13P_check : ∀ a : PairSlot, contains (CA2_3_11I1R13Raw a) (CA2_3_11I1R13P a) = true := by + decide +kernel +lemma CA2_3_11I1R13P_sound (a : PairSlot) : + (CA2_3_11I1R13P a).Encloses (CA2_3_11I1R13Value a) := + contains_sound (CA2_3_11I1R13Raw_sound a) (CA2_3_11I1R13P_check a) +def CA2_3_11I1R13Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_3_11I1R13Certificates (CA2_3_11I1R13CertificateIndex a)).output +lemma CA2_3_11I1R13Terms_sound (a : PairSlot) : + (CA2_3_11I1R13Terms a).Encloses (Foundation.entropyTerm (CA2_3_11I1R13Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_3_11I1R13Certificates_valid + (CA2_3_11I1R13CertificateIndex a) (CA2_3_11I1R13P_sound a) +def CA2_3_11I1R13Entropy : Ball := ⟨0, 0⟩ +lemma CA2_3_11I1R13Entropy_sound : CA2_3_11I1R13Entropy.Encloses (Foundation.finiteEntropy CA2_3_11I1R13Value) := by + exact contains_sound (entropyPair_enclosed CA2_3_11I1R13Value CA2_3_11I1R13Terms CA2_3_11I1R13Terms_sound) (by decide +kernel) +def CA2_3_11I1R13Mass : Ball := ⟨0, 0⟩ +lemma CA2_3_11I1R13Mass_sound : CA2_3_11I1R13Mass.Encloses (∑ a, CA2_3_11I1R13Value a) := by + exact contains_sound (pairSumBall_sound CA2_3_11I1R13P CA2_3_11I1R13Value CA2_3_11I1R13P_sound) (by decide +kernel) +def CA2_3_11I1R13MassTerm : Ball := .exact 0 +lemma CA2_3_11I1R13MassTerm_sound : CA2_3_11I1R13MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_3_11I1R13Value a))) := + entropyTerm_zero_ball (CA2_3_11I1R13Mass_sound) +def CA2_3_11I1R13H : Ball := ⟨0, 0⟩ +lemma CA2_3_11I1R13H_sound : CA2_3_11I1R13H.Encloses (homogeneousEntropy CA2_3_11I1R13Value) := by + exact contains_sound (homogeneous_enclosed CA2_3_11I1R13Value CA2_3_11I1R13MassTerm_sound CA2_3_11I1R13Entropy_sound) (by decide +kernel) +def CA2_3_11I1R14Value (a : PairSlot) : ℝ := residualLaw (below (shape 2 3 11)) (fun u => (stageALaw (shape 2 3 11) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 14 a +def CA2_3_11I1R14Raw (a : PairSlot) : Ball := residualBall (below (shape 2 3 11)) A2_3_11Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 14 a +lemma CA2_3_11I1R14Raw_sound (a : PairSlot) : + (CA2_3_11I1R14Raw a).Encloses (CA2_3_11I1R14Value a) := by + exact residualBall_sound_on (below (shape 2 3 11)) A2_3_11Law (fun u => (stageALaw (shape 2 3 11) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A2_3_11Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 2 3 11) (show (shape 2 3 11) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 14 a +def CA2_3_11I1R14Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA2_3_11I1R14Certificates_valid : + CA2_3_11I1R14Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_3_11I1R14CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA2_3_11I1R14P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_3_11I1R14Certificates (CA2_3_11I1R14CertificateIndex a)).input +lemma CA2_3_11I1R14P_check : ∀ a : PairSlot, contains (CA2_3_11I1R14Raw a) (CA2_3_11I1R14P a) = true := by + decide +kernel +lemma CA2_3_11I1R14P_sound (a : PairSlot) : + (CA2_3_11I1R14P a).Encloses (CA2_3_11I1R14Value a) := + contains_sound (CA2_3_11I1R14Raw_sound a) (CA2_3_11I1R14P_check a) +def CA2_3_11I1R14Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_3_11I1R14Certificates (CA2_3_11I1R14CertificateIndex a)).output +lemma CA2_3_11I1R14Terms_sound (a : PairSlot) : + (CA2_3_11I1R14Terms a).Encloses (Foundation.entropyTerm (CA2_3_11I1R14Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_3_11I1R14Certificates_valid + (CA2_3_11I1R14CertificateIndex a) (CA2_3_11I1R14P_sound a) +def CA2_3_11I1R14Entropy : Ball := ⟨0, 0⟩ +lemma CA2_3_11I1R14Entropy_sound : CA2_3_11I1R14Entropy.Encloses (Foundation.finiteEntropy CA2_3_11I1R14Value) := by + exact contains_sound (entropyPair_enclosed CA2_3_11I1R14Value CA2_3_11I1R14Terms CA2_3_11I1R14Terms_sound) (by decide +kernel) +def CA2_3_11I1R14Mass : Ball := ⟨0, 0⟩ +lemma CA2_3_11I1R14Mass_sound : CA2_3_11I1R14Mass.Encloses (∑ a, CA2_3_11I1R14Value a) := by + exact contains_sound (pairSumBall_sound CA2_3_11I1R14P CA2_3_11I1R14Value CA2_3_11I1R14P_sound) (by decide +kernel) +def CA2_3_11I1R14MassTerm : Ball := .exact 0 +lemma CA2_3_11I1R14MassTerm_sound : CA2_3_11I1R14MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_3_11I1R14Value a))) := + entropyTerm_zero_ball (CA2_3_11I1R14Mass_sound) +def CA2_3_11I1R14H : Ball := ⟨0, 0⟩ +lemma CA2_3_11I1R14H_sound : CA2_3_11I1R14H.Encloses (homogeneousEntropy CA2_3_11I1R14Value) := by + exact contains_sound (homogeneous_enclosed CA2_3_11I1R14Value CA2_3_11I1R14MassTerm_sound CA2_3_11I1R14Entropy_sound) (by decide +kernel) +def CA2_3_11I1R15Value (a : PairSlot) : ℝ := residualLaw (below (shape 2 3 11)) (fun u => (stageALaw (shape 2 3 11) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 15 a +def CA2_3_11I1R15Raw (a : PairSlot) : Ball := residualBall (below (shape 2 3 11)) A2_3_11Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 15 a +lemma CA2_3_11I1R15Raw_sound (a : PairSlot) : + (CA2_3_11I1R15Raw a).Encloses (CA2_3_11I1R15Value a) := by + exact residualBall_sound_on (below (shape 2 3 11)) A2_3_11Law (fun u => (stageALaw (shape 2 3 11) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A2_3_11Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 2 3 11) (show (shape 2 3 11) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 15 a +def CA2_3_11I1R15Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA2_3_11I1R15Certificates_valid : + CA2_3_11I1R15Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_3_11I1R15CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA2_3_11I1R15P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_3_11I1R15Certificates (CA2_3_11I1R15CertificateIndex a)).input +lemma CA2_3_11I1R15P_check : ∀ a : PairSlot, contains (CA2_3_11I1R15Raw a) (CA2_3_11I1R15P a) = true := by + decide +kernel +lemma CA2_3_11I1R15P_sound (a : PairSlot) : + (CA2_3_11I1R15P a).Encloses (CA2_3_11I1R15Value a) := + contains_sound (CA2_3_11I1R15Raw_sound a) (CA2_3_11I1R15P_check a) +def CA2_3_11I1R15Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_3_11I1R15Certificates (CA2_3_11I1R15CertificateIndex a)).output +lemma CA2_3_11I1R15Terms_sound (a : PairSlot) : + (CA2_3_11I1R15Terms a).Encloses (Foundation.entropyTerm (CA2_3_11I1R15Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_3_11I1R15Certificates_valid + (CA2_3_11I1R15CertificateIndex a) (CA2_3_11I1R15P_sound a) +def CA2_3_11I1R15Entropy : Ball := ⟨0, 0⟩ +lemma CA2_3_11I1R15Entropy_sound : CA2_3_11I1R15Entropy.Encloses (Foundation.finiteEntropy CA2_3_11I1R15Value) := by + exact contains_sound (entropyPair_enclosed CA2_3_11I1R15Value CA2_3_11I1R15Terms CA2_3_11I1R15Terms_sound) (by decide +kernel) +def CA2_3_11I1R15Mass : Ball := ⟨0, 0⟩ +lemma CA2_3_11I1R15Mass_sound : CA2_3_11I1R15Mass.Encloses (∑ a, CA2_3_11I1R15Value a) := by + exact contains_sound (pairSumBall_sound CA2_3_11I1R15P CA2_3_11I1R15Value CA2_3_11I1R15P_sound) (by decide +kernel) +def CA2_3_11I1R15MassTerm : Ball := .exact 0 +lemma CA2_3_11I1R15MassTerm_sound : CA2_3_11I1R15MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_3_11I1R15Value a))) := + entropyTerm_zero_ball (CA2_3_11I1R15Mass_sound) +def CA2_3_11I1R15H : Ball := ⟨0, 0⟩ +lemma CA2_3_11I1R15H_sound : CA2_3_11I1R15H.Encloses (homogeneousEntropy CA2_3_11I1R15Value) := by + exact contains_sound (homogeneous_enclosed CA2_3_11I1R15Value CA2_3_11I1R15MassTerm_sound CA2_3_11I1R15Entropy_sound) (by decide +kernel) +def CA2_3_11I1R16Value (a : PairSlot) : ℝ := residualLaw (below (shape 2 3 11)) (fun u => (stageALaw (shape 2 3 11) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 16 a +def CA2_3_11I1R16Raw (a : PairSlot) : Ball := residualBall (below (shape 2 3 11)) A2_3_11Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 16 a +lemma CA2_3_11I1R16Raw_sound (a : PairSlot) : + (CA2_3_11I1R16Raw a).Encloses (CA2_3_11I1R16Value a) := by + exact residualBall_sound_on (below (shape 2 3 11)) A2_3_11Law (fun u => (stageALaw (shape 2 3 11) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A2_3_11Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 2 3 11) (show (shape 2 3 11) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 16 a +def CA2_3_11I1R16Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA2_3_11I1R16Certificates_valid : + CA2_3_11I1R16Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_3_11I1R16CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA2_3_11I1R16P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_3_11I1R16Certificates (CA2_3_11I1R16CertificateIndex a)).input +lemma CA2_3_11I1R16P_check : ∀ a : PairSlot, contains (CA2_3_11I1R16Raw a) (CA2_3_11I1R16P a) = true := by + decide +kernel +lemma CA2_3_11I1R16P_sound (a : PairSlot) : + (CA2_3_11I1R16P a).Encloses (CA2_3_11I1R16Value a) := + contains_sound (CA2_3_11I1R16Raw_sound a) (CA2_3_11I1R16P_check a) +def CA2_3_11I1R16Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_3_11I1R16Certificates (CA2_3_11I1R16CertificateIndex a)).output +lemma CA2_3_11I1R16Terms_sound (a : PairSlot) : + (CA2_3_11I1R16Terms a).Encloses (Foundation.entropyTerm (CA2_3_11I1R16Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_3_11I1R16Certificates_valid + (CA2_3_11I1R16CertificateIndex a) (CA2_3_11I1R16P_sound a) +def CA2_3_11I1R16Entropy : Ball := ⟨0, 0⟩ +lemma CA2_3_11I1R16Entropy_sound : CA2_3_11I1R16Entropy.Encloses (Foundation.finiteEntropy CA2_3_11I1R16Value) := by + exact contains_sound (entropyPair_enclosed CA2_3_11I1R16Value CA2_3_11I1R16Terms CA2_3_11I1R16Terms_sound) (by decide +kernel) +def CA2_3_11I1R16Mass : Ball := ⟨0, 0⟩ +lemma CA2_3_11I1R16Mass_sound : CA2_3_11I1R16Mass.Encloses (∑ a, CA2_3_11I1R16Value a) := by + exact contains_sound (pairSumBall_sound CA2_3_11I1R16P CA2_3_11I1R16Value CA2_3_11I1R16P_sound) (by decide +kernel) +def CA2_3_11I1R16MassTerm : Ball := .exact 0 +lemma CA2_3_11I1R16MassTerm_sound : CA2_3_11I1R16MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_3_11I1R16Value a))) := + entropyTerm_zero_ball (CA2_3_11I1R16Mass_sound) +def CA2_3_11I1R16H : Ball := ⟨0, 0⟩ +lemma CA2_3_11I1R16H_sound : CA2_3_11I1R16H.Encloses (homogeneousEntropy CA2_3_11I1R16Value) := by + exact contains_sound (homogeneous_enclosed CA2_3_11I1R16Value CA2_3_11I1R16MassTerm_sound CA2_3_11I1R16Entropy_sound) (by decide +kernel) +def CA2_3_11I1ResidualEntropies (a : Fin 17) : Ball := + match a.val with + | 0 => CA2_3_11I1R0H + | 1 => CA2_3_11I1R1H + | 2 => CA2_3_11I1R2H + | 3 => CA2_3_11I1R3H + | 4 => CA2_3_11I1R4H + | 5 => CA2_3_11I1R5H + | 6 => CA2_3_11I1R6H + | 7 => CA2_3_11I1R7H + | 8 => CA2_3_11I1R8H + | 9 => CA2_3_11I1R9H + | 10 => CA2_3_11I1R10H + | 11 => CA2_3_11I1R11H + | 12 => CA2_3_11I1R12H + | 13 => CA2_3_11I1R13H + | 14 => CA2_3_11I1R14H + | 15 => CA2_3_11I1R15H + | 16 => CA2_3_11I1R16H + | _ => (.exact 0) +lemma CA2_3_11I1ResidualEntropies_sound (k : Fin 17) : + (CA2_3_11I1ResidualEntropies k).Encloses (homogeneousEntropy + (residualLaw (below (shape 2 3 11)) (fun u => (stageALaw (shape 2 3 11) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) k)) := by + fin_cases k + · exact CA2_3_11I1R0H_sound + · exact CA2_3_11I1R1H_sound + · exact CA2_3_11I1R2H_sound + · exact CA2_3_11I1R3H_sound + · exact CA2_3_11I1R4H_sound + · exact CA2_3_11I1R5H_sound + · exact CA2_3_11I1R6H_sound + · exact CA2_3_11I1R7H_sound + · exact CA2_3_11I1R8H_sound + · exact CA2_3_11I1R9H_sound + · exact CA2_3_11I1R10H_sound + · exact CA2_3_11I1R11H_sound + · exact CA2_3_11I1R12H_sound + · exact CA2_3_11I1R13H_sound + · exact CA2_3_11I1R14H_sound + · exact CA2_3_11I1R15H_sound + · exact CA2_3_11I1R16H_sound +def CA2_3_11I1Singles (s : Shape) : Ball := + match s 0, s 1, s 2 with + | _, _, _ => (.exact 0) +lemma CA2_3_11I1Singles_sound (u : Shape) (hu : u ∈ below (shape 2 3 11)) + (hd : designated (Equiv.refl (Fin 3)) 1 u) : + (CA2_3_11I1Singles u).Encloses (homogeneousEntropy ((fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) u)) := by + rw [A2_3_11_below] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 0 0 8) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 0 1 7) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 0 2 6) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 0 3 5) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 1 0 7) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 1 1 6) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 1 2 5) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 1 3 4) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 2 0 6) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 2 1 5) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 2 2 4) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 2 3 3) by decide +kernel) hd |>.elim +def CA2_3_11I1Singleton : Ball := ⟨0, 0⟩ +lemma CA2_3_11I1Singleton_sound : CA2_3_11I1Singleton.Encloses + (singletonEntropy (below (shape 2 3 11)) (fun u => (stageALaw (shape 2 3 11) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ))) := by + exact contains_sound (singletonBall_sound (below (shape 2 3 11)) A2_3_11Law (fun u => (stageALaw (shape 2 3 11) u : ℝ)) (Equiv.refl (Fin 3)) 1 + CA2_3_11I1Singles (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A2_3_11Law_sound u) CA2_3_11I1Singles_sound) (by decide +kernel) +def CA2_3_11I1Group : Ball := ⟨(40547548289135019042455092632257 / 50000000000000000000000000000000), (84544215161 / 50000000000000000000000000000000)⟩ +lemma CA2_3_11I1Group_sound : CA2_3_11I1Group.Encloses + (groupedEntropy (below (shape 2 3 11)) (fun u => (stageALaw (shape 2 3 11) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ))) := by + exact contains_sound (Ball.add_sound CA2_3_11I1Singleton_sound + (finSumBall_sound 17 CA2_3_11I1ResidualEntropies _ CA2_3_11I1ResidualEntropies_sound)) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CA2_3_11I1H : Ball := ⟨(15078094069919404912919609627283 / 12500000000000000000000000000000), (501523413739 / 100000000000000000000000000000000)⟩ +lemma CA2_3_11I1_sound : CA2_3_11I1H.Encloses (stageACapacity (shape 2 3 11) 1) := by + have hb := contains_sound (Ball.add_sound CA2_3_11I1PairH_sound + (Ball.neg_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) CA2_3_11I1Group_sound))) + (show contains (.add CA2_3_11I1PairH (.neg (.mul (.exact 2) CA2_3_11I1Group))) CA2_3_11I1H = true by decide +kernel) + unfold CA2_3_11I1PairValue at hb + simpa only [stageACapacity, nativeCapacity, + show (1 : Fin 3) ≠ 0 by decide, ite_false, sub_eq_add_neg] using hb + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA2_3_11I2.lean b/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA2_3_11I2.lean new file mode 100644 index 0000000000000000000000000000000000000000..c02495bfe9f0430ead0612b46fd3aaee99f47f65 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA2_3_11I2.lean @@ -0,0 +1,1084 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Certificates.SupportedContraction + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CA2_3_11I2PairValue (a : PairSlot × PairSlot) : ℝ := pairLaw (below (shape 2 3 11)) (shape 2 3 11) (fun u => (stageALaw (shape 2 3 11) u : ℝ)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) a +def CA2_3_11I2PairRaw (a : PairSlot × PairSlot) : Ball := stageAPairBall (shape 2 3 11) A2_3_11Law 2 a +lemma CA2_3_11I2PairRaw_sound (a : PairSlot × PairSlot) : + (CA2_3_11I2PairRaw a).Encloses (CA2_3_11I2PairValue a) := by + exact stageAPairBall_sound (shape 2 3 11) (by decide +kernel) A2_3_11Law (fun u => (stageALaw (shape 2 3 11) u : ℝ)) (fun u _ => A2_3_11Law_sound u) 2 a +def CA2_3_11I2PairCertificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(514093738669073721436557579 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(1565193747281701732814757813 / 25000000000000000000000000000000), (1034211 / 50000000000000000000000000000000)⟩ ⟨(-48713100496693021950406840784137 / 4000000000000000000000000000000), (402340844493 / 100000000000000000000000000000000)⟩ ⟨-18, 514093738669073721436557579, 381469726562500000000000000⟩, + .log ⟨(18286587627341528161390875447 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(19673528357962647637477614739 / 12500000000000000000000000000000), (13553177 / 25000000000000000000000000000000)⟩ ⟨(-860675759037619878649668929959173 / 100000000000000000000000000000000), (29646153703 / 10000000000000000000000000000000)⟩ ⟨-13, 18286587627341528161390875447, 12207031250000000000000000000⟩, + .log ⟨(801928436256759907516886059 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(9409556715347487994516686453 / 100000000000000000000000000000000), (3056683 / 100000000000000000000000000000000)⟩ ⟨(-293341534291681925901083085633429 / 25000000000000000000000000000000), (381164950993 / 100000000000000000000000000000000)⟩ ⟨-17, 801928436256759907516886059, 762939453125000000000000000⟩, + .log ⟨(583174592254490084617031821 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(7028533397709702574684783017 / 100000000000000000000000000000000), (1173181 / 50000000000000000000000000000000)⟩ ⟨(-602609706515003543796694056210721 / 50000000000000000000000000000000), (100585205363 / 25000000000000000000000000000000)⟩ ⟨-18, 583174592254490084617031821, 381469726562500000000000000⟩, + .log ⟨(210208269304228855913852244341 / 100000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ ⟨(161987193032213530398570841011 / 12500000000000000000000000000000), (22256667 / 5000000000000000000000000000000)⟩ ⟨(-616482666712882774055266418353337 / 100000000000000000000000000000000), (211758237781 / 100000000000000000000000000000000)⟩ ⟨-9, 210208269304228855913852244341, 195312500000000000000000000000⟩, + .log ⟨(2207128306853625715322313110039 / 100000000000000000000000000000000), (13 / 100000000000000000000000000000000)⟩ ⟨(2104208768452590292534838504217 / 25000000000000000000000000000000), (1635821627 / 50000000000000000000000000000000)⟩ ⟨(-381347792408543300578107696854781 / 100000000000000000000000000000000), (14823076637 / 10000000000000000000000000000000)⟩ ⟨-6, 2207128306853625715322313110039, 1562500000000000000000000000000⟩, + .log ⟨(20158912145541728246885267581 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(347733224962728327799614132443 / 50000000000000000000000000000000), (29348109 / 12500000000000000000000000000000)⟩ ⟨(-86248013397794321004157859741613 / 12500000000000000000000000000000), (3639594711 / 1562500000000000000000000000000)⟩ ⟨-10, 20158912145541728246885267581, 19531250000000000000000000000⟩, + .log ⟨(5333535771927365604804710433 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(52476184174698319718491385809 / 100000000000000000000000000000000), (9035367 / 50000000000000000000000000000000)⟩ ⟨(-196778221497650669825846684162267 / 20000000000000000000000000000000), (338813197677 / 100000000000000000000000000000000)⟩ ⟨-15, 5333535771927365604804710433, 3051757812500000000000000000⟩, + .log ⟨(2365505276181939121558097447 / 5000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(362215702997453659949968844667 / 100000000000000000000000000000000), (8139873 / 6250000000000000000000000000000)⟩ ⟨(-765620154485748034068444143008119 / 100000000000000000000000000000000), (34410713749 / 12500000000000000000000000000000)⟩ ⟨-12, 2365505276181939121558097447, 1220703125000000000000000000⟩, + .log ⟨(1114540445710650223683009813289 / 50000000000000000000000000000000), (7 / 50000000000000000000000000000000)⟩ ⟨(132476396459504971492683829363 / 1562500000000000000000000000000), (3304183743 / 100000000000000000000000000000000)⟩ ⟨(-38035808417891407357155342318881 / 10000000000000000000000000000000), (148230766409 / 100000000000000000000000000000000)⟩ ⟨-6, 1114540445710650223683009813289, 781250000000000000000000000000⟩, + .log ⟨(129089442418154761929961893523 / 100000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ ⟨(429378590960183740702475642391 / 50000000000000000000000000000000), (18793331 / 6250000000000000000000000000000)⟩ ⟨(-665241994878734080717191029185119 / 100000000000000000000000000000000), (116467031031 / 50000000000000000000000000000000)⟩ ⟨-10, 129089442418154761929961893523, 97656250000000000000000000000⟩, + .log ⟨(1925125746460424888734281561 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(39136986306445901610649586803 / 100000000000000000000000000000000), (3261293 / 25000000000000000000000000000000)⟩ ⟨(-1016478699596739478840195903834799 / 100000000000000000000000000000000), (3388132049 / 1000000000000000000000000000000)⟩ ⟨-15, 1925125746460424888734281561, 1525878906250000000000000000⟩, + .log ⟨(21669445923142634312457989127 / 12500000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ ⟨(68882625340195485264181164237 / 6250000000000000000000000000000), (201902089 / 50000000000000000000000000000000)⟩ ⟨(-635758067691337718102920742650059 / 100000000000000000000000000000000), (116467030833 / 50000000000000000000000000000000)⟩ ⟨-10, 21669445923142634312457989127, 12207031250000000000000000000⟩, + .log ⟨(10220616200711351030348909013 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(46956160972572173983798290413 / 50000000000000000000000000000000), (16232253 / 50000000000000000000000000000000)⟩ ⟨(-918851858840057860722308760889683 / 100000000000000000000000000000000), (317637365029 / 100000000000000000000000000000000)⟩ ⟨-14, 10220616200711351030348909013, 6103515625000000000000000000⟩, + .log ⟨(34879650284750079838933009761 / 25000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ ⟨(458648394004557632110496105047 / 50000000000000000000000000000000), (324986359 / 100000000000000000000000000000000)⟩ ⟨(-657472753109978530906569512194251 / 100000000000000000000000000000000), (116467030973 / 50000000000000000000000000000000)⟩ ⟨-10, 34879650284750079838933009761, 24414062500000000000000000000⟩, + .log ⟨(16101925810295116456395922452093 / 100000000000000000000000000000000), (51 / 100000000000000000000000000000000)⟩ ⟨(29405840995286274778640978020233 / 100000000000000000000000000000000), (6819430911 / 50000000000000000000000000000000)⟩ ⟨(-182623130560476255648401857723113 / 100000000000000000000000000000000), (10587911881 / 12500000000000000000000000000000)⟩ ⟨-3, 16101925810295116456395922452093, 12500000000000000000000000000000⟩, + .log ⟨(71750537800594427299584243279 / 10000000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ ⟨(141697124207935636689177435147 / 4000000000000000000000000000000), (85464943 / 6250000000000000000000000000000)⟩ ⟨(-246857251094293761474724568107779 / 50000000000000000000000000000000), (23822801713 / 12500000000000000000000000000000)⟩ ⟨-8, 71750537800594427299584243279, 39062500000000000000000000000⟩] +lemma CA2_3_11I2PairCertificates_valid : + CA2_3_11I2PairCertificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_3_11I2PairCertificateIndex (a : PairSlot × PairSlot) : ℕ := + match a.1.1.val, a.1.2.val, a.2.1.val, a.2.2.val with + | 5, 5, 4, 0 => 1 + | 5, 5, 2, 1 => 2 + | 5, 5, 3, 1 => 3 + | 5, 5, 1, 2 => 2 + | 5, 5, 1, 3 => 3 + | 5, 5, 0, 4 => 1 + | 4, 5, 5, 0 => 4 + | 4, 5, 4, 1 => 5 + | 4, 5, 2, 2 => 6 + | 4, 5, 2, 3 => 7 + | 4, 5, 3, 2 => 7 + | 4, 5, 3, 3 => 8 + | 4, 5, 1, 4 => 5 + | 4, 5, 0, 5 => 4 + | 5, 4, 5, 0 => 4 + | 5, 4, 4, 1 => 5 + | 5, 4, 2, 2 => 6 + | 5, 4, 2, 3 => 7 + | 5, 4, 3, 2 => 7 + | 5, 4, 3, 3 => 8 + | 5, 4, 1, 4 => 5 + | 5, 4, 0, 5 => 4 + | 2, 5, 5, 1 => 9 + | 2, 5, 4, 2 => 10 + | 2, 5, 4, 3 => 11 + | 2, 5, 2, 4 => 10 + | 2, 5, 3, 4 => 11 + | 2, 5, 1, 5 => 9 + | 3, 5, 5, 1 => 12 + | 3, 5, 4, 2 => 13 + | 3, 5, 4, 3 => 14 + | 3, 5, 2, 4 => 13 + | 3, 5, 3, 4 => 14 + | 3, 5, 1, 5 => 12 + | 4, 4, 5, 1 => 15 + | 4, 4, 4, 2 => 16 + | 4, 4, 4, 3 => 17 + | 4, 4, 2, 4 => 16 + | 4, 4, 3, 4 => 17 + | 4, 4, 1, 5 => 15 + | 5, 2, 5, 1 => 9 + | 5, 2, 4, 2 => 10 + | 5, 2, 4, 3 => 11 + | 5, 2, 2, 4 => 10 + | 5, 2, 3, 4 => 11 + | 5, 2, 1, 5 => 9 + | 5, 3, 5, 1 => 12 + | 5, 3, 4, 2 => 13 + | 5, 3, 4, 3 => 14 + | 5, 3, 2, 4 => 13 + | 5, 3, 3, 4 => 14 + | 5, 3, 1, 5 => 12 + | 1, 5, 2, 5 => 9 + | 1, 5, 3, 5 => 12 + | 1, 5, 4, 4 => 15 + | 1, 5, 5, 2 => 9 + | 1, 5, 5, 3 => 12 + | 2, 4, 2, 5 => 10 + | 2, 4, 3, 5 => 13 + | 2, 4, 4, 4 => 16 + | 2, 4, 5, 2 => 10 + | 2, 4, 5, 3 => 13 + | 3, 4, 2, 5 => 11 + | 3, 4, 3, 5 => 14 + | 3, 4, 4, 4 => 17 + | 3, 4, 5, 2 => 11 + | 3, 4, 5, 3 => 14 + | 4, 2, 2, 5 => 10 + | 4, 2, 3, 5 => 13 + | 4, 2, 4, 4 => 16 + | 4, 2, 5, 2 => 10 + | 4, 2, 5, 3 => 13 + | 4, 3, 2, 5 => 11 + | 4, 3, 3, 5 => 14 + | 4, 3, 4, 4 => 17 + | 4, 3, 5, 2 => 11 + | 4, 3, 5, 3 => 14 + | 5, 1, 2, 5 => 9 + | 5, 1, 3, 5 => 12 + | 5, 1, 4, 4 => 15 + | 5, 1, 5, 2 => 9 + | 5, 1, 5, 3 => 12 + | 5, 0, 4, 5 => 4 + | 5, 0, 5, 4 => 4 + | 4, 1, 4, 5 => 5 + | 4, 1, 5, 4 => 5 + | 2, 2, 4, 5 => 6 + | 2, 2, 5, 4 => 6 + | 2, 3, 4, 5 => 7 + | 2, 3, 5, 4 => 7 + | 3, 2, 4, 5 => 7 + | 3, 2, 5, 4 => 7 + | 3, 3, 4, 5 => 8 + | 3, 3, 5, 4 => 8 + | 1, 4, 4, 5 => 5 + | 1, 4, 5, 4 => 5 + | 0, 5, 4, 5 => 4 + | 0, 5, 5, 4 => 4 + | 4, 0, 5, 5 => 1 + | 2, 1, 5, 5 => 2 + | 3, 1, 5, 5 => 3 + | 1, 2, 5, 5 => 2 + | 1, 3, 5, 5 => 3 + | 0, 4, 5, 5 => 1 + | _, _, _, _ => 0 +def CA2_3_11I2PairP (a : PairSlot × PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_3_11I2PairCertificates (CA2_3_11I2PairCertificateIndex a)).input +lemma CA2_3_11I2PairP_check_0_0 : ∀ k l : Fin 6, contains (CA2_3_11I2PairRaw ((0,0),(k,l))) (CA2_3_11I2PairP ((0,0),(k,l))) = true := by + decide +kernel +lemma CA2_3_11I2PairP_check_0_1 : ∀ k l : Fin 6, contains (CA2_3_11I2PairRaw ((0,1),(k,l))) (CA2_3_11I2PairP ((0,1),(k,l))) = true := by + decide +kernel +lemma CA2_3_11I2PairP_check_0_2 : ∀ k l : Fin 6, contains (CA2_3_11I2PairRaw ((0,2),(k,l))) (CA2_3_11I2PairP ((0,2),(k,l))) = true := by + decide +kernel +lemma CA2_3_11I2PairP_check_0_3 : ∀ k l : Fin 6, contains (CA2_3_11I2PairRaw ((0,3),(k,l))) (CA2_3_11I2PairP ((0,3),(k,l))) = true := by + decide +kernel +lemma CA2_3_11I2PairP_check_0_4 : ∀ k l : Fin 6, contains (CA2_3_11I2PairRaw ((0,4),(k,l))) (CA2_3_11I2PairP ((0,4),(k,l))) = true := by + decide +kernel +lemma CA2_3_11I2PairP_check_0_5 : ∀ k l : Fin 6, contains (CA2_3_11I2PairRaw ((0,5),(k,l))) (CA2_3_11I2PairP ((0,5),(k,l))) = true := by + decide +kernel +lemma CA2_3_11I2PairP_check_1_0 : ∀ k l : Fin 6, contains (CA2_3_11I2PairRaw ((1,0),(k,l))) (CA2_3_11I2PairP ((1,0),(k,l))) = true := by + decide +kernel +lemma CA2_3_11I2PairP_check_1_1 : ∀ k l : Fin 6, contains (CA2_3_11I2PairRaw ((1,1),(k,l))) (CA2_3_11I2PairP ((1,1),(k,l))) = true := by + decide +kernel +lemma CA2_3_11I2PairP_check_1_2 : ∀ k l : Fin 6, contains (CA2_3_11I2PairRaw ((1,2),(k,l))) (CA2_3_11I2PairP ((1,2),(k,l))) = true := by + decide +kernel +lemma CA2_3_11I2PairP_check_1_3 : ∀ k l : Fin 6, contains (CA2_3_11I2PairRaw ((1,3),(k,l))) (CA2_3_11I2PairP ((1,3),(k,l))) = true := by + decide +kernel +lemma CA2_3_11I2PairP_check_1_4 : ∀ k l : Fin 6, contains (CA2_3_11I2PairRaw ((1,4),(k,l))) (CA2_3_11I2PairP ((1,4),(k,l))) = true := by + decide +kernel +lemma CA2_3_11I2PairP_check_1_5 : ∀ k l : Fin 6, contains (CA2_3_11I2PairRaw ((1,5),(k,l))) (CA2_3_11I2PairP ((1,5),(k,l))) = true := by + decide +kernel +lemma CA2_3_11I2PairP_check_2_0 : ∀ k l : Fin 6, contains (CA2_3_11I2PairRaw ((2,0),(k,l))) (CA2_3_11I2PairP ((2,0),(k,l))) = true := by + decide +kernel +lemma CA2_3_11I2PairP_check_2_1 : ∀ k l : Fin 6, contains (CA2_3_11I2PairRaw ((2,1),(k,l))) (CA2_3_11I2PairP ((2,1),(k,l))) = true := by + decide +kernel +lemma CA2_3_11I2PairP_check_2_2 : ∀ k l : Fin 6, contains (CA2_3_11I2PairRaw ((2,2),(k,l))) (CA2_3_11I2PairP ((2,2),(k,l))) = true := by + decide +kernel +lemma CA2_3_11I2PairP_check_2_3 : ∀ k l : Fin 6, contains (CA2_3_11I2PairRaw ((2,3),(k,l))) (CA2_3_11I2PairP ((2,3),(k,l))) = true := by + decide +kernel +lemma CA2_3_11I2PairP_check_2_4 : ∀ k l : Fin 6, contains (CA2_3_11I2PairRaw ((2,4),(k,l))) (CA2_3_11I2PairP ((2,4),(k,l))) = true := by + decide +kernel +lemma CA2_3_11I2PairP_check_2_5 : ∀ k l : Fin 6, contains (CA2_3_11I2PairRaw ((2,5),(k,l))) (CA2_3_11I2PairP ((2,5),(k,l))) = true := by + decide +kernel +lemma CA2_3_11I2PairP_check_3_0 : ∀ k l : Fin 6, contains (CA2_3_11I2PairRaw ((3,0),(k,l))) (CA2_3_11I2PairP ((3,0),(k,l))) = true := by + decide +kernel +lemma CA2_3_11I2PairP_check_3_1 : ∀ k l : Fin 6, contains (CA2_3_11I2PairRaw ((3,1),(k,l))) (CA2_3_11I2PairP ((3,1),(k,l))) = true := by + decide +kernel +lemma CA2_3_11I2PairP_check_3_2 : ∀ k l : Fin 6, contains (CA2_3_11I2PairRaw ((3,2),(k,l))) (CA2_3_11I2PairP ((3,2),(k,l))) = true := by + decide +kernel +lemma CA2_3_11I2PairP_check_3_3 : ∀ k l : Fin 6, contains (CA2_3_11I2PairRaw ((3,3),(k,l))) (CA2_3_11I2PairP ((3,3),(k,l))) = true := by + decide +kernel +lemma CA2_3_11I2PairP_check_3_4 : ∀ k l : Fin 6, contains (CA2_3_11I2PairRaw ((3,4),(k,l))) (CA2_3_11I2PairP ((3,4),(k,l))) = true := by + decide +kernel +lemma CA2_3_11I2PairP_check_3_5 : ∀ k l : Fin 6, contains (CA2_3_11I2PairRaw ((3,5),(k,l))) (CA2_3_11I2PairP ((3,5),(k,l))) = true := by + decide +kernel +lemma CA2_3_11I2PairP_check_4_0 : ∀ k l : Fin 6, contains (CA2_3_11I2PairRaw ((4,0),(k,l))) (CA2_3_11I2PairP ((4,0),(k,l))) = true := by + decide +kernel +lemma CA2_3_11I2PairP_check_4_1 : ∀ k l : Fin 6, contains (CA2_3_11I2PairRaw ((4,1),(k,l))) (CA2_3_11I2PairP ((4,1),(k,l))) = true := by + decide +kernel +lemma CA2_3_11I2PairP_check_4_2 : ∀ k l : Fin 6, contains (CA2_3_11I2PairRaw ((4,2),(k,l))) (CA2_3_11I2PairP ((4,2),(k,l))) = true := by + decide +kernel +lemma CA2_3_11I2PairP_check_4_3 : ∀ k l : Fin 6, contains (CA2_3_11I2PairRaw ((4,3),(k,l))) (CA2_3_11I2PairP ((4,3),(k,l))) = true := by + decide +kernel +lemma CA2_3_11I2PairP_check_4_4 : ∀ k l : Fin 6, contains (CA2_3_11I2PairRaw ((4,4),(k,l))) (CA2_3_11I2PairP ((4,4),(k,l))) = true := by + decide +kernel +lemma CA2_3_11I2PairP_check_4_5 : ∀ k l : Fin 6, contains (CA2_3_11I2PairRaw ((4,5),(k,l))) (CA2_3_11I2PairP ((4,5),(k,l))) = true := by + decide +kernel +lemma CA2_3_11I2PairP_check_5_0 : ∀ k l : Fin 6, contains (CA2_3_11I2PairRaw ((5,0),(k,l))) (CA2_3_11I2PairP ((5,0),(k,l))) = true := by + decide +kernel +lemma CA2_3_11I2PairP_check_5_1 : ∀ k l : Fin 6, contains (CA2_3_11I2PairRaw ((5,1),(k,l))) (CA2_3_11I2PairP ((5,1),(k,l))) = true := by + decide +kernel +lemma CA2_3_11I2PairP_check_5_2 : ∀ k l : Fin 6, contains (CA2_3_11I2PairRaw ((5,2),(k,l))) (CA2_3_11I2PairP ((5,2),(k,l))) = true := by + decide +kernel +lemma CA2_3_11I2PairP_check_5_3 : ∀ k l : Fin 6, contains (CA2_3_11I2PairRaw ((5,3),(k,l))) (CA2_3_11I2PairP ((5,3),(k,l))) = true := by + decide +kernel +lemma CA2_3_11I2PairP_check_5_4 : ∀ k l : Fin 6, contains (CA2_3_11I2PairRaw ((5,4),(k,l))) (CA2_3_11I2PairP ((5,4),(k,l))) = true := by + decide +kernel +lemma CA2_3_11I2PairP_check_5_5 : ∀ k l : Fin 6, contains (CA2_3_11I2PairRaw ((5,5),(k,l))) (CA2_3_11I2PairP ((5,5),(k,l))) = true := by + decide +kernel +lemma CA2_3_11I2PairP_check (a : PairSlot × PairSlot) : contains (CA2_3_11I2PairRaw a) (CA2_3_11I2PairP a) = true := by + rcases a with ⟨⟨i,j⟩,⟨k,l⟩⟩ + revert j i + apply forall_fin6 + · exact forall_fin6 (CA2_3_11I2PairP_check_0_0 k l) (CA2_3_11I2PairP_check_0_1 k l) (CA2_3_11I2PairP_check_0_2 k l) (CA2_3_11I2PairP_check_0_3 k l) (CA2_3_11I2PairP_check_0_4 k l) (CA2_3_11I2PairP_check_0_5 k l) + · exact forall_fin6 (CA2_3_11I2PairP_check_1_0 k l) (CA2_3_11I2PairP_check_1_1 k l) (CA2_3_11I2PairP_check_1_2 k l) (CA2_3_11I2PairP_check_1_3 k l) (CA2_3_11I2PairP_check_1_4 k l) (CA2_3_11I2PairP_check_1_5 k l) + · exact forall_fin6 (CA2_3_11I2PairP_check_2_0 k l) (CA2_3_11I2PairP_check_2_1 k l) (CA2_3_11I2PairP_check_2_2 k l) (CA2_3_11I2PairP_check_2_3 k l) (CA2_3_11I2PairP_check_2_4 k l) (CA2_3_11I2PairP_check_2_5 k l) + · exact forall_fin6 (CA2_3_11I2PairP_check_3_0 k l) (CA2_3_11I2PairP_check_3_1 k l) (CA2_3_11I2PairP_check_3_2 k l) (CA2_3_11I2PairP_check_3_3 k l) (CA2_3_11I2PairP_check_3_4 k l) (CA2_3_11I2PairP_check_3_5 k l) + · exact forall_fin6 (CA2_3_11I2PairP_check_4_0 k l) (CA2_3_11I2PairP_check_4_1 k l) (CA2_3_11I2PairP_check_4_2 k l) (CA2_3_11I2PairP_check_4_3 k l) (CA2_3_11I2PairP_check_4_4 k l) (CA2_3_11I2PairP_check_4_5 k l) + · exact forall_fin6 (CA2_3_11I2PairP_check_5_0 k l) (CA2_3_11I2PairP_check_5_1 k l) (CA2_3_11I2PairP_check_5_2 k l) (CA2_3_11I2PairP_check_5_3 k l) (CA2_3_11I2PairP_check_5_4 k l) (CA2_3_11I2PairP_check_5_5 k l) +lemma CA2_3_11I2PairP_sound (a : PairSlot × PairSlot) : + (CA2_3_11I2PairP a).Encloses (CA2_3_11I2PairValue a) := + contains_sound (CA2_3_11I2PairRaw_sound a) (CA2_3_11I2PairP_check a) +def CA2_3_11I2PairTerms (a : PairSlot × PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_3_11I2PairCertificates (CA2_3_11I2PairCertificateIndex a)).output +lemma CA2_3_11I2PairTerms_sound (a : PairSlot × PairSlot) : + (CA2_3_11I2PairTerms a).Encloses (Foundation.entropyTerm (CA2_3_11I2PairValue a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_3_11I2PairCertificates_valid + (CA2_3_11I2PairCertificateIndex a) (CA2_3_11I2PairP_sound a) +def CA2_3_11I2PairEntropy : Ball := ⟨(34186993952125239895041733853741 / 12500000000000000000000000000000), (3551715743 / 3125000000000000000000000000000)⟩ +lemma CA2_3_11I2PairEntropy_sound : CA2_3_11I2PairEntropy.Encloses (Foundation.finiteEntropy CA2_3_11I2PairValue) := by + exact contains_sound (entropyDoublePair_enclosed CA2_3_11I2PairValue CA2_3_11I2PairTerms CA2_3_11I2PairTerms_sound) (by decide +kernel) +def CA2_3_11I2PairMass : Ball := ⟨(12500000000000000000000000000001 / 12500000000000000000000000000000), (31 / 6250000000000000000000000000000)⟩ +lemma CA2_3_11I2PairMass_sound : CA2_3_11I2PairMass.Encloses (∑ a, CA2_3_11I2PairValue a) := by + exact contains_sound (doublePairSumBall_sound CA2_3_11I2PairP CA2_3_11I2PairValue CA2_3_11I2PairP_sound) (by decide +kernel) +def CA2_3_11I2PairMassTermLogWitness : LogWitness := ⟨0, 12500000000000000000000000000001, 12500000000000000000000000000000⟩ +def CA2_3_11I2PairMassTermLog : Ball := ⟨(1 / 12500000000000000000000000000000), (10587912089 / 50000000000000000000000000000000)⟩ +lemma CA2_3_11I2PairMassTermLog_sound : CA2_3_11I2PairMassTermLog.Encloses (Real.log ((∑ a, CA2_3_11I2PairValue a))) := by + exact checkLog_sound logTwoBall_sound (CA2_3_11I2PairMass_sound) (w := CA2_3_11I2PairMassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA2_3_11I2PairMassTerm : Ball := ⟨(-1 / 12500000000000000000000000000000), (21175824179 / 100000000000000000000000000000000)⟩ +lemma CA2_3_11I2PairMassTerm_sound : CA2_3_11I2PairMassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_3_11I2PairValue a))) := by + exact contains_sound (entropyTerm_ball (CA2_3_11I2PairMass_sound) CA2_3_11I2PairMassTermLog_sound) (by decide +kernel) +def CA2_3_11I2PairH : Ball := ⟨(17093496976062619947520866926871 / 6250000000000000000000000000000), (26966145591 / 20000000000000000000000000000000)⟩ +lemma CA2_3_11I2PairH_sound : CA2_3_11I2PairH.Encloses (homogeneousEntropy CA2_3_11I2PairValue) := by + exact contains_sound (homogeneous_enclosed CA2_3_11I2PairValue CA2_3_11I2PairMassTerm_sound CA2_3_11I2PairEntropy_sound) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CA2_3_11I2R0Value (a : PairSlot) : ℝ := residualLaw (below (shape 2 3 11)) (fun u => (stageALaw (shape 2 3 11) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 0 a +def CA2_3_11I2R0Raw (a : PairSlot) : Ball := residualBall (below (shape 2 3 11)) A2_3_11Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 0 a +lemma CA2_3_11I2R0Raw_sound (a : PairSlot) : + (CA2_3_11I2R0Raw a).Encloses (CA2_3_11I2R0Value a) := by + exact residualBall_sound_on (below (shape 2 3 11)) A2_3_11Law (fun u => (stageALaw (shape 2 3 11) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A2_3_11Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 2 3 11) (show (shape 2 3 11) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 0 a +def CA2_3_11I2R0Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA2_3_11I2R0Certificates_valid : + CA2_3_11I2R0Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_3_11I2R0CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA2_3_11I2R0P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_3_11I2R0Certificates (CA2_3_11I2R0CertificateIndex a)).input +lemma CA2_3_11I2R0P_check : ∀ a : PairSlot, contains (CA2_3_11I2R0Raw a) (CA2_3_11I2R0P a) = true := by + decide +kernel +lemma CA2_3_11I2R0P_sound (a : PairSlot) : + (CA2_3_11I2R0P a).Encloses (CA2_3_11I2R0Value a) := + contains_sound (CA2_3_11I2R0Raw_sound a) (CA2_3_11I2R0P_check a) +def CA2_3_11I2R0Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_3_11I2R0Certificates (CA2_3_11I2R0CertificateIndex a)).output +lemma CA2_3_11I2R0Terms_sound (a : PairSlot) : + (CA2_3_11I2R0Terms a).Encloses (Foundation.entropyTerm (CA2_3_11I2R0Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_3_11I2R0Certificates_valid + (CA2_3_11I2R0CertificateIndex a) (CA2_3_11I2R0P_sound a) +def CA2_3_11I2R0Entropy : Ball := ⟨0, 0⟩ +lemma CA2_3_11I2R0Entropy_sound : CA2_3_11I2R0Entropy.Encloses (Foundation.finiteEntropy CA2_3_11I2R0Value) := by + exact contains_sound (entropyPair_enclosed CA2_3_11I2R0Value CA2_3_11I2R0Terms CA2_3_11I2R0Terms_sound) (by decide +kernel) +def CA2_3_11I2R0Mass : Ball := ⟨0, 0⟩ +lemma CA2_3_11I2R0Mass_sound : CA2_3_11I2R0Mass.Encloses (∑ a, CA2_3_11I2R0Value a) := by + exact contains_sound (pairSumBall_sound CA2_3_11I2R0P CA2_3_11I2R0Value CA2_3_11I2R0P_sound) (by decide +kernel) +def CA2_3_11I2R0MassTerm : Ball := .exact 0 +lemma CA2_3_11I2R0MassTerm_sound : CA2_3_11I2R0MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_3_11I2R0Value a))) := + entropyTerm_zero_ball (CA2_3_11I2R0Mass_sound) +def CA2_3_11I2R0H : Ball := ⟨0, 0⟩ +lemma CA2_3_11I2R0H_sound : CA2_3_11I2R0H.Encloses (homogeneousEntropy CA2_3_11I2R0Value) := by + exact contains_sound (homogeneous_enclosed CA2_3_11I2R0Value CA2_3_11I2R0MassTerm_sound CA2_3_11I2R0Entropy_sound) (by decide +kernel) +def CA2_3_11I2R1Value (a : PairSlot) : ℝ := residualLaw (below (shape 2 3 11)) (fun u => (stageALaw (shape 2 3 11) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 1 a +def CA2_3_11I2R1Raw (a : PairSlot) : Ball := residualBall (below (shape 2 3 11)) A2_3_11Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 1 a +lemma CA2_3_11I2R1Raw_sound (a : PairSlot) : + (CA2_3_11I2R1Raw a).Encloses (CA2_3_11I2R1Value a) := by + exact residualBall_sound_on (below (shape 2 3 11)) A2_3_11Law (fun u => (stageALaw (shape 2 3 11) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A2_3_11Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 2 3 11) (show (shape 2 3 11) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 1 a +def CA2_3_11I2R1Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA2_3_11I2R1Certificates_valid : + CA2_3_11I2R1Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_3_11I2R1CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA2_3_11I2R1P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_3_11I2R1Certificates (CA2_3_11I2R1CertificateIndex a)).input +lemma CA2_3_11I2R1P_check : ∀ a : PairSlot, contains (CA2_3_11I2R1Raw a) (CA2_3_11I2R1P a) = true := by + decide +kernel +lemma CA2_3_11I2R1P_sound (a : PairSlot) : + (CA2_3_11I2R1P a).Encloses (CA2_3_11I2R1Value a) := + contains_sound (CA2_3_11I2R1Raw_sound a) (CA2_3_11I2R1P_check a) +def CA2_3_11I2R1Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_3_11I2R1Certificates (CA2_3_11I2R1CertificateIndex a)).output +lemma CA2_3_11I2R1Terms_sound (a : PairSlot) : + (CA2_3_11I2R1Terms a).Encloses (Foundation.entropyTerm (CA2_3_11I2R1Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_3_11I2R1Certificates_valid + (CA2_3_11I2R1CertificateIndex a) (CA2_3_11I2R1P_sound a) +def CA2_3_11I2R1Entropy : Ball := ⟨0, 0⟩ +lemma CA2_3_11I2R1Entropy_sound : CA2_3_11I2R1Entropy.Encloses (Foundation.finiteEntropy CA2_3_11I2R1Value) := by + exact contains_sound (entropyPair_enclosed CA2_3_11I2R1Value CA2_3_11I2R1Terms CA2_3_11I2R1Terms_sound) (by decide +kernel) +def CA2_3_11I2R1Mass : Ball := ⟨0, 0⟩ +lemma CA2_3_11I2R1Mass_sound : CA2_3_11I2R1Mass.Encloses (∑ a, CA2_3_11I2R1Value a) := by + exact contains_sound (pairSumBall_sound CA2_3_11I2R1P CA2_3_11I2R1Value CA2_3_11I2R1P_sound) (by decide +kernel) +def CA2_3_11I2R1MassTerm : Ball := .exact 0 +lemma CA2_3_11I2R1MassTerm_sound : CA2_3_11I2R1MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_3_11I2R1Value a))) := + entropyTerm_zero_ball (CA2_3_11I2R1Mass_sound) +def CA2_3_11I2R1H : Ball := ⟨0, 0⟩ +lemma CA2_3_11I2R1H_sound : CA2_3_11I2R1H.Encloses (homogeneousEntropy CA2_3_11I2R1Value) := by + exact contains_sound (homogeneous_enclosed CA2_3_11I2R1Value CA2_3_11I2R1MassTerm_sound CA2_3_11I2R1Entropy_sound) (by decide +kernel) +def CA2_3_11I2R2Value (a : PairSlot) : ℝ := residualLaw (below (shape 2 3 11)) (fun u => (stageALaw (shape 2 3 11) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 2 a +def CA2_3_11I2R2Raw (a : PairSlot) : Ball := residualBall (below (shape 2 3 11)) A2_3_11Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 2 a +lemma CA2_3_11I2R2Raw_sound (a : PairSlot) : + (CA2_3_11I2R2Raw a).Encloses (CA2_3_11I2R2Value a) := by + exact residualBall_sound_on (below (shape 2 3 11)) A2_3_11Law (fun u => (stageALaw (shape 2 3 11) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A2_3_11Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 2 3 11) (show (shape 2 3 11) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 2 a +def CA2_3_11I2R2Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA2_3_11I2R2Certificates_valid : + CA2_3_11I2R2Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_3_11I2R2CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA2_3_11I2R2P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_3_11I2R2Certificates (CA2_3_11I2R2CertificateIndex a)).input +lemma CA2_3_11I2R2P_check : ∀ a : PairSlot, contains (CA2_3_11I2R2Raw a) (CA2_3_11I2R2P a) = true := by + decide +kernel +lemma CA2_3_11I2R2P_sound (a : PairSlot) : + (CA2_3_11I2R2P a).Encloses (CA2_3_11I2R2Value a) := + contains_sound (CA2_3_11I2R2Raw_sound a) (CA2_3_11I2R2P_check a) +def CA2_3_11I2R2Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_3_11I2R2Certificates (CA2_3_11I2R2CertificateIndex a)).output +lemma CA2_3_11I2R2Terms_sound (a : PairSlot) : + (CA2_3_11I2R2Terms a).Encloses (Foundation.entropyTerm (CA2_3_11I2R2Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_3_11I2R2Certificates_valid + (CA2_3_11I2R2CertificateIndex a) (CA2_3_11I2R2P_sound a) +def CA2_3_11I2R2Entropy : Ball := ⟨0, 0⟩ +lemma CA2_3_11I2R2Entropy_sound : CA2_3_11I2R2Entropy.Encloses (Foundation.finiteEntropy CA2_3_11I2R2Value) := by + exact contains_sound (entropyPair_enclosed CA2_3_11I2R2Value CA2_3_11I2R2Terms CA2_3_11I2R2Terms_sound) (by decide +kernel) +def CA2_3_11I2R2Mass : Ball := ⟨0, 0⟩ +lemma CA2_3_11I2R2Mass_sound : CA2_3_11I2R2Mass.Encloses (∑ a, CA2_3_11I2R2Value a) := by + exact contains_sound (pairSumBall_sound CA2_3_11I2R2P CA2_3_11I2R2Value CA2_3_11I2R2P_sound) (by decide +kernel) +def CA2_3_11I2R2MassTerm : Ball := .exact 0 +lemma CA2_3_11I2R2MassTerm_sound : CA2_3_11I2R2MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_3_11I2R2Value a))) := + entropyTerm_zero_ball (CA2_3_11I2R2Mass_sound) +def CA2_3_11I2R2H : Ball := ⟨0, 0⟩ +lemma CA2_3_11I2R2H_sound : CA2_3_11I2R2H.Encloses (homogeneousEntropy CA2_3_11I2R2Value) := by + exact contains_sound (homogeneous_enclosed CA2_3_11I2R2Value CA2_3_11I2R2MassTerm_sound CA2_3_11I2R2Entropy_sound) (by decide +kernel) +def CA2_3_11I2R3Value (a : PairSlot) : ℝ := residualLaw (below (shape 2 3 11)) (fun u => (stageALaw (shape 2 3 11) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 3 a +def CA2_3_11I2R3Raw (a : PairSlot) : Ball := residualBall (below (shape 2 3 11)) A2_3_11Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 3 a +lemma CA2_3_11I2R3Raw_sound (a : PairSlot) : + (CA2_3_11I2R3Raw a).Encloses (CA2_3_11I2R3Value a) := by + exact residualBall_sound_on (below (shape 2 3 11)) A2_3_11Law (fun u => (stageALaw (shape 2 3 11) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A2_3_11Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 2 3 11) (show (shape 2 3 11) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 3 a +def CA2_3_11I2R3Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(514093738669073721436557579 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(1565193747281701732814757813 / 25000000000000000000000000000000), (1034211 / 50000000000000000000000000000000)⟩ ⟨(-48713100496693021950406840784137 / 4000000000000000000000000000000), (402340844493 / 100000000000000000000000000000000)⟩ ⟨-18, 514093738669073721436557579, 381469726562500000000000000⟩, + .log ⟨(18286587627341528161390875447 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(19673528357962647637477614739 / 12500000000000000000000000000000), (13553177 / 25000000000000000000000000000000)⟩ ⟨(-860675759037619878649668929959173 / 100000000000000000000000000000000), (29646153703 / 10000000000000000000000000000000)⟩ ⟨-13, 18286587627341528161390875447, 12207031250000000000000000000⟩, + .log ⟨(801928436256759907516886059 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(9409556715347487994516686453 / 100000000000000000000000000000000), (3056683 / 100000000000000000000000000000000)⟩ ⟨(-293341534291681925901083085633429 / 25000000000000000000000000000000), (381164950993 / 100000000000000000000000000000000)⟩ ⟨-17, 801928436256759907516886059, 762939453125000000000000000⟩] +lemma CA2_3_11I2R3Certificates_valid : + CA2_3_11I2R3Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_3_11I2R3CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 4, 0 => 1 + | 2, 1 => 2 + | 3, 1 => 3 + | 1, 2 => 2 + | 1, 3 => 3 + | 0, 4 => 1 + | _, _ => 0 +def CA2_3_11I2R3P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_3_11I2R3Certificates (CA2_3_11I2R3CertificateIndex a)).input +lemma CA2_3_11I2R3P_check : ∀ a : PairSlot, contains (CA2_3_11I2R3Raw a) (CA2_3_11I2R3P a) = true := by + decide +kernel +lemma CA2_3_11I2R3P_sound (a : PairSlot) : + (CA2_3_11I2R3P a).Encloses (CA2_3_11I2R3Value a) := + contains_sound (CA2_3_11I2R3Raw_sound a) (CA2_3_11I2R3P_check a) +def CA2_3_11I2R3Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_3_11I2R3Certificates (CA2_3_11I2R3CertificateIndex a)).output +lemma CA2_3_11I2R3Terms_sound (a : PairSlot) : + (CA2_3_11I2R3Terms a).Encloses (Foundation.entropyTerm (CA2_3_11I2R3Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_3_11I2R3Certificates_valid + (CA2_3_11I2R3CertificateIndex a) (CA2_3_11I2R3P_sound a) +def CA2_3_11I2R3Entropy : Ball := ⟨(173058558568175476025596635617 / 50000000000000000000000000000000), (59337813 / 50000000000000000000000000000000)⟩ +lemma CA2_3_11I2R3Entropy_sound : CA2_3_11I2R3Entropy.Encloses (Foundation.finiteEntropy CA2_3_11I2R3Value) := by + exact contains_sound (entropyPair_enclosed CA2_3_11I2R3Value CA2_3_11I2R3Terms CA2_3_11I2R3Terms_sound) (by decide +kernel) +def CA2_3_11I2R3Mass : Ball := ⟨(3920521960453472358068863817 / 10000000000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ +lemma CA2_3_11I2R3Mass_sound : CA2_3_11I2R3Mass.Encloses (∑ a, CA2_3_11I2R3Value a) := by + exact contains_sound (pairSumBall_sound CA2_3_11I2R3P CA2_3_11I2R3Value CA2_3_11I2R3P_sound) (by decide +kernel) +def CA2_3_11I2R3MassTermLogWitness : LogWitness := ⟨-12, 3920521960453472358068863817, 2441406250000000000000000000⟩ +def CA2_3_11I2R3MassTermLog : Ball := ⟨(-392205778693050138276878830221161 / 50000000000000000000000000000000), (275285723183 / 100000000000000000000000000000000)⟩ +lemma CA2_3_11I2R3MassTermLog_sound : CA2_3_11I2R3MassTermLog.Encloses (Real.log ((∑ a, CA2_3_11I2R3Value a))) := by + exact checkLog_sound logTwoBall_sound (CA2_3_11I2R3Mass_sound) (w := CA2_3_11I2R3MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA2_3_11I2R3MassTerm : Ball := ⟨(153765136838285764580771240553 / 50000000000000000000000000000000), (5396321 / 5000000000000000000000000000000)⟩ +lemma CA2_3_11I2R3MassTerm_sound : CA2_3_11I2R3MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_3_11I2R3Value a))) := by + exact contains_sound (entropyTerm_ball (CA2_3_11I2R3Mass_sound) CA2_3_11I2R3MassTermLog_sound) (by decide +kernel) +def CA2_3_11I2R3H : Ball := ⟨(2411677716236213930603174383 / 6250000000000000000000000000000), (113301023 / 50000000000000000000000000000000)⟩ +lemma CA2_3_11I2R3H_sound : CA2_3_11I2R3H.Encloses (homogeneousEntropy CA2_3_11I2R3Value) := by + exact contains_sound (homogeneous_enclosed CA2_3_11I2R3Value CA2_3_11I2R3MassTerm_sound CA2_3_11I2R3Entropy_sound) (by decide +kernel) +def CA2_3_11I2R4Value (a : PairSlot) : ℝ := residualLaw (below (shape 2 3 11)) (fun u => (stageALaw (shape 2 3 11) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 4 a +def CA2_3_11I2R4Raw (a : PairSlot) : Ball := residualBall (below (shape 2 3 11)) A2_3_11Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 4 a +lemma CA2_3_11I2R4Raw_sound (a : PairSlot) : + (CA2_3_11I2R4Raw a).Encloses (CA2_3_11I2R4Value a) := by + exact residualBall_sound_on (below (shape 2 3 11)) A2_3_11Law (fun u => (stageALaw (shape 2 3 11) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A2_3_11Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 2 3 11) (show (shape 2 3 11) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 4 a +def CA2_3_11I2R4Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(583174592254490084617031821 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(529944605865144564215225401 / 4000000000000000000000000000000), (2222863 / 50000000000000000000000000000000)⟩ ⟨(-141988086871751569581458114921389 / 12500000000000000000000000000000), (381164912031 / 100000000000000000000000000000000)⟩ ⟨-17, 583174592254490084617031821, 381469726562500000000000000⟩, + .log ⟨(210208269304228855913852244341 / 50000000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ ⟨(575096137529548157619818239123 / 25000000000000000000000000000000), (801240011 / 100000000000000000000000000000000)⟩ ⟨(-547167948656888243113543225303007 / 100000000000000000000000000000000), (95291207049 / 50000000000000000000000000000000)⟩ ⟨-8, 210208269304228855913852244341, 195312500000000000000000000000⟩, + .log ⟨(4414256613707251430644626220077 / 100000000000000000000000000000000), (1 / 4000000000000000000000000000000)⟩ ⟨(6886970310780724690083525220293 / 50000000000000000000000000000000), (701066411 / 12500000000000000000000000000000)⟩ ⟨(-312033074352548769636384503804473 / 100000000000000000000000000000000), (15881867833 / 12500000000000000000000000000000)⟩ ⟨-5, 4414256613707251430644626220077, 3125000000000000000000000000000⟩, + .log ⟨(20158912145541728246885267581 / 10000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ ⟨(125120196868253444314340628143 / 10000000000000000000000000000000), (26680099 / 6250000000000000000000000000000)⟩ ⟨(-310334694563180018545769842441287 / 50000000000000000000000000000000), (211758237821 / 100000000000000000000000000000000)⟩ ⟨-9, 20158912145541728246885267581, 19531250000000000000000000000⟩, + .log ⟨(5333535771927365604804710433 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(97558517783942509493184525271 / 100000000000000000000000000000000), (6776523 / 20000000000000000000000000000000)⟩ ⟨(-182915277886451763637502045552201 / 20000000000000000000000000000000), (317637364619 / 100000000000000000000000000000000)⟩ ⟨-14, 5333535771927365604804710433, 3051757812500000000000000000⟩] +lemma CA2_3_11I2R4Certificates_valid : + CA2_3_11I2R4Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_3_11I2R4CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 5, 0 => 1 + | 4, 1 => 2 + | 2, 2 => 3 + | 2, 3 => 4 + | 3, 2 => 4 + | 3, 3 => 5 + | 1, 4 => 2 + | 0, 5 => 1 + | _, _ => 0 +def CA2_3_11I2R4P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_3_11I2R4Certificates (CA2_3_11I2R4CertificateIndex a)).input +lemma CA2_3_11I2R4P_check : ∀ a : PairSlot, contains (CA2_3_11I2R4Raw a) (CA2_3_11I2R4P a) = true := by + decide +kernel +lemma CA2_3_11I2R4P_sound (a : PairSlot) : + (CA2_3_11I2R4P a).Encloses (CA2_3_11I2R4Value a) := + contains_sound (CA2_3_11I2R4Raw_sound a) (CA2_3_11I2R4P_check a) +def CA2_3_11I2R4Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_3_11I2R4Certificates (CA2_3_11I2R4CertificateIndex a)).output +lemma CA2_3_11I2R4Terms_sound (a : PairSlot) : + (CA2_3_11I2R4Terms a).Encloses (Foundation.entropyTerm (CA2_3_11I2R4Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_3_11I2R4Certificates_valid + (CA2_3_11I2R4CertificateIndex a) (CA2_3_11I2R4P_sound a) +def CA2_3_11I2R4Entropy : Ball := ⟨(21001169407240103265116354711751 / 100000000000000000000000000000000), (1621509709 / 20000000000000000000000000000000)⟩ +lemma CA2_3_11I2R4Entropy_sound : CA2_3_11I2R4Entropy.Encloses (Foundation.finiteEntropy CA2_3_11I2R4Value) := by + exact contains_sound (entropyPair_enclosed CA2_3_11I2R4Value CA2_3_11I2R4Terms CA2_3_11I2R4Terms_sound) (by decide +kernel) +def CA2_3_11I2R4Mass : Ball := ⟨(5671267703747874110785818097211 / 100000000000000000000000000000000), (1 / 2500000000000000000000000000000)⟩ +lemma CA2_3_11I2R4Mass_sound : CA2_3_11I2R4Mass.Encloses (∑ a, CA2_3_11I2R4Value a) := by + exact contains_sound (pairSumBall_sound CA2_3_11I2R4P CA2_3_11I2R4Value CA2_3_11I2R4P_sound) (by decide +kernel) +def CA2_3_11I2R4MassTermLogWitness : LogWitness := ⟨-5, 5671267703747874110785818097211, 3125000000000000000000000000000⟩ +def CA2_3_11I2R4MassTermLog : Ball := ⟨(-286975751233100269100320826215251 / 100000000000000000000000000000000), (127054942803 / 100000000000000000000000000000000)⟩ +lemma CA2_3_11I2R4MassTermLog_sound : CA2_3_11I2R4MassTermLog.Encloses (Real.log ((∑ a, CA2_3_11I2R4Value a))) := by + exact checkLog_sound logTwoBall_sound (CA2_3_11I2R4Mass_sound) (w := CA2_3_11I2R4MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA2_3_11I2R4MassTerm : Ball := ⟨(16275163097270657154798053737267 / 100000000000000000000000000000000), (7205626053 / 100000000000000000000000000000000)⟩ +lemma CA2_3_11I2R4MassTerm_sound : CA2_3_11I2R4MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_3_11I2R4Value a))) := by + exact contains_sound (entropyTerm_ball (CA2_3_11I2R4Mass_sound) CA2_3_11I2R4MassTermLog_sound) (by decide +kernel) +def CA2_3_11I2R4H : Ball := ⟨(1181501577492361527579575243621 / 25000000000000000000000000000000), (7656587299 / 50000000000000000000000000000000)⟩ +lemma CA2_3_11I2R4H_sound : CA2_3_11I2R4H.Encloses (homogeneousEntropy CA2_3_11I2R4Value) := by + exact contains_sound (homogeneous_enclosed CA2_3_11I2R4Value CA2_3_11I2R4MassTerm_sound CA2_3_11I2R4Entropy_sound) (by decide +kernel) +def CA2_3_11I2R5Value (a : PairSlot) : ℝ := residualLaw (below (shape 2 3 11)) (fun u => (stageALaw (shape 2 3 11) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 5 a +def CA2_3_11I2R5Raw (a : PairSlot) : Ball := residualBall (below (shape 2 3 11)) A2_3_11Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 5 a +lemma CA2_3_11I2R5Raw_sound (a : PairSlot) : + (CA2_3_11I2R5Raw a).Encloses (CA2_3_11I2R5Value a) := by + exact residualBall_sound_on (below (shape 2 3 11)) A2_3_11Law (fun u => (stageALaw (shape 2 3 11) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A2_3_11Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 2 3 11) (show (shape 2 3 11) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 5 a +def CA2_3_11I2R5Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(29084531585862838898352520637 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(236827167739282218665183368477 / 100000000000000000000000000000000), (2502049 / 3125000000000000000000000000000)⟩ ⟨(-407135949637224257156434397556281 / 50000000000000000000000000000000), (275285711317 / 100000000000000000000000000000000)⟩ ⟨-12, 29084531585862838898352520637, 24414062500000000000000000000⟩, + .log ⟨(4361944975298317792365761385469 / 25000000000000000000000000000000), (47 / 100000000000000000000000000000000)⟩ ⟨(6092617383571510721561243858801 / 20000000000000000000000000000000), (3694711141 / 25000000000000000000000000000000)⟩ ⟨(-174595777172625570177586530892981 / 100000000000000000000000000000000), (84703295001 / 100000000000000000000000000000000)⟩ ⟨-3, 4361944975298317792365761385469, 3125000000000000000000000000000⟩, + .log ⟨(65301921581185389040050134893 / 10000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ ⟨(3285547928556457068689076563159 / 100000000000000000000000000000000), (622269899 / 50000000000000000000000000000000)⟩ ⟨(-251565945457804119779622751462429 / 50000000000000000000000000000000), (95291206803 / 50000000000000000000000000000000)⟩ ⟨-8, 65301921581185389040050134893, 39062500000000000000000000000⟩] +lemma CA2_3_11I2R5Certificates_valid : + CA2_3_11I2R5Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_3_11I2R5CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 5, 1 => 1 + | 4, 2 => 2 + | 4, 3 => 3 + | 2, 4 => 2 + | 3, 4 => 3 + | 1, 5 => 1 + | _, _ => 0 +def CA2_3_11I2R5P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_3_11I2R5Certificates (CA2_3_11I2R5CertificateIndex a)).input +lemma CA2_3_11I2R5P_check : ∀ a : PairSlot, contains (CA2_3_11I2R5Raw a) (CA2_3_11I2R5P a) = true := by + decide +kernel +lemma CA2_3_11I2R5P_sound (a : PairSlot) : + (CA2_3_11I2R5P a).Encloses (CA2_3_11I2R5Value a) := + contains_sound (CA2_3_11I2R5Raw_sound a) (CA2_3_11I2R5P_check a) +def CA2_3_11I2R5Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_3_11I2R5Certificates (CA2_3_11I2R5CertificateIndex a)).output +lemma CA2_3_11I2R5Terms_sound (a : PairSlot) : + (CA2_3_11I2R5Terms a).Encloses (Foundation.entropyTerm (CA2_3_11I2R5Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_3_11I2R5Certificates_valid + (CA2_3_11I2R5CertificateIndex a) (CA2_3_11I2R5P_sound a) +def CA2_3_11I2R5Entropy : Ball := ⟨(33985462014153292895160479225641 / 50000000000000000000000000000000), (1610344993 / 5000000000000000000000000000000)⟩ +lemma CA2_3_11I2R5Entropy_sound : CA2_3_11I2R5Entropy.Encloses (Foundation.finiteEntropy CA2_3_11I2R5Value) := by + exact contains_sound (entropyPair_enclosed CA2_3_11I2R5Value CA2_3_11I2R5Terms CA2_3_11I2R5Terms_sound) (by decide +kernel) +def CA2_3_11I2R5Mass : Ball := ⟨(18129883648590987898761899411443 / 50000000000000000000000000000000), (51 / 50000000000000000000000000000000)⟩ +lemma CA2_3_11I2R5Mass_sound : CA2_3_11I2R5Mass.Encloses (∑ a, CA2_3_11I2R5Value a) := by + exact contains_sound (pairSumBall_sound CA2_3_11I2R5P CA2_3_11I2R5Value CA2_3_11I2R5P_sound) (by decide +kernel) +def CA2_3_11I2R5MassTermLogWitness : LogWitness := ⟨-2, 18129883648590987898761899411443, 12500000000000000000000000000000⟩ +def CA2_3_11I2R5MassTermLog : Ball := ⟨(-101446139829968549672529265203349 / 100000000000000000000000000000000), (6352747133 / 10000000000000000000000000000000)⟩ +lemma CA2_3_11I2R5MassTermLog_sound : CA2_3_11I2R5MassTermLog.Encloses (Real.log ((∑ a, CA2_3_11I2R5Value a))) := by + exact checkLog_sound logTwoBall_sound (CA2_3_11I2R5Mass_sound) (w := CA2_3_11I2R5MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA2_3_11I2R5MassTerm : Ball := ⟨(36784134234320435001557660496367 / 100000000000000000000000000000000), (11517456689 / 50000000000000000000000000000000)⟩ +lemma CA2_3_11I2R5MassTerm_sound : CA2_3_11I2R5MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_3_11I2R5Value a))) := by + exact contains_sound (entropyTerm_ball (CA2_3_11I2R5Mass_sound) CA2_3_11I2R5MassTermLog_sound) (by decide +kernel) +def CA2_3_11I2R5H : Ball := ⟨(6237357958797230157752659590983 / 20000000000000000000000000000000), (27620906619 / 50000000000000000000000000000000)⟩ +lemma CA2_3_11I2R5H_sound : CA2_3_11I2R5H.Encloses (homogeneousEntropy CA2_3_11I2R5Value) := by + exact contains_sound (homogeneous_enclosed CA2_3_11I2R5Value CA2_3_11I2R5MassTerm_sound CA2_3_11I2R5Entropy_sound) (by decide +kernel) +def CA2_3_11I2R6Value (a : PairSlot) : ℝ := residualLaw (below (shape 2 3 11)) (fun u => (stageALaw (shape 2 3 11) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 6 a +def CA2_3_11I2R6Raw (a : PairSlot) : Ball := residualBall (below (shape 2 3 11)) A2_3_11Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 6 a +lemma CA2_3_11I2R6Raw_sound (a : PairSlot) : + (CA2_3_11I2R6Raw a).Encloses (CA2_3_11I2R6Value a) := by + exact residualBall_sound_on (below (shape 2 3 11)) A2_3_11Law (fun u => (stageALaw (shape 2 3 11) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A2_3_11Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 2 3 11) (show (shape 2 3 11) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 6 a +def CA2_3_11I2R6Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(7886314903952997969370681127 / 4000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ ⟨(122808074855800518959106477219 / 10000000000000000000000000000000), (8349961 / 2000000000000000000000000000000)⟩ ⟨(-622892067341836639191883308106711 / 100000000000000000000000000000000), (52939559461 / 25000000000000000000000000000000)⟩ ⟨-9, 7886314903952997969370681127, 7812500000000000000000000000⟩, + .log ⟨(12421728542624157123657613 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(24690100758403456975391283 / 12500000000000000000000000000000), (15787 / 25000000000000000000000000000000)⟩ ⟨(-1590123350300652445519249718726277 / 100000000000000000000000000000000), (508227818801 / 100000000000000000000000000000000)⟩ ⟨-23, 12421728542624157123657613, 11920928955078125000000000⟩, + .log ⟨(4134728977017907334099806971269 / 20000000000000000000000000000000), (13 / 50000000000000000000000000000000)⟩ ⟨(32588083316966892151129048132273 / 100000000000000000000000000000000), (8755629213 / 50000000000000000000000000000000)⟩ ⟨(-39407762271845943239079083940257 / 25000000000000000000000000000000), (84703294857 / 100000000000000000000000000000000)⟩ ⟨-3, 4134728977017907334099806971269, 2500000000000000000000000000000⟩] +lemma CA2_3_11I2R6Certificates_valid : + CA2_3_11I2R6Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_3_11I2R6CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 5, 2 => 1 + | 5, 3 => 2 + | 4, 4 => 3 + | 2, 5 => 1 + | 3, 5 => 2 + | _, _ => 0 +def CA2_3_11I2R6P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_3_11I2R6Certificates (CA2_3_11I2R6CertificateIndex a)).input +lemma CA2_3_11I2R6P_check : ∀ a : PairSlot, contains (CA2_3_11I2R6Raw a) (CA2_3_11I2R6P a) = true := by + decide +kernel +lemma CA2_3_11I2R6P_sound (a : PairSlot) : + (CA2_3_11I2R6P a).Encloses (CA2_3_11I2R6Value a) := + contains_sound (CA2_3_11I2R6Raw_sound a) (CA2_3_11I2R6P_check a) +def CA2_3_11I2R6Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_3_11I2R6Certificates (CA2_3_11I2R6CertificateIndex a)).output +lemma CA2_3_11I2R6Terms_sound (a : PairSlot) : + (CA2_3_11I2R6Terms a).Encloses (Foundation.entropyTerm (CA2_3_11I2R6Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_3_11I2R6Certificates_valid + (CA2_3_11I2R6CertificateIndex a) (CA2_3_11I2R6P_sound a) +def CA2_3_11I2R6Entropy : Ball := ⟨(35044639855695036985622783937181 / 100000000000000000000000000000000), (9173190411 / 50000000000000000000000000000000)⟩ +lemma CA2_3_11I2R6Entropy_sound : CA2_3_11I2R6Entropy.Encloses (Foundation.finiteEntropy CA2_3_11I2R6Value) := by + exact contains_sound (entropyPair_enclosed CA2_3_11I2R6Value CA2_3_11I2R6Terms CA2_3_11I2R6Terms_sound) (by decide +kernel) +def CA2_3_11I2R6Mass : Ball := ⟨(21067985473744271817281816227921 / 100000000000000000000000000000000), (1 / 3125000000000000000000000000000)⟩ +lemma CA2_3_11I2R6Mass_sound : CA2_3_11I2R6Mass.Encloses (∑ a, CA2_3_11I2R6Value a) := by + exact contains_sound (pairSumBall_sound CA2_3_11I2R6P CA2_3_11I2R6Value CA2_3_11I2R6P_sound) (by decide +kernel) +def CA2_3_11I2R6MassTermLogWitness : LogWitness := ⟨-3, 21067985473744271817281816227921, 12500000000000000000000000000000⟩ +def CA2_3_11I2R6MassTermLog : Ball := ⟨(-7787077869305013827687891615047 / 5000000000000000000000000000000), (84703294883 / 100000000000000000000000000000000)⟩ +lemma CA2_3_11I2R6MassTermLog_sound : CA2_3_11I2R6MassTermLog.Encloses (Real.log ((∑ a, CA2_3_11I2R6Value a))) := by + exact checkLog_sound logTwoBall_sound (CA2_3_11I2R6Mass_sound) (w := CA2_3_11I2R6MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA2_3_11I2R6MassTerm : Ball := ⟨(32811608686686705304979056360841 / 100000000000000000000000000000000), (2230659739 / 12500000000000000000000000000000)⟩ +lemma CA2_3_11I2R6MassTerm_sound : CA2_3_11I2R6MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_3_11I2R6Value a))) := by + exact contains_sound (entropyTerm_ball (CA2_3_11I2R6Mass_sound) CA2_3_11I2R6MassTermLog_sound) (by decide +kernel) +def CA2_3_11I2R6H : Ball := ⟨(111651558450416584032186378817 / 5000000000000000000000000000000), (18095829367 / 50000000000000000000000000000000)⟩ +lemma CA2_3_11I2R6H_sound : CA2_3_11I2R6H.Encloses (homogeneousEntropy CA2_3_11I2R6Value) := by + exact contains_sound (homogeneous_enclosed CA2_3_11I2R6Value CA2_3_11I2R6MassTerm_sound CA2_3_11I2R6Entropy_sound) (by decide +kernel) +def CA2_3_11I2R7Value (a : PairSlot) : ℝ := residualLaw (below (shape 2 3 11)) (fun u => (stageALaw (shape 2 3 11) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 7 a +def CA2_3_11I2R7Raw (a : PairSlot) : Ball := residualBall (below (shape 2 3 11)) A2_3_11Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 7 a +lemma CA2_3_11I2R7Raw_sound (a : PairSlot) : + (CA2_3_11I2R7Raw a).Encloses (CA2_3_11I2R7Value a) := by + exact residualBall_sound_on (below (shape 2 3 11)) A2_3_11Law (fun u => (stageALaw (shape 2 3 11) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A2_3_11Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 2 3 11) (show (shape 2 3 11) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 7 a +def CA2_3_11I2R7Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA2_3_11I2R7Certificates_valid : + CA2_3_11I2R7Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_3_11I2R7CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA2_3_11I2R7P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_3_11I2R7Certificates (CA2_3_11I2R7CertificateIndex a)).input +lemma CA2_3_11I2R7P_check : ∀ a : PairSlot, contains (CA2_3_11I2R7Raw a) (CA2_3_11I2R7P a) = true := by + decide +kernel +lemma CA2_3_11I2R7P_sound (a : PairSlot) : + (CA2_3_11I2R7P a).Encloses (CA2_3_11I2R7Value a) := + contains_sound (CA2_3_11I2R7Raw_sound a) (CA2_3_11I2R7P_check a) +def CA2_3_11I2R7Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_3_11I2R7Certificates (CA2_3_11I2R7CertificateIndex a)).output +lemma CA2_3_11I2R7Terms_sound (a : PairSlot) : + (CA2_3_11I2R7Terms a).Encloses (Foundation.entropyTerm (CA2_3_11I2R7Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_3_11I2R7Certificates_valid + (CA2_3_11I2R7CertificateIndex a) (CA2_3_11I2R7P_sound a) +def CA2_3_11I2R7Entropy : Ball := ⟨0, 0⟩ +lemma CA2_3_11I2R7Entropy_sound : CA2_3_11I2R7Entropy.Encloses (Foundation.finiteEntropy CA2_3_11I2R7Value) := by + exact contains_sound (entropyPair_enclosed CA2_3_11I2R7Value CA2_3_11I2R7Terms CA2_3_11I2R7Terms_sound) (by decide +kernel) +def CA2_3_11I2R7Mass : Ball := ⟨0, 0⟩ +lemma CA2_3_11I2R7Mass_sound : CA2_3_11I2R7Mass.Encloses (∑ a, CA2_3_11I2R7Value a) := by + exact contains_sound (pairSumBall_sound CA2_3_11I2R7P CA2_3_11I2R7Value CA2_3_11I2R7P_sound) (by decide +kernel) +def CA2_3_11I2R7MassTerm : Ball := .exact 0 +lemma CA2_3_11I2R7MassTerm_sound : CA2_3_11I2R7MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_3_11I2R7Value a))) := + entropyTerm_zero_ball (CA2_3_11I2R7Mass_sound) +def CA2_3_11I2R7H : Ball := ⟨0, 0⟩ +lemma CA2_3_11I2R7H_sound : CA2_3_11I2R7H.Encloses (homogeneousEntropy CA2_3_11I2R7Value) := by + exact contains_sound (homogeneous_enclosed CA2_3_11I2R7Value CA2_3_11I2R7MassTerm_sound CA2_3_11I2R7Entropy_sound) (by decide +kernel) +def CA2_3_11I2R8Value (a : PairSlot) : ℝ := residualLaw (below (shape 2 3 11)) (fun u => (stageALaw (shape 2 3 11) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 8 a +def CA2_3_11I2R8Raw (a : PairSlot) : Ball := residualBall (below (shape 2 3 11)) A2_3_11Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 8 a +lemma CA2_3_11I2R8Raw_sound (a : PairSlot) : + (CA2_3_11I2R8Raw a).Encloses (CA2_3_11I2R8Value a) := by + exact residualBall_sound_on (below (shape 2 3 11)) A2_3_11Law (fun u => (stageALaw (shape 2 3 11) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A2_3_11Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 2 3 11) (show (shape 2 3 11) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 8 a +def CA2_3_11I2R8Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA2_3_11I2R8Certificates_valid : + CA2_3_11I2R8Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_3_11I2R8CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA2_3_11I2R8P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_3_11I2R8Certificates (CA2_3_11I2R8CertificateIndex a)).input +lemma CA2_3_11I2R8P_check : ∀ a : PairSlot, contains (CA2_3_11I2R8Raw a) (CA2_3_11I2R8P a) = true := by + decide +kernel +lemma CA2_3_11I2R8P_sound (a : PairSlot) : + (CA2_3_11I2R8P a).Encloses (CA2_3_11I2R8Value a) := + contains_sound (CA2_3_11I2R8Raw_sound a) (CA2_3_11I2R8P_check a) +def CA2_3_11I2R8Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_3_11I2R8Certificates (CA2_3_11I2R8CertificateIndex a)).output +lemma CA2_3_11I2R8Terms_sound (a : PairSlot) : + (CA2_3_11I2R8Terms a).Encloses (Foundation.entropyTerm (CA2_3_11I2R8Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_3_11I2R8Certificates_valid + (CA2_3_11I2R8CertificateIndex a) (CA2_3_11I2R8P_sound a) +def CA2_3_11I2R8Entropy : Ball := ⟨0, 0⟩ +lemma CA2_3_11I2R8Entropy_sound : CA2_3_11I2R8Entropy.Encloses (Foundation.finiteEntropy CA2_3_11I2R8Value) := by + exact contains_sound (entropyPair_enclosed CA2_3_11I2R8Value CA2_3_11I2R8Terms CA2_3_11I2R8Terms_sound) (by decide +kernel) +def CA2_3_11I2R8Mass : Ball := ⟨0, 0⟩ +lemma CA2_3_11I2R8Mass_sound : CA2_3_11I2R8Mass.Encloses (∑ a, CA2_3_11I2R8Value a) := by + exact contains_sound (pairSumBall_sound CA2_3_11I2R8P CA2_3_11I2R8Value CA2_3_11I2R8P_sound) (by decide +kernel) +def CA2_3_11I2R8MassTerm : Ball := .exact 0 +lemma CA2_3_11I2R8MassTerm_sound : CA2_3_11I2R8MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_3_11I2R8Value a))) := + entropyTerm_zero_ball (CA2_3_11I2R8Mass_sound) +def CA2_3_11I2R8H : Ball := ⟨0, 0⟩ +lemma CA2_3_11I2R8H_sound : CA2_3_11I2R8H.Encloses (homogeneousEntropy CA2_3_11I2R8Value) := by + exact contains_sound (homogeneous_enclosed CA2_3_11I2R8Value CA2_3_11I2R8MassTerm_sound CA2_3_11I2R8Entropy_sound) (by decide +kernel) +def CA2_3_11I2R9Value (a : PairSlot) : ℝ := residualLaw (below (shape 2 3 11)) (fun u => (stageALaw (shape 2 3 11) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 9 a +def CA2_3_11I2R9Raw (a : PairSlot) : Ball := residualBall (below (shape 2 3 11)) A2_3_11Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 9 a +lemma CA2_3_11I2R9Raw_sound (a : PairSlot) : + (CA2_3_11I2R9Raw a).Encloses (CA2_3_11I2R9Value a) := by + exact residualBall_sound_on (below (shape 2 3 11)) A2_3_11Law (fun u => (stageALaw (shape 2 3 11) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A2_3_11Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 2 3 11) (show (shape 2 3 11) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 9 a +def CA2_3_11I2R9Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA2_3_11I2R9Certificates_valid : + CA2_3_11I2R9Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_3_11I2R9CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA2_3_11I2R9P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_3_11I2R9Certificates (CA2_3_11I2R9CertificateIndex a)).input +lemma CA2_3_11I2R9P_check : ∀ a : PairSlot, contains (CA2_3_11I2R9Raw a) (CA2_3_11I2R9P a) = true := by + decide +kernel +lemma CA2_3_11I2R9P_sound (a : PairSlot) : + (CA2_3_11I2R9P a).Encloses (CA2_3_11I2R9Value a) := + contains_sound (CA2_3_11I2R9Raw_sound a) (CA2_3_11I2R9P_check a) +def CA2_3_11I2R9Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_3_11I2R9Certificates (CA2_3_11I2R9CertificateIndex a)).output +lemma CA2_3_11I2R9Terms_sound (a : PairSlot) : + (CA2_3_11I2R9Terms a).Encloses (Foundation.entropyTerm (CA2_3_11I2R9Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_3_11I2R9Certificates_valid + (CA2_3_11I2R9CertificateIndex a) (CA2_3_11I2R9P_sound a) +def CA2_3_11I2R9Entropy : Ball := ⟨0, 0⟩ +lemma CA2_3_11I2R9Entropy_sound : CA2_3_11I2R9Entropy.Encloses (Foundation.finiteEntropy CA2_3_11I2R9Value) := by + exact contains_sound (entropyPair_enclosed CA2_3_11I2R9Value CA2_3_11I2R9Terms CA2_3_11I2R9Terms_sound) (by decide +kernel) +def CA2_3_11I2R9Mass : Ball := ⟨0, 0⟩ +lemma CA2_3_11I2R9Mass_sound : CA2_3_11I2R9Mass.Encloses (∑ a, CA2_3_11I2R9Value a) := by + exact contains_sound (pairSumBall_sound CA2_3_11I2R9P CA2_3_11I2R9Value CA2_3_11I2R9P_sound) (by decide +kernel) +def CA2_3_11I2R9MassTerm : Ball := .exact 0 +lemma CA2_3_11I2R9MassTerm_sound : CA2_3_11I2R9MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_3_11I2R9Value a))) := + entropyTerm_zero_ball (CA2_3_11I2R9Mass_sound) +def CA2_3_11I2R9H : Ball := ⟨0, 0⟩ +lemma CA2_3_11I2R9H_sound : CA2_3_11I2R9H.Encloses (homogeneousEntropy CA2_3_11I2R9Value) := by + exact contains_sound (homogeneous_enclosed CA2_3_11I2R9Value CA2_3_11I2R9MassTerm_sound CA2_3_11I2R9Entropy_sound) (by decide +kernel) +def CA2_3_11I2R10Value (a : PairSlot) : ℝ := residualLaw (below (shape 2 3 11)) (fun u => (stageALaw (shape 2 3 11) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 10 a +def CA2_3_11I2R10Raw (a : PairSlot) : Ball := residualBall (below (shape 2 3 11)) A2_3_11Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 10 a +lemma CA2_3_11I2R10Raw_sound (a : PairSlot) : + (CA2_3_11I2R10Raw a).Encloses (CA2_3_11I2R10Value a) := by + exact residualBall_sound_on (below (shape 2 3 11)) A2_3_11Law (fun u => (stageALaw (shape 2 3 11) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A2_3_11Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 2 3 11) (show (shape 2 3 11) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 10 a +def CA2_3_11I2R10Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA2_3_11I2R10Certificates_valid : + CA2_3_11I2R10Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_3_11I2R10CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA2_3_11I2R10P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_3_11I2R10Certificates (CA2_3_11I2R10CertificateIndex a)).input +lemma CA2_3_11I2R10P_check : ∀ a : PairSlot, contains (CA2_3_11I2R10Raw a) (CA2_3_11I2R10P a) = true := by + decide +kernel +lemma CA2_3_11I2R10P_sound (a : PairSlot) : + (CA2_3_11I2R10P a).Encloses (CA2_3_11I2R10Value a) := + contains_sound (CA2_3_11I2R10Raw_sound a) (CA2_3_11I2R10P_check a) +def CA2_3_11I2R10Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_3_11I2R10Certificates (CA2_3_11I2R10CertificateIndex a)).output +lemma CA2_3_11I2R10Terms_sound (a : PairSlot) : + (CA2_3_11I2R10Terms a).Encloses (Foundation.entropyTerm (CA2_3_11I2R10Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_3_11I2R10Certificates_valid + (CA2_3_11I2R10CertificateIndex a) (CA2_3_11I2R10P_sound a) +def CA2_3_11I2R10Entropy : Ball := ⟨0, 0⟩ +lemma CA2_3_11I2R10Entropy_sound : CA2_3_11I2R10Entropy.Encloses (Foundation.finiteEntropy CA2_3_11I2R10Value) := by + exact contains_sound (entropyPair_enclosed CA2_3_11I2R10Value CA2_3_11I2R10Terms CA2_3_11I2R10Terms_sound) (by decide +kernel) +def CA2_3_11I2R10Mass : Ball := ⟨0, 0⟩ +lemma CA2_3_11I2R10Mass_sound : CA2_3_11I2R10Mass.Encloses (∑ a, CA2_3_11I2R10Value a) := by + exact contains_sound (pairSumBall_sound CA2_3_11I2R10P CA2_3_11I2R10Value CA2_3_11I2R10P_sound) (by decide +kernel) +def CA2_3_11I2R10MassTerm : Ball := .exact 0 +lemma CA2_3_11I2R10MassTerm_sound : CA2_3_11I2R10MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_3_11I2R10Value a))) := + entropyTerm_zero_ball (CA2_3_11I2R10Mass_sound) +def CA2_3_11I2R10H : Ball := ⟨0, 0⟩ +lemma CA2_3_11I2R10H_sound : CA2_3_11I2R10H.Encloses (homogeneousEntropy CA2_3_11I2R10Value) := by + exact contains_sound (homogeneous_enclosed CA2_3_11I2R10Value CA2_3_11I2R10MassTerm_sound CA2_3_11I2R10Entropy_sound) (by decide +kernel) +def CA2_3_11I2R11Value (a : PairSlot) : ℝ := residualLaw (below (shape 2 3 11)) (fun u => (stageALaw (shape 2 3 11) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 11 a +def CA2_3_11I2R11Raw (a : PairSlot) : Ball := residualBall (below (shape 2 3 11)) A2_3_11Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 11 a +lemma CA2_3_11I2R11Raw_sound (a : PairSlot) : + (CA2_3_11I2R11Raw a).Encloses (CA2_3_11I2R11Value a) := by + exact residualBall_sound_on (below (shape 2 3 11)) A2_3_11Law (fun u => (stageALaw (shape 2 3 11) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A2_3_11Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 2 3 11) (show (shape 2 3 11) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 11 a +def CA2_3_11I2R11Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA2_3_11I2R11Certificates_valid : + CA2_3_11I2R11Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_3_11I2R11CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA2_3_11I2R11P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_3_11I2R11Certificates (CA2_3_11I2R11CertificateIndex a)).input +lemma CA2_3_11I2R11P_check : ∀ a : PairSlot, contains (CA2_3_11I2R11Raw a) (CA2_3_11I2R11P a) = true := by + decide +kernel +lemma CA2_3_11I2R11P_sound (a : PairSlot) : + (CA2_3_11I2R11P a).Encloses (CA2_3_11I2R11Value a) := + contains_sound (CA2_3_11I2R11Raw_sound a) (CA2_3_11I2R11P_check a) +def CA2_3_11I2R11Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_3_11I2R11Certificates (CA2_3_11I2R11CertificateIndex a)).output +lemma CA2_3_11I2R11Terms_sound (a : PairSlot) : + (CA2_3_11I2R11Terms a).Encloses (Foundation.entropyTerm (CA2_3_11I2R11Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_3_11I2R11Certificates_valid + (CA2_3_11I2R11CertificateIndex a) (CA2_3_11I2R11P_sound a) +def CA2_3_11I2R11Entropy : Ball := ⟨0, 0⟩ +lemma CA2_3_11I2R11Entropy_sound : CA2_3_11I2R11Entropy.Encloses (Foundation.finiteEntropy CA2_3_11I2R11Value) := by + exact contains_sound (entropyPair_enclosed CA2_3_11I2R11Value CA2_3_11I2R11Terms CA2_3_11I2R11Terms_sound) (by decide +kernel) +def CA2_3_11I2R11Mass : Ball := ⟨0, 0⟩ +lemma CA2_3_11I2R11Mass_sound : CA2_3_11I2R11Mass.Encloses (∑ a, CA2_3_11I2R11Value a) := by + exact contains_sound (pairSumBall_sound CA2_3_11I2R11P CA2_3_11I2R11Value CA2_3_11I2R11P_sound) (by decide +kernel) +def CA2_3_11I2R11MassTerm : Ball := .exact 0 +lemma CA2_3_11I2R11MassTerm_sound : CA2_3_11I2R11MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_3_11I2R11Value a))) := + entropyTerm_zero_ball (CA2_3_11I2R11Mass_sound) +def CA2_3_11I2R11H : Ball := ⟨0, 0⟩ +lemma CA2_3_11I2R11H_sound : CA2_3_11I2R11H.Encloses (homogeneousEntropy CA2_3_11I2R11Value) := by + exact contains_sound (homogeneous_enclosed CA2_3_11I2R11Value CA2_3_11I2R11MassTerm_sound CA2_3_11I2R11Entropy_sound) (by decide +kernel) +def CA2_3_11I2R12Value (a : PairSlot) : ℝ := residualLaw (below (shape 2 3 11)) (fun u => (stageALaw (shape 2 3 11) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 12 a +def CA2_3_11I2R12Raw (a : PairSlot) : Ball := residualBall (below (shape 2 3 11)) A2_3_11Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 12 a +lemma CA2_3_11I2R12Raw_sound (a : PairSlot) : + (CA2_3_11I2R12Raw a).Encloses (CA2_3_11I2R12Value a) := by + exact residualBall_sound_on (below (shape 2 3 11)) A2_3_11Law (fun u => (stageALaw (shape 2 3 11) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A2_3_11Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 2 3 11) (show (shape 2 3 11) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 12 a +def CA2_3_11I2R12Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA2_3_11I2R12Certificates_valid : + CA2_3_11I2R12Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_3_11I2R12CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA2_3_11I2R12P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_3_11I2R12Certificates (CA2_3_11I2R12CertificateIndex a)).input +lemma CA2_3_11I2R12P_check : ∀ a : PairSlot, contains (CA2_3_11I2R12Raw a) (CA2_3_11I2R12P a) = true := by + decide +kernel +lemma CA2_3_11I2R12P_sound (a : PairSlot) : + (CA2_3_11I2R12P a).Encloses (CA2_3_11I2R12Value a) := + contains_sound (CA2_3_11I2R12Raw_sound a) (CA2_3_11I2R12P_check a) +def CA2_3_11I2R12Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_3_11I2R12Certificates (CA2_3_11I2R12CertificateIndex a)).output +lemma CA2_3_11I2R12Terms_sound (a : PairSlot) : + (CA2_3_11I2R12Terms a).Encloses (Foundation.entropyTerm (CA2_3_11I2R12Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_3_11I2R12Certificates_valid + (CA2_3_11I2R12CertificateIndex a) (CA2_3_11I2R12P_sound a) +def CA2_3_11I2R12Entropy : Ball := ⟨0, 0⟩ +lemma CA2_3_11I2R12Entropy_sound : CA2_3_11I2R12Entropy.Encloses (Foundation.finiteEntropy CA2_3_11I2R12Value) := by + exact contains_sound (entropyPair_enclosed CA2_3_11I2R12Value CA2_3_11I2R12Terms CA2_3_11I2R12Terms_sound) (by decide +kernel) +def CA2_3_11I2R12Mass : Ball := ⟨0, 0⟩ +lemma CA2_3_11I2R12Mass_sound : CA2_3_11I2R12Mass.Encloses (∑ a, CA2_3_11I2R12Value a) := by + exact contains_sound (pairSumBall_sound CA2_3_11I2R12P CA2_3_11I2R12Value CA2_3_11I2R12P_sound) (by decide +kernel) +def CA2_3_11I2R12MassTerm : Ball := .exact 0 +lemma CA2_3_11I2R12MassTerm_sound : CA2_3_11I2R12MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_3_11I2R12Value a))) := + entropyTerm_zero_ball (CA2_3_11I2R12Mass_sound) +def CA2_3_11I2R12H : Ball := ⟨0, 0⟩ +lemma CA2_3_11I2R12H_sound : CA2_3_11I2R12H.Encloses (homogeneousEntropy CA2_3_11I2R12Value) := by + exact contains_sound (homogeneous_enclosed CA2_3_11I2R12Value CA2_3_11I2R12MassTerm_sound CA2_3_11I2R12Entropy_sound) (by decide +kernel) +def CA2_3_11I2R13Value (a : PairSlot) : ℝ := residualLaw (below (shape 2 3 11)) (fun u => (stageALaw (shape 2 3 11) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 13 a +def CA2_3_11I2R13Raw (a : PairSlot) : Ball := residualBall (below (shape 2 3 11)) A2_3_11Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 13 a +lemma CA2_3_11I2R13Raw_sound (a : PairSlot) : + (CA2_3_11I2R13Raw a).Encloses (CA2_3_11I2R13Value a) := by + exact residualBall_sound_on (below (shape 2 3 11)) A2_3_11Law (fun u => (stageALaw (shape 2 3 11) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A2_3_11Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 2 3 11) (show (shape 2 3 11) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 13 a +def CA2_3_11I2R13Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA2_3_11I2R13Certificates_valid : + CA2_3_11I2R13Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_3_11I2R13CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA2_3_11I2R13P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_3_11I2R13Certificates (CA2_3_11I2R13CertificateIndex a)).input +lemma CA2_3_11I2R13P_check : ∀ a : PairSlot, contains (CA2_3_11I2R13Raw a) (CA2_3_11I2R13P a) = true := by + decide +kernel +lemma CA2_3_11I2R13P_sound (a : PairSlot) : + (CA2_3_11I2R13P a).Encloses (CA2_3_11I2R13Value a) := + contains_sound (CA2_3_11I2R13Raw_sound a) (CA2_3_11I2R13P_check a) +def CA2_3_11I2R13Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_3_11I2R13Certificates (CA2_3_11I2R13CertificateIndex a)).output +lemma CA2_3_11I2R13Terms_sound (a : PairSlot) : + (CA2_3_11I2R13Terms a).Encloses (Foundation.entropyTerm (CA2_3_11I2R13Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_3_11I2R13Certificates_valid + (CA2_3_11I2R13CertificateIndex a) (CA2_3_11I2R13P_sound a) +def CA2_3_11I2R13Entropy : Ball := ⟨0, 0⟩ +lemma CA2_3_11I2R13Entropy_sound : CA2_3_11I2R13Entropy.Encloses (Foundation.finiteEntropy CA2_3_11I2R13Value) := by + exact contains_sound (entropyPair_enclosed CA2_3_11I2R13Value CA2_3_11I2R13Terms CA2_3_11I2R13Terms_sound) (by decide +kernel) +def CA2_3_11I2R13Mass : Ball := ⟨0, 0⟩ +lemma CA2_3_11I2R13Mass_sound : CA2_3_11I2R13Mass.Encloses (∑ a, CA2_3_11I2R13Value a) := by + exact contains_sound (pairSumBall_sound CA2_3_11I2R13P CA2_3_11I2R13Value CA2_3_11I2R13P_sound) (by decide +kernel) +def CA2_3_11I2R13MassTerm : Ball := .exact 0 +lemma CA2_3_11I2R13MassTerm_sound : CA2_3_11I2R13MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_3_11I2R13Value a))) := + entropyTerm_zero_ball (CA2_3_11I2R13Mass_sound) +def CA2_3_11I2R13H : Ball := ⟨0, 0⟩ +lemma CA2_3_11I2R13H_sound : CA2_3_11I2R13H.Encloses (homogeneousEntropy CA2_3_11I2R13Value) := by + exact contains_sound (homogeneous_enclosed CA2_3_11I2R13Value CA2_3_11I2R13MassTerm_sound CA2_3_11I2R13Entropy_sound) (by decide +kernel) +def CA2_3_11I2R14Value (a : PairSlot) : ℝ := residualLaw (below (shape 2 3 11)) (fun u => (stageALaw (shape 2 3 11) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 14 a +def CA2_3_11I2R14Raw (a : PairSlot) : Ball := residualBall (below (shape 2 3 11)) A2_3_11Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 14 a +lemma CA2_3_11I2R14Raw_sound (a : PairSlot) : + (CA2_3_11I2R14Raw a).Encloses (CA2_3_11I2R14Value a) := by + exact residualBall_sound_on (below (shape 2 3 11)) A2_3_11Law (fun u => (stageALaw (shape 2 3 11) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A2_3_11Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 2 3 11) (show (shape 2 3 11) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 14 a +def CA2_3_11I2R14Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA2_3_11I2R14Certificates_valid : + CA2_3_11I2R14Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_3_11I2R14CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA2_3_11I2R14P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_3_11I2R14Certificates (CA2_3_11I2R14CertificateIndex a)).input +lemma CA2_3_11I2R14P_check : ∀ a : PairSlot, contains (CA2_3_11I2R14Raw a) (CA2_3_11I2R14P a) = true := by + decide +kernel +lemma CA2_3_11I2R14P_sound (a : PairSlot) : + (CA2_3_11I2R14P a).Encloses (CA2_3_11I2R14Value a) := + contains_sound (CA2_3_11I2R14Raw_sound a) (CA2_3_11I2R14P_check a) +def CA2_3_11I2R14Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_3_11I2R14Certificates (CA2_3_11I2R14CertificateIndex a)).output +lemma CA2_3_11I2R14Terms_sound (a : PairSlot) : + (CA2_3_11I2R14Terms a).Encloses (Foundation.entropyTerm (CA2_3_11I2R14Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_3_11I2R14Certificates_valid + (CA2_3_11I2R14CertificateIndex a) (CA2_3_11I2R14P_sound a) +def CA2_3_11I2R14Entropy : Ball := ⟨0, 0⟩ +lemma CA2_3_11I2R14Entropy_sound : CA2_3_11I2R14Entropy.Encloses (Foundation.finiteEntropy CA2_3_11I2R14Value) := by + exact contains_sound (entropyPair_enclosed CA2_3_11I2R14Value CA2_3_11I2R14Terms CA2_3_11I2R14Terms_sound) (by decide +kernel) +def CA2_3_11I2R14Mass : Ball := ⟨0, 0⟩ +lemma CA2_3_11I2R14Mass_sound : CA2_3_11I2R14Mass.Encloses (∑ a, CA2_3_11I2R14Value a) := by + exact contains_sound (pairSumBall_sound CA2_3_11I2R14P CA2_3_11I2R14Value CA2_3_11I2R14P_sound) (by decide +kernel) +def CA2_3_11I2R14MassTerm : Ball := .exact 0 +lemma CA2_3_11I2R14MassTerm_sound : CA2_3_11I2R14MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_3_11I2R14Value a))) := + entropyTerm_zero_ball (CA2_3_11I2R14Mass_sound) +def CA2_3_11I2R14H : Ball := ⟨0, 0⟩ +lemma CA2_3_11I2R14H_sound : CA2_3_11I2R14H.Encloses (homogeneousEntropy CA2_3_11I2R14Value) := by + exact contains_sound (homogeneous_enclosed CA2_3_11I2R14Value CA2_3_11I2R14MassTerm_sound CA2_3_11I2R14Entropy_sound) (by decide +kernel) +def CA2_3_11I2R15Value (a : PairSlot) : ℝ := residualLaw (below (shape 2 3 11)) (fun u => (stageALaw (shape 2 3 11) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 15 a +def CA2_3_11I2R15Raw (a : PairSlot) : Ball := residualBall (below (shape 2 3 11)) A2_3_11Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 15 a +lemma CA2_3_11I2R15Raw_sound (a : PairSlot) : + (CA2_3_11I2R15Raw a).Encloses (CA2_3_11I2R15Value a) := by + exact residualBall_sound_on (below (shape 2 3 11)) A2_3_11Law (fun u => (stageALaw (shape 2 3 11) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A2_3_11Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 2 3 11) (show (shape 2 3 11) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 15 a +def CA2_3_11I2R15Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA2_3_11I2R15Certificates_valid : + CA2_3_11I2R15Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_3_11I2R15CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA2_3_11I2R15P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_3_11I2R15Certificates (CA2_3_11I2R15CertificateIndex a)).input +lemma CA2_3_11I2R15P_check : ∀ a : PairSlot, contains (CA2_3_11I2R15Raw a) (CA2_3_11I2R15P a) = true := by + decide +kernel +lemma CA2_3_11I2R15P_sound (a : PairSlot) : + (CA2_3_11I2R15P a).Encloses (CA2_3_11I2R15Value a) := + contains_sound (CA2_3_11I2R15Raw_sound a) (CA2_3_11I2R15P_check a) +def CA2_3_11I2R15Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_3_11I2R15Certificates (CA2_3_11I2R15CertificateIndex a)).output +lemma CA2_3_11I2R15Terms_sound (a : PairSlot) : + (CA2_3_11I2R15Terms a).Encloses (Foundation.entropyTerm (CA2_3_11I2R15Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_3_11I2R15Certificates_valid + (CA2_3_11I2R15CertificateIndex a) (CA2_3_11I2R15P_sound a) +def CA2_3_11I2R15Entropy : Ball := ⟨0, 0⟩ +lemma CA2_3_11I2R15Entropy_sound : CA2_3_11I2R15Entropy.Encloses (Foundation.finiteEntropy CA2_3_11I2R15Value) := by + exact contains_sound (entropyPair_enclosed CA2_3_11I2R15Value CA2_3_11I2R15Terms CA2_3_11I2R15Terms_sound) (by decide +kernel) +def CA2_3_11I2R15Mass : Ball := ⟨0, 0⟩ +lemma CA2_3_11I2R15Mass_sound : CA2_3_11I2R15Mass.Encloses (∑ a, CA2_3_11I2R15Value a) := by + exact contains_sound (pairSumBall_sound CA2_3_11I2R15P CA2_3_11I2R15Value CA2_3_11I2R15P_sound) (by decide +kernel) +def CA2_3_11I2R15MassTerm : Ball := .exact 0 +lemma CA2_3_11I2R15MassTerm_sound : CA2_3_11I2R15MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_3_11I2R15Value a))) := + entropyTerm_zero_ball (CA2_3_11I2R15Mass_sound) +def CA2_3_11I2R15H : Ball := ⟨0, 0⟩ +lemma CA2_3_11I2R15H_sound : CA2_3_11I2R15H.Encloses (homogeneousEntropy CA2_3_11I2R15Value) := by + exact contains_sound (homogeneous_enclosed CA2_3_11I2R15Value CA2_3_11I2R15MassTerm_sound CA2_3_11I2R15Entropy_sound) (by decide +kernel) +def CA2_3_11I2R16Value (a : PairSlot) : ℝ := residualLaw (below (shape 2 3 11)) (fun u => (stageALaw (shape 2 3 11) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 16 a +def CA2_3_11I2R16Raw (a : PairSlot) : Ball := residualBall (below (shape 2 3 11)) A2_3_11Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 16 a +lemma CA2_3_11I2R16Raw_sound (a : PairSlot) : + (CA2_3_11I2R16Raw a).Encloses (CA2_3_11I2R16Value a) := by + exact residualBall_sound_on (below (shape 2 3 11)) A2_3_11Law (fun u => (stageALaw (shape 2 3 11) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A2_3_11Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 2 3 11) (show (shape 2 3 11) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 16 a +def CA2_3_11I2R16Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA2_3_11I2R16Certificates_valid : + CA2_3_11I2R16Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_3_11I2R16CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA2_3_11I2R16P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_3_11I2R16Certificates (CA2_3_11I2R16CertificateIndex a)).input +lemma CA2_3_11I2R16P_check : ∀ a : PairSlot, contains (CA2_3_11I2R16Raw a) (CA2_3_11I2R16P a) = true := by + decide +kernel +lemma CA2_3_11I2R16P_sound (a : PairSlot) : + (CA2_3_11I2R16P a).Encloses (CA2_3_11I2R16Value a) := + contains_sound (CA2_3_11I2R16Raw_sound a) (CA2_3_11I2R16P_check a) +def CA2_3_11I2R16Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_3_11I2R16Certificates (CA2_3_11I2R16CertificateIndex a)).output +lemma CA2_3_11I2R16Terms_sound (a : PairSlot) : + (CA2_3_11I2R16Terms a).Encloses (Foundation.entropyTerm (CA2_3_11I2R16Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_3_11I2R16Certificates_valid + (CA2_3_11I2R16CertificateIndex a) (CA2_3_11I2R16P_sound a) +def CA2_3_11I2R16Entropy : Ball := ⟨0, 0⟩ +lemma CA2_3_11I2R16Entropy_sound : CA2_3_11I2R16Entropy.Encloses (Foundation.finiteEntropy CA2_3_11I2R16Value) := by + exact contains_sound (entropyPair_enclosed CA2_3_11I2R16Value CA2_3_11I2R16Terms CA2_3_11I2R16Terms_sound) (by decide +kernel) +def CA2_3_11I2R16Mass : Ball := ⟨0, 0⟩ +lemma CA2_3_11I2R16Mass_sound : CA2_3_11I2R16Mass.Encloses (∑ a, CA2_3_11I2R16Value a) := by + exact contains_sound (pairSumBall_sound CA2_3_11I2R16P CA2_3_11I2R16Value CA2_3_11I2R16P_sound) (by decide +kernel) +def CA2_3_11I2R16MassTerm : Ball := .exact 0 +lemma CA2_3_11I2R16MassTerm_sound : CA2_3_11I2R16MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_3_11I2R16Value a))) := + entropyTerm_zero_ball (CA2_3_11I2R16Mass_sound) +def CA2_3_11I2R16H : Ball := ⟨0, 0⟩ +lemma CA2_3_11I2R16H_sound : CA2_3_11I2R16H.Encloses (homogeneousEntropy CA2_3_11I2R16Value) := by + exact contains_sound (homogeneous_enclosed CA2_3_11I2R16Value CA2_3_11I2R16MassTerm_sound CA2_3_11I2R16Entropy_sound) (by decide +kernel) +def CA2_3_11I2ResidualEntropies (a : Fin 17) : Ball := + match a.val with + | 0 => CA2_3_11I2R0H + | 1 => CA2_3_11I2R1H + | 2 => CA2_3_11I2R2H + | 3 => CA2_3_11I2R3H + | 4 => CA2_3_11I2R4H + | 5 => CA2_3_11I2R5H + | 6 => CA2_3_11I2R6H + | 7 => CA2_3_11I2R7H + | 8 => CA2_3_11I2R8H + | 9 => CA2_3_11I2R9H + | 10 => CA2_3_11I2R10H + | 11 => CA2_3_11I2R11H + | 12 => CA2_3_11I2R12H + | 13 => CA2_3_11I2R13H + | 14 => CA2_3_11I2R14H + | 15 => CA2_3_11I2R15H + | 16 => CA2_3_11I2R16H + | _ => (.exact 0) +lemma CA2_3_11I2ResidualEntropies_sound (k : Fin 17) : + (CA2_3_11I2ResidualEntropies k).Encloses (homogeneousEntropy + (residualLaw (below (shape 2 3 11)) (fun u => (stageALaw (shape 2 3 11) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) k)) := by + fin_cases k + · exact CA2_3_11I2R0H_sound + · exact CA2_3_11I2R1H_sound + · exact CA2_3_11I2R2H_sound + · exact CA2_3_11I2R3H_sound + · exact CA2_3_11I2R4H_sound + · exact CA2_3_11I2R5H_sound + · exact CA2_3_11I2R6H_sound + · exact CA2_3_11I2R7H_sound + · exact CA2_3_11I2R8H_sound + · exact CA2_3_11I2R9H_sound + · exact CA2_3_11I2R10H_sound + · exact CA2_3_11I2R11H_sound + · exact CA2_3_11I2R12H_sound + · exact CA2_3_11I2R13H_sound + · exact CA2_3_11I2R14H_sound + · exact CA2_3_11I2R15H_sound + · exact CA2_3_11I2R16H_sound +def CA2_3_11I2Singles (s : Shape) : Ball := + match s 0, s 1, s 2 with + | 0, 0, 8 => Z0_0_8H2H + | 0, 1, 7 => Z0_1_7H2H + | 0, 2, 6 => Z0_2_6H2H + | 0, 3, 5 => Z0_3_5H2H + | 1, 0, 7 => Z1_0_7H2H + | 2, 0, 6 => Z2_0_6H2H + | _, _, _ => (.exact 0) +lemma CA2_3_11I2Singles_sound (u : Shape) (hu : u ∈ below (shape 2 3 11)) + (hd : designated (Equiv.refl (Fin 3)) 2 u) : + (CA2_3_11I2Singles u).Encloses (homogeneousEntropy ((fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) u)) := by + rw [A2_3_11_below] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl + · exact Z0_0_8H2H_sound + · exact Z0_1_7H2H_sound + · exact Z0_2_6H2H_sound + · exact Z0_3_5H2H_sound + · exact Z1_0_7H2H_sound + · exact (show ¬ designated (Equiv.refl (Fin 3)) 2 (shape 1 1 6) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 2 (shape 1 2 5) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 2 (shape 1 3 4) by decide +kernel) hd |>.elim + · exact Z2_0_6H2H_sound + · exact (show ¬ designated (Equiv.refl (Fin 3)) 2 (shape 2 1 5) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 2 (shape 2 2 4) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 2 (shape 2 3 3) by decide +kernel) hd |>.elim +def CA2_3_11I2Singleton : Ball := ⟨(38894992084717347555582283408189 / 100000000000000000000000000000000), (16335271253 / 50000000000000000000000000000000)⟩ +lemma CA2_3_11I2Singleton_sound : CA2_3_11I2Singleton.Encloses + (singletonEntropy (below (shape 2 3 11)) (fun u => (stageALaw (shape 2 3 11) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ))) := by + exact contains_sound (singletonBall_sound (below (shape 2 3 11)) A2_3_11Law (fun u => (stageALaw (shape 2 3 11) u : ℝ)) (Equiv.refl (Fin 3)) 2 + CA2_3_11I2Singles (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A2_3_11Law_sound u) CA2_3_11I2Singles_sound) (by decide +kernel) +def CA2_3_11I2Group : Ball := ⟨(9634925775142631944774657588007 / 12500000000000000000000000000000), (69821895561 / 50000000000000000000000000000000)⟩ +lemma CA2_3_11I2Group_sound : CA2_3_11I2Group.Encloses + (groupedEntropy (below (shape 2 3 11)) (fun u => (stageALaw (shape 2 3 11) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ))) := by + exact contains_sound (Ball.add_sound CA2_3_11I2Singleton_sound + (finSumBall_sound 17 CA2_3_11I2ResidualEntropies _ CA2_3_11I2ResidualEntropies_sound)) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CA2_3_11I2H : Ball := ⟨(466160700057499250171638083679 / 390625000000000000000000000000), (414118310199 / 100000000000000000000000000000000)⟩ +lemma CA2_3_11I2_sound : CA2_3_11I2H.Encloses (stageACapacity (shape 2 3 11) 2) := by + have hb := contains_sound (Ball.add_sound CA2_3_11I2PairH_sound + (Ball.neg_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) CA2_3_11I2Group_sound))) + (show contains (.add CA2_3_11I2PairH (.neg (.mul (.exact 2) CA2_3_11I2Group))) CA2_3_11I2H = true by decide +kernel) + simp only [stageACapacity, nativeCapacity, + show (2 : Fin 3) ≠ 0 by decide, ite_false] + change CA2_3_11I2H.Encloses (homogeneousEntropy CA2_3_11I2PairValue - _) + simpa only [sub_eq_add_neg] using hb + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA2_4_10I0.lean b/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA2_4_10I0.lean new file mode 100644 index 0000000000000000000000000000000000000000..2a99efe048847ce3da16d100de02c76902de54b8 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA2_4_10I0.lean @@ -0,0 +1,74 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Certificates.SplitA2_4_10 + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CA2_4_10I0Value (a : Fin 17) : ℝ := marginal (below (shape 2 4 10)) (fun u => (stageALaw (shape 2 4 10) u : ℝ)) ((Equiv.refl (Fin 3)) 0) a +def CA2_4_10I0Raw (a : Fin 17) : Ball := marginalBall (below (shape 2 4 10)) A2_4_10Law ((Equiv.refl (Fin 3)) 0) a +lemma CA2_4_10I0Raw_sound (a : Fin 17) : + (CA2_4_10I0Raw a).Encloses (CA2_4_10I0Value a) := by + exact marginalBall_sound (below (shape 2 4 10)) A2_4_10Law (fun u => (stageALaw (shape 2 4 10) u : ℝ)) (fun u _ => A2_4_10Law_sound u) ((Equiv.refl (Fin 3)) 0) a +def CA2_4_10I0Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(26087705617267747066040049921581 / 100000000000000000000000000000000), (31 / 25000000000000000000000000000000)⟩ ⟨(1752710369667411269351514178767 / 5000000000000000000000000000000), (662914397 / 4000000000000000000000000000000)⟩ ⟨(-134370603178477487491496450973271 / 100000000000000000000000000000000), (15881867881 / 25000000000000000000000000000000)⟩ ⟨-2, 26087705617267747066040049921581, 25000000000000000000000000000000⟩, + .log ⟨(23912294382732252933959950078419 / 50000000000000000000000000000000), (9 / 6250000000000000000000000000000)⟩ ⟨(35276864296661715112529795930633 / 100000000000000000000000000000000), (30381752033 / 100000000000000000000000000000000)⟩ ⟨(-14752605388689151031123206533413 / 20000000000000000000000000000000), (1270549427 / 2000000000000000000000000000000)⟩ ⟨-2, 23912294382732252933959950078419, 12500000000000000000000000000000⟩] +lemma CA2_4_10I0Certificates_valid : + CA2_4_10I0Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_4_10I0CertificateIndex (a : Fin 17) : ℕ := + match a.val with + | 0 => 1 + | 1 => 2 + | 2 => 1 + | _ => 0 +def CA2_4_10I0P (a : Fin 17) : Ball := + (CompactCertificate.entropyLookup CA2_4_10I0Certificates (CA2_4_10I0CertificateIndex a)).input +lemma CA2_4_10I0P_check : ∀ a : Fin 17, contains (CA2_4_10I0Raw a) (CA2_4_10I0P a) = true := by + decide +kernel +lemma CA2_4_10I0P_sound (a : Fin 17) : + (CA2_4_10I0P a).Encloses (CA2_4_10I0Value a) := + contains_sound (CA2_4_10I0Raw_sound a) (CA2_4_10I0P_check a) +def CA2_4_10I0Terms (a : Fin 17) : Ball := + (CompactCertificate.entropyLookup CA2_4_10I0Certificates (CA2_4_10I0CertificateIndex a)).output +lemma CA2_4_10I0Terms_sound (a : Fin 17) : + (CA2_4_10I0Terms a).Encloses (Foundation.entropyTerm (CA2_4_10I0Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_4_10I0Certificates_valid + (CA2_4_10I0CertificateIndex a) (CA2_4_10I0P_sound a) +def CA2_4_10I0Entropy : Ball := ⟨(105385279083358165886590363081313 / 100000000000000000000000000000000), (63527471883 / 100000000000000000000000000000000)⟩ +lemma CA2_4_10I0Entropy_sound : CA2_4_10I0Entropy.Encloses (Foundation.finiteEntropy CA2_4_10I0Value) := by + exact contains_sound (entropyFin_enclosed 17 CA2_4_10I0Value CA2_4_10I0Terms CA2_4_10I0Terms_sound) (by decide +kernel) +def CA2_4_10I0Mass : Ball := ⟨1, (49 / 12500000000000000000000000000000)⟩ +lemma CA2_4_10I0Mass_sound : CA2_4_10I0Mass.Encloses (∑ a, CA2_4_10I0Value a) := by + exact contains_sound (finSumBall_sound 17 CA2_4_10I0P CA2_4_10I0Value CA2_4_10I0P_sound) (by decide +kernel) +def CA2_4_10I0MassTermLogWitness : LogWitness := ⟨0, 1, 1⟩ +def CA2_4_10I0MassTermLog : Ball := ⟨0, (10587912037 / 50000000000000000000000000000000)⟩ +lemma CA2_4_10I0MassTermLog_sound : CA2_4_10I0MassTermLog.Encloses (Real.log ((∑ a, CA2_4_10I0Value a))) := by + exact checkLog_sound logTwoBall_sound (CA2_4_10I0Mass_sound) (w := CA2_4_10I0MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA2_4_10I0MassTerm : Ball := ⟨0, (847032963 / 4000000000000000000000000000000)⟩ +lemma CA2_4_10I0MassTerm_sound : CA2_4_10I0MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_4_10I0Value a))) := by + exact contains_sound (entropyTerm_ball (CA2_4_10I0Mass_sound) CA2_4_10I0MassTermLog_sound) (by decide +kernel) +def CA2_4_10I0H : Ball := ⟨(105385279083358165886590363081313 / 100000000000000000000000000000000), (42351647979 / 50000000000000000000000000000000)⟩ +lemma CA2_4_10I0H_sound : CA2_4_10I0H.Encloses (homogeneousEntropy CA2_4_10I0Value) := by + exact contains_sound (homogeneous_enclosed CA2_4_10I0Value CA2_4_10I0MassTerm_sound CA2_4_10I0Entropy_sound) (by decide +kernel) +lemma CA2_4_10I0_sound : CA2_4_10I0H.Encloses (stageACapacity (shape 2 4 10) 0) := by + exact CA2_4_10I0H_sound + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA2_4_10I1.lean b/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA2_4_10I1.lean new file mode 100644 index 0000000000000000000000000000000000000000..56a3e4e86864316c8a1ee7784b0b7c226bf13d5c --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA2_4_10I1.lean @@ -0,0 +1,1040 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Certificates.SupportedContraction + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CA2_4_10I1PairValue (a : PairSlot × PairSlot) : ℝ := pairLaw (below (shape 2 4 10)) (shape 2 4 10) (fun u => (stageALaw (shape 2 4 10) u : ℝ)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) a +def CA2_4_10I1PairRaw (a : PairSlot × PairSlot) : Ball := stageAPairBall (shape 2 4 10) A2_4_10Law 1 a +lemma CA2_4_10I1PairRaw_sound (a : PairSlot × PairSlot) : + (CA2_4_10I1PairRaw a).Encloses (CA2_4_10I1PairValue a) := by + exact stageAPairBall_sound (shape 2 4 10) (by decide +kernel) A2_4_10Law (fun u => (stageALaw (shape 2 4 10) u : ℝ)) (fun u _ => A2_4_10Law_sound u) 1 a +def CA2_4_10I1PairCertificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(1570267050551735974943873725333 / 100000000000000000000000000000000), (7 / 50000000000000000000000000000000)⟩ ⟨(1304554149917839056437223571411 / 20000000000000000000000000000000), (2327618947 / 100000000000000000000000000000000)⟩ ⟨(-415392448519971536465802051772989 / 100000000000000000000000000000000), (9264422917 / 6250000000000000000000000000000)⟩ ⟨-6, 1570267050551735974943873725333, 1562500000000000000000000000000⟩, + .log ⟨(3034387089383124528122128843 / 2000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ ⟨(984794096329826778408729518697 / 100000000000000000000000000000000), (353406069 / 100000000000000000000000000000000)⟩ ⟨(-81136162536371588356964125744811 / 12500000000000000000000000000000), (232934061831 / 100000000000000000000000000000000)⟩ ⟨-10, 3034387089383124528122128843, 1953125000000000000000000000⟩, + .log ⟨(953593008292007130199388873 / 6250000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(134080594248960785344959468161 / 100000000000000000000000000000000), (45232593 / 100000000000000000000000000000000)⟩ ⟨(-878785505733692706370894943601029 / 100000000000000000000000000000000), (59292307623 / 20000000000000000000000000000000)⟩ ⟨-13, 953593008292007130199388873, 762939453125000000000000000⟩, + .log ⟨(303667440279865518063022157441 / 100000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ ⟨(1760357815737784962170102391733 / 100000000000000000000000000000000), (643040839 / 100000000000000000000000000000000)⟩ ⟨(-144924807720199332735360433851017 / 25000000000000000000000000000000), (105879118909 / 50000000000000000000000000000000)⟩ ⟨-9, 303667440279865518063022157441, 195312500000000000000000000000⟩, + .log ⟨(4295678730458672526115271023 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(43194406613782287477000663553 / 100000000000000000000000000000000), (7277169 / 50000000000000000000000000000000)⟩ ⟨(-502765794698643470656208650110853 / 50000000000000000000000000000000), (338813202207 / 100000000000000000000000000000000)⟩ ⟨-15, 4295678730458672526115271023, 3051757812500000000000000000⟩, + .log ⟨(2528984564228431434820444687137 / 50000000000000000000000000000000), (17 / 50000000000000000000000000000000)⟩ ⟨(15094017477510129457010294452863 / 100000000000000000000000000000000), (1606599971 / 25000000000000000000000000000000)⟩ ⟨(-14921025706334399094195115931971 / 5000000000000000000000000000000), (12705494277 / 10000000000000000000000000000000)⟩ ⟨-5, 2528984564228431434820444687137, 1562500000000000000000000000000⟩, + .log ⟨(122420790923018468574288295871 / 25000000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ ⟨(260470646978220434206094808563 / 10000000000000000000000000000000), (29164063 / 3125000000000000000000000000000)⟩ ⟨(-531916688771459333603262788731019 / 100000000000000000000000000000000), (190582413963 / 100000000000000000000000000000000)⟩ ⟨-8, 122420790923018468574288295871, 97656250000000000000000000000⟩, + .log ⟨(60600842512749909065437114167 / 25000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ ⟨(364957805749404454085143082913 / 25000000000000000000000000000000), (128327281 / 25000000000000000000000000000000)⟩ ⟨(-301116115401052710030492793355751 / 50000000000000000000000000000000), (211758238067 / 100000000000000000000000000000000)⟩ ⟨-9, 60600842512749909065437114167, 48828125000000000000000000000⟩, + .log ⟨(1425649691580132680461890821801 / 100000000000000000000000000000000), (3 / 25000000000000000000000000000000)⟩ ⟨(6059784678668181098739670143709 / 100000000000000000000000000000000), (301893073 / 12500000000000000000000000000000)⟩ ⟨(-26565890951583273860873471957703 / 6250000000000000000000000000000), (84703295153 / 50000000000000000000000000000000)⟩ ⟨-7, 1425649691580132680461890821801, 781250000000000000000000000000⟩, + .log ⟨(71380118090287457174125633539 / 50000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ ⟨(187066129933937167370719339141 / 20000000000000000000000000000000), (332537231 / 100000000000000000000000000000000)⟩ ⟨(-3275879455980314197911224765219 / 500000000000000000000000000000), (232934061913 / 100000000000000000000000000000000)⟩ ⟨-10, 71380118090287457174125633539, 48828125000000000000000000000⟩, + .log ⟨(5194274658497938993575257267147 / 100000000000000000000000000000000), (1 / 3125000000000000000000000000000)⟩ ⟨(240041488503310393902760243513 / 1562500000000000000000000000000), (6599582787 / 100000000000000000000000000000000)⟩ ⟨(-295761319418838368875440969706011 / 100000000000000000000000000000000), (63527471357 / 50000000000000000000000000000000)⟩ ⟨-5, 5194274658497938993575257267147, 3125000000000000000000000000000⟩, + .log ⟨(224121877578321584972333781 / 1562500000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(126937003819149110868295781031 / 100000000000000000000000000000000), (42523861 / 100000000000000000000000000000000)⟩ ⟨(-884960766037260043466052530094137 / 100000000000000000000000000000000), (296461538533 / 100000000000000000000000000000000)⟩ ⟨-13, 224121877578321584972333781, 190734863281250000000000000⟩, + .log ⟨(104128067974015647083683350937 / 20000000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ ⟨(136872856753006379266553856473 / 5000000000000000000000000000000), (992248949 / 100000000000000000000000000000000)⟩ ⟨(-525786598814690158746556680501431 / 100000000000000000000000000000000), (95291206957 / 50000000000000000000000000000000)⟩ ⟨-8, 104128067974015647083683350937, 78125000000000000000000000000⟩, + .log ⟨(18908059881216521834005381548437 / 100000000000000000000000000000000), (83 / 100000000000000000000000000000000)⟩ ⟨(3936615302164090789828690581369 / 12500000000000000000000000000000), (16015749911 / 100000000000000000000000000000000)⟩ ⟨(-1040988691302688453154033716209 / 625000000000000000000000000000), (84703295171 / 100000000000000000000000000000000)⟩ ⟨-3, 18908059881216521834005381548437, 12500000000000000000000000000000⟩] +lemma CA2_4_10I1PairCertificates_valid : + CA2_4_10I1PairCertificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_4_10I1PairCertificateIndex (a : PairSlot × PairSlot) : ℕ := + match a.1.1.val, a.1.2.val, a.2.1.val, a.2.2.val with + | 0, 0, 2, 2 => 1 + | 0, 0, 2, 3 => 2 + | 0, 0, 3, 2 => 2 + | 0, 0, 3, 3 => 3 + | 0, 0, 4, 1 => 4 + | 0, 0, 5, 0 => 5 + | 0, 0, 1, 4 => 4 + | 0, 0, 0, 5 => 5 + | 1, 0, 1, 2 => 6 + | 1, 0, 1, 3 => 7 + | 1, 0, 2, 1 => 6 + | 1, 0, 3, 1 => 7 + | 1, 0, 4, 0 => 8 + | 1, 0, 0, 4 => 8 + | 0, 1, 1, 2 => 6 + | 0, 1, 1, 3 => 7 + | 0, 1, 2, 1 => 6 + | 0, 1, 3, 1 => 7 + | 0, 1, 4, 0 => 8 + | 0, 1, 0, 4 => 8 + | 2, 0, 0, 2 => 9 + | 2, 0, 0, 3 => 10 + | 2, 0, 1, 1 => 11 + | 2, 0, 2, 0 => 9 + | 2, 0, 3, 0 => 10 + | 3, 0, 0, 2 => 10 + | 3, 0, 0, 3 => 12 + | 3, 0, 1, 1 => 13 + | 3, 0, 2, 0 => 10 + | 3, 0, 3, 0 => 12 + | 1, 1, 0, 2 => 11 + | 1, 1, 0, 3 => 13 + | 1, 1, 1, 1 => 14 + | 1, 1, 2, 0 => 11 + | 1, 1, 3, 0 => 13 + | 0, 2, 0, 2 => 9 + | 0, 2, 0, 3 => 10 + | 0, 2, 1, 1 => 11 + | 0, 2, 2, 0 => 9 + | 0, 2, 3, 0 => 10 + | 0, 3, 0, 2 => 10 + | 0, 3, 0, 3 => 12 + | 0, 3, 1, 1 => 13 + | 0, 3, 2, 0 => 10 + | 0, 3, 3, 0 => 12 + | 4, 0, 0, 1 => 8 + | 4, 0, 1, 0 => 8 + | 2, 1, 0, 1 => 6 + | 2, 1, 1, 0 => 6 + | 3, 1, 0, 1 => 7 + | 3, 1, 1, 0 => 7 + | 1, 2, 0, 1 => 6 + | 1, 2, 1, 0 => 6 + | 1, 3, 0, 1 => 7 + | 1, 3, 1, 0 => 7 + | 0, 4, 0, 1 => 8 + | 0, 4, 1, 0 => 8 + | 0, 5, 0, 0 => 5 + | 1, 4, 0, 0 => 4 + | 2, 2, 0, 0 => 1 + | 2, 3, 0, 0 => 2 + | 3, 2, 0, 0 => 2 + | 3, 3, 0, 0 => 3 + | 4, 1, 0, 0 => 4 + | 5, 0, 0, 0 => 5 + | _, _, _, _ => 0 +def CA2_4_10I1PairP (a : PairSlot × PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_4_10I1PairCertificates (CA2_4_10I1PairCertificateIndex a)).input +lemma CA2_4_10I1PairP_check_0_0 : ∀ k l : Fin 6, contains (CA2_4_10I1PairRaw ((0,0),(k,l))) (CA2_4_10I1PairP ((0,0),(k,l))) = true := by + decide +kernel +lemma CA2_4_10I1PairP_check_0_1 : ∀ k l : Fin 6, contains (CA2_4_10I1PairRaw ((0,1),(k,l))) (CA2_4_10I1PairP ((0,1),(k,l))) = true := by + decide +kernel +lemma CA2_4_10I1PairP_check_0_2 : ∀ k l : Fin 6, contains (CA2_4_10I1PairRaw ((0,2),(k,l))) (CA2_4_10I1PairP ((0,2),(k,l))) = true := by + decide +kernel +lemma CA2_4_10I1PairP_check_0_3 : ∀ k l : Fin 6, contains (CA2_4_10I1PairRaw ((0,3),(k,l))) (CA2_4_10I1PairP ((0,3),(k,l))) = true := by + decide +kernel +lemma CA2_4_10I1PairP_check_0_4 : ∀ k l : Fin 6, contains (CA2_4_10I1PairRaw ((0,4),(k,l))) (CA2_4_10I1PairP ((0,4),(k,l))) = true := by + decide +kernel +lemma CA2_4_10I1PairP_check_0_5 : ∀ k l : Fin 6, contains (CA2_4_10I1PairRaw ((0,5),(k,l))) (CA2_4_10I1PairP ((0,5),(k,l))) = true := by + decide +kernel +lemma CA2_4_10I1PairP_check_1_0 : ∀ k l : Fin 6, contains (CA2_4_10I1PairRaw ((1,0),(k,l))) (CA2_4_10I1PairP ((1,0),(k,l))) = true := by + decide +kernel +lemma CA2_4_10I1PairP_check_1_1 : ∀ k l : Fin 6, contains (CA2_4_10I1PairRaw ((1,1),(k,l))) (CA2_4_10I1PairP ((1,1),(k,l))) = true := by + decide +kernel +lemma CA2_4_10I1PairP_check_1_2 : ∀ k l : Fin 6, contains (CA2_4_10I1PairRaw ((1,2),(k,l))) (CA2_4_10I1PairP ((1,2),(k,l))) = true := by + decide +kernel +lemma CA2_4_10I1PairP_check_1_3 : ∀ k l : Fin 6, contains (CA2_4_10I1PairRaw ((1,3),(k,l))) (CA2_4_10I1PairP ((1,3),(k,l))) = true := by + decide +kernel +lemma CA2_4_10I1PairP_check_1_4 : ∀ k l : Fin 6, contains (CA2_4_10I1PairRaw ((1,4),(k,l))) (CA2_4_10I1PairP ((1,4),(k,l))) = true := by + decide +kernel +lemma CA2_4_10I1PairP_check_1_5 : ∀ k l : Fin 6, contains (CA2_4_10I1PairRaw ((1,5),(k,l))) (CA2_4_10I1PairP ((1,5),(k,l))) = true := by + decide +kernel +lemma CA2_4_10I1PairP_check_2_0 : ∀ k l : Fin 6, contains (CA2_4_10I1PairRaw ((2,0),(k,l))) (CA2_4_10I1PairP ((2,0),(k,l))) = true := by + decide +kernel +lemma CA2_4_10I1PairP_check_2_1 : ∀ k l : Fin 6, contains (CA2_4_10I1PairRaw ((2,1),(k,l))) (CA2_4_10I1PairP ((2,1),(k,l))) = true := by + decide +kernel +lemma CA2_4_10I1PairP_check_2_2 : ∀ k l : Fin 6, contains (CA2_4_10I1PairRaw ((2,2),(k,l))) (CA2_4_10I1PairP ((2,2),(k,l))) = true := by + decide +kernel +lemma CA2_4_10I1PairP_check_2_3 : ∀ k l : Fin 6, contains (CA2_4_10I1PairRaw ((2,3),(k,l))) (CA2_4_10I1PairP ((2,3),(k,l))) = true := by + decide +kernel +lemma CA2_4_10I1PairP_check_2_4 : ∀ k l : Fin 6, contains (CA2_4_10I1PairRaw ((2,4),(k,l))) (CA2_4_10I1PairP ((2,4),(k,l))) = true := by + decide +kernel +lemma CA2_4_10I1PairP_check_2_5 : ∀ k l : Fin 6, contains (CA2_4_10I1PairRaw ((2,5),(k,l))) (CA2_4_10I1PairP ((2,5),(k,l))) = true := by + decide +kernel +lemma CA2_4_10I1PairP_check_3_0 : ∀ k l : Fin 6, contains (CA2_4_10I1PairRaw ((3,0),(k,l))) (CA2_4_10I1PairP ((3,0),(k,l))) = true := by + decide +kernel +lemma CA2_4_10I1PairP_check_3_1 : ∀ k l : Fin 6, contains (CA2_4_10I1PairRaw ((3,1),(k,l))) (CA2_4_10I1PairP ((3,1),(k,l))) = true := by + decide +kernel +lemma CA2_4_10I1PairP_check_3_2 : ∀ k l : Fin 6, contains (CA2_4_10I1PairRaw ((3,2),(k,l))) (CA2_4_10I1PairP ((3,2),(k,l))) = true := by + decide +kernel +lemma CA2_4_10I1PairP_check_3_3 : ∀ k l : Fin 6, contains (CA2_4_10I1PairRaw ((3,3),(k,l))) (CA2_4_10I1PairP ((3,3),(k,l))) = true := by + decide +kernel +lemma CA2_4_10I1PairP_check_3_4 : ∀ k l : Fin 6, contains (CA2_4_10I1PairRaw ((3,4),(k,l))) (CA2_4_10I1PairP ((3,4),(k,l))) = true := by + decide +kernel +lemma CA2_4_10I1PairP_check_3_5 : ∀ k l : Fin 6, contains (CA2_4_10I1PairRaw ((3,5),(k,l))) (CA2_4_10I1PairP ((3,5),(k,l))) = true := by + decide +kernel +lemma CA2_4_10I1PairP_check_4_0 : ∀ k l : Fin 6, contains (CA2_4_10I1PairRaw ((4,0),(k,l))) (CA2_4_10I1PairP ((4,0),(k,l))) = true := by + decide +kernel +lemma CA2_4_10I1PairP_check_4_1 : ∀ k l : Fin 6, contains (CA2_4_10I1PairRaw ((4,1),(k,l))) (CA2_4_10I1PairP ((4,1),(k,l))) = true := by + decide +kernel +lemma CA2_4_10I1PairP_check_4_2 : ∀ k l : Fin 6, contains (CA2_4_10I1PairRaw ((4,2),(k,l))) (CA2_4_10I1PairP ((4,2),(k,l))) = true := by + decide +kernel +lemma CA2_4_10I1PairP_check_4_3 : ∀ k l : Fin 6, contains (CA2_4_10I1PairRaw ((4,3),(k,l))) (CA2_4_10I1PairP ((4,3),(k,l))) = true := by + decide +kernel +lemma CA2_4_10I1PairP_check_4_4 : ∀ k l : Fin 6, contains (CA2_4_10I1PairRaw ((4,4),(k,l))) (CA2_4_10I1PairP ((4,4),(k,l))) = true := by + decide +kernel +lemma CA2_4_10I1PairP_check_4_5 : ∀ k l : Fin 6, contains (CA2_4_10I1PairRaw ((4,5),(k,l))) (CA2_4_10I1PairP ((4,5),(k,l))) = true := by + decide +kernel +lemma CA2_4_10I1PairP_check_5_0 : ∀ k l : Fin 6, contains (CA2_4_10I1PairRaw ((5,0),(k,l))) (CA2_4_10I1PairP ((5,0),(k,l))) = true := by + decide +kernel +lemma CA2_4_10I1PairP_check_5_1 : ∀ k l : Fin 6, contains (CA2_4_10I1PairRaw ((5,1),(k,l))) (CA2_4_10I1PairP ((5,1),(k,l))) = true := by + decide +kernel +lemma CA2_4_10I1PairP_check_5_2 : ∀ k l : Fin 6, contains (CA2_4_10I1PairRaw ((5,2),(k,l))) (CA2_4_10I1PairP ((5,2),(k,l))) = true := by + decide +kernel +lemma CA2_4_10I1PairP_check_5_3 : ∀ k l : Fin 6, contains (CA2_4_10I1PairRaw ((5,3),(k,l))) (CA2_4_10I1PairP ((5,3),(k,l))) = true := by + decide +kernel +lemma CA2_4_10I1PairP_check_5_4 : ∀ k l : Fin 6, contains (CA2_4_10I1PairRaw ((5,4),(k,l))) (CA2_4_10I1PairP ((5,4),(k,l))) = true := by + decide +kernel +lemma CA2_4_10I1PairP_check_5_5 : ∀ k l : Fin 6, contains (CA2_4_10I1PairRaw ((5,5),(k,l))) (CA2_4_10I1PairP ((5,5),(k,l))) = true := by + decide +kernel +lemma CA2_4_10I1PairP_check (a : PairSlot × PairSlot) : contains (CA2_4_10I1PairRaw a) (CA2_4_10I1PairP a) = true := by + rcases a with ⟨⟨i,j⟩,⟨k,l⟩⟩ + revert j i + apply forall_fin6 + · exact forall_fin6 (CA2_4_10I1PairP_check_0_0 k l) (CA2_4_10I1PairP_check_0_1 k l) (CA2_4_10I1PairP_check_0_2 k l) (CA2_4_10I1PairP_check_0_3 k l) (CA2_4_10I1PairP_check_0_4 k l) (CA2_4_10I1PairP_check_0_5 k l) + · exact forall_fin6 (CA2_4_10I1PairP_check_1_0 k l) (CA2_4_10I1PairP_check_1_1 k l) (CA2_4_10I1PairP_check_1_2 k l) (CA2_4_10I1PairP_check_1_3 k l) (CA2_4_10I1PairP_check_1_4 k l) (CA2_4_10I1PairP_check_1_5 k l) + · exact forall_fin6 (CA2_4_10I1PairP_check_2_0 k l) (CA2_4_10I1PairP_check_2_1 k l) (CA2_4_10I1PairP_check_2_2 k l) (CA2_4_10I1PairP_check_2_3 k l) (CA2_4_10I1PairP_check_2_4 k l) (CA2_4_10I1PairP_check_2_5 k l) + · exact forall_fin6 (CA2_4_10I1PairP_check_3_0 k l) (CA2_4_10I1PairP_check_3_1 k l) (CA2_4_10I1PairP_check_3_2 k l) (CA2_4_10I1PairP_check_3_3 k l) (CA2_4_10I1PairP_check_3_4 k l) (CA2_4_10I1PairP_check_3_5 k l) + · exact forall_fin6 (CA2_4_10I1PairP_check_4_0 k l) (CA2_4_10I1PairP_check_4_1 k l) (CA2_4_10I1PairP_check_4_2 k l) (CA2_4_10I1PairP_check_4_3 k l) (CA2_4_10I1PairP_check_4_4 k l) (CA2_4_10I1PairP_check_4_5 k l) + · exact forall_fin6 (CA2_4_10I1PairP_check_5_0 k l) (CA2_4_10I1PairP_check_5_1 k l) (CA2_4_10I1PairP_check_5_2 k l) (CA2_4_10I1PairP_check_5_3 k l) (CA2_4_10I1PairP_check_5_4 k l) (CA2_4_10I1PairP_check_5_5 k l) +lemma CA2_4_10I1PairP_sound (a : PairSlot × PairSlot) : + (CA2_4_10I1PairP a).Encloses (CA2_4_10I1PairValue a) := + contains_sound (CA2_4_10I1PairRaw_sound a) (CA2_4_10I1PairP_check a) +def CA2_4_10I1PairTerms (a : PairSlot × PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_4_10I1PairCertificates (CA2_4_10I1PairCertificateIndex a)).output +lemma CA2_4_10I1PairTerms_sound (a : PairSlot × PairSlot) : + (CA2_4_10I1PairTerms a).Encloses (Foundation.entropyTerm (CA2_4_10I1PairValue a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_4_10I1PairCertificates_valid + (CA2_4_10I1PairCertificateIndex a) (CA2_4_10I1PairP_sound a) +def CA2_4_10I1PairEntropy : Ball := ⟨(78464608316607251550725274170061 / 25000000000000000000000000000000), (130647428739 / 100000000000000000000000000000000)⟩ +lemma CA2_4_10I1PairEntropy_sound : CA2_4_10I1PairEntropy.Encloses (Foundation.finiteEntropy CA2_4_10I1PairValue) := by + exact contains_sound (entropyDoublePair_enclosed CA2_4_10I1PairValue CA2_4_10I1PairTerms CA2_4_10I1PairTerms_sound) (by decide +kernel) +def CA2_4_10I1PairMass : Ball := ⟨(19999999999999999999999999999999 / 20000000000000000000000000000000), (677 / 100000000000000000000000000000000)⟩ +lemma CA2_4_10I1PairMass_sound : CA2_4_10I1PairMass.Encloses (∑ a, CA2_4_10I1PairValue a) := by + exact contains_sound (doublePairSumBall_sound CA2_4_10I1PairP CA2_4_10I1PairValue CA2_4_10I1PairP_sound) (by decide +kernel) +def CA2_4_10I1PairMassTermLogWitness : LogWitness := ⟨-1, 19999999999999999999999999999999, 10000000000000000000000000000000⟩ +def CA2_4_10I1PairMassTermLog : Ball := ⟨(-1 / 20000000000000000000000000000000), (42351648043 / 100000000000000000000000000000000)⟩ +lemma CA2_4_10I1PairMassTermLog_sound : CA2_4_10I1PairMassTermLog.Encloses (Real.log ((∑ a, CA2_4_10I1PairValue a))) := by + exact checkLog_sound logTwoBall_sound (CA2_4_10I1PairMass_sound) (w := CA2_4_10I1PairMassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA2_4_10I1PairMassTerm : Ball := ⟨(1 / 20000000000000000000000000000000), (10587912011 / 25000000000000000000000000000000)⟩ +lemma CA2_4_10I1PairMassTerm_sound : CA2_4_10I1PairMassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_4_10I1PairValue a))) := by + exact contains_sound (entropyTerm_ball (CA2_4_10I1PairMass_sound) CA2_4_10I1PairMassTermLog_sound) (by decide +kernel) +def CA2_4_10I1PairH : Ball := ⟨(313858433266429006202901096680239 / 100000000000000000000000000000000), (172999076783 / 100000000000000000000000000000000)⟩ +lemma CA2_4_10I1PairH_sound : CA2_4_10I1PairH.Encloses (homogeneousEntropy CA2_4_10I1PairValue) := by + exact contains_sound (homogeneous_enclosed CA2_4_10I1PairValue CA2_4_10I1PairMassTerm_sound CA2_4_10I1PairEntropy_sound) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CA2_4_10I1R0Value (a : PairSlot) : ℝ := residualLaw (below (shape 2 4 10)) (fun u => (stageALaw (shape 2 4 10) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 0 a +def CA2_4_10I1R0Raw (a : PairSlot) : Ball := residualBall (below (shape 2 4 10)) A2_4_10Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 0 a +lemma CA2_4_10I1R0Raw_sound (a : PairSlot) : + (CA2_4_10I1R0Raw a).Encloses (CA2_4_10I1R0Value a) := by + exact residualBall_sound_on (below (shape 2 4 10)) A2_4_10Law (fun u => (stageALaw (shape 2 4 10) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A2_4_10Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 2 4 10) (show (shape 2 4 10) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 0 a +def CA2_4_10I1R0Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(2504889485643368923017551688527 / 100000000000000000000000000000000), (17 / 100000000000000000000000000000000)⟩ ⟨(2308835273618154621376203064027 / 25000000000000000000000000000000), (3713016947 / 100000000000000000000000000000000)⟩ ⟨(-92173139248302656677203865689747 / 25000000000000000000000000000000), (148230766459 / 100000000000000000000000000000000)⟩ ⟨-6, 2504889485643368923017551688527, 1562500000000000000000000000000⟩] +lemma CA2_4_10I1R0Certificates_valid : + CA2_4_10I1R0Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_4_10I1R0CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 0, 0 => 1 + | _, _ => 0 +def CA2_4_10I1R0P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_4_10I1R0Certificates (CA2_4_10I1R0CertificateIndex a)).input +lemma CA2_4_10I1R0P_check : ∀ a : PairSlot, contains (CA2_4_10I1R0Raw a) (CA2_4_10I1R0P a) = true := by + decide +kernel +lemma CA2_4_10I1R0P_sound (a : PairSlot) : + (CA2_4_10I1R0P a).Encloses (CA2_4_10I1R0Value a) := + contains_sound (CA2_4_10I1R0Raw_sound a) (CA2_4_10I1R0P_check a) +def CA2_4_10I1R0Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_4_10I1R0Certificates (CA2_4_10I1R0CertificateIndex a)).output +lemma CA2_4_10I1R0Terms_sound (a : PairSlot) : + (CA2_4_10I1R0Terms a).Encloses (Foundation.entropyTerm (CA2_4_10I1R0Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_4_10I1R0Certificates_valid + (CA2_4_10I1R0CertificateIndex a) (CA2_4_10I1R0P_sound a) +def CA2_4_10I1R0Entropy : Ball := ⟨(2308835273618154621376203064027 / 25000000000000000000000000000000), (3713016947 / 100000000000000000000000000000000)⟩ +lemma CA2_4_10I1R0Entropy_sound : CA2_4_10I1R0Entropy.Encloses (Foundation.finiteEntropy CA2_4_10I1R0Value) := by + exact contains_sound (entropyPair_enclosed CA2_4_10I1R0Value CA2_4_10I1R0Terms CA2_4_10I1R0Terms_sound) (by decide +kernel) +def CA2_4_10I1R0Mass : Ball := ⟨(2504889485643368923017551688527 / 100000000000000000000000000000000), (17 / 100000000000000000000000000000000)⟩ +lemma CA2_4_10I1R0Mass_sound : CA2_4_10I1R0Mass.Encloses (∑ a, CA2_4_10I1R0Value a) := by + exact contains_sound (pairSumBall_sound CA2_4_10I1R0P CA2_4_10I1R0Value CA2_4_10I1R0P_sound) (by decide +kernel) +def CA2_4_10I1R0MassTermLogWitness : LogWitness := ⟨-6, 2504889485643368923017551688527, 1562500000000000000000000000000⟩ +def CA2_4_10I1R0MassTermLog : Ball := ⟨(-92173139248302656677203865689747 / 25000000000000000000000000000000), (148230766459 / 100000000000000000000000000000000)⟩ +lemma CA2_4_10I1R0MassTermLog_sound : CA2_4_10I1R0MassTermLog.Encloses (Real.log ((∑ a, CA2_4_10I1R0Value a))) := by + exact checkLog_sound logTwoBall_sound (CA2_4_10I1R0Mass_sound) (w := CA2_4_10I1R0MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA2_4_10I1R0MassTerm : Ball := ⟨(2308835273618154621376203064027 / 25000000000000000000000000000000), (3713016947 / 100000000000000000000000000000000)⟩ +lemma CA2_4_10I1R0MassTerm_sound : CA2_4_10I1R0MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_4_10I1R0Value a))) := by + exact contains_sound (entropyTerm_ball (CA2_4_10I1R0Mass_sound) CA2_4_10I1R0MassTermLog_sound) (by decide +kernel) +def CA2_4_10I1R0H : Ball := ⟨0, (3713016947 / 50000000000000000000000000000000)⟩ +lemma CA2_4_10I1R0H_sound : CA2_4_10I1R0H.Encloses (homogeneousEntropy CA2_4_10I1R0Value) := by + exact contains_sound (homogeneous_enclosed CA2_4_10I1R0Value CA2_4_10I1R0MassTerm_sound CA2_4_10I1R0Entropy_sound) (by decide +kernel) +def CA2_4_10I1R1Value (a : PairSlot) : ℝ := residualLaw (below (shape 2 4 10)) (fun u => (stageALaw (shape 2 4 10) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 1 a +def CA2_4_10I1R1Raw (a : PairSlot) : Ball := residualBall (below (shape 2 4 10)) A2_4_10Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 1 a +lemma CA2_4_10I1R1Raw_sound (a : PairSlot) : + (CA2_4_10I1R1Raw a).Encloses (CA2_4_10I1R1Value a) := by + exact residualBall_sound_on (below (shape 2 4 10)) A2_4_10Law (fun u => (stageALaw (shape 2 4 10) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A2_4_10Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 2 4 10) (show (shape 2 4 10) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 1 a +def CA2_4_10I1R1Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(11580111324399872760399582028853 / 100000000000000000000000000000000), (61 / 100000000000000000000000000000000)⟩ ⟨(24965343144609674399182126743019 / 100000000000000000000000000000000), (490436799 / 4000000000000000000000000000000)⟩ ⟨(-2155881100383417719247352642923 / 1000000000000000000000000000000), (105879118941 / 100000000000000000000000000000000)⟩ ⟨-4, 11580111324399872760399582028853, 6250000000000000000000000000000⟩] +lemma CA2_4_10I1R1Certificates_valid : + CA2_4_10I1R1Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_4_10I1R1CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 1, 0 => 1 + | 0, 1 => 1 + | _, _ => 0 +def CA2_4_10I1R1P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_4_10I1R1Certificates (CA2_4_10I1R1CertificateIndex a)).input +lemma CA2_4_10I1R1P_check : ∀ a : PairSlot, contains (CA2_4_10I1R1Raw a) (CA2_4_10I1R1P a) = true := by + decide +kernel +lemma CA2_4_10I1R1P_sound (a : PairSlot) : + (CA2_4_10I1R1P a).Encloses (CA2_4_10I1R1Value a) := + contains_sound (CA2_4_10I1R1Raw_sound a) (CA2_4_10I1R1P_check a) +def CA2_4_10I1R1Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_4_10I1R1Certificates (CA2_4_10I1R1CertificateIndex a)).output +lemma CA2_4_10I1R1Terms_sound (a : PairSlot) : + (CA2_4_10I1R1Terms a).Encloses (Foundation.entropyTerm (CA2_4_10I1R1Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_4_10I1R1Certificates_valid + (CA2_4_10I1R1CertificateIndex a) (CA2_4_10I1R1P_sound a) +def CA2_4_10I1R1Entropy : Ball := ⟨(24965343144609674399182126743019 / 50000000000000000000000000000000), (490436799 / 2000000000000000000000000000000)⟩ +lemma CA2_4_10I1R1Entropy_sound : CA2_4_10I1R1Entropy.Encloses (Foundation.finiteEntropy CA2_4_10I1R1Value) := by + exact contains_sound (entropyPair_enclosed CA2_4_10I1R1Value CA2_4_10I1R1Terms CA2_4_10I1R1Terms_sound) (by decide +kernel) +def CA2_4_10I1R1Mass : Ball := ⟨(11580111324399872760399582028853 / 50000000000000000000000000000000), (61 / 50000000000000000000000000000000)⟩ +lemma CA2_4_10I1R1Mass_sound : CA2_4_10I1R1Mass.Encloses (∑ a, CA2_4_10I1R1Value a) := by + exact contains_sound (pairSumBall_sound CA2_4_10I1R1P CA2_4_10I1R1Value CA2_4_10I1R1P_sound) (by decide +kernel) +def CA2_4_10I1R1MassTermLogWitness : LogWitness := ⟨-3, 11580111324399872760399582028853, 6250000000000000000000000000000⟩ +def CA2_4_10I1R1MassTermLog : Ball := ⟨(-14627339198234724098301207124197 / 10000000000000000000000000000000), (42351647629 / 50000000000000000000000000000000)⟩ +lemma CA2_4_10I1R1MassTermLog_sound : CA2_4_10I1R1MassTermLog.Encloses (Real.log ((∑ a, CA2_4_10I1R1Value a))) := by + exact checkLog_sound logTwoBall_sound (CA2_4_10I1R1Mass_sound) (w := CA2_4_10I1R1MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA2_4_10I1R1MassTerm : Ball := ⟨(4234655407382902096081315647709 / 12500000000000000000000000000000), (1226091997 / 6250000000000000000000000000000)⟩ +lemma CA2_4_10I1R1MassTerm_sound : CA2_4_10I1R1MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_4_10I1R1Value a))) := by + exact contains_sound (entropyTerm_ball (CA2_4_10I1R1Mass_sound) CA2_4_10I1R1MassTermLog_sound) (by decide +kernel) +def CA2_4_10I1R1H : Ball := ⟨(8026721515078066014856864152183 / 50000000000000000000000000000000), (22069655951 / 50000000000000000000000000000000)⟩ +lemma CA2_4_10I1R1H_sound : CA2_4_10I1R1H.Encloses (homogeneousEntropy CA2_4_10I1R1Value) := by + exact contains_sound (homogeneous_enclosed CA2_4_10I1R1Value CA2_4_10I1R1MassTerm_sound CA2_4_10I1R1Entropy_sound) (by decide +kernel) +def CA2_4_10I1R2Value (a : PairSlot) : ℝ := residualLaw (below (shape 2 4 10)) (fun u => (stageALaw (shape 2 4 10) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 2 a +def CA2_4_10I1R2Raw (a : PairSlot) : Ball := residualBall (below (shape 2 4 10)) A2_4_10Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 2 a +lemma CA2_4_10I1R2Raw_sound (a : PairSlot) : + (CA2_4_10I1R2Raw a).Encloses (CA2_4_10I1R2Value a) := by + exact residualBall_sound_on (below (shape 2 4 10)) A2_4_10Law (fun u => (stageALaw (shape 2 4 10) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A2_4_10Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 2 4 10) (show (shape 2 4 10) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 2 a +def CA2_4_10I1R2Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(1666218902803870836639108288981 / 20000000000000000000000000000000), (23 / 50000000000000000000000000000000)⟩ ⟨(20704230676447350293382511103893 / 100000000000000000000000000000000), (8820889587 / 100000000000000000000000000000000)⟩ ⟨(-124258767210039430807601364073447 / 50000000000000000000000000000000), (105879118967 / 100000000000000000000000000000000)⟩ ⟨-4, 1666218902803870836639108288981, 1250000000000000000000000000000⟩, + .log ⟨(834848412561253226991378012811 / 100000000000000000000000000000000), (1 / 20000000000000000000000000000000)⟩ ⟨(1997656712969327772773907353117 / 50000000000000000000000000000000), (1414288253 / 100000000000000000000000000000000)⟩ ⟨(-239283764922144922338536586260167 / 50000000000000000000000000000000), (84703295031 / 50000000000000000000000000000000)⟩ ⟨-7, 834848412561253226991378012811, 781250000000000000000000000000⟩, + .log ⟨(15168944938976278145996364796051 / 50000000000000000000000000000000), (7 / 6250000000000000000000000000000)⟩ ⟨(36186208753457450142976308090281 / 100000000000000000000000000000000), (3854578891 / 20000000000000000000000000000000)⟩ ⟨(-11927727636639303812062773998161 / 10000000000000000000000000000000), (63527471417 / 100000000000000000000000000000000)⟩ ⟨-2, 15168944938976278145996364796051, 12500000000000000000000000000000⟩] +lemma CA2_4_10I1R2Certificates_valid : + CA2_4_10I1R2Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_4_10I1R2CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 2, 0 => 1 + | 3, 0 => 2 + | 1, 1 => 3 + | 0, 2 => 1 + | 0, 3 => 2 + | _, _ => 0 +def CA2_4_10I1R2P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_4_10I1R2Certificates (CA2_4_10I1R2CertificateIndex a)).input +lemma CA2_4_10I1R2P_check : ∀ a : PairSlot, contains (CA2_4_10I1R2Raw a) (CA2_4_10I1R2P a) = true := by + decide +kernel +lemma CA2_4_10I1R2P_sound (a : PairSlot) : + (CA2_4_10I1R2P a).Encloses (CA2_4_10I1R2Value a) := + contains_sound (CA2_4_10I1R2Raw_sound a) (CA2_4_10I1R2P_check a) +def CA2_4_10I1R2Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_4_10I1R2Certificates (CA2_4_10I1R2CertificateIndex a)).output +lemma CA2_4_10I1R2Terms_sound (a : PairSlot) : + (CA2_4_10I1R2Terms a).Encloses (Foundation.entropyTerm (CA2_4_10I1R2Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_4_10I1R2Certificates_valid + (CA2_4_10I1R2CertificateIndex a) (CA2_4_10I1R2P_sound a) +def CA2_4_10I1R2Entropy : Ball := ⟨(17117059391645892364167391942107 / 20000000000000000000000000000000), (7948650027 / 20000000000000000000000000000000)⟩ +lemma CA2_4_10I1R2Entropy_sound : CA2_4_10I1R2Entropy.Encloses (Foundation.finiteEntropy CA2_4_10I1R2Value) := by + exact contains_sound (entropyPair_enclosed CA2_4_10I1R2Value CA2_4_10I1R2Terms CA2_4_10I1R2Terms_sound) (by decide +kernel) +def CA2_4_10I1R2Mass : Ball := ⟨(24334887865556885556183284253767 / 50000000000000000000000000000000), (107 / 50000000000000000000000000000000)⟩ +lemma CA2_4_10I1R2Mass_sound : CA2_4_10I1R2Mass.Encloses (∑ a, CA2_4_10I1R2Value a) := by + exact contains_sound (pairSumBall_sound CA2_4_10I1R2P CA2_4_10I1R2Value CA2_4_10I1R2P_sound) (by decide +kernel) +def CA2_4_10I1R2MassTermLogWitness : LogWitness := ⟨-2, 24334887865556885556183284253767, 12500000000000000000000000000000⟩ +def CA2_4_10I1R2MassTermLog : Ball := ⟨(-36005598505125881559196550427071 / 50000000000000000000000000000000), (496308371 / 781250000000000000000000000000)⟩ +lemma CA2_4_10I1R2MassTermLog_sound : CA2_4_10I1R2MassTermLog.Encloses (Real.log ((∑ a, CA2_4_10I1R2Value a))) := by + exact checkLog_sound logTwoBall_sound (CA2_4_10I1R2Mass_sound) (w := CA2_4_10I1R2MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA2_4_10I1R2MassTerm : Ball := ⟨(1401907523447201525122493550069 / 4000000000000000000000000000000), (3864834757 / 12500000000000000000000000000000)⟩ +lemma CA2_4_10I1R2MassTerm_sound : CA2_4_10I1R2MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_4_10I1R2Value a))) := by + exact contains_sound (entropyTerm_ball (CA2_4_10I1R2Mass_sound) CA2_4_10I1R2MassTermLog_sound) (by decide +kernel) +def CA2_4_10I1R2H : Ball := ⟨(5053760887204942369277462095881 / 10000000000000000000000000000000), (70661928191 / 100000000000000000000000000000000)⟩ +lemma CA2_4_10I1R2H_sound : CA2_4_10I1R2H.Encloses (homogeneousEntropy CA2_4_10I1R2Value) := by + exact contains_sound (homogeneous_enclosed CA2_4_10I1R2Value CA2_4_10I1R2MassTerm_sound CA2_4_10I1R2Entropy_sound) (by decide +kernel) +def CA2_4_10I1R3Value (a : PairSlot) : ℝ := residualLaw (below (shape 2 4 10)) (fun u => (stageALaw (shape 2 4 10) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 3 a +def CA2_4_10I1R3Raw (a : PairSlot) : Ball := residualBall (below (shape 2 4 10)) A2_4_10Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 3 a +lemma CA2_4_10I1R3Raw_sound (a : PairSlot) : + (CA2_4_10I1R3Raw a).Encloses (CA2_4_10I1R3Value a) := by + exact residualBall_sound_on (below (shape 2 4 10)) A2_4_10Law (fun u => (stageALaw (shape 2 4 10) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A2_4_10Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 2 4 10) (show (shape 2 4 10) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 3 a +def CA2_4_10I1R3Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(60600842512749909065437114167 / 12500000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ ⟨(1291810010488538332237728883911 / 50000000000000000000000000000000), (92395641 / 10000000000000000000000000000000)⟩ ⟨(-133229378186527722279815598415293 / 25000000000000000000000000000000), (190582413971 / 100000000000000000000000000000000)⟩ ⟨-8, 60600842512749909065437114167, 48828125000000000000000000000⟩, + .log ⟨(2528984564228431434820444687137 / 25000000000000000000000000000000), (61 / 100000000000000000000000000000000)⟩ ⟨(11588100436761011118615419373789 / 50000000000000000000000000000000), (10710666447 / 100000000000000000000000000000000)⟩ ⟨(-22910579607069345094217912558909 / 10000000000000000000000000000000), (52939559509 / 50000000000000000000000000000000)⟩ ⟨-4, 2528984564228431434820444687137, 1562500000000000000000000000000⟩, + .log ⟨(979366327384147748594306366969 / 100000000000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ ⟨(4530567931002738314260469072711 / 100000000000000000000000000000000), (207388891 / 12500000000000000000000000000000)⟩ ⟨(-462601970715464802661539595680587 / 100000000000000000000000000000000), (42351647519 / 25000000000000000000000000000000)⟩ ⟨-7, 979366327384147748594306366969, 781250000000000000000000000000⟩] +lemma CA2_4_10I1R3Certificates_valid : + CA2_4_10I1R3Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_4_10I1R3CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 4, 0 => 1 + | 2, 1 => 2 + | 3, 1 => 3 + | 1, 2 => 2 + | 1, 3 => 3 + | 0, 4 => 1 + | _, _ => 0 +def CA2_4_10I1R3P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_4_10I1R3Certificates (CA2_4_10I1R3CertificateIndex a)).input +lemma CA2_4_10I1R3P_check : ∀ a : PairSlot, contains (CA2_4_10I1R3Raw a) (CA2_4_10I1R3P a) = true := by + decide +kernel +lemma CA2_4_10I1R3P_sound (a : PairSlot) : + (CA2_4_10I1R3P a).Encloses (CA2_4_10I1R3Value a) := + contains_sound (CA2_4_10I1R3Raw_sound a) (CA2_4_10I1R3P_check a) +def CA2_4_10I1R3Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_4_10I1R3Certificates (CA2_4_10I1R3CertificateIndex a)).output +lemma CA2_4_10I1R3Terms_sound (a : PairSlot) : + (CA2_4_10I1R3Terms a).Encloses (Foundation.entropyTerm (CA2_4_10I1R3Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_4_10I1R3Certificates_valid + (CA2_4_10I1R3CertificateIndex a) (CA2_4_10I1R3P_sound a) +def CA2_4_10I1R3Entropy : Ball := ⟨(30290388825501837215966765588111 / 50000000000000000000000000000000), (2658746797 / 10000000000000000000000000000000)⟩ +lemma CA2_4_10I1R3Entropy_sound : CA2_4_10I1R3Entropy.Encloses (Foundation.finiteEntropy CA2_4_10I1R3Value) := by + exact contains_sound (entropyPair_enclosed CA2_4_10I1R3Value CA2_4_10I1R3Terms CA2_4_10I1R3Terms_sound) (by decide +kernel) +def CA2_4_10I1R3Mass : Ball := ⟨(11580111324399872760399582028853 / 50000000000000000000000000000000), (71 / 50000000000000000000000000000000)⟩ +lemma CA2_4_10I1R3Mass_sound : CA2_4_10I1R3Mass.Encloses (∑ a, CA2_4_10I1R3Value a) := by + exact contains_sound (pairSumBall_sound CA2_4_10I1R3P CA2_4_10I1R3Value CA2_4_10I1R3P_sound) (by decide +kernel) +def CA2_4_10I1R3MassTermLogWitness : LogWitness := ⟨-3, 11580111324399872760399582028853, 6250000000000000000000000000000⟩ +def CA2_4_10I1R3MassTermLog : Ball := ⟨(-14627339198234724098301207124197 / 10000000000000000000000000000000), (16940659069 / 20000000000000000000000000000000)⟩ +lemma CA2_4_10I1R3MassTermLog_sound : CA2_4_10I1R3MassTermLog.Encloses (Real.log ((∑ a, CA2_4_10I1R3Value a))) := by + exact checkLog_sound logTwoBall_sound (CA2_4_10I1R3Mass_sound) (w := CA2_4_10I1R3MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA2_4_10I1R3MassTerm : Ball := ⟨(4234655407382902096081315647709 / 12500000000000000000000000000000), (19617472001 / 100000000000000000000000000000000)⟩ +lemma CA2_4_10I1R3MassTerm_sound : CA2_4_10I1R3MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_4_10I1R3Value a))) := by + exact contains_sound (entropyTerm_ball (CA2_4_10I1R3Mass_sound) CA2_4_10I1R3MassTermLog_sound) (by decide +kernel) +def CA2_4_10I1R3H : Ball := ⟨(534070687838809153265660119891 / 2000000000000000000000000000000), (46204939971 / 100000000000000000000000000000000)⟩ +lemma CA2_4_10I1R3H_sound : CA2_4_10I1R3H.Encloses (homogeneousEntropy CA2_4_10I1R3Value) := by + exact contains_sound (homogeneous_enclosed CA2_4_10I1R3Value CA2_4_10I1R3MassTerm_sound CA2_4_10I1R3Entropy_sound) (by decide +kernel) +def CA2_4_10I1R4Value (a : PairSlot) : ℝ := residualLaw (below (shape 2 4 10)) (fun u => (stageALaw (shape 2 4 10) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 4 a +def CA2_4_10I1R4Raw (a : PairSlot) : Ball := residualBall (below (shape 2 4 10)) A2_4_10Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 4 a +lemma CA2_4_10I1R4Raw_sound (a : PairSlot) : + (CA2_4_10I1R4Raw a).Encloses (CA2_4_10I1R4Value a) := by + exact residualBall_sound_on (below (shape 2 4 10)) A2_4_10Law (fun u => (stageALaw (shape 2 4 10) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A2_4_10Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 2 4 10) (show (shape 2 4 10) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 4 a +def CA2_4_10I1R4Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(4295678730458672526115271023 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(43194406613782287477000663553 / 100000000000000000000000000000000), (7277169 / 50000000000000000000000000000000)⟩ ⟨(-502765794698643470656208650110853 / 50000000000000000000000000000000), (338813202207 / 100000000000000000000000000000000)⟩ ⟨-15, 4295678730458672526115271023, 3051757812500000000000000000⟩, + .log ⟨(303667440279865518063022157441 / 100000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ ⟨(1760357815737784962170102391733 / 100000000000000000000000000000000), (643040839 / 100000000000000000000000000000000)⟩ ⟨(-144924807720199332735360433851017 / 25000000000000000000000000000000), (105879118909 / 50000000000000000000000000000000)⟩ ⟨-9, 303667440279865518063022157441, 195312500000000000000000000000⟩, + .log ⟨(1570267050551735974943873725333 / 100000000000000000000000000000000), (7 / 50000000000000000000000000000000)⟩ ⟨(1304554149917839056437223571411 / 20000000000000000000000000000000), (2327618947 / 100000000000000000000000000000000)⟩ ⟨(-415392448519971536465802051772989 / 100000000000000000000000000000000), (9264422917 / 6250000000000000000000000000000)⟩ ⟨-6, 1570267050551735974943873725333, 1562500000000000000000000000000⟩, + .log ⟨(3034387089383124528122128843 / 2000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ ⟨(984794096329826778408729518697 / 100000000000000000000000000000000), (353406069 / 100000000000000000000000000000000)⟩ ⟨(-81136162536371588356964125744811 / 12500000000000000000000000000000), (232934061831 / 100000000000000000000000000000000)⟩ ⟨-10, 3034387089383124528122128843, 1953125000000000000000000000⟩, + .log ⟨(953593008292007130199388873 / 6250000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(134080594248960785344959468161 / 100000000000000000000000000000000), (45232593 / 100000000000000000000000000000000)⟩ ⟨(-878785505733692706370894943601029 / 100000000000000000000000000000000), (59292307623 / 20000000000000000000000000000000)⟩ ⟨-13, 953593008292007130199388873, 762939453125000000000000000⟩] +lemma CA2_4_10I1R4Certificates_valid : + CA2_4_10I1R4Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_4_10I1R4CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 0, 5 => 1 + | 1, 4 => 2 + | 2, 2 => 3 + | 2, 3 => 4 + | 3, 2 => 4 + | 3, 3 => 5 + | 4, 1 => 2 + | 5, 0 => 1 + | _, _ => 0 +def CA2_4_10I1R4P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_4_10I1R4Certificates (CA2_4_10I1R4CertificateIndex a)).input +lemma CA2_4_10I1R4P_check : ∀ a : PairSlot, contains (CA2_4_10I1R4Raw a) (CA2_4_10I1R4P a) = true := by + decide +kernel +lemma CA2_4_10I1R4P_sound (a : PairSlot) : + (CA2_4_10I1R4P a).Encloses (CA2_4_10I1R4Value a) := + contains_sound (CA2_4_10I1R4Raw_sound a) (CA2_4_10I1R4P_check a) +def CA2_4_10I1R4Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_4_10I1R4Certificates (CA2_4_10I1R4CertificateIndex a)).output +lemma CA2_4_10I1R4Terms_sound (a : PairSlot) : + (CA2_4_10I1R4Terms a).Encloses (Foundation.entropyTerm (CA2_4_10I1R4Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_4_10I1R4Certificates_valid + (CA2_4_10I1R4CertificateIndex a) (CA2_4_10I1R4P_sound a) +def CA2_4_10I1R4Entropy : Ball := ⟨(6116771990600472061821371236591 / 50000000000000000000000000000000), (274678377 / 6250000000000000000000000000000)⟩ +lemma CA2_4_10I1R4Entropy_sound : CA2_4_10I1R4Entropy.Encloses (Foundation.finiteEntropy CA2_4_10I1R4Value) := by + exact contains_sound (entropyPair_enclosed CA2_4_10I1R4Value CA2_4_10I1R4Terms CA2_4_10I1R4Terms_sound) (by decide +kernel) +def CA2_4_10I1R4Mass : Ball := ⟨(2504889485643368923017551688529 / 100000000000000000000000000000000), (27 / 100000000000000000000000000000000)⟩ +lemma CA2_4_10I1R4Mass_sound : CA2_4_10I1R4Mass.Encloses (∑ a, CA2_4_10I1R4Value a) := by + exact contains_sound (pairSumBall_sound CA2_4_10I1R4P CA2_4_10I1R4Value CA2_4_10I1R4P_sound) (by decide +kernel) +def CA2_4_10I1R4MassTermLogWitness : LogWitness := ⟨-6, 2504889485643368923017551688529, 1562500000000000000000000000000⟩ +def CA2_4_10I1R4MassTermLog : Ball := ⟨(-92173139248302656677203865689727 / 25000000000000000000000000000000), (148230766859 / 100000000000000000000000000000000)⟩ +lemma CA2_4_10I1R4MassTermLog_sound : CA2_4_10I1R4MassTermLog.Encloses (Real.log ((∑ a, CA2_4_10I1R4Value a))) := by + exact checkLog_sound logTwoBall_sound (CA2_4_10I1R4Mass_sound) (w := CA2_4_10I1R4MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA2_4_10I1R4MassTerm : Ball := ⟨(9235341094472618485504812256113 / 100000000000000000000000000000000), (1856508497 / 50000000000000000000000000000000)⟩ +lemma CA2_4_10I1R4MassTerm_sound : CA2_4_10I1R4MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_4_10I1R4Value a))) := by + exact contains_sound (entropyTerm_ball (CA2_4_10I1R4Mass_sound) CA2_4_10I1R4MassTermLog_sound) (by decide +kernel) +def CA2_4_10I1R4H : Ball := ⟨(2998202886728325638137930217069 / 100000000000000000000000000000000), (4053935513 / 50000000000000000000000000000000)⟩ +lemma CA2_4_10I1R4H_sound : CA2_4_10I1R4H.Encloses (homogeneousEntropy CA2_4_10I1R4Value) := by + exact contains_sound (homogeneous_enclosed CA2_4_10I1R4Value CA2_4_10I1R4MassTerm_sound CA2_4_10I1R4Entropy_sound) (by decide +kernel) +def CA2_4_10I1R5Value (a : PairSlot) : ℝ := residualLaw (below (shape 2 4 10)) (fun u => (stageALaw (shape 2 4 10) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 5 a +def CA2_4_10I1R5Raw (a : PairSlot) : Ball := residualBall (below (shape 2 4 10)) A2_4_10Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 5 a +lemma CA2_4_10I1R5Raw_sound (a : PairSlot) : + (CA2_4_10I1R5Raw a).Encloses (CA2_4_10I1R5Value a) := by + exact residualBall_sound_on (below (shape 2 4 10)) A2_4_10Law (fun u => (stageALaw (shape 2 4 10) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A2_4_10Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 2 4 10) (show (shape 2 4 10) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 5 a +def CA2_4_10I1R5Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA2_4_10I1R5Certificates_valid : + CA2_4_10I1R5Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_4_10I1R5CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA2_4_10I1R5P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_4_10I1R5Certificates (CA2_4_10I1R5CertificateIndex a)).input +lemma CA2_4_10I1R5P_check : ∀ a : PairSlot, contains (CA2_4_10I1R5Raw a) (CA2_4_10I1R5P a) = true := by + decide +kernel +lemma CA2_4_10I1R5P_sound (a : PairSlot) : + (CA2_4_10I1R5P a).Encloses (CA2_4_10I1R5Value a) := + contains_sound (CA2_4_10I1R5Raw_sound a) (CA2_4_10I1R5P_check a) +def CA2_4_10I1R5Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_4_10I1R5Certificates (CA2_4_10I1R5CertificateIndex a)).output +lemma CA2_4_10I1R5Terms_sound (a : PairSlot) : + (CA2_4_10I1R5Terms a).Encloses (Foundation.entropyTerm (CA2_4_10I1R5Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_4_10I1R5Certificates_valid + (CA2_4_10I1R5CertificateIndex a) (CA2_4_10I1R5P_sound a) +def CA2_4_10I1R5Entropy : Ball := ⟨0, 0⟩ +lemma CA2_4_10I1R5Entropy_sound : CA2_4_10I1R5Entropy.Encloses (Foundation.finiteEntropy CA2_4_10I1R5Value) := by + exact contains_sound (entropyPair_enclosed CA2_4_10I1R5Value CA2_4_10I1R5Terms CA2_4_10I1R5Terms_sound) (by decide +kernel) +def CA2_4_10I1R5Mass : Ball := ⟨0, 0⟩ +lemma CA2_4_10I1R5Mass_sound : CA2_4_10I1R5Mass.Encloses (∑ a, CA2_4_10I1R5Value a) := by + exact contains_sound (pairSumBall_sound CA2_4_10I1R5P CA2_4_10I1R5Value CA2_4_10I1R5P_sound) (by decide +kernel) +def CA2_4_10I1R5MassTerm : Ball := .exact 0 +lemma CA2_4_10I1R5MassTerm_sound : CA2_4_10I1R5MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_4_10I1R5Value a))) := + entropyTerm_zero_ball (CA2_4_10I1R5Mass_sound) +def CA2_4_10I1R5H : Ball := ⟨0, 0⟩ +lemma CA2_4_10I1R5H_sound : CA2_4_10I1R5H.Encloses (homogeneousEntropy CA2_4_10I1R5Value) := by + exact contains_sound (homogeneous_enclosed CA2_4_10I1R5Value CA2_4_10I1R5MassTerm_sound CA2_4_10I1R5Entropy_sound) (by decide +kernel) +def CA2_4_10I1R6Value (a : PairSlot) : ℝ := residualLaw (below (shape 2 4 10)) (fun u => (stageALaw (shape 2 4 10) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 6 a +def CA2_4_10I1R6Raw (a : PairSlot) : Ball := residualBall (below (shape 2 4 10)) A2_4_10Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 6 a +lemma CA2_4_10I1R6Raw_sound (a : PairSlot) : + (CA2_4_10I1R6Raw a).Encloses (CA2_4_10I1R6Value a) := by + exact residualBall_sound_on (below (shape 2 4 10)) A2_4_10Law (fun u => (stageALaw (shape 2 4 10) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A2_4_10Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 2 4 10) (show (shape 2 4 10) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 6 a +def CA2_4_10I1R6Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA2_4_10I1R6Certificates_valid : + CA2_4_10I1R6Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_4_10I1R6CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA2_4_10I1R6P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_4_10I1R6Certificates (CA2_4_10I1R6CertificateIndex a)).input +lemma CA2_4_10I1R6P_check : ∀ a : PairSlot, contains (CA2_4_10I1R6Raw a) (CA2_4_10I1R6P a) = true := by + decide +kernel +lemma CA2_4_10I1R6P_sound (a : PairSlot) : + (CA2_4_10I1R6P a).Encloses (CA2_4_10I1R6Value a) := + contains_sound (CA2_4_10I1R6Raw_sound a) (CA2_4_10I1R6P_check a) +def CA2_4_10I1R6Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_4_10I1R6Certificates (CA2_4_10I1R6CertificateIndex a)).output +lemma CA2_4_10I1R6Terms_sound (a : PairSlot) : + (CA2_4_10I1R6Terms a).Encloses (Foundation.entropyTerm (CA2_4_10I1R6Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_4_10I1R6Certificates_valid + (CA2_4_10I1R6CertificateIndex a) (CA2_4_10I1R6P_sound a) +def CA2_4_10I1R6Entropy : Ball := ⟨0, 0⟩ +lemma CA2_4_10I1R6Entropy_sound : CA2_4_10I1R6Entropy.Encloses (Foundation.finiteEntropy CA2_4_10I1R6Value) := by + exact contains_sound (entropyPair_enclosed CA2_4_10I1R6Value CA2_4_10I1R6Terms CA2_4_10I1R6Terms_sound) (by decide +kernel) +def CA2_4_10I1R6Mass : Ball := ⟨0, 0⟩ +lemma CA2_4_10I1R6Mass_sound : CA2_4_10I1R6Mass.Encloses (∑ a, CA2_4_10I1R6Value a) := by + exact contains_sound (pairSumBall_sound CA2_4_10I1R6P CA2_4_10I1R6Value CA2_4_10I1R6P_sound) (by decide +kernel) +def CA2_4_10I1R6MassTerm : Ball := .exact 0 +lemma CA2_4_10I1R6MassTerm_sound : CA2_4_10I1R6MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_4_10I1R6Value a))) := + entropyTerm_zero_ball (CA2_4_10I1R6Mass_sound) +def CA2_4_10I1R6H : Ball := ⟨0, 0⟩ +lemma CA2_4_10I1R6H_sound : CA2_4_10I1R6H.Encloses (homogeneousEntropy CA2_4_10I1R6Value) := by + exact contains_sound (homogeneous_enclosed CA2_4_10I1R6Value CA2_4_10I1R6MassTerm_sound CA2_4_10I1R6Entropy_sound) (by decide +kernel) +def CA2_4_10I1R7Value (a : PairSlot) : ℝ := residualLaw (below (shape 2 4 10)) (fun u => (stageALaw (shape 2 4 10) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 7 a +def CA2_4_10I1R7Raw (a : PairSlot) : Ball := residualBall (below (shape 2 4 10)) A2_4_10Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 7 a +lemma CA2_4_10I1R7Raw_sound (a : PairSlot) : + (CA2_4_10I1R7Raw a).Encloses (CA2_4_10I1R7Value a) := by + exact residualBall_sound_on (below (shape 2 4 10)) A2_4_10Law (fun u => (stageALaw (shape 2 4 10) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A2_4_10Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 2 4 10) (show (shape 2 4 10) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 7 a +def CA2_4_10I1R7Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA2_4_10I1R7Certificates_valid : + CA2_4_10I1R7Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_4_10I1R7CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA2_4_10I1R7P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_4_10I1R7Certificates (CA2_4_10I1R7CertificateIndex a)).input +lemma CA2_4_10I1R7P_check : ∀ a : PairSlot, contains (CA2_4_10I1R7Raw a) (CA2_4_10I1R7P a) = true := by + decide +kernel +lemma CA2_4_10I1R7P_sound (a : PairSlot) : + (CA2_4_10I1R7P a).Encloses (CA2_4_10I1R7Value a) := + contains_sound (CA2_4_10I1R7Raw_sound a) (CA2_4_10I1R7P_check a) +def CA2_4_10I1R7Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_4_10I1R7Certificates (CA2_4_10I1R7CertificateIndex a)).output +lemma CA2_4_10I1R7Terms_sound (a : PairSlot) : + (CA2_4_10I1R7Terms a).Encloses (Foundation.entropyTerm (CA2_4_10I1R7Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_4_10I1R7Certificates_valid + (CA2_4_10I1R7CertificateIndex a) (CA2_4_10I1R7P_sound a) +def CA2_4_10I1R7Entropy : Ball := ⟨0, 0⟩ +lemma CA2_4_10I1R7Entropy_sound : CA2_4_10I1R7Entropy.Encloses (Foundation.finiteEntropy CA2_4_10I1R7Value) := by + exact contains_sound (entropyPair_enclosed CA2_4_10I1R7Value CA2_4_10I1R7Terms CA2_4_10I1R7Terms_sound) (by decide +kernel) +def CA2_4_10I1R7Mass : Ball := ⟨0, 0⟩ +lemma CA2_4_10I1R7Mass_sound : CA2_4_10I1R7Mass.Encloses (∑ a, CA2_4_10I1R7Value a) := by + exact contains_sound (pairSumBall_sound CA2_4_10I1R7P CA2_4_10I1R7Value CA2_4_10I1R7P_sound) (by decide +kernel) +def CA2_4_10I1R7MassTerm : Ball := .exact 0 +lemma CA2_4_10I1R7MassTerm_sound : CA2_4_10I1R7MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_4_10I1R7Value a))) := + entropyTerm_zero_ball (CA2_4_10I1R7Mass_sound) +def CA2_4_10I1R7H : Ball := ⟨0, 0⟩ +lemma CA2_4_10I1R7H_sound : CA2_4_10I1R7H.Encloses (homogeneousEntropy CA2_4_10I1R7Value) := by + exact contains_sound (homogeneous_enclosed CA2_4_10I1R7Value CA2_4_10I1R7MassTerm_sound CA2_4_10I1R7Entropy_sound) (by decide +kernel) +def CA2_4_10I1R8Value (a : PairSlot) : ℝ := residualLaw (below (shape 2 4 10)) (fun u => (stageALaw (shape 2 4 10) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 8 a +def CA2_4_10I1R8Raw (a : PairSlot) : Ball := residualBall (below (shape 2 4 10)) A2_4_10Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 8 a +lemma CA2_4_10I1R8Raw_sound (a : PairSlot) : + (CA2_4_10I1R8Raw a).Encloses (CA2_4_10I1R8Value a) := by + exact residualBall_sound_on (below (shape 2 4 10)) A2_4_10Law (fun u => (stageALaw (shape 2 4 10) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A2_4_10Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 2 4 10) (show (shape 2 4 10) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 8 a +def CA2_4_10I1R8Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA2_4_10I1R8Certificates_valid : + CA2_4_10I1R8Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_4_10I1R8CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA2_4_10I1R8P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_4_10I1R8Certificates (CA2_4_10I1R8CertificateIndex a)).input +lemma CA2_4_10I1R8P_check : ∀ a : PairSlot, contains (CA2_4_10I1R8Raw a) (CA2_4_10I1R8P a) = true := by + decide +kernel +lemma CA2_4_10I1R8P_sound (a : PairSlot) : + (CA2_4_10I1R8P a).Encloses (CA2_4_10I1R8Value a) := + contains_sound (CA2_4_10I1R8Raw_sound a) (CA2_4_10I1R8P_check a) +def CA2_4_10I1R8Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_4_10I1R8Certificates (CA2_4_10I1R8CertificateIndex a)).output +lemma CA2_4_10I1R8Terms_sound (a : PairSlot) : + (CA2_4_10I1R8Terms a).Encloses (Foundation.entropyTerm (CA2_4_10I1R8Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_4_10I1R8Certificates_valid + (CA2_4_10I1R8CertificateIndex a) (CA2_4_10I1R8P_sound a) +def CA2_4_10I1R8Entropy : Ball := ⟨0, 0⟩ +lemma CA2_4_10I1R8Entropy_sound : CA2_4_10I1R8Entropy.Encloses (Foundation.finiteEntropy CA2_4_10I1R8Value) := by + exact contains_sound (entropyPair_enclosed CA2_4_10I1R8Value CA2_4_10I1R8Terms CA2_4_10I1R8Terms_sound) (by decide +kernel) +def CA2_4_10I1R8Mass : Ball := ⟨0, 0⟩ +lemma CA2_4_10I1R8Mass_sound : CA2_4_10I1R8Mass.Encloses (∑ a, CA2_4_10I1R8Value a) := by + exact contains_sound (pairSumBall_sound CA2_4_10I1R8P CA2_4_10I1R8Value CA2_4_10I1R8P_sound) (by decide +kernel) +def CA2_4_10I1R8MassTerm : Ball := .exact 0 +lemma CA2_4_10I1R8MassTerm_sound : CA2_4_10I1R8MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_4_10I1R8Value a))) := + entropyTerm_zero_ball (CA2_4_10I1R8Mass_sound) +def CA2_4_10I1R8H : Ball := ⟨0, 0⟩ +lemma CA2_4_10I1R8H_sound : CA2_4_10I1R8H.Encloses (homogeneousEntropy CA2_4_10I1R8Value) := by + exact contains_sound (homogeneous_enclosed CA2_4_10I1R8Value CA2_4_10I1R8MassTerm_sound CA2_4_10I1R8Entropy_sound) (by decide +kernel) +def CA2_4_10I1R9Value (a : PairSlot) : ℝ := residualLaw (below (shape 2 4 10)) (fun u => (stageALaw (shape 2 4 10) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 9 a +def CA2_4_10I1R9Raw (a : PairSlot) : Ball := residualBall (below (shape 2 4 10)) A2_4_10Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 9 a +lemma CA2_4_10I1R9Raw_sound (a : PairSlot) : + (CA2_4_10I1R9Raw a).Encloses (CA2_4_10I1R9Value a) := by + exact residualBall_sound_on (below (shape 2 4 10)) A2_4_10Law (fun u => (stageALaw (shape 2 4 10) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A2_4_10Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 2 4 10) (show (shape 2 4 10) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 9 a +def CA2_4_10I1R9Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA2_4_10I1R9Certificates_valid : + CA2_4_10I1R9Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_4_10I1R9CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA2_4_10I1R9P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_4_10I1R9Certificates (CA2_4_10I1R9CertificateIndex a)).input +lemma CA2_4_10I1R9P_check : ∀ a : PairSlot, contains (CA2_4_10I1R9Raw a) (CA2_4_10I1R9P a) = true := by + decide +kernel +lemma CA2_4_10I1R9P_sound (a : PairSlot) : + (CA2_4_10I1R9P a).Encloses (CA2_4_10I1R9Value a) := + contains_sound (CA2_4_10I1R9Raw_sound a) (CA2_4_10I1R9P_check a) +def CA2_4_10I1R9Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_4_10I1R9Certificates (CA2_4_10I1R9CertificateIndex a)).output +lemma CA2_4_10I1R9Terms_sound (a : PairSlot) : + (CA2_4_10I1R9Terms a).Encloses (Foundation.entropyTerm (CA2_4_10I1R9Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_4_10I1R9Certificates_valid + (CA2_4_10I1R9CertificateIndex a) (CA2_4_10I1R9P_sound a) +def CA2_4_10I1R9Entropy : Ball := ⟨0, 0⟩ +lemma CA2_4_10I1R9Entropy_sound : CA2_4_10I1R9Entropy.Encloses (Foundation.finiteEntropy CA2_4_10I1R9Value) := by + exact contains_sound (entropyPair_enclosed CA2_4_10I1R9Value CA2_4_10I1R9Terms CA2_4_10I1R9Terms_sound) (by decide +kernel) +def CA2_4_10I1R9Mass : Ball := ⟨0, 0⟩ +lemma CA2_4_10I1R9Mass_sound : CA2_4_10I1R9Mass.Encloses (∑ a, CA2_4_10I1R9Value a) := by + exact contains_sound (pairSumBall_sound CA2_4_10I1R9P CA2_4_10I1R9Value CA2_4_10I1R9P_sound) (by decide +kernel) +def CA2_4_10I1R9MassTerm : Ball := .exact 0 +lemma CA2_4_10I1R9MassTerm_sound : CA2_4_10I1R9MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_4_10I1R9Value a))) := + entropyTerm_zero_ball (CA2_4_10I1R9Mass_sound) +def CA2_4_10I1R9H : Ball := ⟨0, 0⟩ +lemma CA2_4_10I1R9H_sound : CA2_4_10I1R9H.Encloses (homogeneousEntropy CA2_4_10I1R9Value) := by + exact contains_sound (homogeneous_enclosed CA2_4_10I1R9Value CA2_4_10I1R9MassTerm_sound CA2_4_10I1R9Entropy_sound) (by decide +kernel) +def CA2_4_10I1R10Value (a : PairSlot) : ℝ := residualLaw (below (shape 2 4 10)) (fun u => (stageALaw (shape 2 4 10) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 10 a +def CA2_4_10I1R10Raw (a : PairSlot) : Ball := residualBall (below (shape 2 4 10)) A2_4_10Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 10 a +lemma CA2_4_10I1R10Raw_sound (a : PairSlot) : + (CA2_4_10I1R10Raw a).Encloses (CA2_4_10I1R10Value a) := by + exact residualBall_sound_on (below (shape 2 4 10)) A2_4_10Law (fun u => (stageALaw (shape 2 4 10) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A2_4_10Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 2 4 10) (show (shape 2 4 10) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 10 a +def CA2_4_10I1R10Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA2_4_10I1R10Certificates_valid : + CA2_4_10I1R10Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_4_10I1R10CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA2_4_10I1R10P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_4_10I1R10Certificates (CA2_4_10I1R10CertificateIndex a)).input +lemma CA2_4_10I1R10P_check : ∀ a : PairSlot, contains (CA2_4_10I1R10Raw a) (CA2_4_10I1R10P a) = true := by + decide +kernel +lemma CA2_4_10I1R10P_sound (a : PairSlot) : + (CA2_4_10I1R10P a).Encloses (CA2_4_10I1R10Value a) := + contains_sound (CA2_4_10I1R10Raw_sound a) (CA2_4_10I1R10P_check a) +def CA2_4_10I1R10Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_4_10I1R10Certificates (CA2_4_10I1R10CertificateIndex a)).output +lemma CA2_4_10I1R10Terms_sound (a : PairSlot) : + (CA2_4_10I1R10Terms a).Encloses (Foundation.entropyTerm (CA2_4_10I1R10Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_4_10I1R10Certificates_valid + (CA2_4_10I1R10CertificateIndex a) (CA2_4_10I1R10P_sound a) +def CA2_4_10I1R10Entropy : Ball := ⟨0, 0⟩ +lemma CA2_4_10I1R10Entropy_sound : CA2_4_10I1R10Entropy.Encloses (Foundation.finiteEntropy CA2_4_10I1R10Value) := by + exact contains_sound (entropyPair_enclosed CA2_4_10I1R10Value CA2_4_10I1R10Terms CA2_4_10I1R10Terms_sound) (by decide +kernel) +def CA2_4_10I1R10Mass : Ball := ⟨0, 0⟩ +lemma CA2_4_10I1R10Mass_sound : CA2_4_10I1R10Mass.Encloses (∑ a, CA2_4_10I1R10Value a) := by + exact contains_sound (pairSumBall_sound CA2_4_10I1R10P CA2_4_10I1R10Value CA2_4_10I1R10P_sound) (by decide +kernel) +def CA2_4_10I1R10MassTerm : Ball := .exact 0 +lemma CA2_4_10I1R10MassTerm_sound : CA2_4_10I1R10MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_4_10I1R10Value a))) := + entropyTerm_zero_ball (CA2_4_10I1R10Mass_sound) +def CA2_4_10I1R10H : Ball := ⟨0, 0⟩ +lemma CA2_4_10I1R10H_sound : CA2_4_10I1R10H.Encloses (homogeneousEntropy CA2_4_10I1R10Value) := by + exact contains_sound (homogeneous_enclosed CA2_4_10I1R10Value CA2_4_10I1R10MassTerm_sound CA2_4_10I1R10Entropy_sound) (by decide +kernel) +def CA2_4_10I1R11Value (a : PairSlot) : ℝ := residualLaw (below (shape 2 4 10)) (fun u => (stageALaw (shape 2 4 10) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 11 a +def CA2_4_10I1R11Raw (a : PairSlot) : Ball := residualBall (below (shape 2 4 10)) A2_4_10Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 11 a +lemma CA2_4_10I1R11Raw_sound (a : PairSlot) : + (CA2_4_10I1R11Raw a).Encloses (CA2_4_10I1R11Value a) := by + exact residualBall_sound_on (below (shape 2 4 10)) A2_4_10Law (fun u => (stageALaw (shape 2 4 10) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A2_4_10Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 2 4 10) (show (shape 2 4 10) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 11 a +def CA2_4_10I1R11Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA2_4_10I1R11Certificates_valid : + CA2_4_10I1R11Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_4_10I1R11CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA2_4_10I1R11P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_4_10I1R11Certificates (CA2_4_10I1R11CertificateIndex a)).input +lemma CA2_4_10I1R11P_check : ∀ a : PairSlot, contains (CA2_4_10I1R11Raw a) (CA2_4_10I1R11P a) = true := by + decide +kernel +lemma CA2_4_10I1R11P_sound (a : PairSlot) : + (CA2_4_10I1R11P a).Encloses (CA2_4_10I1R11Value a) := + contains_sound (CA2_4_10I1R11Raw_sound a) (CA2_4_10I1R11P_check a) +def CA2_4_10I1R11Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_4_10I1R11Certificates (CA2_4_10I1R11CertificateIndex a)).output +lemma CA2_4_10I1R11Terms_sound (a : PairSlot) : + (CA2_4_10I1R11Terms a).Encloses (Foundation.entropyTerm (CA2_4_10I1R11Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_4_10I1R11Certificates_valid + (CA2_4_10I1R11CertificateIndex a) (CA2_4_10I1R11P_sound a) +def CA2_4_10I1R11Entropy : Ball := ⟨0, 0⟩ +lemma CA2_4_10I1R11Entropy_sound : CA2_4_10I1R11Entropy.Encloses (Foundation.finiteEntropy CA2_4_10I1R11Value) := by + exact contains_sound (entropyPair_enclosed CA2_4_10I1R11Value CA2_4_10I1R11Terms CA2_4_10I1R11Terms_sound) (by decide +kernel) +def CA2_4_10I1R11Mass : Ball := ⟨0, 0⟩ +lemma CA2_4_10I1R11Mass_sound : CA2_4_10I1R11Mass.Encloses (∑ a, CA2_4_10I1R11Value a) := by + exact contains_sound (pairSumBall_sound CA2_4_10I1R11P CA2_4_10I1R11Value CA2_4_10I1R11P_sound) (by decide +kernel) +def CA2_4_10I1R11MassTerm : Ball := .exact 0 +lemma CA2_4_10I1R11MassTerm_sound : CA2_4_10I1R11MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_4_10I1R11Value a))) := + entropyTerm_zero_ball (CA2_4_10I1R11Mass_sound) +def CA2_4_10I1R11H : Ball := ⟨0, 0⟩ +lemma CA2_4_10I1R11H_sound : CA2_4_10I1R11H.Encloses (homogeneousEntropy CA2_4_10I1R11Value) := by + exact contains_sound (homogeneous_enclosed CA2_4_10I1R11Value CA2_4_10I1R11MassTerm_sound CA2_4_10I1R11Entropy_sound) (by decide +kernel) +def CA2_4_10I1R12Value (a : PairSlot) : ℝ := residualLaw (below (shape 2 4 10)) (fun u => (stageALaw (shape 2 4 10) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 12 a +def CA2_4_10I1R12Raw (a : PairSlot) : Ball := residualBall (below (shape 2 4 10)) A2_4_10Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 12 a +lemma CA2_4_10I1R12Raw_sound (a : PairSlot) : + (CA2_4_10I1R12Raw a).Encloses (CA2_4_10I1R12Value a) := by + exact residualBall_sound_on (below (shape 2 4 10)) A2_4_10Law (fun u => (stageALaw (shape 2 4 10) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A2_4_10Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 2 4 10) (show (shape 2 4 10) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 12 a +def CA2_4_10I1R12Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA2_4_10I1R12Certificates_valid : + CA2_4_10I1R12Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_4_10I1R12CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA2_4_10I1R12P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_4_10I1R12Certificates (CA2_4_10I1R12CertificateIndex a)).input +lemma CA2_4_10I1R12P_check : ∀ a : PairSlot, contains (CA2_4_10I1R12Raw a) (CA2_4_10I1R12P a) = true := by + decide +kernel +lemma CA2_4_10I1R12P_sound (a : PairSlot) : + (CA2_4_10I1R12P a).Encloses (CA2_4_10I1R12Value a) := + contains_sound (CA2_4_10I1R12Raw_sound a) (CA2_4_10I1R12P_check a) +def CA2_4_10I1R12Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_4_10I1R12Certificates (CA2_4_10I1R12CertificateIndex a)).output +lemma CA2_4_10I1R12Terms_sound (a : PairSlot) : + (CA2_4_10I1R12Terms a).Encloses (Foundation.entropyTerm (CA2_4_10I1R12Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_4_10I1R12Certificates_valid + (CA2_4_10I1R12CertificateIndex a) (CA2_4_10I1R12P_sound a) +def CA2_4_10I1R12Entropy : Ball := ⟨0, 0⟩ +lemma CA2_4_10I1R12Entropy_sound : CA2_4_10I1R12Entropy.Encloses (Foundation.finiteEntropy CA2_4_10I1R12Value) := by + exact contains_sound (entropyPair_enclosed CA2_4_10I1R12Value CA2_4_10I1R12Terms CA2_4_10I1R12Terms_sound) (by decide +kernel) +def CA2_4_10I1R12Mass : Ball := ⟨0, 0⟩ +lemma CA2_4_10I1R12Mass_sound : CA2_4_10I1R12Mass.Encloses (∑ a, CA2_4_10I1R12Value a) := by + exact contains_sound (pairSumBall_sound CA2_4_10I1R12P CA2_4_10I1R12Value CA2_4_10I1R12P_sound) (by decide +kernel) +def CA2_4_10I1R12MassTerm : Ball := .exact 0 +lemma CA2_4_10I1R12MassTerm_sound : CA2_4_10I1R12MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_4_10I1R12Value a))) := + entropyTerm_zero_ball (CA2_4_10I1R12Mass_sound) +def CA2_4_10I1R12H : Ball := ⟨0, 0⟩ +lemma CA2_4_10I1R12H_sound : CA2_4_10I1R12H.Encloses (homogeneousEntropy CA2_4_10I1R12Value) := by + exact contains_sound (homogeneous_enclosed CA2_4_10I1R12Value CA2_4_10I1R12MassTerm_sound CA2_4_10I1R12Entropy_sound) (by decide +kernel) +def CA2_4_10I1R13Value (a : PairSlot) : ℝ := residualLaw (below (shape 2 4 10)) (fun u => (stageALaw (shape 2 4 10) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 13 a +def CA2_4_10I1R13Raw (a : PairSlot) : Ball := residualBall (below (shape 2 4 10)) A2_4_10Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 13 a +lemma CA2_4_10I1R13Raw_sound (a : PairSlot) : + (CA2_4_10I1R13Raw a).Encloses (CA2_4_10I1R13Value a) := by + exact residualBall_sound_on (below (shape 2 4 10)) A2_4_10Law (fun u => (stageALaw (shape 2 4 10) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A2_4_10Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 2 4 10) (show (shape 2 4 10) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 13 a +def CA2_4_10I1R13Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA2_4_10I1R13Certificates_valid : + CA2_4_10I1R13Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_4_10I1R13CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA2_4_10I1R13P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_4_10I1R13Certificates (CA2_4_10I1R13CertificateIndex a)).input +lemma CA2_4_10I1R13P_check : ∀ a : PairSlot, contains (CA2_4_10I1R13Raw a) (CA2_4_10I1R13P a) = true := by + decide +kernel +lemma CA2_4_10I1R13P_sound (a : PairSlot) : + (CA2_4_10I1R13P a).Encloses (CA2_4_10I1R13Value a) := + contains_sound (CA2_4_10I1R13Raw_sound a) (CA2_4_10I1R13P_check a) +def CA2_4_10I1R13Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_4_10I1R13Certificates (CA2_4_10I1R13CertificateIndex a)).output +lemma CA2_4_10I1R13Terms_sound (a : PairSlot) : + (CA2_4_10I1R13Terms a).Encloses (Foundation.entropyTerm (CA2_4_10I1R13Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_4_10I1R13Certificates_valid + (CA2_4_10I1R13CertificateIndex a) (CA2_4_10I1R13P_sound a) +def CA2_4_10I1R13Entropy : Ball := ⟨0, 0⟩ +lemma CA2_4_10I1R13Entropy_sound : CA2_4_10I1R13Entropy.Encloses (Foundation.finiteEntropy CA2_4_10I1R13Value) := by + exact contains_sound (entropyPair_enclosed CA2_4_10I1R13Value CA2_4_10I1R13Terms CA2_4_10I1R13Terms_sound) (by decide +kernel) +def CA2_4_10I1R13Mass : Ball := ⟨0, 0⟩ +lemma CA2_4_10I1R13Mass_sound : CA2_4_10I1R13Mass.Encloses (∑ a, CA2_4_10I1R13Value a) := by + exact contains_sound (pairSumBall_sound CA2_4_10I1R13P CA2_4_10I1R13Value CA2_4_10I1R13P_sound) (by decide +kernel) +def CA2_4_10I1R13MassTerm : Ball := .exact 0 +lemma CA2_4_10I1R13MassTerm_sound : CA2_4_10I1R13MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_4_10I1R13Value a))) := + entropyTerm_zero_ball (CA2_4_10I1R13Mass_sound) +def CA2_4_10I1R13H : Ball := ⟨0, 0⟩ +lemma CA2_4_10I1R13H_sound : CA2_4_10I1R13H.Encloses (homogeneousEntropy CA2_4_10I1R13Value) := by + exact contains_sound (homogeneous_enclosed CA2_4_10I1R13Value CA2_4_10I1R13MassTerm_sound CA2_4_10I1R13Entropy_sound) (by decide +kernel) +def CA2_4_10I1R14Value (a : PairSlot) : ℝ := residualLaw (below (shape 2 4 10)) (fun u => (stageALaw (shape 2 4 10) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 14 a +def CA2_4_10I1R14Raw (a : PairSlot) : Ball := residualBall (below (shape 2 4 10)) A2_4_10Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 14 a +lemma CA2_4_10I1R14Raw_sound (a : PairSlot) : + (CA2_4_10I1R14Raw a).Encloses (CA2_4_10I1R14Value a) := by + exact residualBall_sound_on (below (shape 2 4 10)) A2_4_10Law (fun u => (stageALaw (shape 2 4 10) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A2_4_10Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 2 4 10) (show (shape 2 4 10) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 14 a +def CA2_4_10I1R14Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA2_4_10I1R14Certificates_valid : + CA2_4_10I1R14Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_4_10I1R14CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA2_4_10I1R14P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_4_10I1R14Certificates (CA2_4_10I1R14CertificateIndex a)).input +lemma CA2_4_10I1R14P_check : ∀ a : PairSlot, contains (CA2_4_10I1R14Raw a) (CA2_4_10I1R14P a) = true := by + decide +kernel +lemma CA2_4_10I1R14P_sound (a : PairSlot) : + (CA2_4_10I1R14P a).Encloses (CA2_4_10I1R14Value a) := + contains_sound (CA2_4_10I1R14Raw_sound a) (CA2_4_10I1R14P_check a) +def CA2_4_10I1R14Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_4_10I1R14Certificates (CA2_4_10I1R14CertificateIndex a)).output +lemma CA2_4_10I1R14Terms_sound (a : PairSlot) : + (CA2_4_10I1R14Terms a).Encloses (Foundation.entropyTerm (CA2_4_10I1R14Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_4_10I1R14Certificates_valid + (CA2_4_10I1R14CertificateIndex a) (CA2_4_10I1R14P_sound a) +def CA2_4_10I1R14Entropy : Ball := ⟨0, 0⟩ +lemma CA2_4_10I1R14Entropy_sound : CA2_4_10I1R14Entropy.Encloses (Foundation.finiteEntropy CA2_4_10I1R14Value) := by + exact contains_sound (entropyPair_enclosed CA2_4_10I1R14Value CA2_4_10I1R14Terms CA2_4_10I1R14Terms_sound) (by decide +kernel) +def CA2_4_10I1R14Mass : Ball := ⟨0, 0⟩ +lemma CA2_4_10I1R14Mass_sound : CA2_4_10I1R14Mass.Encloses (∑ a, CA2_4_10I1R14Value a) := by + exact contains_sound (pairSumBall_sound CA2_4_10I1R14P CA2_4_10I1R14Value CA2_4_10I1R14P_sound) (by decide +kernel) +def CA2_4_10I1R14MassTerm : Ball := .exact 0 +lemma CA2_4_10I1R14MassTerm_sound : CA2_4_10I1R14MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_4_10I1R14Value a))) := + entropyTerm_zero_ball (CA2_4_10I1R14Mass_sound) +def CA2_4_10I1R14H : Ball := ⟨0, 0⟩ +lemma CA2_4_10I1R14H_sound : CA2_4_10I1R14H.Encloses (homogeneousEntropy CA2_4_10I1R14Value) := by + exact contains_sound (homogeneous_enclosed CA2_4_10I1R14Value CA2_4_10I1R14MassTerm_sound CA2_4_10I1R14Entropy_sound) (by decide +kernel) +def CA2_4_10I1R15Value (a : PairSlot) : ℝ := residualLaw (below (shape 2 4 10)) (fun u => (stageALaw (shape 2 4 10) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 15 a +def CA2_4_10I1R15Raw (a : PairSlot) : Ball := residualBall (below (shape 2 4 10)) A2_4_10Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 15 a +lemma CA2_4_10I1R15Raw_sound (a : PairSlot) : + (CA2_4_10I1R15Raw a).Encloses (CA2_4_10I1R15Value a) := by + exact residualBall_sound_on (below (shape 2 4 10)) A2_4_10Law (fun u => (stageALaw (shape 2 4 10) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A2_4_10Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 2 4 10) (show (shape 2 4 10) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 15 a +def CA2_4_10I1R15Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA2_4_10I1R15Certificates_valid : + CA2_4_10I1R15Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_4_10I1R15CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA2_4_10I1R15P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_4_10I1R15Certificates (CA2_4_10I1R15CertificateIndex a)).input +lemma CA2_4_10I1R15P_check : ∀ a : PairSlot, contains (CA2_4_10I1R15Raw a) (CA2_4_10I1R15P a) = true := by + decide +kernel +lemma CA2_4_10I1R15P_sound (a : PairSlot) : + (CA2_4_10I1R15P a).Encloses (CA2_4_10I1R15Value a) := + contains_sound (CA2_4_10I1R15Raw_sound a) (CA2_4_10I1R15P_check a) +def CA2_4_10I1R15Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_4_10I1R15Certificates (CA2_4_10I1R15CertificateIndex a)).output +lemma CA2_4_10I1R15Terms_sound (a : PairSlot) : + (CA2_4_10I1R15Terms a).Encloses (Foundation.entropyTerm (CA2_4_10I1R15Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_4_10I1R15Certificates_valid + (CA2_4_10I1R15CertificateIndex a) (CA2_4_10I1R15P_sound a) +def CA2_4_10I1R15Entropy : Ball := ⟨0, 0⟩ +lemma CA2_4_10I1R15Entropy_sound : CA2_4_10I1R15Entropy.Encloses (Foundation.finiteEntropy CA2_4_10I1R15Value) := by + exact contains_sound (entropyPair_enclosed CA2_4_10I1R15Value CA2_4_10I1R15Terms CA2_4_10I1R15Terms_sound) (by decide +kernel) +def CA2_4_10I1R15Mass : Ball := ⟨0, 0⟩ +lemma CA2_4_10I1R15Mass_sound : CA2_4_10I1R15Mass.Encloses (∑ a, CA2_4_10I1R15Value a) := by + exact contains_sound (pairSumBall_sound CA2_4_10I1R15P CA2_4_10I1R15Value CA2_4_10I1R15P_sound) (by decide +kernel) +def CA2_4_10I1R15MassTerm : Ball := .exact 0 +lemma CA2_4_10I1R15MassTerm_sound : CA2_4_10I1R15MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_4_10I1R15Value a))) := + entropyTerm_zero_ball (CA2_4_10I1R15Mass_sound) +def CA2_4_10I1R15H : Ball := ⟨0, 0⟩ +lemma CA2_4_10I1R15H_sound : CA2_4_10I1R15H.Encloses (homogeneousEntropy CA2_4_10I1R15Value) := by + exact contains_sound (homogeneous_enclosed CA2_4_10I1R15Value CA2_4_10I1R15MassTerm_sound CA2_4_10I1R15Entropy_sound) (by decide +kernel) +def CA2_4_10I1R16Value (a : PairSlot) : ℝ := residualLaw (below (shape 2 4 10)) (fun u => (stageALaw (shape 2 4 10) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 16 a +def CA2_4_10I1R16Raw (a : PairSlot) : Ball := residualBall (below (shape 2 4 10)) A2_4_10Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 16 a +lemma CA2_4_10I1R16Raw_sound (a : PairSlot) : + (CA2_4_10I1R16Raw a).Encloses (CA2_4_10I1R16Value a) := by + exact residualBall_sound_on (below (shape 2 4 10)) A2_4_10Law (fun u => (stageALaw (shape 2 4 10) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A2_4_10Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 2 4 10) (show (shape 2 4 10) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 16 a +def CA2_4_10I1R16Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA2_4_10I1R16Certificates_valid : + CA2_4_10I1R16Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_4_10I1R16CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA2_4_10I1R16P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_4_10I1R16Certificates (CA2_4_10I1R16CertificateIndex a)).input +lemma CA2_4_10I1R16P_check : ∀ a : PairSlot, contains (CA2_4_10I1R16Raw a) (CA2_4_10I1R16P a) = true := by + decide +kernel +lemma CA2_4_10I1R16P_sound (a : PairSlot) : + (CA2_4_10I1R16P a).Encloses (CA2_4_10I1R16Value a) := + contains_sound (CA2_4_10I1R16Raw_sound a) (CA2_4_10I1R16P_check a) +def CA2_4_10I1R16Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_4_10I1R16Certificates (CA2_4_10I1R16CertificateIndex a)).output +lemma CA2_4_10I1R16Terms_sound (a : PairSlot) : + (CA2_4_10I1R16Terms a).Encloses (Foundation.entropyTerm (CA2_4_10I1R16Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_4_10I1R16Certificates_valid + (CA2_4_10I1R16CertificateIndex a) (CA2_4_10I1R16P_sound a) +def CA2_4_10I1R16Entropy : Ball := ⟨0, 0⟩ +lemma CA2_4_10I1R16Entropy_sound : CA2_4_10I1R16Entropy.Encloses (Foundation.finiteEntropy CA2_4_10I1R16Value) := by + exact contains_sound (entropyPair_enclosed CA2_4_10I1R16Value CA2_4_10I1R16Terms CA2_4_10I1R16Terms_sound) (by decide +kernel) +def CA2_4_10I1R16Mass : Ball := ⟨0, 0⟩ +lemma CA2_4_10I1R16Mass_sound : CA2_4_10I1R16Mass.Encloses (∑ a, CA2_4_10I1R16Value a) := by + exact contains_sound (pairSumBall_sound CA2_4_10I1R16P CA2_4_10I1R16Value CA2_4_10I1R16P_sound) (by decide +kernel) +def CA2_4_10I1R16MassTerm : Ball := .exact 0 +lemma CA2_4_10I1R16MassTerm_sound : CA2_4_10I1R16MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_4_10I1R16Value a))) := + entropyTerm_zero_ball (CA2_4_10I1R16Mass_sound) +def CA2_4_10I1R16H : Ball := ⟨0, 0⟩ +lemma CA2_4_10I1R16H_sound : CA2_4_10I1R16H.Encloses (homogeneousEntropy CA2_4_10I1R16Value) := by + exact contains_sound (homogeneous_enclosed CA2_4_10I1R16Value CA2_4_10I1R16MassTerm_sound CA2_4_10I1R16Entropy_sound) (by decide +kernel) +def CA2_4_10I1ResidualEntropies (a : Fin 17) : Ball := + match a.val with + | 0 => CA2_4_10I1R0H + | 1 => CA2_4_10I1R1H + | 2 => CA2_4_10I1R2H + | 3 => CA2_4_10I1R3H + | 4 => CA2_4_10I1R4H + | 5 => CA2_4_10I1R5H + | 6 => CA2_4_10I1R6H + | 7 => CA2_4_10I1R7H + | 8 => CA2_4_10I1R8H + | 9 => CA2_4_10I1R9H + | 10 => CA2_4_10I1R10H + | 11 => CA2_4_10I1R11H + | 12 => CA2_4_10I1R12H + | 13 => CA2_4_10I1R13H + | 14 => CA2_4_10I1R14H + | 15 => CA2_4_10I1R15H + | 16 => CA2_4_10I1R16H + | _ => (.exact 0) +lemma CA2_4_10I1ResidualEntropies_sound (k : Fin 17) : + (CA2_4_10I1ResidualEntropies k).Encloses (homogeneousEntropy + (residualLaw (below (shape 2 4 10)) (fun u => (stageALaw (shape 2 4 10) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) k)) := by + fin_cases k + · exact CA2_4_10I1R0H_sound + · exact CA2_4_10I1R1H_sound + · exact CA2_4_10I1R2H_sound + · exact CA2_4_10I1R3H_sound + · exact CA2_4_10I1R4H_sound + · exact CA2_4_10I1R5H_sound + · exact CA2_4_10I1R6H_sound + · exact CA2_4_10I1R7H_sound + · exact CA2_4_10I1R8H_sound + · exact CA2_4_10I1R9H_sound + · exact CA2_4_10I1R10H_sound + · exact CA2_4_10I1R11H_sound + · exact CA2_4_10I1R12H_sound + · exact CA2_4_10I1R13H_sound + · exact CA2_4_10I1R14H_sound + · exact CA2_4_10I1R15H_sound + · exact CA2_4_10I1R16H_sound +def CA2_4_10I1Singles (s : Shape) : Ball := + match s 0, s 1, s 2 with + | _, _, _ => (.exact 0) +lemma CA2_4_10I1Singles_sound (u : Shape) (hu : u ∈ below (shape 2 4 10)) + (hd : designated (Equiv.refl (Fin 3)) 1 u) : + (CA2_4_10I1Singles u).Encloses (homogeneousEntropy ((fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) u)) := by + rw [A2_4_10_below] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 0 0 8) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 0 1 7) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 0 2 6) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 0 3 5) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 0 4 4) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 1 0 7) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 1 1 6) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 1 2 5) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 1 3 4) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 1 4 3) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 2 0 6) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 2 1 5) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 2 2 4) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 2 3 3) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 2 4 2) by decide +kernel) hd |>.elim +def CA2_4_10I1Singleton : Ball := ⟨0, 0⟩ +lemma CA2_4_10I1Singleton_sound : CA2_4_10I1Singleton.Encloses + (singletonEntropy (below (shape 2 4 10)) (fun u => (stageALaw (shape 2 4 10) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ))) := by + exact contains_sound (singletonBall_sound (below (shape 2 4 10)) A2_4_10Law (fun u => (stageALaw (shape 2 4 10) u : ℝ)) (Equiv.refl (Fin 3)) 1 + CA2_4_10I1Singles (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A2_4_10Law_sound u) CA2_4_10I1Singles_sound) (by decide +kernel) +def CA2_4_10I1Group : Ball := ⟨(19258557836174867804781857094959 / 20000000000000000000000000000000), (22067510623 / 12500000000000000000000000000000)⟩ +lemma CA2_4_10I1Group_sound : CA2_4_10I1Group.Encloses + (groupedEntropy (below (shape 2 4 10)) (fun u => (stageALaw (shape 2 4 10) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ))) := by + exact contains_sound (Ball.add_sound CA2_4_10I1Singleton_sound + (finSumBall_sound 17 CA2_4_10I1ResidualEntropies _ CA2_4_10I1ResidualEntropies_sound)) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CA2_4_10I1H : Ball := ⟨(121272854904680328155082525730649 / 100000000000000000000000000000000), (526079246751 / 100000000000000000000000000000000)⟩ +lemma CA2_4_10I1_sound : CA2_4_10I1H.Encloses (stageACapacity (shape 2 4 10) 1) := by + have hb := contains_sound (Ball.add_sound CA2_4_10I1PairH_sound + (Ball.neg_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) CA2_4_10I1Group_sound))) + (show contains (.add CA2_4_10I1PairH (.neg (.mul (.exact 2) CA2_4_10I1Group))) CA2_4_10I1H = true by decide +kernel) + simp only [stageACapacity, nativeCapacity, + show (1 : Fin 3) ≠ 0 by decide, ite_false, sub_eq_add_neg] + exact hb + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA2_4_10I2.lean b/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA2_4_10I2.lean new file mode 100644 index 0000000000000000000000000000000000000000..5dfb80106b3aa89926b89a8629382e3d59e121f0 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA2_4_10I2.lean @@ -0,0 +1,839 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.CapacityA.CapA2_4_10I2Pair + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CA2_4_10I2R0Value (a : PairSlot) : ℝ := residualLaw (below (shape 2 4 10)) (fun u => (stageALaw (shape 2 4 10) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 0 a +def CA2_4_10I2R0Raw (a : PairSlot) : Ball := residualBall (below (shape 2 4 10)) A2_4_10Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 0 a +lemma CA2_4_10I2R0Raw_sound (a : PairSlot) : + (CA2_4_10I2R0Raw a).Encloses (CA2_4_10I2R0Value a) := by + exact residualBall_sound_on (below (shape 2 4 10)) A2_4_10Law (fun u => (stageALaw (shape 2 4 10) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A2_4_10Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 2 4 10) (show (shape 2 4 10) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 0 a +def CA2_4_10I2R0Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA2_4_10I2R0Certificates_valid : + CA2_4_10I2R0Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_4_10I2R0CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA2_4_10I2R0P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_4_10I2R0Certificates (CA2_4_10I2R0CertificateIndex a)).input +lemma CA2_4_10I2R0P_check : ∀ a : PairSlot, contains (CA2_4_10I2R0Raw a) (CA2_4_10I2R0P a) = true := by + decide +kernel +lemma CA2_4_10I2R0P_sound (a : PairSlot) : + (CA2_4_10I2R0P a).Encloses (CA2_4_10I2R0Value a) := + contains_sound (CA2_4_10I2R0Raw_sound a) (CA2_4_10I2R0P_check a) +def CA2_4_10I2R0Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_4_10I2R0Certificates (CA2_4_10I2R0CertificateIndex a)).output +lemma CA2_4_10I2R0Terms_sound (a : PairSlot) : + (CA2_4_10I2R0Terms a).Encloses (Foundation.entropyTerm (CA2_4_10I2R0Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_4_10I2R0Certificates_valid + (CA2_4_10I2R0CertificateIndex a) (CA2_4_10I2R0P_sound a) +def CA2_4_10I2R0Entropy : Ball := ⟨0, 0⟩ +lemma CA2_4_10I2R0Entropy_sound : CA2_4_10I2R0Entropy.Encloses (Foundation.finiteEntropy CA2_4_10I2R0Value) := by + exact contains_sound (entropyPair_enclosed CA2_4_10I2R0Value CA2_4_10I2R0Terms CA2_4_10I2R0Terms_sound) (by decide +kernel) +def CA2_4_10I2R0Mass : Ball := ⟨0, 0⟩ +lemma CA2_4_10I2R0Mass_sound : CA2_4_10I2R0Mass.Encloses (∑ a, CA2_4_10I2R0Value a) := by + exact contains_sound (pairSumBall_sound CA2_4_10I2R0P CA2_4_10I2R0Value CA2_4_10I2R0P_sound) (by decide +kernel) +def CA2_4_10I2R0MassTerm : Ball := .exact 0 +lemma CA2_4_10I2R0MassTerm_sound : CA2_4_10I2R0MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_4_10I2R0Value a))) := + entropyTerm_zero_ball (CA2_4_10I2R0Mass_sound) +def CA2_4_10I2R0H : Ball := ⟨0, 0⟩ +lemma CA2_4_10I2R0H_sound : CA2_4_10I2R0H.Encloses (homogeneousEntropy CA2_4_10I2R0Value) := by + exact contains_sound (homogeneous_enclosed CA2_4_10I2R0Value CA2_4_10I2R0MassTerm_sound CA2_4_10I2R0Entropy_sound) (by decide +kernel) +def CA2_4_10I2R1Value (a : PairSlot) : ℝ := residualLaw (below (shape 2 4 10)) (fun u => (stageALaw (shape 2 4 10) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 1 a +def CA2_4_10I2R1Raw (a : PairSlot) : Ball := residualBall (below (shape 2 4 10)) A2_4_10Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 1 a +lemma CA2_4_10I2R1Raw_sound (a : PairSlot) : + (CA2_4_10I2R1Raw a).Encloses (CA2_4_10I2R1Value a) := by + exact residualBall_sound_on (below (shape 2 4 10)) A2_4_10Law (fun u => (stageALaw (shape 2 4 10) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A2_4_10Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 2 4 10) (show (shape 2 4 10) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 1 a +def CA2_4_10I2R1Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA2_4_10I2R1Certificates_valid : + CA2_4_10I2R1Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_4_10I2R1CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA2_4_10I2R1P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_4_10I2R1Certificates (CA2_4_10I2R1CertificateIndex a)).input +lemma CA2_4_10I2R1P_check : ∀ a : PairSlot, contains (CA2_4_10I2R1Raw a) (CA2_4_10I2R1P a) = true := by + decide +kernel +lemma CA2_4_10I2R1P_sound (a : PairSlot) : + (CA2_4_10I2R1P a).Encloses (CA2_4_10I2R1Value a) := + contains_sound (CA2_4_10I2R1Raw_sound a) (CA2_4_10I2R1P_check a) +def CA2_4_10I2R1Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_4_10I2R1Certificates (CA2_4_10I2R1CertificateIndex a)).output +lemma CA2_4_10I2R1Terms_sound (a : PairSlot) : + (CA2_4_10I2R1Terms a).Encloses (Foundation.entropyTerm (CA2_4_10I2R1Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_4_10I2R1Certificates_valid + (CA2_4_10I2R1CertificateIndex a) (CA2_4_10I2R1P_sound a) +def CA2_4_10I2R1Entropy : Ball := ⟨0, 0⟩ +lemma CA2_4_10I2R1Entropy_sound : CA2_4_10I2R1Entropy.Encloses (Foundation.finiteEntropy CA2_4_10I2R1Value) := by + exact contains_sound (entropyPair_enclosed CA2_4_10I2R1Value CA2_4_10I2R1Terms CA2_4_10I2R1Terms_sound) (by decide +kernel) +def CA2_4_10I2R1Mass : Ball := ⟨0, 0⟩ +lemma CA2_4_10I2R1Mass_sound : CA2_4_10I2R1Mass.Encloses (∑ a, CA2_4_10I2R1Value a) := by + exact contains_sound (pairSumBall_sound CA2_4_10I2R1P CA2_4_10I2R1Value CA2_4_10I2R1P_sound) (by decide +kernel) +def CA2_4_10I2R1MassTerm : Ball := .exact 0 +lemma CA2_4_10I2R1MassTerm_sound : CA2_4_10I2R1MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_4_10I2R1Value a))) := + entropyTerm_zero_ball (CA2_4_10I2R1Mass_sound) +def CA2_4_10I2R1H : Ball := ⟨0, 0⟩ +lemma CA2_4_10I2R1H_sound : CA2_4_10I2R1H.Encloses (homogeneousEntropy CA2_4_10I2R1Value) := by + exact contains_sound (homogeneous_enclosed CA2_4_10I2R1Value CA2_4_10I2R1MassTerm_sound CA2_4_10I2R1Entropy_sound) (by decide +kernel) +def CA2_4_10I2R2Value (a : PairSlot) : ℝ := residualLaw (below (shape 2 4 10)) (fun u => (stageALaw (shape 2 4 10) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 2 a +def CA2_4_10I2R2Raw (a : PairSlot) : Ball := residualBall (below (shape 2 4 10)) A2_4_10Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 2 a +lemma CA2_4_10I2R2Raw_sound (a : PairSlot) : + (CA2_4_10I2R2Raw a).Encloses (CA2_4_10I2R2Value a) := by + exact residualBall_sound_on (below (shape 2 4 10)) A2_4_10Law (fun u => (stageALaw (shape 2 4 10) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A2_4_10Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 2 4 10) (show (shape 2 4 10) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 2 a +def CA2_4_10I2R2Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(108119627934249078776977417 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(5341606149681540320740204679 / 100000000000000000000000000000000), (1740051 / 100000000000000000000000000000000)⟩ ⟨(-1235114810265980979972407199390463 / 100000000000000000000000000000000), (402340881201 / 100000000000000000000000000000000)⟩ ⟨-18, 108119627934249078776977417, 95367431640625000000000000⟩, + .log ⟨(43499240461398851725860779 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(318587072713131070978388603 / 50000000000000000000000000000000), (211877 / 100000000000000000000000000000000)⟩ ⟨(-1464793726666766377904242428224319 / 100000000000000000000000000000000), (487046243599 / 100000000000000000000000000000000)⟩ ⟨-22, 43499240461398851725860779, 23841857910156250000000000⟩, + .log ⟨(1272072156411299444786029 / 78125000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(224402040018928237480642147 / 1250000000000000000000000000000), (2930771 / 50000000000000000000000000000000)⟩ ⟨(-1102541819699122984308435758302303 / 100000000000000000000000000000000), (179994532013 / 50000000000000000000000000000000)⟩ ⟨-16, 1272072156411299444786029, 1192092895507812500000000⟩] +lemma CA2_4_10I2R2Certificates_valid : + CA2_4_10I2R2Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_4_10I2R2CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 2, 0 => 1 + | 3, 0 => 2 + | 1, 1 => 3 + | 0, 2 => 1 + | 0, 3 => 2 + | _, _ => 0 +def CA2_4_10I2R2P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_4_10I2R2Certificates (CA2_4_10I2R2CertificateIndex a)).input +lemma CA2_4_10I2R2P_check : ∀ a : PairSlot, contains (CA2_4_10I2R2Raw a) (CA2_4_10I2R2P a) = true := by + decide +kernel +lemma CA2_4_10I2R2P_sound (a : PairSlot) : + (CA2_4_10I2R2P a).Encloses (CA2_4_10I2R2Value a) := + contains_sound (CA2_4_10I2R2Raw_sound a) (CA2_4_10I2R2P_check a) +def CA2_4_10I2R2Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_4_10I2R2Certificates (CA2_4_10I2R2CertificateIndex a)).output +lemma CA2_4_10I2R2Terms_sound (a : PairSlot) : + (CA2_4_10I2R2Terms a).Encloses (Foundation.entropyTerm (CA2_4_10I2R2Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_4_10I2R2Certificates_valid + (CA2_4_10I2R2CertificateIndex a) (CA2_4_10I2R2P_sound a) +def CA2_4_10I2R2Entropy : Ball := ⟨(2990972379172986392384533553 / 10000000000000000000000000000000), (4882699 / 50000000000000000000000000000000)⟩ +lemma CA2_4_10I2R2Entropy_sound : CA2_4_10I2R2Entropy.Encloses (Foundation.finiteEntropy CA2_4_10I2R2Value) := by + exact contains_sound (entropyPair_enclosed CA2_4_10I2R2Value CA2_4_10I2R2Terms CA2_4_10I2R2Terms_sound) (by decide +kernel) +def CA2_4_10I2R2Mass : Ball := ⟨(1290103932301626811496829007 / 50000000000000000000000000000000), (1 / 20000000000000000000000000000000)⟩ +lemma CA2_4_10I2R2Mass_sound : CA2_4_10I2R2Mass.Encloses (∑ a, CA2_4_10I2R2Value a) := by + exact contains_sound (pairSumBall_sound CA2_4_10I2R2P CA2_4_10I2R2Value CA2_4_10I2R2P_sound) (by decide +kernel) +def CA2_4_10I2R2MassTermLogWitness : LogWitness := ⟨-16, 1290103932301626811496829007, 762939453125000000000000000⟩ +def CA2_4_10I2R2MassTermLog : Ball := ⟨(-1056505550160642353212106317084283 / 100000000000000000000000000000000), (179994598197 / 50000000000000000000000000000000)⟩ +lemma CA2_4_10I2R2MassTermLog_sound : CA2_4_10I2R2MassTermLog.Encloses (Real.log ((∑ a, CA2_4_10I2R2Value a))) := by + exact checkLog_sound logTwoBall_sound (CA2_4_10I2R2Mass_sound) (w := CA2_4_10I2R2MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA2_4_10I2R2MassTerm : Ball := ⟨(1090401571808590665558663107 / 4000000000000000000000000000000), (9288523 / 100000000000000000000000000000000)⟩ +lemma CA2_4_10I2R2MassTerm_sound : CA2_4_10I2R2MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_4_10I2R2Value a))) := by + exact contains_sound (entropyTerm_ball (CA2_4_10I2R2Mass_sound) CA2_4_10I2R2MassTermLog_sound) (by decide +kernel) +def CA2_4_10I2R2H : Ball := ⟨(529936899303019456975751571 / 20000000000000000000000000000000), (19053921 / 100000000000000000000000000000000)⟩ +lemma CA2_4_10I2R2H_sound : CA2_4_10I2R2H.Encloses (homogeneousEntropy CA2_4_10I2R2Value) := by + exact contains_sound (homogeneous_enclosed CA2_4_10I2R2Value CA2_4_10I2R2MassTerm_sound CA2_4_10I2R2Entropy_sound) (by decide +kernel) +def CA2_4_10I2R3Value (a : PairSlot) : ℝ := residualLaw (below (shape 2 4 10)) (fun u => (stageALaw (shape 2 4 10) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 3 a +def CA2_4_10I2R3Raw (a : PairSlot) : Ball := residualBall (below (shape 2 4 10)) A2_4_10Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 3 a +lemma CA2_4_10I2R3Raw_sound (a : PairSlot) : + (CA2_4_10I2R3Raw a).Encloses (CA2_4_10I2R3Value a) := by + exact residualBall_sound_on (below (shape 2 4 10)) A2_4_10Law (fun u => (stageALaw (shape 2 4 10) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A2_4_10Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 2 4 10) (show (shape 2 4 10) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 3 a +def CA2_4_10I2R3Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(5101330045191344185451166313 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(23441318054895785431659789537 / 25000000000000000000000000000000), (32407471 / 100000000000000000000000000000000)⟩ ⟨(-91902769855058583647193445625611 / 10000000000000000000000000000000), (158818682523 / 50000000000000000000000000000000)⟩ ⟨-14, 5101330045191344185451166313, 3051757812500000000000000000⟩, + .log ⟨(7153688662319837610093422047 / 2000000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ ⟨(2014934538545397049488255840941 / 100000000000000000000000000000000), (189356569 / 25000000000000000000000000000000)⟩ ⟨(-14083185847593086092627204564871 / 2500000000000000000000000000000), (52939559487 / 25000000000000000000000000000000)⟩ ⟨-9, 7153688662319837610093422047, 3906250000000000000000000000⟩, + .log ⟨(4340734698819895454048905001 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(91540060453156114599892195539 / 50000000000000000000000000000000), (64343053 / 100000000000000000000000000000000)⟩ ⟨(-33741775733234423723495425326571 / 4000000000000000000000000000000), (296461536169 / 100000000000000000000000000000000)⟩ ⟨-13, 4340734698819895454048905001, 2441406250000000000000000000⟩] +lemma CA2_4_10I2R3Certificates_valid : + CA2_4_10I2R3Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_4_10I2R3CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 4, 0 => 1 + | 2, 1 => 2 + | 3, 1 => 3 + | 1, 2 => 2 + | 1, 3 => 3 + | 0, 4 => 1 + | _, _ => 0 +def CA2_4_10I2R3P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_4_10I2R3Certificates (CA2_4_10I2R3CertificateIndex a)).input +lemma CA2_4_10I2R3P_check : ∀ a : PairSlot, contains (CA2_4_10I2R3Raw a) (CA2_4_10I2R3P a) = true := by + decide +kernel +lemma CA2_4_10I2R3P_sound (a : PairSlot) : + (CA2_4_10I2R3P a).Encloses (CA2_4_10I2R3Value a) := + contains_sound (CA2_4_10I2R3Raw_sound a) (CA2_4_10I2R3P_check a) +def CA2_4_10I2R3Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_4_10I2R3Certificates (CA2_4_10I2R3CertificateIndex a)).output +lemma CA2_4_10I2R3Terms_sound (a : PairSlot) : + (CA2_4_10I2R3Terms a).Encloses (Foundation.entropyTerm (CA2_4_10I2R3Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_4_10I2R3Certificates_valid + (CA2_4_10I2R3CertificateIndex a) (CA2_4_10I2R3P_sound a) +def CA2_4_10I2R3Entropy : Ball := ⟨(2291779931671292420414679390167 / 50000000000000000000000000000000), (1067721 / 62500000000000000000000000000)⟩ +lemma CA2_4_10I2R3Entropy_sound : CA2_4_10I2R3Entropy.Encloses (Foundation.finiteEntropy CA2_4_10I2R3Value) := by + exact contains_sound (entropyPair_enclosed CA2_4_10I2R3Value CA2_4_10I2R3Terms CA2_4_10I2R3Terms_sound) (by decide +kernel) +def CA2_4_10I2R3Mass : Ball := ⟨(389590766700474046145817959981 / 50000000000000000000000000000000), (3 / 25000000000000000000000000000000)⟩ +lemma CA2_4_10I2R3Mass_sound : CA2_4_10I2R3Mass.Encloses (∑ a, CA2_4_10I2R3Value a) := by + exact contains_sound (pairSumBall_sound CA2_4_10I2R3P CA2_4_10I2R3Value CA2_4_10I2R3P_sound) (by decide +kernel) +def CA2_4_10I2R3MassTermLogWitness : LogWitness := ⟨-8, 389590766700474046145817959981, 195312500000000000000000000000⟩ +def CA2_4_10I2R3MassTermLog : Ball := ⟨(-6068351765446050781817188320967 / 1250000000000000000000000000000), (190582414687 / 100000000000000000000000000000000)⟩ +lemma CA2_4_10I2R3MassTermLog_sound : CA2_4_10I2R3MassTermLog.Encloses (Real.log ((∑ a, CA2_4_10I2R3Value a))) := by + exact checkLog_sound logTwoBall_sound (CA2_4_10I2R3Mass_sound) (w := CA2_4_10I2R3MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA2_4_10I2R3MassTerm : Ball := ⟨(3782678107053283472545872209083 / 100000000000000000000000000000000), (1160143 / 78125000000000000000000000000)⟩ +lemma CA2_4_10I2R3MassTerm_sound : CA2_4_10I2R3MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_4_10I2R3Value a))) := by + exact contains_sound (entropyTerm_ball (CA2_4_10I2R3Mass_sound) CA2_4_10I2R3MassTermLog_sound) (by decide +kernel) +def CA2_4_10I2R3H : Ball := ⟨(800881756289301368283486571251 / 100000000000000000000000000000000), (9979177 / 312500000000000000000000000000)⟩ +lemma CA2_4_10I2R3H_sound : CA2_4_10I2R3H.Encloses (homogeneousEntropy CA2_4_10I2R3Value) := by + exact contains_sound (homogeneous_enclosed CA2_4_10I2R3Value CA2_4_10I2R3MassTerm_sound CA2_4_10I2R3Entropy_sound) (by decide +kernel) +def CA2_4_10I2R4Value (a : PairSlot) : ℝ := residualLaw (below (shape 2 4 10)) (fun u => (stageALaw (shape 2 4 10) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 4 a +def CA2_4_10I2R4Raw (a : PairSlot) : Ball := residualBall (below (shape 2 4 10)) A2_4_10Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 4 a +lemma CA2_4_10I2R4Raw_sound (a : PairSlot) : + (CA2_4_10I2R4Raw a).Encloses (CA2_4_10I2R4Value a) := by + exact residualBall_sound_on (below (shape 2 4 10)) A2_4_10Law (fun u => (stageALaw (shape 2 4 10) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A2_4_10Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 2 4 10) (show (shape 2 4 10) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 4 a +def CA2_4_10I2R4Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(972062729000252664061250893 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(19742528012137973035621483893 / 50000000000000000000000000000000), (6586959 / 50000000000000000000000000000000)⟩ ⟨(-1015496604444590398738360364393069 / 100000000000000000000000000000000), (169406602323 / 50000000000000000000000000000000)⟩ ⟨-15, 972062729000252664061250893, 762939453125000000000000000⟩, + .log ⟨(282887429788319230324036160949 / 20000000000000000000000000000000), (11 / 100000000000000000000000000000000)⟩ ⟨(3011646811541868877798144773663 / 50000000000000000000000000000000), (2396149793 / 100000000000000000000000000000000)⟩ ⟨(-106460962715644266364444384953511 / 25000000000000000000000000000000), (169406590241 / 100000000000000000000000000000000)⟩ ⟨-7, 282887429788319230324036160949, 156250000000000000000000000000⟩, + .log ⟨(2973873107602243992170166476157 / 20000000000000000000000000000000), (17 / 20000000000000000000000000000000)⟩ ⟨(28339034482721266653792374925983 / 100000000000000000000000000000000), (3148710691 / 25000000000000000000000000000000)⟩ ⟨(-190586709367504170503864919298769 / 100000000000000000000000000000000), (84703295303 / 100000000000000000000000000000000)⟩ ⟨-3, 2973873107602243992170166476157, 2500000000000000000000000000000⟩, + .log ⟨(688444784950710917538417309189 / 100000000000000000000000000000000), (1 / 20000000000000000000000000000000)⟩ ⟨(3427415715746421544076009068661 / 100000000000000000000000000000000), (262410943 / 20000000000000000000000000000000)⟩ ⟨(-2489245173083711256003230900169 / 500000000000000000000000000000), (190582413873 / 100000000000000000000000000000000)⟩ ⟨-8, 688444784950710917538417309189, 390625000000000000000000000000⟩, + .log ⟨(3244754126435935260381470661 / 10000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(130330429511940918756764107249 / 50000000000000000000000000000000), (44661727 / 50000000000000000000000000000000)⟩ ⟨(-401665039733216825528248804145889 / 50000000000000000000000000000000), (3441071387 / 1250000000000000000000000000000)⟩ ⟨-12, 3244754126435935260381470661, 2441406250000000000000000000⟩] +lemma CA2_4_10I2R4Certificates_valid : + CA2_4_10I2R4Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_4_10I2R4CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 5, 0 => 1 + | 4, 1 => 2 + | 2, 2 => 3 + | 2, 3 => 4 + | 3, 2 => 4 + | 3, 3 => 5 + | 1, 4 => 2 + | 0, 5 => 1 + | _, _ => 0 +def CA2_4_10I2R4P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_4_10I2R4Certificates (CA2_4_10I2R4CertificateIndex a)).input +lemma CA2_4_10I2R4P_check : ∀ a : PairSlot, contains (CA2_4_10I2R4Raw a) (CA2_4_10I2R4P a) = true := by + decide +kernel +lemma CA2_4_10I2R4P_sound (a : PairSlot) : + (CA2_4_10I2R4P a).Encloses (CA2_4_10I2R4Value a) := + contains_sound (CA2_4_10I2R4Raw_sound a) (CA2_4_10I2R4P_check a) +def CA2_4_10I2R4Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_4_10I2R4Certificates (CA2_4_10I2R4CertificateIndex a)).output +lemma CA2_4_10I2R4Terms_sound (a : PairSlot) : + (CA2_4_10I2R4Terms a).Encloses (Foundation.entropyTerm (CA2_4_10I2R4Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_4_10I2R4Certificates_valid + (CA2_4_10I2R4CertificateIndex a) (CA2_4_10I2R4P_sound a) +def CA2_4_10I2R4Entropy : Ball := ⟨(47580084131454018982792986308027 / 100000000000000000000000000000000), (2012692307 / 10000000000000000000000000000000)⟩ +lemma CA2_4_10I2R4Entropy_sound : CA2_4_10I2R4Entropy.Encloses (Foundation.finiteEntropy CA2_4_10I2R4Value) := by + exact contains_sound (entropyPair_enclosed CA2_4_10I2R4Value CA2_4_10I2R4Terms CA2_4_10I2R4Terms_sound) (by decide +kernel) +def CA2_4_10I2R4Mass : Ball := ⟨(19115353448892195473084333322407 / 100000000000000000000000000000000), (3 / 2500000000000000000000000000000)⟩ +lemma CA2_4_10I2R4Mass_sound : CA2_4_10I2R4Mass.Encloses (∑ a, CA2_4_10I2R4Value a) := by + exact contains_sound (pairSumBall_sound CA2_4_10I2R4P CA2_4_10I2R4Value CA2_4_10I2R4P_sound) (by decide +kernel) +def CA2_4_10I2R4MassTermLogWitness : LogWitness := ⟨-3, 19115353448892195473084333322407, 12500000000000000000000000000000⟩ +def CA2_4_10I2R4MassTermLog : Ball := ⟨(-165467832835452117553219578152353 / 100000000000000000000000000000000), (84703295359 / 100000000000000000000000000000000)⟩ +lemma CA2_4_10I2R4MassTermLog_sound : CA2_4_10I2R4MassTermLog.Encloses (Real.log ((∑ a, CA2_4_10I2R4Value a))) := by + exact checkLog_sound logTwoBall_sound (CA2_4_10I2R4Mass_sound) (w := CA2_4_10I2R4MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA2_4_10I2R4MassTerm : Ball := ⟨(15814880545359384516533513860097 / 50000000000000000000000000000000), (1619133449 / 10000000000000000000000000000000)⟩ +lemma CA2_4_10I2R4MassTerm_sound : CA2_4_10I2R4MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_4_10I2R4Value a))) := by + exact contains_sound (entropyTerm_ball (CA2_4_10I2R4Mass_sound) CA2_4_10I2R4MassTermLog_sound) (by decide +kernel) +def CA2_4_10I2R4H : Ball := ⟨(15950323040735249949725958587833 / 100000000000000000000000000000000), (907956439 / 2500000000000000000000000000000)⟩ +lemma CA2_4_10I2R4H_sound : CA2_4_10I2R4H.Encloses (homogeneousEntropy CA2_4_10I2R4Value) := by + exact contains_sound (homogeneous_enclosed CA2_4_10I2R4Value CA2_4_10I2R4MassTerm_sound CA2_4_10I2R4Entropy_sound) (by decide +kernel) +def CA2_4_10I2R5Value (a : PairSlot) : ℝ := residualLaw (below (shape 2 4 10)) (fun u => (stageALaw (shape 2 4 10) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 5 a +def CA2_4_10I2R5Raw (a : PairSlot) : Ball := residualBall (below (shape 2 4 10)) A2_4_10Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 5 a +lemma CA2_4_10I2R5Raw_sound (a : PairSlot) : + (CA2_4_10I2R5Raw a).Encloses (CA2_4_10I2R5Value a) := by + exact residualBall_sound_on (below (shape 2 4 10)) A2_4_10Law (fun u => (stageALaw (shape 2 4 10) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A2_4_10Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 2 4 10) (show (shape 2 4 10) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 5 a +def CA2_4_10I2R5Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(16566491413379707340906706941 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(6636864657885305316815959311 / 2500000000000000000000000000000), (11401297 / 12500000000000000000000000000000)⟩ ⟨(-801239621870099723292720346396909 / 100000000000000000000000000000000), (17205356931 / 6250000000000000000000000000000)⟩ ⟨-12, 16566491413379707340906706941, 12207031250000000000000000000⟩, + .log ⟨(2035480733178375986788837663423 / 10000000000000000000000000000000), (19 / 25000000000000000000000000000000)⟩ ⟨(1012558204054107071425207125407 / 3125000000000000000000000000000), (4310298161 / 25000000000000000000000000000000)⟩ ⟨(-159185306947790906280698291000047 / 100000000000000000000000000000000), (16940659021 / 20000000000000000000000000000000)⟩ ⟨-3, 2035480733178375986788837663423, 1250000000000000000000000000000⟩, + .log ⟨(759233811713028272251009164257 / 100000000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ ⟨(185276422413761041348577490497 / 5000000000000000000000000000000), (11304423 / 781250000000000000000000000000)⟩ ⟨(-61007696033626785148893640778559 / 12500000000000000000000000000000), (95291206837 / 50000000000000000000000000000000)⟩ ⟨-8, 759233811713028272251009164257, 390625000000000000000000000000⟩] +lemma CA2_4_10I2R5Certificates_valid : + CA2_4_10I2R5Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_4_10I2R5CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 5, 1 => 1 + | 4, 2 => 2 + | 4, 3 => 3 + | 2, 4 => 2 + | 3, 4 => 3 + | 1, 5 => 1 + | _, _ => 0 +def CA2_4_10I2R5P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_4_10I2R5Certificates (CA2_4_10I2R5CertificateIndex a)).input +lemma CA2_4_10I2R5P_check : ∀ a : PairSlot, contains (CA2_4_10I2R5Raw a) (CA2_4_10I2R5P a) = true := by + decide +kernel +lemma CA2_4_10I2R5P_sound (a : PairSlot) : + (CA2_4_10I2R5P a).Encloses (CA2_4_10I2R5Value a) := + contains_sound (CA2_4_10I2R5Raw_sound a) (CA2_4_10I2R5P_check a) +def CA2_4_10I2R5Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_4_10I2R5Certificates (CA2_4_10I2R5CertificateIndex a)).output +lemma CA2_4_10I2R5Terms_sound (a : PairSlot) : + (CA2_4_10I2R5Terms a).Encloses (Foundation.entropyTerm (CA2_4_10I2R5Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_4_10I2R5Certificates_valid + (CA2_4_10I2R5CertificateIndex a) (CA2_4_10I2R5P_sound a) +def CA2_4_10I2R5Entropy : Ball := ⟨(9093216391080514831312704048851 / 12500000000000000000000000000000), (4694842291 / 12500000000000000000000000000000)⟩ +lemma CA2_4_10I2R5Entropy_sound : CA2_4_10I2R5Entropy.Encloses (Foundation.finiteEntropy CA2_4_10I2R5Value) := by + exact contains_sound (entropyPair_enclosed CA2_4_10I2R5Value CA2_4_10I2R5Terms CA2_4_10I2R5Terms_sound) (by decide +kernel) +def CA2_4_10I2R5Mass : Ball := ⟨(21147174126323547554821199212369 / 50000000000000000000000000000000), (81 / 50000000000000000000000000000000)⟩ +lemma CA2_4_10I2R5Mass_sound : CA2_4_10I2R5Mass.Encloses (∑ a, CA2_4_10I2R5Value a) := by + exact contains_sound (pairSumBall_sound CA2_4_10I2R5P CA2_4_10I2R5Value CA2_4_10I2R5P_sound) (by decide +kernel) +def CA2_4_10I2R5MassTermLogWitness : LogWitness := ⟨-2, 21147174126323547554821199212369, 12500000000000000000000000000000⟩ +def CA2_4_10I2R5MassTermLog : Ball := ⟨(-17210334398222848168988098648769 / 20000000000000000000000000000000), (63527471431 / 100000000000000000000000000000000)⟩ +lemma CA2_4_10I2R5MassTermLog_sound : CA2_4_10I2R5MassTermLog.Encloses (Real.log ((∑ a, CA2_4_10I2R5Value a))) := by + exact checkLog_sound logTwoBall_sound (CA2_4_10I2R5Mass_sound) (w := CA2_4_10I2R5MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA2_4_10I2R5MassTerm : Ball := ⟨(909874845728685891983629432179 / 2500000000000000000000000000000), (26868530143 / 100000000000000000000000000000000)⟩ +lemma CA2_4_10I2R5MassTerm_sound : CA2_4_10I2R5MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_4_10I2R5Value a))) := by + exact contains_sound (entropyTerm_ball (CA2_4_10I2R5Mass_sound) CA2_4_10I2R5MassTermLog_sound) (by decide +kernel) +def CA2_4_10I2R5H : Ball := ⟨(1135960540609271342848639221989 / 3125000000000000000000000000000), (64427268471 / 100000000000000000000000000000000)⟩ +lemma CA2_4_10I2R5H_sound : CA2_4_10I2R5H.Encloses (homogeneousEntropy CA2_4_10I2R5Value) := by + exact contains_sound (homogeneous_enclosed CA2_4_10I2R5Value CA2_4_10I2R5MassTerm_sound CA2_4_10I2R5Entropy_sound) (by decide +kernel) +def CA2_4_10I2R6Value (a : PairSlot) : ℝ := residualLaw (below (shape 2 4 10)) (fun u => (stageALaw (shape 2 4 10) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 6 a +def CA2_4_10I2R6Raw (a : PairSlot) : Ball := residualBall (below (shape 2 4 10)) A2_4_10Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 6 a +lemma CA2_4_10I2R6Raw_sound (a : PairSlot) : + (CA2_4_10I2R6Raw a).Encloses (CA2_4_10I2R6Value a) := by + exact residualBall_sound_on (below (shape 2 4 10)) A2_4_10Law (fun u => (stageALaw (shape 2 4 10) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A2_4_10Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 2 4 10) (show (shape 2 4 10) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 6 a +def CA2_4_10I2R6Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(43134264585488101866709234377 / 50000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ ⟨(608664208686171475410771811939 / 100000000000000000000000000000000), (54804219 / 25000000000000000000000000000000)⟩ ⟨(-88193257514547339481279000366791 / 12500000000000000000000000000000), (127054943257 / 50000000000000000000000000000000)⟩ ⟨-11, 43134264585488101866709234377, 24414062500000000000000000000⟩, + .log ⟨(5435259759136326423770061 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(45459896894057929252170797 / 50000000000000000000000000000000), (29943 / 100000000000000000000000000000000)⟩ ⟨(-26137145985549914409024975199461 / 1562500000000000000000000000000), (275294907071 / 50000000000000000000000000000000)⟩ ⟨-25, 5435259759136326423770061, 2980232238769531250000000⟩, + .log ⟨(1809194746657434931160869249031 / 20000000000000000000000000000000), (21 / 50000000000000000000000000000000)⟩ ⟨(21736121771847904225995996957063 / 100000000000000000000000000000000), (1915559477 / 20000000000000000000000000000000)⟩ ⟨(-6007126046548146240366626242057 / 2500000000000000000000000000000), (105879118879 / 100000000000000000000000000000000)⟩ ⟨-4, 1809194746657434931160869249031, 1250000000000000000000000000000⟩] +lemma CA2_4_10I2R6Certificates_valid : + CA2_4_10I2R6Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_4_10I2R6CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 5, 2 => 1 + | 5, 3 => 2 + | 4, 4 => 3 + | 2, 5 => 1 + | 3, 5 => 2 + | _, _ => 0 +def CA2_4_10I2R6P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_4_10I2R6Certificates (CA2_4_10I2R6CertificateIndex a)).input +lemma CA2_4_10I2R6P_check : ∀ a : PairSlot, contains (CA2_4_10I2R6Raw a) (CA2_4_10I2R6P a) = true := by + decide +kernel +lemma CA2_4_10I2R6P_sound (a : PairSlot) : + (CA2_4_10I2R6P a).Encloses (CA2_4_10I2R6Value a) := + contains_sound (CA2_4_10I2R6Raw_sound a) (CA2_4_10I2R6P_check a) +def CA2_4_10I2R6Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_4_10I2R6Certificates (CA2_4_10I2R6CertificateIndex a)).output +lemma CA2_4_10I2R6Terms_sound (a : PairSlot) : + (CA2_4_10I2R6Terms a).Encloses (Foundation.entropyTerm (CA2_4_10I2R6Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_4_10I2R6Certificates_valid + (CA2_4_10I2R6CertificateIndex a) (CA2_4_10I2R6P_sound a) +def CA2_4_10I2R6Entropy : Ball := ⟨(22953632028807823408534549264129 / 100000000000000000000000000000000), (10016291023 / 100000000000000000000000000000000)⟩ +lemma CA2_4_10I2R6Entropy_sound : CA2_4_10I2R6Entropy.Encloses (Foundation.finiteEntropy CA2_4_10I2R6Value) := by + exact contains_sound (entropyPair_enclosed CA2_4_10I2R6Value CA2_4_10I2R6Terms CA2_4_10I2R6Terms_sound) (by decide +kernel) +def CA2_4_10I2R6Mass : Ball := ⟨(1843704332429729067184806144557 / 20000000000000000000000000000000), (3 / 6250000000000000000000000000000)⟩ +lemma CA2_4_10I2R6Mass_sound : CA2_4_10I2R6Mass.Encloses (∑ a, CA2_4_10I2R6Value a) := by + exact contains_sound (pairSumBall_sound CA2_4_10I2R6P CA2_4_10I2R6Value CA2_4_10I2R6P_sound) (by decide +kernel) +def CA2_4_10I2R6MassTermLogWitness : LogWitness := ⟨-4, 1843704332429729067184806144557, 1250000000000000000000000000000⟩ +def CA2_4_10I2R6MassTermLog : Ball := ⟨(-238395550160642353212106546222153 / 100000000000000000000000000000000), (21175823787 / 20000000000000000000000000000000)⟩ +lemma CA2_4_10I2R6MassTermLog_sound : CA2_4_10I2R6MassTermLog.Encloses (Real.log ((∑ a, CA2_4_10I2R6Value a))) := by + exact checkLog_sound logTwoBall_sound (CA2_4_10I2R6Mass_sound) (w := CA2_4_10I2R6MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA2_4_10I2R6MassTerm : Ball := ⟨(2197654543315725499556882275933 / 10000000000000000000000000000000), (976048963 / 10000000000000000000000000000000)⟩ +lemma CA2_4_10I2R6MassTerm_sound : CA2_4_10I2R6MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_4_10I2R6Value a))) := by + exact contains_sound (entropyTerm_ball (CA2_4_10I2R6Mass_sound) CA2_4_10I2R6MassTermLog_sound) (by decide +kernel) +def CA2_4_10I2R6H : Ball := ⟨(977086595650568412965726504799 / 100000000000000000000000000000000), (19776780653 / 100000000000000000000000000000000)⟩ +lemma CA2_4_10I2R6H_sound : CA2_4_10I2R6H.Encloses (homogeneousEntropy CA2_4_10I2R6Value) := by + exact contains_sound (homogeneous_enclosed CA2_4_10I2R6Value CA2_4_10I2R6MassTerm_sound CA2_4_10I2R6Entropy_sound) (by decide +kernel) +def CA2_4_10I2R7Value (a : PairSlot) : ℝ := residualLaw (below (shape 2 4 10)) (fun u => (stageALaw (shape 2 4 10) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 7 a +def CA2_4_10I2R7Raw (a : PairSlot) : Ball := residualBall (below (shape 2 4 10)) A2_4_10Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 7 a +lemma CA2_4_10I2R7Raw_sound (a : PairSlot) : + (CA2_4_10I2R7Raw a).Encloses (CA2_4_10I2R7Value a) := by + exact residualBall_sound_on (below (shape 2 4 10)) A2_4_10Law (fun u => (stageALaw (shape 2 4 10) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A2_4_10Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 2 4 10) (show (shape 2 4 10) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 7 a +def CA2_4_10I2R7Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA2_4_10I2R7Certificates_valid : + CA2_4_10I2R7Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_4_10I2R7CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA2_4_10I2R7P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_4_10I2R7Certificates (CA2_4_10I2R7CertificateIndex a)).input +lemma CA2_4_10I2R7P_check : ∀ a : PairSlot, contains (CA2_4_10I2R7Raw a) (CA2_4_10I2R7P a) = true := by + decide +kernel +lemma CA2_4_10I2R7P_sound (a : PairSlot) : + (CA2_4_10I2R7P a).Encloses (CA2_4_10I2R7Value a) := + contains_sound (CA2_4_10I2R7Raw_sound a) (CA2_4_10I2R7P_check a) +def CA2_4_10I2R7Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_4_10I2R7Certificates (CA2_4_10I2R7CertificateIndex a)).output +lemma CA2_4_10I2R7Terms_sound (a : PairSlot) : + (CA2_4_10I2R7Terms a).Encloses (Foundation.entropyTerm (CA2_4_10I2R7Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_4_10I2R7Certificates_valid + (CA2_4_10I2R7CertificateIndex a) (CA2_4_10I2R7P_sound a) +def CA2_4_10I2R7Entropy : Ball := ⟨0, 0⟩ +lemma CA2_4_10I2R7Entropy_sound : CA2_4_10I2R7Entropy.Encloses (Foundation.finiteEntropy CA2_4_10I2R7Value) := by + exact contains_sound (entropyPair_enclosed CA2_4_10I2R7Value CA2_4_10I2R7Terms CA2_4_10I2R7Terms_sound) (by decide +kernel) +def CA2_4_10I2R7Mass : Ball := ⟨0, 0⟩ +lemma CA2_4_10I2R7Mass_sound : CA2_4_10I2R7Mass.Encloses (∑ a, CA2_4_10I2R7Value a) := by + exact contains_sound (pairSumBall_sound CA2_4_10I2R7P CA2_4_10I2R7Value CA2_4_10I2R7P_sound) (by decide +kernel) +def CA2_4_10I2R7MassTerm : Ball := .exact 0 +lemma CA2_4_10I2R7MassTerm_sound : CA2_4_10I2R7MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_4_10I2R7Value a))) := + entropyTerm_zero_ball (CA2_4_10I2R7Mass_sound) +def CA2_4_10I2R7H : Ball := ⟨0, 0⟩ +lemma CA2_4_10I2R7H_sound : CA2_4_10I2R7H.Encloses (homogeneousEntropy CA2_4_10I2R7Value) := by + exact contains_sound (homogeneous_enclosed CA2_4_10I2R7Value CA2_4_10I2R7MassTerm_sound CA2_4_10I2R7Entropy_sound) (by decide +kernel) +def CA2_4_10I2R8Value (a : PairSlot) : ℝ := residualLaw (below (shape 2 4 10)) (fun u => (stageALaw (shape 2 4 10) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 8 a +def CA2_4_10I2R8Raw (a : PairSlot) : Ball := residualBall (below (shape 2 4 10)) A2_4_10Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 8 a +lemma CA2_4_10I2R8Raw_sound (a : PairSlot) : + (CA2_4_10I2R8Raw a).Encloses (CA2_4_10I2R8Value a) := by + exact residualBall_sound_on (below (shape 2 4 10)) A2_4_10Law (fun u => (stageALaw (shape 2 4 10) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A2_4_10Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 2 4 10) (show (shape 2 4 10) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 8 a +def CA2_4_10I2R8Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA2_4_10I2R8Certificates_valid : + CA2_4_10I2R8Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_4_10I2R8CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA2_4_10I2R8P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_4_10I2R8Certificates (CA2_4_10I2R8CertificateIndex a)).input +lemma CA2_4_10I2R8P_check : ∀ a : PairSlot, contains (CA2_4_10I2R8Raw a) (CA2_4_10I2R8P a) = true := by + decide +kernel +lemma CA2_4_10I2R8P_sound (a : PairSlot) : + (CA2_4_10I2R8P a).Encloses (CA2_4_10I2R8Value a) := + contains_sound (CA2_4_10I2R8Raw_sound a) (CA2_4_10I2R8P_check a) +def CA2_4_10I2R8Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_4_10I2R8Certificates (CA2_4_10I2R8CertificateIndex a)).output +lemma CA2_4_10I2R8Terms_sound (a : PairSlot) : + (CA2_4_10I2R8Terms a).Encloses (Foundation.entropyTerm (CA2_4_10I2R8Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_4_10I2R8Certificates_valid + (CA2_4_10I2R8CertificateIndex a) (CA2_4_10I2R8P_sound a) +def CA2_4_10I2R8Entropy : Ball := ⟨0, 0⟩ +lemma CA2_4_10I2R8Entropy_sound : CA2_4_10I2R8Entropy.Encloses (Foundation.finiteEntropy CA2_4_10I2R8Value) := by + exact contains_sound (entropyPair_enclosed CA2_4_10I2R8Value CA2_4_10I2R8Terms CA2_4_10I2R8Terms_sound) (by decide +kernel) +def CA2_4_10I2R8Mass : Ball := ⟨0, 0⟩ +lemma CA2_4_10I2R8Mass_sound : CA2_4_10I2R8Mass.Encloses (∑ a, CA2_4_10I2R8Value a) := by + exact contains_sound (pairSumBall_sound CA2_4_10I2R8P CA2_4_10I2R8Value CA2_4_10I2R8P_sound) (by decide +kernel) +def CA2_4_10I2R8MassTerm : Ball := .exact 0 +lemma CA2_4_10I2R8MassTerm_sound : CA2_4_10I2R8MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_4_10I2R8Value a))) := + entropyTerm_zero_ball (CA2_4_10I2R8Mass_sound) +def CA2_4_10I2R8H : Ball := ⟨0, 0⟩ +lemma CA2_4_10I2R8H_sound : CA2_4_10I2R8H.Encloses (homogeneousEntropy CA2_4_10I2R8Value) := by + exact contains_sound (homogeneous_enclosed CA2_4_10I2R8Value CA2_4_10I2R8MassTerm_sound CA2_4_10I2R8Entropy_sound) (by decide +kernel) +def CA2_4_10I2R9Value (a : PairSlot) : ℝ := residualLaw (below (shape 2 4 10)) (fun u => (stageALaw (shape 2 4 10) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 9 a +def CA2_4_10I2R9Raw (a : PairSlot) : Ball := residualBall (below (shape 2 4 10)) A2_4_10Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 9 a +lemma CA2_4_10I2R9Raw_sound (a : PairSlot) : + (CA2_4_10I2R9Raw a).Encloses (CA2_4_10I2R9Value a) := by + exact residualBall_sound_on (below (shape 2 4 10)) A2_4_10Law (fun u => (stageALaw (shape 2 4 10) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A2_4_10Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 2 4 10) (show (shape 2 4 10) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 9 a +def CA2_4_10I2R9Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA2_4_10I2R9Certificates_valid : + CA2_4_10I2R9Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_4_10I2R9CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA2_4_10I2R9P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_4_10I2R9Certificates (CA2_4_10I2R9CertificateIndex a)).input +lemma CA2_4_10I2R9P_check : ∀ a : PairSlot, contains (CA2_4_10I2R9Raw a) (CA2_4_10I2R9P a) = true := by + decide +kernel +lemma CA2_4_10I2R9P_sound (a : PairSlot) : + (CA2_4_10I2R9P a).Encloses (CA2_4_10I2R9Value a) := + contains_sound (CA2_4_10I2R9Raw_sound a) (CA2_4_10I2R9P_check a) +def CA2_4_10I2R9Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_4_10I2R9Certificates (CA2_4_10I2R9CertificateIndex a)).output +lemma CA2_4_10I2R9Terms_sound (a : PairSlot) : + (CA2_4_10I2R9Terms a).Encloses (Foundation.entropyTerm (CA2_4_10I2R9Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_4_10I2R9Certificates_valid + (CA2_4_10I2R9CertificateIndex a) (CA2_4_10I2R9P_sound a) +def CA2_4_10I2R9Entropy : Ball := ⟨0, 0⟩ +lemma CA2_4_10I2R9Entropy_sound : CA2_4_10I2R9Entropy.Encloses (Foundation.finiteEntropy CA2_4_10I2R9Value) := by + exact contains_sound (entropyPair_enclosed CA2_4_10I2R9Value CA2_4_10I2R9Terms CA2_4_10I2R9Terms_sound) (by decide +kernel) +def CA2_4_10I2R9Mass : Ball := ⟨0, 0⟩ +lemma CA2_4_10I2R9Mass_sound : CA2_4_10I2R9Mass.Encloses (∑ a, CA2_4_10I2R9Value a) := by + exact contains_sound (pairSumBall_sound CA2_4_10I2R9P CA2_4_10I2R9Value CA2_4_10I2R9P_sound) (by decide +kernel) +def CA2_4_10I2R9MassTerm : Ball := .exact 0 +lemma CA2_4_10I2R9MassTerm_sound : CA2_4_10I2R9MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_4_10I2R9Value a))) := + entropyTerm_zero_ball (CA2_4_10I2R9Mass_sound) +def CA2_4_10I2R9H : Ball := ⟨0, 0⟩ +lemma CA2_4_10I2R9H_sound : CA2_4_10I2R9H.Encloses (homogeneousEntropy CA2_4_10I2R9Value) := by + exact contains_sound (homogeneous_enclosed CA2_4_10I2R9Value CA2_4_10I2R9MassTerm_sound CA2_4_10I2R9Entropy_sound) (by decide +kernel) +def CA2_4_10I2R10Value (a : PairSlot) : ℝ := residualLaw (below (shape 2 4 10)) (fun u => (stageALaw (shape 2 4 10) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 10 a +def CA2_4_10I2R10Raw (a : PairSlot) : Ball := residualBall (below (shape 2 4 10)) A2_4_10Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 10 a +lemma CA2_4_10I2R10Raw_sound (a : PairSlot) : + (CA2_4_10I2R10Raw a).Encloses (CA2_4_10I2R10Value a) := by + exact residualBall_sound_on (below (shape 2 4 10)) A2_4_10Law (fun u => (stageALaw (shape 2 4 10) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A2_4_10Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 2 4 10) (show (shape 2 4 10) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 10 a +def CA2_4_10I2R10Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA2_4_10I2R10Certificates_valid : + CA2_4_10I2R10Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_4_10I2R10CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA2_4_10I2R10P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_4_10I2R10Certificates (CA2_4_10I2R10CertificateIndex a)).input +lemma CA2_4_10I2R10P_check : ∀ a : PairSlot, contains (CA2_4_10I2R10Raw a) (CA2_4_10I2R10P a) = true := by + decide +kernel +lemma CA2_4_10I2R10P_sound (a : PairSlot) : + (CA2_4_10I2R10P a).Encloses (CA2_4_10I2R10Value a) := + contains_sound (CA2_4_10I2R10Raw_sound a) (CA2_4_10I2R10P_check a) +def CA2_4_10I2R10Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_4_10I2R10Certificates (CA2_4_10I2R10CertificateIndex a)).output +lemma CA2_4_10I2R10Terms_sound (a : PairSlot) : + (CA2_4_10I2R10Terms a).Encloses (Foundation.entropyTerm (CA2_4_10I2R10Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_4_10I2R10Certificates_valid + (CA2_4_10I2R10CertificateIndex a) (CA2_4_10I2R10P_sound a) +def CA2_4_10I2R10Entropy : Ball := ⟨0, 0⟩ +lemma CA2_4_10I2R10Entropy_sound : CA2_4_10I2R10Entropy.Encloses (Foundation.finiteEntropy CA2_4_10I2R10Value) := by + exact contains_sound (entropyPair_enclosed CA2_4_10I2R10Value CA2_4_10I2R10Terms CA2_4_10I2R10Terms_sound) (by decide +kernel) +def CA2_4_10I2R10Mass : Ball := ⟨0, 0⟩ +lemma CA2_4_10I2R10Mass_sound : CA2_4_10I2R10Mass.Encloses (∑ a, CA2_4_10I2R10Value a) := by + exact contains_sound (pairSumBall_sound CA2_4_10I2R10P CA2_4_10I2R10Value CA2_4_10I2R10P_sound) (by decide +kernel) +def CA2_4_10I2R10MassTerm : Ball := .exact 0 +lemma CA2_4_10I2R10MassTerm_sound : CA2_4_10I2R10MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_4_10I2R10Value a))) := + entropyTerm_zero_ball (CA2_4_10I2R10Mass_sound) +def CA2_4_10I2R10H : Ball := ⟨0, 0⟩ +lemma CA2_4_10I2R10H_sound : CA2_4_10I2R10H.Encloses (homogeneousEntropy CA2_4_10I2R10Value) := by + exact contains_sound (homogeneous_enclosed CA2_4_10I2R10Value CA2_4_10I2R10MassTerm_sound CA2_4_10I2R10Entropy_sound) (by decide +kernel) +def CA2_4_10I2R11Value (a : PairSlot) : ℝ := residualLaw (below (shape 2 4 10)) (fun u => (stageALaw (shape 2 4 10) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 11 a +def CA2_4_10I2R11Raw (a : PairSlot) : Ball := residualBall (below (shape 2 4 10)) A2_4_10Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 11 a +lemma CA2_4_10I2R11Raw_sound (a : PairSlot) : + (CA2_4_10I2R11Raw a).Encloses (CA2_4_10I2R11Value a) := by + exact residualBall_sound_on (below (shape 2 4 10)) A2_4_10Law (fun u => (stageALaw (shape 2 4 10) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A2_4_10Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 2 4 10) (show (shape 2 4 10) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 11 a +def CA2_4_10I2R11Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA2_4_10I2R11Certificates_valid : + CA2_4_10I2R11Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_4_10I2R11CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA2_4_10I2R11P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_4_10I2R11Certificates (CA2_4_10I2R11CertificateIndex a)).input +lemma CA2_4_10I2R11P_check : ∀ a : PairSlot, contains (CA2_4_10I2R11Raw a) (CA2_4_10I2R11P a) = true := by + decide +kernel +lemma CA2_4_10I2R11P_sound (a : PairSlot) : + (CA2_4_10I2R11P a).Encloses (CA2_4_10I2R11Value a) := + contains_sound (CA2_4_10I2R11Raw_sound a) (CA2_4_10I2R11P_check a) +def CA2_4_10I2R11Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_4_10I2R11Certificates (CA2_4_10I2R11CertificateIndex a)).output +lemma CA2_4_10I2R11Terms_sound (a : PairSlot) : + (CA2_4_10I2R11Terms a).Encloses (Foundation.entropyTerm (CA2_4_10I2R11Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_4_10I2R11Certificates_valid + (CA2_4_10I2R11CertificateIndex a) (CA2_4_10I2R11P_sound a) +def CA2_4_10I2R11Entropy : Ball := ⟨0, 0⟩ +lemma CA2_4_10I2R11Entropy_sound : CA2_4_10I2R11Entropy.Encloses (Foundation.finiteEntropy CA2_4_10I2R11Value) := by + exact contains_sound (entropyPair_enclosed CA2_4_10I2R11Value CA2_4_10I2R11Terms CA2_4_10I2R11Terms_sound) (by decide +kernel) +def CA2_4_10I2R11Mass : Ball := ⟨0, 0⟩ +lemma CA2_4_10I2R11Mass_sound : CA2_4_10I2R11Mass.Encloses (∑ a, CA2_4_10I2R11Value a) := by + exact contains_sound (pairSumBall_sound CA2_4_10I2R11P CA2_4_10I2R11Value CA2_4_10I2R11P_sound) (by decide +kernel) +def CA2_4_10I2R11MassTerm : Ball := .exact 0 +lemma CA2_4_10I2R11MassTerm_sound : CA2_4_10I2R11MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_4_10I2R11Value a))) := + entropyTerm_zero_ball (CA2_4_10I2R11Mass_sound) +def CA2_4_10I2R11H : Ball := ⟨0, 0⟩ +lemma CA2_4_10I2R11H_sound : CA2_4_10I2R11H.Encloses (homogeneousEntropy CA2_4_10I2R11Value) := by + exact contains_sound (homogeneous_enclosed CA2_4_10I2R11Value CA2_4_10I2R11MassTerm_sound CA2_4_10I2R11Entropy_sound) (by decide +kernel) +def CA2_4_10I2R12Value (a : PairSlot) : ℝ := residualLaw (below (shape 2 4 10)) (fun u => (stageALaw (shape 2 4 10) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 12 a +def CA2_4_10I2R12Raw (a : PairSlot) : Ball := residualBall (below (shape 2 4 10)) A2_4_10Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 12 a +lemma CA2_4_10I2R12Raw_sound (a : PairSlot) : + (CA2_4_10I2R12Raw a).Encloses (CA2_4_10I2R12Value a) := by + exact residualBall_sound_on (below (shape 2 4 10)) A2_4_10Law (fun u => (stageALaw (shape 2 4 10) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A2_4_10Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 2 4 10) (show (shape 2 4 10) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 12 a +def CA2_4_10I2R12Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA2_4_10I2R12Certificates_valid : + CA2_4_10I2R12Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_4_10I2R12CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA2_4_10I2R12P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_4_10I2R12Certificates (CA2_4_10I2R12CertificateIndex a)).input +lemma CA2_4_10I2R12P_check : ∀ a : PairSlot, contains (CA2_4_10I2R12Raw a) (CA2_4_10I2R12P a) = true := by + decide +kernel +lemma CA2_4_10I2R12P_sound (a : PairSlot) : + (CA2_4_10I2R12P a).Encloses (CA2_4_10I2R12Value a) := + contains_sound (CA2_4_10I2R12Raw_sound a) (CA2_4_10I2R12P_check a) +def CA2_4_10I2R12Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_4_10I2R12Certificates (CA2_4_10I2R12CertificateIndex a)).output +lemma CA2_4_10I2R12Terms_sound (a : PairSlot) : + (CA2_4_10I2R12Terms a).Encloses (Foundation.entropyTerm (CA2_4_10I2R12Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_4_10I2R12Certificates_valid + (CA2_4_10I2R12CertificateIndex a) (CA2_4_10I2R12P_sound a) +def CA2_4_10I2R12Entropy : Ball := ⟨0, 0⟩ +lemma CA2_4_10I2R12Entropy_sound : CA2_4_10I2R12Entropy.Encloses (Foundation.finiteEntropy CA2_4_10I2R12Value) := by + exact contains_sound (entropyPair_enclosed CA2_4_10I2R12Value CA2_4_10I2R12Terms CA2_4_10I2R12Terms_sound) (by decide +kernel) +def CA2_4_10I2R12Mass : Ball := ⟨0, 0⟩ +lemma CA2_4_10I2R12Mass_sound : CA2_4_10I2R12Mass.Encloses (∑ a, CA2_4_10I2R12Value a) := by + exact contains_sound (pairSumBall_sound CA2_4_10I2R12P CA2_4_10I2R12Value CA2_4_10I2R12P_sound) (by decide +kernel) +def CA2_4_10I2R12MassTerm : Ball := .exact 0 +lemma CA2_4_10I2R12MassTerm_sound : CA2_4_10I2R12MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_4_10I2R12Value a))) := + entropyTerm_zero_ball (CA2_4_10I2R12Mass_sound) +def CA2_4_10I2R12H : Ball := ⟨0, 0⟩ +lemma CA2_4_10I2R12H_sound : CA2_4_10I2R12H.Encloses (homogeneousEntropy CA2_4_10I2R12Value) := by + exact contains_sound (homogeneous_enclosed CA2_4_10I2R12Value CA2_4_10I2R12MassTerm_sound CA2_4_10I2R12Entropy_sound) (by decide +kernel) +def CA2_4_10I2R13Value (a : PairSlot) : ℝ := residualLaw (below (shape 2 4 10)) (fun u => (stageALaw (shape 2 4 10) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 13 a +def CA2_4_10I2R13Raw (a : PairSlot) : Ball := residualBall (below (shape 2 4 10)) A2_4_10Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 13 a +lemma CA2_4_10I2R13Raw_sound (a : PairSlot) : + (CA2_4_10I2R13Raw a).Encloses (CA2_4_10I2R13Value a) := by + exact residualBall_sound_on (below (shape 2 4 10)) A2_4_10Law (fun u => (stageALaw (shape 2 4 10) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A2_4_10Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 2 4 10) (show (shape 2 4 10) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 13 a +def CA2_4_10I2R13Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA2_4_10I2R13Certificates_valid : + CA2_4_10I2R13Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_4_10I2R13CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA2_4_10I2R13P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_4_10I2R13Certificates (CA2_4_10I2R13CertificateIndex a)).input +lemma CA2_4_10I2R13P_check : ∀ a : PairSlot, contains (CA2_4_10I2R13Raw a) (CA2_4_10I2R13P a) = true := by + decide +kernel +lemma CA2_4_10I2R13P_sound (a : PairSlot) : + (CA2_4_10I2R13P a).Encloses (CA2_4_10I2R13Value a) := + contains_sound (CA2_4_10I2R13Raw_sound a) (CA2_4_10I2R13P_check a) +def CA2_4_10I2R13Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_4_10I2R13Certificates (CA2_4_10I2R13CertificateIndex a)).output +lemma CA2_4_10I2R13Terms_sound (a : PairSlot) : + (CA2_4_10I2R13Terms a).Encloses (Foundation.entropyTerm (CA2_4_10I2R13Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_4_10I2R13Certificates_valid + (CA2_4_10I2R13CertificateIndex a) (CA2_4_10I2R13P_sound a) +def CA2_4_10I2R13Entropy : Ball := ⟨0, 0⟩ +lemma CA2_4_10I2R13Entropy_sound : CA2_4_10I2R13Entropy.Encloses (Foundation.finiteEntropy CA2_4_10I2R13Value) := by + exact contains_sound (entropyPair_enclosed CA2_4_10I2R13Value CA2_4_10I2R13Terms CA2_4_10I2R13Terms_sound) (by decide +kernel) +def CA2_4_10I2R13Mass : Ball := ⟨0, 0⟩ +lemma CA2_4_10I2R13Mass_sound : CA2_4_10I2R13Mass.Encloses (∑ a, CA2_4_10I2R13Value a) := by + exact contains_sound (pairSumBall_sound CA2_4_10I2R13P CA2_4_10I2R13Value CA2_4_10I2R13P_sound) (by decide +kernel) +def CA2_4_10I2R13MassTerm : Ball := .exact 0 +lemma CA2_4_10I2R13MassTerm_sound : CA2_4_10I2R13MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_4_10I2R13Value a))) := + entropyTerm_zero_ball (CA2_4_10I2R13Mass_sound) +def CA2_4_10I2R13H : Ball := ⟨0, 0⟩ +lemma CA2_4_10I2R13H_sound : CA2_4_10I2R13H.Encloses (homogeneousEntropy CA2_4_10I2R13Value) := by + exact contains_sound (homogeneous_enclosed CA2_4_10I2R13Value CA2_4_10I2R13MassTerm_sound CA2_4_10I2R13Entropy_sound) (by decide +kernel) +def CA2_4_10I2R14Value (a : PairSlot) : ℝ := residualLaw (below (shape 2 4 10)) (fun u => (stageALaw (shape 2 4 10) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 14 a +def CA2_4_10I2R14Raw (a : PairSlot) : Ball := residualBall (below (shape 2 4 10)) A2_4_10Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 14 a +lemma CA2_4_10I2R14Raw_sound (a : PairSlot) : + (CA2_4_10I2R14Raw a).Encloses (CA2_4_10I2R14Value a) := by + exact residualBall_sound_on (below (shape 2 4 10)) A2_4_10Law (fun u => (stageALaw (shape 2 4 10) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A2_4_10Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 2 4 10) (show (shape 2 4 10) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 14 a +def CA2_4_10I2R14Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA2_4_10I2R14Certificates_valid : + CA2_4_10I2R14Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_4_10I2R14CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA2_4_10I2R14P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_4_10I2R14Certificates (CA2_4_10I2R14CertificateIndex a)).input +lemma CA2_4_10I2R14P_check : ∀ a : PairSlot, contains (CA2_4_10I2R14Raw a) (CA2_4_10I2R14P a) = true := by + decide +kernel +lemma CA2_4_10I2R14P_sound (a : PairSlot) : + (CA2_4_10I2R14P a).Encloses (CA2_4_10I2R14Value a) := + contains_sound (CA2_4_10I2R14Raw_sound a) (CA2_4_10I2R14P_check a) +def CA2_4_10I2R14Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_4_10I2R14Certificates (CA2_4_10I2R14CertificateIndex a)).output +lemma CA2_4_10I2R14Terms_sound (a : PairSlot) : + (CA2_4_10I2R14Terms a).Encloses (Foundation.entropyTerm (CA2_4_10I2R14Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_4_10I2R14Certificates_valid + (CA2_4_10I2R14CertificateIndex a) (CA2_4_10I2R14P_sound a) +def CA2_4_10I2R14Entropy : Ball := ⟨0, 0⟩ +lemma CA2_4_10I2R14Entropy_sound : CA2_4_10I2R14Entropy.Encloses (Foundation.finiteEntropy CA2_4_10I2R14Value) := by + exact contains_sound (entropyPair_enclosed CA2_4_10I2R14Value CA2_4_10I2R14Terms CA2_4_10I2R14Terms_sound) (by decide +kernel) +def CA2_4_10I2R14Mass : Ball := ⟨0, 0⟩ +lemma CA2_4_10I2R14Mass_sound : CA2_4_10I2R14Mass.Encloses (∑ a, CA2_4_10I2R14Value a) := by + exact contains_sound (pairSumBall_sound CA2_4_10I2R14P CA2_4_10I2R14Value CA2_4_10I2R14P_sound) (by decide +kernel) +def CA2_4_10I2R14MassTerm : Ball := .exact 0 +lemma CA2_4_10I2R14MassTerm_sound : CA2_4_10I2R14MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_4_10I2R14Value a))) := + entropyTerm_zero_ball (CA2_4_10I2R14Mass_sound) +def CA2_4_10I2R14H : Ball := ⟨0, 0⟩ +lemma CA2_4_10I2R14H_sound : CA2_4_10I2R14H.Encloses (homogeneousEntropy CA2_4_10I2R14Value) := by + exact contains_sound (homogeneous_enclosed CA2_4_10I2R14Value CA2_4_10I2R14MassTerm_sound CA2_4_10I2R14Entropy_sound) (by decide +kernel) +def CA2_4_10I2R15Value (a : PairSlot) : ℝ := residualLaw (below (shape 2 4 10)) (fun u => (stageALaw (shape 2 4 10) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 15 a +def CA2_4_10I2R15Raw (a : PairSlot) : Ball := residualBall (below (shape 2 4 10)) A2_4_10Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 15 a +lemma CA2_4_10I2R15Raw_sound (a : PairSlot) : + (CA2_4_10I2R15Raw a).Encloses (CA2_4_10I2R15Value a) := by + exact residualBall_sound_on (below (shape 2 4 10)) A2_4_10Law (fun u => (stageALaw (shape 2 4 10) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A2_4_10Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 2 4 10) (show (shape 2 4 10) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 15 a +def CA2_4_10I2R15Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA2_4_10I2R15Certificates_valid : + CA2_4_10I2R15Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_4_10I2R15CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA2_4_10I2R15P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_4_10I2R15Certificates (CA2_4_10I2R15CertificateIndex a)).input +lemma CA2_4_10I2R15P_check : ∀ a : PairSlot, contains (CA2_4_10I2R15Raw a) (CA2_4_10I2R15P a) = true := by + decide +kernel +lemma CA2_4_10I2R15P_sound (a : PairSlot) : + (CA2_4_10I2R15P a).Encloses (CA2_4_10I2R15Value a) := + contains_sound (CA2_4_10I2R15Raw_sound a) (CA2_4_10I2R15P_check a) +def CA2_4_10I2R15Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_4_10I2R15Certificates (CA2_4_10I2R15CertificateIndex a)).output +lemma CA2_4_10I2R15Terms_sound (a : PairSlot) : + (CA2_4_10I2R15Terms a).Encloses (Foundation.entropyTerm (CA2_4_10I2R15Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_4_10I2R15Certificates_valid + (CA2_4_10I2R15CertificateIndex a) (CA2_4_10I2R15P_sound a) +def CA2_4_10I2R15Entropy : Ball := ⟨0, 0⟩ +lemma CA2_4_10I2R15Entropy_sound : CA2_4_10I2R15Entropy.Encloses (Foundation.finiteEntropy CA2_4_10I2R15Value) := by + exact contains_sound (entropyPair_enclosed CA2_4_10I2R15Value CA2_4_10I2R15Terms CA2_4_10I2R15Terms_sound) (by decide +kernel) +def CA2_4_10I2R15Mass : Ball := ⟨0, 0⟩ +lemma CA2_4_10I2R15Mass_sound : CA2_4_10I2R15Mass.Encloses (∑ a, CA2_4_10I2R15Value a) := by + exact contains_sound (pairSumBall_sound CA2_4_10I2R15P CA2_4_10I2R15Value CA2_4_10I2R15P_sound) (by decide +kernel) +def CA2_4_10I2R15MassTerm : Ball := .exact 0 +lemma CA2_4_10I2R15MassTerm_sound : CA2_4_10I2R15MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_4_10I2R15Value a))) := + entropyTerm_zero_ball (CA2_4_10I2R15Mass_sound) +def CA2_4_10I2R15H : Ball := ⟨0, 0⟩ +lemma CA2_4_10I2R15H_sound : CA2_4_10I2R15H.Encloses (homogeneousEntropy CA2_4_10I2R15Value) := by + exact contains_sound (homogeneous_enclosed CA2_4_10I2R15Value CA2_4_10I2R15MassTerm_sound CA2_4_10I2R15Entropy_sound) (by decide +kernel) +def CA2_4_10I2R16Value (a : PairSlot) : ℝ := residualLaw (below (shape 2 4 10)) (fun u => (stageALaw (shape 2 4 10) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 16 a +def CA2_4_10I2R16Raw (a : PairSlot) : Ball := residualBall (below (shape 2 4 10)) A2_4_10Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 16 a +lemma CA2_4_10I2R16Raw_sound (a : PairSlot) : + (CA2_4_10I2R16Raw a).Encloses (CA2_4_10I2R16Value a) := by + exact residualBall_sound_on (below (shape 2 4 10)) A2_4_10Law (fun u => (stageALaw (shape 2 4 10) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A2_4_10Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 2 4 10) (show (shape 2 4 10) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 16 a +def CA2_4_10I2R16Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA2_4_10I2R16Certificates_valid : + CA2_4_10I2R16Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_4_10I2R16CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA2_4_10I2R16P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_4_10I2R16Certificates (CA2_4_10I2R16CertificateIndex a)).input +lemma CA2_4_10I2R16P_check : ∀ a : PairSlot, contains (CA2_4_10I2R16Raw a) (CA2_4_10I2R16P a) = true := by + decide +kernel +lemma CA2_4_10I2R16P_sound (a : PairSlot) : + (CA2_4_10I2R16P a).Encloses (CA2_4_10I2R16Value a) := + contains_sound (CA2_4_10I2R16Raw_sound a) (CA2_4_10I2R16P_check a) +def CA2_4_10I2R16Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_4_10I2R16Certificates (CA2_4_10I2R16CertificateIndex a)).output +lemma CA2_4_10I2R16Terms_sound (a : PairSlot) : + (CA2_4_10I2R16Terms a).Encloses (Foundation.entropyTerm (CA2_4_10I2R16Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_4_10I2R16Certificates_valid + (CA2_4_10I2R16CertificateIndex a) (CA2_4_10I2R16P_sound a) +def CA2_4_10I2R16Entropy : Ball := ⟨0, 0⟩ +lemma CA2_4_10I2R16Entropy_sound : CA2_4_10I2R16Entropy.Encloses (Foundation.finiteEntropy CA2_4_10I2R16Value) := by + exact contains_sound (entropyPair_enclosed CA2_4_10I2R16Value CA2_4_10I2R16Terms CA2_4_10I2R16Terms_sound) (by decide +kernel) +def CA2_4_10I2R16Mass : Ball := ⟨0, 0⟩ +lemma CA2_4_10I2R16Mass_sound : CA2_4_10I2R16Mass.Encloses (∑ a, CA2_4_10I2R16Value a) := by + exact contains_sound (pairSumBall_sound CA2_4_10I2R16P CA2_4_10I2R16Value CA2_4_10I2R16P_sound) (by decide +kernel) +def CA2_4_10I2R16MassTerm : Ball := .exact 0 +lemma CA2_4_10I2R16MassTerm_sound : CA2_4_10I2R16MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_4_10I2R16Value a))) := + entropyTerm_zero_ball (CA2_4_10I2R16Mass_sound) +def CA2_4_10I2R16H : Ball := ⟨0, 0⟩ +lemma CA2_4_10I2R16H_sound : CA2_4_10I2R16H.Encloses (homogeneousEntropy CA2_4_10I2R16Value) := by + exact contains_sound (homogeneous_enclosed CA2_4_10I2R16Value CA2_4_10I2R16MassTerm_sound CA2_4_10I2R16Entropy_sound) (by decide +kernel) +def CA2_4_10I2ResidualEntropies (a : Fin 17) : Ball := + match a.val with + | 0 => CA2_4_10I2R0H + | 1 => CA2_4_10I2R1H + | 2 => CA2_4_10I2R2H + | 3 => CA2_4_10I2R3H + | 4 => CA2_4_10I2R4H + | 5 => CA2_4_10I2R5H + | 6 => CA2_4_10I2R6H + | 7 => CA2_4_10I2R7H + | 8 => CA2_4_10I2R8H + | 9 => CA2_4_10I2R9H + | 10 => CA2_4_10I2R10H + | 11 => CA2_4_10I2R11H + | 12 => CA2_4_10I2R12H + | 13 => CA2_4_10I2R13H + | 14 => CA2_4_10I2R14H + | 15 => CA2_4_10I2R15H + | 16 => CA2_4_10I2R16H + | _ => (.exact 0) +lemma CA2_4_10I2ResidualEntropies_sound (k : Fin 17) : + (CA2_4_10I2ResidualEntropies k).Encloses (homogeneousEntropy + (residualLaw (below (shape 2 4 10)) (fun u => (stageALaw (shape 2 4 10) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) k)) := by + fin_cases k + · exact CA2_4_10I2R0H_sound + · exact CA2_4_10I2R1H_sound + · exact CA2_4_10I2R2H_sound + · exact CA2_4_10I2R3H_sound + · exact CA2_4_10I2R4H_sound + · exact CA2_4_10I2R5H_sound + · exact CA2_4_10I2R6H_sound + · exact CA2_4_10I2R7H_sound + · exact CA2_4_10I2R8H_sound + · exact CA2_4_10I2R9H_sound + · exact CA2_4_10I2R10H_sound + · exact CA2_4_10I2R11H_sound + · exact CA2_4_10I2R12H_sound + · exact CA2_4_10I2R13H_sound + · exact CA2_4_10I2R14H_sound + · exact CA2_4_10I2R15H_sound + · exact CA2_4_10I2R16H_sound +def CA2_4_10I2Singles (s : Shape) : Ball := + match s 0, s 1, s 2 with + | 0, 0, 8 => Z0_0_8H2H + | 0, 1, 7 => Z0_1_7H2H + | 0, 2, 6 => Z0_2_6H2H + | 0, 3, 5 => Z0_3_5H2H + | 0, 4, 4 => Z0_4_4H2H + | 1, 0, 7 => Z1_0_7H2H + | 2, 0, 6 => Z2_0_6H2H + | _, _, _ => (.exact 0) +lemma CA2_4_10I2Singles_sound (u : Shape) (hu : u ∈ below (shape 2 4 10)) + (hd : designated (Equiv.refl (Fin 3)) 2 u) : + (CA2_4_10I2Singles u).Encloses (homogeneousEntropy ((fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) u)) := by + rw [A2_4_10_below] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl + · exact Z0_0_8H2H_sound + · exact Z0_1_7H2H_sound + · exact Z0_2_6H2H_sound + · exact Z0_3_5H2H_sound + · exact Z0_4_4H2H_sound + · exact Z1_0_7H2H_sound + · exact (show ¬ designated (Equiv.refl (Fin 3)) 2 (shape 1 1 6) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 2 (shape 1 2 5) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 2 (shape 1 3 4) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 2 (shape 1 4 3) by decide +kernel) hd |>.elim + · exact Z2_0_6H2H_sound + · exact (show ¬ designated (Equiv.refl (Fin 3)) 2 (shape 2 1 5) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 2 (shape 2 2 4) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 2 (shape 2 3 3) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 2 (shape 2 4 2) by decide +kernel) hd |>.elim +def CA2_4_10I2Singleton : Ball := ⟨(16222574466090492566167298681711 / 50000000000000000000000000000000), (27623665329 / 100000000000000000000000000000000)⟩ +lemma CA2_4_10I2Singleton_sound : CA2_4_10I2Singleton.Encloses + (singletonEntropy (below (shape 2 4 10)) (fun u => (stageALaw (shape 2 4 10) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ))) := by + exact contains_sound (singletonBall_sound (below (shape 2 4 10)) A2_4_10Law (fun u => (stageALaw (shape 2 4 10) u : ℝ)) (Equiv.refl (Fin 3)) 2 + CA2_4_10I2Singles (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A2_4_10Law_sound u) CA2_4_10I2Singles_sound) (by decide +kernel) +def CA2_4_10I2Group : Ball := ⟨(10815853413606162866468887861101 / 12500000000000000000000000000000), (75679181287 / 50000000000000000000000000000000)⟩ +lemma CA2_4_10I2Group_sound : CA2_4_10I2Group.Encloses + (groupedEntropy (below (shape 2 4 10)) (fun u => (stageALaw (shape 2 4 10) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ))) := by + exact contains_sound (Ball.add_sound CA2_4_10I2Singleton_sound + (finSumBall_sound 17 CA2_4_10I2ResidualEntropies _ CA2_4_10I2ResidualEntropies_sound)) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CA2_4_10I2H : Ball := ⟨(114361613035409002036379178824189 / 100000000000000000000000000000000), (472233660579 / 100000000000000000000000000000000)⟩ +lemma CA2_4_10I2_sound : CA2_4_10I2H.Encloses (stageACapacity (shape 2 4 10) 2) := by + have hb := contains_sound (Ball.add_sound CA2_4_10I2PairH_sound + (Ball.neg_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) CA2_4_10I2Group_sound))) + (show contains (.add CA2_4_10I2PairH (.neg (.mul (.exact 2) CA2_4_10I2Group))) CA2_4_10I2H = true by decide +kernel) + unfold CA2_4_10I2PairValue at hb + simpa only [stageACapacity, nativeCapacity, + show (2 : Fin 3) ≠ 0 by decide, ite_false, sub_eq_add_neg] using hb + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA2_4_10I2Pair.lean b/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA2_4_10I2Pair.lean new file mode 100644 index 0000000000000000000000000000000000000000..f1cc68b4d6155562a6ae45757047a6505172cc60 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA2_4_10I2Pair.lean @@ -0,0 +1,324 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Certificates.SupportedContraction + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CA2_4_10I2PairValue (a : PairSlot × PairSlot) : ℝ := pairLaw (below (shape 2 4 10)) (shape 2 4 10) (fun u => (stageALaw (shape 2 4 10) u : ℝ)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) a +def CA2_4_10I2PairRaw (a : PairSlot × PairSlot) : Ball := stageAPairBall (shape 2 4 10) A2_4_10Law 2 a +lemma CA2_4_10I2PairRaw_sound (a : PairSlot × PairSlot) : + (CA2_4_10I2PairRaw a).Encloses (CA2_4_10I2PairValue a) := by + exact stageAPairBall_sound (shape 2 4 10) (by decide +kernel) A2_4_10Law (fun u => (stageALaw (shape 2 4 10) u : ℝ)) (fun u _ => A2_4_10Law_sound u) 2 a +def CA2_4_10I2PairCertificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(108119627934249078776977417 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(5341606149681540320740204679 / 100000000000000000000000000000000), (1740051 / 100000000000000000000000000000000)⟩ ⟨(-1235114810265980979972407199390463 / 100000000000000000000000000000000), (402340881201 / 100000000000000000000000000000000)⟩ ⟨-18, 108119627934249078776977417, 95367431640625000000000000⟩, + .log ⟨(43499240461398851725860779 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(318587072713131070978388603 / 50000000000000000000000000000000), (211877 / 100000000000000000000000000000000)⟩ ⟨(-1464793726666766377904242428224319 / 100000000000000000000000000000000), (487046243599 / 100000000000000000000000000000000)⟩ ⟨-22, 43499240461398851725860779, 23841857910156250000000000⟩, + .log ⟨(1272072156411299444786029 / 78125000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(224402040018928237480642147 / 1250000000000000000000000000000), (2930771 / 50000000000000000000000000000000)⟩ ⟨(-1102541819699122984308435758302303 / 100000000000000000000000000000000), (179994532013 / 50000000000000000000000000000000)⟩ ⟨-16, 1272072156411299444786029, 1192092895507812500000000⟩, + .log ⟨(5101330045191344185451166313 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(50418608647721689476468540999 / 100000000000000000000000000000000), (1728399 / 10000000000000000000000000000000)⟩ ⟨(-24708560415164509185341441232661 / 2500000000000000000000000000000), (33881319853 / 10000000000000000000000000000000)⟩ ⟨-15, 5101330045191344185451166313, 3051757812500000000000000000⟩, + .log ⟨(7153688662319837610093422047 / 4000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ ⟨(282857811861241144367228358159 / 25000000000000000000000000000000), (104146113 / 25000000000000000000000000000000)⟩ ⟨(-63264215195971797464681137564517 / 10000000000000000000000000000000), (232934061631 / 100000000000000000000000000000000)⟩ ⟨-10, 7153688662319837610093422047, 3906250000000000000000000000⟩, + .log ⟨(5425918373524869317561131251 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(49530990249135224669818147139 / 50000000000000000000000000000000), (17234749 / 50000000000000000000000000000000)⟩ ⟨(-912859111386855124029108826219213 / 100000000000000000000000000000000), (15881868223 / 5000000000000000000000000000000)⟩ ⟨-14, 5425918373524869317561131251, 3051757812500000000000000000⟩, + .log ⟨(41252104697739760742166491 / 3125000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(7415638535059611645303703193 / 50000000000000000000000000000000), (1006329 / 20000000000000000000000000000000)⟩ ⟨(-561762135334903366116551180592311 / 50000000000000000000000000000000), (381164902047 / 100000000000000000000000000000000)⟩ ⟨-17, 41252104697739760742166491, 23841857910156250000000000⟩, + .log ⟨(52277522944504399084799748089 / 25000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ ⟨(40319461690861601311012512411 / 3125000000000000000000000000000), (221403933 / 50000000000000000000000000000000)⟩ ⟨(-308503229838667234646560817641541 / 50000000000000000000000000000000), (26469779783 / 12500000000000000000000000000000)⟩ ⟨-9, 52277522944504399084799748089, 48828125000000000000000000000⟩, + .log ⟨(1848578422152396440395254973927 / 100000000000000000000000000000000), (17 / 100000000000000000000000000000000)⟩ ⟨(7377220369639786078491440309453 / 100000000000000000000000000000000), (2740162037 / 100000000000000000000000000000000)⟩ ⟨(-49884415784279406992029657488389 / 12500000000000000000000000000000), (1482307667 / 1000000000000000000000000000000)⟩ ⟨-6, 1848578422152396440395254973927, 1562500000000000000000000000000⟩, + .log ⟨(3780488634272360579419455831 / 4000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ ⟨(164550407659450428728644315553 / 25000000000000000000000000000000), (240164899 / 100000000000000000000000000000000)⟩ ⟨(-348209818524947006068992824569973 / 50000000000000000000000000000000), (31763735789 / 12500000000000000000000000000000)⟩ ⟨-11, 3780488634272360579419455831, 1953125000000000000000000000⟩, + .log ⟨(9281629946511335229955979823 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(21544724307133178863036974377 / 25000000000000000000000000000000), (5896387 / 20000000000000000000000000000000)⟩ ⟨(-928488829280729707749864361346569 / 100000000000000000000000000000000), (317637366019 / 100000000000000000000000000000000)⟩ ⟨-14, 9281629946511335229955979823, 6103515625000000000000000000⟩, + .log ⟨(106230161160827278471292357 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(1461203586732699979463499139 / 100000000000000000000000000000000), (472413 / 100000000000000000000000000000000)⟩ ⟨(-1375507267206823753604136253829767 / 100000000000000000000000000000000), (222346619347 / 50000000000000000000000000000000)⟩ ⟨-20, 106230161160827278471292357, 95367431640625000000000000⟩, + .log ⟨(2058648750590352882636464579 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(28694052687994667586617919123 / 20000000000000000000000000000000), (48824823 / 100000000000000000000000000000000)⟩ ⟨(-871143410203117312149753332497077 / 100000000000000000000000000000000), (296461537633 / 100000000000000000000000000000000)⟩ ⟨-13, 2058648750590352882636464579, 1525878906250000000000000000⟩, + .log ⟨(36131313410556833444675506433 / 25000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ ⟨(94511873487733181650078609327 / 10000000000000000000000000000000), (168324279 / 50000000000000000000000000000000)⟩ ⟨(-130789424139946623571494412292307 / 20000000000000000000000000000000), (29116757737 / 12500000000000000000000000000000)⟩ ⟨-10, 36131313410556833444675506433, 24414062500000000000000000000⟩, + .log ⟨(7395111491346702148149037607 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(35171543274682728098645490541 / 50000000000000000000000000000000), (1468103 / 6250000000000000000000000000000)⟩ ⟨(-118901328654200388228325531571159 / 12500000000000000000000000000000), (317637368767 / 100000000000000000000000000000000)⟩ ⟨-14, 7395111491346702148149037607, 6103515625000000000000000000⟩, + .log ⟨(753267576575704326046657709 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(4442870178768066264509792171 / 50000000000000000000000000000000), (606143 / 20000000000000000000000000000000)⟩ ⟨(-294906505797382631611682016877563 / 25000000000000000000000000000000), (100585195683 / 25000000000000000000000000000000)⟩ ⟨-18, 753267576575704326046657709, 381469726562500000000000000⟩, + .log ⟨(2622450649824599874471237341 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(51692011363562458424530491197 / 100000000000000000000000000000000), (4442607 / 25000000000000000000000000000000)⟩ ⟨(-985566904128774160126790389928983 / 100000000000000000000000000000000), (169406598997 / 50000000000000000000000000000000)⟩ ⟨-15, 2622450649824599874471237341, 1525878906250000000000000000⟩, + .log ⟨(1246628730077965879316887199187 / 100000000000000000000000000000000), (1 / 10000000000000000000000000000000)⟩ ⟨(2733063509198219280683510717221 / 50000000000000000000000000000000), (2111871269 / 100000000000000000000000000000000)⟩ ⟨(-219236364705575951322606746681101 / 50000000000000000000000000000000), (84703295133 / 50000000000000000000000000000000)⟩ ⟨-7, 1246628730077965879316887199187, 781250000000000000000000000000⟩, + .log ⟨(6128649116173515092787676655851 / 50000000000000000000000000000000), (73 / 100000000000000000000000000000000)⟩ ⟨(12864332667914344416043016065971 / 50000000000000000000000000000000), (12977919537 / 100000000000000000000000000000000)⟩ ⟨(-209904865233112291533707925789433 / 100000000000000000000000000000000), (10587911901 / 10000000000000000000000000000000)⟩ ⟨-4, 6128649116173515092787676655851, 3125000000000000000000000000000⟩, + .log ⟨(312851981745174365667198133311 / 50000000000000000000000000000000), (1 / 20000000000000000000000000000000)⟩ ⟨(1587426005900488946015424235381 / 50000000000000000000000000000000), (74530109 / 6250000000000000000000000000000)⟩ ⟨(-101480962149920883265700808226073 / 20000000000000000000000000000000), (95291206973 / 50000000000000000000000000000000)⟩ ⟨-8, 312851981745174365667198133311, 195312500000000000000000000000⟩, + .log ⟨(6890972403192746751410533651 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(112962592838052260905059646001 / 50000000000000000000000000000000), (37939729 / 50000000000000000000000000000000)⟩ ⟨(-409820944812208511010335324029441 / 50000000000000000000000000000000), (137642855753 / 50000000000000000000000000000000)⟩ ⟨-12, 6890972403192746751410533651, 6103515625000000000000000000⟩, + .log ⟨(165396220548973585073238177 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(7890089389923995910346527093 / 100000000000000000000000000000000), (2661839 / 100000000000000000000000000000000)⟩ ⟨(-1192604245087292017674464867816003 / 100000000000000000000000000000000), (402340801129 / 100000000000000000000000000000000)⟩ ⟨-18, 165396220548973585073238177, 95367431640625000000000000⟩, + .log ⟨(23281726775604131279761692301 / 12500000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ ⟨(1170757043156758157398049443171 / 100000000000000000000000000000000), (108462147 / 25000000000000000000000000000000)⟩ ⟨(-628581512896812664087916473323373 / 100000000000000000000000000000000), (232934061587 / 100000000000000000000000000000000)⟩ ⟨-10, 23281726775604131279761692301, 12207031250000000000000000000⟩, + .log ⟨(3707218682379846327949756069 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(14101513041513379419233600539 / 20000000000000000000000000000000), (11775517 / 50000000000000000000000000000000)⟩ ⟨(-950949637024172216641741372993057 / 100000000000000000000000000000000), (79409342183 / 25000000000000000000000000000000)⟩ ⟨-14, 3707218682379846327949756069, 3051757812500000000000000000⟩, + .log ⟨(2450508355771933046641360175817 / 20000000000000000000000000000000), (17 / 25000000000000000000000000000000)⟩ ⟨(1028937473561660457012943415179 / 4000000000000000000000000000000), (1297288343 / 10000000000000000000000000000000)⟩ ⟨(-209943677836906524503866157511149 / 100000000000000000000000000000000), (10587911897 / 10000000000000000000000000000000)⟩ ⟨-4, 2450508355771933046641360175817, 1250000000000000000000000000000⟩, + .log ⟨(628727612435055743783097625249 / 100000000000000000000000000000000), (1 / 20000000000000000000000000000000)⟩ ⟨(3187163209068005455953765077897 / 100000000000000000000000000000000), (1198244287 / 100000000000000000000000000000000)⟩ ⟨(-253461367532766238721259733786539 / 50000000000000000000000000000000), (95291206971 / 50000000000000000000000000000000)⟩ ⟨-8, 628727612435055743783097625249, 390625000000000000000000000000⟩, + .log ⟨(15075497582860872204216600957 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(244425299703337488029761716651 / 100000000000000000000000000000000), (8300139 / 10000000000000000000000000000000)⟩ ⟨(-202667688379670201505467732940423 / 25000000000000000000000000000000), (55057142239 / 20000000000000000000000000000000)⟩ ⟨-12, 15075497582860872204216600957, 12207031250000000000000000000⟩] +lemma CA2_4_10I2PairCertificates_valid : + CA2_4_10I2PairCertificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_4_10I2PairCertificateIndex (a : PairSlot × PairSlot) : ℕ := + match a.1.1.val, a.1.2.val, a.2.1.val, a.2.2.val with + | 5, 5, 2, 0 => 1 + | 5, 5, 3, 0 => 2 + | 5, 5, 1, 1 => 3 + | 5, 5, 0, 2 => 1 + | 5, 5, 0, 3 => 2 + | 4, 5, 4, 0 => 4 + | 4, 5, 2, 1 => 5 + | 4, 5, 3, 1 => 6 + | 4, 5, 1, 2 => 5 + | 4, 5, 1, 3 => 6 + | 4, 5, 0, 4 => 4 + | 5, 4, 4, 0 => 4 + | 5, 4, 2, 1 => 5 + | 5, 4, 3, 1 => 6 + | 5, 4, 1, 2 => 5 + | 5, 4, 1, 3 => 6 + | 5, 4, 0, 4 => 4 + | 2, 5, 5, 0 => 7 + | 2, 5, 4, 1 => 8 + | 2, 5, 2, 2 => 9 + | 2, 5, 2, 3 => 10 + | 2, 5, 3, 2 => 10 + | 2, 5, 3, 3 => 11 + | 2, 5, 1, 4 => 8 + | 2, 5, 0, 5 => 7 + | 3, 5, 5, 0 => 12 + | 3, 5, 4, 1 => 13 + | 3, 5, 2, 2 => 14 + | 3, 5, 2, 3 => 15 + | 3, 5, 3, 2 => 15 + | 3, 5, 3, 3 => 16 + | 3, 5, 1, 4 => 13 + | 3, 5, 0, 5 => 12 + | 4, 4, 5, 0 => 17 + | 4, 4, 4, 1 => 18 + | 4, 4, 2, 2 => 19 + | 4, 4, 2, 3 => 20 + | 4, 4, 3, 2 => 20 + | 4, 4, 3, 3 => 21 + | 4, 4, 1, 4 => 18 + | 4, 4, 0, 5 => 17 + | 5, 2, 5, 0 => 7 + | 5, 2, 4, 1 => 8 + | 5, 2, 2, 2 => 9 + | 5, 2, 2, 3 => 10 + | 5, 2, 3, 2 => 10 + | 5, 2, 3, 3 => 11 + | 5, 2, 1, 4 => 8 + | 5, 2, 0, 5 => 7 + | 5, 3, 5, 0 => 12 + | 5, 3, 4, 1 => 13 + | 5, 3, 2, 2 => 14 + | 5, 3, 2, 3 => 15 + | 5, 3, 3, 2 => 15 + | 5, 3, 3, 3 => 16 + | 5, 3, 1, 4 => 13 + | 5, 3, 0, 5 => 12 + | 1, 5, 5, 1 => 22 + | 1, 5, 4, 2 => 23 + | 1, 5, 4, 3 => 24 + | 1, 5, 2, 4 => 23 + | 1, 5, 3, 4 => 24 + | 1, 5, 1, 5 => 22 + | 2, 4, 5, 1 => 23 + | 2, 4, 4, 2 => 25 + | 2, 4, 4, 3 => 26 + | 2, 4, 2, 4 => 25 + | 2, 4, 3, 4 => 26 + | 2, 4, 1, 5 => 23 + | 3, 4, 5, 1 => 24 + | 3, 4, 4, 2 => 26 + | 3, 4, 4, 3 => 27 + | 3, 4, 2, 4 => 26 + | 3, 4, 3, 4 => 27 + | 3, 4, 1, 5 => 24 + | 4, 2, 5, 1 => 23 + | 4, 2, 4, 2 => 25 + | 4, 2, 4, 3 => 26 + | 4, 2, 2, 4 => 25 + | 4, 2, 3, 4 => 26 + | 4, 2, 1, 5 => 23 + | 4, 3, 5, 1 => 24 + | 4, 3, 4, 2 => 26 + | 4, 3, 4, 3 => 27 + | 4, 3, 2, 4 => 26 + | 4, 3, 3, 4 => 27 + | 4, 3, 1, 5 => 24 + | 5, 1, 5, 1 => 22 + | 5, 1, 4, 2 => 23 + | 5, 1, 4, 3 => 24 + | 5, 1, 2, 4 => 23 + | 5, 1, 3, 4 => 24 + | 5, 1, 1, 5 => 22 + | 5, 0, 2, 5 => 7 + | 5, 0, 3, 5 => 12 + | 5, 0, 4, 4 => 17 + | 5, 0, 5, 2 => 7 + | 5, 0, 5, 3 => 12 + | 4, 1, 2, 5 => 8 + | 4, 1, 3, 5 => 13 + | 4, 1, 4, 4 => 18 + | 4, 1, 5, 2 => 8 + | 4, 1, 5, 3 => 13 + | 2, 2, 2, 5 => 9 + | 2, 2, 3, 5 => 14 + | 2, 2, 4, 4 => 19 + | 2, 2, 5, 2 => 9 + | 2, 2, 5, 3 => 14 + | 2, 3, 2, 5 => 10 + | 2, 3, 3, 5 => 15 + | 2, 3, 4, 4 => 20 + | 2, 3, 5, 2 => 10 + | 2, 3, 5, 3 => 15 + | 3, 2, 2, 5 => 10 + | 3, 2, 3, 5 => 15 + | 3, 2, 4, 4 => 20 + | 3, 2, 5, 2 => 10 + | 3, 2, 5, 3 => 15 + | 3, 3, 2, 5 => 11 + | 3, 3, 3, 5 => 16 + | 3, 3, 4, 4 => 21 + | 3, 3, 5, 2 => 11 + | 3, 3, 5, 3 => 16 + | 1, 4, 2, 5 => 8 + | 1, 4, 3, 5 => 13 + | 1, 4, 4, 4 => 18 + | 1, 4, 5, 2 => 8 + | 1, 4, 5, 3 => 13 + | 0, 5, 2, 5 => 7 + | 0, 5, 3, 5 => 12 + | 0, 5, 4, 4 => 17 + | 0, 5, 5, 2 => 7 + | 0, 5, 5, 3 => 12 + | 4, 0, 4, 5 => 4 + | 4, 0, 5, 4 => 4 + | 2, 1, 4, 5 => 5 + | 2, 1, 5, 4 => 5 + | 3, 1, 4, 5 => 6 + | 3, 1, 5, 4 => 6 + | 1, 2, 4, 5 => 5 + | 1, 2, 5, 4 => 5 + | 1, 3, 4, 5 => 6 + | 1, 3, 5, 4 => 6 + | 0, 4, 4, 5 => 4 + | 0, 4, 5, 4 => 4 + | 2, 0, 5, 5 => 1 + | 3, 0, 5, 5 => 2 + | 1, 1, 5, 5 => 3 + | 0, 2, 5, 5 => 1 + | 0, 3, 5, 5 => 2 + | _, _, _, _ => 0 +def CA2_4_10I2PairP (a : PairSlot × PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_4_10I2PairCertificates (CA2_4_10I2PairCertificateIndex a)).input +lemma CA2_4_10I2PairP_check_0_0 : ∀ k l : Fin 6, contains (CA2_4_10I2PairRaw ((0,0),(k,l))) (CA2_4_10I2PairP ((0,0),(k,l))) = true := by + decide +kernel +lemma CA2_4_10I2PairP_check_0_1 : ∀ k l : Fin 6, contains (CA2_4_10I2PairRaw ((0,1),(k,l))) (CA2_4_10I2PairP ((0,1),(k,l))) = true := by + decide +kernel +lemma CA2_4_10I2PairP_check_0_2 : ∀ k l : Fin 6, contains (CA2_4_10I2PairRaw ((0,2),(k,l))) (CA2_4_10I2PairP ((0,2),(k,l))) = true := by + decide +kernel +lemma CA2_4_10I2PairP_check_0_3 : ∀ k l : Fin 6, contains (CA2_4_10I2PairRaw ((0,3),(k,l))) (CA2_4_10I2PairP ((0,3),(k,l))) = true := by + decide +kernel +lemma CA2_4_10I2PairP_check_0_4 : ∀ k l : Fin 6, contains (CA2_4_10I2PairRaw ((0,4),(k,l))) (CA2_4_10I2PairP ((0,4),(k,l))) = true := by + decide +kernel +lemma CA2_4_10I2PairP_check_0_5 : ∀ k l : Fin 6, contains (CA2_4_10I2PairRaw ((0,5),(k,l))) (CA2_4_10I2PairP ((0,5),(k,l))) = true := by + decide +kernel +lemma CA2_4_10I2PairP_check_1_0 : ∀ k l : Fin 6, contains (CA2_4_10I2PairRaw ((1,0),(k,l))) (CA2_4_10I2PairP ((1,0),(k,l))) = true := by + decide +kernel +lemma CA2_4_10I2PairP_check_1_1 : ∀ k l : Fin 6, contains (CA2_4_10I2PairRaw ((1,1),(k,l))) (CA2_4_10I2PairP ((1,1),(k,l))) = true := by + decide +kernel +lemma CA2_4_10I2PairP_check_1_2 : ∀ k l : Fin 6, contains (CA2_4_10I2PairRaw ((1,2),(k,l))) (CA2_4_10I2PairP ((1,2),(k,l))) = true := by + decide +kernel +lemma CA2_4_10I2PairP_check_1_3 : ∀ k l : Fin 6, contains (CA2_4_10I2PairRaw ((1,3),(k,l))) (CA2_4_10I2PairP ((1,3),(k,l))) = true := by + decide +kernel +lemma CA2_4_10I2PairP_check_1_4 : ∀ k l : Fin 6, contains (CA2_4_10I2PairRaw ((1,4),(k,l))) (CA2_4_10I2PairP ((1,4),(k,l))) = true := by + decide +kernel +lemma CA2_4_10I2PairP_check_1_5 : ∀ k l : Fin 6, contains (CA2_4_10I2PairRaw ((1,5),(k,l))) (CA2_4_10I2PairP ((1,5),(k,l))) = true := by + decide +kernel +lemma CA2_4_10I2PairP_check_2_0 : ∀ k l : Fin 6, contains (CA2_4_10I2PairRaw ((2,0),(k,l))) (CA2_4_10I2PairP ((2,0),(k,l))) = true := by + decide +kernel +lemma CA2_4_10I2PairP_check_2_1 : ∀ k l : Fin 6, contains (CA2_4_10I2PairRaw ((2,1),(k,l))) (CA2_4_10I2PairP ((2,1),(k,l))) = true := by + decide +kernel +lemma CA2_4_10I2PairP_check_2_2 : ∀ k l : Fin 6, contains (CA2_4_10I2PairRaw ((2,2),(k,l))) (CA2_4_10I2PairP ((2,2),(k,l))) = true := by + decide +kernel +lemma CA2_4_10I2PairP_check_2_3 : ∀ k l : Fin 6, contains (CA2_4_10I2PairRaw ((2,3),(k,l))) (CA2_4_10I2PairP ((2,3),(k,l))) = true := by + decide +kernel +lemma CA2_4_10I2PairP_check_2_4 : ∀ k l : Fin 6, contains (CA2_4_10I2PairRaw ((2,4),(k,l))) (CA2_4_10I2PairP ((2,4),(k,l))) = true := by + decide +kernel +lemma CA2_4_10I2PairP_check_2_5 : ∀ k l : Fin 6, contains (CA2_4_10I2PairRaw ((2,5),(k,l))) (CA2_4_10I2PairP ((2,5),(k,l))) = true := by + decide +kernel +lemma CA2_4_10I2PairP_check_3_0 : ∀ k l : Fin 6, contains (CA2_4_10I2PairRaw ((3,0),(k,l))) (CA2_4_10I2PairP ((3,0),(k,l))) = true := by + decide +kernel +lemma CA2_4_10I2PairP_check_3_1 : ∀ k l : Fin 6, contains (CA2_4_10I2PairRaw ((3,1),(k,l))) (CA2_4_10I2PairP ((3,1),(k,l))) = true := by + decide +kernel +lemma CA2_4_10I2PairP_check_3_2 : ∀ k l : Fin 6, contains (CA2_4_10I2PairRaw ((3,2),(k,l))) (CA2_4_10I2PairP ((3,2),(k,l))) = true := by + decide +kernel +lemma CA2_4_10I2PairP_check_3_3 : ∀ k l : Fin 6, contains (CA2_4_10I2PairRaw ((3,3),(k,l))) (CA2_4_10I2PairP ((3,3),(k,l))) = true := by + decide +kernel +lemma CA2_4_10I2PairP_check_3_4 : ∀ k l : Fin 6, contains (CA2_4_10I2PairRaw ((3,4),(k,l))) (CA2_4_10I2PairP ((3,4),(k,l))) = true := by + decide +kernel +lemma CA2_4_10I2PairP_check_3_5 : ∀ k l : Fin 6, contains (CA2_4_10I2PairRaw ((3,5),(k,l))) (CA2_4_10I2PairP ((3,5),(k,l))) = true := by + decide +kernel +lemma CA2_4_10I2PairP_check_4_0 : ∀ k l : Fin 6, contains (CA2_4_10I2PairRaw ((4,0),(k,l))) (CA2_4_10I2PairP ((4,0),(k,l))) = true := by + decide +kernel +lemma CA2_4_10I2PairP_check_4_1 : ∀ k l : Fin 6, contains (CA2_4_10I2PairRaw ((4,1),(k,l))) (CA2_4_10I2PairP ((4,1),(k,l))) = true := by + decide +kernel +lemma CA2_4_10I2PairP_check_4_2 : ∀ k l : Fin 6, contains (CA2_4_10I2PairRaw ((4,2),(k,l))) (CA2_4_10I2PairP ((4,2),(k,l))) = true := by + decide +kernel +lemma CA2_4_10I2PairP_check_4_3 : ∀ k l : Fin 6, contains (CA2_4_10I2PairRaw ((4,3),(k,l))) (CA2_4_10I2PairP ((4,3),(k,l))) = true := by + decide +kernel +lemma CA2_4_10I2PairP_check_4_4 : ∀ k l : Fin 6, contains (CA2_4_10I2PairRaw ((4,4),(k,l))) (CA2_4_10I2PairP ((4,4),(k,l))) = true := by + decide +kernel +lemma CA2_4_10I2PairP_check_4_5 : ∀ k l : Fin 6, contains (CA2_4_10I2PairRaw ((4,5),(k,l))) (CA2_4_10I2PairP ((4,5),(k,l))) = true := by + decide +kernel +lemma CA2_4_10I2PairP_check_5_0 : ∀ k l : Fin 6, contains (CA2_4_10I2PairRaw ((5,0),(k,l))) (CA2_4_10I2PairP ((5,0),(k,l))) = true := by + decide +kernel +lemma CA2_4_10I2PairP_check_5_1 : ∀ k l : Fin 6, contains (CA2_4_10I2PairRaw ((5,1),(k,l))) (CA2_4_10I2PairP ((5,1),(k,l))) = true := by + decide +kernel +lemma CA2_4_10I2PairP_check_5_2 : ∀ k l : Fin 6, contains (CA2_4_10I2PairRaw ((5,2),(k,l))) (CA2_4_10I2PairP ((5,2),(k,l))) = true := by + decide +kernel +lemma CA2_4_10I2PairP_check_5_3 : ∀ k l : Fin 6, contains (CA2_4_10I2PairRaw ((5,3),(k,l))) (CA2_4_10I2PairP ((5,3),(k,l))) = true := by + decide +kernel +lemma CA2_4_10I2PairP_check_5_4 : ∀ k l : Fin 6, contains (CA2_4_10I2PairRaw ((5,4),(k,l))) (CA2_4_10I2PairP ((5,4),(k,l))) = true := by + decide +kernel +lemma CA2_4_10I2PairP_check_5_5 : ∀ k l : Fin 6, contains (CA2_4_10I2PairRaw ((5,5),(k,l))) (CA2_4_10I2PairP ((5,5),(k,l))) = true := by + decide +kernel +lemma CA2_4_10I2PairP_check (a : PairSlot × PairSlot) : contains (CA2_4_10I2PairRaw a) (CA2_4_10I2PairP a) = true := by + rcases a with ⟨⟨i,j⟩,⟨k,l⟩⟩ + revert j i + apply forall_fin6 + · exact forall_fin6 (CA2_4_10I2PairP_check_0_0 k l) (CA2_4_10I2PairP_check_0_1 k l) (CA2_4_10I2PairP_check_0_2 k l) (CA2_4_10I2PairP_check_0_3 k l) (CA2_4_10I2PairP_check_0_4 k l) (CA2_4_10I2PairP_check_0_5 k l) + · exact forall_fin6 (CA2_4_10I2PairP_check_1_0 k l) (CA2_4_10I2PairP_check_1_1 k l) (CA2_4_10I2PairP_check_1_2 k l) (CA2_4_10I2PairP_check_1_3 k l) (CA2_4_10I2PairP_check_1_4 k l) (CA2_4_10I2PairP_check_1_5 k l) + · exact forall_fin6 (CA2_4_10I2PairP_check_2_0 k l) (CA2_4_10I2PairP_check_2_1 k l) (CA2_4_10I2PairP_check_2_2 k l) (CA2_4_10I2PairP_check_2_3 k l) (CA2_4_10I2PairP_check_2_4 k l) (CA2_4_10I2PairP_check_2_5 k l) + · exact forall_fin6 (CA2_4_10I2PairP_check_3_0 k l) (CA2_4_10I2PairP_check_3_1 k l) (CA2_4_10I2PairP_check_3_2 k l) (CA2_4_10I2PairP_check_3_3 k l) (CA2_4_10I2PairP_check_3_4 k l) (CA2_4_10I2PairP_check_3_5 k l) + · exact forall_fin6 (CA2_4_10I2PairP_check_4_0 k l) (CA2_4_10I2PairP_check_4_1 k l) (CA2_4_10I2PairP_check_4_2 k l) (CA2_4_10I2PairP_check_4_3 k l) (CA2_4_10I2PairP_check_4_4 k l) (CA2_4_10I2PairP_check_4_5 k l) + · exact forall_fin6 (CA2_4_10I2PairP_check_5_0 k l) (CA2_4_10I2PairP_check_5_1 k l) (CA2_4_10I2PairP_check_5_2 k l) (CA2_4_10I2PairP_check_5_3 k l) (CA2_4_10I2PairP_check_5_4 k l) (CA2_4_10I2PairP_check_5_5 k l) +lemma CA2_4_10I2PairP_sound (a : PairSlot × PairSlot) : + (CA2_4_10I2PairP a).Encloses (CA2_4_10I2PairValue a) := + contains_sound (CA2_4_10I2PairRaw_sound a) (CA2_4_10I2PairP_check a) +def CA2_4_10I2PairTerms (a : PairSlot × PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_4_10I2PairCertificates (CA2_4_10I2PairCertificateIndex a)).output +lemma CA2_4_10I2PairTerms_sound (a : PairSlot × PairSlot) : + (CA2_4_10I2PairTerms a).Encloses (Foundation.entropyTerm (CA2_4_10I2PairValue a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_4_10I2PairCertificates_valid + (CA2_4_10I2PairCertificateIndex a) (CA2_4_10I2PairP_sound a) +def CA2_4_10I2PairEntropy : Ball := ⟨(35926908456638450987485173075227 / 12500000000000000000000000000000), (12716528731 / 10000000000000000000000000000000)⟩ +lemma CA2_4_10I2PairEntropy_sound : CA2_4_10I2PairEntropy.Encloses (Foundation.finiteEntropy CA2_4_10I2PairValue) := by + exact contains_sound (entropyDoublePair_enclosed CA2_4_10I2PairValue CA2_4_10I2PairTerms CA2_4_10I2PairTerms_sound) (by decide +kernel) +def CA2_4_10I2PairMass : Ball := ⟨(24999999999999999999999999999997 / 25000000000000000000000000000000), (377 / 50000000000000000000000000000000)⟩ +lemma CA2_4_10I2PairMass_sound : CA2_4_10I2PairMass.Encloses (∑ a, CA2_4_10I2PairValue a) := by + exact contains_sound (doublePairSumBall_sound CA2_4_10I2PairP CA2_4_10I2PairValue CA2_4_10I2PairP_sound) (by decide +kernel) +def CA2_4_10I2PairMassTermLogWitness : LogWitness := ⟨-1, 24999999999999999999999999999997, 12500000000000000000000000000000⟩ +def CA2_4_10I2PairMassTermLog : Ball := ⟨(-11 / 100000000000000000000000000000000), (1058791203 / 2500000000000000000000000000000)⟩ +lemma CA2_4_10I2PairMassTermLog_sound : CA2_4_10I2PairMassTermLog.Encloses (Real.log ((∑ a, CA2_4_10I2PairValue a))) := by + exact checkLog_sound logTwoBall_sound (CA2_4_10I2PairMass_sound) (w := CA2_4_10I2PairMassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA2_4_10I2PairMassTerm : Ball := ⟨(11 / 100000000000000000000000000000000), (42351648121 / 100000000000000000000000000000000)⟩ +lemma CA2_4_10I2PairMassTerm_sound : CA2_4_10I2PairMassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_4_10I2PairValue a))) := by + exact contains_sound (entropyTerm_ball (CA2_4_10I2PairMass_sound) CA2_4_10I2PairMassTermLog_sound) (by decide +kernel) +def CA2_4_10I2PairH : Ball := ⟨(57483053530621521579976276920361 / 20000000000000000000000000000000), (169516935431 / 100000000000000000000000000000000)⟩ +lemma CA2_4_10I2PairH_sound : CA2_4_10I2PairH.Encloses (homogeneousEntropy CA2_4_10I2PairValue) := by + exact contains_sound (homogeneous_enclosed CA2_4_10I2PairValue CA2_4_10I2PairMassTerm_sound CA2_4_10I2PairEntropy_sound) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA2_5_9I0.lean b/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA2_5_9I0.lean new file mode 100644 index 0000000000000000000000000000000000000000..c7dcd1297c19bdcfc203f7d9f88ac4092f8a8710 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA2_5_9I0.lean @@ -0,0 +1,74 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Certificates.SplitA2_5_9 + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CA2_5_9I0Value (a : Fin 17) : ℝ := marginal (below (shape 2 5 9)) (fun u => (stageALaw (shape 2 5 9) u : ℝ)) ((Equiv.refl (Fin 3)) 0) a +def CA2_5_9I0Raw (a : Fin 17) : Ball := marginalBall (below (shape 2 5 9)) A2_5_9Law ((Equiv.refl (Fin 3)) 0) a +lemma CA2_5_9I0Raw_sound (a : Fin 17) : + (CA2_5_9I0Raw a).Encloses (CA2_5_9I0Value a) := by + exact marginalBall_sound (below (shape 2 5 9)) A2_5_9Law (fun u => (stageALaw (shape 2 5 9) u : ℝ)) (fun u _ => A2_5_9Law_sound u) ((Equiv.refl (Fin 3)) 0) a +def CA2_5_9I0Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(12820241431770474661034931012817 / 50000000000000000000000000000000), (3 / 4000000000000000000000000000000)⟩ ⟨(34896638760094206029001325695197 / 100000000000000000000000000000000), (8144375253 / 50000000000000000000000000000000)⟩ ⟨(-27219954433631116156815148137033 / 20000000000000000000000000000000), (3176373567 / 5000000000000000000000000000000)⟩ ⟨-2, 12820241431770474661034931012817, 12500000000000000000000000000000⟩, + .log ⟨(12179758568229525338965068987183 / 25000000000000000000000000000000), (31 / 50000000000000000000000000000000)⟩ ⟨(17516938145574499321587008667317 / 50000000000000000000000000000000), (61899941 / 200000000000000000000000000000)⟩ ⟨(-14382007695346950823450620237117 / 20000000000000000000000000000000), (7940933897 / 12500000000000000000000000000000)⟩ ⟨-2, 12179758568229525338965068987183, 6250000000000000000000000000000⟩] +lemma CA2_5_9I0Certificates_valid : + CA2_5_9I0Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_5_9I0CertificateIndex (a : Fin 17) : ℕ := + match a.val with + | 0 => 1 + | 1 => 2 + | 2 => 1 + | _ => 0 +def CA2_5_9I0P (a : Fin 17) : Ball := + (CompactCertificate.entropyLookup CA2_5_9I0Certificates (CA2_5_9I0CertificateIndex a)).input +lemma CA2_5_9I0P_check : ∀ a : Fin 17, contains (CA2_5_9I0Raw a) (CA2_5_9I0P a) = true := by + decide +kernel +lemma CA2_5_9I0P_sound (a : Fin 17) : + (CA2_5_9I0P a).Encloses (CA2_5_9I0Value a) := + contains_sound (CA2_5_9I0Raw_sound a) (CA2_5_9I0P_check a) +def CA2_5_9I0Terms (a : Fin 17) : Ball := + (CompactCertificate.entropyLookup CA2_5_9I0Certificates (CA2_5_9I0CertificateIndex a)).output +lemma CA2_5_9I0Terms_sound (a : Fin 17) : + (CA2_5_9I0Terms a).Encloses (Foundation.entropyTerm (CA2_5_9I0Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_5_9I0Certificates_valid + (CA2_5_9I0CertificateIndex a) (CA2_5_9I0P_sound a) +def CA2_5_9I0Entropy : Ball := ⟨(26206788452834352675294167181257 / 25000000000000000000000000000000), (7940933939 / 12500000000000000000000000000000)⟩ +lemma CA2_5_9I0Entropy_sound : CA2_5_9I0Entropy.Encloses (Foundation.finiteEntropy CA2_5_9I0Value) := by + exact contains_sound (entropyFin_enclosed 17 CA2_5_9I0Value CA2_5_9I0Terms CA2_5_9I0Terms_sound) (by decide +kernel) +def CA2_5_9I0Mass : Ball := ⟨1, (53 / 25000000000000000000000000000000)⟩ +lemma CA2_5_9I0Mass_sound : CA2_5_9I0Mass.Encloses (∑ a, CA2_5_9I0Value a) := by + exact contains_sound (finSumBall_sound 17 CA2_5_9I0P CA2_5_9I0Value CA2_5_9I0P_sound) (by decide +kernel) +def CA2_5_9I0MassTermLogWitness : LogWitness := ⟨0, 1, 1⟩ +def CA2_5_9I0MassTermLog : Ball := ⟨0, (10587911947 / 50000000000000000000000000000000)⟩ +lemma CA2_5_9I0MassTermLog_sound : CA2_5_9I0MassTermLog.Encloses (Real.log ((∑ a, CA2_5_9I0Value a))) := by + exact checkLog_sound logTwoBall_sound (CA2_5_9I0Mass_sound) (w := CA2_5_9I0MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA2_5_9I0MassTerm : Ball := ⟨0, (4235164779 / 20000000000000000000000000000000)⟩ +lemma CA2_5_9I0MassTerm_sound : CA2_5_9I0MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_5_9I0Value a))) := by + exact contains_sound (entropyTerm_ball (CA2_5_9I0Mass_sound) CA2_5_9I0MassTermLog_sound) (by decide +kernel) +def CA2_5_9I0H : Ball := ⟨(26206788452834352675294167181257 / 25000000000000000000000000000000), (84703295407 / 100000000000000000000000000000000)⟩ +lemma CA2_5_9I0H_sound : CA2_5_9I0H.Encloses (homogeneousEntropy CA2_5_9I0Value) := by + exact contains_sound (homogeneous_enclosed CA2_5_9I0Value CA2_5_9I0MassTerm_sound CA2_5_9I0Entropy_sound) (by decide +kernel) +lemma CA2_5_9I0_sound : CA2_5_9I0H.Encloses (stageACapacity (shape 2 5 9) 0) := by + exact CA2_5_9I0H_sound + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA2_5_9I1.lean b/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA2_5_9I1.lean new file mode 100644 index 0000000000000000000000000000000000000000..b9f7845eef81c92e0a0739866f25eee71f187b23 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA2_5_9I1.lean @@ -0,0 +1,1100 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Certificates.SupportedContraction + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CA2_5_9I1PairValue (a : PairSlot × PairSlot) : ℝ := pairLaw (below (shape 2 5 9)) (shape 2 5 9) (fun u => (stageALaw (shape 2 5 9) u : ℝ)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) a +def CA2_5_9I1PairRaw (a : PairSlot × PairSlot) : Ball := stageAPairBall (shape 2 5 9) A2_5_9Law 1 a +lemma CA2_5_9I1PairRaw_sound (a : PairSlot × PairSlot) : + (CA2_5_9I1PairRaw a).Encloses (CA2_5_9I1PairValue a) := by + exact stageAPairBall_sound (shape 2 5 9) (by decide +kernel) A2_5_9Law (fun u => (stageALaw (shape 2 5 9) u : ℝ)) (fun u _ => A2_5_9Law_sound u) 1 a +def CA2_5_9I1PairCertificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(58767960382992480839007727889 / 50000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ ⟨(396459325333626947251218852751 / 50000000000000000000000000000000), (273781217 / 100000000000000000000000000000000)⟩ ⟨(-168654536736467528425815810214747 / 25000000000000000000000000000000), (46586812613 / 20000000000000000000000000000000)⟩ ⟨-10, 58767960382992480839007727889, 48828125000000000000000000000⟩, + .log ⟨(2590606933834850275205243681 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(1485508891101424430870622729 / 1562500000000000000000000000000), (4114369 / 12500000000000000000000000000000)⟩ ⟨(-114684236477545441583647027058547 / 12500000000000000000000000000000), (63527472979 / 20000000000000000000000000000000)⟩ ⟨-14, 2590606933834850275205243681, 1525878906250000000000000000⟩, + .log ⟨(2745981867591502035041794869 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(53874184830190808013575710667 / 100000000000000000000000000000000), (18607509 / 100000000000000000000000000000000)⟩ ⟨(-61310247376837881701171708132229 / 6250000000000000000000000000000), (21175824821 / 6250000000000000000000000000000)⟩ ⟨-15, 2745981867591502035041794869, 1525878906250000000000000000⟩, + .log ⟨(2710065051726081673498148871531 / 100000000000000000000000000000000), (9 / 50000000000000000000000000000000)⟩ ⟨(4889225036002306408609940163453 / 50000000000000000000000000000000), (4017150263 / 100000000000000000000000000000000)⟩ ⟨(-180409877352880683747476075364579 / 50000000000000000000000000000000), (29646153289 / 20000000000000000000000000000000)⟩ ⟨-6, 2710065051726081673498148871531, 1562500000000000000000000000000⟩, + .log ⟨(122436640021604194836528458687 / 50000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ ⟨(1472223366299340295692474895703 / 100000000000000000000000000000000), (103707871 / 20000000000000000000000000000000)⟩ ⟨(-30060923062727862349196471705593 / 5000000000000000000000000000000), (105879118823 / 50000000000000000000000000000000)⟩ ⟨-9, 122436640021604194836528458687, 97656250000000000000000000000⟩, + .log ⟨(22690538983199886514026113531 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(190395800079647067579218983299 / 100000000000000000000000000000000), (6726873 / 10000000000000000000000000000000)⟩ ⟨(-167819548244857859359923598914237 / 20000000000000000000000000000000), (296461535969 / 100000000000000000000000000000000)⟩ ⟨-13, 22690538983199886514026113531, 12207031250000000000000000000⟩, + .log ⟨(97690066787711583919526744233 / 20000000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ ⟨(519876023827647474286509979471 / 20000000000000000000000000000000), (46545023 / 5000000000000000000000000000000)⟩ ⟨(-532168766920162026766045173909017 / 100000000000000000000000000000000), (38116482793 / 20000000000000000000000000000000)⟩ ⟨-8, 97690066787711583919526744233, 78125000000000000000000000000⟩, + .log ⟨(406470096200288560025402877 / 6250000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(31348865236553908515014699977 / 50000000000000000000000000000000), (165261 / 800000000000000000000000000000)⟩ ⟨(-964058165951361978172570358174491 / 100000000000000000000000000000000), (15881868531 / 5000000000000000000000000000000)⟩ ⟨-14, 406470096200288560025402877, 381469726562500000000000000⟩, + .log ⟨(1526102126905491530775405243131 / 50000000000000000000000000000000), (17 / 100000000000000000000000000000000)⟩ ⟨(1065007507457345083364980474119 / 10000000000000000000000000000000), (565538227 / 12500000000000000000000000000000)⟩ ⟨(-174465307511379099196382779562173 / 50000000000000000000000000000000), (74115383169 / 50000000000000000000000000000000)⟩ ⟨-6, 1526102126905491530775405243131, 781250000000000000000000000000⟩, + .log ⟨(14426086594155923331676518207 / 5000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ ⟨(843659912352658416356605933641 / 50000000000000000000000000000000), (610968547 / 100000000000000000000000000000000)⟩ ⟨(-116963101094156620609246396633903 / 20000000000000000000000000000000), (211758237523 / 100000000000000000000000000000000)⟩ ⟨-9, 14426086594155923331676518207, 9765625000000000000000000000⟩, + .log ⟨(25406989929180182184981337909 / 20000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ ⟨(33885115586459414464013650327 / 4000000000000000000000000000000), (295907683 / 100000000000000000000000000000000)⟩ ⟨(-666846322230836564386804567371771 / 100000000000000000000000000000000), (232934062087 / 100000000000000000000000000000000)⟩ ⟨-10, 25406989929180182184981337909, 19531250000000000000000000000⟩, + .log ⟨(313674041300645300353004729543 / 100000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ ⟨(452049078582313622232021177403 / 25000000000000000000000000000000), (8302883 / 1250000000000000000000000000000)⟩ ⟨(-115291422065504188673213000984231 / 20000000000000000000000000000000), (105879118893 / 50000000000000000000000000000000)⟩ ⟨-9, 313674041300645300353004729543, 195312500000000000000000000000⟩, + .log ⟨(7443132397103191994943809537 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(241733270217311075975632152167 / 100000000000000000000000000000000), (81959529 / 100000000000000000000000000000000)⟩ ⟨(-405966966124691911560485573444577 / 50000000000000000000000000000000), (275285711237 / 100000000000000000000000000000000)⟩ ⟨-12, 7443132397103191994943809537, 6103515625000000000000000000⟩, + .log ⟨(12963860454615978603929701577 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(14504550359301825659170257197 / 12500000000000000000000000000000), (3843287 / 10000000000000000000000000000000)⟩ ⟨(-44753799719086797514775048483007 / 5000000000000000000000000000000), (11858461571 / 4000000000000000000000000000000)⟩ ⟨-13, 12963860454615978603929701577, 12207031250000000000000000000⟩, + .log ⟨(5721259318218938554569654511383 / 50000000000000000000000000000000), (21 / 50000000000000000000000000000000)⟩ ⟨(6201370418763669015022762180797 / 25000000000000000000000000000000), (12115237991 / 100000000000000000000000000000000)⟩ ⟨(-21678340637404255434211268008519 / 10000000000000000000000000000000), (52939559391 / 50000000000000000000000000000000)⟩ ⟨-4, 5721259318218938554569654511383, 3125000000000000000000000000000⟩, + .log ⟨(1086258372234227801232634232139 / 100000000000000000000000000000000), (1 / 20000000000000000000000000000000)⟩ ⟨(4912528624539643401614980383279 / 100000000000000000000000000000000), (1840193289 / 100000000000000000000000000000000)⟩ ⟨(-452243108095498693500220823300617 / 100000000000000000000000000000000), (42351647481 / 25000000000000000000000000000000)⟩ ⟨-7, 1086258372234227801232634232139, 781250000000000000000000000000⟩, + .log ⟨(477080083972811338212853152219 / 100000000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ ⟨(255010807152888463961905473887 / 10000000000000000000000000000000), (909230763 / 100000000000000000000000000000000)⟩ ⟨(-534524109724566618459559269887467 / 100000000000000000000000000000000), (38116482797 / 20000000000000000000000000000000)⟩ ⟨-8, 477080083972811338212853152219, 390625000000000000000000000000⟩] +lemma CA2_5_9I1PairCertificates_valid : + CA2_5_9I1PairCertificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_5_9I1PairCertificateIndex (a : PairSlot × PairSlot) : ℕ := + match a.1.1.val, a.1.2.val, a.2.1.val, a.2.2.val with + | 0, 0, 4, 2 => 1 + | 0, 0, 4, 3 => 2 + | 0, 0, 5, 1 => 3 + | 0, 0, 2, 4 => 1 + | 0, 0, 3, 4 => 2 + | 0, 0, 1, 5 => 3 + | 1, 0, 2, 2 => 4 + | 1, 0, 2, 3 => 5 + | 1, 0, 3, 2 => 5 + | 1, 0, 3, 3 => 6 + | 1, 0, 4, 1 => 7 + | 1, 0, 5, 0 => 8 + | 1, 0, 1, 4 => 7 + | 1, 0, 0, 5 => 8 + | 0, 1, 2, 2 => 4 + | 0, 1, 2, 3 => 5 + | 0, 1, 3, 2 => 5 + | 0, 1, 3, 3 => 6 + | 0, 1, 4, 1 => 7 + | 0, 1, 5, 0 => 8 + | 0, 1, 1, 4 => 7 + | 0, 1, 0, 5 => 8 + | 2, 0, 1, 2 => 9 + | 2, 0, 1, 3 => 10 + | 2, 0, 2, 1 => 9 + | 2, 0, 3, 1 => 10 + | 2, 0, 4, 0 => 11 + | 2, 0, 0, 4 => 11 + | 3, 0, 1, 2 => 12 + | 3, 0, 1, 3 => 13 + | 3, 0, 2, 1 => 12 + | 3, 0, 3, 1 => 13 + | 3, 0, 4, 0 => 14 + | 3, 0, 0, 4 => 14 + | 1, 1, 1, 2 => 15 + | 1, 1, 1, 3 => 16 + | 1, 1, 2, 1 => 15 + | 1, 1, 3, 1 => 16 + | 1, 1, 4, 0 => 17 + | 1, 1, 0, 4 => 17 + | 0, 2, 1, 2 => 9 + | 0, 2, 1, 3 => 10 + | 0, 2, 2, 1 => 9 + | 0, 2, 3, 1 => 10 + | 0, 2, 4, 0 => 11 + | 0, 2, 0, 4 => 11 + | 0, 3, 1, 2 => 12 + | 0, 3, 1, 3 => 13 + | 0, 3, 2, 1 => 12 + | 0, 3, 3, 1 => 13 + | 0, 3, 4, 0 => 14 + | 0, 3, 0, 4 => 14 + | 4, 0, 0, 2 => 11 + | 4, 0, 0, 3 => 14 + | 4, 0, 1, 1 => 17 + | 4, 0, 2, 0 => 11 + | 4, 0, 3, 0 => 14 + | 2, 1, 0, 2 => 9 + | 2, 1, 0, 3 => 12 + | 2, 1, 1, 1 => 15 + | 2, 1, 2, 0 => 9 + | 2, 1, 3, 0 => 12 + | 3, 1, 0, 2 => 10 + | 3, 1, 0, 3 => 13 + | 3, 1, 1, 1 => 16 + | 3, 1, 2, 0 => 10 + | 3, 1, 3, 0 => 13 + | 1, 2, 0, 2 => 9 + | 1, 2, 0, 3 => 12 + | 1, 2, 1, 1 => 15 + | 1, 2, 2, 0 => 9 + | 1, 2, 3, 0 => 12 + | 1, 3, 0, 2 => 10 + | 1, 3, 0, 3 => 13 + | 1, 3, 1, 1 => 16 + | 1, 3, 2, 0 => 10 + | 1, 3, 3, 0 => 13 + | 0, 4, 0, 2 => 11 + | 0, 4, 0, 3 => 14 + | 0, 4, 1, 1 => 17 + | 0, 4, 2, 0 => 11 + | 0, 4, 3, 0 => 14 + | 0, 5, 0, 1 => 8 + | 0, 5, 1, 0 => 8 + | 1, 4, 0, 1 => 7 + | 1, 4, 1, 0 => 7 + | 2, 2, 0, 1 => 4 + | 2, 2, 1, 0 => 4 + | 2, 3, 0, 1 => 5 + | 2, 3, 1, 0 => 5 + | 3, 2, 0, 1 => 5 + | 3, 2, 1, 0 => 5 + | 3, 3, 0, 1 => 6 + | 3, 3, 1, 0 => 6 + | 4, 1, 0, 1 => 7 + | 4, 1, 1, 0 => 7 + | 5, 0, 0, 1 => 8 + | 5, 0, 1, 0 => 8 + | 1, 5, 0, 0 => 3 + | 2, 4, 0, 0 => 1 + | 3, 4, 0, 0 => 2 + | 4, 2, 0, 0 => 1 + | 4, 3, 0, 0 => 2 + | 5, 1, 0, 0 => 3 + | _, _, _, _ => 0 +def CA2_5_9I1PairP (a : PairSlot × PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_5_9I1PairCertificates (CA2_5_9I1PairCertificateIndex a)).input +lemma CA2_5_9I1PairP_check_0_0 : ∀ k l : Fin 6, contains (CA2_5_9I1PairRaw ((0,0),(k,l))) (CA2_5_9I1PairP ((0,0),(k,l))) = true := by + decide +kernel +lemma CA2_5_9I1PairP_check_0_1 : ∀ k l : Fin 6, contains (CA2_5_9I1PairRaw ((0,1),(k,l))) (CA2_5_9I1PairP ((0,1),(k,l))) = true := by + decide +kernel +lemma CA2_5_9I1PairP_check_0_2 : ∀ k l : Fin 6, contains (CA2_5_9I1PairRaw ((0,2),(k,l))) (CA2_5_9I1PairP ((0,2),(k,l))) = true := by + decide +kernel +lemma CA2_5_9I1PairP_check_0_3 : ∀ k l : Fin 6, contains (CA2_5_9I1PairRaw ((0,3),(k,l))) (CA2_5_9I1PairP ((0,3),(k,l))) = true := by + decide +kernel +lemma CA2_5_9I1PairP_check_0_4 : ∀ k l : Fin 6, contains (CA2_5_9I1PairRaw ((0,4),(k,l))) (CA2_5_9I1PairP ((0,4),(k,l))) = true := by + decide +kernel +lemma CA2_5_9I1PairP_check_0_5 : ∀ k l : Fin 6, contains (CA2_5_9I1PairRaw ((0,5),(k,l))) (CA2_5_9I1PairP ((0,5),(k,l))) = true := by + decide +kernel +lemma CA2_5_9I1PairP_check_1_0 : ∀ k l : Fin 6, contains (CA2_5_9I1PairRaw ((1,0),(k,l))) (CA2_5_9I1PairP ((1,0),(k,l))) = true := by + decide +kernel +lemma CA2_5_9I1PairP_check_1_1 : ∀ k l : Fin 6, contains (CA2_5_9I1PairRaw ((1,1),(k,l))) (CA2_5_9I1PairP ((1,1),(k,l))) = true := by + decide +kernel +lemma CA2_5_9I1PairP_check_1_2 : ∀ k l : Fin 6, contains (CA2_5_9I1PairRaw ((1,2),(k,l))) (CA2_5_9I1PairP ((1,2),(k,l))) = true := by + decide +kernel +lemma CA2_5_9I1PairP_check_1_3 : ∀ k l : Fin 6, contains (CA2_5_9I1PairRaw ((1,3),(k,l))) (CA2_5_9I1PairP ((1,3),(k,l))) = true := by + decide +kernel +lemma CA2_5_9I1PairP_check_1_4 : ∀ k l : Fin 6, contains (CA2_5_9I1PairRaw ((1,4),(k,l))) (CA2_5_9I1PairP ((1,4),(k,l))) = true := by + decide +kernel +lemma CA2_5_9I1PairP_check_1_5 : ∀ k l : Fin 6, contains (CA2_5_9I1PairRaw ((1,5),(k,l))) (CA2_5_9I1PairP ((1,5),(k,l))) = true := by + decide +kernel +lemma CA2_5_9I1PairP_check_2_0 : ∀ k l : Fin 6, contains (CA2_5_9I1PairRaw ((2,0),(k,l))) (CA2_5_9I1PairP ((2,0),(k,l))) = true := by + decide +kernel +lemma CA2_5_9I1PairP_check_2_1 : ∀ k l : Fin 6, contains (CA2_5_9I1PairRaw ((2,1),(k,l))) (CA2_5_9I1PairP ((2,1),(k,l))) = true := by + decide +kernel +lemma CA2_5_9I1PairP_check_2_2 : ∀ k l : Fin 6, contains (CA2_5_9I1PairRaw ((2,2),(k,l))) (CA2_5_9I1PairP ((2,2),(k,l))) = true := by + decide +kernel +lemma CA2_5_9I1PairP_check_2_3 : ∀ k l : Fin 6, contains (CA2_5_9I1PairRaw ((2,3),(k,l))) (CA2_5_9I1PairP ((2,3),(k,l))) = true := by + decide +kernel +lemma CA2_5_9I1PairP_check_2_4 : ∀ k l : Fin 6, contains (CA2_5_9I1PairRaw ((2,4),(k,l))) (CA2_5_9I1PairP ((2,4),(k,l))) = true := by + decide +kernel +lemma CA2_5_9I1PairP_check_2_5 : ∀ k l : Fin 6, contains (CA2_5_9I1PairRaw ((2,5),(k,l))) (CA2_5_9I1PairP ((2,5),(k,l))) = true := by + decide +kernel +lemma CA2_5_9I1PairP_check_3_0 : ∀ k l : Fin 6, contains (CA2_5_9I1PairRaw ((3,0),(k,l))) (CA2_5_9I1PairP ((3,0),(k,l))) = true := by + decide +kernel +lemma CA2_5_9I1PairP_check_3_1 : ∀ k l : Fin 6, contains (CA2_5_9I1PairRaw ((3,1),(k,l))) (CA2_5_9I1PairP ((3,1),(k,l))) = true := by + decide +kernel +lemma CA2_5_9I1PairP_check_3_2 : ∀ k l : Fin 6, contains (CA2_5_9I1PairRaw ((3,2),(k,l))) (CA2_5_9I1PairP ((3,2),(k,l))) = true := by + decide +kernel +lemma CA2_5_9I1PairP_check_3_3 : ∀ k l : Fin 6, contains (CA2_5_9I1PairRaw ((3,3),(k,l))) (CA2_5_9I1PairP ((3,3),(k,l))) = true := by + decide +kernel +lemma CA2_5_9I1PairP_check_3_4 : ∀ k l : Fin 6, contains (CA2_5_9I1PairRaw ((3,4),(k,l))) (CA2_5_9I1PairP ((3,4),(k,l))) = true := by + decide +kernel +lemma CA2_5_9I1PairP_check_3_5 : ∀ k l : Fin 6, contains (CA2_5_9I1PairRaw ((3,5),(k,l))) (CA2_5_9I1PairP ((3,5),(k,l))) = true := by + decide +kernel +lemma CA2_5_9I1PairP_check_4_0 : ∀ k l : Fin 6, contains (CA2_5_9I1PairRaw ((4,0),(k,l))) (CA2_5_9I1PairP ((4,0),(k,l))) = true := by + decide +kernel +lemma CA2_5_9I1PairP_check_4_1 : ∀ k l : Fin 6, contains (CA2_5_9I1PairRaw ((4,1),(k,l))) (CA2_5_9I1PairP ((4,1),(k,l))) = true := by + decide +kernel +lemma CA2_5_9I1PairP_check_4_2 : ∀ k l : Fin 6, contains (CA2_5_9I1PairRaw ((4,2),(k,l))) (CA2_5_9I1PairP ((4,2),(k,l))) = true := by + decide +kernel +lemma CA2_5_9I1PairP_check_4_3 : ∀ k l : Fin 6, contains (CA2_5_9I1PairRaw ((4,3),(k,l))) (CA2_5_9I1PairP ((4,3),(k,l))) = true := by + decide +kernel +lemma CA2_5_9I1PairP_check_4_4 : ∀ k l : Fin 6, contains (CA2_5_9I1PairRaw ((4,4),(k,l))) (CA2_5_9I1PairP ((4,4),(k,l))) = true := by + decide +kernel +lemma CA2_5_9I1PairP_check_4_5 : ∀ k l : Fin 6, contains (CA2_5_9I1PairRaw ((4,5),(k,l))) (CA2_5_9I1PairP ((4,5),(k,l))) = true := by + decide +kernel +lemma CA2_5_9I1PairP_check_5_0 : ∀ k l : Fin 6, contains (CA2_5_9I1PairRaw ((5,0),(k,l))) (CA2_5_9I1PairP ((5,0),(k,l))) = true := by + decide +kernel +lemma CA2_5_9I1PairP_check_5_1 : ∀ k l : Fin 6, contains (CA2_5_9I1PairRaw ((5,1),(k,l))) (CA2_5_9I1PairP ((5,1),(k,l))) = true := by + decide +kernel +lemma CA2_5_9I1PairP_check_5_2 : ∀ k l : Fin 6, contains (CA2_5_9I1PairRaw ((5,2),(k,l))) (CA2_5_9I1PairP ((5,2),(k,l))) = true := by + decide +kernel +lemma CA2_5_9I1PairP_check_5_3 : ∀ k l : Fin 6, contains (CA2_5_9I1PairRaw ((5,3),(k,l))) (CA2_5_9I1PairP ((5,3),(k,l))) = true := by + decide +kernel +lemma CA2_5_9I1PairP_check_5_4 : ∀ k l : Fin 6, contains (CA2_5_9I1PairRaw ((5,4),(k,l))) (CA2_5_9I1PairP ((5,4),(k,l))) = true := by + decide +kernel +lemma CA2_5_9I1PairP_check_5_5 : ∀ k l : Fin 6, contains (CA2_5_9I1PairRaw ((5,5),(k,l))) (CA2_5_9I1PairP ((5,5),(k,l))) = true := by + decide +kernel +lemma CA2_5_9I1PairP_check (a : PairSlot × PairSlot) : contains (CA2_5_9I1PairRaw a) (CA2_5_9I1PairP a) = true := by + rcases a with ⟨⟨i,j⟩,⟨k,l⟩⟩ + revert j i + apply forall_fin6 + · exact forall_fin6 (CA2_5_9I1PairP_check_0_0 k l) (CA2_5_9I1PairP_check_0_1 k l) (CA2_5_9I1PairP_check_0_2 k l) (CA2_5_9I1PairP_check_0_3 k l) (CA2_5_9I1PairP_check_0_4 k l) (CA2_5_9I1PairP_check_0_5 k l) + · exact forall_fin6 (CA2_5_9I1PairP_check_1_0 k l) (CA2_5_9I1PairP_check_1_1 k l) (CA2_5_9I1PairP_check_1_2 k l) (CA2_5_9I1PairP_check_1_3 k l) (CA2_5_9I1PairP_check_1_4 k l) (CA2_5_9I1PairP_check_1_5 k l) + · exact forall_fin6 (CA2_5_9I1PairP_check_2_0 k l) (CA2_5_9I1PairP_check_2_1 k l) (CA2_5_9I1PairP_check_2_2 k l) (CA2_5_9I1PairP_check_2_3 k l) (CA2_5_9I1PairP_check_2_4 k l) (CA2_5_9I1PairP_check_2_5 k l) + · exact forall_fin6 (CA2_5_9I1PairP_check_3_0 k l) (CA2_5_9I1PairP_check_3_1 k l) (CA2_5_9I1PairP_check_3_2 k l) (CA2_5_9I1PairP_check_3_3 k l) (CA2_5_9I1PairP_check_3_4 k l) (CA2_5_9I1PairP_check_3_5 k l) + · exact forall_fin6 (CA2_5_9I1PairP_check_4_0 k l) (CA2_5_9I1PairP_check_4_1 k l) (CA2_5_9I1PairP_check_4_2 k l) (CA2_5_9I1PairP_check_4_3 k l) (CA2_5_9I1PairP_check_4_4 k l) (CA2_5_9I1PairP_check_4_5 k l) + · exact forall_fin6 (CA2_5_9I1PairP_check_5_0 k l) (CA2_5_9I1PairP_check_5_1 k l) (CA2_5_9I1PairP_check_5_2 k l) (CA2_5_9I1PairP_check_5_3 k l) (CA2_5_9I1PairP_check_5_4 k l) (CA2_5_9I1PairP_check_5_5 k l) +lemma CA2_5_9I1PairP_sound (a : PairSlot × PairSlot) : + (CA2_5_9I1PairP a).Encloses (CA2_5_9I1PairValue a) := + contains_sound (CA2_5_9I1PairRaw_sound a) (CA2_5_9I1PairP_check a) +def CA2_5_9I1PairTerms (a : PairSlot × PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_5_9I1PairCertificates (CA2_5_9I1PairCertificateIndex a)).output +lemma CA2_5_9I1PairTerms_sound (a : PairSlot × PairSlot) : + (CA2_5_9I1PairTerms a).Encloses (Foundation.entropyTerm (CA2_5_9I1PairValue a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_5_9I1PairCertificates_valid + (CA2_5_9I1PairCertificateIndex a) (CA2_5_9I1PairP_sound a) +def CA2_5_9I1PairEntropy : Ball := ⟨(16429681926455847443361379676879 / 5000000000000000000000000000000), (8661547441 / 6250000000000000000000000000000)⟩ +lemma CA2_5_9I1PairEntropy_sound : CA2_5_9I1PairEntropy.Encloses (Foundation.finiteEntropy CA2_5_9I1PairValue) := by + exact contains_sound (entropyDoublePair_enclosed CA2_5_9I1PairValue CA2_5_9I1PairTerms CA2_5_9I1PairTerms_sound) (by decide +kernel) +def CA2_5_9I1PairMass : Ball := ⟨(12499999999999999999999999999999 / 12500000000000000000000000000000), (141 / 25000000000000000000000000000000)⟩ +lemma CA2_5_9I1PairMass_sound : CA2_5_9I1PairMass.Encloses (∑ a, CA2_5_9I1PairValue a) := by + exact contains_sound (doublePairSumBall_sound CA2_5_9I1PairP CA2_5_9I1PairValue CA2_5_9I1PairP_sound) (by decide +kernel) +def CA2_5_9I1PairMassTermLogWitness : LogWitness := ⟨-1, 12499999999999999999999999999999, 6250000000000000000000000000000⟩ +def CA2_5_9I1PairMassTermLog : Ball := ⟨(-7 / 100000000000000000000000000000000), (4235164793 / 10000000000000000000000000000000)⟩ +lemma CA2_5_9I1PairMassTermLog_sound : CA2_5_9I1PairMassTermLog.Encloses (Real.log ((∑ a, CA2_5_9I1PairValue a))) := by + exact checkLog_sound logTwoBall_sound (CA2_5_9I1PairMass_sound) (w := CA2_5_9I1PairMassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA2_5_9I1PairMassTerm : Ball := ⟨(7 / 100000000000000000000000000000000), (42351647931 / 100000000000000000000000000000000)⟩ +lemma CA2_5_9I1PairMassTerm_sound : CA2_5_9I1PairMassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_5_9I1PairValue a))) := by + exact contains_sound (entropyTerm_ball (CA2_5_9I1PairMass_sound) CA2_5_9I1PairMassTermLog_sound) (by decide +kernel) +def CA2_5_9I1PairH : Ball := ⟨(328593638529116948867227593537573 / 100000000000000000000000000000000), (180936406987 / 100000000000000000000000000000000)⟩ +lemma CA2_5_9I1PairH_sound : CA2_5_9I1PairH.Encloses (homogeneousEntropy CA2_5_9I1PairValue) := by + exact contains_sound (homogeneous_enclosed CA2_5_9I1PairValue CA2_5_9I1PairMassTerm_sound CA2_5_9I1PairEntropy_sound) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CA2_5_9I1R0Value (a : PairSlot) : ℝ := residualLaw (below (shape 2 5 9)) (fun u => (stageALaw (shape 2 5 9) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 0 a +def CA2_5_9I1R0Raw (a : PairSlot) : Ball := residualBall (below (shape 2 5 9)) A2_5_9Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 0 a +lemma CA2_5_9I1R0Raw_sound (a : PairSlot) : + (CA2_5_9I1R0Raw a).Encloses (CA2_5_9I1R0Value a) := by + exact residualBall_sound_on (below (shape 2 5 9)) A2_5_9Law (fun u => (stageALaw (shape 2 5 9) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A2_5_9Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 2 5 9) (show (shape 2 5 9) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 0 a +def CA2_5_9I1R0Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(1667378902956342085611500253 / 625000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ ⟨(158107504426140389340504222457 / 10000000000000000000000000000000), (22597199 / 4000000000000000000000000000000)⟩ ⟨(-148162469387027396464920609740599 / 25000000000000000000000000000000), (211758238329 / 100000000000000000000000000000000)⟩ ⟨-9, 1667378902956342085611500253, 1220703125000000000000000000⟩] +lemma CA2_5_9I1R0Certificates_valid : + CA2_5_9I1R0Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_5_9I1R0CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 0, 0 => 1 + | _, _ => 0 +def CA2_5_9I1R0P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_5_9I1R0Certificates (CA2_5_9I1R0CertificateIndex a)).input +lemma CA2_5_9I1R0P_check : ∀ a : PairSlot, contains (CA2_5_9I1R0Raw a) (CA2_5_9I1R0P a) = true := by + decide +kernel +lemma CA2_5_9I1R0P_sound (a : PairSlot) : + (CA2_5_9I1R0P a).Encloses (CA2_5_9I1R0Value a) := + contains_sound (CA2_5_9I1R0Raw_sound a) (CA2_5_9I1R0P_check a) +def CA2_5_9I1R0Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_5_9I1R0Certificates (CA2_5_9I1R0CertificateIndex a)).output +lemma CA2_5_9I1R0Terms_sound (a : PairSlot) : + (CA2_5_9I1R0Terms a).Encloses (Foundation.entropyTerm (CA2_5_9I1R0Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_5_9I1R0Certificates_valid + (CA2_5_9I1R0CertificateIndex a) (CA2_5_9I1R0P_sound a) +def CA2_5_9I1R0Entropy : Ball := ⟨(158107504426140389340504222457 / 10000000000000000000000000000000), (22597199 / 4000000000000000000000000000000)⟩ +lemma CA2_5_9I1R0Entropy_sound : CA2_5_9I1R0Entropy.Encloses (Foundation.finiteEntropy CA2_5_9I1R0Value) := by + exact contains_sound (entropyPair_enclosed CA2_5_9I1R0Value CA2_5_9I1R0Terms CA2_5_9I1R0Terms_sound) (by decide +kernel) +def CA2_5_9I1R0Mass : Ball := ⟨(1667378902956342085611500253 / 625000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ +lemma CA2_5_9I1R0Mass_sound : CA2_5_9I1R0Mass.Encloses (∑ a, CA2_5_9I1R0Value a) := by + exact contains_sound (pairSumBall_sound CA2_5_9I1R0P CA2_5_9I1R0Value CA2_5_9I1R0P_sound) (by decide +kernel) +def CA2_5_9I1R0MassTermLogWitness : LogWitness := ⟨-9, 1667378902956342085611500253, 1220703125000000000000000000⟩ +def CA2_5_9I1R0MassTermLog : Ball := ⟨(-148162469387027396464920609740599 / 25000000000000000000000000000000), (211758238329 / 100000000000000000000000000000000)⟩ +lemma CA2_5_9I1R0MassTermLog_sound : CA2_5_9I1R0MassTermLog.Encloses (Real.log ((∑ a, CA2_5_9I1R0Value a))) := by + exact checkLog_sound logTwoBall_sound (CA2_5_9I1R0Mass_sound) (w := CA2_5_9I1R0MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA2_5_9I1R0MassTerm : Ball := ⟨(158107504426140389340504222457 / 10000000000000000000000000000000), (22597199 / 4000000000000000000000000000000)⟩ +lemma CA2_5_9I1R0MassTerm_sound : CA2_5_9I1R0MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_5_9I1R0Value a))) := by + exact contains_sound (entropyTerm_ball (CA2_5_9I1R0Mass_sound) CA2_5_9I1R0MassTermLog_sound) (by decide +kernel) +def CA2_5_9I1R0H : Ball := ⟨0, (22597199 / 2000000000000000000000000000000)⟩ +lemma CA2_5_9I1R0H_sound : CA2_5_9I1R0H.Encloses (homogeneousEntropy CA2_5_9I1R0Value) := by + exact contains_sound (homogeneous_enclosed CA2_5_9I1R0Value CA2_5_9I1R0MassTerm_sound CA2_5_9I1R0Entropy_sound) (by decide +kernel) +def CA2_5_9I1R1Value (a : PairSlot) : ℝ := residualLaw (below (shape 2 5 9)) (fun u => (stageALaw (shape 2 5 9) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 1 a +def CA2_5_9I1R1Raw (a : PairSlot) : Ball := residualBall (below (shape 2 5 9)) A2_5_9Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 1 a +lemma CA2_5_9I1R1Raw_sound (a : PairSlot) : + (CA2_5_9I1R1Raw a).Encloses (CA2_5_9I1R1Value a) := by + exact residualBall_sound_on (below (shape 2 5 9)) A2_5_9Law (fun u => (stageALaw (shape 2 5 9) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A2_5_9Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 2 5 9) (show (shape 2 5 9) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 1 a +def CA2_5_9I1R1Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(1053102465437805853118592288551 / 25000000000000000000000000000000), (21 / 100000000000000000000000000000000)⟩ ⟨(6670635961056939163159896733377 / 50000000000000000000000000000000), (5352074999 / 100000000000000000000000000000000)⟩ ⟨(-316713528834241140507177538837023 / 100000000000000000000000000000000), (31763735649 / 25000000000000000000000000000000)⟩ ⟨-5, 1053102465437805853118592288551, 781250000000000000000000000000⟩] +lemma CA2_5_9I1R1Certificates_valid : + CA2_5_9I1R1Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_5_9I1R1CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 1, 0 => 1 + | 0, 1 => 1 + | _, _ => 0 +def CA2_5_9I1R1P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_5_9I1R1Certificates (CA2_5_9I1R1CertificateIndex a)).input +lemma CA2_5_9I1R1P_check : ∀ a : PairSlot, contains (CA2_5_9I1R1Raw a) (CA2_5_9I1R1P a) = true := by + decide +kernel +lemma CA2_5_9I1R1P_sound (a : PairSlot) : + (CA2_5_9I1R1P a).Encloses (CA2_5_9I1R1Value a) := + contains_sound (CA2_5_9I1R1Raw_sound a) (CA2_5_9I1R1P_check a) +def CA2_5_9I1R1Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_5_9I1R1Certificates (CA2_5_9I1R1CertificateIndex a)).output +lemma CA2_5_9I1R1Terms_sound (a : PairSlot) : + (CA2_5_9I1R1Terms a).Encloses (Foundation.entropyTerm (CA2_5_9I1R1Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_5_9I1R1Certificates_valid + (CA2_5_9I1R1CertificateIndex a) (CA2_5_9I1R1P_sound a) +def CA2_5_9I1R1Entropy : Ball := ⟨(6670635961056939163159896733377 / 25000000000000000000000000000000), (5352074999 / 50000000000000000000000000000000)⟩ +lemma CA2_5_9I1R1Entropy_sound : CA2_5_9I1R1Entropy.Encloses (Foundation.finiteEntropy CA2_5_9I1R1Value) := by + exact contains_sound (entropyPair_enclosed CA2_5_9I1R1Value CA2_5_9I1R1Terms CA2_5_9I1R1Terms_sound) (by decide +kernel) +def CA2_5_9I1R1Mass : Ball := ⟨(1053102465437805853118592288551 / 12500000000000000000000000000000), (21 / 50000000000000000000000000000000)⟩ +lemma CA2_5_9I1R1Mass_sound : CA2_5_9I1R1Mass.Encloses (∑ a, CA2_5_9I1R1Value a) := by + exact contains_sound (pairSumBall_sound CA2_5_9I1R1P CA2_5_9I1R1Value CA2_5_9I1R1P_sound) (by decide +kernel) +def CA2_5_9I1R1MassTermLogWitness : LogWitness := ⟨-4, 1053102465437805853118592288551, 781250000000000000000000000000⟩ +def CA2_5_9I1R1MassTermLog : Ball := ⟨(-247398810778246609565454345786693 / 100000000000000000000000000000000), (105879118913 / 100000000000000000000000000000000)⟩ +lemma CA2_5_9I1R1MassTermLog_sound : CA2_5_9I1R1MassTermLog.Encloses (Real.log ((∑ a, CA2_5_9I1R1Value a))) := by + exact checkLog_sound logTwoBall_sound (CA2_5_9I1R1Mass_sound) (w := CA2_5_9I1R1MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA2_5_9I1R1MassTerm : Ball := ⟨(10421451903078108812982719691723 / 50000000000000000000000000000000), (4460062499 / 50000000000000000000000000000000)⟩ +lemma CA2_5_9I1R1MassTerm_sound : CA2_5_9I1R1MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_5_9I1R1Value a))) := by + exact contains_sound (entropyTerm_ball (CA2_5_9I1R1Mass_sound) CA2_5_9I1R1MassTermLog_sound) (by decide +kernel) +def CA2_5_9I1R1H : Ball := ⟨(2919820019035769513337073775031 / 50000000000000000000000000000000), (4906068749 / 25000000000000000000000000000000)⟩ +lemma CA2_5_9I1R1H_sound : CA2_5_9I1R1H.Encloses (homogeneousEntropy CA2_5_9I1R1Value) := by + exact contains_sound (homogeneous_enclosed CA2_5_9I1R1Value CA2_5_9I1R1MassTerm_sound CA2_5_9I1R1Entropy_sound) (by decide +kernel) +def CA2_5_9I1R2Value (a : PairSlot) : ℝ := residualLaw (below (shape 2 5 9)) (fun u => (stageALaw (shape 2 5 9) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 2 a +def CA2_5_9I1R2Raw (a : PairSlot) : Ball := residualBall (below (shape 2 5 9)) A2_5_9Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 2 a +lemma CA2_5_9I1R2Raw_sound (a : PairSlot) : + (CA2_5_9I1R2Raw a).Encloses (CA2_5_9I1R2Value a) := by + exact residualBall_sound_on (below (shape 2 5 9)) A2_5_9Law (fun u => (stageALaw (shape 2 5 9) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A2_5_9Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 2 5 9) (show (shape 2 5 9) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 2 a +def CA2_5_9I1R2Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(1387104374136000975643699015979 / 20000000000000000000000000000000), (31 / 100000000000000000000000000000000)⟩ ⟨(18507536400064431315685081733191 / 100000000000000000000000000000000), (917908691 / 12500000000000000000000000000000)⟩ ⟨(-10674055533329219453488845751113 / 4000000000000000000000000000000), (105879118861 / 100000000000000000000000000000000)⟩ ⟨-4, 1387104374136000975643699015979, 1250000000000000000000000000000⟩, + .log ⟨(712820862687348093873419338537 / 100000000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ ⟨(3523969163294129789506413610911 / 100000000000000000000000000000000), (679255613 / 50000000000000000000000000000000)⟩ ⟨(-247184766030044322285874091146451 / 50000000000000000000000000000000), (47645603427 / 25000000000000000000000000000000)⟩ ⟨-8, 712820862687348093873419338537, 390625000000000000000000000000⟩, + .log ⟨(3251464273161229062146199101781 / 12500000000000000000000000000000), (33 / 50000000000000000000000000000000)⟩ ⟨(35027977893662315005374984049149 / 100000000000000000000000000000000), (8262292177 / 50000000000000000000000000000000)⟩ ⟨(-134662320384372698886236201504337 / 100000000000000000000000000000000), (31763735651 / 50000000000000000000000000000000)⟩ ⟨-2, 3251464273161229062146199101781, 3125000000000000000000000000000⟩] +lemma CA2_5_9I1R2Certificates_valid : + CA2_5_9I1R2Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_5_9I1R2CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 2, 0 => 1 + | 3, 0 => 2 + | 1, 1 => 3 + | 0, 2 => 1 + | 0, 3 => 2 + | _, _ => 0 +def CA2_5_9I1R2P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_5_9I1R2Certificates (CA2_5_9I1R2CertificateIndex a)).input +lemma CA2_5_9I1R2P_check : ∀ a : PairSlot, contains (CA2_5_9I1R2Raw a) (CA2_5_9I1R2P a) = true := by + decide +kernel +lemma CA2_5_9I1R2P_sound (a : PairSlot) : + (CA2_5_9I1R2P a).Encloses (CA2_5_9I1R2Value a) := + contains_sound (CA2_5_9I1R2Raw_sound a) (CA2_5_9I1R2P_check a) +def CA2_5_9I1R2Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_5_9I1R2Certificates (CA2_5_9I1R2CertificateIndex a)).output +lemma CA2_5_9I1R2Terms_sound (a : PairSlot) : + (CA2_5_9I1R2Terms a).Encloses (Foundation.entropyTerm (CA2_5_9I1R2Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_5_9I1R2Certificates_valid + (CA2_5_9I1R2CertificateIndex a) (CA2_5_9I1R2P_sound a) +def CA2_5_9I1R2Entropy : Ball := ⟨(79090989020379437215757974737353 / 100000000000000000000000000000000), (16964072931 / 50000000000000000000000000000000)⟩ +lemma CA2_5_9I1R2Entropy_sound : CA2_5_9I1R2Entropy.Encloses (Foundation.finiteEntropy CA2_5_9I1R2Value) := by + exact contains_sound (entropyPair_enclosed CA2_5_9I1R2Value CA2_5_9I1R2Terms CA2_5_9I1R2Terms_sound) (by decide +kernel) +def CA2_5_9I1R2Mass : Ball := ⟨(5163549956503067305169177706389 / 12500000000000000000000000000000), (17 / 12500000000000000000000000000000)⟩ +lemma CA2_5_9I1R2Mass_sound : CA2_5_9I1R2Mass.Encloses (∑ a, CA2_5_9I1R2Value a) := by + exact contains_sound (pairSumBall_sound CA2_5_9I1R2P CA2_5_9I1R2Value CA2_5_9I1R2P_sound) (by decide +kernel) +def CA2_5_9I1R2MassTermLogWitness : LogWitness := ⟨-2, 5163549956503067305169177706389, 3125000000000000000000000000000⟩ +def CA2_5_9I1R2MassTermLog : Ball := ⟨(-22102608132383648426747574327047 / 25000000000000000000000000000000), (31763735689 / 50000000000000000000000000000000)⟩ +lemma CA2_5_9I1R2MassTermLog_sound : CA2_5_9I1R2MassTermLog.Encloses (Real.log ((∑ a, CA2_5_9I1R2Value a))) := by + exact checkLog_sound logTwoBall_sound (CA2_5_9I1R2Mass_sound) (w := CA2_5_9I1R2MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA2_5_9I1R2MassTerm : Ball := ⟨(18260467401691828723107280068591 / 50000000000000000000000000000000), (26242181887 / 100000000000000000000000000000000)⟩ +lemma CA2_5_9I1R2MassTerm_sound : CA2_5_9I1R2MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_5_9I1R2Value a))) := by + exact contains_sound (entropyTerm_ball (CA2_5_9I1R2Mass_sound) CA2_5_9I1R2MassTermLog_sound) (by decide +kernel) +def CA2_5_9I1R2H : Ball := ⟨(42570054216995779769543414600171 / 100000000000000000000000000000000), (60170327749 / 100000000000000000000000000000000)⟩ +lemma CA2_5_9I1R2H_sound : CA2_5_9I1R2H.Encloses (homogeneousEntropy CA2_5_9I1R2Value) := by + exact contains_sound (homogeneous_enclosed CA2_5_9I1R2Value CA2_5_9I1R2MassTerm_sound CA2_5_9I1R2Entropy_sound) (by decide +kernel) +def CA2_5_9I1R3Value (a : PairSlot) : ℝ := residualLaw (below (shape 2 5 9)) (fun u => (stageALaw (shape 2 5 9) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 3 a +def CA2_5_9I1R3Raw (a : PairSlot) : Ball := residualBall (below (shape 2 5 9)) A2_5_9Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 3 a +lemma CA2_5_9I1R3Raw_sound (a : PairSlot) : + (CA2_5_9I1R3Raw a).Encloses (CA2_5_9I1R3Value a) := by + exact residualBall_sound_on (below (shape 2 5 9)) A2_5_9Law (fun u => (stageALaw (shape 2 5 9) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A2_5_9Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 2 5 9) (show (shape 2 5 9) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 3 a +def CA2_5_9I1R3Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(757077704173845117270525934463 / 100000000000000000000000000000000), (1 / 20000000000000000000000000000000)⟩ ⟨(1848579179567801739232915360923 / 50000000000000000000000000000000), (360714247 / 25000000000000000000000000000000)⟩ ⟨(-244172978463954201784196004312511 / 50000000000000000000000000000000), (190582413807 / 100000000000000000000000000000000)⟩ ⟨-8, 757077704173845117270525934463, 390625000000000000000000000000⟩, + .log ⟨(18174275226661133832946939454377 / 100000000000000000000000000000000), (1 / 2000000000000000000000000000000)⟩ ⟨(30990102410762529748110608284967 / 100000000000000000000000000000000), (15394210047 / 100000000000000000000000000000000)⟩ ⟨(-170516304085133198098477550097527 / 100000000000000000000000000000000), (84703295007 / 100000000000000000000000000000000)⟩ ⟨-3, 18174275226661133832946939454377, 12500000000000000000000000000000⟩, + .log ⟨(430711723794322567614811359179 / 25000000000000000000000000000000), (1 / 20000000000000000000000000000000)⟩ ⟨(6996812186136387755160203483507 / 100000000000000000000000000000000), (638447293 / 25000000000000000000000000000000)⟩ ⟨(-406119209183493807255103685890127 / 100000000000000000000000000000000), (14823076607 / 10000000000000000000000000000000)⟩ ⟨-6, 430711723794322567614811359179, 390625000000000000000000000000⟩] +lemma CA2_5_9I1R3Certificates_valid : + CA2_5_9I1R3Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_5_9I1R3CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 4, 0 => 1 + | 2, 1 => 2 + | 3, 1 => 3 + | 1, 2 => 2 + | 1, 3 => 3 + | 0, 4 => 1 + | _, _ => 0 +def CA2_5_9I1R3P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_5_9I1R3Certificates (CA2_5_9I1R3CertificateIndex a)).input +lemma CA2_5_9I1R3P_check : ∀ a : PairSlot, contains (CA2_5_9I1R3Raw a) (CA2_5_9I1R3P a) = true := by + decide +kernel +lemma CA2_5_9I1R3P_sound (a : PairSlot) : + (CA2_5_9I1R3P a).Encloses (CA2_5_9I1R3Value a) := + contains_sound (CA2_5_9I1R3Raw_sound a) (CA2_5_9I1R3P_check a) +def CA2_5_9I1R3Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_5_9I1R3Certificates (CA2_5_9I1R3CertificateIndex a)).output +lemma CA2_5_9I1R3Terms_sound (a : PairSlot) : + (CA2_5_9I1R3Terms a).Encloses (Foundation.entropyTerm (CA2_5_9I1R3Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_5_9I1R3Certificates_valid + (CA2_5_9I1R3CertificateIndex a) (CA2_5_9I1R3P_sound a) +def CA2_5_9I1R3Entropy : Ball := ⟨(521050911950431512271708031129 / 625000000000000000000000000000), (19390856207 / 50000000000000000000000000000000)⟩ +lemma CA2_5_9I1R3Entropy_sound : CA2_5_9I1R3Entropy.Encloses (Foundation.finiteEntropy CA2_5_9I1R3Value) := by + exact contains_sound (entropyPair_enclosed CA2_5_9I1R3Value CA2_5_9I1R3Terms CA2_5_9I1R3Terms_sound) (by decide +kernel) +def CA2_5_9I1R3Mass : Ball := ⟨(5163549956503067305169177706389 / 12500000000000000000000000000000), (3 / 2500000000000000000000000000000)⟩ +lemma CA2_5_9I1R3Mass_sound : CA2_5_9I1R3Mass.Encloses (∑ a, CA2_5_9I1R3Value a) := by + exact contains_sound (pairSumBall_sound CA2_5_9I1R3P CA2_5_9I1R3Value CA2_5_9I1R3P_sound) (by decide +kernel) +def CA2_5_9I1R3MassTermLogWitness : LogWitness := ⟨-2, 5163549956503067305169177706389, 3125000000000000000000000000000⟩ +def CA2_5_9I1R3MassTermLog : Ball := ⟨(-22102608132383648426747574327047 / 25000000000000000000000000000000), (63527471339 / 100000000000000000000000000000000)⟩ +lemma CA2_5_9I1R3MassTermLog_sound : CA2_5_9I1R3MassTermLog.Encloses (Real.log ((∑ a, CA2_5_9I1R3Value a))) := by + exact checkLog_sound logTwoBall_sound (CA2_5_9I1R3Mass_sound) (w := CA2_5_9I1R3MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA2_5_9I1R3MassTerm : Ball := ⟨(18260467401691828723107280068591 / 50000000000000000000000000000000), (820068183 / 3125000000000000000000000000000)⟩ +lemma CA2_5_9I1R3MassTerm_sound : CA2_5_9I1R3MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_5_9I1R3Value a))) := by + exact contains_sound (entropyTerm_ball (CA2_5_9I1R3Mass_sound) CA2_5_9I1R3MassTermLog_sound) (by decide +kernel) +def CA2_5_9I1R3H : Ball := ⟨(23423605554342692258629362421729 / 50000000000000000000000000000000), (6502389427 / 10000000000000000000000000000000)⟩ +lemma CA2_5_9I1R3H_sound : CA2_5_9I1R3H.Encloses (homogeneousEntropy CA2_5_9I1R3Value) := by + exact contains_sound (homogeneous_enclosed CA2_5_9I1R3Value CA2_5_9I1R3MassTerm_sound CA2_5_9I1R3Entropy_sound) (by decide +kernel) +def CA2_5_9I1R4Value (a : PairSlot) : ℝ := residualLaw (below (shape 2 5 9)) (fun u => (stageALaw (shape 2 5 9) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 4 a +def CA2_5_9I1R4Raw (a : PairSlot) : Ball := residualBall (below (shape 2 5 9)) A2_5_9Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 4 a +lemma CA2_5_9I1R4Raw_sound (a : PairSlot) : + (CA2_5_9I1R4Raw a).Encloses (CA2_5_9I1R4Value a) := by + exact residualBall_sound_on (below (shape 2 5 9)) A2_5_9Law (fun u => (stageALaw (shape 2 5 9) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A2_5_9Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 2 5 9) (show (shape 2 5 9) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 4 a +def CA2_5_9I1R4Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(406470096200288560025402877 / 3125000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(1818432276703039405011623079 / 1562500000000000000000000000000), (3856089 / 10000000000000000000000000000000)⟩ ⟨(-894743447895367447230847165124161 / 100000000000000000000000000000000), (296461539249 / 100000000000000000000000000000000)⟩ ⟨-13, 406470096200288560025402877, 381469726562500000000000000⟩, + .log ⟨(97690066787711583919526744233 / 10000000000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ ⟨(4521624294650324365649214543539 / 100000000000000000000000000000000), (827467069 / 50000000000000000000000000000000)⟩ ⟨(-462854048864167495824321980858687 / 100000000000000000000000000000000), (84703295039 / 50000000000000000000000000000000)⟩ ⟨-7, 97690066787711583919526744233, 78125000000000000000000000000⟩, + .log ⟨(5420130103452163346996297743061 / 100000000000000000000000000000000), (3 / 10000000000000000000000000000000)⟩ ⟨(1974994030566659239713842560509 / 12500000000000000000000000000000), (6886543283 / 100000000000000000000000000000000)⟩ ⟨(-145752518324883418276614478839423 / 50000000000000000000000000000000), (127054942651 / 100000000000000000000000000000000)⟩ ⟨-5, 5420130103452163346996297743061, 3125000000000000000000000000000⟩, + .log ⟨(122436640021604194836528458687 / 25000000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ ⟨(520996057057169791070579025991 / 20000000000000000000000000000000), (933370839 / 100000000000000000000000000000000)⟩ ⟨(-53190374319856271604220624106153 / 10000000000000000000000000000000), (190582413963 / 100000000000000000000000000000000)⟩ ⟨-8, 122436640021604194836528458687, 97656250000000000000000000000⟩, + .log ⟨(22690538983199886514026113531 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(349335833916113075987820257223 / 100000000000000000000000000000000), (124927631 / 100000000000000000000000000000000)⟩ ⟨(-153956604633658953171578960304171 / 20000000000000000000000000000000), (137642855041 / 50000000000000000000000000000000)⟩ ⟨-12, 22690538983199886514026113531, 12207031250000000000000000000⟩] +lemma CA2_5_9I1R4Certificates_valid : + CA2_5_9I1R4Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_5_9I1R4CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 0, 5 => 1 + | 1, 4 => 2 + | 2, 2 => 3 + | 2, 3 => 4 + | 3, 2 => 4 + | 3, 3 => 5 + | 4, 1 => 2 + | 5, 0 => 1 + | _, _ => 0 +def CA2_5_9I1R4P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_5_9I1R4Certificates (CA2_5_9I1R4CertificateIndex a)).input +lemma CA2_5_9I1R4P_check : ∀ a : PairSlot, contains (CA2_5_9I1R4Raw a) (CA2_5_9I1R4P a) = true := by + decide +kernel +lemma CA2_5_9I1R4P_sound (a : PairSlot) : + (CA2_5_9I1R4P a).Encloses (CA2_5_9I1R4Value a) := + contains_sound (CA2_5_9I1R4Raw_sound a) (CA2_5_9I1R4P_check a) +def CA2_5_9I1R4Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_5_9I1R4Certificates (CA2_5_9I1R4CertificateIndex a)).output +lemma CA2_5_9I1R4Terms_sound (a : PairSlot) : + (CA2_5_9I1R4Terms a).Encloses (Foundation.entropyTerm (CA2_5_9I1R4Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_5_9I1R4Certificates_valid + (CA2_5_9I1R4CertificateIndex a) (CA2_5_9I1R4P_sound a) +def CA2_5_9I1R4Entropy : Ball := ⟨(6127051313947944535908853568479 / 20000000000000000000000000000000), (1533150331 / 12500000000000000000000000000000)⟩ +lemma CA2_5_9I1R4Entropy_sound : CA2_5_9I1R4Entropy.Encloses (Foundation.finiteEntropy CA2_5_9I1R4Value) := by + exact contains_sound (entropyPair_enclosed CA2_5_9I1R4Value CA2_5_9I1R4Terms CA2_5_9I1R4Terms_sound) (by decide +kernel) +def CA2_5_9I1R4Mass : Ball := ⟨(8424819723502446824948738308407 / 100000000000000000000000000000000), (53 / 100000000000000000000000000000000)⟩ +lemma CA2_5_9I1R4Mass_sound : CA2_5_9I1R4Mass.Encloses (∑ a, CA2_5_9I1R4Value a) := by + exact contains_sound (pairSumBall_sound CA2_5_9I1R4P CA2_5_9I1R4Value CA2_5_9I1R4P_sound) (by decide +kernel) +def CA2_5_9I1R4MassTermLogWitness : LogWitness := ⟨-4, 8424819723502446824948738308407, 6250000000000000000000000000000⟩ +def CA2_5_9I1R4MassTermLog : Ball := ⟨(-49479762155649321913090869157341 / 20000000000000000000000000000000), (26469779761 / 25000000000000000000000000000000)⟩ +lemma CA2_5_9I1R4MassTermLog_sound : CA2_5_9I1R4MassTermLog.Encloses (Real.log ((∑ a, CA2_5_9I1R4Value a))) := by + exact checkLog_sound logTwoBall_sound (CA2_5_9I1R4Mass_sound) (w := CA2_5_9I1R4MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA2_5_9I1R4MassTerm : Ball := ⟨(4168580761231243525193087876689 / 20000000000000000000000000000000), (2230031259 / 25000000000000000000000000000000)⟩ +lemma CA2_5_9I1R4MassTerm_sound : CA2_5_9I1R4MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_5_9I1R4Value a))) := by + exact contains_sound (entropyTerm_ball (CA2_5_9I1R4Mass_sound) CA2_5_9I1R4MassTermLog_sound) (by decide +kernel) +def CA2_5_9I1R4H : Ball := ⟨(195847055271670101071576569179 / 2000000000000000000000000000000), (5296331921 / 25000000000000000000000000000000)⟩ +lemma CA2_5_9I1R4H_sound : CA2_5_9I1R4H.Encloses (homogeneousEntropy CA2_5_9I1R4Value) := by + exact contains_sound (homogeneous_enclosed CA2_5_9I1R4Value CA2_5_9I1R4MassTerm_sound CA2_5_9I1R4Entropy_sound) (by decide +kernel) +def CA2_5_9I1R5Value (a : PairSlot) : ℝ := residualLaw (below (shape 2 5 9)) (fun u => (stageALaw (shape 2 5 9) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 5 a +def CA2_5_9I1R5Raw (a : PairSlot) : Ball := residualBall (below (shape 2 5 9)) A2_5_9Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 5 a +lemma CA2_5_9I1R5Raw_sound (a : PairSlot) : + (CA2_5_9I1R5Raw a).Encloses (CA2_5_9I1R5Value a) := by + exact residualBall_sound_on (below (shape 2 5 9)) A2_5_9Law (fun u => (stageALaw (shape 2 5 9) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A2_5_9Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 2 5 9) (show (shape 2 5 9) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 5 a +def CA2_5_9I1R5Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(2745981867591502035041794869 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(53874184830190808013575710667 / 100000000000000000000000000000000), (18607509 / 100000000000000000000000000000000)⟩ ⟨(-61310247376837881701171708132229 / 6250000000000000000000000000000), (21175824821 / 6250000000000000000000000000000)⟩ ⟨-15, 2745981867591502035041794869, 1525878906250000000000000000⟩, + .log ⟨(58767960382992480839007727889 / 50000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ ⟨(396459325333626947251218852751 / 50000000000000000000000000000000), (273781217 / 100000000000000000000000000000000)⟩ ⟨(-168654536736467528425815810214747 / 25000000000000000000000000000000), (46586812613 / 20000000000000000000000000000000)⟩ ⟨-10, 58767960382992480839007727889, 48828125000000000000000000000⟩, + .log ⟨(2590606933834850275205243681 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(1485508891101424430870622729 / 1562500000000000000000000000000), (4114369 / 12500000000000000000000000000000)⟩ ⟨(-114684236477545441583647027058547 / 12500000000000000000000000000000), (63527472979 / 20000000000000000000000000000000)⟩ ⟨-14, 2590606933834850275205243681, 1525878906250000000000000000⟩] +lemma CA2_5_9I1R5Certificates_valid : + CA2_5_9I1R5Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_5_9I1R5CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 1, 5 => 1 + | 2, 4 => 2 + | 3, 4 => 3 + | 4, 2 => 2 + | 4, 3 => 3 + | 5, 1 => 1 + | _, _ => 0 +def CA2_5_9I1R5P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_5_9I1R5Certificates (CA2_5_9I1R5CertificateIndex a)).input +lemma CA2_5_9I1R5P_check : ∀ a : PairSlot, contains (CA2_5_9I1R5Raw a) (CA2_5_9I1R5P a) = true := by + decide +kernel +lemma CA2_5_9I1R5P_sound (a : PairSlot) : + (CA2_5_9I1R5P a).Encloses (CA2_5_9I1R5Value a) := + contains_sound (CA2_5_9I1R5Raw_sound a) (CA2_5_9I1R5P_check a) +def CA2_5_9I1R5Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_5_9I1R5Certificates (CA2_5_9I1R5CertificateIndex a)).output +lemma CA2_5_9I1R5Terms_sound (a : PairSlot) : + (CA2_5_9I1R5Terms a).Encloses (Foundation.entropyTerm (CA2_5_9I1R5Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_5_9I1R5Certificates_valid + (CA2_5_9I1R5CertificateIndex a) (CA2_5_9I1R5P_sound a) +def CA2_5_9I1R5Entropy : Ball := ⟨(37674616181117434643669330833 / 2000000000000000000000000000000), (162651839 / 25000000000000000000000000000000)⟩ +lemma CA2_5_9I1R5Entropy_sound : CA2_5_9I1R5Entropy.Encloses (Foundation.finiteEntropy CA2_5_9I1R5Value) := by + exact contains_sound (entropyPair_enclosed CA2_5_9I1R5Value CA2_5_9I1R5Terms CA2_5_9I1R5Terms_sound) (by decide +kernel) +def CA2_5_9I1R5Mass : Ball := ⟨(1667378902956342085611500253 / 625000000000000000000000000000), (1 / 10000000000000000000000000000000)⟩ +lemma CA2_5_9I1R5Mass_sound : CA2_5_9I1R5Mass.Encloses (∑ a, CA2_5_9I1R5Value a) := by + exact contains_sound (pairSumBall_sound CA2_5_9I1R5P CA2_5_9I1R5Value CA2_5_9I1R5P_sound) (by decide +kernel) +def CA2_5_9I1R5MassTermLogWitness : LogWitness := ⟨-9, 1667378902956342085611500253, 1220703125000000000000000000⟩ +def CA2_5_9I1R5MassTermLog : Ball := ⟨(-148162469387027396464920609740599 / 25000000000000000000000000000000), (105879120289 / 50000000000000000000000000000000)⟩ +lemma CA2_5_9I1R5MassTermLog_sound : CA2_5_9I1R5MassTermLog.Encloses (Real.log ((∑ a, CA2_5_9I1R5Value a))) := by + exact checkLog_sound logTwoBall_sound (CA2_5_9I1R5Mass_sound) (w := CA2_5_9I1R5MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA2_5_9I1R5MassTerm : Ball := ⟨(158107504426140389340504222457 / 10000000000000000000000000000000), (564930017 / 100000000000000000000000000000000)⟩ +lemma CA2_5_9I1R5MassTerm_sound : CA2_5_9I1R5MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_5_9I1R5Value a))) := by + exact contains_sound (entropyTerm_ball (CA2_5_9I1R5Mass_sound) CA2_5_9I1R5MassTermLog_sound) (by decide +kernel) +def CA2_5_9I1R5H : Ball := ⟨(7566394119861695969460607927 / 2500000000000000000000000000000), (1215537373 / 100000000000000000000000000000000)⟩ +lemma CA2_5_9I1R5H_sound : CA2_5_9I1R5H.Encloses (homogeneousEntropy CA2_5_9I1R5Value) := by + exact contains_sound (homogeneous_enclosed CA2_5_9I1R5Value CA2_5_9I1R5MassTerm_sound CA2_5_9I1R5Entropy_sound) (by decide +kernel) +def CA2_5_9I1R6Value (a : PairSlot) : ℝ := residualLaw (below (shape 2 5 9)) (fun u => (stageALaw (shape 2 5 9) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 6 a +def CA2_5_9I1R6Raw (a : PairSlot) : Ball := residualBall (below (shape 2 5 9)) A2_5_9Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 6 a +lemma CA2_5_9I1R6Raw_sound (a : PairSlot) : + (CA2_5_9I1R6Raw a).Encloses (CA2_5_9I1R6Value a) := by + exact residualBall_sound_on (below (shape 2 5 9)) A2_5_9Law (fun u => (stageALaw (shape 2 5 9) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A2_5_9Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 2 5 9) (show (shape 2 5 9) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 6 a +def CA2_5_9I1R6Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA2_5_9I1R6Certificates_valid : + CA2_5_9I1R6Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_5_9I1R6CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA2_5_9I1R6P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_5_9I1R6Certificates (CA2_5_9I1R6CertificateIndex a)).input +lemma CA2_5_9I1R6P_check : ∀ a : PairSlot, contains (CA2_5_9I1R6Raw a) (CA2_5_9I1R6P a) = true := by + decide +kernel +lemma CA2_5_9I1R6P_sound (a : PairSlot) : + (CA2_5_9I1R6P a).Encloses (CA2_5_9I1R6Value a) := + contains_sound (CA2_5_9I1R6Raw_sound a) (CA2_5_9I1R6P_check a) +def CA2_5_9I1R6Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_5_9I1R6Certificates (CA2_5_9I1R6CertificateIndex a)).output +lemma CA2_5_9I1R6Terms_sound (a : PairSlot) : + (CA2_5_9I1R6Terms a).Encloses (Foundation.entropyTerm (CA2_5_9I1R6Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_5_9I1R6Certificates_valid + (CA2_5_9I1R6CertificateIndex a) (CA2_5_9I1R6P_sound a) +def CA2_5_9I1R6Entropy : Ball := ⟨0, 0⟩ +lemma CA2_5_9I1R6Entropy_sound : CA2_5_9I1R6Entropy.Encloses (Foundation.finiteEntropy CA2_5_9I1R6Value) := by + exact contains_sound (entropyPair_enclosed CA2_5_9I1R6Value CA2_5_9I1R6Terms CA2_5_9I1R6Terms_sound) (by decide +kernel) +def CA2_5_9I1R6Mass : Ball := ⟨0, 0⟩ +lemma CA2_5_9I1R6Mass_sound : CA2_5_9I1R6Mass.Encloses (∑ a, CA2_5_9I1R6Value a) := by + exact contains_sound (pairSumBall_sound CA2_5_9I1R6P CA2_5_9I1R6Value CA2_5_9I1R6P_sound) (by decide +kernel) +def CA2_5_9I1R6MassTerm : Ball := .exact 0 +lemma CA2_5_9I1R6MassTerm_sound : CA2_5_9I1R6MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_5_9I1R6Value a))) := + entropyTerm_zero_ball (CA2_5_9I1R6Mass_sound) +def CA2_5_9I1R6H : Ball := ⟨0, 0⟩ +lemma CA2_5_9I1R6H_sound : CA2_5_9I1R6H.Encloses (homogeneousEntropy CA2_5_9I1R6Value) := by + exact contains_sound (homogeneous_enclosed CA2_5_9I1R6Value CA2_5_9I1R6MassTerm_sound CA2_5_9I1R6Entropy_sound) (by decide +kernel) +def CA2_5_9I1R7Value (a : PairSlot) : ℝ := residualLaw (below (shape 2 5 9)) (fun u => (stageALaw (shape 2 5 9) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 7 a +def CA2_5_9I1R7Raw (a : PairSlot) : Ball := residualBall (below (shape 2 5 9)) A2_5_9Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 7 a +lemma CA2_5_9I1R7Raw_sound (a : PairSlot) : + (CA2_5_9I1R7Raw a).Encloses (CA2_5_9I1R7Value a) := by + exact residualBall_sound_on (below (shape 2 5 9)) A2_5_9Law (fun u => (stageALaw (shape 2 5 9) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A2_5_9Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 2 5 9) (show (shape 2 5 9) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 7 a +def CA2_5_9I1R7Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA2_5_9I1R7Certificates_valid : + CA2_5_9I1R7Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_5_9I1R7CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA2_5_9I1R7P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_5_9I1R7Certificates (CA2_5_9I1R7CertificateIndex a)).input +lemma CA2_5_9I1R7P_check : ∀ a : PairSlot, contains (CA2_5_9I1R7Raw a) (CA2_5_9I1R7P a) = true := by + decide +kernel +lemma CA2_5_9I1R7P_sound (a : PairSlot) : + (CA2_5_9I1R7P a).Encloses (CA2_5_9I1R7Value a) := + contains_sound (CA2_5_9I1R7Raw_sound a) (CA2_5_9I1R7P_check a) +def CA2_5_9I1R7Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_5_9I1R7Certificates (CA2_5_9I1R7CertificateIndex a)).output +lemma CA2_5_9I1R7Terms_sound (a : PairSlot) : + (CA2_5_9I1R7Terms a).Encloses (Foundation.entropyTerm (CA2_5_9I1R7Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_5_9I1R7Certificates_valid + (CA2_5_9I1R7CertificateIndex a) (CA2_5_9I1R7P_sound a) +def CA2_5_9I1R7Entropy : Ball := ⟨0, 0⟩ +lemma CA2_5_9I1R7Entropy_sound : CA2_5_9I1R7Entropy.Encloses (Foundation.finiteEntropy CA2_5_9I1R7Value) := by + exact contains_sound (entropyPair_enclosed CA2_5_9I1R7Value CA2_5_9I1R7Terms CA2_5_9I1R7Terms_sound) (by decide +kernel) +def CA2_5_9I1R7Mass : Ball := ⟨0, 0⟩ +lemma CA2_5_9I1R7Mass_sound : CA2_5_9I1R7Mass.Encloses (∑ a, CA2_5_9I1R7Value a) := by + exact contains_sound (pairSumBall_sound CA2_5_9I1R7P CA2_5_9I1R7Value CA2_5_9I1R7P_sound) (by decide +kernel) +def CA2_5_9I1R7MassTerm : Ball := .exact 0 +lemma CA2_5_9I1R7MassTerm_sound : CA2_5_9I1R7MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_5_9I1R7Value a))) := + entropyTerm_zero_ball (CA2_5_9I1R7Mass_sound) +def CA2_5_9I1R7H : Ball := ⟨0, 0⟩ +lemma CA2_5_9I1R7H_sound : CA2_5_9I1R7H.Encloses (homogeneousEntropy CA2_5_9I1R7Value) := by + exact contains_sound (homogeneous_enclosed CA2_5_9I1R7Value CA2_5_9I1R7MassTerm_sound CA2_5_9I1R7Entropy_sound) (by decide +kernel) +def CA2_5_9I1R8Value (a : PairSlot) : ℝ := residualLaw (below (shape 2 5 9)) (fun u => (stageALaw (shape 2 5 9) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 8 a +def CA2_5_9I1R8Raw (a : PairSlot) : Ball := residualBall (below (shape 2 5 9)) A2_5_9Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 8 a +lemma CA2_5_9I1R8Raw_sound (a : PairSlot) : + (CA2_5_9I1R8Raw a).Encloses (CA2_5_9I1R8Value a) := by + exact residualBall_sound_on (below (shape 2 5 9)) A2_5_9Law (fun u => (stageALaw (shape 2 5 9) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A2_5_9Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 2 5 9) (show (shape 2 5 9) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 8 a +def CA2_5_9I1R8Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA2_5_9I1R8Certificates_valid : + CA2_5_9I1R8Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_5_9I1R8CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA2_5_9I1R8P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_5_9I1R8Certificates (CA2_5_9I1R8CertificateIndex a)).input +lemma CA2_5_9I1R8P_check : ∀ a : PairSlot, contains (CA2_5_9I1R8Raw a) (CA2_5_9I1R8P a) = true := by + decide +kernel +lemma CA2_5_9I1R8P_sound (a : PairSlot) : + (CA2_5_9I1R8P a).Encloses (CA2_5_9I1R8Value a) := + contains_sound (CA2_5_9I1R8Raw_sound a) (CA2_5_9I1R8P_check a) +def CA2_5_9I1R8Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_5_9I1R8Certificates (CA2_5_9I1R8CertificateIndex a)).output +lemma CA2_5_9I1R8Terms_sound (a : PairSlot) : + (CA2_5_9I1R8Terms a).Encloses (Foundation.entropyTerm (CA2_5_9I1R8Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_5_9I1R8Certificates_valid + (CA2_5_9I1R8CertificateIndex a) (CA2_5_9I1R8P_sound a) +def CA2_5_9I1R8Entropy : Ball := ⟨0, 0⟩ +lemma CA2_5_9I1R8Entropy_sound : CA2_5_9I1R8Entropy.Encloses (Foundation.finiteEntropy CA2_5_9I1R8Value) := by + exact contains_sound (entropyPair_enclosed CA2_5_9I1R8Value CA2_5_9I1R8Terms CA2_5_9I1R8Terms_sound) (by decide +kernel) +def CA2_5_9I1R8Mass : Ball := ⟨0, 0⟩ +lemma CA2_5_9I1R8Mass_sound : CA2_5_9I1R8Mass.Encloses (∑ a, CA2_5_9I1R8Value a) := by + exact contains_sound (pairSumBall_sound CA2_5_9I1R8P CA2_5_9I1R8Value CA2_5_9I1R8P_sound) (by decide +kernel) +def CA2_5_9I1R8MassTerm : Ball := .exact 0 +lemma CA2_5_9I1R8MassTerm_sound : CA2_5_9I1R8MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_5_9I1R8Value a))) := + entropyTerm_zero_ball (CA2_5_9I1R8Mass_sound) +def CA2_5_9I1R8H : Ball := ⟨0, 0⟩ +lemma CA2_5_9I1R8H_sound : CA2_5_9I1R8H.Encloses (homogeneousEntropy CA2_5_9I1R8Value) := by + exact contains_sound (homogeneous_enclosed CA2_5_9I1R8Value CA2_5_9I1R8MassTerm_sound CA2_5_9I1R8Entropy_sound) (by decide +kernel) +def CA2_5_9I1R9Value (a : PairSlot) : ℝ := residualLaw (below (shape 2 5 9)) (fun u => (stageALaw (shape 2 5 9) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 9 a +def CA2_5_9I1R9Raw (a : PairSlot) : Ball := residualBall (below (shape 2 5 9)) A2_5_9Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 9 a +lemma CA2_5_9I1R9Raw_sound (a : PairSlot) : + (CA2_5_9I1R9Raw a).Encloses (CA2_5_9I1R9Value a) := by + exact residualBall_sound_on (below (shape 2 5 9)) A2_5_9Law (fun u => (stageALaw (shape 2 5 9) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A2_5_9Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 2 5 9) (show (shape 2 5 9) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 9 a +def CA2_5_9I1R9Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA2_5_9I1R9Certificates_valid : + CA2_5_9I1R9Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_5_9I1R9CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA2_5_9I1R9P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_5_9I1R9Certificates (CA2_5_9I1R9CertificateIndex a)).input +lemma CA2_5_9I1R9P_check : ∀ a : PairSlot, contains (CA2_5_9I1R9Raw a) (CA2_5_9I1R9P a) = true := by + decide +kernel +lemma CA2_5_9I1R9P_sound (a : PairSlot) : + (CA2_5_9I1R9P a).Encloses (CA2_5_9I1R9Value a) := + contains_sound (CA2_5_9I1R9Raw_sound a) (CA2_5_9I1R9P_check a) +def CA2_5_9I1R9Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_5_9I1R9Certificates (CA2_5_9I1R9CertificateIndex a)).output +lemma CA2_5_9I1R9Terms_sound (a : PairSlot) : + (CA2_5_9I1R9Terms a).Encloses (Foundation.entropyTerm (CA2_5_9I1R9Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_5_9I1R9Certificates_valid + (CA2_5_9I1R9CertificateIndex a) (CA2_5_9I1R9P_sound a) +def CA2_5_9I1R9Entropy : Ball := ⟨0, 0⟩ +lemma CA2_5_9I1R9Entropy_sound : CA2_5_9I1R9Entropy.Encloses (Foundation.finiteEntropy CA2_5_9I1R9Value) := by + exact contains_sound (entropyPair_enclosed CA2_5_9I1R9Value CA2_5_9I1R9Terms CA2_5_9I1R9Terms_sound) (by decide +kernel) +def CA2_5_9I1R9Mass : Ball := ⟨0, 0⟩ +lemma CA2_5_9I1R9Mass_sound : CA2_5_9I1R9Mass.Encloses (∑ a, CA2_5_9I1R9Value a) := by + exact contains_sound (pairSumBall_sound CA2_5_9I1R9P CA2_5_9I1R9Value CA2_5_9I1R9P_sound) (by decide +kernel) +def CA2_5_9I1R9MassTerm : Ball := .exact 0 +lemma CA2_5_9I1R9MassTerm_sound : CA2_5_9I1R9MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_5_9I1R9Value a))) := + entropyTerm_zero_ball (CA2_5_9I1R9Mass_sound) +def CA2_5_9I1R9H : Ball := ⟨0, 0⟩ +lemma CA2_5_9I1R9H_sound : CA2_5_9I1R9H.Encloses (homogeneousEntropy CA2_5_9I1R9Value) := by + exact contains_sound (homogeneous_enclosed CA2_5_9I1R9Value CA2_5_9I1R9MassTerm_sound CA2_5_9I1R9Entropy_sound) (by decide +kernel) +def CA2_5_9I1R10Value (a : PairSlot) : ℝ := residualLaw (below (shape 2 5 9)) (fun u => (stageALaw (shape 2 5 9) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 10 a +def CA2_5_9I1R10Raw (a : PairSlot) : Ball := residualBall (below (shape 2 5 9)) A2_5_9Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 10 a +lemma CA2_5_9I1R10Raw_sound (a : PairSlot) : + (CA2_5_9I1R10Raw a).Encloses (CA2_5_9I1R10Value a) := by + exact residualBall_sound_on (below (shape 2 5 9)) A2_5_9Law (fun u => (stageALaw (shape 2 5 9) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A2_5_9Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 2 5 9) (show (shape 2 5 9) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 10 a +def CA2_5_9I1R10Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA2_5_9I1R10Certificates_valid : + CA2_5_9I1R10Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_5_9I1R10CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA2_5_9I1R10P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_5_9I1R10Certificates (CA2_5_9I1R10CertificateIndex a)).input +lemma CA2_5_9I1R10P_check : ∀ a : PairSlot, contains (CA2_5_9I1R10Raw a) (CA2_5_9I1R10P a) = true := by + decide +kernel +lemma CA2_5_9I1R10P_sound (a : PairSlot) : + (CA2_5_9I1R10P a).Encloses (CA2_5_9I1R10Value a) := + contains_sound (CA2_5_9I1R10Raw_sound a) (CA2_5_9I1R10P_check a) +def CA2_5_9I1R10Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_5_9I1R10Certificates (CA2_5_9I1R10CertificateIndex a)).output +lemma CA2_5_9I1R10Terms_sound (a : PairSlot) : + (CA2_5_9I1R10Terms a).Encloses (Foundation.entropyTerm (CA2_5_9I1R10Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_5_9I1R10Certificates_valid + (CA2_5_9I1R10CertificateIndex a) (CA2_5_9I1R10P_sound a) +def CA2_5_9I1R10Entropy : Ball := ⟨0, 0⟩ +lemma CA2_5_9I1R10Entropy_sound : CA2_5_9I1R10Entropy.Encloses (Foundation.finiteEntropy CA2_5_9I1R10Value) := by + exact contains_sound (entropyPair_enclosed CA2_5_9I1R10Value CA2_5_9I1R10Terms CA2_5_9I1R10Terms_sound) (by decide +kernel) +def CA2_5_9I1R10Mass : Ball := ⟨0, 0⟩ +lemma CA2_5_9I1R10Mass_sound : CA2_5_9I1R10Mass.Encloses (∑ a, CA2_5_9I1R10Value a) := by + exact contains_sound (pairSumBall_sound CA2_5_9I1R10P CA2_5_9I1R10Value CA2_5_9I1R10P_sound) (by decide +kernel) +def CA2_5_9I1R10MassTerm : Ball := .exact 0 +lemma CA2_5_9I1R10MassTerm_sound : CA2_5_9I1R10MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_5_9I1R10Value a))) := + entropyTerm_zero_ball (CA2_5_9I1R10Mass_sound) +def CA2_5_9I1R10H : Ball := ⟨0, 0⟩ +lemma CA2_5_9I1R10H_sound : CA2_5_9I1R10H.Encloses (homogeneousEntropy CA2_5_9I1R10Value) := by + exact contains_sound (homogeneous_enclosed CA2_5_9I1R10Value CA2_5_9I1R10MassTerm_sound CA2_5_9I1R10Entropy_sound) (by decide +kernel) +def CA2_5_9I1R11Value (a : PairSlot) : ℝ := residualLaw (below (shape 2 5 9)) (fun u => (stageALaw (shape 2 5 9) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 11 a +def CA2_5_9I1R11Raw (a : PairSlot) : Ball := residualBall (below (shape 2 5 9)) A2_5_9Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 11 a +lemma CA2_5_9I1R11Raw_sound (a : PairSlot) : + (CA2_5_9I1R11Raw a).Encloses (CA2_5_9I1R11Value a) := by + exact residualBall_sound_on (below (shape 2 5 9)) A2_5_9Law (fun u => (stageALaw (shape 2 5 9) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A2_5_9Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 2 5 9) (show (shape 2 5 9) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 11 a +def CA2_5_9I1R11Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA2_5_9I1R11Certificates_valid : + CA2_5_9I1R11Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_5_9I1R11CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA2_5_9I1R11P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_5_9I1R11Certificates (CA2_5_9I1R11CertificateIndex a)).input +lemma CA2_5_9I1R11P_check : ∀ a : PairSlot, contains (CA2_5_9I1R11Raw a) (CA2_5_9I1R11P a) = true := by + decide +kernel +lemma CA2_5_9I1R11P_sound (a : PairSlot) : + (CA2_5_9I1R11P a).Encloses (CA2_5_9I1R11Value a) := + contains_sound (CA2_5_9I1R11Raw_sound a) (CA2_5_9I1R11P_check a) +def CA2_5_9I1R11Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_5_9I1R11Certificates (CA2_5_9I1R11CertificateIndex a)).output +lemma CA2_5_9I1R11Terms_sound (a : PairSlot) : + (CA2_5_9I1R11Terms a).Encloses (Foundation.entropyTerm (CA2_5_9I1R11Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_5_9I1R11Certificates_valid + (CA2_5_9I1R11CertificateIndex a) (CA2_5_9I1R11P_sound a) +def CA2_5_9I1R11Entropy : Ball := ⟨0, 0⟩ +lemma CA2_5_9I1R11Entropy_sound : CA2_5_9I1R11Entropy.Encloses (Foundation.finiteEntropy CA2_5_9I1R11Value) := by + exact contains_sound (entropyPair_enclosed CA2_5_9I1R11Value CA2_5_9I1R11Terms CA2_5_9I1R11Terms_sound) (by decide +kernel) +def CA2_5_9I1R11Mass : Ball := ⟨0, 0⟩ +lemma CA2_5_9I1R11Mass_sound : CA2_5_9I1R11Mass.Encloses (∑ a, CA2_5_9I1R11Value a) := by + exact contains_sound (pairSumBall_sound CA2_5_9I1R11P CA2_5_9I1R11Value CA2_5_9I1R11P_sound) (by decide +kernel) +def CA2_5_9I1R11MassTerm : Ball := .exact 0 +lemma CA2_5_9I1R11MassTerm_sound : CA2_5_9I1R11MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_5_9I1R11Value a))) := + entropyTerm_zero_ball (CA2_5_9I1R11Mass_sound) +def CA2_5_9I1R11H : Ball := ⟨0, 0⟩ +lemma CA2_5_9I1R11H_sound : CA2_5_9I1R11H.Encloses (homogeneousEntropy CA2_5_9I1R11Value) := by + exact contains_sound (homogeneous_enclosed CA2_5_9I1R11Value CA2_5_9I1R11MassTerm_sound CA2_5_9I1R11Entropy_sound) (by decide +kernel) +def CA2_5_9I1R12Value (a : PairSlot) : ℝ := residualLaw (below (shape 2 5 9)) (fun u => (stageALaw (shape 2 5 9) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 12 a +def CA2_5_9I1R12Raw (a : PairSlot) : Ball := residualBall (below (shape 2 5 9)) A2_5_9Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 12 a +lemma CA2_5_9I1R12Raw_sound (a : PairSlot) : + (CA2_5_9I1R12Raw a).Encloses (CA2_5_9I1R12Value a) := by + exact residualBall_sound_on (below (shape 2 5 9)) A2_5_9Law (fun u => (stageALaw (shape 2 5 9) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A2_5_9Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 2 5 9) (show (shape 2 5 9) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 12 a +def CA2_5_9I1R12Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA2_5_9I1R12Certificates_valid : + CA2_5_9I1R12Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_5_9I1R12CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA2_5_9I1R12P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_5_9I1R12Certificates (CA2_5_9I1R12CertificateIndex a)).input +lemma CA2_5_9I1R12P_check : ∀ a : PairSlot, contains (CA2_5_9I1R12Raw a) (CA2_5_9I1R12P a) = true := by + decide +kernel +lemma CA2_5_9I1R12P_sound (a : PairSlot) : + (CA2_5_9I1R12P a).Encloses (CA2_5_9I1R12Value a) := + contains_sound (CA2_5_9I1R12Raw_sound a) (CA2_5_9I1R12P_check a) +def CA2_5_9I1R12Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_5_9I1R12Certificates (CA2_5_9I1R12CertificateIndex a)).output +lemma CA2_5_9I1R12Terms_sound (a : PairSlot) : + (CA2_5_9I1R12Terms a).Encloses (Foundation.entropyTerm (CA2_5_9I1R12Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_5_9I1R12Certificates_valid + (CA2_5_9I1R12CertificateIndex a) (CA2_5_9I1R12P_sound a) +def CA2_5_9I1R12Entropy : Ball := ⟨0, 0⟩ +lemma CA2_5_9I1R12Entropy_sound : CA2_5_9I1R12Entropy.Encloses (Foundation.finiteEntropy CA2_5_9I1R12Value) := by + exact contains_sound (entropyPair_enclosed CA2_5_9I1R12Value CA2_5_9I1R12Terms CA2_5_9I1R12Terms_sound) (by decide +kernel) +def CA2_5_9I1R12Mass : Ball := ⟨0, 0⟩ +lemma CA2_5_9I1R12Mass_sound : CA2_5_9I1R12Mass.Encloses (∑ a, CA2_5_9I1R12Value a) := by + exact contains_sound (pairSumBall_sound CA2_5_9I1R12P CA2_5_9I1R12Value CA2_5_9I1R12P_sound) (by decide +kernel) +def CA2_5_9I1R12MassTerm : Ball := .exact 0 +lemma CA2_5_9I1R12MassTerm_sound : CA2_5_9I1R12MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_5_9I1R12Value a))) := + entropyTerm_zero_ball (CA2_5_9I1R12Mass_sound) +def CA2_5_9I1R12H : Ball := ⟨0, 0⟩ +lemma CA2_5_9I1R12H_sound : CA2_5_9I1R12H.Encloses (homogeneousEntropy CA2_5_9I1R12Value) := by + exact contains_sound (homogeneous_enclosed CA2_5_9I1R12Value CA2_5_9I1R12MassTerm_sound CA2_5_9I1R12Entropy_sound) (by decide +kernel) +def CA2_5_9I1R13Value (a : PairSlot) : ℝ := residualLaw (below (shape 2 5 9)) (fun u => (stageALaw (shape 2 5 9) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 13 a +def CA2_5_9I1R13Raw (a : PairSlot) : Ball := residualBall (below (shape 2 5 9)) A2_5_9Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 13 a +lemma CA2_5_9I1R13Raw_sound (a : PairSlot) : + (CA2_5_9I1R13Raw a).Encloses (CA2_5_9I1R13Value a) := by + exact residualBall_sound_on (below (shape 2 5 9)) A2_5_9Law (fun u => (stageALaw (shape 2 5 9) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A2_5_9Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 2 5 9) (show (shape 2 5 9) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 13 a +def CA2_5_9I1R13Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA2_5_9I1R13Certificates_valid : + CA2_5_9I1R13Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_5_9I1R13CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA2_5_9I1R13P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_5_9I1R13Certificates (CA2_5_9I1R13CertificateIndex a)).input +lemma CA2_5_9I1R13P_check : ∀ a : PairSlot, contains (CA2_5_9I1R13Raw a) (CA2_5_9I1R13P a) = true := by + decide +kernel +lemma CA2_5_9I1R13P_sound (a : PairSlot) : + (CA2_5_9I1R13P a).Encloses (CA2_5_9I1R13Value a) := + contains_sound (CA2_5_9I1R13Raw_sound a) (CA2_5_9I1R13P_check a) +def CA2_5_9I1R13Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_5_9I1R13Certificates (CA2_5_9I1R13CertificateIndex a)).output +lemma CA2_5_9I1R13Terms_sound (a : PairSlot) : + (CA2_5_9I1R13Terms a).Encloses (Foundation.entropyTerm (CA2_5_9I1R13Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_5_9I1R13Certificates_valid + (CA2_5_9I1R13CertificateIndex a) (CA2_5_9I1R13P_sound a) +def CA2_5_9I1R13Entropy : Ball := ⟨0, 0⟩ +lemma CA2_5_9I1R13Entropy_sound : CA2_5_9I1R13Entropy.Encloses (Foundation.finiteEntropy CA2_5_9I1R13Value) := by + exact contains_sound (entropyPair_enclosed CA2_5_9I1R13Value CA2_5_9I1R13Terms CA2_5_9I1R13Terms_sound) (by decide +kernel) +def CA2_5_9I1R13Mass : Ball := ⟨0, 0⟩ +lemma CA2_5_9I1R13Mass_sound : CA2_5_9I1R13Mass.Encloses (∑ a, CA2_5_9I1R13Value a) := by + exact contains_sound (pairSumBall_sound CA2_5_9I1R13P CA2_5_9I1R13Value CA2_5_9I1R13P_sound) (by decide +kernel) +def CA2_5_9I1R13MassTerm : Ball := .exact 0 +lemma CA2_5_9I1R13MassTerm_sound : CA2_5_9I1R13MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_5_9I1R13Value a))) := + entropyTerm_zero_ball (CA2_5_9I1R13Mass_sound) +def CA2_5_9I1R13H : Ball := ⟨0, 0⟩ +lemma CA2_5_9I1R13H_sound : CA2_5_9I1R13H.Encloses (homogeneousEntropy CA2_5_9I1R13Value) := by + exact contains_sound (homogeneous_enclosed CA2_5_9I1R13Value CA2_5_9I1R13MassTerm_sound CA2_5_9I1R13Entropy_sound) (by decide +kernel) +def CA2_5_9I1R14Value (a : PairSlot) : ℝ := residualLaw (below (shape 2 5 9)) (fun u => (stageALaw (shape 2 5 9) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 14 a +def CA2_5_9I1R14Raw (a : PairSlot) : Ball := residualBall (below (shape 2 5 9)) A2_5_9Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 14 a +lemma CA2_5_9I1R14Raw_sound (a : PairSlot) : + (CA2_5_9I1R14Raw a).Encloses (CA2_5_9I1R14Value a) := by + exact residualBall_sound_on (below (shape 2 5 9)) A2_5_9Law (fun u => (stageALaw (shape 2 5 9) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A2_5_9Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 2 5 9) (show (shape 2 5 9) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 14 a +def CA2_5_9I1R14Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA2_5_9I1R14Certificates_valid : + CA2_5_9I1R14Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_5_9I1R14CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA2_5_9I1R14P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_5_9I1R14Certificates (CA2_5_9I1R14CertificateIndex a)).input +lemma CA2_5_9I1R14P_check : ∀ a : PairSlot, contains (CA2_5_9I1R14Raw a) (CA2_5_9I1R14P a) = true := by + decide +kernel +lemma CA2_5_9I1R14P_sound (a : PairSlot) : + (CA2_5_9I1R14P a).Encloses (CA2_5_9I1R14Value a) := + contains_sound (CA2_5_9I1R14Raw_sound a) (CA2_5_9I1R14P_check a) +def CA2_5_9I1R14Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_5_9I1R14Certificates (CA2_5_9I1R14CertificateIndex a)).output +lemma CA2_5_9I1R14Terms_sound (a : PairSlot) : + (CA2_5_9I1R14Terms a).Encloses (Foundation.entropyTerm (CA2_5_9I1R14Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_5_9I1R14Certificates_valid + (CA2_5_9I1R14CertificateIndex a) (CA2_5_9I1R14P_sound a) +def CA2_5_9I1R14Entropy : Ball := ⟨0, 0⟩ +lemma CA2_5_9I1R14Entropy_sound : CA2_5_9I1R14Entropy.Encloses (Foundation.finiteEntropy CA2_5_9I1R14Value) := by + exact contains_sound (entropyPair_enclosed CA2_5_9I1R14Value CA2_5_9I1R14Terms CA2_5_9I1R14Terms_sound) (by decide +kernel) +def CA2_5_9I1R14Mass : Ball := ⟨0, 0⟩ +lemma CA2_5_9I1R14Mass_sound : CA2_5_9I1R14Mass.Encloses (∑ a, CA2_5_9I1R14Value a) := by + exact contains_sound (pairSumBall_sound CA2_5_9I1R14P CA2_5_9I1R14Value CA2_5_9I1R14P_sound) (by decide +kernel) +def CA2_5_9I1R14MassTerm : Ball := .exact 0 +lemma CA2_5_9I1R14MassTerm_sound : CA2_5_9I1R14MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_5_9I1R14Value a))) := + entropyTerm_zero_ball (CA2_5_9I1R14Mass_sound) +def CA2_5_9I1R14H : Ball := ⟨0, 0⟩ +lemma CA2_5_9I1R14H_sound : CA2_5_9I1R14H.Encloses (homogeneousEntropy CA2_5_9I1R14Value) := by + exact contains_sound (homogeneous_enclosed CA2_5_9I1R14Value CA2_5_9I1R14MassTerm_sound CA2_5_9I1R14Entropy_sound) (by decide +kernel) +def CA2_5_9I1R15Value (a : PairSlot) : ℝ := residualLaw (below (shape 2 5 9)) (fun u => (stageALaw (shape 2 5 9) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 15 a +def CA2_5_9I1R15Raw (a : PairSlot) : Ball := residualBall (below (shape 2 5 9)) A2_5_9Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 15 a +lemma CA2_5_9I1R15Raw_sound (a : PairSlot) : + (CA2_5_9I1R15Raw a).Encloses (CA2_5_9I1R15Value a) := by + exact residualBall_sound_on (below (shape 2 5 9)) A2_5_9Law (fun u => (stageALaw (shape 2 5 9) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A2_5_9Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 2 5 9) (show (shape 2 5 9) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 15 a +def CA2_5_9I1R15Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA2_5_9I1R15Certificates_valid : + CA2_5_9I1R15Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_5_9I1R15CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA2_5_9I1R15P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_5_9I1R15Certificates (CA2_5_9I1R15CertificateIndex a)).input +lemma CA2_5_9I1R15P_check : ∀ a : PairSlot, contains (CA2_5_9I1R15Raw a) (CA2_5_9I1R15P a) = true := by + decide +kernel +lemma CA2_5_9I1R15P_sound (a : PairSlot) : + (CA2_5_9I1R15P a).Encloses (CA2_5_9I1R15Value a) := + contains_sound (CA2_5_9I1R15Raw_sound a) (CA2_5_9I1R15P_check a) +def CA2_5_9I1R15Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_5_9I1R15Certificates (CA2_5_9I1R15CertificateIndex a)).output +lemma CA2_5_9I1R15Terms_sound (a : PairSlot) : + (CA2_5_9I1R15Terms a).Encloses (Foundation.entropyTerm (CA2_5_9I1R15Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_5_9I1R15Certificates_valid + (CA2_5_9I1R15CertificateIndex a) (CA2_5_9I1R15P_sound a) +def CA2_5_9I1R15Entropy : Ball := ⟨0, 0⟩ +lemma CA2_5_9I1R15Entropy_sound : CA2_5_9I1R15Entropy.Encloses (Foundation.finiteEntropy CA2_5_9I1R15Value) := by + exact contains_sound (entropyPair_enclosed CA2_5_9I1R15Value CA2_5_9I1R15Terms CA2_5_9I1R15Terms_sound) (by decide +kernel) +def CA2_5_9I1R15Mass : Ball := ⟨0, 0⟩ +lemma CA2_5_9I1R15Mass_sound : CA2_5_9I1R15Mass.Encloses (∑ a, CA2_5_9I1R15Value a) := by + exact contains_sound (pairSumBall_sound CA2_5_9I1R15P CA2_5_9I1R15Value CA2_5_9I1R15P_sound) (by decide +kernel) +def CA2_5_9I1R15MassTerm : Ball := .exact 0 +lemma CA2_5_9I1R15MassTerm_sound : CA2_5_9I1R15MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_5_9I1R15Value a))) := + entropyTerm_zero_ball (CA2_5_9I1R15Mass_sound) +def CA2_5_9I1R15H : Ball := ⟨0, 0⟩ +lemma CA2_5_9I1R15H_sound : CA2_5_9I1R15H.Encloses (homogeneousEntropy CA2_5_9I1R15Value) := by + exact contains_sound (homogeneous_enclosed CA2_5_9I1R15Value CA2_5_9I1R15MassTerm_sound CA2_5_9I1R15Entropy_sound) (by decide +kernel) +def CA2_5_9I1R16Value (a : PairSlot) : ℝ := residualLaw (below (shape 2 5 9)) (fun u => (stageALaw (shape 2 5 9) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 16 a +def CA2_5_9I1R16Raw (a : PairSlot) : Ball := residualBall (below (shape 2 5 9)) A2_5_9Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 16 a +lemma CA2_5_9I1R16Raw_sound (a : PairSlot) : + (CA2_5_9I1R16Raw a).Encloses (CA2_5_9I1R16Value a) := by + exact residualBall_sound_on (below (shape 2 5 9)) A2_5_9Law (fun u => (stageALaw (shape 2 5 9) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A2_5_9Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 2 5 9) (show (shape 2 5 9) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 16 a +def CA2_5_9I1R16Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA2_5_9I1R16Certificates_valid : + CA2_5_9I1R16Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_5_9I1R16CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA2_5_9I1R16P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_5_9I1R16Certificates (CA2_5_9I1R16CertificateIndex a)).input +lemma CA2_5_9I1R16P_check : ∀ a : PairSlot, contains (CA2_5_9I1R16Raw a) (CA2_5_9I1R16P a) = true := by + decide +kernel +lemma CA2_5_9I1R16P_sound (a : PairSlot) : + (CA2_5_9I1R16P a).Encloses (CA2_5_9I1R16Value a) := + contains_sound (CA2_5_9I1R16Raw_sound a) (CA2_5_9I1R16P_check a) +def CA2_5_9I1R16Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_5_9I1R16Certificates (CA2_5_9I1R16CertificateIndex a)).output +lemma CA2_5_9I1R16Terms_sound (a : PairSlot) : + (CA2_5_9I1R16Terms a).Encloses (Foundation.entropyTerm (CA2_5_9I1R16Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_5_9I1R16Certificates_valid + (CA2_5_9I1R16CertificateIndex a) (CA2_5_9I1R16P_sound a) +def CA2_5_9I1R16Entropy : Ball := ⟨0, 0⟩ +lemma CA2_5_9I1R16Entropy_sound : CA2_5_9I1R16Entropy.Encloses (Foundation.finiteEntropy CA2_5_9I1R16Value) := by + exact contains_sound (entropyPair_enclosed CA2_5_9I1R16Value CA2_5_9I1R16Terms CA2_5_9I1R16Terms_sound) (by decide +kernel) +def CA2_5_9I1R16Mass : Ball := ⟨0, 0⟩ +lemma CA2_5_9I1R16Mass_sound : CA2_5_9I1R16Mass.Encloses (∑ a, CA2_5_9I1R16Value a) := by + exact contains_sound (pairSumBall_sound CA2_5_9I1R16P CA2_5_9I1R16Value CA2_5_9I1R16P_sound) (by decide +kernel) +def CA2_5_9I1R16MassTerm : Ball := .exact 0 +lemma CA2_5_9I1R16MassTerm_sound : CA2_5_9I1R16MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_5_9I1R16Value a))) := + entropyTerm_zero_ball (CA2_5_9I1R16Mass_sound) +def CA2_5_9I1R16H : Ball := ⟨0, 0⟩ +lemma CA2_5_9I1R16H_sound : CA2_5_9I1R16H.Encloses (homogeneousEntropy CA2_5_9I1R16Value) := by + exact contains_sound (homogeneous_enclosed CA2_5_9I1R16Value CA2_5_9I1R16MassTerm_sound CA2_5_9I1R16Entropy_sound) (by decide +kernel) +def CA2_5_9I1ResidualEntropies (a : Fin 17) : Ball := + match a.val with + | 0 => CA2_5_9I1R0H + | 1 => CA2_5_9I1R1H + | 2 => CA2_5_9I1R2H + | 3 => CA2_5_9I1R3H + | 4 => CA2_5_9I1R4H + | 5 => CA2_5_9I1R5H + | 6 => CA2_5_9I1R6H + | 7 => CA2_5_9I1R7H + | 8 => CA2_5_9I1R8H + | 9 => CA2_5_9I1R9H + | 10 => CA2_5_9I1R10H + | 11 => CA2_5_9I1R11H + | 12 => CA2_5_9I1R12H + | 13 => CA2_5_9I1R13H + | 14 => CA2_5_9I1R14H + | 15 => CA2_5_9I1R15H + | 16 => CA2_5_9I1R16H + | _ => (.exact 0) +lemma CA2_5_9I1ResidualEntropies_sound (k : Fin 17) : + (CA2_5_9I1ResidualEntropies k).Encloses (homogeneousEntropy + (residualLaw (below (shape 2 5 9)) (fun u => (stageALaw (shape 2 5 9) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) k)) := by + fin_cases k + · exact CA2_5_9I1R0H_sound + · exact CA2_5_9I1R1H_sound + · exact CA2_5_9I1R2H_sound + · exact CA2_5_9I1R3H_sound + · exact CA2_5_9I1R4H_sound + · exact CA2_5_9I1R5H_sound + · exact CA2_5_9I1R6H_sound + · exact CA2_5_9I1R7H_sound + · exact CA2_5_9I1R8H_sound + · exact CA2_5_9I1R9H_sound + · exact CA2_5_9I1R10H_sound + · exact CA2_5_9I1R11H_sound + · exact CA2_5_9I1R12H_sound + · exact CA2_5_9I1R13H_sound + · exact CA2_5_9I1R14H_sound + · exact CA2_5_9I1R15H_sound + · exact CA2_5_9I1R16H_sound +def CA2_5_9I1Singles (s : Shape) : Ball := + match s 0, s 1, s 2 with + | _, _, _ => (.exact 0) +lemma CA2_5_9I1Singles_sound (u : Shape) (hu : u ∈ below (shape 2 5 9)) + (hd : designated (Equiv.refl (Fin 3)) 1 u) : + (CA2_5_9I1Singles u).Encloses (homogeneousEntropy ((fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) u)) := by + rw [A2_5_9_below] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 0 0 8) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 0 1 7) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 0 2 6) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 0 3 5) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 0 4 4) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 0 5 3) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 1 0 7) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 1 1 6) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 1 2 5) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 1 3 4) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 1 4 3) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 1 5 2) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 2 0 6) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 2 1 5) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 2 2 4) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 2 3 3) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 2 4 2) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 2 5 1) by decide +kernel) hd |>.elim +def CA2_5_9I1Singleton : Ball := ⟨0, 0⟩ +lemma CA2_5_9I1Singleton_sound : CA2_5_9I1Singleton.Encloses + (singletonEntropy (below (shape 2 5 9)) (fun u => (stageALaw (shape 2 5 9) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ))) := by + exact contains_sound (singletonBall_sound (below (shape 2 5 9)) A2_5_9Law (fun u => (stageALaw (shape 2 5 9) u : ℝ)) (Equiv.refl (Fin 3)) 1 + CA2_5_9I1Singles (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A2_5_9Law_sound u) CA2_5_9I1Singles_sound) (by decide +kernel) +def CA2_5_9I1Group : Ball := ⟨(105351913892130676205833539769721 / 100000000000000000000000000000000), (84174611011 / 50000000000000000000000000000000)⟩ +lemma CA2_5_9I1Group_sound : CA2_5_9I1Group.Encloses + (groupedEntropy (below (shape 2 5 9)) (fun u => (stageALaw (shape 2 5 9) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ))) := by + exact contains_sound (Ball.add_sound CA2_5_9I1Singleton_sound + (finSumBall_sound 17 CA2_5_9I1ResidualEntropies _ CA2_5_9I1ResidualEntropies_sound)) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CA2_5_9I1H : Ball := ⟨(117889810744855596455560513998131 / 100000000000000000000000000000000), (517634851031 / 100000000000000000000000000000000)⟩ +lemma CA2_5_9I1_sound : CA2_5_9I1H.Encloses (stageACapacity (shape 2 5 9) 1) := by + have hb := contains_sound (Ball.add_sound CA2_5_9I1PairH_sound + (Ball.neg_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) CA2_5_9I1Group_sound))) + (show contains (.add CA2_5_9I1PairH (.neg (.mul (.exact 2) CA2_5_9I1Group))) CA2_5_9I1H = true by decide +kernel) + unfold CA2_5_9I1PairValue at hb + simpa only [stageACapacity, nativeCapacity, + show (1 : Fin 3) ≠ 0 by decide, ite_false, sub_eq_add_neg] using hb + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA2_5_9I2.lean b/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA2_5_9I2.lean new file mode 100644 index 0000000000000000000000000000000000000000..ba04eed8c7af5191d61800d9f861c9b0138b7f39 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA2_5_9I2.lean @@ -0,0 +1,852 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.CapacityA.CapA2_5_9I2Pair + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CA2_5_9I2R0Value (a : PairSlot) : ℝ := residualLaw (below (shape 2 5 9)) (fun u => (stageALaw (shape 2 5 9) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 0 a +def CA2_5_9I2R0Raw (a : PairSlot) : Ball := residualBall (below (shape 2 5 9)) A2_5_9Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 0 a +lemma CA2_5_9I2R0Raw_sound (a : PairSlot) : + (CA2_5_9I2R0Raw a).Encloses (CA2_5_9I2R0Value a) := by + exact residualBall_sound_on (below (shape 2 5 9)) A2_5_9Law (fun u => (stageALaw (shape 2 5 9) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A2_5_9Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 2 5 9) (show (shape 2 5 9) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 0 a +def CA2_5_9I2R0Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA2_5_9I2R0Certificates_valid : + CA2_5_9I2R0Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_5_9I2R0CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA2_5_9I2R0P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_5_9I2R0Certificates (CA2_5_9I2R0CertificateIndex a)).input +lemma CA2_5_9I2R0P_check : ∀ a : PairSlot, contains (CA2_5_9I2R0Raw a) (CA2_5_9I2R0P a) = true := by + decide +kernel +lemma CA2_5_9I2R0P_sound (a : PairSlot) : + (CA2_5_9I2R0P a).Encloses (CA2_5_9I2R0Value a) := + contains_sound (CA2_5_9I2R0Raw_sound a) (CA2_5_9I2R0P_check a) +def CA2_5_9I2R0Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_5_9I2R0Certificates (CA2_5_9I2R0CertificateIndex a)).output +lemma CA2_5_9I2R0Terms_sound (a : PairSlot) : + (CA2_5_9I2R0Terms a).Encloses (Foundation.entropyTerm (CA2_5_9I2R0Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_5_9I2R0Certificates_valid + (CA2_5_9I2R0CertificateIndex a) (CA2_5_9I2R0P_sound a) +def CA2_5_9I2R0Entropy : Ball := ⟨0, 0⟩ +lemma CA2_5_9I2R0Entropy_sound : CA2_5_9I2R0Entropy.Encloses (Foundation.finiteEntropy CA2_5_9I2R0Value) := by + exact contains_sound (entropyPair_enclosed CA2_5_9I2R0Value CA2_5_9I2R0Terms CA2_5_9I2R0Terms_sound) (by decide +kernel) +def CA2_5_9I2R0Mass : Ball := ⟨0, 0⟩ +lemma CA2_5_9I2R0Mass_sound : CA2_5_9I2R0Mass.Encloses (∑ a, CA2_5_9I2R0Value a) := by + exact contains_sound (pairSumBall_sound CA2_5_9I2R0P CA2_5_9I2R0Value CA2_5_9I2R0P_sound) (by decide +kernel) +def CA2_5_9I2R0MassTerm : Ball := .exact 0 +lemma CA2_5_9I2R0MassTerm_sound : CA2_5_9I2R0MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_5_9I2R0Value a))) := + entropyTerm_zero_ball (CA2_5_9I2R0Mass_sound) +def CA2_5_9I2R0H : Ball := ⟨0, 0⟩ +lemma CA2_5_9I2R0H_sound : CA2_5_9I2R0H.Encloses (homogeneousEntropy CA2_5_9I2R0Value) := by + exact contains_sound (homogeneous_enclosed CA2_5_9I2R0Value CA2_5_9I2R0MassTerm_sound CA2_5_9I2R0Entropy_sound) (by decide +kernel) +def CA2_5_9I2R1Value (a : PairSlot) : ℝ := residualLaw (below (shape 2 5 9)) (fun u => (stageALaw (shape 2 5 9) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 1 a +def CA2_5_9I2R1Raw (a : PairSlot) : Ball := residualBall (below (shape 2 5 9)) A2_5_9Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 1 a +lemma CA2_5_9I2R1Raw_sound (a : PairSlot) : + (CA2_5_9I2R1Raw a).Encloses (CA2_5_9I2R1Value a) := by + exact residualBall_sound_on (below (shape 2 5 9)) A2_5_9Law (fun u => (stageALaw (shape 2 5 9) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A2_5_9Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 2 5 9) (show (shape 2 5 9) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 1 a +def CA2_5_9I2R1Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(15446294267654093658823153 / 25000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ ⟨(44167187154123555521479247 / 5000000000000000000000000000000), (287869 / 100000000000000000000000000000000)⟩ ⟨(-1429701726148437809485208500868057 / 100000000000000000000000000000000), (14558479939 / 3125000000000000000000000000000)⟩ ⟨-21, 15446294267654093658823153, 11920928955078125000000000⟩] +lemma CA2_5_9I2R1Certificates_valid : + CA2_5_9I2R1Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_5_9I2R1CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 1, 0 => 1 + | 0, 1 => 1 + | _, _ => 0 +def CA2_5_9I2R1P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_5_9I2R1Certificates (CA2_5_9I2R1CertificateIndex a)).input +lemma CA2_5_9I2R1P_check : ∀ a : PairSlot, contains (CA2_5_9I2R1Raw a) (CA2_5_9I2R1P a) = true := by + decide +kernel +lemma CA2_5_9I2R1P_sound (a : PairSlot) : + (CA2_5_9I2R1P a).Encloses (CA2_5_9I2R1Value a) := + contains_sound (CA2_5_9I2R1Raw_sound a) (CA2_5_9I2R1P_check a) +def CA2_5_9I2R1Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_5_9I2R1Certificates (CA2_5_9I2R1CertificateIndex a)).output +lemma CA2_5_9I2R1Terms_sound (a : PairSlot) : + (CA2_5_9I2R1Terms a).Encloses (Foundation.entropyTerm (CA2_5_9I2R1Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_5_9I2R1Certificates_valid + (CA2_5_9I2R1CertificateIndex a) (CA2_5_9I2R1P_sound a) +def CA2_5_9I2R1Entropy : Ball := ⟨(44167187154123555521479247 / 2500000000000000000000000000000), (287869 / 50000000000000000000000000000000)⟩ +lemma CA2_5_9I2R1Entropy_sound : CA2_5_9I2R1Entropy.Encloses (Foundation.finiteEntropy CA2_5_9I2R1Value) := by + exact contains_sound (entropyPair_enclosed CA2_5_9I2R1Value CA2_5_9I2R1Terms CA2_5_9I2R1Terms_sound) (by decide +kernel) +def CA2_5_9I2R1Mass : Ball := ⟨(15446294267654093658823153 / 12500000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ +lemma CA2_5_9I2R1Mass_sound : CA2_5_9I2R1Mass.Encloses (∑ a, CA2_5_9I2R1Value a) := by + exact contains_sound (pairSumBall_sound CA2_5_9I2R1P CA2_5_9I2R1Value CA2_5_9I2R1P_sound) (by decide +kernel) +def CA2_5_9I2R1MassTermLogWitness : LogWitness := ⟨-20, 15446294267654093658823153, 11920928955078125000000000⟩ +def CA2_5_9I2R1MassTermLog : Ball := ⟨(-1360387008092443278543485307817727 / 100000000000000000000000000000000), (88939106873 / 20000000000000000000000000000000)⟩ +lemma CA2_5_9I2R1MassTermLog_sound : CA2_5_9I2R1MassTermLog.Encloses (Real.log ((∑ a, CA2_5_9I2R1Value a))) := by + exact checkLog_sound logTwoBall_sound (CA2_5_9I2R1Mass_sound) (w := CA2_5_9I2R1MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA2_5_9I2R1MassTerm : Ball := ⟨(67241401743646111151768287 / 4000000000000000000000000000000), (549567 / 100000000000000000000000000000000)⟩ +lemma CA2_5_9I2R1MassTerm_sound : CA2_5_9I2R1MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_5_9I2R1Value a))) := by + exact contains_sound (entropyTerm_ball (CA2_5_9I2R1Mass_sound) CA2_5_9I2R1MassTermLog_sound) (by decide +kernel) +def CA2_5_9I2R1H : Ball := ⟨(17130488514757888412992541 / 20000000000000000000000000000000), (225061 / 20000000000000000000000000000000)⟩ +lemma CA2_5_9I2R1H_sound : CA2_5_9I2R1H.Encloses (homogeneousEntropy CA2_5_9I2R1Value) := by + exact contains_sound (homogeneous_enclosed CA2_5_9I2R1Value CA2_5_9I2R1MassTerm_sound CA2_5_9I2R1Entropy_sound) (by decide +kernel) +def CA2_5_9I2R2Value (a : PairSlot) : ℝ := residualLaw (below (shape 2 5 9)) (fun u => (stageALaw (shape 2 5 9) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 2 a +def CA2_5_9I2R2Raw (a : PairSlot) : Ball := residualBall (below (shape 2 5 9)) A2_5_9Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 2 a +lemma CA2_5_9I2R2Raw_sound (a : PairSlot) : + (CA2_5_9I2R2Raw a).Encloses (CA2_5_9I2R2Value a) := by + exact residualBall_sound_on (below (shape 2 5 9)) A2_5_9Law (fun u => (stageALaw (shape 2 5 9) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A2_5_9Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 2 5 9) (show (shape 2 5 9) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 2 a +def CA2_5_9I2R2Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(13448325190745958237288110239 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(119879324072629199536564734163 / 100000000000000000000000000000000), (19934561 / 50000000000000000000000000000000)⟩ ⟨(-178281417756198197539321688437499 / 20000000000000000000000000000000), (296461538997 / 100000000000000000000000000000000)⟩ ⟨-13, 13448325190745958237288110239, 12207031250000000000000000000⟩, + .log ⟨(282323780452652185071222811 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(15765225654074667926548964821 / 100000000000000000000000000000000), (10509 / 195312500000000000000000000000)⟩ ⟨(-1116818826157551717896683661857721 / 100000000000000000000000000000000), (190582448567 / 50000000000000000000000000000000)⟩ ⟨-17, 282323780452652185071222811, 152587890625000000000000000⟩, + .log ⟨(50783447597251899709700684141 / 100000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ ⟨(385210478056688646600278217389 / 100000000000000000000000000000000), (64522889 / 50000000000000000000000000000000)⟩ ⟨(-758535499818121767047583016378033 / 100000000000000000000000000000000), (254109888133 / 100000000000000000000000000000000)⟩ ⟨-11, 50783447597251899709700684141, 48828125000000000000000000000⟩] +lemma CA2_5_9I2R2Certificates_valid : + CA2_5_9I2R2Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_5_9I2R2CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 2, 0 => 1 + | 3, 0 => 2 + | 1, 1 => 3 + | 0, 2 => 1 + | 0, 3 => 2 + | _, _ => 0 +def CA2_5_9I2R2P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_5_9I2R2Certificates (CA2_5_9I2R2CertificateIndex a)).input +lemma CA2_5_9I2R2P_check : ∀ a : PairSlot, contains (CA2_5_9I2R2Raw a) (CA2_5_9I2R2P a) = true := by + decide +kernel +lemma CA2_5_9I2R2P_sound (a : PairSlot) : + (CA2_5_9I2R2P a).Encloses (CA2_5_9I2R2Value a) := + contains_sound (CA2_5_9I2R2Raw_sound a) (CA2_5_9I2R2P_check a) +def CA2_5_9I2R2Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_5_9I2R2Certificates (CA2_5_9I2R2CertificateIndex a)).output +lemma CA2_5_9I2R2Terms_sound (a : PairSlot) : + (CA2_5_9I2R2Terms a).Encloses (Foundation.entropyTerm (CA2_5_9I2R2Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_5_9I2R2Certificates_valid + (CA2_5_9I2R2CertificateIndex a) (CA2_5_9I2R2P_sound a) +def CA2_5_9I2R2Entropy : Ball := ⟨(656499577510096381526505615357 / 100000000000000000000000000000000), (109772619 / 50000000000000000000000000000000)⟩ +lemma CA2_5_9I2R2Entropy_sound : CA2_5_9I2R2Entropy.Encloses (Foundation.finiteEntropy CA2_5_9I2R2Value) := by + exact contains_sound (entropyPair_enclosed CA2_5_9I2R2Value CA2_5_9I2R2Terms CA2_5_9I2R2Terms_sound) (by decide +kernel) +def CA2_5_9I2R2Mass : Ball := ⟨(80503335783270338034989132729 / 100000000000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ +lemma CA2_5_9I2R2Mass_sound : CA2_5_9I2R2Mass.Encloses (∑ a, CA2_5_9I2R2Value a) := by + exact contains_sound (pairSumBall_sound CA2_5_9I2R2P CA2_5_9I2R2Value CA2_5_9I2R2P_sound) (by decide +kernel) +def CA2_5_9I2R2MassTermLogWitness : LogWitness := ⟨-11, 80503335783270338034989132729, 48828125000000000000000000000⟩ +def CA2_5_9I2R2MassTermLog : Ball := ⟨(-14249253686205517097888745662231 / 2000000000000000000000000000000), (254109891649 / 100000000000000000000000000000000)⟩ +lemma CA2_5_9I2R2MassTermLog_sound : CA2_5_9I2R2MassTermLog.Encloses (Real.log ((∑ a, CA2_5_9I2R2Value a))) := by + exact checkLog_sound logTwoBall_sound (CA2_5_9I2R2Mass_sound) (w := CA2_5_9I2R2MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA2_5_9I2R2MassTerm : Ball := ⟨(57355622708080268666003791401 / 10000000000000000000000000000000), (204566983 / 100000000000000000000000000000000)⟩ +lemma CA2_5_9I2R2MassTerm_sound : CA2_5_9I2R2MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_5_9I2R2Value a))) := by + exact contains_sound (entropyTerm_ball (CA2_5_9I2R2Mass_sound) CA2_5_9I2R2MassTermLog_sound) (by decide +kernel) +def CA2_5_9I2R2H : Ball := ⟨(82943350429293694866467701347 / 100000000000000000000000000000000), (424112221 / 100000000000000000000000000000000)⟩ +lemma CA2_5_9I2R2H_sound : CA2_5_9I2R2H.Encloses (homogeneousEntropy CA2_5_9I2R2Value) := by + exact contains_sound (homogeneous_enclosed CA2_5_9I2R2Value CA2_5_9I2R2MassTerm_sound CA2_5_9I2R2Entropy_sound) (by decide +kernel) +def CA2_5_9I2R3Value (a : PairSlot) : ℝ := residualLaw (below (shape 2 5 9)) (fun u => (stageALaw (shape 2 5 9) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 3 a +def CA2_5_9I2R3Raw (a : PairSlot) : Ball := residualBall (below (shape 2 5 9)) A2_5_9Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 3 a +lemma CA2_5_9I2R3Raw_sound (a : PairSlot) : + (CA2_5_9I2R3Raw a).Encloses (CA2_5_9I2R3Value a) := by + exact residualBall_sound_on (below (shape 2 5 9)) A2_5_9Law (fun u => (stageALaw (shape 2 5 9) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A2_5_9Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 2 5 9) (show (shape 2 5 9) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 3 a +def CA2_5_9I2R3Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(2435297310659647602143457693 / 4000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(450772362784741535350836775619 / 100000000000000000000000000000000), (2417317 / 1562500000000000000000000000000)⟩ ⟨(-740398079218739959029923724054193 / 100000000000000000000000000000000), (127054942919 / 50000000000000000000000000000000)⟩ ⟨-11, 2435297310659647602143457693, 1953125000000000000000000000⟩, + .log ⟨(2129985717566248000727447269227 / 100000000000000000000000000000000), (1 / 10000000000000000000000000000000)⟩ ⟨(8198431987958046886550801924529 / 100000000000000000000000000000000), (3157294189 / 100000000000000000000000000000000)⟩ ⟨(-15396219646628789554713718736161 / 4000000000000000000000000000000), (118584613 / 80000000000000000000000000000)⟩ ⟨-6, 2129985717566248000727447269227, 1562500000000000000000000000000⟩, + .log ⟨(26882798760508601774438039839 / 20000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ ⟨(888745450918071274338589927737 / 100000000000000000000000000000000), (31309599 / 10000000000000000000000000000000)⟩ ⟨(-165300023043667812162660823878931 / 25000000000000000000000000000000), (116467031 / 50000000000000000000000000000)⟩ ⟨-10, 26882798760508601774438039839, 19531250000000000000000000000⟩] +lemma CA2_5_9I2R3Certificates_valid : + CA2_5_9I2R3Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_5_9I2R3CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 4, 0 => 1 + | 2, 1 => 2 + | 3, 1 => 3 + | 1, 2 => 2 + | 1, 3 => 3 + | 0, 4 => 1 + | _, _ => 0 +def CA2_5_9I2R3P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_5_9I2R3Certificates (CA2_5_9I2R3CertificateIndex a)).input +lemma CA2_5_9I2R3P_check : ∀ a : PairSlot, contains (CA2_5_9I2R3Raw a) (CA2_5_9I2R3P a) = true := by + decide +kernel +lemma CA2_5_9I2R3P_sound (a : PairSlot) : + (CA2_5_9I2R3P a).Encloses (CA2_5_9I2R3Value a) := + contains_sound (CA2_5_9I2R3Raw_sound a) (CA2_5_9I2R3P_check a) +def CA2_5_9I2R3Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_5_9I2R3Certificates (CA2_5_9I2R3CertificateIndex a)).output +lemma CA2_5_9I2R3Terms_sound (a : PairSlot) : + (CA2_5_9I2R3Terms a).Encloses (Foundation.entropyTerm (CA2_5_9I2R3Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_5_9I2R3Certificates_valid + (CA2_5_9I2R3CertificateIndex a) (CA2_5_9I2R3P_sound a) +def CA2_5_9I2R3Entropy : Ball := ⟨(1907589960332171939248045725577 / 10000000000000000000000000000000), (3625098467 / 50000000000000000000000000000000)⟩ +lemma CA2_5_9I2R3Entropy_sound : CA2_5_9I2R3Entropy.Encloses (Foundation.finiteEntropy CA2_5_9I2R3Value) := by + exact contains_sound (entropyPair_enclosed CA2_5_9I2R3Value CA2_5_9I2R3Terms CA2_5_9I2R3Terms_sound) (by decide +kernel) +def CA2_5_9I2R3Mass : Ball := ⟨(2325282144135282199653223910747 / 50000000000000000000000000000000), (13 / 50000000000000000000000000000000)⟩ +lemma CA2_5_9I2R3Mass_sound : CA2_5_9I2R3Mass.Encloses (∑ a, CA2_5_9I2R3Value a) := by + exact contains_sound (pairSumBall_sound CA2_5_9I2R3P CA2_5_9I2R3Value CA2_5_9I2R3P_sound) (by decide +kernel) +def CA2_5_9I2R3MassTermLogWitness : LogWitness := ⟨-5, 2325282144135282199653223910747, 1562500000000000000000000000000⟩ +def CA2_5_9I2R3MassTermLog : Ball := ⟨(-306818162143517270594524012514053 / 100000000000000000000000000000000), (127054942657 / 100000000000000000000000000000000)⟩ +lemma CA2_5_9I2R3MassTermLog_sound : CA2_5_9I2R3MassTermLog.Encloses (Real.log ((∑ a, CA2_5_9I2R3Value a))) := by + exact checkLog_sound logTwoBall_sound (CA2_5_9I2R3Mass_sound) (w := CA2_5_9I2R3MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA2_5_9I2R3MassTerm : Ball := ⟨(2853755175714898042149589920809 / 20000000000000000000000000000000), (590877187 / 10000000000000000000000000000000)⟩ +lemma CA2_5_9I2R3MassTerm_sound : CA2_5_9I2R3MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_5_9I2R3Value a))) := by + exact contains_sound (entropyTerm_ball (CA2_5_9I2R3Mass_sound) CA2_5_9I2R3MassTermLog_sound) (by decide +kernel) +def CA2_5_9I2R3H : Ball := ⟨(192284948989889167269300306069 / 4000000000000000000000000000000), (3289742201 / 25000000000000000000000000000000)⟩ +lemma CA2_5_9I2R3H_sound : CA2_5_9I2R3H.Encloses (homogeneousEntropy CA2_5_9I2R3Value) := by + exact contains_sound (homogeneous_enclosed CA2_5_9I2R3Value CA2_5_9I2R3MassTerm_sound CA2_5_9I2R3Entropy_sound) (by decide +kernel) +def CA2_5_9I2R4Value (a : PairSlot) : ℝ := residualLaw (below (shape 2 5 9)) (fun u => (stageALaw (shape 2 5 9) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 4 a +def CA2_5_9I2R4Raw (a : PairSlot) : Ball := residualBall (below (shape 2 5 9)) A2_5_9Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 4 a +lemma CA2_5_9I2R4Raw_sound (a : PairSlot) : + (CA2_5_9I2R4Raw a).Encloses (CA2_5_9I2R4Value a) := by + exact residualBall_sound_on (below (shape 2 5 9)) A2_5_9Law (fun u => (stageALaw (shape 2 5 9) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A2_5_9Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 2 5 9) (show (shape 2 5 9) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 4 a +def CA2_5_9I2R4Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(3828098270400182291888320817 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(9070114340891405229949781027 / 12500000000000000000000000000000), (24318951 / 100000000000000000000000000000000)⟩ ⟨(-473870506983784003132945954197861 / 50000000000000000000000000000000), (158818684153 / 50000000000000000000000000000000)⟩ ⟨-14, 3828098270400182291888320817, 3051757812500000000000000000⟩, + .log ⟨(2832054442480734568472529862261 / 100000000000000000000000000000000), (13 / 100000000000000000000000000000000)⟩ ⟨(5046958606471071858858950380841 / 50000000000000000000000000000000), (4197976047 / 100000000000000000000000000000000)⟩ ⟨(-71283355726031802428228276296787 / 20000000000000000000000000000000), (926442289 / 625000000000000000000000000000)⟩ ⟨-6, 2832054442480734568472529862261, 1562500000000000000000000000000⟩, + .log ⟨(7459423225686522421399854785953 / 25000000000000000000000000000000), (37 / 50000000000000000000000000000000)⟩ ⟨(9021409510534333997929849792521 / 25000000000000000000000000000000), (4738782971 / 25000000000000000000000000000000)⟩ ⟨(-60469886461657733198408369629621 / 50000000000000000000000000000000), (992616739 / 1562500000000000000000000000000)⟩ ⟨-2, 7459423225686522421399854785953, 6250000000000000000000000000000⟩, + .log ⟨(353828186837348644017151682629 / 25000000000000000000000000000000), (1 / 20000000000000000000000000000000)⟩ ⟨(6026146435692866440667433416913 / 100000000000000000000000000000000), (2397633083 / 100000000000000000000000000000000)⟩ ⟨(-425781965645308170662892233837533 / 100000000000000000000000000000000), (169406589817 / 100000000000000000000000000000000)⟩ ⟨-7, 353828186837348644017151682629, 195312500000000000000000000000⟩, + .log ⟨(52559516800331754163666714549 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(198437911271665158719651026751 / 50000000000000000000000000000000), (16694867 / 12500000000000000000000000000000)⟩ ⟨(-94387241051658899721379744189137 / 12500000000000000000000000000000), (127054943049 / 50000000000000000000000000000000)⟩ ⟨-11, 52559516800331754163666714549, 48828125000000000000000000000⟩] +lemma CA2_5_9I2R4Certificates_valid : + CA2_5_9I2R4Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_5_9I2R4CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 5, 0 => 1 + | 4, 1 => 2 + | 2, 2 => 3 + | 2, 3 => 4 + | 3, 2 => 4 + | 3, 3 => 5 + | 1, 4 => 2 + | 0, 5 => 1 + | _, _ => 0 +def CA2_5_9I2R4P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_5_9I2R4Certificates (CA2_5_9I2R4CertificateIndex a)).input +lemma CA2_5_9I2R4P_check : ∀ a : PairSlot, contains (CA2_5_9I2R4Raw a) (CA2_5_9I2R4P a) = true := by + decide +kernel +lemma CA2_5_9I2R4P_sound (a : PairSlot) : + (CA2_5_9I2R4P a).Encloses (CA2_5_9I2R4Value a) := + contains_sound (CA2_5_9I2R4Raw_sound a) (CA2_5_9I2R4P_check a) +def CA2_5_9I2R4Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_5_9I2R4Certificates (CA2_5_9I2R4CertificateIndex a)).output +lemma CA2_5_9I2R4Terms_sound (a : PairSlot) : + (CA2_5_9I2R4Terms a).Encloses (Foundation.entropyTerm (CA2_5_9I2R4Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_5_9I2R4Certificates_valid + (CA2_5_9I2R4CertificateIndex a) (CA2_5_9I2R4P_sound a) +def CA2_5_9I2R4Entropy : Ball := ⟨(8608470373925618638701070759651 / 12500000000000000000000000000000), (16164273491 / 50000000000000000000000000000000)⟩ +lemma CA2_5_9I2R4Entropy_sound : CA2_5_9I2R4Entropy.Encloses (Foundation.finiteEntropy CA2_5_9I2R4Value) := by + exact contains_sound (entropyPair_enclosed CA2_5_9I2R4Value CA2_5_9I2R4Terms CA2_5_9I2R4Terms_sound) (by decide +kernel) +def CA2_5_9I2R4Mass : Ball := ⟨(38400299192288280458012912327183 / 100000000000000000000000000000000), (113 / 100000000000000000000000000000000)⟩ +lemma CA2_5_9I2R4Mass_sound : CA2_5_9I2R4Mass.Encloses (∑ a, CA2_5_9I2R4Value a) := by + exact contains_sound (pairSumBall_sound CA2_5_9I2R4P CA2_5_9I2R4Value CA2_5_9I2R4P_sound) (by decide +kernel) +def CA2_5_9I2R4MassTermLogWitness : LogWitness := ⟨-2, 38400299192288280458012912327183, 25000000000000000000000000000000⟩ +def CA2_5_9I2R4MassTermLog : Ball := ⟨(-5981905843493267938244762848697 / 6250000000000000000000000000000), (63527471343 / 100000000000000000000000000000000)⟩ +lemma CA2_5_9I2R4MassTermLog_sound : CA2_5_9I2R4MassTermLog.Encloses (Real.log ((∑ a, CA2_5_9I2R4Value a))) := by + exact checkLog_sound logTwoBall_sound (CA2_5_9I2R4Mass_sound) (w := CA2_5_9I2R4MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA2_5_9I2R4MassTerm : Ball := ⟨(36753115860838253091643556582981 / 100000000000000000000000000000000), (12197369587 / 50000000000000000000000000000000)⟩ +lemma CA2_5_9I2R4MassTerm_sound : CA2_5_9I2R4MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_5_9I2R4Value a))) := by + exact contains_sound (entropyTerm_ball (CA2_5_9I2R4Mass_sound) CA2_5_9I2R4MassTermLog_sound) (by decide +kernel) +def CA2_5_9I2R4H : Ball := ⟨(32114647130566696017965009494227 / 100000000000000000000000000000000), (14180821539 / 25000000000000000000000000000000)⟩ +lemma CA2_5_9I2R4H_sound : CA2_5_9I2R4H.Encloses (homogeneousEntropy CA2_5_9I2R4Value) := by + exact contains_sound (homogeneous_enclosed CA2_5_9I2R4Value CA2_5_9I2R4MassTerm_sound CA2_5_9I2R4Entropy_sound) (by decide +kernel) +def CA2_5_9I2R5Value (a : PairSlot) : ℝ := residualLaw (below (shape 2 5 9)) (fun u => (stageALaw (shape 2 5 9) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 5 a +def CA2_5_9I2R5Raw (a : PairSlot) : Ball := residualBall (below (shape 2 5 9)) A2_5_9Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 5 a +lemma CA2_5_9I2R5Raw_sound (a : PairSlot) : + (CA2_5_9I2R5Raw a).Encloses (CA2_5_9I2R5Value a) := by + exact residualBall_sound_on (below (shape 2 5 9)) A2_5_9Law (fun u => (stageALaw (shape 2 5 9) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A2_5_9Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 2 5 9) (show (shape 2 5 9) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 5 a +def CA2_5_9I2R5Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(5600488392744089971371737059 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(188261028826472976735768689537 / 100000000000000000000000000000000), (13282637 / 20000000000000000000000000000000)⟩ ⟨(-210094432423051247419052727635687 / 25000000000000000000000000000000), (11858461441 / 4000000000000000000000000000000)⟩ ⟨-13, 5600488392744089971371737059, 3051757812500000000000000000⟩, + .log ⟨(7032027662952837067374330528689 / 50000000000000000000000000000000), (19 / 50000000000000000000000000000000)⟩ ⟨(431051849177102147077217782683 / 1562500000000000000000000000000), (11912718347 / 100000000000000000000000000000000)⟩ ⟨(-196154791118599458479523003440067 / 100000000000000000000000000000000), (84703295001 / 100000000000000000000000000000000)⟩ ⟨-3, 7032027662952837067374330528689, 6250000000000000000000000000000⟩, + .log ⟨(522995654078156671821857071841 / 100000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ ⟨(137374021387740878646307130533 / 5000000000000000000000000000000), (498368879 / 50000000000000000000000000000000)⟩ ⟨(-525335231054182534454967113010739 / 100000000000000000000000000000000), (4764560343 / 2500000000000000000000000000000)⟩ ⟨-8, 522995654078156671821857071841, 390625000000000000000000000000⟩] +lemma CA2_5_9I2R5Certificates_valid : + CA2_5_9I2R5Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_5_9I2R5CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 5, 1 => 1 + | 4, 2 => 2 + | 4, 3 => 3 + | 2, 4 => 2 + | 3, 4 => 3 + | 1, 5 => 1 + | _, _ => 0 +def CA2_5_9I2R5P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_5_9I2R5Certificates (CA2_5_9I2R5CertificateIndex a)).input +lemma CA2_5_9I2R5P_check : ∀ a : PairSlot, contains (CA2_5_9I2R5Raw a) (CA2_5_9I2R5P a) = true := by + decide +kernel +lemma CA2_5_9I2R5P_sound (a : PairSlot) : + (CA2_5_9I2R5P a).Encloses (CA2_5_9I2R5Value a) := + contains_sound (CA2_5_9I2R5Raw_sound a) (CA2_5_9I2R5P_check a) +def CA2_5_9I2R5Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_5_9I2R5Certificates (CA2_5_9I2R5CertificateIndex a)).output +lemma CA2_5_9I2R5Terms_sound (a : PairSlot) : + (CA2_5_9I2R5Terms a).Encloses (Foundation.entropyTerm (CA2_5_9I2R5Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_5_9I2R5Certificates_valid + (CA2_5_9I2R5CertificateIndex a) (CA2_5_9I2R5P_sound a) +def CA2_5_9I2R5Entropy : Ball := ⟨(30523059803915827962603849391909 / 50000000000000000000000000000000), (1297586929 / 5000000000000000000000000000000)⟩ +lemma CA2_5_9I2R5Entropy_sound : CA2_5_9I2R5Entropy.Encloses (Foundation.finiteEntropy CA2_5_9I2R5Value) := by + exact contains_sound (entropyPair_enclosed CA2_5_9I2R5Value CA2_5_9I2R5Terms CA2_5_9I2R5Terms_sound) (by decide +kernel) +def CA2_5_9I2R5Mass : Ball := ⟨(2921890586710961433291201015491 / 10000000000000000000000000000000), (21 / 25000000000000000000000000000000)⟩ +lemma CA2_5_9I2R5Mass_sound : CA2_5_9I2R5Mass.Encloses (∑ a, CA2_5_9I2R5Value a) := by + exact contains_sound (pairSumBall_sound CA2_5_9I2R5P CA2_5_9I2R5Value CA2_5_9I2R5P_sound) (by decide +kernel) +def CA2_5_9I2R5MassTermLogWitness : LogWitness := ⟨-2, 2921890586710961433291201015491, 2500000000000000000000000000000⟩ +def CA2_5_9I2R5MassTermLog : Ball := ⟨(-61517711251202312490872296417681 / 50000000000000000000000000000000), (7940933917 / 12500000000000000000000000000000)⟩ +lemma CA2_5_9I2R5MassTermLog_sound : CA2_5_9I2R5MassTermLog.Encloses (Real.log ((∑ a, CA2_5_9I2R5Value a))) := by + exact checkLog_sound logTwoBall_sound (CA2_5_9I2R5Mass_sound) (w := CA2_5_9I2R5MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA2_5_9I2R5MassTerm : Ball := ⟨(4493700535522275955311475321987 / 12500000000000000000000000000000), (18562032153 / 100000000000000000000000000000000)⟩ +lemma CA2_5_9I2R5MassTerm_sound : CA2_5_9I2R5MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_5_9I2R5Value a))) := by + exact contains_sound (entropyTerm_ball (CA2_5_9I2R5Mass_sound) CA2_5_9I2R5MassTermLog_sound) (by decide +kernel) +def CA2_5_9I2R5H : Ball := ⟨(12548257661826724141357948103961 / 50000000000000000000000000000000), (44513770733 / 100000000000000000000000000000000)⟩ +lemma CA2_5_9I2R5H_sound : CA2_5_9I2R5H.Encloses (homogeneousEntropy CA2_5_9I2R5Value) := by + exact contains_sound (homogeneous_enclosed CA2_5_9I2R5Value CA2_5_9I2R5MassTerm_sound CA2_5_9I2R5Entropy_sound) (by decide +kernel) +def CA2_5_9I2R6Value (a : PairSlot) : ℝ := residualLaw (below (shape 2 5 9)) (fun u => (stageALaw (shape 2 5 9) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 6 a +def CA2_5_9I2R6Raw (a : PairSlot) : Ball := residualBall (below (shape 2 5 9)) A2_5_9Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 6 a +lemma CA2_5_9I2R6Raw_sound (a : PairSlot) : + (CA2_5_9I2R6Raw a).Encloses (CA2_5_9I2R6Value a) := by + exact residualBall_sound_on (below (shape 2 5 9)) A2_5_9Law (fun u => (stageALaw (shape 2 5 9) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A2_5_9Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 2 5 9) (show (shape 2 5 9) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 6 a +def CA2_5_9I2R6Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(127392809289938692686235391 / 781250000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(142213182094479633474873263753 / 100000000000000000000000000000000), (48341857 / 100000000000000000000000000000000)⟩ ⟨(-872137518048179641181611031582051 / 100000000000000000000000000000000), (148230768847 / 50000000000000000000000000000000)⟩ ⟨-13, 127392809289938692686235391, 95367431640625000000000000⟩, + .log ⟨(1027360337815347984744841 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(18896945527695584274138771 / 100000000000000000000000000000000), (6111 / 100000000000000000000000000000000)⟩ ⟨(-459842200251748861877244363010299 / 25000000000000000000000000000000), (118604079991 / 20000000000000000000000000000000)⟩ ⟨-27, 1027360337815347984744841, 745058059692382812500000⟩, + .log ⟨(1709849214635406479942292747789 / 100000000000000000000000000000000), (1 / 12500000000000000000000000000000)⟩ ⟨(6956974636259068527774212910991 / 100000000000000000000000000000000), (1267261313 / 50000000000000000000000000000000)⟩ ⟨(-406876499793726774946044078329567 / 100000000000000000000000000000000), (18528845781 / 12500000000000000000000000000000)⟩ ⟨-6, 1709849214635406479942292747789, 1562500000000000000000000000000⟩] +lemma CA2_5_9I2R6Certificates_valid : + CA2_5_9I2R6Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_5_9I2R6CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 5, 2 => 1 + | 5, 3 => 2 + | 4, 4 => 3 + | 2, 5 => 1 + | 3, 5 => 2 + | _, _ => 0 +def CA2_5_9I2R6P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_5_9I2R6Certificates (CA2_5_9I2R6CertificateIndex a)).input +lemma CA2_5_9I2R6P_check : ∀ a : PairSlot, contains (CA2_5_9I2R6Raw a) (CA2_5_9I2R6P a) = true := by + decide +kernel +lemma CA2_5_9I2R6P_sound (a : PairSlot) : + (CA2_5_9I2R6P a).Encloses (CA2_5_9I2R6Value a) := + contains_sound (CA2_5_9I2R6Raw_sound a) (CA2_5_9I2R6P_check a) +def CA2_5_9I2R6Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_5_9I2R6Certificates (CA2_5_9I2R6CertificateIndex a)).output +lemma CA2_5_9I2R6Terms_sound (a : PairSlot) : + (CA2_5_9I2R6Terms a).Encloses (Foundation.entropyTerm (CA2_5_9I2R6Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_5_9I2R6Certificates_valid + (CA2_5_9I2R6CertificateIndex a) (CA2_5_9I2R6P_sound a) +def CA2_5_9I2R6Entropy : Ball := ⟨(7241438794339083185892507716039 / 100000000000000000000000000000000), (1315609281 / 50000000000000000000000000000000)⟩ +lemma CA2_5_9I2R6Entropy_sound : CA2_5_9I2R6Entropy.Encloses (Foundation.finiteEntropy CA2_5_9I2R6Value) := by + exact contains_sound (entropyPair_enclosed CA2_5_9I2R6Value CA2_5_9I2R6Terms CA2_5_9I2R6Terms_sound) (by decide +kernel) +def CA2_5_9I2R6Mass : Ball := ⟨(1742463828534306415965938497567 / 100000000000000000000000000000000), (3 / 25000000000000000000000000000000)⟩ +lemma CA2_5_9I2R6Mass_sound : CA2_5_9I2R6Mass.Encloses (∑ a, CA2_5_9I2R6Value a) := by + exact contains_sound (pairSumBall_sound CA2_5_9I2R6P CA2_5_9I2R6Value CA2_5_9I2R6P_sound) (by decide +kernel) +def CA2_5_9I2R6MassTermLogWitness : LogWitness := ⟨-6, 1742463828534306415965938497567, 1562500000000000000000000000000⟩ +def CA2_5_9I2R6MassTermLog : Ball := ⟨(-202493504046221639271742787434751 / 50000000000000000000000000000000), (148230766469 / 100000000000000000000000000000000)⟩ +lemma CA2_5_9I2R6MassTermLog_sound : CA2_5_9I2R6MassTermLog.Encloses (Real.log ((∑ a, CA2_5_9I2R6Value a))) := by + exact checkLog_sound logTwoBall_sound (CA2_5_9I2R6Mass_sound) (w := CA2_5_9I2R6MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA2_5_9I2R6MassTerm : Ball := ⟨(7056752126274128498103940381303 / 100000000000000000000000000000000), (1291433769 / 50000000000000000000000000000000)⟩ +lemma CA2_5_9I2R6MassTerm_sound : CA2_5_9I2R6MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_5_9I2R6Value a))) := by + exact contains_sound (entropyTerm_ball (CA2_5_9I2R6Mass_sound) CA2_5_9I2R6MassTermLog_sound) (by decide +kernel) +def CA2_5_9I2R6H : Ball := ⟨(11542916754059667986785458421 / 6250000000000000000000000000000), (52140861 / 1000000000000000000000000000000)⟩ +lemma CA2_5_9I2R6H_sound : CA2_5_9I2R6H.Encloses (homogeneousEntropy CA2_5_9I2R6Value) := by + exact contains_sound (homogeneous_enclosed CA2_5_9I2R6Value CA2_5_9I2R6MassTerm_sound CA2_5_9I2R6Entropy_sound) (by decide +kernel) +def CA2_5_9I2R7Value (a : PairSlot) : ℝ := residualLaw (below (shape 2 5 9)) (fun u => (stageALaw (shape 2 5 9) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 7 a +def CA2_5_9I2R7Raw (a : PairSlot) : Ball := residualBall (below (shape 2 5 9)) A2_5_9Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 7 a +lemma CA2_5_9I2R7Raw_sound (a : PairSlot) : + (CA2_5_9I2R7Raw a).Encloses (CA2_5_9I2R7Value a) := by + exact residualBall_sound_on (below (shape 2 5 9)) A2_5_9Law (fun u => (stageALaw (shape 2 5 9) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A2_5_9Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 2 5 9) (show (shape 2 5 9) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 7 a +def CA2_5_9I2R7Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA2_5_9I2R7Certificates_valid : + CA2_5_9I2R7Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_5_9I2R7CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA2_5_9I2R7P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_5_9I2R7Certificates (CA2_5_9I2R7CertificateIndex a)).input +lemma CA2_5_9I2R7P_check : ∀ a : PairSlot, contains (CA2_5_9I2R7Raw a) (CA2_5_9I2R7P a) = true := by + decide +kernel +lemma CA2_5_9I2R7P_sound (a : PairSlot) : + (CA2_5_9I2R7P a).Encloses (CA2_5_9I2R7Value a) := + contains_sound (CA2_5_9I2R7Raw_sound a) (CA2_5_9I2R7P_check a) +def CA2_5_9I2R7Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_5_9I2R7Certificates (CA2_5_9I2R7CertificateIndex a)).output +lemma CA2_5_9I2R7Terms_sound (a : PairSlot) : + (CA2_5_9I2R7Terms a).Encloses (Foundation.entropyTerm (CA2_5_9I2R7Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_5_9I2R7Certificates_valid + (CA2_5_9I2R7CertificateIndex a) (CA2_5_9I2R7P_sound a) +def CA2_5_9I2R7Entropy : Ball := ⟨0, 0⟩ +lemma CA2_5_9I2R7Entropy_sound : CA2_5_9I2R7Entropy.Encloses (Foundation.finiteEntropy CA2_5_9I2R7Value) := by + exact contains_sound (entropyPair_enclosed CA2_5_9I2R7Value CA2_5_9I2R7Terms CA2_5_9I2R7Terms_sound) (by decide +kernel) +def CA2_5_9I2R7Mass : Ball := ⟨0, 0⟩ +lemma CA2_5_9I2R7Mass_sound : CA2_5_9I2R7Mass.Encloses (∑ a, CA2_5_9I2R7Value a) := by + exact contains_sound (pairSumBall_sound CA2_5_9I2R7P CA2_5_9I2R7Value CA2_5_9I2R7P_sound) (by decide +kernel) +def CA2_5_9I2R7MassTerm : Ball := .exact 0 +lemma CA2_5_9I2R7MassTerm_sound : CA2_5_9I2R7MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_5_9I2R7Value a))) := + entropyTerm_zero_ball (CA2_5_9I2R7Mass_sound) +def CA2_5_9I2R7H : Ball := ⟨0, 0⟩ +lemma CA2_5_9I2R7H_sound : CA2_5_9I2R7H.Encloses (homogeneousEntropy CA2_5_9I2R7Value) := by + exact contains_sound (homogeneous_enclosed CA2_5_9I2R7Value CA2_5_9I2R7MassTerm_sound CA2_5_9I2R7Entropy_sound) (by decide +kernel) +def CA2_5_9I2R8Value (a : PairSlot) : ℝ := residualLaw (below (shape 2 5 9)) (fun u => (stageALaw (shape 2 5 9) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 8 a +def CA2_5_9I2R8Raw (a : PairSlot) : Ball := residualBall (below (shape 2 5 9)) A2_5_9Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 8 a +lemma CA2_5_9I2R8Raw_sound (a : PairSlot) : + (CA2_5_9I2R8Raw a).Encloses (CA2_5_9I2R8Value a) := by + exact residualBall_sound_on (below (shape 2 5 9)) A2_5_9Law (fun u => (stageALaw (shape 2 5 9) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A2_5_9Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 2 5 9) (show (shape 2 5 9) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 8 a +def CA2_5_9I2R8Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA2_5_9I2R8Certificates_valid : + CA2_5_9I2R8Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_5_9I2R8CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA2_5_9I2R8P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_5_9I2R8Certificates (CA2_5_9I2R8CertificateIndex a)).input +lemma CA2_5_9I2R8P_check : ∀ a : PairSlot, contains (CA2_5_9I2R8Raw a) (CA2_5_9I2R8P a) = true := by + decide +kernel +lemma CA2_5_9I2R8P_sound (a : PairSlot) : + (CA2_5_9I2R8P a).Encloses (CA2_5_9I2R8Value a) := + contains_sound (CA2_5_9I2R8Raw_sound a) (CA2_5_9I2R8P_check a) +def CA2_5_9I2R8Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_5_9I2R8Certificates (CA2_5_9I2R8CertificateIndex a)).output +lemma CA2_5_9I2R8Terms_sound (a : PairSlot) : + (CA2_5_9I2R8Terms a).Encloses (Foundation.entropyTerm (CA2_5_9I2R8Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_5_9I2R8Certificates_valid + (CA2_5_9I2R8CertificateIndex a) (CA2_5_9I2R8P_sound a) +def CA2_5_9I2R8Entropy : Ball := ⟨0, 0⟩ +lemma CA2_5_9I2R8Entropy_sound : CA2_5_9I2R8Entropy.Encloses (Foundation.finiteEntropy CA2_5_9I2R8Value) := by + exact contains_sound (entropyPair_enclosed CA2_5_9I2R8Value CA2_5_9I2R8Terms CA2_5_9I2R8Terms_sound) (by decide +kernel) +def CA2_5_9I2R8Mass : Ball := ⟨0, 0⟩ +lemma CA2_5_9I2R8Mass_sound : CA2_5_9I2R8Mass.Encloses (∑ a, CA2_5_9I2R8Value a) := by + exact contains_sound (pairSumBall_sound CA2_5_9I2R8P CA2_5_9I2R8Value CA2_5_9I2R8P_sound) (by decide +kernel) +def CA2_5_9I2R8MassTerm : Ball := .exact 0 +lemma CA2_5_9I2R8MassTerm_sound : CA2_5_9I2R8MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_5_9I2R8Value a))) := + entropyTerm_zero_ball (CA2_5_9I2R8Mass_sound) +def CA2_5_9I2R8H : Ball := ⟨0, 0⟩ +lemma CA2_5_9I2R8H_sound : CA2_5_9I2R8H.Encloses (homogeneousEntropy CA2_5_9I2R8Value) := by + exact contains_sound (homogeneous_enclosed CA2_5_9I2R8Value CA2_5_9I2R8MassTerm_sound CA2_5_9I2R8Entropy_sound) (by decide +kernel) +def CA2_5_9I2R9Value (a : PairSlot) : ℝ := residualLaw (below (shape 2 5 9)) (fun u => (stageALaw (shape 2 5 9) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 9 a +def CA2_5_9I2R9Raw (a : PairSlot) : Ball := residualBall (below (shape 2 5 9)) A2_5_9Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 9 a +lemma CA2_5_9I2R9Raw_sound (a : PairSlot) : + (CA2_5_9I2R9Raw a).Encloses (CA2_5_9I2R9Value a) := by + exact residualBall_sound_on (below (shape 2 5 9)) A2_5_9Law (fun u => (stageALaw (shape 2 5 9) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A2_5_9Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 2 5 9) (show (shape 2 5 9) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 9 a +def CA2_5_9I2R9Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA2_5_9I2R9Certificates_valid : + CA2_5_9I2R9Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_5_9I2R9CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA2_5_9I2R9P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_5_9I2R9Certificates (CA2_5_9I2R9CertificateIndex a)).input +lemma CA2_5_9I2R9P_check : ∀ a : PairSlot, contains (CA2_5_9I2R9Raw a) (CA2_5_9I2R9P a) = true := by + decide +kernel +lemma CA2_5_9I2R9P_sound (a : PairSlot) : + (CA2_5_9I2R9P a).Encloses (CA2_5_9I2R9Value a) := + contains_sound (CA2_5_9I2R9Raw_sound a) (CA2_5_9I2R9P_check a) +def CA2_5_9I2R9Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_5_9I2R9Certificates (CA2_5_9I2R9CertificateIndex a)).output +lemma CA2_5_9I2R9Terms_sound (a : PairSlot) : + (CA2_5_9I2R9Terms a).Encloses (Foundation.entropyTerm (CA2_5_9I2R9Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_5_9I2R9Certificates_valid + (CA2_5_9I2R9CertificateIndex a) (CA2_5_9I2R9P_sound a) +def CA2_5_9I2R9Entropy : Ball := ⟨0, 0⟩ +lemma CA2_5_9I2R9Entropy_sound : CA2_5_9I2R9Entropy.Encloses (Foundation.finiteEntropy CA2_5_9I2R9Value) := by + exact contains_sound (entropyPair_enclosed CA2_5_9I2R9Value CA2_5_9I2R9Terms CA2_5_9I2R9Terms_sound) (by decide +kernel) +def CA2_5_9I2R9Mass : Ball := ⟨0, 0⟩ +lemma CA2_5_9I2R9Mass_sound : CA2_5_9I2R9Mass.Encloses (∑ a, CA2_5_9I2R9Value a) := by + exact contains_sound (pairSumBall_sound CA2_5_9I2R9P CA2_5_9I2R9Value CA2_5_9I2R9P_sound) (by decide +kernel) +def CA2_5_9I2R9MassTerm : Ball := .exact 0 +lemma CA2_5_9I2R9MassTerm_sound : CA2_5_9I2R9MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_5_9I2R9Value a))) := + entropyTerm_zero_ball (CA2_5_9I2R9Mass_sound) +def CA2_5_9I2R9H : Ball := ⟨0, 0⟩ +lemma CA2_5_9I2R9H_sound : CA2_5_9I2R9H.Encloses (homogeneousEntropy CA2_5_9I2R9Value) := by + exact contains_sound (homogeneous_enclosed CA2_5_9I2R9Value CA2_5_9I2R9MassTerm_sound CA2_5_9I2R9Entropy_sound) (by decide +kernel) +def CA2_5_9I2R10Value (a : PairSlot) : ℝ := residualLaw (below (shape 2 5 9)) (fun u => (stageALaw (shape 2 5 9) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 10 a +def CA2_5_9I2R10Raw (a : PairSlot) : Ball := residualBall (below (shape 2 5 9)) A2_5_9Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 10 a +lemma CA2_5_9I2R10Raw_sound (a : PairSlot) : + (CA2_5_9I2R10Raw a).Encloses (CA2_5_9I2R10Value a) := by + exact residualBall_sound_on (below (shape 2 5 9)) A2_5_9Law (fun u => (stageALaw (shape 2 5 9) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A2_5_9Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 2 5 9) (show (shape 2 5 9) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 10 a +def CA2_5_9I2R10Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA2_5_9I2R10Certificates_valid : + CA2_5_9I2R10Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_5_9I2R10CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA2_5_9I2R10P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_5_9I2R10Certificates (CA2_5_9I2R10CertificateIndex a)).input +lemma CA2_5_9I2R10P_check : ∀ a : PairSlot, contains (CA2_5_9I2R10Raw a) (CA2_5_9I2R10P a) = true := by + decide +kernel +lemma CA2_5_9I2R10P_sound (a : PairSlot) : + (CA2_5_9I2R10P a).Encloses (CA2_5_9I2R10Value a) := + contains_sound (CA2_5_9I2R10Raw_sound a) (CA2_5_9I2R10P_check a) +def CA2_5_9I2R10Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_5_9I2R10Certificates (CA2_5_9I2R10CertificateIndex a)).output +lemma CA2_5_9I2R10Terms_sound (a : PairSlot) : + (CA2_5_9I2R10Terms a).Encloses (Foundation.entropyTerm (CA2_5_9I2R10Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_5_9I2R10Certificates_valid + (CA2_5_9I2R10CertificateIndex a) (CA2_5_9I2R10P_sound a) +def CA2_5_9I2R10Entropy : Ball := ⟨0, 0⟩ +lemma CA2_5_9I2R10Entropy_sound : CA2_5_9I2R10Entropy.Encloses (Foundation.finiteEntropy CA2_5_9I2R10Value) := by + exact contains_sound (entropyPair_enclosed CA2_5_9I2R10Value CA2_5_9I2R10Terms CA2_5_9I2R10Terms_sound) (by decide +kernel) +def CA2_5_9I2R10Mass : Ball := ⟨0, 0⟩ +lemma CA2_5_9I2R10Mass_sound : CA2_5_9I2R10Mass.Encloses (∑ a, CA2_5_9I2R10Value a) := by + exact contains_sound (pairSumBall_sound CA2_5_9I2R10P CA2_5_9I2R10Value CA2_5_9I2R10P_sound) (by decide +kernel) +def CA2_5_9I2R10MassTerm : Ball := .exact 0 +lemma CA2_5_9I2R10MassTerm_sound : CA2_5_9I2R10MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_5_9I2R10Value a))) := + entropyTerm_zero_ball (CA2_5_9I2R10Mass_sound) +def CA2_5_9I2R10H : Ball := ⟨0, 0⟩ +lemma CA2_5_9I2R10H_sound : CA2_5_9I2R10H.Encloses (homogeneousEntropy CA2_5_9I2R10Value) := by + exact contains_sound (homogeneous_enclosed CA2_5_9I2R10Value CA2_5_9I2R10MassTerm_sound CA2_5_9I2R10Entropy_sound) (by decide +kernel) +def CA2_5_9I2R11Value (a : PairSlot) : ℝ := residualLaw (below (shape 2 5 9)) (fun u => (stageALaw (shape 2 5 9) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 11 a +def CA2_5_9I2R11Raw (a : PairSlot) : Ball := residualBall (below (shape 2 5 9)) A2_5_9Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 11 a +lemma CA2_5_9I2R11Raw_sound (a : PairSlot) : + (CA2_5_9I2R11Raw a).Encloses (CA2_5_9I2R11Value a) := by + exact residualBall_sound_on (below (shape 2 5 9)) A2_5_9Law (fun u => (stageALaw (shape 2 5 9) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A2_5_9Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 2 5 9) (show (shape 2 5 9) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 11 a +def CA2_5_9I2R11Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA2_5_9I2R11Certificates_valid : + CA2_5_9I2R11Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_5_9I2R11CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA2_5_9I2R11P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_5_9I2R11Certificates (CA2_5_9I2R11CertificateIndex a)).input +lemma CA2_5_9I2R11P_check : ∀ a : PairSlot, contains (CA2_5_9I2R11Raw a) (CA2_5_9I2R11P a) = true := by + decide +kernel +lemma CA2_5_9I2R11P_sound (a : PairSlot) : + (CA2_5_9I2R11P a).Encloses (CA2_5_9I2R11Value a) := + contains_sound (CA2_5_9I2R11Raw_sound a) (CA2_5_9I2R11P_check a) +def CA2_5_9I2R11Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_5_9I2R11Certificates (CA2_5_9I2R11CertificateIndex a)).output +lemma CA2_5_9I2R11Terms_sound (a : PairSlot) : + (CA2_5_9I2R11Terms a).Encloses (Foundation.entropyTerm (CA2_5_9I2R11Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_5_9I2R11Certificates_valid + (CA2_5_9I2R11CertificateIndex a) (CA2_5_9I2R11P_sound a) +def CA2_5_9I2R11Entropy : Ball := ⟨0, 0⟩ +lemma CA2_5_9I2R11Entropy_sound : CA2_5_9I2R11Entropy.Encloses (Foundation.finiteEntropy CA2_5_9I2R11Value) := by + exact contains_sound (entropyPair_enclosed CA2_5_9I2R11Value CA2_5_9I2R11Terms CA2_5_9I2R11Terms_sound) (by decide +kernel) +def CA2_5_9I2R11Mass : Ball := ⟨0, 0⟩ +lemma CA2_5_9I2R11Mass_sound : CA2_5_9I2R11Mass.Encloses (∑ a, CA2_5_9I2R11Value a) := by + exact contains_sound (pairSumBall_sound CA2_5_9I2R11P CA2_5_9I2R11Value CA2_5_9I2R11P_sound) (by decide +kernel) +def CA2_5_9I2R11MassTerm : Ball := .exact 0 +lemma CA2_5_9I2R11MassTerm_sound : CA2_5_9I2R11MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_5_9I2R11Value a))) := + entropyTerm_zero_ball (CA2_5_9I2R11Mass_sound) +def CA2_5_9I2R11H : Ball := ⟨0, 0⟩ +lemma CA2_5_9I2R11H_sound : CA2_5_9I2R11H.Encloses (homogeneousEntropy CA2_5_9I2R11Value) := by + exact contains_sound (homogeneous_enclosed CA2_5_9I2R11Value CA2_5_9I2R11MassTerm_sound CA2_5_9I2R11Entropy_sound) (by decide +kernel) +def CA2_5_9I2R12Value (a : PairSlot) : ℝ := residualLaw (below (shape 2 5 9)) (fun u => (stageALaw (shape 2 5 9) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 12 a +def CA2_5_9I2R12Raw (a : PairSlot) : Ball := residualBall (below (shape 2 5 9)) A2_5_9Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 12 a +lemma CA2_5_9I2R12Raw_sound (a : PairSlot) : + (CA2_5_9I2R12Raw a).Encloses (CA2_5_9I2R12Value a) := by + exact residualBall_sound_on (below (shape 2 5 9)) A2_5_9Law (fun u => (stageALaw (shape 2 5 9) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A2_5_9Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 2 5 9) (show (shape 2 5 9) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 12 a +def CA2_5_9I2R12Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA2_5_9I2R12Certificates_valid : + CA2_5_9I2R12Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_5_9I2R12CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA2_5_9I2R12P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_5_9I2R12Certificates (CA2_5_9I2R12CertificateIndex a)).input +lemma CA2_5_9I2R12P_check : ∀ a : PairSlot, contains (CA2_5_9I2R12Raw a) (CA2_5_9I2R12P a) = true := by + decide +kernel +lemma CA2_5_9I2R12P_sound (a : PairSlot) : + (CA2_5_9I2R12P a).Encloses (CA2_5_9I2R12Value a) := + contains_sound (CA2_5_9I2R12Raw_sound a) (CA2_5_9I2R12P_check a) +def CA2_5_9I2R12Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_5_9I2R12Certificates (CA2_5_9I2R12CertificateIndex a)).output +lemma CA2_5_9I2R12Terms_sound (a : PairSlot) : + (CA2_5_9I2R12Terms a).Encloses (Foundation.entropyTerm (CA2_5_9I2R12Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_5_9I2R12Certificates_valid + (CA2_5_9I2R12CertificateIndex a) (CA2_5_9I2R12P_sound a) +def CA2_5_9I2R12Entropy : Ball := ⟨0, 0⟩ +lemma CA2_5_9I2R12Entropy_sound : CA2_5_9I2R12Entropy.Encloses (Foundation.finiteEntropy CA2_5_9I2R12Value) := by + exact contains_sound (entropyPair_enclosed CA2_5_9I2R12Value CA2_5_9I2R12Terms CA2_5_9I2R12Terms_sound) (by decide +kernel) +def CA2_5_9I2R12Mass : Ball := ⟨0, 0⟩ +lemma CA2_5_9I2R12Mass_sound : CA2_5_9I2R12Mass.Encloses (∑ a, CA2_5_9I2R12Value a) := by + exact contains_sound (pairSumBall_sound CA2_5_9I2R12P CA2_5_9I2R12Value CA2_5_9I2R12P_sound) (by decide +kernel) +def CA2_5_9I2R12MassTerm : Ball := .exact 0 +lemma CA2_5_9I2R12MassTerm_sound : CA2_5_9I2R12MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_5_9I2R12Value a))) := + entropyTerm_zero_ball (CA2_5_9I2R12Mass_sound) +def CA2_5_9I2R12H : Ball := ⟨0, 0⟩ +lemma CA2_5_9I2R12H_sound : CA2_5_9I2R12H.Encloses (homogeneousEntropy CA2_5_9I2R12Value) := by + exact contains_sound (homogeneous_enclosed CA2_5_9I2R12Value CA2_5_9I2R12MassTerm_sound CA2_5_9I2R12Entropy_sound) (by decide +kernel) +def CA2_5_9I2R13Value (a : PairSlot) : ℝ := residualLaw (below (shape 2 5 9)) (fun u => (stageALaw (shape 2 5 9) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 13 a +def CA2_5_9I2R13Raw (a : PairSlot) : Ball := residualBall (below (shape 2 5 9)) A2_5_9Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 13 a +lemma CA2_5_9I2R13Raw_sound (a : PairSlot) : + (CA2_5_9I2R13Raw a).Encloses (CA2_5_9I2R13Value a) := by + exact residualBall_sound_on (below (shape 2 5 9)) A2_5_9Law (fun u => (stageALaw (shape 2 5 9) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A2_5_9Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 2 5 9) (show (shape 2 5 9) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 13 a +def CA2_5_9I2R13Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA2_5_9I2R13Certificates_valid : + CA2_5_9I2R13Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_5_9I2R13CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA2_5_9I2R13P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_5_9I2R13Certificates (CA2_5_9I2R13CertificateIndex a)).input +lemma CA2_5_9I2R13P_check : ∀ a : PairSlot, contains (CA2_5_9I2R13Raw a) (CA2_5_9I2R13P a) = true := by + decide +kernel +lemma CA2_5_9I2R13P_sound (a : PairSlot) : + (CA2_5_9I2R13P a).Encloses (CA2_5_9I2R13Value a) := + contains_sound (CA2_5_9I2R13Raw_sound a) (CA2_5_9I2R13P_check a) +def CA2_5_9I2R13Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_5_9I2R13Certificates (CA2_5_9I2R13CertificateIndex a)).output +lemma CA2_5_9I2R13Terms_sound (a : PairSlot) : + (CA2_5_9I2R13Terms a).Encloses (Foundation.entropyTerm (CA2_5_9I2R13Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_5_9I2R13Certificates_valid + (CA2_5_9I2R13CertificateIndex a) (CA2_5_9I2R13P_sound a) +def CA2_5_9I2R13Entropy : Ball := ⟨0, 0⟩ +lemma CA2_5_9I2R13Entropy_sound : CA2_5_9I2R13Entropy.Encloses (Foundation.finiteEntropy CA2_5_9I2R13Value) := by + exact contains_sound (entropyPair_enclosed CA2_5_9I2R13Value CA2_5_9I2R13Terms CA2_5_9I2R13Terms_sound) (by decide +kernel) +def CA2_5_9I2R13Mass : Ball := ⟨0, 0⟩ +lemma CA2_5_9I2R13Mass_sound : CA2_5_9I2R13Mass.Encloses (∑ a, CA2_5_9I2R13Value a) := by + exact contains_sound (pairSumBall_sound CA2_5_9I2R13P CA2_5_9I2R13Value CA2_5_9I2R13P_sound) (by decide +kernel) +def CA2_5_9I2R13MassTerm : Ball := .exact 0 +lemma CA2_5_9I2R13MassTerm_sound : CA2_5_9I2R13MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_5_9I2R13Value a))) := + entropyTerm_zero_ball (CA2_5_9I2R13Mass_sound) +def CA2_5_9I2R13H : Ball := ⟨0, 0⟩ +lemma CA2_5_9I2R13H_sound : CA2_5_9I2R13H.Encloses (homogeneousEntropy CA2_5_9I2R13Value) := by + exact contains_sound (homogeneous_enclosed CA2_5_9I2R13Value CA2_5_9I2R13MassTerm_sound CA2_5_9I2R13Entropy_sound) (by decide +kernel) +def CA2_5_9I2R14Value (a : PairSlot) : ℝ := residualLaw (below (shape 2 5 9)) (fun u => (stageALaw (shape 2 5 9) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 14 a +def CA2_5_9I2R14Raw (a : PairSlot) : Ball := residualBall (below (shape 2 5 9)) A2_5_9Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 14 a +lemma CA2_5_9I2R14Raw_sound (a : PairSlot) : + (CA2_5_9I2R14Raw a).Encloses (CA2_5_9I2R14Value a) := by + exact residualBall_sound_on (below (shape 2 5 9)) A2_5_9Law (fun u => (stageALaw (shape 2 5 9) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A2_5_9Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 2 5 9) (show (shape 2 5 9) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 14 a +def CA2_5_9I2R14Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA2_5_9I2R14Certificates_valid : + CA2_5_9I2R14Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_5_9I2R14CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA2_5_9I2R14P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_5_9I2R14Certificates (CA2_5_9I2R14CertificateIndex a)).input +lemma CA2_5_9I2R14P_check : ∀ a : PairSlot, contains (CA2_5_9I2R14Raw a) (CA2_5_9I2R14P a) = true := by + decide +kernel +lemma CA2_5_9I2R14P_sound (a : PairSlot) : + (CA2_5_9I2R14P a).Encloses (CA2_5_9I2R14Value a) := + contains_sound (CA2_5_9I2R14Raw_sound a) (CA2_5_9I2R14P_check a) +def CA2_5_9I2R14Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_5_9I2R14Certificates (CA2_5_9I2R14CertificateIndex a)).output +lemma CA2_5_9I2R14Terms_sound (a : PairSlot) : + (CA2_5_9I2R14Terms a).Encloses (Foundation.entropyTerm (CA2_5_9I2R14Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_5_9I2R14Certificates_valid + (CA2_5_9I2R14CertificateIndex a) (CA2_5_9I2R14P_sound a) +def CA2_5_9I2R14Entropy : Ball := ⟨0, 0⟩ +lemma CA2_5_9I2R14Entropy_sound : CA2_5_9I2R14Entropy.Encloses (Foundation.finiteEntropy CA2_5_9I2R14Value) := by + exact contains_sound (entropyPair_enclosed CA2_5_9I2R14Value CA2_5_9I2R14Terms CA2_5_9I2R14Terms_sound) (by decide +kernel) +def CA2_5_9I2R14Mass : Ball := ⟨0, 0⟩ +lemma CA2_5_9I2R14Mass_sound : CA2_5_9I2R14Mass.Encloses (∑ a, CA2_5_9I2R14Value a) := by + exact contains_sound (pairSumBall_sound CA2_5_9I2R14P CA2_5_9I2R14Value CA2_5_9I2R14P_sound) (by decide +kernel) +def CA2_5_9I2R14MassTerm : Ball := .exact 0 +lemma CA2_5_9I2R14MassTerm_sound : CA2_5_9I2R14MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_5_9I2R14Value a))) := + entropyTerm_zero_ball (CA2_5_9I2R14Mass_sound) +def CA2_5_9I2R14H : Ball := ⟨0, 0⟩ +lemma CA2_5_9I2R14H_sound : CA2_5_9I2R14H.Encloses (homogeneousEntropy CA2_5_9I2R14Value) := by + exact contains_sound (homogeneous_enclosed CA2_5_9I2R14Value CA2_5_9I2R14MassTerm_sound CA2_5_9I2R14Entropy_sound) (by decide +kernel) +def CA2_5_9I2R15Value (a : PairSlot) : ℝ := residualLaw (below (shape 2 5 9)) (fun u => (stageALaw (shape 2 5 9) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 15 a +def CA2_5_9I2R15Raw (a : PairSlot) : Ball := residualBall (below (shape 2 5 9)) A2_5_9Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 15 a +lemma CA2_5_9I2R15Raw_sound (a : PairSlot) : + (CA2_5_9I2R15Raw a).Encloses (CA2_5_9I2R15Value a) := by + exact residualBall_sound_on (below (shape 2 5 9)) A2_5_9Law (fun u => (stageALaw (shape 2 5 9) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A2_5_9Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 2 5 9) (show (shape 2 5 9) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 15 a +def CA2_5_9I2R15Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA2_5_9I2R15Certificates_valid : + CA2_5_9I2R15Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_5_9I2R15CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA2_5_9I2R15P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_5_9I2R15Certificates (CA2_5_9I2R15CertificateIndex a)).input +lemma CA2_5_9I2R15P_check : ∀ a : PairSlot, contains (CA2_5_9I2R15Raw a) (CA2_5_9I2R15P a) = true := by + decide +kernel +lemma CA2_5_9I2R15P_sound (a : PairSlot) : + (CA2_5_9I2R15P a).Encloses (CA2_5_9I2R15Value a) := + contains_sound (CA2_5_9I2R15Raw_sound a) (CA2_5_9I2R15P_check a) +def CA2_5_9I2R15Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_5_9I2R15Certificates (CA2_5_9I2R15CertificateIndex a)).output +lemma CA2_5_9I2R15Terms_sound (a : PairSlot) : + (CA2_5_9I2R15Terms a).Encloses (Foundation.entropyTerm (CA2_5_9I2R15Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_5_9I2R15Certificates_valid + (CA2_5_9I2R15CertificateIndex a) (CA2_5_9I2R15P_sound a) +def CA2_5_9I2R15Entropy : Ball := ⟨0, 0⟩ +lemma CA2_5_9I2R15Entropy_sound : CA2_5_9I2R15Entropy.Encloses (Foundation.finiteEntropy CA2_5_9I2R15Value) := by + exact contains_sound (entropyPair_enclosed CA2_5_9I2R15Value CA2_5_9I2R15Terms CA2_5_9I2R15Terms_sound) (by decide +kernel) +def CA2_5_9I2R15Mass : Ball := ⟨0, 0⟩ +lemma CA2_5_9I2R15Mass_sound : CA2_5_9I2R15Mass.Encloses (∑ a, CA2_5_9I2R15Value a) := by + exact contains_sound (pairSumBall_sound CA2_5_9I2R15P CA2_5_9I2R15Value CA2_5_9I2R15P_sound) (by decide +kernel) +def CA2_5_9I2R15MassTerm : Ball := .exact 0 +lemma CA2_5_9I2R15MassTerm_sound : CA2_5_9I2R15MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_5_9I2R15Value a))) := + entropyTerm_zero_ball (CA2_5_9I2R15Mass_sound) +def CA2_5_9I2R15H : Ball := ⟨0, 0⟩ +lemma CA2_5_9I2R15H_sound : CA2_5_9I2R15H.Encloses (homogeneousEntropy CA2_5_9I2R15Value) := by + exact contains_sound (homogeneous_enclosed CA2_5_9I2R15Value CA2_5_9I2R15MassTerm_sound CA2_5_9I2R15Entropy_sound) (by decide +kernel) +def CA2_5_9I2R16Value (a : PairSlot) : ℝ := residualLaw (below (shape 2 5 9)) (fun u => (stageALaw (shape 2 5 9) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 16 a +def CA2_5_9I2R16Raw (a : PairSlot) : Ball := residualBall (below (shape 2 5 9)) A2_5_9Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 16 a +lemma CA2_5_9I2R16Raw_sound (a : PairSlot) : + (CA2_5_9I2R16Raw a).Encloses (CA2_5_9I2R16Value a) := by + exact residualBall_sound_on (below (shape 2 5 9)) A2_5_9Law (fun u => (stageALaw (shape 2 5 9) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A2_5_9Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 2 5 9) (show (shape 2 5 9) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 16 a +def CA2_5_9I2R16Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA2_5_9I2R16Certificates_valid : + CA2_5_9I2R16Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_5_9I2R16CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA2_5_9I2R16P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_5_9I2R16Certificates (CA2_5_9I2R16CertificateIndex a)).input +lemma CA2_5_9I2R16P_check : ∀ a : PairSlot, contains (CA2_5_9I2R16Raw a) (CA2_5_9I2R16P a) = true := by + decide +kernel +lemma CA2_5_9I2R16P_sound (a : PairSlot) : + (CA2_5_9I2R16P a).Encloses (CA2_5_9I2R16Value a) := + contains_sound (CA2_5_9I2R16Raw_sound a) (CA2_5_9I2R16P_check a) +def CA2_5_9I2R16Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_5_9I2R16Certificates (CA2_5_9I2R16CertificateIndex a)).output +lemma CA2_5_9I2R16Terms_sound (a : PairSlot) : + (CA2_5_9I2R16Terms a).Encloses (Foundation.entropyTerm (CA2_5_9I2R16Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_5_9I2R16Certificates_valid + (CA2_5_9I2R16CertificateIndex a) (CA2_5_9I2R16P_sound a) +def CA2_5_9I2R16Entropy : Ball := ⟨0, 0⟩ +lemma CA2_5_9I2R16Entropy_sound : CA2_5_9I2R16Entropy.Encloses (Foundation.finiteEntropy CA2_5_9I2R16Value) := by + exact contains_sound (entropyPair_enclosed CA2_5_9I2R16Value CA2_5_9I2R16Terms CA2_5_9I2R16Terms_sound) (by decide +kernel) +def CA2_5_9I2R16Mass : Ball := ⟨0, 0⟩ +lemma CA2_5_9I2R16Mass_sound : CA2_5_9I2R16Mass.Encloses (∑ a, CA2_5_9I2R16Value a) := by + exact contains_sound (pairSumBall_sound CA2_5_9I2R16P CA2_5_9I2R16Value CA2_5_9I2R16P_sound) (by decide +kernel) +def CA2_5_9I2R16MassTerm : Ball := .exact 0 +lemma CA2_5_9I2R16MassTerm_sound : CA2_5_9I2R16MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_5_9I2R16Value a))) := + entropyTerm_zero_ball (CA2_5_9I2R16Mass_sound) +def CA2_5_9I2R16H : Ball := ⟨0, 0⟩ +lemma CA2_5_9I2R16H_sound : CA2_5_9I2R16H.Encloses (homogeneousEntropy CA2_5_9I2R16Value) := by + exact contains_sound (homogeneous_enclosed CA2_5_9I2R16Value CA2_5_9I2R16MassTerm_sound CA2_5_9I2R16Entropy_sound) (by decide +kernel) +def CA2_5_9I2ResidualEntropies (a : Fin 17) : Ball := + match a.val with + | 0 => CA2_5_9I2R0H + | 1 => CA2_5_9I2R1H + | 2 => CA2_5_9I2R2H + | 3 => CA2_5_9I2R3H + | 4 => CA2_5_9I2R4H + | 5 => CA2_5_9I2R5H + | 6 => CA2_5_9I2R6H + | 7 => CA2_5_9I2R7H + | 8 => CA2_5_9I2R8H + | 9 => CA2_5_9I2R9H + | 10 => CA2_5_9I2R10H + | 11 => CA2_5_9I2R11H + | 12 => CA2_5_9I2R12H + | 13 => CA2_5_9I2R13H + | 14 => CA2_5_9I2R14H + | 15 => CA2_5_9I2R15H + | 16 => CA2_5_9I2R16H + | _ => (.exact 0) +lemma CA2_5_9I2ResidualEntropies_sound (k : Fin 17) : + (CA2_5_9I2ResidualEntropies k).Encloses (homogeneousEntropy + (residualLaw (below (shape 2 5 9)) (fun u => (stageALaw (shape 2 5 9) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) k)) := by + fin_cases k + · exact CA2_5_9I2R0H_sound + · exact CA2_5_9I2R1H_sound + · exact CA2_5_9I2R2H_sound + · exact CA2_5_9I2R3H_sound + · exact CA2_5_9I2R4H_sound + · exact CA2_5_9I2R5H_sound + · exact CA2_5_9I2R6H_sound + · exact CA2_5_9I2R7H_sound + · exact CA2_5_9I2R8H_sound + · exact CA2_5_9I2R9H_sound + · exact CA2_5_9I2R10H_sound + · exact CA2_5_9I2R11H_sound + · exact CA2_5_9I2R12H_sound + · exact CA2_5_9I2R13H_sound + · exact CA2_5_9I2R14H_sound + · exact CA2_5_9I2R15H_sound + · exact CA2_5_9I2R16H_sound +def CA2_5_9I2Singles (s : Shape) : Ball := + match s 0, s 1, s 2 with + | 0, 0, 8 => Z0_0_8H2H + | 0, 1, 7 => Z0_1_7H2H + | 0, 2, 6 => Z0_2_6H2H + | 0, 3, 5 => Z0_3_5H2H + | 0, 4, 4 => Z0_4_4H2H + | 0, 5, 3 => Z0_5_3H2H + | 1, 0, 7 => Z1_0_7H2H + | 2, 0, 6 => Z2_0_6H2H + | _, _, _ => (.exact 0) +lemma CA2_5_9I2Singles_sound (u : Shape) (hu : u ∈ below (shape 2 5 9)) + (hd : designated (Equiv.refl (Fin 3)) 2 u) : + (CA2_5_9I2Singles u).Encloses (homogeneousEntropy ((fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) u)) := by + rw [A2_5_9_below] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl + · exact Z0_0_8H2H_sound + · exact Z0_1_7H2H_sound + · exact Z0_2_6H2H_sound + · exact Z0_3_5H2H_sound + · exact Z0_4_4H2H_sound + · exact Z0_5_3H2H_sound + · exact Z1_0_7H2H_sound + · exact (show ¬ designated (Equiv.refl (Fin 3)) 2 (shape 1 1 6) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 2 (shape 1 2 5) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 2 (shape 1 3 4) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 2 (shape 1 4 3) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 2 (shape 1 5 2) by decide +kernel) hd |>.elim + · exact Z2_0_6H2H_sound + · exact (show ¬ designated (Equiv.refl (Fin 3)) 2 (shape 2 1 5) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 2 (shape 2 2 4) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 2 (shape 2 3 3) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 2 (shape 2 4 2) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 2 (shape 2 5 1) by decide +kernel) hd |>.elim +def CA2_5_9I2Singleton : Ball := ⟨(30652448503721051159498519689651 / 100000000000000000000000000000000), (25420405831 / 100000000000000000000000000000000)⟩ +lemma CA2_5_9I2Singleton_sound : CA2_5_9I2Singleton.Encloses + (singletonEntropy (below (shape 2 5 9)) (fun u => (stageALaw (shape 2 5 9) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ))) := by + exact contains_sound (singletonBall_sound (below (shape 2 5 9)) A2_5_9Law (fun u => (stageALaw (shape 2 5 9) u : ℝ)) (Equiv.refl (Fin 3)) 2 + CA2_5_9I2Singles (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A2_5_9Law_sound u) CA2_5_9I2Singles_sound) (by decide +kernel) +def CA2_5_9I2Group : Ball := ⟨(92938450353625246814009033042313 / 100000000000000000000000000000000), (2909115103 / 2000000000000000000000000000000)⟩ +lemma CA2_5_9I2Group_sound : CA2_5_9I2Group.Encloses + (groupedEntropy (below (shape 2 5 9)) (fun u => (stageALaw (shape 2 5 9) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ))) := by + exact contains_sound (Ball.add_sound CA2_5_9I2Singleton_sound + (finSumBall_sound 17 CA2_5_9I2ResidualEntropies _ CA2_5_9I2ResidualEntropies_sound)) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CA2_5_9I2H : Ball := ⟨(53271317490750496935685571785111 / 50000000000000000000000000000000), (449852656411 / 100000000000000000000000000000000)⟩ +lemma CA2_5_9I2_sound : CA2_5_9I2H.Encloses (stageACapacity (shape 2 5 9) 2) := by + have hb := contains_sound (Ball.add_sound CA2_5_9I2PairH_sound + (Ball.neg_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) CA2_5_9I2Group_sound))) + (show contains (.add CA2_5_9I2PairH (.neg (.mul (.exact 2) CA2_5_9I2Group))) CA2_5_9I2H = true by decide +kernel) + unfold CA2_5_9I2PairValue at hb + simpa only [stageACapacity, nativeCapacity, + show (2 : Fin 3) ≠ 0 by decide, ite_false, sub_eq_add_neg] using hb + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA2_5_9I2Pair.lean b/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA2_5_9I2Pair.lean new file mode 100644 index 0000000000000000000000000000000000000000..2e82d38ba07303dff82c935febc5d346ac3dbcc9 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA2_5_9I2Pair.lean @@ -0,0 +1,355 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Certificates.SupportedContraction + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CA2_5_9I2PairValue (a : PairSlot × PairSlot) : ℝ := pairLaw (below (shape 2 5 9)) (shape 2 5 9) (fun u => (stageALaw (shape 2 5 9) u : ℝ)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) a +def CA2_5_9I2PairRaw (a : PairSlot × PairSlot) : Ball := stageAPairBall (shape 2 5 9) A2_5_9Law 2 a +lemma CA2_5_9I2PairRaw_sound (a : PairSlot × PairSlot) : + (CA2_5_9I2PairRaw a).Encloses (CA2_5_9I2PairValue a) := by + exact stageAPairBall_sound (shape 2 5 9) (by decide +kernel) A2_5_9Law (fun u => (stageALaw (shape 2 5 9) u : ℝ)) (fun u _ => A2_5_9Law_sound u) 2 a +def CA2_5_9I2PairCertificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(15446294267654093658823153 / 25000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ ⟨(44167187154123555521479247 / 5000000000000000000000000000000), (287869 / 100000000000000000000000000000000)⟩ ⟨(-1429701726148437809485208500868057 / 100000000000000000000000000000000), (14558479939 / 3125000000000000000000000000000)⟩ ⟨-21, 15446294267654093658823153, 11920928955078125000000000⟩, + .log ⟨(84052032442162238983050689 / 1250000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(64600496380924024597607279419 / 100000000000000000000000000000000), (166863 / 781250000000000000000000000000)⟩ ⟨(-960721806836985518638331635230389 / 100000000000000000000000000000000), (79409342529 / 25000000000000000000000000000000)⟩ ⟨-14, 84052032442162238983050689, 76293945312500000000000000⟩, + .log ⟨(705809451131630462678057027 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(418592132905089305939269017 / 5000000000000000000000000000000), (709943 / 25000000000000000000000000000000)⟩ ⟨(-296533386053386562209601713744723 / 25000000000000000000000000000000), (201170395829 / 50000000000000000000000000000000)⟩ ⟨-18, 705809451131630462678057027, 381469726562500000000000000⟩, + .log ⟨(2539172379862594985485034207 / 10000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ ⟨(8408217631556750598236341273 / 4000000000000000000000000000000), (34949903 / 50000000000000000000000000000000)⟩ ⟨(-206962554468529074497326552357583 / 25000000000000000000000000000000), (55057143151 / 20000000000000000000000000000000)⟩ ⟨-12, 2539172379862594985485034207, 2441406250000000000000000000⟩, + .log ⟨(1739973811905872310228996631 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(5083777995008492878082370791 / 6250000000000000000000000000000), (5526809 / 20000000000000000000000000000000)⟩ ⟨(-467480874502588062642770565217129 / 50000000000000000000000000000000), (317637366739 / 100000000000000000000000000000000)⟩ ⟨-14, 1739973811905872310228996631, 1220703125000000000000000000⟩, + .log ⟨(58402260536171251710526635451 / 20000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ ⟨(34084335739901796680326445169 / 2000000000000000000000000000000), (618358007 / 100000000000000000000000000000000)⟩ ⟨(-58361329556399230925096300831487 / 10000000000000000000000000000000), (211758237857 / 100000000000000000000000000000000)⟩ ⟨-9, 58402260536171251710526635451, 39062500000000000000000000000⟩, + .log ⟨(14278640094850925349403626367 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(126425374606199016504489849981 / 100000000000000000000000000000000), (21165343 / 50000000000000000000000000000000)⟩ ⟨(-3541664297618643701061301268097 / 400000000000000000000000000000), (59292307713 / 20000000000000000000000000000000)⟩ ⟨-13, 14278640094850925349403626367, 12207031250000000000000000000⟩, + .log ⟨(86026382527472352213840711 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(8180479388768940476805270587 / 100000000000000000000000000000000), (1384483 / 50000000000000000000000000000000)⟩ ⟨(-594329258974457693214005472140213 / 50000000000000000000000000000000), (402340795281 / 100000000000000000000000000000000)⟩ ⟨-18, 86026382527472352213840711, 47683715820312500000000000⟩, + .log ⟨(23082340481041683998002619819 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(193288232751093317953722678819 / 100000000000000000000000000000000), (6843027 / 10000000000000000000000000000000)⟩ ⟨(-837385762114754164081289040510461 / 100000000000000000000000000000000), (148230767947 / 50000000000000000000000000000000)⟩ ⟨-13, 23082340481041683998002619819, 12207031250000000000000000000⟩, + .log ⟨(550607799673663642669837623 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(3143009947149399602298920659 / 25000000000000000000000000000000), (209873 / 5000000000000000000000000000000)⟩ ⟨(-1141651080501297248990336577626623 / 100000000000000000000000000000000), (190582458551 / 50000000000000000000000000000000)⟩ ⟨-17, 550607799673663642669837623, 381469726562500000000000000⟩, + .log ⟨(11866990849385366655841517373 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(181633086877381467666571790489 / 50000000000000000000000000000000), (8167033 / 6250000000000000000000000000000)⟩ ⟨(-765287043626518370341030059745599 / 100000000000000000000000000000000), (55057141997 / 20000000000000000000000000000000)⟩ ⟨-12, 11866990849385366655841517373, 6103515625000000000000000000⟩, + .log ⟨(1608692916285317383165326218947 / 100000000000000000000000000000000), (9 / 100000000000000000000000000000000)⟩ ⟨(6643496659233929492329888614297 / 100000000000000000000000000000000), (596144469 / 25000000000000000000000000000000)⟩ ⟨(-206487409498098409778731111343947 / 50000000000000000000000000000000), (148230766339 / 100000000000000000000000000000000)⟩ ⟨-6, 1608692916285317383165326218947, 1562500000000000000000000000000⟩, + .log ⟨(28409309971425493641883738691 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(154090147190606743745174497911 / 20000000000000000000000000000000), (132349923 / 50000000000000000000000000000000)⟩ ⟨(-677991419650780434290952792169713 / 100000000000000000000000000000000), (14558378837 / 6250000000000000000000000000000)⟩ ⟨-10, 28409309971425493641883738691, 24414062500000000000000000000⟩, + .log ⟨(107108947290321088705277827 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(92025558924514888097155027 / 6250000000000000000000000000000), (476321 / 100000000000000000000000000000000)⟩ ⟨(-1374683422852847512427804488130163 / 100000000000000000000000000000000), (444693230971 / 100000000000000000000000000000000)⟩ ⟨-20, 107108947290321088705277827, 95367431640625000000000000⟩, + .log ⟨(33395000755762067023629784309 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(33413865817779976030903751117 / 12500000000000000000000000000000), (45965837 / 50000000000000000000000000000000)⟩ ⟨(-800451925416163471153135330968053 / 100000000000000000000000000000000), (275285710873 / 100000000000000000000000000000000)⟩ ⟨-12, 33395000755762067023629784309, 24414062500000000000000000000⟩, + .log ⟨(42957770807630410753796535623 / 12500000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ ⟨(1949687009696439029110321217973 / 100000000000000000000000000000000), (145546593 / 20000000000000000000000000000000)⟩ ⟨(-28366331821944252978183552721771 / 5000000000000000000000000000000), (211758237703 / 100000000000000000000000000000000)⟩ ⟨-9, 42957770807630410753796535623, 24414062500000000000000000000⟩, + .log ⟨(45357959008692679574990109 / 312500000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(25655257259670264018236348811 / 20000000000000000000000000000000), (43030059 / 100000000000000000000000000000000)⟩ ⟨(-220944352128765282960911741414623 / 25000000000000000000000000000000), (296461538451 / 100000000000000000000000000000000)⟩ ⟨-13, 45357959008692679574990109, 38146972656250000000000000⟩, + .log ⟨(172201829298600221142046571 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(481845342689352917241842469 / 3125000000000000000000000000000), (1050199 / 20000000000000000000000000000000)⟩ ⟨(-17488393730048114050809343456313 / 1562500000000000000000000000000), (381164898883 / 100000000000000000000000000000000)⟩ ⟨-17, 172201829298600221142046571, 95367431640625000000000000⟩, + .log ⟨(473584118005525788483344343 / 5000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(17550305523345073065062797047 / 20000000000000000000000000000000), (7521403 / 25000000000000000000000000000000)⟩ ⟨(-7411695137606069706457336316063 / 800000000000000000000000000000), (158818682901 / 50000000000000000000000000000000)⟩ ⟨-14, 473584118005525788483344343, 305175781250000000000000000⟩, + .log ⟨(1704846611057765443419689694683 / 100000000000000000000000000000000), (11 / 100000000000000000000000000000000)⟩ ⟨(867701937019035510377027134293 / 12500000000000000000000000000000), (631776811 / 25000000000000000000000000000000)⟩ ⟨(-407169504348862550741190634117577 / 100000000000000000000000000000000), (74115383213 / 50000000000000000000000000000000)⟩ ⟨-6, 1704846611057765443419689694683, 1562500000000000000000000000000⟩, + .log ⟨(15686970506190498850975631706939 / 100000000000000000000000000000000), (13 / 20000000000000000000000000000000)⟩ ⟨(29057598590524459353052409957941 / 100000000000000000000000000000000), (13287381049 / 100000000000000000000000000000000)⟩ ⟨(-185233972225915465518282145669877 / 100000000000000000000000000000000), (42351647573 / 50000000000000000000000000000000)⟩ ⟨-3, 15686970506190498850975631706939, 12500000000000000000000000000000⟩, + .log ⟨(855520585725808059678490900441 / 100000000000000000000000000000000), (1 / 20000000000000000000000000000000)⟩ ⟨(814663542006204400727901155953 / 20000000000000000000000000000000), (362327069 / 25000000000000000000000000000000)⟩ ⟨(-238060765456350390353874769509437 / 50000000000000000000000000000000), (5293955939 / 3125000000000000000000000000000)⟩ ⟨-7, 855520585725808059678490900441, 781250000000000000000000000000⟩, + .log ⟨(44263920102789025748027709351 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(42729929409450221144009063111 / 12500000000000000000000000000000), (24370451 / 20000000000000000000000000000000)⟩ ⟨(-386137778219582956726487384768163 / 50000000000000000000000000000000), (137642855069 / 50000000000000000000000000000000)⟩ ⟨-12, 44263920102789025748027709351, 24414062500000000000000000000⟩, + .log ⟨(56374463679208232589586637 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(555140672245610105378958777 / 10000000000000000000000000000000), (1814553 / 100000000000000000000000000000000)⟩ ⟨(-1230922291794579203485277805836833 / 100000000000000000000000000000000), (100585217927 / 25000000000000000000000000000000)⟩ ⟨-18, 56374463679208232589586637, 47683715820312500000000000⟩, + .log ⟨(11907418120546106973954998073 / 12500000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ ⟨(66265471003274415670941954647 / 10000000000000000000000000000000), (60515857 / 25000000000000000000000000000000)⟩ ⟨(-173908058647843390424453659388811 / 25000000000000000000000000000000), (50821977259 / 20000000000000000000000000000000)⟩ ⟨-11, 11907418120546106973954998073, 6103515625000000000000000000⟩, + .log ⟨(456401022345358579079905858037 / 50000000000000000000000000000000), (1 / 20000000000000000000000000000000)⟩ ⟨(857377877744105901481567653999 / 20000000000000000000000000000000), (1546346841 / 100000000000000000000000000000000)⟩ ⟨(-469640642640436616616333688065959 / 100000000000000000000000000000000), (169406590011 / 100000000000000000000000000000000)⟩ ⟨-7, 456401022345358579079905858037, 390625000000000000000000000000⟩, + .log ⟨(45472273609538329048184605453 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(69989311056368236060141256467 / 20000000000000000000000000000000), (3129467 / 2500000000000000000000000000000)⟩ ⟨(-153916453919487276805097180897989 / 20000000000000000000000000000000), (137642855039 / 50000000000000000000000000000000)⟩ ⟨-12, 45472273609538329048184605453, 24414062500000000000000000000⟩, + .log ⟨(1506358652943883085376084289 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(31362637312322218879349057853 / 100000000000000000000000000000000), (10845463 / 100000000000000000000000000000000)⟩ ⟨(-52050415170102558505774824310057 / 5000000000000000000000000000000), (359989035803 / 100000000000000000000000000000000)⟩ ⟨-16, 1506358652943883085376084289, 762939453125000000000000000⟩] +lemma CA2_5_9I2PairCertificates_valid : + CA2_5_9I2PairCertificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_5_9I2PairCertificateIndex (a : PairSlot × PairSlot) : ℕ := + match a.1.1.val, a.1.2.val, a.2.1.val, a.2.2.val with + | 5, 5, 1, 0 => 1 + | 5, 5, 0, 1 => 1 + | 4, 5, 2, 0 => 2 + | 4, 5, 3, 0 => 3 + | 4, 5, 1, 1 => 4 + | 4, 5, 0, 2 => 2 + | 4, 5, 0, 3 => 3 + | 5, 4, 2, 0 => 2 + | 5, 4, 3, 0 => 3 + | 5, 4, 1, 1 => 4 + | 5, 4, 0, 2 => 2 + | 5, 4, 0, 3 => 3 + | 2, 5, 4, 0 => 5 + | 2, 5, 2, 1 => 6 + | 2, 5, 3, 1 => 7 + | 2, 5, 1, 2 => 6 + | 2, 5, 1, 3 => 7 + | 2, 5, 0, 4 => 5 + | 3, 5, 4, 0 => 8 + | 3, 5, 2, 1 => 9 + | 3, 5, 3, 1 => 10 + | 3, 5, 1, 2 => 9 + | 3, 5, 1, 3 => 10 + | 3, 5, 0, 4 => 8 + | 4, 4, 4, 0 => 11 + | 4, 4, 2, 1 => 12 + | 4, 4, 3, 1 => 13 + | 4, 4, 1, 2 => 12 + | 4, 4, 1, 3 => 13 + | 4, 4, 0, 4 => 11 + | 5, 2, 4, 0 => 5 + | 5, 2, 2, 1 => 6 + | 5, 2, 3, 1 => 7 + | 5, 2, 1, 2 => 6 + | 5, 2, 1, 3 => 7 + | 5, 2, 0, 4 => 5 + | 5, 3, 4, 0 => 8 + | 5, 3, 2, 1 => 9 + | 5, 3, 3, 1 => 10 + | 5, 3, 1, 2 => 9 + | 5, 3, 1, 3 => 10 + | 5, 3, 0, 4 => 8 + | 1, 5, 5, 0 => 14 + | 1, 5, 4, 1 => 15 + | 1, 5, 2, 2 => 16 + | 1, 5, 2, 3 => 17 + | 1, 5, 3, 2 => 17 + | 1, 5, 3, 3 => 18 + | 1, 5, 1, 4 => 15 + | 1, 5, 0, 5 => 14 + | 2, 4, 5, 0 => 19 + | 2, 4, 4, 1 => 20 + | 2, 4, 2, 2 => 21 + | 2, 4, 2, 3 => 22 + | 2, 4, 3, 2 => 22 + | 2, 4, 3, 3 => 23 + | 2, 4, 1, 4 => 20 + | 2, 4, 0, 5 => 19 + | 3, 4, 5, 0 => 24 + | 3, 4, 4, 1 => 25 + | 3, 4, 2, 2 => 26 + | 3, 4, 2, 3 => 27 + | 3, 4, 3, 2 => 27 + | 3, 4, 3, 3 => 28 + | 3, 4, 1, 4 => 25 + | 3, 4, 0, 5 => 24 + | 4, 2, 5, 0 => 19 + | 4, 2, 4, 1 => 20 + | 4, 2, 2, 2 => 21 + | 4, 2, 2, 3 => 22 + | 4, 2, 3, 2 => 22 + | 4, 2, 3, 3 => 23 + | 4, 2, 1, 4 => 20 + | 4, 2, 0, 5 => 19 + | 4, 3, 5, 0 => 24 + | 4, 3, 4, 1 => 25 + | 4, 3, 2, 2 => 26 + | 4, 3, 2, 3 => 27 + | 4, 3, 3, 2 => 27 + | 4, 3, 3, 3 => 28 + | 4, 3, 1, 4 => 25 + | 4, 3, 0, 5 => 24 + | 5, 1, 5, 0 => 14 + | 5, 1, 4, 1 => 15 + | 5, 1, 2, 2 => 16 + | 5, 1, 2, 3 => 17 + | 5, 1, 3, 2 => 17 + | 5, 1, 3, 3 => 18 + | 5, 1, 1, 4 => 15 + | 5, 1, 0, 5 => 14 + | 5, 0, 5, 1 => 14 + | 5, 0, 4, 2 => 19 + | 5, 0, 4, 3 => 24 + | 5, 0, 2, 4 => 19 + | 5, 0, 3, 4 => 24 + | 5, 0, 1, 5 => 14 + | 4, 1, 5, 1 => 15 + | 4, 1, 4, 2 => 20 + | 4, 1, 4, 3 => 25 + | 4, 1, 2, 4 => 20 + | 4, 1, 3, 4 => 25 + | 4, 1, 1, 5 => 15 + | 2, 2, 5, 1 => 16 + | 2, 2, 4, 2 => 21 + | 2, 2, 4, 3 => 26 + | 2, 2, 2, 4 => 21 + | 2, 2, 3, 4 => 26 + | 2, 2, 1, 5 => 16 + | 2, 3, 5, 1 => 17 + | 2, 3, 4, 2 => 22 + | 2, 3, 4, 3 => 27 + | 2, 3, 2, 4 => 22 + | 2, 3, 3, 4 => 27 + | 2, 3, 1, 5 => 17 + | 3, 2, 5, 1 => 17 + | 3, 2, 4, 2 => 22 + | 3, 2, 4, 3 => 27 + | 3, 2, 2, 4 => 22 + | 3, 2, 3, 4 => 27 + | 3, 2, 1, 5 => 17 + | 3, 3, 5, 1 => 18 + | 3, 3, 4, 2 => 23 + | 3, 3, 4, 3 => 28 + | 3, 3, 2, 4 => 23 + | 3, 3, 3, 4 => 28 + | 3, 3, 1, 5 => 18 + | 1, 4, 5, 1 => 15 + | 1, 4, 4, 2 => 20 + | 1, 4, 4, 3 => 25 + | 1, 4, 2, 4 => 20 + | 1, 4, 3, 4 => 25 + | 1, 4, 1, 5 => 15 + | 0, 5, 5, 1 => 14 + | 0, 5, 4, 2 => 19 + | 0, 5, 4, 3 => 24 + | 0, 5, 2, 4 => 19 + | 0, 5, 3, 4 => 24 + | 0, 5, 1, 5 => 14 + | 4, 0, 2, 5 => 5 + | 4, 0, 3, 5 => 8 + | 4, 0, 4, 4 => 11 + | 4, 0, 5, 2 => 5 + | 4, 0, 5, 3 => 8 + | 2, 1, 2, 5 => 6 + | 2, 1, 3, 5 => 9 + | 2, 1, 4, 4 => 12 + | 2, 1, 5, 2 => 6 + | 2, 1, 5, 3 => 9 + | 3, 1, 2, 5 => 7 + | 3, 1, 3, 5 => 10 + | 3, 1, 4, 4 => 13 + | 3, 1, 5, 2 => 7 + | 3, 1, 5, 3 => 10 + | 1, 2, 2, 5 => 6 + | 1, 2, 3, 5 => 9 + | 1, 2, 4, 4 => 12 + | 1, 2, 5, 2 => 6 + | 1, 2, 5, 3 => 9 + | 1, 3, 2, 5 => 7 + | 1, 3, 3, 5 => 10 + | 1, 3, 4, 4 => 13 + | 1, 3, 5, 2 => 7 + | 1, 3, 5, 3 => 10 + | 0, 4, 2, 5 => 5 + | 0, 4, 3, 5 => 8 + | 0, 4, 4, 4 => 11 + | 0, 4, 5, 2 => 5 + | 0, 4, 5, 3 => 8 + | 2, 0, 4, 5 => 2 + | 2, 0, 5, 4 => 2 + | 3, 0, 4, 5 => 3 + | 3, 0, 5, 4 => 3 + | 1, 1, 4, 5 => 4 + | 1, 1, 5, 4 => 4 + | 0, 2, 4, 5 => 2 + | 0, 2, 5, 4 => 2 + | 0, 3, 4, 5 => 3 + | 0, 3, 5, 4 => 3 + | 1, 0, 5, 5 => 1 + | 0, 1, 5, 5 => 1 + | _, _, _, _ => 0 +def CA2_5_9I2PairP (a : PairSlot × PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_5_9I2PairCertificates (CA2_5_9I2PairCertificateIndex a)).input +lemma CA2_5_9I2PairP_check_0_0 : ∀ k l : Fin 6, contains (CA2_5_9I2PairRaw ((0,0),(k,l))) (CA2_5_9I2PairP ((0,0),(k,l))) = true := by + decide +kernel +lemma CA2_5_9I2PairP_check_0_1 : ∀ k l : Fin 6, contains (CA2_5_9I2PairRaw ((0,1),(k,l))) (CA2_5_9I2PairP ((0,1),(k,l))) = true := by + decide +kernel +lemma CA2_5_9I2PairP_check_0_2 : ∀ k l : Fin 6, contains (CA2_5_9I2PairRaw ((0,2),(k,l))) (CA2_5_9I2PairP ((0,2),(k,l))) = true := by + decide +kernel +lemma CA2_5_9I2PairP_check_0_3 : ∀ k l : Fin 6, contains (CA2_5_9I2PairRaw ((0,3),(k,l))) (CA2_5_9I2PairP ((0,3),(k,l))) = true := by + decide +kernel +lemma CA2_5_9I2PairP_check_0_4 : ∀ k l : Fin 6, contains (CA2_5_9I2PairRaw ((0,4),(k,l))) (CA2_5_9I2PairP ((0,4),(k,l))) = true := by + decide +kernel +lemma CA2_5_9I2PairP_check_0_5 : ∀ k l : Fin 6, contains (CA2_5_9I2PairRaw ((0,5),(k,l))) (CA2_5_9I2PairP ((0,5),(k,l))) = true := by + decide +kernel +lemma CA2_5_9I2PairP_check_1_0 : ∀ k l : Fin 6, contains (CA2_5_9I2PairRaw ((1,0),(k,l))) (CA2_5_9I2PairP ((1,0),(k,l))) = true := by + decide +kernel +lemma CA2_5_9I2PairP_check_1_1 : ∀ k l : Fin 6, contains (CA2_5_9I2PairRaw ((1,1),(k,l))) (CA2_5_9I2PairP ((1,1),(k,l))) = true := by + decide +kernel +lemma CA2_5_9I2PairP_check_1_2 : ∀ k l : Fin 6, contains (CA2_5_9I2PairRaw ((1,2),(k,l))) (CA2_5_9I2PairP ((1,2),(k,l))) = true := by + decide +kernel +lemma CA2_5_9I2PairP_check_1_3 : ∀ k l : Fin 6, contains (CA2_5_9I2PairRaw ((1,3),(k,l))) (CA2_5_9I2PairP ((1,3),(k,l))) = true := by + decide +kernel +lemma CA2_5_9I2PairP_check_1_4 : ∀ k l : Fin 6, contains (CA2_5_9I2PairRaw ((1,4),(k,l))) (CA2_5_9I2PairP ((1,4),(k,l))) = true := by + decide +kernel +lemma CA2_5_9I2PairP_check_1_5 : ∀ k l : Fin 6, contains (CA2_5_9I2PairRaw ((1,5),(k,l))) (CA2_5_9I2PairP ((1,5),(k,l))) = true := by + decide +kernel +lemma CA2_5_9I2PairP_check_2_0 : ∀ k l : Fin 6, contains (CA2_5_9I2PairRaw ((2,0),(k,l))) (CA2_5_9I2PairP ((2,0),(k,l))) = true := by + decide +kernel +lemma CA2_5_9I2PairP_check_2_1 : ∀ k l : Fin 6, contains (CA2_5_9I2PairRaw ((2,1),(k,l))) (CA2_5_9I2PairP ((2,1),(k,l))) = true := by + decide +kernel +lemma CA2_5_9I2PairP_check_2_2 : ∀ k l : Fin 6, contains (CA2_5_9I2PairRaw ((2,2),(k,l))) (CA2_5_9I2PairP ((2,2),(k,l))) = true := by + decide +kernel +lemma CA2_5_9I2PairP_check_2_3 : ∀ k l : Fin 6, contains (CA2_5_9I2PairRaw ((2,3),(k,l))) (CA2_5_9I2PairP ((2,3),(k,l))) = true := by + decide +kernel +lemma CA2_5_9I2PairP_check_2_4 : ∀ k l : Fin 6, contains (CA2_5_9I2PairRaw ((2,4),(k,l))) (CA2_5_9I2PairP ((2,4),(k,l))) = true := by + decide +kernel +lemma CA2_5_9I2PairP_check_2_5 : ∀ k l : Fin 6, contains (CA2_5_9I2PairRaw ((2,5),(k,l))) (CA2_5_9I2PairP ((2,5),(k,l))) = true := by + decide +kernel +lemma CA2_5_9I2PairP_check_3_0 : ∀ k l : Fin 6, contains (CA2_5_9I2PairRaw ((3,0),(k,l))) (CA2_5_9I2PairP ((3,0),(k,l))) = true := by + decide +kernel +lemma CA2_5_9I2PairP_check_3_1 : ∀ k l : Fin 6, contains (CA2_5_9I2PairRaw ((3,1),(k,l))) (CA2_5_9I2PairP ((3,1),(k,l))) = true := by + decide +kernel +lemma CA2_5_9I2PairP_check_3_2 : ∀ k l : Fin 6, contains (CA2_5_9I2PairRaw ((3,2),(k,l))) (CA2_5_9I2PairP ((3,2),(k,l))) = true := by + decide +kernel +lemma CA2_5_9I2PairP_check_3_3 : ∀ k l : Fin 6, contains (CA2_5_9I2PairRaw ((3,3),(k,l))) (CA2_5_9I2PairP ((3,3),(k,l))) = true := by + decide +kernel +lemma CA2_5_9I2PairP_check_3_4 : ∀ k l : Fin 6, contains (CA2_5_9I2PairRaw ((3,4),(k,l))) (CA2_5_9I2PairP ((3,4),(k,l))) = true := by + decide +kernel +lemma CA2_5_9I2PairP_check_3_5 : ∀ k l : Fin 6, contains (CA2_5_9I2PairRaw ((3,5),(k,l))) (CA2_5_9I2PairP ((3,5),(k,l))) = true := by + decide +kernel +lemma CA2_5_9I2PairP_check_4_0 : ∀ k l : Fin 6, contains (CA2_5_9I2PairRaw ((4,0),(k,l))) (CA2_5_9I2PairP ((4,0),(k,l))) = true := by + decide +kernel +lemma CA2_5_9I2PairP_check_4_1 : ∀ k l : Fin 6, contains (CA2_5_9I2PairRaw ((4,1),(k,l))) (CA2_5_9I2PairP ((4,1),(k,l))) = true := by + decide +kernel +lemma CA2_5_9I2PairP_check_4_2 : ∀ k l : Fin 6, contains (CA2_5_9I2PairRaw ((4,2),(k,l))) (CA2_5_9I2PairP ((4,2),(k,l))) = true := by + decide +kernel +lemma CA2_5_9I2PairP_check_4_3 : ∀ k l : Fin 6, contains (CA2_5_9I2PairRaw ((4,3),(k,l))) (CA2_5_9I2PairP ((4,3),(k,l))) = true := by + decide +kernel +lemma CA2_5_9I2PairP_check_4_4 : ∀ k l : Fin 6, contains (CA2_5_9I2PairRaw ((4,4),(k,l))) (CA2_5_9I2PairP ((4,4),(k,l))) = true := by + decide +kernel +lemma CA2_5_9I2PairP_check_4_5 : ∀ k l : Fin 6, contains (CA2_5_9I2PairRaw ((4,5),(k,l))) (CA2_5_9I2PairP ((4,5),(k,l))) = true := by + decide +kernel +lemma CA2_5_9I2PairP_check_5_0 : ∀ k l : Fin 6, contains (CA2_5_9I2PairRaw ((5,0),(k,l))) (CA2_5_9I2PairP ((5,0),(k,l))) = true := by + decide +kernel +lemma CA2_5_9I2PairP_check_5_1 : ∀ k l : Fin 6, contains (CA2_5_9I2PairRaw ((5,1),(k,l))) (CA2_5_9I2PairP ((5,1),(k,l))) = true := by + decide +kernel +lemma CA2_5_9I2PairP_check_5_2 : ∀ k l : Fin 6, contains (CA2_5_9I2PairRaw ((5,2),(k,l))) (CA2_5_9I2PairP ((5,2),(k,l))) = true := by + decide +kernel +lemma CA2_5_9I2PairP_check_5_3 : ∀ k l : Fin 6, contains (CA2_5_9I2PairRaw ((5,3),(k,l))) (CA2_5_9I2PairP ((5,3),(k,l))) = true := by + decide +kernel +lemma CA2_5_9I2PairP_check_5_4 : ∀ k l : Fin 6, contains (CA2_5_9I2PairRaw ((5,4),(k,l))) (CA2_5_9I2PairP ((5,4),(k,l))) = true := by + decide +kernel +lemma CA2_5_9I2PairP_check_5_5 : ∀ k l : Fin 6, contains (CA2_5_9I2PairRaw ((5,5),(k,l))) (CA2_5_9I2PairP ((5,5),(k,l))) = true := by + decide +kernel +lemma CA2_5_9I2PairP_check (a : PairSlot × PairSlot) : contains (CA2_5_9I2PairRaw a) (CA2_5_9I2PairP a) = true := by + rcases a with ⟨⟨i,j⟩,⟨k,l⟩⟩ + revert j i + apply forall_fin6 + · exact forall_fin6 (CA2_5_9I2PairP_check_0_0 k l) (CA2_5_9I2PairP_check_0_1 k l) (CA2_5_9I2PairP_check_0_2 k l) (CA2_5_9I2PairP_check_0_3 k l) (CA2_5_9I2PairP_check_0_4 k l) (CA2_5_9I2PairP_check_0_5 k l) + · exact forall_fin6 (CA2_5_9I2PairP_check_1_0 k l) (CA2_5_9I2PairP_check_1_1 k l) (CA2_5_9I2PairP_check_1_2 k l) (CA2_5_9I2PairP_check_1_3 k l) (CA2_5_9I2PairP_check_1_4 k l) (CA2_5_9I2PairP_check_1_5 k l) + · exact forall_fin6 (CA2_5_9I2PairP_check_2_0 k l) (CA2_5_9I2PairP_check_2_1 k l) (CA2_5_9I2PairP_check_2_2 k l) (CA2_5_9I2PairP_check_2_3 k l) (CA2_5_9I2PairP_check_2_4 k l) (CA2_5_9I2PairP_check_2_5 k l) + · exact forall_fin6 (CA2_5_9I2PairP_check_3_0 k l) (CA2_5_9I2PairP_check_3_1 k l) (CA2_5_9I2PairP_check_3_2 k l) (CA2_5_9I2PairP_check_3_3 k l) (CA2_5_9I2PairP_check_3_4 k l) (CA2_5_9I2PairP_check_3_5 k l) + · exact forall_fin6 (CA2_5_9I2PairP_check_4_0 k l) (CA2_5_9I2PairP_check_4_1 k l) (CA2_5_9I2PairP_check_4_2 k l) (CA2_5_9I2PairP_check_4_3 k l) (CA2_5_9I2PairP_check_4_4 k l) (CA2_5_9I2PairP_check_4_5 k l) + · exact forall_fin6 (CA2_5_9I2PairP_check_5_0 k l) (CA2_5_9I2PairP_check_5_1 k l) (CA2_5_9I2PairP_check_5_2 k l) (CA2_5_9I2PairP_check_5_3 k l) (CA2_5_9I2PairP_check_5_4 k l) (CA2_5_9I2PairP_check_5_5 k l) +lemma CA2_5_9I2PairP_sound (a : PairSlot × PairSlot) : + (CA2_5_9I2PairP a).Encloses (CA2_5_9I2PairValue a) := + contains_sound (CA2_5_9I2PairRaw_sound a) (CA2_5_9I2PairP_check a) +def CA2_5_9I2PairTerms (a : PairSlot × PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_5_9I2PairCertificates (CA2_5_9I2PairCertificateIndex a)).output +lemma CA2_5_9I2PairTerms_sound (a : PairSlot × PairSlot) : + (CA2_5_9I2PairTerms a).Encloses (Foundation.entropyTerm (CA2_5_9I2PairValue a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_5_9I2PairCertificates_valid + (CA2_5_9I2PairCertificateIndex a) (CA2_5_9I2PairP_sound a) +def CA2_5_9I2PairEntropy : Ball := ⟨(73104883922187871874847302413713 / 25000000000000000000000000000000), (29147374527 / 25000000000000000000000000000000)⟩ +lemma CA2_5_9I2PairEntropy_sound : CA2_5_9I2PairEntropy.Encloses (Foundation.finiteEntropy CA2_5_9I2PairValue) := by + exact contains_sound (entropyDoublePair_enclosed CA2_5_9I2PairValue CA2_5_9I2PairTerms CA2_5_9I2PairTerms_sound) (by decide +kernel) +def CA2_5_9I2PairMass : Ball := ⟨(24999999999999999999999999999999 / 25000000000000000000000000000000), (159 / 25000000000000000000000000000000)⟩ +lemma CA2_5_9I2PairMass_sound : CA2_5_9I2PairMass.Encloses (∑ a, CA2_5_9I2PairValue a) := by + exact contains_sound (doublePairSumBall_sound CA2_5_9I2PairP CA2_5_9I2PairValue CA2_5_9I2PairP_sound) (by decide +kernel) +def CA2_5_9I2PairMassTermLogWitness : LogWitness := ⟨-1, 24999999999999999999999999999999, 12500000000000000000000000000000⟩ +def CA2_5_9I2PairMassTermLog : Ball := ⟨(-1 / 25000000000000000000000000000000), (21175824001 / 50000000000000000000000000000000)⟩ +lemma CA2_5_9I2PairMassTermLog_sound : CA2_5_9I2PairMassTermLog.Encloses (Real.log ((∑ a, CA2_5_9I2PairValue a))) := by + exact checkLog_sound logTwoBall_sound (CA2_5_9I2PairMass_sound) (w := CA2_5_9I2PairMassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA2_5_9I2PairMassTerm : Ball := ⟨(1 / 25000000000000000000000000000000), (42351648003 / 100000000000000000000000000000000)⟩ +lemma CA2_5_9I2PairMassTerm_sound : CA2_5_9I2PairMassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_5_9I2PairValue a))) := by + exact contains_sound (entropyTerm_ball (CA2_5_9I2PairMass_sound) CA2_5_9I2PairMassTermLog_sound) (by decide +kernel) +def CA2_5_9I2PairH : Ball := ⟨(4569055245136741992177956400857 / 1562500000000000000000000000000), (158941146111 / 100000000000000000000000000000000)⟩ +lemma CA2_5_9I2PairH_sound : CA2_5_9I2PairH.Encloses (homogeneousEntropy CA2_5_9I2PairValue) := by + exact contains_sound (homogeneous_enclosed CA2_5_9I2PairValue CA2_5_9I2PairMassTerm_sound CA2_5_9I2PairEntropy_sound) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA2_6_8I0.lean b/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA2_6_8I0.lean new file mode 100644 index 0000000000000000000000000000000000000000..343687377426b62b007ef9c7ddbfe30065b78b6d --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA2_6_8I0.lean @@ -0,0 +1,74 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Certificates.SplitA2_6_8 + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CA2_6_8I0Value (a : Fin 17) : ℝ := marginal (below (shape 2 6 8)) (fun u => (stageALaw (shape 2 6 8) u : ℝ)) ((Equiv.refl (Fin 3)) 0) a +def CA2_6_8I0Raw (a : Fin 17) : Ball := marginalBall (below (shape 2 6 8)) A2_6_8Law ((Equiv.refl (Fin 3)) 0) a +lemma CA2_6_8I0Raw_sound (a : Fin 17) : + (CA2_6_8I0Raw a).Encloses (CA2_6_8I0Value a) := by + exact marginalBall_sound (below (shape 2 6 8)) A2_6_8Law (fun u => (stageALaw (shape 2 6 8) u : ℝ)) (fun u _ => A2_6_8Law_sound u) ((Equiv.refl (Fin 3)) 0) a +def CA2_6_8I0Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(5031635526765957794431946269157 / 20000000000000000000000000000000), (59 / 50000000000000000000000000000000)⟩ ⟨(4339745350595764104085212084849 / 12500000000000000000000000000000), (7991177147 / 50000000000000000000000000000000)⟩ ⟨(-68999359393347786611655126869357 / 50000000000000000000000000000000), (63527471517 / 100000000000000000000000000000000)⟩ ⟨-2, 5031635526765957794431946269157, 5000000000000000000000000000000⟩, + .log ⟨(49683644732340422055680537308427 / 100000000000000000000000000000000), (137 / 100000000000000000000000000000000)⟩ ⟨(34753430609830510821655789687667 / 100000000000000000000000000000000), (31562763257 / 100000000000000000000000000000000)⟩ ⟨(-34974719343817148668740251262693 / 50000000000000000000000000000000), (15881867831 / 25000000000000000000000000000000)⟩ ⟨-2, 49683644732340422055680537308427, 25000000000000000000000000000000⟩] +lemma CA2_6_8I0Certificates_valid : + CA2_6_8I0Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_6_8I0CertificateIndex (a : Fin 17) : ℕ := + match a.val with + | 0 => 1 + | 1 => 2 + | 2 => 1 + | _ => 0 +def CA2_6_8I0P (a : Fin 17) : Ball := + (CompactCertificate.entropyLookup CA2_6_8I0Certificates (CA2_6_8I0CertificateIndex a)).input +lemma CA2_6_8I0P_check : ∀ a : Fin 17, contains (CA2_6_8I0Raw a) (CA2_6_8I0P a) = true := by + decide +kernel +lemma CA2_6_8I0P_sound (a : Fin 17) : + (CA2_6_8I0P a).Encloses (CA2_6_8I0Value a) := + contains_sound (CA2_6_8I0Raw_sound a) (CA2_6_8I0P_check a) +def CA2_6_8I0Terms (a : Fin 17) : Ball := + (CompactCertificate.entropyLookup CA2_6_8I0Certificates (CA2_6_8I0CertificateIndex a)).output +lemma CA2_6_8I0Terms_sound (a : Fin 17) : + (CA2_6_8I0Terms a).Encloses (Foundation.entropyTerm (CA2_6_8I0Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_6_8I0Certificates_valid + (CA2_6_8I0CertificateIndex a) (CA2_6_8I0P_sound a) +def CA2_6_8I0Entropy : Ball := ⟨(104189356219362736487019183045251 / 100000000000000000000000000000000), (12705494369 / 20000000000000000000000000000000)⟩ +lemma CA2_6_8I0Entropy_sound : CA2_6_8I0Entropy.Encloses (Foundation.finiteEntropy CA2_6_8I0Value) := by + exact contains_sound (entropyFin_enclosed 17 CA2_6_8I0Value CA2_6_8I0Terms CA2_6_8I0Terms_sound) (by decide +kernel) +def CA2_6_8I0Mass : Ball := ⟨(99999999999999999999999999999997 / 100000000000000000000000000000000), (373 / 100000000000000000000000000000000)⟩ +lemma CA2_6_8I0Mass_sound : CA2_6_8I0Mass.Encloses (∑ a, CA2_6_8I0Value a) := by + exact contains_sound (finSumBall_sound 17 CA2_6_8I0P CA2_6_8I0Value CA2_6_8I0P_sound) (by decide +kernel) +def CA2_6_8I0MassTermLogWitness : LogWitness := ⟨-1, 99999999999999999999999999999997, 50000000000000000000000000000000⟩ +def CA2_6_8I0MassTermLog : Ball := ⟨(-1 / 50000000000000000000000000000000), (42351647739 / 100000000000000000000000000000000)⟩ +lemma CA2_6_8I0MassTermLog_sound : CA2_6_8I0MassTermLog.Encloses (Real.log ((∑ a, CA2_6_8I0Value a))) := by + exact checkLog_sound logTwoBall_sound (CA2_6_8I0Mass_sound) (w := CA2_6_8I0MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA2_6_8I0MassTerm : Ball := ⟨(1 / 50000000000000000000000000000000), (2117582387 / 5000000000000000000000000000000)⟩ +lemma CA2_6_8I0MassTerm_sound : CA2_6_8I0MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_6_8I0Value a))) := by + exact contains_sound (entropyTerm_ball (CA2_6_8I0Mass_sound) CA2_6_8I0MassTermLog_sound) (by decide +kernel) +def CA2_6_8I0H : Ball := ⟨(104189356219362736487019183045249 / 100000000000000000000000000000000), (21175823917 / 20000000000000000000000000000000)⟩ +lemma CA2_6_8I0H_sound : CA2_6_8I0H.Encloses (homogeneousEntropy CA2_6_8I0Value) := by + exact contains_sound (homogeneous_enclosed CA2_6_8I0Value CA2_6_8I0MassTerm_sound CA2_6_8I0Entropy_sound) (by decide +kernel) +lemma CA2_6_8I0_sound : CA2_6_8I0H.Encloses (stageACapacity (shape 2 6 8) 0) := by + exact CA2_6_8I0H_sound + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA2_6_8I1.lean b/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA2_6_8I1.lean new file mode 100644 index 0000000000000000000000000000000000000000..11c18475e7fc13ec8b78086c98dd427dec52b5dd --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA2_6_8I1.lean @@ -0,0 +1,856 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.CapacityA.CapA2_6_8I1Pair + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CA2_6_8I1R0Value (a : PairSlot) : ℝ := residualLaw (below (shape 2 6 8)) (fun u => (stageALaw (shape 2 6 8) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 0 a +def CA2_6_8I1R0Raw (a : PairSlot) : Ball := residualBall (below (shape 2 6 8)) A2_6_8Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 0 a +lemma CA2_6_8I1R0Raw_sound (a : PairSlot) : + (CA2_6_8I1R0Raw a).Encloses (CA2_6_8I1R0Value a) := by + exact residualBall_sound_on (below (shape 2 6 8)) A2_6_8Law (fun u => (stageALaw (shape 2 6 8) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A2_6_8Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 2 6 8) (show (shape 2 6 8) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 0 a +def CA2_6_8I1R0Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(482614198838945946544192483 / 3125000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ ⟨(135529298691786926273657801109 / 100000000000000000000000000000000), (11446131 / 25000000000000000000000000000000)⟩ ⟨(-87757272668467590908988813682361 / 10000000000000000000000000000000), (296461550987 / 100000000000000000000000000000000)⟩ ⟨-13, 482614198838945946544192483, 381469726562500000000000000⟩] +lemma CA2_6_8I1R0Certificates_valid : + CA2_6_8I1R0Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_6_8I1R0CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 0, 0 => 1 + | _, _ => 0 +def CA2_6_8I1R0P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_6_8I1R0Certificates (CA2_6_8I1R0CertificateIndex a)).input +lemma CA2_6_8I1R0P_check : ∀ a : PairSlot, contains (CA2_6_8I1R0Raw a) (CA2_6_8I1R0P a) = true := by + decide +kernel +lemma CA2_6_8I1R0P_sound (a : PairSlot) : + (CA2_6_8I1R0P a).Encloses (CA2_6_8I1R0Value a) := + contains_sound (CA2_6_8I1R0Raw_sound a) (CA2_6_8I1R0P_check a) +def CA2_6_8I1R0Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_6_8I1R0Certificates (CA2_6_8I1R0CertificateIndex a)).output +lemma CA2_6_8I1R0Terms_sound (a : PairSlot) : + (CA2_6_8I1R0Terms a).Encloses (Foundation.entropyTerm (CA2_6_8I1R0Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_6_8I1R0Certificates_valid + (CA2_6_8I1R0CertificateIndex a) (CA2_6_8I1R0P_sound a) +def CA2_6_8I1R0Entropy : Ball := ⟨(135529298691786926273657801109 / 100000000000000000000000000000000), (11446131 / 25000000000000000000000000000000)⟩ +lemma CA2_6_8I1R0Entropy_sound : CA2_6_8I1R0Entropy.Encloses (Foundation.finiteEntropy CA2_6_8I1R0Value) := by + exact contains_sound (entropyPair_enclosed CA2_6_8I1R0Value CA2_6_8I1R0Terms CA2_6_8I1R0Terms_sound) (by decide +kernel) +def CA2_6_8I1R0Mass : Ball := ⟨(482614198838945946544192483 / 3125000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +lemma CA2_6_8I1R0Mass_sound : CA2_6_8I1R0Mass.Encloses (∑ a, CA2_6_8I1R0Value a) := by + exact contains_sound (pairSumBall_sound CA2_6_8I1R0P CA2_6_8I1R0Value CA2_6_8I1R0P_sound) (by decide +kernel) +def CA2_6_8I1R0MassTermLogWitness : LogWitness := ⟨-13, 482614198838945946544192483, 381469726562500000000000000⟩ +def CA2_6_8I1R0MassTermLog : Ball := ⟨(-87757272668467590908988813682361 / 10000000000000000000000000000000), (296461550987 / 100000000000000000000000000000000)⟩ +lemma CA2_6_8I1R0MassTermLog_sound : CA2_6_8I1R0MassTermLog.Encloses (Real.log ((∑ a, CA2_6_8I1R0Value a))) := by + exact checkLog_sound logTwoBall_sound (CA2_6_8I1R0Mass_sound) (w := CA2_6_8I1R0MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA2_6_8I1R0MassTerm : Ball := ⟨(135529298691786926273657801109 / 100000000000000000000000000000000), (11446131 / 25000000000000000000000000000000)⟩ +lemma CA2_6_8I1R0MassTerm_sound : CA2_6_8I1R0MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_6_8I1R0Value a))) := by + exact contains_sound (entropyTerm_ball (CA2_6_8I1R0Mass_sound) CA2_6_8I1R0MassTermLog_sound) (by decide +kernel) +def CA2_6_8I1R0H : Ball := ⟨0, (11446131 / 12500000000000000000000000000000)⟩ +lemma CA2_6_8I1R0H_sound : CA2_6_8I1R0H.Encloses (homogeneousEntropy CA2_6_8I1R0Value) := by + exact contains_sound (homogeneous_enclosed CA2_6_8I1R0Value CA2_6_8I1R0MassTerm_sound CA2_6_8I1R0Entropy_sound) (by decide +kernel) +def CA2_6_8I1R1Value (a : PairSlot) : ℝ := residualLaw (below (shape 2 6 8)) (fun u => (stageALaw (shape 2 6 8) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 1 a +def CA2_6_8I1R1Raw (a : PairSlot) : Ball := residualBall (below (shape 2 6 8)) A2_6_8Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 1 a +lemma CA2_6_8I1R1Raw_sound (a : PairSlot) : + (CA2_6_8I1R1Raw a).Encloses (CA2_6_8I1R1Value a) := by + exact residualBall_sound_on (below (shape 2 6 8)) A2_6_8Law (fun u => (stageALaw (shape 2 6 8) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A2_6_8Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 2 6 8) (show (shape 2 6 8) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 1 a +def CA2_6_8I1R1Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(139327975552563848910158761633 / 20000000000000000000000000000000), (7 / 100000000000000000000000000000000)⟩ ⟨(1729985614752913054347013600901 / 50000000000000000000000000000000), (1327673133 / 100000000000000000000000000000000)⟩ ⟨(-496665686239084569800190523237413 / 100000000000000000000000000000000), (190582414151 / 100000000000000000000000000000000)⟩ ⟨-8, 139327975552563848910158761633, 78125000000000000000000000000⟩] +lemma CA2_6_8I1R1Certificates_valid : + CA2_6_8I1R1Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_6_8I1R1CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 1, 0 => 1 + | 0, 1 => 1 + | _, _ => 0 +def CA2_6_8I1R1P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_6_8I1R1Certificates (CA2_6_8I1R1CertificateIndex a)).input +lemma CA2_6_8I1R1P_check : ∀ a : PairSlot, contains (CA2_6_8I1R1Raw a) (CA2_6_8I1R1P a) = true := by + decide +kernel +lemma CA2_6_8I1R1P_sound (a : PairSlot) : + (CA2_6_8I1R1P a).Encloses (CA2_6_8I1R1Value a) := + contains_sound (CA2_6_8I1R1Raw_sound a) (CA2_6_8I1R1P_check a) +def CA2_6_8I1R1Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_6_8I1R1Certificates (CA2_6_8I1R1CertificateIndex a)).output +lemma CA2_6_8I1R1Terms_sound (a : PairSlot) : + (CA2_6_8I1R1Terms a).Encloses (Foundation.entropyTerm (CA2_6_8I1R1Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_6_8I1R1Certificates_valid + (CA2_6_8I1R1CertificateIndex a) (CA2_6_8I1R1P_sound a) +def CA2_6_8I1R1Entropy : Ball := ⟨(1729985614752913054347013600901 / 25000000000000000000000000000000), (1327673133 / 50000000000000000000000000000000)⟩ +lemma CA2_6_8I1R1Entropy_sound : CA2_6_8I1R1Entropy.Encloses (Foundation.finiteEntropy CA2_6_8I1R1Value) := by + exact contains_sound (entropyPair_enclosed CA2_6_8I1R1Value CA2_6_8I1R1Terms CA2_6_8I1R1Terms_sound) (by decide +kernel) +def CA2_6_8I1R1Mass : Ball := ⟨(139327975552563848910158761633 / 10000000000000000000000000000000), (7 / 50000000000000000000000000000000)⟩ +lemma CA2_6_8I1R1Mass_sound : CA2_6_8I1R1Mass.Encloses (∑ a, CA2_6_8I1R1Value a) := by + exact contains_sound (pairSumBall_sound CA2_6_8I1R1P CA2_6_8I1R1Value CA2_6_8I1R1P_sound) (by decide +kernel) +def CA2_6_8I1R1MassTermLogWitness : LogWitness := ⟨-7, 139327975552563848910158761633, 78125000000000000000000000000⟩ +def CA2_6_8I1R1MassTermLog : Ball := ⟨(-427350968183090038858467330187083 / 100000000000000000000000000000000), (42351647617 / 25000000000000000000000000000000)⟩ +lemma CA2_6_8I1R1MassTermLog_sound : CA2_6_8I1R1MassTermLog.Encloses (Real.log ((∑ a, CA2_6_8I1R1Value a))) := by + exact checkLog_sound logTwoBall_sound (CA2_6_8I1R1Mass_sound) (w := CA2_6_8I1R1MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA2_6_8I1R1MassTerm : Ball := ⟨(5954194524737806017155259310491 / 100000000000000000000000000000000), (236030779 / 10000000000000000000000000000000)⟩ +lemma CA2_6_8I1R1MassTerm_sound : CA2_6_8I1R1MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_6_8I1R1Value a))) := by + exact contains_sound (entropyTerm_ball (CA2_6_8I1R1Mass_sound) CA2_6_8I1R1MassTermLog_sound) (by decide +kernel) +def CA2_6_8I1R1H : Ball := ⟨(965747934273846200232795093113 / 100000000000000000000000000000000), (626956757 / 12500000000000000000000000000000)⟩ +lemma CA2_6_8I1R1H_sound : CA2_6_8I1R1H.Encloses (homogeneousEntropy CA2_6_8I1R1Value) := by + exact contains_sound (homogeneous_enclosed CA2_6_8I1R1Value CA2_6_8I1R1MassTerm_sound CA2_6_8I1R1Entropy_sound) (by decide +kernel) +def CA2_6_8I1R2Value (a : PairSlot) : ℝ := residualLaw (below (shape 2 6 8)) (fun u => (stageALaw (shape 2 6 8) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 2 a +def CA2_6_8I1R2Raw (a : PairSlot) : Ball := residualBall (below (shape 2 6 8)) A2_6_8Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 2 a +lemma CA2_6_8I1R2Raw_sound (a : PairSlot) : + (CA2_6_8I1R2Raw a).Encloses (CA2_6_8I1R2Value a) := by + exact residualBall_sound_on (below (shape 2 6 8)) A2_6_8Law (fun u => (stageALaw (shape 2 6 8) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A2_6_8Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 2 6 8) (show (shape 2 6 8) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 2 a +def CA2_6_8I1R2Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(3783651321028126610853790513179 / 100000000000000000000000000000000), (29 / 100000000000000000000000000000000)⟩ ⟨(12389493168156305713771513717961 / 100000000000000000000000000000000), (120182903 / 2500000000000000000000000000000)⟩ ⟨(-65489613692996028953092399509311 / 20000000000000000000000000000000), (7940933929 / 6250000000000000000000000000000)⟩ ⟨-5, 3783651321028126610853790513179, 3125000000000000000000000000000⟩, + .log ⟨(96587081401284219179413856493 / 25000000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ ⟨(107331159910835579347332177653 / 5000000000000000000000000000000), (818124429 / 100000000000000000000000000000000)⟩ ⟨(-555618610448086834909677471211931 / 100000000000000000000000000000000), (42351647573 / 20000000000000000000000000000000)⟩ ⟨-9, 96587081401284219179413856493, 48828125000000000000000000000⟩, + .log ⟨(3566440220939032184575400192723 / 25000000000000000000000000000000), (1 / 1250000000000000000000000000000)⟩ ⟨(13889914174162227826278016912847 / 50000000000000000000000000000000), (12083569723 / 100000000000000000000000000000000)⟩ ⟨(-194730786354033691219360199838101 / 100000000000000000000000000000000), (21175823823 / 25000000000000000000000000000000)⟩ ⟨-3, 3566440220939032184575400192723, 3125000000000000000000000000000⟩] +lemma CA2_6_8I1R2Certificates_valid : + CA2_6_8I1R2Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_6_8I1R2CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 2, 0 => 1 + | 3, 0 => 2 + | 1, 1 => 3 + | 0, 2 => 1 + | 0, 3 => 2 + | _, _ => 0 +def CA2_6_8I1R2P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_6_8I1R2Certificates (CA2_6_8I1R2CertificateIndex a)).input +lemma CA2_6_8I1R2P_check : ∀ a : PairSlot, contains (CA2_6_8I1R2Raw a) (CA2_6_8I1R2P a) = true := by + decide +kernel +lemma CA2_6_8I1R2P_sound (a : PairSlot) : + (CA2_6_8I1R2P a).Encloses (CA2_6_8I1R2Value a) := + contains_sound (CA2_6_8I1R2Raw_sound a) (CA2_6_8I1R2P_check a) +def CA2_6_8I1R2Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_6_8I1R2Certificates (CA2_6_8I1R2CertificateIndex a)).output +lemma CA2_6_8I1R2Terms_sound (a : PairSlot) : + (CA2_6_8I1R2Terms a).Encloses (Foundation.entropyTerm (CA2_6_8I1R2Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_6_8I1R2Certificates_valid + (CA2_6_8I1R2CertificateIndex a) (CA2_6_8I1R2P_sound a) +def CA2_6_8I1R2Entropy : Ball := ⟨(7106507635133811281749043545967 / 12500000000000000000000000000000), (23334450821 / 100000000000000000000000000000000)⟩ +lemma CA2_6_8I1R2Entropy_sound : CA2_6_8I1R2Entropy.Encloses (Foundation.finiteEntropy CA2_6_8I1R2Value) := by + exact contains_sound (entropyPair_enclosed CA2_6_8I1R2Value CA2_6_8I1R2Terms CA2_6_8I1R2Terms_sound) (by decide +kernel) +def CA2_6_8I1R2Mass : Ball := ⟨(11302880088511327856722246324597 / 50000000000000000000000000000000), (73 / 50000000000000000000000000000000)⟩ +lemma CA2_6_8I1R2Mass_sound : CA2_6_8I1R2Mass.Encloses (∑ a, CA2_6_8I1R2Value a) := by + exact contains_sound (pairSumBall_sound CA2_6_8I1R2P CA2_6_8I1R2Value CA2_6_8I1R2P_sound) (by decide +kernel) +def CA2_6_8I1R2MassTermLogWitness : LogWitness := ⟨-3, 11302880088511327856722246324597, 6250000000000000000000000000000⟩ +def CA2_6_8I1R2MassTermLog : Ball := ⟨(-290422936932713047863097462883 / 195312500000000000000000000000), (42351647689 / 50000000000000000000000000000000)⟩ +lemma CA2_6_8I1R2MassTermLog_sound : CA2_6_8I1R2MassTermLog.Encloses (Real.log ((∑ a, CA2_6_8I1R2Value a))) := by + exact checkLog_sound logTwoBall_sound (CA2_6_8I1R2Mass_sound) (w := CA2_6_8I1R2MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA2_6_8I1R2MassTerm : Ball := ⟨(33613984062502332850118446500137 / 100000000000000000000000000000000), (19147824033 / 100000000000000000000000000000000)⟩ +lemma CA2_6_8I1R2MassTerm_sound : CA2_6_8I1R2MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_6_8I1R2Value a))) := by + exact contains_sound (entropyTerm_ball (CA2_6_8I1R2Mass_sound) CA2_6_8I1R2MassTermLog_sound) (by decide +kernel) +def CA2_6_8I1R2H : Ball := ⟨(23238077018568157403873901867599 / 100000000000000000000000000000000), (21241137427 / 50000000000000000000000000000000)⟩ +lemma CA2_6_8I1R2H_sound : CA2_6_8I1R2H.Encloses (homogeneousEntropy CA2_6_8I1R2Value) := by + exact contains_sound (homogeneous_enclosed CA2_6_8I1R2Value CA2_6_8I1R2MassTerm_sound CA2_6_8I1R2Entropy_sound) (by decide +kernel) +def CA2_6_8I1R3Value (a : PairSlot) : ℝ := residualLaw (below (shape 2 6 8)) (fun u => (stageALaw (shape 2 6 8) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 3 a +def CA2_6_8I1R3Raw (a : PairSlot) : Ball := residualBall (below (shape 2 6 8)) A2_6_8Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 3 a +lemma CA2_6_8I1R3Raw_sound (a : PairSlot) : + (CA2_6_8I1R3Raw a).Encloses (CA2_6_8I1R3Value a) := by + exact residualBall_sound_on (below (shape 2 6 8)) A2_6_8Law (fun u => (stageALaw (shape 2 6 8) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A2_6_8Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 2 6 8) (show (shape 2 6 8) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 3 a +def CA2_6_8I1R3Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(50539334642013499758943026079 / 6250000000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ ⟨(1947820245347008096111170450639 / 50000000000000000000000000000000), (684935723 / 50000000000000000000000000000000)⟩ ⟨(-60219810072937825623662557649961 / 12500000000000000000000000000000), (33881318041 / 20000000000000000000000000000000)⟩ ⟨-7, 50539334642013499758943026079, 48828125000000000000000000000⟩, + .log ⟨(5767145425469417847973279851969 / 25000000000000000000000000000000), (41 / 50000000000000000000000000000000)⟩ ⟨(16917328170640872016017922106491 / 50000000000000000000000000000000), (2442481119 / 12500000000000000000000000000000)⟩ ⟨(-146669859372099005298085022603483 / 100000000000000000000000000000000), (84703295087 / 100000000000000000000000000000000)⟩ ⟨-3, 5767145425469417847973279851969, 3125000000000000000000000000000⟩, + .log ⟨(1054152678469486069564148874939 / 50000000000000000000000000000000), (1 / 12500000000000000000000000000000)⟩ ⟨(8136552735437532741595721636497 / 100000000000000000000000000000000), (625031443 / 20000000000000000000000000000000)⟩ ⟨(-192964285478335875919877671941113 / 50000000000000000000000000000000), (1852884577 / 1250000000000000000000000000000)⟩ ⟨-6, 1054152678469486069564148874939, 781250000000000000000000000000⟩] +lemma CA2_6_8I1R3Certificates_valid : + CA2_6_8I1R3Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_6_8I1R3CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 4, 0 => 1 + | 2, 1 => 2 + | 3, 1 => 3 + | 1, 2 => 2 + | 1, 3 => 3 + | 0, 4 => 1 + | _, _ => 0 +def CA2_6_8I1R3P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_6_8I1R3Certificates (CA2_6_8I1R3CertificateIndex a)).input +lemma CA2_6_8I1R3P_check : ∀ a : PairSlot, contains (CA2_6_8I1R3Raw a) (CA2_6_8I1R3P a) = true := by + decide +kernel +lemma CA2_6_8I1R3P_sound (a : PairSlot) : + (CA2_6_8I1R3P a).Encloses (CA2_6_8I1R3Value a) := + contains_sound (CA2_6_8I1R3Raw_sound a) (CA2_6_8I1R3P_check a) +def CA2_6_8I1R3Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_6_8I1R3Certificates (CA2_6_8I1R3CertificateIndex a)).output +lemma CA2_6_8I1R3Terms_sound (a : PairSlot) : + (CA2_6_8I1R3Terms a).Encloses (Foundation.entropyTerm (CA2_6_8I1R3Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_6_8I1R3Certificates_valid + (CA2_6_8I1R3CertificateIndex a) (CA2_6_8I1R3P_sound a) +def CA2_6_8I1R3Entropy : Ball := ⟨(45866849567413292965853906750757 / 50000000000000000000000000000000), (24034877613 / 50000000000000000000000000000000)⟩ +lemma CA2_6_8I1R3Entropy_sound : CA2_6_8I1R3Entropy.Encloses (Foundation.finiteEntropy CA2_6_8I1R3Value) := by + exact contains_sound (entropyPair_enclosed CA2_6_8I1R3Value CA2_6_8I1R3Terms CA2_6_8I1R3Terms_sound) (by decide +kernel) +def CA2_6_8I1R3Mass : Ball := ⟨(12992758206544429763582252787509 / 25000000000000000000000000000000), (3 / 1562500000000000000000000000000)⟩ +lemma CA2_6_8I1R3Mass_sound : CA2_6_8I1R3Mass.Encloses (∑ a, CA2_6_8I1R3Value a) := by + exact contains_sound (pairSumBall_sound CA2_6_8I1R3P CA2_6_8I1R3Value CA2_6_8I1R3P_sound) (by decide +kernel) +def CA2_6_8I1R3MassTermLogWitness : LogWitness := ⟨-1, 12992758206544429763582252787509, 12500000000000000000000000000000⟩ +def CA2_6_8I1R3MassTermLog : Ball := ⟨(-65448368365785218025485415970023 / 100000000000000000000000000000000), (8470329547 / 20000000000000000000000000000000)⟩ +lemma CA2_6_8I1R3MassTermLog_sound : CA2_6_8I1R3MassTermLog.Encloses (Real.log ((∑ a, CA2_6_8I1R3Value a))) := by + exact checkLog_sound logTwoBall_sound (CA2_6_8I1R3Mass_sound) (w := CA2_6_8I1R3MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA2_6_8I1R3MassTerm : Ball := ⟨(3401419300757994963401413575821 / 10000000000000000000000000000000), (22010588873 / 100000000000000000000000000000000)⟩ +lemma CA2_6_8I1R3MassTerm_sound : CA2_6_8I1R3MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_6_8I1R3Value a))) := by + exact contains_sound (entropyTerm_ball (CA2_6_8I1R3Mass_sound) CA2_6_8I1R3MassTermLog_sound) (by decide +kernel) +def CA2_6_8I1R3H : Ball := ⟨(7214938265905829537211709717913 / 12500000000000000000000000000000), (70080344099 / 100000000000000000000000000000000)⟩ +lemma CA2_6_8I1R3H_sound : CA2_6_8I1R3H.Encloses (homogeneousEntropy CA2_6_8I1R3Value) := by + exact contains_sound (homogeneous_enclosed CA2_6_8I1R3Value CA2_6_8I1R3MassTerm_sound CA2_6_8I1R3Entropy_sound) (by decide +kernel) +def CA2_6_8I1R4Value (a : PairSlot) : ℝ := residualLaw (below (shape 2 6 8)) (fun u => (stageALaw (shape 2 6 8) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 4 a +def CA2_6_8I1R4Raw (a : PairSlot) : Ball := residualBall (below (shape 2 6 8)) A2_6_8Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 4 a +lemma CA2_6_8I1R4Raw_sound (a : PairSlot) : + (CA2_6_8I1R4Raw a).Encloses (CA2_6_8I1R4Value a) := by + exact residualBall_sound_on (below (shape 2 6 8)) A2_6_8Law (fun u => (stageALaw (shape 2 6 8) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A2_6_8Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 2 6 8) (show (shape 2 6 8) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 4 a +def CA2_6_8I1R4Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(2954896846137971690902062987 / 10000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(240140821228559693148592536003 / 100000000000000000000000000000000), (81344097 / 100000000000000000000000000000000)⟩ ⟨(-812687662997176937812792579599483 / 100000000000000000000000000000000), (275285711263 / 100000000000000000000000000000000)⟩ ⟨-12, 2954896846137971690902062987, 2441406250000000000000000000⟩, + .log ⟨(614044372111436108901844232643 / 25000000000000000000000000000000), (17 / 100000000000000000000000000000000)⟩ ⟨(4551989418880959818631452637923 / 50000000000000000000000000000000), (3640810781 / 100000000000000000000000000000000)⟩ ⟨(-92664097775797009083015096068037 / 25000000000000000000000000000000), (18528845809 / 12500000000000000000000000000000)⟩ ⟨-6, 614044372111436108901844232643, 390625000000000000000000000000⟩, + .log ⟨(7531147980704175769209851871551 / 50000000000000000000000000000000), (87 / 100000000000000000000000000000000)⟩ ⟨(28512557544393646301591490039757 / 100000000000000000000000000000000), (6379130597 / 50000000000000000000000000000000)⟩ ⟨(-189297552095953313842979960916533 / 100000000000000000000000000000000), (84703295309 / 100000000000000000000000000000000)⟩ ⟨-3, 7531147980704175769209851871551, 6250000000000000000000000000000⟩, + .log ⟨(617862331104690817659332363237 / 50000000000000000000000000000000), (1 / 12500000000000000000000000000000)⟩ ⟨(2714585947259703178542502146337 / 50000000000000000000000000000000), (2093399049 / 100000000000000000000000000000000)⟩ ⟨(-439351261697121126206865800526079 / 100000000000000000000000000000000), (169406590111 / 100000000000000000000000000000000)⟩ ⟨-7, 617862331104690817659332363237, 390625000000000000000000000000⟩, + .log ⟨(5028098869064629967733216613 / 5000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ ⟨(347046988298046308124279644971 / 50000000000000000000000000000000), (117121557 / 50000000000000000000000000000000)⟩ ⟨(-345107561859266862803994865368403 / 50000000000000000000000000000000), (232934062501 / 100000000000000000000000000000000)⟩ ⟨-10, 5028098869064629967733216613, 4882812500000000000000000000⟩] +lemma CA2_6_8I1R4Certificates_valid : + CA2_6_8I1R4Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_6_8I1R4CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 0, 5 => 1 + | 1, 4 => 2 + | 2, 2 => 3 + | 2, 3 => 4 + | 3, 2 => 4 + | 3, 3 => 5 + | 4, 1 => 2 + | 5, 0 => 1 + | _, _ => 0 +def CA2_6_8I1R4P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_6_8I1R4Certificates (CA2_6_8I1R4CertificateIndex a)).input +lemma CA2_6_8I1R4P_check : ∀ a : PairSlot, contains (CA2_6_8I1R4Raw a) (CA2_6_8I1R4P a) = true := by + decide +kernel +lemma CA2_6_8I1R4P_sound (a : PairSlot) : + (CA2_6_8I1R4P a).Encloses (CA2_6_8I1R4Value a) := + contains_sound (CA2_6_8I1R4Raw_sound a) (CA2_6_8I1R4P_check a) +def CA2_6_8I1R4Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_6_8I1R4Certificates (CA2_6_8I1R4CertificateIndex a)).output +lemma CA2_6_8I1R4Terms_sound (a : PairSlot) : + (CA2_6_8I1R4Terms a).Encloses (Foundation.entropyTerm (CA2_6_8I1R4Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_6_8I1R4Certificates_valid + (CA2_6_8I1R4CertificateIndex a) (CA2_6_8I1R4P_sound a) +def CA2_6_8I1R4Entropy : Ball := ⟨(11750646925601902058566610707749 / 20000000000000000000000000000000), (12311806081 / 50000000000000000000000000000000)⟩ +lemma CA2_6_8I1R4Entropy_sound : CA2_6_8I1R4Entropy.Encloses (Foundation.finiteEntropy CA2_6_8I1R4Value) := by + exact contains_sound (entropyPair_enclosed CA2_6_8I1R4Value CA2_6_8I1R4Terms CA2_6_8I1R4Terms_sound) (by decide +kernel) +def CA2_6_8I1R4Mass : Ball := ⟨(11302880088511327856722246324597 / 50000000000000000000000000000000), (141 / 100000000000000000000000000000000)⟩ +lemma CA2_6_8I1R4Mass_sound : CA2_6_8I1R4Mass.Encloses (∑ a, CA2_6_8I1R4Value a) := by + exact contains_sound (pairSumBall_sound CA2_6_8I1R4P CA2_6_8I1R4Value CA2_6_8I1R4P_sound) (by decide +kernel) +def CA2_6_8I1R4MassTermLogWitness : LogWitness := ⟨-3, 11302880088511327856722246324597, 6250000000000000000000000000000⟩ +def CA2_6_8I1R4MassTermLog : Ball := ⟨(-290422936932713047863097462883 / 195312500000000000000000000000), (21175823839 / 25000000000000000000000000000000)⟩ +lemma CA2_6_8I1R4MassTermLog_sound : CA2_6_8I1R4MassTermLog.Encloses (Real.log ((∑ a, CA2_6_8I1R4Value a))) := by + exact checkLog_sound logTwoBall_sound (CA2_6_8I1R4Mass_sound) (w := CA2_6_8I1R4MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA2_6_8I1R4MassTerm : Ball := ⟨(33613984062502332850118446500137 / 100000000000000000000000000000000), (19147824021 / 100000000000000000000000000000000)⟩ +lemma CA2_6_8I1R4MassTerm_sound : CA2_6_8I1R4MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_6_8I1R4Value a))) := by + exact contains_sound (entropyTerm_ball (CA2_6_8I1R4Mass_sound) CA2_6_8I1R4MassTermLog_sound) (by decide +kernel) +def CA2_6_8I1R4H : Ball := ⟨(1571203160344198590169662939913 / 6250000000000000000000000000000), (43771436183 / 100000000000000000000000000000000)⟩ +lemma CA2_6_8I1R4H_sound : CA2_6_8I1R4H.Encloses (homogeneousEntropy CA2_6_8I1R4Value) := by + exact contains_sound (homogeneous_enclosed CA2_6_8I1R4Value CA2_6_8I1R4MassTerm_sound CA2_6_8I1R4Entropy_sound) (by decide +kernel) +def CA2_6_8I1R5Value (a : PairSlot) : ℝ := residualLaw (below (shape 2 6 8)) (fun u => (stageALaw (shape 2 6 8) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 5 a +def CA2_6_8I1R5Raw (a : PairSlot) : Ball := residualBall (below (shape 2 6 8)) A2_6_8Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 5 a +lemma CA2_6_8I1R5Raw_sound (a : PairSlot) : + (CA2_6_8I1R5Raw a).Encloses (CA2_6_8I1R5Value a) := by + exact residualBall_sound_on (below (shape 2 6 8)) A2_6_8Law (fun u => (stageALaw (shape 2 6 8) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A2_6_8Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 2 6 8) (show (shape 2 6 8) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 5 a +def CA2_6_8I1R5Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(27078558314774540953224986201 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(11121412015766170351601433071 / 5000000000000000000000000000000), (74543411 / 100000000000000000000000000000000)⟩ ⟨(-821418325635019572344764453392313 / 100000000000000000000000000000000), (275285711571 / 100000000000000000000000000000000)⟩ ⟨-12, 27078558314774540953224986201, 24414062500000000000000000000⟩, + .log ⟨(154399745645881389037673594901 / 25000000000000000000000000000000), (7 / 100000000000000000000000000000000)⟩ ⟨(3141779208094060806487212302823 / 100000000000000000000000000000000), (73564693 / 6250000000000000000000000000000)⟩ ⟨(-254354305681612672480366648598361 / 50000000000000000000000000000000), (4764560357 / 2500000000000000000000000000000)⟩ ⟨-8, 154399745645881389037673594901, 97656250000000000000000000000⟩, + .log ⟨(1299058421612978686171861059 / 2500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(196480151830395347388024227653 / 50000000000000000000000000000000), (132041443 / 100000000000000000000000000000000)⟩ ⟨(-9453007874851547468820693070053 / 1250000000000000000000000000000), (6352747153 / 2500000000000000000000000000000)⟩ ⟨-11, 1299058421612978686171861059, 1220703125000000000000000000⟩] +lemma CA2_6_8I1R5Certificates_valid : + CA2_6_8I1R5Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_6_8I1R5CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 1, 5 => 1 + | 2, 4 => 2 + | 3, 4 => 3 + | 4, 2 => 2 + | 4, 3 => 3 + | 5, 1 => 1 + | _, _ => 0 +def CA2_6_8I1R5P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_6_8I1R5Certificates (CA2_6_8I1R5CertificateIndex a)).input +lemma CA2_6_8I1R5P_check : ∀ a : PairSlot, contains (CA2_6_8I1R5Raw a) (CA2_6_8I1R5P a) = true := by + decide +kernel +lemma CA2_6_8I1R5P_sound (a : PairSlot) : + (CA2_6_8I1R5P a).Encloses (CA2_6_8I1R5Value a) := + contains_sound (CA2_6_8I1R5Raw_sound a) (CA2_6_8I1R5P_check a) +def CA2_6_8I1R5Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_6_8I1R5Certificates (CA2_6_8I1R5CertificateIndex a)).output +lemma CA2_6_8I1R5Terms_sound (a : PairSlot) : + (CA2_6_8I1R5Terms a).Encloses (Foundation.entropyTerm (CA2_6_8I1R5Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_6_8I1R5Certificates_valid + (CA2_6_8I1R5CertificateIndex a) (CA2_6_8I1R5P_sound a) +def CA2_6_8I1R5Entropy : Ball := ⟨(3757167752070174908295289419549 / 50000000000000000000000000000000), (691809971 / 25000000000000000000000000000000)⟩ +lemma CA2_6_8I1R5Entropy_sound : CA2_6_8I1R5Entropy.Encloses (Foundation.finiteEntropy CA2_6_8I1R5Value) := by + exact contains_sound (entropyPair_enclosed CA2_6_8I1R5Value CA2_6_8I1R5Terms CA2_6_8I1R5Terms_sound) (by decide +kernel) +def CA2_6_8I1R5Mass : Ball := ⟨(139327975552563848910158761633 / 10000000000000000000000000000000), (9 / 50000000000000000000000000000000)⟩ +lemma CA2_6_8I1R5Mass_sound : CA2_6_8I1R5Mass.Encloses (∑ a, CA2_6_8I1R5Value a) := by + exact contains_sound (pairSumBall_sound CA2_6_8I1R5P CA2_6_8I1R5Value CA2_6_8I1R5P_sound) (by decide +kernel) +def CA2_6_8I1R5MassTermLogWitness : LogWitness := ⟨-7, 139327975552563848910158761633, 78125000000000000000000000000⟩ +def CA2_6_8I1R5MassTermLog : Ball := ⟨(-427350968183090038858467330187083 / 100000000000000000000000000000000), (42351647689 / 25000000000000000000000000000000)⟩ +lemma CA2_6_8I1R5MassTermLog_sound : CA2_6_8I1R5MassTermLog.Encloses (Real.log ((∑ a, CA2_6_8I1R5Value a))) := by + exact checkLog_sound logTwoBall_sound (CA2_6_8I1R5Mass_sound) (w := CA2_6_8I1R5MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA2_6_8I1R5MassTerm : Ball := ⟨(5954194524737806017155259310491 / 100000000000000000000000000000000), (2360307811 / 100000000000000000000000000000000)⟩ +lemma CA2_6_8I1R5MassTerm_sound : CA2_6_8I1R5MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_6_8I1R5Value a))) := by + exact contains_sound (entropyTerm_ball (CA2_6_8I1R5Mass_sound) CA2_6_8I1R5MassTermLog_sound) (by decide +kernel) +def CA2_6_8I1R5H : Ball := ⟨(1560140979402543799435319528607 / 100000000000000000000000000000000), (1025509539 / 20000000000000000000000000000000)⟩ +lemma CA2_6_8I1R5H_sound : CA2_6_8I1R5H.Encloses (homogeneousEntropy CA2_6_8I1R5Value) := by + exact contains_sound (homogeneous_enclosed CA2_6_8I1R5Value CA2_6_8I1R5MassTerm_sound CA2_6_8I1R5Entropy_sound) (by decide +kernel) +def CA2_6_8I1R6Value (a : PairSlot) : ℝ := residualLaw (below (shape 2 6 8)) (fun u => (stageALaw (shape 2 6 8) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 6 a +def CA2_6_8I1R6Raw (a : PairSlot) : Ball := residualBall (below (shape 2 6 8)) A2_6_8Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 6 a +lemma CA2_6_8I1R6Raw_sound (a : PairSlot) : + (CA2_6_8I1R6Raw a).Encloses (CA2_6_8I1R6Value a) := by + exact residualBall_sound_on (below (shape 2 6 8)) A2_6_8Law (fun u => (stageALaw (shape 2 6 8) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A2_6_8Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 2 6 8) (show (shape 2 6 8) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 6 a +def CA2_6_8I1R6Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(1200291507443088968093509091 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(12767757428104096652180005201 / 50000000000000000000000000000000), (8641847 / 100000000000000000000000000000000)⟩ ⟨(-16620646616012609894185777136421 / 1562500000000000000000000000000), (359989044267 / 100000000000000000000000000000000)⟩ ⟨-16, 1200291507443088968093509091, 762939453125000000000000000⟩, + .log ⟨(42409102545603473825261857 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(563490736240623134868651979 / 25000000000000000000000000000000), (1207 / 160000000000000000000000000000)⟩ ⟨(-332175584023906608735495021794391 / 25000000000000000000000000000000), (444692886839 / 100000000000000000000000000000000)⟩ ⟨-20, 42409102545603473825261857, 23841857910156250000000000⟩, + .log ⟨(10295932270523190320885075407 / 100000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ ⟨(23632193039650510747454854773 / 25000000000000000000000000000000), (8175937 / 25000000000000000000000000000000)⟩ ⟨(-918117657293005291618197560044797 / 100000000000000000000000000000000), (31763737467 / 10000000000000000000000000000000)⟩ ⟨-14, 10295932270523190320885075407, 6103515625000000000000000000⟩] +lemma CA2_6_8I1R6Certificates_valid : + CA2_6_8I1R6Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_6_8I1R6CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 2, 5 => 1 + | 3, 5 => 2 + | 4, 4 => 3 + | 5, 2 => 1 + | 5, 3 => 2 + | _, _ => 0 +def CA2_6_8I1R6P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_6_8I1R6Certificates (CA2_6_8I1R6CertificateIndex a)).input +lemma CA2_6_8I1R6P_check : ∀ a : PairSlot, contains (CA2_6_8I1R6Raw a) (CA2_6_8I1R6P a) = true := by + decide +kernel +lemma CA2_6_8I1R6P_sound (a : PairSlot) : + (CA2_6_8I1R6P a).Encloses (CA2_6_8I1R6Value a) := + contains_sound (CA2_6_8I1R6Raw_sound a) (CA2_6_8I1R6P_check a) +def CA2_6_8I1R6Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_6_8I1R6Certificates (CA2_6_8I1R6CertificateIndex a)).output +lemma CA2_6_8I1R6Terms_sound (a : PairSlot) : + (CA2_6_8I1R6Terms a).Encloses (Foundation.entropyTerm (CA2_6_8I1R6Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_6_8I1R6Certificates_valid + (CA2_6_8I1R6CertificateIndex a) (CA2_6_8I1R6P_sound a) +def CA2_6_8I1R6Entropy : Ball := ⟨(9381732985058963417343040983 / 6250000000000000000000000000000), (201157 / 390625000000000000000000000000)⟩ +lemma CA2_6_8I1R6Entropy_sound : CA2_6_8I1R6Entropy.Encloses (Foundation.finiteEntropy CA2_6_8I1R6Value) := by + exact contains_sound (entropyPair_enclosed CA2_6_8I1R6Value CA2_6_8I1R6Terms CA2_6_8I1R6Terms_sound) (by decide +kernel) +def CA2_6_8I1R6Mass : Ball := ⟨(15436371120660373983861206627 / 100000000000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ +lemma CA2_6_8I1R6Mass_sound : CA2_6_8I1R6Mass.Encloses (∑ a, CA2_6_8I1R6Value a) := by + exact contains_sound (pairSumBall_sound CA2_6_8I1R6P CA2_6_8I1R6Value CA2_6_8I1R6P_sound) (by decide +kernel) +def CA2_6_8I1R6MassTermLogWitness : LogWitness := ⟨-13, 15436371120660373983861206627, 12207031250000000000000000000⟩ +def CA2_6_8I1R6MassTermLog : Ball := ⟨(-438809948952151772011195872757127 / 50000000000000000000000000000000), (29646157043 / 10000000000000000000000000000000)⟩ +lemma CA2_6_8I1R6MassTermLog_sound : CA2_6_8I1R6MassTermLog.Encloses (Real.log ((∑ a, CA2_6_8I1R6Value a))) := by + exact checkLog_sound logTwoBall_sound (CA2_6_8I1R6Mass_sound) (w := CA2_6_8I1R6MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA2_6_8I1R6MassTerm : Ball := ⟨(135472664469268970989558269301 / 100000000000000000000000000000000), (22881481 / 50000000000000000000000000000000)⟩ +lemma CA2_6_8I1R6MassTerm_sound : CA2_6_8I1R6MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_6_8I1R6Value a))) := by + exact contains_sound (entropyTerm_ball (CA2_6_8I1R6Mass_sound) CA2_6_8I1R6MassTermLog_sound) (by decide +kernel) +def CA2_6_8I1R6H : Ball := ⟨(14635063291674443687930386427 / 100000000000000000000000000000000), (48629577 / 50000000000000000000000000000000)⟩ +lemma CA2_6_8I1R6H_sound : CA2_6_8I1R6H.Encloses (homogeneousEntropy CA2_6_8I1R6Value) := by + exact contains_sound (homogeneous_enclosed CA2_6_8I1R6Value CA2_6_8I1R6MassTerm_sound CA2_6_8I1R6Entropy_sound) (by decide +kernel) +def CA2_6_8I1R7Value (a : PairSlot) : ℝ := residualLaw (below (shape 2 6 8)) (fun u => (stageALaw (shape 2 6 8) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 7 a +def CA2_6_8I1R7Raw (a : PairSlot) : Ball := residualBall (below (shape 2 6 8)) A2_6_8Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 7 a +lemma CA2_6_8I1R7Raw_sound (a : PairSlot) : + (CA2_6_8I1R7Raw a).Encloses (CA2_6_8I1R7Value a) := by + exact residualBall_sound_on (below (shape 2 6 8)) A2_6_8Law (fun u => (stageALaw (shape 2 6 8) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A2_6_8Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 2 6 8) (show (shape 2 6 8) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 7 a +def CA2_6_8I1R7Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA2_6_8I1R7Certificates_valid : + CA2_6_8I1R7Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_6_8I1R7CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA2_6_8I1R7P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_6_8I1R7Certificates (CA2_6_8I1R7CertificateIndex a)).input +lemma CA2_6_8I1R7P_check : ∀ a : PairSlot, contains (CA2_6_8I1R7Raw a) (CA2_6_8I1R7P a) = true := by + decide +kernel +lemma CA2_6_8I1R7P_sound (a : PairSlot) : + (CA2_6_8I1R7P a).Encloses (CA2_6_8I1R7Value a) := + contains_sound (CA2_6_8I1R7Raw_sound a) (CA2_6_8I1R7P_check a) +def CA2_6_8I1R7Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_6_8I1R7Certificates (CA2_6_8I1R7CertificateIndex a)).output +lemma CA2_6_8I1R7Terms_sound (a : PairSlot) : + (CA2_6_8I1R7Terms a).Encloses (Foundation.entropyTerm (CA2_6_8I1R7Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_6_8I1R7Certificates_valid + (CA2_6_8I1R7CertificateIndex a) (CA2_6_8I1R7P_sound a) +def CA2_6_8I1R7Entropy : Ball := ⟨0, 0⟩ +lemma CA2_6_8I1R7Entropy_sound : CA2_6_8I1R7Entropy.Encloses (Foundation.finiteEntropy CA2_6_8I1R7Value) := by + exact contains_sound (entropyPair_enclosed CA2_6_8I1R7Value CA2_6_8I1R7Terms CA2_6_8I1R7Terms_sound) (by decide +kernel) +def CA2_6_8I1R7Mass : Ball := ⟨0, 0⟩ +lemma CA2_6_8I1R7Mass_sound : CA2_6_8I1R7Mass.Encloses (∑ a, CA2_6_8I1R7Value a) := by + exact contains_sound (pairSumBall_sound CA2_6_8I1R7P CA2_6_8I1R7Value CA2_6_8I1R7P_sound) (by decide +kernel) +def CA2_6_8I1R7MassTerm : Ball := .exact 0 +lemma CA2_6_8I1R7MassTerm_sound : CA2_6_8I1R7MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_6_8I1R7Value a))) := + entropyTerm_zero_ball (CA2_6_8I1R7Mass_sound) +def CA2_6_8I1R7H : Ball := ⟨0, 0⟩ +lemma CA2_6_8I1R7H_sound : CA2_6_8I1R7H.Encloses (homogeneousEntropy CA2_6_8I1R7Value) := by + exact contains_sound (homogeneous_enclosed CA2_6_8I1R7Value CA2_6_8I1R7MassTerm_sound CA2_6_8I1R7Entropy_sound) (by decide +kernel) +def CA2_6_8I1R8Value (a : PairSlot) : ℝ := residualLaw (below (shape 2 6 8)) (fun u => (stageALaw (shape 2 6 8) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 8 a +def CA2_6_8I1R8Raw (a : PairSlot) : Ball := residualBall (below (shape 2 6 8)) A2_6_8Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 8 a +lemma CA2_6_8I1R8Raw_sound (a : PairSlot) : + (CA2_6_8I1R8Raw a).Encloses (CA2_6_8I1R8Value a) := by + exact residualBall_sound_on (below (shape 2 6 8)) A2_6_8Law (fun u => (stageALaw (shape 2 6 8) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A2_6_8Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 2 6 8) (show (shape 2 6 8) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 8 a +def CA2_6_8I1R8Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA2_6_8I1R8Certificates_valid : + CA2_6_8I1R8Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_6_8I1R8CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA2_6_8I1R8P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_6_8I1R8Certificates (CA2_6_8I1R8CertificateIndex a)).input +lemma CA2_6_8I1R8P_check : ∀ a : PairSlot, contains (CA2_6_8I1R8Raw a) (CA2_6_8I1R8P a) = true := by + decide +kernel +lemma CA2_6_8I1R8P_sound (a : PairSlot) : + (CA2_6_8I1R8P a).Encloses (CA2_6_8I1R8Value a) := + contains_sound (CA2_6_8I1R8Raw_sound a) (CA2_6_8I1R8P_check a) +def CA2_6_8I1R8Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_6_8I1R8Certificates (CA2_6_8I1R8CertificateIndex a)).output +lemma CA2_6_8I1R8Terms_sound (a : PairSlot) : + (CA2_6_8I1R8Terms a).Encloses (Foundation.entropyTerm (CA2_6_8I1R8Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_6_8I1R8Certificates_valid + (CA2_6_8I1R8CertificateIndex a) (CA2_6_8I1R8P_sound a) +def CA2_6_8I1R8Entropy : Ball := ⟨0, 0⟩ +lemma CA2_6_8I1R8Entropy_sound : CA2_6_8I1R8Entropy.Encloses (Foundation.finiteEntropy CA2_6_8I1R8Value) := by + exact contains_sound (entropyPair_enclosed CA2_6_8I1R8Value CA2_6_8I1R8Terms CA2_6_8I1R8Terms_sound) (by decide +kernel) +def CA2_6_8I1R8Mass : Ball := ⟨0, 0⟩ +lemma CA2_6_8I1R8Mass_sound : CA2_6_8I1R8Mass.Encloses (∑ a, CA2_6_8I1R8Value a) := by + exact contains_sound (pairSumBall_sound CA2_6_8I1R8P CA2_6_8I1R8Value CA2_6_8I1R8P_sound) (by decide +kernel) +def CA2_6_8I1R8MassTerm : Ball := .exact 0 +lemma CA2_6_8I1R8MassTerm_sound : CA2_6_8I1R8MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_6_8I1R8Value a))) := + entropyTerm_zero_ball (CA2_6_8I1R8Mass_sound) +def CA2_6_8I1R8H : Ball := ⟨0, 0⟩ +lemma CA2_6_8I1R8H_sound : CA2_6_8I1R8H.Encloses (homogeneousEntropy CA2_6_8I1R8Value) := by + exact contains_sound (homogeneous_enclosed CA2_6_8I1R8Value CA2_6_8I1R8MassTerm_sound CA2_6_8I1R8Entropy_sound) (by decide +kernel) +def CA2_6_8I1R9Value (a : PairSlot) : ℝ := residualLaw (below (shape 2 6 8)) (fun u => (stageALaw (shape 2 6 8) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 9 a +def CA2_6_8I1R9Raw (a : PairSlot) : Ball := residualBall (below (shape 2 6 8)) A2_6_8Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 9 a +lemma CA2_6_8I1R9Raw_sound (a : PairSlot) : + (CA2_6_8I1R9Raw a).Encloses (CA2_6_8I1R9Value a) := by + exact residualBall_sound_on (below (shape 2 6 8)) A2_6_8Law (fun u => (stageALaw (shape 2 6 8) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A2_6_8Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 2 6 8) (show (shape 2 6 8) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 9 a +def CA2_6_8I1R9Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA2_6_8I1R9Certificates_valid : + CA2_6_8I1R9Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_6_8I1R9CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA2_6_8I1R9P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_6_8I1R9Certificates (CA2_6_8I1R9CertificateIndex a)).input +lemma CA2_6_8I1R9P_check : ∀ a : PairSlot, contains (CA2_6_8I1R9Raw a) (CA2_6_8I1R9P a) = true := by + decide +kernel +lemma CA2_6_8I1R9P_sound (a : PairSlot) : + (CA2_6_8I1R9P a).Encloses (CA2_6_8I1R9Value a) := + contains_sound (CA2_6_8I1R9Raw_sound a) (CA2_6_8I1R9P_check a) +def CA2_6_8I1R9Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_6_8I1R9Certificates (CA2_6_8I1R9CertificateIndex a)).output +lemma CA2_6_8I1R9Terms_sound (a : PairSlot) : + (CA2_6_8I1R9Terms a).Encloses (Foundation.entropyTerm (CA2_6_8I1R9Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_6_8I1R9Certificates_valid + (CA2_6_8I1R9CertificateIndex a) (CA2_6_8I1R9P_sound a) +def CA2_6_8I1R9Entropy : Ball := ⟨0, 0⟩ +lemma CA2_6_8I1R9Entropy_sound : CA2_6_8I1R9Entropy.Encloses (Foundation.finiteEntropy CA2_6_8I1R9Value) := by + exact contains_sound (entropyPair_enclosed CA2_6_8I1R9Value CA2_6_8I1R9Terms CA2_6_8I1R9Terms_sound) (by decide +kernel) +def CA2_6_8I1R9Mass : Ball := ⟨0, 0⟩ +lemma CA2_6_8I1R9Mass_sound : CA2_6_8I1R9Mass.Encloses (∑ a, CA2_6_8I1R9Value a) := by + exact contains_sound (pairSumBall_sound CA2_6_8I1R9P CA2_6_8I1R9Value CA2_6_8I1R9P_sound) (by decide +kernel) +def CA2_6_8I1R9MassTerm : Ball := .exact 0 +lemma CA2_6_8I1R9MassTerm_sound : CA2_6_8I1R9MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_6_8I1R9Value a))) := + entropyTerm_zero_ball (CA2_6_8I1R9Mass_sound) +def CA2_6_8I1R9H : Ball := ⟨0, 0⟩ +lemma CA2_6_8I1R9H_sound : CA2_6_8I1R9H.Encloses (homogeneousEntropy CA2_6_8I1R9Value) := by + exact contains_sound (homogeneous_enclosed CA2_6_8I1R9Value CA2_6_8I1R9MassTerm_sound CA2_6_8I1R9Entropy_sound) (by decide +kernel) +def CA2_6_8I1R10Value (a : PairSlot) : ℝ := residualLaw (below (shape 2 6 8)) (fun u => (stageALaw (shape 2 6 8) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 10 a +def CA2_6_8I1R10Raw (a : PairSlot) : Ball := residualBall (below (shape 2 6 8)) A2_6_8Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 10 a +lemma CA2_6_8I1R10Raw_sound (a : PairSlot) : + (CA2_6_8I1R10Raw a).Encloses (CA2_6_8I1R10Value a) := by + exact residualBall_sound_on (below (shape 2 6 8)) A2_6_8Law (fun u => (stageALaw (shape 2 6 8) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A2_6_8Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 2 6 8) (show (shape 2 6 8) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 10 a +def CA2_6_8I1R10Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA2_6_8I1R10Certificates_valid : + CA2_6_8I1R10Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_6_8I1R10CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA2_6_8I1R10P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_6_8I1R10Certificates (CA2_6_8I1R10CertificateIndex a)).input +lemma CA2_6_8I1R10P_check : ∀ a : PairSlot, contains (CA2_6_8I1R10Raw a) (CA2_6_8I1R10P a) = true := by + decide +kernel +lemma CA2_6_8I1R10P_sound (a : PairSlot) : + (CA2_6_8I1R10P a).Encloses (CA2_6_8I1R10Value a) := + contains_sound (CA2_6_8I1R10Raw_sound a) (CA2_6_8I1R10P_check a) +def CA2_6_8I1R10Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_6_8I1R10Certificates (CA2_6_8I1R10CertificateIndex a)).output +lemma CA2_6_8I1R10Terms_sound (a : PairSlot) : + (CA2_6_8I1R10Terms a).Encloses (Foundation.entropyTerm (CA2_6_8I1R10Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_6_8I1R10Certificates_valid + (CA2_6_8I1R10CertificateIndex a) (CA2_6_8I1R10P_sound a) +def CA2_6_8I1R10Entropy : Ball := ⟨0, 0⟩ +lemma CA2_6_8I1R10Entropy_sound : CA2_6_8I1R10Entropy.Encloses (Foundation.finiteEntropy CA2_6_8I1R10Value) := by + exact contains_sound (entropyPair_enclosed CA2_6_8I1R10Value CA2_6_8I1R10Terms CA2_6_8I1R10Terms_sound) (by decide +kernel) +def CA2_6_8I1R10Mass : Ball := ⟨0, 0⟩ +lemma CA2_6_8I1R10Mass_sound : CA2_6_8I1R10Mass.Encloses (∑ a, CA2_6_8I1R10Value a) := by + exact contains_sound (pairSumBall_sound CA2_6_8I1R10P CA2_6_8I1R10Value CA2_6_8I1R10P_sound) (by decide +kernel) +def CA2_6_8I1R10MassTerm : Ball := .exact 0 +lemma CA2_6_8I1R10MassTerm_sound : CA2_6_8I1R10MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_6_8I1R10Value a))) := + entropyTerm_zero_ball (CA2_6_8I1R10Mass_sound) +def CA2_6_8I1R10H : Ball := ⟨0, 0⟩ +lemma CA2_6_8I1R10H_sound : CA2_6_8I1R10H.Encloses (homogeneousEntropy CA2_6_8I1R10Value) := by + exact contains_sound (homogeneous_enclosed CA2_6_8I1R10Value CA2_6_8I1R10MassTerm_sound CA2_6_8I1R10Entropy_sound) (by decide +kernel) +def CA2_6_8I1R11Value (a : PairSlot) : ℝ := residualLaw (below (shape 2 6 8)) (fun u => (stageALaw (shape 2 6 8) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 11 a +def CA2_6_8I1R11Raw (a : PairSlot) : Ball := residualBall (below (shape 2 6 8)) A2_6_8Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 11 a +lemma CA2_6_8I1R11Raw_sound (a : PairSlot) : + (CA2_6_8I1R11Raw a).Encloses (CA2_6_8I1R11Value a) := by + exact residualBall_sound_on (below (shape 2 6 8)) A2_6_8Law (fun u => (stageALaw (shape 2 6 8) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A2_6_8Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 2 6 8) (show (shape 2 6 8) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 11 a +def CA2_6_8I1R11Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA2_6_8I1R11Certificates_valid : + CA2_6_8I1R11Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_6_8I1R11CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA2_6_8I1R11P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_6_8I1R11Certificates (CA2_6_8I1R11CertificateIndex a)).input +lemma CA2_6_8I1R11P_check : ∀ a : PairSlot, contains (CA2_6_8I1R11Raw a) (CA2_6_8I1R11P a) = true := by + decide +kernel +lemma CA2_6_8I1R11P_sound (a : PairSlot) : + (CA2_6_8I1R11P a).Encloses (CA2_6_8I1R11Value a) := + contains_sound (CA2_6_8I1R11Raw_sound a) (CA2_6_8I1R11P_check a) +def CA2_6_8I1R11Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_6_8I1R11Certificates (CA2_6_8I1R11CertificateIndex a)).output +lemma CA2_6_8I1R11Terms_sound (a : PairSlot) : + (CA2_6_8I1R11Terms a).Encloses (Foundation.entropyTerm (CA2_6_8I1R11Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_6_8I1R11Certificates_valid + (CA2_6_8I1R11CertificateIndex a) (CA2_6_8I1R11P_sound a) +def CA2_6_8I1R11Entropy : Ball := ⟨0, 0⟩ +lemma CA2_6_8I1R11Entropy_sound : CA2_6_8I1R11Entropy.Encloses (Foundation.finiteEntropy CA2_6_8I1R11Value) := by + exact contains_sound (entropyPair_enclosed CA2_6_8I1R11Value CA2_6_8I1R11Terms CA2_6_8I1R11Terms_sound) (by decide +kernel) +def CA2_6_8I1R11Mass : Ball := ⟨0, 0⟩ +lemma CA2_6_8I1R11Mass_sound : CA2_6_8I1R11Mass.Encloses (∑ a, CA2_6_8I1R11Value a) := by + exact contains_sound (pairSumBall_sound CA2_6_8I1R11P CA2_6_8I1R11Value CA2_6_8I1R11P_sound) (by decide +kernel) +def CA2_6_8I1R11MassTerm : Ball := .exact 0 +lemma CA2_6_8I1R11MassTerm_sound : CA2_6_8I1R11MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_6_8I1R11Value a))) := + entropyTerm_zero_ball (CA2_6_8I1R11Mass_sound) +def CA2_6_8I1R11H : Ball := ⟨0, 0⟩ +lemma CA2_6_8I1R11H_sound : CA2_6_8I1R11H.Encloses (homogeneousEntropy CA2_6_8I1R11Value) := by + exact contains_sound (homogeneous_enclosed CA2_6_8I1R11Value CA2_6_8I1R11MassTerm_sound CA2_6_8I1R11Entropy_sound) (by decide +kernel) +def CA2_6_8I1R12Value (a : PairSlot) : ℝ := residualLaw (below (shape 2 6 8)) (fun u => (stageALaw (shape 2 6 8) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 12 a +def CA2_6_8I1R12Raw (a : PairSlot) : Ball := residualBall (below (shape 2 6 8)) A2_6_8Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 12 a +lemma CA2_6_8I1R12Raw_sound (a : PairSlot) : + (CA2_6_8I1R12Raw a).Encloses (CA2_6_8I1R12Value a) := by + exact residualBall_sound_on (below (shape 2 6 8)) A2_6_8Law (fun u => (stageALaw (shape 2 6 8) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A2_6_8Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 2 6 8) (show (shape 2 6 8) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 12 a +def CA2_6_8I1R12Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA2_6_8I1R12Certificates_valid : + CA2_6_8I1R12Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_6_8I1R12CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA2_6_8I1R12P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_6_8I1R12Certificates (CA2_6_8I1R12CertificateIndex a)).input +lemma CA2_6_8I1R12P_check : ∀ a : PairSlot, contains (CA2_6_8I1R12Raw a) (CA2_6_8I1R12P a) = true := by + decide +kernel +lemma CA2_6_8I1R12P_sound (a : PairSlot) : + (CA2_6_8I1R12P a).Encloses (CA2_6_8I1R12Value a) := + contains_sound (CA2_6_8I1R12Raw_sound a) (CA2_6_8I1R12P_check a) +def CA2_6_8I1R12Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_6_8I1R12Certificates (CA2_6_8I1R12CertificateIndex a)).output +lemma CA2_6_8I1R12Terms_sound (a : PairSlot) : + (CA2_6_8I1R12Terms a).Encloses (Foundation.entropyTerm (CA2_6_8I1R12Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_6_8I1R12Certificates_valid + (CA2_6_8I1R12CertificateIndex a) (CA2_6_8I1R12P_sound a) +def CA2_6_8I1R12Entropy : Ball := ⟨0, 0⟩ +lemma CA2_6_8I1R12Entropy_sound : CA2_6_8I1R12Entropy.Encloses (Foundation.finiteEntropy CA2_6_8I1R12Value) := by + exact contains_sound (entropyPair_enclosed CA2_6_8I1R12Value CA2_6_8I1R12Terms CA2_6_8I1R12Terms_sound) (by decide +kernel) +def CA2_6_8I1R12Mass : Ball := ⟨0, 0⟩ +lemma CA2_6_8I1R12Mass_sound : CA2_6_8I1R12Mass.Encloses (∑ a, CA2_6_8I1R12Value a) := by + exact contains_sound (pairSumBall_sound CA2_6_8I1R12P CA2_6_8I1R12Value CA2_6_8I1R12P_sound) (by decide +kernel) +def CA2_6_8I1R12MassTerm : Ball := .exact 0 +lemma CA2_6_8I1R12MassTerm_sound : CA2_6_8I1R12MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_6_8I1R12Value a))) := + entropyTerm_zero_ball (CA2_6_8I1R12Mass_sound) +def CA2_6_8I1R12H : Ball := ⟨0, 0⟩ +lemma CA2_6_8I1R12H_sound : CA2_6_8I1R12H.Encloses (homogeneousEntropy CA2_6_8I1R12Value) := by + exact contains_sound (homogeneous_enclosed CA2_6_8I1R12Value CA2_6_8I1R12MassTerm_sound CA2_6_8I1R12Entropy_sound) (by decide +kernel) +def CA2_6_8I1R13Value (a : PairSlot) : ℝ := residualLaw (below (shape 2 6 8)) (fun u => (stageALaw (shape 2 6 8) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 13 a +def CA2_6_8I1R13Raw (a : PairSlot) : Ball := residualBall (below (shape 2 6 8)) A2_6_8Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 13 a +lemma CA2_6_8I1R13Raw_sound (a : PairSlot) : + (CA2_6_8I1R13Raw a).Encloses (CA2_6_8I1R13Value a) := by + exact residualBall_sound_on (below (shape 2 6 8)) A2_6_8Law (fun u => (stageALaw (shape 2 6 8) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A2_6_8Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 2 6 8) (show (shape 2 6 8) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 13 a +def CA2_6_8I1R13Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA2_6_8I1R13Certificates_valid : + CA2_6_8I1R13Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_6_8I1R13CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA2_6_8I1R13P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_6_8I1R13Certificates (CA2_6_8I1R13CertificateIndex a)).input +lemma CA2_6_8I1R13P_check : ∀ a : PairSlot, contains (CA2_6_8I1R13Raw a) (CA2_6_8I1R13P a) = true := by + decide +kernel +lemma CA2_6_8I1R13P_sound (a : PairSlot) : + (CA2_6_8I1R13P a).Encloses (CA2_6_8I1R13Value a) := + contains_sound (CA2_6_8I1R13Raw_sound a) (CA2_6_8I1R13P_check a) +def CA2_6_8I1R13Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_6_8I1R13Certificates (CA2_6_8I1R13CertificateIndex a)).output +lemma CA2_6_8I1R13Terms_sound (a : PairSlot) : + (CA2_6_8I1R13Terms a).Encloses (Foundation.entropyTerm (CA2_6_8I1R13Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_6_8I1R13Certificates_valid + (CA2_6_8I1R13CertificateIndex a) (CA2_6_8I1R13P_sound a) +def CA2_6_8I1R13Entropy : Ball := ⟨0, 0⟩ +lemma CA2_6_8I1R13Entropy_sound : CA2_6_8I1R13Entropy.Encloses (Foundation.finiteEntropy CA2_6_8I1R13Value) := by + exact contains_sound (entropyPair_enclosed CA2_6_8I1R13Value CA2_6_8I1R13Terms CA2_6_8I1R13Terms_sound) (by decide +kernel) +def CA2_6_8I1R13Mass : Ball := ⟨0, 0⟩ +lemma CA2_6_8I1R13Mass_sound : CA2_6_8I1R13Mass.Encloses (∑ a, CA2_6_8I1R13Value a) := by + exact contains_sound (pairSumBall_sound CA2_6_8I1R13P CA2_6_8I1R13Value CA2_6_8I1R13P_sound) (by decide +kernel) +def CA2_6_8I1R13MassTerm : Ball := .exact 0 +lemma CA2_6_8I1R13MassTerm_sound : CA2_6_8I1R13MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_6_8I1R13Value a))) := + entropyTerm_zero_ball (CA2_6_8I1R13Mass_sound) +def CA2_6_8I1R13H : Ball := ⟨0, 0⟩ +lemma CA2_6_8I1R13H_sound : CA2_6_8I1R13H.Encloses (homogeneousEntropy CA2_6_8I1R13Value) := by + exact contains_sound (homogeneous_enclosed CA2_6_8I1R13Value CA2_6_8I1R13MassTerm_sound CA2_6_8I1R13Entropy_sound) (by decide +kernel) +def CA2_6_8I1R14Value (a : PairSlot) : ℝ := residualLaw (below (shape 2 6 8)) (fun u => (stageALaw (shape 2 6 8) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 14 a +def CA2_6_8I1R14Raw (a : PairSlot) : Ball := residualBall (below (shape 2 6 8)) A2_6_8Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 14 a +lemma CA2_6_8I1R14Raw_sound (a : PairSlot) : + (CA2_6_8I1R14Raw a).Encloses (CA2_6_8I1R14Value a) := by + exact residualBall_sound_on (below (shape 2 6 8)) A2_6_8Law (fun u => (stageALaw (shape 2 6 8) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A2_6_8Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 2 6 8) (show (shape 2 6 8) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 14 a +def CA2_6_8I1R14Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA2_6_8I1R14Certificates_valid : + CA2_6_8I1R14Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_6_8I1R14CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA2_6_8I1R14P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_6_8I1R14Certificates (CA2_6_8I1R14CertificateIndex a)).input +lemma CA2_6_8I1R14P_check : ∀ a : PairSlot, contains (CA2_6_8I1R14Raw a) (CA2_6_8I1R14P a) = true := by + decide +kernel +lemma CA2_6_8I1R14P_sound (a : PairSlot) : + (CA2_6_8I1R14P a).Encloses (CA2_6_8I1R14Value a) := + contains_sound (CA2_6_8I1R14Raw_sound a) (CA2_6_8I1R14P_check a) +def CA2_6_8I1R14Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_6_8I1R14Certificates (CA2_6_8I1R14CertificateIndex a)).output +lemma CA2_6_8I1R14Terms_sound (a : PairSlot) : + (CA2_6_8I1R14Terms a).Encloses (Foundation.entropyTerm (CA2_6_8I1R14Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_6_8I1R14Certificates_valid + (CA2_6_8I1R14CertificateIndex a) (CA2_6_8I1R14P_sound a) +def CA2_6_8I1R14Entropy : Ball := ⟨0, 0⟩ +lemma CA2_6_8I1R14Entropy_sound : CA2_6_8I1R14Entropy.Encloses (Foundation.finiteEntropy CA2_6_8I1R14Value) := by + exact contains_sound (entropyPair_enclosed CA2_6_8I1R14Value CA2_6_8I1R14Terms CA2_6_8I1R14Terms_sound) (by decide +kernel) +def CA2_6_8I1R14Mass : Ball := ⟨0, 0⟩ +lemma CA2_6_8I1R14Mass_sound : CA2_6_8I1R14Mass.Encloses (∑ a, CA2_6_8I1R14Value a) := by + exact contains_sound (pairSumBall_sound CA2_6_8I1R14P CA2_6_8I1R14Value CA2_6_8I1R14P_sound) (by decide +kernel) +def CA2_6_8I1R14MassTerm : Ball := .exact 0 +lemma CA2_6_8I1R14MassTerm_sound : CA2_6_8I1R14MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_6_8I1R14Value a))) := + entropyTerm_zero_ball (CA2_6_8I1R14Mass_sound) +def CA2_6_8I1R14H : Ball := ⟨0, 0⟩ +lemma CA2_6_8I1R14H_sound : CA2_6_8I1R14H.Encloses (homogeneousEntropy CA2_6_8I1R14Value) := by + exact contains_sound (homogeneous_enclosed CA2_6_8I1R14Value CA2_6_8I1R14MassTerm_sound CA2_6_8I1R14Entropy_sound) (by decide +kernel) +def CA2_6_8I1R15Value (a : PairSlot) : ℝ := residualLaw (below (shape 2 6 8)) (fun u => (stageALaw (shape 2 6 8) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 15 a +def CA2_6_8I1R15Raw (a : PairSlot) : Ball := residualBall (below (shape 2 6 8)) A2_6_8Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 15 a +lemma CA2_6_8I1R15Raw_sound (a : PairSlot) : + (CA2_6_8I1R15Raw a).Encloses (CA2_6_8I1R15Value a) := by + exact residualBall_sound_on (below (shape 2 6 8)) A2_6_8Law (fun u => (stageALaw (shape 2 6 8) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A2_6_8Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 2 6 8) (show (shape 2 6 8) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 15 a +def CA2_6_8I1R15Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA2_6_8I1R15Certificates_valid : + CA2_6_8I1R15Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_6_8I1R15CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA2_6_8I1R15P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_6_8I1R15Certificates (CA2_6_8I1R15CertificateIndex a)).input +lemma CA2_6_8I1R15P_check : ∀ a : PairSlot, contains (CA2_6_8I1R15Raw a) (CA2_6_8I1R15P a) = true := by + decide +kernel +lemma CA2_6_8I1R15P_sound (a : PairSlot) : + (CA2_6_8I1R15P a).Encloses (CA2_6_8I1R15Value a) := + contains_sound (CA2_6_8I1R15Raw_sound a) (CA2_6_8I1R15P_check a) +def CA2_6_8I1R15Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_6_8I1R15Certificates (CA2_6_8I1R15CertificateIndex a)).output +lemma CA2_6_8I1R15Terms_sound (a : PairSlot) : + (CA2_6_8I1R15Terms a).Encloses (Foundation.entropyTerm (CA2_6_8I1R15Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_6_8I1R15Certificates_valid + (CA2_6_8I1R15CertificateIndex a) (CA2_6_8I1R15P_sound a) +def CA2_6_8I1R15Entropy : Ball := ⟨0, 0⟩ +lemma CA2_6_8I1R15Entropy_sound : CA2_6_8I1R15Entropy.Encloses (Foundation.finiteEntropy CA2_6_8I1R15Value) := by + exact contains_sound (entropyPair_enclosed CA2_6_8I1R15Value CA2_6_8I1R15Terms CA2_6_8I1R15Terms_sound) (by decide +kernel) +def CA2_6_8I1R15Mass : Ball := ⟨0, 0⟩ +lemma CA2_6_8I1R15Mass_sound : CA2_6_8I1R15Mass.Encloses (∑ a, CA2_6_8I1R15Value a) := by + exact contains_sound (pairSumBall_sound CA2_6_8I1R15P CA2_6_8I1R15Value CA2_6_8I1R15P_sound) (by decide +kernel) +def CA2_6_8I1R15MassTerm : Ball := .exact 0 +lemma CA2_6_8I1R15MassTerm_sound : CA2_6_8I1R15MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_6_8I1R15Value a))) := + entropyTerm_zero_ball (CA2_6_8I1R15Mass_sound) +def CA2_6_8I1R15H : Ball := ⟨0, 0⟩ +lemma CA2_6_8I1R15H_sound : CA2_6_8I1R15H.Encloses (homogeneousEntropy CA2_6_8I1R15Value) := by + exact contains_sound (homogeneous_enclosed CA2_6_8I1R15Value CA2_6_8I1R15MassTerm_sound CA2_6_8I1R15Entropy_sound) (by decide +kernel) +def CA2_6_8I1R16Value (a : PairSlot) : ℝ := residualLaw (below (shape 2 6 8)) (fun u => (stageALaw (shape 2 6 8) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 16 a +def CA2_6_8I1R16Raw (a : PairSlot) : Ball := residualBall (below (shape 2 6 8)) A2_6_8Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 16 a +lemma CA2_6_8I1R16Raw_sound (a : PairSlot) : + (CA2_6_8I1R16Raw a).Encloses (CA2_6_8I1R16Value a) := by + exact residualBall_sound_on (below (shape 2 6 8)) A2_6_8Law (fun u => (stageALaw (shape 2 6 8) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A2_6_8Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 2 6 8) (show (shape 2 6 8) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 16 a +def CA2_6_8I1R16Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA2_6_8I1R16Certificates_valid : + CA2_6_8I1R16Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_6_8I1R16CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA2_6_8I1R16P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_6_8I1R16Certificates (CA2_6_8I1R16CertificateIndex a)).input +lemma CA2_6_8I1R16P_check : ∀ a : PairSlot, contains (CA2_6_8I1R16Raw a) (CA2_6_8I1R16P a) = true := by + decide +kernel +lemma CA2_6_8I1R16P_sound (a : PairSlot) : + (CA2_6_8I1R16P a).Encloses (CA2_6_8I1R16Value a) := + contains_sound (CA2_6_8I1R16Raw_sound a) (CA2_6_8I1R16P_check a) +def CA2_6_8I1R16Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_6_8I1R16Certificates (CA2_6_8I1R16CertificateIndex a)).output +lemma CA2_6_8I1R16Terms_sound (a : PairSlot) : + (CA2_6_8I1R16Terms a).Encloses (Foundation.entropyTerm (CA2_6_8I1R16Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_6_8I1R16Certificates_valid + (CA2_6_8I1R16CertificateIndex a) (CA2_6_8I1R16P_sound a) +def CA2_6_8I1R16Entropy : Ball := ⟨0, 0⟩ +lemma CA2_6_8I1R16Entropy_sound : CA2_6_8I1R16Entropy.Encloses (Foundation.finiteEntropy CA2_6_8I1R16Value) := by + exact contains_sound (entropyPair_enclosed CA2_6_8I1R16Value CA2_6_8I1R16Terms CA2_6_8I1R16Terms_sound) (by decide +kernel) +def CA2_6_8I1R16Mass : Ball := ⟨0, 0⟩ +lemma CA2_6_8I1R16Mass_sound : CA2_6_8I1R16Mass.Encloses (∑ a, CA2_6_8I1R16Value a) := by + exact contains_sound (pairSumBall_sound CA2_6_8I1R16P CA2_6_8I1R16Value CA2_6_8I1R16P_sound) (by decide +kernel) +def CA2_6_8I1R16MassTerm : Ball := .exact 0 +lemma CA2_6_8I1R16MassTerm_sound : CA2_6_8I1R16MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_6_8I1R16Value a))) := + entropyTerm_zero_ball (CA2_6_8I1R16Mass_sound) +def CA2_6_8I1R16H : Ball := ⟨0, 0⟩ +lemma CA2_6_8I1R16H_sound : CA2_6_8I1R16H.Encloses (homogeneousEntropy CA2_6_8I1R16Value) := by + exact contains_sound (homogeneous_enclosed CA2_6_8I1R16Value CA2_6_8I1R16MassTerm_sound CA2_6_8I1R16Entropy_sound) (by decide +kernel) +def CA2_6_8I1ResidualEntropies (a : Fin 17) : Ball := + match a.val with + | 0 => CA2_6_8I1R0H + | 1 => CA2_6_8I1R1H + | 2 => CA2_6_8I1R2H + | 3 => CA2_6_8I1R3H + | 4 => CA2_6_8I1R4H + | 5 => CA2_6_8I1R5H + | 6 => CA2_6_8I1R6H + | 7 => CA2_6_8I1R7H + | 8 => CA2_6_8I1R8H + | 9 => CA2_6_8I1R9H + | 10 => CA2_6_8I1R10H + | 11 => CA2_6_8I1R11H + | 12 => CA2_6_8I1R12H + | 13 => CA2_6_8I1R13H + | 14 => CA2_6_8I1R14H + | 15 => CA2_6_8I1R15H + | 16 => CA2_6_8I1R16H + | _ => (.exact 0) +lemma CA2_6_8I1ResidualEntropies_sound (k : Fin 17) : + (CA2_6_8I1ResidualEntropies k).Encloses (homogeneousEntropy + (residualLaw (below (shape 2 6 8)) (fun u => (stageALaw (shape 2 6 8) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) k)) := by + fin_cases k + · exact CA2_6_8I1R0H_sound + · exact CA2_6_8I1R1H_sound + · exact CA2_6_8I1R2H_sound + · exact CA2_6_8I1R3H_sound + · exact CA2_6_8I1R4H_sound + · exact CA2_6_8I1R5H_sound + · exact CA2_6_8I1R6H_sound + · exact CA2_6_8I1R7H_sound + · exact CA2_6_8I1R8H_sound + · exact CA2_6_8I1R9H_sound + · exact CA2_6_8I1R10H_sound + · exact CA2_6_8I1R11H_sound + · exact CA2_6_8I1R12H_sound + · exact CA2_6_8I1R13H_sound + · exact CA2_6_8I1R14H_sound + · exact CA2_6_8I1R15H_sound + · exact CA2_6_8I1R16H_sound +def CA2_6_8I1Singles (s : Shape) : Ball := + match s 0, s 1, s 2 with + | 2, 6, 0 => Z2_6_0H1H + | _, _, _ => (.exact 0) +lemma CA2_6_8I1Singles_sound (u : Shape) (hu : u ∈ below (shape 2 6 8)) + (hd : designated (Equiv.refl (Fin 3)) 1 u) : + (CA2_6_8I1Singles u).Encloses (homogeneousEntropy ((fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) u)) := by + rw [A2_6_8_below] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 0 0 8) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 0 1 7) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 0 2 6) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 0 3 5) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 0 4 4) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 0 5 3) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 0 6 2) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 1 0 7) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 1 1 6) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 1 2 5) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 1 3 4) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 1 4 3) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 1 5 2) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 1 6 1) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 2 0 6) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 2 1 5) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 2 2 4) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 2 3 3) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 2 4 2) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 2 5 1) by decide +kernel) hd |>.elim + · exact Z2_6_0H1H_sound +def CA2_6_8I1Singleton : Ball := ⟨(37757724657937222513117 / 500000000000000000000000000000), (1487 / 25000000000000000000000000000000)⟩ +lemma CA2_6_8I1Singleton_sound : CA2_6_8I1Singleton.Encloses + (singletonEntropy (below (shape 2 6 8)) (fun u => (stageALaw (shape 2 6 8) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ))) := by + exact contains_sound (singletonBall_sound (below (shape 2 6 8)) A2_6_8Law (fun u => (stageALaw (shape 2 6 8) u : ℝ)) (Equiv.refl (Fin 3)) 1 + CA2_6_8I1Singles (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A2_6_8Law_sound u) CA2_6_8I1Singles_sound) (by decide +kernel) +def CA2_6_8I1Group : Ball := ⟨(54318682619917483587541367140529 / 50000000000000000000000000000000), (166666091037 / 100000000000000000000000000000000)⟩ +lemma CA2_6_8I1Group_sound : CA2_6_8I1Group.Encloses + (groupedEntropy (below (shape 2 6 8)) (fun u => (stageALaw (shape 2 6 8) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ))) := by + exact contains_sound (Ball.add_sound CA2_6_8I1Singleton_sound + (finSumBall_sound 17 CA2_6_8I1ResidualEntropies _ CA2_6_8I1ResidualEntropies_sound)) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CA2_6_8I1H : Ball := ⟨(56710716895161352451896967881823 / 50000000000000000000000000000000), (490426241337 / 100000000000000000000000000000000)⟩ +lemma CA2_6_8I1_sound : CA2_6_8I1H.Encloses (stageACapacity (shape 2 6 8) 1) := by + have hb := contains_sound (Ball.add_sound CA2_6_8I1PairH_sound + (Ball.neg_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) CA2_6_8I1Group_sound))) + (show contains (.add CA2_6_8I1PairH (.neg (.mul (.exact 2) CA2_6_8I1Group))) CA2_6_8I1H = true by decide +kernel) + unfold CA2_6_8I1PairValue at hb + simpa only [stageACapacity, nativeCapacity, + show (1 : Fin 3) ≠ 0 by decide, ite_false, sub_eq_add_neg] using hb + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA2_6_8I1Pair.lean b/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA2_6_8I1Pair.lean new file mode 100644 index 0000000000000000000000000000000000000000..6ece3e9e94c1bc5983fc9aa43f8f224b7cf380dd --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA2_6_8I1Pair.lean @@ -0,0 +1,324 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Certificates.SupportedContraction + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CA2_6_8I1PairValue (a : PairSlot × PairSlot) : ℝ := pairLaw (below (shape 2 6 8)) (shape 2 6 8) (fun u => (stageALaw (shape 2 6 8) u : ℝ)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) a +def CA2_6_8I1PairRaw (a : PairSlot × PairSlot) : Ball := stageAPairBall (shape 2 6 8) A2_6_8Law 1 a +lemma CA2_6_8I1PairRaw_sound (a : PairSlot × PairSlot) : + (CA2_6_8I1PairRaw a).Encloses (CA2_6_8I1PairValue a) := by + exact stageAPairBall_sound (shape 2 6 8) (by decide +kernel) A2_6_8Law (fun u => (stageALaw (shape 2 6 8) u : ℝ)) (fun u _ => A2_6_8Law_sound u) 1 a +def CA2_6_8I1PairCertificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(600462585855878852340789703 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(3193466004731525691912694491 / 12500000000000000000000000000000), (8646409 / 100000000000000000000000000000000)⟩ ⟨(-531834302411975988158267938276751 / 50000000000000000000000000000000), (71997808849 / 20000000000000000000000000000000)⟩ ⟨-16, 600462585855878852340789703, 381469726562500000000000000⟩, + .log ⟨(169752511872998762977915647 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(1127694724712575777512175943 / 50000000000000000000000000000000), (754891 / 100000000000000000000000000000000)⟩ ⟨(-1328633918013851286275474412603347 / 100000000000000000000000000000000), (88938577287 / 20000000000000000000000000000000)⟩ ⟨-20, 169752511872998762977915647, 95367431640625000000000000⟩, + .log ⟨(5150224326126620972366005269 / 50000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ ⟨(94565720484580155200496157261 / 100000000000000000000000000000000), (4089763 / 12500000000000000000000000000000)⟩ ⟨(-918073801221209245364125856290051 / 100000000000000000000000000000000), (31763738437 / 10000000000000000000000000000000)⟩ ⟨-14, 5150224326126620972366005269, 3051757812500000000000000000⟩, + .log ⟨(154399745645881389037673594901 / 50000000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ ⟨(892466550397130578397374404679 / 50000000000000000000000000000000), (326954193 / 50000000000000000000000000000000)⟩ ⟨(-144505832354804968975614122561763 / 25000000000000000000000000000000), (338813181 / 160000000000000000000000000000)⟩ ⟨-9, 154399745645881389037673594901, 97656250000000000000000000000⟩, + .log ⟨(1299058421612978686171861059 / 5000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(10724446273843456266962482153 / 5000000000000000000000000000000), (35761227 / 50000000000000000000000000000000)⟩ ⟨(-82555534804411832844737863865457 / 10000000000000000000000000000000), (275285711727 / 100000000000000000000000000000000)⟩ ⟨-12, 1299058421612978686171861059, 1220703125000000000000000000⟩, + .log ⟨(13539279157387270476612493101 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(1507485416655234025898062883 / 1250000000000000000000000000000), (8027753 / 20000000000000000000000000000000)⟩ ⟨(-17814660873820282065729752928779 / 2000000000000000000000000000000), (296461538947 / 100000000000000000000000000000000)⟩ ⟨-13, 13539279157387270476612493101, 12207031250000000000000000000⟩, + .log ⟨(2520895374428631094935688921701 / 100000000000000000000000000000000), (23 / 100000000000000000000000000000000)⟩ ⟨(9278296697213026713030033971299 / 100000000000000000000000000000000), (1868371313 / 50000000000000000000000000000000)⟩ ⟨(-368055604025850616183560298753439 / 100000000000000000000000000000000), (148230766693 / 100000000000000000000000000000000)⟩ ⟨-6, 2520895374428631094935688921701, 1562500000000000000000000000000⟩, + .log ⟨(103379044182908133136455182299 / 50000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ ⟨(1278049487370797580347246983203 / 100000000000000000000000000000000), (87565461 / 20000000000000000000000000000000)⟩ ⟨(-618137601035249314073343054887803 / 100000000000000000000000000000000), (5293955957 / 2500000000000000000000000000000)⟩ ⟨-9, 103379044182908133136455182299, 97656250000000000000000000000⟩, + .log ⟨(2112266548304247734268732677 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(36693121572814147119934723729 / 25000000000000000000000000000000), (50096473 / 100000000000000000000000000000000)⟩ ⟨(-217143058970657691490922402259579 / 25000000000000000000000000000000), (296461537479 / 100000000000000000000000000000000)⟩ ⟨-13, 2112266548304247734268732677, 1525878906250000000000000000⟩, + .log ⟨(411221233435494998762392739779 / 100000000000000000000000000000000), (1 / 20000000000000000000000000000000)⟩ ⟨(2259164791976658001080339639893 / 100000000000000000000000000000000), (783715383 / 100000000000000000000000000000000)⟩ ⟨(-549379411443021994930818780276173 / 100000000000000000000000000000000), (95291207181 / 50000000000000000000000000000000)⟩ ⟨-8, 411221233435494998762392739779, 390625000000000000000000000000⟩, + .log ⟨(2474792652609750993336380327 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(6133539516564901179682071639 / 12500000000000000000000000000000), (16769859 / 100000000000000000000000000000000)⟩ ⟨(-991362166862242811391889358694967 / 100000000000000000000000000000000), (338813199131 / 100000000000000000000000000000000)⟩ ⟨-15, 2474792652609750993336380327, 1525878906250000000000000000⟩, + .log ⟨(258079486080502395838315073349 / 100000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ ⟨(769032716528385905299826930591 / 50000000000000000000000000000000), (546504591 / 100000000000000000000000000000000)⟩ ⟨(-148991446047847161702439962223767 / 25000000000000000000000000000000), (26469779749 / 12500000000000000000000000000000)⟩ ⟨-9, 258079486080502395838315073349, 195312500000000000000000000000⟩, + .log ⟨(21029417372678407687471620373 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(89028071886316673926253240383 / 50000000000000000000000000000000), (62344143 / 100000000000000000000000000000000)⟩ ⟨(-846700318021959832569339751824367 / 100000000000000000000000000000000), (296461536317 / 100000000000000000000000000000000)⟩ ⟨-13, 21029417372678407687471620373, 12207031250000000000000000000⟩, + .log ⟨(1686465299228190811797673887 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(9267371917709427765953210751 / 50000000000000000000000000000000), (3035551 / 50000000000000000000000000000000)⟩ ⟨(-1099029066527562876531192614906891 / 100000000000000000000000000000000), (179994530953 / 50000000000000000000000000000000)⟩ ⟨-16, 1686465299228190811797673887, 1525878906250000000000000000⟩, + .log ⟨(8352739902711933852485056267 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(324959083321209431628106918091 / 100000000000000000000000000000000), (57484753 / 50000000000000000000000000000000)⟩ ⟨(-97261224192945068557358169132091 / 12500000000000000000000000000000), (275285710273 / 100000000000000000000000000000000)⟩ ⟨-12, 8352739902711933852485056267, 4882812500000000000000000000⟩, + .log ⟨(498070226465068083874437661 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(6081407411517037338765211421 / 100000000000000000000000000000000), (2003953 / 100000000000000000000000000000000)⟩ ⟨(-305248491496788652496477894893049 / 25000000000000000000000000000000), (402340850751 / 100000000000000000000000000000000)⟩ ⟨-18, 498070226465068083874437661, 381469726562500000000000000⟩, + .log ⟨(9504346240390084556871695753003 / 100000000000000000000000000000000), (13 / 20000000000000000000000000000000)⟩ ⟨(349495749484483657397994059811 / 1562500000000000000000000000000), (10063118229 / 100000000000000000000000000000000)⟩ ⟨(-117671049650696021403988952801757 / 50000000000000000000000000000000), (105879119099 / 100000000000000000000000000000000)⟩ ⟨-4, 9504346240390084556871695753003, 6250000000000000000000000000000⟩, + .log ⟨(780149650732392287397900756533 / 100000000000000000000000000000000), (7 / 100000000000000000000000000000000)⟩ ⟨(3786409289751592892001845105419 / 100000000000000000000000000000000), (185853509 / 12500000000000000000000000000000)⟩ ⟨(-485343970377602692714856807094827 / 100000000000000000000000000000000), (47645603511 / 25000000000000000000000000000000)⟩ ⟨-8, 780149650732392287397900756533, 390625000000000000000000000000⟩, + .log ⟨(31696391004984126991384630827 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(466797533850299212433142405687 / 100000000000000000000000000000000), (80543667 / 50000000000000000000000000000000)⟩ ⟨(-736357545843148549691683760891591 / 100000000000000000000000000000000), (254109885773 / 100000000000000000000000000000000)⟩ ⟨-11, 31696391004984126991384630827, 24414062500000000000000000000⟩, + .log ⟨(193775952818454387444717611043 / 12500000000000000000000000000000), (13 / 100000000000000000000000000000000)⟩ ⟨(1291875230889349576646089026841 / 20000000000000000000000000000000), (2626153931 / 100000000000000000000000000000000)⟩ ⟨(-208339065699835405128221060158723 / 50000000000000000000000000000000), (169406590303 / 100000000000000000000000000000000)⟩ ⟨-7, 193775952818454387444717611043, 97656250000000000000000000000⟩, + .log ⟨(466341434950264419198155831 / 2500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(160176777907329016854603391169 / 100000000000000000000000000000000), (55300929 / 100000000000000000000000000000000)⟩ ⟨(-17173766461949918930687514834883 / 2000000000000000000000000000000), (148230768461 / 50000000000000000000000000000000)⟩ ⟨-13, 466341434950264419198155831, 305175781250000000000000000⟩, + .log ⟨(360211644980747345599307130097 / 100000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ ⟨(50665872434982569410077816203 / 2500000000000000000000000000000), (762777849 / 100000000000000000000000000000000)⟩ ⟨(-112524674070857576493672435143711 / 20000000000000000000000000000000), (211758237663 / 100000000000000000000000000000000)⟩ ⟨-9, 360211644980747345599307130097, 195312500000000000000000000000⟩, + .log ⟨(3975695584412547441639193113 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(25613925149405639350648789303 / 10000000000000000000000000000000), (10944523 / 12500000000000000000000000000000)⟩ ⟨(-100666052508796305374135692278849 / 12500000000000000000000000000000), (275285711023 / 100000000000000000000000000000000)⟩ ⟨-12, 3975695584412547441639193113, 3051757812500000000000000000⟩, + .log ⟨(12297467480060272939123533631 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(110720643447951962742892685813 / 100000000000000000000000000000000), (36457271 / 100000000000000000000000000000000)⟩ ⟨(-450176605986069635044661807876481 / 50000000000000000000000000000000), (296461539693 / 100000000000000000000000000000000)⟩ ⟨-13, 12297467480060272939123533631, 12207031250000000000000000000⟩, + .log ⟨(10237025554461730987333810638623 / 100000000000000000000000000000000), (9 / 20000000000000000000000000000000)⟩ ⟨(23331809762756233178684675042331 / 100000000000000000000000000000000), (10838872557 / 100000000000000000000000000000000)⟩ ⟨(-227915908176933664862164492518359 / 100000000000000000000000000000000), (52939559427 / 50000000000000000000000000000000)⟩ ⟨-4, 10237025554461730987333810638623, 6250000000000000000000000000000⟩, + .log ⟨(468526825748178681506720967609 / 50000000000000000000000000000000), (1 / 20000000000000000000000000000000)⟩ ⟨(273513364854301191225079149757 / 6250000000000000000000000000000), (1587430661 / 100000000000000000000000000000000)⟩ ⟨(-14594327892406939091714104497209 / 3125000000000000000000000000000), (169406589997 / 100000000000000000000000000000000)⟩ ⟨-7, 468526825748178681506720967609, 390625000000000000000000000000⟩, + .log ⟨(85293462297828327017593394817 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(602754198331513151888837016751 / 100000000000000000000000000000000), (216739127 / 100000000000000000000000000000000)⟩ ⟨(-706682765704611325858872810226659 / 100000000000000000000000000000000), (31763735671 / 12500000000000000000000000000000)⟩ ⟨-11, 85293462297828327017593394817, 48828125000000000000000000000⟩] +lemma CA2_6_8I1PairCertificates_valid : + CA2_6_8I1PairCertificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_6_8I1PairCertificateIndex (a : PairSlot × PairSlot) : ℕ := + match a.1.1.val, a.1.2.val, a.2.1.val, a.2.2.val with + | 0, 0, 2, 5 => 1 + | 0, 0, 3, 5 => 2 + | 0, 0, 4, 4 => 3 + | 0, 0, 5, 2 => 1 + | 0, 0, 5, 3 => 2 + | 1, 0, 4, 2 => 4 + | 1, 0, 4, 3 => 5 + | 1, 0, 5, 1 => 6 + | 1, 0, 2, 4 => 4 + | 1, 0, 3, 4 => 5 + | 1, 0, 1, 5 => 6 + | 0, 1, 4, 2 => 4 + | 0, 1, 4, 3 => 5 + | 0, 1, 5, 1 => 6 + | 0, 1, 2, 4 => 4 + | 0, 1, 3, 4 => 5 + | 0, 1, 1, 5 => 6 + | 2, 0, 2, 2 => 7 + | 2, 0, 2, 3 => 8 + | 2, 0, 3, 2 => 8 + | 2, 0, 3, 3 => 9 + | 2, 0, 4, 1 => 10 + | 2, 0, 5, 0 => 11 + | 2, 0, 1, 4 => 10 + | 2, 0, 0, 5 => 11 + | 3, 0, 2, 2 => 12 + | 3, 0, 2, 3 => 13 + | 3, 0, 3, 2 => 13 + | 3, 0, 3, 3 => 14 + | 3, 0, 4, 1 => 15 + | 3, 0, 5, 0 => 16 + | 3, 0, 1, 4 => 15 + | 3, 0, 0, 5 => 16 + | 1, 1, 2, 2 => 17 + | 1, 1, 2, 3 => 18 + | 1, 1, 3, 2 => 18 + | 1, 1, 3, 3 => 19 + | 1, 1, 4, 1 => 20 + | 1, 1, 5, 0 => 21 + | 1, 1, 1, 4 => 20 + | 1, 1, 0, 5 => 21 + | 0, 2, 2, 2 => 7 + | 0, 2, 2, 3 => 8 + | 0, 2, 3, 2 => 8 + | 0, 2, 3, 3 => 9 + | 0, 2, 4, 1 => 10 + | 0, 2, 5, 0 => 11 + | 0, 2, 1, 4 => 10 + | 0, 2, 0, 5 => 11 + | 0, 3, 2, 2 => 12 + | 0, 3, 2, 3 => 13 + | 0, 3, 3, 2 => 13 + | 0, 3, 3, 3 => 14 + | 0, 3, 4, 1 => 15 + | 0, 3, 5, 0 => 16 + | 0, 3, 1, 4 => 15 + | 0, 3, 0, 5 => 16 + | 4, 0, 1, 2 => 22 + | 4, 0, 1, 3 => 23 + | 4, 0, 2, 1 => 22 + | 4, 0, 3, 1 => 23 + | 4, 0, 4, 0 => 24 + | 4, 0, 0, 4 => 24 + | 2, 1, 1, 2 => 25 + | 2, 1, 1, 3 => 26 + | 2, 1, 2, 1 => 25 + | 2, 1, 3, 1 => 26 + | 2, 1, 4, 0 => 22 + | 2, 1, 0, 4 => 22 + | 3, 1, 1, 2 => 26 + | 3, 1, 1, 3 => 27 + | 3, 1, 2, 1 => 26 + | 3, 1, 3, 1 => 27 + | 3, 1, 4, 0 => 23 + | 3, 1, 0, 4 => 23 + | 1, 2, 1, 2 => 25 + | 1, 2, 1, 3 => 26 + | 1, 2, 2, 1 => 25 + | 1, 2, 3, 1 => 26 + | 1, 2, 4, 0 => 22 + | 1, 2, 0, 4 => 22 + | 1, 3, 1, 2 => 26 + | 1, 3, 1, 3 => 27 + | 1, 3, 2, 1 => 26 + | 1, 3, 3, 1 => 27 + | 1, 3, 4, 0 => 23 + | 1, 3, 0, 4 => 23 + | 0, 4, 1, 2 => 22 + | 0, 4, 1, 3 => 23 + | 0, 4, 2, 1 => 22 + | 0, 4, 3, 1 => 23 + | 0, 4, 4, 0 => 24 + | 0, 4, 0, 4 => 24 + | 0, 5, 0, 2 => 11 + | 0, 5, 0, 3 => 16 + | 0, 5, 1, 1 => 21 + | 0, 5, 2, 0 => 11 + | 0, 5, 3, 0 => 16 + | 1, 4, 0, 2 => 10 + | 1, 4, 0, 3 => 15 + | 1, 4, 1, 1 => 20 + | 1, 4, 2, 0 => 10 + | 1, 4, 3, 0 => 15 + | 2, 2, 0, 2 => 7 + | 2, 2, 0, 3 => 12 + | 2, 2, 1, 1 => 17 + | 2, 2, 2, 0 => 7 + | 2, 2, 3, 0 => 12 + | 2, 3, 0, 2 => 8 + | 2, 3, 0, 3 => 13 + | 2, 3, 1, 1 => 18 + | 2, 3, 2, 0 => 8 + | 2, 3, 3, 0 => 13 + | 3, 2, 0, 2 => 8 + | 3, 2, 0, 3 => 13 + | 3, 2, 1, 1 => 18 + | 3, 2, 2, 0 => 8 + | 3, 2, 3, 0 => 13 + | 3, 3, 0, 2 => 9 + | 3, 3, 0, 3 => 14 + | 3, 3, 1, 1 => 19 + | 3, 3, 2, 0 => 9 + | 3, 3, 3, 0 => 14 + | 4, 1, 0, 2 => 10 + | 4, 1, 0, 3 => 15 + | 4, 1, 1, 1 => 20 + | 4, 1, 2, 0 => 10 + | 4, 1, 3, 0 => 15 + | 5, 0, 0, 2 => 11 + | 5, 0, 0, 3 => 16 + | 5, 0, 1, 1 => 21 + | 5, 0, 2, 0 => 11 + | 5, 0, 3, 0 => 16 + | 1, 5, 0, 1 => 6 + | 1, 5, 1, 0 => 6 + | 2, 4, 0, 1 => 4 + | 2, 4, 1, 0 => 4 + | 3, 4, 0, 1 => 5 + | 3, 4, 1, 0 => 5 + | 4, 2, 0, 1 => 4 + | 4, 2, 1, 0 => 4 + | 4, 3, 0, 1 => 5 + | 4, 3, 1, 0 => 5 + | 5, 1, 0, 1 => 6 + | 5, 1, 1, 0 => 6 + | 2, 5, 0, 0 => 1 + | 3, 5, 0, 0 => 2 + | 4, 4, 0, 0 => 3 + | 5, 2, 0, 0 => 1 + | 5, 3, 0, 0 => 2 + | _, _, _, _ => 0 +def CA2_6_8I1PairP (a : PairSlot × PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_6_8I1PairCertificates (CA2_6_8I1PairCertificateIndex a)).input +lemma CA2_6_8I1PairP_check_0_0 : ∀ k l : Fin 6, contains (CA2_6_8I1PairRaw ((0,0),(k,l))) (CA2_6_8I1PairP ((0,0),(k,l))) = true := by + decide +kernel +lemma CA2_6_8I1PairP_check_0_1 : ∀ k l : Fin 6, contains (CA2_6_8I1PairRaw ((0,1),(k,l))) (CA2_6_8I1PairP ((0,1),(k,l))) = true := by + decide +kernel +lemma CA2_6_8I1PairP_check_0_2 : ∀ k l : Fin 6, contains (CA2_6_8I1PairRaw ((0,2),(k,l))) (CA2_6_8I1PairP ((0,2),(k,l))) = true := by + decide +kernel +lemma CA2_6_8I1PairP_check_0_3 : ∀ k l : Fin 6, contains (CA2_6_8I1PairRaw ((0,3),(k,l))) (CA2_6_8I1PairP ((0,3),(k,l))) = true := by + decide +kernel +lemma CA2_6_8I1PairP_check_0_4 : ∀ k l : Fin 6, contains (CA2_6_8I1PairRaw ((0,4),(k,l))) (CA2_6_8I1PairP ((0,4),(k,l))) = true := by + decide +kernel +lemma CA2_6_8I1PairP_check_0_5 : ∀ k l : Fin 6, contains (CA2_6_8I1PairRaw ((0,5),(k,l))) (CA2_6_8I1PairP ((0,5),(k,l))) = true := by + decide +kernel +lemma CA2_6_8I1PairP_check_1_0 : ∀ k l : Fin 6, contains (CA2_6_8I1PairRaw ((1,0),(k,l))) (CA2_6_8I1PairP ((1,0),(k,l))) = true := by + decide +kernel +lemma CA2_6_8I1PairP_check_1_1 : ∀ k l : Fin 6, contains (CA2_6_8I1PairRaw ((1,1),(k,l))) (CA2_6_8I1PairP ((1,1),(k,l))) = true := by + decide +kernel +lemma CA2_6_8I1PairP_check_1_2 : ∀ k l : Fin 6, contains (CA2_6_8I1PairRaw ((1,2),(k,l))) (CA2_6_8I1PairP ((1,2),(k,l))) = true := by + decide +kernel +lemma CA2_6_8I1PairP_check_1_3 : ∀ k l : Fin 6, contains (CA2_6_8I1PairRaw ((1,3),(k,l))) (CA2_6_8I1PairP ((1,3),(k,l))) = true := by + decide +kernel +lemma CA2_6_8I1PairP_check_1_4 : ∀ k l : Fin 6, contains (CA2_6_8I1PairRaw ((1,4),(k,l))) (CA2_6_8I1PairP ((1,4),(k,l))) = true := by + decide +kernel +lemma CA2_6_8I1PairP_check_1_5 : ∀ k l : Fin 6, contains (CA2_6_8I1PairRaw ((1,5),(k,l))) (CA2_6_8I1PairP ((1,5),(k,l))) = true := by + decide +kernel +lemma CA2_6_8I1PairP_check_2_0 : ∀ k l : Fin 6, contains (CA2_6_8I1PairRaw ((2,0),(k,l))) (CA2_6_8I1PairP ((2,0),(k,l))) = true := by + decide +kernel +lemma CA2_6_8I1PairP_check_2_1 : ∀ k l : Fin 6, contains (CA2_6_8I1PairRaw ((2,1),(k,l))) (CA2_6_8I1PairP ((2,1),(k,l))) = true := by + decide +kernel +lemma CA2_6_8I1PairP_check_2_2 : ∀ k l : Fin 6, contains (CA2_6_8I1PairRaw ((2,2),(k,l))) (CA2_6_8I1PairP ((2,2),(k,l))) = true := by + decide +kernel +lemma CA2_6_8I1PairP_check_2_3 : ∀ k l : Fin 6, contains (CA2_6_8I1PairRaw ((2,3),(k,l))) (CA2_6_8I1PairP ((2,3),(k,l))) = true := by + decide +kernel +lemma CA2_6_8I1PairP_check_2_4 : ∀ k l : Fin 6, contains (CA2_6_8I1PairRaw ((2,4),(k,l))) (CA2_6_8I1PairP ((2,4),(k,l))) = true := by + decide +kernel +lemma CA2_6_8I1PairP_check_2_5 : ∀ k l : Fin 6, contains (CA2_6_8I1PairRaw ((2,5),(k,l))) (CA2_6_8I1PairP ((2,5),(k,l))) = true := by + decide +kernel +lemma CA2_6_8I1PairP_check_3_0 : ∀ k l : Fin 6, contains (CA2_6_8I1PairRaw ((3,0),(k,l))) (CA2_6_8I1PairP ((3,0),(k,l))) = true := by + decide +kernel +lemma CA2_6_8I1PairP_check_3_1 : ∀ k l : Fin 6, contains (CA2_6_8I1PairRaw ((3,1),(k,l))) (CA2_6_8I1PairP ((3,1),(k,l))) = true := by + decide +kernel +lemma CA2_6_8I1PairP_check_3_2 : ∀ k l : Fin 6, contains (CA2_6_8I1PairRaw ((3,2),(k,l))) (CA2_6_8I1PairP ((3,2),(k,l))) = true := by + decide +kernel +lemma CA2_6_8I1PairP_check_3_3 : ∀ k l : Fin 6, contains (CA2_6_8I1PairRaw ((3,3),(k,l))) (CA2_6_8I1PairP ((3,3),(k,l))) = true := by + decide +kernel +lemma CA2_6_8I1PairP_check_3_4 : ∀ k l : Fin 6, contains (CA2_6_8I1PairRaw ((3,4),(k,l))) (CA2_6_8I1PairP ((3,4),(k,l))) = true := by + decide +kernel +lemma CA2_6_8I1PairP_check_3_5 : ∀ k l : Fin 6, contains (CA2_6_8I1PairRaw ((3,5),(k,l))) (CA2_6_8I1PairP ((3,5),(k,l))) = true := by + decide +kernel +lemma CA2_6_8I1PairP_check_4_0 : ∀ k l : Fin 6, contains (CA2_6_8I1PairRaw ((4,0),(k,l))) (CA2_6_8I1PairP ((4,0),(k,l))) = true := by + decide +kernel +lemma CA2_6_8I1PairP_check_4_1 : ∀ k l : Fin 6, contains (CA2_6_8I1PairRaw ((4,1),(k,l))) (CA2_6_8I1PairP ((4,1),(k,l))) = true := by + decide +kernel +lemma CA2_6_8I1PairP_check_4_2 : ∀ k l : Fin 6, contains (CA2_6_8I1PairRaw ((4,2),(k,l))) (CA2_6_8I1PairP ((4,2),(k,l))) = true := by + decide +kernel +lemma CA2_6_8I1PairP_check_4_3 : ∀ k l : Fin 6, contains (CA2_6_8I1PairRaw ((4,3),(k,l))) (CA2_6_8I1PairP ((4,3),(k,l))) = true := by + decide +kernel +lemma CA2_6_8I1PairP_check_4_4 : ∀ k l : Fin 6, contains (CA2_6_8I1PairRaw ((4,4),(k,l))) (CA2_6_8I1PairP ((4,4),(k,l))) = true := by + decide +kernel +lemma CA2_6_8I1PairP_check_4_5 : ∀ k l : Fin 6, contains (CA2_6_8I1PairRaw ((4,5),(k,l))) (CA2_6_8I1PairP ((4,5),(k,l))) = true := by + decide +kernel +lemma CA2_6_8I1PairP_check_5_0 : ∀ k l : Fin 6, contains (CA2_6_8I1PairRaw ((5,0),(k,l))) (CA2_6_8I1PairP ((5,0),(k,l))) = true := by + decide +kernel +lemma CA2_6_8I1PairP_check_5_1 : ∀ k l : Fin 6, contains (CA2_6_8I1PairRaw ((5,1),(k,l))) (CA2_6_8I1PairP ((5,1),(k,l))) = true := by + decide +kernel +lemma CA2_6_8I1PairP_check_5_2 : ∀ k l : Fin 6, contains (CA2_6_8I1PairRaw ((5,2),(k,l))) (CA2_6_8I1PairP ((5,2),(k,l))) = true := by + decide +kernel +lemma CA2_6_8I1PairP_check_5_3 : ∀ k l : Fin 6, contains (CA2_6_8I1PairRaw ((5,3),(k,l))) (CA2_6_8I1PairP ((5,3),(k,l))) = true := by + decide +kernel +lemma CA2_6_8I1PairP_check_5_4 : ∀ k l : Fin 6, contains (CA2_6_8I1PairRaw ((5,4),(k,l))) (CA2_6_8I1PairP ((5,4),(k,l))) = true := by + decide +kernel +lemma CA2_6_8I1PairP_check_5_5 : ∀ k l : Fin 6, contains (CA2_6_8I1PairRaw ((5,5),(k,l))) (CA2_6_8I1PairP ((5,5),(k,l))) = true := by + decide +kernel +lemma CA2_6_8I1PairP_check (a : PairSlot × PairSlot) : contains (CA2_6_8I1PairRaw a) (CA2_6_8I1PairP a) = true := by + rcases a with ⟨⟨i,j⟩,⟨k,l⟩⟩ + revert j i + apply forall_fin6 + · exact forall_fin6 (CA2_6_8I1PairP_check_0_0 k l) (CA2_6_8I1PairP_check_0_1 k l) (CA2_6_8I1PairP_check_0_2 k l) (CA2_6_8I1PairP_check_0_3 k l) (CA2_6_8I1PairP_check_0_4 k l) (CA2_6_8I1PairP_check_0_5 k l) + · exact forall_fin6 (CA2_6_8I1PairP_check_1_0 k l) (CA2_6_8I1PairP_check_1_1 k l) (CA2_6_8I1PairP_check_1_2 k l) (CA2_6_8I1PairP_check_1_3 k l) (CA2_6_8I1PairP_check_1_4 k l) (CA2_6_8I1PairP_check_1_5 k l) + · exact forall_fin6 (CA2_6_8I1PairP_check_2_0 k l) (CA2_6_8I1PairP_check_2_1 k l) (CA2_6_8I1PairP_check_2_2 k l) (CA2_6_8I1PairP_check_2_3 k l) (CA2_6_8I1PairP_check_2_4 k l) (CA2_6_8I1PairP_check_2_5 k l) + · exact forall_fin6 (CA2_6_8I1PairP_check_3_0 k l) (CA2_6_8I1PairP_check_3_1 k l) (CA2_6_8I1PairP_check_3_2 k l) (CA2_6_8I1PairP_check_3_3 k l) (CA2_6_8I1PairP_check_3_4 k l) (CA2_6_8I1PairP_check_3_5 k l) + · exact forall_fin6 (CA2_6_8I1PairP_check_4_0 k l) (CA2_6_8I1PairP_check_4_1 k l) (CA2_6_8I1PairP_check_4_2 k l) (CA2_6_8I1PairP_check_4_3 k l) (CA2_6_8I1PairP_check_4_4 k l) (CA2_6_8I1PairP_check_4_5 k l) + · exact forall_fin6 (CA2_6_8I1PairP_check_5_0 k l) (CA2_6_8I1PairP_check_5_1 k l) (CA2_6_8I1PairP_check_5_2 k l) (CA2_6_8I1PairP_check_5_3 k l) (CA2_6_8I1PairP_check_5_4 k l) (CA2_6_8I1PairP_check_5_5 k l) +lemma CA2_6_8I1PairP_sound (a : PairSlot × PairSlot) : + (CA2_6_8I1PairP a).Encloses (CA2_6_8I1PairValue a) := + contains_sound (CA2_6_8I1PairRaw_sound a) (CA2_6_8I1PairP_check a) +def CA2_6_8I1PairTerms (a : PairSlot × PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_6_8I1PairCertificates (CA2_6_8I1PairCertificateIndex a)).output +lemma CA2_6_8I1PairTerms_sound (a : PairSlot × PairSlot) : + (CA2_6_8I1PairTerms a).Encloses (Foundation.entropyTerm (CA2_6_8I1PairValue a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_6_8I1PairCertificates_valid + (CA2_6_8I1PairCertificateIndex a) (CA2_6_8I1PairP_sound a) +def CA2_6_8I1PairEntropy : Ball := ⟨(82674041067498159813489851081439 / 25000000000000000000000000000000), (67959117417 / 50000000000000000000000000000000)⟩ +lemma CA2_6_8I1PairEntropy_sound : CA2_6_8I1PairEntropy.Encloses (Foundation.finiteEntropy CA2_6_8I1PairValue) := by + exact contains_sound (entropyDoublePair_enclosed CA2_6_8I1PairValue CA2_6_8I1PairTerms CA2_6_8I1PairTerms_sound) (by decide +kernel) +def CA2_6_8I1PairMass : Ball := ⟨(50000000000000000000000000000003 / 50000000000000000000000000000000), (373 / 50000000000000000000000000000000)⟩ +lemma CA2_6_8I1PairMass_sound : CA2_6_8I1PairMass.Encloses (∑ a, CA2_6_8I1PairValue a) := by + exact contains_sound (doublePairSumBall_sound CA2_6_8I1PairP CA2_6_8I1PairValue CA2_6_8I1PairP_sound) (by decide +kernel) +def CA2_6_8I1PairMassTermLogWitness : LogWitness := ⟨0, 50000000000000000000000000000003, 50000000000000000000000000000000⟩ +def CA2_6_8I1PairMassTermLog : Ball := ⟨(3 / 50000000000000000000000000000000), (5293956107 / 25000000000000000000000000000000)⟩ +lemma CA2_6_8I1PairMassTermLog_sound : CA2_6_8I1PairMassTermLog.Encloses (Real.log ((∑ a, CA2_6_8I1PairValue a))) := by + exact checkLog_sound logTwoBall_sound (CA2_6_8I1PairMass_sound) (w := CA2_6_8I1PairMassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA2_6_8I1PairMassTerm : Ball := ⟨(-3 / 50000000000000000000000000000000), (21175824429 / 100000000000000000000000000000000)⟩ +lemma CA2_6_8I1PairMassTerm_sound : CA2_6_8I1PairMassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_6_8I1PairValue a))) := by + exact contains_sound (entropyTerm_ball (CA2_6_8I1PairMass_sound) CA2_6_8I1PairMassTermLog_sound) (by decide +kernel) +def CA2_6_8I1PairH : Ball := ⟨(165348082134996319626979702162881 / 50000000000000000000000000000000), (157094059263 / 100000000000000000000000000000000)⟩ +lemma CA2_6_8I1PairH_sound : CA2_6_8I1PairH.Encloses (homogeneousEntropy CA2_6_8I1PairValue) := by + exact contains_sound (homogeneous_enclosed CA2_6_8I1PairValue CA2_6_8I1PairMassTerm_sound CA2_6_8I1PairEntropy_sound) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA2_6_8I2.lean b/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA2_6_8I2.lean new file mode 100644 index 0000000000000000000000000000000000000000..2db8fc0b0a634bcdb5911e1068f728cd1afade4b --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA2_6_8I2.lean @@ -0,0 +1,864 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.CapacityA.CapA2_6_8I2Pair + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CA2_6_8I2R0Value (a : PairSlot) : ℝ := residualLaw (below (shape 2 6 8)) (fun u => (stageALaw (shape 2 6 8) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 0 a +def CA2_6_8I2R0Raw (a : PairSlot) : Ball := residualBall (below (shape 2 6 8)) A2_6_8Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 0 a +lemma CA2_6_8I2R0Raw_sound (a : PairSlot) : + (CA2_6_8I2R0Raw a).Encloses (CA2_6_8I2R0Value a) := by + exact residualBall_sound_on (below (shape 2 6 8)) A2_6_8Law (fun u => (stageALaw (shape 2 6 8) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A2_6_8Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 2 6 8) (show (shape 2 6 8) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 0 a +def CA2_6_8I2R0Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(7283242185896305552952829 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(119700847339367931999913737 / 100000000000000000000000000000000), (1543 / 4000000000000000000000000000000)⟩ ⟨(-821755231283971483508731748424759 / 50000000000000000000000000000000), (529409322223 / 100000000000000000000000000000000)⟩ ⟨-24, 7283242185896305552952829, 5960464477539062500000000⟩] +lemma CA2_6_8I2R0Certificates_valid : + CA2_6_8I2R0Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_6_8I2R0CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 0, 0 => 1 + | _, _ => 0 +def CA2_6_8I2R0P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_6_8I2R0Certificates (CA2_6_8I2R0CertificateIndex a)).input +lemma CA2_6_8I2R0P_check : ∀ a : PairSlot, contains (CA2_6_8I2R0Raw a) (CA2_6_8I2R0P a) = true := by + decide +kernel +lemma CA2_6_8I2R0P_sound (a : PairSlot) : + (CA2_6_8I2R0P a).Encloses (CA2_6_8I2R0Value a) := + contains_sound (CA2_6_8I2R0Raw_sound a) (CA2_6_8I2R0P_check a) +def CA2_6_8I2R0Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_6_8I2R0Certificates (CA2_6_8I2R0CertificateIndex a)).output +lemma CA2_6_8I2R0Terms_sound (a : PairSlot) : + (CA2_6_8I2R0Terms a).Encloses (Foundation.entropyTerm (CA2_6_8I2R0Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_6_8I2R0Certificates_valid + (CA2_6_8I2R0CertificateIndex a) (CA2_6_8I2R0P_sound a) +def CA2_6_8I2R0Entropy : Ball := ⟨(119700847339367931999913737 / 100000000000000000000000000000000), (1543 / 4000000000000000000000000000000)⟩ +lemma CA2_6_8I2R0Entropy_sound : CA2_6_8I2R0Entropy.Encloses (Foundation.finiteEntropy CA2_6_8I2R0Value) := by + exact contains_sound (entropyPair_enclosed CA2_6_8I2R0Value CA2_6_8I2R0Terms CA2_6_8I2R0Terms_sound) (by decide +kernel) +def CA2_6_8I2R0Mass : Ball := ⟨(7283242185896305552952829 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ +lemma CA2_6_8I2R0Mass_sound : CA2_6_8I2R0Mass.Encloses (∑ a, CA2_6_8I2R0Value a) := by + exact contains_sound (pairSumBall_sound CA2_6_8I2R0P CA2_6_8I2R0Value CA2_6_8I2R0P_sound) (by decide +kernel) +def CA2_6_8I2R0MassTermLogWitness : LogWitness := ⟨-24, 7283242185896305552952829, 5960464477539062500000000⟩ +def CA2_6_8I2R0MassTermLog : Ball := ⟨(-821755231283971483508731748424759 / 50000000000000000000000000000000), (529409322223 / 100000000000000000000000000000000)⟩ +lemma CA2_6_8I2R0MassTermLog_sound : CA2_6_8I2R0MassTermLog.Encloses (Real.log ((∑ a, CA2_6_8I2R0Value a))) := by + exact checkLog_sound logTwoBall_sound (CA2_6_8I2R0Mass_sound) (w := CA2_6_8I2R0MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA2_6_8I2R0MassTerm : Ball := ⟨(119700847339367931999913737 / 100000000000000000000000000000000), (1543 / 4000000000000000000000000000000)⟩ +lemma CA2_6_8I2R0MassTerm_sound : CA2_6_8I2R0MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_6_8I2R0Value a))) := by + exact contains_sound (entropyTerm_ball (CA2_6_8I2R0Mass_sound) CA2_6_8I2R0MassTermLog_sound) (by decide +kernel) +def CA2_6_8I2R0H : Ball := ⟨0, (1543 / 2000000000000000000000000000000)⟩ +lemma CA2_6_8I2R0H_sound : CA2_6_8I2R0H.Encloses (homogeneousEntropy CA2_6_8I2R0Value) := by + exact contains_sound (homogeneous_enclosed CA2_6_8I2R0Value CA2_6_8I2R0MassTerm_sound CA2_6_8I2R0Entropy_sound) (by decide +kernel) +def CA2_6_8I2R1Value (a : PairSlot) : ℝ := residualLaw (below (shape 2 6 8)) (fun u => (stageALaw (shape 2 6 8) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 1 a +def CA2_6_8I2R1Raw (a : PairSlot) : Ball := residualBall (below (shape 2 6 8)) A2_6_8Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 1 a +lemma CA2_6_8I2R1Raw_sound (a : PairSlot) : + (CA2_6_8I2R1Raw a).Encloses (CA2_6_8I2R1Value a) := by + exact residualBall_sound_on (below (shape 2 6 8)) A2_6_8Law (fun u => (stageALaw (shape 2 6 8) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A2_6_8Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 2 6 8) (show (shape 2 6 8) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 1 a +def CA2_6_8I2R1Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(3241019566401678236465874989 / 100000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ ⟨(33502540808053205599377088871 / 100000000000000000000000000000000), (439241 / 4000000000000000000000000000000)⟩ ⟨(-516851875183974785739036453103619 / 50000000000000000000000000000000), (84703310159 / 25000000000000000000000000000000)⟩ ⟨-15, 3241019566401678236465874989, 3051757812500000000000000000⟩] +lemma CA2_6_8I2R1Certificates_valid : + CA2_6_8I2R1Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_6_8I2R1CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 1, 0 => 1 + | 0, 1 => 1 + | _, _ => 0 +def CA2_6_8I2R1P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_6_8I2R1Certificates (CA2_6_8I2R1CertificateIndex a)).input +lemma CA2_6_8I2R1P_check : ∀ a : PairSlot, contains (CA2_6_8I2R1Raw a) (CA2_6_8I2R1P a) = true := by + decide +kernel +lemma CA2_6_8I2R1P_sound (a : PairSlot) : + (CA2_6_8I2R1P a).Encloses (CA2_6_8I2R1Value a) := + contains_sound (CA2_6_8I2R1Raw_sound a) (CA2_6_8I2R1P_check a) +def CA2_6_8I2R1Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_6_8I2R1Certificates (CA2_6_8I2R1CertificateIndex a)).output +lemma CA2_6_8I2R1Terms_sound (a : PairSlot) : + (CA2_6_8I2R1Terms a).Encloses (Foundation.entropyTerm (CA2_6_8I2R1Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_6_8I2R1Certificates_valid + (CA2_6_8I2R1CertificateIndex a) (CA2_6_8I2R1P_sound a) +def CA2_6_8I2R1Entropy : Ball := ⟨(33502540808053205599377088871 / 50000000000000000000000000000000), (439241 / 2000000000000000000000000000000)⟩ +lemma CA2_6_8I2R1Entropy_sound : CA2_6_8I2R1Entropy.Encloses (Foundation.finiteEntropy CA2_6_8I2R1Value) := by + exact contains_sound (entropyPair_enclosed CA2_6_8I2R1Value CA2_6_8I2R1Terms CA2_6_8I2R1Terms_sound) (by decide +kernel) +def CA2_6_8I2R1Mass : Ball := ⟨(3241019566401678236465874989 / 50000000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ +lemma CA2_6_8I2R1Mass_sound : CA2_6_8I2R1Mass.Encloses (∑ a, CA2_6_8I2R1Value a) := by + exact contains_sound (pairSumBall_sound CA2_6_8I2R1P CA2_6_8I2R1Value CA2_6_8I2R1P_sound) (by decide +kernel) +def CA2_6_8I2R1MassTermLogWitness : LogWitness := ⟨-14, 3241019566401678236465874989, 3051757812500000000000000000⟩ +def CA2_6_8I2R1MassTermLog : Ball := ⟨(-241097258077988760134087428289227 / 25000000000000000000000000000000), (317637416953 / 100000000000000000000000000000000)⟩ +lemma CA2_6_8I2R1MassTermLog_sound : CA2_6_8I2R1MassTermLog.Encloses (Real.log ((∑ a, CA2_6_8I2R1Value a))) := by + exact checkLog_sound logTwoBall_sound (CA2_6_8I2R1Mass_sound) (w := CA2_6_8I2R1MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA2_6_8I2R1MassTerm : Ball := ⟨(12502414893384906351426921547 / 20000000000000000000000000000000), (20589421 / 100000000000000000000000000000000)⟩ +lemma CA2_6_8I2R1MassTerm_sound : CA2_6_8I2R1MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_6_8I2R1Value a))) := by + exact contains_sound (entropyTerm_ball (CA2_6_8I2R1Mass_sound) CA2_6_8I2R1MassTermLog_sound) (by decide +kernel) +def CA2_6_8I2R1H : Ball := ⟨(4493007149181879441619570007 / 100000000000000000000000000000000), (42551471 / 100000000000000000000000000000000)⟩ +lemma CA2_6_8I2R1H_sound : CA2_6_8I2R1H.Encloses (homogeneousEntropy CA2_6_8I2R1Value) := by + exact contains_sound (homogeneous_enclosed CA2_6_8I2R1Value CA2_6_8I2R1MassTerm_sound CA2_6_8I2R1Entropy_sound) (by decide +kernel) +def CA2_6_8I2R2Value (a : PairSlot) : ℝ := residualLaw (below (shape 2 6 8)) (fun u => (stageALaw (shape 2 6 8) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 2 a +def CA2_6_8I2R2Raw (a : PairSlot) : Ball := residualBall (below (shape 2 6 8)) A2_6_8Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 2 a +lemma CA2_6_8I2R2Raw_sound (a : PairSlot) : + (CA2_6_8I2R2Raw a).Encloses (CA2_6_8I2R2Value a) := by + exact residualBall_sound_on (below (shape 2 6 8)) A2_6_8Law (fun u => (stageALaw (shape 2 6 8) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A2_6_8Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 2 6 8) (show (shape 2 6 8) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 2 a +def CA2_6_8I2R2Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(140902655070367662508780278177 / 100000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ ⟨(925005669100461279977077150509 / 100000000000000000000000000000000), (82052573 / 25000000000000000000000000000000)⟩ ⟨(-656485620259254656553045040293771 / 100000000000000000000000000000000), (58233515483 / 25000000000000000000000000000000)⟩ ⟨-10, 140902655070367662508780278177, 97656250000000000000000000000⟩, + .log ⟨(7411802901943689158823834801 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(130695353006720826070060753251 / 100000000000000000000000000000000), (43946299 / 100000000000000000000000000000000)⟩ ⟨(-88167045680914531536555617695763 / 10000000000000000000000000000000), (296461538307 / 100000000000000000000000000000000)⟩ ⟨-13, 7411802901943689158823834801, 6103515625000000000000000000⟩, + .log ⟨(532161634655843941550587720409 / 100000000000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ ⟨(2786386716461794114624242134321 / 100000000000000000000000000000000), (1014206523 / 100000000000000000000000000000000)⟩ ⟨(-523597819723285338506403296232279 / 100000000000000000000000000000000), (95291207137 / 50000000000000000000000000000000)⟩ ⟨-8, 532161634655843941550587720409, 390625000000000000000000000000⟩] +lemma CA2_6_8I2R2Certificates_valid : + CA2_6_8I2R2Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_6_8I2R2CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 2, 0 => 1 + | 3, 0 => 2 + | 1, 1 => 3 + | 0, 2 => 1 + | 0, 3 => 2 + | _, _ => 0 +def CA2_6_8I2R2P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_6_8I2R2Certificates (CA2_6_8I2R2CertificateIndex a)).input +lemma CA2_6_8I2R2P_check : ∀ a : PairSlot, contains (CA2_6_8I2R2Raw a) (CA2_6_8I2R2P a) = true := by + decide +kernel +lemma CA2_6_8I2R2P_sound (a : PairSlot) : + (CA2_6_8I2R2P a).Encloses (CA2_6_8I2R2Value a) := + contains_sound (CA2_6_8I2R2Raw_sound a) (CA2_6_8I2R2P_check a) +def CA2_6_8I2R2Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_6_8I2R2Certificates (CA2_6_8I2R2CertificateIndex a)).output +lemma CA2_6_8I2R2Terms_sound (a : PairSlot) : + (CA2_6_8I2R2Terms a).Encloses (Foundation.entropyTerm (CA2_6_8I2R2Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_6_8I2R2Certificates_valid + (CA2_6_8I2R2CertificateIndex a) (CA2_6_8I2R2P_sound a) +def CA2_6_8I2R2Entropy : Ball := ⟨(4897788760676158326718517941841 / 100000000000000000000000000000000), (351703941 / 20000000000000000000000000000000)⟩ +lemma CA2_6_8I2R2Entropy_sound : CA2_6_8I2R2Entropy.Encloses (Foundation.finiteEntropy CA2_6_8I2R2Value) := by + exact contains_sound (entropyPair_enclosed CA2_6_8I2R2Value CA2_6_8I2R2Terms CA2_6_8I2R2Terms_sound) (by decide +kernel) +def CA2_6_8I2R2Mass : Ball := ⟨(843614156404354023203443615967 / 100000000000000000000000000000000), (3 / 25000000000000000000000000000000)⟩ +lemma CA2_6_8I2R2Mass_sound : CA2_6_8I2R2Mass.Encloses (∑ a, CA2_6_8I2R2Value a) := by + exact contains_sound (pairSumBall_sound CA2_6_8I2R2P CA2_6_8I2R2Value CA2_6_8I2R2P_sound) (by decide +kernel) +def CA2_6_8I2R2MassTermLogWitness : LogWitness := ⟨-7, 843614156404354023203443615967, 781250000000000000000000000000⟩ +def CA2_6_8I2R2MassTermLog : Ball := ⟨(-238761511778120627163225134528117 / 50000000000000000000000000000000), (84703295443 / 50000000000000000000000000000000)⟩ +lemma CA2_6_8I2R2MassTermLog_sound : CA2_6_8I2R2MassTermLog.Encloses (Real.log ((∑ a, CA2_6_8I2R2Value a))) := by + exact checkLog_sound logTwoBall_sound (CA2_6_8I2R2Mass_sound) (w := CA2_6_8I2R2MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA2_6_8I2R2MassTerm : Ball := ⟨(4028451826810549400482286207711 / 100000000000000000000000000000000), (35728451 / 2500000000000000000000000000000)⟩ +lemma CA2_6_8I2R2MassTerm_sound : CA2_6_8I2R2MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_6_8I2R2Value a))) := by + exact contains_sound (entropyTerm_ball (CA2_6_8I2R2Mass_sound) CA2_6_8I2R2MassTermLog_sound) (by decide +kernel) +def CA2_6_8I2R2H : Ball := ⟨(86933693386560892623623173413 / 10000000000000000000000000000000), (637531549 / 20000000000000000000000000000000)⟩ +lemma CA2_6_8I2R2H_sound : CA2_6_8I2R2H.Encloses (homogeneousEntropy CA2_6_8I2R2Value) := by + exact contains_sound (homogeneous_enclosed CA2_6_8I2R2Value CA2_6_8I2R2MassTerm_sound CA2_6_8I2R2Entropy_sound) (by decide +kernel) +def CA2_6_8I2R3Value (a : PairSlot) : ℝ := residualLaw (below (shape 2 6 8)) (fun u => (stageALaw (shape 2 6 8) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 3 a +def CA2_6_8I2R3Raw (a : PairSlot) : Ball := residualBall (below (shape 2 6 8)) A2_6_8Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 3 a +lemma CA2_6_8I2R3Raw_sound (a : PairSlot) : + (CA2_6_8I2R3Raw a).Encloses (CA2_6_8I2R3Value a) := by + exact residualBall_sound_on (below (shape 2 6 8)) A2_6_8Law (fun u => (stageALaw (shape 2 6 8) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A2_6_8Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 2 6 8) (show (shape 2 6 8) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 3 a +def CA2_6_8I2R3Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(109251866670461195107544193847 / 50000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ ⟨(669290303757123260959902370953 / 50000000000000000000000000000000), (18507987 / 4000000000000000000000000000000)⟩ ⟨(-612612236435207375937502711790713 / 100000000000000000000000000000000), (105879119101 / 50000000000000000000000000000000)⟩ ⟨-9, 109251866670461195107544193847, 97656250000000000000000000000⟩, + .log ⟨(3807659390537154766739618738827 / 50000000000000000000000000000000), (1 / 2500000000000000000000000000000)⟩ ⟨(4902377339947084153189162392023 / 25000000000000000000000000000000), (4031516267 / 50000000000000000000000000000000)⟩ ⟨(-64375208456545993095555699119747 / 25000000000000000000000000000000), (105879118939 / 100000000000000000000000000000000)⟩ ⟨-4, 3807659390537154766739618738827, 3125000000000000000000000000000⟩, + .log ⟨(102919505735096066747862988197 / 20000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ ⟨(542338490079643639377028344313 / 20000000000000000000000000000000), (122591551 / 12500000000000000000000000000000)⟩ ⟨(-131738509188813442510258290379967 / 25000000000000000000000000000000), (190582413729 / 100000000000000000000000000000000)⟩ ⟨-8, 102919505735096066747862988197, 78125000000000000000000000000⟩] +lemma CA2_6_8I2R3Certificates_valid : + CA2_6_8I2R3Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_6_8I2R3CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 4, 0 => 1 + | 2, 1 => 2 + | 3, 1 => 3 + | 1, 2 => 2 + | 1, 3 => 3 + | 0, 4 => 1 + | _, _ => 0 +def CA2_6_8I2R3P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_6_8I2R3Certificates (CA2_6_8I2R3CertificateIndex a)).input +lemma CA2_6_8I2R3P_check : ∀ a : PairSlot, contains (CA2_6_8I2R3Raw a) (CA2_6_8I2R3P a) = true := by + decide +kernel +lemma CA2_6_8I2R3P_sound (a : PairSlot) : + (CA2_6_8I2R3P a).Encloses (CA2_6_8I2R3Value a) := + contains_sound (CA2_6_8I2R3Raw_sound a) (CA2_6_8I2R3P_check a) +def CA2_6_8I2R3Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_6_8I2R3Certificates (CA2_6_8I2R3CertificateIndex a)).output +lemma CA2_6_8I2R3Terms_sound (a : PairSlot) : + (CA2_6_8I2R3Terms a).Encloses (Foundation.entropyTerm (CA2_6_8I2R3Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_6_8I2R3Certificates_valid + (CA2_6_8I2R3CertificateIndex a) (CA2_6_8I2R3P_sound a) +def CA2_6_8I2R3Entropy : Ball := ⟨(23659782417700801331561596031563 / 50000000000000000000000000000000), (9506464617 / 50000000000000000000000000000000)⟩ +lemma CA2_6_8I2R3Entropy_sound : CA2_6_8I2R3Entropy.Encloses (Foundation.finiteEntropy CA2_6_8I2R3Value) := by + exact contains_sound (entropyPair_enclosed CA2_6_8I2R3Value CA2_6_8I2R3Terms CA2_6_8I2R3Terms_sound) (by decide +kernel) +def CA2_6_8I2R3Mass : Ball := ⟨(8348420043090712257433640806333 / 50000000000000000000000000000000), (23 / 25000000000000000000000000000000)⟩ +lemma CA2_6_8I2R3Mass_sound : CA2_6_8I2R3Mass.Encloses (∑ a, CA2_6_8I2R3Value a) := by + exact contains_sound (pairSumBall_sound CA2_6_8I2R3P CA2_6_8I2R3Value CA2_6_8I2R3P_sound) (by decide +kernel) +def CA2_6_8I2R3MassTermLogWitness : LogWitness := ⟨-3, 8348420043090712257433640806333, 6250000000000000000000000000000⟩ +def CA2_6_8I2R3MassTermLog : Ball := ⟨(-178995070086538463090810528272429 / 100000000000000000000000000000000), (42351647641 / 50000000000000000000000000000000)⟩ +lemma CA2_6_8I2R3MassTermLog_sound : CA2_6_8I2R3MassTermLog.Encloses (Real.log ((∑ a, CA2_6_8I2R3Value a))) := by + exact checkLog_sound logTwoBall_sound (CA2_6_8I2R3Mass_sound) (w := CA2_6_8I2R3MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA2_6_8I2R3MassTerm : Ball := ⟨(466976884601526405198369062241 / 1562500000000000000000000000000), (7071386963 / 50000000000000000000000000000000)⟩ +lemma CA2_6_8I2R3MassTerm_sound : CA2_6_8I2R3MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_6_8I2R3Value a))) := by + exact contains_sound (entropyTerm_ball (CA2_6_8I2R3Mass_sound) CA2_6_8I2R3MassTermLog_sound) (by decide +kernel) +def CA2_6_8I2R3H : Ball := ⟨(8716522110451956365213786039851 / 50000000000000000000000000000000), (828892579 / 2500000000000000000000000000000)⟩ +lemma CA2_6_8I2R3H_sound : CA2_6_8I2R3H.Encloses (homogeneousEntropy CA2_6_8I2R3Value) := by + exact contains_sound (homogeneous_enclosed CA2_6_8I2R3Value CA2_6_8I2R3MassTerm_sound CA2_6_8I2R3Entropy_sound) (by decide +kernel) +def CA2_6_8I2R4Value (a : PairSlot) : ℝ := residualLaw (below (shape 2 6 8)) (fun u => (stageALaw (shape 2 6 8) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 4 a +def CA2_6_8I2R4Raw (a : PairSlot) : Ball := residualBall (below (shape 2 6 8)) A2_6_8Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 4 a +lemma CA2_6_8I2R4Raw_sound (a : PairSlot) : + (CA2_6_8I2R4Raw a).Encloses (CA2_6_8I2R4Value a) := by + exact residualBall_sound_on (below (shape 2 6 8)) A2_6_8Law (fun u => (stageALaw (shape 2 6 8) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A2_6_8Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 2 6 8) (show (shape 2 6 8) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 4 a +def CA2_6_8I2R4Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(9402550556286229819547189751 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(136218635464807180293186953 / 156250000000000000000000000000), (3733253 / 12500000000000000000000000000000)⟩ ⟨(-231798611918100832579068578755583 / 25000000000000000000000000000000), (7940934147 / 2500000000000000000000000000000)⟩ ⟨-14, 9402550556286229819547189751, 6103515625000000000000000000⟩, + .log ⟨(3543223831892394318588980025187 / 100000000000000000000000000000000), (19 / 100000000000000000000000000000000)⟩ ⟨(5917419753680388482268673928137 / 50000000000000000000000000000000), (4501841071 / 100000000000000000000000000000000)⟩ ⟨(-334013318629095128304943817936191 / 100000000000000000000000000000000), (63527471317 / 50000000000000000000000000000000)⟩ ⟨-5, 3543223831892394318588980025187, 3125000000000000000000000000000⟩, + .log ⟨(9354963093004439840323456078769 / 25000000000000000000000000000000), (31 / 25000000000000000000000000000000)⟩ ⟨(36782547768190548772561755222693 / 100000000000000000000000000000000), (23771886129 / 100000000000000000000000000000000)⟩ ⟨(-98296881031246982051345585706517 / 100000000000000000000000000000000), (3176373569 / 5000000000000000000000000000000)⟩ ⟨-2, 9354963093004439840323456078769, 6250000000000000000000000000000⟩, + .log ⟨(910537380326362943907589992403 / 50000000000000000000000000000000), (7 / 100000000000000000000000000000000)⟩ ⟨(291790323135791516072672677853 / 4000000000000000000000000000000), (2699393099 / 100000000000000000000000000000000)⟩ ⟨(-400574333136116582577552350313507 / 100000000000000000000000000000000), (29646153233 / 20000000000000000000000000000000)⟩ ⟨-6, 910537380326362943907589992403, 781250000000000000000000000000⟩, + .log ⟨(48812956184422649195326386733 / 100000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ ⟨(14887814358139884453910235623 / 4000000000000000000000000000000), (13437511 / 10000000000000000000000000000000)⟩ ⟨(-95311621147080136281874359575383 / 12500000000000000000000000000000), (34410713997 / 12500000000000000000000000000000)⟩ ⟨-12, 48812956184422649195326386733, 24414062500000000000000000000⟩] +lemma CA2_6_8I2R4Certificates_valid : + CA2_6_8I2R4Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_6_8I2R4CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 5, 0 => 1 + | 4, 1 => 2 + | 2, 2 => 3 + | 2, 3 => 4 + | 3, 2 => 4 + | 3, 3 => 5 + | 1, 4 => 2 + | 0, 5 => 1 + | _, _ => 0 +def CA2_6_8I2R4P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_6_8I2R4Certificates (CA2_6_8I2R4CertificateIndex a)).input +lemma CA2_6_8I2R4P_check : ∀ a : PairSlot, contains (CA2_6_8I2R4Raw a) (CA2_6_8I2R4P a) = true := by + decide +kernel +lemma CA2_6_8I2R4P_sound (a : PairSlot) : + (CA2_6_8I2R4P a).Encloses (CA2_6_8I2R4Value a) := + contains_sound (CA2_6_8I2R4Raw_sound a) (CA2_6_8I2R4P_check a) +def CA2_6_8I2R4Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_6_8I2R4Certificates (CA2_6_8I2R4CertificateIndex a)).output +lemma CA2_6_8I2R4Terms_sound (a : PairSlot) : + (CA2_6_8I2R4Terms a).Encloses (Foundation.entropyTerm (CA2_6_8I2R4Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_6_8I2R4Certificates_valid + (CA2_6_8I2R4CertificateIndex a) (CA2_6_8I2R4P_sound a) +def CA2_6_8I2R4Entropy : Ball := ⟨(37794149076025064403696560009153 / 50000000000000000000000000000000), (38368461627 / 100000000000000000000000000000000)⟩ +lemma CA2_6_8I2R4Entropy_sound : CA2_6_8I2R4Entropy.Encloses (Foundation.finiteEntropy CA2_6_8I2R4Value) := by + exact contains_sound (entropyPair_enclosed CA2_6_8I2R4Value CA2_6_8I2R4Terms CA2_6_8I2R4Terms_sound) (by decide +kernel) +def CA2_6_8I2R4Mass : Ball := ⟨(48216067614404994882936565101297 / 100000000000000000000000000000000), (9 / 5000000000000000000000000000000)⟩ +lemma CA2_6_8I2R4Mass_sound : CA2_6_8I2R4Mass.Encloses (∑ a, CA2_6_8I2R4Value a) := by + exact contains_sound (pairSumBall_sound CA2_6_8I2R4P CA2_6_8I2R4Value CA2_6_8I2R4P_sound) (by decide +kernel) +def CA2_6_8I2R4MassTermLogWitness : LogWitness := ⟨-2, 48216067614404994882936565101297, 25000000000000000000000000000000⟩ +def CA2_6_8I2R4MassTermLog : Ball := ⟨(-72947786748534767477246031256031 / 100000000000000000000000000000000), (31763735711 / 50000000000000000000000000000000)⟩ +lemma CA2_6_8I2R4MassTermLog_sound : CA2_6_8I2R4MassTermLog.Encloses (Real.log ((∑ a, CA2_6_8I2R4Value a))) := by + exact checkLog_sound logTwoBall_sound (CA2_6_8I2R4Mass_sound) (w := CA2_6_8I2R4MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA2_6_8I2R4MassTerm : Ball := ⟨(8793138545471372611168418006667 / 25000000000000000000000000000000), (30630448707 / 100000000000000000000000000000000)⟩ +lemma CA2_6_8I2R4MassTerm_sound : CA2_6_8I2R4MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_6_8I2R4Value a))) := by + exact contains_sound (entropyTerm_ball (CA2_6_8I2R4Mass_sound) CA2_6_8I2R4MassTermLog_sound) (by decide +kernel) +def CA2_6_8I2R4H : Ball := ⟨(20207871985082319181359723995819 / 50000000000000000000000000000000), (34499455167 / 50000000000000000000000000000000)⟩ +lemma CA2_6_8I2R4H_sound : CA2_6_8I2R4H.Encloses (homogeneousEntropy CA2_6_8I2R4Value) := by + exact contains_sound (homogeneous_enclosed CA2_6_8I2R4Value CA2_6_8I2R4MassTerm_sound CA2_6_8I2R4Entropy_sound) (by decide +kernel) +def CA2_6_8I2R5Value (a : PairSlot) : ℝ := residualLaw (below (shape 2 6 8)) (fun u => (stageALaw (shape 2 6 8) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 5 a +def CA2_6_8I2R5Raw (a : PairSlot) : Ball := residualBall (below (shape 2 6 8)) A2_6_8Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 5 a +lemma CA2_6_8I2R5Raw_sound (a : PairSlot) : + (CA2_6_8I2R5Raw a).Encloses (CA2_6_8I2R5Value a) := by + exact residualBall_sound_on (below (shape 2 6 8)) A2_6_8Law (fun u => (stageALaw (shape 2 6 8) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A2_6_8Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 2 6 8) (show (shape 2 6 8) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 5 a +def CA2_6_8I2R5Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(6643687772735896558483231589 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(12781469707835433312533761123 / 20000000000000000000000000000000), (4220569 / 20000000000000000000000000000000)⟩ ⟨(-480962913409609787935296114153293 / 50000000000000000000000000000000), (39704671287 / 12500000000000000000000000000000)⟩ ⟨-14, 6643687772735896558483231589, 6103515625000000000000000000⟩, + .log ⟨(4266470274952823916557576969017 / 100000000000000000000000000000000), (1 / 4000000000000000000000000000000)⟩ ⟨(13458082730735454483262644488643 / 100000000000000000000000000000000), (2710380721 / 50000000000000000000000000000000)⟩ ⟨(-157719166704897128747034779156421 / 50000000000000000000000000000000), (127054942683 / 100000000000000000000000000000000)⟩ ⟨-5, 4266470274952823916557576969017, 3125000000000000000000000000000⟩, + .log ⟨(39540563691210857175174239547 / 25000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ ⟨(1020036467046040262648351935589 / 100000000000000000000000000000000), (184206889 / 50000000000000000000000000000000)⟩ ⟨(-644930402998260543013779698531911 / 100000000000000000000000000000000), (232934061777 / 100000000000000000000000000000000)⟩ ⟨-10, 39540563691210857175174239547, 24414062500000000000000000000⟩] +lemma CA2_6_8I2R5Certificates_valid : + CA2_6_8I2R5Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_6_8I2R5CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 5, 1 => 1 + | 4, 2 => 2 + | 4, 3 => 3 + | 2, 4 => 2 + | 3, 4 => 3 + | 1, 5 => 1 + | _, _ => 0 +def CA2_6_8I2R5P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_6_8I2R5Certificates (CA2_6_8I2R5CertificateIndex a)).input +lemma CA2_6_8I2R5P_check : ∀ a : PairSlot, contains (CA2_6_8I2R5Raw a) (CA2_6_8I2R5P a) = true := by + decide +kernel +lemma CA2_6_8I2R5P_sound (a : PairSlot) : + (CA2_6_8I2R5P a).Encloses (CA2_6_8I2R5Value a) := + contains_sound (CA2_6_8I2R5Raw_sound a) (CA2_6_8I2R5P_check a) +def CA2_6_8I2R5Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_6_8I2R5Certificates (CA2_6_8I2R5CertificateIndex a)).output +lemma CA2_6_8I2R5Terms_sound (a : PairSlot) : + (CA2_6_8I2R5Terms a).Encloses (Foundation.entropyTerm (CA2_6_8I2R5Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_6_8I2R5Certificates_valid + (CA2_6_8I2R5CertificateIndex a) (CA2_6_8I2R5P_sound a) +def CA2_6_8I2R5Entropy : Ball := ⟨(14542026546320671912473665229847 / 50000000000000000000000000000000), (1162055613 / 10000000000000000000000000000000)⟩ +lemma CA2_6_8I2R5Entropy_sound : CA2_6_8I2R5Entropy.Encloses (Foundation.finiteEntropy CA2_6_8I2R5Value) := by + exact contains_sound (entropyPair_enclosed CA2_6_8I2R5Value CA2_6_8I2R5Terms CA2_6_8I2R5Terms_sound) (by decide +kernel) +def CA2_6_8I2R5Mass : Ball := ⟨(2215638108745201620908378579397 / 25000000000000000000000000000000), (7 / 12500000000000000000000000000000)⟩ +lemma CA2_6_8I2R5Mass_sound : CA2_6_8I2R5Mass.Encloses (∑ a, CA2_6_8I2R5Value a) := by + exact contains_sound (pairSumBall_sound CA2_6_8I2R5P CA2_6_8I2R5Value CA2_6_8I2R5P_sound) (by decide +kernel) +def CA2_6_8I2R5MassTermLogWitness : LogWitness := ⟨-4, 2215638108745201620908378579397, 1562500000000000000000000000000⟩ +def CA2_6_8I2R5MassTermLog : Ball := ⟨(-242333537764739794209388441775203 / 100000000000000000000000000000000), (52939559523 / 50000000000000000000000000000000)⟩ +lemma CA2_6_8I2R5MassTermLog_sound : CA2_6_8I2R5MassTermLog.Encloses (Real.log ((∑ a, CA2_6_8I2R5Value a))) := by + exact checkLog_sound logTwoBall_sound (CA2_6_8I2R5Mass_sound) (w := CA2_6_8I2R5MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA2_6_8I2R5MassTerm : Ball := ⟨(21476936851944078875885785250807 / 100000000000000000000000000000000), (469179629 / 5000000000000000000000000000000)⟩ +lemma CA2_6_8I2R5MassTerm_sound : CA2_6_8I2R5MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_6_8I2R5Value a))) := by + exact contains_sound (entropyTerm_ball (CA2_6_8I2R5Mass_sound) CA2_6_8I2R5MassTermLog_sound) (by decide +kernel) +def CA2_6_8I2R5H : Ball := ⟨(7607116240697264949061545208887 / 100000000000000000000000000000000), (2100414871 / 10000000000000000000000000000000)⟩ +lemma CA2_6_8I2R5H_sound : CA2_6_8I2R5H.Encloses (homogeneousEntropy CA2_6_8I2R5Value) := by + exact contains_sound (homogeneous_enclosed CA2_6_8I2R5Value CA2_6_8I2R5MassTerm_sound CA2_6_8I2R5Entropy_sound) (by decide +kernel) +def CA2_6_8I2R6Value (a : PairSlot) : ℝ := residualLaw (below (shape 2 6 8)) (fun u => (stageALaw (shape 2 6 8) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 6 a +def CA2_6_8I2R6Raw (a : PairSlot) : Ball := residualBall (below (shape 2 6 8)) A2_6_8Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 6 a +lemma CA2_6_8I2R6Raw_sound (a : PairSlot) : + (CA2_6_8I2R6Raw a).Encloses (CA2_6_8I2R6Value a) := by + exact residualBall_sound_on (below (shape 2 6 8)) A2_6_8Law (fun u => (stageALaw (shape 2 6 8) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A2_6_8Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 2 6 8) (show (shape 2 6 8) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 6 a +def CA2_6_8I2R6Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(1879330769378702376110481489 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(10225447854657892196457485831 / 50000000000000000000000000000000), (6765397 / 100000000000000000000000000000000)⟩ ⟨(-544100486261839664827794617986551 / 50000000000000000000000000000000), (359989055821 / 100000000000000000000000000000000)⟩ ⟨-16, 1879330769378702376110481489, 1525878906250000000000000000⟩, + .log ⟨(59202649002316270772539 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(608435171846847114190571 / 25000000000000000000000000000000), (799 / 100000000000000000000000000000000)⟩ ⟨(-256929031935311891997869421170823 / 12500000000000000000000000000000), (20540471593 / 3125000000000000000000000000000)⟩ ⟨-30, 59202649002316270772539, 46566128730773925781250⟩, + .log ⟨(98531741176814041209907022063 / 50000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ ⟨(1227587166855035938190084268841 / 100000000000000000000000000000000), (208649089 / 50000000000000000000000000000000)⟩ ⟨(-311469977134613231710011141363691 / 50000000000000000000000000000000), (211758238351 / 100000000000000000000000000000000)⟩ ⟨-9, 98531741176814041209907022063, 97656250000000000000000000000⟩] +lemma CA2_6_8I2R6Certificates_valid : + CA2_6_8I2R6Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_6_8I2R6CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 5, 2 => 1 + | 5, 3 => 2 + | 4, 4 => 3 + | 2, 5 => 1 + | 3, 5 => 2 + | _, _ => 0 +def CA2_6_8I2R6P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_6_8I2R6Certificates (CA2_6_8I2R6CertificateIndex a)).input +lemma CA2_6_8I2R6P_check : ∀ a : PairSlot, contains (CA2_6_8I2R6Raw a) (CA2_6_8I2R6P a) = true := by + decide +kernel +lemma CA2_6_8I2R6P_sound (a : PairSlot) : + (CA2_6_8I2R6P a).Encloses (CA2_6_8I2R6Value a) := + contains_sound (CA2_6_8I2R6Raw_sound a) (CA2_6_8I2R6P_check a) +def CA2_6_8I2R6Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_6_8I2R6Certificates (CA2_6_8I2R6CertificateIndex a)).output +lemma CA2_6_8I2R6Terms_sound (a : PairSlot) : + (CA2_6_8I2R6Terms a).Encloses (Foundation.entropyTerm (CA2_6_8I2R6Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_6_8I2R6Certificates_valid + (CA2_6_8I2R6CertificateIndex a) (CA2_6_8I2R6P_sound a) +def CA2_6_8I2R6Entropy : Ball := ⟨(1268493825755042281752827736733 / 100000000000000000000000000000000), (43083057 / 10000000000000000000000000000000)⟩ +lemma CA2_6_8I2R6Entropy_sound : CA2_6_8I2R6Entropy.Encloses (Foundation.finiteEntropy CA2_6_8I2R6Value) := by + exact contains_sound (entropyPair_enclosed CA2_6_8I2R6Value CA2_6_8I2R6Terms CA2_6_8I2R6Terms_sound) (by decide +kernel) +def CA2_6_8I2R6Mass : Ball := ⟨(10041119035149074821855904863 / 5000000000000000000000000000000), (7 / 100000000000000000000000000000000)⟩ +lemma CA2_6_8I2R6Mass_sound : CA2_6_8I2R6Mass.Encloses (∑ a, CA2_6_8I2R6Value a) := by + exact contains_sound (pairSumBall_sound CA2_6_8I2R6P CA2_6_8I2R6Value CA2_6_8I2R6P_sound) (by decide +kernel) +def CA2_6_8I2R6MassTermLogWitness : LogWitness := ⟨-9, 10041119035149074821855904863, 9765625000000000000000000000⟩ +def CA2_6_8I2R6MassTermLog : Ball := ⟨(-155262615641985741754365944816713 / 25000000000000000000000000000000), (42351648063 / 20000000000000000000000000000000)⟩ +lemma CA2_6_8I2R6MassTermLog_sound : CA2_6_8I2R6MassTermLog.Encloses (Real.log ((∑ a, CA2_6_8I2R6Value a))) := by + exact checkLog_sound logTwoBall_sound (CA2_6_8I2R6Mass_sound) (w := CA2_6_8I2R6MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA2_6_8I2R6MassTerm : Ball := ⟨(1247208324295822018796855228129 / 100000000000000000000000000000000), (415291 / 97656250000000000000000000000)⟩ +lemma CA2_6_8I2R6MassTerm_sound : CA2_6_8I2R6MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_6_8I2R6Value a))) := by + exact contains_sound (entropyTerm_ball (CA2_6_8I2R6Mass_sound) CA2_6_8I2R6MassTermLog_sound) (by decide +kernel) +def CA2_6_8I2R6H : Ball := ⟨(5321375364805065738993127151 / 25000000000000000000000000000000), (428044277 / 50000000000000000000000000000000)⟩ +lemma CA2_6_8I2R6H_sound : CA2_6_8I2R6H.Encloses (homogeneousEntropy CA2_6_8I2R6Value) := by + exact contains_sound (homogeneous_enclosed CA2_6_8I2R6Value CA2_6_8I2R6MassTerm_sound CA2_6_8I2R6Entropy_sound) (by decide +kernel) +def CA2_6_8I2R7Value (a : PairSlot) : ℝ := residualLaw (below (shape 2 6 8)) (fun u => (stageALaw (shape 2 6 8) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 7 a +def CA2_6_8I2R7Raw (a : PairSlot) : Ball := residualBall (below (shape 2 6 8)) A2_6_8Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 7 a +lemma CA2_6_8I2R7Raw_sound (a : PairSlot) : + (CA2_6_8I2R7Raw a).Encloses (CA2_6_8I2R7Value a) := by + exact residualBall_sound_on (below (shape 2 6 8)) A2_6_8Law (fun u => (stageALaw (shape 2 6 8) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A2_6_8Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 2 6 8) (show (shape 2 6 8) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 7 a +def CA2_6_8I2R7Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA2_6_8I2R7Certificates_valid : + CA2_6_8I2R7Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_6_8I2R7CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA2_6_8I2R7P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_6_8I2R7Certificates (CA2_6_8I2R7CertificateIndex a)).input +lemma CA2_6_8I2R7P_check : ∀ a : PairSlot, contains (CA2_6_8I2R7Raw a) (CA2_6_8I2R7P a) = true := by + decide +kernel +lemma CA2_6_8I2R7P_sound (a : PairSlot) : + (CA2_6_8I2R7P a).Encloses (CA2_6_8I2R7Value a) := + contains_sound (CA2_6_8I2R7Raw_sound a) (CA2_6_8I2R7P_check a) +def CA2_6_8I2R7Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_6_8I2R7Certificates (CA2_6_8I2R7CertificateIndex a)).output +lemma CA2_6_8I2R7Terms_sound (a : PairSlot) : + (CA2_6_8I2R7Terms a).Encloses (Foundation.entropyTerm (CA2_6_8I2R7Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_6_8I2R7Certificates_valid + (CA2_6_8I2R7CertificateIndex a) (CA2_6_8I2R7P_sound a) +def CA2_6_8I2R7Entropy : Ball := ⟨0, 0⟩ +lemma CA2_6_8I2R7Entropy_sound : CA2_6_8I2R7Entropy.Encloses (Foundation.finiteEntropy CA2_6_8I2R7Value) := by + exact contains_sound (entropyPair_enclosed CA2_6_8I2R7Value CA2_6_8I2R7Terms CA2_6_8I2R7Terms_sound) (by decide +kernel) +def CA2_6_8I2R7Mass : Ball := ⟨0, 0⟩ +lemma CA2_6_8I2R7Mass_sound : CA2_6_8I2R7Mass.Encloses (∑ a, CA2_6_8I2R7Value a) := by + exact contains_sound (pairSumBall_sound CA2_6_8I2R7P CA2_6_8I2R7Value CA2_6_8I2R7P_sound) (by decide +kernel) +def CA2_6_8I2R7MassTerm : Ball := .exact 0 +lemma CA2_6_8I2R7MassTerm_sound : CA2_6_8I2R7MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_6_8I2R7Value a))) := + entropyTerm_zero_ball (CA2_6_8I2R7Mass_sound) +def CA2_6_8I2R7H : Ball := ⟨0, 0⟩ +lemma CA2_6_8I2R7H_sound : CA2_6_8I2R7H.Encloses (homogeneousEntropy CA2_6_8I2R7Value) := by + exact contains_sound (homogeneous_enclosed CA2_6_8I2R7Value CA2_6_8I2R7MassTerm_sound CA2_6_8I2R7Entropy_sound) (by decide +kernel) +def CA2_6_8I2R8Value (a : PairSlot) : ℝ := residualLaw (below (shape 2 6 8)) (fun u => (stageALaw (shape 2 6 8) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 8 a +def CA2_6_8I2R8Raw (a : PairSlot) : Ball := residualBall (below (shape 2 6 8)) A2_6_8Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 8 a +lemma CA2_6_8I2R8Raw_sound (a : PairSlot) : + (CA2_6_8I2R8Raw a).Encloses (CA2_6_8I2R8Value a) := by + exact residualBall_sound_on (below (shape 2 6 8)) A2_6_8Law (fun u => (stageALaw (shape 2 6 8) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A2_6_8Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 2 6 8) (show (shape 2 6 8) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 8 a +def CA2_6_8I2R8Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA2_6_8I2R8Certificates_valid : + CA2_6_8I2R8Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_6_8I2R8CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA2_6_8I2R8P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_6_8I2R8Certificates (CA2_6_8I2R8CertificateIndex a)).input +lemma CA2_6_8I2R8P_check : ∀ a : PairSlot, contains (CA2_6_8I2R8Raw a) (CA2_6_8I2R8P a) = true := by + decide +kernel +lemma CA2_6_8I2R8P_sound (a : PairSlot) : + (CA2_6_8I2R8P a).Encloses (CA2_6_8I2R8Value a) := + contains_sound (CA2_6_8I2R8Raw_sound a) (CA2_6_8I2R8P_check a) +def CA2_6_8I2R8Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_6_8I2R8Certificates (CA2_6_8I2R8CertificateIndex a)).output +lemma CA2_6_8I2R8Terms_sound (a : PairSlot) : + (CA2_6_8I2R8Terms a).Encloses (Foundation.entropyTerm (CA2_6_8I2R8Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_6_8I2R8Certificates_valid + (CA2_6_8I2R8CertificateIndex a) (CA2_6_8I2R8P_sound a) +def CA2_6_8I2R8Entropy : Ball := ⟨0, 0⟩ +lemma CA2_6_8I2R8Entropy_sound : CA2_6_8I2R8Entropy.Encloses (Foundation.finiteEntropy CA2_6_8I2R8Value) := by + exact contains_sound (entropyPair_enclosed CA2_6_8I2R8Value CA2_6_8I2R8Terms CA2_6_8I2R8Terms_sound) (by decide +kernel) +def CA2_6_8I2R8Mass : Ball := ⟨0, 0⟩ +lemma CA2_6_8I2R8Mass_sound : CA2_6_8I2R8Mass.Encloses (∑ a, CA2_6_8I2R8Value a) := by + exact contains_sound (pairSumBall_sound CA2_6_8I2R8P CA2_6_8I2R8Value CA2_6_8I2R8P_sound) (by decide +kernel) +def CA2_6_8I2R8MassTerm : Ball := .exact 0 +lemma CA2_6_8I2R8MassTerm_sound : CA2_6_8I2R8MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_6_8I2R8Value a))) := + entropyTerm_zero_ball (CA2_6_8I2R8Mass_sound) +def CA2_6_8I2R8H : Ball := ⟨0, 0⟩ +lemma CA2_6_8I2R8H_sound : CA2_6_8I2R8H.Encloses (homogeneousEntropy CA2_6_8I2R8Value) := by + exact contains_sound (homogeneous_enclosed CA2_6_8I2R8Value CA2_6_8I2R8MassTerm_sound CA2_6_8I2R8Entropy_sound) (by decide +kernel) +def CA2_6_8I2R9Value (a : PairSlot) : ℝ := residualLaw (below (shape 2 6 8)) (fun u => (stageALaw (shape 2 6 8) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 9 a +def CA2_6_8I2R9Raw (a : PairSlot) : Ball := residualBall (below (shape 2 6 8)) A2_6_8Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 9 a +lemma CA2_6_8I2R9Raw_sound (a : PairSlot) : + (CA2_6_8I2R9Raw a).Encloses (CA2_6_8I2R9Value a) := by + exact residualBall_sound_on (below (shape 2 6 8)) A2_6_8Law (fun u => (stageALaw (shape 2 6 8) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A2_6_8Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 2 6 8) (show (shape 2 6 8) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 9 a +def CA2_6_8I2R9Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA2_6_8I2R9Certificates_valid : + CA2_6_8I2R9Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_6_8I2R9CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA2_6_8I2R9P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_6_8I2R9Certificates (CA2_6_8I2R9CertificateIndex a)).input +lemma CA2_6_8I2R9P_check : ∀ a : PairSlot, contains (CA2_6_8I2R9Raw a) (CA2_6_8I2R9P a) = true := by + decide +kernel +lemma CA2_6_8I2R9P_sound (a : PairSlot) : + (CA2_6_8I2R9P a).Encloses (CA2_6_8I2R9Value a) := + contains_sound (CA2_6_8I2R9Raw_sound a) (CA2_6_8I2R9P_check a) +def CA2_6_8I2R9Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_6_8I2R9Certificates (CA2_6_8I2R9CertificateIndex a)).output +lemma CA2_6_8I2R9Terms_sound (a : PairSlot) : + (CA2_6_8I2R9Terms a).Encloses (Foundation.entropyTerm (CA2_6_8I2R9Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_6_8I2R9Certificates_valid + (CA2_6_8I2R9CertificateIndex a) (CA2_6_8I2R9P_sound a) +def CA2_6_8I2R9Entropy : Ball := ⟨0, 0⟩ +lemma CA2_6_8I2R9Entropy_sound : CA2_6_8I2R9Entropy.Encloses (Foundation.finiteEntropy CA2_6_8I2R9Value) := by + exact contains_sound (entropyPair_enclosed CA2_6_8I2R9Value CA2_6_8I2R9Terms CA2_6_8I2R9Terms_sound) (by decide +kernel) +def CA2_6_8I2R9Mass : Ball := ⟨0, 0⟩ +lemma CA2_6_8I2R9Mass_sound : CA2_6_8I2R9Mass.Encloses (∑ a, CA2_6_8I2R9Value a) := by + exact contains_sound (pairSumBall_sound CA2_6_8I2R9P CA2_6_8I2R9Value CA2_6_8I2R9P_sound) (by decide +kernel) +def CA2_6_8I2R9MassTerm : Ball := .exact 0 +lemma CA2_6_8I2R9MassTerm_sound : CA2_6_8I2R9MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_6_8I2R9Value a))) := + entropyTerm_zero_ball (CA2_6_8I2R9Mass_sound) +def CA2_6_8I2R9H : Ball := ⟨0, 0⟩ +lemma CA2_6_8I2R9H_sound : CA2_6_8I2R9H.Encloses (homogeneousEntropy CA2_6_8I2R9Value) := by + exact contains_sound (homogeneous_enclosed CA2_6_8I2R9Value CA2_6_8I2R9MassTerm_sound CA2_6_8I2R9Entropy_sound) (by decide +kernel) +def CA2_6_8I2R10Value (a : PairSlot) : ℝ := residualLaw (below (shape 2 6 8)) (fun u => (stageALaw (shape 2 6 8) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 10 a +def CA2_6_8I2R10Raw (a : PairSlot) : Ball := residualBall (below (shape 2 6 8)) A2_6_8Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 10 a +lemma CA2_6_8I2R10Raw_sound (a : PairSlot) : + (CA2_6_8I2R10Raw a).Encloses (CA2_6_8I2R10Value a) := by + exact residualBall_sound_on (below (shape 2 6 8)) A2_6_8Law (fun u => (stageALaw (shape 2 6 8) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A2_6_8Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 2 6 8) (show (shape 2 6 8) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 10 a +def CA2_6_8I2R10Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA2_6_8I2R10Certificates_valid : + CA2_6_8I2R10Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_6_8I2R10CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA2_6_8I2R10P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_6_8I2R10Certificates (CA2_6_8I2R10CertificateIndex a)).input +lemma CA2_6_8I2R10P_check : ∀ a : PairSlot, contains (CA2_6_8I2R10Raw a) (CA2_6_8I2R10P a) = true := by + decide +kernel +lemma CA2_6_8I2R10P_sound (a : PairSlot) : + (CA2_6_8I2R10P a).Encloses (CA2_6_8I2R10Value a) := + contains_sound (CA2_6_8I2R10Raw_sound a) (CA2_6_8I2R10P_check a) +def CA2_6_8I2R10Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_6_8I2R10Certificates (CA2_6_8I2R10CertificateIndex a)).output +lemma CA2_6_8I2R10Terms_sound (a : PairSlot) : + (CA2_6_8I2R10Terms a).Encloses (Foundation.entropyTerm (CA2_6_8I2R10Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_6_8I2R10Certificates_valid + (CA2_6_8I2R10CertificateIndex a) (CA2_6_8I2R10P_sound a) +def CA2_6_8I2R10Entropy : Ball := ⟨0, 0⟩ +lemma CA2_6_8I2R10Entropy_sound : CA2_6_8I2R10Entropy.Encloses (Foundation.finiteEntropy CA2_6_8I2R10Value) := by + exact contains_sound (entropyPair_enclosed CA2_6_8I2R10Value CA2_6_8I2R10Terms CA2_6_8I2R10Terms_sound) (by decide +kernel) +def CA2_6_8I2R10Mass : Ball := ⟨0, 0⟩ +lemma CA2_6_8I2R10Mass_sound : CA2_6_8I2R10Mass.Encloses (∑ a, CA2_6_8I2R10Value a) := by + exact contains_sound (pairSumBall_sound CA2_6_8I2R10P CA2_6_8I2R10Value CA2_6_8I2R10P_sound) (by decide +kernel) +def CA2_6_8I2R10MassTerm : Ball := .exact 0 +lemma CA2_6_8I2R10MassTerm_sound : CA2_6_8I2R10MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_6_8I2R10Value a))) := + entropyTerm_zero_ball (CA2_6_8I2R10Mass_sound) +def CA2_6_8I2R10H : Ball := ⟨0, 0⟩ +lemma CA2_6_8I2R10H_sound : CA2_6_8I2R10H.Encloses (homogeneousEntropy CA2_6_8I2R10Value) := by + exact contains_sound (homogeneous_enclosed CA2_6_8I2R10Value CA2_6_8I2R10MassTerm_sound CA2_6_8I2R10Entropy_sound) (by decide +kernel) +def CA2_6_8I2R11Value (a : PairSlot) : ℝ := residualLaw (below (shape 2 6 8)) (fun u => (stageALaw (shape 2 6 8) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 11 a +def CA2_6_8I2R11Raw (a : PairSlot) : Ball := residualBall (below (shape 2 6 8)) A2_6_8Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 11 a +lemma CA2_6_8I2R11Raw_sound (a : PairSlot) : + (CA2_6_8I2R11Raw a).Encloses (CA2_6_8I2R11Value a) := by + exact residualBall_sound_on (below (shape 2 6 8)) A2_6_8Law (fun u => (stageALaw (shape 2 6 8) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A2_6_8Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 2 6 8) (show (shape 2 6 8) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 11 a +def CA2_6_8I2R11Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA2_6_8I2R11Certificates_valid : + CA2_6_8I2R11Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_6_8I2R11CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA2_6_8I2R11P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_6_8I2R11Certificates (CA2_6_8I2R11CertificateIndex a)).input +lemma CA2_6_8I2R11P_check : ∀ a : PairSlot, contains (CA2_6_8I2R11Raw a) (CA2_6_8I2R11P a) = true := by + decide +kernel +lemma CA2_6_8I2R11P_sound (a : PairSlot) : + (CA2_6_8I2R11P a).Encloses (CA2_6_8I2R11Value a) := + contains_sound (CA2_6_8I2R11Raw_sound a) (CA2_6_8I2R11P_check a) +def CA2_6_8I2R11Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_6_8I2R11Certificates (CA2_6_8I2R11CertificateIndex a)).output +lemma CA2_6_8I2R11Terms_sound (a : PairSlot) : + (CA2_6_8I2R11Terms a).Encloses (Foundation.entropyTerm (CA2_6_8I2R11Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_6_8I2R11Certificates_valid + (CA2_6_8I2R11CertificateIndex a) (CA2_6_8I2R11P_sound a) +def CA2_6_8I2R11Entropy : Ball := ⟨0, 0⟩ +lemma CA2_6_8I2R11Entropy_sound : CA2_6_8I2R11Entropy.Encloses (Foundation.finiteEntropy CA2_6_8I2R11Value) := by + exact contains_sound (entropyPair_enclosed CA2_6_8I2R11Value CA2_6_8I2R11Terms CA2_6_8I2R11Terms_sound) (by decide +kernel) +def CA2_6_8I2R11Mass : Ball := ⟨0, 0⟩ +lemma CA2_6_8I2R11Mass_sound : CA2_6_8I2R11Mass.Encloses (∑ a, CA2_6_8I2R11Value a) := by + exact contains_sound (pairSumBall_sound CA2_6_8I2R11P CA2_6_8I2R11Value CA2_6_8I2R11P_sound) (by decide +kernel) +def CA2_6_8I2R11MassTerm : Ball := .exact 0 +lemma CA2_6_8I2R11MassTerm_sound : CA2_6_8I2R11MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_6_8I2R11Value a))) := + entropyTerm_zero_ball (CA2_6_8I2R11Mass_sound) +def CA2_6_8I2R11H : Ball := ⟨0, 0⟩ +lemma CA2_6_8I2R11H_sound : CA2_6_8I2R11H.Encloses (homogeneousEntropy CA2_6_8I2R11Value) := by + exact contains_sound (homogeneous_enclosed CA2_6_8I2R11Value CA2_6_8I2R11MassTerm_sound CA2_6_8I2R11Entropy_sound) (by decide +kernel) +def CA2_6_8I2R12Value (a : PairSlot) : ℝ := residualLaw (below (shape 2 6 8)) (fun u => (stageALaw (shape 2 6 8) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 12 a +def CA2_6_8I2R12Raw (a : PairSlot) : Ball := residualBall (below (shape 2 6 8)) A2_6_8Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 12 a +lemma CA2_6_8I2R12Raw_sound (a : PairSlot) : + (CA2_6_8I2R12Raw a).Encloses (CA2_6_8I2R12Value a) := by + exact residualBall_sound_on (below (shape 2 6 8)) A2_6_8Law (fun u => (stageALaw (shape 2 6 8) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A2_6_8Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 2 6 8) (show (shape 2 6 8) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 12 a +def CA2_6_8I2R12Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA2_6_8I2R12Certificates_valid : + CA2_6_8I2R12Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_6_8I2R12CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA2_6_8I2R12P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_6_8I2R12Certificates (CA2_6_8I2R12CertificateIndex a)).input +lemma CA2_6_8I2R12P_check : ∀ a : PairSlot, contains (CA2_6_8I2R12Raw a) (CA2_6_8I2R12P a) = true := by + decide +kernel +lemma CA2_6_8I2R12P_sound (a : PairSlot) : + (CA2_6_8I2R12P a).Encloses (CA2_6_8I2R12Value a) := + contains_sound (CA2_6_8I2R12Raw_sound a) (CA2_6_8I2R12P_check a) +def CA2_6_8I2R12Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_6_8I2R12Certificates (CA2_6_8I2R12CertificateIndex a)).output +lemma CA2_6_8I2R12Terms_sound (a : PairSlot) : + (CA2_6_8I2R12Terms a).Encloses (Foundation.entropyTerm (CA2_6_8I2R12Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_6_8I2R12Certificates_valid + (CA2_6_8I2R12CertificateIndex a) (CA2_6_8I2R12P_sound a) +def CA2_6_8I2R12Entropy : Ball := ⟨0, 0⟩ +lemma CA2_6_8I2R12Entropy_sound : CA2_6_8I2R12Entropy.Encloses (Foundation.finiteEntropy CA2_6_8I2R12Value) := by + exact contains_sound (entropyPair_enclosed CA2_6_8I2R12Value CA2_6_8I2R12Terms CA2_6_8I2R12Terms_sound) (by decide +kernel) +def CA2_6_8I2R12Mass : Ball := ⟨0, 0⟩ +lemma CA2_6_8I2R12Mass_sound : CA2_6_8I2R12Mass.Encloses (∑ a, CA2_6_8I2R12Value a) := by + exact contains_sound (pairSumBall_sound CA2_6_8I2R12P CA2_6_8I2R12Value CA2_6_8I2R12P_sound) (by decide +kernel) +def CA2_6_8I2R12MassTerm : Ball := .exact 0 +lemma CA2_6_8I2R12MassTerm_sound : CA2_6_8I2R12MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_6_8I2R12Value a))) := + entropyTerm_zero_ball (CA2_6_8I2R12Mass_sound) +def CA2_6_8I2R12H : Ball := ⟨0, 0⟩ +lemma CA2_6_8I2R12H_sound : CA2_6_8I2R12H.Encloses (homogeneousEntropy CA2_6_8I2R12Value) := by + exact contains_sound (homogeneous_enclosed CA2_6_8I2R12Value CA2_6_8I2R12MassTerm_sound CA2_6_8I2R12Entropy_sound) (by decide +kernel) +def CA2_6_8I2R13Value (a : PairSlot) : ℝ := residualLaw (below (shape 2 6 8)) (fun u => (stageALaw (shape 2 6 8) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 13 a +def CA2_6_8I2R13Raw (a : PairSlot) : Ball := residualBall (below (shape 2 6 8)) A2_6_8Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 13 a +lemma CA2_6_8I2R13Raw_sound (a : PairSlot) : + (CA2_6_8I2R13Raw a).Encloses (CA2_6_8I2R13Value a) := by + exact residualBall_sound_on (below (shape 2 6 8)) A2_6_8Law (fun u => (stageALaw (shape 2 6 8) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A2_6_8Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 2 6 8) (show (shape 2 6 8) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 13 a +def CA2_6_8I2R13Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA2_6_8I2R13Certificates_valid : + CA2_6_8I2R13Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_6_8I2R13CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA2_6_8I2R13P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_6_8I2R13Certificates (CA2_6_8I2R13CertificateIndex a)).input +lemma CA2_6_8I2R13P_check : ∀ a : PairSlot, contains (CA2_6_8I2R13Raw a) (CA2_6_8I2R13P a) = true := by + decide +kernel +lemma CA2_6_8I2R13P_sound (a : PairSlot) : + (CA2_6_8I2R13P a).Encloses (CA2_6_8I2R13Value a) := + contains_sound (CA2_6_8I2R13Raw_sound a) (CA2_6_8I2R13P_check a) +def CA2_6_8I2R13Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_6_8I2R13Certificates (CA2_6_8I2R13CertificateIndex a)).output +lemma CA2_6_8I2R13Terms_sound (a : PairSlot) : + (CA2_6_8I2R13Terms a).Encloses (Foundation.entropyTerm (CA2_6_8I2R13Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_6_8I2R13Certificates_valid + (CA2_6_8I2R13CertificateIndex a) (CA2_6_8I2R13P_sound a) +def CA2_6_8I2R13Entropy : Ball := ⟨0, 0⟩ +lemma CA2_6_8I2R13Entropy_sound : CA2_6_8I2R13Entropy.Encloses (Foundation.finiteEntropy CA2_6_8I2R13Value) := by + exact contains_sound (entropyPair_enclosed CA2_6_8I2R13Value CA2_6_8I2R13Terms CA2_6_8I2R13Terms_sound) (by decide +kernel) +def CA2_6_8I2R13Mass : Ball := ⟨0, 0⟩ +lemma CA2_6_8I2R13Mass_sound : CA2_6_8I2R13Mass.Encloses (∑ a, CA2_6_8I2R13Value a) := by + exact contains_sound (pairSumBall_sound CA2_6_8I2R13P CA2_6_8I2R13Value CA2_6_8I2R13P_sound) (by decide +kernel) +def CA2_6_8I2R13MassTerm : Ball := .exact 0 +lemma CA2_6_8I2R13MassTerm_sound : CA2_6_8I2R13MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_6_8I2R13Value a))) := + entropyTerm_zero_ball (CA2_6_8I2R13Mass_sound) +def CA2_6_8I2R13H : Ball := ⟨0, 0⟩ +lemma CA2_6_8I2R13H_sound : CA2_6_8I2R13H.Encloses (homogeneousEntropy CA2_6_8I2R13Value) := by + exact contains_sound (homogeneous_enclosed CA2_6_8I2R13Value CA2_6_8I2R13MassTerm_sound CA2_6_8I2R13Entropy_sound) (by decide +kernel) +def CA2_6_8I2R14Value (a : PairSlot) : ℝ := residualLaw (below (shape 2 6 8)) (fun u => (stageALaw (shape 2 6 8) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 14 a +def CA2_6_8I2R14Raw (a : PairSlot) : Ball := residualBall (below (shape 2 6 8)) A2_6_8Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 14 a +lemma CA2_6_8I2R14Raw_sound (a : PairSlot) : + (CA2_6_8I2R14Raw a).Encloses (CA2_6_8I2R14Value a) := by + exact residualBall_sound_on (below (shape 2 6 8)) A2_6_8Law (fun u => (stageALaw (shape 2 6 8) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A2_6_8Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 2 6 8) (show (shape 2 6 8) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 14 a +def CA2_6_8I2R14Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA2_6_8I2R14Certificates_valid : + CA2_6_8I2R14Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_6_8I2R14CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA2_6_8I2R14P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_6_8I2R14Certificates (CA2_6_8I2R14CertificateIndex a)).input +lemma CA2_6_8I2R14P_check : ∀ a : PairSlot, contains (CA2_6_8I2R14Raw a) (CA2_6_8I2R14P a) = true := by + decide +kernel +lemma CA2_6_8I2R14P_sound (a : PairSlot) : + (CA2_6_8I2R14P a).Encloses (CA2_6_8I2R14Value a) := + contains_sound (CA2_6_8I2R14Raw_sound a) (CA2_6_8I2R14P_check a) +def CA2_6_8I2R14Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_6_8I2R14Certificates (CA2_6_8I2R14CertificateIndex a)).output +lemma CA2_6_8I2R14Terms_sound (a : PairSlot) : + (CA2_6_8I2R14Terms a).Encloses (Foundation.entropyTerm (CA2_6_8I2R14Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_6_8I2R14Certificates_valid + (CA2_6_8I2R14CertificateIndex a) (CA2_6_8I2R14P_sound a) +def CA2_6_8I2R14Entropy : Ball := ⟨0, 0⟩ +lemma CA2_6_8I2R14Entropy_sound : CA2_6_8I2R14Entropy.Encloses (Foundation.finiteEntropy CA2_6_8I2R14Value) := by + exact contains_sound (entropyPair_enclosed CA2_6_8I2R14Value CA2_6_8I2R14Terms CA2_6_8I2R14Terms_sound) (by decide +kernel) +def CA2_6_8I2R14Mass : Ball := ⟨0, 0⟩ +lemma CA2_6_8I2R14Mass_sound : CA2_6_8I2R14Mass.Encloses (∑ a, CA2_6_8I2R14Value a) := by + exact contains_sound (pairSumBall_sound CA2_6_8I2R14P CA2_6_8I2R14Value CA2_6_8I2R14P_sound) (by decide +kernel) +def CA2_6_8I2R14MassTerm : Ball := .exact 0 +lemma CA2_6_8I2R14MassTerm_sound : CA2_6_8I2R14MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_6_8I2R14Value a))) := + entropyTerm_zero_ball (CA2_6_8I2R14Mass_sound) +def CA2_6_8I2R14H : Ball := ⟨0, 0⟩ +lemma CA2_6_8I2R14H_sound : CA2_6_8I2R14H.Encloses (homogeneousEntropy CA2_6_8I2R14Value) := by + exact contains_sound (homogeneous_enclosed CA2_6_8I2R14Value CA2_6_8I2R14MassTerm_sound CA2_6_8I2R14Entropy_sound) (by decide +kernel) +def CA2_6_8I2R15Value (a : PairSlot) : ℝ := residualLaw (below (shape 2 6 8)) (fun u => (stageALaw (shape 2 6 8) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 15 a +def CA2_6_8I2R15Raw (a : PairSlot) : Ball := residualBall (below (shape 2 6 8)) A2_6_8Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 15 a +lemma CA2_6_8I2R15Raw_sound (a : PairSlot) : + (CA2_6_8I2R15Raw a).Encloses (CA2_6_8I2R15Value a) := by + exact residualBall_sound_on (below (shape 2 6 8)) A2_6_8Law (fun u => (stageALaw (shape 2 6 8) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A2_6_8Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 2 6 8) (show (shape 2 6 8) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 15 a +def CA2_6_8I2R15Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA2_6_8I2R15Certificates_valid : + CA2_6_8I2R15Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_6_8I2R15CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA2_6_8I2R15P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_6_8I2R15Certificates (CA2_6_8I2R15CertificateIndex a)).input +lemma CA2_6_8I2R15P_check : ∀ a : PairSlot, contains (CA2_6_8I2R15Raw a) (CA2_6_8I2R15P a) = true := by + decide +kernel +lemma CA2_6_8I2R15P_sound (a : PairSlot) : + (CA2_6_8I2R15P a).Encloses (CA2_6_8I2R15Value a) := + contains_sound (CA2_6_8I2R15Raw_sound a) (CA2_6_8I2R15P_check a) +def CA2_6_8I2R15Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_6_8I2R15Certificates (CA2_6_8I2R15CertificateIndex a)).output +lemma CA2_6_8I2R15Terms_sound (a : PairSlot) : + (CA2_6_8I2R15Terms a).Encloses (Foundation.entropyTerm (CA2_6_8I2R15Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_6_8I2R15Certificates_valid + (CA2_6_8I2R15CertificateIndex a) (CA2_6_8I2R15P_sound a) +def CA2_6_8I2R15Entropy : Ball := ⟨0, 0⟩ +lemma CA2_6_8I2R15Entropy_sound : CA2_6_8I2R15Entropy.Encloses (Foundation.finiteEntropy CA2_6_8I2R15Value) := by + exact contains_sound (entropyPair_enclosed CA2_6_8I2R15Value CA2_6_8I2R15Terms CA2_6_8I2R15Terms_sound) (by decide +kernel) +def CA2_6_8I2R15Mass : Ball := ⟨0, 0⟩ +lemma CA2_6_8I2R15Mass_sound : CA2_6_8I2R15Mass.Encloses (∑ a, CA2_6_8I2R15Value a) := by + exact contains_sound (pairSumBall_sound CA2_6_8I2R15P CA2_6_8I2R15Value CA2_6_8I2R15P_sound) (by decide +kernel) +def CA2_6_8I2R15MassTerm : Ball := .exact 0 +lemma CA2_6_8I2R15MassTerm_sound : CA2_6_8I2R15MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_6_8I2R15Value a))) := + entropyTerm_zero_ball (CA2_6_8I2R15Mass_sound) +def CA2_6_8I2R15H : Ball := ⟨0, 0⟩ +lemma CA2_6_8I2R15H_sound : CA2_6_8I2R15H.Encloses (homogeneousEntropy CA2_6_8I2R15Value) := by + exact contains_sound (homogeneous_enclosed CA2_6_8I2R15Value CA2_6_8I2R15MassTerm_sound CA2_6_8I2R15Entropy_sound) (by decide +kernel) +def CA2_6_8I2R16Value (a : PairSlot) : ℝ := residualLaw (below (shape 2 6 8)) (fun u => (stageALaw (shape 2 6 8) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 16 a +def CA2_6_8I2R16Raw (a : PairSlot) : Ball := residualBall (below (shape 2 6 8)) A2_6_8Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 16 a +lemma CA2_6_8I2R16Raw_sound (a : PairSlot) : + (CA2_6_8I2R16Raw a).Encloses (CA2_6_8I2R16Value a) := by + exact residualBall_sound_on (below (shape 2 6 8)) A2_6_8Law (fun u => (stageALaw (shape 2 6 8) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A2_6_8Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 2 6 8) (show (shape 2 6 8) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 16 a +def CA2_6_8I2R16Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA2_6_8I2R16Certificates_valid : + CA2_6_8I2R16Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_6_8I2R16CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA2_6_8I2R16P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_6_8I2R16Certificates (CA2_6_8I2R16CertificateIndex a)).input +lemma CA2_6_8I2R16P_check : ∀ a : PairSlot, contains (CA2_6_8I2R16Raw a) (CA2_6_8I2R16P a) = true := by + decide +kernel +lemma CA2_6_8I2R16P_sound (a : PairSlot) : + (CA2_6_8I2R16P a).Encloses (CA2_6_8I2R16Value a) := + contains_sound (CA2_6_8I2R16Raw_sound a) (CA2_6_8I2R16P_check a) +def CA2_6_8I2R16Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_6_8I2R16Certificates (CA2_6_8I2R16CertificateIndex a)).output +lemma CA2_6_8I2R16Terms_sound (a : PairSlot) : + (CA2_6_8I2R16Terms a).Encloses (Foundation.entropyTerm (CA2_6_8I2R16Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_6_8I2R16Certificates_valid + (CA2_6_8I2R16CertificateIndex a) (CA2_6_8I2R16P_sound a) +def CA2_6_8I2R16Entropy : Ball := ⟨0, 0⟩ +lemma CA2_6_8I2R16Entropy_sound : CA2_6_8I2R16Entropy.Encloses (Foundation.finiteEntropy CA2_6_8I2R16Value) := by + exact contains_sound (entropyPair_enclosed CA2_6_8I2R16Value CA2_6_8I2R16Terms CA2_6_8I2R16Terms_sound) (by decide +kernel) +def CA2_6_8I2R16Mass : Ball := ⟨0, 0⟩ +lemma CA2_6_8I2R16Mass_sound : CA2_6_8I2R16Mass.Encloses (∑ a, CA2_6_8I2R16Value a) := by + exact contains_sound (pairSumBall_sound CA2_6_8I2R16P CA2_6_8I2R16Value CA2_6_8I2R16P_sound) (by decide +kernel) +def CA2_6_8I2R16MassTerm : Ball := .exact 0 +lemma CA2_6_8I2R16MassTerm_sound : CA2_6_8I2R16MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_6_8I2R16Value a))) := + entropyTerm_zero_ball (CA2_6_8I2R16Mass_sound) +def CA2_6_8I2R16H : Ball := ⟨0, 0⟩ +lemma CA2_6_8I2R16H_sound : CA2_6_8I2R16H.Encloses (homogeneousEntropy CA2_6_8I2R16Value) := by + exact contains_sound (homogeneous_enclosed CA2_6_8I2R16Value CA2_6_8I2R16MassTerm_sound CA2_6_8I2R16Entropy_sound) (by decide +kernel) +def CA2_6_8I2ResidualEntropies (a : Fin 17) : Ball := + match a.val with + | 0 => CA2_6_8I2R0H + | 1 => CA2_6_8I2R1H + | 2 => CA2_6_8I2R2H + | 3 => CA2_6_8I2R3H + | 4 => CA2_6_8I2R4H + | 5 => CA2_6_8I2R5H + | 6 => CA2_6_8I2R6H + | 7 => CA2_6_8I2R7H + | 8 => CA2_6_8I2R8H + | 9 => CA2_6_8I2R9H + | 10 => CA2_6_8I2R10H + | 11 => CA2_6_8I2R11H + | 12 => CA2_6_8I2R12H + | 13 => CA2_6_8I2R13H + | 14 => CA2_6_8I2R14H + | 15 => CA2_6_8I2R15H + | 16 => CA2_6_8I2R16H + | _ => (.exact 0) +lemma CA2_6_8I2ResidualEntropies_sound (k : Fin 17) : + (CA2_6_8I2ResidualEntropies k).Encloses (homogeneousEntropy + (residualLaw (below (shape 2 6 8)) (fun u => (stageALaw (shape 2 6 8) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) k)) := by + fin_cases k + · exact CA2_6_8I2R0H_sound + · exact CA2_6_8I2R1H_sound + · exact CA2_6_8I2R2H_sound + · exact CA2_6_8I2R3H_sound + · exact CA2_6_8I2R4H_sound + · exact CA2_6_8I2R5H_sound + · exact CA2_6_8I2R6H_sound + · exact CA2_6_8I2R7H_sound + · exact CA2_6_8I2R8H_sound + · exact CA2_6_8I2R9H_sound + · exact CA2_6_8I2R10H_sound + · exact CA2_6_8I2R11H_sound + · exact CA2_6_8I2R12H_sound + · exact CA2_6_8I2R13H_sound + · exact CA2_6_8I2R14H_sound + · exact CA2_6_8I2R15H_sound + · exact CA2_6_8I2R16H_sound +def CA2_6_8I2Singles (s : Shape) : Ball := + match s 0, s 1, s 2 with + | 0, 0, 8 => Z0_0_8H2H + | 0, 1, 7 => Z0_1_7H2H + | 0, 2, 6 => Z0_2_6H2H + | 0, 3, 5 => Z0_3_5H2H + | 0, 4, 4 => Z0_4_4H2H + | 0, 5, 3 => Z0_5_3H2H + | 0, 6, 2 => Z0_6_2H2H + | 1, 0, 7 => Z1_0_7H2H + | 2, 0, 6 => Z2_0_6H2H + | _, _, _ => (.exact 0) +lemma CA2_6_8I2Singles_sound (u : Shape) (hu : u ∈ below (shape 2 6 8)) + (hd : designated (Equiv.refl (Fin 3)) 2 u) : + (CA2_6_8I2Singles u).Encloses (homogeneousEntropy ((fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) u)) := by + rw [A2_6_8_below] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl + · exact Z0_0_8H2H_sound + · exact Z0_1_7H2H_sound + · exact Z0_2_6H2H_sound + · exact Z0_3_5H2H_sound + · exact Z0_4_4H2H_sound + · exact Z0_5_3H2H_sound + · exact Z0_6_2H2H_sound + · exact Z1_0_7H2H_sound + · exact (show ¬ designated (Equiv.refl (Fin 3)) 2 (shape 1 1 6) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 2 (shape 1 2 5) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 2 (shape 1 3 4) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 2 (shape 1 4 3) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 2 (shape 1 5 2) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 2 (shape 1 6 1) by decide +kernel) hd |>.elim + · exact Z2_0_6H2H_sound + · exact (show ¬ designated (Equiv.refl (Fin 3)) 2 (shape 2 1 5) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 2 (shape 2 2 4) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 2 (shape 2 3 3) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 2 (shape 2 4 2) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 2 (shape 2 5 1) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 2 (shape 2 6 0) by decide +kernel) hd |>.elim +def CA2_6_8I2Singleton : Ball := ⟨(15172583866467906805800478596961 / 50000000000000000000000000000000), (25355929183 / 100000000000000000000000000000000)⟩ +lemma CA2_6_8I2Singleton_sound : CA2_6_8I2Singleton.Encloses + (singletonEntropy (below (shape 2 6 8)) (fun u => (stageALaw (shape 2 6 8) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ))) := by + exact contains_sound (singletonBall_sound (below (shape 2 6 8)) A2_6_8Law (fun u => (stageALaw (shape 2 6 8) u : ℝ)) (Equiv.refl (Fin 3)) 2 + CA2_6_8I2Singles (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A2_6_8Law_sound u) CA2_6_8I2Singles_sound) (by decide +kernel) +def CA2_6_8I2Group : Ball := ⟨(9669618760717564072244334628689 / 10000000000000000000000000000000), (152601066307 / 100000000000000000000000000000000)⟩ +lemma CA2_6_8I2Group_sound : CA2_6_8I2Group.Encloses + (groupedEntropy (below (shape 2 6 8)) (fun u => (stageALaw (shape 2 6 8) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ))) := by + exact contains_sound (Ball.add_sound CA2_6_8I2Singleton_sound + (finSumBall_sound 17 CA2_6_8I2ResidualEntropies _ CA2_6_8I2ResidualEntropies_sound)) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CA2_6_8I2H : Ball := ⟨(25438310392363462550988190426307 / 25000000000000000000000000000000), (466388455693 / 100000000000000000000000000000000)⟩ +lemma CA2_6_8I2_sound : CA2_6_8I2H.Encloses (stageACapacity (shape 2 6 8) 2) := by + have hb := contains_sound (Ball.add_sound CA2_6_8I2PairH_sound + (Ball.neg_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) CA2_6_8I2Group_sound))) + (show contains (.add CA2_6_8I2PairH (.neg (.mul (.exact 2) CA2_6_8I2Group))) CA2_6_8I2H = true by decide +kernel) + unfold CA2_6_8I2PairValue at hb + simpa only [stageACapacity, nativeCapacity, + show (2 : Fin 3) ≠ 0 by decide, ite_false, sub_eq_add_neg] using hb + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA2_6_8I2Pair.lean b/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA2_6_8I2Pair.lean new file mode 100644 index 0000000000000000000000000000000000000000..3562d55a97c2c0c1138ac9c7fbcb9217795fe44d --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA2_6_8I2Pair.lean @@ -0,0 +1,378 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Certificates.SupportedContraction + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CA2_6_8I2PairValue (a : PairSlot × PairSlot) : ℝ := pairLaw (below (shape 2 6 8)) (shape 2 6 8) (fun u => (stageALaw (shape 2 6 8) u : ℝ)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) a +def CA2_6_8I2PairRaw (a : PairSlot × PairSlot) : Ball := stageAPairBall (shape 2 6 8) A2_6_8Law 2 a +lemma CA2_6_8I2PairRaw_sound (a : PairSlot × PairSlot) : + (CA2_6_8I2PairRaw a).Encloses (CA2_6_8I2PairValue a) := by + exact stageAPairBall_sound (shape 2 6 8) (by decide +kernel) A2_6_8Law (fun u => (stageALaw (shape 2 6 8) u : ℝ)) (fun u _ => A2_6_8Law_sound u) 2 a +def CA2_6_8I2PairCertificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(7283242185896305552952829 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(119700847339367931999913737 / 100000000000000000000000000000000), (1543 / 4000000000000000000000000000000)⟩ ⟨(-821755231283971483508731748424759 / 50000000000000000000000000000000), (529409322223 / 100000000000000000000000000000000)⟩ ⟨-24, 7283242185896305552952829, 5960464477539062500000000⟩, + .log ⟨(810254891600419559116468747 / 50000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ ⟨(4468630547830518165023359233 / 25000000000000000000000000000000), (2916841 / 50000000000000000000000000000000)⟩ ⟨(-551509234211972051209898049644211 / 50000000000000000000000000000000), (89997281507 / 25000000000000000000000000000000)⟩ ⟨-16, 810254891600419559116468747, 762939453125000000000000000⟩, + .log ⟨(5400731718141167865050360571 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(9116539542955711077328213079 / 5000000000000000000000000000000), (32022189 / 50000000000000000000000000000000)⟩ ⟨(-211002416402509613424574327269867 / 25000000000000000000000000000000), (296461536191 / 100000000000000000000000000000000)⟩ ⟨-13, 5400731718141167865050360571, 3051757812500000000000000000⟩, + .log ⟨(541261111431111930211375861 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(23253626472461251371335402687 / 100000000000000000000000000000000), (1558787 / 20000000000000000000000000000000)⟩ ⟨(-1074048457452351829227485123343983 / 100000000000000000000000000000000), (359989048799 / 100000000000000000000000000000000)⟩ ⟨-16, 541261111431111930211375861, 381469726562500000000000000⟩, + .log ⟨(16310810352281592015938696603 / 20000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ ⟨(579984643119466976471065611627 / 100000000000000000000000000000000), (207236923 / 100000000000000000000000000000000)⟩ ⟨(-711165945275474862392308592697789 / 100000000000000000000000000000000), (31763735831 / 12500000000000000000000000000000)⟩ ⟨-11, 16310810352281592015938696603, 9765625000000000000000000000⟩, + .log ⟨(86252590515676185387905379 / 5000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(18919796193791823373500052163 / 100000000000000000000000000000000), (6210009 / 100000000000000000000000000000000)⟩ ⟨(-21935336759947168563649548500583 / 2000000000000000000000000000000), (359989060579 / 100000000000000000000000000000000)⟩ ⟨-16, 86252590515676185387905379, 76293945312500000000000000⟩, + .log ⟨(2693327732805362693813321 / 1562500000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(2287565224264602642079116459 / 100000000000000000000000000000000), (153309 / 20000000000000000000000000000000)⟩ ⟨(-1327102015613391075419681174071847 / 100000000000000000000000000000000), (11117321937 / 2500000000000000000000000000000)⟩ ⟨-20, 2693327732805362693813321, 1490116119384765625000000⟩, + .log ⟨(162785828585918966585480913 / 2500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(31383043262603788968607196283 / 50000000000000000000000000000000), (5170689 / 25000000000000000000000000000000)⟩ ⟨(-240984147201423171303448593653919 / 25000000000000000000000000000000), (158818685301 / 50000000000000000000000000000000)⟩ ⟨-14, 162785828585918966585480913, 152587890625000000000000000⟩, + .log ⟨(96552965811411750769710623253 / 100000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ ⟨(335175594302855718540979569941 / 50000000000000000000000000000000), (122675323 / 50000000000000000000000000000000)⟩ ⟨(-27771334954745907921992836477071 / 4000000000000000000000000000000), (254109886267 / 100000000000000000000000000000000)⟩ ⟨-11, 96552965811411750769710623253, 48828125000000000000000000000⟩, + .log ⟨(10314273406120634677997509047 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(94678807900749203363836910429 / 100000000000000000000000000000000), (8190499 / 25000000000000000000000000000000)⟩ ⟨(-917939676143987701767435904774239 / 100000000000000000000000000000000), (15881868247 / 5000000000000000000000000000000)⟩ ⟨-14, 10314273406120634677997509047, 6103515625000000000000000000⟩, + .log ⟨(365692954844140268622800193131 / 100000000000000000000000000000000), (1 / 20000000000000000000000000000000)⟩ ⟨(2051951223458732260384167853191 / 100000000000000000000000000000000), (774384987 / 100000000000000000000000000000000)⟩ ⟨(-561113140485104968419865303192503 / 100000000000000000000000000000000), (211758238197 / 100000000000000000000000000000000)⟩ ⟨-9, 365692954844140268622800193131, 195312500000000000000000000000⟩, + .log ⟨(323018751619936190633346671 / 10000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(16700691713788192759517087673 / 50000000000000000000000000000000), (10944313 / 100000000000000000000000000000000)⟩ ⟨(-258509631871746935746729636778579 / 25000000000000000000000000000000), (67762641977 / 20000000000000000000000000000000)⟩ ⟨-15, 323018751619936190633346671, 305175781250000000000000000⟩, + .log ⟨(22886079992816800401957203331 / 20000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ ⟨(155006474307279360412057686263 / 20000000000000000000000000000000), (266547393 / 100000000000000000000000000000000)⟩ ⟨(-169323967184344014497853445202809 / 25000000000000000000000000000000), (11646703113 / 5000000000000000000000000000000)⟩ ⟨-10, 22886079992816800401957203331, 19531250000000000000000000000⟩, + .log ⟨(5171730800213798948729213707 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(51043524853803572447298191847 / 100000000000000000000000000000000), (17522517 / 100000000000000000000000000000000)⟩ ⟨(-493485902743559632907739425369451 / 50000000000000000000000000000000), (42351649783 / 12500000000000000000000000000000)⟩ ⟨-15, 5171730800213798948729213707, 3051757812500000000000000000⟩, + .log ⟨(892169642072242837760614167 / 800000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ ⟨(379100206318819447933130073197 / 50000000000000000000000000000000), (32471361 / 12500000000000000000000000000000)⟩ ⟨(-339935535522848075797516825905013 / 50000000000000000000000000000000), (116467031153 / 50000000000000000000000000000000)⟩ ⟨-10, 892169642072242837760614167, 781250000000000000000000000⟩, + .log ⟨(740680147511133466420038328453 / 20000000000000000000000000000000), (27 / 100000000000000000000000000000000)⟩ ⟨(12206107634179844172151828241783 / 100000000000000000000000000000000), (235267689 / 5000000000000000000000000000000)⟩ ⟨(-82397966755254292629478209413957 / 25000000000000000000000000000000), (63527471413 / 50000000000000000000000000000000)⟩ ⟨-5, 740680147511133466420038328453, 625000000000000000000000000000⟩, + .log ⟨(130671723690641084362021155517 / 50000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ ⟨(388558252733520918273425406553 / 25000000000000000000000000000000), (276708149 / 50000000000000000000000000000000)⟩ ⟨(-59470900323227323468055250316191 / 10000000000000000000000000000000), (105879118989 / 50000000000000000000000000000000)⟩ ⟨-9, 130671723690641084362021155517, 97656250000000000000000000000⟩, + .log ⟨(3652493281375781877954444309 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(13915076430472072837099351583 / 20000000000000000000000000000000), (23203377 / 100000000000000000000000000000000)⟩ ⟨(-952436825922831782533424461394811 / 100000000000000000000000000000000), (158818684467 / 50000000000000000000000000000000)⟩ ⟨-14, 3652493281375781877954444309, 3051757812500000000000000000⟩, + .log ⟨(249884426866118634636711681389 / 100000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ ⟨(748644615429106194063312783017 / 50000000000000000000000000000000), (264575439 / 50000000000000000000000000000000)⟩ ⟨(-599192694653364592778576460436519 / 100000000000000000000000000000000), (21175823803 / 10000000000000000000000000000000)⟩ ⟨-9, 249884426866118634636711681389, 195312500000000000000000000000⟩, + .log ⟨(7312184284000057453715739891 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(129136629427737978556049488889 / 100000000000000000000000000000000), (43355637 / 100000000000000000000000000000000)⟩ ⟨(-883023624762196733882828075209289 / 100000000000000000000000000000000), (296461538399 / 100000000000000000000000000000000)⟩ ⟨-13, 7312184284000057453715739891, 6103515625000000000000000000⟩, + .log ⟨(3253854799569380354835221 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(103176781175752322306231793 / 50000000000000000000000000000000), (16541 / 25000000000000000000000000000000)⟩ ⟨(-158545459971672491730930109710221 / 10000000000000000000000000000000), (254113725793 / 50000000000000000000000000000000)⟩ ⟨-23, 3253854799569380354835221, 2980232238769531250000000⟩, + .log ⟨(715960630090064163533759373 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(14978986364660332991072791339 / 50000000000000000000000000000000), (1030953 / 10000000000000000000000000000000)⟩ ⟨(-209215224065826825920178287721281 / 20000000000000000000000000000000), (359989037529 / 100000000000000000000000000000000)⟩ ⟨-16, 715960630090064163533759373, 381469726562500000000000000⟩, + .log ⟨(13844221456529527333394957303 / 50000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ ⟨(113410621206253930007323506821 / 50000000000000000000000000000000), (15244469 / 20000000000000000000000000000000)⟩ ⟨(-409595518109704274430888422941689 / 50000000000000000000000000000000), (137642857551 / 50000000000000000000000000000000)⟩ ⟨-12, 13844221456529527333394957303, 12207031250000000000000000000⟩, + .log ⟨(1310865132118921721619183543 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(2947411596817928265293968287 / 20000000000000000000000000000000), (499657 / 10000000000000000000000000000000)⟩ ⟨(-1124223813953172950218030605580461 / 100000000000000000000000000000000), (381164902579 / 100000000000000000000000000000000)⟩ ⟨-17, 1310865132118921721619183543, 762939453125000000000000000⟩, + .log ⟨(21477518239019404316600743 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(1475960408323068760635027329 / 100000000000000000000000000000000), (11939 / 2500000000000000000000000000000)⟩ ⟨(-68721180533866768287500154383039 / 5000000000000000000000000000000), (111173307137 / 25000000000000000000000000000000)⟩ ⟨-20, 21477518239019404316600743, 19073486328125000000000000⟩, + .log ⟨(56313786850578690215130003913 / 12500000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ ⟨(486780386342457339251458002331 / 20000000000000000000000000000000), (429296709 / 50000000000000000000000000000000)⟩ ⟨(-108050890724607498979529439533053 / 20000000000000000000000000000000), (95291207017 / 50000000000000000000000000000000)⟩ ⟨-8, 56313786850578690215130003913, 48828125000000000000000000000⟩, + .log ⟨(3976227066928181382070837638453 / 100000000000000000000000000000000), (27 / 100000000000000000000000000000000)⟩ ⟨(12822683328581466754084409233043 / 100000000000000000000000000000000), (631499139 / 12500000000000000000000000000000)⟩ ⟨(-64496735788721344043649028136849 / 20000000000000000000000000000000), (15881867847 / 12500000000000000000000000000000)⟩ ⟨-5, 3976227066928181382070837638453, 3125000000000000000000000000000⟩, + .log ⟨(224489536960661043435060636241 / 100000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ ⟨(1369183318821357066392370205587 / 100000000000000000000000000000000), (4753751 / 1000000000000000000000000000000)⟩ ⟨(-609909636483988629445204860227731 / 100000000000000000000000000000000), (5293955943 / 2500000000000000000000000000000)⟩ ⟨-9, 224489536960661043435060636241, 195312500000000000000000000000⟩, + .log ⟨(13236676254300026995773442831 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(11820264512075092378951388193 / 10000000000000000000000000000000), (613151 / 1562500000000000000000000000000)⟩ ⟨(-17859867968343180802220096162239 / 2000000000000000000000000000000), (74115384779 / 25000000000000000000000000000000)⟩ ⟨-13, 13236676254300026995773442831, 12207031250000000000000000000⟩, + .log ⟨(2123338030130107319998626643731 / 6250000000000000000000000000000), (79 / 50000000000000000000000000000000)⟩ ⟨(36677422416751916598991846650501 / 100000000000000000000000000000000), (21582447567 / 100000000000000000000000000000000)⟩ ⟨(-107959207084259304506870870543877 / 100000000000000000000000000000000), (31763735757 / 50000000000000000000000000000000)⟩ ⟨-2, 2123338030130107319998626643731, 1562500000000000000000000000000⟩, + .log ⟨(254473960868337867019245763961 / 12500000000000000000000000000000), (3 / 25000000000000000000000000000000)⟩ ⟨(247748558092799483994342090961 / 3125000000000000000000000000000), (3017669667 / 100000000000000000000000000000000)⟩ ⟨(-389428540739352054629520523556091 / 100000000000000000000000000000000), (14823076637 / 10000000000000000000000000000000)⟩ ⟨-6, 254473960868337867019245763961, 195312500000000000000000000000⟩, + .log ⟨(105882888606922892650060131313 / 100000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ ⟨(11333757017120064135234114051 / 1562500000000000000000000000000), (15414833 / 6250000000000000000000000000000)⟩ ⟨(-342529590304480129659044563103307 / 50000000000000000000000000000000), (232934062401 / 100000000000000000000000000000000)⟩ ⟨-10, 105882888606922892650060131313, 97656250000000000000000000000⟩, + .log ⟨(112370670395376744912564980747 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(152624597637241215759138826107 / 20000000000000000000000000000000), (130874787 / 50000000000000000000000000000000)⟩ ⟨(-42444515631901220866098800423077 / 6250000000000000000000000000000), (116467030701 / 50000000000000000000000000000000)⟩ ⟨-10, 112370670395376744912564980747, 97656250000000000000000000000⟩, + .log ⟨(6100974233881533790432983503 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(59206764106324871502895767847 / 100000000000000000000000000000000), (5167729 / 25000000000000000000000000000000)⟩ ⟨(-970447699607093998890187716757343 / 100000000000000000000000000000000), (338813195319 / 100000000000000000000000000000000)⟩ ⟨-15, 6100974233881533790432983503, 3051757812500000000000000000⟩, + .log ⟨(616378310653418768486974223 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(3697289769476601702649657399 / 50000000000000000000000000000000), (1239977 / 50000000000000000000000000000000)⟩ ⟨(-1199681982825491728831417370878349 / 100000000000000000000000000000000), (80468162443 / 20000000000000000000000000000000)⟩ ⟨-18, 616378310653418768486974223, 381469726562500000000000000⟩] +lemma CA2_6_8I2PairCertificates_valid : + CA2_6_8I2PairCertificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_6_8I2PairCertificateIndex (a : PairSlot × PairSlot) : ℕ := + match a.1.1.val, a.1.2.val, a.2.1.val, a.2.2.val with + | 5, 5, 0, 0 => 1 + | 4, 5, 1, 0 => 2 + | 4, 5, 0, 1 => 2 + | 5, 4, 1, 0 => 2 + | 5, 4, 0, 1 => 2 + | 2, 5, 2, 0 => 3 + | 2, 5, 3, 0 => 4 + | 2, 5, 1, 1 => 5 + | 2, 5, 0, 2 => 3 + | 2, 5, 0, 3 => 4 + | 3, 5, 2, 0 => 6 + | 3, 5, 3, 0 => 7 + | 3, 5, 1, 1 => 8 + | 3, 5, 0, 2 => 6 + | 3, 5, 0, 3 => 7 + | 4, 4, 2, 0 => 9 + | 4, 4, 3, 0 => 10 + | 4, 4, 1, 1 => 11 + | 4, 4, 0, 2 => 9 + | 4, 4, 0, 3 => 10 + | 5, 2, 2, 0 => 3 + | 5, 2, 3, 0 => 4 + | 5, 2, 1, 1 => 5 + | 5, 2, 0, 2 => 3 + | 5, 2, 0, 3 => 4 + | 5, 3, 2, 0 => 6 + | 5, 3, 3, 0 => 7 + | 5, 3, 1, 1 => 8 + | 5, 3, 0, 2 => 6 + | 5, 3, 0, 3 => 7 + | 1, 5, 4, 0 => 12 + | 1, 5, 2, 1 => 13 + | 1, 5, 3, 1 => 14 + | 1, 5, 1, 2 => 13 + | 1, 5, 1, 3 => 14 + | 1, 5, 0, 4 => 12 + | 2, 4, 4, 0 => 15 + | 2, 4, 2, 1 => 16 + | 2, 4, 3, 1 => 17 + | 2, 4, 1, 2 => 16 + | 2, 4, 1, 3 => 17 + | 2, 4, 0, 4 => 15 + | 3, 4, 4, 0 => 18 + | 3, 4, 2, 1 => 19 + | 3, 4, 3, 1 => 20 + | 3, 4, 1, 2 => 19 + | 3, 4, 1, 3 => 20 + | 3, 4, 0, 4 => 18 + | 4, 2, 4, 0 => 15 + | 4, 2, 2, 1 => 16 + | 4, 2, 3, 1 => 17 + | 4, 2, 1, 2 => 16 + | 4, 2, 1, 3 => 17 + | 4, 2, 0, 4 => 15 + | 4, 3, 4, 0 => 18 + | 4, 3, 2, 1 => 19 + | 4, 3, 3, 1 => 20 + | 4, 3, 1, 2 => 19 + | 4, 3, 1, 3 => 20 + | 4, 3, 0, 4 => 18 + | 5, 1, 4, 0 => 12 + | 5, 1, 2, 1 => 13 + | 5, 1, 3, 1 => 14 + | 5, 1, 1, 2 => 13 + | 5, 1, 1, 3 => 14 + | 5, 1, 0, 4 => 12 + | 5, 0, 5, 0 => 21 + | 5, 0, 4, 1 => 22 + | 5, 0, 2, 2 => 23 + | 5, 0, 2, 3 => 24 + | 5, 0, 3, 2 => 24 + | 5, 0, 3, 3 => 25 + | 5, 0, 1, 4 => 22 + | 5, 0, 0, 5 => 21 + | 4, 1, 5, 0 => 22 + | 4, 1, 4, 1 => 26 + | 4, 1, 2, 2 => 27 + | 4, 1, 2, 3 => 28 + | 4, 1, 3, 2 => 28 + | 4, 1, 3, 3 => 29 + | 4, 1, 1, 4 => 26 + | 4, 1, 0, 5 => 22 + | 2, 2, 5, 0 => 23 + | 2, 2, 4, 1 => 27 + | 2, 2, 2, 2 => 30 + | 2, 2, 2, 3 => 31 + | 2, 2, 3, 2 => 31 + | 2, 2, 3, 3 => 32 + | 2, 2, 1, 4 => 27 + | 2, 2, 0, 5 => 23 + | 2, 3, 5, 0 => 24 + | 2, 3, 4, 1 => 28 + | 2, 3, 2, 2 => 31 + | 2, 3, 2, 3 => 33 + | 2, 3, 3, 2 => 33 + | 2, 3, 3, 3 => 34 + | 2, 3, 1, 4 => 28 + | 2, 3, 0, 5 => 24 + | 3, 2, 5, 0 => 24 + | 3, 2, 4, 1 => 28 + | 3, 2, 2, 2 => 31 + | 3, 2, 2, 3 => 33 + | 3, 2, 3, 2 => 33 + | 3, 2, 3, 3 => 34 + | 3, 2, 1, 4 => 28 + | 3, 2, 0, 5 => 24 + | 3, 3, 5, 0 => 25 + | 3, 3, 4, 1 => 29 + | 3, 3, 2, 2 => 32 + | 3, 3, 2, 3 => 34 + | 3, 3, 3, 2 => 34 + | 3, 3, 3, 3 => 35 + | 3, 3, 1, 4 => 29 + | 3, 3, 0, 5 => 25 + | 1, 4, 5, 0 => 22 + | 1, 4, 4, 1 => 26 + | 1, 4, 2, 2 => 27 + | 1, 4, 2, 3 => 28 + | 1, 4, 3, 2 => 28 + | 1, 4, 3, 3 => 29 + | 1, 4, 1, 4 => 26 + | 1, 4, 0, 5 => 22 + | 0, 5, 5, 0 => 21 + | 0, 5, 4, 1 => 22 + | 0, 5, 2, 2 => 23 + | 0, 5, 2, 3 => 24 + | 0, 5, 3, 2 => 24 + | 0, 5, 3, 3 => 25 + | 0, 5, 1, 4 => 22 + | 0, 5, 0, 5 => 21 + | 4, 0, 5, 1 => 12 + | 4, 0, 4, 2 => 15 + | 4, 0, 4, 3 => 18 + | 4, 0, 2, 4 => 15 + | 4, 0, 3, 4 => 18 + | 4, 0, 1, 5 => 12 + | 2, 1, 5, 1 => 13 + | 2, 1, 4, 2 => 16 + | 2, 1, 4, 3 => 19 + | 2, 1, 2, 4 => 16 + | 2, 1, 3, 4 => 19 + | 2, 1, 1, 5 => 13 + | 3, 1, 5, 1 => 14 + | 3, 1, 4, 2 => 17 + | 3, 1, 4, 3 => 20 + | 3, 1, 2, 4 => 17 + | 3, 1, 3, 4 => 20 + | 3, 1, 1, 5 => 14 + | 1, 2, 5, 1 => 13 + | 1, 2, 4, 2 => 16 + | 1, 2, 4, 3 => 19 + | 1, 2, 2, 4 => 16 + | 1, 2, 3, 4 => 19 + | 1, 2, 1, 5 => 13 + | 1, 3, 5, 1 => 14 + | 1, 3, 4, 2 => 17 + | 1, 3, 4, 3 => 20 + | 1, 3, 2, 4 => 17 + | 1, 3, 3, 4 => 20 + | 1, 3, 1, 5 => 14 + | 0, 4, 5, 1 => 12 + | 0, 4, 4, 2 => 15 + | 0, 4, 4, 3 => 18 + | 0, 4, 2, 4 => 15 + | 0, 4, 3, 4 => 18 + | 0, 4, 1, 5 => 12 + | 2, 0, 2, 5 => 3 + | 2, 0, 3, 5 => 6 + | 2, 0, 4, 4 => 9 + | 2, 0, 5, 2 => 3 + | 2, 0, 5, 3 => 6 + | 3, 0, 2, 5 => 4 + | 3, 0, 3, 5 => 7 + | 3, 0, 4, 4 => 10 + | 3, 0, 5, 2 => 4 + | 3, 0, 5, 3 => 7 + | 1, 1, 2, 5 => 5 + | 1, 1, 3, 5 => 8 + | 1, 1, 4, 4 => 11 + | 1, 1, 5, 2 => 5 + | 1, 1, 5, 3 => 8 + | 0, 2, 2, 5 => 3 + | 0, 2, 3, 5 => 6 + | 0, 2, 4, 4 => 9 + | 0, 2, 5, 2 => 3 + | 0, 2, 5, 3 => 6 + | 0, 3, 2, 5 => 4 + | 0, 3, 3, 5 => 7 + | 0, 3, 4, 4 => 10 + | 0, 3, 5, 2 => 4 + | 0, 3, 5, 3 => 7 + | 1, 0, 4, 5 => 2 + | 1, 0, 5, 4 => 2 + | 0, 1, 4, 5 => 2 + | 0, 1, 5, 4 => 2 + | 0, 0, 5, 5 => 1 + | _, _, _, _ => 0 +def CA2_6_8I2PairP (a : PairSlot × PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_6_8I2PairCertificates (CA2_6_8I2PairCertificateIndex a)).input +lemma CA2_6_8I2PairP_check_0_0 : ∀ k l : Fin 6, contains (CA2_6_8I2PairRaw ((0,0),(k,l))) (CA2_6_8I2PairP ((0,0),(k,l))) = true := by + decide +kernel +lemma CA2_6_8I2PairP_check_0_1 : ∀ k l : Fin 6, contains (CA2_6_8I2PairRaw ((0,1),(k,l))) (CA2_6_8I2PairP ((0,1),(k,l))) = true := by + decide +kernel +lemma CA2_6_8I2PairP_check_0_2 : ∀ k l : Fin 6, contains (CA2_6_8I2PairRaw ((0,2),(k,l))) (CA2_6_8I2PairP ((0,2),(k,l))) = true := by + decide +kernel +lemma CA2_6_8I2PairP_check_0_3 : ∀ k l : Fin 6, contains (CA2_6_8I2PairRaw ((0,3),(k,l))) (CA2_6_8I2PairP ((0,3),(k,l))) = true := by + decide +kernel +lemma CA2_6_8I2PairP_check_0_4 : ∀ k l : Fin 6, contains (CA2_6_8I2PairRaw ((0,4),(k,l))) (CA2_6_8I2PairP ((0,4),(k,l))) = true := by + decide +kernel +lemma CA2_6_8I2PairP_check_0_5 : ∀ k l : Fin 6, contains (CA2_6_8I2PairRaw ((0,5),(k,l))) (CA2_6_8I2PairP ((0,5),(k,l))) = true := by + decide +kernel +lemma CA2_6_8I2PairP_check_1_0 : ∀ k l : Fin 6, contains (CA2_6_8I2PairRaw ((1,0),(k,l))) (CA2_6_8I2PairP ((1,0),(k,l))) = true := by + decide +kernel +lemma CA2_6_8I2PairP_check_1_1 : ∀ k l : Fin 6, contains (CA2_6_8I2PairRaw ((1,1),(k,l))) (CA2_6_8I2PairP ((1,1),(k,l))) = true := by + decide +kernel +lemma CA2_6_8I2PairP_check_1_2 : ∀ k l : Fin 6, contains (CA2_6_8I2PairRaw ((1,2),(k,l))) (CA2_6_8I2PairP ((1,2),(k,l))) = true := by + decide +kernel +lemma CA2_6_8I2PairP_check_1_3 : ∀ k l : Fin 6, contains (CA2_6_8I2PairRaw ((1,3),(k,l))) (CA2_6_8I2PairP ((1,3),(k,l))) = true := by + decide +kernel +lemma CA2_6_8I2PairP_check_1_4 : ∀ k l : Fin 6, contains (CA2_6_8I2PairRaw ((1,4),(k,l))) (CA2_6_8I2PairP ((1,4),(k,l))) = true := by + decide +kernel +lemma CA2_6_8I2PairP_check_1_5 : ∀ k l : Fin 6, contains (CA2_6_8I2PairRaw ((1,5),(k,l))) (CA2_6_8I2PairP ((1,5),(k,l))) = true := by + decide +kernel +lemma CA2_6_8I2PairP_check_2_0 : ∀ k l : Fin 6, contains (CA2_6_8I2PairRaw ((2,0),(k,l))) (CA2_6_8I2PairP ((2,0),(k,l))) = true := by + decide +kernel +lemma CA2_6_8I2PairP_check_2_1 : ∀ k l : Fin 6, contains (CA2_6_8I2PairRaw ((2,1),(k,l))) (CA2_6_8I2PairP ((2,1),(k,l))) = true := by + decide +kernel +lemma CA2_6_8I2PairP_check_2_2 : ∀ k l : Fin 6, contains (CA2_6_8I2PairRaw ((2,2),(k,l))) (CA2_6_8I2PairP ((2,2),(k,l))) = true := by + decide +kernel +lemma CA2_6_8I2PairP_check_2_3 : ∀ k l : Fin 6, contains (CA2_6_8I2PairRaw ((2,3),(k,l))) (CA2_6_8I2PairP ((2,3),(k,l))) = true := by + decide +kernel +lemma CA2_6_8I2PairP_check_2_4 : ∀ k l : Fin 6, contains (CA2_6_8I2PairRaw ((2,4),(k,l))) (CA2_6_8I2PairP ((2,4),(k,l))) = true := by + decide +kernel +lemma CA2_6_8I2PairP_check_2_5 : ∀ k l : Fin 6, contains (CA2_6_8I2PairRaw ((2,5),(k,l))) (CA2_6_8I2PairP ((2,5),(k,l))) = true := by + decide +kernel +lemma CA2_6_8I2PairP_check_3_0 : ∀ k l : Fin 6, contains (CA2_6_8I2PairRaw ((3,0),(k,l))) (CA2_6_8I2PairP ((3,0),(k,l))) = true := by + decide +kernel +lemma CA2_6_8I2PairP_check_3_1 : ∀ k l : Fin 6, contains (CA2_6_8I2PairRaw ((3,1),(k,l))) (CA2_6_8I2PairP ((3,1),(k,l))) = true := by + decide +kernel +lemma CA2_6_8I2PairP_check_3_2 : ∀ k l : Fin 6, contains (CA2_6_8I2PairRaw ((3,2),(k,l))) (CA2_6_8I2PairP ((3,2),(k,l))) = true := by + decide +kernel +lemma CA2_6_8I2PairP_check_3_3 : ∀ k l : Fin 6, contains (CA2_6_8I2PairRaw ((3,3),(k,l))) (CA2_6_8I2PairP ((3,3),(k,l))) = true := by + decide +kernel +lemma CA2_6_8I2PairP_check_3_4 : ∀ k l : Fin 6, contains (CA2_6_8I2PairRaw ((3,4),(k,l))) (CA2_6_8I2PairP ((3,4),(k,l))) = true := by + decide +kernel +lemma CA2_6_8I2PairP_check_3_5 : ∀ k l : Fin 6, contains (CA2_6_8I2PairRaw ((3,5),(k,l))) (CA2_6_8I2PairP ((3,5),(k,l))) = true := by + decide +kernel +lemma CA2_6_8I2PairP_check_4_0 : ∀ k l : Fin 6, contains (CA2_6_8I2PairRaw ((4,0),(k,l))) (CA2_6_8I2PairP ((4,0),(k,l))) = true := by + decide +kernel +lemma CA2_6_8I2PairP_check_4_1 : ∀ k l : Fin 6, contains (CA2_6_8I2PairRaw ((4,1),(k,l))) (CA2_6_8I2PairP ((4,1),(k,l))) = true := by + decide +kernel +lemma CA2_6_8I2PairP_check_4_2 : ∀ k l : Fin 6, contains (CA2_6_8I2PairRaw ((4,2),(k,l))) (CA2_6_8I2PairP ((4,2),(k,l))) = true := by + decide +kernel +lemma CA2_6_8I2PairP_check_4_3 : ∀ k l : Fin 6, contains (CA2_6_8I2PairRaw ((4,3),(k,l))) (CA2_6_8I2PairP ((4,3),(k,l))) = true := by + decide +kernel +lemma CA2_6_8I2PairP_check_4_4 : ∀ k l : Fin 6, contains (CA2_6_8I2PairRaw ((4,4),(k,l))) (CA2_6_8I2PairP ((4,4),(k,l))) = true := by + decide +kernel +lemma CA2_6_8I2PairP_check_4_5 : ∀ k l : Fin 6, contains (CA2_6_8I2PairRaw ((4,5),(k,l))) (CA2_6_8I2PairP ((4,5),(k,l))) = true := by + decide +kernel +lemma CA2_6_8I2PairP_check_5_0 : ∀ k l : Fin 6, contains (CA2_6_8I2PairRaw ((5,0),(k,l))) (CA2_6_8I2PairP ((5,0),(k,l))) = true := by + decide +kernel +lemma CA2_6_8I2PairP_check_5_1 : ∀ k l : Fin 6, contains (CA2_6_8I2PairRaw ((5,1),(k,l))) (CA2_6_8I2PairP ((5,1),(k,l))) = true := by + decide +kernel +lemma CA2_6_8I2PairP_check_5_2 : ∀ k l : Fin 6, contains (CA2_6_8I2PairRaw ((5,2),(k,l))) (CA2_6_8I2PairP ((5,2),(k,l))) = true := by + decide +kernel +lemma CA2_6_8I2PairP_check_5_3 : ∀ k l : Fin 6, contains (CA2_6_8I2PairRaw ((5,3),(k,l))) (CA2_6_8I2PairP ((5,3),(k,l))) = true := by + decide +kernel +lemma CA2_6_8I2PairP_check_5_4 : ∀ k l : Fin 6, contains (CA2_6_8I2PairRaw ((5,4),(k,l))) (CA2_6_8I2PairP ((5,4),(k,l))) = true := by + decide +kernel +lemma CA2_6_8I2PairP_check_5_5 : ∀ k l : Fin 6, contains (CA2_6_8I2PairRaw ((5,5),(k,l))) (CA2_6_8I2PairP ((5,5),(k,l))) = true := by + decide +kernel +lemma CA2_6_8I2PairP_check (a : PairSlot × PairSlot) : contains (CA2_6_8I2PairRaw a) (CA2_6_8I2PairP a) = true := by + rcases a with ⟨⟨i,j⟩,⟨k,l⟩⟩ + revert j i + apply forall_fin6 + · exact forall_fin6 (CA2_6_8I2PairP_check_0_0 k l) (CA2_6_8I2PairP_check_0_1 k l) (CA2_6_8I2PairP_check_0_2 k l) (CA2_6_8I2PairP_check_0_3 k l) (CA2_6_8I2PairP_check_0_4 k l) (CA2_6_8I2PairP_check_0_5 k l) + · exact forall_fin6 (CA2_6_8I2PairP_check_1_0 k l) (CA2_6_8I2PairP_check_1_1 k l) (CA2_6_8I2PairP_check_1_2 k l) (CA2_6_8I2PairP_check_1_3 k l) (CA2_6_8I2PairP_check_1_4 k l) (CA2_6_8I2PairP_check_1_5 k l) + · exact forall_fin6 (CA2_6_8I2PairP_check_2_0 k l) (CA2_6_8I2PairP_check_2_1 k l) (CA2_6_8I2PairP_check_2_2 k l) (CA2_6_8I2PairP_check_2_3 k l) (CA2_6_8I2PairP_check_2_4 k l) (CA2_6_8I2PairP_check_2_5 k l) + · exact forall_fin6 (CA2_6_8I2PairP_check_3_0 k l) (CA2_6_8I2PairP_check_3_1 k l) (CA2_6_8I2PairP_check_3_2 k l) (CA2_6_8I2PairP_check_3_3 k l) (CA2_6_8I2PairP_check_3_4 k l) (CA2_6_8I2PairP_check_3_5 k l) + · exact forall_fin6 (CA2_6_8I2PairP_check_4_0 k l) (CA2_6_8I2PairP_check_4_1 k l) (CA2_6_8I2PairP_check_4_2 k l) (CA2_6_8I2PairP_check_4_3 k l) (CA2_6_8I2PairP_check_4_4 k l) (CA2_6_8I2PairP_check_4_5 k l) + · exact forall_fin6 (CA2_6_8I2PairP_check_5_0 k l) (CA2_6_8I2PairP_check_5_1 k l) (CA2_6_8I2PairP_check_5_2 k l) (CA2_6_8I2PairP_check_5_3 k l) (CA2_6_8I2PairP_check_5_4 k l) (CA2_6_8I2PairP_check_5_5 k l) +lemma CA2_6_8I2PairP_sound (a : PairSlot × PairSlot) : + (CA2_6_8I2PairP a).Encloses (CA2_6_8I2PairValue a) := + contains_sound (CA2_6_8I2PairRaw_sound a) (CA2_6_8I2PairP_check a) +def CA2_6_8I2PairTerms (a : PairSlot × PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_6_8I2PairCertificates (CA2_6_8I2PairCertificateIndex a)).output +lemma CA2_6_8I2PairTerms_sound (a : PairSlot × PairSlot) : + (CA2_6_8I2PairTerms a).Encloses (Foundation.entropyTerm (CA2_6_8I2PairValue a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_6_8I2PairCertificates_valid + (CA2_6_8I2PairCertificateIndex a) (CA2_6_8I2PairP_sound a) +def CA2_6_8I2PairEntropy : Ball := ⟨(295145616783805131648839454279023 / 100000000000000000000000000000000), (23766934981 / 20000000000000000000000000000000)⟩ +lemma CA2_6_8I2PairEntropy_sound : CA2_6_8I2PairEntropy.Encloses (Foundation.finiteEntropy CA2_6_8I2PairValue) := by + exact contains_sound (entropyDoublePair_enclosed CA2_6_8I2PairValue CA2_6_8I2PairTerms CA2_6_8I2PairTerms_sound) (by decide +kernel) +def CA2_6_8I2PairMass : Ball := ⟨(19999999999999999999999999999997 / 20000000000000000000000000000000), (807 / 100000000000000000000000000000000)⟩ +lemma CA2_6_8I2PairMass_sound : CA2_6_8I2PairMass.Encloses (∑ a, CA2_6_8I2PairValue a) := by + exact contains_sound (doublePairSumBall_sound CA2_6_8I2PairP CA2_6_8I2PairValue CA2_6_8I2PairP_sound) (by decide +kernel) +def CA2_6_8I2PairMassTermLogWitness : LogWitness := ⟨-1, 19999999999999999999999999999997, 10000000000000000000000000000000⟩ +def CA2_6_8I2PairMassTermLog : Ball := ⟨(-3 / 20000000000000000000000000000000), (42351648173 / 100000000000000000000000000000000)⟩ +lemma CA2_6_8I2PairMassTermLog_sound : CA2_6_8I2PairMassTermLog.Encloses (Real.log ((∑ a, CA2_6_8I2PairValue a))) := by + exact checkLog_sound logTwoBall_sound (CA2_6_8I2PairMass_sound) (w := CA2_6_8I2PairMassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA2_6_8I2PairMassTerm : Ball := ⟨(3 / 20000000000000000000000000000000), (21175824087 / 50000000000000000000000000000000)⟩ +lemma CA2_6_8I2PairMassTerm_sound : CA2_6_8I2PairMassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_6_8I2PairValue a))) := by + exact contains_sound (entropyTerm_ball (CA2_6_8I2PairMass_sound) CA2_6_8I2PairMassTermLog_sound) (by decide +kernel) +def CA2_6_8I2PairH : Ball := ⟨(9223300524493910364026232946219 / 3125000000000000000000000000000), (161186323079 / 100000000000000000000000000000000)⟩ +lemma CA2_6_8I2PairH_sound : CA2_6_8I2PairH.Encloses (homogeneousEntropy CA2_6_8I2PairValue) := by + exact contains_sound (homogeneous_enclosed CA2_6_8I2PairValue CA2_6_8I2PairMassTerm_sound CA2_6_8I2PairEntropy_sound) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA2_7_7I0.lean b/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA2_7_7I0.lean new file mode 100644 index 0000000000000000000000000000000000000000..45716fe0d5b17bfe499627958c6598ea910543e7 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA2_7_7I0.lean @@ -0,0 +1,74 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Certificates.SplitA2_7_7 + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CA2_7_7I0Value (a : Fin 17) : ℝ := marginal (below (shape 2 7 7)) (fun u => (stageALaw (shape 2 7 7) u : ℝ)) ((Equiv.refl (Fin 3)) 0) a +def CA2_7_7I0Raw (a : Fin 17) : Ball := marginalBall (below (shape 2 7 7)) A2_7_7Law ((Equiv.refl (Fin 3)) 0) a +lemma CA2_7_7I0Raw_sound (a : Fin 17) : + (CA2_7_7I0Raw a).Encloses (CA2_7_7I0Value a) := by + exact marginalBall_sound (below (shape 2 7 7)) A2_7_7Law (fun u => (stageALaw (shape 2 7 7) u : ℝ)) (fun u _ => A2_7_7Law_sound u) ((Equiv.refl (Fin 3)) 0) a +def CA2_7_7I0Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(2478236922667912448826878641011 / 10000000000000000000000000000000), (9 / 12500000000000000000000000000000)⟩ ⟨(8643084865911444987514954227337 / 25000000000000000000000000000000), (20991483421 / 100000000000000000000000000000000)⟩ ⟨(-139503770391845325996477971161587 / 100000000000000000000000000000000), (84703295023 / 100000000000000000000000000000000)⟩ ⟨-3, 2478236922667912448826878641011, 1250000000000000000000000000000⟩, + .log ⟨(25217630773320875511731213589889 / 50000000000000000000000000000000), (31 / 50000000000000000000000000000000)⟩ ⟨(34521908742701804978706762282031 / 100000000000000000000000000000000), (21360164223 / 100000000000000000000000000000000)⟩ ⟨(-17111990541962629104116060290069 / 25000000000000000000000000000000), (165436123 / 390625000000000000000000000000)⟩ ⟨-1, 25217630773320875511731213589889, 25000000000000000000000000000000⟩] +lemma CA2_7_7I0Certificates_valid : + CA2_7_7I0Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_7_7I0CertificateIndex (a : Fin 17) : ℕ := + match a.val with + | 0 => 1 + | 1 => 2 + | 2 => 1 + | _ => 0 +def CA2_7_7I0P (a : Fin 17) : Ball := + (CompactCertificate.entropyLookup CA2_7_7I0Certificates (CA2_7_7I0CertificateIndex a)).input +lemma CA2_7_7I0P_check : ∀ a : Fin 17, contains (CA2_7_7I0Raw a) (CA2_7_7I0P a) = true := by + decide +kernel +lemma CA2_7_7I0P_sound (a : Fin 17) : + (CA2_7_7I0P a).Encloses (CA2_7_7I0Value a) := + contains_sound (CA2_7_7I0Raw_sound a) (CA2_7_7I0P_check a) +def CA2_7_7I0Terms (a : Fin 17) : Ball := + (CompactCertificate.entropyLookup CA2_7_7I0Certificates (CA2_7_7I0CertificateIndex a)).output +lemma CA2_7_7I0Terms_sound (a : Fin 17) : + (CA2_7_7I0Terms a).Encloses (Foundation.entropyTerm (CA2_7_7I0Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_7_7I0Certificates_valid + (CA2_7_7I0CertificateIndex a) (CA2_7_7I0P_sound a) +def CA2_7_7I0Entropy : Ball := ⟨(103666587669993364878826396100727 / 100000000000000000000000000000000), (12668626213 / 20000000000000000000000000000000)⟩ +lemma CA2_7_7I0Entropy_sound : CA2_7_7I0Entropy.Encloses (Foundation.finiteEntropy CA2_7_7I0Value) := by + exact contains_sound (entropyFin_enclosed 17 CA2_7_7I0Value CA2_7_7I0Terms CA2_7_7I0Terms_sound) (by decide +kernel) +def CA2_7_7I0Mass : Ball := ⟨(49999999999999999999999999999999 / 50000000000000000000000000000000), (103 / 50000000000000000000000000000000)⟩ +lemma CA2_7_7I0Mass_sound : CA2_7_7I0Mass.Encloses (∑ a, CA2_7_7I0Value a) := by + exact contains_sound (finSumBall_sound 17 CA2_7_7I0P CA2_7_7I0Value CA2_7_7I0P_sound) (by decide +kernel) +def CA2_7_7I0MassTermLogWitness : LogWitness := ⟨-1, 49999999999999999999999999999999, 25000000000000000000000000000000⟩ +def CA2_7_7I0MassTermLog : Ball := ⟨(-1 / 100000000000000000000000000000000), (10587911893 / 25000000000000000000000000000000)⟩ +lemma CA2_7_7I0MassTermLog_sound : CA2_7_7I0MassTermLog.Encloses (Real.log ((∑ a, CA2_7_7I0Value a))) := by + exact checkLog_sound logTwoBall_sound (CA2_7_7I0Mass_sound) (w := CA2_7_7I0MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA2_7_7I0MassTerm : Ball := ⟨(1 / 100000000000000000000000000000000), (42351647573 / 100000000000000000000000000000000)⟩ +lemma CA2_7_7I0MassTerm_sound : CA2_7_7I0MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_7_7I0Value a))) := by + exact contains_sound (entropyTerm_ball (CA2_7_7I0Mass_sound) CA2_7_7I0MassTermLog_sound) (by decide +kernel) +def CA2_7_7I0H : Ball := ⟨(51833293834996682439413198050363 / 50000000000000000000000000000000), (52847389319 / 50000000000000000000000000000000)⟩ +lemma CA2_7_7I0H_sound : CA2_7_7I0H.Encloses (homogeneousEntropy CA2_7_7I0Value) := by + exact contains_sound (homogeneous_enclosed CA2_7_7I0Value CA2_7_7I0MassTerm_sound CA2_7_7I0Entropy_sound) (by decide +kernel) +lemma CA2_7_7I0_sound : CA2_7_7I0H.Encloses (stageACapacity (shape 2 7 7) 0) := by + exact CA2_7_7I0H_sound + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA2_7_7I1.lean b/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA2_7_7I1.lean new file mode 100644 index 0000000000000000000000000000000000000000..aad3c01d233ba2a40fdc0d962f1fc2902efe080d --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA2_7_7I1.lean @@ -0,0 +1,868 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.CapacityA.CapA2_7_7I1Pair + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CA2_7_7I1R0Value (a : PairSlot) : ℝ := residualLaw (below (shape 2 7 7)) (fun u => (stageALaw (shape 2 7 7) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 0 a +def CA2_7_7I1R0Raw (a : PairSlot) : Ball := residualBall (below (shape 2 7 7)) A2_7_7Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 0 a +lemma CA2_7_7I1R0Raw_sound (a : PairSlot) : + (CA2_7_7I1R0Raw a).Encloses (CA2_7_7I1R0Value a) := by + exact residualBall_sound_on (below (shape 2 7 7)) A2_7_7Law (fun u => (stageALaw (shape 2 7 7) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A2_7_7Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 2 7 7) (show (shape 2 7 7) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 0 a +def CA2_7_7I1R0Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(518482090007836349659861879 / 100000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ ⟨(394363156944662384672781891 / 6250000000000000000000000000000), (521523 / 25000000000000000000000000000000)⟩ ⟨(-1216977525881218296384070257089797 / 100000000000000000000000000000000), (201170517859 / 50000000000000000000000000000000)⟩ ⟨-18, 518482090007836349659861879, 381469726562500000000000000⟩] +lemma CA2_7_7I1R0Certificates_valid : + CA2_7_7I1R0Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_7_7I1R0CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 0, 0 => 1 + | _, _ => 0 +def CA2_7_7I1R0P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_7_7I1R0Certificates (CA2_7_7I1R0CertificateIndex a)).input +lemma CA2_7_7I1R0P_check : ∀ a : PairSlot, contains (CA2_7_7I1R0Raw a) (CA2_7_7I1R0P a) = true := by + decide +kernel +lemma CA2_7_7I1R0P_sound (a : PairSlot) : + (CA2_7_7I1R0P a).Encloses (CA2_7_7I1R0Value a) := + contains_sound (CA2_7_7I1R0Raw_sound a) (CA2_7_7I1R0P_check a) +def CA2_7_7I1R0Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_7_7I1R0Certificates (CA2_7_7I1R0CertificateIndex a)).output +lemma CA2_7_7I1R0Terms_sound (a : PairSlot) : + (CA2_7_7I1R0Terms a).Encloses (Foundation.entropyTerm (CA2_7_7I1R0Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_7_7I1R0Certificates_valid + (CA2_7_7I1R0CertificateIndex a) (CA2_7_7I1R0P_sound a) +def CA2_7_7I1R0Entropy : Ball := ⟨(394363156944662384672781891 / 6250000000000000000000000000000), (521523 / 25000000000000000000000000000000)⟩ +lemma CA2_7_7I1R0Entropy_sound : CA2_7_7I1R0Entropy.Encloses (Foundation.finiteEntropy CA2_7_7I1R0Value) := by + exact contains_sound (entropyPair_enclosed CA2_7_7I1R0Value CA2_7_7I1R0Terms CA2_7_7I1R0Terms_sound) (by decide +kernel) +def CA2_7_7I1R0Mass : Ball := ⟨(518482090007836349659861879 / 100000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ +lemma CA2_7_7I1R0Mass_sound : CA2_7_7I1R0Mass.Encloses (∑ a, CA2_7_7I1R0Value a) := by + exact contains_sound (pairSumBall_sound CA2_7_7I1R0P CA2_7_7I1R0Value CA2_7_7I1R0P_sound) (by decide +kernel) +def CA2_7_7I1R0MassTermLogWitness : LogWitness := ⟨-18, 518482090007836349659861879, 381469726562500000000000000⟩ +def CA2_7_7I1R0MassTermLog : Ball := ⟨(-1216977525881218296384070257089797 / 100000000000000000000000000000000), (201170517859 / 50000000000000000000000000000000)⟩ +lemma CA2_7_7I1R0MassTermLog_sound : CA2_7_7I1R0MassTermLog.Encloses (Real.log ((∑ a, CA2_7_7I1R0Value a))) := by + exact checkLog_sound logTwoBall_sound (CA2_7_7I1R0Mass_sound) (w := CA2_7_7I1R0MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA2_7_7I1R0MassTerm : Ball := ⟨(394363156944662384672781891 / 6250000000000000000000000000000), (521523 / 25000000000000000000000000000000)⟩ +lemma CA2_7_7I1R0MassTerm_sound : CA2_7_7I1R0MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_7_7I1R0Value a))) := by + exact contains_sound (entropyTerm_ball (CA2_7_7I1R0Mass_sound) CA2_7_7I1R0MassTermLog_sound) (by decide +kernel) +def CA2_7_7I1R0H : Ball := ⟨0, (521523 / 12500000000000000000000000000000)⟩ +lemma CA2_7_7I1R0H_sound : CA2_7_7I1R0H.Encloses (homogeneousEntropy CA2_7_7I1R0Value) := by + exact contains_sound (homogeneous_enclosed CA2_7_7I1R0Value CA2_7_7I1R0MassTerm_sound CA2_7_7I1R0Entropy_sound) (by decide +kernel) +def CA2_7_7I1R1Value (a : PairSlot) : ℝ := residualLaw (below (shape 2 7 7)) (fun u => (stageALaw (shape 2 7 7) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 1 a +def CA2_7_7I1R1Raw (a : PairSlot) : Ball := residualBall (below (shape 2 7 7)) A2_7_7Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 1 a +lemma CA2_7_7I1R1Raw_sound (a : PairSlot) : + (CA2_7_7I1R1Raw a).Encloses (CA2_7_7I1R1Value a) := by + exact residualBall_sound_on (below (shape 2 7 7)) A2_7_7Law (fun u => (stageALaw (shape 2 7 7) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A2_7_7Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 2 7 7) (show (shape 2 7 7) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 1 a +def CA2_7_7I1R1Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(16422740291403525891109820993 / 25000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ ⟨(481381006845902733106782874549 / 100000000000000000000000000000000), (166927251 / 100000000000000000000000000000000)⟩ ⟨(-366398206316610685122953063338753 / 50000000000000000000000000000000), (127054944381 / 50000000000000000000000000000000)⟩ ⟨-11, 16422740291403525891109820993, 12207031250000000000000000000⟩] +lemma CA2_7_7I1R1Certificates_valid : + CA2_7_7I1R1Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_7_7I1R1CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 1, 0 => 1 + | 0, 1 => 1 + | _, _ => 0 +def CA2_7_7I1R1P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_7_7I1R1Certificates (CA2_7_7I1R1CertificateIndex a)).input +lemma CA2_7_7I1R1P_check : ∀ a : PairSlot, contains (CA2_7_7I1R1Raw a) (CA2_7_7I1R1P a) = true := by + decide +kernel +lemma CA2_7_7I1R1P_sound (a : PairSlot) : + (CA2_7_7I1R1P a).Encloses (CA2_7_7I1R1Value a) := + contains_sound (CA2_7_7I1R1Raw_sound a) (CA2_7_7I1R1P_check a) +def CA2_7_7I1R1Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_7_7I1R1Certificates (CA2_7_7I1R1CertificateIndex a)).output +lemma CA2_7_7I1R1Terms_sound (a : PairSlot) : + (CA2_7_7I1R1Terms a).Encloses (Foundation.entropyTerm (CA2_7_7I1R1Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_7_7I1R1Certificates_valid + (CA2_7_7I1R1CertificateIndex a) (CA2_7_7I1R1P_sound a) +def CA2_7_7I1R1Entropy : Ball := ⟨(481381006845902733106782874549 / 50000000000000000000000000000000), (166927251 / 50000000000000000000000000000000)⟩ +lemma CA2_7_7I1R1Entropy_sound : CA2_7_7I1R1Entropy.Encloses (Foundation.finiteEntropy CA2_7_7I1R1Value) := by + exact contains_sound (entropyPair_enclosed CA2_7_7I1R1Value CA2_7_7I1R1Terms CA2_7_7I1R1Terms_sound) (by decide +kernel) +def CA2_7_7I1R1Mass : Ball := ⟨(16422740291403525891109820993 / 12500000000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ +lemma CA2_7_7I1R1Mass_sound : CA2_7_7I1R1Mass.Encloses (∑ a, CA2_7_7I1R1Value a) := by + exact contains_sound (pairSumBall_sound CA2_7_7I1R1P CA2_7_7I1R1Value CA2_7_7I1R1P_sound) (by decide +kernel) +def CA2_7_7I1R1MassTermLogWitness : LogWitness := ⟨-10, 16422740291403525891109820993, 12207031250000000000000000000⟩ +def CA2_7_7I1R1MassTermLog : Ball := ⟨(-82935211822153354913022866703397 / 12500000000000000000000000000000), (232934065079 / 100000000000000000000000000000000)⟩ +lemma CA2_7_7I1R1MassTermLog_sound : CA2_7_7I1R1MassTermLog.Encloses (Real.log ((∑ a, CA2_7_7I1R1Value a))) := by + exact checkLog_sound logTwoBall_sound (CA2_7_7I1R1Mass_sound) (w := CA2_7_7I1R1MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA2_7_7I1R1MassTerm : Ball := ⟨(871695004651368917354137361287 / 100000000000000000000000000000000), (306033293 / 100000000000000000000000000000000)⟩ +lemma CA2_7_7I1R1MassTerm_sound : CA2_7_7I1R1MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_7_7I1R1Value a))) := by + exact contains_sound (entropyTerm_ball (CA2_7_7I1R1Mass_sound) CA2_7_7I1R1MassTermLog_sound) (by decide +kernel) +def CA2_7_7I1R1H : Ball := ⟨(91067009040436548859428387811 / 100000000000000000000000000000000), (127977559 / 20000000000000000000000000000000)⟩ +lemma CA2_7_7I1R1H_sound : CA2_7_7I1R1H.Encloses (homogeneousEntropy CA2_7_7I1R1Value) := by + exact contains_sound (homogeneous_enclosed CA2_7_7I1R1Value CA2_7_7I1R1MassTerm_sound CA2_7_7I1R1Entropy_sound) (by decide +kernel) +def CA2_7_7I1R2Value (a : PairSlot) : ℝ := residualLaw (below (shape 2 7 7)) (fun u => (stageALaw (shape 2 7 7) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 2 a +def CA2_7_7I1R2Raw (a : PairSlot) : Ball := residualBall (below (shape 2 7 7)) A2_7_7Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 2 a +lemma CA2_7_7I1R2Raw_sound (a : PairSlot) : + (CA2_7_7I1R2Raw a).Encloses (CA2_7_7I1R2Value a) := by + exact residualBall_sound_on (below (shape 2 7 7)) A2_7_7Law (fun u => (stageALaw (shape 2 7 7) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A2_7_7Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 2 7 7) (show (shape 2 7 7) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 2 a +def CA2_7_7I1R2Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(936943688749496935401112543 / 97656250000000000000000000000), (1 / 12500000000000000000000000000000)⟩ ⟨(891615067682299212220383761227 / 20000000000000000000000000000000), (1625338259 / 100000000000000000000000000000000)⟩ ⟨(-46465857553062194688581618121661 / 10000000000000000000000000000000), (169406590297 / 100000000000000000000000000000000)⟩ ⟨-7, 936943688749496935401112543, 762939453125000000000000000⟩, + .log ⟨(97581178763297969963962951187 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(676456231729529575982465463009 / 100000000000000000000000000000000), (247963429 / 100000000000000000000000000000000)⟩ ⟨(-693224083068728912677772212316411 / 100000000000000000000000000000000), (12705494261 / 5000000000000000000000000000000)⟩ ⟨-11, 97581178763297969963962951187, 48828125000000000000000000000⟩, + .log ⟨(226227111864411376422478165517 / 6250000000000000000000000000000), (19 / 100000000000000000000000000000000)⟩ ⟨(12012830951106762904887313794573 / 100000000000000000000000000000000), (4598923699 / 100000000000000000000000000000000)⟩ ⟨(-265503786263836968659047249629 / 80000000000000000000000000000), (63527471311 / 50000000000000000000000000000000)⟩ ⟨-5, 226227111864411376422478165517, 195312500000000000000000000000⟩] +lemma CA2_7_7I1R2Certificates_valid : + CA2_7_7I1R2Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_7_7I1R2CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 2, 0 => 1 + | 3, 0 => 2 + | 1, 1 => 3 + | 0, 2 => 1 + | 0, 3 => 2 + | _, _ => 0 +def CA2_7_7I1R2P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_7_7I1R2Certificates (CA2_7_7I1R2CertificateIndex a)).input +lemma CA2_7_7I1R2P_check : ∀ a : PairSlot, contains (CA2_7_7I1R2Raw a) (CA2_7_7I1R2P a) = true := by + decide +kernel +lemma CA2_7_7I1R2P_sound (a : PairSlot) : + (CA2_7_7I1R2P a).Encloses (CA2_7_7I1R2Value a) := + contains_sound (CA2_7_7I1R2Raw_sound a) (CA2_7_7I1R2P_check a) +def CA2_7_7I1R2Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_7_7I1R2Certificates (CA2_7_7I1R2CertificateIndex a)).output +lemma CA2_7_7I1R2Terms_sound (a : PairSlot) : + (CA2_7_7I1R2Terms a).Encloses (Foundation.entropyTerm (CA2_7_7I1R2Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_7_7I1R2Certificates_valid + (CA2_7_7I1R2CertificateIndex a) (CA2_7_7I1R2P_sound a) +def CA2_7_7I1R2Entropy : Ball := ⟨(22281894091388814179056082332861 / 100000000000000000000000000000000), (333821083 / 4000000000000000000000000000000)⟩ +lemma CA2_7_7I1R2Entropy_sound : CA2_7_7I1R2Entropy.Encloses (Foundation.finiteEntropy CA2_7_7I1R2Value) := by + exact contains_sound (entropyPair_enclosed CA2_7_7I1R2Value CA2_7_7I1R2Terms CA2_7_7I1R2Terms_sound) (by decide +kernel) +def CA2_7_7I1R2Mass : Ball := ⟨(573365682191614768638905503871 / 10000000000000000000000000000000), (37 / 100000000000000000000000000000000)⟩ +lemma CA2_7_7I1R2Mass_sound : CA2_7_7I1R2Mass.Encloses (∑ a, CA2_7_7I1R2Value a) := by + exact contains_sound (pairSumBall_sound CA2_7_7I1R2P CA2_7_7I1R2Value CA2_7_7I1R2P_sound) (by decide +kernel) +def CA2_7_7I1R2MassTermLogWitness : LogWitness := ⟨-5, 573365682191614768638905503871, 312500000000000000000000000000⟩ +def CA2_7_7I1R2MassTermLog : Ball := ⟨(-71470416750031097905684090412837 / 25000000000000000000000000000000), (127054942743 / 100000000000000000000000000000000)⟩ +lemma CA2_7_7I1R2MassTermLog_sound : CA2_7_7I1R2MassTermLog.Encloses (Real.log ((∑ a, CA2_7_7I1R2Value a))) := by + exact checkLog_sound logTwoBall_sound (CA2_7_7I1R2Mass_sound) (w := CA2_7_7I1R2MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA2_7_7I1R2MassTerm : Ball := ⟨(3278294740512047307358775649571 / 20000000000000000000000000000000), (7284894499 / 100000000000000000000000000000000)⟩ +lemma CA2_7_7I1R2MassTerm_sound : CA2_7_7I1R2MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_7_7I1R2Value a))) := by + exact contains_sound (entropyTerm_ball (CA2_7_7I1R2Mass_sound) CA2_7_7I1R2MassTermLog_sound) (by decide +kernel) +def CA2_7_7I1R2H : Ball := ⟨(2945210194414288821131102042503 / 50000000000000000000000000000000), (7815210787 / 50000000000000000000000000000000)⟩ +lemma CA2_7_7I1R2H_sound : CA2_7_7I1R2H.Encloses (homogeneousEntropy CA2_7_7I1R2Value) := by + exact contains_sound (homogeneous_enclosed CA2_7_7I1R2Value CA2_7_7I1R2MassTerm_sound CA2_7_7I1R2Entropy_sound) (by decide +kernel) +def CA2_7_7I1R3Value (a : PairSlot) : ℝ := residualLaw (below (shape 2 7 7)) (fun u => (stageALaw (shape 2 7 7) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 3 a +def CA2_7_7I1R3Raw (a : PairSlot) : Ball := residualBall (below (shape 2 7 7)) A2_7_7Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 3 a +lemma CA2_7_7I1R3Raw_sound (a : PairSlot) : + (CA2_7_7I1R3Raw a).Encloses (CA2_7_7I1R3Value a) := by + exact residualBall_sound_on (below (shape 2 7 7)) A2_7_7Law (fun u => (stageALaw (shape 2 7 7) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A2_7_7Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 2 7 7) (show (shape 2 7 7) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 3 a +def CA2_7_7I1R3Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(319186405843124656703421426049 / 50000000000000000000000000000000), (1 / 20000000000000000000000000000000)⟩ ⟨(161316905522863411870927740587 / 5000000000000000000000000000000), (60831317 / 5000000000000000000000000000000)⟩ ⟨(-505400300795229536061048437334033 / 100000000000000000000000000000000), (19058241393 / 10000000000000000000000000000000)⟩ ⟨-8, 319186405843124656703421426049, 195312500000000000000000000000⟩, + .log ⟨(4931876896034142675390643532267 / 25000000000000000000000000000000), (49 / 100000000000000000000000000000000)⟩ ⟨(32020826248307253689798850210269 / 100000000000000000000000000000000), (8354924511 / 50000000000000000000000000000000)⟩ ⟨(-162315620013022209206422899947421 / 100000000000000000000000000000000), (4235164749 / 5000000000000000000000000000000)⟩ ⟨-3, 4931876896034142675390643532267, 3125000000000000000000000000000⟩, + .log ⟨(212667623876061015012098285571 / 12500000000000000000000000000000), (1 / 20000000000000000000000000000000)⟩ ⟨(866355461712993848957458311427 / 12500000000000000000000000000000), (504382161 / 20000000000000000000000000000000)⟩ ⟨(-40737534276392287801647223947449 / 10000000000000000000000000000000), (74115383037 / 50000000000000000000000000000000)⟩ ⟨-6, 212667623876061015012098285571, 195312500000000000000000000000⟩] +lemma CA2_7_7I1R3Certificates_valid : + CA2_7_7I1R3Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_7_7I1R3CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 4, 0 => 1 + | 2, 1 => 2 + | 3, 1 => 3 + | 1, 2 => 2 + | 1, 3 => 3 + | 0, 4 => 1 + | _, _ => 0 +def CA2_7_7I1R3P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_7_7I1R3Certificates (CA2_7_7I1R3CertificateIndex a)).input +lemma CA2_7_7I1R3P_check : ∀ a : PairSlot, contains (CA2_7_7I1R3Raw a) (CA2_7_7I1R3P a) = true := by + decide +kernel +lemma CA2_7_7I1R3P_sound (a : PairSlot) : + (CA2_7_7I1R3P a).Encloses (CA2_7_7I1R3Value a) := + contains_sound (CA2_7_7I1R3Raw_sound a) (CA2_7_7I1R3P_check a) +def CA2_7_7I1R3Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_7_7I1R3Certificates (CA2_7_7I1R3CertificateIndex a)).output +lemma CA2_7_7I1R3Terms_sound (a : PairSlot) : + (CA2_7_7I1R3Terms a).Encloses (Foundation.entropyTerm (CA2_7_7I1R3Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_7_7I1R3Certificates_valid + (CA2_7_7I1R3CertificateIndex a) (CA2_7_7I1R3P_sound a) +def CA2_7_7I1R3Entropy : Ball := ⟨(1687120322098738908755082860537 / 2000000000000000000000000000000), (20448386167 / 50000000000000000000000000000000)⟩ +lemma CA2_7_7I1R3Entropy_sound : CA2_7_7I1R3Entropy.Encloses (Foundation.finiteEntropy CA2_7_7I1R3Value) := by + exact contains_sound (entropyPair_enclosed CA2_7_7I1R3Value CA2_7_7I1R3Terms CA2_7_7I1R3Terms_sound) (by decide +kernel) +def CA2_7_7I1R3Mass : Ball := ⟨(11033610693415654067533101632867 / 25000000000000000000000000000000), (59 / 50000000000000000000000000000000)⟩ +lemma CA2_7_7I1R3Mass_sound : CA2_7_7I1R3Mass.Encloses (∑ a, CA2_7_7I1R3Value a) := by + exact contains_sound (pairSumBall_sound CA2_7_7I1R3P CA2_7_7I1R3Value CA2_7_7I1R3P_sound) (by decide +kernel) +def CA2_7_7I1R3MassTermLogWitness : LogWitness := ⟨-2, 11033610693415654067533101632867, 6250000000000000000000000000000⟩ +def CA2_7_7I1R3MassTermLog : Ball := ⟨(-81792969309321574946819002094641 / 100000000000000000000000000000000), (15881867829 / 25000000000000000000000000000000)⟩ +lemma CA2_7_7I1R3MassTermLog_sound : CA2_7_7I1R3MassTermLog.Encloses (Real.log ((∑ a, CA2_7_7I1R3Value a))) := by + exact checkLog_sound logTwoBall_sound (CA2_7_7I1R3Mass_sound) (w := CA2_7_7I1R3MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA2_7_7I1R3MassTerm : Ball := ⟨(18049435616350978685957054139607 / 50000000000000000000000000000000), (28037495571 / 100000000000000000000000000000000)⟩ +lemma CA2_7_7I1R3MassTerm_sound : CA2_7_7I1R3MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_7_7I1R3Value a))) := by + exact contains_sound (entropyTerm_ball (CA2_7_7I1R3Mass_sound) CA2_7_7I1R3MassTermLog_sound) (by decide +kernel) +def CA2_7_7I1R3H : Ball := ⟨(12064286218058747016460008686909 / 25000000000000000000000000000000), (13786853581 / 20000000000000000000000000000000)⟩ +lemma CA2_7_7I1R3H_sound : CA2_7_7I1R3H.Encloses (homogeneousEntropy CA2_7_7I1R3Value) := by + exact contains_sound (homogeneous_enclosed CA2_7_7I1R3Value CA2_7_7I1R3MassTerm_sound CA2_7_7I1R3Entropy_sound) (by decide +kernel) +def CA2_7_7I1R4Value (a : PairSlot) : ℝ := residualLaw (below (shape 2 7 7)) (fun u => (stageALaw (shape 2 7 7) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 4 a +def CA2_7_7I1R4Raw (a : PairSlot) : Ball := residualBall (below (shape 2 7 7)) A2_7_7Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 4 a +lemma CA2_7_7I1R4Raw_sound (a : PairSlot) : + (CA2_7_7I1R4Raw a).Encloses (CA2_7_7I1R4Value a) := by + exact residualBall_sound_on (below (shape 2 7 7)) A2_7_7Law (fun u => (stageALaw (shape 2 7 7) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A2_7_7Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 2 7 7) (show (shape 2 7 7) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 4 a +def CA2_7_7I1R4Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(3994686615688407794575543003 / 10000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(312599217338392765931898463569 / 100000000000000000000000000000000), (109968023 / 100000000000000000000000000000000)⟩ ⟨(-782537523996791104538684222120479 / 100000000000000000000000000000000), (137642855191 / 50000000000000000000000000000000)⟩ ⟨-12, 3994686615688407794575543003, 2441406250000000000000000000⟩, + .log ⟨(4248035449603416421730568330403 / 100000000000000000000000000000000), (9 / 50000000000000000000000000000000)⟩ ⟨(6709163582794615931166082232097 / 50000000000000000000000000000000), (337333691 / 6250000000000000000000000000000)⟩ ⟨(-157935677853652631212439156419493 / 50000000000000000000000000000000), (127054942521 / 100000000000000000000000000000000)⟩ ⟨-5, 4248035449603416421730568330403, 3125000000000000000000000000000⟩, + .log ⟨(31141609959674067281134018926149 / 100000000000000000000000000000000), (81 / 100000000000000000000000000000000)⟩ ⟨(3633059069145374595738373947531 / 10000000000000000000000000000000), (19783477427 / 100000000000000000000000000000000)⟩ ⟨(-23332506404453077492658831608737 / 20000000000000000000000000000000), (63527471309 / 100000000000000000000000000000000)⟩ ⟨-2, 31141609959674067281134018926149, 25000000000000000000000000000000⟩, + .log ⟨(21435807383318659594624099329 / 1000000000000000000000000000000), (1 / 12500000000000000000000000000000)⟩ ⟨(4118560827156602913436404968533 / 50000000000000000000000000000000), (3177446183 / 100000000000000000000000000000000)⟩ ⟨(-384269251305333710696431207285663 / 100000000000000000000000000000000), (74115383077 / 50000000000000000000000000000000)⟩ ⟨-6, 21435807383318659594624099329, 15625000000000000000000000000⟩, + .log ⟨(129706705804216070720920218653 / 100000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ ⟨(862244740368455921490701627033 / 100000000000000000000000000000000), (302131113 / 100000000000000000000000000000000)⟩ ⟨(-41547810453510731302108942954391 / 6250000000000000000000000000000), (116467031027 / 50000000000000000000000000000000)⟩ ⟨-10, 129706705804216070720920218653, 97656250000000000000000000000⟩] +lemma CA2_7_7I1R4Certificates_valid : + CA2_7_7I1R4Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_7_7I1R4CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 0, 5 => 1 + | 1, 4 => 2 + | 2, 2 => 3 + | 2, 3 => 4 + | 3, 2 => 4 + | 3, 3 => 5 + | 4, 1 => 2 + | 5, 0 => 1 + | _, _ => 0 +def CA2_7_7I1R4P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_7_7I1R4Certificates (CA2_7_7I1R4CertificateIndex a)).input +lemma CA2_7_7I1R4P_check : ∀ a : PairSlot, contains (CA2_7_7I1R4Raw a) (CA2_7_7I1R4P a) = true := by + decide +kernel +lemma CA2_7_7I1R4P_sound (a : PairSlot) : + (CA2_7_7I1R4P a).Encloses (CA2_7_7I1R4Value a) := + contains_sound (CA2_7_7I1R4Raw_sound a) (CA2_7_7I1R4P_check a) +def CA2_7_7I1R4Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_7_7I1R4Certificates (CA2_7_7I1R4CertificateIndex a)).output +lemma CA2_7_7I1R4Terms_sound (a : PairSlot) : + (CA2_7_7I1R4Terms a).Encloses (Foundation.entropyTerm (CA2_7_7I1R4Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_7_7I1R4Certificates_valid + (CA2_7_7I1R4CertificateIndex a) (CA2_7_7I1R4P_sound a) +def CA2_7_7I1R4Entropy : Ball := ⟨(81128931506303862789148186832001 / 100000000000000000000000000000000), (4681889383 / 12500000000000000000000000000000)⟩ +lemma CA2_7_7I1R4Entropy_sound : CA2_7_7I1R4Entropy.Encloses (Foundation.finiteEntropy CA2_7_7I1R4Value) := by + exact contains_sound (entropyPair_enclosed CA2_7_7I1R4Value CA2_7_7I1R4Terms CA2_7_7I1R4Terms_sound) (by decide +kernel) +def CA2_7_7I1R4Mass : Ball := ⟨(11033610693415654067533101632867 / 25000000000000000000000000000000), (137 / 100000000000000000000000000000000)⟩ +lemma CA2_7_7I1R4Mass_sound : CA2_7_7I1R4Mass.Encloses (∑ a, CA2_7_7I1R4Value a) := by + exact contains_sound (pairSumBall_sound CA2_7_7I1R4P CA2_7_7I1R4Value CA2_7_7I1R4P_sound) (by decide +kernel) +def CA2_7_7I1R4MassTermLogWitness : LogWitness := ⟨-2, 11033610693415654067533101632867, 6250000000000000000000000000000⟩ +def CA2_7_7I1R4MassTermLog : Ball := ⟨(-81792969309321574946819002094641 / 100000000000000000000000000000000), (63527471359 / 100000000000000000000000000000000)⟩ +lemma CA2_7_7I1R4MassTermLog_sound : CA2_7_7I1R4MassTermLog.Encloses (Real.log ((∑ a, CA2_7_7I1R4Value a))) := by + exact checkLog_sound logTwoBall_sound (CA2_7_7I1R4Mass_sound) (w := CA2_7_7I1R4MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA2_7_7I1R4MassTerm : Ball := ⟨(18049435616350978685957054139607 / 50000000000000000000000000000000), (5607499121 / 20000000000000000000000000000000)⟩ +lemma CA2_7_7I1R4MassTerm_sound : CA2_7_7I1R4MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_7_7I1R4Value a))) := by + exact contains_sound (entropyTerm_ball (CA2_7_7I1R4Mass_sound) CA2_7_7I1R4MassTermLog_sound) (by decide +kernel) +def CA2_7_7I1R4H : Ball := ⟨(45030060273601905417234078552787 / 100000000000000000000000000000000), (65492610669 / 100000000000000000000000000000000)⟩ +lemma CA2_7_7I1R4H_sound : CA2_7_7I1R4H.Encloses (homogeneousEntropy CA2_7_7I1R4Value) := by + exact contains_sound (homogeneous_enclosed CA2_7_7I1R4Value CA2_7_7I1R4MassTerm_sound CA2_7_7I1R4Entropy_sound) (by decide +kernel) +def CA2_7_7I1R5Value (a : PairSlot) : ℝ := residualLaw (below (shape 2 7 7)) (fun u => (stageALaw (shape 2 7 7) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 5 a +def CA2_7_7I1R5Raw (a : PairSlot) : Ball := residualBall (below (shape 2 7 7)) A2_7_7Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 5 a +lemma CA2_7_7I1R5Raw_sound (a : PairSlot) : + (CA2_7_7I1R5Raw a).Encloses (CA2_7_7I1R5Value a) := by + exact residualBall_sound_on (below (shape 2 7 7)) A2_7_7Law (fun u => (stageALaw (shape 2 7 7) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A2_7_7Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 2 7 7) (show (shape 2 7 7) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 5 a +def CA2_7_7I1R5Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(100767844754924508667501994673 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(347654413195527167073773901443 / 50000000000000000000000000000000), (234722641 / 100000000000000000000000000000000)⟩ ⟨(-345005308033580177149038696772543 / 50000000000000000000000000000000), (46586812301 / 20000000000000000000000000000000)⟩ ⟨-10, 100767844754924508667501994673, 97656250000000000000000000000⟩, + .log ⟨(128328279892289891575263906127 / 5000000000000000000000000000000), (1 / 6250000000000000000000000000000)⟩ ⟨(9400307070204669460590086012587 / 100000000000000000000000000000000), (760887983 / 20000000000000000000000000000000)⟩ ⟨(-183130076201727585026414101691607 / 50000000000000000000000000000000), (37057691601 / 25000000000000000000000000000000)⟩ ⟨-6, 128328279892289891575263906127, 78125000000000000000000000000⟩, + .log ⟨(99747484178675751510873701071 / 50000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ ⟨(1240287439410929187097892052713 / 100000000000000000000000000000000), (422447043 / 100000000000000000000000000000000)⟩ ⟨(-31085682251123901333661096905369 / 5000000000000000000000000000000), (26469779729 / 12500000000000000000000000000000)⟩ ⟨-9, 99747484178675751510873701071, 97656250000000000000000000000⟩] +lemma CA2_7_7I1R5Certificates_valid : + CA2_7_7I1R5Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_7_7I1R5CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 1, 5 => 1 + | 2, 4 => 2 + | 3, 4 => 3 + | 4, 2 => 2 + | 4, 3 => 3 + | 5, 1 => 1 + | _, _ => 0 +def CA2_7_7I1R5P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_7_7I1R5Certificates (CA2_7_7I1R5CertificateIndex a)).input +lemma CA2_7_7I1R5P_check : ∀ a : PairSlot, contains (CA2_7_7I1R5Raw a) (CA2_7_7I1R5P a) = true := by + decide +kernel +lemma CA2_7_7I1R5P_sound (a : PairSlot) : + (CA2_7_7I1R5P a).Encloses (CA2_7_7I1R5Value a) := + contains_sound (CA2_7_7I1R5Raw_sound a) (CA2_7_7I1R5P_check a) +def CA2_7_7I1R5Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_7_7I1R5Certificates (CA2_7_7I1R5CertificateIndex a)).output +lemma CA2_7_7I1R5Terms_sound (a : PairSlot) : + (CA2_7_7I1R5Terms a).Encloses (Foundation.entropyTerm (CA2_7_7I1R5Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_7_7I1R5Certificates_valid + (CA2_7_7I1R5CertificateIndex a) (CA2_7_7I1R5P_sound a) +def CA2_7_7I1R5Entropy : Ball := ⟨(5667951668003326490917762934093 / 25000000000000000000000000000000), (4461609599 / 50000000000000000000000000000000)⟩ +lemma CA2_7_7I1R5Entropy_sound : CA2_7_7I1R5Entropy.Encloses (Foundation.finiteEntropy CA2_7_7I1R5Value) := by + exact contains_sound (entropyPair_enclosed CA2_7_7I1R5Value CA2_7_7I1R5Terms CA2_7_7I1R5Terms_sound) (by decide +kernel) +def CA2_7_7I1R5Mass : Ball := ⟨(573365682191614768638905503871 / 10000000000000000000000000000000), (19 / 50000000000000000000000000000000)⟩ +lemma CA2_7_7I1R5Mass_sound : CA2_7_7I1R5Mass.Encloses (∑ a, CA2_7_7I1R5Value a) := by + exact contains_sound (pairSumBall_sound CA2_7_7I1R5P CA2_7_7I1R5Value CA2_7_7I1R5P_sound) (by decide +kernel) +def CA2_7_7I1R5MassTermLogWitness : LogWitness := ⟨-5, 573365682191614768638905503871, 312500000000000000000000000000⟩ +def CA2_7_7I1R5MassTermLog : Ball := ⟨(-71470416750031097905684090412837 / 25000000000000000000000000000000), (127054942761 / 100000000000000000000000000000000)⟩ +lemma CA2_7_7I1R5MassTermLog_sound : CA2_7_7I1R5MassTermLog.Encloses (Real.log ((∑ a, CA2_7_7I1R5Value a))) := by + exact checkLog_sound logTwoBall_sound (CA2_7_7I1R5Mass_sound) (w := CA2_7_7I1R5MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA2_7_7I1R5MassTerm : Ball := ⟨(3278294740512047307358775649571 / 20000000000000000000000000000000), (3642447251 / 50000000000000000000000000000000)⟩ +lemma CA2_7_7I1R5MassTerm_sound : CA2_7_7I1R5MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_7_7I1R5Value a))) := by + exact contains_sound (entropyTerm_ball (CA2_7_7I1R5Mass_sound) CA2_7_7I1R5MassTermLog_sound) (by decide +kernel) +def CA2_7_7I1R5H : Ball := ⟨(6280332969453069426877173488517 / 100000000000000000000000000000000), (162081137 / 1000000000000000000000000000000)⟩ +lemma CA2_7_7I1R5H_sound : CA2_7_7I1R5H.Encloses (homogeneousEntropy CA2_7_7I1R5Value) := by + exact contains_sound (homogeneous_enclosed CA2_7_7I1R5Value CA2_7_7I1R5MassTerm_sound CA2_7_7I1R5Entropy_sound) (by decide +kernel) +def CA2_7_7I1R6Value (a : PairSlot) : ℝ := residualLaw (below (shape 2 7 7)) (fun u => (stageALaw (shape 2 7 7) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 6 a +def CA2_7_7I1R6Raw (a : PairSlot) : Ball := residualBall (below (shape 2 7 7)) A2_7_7Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 6 a +lemma CA2_7_7I1R6Raw_sound (a : PairSlot) : + (CA2_7_7I1R6Raw a).Encloses (CA2_7_7I1R6Value a) := by + exact residualBall_sound_on (below (shape 2 7 7)) A2_7_7Law (fun u => (stageALaw (shape 2 7 7) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A2_7_7Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 2 7 7) (show (shape 2 7 7) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 6 a +def CA2_7_7I1R6Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(9959407168548791733825735439 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(169733410514704021981757416199 / 100000000000000000000000000000000), (3690727 / 6250000000000000000000000000000)⟩ ⟨(-852126073581527594166230203002393 / 100000000000000000000000000000000), (148230768291 / 50000000000000000000000000000000)⟩ ⟨-13, 9959407168548791733825735439, 6103515625000000000000000000⟩, + .log ⟨(55025814211550424684177823 / 4000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(3079795507774160501234131027 / 20000000000000000000000000000000), (5243489 / 100000000000000000000000000000000)⟩ ⟨(-559700124733035406423617292816217 / 50000000000000000000000000000000), (381164898987 / 100000000000000000000000000000000)⟩ ⟨-17, 55025814211550424684177823, 30517578125000000000000000⟩, + .log ⟨(88319589956824610672646792579 / 100000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ ⟨(621060135132702437816815171041 / 100000000000000000000000000000000), (8977153 / 4000000000000000000000000000000)⟩ ⟨(-703196352515121730921719718825911 / 100000000000000000000000000000000), (12705494323 / 5000000000000000000000000000000)⟩ ⟨-11, 88319589956824610672646792579, 48828125000000000000000000000⟩] +lemma CA2_7_7I1R6Certificates_valid : + CA2_7_7I1R6Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_7_7I1R6CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 2, 5 => 1 + | 3, 5 => 2 + | 4, 4 => 3 + | 5, 2 => 1 + | 5, 3 => 2 + | _, _ => 0 +def CA2_7_7I1R6P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_7_7I1R6Certificates (CA2_7_7I1R6CertificateIndex a)).input +lemma CA2_7_7I1R6P_check : ∀ a : PairSlot, contains (CA2_7_7I1R6Raw a) (CA2_7_7I1R6P a) = true := by + decide +kernel +lemma CA2_7_7I1R6P_sound (a : PairSlot) : + (CA2_7_7I1R6P a).Encloses (CA2_7_7I1R6Value a) := + contains_sound (CA2_7_7I1R6Raw_sound a) (CA2_7_7I1R6P_check a) +def CA2_7_7I1R6Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_7_7I1R6Certificates (CA2_7_7I1R6CertificateIndex a)).output +lemma CA2_7_7I1R6Terms_sound (a : PairSlot) : + (CA2_7_7I1R6Terms a).Encloses (Foundation.entropyTerm (CA2_7_7I1R6Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_7_7I1R6Certificates_valid + (CA2_7_7I1R6CertificateIndex a) (CA2_7_7I1R6P_sound a) +def CA2_7_7I1R6Entropy : Ball := ⟨(991324911239852086792671313709 / 100000000000000000000000000000000), (353019067 / 100000000000000000000000000000000)⟩ +lemma CA2_7_7I1R6Entropy_sound : CA2_7_7I1R6Entropy.Encloses (Foundation.finiteEntropy CA2_7_7I1R6Value) := by + exact contains_sound (entropyPair_enclosed CA2_7_7I1R6Value CA2_7_7I1R6Terms CA2_7_7I1R6Terms_sound) (by decide +kernel) +def CA2_7_7I1R6Mass : Ball := ⟨(26181701868319459768431725097 / 20000000000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ +lemma CA2_7_7I1R6Mass_sound : CA2_7_7I1R6Mass.Encloses (∑ a, CA2_7_7I1R6Value a) := by + exact contains_sound (pairSumBall_sound CA2_7_7I1R6P CA2_7_7I1R6Value CA2_7_7I1R6P_sound) (by decide +kernel) +def CA2_7_7I1R6MassTermLogWitness : LogWitness := ⟨-10, 26181701868319459768431725097, 19531250000000000000000000000⟩ +def CA2_7_7I1R6MassTermLog : Ball := ⟨(-331921339386894290060685881598867 / 50000000000000000000000000000000), (29116758137 / 12500000000000000000000000000000)⟩ +lemma CA2_7_7I1R6MassTermLog_sound : CA2_7_7I1R6MassTermLog.Encloses (Real.log ((∑ a, CA2_7_7I1R6Value a))) := by + exact checkLog_sound logTwoBall_sound (CA2_7_7I1R6Mass_sound) (w := CA2_7_7I1R6MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA2_7_7I1R6MassTerm : Ball := ⟨(43451327757804738615092393321 / 5000000000000000000000000000000), (304930553 / 100000000000000000000000000000000)⟩ +lemma CA2_7_7I1R6MassTerm_sound : CA2_7_7I1R6MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_7_7I1R6Value a))) := by + exact contains_sound (entropyTerm_ball (CA2_7_7I1R6Mass_sound) CA2_7_7I1R6MassTermLog_sound) (by decide +kernel) +def CA2_7_7I1R6H : Ball := ⟨(122298356083757314490823447289 / 100000000000000000000000000000000), (32897481 / 5000000000000000000000000000000)⟩ +lemma CA2_7_7I1R6H_sound : CA2_7_7I1R6H.Encloses (homogeneousEntropy CA2_7_7I1R6Value) := by + exact contains_sound (homogeneous_enclosed CA2_7_7I1R6Value CA2_7_7I1R6MassTerm_sound CA2_7_7I1R6Entropy_sound) (by decide +kernel) +def CA2_7_7I1R7Value (a : PairSlot) : ℝ := residualLaw (below (shape 2 7 7)) (fun u => (stageALaw (shape 2 7 7) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 7 a +def CA2_7_7I1R7Raw (a : PairSlot) : Ball := residualBall (below (shape 2 7 7)) A2_7_7Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 7 a +lemma CA2_7_7I1R7Raw_sound (a : PairSlot) : + (CA2_7_7I1R7Raw a).Encloses (CA2_7_7I1R7Value a) := by + exact residualBall_sound_on (below (shape 2 7 7)) A2_7_7Law (fun u => (stageALaw (shape 2 7 7) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A2_7_7Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 2 7 7) (show (shape 2 7 7) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 7 a +def CA2_7_7I1R7Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(61223223962159475536795967 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(395497734704434699516257969 / 12500000000000000000000000000000), (129647 / 12500000000000000000000000000000)⟩ ⟨(-1291985978879131993165599986787771 / 100000000000000000000000000000000), (423516882001 / 100000000000000000000000000000000)⟩ ⟨-19, 61223223962159475536795967, 47683715820312500000000000⟩] +lemma CA2_7_7I1R7Certificates_valid : + CA2_7_7I1R7Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_7_7I1R7CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 4, 5 => 1 + | 5, 4 => 1 + | _, _ => 0 +def CA2_7_7I1R7P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_7_7I1R7Certificates (CA2_7_7I1R7CertificateIndex a)).input +lemma CA2_7_7I1R7P_check : ∀ a : PairSlot, contains (CA2_7_7I1R7Raw a) (CA2_7_7I1R7P a) = true := by + decide +kernel +lemma CA2_7_7I1R7P_sound (a : PairSlot) : + (CA2_7_7I1R7P a).Encloses (CA2_7_7I1R7Value a) := + contains_sound (CA2_7_7I1R7Raw_sound a) (CA2_7_7I1R7P_check a) +def CA2_7_7I1R7Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_7_7I1R7Certificates (CA2_7_7I1R7CertificateIndex a)).output +lemma CA2_7_7I1R7Terms_sound (a : PairSlot) : + (CA2_7_7I1R7Terms a).Encloses (Foundation.entropyTerm (CA2_7_7I1R7Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_7_7I1R7Certificates_valid + (CA2_7_7I1R7CertificateIndex a) (CA2_7_7I1R7P_sound a) +def CA2_7_7I1R7Entropy : Ball := ⟨(395497734704434699516257969 / 6250000000000000000000000000000), (129647 / 6250000000000000000000000000000)⟩ +lemma CA2_7_7I1R7Entropy_sound : CA2_7_7I1R7Entropy.Encloses (Foundation.finiteEntropy CA2_7_7I1R7Value) := by + exact contains_sound (entropyPair_enclosed CA2_7_7I1R7Value CA2_7_7I1R7Terms CA2_7_7I1R7Terms_sound) (by decide +kernel) +def CA2_7_7I1R7Mass : Ball := ⟨(61223223962159475536795967 / 12500000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ +lemma CA2_7_7I1R7Mass_sound : CA2_7_7I1R7Mass.Encloses (∑ a, CA2_7_7I1R7Value a) := by + exact contains_sound (pairSumBall_sound CA2_7_7I1R7P CA2_7_7I1R7Value CA2_7_7I1R7P_sound) (by decide +kernel) +def CA2_7_7I1R7MassTermLogWitness : LogWitness := ⟨-18, 61223223962159475536795967, 47683715820312500000000000⟩ +def CA2_7_7I1R7MassTermLog : Ball := ⟨(-1222671260823137462223876793737441 / 100000000000000000000000000000000), (201170529159 / 50000000000000000000000000000000)⟩ +lemma CA2_7_7I1R7MassTermLog_sound : CA2_7_7I1R7MassTermLog.Encloses (Real.log ((∑ a, CA2_7_7I1R7Value a))) := by + exact checkLog_sound logTwoBall_sound (CA2_7_7I1R7Mass_sound) (w := CA2_7_7I1R7MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA2_7_7I1R7MassTerm : Ball := ⟨(1497117528669416949537789903 / 25000000000000000000000000000000), (985317 / 50000000000000000000000000000000)⟩ +lemma CA2_7_7I1R7MassTerm_sound : CA2_7_7I1R7MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_7_7I1R7Value a))) := by + exact contains_sound (entropyTerm_ball (CA2_7_7I1R7Mass_sound) CA2_7_7I1R7MassTermLog_sound) (by decide +kernel) +def CA2_7_7I1R7H : Ball := ⟨(84873410148321848527241973 / 25000000000000000000000000000000), (2022493 / 50000000000000000000000000000000)⟩ +lemma CA2_7_7I1R7H_sound : CA2_7_7I1R7H.Encloses (homogeneousEntropy CA2_7_7I1R7Value) := by + exact contains_sound (homogeneous_enclosed CA2_7_7I1R7Value CA2_7_7I1R7MassTerm_sound CA2_7_7I1R7Entropy_sound) (by decide +kernel) +def CA2_7_7I1R8Value (a : PairSlot) : ℝ := residualLaw (below (shape 2 7 7)) (fun u => (stageALaw (shape 2 7 7) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 8 a +def CA2_7_7I1R8Raw (a : PairSlot) : Ball := residualBall (below (shape 2 7 7)) A2_7_7Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 8 a +lemma CA2_7_7I1R8Raw_sound (a : PairSlot) : + (CA2_7_7I1R8Raw a).Encloses (CA2_7_7I1R8Value a) := by + exact residualBall_sound_on (below (shape 2 7 7)) A2_7_7Law (fun u => (stageALaw (shape 2 7 7) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A2_7_7Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 2 7 7) (show (shape 2 7 7) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 8 a +def CA2_7_7I1R8Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA2_7_7I1R8Certificates_valid : + CA2_7_7I1R8Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_7_7I1R8CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA2_7_7I1R8P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_7_7I1R8Certificates (CA2_7_7I1R8CertificateIndex a)).input +lemma CA2_7_7I1R8P_check : ∀ a : PairSlot, contains (CA2_7_7I1R8Raw a) (CA2_7_7I1R8P a) = true := by + decide +kernel +lemma CA2_7_7I1R8P_sound (a : PairSlot) : + (CA2_7_7I1R8P a).Encloses (CA2_7_7I1R8Value a) := + contains_sound (CA2_7_7I1R8Raw_sound a) (CA2_7_7I1R8P_check a) +def CA2_7_7I1R8Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_7_7I1R8Certificates (CA2_7_7I1R8CertificateIndex a)).output +lemma CA2_7_7I1R8Terms_sound (a : PairSlot) : + (CA2_7_7I1R8Terms a).Encloses (Foundation.entropyTerm (CA2_7_7I1R8Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_7_7I1R8Certificates_valid + (CA2_7_7I1R8CertificateIndex a) (CA2_7_7I1R8P_sound a) +def CA2_7_7I1R8Entropy : Ball := ⟨0, 0⟩ +lemma CA2_7_7I1R8Entropy_sound : CA2_7_7I1R8Entropy.Encloses (Foundation.finiteEntropy CA2_7_7I1R8Value) := by + exact contains_sound (entropyPair_enclosed CA2_7_7I1R8Value CA2_7_7I1R8Terms CA2_7_7I1R8Terms_sound) (by decide +kernel) +def CA2_7_7I1R8Mass : Ball := ⟨0, 0⟩ +lemma CA2_7_7I1R8Mass_sound : CA2_7_7I1R8Mass.Encloses (∑ a, CA2_7_7I1R8Value a) := by + exact contains_sound (pairSumBall_sound CA2_7_7I1R8P CA2_7_7I1R8Value CA2_7_7I1R8P_sound) (by decide +kernel) +def CA2_7_7I1R8MassTerm : Ball := .exact 0 +lemma CA2_7_7I1R8MassTerm_sound : CA2_7_7I1R8MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_7_7I1R8Value a))) := + entropyTerm_zero_ball (CA2_7_7I1R8Mass_sound) +def CA2_7_7I1R8H : Ball := ⟨0, 0⟩ +lemma CA2_7_7I1R8H_sound : CA2_7_7I1R8H.Encloses (homogeneousEntropy CA2_7_7I1R8Value) := by + exact contains_sound (homogeneous_enclosed CA2_7_7I1R8Value CA2_7_7I1R8MassTerm_sound CA2_7_7I1R8Entropy_sound) (by decide +kernel) +def CA2_7_7I1R9Value (a : PairSlot) : ℝ := residualLaw (below (shape 2 7 7)) (fun u => (stageALaw (shape 2 7 7) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 9 a +def CA2_7_7I1R9Raw (a : PairSlot) : Ball := residualBall (below (shape 2 7 7)) A2_7_7Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 9 a +lemma CA2_7_7I1R9Raw_sound (a : PairSlot) : + (CA2_7_7I1R9Raw a).Encloses (CA2_7_7I1R9Value a) := by + exact residualBall_sound_on (below (shape 2 7 7)) A2_7_7Law (fun u => (stageALaw (shape 2 7 7) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A2_7_7Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 2 7 7) (show (shape 2 7 7) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 9 a +def CA2_7_7I1R9Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA2_7_7I1R9Certificates_valid : + CA2_7_7I1R9Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_7_7I1R9CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA2_7_7I1R9P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_7_7I1R9Certificates (CA2_7_7I1R9CertificateIndex a)).input +lemma CA2_7_7I1R9P_check : ∀ a : PairSlot, contains (CA2_7_7I1R9Raw a) (CA2_7_7I1R9P a) = true := by + decide +kernel +lemma CA2_7_7I1R9P_sound (a : PairSlot) : + (CA2_7_7I1R9P a).Encloses (CA2_7_7I1R9Value a) := + contains_sound (CA2_7_7I1R9Raw_sound a) (CA2_7_7I1R9P_check a) +def CA2_7_7I1R9Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_7_7I1R9Certificates (CA2_7_7I1R9CertificateIndex a)).output +lemma CA2_7_7I1R9Terms_sound (a : PairSlot) : + (CA2_7_7I1R9Terms a).Encloses (Foundation.entropyTerm (CA2_7_7I1R9Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_7_7I1R9Certificates_valid + (CA2_7_7I1R9CertificateIndex a) (CA2_7_7I1R9P_sound a) +def CA2_7_7I1R9Entropy : Ball := ⟨0, 0⟩ +lemma CA2_7_7I1R9Entropy_sound : CA2_7_7I1R9Entropy.Encloses (Foundation.finiteEntropy CA2_7_7I1R9Value) := by + exact contains_sound (entropyPair_enclosed CA2_7_7I1R9Value CA2_7_7I1R9Terms CA2_7_7I1R9Terms_sound) (by decide +kernel) +def CA2_7_7I1R9Mass : Ball := ⟨0, 0⟩ +lemma CA2_7_7I1R9Mass_sound : CA2_7_7I1R9Mass.Encloses (∑ a, CA2_7_7I1R9Value a) := by + exact contains_sound (pairSumBall_sound CA2_7_7I1R9P CA2_7_7I1R9Value CA2_7_7I1R9P_sound) (by decide +kernel) +def CA2_7_7I1R9MassTerm : Ball := .exact 0 +lemma CA2_7_7I1R9MassTerm_sound : CA2_7_7I1R9MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_7_7I1R9Value a))) := + entropyTerm_zero_ball (CA2_7_7I1R9Mass_sound) +def CA2_7_7I1R9H : Ball := ⟨0, 0⟩ +lemma CA2_7_7I1R9H_sound : CA2_7_7I1R9H.Encloses (homogeneousEntropy CA2_7_7I1R9Value) := by + exact contains_sound (homogeneous_enclosed CA2_7_7I1R9Value CA2_7_7I1R9MassTerm_sound CA2_7_7I1R9Entropy_sound) (by decide +kernel) +def CA2_7_7I1R10Value (a : PairSlot) : ℝ := residualLaw (below (shape 2 7 7)) (fun u => (stageALaw (shape 2 7 7) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 10 a +def CA2_7_7I1R10Raw (a : PairSlot) : Ball := residualBall (below (shape 2 7 7)) A2_7_7Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 10 a +lemma CA2_7_7I1R10Raw_sound (a : PairSlot) : + (CA2_7_7I1R10Raw a).Encloses (CA2_7_7I1R10Value a) := by + exact residualBall_sound_on (below (shape 2 7 7)) A2_7_7Law (fun u => (stageALaw (shape 2 7 7) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A2_7_7Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 2 7 7) (show (shape 2 7 7) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 10 a +def CA2_7_7I1R10Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA2_7_7I1R10Certificates_valid : + CA2_7_7I1R10Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_7_7I1R10CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA2_7_7I1R10P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_7_7I1R10Certificates (CA2_7_7I1R10CertificateIndex a)).input +lemma CA2_7_7I1R10P_check : ∀ a : PairSlot, contains (CA2_7_7I1R10Raw a) (CA2_7_7I1R10P a) = true := by + decide +kernel +lemma CA2_7_7I1R10P_sound (a : PairSlot) : + (CA2_7_7I1R10P a).Encloses (CA2_7_7I1R10Value a) := + contains_sound (CA2_7_7I1R10Raw_sound a) (CA2_7_7I1R10P_check a) +def CA2_7_7I1R10Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_7_7I1R10Certificates (CA2_7_7I1R10CertificateIndex a)).output +lemma CA2_7_7I1R10Terms_sound (a : PairSlot) : + (CA2_7_7I1R10Terms a).Encloses (Foundation.entropyTerm (CA2_7_7I1R10Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_7_7I1R10Certificates_valid + (CA2_7_7I1R10CertificateIndex a) (CA2_7_7I1R10P_sound a) +def CA2_7_7I1R10Entropy : Ball := ⟨0, 0⟩ +lemma CA2_7_7I1R10Entropy_sound : CA2_7_7I1R10Entropy.Encloses (Foundation.finiteEntropy CA2_7_7I1R10Value) := by + exact contains_sound (entropyPair_enclosed CA2_7_7I1R10Value CA2_7_7I1R10Terms CA2_7_7I1R10Terms_sound) (by decide +kernel) +def CA2_7_7I1R10Mass : Ball := ⟨0, 0⟩ +lemma CA2_7_7I1R10Mass_sound : CA2_7_7I1R10Mass.Encloses (∑ a, CA2_7_7I1R10Value a) := by + exact contains_sound (pairSumBall_sound CA2_7_7I1R10P CA2_7_7I1R10Value CA2_7_7I1R10P_sound) (by decide +kernel) +def CA2_7_7I1R10MassTerm : Ball := .exact 0 +lemma CA2_7_7I1R10MassTerm_sound : CA2_7_7I1R10MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_7_7I1R10Value a))) := + entropyTerm_zero_ball (CA2_7_7I1R10Mass_sound) +def CA2_7_7I1R10H : Ball := ⟨0, 0⟩ +lemma CA2_7_7I1R10H_sound : CA2_7_7I1R10H.Encloses (homogeneousEntropy CA2_7_7I1R10Value) := by + exact contains_sound (homogeneous_enclosed CA2_7_7I1R10Value CA2_7_7I1R10MassTerm_sound CA2_7_7I1R10Entropy_sound) (by decide +kernel) +def CA2_7_7I1R11Value (a : PairSlot) : ℝ := residualLaw (below (shape 2 7 7)) (fun u => (stageALaw (shape 2 7 7) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 11 a +def CA2_7_7I1R11Raw (a : PairSlot) : Ball := residualBall (below (shape 2 7 7)) A2_7_7Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 11 a +lemma CA2_7_7I1R11Raw_sound (a : PairSlot) : + (CA2_7_7I1R11Raw a).Encloses (CA2_7_7I1R11Value a) := by + exact residualBall_sound_on (below (shape 2 7 7)) A2_7_7Law (fun u => (stageALaw (shape 2 7 7) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A2_7_7Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 2 7 7) (show (shape 2 7 7) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 11 a +def CA2_7_7I1R11Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA2_7_7I1R11Certificates_valid : + CA2_7_7I1R11Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_7_7I1R11CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA2_7_7I1R11P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_7_7I1R11Certificates (CA2_7_7I1R11CertificateIndex a)).input +lemma CA2_7_7I1R11P_check : ∀ a : PairSlot, contains (CA2_7_7I1R11Raw a) (CA2_7_7I1R11P a) = true := by + decide +kernel +lemma CA2_7_7I1R11P_sound (a : PairSlot) : + (CA2_7_7I1R11P a).Encloses (CA2_7_7I1R11Value a) := + contains_sound (CA2_7_7I1R11Raw_sound a) (CA2_7_7I1R11P_check a) +def CA2_7_7I1R11Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_7_7I1R11Certificates (CA2_7_7I1R11CertificateIndex a)).output +lemma CA2_7_7I1R11Terms_sound (a : PairSlot) : + (CA2_7_7I1R11Terms a).Encloses (Foundation.entropyTerm (CA2_7_7I1R11Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_7_7I1R11Certificates_valid + (CA2_7_7I1R11CertificateIndex a) (CA2_7_7I1R11P_sound a) +def CA2_7_7I1R11Entropy : Ball := ⟨0, 0⟩ +lemma CA2_7_7I1R11Entropy_sound : CA2_7_7I1R11Entropy.Encloses (Foundation.finiteEntropy CA2_7_7I1R11Value) := by + exact contains_sound (entropyPair_enclosed CA2_7_7I1R11Value CA2_7_7I1R11Terms CA2_7_7I1R11Terms_sound) (by decide +kernel) +def CA2_7_7I1R11Mass : Ball := ⟨0, 0⟩ +lemma CA2_7_7I1R11Mass_sound : CA2_7_7I1R11Mass.Encloses (∑ a, CA2_7_7I1R11Value a) := by + exact contains_sound (pairSumBall_sound CA2_7_7I1R11P CA2_7_7I1R11Value CA2_7_7I1R11P_sound) (by decide +kernel) +def CA2_7_7I1R11MassTerm : Ball := .exact 0 +lemma CA2_7_7I1R11MassTerm_sound : CA2_7_7I1R11MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_7_7I1R11Value a))) := + entropyTerm_zero_ball (CA2_7_7I1R11Mass_sound) +def CA2_7_7I1R11H : Ball := ⟨0, 0⟩ +lemma CA2_7_7I1R11H_sound : CA2_7_7I1R11H.Encloses (homogeneousEntropy CA2_7_7I1R11Value) := by + exact contains_sound (homogeneous_enclosed CA2_7_7I1R11Value CA2_7_7I1R11MassTerm_sound CA2_7_7I1R11Entropy_sound) (by decide +kernel) +def CA2_7_7I1R12Value (a : PairSlot) : ℝ := residualLaw (below (shape 2 7 7)) (fun u => (stageALaw (shape 2 7 7) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 12 a +def CA2_7_7I1R12Raw (a : PairSlot) : Ball := residualBall (below (shape 2 7 7)) A2_7_7Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 12 a +lemma CA2_7_7I1R12Raw_sound (a : PairSlot) : + (CA2_7_7I1R12Raw a).Encloses (CA2_7_7I1R12Value a) := by + exact residualBall_sound_on (below (shape 2 7 7)) A2_7_7Law (fun u => (stageALaw (shape 2 7 7) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A2_7_7Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 2 7 7) (show (shape 2 7 7) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 12 a +def CA2_7_7I1R12Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA2_7_7I1R12Certificates_valid : + CA2_7_7I1R12Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_7_7I1R12CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA2_7_7I1R12P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_7_7I1R12Certificates (CA2_7_7I1R12CertificateIndex a)).input +lemma CA2_7_7I1R12P_check : ∀ a : PairSlot, contains (CA2_7_7I1R12Raw a) (CA2_7_7I1R12P a) = true := by + decide +kernel +lemma CA2_7_7I1R12P_sound (a : PairSlot) : + (CA2_7_7I1R12P a).Encloses (CA2_7_7I1R12Value a) := + contains_sound (CA2_7_7I1R12Raw_sound a) (CA2_7_7I1R12P_check a) +def CA2_7_7I1R12Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_7_7I1R12Certificates (CA2_7_7I1R12CertificateIndex a)).output +lemma CA2_7_7I1R12Terms_sound (a : PairSlot) : + (CA2_7_7I1R12Terms a).Encloses (Foundation.entropyTerm (CA2_7_7I1R12Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_7_7I1R12Certificates_valid + (CA2_7_7I1R12CertificateIndex a) (CA2_7_7I1R12P_sound a) +def CA2_7_7I1R12Entropy : Ball := ⟨0, 0⟩ +lemma CA2_7_7I1R12Entropy_sound : CA2_7_7I1R12Entropy.Encloses (Foundation.finiteEntropy CA2_7_7I1R12Value) := by + exact contains_sound (entropyPair_enclosed CA2_7_7I1R12Value CA2_7_7I1R12Terms CA2_7_7I1R12Terms_sound) (by decide +kernel) +def CA2_7_7I1R12Mass : Ball := ⟨0, 0⟩ +lemma CA2_7_7I1R12Mass_sound : CA2_7_7I1R12Mass.Encloses (∑ a, CA2_7_7I1R12Value a) := by + exact contains_sound (pairSumBall_sound CA2_7_7I1R12P CA2_7_7I1R12Value CA2_7_7I1R12P_sound) (by decide +kernel) +def CA2_7_7I1R12MassTerm : Ball := .exact 0 +lemma CA2_7_7I1R12MassTerm_sound : CA2_7_7I1R12MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_7_7I1R12Value a))) := + entropyTerm_zero_ball (CA2_7_7I1R12Mass_sound) +def CA2_7_7I1R12H : Ball := ⟨0, 0⟩ +lemma CA2_7_7I1R12H_sound : CA2_7_7I1R12H.Encloses (homogeneousEntropy CA2_7_7I1R12Value) := by + exact contains_sound (homogeneous_enclosed CA2_7_7I1R12Value CA2_7_7I1R12MassTerm_sound CA2_7_7I1R12Entropy_sound) (by decide +kernel) +def CA2_7_7I1R13Value (a : PairSlot) : ℝ := residualLaw (below (shape 2 7 7)) (fun u => (stageALaw (shape 2 7 7) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 13 a +def CA2_7_7I1R13Raw (a : PairSlot) : Ball := residualBall (below (shape 2 7 7)) A2_7_7Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 13 a +lemma CA2_7_7I1R13Raw_sound (a : PairSlot) : + (CA2_7_7I1R13Raw a).Encloses (CA2_7_7I1R13Value a) := by + exact residualBall_sound_on (below (shape 2 7 7)) A2_7_7Law (fun u => (stageALaw (shape 2 7 7) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A2_7_7Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 2 7 7) (show (shape 2 7 7) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 13 a +def CA2_7_7I1R13Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA2_7_7I1R13Certificates_valid : + CA2_7_7I1R13Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_7_7I1R13CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA2_7_7I1R13P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_7_7I1R13Certificates (CA2_7_7I1R13CertificateIndex a)).input +lemma CA2_7_7I1R13P_check : ∀ a : PairSlot, contains (CA2_7_7I1R13Raw a) (CA2_7_7I1R13P a) = true := by + decide +kernel +lemma CA2_7_7I1R13P_sound (a : PairSlot) : + (CA2_7_7I1R13P a).Encloses (CA2_7_7I1R13Value a) := + contains_sound (CA2_7_7I1R13Raw_sound a) (CA2_7_7I1R13P_check a) +def CA2_7_7I1R13Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_7_7I1R13Certificates (CA2_7_7I1R13CertificateIndex a)).output +lemma CA2_7_7I1R13Terms_sound (a : PairSlot) : + (CA2_7_7I1R13Terms a).Encloses (Foundation.entropyTerm (CA2_7_7I1R13Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_7_7I1R13Certificates_valid + (CA2_7_7I1R13CertificateIndex a) (CA2_7_7I1R13P_sound a) +def CA2_7_7I1R13Entropy : Ball := ⟨0, 0⟩ +lemma CA2_7_7I1R13Entropy_sound : CA2_7_7I1R13Entropy.Encloses (Foundation.finiteEntropy CA2_7_7I1R13Value) := by + exact contains_sound (entropyPair_enclosed CA2_7_7I1R13Value CA2_7_7I1R13Terms CA2_7_7I1R13Terms_sound) (by decide +kernel) +def CA2_7_7I1R13Mass : Ball := ⟨0, 0⟩ +lemma CA2_7_7I1R13Mass_sound : CA2_7_7I1R13Mass.Encloses (∑ a, CA2_7_7I1R13Value a) := by + exact contains_sound (pairSumBall_sound CA2_7_7I1R13P CA2_7_7I1R13Value CA2_7_7I1R13P_sound) (by decide +kernel) +def CA2_7_7I1R13MassTerm : Ball := .exact 0 +lemma CA2_7_7I1R13MassTerm_sound : CA2_7_7I1R13MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_7_7I1R13Value a))) := + entropyTerm_zero_ball (CA2_7_7I1R13Mass_sound) +def CA2_7_7I1R13H : Ball := ⟨0, 0⟩ +lemma CA2_7_7I1R13H_sound : CA2_7_7I1R13H.Encloses (homogeneousEntropy CA2_7_7I1R13Value) := by + exact contains_sound (homogeneous_enclosed CA2_7_7I1R13Value CA2_7_7I1R13MassTerm_sound CA2_7_7I1R13Entropy_sound) (by decide +kernel) +def CA2_7_7I1R14Value (a : PairSlot) : ℝ := residualLaw (below (shape 2 7 7)) (fun u => (stageALaw (shape 2 7 7) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 14 a +def CA2_7_7I1R14Raw (a : PairSlot) : Ball := residualBall (below (shape 2 7 7)) A2_7_7Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 14 a +lemma CA2_7_7I1R14Raw_sound (a : PairSlot) : + (CA2_7_7I1R14Raw a).Encloses (CA2_7_7I1R14Value a) := by + exact residualBall_sound_on (below (shape 2 7 7)) A2_7_7Law (fun u => (stageALaw (shape 2 7 7) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A2_7_7Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 2 7 7) (show (shape 2 7 7) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 14 a +def CA2_7_7I1R14Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA2_7_7I1R14Certificates_valid : + CA2_7_7I1R14Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_7_7I1R14CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA2_7_7I1R14P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_7_7I1R14Certificates (CA2_7_7I1R14CertificateIndex a)).input +lemma CA2_7_7I1R14P_check : ∀ a : PairSlot, contains (CA2_7_7I1R14Raw a) (CA2_7_7I1R14P a) = true := by + decide +kernel +lemma CA2_7_7I1R14P_sound (a : PairSlot) : + (CA2_7_7I1R14P a).Encloses (CA2_7_7I1R14Value a) := + contains_sound (CA2_7_7I1R14Raw_sound a) (CA2_7_7I1R14P_check a) +def CA2_7_7I1R14Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_7_7I1R14Certificates (CA2_7_7I1R14CertificateIndex a)).output +lemma CA2_7_7I1R14Terms_sound (a : PairSlot) : + (CA2_7_7I1R14Terms a).Encloses (Foundation.entropyTerm (CA2_7_7I1R14Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_7_7I1R14Certificates_valid + (CA2_7_7I1R14CertificateIndex a) (CA2_7_7I1R14P_sound a) +def CA2_7_7I1R14Entropy : Ball := ⟨0, 0⟩ +lemma CA2_7_7I1R14Entropy_sound : CA2_7_7I1R14Entropy.Encloses (Foundation.finiteEntropy CA2_7_7I1R14Value) := by + exact contains_sound (entropyPair_enclosed CA2_7_7I1R14Value CA2_7_7I1R14Terms CA2_7_7I1R14Terms_sound) (by decide +kernel) +def CA2_7_7I1R14Mass : Ball := ⟨0, 0⟩ +lemma CA2_7_7I1R14Mass_sound : CA2_7_7I1R14Mass.Encloses (∑ a, CA2_7_7I1R14Value a) := by + exact contains_sound (pairSumBall_sound CA2_7_7I1R14P CA2_7_7I1R14Value CA2_7_7I1R14P_sound) (by decide +kernel) +def CA2_7_7I1R14MassTerm : Ball := .exact 0 +lemma CA2_7_7I1R14MassTerm_sound : CA2_7_7I1R14MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_7_7I1R14Value a))) := + entropyTerm_zero_ball (CA2_7_7I1R14Mass_sound) +def CA2_7_7I1R14H : Ball := ⟨0, 0⟩ +lemma CA2_7_7I1R14H_sound : CA2_7_7I1R14H.Encloses (homogeneousEntropy CA2_7_7I1R14Value) := by + exact contains_sound (homogeneous_enclosed CA2_7_7I1R14Value CA2_7_7I1R14MassTerm_sound CA2_7_7I1R14Entropy_sound) (by decide +kernel) +def CA2_7_7I1R15Value (a : PairSlot) : ℝ := residualLaw (below (shape 2 7 7)) (fun u => (stageALaw (shape 2 7 7) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 15 a +def CA2_7_7I1R15Raw (a : PairSlot) : Ball := residualBall (below (shape 2 7 7)) A2_7_7Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 15 a +lemma CA2_7_7I1R15Raw_sound (a : PairSlot) : + (CA2_7_7I1R15Raw a).Encloses (CA2_7_7I1R15Value a) := by + exact residualBall_sound_on (below (shape 2 7 7)) A2_7_7Law (fun u => (stageALaw (shape 2 7 7) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A2_7_7Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 2 7 7) (show (shape 2 7 7) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 15 a +def CA2_7_7I1R15Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA2_7_7I1R15Certificates_valid : + CA2_7_7I1R15Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_7_7I1R15CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA2_7_7I1R15P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_7_7I1R15Certificates (CA2_7_7I1R15CertificateIndex a)).input +lemma CA2_7_7I1R15P_check : ∀ a : PairSlot, contains (CA2_7_7I1R15Raw a) (CA2_7_7I1R15P a) = true := by + decide +kernel +lemma CA2_7_7I1R15P_sound (a : PairSlot) : + (CA2_7_7I1R15P a).Encloses (CA2_7_7I1R15Value a) := + contains_sound (CA2_7_7I1R15Raw_sound a) (CA2_7_7I1R15P_check a) +def CA2_7_7I1R15Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_7_7I1R15Certificates (CA2_7_7I1R15CertificateIndex a)).output +lemma CA2_7_7I1R15Terms_sound (a : PairSlot) : + (CA2_7_7I1R15Terms a).Encloses (Foundation.entropyTerm (CA2_7_7I1R15Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_7_7I1R15Certificates_valid + (CA2_7_7I1R15CertificateIndex a) (CA2_7_7I1R15P_sound a) +def CA2_7_7I1R15Entropy : Ball := ⟨0, 0⟩ +lemma CA2_7_7I1R15Entropy_sound : CA2_7_7I1R15Entropy.Encloses (Foundation.finiteEntropy CA2_7_7I1R15Value) := by + exact contains_sound (entropyPair_enclosed CA2_7_7I1R15Value CA2_7_7I1R15Terms CA2_7_7I1R15Terms_sound) (by decide +kernel) +def CA2_7_7I1R15Mass : Ball := ⟨0, 0⟩ +lemma CA2_7_7I1R15Mass_sound : CA2_7_7I1R15Mass.Encloses (∑ a, CA2_7_7I1R15Value a) := by + exact contains_sound (pairSumBall_sound CA2_7_7I1R15P CA2_7_7I1R15Value CA2_7_7I1R15P_sound) (by decide +kernel) +def CA2_7_7I1R15MassTerm : Ball := .exact 0 +lemma CA2_7_7I1R15MassTerm_sound : CA2_7_7I1R15MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_7_7I1R15Value a))) := + entropyTerm_zero_ball (CA2_7_7I1R15Mass_sound) +def CA2_7_7I1R15H : Ball := ⟨0, 0⟩ +lemma CA2_7_7I1R15H_sound : CA2_7_7I1R15H.Encloses (homogeneousEntropy CA2_7_7I1R15Value) := by + exact contains_sound (homogeneous_enclosed CA2_7_7I1R15Value CA2_7_7I1R15MassTerm_sound CA2_7_7I1R15Entropy_sound) (by decide +kernel) +def CA2_7_7I1R16Value (a : PairSlot) : ℝ := residualLaw (below (shape 2 7 7)) (fun u => (stageALaw (shape 2 7 7) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 16 a +def CA2_7_7I1R16Raw (a : PairSlot) : Ball := residualBall (below (shape 2 7 7)) A2_7_7Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 16 a +lemma CA2_7_7I1R16Raw_sound (a : PairSlot) : + (CA2_7_7I1R16Raw a).Encloses (CA2_7_7I1R16Value a) := by + exact residualBall_sound_on (below (shape 2 7 7)) A2_7_7Law (fun u => (stageALaw (shape 2 7 7) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A2_7_7Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 2 7 7) (show (shape 2 7 7) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 16 a +def CA2_7_7I1R16Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA2_7_7I1R16Certificates_valid : + CA2_7_7I1R16Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_7_7I1R16CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA2_7_7I1R16P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_7_7I1R16Certificates (CA2_7_7I1R16CertificateIndex a)).input +lemma CA2_7_7I1R16P_check : ∀ a : PairSlot, contains (CA2_7_7I1R16Raw a) (CA2_7_7I1R16P a) = true := by + decide +kernel +lemma CA2_7_7I1R16P_sound (a : PairSlot) : + (CA2_7_7I1R16P a).Encloses (CA2_7_7I1R16Value a) := + contains_sound (CA2_7_7I1R16Raw_sound a) (CA2_7_7I1R16P_check a) +def CA2_7_7I1R16Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_7_7I1R16Certificates (CA2_7_7I1R16CertificateIndex a)).output +lemma CA2_7_7I1R16Terms_sound (a : PairSlot) : + (CA2_7_7I1R16Terms a).Encloses (Foundation.entropyTerm (CA2_7_7I1R16Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_7_7I1R16Certificates_valid + (CA2_7_7I1R16CertificateIndex a) (CA2_7_7I1R16P_sound a) +def CA2_7_7I1R16Entropy : Ball := ⟨0, 0⟩ +lemma CA2_7_7I1R16Entropy_sound : CA2_7_7I1R16Entropy.Encloses (Foundation.finiteEntropy CA2_7_7I1R16Value) := by + exact contains_sound (entropyPair_enclosed CA2_7_7I1R16Value CA2_7_7I1R16Terms CA2_7_7I1R16Terms_sound) (by decide +kernel) +def CA2_7_7I1R16Mass : Ball := ⟨0, 0⟩ +lemma CA2_7_7I1R16Mass_sound : CA2_7_7I1R16Mass.Encloses (∑ a, CA2_7_7I1R16Value a) := by + exact contains_sound (pairSumBall_sound CA2_7_7I1R16P CA2_7_7I1R16Value CA2_7_7I1R16P_sound) (by decide +kernel) +def CA2_7_7I1R16MassTerm : Ball := .exact 0 +lemma CA2_7_7I1R16MassTerm_sound : CA2_7_7I1R16MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_7_7I1R16Value a))) := + entropyTerm_zero_ball (CA2_7_7I1R16Mass_sound) +def CA2_7_7I1R16H : Ball := ⟨0, 0⟩ +lemma CA2_7_7I1R16H_sound : CA2_7_7I1R16H.Encloses (homogeneousEntropy CA2_7_7I1R16Value) := by + exact contains_sound (homogeneous_enclosed CA2_7_7I1R16Value CA2_7_7I1R16MassTerm_sound CA2_7_7I1R16Entropy_sound) (by decide +kernel) +def CA2_7_7I1ResidualEntropies (a : Fin 17) : Ball := + match a.val with + | 0 => CA2_7_7I1R0H + | 1 => CA2_7_7I1R1H + | 2 => CA2_7_7I1R2H + | 3 => CA2_7_7I1R3H + | 4 => CA2_7_7I1R4H + | 5 => CA2_7_7I1R5H + | 6 => CA2_7_7I1R6H + | 7 => CA2_7_7I1R7H + | 8 => CA2_7_7I1R8H + | 9 => CA2_7_7I1R9H + | 10 => CA2_7_7I1R10H + | 11 => CA2_7_7I1R11H + | 12 => CA2_7_7I1R12H + | 13 => CA2_7_7I1R13H + | 14 => CA2_7_7I1R14H + | 15 => CA2_7_7I1R15H + | 16 => CA2_7_7I1R16H + | _ => (.exact 0) +lemma CA2_7_7I1ResidualEntropies_sound (k : Fin 17) : + (CA2_7_7I1ResidualEntropies k).Encloses (homogeneousEntropy + (residualLaw (below (shape 2 7 7)) (fun u => (stageALaw (shape 2 7 7) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) k)) := by + fin_cases k + · exact CA2_7_7I1R0H_sound + · exact CA2_7_7I1R1H_sound + · exact CA2_7_7I1R2H_sound + · exact CA2_7_7I1R3H_sound + · exact CA2_7_7I1R4H_sound + · exact CA2_7_7I1R5H_sound + · exact CA2_7_7I1R6H_sound + · exact CA2_7_7I1R7H_sound + · exact CA2_7_7I1R8H_sound + · exact CA2_7_7I1R9H_sound + · exact CA2_7_7I1R10H_sound + · exact CA2_7_7I1R11H_sound + · exact CA2_7_7I1R12H_sound + · exact CA2_7_7I1R13H_sound + · exact CA2_7_7I1R14H_sound + · exact CA2_7_7I1R15H_sound + · exact CA2_7_7I1R16H_sound +def CA2_7_7I1Singles (s : Shape) : Ball := + match s 0, s 1, s 2 with + | 1, 7, 0 => Z1_7_0H1H + | 2, 6, 0 => Z2_6_0H1H + | _, _, _ => (.exact 0) +lemma CA2_7_7I1Singles_sound (u : Shape) (hu : u ∈ below (shape 2 7 7)) + (hd : designated (Equiv.refl (Fin 3)) 1 u) : + (CA2_7_7I1Singles u).Encloses (homogeneousEntropy ((fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) u)) := by + rw [A2_7_7_below] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 0 1 7) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 0 2 6) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 0 3 5) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 0 4 4) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 0 5 3) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 0 6 2) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 0 7 1) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 1 0 7) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 1 1 6) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 1 2 5) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 1 3 4) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 1 4 3) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 1 5 2) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 1 6 1) by decide +kernel) hd |>.elim + · exact Z1_7_0H1H_sound + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 2 0 6) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 2 1 5) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 2 2 4) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 2 3 3) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 2 4 2) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 2 5 1) by decide +kernel) hd |>.elim + · exact Z2_6_0H1H_sound +def CA2_7_7I1Singleton : Ball := ⟨(510743509163288709243151337 / 100000000000000000000000000000000), (19933 / 5000000000000000000000000000000)⟩ +lemma CA2_7_7I1Singleton_sound : CA2_7_7I1Singleton.Encloses + (singletonEntropy (below (shape 2 7 7)) (fun u => (stageALaw (shape 2 7 7) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ))) := by + exact contains_sound (singletonBall_sound (below (shape 2 7 7)) A2_7_7Law (fun u => (stageALaw (shape 2 7 7) u : ℝ)) (Equiv.refl (Fin 3)) 1 + CA2_7_7I1Singles (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A2_7_7Law_sound u) CA2_7_7I1Singles_sound) (by decide +kernel) +def CA2_7_7I1Group : Ball := ⟨(4226886964255699639666683793131 / 4000000000000000000000000000000), (167571867093 / 100000000000000000000000000000000)⟩ +lemma CA2_7_7I1Group_sound : CA2_7_7I1Group.Encloses + (groupedEntropy (below (shape 2 7 7)) (fun u => (stageALaw (shape 2 7 7) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ))) := by + exact contains_sound (Ball.add_sound CA2_7_7I1Singleton_sound + (finSumBall_sound 17 CA2_7_7I1ResidualEntropies _ CA2_7_7I1ResidualEntropies_sound)) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CA2_7_7I1H : Ball := ⟨(106734798192338952840863394793203 / 100000000000000000000000000000000), (100109470549 / 20000000000000000000000000000000)⟩ +lemma CA2_7_7I1_sound : CA2_7_7I1H.Encloses (stageACapacity (shape 2 7 7) 1) := by + have hb := contains_sound (Ball.add_sound CA2_7_7I1PairH_sound + (Ball.neg_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) CA2_7_7I1Group_sound))) + (show contains (.add CA2_7_7I1PairH (.neg (.mul (.exact 2) CA2_7_7I1Group))) CA2_7_7I1H = true by decide +kernel) + simp only [stageACapacity, nativeCapacity, + show (1 : Fin 3) ≠ 0 by decide, ite_false] + change CA2_7_7I1H.Encloses (homogeneousEntropy CA2_7_7I1PairValue - _) + simpa only [sub_eq_add_neg] using hb + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA2_7_7I1Pair.lean b/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA2_7_7I1Pair.lean new file mode 100644 index 0000000000000000000000000000000000000000..53d92d93b31de9400f88d3731cff7f3fc1666c83 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA2_7_7I1Pair.lean @@ -0,0 +1,355 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Certificates.SupportedContraction + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CA2_7_7I1PairValue (a : PairSlot × PairSlot) : ℝ := pairLaw (below (shape 2 7 7)) (shape 2 7 7) (fun u => (stageALaw (shape 2 7 7) u : ℝ)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) a +def CA2_7_7I1PairRaw (a : PairSlot × PairSlot) : Ball := stageAPairBall (shape 2 7 7) A2_7_7Law 1 a +lemma CA2_7_7I1PairRaw_sound (a : PairSlot × PairSlot) : + (CA2_7_7I1PairRaw a).Encloses (CA2_7_7I1PairValue a) := by + exact stageAPairBall_sound (shape 2 7 7) (by decide +kernel) A2_7_7Law (fun u => (stageALaw (shape 2 7 7) u : ℝ)) (fun u _ => A2_7_7Law_sound u) 1 a +def CA2_7_7I1PairCertificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(10000595541555755295297669883 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(18421658660181419871743246927 / 20000000000000000000000000000000), (15882819 / 50000000000000000000000000000000)⟩ ⟨(-921028081959388552598683380657969 / 100000000000000000000000000000000), (79409341311 / 25000000000000000000000000000000)⟩ ⟨-14, 10000595541555755295297669883, 6103515625000000000000000000⟩, + .log ⟨(691596000502394042397763869 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(4108660759373210252442279209 / 50000000000000000000000000000000), (556517 / 20000000000000000000000000000000)⟩ ⟨(-297041969328088070043180133817291 / 25000000000000000000000000000000), (40234079457 / 10000000000000000000000000000000)⟩ ⟨-18, 691596000502394042397763869, 381469726562500000000000000⟩, + .log ⟨(22153289040748902444524208233 / 50000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ ⟨(171063096945390294612000520151 / 50000000000000000000000000000000), (24393939 / 20000000000000000000000000000000)⟩ ⟨(-772179230951827212178576146063907 / 100000000000000000000000000000000), (275285712393 / 100000000000000000000000000000000)⟩ ⟨-12, 22153289040748902444524208233, 12207031250000000000000000000⟩, + .log ⟨(429440455520008279582273376157 / 100000000000000000000000000000000), (1 / 20000000000000000000000000000000)⟩ ⟨(1170320227057115556906258042927 / 50000000000000000000000000000000), (6394047 / 781250000000000000000000000000)⟩ ⟨(-109008847397945121592231689713711 / 20000000000000000000000000000000), (190582414311 / 100000000000000000000000000000000)⟩ ⟨-8, 429440455520008279582273376157, 390625000000000000000000000000⟩, + .log ⟨(33399780677112209380551535723 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(133672203625652358021634853497 / 50000000000000000000000000000000), (91944833 / 100000000000000000000000000000000)⟩ ⟨(-400218806578133012983804934161053 / 50000000000000000000000000000000), (34410713859 / 12500000000000000000000000000000)⟩ ⟨-12, 33399780677112209380551535723, 24414062500000000000000000000⟩, + .log ⟨(2109366555327742745318088767 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(36648540507785070211199756207 / 25000000000000000000000000000000), (25013847 / 50000000000000000000000000000000)⟩ ⟨(-108588702895247871806035933246323 / 12500000000000000000000000000000), (18528846093 / 6250000000000000000000000000000)⟩ ⟨-13, 2109366555327742745318088767, 1525878906250000000000000000⟩, + .log ⟨(43714749634725180104344779881 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(338144075574256826468569598439 / 100000000000000000000000000000000), (120340467 / 100000000000000000000000000000000)⟩ ⟨(-4834524937231500632421465305357 / 625000000000000000000000000000), (137642855083 / 50000000000000000000000000000000)⟩ ⟨-12, 43714749634725180104344779881, 24414062500000000000000000000⟩, + .log ⟨(1687757775514075859450315147 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(34755582020976894368776819891 / 100000000000000000000000000000000), (357397 / 3125000000000000000000000000000)⟩ ⟨(-1029637739645153056698719169957471 / 100000000000000000000000000000000), (338813208553 / 100000000000000000000000000000000)⟩ ⟨-15, 1687757775514075859450315147, 1525878906250000000000000000⟩, + .log ⟨(850162097947826579368032709 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(9336570726259480822574474361 / 50000000000000000000000000000000), (6120993 / 100000000000000000000000000000000)⟩ ⟨(-109821065286216216215243747075717 / 10000000000000000000000000000000), (179994530711 / 50000000000000000000000000000000)⟩ ⟨-16, 850162097947826579368032709, 762939453125000000000000000⟩, + .log ⟨(50632974610510341004126306577 / 3125000000000000000000000000000), (3 / 25000000000000000000000000000000)⟩ ⟨(417477637799022680599156984179 / 6250000000000000000000000000000), (1200858367 / 50000000000000000000000000000000)⟩ ⟨(-103064663149467397720558759871913 / 25000000000000000000000000000000), (148230766521 / 100000000000000000000000000000000)⟩ ⟨-6, 50632974610510341004126306577, 48828125000000000000000000000⟩, + .log ⟨(125944375901070780822843070107 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(840941317847760238056493357509 / 100000000000000000000000000000000), (293367357 / 100000000000000000000000000000000)⟩ ⟨(-333854255829700190431907016741329 / 50000000000000000000000000000000), (232934061307 / 100000000000000000000000000000000)⟩ ⟨-10, 125944375901070780822843070107, 97656250000000000000000000000⟩, + .log ⟨(12723466295577863684988088713 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(18729042964141422438481875799 / 4000000000000000000000000000000), (10103621 / 6250000000000000000000000000000)⟩ ⟨(-368001976211679871594605317124857 / 50000000000000000000000000000000), (254109885767 / 100000000000000000000000000000000)⟩ ⟨-11, 12723466295577863684988088713, 9765625000000000000000000000⟩, + .log ⟨(454062879728300184344221279951 / 100000000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ ⟨(612382093609697893878930441253 / 25000000000000000000000000000000), (43268201 / 5000000000000000000000000000000)⟩ ⟨(-53946897749151566692267032010911 / 10000000000000000000000000000000), (190582414027 / 100000000000000000000000000000000)⟩ ⟨-8, 454062879728300184344221279951, 390625000000000000000000000000⟩, + .log ⟨(7548936877656788210385271853 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(15296456770883623239217688617 / 6250000000000000000000000000000), (83124587 / 100000000000000000000000000000000)⟩ ⟨(-810522436141057656293458419965141 / 100000000000000000000000000000000), (27528571119 / 10000000000000000000000000000000)⟩ ⟨-12, 7548936877656788210385271853, 6103515625000000000000000000⟩, + .log ⟨(472516500436659465730429241 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(20556950776956445558180492029 / 100000000000000000000000000000000), (3402021 / 50000000000000000000000000000000)⟩ ⟨(-271907842873733830123328939997993 / 25000000000000000000000000000000), (359989055519 / 100000000000000000000000000000000)⟩ ⟨-16, 472516500436659465730429241, 381469726562500000000000000⟩, + .log ⟨(60468020482346465110403058101 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(17924682434516974882531204151 / 4000000000000000000000000000000), (76827613 / 50000000000000000000000000000000)⟩ ⟨(-741081082675348004080231833892751 / 100000000000000000000000000000000), (254109885849 / 100000000000000000000000000000000)⟩ ⟨-11, 60468020482346465110403058101, 48828125000000000000000000000⟩, + .log ⟨(273082492563813823952891039 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(661829601535675902811713751 / 10000000000000000000000000000000), (1098729 / 50000000000000000000000000000000)⟩ ⟨(-605887982164418492239724413459553 / 50000000000000000000000000000000), (402340833071 / 100000000000000000000000000000000)⟩ ⟨-18, 273082492563813823952891039, 190734863281250000000000000⟩, + .log ⟨(13900730702911253667437218311437 / 100000000000000000000000000000000), (47 / 100000000000000000000000000000000)⟩ ⟨(548586437352846213362933624123 / 2000000000000000000000000000000), (11774377037 / 100000000000000000000000000000000)⟩ ⟨(-12332679866739730608876666605873 / 6250000000000000000000000000000), (8470329507 / 10000000000000000000000000000000)⟩ ⟨-3, 13900730702911253667437218311437, 12500000000000000000000000000000⟩, + .log ⟨(480661717387338202979144935959 / 50000000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ ⟨(2232488407158920010556983345431 / 50000000000000000000000000000000), (407136317 / 25000000000000000000000000000000)⟩ ⟨(-232230727599207090218572525545633 / 50000000000000000000000000000000), (4235164747 / 2500000000000000000000000000000)⟩ ⟨-7, 480661717387338202979144935959, 390625000000000000000000000000⟩, + .log ⟨(58588561931959515301824090893 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(2725241823092440486742702277 / 625000000000000000000000000000), (18609917 / 12500000000000000000000000000000)⟩ ⟨(-23257456175979687544329793627077 / 3125000000000000000000000000000), (127054942951 / 50000000000000000000000000000000)⟩ ⟨-11, 58588561931959515301824090893, 48828125000000000000000000000⟩, + .log ⟨(190472348553949522502886206891 / 10000000000000000000000000000000), (1 / 10000000000000000000000000000000)⟩ ⟨(377214614240079101824358220357 / 5000000000000000000000000000000), (2823386259 / 100000000000000000000000000000000)⟩ ⟨(-396083333989276210477338625073817 / 100000000000000000000000000000000), (29646153261 / 20000000000000000000000000000000)⟩ ⟨-6, 190472348553949522502886206891, 156250000000000000000000000000⟩, + .log ⟨(18047239332507128424613922541 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(388914972857462383517717567 / 250000000000000000000000000000), (53503133 / 100000000000000000000000000000000)⟩ ⟨(-53874579609101103935556381404861 / 6250000000000000000000000000000), (148230768551 / 50000000000000000000000000000000)⟩ ⟨-13, 18047239332507128424613922541, 12207031250000000000000000000⟩, + .log ⟨(608005698598739894392784935843 / 50000000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ ⟨(1340529149310484883641127188737 / 25000000000000000000000000000000), (1030001729 / 50000000000000000000000000000000)⟩ ⟨(-220479701489637182937148402282181 / 50000000000000000000000000000000), (5293955931 / 3125000000000000000000000000000)⟩ ⟨-7, 608005698598739894392784935843, 390625000000000000000000000000⟩, + .log ⟨(1003389836007867761642175089 / 1250000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(572134066631913007042242505929 / 100000000000000000000000000000000), (203977029 / 100000000000000000000000000000000)⟩ ⟨(-712751472683129212109761696483391 / 100000000000000000000000000000000), (127054942721 / 50000000000000000000000000000000)⟩ ⟨-11, 1003389836007867761642175089, 610351562500000000000000000⟩, + .log ⟨(4374724968401882195714301469 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(878189448213402273733400469 / 2000000000000000000000000000000), (3705539 / 25000000000000000000000000000000)⟩ ⟨(-1003708181150198176519962854245567 / 100000000000000000000000000000000), (169406600893 / 50000000000000000000000000000000)⟩ ⟨-15, 4374724968401882195714301469, 3051757812500000000000000000⟩, + .log ⟨(15882621877986652072601903819 / 10000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ ⟨(511826608558440058768422103447 / 50000000000000000000000000000000), (46245047 / 12500000000000000000000000000000)⟩ ⟨(-80563935301487097990608249772427 / 12500000000000000000000000000000), (58233515443 / 25000000000000000000000000000000)⟩ ⟨-10, 15882621877986652072601903819, 9765625000000000000000000000⟩, + .log ⟨(345007190201820725089502599 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(15443655009347665453820791751 / 100000000000000000000000000000000), (5260197 / 100000000000000000000000000000000)⟩ ⟨(-1119082112485359139816860926093711 / 100000000000000000000000000000000), (95291224689 / 25000000000000000000000000000000)⟩ ⟨-17, 345007190201820725089502599, 190734863281250000000000000⟩, + .log ⟨(12962052250195908741496547 / 5000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ ⟨(666919490997435771274946851 / 20000000000000000000000000000000), (1097957 / 100000000000000000000000000000000)⟩ ⟨(-1286292243937212827325793449947257 / 100000000000000000000000000000000), (211758622571 / 50000000000000000000000000000000)⟩ ⟨-19, 12962052250195908741496547, 9536743164062500000000000⟩] +lemma CA2_7_7I1PairCertificates_valid : + CA2_7_7I1PairCertificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_7_7I1PairCertificateIndex (a : PairSlot × PairSlot) : ℕ := + match a.1.1.val, a.1.2.val, a.2.1.val, a.2.2.val with + | 1, 0, 2, 5 => 1 + | 1, 0, 3, 5 => 2 + | 1, 0, 4, 4 => 3 + | 1, 0, 5, 2 => 1 + | 1, 0, 5, 3 => 2 + | 0, 1, 2, 5 => 1 + | 0, 1, 3, 5 => 2 + | 0, 1, 4, 4 => 3 + | 0, 1, 5, 2 => 1 + | 0, 1, 5, 3 => 2 + | 2, 0, 4, 2 => 4 + | 2, 0, 4, 3 => 5 + | 2, 0, 5, 1 => 6 + | 2, 0, 2, 4 => 4 + | 2, 0, 3, 4 => 5 + | 2, 0, 1, 5 => 6 + | 3, 0, 4, 2 => 7 + | 3, 0, 4, 3 => 8 + | 3, 0, 5, 1 => 9 + | 3, 0, 2, 4 => 7 + | 3, 0, 3, 4 => 8 + | 3, 0, 1, 5 => 9 + | 1, 1, 4, 2 => 10 + | 1, 1, 4, 3 => 11 + | 1, 1, 5, 1 => 12 + | 1, 1, 2, 4 => 10 + | 1, 1, 3, 4 => 11 + | 1, 1, 1, 5 => 12 + | 0, 2, 4, 2 => 4 + | 0, 2, 4, 3 => 5 + | 0, 2, 5, 1 => 6 + | 0, 2, 2, 4 => 4 + | 0, 2, 3, 4 => 5 + | 0, 2, 1, 5 => 6 + | 0, 3, 4, 2 => 7 + | 0, 3, 4, 3 => 8 + | 0, 3, 5, 1 => 9 + | 0, 3, 2, 4 => 7 + | 0, 3, 3, 4 => 8 + | 0, 3, 1, 5 => 9 + | 4, 0, 2, 2 => 13 + | 4, 0, 2, 3 => 14 + | 4, 0, 3, 2 => 14 + | 4, 0, 3, 3 => 15 + | 4, 0, 4, 1 => 16 + | 4, 0, 5, 0 => 17 + | 4, 0, 1, 4 => 16 + | 4, 0, 0, 5 => 17 + | 2, 1, 2, 2 => 18 + | 2, 1, 2, 3 => 19 + | 2, 1, 3, 2 => 19 + | 2, 1, 3, 3 => 20 + | 2, 1, 4, 1 => 21 + | 2, 1, 5, 0 => 22 + | 2, 1, 1, 4 => 21 + | 2, 1, 0, 5 => 22 + | 3, 1, 2, 2 => 23 + | 3, 1, 2, 3 => 24 + | 3, 1, 3, 2 => 24 + | 3, 1, 3, 3 => 25 + | 3, 1, 4, 1 => 26 + | 3, 1, 5, 0 => 27 + | 3, 1, 1, 4 => 26 + | 3, 1, 0, 5 => 27 + | 1, 2, 2, 2 => 18 + | 1, 2, 2, 3 => 19 + | 1, 2, 3, 2 => 19 + | 1, 2, 3, 3 => 20 + | 1, 2, 4, 1 => 21 + | 1, 2, 5, 0 => 22 + | 1, 2, 1, 4 => 21 + | 1, 2, 0, 5 => 22 + | 1, 3, 2, 2 => 23 + | 1, 3, 2, 3 => 24 + | 1, 3, 3, 2 => 24 + | 1, 3, 3, 3 => 25 + | 1, 3, 4, 1 => 26 + | 1, 3, 5, 0 => 27 + | 1, 3, 1, 4 => 26 + | 1, 3, 0, 5 => 27 + | 0, 4, 2, 2 => 13 + | 0, 4, 2, 3 => 14 + | 0, 4, 3, 2 => 14 + | 0, 4, 3, 3 => 15 + | 0, 4, 4, 1 => 16 + | 0, 4, 5, 0 => 17 + | 0, 4, 1, 4 => 16 + | 0, 4, 0, 5 => 17 + | 0, 5, 1, 2 => 22 + | 0, 5, 1, 3 => 27 + | 0, 5, 2, 1 => 22 + | 0, 5, 3, 1 => 27 + | 0, 5, 4, 0 => 17 + | 0, 5, 0, 4 => 17 + | 1, 4, 1, 2 => 21 + | 1, 4, 1, 3 => 26 + | 1, 4, 2, 1 => 21 + | 1, 4, 3, 1 => 26 + | 1, 4, 4, 0 => 16 + | 1, 4, 0, 4 => 16 + | 2, 2, 1, 2 => 18 + | 2, 2, 1, 3 => 23 + | 2, 2, 2, 1 => 18 + | 2, 2, 3, 1 => 23 + | 2, 2, 4, 0 => 13 + | 2, 2, 0, 4 => 13 + | 2, 3, 1, 2 => 19 + | 2, 3, 1, 3 => 24 + | 2, 3, 2, 1 => 19 + | 2, 3, 3, 1 => 24 + | 2, 3, 4, 0 => 14 + | 2, 3, 0, 4 => 14 + | 3, 2, 1, 2 => 19 + | 3, 2, 1, 3 => 24 + | 3, 2, 2, 1 => 19 + | 3, 2, 3, 1 => 24 + | 3, 2, 4, 0 => 14 + | 3, 2, 0, 4 => 14 + | 3, 3, 1, 2 => 20 + | 3, 3, 1, 3 => 25 + | 3, 3, 2, 1 => 20 + | 3, 3, 3, 1 => 25 + | 3, 3, 4, 0 => 15 + | 3, 3, 0, 4 => 15 + | 4, 1, 1, 2 => 21 + | 4, 1, 1, 3 => 26 + | 4, 1, 2, 1 => 21 + | 4, 1, 3, 1 => 26 + | 4, 1, 4, 0 => 16 + | 4, 1, 0, 4 => 16 + | 5, 0, 1, 2 => 22 + | 5, 0, 1, 3 => 27 + | 5, 0, 2, 1 => 22 + | 5, 0, 3, 1 => 27 + | 5, 0, 4, 0 => 17 + | 5, 0, 0, 4 => 17 + | 1, 5, 0, 2 => 6 + | 1, 5, 0, 3 => 9 + | 1, 5, 1, 1 => 12 + | 1, 5, 2, 0 => 6 + | 1, 5, 3, 0 => 9 + | 2, 4, 0, 2 => 4 + | 2, 4, 0, 3 => 7 + | 2, 4, 1, 1 => 10 + | 2, 4, 2, 0 => 4 + | 2, 4, 3, 0 => 7 + | 3, 4, 0, 2 => 5 + | 3, 4, 0, 3 => 8 + | 3, 4, 1, 1 => 11 + | 3, 4, 2, 0 => 5 + | 3, 4, 3, 0 => 8 + | 4, 2, 0, 2 => 4 + | 4, 2, 0, 3 => 7 + | 4, 2, 1, 1 => 10 + | 4, 2, 2, 0 => 4 + | 4, 2, 3, 0 => 7 + | 4, 3, 0, 2 => 5 + | 4, 3, 0, 3 => 8 + | 4, 3, 1, 1 => 11 + | 4, 3, 2, 0 => 5 + | 4, 3, 3, 0 => 8 + | 5, 1, 0, 2 => 6 + | 5, 1, 0, 3 => 9 + | 5, 1, 1, 1 => 12 + | 5, 1, 2, 0 => 6 + | 5, 1, 3, 0 => 9 + | 2, 5, 0, 1 => 1 + | 2, 5, 1, 0 => 1 + | 3, 5, 0, 1 => 2 + | 3, 5, 1, 0 => 2 + | 4, 4, 0, 1 => 3 + | 4, 4, 1, 0 => 3 + | 5, 2, 0, 1 => 1 + | 5, 2, 1, 0 => 1 + | 5, 3, 0, 1 => 2 + | 5, 3, 1, 0 => 2 + | 4, 5, 0, 0 => 28 + | 5, 4, 0, 0 => 28 + | 0, 0, 4, 5 => 28 + | 0, 0, 5, 4 => 28 + | _, _, _, _ => 0 +def CA2_7_7I1PairP (a : PairSlot × PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_7_7I1PairCertificates (CA2_7_7I1PairCertificateIndex a)).input +lemma CA2_7_7I1PairP_check_0_0 : ∀ k l : Fin 6, contains (CA2_7_7I1PairRaw ((0,0),(k,l))) (CA2_7_7I1PairP ((0,0),(k,l))) = true := by + decide +kernel +lemma CA2_7_7I1PairP_check_0_1 : ∀ k l : Fin 6, contains (CA2_7_7I1PairRaw ((0,1),(k,l))) (CA2_7_7I1PairP ((0,1),(k,l))) = true := by + decide +kernel +lemma CA2_7_7I1PairP_check_0_2 : ∀ k l : Fin 6, contains (CA2_7_7I1PairRaw ((0,2),(k,l))) (CA2_7_7I1PairP ((0,2),(k,l))) = true := by + decide +kernel +lemma CA2_7_7I1PairP_check_0_3 : ∀ k l : Fin 6, contains (CA2_7_7I1PairRaw ((0,3),(k,l))) (CA2_7_7I1PairP ((0,3),(k,l))) = true := by + decide +kernel +lemma CA2_7_7I1PairP_check_0_4 : ∀ k l : Fin 6, contains (CA2_7_7I1PairRaw ((0,4),(k,l))) (CA2_7_7I1PairP ((0,4),(k,l))) = true := by + decide +kernel +lemma CA2_7_7I1PairP_check_0_5 : ∀ k l : Fin 6, contains (CA2_7_7I1PairRaw ((0,5),(k,l))) (CA2_7_7I1PairP ((0,5),(k,l))) = true := by + decide +kernel +lemma CA2_7_7I1PairP_check_1_0 : ∀ k l : Fin 6, contains (CA2_7_7I1PairRaw ((1,0),(k,l))) (CA2_7_7I1PairP ((1,0),(k,l))) = true := by + decide +kernel +lemma CA2_7_7I1PairP_check_1_1 : ∀ k l : Fin 6, contains (CA2_7_7I1PairRaw ((1,1),(k,l))) (CA2_7_7I1PairP ((1,1),(k,l))) = true := by + decide +kernel +lemma CA2_7_7I1PairP_check_1_2 : ∀ k l : Fin 6, contains (CA2_7_7I1PairRaw ((1,2),(k,l))) (CA2_7_7I1PairP ((1,2),(k,l))) = true := by + decide +kernel +lemma CA2_7_7I1PairP_check_1_3 : ∀ k l : Fin 6, contains (CA2_7_7I1PairRaw ((1,3),(k,l))) (CA2_7_7I1PairP ((1,3),(k,l))) = true := by + decide +kernel +lemma CA2_7_7I1PairP_check_1_4 : ∀ k l : Fin 6, contains (CA2_7_7I1PairRaw ((1,4),(k,l))) (CA2_7_7I1PairP ((1,4),(k,l))) = true := by + decide +kernel +lemma CA2_7_7I1PairP_check_1_5 : ∀ k l : Fin 6, contains (CA2_7_7I1PairRaw ((1,5),(k,l))) (CA2_7_7I1PairP ((1,5),(k,l))) = true := by + decide +kernel +lemma CA2_7_7I1PairP_check_2_0 : ∀ k l : Fin 6, contains (CA2_7_7I1PairRaw ((2,0),(k,l))) (CA2_7_7I1PairP ((2,0),(k,l))) = true := by + decide +kernel +lemma CA2_7_7I1PairP_check_2_1 : ∀ k l : Fin 6, contains (CA2_7_7I1PairRaw ((2,1),(k,l))) (CA2_7_7I1PairP ((2,1),(k,l))) = true := by + decide +kernel +lemma CA2_7_7I1PairP_check_2_2 : ∀ k l : Fin 6, contains (CA2_7_7I1PairRaw ((2,2),(k,l))) (CA2_7_7I1PairP ((2,2),(k,l))) = true := by + decide +kernel +lemma CA2_7_7I1PairP_check_2_3 : ∀ k l : Fin 6, contains (CA2_7_7I1PairRaw ((2,3),(k,l))) (CA2_7_7I1PairP ((2,3),(k,l))) = true := by + decide +kernel +lemma CA2_7_7I1PairP_check_2_4 : ∀ k l : Fin 6, contains (CA2_7_7I1PairRaw ((2,4),(k,l))) (CA2_7_7I1PairP ((2,4),(k,l))) = true := by + decide +kernel +lemma CA2_7_7I1PairP_check_2_5 : ∀ k l : Fin 6, contains (CA2_7_7I1PairRaw ((2,5),(k,l))) (CA2_7_7I1PairP ((2,5),(k,l))) = true := by + decide +kernel +lemma CA2_7_7I1PairP_check_3_0 : ∀ k l : Fin 6, contains (CA2_7_7I1PairRaw ((3,0),(k,l))) (CA2_7_7I1PairP ((3,0),(k,l))) = true := by + decide +kernel +lemma CA2_7_7I1PairP_check_3_1 : ∀ k l : Fin 6, contains (CA2_7_7I1PairRaw ((3,1),(k,l))) (CA2_7_7I1PairP ((3,1),(k,l))) = true := by + decide +kernel +lemma CA2_7_7I1PairP_check_3_2 : ∀ k l : Fin 6, contains (CA2_7_7I1PairRaw ((3,2),(k,l))) (CA2_7_7I1PairP ((3,2),(k,l))) = true := by + decide +kernel +lemma CA2_7_7I1PairP_check_3_3 : ∀ k l : Fin 6, contains (CA2_7_7I1PairRaw ((3,3),(k,l))) (CA2_7_7I1PairP ((3,3),(k,l))) = true := by + decide +kernel +lemma CA2_7_7I1PairP_check_3_4 : ∀ k l : Fin 6, contains (CA2_7_7I1PairRaw ((3,4),(k,l))) (CA2_7_7I1PairP ((3,4),(k,l))) = true := by + decide +kernel +lemma CA2_7_7I1PairP_check_3_5 : ∀ k l : Fin 6, contains (CA2_7_7I1PairRaw ((3,5),(k,l))) (CA2_7_7I1PairP ((3,5),(k,l))) = true := by + decide +kernel +lemma CA2_7_7I1PairP_check_4_0 : ∀ k l : Fin 6, contains (CA2_7_7I1PairRaw ((4,0),(k,l))) (CA2_7_7I1PairP ((4,0),(k,l))) = true := by + decide +kernel +lemma CA2_7_7I1PairP_check_4_1 : ∀ k l : Fin 6, contains (CA2_7_7I1PairRaw ((4,1),(k,l))) (CA2_7_7I1PairP ((4,1),(k,l))) = true := by + decide +kernel +lemma CA2_7_7I1PairP_check_4_2 : ∀ k l : Fin 6, contains (CA2_7_7I1PairRaw ((4,2),(k,l))) (CA2_7_7I1PairP ((4,2),(k,l))) = true := by + decide +kernel +lemma CA2_7_7I1PairP_check_4_3 : ∀ k l : Fin 6, contains (CA2_7_7I1PairRaw ((4,3),(k,l))) (CA2_7_7I1PairP ((4,3),(k,l))) = true := by + decide +kernel +lemma CA2_7_7I1PairP_check_4_4 : ∀ k l : Fin 6, contains (CA2_7_7I1PairRaw ((4,4),(k,l))) (CA2_7_7I1PairP ((4,4),(k,l))) = true := by + decide +kernel +lemma CA2_7_7I1PairP_check_4_5 : ∀ k l : Fin 6, contains (CA2_7_7I1PairRaw ((4,5),(k,l))) (CA2_7_7I1PairP ((4,5),(k,l))) = true := by + decide +kernel +lemma CA2_7_7I1PairP_check_5_0 : ∀ k l : Fin 6, contains (CA2_7_7I1PairRaw ((5,0),(k,l))) (CA2_7_7I1PairP ((5,0),(k,l))) = true := by + decide +kernel +lemma CA2_7_7I1PairP_check_5_1 : ∀ k l : Fin 6, contains (CA2_7_7I1PairRaw ((5,1),(k,l))) (CA2_7_7I1PairP ((5,1),(k,l))) = true := by + decide +kernel +lemma CA2_7_7I1PairP_check_5_2 : ∀ k l : Fin 6, contains (CA2_7_7I1PairRaw ((5,2),(k,l))) (CA2_7_7I1PairP ((5,2),(k,l))) = true := by + decide +kernel +lemma CA2_7_7I1PairP_check_5_3 : ∀ k l : Fin 6, contains (CA2_7_7I1PairRaw ((5,3),(k,l))) (CA2_7_7I1PairP ((5,3),(k,l))) = true := by + decide +kernel +lemma CA2_7_7I1PairP_check_5_4 : ∀ k l : Fin 6, contains (CA2_7_7I1PairRaw ((5,4),(k,l))) (CA2_7_7I1PairP ((5,4),(k,l))) = true := by + decide +kernel +lemma CA2_7_7I1PairP_check_5_5 : ∀ k l : Fin 6, contains (CA2_7_7I1PairRaw ((5,5),(k,l))) (CA2_7_7I1PairP ((5,5),(k,l))) = true := by + decide +kernel +lemma CA2_7_7I1PairP_check (a : PairSlot × PairSlot) : contains (CA2_7_7I1PairRaw a) (CA2_7_7I1PairP a) = true := by + rcases a with ⟨⟨i,j⟩,⟨k,l⟩⟩ + revert j i + apply forall_fin6 + · exact forall_fin6 (CA2_7_7I1PairP_check_0_0 k l) (CA2_7_7I1PairP_check_0_1 k l) (CA2_7_7I1PairP_check_0_2 k l) (CA2_7_7I1PairP_check_0_3 k l) (CA2_7_7I1PairP_check_0_4 k l) (CA2_7_7I1PairP_check_0_5 k l) + · exact forall_fin6 (CA2_7_7I1PairP_check_1_0 k l) (CA2_7_7I1PairP_check_1_1 k l) (CA2_7_7I1PairP_check_1_2 k l) (CA2_7_7I1PairP_check_1_3 k l) (CA2_7_7I1PairP_check_1_4 k l) (CA2_7_7I1PairP_check_1_5 k l) + · exact forall_fin6 (CA2_7_7I1PairP_check_2_0 k l) (CA2_7_7I1PairP_check_2_1 k l) (CA2_7_7I1PairP_check_2_2 k l) (CA2_7_7I1PairP_check_2_3 k l) (CA2_7_7I1PairP_check_2_4 k l) (CA2_7_7I1PairP_check_2_5 k l) + · exact forall_fin6 (CA2_7_7I1PairP_check_3_0 k l) (CA2_7_7I1PairP_check_3_1 k l) (CA2_7_7I1PairP_check_3_2 k l) (CA2_7_7I1PairP_check_3_3 k l) (CA2_7_7I1PairP_check_3_4 k l) (CA2_7_7I1PairP_check_3_5 k l) + · exact forall_fin6 (CA2_7_7I1PairP_check_4_0 k l) (CA2_7_7I1PairP_check_4_1 k l) (CA2_7_7I1PairP_check_4_2 k l) (CA2_7_7I1PairP_check_4_3 k l) (CA2_7_7I1PairP_check_4_4 k l) (CA2_7_7I1PairP_check_4_5 k l) + · exact forall_fin6 (CA2_7_7I1PairP_check_5_0 k l) (CA2_7_7I1PairP_check_5_1 k l) (CA2_7_7I1PairP_check_5_2 k l) (CA2_7_7I1PairP_check_5_3 k l) (CA2_7_7I1PairP_check_5_4 k l) (CA2_7_7I1PairP_check_5_5 k l) +lemma CA2_7_7I1PairP_sound (a : PairSlot × PairSlot) : + (CA2_7_7I1PairP a).Encloses (CA2_7_7I1PairValue a) := + contains_sound (CA2_7_7I1PairRaw_sound a) (CA2_7_7I1PairP_check a) +def CA2_7_7I1PairTerms (a : PairSlot × PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_7_7I1PairCertificates (CA2_7_7I1PairCertificateIndex a)).output +lemma CA2_7_7I1PairTerms_sound (a : PairSlot × PairSlot) : + (CA2_7_7I1PairTerms a).Encloses (Foundation.entropyTerm (CA2_7_7I1PairValue a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_7_7I1PairCertificates_valid + (CA2_7_7I1PairCertificateIndex a) (CA2_7_7I1PairP_sound a) +def CA2_7_7I1PairEntropy : Ball := ⟨(39759893300640491853024698056221 / 12500000000000000000000000000000), (15381496327 / 12500000000000000000000000000000)⟩ +lemma CA2_7_7I1PairEntropy_sound : CA2_7_7I1PairEntropy.Encloses (Foundation.finiteEntropy CA2_7_7I1PairValue) := by + exact contains_sound (entropyDoublePair_enclosed CA2_7_7I1PairValue CA2_7_7I1PairTerms CA2_7_7I1PairTerms_sound) (by decide +kernel) +def CA2_7_7I1PairMass : Ball := ⟨(6249999999999999999999999999999 / 6250000000000000000000000000000), (9 / 1562500000000000000000000000000)⟩ +lemma CA2_7_7I1PairMass_sound : CA2_7_7I1PairMass.Encloses (∑ a, CA2_7_7I1PairValue a) := by + exact contains_sound (doublePairSumBall_sound CA2_7_7I1PairP CA2_7_7I1PairValue CA2_7_7I1PairP_sound) (by decide +kernel) +def CA2_7_7I1PairMassTermLogWitness : LogWitness := ⟨-1, 6249999999999999999999999999999, 3125000000000000000000000000000⟩ +def CA2_7_7I1PairMassTermLog : Ball := ⟨(-3 / 20000000000000000000000000000000), (21175823971 / 50000000000000000000000000000000)⟩ +lemma CA2_7_7I1PairMassTermLog_sound : CA2_7_7I1PairMassTermLog.Encloses (Real.log ((∑ a, CA2_7_7I1PairValue a))) := by + exact checkLog_sound logTwoBall_sound (CA2_7_7I1PairMass_sound) (w := CA2_7_7I1PairMassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA2_7_7I1PairMassTerm : Ball := ⟨(3 / 20000000000000000000000000000000), (42351647943 / 100000000000000000000000000000000)⟩ +lemma CA2_7_7I1PairMassTerm_sound : CA2_7_7I1PairMassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_7_7I1PairValue a))) := by + exact contains_sound (entropyTerm_ball (CA2_7_7I1PairMass_sound) CA2_7_7I1PairMassTermLog_sound) (by decide +kernel) +def CA2_7_7I1PairH : Ball := ⟨(318079146405123934824197584449753 / 100000000000000000000000000000000), (165403618559 / 100000000000000000000000000000000)⟩ +lemma CA2_7_7I1PairH_sound : CA2_7_7I1PairH.Encloses (homogeneousEntropy CA2_7_7I1PairValue) := by + exact contains_sound (homogeneous_enclosed CA2_7_7I1PairValue CA2_7_7I1PairMassTerm_sound CA2_7_7I1PairEntropy_sound) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA2_7_7I2.lean b/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA2_7_7I2.lean new file mode 100644 index 0000000000000000000000000000000000000000..12f170aaddabfdf2384d3b75894a303cd1374518 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA2_7_7I2.lean @@ -0,0 +1,866 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.CapacityA.CapA2_7_7I2Pair + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CA2_7_7I2R0Value (a : PairSlot) : ℝ := residualLaw (below (shape 2 7 7)) (fun u => (stageALaw (shape 2 7 7) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 0 a +def CA2_7_7I2R0Raw (a : PairSlot) : Ball := residualBall (below (shape 2 7 7)) A2_7_7Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 0 a +lemma CA2_7_7I2R0Raw_sound (a : PairSlot) : + (CA2_7_7I2R0Raw a).Encloses (CA2_7_7I2R0Value a) := by + exact residualBall_sound_on (below (shape 2 7 7)) A2_7_7Law (fun u => (stageALaw (shape 2 7 7) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A2_7_7Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 2 7 7) (show (shape 2 7 7) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 0 a +def CA2_7_7I2R0Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(502109287941468832085436601 / 100000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ ⟨(3063334356907513434862083549 / 50000000000000000000000000000000), (2020217 / 100000000000000000000000000000000)⟩ ⟨(-244037258857845153364503487992193 / 20000000000000000000000000000000), (50292631037 / 12500000000000000000000000000000)⟩ ⟨-18, 502109287941468832085436601, 381469726562500000000000000⟩] +lemma CA2_7_7I2R0Certificates_valid : + CA2_7_7I2R0Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_7_7I2R0CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 0, 0 => 1 + | _, _ => 0 +def CA2_7_7I2R0P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_7_7I2R0Certificates (CA2_7_7I2R0CertificateIndex a)).input +lemma CA2_7_7I2R0P_check : ∀ a : PairSlot, contains (CA2_7_7I2R0Raw a) (CA2_7_7I2R0P a) = true := by + decide +kernel +lemma CA2_7_7I2R0P_sound (a : PairSlot) : + (CA2_7_7I2R0P a).Encloses (CA2_7_7I2R0Value a) := + contains_sound (CA2_7_7I2R0Raw_sound a) (CA2_7_7I2R0P_check a) +def CA2_7_7I2R0Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_7_7I2R0Certificates (CA2_7_7I2R0CertificateIndex a)).output +lemma CA2_7_7I2R0Terms_sound (a : PairSlot) : + (CA2_7_7I2R0Terms a).Encloses (Foundation.entropyTerm (CA2_7_7I2R0Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_7_7I2R0Certificates_valid + (CA2_7_7I2R0CertificateIndex a) (CA2_7_7I2R0P_sound a) +def CA2_7_7I2R0Entropy : Ball := ⟨(3063334356907513434862083549 / 50000000000000000000000000000000), (2020217 / 100000000000000000000000000000000)⟩ +lemma CA2_7_7I2R0Entropy_sound : CA2_7_7I2R0Entropy.Encloses (Foundation.finiteEntropy CA2_7_7I2R0Value) := by + exact contains_sound (entropyPair_enclosed CA2_7_7I2R0Value CA2_7_7I2R0Terms CA2_7_7I2R0Terms_sound) (by decide +kernel) +def CA2_7_7I2R0Mass : Ball := ⟨(502109287941468832085436601 / 100000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ +lemma CA2_7_7I2R0Mass_sound : CA2_7_7I2R0Mass.Encloses (∑ a, CA2_7_7I2R0Value a) := by + exact contains_sound (pairSumBall_sound CA2_7_7I2R0P CA2_7_7I2R0Value CA2_7_7I2R0P_sound) (by decide +kernel) +def CA2_7_7I2R0MassTermLogWitness : LogWitness := ⟨-18, 502109287941468832085436601, 381469726562500000000000000⟩ +def CA2_7_7I2R0MassTermLog : Ball := ⟨(-244037258857845153364503487992193 / 20000000000000000000000000000000), (50292631037 / 12500000000000000000000000000000)⟩ +lemma CA2_7_7I2R0MassTermLog_sound : CA2_7_7I2R0MassTermLog.Encloses (Real.log ((∑ a, CA2_7_7I2R0Value a))) := by + exact checkLog_sound logTwoBall_sound (CA2_7_7I2R0Mass_sound) (w := CA2_7_7I2R0MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA2_7_7I2R0MassTerm : Ball := ⟨(3063334356907513434862083549 / 50000000000000000000000000000000), (2020217 / 100000000000000000000000000000000)⟩ +lemma CA2_7_7I2R0MassTerm_sound : CA2_7_7I2R0MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_7_7I2R0Value a))) := by + exact contains_sound (entropyTerm_ball (CA2_7_7I2R0Mass_sound) CA2_7_7I2R0MassTermLog_sound) (by decide +kernel) +def CA2_7_7I2R0H : Ball := ⟨0, (2020217 / 50000000000000000000000000000000)⟩ +lemma CA2_7_7I2R0H_sound : CA2_7_7I2R0H.Encloses (homogeneousEntropy CA2_7_7I2R0Value) := by + exact contains_sound (homogeneous_enclosed CA2_7_7I2R0Value CA2_7_7I2R0MassTerm_sound CA2_7_7I2R0Entropy_sound) (by decide +kernel) +def CA2_7_7I2R1Value (a : PairSlot) : ℝ := residualLaw (below (shape 2 7 7)) (fun u => (stageALaw (shape 2 7 7) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 1 a +def CA2_7_7I2R1Raw (a : PairSlot) : Ball := residualBall (below (shape 2 7 7)) A2_7_7Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 1 a +lemma CA2_7_7I2R1Raw_sound (a : PairSlot) : + (CA2_7_7I2R1Raw a).Encloses (CA2_7_7I2R1Value a) := by + exact residualBall_sound_on (below (shape 2 7 7)) A2_7_7Law (fun u => (stageALaw (shape 2 7 7) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A2_7_7Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 2 7 7) (show (shape 2 7 7) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 1 a +def CA2_7_7I2R1Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(61021004836896843510631497413 / 100000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ ⟨(112914904520571858587520645573 / 25000000000000000000000000000000), (77530211 / 50000000000000000000000000000000)⟩ ⟨(-370085365924020147984039148650649 / 50000000000000000000000000000000), (254109887473 / 100000000000000000000000000000000)⟩ ⟨-11, 61021004836896843510631497413, 48828125000000000000000000000⟩] +lemma CA2_7_7I2R1Certificates_valid : + CA2_7_7I2R1Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_7_7I2R1CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 1, 0 => 1 + | 0, 1 => 1 + | _, _ => 0 +def CA2_7_7I2R1P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_7_7I2R1Certificates (CA2_7_7I2R1CertificateIndex a)).input +lemma CA2_7_7I2R1P_check : ∀ a : PairSlot, contains (CA2_7_7I2R1Raw a) (CA2_7_7I2R1P a) = true := by + decide +kernel +lemma CA2_7_7I2R1P_sound (a : PairSlot) : + (CA2_7_7I2R1P a).Encloses (CA2_7_7I2R1Value a) := + contains_sound (CA2_7_7I2R1Raw_sound a) (CA2_7_7I2R1P_check a) +def CA2_7_7I2R1Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_7_7I2R1Certificates (CA2_7_7I2R1CertificateIndex a)).output +lemma CA2_7_7I2R1Terms_sound (a : PairSlot) : + (CA2_7_7I2R1Terms a).Encloses (Foundation.entropyTerm (CA2_7_7I2R1Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_7_7I2R1Certificates_valid + (CA2_7_7I2R1CertificateIndex a) (CA2_7_7I2R1P_sound a) +def CA2_7_7I2R1Entropy : Ball := ⟨(112914904520571858587520645573 / 12500000000000000000000000000000), (77530211 / 25000000000000000000000000000000)⟩ +lemma CA2_7_7I2R1Entropy_sound : CA2_7_7I2R1Entropy.Encloses (Foundation.finiteEntropy CA2_7_7I2R1Value) := by + exact contains_sound (entropyPair_enclosed CA2_7_7I2R1Value CA2_7_7I2R1Terms CA2_7_7I2R1Terms_sound) (by decide +kernel) +def CA2_7_7I2R1Mass : Ball := ⟨(61021004836896843510631497413 / 50000000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ +lemma CA2_7_7I2R1Mass_sound : CA2_7_7I2R1Mass.Encloses (∑ a, CA2_7_7I2R1Value a) := by + exact contains_sound (pairSumBall_sound CA2_7_7I2R1P CA2_7_7I2R1Value CA2_7_7I2R1P_sound) (by decide +kernel) +def CA2_7_7I2R1MassTermLogWitness : LogWitness := ⟨-10, 61021004836896843510631497413, 48828125000000000000000000000⟩ +def CA2_7_7I2R1MassTermLog : Ball := ⟨(-83857001724005720628294388031371 / 12500000000000000000000000000000), (23293406379 / 10000000000000000000000000000000)⟩ +lemma CA2_7_7I2R1MassTermLog_sound : CA2_7_7I2R1MassTermLog.Encloses (Real.log ((∑ a, CA2_7_7I2R1Value a))) := by + exact checkLog_sound logTwoBall_sound (CA2_7_7I2R1Mass_sound) (w := CA2_7_7I2R1MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA2_7_7I2R1MassTerm : Ball := ⟨(818726161249315203770880901103 / 100000000000000000000000000000000), (888367 / 312500000000000000000000000000)⟩ +lemma CA2_7_7I2R1MassTerm_sound : CA2_7_7I2R1MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_7_7I2R1Value a))) := by + exact contains_sound (entropyTerm_ball (CA2_7_7I2R1Mass_sound) CA2_7_7I2R1MassTermLog_sound) (by decide +kernel) +def CA2_7_7I2R1H : Ball := ⟨(84593074915259664929284263481 / 100000000000000000000000000000000), (148599571 / 25000000000000000000000000000000)⟩ +lemma CA2_7_7I2R1H_sound : CA2_7_7I2R1H.Encloses (homogeneousEntropy CA2_7_7I2R1Value) := by + exact contains_sound (homogeneous_enclosed CA2_7_7I2R1Value CA2_7_7I2R1MassTerm_sound CA2_7_7I2R1Entropy_sound) (by decide +kernel) +def CA2_7_7I2R2Value (a : PairSlot) : ℝ := residualLaw (below (shape 2 7 7)) (fun u => (stageALaw (shape 2 7 7) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 2 a +def CA2_7_7I2R2Raw (a : PairSlot) : Ball := residualBall (below (shape 2 7 7)) A2_7_7Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 2 a +lemma CA2_7_7I2R2Raw_sound (a : PairSlot) : + (CA2_7_7I2R2Raw a).Encloses (CA2_7_7I2R2Value a) := by + exact residualBall_sound_on (below (shape 2 7 7)) A2_7_7Law (fun u => (stageALaw (shape 2 7 7) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A2_7_7Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 2 7 7) (show (shape 2 7 7) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 2 a +def CA2_7_7I2R2Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(461021550444907393413351550401 / 50000000000000000000000000000000), (7 / 100000000000000000000000000000000)⟩ ⟨(4321001467844565078070936299133 / 100000000000000000000000000000000), (1562001811 / 100000000000000000000000000000000)⟩ ⟨(-46863334953372529309297799122213 / 10000000000000000000000000000000), (84703295111 / 50000000000000000000000000000000)⟩ ⟨-7, 461021550444907393413351550401, 390625000000000000000000000000⟩, + .log ⟨(24386991200266839911037879939 / 25000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ ⟨(169064798213358252125773084711 / 25000000000000000000000000000000), (247879037 / 100000000000000000000000000000000)⟩ ⟨(-346629063062745441837771588922581 / 50000000000000000000000000000000), (127054943123 / 50000000000000000000000000000000)⟩ ⟨-11, 24386991200266839911037879939, 12207031250000000000000000000⟩, + .log ⟨(3483774427281869882558098408561 / 100000000000000000000000000000000), (9 / 50000000000000000000000000000000)⟩ ⟨(5847609219356964929723995082299 / 50000000000000000000000000000000), (221315383 / 5000000000000000000000000000000)⟩ ⟨(-335705387442057754048834480698173 / 100000000000000000000000000000000), (63527471307 / 50000000000000000000000000000000)⟩ ⟨-5, 3483774427281869882558098408561, 3125000000000000000000000000000⟩] +lemma CA2_7_7I2R2Certificates_valid : + CA2_7_7I2R2Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_7_7I2R2CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 2, 0 => 1 + | 3, 0 => 2 + | 1, 1 => 3 + | 0, 2 => 1 + | 0, 3 => 2 + | _, _ => 0 +def CA2_7_7I2R2P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_7_7I2R2Certificates (CA2_7_7I2R2CertificateIndex a)).input +lemma CA2_7_7I2R2P_check : ∀ a : PairSlot, contains (CA2_7_7I2R2Raw a) (CA2_7_7I2R2P a) = true := by + decide +kernel +lemma CA2_7_7I2R2P_sound (a : PairSlot) : + (CA2_7_7I2R2P a).Encloses (CA2_7_7I2R2Value a) := + contains_sound (CA2_7_7I2R2Raw_sound a) (CA2_7_7I2R2P_check a) +def CA2_7_7I2R2Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_7_7I2R2Certificates (CA2_7_7I2R2CertificateIndex a)).output +lemma CA2_7_7I2R2Terms_sound (a : PairSlot) : + (CA2_7_7I2R2Terms a).Encloses (Foundation.entropyTerm (CA2_7_7I2R2Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_7_7I2R2Certificates_valid + (CA2_7_7I2R2CertificateIndex a) (CA2_7_7I2R2P_sound a) +def CA2_7_7I2R2Entropy : Ball := ⟨(2711217470013740754074505930069 / 12500000000000000000000000000000), (2011517339 / 25000000000000000000000000000000)⟩ +lemma CA2_7_7I2R2Entropy_sound : CA2_7_7I2R2Entropy.Encloses (Foundation.finiteEntropy CA2_7_7I2R2Value) := by + exact contains_sound (entropyPair_enclosed CA2_7_7I2R2Value CA2_7_7I2R2Terms CA2_7_7I2R2Terms_sound) (by decide +kernel) +def CA2_7_7I2R2Mass : Ball := ⟨(5522956558663634175499807649677 / 100000000000000000000000000000000), (9 / 25000000000000000000000000000000)⟩ +lemma CA2_7_7I2R2Mass_sound : CA2_7_7I2R2Mass.Encloses (∑ a, CA2_7_7I2R2Value a) := by + exact contains_sound (pairSumBall_sound CA2_7_7I2R2P CA2_7_7I2R2Value CA2_7_7I2R2P_sound) (by decide +kernel) +def CA2_7_7I2R2MassTermLogWitness : LogWitness := ⟨-5, 5522956558663634175499807649677, 3125000000000000000000000000000⟩ +def CA2_7_7I2R2MassTermLog : Ball := ⟨(-1158502744253016410078641519441 / 400000000000000000000000000000), (127054942749 / 100000000000000000000000000000000)⟩ +lemma CA2_7_7I2R2MassTermLog_sound : CA2_7_7I2R2MassTermLog.Encloses (Real.log ((∑ a, CA2_7_7I2R2Value a))) := by + exact checkLog_sound logTwoBall_sound (CA2_7_7I2R2Mass_sound) (w := CA2_7_7I2R2MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA2_7_7I2R2MassTerm : Ball := ⟨(15995900824005039517055163864603 / 100000000000000000000000000000000), (3508594699 / 50000000000000000000000000000000)⟩ +lemma CA2_7_7I2R2MassTerm_sound : CA2_7_7I2R2MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_7_7I2R2Value a))) := by + exact contains_sound (entropyTerm_ball (CA2_7_7I2R2Mass_sound) CA2_7_7I2R2MassTermLog_sound) (by decide +kernel) +def CA2_7_7I2R2H : Ball := ⟨(5693838936104886515540883575949 / 100000000000000000000000000000000), (7531629377 / 50000000000000000000000000000000)⟩ +lemma CA2_7_7I2R2H_sound : CA2_7_7I2R2H.Encloses (homogeneousEntropy CA2_7_7I2R2Value) := by + exact contains_sound (homogeneous_enclosed CA2_7_7I2R2Value CA2_7_7I2R2MassTerm_sound CA2_7_7I2R2Entropy_sound) (by decide +kernel) +def CA2_7_7I2R3Value (a : PairSlot) : ℝ := residualLaw (below (shape 2 7 7)) (fun u => (stageALaw (shape 2 7 7) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 3 a +def CA2_7_7I2R3Raw (a : PairSlot) : Ball := residualBall (below (shape 2 7 7)) A2_7_7Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 3 a +lemma CA2_7_7I2R3Raw_sound (a : PairSlot) : + (CA2_7_7I2R3Raw a).Encloses (CA2_7_7I2R3Value a) := by + exact residualBall_sound_on (below (shape 2 7 7)) A2_7_7Law (fun u => (stageALaw (shape 2 7 7) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A2_7_7Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 2 7 7) (show (shape 2 7 7) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 3 a +def CA2_7_7I2R3Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(131095704406984719407700239349 / 25000000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ ⟨(2753378685052309096502096580713 / 100000000000000000000000000000000), (499690727 / 50000000000000000000000000000000)⟩ ⟨(-21002813917567312255242342477773 / 4000000000000000000000000000000), (190582413909 / 100000000000000000000000000000000)⟩ ⟨-8, 131095704406984719407700239349, 97656250000000000000000000000⟩, + .log ⟨(2270939017850000493846381468481 / 12500000000000000000000000000000), (39 / 100000000000000000000000000000000)⟩ ⟨(30985332075472481453487574065897 / 100000000000000000000000000000000), (7694240731 / 50000000000000000000000000000000)⟩ ⟨(-170553523409931108265824846279181 / 100000000000000000000000000000000), (42351647473 / 50000000000000000000000000000000)⟩ ⟨-3, 2270939017850000493846381468481, 1562500000000000000000000000000⟩, + .log ⟨(1354896351343567252040316827981 / 100000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ ⟨(1165602488999341910841382973429 / 20000000000000000000000000000000), (573820929 / 25000000000000000000000000000000)⟩ ⟨(-107536130701389604624485476198019 / 25000000000000000000000000000000), (33881317937 / 20000000000000000000000000000000)⟩ ⟨-7, 1354896351343567252040316827981, 781250000000000000000000000000⟩] +lemma CA2_7_7I2R3Certificates_valid : + CA2_7_7I2R3Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_7_7I2R3CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 4, 0 => 1 + | 2, 1 => 2 + | 3, 1 => 3 + | 1, 2 => 2 + | 1, 3 => 3 + | 0, 4 => 1 + | _, _ => 0 +def CA2_7_7I2R3P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_7_7I2R3Certificates (CA2_7_7I2R3CertificateIndex a)).input +lemma CA2_7_7I2R3P_check : ∀ a : PairSlot, contains (CA2_7_7I2R3Raw a) (CA2_7_7I2R3P a) = true := by + decide +kernel +lemma CA2_7_7I2R3P_sound (a : PairSlot) : + (CA2_7_7I2R3P a).Encloses (CA2_7_7I2R3Value a) := + contains_sound (CA2_7_7I2R3Raw_sound a) (CA2_7_7I2R3P_check a) +def CA2_7_7I2R3Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_7_7I2R3Certificates (CA2_7_7I2R3CertificateIndex a)).output +lemma CA2_7_7I2R3Terms_sound (a : PairSlot) : + (CA2_7_7I2R3Terms a).Encloses (Foundation.entropyTerm (CA2_7_7I2R3Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_7_7I2R3Certificates_valid + (CA2_7_7I2R3CertificateIndex a) (CA2_7_7I2R3P_sound a) +def CA2_7_7I2R3Entropy : Ball := ⟨(7913344641104300020839317102751 / 10000000000000000000000000000000), (2335393329 / 6250000000000000000000000000000)⟩ +lemma CA2_7_7I2R3Entropy_sound : CA2_7_7I2R3Entropy.Encloses (Foundation.finiteEntropy CA2_7_7I2R3Value) := by + exact contains_sound (entropyPair_enclosed CA2_7_7I2R3Value CA2_7_7I2R3Terms CA2_7_7I2R3Terms_sound) (by decide +kernel) +def CA2_7_7I2R3Mass : Ball := ⟨(801871652470860403217686781329 / 2000000000000000000000000000000), (23 / 25000000000000000000000000000000)⟩ +lemma CA2_7_7I2R3Mass_sound : CA2_7_7I2R3Mass.Encloses (∑ a, CA2_7_7I2R3Value a) := by + exact contains_sound (pairSumBall_sound CA2_7_7I2R3P CA2_7_7I2R3Value CA2_7_7I2R3P_sound) (by decide +kernel) +def CA2_7_7I2R3MassTermLogWitness : LogWitness := ⟨-2, 801871652470860403217686781329, 500000000000000000000000000000⟩ +def CA2_7_7I2R3MassTermLog : Ball := ⟨(-18279077976160747981294955766949 / 20000000000000000000000000000000), (31763735639 / 50000000000000000000000000000000)⟩ +lemma CA2_7_7I2R3MassTermLog_sound : CA2_7_7I2R3MassTermLog.Encloses (Real.log ((∑ a, CA2_7_7I2R3Value a))) := by + exact checkLog_sound logTwoBall_sound (CA2_7_7I2R3Mass_sound) (w := CA2_7_7I2R3MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA2_7_7I2R3MassTerm : Ball := ⟨(36643686155969324069048097794141 / 100000000000000000000000000000000), (2547043927 / 10000000000000000000000000000000)⟩ +lemma CA2_7_7I2R3MassTerm_sound : CA2_7_7I2R3MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_7_7I2R3Value a))) := by + exact contains_sound (entropyTerm_ball (CA2_7_7I2R3Mass_sound) CA2_7_7I2R3MassTermLog_sound) (by decide +kernel) +def CA2_7_7I2R3H : Ball := ⟨(42489760255073676139345073233369 / 100000000000000000000000000000000), (31418366267 / 50000000000000000000000000000000)⟩ +lemma CA2_7_7I2R3H_sound : CA2_7_7I2R3H.Encloses (homogeneousEntropy CA2_7_7I2R3Value) := by + exact contains_sound (homogeneous_enclosed CA2_7_7I2R3Value CA2_7_7I2R3MassTerm_sound CA2_7_7I2R3Entropy_sound) (by decide +kernel) +def CA2_7_7I2R4Value (a : PairSlot) : ℝ := residualLaw (below (shape 2 7 7)) (fun u => (stageALaw (shape 2 7 7) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 4 a +def CA2_7_7I2R4Raw (a : PairSlot) : Ball := residualBall (below (shape 2 7 7)) A2_7_7Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 4 a +lemma CA2_7_7I2R4Raw_sound (a : PairSlot) : + (CA2_7_7I2R4Raw a).Encloses (CA2_7_7I2R4Value a) := by + exact residualBall_sound_on (below (shape 2 7 7)) A2_7_7Law (fun u => (stageALaw (shape 2 7 7) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A2_7_7Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 2 7 7) (show (shape 2 7 7) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 4 a +def CA2_7_7I2R4Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(5277967175821923079897539329 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(25992363903925895922513432917 / 50000000000000000000000000000000), (894123 / 5000000000000000000000000000000)⟩ ⟨(-246234611149113273170862319465459 / 25000000000000000000000000000000), (169406598937 / 50000000000000000000000000000000)⟩ ⟨-15, 5277967175821923079897539329, 3051757812500000000000000000⟩, + .log ⟨(2038260987631875115742940545529 / 100000000000000000000000000000000), (1 / 12500000000000000000000000000000)⟩ ⟨(7935099222952918042652310790589 / 100000000000000000000000000000000), (302132991 / 10000000000000000000000000000000)⟩ ⟨(-389307319872329085824439203688361 / 100000000000000000000000000000000), (148230766173 / 100000000000000000000000000000000)⟩ ⟨-6, 2038260987631875115742940545529, 1562500000000000000000000000000⟩, + .log ⟨(10796235779384559959949417266089 / 50000000000000000000000000000000), (21 / 50000000000000000000000000000000)⟩ ⟨(33097490387073889598235127180257 / 100000000000000000000000000000000), (18289534931 / 100000000000000000000000000000000)⟩ ⟨(-76641273549883082343996926940597 / 50000000000000000000000000000000), (42351647463 / 50000000000000000000000000000000)⟩ ⟨-3, 10796235779384559959949417266089, 6250000000000000000000000000000⟩, + .log ⟨(108499099170855725901779589871 / 10000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ ⟨(613507953043183359593479737449 / 12500000000000000000000000000000), (459511563 / 25000000000000000000000000000000)⟩ ⟨(-226179925080144666452584544784981 / 50000000000000000000000000000000), (8470329487 / 5000000000000000000000000000000)⟩ ⟨-7, 108499099170855725901779589871, 78125000000000000000000000000⟩, + .log ⟨(15492620375214302470057270997 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(135909967504824284589811746589 / 100000000000000000000000000000000), (4592967 / 10000000000000000000000000000000)⟩ ⟨(-438628082962189999951851555532183 / 50000000000000000000000000000000), (9264423063 / 3125000000000000000000000000000)⟩ ⟨-13, 15492620375214302470057270997, 12207031250000000000000000000⟩] +lemma CA2_7_7I2R4Certificates_valid : + CA2_7_7I2R4Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_7_7I2R4CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 5, 0 => 1 + | 4, 1 => 2 + | 2, 2 => 3 + | 2, 3 => 4 + | 3, 2 => 4 + | 3, 3 => 5 + | 1, 4 => 2 + | 0, 5 => 1 + | _, _ => 0 +def CA2_7_7I2R4P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_7_7I2R4Certificates (CA2_7_7I2R4CertificateIndex a)).input +lemma CA2_7_7I2R4P_check : ∀ a : PairSlot, contains (CA2_7_7I2R4Raw a) (CA2_7_7I2R4P a) = true := by + decide +kernel +lemma CA2_7_7I2R4P_sound (a : PairSlot) : + (CA2_7_7I2R4P a).Encloses (CA2_7_7I2R4Value a) := + contains_sound (CA2_7_7I2R4Raw_sound a) (CA2_7_7I2R4P_check a) +def CA2_7_7I2R4Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_7_7I2R4Certificates (CA2_7_7I2R4CertificateIndex a)).output +lemma CA2_7_7I2R4Terms_sound (a : PairSlot) : + (CA2_7_7I2R4Terms a).Encloses (Foundation.entropyTerm (CA2_7_7I2R4Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_7_7I2R4Certificates_valid + (CA2_7_7I2R4CertificateIndex a) (CA2_7_7I2R4P_sound a) +def CA2_7_7I2R4Entropy : Ball := ⟨(14755923876197796826328822509719 / 25000000000000000000000000000000), (5617996369 / 20000000000000000000000000000000)⟩ +lemma CA2_7_7I2R4Entropy_sound : CA2_7_7I2R4Entropy.Encloses (Foundation.finiteEntropy CA2_7_7I2R4Value) := by + exact contains_sound (entropyPair_enclosed CA2_7_7I2R4Value CA2_7_7I2R4Terms CA2_7_7I2R4Terms_sound) (by decide +kernel) +def CA2_7_7I2R4Mass : Ball := ⟨(27865024072176842818050159770311 / 100000000000000000000000000000000), (67 / 100000000000000000000000000000000)⟩ +lemma CA2_7_7I2R4Mass_sound : CA2_7_7I2R4Mass.Encloses (∑ a, CA2_7_7I2R4Value a) := by + exact contains_sound (pairSumBall_sound CA2_7_7I2R4P CA2_7_7I2R4Value CA2_7_7I2R4P_sound) (by decide +kernel) +def CA2_7_7I2R4MassTermLogWitness : LogWitness := ⟨-2, 27865024072176842818050159770311, 25000000000000000000000000000000⟩ +def CA2_7_7I2R4MassTermLog : Ball := ⟨(-25555958021623995984140828497229 / 20000000000000000000000000000000), (63527471289 / 100000000000000000000000000000000)⟩ +lemma CA2_7_7I2R4MassTermLog_sound : CA2_7_7I2R4MassTermLog.Encloses (Real.log ((∑ a, CA2_7_7I2R4Value a))) := by + exact checkLog_sound logTwoBall_sound (CA2_7_7I2R4Mass_sound) (w := CA2_7_7I2R4MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA2_7_7I2R4MassTerm : Ball := ⟨(178029346365023383066357772421 / 500000000000000000000000000000), (8850972627 / 50000000000000000000000000000000)⟩ +lemma CA2_7_7I2R4MassTerm_sound : CA2_7_7I2R4MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_7_7I2R4Value a))) := by + exact contains_sound (entropyTerm_ball (CA2_7_7I2R4Mass_sound) CA2_7_7I2R4MassTermLog_sound) (by decide +kernel) +def CA2_7_7I2R4H : Ball := ⟨(5854456557946627673010933888669 / 25000000000000000000000000000000), (45791927099 / 100000000000000000000000000000000)⟩ +lemma CA2_7_7I2R4H_sound : CA2_7_7I2R4H.Encloses (homogeneousEntropy CA2_7_7I2R4Value) := by + exact contains_sound (homogeneous_enclosed CA2_7_7I2R4Value CA2_7_7I2R4MassTerm_sound CA2_7_7I2R4Entropy_sound) (by decide +kernel) +def CA2_7_7I2R5Value (a : PairSlot) : ℝ := residualLaw (below (shape 2 7 7)) (fun u => (stageALaw (shape 2 7 7) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 5 a +def CA2_7_7I2R5Raw (a : PairSlot) : Ball := residualBall (below (shape 2 7 7)) A2_7_7Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 5 a +lemma CA2_7_7I2R5Raw_sound (a : PairSlot) : + (CA2_7_7I2R5Raw a).Encloses (CA2_7_7I2R5Value a) := by + exact residualBall_sound_on (below (shape 2 7 7)) A2_7_7Law (fun u => (stageALaw (shape 2 7 7) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A2_7_7Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 2 7 7) (show (shape 2 7 7) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 5 a +def CA2_7_7I2R5Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(147261181015888131340596841 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(3342543549552779568172383377 / 25000000000000000000000000000000), (1122619 / 25000000000000000000000000000000)⟩ ⟨(-283725786260683812153665541671581 / 25000000000000000000000000000000), (381164911177 / 100000000000000000000000000000000)⟩ ⟨-17, 147261181015888131340596841, 95367431640625000000000000⟩, + .log ⟨(192105488604869140798984184437 / 25000000000000000000000000000000), (1 / 20000000000000000000000000000000)⟩ ⟨(3741128725067483292783869146183 / 100000000000000000000000000000000), (732238567 / 50000000000000000000000000000000)⟩ ⟨(-97371729257626738127061474219161 / 20000000000000000000000000000000), (95291206899 / 50000000000000000000000000000000)⟩ ⟨-8, 192105488604869140798984184437, 97656250000000000000000000000⟩, + .log ⟨(28426185916905566073339232999 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(58029320434616063406177313117 / 25000000000000000000000000000000), (78253237 / 100000000000000000000000000000000)⟩ ⟨(-816561470529255613905471137791119 / 100000000000000000000000000000000), (68821427849 / 25000000000000000000000000000000)⟩ ⟨-12, 28426185916905566073339232999, 24414062500000000000000000000⟩] +lemma CA2_7_7I2R5Certificates_valid : + CA2_7_7I2R5Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_7_7I2R5CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 5, 1 => 1 + | 4, 2 => 2 + | 4, 3 => 3 + | 2, 4 => 2 + | 3, 4 => 3 + | 1, 5 => 1 + | _, _ => 0 +def CA2_7_7I2R5P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_7_7I2R5Certificates (CA2_7_7I2R5CertificateIndex a)).input +lemma CA2_7_7I2R5P_check : ∀ a : PairSlot, contains (CA2_7_7I2R5Raw a) (CA2_7_7I2R5P a) = true := by + decide +kernel +lemma CA2_7_7I2R5P_sound (a : PairSlot) : + (CA2_7_7I2R5P a).Encloses (CA2_7_7I2R5Value a) := + contains_sound (CA2_7_7I2R5Raw_sound a) (CA2_7_7I2R5P_check a) +def CA2_7_7I2R5Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_7_7I2R5Certificates (CA2_7_7I2R5CertificateIndex a)).output +lemma CA2_7_7I2R5Terms_sound (a : PairSlot) : + (CA2_7_7I2R5Terms a).Encloses (Foundation.entropyTerm (CA2_7_7I2R5Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_7_7I2R5Certificates_valid + (CA2_7_7I2R5CertificateIndex a) (CA2_7_7I2R5P_sound a) +def CA2_7_7I2R5Entropy : Ball := ⟨(3986616181004158664681267932159 / 50000000000000000000000000000000), (1547220847 / 50000000000000000000000000000000)⟩ +lemma CA2_7_7I2R5Entropy_sound : CA2_7_7I2R5Entropy.Encloses (Foundation.finiteEntropy CA2_7_7I2R5Value) := by + exact contains_sound (entropyPair_enclosed CA2_7_7I2R5Value CA2_7_7I2R5Terms CA2_7_7I2R5Terms_sound) (by decide +kernel) +def CA2_7_7I2R5Mass : Ball := ⟨(31921049191380369372800029819 / 2000000000000000000000000000000), (7 / 50000000000000000000000000000000)⟩ +lemma CA2_7_7I2R5Mass_sound : CA2_7_7I2R5Mass.Encloses (∑ a, CA2_7_7I2R5Value a) := by + exact contains_sound (pairSumBall_sound CA2_7_7I2R5P CA2_7_7I2R5Value CA2_7_7I2R5P_sound) (by decide +kernel) +def CA2_7_7I2R5MassTermLogWitness : LogWitness := ⟨-6, 31921049191380369372800029819, 31250000000000000000000000000⟩ +def CA2_7_7I2R5MassTermLog : Ball := ⟨(-413763681809651446200549432929053 / 100000000000000000000000000000000), (148230766657 / 100000000000000000000000000000000)⟩ +lemma CA2_7_7I2R5MassTermLog_sound : CA2_7_7I2R5MassTermLog.Encloses (Real.log ((∑ a, CA2_7_7I2R5Value a))) := by + exact checkLog_sound logTwoBall_sound (CA2_7_7I2R5Mass_sound) (w := CA2_7_7I2R5MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA2_7_7I2R5MassTerm : Ball := ⟨(1650971355081567343108674590919 / 25000000000000000000000000000000), (295730107 / 12500000000000000000000000000000)⟩ +lemma CA2_7_7I2R5MassTerm_sound : CA2_7_7I2R5MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_7_7I2R5Value a))) := by + exact contains_sound (entropyTerm_ball (CA2_7_7I2R5Mass_sound) CA2_7_7I2R5MassTermLog_sound) (by decide +kernel) +def CA2_7_7I2R5H : Ball := ⟨(684673470841023978463918750321 / 50000000000000000000000000000000), (109205651 / 2000000000000000000000000000000)⟩ +lemma CA2_7_7I2R5H_sound : CA2_7_7I2R5H.Encloses (homogeneousEntropy CA2_7_7I2R5Value) := by + exact contains_sound (homogeneous_enclosed CA2_7_7I2R5Value CA2_7_7I2R5MassTerm_sound CA2_7_7I2R5Entropy_sound) (by decide +kernel) +def CA2_7_7I2R6Value (a : PairSlot) : ℝ := residualLaw (below (shape 2 7 7)) (fun u => (stageALaw (shape 2 7 7) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 6 a +def CA2_7_7I2R6Raw (a : PairSlot) : Ball := residualBall (below (shape 2 7 7)) A2_7_7Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 6 a +lemma CA2_7_7I2R6Raw_sound (a : PairSlot) : + (CA2_7_7I2R6Raw a).Encloses (CA2_7_7I2R6Value a) := by + exact residualBall_sound_on (below (shape 2 7 7)) A2_7_7Law (fun u => (stageALaw (shape 2 7 7) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A2_7_7Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 2 7 7) (show (shape 2 7 7) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 6 a +def CA2_7_7I2R6Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(158644053613467679879438893 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(529633875297408340945825551 / 25000000000000000000000000000000), (705493 / 100000000000000000000000000000000)⟩ ⟨(-1335401770778873824862002345811629 / 100000000000000000000000000000000), (111173231921 / 25000000000000000000000000000000)⟩ ⟨-20, 158644053613467679879438893, 95367431640625000000000000⟩, + .log ⟨(2498801268892056157639 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(4603057917178023187341 / 2000000000000000000000000000000), (99 / 100000000000000000000000000000000)⟩ ⟨(-2302633053737689631189372509690703 / 100000000000000000000000000000000), (751158626129 / 100000000000000000000000000000000)⟩ ⟨-34, 39980820302272898522224, 23283064365386962890625⟩, + .log ⟨(2079393777372476244711147537 / 12500000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ ⟨(2894984425979975586826580021 / 2000000000000000000000000000000), (49316841 / 100000000000000000000000000000000)⟩ ⟨(-870140752524420958626435392655381 / 100000000000000000000000000000000), (9264423237 / 3125000000000000000000000000000)⟩ ⟨-13, 2079393777372476244711147537, 1525878906250000000000000000⟩] +lemma CA2_7_7I2R6Certificates_valid : + CA2_7_7I2R6Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_7_7I2R6CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 5, 2 => 1 + | 5, 3 => 2 + | 4, 4 => 3 + | 2, 5 => 1 + | 3, 5 => 2 + | _, _ => 0 +def CA2_7_7I2R6P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_7_7I2R6Certificates (CA2_7_7I2R6CertificateIndex a)).input +lemma CA2_7_7I2R6P_check : ∀ a : PairSlot, contains (CA2_7_7I2R6Raw a) (CA2_7_7I2R6P a) = true := by + decide +kernel +lemma CA2_7_7I2R6P_sound (a : PairSlot) : + (CA2_7_7I2R6P a).Encloses (CA2_7_7I2R6Value a) := + contains_sound (CA2_7_7I2R6Raw_sound a) (CA2_7_7I2R6P_check a) +def CA2_7_7I2R6Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_7_7I2R6Certificates (CA2_7_7I2R6CertificateIndex a)).output +lemma CA2_7_7I2R6Terms_sound (a : PairSlot) : + (CA2_7_7I2R6Terms a).Encloses (Foundation.entropyTerm (CA2_7_7I2R6Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_7_7I2R6Certificates_valid + (CA2_7_7I2R6CertificateIndex a) (CA2_7_7I2R6P_sound a) +def CA2_7_7I2R6Entropy : Ball := ⟨(74493376303584881935607169779 / 50000000000000000000000000000000), (2029121 / 4000000000000000000000000000000)⟩ +lemma CA2_7_7I2R6Entropy_sound : CA2_7_7I2R6Entropy.Encloses (Foundation.finiteEntropy CA2_7_7I2R6Value) := by + exact contains_sound (entropyPair_enclosed CA2_7_7I2R6Value CA2_7_7I2R6Terms CA2_7_7I2R6Terms_sound) (by decide +kernel) +def CA2_7_7I2R6Mass : Ball := ⟨(8476229158308448226948659597 / 50000000000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ +lemma CA2_7_7I2R6Mass_sound : CA2_7_7I2R6Mass.Encloses (∑ a, CA2_7_7I2R6Value a) := by + exact contains_sound (pairSumBall_sound CA2_7_7I2R6P CA2_7_7I2R6Value CA2_7_7I2R6P_sound) (by decide +kernel) +def CA2_7_7I2R6MassTermLogWitness : LogWitness := ⟨-13, 8476229158308448226948659597, 6103515625000000000000000000⟩ +def CA2_7_7I2R6MassTermLog : Ball := ⟨(-108531407602892182777984611149741 / 12500000000000000000000000000000), (148230783477 / 50000000000000000000000000000000)⟩ +lemma CA2_7_7I2R6MassTermLog_sound : CA2_7_7I2R6MassTermLog.Encloses (Real.log ((∑ a, CA2_7_7I2R6Value a))) := by + exact checkLog_sound logTwoBall_sound (CA2_7_7I2R6Mass_sound) (w := CA2_7_7I2R6MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA2_7_7I2R6MassTerm : Ball := ⟨(18398741634317878500727459383 / 12500000000000000000000000000000), (6282197 / 12500000000000000000000000000000)⟩ +lemma CA2_7_7I2R6MassTerm_sound : CA2_7_7I2R6MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_7_7I2R6Value a))) := by + exact contains_sound (entropyTerm_ball (CA2_7_7I2R6Mass_sound) CA2_7_7I2R6MassTermLog_sound) (by decide +kernel) +def CA2_7_7I2R6H : Ball := ⟨(898409766313367932697332247 / 50000000000000000000000000000000), (100985601 / 100000000000000000000000000000000)⟩ +lemma CA2_7_7I2R6H_sound : CA2_7_7I2R6H.Encloses (homogeneousEntropy CA2_7_7I2R6Value) := by + exact contains_sound (homogeneous_enclosed CA2_7_7I2R6Value CA2_7_7I2R6MassTerm_sound CA2_7_7I2R6Entropy_sound) (by decide +kernel) +def CA2_7_7I2R7Value (a : PairSlot) : ℝ := residualLaw (below (shape 2 7 7)) (fun u => (stageALaw (shape 2 7 7) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 7 a +def CA2_7_7I2R7Raw (a : PairSlot) : Ball := residualBall (below (shape 2 7 7)) A2_7_7Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 7 a +lemma CA2_7_7I2R7Raw_sound (a : PairSlot) : + (CA2_7_7I2R7Raw a).Encloses (CA2_7_7I2R7Value a) := by + exact residualBall_sound_on (below (shape 2 7 7)) A2_7_7Law (fun u => (stageALaw (shape 2 7 7) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A2_7_7Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 2 7 7) (show (shape 2 7 7) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 7 a +def CA2_7_7I2R7Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA2_7_7I2R7Certificates_valid : + CA2_7_7I2R7Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_7_7I2R7CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA2_7_7I2R7P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_7_7I2R7Certificates (CA2_7_7I2R7CertificateIndex a)).input +lemma CA2_7_7I2R7P_check : ∀ a : PairSlot, contains (CA2_7_7I2R7Raw a) (CA2_7_7I2R7P a) = true := by + decide +kernel +lemma CA2_7_7I2R7P_sound (a : PairSlot) : + (CA2_7_7I2R7P a).Encloses (CA2_7_7I2R7Value a) := + contains_sound (CA2_7_7I2R7Raw_sound a) (CA2_7_7I2R7P_check a) +def CA2_7_7I2R7Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_7_7I2R7Certificates (CA2_7_7I2R7CertificateIndex a)).output +lemma CA2_7_7I2R7Terms_sound (a : PairSlot) : + (CA2_7_7I2R7Terms a).Encloses (Foundation.entropyTerm (CA2_7_7I2R7Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_7_7I2R7Certificates_valid + (CA2_7_7I2R7CertificateIndex a) (CA2_7_7I2R7P_sound a) +def CA2_7_7I2R7Entropy : Ball := ⟨0, 0⟩ +lemma CA2_7_7I2R7Entropy_sound : CA2_7_7I2R7Entropy.Encloses (Foundation.finiteEntropy CA2_7_7I2R7Value) := by + exact contains_sound (entropyPair_enclosed CA2_7_7I2R7Value CA2_7_7I2R7Terms CA2_7_7I2R7Terms_sound) (by decide +kernel) +def CA2_7_7I2R7Mass : Ball := ⟨0, 0⟩ +lemma CA2_7_7I2R7Mass_sound : CA2_7_7I2R7Mass.Encloses (∑ a, CA2_7_7I2R7Value a) := by + exact contains_sound (pairSumBall_sound CA2_7_7I2R7P CA2_7_7I2R7Value CA2_7_7I2R7P_sound) (by decide +kernel) +def CA2_7_7I2R7MassTerm : Ball := .exact 0 +lemma CA2_7_7I2R7MassTerm_sound : CA2_7_7I2R7MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_7_7I2R7Value a))) := + entropyTerm_zero_ball (CA2_7_7I2R7Mass_sound) +def CA2_7_7I2R7H : Ball := ⟨0, 0⟩ +lemma CA2_7_7I2R7H_sound : CA2_7_7I2R7H.Encloses (homogeneousEntropy CA2_7_7I2R7Value) := by + exact contains_sound (homogeneous_enclosed CA2_7_7I2R7Value CA2_7_7I2R7MassTerm_sound CA2_7_7I2R7Entropy_sound) (by decide +kernel) +def CA2_7_7I2R8Value (a : PairSlot) : ℝ := residualLaw (below (shape 2 7 7)) (fun u => (stageALaw (shape 2 7 7) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 8 a +def CA2_7_7I2R8Raw (a : PairSlot) : Ball := residualBall (below (shape 2 7 7)) A2_7_7Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 8 a +lemma CA2_7_7I2R8Raw_sound (a : PairSlot) : + (CA2_7_7I2R8Raw a).Encloses (CA2_7_7I2R8Value a) := by + exact residualBall_sound_on (below (shape 2 7 7)) A2_7_7Law (fun u => (stageALaw (shape 2 7 7) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A2_7_7Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 2 7 7) (show (shape 2 7 7) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 8 a +def CA2_7_7I2R8Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA2_7_7I2R8Certificates_valid : + CA2_7_7I2R8Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_7_7I2R8CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA2_7_7I2R8P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_7_7I2R8Certificates (CA2_7_7I2R8CertificateIndex a)).input +lemma CA2_7_7I2R8P_check : ∀ a : PairSlot, contains (CA2_7_7I2R8Raw a) (CA2_7_7I2R8P a) = true := by + decide +kernel +lemma CA2_7_7I2R8P_sound (a : PairSlot) : + (CA2_7_7I2R8P a).Encloses (CA2_7_7I2R8Value a) := + contains_sound (CA2_7_7I2R8Raw_sound a) (CA2_7_7I2R8P_check a) +def CA2_7_7I2R8Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_7_7I2R8Certificates (CA2_7_7I2R8CertificateIndex a)).output +lemma CA2_7_7I2R8Terms_sound (a : PairSlot) : + (CA2_7_7I2R8Terms a).Encloses (Foundation.entropyTerm (CA2_7_7I2R8Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_7_7I2R8Certificates_valid + (CA2_7_7I2R8CertificateIndex a) (CA2_7_7I2R8P_sound a) +def CA2_7_7I2R8Entropy : Ball := ⟨0, 0⟩ +lemma CA2_7_7I2R8Entropy_sound : CA2_7_7I2R8Entropy.Encloses (Foundation.finiteEntropy CA2_7_7I2R8Value) := by + exact contains_sound (entropyPair_enclosed CA2_7_7I2R8Value CA2_7_7I2R8Terms CA2_7_7I2R8Terms_sound) (by decide +kernel) +def CA2_7_7I2R8Mass : Ball := ⟨0, 0⟩ +lemma CA2_7_7I2R8Mass_sound : CA2_7_7I2R8Mass.Encloses (∑ a, CA2_7_7I2R8Value a) := by + exact contains_sound (pairSumBall_sound CA2_7_7I2R8P CA2_7_7I2R8Value CA2_7_7I2R8P_sound) (by decide +kernel) +def CA2_7_7I2R8MassTerm : Ball := .exact 0 +lemma CA2_7_7I2R8MassTerm_sound : CA2_7_7I2R8MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_7_7I2R8Value a))) := + entropyTerm_zero_ball (CA2_7_7I2R8Mass_sound) +def CA2_7_7I2R8H : Ball := ⟨0, 0⟩ +lemma CA2_7_7I2R8H_sound : CA2_7_7I2R8H.Encloses (homogeneousEntropy CA2_7_7I2R8Value) := by + exact contains_sound (homogeneous_enclosed CA2_7_7I2R8Value CA2_7_7I2R8MassTerm_sound CA2_7_7I2R8Entropy_sound) (by decide +kernel) +def CA2_7_7I2R9Value (a : PairSlot) : ℝ := residualLaw (below (shape 2 7 7)) (fun u => (stageALaw (shape 2 7 7) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 9 a +def CA2_7_7I2R9Raw (a : PairSlot) : Ball := residualBall (below (shape 2 7 7)) A2_7_7Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 9 a +lemma CA2_7_7I2R9Raw_sound (a : PairSlot) : + (CA2_7_7I2R9Raw a).Encloses (CA2_7_7I2R9Value a) := by + exact residualBall_sound_on (below (shape 2 7 7)) A2_7_7Law (fun u => (stageALaw (shape 2 7 7) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A2_7_7Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 2 7 7) (show (shape 2 7 7) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 9 a +def CA2_7_7I2R9Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA2_7_7I2R9Certificates_valid : + CA2_7_7I2R9Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_7_7I2R9CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA2_7_7I2R9P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_7_7I2R9Certificates (CA2_7_7I2R9CertificateIndex a)).input +lemma CA2_7_7I2R9P_check : ∀ a : PairSlot, contains (CA2_7_7I2R9Raw a) (CA2_7_7I2R9P a) = true := by + decide +kernel +lemma CA2_7_7I2R9P_sound (a : PairSlot) : + (CA2_7_7I2R9P a).Encloses (CA2_7_7I2R9Value a) := + contains_sound (CA2_7_7I2R9Raw_sound a) (CA2_7_7I2R9P_check a) +def CA2_7_7I2R9Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_7_7I2R9Certificates (CA2_7_7I2R9CertificateIndex a)).output +lemma CA2_7_7I2R9Terms_sound (a : PairSlot) : + (CA2_7_7I2R9Terms a).Encloses (Foundation.entropyTerm (CA2_7_7I2R9Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_7_7I2R9Certificates_valid + (CA2_7_7I2R9CertificateIndex a) (CA2_7_7I2R9P_sound a) +def CA2_7_7I2R9Entropy : Ball := ⟨0, 0⟩ +lemma CA2_7_7I2R9Entropy_sound : CA2_7_7I2R9Entropy.Encloses (Foundation.finiteEntropy CA2_7_7I2R9Value) := by + exact contains_sound (entropyPair_enclosed CA2_7_7I2R9Value CA2_7_7I2R9Terms CA2_7_7I2R9Terms_sound) (by decide +kernel) +def CA2_7_7I2R9Mass : Ball := ⟨0, 0⟩ +lemma CA2_7_7I2R9Mass_sound : CA2_7_7I2R9Mass.Encloses (∑ a, CA2_7_7I2R9Value a) := by + exact contains_sound (pairSumBall_sound CA2_7_7I2R9P CA2_7_7I2R9Value CA2_7_7I2R9P_sound) (by decide +kernel) +def CA2_7_7I2R9MassTerm : Ball := .exact 0 +lemma CA2_7_7I2R9MassTerm_sound : CA2_7_7I2R9MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_7_7I2R9Value a))) := + entropyTerm_zero_ball (CA2_7_7I2R9Mass_sound) +def CA2_7_7I2R9H : Ball := ⟨0, 0⟩ +lemma CA2_7_7I2R9H_sound : CA2_7_7I2R9H.Encloses (homogeneousEntropy CA2_7_7I2R9Value) := by + exact contains_sound (homogeneous_enclosed CA2_7_7I2R9Value CA2_7_7I2R9MassTerm_sound CA2_7_7I2R9Entropy_sound) (by decide +kernel) +def CA2_7_7I2R10Value (a : PairSlot) : ℝ := residualLaw (below (shape 2 7 7)) (fun u => (stageALaw (shape 2 7 7) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 10 a +def CA2_7_7I2R10Raw (a : PairSlot) : Ball := residualBall (below (shape 2 7 7)) A2_7_7Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 10 a +lemma CA2_7_7I2R10Raw_sound (a : PairSlot) : + (CA2_7_7I2R10Raw a).Encloses (CA2_7_7I2R10Value a) := by + exact residualBall_sound_on (below (shape 2 7 7)) A2_7_7Law (fun u => (stageALaw (shape 2 7 7) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A2_7_7Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 2 7 7) (show (shape 2 7 7) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 10 a +def CA2_7_7I2R10Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA2_7_7I2R10Certificates_valid : + CA2_7_7I2R10Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_7_7I2R10CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA2_7_7I2R10P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_7_7I2R10Certificates (CA2_7_7I2R10CertificateIndex a)).input +lemma CA2_7_7I2R10P_check : ∀ a : PairSlot, contains (CA2_7_7I2R10Raw a) (CA2_7_7I2R10P a) = true := by + decide +kernel +lemma CA2_7_7I2R10P_sound (a : PairSlot) : + (CA2_7_7I2R10P a).Encloses (CA2_7_7I2R10Value a) := + contains_sound (CA2_7_7I2R10Raw_sound a) (CA2_7_7I2R10P_check a) +def CA2_7_7I2R10Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_7_7I2R10Certificates (CA2_7_7I2R10CertificateIndex a)).output +lemma CA2_7_7I2R10Terms_sound (a : PairSlot) : + (CA2_7_7I2R10Terms a).Encloses (Foundation.entropyTerm (CA2_7_7I2R10Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_7_7I2R10Certificates_valid + (CA2_7_7I2R10CertificateIndex a) (CA2_7_7I2R10P_sound a) +def CA2_7_7I2R10Entropy : Ball := ⟨0, 0⟩ +lemma CA2_7_7I2R10Entropy_sound : CA2_7_7I2R10Entropy.Encloses (Foundation.finiteEntropy CA2_7_7I2R10Value) := by + exact contains_sound (entropyPair_enclosed CA2_7_7I2R10Value CA2_7_7I2R10Terms CA2_7_7I2R10Terms_sound) (by decide +kernel) +def CA2_7_7I2R10Mass : Ball := ⟨0, 0⟩ +lemma CA2_7_7I2R10Mass_sound : CA2_7_7I2R10Mass.Encloses (∑ a, CA2_7_7I2R10Value a) := by + exact contains_sound (pairSumBall_sound CA2_7_7I2R10P CA2_7_7I2R10Value CA2_7_7I2R10P_sound) (by decide +kernel) +def CA2_7_7I2R10MassTerm : Ball := .exact 0 +lemma CA2_7_7I2R10MassTerm_sound : CA2_7_7I2R10MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_7_7I2R10Value a))) := + entropyTerm_zero_ball (CA2_7_7I2R10Mass_sound) +def CA2_7_7I2R10H : Ball := ⟨0, 0⟩ +lemma CA2_7_7I2R10H_sound : CA2_7_7I2R10H.Encloses (homogeneousEntropy CA2_7_7I2R10Value) := by + exact contains_sound (homogeneous_enclosed CA2_7_7I2R10Value CA2_7_7I2R10MassTerm_sound CA2_7_7I2R10Entropy_sound) (by decide +kernel) +def CA2_7_7I2R11Value (a : PairSlot) : ℝ := residualLaw (below (shape 2 7 7)) (fun u => (stageALaw (shape 2 7 7) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 11 a +def CA2_7_7I2R11Raw (a : PairSlot) : Ball := residualBall (below (shape 2 7 7)) A2_7_7Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 11 a +lemma CA2_7_7I2R11Raw_sound (a : PairSlot) : + (CA2_7_7I2R11Raw a).Encloses (CA2_7_7I2R11Value a) := by + exact residualBall_sound_on (below (shape 2 7 7)) A2_7_7Law (fun u => (stageALaw (shape 2 7 7) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A2_7_7Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 2 7 7) (show (shape 2 7 7) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 11 a +def CA2_7_7I2R11Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA2_7_7I2R11Certificates_valid : + CA2_7_7I2R11Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_7_7I2R11CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA2_7_7I2R11P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_7_7I2R11Certificates (CA2_7_7I2R11CertificateIndex a)).input +lemma CA2_7_7I2R11P_check : ∀ a : PairSlot, contains (CA2_7_7I2R11Raw a) (CA2_7_7I2R11P a) = true := by + decide +kernel +lemma CA2_7_7I2R11P_sound (a : PairSlot) : + (CA2_7_7I2R11P a).Encloses (CA2_7_7I2R11Value a) := + contains_sound (CA2_7_7I2R11Raw_sound a) (CA2_7_7I2R11P_check a) +def CA2_7_7I2R11Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_7_7I2R11Certificates (CA2_7_7I2R11CertificateIndex a)).output +lemma CA2_7_7I2R11Terms_sound (a : PairSlot) : + (CA2_7_7I2R11Terms a).Encloses (Foundation.entropyTerm (CA2_7_7I2R11Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_7_7I2R11Certificates_valid + (CA2_7_7I2R11CertificateIndex a) (CA2_7_7I2R11P_sound a) +def CA2_7_7I2R11Entropy : Ball := ⟨0, 0⟩ +lemma CA2_7_7I2R11Entropy_sound : CA2_7_7I2R11Entropy.Encloses (Foundation.finiteEntropy CA2_7_7I2R11Value) := by + exact contains_sound (entropyPair_enclosed CA2_7_7I2R11Value CA2_7_7I2R11Terms CA2_7_7I2R11Terms_sound) (by decide +kernel) +def CA2_7_7I2R11Mass : Ball := ⟨0, 0⟩ +lemma CA2_7_7I2R11Mass_sound : CA2_7_7I2R11Mass.Encloses (∑ a, CA2_7_7I2R11Value a) := by + exact contains_sound (pairSumBall_sound CA2_7_7I2R11P CA2_7_7I2R11Value CA2_7_7I2R11P_sound) (by decide +kernel) +def CA2_7_7I2R11MassTerm : Ball := .exact 0 +lemma CA2_7_7I2R11MassTerm_sound : CA2_7_7I2R11MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_7_7I2R11Value a))) := + entropyTerm_zero_ball (CA2_7_7I2R11Mass_sound) +def CA2_7_7I2R11H : Ball := ⟨0, 0⟩ +lemma CA2_7_7I2R11H_sound : CA2_7_7I2R11H.Encloses (homogeneousEntropy CA2_7_7I2R11Value) := by + exact contains_sound (homogeneous_enclosed CA2_7_7I2R11Value CA2_7_7I2R11MassTerm_sound CA2_7_7I2R11Entropy_sound) (by decide +kernel) +def CA2_7_7I2R12Value (a : PairSlot) : ℝ := residualLaw (below (shape 2 7 7)) (fun u => (stageALaw (shape 2 7 7) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 12 a +def CA2_7_7I2R12Raw (a : PairSlot) : Ball := residualBall (below (shape 2 7 7)) A2_7_7Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 12 a +lemma CA2_7_7I2R12Raw_sound (a : PairSlot) : + (CA2_7_7I2R12Raw a).Encloses (CA2_7_7I2R12Value a) := by + exact residualBall_sound_on (below (shape 2 7 7)) A2_7_7Law (fun u => (stageALaw (shape 2 7 7) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A2_7_7Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 2 7 7) (show (shape 2 7 7) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 12 a +def CA2_7_7I2R12Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA2_7_7I2R12Certificates_valid : + CA2_7_7I2R12Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_7_7I2R12CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA2_7_7I2R12P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_7_7I2R12Certificates (CA2_7_7I2R12CertificateIndex a)).input +lemma CA2_7_7I2R12P_check : ∀ a : PairSlot, contains (CA2_7_7I2R12Raw a) (CA2_7_7I2R12P a) = true := by + decide +kernel +lemma CA2_7_7I2R12P_sound (a : PairSlot) : + (CA2_7_7I2R12P a).Encloses (CA2_7_7I2R12Value a) := + contains_sound (CA2_7_7I2R12Raw_sound a) (CA2_7_7I2R12P_check a) +def CA2_7_7I2R12Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_7_7I2R12Certificates (CA2_7_7I2R12CertificateIndex a)).output +lemma CA2_7_7I2R12Terms_sound (a : PairSlot) : + (CA2_7_7I2R12Terms a).Encloses (Foundation.entropyTerm (CA2_7_7I2R12Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_7_7I2R12Certificates_valid + (CA2_7_7I2R12CertificateIndex a) (CA2_7_7I2R12P_sound a) +def CA2_7_7I2R12Entropy : Ball := ⟨0, 0⟩ +lemma CA2_7_7I2R12Entropy_sound : CA2_7_7I2R12Entropy.Encloses (Foundation.finiteEntropy CA2_7_7I2R12Value) := by + exact contains_sound (entropyPair_enclosed CA2_7_7I2R12Value CA2_7_7I2R12Terms CA2_7_7I2R12Terms_sound) (by decide +kernel) +def CA2_7_7I2R12Mass : Ball := ⟨0, 0⟩ +lemma CA2_7_7I2R12Mass_sound : CA2_7_7I2R12Mass.Encloses (∑ a, CA2_7_7I2R12Value a) := by + exact contains_sound (pairSumBall_sound CA2_7_7I2R12P CA2_7_7I2R12Value CA2_7_7I2R12P_sound) (by decide +kernel) +def CA2_7_7I2R12MassTerm : Ball := .exact 0 +lemma CA2_7_7I2R12MassTerm_sound : CA2_7_7I2R12MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_7_7I2R12Value a))) := + entropyTerm_zero_ball (CA2_7_7I2R12Mass_sound) +def CA2_7_7I2R12H : Ball := ⟨0, 0⟩ +lemma CA2_7_7I2R12H_sound : CA2_7_7I2R12H.Encloses (homogeneousEntropy CA2_7_7I2R12Value) := by + exact contains_sound (homogeneous_enclosed CA2_7_7I2R12Value CA2_7_7I2R12MassTerm_sound CA2_7_7I2R12Entropy_sound) (by decide +kernel) +def CA2_7_7I2R13Value (a : PairSlot) : ℝ := residualLaw (below (shape 2 7 7)) (fun u => (stageALaw (shape 2 7 7) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 13 a +def CA2_7_7I2R13Raw (a : PairSlot) : Ball := residualBall (below (shape 2 7 7)) A2_7_7Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 13 a +lemma CA2_7_7I2R13Raw_sound (a : PairSlot) : + (CA2_7_7I2R13Raw a).Encloses (CA2_7_7I2R13Value a) := by + exact residualBall_sound_on (below (shape 2 7 7)) A2_7_7Law (fun u => (stageALaw (shape 2 7 7) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A2_7_7Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 2 7 7) (show (shape 2 7 7) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 13 a +def CA2_7_7I2R13Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA2_7_7I2R13Certificates_valid : + CA2_7_7I2R13Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_7_7I2R13CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA2_7_7I2R13P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_7_7I2R13Certificates (CA2_7_7I2R13CertificateIndex a)).input +lemma CA2_7_7I2R13P_check : ∀ a : PairSlot, contains (CA2_7_7I2R13Raw a) (CA2_7_7I2R13P a) = true := by + decide +kernel +lemma CA2_7_7I2R13P_sound (a : PairSlot) : + (CA2_7_7I2R13P a).Encloses (CA2_7_7I2R13Value a) := + contains_sound (CA2_7_7I2R13Raw_sound a) (CA2_7_7I2R13P_check a) +def CA2_7_7I2R13Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_7_7I2R13Certificates (CA2_7_7I2R13CertificateIndex a)).output +lemma CA2_7_7I2R13Terms_sound (a : PairSlot) : + (CA2_7_7I2R13Terms a).Encloses (Foundation.entropyTerm (CA2_7_7I2R13Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_7_7I2R13Certificates_valid + (CA2_7_7I2R13CertificateIndex a) (CA2_7_7I2R13P_sound a) +def CA2_7_7I2R13Entropy : Ball := ⟨0, 0⟩ +lemma CA2_7_7I2R13Entropy_sound : CA2_7_7I2R13Entropy.Encloses (Foundation.finiteEntropy CA2_7_7I2R13Value) := by + exact contains_sound (entropyPair_enclosed CA2_7_7I2R13Value CA2_7_7I2R13Terms CA2_7_7I2R13Terms_sound) (by decide +kernel) +def CA2_7_7I2R13Mass : Ball := ⟨0, 0⟩ +lemma CA2_7_7I2R13Mass_sound : CA2_7_7I2R13Mass.Encloses (∑ a, CA2_7_7I2R13Value a) := by + exact contains_sound (pairSumBall_sound CA2_7_7I2R13P CA2_7_7I2R13Value CA2_7_7I2R13P_sound) (by decide +kernel) +def CA2_7_7I2R13MassTerm : Ball := .exact 0 +lemma CA2_7_7I2R13MassTerm_sound : CA2_7_7I2R13MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_7_7I2R13Value a))) := + entropyTerm_zero_ball (CA2_7_7I2R13Mass_sound) +def CA2_7_7I2R13H : Ball := ⟨0, 0⟩ +lemma CA2_7_7I2R13H_sound : CA2_7_7I2R13H.Encloses (homogeneousEntropy CA2_7_7I2R13Value) := by + exact contains_sound (homogeneous_enclosed CA2_7_7I2R13Value CA2_7_7I2R13MassTerm_sound CA2_7_7I2R13Entropy_sound) (by decide +kernel) +def CA2_7_7I2R14Value (a : PairSlot) : ℝ := residualLaw (below (shape 2 7 7)) (fun u => (stageALaw (shape 2 7 7) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 14 a +def CA2_7_7I2R14Raw (a : PairSlot) : Ball := residualBall (below (shape 2 7 7)) A2_7_7Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 14 a +lemma CA2_7_7I2R14Raw_sound (a : PairSlot) : + (CA2_7_7I2R14Raw a).Encloses (CA2_7_7I2R14Value a) := by + exact residualBall_sound_on (below (shape 2 7 7)) A2_7_7Law (fun u => (stageALaw (shape 2 7 7) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A2_7_7Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 2 7 7) (show (shape 2 7 7) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 14 a +def CA2_7_7I2R14Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA2_7_7I2R14Certificates_valid : + CA2_7_7I2R14Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_7_7I2R14CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA2_7_7I2R14P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_7_7I2R14Certificates (CA2_7_7I2R14CertificateIndex a)).input +lemma CA2_7_7I2R14P_check : ∀ a : PairSlot, contains (CA2_7_7I2R14Raw a) (CA2_7_7I2R14P a) = true := by + decide +kernel +lemma CA2_7_7I2R14P_sound (a : PairSlot) : + (CA2_7_7I2R14P a).Encloses (CA2_7_7I2R14Value a) := + contains_sound (CA2_7_7I2R14Raw_sound a) (CA2_7_7I2R14P_check a) +def CA2_7_7I2R14Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_7_7I2R14Certificates (CA2_7_7I2R14CertificateIndex a)).output +lemma CA2_7_7I2R14Terms_sound (a : PairSlot) : + (CA2_7_7I2R14Terms a).Encloses (Foundation.entropyTerm (CA2_7_7I2R14Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_7_7I2R14Certificates_valid + (CA2_7_7I2R14CertificateIndex a) (CA2_7_7I2R14P_sound a) +def CA2_7_7I2R14Entropy : Ball := ⟨0, 0⟩ +lemma CA2_7_7I2R14Entropy_sound : CA2_7_7I2R14Entropy.Encloses (Foundation.finiteEntropy CA2_7_7I2R14Value) := by + exact contains_sound (entropyPair_enclosed CA2_7_7I2R14Value CA2_7_7I2R14Terms CA2_7_7I2R14Terms_sound) (by decide +kernel) +def CA2_7_7I2R14Mass : Ball := ⟨0, 0⟩ +lemma CA2_7_7I2R14Mass_sound : CA2_7_7I2R14Mass.Encloses (∑ a, CA2_7_7I2R14Value a) := by + exact contains_sound (pairSumBall_sound CA2_7_7I2R14P CA2_7_7I2R14Value CA2_7_7I2R14P_sound) (by decide +kernel) +def CA2_7_7I2R14MassTerm : Ball := .exact 0 +lemma CA2_7_7I2R14MassTerm_sound : CA2_7_7I2R14MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_7_7I2R14Value a))) := + entropyTerm_zero_ball (CA2_7_7I2R14Mass_sound) +def CA2_7_7I2R14H : Ball := ⟨0, 0⟩ +lemma CA2_7_7I2R14H_sound : CA2_7_7I2R14H.Encloses (homogeneousEntropy CA2_7_7I2R14Value) := by + exact contains_sound (homogeneous_enclosed CA2_7_7I2R14Value CA2_7_7I2R14MassTerm_sound CA2_7_7I2R14Entropy_sound) (by decide +kernel) +def CA2_7_7I2R15Value (a : PairSlot) : ℝ := residualLaw (below (shape 2 7 7)) (fun u => (stageALaw (shape 2 7 7) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 15 a +def CA2_7_7I2R15Raw (a : PairSlot) : Ball := residualBall (below (shape 2 7 7)) A2_7_7Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 15 a +lemma CA2_7_7I2R15Raw_sound (a : PairSlot) : + (CA2_7_7I2R15Raw a).Encloses (CA2_7_7I2R15Value a) := by + exact residualBall_sound_on (below (shape 2 7 7)) A2_7_7Law (fun u => (stageALaw (shape 2 7 7) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A2_7_7Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 2 7 7) (show (shape 2 7 7) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 15 a +def CA2_7_7I2R15Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA2_7_7I2R15Certificates_valid : + CA2_7_7I2R15Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_7_7I2R15CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA2_7_7I2R15P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_7_7I2R15Certificates (CA2_7_7I2R15CertificateIndex a)).input +lemma CA2_7_7I2R15P_check : ∀ a : PairSlot, contains (CA2_7_7I2R15Raw a) (CA2_7_7I2R15P a) = true := by + decide +kernel +lemma CA2_7_7I2R15P_sound (a : PairSlot) : + (CA2_7_7I2R15P a).Encloses (CA2_7_7I2R15Value a) := + contains_sound (CA2_7_7I2R15Raw_sound a) (CA2_7_7I2R15P_check a) +def CA2_7_7I2R15Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_7_7I2R15Certificates (CA2_7_7I2R15CertificateIndex a)).output +lemma CA2_7_7I2R15Terms_sound (a : PairSlot) : + (CA2_7_7I2R15Terms a).Encloses (Foundation.entropyTerm (CA2_7_7I2R15Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_7_7I2R15Certificates_valid + (CA2_7_7I2R15CertificateIndex a) (CA2_7_7I2R15P_sound a) +def CA2_7_7I2R15Entropy : Ball := ⟨0, 0⟩ +lemma CA2_7_7I2R15Entropy_sound : CA2_7_7I2R15Entropy.Encloses (Foundation.finiteEntropy CA2_7_7I2R15Value) := by + exact contains_sound (entropyPair_enclosed CA2_7_7I2R15Value CA2_7_7I2R15Terms CA2_7_7I2R15Terms_sound) (by decide +kernel) +def CA2_7_7I2R15Mass : Ball := ⟨0, 0⟩ +lemma CA2_7_7I2R15Mass_sound : CA2_7_7I2R15Mass.Encloses (∑ a, CA2_7_7I2R15Value a) := by + exact contains_sound (pairSumBall_sound CA2_7_7I2R15P CA2_7_7I2R15Value CA2_7_7I2R15P_sound) (by decide +kernel) +def CA2_7_7I2R15MassTerm : Ball := .exact 0 +lemma CA2_7_7I2R15MassTerm_sound : CA2_7_7I2R15MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_7_7I2R15Value a))) := + entropyTerm_zero_ball (CA2_7_7I2R15Mass_sound) +def CA2_7_7I2R15H : Ball := ⟨0, 0⟩ +lemma CA2_7_7I2R15H_sound : CA2_7_7I2R15H.Encloses (homogeneousEntropy CA2_7_7I2R15Value) := by + exact contains_sound (homogeneous_enclosed CA2_7_7I2R15Value CA2_7_7I2R15MassTerm_sound CA2_7_7I2R15Entropy_sound) (by decide +kernel) +def CA2_7_7I2R16Value (a : PairSlot) : ℝ := residualLaw (below (shape 2 7 7)) (fun u => (stageALaw (shape 2 7 7) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 16 a +def CA2_7_7I2R16Raw (a : PairSlot) : Ball := residualBall (below (shape 2 7 7)) A2_7_7Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 16 a +lemma CA2_7_7I2R16Raw_sound (a : PairSlot) : + (CA2_7_7I2R16Raw a).Encloses (CA2_7_7I2R16Value a) := by + exact residualBall_sound_on (below (shape 2 7 7)) A2_7_7Law (fun u => (stageALaw (shape 2 7 7) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A2_7_7Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 2 7 7) (show (shape 2 7 7) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 16 a +def CA2_7_7I2R16Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA2_7_7I2R16Certificates_valid : + CA2_7_7I2R16Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_7_7I2R16CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA2_7_7I2R16P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_7_7I2R16Certificates (CA2_7_7I2R16CertificateIndex a)).input +lemma CA2_7_7I2R16P_check : ∀ a : PairSlot, contains (CA2_7_7I2R16Raw a) (CA2_7_7I2R16P a) = true := by + decide +kernel +lemma CA2_7_7I2R16P_sound (a : PairSlot) : + (CA2_7_7I2R16P a).Encloses (CA2_7_7I2R16Value a) := + contains_sound (CA2_7_7I2R16Raw_sound a) (CA2_7_7I2R16P_check a) +def CA2_7_7I2R16Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_7_7I2R16Certificates (CA2_7_7I2R16CertificateIndex a)).output +lemma CA2_7_7I2R16Terms_sound (a : PairSlot) : + (CA2_7_7I2R16Terms a).Encloses (Foundation.entropyTerm (CA2_7_7I2R16Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_7_7I2R16Certificates_valid + (CA2_7_7I2R16CertificateIndex a) (CA2_7_7I2R16P_sound a) +def CA2_7_7I2R16Entropy : Ball := ⟨0, 0⟩ +lemma CA2_7_7I2R16Entropy_sound : CA2_7_7I2R16Entropy.Encloses (Foundation.finiteEntropy CA2_7_7I2R16Value) := by + exact contains_sound (entropyPair_enclosed CA2_7_7I2R16Value CA2_7_7I2R16Terms CA2_7_7I2R16Terms_sound) (by decide +kernel) +def CA2_7_7I2R16Mass : Ball := ⟨0, 0⟩ +lemma CA2_7_7I2R16Mass_sound : CA2_7_7I2R16Mass.Encloses (∑ a, CA2_7_7I2R16Value a) := by + exact contains_sound (pairSumBall_sound CA2_7_7I2R16P CA2_7_7I2R16Value CA2_7_7I2R16P_sound) (by decide +kernel) +def CA2_7_7I2R16MassTerm : Ball := .exact 0 +lemma CA2_7_7I2R16MassTerm_sound : CA2_7_7I2R16MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_7_7I2R16Value a))) := + entropyTerm_zero_ball (CA2_7_7I2R16Mass_sound) +def CA2_7_7I2R16H : Ball := ⟨0, 0⟩ +lemma CA2_7_7I2R16H_sound : CA2_7_7I2R16H.Encloses (homogeneousEntropy CA2_7_7I2R16Value) := by + exact contains_sound (homogeneous_enclosed CA2_7_7I2R16Value CA2_7_7I2R16MassTerm_sound CA2_7_7I2R16Entropy_sound) (by decide +kernel) +def CA2_7_7I2ResidualEntropies (a : Fin 17) : Ball := + match a.val with + | 0 => CA2_7_7I2R0H + | 1 => CA2_7_7I2R1H + | 2 => CA2_7_7I2R2H + | 3 => CA2_7_7I2R3H + | 4 => CA2_7_7I2R4H + | 5 => CA2_7_7I2R5H + | 6 => CA2_7_7I2R6H + | 7 => CA2_7_7I2R7H + | 8 => CA2_7_7I2R8H + | 9 => CA2_7_7I2R9H + | 10 => CA2_7_7I2R10H + | 11 => CA2_7_7I2R11H + | 12 => CA2_7_7I2R12H + | 13 => CA2_7_7I2R13H + | 14 => CA2_7_7I2R14H + | 15 => CA2_7_7I2R15H + | 16 => CA2_7_7I2R16H + | _ => (.exact 0) +lemma CA2_7_7I2ResidualEntropies_sound (k : Fin 17) : + (CA2_7_7I2ResidualEntropies k).Encloses (homogeneousEntropy + (residualLaw (below (shape 2 7 7)) (fun u => (stageALaw (shape 2 7 7) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) k)) := by + fin_cases k + · exact CA2_7_7I2R0H_sound + · exact CA2_7_7I2R1H_sound + · exact CA2_7_7I2R2H_sound + · exact CA2_7_7I2R3H_sound + · exact CA2_7_7I2R4H_sound + · exact CA2_7_7I2R5H_sound + · exact CA2_7_7I2R6H_sound + · exact CA2_7_7I2R7H_sound + · exact CA2_7_7I2R8H_sound + · exact CA2_7_7I2R9H_sound + · exact CA2_7_7I2R10H_sound + · exact CA2_7_7I2R11H_sound + · exact CA2_7_7I2R12H_sound + · exact CA2_7_7I2R13H_sound + · exact CA2_7_7I2R14H_sound + · exact CA2_7_7I2R15H_sound + · exact CA2_7_7I2R16H_sound +def CA2_7_7I2Singles (s : Shape) : Ball := + match s 0, s 1, s 2 with + | 0, 1, 7 => Z0_1_7H2H + | 0, 2, 6 => Z0_2_6H2H + | 0, 3, 5 => Z0_3_5H2H + | 0, 4, 4 => Z0_4_4H2H + | 0, 5, 3 => Z0_5_3H2H + | 0, 6, 2 => Z0_6_2H2H + | 0, 7, 1 => Z0_7_1H2H + | 1, 0, 7 => Z1_0_7H2H + | 2, 0, 6 => Z2_0_6H2H + | _, _, _ => (.exact 0) +lemma CA2_7_7I2Singles_sound (u : Shape) (hu : u ∈ below (shape 2 7 7)) + (hd : designated (Equiv.refl (Fin 3)) 2 u) : + (CA2_7_7I2Singles u).Encloses (homogeneousEntropy ((fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) u)) := by + rw [A2_7_7_below] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl + · exact Z0_1_7H2H_sound + · exact Z0_2_6H2H_sound + · exact Z0_3_5H2H_sound + · exact Z0_4_4H2H_sound + · exact Z0_5_3H2H_sound + · exact Z0_6_2H2H_sound + · exact Z0_7_1H2H_sound + · exact Z1_0_7H2H_sound + · exact (show ¬ designated (Equiv.refl (Fin 3)) 2 (shape 1 1 6) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 2 (shape 1 2 5) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 2 (shape 1 3 4) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 2 (shape 1 4 3) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 2 (shape 1 5 2) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 2 (shape 1 6 1) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 2 (shape 1 7 0) by decide +kernel) hd |>.elim + · exact Z2_0_6H2H_sound + · exact (show ¬ designated (Equiv.refl (Fin 3)) 2 (shape 2 1 5) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 2 (shape 2 2 4) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 2 (shape 2 3 3) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 2 (shape 2 4 2) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 2 (shape 2 5 1) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 2 (shape 2 6 0) by decide +kernel) hd |>.elim +def CA2_7_7I2Singleton : Ball := ⟨(3735549344201020389155168425783 / 12500000000000000000000000000000), (3138425543 / 12500000000000000000000000000000)⟩ +lemma CA2_7_7I2Singleton_sound : CA2_7_7I2Singleton.Encloses + (singletonEntropy (below (shape 2 7 7)) (fun u => (stageALaw (shape 2 7 7) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ))) := by + exact contains_sound (singletonBall_sound (below (shape 2 7 7)) A2_7_7Law (fun u => (stageALaw (shape 2 7 7) u : ℝ)) (Equiv.refl (Fin 3)) 2 + CA2_7_7I2Singles (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A2_7_7Law_sound u) CA2_7_7I2Singles_sound) (by decide +kernel) +def CA2_7_7I2Group : Ball := ⟨(823532456101625366543148449591 / 800000000000000000000000000000), (193698787 / 125000000000000000000000000000)⟩ +lemma CA2_7_7I2Group_sound : CA2_7_7I2Group.Encloses + (groupedEntropy (below (shape 2 7 7)) (fun u => (stageALaw (shape 2 7 7) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ))) := by + exact contains_sound (Ball.add_sound CA2_7_7I2Singleton_sound + (finSumBall_sound 17 CA2_7_7I2ResidualEntropies _ CA2_7_7I2ResidualEntropies_sound)) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CA2_7_7I2H : Ball := ⟨(53956368040931955078041468163973 / 50000000000000000000000000000000), (473949701211 / 100000000000000000000000000000000)⟩ +lemma CA2_7_7I2_sound : CA2_7_7I2H.Encloses (stageACapacity (shape 2 7 7) 2) := by + have hb := contains_sound (Ball.add_sound CA2_7_7I2PairH_sound + (Ball.neg_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) CA2_7_7I2Group_sound))) + (show contains (.add CA2_7_7I2PairH (.neg (.mul (.exact 2) CA2_7_7I2Group))) CA2_7_7I2H = true by decide +kernel) + simp only [stageACapacity, nativeCapacity, + show (2 : Fin 3) ≠ 0 by decide, ite_false] + change CA2_7_7I2H.Encloses (homogeneousEntropy CA2_7_7I2PairValue - _) + simpa only [sub_eq_add_neg] using hb + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA2_7_7I2Pair.lean b/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA2_7_7I2Pair.lean new file mode 100644 index 0000000000000000000000000000000000000000..d4954785bf253bd1fdec116959dd2c5fa77b6b91 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA2_7_7I2Pair.lean @@ -0,0 +1,355 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Certificates.SupportedContraction + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CA2_7_7I2PairValue (a : PairSlot × PairSlot) : ℝ := pairLaw (below (shape 2 7 7)) (shape 2 7 7) (fun u => (stageALaw (shape 2 7 7) u : ℝ)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) a +def CA2_7_7I2PairRaw (a : PairSlot × PairSlot) : Ball := stageAPairBall (shape 2 7 7) A2_7_7Law 2 a +lemma CA2_7_7I2PairRaw_sound (a : PairSlot × PairSlot) : + (CA2_7_7I2PairRaw a).Encloses (CA2_7_7I2PairValue a) := by + exact stageAPairBall_sound (shape 2 7 7) (by decide +kernel) A2_7_7Law (fun u => (stageALaw (shape 2 7 7) u : ℝ)) (fun u _ => A2_7_7Law_sound u) 2 a +def CA2_7_7I2PairCertificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(2510546439707344160427183 / 1000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ ⟨(404669021942788608521233297 / 12500000000000000000000000000000), (531643 / 50000000000000000000000000000000)⟩ ⟨(-257900202469044059552848126642091 / 20000000000000000000000000000000), (423517270299 / 100000000000000000000000000000000)⟩ ⟨-19, 2510546439707344160427183, 1907348632812500000000000⟩, + .log ⟨(10279606875747867880166399993 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(2359879956789315970362160483 / 2500000000000000000000000000000), (16325941 / 50000000000000000000000000000000)⟩ ⟨(-229569086183330199047762295029943 / 25000000000000000000000000000000), (79409341243 / 25000000000000000000000000000000)⟩ ⟨-14, 10279606875747867880166399993, 6103515625000000000000000000⟩, + .log ⟨(413133645954877779036924943 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(9670436083914656946965860893 / 100000000000000000000000000000000), (1574727 / 50000000000000000000000000000000)⟩ ⟨(-1170376242482421348881176270376353 / 100000000000000000000000000000000), (9529123683 / 2500000000000000000000000000000)⟩ ⟨-17, 413133645954877779036924943, 381469726562500000000000000⟩, + .log ⟨(39054149397430234536298181523 / 100000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ ⟨(306496040283979827517635607713 / 100000000000000000000000000000000), (10751051 / 10000000000000000000000000000000)⟩ ⟨(-392398816787630875997521829431211 / 50000000000000000000000000000000), (275285713 / 100000000000000000000000000000)⟩ ⟨-12, 39054149397430234536298181523, 24414062500000000000000000000⟩, + .log ⟨(3627898167391188269152883063 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(156268704022978936805675281313 / 100000000000000000000000000000000), (53776623 / 100000000000000000000000000000000)⟩ ⟨(-430741704460109854631716223806157 / 50000000000000000000000000000000), (148230768537 / 50000000000000000000000000000000)⟩ ⟨-13, 3627898167391188269152883063, 2441406250000000000000000000⟩, + .log ⟨(73100288137862312756041453 / 4000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(9969026767676248182761336421 / 50000000000000000000000000000000), (3289419 / 50000000000000000000000000000000)⟩ ⟨(-1090997261064177747716622022241701 / 100000000000000000000000000000000), (35998905733 / 10000000000000000000000000000000)⟩ ⟨-16, 73100288137862312756041453, 61035156250000000000000000⟩, + .log ⟨(2732394101491916499309783479 / 4000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(248950867125705767804370156399 / 50000000000000000000000000000000), (10848881 / 6250000000000000000000000000000)⟩ ⟨(-728887145495668938801749730253793 / 100000000000000000000000000000000), (254109885659 / 100000000000000000000000000000000)⟩ ⟨-11, 2732394101491916499309783479, 1953125000000000000000000000⟩, + .log ⟨(104564813920118608650785542387 / 25000000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ ⟨(2290732327979309104197444633489 / 100000000000000000000000000000000), (797128609 / 100000000000000000000000000000000)⟩ ⟨(-273841199790363322890437070001091 / 50000000000000000000000000000000), (95291207051 / 50000000000000000000000000000000)⟩ ⟨-8, 104564813920118608650785542387, 97656250000000000000000000000⟩, + .log ⟨(8826936252630041141800145737 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(85242601322980810465949812231 / 25000000000000000000000000000000), (121496479 / 100000000000000000000000000000000)⟩ ⟨(-386283978419271994059894509715879 / 50000000000000000000000000000000), (4301339221 / 1562500000000000000000000000000)⟩ ⟨-12, 8826936252630041141800145737, 4882812500000000000000000000⟩, + .log ⟨(198041892188618963952433670161 / 12500000000000000000000000000000), (3 / 25000000000000000000000000000000)⟩ ⟨(1313415520515037926372565941971 / 20000000000000000000000000000000), (2348472169 / 100000000000000000000000000000000)⟩ ⟨(-51812566728310700767165823742157 / 12500000000000000000000000000000), (148230766537 / 100000000000000000000000000000000)⟩ ⟨-6, 198041892188618963952433670161, 195312500000000000000000000000⟩, + .log ⟨(33619662931342453423765132823 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(67220955766848086762710177173 / 25000000000000000000000000000000), (92550137 / 100000000000000000000000000000000)⟩ ⟨(-799781436287754160944997310677471 / 100000000000000000000000000000000), (275285710853 / 100000000000000000000000000000000)⟩ ⟨-12, 33619662931342453423765132823, 24414062500000000000000000000⟩, + .log ⟨(3457426653049363403427188823 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(35516072643476816117784595007 / 100000000000000000000000000000000), (11714229 / 100000000000000000000000000000000)⟩ ⟨(-51362004472535278173930401360349 / 5000000000000000000000000000000), (6776264157 / 2000000000000000000000000000000)⟩ ⟨-15, 3457426653049363403427188823, 3051757812500000000000000000⟩, + .log ⟨(126935265661219752233819186681 / 100000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ ⟨(211640698884838777328774533661 / 25000000000000000000000000000000), (59135097 / 20000000000000000000000000000000)⟩ ⟨(-666924822766562506197309152720411 / 100000000000000000000000000000000), (29116757761 / 12500000000000000000000000000000)⟩ ⟨-10, 126935265661219752233819186681, 97656250000000000000000000000⟩, + .log ⟨(479051223817977888502272441 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(234713508126640067953716619 / 4000000000000000000000000000000), (240929 / 12500000000000000000000000000000)⟩ ⟨(-1224887321318182763806950743492327 / 100000000000000000000000000000000), (201170429361 / 50000000000000000000000000000000)⟩ ⟨-18, 479051223817977888502272441, 381469726562500000000000000⟩, + .log ⟨(16648242804264711264407264299 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(9053127967685718998199971591 / 6250000000000000000000000000000), (24677823 / 50000000000000000000000000000000)⟩ ⟨(-174012415827892501032965282680727 / 20000000000000000000000000000000), (9264423049 / 3125000000000000000000000000000)⟩ ⟨-13, 16648242804264711264407264299, 12207031250000000000000000000⟩, + .log ⟨(851924419693228798178526043 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(1988933918780254767847451827 / 20000000000000000000000000000000), (3247249 / 100000000000000000000000000000000)⟩ ⟨(-583659146516909927048400808266211 / 50000000000000000000000000000000), (190582471837 / 50000000000000000000000000000000)⟩ ⟨-17, 851924419693228798178526043, 762939453125000000000000000⟩, + .log ⟨(1126931161629491582317713843 / 2000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(210775691169632112352784965079 / 50000000000000000000000000000000), (143182183 / 100000000000000000000000000000000)⟩ ⟨(-149628086148481317195069794093373 / 20000000000000000000000000000000), (25410988597 / 10000000000000000000000000000000)⟩ ⟨-11, 1126931161629491582317713843, 976562500000000000000000000⟩, + .log ⟨(1866414731679781571103202896629 / 100000000000000000000000000000000), (1 / 10000000000000000000000000000000)⟩ ⟨(7430478597710337881116419585399 / 100000000000000000000000000000000), (27666009 / 1000000000000000000000000000000)⟩ ⟨(-199057542559763071777106843870873 / 50000000000000000000000000000000), (37057691579 / 25000000000000000000000000000000)⟩ ⟨-6, 1866414731679781571103202896629, 1562500000000000000000000000000⟩, + .log ⟨(129014570956225733162903656547 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(858333955258562297951304177679 / 100000000000000000000000000000000), (300518887 / 100000000000000000000000000000000)⟩ ⟨(-332650005691912311285246965330339 / 50000000000000000000000000000000), (232934061287 / 100000000000000000000000000000000)⟩ ⟨-10, 129014570956225733162903656547, 97656250000000000000000000000⟩, + .log ⟨(440865350595655735324011060487 / 100000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ ⟨(95653425861414810952534956629 / 4000000000000000000000000000000), (210052961 / 25000000000000000000000000000000)⟩ ⟨(-542418596359279039537884042309559 / 100000000000000000000000000000000), (190582413827 / 100000000000000000000000000000000)⟩ ⟨-8, 440865350595655735324011060487, 390625000000000000000000000000⟩, + .log ⟨(3559767696973306860165703960319 / 25000000000000000000000000000000), (3 / 6250000000000000000000000000000)⟩ ⟨(27754519627533878731257084757797 / 100000000000000000000000000000000), (12060962239 / 100000000000000000000000000000000)⟩ ⟨(-194918053579255776684420820809537 / 100000000000000000000000000000000), (21175823767 / 25000000000000000000000000000000)⟩ ⟨-3, 3559767696973306860165703960319, 3125000000000000000000000000000⟩, + .log ⟨(1124235505518225308019853175019 / 100000000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ ⟨(5045644196075710458162538337703 / 100000000000000000000000000000000), (38090581 / 2000000000000000000000000000000)⟩ ⟨(-448806693198137394702080094459183 / 100000000000000000000000000000000), (169406589819 / 100000000000000000000000000000000)⟩ ⟨-7, 1124235505518225308019853175019, 781250000000000000000000000000⟩, + .log ⟨(14393202684625673751560562771 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(46939240551031084872834818473 / 20000000000000000000000000000000), (7924487 / 10000000000000000000000000000000)⟩ ⟨(-101912777813277214338274570764083 / 12500000000000000000000000000000), (34410713919 / 12500000000000000000000000000000)⟩ ⟨-12, 14393202684625673751560562771, 12207031250000000000000000000⟩, + .log ⟨(240132015369370150431856457053 / 25000000000000000000000000000000), (1 / 20000000000000000000000000000000)⟩ ⟨(2231038828049270995568436575659 / 50000000000000000000000000000000), (1627197859 / 100000000000000000000000000000000)⟩ ⟨(-116136056692476822440950588949493 / 25000000000000000000000000000000), (5293955937 / 3125000000000000000000000000000)⟩ ⟨-7, 240132015369370150431856457053, 195312500000000000000000000000⟩, + .log ⟨(13462509585777460947738576583 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(122905624473504815033499749033 / 25000000000000000000000000000000), (171047847 / 100000000000000000000000000000000)⟩ ⟨(-365178939900920429809331991957607 / 50000000000000000000000000000000), (254109885681 / 100000000000000000000000000000000)⟩ ⟨-11, 13462509585777460947738576583, 9765625000000000000000000000⟩, + .log ⟨(1766433671393188504536687477 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(4832946108533981429512820057 / 25000000000000000000000000000000), (317949 / 5000000000000000000000000000000)⟩ ⟨(-136799535323684999412812678830447 / 12500000000000000000000000000000), (179994529611 / 50000000000000000000000000000000)⟩ ⟨-16, 1766433671393188504536687477, 1525878906250000000000000000⟩, + .log ⟨(58431525586424736077041896729 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(435026792302099326231780528773 / 100000000000000000000000000000000), (148480291 / 100000000000000000000000000000000)⟩ ⟨(-74450698991020031665399692795473 / 10000000000000000000000000000000), (254109885907 / 100000000000000000000000000000000)⟩ ⟨-11, 58431525586424736077041896729, 48828125000000000000000000000⟩, + .log ⟨(2892951632295976034245171887 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(944788113975300795372861957 / 3125000000000000000000000000000), (130179 / 1250000000000000000000000000000)⟩ ⟨(-522532407899526265823823776984473 / 50000000000000000000000000000000), (359989037177 / 100000000000000000000000000000000)⟩ ⟨-16, 2892951632295976034245171887, 1525878906250000000000000000⟩] +lemma CA2_7_7I2PairCertificates_valid : + CA2_7_7I2PairCertificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA2_7_7I2PairCertificateIndex (a : PairSlot × PairSlot) : ℕ := + match a.1.1.val, a.1.2.val, a.2.1.val, a.2.2.val with + | 4, 5, 0, 0 => 1 + | 5, 4, 0, 0 => 1 + | 2, 5, 1, 0 => 2 + | 2, 5, 0, 1 => 2 + | 3, 5, 1, 0 => 3 + | 3, 5, 0, 1 => 3 + | 4, 4, 1, 0 => 4 + | 4, 4, 0, 1 => 4 + | 5, 2, 1, 0 => 2 + | 5, 2, 0, 1 => 2 + | 5, 3, 1, 0 => 3 + | 5, 3, 0, 1 => 3 + | 1, 5, 2, 0 => 5 + | 1, 5, 3, 0 => 6 + | 1, 5, 1, 1 => 7 + | 1, 5, 0, 2 => 5 + | 1, 5, 0, 3 => 6 + | 2, 4, 2, 0 => 8 + | 2, 4, 3, 0 => 9 + | 2, 4, 1, 1 => 10 + | 2, 4, 0, 2 => 8 + | 2, 4, 0, 3 => 9 + | 3, 4, 2, 0 => 11 + | 3, 4, 3, 0 => 12 + | 3, 4, 1, 1 => 13 + | 3, 4, 0, 2 => 11 + | 3, 4, 0, 3 => 12 + | 4, 2, 2, 0 => 8 + | 4, 2, 3, 0 => 9 + | 4, 2, 1, 1 => 10 + | 4, 2, 0, 2 => 8 + | 4, 2, 0, 3 => 9 + | 4, 3, 2, 0 => 11 + | 4, 3, 3, 0 => 12 + | 4, 3, 1, 1 => 13 + | 4, 3, 0, 2 => 11 + | 4, 3, 0, 3 => 12 + | 5, 1, 2, 0 => 5 + | 5, 1, 3, 0 => 6 + | 5, 1, 1, 1 => 7 + | 5, 1, 0, 2 => 5 + | 5, 1, 0, 3 => 6 + | 5, 0, 4, 0 => 14 + | 5, 0, 2, 1 => 15 + | 5, 0, 3, 1 => 16 + | 5, 0, 1, 2 => 15 + | 5, 0, 1, 3 => 16 + | 5, 0, 0, 4 => 14 + | 4, 1, 4, 0 => 17 + | 4, 1, 2, 1 => 18 + | 4, 1, 3, 1 => 19 + | 4, 1, 1, 2 => 18 + | 4, 1, 1, 3 => 19 + | 4, 1, 0, 4 => 17 + | 2, 2, 4, 0 => 20 + | 2, 2, 2, 1 => 21 + | 2, 2, 3, 1 => 22 + | 2, 2, 1, 2 => 21 + | 2, 2, 1, 3 => 22 + | 2, 2, 0, 4 => 20 + | 2, 3, 4, 0 => 23 + | 2, 3, 2, 1 => 24 + | 2, 3, 3, 1 => 25 + | 2, 3, 1, 2 => 24 + | 2, 3, 1, 3 => 25 + | 2, 3, 0, 4 => 23 + | 3, 2, 4, 0 => 23 + | 3, 2, 2, 1 => 24 + | 3, 2, 3, 1 => 25 + | 3, 2, 1, 2 => 24 + | 3, 2, 1, 3 => 25 + | 3, 2, 0, 4 => 23 + | 3, 3, 4, 0 => 26 + | 3, 3, 2, 1 => 27 + | 3, 3, 3, 1 => 28 + | 3, 3, 1, 2 => 27 + | 3, 3, 1, 3 => 28 + | 3, 3, 0, 4 => 26 + | 1, 4, 4, 0 => 17 + | 1, 4, 2, 1 => 18 + | 1, 4, 3, 1 => 19 + | 1, 4, 1, 2 => 18 + | 1, 4, 1, 3 => 19 + | 1, 4, 0, 4 => 17 + | 0, 5, 4, 0 => 14 + | 0, 5, 2, 1 => 15 + | 0, 5, 3, 1 => 16 + | 0, 5, 1, 2 => 15 + | 0, 5, 1, 3 => 16 + | 0, 5, 0, 4 => 14 + | 4, 0, 5, 0 => 14 + | 4, 0, 4, 1 => 17 + | 4, 0, 2, 2 => 20 + | 4, 0, 2, 3 => 23 + | 4, 0, 3, 2 => 23 + | 4, 0, 3, 3 => 26 + | 4, 0, 1, 4 => 17 + | 4, 0, 0, 5 => 14 + | 2, 1, 5, 0 => 15 + | 2, 1, 4, 1 => 18 + | 2, 1, 2, 2 => 21 + | 2, 1, 2, 3 => 24 + | 2, 1, 3, 2 => 24 + | 2, 1, 3, 3 => 27 + | 2, 1, 1, 4 => 18 + | 2, 1, 0, 5 => 15 + | 3, 1, 5, 0 => 16 + | 3, 1, 4, 1 => 19 + | 3, 1, 2, 2 => 22 + | 3, 1, 2, 3 => 25 + | 3, 1, 3, 2 => 25 + | 3, 1, 3, 3 => 28 + | 3, 1, 1, 4 => 19 + | 3, 1, 0, 5 => 16 + | 1, 2, 5, 0 => 15 + | 1, 2, 4, 1 => 18 + | 1, 2, 2, 2 => 21 + | 1, 2, 2, 3 => 24 + | 1, 2, 3, 2 => 24 + | 1, 2, 3, 3 => 27 + | 1, 2, 1, 4 => 18 + | 1, 2, 0, 5 => 15 + | 1, 3, 5, 0 => 16 + | 1, 3, 4, 1 => 19 + | 1, 3, 2, 2 => 22 + | 1, 3, 2, 3 => 25 + | 1, 3, 3, 2 => 25 + | 1, 3, 3, 3 => 28 + | 1, 3, 1, 4 => 19 + | 1, 3, 0, 5 => 16 + | 0, 4, 5, 0 => 14 + | 0, 4, 4, 1 => 17 + | 0, 4, 2, 2 => 20 + | 0, 4, 2, 3 => 23 + | 0, 4, 3, 2 => 23 + | 0, 4, 3, 3 => 26 + | 0, 4, 1, 4 => 17 + | 0, 4, 0, 5 => 14 + | 2, 0, 5, 1 => 5 + | 2, 0, 4, 2 => 8 + | 2, 0, 4, 3 => 11 + | 2, 0, 2, 4 => 8 + | 2, 0, 3, 4 => 11 + | 2, 0, 1, 5 => 5 + | 3, 0, 5, 1 => 6 + | 3, 0, 4, 2 => 9 + | 3, 0, 4, 3 => 12 + | 3, 0, 2, 4 => 9 + | 3, 0, 3, 4 => 12 + | 3, 0, 1, 5 => 6 + | 1, 1, 5, 1 => 7 + | 1, 1, 4, 2 => 10 + | 1, 1, 4, 3 => 13 + | 1, 1, 2, 4 => 10 + | 1, 1, 3, 4 => 13 + | 1, 1, 1, 5 => 7 + | 0, 2, 5, 1 => 5 + | 0, 2, 4, 2 => 8 + | 0, 2, 4, 3 => 11 + | 0, 2, 2, 4 => 8 + | 0, 2, 3, 4 => 11 + | 0, 2, 1, 5 => 5 + | 0, 3, 5, 1 => 6 + | 0, 3, 4, 2 => 9 + | 0, 3, 4, 3 => 12 + | 0, 3, 2, 4 => 9 + | 0, 3, 3, 4 => 12 + | 0, 3, 1, 5 => 6 + | 1, 0, 2, 5 => 2 + | 1, 0, 3, 5 => 3 + | 1, 0, 4, 4 => 4 + | 1, 0, 5, 2 => 2 + | 1, 0, 5, 3 => 3 + | 0, 1, 2, 5 => 2 + | 0, 1, 3, 5 => 3 + | 0, 1, 4, 4 => 4 + | 0, 1, 5, 2 => 2 + | 0, 1, 5, 3 => 3 + | 0, 0, 4, 5 => 1 + | 0, 0, 5, 4 => 1 + | _, _, _, _ => 0 +def CA2_7_7I2PairP (a : PairSlot × PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_7_7I2PairCertificates (CA2_7_7I2PairCertificateIndex a)).input +lemma CA2_7_7I2PairP_check_0_0 : ∀ k l : Fin 6, contains (CA2_7_7I2PairRaw ((0,0),(k,l))) (CA2_7_7I2PairP ((0,0),(k,l))) = true := by + decide +kernel +lemma CA2_7_7I2PairP_check_0_1 : ∀ k l : Fin 6, contains (CA2_7_7I2PairRaw ((0,1),(k,l))) (CA2_7_7I2PairP ((0,1),(k,l))) = true := by + decide +kernel +lemma CA2_7_7I2PairP_check_0_2 : ∀ k l : Fin 6, contains (CA2_7_7I2PairRaw ((0,2),(k,l))) (CA2_7_7I2PairP ((0,2),(k,l))) = true := by + decide +kernel +lemma CA2_7_7I2PairP_check_0_3 : ∀ k l : Fin 6, contains (CA2_7_7I2PairRaw ((0,3),(k,l))) (CA2_7_7I2PairP ((0,3),(k,l))) = true := by + decide +kernel +lemma CA2_7_7I2PairP_check_0_4 : ∀ k l : Fin 6, contains (CA2_7_7I2PairRaw ((0,4),(k,l))) (CA2_7_7I2PairP ((0,4),(k,l))) = true := by + decide +kernel +lemma CA2_7_7I2PairP_check_0_5 : ∀ k l : Fin 6, contains (CA2_7_7I2PairRaw ((0,5),(k,l))) (CA2_7_7I2PairP ((0,5),(k,l))) = true := by + decide +kernel +lemma CA2_7_7I2PairP_check_1_0 : ∀ k l : Fin 6, contains (CA2_7_7I2PairRaw ((1,0),(k,l))) (CA2_7_7I2PairP ((1,0),(k,l))) = true := by + decide +kernel +lemma CA2_7_7I2PairP_check_1_1 : ∀ k l : Fin 6, contains (CA2_7_7I2PairRaw ((1,1),(k,l))) (CA2_7_7I2PairP ((1,1),(k,l))) = true := by + decide +kernel +lemma CA2_7_7I2PairP_check_1_2 : ∀ k l : Fin 6, contains (CA2_7_7I2PairRaw ((1,2),(k,l))) (CA2_7_7I2PairP ((1,2),(k,l))) = true := by + decide +kernel +lemma CA2_7_7I2PairP_check_1_3 : ∀ k l : Fin 6, contains (CA2_7_7I2PairRaw ((1,3),(k,l))) (CA2_7_7I2PairP ((1,3),(k,l))) = true := by + decide +kernel +lemma CA2_7_7I2PairP_check_1_4 : ∀ k l : Fin 6, contains (CA2_7_7I2PairRaw ((1,4),(k,l))) (CA2_7_7I2PairP ((1,4),(k,l))) = true := by + decide +kernel +lemma CA2_7_7I2PairP_check_1_5 : ∀ k l : Fin 6, contains (CA2_7_7I2PairRaw ((1,5),(k,l))) (CA2_7_7I2PairP ((1,5),(k,l))) = true := by + decide +kernel +lemma CA2_7_7I2PairP_check_2_0 : ∀ k l : Fin 6, contains (CA2_7_7I2PairRaw ((2,0),(k,l))) (CA2_7_7I2PairP ((2,0),(k,l))) = true := by + decide +kernel +lemma CA2_7_7I2PairP_check_2_1 : ∀ k l : Fin 6, contains (CA2_7_7I2PairRaw ((2,1),(k,l))) (CA2_7_7I2PairP ((2,1),(k,l))) = true := by + decide +kernel +lemma CA2_7_7I2PairP_check_2_2 : ∀ k l : Fin 6, contains (CA2_7_7I2PairRaw ((2,2),(k,l))) (CA2_7_7I2PairP ((2,2),(k,l))) = true := by + decide +kernel +lemma CA2_7_7I2PairP_check_2_3 : ∀ k l : Fin 6, contains (CA2_7_7I2PairRaw ((2,3),(k,l))) (CA2_7_7I2PairP ((2,3),(k,l))) = true := by + decide +kernel +lemma CA2_7_7I2PairP_check_2_4 : ∀ k l : Fin 6, contains (CA2_7_7I2PairRaw ((2,4),(k,l))) (CA2_7_7I2PairP ((2,4),(k,l))) = true := by + decide +kernel +lemma CA2_7_7I2PairP_check_2_5 : ∀ k l : Fin 6, contains (CA2_7_7I2PairRaw ((2,5),(k,l))) (CA2_7_7I2PairP ((2,5),(k,l))) = true := by + decide +kernel +lemma CA2_7_7I2PairP_check_3_0 : ∀ k l : Fin 6, contains (CA2_7_7I2PairRaw ((3,0),(k,l))) (CA2_7_7I2PairP ((3,0),(k,l))) = true := by + decide +kernel +lemma CA2_7_7I2PairP_check_3_1 : ∀ k l : Fin 6, contains (CA2_7_7I2PairRaw ((3,1),(k,l))) (CA2_7_7I2PairP ((3,1),(k,l))) = true := by + decide +kernel +lemma CA2_7_7I2PairP_check_3_2 : ∀ k l : Fin 6, contains (CA2_7_7I2PairRaw ((3,2),(k,l))) (CA2_7_7I2PairP ((3,2),(k,l))) = true := by + decide +kernel +lemma CA2_7_7I2PairP_check_3_3 : ∀ k l : Fin 6, contains (CA2_7_7I2PairRaw ((3,3),(k,l))) (CA2_7_7I2PairP ((3,3),(k,l))) = true := by + decide +kernel +lemma CA2_7_7I2PairP_check_3_4 : ∀ k l : Fin 6, contains (CA2_7_7I2PairRaw ((3,4),(k,l))) (CA2_7_7I2PairP ((3,4),(k,l))) = true := by + decide +kernel +lemma CA2_7_7I2PairP_check_3_5 : ∀ k l : Fin 6, contains (CA2_7_7I2PairRaw ((3,5),(k,l))) (CA2_7_7I2PairP ((3,5),(k,l))) = true := by + decide +kernel +lemma CA2_7_7I2PairP_check_4_0 : ∀ k l : Fin 6, contains (CA2_7_7I2PairRaw ((4,0),(k,l))) (CA2_7_7I2PairP ((4,0),(k,l))) = true := by + decide +kernel +lemma CA2_7_7I2PairP_check_4_1 : ∀ k l : Fin 6, contains (CA2_7_7I2PairRaw ((4,1),(k,l))) (CA2_7_7I2PairP ((4,1),(k,l))) = true := by + decide +kernel +lemma CA2_7_7I2PairP_check_4_2 : ∀ k l : Fin 6, contains (CA2_7_7I2PairRaw ((4,2),(k,l))) (CA2_7_7I2PairP ((4,2),(k,l))) = true := by + decide +kernel +lemma CA2_7_7I2PairP_check_4_3 : ∀ k l : Fin 6, contains (CA2_7_7I2PairRaw ((4,3),(k,l))) (CA2_7_7I2PairP ((4,3),(k,l))) = true := by + decide +kernel +lemma CA2_7_7I2PairP_check_4_4 : ∀ k l : Fin 6, contains (CA2_7_7I2PairRaw ((4,4),(k,l))) (CA2_7_7I2PairP ((4,4),(k,l))) = true := by + decide +kernel +lemma CA2_7_7I2PairP_check_4_5 : ∀ k l : Fin 6, contains (CA2_7_7I2PairRaw ((4,5),(k,l))) (CA2_7_7I2PairP ((4,5),(k,l))) = true := by + decide +kernel +lemma CA2_7_7I2PairP_check_5_0 : ∀ k l : Fin 6, contains (CA2_7_7I2PairRaw ((5,0),(k,l))) (CA2_7_7I2PairP ((5,0),(k,l))) = true := by + decide +kernel +lemma CA2_7_7I2PairP_check_5_1 : ∀ k l : Fin 6, contains (CA2_7_7I2PairRaw ((5,1),(k,l))) (CA2_7_7I2PairP ((5,1),(k,l))) = true := by + decide +kernel +lemma CA2_7_7I2PairP_check_5_2 : ∀ k l : Fin 6, contains (CA2_7_7I2PairRaw ((5,2),(k,l))) (CA2_7_7I2PairP ((5,2),(k,l))) = true := by + decide +kernel +lemma CA2_7_7I2PairP_check_5_3 : ∀ k l : Fin 6, contains (CA2_7_7I2PairRaw ((5,3),(k,l))) (CA2_7_7I2PairP ((5,3),(k,l))) = true := by + decide +kernel +lemma CA2_7_7I2PairP_check_5_4 : ∀ k l : Fin 6, contains (CA2_7_7I2PairRaw ((5,4),(k,l))) (CA2_7_7I2PairP ((5,4),(k,l))) = true := by + decide +kernel +lemma CA2_7_7I2PairP_check_5_5 : ∀ k l : Fin 6, contains (CA2_7_7I2PairRaw ((5,5),(k,l))) (CA2_7_7I2PairP ((5,5),(k,l))) = true := by + decide +kernel +lemma CA2_7_7I2PairP_check (a : PairSlot × PairSlot) : contains (CA2_7_7I2PairRaw a) (CA2_7_7I2PairP a) = true := by + rcases a with ⟨⟨i,j⟩,⟨k,l⟩⟩ + revert j i + apply forall_fin6 + · exact forall_fin6 (CA2_7_7I2PairP_check_0_0 k l) (CA2_7_7I2PairP_check_0_1 k l) (CA2_7_7I2PairP_check_0_2 k l) (CA2_7_7I2PairP_check_0_3 k l) (CA2_7_7I2PairP_check_0_4 k l) (CA2_7_7I2PairP_check_0_5 k l) + · exact forall_fin6 (CA2_7_7I2PairP_check_1_0 k l) (CA2_7_7I2PairP_check_1_1 k l) (CA2_7_7I2PairP_check_1_2 k l) (CA2_7_7I2PairP_check_1_3 k l) (CA2_7_7I2PairP_check_1_4 k l) (CA2_7_7I2PairP_check_1_5 k l) + · exact forall_fin6 (CA2_7_7I2PairP_check_2_0 k l) (CA2_7_7I2PairP_check_2_1 k l) (CA2_7_7I2PairP_check_2_2 k l) (CA2_7_7I2PairP_check_2_3 k l) (CA2_7_7I2PairP_check_2_4 k l) (CA2_7_7I2PairP_check_2_5 k l) + · exact forall_fin6 (CA2_7_7I2PairP_check_3_0 k l) (CA2_7_7I2PairP_check_3_1 k l) (CA2_7_7I2PairP_check_3_2 k l) (CA2_7_7I2PairP_check_3_3 k l) (CA2_7_7I2PairP_check_3_4 k l) (CA2_7_7I2PairP_check_3_5 k l) + · exact forall_fin6 (CA2_7_7I2PairP_check_4_0 k l) (CA2_7_7I2PairP_check_4_1 k l) (CA2_7_7I2PairP_check_4_2 k l) (CA2_7_7I2PairP_check_4_3 k l) (CA2_7_7I2PairP_check_4_4 k l) (CA2_7_7I2PairP_check_4_5 k l) + · exact forall_fin6 (CA2_7_7I2PairP_check_5_0 k l) (CA2_7_7I2PairP_check_5_1 k l) (CA2_7_7I2PairP_check_5_2 k l) (CA2_7_7I2PairP_check_5_3 k l) (CA2_7_7I2PairP_check_5_4 k l) (CA2_7_7I2PairP_check_5_5 k l) +lemma CA2_7_7I2PairP_sound (a : PairSlot × PairSlot) : + (CA2_7_7I2PairP a).Encloses (CA2_7_7I2PairValue a) := + contains_sound (CA2_7_7I2PairRaw_sound a) (CA2_7_7I2PairP_check a) +def CA2_7_7I2PairTerms (a : PairSlot × PairSlot) : Ball := + (CompactCertificate.entropyLookup CA2_7_7I2PairCertificates (CA2_7_7I2PairCertificateIndex a)).output +lemma CA2_7_7I2PairTerms_sound (a : PairSlot × PairSlot) : + (CA2_7_7I2PairTerms a).Encloses (Foundation.entropyTerm (CA2_7_7I2PairValue a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA2_7_7I2PairCertificates_valid + (CA2_7_7I2PairCertificateIndex a) (CA2_7_7I2PairP_sound a) +def CA2_7_7I2PairEntropy : Ball := ⟨(7844896252681756294796751218143 / 2500000000000000000000000000000), (15209999259 / 12500000000000000000000000000000)⟩ +lemma CA2_7_7I2PairEntropy_sound : CA2_7_7I2PairEntropy.Encloses (Foundation.finiteEntropy CA2_7_7I2PairValue) := by + exact contains_sound (entropyDoublePair_enclosed CA2_7_7I2PairValue CA2_7_7I2PairTerms CA2_7_7I2PairTerms_sound) (by decide +kernel) +def CA2_7_7I2PairMass : Ball := ⟨(12499999999999999999999999999997 / 12500000000000000000000000000000), (143 / 25000000000000000000000000000000)⟩ +lemma CA2_7_7I2PairMass_sound : CA2_7_7I2PairMass.Encloses (∑ a, CA2_7_7I2PairValue a) := by + exact contains_sound (doublePairSumBall_sound CA2_7_7I2PairP CA2_7_7I2PairValue CA2_7_7I2PairP_sound) (by decide +kernel) +def CA2_7_7I2PairMassTermLogWitness : LogWitness := ⟨-1, 12499999999999999999999999999997, 6250000000000000000000000000000⟩ +def CA2_7_7I2PairMassTermLog : Ball := ⟨(-3 / 12500000000000000000000000000000), (21175823969 / 50000000000000000000000000000000)⟩ +lemma CA2_7_7I2PairMassTermLog_sound : CA2_7_7I2PairMassTermLog.Encloses (Real.log ((∑ a, CA2_7_7I2PairValue a))) := by + exact checkLog_sound logTwoBall_sound (CA2_7_7I2PairMass_sound) (w := CA2_7_7I2PairMassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA2_7_7I2PairMassTerm : Ball := ⟨(3 / 12500000000000000000000000000000), (42351647939 / 100000000000000000000000000000000)⟩ +lemma CA2_7_7I2PairMassTerm_sound : CA2_7_7I2PairMassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA2_7_7I2PairValue a))) := by + exact contains_sound (entropyTerm_ball (CA2_7_7I2PairMass_sound) CA2_7_7I2PairMassTermLog_sound) (by decide +kernel) +def CA2_7_7I2PairH : Ball := ⟨(4903060157926097684247969511339 / 1562500000000000000000000000000), (164031642011 / 100000000000000000000000000000000)⟩ +lemma CA2_7_7I2PairH_sound : CA2_7_7I2PairH.Encloses (homogeneousEntropy CA2_7_7I2PairValue) := by + exact contains_sound (homogeneous_enclosed CA2_7_7I2PairValue CA2_7_7I2PairMassTerm_sound CA2_7_7I2PairEntropy_sound) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA3_3_10I0.lean b/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA3_3_10I0.lean new file mode 100644 index 0000000000000000000000000000000000000000..090852ccbf95546cf9a0634e40c2616b0c65af7f --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA3_3_10I0.lean @@ -0,0 +1,75 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Certificates.SplitA3_3_10 + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CA3_3_10I0Value (a : Fin 17) : ℝ := marginal (below (shape 3 3 10)) (fun u => (stageALaw (shape 3 3 10) u : ℝ)) ((Equiv.refl (Fin 3)) 0) a +def CA3_3_10I0Raw (a : Fin 17) : Ball := marginalBall (below (shape 3 3 10)) A3_3_10Law ((Equiv.refl (Fin 3)) 0) a +lemma CA3_3_10I0Raw_sound (a : Fin 17) : + (CA3_3_10I0Raw a).Encloses (CA3_3_10I0Value a) := by + exact marginalBall_sound (below (shape 3 3 10)) A3_3_10Law (fun u => (stageALaw (shape 3 3 10) u : ℝ)) (fun u _ => A3_3_10Law_sound u) ((Equiv.refl (Fin 3)) 0) a +def CA3_3_10I0Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(10497274588807341414561202190481 / 100000000000000000000000000000000), (1 / 2500000000000000000000000000000)⟩ ⟨(23661429292187606529377590229149 / 100000000000000000000000000000000), (11114421923 / 100000000000000000000000000000000)⟩ ⟨(-56351363137191031627685565486621 / 25000000000000000000000000000000), (21175823759 / 20000000000000000000000000000000)⟩ ⟨-4, 10497274588807341414561202190481, 6250000000000000000000000000000⟩, + .log ⟨(39502725411192658585438797809519 / 100000000000000000000000000000000), (3 / 4000000000000000000000000000000)⟩ ⟨(18345075926178088449710102227777 / 50000000000000000000000000000000), (12547541297 / 50000000000000000000000000000000)⟩ ⟨(-290250162096730528682758688967 / 312500000000000000000000000000), (31763735619 / 50000000000000000000000000000000)⟩ ⟨-2, 39502725411192658585438797809519, 25000000000000000000000000000000⟩] +lemma CA3_3_10I0Certificates_valid : + CA3_3_10I0Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA3_3_10I0CertificateIndex (a : Fin 17) : ℕ := + match a.val with + | 0 => 1 + | 1 => 2 + | 2 => 2 + | 3 => 1 + | _ => 0 +def CA3_3_10I0P (a : Fin 17) : Ball := + (CompactCertificate.entropyLookup CA3_3_10I0Certificates (CA3_3_10I0CertificateIndex a)).input +lemma CA3_3_10I0P_check : ∀ a : Fin 17, contains (CA3_3_10I0Raw a) (CA3_3_10I0P a) = true := by + decide +kernel +lemma CA3_3_10I0P_sound (a : Fin 17) : + (CA3_3_10I0P a).Encloses (CA3_3_10I0Value a) := + contains_sound (CA3_3_10I0Raw_sound a) (CA3_3_10I0P_check a) +def CA3_3_10I0Terms (a : Fin 17) : Ball := + (CompactCertificate.entropyLookup CA3_3_10I0Certificates (CA3_3_10I0CertificateIndex a)).output +lemma CA3_3_10I0Terms_sound (a : Fin 17) : + (CA3_3_10I0Terms a).Encloses (Foundation.entropyTerm (CA3_3_10I0Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA3_3_10I0Certificates_valid + (CA3_3_10I0CertificateIndex a) (CA3_3_10I0P_sound a) +def CA3_3_10I0Entropy : Ball := ⟨(60351581144543783428797794684703 / 50000000000000000000000000000000), (36209504517 / 50000000000000000000000000000000)⟩ +lemma CA3_3_10I0Entropy_sound : CA3_3_10I0Entropy.Encloses (Foundation.finiteEntropy CA3_3_10I0Value) := by + exact contains_sound (entropyFin_enclosed 17 CA3_3_10I0Value CA3_3_10I0Terms CA3_3_10I0Terms_sound) (by decide +kernel) +def CA3_3_10I0Mass : Ball := ⟨1, (23 / 10000000000000000000000000000000)⟩ +lemma CA3_3_10I0Mass_sound : CA3_3_10I0Mass.Encloses (∑ a, CA3_3_10I0Value a) := by + exact contains_sound (finSumBall_sound 17 CA3_3_10I0P CA3_3_10I0Value CA3_3_10I0P_sound) (by decide +kernel) +def CA3_3_10I0MassTermLogWitness : LogWitness := ⟨0, 1, 1⟩ +def CA3_3_10I0MassTermLog : Ball := ⟨0, (2646977989 / 12500000000000000000000000000000)⟩ +lemma CA3_3_10I0MassTermLog_sound : CA3_3_10I0MassTermLog.Encloses (Real.log ((∑ a, CA3_3_10I0Value a))) := by + exact checkLog_sound logTwoBall_sound (CA3_3_10I0Mass_sound) (w := CA3_3_10I0MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA3_3_10I0MassTerm : Ball := ⟨0, (21175823913 / 100000000000000000000000000000000)⟩ +lemma CA3_3_10I0MassTerm_sound : CA3_3_10I0MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA3_3_10I0Value a))) := by + exact contains_sound (entropyTerm_ball (CA3_3_10I0Mass_sound) CA3_3_10I0MassTermLog_sound) (by decide +kernel) +def CA3_3_10I0H : Ball := ⟨(60351581144543783428797794684703 / 50000000000000000000000000000000), (93594832947 / 100000000000000000000000000000000)⟩ +lemma CA3_3_10I0H_sound : CA3_3_10I0H.Encloses (homogeneousEntropy CA3_3_10I0Value) := by + exact contains_sound (homogeneous_enclosed CA3_3_10I0Value CA3_3_10I0MassTerm_sound CA3_3_10I0Entropy_sound) (by decide +kernel) +lemma CA3_3_10I0_sound : CA3_3_10I0H.Encloses (stageACapacity (shape 3 3 10) 0) := by + exact CA3_3_10I0H_sound + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA3_3_10I1.lean b/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA3_3_10I1.lean new file mode 100644 index 0000000000000000000000000000000000000000..dfb25d6d584cd67af7d08d3ddcc8f2b6e8df6262 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA3_3_10I1.lean @@ -0,0 +1,981 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Certificates.SupportedContraction + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CA3_3_10I1PairValue (a : PairSlot × PairSlot) : ℝ := pairLaw (below (shape 3 3 10)) (shape 3 3 10) (fun u => (stageALaw (shape 3 3 10) u : ℝ)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) a +def CA3_3_10I1PairRaw (a : PairSlot × PairSlot) : Ball := stageAPairBall (shape 3 3 10) A3_3_10Law 1 a +lemma CA3_3_10I1PairRaw_sound (a : PairSlot × PairSlot) : + (CA3_3_10I1PairRaw a).Encloses (CA3_3_10I1PairValue a) := by + exact stageAPairBall_sound (shape 3 3 10) (by decide +kernel) A3_3_10Law (fun u => (stageALaw (shape 3 3 10) u : ℝ)) (fun u _ => A3_3_10Law_sound u) 1 a +def CA3_3_10I1PairCertificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(4619054651167277020629531838693 / 100000000000000000000000000000000), (3 / 12500000000000000000000000000000)⟩ ⟨(14203501238427614750271209133991 / 100000000000000000000000000000000), (5868737311 / 100000000000000000000000000000000)⟩ ⟨(-307498012279163250732354083952271 / 100000000000000000000000000000000), (127054942617 / 100000000000000000000000000000000)⟩ ⟨-5, 4619054651167277020629531838693, 3125000000000000000000000000000⟩, + .log ⟨(8871250693737520079598966291 / 2000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ ⟨(1201630128356614022253786080439 / 50000000000000000000000000000000), (422676101 / 50000000000000000000000000000000)⟩ ⟨(-541808667048437937517112002272391 / 100000000000000000000000000000000), (95291206911 / 50000000000000000000000000000000)⟩ ⟨-8, 8871250693737520079598966291, 7812500000000000000000000000⟩, + .log ⟨(205890417481175314177510224919 / 100000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ ⟨(1273551935099509918164620566777 / 100000000000000000000000000000000), (435989933 / 100000000000000000000000000000000)⟩ ⟨(-618558139169323674081473370489413 / 100000000000000000000000000000000), (211758237801 / 100000000000000000000000000000000)⟩ ⟨-9, 205890417481175314177510224919, 195312500000000000000000000000⟩, + .log ⟨(12369411578640493863887606112473 / 100000000000000000000000000000000), (21 / 50000000000000000000000000000000)⟩ ⟨(25851372182769150597570746307719 / 100000000000000000000000000000000), (13096624063 / 100000000000000000000000000000000)⟩ ⟨(-104497178456771998300419614782573 / 50000000000000000000000000000000), (52939559377 / 50000000000000000000000000000000)⟩ ⟨-4, 12369411578640493863887606112473, 6250000000000000000000000000000⟩, + .log ⟨(522296892672814704126252563 / 15625000000000000000000000000), (9 / 50000000000000000000000000000000)⟩ ⟨(11359802944430633853842515363723 / 100000000000000000000000000000000), (4247065773 / 100000000000000000000000000000000)⟩ ⟨(-67967825769899427637754912757131 / 20000000000000000000000000000000), (31763735659 / 25000000000000000000000000000000)⟩ ⟨-5, 522296892672814704126252563, 488281250000000000000000000⟩, + .log ⟨(338340295906074792254685351483 / 100000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ ⟨(15037305234827450456760484733 / 781250000000000000000000000000), (716463459 / 100000000000000000000000000000000)⟩ ⟨(-17777729010442070054965821551063 / 3125000000000000000000000000000), (211758237421 / 100000000000000000000000000000000)⟩ ⟨-9, 338340295906074792254685351483, 195312500000000000000000000000⟩] +lemma CA3_3_10I1PairCertificates_valid : + CA3_3_10I1PairCertificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA3_3_10I1PairCertificateIndex (a : PairSlot × PairSlot) : ℕ := + match a.1.1.val, a.1.2.val, a.2.1.val, a.2.2.val with + | 0, 0, 2, 1 => 1 + | 0, 0, 3, 1 => 2 + | 0, 0, 4, 0 => 3 + | 0, 0, 1, 2 => 1 + | 0, 0, 1, 3 => 2 + | 0, 0, 0, 4 => 3 + | 1, 0, 1, 1 => 4 + | 1, 0, 2, 0 => 5 + | 1, 0, 3, 0 => 6 + | 1, 0, 0, 2 => 5 + | 1, 0, 0, 3 => 6 + | 0, 1, 1, 1 => 4 + | 0, 1, 2, 0 => 5 + | 0, 1, 3, 0 => 6 + | 0, 1, 0, 2 => 5 + | 0, 1, 0, 3 => 6 + | 2, 0, 0, 1 => 5 + | 2, 0, 1, 0 => 5 + | 3, 0, 0, 1 => 6 + | 3, 0, 1, 0 => 6 + | 1, 1, 0, 1 => 4 + | 1, 1, 1, 0 => 4 + | 0, 2, 0, 1 => 5 + | 0, 2, 1, 0 => 5 + | 0, 3, 0, 1 => 6 + | 0, 3, 1, 0 => 6 + | 4, 0, 0, 0 => 3 + | 2, 1, 0, 0 => 1 + | 3, 1, 0, 0 => 2 + | 1, 2, 0, 0 => 1 + | 1, 3, 0, 0 => 2 + | 0, 4, 0, 0 => 3 + | _, _, _, _ => 0 +def CA3_3_10I1PairP (a : PairSlot × PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_3_10I1PairCertificates (CA3_3_10I1PairCertificateIndex a)).input +lemma CA3_3_10I1PairP_check_0_0 : ∀ k l : Fin 6, contains (CA3_3_10I1PairRaw ((0,0),(k,l))) (CA3_3_10I1PairP ((0,0),(k,l))) = true := by + decide +kernel +lemma CA3_3_10I1PairP_check_0_1 : ∀ k l : Fin 6, contains (CA3_3_10I1PairRaw ((0,1),(k,l))) (CA3_3_10I1PairP ((0,1),(k,l))) = true := by + decide +kernel +lemma CA3_3_10I1PairP_check_0_2 : ∀ k l : Fin 6, contains (CA3_3_10I1PairRaw ((0,2),(k,l))) (CA3_3_10I1PairP ((0,2),(k,l))) = true := by + decide +kernel +lemma CA3_3_10I1PairP_check_0_3 : ∀ k l : Fin 6, contains (CA3_3_10I1PairRaw ((0,3),(k,l))) (CA3_3_10I1PairP ((0,3),(k,l))) = true := by + decide +kernel +lemma CA3_3_10I1PairP_check_0_4 : ∀ k l : Fin 6, contains (CA3_3_10I1PairRaw ((0,4),(k,l))) (CA3_3_10I1PairP ((0,4),(k,l))) = true := by + decide +kernel +lemma CA3_3_10I1PairP_check_0_5 : ∀ k l : Fin 6, contains (CA3_3_10I1PairRaw ((0,5),(k,l))) (CA3_3_10I1PairP ((0,5),(k,l))) = true := by + decide +kernel +lemma CA3_3_10I1PairP_check_1_0 : ∀ k l : Fin 6, contains (CA3_3_10I1PairRaw ((1,0),(k,l))) (CA3_3_10I1PairP ((1,0),(k,l))) = true := by + decide +kernel +lemma CA3_3_10I1PairP_check_1_1 : ∀ k l : Fin 6, contains (CA3_3_10I1PairRaw ((1,1),(k,l))) (CA3_3_10I1PairP ((1,1),(k,l))) = true := by + decide +kernel +lemma CA3_3_10I1PairP_check_1_2 : ∀ k l : Fin 6, contains (CA3_3_10I1PairRaw ((1,2),(k,l))) (CA3_3_10I1PairP ((1,2),(k,l))) = true := by + decide +kernel +lemma CA3_3_10I1PairP_check_1_3 : ∀ k l : Fin 6, contains (CA3_3_10I1PairRaw ((1,3),(k,l))) (CA3_3_10I1PairP ((1,3),(k,l))) = true := by + decide +kernel +lemma CA3_3_10I1PairP_check_1_4 : ∀ k l : Fin 6, contains (CA3_3_10I1PairRaw ((1,4),(k,l))) (CA3_3_10I1PairP ((1,4),(k,l))) = true := by + decide +kernel +lemma CA3_3_10I1PairP_check_1_5 : ∀ k l : Fin 6, contains (CA3_3_10I1PairRaw ((1,5),(k,l))) (CA3_3_10I1PairP ((1,5),(k,l))) = true := by + decide +kernel +lemma CA3_3_10I1PairP_check_2_0 : ∀ k l : Fin 6, contains (CA3_3_10I1PairRaw ((2,0),(k,l))) (CA3_3_10I1PairP ((2,0),(k,l))) = true := by + decide +kernel +lemma CA3_3_10I1PairP_check_2_1 : ∀ k l : Fin 6, contains (CA3_3_10I1PairRaw ((2,1),(k,l))) (CA3_3_10I1PairP ((2,1),(k,l))) = true := by + decide +kernel +lemma CA3_3_10I1PairP_check_2_2 : ∀ k l : Fin 6, contains (CA3_3_10I1PairRaw ((2,2),(k,l))) (CA3_3_10I1PairP ((2,2),(k,l))) = true := by + decide +kernel +lemma CA3_3_10I1PairP_check_2_3 : ∀ k l : Fin 6, contains (CA3_3_10I1PairRaw ((2,3),(k,l))) (CA3_3_10I1PairP ((2,3),(k,l))) = true := by + decide +kernel +lemma CA3_3_10I1PairP_check_2_4 : ∀ k l : Fin 6, contains (CA3_3_10I1PairRaw ((2,4),(k,l))) (CA3_3_10I1PairP ((2,4),(k,l))) = true := by + decide +kernel +lemma CA3_3_10I1PairP_check_2_5 : ∀ k l : Fin 6, contains (CA3_3_10I1PairRaw ((2,5),(k,l))) (CA3_3_10I1PairP ((2,5),(k,l))) = true := by + decide +kernel +lemma CA3_3_10I1PairP_check_3_0 : ∀ k l : Fin 6, contains (CA3_3_10I1PairRaw ((3,0),(k,l))) (CA3_3_10I1PairP ((3,0),(k,l))) = true := by + decide +kernel +lemma CA3_3_10I1PairP_check_3_1 : ∀ k l : Fin 6, contains (CA3_3_10I1PairRaw ((3,1),(k,l))) (CA3_3_10I1PairP ((3,1),(k,l))) = true := by + decide +kernel +lemma CA3_3_10I1PairP_check_3_2 : ∀ k l : Fin 6, contains (CA3_3_10I1PairRaw ((3,2),(k,l))) (CA3_3_10I1PairP ((3,2),(k,l))) = true := by + decide +kernel +lemma CA3_3_10I1PairP_check_3_3 : ∀ k l : Fin 6, contains (CA3_3_10I1PairRaw ((3,3),(k,l))) (CA3_3_10I1PairP ((3,3),(k,l))) = true := by + decide +kernel +lemma CA3_3_10I1PairP_check_3_4 : ∀ k l : Fin 6, contains (CA3_3_10I1PairRaw ((3,4),(k,l))) (CA3_3_10I1PairP ((3,4),(k,l))) = true := by + decide +kernel +lemma CA3_3_10I1PairP_check_3_5 : ∀ k l : Fin 6, contains (CA3_3_10I1PairRaw ((3,5),(k,l))) (CA3_3_10I1PairP ((3,5),(k,l))) = true := by + decide +kernel +lemma CA3_3_10I1PairP_check_4_0 : ∀ k l : Fin 6, contains (CA3_3_10I1PairRaw ((4,0),(k,l))) (CA3_3_10I1PairP ((4,0),(k,l))) = true := by + decide +kernel +lemma CA3_3_10I1PairP_check_4_1 : ∀ k l : Fin 6, contains (CA3_3_10I1PairRaw ((4,1),(k,l))) (CA3_3_10I1PairP ((4,1),(k,l))) = true := by + decide +kernel +lemma CA3_3_10I1PairP_check_4_2 : ∀ k l : Fin 6, contains (CA3_3_10I1PairRaw ((4,2),(k,l))) (CA3_3_10I1PairP ((4,2),(k,l))) = true := by + decide +kernel +lemma CA3_3_10I1PairP_check_4_3 : ∀ k l : Fin 6, contains (CA3_3_10I1PairRaw ((4,3),(k,l))) (CA3_3_10I1PairP ((4,3),(k,l))) = true := by + decide +kernel +lemma CA3_3_10I1PairP_check_4_4 : ∀ k l : Fin 6, contains (CA3_3_10I1PairRaw ((4,4),(k,l))) (CA3_3_10I1PairP ((4,4),(k,l))) = true := by + decide +kernel +lemma CA3_3_10I1PairP_check_4_5 : ∀ k l : Fin 6, contains (CA3_3_10I1PairRaw ((4,5),(k,l))) (CA3_3_10I1PairP ((4,5),(k,l))) = true := by + decide +kernel +lemma CA3_3_10I1PairP_check_5_0 : ∀ k l : Fin 6, contains (CA3_3_10I1PairRaw ((5,0),(k,l))) (CA3_3_10I1PairP ((5,0),(k,l))) = true := by + decide +kernel +lemma CA3_3_10I1PairP_check_5_1 : ∀ k l : Fin 6, contains (CA3_3_10I1PairRaw ((5,1),(k,l))) (CA3_3_10I1PairP ((5,1),(k,l))) = true := by + decide +kernel +lemma CA3_3_10I1PairP_check_5_2 : ∀ k l : Fin 6, contains (CA3_3_10I1PairRaw ((5,2),(k,l))) (CA3_3_10I1PairP ((5,2),(k,l))) = true := by + decide +kernel +lemma CA3_3_10I1PairP_check_5_3 : ∀ k l : Fin 6, contains (CA3_3_10I1PairRaw ((5,3),(k,l))) (CA3_3_10I1PairP ((5,3),(k,l))) = true := by + decide +kernel +lemma CA3_3_10I1PairP_check_5_4 : ∀ k l : Fin 6, contains (CA3_3_10I1PairRaw ((5,4),(k,l))) (CA3_3_10I1PairP ((5,4),(k,l))) = true := by + decide +kernel +lemma CA3_3_10I1PairP_check_5_5 : ∀ k l : Fin 6, contains (CA3_3_10I1PairRaw ((5,5),(k,l))) (CA3_3_10I1PairP ((5,5),(k,l))) = true := by + decide +kernel +lemma CA3_3_10I1PairP_check (a : PairSlot × PairSlot) : contains (CA3_3_10I1PairRaw a) (CA3_3_10I1PairP a) = true := by + rcases a with ⟨⟨i,j⟩,⟨k,l⟩⟩ + revert j i + apply forall_fin6 + · exact forall_fin6 (CA3_3_10I1PairP_check_0_0 k l) (CA3_3_10I1PairP_check_0_1 k l) (CA3_3_10I1PairP_check_0_2 k l) (CA3_3_10I1PairP_check_0_3 k l) (CA3_3_10I1PairP_check_0_4 k l) (CA3_3_10I1PairP_check_0_5 k l) + · exact forall_fin6 (CA3_3_10I1PairP_check_1_0 k l) (CA3_3_10I1PairP_check_1_1 k l) (CA3_3_10I1PairP_check_1_2 k l) (CA3_3_10I1PairP_check_1_3 k l) (CA3_3_10I1PairP_check_1_4 k l) (CA3_3_10I1PairP_check_1_5 k l) + · exact forall_fin6 (CA3_3_10I1PairP_check_2_0 k l) (CA3_3_10I1PairP_check_2_1 k l) (CA3_3_10I1PairP_check_2_2 k l) (CA3_3_10I1PairP_check_2_3 k l) (CA3_3_10I1PairP_check_2_4 k l) (CA3_3_10I1PairP_check_2_5 k l) + · exact forall_fin6 (CA3_3_10I1PairP_check_3_0 k l) (CA3_3_10I1PairP_check_3_1 k l) (CA3_3_10I1PairP_check_3_2 k l) (CA3_3_10I1PairP_check_3_3 k l) (CA3_3_10I1PairP_check_3_4 k l) (CA3_3_10I1PairP_check_3_5 k l) + · exact forall_fin6 (CA3_3_10I1PairP_check_4_0 k l) (CA3_3_10I1PairP_check_4_1 k l) (CA3_3_10I1PairP_check_4_2 k l) (CA3_3_10I1PairP_check_4_3 k l) (CA3_3_10I1PairP_check_4_4 k l) (CA3_3_10I1PairP_check_4_5 k l) + · exact forall_fin6 (CA3_3_10I1PairP_check_5_0 k l) (CA3_3_10I1PairP_check_5_1 k l) (CA3_3_10I1PairP_check_5_2 k l) (CA3_3_10I1PairP_check_5_3 k l) (CA3_3_10I1PairP_check_5_4 k l) (CA3_3_10I1PairP_check_5_5 k l) +lemma CA3_3_10I1PairP_sound (a : PairSlot × PairSlot) : + (CA3_3_10I1PairP a).Encloses (CA3_3_10I1PairValue a) := + contains_sound (CA3_3_10I1PairRaw_sound a) (CA3_3_10I1PairP_check a) +def CA3_3_10I1PairTerms (a : PairSlot × PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_3_10I1PairCertificates (CA3_3_10I1PairCertificateIndex a)).output +lemma CA3_3_10I1PairTerms_sound (a : PairSlot × PairSlot) : + (CA3_3_10I1PairTerms a).Encloses (Foundation.entropyTerm (CA3_3_10I1PairValue a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA3_3_10I1PairCertificates_valid + (CA3_3_10I1PairCertificateIndex a) (CA3_3_10I1PairP_sound a) +def CA3_3_10I1PairEntropy : Ball := ⟨(70300841641986598335129862988459 / 25000000000000000000000000000000), (30173761973 / 25000000000000000000000000000000)⟩ +lemma CA3_3_10I1PairEntropy_sound : CA3_3_10I1PairEntropy.Encloses (Foundation.finiteEntropy CA3_3_10I1PairValue) := by + exact contains_sound (entropyDoublePair_enclosed CA3_3_10I1PairValue CA3_3_10I1PairTerms CA3_3_10I1PairTerms_sound) (by decide +kernel) +def CA3_3_10I1PairMass : Ball := ⟨(25000000000000000000000000000001 / 25000000000000000000000000000000), (111 / 25000000000000000000000000000000)⟩ +lemma CA3_3_10I1PairMass_sound : CA3_3_10I1PairMass.Encloses (∑ a, CA3_3_10I1PairValue a) := by + exact contains_sound (doublePairSumBall_sound CA3_3_10I1PairP CA3_3_10I1PairValue CA3_3_10I1PairP_sound) (by decide +kernel) +def CA3_3_10I1PairMassTermLogWitness : LogWitness := ⟨0, 25000000000000000000000000000001, 25000000000000000000000000000000⟩ +def CA3_3_10I1PairMassTermLog : Ball := ⟨(1 / 25000000000000000000000000000000), (10587912063 / 50000000000000000000000000000000)⟩ +lemma CA3_3_10I1PairMassTermLog_sound : CA3_3_10I1PairMassTermLog.Encloses (Real.log ((∑ a, CA3_3_10I1PairValue a))) := by + exact checkLog_sound logTwoBall_sound (CA3_3_10I1PairMass_sound) (w := CA3_3_10I1PairMassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA3_3_10I1PairMassTerm : Ball := ⟨(-1 / 25000000000000000000000000000000), (21175824127 / 100000000000000000000000000000000)⟩ +lemma CA3_3_10I1PairMassTerm_sound : CA3_3_10I1PairMassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA3_3_10I1PairValue a))) := by + exact contains_sound (entropyTerm_ball (CA3_3_10I1PairMass_sound) CA3_3_10I1PairMassTermLog_sound) (by decide +kernel) +def CA3_3_10I1PairH : Ball := ⟨(3515042082099329916756493149423 / 1250000000000000000000000000000), (141870872019 / 100000000000000000000000000000000)⟩ +lemma CA3_3_10I1PairH_sound : CA3_3_10I1PairH.Encloses (homogeneousEntropy CA3_3_10I1PairValue) := by + exact contains_sound (homogeneous_enclosed CA3_3_10I1PairValue CA3_3_10I1PairMassTerm_sound CA3_3_10I1PairEntropy_sound) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CA3_3_10I1R0Value (a : PairSlot) : ℝ := residualLaw (below (shape 3 3 10)) (fun u => (stageALaw (shape 3 3 10) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 0 a +def CA3_3_10I1R0Raw (a : PairSlot) : Ball := residualBall (below (shape 3 3 10)) A3_3_10Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 0 a +lemma CA3_3_10I1R0Raw_sound (a : PairSlot) : + (CA3_3_10I1R0Raw a).Encloses (CA3_3_10I1R0Value a) := by + exact residualBall_sound_on (below (shape 3 3 10)) A3_3_10Law (fun u => (stageALaw (shape 3 3 10) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A3_3_10Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 3 3 10) (show (shape 3 3 10) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 0 a +def CA3_3_10I1R0Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(2634253801667664169393495189081 / 25000000000000000000000000000000), (41 / 100000000000000000000000000000000)⟩ ⟨(23711191063531435570046086221241 / 100000000000000000000000000000000), (5578249471 / 50000000000000000000000000000000)⟩ ⟨(-14064224188767788938283650303749 / 6250000000000000000000000000000), (26469779701 / 25000000000000000000000000000000)⟩ ⟨-4, 2634253801667664169393495189081, 1562500000000000000000000000000⟩] +lemma CA3_3_10I1R0Certificates_valid : + CA3_3_10I1R0Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA3_3_10I1R0CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 0, 0 => 1 + | _, _ => 0 +def CA3_3_10I1R0P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_3_10I1R0Certificates (CA3_3_10I1R0CertificateIndex a)).input +lemma CA3_3_10I1R0P_check : ∀ a : PairSlot, contains (CA3_3_10I1R0Raw a) (CA3_3_10I1R0P a) = true := by + decide +kernel +lemma CA3_3_10I1R0P_sound (a : PairSlot) : + (CA3_3_10I1R0P a).Encloses (CA3_3_10I1R0Value a) := + contains_sound (CA3_3_10I1R0Raw_sound a) (CA3_3_10I1R0P_check a) +def CA3_3_10I1R0Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_3_10I1R0Certificates (CA3_3_10I1R0CertificateIndex a)).output +lemma CA3_3_10I1R0Terms_sound (a : PairSlot) : + (CA3_3_10I1R0Terms a).Encloses (Foundation.entropyTerm (CA3_3_10I1R0Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA3_3_10I1R0Certificates_valid + (CA3_3_10I1R0CertificateIndex a) (CA3_3_10I1R0P_sound a) +def CA3_3_10I1R0Entropy : Ball := ⟨(23711191063531435570046086221241 / 100000000000000000000000000000000), (5578249471 / 50000000000000000000000000000000)⟩ +lemma CA3_3_10I1R0Entropy_sound : CA3_3_10I1R0Entropy.Encloses (Foundation.finiteEntropy CA3_3_10I1R0Value) := by + exact contains_sound (entropyPair_enclosed CA3_3_10I1R0Value CA3_3_10I1R0Terms CA3_3_10I1R0Terms_sound) (by decide +kernel) +def CA3_3_10I1R0Mass : Ball := ⟨(2634253801667664169393495189081 / 25000000000000000000000000000000), (41 / 100000000000000000000000000000000)⟩ +lemma CA3_3_10I1R0Mass_sound : CA3_3_10I1R0Mass.Encloses (∑ a, CA3_3_10I1R0Value a) := by + exact contains_sound (pairSumBall_sound CA3_3_10I1R0P CA3_3_10I1R0Value CA3_3_10I1R0P_sound) (by decide +kernel) +def CA3_3_10I1R0MassTermLogWitness : LogWitness := ⟨-4, 2634253801667664169393495189081, 1562500000000000000000000000000⟩ +def CA3_3_10I1R0MassTermLog : Ball := ⟨(-14064224188767788938283650303749 / 6250000000000000000000000000000), (26469779701 / 25000000000000000000000000000000)⟩ +lemma CA3_3_10I1R0MassTermLog_sound : CA3_3_10I1R0MassTermLog.Encloses (Real.log ((∑ a, CA3_3_10I1R0Value a))) := by + exact checkLog_sound logTwoBall_sound (CA3_3_10I1R0Mass_sound) (w := CA3_3_10I1R0MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA3_3_10I1R0MassTerm : Ball := ⟨(23711191063531435570046086221241 / 100000000000000000000000000000000), (5578249471 / 50000000000000000000000000000000)⟩ +lemma CA3_3_10I1R0MassTerm_sound : CA3_3_10I1R0MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA3_3_10I1R0Value a))) := by + exact contains_sound (entropyTerm_ball (CA3_3_10I1R0Mass_sound) CA3_3_10I1R0MassTermLog_sound) (by decide +kernel) +def CA3_3_10I1R0H : Ball := ⟨0, (5578249471 / 25000000000000000000000000000000)⟩ +lemma CA3_3_10I1R0H_sound : CA3_3_10I1R0H.Encloses (homogeneousEntropy CA3_3_10I1R0Value) := by + exact contains_sound (homogeneous_enclosed CA3_3_10I1R0Value CA3_3_10I1R0MassTerm_sound CA3_3_10I1R0Entropy_sound) (by decide +kernel) +def CA3_3_10I1R1Value (a : PairSlot) : ℝ := residualLaw (below (shape 3 3 10)) (fun u => (stageALaw (shape 3 3 10) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 1 a +def CA3_3_10I1R1Raw (a : PairSlot) : Ball := residualBall (below (shape 3 3 10)) A3_3_10Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 1 a +lemma CA3_3_10I1R1Raw_sound (a : PairSlot) : + (CA3_3_10I1R1Raw a).Encloses (CA3_3_10I1R1Value a) := by + exact residualBall_sound_on (below (shape 3 3 10)) A3_3_10Law (fun u => (stageALaw (shape 3 3 10) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A3_3_10Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 3 3 10) (show (shape 3 3 10) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 1 a +def CA3_3_10I1R1Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(9865746198332335830606504810919 / 50000000000000000000000000000000), (51 / 100000000000000000000000000000000)⟩ ⟨(32023309006516069604011097727319 / 100000000000000000000000000000000), (8356612147 / 50000000000000000000000000000000)⟩ ⟨(-8114771139138252622148038346787 / 5000000000000000000000000000000), (8470329499 / 10000000000000000000000000000000)⟩ ⟨-3, 9865746198332335830606504810919, 6250000000000000000000000000000⟩] +lemma CA3_3_10I1R1Certificates_valid : + CA3_3_10I1R1Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA3_3_10I1R1CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 1, 0 => 1 + | 0, 1 => 1 + | _, _ => 0 +def CA3_3_10I1R1P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_3_10I1R1Certificates (CA3_3_10I1R1CertificateIndex a)).input +lemma CA3_3_10I1R1P_check : ∀ a : PairSlot, contains (CA3_3_10I1R1Raw a) (CA3_3_10I1R1P a) = true := by + decide +kernel +lemma CA3_3_10I1R1P_sound (a : PairSlot) : + (CA3_3_10I1R1P a).Encloses (CA3_3_10I1R1Value a) := + contains_sound (CA3_3_10I1R1Raw_sound a) (CA3_3_10I1R1P_check a) +def CA3_3_10I1R1Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_3_10I1R1Certificates (CA3_3_10I1R1CertificateIndex a)).output +lemma CA3_3_10I1R1Terms_sound (a : PairSlot) : + (CA3_3_10I1R1Terms a).Encloses (Foundation.entropyTerm (CA3_3_10I1R1Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA3_3_10I1R1Certificates_valid + (CA3_3_10I1R1CertificateIndex a) (CA3_3_10I1R1P_sound a) +def CA3_3_10I1R1Entropy : Ball := ⟨(32023309006516069604011097727319 / 50000000000000000000000000000000), (8356612147 / 25000000000000000000000000000000)⟩ +lemma CA3_3_10I1R1Entropy_sound : CA3_3_10I1R1Entropy.Encloses (Foundation.finiteEntropy CA3_3_10I1R1Value) := by + exact contains_sound (entropyPair_enclosed CA3_3_10I1R1Value CA3_3_10I1R1Terms CA3_3_10I1R1Terms_sound) (by decide +kernel) +def CA3_3_10I1R1Mass : Ball := ⟨(9865746198332335830606504810919 / 25000000000000000000000000000000), (51 / 50000000000000000000000000000000)⟩ +lemma CA3_3_10I1R1Mass_sound : CA3_3_10I1R1Mass.Encloses (∑ a, CA3_3_10I1R1Value a) := by + exact contains_sound (pairSumBall_sound CA3_3_10I1R1P CA3_3_10I1R1Value CA3_3_10I1R1P_sound) (by decide +kernel) +def CA3_3_10I1R1MassTermLogWitness : LogWitness := ⟨-2, 9865746198332335830606504810919, 6250000000000000000000000000000⟩ +def CA3_3_10I1R1MassTermLog : Ball := ⟨(-9298070472677052150123757388541 / 10000000000000000000000000000000), (63527471307 / 100000000000000000000000000000000)⟩ +lemma CA3_3_10I1R1MassTermLog_sound : CA3_3_10I1R1MassTermLog.Encloses (Real.log ((∑ a, CA3_3_10I1R1Value a))) := by + exact checkLog_sound logTwoBall_sound (CA3_3_10I1R1Mass_sound) (w := CA3_3_10I1R1MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA3_3_10I1R1MassTerm : Ball := ⟨(17916485042507767989356665939 / 48828125000000000000000000000), (25069836437 / 100000000000000000000000000000000)⟩ +lemma CA3_3_10I1R1MassTerm_sound : CA3_3_10I1R1MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA3_3_10I1R1Value a))) := by + exact contains_sound (entropyTerm_ball (CA3_3_10I1R1Mass_sound) CA3_3_10I1R1MassTermLog_sound) (by decide +kernel) +def CA3_3_10I1R1H : Ball := ⟨(13676828322988115182909871805783 / 50000000000000000000000000000000), (2339851401 / 4000000000000000000000000000000)⟩ +lemma CA3_3_10I1R1H_sound : CA3_3_10I1R1H.Encloses (homogeneousEntropy CA3_3_10I1R1Value) := by + exact contains_sound (homogeneous_enclosed CA3_3_10I1R1Value CA3_3_10I1R1MassTerm_sound CA3_3_10I1R1Entropy_sound) (by decide +kernel) +def CA3_3_10I1R2Value (a : PairSlot) : ℝ := residualLaw (below (shape 3 3 10)) (fun u => (stageALaw (shape 3 3 10) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 2 a +def CA3_3_10I1R2Raw (a : PairSlot) : Ball := residualBall (below (shape 3 3 10)) A3_3_10Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 2 a +lemma CA3_3_10I1R2Raw_sound (a : PairSlot) : + (CA3_3_10I1R2Raw a).Encloses (CA3_3_10I1R2Value a) := by + exact residualBall_sound_on (below (shape 3 3 10)) A3_3_10Law (fun u => (stageALaw (shape 3 3 10) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A3_3_10Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 3 3 10) (show (shape 3 3 10) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 2 a +def CA3_3_10I1R2Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(522296892672814704126252563 / 7812500000000000000000000000), (3 / 10000000000000000000000000000000)⟩ ⟨(1808563957114757977164683124919 / 10000000000000000000000000000000), (3539221467 / 50000000000000000000000000000000)⟩ ⟨(-10820976431740104289882054829413 / 4000000000000000000000000000000), (105879118863 / 100000000000000000000000000000000)⟩ ⟨-4, 522296892672814704126252563, 488281250000000000000000000⟩, + .log ⟨(338340295906074792254685351483 / 50000000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ ⟨(676102179152320123866190477321 / 20000000000000000000000000000000), (644817113 / 50000000000000000000000000000000)⟩ ⟨(-249786305139075855408591548291843 / 50000000000000000000000000000000), (95291206869 / 50000000000000000000000000000000)⟩ ⟨-8, 338340295906074792254685351483, 195312500000000000000000000000⟩, + .log ⟨(4947764631456197545555042444989 / 20000000000000000000000000000000), (13 / 20000000000000000000000000000000)⟩ ⟨(8638774710924475024149402842617 / 25000000000000000000000000000000), (1309662403 / 6250000000000000000000000000000)⟩ ⟨(-6983981942877473282955801825741 / 5000000000000000000000000000000), (42351647497 / 50000000000000000000000000000000)⟩ ⟨-3, 4947764631456197545555042444989, 2500000000000000000000000000000⟩] +lemma CA3_3_10I1R2Certificates_valid : + CA3_3_10I1R2Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA3_3_10I1R2CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 2, 0 => 1 + | 3, 0 => 2 + | 1, 1 => 3 + | 0, 2 => 1 + | 0, 3 => 2 + | _, _ => 0 +def CA3_3_10I1R2P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_3_10I1R2Certificates (CA3_3_10I1R2CertificateIndex a)).input +lemma CA3_3_10I1R2P_check : ∀ a : PairSlot, contains (CA3_3_10I1R2Raw a) (CA3_3_10I1R2P a) = true := by + decide +kernel +lemma CA3_3_10I1R2P_sound (a : PairSlot) : + (CA3_3_10I1R2P a).Encloses (CA3_3_10I1R2Value a) := + contains_sound (CA3_3_10I1R2Raw_sound a) (CA3_3_10I1R2P_check a) +def CA3_3_10I1R2Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_3_10I1R2Certificates (CA3_3_10I1R2CertificateIndex a)).output +lemma CA3_3_10I1R2Terms_sound (a : PairSlot) : + (CA3_3_10I1R2Terms a).Encloses (Foundation.entropyTerm (CA3_3_10I1R2Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA3_3_10I1R2Certificates_valid + (CA3_3_10I1R2CertificateIndex a) (CA3_3_10I1R2P_sound a) +def CA3_3_10I1R2Entropy : Ball := ⟨(38743699888758130439276589321029 / 50000000000000000000000000000000), (147229503 / 390625000000000000000000000000)⟩ +lemma CA3_3_10I1R2Entropy_sound : CA3_3_10I1R2Entropy.Encloses (Foundation.finiteEntropy CA3_3_10I1R2Value) := by + exact contains_sound (entropyPair_enclosed CA3_3_10I1R2Value CA3_3_10I1R2Terms CA3_3_10I1R2Terms_sound) (by decide +kernel) +def CA3_3_10I1R2Mass : Ball := ⟨(39462984793329343322426019243677 / 100000000000000000000000000000000), (133 / 100000000000000000000000000000000)⟩ +lemma CA3_3_10I1R2Mass_sound : CA3_3_10I1R2Mass.Encloses (∑ a, CA3_3_10I1R2Value a) := by + exact contains_sound (pairSumBall_sound CA3_3_10I1R2P CA3_3_10I1R2Value CA3_3_10I1R2P_sound) (by decide +kernel) +def CA3_3_10I1R2MassTermLogWitness : LogWitness := ⟨-2, 39462984793329343322426019243677, 25000000000000000000000000000000⟩ +def CA3_3_10I1R2MassTermLog : Ball := ⟨(-92980704726770521501237573885407 / 100000000000000000000000000000000), (31763735693 / 50000000000000000000000000000000)⟩ +lemma CA3_3_10I1R2MassTermLog_sound : CA3_3_10I1R2MassTermLog.Encloses (Real.log ((∑ a, CA3_3_10I1R2Value a))) := by + exact checkLog_sound logTwoBall_sound (CA3_3_10I1R2Mass_sound) (w := CA3_3_10I1R2MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA3_3_10I1R2MassTerm : Ball := ⟨(17916485042507767989356665939 / 48828125000000000000000000000), (25069836497 / 100000000000000000000000000000000)⟩ +lemma CA3_3_10I1R2MassTerm_sound : CA3_3_10I1R2MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA3_3_10I1R2Value a))) := by + exact contains_sound (entropyTerm_ball (CA3_3_10I1R2Mass_sound) CA3_3_10I1R2MassTermLog_sound) (by decide +kernel) +def CA3_3_10I1R2H : Ball := ⟨(20397219205230176018175363399493 / 50000000000000000000000000000000), (12552117853 / 20000000000000000000000000000000)⟩ +lemma CA3_3_10I1R2H_sound : CA3_3_10I1R2H.Encloses (homogeneousEntropy CA3_3_10I1R2Value) := by + exact contains_sound (homogeneous_enclosed CA3_3_10I1R2Value CA3_3_10I1R2MassTerm_sound CA3_3_10I1R2Entropy_sound) (by decide +kernel) +def CA3_3_10I1R3Value (a : PairSlot) : ℝ := residualLaw (below (shape 3 3 10)) (fun u => (stageALaw (shape 3 3 10) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 3 a +def CA3_3_10I1R3Raw (a : PairSlot) : Ball := residualBall (below (shape 3 3 10)) A3_3_10Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 3 a +lemma CA3_3_10I1R3Raw_sound (a : PairSlot) : + (CA3_3_10I1R3Raw a).Encloses (CA3_3_10I1R3Value a) := by + exact residualBall_sound_on (below (shape 3 3 10)) A3_3_10Law (fun u => (stageALaw (shape 3 3 10) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A3_3_10Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 3 3 10) (show (shape 3 3 10) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 3 a +def CA3_3_10I1R3Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(205890417481175314177510224919 / 100000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ ⟨(1273551935099509918164620566777 / 100000000000000000000000000000000), (435989933 / 100000000000000000000000000000000)⟩ ⟨(-618558139169323674081473370489413 / 100000000000000000000000000000000), (211758237801 / 100000000000000000000000000000000)⟩ ⟨-9, 205890417481175314177510224919, 195312500000000000000000000000⟩, + .log ⟨(4619054651167277020629531838693 / 100000000000000000000000000000000), (3 / 12500000000000000000000000000000)⟩ ⟨(14203501238427614750271209133991 / 100000000000000000000000000000000), (5868737311 / 100000000000000000000000000000000)⟩ ⟨(-307498012279163250732354083952271 / 100000000000000000000000000000000), (127054942617 / 100000000000000000000000000000000)⟩ ⟨-5, 4619054651167277020629531838693, 3125000000000000000000000000000⟩, + .log ⟨(8871250693737520079598966291 / 2000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ ⟨(1201630128356614022253786080439 / 50000000000000000000000000000000), (422676101 / 50000000000000000000000000000000)⟩ ⟨(-541808667048437937517112002272391 / 100000000000000000000000000000000), (95291206911 / 50000000000000000000000000000000)⟩ ⟨-8, 8871250693737520079598966291, 7812500000000000000000000000⟩] +lemma CA3_3_10I1R3Certificates_valid : + CA3_3_10I1R3Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA3_3_10I1R3CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 4, 0 => 1 + | 2, 1 => 2 + | 3, 1 => 3 + | 1, 2 => 2 + | 1, 3 => 3 + | 0, 4 => 1 + | _, _ => 0 +def CA3_3_10I1R3P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_3_10I1R3Certificates (CA3_3_10I1R3CertificateIndex a)).input +lemma CA3_3_10I1R3P_check : ∀ a : PairSlot, contains (CA3_3_10I1R3Raw a) (CA3_3_10I1R3P a) = true := by + decide +kernel +lemma CA3_3_10I1R3P_sound (a : PairSlot) : + (CA3_3_10I1R3P a).Encloses (CA3_3_10I1R3Value a) := + contains_sound (CA3_3_10I1R3Raw_sound a) (CA3_3_10I1R3P_check a) +def CA3_3_10I1R3Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_3_10I1R3Certificates (CA3_3_10I1R3CertificateIndex a)).output +lemma CA3_3_10I1R3Terms_sound (a : PairSlot) : + (CA3_3_10I1R3Terms a).Encloses (Foundation.entropyTerm (CA3_3_10I1R3Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA3_3_10I1R3Certificates_valid + (CA3_3_10I1R3CertificateIndex a) (CA3_3_10I1R3P_sound a) +def CA3_3_10I1R3Entropy : Ball := ⟨(8940156715120176356471700930823 / 25000000000000000000000000000000), (3575039723 / 25000000000000000000000000000000)⟩ +lemma CA3_3_10I1R3Entropy_sound : CA3_3_10I1R3Entropy.Encloses (Foundation.finiteEntropy CA3_3_10I1R3Value) := by + exact contains_sound (entropyPair_enclosed CA3_3_10I1R3Value CA3_3_10I1R3Terms CA3_3_10I1R3Terms_sound) (by decide +kernel) +def CA3_3_10I1R3Mass : Ball := ⟨(2634253801667664169393495189081 / 25000000000000000000000000000000), (29 / 50000000000000000000000000000000)⟩ +lemma CA3_3_10I1R3Mass_sound : CA3_3_10I1R3Mass.Encloses (∑ a, CA3_3_10I1R3Value a) := by + exact contains_sound (pairSumBall_sound CA3_3_10I1R3P CA3_3_10I1R3Value CA3_3_10I1R3P_sound) (by decide +kernel) +def CA3_3_10I1R3MassTermLogWitness : LogWitness := ⟨-4, 2634253801667664169393495189081, 1562500000000000000000000000000⟩ +def CA3_3_10I1R3MassTermLog : Ball := ⟨(-14064224188767788938283650303749 / 6250000000000000000000000000000), (21175823793 / 20000000000000000000000000000000)⟩ +lemma CA3_3_10I1R3MassTermLog_sound : CA3_3_10I1R3MassTermLog.Encloses (Real.log ((∑ a, CA3_3_10I1R3Value a))) := by + exact checkLog_sound logTwoBall_sound (CA3_3_10I1R3Mass_sound) (w := CA3_3_10I1R3MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA3_3_10I1R3MassTerm : Ball := ⟨(23711191063531435570046086221241 / 100000000000000000000000000000000), (11156498997 / 100000000000000000000000000000000)⟩ +lemma CA3_3_10I1R3MassTerm_sound : CA3_3_10I1R3MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA3_3_10I1R3Value a))) := by + exact contains_sound (entropyTerm_ball (CA3_3_10I1R3Mass_sound) CA3_3_10I1R3MassTermLog_sound) (by decide +kernel) +def CA3_3_10I1R3H : Ball := ⟨(12049435796949269855840717502051 / 100000000000000000000000000000000), (25456657889 / 100000000000000000000000000000000)⟩ +lemma CA3_3_10I1R3H_sound : CA3_3_10I1R3H.Encloses (homogeneousEntropy CA3_3_10I1R3Value) := by + exact contains_sound (homogeneous_enclosed CA3_3_10I1R3Value CA3_3_10I1R3MassTerm_sound CA3_3_10I1R3Entropy_sound) (by decide +kernel) +def CA3_3_10I1R4Value (a : PairSlot) : ℝ := residualLaw (below (shape 3 3 10)) (fun u => (stageALaw (shape 3 3 10) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 4 a +def CA3_3_10I1R4Raw (a : PairSlot) : Ball := residualBall (below (shape 3 3 10)) A3_3_10Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 4 a +lemma CA3_3_10I1R4Raw_sound (a : PairSlot) : + (CA3_3_10I1R4Raw a).Encloses (CA3_3_10I1R4Value a) := by + exact residualBall_sound_on (below (shape 3 3 10)) A3_3_10Law (fun u => (stageALaw (shape 3 3 10) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A3_3_10Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 3 3 10) (show (shape 3 3 10) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 4 a +def CA3_3_10I1R4Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA3_3_10I1R4Certificates_valid : + CA3_3_10I1R4Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA3_3_10I1R4CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA3_3_10I1R4P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_3_10I1R4Certificates (CA3_3_10I1R4CertificateIndex a)).input +lemma CA3_3_10I1R4P_check : ∀ a : PairSlot, contains (CA3_3_10I1R4Raw a) (CA3_3_10I1R4P a) = true := by + decide +kernel +lemma CA3_3_10I1R4P_sound (a : PairSlot) : + (CA3_3_10I1R4P a).Encloses (CA3_3_10I1R4Value a) := + contains_sound (CA3_3_10I1R4Raw_sound a) (CA3_3_10I1R4P_check a) +def CA3_3_10I1R4Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_3_10I1R4Certificates (CA3_3_10I1R4CertificateIndex a)).output +lemma CA3_3_10I1R4Terms_sound (a : PairSlot) : + (CA3_3_10I1R4Terms a).Encloses (Foundation.entropyTerm (CA3_3_10I1R4Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA3_3_10I1R4Certificates_valid + (CA3_3_10I1R4CertificateIndex a) (CA3_3_10I1R4P_sound a) +def CA3_3_10I1R4Entropy : Ball := ⟨0, 0⟩ +lemma CA3_3_10I1R4Entropy_sound : CA3_3_10I1R4Entropy.Encloses (Foundation.finiteEntropy CA3_3_10I1R4Value) := by + exact contains_sound (entropyPair_enclosed CA3_3_10I1R4Value CA3_3_10I1R4Terms CA3_3_10I1R4Terms_sound) (by decide +kernel) +def CA3_3_10I1R4Mass : Ball := ⟨0, 0⟩ +lemma CA3_3_10I1R4Mass_sound : CA3_3_10I1R4Mass.Encloses (∑ a, CA3_3_10I1R4Value a) := by + exact contains_sound (pairSumBall_sound CA3_3_10I1R4P CA3_3_10I1R4Value CA3_3_10I1R4P_sound) (by decide +kernel) +def CA3_3_10I1R4MassTerm : Ball := .exact 0 +lemma CA3_3_10I1R4MassTerm_sound : CA3_3_10I1R4MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA3_3_10I1R4Value a))) := + entropyTerm_zero_ball (CA3_3_10I1R4Mass_sound) +def CA3_3_10I1R4H : Ball := ⟨0, 0⟩ +lemma CA3_3_10I1R4H_sound : CA3_3_10I1R4H.Encloses (homogeneousEntropy CA3_3_10I1R4Value) := by + exact contains_sound (homogeneous_enclosed CA3_3_10I1R4Value CA3_3_10I1R4MassTerm_sound CA3_3_10I1R4Entropy_sound) (by decide +kernel) +def CA3_3_10I1R5Value (a : PairSlot) : ℝ := residualLaw (below (shape 3 3 10)) (fun u => (stageALaw (shape 3 3 10) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 5 a +def CA3_3_10I1R5Raw (a : PairSlot) : Ball := residualBall (below (shape 3 3 10)) A3_3_10Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 5 a +lemma CA3_3_10I1R5Raw_sound (a : PairSlot) : + (CA3_3_10I1R5Raw a).Encloses (CA3_3_10I1R5Value a) := by + exact residualBall_sound_on (below (shape 3 3 10)) A3_3_10Law (fun u => (stageALaw (shape 3 3 10) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A3_3_10Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 3 3 10) (show (shape 3 3 10) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 5 a +def CA3_3_10I1R5Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA3_3_10I1R5Certificates_valid : + CA3_3_10I1R5Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA3_3_10I1R5CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA3_3_10I1R5P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_3_10I1R5Certificates (CA3_3_10I1R5CertificateIndex a)).input +lemma CA3_3_10I1R5P_check : ∀ a : PairSlot, contains (CA3_3_10I1R5Raw a) (CA3_3_10I1R5P a) = true := by + decide +kernel +lemma CA3_3_10I1R5P_sound (a : PairSlot) : + (CA3_3_10I1R5P a).Encloses (CA3_3_10I1R5Value a) := + contains_sound (CA3_3_10I1R5Raw_sound a) (CA3_3_10I1R5P_check a) +def CA3_3_10I1R5Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_3_10I1R5Certificates (CA3_3_10I1R5CertificateIndex a)).output +lemma CA3_3_10I1R5Terms_sound (a : PairSlot) : + (CA3_3_10I1R5Terms a).Encloses (Foundation.entropyTerm (CA3_3_10I1R5Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA3_3_10I1R5Certificates_valid + (CA3_3_10I1R5CertificateIndex a) (CA3_3_10I1R5P_sound a) +def CA3_3_10I1R5Entropy : Ball := ⟨0, 0⟩ +lemma CA3_3_10I1R5Entropy_sound : CA3_3_10I1R5Entropy.Encloses (Foundation.finiteEntropy CA3_3_10I1R5Value) := by + exact contains_sound (entropyPair_enclosed CA3_3_10I1R5Value CA3_3_10I1R5Terms CA3_3_10I1R5Terms_sound) (by decide +kernel) +def CA3_3_10I1R5Mass : Ball := ⟨0, 0⟩ +lemma CA3_3_10I1R5Mass_sound : CA3_3_10I1R5Mass.Encloses (∑ a, CA3_3_10I1R5Value a) := by + exact contains_sound (pairSumBall_sound CA3_3_10I1R5P CA3_3_10I1R5Value CA3_3_10I1R5P_sound) (by decide +kernel) +def CA3_3_10I1R5MassTerm : Ball := .exact 0 +lemma CA3_3_10I1R5MassTerm_sound : CA3_3_10I1R5MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA3_3_10I1R5Value a))) := + entropyTerm_zero_ball (CA3_3_10I1R5Mass_sound) +def CA3_3_10I1R5H : Ball := ⟨0, 0⟩ +lemma CA3_3_10I1R5H_sound : CA3_3_10I1R5H.Encloses (homogeneousEntropy CA3_3_10I1R5Value) := by + exact contains_sound (homogeneous_enclosed CA3_3_10I1R5Value CA3_3_10I1R5MassTerm_sound CA3_3_10I1R5Entropy_sound) (by decide +kernel) +def CA3_3_10I1R6Value (a : PairSlot) : ℝ := residualLaw (below (shape 3 3 10)) (fun u => (stageALaw (shape 3 3 10) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 6 a +def CA3_3_10I1R6Raw (a : PairSlot) : Ball := residualBall (below (shape 3 3 10)) A3_3_10Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 6 a +lemma CA3_3_10I1R6Raw_sound (a : PairSlot) : + (CA3_3_10I1R6Raw a).Encloses (CA3_3_10I1R6Value a) := by + exact residualBall_sound_on (below (shape 3 3 10)) A3_3_10Law (fun u => (stageALaw (shape 3 3 10) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A3_3_10Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 3 3 10) (show (shape 3 3 10) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 6 a +def CA3_3_10I1R6Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA3_3_10I1R6Certificates_valid : + CA3_3_10I1R6Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA3_3_10I1R6CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA3_3_10I1R6P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_3_10I1R6Certificates (CA3_3_10I1R6CertificateIndex a)).input +lemma CA3_3_10I1R6P_check : ∀ a : PairSlot, contains (CA3_3_10I1R6Raw a) (CA3_3_10I1R6P a) = true := by + decide +kernel +lemma CA3_3_10I1R6P_sound (a : PairSlot) : + (CA3_3_10I1R6P a).Encloses (CA3_3_10I1R6Value a) := + contains_sound (CA3_3_10I1R6Raw_sound a) (CA3_3_10I1R6P_check a) +def CA3_3_10I1R6Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_3_10I1R6Certificates (CA3_3_10I1R6CertificateIndex a)).output +lemma CA3_3_10I1R6Terms_sound (a : PairSlot) : + (CA3_3_10I1R6Terms a).Encloses (Foundation.entropyTerm (CA3_3_10I1R6Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA3_3_10I1R6Certificates_valid + (CA3_3_10I1R6CertificateIndex a) (CA3_3_10I1R6P_sound a) +def CA3_3_10I1R6Entropy : Ball := ⟨0, 0⟩ +lemma CA3_3_10I1R6Entropy_sound : CA3_3_10I1R6Entropy.Encloses (Foundation.finiteEntropy CA3_3_10I1R6Value) := by + exact contains_sound (entropyPair_enclosed CA3_3_10I1R6Value CA3_3_10I1R6Terms CA3_3_10I1R6Terms_sound) (by decide +kernel) +def CA3_3_10I1R6Mass : Ball := ⟨0, 0⟩ +lemma CA3_3_10I1R6Mass_sound : CA3_3_10I1R6Mass.Encloses (∑ a, CA3_3_10I1R6Value a) := by + exact contains_sound (pairSumBall_sound CA3_3_10I1R6P CA3_3_10I1R6Value CA3_3_10I1R6P_sound) (by decide +kernel) +def CA3_3_10I1R6MassTerm : Ball := .exact 0 +lemma CA3_3_10I1R6MassTerm_sound : CA3_3_10I1R6MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA3_3_10I1R6Value a))) := + entropyTerm_zero_ball (CA3_3_10I1R6Mass_sound) +def CA3_3_10I1R6H : Ball := ⟨0, 0⟩ +lemma CA3_3_10I1R6H_sound : CA3_3_10I1R6H.Encloses (homogeneousEntropy CA3_3_10I1R6Value) := by + exact contains_sound (homogeneous_enclosed CA3_3_10I1R6Value CA3_3_10I1R6MassTerm_sound CA3_3_10I1R6Entropy_sound) (by decide +kernel) +def CA3_3_10I1R7Value (a : PairSlot) : ℝ := residualLaw (below (shape 3 3 10)) (fun u => (stageALaw (shape 3 3 10) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 7 a +def CA3_3_10I1R7Raw (a : PairSlot) : Ball := residualBall (below (shape 3 3 10)) A3_3_10Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 7 a +lemma CA3_3_10I1R7Raw_sound (a : PairSlot) : + (CA3_3_10I1R7Raw a).Encloses (CA3_3_10I1R7Value a) := by + exact residualBall_sound_on (below (shape 3 3 10)) A3_3_10Law (fun u => (stageALaw (shape 3 3 10) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A3_3_10Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 3 3 10) (show (shape 3 3 10) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 7 a +def CA3_3_10I1R7Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA3_3_10I1R7Certificates_valid : + CA3_3_10I1R7Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA3_3_10I1R7CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA3_3_10I1R7P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_3_10I1R7Certificates (CA3_3_10I1R7CertificateIndex a)).input +lemma CA3_3_10I1R7P_check : ∀ a : PairSlot, contains (CA3_3_10I1R7Raw a) (CA3_3_10I1R7P a) = true := by + decide +kernel +lemma CA3_3_10I1R7P_sound (a : PairSlot) : + (CA3_3_10I1R7P a).Encloses (CA3_3_10I1R7Value a) := + contains_sound (CA3_3_10I1R7Raw_sound a) (CA3_3_10I1R7P_check a) +def CA3_3_10I1R7Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_3_10I1R7Certificates (CA3_3_10I1R7CertificateIndex a)).output +lemma CA3_3_10I1R7Terms_sound (a : PairSlot) : + (CA3_3_10I1R7Terms a).Encloses (Foundation.entropyTerm (CA3_3_10I1R7Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA3_3_10I1R7Certificates_valid + (CA3_3_10I1R7CertificateIndex a) (CA3_3_10I1R7P_sound a) +def CA3_3_10I1R7Entropy : Ball := ⟨0, 0⟩ +lemma CA3_3_10I1R7Entropy_sound : CA3_3_10I1R7Entropy.Encloses (Foundation.finiteEntropy CA3_3_10I1R7Value) := by + exact contains_sound (entropyPair_enclosed CA3_3_10I1R7Value CA3_3_10I1R7Terms CA3_3_10I1R7Terms_sound) (by decide +kernel) +def CA3_3_10I1R7Mass : Ball := ⟨0, 0⟩ +lemma CA3_3_10I1R7Mass_sound : CA3_3_10I1R7Mass.Encloses (∑ a, CA3_3_10I1R7Value a) := by + exact contains_sound (pairSumBall_sound CA3_3_10I1R7P CA3_3_10I1R7Value CA3_3_10I1R7P_sound) (by decide +kernel) +def CA3_3_10I1R7MassTerm : Ball := .exact 0 +lemma CA3_3_10I1R7MassTerm_sound : CA3_3_10I1R7MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA3_3_10I1R7Value a))) := + entropyTerm_zero_ball (CA3_3_10I1R7Mass_sound) +def CA3_3_10I1R7H : Ball := ⟨0, 0⟩ +lemma CA3_3_10I1R7H_sound : CA3_3_10I1R7H.Encloses (homogeneousEntropy CA3_3_10I1R7Value) := by + exact contains_sound (homogeneous_enclosed CA3_3_10I1R7Value CA3_3_10I1R7MassTerm_sound CA3_3_10I1R7Entropy_sound) (by decide +kernel) +def CA3_3_10I1R8Value (a : PairSlot) : ℝ := residualLaw (below (shape 3 3 10)) (fun u => (stageALaw (shape 3 3 10) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 8 a +def CA3_3_10I1R8Raw (a : PairSlot) : Ball := residualBall (below (shape 3 3 10)) A3_3_10Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 8 a +lemma CA3_3_10I1R8Raw_sound (a : PairSlot) : + (CA3_3_10I1R8Raw a).Encloses (CA3_3_10I1R8Value a) := by + exact residualBall_sound_on (below (shape 3 3 10)) A3_3_10Law (fun u => (stageALaw (shape 3 3 10) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A3_3_10Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 3 3 10) (show (shape 3 3 10) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 8 a +def CA3_3_10I1R8Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA3_3_10I1R8Certificates_valid : + CA3_3_10I1R8Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA3_3_10I1R8CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA3_3_10I1R8P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_3_10I1R8Certificates (CA3_3_10I1R8CertificateIndex a)).input +lemma CA3_3_10I1R8P_check : ∀ a : PairSlot, contains (CA3_3_10I1R8Raw a) (CA3_3_10I1R8P a) = true := by + decide +kernel +lemma CA3_3_10I1R8P_sound (a : PairSlot) : + (CA3_3_10I1R8P a).Encloses (CA3_3_10I1R8Value a) := + contains_sound (CA3_3_10I1R8Raw_sound a) (CA3_3_10I1R8P_check a) +def CA3_3_10I1R8Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_3_10I1R8Certificates (CA3_3_10I1R8CertificateIndex a)).output +lemma CA3_3_10I1R8Terms_sound (a : PairSlot) : + (CA3_3_10I1R8Terms a).Encloses (Foundation.entropyTerm (CA3_3_10I1R8Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA3_3_10I1R8Certificates_valid + (CA3_3_10I1R8CertificateIndex a) (CA3_3_10I1R8P_sound a) +def CA3_3_10I1R8Entropy : Ball := ⟨0, 0⟩ +lemma CA3_3_10I1R8Entropy_sound : CA3_3_10I1R8Entropy.Encloses (Foundation.finiteEntropy CA3_3_10I1R8Value) := by + exact contains_sound (entropyPair_enclosed CA3_3_10I1R8Value CA3_3_10I1R8Terms CA3_3_10I1R8Terms_sound) (by decide +kernel) +def CA3_3_10I1R8Mass : Ball := ⟨0, 0⟩ +lemma CA3_3_10I1R8Mass_sound : CA3_3_10I1R8Mass.Encloses (∑ a, CA3_3_10I1R8Value a) := by + exact contains_sound (pairSumBall_sound CA3_3_10I1R8P CA3_3_10I1R8Value CA3_3_10I1R8P_sound) (by decide +kernel) +def CA3_3_10I1R8MassTerm : Ball := .exact 0 +lemma CA3_3_10I1R8MassTerm_sound : CA3_3_10I1R8MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA3_3_10I1R8Value a))) := + entropyTerm_zero_ball (CA3_3_10I1R8Mass_sound) +def CA3_3_10I1R8H : Ball := ⟨0, 0⟩ +lemma CA3_3_10I1R8H_sound : CA3_3_10I1R8H.Encloses (homogeneousEntropy CA3_3_10I1R8Value) := by + exact contains_sound (homogeneous_enclosed CA3_3_10I1R8Value CA3_3_10I1R8MassTerm_sound CA3_3_10I1R8Entropy_sound) (by decide +kernel) +def CA3_3_10I1R9Value (a : PairSlot) : ℝ := residualLaw (below (shape 3 3 10)) (fun u => (stageALaw (shape 3 3 10) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 9 a +def CA3_3_10I1R9Raw (a : PairSlot) : Ball := residualBall (below (shape 3 3 10)) A3_3_10Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 9 a +lemma CA3_3_10I1R9Raw_sound (a : PairSlot) : + (CA3_3_10I1R9Raw a).Encloses (CA3_3_10I1R9Value a) := by + exact residualBall_sound_on (below (shape 3 3 10)) A3_3_10Law (fun u => (stageALaw (shape 3 3 10) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A3_3_10Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 3 3 10) (show (shape 3 3 10) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 9 a +def CA3_3_10I1R9Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA3_3_10I1R9Certificates_valid : + CA3_3_10I1R9Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA3_3_10I1R9CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA3_3_10I1R9P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_3_10I1R9Certificates (CA3_3_10I1R9CertificateIndex a)).input +lemma CA3_3_10I1R9P_check : ∀ a : PairSlot, contains (CA3_3_10I1R9Raw a) (CA3_3_10I1R9P a) = true := by + decide +kernel +lemma CA3_3_10I1R9P_sound (a : PairSlot) : + (CA3_3_10I1R9P a).Encloses (CA3_3_10I1R9Value a) := + contains_sound (CA3_3_10I1R9Raw_sound a) (CA3_3_10I1R9P_check a) +def CA3_3_10I1R9Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_3_10I1R9Certificates (CA3_3_10I1R9CertificateIndex a)).output +lemma CA3_3_10I1R9Terms_sound (a : PairSlot) : + (CA3_3_10I1R9Terms a).Encloses (Foundation.entropyTerm (CA3_3_10I1R9Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA3_3_10I1R9Certificates_valid + (CA3_3_10I1R9CertificateIndex a) (CA3_3_10I1R9P_sound a) +def CA3_3_10I1R9Entropy : Ball := ⟨0, 0⟩ +lemma CA3_3_10I1R9Entropy_sound : CA3_3_10I1R9Entropy.Encloses (Foundation.finiteEntropy CA3_3_10I1R9Value) := by + exact contains_sound (entropyPair_enclosed CA3_3_10I1R9Value CA3_3_10I1R9Terms CA3_3_10I1R9Terms_sound) (by decide +kernel) +def CA3_3_10I1R9Mass : Ball := ⟨0, 0⟩ +lemma CA3_3_10I1R9Mass_sound : CA3_3_10I1R9Mass.Encloses (∑ a, CA3_3_10I1R9Value a) := by + exact contains_sound (pairSumBall_sound CA3_3_10I1R9P CA3_3_10I1R9Value CA3_3_10I1R9P_sound) (by decide +kernel) +def CA3_3_10I1R9MassTerm : Ball := .exact 0 +lemma CA3_3_10I1R9MassTerm_sound : CA3_3_10I1R9MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA3_3_10I1R9Value a))) := + entropyTerm_zero_ball (CA3_3_10I1R9Mass_sound) +def CA3_3_10I1R9H : Ball := ⟨0, 0⟩ +lemma CA3_3_10I1R9H_sound : CA3_3_10I1R9H.Encloses (homogeneousEntropy CA3_3_10I1R9Value) := by + exact contains_sound (homogeneous_enclosed CA3_3_10I1R9Value CA3_3_10I1R9MassTerm_sound CA3_3_10I1R9Entropy_sound) (by decide +kernel) +def CA3_3_10I1R10Value (a : PairSlot) : ℝ := residualLaw (below (shape 3 3 10)) (fun u => (stageALaw (shape 3 3 10) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 10 a +def CA3_3_10I1R10Raw (a : PairSlot) : Ball := residualBall (below (shape 3 3 10)) A3_3_10Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 10 a +lemma CA3_3_10I1R10Raw_sound (a : PairSlot) : + (CA3_3_10I1R10Raw a).Encloses (CA3_3_10I1R10Value a) := by + exact residualBall_sound_on (below (shape 3 3 10)) A3_3_10Law (fun u => (stageALaw (shape 3 3 10) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A3_3_10Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 3 3 10) (show (shape 3 3 10) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 10 a +def CA3_3_10I1R10Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA3_3_10I1R10Certificates_valid : + CA3_3_10I1R10Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA3_3_10I1R10CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA3_3_10I1R10P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_3_10I1R10Certificates (CA3_3_10I1R10CertificateIndex a)).input +lemma CA3_3_10I1R10P_check : ∀ a : PairSlot, contains (CA3_3_10I1R10Raw a) (CA3_3_10I1R10P a) = true := by + decide +kernel +lemma CA3_3_10I1R10P_sound (a : PairSlot) : + (CA3_3_10I1R10P a).Encloses (CA3_3_10I1R10Value a) := + contains_sound (CA3_3_10I1R10Raw_sound a) (CA3_3_10I1R10P_check a) +def CA3_3_10I1R10Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_3_10I1R10Certificates (CA3_3_10I1R10CertificateIndex a)).output +lemma CA3_3_10I1R10Terms_sound (a : PairSlot) : + (CA3_3_10I1R10Terms a).Encloses (Foundation.entropyTerm (CA3_3_10I1R10Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA3_3_10I1R10Certificates_valid + (CA3_3_10I1R10CertificateIndex a) (CA3_3_10I1R10P_sound a) +def CA3_3_10I1R10Entropy : Ball := ⟨0, 0⟩ +lemma CA3_3_10I1R10Entropy_sound : CA3_3_10I1R10Entropy.Encloses (Foundation.finiteEntropy CA3_3_10I1R10Value) := by + exact contains_sound (entropyPair_enclosed CA3_3_10I1R10Value CA3_3_10I1R10Terms CA3_3_10I1R10Terms_sound) (by decide +kernel) +def CA3_3_10I1R10Mass : Ball := ⟨0, 0⟩ +lemma CA3_3_10I1R10Mass_sound : CA3_3_10I1R10Mass.Encloses (∑ a, CA3_3_10I1R10Value a) := by + exact contains_sound (pairSumBall_sound CA3_3_10I1R10P CA3_3_10I1R10Value CA3_3_10I1R10P_sound) (by decide +kernel) +def CA3_3_10I1R10MassTerm : Ball := .exact 0 +lemma CA3_3_10I1R10MassTerm_sound : CA3_3_10I1R10MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA3_3_10I1R10Value a))) := + entropyTerm_zero_ball (CA3_3_10I1R10Mass_sound) +def CA3_3_10I1R10H : Ball := ⟨0, 0⟩ +lemma CA3_3_10I1R10H_sound : CA3_3_10I1R10H.Encloses (homogeneousEntropy CA3_3_10I1R10Value) := by + exact contains_sound (homogeneous_enclosed CA3_3_10I1R10Value CA3_3_10I1R10MassTerm_sound CA3_3_10I1R10Entropy_sound) (by decide +kernel) +def CA3_3_10I1R11Value (a : PairSlot) : ℝ := residualLaw (below (shape 3 3 10)) (fun u => (stageALaw (shape 3 3 10) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 11 a +def CA3_3_10I1R11Raw (a : PairSlot) : Ball := residualBall (below (shape 3 3 10)) A3_3_10Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 11 a +lemma CA3_3_10I1R11Raw_sound (a : PairSlot) : + (CA3_3_10I1R11Raw a).Encloses (CA3_3_10I1R11Value a) := by + exact residualBall_sound_on (below (shape 3 3 10)) A3_3_10Law (fun u => (stageALaw (shape 3 3 10) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A3_3_10Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 3 3 10) (show (shape 3 3 10) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 11 a +def CA3_3_10I1R11Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA3_3_10I1R11Certificates_valid : + CA3_3_10I1R11Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA3_3_10I1R11CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA3_3_10I1R11P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_3_10I1R11Certificates (CA3_3_10I1R11CertificateIndex a)).input +lemma CA3_3_10I1R11P_check : ∀ a : PairSlot, contains (CA3_3_10I1R11Raw a) (CA3_3_10I1R11P a) = true := by + decide +kernel +lemma CA3_3_10I1R11P_sound (a : PairSlot) : + (CA3_3_10I1R11P a).Encloses (CA3_3_10I1R11Value a) := + contains_sound (CA3_3_10I1R11Raw_sound a) (CA3_3_10I1R11P_check a) +def CA3_3_10I1R11Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_3_10I1R11Certificates (CA3_3_10I1R11CertificateIndex a)).output +lemma CA3_3_10I1R11Terms_sound (a : PairSlot) : + (CA3_3_10I1R11Terms a).Encloses (Foundation.entropyTerm (CA3_3_10I1R11Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA3_3_10I1R11Certificates_valid + (CA3_3_10I1R11CertificateIndex a) (CA3_3_10I1R11P_sound a) +def CA3_3_10I1R11Entropy : Ball := ⟨0, 0⟩ +lemma CA3_3_10I1R11Entropy_sound : CA3_3_10I1R11Entropy.Encloses (Foundation.finiteEntropy CA3_3_10I1R11Value) := by + exact contains_sound (entropyPair_enclosed CA3_3_10I1R11Value CA3_3_10I1R11Terms CA3_3_10I1R11Terms_sound) (by decide +kernel) +def CA3_3_10I1R11Mass : Ball := ⟨0, 0⟩ +lemma CA3_3_10I1R11Mass_sound : CA3_3_10I1R11Mass.Encloses (∑ a, CA3_3_10I1R11Value a) := by + exact contains_sound (pairSumBall_sound CA3_3_10I1R11P CA3_3_10I1R11Value CA3_3_10I1R11P_sound) (by decide +kernel) +def CA3_3_10I1R11MassTerm : Ball := .exact 0 +lemma CA3_3_10I1R11MassTerm_sound : CA3_3_10I1R11MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA3_3_10I1R11Value a))) := + entropyTerm_zero_ball (CA3_3_10I1R11Mass_sound) +def CA3_3_10I1R11H : Ball := ⟨0, 0⟩ +lemma CA3_3_10I1R11H_sound : CA3_3_10I1R11H.Encloses (homogeneousEntropy CA3_3_10I1R11Value) := by + exact contains_sound (homogeneous_enclosed CA3_3_10I1R11Value CA3_3_10I1R11MassTerm_sound CA3_3_10I1R11Entropy_sound) (by decide +kernel) +def CA3_3_10I1R12Value (a : PairSlot) : ℝ := residualLaw (below (shape 3 3 10)) (fun u => (stageALaw (shape 3 3 10) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 12 a +def CA3_3_10I1R12Raw (a : PairSlot) : Ball := residualBall (below (shape 3 3 10)) A3_3_10Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 12 a +lemma CA3_3_10I1R12Raw_sound (a : PairSlot) : + (CA3_3_10I1R12Raw a).Encloses (CA3_3_10I1R12Value a) := by + exact residualBall_sound_on (below (shape 3 3 10)) A3_3_10Law (fun u => (stageALaw (shape 3 3 10) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A3_3_10Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 3 3 10) (show (shape 3 3 10) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 12 a +def CA3_3_10I1R12Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA3_3_10I1R12Certificates_valid : + CA3_3_10I1R12Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA3_3_10I1R12CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA3_3_10I1R12P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_3_10I1R12Certificates (CA3_3_10I1R12CertificateIndex a)).input +lemma CA3_3_10I1R12P_check : ∀ a : PairSlot, contains (CA3_3_10I1R12Raw a) (CA3_3_10I1R12P a) = true := by + decide +kernel +lemma CA3_3_10I1R12P_sound (a : PairSlot) : + (CA3_3_10I1R12P a).Encloses (CA3_3_10I1R12Value a) := + contains_sound (CA3_3_10I1R12Raw_sound a) (CA3_3_10I1R12P_check a) +def CA3_3_10I1R12Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_3_10I1R12Certificates (CA3_3_10I1R12CertificateIndex a)).output +lemma CA3_3_10I1R12Terms_sound (a : PairSlot) : + (CA3_3_10I1R12Terms a).Encloses (Foundation.entropyTerm (CA3_3_10I1R12Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA3_3_10I1R12Certificates_valid + (CA3_3_10I1R12CertificateIndex a) (CA3_3_10I1R12P_sound a) +def CA3_3_10I1R12Entropy : Ball := ⟨0, 0⟩ +lemma CA3_3_10I1R12Entropy_sound : CA3_3_10I1R12Entropy.Encloses (Foundation.finiteEntropy CA3_3_10I1R12Value) := by + exact contains_sound (entropyPair_enclosed CA3_3_10I1R12Value CA3_3_10I1R12Terms CA3_3_10I1R12Terms_sound) (by decide +kernel) +def CA3_3_10I1R12Mass : Ball := ⟨0, 0⟩ +lemma CA3_3_10I1R12Mass_sound : CA3_3_10I1R12Mass.Encloses (∑ a, CA3_3_10I1R12Value a) := by + exact contains_sound (pairSumBall_sound CA3_3_10I1R12P CA3_3_10I1R12Value CA3_3_10I1R12P_sound) (by decide +kernel) +def CA3_3_10I1R12MassTerm : Ball := .exact 0 +lemma CA3_3_10I1R12MassTerm_sound : CA3_3_10I1R12MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA3_3_10I1R12Value a))) := + entropyTerm_zero_ball (CA3_3_10I1R12Mass_sound) +def CA3_3_10I1R12H : Ball := ⟨0, 0⟩ +lemma CA3_3_10I1R12H_sound : CA3_3_10I1R12H.Encloses (homogeneousEntropy CA3_3_10I1R12Value) := by + exact contains_sound (homogeneous_enclosed CA3_3_10I1R12Value CA3_3_10I1R12MassTerm_sound CA3_3_10I1R12Entropy_sound) (by decide +kernel) +def CA3_3_10I1R13Value (a : PairSlot) : ℝ := residualLaw (below (shape 3 3 10)) (fun u => (stageALaw (shape 3 3 10) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 13 a +def CA3_3_10I1R13Raw (a : PairSlot) : Ball := residualBall (below (shape 3 3 10)) A3_3_10Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 13 a +lemma CA3_3_10I1R13Raw_sound (a : PairSlot) : + (CA3_3_10I1R13Raw a).Encloses (CA3_3_10I1R13Value a) := by + exact residualBall_sound_on (below (shape 3 3 10)) A3_3_10Law (fun u => (stageALaw (shape 3 3 10) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A3_3_10Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 3 3 10) (show (shape 3 3 10) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 13 a +def CA3_3_10I1R13Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA3_3_10I1R13Certificates_valid : + CA3_3_10I1R13Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA3_3_10I1R13CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA3_3_10I1R13P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_3_10I1R13Certificates (CA3_3_10I1R13CertificateIndex a)).input +lemma CA3_3_10I1R13P_check : ∀ a : PairSlot, contains (CA3_3_10I1R13Raw a) (CA3_3_10I1R13P a) = true := by + decide +kernel +lemma CA3_3_10I1R13P_sound (a : PairSlot) : + (CA3_3_10I1R13P a).Encloses (CA3_3_10I1R13Value a) := + contains_sound (CA3_3_10I1R13Raw_sound a) (CA3_3_10I1R13P_check a) +def CA3_3_10I1R13Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_3_10I1R13Certificates (CA3_3_10I1R13CertificateIndex a)).output +lemma CA3_3_10I1R13Terms_sound (a : PairSlot) : + (CA3_3_10I1R13Terms a).Encloses (Foundation.entropyTerm (CA3_3_10I1R13Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA3_3_10I1R13Certificates_valid + (CA3_3_10I1R13CertificateIndex a) (CA3_3_10I1R13P_sound a) +def CA3_3_10I1R13Entropy : Ball := ⟨0, 0⟩ +lemma CA3_3_10I1R13Entropy_sound : CA3_3_10I1R13Entropy.Encloses (Foundation.finiteEntropy CA3_3_10I1R13Value) := by + exact contains_sound (entropyPair_enclosed CA3_3_10I1R13Value CA3_3_10I1R13Terms CA3_3_10I1R13Terms_sound) (by decide +kernel) +def CA3_3_10I1R13Mass : Ball := ⟨0, 0⟩ +lemma CA3_3_10I1R13Mass_sound : CA3_3_10I1R13Mass.Encloses (∑ a, CA3_3_10I1R13Value a) := by + exact contains_sound (pairSumBall_sound CA3_3_10I1R13P CA3_3_10I1R13Value CA3_3_10I1R13P_sound) (by decide +kernel) +def CA3_3_10I1R13MassTerm : Ball := .exact 0 +lemma CA3_3_10I1R13MassTerm_sound : CA3_3_10I1R13MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA3_3_10I1R13Value a))) := + entropyTerm_zero_ball (CA3_3_10I1R13Mass_sound) +def CA3_3_10I1R13H : Ball := ⟨0, 0⟩ +lemma CA3_3_10I1R13H_sound : CA3_3_10I1R13H.Encloses (homogeneousEntropy CA3_3_10I1R13Value) := by + exact contains_sound (homogeneous_enclosed CA3_3_10I1R13Value CA3_3_10I1R13MassTerm_sound CA3_3_10I1R13Entropy_sound) (by decide +kernel) +def CA3_3_10I1R14Value (a : PairSlot) : ℝ := residualLaw (below (shape 3 3 10)) (fun u => (stageALaw (shape 3 3 10) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 14 a +def CA3_3_10I1R14Raw (a : PairSlot) : Ball := residualBall (below (shape 3 3 10)) A3_3_10Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 14 a +lemma CA3_3_10I1R14Raw_sound (a : PairSlot) : + (CA3_3_10I1R14Raw a).Encloses (CA3_3_10I1R14Value a) := by + exact residualBall_sound_on (below (shape 3 3 10)) A3_3_10Law (fun u => (stageALaw (shape 3 3 10) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A3_3_10Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 3 3 10) (show (shape 3 3 10) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 14 a +def CA3_3_10I1R14Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA3_3_10I1R14Certificates_valid : + CA3_3_10I1R14Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA3_3_10I1R14CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA3_3_10I1R14P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_3_10I1R14Certificates (CA3_3_10I1R14CertificateIndex a)).input +lemma CA3_3_10I1R14P_check : ∀ a : PairSlot, contains (CA3_3_10I1R14Raw a) (CA3_3_10I1R14P a) = true := by + decide +kernel +lemma CA3_3_10I1R14P_sound (a : PairSlot) : + (CA3_3_10I1R14P a).Encloses (CA3_3_10I1R14Value a) := + contains_sound (CA3_3_10I1R14Raw_sound a) (CA3_3_10I1R14P_check a) +def CA3_3_10I1R14Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_3_10I1R14Certificates (CA3_3_10I1R14CertificateIndex a)).output +lemma CA3_3_10I1R14Terms_sound (a : PairSlot) : + (CA3_3_10I1R14Terms a).Encloses (Foundation.entropyTerm (CA3_3_10I1R14Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA3_3_10I1R14Certificates_valid + (CA3_3_10I1R14CertificateIndex a) (CA3_3_10I1R14P_sound a) +def CA3_3_10I1R14Entropy : Ball := ⟨0, 0⟩ +lemma CA3_3_10I1R14Entropy_sound : CA3_3_10I1R14Entropy.Encloses (Foundation.finiteEntropy CA3_3_10I1R14Value) := by + exact contains_sound (entropyPair_enclosed CA3_3_10I1R14Value CA3_3_10I1R14Terms CA3_3_10I1R14Terms_sound) (by decide +kernel) +def CA3_3_10I1R14Mass : Ball := ⟨0, 0⟩ +lemma CA3_3_10I1R14Mass_sound : CA3_3_10I1R14Mass.Encloses (∑ a, CA3_3_10I1R14Value a) := by + exact contains_sound (pairSumBall_sound CA3_3_10I1R14P CA3_3_10I1R14Value CA3_3_10I1R14P_sound) (by decide +kernel) +def CA3_3_10I1R14MassTerm : Ball := .exact 0 +lemma CA3_3_10I1R14MassTerm_sound : CA3_3_10I1R14MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA3_3_10I1R14Value a))) := + entropyTerm_zero_ball (CA3_3_10I1R14Mass_sound) +def CA3_3_10I1R14H : Ball := ⟨0, 0⟩ +lemma CA3_3_10I1R14H_sound : CA3_3_10I1R14H.Encloses (homogeneousEntropy CA3_3_10I1R14Value) := by + exact contains_sound (homogeneous_enclosed CA3_3_10I1R14Value CA3_3_10I1R14MassTerm_sound CA3_3_10I1R14Entropy_sound) (by decide +kernel) +def CA3_3_10I1R15Value (a : PairSlot) : ℝ := residualLaw (below (shape 3 3 10)) (fun u => (stageALaw (shape 3 3 10) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 15 a +def CA3_3_10I1R15Raw (a : PairSlot) : Ball := residualBall (below (shape 3 3 10)) A3_3_10Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 15 a +lemma CA3_3_10I1R15Raw_sound (a : PairSlot) : + (CA3_3_10I1R15Raw a).Encloses (CA3_3_10I1R15Value a) := by + exact residualBall_sound_on (below (shape 3 3 10)) A3_3_10Law (fun u => (stageALaw (shape 3 3 10) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A3_3_10Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 3 3 10) (show (shape 3 3 10) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 15 a +def CA3_3_10I1R15Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA3_3_10I1R15Certificates_valid : + CA3_3_10I1R15Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA3_3_10I1R15CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA3_3_10I1R15P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_3_10I1R15Certificates (CA3_3_10I1R15CertificateIndex a)).input +lemma CA3_3_10I1R15P_check : ∀ a : PairSlot, contains (CA3_3_10I1R15Raw a) (CA3_3_10I1R15P a) = true := by + decide +kernel +lemma CA3_3_10I1R15P_sound (a : PairSlot) : + (CA3_3_10I1R15P a).Encloses (CA3_3_10I1R15Value a) := + contains_sound (CA3_3_10I1R15Raw_sound a) (CA3_3_10I1R15P_check a) +def CA3_3_10I1R15Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_3_10I1R15Certificates (CA3_3_10I1R15CertificateIndex a)).output +lemma CA3_3_10I1R15Terms_sound (a : PairSlot) : + (CA3_3_10I1R15Terms a).Encloses (Foundation.entropyTerm (CA3_3_10I1R15Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA3_3_10I1R15Certificates_valid + (CA3_3_10I1R15CertificateIndex a) (CA3_3_10I1R15P_sound a) +def CA3_3_10I1R15Entropy : Ball := ⟨0, 0⟩ +lemma CA3_3_10I1R15Entropy_sound : CA3_3_10I1R15Entropy.Encloses (Foundation.finiteEntropy CA3_3_10I1R15Value) := by + exact contains_sound (entropyPair_enclosed CA3_3_10I1R15Value CA3_3_10I1R15Terms CA3_3_10I1R15Terms_sound) (by decide +kernel) +def CA3_3_10I1R15Mass : Ball := ⟨0, 0⟩ +lemma CA3_3_10I1R15Mass_sound : CA3_3_10I1R15Mass.Encloses (∑ a, CA3_3_10I1R15Value a) := by + exact contains_sound (pairSumBall_sound CA3_3_10I1R15P CA3_3_10I1R15Value CA3_3_10I1R15P_sound) (by decide +kernel) +def CA3_3_10I1R15MassTerm : Ball := .exact 0 +lemma CA3_3_10I1R15MassTerm_sound : CA3_3_10I1R15MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA3_3_10I1R15Value a))) := + entropyTerm_zero_ball (CA3_3_10I1R15Mass_sound) +def CA3_3_10I1R15H : Ball := ⟨0, 0⟩ +lemma CA3_3_10I1R15H_sound : CA3_3_10I1R15H.Encloses (homogeneousEntropy CA3_3_10I1R15Value) := by + exact contains_sound (homogeneous_enclosed CA3_3_10I1R15Value CA3_3_10I1R15MassTerm_sound CA3_3_10I1R15Entropy_sound) (by decide +kernel) +def CA3_3_10I1R16Value (a : PairSlot) : ℝ := residualLaw (below (shape 3 3 10)) (fun u => (stageALaw (shape 3 3 10) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 16 a +def CA3_3_10I1R16Raw (a : PairSlot) : Ball := residualBall (below (shape 3 3 10)) A3_3_10Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 16 a +lemma CA3_3_10I1R16Raw_sound (a : PairSlot) : + (CA3_3_10I1R16Raw a).Encloses (CA3_3_10I1R16Value a) := by + exact residualBall_sound_on (below (shape 3 3 10)) A3_3_10Law (fun u => (stageALaw (shape 3 3 10) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A3_3_10Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 3 3 10) (show (shape 3 3 10) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 16 a +def CA3_3_10I1R16Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA3_3_10I1R16Certificates_valid : + CA3_3_10I1R16Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA3_3_10I1R16CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA3_3_10I1R16P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_3_10I1R16Certificates (CA3_3_10I1R16CertificateIndex a)).input +lemma CA3_3_10I1R16P_check : ∀ a : PairSlot, contains (CA3_3_10I1R16Raw a) (CA3_3_10I1R16P a) = true := by + decide +kernel +lemma CA3_3_10I1R16P_sound (a : PairSlot) : + (CA3_3_10I1R16P a).Encloses (CA3_3_10I1R16Value a) := + contains_sound (CA3_3_10I1R16Raw_sound a) (CA3_3_10I1R16P_check a) +def CA3_3_10I1R16Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_3_10I1R16Certificates (CA3_3_10I1R16CertificateIndex a)).output +lemma CA3_3_10I1R16Terms_sound (a : PairSlot) : + (CA3_3_10I1R16Terms a).Encloses (Foundation.entropyTerm (CA3_3_10I1R16Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA3_3_10I1R16Certificates_valid + (CA3_3_10I1R16CertificateIndex a) (CA3_3_10I1R16P_sound a) +def CA3_3_10I1R16Entropy : Ball := ⟨0, 0⟩ +lemma CA3_3_10I1R16Entropy_sound : CA3_3_10I1R16Entropy.Encloses (Foundation.finiteEntropy CA3_3_10I1R16Value) := by + exact contains_sound (entropyPair_enclosed CA3_3_10I1R16Value CA3_3_10I1R16Terms CA3_3_10I1R16Terms_sound) (by decide +kernel) +def CA3_3_10I1R16Mass : Ball := ⟨0, 0⟩ +lemma CA3_3_10I1R16Mass_sound : CA3_3_10I1R16Mass.Encloses (∑ a, CA3_3_10I1R16Value a) := by + exact contains_sound (pairSumBall_sound CA3_3_10I1R16P CA3_3_10I1R16Value CA3_3_10I1R16P_sound) (by decide +kernel) +def CA3_3_10I1R16MassTerm : Ball := .exact 0 +lemma CA3_3_10I1R16MassTerm_sound : CA3_3_10I1R16MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA3_3_10I1R16Value a))) := + entropyTerm_zero_ball (CA3_3_10I1R16Mass_sound) +def CA3_3_10I1R16H : Ball := ⟨0, 0⟩ +lemma CA3_3_10I1R16H_sound : CA3_3_10I1R16H.Encloses (homogeneousEntropy CA3_3_10I1R16Value) := by + exact contains_sound (homogeneous_enclosed CA3_3_10I1R16Value CA3_3_10I1R16MassTerm_sound CA3_3_10I1R16Entropy_sound) (by decide +kernel) +def CA3_3_10I1ResidualEntropies (a : Fin 17) : Ball := + match a.val with + | 0 => CA3_3_10I1R0H + | 1 => CA3_3_10I1R1H + | 2 => CA3_3_10I1R2H + | 3 => CA3_3_10I1R3H + | 4 => CA3_3_10I1R4H + | 5 => CA3_3_10I1R5H + | 6 => CA3_3_10I1R6H + | 7 => CA3_3_10I1R7H + | 8 => CA3_3_10I1R8H + | 9 => CA3_3_10I1R9H + | 10 => CA3_3_10I1R10H + | 11 => CA3_3_10I1R11H + | 12 => CA3_3_10I1R12H + | 13 => CA3_3_10I1R13H + | 14 => CA3_3_10I1R14H + | 15 => CA3_3_10I1R15H + | 16 => CA3_3_10I1R16H + | _ => (.exact 0) +lemma CA3_3_10I1ResidualEntropies_sound (k : Fin 17) : + (CA3_3_10I1ResidualEntropies k).Encloses (homogeneousEntropy + (residualLaw (below (shape 3 3 10)) (fun u => (stageALaw (shape 3 3 10) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) k)) := by + fin_cases k + · exact CA3_3_10I1R0H_sound + · exact CA3_3_10I1R1H_sound + · exact CA3_3_10I1R2H_sound + · exact CA3_3_10I1R3H_sound + · exact CA3_3_10I1R4H_sound + · exact CA3_3_10I1R5H_sound + · exact CA3_3_10I1R6H_sound + · exact CA3_3_10I1R7H_sound + · exact CA3_3_10I1R8H_sound + · exact CA3_3_10I1R9H_sound + · exact CA3_3_10I1R10H_sound + · exact CA3_3_10I1R11H_sound + · exact CA3_3_10I1R12H_sound + · exact CA3_3_10I1R13H_sound + · exact CA3_3_10I1R14H_sound + · exact CA3_3_10I1R15H_sound + · exact CA3_3_10I1R16H_sound +def CA3_3_10I1Singles (s : Shape) : Ball := + match s 0, s 1, s 2 with + | _, _, _ => (.exact 0) +lemma CA3_3_10I1Singles_sound (u : Shape) (hu : u ∈ below (shape 3 3 10)) + (hd : designated (Equiv.refl (Fin 3)) 1 u) : + (CA3_3_10I1Singles u).Encloses (homogeneousEntropy ((fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) u)) := by + rw [A3_3_10_below] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 0 0 8) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 0 1 7) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 0 2 6) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 0 3 5) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 1 0 7) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 1 1 6) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 1 2 5) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 1 3 4) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 2 0 6) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 2 1 5) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 2 2 4) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 2 3 3) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 3 0 5) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 3 1 4) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 3 2 3) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 3 3 2) by decide +kernel) hd |>.elim +def CA3_3_10I1Singleton : Ball := ⟨0, 0⟩ +lemma CA3_3_10I1Singleton_sound : CA3_3_10I1Singleton.Encloses + (singletonEntropy (below (shape 3 3 10)) (fun u => (stageALaw (shape 3 3 10) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ))) := by + exact contains_sound (singletonBall_sound (below (shape 3 3 10)) A3_3_10Law (fun u => (stageALaw (shape 3 3 10) u : ℝ)) (Equiv.refl (Fin 3)) 1 + CA3_3_10I1Singles (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A3_3_10Law_sound u) CA3_3_10I1Singles_sound) (by decide +kernel) +def CA3_3_10I1Group : Ball := ⟨(80197530853385852258011187912603 / 100000000000000000000000000000000), (169026530063 / 100000000000000000000000000000000)⟩ +lemma CA3_3_10I1Group_sound : CA3_3_10I1Group.Encloses + (groupedEntropy (below (shape 3 3 10)) (fun u => (stageALaw (shape 3 3 10) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ))) := by + exact contains_sound (Ball.add_sound CA3_3_10I1Singleton_sound + (finSumBall_sound 17 CA3_3_10I1ResidualEntropies _ CA3_3_10I1ResidualEntropies_sound)) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CA3_3_10I1H : Ball := ⟨(60404152430587344412248538064317 / 50000000000000000000000000000000), (95984786429 / 20000000000000000000000000000000)⟩ +lemma CA3_3_10I1_sound : CA3_3_10I1H.Encloses (stageACapacity (shape 3 3 10) 1) := by + have hb := contains_sound (Ball.add_sound CA3_3_10I1PairH_sound + (Ball.neg_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) CA3_3_10I1Group_sound))) + (show contains (.add CA3_3_10I1PairH (.neg (.mul (.exact 2) CA3_3_10I1Group))) CA3_3_10I1H = true by decide +kernel) + simp only [stageACapacity, nativeCapacity, + show (1 : Fin 3) ≠ 0 by decide, ite_false, sub_eq_add_neg] + exact hb + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA3_3_10I2.lean b/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA3_3_10I2.lean new file mode 100644 index 0000000000000000000000000000000000000000..1e5c520c5921daefdaf5c5913574fa2735f73b51 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA3_3_10I2.lean @@ -0,0 +1,840 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.CapacityA.CapA3_3_10I2Pair + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CA3_3_10I2R0Value (a : PairSlot) : ℝ := residualLaw (below (shape 3 3 10)) (fun u => (stageALaw (shape 3 3 10) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 0 a +def CA3_3_10I2R0Raw (a : PairSlot) : Ball := residualBall (below (shape 3 3 10)) A3_3_10Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 0 a +lemma CA3_3_10I2R0Raw_sound (a : PairSlot) : + (CA3_3_10I2R0Raw a).Encloses (CA3_3_10I2R0Value a) := by + exact residualBall_sound_on (below (shape 3 3 10)) A3_3_10Law (fun u => (stageALaw (shape 3 3 10) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A3_3_10Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 3 3 10) (show (shape 3 3 10) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 0 a +def CA3_3_10I2R0Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA3_3_10I2R0Certificates_valid : + CA3_3_10I2R0Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA3_3_10I2R0CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA3_3_10I2R0P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_3_10I2R0Certificates (CA3_3_10I2R0CertificateIndex a)).input +lemma CA3_3_10I2R0P_check : ∀ a : PairSlot, contains (CA3_3_10I2R0Raw a) (CA3_3_10I2R0P a) = true := by + decide +kernel +lemma CA3_3_10I2R0P_sound (a : PairSlot) : + (CA3_3_10I2R0P a).Encloses (CA3_3_10I2R0Value a) := + contains_sound (CA3_3_10I2R0Raw_sound a) (CA3_3_10I2R0P_check a) +def CA3_3_10I2R0Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_3_10I2R0Certificates (CA3_3_10I2R0CertificateIndex a)).output +lemma CA3_3_10I2R0Terms_sound (a : PairSlot) : + (CA3_3_10I2R0Terms a).Encloses (Foundation.entropyTerm (CA3_3_10I2R0Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA3_3_10I2R0Certificates_valid + (CA3_3_10I2R0CertificateIndex a) (CA3_3_10I2R0P_sound a) +def CA3_3_10I2R0Entropy : Ball := ⟨0, 0⟩ +lemma CA3_3_10I2R0Entropy_sound : CA3_3_10I2R0Entropy.Encloses (Foundation.finiteEntropy CA3_3_10I2R0Value) := by + exact contains_sound (entropyPair_enclosed CA3_3_10I2R0Value CA3_3_10I2R0Terms CA3_3_10I2R0Terms_sound) (by decide +kernel) +def CA3_3_10I2R0Mass : Ball := ⟨0, 0⟩ +lemma CA3_3_10I2R0Mass_sound : CA3_3_10I2R0Mass.Encloses (∑ a, CA3_3_10I2R0Value a) := by + exact contains_sound (pairSumBall_sound CA3_3_10I2R0P CA3_3_10I2R0Value CA3_3_10I2R0P_sound) (by decide +kernel) +def CA3_3_10I2R0MassTerm : Ball := .exact 0 +lemma CA3_3_10I2R0MassTerm_sound : CA3_3_10I2R0MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA3_3_10I2R0Value a))) := + entropyTerm_zero_ball (CA3_3_10I2R0Mass_sound) +def CA3_3_10I2R0H : Ball := ⟨0, 0⟩ +lemma CA3_3_10I2R0H_sound : CA3_3_10I2R0H.Encloses (homogeneousEntropy CA3_3_10I2R0Value) := by + exact contains_sound (homogeneous_enclosed CA3_3_10I2R0Value CA3_3_10I2R0MassTerm_sound CA3_3_10I2R0Entropy_sound) (by decide +kernel) +def CA3_3_10I2R1Value (a : PairSlot) : ℝ := residualLaw (below (shape 3 3 10)) (fun u => (stageALaw (shape 3 3 10) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 1 a +def CA3_3_10I2R1Raw (a : PairSlot) : Ball := residualBall (below (shape 3 3 10)) A3_3_10Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 1 a +lemma CA3_3_10I2R1Raw_sound (a : PairSlot) : + (CA3_3_10I2R1Raw a).Encloses (CA3_3_10I2R1Value a) := by + exact residualBall_sound_on (below (shape 3 3 10)) A3_3_10Law (fun u => (stageALaw (shape 3 3 10) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A3_3_10Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 3 3 10) (show (shape 3 3 10) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 1 a +def CA3_3_10I2R1Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA3_3_10I2R1Certificates_valid : + CA3_3_10I2R1Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA3_3_10I2R1CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA3_3_10I2R1P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_3_10I2R1Certificates (CA3_3_10I2R1CertificateIndex a)).input +lemma CA3_3_10I2R1P_check : ∀ a : PairSlot, contains (CA3_3_10I2R1Raw a) (CA3_3_10I2R1P a) = true := by + decide +kernel +lemma CA3_3_10I2R1P_sound (a : PairSlot) : + (CA3_3_10I2R1P a).Encloses (CA3_3_10I2R1Value a) := + contains_sound (CA3_3_10I2R1Raw_sound a) (CA3_3_10I2R1P_check a) +def CA3_3_10I2R1Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_3_10I2R1Certificates (CA3_3_10I2R1CertificateIndex a)).output +lemma CA3_3_10I2R1Terms_sound (a : PairSlot) : + (CA3_3_10I2R1Terms a).Encloses (Foundation.entropyTerm (CA3_3_10I2R1Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA3_3_10I2R1Certificates_valid + (CA3_3_10I2R1CertificateIndex a) (CA3_3_10I2R1P_sound a) +def CA3_3_10I2R1Entropy : Ball := ⟨0, 0⟩ +lemma CA3_3_10I2R1Entropy_sound : CA3_3_10I2R1Entropy.Encloses (Foundation.finiteEntropy CA3_3_10I2R1Value) := by + exact contains_sound (entropyPair_enclosed CA3_3_10I2R1Value CA3_3_10I2R1Terms CA3_3_10I2R1Terms_sound) (by decide +kernel) +def CA3_3_10I2R1Mass : Ball := ⟨0, 0⟩ +lemma CA3_3_10I2R1Mass_sound : CA3_3_10I2R1Mass.Encloses (∑ a, CA3_3_10I2R1Value a) := by + exact contains_sound (pairSumBall_sound CA3_3_10I2R1P CA3_3_10I2R1Value CA3_3_10I2R1P_sound) (by decide +kernel) +def CA3_3_10I2R1MassTerm : Ball := .exact 0 +lemma CA3_3_10I2R1MassTerm_sound : CA3_3_10I2R1MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA3_3_10I2R1Value a))) := + entropyTerm_zero_ball (CA3_3_10I2R1Mass_sound) +def CA3_3_10I2R1H : Ball := ⟨0, 0⟩ +lemma CA3_3_10I2R1H_sound : CA3_3_10I2R1H.Encloses (homogeneousEntropy CA3_3_10I2R1Value) := by + exact contains_sound (homogeneous_enclosed CA3_3_10I2R1Value CA3_3_10I2R1MassTerm_sound CA3_3_10I2R1Entropy_sound) (by decide +kernel) +def CA3_3_10I2R2Value (a : PairSlot) : ℝ := residualLaw (below (shape 3 3 10)) (fun u => (stageALaw (shape 3 3 10) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 2 a +def CA3_3_10I2R2Raw (a : PairSlot) : Ball := residualBall (below (shape 3 3 10)) A3_3_10Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 2 a +lemma CA3_3_10I2R2Raw_sound (a : PairSlot) : + (CA3_3_10I2R2Raw a).Encloses (CA3_3_10I2R2Value a) := by + exact residualBall_sound_on (below (shape 3 3 10)) A3_3_10Law (fun u => (stageALaw (shape 3 3 10) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A3_3_10Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 3 3 10) (show (shape 3 3 10) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 2 a +def CA3_3_10I2R2Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(204410733265658976046433123 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(2536206180674890189163805149 / 50000000000000000000000000000000), (1644869 / 100000000000000000000000000000000)⟩ ⟨(-1240740219535709226456799424257063 / 100000000000000000000000000000000), (201170447291 / 50000000000000000000000000000000)⟩ ⟨-18, 204410733265658976046433123, 190734863281250000000000000⟩, + .log ⟨(5044486655977323258061011 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(311065051000710648768908957 / 100000000000000000000000000000000), (51283 / 50000000000000000000000000000000)⟩ ⟨(-770804524361569139790725698710741 / 50000000000000000000000000000000), (508224724297 / 100000000000000000000000000000000)⟩ ⟨-23, 5044486655977323258061011, 2980232238769531250000000⟩, + .log ⟨(292437207758310337832007369 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(16278506733108100910470138241 / 100000000000000000000000000000000), (696669 / 12500000000000000000000000000000)⟩ ⟨(-1113299286222274925386142123835681 / 100000000000000000000000000000000), (95291223671 / 25000000000000000000000000000000)⟩ ⟨-17, 292437207758310337832007369, 152587890625000000000000000⟩] +lemma CA3_3_10I2R2Certificates_valid : + CA3_3_10I2R2Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA3_3_10I2R2CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 2, 0 => 1 + | 3, 0 => 2 + | 1, 1 => 3 + | 0, 2 => 1 + | 0, 3 => 2 + | _, _ => 0 +def CA3_3_10I2R2P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_3_10I2R2Certificates (CA3_3_10I2R2CertificateIndex a)).input +lemma CA3_3_10I2R2P_check : ∀ a : PairSlot, contains (CA3_3_10I2R2Raw a) (CA3_3_10I2R2P a) = true := by + decide +kernel +lemma CA3_3_10I2R2P_sound (a : PairSlot) : + (CA3_3_10I2R2P a).Encloses (CA3_3_10I2R2Value a) := + contains_sound (CA3_3_10I2R2Raw_sound a) (CA3_3_10I2R2P_check a) +def CA3_3_10I2R2Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_3_10I2R2Certificates (CA3_3_10I2R2CertificateIndex a)).output +lemma CA3_3_10I2R2Terms_sound (a : PairSlot) : + (CA3_3_10I2R2Terms a).Encloses (Foundation.entropyTerm (CA3_3_10I2R2Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA3_3_10I2R2Certificates_valid + (CA3_3_10I2R2CertificateIndex a) (CA3_3_10I2R2P_sound a) +def CA3_3_10I2R2Entropy : Ball := ⟨(27045461557809082964663176751 / 100000000000000000000000000000000), (4534111 / 50000000000000000000000000000000)⟩ +lemma CA3_3_10I2R2Entropy_sound : CA3_3_10I2R2Entropy.Encloses (Foundation.finiteEntropy CA3_3_10I2R2Value) := by + exact contains_sound (entropyPair_enclosed CA3_3_10I2R2Value CA3_3_10I2R2Terms CA3_3_10I2R2Terms_sound) (by decide +kernel) +def CA3_3_10I2R2Mass : Ball := ⟨(92807394604080247176410297 / 4000000000000000000000000000000), (1 / 20000000000000000000000000000000)⟩ +lemma CA3_3_10I2R2Mass_sound : CA3_3_10I2R2Mass.Encloses (∑ a, CA3_3_10I2R2Value a) := by + exact contains_sound (pairSumBall_sound CA3_3_10I2R2P CA3_3_10I2R2Value CA3_3_10I2R2P_sound) (by decide +kernel) +def CA3_3_10I2R2MassTermLogWitness : LogWitness := ⟨-16, 92807394604080247176410297, 61035156250000000000000000⟩ +def CA3_3_10I2R2MassTermLog : Ball := ⟨(-106712785992329267025334324179899 / 10000000000000000000000000000000), (359989218111 / 100000000000000000000000000000000)⟩ +lemma CA3_3_10I2R2MassTermLog_sound : CA3_3_10I2R2MassTermLog.Encloses (Real.log ((∑ a, CA3_3_10I2R2Value a))) := by + exact checkLog_sound logTwoBall_sound (CA3_3_10I2R2Mass_sound) (w := CA3_3_10I2R2MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA3_3_10I2R2MassTerm : Ball := ⟨(6189834774306793376050655379 / 25000000000000000000000000000000), (8352469 / 100000000000000000000000000000000)⟩ +lemma CA3_3_10I2R2MassTerm_sound : CA3_3_10I2R2MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA3_3_10I2R2Value a))) := by + exact contains_sound (entropyTerm_ball (CA3_3_10I2R2Mass_sound) CA3_3_10I2R2MassTermLog_sound) (by decide +kernel) +def CA3_3_10I2R2H : Ball := ⟨(457224492116381892092111047 / 20000000000000000000000000000000), (17420691 / 100000000000000000000000000000000)⟩ +lemma CA3_3_10I2R2H_sound : CA3_3_10I2R2H.Encloses (homogeneousEntropy CA3_3_10I2R2Value) := by + exact contains_sound (homogeneous_enclosed CA3_3_10I2R2Value CA3_3_10I2R2MassTerm_sound CA3_3_10I2R2Entropy_sound) (by decide +kernel) +def CA3_3_10I2R3Value (a : PairSlot) : ℝ := residualLaw (below (shape 3 3 10)) (fun u => (stageALaw (shape 3 3 10) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 3 a +def CA3_3_10I2R3Raw (a : PairSlot) : Ball := residualBall (below (shape 3 3 10)) A3_3_10Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 3 a +lemma CA3_3_10I2R3Raw_sound (a : PairSlot) : + (CA3_3_10I2R3Raw a).Encloses (CA3_3_10I2R3Value a) := by + exact residualBall_sound_on (below (shape 3 3 10)) A3_3_10Law (fun u => (stageALaw (shape 3 3 10) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A3_3_10Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 3 3 10) (show (shape 3 3 10) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 3 a +def CA3_3_10I2R3Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(4934993434450625004229415309 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(18207020560625530018934037979 / 20000000000000000000000000000000), (3918847 / 12500000000000000000000000000000)⟩ ⟨(-230585673548271625940616174386427 / 25000000000000000000000000000000), (2481541917 / 781250000000000000000000000000)⟩ ⟨-14, 4934993434450625004229415309, 3051757812500000000000000000⟩, + .log ⟨(350467867214893328574126728907 / 100000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ ⟨(1981424914383373820028631039891 / 100000000000000000000000000000000), (742144597 / 100000000000000000000000000000000)⟩ ⟨(-565365643968849437797224337721463 / 100000000000000000000000000000000), (105879118843 / 50000000000000000000000000000000)⟩ ⟨-9, 350467867214893328574126728907, 195312500000000000000000000000⟩, + .log ⟨(3077117550294247173663889277 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(135077679258998791932977281509 / 100000000000000000000000000000000), (1140309 / 2500000000000000000000000000000)⟩ ⟨(-109743678175442213022326652229331 / 12500000000000000000000000000000), (296461538061 / 100000000000000000000000000000000)⟩ ⟨-13, 3077117550294247173663889277, 2441406250000000000000000000⟩] +lemma CA3_3_10I2R3Certificates_valid : + CA3_3_10I2R3Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA3_3_10I2R3CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 4, 0 => 1 + | 2, 1 => 2 + | 3, 1 => 3 + | 1, 2 => 2 + | 1, 3 => 3 + | 0, 4 => 1 + | _, _ => 0 +def CA3_3_10I2R3P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_3_10I2R3Certificates (CA3_3_10I2R3CertificateIndex a)).input +lemma CA3_3_10I2R3P_check : ∀ a : PairSlot, contains (CA3_3_10I2R3Raw a) (CA3_3_10I2R3P a) = true := by + decide +kernel +lemma CA3_3_10I2R3P_sound (a : PairSlot) : + (CA3_3_10I2R3P a).Encloses (CA3_3_10I2R3Value a) := + contains_sound (CA3_3_10I2R3Raw_sound a) (CA3_3_10I2R3P_check a) +def CA3_3_10I2R3Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_3_10I2R3Certificates (CA3_3_10I2R3CertificateIndex a)).output +lemma CA3_3_10I2R3Terms_sound (a : PairSlot) : + (CA3_3_10I2R3Terms a).Encloses (Foundation.entropyTerm (CA3_3_10I2R3Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA3_3_10I2R3Certificates_valid + (CA3_3_10I2R3CertificateIndex a) (CA3_3_10I2R3P_sound a) +def CA3_3_10I2R3Entropy : Ball := ⟨(441507539289100052411255702259 / 10000000000000000000000000000000), (819107733 / 50000000000000000000000000000000)⟩ +lemma CA3_3_10I2R3Entropy_sound : CA3_3_10I2R3Entropy.Encloses (Foundation.finiteEntropy CA3_3_10I2R3Value) := by + exact contains_sound (entropyPair_enclosed CA3_3_10I2R3Value CA3_3_10I2R3Terms CA3_3_10I2R3Terms_sound) (by decide +kernel) +def CA3_3_10I2R3Mass : Ball := ⟨(37572344183526581445090500591 / 5000000000000000000000000000000), (1 / 10000000000000000000000000000000)⟩ +lemma CA3_3_10I2R3Mass_sound : CA3_3_10I2R3Mass.Encloses (∑ a, CA3_3_10I2R3Value a) := by + exact contains_sound (pairSumBall_sound CA3_3_10I2R3P CA3_3_10I2R3Value CA3_3_10I2R3P_sound) (by decide +kernel) +def CA3_3_10I2R3MassTermLogWitness : LogWitness := ⟨-8, 37572344183526581445090500591, 19531250000000000000000000000⟩ +def CA3_3_10I2R3MassTermLog : Ball := ⟨(-4890924938686978144743451349959 / 1000000000000000000000000000000), (95291207239 / 50000000000000000000000000000000)⟩ +lemma CA3_3_10I2R3MassTermLog_sound : CA3_3_10I2R3MassTermLog.Encloses (Real.log ((∑ a, CA3_3_10I2R3Value a))) := by + exact checkLog_sound logTwoBall_sound (CA3_3_10I2R3Mass_sound) (w := CA3_3_10I2R3MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA3_3_10I2R3MassTerm : Ball := ⟨(459408787930351963191356758269 / 12500000000000000000000000000000), (44753927 / 3125000000000000000000000000000)⟩ +lemma CA3_3_10I2R3MassTerm_sound : CA3_3_10I2R3MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA3_3_10I2R3Value a))) := by + exact contains_sound (entropyTerm_ball (CA3_3_10I2R3Mass_sound) CA3_3_10I2R3MassTermLog_sound) (by decide +kernel) +def CA3_3_10I2R3H : Ball := ⟨(369902544724092409290851478219 / 50000000000000000000000000000000), (307034113 / 10000000000000000000000000000000)⟩ +lemma CA3_3_10I2R3H_sound : CA3_3_10I2R3H.Encloses (homogeneousEntropy CA3_3_10I2R3Value) := by + exact contains_sound (homogeneous_enclosed CA3_3_10I2R3Value CA3_3_10I2R3MassTerm_sound CA3_3_10I2R3Entropy_sound) (by decide +kernel) +def CA3_3_10I2R4Value (a : PairSlot) : ℝ := residualLaw (below (shape 3 3 10)) (fun u => (stageALaw (shape 3 3 10) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 4 a +def CA3_3_10I2R4Raw (a : PairSlot) : Ball := residualBall (below (shape 3 3 10)) A3_3_10Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 4 a +lemma CA3_3_10I2R4Raw_sound (a : PairSlot) : + (CA3_3_10I2R4Raw a).Encloses (CA3_3_10I2R4Value a) := by + exact residualBall_sound_on (below (shape 3 3 10)) A3_3_10Law (fun u => (stageALaw (shape 3 3 10) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A3_3_10Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 3 3 10) (show (shape 3 3 10) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 4 a +def CA3_3_10I2R4Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(292426610747876677393628467 / 6250000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(23323661743187264287437728669 / 50000000000000000000000000000000), (1585249 / 10000000000000000000000000000000)⟩ ⟨(-996987828994826628952931568601249 / 100000000000000000000000000000000), (338813200301 / 100000000000000000000000000000000)⟩ ⟨-15, 292426610747876677393628467, 190734863281250000000000000⟩, + .log ⟨(49855739965540601932205240819 / 3125000000000000000000000000000), (1 / 10000000000000000000000000000000)⟩ ⟨(6601786889331058205106748938237 / 100000000000000000000000000000000), (2364849497 / 100000000000000000000000000000000)⟩ ⟨(-413805592764625468094839034928309 / 100000000000000000000000000000000), (148230766407 / 100000000000000000000000000000000)⟩ ⟨-6, 49855739965540601932205240819, 48828125000000000000000000000⟩, + .log ⟨(1653108759278764065063434902573 / 10000000000000000000000000000000), (7 / 10000000000000000000000000000000)⟩ ⟨(29754758852921556780326831903431 / 100000000000000000000000000000000), (14002376043 / 100000000000000000000000000000000)⟩ ⟨(-179992748123258874859358077837239 / 100000000000000000000000000000000), (16940659031 / 20000000000000000000000000000000)⟩ ⟨-3, 1653108759278764065063434902573, 1250000000000000000000000000000⟩, + .log ⟨(96435795935249516874992395783 / 12500000000000000000000000000000), (1 / 20000000000000000000000000000000)⟩ ⟨(3752977569731605056105428799339 / 100000000000000000000000000000000), (735158683 / 50000000000000000000000000000000)⟩ ⟨(-19458425853878418786976991792859 / 4000000000000000000000000000000), (38116482759 / 20000000000000000000000000000000)⟩ ⟨-8, 96435795935249516874992395783, 48828125000000000000000000000⟩, + .log ⟨(18279812938541531845270453481 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(289332182787322242821107074539 / 100000000000000000000000000000000), (50321717 / 50000000000000000000000000000000)⟩ ⟨(-395699047577899915330143175246277 / 50000000000000000000000000000000), (137642855307 / 50000000000000000000000000000000)⟩ ⟨-12, 18279812938541531845270453481, 12207031250000000000000000000⟩] +lemma CA3_3_10I2R4Certificates_valid : + CA3_3_10I2R4Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA3_3_10I2R4CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 5, 0 => 1 + | 4, 1 => 2 + | 2, 2 => 3 + | 2, 3 => 4 + | 3, 2 => 4 + | 3, 3 => 5 + | 1, 4 => 2 + | 0, 5 => 1 + | _, _ => 0 +def CA3_3_10I2R4P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_3_10I2R4Certificates (CA3_3_10I2R4CertificateIndex a)).input +lemma CA3_3_10I2R4P_check : ∀ a : PairSlot, contains (CA3_3_10I2R4Raw a) (CA3_3_10I2R4P a) = true := by + decide +kernel +lemma CA3_3_10I2R4P_sound (a : PairSlot) : + (CA3_3_10I2R4P a).Encloses (CA3_3_10I2R4Value a) := + contains_sound (CA3_3_10I2R4Raw_sound a) (CA3_3_10I2R4P_check a) +def CA3_3_10I2R4Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_3_10I2R4Certificates (CA3_3_10I2R4CertificateIndex a)).output +lemma CA3_3_10I2R4Terms_sound (a : PairSlot) : + (CA3_3_10I2R4Terms a).Encloses (Foundation.entropyTerm (CA3_3_10I2R4Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA3_3_10I2R4Certificates_valid + (CA3_3_10I2R4CertificateIndex a) (CA3_3_10I2R4P_sound a) +def CA3_3_10I2R4Entropy : Ball := ⟨(25423457300403477301361022683899 / 50000000000000000000000000000000), (21805058183 / 100000000000000000000000000000000)⟩ +lemma CA3_3_10I2R4Entropy_sound : CA3_3_10I2R4Entropy.Encloses (Foundation.finiteEntropy CA3_3_10I2R4Value) := by + exact contains_sound (entropyPair_enclosed CA3_3_10I2R4Value CA3_3_10I2R4Terms CA3_3_10I2R4Terms_sound) (by decide +kernel) +def CA3_3_10I2R4Mass : Ball := ⟨(1065537248148362328083124989429 / 5000000000000000000000000000000), (103 / 100000000000000000000000000000000)⟩ +lemma CA3_3_10I2R4Mass_sound : CA3_3_10I2R4Mass.Encloses (∑ a, CA3_3_10I2R4Value a) := by + exact contains_sound (pairSumBall_sound CA3_3_10I2R4P CA3_3_10I2R4Value CA3_3_10I2R4P_sound) (by decide +kernel) +def CA3_3_10I2R4MassTermLogWitness : LogWitness := ⟨-3, 1065537248148362328083124989429, 625000000000000000000000000000⟩ +def CA3_3_10I2R4MassTermLog : Ball := ⟨(-154595878211378320822588544937459 / 100000000000000000000000000000000), (16940659043 / 20000000000000000000000000000000)⟩ +lemma CA3_3_10I2R4MassTermLog_sound : CA3_3_10I2R4MassTermLog.Encloses (Real.log ((∑ a, CA3_3_10I2R4Value a))) := by + exact checkLog_sound logTwoBall_sound (CA3_3_10I2R4Mass_sound) (w := CA3_3_10I2R4MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA3_3_10I2R4MassTerm : Ball := ⟨(2059095833055392783245717986463 / 6250000000000000000000000000000), (18050903379 / 100000000000000000000000000000000)⟩ +lemma CA3_3_10I2R4MassTerm_sound : CA3_3_10I2R4MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA3_3_10I2R4Value a))) := by + exact contains_sound (entropyTerm_ball (CA3_3_10I2R4Mass_sound) CA3_3_10I2R4MassTermLog_sound) (by decide +kernel) +def CA3_3_10I2R4H : Ball := ⟨(1790138127192067007079055758439 / 10000000000000000000000000000000), (19927980781 / 50000000000000000000000000000000)⟩ +lemma CA3_3_10I2R4H_sound : CA3_3_10I2R4H.Encloses (homogeneousEntropy CA3_3_10I2R4Value) := by + exact contains_sound (homogeneous_enclosed CA3_3_10I2R4Value CA3_3_10I2R4MassTerm_sound CA3_3_10I2R4Entropy_sound) (by decide +kernel) +def CA3_3_10I2R5Value (a : PairSlot) : ℝ := residualLaw (below (shape 3 3 10)) (fun u => (stageALaw (shape 3 3 10) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 5 a +def CA3_3_10I2R5Raw (a : PairSlot) : Ball := residualBall (below (shape 3 3 10)) A3_3_10Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 5 a +lemma CA3_3_10I2R5Raw_sound (a : PairSlot) : + (CA3_3_10I2R5Raw a).Encloses (CA3_3_10I2R5Value a) := by + exact residualBall_sound_on (below (shape 3 3 10)) A3_3_10Law (fun u => (stageALaw (shape 3 3 10) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A3_3_10Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 3 3 10) (show (shape 3 3 10) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 5 a +def CA3_3_10I2R5Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(18742924709934919642771347073 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(295724439812178383035116466057 / 100000000000000000000000000000000), (25798299 / 25000000000000000000000000000000)⟩ ⟨(-394448097600565477541093905839049 / 50000000000000000000000000000000), (137642855273 / 50000000000000000000000000000000)⟩ ⟨-12, 18742924709934919642771347073, 12207031250000000000000000000⟩, + .log ⟨(441486378135169595035023994947 / 2000000000000000000000000000000), (47 / 100000000000000000000000000000000)⟩ ⟨(8337223535112156143260300671753 / 25000000000000000000000000000000), (18697675523 / 100000000000000000000000000000000)⟩ ⟨(-37768882339375616603467954678619 / 25000000000000000000000000000000), (16940658989 / 20000000000000000000000000000000)⟩ ⟨-3, 441486378135169595035023994947, 250000000000000000000000000000⟩, + .log ⟨(828412602588776180169548902123 / 100000000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ ⟨(1985462334209944676635733051203 / 50000000000000000000000000000000), (1403385561 / 100000000000000000000000000000000)⟩ ⟨(-479341412239602952867242993422541 / 100000000000000000000000000000000), (84703294973 / 50000000000000000000000000000000)⟩ ⟨-7, 828412602588776180169548902123, 781250000000000000000000000000⟩] +lemma CA3_3_10I2R5Certificates_valid : + CA3_3_10I2R5Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA3_3_10I2R5CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 5, 1 => 1 + | 4, 2 => 2 + | 4, 3 => 3 + | 2, 4 => 2 + | 3, 4 => 3 + | 1, 5 => 1 + | _, _ => 0 +def CA3_3_10I2R5P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_3_10I2R5Certificates (CA3_3_10I2R5CertificateIndex a)).input +lemma CA3_3_10I2R5P_check : ∀ a : PairSlot, contains (CA3_3_10I2R5Raw a) (CA3_3_10I2R5P a) = true := by + decide +kernel +lemma CA3_3_10I2R5P_sound (a : PairSlot) : + (CA3_3_10I2R5P a).Encloses (CA3_3_10I2R5Value a) := + contains_sound (CA3_3_10I2R5Raw_sound a) (CA3_3_10I2R5P_check a) +def CA3_3_10I2R5Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_3_10I2R5Certificates (CA3_3_10I2R5CertificateIndex a)).output +lemma CA3_3_10I2R5Terms_sound (a : PairSlot) : + (CA3_3_10I2R5Terms a).Encloses (Foundation.entropyTerm (CA3_3_10I2R5Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA3_3_10I2R5Certificates_valid + (CA3_3_10I2R5CertificateIndex a) (CA3_3_10I2R5P_sound a) +def CA3_3_10I2R5Entropy : Ball := ⟨(1504621729947227692373911410219 / 2000000000000000000000000000000), (505106357 / 1250000000000000000000000000000)⟩ +lemma CA3_3_10I2R5Entropy_sound : CA3_3_10I2R5Entropy.Encloses (Foundation.finiteEntropy CA3_3_10I2R5Value) := by + exact contains_sound (entropyPair_enclosed CA3_3_10I2R5Value CA3_3_10I2R5Terms CA3_3_10I2R5Terms_sound) (by decide +kernel) +def CA3_3_10I2R5Mass : Ball := ⟨(22940217358767125771206291343619 / 50000000000000000000000000000000), (13 / 12500000000000000000000000000000)⟩ +lemma CA3_3_10I2R5Mass_sound : CA3_3_10I2R5Mass.Encloses (∑ a, CA3_3_10I2R5Value a) := by + exact contains_sound (pairSumBall_sound CA3_3_10I2R5P CA3_3_10I2R5Value CA3_3_10I2R5P_sound) (by decide +kernel) +def CA3_3_10I2R5MassTermLogWitness : LogWitness := ⟨-2, 22940217358767125771206291343619, 12500000000000000000000000000000⟩ +def CA3_3_10I2R5MassTermLog : Ball := ⟨(-77913141867298139311620297031129 / 100000000000000000000000000000000), (2541098851 / 4000000000000000000000000000000)⟩ +lemma CA3_3_10I2R5MassTermLog_sound : CA3_3_10I2R5MassTermLog.Encloses (Real.log ((∑ a, CA3_3_10I2R5Value a))) := by + exact checkLog_sound logTwoBall_sound (CA3_3_10I2R5Mass_sound) (w := CA3_3_10I2R5MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA3_3_10I2R5MassTerm : Ball := ⟨(17873444095402784870395903805863 / 50000000000000000000000000000000), (7286670017 / 25000000000000000000000000000000)⟩ +lemma CA3_3_10I2R5MassTerm_sound : CA3_3_10I2R5MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA3_3_10I2R5Value a))) := by + exact contains_sound (entropyTerm_ball (CA3_3_10I2R5Mass_sound) CA3_3_10I2R5MassTermLog_sound) (by decide +kernel) +def CA3_3_10I2R5H : Ball := ⟨(4935524788319476859737970362403 / 12500000000000000000000000000000), (17388797157 / 25000000000000000000000000000000)⟩ +lemma CA3_3_10I2R5H_sound : CA3_3_10I2R5H.Encloses (homogeneousEntropy CA3_3_10I2R5Value) := by + exact contains_sound (homogeneous_enclosed CA3_3_10I2R5Value CA3_3_10I2R5MassTerm_sound CA3_3_10I2R5Entropy_sound) (by decide +kernel) +def CA3_3_10I2R6Value (a : PairSlot) : ℝ := residualLaw (below (shape 3 3 10)) (fun u => (stageALaw (shape 3 3 10) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 6 a +def CA3_3_10I2R6Raw (a : PairSlot) : Ball := residualBall (below (shape 3 3 10)) A3_3_10Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 6 a +lemma CA3_3_10I2R6Raw_sound (a : PairSlot) : + (CA3_3_10I2R6Raw a).Encloses (CA3_3_10I2R6Value a) := by + exact residualBall_sound_on (below (shape 3 3 10)) A3_3_10Law (fun u => (stageALaw (shape 3 3 10) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A3_3_10Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 3 3 10) (show (shape 3 3 10) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 6 a +def CA3_3_10I2R6Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(2063118680918729050143193271 / 2000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ ⟨(709370730087177523146601219117 / 100000000000000000000000000000000), (120142661 / 50000000000000000000000000000000)⟩ ⟨(-171917092469757258222867236687177 / 25000000000000000000000000000000), (232934062451 / 100000000000000000000000000000000)⟩ ⟨-10, 2063118680918729050143193271, 1953125000000000000000000000⟩, + .log ⟨(1299846659318336356780689 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(26888947315604340116762773 / 25000000000000000000000000000000), (1377 / 4000000000000000000000000000000)⟩ ⟨(-165489965283784483921883535142277 / 10000000000000000000000000000000), (66176372313 / 12500000000000000000000000000000)⟩ ⟨-24, 1299846659318336356780689, 1192092895507812500000000⟩, + .log ⟨(10816758773791506086510037431569 / 100000000000000000000000000000000), (7 / 25000000000000000000000000000000)⟩ ⟨(24057266720408668255773678513131 / 100000000000000000000000000000000), (5726344461 / 50000000000000000000000000000000)⟩ ⟨(-222407351624576166655901974402823 / 100000000000000000000000000000000), (105879118673 / 100000000000000000000000000000000)⟩ ⟨-4, 10816758773791506086510037431569, 6250000000000000000000000000000⟩] +lemma CA3_3_10I2R6Certificates_valid : + CA3_3_10I2R6Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA3_3_10I2R6CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 5, 2 => 1 + | 5, 3 => 2 + | 4, 4 => 3 + | 2, 5 => 1 + | 3, 5 => 2 + | _, _ => 0 +def CA3_3_10I2R6P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_3_10I2R6Certificates (CA3_3_10I2R6CertificateIndex a)).input +lemma CA3_3_10I2R6P_check : ∀ a : PairSlot, contains (CA3_3_10I2R6Raw a) (CA3_3_10I2R6P a) = true := by + decide +kernel +lemma CA3_3_10I2R6P_sound (a : PairSlot) : + (CA3_3_10I2R6P a).Encloses (CA3_3_10I2R6Value a) := + contains_sound (CA3_3_10I2R6Raw_sound a) (CA3_3_10I2R6P_check a) +def CA3_3_10I2R6Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_3_10I2R6Certificates (CA3_3_10I2R6CertificateIndex a)).output +lemma CA3_3_10I2R6Terms_sound (a : PairSlot) : + (CA3_3_10I2R6Terms a).Encloses (Foundation.entropyTerm (CA3_3_10I2R6Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA3_3_10I2R6Certificates_valid + (CA3_3_10I2R6CertificateIndex a) (CA3_3_10I2R6P_sound a) +def CA3_3_10I2R6Entropy : Ball := ⟨(25476223292161548136787815053549 / 100000000000000000000000000000000), (372916513 / 3125000000000000000000000000000)⟩ +lemma CA3_3_10I2R6Entropy_sound : CA3_3_10I2R6Entropy.Encloses (Foundation.finiteEntropy CA3_3_10I2R6Value) := by + exact contains_sound (entropyPair_enclosed CA3_3_10I2R6Value CA3_3_10I2R6Terms CA3_3_10I2R6Terms_sound) (by decide +kernel) +def CA3_3_10I2R6Mass : Ball := ⟨(11023083640349972174887924565559 / 100000000000000000000000000000000), (17 / 50000000000000000000000000000000)⟩ +lemma CA3_3_10I2R6Mass_sound : CA3_3_10I2R6Mass.Encloses (∑ a, CA3_3_10I2R6Value a) := by + exact contains_sound (pairSumBall_sound CA3_3_10I2R6P CA3_3_10I2R6Value CA3_3_10I2R6P_sound) (by decide +kernel) +def CA3_3_10I2R6MassTermLogWitness : LogWitness := ⟨-4, 11023083640349972174887924565559, 6250000000000000000000000000000⟩ +def CA3_3_10I2R6MassTermLog : Ball := ⟨(-1102589299616463351266717354721 / 500000000000000000000000000000), (105879118723 / 100000000000000000000000000000000)⟩ +lemma CA3_3_10I2R6MassTermLog_sound : CA3_3_10I2R6MassTermLog.Encloses (Real.log ((∑ a, CA3_3_10I2R6Value a))) := by + exact checkLog_sound logTwoBall_sound (CA3_3_10I2R6Mass_sound) (w := CA3_3_10I2R6MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA3_3_10I2R6MassTerm : Ball := ⟨(2430786814125434203440530503883 / 10000000000000000000000000000000), (1167114389 / 10000000000000000000000000000000)⟩ +lemma CA3_3_10I2R6MassTerm_sound : CA3_3_10I2R6MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA3_3_10I2R6Value a))) := by + exact contains_sound (entropyTerm_ball (CA3_3_10I2R6Mass_sound) CA3_3_10I2R6MassTermLog_sound) (by decide +kernel) +def CA3_3_10I2R6H : Ball := ⟨(1168355150907206102382510014719 / 100000000000000000000000000000000), (11802236153 / 50000000000000000000000000000000)⟩ +lemma CA3_3_10I2R6H_sound : CA3_3_10I2R6H.Encloses (homogeneousEntropy CA3_3_10I2R6Value) := by + exact contains_sound (homogeneous_enclosed CA3_3_10I2R6Value CA3_3_10I2R6MassTerm_sound CA3_3_10I2R6Entropy_sound) (by decide +kernel) +def CA3_3_10I2R7Value (a : PairSlot) : ℝ := residualLaw (below (shape 3 3 10)) (fun u => (stageALaw (shape 3 3 10) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 7 a +def CA3_3_10I2R7Raw (a : PairSlot) : Ball := residualBall (below (shape 3 3 10)) A3_3_10Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 7 a +lemma CA3_3_10I2R7Raw_sound (a : PairSlot) : + (CA3_3_10I2R7Raw a).Encloses (CA3_3_10I2R7Value a) := by + exact residualBall_sound_on (below (shape 3 3 10)) A3_3_10Law (fun u => (stageALaw (shape 3 3 10) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A3_3_10Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 3 3 10) (show (shape 3 3 10) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 7 a +def CA3_3_10I2R7Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA3_3_10I2R7Certificates_valid : + CA3_3_10I2R7Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA3_3_10I2R7CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA3_3_10I2R7P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_3_10I2R7Certificates (CA3_3_10I2R7CertificateIndex a)).input +lemma CA3_3_10I2R7P_check : ∀ a : PairSlot, contains (CA3_3_10I2R7Raw a) (CA3_3_10I2R7P a) = true := by + decide +kernel +lemma CA3_3_10I2R7P_sound (a : PairSlot) : + (CA3_3_10I2R7P a).Encloses (CA3_3_10I2R7Value a) := + contains_sound (CA3_3_10I2R7Raw_sound a) (CA3_3_10I2R7P_check a) +def CA3_3_10I2R7Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_3_10I2R7Certificates (CA3_3_10I2R7CertificateIndex a)).output +lemma CA3_3_10I2R7Terms_sound (a : PairSlot) : + (CA3_3_10I2R7Terms a).Encloses (Foundation.entropyTerm (CA3_3_10I2R7Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA3_3_10I2R7Certificates_valid + (CA3_3_10I2R7CertificateIndex a) (CA3_3_10I2R7P_sound a) +def CA3_3_10I2R7Entropy : Ball := ⟨0, 0⟩ +lemma CA3_3_10I2R7Entropy_sound : CA3_3_10I2R7Entropy.Encloses (Foundation.finiteEntropy CA3_3_10I2R7Value) := by + exact contains_sound (entropyPair_enclosed CA3_3_10I2R7Value CA3_3_10I2R7Terms CA3_3_10I2R7Terms_sound) (by decide +kernel) +def CA3_3_10I2R7Mass : Ball := ⟨0, 0⟩ +lemma CA3_3_10I2R7Mass_sound : CA3_3_10I2R7Mass.Encloses (∑ a, CA3_3_10I2R7Value a) := by + exact contains_sound (pairSumBall_sound CA3_3_10I2R7P CA3_3_10I2R7Value CA3_3_10I2R7P_sound) (by decide +kernel) +def CA3_3_10I2R7MassTerm : Ball := .exact 0 +lemma CA3_3_10I2R7MassTerm_sound : CA3_3_10I2R7MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA3_3_10I2R7Value a))) := + entropyTerm_zero_ball (CA3_3_10I2R7Mass_sound) +def CA3_3_10I2R7H : Ball := ⟨0, 0⟩ +lemma CA3_3_10I2R7H_sound : CA3_3_10I2R7H.Encloses (homogeneousEntropy CA3_3_10I2R7Value) := by + exact contains_sound (homogeneous_enclosed CA3_3_10I2R7Value CA3_3_10I2R7MassTerm_sound CA3_3_10I2R7Entropy_sound) (by decide +kernel) +def CA3_3_10I2R8Value (a : PairSlot) : ℝ := residualLaw (below (shape 3 3 10)) (fun u => (stageALaw (shape 3 3 10) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 8 a +def CA3_3_10I2R8Raw (a : PairSlot) : Ball := residualBall (below (shape 3 3 10)) A3_3_10Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 8 a +lemma CA3_3_10I2R8Raw_sound (a : PairSlot) : + (CA3_3_10I2R8Raw a).Encloses (CA3_3_10I2R8Value a) := by + exact residualBall_sound_on (below (shape 3 3 10)) A3_3_10Law (fun u => (stageALaw (shape 3 3 10) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A3_3_10Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 3 3 10) (show (shape 3 3 10) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 8 a +def CA3_3_10I2R8Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA3_3_10I2R8Certificates_valid : + CA3_3_10I2R8Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA3_3_10I2R8CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA3_3_10I2R8P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_3_10I2R8Certificates (CA3_3_10I2R8CertificateIndex a)).input +lemma CA3_3_10I2R8P_check : ∀ a : PairSlot, contains (CA3_3_10I2R8Raw a) (CA3_3_10I2R8P a) = true := by + decide +kernel +lemma CA3_3_10I2R8P_sound (a : PairSlot) : + (CA3_3_10I2R8P a).Encloses (CA3_3_10I2R8Value a) := + contains_sound (CA3_3_10I2R8Raw_sound a) (CA3_3_10I2R8P_check a) +def CA3_3_10I2R8Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_3_10I2R8Certificates (CA3_3_10I2R8CertificateIndex a)).output +lemma CA3_3_10I2R8Terms_sound (a : PairSlot) : + (CA3_3_10I2R8Terms a).Encloses (Foundation.entropyTerm (CA3_3_10I2R8Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA3_3_10I2R8Certificates_valid + (CA3_3_10I2R8CertificateIndex a) (CA3_3_10I2R8P_sound a) +def CA3_3_10I2R8Entropy : Ball := ⟨0, 0⟩ +lemma CA3_3_10I2R8Entropy_sound : CA3_3_10I2R8Entropy.Encloses (Foundation.finiteEntropy CA3_3_10I2R8Value) := by + exact contains_sound (entropyPair_enclosed CA3_3_10I2R8Value CA3_3_10I2R8Terms CA3_3_10I2R8Terms_sound) (by decide +kernel) +def CA3_3_10I2R8Mass : Ball := ⟨0, 0⟩ +lemma CA3_3_10I2R8Mass_sound : CA3_3_10I2R8Mass.Encloses (∑ a, CA3_3_10I2R8Value a) := by + exact contains_sound (pairSumBall_sound CA3_3_10I2R8P CA3_3_10I2R8Value CA3_3_10I2R8P_sound) (by decide +kernel) +def CA3_3_10I2R8MassTerm : Ball := .exact 0 +lemma CA3_3_10I2R8MassTerm_sound : CA3_3_10I2R8MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA3_3_10I2R8Value a))) := + entropyTerm_zero_ball (CA3_3_10I2R8Mass_sound) +def CA3_3_10I2R8H : Ball := ⟨0, 0⟩ +lemma CA3_3_10I2R8H_sound : CA3_3_10I2R8H.Encloses (homogeneousEntropy CA3_3_10I2R8Value) := by + exact contains_sound (homogeneous_enclosed CA3_3_10I2R8Value CA3_3_10I2R8MassTerm_sound CA3_3_10I2R8Entropy_sound) (by decide +kernel) +def CA3_3_10I2R9Value (a : PairSlot) : ℝ := residualLaw (below (shape 3 3 10)) (fun u => (stageALaw (shape 3 3 10) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 9 a +def CA3_3_10I2R9Raw (a : PairSlot) : Ball := residualBall (below (shape 3 3 10)) A3_3_10Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 9 a +lemma CA3_3_10I2R9Raw_sound (a : PairSlot) : + (CA3_3_10I2R9Raw a).Encloses (CA3_3_10I2R9Value a) := by + exact residualBall_sound_on (below (shape 3 3 10)) A3_3_10Law (fun u => (stageALaw (shape 3 3 10) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A3_3_10Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 3 3 10) (show (shape 3 3 10) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 9 a +def CA3_3_10I2R9Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA3_3_10I2R9Certificates_valid : + CA3_3_10I2R9Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA3_3_10I2R9CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA3_3_10I2R9P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_3_10I2R9Certificates (CA3_3_10I2R9CertificateIndex a)).input +lemma CA3_3_10I2R9P_check : ∀ a : PairSlot, contains (CA3_3_10I2R9Raw a) (CA3_3_10I2R9P a) = true := by + decide +kernel +lemma CA3_3_10I2R9P_sound (a : PairSlot) : + (CA3_3_10I2R9P a).Encloses (CA3_3_10I2R9Value a) := + contains_sound (CA3_3_10I2R9Raw_sound a) (CA3_3_10I2R9P_check a) +def CA3_3_10I2R9Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_3_10I2R9Certificates (CA3_3_10I2R9CertificateIndex a)).output +lemma CA3_3_10I2R9Terms_sound (a : PairSlot) : + (CA3_3_10I2R9Terms a).Encloses (Foundation.entropyTerm (CA3_3_10I2R9Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA3_3_10I2R9Certificates_valid + (CA3_3_10I2R9CertificateIndex a) (CA3_3_10I2R9P_sound a) +def CA3_3_10I2R9Entropy : Ball := ⟨0, 0⟩ +lemma CA3_3_10I2R9Entropy_sound : CA3_3_10I2R9Entropy.Encloses (Foundation.finiteEntropy CA3_3_10I2R9Value) := by + exact contains_sound (entropyPair_enclosed CA3_3_10I2R9Value CA3_3_10I2R9Terms CA3_3_10I2R9Terms_sound) (by decide +kernel) +def CA3_3_10I2R9Mass : Ball := ⟨0, 0⟩ +lemma CA3_3_10I2R9Mass_sound : CA3_3_10I2R9Mass.Encloses (∑ a, CA3_3_10I2R9Value a) := by + exact contains_sound (pairSumBall_sound CA3_3_10I2R9P CA3_3_10I2R9Value CA3_3_10I2R9P_sound) (by decide +kernel) +def CA3_3_10I2R9MassTerm : Ball := .exact 0 +lemma CA3_3_10I2R9MassTerm_sound : CA3_3_10I2R9MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA3_3_10I2R9Value a))) := + entropyTerm_zero_ball (CA3_3_10I2R9Mass_sound) +def CA3_3_10I2R9H : Ball := ⟨0, 0⟩ +lemma CA3_3_10I2R9H_sound : CA3_3_10I2R9H.Encloses (homogeneousEntropy CA3_3_10I2R9Value) := by + exact contains_sound (homogeneous_enclosed CA3_3_10I2R9Value CA3_3_10I2R9MassTerm_sound CA3_3_10I2R9Entropy_sound) (by decide +kernel) +def CA3_3_10I2R10Value (a : PairSlot) : ℝ := residualLaw (below (shape 3 3 10)) (fun u => (stageALaw (shape 3 3 10) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 10 a +def CA3_3_10I2R10Raw (a : PairSlot) : Ball := residualBall (below (shape 3 3 10)) A3_3_10Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 10 a +lemma CA3_3_10I2R10Raw_sound (a : PairSlot) : + (CA3_3_10I2R10Raw a).Encloses (CA3_3_10I2R10Value a) := by + exact residualBall_sound_on (below (shape 3 3 10)) A3_3_10Law (fun u => (stageALaw (shape 3 3 10) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A3_3_10Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 3 3 10) (show (shape 3 3 10) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 10 a +def CA3_3_10I2R10Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA3_3_10I2R10Certificates_valid : + CA3_3_10I2R10Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA3_3_10I2R10CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA3_3_10I2R10P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_3_10I2R10Certificates (CA3_3_10I2R10CertificateIndex a)).input +lemma CA3_3_10I2R10P_check : ∀ a : PairSlot, contains (CA3_3_10I2R10Raw a) (CA3_3_10I2R10P a) = true := by + decide +kernel +lemma CA3_3_10I2R10P_sound (a : PairSlot) : + (CA3_3_10I2R10P a).Encloses (CA3_3_10I2R10Value a) := + contains_sound (CA3_3_10I2R10Raw_sound a) (CA3_3_10I2R10P_check a) +def CA3_3_10I2R10Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_3_10I2R10Certificates (CA3_3_10I2R10CertificateIndex a)).output +lemma CA3_3_10I2R10Terms_sound (a : PairSlot) : + (CA3_3_10I2R10Terms a).Encloses (Foundation.entropyTerm (CA3_3_10I2R10Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA3_3_10I2R10Certificates_valid + (CA3_3_10I2R10CertificateIndex a) (CA3_3_10I2R10P_sound a) +def CA3_3_10I2R10Entropy : Ball := ⟨0, 0⟩ +lemma CA3_3_10I2R10Entropy_sound : CA3_3_10I2R10Entropy.Encloses (Foundation.finiteEntropy CA3_3_10I2R10Value) := by + exact contains_sound (entropyPair_enclosed CA3_3_10I2R10Value CA3_3_10I2R10Terms CA3_3_10I2R10Terms_sound) (by decide +kernel) +def CA3_3_10I2R10Mass : Ball := ⟨0, 0⟩ +lemma CA3_3_10I2R10Mass_sound : CA3_3_10I2R10Mass.Encloses (∑ a, CA3_3_10I2R10Value a) := by + exact contains_sound (pairSumBall_sound CA3_3_10I2R10P CA3_3_10I2R10Value CA3_3_10I2R10P_sound) (by decide +kernel) +def CA3_3_10I2R10MassTerm : Ball := .exact 0 +lemma CA3_3_10I2R10MassTerm_sound : CA3_3_10I2R10MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA3_3_10I2R10Value a))) := + entropyTerm_zero_ball (CA3_3_10I2R10Mass_sound) +def CA3_3_10I2R10H : Ball := ⟨0, 0⟩ +lemma CA3_3_10I2R10H_sound : CA3_3_10I2R10H.Encloses (homogeneousEntropy CA3_3_10I2R10Value) := by + exact contains_sound (homogeneous_enclosed CA3_3_10I2R10Value CA3_3_10I2R10MassTerm_sound CA3_3_10I2R10Entropy_sound) (by decide +kernel) +def CA3_3_10I2R11Value (a : PairSlot) : ℝ := residualLaw (below (shape 3 3 10)) (fun u => (stageALaw (shape 3 3 10) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 11 a +def CA3_3_10I2R11Raw (a : PairSlot) : Ball := residualBall (below (shape 3 3 10)) A3_3_10Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 11 a +lemma CA3_3_10I2R11Raw_sound (a : PairSlot) : + (CA3_3_10I2R11Raw a).Encloses (CA3_3_10I2R11Value a) := by + exact residualBall_sound_on (below (shape 3 3 10)) A3_3_10Law (fun u => (stageALaw (shape 3 3 10) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A3_3_10Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 3 3 10) (show (shape 3 3 10) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 11 a +def CA3_3_10I2R11Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA3_3_10I2R11Certificates_valid : + CA3_3_10I2R11Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA3_3_10I2R11CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA3_3_10I2R11P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_3_10I2R11Certificates (CA3_3_10I2R11CertificateIndex a)).input +lemma CA3_3_10I2R11P_check : ∀ a : PairSlot, contains (CA3_3_10I2R11Raw a) (CA3_3_10I2R11P a) = true := by + decide +kernel +lemma CA3_3_10I2R11P_sound (a : PairSlot) : + (CA3_3_10I2R11P a).Encloses (CA3_3_10I2R11Value a) := + contains_sound (CA3_3_10I2R11Raw_sound a) (CA3_3_10I2R11P_check a) +def CA3_3_10I2R11Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_3_10I2R11Certificates (CA3_3_10I2R11CertificateIndex a)).output +lemma CA3_3_10I2R11Terms_sound (a : PairSlot) : + (CA3_3_10I2R11Terms a).Encloses (Foundation.entropyTerm (CA3_3_10I2R11Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA3_3_10I2R11Certificates_valid + (CA3_3_10I2R11CertificateIndex a) (CA3_3_10I2R11P_sound a) +def CA3_3_10I2R11Entropy : Ball := ⟨0, 0⟩ +lemma CA3_3_10I2R11Entropy_sound : CA3_3_10I2R11Entropy.Encloses (Foundation.finiteEntropy CA3_3_10I2R11Value) := by + exact contains_sound (entropyPair_enclosed CA3_3_10I2R11Value CA3_3_10I2R11Terms CA3_3_10I2R11Terms_sound) (by decide +kernel) +def CA3_3_10I2R11Mass : Ball := ⟨0, 0⟩ +lemma CA3_3_10I2R11Mass_sound : CA3_3_10I2R11Mass.Encloses (∑ a, CA3_3_10I2R11Value a) := by + exact contains_sound (pairSumBall_sound CA3_3_10I2R11P CA3_3_10I2R11Value CA3_3_10I2R11P_sound) (by decide +kernel) +def CA3_3_10I2R11MassTerm : Ball := .exact 0 +lemma CA3_3_10I2R11MassTerm_sound : CA3_3_10I2R11MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA3_3_10I2R11Value a))) := + entropyTerm_zero_ball (CA3_3_10I2R11Mass_sound) +def CA3_3_10I2R11H : Ball := ⟨0, 0⟩ +lemma CA3_3_10I2R11H_sound : CA3_3_10I2R11H.Encloses (homogeneousEntropy CA3_3_10I2R11Value) := by + exact contains_sound (homogeneous_enclosed CA3_3_10I2R11Value CA3_3_10I2R11MassTerm_sound CA3_3_10I2R11Entropy_sound) (by decide +kernel) +def CA3_3_10I2R12Value (a : PairSlot) : ℝ := residualLaw (below (shape 3 3 10)) (fun u => (stageALaw (shape 3 3 10) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 12 a +def CA3_3_10I2R12Raw (a : PairSlot) : Ball := residualBall (below (shape 3 3 10)) A3_3_10Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 12 a +lemma CA3_3_10I2R12Raw_sound (a : PairSlot) : + (CA3_3_10I2R12Raw a).Encloses (CA3_3_10I2R12Value a) := by + exact residualBall_sound_on (below (shape 3 3 10)) A3_3_10Law (fun u => (stageALaw (shape 3 3 10) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A3_3_10Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 3 3 10) (show (shape 3 3 10) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 12 a +def CA3_3_10I2R12Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA3_3_10I2R12Certificates_valid : + CA3_3_10I2R12Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA3_3_10I2R12CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA3_3_10I2R12P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_3_10I2R12Certificates (CA3_3_10I2R12CertificateIndex a)).input +lemma CA3_3_10I2R12P_check : ∀ a : PairSlot, contains (CA3_3_10I2R12Raw a) (CA3_3_10I2R12P a) = true := by + decide +kernel +lemma CA3_3_10I2R12P_sound (a : PairSlot) : + (CA3_3_10I2R12P a).Encloses (CA3_3_10I2R12Value a) := + contains_sound (CA3_3_10I2R12Raw_sound a) (CA3_3_10I2R12P_check a) +def CA3_3_10I2R12Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_3_10I2R12Certificates (CA3_3_10I2R12CertificateIndex a)).output +lemma CA3_3_10I2R12Terms_sound (a : PairSlot) : + (CA3_3_10I2R12Terms a).Encloses (Foundation.entropyTerm (CA3_3_10I2R12Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA3_3_10I2R12Certificates_valid + (CA3_3_10I2R12CertificateIndex a) (CA3_3_10I2R12P_sound a) +def CA3_3_10I2R12Entropy : Ball := ⟨0, 0⟩ +lemma CA3_3_10I2R12Entropy_sound : CA3_3_10I2R12Entropy.Encloses (Foundation.finiteEntropy CA3_3_10I2R12Value) := by + exact contains_sound (entropyPair_enclosed CA3_3_10I2R12Value CA3_3_10I2R12Terms CA3_3_10I2R12Terms_sound) (by decide +kernel) +def CA3_3_10I2R12Mass : Ball := ⟨0, 0⟩ +lemma CA3_3_10I2R12Mass_sound : CA3_3_10I2R12Mass.Encloses (∑ a, CA3_3_10I2R12Value a) := by + exact contains_sound (pairSumBall_sound CA3_3_10I2R12P CA3_3_10I2R12Value CA3_3_10I2R12P_sound) (by decide +kernel) +def CA3_3_10I2R12MassTerm : Ball := .exact 0 +lemma CA3_3_10I2R12MassTerm_sound : CA3_3_10I2R12MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA3_3_10I2R12Value a))) := + entropyTerm_zero_ball (CA3_3_10I2R12Mass_sound) +def CA3_3_10I2R12H : Ball := ⟨0, 0⟩ +lemma CA3_3_10I2R12H_sound : CA3_3_10I2R12H.Encloses (homogeneousEntropy CA3_3_10I2R12Value) := by + exact contains_sound (homogeneous_enclosed CA3_3_10I2R12Value CA3_3_10I2R12MassTerm_sound CA3_3_10I2R12Entropy_sound) (by decide +kernel) +def CA3_3_10I2R13Value (a : PairSlot) : ℝ := residualLaw (below (shape 3 3 10)) (fun u => (stageALaw (shape 3 3 10) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 13 a +def CA3_3_10I2R13Raw (a : PairSlot) : Ball := residualBall (below (shape 3 3 10)) A3_3_10Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 13 a +lemma CA3_3_10I2R13Raw_sound (a : PairSlot) : + (CA3_3_10I2R13Raw a).Encloses (CA3_3_10I2R13Value a) := by + exact residualBall_sound_on (below (shape 3 3 10)) A3_3_10Law (fun u => (stageALaw (shape 3 3 10) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A3_3_10Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 3 3 10) (show (shape 3 3 10) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 13 a +def CA3_3_10I2R13Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA3_3_10I2R13Certificates_valid : + CA3_3_10I2R13Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA3_3_10I2R13CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA3_3_10I2R13P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_3_10I2R13Certificates (CA3_3_10I2R13CertificateIndex a)).input +lemma CA3_3_10I2R13P_check : ∀ a : PairSlot, contains (CA3_3_10I2R13Raw a) (CA3_3_10I2R13P a) = true := by + decide +kernel +lemma CA3_3_10I2R13P_sound (a : PairSlot) : + (CA3_3_10I2R13P a).Encloses (CA3_3_10I2R13Value a) := + contains_sound (CA3_3_10I2R13Raw_sound a) (CA3_3_10I2R13P_check a) +def CA3_3_10I2R13Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_3_10I2R13Certificates (CA3_3_10I2R13CertificateIndex a)).output +lemma CA3_3_10I2R13Terms_sound (a : PairSlot) : + (CA3_3_10I2R13Terms a).Encloses (Foundation.entropyTerm (CA3_3_10I2R13Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA3_3_10I2R13Certificates_valid + (CA3_3_10I2R13CertificateIndex a) (CA3_3_10I2R13P_sound a) +def CA3_3_10I2R13Entropy : Ball := ⟨0, 0⟩ +lemma CA3_3_10I2R13Entropy_sound : CA3_3_10I2R13Entropy.Encloses (Foundation.finiteEntropy CA3_3_10I2R13Value) := by + exact contains_sound (entropyPair_enclosed CA3_3_10I2R13Value CA3_3_10I2R13Terms CA3_3_10I2R13Terms_sound) (by decide +kernel) +def CA3_3_10I2R13Mass : Ball := ⟨0, 0⟩ +lemma CA3_3_10I2R13Mass_sound : CA3_3_10I2R13Mass.Encloses (∑ a, CA3_3_10I2R13Value a) := by + exact contains_sound (pairSumBall_sound CA3_3_10I2R13P CA3_3_10I2R13Value CA3_3_10I2R13P_sound) (by decide +kernel) +def CA3_3_10I2R13MassTerm : Ball := .exact 0 +lemma CA3_3_10I2R13MassTerm_sound : CA3_3_10I2R13MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA3_3_10I2R13Value a))) := + entropyTerm_zero_ball (CA3_3_10I2R13Mass_sound) +def CA3_3_10I2R13H : Ball := ⟨0, 0⟩ +lemma CA3_3_10I2R13H_sound : CA3_3_10I2R13H.Encloses (homogeneousEntropy CA3_3_10I2R13Value) := by + exact contains_sound (homogeneous_enclosed CA3_3_10I2R13Value CA3_3_10I2R13MassTerm_sound CA3_3_10I2R13Entropy_sound) (by decide +kernel) +def CA3_3_10I2R14Value (a : PairSlot) : ℝ := residualLaw (below (shape 3 3 10)) (fun u => (stageALaw (shape 3 3 10) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 14 a +def CA3_3_10I2R14Raw (a : PairSlot) : Ball := residualBall (below (shape 3 3 10)) A3_3_10Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 14 a +lemma CA3_3_10I2R14Raw_sound (a : PairSlot) : + (CA3_3_10I2R14Raw a).Encloses (CA3_3_10I2R14Value a) := by + exact residualBall_sound_on (below (shape 3 3 10)) A3_3_10Law (fun u => (stageALaw (shape 3 3 10) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A3_3_10Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 3 3 10) (show (shape 3 3 10) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 14 a +def CA3_3_10I2R14Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA3_3_10I2R14Certificates_valid : + CA3_3_10I2R14Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA3_3_10I2R14CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA3_3_10I2R14P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_3_10I2R14Certificates (CA3_3_10I2R14CertificateIndex a)).input +lemma CA3_3_10I2R14P_check : ∀ a : PairSlot, contains (CA3_3_10I2R14Raw a) (CA3_3_10I2R14P a) = true := by + decide +kernel +lemma CA3_3_10I2R14P_sound (a : PairSlot) : + (CA3_3_10I2R14P a).Encloses (CA3_3_10I2R14Value a) := + contains_sound (CA3_3_10I2R14Raw_sound a) (CA3_3_10I2R14P_check a) +def CA3_3_10I2R14Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_3_10I2R14Certificates (CA3_3_10I2R14CertificateIndex a)).output +lemma CA3_3_10I2R14Terms_sound (a : PairSlot) : + (CA3_3_10I2R14Terms a).Encloses (Foundation.entropyTerm (CA3_3_10I2R14Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA3_3_10I2R14Certificates_valid + (CA3_3_10I2R14CertificateIndex a) (CA3_3_10I2R14P_sound a) +def CA3_3_10I2R14Entropy : Ball := ⟨0, 0⟩ +lemma CA3_3_10I2R14Entropy_sound : CA3_3_10I2R14Entropy.Encloses (Foundation.finiteEntropy CA3_3_10I2R14Value) := by + exact contains_sound (entropyPair_enclosed CA3_3_10I2R14Value CA3_3_10I2R14Terms CA3_3_10I2R14Terms_sound) (by decide +kernel) +def CA3_3_10I2R14Mass : Ball := ⟨0, 0⟩ +lemma CA3_3_10I2R14Mass_sound : CA3_3_10I2R14Mass.Encloses (∑ a, CA3_3_10I2R14Value a) := by + exact contains_sound (pairSumBall_sound CA3_3_10I2R14P CA3_3_10I2R14Value CA3_3_10I2R14P_sound) (by decide +kernel) +def CA3_3_10I2R14MassTerm : Ball := .exact 0 +lemma CA3_3_10I2R14MassTerm_sound : CA3_3_10I2R14MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA3_3_10I2R14Value a))) := + entropyTerm_zero_ball (CA3_3_10I2R14Mass_sound) +def CA3_3_10I2R14H : Ball := ⟨0, 0⟩ +lemma CA3_3_10I2R14H_sound : CA3_3_10I2R14H.Encloses (homogeneousEntropy CA3_3_10I2R14Value) := by + exact contains_sound (homogeneous_enclosed CA3_3_10I2R14Value CA3_3_10I2R14MassTerm_sound CA3_3_10I2R14Entropy_sound) (by decide +kernel) +def CA3_3_10I2R15Value (a : PairSlot) : ℝ := residualLaw (below (shape 3 3 10)) (fun u => (stageALaw (shape 3 3 10) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 15 a +def CA3_3_10I2R15Raw (a : PairSlot) : Ball := residualBall (below (shape 3 3 10)) A3_3_10Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 15 a +lemma CA3_3_10I2R15Raw_sound (a : PairSlot) : + (CA3_3_10I2R15Raw a).Encloses (CA3_3_10I2R15Value a) := by + exact residualBall_sound_on (below (shape 3 3 10)) A3_3_10Law (fun u => (stageALaw (shape 3 3 10) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A3_3_10Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 3 3 10) (show (shape 3 3 10) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 15 a +def CA3_3_10I2R15Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA3_3_10I2R15Certificates_valid : + CA3_3_10I2R15Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA3_3_10I2R15CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA3_3_10I2R15P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_3_10I2R15Certificates (CA3_3_10I2R15CertificateIndex a)).input +lemma CA3_3_10I2R15P_check : ∀ a : PairSlot, contains (CA3_3_10I2R15Raw a) (CA3_3_10I2R15P a) = true := by + decide +kernel +lemma CA3_3_10I2R15P_sound (a : PairSlot) : + (CA3_3_10I2R15P a).Encloses (CA3_3_10I2R15Value a) := + contains_sound (CA3_3_10I2R15Raw_sound a) (CA3_3_10I2R15P_check a) +def CA3_3_10I2R15Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_3_10I2R15Certificates (CA3_3_10I2R15CertificateIndex a)).output +lemma CA3_3_10I2R15Terms_sound (a : PairSlot) : + (CA3_3_10I2R15Terms a).Encloses (Foundation.entropyTerm (CA3_3_10I2R15Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA3_3_10I2R15Certificates_valid + (CA3_3_10I2R15CertificateIndex a) (CA3_3_10I2R15P_sound a) +def CA3_3_10I2R15Entropy : Ball := ⟨0, 0⟩ +lemma CA3_3_10I2R15Entropy_sound : CA3_3_10I2R15Entropy.Encloses (Foundation.finiteEntropy CA3_3_10I2R15Value) := by + exact contains_sound (entropyPair_enclosed CA3_3_10I2R15Value CA3_3_10I2R15Terms CA3_3_10I2R15Terms_sound) (by decide +kernel) +def CA3_3_10I2R15Mass : Ball := ⟨0, 0⟩ +lemma CA3_3_10I2R15Mass_sound : CA3_3_10I2R15Mass.Encloses (∑ a, CA3_3_10I2R15Value a) := by + exact contains_sound (pairSumBall_sound CA3_3_10I2R15P CA3_3_10I2R15Value CA3_3_10I2R15P_sound) (by decide +kernel) +def CA3_3_10I2R15MassTerm : Ball := .exact 0 +lemma CA3_3_10I2R15MassTerm_sound : CA3_3_10I2R15MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA3_3_10I2R15Value a))) := + entropyTerm_zero_ball (CA3_3_10I2R15Mass_sound) +def CA3_3_10I2R15H : Ball := ⟨0, 0⟩ +lemma CA3_3_10I2R15H_sound : CA3_3_10I2R15H.Encloses (homogeneousEntropy CA3_3_10I2R15Value) := by + exact contains_sound (homogeneous_enclosed CA3_3_10I2R15Value CA3_3_10I2R15MassTerm_sound CA3_3_10I2R15Entropy_sound) (by decide +kernel) +def CA3_3_10I2R16Value (a : PairSlot) : ℝ := residualLaw (below (shape 3 3 10)) (fun u => (stageALaw (shape 3 3 10) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 16 a +def CA3_3_10I2R16Raw (a : PairSlot) : Ball := residualBall (below (shape 3 3 10)) A3_3_10Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 16 a +lemma CA3_3_10I2R16Raw_sound (a : PairSlot) : + (CA3_3_10I2R16Raw a).Encloses (CA3_3_10I2R16Value a) := by + exact residualBall_sound_on (below (shape 3 3 10)) A3_3_10Law (fun u => (stageALaw (shape 3 3 10) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A3_3_10Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 3 3 10) (show (shape 3 3 10) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 16 a +def CA3_3_10I2R16Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA3_3_10I2R16Certificates_valid : + CA3_3_10I2R16Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA3_3_10I2R16CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA3_3_10I2R16P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_3_10I2R16Certificates (CA3_3_10I2R16CertificateIndex a)).input +lemma CA3_3_10I2R16P_check : ∀ a : PairSlot, contains (CA3_3_10I2R16Raw a) (CA3_3_10I2R16P a) = true := by + decide +kernel +lemma CA3_3_10I2R16P_sound (a : PairSlot) : + (CA3_3_10I2R16P a).Encloses (CA3_3_10I2R16Value a) := + contains_sound (CA3_3_10I2R16Raw_sound a) (CA3_3_10I2R16P_check a) +def CA3_3_10I2R16Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_3_10I2R16Certificates (CA3_3_10I2R16CertificateIndex a)).output +lemma CA3_3_10I2R16Terms_sound (a : PairSlot) : + (CA3_3_10I2R16Terms a).Encloses (Foundation.entropyTerm (CA3_3_10I2R16Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA3_3_10I2R16Certificates_valid + (CA3_3_10I2R16CertificateIndex a) (CA3_3_10I2R16P_sound a) +def CA3_3_10I2R16Entropy : Ball := ⟨0, 0⟩ +lemma CA3_3_10I2R16Entropy_sound : CA3_3_10I2R16Entropy.Encloses (Foundation.finiteEntropy CA3_3_10I2R16Value) := by + exact contains_sound (entropyPair_enclosed CA3_3_10I2R16Value CA3_3_10I2R16Terms CA3_3_10I2R16Terms_sound) (by decide +kernel) +def CA3_3_10I2R16Mass : Ball := ⟨0, 0⟩ +lemma CA3_3_10I2R16Mass_sound : CA3_3_10I2R16Mass.Encloses (∑ a, CA3_3_10I2R16Value a) := by + exact contains_sound (pairSumBall_sound CA3_3_10I2R16P CA3_3_10I2R16Value CA3_3_10I2R16P_sound) (by decide +kernel) +def CA3_3_10I2R16MassTerm : Ball := .exact 0 +lemma CA3_3_10I2R16MassTerm_sound : CA3_3_10I2R16MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA3_3_10I2R16Value a))) := + entropyTerm_zero_ball (CA3_3_10I2R16Mass_sound) +def CA3_3_10I2R16H : Ball := ⟨0, 0⟩ +lemma CA3_3_10I2R16H_sound : CA3_3_10I2R16H.Encloses (homogeneousEntropy CA3_3_10I2R16Value) := by + exact contains_sound (homogeneous_enclosed CA3_3_10I2R16Value CA3_3_10I2R16MassTerm_sound CA3_3_10I2R16Entropy_sound) (by decide +kernel) +def CA3_3_10I2ResidualEntropies (a : Fin 17) : Ball := + match a.val with + | 0 => CA3_3_10I2R0H + | 1 => CA3_3_10I2R1H + | 2 => CA3_3_10I2R2H + | 3 => CA3_3_10I2R3H + | 4 => CA3_3_10I2R4H + | 5 => CA3_3_10I2R5H + | 6 => CA3_3_10I2R6H + | 7 => CA3_3_10I2R7H + | 8 => CA3_3_10I2R8H + | 9 => CA3_3_10I2R9H + | 10 => CA3_3_10I2R10H + | 11 => CA3_3_10I2R11H + | 12 => CA3_3_10I2R12H + | 13 => CA3_3_10I2R13H + | 14 => CA3_3_10I2R14H + | 15 => CA3_3_10I2R15H + | 16 => CA3_3_10I2R16H + | _ => (.exact 0) +lemma CA3_3_10I2ResidualEntropies_sound (k : Fin 17) : + (CA3_3_10I2ResidualEntropies k).Encloses (homogeneousEntropy + (residualLaw (below (shape 3 3 10)) (fun u => (stageALaw (shape 3 3 10) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) k)) := by + fin_cases k + · exact CA3_3_10I2R0H_sound + · exact CA3_3_10I2R1H_sound + · exact CA3_3_10I2R2H_sound + · exact CA3_3_10I2R3H_sound + · exact CA3_3_10I2R4H_sound + · exact CA3_3_10I2R5H_sound + · exact CA3_3_10I2R6H_sound + · exact CA3_3_10I2R7H_sound + · exact CA3_3_10I2R8H_sound + · exact CA3_3_10I2R9H_sound + · exact CA3_3_10I2R10H_sound + · exact CA3_3_10I2R11H_sound + · exact CA3_3_10I2R12H_sound + · exact CA3_3_10I2R13H_sound + · exact CA3_3_10I2R14H_sound + · exact CA3_3_10I2R15H_sound + · exact CA3_3_10I2R16H_sound +def CA3_3_10I2Singles (s : Shape) : Ball := + match s 0, s 1, s 2 with + | 0, 0, 8 => Z0_0_8H2H + | 0, 1, 7 => Z0_1_7H2H + | 0, 2, 6 => Z0_2_6H2H + | 0, 3, 5 => Z0_3_5H2H + | 1, 0, 7 => Z1_0_7H2H + | 2, 0, 6 => Z2_0_6H2H + | 3, 0, 5 => Z3_0_5H2H + | _, _, _ => (.exact 0) +lemma CA3_3_10I2Singles_sound (u : Shape) (hu : u ∈ below (shape 3 3 10)) + (hd : designated (Equiv.refl (Fin 3)) 2 u) : + (CA3_3_10I2Singles u).Encloses (homogeneousEntropy ((fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) u)) := by + rw [A3_3_10_below] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl + · exact Z0_0_8H2H_sound + · exact Z0_1_7H2H_sound + · exact Z0_2_6H2H_sound + · exact Z0_3_5H2H_sound + · exact Z1_0_7H2H_sound + · exact (show ¬ designated (Equiv.refl (Fin 3)) 2 (shape 1 1 6) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 2 (shape 1 2 5) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 2 (shape 1 3 4) by decide +kernel) hd |>.elim + · exact Z2_0_6H2H_sound + · exact (show ¬ designated (Equiv.refl (Fin 3)) 2 (shape 2 1 5) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 2 (shape 2 2 4) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 2 (shape 2 3 3) by decide +kernel) hd |>.elim + · exact Z3_0_5H2H_sound + · exact (show ¬ designated (Equiv.refl (Fin 3)) 2 (shape 3 1 4) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 2 (shape 3 2 3) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 2 (shape 3 3 2) by decide +kernel) hd |>.elim +def CA3_3_10I2Singleton : Ball := ⟨(24142252657962249439325503564723 / 100000000000000000000000000000000), (9777366223 / 50000000000000000000000000000000)⟩ +lemma CA3_3_10I2Singleton_sound : CA3_3_10I2Singleton.Encloses + (singletonEntropy (below (shape 3 3 10)) (fun u => (stageALaw (shape 3 3 10) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ))) := by + exact contains_sound (singletonBall_sound (below (shape 3 3 10)) A3_3_10Law (fun u => (stageALaw (shape 3 3 10) u : ℝ)) (Equiv.refl (Fin 3)) 2 + CA3_3_10I2Singles (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A3_3_10Law_sound u) CA3_3_10I2Singles_sound) (by decide +kernel) +def CA3_3_10I2Group : Ball := ⟨(83438278599254707218444497574729 / 100000000000000000000000000000000), (155658116763 / 100000000000000000000000000000000)⟩ +lemma CA3_3_10I2Group_sound : CA3_3_10I2Group.Encloses + (groupedEntropy (below (shape 3 3 10)) (fun u => (stageALaw (shape 3 3 10) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ))) := by + exact contains_sound (Ball.add_sound CA3_3_10I2Singleton_sound + (finSumBall_sound 17 CA3_3_10I2ResidualEntropies _ CA3_3_10I2ResidualEntropies_sound)) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CA3_3_10I2H : Ball := ⟨(28617512088637626964024434023143 / 25000000000000000000000000000000), (452848691841 / 100000000000000000000000000000000)⟩ +lemma CA3_3_10I2_sound : CA3_3_10I2H.Encloses (stageACapacity (shape 3 3 10) 2) := by + have hb := contains_sound (Ball.add_sound CA3_3_10I2PairH_sound + (Ball.neg_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) CA3_3_10I2Group_sound))) + (show contains (.add CA3_3_10I2PairH (.neg (.mul (.exact 2) CA3_3_10I2Group))) CA3_3_10I2H = true by decide +kernel) + simp only [stageACapacity, nativeCapacity, + show (2 : Fin 3) ≠ 0 by decide, ite_false, sub_eq_add_neg] + exact hb + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA3_3_10I2Pair.lean b/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA3_3_10I2Pair.lean new file mode 100644 index 0000000000000000000000000000000000000000..7371751978a7ab3b85371c923e72882d6db7e721 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA3_3_10I2Pair.lean @@ -0,0 +1,324 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Certificates.SupportedContraction + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CA3_3_10I2PairValue (a : PairSlot × PairSlot) : ℝ := pairLaw (below (shape 3 3 10)) (shape 3 3 10) (fun u => (stageALaw (shape 3 3 10) u : ℝ)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) a +def CA3_3_10I2PairRaw (a : PairSlot × PairSlot) : Ball := stageAPairBall (shape 3 3 10) A3_3_10Law 2 a +lemma CA3_3_10I2PairRaw_sound (a : PairSlot × PairSlot) : + (CA3_3_10I2PairRaw a).Encloses (CA3_3_10I2PairValue a) := by + exact stageAPairBall_sound (shape 3 3 10) (by decide +kernel) A3_3_10Law (fun u => (stageALaw (shape 3 3 10) u : ℝ)) (fun u _ => A3_3_10Law_sound u) 2 a +def CA3_3_10I2PairCertificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(204410733265658976046433123 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(2536206180674890189163805149 / 50000000000000000000000000000000), (1644869 / 100000000000000000000000000000000)⟩ ⟨(-1240740219535709226456799424257063 / 100000000000000000000000000000000), (201170447291 / 50000000000000000000000000000000)⟩ ⟨-18, 204410733265658976046433123, 190734863281250000000000000⟩, + .log ⟨(5044486655977323258061011 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(311065051000710648768908957 / 100000000000000000000000000000000), (51283 / 50000000000000000000000000000000)⟩ ⟨(-770804524361569139790725698710741 / 50000000000000000000000000000000), (508224724297 / 100000000000000000000000000000000)⟩ ⟨-23, 5044486655977323258061011, 2980232238769531250000000⟩, + .log ⟨(292437207758310337832007369 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(16278506733108100910470138241 / 100000000000000000000000000000000), (696669 / 12500000000000000000000000000000)⟩ ⟨(-1113299286222274925386142123835681 / 100000000000000000000000000000000), (95291223671 / 25000000000000000000000000000000)⟩ ⟨-17, 292437207758310337832007369, 152587890625000000000000000⟩, + .log ⟨(4934993434450625004229415309 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(48938228186735117043879665543 / 100000000000000000000000000000000), (836021 / 5000000000000000000000000000000)⟩ ⟨(-495828706124540517352093945298019 / 50000000000000000000000000000000), (338813199191 / 100000000000000000000000000000000)⟩ ⟨-15, 4934993434450625004229415309, 3051757812500000000000000000⟩, + .log ⟨(175233933607446664287063364453 / 100000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ ⟨(1112175364210117211539520601039 / 100000000000000000000000000000000), (102044883 / 25000000000000000000000000000000)⟩ ⟨(-317340181012421984369473765386039 / 50000000000000000000000000000000), (116467030827 / 50000000000000000000000000000000)⟩ ⟨-10, 175233933607446664287063364453, 97656250000000000000000000000⟩, + .log ⟨(961599234466952241769965399 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(72871078015094353810140645977 / 100000000000000000000000000000000), (12217599 / 50000000000000000000000000000000)⟩ ⟨(-947264143459532235120336410891477 / 100000000000000000000000000000000), (79409342061 / 25000000000000000000000000000000)⟩ ⟨-14, 961599234466952241769965399, 762939453125000000000000000⟩, + .log ⟨(5871689088105631771894841 / 1250000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(5762950933839117609657174883 / 100000000000000000000000000000000), (1889949 / 100000000000000000000000000000000)⟩ ⟨(-122685117675789691751799736644629 / 10000000000000000000000000000000), (201170431431 / 50000000000000000000000000000000)⟩ ⟨-18, 5871689088105631771894841, 4768371582031250000000000⟩, + .log ⟨(4050305691172672147315614513 / 2500000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ ⟨(520484828782513672292528162173 / 50000000000000000000000000000000), (94345419 / 25000000000000000000000000000000)⟩ ⟨(-80315670666054614559172723874151 / 12500000000000000000000000000000), (232934061747 / 100000000000000000000000000000000)⟩ ⟨-10, 4050305691172672147315614513, 2441406250000000000000000000⟩, + .log ⟨(418273263090507033722808934973 / 25000000000000000000000000000000), (11 / 100000000000000000000000000000000)⟩ ⟨(342189034084905173355462187149 / 5000000000000000000000000000000), (24800387 / 1000000000000000000000000000000)⟩ ⟨(-409049614546915754975309987836739 / 100000000000000000000000000000000), (148230766437 / 100000000000000000000000000000000)⟩ ⟨-6, 418273263090507033722808934973, 390625000000000000000000000000⟩, + .log ⟨(43550651888415478022380834641 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(613703035868456443237920123789 / 100000000000000000000000000000000), (221333031 / 100000000000000000000000000000000)⟩ ⟨(-11009146269513529215245308945763 / 1562500000000000000000000000000), (7940933917 / 3125000000000000000000000000000)⟩ ⟨-11, 43550651888415478022380834641, 24414062500000000000000000000⟩, + .log ⟨(607537852084135341396088357 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(7297298906064336848897059441 / 100000000000000000000000000000000), (488877 / 20000000000000000000000000000000)⟩ ⟨(-300281656568032441758200308567621 / 25000000000000000000000000000000), (16093632583 / 4000000000000000000000000000000)⟩ ⟨-18, 607537852084135341396088357, 381469726562500000000000000⟩, + .log ⟨(1453201524880646734062919 / 4000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(269351553823383360304302949 / 50000000000000000000000000000000), (553 / 312500000000000000000000000000)⟩ ⟨(-1482803584839373419339216820051167 / 100000000000000000000000000000000), (121761674313 / 25000000000000000000000000000000)⟩ ⟨-22, 1453201524880646734062919, 953674316406250000000000⟩, + .log ⟨(12548458165396817115804218967 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(56363455678127937803501150317 / 50000000000000000000000000000000), (18600681 / 50000000000000000000000000000000)⟩ ⟨(-898332766228663897639327705881603 / 100000000000000000000000000000000), (29646153953 / 10000000000000000000000000000000)⟩ ⟨-13, 12548458165396817115804218967, 12207031250000000000000000000⟩, + .log ⟨(64775685545024183170200832149 / 50000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ ⟨(430683685635244650732519388739 / 50000000000000000000000000000000), (60353857 / 20000000000000000000000000000000)⟩ ⟨(-332442398726822969442886901555411 / 50000000000000000000000000000000), (29116757757 / 12500000000000000000000000000000)⟩ ⟨-10, 64775685545024183170200832149, 48828125000000000000000000000⟩, + .log ⟨(425958125380044971954451813 / 6250000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(65384578907853638055446953851 / 100000000000000000000000000000000), (4329609 / 20000000000000000000000000000000)⟩ ⟨(-191875019550092890341353968721337 / 20000000000000000000000000000000), (317637369917 / 100000000000000000000000000000000)⟩ ⟨-14, 425958125380044971954451813, 381469726562500000000000000⟩, + .log ⟨(1415603925488974129574141 / 6250000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(69310395235610980937462773 / 20000000000000000000000000000000), (115127 / 100000000000000000000000000000000)⟩ ⟨(-382513394480148558826260135801393 / 25000000000000000000000000000000), (508224183469 / 100000000000000000000000000000000)⟩ ⟨-23, 1415603925488974129574141, 745058059692382812500000⟩, + .log ⟨(3666695441625093418091734963 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(37450287551812984313625466319 / 100000000000000000000000000000000), (12423259 / 100000000000000000000000000000000)⟩ ⟨(-510681731657741308022186952554799 / 50000000000000000000000000000000), (1694066031 / 500000000000000000000000000000)⟩ ⟨-15, 3666695441625093418091734963, 3051757812500000000000000000⟩, + .log ⟨(623131153636345927906855053617 / 50000000000000000000000000000000), (1 / 12500000000000000000000000000000)⟩ ⟨(5464886723269458416104593670051 / 100000000000000000000000000000000), (1055625257 / 50000000000000000000000000000000)⟩ ⟨(-54812765853730690868412213426323 / 12500000000000000000000000000000), (33881318021 / 20000000000000000000000000000000)⟩ ⟨-7, 623131153636345927906855053617, 390625000000000000000000000000⟩, + .log ⟨(1615724843235435956021384277169 / 12500000000000000000000000000000), (59 / 100000000000000000000000000000000)⟩ ⟨(26445472914215230525728977663187 / 100000000000000000000000000000000), (10948577589 / 100000000000000000000000000000000)⟩ ⟨(-204594496898208230742459671314833 / 100000000000000000000000000000000), (21175823797 / 25000000000000000000000000000000)⟩ ⟨-3, 1615724843235435956021384277169, 1562500000000000000000000000000⟩, + .log ⟨(116730619983234556761574673937 / 20000000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ ⟨(75052224474495784280253362347 / 2500000000000000000000000000000), (1112340187 / 100000000000000000000000000000000)⟩ ⟨(-64295233320336313751770935615981 / 12500000000000000000000000000000), (23822801729 / 12500000000000000000000000000000)⟩ ⟨-8, 116730619983234556761574673937, 78125000000000000000000000000⟩, + .log ⟨(4412406355912393229450294717 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(4384312412257593997767355903 / 1562500000000000000000000000000), (48586901 / 50000000000000000000000000000000)⟩ ⟨(-49681648273201823084575701067219 / 6250000000000000000000000000000), (275285710711 / 100000000000000000000000000000000)⟩ ⟨-12, 4412406355912393229450294717, 3051757812500000000000000000⟩, + .log ⟨(2045243619941926331434801581 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(46979095832153888661419402607 / 50000000000000000000000000000000), (324823 / 1000000000000000000000000000000)⟩ ⟨(-459398532029038541294548141283517 / 50000000000000000000000000000000), (317637365023 / 100000000000000000000000000000000)⟩ ⟨-14, 2045243619941926331434801581, 1220703125000000000000000000⟩, + .log ⟨(155664234709779771589449063501 / 100000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ ⟨(1006404164702139047156012084219 / 100000000000000000000000000000000), (181297519 / 50000000000000000000000000000000)⟩ ⟨(-323261205947042963234435705555549 / 50000000000000000000000000000000), (116467030899 / 50000000000000000000000000000000)⟩ ⟨-10, 155664234709779771589449063501, 97656250000000000000000000000⟩, + .log ⟨(15233069975923229976830594707 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(13389040963353386959298398457 / 10000000000000000000000000000000), (45160203 / 100000000000000000000000000000000)⟩ ⟨(-175789134882404660714829214764547 / 20000000000000000000000000000000), (148230769063 / 50000000000000000000000000000000)⟩ ⟨-13, 15233069975923229976830594707, 12207031250000000000000000000⟩, + .log ⟨(387518435308625164440643386013 / 3125000000000000000000000000000), (47 / 100000000000000000000000000000000)⟩ ⟨(25885315565076202415021638235089 / 100000000000000000000000000000000), (6564817721 / 50000000000000000000000000000000)⟩ ⟨(-52185653487968842688913201549153 / 25000000000000000000000000000000), (52939559397 / 50000000000000000000000000000000)⟩ ⟨-4, 387518435308625164440643386013, 195312500000000000000000000000⟩, + .log ⟨(589871674980925115350727521177 / 100000000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ ⟨(189238960724414761586399905391 / 6250000000000000000000000000000), (562095849 / 50000000000000000000000000000000)⟩ ⟨(-513302045175935589448682157593191 / 100000000000000000000000000000000), (7623296553 / 4000000000000000000000000000000)⟩ ⟨-8, 589871674980925115350727521177, 390625000000000000000000000000⟩, + .log ⟨(17694938469794387018181625999 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(281225644639099695989355535313 / 100000000000000000000000000000000), (97423283 / 100000000000000000000000000000000)⟩ ⟨(-31785998591535933491674436442611 / 4000000000000000000000000000000), (17205356919 / 6250000000000000000000000000000)⟩ ⟨-12, 17694938469794387018181625999, 12207031250000000000000000000⟩] +lemma CA3_3_10I2PairCertificates_valid : + CA3_3_10I2PairCertificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA3_3_10I2PairCertificateIndex (a : PairSlot × PairSlot) : ℕ := + match a.1.1.val, a.1.2.val, a.2.1.val, a.2.2.val with + | 5, 5, 2, 0 => 1 + | 5, 5, 3, 0 => 2 + | 5, 5, 1, 1 => 3 + | 5, 5, 0, 2 => 1 + | 5, 5, 0, 3 => 2 + | 4, 5, 4, 0 => 4 + | 4, 5, 2, 1 => 5 + | 4, 5, 3, 1 => 6 + | 4, 5, 1, 2 => 5 + | 4, 5, 1, 3 => 6 + | 4, 5, 0, 4 => 4 + | 5, 4, 4, 0 => 4 + | 5, 4, 2, 1 => 5 + | 5, 4, 3, 1 => 6 + | 5, 4, 1, 2 => 5 + | 5, 4, 1, 3 => 6 + | 5, 4, 0, 4 => 4 + | 2, 5, 5, 0 => 7 + | 2, 5, 4, 1 => 8 + | 2, 5, 2, 2 => 9 + | 2, 5, 2, 3 => 10 + | 2, 5, 3, 2 => 10 + | 2, 5, 3, 3 => 11 + | 2, 5, 1, 4 => 8 + | 2, 5, 0, 5 => 7 + | 3, 5, 5, 0 => 12 + | 3, 5, 4, 1 => 13 + | 3, 5, 2, 2 => 14 + | 3, 5, 2, 3 => 15 + | 3, 5, 3, 2 => 15 + | 3, 5, 3, 3 => 16 + | 3, 5, 1, 4 => 13 + | 3, 5, 0, 5 => 12 + | 4, 4, 5, 0 => 17 + | 4, 4, 4, 1 => 18 + | 4, 4, 2, 2 => 19 + | 4, 4, 2, 3 => 20 + | 4, 4, 3, 2 => 20 + | 4, 4, 3, 3 => 21 + | 4, 4, 1, 4 => 18 + | 4, 4, 0, 5 => 17 + | 5, 2, 5, 0 => 7 + | 5, 2, 4, 1 => 8 + | 5, 2, 2, 2 => 9 + | 5, 2, 2, 3 => 10 + | 5, 2, 3, 2 => 10 + | 5, 2, 3, 3 => 11 + | 5, 2, 1, 4 => 8 + | 5, 2, 0, 5 => 7 + | 5, 3, 5, 0 => 12 + | 5, 3, 4, 1 => 13 + | 5, 3, 2, 2 => 14 + | 5, 3, 2, 3 => 15 + | 5, 3, 3, 2 => 15 + | 5, 3, 3, 3 => 16 + | 5, 3, 1, 4 => 13 + | 5, 3, 0, 5 => 12 + | 1, 5, 1, 5 => 22 + | 1, 5, 2, 4 => 23 + | 1, 5, 3, 4 => 24 + | 1, 5, 4, 2 => 23 + | 1, 5, 4, 3 => 24 + | 1, 5, 5, 1 => 22 + | 2, 4, 1, 5 => 23 + | 2, 4, 2, 4 => 25 + | 2, 4, 3, 4 => 26 + | 2, 4, 4, 2 => 25 + | 2, 4, 4, 3 => 26 + | 2, 4, 5, 1 => 23 + | 3, 4, 1, 5 => 24 + | 3, 4, 2, 4 => 26 + | 3, 4, 3, 4 => 27 + | 3, 4, 4, 2 => 26 + | 3, 4, 4, 3 => 27 + | 3, 4, 5, 1 => 24 + | 4, 2, 1, 5 => 23 + | 4, 2, 2, 4 => 25 + | 4, 2, 3, 4 => 26 + | 4, 2, 4, 2 => 25 + | 4, 2, 4, 3 => 26 + | 4, 2, 5, 1 => 23 + | 4, 3, 1, 5 => 24 + | 4, 3, 2, 4 => 26 + | 4, 3, 3, 4 => 27 + | 4, 3, 4, 2 => 26 + | 4, 3, 4, 3 => 27 + | 4, 3, 5, 1 => 24 + | 5, 1, 1, 5 => 22 + | 5, 1, 2, 4 => 23 + | 5, 1, 3, 4 => 24 + | 5, 1, 4, 2 => 23 + | 5, 1, 4, 3 => 24 + | 5, 1, 5, 1 => 22 + | 5, 0, 2, 5 => 7 + | 5, 0, 3, 5 => 12 + | 5, 0, 4, 4 => 17 + | 5, 0, 5, 2 => 7 + | 5, 0, 5, 3 => 12 + | 4, 1, 2, 5 => 8 + | 4, 1, 3, 5 => 13 + | 4, 1, 4, 4 => 18 + | 4, 1, 5, 2 => 8 + | 4, 1, 5, 3 => 13 + | 2, 2, 2, 5 => 9 + | 2, 2, 3, 5 => 14 + | 2, 2, 4, 4 => 19 + | 2, 2, 5, 2 => 9 + | 2, 2, 5, 3 => 14 + | 2, 3, 2, 5 => 10 + | 2, 3, 3, 5 => 15 + | 2, 3, 4, 4 => 20 + | 2, 3, 5, 2 => 10 + | 2, 3, 5, 3 => 15 + | 3, 2, 2, 5 => 10 + | 3, 2, 3, 5 => 15 + | 3, 2, 4, 4 => 20 + | 3, 2, 5, 2 => 10 + | 3, 2, 5, 3 => 15 + | 3, 3, 2, 5 => 11 + | 3, 3, 3, 5 => 16 + | 3, 3, 4, 4 => 21 + | 3, 3, 5, 2 => 11 + | 3, 3, 5, 3 => 16 + | 1, 4, 2, 5 => 8 + | 1, 4, 3, 5 => 13 + | 1, 4, 4, 4 => 18 + | 1, 4, 5, 2 => 8 + | 1, 4, 5, 3 => 13 + | 0, 5, 2, 5 => 7 + | 0, 5, 3, 5 => 12 + | 0, 5, 4, 4 => 17 + | 0, 5, 5, 2 => 7 + | 0, 5, 5, 3 => 12 + | 4, 0, 4, 5 => 4 + | 4, 0, 5, 4 => 4 + | 2, 1, 4, 5 => 5 + | 2, 1, 5, 4 => 5 + | 3, 1, 4, 5 => 6 + | 3, 1, 5, 4 => 6 + | 1, 2, 4, 5 => 5 + | 1, 2, 5, 4 => 5 + | 1, 3, 4, 5 => 6 + | 1, 3, 5, 4 => 6 + | 0, 4, 4, 5 => 4 + | 0, 4, 5, 4 => 4 + | 2, 0, 5, 5 => 1 + | 3, 0, 5, 5 => 2 + | 1, 1, 5, 5 => 3 + | 0, 2, 5, 5 => 1 + | 0, 3, 5, 5 => 2 + | _, _, _, _ => 0 +def CA3_3_10I2PairP (a : PairSlot × PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_3_10I2PairCertificates (CA3_3_10I2PairCertificateIndex a)).input +lemma CA3_3_10I2PairP_check_0_0 : ∀ k l : Fin 6, contains (CA3_3_10I2PairRaw ((0,0),(k,l))) (CA3_3_10I2PairP ((0,0),(k,l))) = true := by + decide +kernel +lemma CA3_3_10I2PairP_check_0_1 : ∀ k l : Fin 6, contains (CA3_3_10I2PairRaw ((0,1),(k,l))) (CA3_3_10I2PairP ((0,1),(k,l))) = true := by + decide +kernel +lemma CA3_3_10I2PairP_check_0_2 : ∀ k l : Fin 6, contains (CA3_3_10I2PairRaw ((0,2),(k,l))) (CA3_3_10I2PairP ((0,2),(k,l))) = true := by + decide +kernel +lemma CA3_3_10I2PairP_check_0_3 : ∀ k l : Fin 6, contains (CA3_3_10I2PairRaw ((0,3),(k,l))) (CA3_3_10I2PairP ((0,3),(k,l))) = true := by + decide +kernel +lemma CA3_3_10I2PairP_check_0_4 : ∀ k l : Fin 6, contains (CA3_3_10I2PairRaw ((0,4),(k,l))) (CA3_3_10I2PairP ((0,4),(k,l))) = true := by + decide +kernel +lemma CA3_3_10I2PairP_check_0_5 : ∀ k l : Fin 6, contains (CA3_3_10I2PairRaw ((0,5),(k,l))) (CA3_3_10I2PairP ((0,5),(k,l))) = true := by + decide +kernel +lemma CA3_3_10I2PairP_check_1_0 : ∀ k l : Fin 6, contains (CA3_3_10I2PairRaw ((1,0),(k,l))) (CA3_3_10I2PairP ((1,0),(k,l))) = true := by + decide +kernel +lemma CA3_3_10I2PairP_check_1_1 : ∀ k l : Fin 6, contains (CA3_3_10I2PairRaw ((1,1),(k,l))) (CA3_3_10I2PairP ((1,1),(k,l))) = true := by + decide +kernel +lemma CA3_3_10I2PairP_check_1_2 : ∀ k l : Fin 6, contains (CA3_3_10I2PairRaw ((1,2),(k,l))) (CA3_3_10I2PairP ((1,2),(k,l))) = true := by + decide +kernel +lemma CA3_3_10I2PairP_check_1_3 : ∀ k l : Fin 6, contains (CA3_3_10I2PairRaw ((1,3),(k,l))) (CA3_3_10I2PairP ((1,3),(k,l))) = true := by + decide +kernel +lemma CA3_3_10I2PairP_check_1_4 : ∀ k l : Fin 6, contains (CA3_3_10I2PairRaw ((1,4),(k,l))) (CA3_3_10I2PairP ((1,4),(k,l))) = true := by + decide +kernel +lemma CA3_3_10I2PairP_check_1_5 : ∀ k l : Fin 6, contains (CA3_3_10I2PairRaw ((1,5),(k,l))) (CA3_3_10I2PairP ((1,5),(k,l))) = true := by + decide +kernel +lemma CA3_3_10I2PairP_check_2_0 : ∀ k l : Fin 6, contains (CA3_3_10I2PairRaw ((2,0),(k,l))) (CA3_3_10I2PairP ((2,0),(k,l))) = true := by + decide +kernel +lemma CA3_3_10I2PairP_check_2_1 : ∀ k l : Fin 6, contains (CA3_3_10I2PairRaw ((2,1),(k,l))) (CA3_3_10I2PairP ((2,1),(k,l))) = true := by + decide +kernel +lemma CA3_3_10I2PairP_check_2_2 : ∀ k l : Fin 6, contains (CA3_3_10I2PairRaw ((2,2),(k,l))) (CA3_3_10I2PairP ((2,2),(k,l))) = true := by + decide +kernel +lemma CA3_3_10I2PairP_check_2_3 : ∀ k l : Fin 6, contains (CA3_3_10I2PairRaw ((2,3),(k,l))) (CA3_3_10I2PairP ((2,3),(k,l))) = true := by + decide +kernel +lemma CA3_3_10I2PairP_check_2_4 : ∀ k l : Fin 6, contains (CA3_3_10I2PairRaw ((2,4),(k,l))) (CA3_3_10I2PairP ((2,4),(k,l))) = true := by + decide +kernel +lemma CA3_3_10I2PairP_check_2_5 : ∀ k l : Fin 6, contains (CA3_3_10I2PairRaw ((2,5),(k,l))) (CA3_3_10I2PairP ((2,5),(k,l))) = true := by + decide +kernel +lemma CA3_3_10I2PairP_check_3_0 : ∀ k l : Fin 6, contains (CA3_3_10I2PairRaw ((3,0),(k,l))) (CA3_3_10I2PairP ((3,0),(k,l))) = true := by + decide +kernel +lemma CA3_3_10I2PairP_check_3_1 : ∀ k l : Fin 6, contains (CA3_3_10I2PairRaw ((3,1),(k,l))) (CA3_3_10I2PairP ((3,1),(k,l))) = true := by + decide +kernel +lemma CA3_3_10I2PairP_check_3_2 : ∀ k l : Fin 6, contains (CA3_3_10I2PairRaw ((3,2),(k,l))) (CA3_3_10I2PairP ((3,2),(k,l))) = true := by + decide +kernel +lemma CA3_3_10I2PairP_check_3_3 : ∀ k l : Fin 6, contains (CA3_3_10I2PairRaw ((3,3),(k,l))) (CA3_3_10I2PairP ((3,3),(k,l))) = true := by + decide +kernel +lemma CA3_3_10I2PairP_check_3_4 : ∀ k l : Fin 6, contains (CA3_3_10I2PairRaw ((3,4),(k,l))) (CA3_3_10I2PairP ((3,4),(k,l))) = true := by + decide +kernel +lemma CA3_3_10I2PairP_check_3_5 : ∀ k l : Fin 6, contains (CA3_3_10I2PairRaw ((3,5),(k,l))) (CA3_3_10I2PairP ((3,5),(k,l))) = true := by + decide +kernel +lemma CA3_3_10I2PairP_check_4_0 : ∀ k l : Fin 6, contains (CA3_3_10I2PairRaw ((4,0),(k,l))) (CA3_3_10I2PairP ((4,0),(k,l))) = true := by + decide +kernel +lemma CA3_3_10I2PairP_check_4_1 : ∀ k l : Fin 6, contains (CA3_3_10I2PairRaw ((4,1),(k,l))) (CA3_3_10I2PairP ((4,1),(k,l))) = true := by + decide +kernel +lemma CA3_3_10I2PairP_check_4_2 : ∀ k l : Fin 6, contains (CA3_3_10I2PairRaw ((4,2),(k,l))) (CA3_3_10I2PairP ((4,2),(k,l))) = true := by + decide +kernel +lemma CA3_3_10I2PairP_check_4_3 : ∀ k l : Fin 6, contains (CA3_3_10I2PairRaw ((4,3),(k,l))) (CA3_3_10I2PairP ((4,3),(k,l))) = true := by + decide +kernel +lemma CA3_3_10I2PairP_check_4_4 : ∀ k l : Fin 6, contains (CA3_3_10I2PairRaw ((4,4),(k,l))) (CA3_3_10I2PairP ((4,4),(k,l))) = true := by + decide +kernel +lemma CA3_3_10I2PairP_check_4_5 : ∀ k l : Fin 6, contains (CA3_3_10I2PairRaw ((4,5),(k,l))) (CA3_3_10I2PairP ((4,5),(k,l))) = true := by + decide +kernel +lemma CA3_3_10I2PairP_check_5_0 : ∀ k l : Fin 6, contains (CA3_3_10I2PairRaw ((5,0),(k,l))) (CA3_3_10I2PairP ((5,0),(k,l))) = true := by + decide +kernel +lemma CA3_3_10I2PairP_check_5_1 : ∀ k l : Fin 6, contains (CA3_3_10I2PairRaw ((5,1),(k,l))) (CA3_3_10I2PairP ((5,1),(k,l))) = true := by + decide +kernel +lemma CA3_3_10I2PairP_check_5_2 : ∀ k l : Fin 6, contains (CA3_3_10I2PairRaw ((5,2),(k,l))) (CA3_3_10I2PairP ((5,2),(k,l))) = true := by + decide +kernel +lemma CA3_3_10I2PairP_check_5_3 : ∀ k l : Fin 6, contains (CA3_3_10I2PairRaw ((5,3),(k,l))) (CA3_3_10I2PairP ((5,3),(k,l))) = true := by + decide +kernel +lemma CA3_3_10I2PairP_check_5_4 : ∀ k l : Fin 6, contains (CA3_3_10I2PairRaw ((5,4),(k,l))) (CA3_3_10I2PairP ((5,4),(k,l))) = true := by + decide +kernel +lemma CA3_3_10I2PairP_check_5_5 : ∀ k l : Fin 6, contains (CA3_3_10I2PairRaw ((5,5),(k,l))) (CA3_3_10I2PairP ((5,5),(k,l))) = true := by + decide +kernel +lemma CA3_3_10I2PairP_check (a : PairSlot × PairSlot) : contains (CA3_3_10I2PairRaw a) (CA3_3_10I2PairP a) = true := by + rcases a with ⟨⟨i,j⟩,⟨k,l⟩⟩ + revert j i + apply forall_fin6 + · exact forall_fin6 (CA3_3_10I2PairP_check_0_0 k l) (CA3_3_10I2PairP_check_0_1 k l) (CA3_3_10I2PairP_check_0_2 k l) (CA3_3_10I2PairP_check_0_3 k l) (CA3_3_10I2PairP_check_0_4 k l) (CA3_3_10I2PairP_check_0_5 k l) + · exact forall_fin6 (CA3_3_10I2PairP_check_1_0 k l) (CA3_3_10I2PairP_check_1_1 k l) (CA3_3_10I2PairP_check_1_2 k l) (CA3_3_10I2PairP_check_1_3 k l) (CA3_3_10I2PairP_check_1_4 k l) (CA3_3_10I2PairP_check_1_5 k l) + · exact forall_fin6 (CA3_3_10I2PairP_check_2_0 k l) (CA3_3_10I2PairP_check_2_1 k l) (CA3_3_10I2PairP_check_2_2 k l) (CA3_3_10I2PairP_check_2_3 k l) (CA3_3_10I2PairP_check_2_4 k l) (CA3_3_10I2PairP_check_2_5 k l) + · exact forall_fin6 (CA3_3_10I2PairP_check_3_0 k l) (CA3_3_10I2PairP_check_3_1 k l) (CA3_3_10I2PairP_check_3_2 k l) (CA3_3_10I2PairP_check_3_3 k l) (CA3_3_10I2PairP_check_3_4 k l) (CA3_3_10I2PairP_check_3_5 k l) + · exact forall_fin6 (CA3_3_10I2PairP_check_4_0 k l) (CA3_3_10I2PairP_check_4_1 k l) (CA3_3_10I2PairP_check_4_2 k l) (CA3_3_10I2PairP_check_4_3 k l) (CA3_3_10I2PairP_check_4_4 k l) (CA3_3_10I2PairP_check_4_5 k l) + · exact forall_fin6 (CA3_3_10I2PairP_check_5_0 k l) (CA3_3_10I2PairP_check_5_1 k l) (CA3_3_10I2PairP_check_5_2 k l) (CA3_3_10I2PairP_check_5_3 k l) (CA3_3_10I2PairP_check_5_4 k l) (CA3_3_10I2PairP_check_5_5 k l) +lemma CA3_3_10I2PairP_sound (a : PairSlot × PairSlot) : + (CA3_3_10I2PairP a).Encloses (CA3_3_10I2PairValue a) := + contains_sound (CA3_3_10I2PairRaw_sound a) (CA3_3_10I2PairP_check a) +def CA3_3_10I2PairTerms (a : PairSlot × PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_3_10I2PairCertificates (CA3_3_10I2PairCertificateIndex a)).output +lemma CA3_3_10I2PairTerms_sound (a : PairSlot × PairSlot) : + (CA3_3_10I2PairTerms a).Encloses (Foundation.entropyTerm (CA3_3_10I2PairValue a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA3_3_10I2PairCertificates_valid + (CA3_3_10I2PairCertificateIndex a) (CA3_3_10I2PairP_sound a) +def CA3_3_10I2PairEntropy : Ball := ⟨(14067330277652996114649336562101 / 5000000000000000000000000000000), (2407132681 / 2000000000000000000000000000000)⟩ +lemma CA3_3_10I2PairEntropy_sound : CA3_3_10I2PairEntropy.Encloses (Foundation.finiteEntropy CA3_3_10I2PairValue) := by + exact contains_sound (entropyDoublePair_enclosed CA3_3_10I2PairValue CA3_3_10I2PairTerms CA3_3_10I2PairTerms_sound) (by decide +kernel) +def CA3_3_10I2PairMass : Ball := ⟨(10000000000000000000000000000001 / 10000000000000000000000000000000), (291 / 50000000000000000000000000000000)⟩ +lemma CA3_3_10I2PairMass_sound : CA3_3_10I2PairMass.Encloses (∑ a, CA3_3_10I2PairValue a) := by + exact contains_sound (doublePairSumBall_sound CA3_3_10I2PairP CA3_3_10I2PairValue CA3_3_10I2PairP_sound) (by decide +kernel) +def CA3_3_10I2PairMassTermLogWitness : LogWitness := ⟨0, 10000000000000000000000000000001, 10000000000000000000000000000000⟩ +def CA3_3_10I2PairMassTermLog : Ball := ⟨(1 / 10000000000000000000000000000000), (2646978033 / 12500000000000000000000000000000)⟩ +lemma CA3_3_10I2PairMassTermLog_sound : CA3_3_10I2PairMassTermLog.Encloses (Real.log ((∑ a, CA3_3_10I2PairValue a))) := by + exact checkLog_sound logTwoBall_sound (CA3_3_10I2PairMass_sound) (w := CA3_3_10I2PairMassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA3_3_10I2PairMassTerm : Ball := ⟨(-1 / 10000000000000000000000000000000), (4235164853 / 20000000000000000000000000000000)⟩ +lemma CA3_3_10I2PairMassTerm_sound : CA3_3_10I2PairMassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA3_3_10I2PairValue a))) := by + exact contains_sound (entropyTerm_ball (CA3_3_10I2PairMass_sound) CA3_3_10I2PairMassTermLog_sound) (by decide +kernel) +def CA3_3_10I2PairH : Ball := ⟨(28134660555305992229298673124203 / 10000000000000000000000000000000), (28306491663 / 20000000000000000000000000000000)⟩ +lemma CA3_3_10I2PairH_sound : CA3_3_10I2PairH.Encloses (homogeneousEntropy CA3_3_10I2PairValue) := by + exact contains_sound (homogeneous_enclosed CA3_3_10I2PairValue CA3_3_10I2PairMassTerm_sound CA3_3_10I2PairEntropy_sound) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA3_4_9I0.lean b/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA3_4_9I0.lean new file mode 100644 index 0000000000000000000000000000000000000000..c385805f0952253e9badd2c0c6e5fc581ff8d93d --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA3_4_9I0.lean @@ -0,0 +1,75 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Certificates.SplitA3_4_9 + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CA3_4_9I0Value (a : Fin 17) : ℝ := marginal (below (shape 3 4 9)) (fun u => (stageALaw (shape 3 4 9) u : ℝ)) ((Equiv.refl (Fin 3)) 0) a +def CA3_4_9I0Raw (a : Fin 17) : Ball := marginalBall (below (shape 3 4 9)) A3_4_9Law ((Equiv.refl (Fin 3)) 0) a +lemma CA3_4_9I0Raw_sound (a : Fin 17) : + (CA3_4_9I0Raw a).Encloses (CA3_4_9I0Value a) := by + exact marginalBall_sound (below (shape 3 4 9)) A3_4_9Law (fun u => (stageALaw (shape 3 4 9) u : ℝ)) (fun u _ => A3_4_9Law_sound u) ((Equiv.refl (Fin 3)) 0) a +def CA3_4_9I0Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(1299456700004793073277956283603 / 12500000000000000000000000000000), (43 / 100000000000000000000000000000000)⟩ ⟨(23533497555094888247285717255271 / 100000000000000000000000000000000), (5503413263 / 50000000000000000000000000000000)⟩ ⟨(-113189119513409356234371341744503 / 50000000000000000000000000000000), (26469779707 / 25000000000000000000000000000000)⟩ ⟨-4, 1299456700004793073277956283603, 781250000000000000000000000000⟩, + .log ⟨(4950543299995206926722043716397 / 12500000000000000000000000000000), (37 / 50000000000000000000000000000000)⟩ ⟨(36682785892318360300699001332619 / 100000000000000000000000000000000), (25159639837 / 100000000000000000000000000000000)⟩ ⟨(-92623131617578913654954671725473 / 100000000000000000000000000000000), (15881867809 / 25000000000000000000000000000000)⟩ ⟨-2, 4950543299995206926722043716397, 3125000000000000000000000000000⟩] +lemma CA3_4_9I0Certificates_valid : + CA3_4_9I0Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA3_4_9I0CertificateIndex (a : Fin 17) : ℕ := + match a.val with + | 0 => 1 + | 1 => 2 + | 2 => 2 + | 3 => 1 + | _ => 0 +def CA3_4_9I0P (a : Fin 17) : Ball := + (CompactCertificate.entropyLookup CA3_4_9I0Certificates (CA3_4_9I0CertificateIndex a)).input +lemma CA3_4_9I0P_check : ∀ a : Fin 17, contains (CA3_4_9I0Raw a) (CA3_4_9I0P a) = true := by + decide +kernel +lemma CA3_4_9I0P_sound (a : Fin 17) : + (CA3_4_9I0P a).Encloses (CA3_4_9I0Value a) := + contains_sound (CA3_4_9I0Raw_sound a) (CA3_4_9I0P_check a) +def CA3_4_9I0Terms (a : Fin 17) : Ball := + (CompactCertificate.entropyLookup CA3_4_9I0Certificates (CA3_4_9I0CertificateIndex a)).output +lemma CA3_4_9I0Terms_sound (a : Fin 17) : + (CA3_4_9I0Terms a).Encloses (Foundation.entropyTerm (CA3_4_9I0Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA3_4_9I0Certificates_valid + (CA3_4_9I0CertificateIndex a) (CA3_4_9I0P_sound a) +def CA3_4_9I0Entropy : Ball := ⟨(6021628344741324854798471858789 / 5000000000000000000000000000000), (36166466363 / 50000000000000000000000000000000)⟩ +lemma CA3_4_9I0Entropy_sound : CA3_4_9I0Entropy.Encloses (Foundation.finiteEntropy CA3_4_9I0Value) := by + exact contains_sound (entropyFin_enclosed 17 CA3_4_9I0Value CA3_4_9I0Terms CA3_4_9I0Terms_sound) (by decide +kernel) +def CA3_4_9I0Mass : Ball := ⟨1, (117 / 50000000000000000000000000000000)⟩ +lemma CA3_4_9I0Mass_sound : CA3_4_9I0Mass.Encloses (∑ a, CA3_4_9I0Value a) := by + exact contains_sound (finSumBall_sound 17 CA3_4_9I0P CA3_4_9I0Value CA3_4_9I0P_sound) (by decide +kernel) +def CA3_4_9I0MassTermLogWitness : LogWitness := ⟨0, 1, 1⟩ +def CA3_4_9I0MassTermLog : Ball := ⟨0, (5293955979 / 25000000000000000000000000000000)⟩ +lemma CA3_4_9I0MassTermLog_sound : CA3_4_9I0MassTermLog.Encloses (Real.log ((∑ a, CA3_4_9I0Value a))) := by + exact checkLog_sound logTwoBall_sound (CA3_4_9I0Mass_sound) (w := CA3_4_9I0MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA3_4_9I0MassTerm : Ball := ⟨0, (21175823917 / 100000000000000000000000000000000)⟩ +lemma CA3_4_9I0MassTerm_sound : CA3_4_9I0MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA3_4_9I0Value a))) := by + exact contains_sound (entropyTerm_ball (CA3_4_9I0Mass_sound) CA3_4_9I0MassTermLog_sound) (by decide +kernel) +def CA3_4_9I0H : Ball := ⟨(6021628344741324854798471858789 / 5000000000000000000000000000000), (93508756643 / 100000000000000000000000000000000)⟩ +lemma CA3_4_9I0H_sound : CA3_4_9I0H.Encloses (homogeneousEntropy CA3_4_9I0Value) := by + exact contains_sound (homogeneous_enclosed CA3_4_9I0Value CA3_4_9I0MassTerm_sound CA3_4_9I0Entropy_sound) (by decide +kernel) +lemma CA3_4_9I0_sound : CA3_4_9I0H.Encloses (stageACapacity (shape 3 4 9) 0) := by + exact CA3_4_9I0H_sound + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA3_4_9I1.lean b/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA3_4_9I1.lean new file mode 100644 index 0000000000000000000000000000000000000000..6b81092aaba56f23867a06f1edcecec7dbc43756 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA3_4_9I1.lean @@ -0,0 +1,1045 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Certificates.SupportedContraction + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CA3_4_9I1PairValue (a : PairSlot × PairSlot) : ℝ := pairLaw (below (shape 3 4 9)) (shape 3 4 9) (fun u => (stageALaw (shape 3 4 9) u : ℝ)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) a +def CA3_4_9I1PairRaw (a : PairSlot × PairSlot) : Ball := stageAPairBall (shape 3 4 9) A3_4_9Law 1 a +lemma CA3_4_9I1PairRaw_sound (a : PairSlot × PairSlot) : + (CA3_4_9I1PairRaw a).Encloses (CA3_4_9I1PairValue a) := by + exact stageAPairBall_sound (shape 3 4 9) (by decide +kernel) A3_4_9Law (fun u => (stageALaw (shape 3 4 9) u : ℝ)) (fun u _ => A3_4_9Law_sound u) 1 a +def CA3_4_9I1PairCertificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(292857264085756312241011408043 / 100000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ ⟨(1708306744624285742802727879751 / 100000000000000000000000000000000), (3100747 / 500000000000000000000000000000)⟩ ⟨(-72915501599272631539291127246699 / 12500000000000000000000000000000), (105879118927 / 50000000000000000000000000000000)⟩ ⟨-9, 292857264085756312241011408043, 195312500000000000000000000000⟩, + .log ⟨(1885575878487842349807621027 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(1920561796943324412147676313 / 5000000000000000000000000000000), (12777171 / 100000000000000000000000000000000)⟩ ⟨(-254638625108465456202777856275343 / 25000000000000000000000000000000), (84703301361 / 25000000000000000000000000000000)⟩ ⟨-15, 1885575878487842349807621027, 1525878906250000000000000000⟩, + .log ⟨(841509810611295391142428923819 / 50000000000000000000000000000000), (3 / 25000000000000000000000000000000)⟩ ⟨(6874429315078938315221032438319 / 100000000000000000000000000000000), (498950587 / 20000000000000000000000000000000)⟩ ⟨(-3191078603411668648692810823379 / 781250000000000000000000000000), (148230766493 / 100000000000000000000000000000000)⟩ ⟨-6, 841509810611295391142428923819, 781250000000000000000000000000⟩, + .log ⟨(14706810017409610410934150259 / 10000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ ⟨(239795630012192420696149077293 / 25000000000000000000000000000000), (342571713 / 100000000000000000000000000000000)⟩ ⟨(-652202971897583308566276690454327 / 100000000000000000000000000000000), (14558378867 / 6250000000000000000000000000000)⟩ ⟨-10, 14706810017409610410934150259, 9765625000000000000000000000⟩, + .log ⟨(6512532435152937635412385023 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(58261440120041247146646050737 / 50000000000000000000000000000000), (19307159 / 50000000000000000000000000000000)⟩ ⟨(-894604989689745160234788813902721 / 100000000000000000000000000000000), (296461539239 / 100000000000000000000000000000000)⟩ ⟨-13, 6512532435152937635412385023, 6103515625000000000000000000⟩, + .log ⟨(2551518495124812919643556648547 / 50000000000000000000000000000000), (1 / 4000000000000000000000000000000)⟩ ⟨(94895257318236553266192335441 / 625000000000000000000000000000), (6483660793 / 100000000000000000000000000000000)⟩ ⟨(-148766716760318135495281997652377 / 50000000000000000000000000000000), (31763735647 / 25000000000000000000000000000000)⟩ ⟨-5, 2551518495124812919643556648547, 1562500000000000000000000000000⟩, + .log ⟨(477235717337443166844245563137 / 100000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ ⟨(2550784310638338466641438747857 / 100000000000000000000000000000000), (454763683 / 50000000000000000000000000000000)⟩ ⟨(-534491492981597906304914361761911 / 100000000000000000000000000000000), (7623296551 / 4000000000000000000000000000000)⟩ ⟨-8, 477235717337443166844245563137, 390625000000000000000000000000⟩, + .log ⟨(197401741563142660985948151703 / 100000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ ⟨(1229355769265801328866234541451 / 100000000000000000000000000000000), (418014463 / 100000000000000000000000000000000)⟩ ⟨(-155692112887536095619562721419211 / 25000000000000000000000000000000), (105879118921 / 50000000000000000000000000000000)⟩ ⟨-9, 197401741563142660985948151703, 195312500000000000000000000000⟩, + .log ⟨(32123053480794354222066256883 / 625000000000000000000000000000), (27 / 100000000000000000000000000000000)⟩ ⟨(7627754480821433172880193405681 / 50000000000000000000000000000000), (1632557107 / 25000000000000000000000000000000)⟩ ⟨(-59363554007886382395582449412141 / 20000000000000000000000000000000), (127054942623 / 100000000000000000000000000000000)⟩ ⟨-5, 32123053480794354222066256883, 19531250000000000000000000000⟩, + .log ⟨(68297117279496336545355678441 / 5000000000000000000000000000000), (1 / 10000000000000000000000000000000)⟩ ⟨(5864435284800964772208620123351 / 100000000000000000000000000000000), (462799279 / 20000000000000000000000000000000)⟩ ⟨(-429332563247258962245902814892459 / 100000000000000000000000000000000), (42351647549 / 25000000000000000000000000000000)⟩ ⟨-7, 68297117279496336545355678441, 39062500000000000000000000000⟩, + .log ⟨(6868278761850895068649910837 / 5000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ ⟨(905277556564862264997319906539 / 100000000000000000000000000000000), (79992807 / 25000000000000000000000000000000)⟩ ⟨(-82378495758748872339109756633499 / 12500000000000000000000000000000), (14558378873 / 6250000000000000000000000000000)⟩ ⟨-10, 6868278761850895068649910837, 4882812500000000000000000000⟩, + .log ⟨(51942877695133887313949975319 / 10000000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ ⟨(1366148525864748611102187376993 / 50000000000000000000000000000000), (989939923 / 100000000000000000000000000000000)⟩ ⟨(-526019576305735613015829243946971 / 100000000000000000000000000000000), (47645603479 / 25000000000000000000000000000000)⟩ ⟨-8, 51942877695133887313949975319, 39062500000000000000000000000⟩, + .log ⟨(13932265331896540711495502853 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(123700655928616729544354072211 / 100000000000000000000000000000000), (20651909 / 50000000000000000000000000000000)⟩ ⟨(-443935903393313710537678197278661 / 50000000000000000000000000000000), (296461538739 / 100000000000000000000000000000000)⟩ ⟨-13, 13932265331896540711495502853, 12207031250000000000000000000⟩, + .log ⟨(9678418294724011225805740309959 / 50000000000000000000000000000000), (31 / 50000000000000000000000000000000)⟩ ⟨(15893167965574704805083629831923 / 50000000000000000000000000000000), (1024742407 / 6250000000000000000000000000000)⟩ ⟨(-82106225839807602248031070671817 / 50000000000000000000000000000000), (21175823763 / 25000000000000000000000000000000)⟩ ⟨-3, 9678418294724011225805740309959, 6250000000000000000000000000000⟩] +lemma CA3_4_9I1PairCertificates_valid : + CA3_4_9I1PairCertificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA3_4_9I1PairCertificateIndex (a : PairSlot × PairSlot) : ℕ := + match a.1.1.val, a.1.2.val, a.2.1.val, a.2.2.val with + | 0, 0, 4, 1 => 1 + | 0, 0, 5, 0 => 2 + | 0, 0, 2, 2 => 3 + | 0, 0, 2, 3 => 4 + | 0, 0, 3, 2 => 4 + | 0, 0, 3, 3 => 5 + | 0, 0, 1, 4 => 1 + | 0, 0, 0, 5 => 2 + | 1, 0, 2, 1 => 6 + | 1, 0, 3, 1 => 7 + | 1, 0, 4, 0 => 8 + | 1, 0, 1, 2 => 6 + | 1, 0, 1, 3 => 7 + | 1, 0, 0, 4 => 8 + | 0, 1, 2, 1 => 6 + | 0, 1, 3, 1 => 7 + | 0, 1, 4, 0 => 8 + | 0, 1, 1, 2 => 6 + | 0, 1, 1, 3 => 7 + | 0, 1, 0, 4 => 8 + | 2, 0, 1, 1 => 9 + | 2, 0, 2, 0 => 10 + | 2, 0, 3, 0 => 11 + | 2, 0, 0, 2 => 10 + | 2, 0, 0, 3 => 11 + | 3, 0, 1, 1 => 12 + | 3, 0, 2, 0 => 11 + | 3, 0, 3, 0 => 13 + | 3, 0, 0, 2 => 11 + | 3, 0, 0, 3 => 13 + | 1, 1, 1, 1 => 14 + | 1, 1, 2, 0 => 9 + | 1, 1, 3, 0 => 12 + | 1, 1, 0, 2 => 9 + | 1, 1, 0, 3 => 12 + | 0, 2, 1, 1 => 9 + | 0, 2, 2, 0 => 10 + | 0, 2, 3, 0 => 11 + | 0, 2, 0, 2 => 10 + | 0, 2, 0, 3 => 11 + | 0, 3, 1, 1 => 12 + | 0, 3, 2, 0 => 11 + | 0, 3, 3, 0 => 13 + | 0, 3, 0, 2 => 11 + | 0, 3, 0, 3 => 13 + | 4, 0, 0, 1 => 8 + | 4, 0, 1, 0 => 8 + | 2, 1, 0, 1 => 6 + | 2, 1, 1, 0 => 6 + | 3, 1, 0, 1 => 7 + | 3, 1, 1, 0 => 7 + | 1, 2, 0, 1 => 6 + | 1, 2, 1, 0 => 6 + | 1, 3, 0, 1 => 7 + | 1, 3, 1, 0 => 7 + | 0, 4, 0, 1 => 8 + | 0, 4, 1, 0 => 8 + | 0, 5, 0, 0 => 2 + | 1, 4, 0, 0 => 1 + | 2, 2, 0, 0 => 3 + | 2, 3, 0, 0 => 4 + | 3, 2, 0, 0 => 4 + | 3, 3, 0, 0 => 5 + | 4, 1, 0, 0 => 1 + | 5, 0, 0, 0 => 2 + | _, _, _, _ => 0 +def CA3_4_9I1PairP (a : PairSlot × PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_4_9I1PairCertificates (CA3_4_9I1PairCertificateIndex a)).input +lemma CA3_4_9I1PairP_check_0_0 : ∀ k l : Fin 6, contains (CA3_4_9I1PairRaw ((0,0),(k,l))) (CA3_4_9I1PairP ((0,0),(k,l))) = true := by + decide +kernel +lemma CA3_4_9I1PairP_check_0_1 : ∀ k l : Fin 6, contains (CA3_4_9I1PairRaw ((0,1),(k,l))) (CA3_4_9I1PairP ((0,1),(k,l))) = true := by + decide +kernel +lemma CA3_4_9I1PairP_check_0_2 : ∀ k l : Fin 6, contains (CA3_4_9I1PairRaw ((0,2),(k,l))) (CA3_4_9I1PairP ((0,2),(k,l))) = true := by + decide +kernel +lemma CA3_4_9I1PairP_check_0_3 : ∀ k l : Fin 6, contains (CA3_4_9I1PairRaw ((0,3),(k,l))) (CA3_4_9I1PairP ((0,3),(k,l))) = true := by + decide +kernel +lemma CA3_4_9I1PairP_check_0_4 : ∀ k l : Fin 6, contains (CA3_4_9I1PairRaw ((0,4),(k,l))) (CA3_4_9I1PairP ((0,4),(k,l))) = true := by + decide +kernel +lemma CA3_4_9I1PairP_check_0_5 : ∀ k l : Fin 6, contains (CA3_4_9I1PairRaw ((0,5),(k,l))) (CA3_4_9I1PairP ((0,5),(k,l))) = true := by + decide +kernel +lemma CA3_4_9I1PairP_check_1_0 : ∀ k l : Fin 6, contains (CA3_4_9I1PairRaw ((1,0),(k,l))) (CA3_4_9I1PairP ((1,0),(k,l))) = true := by + decide +kernel +lemma CA3_4_9I1PairP_check_1_1 : ∀ k l : Fin 6, contains (CA3_4_9I1PairRaw ((1,1),(k,l))) (CA3_4_9I1PairP ((1,1),(k,l))) = true := by + decide +kernel +lemma CA3_4_9I1PairP_check_1_2 : ∀ k l : Fin 6, contains (CA3_4_9I1PairRaw ((1,2),(k,l))) (CA3_4_9I1PairP ((1,2),(k,l))) = true := by + decide +kernel +lemma CA3_4_9I1PairP_check_1_3 : ∀ k l : Fin 6, contains (CA3_4_9I1PairRaw ((1,3),(k,l))) (CA3_4_9I1PairP ((1,3),(k,l))) = true := by + decide +kernel +lemma CA3_4_9I1PairP_check_1_4 : ∀ k l : Fin 6, contains (CA3_4_9I1PairRaw ((1,4),(k,l))) (CA3_4_9I1PairP ((1,4),(k,l))) = true := by + decide +kernel +lemma CA3_4_9I1PairP_check_1_5 : ∀ k l : Fin 6, contains (CA3_4_9I1PairRaw ((1,5),(k,l))) (CA3_4_9I1PairP ((1,5),(k,l))) = true := by + decide +kernel +lemma CA3_4_9I1PairP_check_2_0 : ∀ k l : Fin 6, contains (CA3_4_9I1PairRaw ((2,0),(k,l))) (CA3_4_9I1PairP ((2,0),(k,l))) = true := by + decide +kernel +lemma CA3_4_9I1PairP_check_2_1 : ∀ k l : Fin 6, contains (CA3_4_9I1PairRaw ((2,1),(k,l))) (CA3_4_9I1PairP ((2,1),(k,l))) = true := by + decide +kernel +lemma CA3_4_9I1PairP_check_2_2 : ∀ k l : Fin 6, contains (CA3_4_9I1PairRaw ((2,2),(k,l))) (CA3_4_9I1PairP ((2,2),(k,l))) = true := by + decide +kernel +lemma CA3_4_9I1PairP_check_2_3 : ∀ k l : Fin 6, contains (CA3_4_9I1PairRaw ((2,3),(k,l))) (CA3_4_9I1PairP ((2,3),(k,l))) = true := by + decide +kernel +lemma CA3_4_9I1PairP_check_2_4 : ∀ k l : Fin 6, contains (CA3_4_9I1PairRaw ((2,4),(k,l))) (CA3_4_9I1PairP ((2,4),(k,l))) = true := by + decide +kernel +lemma CA3_4_9I1PairP_check_2_5 : ∀ k l : Fin 6, contains (CA3_4_9I1PairRaw ((2,5),(k,l))) (CA3_4_9I1PairP ((2,5),(k,l))) = true := by + decide +kernel +lemma CA3_4_9I1PairP_check_3_0 : ∀ k l : Fin 6, contains (CA3_4_9I1PairRaw ((3,0),(k,l))) (CA3_4_9I1PairP ((3,0),(k,l))) = true := by + decide +kernel +lemma CA3_4_9I1PairP_check_3_1 : ∀ k l : Fin 6, contains (CA3_4_9I1PairRaw ((3,1),(k,l))) (CA3_4_9I1PairP ((3,1),(k,l))) = true := by + decide +kernel +lemma CA3_4_9I1PairP_check_3_2 : ∀ k l : Fin 6, contains (CA3_4_9I1PairRaw ((3,2),(k,l))) (CA3_4_9I1PairP ((3,2),(k,l))) = true := by + decide +kernel +lemma CA3_4_9I1PairP_check_3_3 : ∀ k l : Fin 6, contains (CA3_4_9I1PairRaw ((3,3),(k,l))) (CA3_4_9I1PairP ((3,3),(k,l))) = true := by + decide +kernel +lemma CA3_4_9I1PairP_check_3_4 : ∀ k l : Fin 6, contains (CA3_4_9I1PairRaw ((3,4),(k,l))) (CA3_4_9I1PairP ((3,4),(k,l))) = true := by + decide +kernel +lemma CA3_4_9I1PairP_check_3_5 : ∀ k l : Fin 6, contains (CA3_4_9I1PairRaw ((3,5),(k,l))) (CA3_4_9I1PairP ((3,5),(k,l))) = true := by + decide +kernel +lemma CA3_4_9I1PairP_check_4_0 : ∀ k l : Fin 6, contains (CA3_4_9I1PairRaw ((4,0),(k,l))) (CA3_4_9I1PairP ((4,0),(k,l))) = true := by + decide +kernel +lemma CA3_4_9I1PairP_check_4_1 : ∀ k l : Fin 6, contains (CA3_4_9I1PairRaw ((4,1),(k,l))) (CA3_4_9I1PairP ((4,1),(k,l))) = true := by + decide +kernel +lemma CA3_4_9I1PairP_check_4_2 : ∀ k l : Fin 6, contains (CA3_4_9I1PairRaw ((4,2),(k,l))) (CA3_4_9I1PairP ((4,2),(k,l))) = true := by + decide +kernel +lemma CA3_4_9I1PairP_check_4_3 : ∀ k l : Fin 6, contains (CA3_4_9I1PairRaw ((4,3),(k,l))) (CA3_4_9I1PairP ((4,3),(k,l))) = true := by + decide +kernel +lemma CA3_4_9I1PairP_check_4_4 : ∀ k l : Fin 6, contains (CA3_4_9I1PairRaw ((4,4),(k,l))) (CA3_4_9I1PairP ((4,4),(k,l))) = true := by + decide +kernel +lemma CA3_4_9I1PairP_check_4_5 : ∀ k l : Fin 6, contains (CA3_4_9I1PairRaw ((4,5),(k,l))) (CA3_4_9I1PairP ((4,5),(k,l))) = true := by + decide +kernel +lemma CA3_4_9I1PairP_check_5_0 : ∀ k l : Fin 6, contains (CA3_4_9I1PairRaw ((5,0),(k,l))) (CA3_4_9I1PairP ((5,0),(k,l))) = true := by + decide +kernel +lemma CA3_4_9I1PairP_check_5_1 : ∀ k l : Fin 6, contains (CA3_4_9I1PairRaw ((5,1),(k,l))) (CA3_4_9I1PairP ((5,1),(k,l))) = true := by + decide +kernel +lemma CA3_4_9I1PairP_check_5_2 : ∀ k l : Fin 6, contains (CA3_4_9I1PairRaw ((5,2),(k,l))) (CA3_4_9I1PairP ((5,2),(k,l))) = true := by + decide +kernel +lemma CA3_4_9I1PairP_check_5_3 : ∀ k l : Fin 6, contains (CA3_4_9I1PairRaw ((5,3),(k,l))) (CA3_4_9I1PairP ((5,3),(k,l))) = true := by + decide +kernel +lemma CA3_4_9I1PairP_check_5_4 : ∀ k l : Fin 6, contains (CA3_4_9I1PairRaw ((5,4),(k,l))) (CA3_4_9I1PairP ((5,4),(k,l))) = true := by + decide +kernel +lemma CA3_4_9I1PairP_check_5_5 : ∀ k l : Fin 6, contains (CA3_4_9I1PairRaw ((5,5),(k,l))) (CA3_4_9I1PairP ((5,5),(k,l))) = true := by + decide +kernel +lemma CA3_4_9I1PairP_check (a : PairSlot × PairSlot) : contains (CA3_4_9I1PairRaw a) (CA3_4_9I1PairP a) = true := by + rcases a with ⟨⟨i,j⟩,⟨k,l⟩⟩ + revert j i + apply forall_fin6 + · exact forall_fin6 (CA3_4_9I1PairP_check_0_0 k l) (CA3_4_9I1PairP_check_0_1 k l) (CA3_4_9I1PairP_check_0_2 k l) (CA3_4_9I1PairP_check_0_3 k l) (CA3_4_9I1PairP_check_0_4 k l) (CA3_4_9I1PairP_check_0_5 k l) + · exact forall_fin6 (CA3_4_9I1PairP_check_1_0 k l) (CA3_4_9I1PairP_check_1_1 k l) (CA3_4_9I1PairP_check_1_2 k l) (CA3_4_9I1PairP_check_1_3 k l) (CA3_4_9I1PairP_check_1_4 k l) (CA3_4_9I1PairP_check_1_5 k l) + · exact forall_fin6 (CA3_4_9I1PairP_check_2_0 k l) (CA3_4_9I1PairP_check_2_1 k l) (CA3_4_9I1PairP_check_2_2 k l) (CA3_4_9I1PairP_check_2_3 k l) (CA3_4_9I1PairP_check_2_4 k l) (CA3_4_9I1PairP_check_2_5 k l) + · exact forall_fin6 (CA3_4_9I1PairP_check_3_0 k l) (CA3_4_9I1PairP_check_3_1 k l) (CA3_4_9I1PairP_check_3_2 k l) (CA3_4_9I1PairP_check_3_3 k l) (CA3_4_9I1PairP_check_3_4 k l) (CA3_4_9I1PairP_check_3_5 k l) + · exact forall_fin6 (CA3_4_9I1PairP_check_4_0 k l) (CA3_4_9I1PairP_check_4_1 k l) (CA3_4_9I1PairP_check_4_2 k l) (CA3_4_9I1PairP_check_4_3 k l) (CA3_4_9I1PairP_check_4_4 k l) (CA3_4_9I1PairP_check_4_5 k l) + · exact forall_fin6 (CA3_4_9I1PairP_check_5_0 k l) (CA3_4_9I1PairP_check_5_1 k l) (CA3_4_9I1PairP_check_5_2 k l) (CA3_4_9I1PairP_check_5_3 k l) (CA3_4_9I1PairP_check_5_4 k l) (CA3_4_9I1PairP_check_5_5 k l) +lemma CA3_4_9I1PairP_sound (a : PairSlot × PairSlot) : + (CA3_4_9I1PairP a).Encloses (CA3_4_9I1PairValue a) := + contains_sound (CA3_4_9I1PairRaw_sound a) (CA3_4_9I1PairP_check a) +def CA3_4_9I1PairTerms (a : PairSlot × PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_4_9I1PairCertificates (CA3_4_9I1PairCertificateIndex a)).output +lemma CA3_4_9I1PairTerms_sound (a : PairSlot × PairSlot) : + (CA3_4_9I1PairTerms a).Encloses (Foundation.entropyTerm (CA3_4_9I1PairValue a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA3_4_9I1PairCertificates_valid + (CA3_4_9I1PairCertificateIndex a) (CA3_4_9I1PairP_sound a) +def CA3_4_9I1PairEntropy : Ball := ⟨(15572244029986886191407704878953 / 5000000000000000000000000000000), (12991587121 / 10000000000000000000000000000000)⟩ +lemma CA3_4_9I1PairEntropy_sound : CA3_4_9I1PairEntropy.Encloses (Foundation.finiteEntropy CA3_4_9I1PairValue) := by + exact contains_sound (entropyDoublePair_enclosed CA3_4_9I1PairValue CA3_4_9I1PairTerms CA3_4_9I1PairTerms_sound) (by decide +kernel) +def CA3_4_9I1PairMass : Ball := ⟨(49999999999999999999999999999999 / 50000000000000000000000000000000), (67 / 12500000000000000000000000000000)⟩ +lemma CA3_4_9I1PairMass_sound : CA3_4_9I1PairMass.Encloses (∑ a, CA3_4_9I1PairValue a) := by + exact contains_sound (doublePairSumBall_sound CA3_4_9I1PairP CA3_4_9I1PairValue CA3_4_9I1PairP_sound) (by decide +kernel) +def CA3_4_9I1PairMassTermLogWitness : LogWitness := ⟨-1, 49999999999999999999999999999999, 25000000000000000000000000000000⟩ +def CA3_4_9I1PairMassTermLog : Ball := ⟨(-1 / 100000000000000000000000000000000), (21175823951 / 50000000000000000000000000000000)⟩ +lemma CA3_4_9I1PairMassTermLog_sound : CA3_4_9I1PairMassTermLog.Encloses (Real.log ((∑ a, CA3_4_9I1PairValue a))) := by + exact checkLog_sound logTwoBall_sound (CA3_4_9I1PairMass_sound) (w := CA3_4_9I1PairMassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA3_4_9I1PairMassTerm : Ball := ⟨(1 / 100000000000000000000000000000000), (42351647903 / 100000000000000000000000000000000)⟩ +lemma CA3_4_9I1PairMassTerm_sound : CA3_4_9I1PairMassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA3_4_9I1PairValue a))) := by + exact contains_sound (entropyTerm_ball (CA3_4_9I1PairMass_sound) CA3_4_9I1PairMassTermLog_sound) (by decide +kernel) +def CA3_4_9I1PairH : Ball := ⟨(311444880599737723828154097579059 / 100000000000000000000000000000000), (172267519113 / 100000000000000000000000000000000)⟩ +lemma CA3_4_9I1PairH_sound : CA3_4_9I1PairH.Encloses (homogeneousEntropy CA3_4_9I1PairValue) := by + exact contains_sound (homogeneous_enclosed CA3_4_9I1PairValue CA3_4_9I1PairMassTerm_sound CA3_4_9I1PairEntropy_sound) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CA3_4_9I1R0Value (a : PairSlot) : ℝ := residualLaw (below (shape 3 4 9)) (fun u => (stageALaw (shape 3 4 9) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 0 a +def CA3_4_9I1R0Raw (a : PairSlot) : Ball := residualBall (below (shape 3 4 9)) A3_4_9Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 0 a +lemma CA3_4_9I1R0Raw_sound (a : PairSlot) : + (CA3_4_9I1R0Raw a).Encloses (CA3_4_9I1R0Value a) := by + exact residualBall_sound_on (below (shape 3 4 9)) A3_4_9Law (fun u => (stageALaw (shape 3 4 9) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A3_4_9Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 3 4 9) (show (shape 3 4 9) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 0 a +def CA3_4_9I1R0Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(129171885906327642982780946153 / 5000000000000000000000000000000), (7 / 50000000000000000000000000000000)⟩ ⟨(9445175467426299895193937865993 / 100000000000000000000000000000000), (3829449579 / 100000000000000000000000000000000)⟩ ⟨(-45700615313631960038590227361989 / 12500000000000000000000000000000), (148230766323 / 100000000000000000000000000000000)⟩ ⟨-6, 129171885906327642982780946153, 78125000000000000000000000000⟩] +lemma CA3_4_9I1R0Certificates_valid : + CA3_4_9I1R0Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA3_4_9I1R0CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 0, 0 => 1 + | _, _ => 0 +def CA3_4_9I1R0P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_4_9I1R0Certificates (CA3_4_9I1R0CertificateIndex a)).input +lemma CA3_4_9I1R0P_check : ∀ a : PairSlot, contains (CA3_4_9I1R0Raw a) (CA3_4_9I1R0P a) = true := by + decide +kernel +lemma CA3_4_9I1R0P_sound (a : PairSlot) : + (CA3_4_9I1R0P a).Encloses (CA3_4_9I1R0Value a) := + contains_sound (CA3_4_9I1R0Raw_sound a) (CA3_4_9I1R0P_check a) +def CA3_4_9I1R0Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_4_9I1R0Certificates (CA3_4_9I1R0CertificateIndex a)).output +lemma CA3_4_9I1R0Terms_sound (a : PairSlot) : + (CA3_4_9I1R0Terms a).Encloses (Foundation.entropyTerm (CA3_4_9I1R0Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA3_4_9I1R0Certificates_valid + (CA3_4_9I1R0CertificateIndex a) (CA3_4_9I1R0P_sound a) +def CA3_4_9I1R0Entropy : Ball := ⟨(9445175467426299895193937865993 / 100000000000000000000000000000000), (3829449579 / 100000000000000000000000000000000)⟩ +lemma CA3_4_9I1R0Entropy_sound : CA3_4_9I1R0Entropy.Encloses (Foundation.finiteEntropy CA3_4_9I1R0Value) := by + exact contains_sound (entropyPair_enclosed CA3_4_9I1R0Value CA3_4_9I1R0Terms CA3_4_9I1R0Terms_sound) (by decide +kernel) +def CA3_4_9I1R0Mass : Ball := ⟨(129171885906327642982780946153 / 5000000000000000000000000000000), (7 / 50000000000000000000000000000000)⟩ +lemma CA3_4_9I1R0Mass_sound : CA3_4_9I1R0Mass.Encloses (∑ a, CA3_4_9I1R0Value a) := by + exact contains_sound (pairSumBall_sound CA3_4_9I1R0P CA3_4_9I1R0Value CA3_4_9I1R0P_sound) (by decide +kernel) +def CA3_4_9I1R0MassTermLogWitness : LogWitness := ⟨-6, 129171885906327642982780946153, 78125000000000000000000000000⟩ +def CA3_4_9I1R0MassTermLog : Ball := ⟨(-45700615313631960038590227361989 / 12500000000000000000000000000000), (148230766323 / 100000000000000000000000000000000)⟩ +lemma CA3_4_9I1R0MassTermLog_sound : CA3_4_9I1R0MassTermLog.Encloses (Real.log ((∑ a, CA3_4_9I1R0Value a))) := by + exact checkLog_sound logTwoBall_sound (CA3_4_9I1R0Mass_sound) (w := CA3_4_9I1R0MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA3_4_9I1R0MassTerm : Ball := ⟨(9445175467426299895193937865993 / 100000000000000000000000000000000), (3829449579 / 100000000000000000000000000000000)⟩ +lemma CA3_4_9I1R0MassTerm_sound : CA3_4_9I1R0MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA3_4_9I1R0Value a))) := by + exact contains_sound (entropyTerm_ball (CA3_4_9I1R0Mass_sound) CA3_4_9I1R0MassTermLog_sound) (by decide +kernel) +def CA3_4_9I1R0H : Ball := ⟨0, (3829449579 / 50000000000000000000000000000000)⟩ +lemma CA3_4_9I1R0H_sound : CA3_4_9I1R0H.Encloses (homogeneousEntropy CA3_4_9I1R0Value) := by + exact contains_sound (homogeneous_enclosed CA3_4_9I1R0Value CA3_4_9I1R0MassTerm_sound CA3_4_9I1R0Entropy_sound) (by decide +kernel) +def CA3_4_9I1R1Value (a : PairSlot) : ℝ := residualLaw (below (shape 3 4 9)) (fun u => (stageALaw (shape 3 4 9) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 1 a +def CA3_4_9I1R1Raw (a : PairSlot) : Ball := residualBall (below (shape 3 4 9)) A3_4_9Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 1 a +lemma CA3_4_9I1R1Raw_sound (a : PairSlot) : + (CA3_4_9I1R1Raw a).Encloses (CA3_4_9I1R1Value a) := by + exact residualBall_sound_on (below (shape 3 4 9)) A3_4_9Law (fun u => (stageALaw (shape 3 4 9) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A3_4_9Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 3 4 9) (show (shape 3 4 9) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 1 a +def CA3_4_9I1R1Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(11555348898300423334234614023867 / 100000000000000000000000000000000), (11 / 25000000000000000000000000000000)⟩ ⟨(24936694229921582604765072396319 / 100000000000000000000000000000000), (12234701683 / 100000000000000000000000000000000)⟩ ⟨(-215802174814378006466983161722997 / 100000000000000000000000000000000), (26469779699 / 25000000000000000000000000000000)⟩ ⟨-4, 11555348898300423334234614023867, 6250000000000000000000000000000⟩] +lemma CA3_4_9I1R1Certificates_valid : + CA3_4_9I1R1Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA3_4_9I1R1CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 1, 0 => 1 + | 0, 1 => 1 + | _, _ => 0 +def CA3_4_9I1R1P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_4_9I1R1Certificates (CA3_4_9I1R1CertificateIndex a)).input +lemma CA3_4_9I1R1P_check : ∀ a : PairSlot, contains (CA3_4_9I1R1Raw a) (CA3_4_9I1R1P a) = true := by + decide +kernel +lemma CA3_4_9I1R1P_sound (a : PairSlot) : + (CA3_4_9I1R1P a).Encloses (CA3_4_9I1R1Value a) := + contains_sound (CA3_4_9I1R1Raw_sound a) (CA3_4_9I1R1P_check a) +def CA3_4_9I1R1Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_4_9I1R1Certificates (CA3_4_9I1R1CertificateIndex a)).output +lemma CA3_4_9I1R1Terms_sound (a : PairSlot) : + (CA3_4_9I1R1Terms a).Encloses (Foundation.entropyTerm (CA3_4_9I1R1Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA3_4_9I1R1Certificates_valid + (CA3_4_9I1R1CertificateIndex a) (CA3_4_9I1R1P_sound a) +def CA3_4_9I1R1Entropy : Ball := ⟨(24936694229921582604765072396319 / 50000000000000000000000000000000), (12234701683 / 50000000000000000000000000000000)⟩ +lemma CA3_4_9I1R1Entropy_sound : CA3_4_9I1R1Entropy.Encloses (Foundation.finiteEntropy CA3_4_9I1R1Value) := by + exact contains_sound (entropyPair_enclosed CA3_4_9I1R1Value CA3_4_9I1R1Terms CA3_4_9I1R1Terms_sound) (by decide +kernel) +def CA3_4_9I1R1Mass : Ball := ⟨(11555348898300423334234614023867 / 50000000000000000000000000000000), (11 / 12500000000000000000000000000000)⟩ +lemma CA3_4_9I1R1Mass_sound : CA3_4_9I1R1Mass.Encloses (∑ a, CA3_4_9I1R1Value a) := by + exact contains_sound (pairSumBall_sound CA3_4_9I1R1P CA3_4_9I1R1Value CA3_4_9I1R1P_sound) (by decide +kernel) +def CA3_4_9I1R1MassTermLogWitness : LogWitness := ⟨-3, 11555348898300423334234614023867, 6250000000000000000000000000000⟩ +def CA3_4_9I1R1MassTermLog : Ball := ⟨(-146487456758383475525259968672667 / 100000000000000000000000000000000), (84703295113 / 100000000000000000000000000000000)⟩ +lemma CA3_4_9I1R1MassTermLog_sound : CA3_4_9I1R1MassTermLog.Encloses (Real.log ((∑ a, CA3_4_9I1R1Value a))) := by + exact checkLog_sound logTwoBall_sound (CA3_4_9I1R1Mass_sound) (w := CA3_4_9I1R1MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA3_4_9I1R1MassTerm : Ball := ⟨(33854273441356347927102503160183 / 100000000000000000000000000000000), (19575522687 / 100000000000000000000000000000000)⟩ +lemma CA3_4_9I1R1MassTerm_sound : CA3_4_9I1R1MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA3_4_9I1R1Value a))) := by + exact contains_sound (entropyTerm_ball (CA3_4_9I1R1Mass_sound) CA3_4_9I1R1MassTermLog_sound) (by decide +kernel) +def CA3_4_9I1R1H : Ball := ⟨(3203823003697363456485528326491 / 20000000000000000000000000000000), (44044926053 / 100000000000000000000000000000000)⟩ +lemma CA3_4_9I1R1H_sound : CA3_4_9I1R1H.Encloses (homogeneousEntropy CA3_4_9I1R1Value) := by + exact contains_sound (homogeneous_enclosed CA3_4_9I1R1Value CA3_4_9I1R1MassTerm_sound CA3_4_9I1R1Entropy_sound) (by decide +kernel) +def CA3_4_9I1R2Value (a : PairSlot) : ℝ := residualLaw (below (shape 3 4 9)) (fun u => (stageALaw (shape 3 4 9) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 2 a +def CA3_4_9I1R2Raw (a : PairSlot) : Ball := residualBall (below (shape 3 4 9)) A3_4_9Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 2 a +lemma CA3_4_9I1R2Raw_sound (a : PairSlot) : + (CA3_4_9I1R2Raw a).Encloses (CA3_4_9I1R2Value a) := by + exact residualBall_sound_on (below (shape 3 4 9)) A3_4_9Law (fun u => (stageALaw (shape 3 4 9) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A3_4_9Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 3 4 9) (show (shape 3 4 9) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 2 a +def CA3_4_9I1R2Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(20365760996452464850227061681 / 250000000000000000000000000000), (7 / 20000000000000000000000000000000)⟩ ⟨(1021386011832927298843292887369 / 5000000000000000000000000000000), (2156308851 / 25000000000000000000000000000000)⟩ ⟨(-25076058096008386179872407245093 / 10000000000000000000000000000000), (26469779711 / 25000000000000000000000000000000)⟩ ⟨-4, 20365760996452464850227061681, 15625000000000000000000000000⟩, + .log ⟨(822024458089167757308487192377 / 100000000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ ⟨(3946667096828867111605776669259 / 100000000000000000000000000000000), (1392563623 / 100000000000000000000000000000000)⟩ ⟨(-240057765799515837495263368876237 / 50000000000000000000000000000000), (3388131799 / 2000000000000000000000000000000)⟩ ⟨-7, 822024458089167757308487192377, 781250000000000000000000000000⟩, + .log ⟨(30675071257204893548951682328859 / 100000000000000000000000000000000), (71 / 100000000000000000000000000000000)⟩ ⟨(36249341292555436934643008586237 / 100000000000000000000000000000000), (1217943573 / 6250000000000000000000000000000)⟩ ⟨(-118171987242054966862292732949783 / 100000000000000000000000000000000), (794093391 / 1250000000000000000000000000000)⟩ ⟨-2, 30675071257204893548951682328859, 25000000000000000000000000000000⟩] +lemma CA3_4_9I1R2Certificates_valid : + CA3_4_9I1R2Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA3_4_9I1R2CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 2, 0 => 1 + | 3, 0 => 2 + | 1, 1 => 3 + | 0, 2 => 1 + | 0, 3 => 2 + | _, _ => 0 +def CA3_4_9I1R2P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_4_9I1R2Certificates (CA3_4_9I1R2CertificateIndex a)).input +lemma CA3_4_9I1R2P_check : ∀ a : PairSlot, contains (CA3_4_9I1R2Raw a) (CA3_4_9I1R2P a) = true := by + decide +kernel +lemma CA3_4_9I1R2P_sound (a : PairSlot) : + (CA3_4_9I1R2P a).Encloses (CA3_4_9I1R2Value a) := + contains_sound (CA3_4_9I1R2Raw_sound a) (CA3_4_9I1R2P_check a) +def CA3_4_9I1R2Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_4_9I1R2Certificates (CA3_4_9I1R2CertificateIndex a)).output +lemma CA3_4_9I1R2Terms_sound (a : PairSlot) : + (CA3_4_9I1R2Terms a).Encloses (Foundation.entropyTerm (CA3_4_9I1R2Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA3_4_9I1R2Certificates_valid + (CA3_4_9I1R2CertificateIndex a) (CA3_4_9I1R2P_sound a) +def CA3_4_9I1R2Entropy : Ball := ⟨(16999623191906052622317255483903 / 20000000000000000000000000000000), (19761347611 / 50000000000000000000000000000000)⟩ +lemma CA3_4_9I1R2Entropy_sound : CA3_4_9I1R2Entropy.Encloses (Foundation.finiteEntropy CA3_4_9I1R2Value) := by + exact contains_sound (entropyPair_enclosed CA3_4_9I1R2Value CA3_4_9I1R2Terms CA3_4_9I1R2Terms_sound) (by decide +kernel) +def CA3_4_9I1R2Mass : Ball := ⟨(48611728970545200943750306058413 / 100000000000000000000000000000000), (149 / 100000000000000000000000000000000)⟩ +lemma CA3_4_9I1R2Mass_sound : CA3_4_9I1R2Mass.Encloses (∑ a, CA3_4_9I1R2Value a) := by + exact contains_sound (pairSumBall_sound CA3_4_9I1R2P CA3_4_9I1R2Value CA3_4_9I1R2P_sound) (by decide +kernel) +def CA3_4_9I1R2MassTermLogWitness : LogWitness := ⟨-2, 48611728970545200943750306058413, 25000000000000000000000000000000⟩ +def CA3_4_9I1R2MassTermLog : Ball := ⟨(-14426106947124012552068567061067 / 20000000000000000000000000000000), (12705494271 / 20000000000000000000000000000000)⟩ +lemma CA3_4_9I1R2MassTermLog_sound : CA3_4_9I1R2MassTermLog.Encloses (Real.log ((∑ a, CA3_4_9I1R2Value a))) := by + exact checkLog_sound logTwoBall_sound (CA3_4_9I1R2Mass_sound) (w := CA3_4_9I1R2MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA3_4_9I1R2MassTerm : Ball := ⟨(35063900050684587314112502652597 / 100000000000000000000000000000000), (6176360461 / 20000000000000000000000000000000)⟩ +lemma CA3_4_9I1R2MassTerm_sound : CA3_4_9I1R2MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA3_4_9I1R2Value a))) := by + exact contains_sound (entropyTerm_ball (CA3_4_9I1R2Mass_sound) CA3_4_9I1R2MassTermLog_sound) (by decide +kernel) +def CA3_4_9I1R2H : Ball := ⟨(24967107954422837898736887383459 / 50000000000000000000000000000000), (70404497527 / 100000000000000000000000000000000)⟩ +lemma CA3_4_9I1R2H_sound : CA3_4_9I1R2H.Encloses (homogeneousEntropy CA3_4_9I1R2Value) := by + exact contains_sound (homogeneous_enclosed CA3_4_9I1R2Value CA3_4_9I1R2MassTerm_sound CA3_4_9I1R2Entropy_sound) (by decide +kernel) +def CA3_4_9I1R3Value (a : PairSlot) : ℝ := residualLaw (below (shape 3 4 9)) (fun u => (stageALaw (shape 3 4 9) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 3 a +def CA3_4_9I1R3Raw (a : PairSlot) : Ball := residualBall (below (shape 3 4 9)) A3_4_9Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 3 a +lemma CA3_4_9I1R3Raw_sound (a : PairSlot) : + (CA3_4_9I1R3Raw a).Encloses (CA3_4_9I1R3Value a) := by + exact residualBall_sound_on (below (shape 3 4 9)) A3_4_9Law (fun u => (stageALaw (shape 3 4 9) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A3_4_9Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 3 4 9) (show (shape 3 4 9) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 3 a +def CA3_4_9I1R3Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(197401741563142660985948151703 / 50000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ ⟨(17480436938618976355312867047 / 800000000000000000000000000000), (376213013 / 50000000000000000000000000000000)⟩ ⟨(-276726866747074925768263846313257 / 50000000000000000000000000000000), (95291206953 / 50000000000000000000000000000000)⟩ ⟨-8, 197401741563142660985948151703, 195312500000000000000000000000⟩, + .log ⟨(10206073980499251678574226594187 / 100000000000000000000000000000000), (41 / 100000000000000000000000000000000)⟩ ⟨(4658434187533284499824348470301 / 20000000000000000000000000000000), (10806101291 / 100000000000000000000000000000000)⟩ ⟨(-114109357732320870024420401127217 / 50000000000000000000000000000000), (3308722463 / 3125000000000000000000000000000)⟩ ⟨-4, 10206073980499251678574226594187, 6250000000000000000000000000000⟩, + .log ⟨(477235717337443166844245563137 / 50000000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ ⟨(2219989718703386725723611185563 / 50000000000000000000000000000000), (202117191 / 12500000000000000000000000000000)⟩ ⟨(-465176774925603375363191168711581 / 100000000000000000000000000000000), (84703294941 / 50000000000000000000000000000000)⟩ ⟨-7, 477235717337443166844245563137, 390625000000000000000000000000⟩] +lemma CA3_4_9I1R3Certificates_valid : + CA3_4_9I1R3Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA3_4_9I1R3CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 4, 0 => 1 + | 2, 1 => 2 + | 3, 1 => 3 + | 1, 2 => 2 + | 1, 3 => 3 + | 0, 4 => 1 + | _, _ => 0 +def CA3_4_9I1R3P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_4_9I1R3Certificates (CA3_4_9I1R3CertificateIndex a)).input +lemma CA3_4_9I1R3P_check : ∀ a : PairSlot, contains (CA3_4_9I1R3Raw a) (CA3_4_9I1R3P a) = true := by + decide +kernel +lemma CA3_4_9I1R3P_sound (a : PairSlot) : + (CA3_4_9I1R3P a).Encloses (CA3_4_9I1R3Value a) := + contains_sound (CA3_4_9I1R3Raw_sound a) (CA3_4_9I1R3P_check a) +def CA3_4_9I1R3Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_4_9I1R3Certificates (CA3_4_9I1R3CertificateIndex a)).output +lemma CA3_4_9I1R3Terms_sound (a : PairSlot) : + (CA3_4_9I1R3Terms a).Encloses (Foundation.entropyTerm (CA3_4_9I1R3Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA3_4_9I1R3Certificates_valid + (CA3_4_9I1R3CertificateIndex a) (CA3_4_9I1R3P_sound a) +def CA3_4_9I1R3Entropy : Ball := ⟨(14958602496200283997491536551753 / 25000000000000000000000000000000), (2635092969 / 10000000000000000000000000000000)⟩ +lemma CA3_4_9I1R3Entropy_sound : CA3_4_9I1R3Entropy.Encloses (Foundation.finiteEntropy CA3_4_9I1R3Value) := by + exact contains_sound (entropyPair_enclosed CA3_4_9I1R3Value CA3_4_9I1R3Terms CA3_4_9I1R3Terms_sound) (by decide +kernel) +def CA3_4_9I1R3Mass : Ball := ⟨(11555348898300423334234614023867 / 50000000000000000000000000000000), (3 / 3125000000000000000000000000000)⟩ +lemma CA3_4_9I1R3Mass_sound : CA3_4_9I1R3Mass.Encloses (∑ a, CA3_4_9I1R3Value a) := by + exact contains_sound (pairSumBall_sound CA3_4_9I1R3P CA3_4_9I1R3Value CA3_4_9I1R3P_sound) (by decide +kernel) +def CA3_4_9I1R3MassTermLogWitness : LogWitness := ⟨-3, 11555348898300423334234614023867, 6250000000000000000000000000000⟩ +def CA3_4_9I1R3MassTermLog : Ball := ⟨(-146487456758383475525259968672667 / 100000000000000000000000000000000), (84703295147 / 100000000000000000000000000000000)⟩ +lemma CA3_4_9I1R3MassTermLog_sound : CA3_4_9I1R3MassTermLog.Encloses (Real.log ((∑ a, CA3_4_9I1R3Value a))) := by + exact checkLog_sound logTwoBall_sound (CA3_4_9I1R3Mass_sound) (w := CA3_4_9I1R3MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA3_4_9I1R3MassTerm : Ball := ⟨(33854273441356347927102503160183 / 100000000000000000000000000000000), (9787761353 / 50000000000000000000000000000000)⟩ +lemma CA3_4_9I1R3MassTerm_sound : CA3_4_9I1R3MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA3_4_9I1R3Value a))) := by + exact contains_sound (entropyTerm_ball (CA3_4_9I1R3Mass_sound) CA3_4_9I1R3MassTermLog_sound) (by decide +kernel) +def CA3_4_9I1R3H : Ball := ⟨(25980136543444788062863643046829 / 100000000000000000000000000000000), (11481613099 / 25000000000000000000000000000000)⟩ +lemma CA3_4_9I1R3H_sound : CA3_4_9I1R3H.Encloses (homogeneousEntropy CA3_4_9I1R3Value) := by + exact contains_sound (homogeneous_enclosed CA3_4_9I1R3Value CA3_4_9I1R3MassTerm_sound CA3_4_9I1R3Entropy_sound) (by decide +kernel) +def CA3_4_9I1R4Value (a : PairSlot) : ℝ := residualLaw (below (shape 3 4 9)) (fun u => (stageALaw (shape 3 4 9) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 4 a +def CA3_4_9I1R4Raw (a : PairSlot) : Ball := residualBall (below (shape 3 4 9)) A3_4_9Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 4 a +lemma CA3_4_9I1R4Raw_sound (a : PairSlot) : + (CA3_4_9I1R4Raw a).Encloses (CA3_4_9I1R4Value a) := by + exact residualBall_sound_on (below (shape 3 4 9)) A3_4_9Law (fun u => (stageALaw (shape 3 4 9) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A3_4_9Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 3 4 9) (show (shape 3 4 9) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 4 a +def CA3_4_9I1R4Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(1885575878487842349807621027 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(1920561796943324412147676313 / 5000000000000000000000000000000), (12777171 / 100000000000000000000000000000000)⟩ ⟨(-254638625108465456202777856275343 / 25000000000000000000000000000000), (84703301361 / 25000000000000000000000000000000)⟩ ⟨-15, 1885575878487842349807621027, 1525878906250000000000000000⟩, + .log ⟨(292857264085756312241011408043 / 100000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ ⟨(1708306744624285742802727879751 / 100000000000000000000000000000000), (3100747 / 500000000000000000000000000000)⟩ ⟨(-72915501599272631539291127246699 / 12500000000000000000000000000000), (105879118927 / 50000000000000000000000000000000)⟩ ⟨-9, 292857264085756312241011408043, 195312500000000000000000000000⟩, + .log ⟨(841509810611295391142428923819 / 50000000000000000000000000000000), (3 / 25000000000000000000000000000000)⟩ ⟨(6874429315078938315221032438319 / 100000000000000000000000000000000), (498950587 / 20000000000000000000000000000000)⟩ ⟨(-3191078603411668648692810823379 / 781250000000000000000000000000), (148230766493 / 100000000000000000000000000000000)⟩ ⟨-6, 841509810611295391142428923819, 781250000000000000000000000000⟩, + .log ⟨(14706810017409610410934150259 / 10000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ ⟨(239795630012192420696149077293 / 25000000000000000000000000000000), (342571713 / 100000000000000000000000000000000)⟩ ⟨(-652202971897583308566276690454327 / 100000000000000000000000000000000), (14558378867 / 6250000000000000000000000000000)⟩ ⟨-10, 14706810017409610410934150259, 9765625000000000000000000000⟩, + .log ⟨(6512532435152937635412385023 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(58261440120041247146646050737 / 50000000000000000000000000000000), (19307159 / 50000000000000000000000000000000)⟩ ⟨(-894604989689745160234788813902721 / 100000000000000000000000000000000), (296461539239 / 100000000000000000000000000000000)⟩ ⟨-13, 6512532435152937635412385023, 6103515625000000000000000000⟩] +lemma CA3_4_9I1R4Certificates_valid : + CA3_4_9I1R4Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA3_4_9I1R4CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 0, 5 => 1 + | 1, 4 => 2 + | 2, 2 => 3 + | 2, 3 => 4 + | 3, 2 => 4 + | 3, 3 => 5 + | 4, 1 => 2 + | 5, 0 => 1 + | _, _ => 0 +def CA3_4_9I1R4P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_4_9I1R4Certificates (CA3_4_9I1R4CertificateIndex a)).input +lemma CA3_4_9I1R4P_check : ∀ a : PairSlot, contains (CA3_4_9I1R4Raw a) (CA3_4_9I1R4P a) = true := by + decide +kernel +lemma CA3_4_9I1R4P_sound (a : PairSlot) : + (CA3_4_9I1R4P a).Encloses (CA3_4_9I1R4Value a) := + contains_sound (CA3_4_9I1R4Raw_sound a) (CA3_4_9I1R4P_check a) +def CA3_4_9I1R4Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_4_9I1R4Certificates (CA3_4_9I1R4CertificateIndex a)).output +lemma CA3_4_9I1R4Terms_sound (a : PairSlot) : + (CA3_4_9I1R4Terms a).Encloses (Foundation.entropyTerm (CA3_4_9I1R4Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA3_4_9I1R4Certificates_valid + (CA3_4_9I1R4CertificateIndex a) (CA3_4_9I1R4P_sound a) +def CA3_4_9I1R4Entropy : Ball := ⟨(12402753196542864637174879970159 / 100000000000000000000000000000000), (4484363821 / 100000000000000000000000000000000)⟩ +lemma CA3_4_9I1R4Entropy_sound : CA3_4_9I1R4Entropy.Encloses (Foundation.finiteEntropy CA3_4_9I1R4Value) := by + exact contains_sound (entropyPair_enclosed CA3_4_9I1R4Value CA3_4_9I1R4Terms CA3_4_9I1R4Terms_sound) (by decide +kernel) +def CA3_4_9I1R4Mass : Ball := ⟨(1291718859063276429827809461529 / 50000000000000000000000000000000), (1 / 4000000000000000000000000000000)⟩ +lemma CA3_4_9I1R4Mass_sound : CA3_4_9I1R4Mass.Encloses (∑ a, CA3_4_9I1R4Value a) := by + exact contains_sound (pairSumBall_sound CA3_4_9I1R4P CA3_4_9I1R4Value CA3_4_9I1R4P_sound) (by decide +kernel) +def CA3_4_9I1R4MassTermLogWitness : LogWitness := ⟨-6, 1291718859063276429827809461529, 781250000000000000000000000000⟩ +def CA3_4_9I1R4MassTermLog : Ball := ⟨(-36560492250905568030872181889599 / 10000000000000000000000000000000), (37057691687 / 25000000000000000000000000000000)⟩ +lemma CA3_4_9I1R4MassTermLog_sound : CA3_4_9I1R4MassTermLog.Encloses (Real.log ((∑ a, CA3_4_9I1R4Value a))) := by + exact checkLog_sound logTwoBall_sound (CA3_4_9I1R4Mass_sound) (w := CA3_4_9I1R4MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA3_4_9I1R4MassTerm : Ball := ⟨(2361293866856574973798484466497 / 25000000000000000000000000000000), (382944963 / 10000000000000000000000000000000)⟩ +lemma CA3_4_9I1R4MassTerm_sound : CA3_4_9I1R4MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA3_4_9I1R4Value a))) := by + exact contains_sound (entropyTerm_ball (CA3_4_9I1R4Mass_sound) CA3_4_9I1R4MassTermLog_sound) (by decide +kernel) +def CA3_4_9I1R4H : Ball := ⟨(2957577729116564741980942104171 / 100000000000000000000000000000000), (8313813451 / 100000000000000000000000000000000)⟩ +lemma CA3_4_9I1R4H_sound : CA3_4_9I1R4H.Encloses (homogeneousEntropy CA3_4_9I1R4Value) := by + exact contains_sound (homogeneous_enclosed CA3_4_9I1R4Value CA3_4_9I1R4MassTerm_sound CA3_4_9I1R4Entropy_sound) (by decide +kernel) +def CA3_4_9I1R5Value (a : PairSlot) : ℝ := residualLaw (below (shape 3 4 9)) (fun u => (stageALaw (shape 3 4 9) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 5 a +def CA3_4_9I1R5Raw (a : PairSlot) : Ball := residualBall (below (shape 3 4 9)) A3_4_9Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 5 a +lemma CA3_4_9I1R5Raw_sound (a : PairSlot) : + (CA3_4_9I1R5Raw a).Encloses (CA3_4_9I1R5Value a) := by + exact residualBall_sound_on (below (shape 3 4 9)) A3_4_9Law (fun u => (stageALaw (shape 3 4 9) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A3_4_9Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 3 4 9) (show (shape 3 4 9) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 5 a +def CA3_4_9I1R5Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA3_4_9I1R5Certificates_valid : + CA3_4_9I1R5Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA3_4_9I1R5CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA3_4_9I1R5P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_4_9I1R5Certificates (CA3_4_9I1R5CertificateIndex a)).input +lemma CA3_4_9I1R5P_check : ∀ a : PairSlot, contains (CA3_4_9I1R5Raw a) (CA3_4_9I1R5P a) = true := by + decide +kernel +lemma CA3_4_9I1R5P_sound (a : PairSlot) : + (CA3_4_9I1R5P a).Encloses (CA3_4_9I1R5Value a) := + contains_sound (CA3_4_9I1R5Raw_sound a) (CA3_4_9I1R5P_check a) +def CA3_4_9I1R5Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_4_9I1R5Certificates (CA3_4_9I1R5CertificateIndex a)).output +lemma CA3_4_9I1R5Terms_sound (a : PairSlot) : + (CA3_4_9I1R5Terms a).Encloses (Foundation.entropyTerm (CA3_4_9I1R5Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA3_4_9I1R5Certificates_valid + (CA3_4_9I1R5CertificateIndex a) (CA3_4_9I1R5P_sound a) +def CA3_4_9I1R5Entropy : Ball := ⟨0, 0⟩ +lemma CA3_4_9I1R5Entropy_sound : CA3_4_9I1R5Entropy.Encloses (Foundation.finiteEntropy CA3_4_9I1R5Value) := by + exact contains_sound (entropyPair_enclosed CA3_4_9I1R5Value CA3_4_9I1R5Terms CA3_4_9I1R5Terms_sound) (by decide +kernel) +def CA3_4_9I1R5Mass : Ball := ⟨0, 0⟩ +lemma CA3_4_9I1R5Mass_sound : CA3_4_9I1R5Mass.Encloses (∑ a, CA3_4_9I1R5Value a) := by + exact contains_sound (pairSumBall_sound CA3_4_9I1R5P CA3_4_9I1R5Value CA3_4_9I1R5P_sound) (by decide +kernel) +def CA3_4_9I1R5MassTerm : Ball := .exact 0 +lemma CA3_4_9I1R5MassTerm_sound : CA3_4_9I1R5MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA3_4_9I1R5Value a))) := + entropyTerm_zero_ball (CA3_4_9I1R5Mass_sound) +def CA3_4_9I1R5H : Ball := ⟨0, 0⟩ +lemma CA3_4_9I1R5H_sound : CA3_4_9I1R5H.Encloses (homogeneousEntropy CA3_4_9I1R5Value) := by + exact contains_sound (homogeneous_enclosed CA3_4_9I1R5Value CA3_4_9I1R5MassTerm_sound CA3_4_9I1R5Entropy_sound) (by decide +kernel) +def CA3_4_9I1R6Value (a : PairSlot) : ℝ := residualLaw (below (shape 3 4 9)) (fun u => (stageALaw (shape 3 4 9) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 6 a +def CA3_4_9I1R6Raw (a : PairSlot) : Ball := residualBall (below (shape 3 4 9)) A3_4_9Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 6 a +lemma CA3_4_9I1R6Raw_sound (a : PairSlot) : + (CA3_4_9I1R6Raw a).Encloses (CA3_4_9I1R6Value a) := by + exact residualBall_sound_on (below (shape 3 4 9)) A3_4_9Law (fun u => (stageALaw (shape 3 4 9) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A3_4_9Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 3 4 9) (show (shape 3 4 9) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 6 a +def CA3_4_9I1R6Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA3_4_9I1R6Certificates_valid : + CA3_4_9I1R6Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA3_4_9I1R6CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA3_4_9I1R6P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_4_9I1R6Certificates (CA3_4_9I1R6CertificateIndex a)).input +lemma CA3_4_9I1R6P_check : ∀ a : PairSlot, contains (CA3_4_9I1R6Raw a) (CA3_4_9I1R6P a) = true := by + decide +kernel +lemma CA3_4_9I1R6P_sound (a : PairSlot) : + (CA3_4_9I1R6P a).Encloses (CA3_4_9I1R6Value a) := + contains_sound (CA3_4_9I1R6Raw_sound a) (CA3_4_9I1R6P_check a) +def CA3_4_9I1R6Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_4_9I1R6Certificates (CA3_4_9I1R6CertificateIndex a)).output +lemma CA3_4_9I1R6Terms_sound (a : PairSlot) : + (CA3_4_9I1R6Terms a).Encloses (Foundation.entropyTerm (CA3_4_9I1R6Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA3_4_9I1R6Certificates_valid + (CA3_4_9I1R6CertificateIndex a) (CA3_4_9I1R6P_sound a) +def CA3_4_9I1R6Entropy : Ball := ⟨0, 0⟩ +lemma CA3_4_9I1R6Entropy_sound : CA3_4_9I1R6Entropy.Encloses (Foundation.finiteEntropy CA3_4_9I1R6Value) := by + exact contains_sound (entropyPair_enclosed CA3_4_9I1R6Value CA3_4_9I1R6Terms CA3_4_9I1R6Terms_sound) (by decide +kernel) +def CA3_4_9I1R6Mass : Ball := ⟨0, 0⟩ +lemma CA3_4_9I1R6Mass_sound : CA3_4_9I1R6Mass.Encloses (∑ a, CA3_4_9I1R6Value a) := by + exact contains_sound (pairSumBall_sound CA3_4_9I1R6P CA3_4_9I1R6Value CA3_4_9I1R6P_sound) (by decide +kernel) +def CA3_4_9I1R6MassTerm : Ball := .exact 0 +lemma CA3_4_9I1R6MassTerm_sound : CA3_4_9I1R6MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA3_4_9I1R6Value a))) := + entropyTerm_zero_ball (CA3_4_9I1R6Mass_sound) +def CA3_4_9I1R6H : Ball := ⟨0, 0⟩ +lemma CA3_4_9I1R6H_sound : CA3_4_9I1R6H.Encloses (homogeneousEntropy CA3_4_9I1R6Value) := by + exact contains_sound (homogeneous_enclosed CA3_4_9I1R6Value CA3_4_9I1R6MassTerm_sound CA3_4_9I1R6Entropy_sound) (by decide +kernel) +def CA3_4_9I1R7Value (a : PairSlot) : ℝ := residualLaw (below (shape 3 4 9)) (fun u => (stageALaw (shape 3 4 9) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 7 a +def CA3_4_9I1R7Raw (a : PairSlot) : Ball := residualBall (below (shape 3 4 9)) A3_4_9Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 7 a +lemma CA3_4_9I1R7Raw_sound (a : PairSlot) : + (CA3_4_9I1R7Raw a).Encloses (CA3_4_9I1R7Value a) := by + exact residualBall_sound_on (below (shape 3 4 9)) A3_4_9Law (fun u => (stageALaw (shape 3 4 9) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A3_4_9Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 3 4 9) (show (shape 3 4 9) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 7 a +def CA3_4_9I1R7Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA3_4_9I1R7Certificates_valid : + CA3_4_9I1R7Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA3_4_9I1R7CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA3_4_9I1R7P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_4_9I1R7Certificates (CA3_4_9I1R7CertificateIndex a)).input +lemma CA3_4_9I1R7P_check : ∀ a : PairSlot, contains (CA3_4_9I1R7Raw a) (CA3_4_9I1R7P a) = true := by + decide +kernel +lemma CA3_4_9I1R7P_sound (a : PairSlot) : + (CA3_4_9I1R7P a).Encloses (CA3_4_9I1R7Value a) := + contains_sound (CA3_4_9I1R7Raw_sound a) (CA3_4_9I1R7P_check a) +def CA3_4_9I1R7Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_4_9I1R7Certificates (CA3_4_9I1R7CertificateIndex a)).output +lemma CA3_4_9I1R7Terms_sound (a : PairSlot) : + (CA3_4_9I1R7Terms a).Encloses (Foundation.entropyTerm (CA3_4_9I1R7Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA3_4_9I1R7Certificates_valid + (CA3_4_9I1R7CertificateIndex a) (CA3_4_9I1R7P_sound a) +def CA3_4_9I1R7Entropy : Ball := ⟨0, 0⟩ +lemma CA3_4_9I1R7Entropy_sound : CA3_4_9I1R7Entropy.Encloses (Foundation.finiteEntropy CA3_4_9I1R7Value) := by + exact contains_sound (entropyPair_enclosed CA3_4_9I1R7Value CA3_4_9I1R7Terms CA3_4_9I1R7Terms_sound) (by decide +kernel) +def CA3_4_9I1R7Mass : Ball := ⟨0, 0⟩ +lemma CA3_4_9I1R7Mass_sound : CA3_4_9I1R7Mass.Encloses (∑ a, CA3_4_9I1R7Value a) := by + exact contains_sound (pairSumBall_sound CA3_4_9I1R7P CA3_4_9I1R7Value CA3_4_9I1R7P_sound) (by decide +kernel) +def CA3_4_9I1R7MassTerm : Ball := .exact 0 +lemma CA3_4_9I1R7MassTerm_sound : CA3_4_9I1R7MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA3_4_9I1R7Value a))) := + entropyTerm_zero_ball (CA3_4_9I1R7Mass_sound) +def CA3_4_9I1R7H : Ball := ⟨0, 0⟩ +lemma CA3_4_9I1R7H_sound : CA3_4_9I1R7H.Encloses (homogeneousEntropy CA3_4_9I1R7Value) := by + exact contains_sound (homogeneous_enclosed CA3_4_9I1R7Value CA3_4_9I1R7MassTerm_sound CA3_4_9I1R7Entropy_sound) (by decide +kernel) +def CA3_4_9I1R8Value (a : PairSlot) : ℝ := residualLaw (below (shape 3 4 9)) (fun u => (stageALaw (shape 3 4 9) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 8 a +def CA3_4_9I1R8Raw (a : PairSlot) : Ball := residualBall (below (shape 3 4 9)) A3_4_9Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 8 a +lemma CA3_4_9I1R8Raw_sound (a : PairSlot) : + (CA3_4_9I1R8Raw a).Encloses (CA3_4_9I1R8Value a) := by + exact residualBall_sound_on (below (shape 3 4 9)) A3_4_9Law (fun u => (stageALaw (shape 3 4 9) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A3_4_9Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 3 4 9) (show (shape 3 4 9) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 8 a +def CA3_4_9I1R8Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA3_4_9I1R8Certificates_valid : + CA3_4_9I1R8Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA3_4_9I1R8CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA3_4_9I1R8P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_4_9I1R8Certificates (CA3_4_9I1R8CertificateIndex a)).input +lemma CA3_4_9I1R8P_check : ∀ a : PairSlot, contains (CA3_4_9I1R8Raw a) (CA3_4_9I1R8P a) = true := by + decide +kernel +lemma CA3_4_9I1R8P_sound (a : PairSlot) : + (CA3_4_9I1R8P a).Encloses (CA3_4_9I1R8Value a) := + contains_sound (CA3_4_9I1R8Raw_sound a) (CA3_4_9I1R8P_check a) +def CA3_4_9I1R8Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_4_9I1R8Certificates (CA3_4_9I1R8CertificateIndex a)).output +lemma CA3_4_9I1R8Terms_sound (a : PairSlot) : + (CA3_4_9I1R8Terms a).Encloses (Foundation.entropyTerm (CA3_4_9I1R8Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA3_4_9I1R8Certificates_valid + (CA3_4_9I1R8CertificateIndex a) (CA3_4_9I1R8P_sound a) +def CA3_4_9I1R8Entropy : Ball := ⟨0, 0⟩ +lemma CA3_4_9I1R8Entropy_sound : CA3_4_9I1R8Entropy.Encloses (Foundation.finiteEntropy CA3_4_9I1R8Value) := by + exact contains_sound (entropyPair_enclosed CA3_4_9I1R8Value CA3_4_9I1R8Terms CA3_4_9I1R8Terms_sound) (by decide +kernel) +def CA3_4_9I1R8Mass : Ball := ⟨0, 0⟩ +lemma CA3_4_9I1R8Mass_sound : CA3_4_9I1R8Mass.Encloses (∑ a, CA3_4_9I1R8Value a) := by + exact contains_sound (pairSumBall_sound CA3_4_9I1R8P CA3_4_9I1R8Value CA3_4_9I1R8P_sound) (by decide +kernel) +def CA3_4_9I1R8MassTerm : Ball := .exact 0 +lemma CA3_4_9I1R8MassTerm_sound : CA3_4_9I1R8MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA3_4_9I1R8Value a))) := + entropyTerm_zero_ball (CA3_4_9I1R8Mass_sound) +def CA3_4_9I1R8H : Ball := ⟨0, 0⟩ +lemma CA3_4_9I1R8H_sound : CA3_4_9I1R8H.Encloses (homogeneousEntropy CA3_4_9I1R8Value) := by + exact contains_sound (homogeneous_enclosed CA3_4_9I1R8Value CA3_4_9I1R8MassTerm_sound CA3_4_9I1R8Entropy_sound) (by decide +kernel) +def CA3_4_9I1R9Value (a : PairSlot) : ℝ := residualLaw (below (shape 3 4 9)) (fun u => (stageALaw (shape 3 4 9) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 9 a +def CA3_4_9I1R9Raw (a : PairSlot) : Ball := residualBall (below (shape 3 4 9)) A3_4_9Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 9 a +lemma CA3_4_9I1R9Raw_sound (a : PairSlot) : + (CA3_4_9I1R9Raw a).Encloses (CA3_4_9I1R9Value a) := by + exact residualBall_sound_on (below (shape 3 4 9)) A3_4_9Law (fun u => (stageALaw (shape 3 4 9) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A3_4_9Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 3 4 9) (show (shape 3 4 9) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 9 a +def CA3_4_9I1R9Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA3_4_9I1R9Certificates_valid : + CA3_4_9I1R9Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA3_4_9I1R9CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA3_4_9I1R9P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_4_9I1R9Certificates (CA3_4_9I1R9CertificateIndex a)).input +lemma CA3_4_9I1R9P_check : ∀ a : PairSlot, contains (CA3_4_9I1R9Raw a) (CA3_4_9I1R9P a) = true := by + decide +kernel +lemma CA3_4_9I1R9P_sound (a : PairSlot) : + (CA3_4_9I1R9P a).Encloses (CA3_4_9I1R9Value a) := + contains_sound (CA3_4_9I1R9Raw_sound a) (CA3_4_9I1R9P_check a) +def CA3_4_9I1R9Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_4_9I1R9Certificates (CA3_4_9I1R9CertificateIndex a)).output +lemma CA3_4_9I1R9Terms_sound (a : PairSlot) : + (CA3_4_9I1R9Terms a).Encloses (Foundation.entropyTerm (CA3_4_9I1R9Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA3_4_9I1R9Certificates_valid + (CA3_4_9I1R9CertificateIndex a) (CA3_4_9I1R9P_sound a) +def CA3_4_9I1R9Entropy : Ball := ⟨0, 0⟩ +lemma CA3_4_9I1R9Entropy_sound : CA3_4_9I1R9Entropy.Encloses (Foundation.finiteEntropy CA3_4_9I1R9Value) := by + exact contains_sound (entropyPair_enclosed CA3_4_9I1R9Value CA3_4_9I1R9Terms CA3_4_9I1R9Terms_sound) (by decide +kernel) +def CA3_4_9I1R9Mass : Ball := ⟨0, 0⟩ +lemma CA3_4_9I1R9Mass_sound : CA3_4_9I1R9Mass.Encloses (∑ a, CA3_4_9I1R9Value a) := by + exact contains_sound (pairSumBall_sound CA3_4_9I1R9P CA3_4_9I1R9Value CA3_4_9I1R9P_sound) (by decide +kernel) +def CA3_4_9I1R9MassTerm : Ball := .exact 0 +lemma CA3_4_9I1R9MassTerm_sound : CA3_4_9I1R9MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA3_4_9I1R9Value a))) := + entropyTerm_zero_ball (CA3_4_9I1R9Mass_sound) +def CA3_4_9I1R9H : Ball := ⟨0, 0⟩ +lemma CA3_4_9I1R9H_sound : CA3_4_9I1R9H.Encloses (homogeneousEntropy CA3_4_9I1R9Value) := by + exact contains_sound (homogeneous_enclosed CA3_4_9I1R9Value CA3_4_9I1R9MassTerm_sound CA3_4_9I1R9Entropy_sound) (by decide +kernel) +def CA3_4_9I1R10Value (a : PairSlot) : ℝ := residualLaw (below (shape 3 4 9)) (fun u => (stageALaw (shape 3 4 9) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 10 a +def CA3_4_9I1R10Raw (a : PairSlot) : Ball := residualBall (below (shape 3 4 9)) A3_4_9Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 10 a +lemma CA3_4_9I1R10Raw_sound (a : PairSlot) : + (CA3_4_9I1R10Raw a).Encloses (CA3_4_9I1R10Value a) := by + exact residualBall_sound_on (below (shape 3 4 9)) A3_4_9Law (fun u => (stageALaw (shape 3 4 9) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A3_4_9Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 3 4 9) (show (shape 3 4 9) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 10 a +def CA3_4_9I1R10Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA3_4_9I1R10Certificates_valid : + CA3_4_9I1R10Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA3_4_9I1R10CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA3_4_9I1R10P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_4_9I1R10Certificates (CA3_4_9I1R10CertificateIndex a)).input +lemma CA3_4_9I1R10P_check : ∀ a : PairSlot, contains (CA3_4_9I1R10Raw a) (CA3_4_9I1R10P a) = true := by + decide +kernel +lemma CA3_4_9I1R10P_sound (a : PairSlot) : + (CA3_4_9I1R10P a).Encloses (CA3_4_9I1R10Value a) := + contains_sound (CA3_4_9I1R10Raw_sound a) (CA3_4_9I1R10P_check a) +def CA3_4_9I1R10Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_4_9I1R10Certificates (CA3_4_9I1R10CertificateIndex a)).output +lemma CA3_4_9I1R10Terms_sound (a : PairSlot) : + (CA3_4_9I1R10Terms a).Encloses (Foundation.entropyTerm (CA3_4_9I1R10Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA3_4_9I1R10Certificates_valid + (CA3_4_9I1R10CertificateIndex a) (CA3_4_9I1R10P_sound a) +def CA3_4_9I1R10Entropy : Ball := ⟨0, 0⟩ +lemma CA3_4_9I1R10Entropy_sound : CA3_4_9I1R10Entropy.Encloses (Foundation.finiteEntropy CA3_4_9I1R10Value) := by + exact contains_sound (entropyPair_enclosed CA3_4_9I1R10Value CA3_4_9I1R10Terms CA3_4_9I1R10Terms_sound) (by decide +kernel) +def CA3_4_9I1R10Mass : Ball := ⟨0, 0⟩ +lemma CA3_4_9I1R10Mass_sound : CA3_4_9I1R10Mass.Encloses (∑ a, CA3_4_9I1R10Value a) := by + exact contains_sound (pairSumBall_sound CA3_4_9I1R10P CA3_4_9I1R10Value CA3_4_9I1R10P_sound) (by decide +kernel) +def CA3_4_9I1R10MassTerm : Ball := .exact 0 +lemma CA3_4_9I1R10MassTerm_sound : CA3_4_9I1R10MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA3_4_9I1R10Value a))) := + entropyTerm_zero_ball (CA3_4_9I1R10Mass_sound) +def CA3_4_9I1R10H : Ball := ⟨0, 0⟩ +lemma CA3_4_9I1R10H_sound : CA3_4_9I1R10H.Encloses (homogeneousEntropy CA3_4_9I1R10Value) := by + exact contains_sound (homogeneous_enclosed CA3_4_9I1R10Value CA3_4_9I1R10MassTerm_sound CA3_4_9I1R10Entropy_sound) (by decide +kernel) +def CA3_4_9I1R11Value (a : PairSlot) : ℝ := residualLaw (below (shape 3 4 9)) (fun u => (stageALaw (shape 3 4 9) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 11 a +def CA3_4_9I1R11Raw (a : PairSlot) : Ball := residualBall (below (shape 3 4 9)) A3_4_9Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 11 a +lemma CA3_4_9I1R11Raw_sound (a : PairSlot) : + (CA3_4_9I1R11Raw a).Encloses (CA3_4_9I1R11Value a) := by + exact residualBall_sound_on (below (shape 3 4 9)) A3_4_9Law (fun u => (stageALaw (shape 3 4 9) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A3_4_9Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 3 4 9) (show (shape 3 4 9) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 11 a +def CA3_4_9I1R11Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA3_4_9I1R11Certificates_valid : + CA3_4_9I1R11Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA3_4_9I1R11CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA3_4_9I1R11P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_4_9I1R11Certificates (CA3_4_9I1R11CertificateIndex a)).input +lemma CA3_4_9I1R11P_check : ∀ a : PairSlot, contains (CA3_4_9I1R11Raw a) (CA3_4_9I1R11P a) = true := by + decide +kernel +lemma CA3_4_9I1R11P_sound (a : PairSlot) : + (CA3_4_9I1R11P a).Encloses (CA3_4_9I1R11Value a) := + contains_sound (CA3_4_9I1R11Raw_sound a) (CA3_4_9I1R11P_check a) +def CA3_4_9I1R11Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_4_9I1R11Certificates (CA3_4_9I1R11CertificateIndex a)).output +lemma CA3_4_9I1R11Terms_sound (a : PairSlot) : + (CA3_4_9I1R11Terms a).Encloses (Foundation.entropyTerm (CA3_4_9I1R11Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA3_4_9I1R11Certificates_valid + (CA3_4_9I1R11CertificateIndex a) (CA3_4_9I1R11P_sound a) +def CA3_4_9I1R11Entropy : Ball := ⟨0, 0⟩ +lemma CA3_4_9I1R11Entropy_sound : CA3_4_9I1R11Entropy.Encloses (Foundation.finiteEntropy CA3_4_9I1R11Value) := by + exact contains_sound (entropyPair_enclosed CA3_4_9I1R11Value CA3_4_9I1R11Terms CA3_4_9I1R11Terms_sound) (by decide +kernel) +def CA3_4_9I1R11Mass : Ball := ⟨0, 0⟩ +lemma CA3_4_9I1R11Mass_sound : CA3_4_9I1R11Mass.Encloses (∑ a, CA3_4_9I1R11Value a) := by + exact contains_sound (pairSumBall_sound CA3_4_9I1R11P CA3_4_9I1R11Value CA3_4_9I1R11P_sound) (by decide +kernel) +def CA3_4_9I1R11MassTerm : Ball := .exact 0 +lemma CA3_4_9I1R11MassTerm_sound : CA3_4_9I1R11MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA3_4_9I1R11Value a))) := + entropyTerm_zero_ball (CA3_4_9I1R11Mass_sound) +def CA3_4_9I1R11H : Ball := ⟨0, 0⟩ +lemma CA3_4_9I1R11H_sound : CA3_4_9I1R11H.Encloses (homogeneousEntropy CA3_4_9I1R11Value) := by + exact contains_sound (homogeneous_enclosed CA3_4_9I1R11Value CA3_4_9I1R11MassTerm_sound CA3_4_9I1R11Entropy_sound) (by decide +kernel) +def CA3_4_9I1R12Value (a : PairSlot) : ℝ := residualLaw (below (shape 3 4 9)) (fun u => (stageALaw (shape 3 4 9) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 12 a +def CA3_4_9I1R12Raw (a : PairSlot) : Ball := residualBall (below (shape 3 4 9)) A3_4_9Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 12 a +lemma CA3_4_9I1R12Raw_sound (a : PairSlot) : + (CA3_4_9I1R12Raw a).Encloses (CA3_4_9I1R12Value a) := by + exact residualBall_sound_on (below (shape 3 4 9)) A3_4_9Law (fun u => (stageALaw (shape 3 4 9) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A3_4_9Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 3 4 9) (show (shape 3 4 9) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 12 a +def CA3_4_9I1R12Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA3_4_9I1R12Certificates_valid : + CA3_4_9I1R12Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA3_4_9I1R12CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA3_4_9I1R12P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_4_9I1R12Certificates (CA3_4_9I1R12CertificateIndex a)).input +lemma CA3_4_9I1R12P_check : ∀ a : PairSlot, contains (CA3_4_9I1R12Raw a) (CA3_4_9I1R12P a) = true := by + decide +kernel +lemma CA3_4_9I1R12P_sound (a : PairSlot) : + (CA3_4_9I1R12P a).Encloses (CA3_4_9I1R12Value a) := + contains_sound (CA3_4_9I1R12Raw_sound a) (CA3_4_9I1R12P_check a) +def CA3_4_9I1R12Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_4_9I1R12Certificates (CA3_4_9I1R12CertificateIndex a)).output +lemma CA3_4_9I1R12Terms_sound (a : PairSlot) : + (CA3_4_9I1R12Terms a).Encloses (Foundation.entropyTerm (CA3_4_9I1R12Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA3_4_9I1R12Certificates_valid + (CA3_4_9I1R12CertificateIndex a) (CA3_4_9I1R12P_sound a) +def CA3_4_9I1R12Entropy : Ball := ⟨0, 0⟩ +lemma CA3_4_9I1R12Entropy_sound : CA3_4_9I1R12Entropy.Encloses (Foundation.finiteEntropy CA3_4_9I1R12Value) := by + exact contains_sound (entropyPair_enclosed CA3_4_9I1R12Value CA3_4_9I1R12Terms CA3_4_9I1R12Terms_sound) (by decide +kernel) +def CA3_4_9I1R12Mass : Ball := ⟨0, 0⟩ +lemma CA3_4_9I1R12Mass_sound : CA3_4_9I1R12Mass.Encloses (∑ a, CA3_4_9I1R12Value a) := by + exact contains_sound (pairSumBall_sound CA3_4_9I1R12P CA3_4_9I1R12Value CA3_4_9I1R12P_sound) (by decide +kernel) +def CA3_4_9I1R12MassTerm : Ball := .exact 0 +lemma CA3_4_9I1R12MassTerm_sound : CA3_4_9I1R12MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA3_4_9I1R12Value a))) := + entropyTerm_zero_ball (CA3_4_9I1R12Mass_sound) +def CA3_4_9I1R12H : Ball := ⟨0, 0⟩ +lemma CA3_4_9I1R12H_sound : CA3_4_9I1R12H.Encloses (homogeneousEntropy CA3_4_9I1R12Value) := by + exact contains_sound (homogeneous_enclosed CA3_4_9I1R12Value CA3_4_9I1R12MassTerm_sound CA3_4_9I1R12Entropy_sound) (by decide +kernel) +def CA3_4_9I1R13Value (a : PairSlot) : ℝ := residualLaw (below (shape 3 4 9)) (fun u => (stageALaw (shape 3 4 9) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 13 a +def CA3_4_9I1R13Raw (a : PairSlot) : Ball := residualBall (below (shape 3 4 9)) A3_4_9Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 13 a +lemma CA3_4_9I1R13Raw_sound (a : PairSlot) : + (CA3_4_9I1R13Raw a).Encloses (CA3_4_9I1R13Value a) := by + exact residualBall_sound_on (below (shape 3 4 9)) A3_4_9Law (fun u => (stageALaw (shape 3 4 9) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A3_4_9Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 3 4 9) (show (shape 3 4 9) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 13 a +def CA3_4_9I1R13Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA3_4_9I1R13Certificates_valid : + CA3_4_9I1R13Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA3_4_9I1R13CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA3_4_9I1R13P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_4_9I1R13Certificates (CA3_4_9I1R13CertificateIndex a)).input +lemma CA3_4_9I1R13P_check : ∀ a : PairSlot, contains (CA3_4_9I1R13Raw a) (CA3_4_9I1R13P a) = true := by + decide +kernel +lemma CA3_4_9I1R13P_sound (a : PairSlot) : + (CA3_4_9I1R13P a).Encloses (CA3_4_9I1R13Value a) := + contains_sound (CA3_4_9I1R13Raw_sound a) (CA3_4_9I1R13P_check a) +def CA3_4_9I1R13Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_4_9I1R13Certificates (CA3_4_9I1R13CertificateIndex a)).output +lemma CA3_4_9I1R13Terms_sound (a : PairSlot) : + (CA3_4_9I1R13Terms a).Encloses (Foundation.entropyTerm (CA3_4_9I1R13Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA3_4_9I1R13Certificates_valid + (CA3_4_9I1R13CertificateIndex a) (CA3_4_9I1R13P_sound a) +def CA3_4_9I1R13Entropy : Ball := ⟨0, 0⟩ +lemma CA3_4_9I1R13Entropy_sound : CA3_4_9I1R13Entropy.Encloses (Foundation.finiteEntropy CA3_4_9I1R13Value) := by + exact contains_sound (entropyPair_enclosed CA3_4_9I1R13Value CA3_4_9I1R13Terms CA3_4_9I1R13Terms_sound) (by decide +kernel) +def CA3_4_9I1R13Mass : Ball := ⟨0, 0⟩ +lemma CA3_4_9I1R13Mass_sound : CA3_4_9I1R13Mass.Encloses (∑ a, CA3_4_9I1R13Value a) := by + exact contains_sound (pairSumBall_sound CA3_4_9I1R13P CA3_4_9I1R13Value CA3_4_9I1R13P_sound) (by decide +kernel) +def CA3_4_9I1R13MassTerm : Ball := .exact 0 +lemma CA3_4_9I1R13MassTerm_sound : CA3_4_9I1R13MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA3_4_9I1R13Value a))) := + entropyTerm_zero_ball (CA3_4_9I1R13Mass_sound) +def CA3_4_9I1R13H : Ball := ⟨0, 0⟩ +lemma CA3_4_9I1R13H_sound : CA3_4_9I1R13H.Encloses (homogeneousEntropy CA3_4_9I1R13Value) := by + exact contains_sound (homogeneous_enclosed CA3_4_9I1R13Value CA3_4_9I1R13MassTerm_sound CA3_4_9I1R13Entropy_sound) (by decide +kernel) +def CA3_4_9I1R14Value (a : PairSlot) : ℝ := residualLaw (below (shape 3 4 9)) (fun u => (stageALaw (shape 3 4 9) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 14 a +def CA3_4_9I1R14Raw (a : PairSlot) : Ball := residualBall (below (shape 3 4 9)) A3_4_9Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 14 a +lemma CA3_4_9I1R14Raw_sound (a : PairSlot) : + (CA3_4_9I1R14Raw a).Encloses (CA3_4_9I1R14Value a) := by + exact residualBall_sound_on (below (shape 3 4 9)) A3_4_9Law (fun u => (stageALaw (shape 3 4 9) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A3_4_9Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 3 4 9) (show (shape 3 4 9) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 14 a +def CA3_4_9I1R14Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA3_4_9I1R14Certificates_valid : + CA3_4_9I1R14Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA3_4_9I1R14CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA3_4_9I1R14P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_4_9I1R14Certificates (CA3_4_9I1R14CertificateIndex a)).input +lemma CA3_4_9I1R14P_check : ∀ a : PairSlot, contains (CA3_4_9I1R14Raw a) (CA3_4_9I1R14P a) = true := by + decide +kernel +lemma CA3_4_9I1R14P_sound (a : PairSlot) : + (CA3_4_9I1R14P a).Encloses (CA3_4_9I1R14Value a) := + contains_sound (CA3_4_9I1R14Raw_sound a) (CA3_4_9I1R14P_check a) +def CA3_4_9I1R14Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_4_9I1R14Certificates (CA3_4_9I1R14CertificateIndex a)).output +lemma CA3_4_9I1R14Terms_sound (a : PairSlot) : + (CA3_4_9I1R14Terms a).Encloses (Foundation.entropyTerm (CA3_4_9I1R14Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA3_4_9I1R14Certificates_valid + (CA3_4_9I1R14CertificateIndex a) (CA3_4_9I1R14P_sound a) +def CA3_4_9I1R14Entropy : Ball := ⟨0, 0⟩ +lemma CA3_4_9I1R14Entropy_sound : CA3_4_9I1R14Entropy.Encloses (Foundation.finiteEntropy CA3_4_9I1R14Value) := by + exact contains_sound (entropyPair_enclosed CA3_4_9I1R14Value CA3_4_9I1R14Terms CA3_4_9I1R14Terms_sound) (by decide +kernel) +def CA3_4_9I1R14Mass : Ball := ⟨0, 0⟩ +lemma CA3_4_9I1R14Mass_sound : CA3_4_9I1R14Mass.Encloses (∑ a, CA3_4_9I1R14Value a) := by + exact contains_sound (pairSumBall_sound CA3_4_9I1R14P CA3_4_9I1R14Value CA3_4_9I1R14P_sound) (by decide +kernel) +def CA3_4_9I1R14MassTerm : Ball := .exact 0 +lemma CA3_4_9I1R14MassTerm_sound : CA3_4_9I1R14MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA3_4_9I1R14Value a))) := + entropyTerm_zero_ball (CA3_4_9I1R14Mass_sound) +def CA3_4_9I1R14H : Ball := ⟨0, 0⟩ +lemma CA3_4_9I1R14H_sound : CA3_4_9I1R14H.Encloses (homogeneousEntropy CA3_4_9I1R14Value) := by + exact contains_sound (homogeneous_enclosed CA3_4_9I1R14Value CA3_4_9I1R14MassTerm_sound CA3_4_9I1R14Entropy_sound) (by decide +kernel) +def CA3_4_9I1R15Value (a : PairSlot) : ℝ := residualLaw (below (shape 3 4 9)) (fun u => (stageALaw (shape 3 4 9) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 15 a +def CA3_4_9I1R15Raw (a : PairSlot) : Ball := residualBall (below (shape 3 4 9)) A3_4_9Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 15 a +lemma CA3_4_9I1R15Raw_sound (a : PairSlot) : + (CA3_4_9I1R15Raw a).Encloses (CA3_4_9I1R15Value a) := by + exact residualBall_sound_on (below (shape 3 4 9)) A3_4_9Law (fun u => (stageALaw (shape 3 4 9) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A3_4_9Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 3 4 9) (show (shape 3 4 9) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 15 a +def CA3_4_9I1R15Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA3_4_9I1R15Certificates_valid : + CA3_4_9I1R15Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA3_4_9I1R15CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA3_4_9I1R15P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_4_9I1R15Certificates (CA3_4_9I1R15CertificateIndex a)).input +lemma CA3_4_9I1R15P_check : ∀ a : PairSlot, contains (CA3_4_9I1R15Raw a) (CA3_4_9I1R15P a) = true := by + decide +kernel +lemma CA3_4_9I1R15P_sound (a : PairSlot) : + (CA3_4_9I1R15P a).Encloses (CA3_4_9I1R15Value a) := + contains_sound (CA3_4_9I1R15Raw_sound a) (CA3_4_9I1R15P_check a) +def CA3_4_9I1R15Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_4_9I1R15Certificates (CA3_4_9I1R15CertificateIndex a)).output +lemma CA3_4_9I1R15Terms_sound (a : PairSlot) : + (CA3_4_9I1R15Terms a).Encloses (Foundation.entropyTerm (CA3_4_9I1R15Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA3_4_9I1R15Certificates_valid + (CA3_4_9I1R15CertificateIndex a) (CA3_4_9I1R15P_sound a) +def CA3_4_9I1R15Entropy : Ball := ⟨0, 0⟩ +lemma CA3_4_9I1R15Entropy_sound : CA3_4_9I1R15Entropy.Encloses (Foundation.finiteEntropy CA3_4_9I1R15Value) := by + exact contains_sound (entropyPair_enclosed CA3_4_9I1R15Value CA3_4_9I1R15Terms CA3_4_9I1R15Terms_sound) (by decide +kernel) +def CA3_4_9I1R15Mass : Ball := ⟨0, 0⟩ +lemma CA3_4_9I1R15Mass_sound : CA3_4_9I1R15Mass.Encloses (∑ a, CA3_4_9I1R15Value a) := by + exact contains_sound (pairSumBall_sound CA3_4_9I1R15P CA3_4_9I1R15Value CA3_4_9I1R15P_sound) (by decide +kernel) +def CA3_4_9I1R15MassTerm : Ball := .exact 0 +lemma CA3_4_9I1R15MassTerm_sound : CA3_4_9I1R15MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA3_4_9I1R15Value a))) := + entropyTerm_zero_ball (CA3_4_9I1R15Mass_sound) +def CA3_4_9I1R15H : Ball := ⟨0, 0⟩ +lemma CA3_4_9I1R15H_sound : CA3_4_9I1R15H.Encloses (homogeneousEntropy CA3_4_9I1R15Value) := by + exact contains_sound (homogeneous_enclosed CA3_4_9I1R15Value CA3_4_9I1R15MassTerm_sound CA3_4_9I1R15Entropy_sound) (by decide +kernel) +def CA3_4_9I1R16Value (a : PairSlot) : ℝ := residualLaw (below (shape 3 4 9)) (fun u => (stageALaw (shape 3 4 9) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 16 a +def CA3_4_9I1R16Raw (a : PairSlot) : Ball := residualBall (below (shape 3 4 9)) A3_4_9Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 16 a +lemma CA3_4_9I1R16Raw_sound (a : PairSlot) : + (CA3_4_9I1R16Raw a).Encloses (CA3_4_9I1R16Value a) := by + exact residualBall_sound_on (below (shape 3 4 9)) A3_4_9Law (fun u => (stageALaw (shape 3 4 9) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A3_4_9Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 3 4 9) (show (shape 3 4 9) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 16 a +def CA3_4_9I1R16Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA3_4_9I1R16Certificates_valid : + CA3_4_9I1R16Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA3_4_9I1R16CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA3_4_9I1R16P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_4_9I1R16Certificates (CA3_4_9I1R16CertificateIndex a)).input +lemma CA3_4_9I1R16P_check : ∀ a : PairSlot, contains (CA3_4_9I1R16Raw a) (CA3_4_9I1R16P a) = true := by + decide +kernel +lemma CA3_4_9I1R16P_sound (a : PairSlot) : + (CA3_4_9I1R16P a).Encloses (CA3_4_9I1R16Value a) := + contains_sound (CA3_4_9I1R16Raw_sound a) (CA3_4_9I1R16P_check a) +def CA3_4_9I1R16Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_4_9I1R16Certificates (CA3_4_9I1R16CertificateIndex a)).output +lemma CA3_4_9I1R16Terms_sound (a : PairSlot) : + (CA3_4_9I1R16Terms a).Encloses (Foundation.entropyTerm (CA3_4_9I1R16Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA3_4_9I1R16Certificates_valid + (CA3_4_9I1R16CertificateIndex a) (CA3_4_9I1R16P_sound a) +def CA3_4_9I1R16Entropy : Ball := ⟨0, 0⟩ +lemma CA3_4_9I1R16Entropy_sound : CA3_4_9I1R16Entropy.Encloses (Foundation.finiteEntropy CA3_4_9I1R16Value) := by + exact contains_sound (entropyPair_enclosed CA3_4_9I1R16Value CA3_4_9I1R16Terms CA3_4_9I1R16Terms_sound) (by decide +kernel) +def CA3_4_9I1R16Mass : Ball := ⟨0, 0⟩ +lemma CA3_4_9I1R16Mass_sound : CA3_4_9I1R16Mass.Encloses (∑ a, CA3_4_9I1R16Value a) := by + exact contains_sound (pairSumBall_sound CA3_4_9I1R16P CA3_4_9I1R16Value CA3_4_9I1R16P_sound) (by decide +kernel) +def CA3_4_9I1R16MassTerm : Ball := .exact 0 +lemma CA3_4_9I1R16MassTerm_sound : CA3_4_9I1R16MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA3_4_9I1R16Value a))) := + entropyTerm_zero_ball (CA3_4_9I1R16Mass_sound) +def CA3_4_9I1R16H : Ball := ⟨0, 0⟩ +lemma CA3_4_9I1R16H_sound : CA3_4_9I1R16H.Encloses (homogeneousEntropy CA3_4_9I1R16Value) := by + exact contains_sound (homogeneous_enclosed CA3_4_9I1R16Value CA3_4_9I1R16MassTerm_sound CA3_4_9I1R16Entropy_sound) (by decide +kernel) +def CA3_4_9I1ResidualEntropies (a : Fin 17) : Ball := + match a.val with + | 0 => CA3_4_9I1R0H + | 1 => CA3_4_9I1R1H + | 2 => CA3_4_9I1R2H + | 3 => CA3_4_9I1R3H + | 4 => CA3_4_9I1R4H + | 5 => CA3_4_9I1R5H + | 6 => CA3_4_9I1R6H + | 7 => CA3_4_9I1R7H + | 8 => CA3_4_9I1R8H + | 9 => CA3_4_9I1R9H + | 10 => CA3_4_9I1R10H + | 11 => CA3_4_9I1R11H + | 12 => CA3_4_9I1R12H + | 13 => CA3_4_9I1R13H + | 14 => CA3_4_9I1R14H + | 15 => CA3_4_9I1R15H + | 16 => CA3_4_9I1R16H + | _ => (.exact 0) +lemma CA3_4_9I1ResidualEntropies_sound (k : Fin 17) : + (CA3_4_9I1ResidualEntropies k).Encloses (homogeneousEntropy + (residualLaw (below (shape 3 4 9)) (fun u => (stageALaw (shape 3 4 9) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) k)) := by + fin_cases k + · exact CA3_4_9I1R0H_sound + · exact CA3_4_9I1R1H_sound + · exact CA3_4_9I1R2H_sound + · exact CA3_4_9I1R3H_sound + · exact CA3_4_9I1R4H_sound + · exact CA3_4_9I1R5H_sound + · exact CA3_4_9I1R6H_sound + · exact CA3_4_9I1R7H_sound + · exact CA3_4_9I1R8H_sound + · exact CA3_4_9I1R9H_sound + · exact CA3_4_9I1R10H_sound + · exact CA3_4_9I1R11H_sound + · exact CA3_4_9I1R12H_sound + · exact CA3_4_9I1R13H_sound + · exact CA3_4_9I1R14H_sound + · exact CA3_4_9I1R15H_sound + · exact CA3_4_9I1R16H_sound +def CA3_4_9I1Singles (s : Shape) : Ball := + match s 0, s 1, s 2 with + | _, _, _ => (.exact 0) +lemma CA3_4_9I1Singles_sound (u : Shape) (hu : u ∈ below (shape 3 4 9)) + (hd : designated (Equiv.refl (Fin 3)) 1 u) : + (CA3_4_9I1Singles u).Encloses (homogeneousEntropy ((fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) u)) := by + rw [A3_4_9_below] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 0 0 8) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 0 1 7) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 0 2 6) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 0 3 5) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 0 4 4) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 1 0 7) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 1 1 6) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 1 2 5) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 1 3 4) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 1 4 3) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 2 0 6) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 2 1 5) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 2 2 4) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 2 3 3) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 2 4 2) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 3 0 5) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 3 1 4) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 3 2 3) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 3 3 2) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 3 4 1) by decide +kernel) hd |>.elim +def CA3_4_9I1Singleton : Ball := ⟨0, 0⟩ +lemma CA3_4_9I1Singleton_sound : CA3_4_9I1Singleton.Encloses + (singletonEntropy (below (shape 3 4 9)) (fun u => (stageALaw (shape 3 4 9) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ))) := by + exact contains_sound (singletonBall_sound (below (shape 3 4 9)) A3_4_9Law (fun u => (stageALaw (shape 3 4 9) u : ℝ)) (Equiv.refl (Fin 3)) 1 + CA3_4_9I1Singles (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A3_4_9Law_sound u) CA3_4_9I1Singles_sound) (by decide +kernel) +def CA3_4_9I1Group : Ball := ⟨(94891045199893845884746001550373 / 100000000000000000000000000000000), (35269717717 / 20000000000000000000000000000000)⟩ +lemma CA3_4_9I1Group_sound : CA3_4_9I1Group.Encloses + (groupedEntropy (below (shape 3 4 9)) (fun u => (stageALaw (shape 3 4 9) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ))) := by + exact contains_sound (Ball.add_sound CA3_4_9I1Singleton_sound + (finSumBall_sound 17 CA3_4_9I1ResidualEntropies _ CA3_4_9I1ResidualEntropies_sound)) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CA3_4_9I1H : Ball := ⟨(121662790199950032058662094478313 / 100000000000000000000000000000000), (524964696283 / 100000000000000000000000000000000)⟩ +lemma CA3_4_9I1_sound : CA3_4_9I1H.Encloses (stageACapacity (shape 3 4 9) 1) := by + have hb := contains_sound (Ball.add_sound CA3_4_9I1PairH_sound + (Ball.neg_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) CA3_4_9I1Group_sound))) + (show contains (.add CA3_4_9I1PairH (.neg (.mul (.exact 2) CA3_4_9I1Group))) CA3_4_9I1H = true by decide +kernel) + unfold CA3_4_9I1PairValue at hb + simpa only [stageACapacity, nativeCapacity, + show (1 : Fin 3) ≠ 0 by decide, ite_false, sub_eq_add_neg] using hb + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA3_4_9I2.lean b/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA3_4_9I2.lean new file mode 100644 index 0000000000000000000000000000000000000000..3ed5603a8020cfcd7477d07c7d15624913926f70 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA3_4_9I2.lean @@ -0,0 +1,854 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.CapacityA.CapA3_4_9I2Pair + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CA3_4_9I2R0Value (a : PairSlot) : ℝ := residualLaw (below (shape 3 4 9)) (fun u => (stageALaw (shape 3 4 9) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 0 a +def CA3_4_9I2R0Raw (a : PairSlot) : Ball := residualBall (below (shape 3 4 9)) A3_4_9Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 0 a +lemma CA3_4_9I2R0Raw_sound (a : PairSlot) : + (CA3_4_9I2R0Raw a).Encloses (CA3_4_9I2R0Value a) := by + exact residualBall_sound_on (below (shape 3 4 9)) A3_4_9Law (fun u => (stageALaw (shape 3 4 9) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A3_4_9Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 3 4 9) (show (shape 3 4 9) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 0 a +def CA3_4_9I2R0Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA3_4_9I2R0Certificates_valid : + CA3_4_9I2R0Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA3_4_9I2R0CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA3_4_9I2R0P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_4_9I2R0Certificates (CA3_4_9I2R0CertificateIndex a)).input +lemma CA3_4_9I2R0P_check : ∀ a : PairSlot, contains (CA3_4_9I2R0Raw a) (CA3_4_9I2R0P a) = true := by + decide +kernel +lemma CA3_4_9I2R0P_sound (a : PairSlot) : + (CA3_4_9I2R0P a).Encloses (CA3_4_9I2R0Value a) := + contains_sound (CA3_4_9I2R0Raw_sound a) (CA3_4_9I2R0P_check a) +def CA3_4_9I2R0Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_4_9I2R0Certificates (CA3_4_9I2R0CertificateIndex a)).output +lemma CA3_4_9I2R0Terms_sound (a : PairSlot) : + (CA3_4_9I2R0Terms a).Encloses (Foundation.entropyTerm (CA3_4_9I2R0Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA3_4_9I2R0Certificates_valid + (CA3_4_9I2R0CertificateIndex a) (CA3_4_9I2R0P_sound a) +def CA3_4_9I2R0Entropy : Ball := ⟨0, 0⟩ +lemma CA3_4_9I2R0Entropy_sound : CA3_4_9I2R0Entropy.Encloses (Foundation.finiteEntropy CA3_4_9I2R0Value) := by + exact contains_sound (entropyPair_enclosed CA3_4_9I2R0Value CA3_4_9I2R0Terms CA3_4_9I2R0Terms_sound) (by decide +kernel) +def CA3_4_9I2R0Mass : Ball := ⟨0, 0⟩ +lemma CA3_4_9I2R0Mass_sound : CA3_4_9I2R0Mass.Encloses (∑ a, CA3_4_9I2R0Value a) := by + exact contains_sound (pairSumBall_sound CA3_4_9I2R0P CA3_4_9I2R0Value CA3_4_9I2R0P_sound) (by decide +kernel) +def CA3_4_9I2R0MassTerm : Ball := .exact 0 +lemma CA3_4_9I2R0MassTerm_sound : CA3_4_9I2R0MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA3_4_9I2R0Value a))) := + entropyTerm_zero_ball (CA3_4_9I2R0Mass_sound) +def CA3_4_9I2R0H : Ball := ⟨0, 0⟩ +lemma CA3_4_9I2R0H_sound : CA3_4_9I2R0H.Encloses (homogeneousEntropy CA3_4_9I2R0Value) := by + exact contains_sound (homogeneous_enclosed CA3_4_9I2R0Value CA3_4_9I2R0MassTerm_sound CA3_4_9I2R0Entropy_sound) (by decide +kernel) +def CA3_4_9I2R1Value (a : PairSlot) : ℝ := residualLaw (below (shape 3 4 9)) (fun u => (stageALaw (shape 3 4 9) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 1 a +def CA3_4_9I2R1Raw (a : PairSlot) : Ball := residualBall (below (shape 3 4 9)) A3_4_9Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 1 a +lemma CA3_4_9I2R1Raw_sound (a : PairSlot) : + (CA3_4_9I2R1Raw a).Encloses (CA3_4_9I2R1Value a) := by + exact residualBall_sound_on (below (shape 3 4 9)) A3_4_9Law (fun u => (stageALaw (shape 3 4 9) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A3_4_9Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 3 4 9) (show (shape 3 4 9) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 1 a +def CA3_4_9I2R1Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(2961092486317753981806299 / 5000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(849205210818614472015140153 / 100000000000000000000000000000000), (34489 / 12500000000000000000000000000000)⟩ ⟨(-89621188668383771972172972770083 / 6250000000000000000000000000000), (465869809591 / 100000000000000000000000000000000)⟩ ⟨-21, 2961092486317753981806299, 2384185791015625000000000⟩] +lemma CA3_4_9I2R1Certificates_valid : + CA3_4_9I2R1Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA3_4_9I2R1CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 1, 0 => 1 + | 0, 1 => 1 + | _, _ => 0 +def CA3_4_9I2R1P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_4_9I2R1Certificates (CA3_4_9I2R1CertificateIndex a)).input +lemma CA3_4_9I2R1P_check : ∀ a : PairSlot, contains (CA3_4_9I2R1Raw a) (CA3_4_9I2R1P a) = true := by + decide +kernel +lemma CA3_4_9I2R1P_sound (a : PairSlot) : + (CA3_4_9I2R1P a).Encloses (CA3_4_9I2R1Value a) := + contains_sound (CA3_4_9I2R1Raw_sound a) (CA3_4_9I2R1P_check a) +def CA3_4_9I2R1Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_4_9I2R1Certificates (CA3_4_9I2R1CertificateIndex a)).output +lemma CA3_4_9I2R1Terms_sound (a : PairSlot) : + (CA3_4_9I2R1Terms a).Encloses (Foundation.entropyTerm (CA3_4_9I2R1Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA3_4_9I2R1Certificates_valid + (CA3_4_9I2R1CertificateIndex a) (CA3_4_9I2R1P_sound a) +def CA3_4_9I2R1Entropy : Ball := ⟨(849205210818614472015140153 / 50000000000000000000000000000000), (34489 / 6250000000000000000000000000000)⟩ +lemma CA3_4_9I2R1Entropy_sound : CA3_4_9I2R1Entropy.Encloses (Foundation.finiteEntropy CA3_4_9I2R1Value) := by + exact contains_sound (entropyPair_enclosed CA3_4_9I2R1Value CA3_4_9I2R1Terms CA3_4_9I2R1Terms_sound) (by decide +kernel) +def CA3_4_9I2R1Mass : Ball := ⟨(2961092486317753981806299 / 2500000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ +lemma CA3_4_9I2R1Mass_sound : CA3_4_9I2R1Mass.Encloses (∑ a, CA3_4_9I2R1Value a) := by + exact contains_sound (pairSumBall_sound CA3_4_9I2R1P CA3_4_9I2R1Value CA3_4_9I2R1P_sound) (by decide +kernel) +def CA3_4_9I2R1MassTermLogWitness : LogWitness := ⟨-20, 2961092486317753981806299, 2384185791015625000000000⟩ +def CA3_4_9I2R1MassTermLog : Ball := ⟨(-682312150319072910306522185635499 / 50000000000000000000000000000000), (111173496477 / 25000000000000000000000000000000)⟩ +lemma CA3_4_9I2R1MassTermLog_sound : CA3_4_9I2R1MassTermLog.Encloses (Real.log ((∑ a, CA3_4_9I2R1Value a))) := by + exact checkLog_sound logTwoBall_sound (CA3_4_9I2R1Mass_sound) (w := CA3_4_9I2R1MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA3_4_9I2R1MassTerm : Ball := ⟨(808155752653246679917399297 / 50000000000000000000000000000000), (26337 / 5000000000000000000000000000000)⟩ +lemma CA3_4_9I2R1MassTerm_sound : CA3_4_9I2R1MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA3_4_9I2R1Value a))) := by + exact contains_sound (entropyTerm_ball (CA3_4_9I2R1Mass_sound) CA3_4_9I2R1MassTermLog_sound) (by decide +kernel) +def CA3_4_9I2R1H : Ball := ⟨(5131182270670974012217607 / 6250000000000000000000000000000), (269641 / 25000000000000000000000000000000)⟩ +lemma CA3_4_9I2R1H_sound : CA3_4_9I2R1H.Encloses (homogeneousEntropy CA3_4_9I2R1Value) := by + exact contains_sound (homogeneous_enclosed CA3_4_9I2R1Value CA3_4_9I2R1MassTerm_sound CA3_4_9I2R1Entropy_sound) (by decide +kernel) +def CA3_4_9I2R2Value (a : PairSlot) : ℝ := residualLaw (below (shape 3 4 9)) (fun u => (stageALaw (shape 3 4 9) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 2 a +def CA3_4_9I2R2Raw (a : PairSlot) : Ball := residualBall (below (shape 3 4 9)) A3_4_9Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 2 a +lemma CA3_4_9I2R2Raw_sound (a : PairSlot) : + (CA3_4_9I2R2Raw a).Encloses (CA3_4_9I2R2Value a) := by + exact residualBall_sound_on (below (shape 3 4 9)) A3_4_9Law (fun u => (stageALaw (shape 3 4 9) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A3_4_9Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 3 4 9) (show (shape 3 4 9) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 2 a +def CA3_4_9I2R2Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(2662620585721420017024656709 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(118808483387719070591604441351 / 100000000000000000000000000000000), (39468239 / 100000000000000000000000000000000)⟩ ⟨(-892417673211436333438693782157249 / 100000000000000000000000000000000), (296461539073 / 100000000000000000000000000000000)⟩ ⟨-13, 2662620585721420017024656709, 2441406250000000000000000000⟩, + .log ⟨(903945099847381946666593881 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(10498338947010504097231655437 / 100000000000000000000000000000000), (1722767 / 50000000000000000000000000000000)⟩ ⟨(-1161391211566166657234958092089781 / 100000000000000000000000000000000), (381164936919 / 100000000000000000000000000000000)⟩ ⟨-17, 903945099847381946666593881, 762939453125000000000000000⟩, + .log ⟨(12130784726064703499147662307 / 25000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ ⟨(370274477774716566427238229337 / 100000000000000000000000000000000), (33394321 / 25000000000000000000000000000000)⟩ ⟨(-381544234499448311559192971659527 / 50000000000000000000000000000000), (275285712001 / 100000000000000000000000000000000)⟩ ⟨-12, 12130784726064703499147662307, 6103515625000000000000000000⟩] +lemma CA3_4_9I2R2Certificates_valid : + CA3_4_9I2R2Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA3_4_9I2R2CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 2, 0 => 1 + | 3, 0 => 2 + | 1, 1 => 3 + | 0, 2 => 1 + | 0, 3 => 2 + | _, _ => 0 +def CA3_4_9I2R2P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_4_9I2R2Certificates (CA3_4_9I2R2CertificateIndex a)).input +lemma CA3_4_9I2R2P_check : ∀ a : PairSlot, contains (CA3_4_9I2R2Raw a) (CA3_4_9I2R2P a) = true := by + decide +kernel +lemma CA3_4_9I2R2P_sound (a : PairSlot) : + (CA3_4_9I2R2P a).Encloses (CA3_4_9I2R2Value a) := + contains_sound (CA3_4_9I2R2Raw_sound a) (CA3_4_9I2R2P_check a) +def CA3_4_9I2R2Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_4_9I2R2Certificates (CA3_4_9I2R2CertificateIndex a)).output +lemma CA3_4_9I2R2Terms_sound (a : PairSlot) : + (CA3_4_9I2R2Terms a).Encloses (Foundation.entropyTerm (CA3_4_9I2R2Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA3_4_9I2R2Certificates_valid + (CA3_4_9I2R2CertificateIndex a) (CA3_4_9I2R2P_sound a) +def CA3_4_9I2R2Entropy : Ball := ⟨(628888122444175715804910422913 / 100000000000000000000000000000000), (21940483 / 10000000000000000000000000000000)⟩ +lemma CA3_4_9I2R2Entropy_sound : CA3_4_9I2R2Entropy.Encloses (Foundation.finiteEntropy CA3_4_9I2R2Value) := by + exact contains_sound (entropyPair_enclosed CA3_4_9I2R2Value CA3_4_9I2R2Terms CA3_4_9I2R2Terms_sound) (by decide +kernel) +def CA3_4_9I2R2Mass : Ball := ⟨(961965437014597225752130051 / 1250000000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ +lemma CA3_4_9I2R2Mass_sound : CA3_4_9I2R2Mass.Encloses (∑ a, CA3_4_9I2R2Value a) := by + exact contains_sound (pairSumBall_sound CA3_4_9I2R2P CA3_4_9I2R2Value CA3_4_9I2R2P_sound) (by decide +kernel) +def CA3_4_9I2R2MassTermLogWitness : LogWitness := ⟨-11, 961965437014597225752130051, 610351562500000000000000000⟩ +def CA3_4_9I2R2MassTermLog : Ball := ⟨(-716967558751746717927349993101709 / 100000000000000000000000000000000), (31763736499 / 12500000000000000000000000000000)⟩ +lemma CA3_4_9I2R2MassTermLog_sound : CA3_4_9I2R2MassTermLog.Encloses (Real.log ((∑ a, CA3_4_9I2R2Value a))) := by + exact checkLog_sound logTwoBall_sound (CA3_4_9I2R2Mass_sound) (w := CA3_4_9I2R2MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA3_4_9I2R2MassTerm : Ball := ⟨(4310612568624455895852198643 / 781250000000000000000000000000), (19555599 / 10000000000000000000000000000000)⟩ +lemma CA3_4_9I2R2MassTerm_sound : CA3_4_9I2R2MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA3_4_9I2R2Value a))) := by + exact contains_sound (entropyTerm_ball (CA3_4_9I2R2Mass_sound) CA3_4_9I2R2MassTermLog_sound) (by decide +kernel) +def CA3_4_9I2R2H : Ball := ⟨(77129713660245361135828996609 / 100000000000000000000000000000000), (20748041 / 5000000000000000000000000000000)⟩ +lemma CA3_4_9I2R2H_sound : CA3_4_9I2R2H.Encloses (homogeneousEntropy CA3_4_9I2R2Value) := by + exact contains_sound (homogeneous_enclosed CA3_4_9I2R2Value CA3_4_9I2R2MassTerm_sound CA3_4_9I2R2Entropy_sound) (by decide +kernel) +def CA3_4_9I2R3Value (a : PairSlot) : ℝ := residualLaw (below (shape 3 4 9)) (fun u => (stageALaw (shape 3 4 9) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 3 a +def CA3_4_9I2R3Raw (a : PairSlot) : Ball := residualBall (below (shape 3 4 9)) A3_4_9Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 3 a +lemma CA3_4_9I2R3Raw_sound (a : PairSlot) : + (CA3_4_9I2R3Raw a).Encloses (CA3_4_9I2R3Value a) := by + exact residualBall_sound_on (below (shape 3 4 9)) A3_4_9Law (fun u => (stageALaw (shape 3 4 9) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A3_4_9Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 3 4 9) (show (shape 3 4 9) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 3 a +def CA3_4_9I2R3Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(63065380170987248489996400911 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(464713240624695623579038050939 / 100000000000000000000000000000000), (80127687 / 50000000000000000000000000000000)⟩ ⟨(-147375069924174797158524850477827 / 20000000000000000000000000000000), (254109885781 / 100000000000000000000000000000000)⟩ ⟨-11, 63065380170987248489996400911, 48828125000000000000000000000⟩, + .log ⟨(445344646416109351263041104079 / 20000000000000000000000000000000), (13 / 100000000000000000000000000000000)⟩ ⟨(2117969559395514344629812661969 / 25000000000000000000000000000000), (1650344481 / 50000000000000000000000000000000)⟩ ⟨(-380463908380132535544902353615437 / 100000000000000000000000000000000), (37057691591 / 25000000000000000000000000000000)⟩ ⟨-6, 445344646416109351263041104079, 312500000000000000000000000000⟩, + .log ⟨(113396433956510867113178585959 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(153811728604174436385946652067 / 20000000000000000000000000000000), (132069463 / 50000000000000000000000000000000)⟩ ⟨(-339101776038132304026122658759803 / 50000000000000000000000000000000), (116467030697 / 50000000000000000000000000000000)⟩ ⟨-10, 113396433956510867113178585959, 97656250000000000000000000000⟩] +lemma CA3_4_9I2R3Certificates_valid : + CA3_4_9I2R3Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA3_4_9I2R3CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 4, 0 => 1 + | 2, 1 => 2 + | 3, 1 => 3 + | 1, 2 => 2 + | 1, 3 => 3 + | 0, 4 => 1 + | _, _ => 0 +def CA3_4_9I2R3P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_4_9I2R3Certificates (CA3_4_9I2R3CertificateIndex a)).input +lemma CA3_4_9I2R3P_check : ∀ a : PairSlot, contains (CA3_4_9I2R3Raw a) (CA3_4_9I2R3P a) = true := by + decide +kernel +lemma CA3_4_9I2R3P_sound (a : PairSlot) : + (CA3_4_9I2R3P a).Encloses (CA3_4_9I2R3Value a) := + contains_sound (CA3_4_9I2R3Raw_sound a) (CA3_4_9I2R3P_check a) +def CA3_4_9I2R3Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_4_9I2R3Certificates (CA3_4_9I2R3CertificateIndex a)).output +lemma CA3_4_9I2R3Terms_sound (a : PairSlot) : + (CA3_4_9I2R3Terms a).Encloses (Foundation.entropyTerm (CA3_4_9I2R3Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA3_4_9I2R3Certificates_valid + (CA3_4_9I2R3CertificateIndex a) (CA3_4_9I2R3P_sound a) +def CA3_4_9I2R3Entropy : Ball := ⟨(194113002424552503680560439183 / 1000000000000000000000000000000), (1862541631 / 25000000000000000000000000000000)⟩ +lemma CA3_4_9I2R3Entropy_sound : CA3_4_9I2R3Entropy.Encloses (Foundation.finiteEntropy CA3_4_9I2R3Value) := by + exact contains_sound (entropyPair_enclosed CA3_4_9I2R3Value CA3_4_9I2R3Terms CA3_4_9I2R3Terms_sound) (by decide +kernel) +def CA3_4_9I2R3Mass : Ball := ⟨(480637009241608974383676101453 / 10000000000000000000000000000000), (3 / 10000000000000000000000000000000)⟩ +lemma CA3_4_9I2R3Mass_sound : CA3_4_9I2R3Mass.Encloses (∑ a, CA3_4_9I2R3Value a) := by + exact contains_sound (pairSumBall_sound CA3_4_9I2R3P CA3_4_9I2R3Value CA3_4_9I2R3P_sound) (by decide +kernel) +def CA3_4_9I2R3MassTermLogWitness : LogWitness := ⟨-5, 480637009241608974383676101453, 312500000000000000000000000000⟩ +def CA3_4_9I2R3MassTermLog : Ball := ⟨(-303522804530987493211666450419657 / 100000000000000000000000000000000), (63527471361 / 50000000000000000000000000000000)⟩ +lemma CA3_4_9I2R3MassTermLog_sound : CA3_4_9I2R3MassTermLog.Encloses (Real.log ((∑ a, CA3_4_9I2R3Value a))) := by + exact checkLog_sound logTwoBall_sound (CA3_4_9I2R3Mass_sound) (w := CA3_4_9I2R3MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA3_4_9I2R3MassTerm : Ball := ⟨(7294214650319965502922602621079 / 50000000000000000000000000000000), (305336543 / 5000000000000000000000000000000)⟩ +lemma CA3_4_9I2R3MassTerm_sound : CA3_4_9I2R3MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA3_4_9I2R3Value a))) := by + exact contains_sound (entropyTerm_ball (CA3_4_9I2R3Mass_sound) CA3_4_9I2R3MassTermLog_sound) (by decide +kernel) +def CA3_4_9I2R3H : Ball := ⟨(2411435470907659681105419338071 / 50000000000000000000000000000000), (1694612173 / 12500000000000000000000000000000)⟩ +lemma CA3_4_9I2R3H_sound : CA3_4_9I2R3H.Encloses (homogeneousEntropy CA3_4_9I2R3Value) := by + exact contains_sound (homogeneous_enclosed CA3_4_9I2R3Value CA3_4_9I2R3MassTerm_sound CA3_4_9I2R3Entropy_sound) (by decide +kernel) +def CA3_4_9I2R4Value (a : PairSlot) : ℝ := residualLaw (below (shape 3 4 9)) (fun u => (stageALaw (shape 3 4 9) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 4 a +def CA3_4_9I2R4Raw (a : PairSlot) : Ball := residualBall (below (shape 3 4 9)) A3_4_9Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 4 a +lemma CA3_4_9I2R4Raw_sound (a : PairSlot) : + (CA3_4_9I2R4Raw a).Encloses (CA3_4_9I2R4Value a) := by + exact residualBall_sound_on (below (shape 3 4 9)) A3_4_9Law (fun u => (stageALaw (shape 3 4 9) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A3_4_9Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 3 4 9) (show (shape 3 4 9) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 4 a +def CA3_4_9I2R4Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(4623100515197636596302359599 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(85885304912106424752106925081 / 100000000000000000000000000000000), (29369399 / 100000000000000000000000000000000)⟩ ⟨(-116108908715284072767299146936791 / 12500000000000000000000000000000), (15881868303 / 5000000000000000000000000000000)⟩ ⟨-14, 4623100515197636596302359599, 3051757812500000000000000000⟩, + .log ⟨(1611521471481617569636159217241 / 50000000000000000000000000000000), (1 / 6250000000000000000000000000000)⟩ ⟨(2767662637555370849218275890653 / 25000000000000000000000000000000), (4095035417 / 100000000000000000000000000000000)⟩ ⟨(-171742212966657406520456083400811 / 50000000000000000000000000000000), (127054942593 / 100000000000000000000000000000000)⟩ ⟨-5, 1611521471481617569636159217241, 1562500000000000000000000000000⟩, + .log ⟨(8391789291930128613674735173291 / 25000000000000000000000000000000), (13 / 12500000000000000000000000000000)⟩ ⟨(36642649332842067791324251940707 / 100000000000000000000000000000000), (2132436627 / 10000000000000000000000000000000)⟩ ⟨(-10916220622960310255925014085969 / 10000000000000000000000000000000), (31763735679 / 50000000000000000000000000000000)⟩ ⟨-2, 8391789291930128613674735173291, 6250000000000000000000000000000⟩, + .log ⟨(31217071843515331933395889141 / 2000000000000000000000000000000), (7 / 100000000000000000000000000000000)⟩ ⟨(1623263285052397325525672402621 / 25000000000000000000000000000000), (1322094437 / 50000000000000000000000000000000)⟩ ⟨(-415993733990036605144244965066989 / 100000000000000000000000000000000), (21175823739 / 12500000000000000000000000000000)⟩ ⟨-7, 31217071843515331933395889141, 15625000000000000000000000000⟩, + .log ⟨(743390276070452316441660391 / 1000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(535559867148594134063805993269 / 100000000000000000000000000000000), (94451413 / 50000000000000000000000000000000)⟩ ⟨(-720428938053311645075035565753419 / 100000000000000000000000000000000), (254109885541 / 100000000000000000000000000000000)⟩ ⟨-11, 743390276070452316441660391, 488281250000000000000000000⟩] +lemma CA3_4_9I2R4Certificates_valid : + CA3_4_9I2R4Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA3_4_9I2R4CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 5, 0 => 1 + | 4, 1 => 2 + | 2, 2 => 3 + | 2, 3 => 4 + | 3, 2 => 4 + | 3, 3 => 5 + | 1, 4 => 2 + | 0, 5 => 1 + | _, _ => 0 +def CA3_4_9I2R4P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_4_9I2R4Certificates (CA3_4_9I2R4CertificateIndex a)).input +lemma CA3_4_9I2R4P_check : ∀ a : PairSlot, contains (CA3_4_9I2R4Raw a) (CA3_4_9I2R4P a) = true := by + decide +kernel +lemma CA3_4_9I2R4P_sound (a : PairSlot) : + (CA3_4_9I2R4P a).Encloses (CA3_4_9I2R4Value a) := + contains_sound (CA3_4_9I2R4Raw_sound a) (CA3_4_9I2R4P_check a) +def CA3_4_9I2R4Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_4_9I2R4Certificates (CA3_4_9I2R4CertificateIndex a)).output +lemma CA3_4_9I2R4Terms_sound (a : PairSlot) : + (CA3_4_9I2R4Terms a).Encloses (Foundation.entropyTerm (CA3_4_9I2R4Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA3_4_9I2R4Certificates_valid + (CA3_4_9I2R4CertificateIndex a) (CA3_4_9I2R4P_sound a) +def CA3_4_9I2R4Entropy : Ball := ⟨(7247738719067702017284385813033 / 10000000000000000000000000000000), (8762614119 / 25000000000000000000000000000000)⟩ +lemma CA3_4_9I2R4Entropy_sound : CA3_4_9I2R4Entropy.Encloses (Foundation.finiteEntropy CA3_4_9I2R4Value) := by + exact contains_sound (entropyPair_enclosed CA3_4_9I2R4Value CA3_4_9I2R4Terms CA3_4_9I2R4Terms_sound) (by decide +kernel) +def CA3_4_9I2R4Mass : Ball := ⟨(10806945416916588426153135488431 / 25000000000000000000000000000000), (153 / 100000000000000000000000000000000)⟩ +lemma CA3_4_9I2R4Mass_sound : CA3_4_9I2R4Mass.Encloses (∑ a, CA3_4_9I2R4Value a) := by + exact contains_sound (pairSumBall_sound CA3_4_9I2R4P CA3_4_9I2R4Value CA3_4_9I2R4P_sound) (by decide +kernel) +def CA3_4_9I2R4MassTermLogWitness : LogWitness := ⟨-2, 10806945416916588426153135488431, 6250000000000000000000000000000⟩ +def CA3_4_9I2R4MassTermLog : Ball := ⟨(-41934340163775995053156294938029 / 50000000000000000000000000000000), (63527471403 / 100000000000000000000000000000000)⟩ +lemma CA3_4_9I2R4MassTermLog_sound : CA3_4_9I2R4MassTermLog.Encloses (Real.log ((∑ a, CA3_4_9I2R4Value a))) := by + exact checkLog_sound logTwoBall_sound (CA3_4_9I2R4Mass_sound) (w := CA3_4_9I2R4MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA3_4_9I2R4MassTerm : Ball := ⟨(9063642504886804196860635101949 / 25000000000000000000000000000000), (13730758383 / 50000000000000000000000000000000)⟩ +lemma CA3_4_9I2R4MassTerm_sound : CA3_4_9I2R4MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA3_4_9I2R4Value a))) := by + exact contains_sound (entropyTerm_ball (CA3_4_9I2R4Mass_sound) CA3_4_9I2R4MassTermLog_sound) (by decide +kernel) +def CA3_4_9I2R4H : Ball := ⟨(18111408585564901692700658861267 / 50000000000000000000000000000000), (31255986621 / 50000000000000000000000000000000)⟩ +lemma CA3_4_9I2R4H_sound : CA3_4_9I2R4H.Encloses (homogeneousEntropy CA3_4_9I2R4Value) := by + exact contains_sound (homogeneous_enclosed CA3_4_9I2R4Value CA3_4_9I2R4MassTerm_sound CA3_4_9I2R4Entropy_sound) (by decide +kernel) +def CA3_4_9I2R5Value (a : PairSlot) : ℝ := residualLaw (below (shape 3 4 9)) (fun u => (stageALaw (shape 3 4 9) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 5 a +def CA3_4_9I2R5Raw (a : PairSlot) : Ball := residualBall (below (shape 3 4 9)) A3_4_9Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 5 a +lemma CA3_4_9I2R5Raw_sound (a : PairSlot) : + (CA3_4_9I2R5Raw a).Encloses (CA3_4_9I2R5Value a) := by + exact residualBall_sound_on (below (shape 3 4 9)) A3_4_9Law (fun u => (stageALaw (shape 3 4 9) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A3_4_9Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 3 4 9) (show (shape 3 4 9) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 5 a +def CA3_4_9I2R5Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(7272508322125620575782948437 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(236866464334893733212117780143 / 100000000000000000000000000000000), (40040357 / 50000000000000000000000000000000)⟩ ⟨(-203563246203393495460811346542017 / 25000000000000000000000000000000), (68821427829 / 25000000000000000000000000000000)⟩ ⟨-12, 7272508322125620575782948437, 6103515625000000000000000000⟩, + .log ⟨(17592763981361906146979831159223 / 100000000000000000000000000000000), (23 / 50000000000000000000000000000000)⟩ ⟨(7642659550239816707168560158683 / 25000000000000000000000000000000), (14901650853 / 100000000000000000000000000000000)⟩ ⟨(-34753650118135338438594227075673 / 20000000000000000000000000000000), (84703294993 / 100000000000000000000000000000000)⟩ ⟨-3, 17592763981361906146979831159223, 12500000000000000000000000000000⟩, + .log ⟨(328839673074914029910480820183 / 50000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ ⟨(3304317811514671185683979148613 / 100000000000000000000000000000000), (1253421187 / 100000000000000000000000000000000)⟩ ⟨(-502420796830360528557032476853169 / 100000000000000000000000000000000), (190582413603 / 100000000000000000000000000000000)⟩ ⟨-8, 328839673074914029910480820183, 195312500000000000000000000000⟩] +lemma CA3_4_9I2R5Certificates_valid : + CA3_4_9I2R5Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA3_4_9I2R5CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 5, 1 => 1 + | 4, 2 => 2 + | 4, 3 => 3 + | 2, 4 => 2 + | 3, 4 => 3 + | 1, 5 => 1 + | _, _ => 0 +def CA3_4_9I2R5P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_4_9I2R5Certificates (CA3_4_9I2R5CertificateIndex a)).input +lemma CA3_4_9I2R5P_check : ∀ a : PairSlot, contains (CA3_4_9I2R5Raw a) (CA3_4_9I2R5P a) = true := by + decide +kernel +lemma CA3_4_9I2R5P_sound (a : PairSlot) : + (CA3_4_9I2R5P a).Encloses (CA3_4_9I2R5Value a) := + contains_sound (CA3_4_9I2R5Raw_sound a) (CA3_4_9I2R5P_check a) +def CA3_4_9I2R5Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_4_9I2R5Certificates (CA3_4_9I2R5CertificateIndex a)).output +lemma CA3_4_9I2R5Terms_sound (a : PairSlot) : + (CA3_4_9I2R5Terms a).Encloses (Foundation.entropyTerm (CA3_4_9I2R5Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA3_4_9I2R5Certificates_valid + (CA3_4_9I2R5CertificateIndex a) (CA3_4_9I2R5P_sound a) +def CA3_4_9I2R5Entropy : Ball := ⟨(1065994452400275992111573048859 / 1562500000000000000000000000000), (8117576377 / 25000000000000000000000000000000)⟩ +lemma CA3_4_9I2R5Entropy_sound : CA3_4_9I2R5Entropy.Encloses (Foundation.finiteEntropy CA3_4_9I2R5Value) := by + exact contains_sound (entropyPair_enclosed CA3_4_9I2R5Value CA3_4_9I2R5Terms CA3_4_9I2R5Terms_sound) (by decide +kernel) +def CA3_4_9I2R5Mass : Ball := ⟨(18279533360800236689103924593337 / 50000000000000000000000000000000), (1 / 1000000000000000000000000000000)⟩ +lemma CA3_4_9I2R5Mass_sound : CA3_4_9I2R5Mass.Encloses (∑ a, CA3_4_9I2R5Value a) := by + exact contains_sound (pairSumBall_sound CA3_4_9I2R5P CA3_4_9I2R5Value CA3_4_9I2R5P_sound) (by decide +kernel) +def CA3_4_9I2R5MassTermLogWitness : LogWitness := ⟨-2, 18279533360800236689103924593337, 12500000000000000000000000000000⟩ +def CA3_4_9I2R5MassTermLog : Ball := ⟨(-100624096703649036266445403338169 / 100000000000000000000000000000000), (31763735661 / 50000000000000000000000000000000)⟩ +lemma CA3_4_9I2R5MassTermLog_sound : CA3_4_9I2R5MassTermLog.Encloses (Real.log ((∑ a, CA3_4_9I2R5Value a))) := by + exact checkLog_sound logTwoBall_sound (CA3_4_9I2R5Mass_sound) (w := CA3_4_9I2R5MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA3_4_9I2R5MassTerm : Ball := ⟨(36787230651894833723090796725369 / 100000000000000000000000000000000), (2903131341 / 12500000000000000000000000000000)⟩ +lemma CA3_4_9I2R5MassTerm_sound : CA3_4_9I2R5MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA3_4_9I2R5Value a))) := by + exact contains_sound (entropyTerm_ball (CA3_4_9I2R5Mass_sound) CA3_4_9I2R5MassTermLog_sound) (by decide +kernel) +def CA3_4_9I2R5H : Ball := ⟨(31436414301722829772049878401607 / 100000000000000000000000000000000), (13923839059 / 25000000000000000000000000000000)⟩ +lemma CA3_4_9I2R5H_sound : CA3_4_9I2R5H.Encloses (homogeneousEntropy CA3_4_9I2R5Value) := by + exact contains_sound (homogeneous_enclosed CA3_4_9I2R5Value CA3_4_9I2R5MassTerm_sound CA3_4_9I2R5Entropy_sound) (by decide +kernel) +def CA3_4_9I2R6Value (a : PairSlot) : ℝ := residualLaw (below (shape 3 4 9)) (fun u => (stageALaw (shape 3 4 9) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 6 a +def CA3_4_9I2R6Raw (a : PairSlot) : Ball := residualBall (below (shape 3 4 9)) A3_4_9Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 6 a +lemma CA3_4_9I2R6Raw_sound (a : PairSlot) : + (CA3_4_9I2R6Raw a).Encloses (CA3_4_9I2R6Value a) := by + exact residualBall_sound_on (below (shape 3 4 9)) A3_4_9Law (fun u => (stageALaw (shape 3 4 9) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A3_4_9Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 3 4 9) (show (shape 3 4 9) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 6 a +def CA3_4_9I2R6Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(21998567971416970171570656021 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(185270797860241581996859903193 / 100000000000000000000000000000000), (32608651 / 50000000000000000000000000000000)⟩ ⟨(-421097405296941091625585047822189 / 50000000000000000000000000000000), (296461536107 / 100000000000000000000000000000000)⟩ ⟨-13, 21998567971416970171570656021, 12207031250000000000000000000⟩, + .log ⟨(1385997100016570164729329 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(25078593183583505991673963 / 100000000000000000000000000000000), (4119 / 50000000000000000000000000000000)⟩ ⟨(-452356523388174497394634131179329 / 25000000000000000000000000000000), (592995213347 / 100000000000000000000000000000000)⟩ ⟨-27, 1385997100016570164729329, 745058059692382812500000⟩, + .log ⟨(1153366528626991987959968739203 / 50000000000000000000000000000000), (11 / 100000000000000000000000000000000)⟩ ⟨(2173714097963675283279431707373 / 25000000000000000000000000000000), (3419288129 / 100000000000000000000000000000000)⟩ ⟨(-188466896169714658507801571192217 / 50000000000000000000000000000000), (148230766257 / 100000000000000000000000000000000)⟩ ⟨-6, 1153366528626991987959968739203, 781250000000000000000000000000⟩] +lemma CA3_4_9I2R6Certificates_valid : + CA3_4_9I2R6Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA3_4_9I2R6CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 5, 2 => 1 + | 5, 3 => 2 + | 4, 4 => 3 + | 2, 5 => 1 + | 3, 5 => 2 + | _, _ => 0 +def CA3_4_9I2R6P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_4_9I2R6Certificates (CA3_4_9I2R6CertificateIndex a)).input +lemma CA3_4_9I2R6P_check : ∀ a : PairSlot, contains (CA3_4_9I2R6Raw a) (CA3_4_9I2R6P a) = true := by + decide +kernel +lemma CA3_4_9I2R6P_sound (a : PairSlot) : + (CA3_4_9I2R6P a).Encloses (CA3_4_9I2R6Value a) := + contains_sound (CA3_4_9I2R6Raw_sound a) (CA3_4_9I2R6P_check a) +def CA3_4_9I2R6Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_4_9I2R6Certificates (CA3_4_9I2R6CertificateIndex a)).output +lemma CA3_4_9I2R6Terms_sound (a : PairSlot) : + (CA3_4_9I2R6Terms a).Encloses (Foundation.entropyTerm (CA3_4_9I2R6Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA3_4_9I2R6Certificates_valid + (CA3_4_9I2R6CertificateIndex a) (CA3_4_9I2R6P_sound a) +def CA3_4_9I2R6Entropy : Ball := ⟨(2266362036190387866030857495951 / 25000000000000000000000000000000), (3549739209 / 100000000000000000000000000000000)⟩ +lemma CA3_4_9I2R6Entropy_sound : CA3_4_9I2R6Entropy.Encloses (Foundation.finiteEntropy CA3_4_9I2R6Value) := by + exact contains_sound (entropyPair_enclosed CA3_4_9I2R6Value CA3_4_9I2R6Terms CA3_4_9I2R6Terms_sound) (by decide +kernel) +def CA3_4_9I2R6Mass : Ball := ⟨(1175366482595508974701704124553 / 50000000000000000000000000000000), (3 / 20000000000000000000000000000000)⟩ +lemma CA3_4_9I2R6Mass_sound : CA3_4_9I2R6Mass.Encloses (∑ a, CA3_4_9I2R6Value a) := by + exact contains_sound (pairSumBall_sound CA3_4_9I2R6P CA3_4_9I2R6Value CA3_4_9I2R6P_sound) (by decide +kernel) +def CA3_4_9I2R6MassTermLogWitness : LogWitness := ⟨-6, 1175366482595508974701704124553, 781250000000000000000000000000⟩ +def CA3_4_9I2R6MassTermLog : Ball := ⟨(-375044300638145820613044638924319 / 100000000000000000000000000000000), (148230766419 / 100000000000000000000000000000000)⟩ +lemma CA3_4_9I2R6MassTermLog_sound : CA3_4_9I2R6MassTermLog.Encloses (Real.log ((∑ a, CA3_4_9I2R6Value a))) := by + exact checkLog_sound logTwoBall_sound (CA3_4_9I2R6Mass_sound) (w := CA3_4_9I2R6MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA3_4_9I2R6MassTerm : Ball := ⟨(88162900091710011023539451221 / 1000000000000000000000000000000), (871127387 / 25000000000000000000000000000000)⟩ +lemma CA3_4_9I2R6MassTerm_sound : CA3_4_9I2R6MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA3_4_9I2R6Value a))) := by + exact contains_sound (entropyTerm_ball (CA3_4_9I2R6Mass_sound) CA3_4_9I2R6MassTermLog_sound) (by decide +kernel) +def CA3_4_9I2R6H : Ball := ⟨(31144766948818795221185607713 / 12500000000000000000000000000000), (7034248757 / 100000000000000000000000000000000)⟩ +lemma CA3_4_9I2R6H_sound : CA3_4_9I2R6H.Encloses (homogeneousEntropy CA3_4_9I2R6Value) := by + exact contains_sound (homogeneous_enclosed CA3_4_9I2R6Value CA3_4_9I2R6MassTerm_sound CA3_4_9I2R6Entropy_sound) (by decide +kernel) +def CA3_4_9I2R7Value (a : PairSlot) : ℝ := residualLaw (below (shape 3 4 9)) (fun u => (stageALaw (shape 3 4 9) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 7 a +def CA3_4_9I2R7Raw (a : PairSlot) : Ball := residualBall (below (shape 3 4 9)) A3_4_9Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 7 a +lemma CA3_4_9I2R7Raw_sound (a : PairSlot) : + (CA3_4_9I2R7Raw a).Encloses (CA3_4_9I2R7Value a) := by + exact residualBall_sound_on (below (shape 3 4 9)) A3_4_9Law (fun u => (stageALaw (shape 3 4 9) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A3_4_9Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 3 4 9) (show (shape 3 4 9) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 7 a +def CA3_4_9I2R7Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA3_4_9I2R7Certificates_valid : + CA3_4_9I2R7Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA3_4_9I2R7CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA3_4_9I2R7P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_4_9I2R7Certificates (CA3_4_9I2R7CertificateIndex a)).input +lemma CA3_4_9I2R7P_check : ∀ a : PairSlot, contains (CA3_4_9I2R7Raw a) (CA3_4_9I2R7P a) = true := by + decide +kernel +lemma CA3_4_9I2R7P_sound (a : PairSlot) : + (CA3_4_9I2R7P a).Encloses (CA3_4_9I2R7Value a) := + contains_sound (CA3_4_9I2R7Raw_sound a) (CA3_4_9I2R7P_check a) +def CA3_4_9I2R7Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_4_9I2R7Certificates (CA3_4_9I2R7CertificateIndex a)).output +lemma CA3_4_9I2R7Terms_sound (a : PairSlot) : + (CA3_4_9I2R7Terms a).Encloses (Foundation.entropyTerm (CA3_4_9I2R7Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA3_4_9I2R7Certificates_valid + (CA3_4_9I2R7CertificateIndex a) (CA3_4_9I2R7P_sound a) +def CA3_4_9I2R7Entropy : Ball := ⟨0, 0⟩ +lemma CA3_4_9I2R7Entropy_sound : CA3_4_9I2R7Entropy.Encloses (Foundation.finiteEntropy CA3_4_9I2R7Value) := by + exact contains_sound (entropyPair_enclosed CA3_4_9I2R7Value CA3_4_9I2R7Terms CA3_4_9I2R7Terms_sound) (by decide +kernel) +def CA3_4_9I2R7Mass : Ball := ⟨0, 0⟩ +lemma CA3_4_9I2R7Mass_sound : CA3_4_9I2R7Mass.Encloses (∑ a, CA3_4_9I2R7Value a) := by + exact contains_sound (pairSumBall_sound CA3_4_9I2R7P CA3_4_9I2R7Value CA3_4_9I2R7P_sound) (by decide +kernel) +def CA3_4_9I2R7MassTerm : Ball := .exact 0 +lemma CA3_4_9I2R7MassTerm_sound : CA3_4_9I2R7MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA3_4_9I2R7Value a))) := + entropyTerm_zero_ball (CA3_4_9I2R7Mass_sound) +def CA3_4_9I2R7H : Ball := ⟨0, 0⟩ +lemma CA3_4_9I2R7H_sound : CA3_4_9I2R7H.Encloses (homogeneousEntropy CA3_4_9I2R7Value) := by + exact contains_sound (homogeneous_enclosed CA3_4_9I2R7Value CA3_4_9I2R7MassTerm_sound CA3_4_9I2R7Entropy_sound) (by decide +kernel) +def CA3_4_9I2R8Value (a : PairSlot) : ℝ := residualLaw (below (shape 3 4 9)) (fun u => (stageALaw (shape 3 4 9) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 8 a +def CA3_4_9I2R8Raw (a : PairSlot) : Ball := residualBall (below (shape 3 4 9)) A3_4_9Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 8 a +lemma CA3_4_9I2R8Raw_sound (a : PairSlot) : + (CA3_4_9I2R8Raw a).Encloses (CA3_4_9I2R8Value a) := by + exact residualBall_sound_on (below (shape 3 4 9)) A3_4_9Law (fun u => (stageALaw (shape 3 4 9) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A3_4_9Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 3 4 9) (show (shape 3 4 9) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 8 a +def CA3_4_9I2R8Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA3_4_9I2R8Certificates_valid : + CA3_4_9I2R8Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA3_4_9I2R8CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA3_4_9I2R8P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_4_9I2R8Certificates (CA3_4_9I2R8CertificateIndex a)).input +lemma CA3_4_9I2R8P_check : ∀ a : PairSlot, contains (CA3_4_9I2R8Raw a) (CA3_4_9I2R8P a) = true := by + decide +kernel +lemma CA3_4_9I2R8P_sound (a : PairSlot) : + (CA3_4_9I2R8P a).Encloses (CA3_4_9I2R8Value a) := + contains_sound (CA3_4_9I2R8Raw_sound a) (CA3_4_9I2R8P_check a) +def CA3_4_9I2R8Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_4_9I2R8Certificates (CA3_4_9I2R8CertificateIndex a)).output +lemma CA3_4_9I2R8Terms_sound (a : PairSlot) : + (CA3_4_9I2R8Terms a).Encloses (Foundation.entropyTerm (CA3_4_9I2R8Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA3_4_9I2R8Certificates_valid + (CA3_4_9I2R8CertificateIndex a) (CA3_4_9I2R8P_sound a) +def CA3_4_9I2R8Entropy : Ball := ⟨0, 0⟩ +lemma CA3_4_9I2R8Entropy_sound : CA3_4_9I2R8Entropy.Encloses (Foundation.finiteEntropy CA3_4_9I2R8Value) := by + exact contains_sound (entropyPair_enclosed CA3_4_9I2R8Value CA3_4_9I2R8Terms CA3_4_9I2R8Terms_sound) (by decide +kernel) +def CA3_4_9I2R8Mass : Ball := ⟨0, 0⟩ +lemma CA3_4_9I2R8Mass_sound : CA3_4_9I2R8Mass.Encloses (∑ a, CA3_4_9I2R8Value a) := by + exact contains_sound (pairSumBall_sound CA3_4_9I2R8P CA3_4_9I2R8Value CA3_4_9I2R8P_sound) (by decide +kernel) +def CA3_4_9I2R8MassTerm : Ball := .exact 0 +lemma CA3_4_9I2R8MassTerm_sound : CA3_4_9I2R8MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA3_4_9I2R8Value a))) := + entropyTerm_zero_ball (CA3_4_9I2R8Mass_sound) +def CA3_4_9I2R8H : Ball := ⟨0, 0⟩ +lemma CA3_4_9I2R8H_sound : CA3_4_9I2R8H.Encloses (homogeneousEntropy CA3_4_9I2R8Value) := by + exact contains_sound (homogeneous_enclosed CA3_4_9I2R8Value CA3_4_9I2R8MassTerm_sound CA3_4_9I2R8Entropy_sound) (by decide +kernel) +def CA3_4_9I2R9Value (a : PairSlot) : ℝ := residualLaw (below (shape 3 4 9)) (fun u => (stageALaw (shape 3 4 9) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 9 a +def CA3_4_9I2R9Raw (a : PairSlot) : Ball := residualBall (below (shape 3 4 9)) A3_4_9Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 9 a +lemma CA3_4_9I2R9Raw_sound (a : PairSlot) : + (CA3_4_9I2R9Raw a).Encloses (CA3_4_9I2R9Value a) := by + exact residualBall_sound_on (below (shape 3 4 9)) A3_4_9Law (fun u => (stageALaw (shape 3 4 9) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A3_4_9Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 3 4 9) (show (shape 3 4 9) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 9 a +def CA3_4_9I2R9Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA3_4_9I2R9Certificates_valid : + CA3_4_9I2R9Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA3_4_9I2R9CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA3_4_9I2R9P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_4_9I2R9Certificates (CA3_4_9I2R9CertificateIndex a)).input +lemma CA3_4_9I2R9P_check : ∀ a : PairSlot, contains (CA3_4_9I2R9Raw a) (CA3_4_9I2R9P a) = true := by + decide +kernel +lemma CA3_4_9I2R9P_sound (a : PairSlot) : + (CA3_4_9I2R9P a).Encloses (CA3_4_9I2R9Value a) := + contains_sound (CA3_4_9I2R9Raw_sound a) (CA3_4_9I2R9P_check a) +def CA3_4_9I2R9Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_4_9I2R9Certificates (CA3_4_9I2R9CertificateIndex a)).output +lemma CA3_4_9I2R9Terms_sound (a : PairSlot) : + (CA3_4_9I2R9Terms a).Encloses (Foundation.entropyTerm (CA3_4_9I2R9Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA3_4_9I2R9Certificates_valid + (CA3_4_9I2R9CertificateIndex a) (CA3_4_9I2R9P_sound a) +def CA3_4_9I2R9Entropy : Ball := ⟨0, 0⟩ +lemma CA3_4_9I2R9Entropy_sound : CA3_4_9I2R9Entropy.Encloses (Foundation.finiteEntropy CA3_4_9I2R9Value) := by + exact contains_sound (entropyPair_enclosed CA3_4_9I2R9Value CA3_4_9I2R9Terms CA3_4_9I2R9Terms_sound) (by decide +kernel) +def CA3_4_9I2R9Mass : Ball := ⟨0, 0⟩ +lemma CA3_4_9I2R9Mass_sound : CA3_4_9I2R9Mass.Encloses (∑ a, CA3_4_9I2R9Value a) := by + exact contains_sound (pairSumBall_sound CA3_4_9I2R9P CA3_4_9I2R9Value CA3_4_9I2R9P_sound) (by decide +kernel) +def CA3_4_9I2R9MassTerm : Ball := .exact 0 +lemma CA3_4_9I2R9MassTerm_sound : CA3_4_9I2R9MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA3_4_9I2R9Value a))) := + entropyTerm_zero_ball (CA3_4_9I2R9Mass_sound) +def CA3_4_9I2R9H : Ball := ⟨0, 0⟩ +lemma CA3_4_9I2R9H_sound : CA3_4_9I2R9H.Encloses (homogeneousEntropy CA3_4_9I2R9Value) := by + exact contains_sound (homogeneous_enclosed CA3_4_9I2R9Value CA3_4_9I2R9MassTerm_sound CA3_4_9I2R9Entropy_sound) (by decide +kernel) +def CA3_4_9I2R10Value (a : PairSlot) : ℝ := residualLaw (below (shape 3 4 9)) (fun u => (stageALaw (shape 3 4 9) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 10 a +def CA3_4_9I2R10Raw (a : PairSlot) : Ball := residualBall (below (shape 3 4 9)) A3_4_9Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 10 a +lemma CA3_4_9I2R10Raw_sound (a : PairSlot) : + (CA3_4_9I2R10Raw a).Encloses (CA3_4_9I2R10Value a) := by + exact residualBall_sound_on (below (shape 3 4 9)) A3_4_9Law (fun u => (stageALaw (shape 3 4 9) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A3_4_9Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 3 4 9) (show (shape 3 4 9) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 10 a +def CA3_4_9I2R10Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA3_4_9I2R10Certificates_valid : + CA3_4_9I2R10Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA3_4_9I2R10CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA3_4_9I2R10P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_4_9I2R10Certificates (CA3_4_9I2R10CertificateIndex a)).input +lemma CA3_4_9I2R10P_check : ∀ a : PairSlot, contains (CA3_4_9I2R10Raw a) (CA3_4_9I2R10P a) = true := by + decide +kernel +lemma CA3_4_9I2R10P_sound (a : PairSlot) : + (CA3_4_9I2R10P a).Encloses (CA3_4_9I2R10Value a) := + contains_sound (CA3_4_9I2R10Raw_sound a) (CA3_4_9I2R10P_check a) +def CA3_4_9I2R10Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_4_9I2R10Certificates (CA3_4_9I2R10CertificateIndex a)).output +lemma CA3_4_9I2R10Terms_sound (a : PairSlot) : + (CA3_4_9I2R10Terms a).Encloses (Foundation.entropyTerm (CA3_4_9I2R10Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA3_4_9I2R10Certificates_valid + (CA3_4_9I2R10CertificateIndex a) (CA3_4_9I2R10P_sound a) +def CA3_4_9I2R10Entropy : Ball := ⟨0, 0⟩ +lemma CA3_4_9I2R10Entropy_sound : CA3_4_9I2R10Entropy.Encloses (Foundation.finiteEntropy CA3_4_9I2R10Value) := by + exact contains_sound (entropyPair_enclosed CA3_4_9I2R10Value CA3_4_9I2R10Terms CA3_4_9I2R10Terms_sound) (by decide +kernel) +def CA3_4_9I2R10Mass : Ball := ⟨0, 0⟩ +lemma CA3_4_9I2R10Mass_sound : CA3_4_9I2R10Mass.Encloses (∑ a, CA3_4_9I2R10Value a) := by + exact contains_sound (pairSumBall_sound CA3_4_9I2R10P CA3_4_9I2R10Value CA3_4_9I2R10P_sound) (by decide +kernel) +def CA3_4_9I2R10MassTerm : Ball := .exact 0 +lemma CA3_4_9I2R10MassTerm_sound : CA3_4_9I2R10MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA3_4_9I2R10Value a))) := + entropyTerm_zero_ball (CA3_4_9I2R10Mass_sound) +def CA3_4_9I2R10H : Ball := ⟨0, 0⟩ +lemma CA3_4_9I2R10H_sound : CA3_4_9I2R10H.Encloses (homogeneousEntropy CA3_4_9I2R10Value) := by + exact contains_sound (homogeneous_enclosed CA3_4_9I2R10Value CA3_4_9I2R10MassTerm_sound CA3_4_9I2R10Entropy_sound) (by decide +kernel) +def CA3_4_9I2R11Value (a : PairSlot) : ℝ := residualLaw (below (shape 3 4 9)) (fun u => (stageALaw (shape 3 4 9) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 11 a +def CA3_4_9I2R11Raw (a : PairSlot) : Ball := residualBall (below (shape 3 4 9)) A3_4_9Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 11 a +lemma CA3_4_9I2R11Raw_sound (a : PairSlot) : + (CA3_4_9I2R11Raw a).Encloses (CA3_4_9I2R11Value a) := by + exact residualBall_sound_on (below (shape 3 4 9)) A3_4_9Law (fun u => (stageALaw (shape 3 4 9) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A3_4_9Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 3 4 9) (show (shape 3 4 9) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 11 a +def CA3_4_9I2R11Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA3_4_9I2R11Certificates_valid : + CA3_4_9I2R11Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA3_4_9I2R11CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA3_4_9I2R11P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_4_9I2R11Certificates (CA3_4_9I2R11CertificateIndex a)).input +lemma CA3_4_9I2R11P_check : ∀ a : PairSlot, contains (CA3_4_9I2R11Raw a) (CA3_4_9I2R11P a) = true := by + decide +kernel +lemma CA3_4_9I2R11P_sound (a : PairSlot) : + (CA3_4_9I2R11P a).Encloses (CA3_4_9I2R11Value a) := + contains_sound (CA3_4_9I2R11Raw_sound a) (CA3_4_9I2R11P_check a) +def CA3_4_9I2R11Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_4_9I2R11Certificates (CA3_4_9I2R11CertificateIndex a)).output +lemma CA3_4_9I2R11Terms_sound (a : PairSlot) : + (CA3_4_9I2R11Terms a).Encloses (Foundation.entropyTerm (CA3_4_9I2R11Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA3_4_9I2R11Certificates_valid + (CA3_4_9I2R11CertificateIndex a) (CA3_4_9I2R11P_sound a) +def CA3_4_9I2R11Entropy : Ball := ⟨0, 0⟩ +lemma CA3_4_9I2R11Entropy_sound : CA3_4_9I2R11Entropy.Encloses (Foundation.finiteEntropy CA3_4_9I2R11Value) := by + exact contains_sound (entropyPair_enclosed CA3_4_9I2R11Value CA3_4_9I2R11Terms CA3_4_9I2R11Terms_sound) (by decide +kernel) +def CA3_4_9I2R11Mass : Ball := ⟨0, 0⟩ +lemma CA3_4_9I2R11Mass_sound : CA3_4_9I2R11Mass.Encloses (∑ a, CA3_4_9I2R11Value a) := by + exact contains_sound (pairSumBall_sound CA3_4_9I2R11P CA3_4_9I2R11Value CA3_4_9I2R11P_sound) (by decide +kernel) +def CA3_4_9I2R11MassTerm : Ball := .exact 0 +lemma CA3_4_9I2R11MassTerm_sound : CA3_4_9I2R11MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA3_4_9I2R11Value a))) := + entropyTerm_zero_ball (CA3_4_9I2R11Mass_sound) +def CA3_4_9I2R11H : Ball := ⟨0, 0⟩ +lemma CA3_4_9I2R11H_sound : CA3_4_9I2R11H.Encloses (homogeneousEntropy CA3_4_9I2R11Value) := by + exact contains_sound (homogeneous_enclosed CA3_4_9I2R11Value CA3_4_9I2R11MassTerm_sound CA3_4_9I2R11Entropy_sound) (by decide +kernel) +def CA3_4_9I2R12Value (a : PairSlot) : ℝ := residualLaw (below (shape 3 4 9)) (fun u => (stageALaw (shape 3 4 9) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 12 a +def CA3_4_9I2R12Raw (a : PairSlot) : Ball := residualBall (below (shape 3 4 9)) A3_4_9Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 12 a +lemma CA3_4_9I2R12Raw_sound (a : PairSlot) : + (CA3_4_9I2R12Raw a).Encloses (CA3_4_9I2R12Value a) := by + exact residualBall_sound_on (below (shape 3 4 9)) A3_4_9Law (fun u => (stageALaw (shape 3 4 9) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A3_4_9Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 3 4 9) (show (shape 3 4 9) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 12 a +def CA3_4_9I2R12Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA3_4_9I2R12Certificates_valid : + CA3_4_9I2R12Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA3_4_9I2R12CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA3_4_9I2R12P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_4_9I2R12Certificates (CA3_4_9I2R12CertificateIndex a)).input +lemma CA3_4_9I2R12P_check : ∀ a : PairSlot, contains (CA3_4_9I2R12Raw a) (CA3_4_9I2R12P a) = true := by + decide +kernel +lemma CA3_4_9I2R12P_sound (a : PairSlot) : + (CA3_4_9I2R12P a).Encloses (CA3_4_9I2R12Value a) := + contains_sound (CA3_4_9I2R12Raw_sound a) (CA3_4_9I2R12P_check a) +def CA3_4_9I2R12Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_4_9I2R12Certificates (CA3_4_9I2R12CertificateIndex a)).output +lemma CA3_4_9I2R12Terms_sound (a : PairSlot) : + (CA3_4_9I2R12Terms a).Encloses (Foundation.entropyTerm (CA3_4_9I2R12Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA3_4_9I2R12Certificates_valid + (CA3_4_9I2R12CertificateIndex a) (CA3_4_9I2R12P_sound a) +def CA3_4_9I2R12Entropy : Ball := ⟨0, 0⟩ +lemma CA3_4_9I2R12Entropy_sound : CA3_4_9I2R12Entropy.Encloses (Foundation.finiteEntropy CA3_4_9I2R12Value) := by + exact contains_sound (entropyPair_enclosed CA3_4_9I2R12Value CA3_4_9I2R12Terms CA3_4_9I2R12Terms_sound) (by decide +kernel) +def CA3_4_9I2R12Mass : Ball := ⟨0, 0⟩ +lemma CA3_4_9I2R12Mass_sound : CA3_4_9I2R12Mass.Encloses (∑ a, CA3_4_9I2R12Value a) := by + exact contains_sound (pairSumBall_sound CA3_4_9I2R12P CA3_4_9I2R12Value CA3_4_9I2R12P_sound) (by decide +kernel) +def CA3_4_9I2R12MassTerm : Ball := .exact 0 +lemma CA3_4_9I2R12MassTerm_sound : CA3_4_9I2R12MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA3_4_9I2R12Value a))) := + entropyTerm_zero_ball (CA3_4_9I2R12Mass_sound) +def CA3_4_9I2R12H : Ball := ⟨0, 0⟩ +lemma CA3_4_9I2R12H_sound : CA3_4_9I2R12H.Encloses (homogeneousEntropy CA3_4_9I2R12Value) := by + exact contains_sound (homogeneous_enclosed CA3_4_9I2R12Value CA3_4_9I2R12MassTerm_sound CA3_4_9I2R12Entropy_sound) (by decide +kernel) +def CA3_4_9I2R13Value (a : PairSlot) : ℝ := residualLaw (below (shape 3 4 9)) (fun u => (stageALaw (shape 3 4 9) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 13 a +def CA3_4_9I2R13Raw (a : PairSlot) : Ball := residualBall (below (shape 3 4 9)) A3_4_9Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 13 a +lemma CA3_4_9I2R13Raw_sound (a : PairSlot) : + (CA3_4_9I2R13Raw a).Encloses (CA3_4_9I2R13Value a) := by + exact residualBall_sound_on (below (shape 3 4 9)) A3_4_9Law (fun u => (stageALaw (shape 3 4 9) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A3_4_9Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 3 4 9) (show (shape 3 4 9) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 13 a +def CA3_4_9I2R13Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA3_4_9I2R13Certificates_valid : + CA3_4_9I2R13Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA3_4_9I2R13CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA3_4_9I2R13P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_4_9I2R13Certificates (CA3_4_9I2R13CertificateIndex a)).input +lemma CA3_4_9I2R13P_check : ∀ a : PairSlot, contains (CA3_4_9I2R13Raw a) (CA3_4_9I2R13P a) = true := by + decide +kernel +lemma CA3_4_9I2R13P_sound (a : PairSlot) : + (CA3_4_9I2R13P a).Encloses (CA3_4_9I2R13Value a) := + contains_sound (CA3_4_9I2R13Raw_sound a) (CA3_4_9I2R13P_check a) +def CA3_4_9I2R13Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_4_9I2R13Certificates (CA3_4_9I2R13CertificateIndex a)).output +lemma CA3_4_9I2R13Terms_sound (a : PairSlot) : + (CA3_4_9I2R13Terms a).Encloses (Foundation.entropyTerm (CA3_4_9I2R13Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA3_4_9I2R13Certificates_valid + (CA3_4_9I2R13CertificateIndex a) (CA3_4_9I2R13P_sound a) +def CA3_4_9I2R13Entropy : Ball := ⟨0, 0⟩ +lemma CA3_4_9I2R13Entropy_sound : CA3_4_9I2R13Entropy.Encloses (Foundation.finiteEntropy CA3_4_9I2R13Value) := by + exact contains_sound (entropyPair_enclosed CA3_4_9I2R13Value CA3_4_9I2R13Terms CA3_4_9I2R13Terms_sound) (by decide +kernel) +def CA3_4_9I2R13Mass : Ball := ⟨0, 0⟩ +lemma CA3_4_9I2R13Mass_sound : CA3_4_9I2R13Mass.Encloses (∑ a, CA3_4_9I2R13Value a) := by + exact contains_sound (pairSumBall_sound CA3_4_9I2R13P CA3_4_9I2R13Value CA3_4_9I2R13P_sound) (by decide +kernel) +def CA3_4_9I2R13MassTerm : Ball := .exact 0 +lemma CA3_4_9I2R13MassTerm_sound : CA3_4_9I2R13MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA3_4_9I2R13Value a))) := + entropyTerm_zero_ball (CA3_4_9I2R13Mass_sound) +def CA3_4_9I2R13H : Ball := ⟨0, 0⟩ +lemma CA3_4_9I2R13H_sound : CA3_4_9I2R13H.Encloses (homogeneousEntropy CA3_4_9I2R13Value) := by + exact contains_sound (homogeneous_enclosed CA3_4_9I2R13Value CA3_4_9I2R13MassTerm_sound CA3_4_9I2R13Entropy_sound) (by decide +kernel) +def CA3_4_9I2R14Value (a : PairSlot) : ℝ := residualLaw (below (shape 3 4 9)) (fun u => (stageALaw (shape 3 4 9) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 14 a +def CA3_4_9I2R14Raw (a : PairSlot) : Ball := residualBall (below (shape 3 4 9)) A3_4_9Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 14 a +lemma CA3_4_9I2R14Raw_sound (a : PairSlot) : + (CA3_4_9I2R14Raw a).Encloses (CA3_4_9I2R14Value a) := by + exact residualBall_sound_on (below (shape 3 4 9)) A3_4_9Law (fun u => (stageALaw (shape 3 4 9) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A3_4_9Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 3 4 9) (show (shape 3 4 9) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 14 a +def CA3_4_9I2R14Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA3_4_9I2R14Certificates_valid : + CA3_4_9I2R14Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA3_4_9I2R14CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA3_4_9I2R14P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_4_9I2R14Certificates (CA3_4_9I2R14CertificateIndex a)).input +lemma CA3_4_9I2R14P_check : ∀ a : PairSlot, contains (CA3_4_9I2R14Raw a) (CA3_4_9I2R14P a) = true := by + decide +kernel +lemma CA3_4_9I2R14P_sound (a : PairSlot) : + (CA3_4_9I2R14P a).Encloses (CA3_4_9I2R14Value a) := + contains_sound (CA3_4_9I2R14Raw_sound a) (CA3_4_9I2R14P_check a) +def CA3_4_9I2R14Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_4_9I2R14Certificates (CA3_4_9I2R14CertificateIndex a)).output +lemma CA3_4_9I2R14Terms_sound (a : PairSlot) : + (CA3_4_9I2R14Terms a).Encloses (Foundation.entropyTerm (CA3_4_9I2R14Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA3_4_9I2R14Certificates_valid + (CA3_4_9I2R14CertificateIndex a) (CA3_4_9I2R14P_sound a) +def CA3_4_9I2R14Entropy : Ball := ⟨0, 0⟩ +lemma CA3_4_9I2R14Entropy_sound : CA3_4_9I2R14Entropy.Encloses (Foundation.finiteEntropy CA3_4_9I2R14Value) := by + exact contains_sound (entropyPair_enclosed CA3_4_9I2R14Value CA3_4_9I2R14Terms CA3_4_9I2R14Terms_sound) (by decide +kernel) +def CA3_4_9I2R14Mass : Ball := ⟨0, 0⟩ +lemma CA3_4_9I2R14Mass_sound : CA3_4_9I2R14Mass.Encloses (∑ a, CA3_4_9I2R14Value a) := by + exact contains_sound (pairSumBall_sound CA3_4_9I2R14P CA3_4_9I2R14Value CA3_4_9I2R14P_sound) (by decide +kernel) +def CA3_4_9I2R14MassTerm : Ball := .exact 0 +lemma CA3_4_9I2R14MassTerm_sound : CA3_4_9I2R14MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA3_4_9I2R14Value a))) := + entropyTerm_zero_ball (CA3_4_9I2R14Mass_sound) +def CA3_4_9I2R14H : Ball := ⟨0, 0⟩ +lemma CA3_4_9I2R14H_sound : CA3_4_9I2R14H.Encloses (homogeneousEntropy CA3_4_9I2R14Value) := by + exact contains_sound (homogeneous_enclosed CA3_4_9I2R14Value CA3_4_9I2R14MassTerm_sound CA3_4_9I2R14Entropy_sound) (by decide +kernel) +def CA3_4_9I2R15Value (a : PairSlot) : ℝ := residualLaw (below (shape 3 4 9)) (fun u => (stageALaw (shape 3 4 9) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 15 a +def CA3_4_9I2R15Raw (a : PairSlot) : Ball := residualBall (below (shape 3 4 9)) A3_4_9Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 15 a +lemma CA3_4_9I2R15Raw_sound (a : PairSlot) : + (CA3_4_9I2R15Raw a).Encloses (CA3_4_9I2R15Value a) := by + exact residualBall_sound_on (below (shape 3 4 9)) A3_4_9Law (fun u => (stageALaw (shape 3 4 9) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A3_4_9Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 3 4 9) (show (shape 3 4 9) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 15 a +def CA3_4_9I2R15Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA3_4_9I2R15Certificates_valid : + CA3_4_9I2R15Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA3_4_9I2R15CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA3_4_9I2R15P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_4_9I2R15Certificates (CA3_4_9I2R15CertificateIndex a)).input +lemma CA3_4_9I2R15P_check : ∀ a : PairSlot, contains (CA3_4_9I2R15Raw a) (CA3_4_9I2R15P a) = true := by + decide +kernel +lemma CA3_4_9I2R15P_sound (a : PairSlot) : + (CA3_4_9I2R15P a).Encloses (CA3_4_9I2R15Value a) := + contains_sound (CA3_4_9I2R15Raw_sound a) (CA3_4_9I2R15P_check a) +def CA3_4_9I2R15Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_4_9I2R15Certificates (CA3_4_9I2R15CertificateIndex a)).output +lemma CA3_4_9I2R15Terms_sound (a : PairSlot) : + (CA3_4_9I2R15Terms a).Encloses (Foundation.entropyTerm (CA3_4_9I2R15Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA3_4_9I2R15Certificates_valid + (CA3_4_9I2R15CertificateIndex a) (CA3_4_9I2R15P_sound a) +def CA3_4_9I2R15Entropy : Ball := ⟨0, 0⟩ +lemma CA3_4_9I2R15Entropy_sound : CA3_4_9I2R15Entropy.Encloses (Foundation.finiteEntropy CA3_4_9I2R15Value) := by + exact contains_sound (entropyPair_enclosed CA3_4_9I2R15Value CA3_4_9I2R15Terms CA3_4_9I2R15Terms_sound) (by decide +kernel) +def CA3_4_9I2R15Mass : Ball := ⟨0, 0⟩ +lemma CA3_4_9I2R15Mass_sound : CA3_4_9I2R15Mass.Encloses (∑ a, CA3_4_9I2R15Value a) := by + exact contains_sound (pairSumBall_sound CA3_4_9I2R15P CA3_4_9I2R15Value CA3_4_9I2R15P_sound) (by decide +kernel) +def CA3_4_9I2R15MassTerm : Ball := .exact 0 +lemma CA3_4_9I2R15MassTerm_sound : CA3_4_9I2R15MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA3_4_9I2R15Value a))) := + entropyTerm_zero_ball (CA3_4_9I2R15Mass_sound) +def CA3_4_9I2R15H : Ball := ⟨0, 0⟩ +lemma CA3_4_9I2R15H_sound : CA3_4_9I2R15H.Encloses (homogeneousEntropy CA3_4_9I2R15Value) := by + exact contains_sound (homogeneous_enclosed CA3_4_9I2R15Value CA3_4_9I2R15MassTerm_sound CA3_4_9I2R15Entropy_sound) (by decide +kernel) +def CA3_4_9I2R16Value (a : PairSlot) : ℝ := residualLaw (below (shape 3 4 9)) (fun u => (stageALaw (shape 3 4 9) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 16 a +def CA3_4_9I2R16Raw (a : PairSlot) : Ball := residualBall (below (shape 3 4 9)) A3_4_9Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 16 a +lemma CA3_4_9I2R16Raw_sound (a : PairSlot) : + (CA3_4_9I2R16Raw a).Encloses (CA3_4_9I2R16Value a) := by + exact residualBall_sound_on (below (shape 3 4 9)) A3_4_9Law (fun u => (stageALaw (shape 3 4 9) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A3_4_9Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 3 4 9) (show (shape 3 4 9) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 16 a +def CA3_4_9I2R16Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA3_4_9I2R16Certificates_valid : + CA3_4_9I2R16Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA3_4_9I2R16CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA3_4_9I2R16P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_4_9I2R16Certificates (CA3_4_9I2R16CertificateIndex a)).input +lemma CA3_4_9I2R16P_check : ∀ a : PairSlot, contains (CA3_4_9I2R16Raw a) (CA3_4_9I2R16P a) = true := by + decide +kernel +lemma CA3_4_9I2R16P_sound (a : PairSlot) : + (CA3_4_9I2R16P a).Encloses (CA3_4_9I2R16Value a) := + contains_sound (CA3_4_9I2R16Raw_sound a) (CA3_4_9I2R16P_check a) +def CA3_4_9I2R16Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_4_9I2R16Certificates (CA3_4_9I2R16CertificateIndex a)).output +lemma CA3_4_9I2R16Terms_sound (a : PairSlot) : + (CA3_4_9I2R16Terms a).Encloses (Foundation.entropyTerm (CA3_4_9I2R16Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA3_4_9I2R16Certificates_valid + (CA3_4_9I2R16CertificateIndex a) (CA3_4_9I2R16P_sound a) +def CA3_4_9I2R16Entropy : Ball := ⟨0, 0⟩ +lemma CA3_4_9I2R16Entropy_sound : CA3_4_9I2R16Entropy.Encloses (Foundation.finiteEntropy CA3_4_9I2R16Value) := by + exact contains_sound (entropyPair_enclosed CA3_4_9I2R16Value CA3_4_9I2R16Terms CA3_4_9I2R16Terms_sound) (by decide +kernel) +def CA3_4_9I2R16Mass : Ball := ⟨0, 0⟩ +lemma CA3_4_9I2R16Mass_sound : CA3_4_9I2R16Mass.Encloses (∑ a, CA3_4_9I2R16Value a) := by + exact contains_sound (pairSumBall_sound CA3_4_9I2R16P CA3_4_9I2R16Value CA3_4_9I2R16P_sound) (by decide +kernel) +def CA3_4_9I2R16MassTerm : Ball := .exact 0 +lemma CA3_4_9I2R16MassTerm_sound : CA3_4_9I2R16MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA3_4_9I2R16Value a))) := + entropyTerm_zero_ball (CA3_4_9I2R16Mass_sound) +def CA3_4_9I2R16H : Ball := ⟨0, 0⟩ +lemma CA3_4_9I2R16H_sound : CA3_4_9I2R16H.Encloses (homogeneousEntropy CA3_4_9I2R16Value) := by + exact contains_sound (homogeneous_enclosed CA3_4_9I2R16Value CA3_4_9I2R16MassTerm_sound CA3_4_9I2R16Entropy_sound) (by decide +kernel) +def CA3_4_9I2ResidualEntropies (a : Fin 17) : Ball := + match a.val with + | 0 => CA3_4_9I2R0H + | 1 => CA3_4_9I2R1H + | 2 => CA3_4_9I2R2H + | 3 => CA3_4_9I2R3H + | 4 => CA3_4_9I2R4H + | 5 => CA3_4_9I2R5H + | 6 => CA3_4_9I2R6H + | 7 => CA3_4_9I2R7H + | 8 => CA3_4_9I2R8H + | 9 => CA3_4_9I2R9H + | 10 => CA3_4_9I2R10H + | 11 => CA3_4_9I2R11H + | 12 => CA3_4_9I2R12H + | 13 => CA3_4_9I2R13H + | 14 => CA3_4_9I2R14H + | 15 => CA3_4_9I2R15H + | 16 => CA3_4_9I2R16H + | _ => (.exact 0) +lemma CA3_4_9I2ResidualEntropies_sound (k : Fin 17) : + (CA3_4_9I2ResidualEntropies k).Encloses (homogeneousEntropy + (residualLaw (below (shape 3 4 9)) (fun u => (stageALaw (shape 3 4 9) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) k)) := by + fin_cases k + · exact CA3_4_9I2R0H_sound + · exact CA3_4_9I2R1H_sound + · exact CA3_4_9I2R2H_sound + · exact CA3_4_9I2R3H_sound + · exact CA3_4_9I2R4H_sound + · exact CA3_4_9I2R5H_sound + · exact CA3_4_9I2R6H_sound + · exact CA3_4_9I2R7H_sound + · exact CA3_4_9I2R8H_sound + · exact CA3_4_9I2R9H_sound + · exact CA3_4_9I2R10H_sound + · exact CA3_4_9I2R11H_sound + · exact CA3_4_9I2R12H_sound + · exact CA3_4_9I2R13H_sound + · exact CA3_4_9I2R14H_sound + · exact CA3_4_9I2R15H_sound + · exact CA3_4_9I2R16H_sound +def CA3_4_9I2Singles (s : Shape) : Ball := + match s 0, s 1, s 2 with + | 0, 0, 8 => Z0_0_8H2H + | 0, 1, 7 => Z0_1_7H2H + | 0, 2, 6 => Z0_2_6H2H + | 0, 3, 5 => Z0_3_5H2H + | 0, 4, 4 => Z0_4_4H2H + | 1, 0, 7 => Z1_0_7H2H + | 2, 0, 6 => Z2_0_6H2H + | 3, 0, 5 => Z3_0_5H2H + | _, _, _ => (.exact 0) +lemma CA3_4_9I2Singles_sound (u : Shape) (hu : u ∈ below (shape 3 4 9)) + (hd : designated (Equiv.refl (Fin 3)) 2 u) : + (CA3_4_9I2Singles u).Encloses (homogeneousEntropy ((fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) u)) := by + rw [A3_4_9_below] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl + · exact Z0_0_8H2H_sound + · exact Z0_1_7H2H_sound + · exact Z0_2_6H2H_sound + · exact Z0_3_5H2H_sound + · exact Z0_4_4H2H_sound + · exact Z1_0_7H2H_sound + · exact (show ¬ designated (Equiv.refl (Fin 3)) 2 (shape 1 1 6) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 2 (shape 1 2 5) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 2 (shape 1 3 4) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 2 (shape 1 4 3) by decide +kernel) hd |>.elim + · exact Z2_0_6H2H_sound + · exact (show ¬ designated (Equiv.refl (Fin 3)) 2 (shape 2 1 5) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 2 (shape 2 2 4) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 2 (shape 2 3 3) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 2 (shape 2 4 2) by decide +kernel) hd |>.elim + · exact Z3_0_5H2H_sound + · exact (show ¬ designated (Equiv.refl (Fin 3)) 2 (shape 3 1 4) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 2 (shape 3 2 3) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 2 (shape 3 3 2) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 2 (shape 3 4 1) by decide +kernel) hd |>.elim +def CA3_4_9I2Singleton : Ball := ⟨(15375045182343300175117354668423 / 100000000000000000000000000000000), (125676761 / 1000000000000000000000000000000)⟩ +lemma CA3_4_9I2Singleton_sound : CA3_4_9I2Singleton.Encloses + (singletonEntropy (below (shape 3 4 9)) (fun u => (stageALaw (shape 3 4 9) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ))) := by + exact contains_sound (singletonBall_sound (below (shape 3 4 9)) A3_4_9Law (fun u => (stageALaw (shape 3 4 9) u : ℝ)) (Equiv.refl (Fin 3)) 2 + CA3_4_9I2Singles (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A3_4_9Law_sound u) CA3_4_9I2Singles_sound) (by decide +kernel) +def CA3_4_9I2Group : Ball := ⟨(88183517545178379153268898808731 / 100000000000000000000000000000000), (151782191103 / 100000000000000000000000000000000)⟩ +lemma CA3_4_9I2Group_sound : CA3_4_9I2Group.Encloses + (groupedEntropy (below (shape 3 4 9)) (fun u => (stageALaw (shape 3 4 9) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ))) := by + exact contains_sound (Ball.add_sound CA3_4_9I2Singleton_sound + (finSumBall_sound 17 CA3_4_9I2ResidualEntropies _ CA3_4_9I2ResidualEntropies_sound)) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CA3_4_9I2H : Ball := ⟨(52743704500292451550178385388619 / 50000000000000000000000000000000), (438248317761 / 100000000000000000000000000000000)⟩ +lemma CA3_4_9I2_sound : CA3_4_9I2H.Encloses (stageACapacity (shape 3 4 9) 2) := by + have hb := contains_sound (Ball.add_sound CA3_4_9I2PairH_sound + (Ball.neg_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) CA3_4_9I2Group_sound))) + (show contains (.add CA3_4_9I2PairH (.neg (.mul (.exact 2) CA3_4_9I2Group))) CA3_4_9I2H = true by decide +kernel) + unfold CA3_4_9I2PairValue at hb + simpa only [stageACapacity, nativeCapacity, + show (2 : Fin 3) ≠ 0 by decide, ite_false, sub_eq_add_neg] using hb + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA3_4_9I2Pair.lean b/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA3_4_9I2Pair.lean new file mode 100644 index 0000000000000000000000000000000000000000..b0a1d2c2466af6f649e580b88098f77bd3cfeef0 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA3_4_9I2Pair.lean @@ -0,0 +1,355 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Certificates.SupportedContraction + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CA3_4_9I2PairValue (a : PairSlot × PairSlot) : ℝ := pairLaw (below (shape 3 4 9)) (shape 3 4 9) (fun u => (stageALaw (shape 3 4 9) u : ℝ)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) a +def CA3_4_9I2PairRaw (a : PairSlot × PairSlot) : Ball := stageAPairBall (shape 3 4 9) A3_4_9Law 2 a +lemma CA3_4_9I2PairRaw_sound (a : PairSlot × PairSlot) : + (CA3_4_9I2PairRaw a).Encloses (CA3_4_9I2PairValue a) := by + exact stageAPairBall_sound (shape 3 4 9) (by decide +kernel) A3_4_9Law (fun u => (stageALaw (shape 3 4 9) u : ℝ)) (fun u _ => A3_4_9Law_sound u) 2 a +def CA3_4_9I2PairCertificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(2961092486317753981806299 / 5000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(849205210818614472015140153 / 100000000000000000000000000000000), (34489 / 12500000000000000000000000000000)⟩ ⟨(-89621188668383771972172972770083 / 6250000000000000000000000000000), (465869809591 / 100000000000000000000000000000000)⟩ ⟨-21, 2961092486317753981806299, 2384185791015625000000000⟩, + .log ⟨(6656551464303550042561641773 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(64018211573593716441123882267 / 100000000000000000000000000000000), (4228741 / 20000000000000000000000000000000)⟩ ⟨(-961732391267430864380416975200067 / 100000000000000000000000000000000), (317637370267 / 100000000000000000000000000000000)⟩ ⟨-14, 6656551464303550042561641773, 6103515625000000000000000000⟩, + .log ⟨(22598627496184548666664847 / 5000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(1112490594435069514257674827 / 20000000000000000000000000000000), (1818483 / 100000000000000000000000000000000)⟩ ⟨(-1230705929622161188176681285250737 / 100000000000000000000000000000000), (402340871229 / 100000000000000000000000000000000)⟩ ⟨-18, 22598627496184548666664847, 19073486328125000000000000⟩, + .log ⟨(12130784726064703499147662307 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(201954077349061078683380046701 / 100000000000000000000000000000000), (7192623 / 10000000000000000000000000000000)⟩ ⟨(-104050398381861394257513642046173 / 12500000000000000000000000000000), (74115383921 / 25000000000000000000000000000000)⟩ ⟨-13, 12130784726064703499147662307, 6103515625000000000000000000⟩, + .log ⟨(332744438024250081194617291 / 5000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(32001941654271138132774804903 / 50000000000000000000000000000000), (2642303 / 12500000000000000000000000000000)⟩ ⟨(-961757372844166630207520383461919 / 100000000000000000000000000000000), (317637370271 / 100000000000000000000000000000000)⟩ ⟨-14, 332744438024250081194617291, 305175781250000000000000000⟩, + .log ⟨(5832602770901514807695630093 / 2500000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ ⟨(706979424986196093962159585051 / 50000000000000000000000000000000), (494040687 / 100000000000000000000000000000000)⟩ ⟨(-15151456664280130498971520613631 / 2500000000000000000000000000000), (211758237687 / 100000000000000000000000000000000)⟩ ⟨-9, 5832602770901514807695630093, 4882812500000000000000000000⟩, + .log ⟨(2704714654137680623506298549 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(15059329072920006556191396017 / 12500000000000000000000000000000), (40092203 / 100000000000000000000000000000000)⟩ ⟨(-890849113410596542583090231759007 / 100000000000000000000000000000000), (74115384739 / 25000000000000000000000000000000)⟩ ⟨-13, 2704714654137680623506298549, 2441406250000000000000000000⟩, + .log ⟨(516914214513035652680828387 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(629229532120464872534233997 / 10000000000000000000000000000000), (207977 / 10000000000000000000000000000000)⟩ ⟨(-608640190629345547112014405024393 / 50000000000000000000000000000000), (50292605429 / 12500000000000000000000000000000)⟩ ⟨-18, 516914214513035652680828387, 381469726562500000000000000⟩, + .log ⟨(18108492897611398082534338451 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(156032633357017999457201342997 / 100000000000000000000000000000000), (26842363 / 50000000000000000000000000000000)⟩ ⟨(-172330888317712507119699383038613 / 20000000000000000000000000000000), (74115384271 / 25000000000000000000000000000000)⟩ ⟨-13, 18108492897611398082534338451, 12207031250000000000000000000⟩, + .log ⟨(265747585282445043787954383 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(12173194725726930358598869891 / 100000000000000000000000000000000), (4051759 / 100000000000000000000000000000000)⟩ ⟨(-1145183945207711781898289838182193 / 100000000000000000000000000000000), (23822807523 / 6250000000000000000000000000000)⟩ ⟨-17, 265747585282445043787954383, 190734863281250000000000000⟩, + .log ⟨(3045110888811948371053128281 / 6250000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(185795599820085746166412326987 / 50000000000000000000000000000000), (134124091 / 100000000000000000000000000000000)⟩ ⟨(-38133997127723236627305425645079 / 5000000000000000000000000000000), (275285709931 / 100000000000000000000000000000000)⟩ ⟨-12, 3045110888811948371053128281, 1525878906250000000000000000⟩, + .log ⟨(1723898024613202775534486436053 / 100000000000000000000000000000000), (1 / 10000000000000000000000000000000)⟩ ⟨(350001478733249388339954685581 / 5000000000000000000000000000000), (511069459 / 20000000000000000000000000000000)⟩ ⟨(-406058216595242614672851982472227 / 100000000000000000000000000000000), (3705769159 / 2500000000000000000000000000000)⟩ ⟨-6, 1723898024613202775534486436053, 1562500000000000000000000000000⟩, + .log ⟨(42111653366437250263905982703 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(596255007211741265964873643659 / 100000000000000000000000000000000), (53504939 / 25000000000000000000000000000000)⟩ ⟨(-353972688998571317634209305166309 / 50000000000000000000000000000000), (254109885383 / 100000000000000000000000000000000)⟩ ⟨-11, 42111653366437250263905982703, 24414062500000000000000000000⟩, + .log ⟨(186616889667026953071023833 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(2461779644020010752909295153 / 100000000000000000000000000000000), (414943 / 50000000000000000000000000000000)⟩ ⟨(-1319162294695011603447831019243807 / 100000000000000000000000000000000), (1111732083 / 250000000000000000000000000000)⟩ ⟨-20, 186616889667026953071023833, 95367431640625000000000000⟩, + .log ⟨(4966804798289850534881547519 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(103070025786530083318567226649 / 50000000000000000000000000000000), (68364529 / 100000000000000000000000000000000)⟩ ⟨(-83007108169033519277941244451529 / 10000000000000000000000000000000), (55057142381 / 20000000000000000000000000000000)⟩ ⟨-12, 4966804798289850534881547519, 4882812500000000000000000000⟩, + .log ⟨(202259963217779677165430682313 / 100000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ ⟨(25093874428439263734076922377 / 2000000000000000000000000000000), (428302147 / 100000000000000000000000000000000)⟩ ⟨(-310168582417617398602136150612893 / 50000000000000000000000000000000), (105879118909 / 50000000000000000000000000000000)⟩ ⟨-9, 202259963217779677165430682313, 195312500000000000000000000000⟩, + .log ⟨(6414229875101313942905655201 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(57479577404073147467409331287 / 50000000000000000000000000000000), (38031459 / 100000000000000000000000000000000)⟩ ⟨(-896125934419605548512535699422521 / 100000000000000000000000000000000), (74115384839 / 25000000000000000000000000000000)⟩ ⟨-13, 6414229875101313942905655201, 6103515625000000000000000000⟩, + .log ⟨(144087233488744055996762879 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(1738263698883276781242193243 / 25000000000000000000000000000000), (23189 / 1000000000000000000000000000000)⟩ ⟨(-301599186963893668559763563595603 / 25000000000000000000000000000000), (201170411741 / 50000000000000000000000000000000)⟩ ⟨-18, 144087233488744055996762879, 95367431640625000000000000⟩, + .log ⟨(1165787462078482477997580201 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(56832667815011790538750632819 / 100000000000000000000000000000000), (987461 / 5000000000000000000000000000000)⟩ ⟨(-48750453803718927044635012645141 / 5000000000000000000000000000000), (84703299021 / 25000000000000000000000000000000)⟩ ⟨-15, 1165787462078482477997580201, 610351562500000000000000000⟩, + .log ⟨(64952642205814085269546239359 / 4000000000000000000000000000000), (1 / 10000000000000000000000000000000)⟩ ⟨(1338151482393805484571545212431 / 20000000000000000000000000000000), (96279801 / 4000000000000000000000000000000)⟩ ⟨(-206019560859992844935890579679259 / 50000000000000000000000000000000), (37057691599 / 25000000000000000000000000000000)⟩ ⟨-6, 64952642205814085269546239359, 62500000000000000000000000000⟩, + .log ⟨(8186834240423657619173078879353 / 50000000000000000000000000000000), (71 / 100000000000000000000000000000000)⟩ ⟨(29628083068224307230571944646167 / 100000000000000000000000000000000), (1733629609 / 12500000000000000000000000000000)⟩ ⟨(-180949572191967904871536882323841 / 100000000000000000000000000000000), (16940659033 / 20000000000000000000000000000000)⟩ ⟨-3, 8186834240423657619173078879353, 6250000000000000000000000000000⟩, + .log ⟨(98295114952282442351090355077 / 12500000000000000000000000000000), (1 / 20000000000000000000000000000000)⟩ ⟨(3810319379310570046906064289003 / 100000000000000000000000000000000), (266429449 / 20000000000000000000000000000000)⟩ ⟨(-242275479633467613924558989974959 / 50000000000000000000000000000000), (169406590099 / 100000000000000000000000000000000)⟩ ⟨-7, 98295114952282442351090355077, 97656250000000000000000000000⟩, + .log ⟨(8202893718981588628393690421 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(319871863866228712640539547787 / 100000000000000000000000000000000), (5645349 / 5000000000000000000000000000000)⟩ ⟨(-77990005679591242337443753557709 / 10000000000000000000000000000000), (275285710317 / 100000000000000000000000000000000)⟩ ⟨-12, 8202893718981588628393690421, 4882812500000000000000000000⟩, + .log ⟨(376960827632039789975653507 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(470769017354205273462145727 / 10000000000000000000000000000000), (319301 / 20000000000000000000000000000000)⟩ ⟨(-9990831573910567365241383690441 / 800000000000000000000000000000), (21175836947 / 5000000000000000000000000000000)⟩ ⟨-19, 376960827632039789975653507, 190734863281250000000000000⟩, + .log ⟨(81981543861180014520785474659 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(145649052696277556516109060899 / 25000000000000000000000000000000), (41664643 / 20000000000000000000000000000000)⟩ ⟨(-138797486677788712883757361721 / 19531250000000000000000000000), (50821977083 / 20000000000000000000000000000000)⟩ ⟨-11, 81981543861180014520785474659, 48828125000000000000000000000⟩, + .log ⟨(157057781966046966767923994057 / 20000000000000000000000000000000), (1 / 20000000000000000000000000000000)⟩ ⟨(38061962243441140303453659739 / 1000000000000000000000000000000), (1330331189 / 100000000000000000000000000000000)⟩ ⟨(-121171844422422327422103024342349 / 25000000000000000000000000000000), (1694065901 / 1000000000000000000000000000000)⟩ ⟨-7, 157057781966046966767923994057, 156250000000000000000000000000⟩, + .log ⟨(20269876650817521574223443653 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(316641516399189967373230498273 / 100000000000000000000000000000000), (111600157 / 100000000000000000000000000000000)⟩ ⟨(-390532120463618151836386523446363 / 50000000000000000000000000000000), (137642855173 / 50000000000000000000000000000000)⟩ ⟨-12, 20269876650817521574223443653, 12207031250000000000000000000⟩, + .log ⟨(490600411478009858751155999 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(1063499671155329504974857 / 5000000000000000000000000000), (7064443 / 100000000000000000000000000000000)⟩ ⟨(-13548445515355507680159764640421 / 1250000000000000000000000000000), (2812414481 / 781250000000000000000000000000)⟩ ⟨-16, 490600411478009858751155999, 381469726562500000000000000⟩] +lemma CA3_4_9I2PairCertificates_valid : + CA3_4_9I2PairCertificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA3_4_9I2PairCertificateIndex (a : PairSlot × PairSlot) : ℕ := + match a.1.1.val, a.1.2.val, a.2.1.val, a.2.2.val with + | 5, 5, 1, 0 => 1 + | 5, 5, 0, 1 => 1 + | 4, 5, 2, 0 => 2 + | 4, 5, 3, 0 => 3 + | 4, 5, 1, 1 => 4 + | 4, 5, 0, 2 => 2 + | 4, 5, 0, 3 => 3 + | 5, 4, 2, 0 => 2 + | 5, 4, 3, 0 => 3 + | 5, 4, 1, 1 => 4 + | 5, 4, 0, 2 => 2 + | 5, 4, 0, 3 => 3 + | 2, 5, 4, 0 => 5 + | 2, 5, 2, 1 => 6 + | 2, 5, 3, 1 => 7 + | 2, 5, 1, 2 => 6 + | 2, 5, 1, 3 => 7 + | 2, 5, 0, 4 => 5 + | 3, 5, 4, 0 => 8 + | 3, 5, 2, 1 => 9 + | 3, 5, 3, 1 => 10 + | 3, 5, 1, 2 => 9 + | 3, 5, 1, 3 => 10 + | 3, 5, 0, 4 => 8 + | 4, 4, 4, 0 => 11 + | 4, 4, 2, 1 => 12 + | 4, 4, 3, 1 => 13 + | 4, 4, 1, 2 => 12 + | 4, 4, 1, 3 => 13 + | 4, 4, 0, 4 => 11 + | 5, 2, 4, 0 => 5 + | 5, 2, 2, 1 => 6 + | 5, 2, 3, 1 => 7 + | 5, 2, 1, 2 => 6 + | 5, 2, 1, 3 => 7 + | 5, 2, 0, 4 => 5 + | 5, 3, 4, 0 => 8 + | 5, 3, 2, 1 => 9 + | 5, 3, 3, 1 => 10 + | 5, 3, 1, 2 => 9 + | 5, 3, 1, 3 => 10 + | 5, 3, 0, 4 => 8 + | 1, 5, 5, 0 => 14 + | 1, 5, 4, 1 => 15 + | 1, 5, 2, 2 => 16 + | 1, 5, 2, 3 => 17 + | 1, 5, 3, 2 => 17 + | 1, 5, 3, 3 => 18 + | 1, 5, 1, 4 => 15 + | 1, 5, 0, 5 => 14 + | 2, 4, 5, 0 => 19 + | 2, 4, 4, 1 => 20 + | 2, 4, 2, 2 => 21 + | 2, 4, 2, 3 => 22 + | 2, 4, 3, 2 => 22 + | 2, 4, 3, 3 => 23 + | 2, 4, 1, 4 => 20 + | 2, 4, 0, 5 => 19 + | 3, 4, 5, 0 => 24 + | 3, 4, 4, 1 => 25 + | 3, 4, 2, 2 => 26 + | 3, 4, 2, 3 => 27 + | 3, 4, 3, 2 => 27 + | 3, 4, 3, 3 => 28 + | 3, 4, 1, 4 => 25 + | 3, 4, 0, 5 => 24 + | 4, 2, 5, 0 => 19 + | 4, 2, 4, 1 => 20 + | 4, 2, 2, 2 => 21 + | 4, 2, 2, 3 => 22 + | 4, 2, 3, 2 => 22 + | 4, 2, 3, 3 => 23 + | 4, 2, 1, 4 => 20 + | 4, 2, 0, 5 => 19 + | 4, 3, 5, 0 => 24 + | 4, 3, 4, 1 => 25 + | 4, 3, 2, 2 => 26 + | 4, 3, 2, 3 => 27 + | 4, 3, 3, 2 => 27 + | 4, 3, 3, 3 => 28 + | 4, 3, 1, 4 => 25 + | 4, 3, 0, 5 => 24 + | 5, 1, 5, 0 => 14 + | 5, 1, 4, 1 => 15 + | 5, 1, 2, 2 => 16 + | 5, 1, 2, 3 => 17 + | 5, 1, 3, 2 => 17 + | 5, 1, 3, 3 => 18 + | 5, 1, 1, 4 => 15 + | 5, 1, 0, 5 => 14 + | 5, 0, 1, 5 => 14 + | 5, 0, 2, 4 => 19 + | 5, 0, 3, 4 => 24 + | 5, 0, 4, 2 => 19 + | 5, 0, 4, 3 => 24 + | 5, 0, 5, 1 => 14 + | 4, 1, 1, 5 => 15 + | 4, 1, 2, 4 => 20 + | 4, 1, 3, 4 => 25 + | 4, 1, 4, 2 => 20 + | 4, 1, 4, 3 => 25 + | 4, 1, 5, 1 => 15 + | 2, 2, 1, 5 => 16 + | 2, 2, 2, 4 => 21 + | 2, 2, 3, 4 => 26 + | 2, 2, 4, 2 => 21 + | 2, 2, 4, 3 => 26 + | 2, 2, 5, 1 => 16 + | 2, 3, 1, 5 => 17 + | 2, 3, 2, 4 => 22 + | 2, 3, 3, 4 => 27 + | 2, 3, 4, 2 => 22 + | 2, 3, 4, 3 => 27 + | 2, 3, 5, 1 => 17 + | 3, 2, 1, 5 => 17 + | 3, 2, 2, 4 => 22 + | 3, 2, 3, 4 => 27 + | 3, 2, 4, 2 => 22 + | 3, 2, 4, 3 => 27 + | 3, 2, 5, 1 => 17 + | 3, 3, 1, 5 => 18 + | 3, 3, 2, 4 => 23 + | 3, 3, 3, 4 => 28 + | 3, 3, 4, 2 => 23 + | 3, 3, 4, 3 => 28 + | 3, 3, 5, 1 => 18 + | 1, 4, 1, 5 => 15 + | 1, 4, 2, 4 => 20 + | 1, 4, 3, 4 => 25 + | 1, 4, 4, 2 => 20 + | 1, 4, 4, 3 => 25 + | 1, 4, 5, 1 => 15 + | 0, 5, 1, 5 => 14 + | 0, 5, 2, 4 => 19 + | 0, 5, 3, 4 => 24 + | 0, 5, 4, 2 => 19 + | 0, 5, 4, 3 => 24 + | 0, 5, 5, 1 => 14 + | 4, 0, 2, 5 => 5 + | 4, 0, 3, 5 => 8 + | 4, 0, 4, 4 => 11 + | 4, 0, 5, 2 => 5 + | 4, 0, 5, 3 => 8 + | 2, 1, 2, 5 => 6 + | 2, 1, 3, 5 => 9 + | 2, 1, 4, 4 => 12 + | 2, 1, 5, 2 => 6 + | 2, 1, 5, 3 => 9 + | 3, 1, 2, 5 => 7 + | 3, 1, 3, 5 => 10 + | 3, 1, 4, 4 => 13 + | 3, 1, 5, 2 => 7 + | 3, 1, 5, 3 => 10 + | 1, 2, 2, 5 => 6 + | 1, 2, 3, 5 => 9 + | 1, 2, 4, 4 => 12 + | 1, 2, 5, 2 => 6 + | 1, 2, 5, 3 => 9 + | 1, 3, 2, 5 => 7 + | 1, 3, 3, 5 => 10 + | 1, 3, 4, 4 => 13 + | 1, 3, 5, 2 => 7 + | 1, 3, 5, 3 => 10 + | 0, 4, 2, 5 => 5 + | 0, 4, 3, 5 => 8 + | 0, 4, 4, 4 => 11 + | 0, 4, 5, 2 => 5 + | 0, 4, 5, 3 => 8 + | 2, 0, 4, 5 => 2 + | 2, 0, 5, 4 => 2 + | 3, 0, 4, 5 => 3 + | 3, 0, 5, 4 => 3 + | 1, 1, 4, 5 => 4 + | 1, 1, 5, 4 => 4 + | 0, 2, 4, 5 => 2 + | 0, 2, 5, 4 => 2 + | 0, 3, 4, 5 => 3 + | 0, 3, 5, 4 => 3 + | 1, 0, 5, 5 => 1 + | 0, 1, 5, 5 => 1 + | _, _, _, _ => 0 +def CA3_4_9I2PairP (a : PairSlot × PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_4_9I2PairCertificates (CA3_4_9I2PairCertificateIndex a)).input +lemma CA3_4_9I2PairP_check_0_0 : ∀ k l : Fin 6, contains (CA3_4_9I2PairRaw ((0,0),(k,l))) (CA3_4_9I2PairP ((0,0),(k,l))) = true := by + decide +kernel +lemma CA3_4_9I2PairP_check_0_1 : ∀ k l : Fin 6, contains (CA3_4_9I2PairRaw ((0,1),(k,l))) (CA3_4_9I2PairP ((0,1),(k,l))) = true := by + decide +kernel +lemma CA3_4_9I2PairP_check_0_2 : ∀ k l : Fin 6, contains (CA3_4_9I2PairRaw ((0,2),(k,l))) (CA3_4_9I2PairP ((0,2),(k,l))) = true := by + decide +kernel +lemma CA3_4_9I2PairP_check_0_3 : ∀ k l : Fin 6, contains (CA3_4_9I2PairRaw ((0,3),(k,l))) (CA3_4_9I2PairP ((0,3),(k,l))) = true := by + decide +kernel +lemma CA3_4_9I2PairP_check_0_4 : ∀ k l : Fin 6, contains (CA3_4_9I2PairRaw ((0,4),(k,l))) (CA3_4_9I2PairP ((0,4),(k,l))) = true := by + decide +kernel +lemma CA3_4_9I2PairP_check_0_5 : ∀ k l : Fin 6, contains (CA3_4_9I2PairRaw ((0,5),(k,l))) (CA3_4_9I2PairP ((0,5),(k,l))) = true := by + decide +kernel +lemma CA3_4_9I2PairP_check_1_0 : ∀ k l : Fin 6, contains (CA3_4_9I2PairRaw ((1,0),(k,l))) (CA3_4_9I2PairP ((1,0),(k,l))) = true := by + decide +kernel +lemma CA3_4_9I2PairP_check_1_1 : ∀ k l : Fin 6, contains (CA3_4_9I2PairRaw ((1,1),(k,l))) (CA3_4_9I2PairP ((1,1),(k,l))) = true := by + decide +kernel +lemma CA3_4_9I2PairP_check_1_2 : ∀ k l : Fin 6, contains (CA3_4_9I2PairRaw ((1,2),(k,l))) (CA3_4_9I2PairP ((1,2),(k,l))) = true := by + decide +kernel +lemma CA3_4_9I2PairP_check_1_3 : ∀ k l : Fin 6, contains (CA3_4_9I2PairRaw ((1,3),(k,l))) (CA3_4_9I2PairP ((1,3),(k,l))) = true := by + decide +kernel +lemma CA3_4_9I2PairP_check_1_4 : ∀ k l : Fin 6, contains (CA3_4_9I2PairRaw ((1,4),(k,l))) (CA3_4_9I2PairP ((1,4),(k,l))) = true := by + decide +kernel +lemma CA3_4_9I2PairP_check_1_5 : ∀ k l : Fin 6, contains (CA3_4_9I2PairRaw ((1,5),(k,l))) (CA3_4_9I2PairP ((1,5),(k,l))) = true := by + decide +kernel +lemma CA3_4_9I2PairP_check_2_0 : ∀ k l : Fin 6, contains (CA3_4_9I2PairRaw ((2,0),(k,l))) (CA3_4_9I2PairP ((2,0),(k,l))) = true := by + decide +kernel +lemma CA3_4_9I2PairP_check_2_1 : ∀ k l : Fin 6, contains (CA3_4_9I2PairRaw ((2,1),(k,l))) (CA3_4_9I2PairP ((2,1),(k,l))) = true := by + decide +kernel +lemma CA3_4_9I2PairP_check_2_2 : ∀ k l : Fin 6, contains (CA3_4_9I2PairRaw ((2,2),(k,l))) (CA3_4_9I2PairP ((2,2),(k,l))) = true := by + decide +kernel +lemma CA3_4_9I2PairP_check_2_3 : ∀ k l : Fin 6, contains (CA3_4_9I2PairRaw ((2,3),(k,l))) (CA3_4_9I2PairP ((2,3),(k,l))) = true := by + decide +kernel +lemma CA3_4_9I2PairP_check_2_4 : ∀ k l : Fin 6, contains (CA3_4_9I2PairRaw ((2,4),(k,l))) (CA3_4_9I2PairP ((2,4),(k,l))) = true := by + decide +kernel +lemma CA3_4_9I2PairP_check_2_5 : ∀ k l : Fin 6, contains (CA3_4_9I2PairRaw ((2,5),(k,l))) (CA3_4_9I2PairP ((2,5),(k,l))) = true := by + decide +kernel +lemma CA3_4_9I2PairP_check_3_0 : ∀ k l : Fin 6, contains (CA3_4_9I2PairRaw ((3,0),(k,l))) (CA3_4_9I2PairP ((3,0),(k,l))) = true := by + decide +kernel +lemma CA3_4_9I2PairP_check_3_1 : ∀ k l : Fin 6, contains (CA3_4_9I2PairRaw ((3,1),(k,l))) (CA3_4_9I2PairP ((3,1),(k,l))) = true := by + decide +kernel +lemma CA3_4_9I2PairP_check_3_2 : ∀ k l : Fin 6, contains (CA3_4_9I2PairRaw ((3,2),(k,l))) (CA3_4_9I2PairP ((3,2),(k,l))) = true := by + decide +kernel +lemma CA3_4_9I2PairP_check_3_3 : ∀ k l : Fin 6, contains (CA3_4_9I2PairRaw ((3,3),(k,l))) (CA3_4_9I2PairP ((3,3),(k,l))) = true := by + decide +kernel +lemma CA3_4_9I2PairP_check_3_4 : ∀ k l : Fin 6, contains (CA3_4_9I2PairRaw ((3,4),(k,l))) (CA3_4_9I2PairP ((3,4),(k,l))) = true := by + decide +kernel +lemma CA3_4_9I2PairP_check_3_5 : ∀ k l : Fin 6, contains (CA3_4_9I2PairRaw ((3,5),(k,l))) (CA3_4_9I2PairP ((3,5),(k,l))) = true := by + decide +kernel +lemma CA3_4_9I2PairP_check_4_0 : ∀ k l : Fin 6, contains (CA3_4_9I2PairRaw ((4,0),(k,l))) (CA3_4_9I2PairP ((4,0),(k,l))) = true := by + decide +kernel +lemma CA3_4_9I2PairP_check_4_1 : ∀ k l : Fin 6, contains (CA3_4_9I2PairRaw ((4,1),(k,l))) (CA3_4_9I2PairP ((4,1),(k,l))) = true := by + decide +kernel +lemma CA3_4_9I2PairP_check_4_2 : ∀ k l : Fin 6, contains (CA3_4_9I2PairRaw ((4,2),(k,l))) (CA3_4_9I2PairP ((4,2),(k,l))) = true := by + decide +kernel +lemma CA3_4_9I2PairP_check_4_3 : ∀ k l : Fin 6, contains (CA3_4_9I2PairRaw ((4,3),(k,l))) (CA3_4_9I2PairP ((4,3),(k,l))) = true := by + decide +kernel +lemma CA3_4_9I2PairP_check_4_4 : ∀ k l : Fin 6, contains (CA3_4_9I2PairRaw ((4,4),(k,l))) (CA3_4_9I2PairP ((4,4),(k,l))) = true := by + decide +kernel +lemma CA3_4_9I2PairP_check_4_5 : ∀ k l : Fin 6, contains (CA3_4_9I2PairRaw ((4,5),(k,l))) (CA3_4_9I2PairP ((4,5),(k,l))) = true := by + decide +kernel +lemma CA3_4_9I2PairP_check_5_0 : ∀ k l : Fin 6, contains (CA3_4_9I2PairRaw ((5,0),(k,l))) (CA3_4_9I2PairP ((5,0),(k,l))) = true := by + decide +kernel +lemma CA3_4_9I2PairP_check_5_1 : ∀ k l : Fin 6, contains (CA3_4_9I2PairRaw ((5,1),(k,l))) (CA3_4_9I2PairP ((5,1),(k,l))) = true := by + decide +kernel +lemma CA3_4_9I2PairP_check_5_2 : ∀ k l : Fin 6, contains (CA3_4_9I2PairRaw ((5,2),(k,l))) (CA3_4_9I2PairP ((5,2),(k,l))) = true := by + decide +kernel +lemma CA3_4_9I2PairP_check_5_3 : ∀ k l : Fin 6, contains (CA3_4_9I2PairRaw ((5,3),(k,l))) (CA3_4_9I2PairP ((5,3),(k,l))) = true := by + decide +kernel +lemma CA3_4_9I2PairP_check_5_4 : ∀ k l : Fin 6, contains (CA3_4_9I2PairRaw ((5,4),(k,l))) (CA3_4_9I2PairP ((5,4),(k,l))) = true := by + decide +kernel +lemma CA3_4_9I2PairP_check_5_5 : ∀ k l : Fin 6, contains (CA3_4_9I2PairRaw ((5,5),(k,l))) (CA3_4_9I2PairP ((5,5),(k,l))) = true := by + decide +kernel +lemma CA3_4_9I2PairP_check (a : PairSlot × PairSlot) : contains (CA3_4_9I2PairRaw a) (CA3_4_9I2PairP a) = true := by + rcases a with ⟨⟨i,j⟩,⟨k,l⟩⟩ + revert j i + apply forall_fin6 + · exact forall_fin6 (CA3_4_9I2PairP_check_0_0 k l) (CA3_4_9I2PairP_check_0_1 k l) (CA3_4_9I2PairP_check_0_2 k l) (CA3_4_9I2PairP_check_0_3 k l) (CA3_4_9I2PairP_check_0_4 k l) (CA3_4_9I2PairP_check_0_5 k l) + · exact forall_fin6 (CA3_4_9I2PairP_check_1_0 k l) (CA3_4_9I2PairP_check_1_1 k l) (CA3_4_9I2PairP_check_1_2 k l) (CA3_4_9I2PairP_check_1_3 k l) (CA3_4_9I2PairP_check_1_4 k l) (CA3_4_9I2PairP_check_1_5 k l) + · exact forall_fin6 (CA3_4_9I2PairP_check_2_0 k l) (CA3_4_9I2PairP_check_2_1 k l) (CA3_4_9I2PairP_check_2_2 k l) (CA3_4_9I2PairP_check_2_3 k l) (CA3_4_9I2PairP_check_2_4 k l) (CA3_4_9I2PairP_check_2_5 k l) + · exact forall_fin6 (CA3_4_9I2PairP_check_3_0 k l) (CA3_4_9I2PairP_check_3_1 k l) (CA3_4_9I2PairP_check_3_2 k l) (CA3_4_9I2PairP_check_3_3 k l) (CA3_4_9I2PairP_check_3_4 k l) (CA3_4_9I2PairP_check_3_5 k l) + · exact forall_fin6 (CA3_4_9I2PairP_check_4_0 k l) (CA3_4_9I2PairP_check_4_1 k l) (CA3_4_9I2PairP_check_4_2 k l) (CA3_4_9I2PairP_check_4_3 k l) (CA3_4_9I2PairP_check_4_4 k l) (CA3_4_9I2PairP_check_4_5 k l) + · exact forall_fin6 (CA3_4_9I2PairP_check_5_0 k l) (CA3_4_9I2PairP_check_5_1 k l) (CA3_4_9I2PairP_check_5_2 k l) (CA3_4_9I2PairP_check_5_3 k l) (CA3_4_9I2PairP_check_5_4 k l) (CA3_4_9I2PairP_check_5_5 k l) +lemma CA3_4_9I2PairP_sound (a : PairSlot × PairSlot) : + (CA3_4_9I2PairP a).Encloses (CA3_4_9I2PairValue a) := + contains_sound (CA3_4_9I2PairRaw_sound a) (CA3_4_9I2PairP_check a) +def CA3_4_9I2PairTerms (a : PairSlot × PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_4_9I2PairCertificates (CA3_4_9I2PairCertificateIndex a)).output +lemma CA3_4_9I2PairTerms_sound (a : PairSlot × PairSlot) : + (CA3_4_9I2PairTerms a).Encloses (Foundation.entropyTerm (CA3_4_9I2PairValue a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA3_4_9I2PairCertificates_valid + (CA3_4_9I2PairCertificateIndex a) (CA3_4_9I2PairP_sound a) +def CA3_4_9I2PairEntropy : Ball := ⟨(70463611022735415351723642098673 / 25000000000000000000000000000000), (28377027811 / 25000000000000000000000000000000)⟩ +lemma CA3_4_9I2PairEntropy_sound : CA3_4_9I2PairEntropy.Encloses (Foundation.finiteEntropy CA3_4_9I2PairValue) := by + exact contains_sound (entropyDoublePair_enclosed CA3_4_9I2PairValue CA3_4_9I2PairTerms CA3_4_9I2PairTerms_sound) (by decide +kernel) +def CA3_4_9I2PairMass : Ball := ⟨(12500000000000000000000000000001 / 12500000000000000000000000000000), (157 / 25000000000000000000000000000000)⟩ +lemma CA3_4_9I2PairMass_sound : CA3_4_9I2PairMass.Encloses (∑ a, CA3_4_9I2PairValue a) := by + exact contains_sound (doublePairSumBall_sound CA3_4_9I2PairP CA3_4_9I2PairValue CA3_4_9I2PairP_sound) (by decide +kernel) +def CA3_4_9I2PairMassTermLogWitness : LogWitness := ⟨0, 12500000000000000000000000000001, 12500000000000000000000000000000⟩ +def CA3_4_9I2PairMassTermLog : Ball := ⟨(1 / 12500000000000000000000000000000), (2117582431 / 10000000000000000000000000000000)⟩ +lemma CA3_4_9I2PairMassTermLog_sound : CA3_4_9I2PairMassTermLog.Encloses (Real.log ((∑ a, CA3_4_9I2PairValue a))) := by + exact checkLog_sound logTwoBall_sound (CA3_4_9I2PairMass_sound) (w := CA3_4_9I2PairMassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA3_4_9I2PairMassTerm : Ball := ⟨(-1 / 12500000000000000000000000000000), (21175824311 / 100000000000000000000000000000000)⟩ +lemma CA3_4_9I2PairMassTerm_sound : CA3_4_9I2PairMassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA3_4_9I2PairValue a))) := by + exact contains_sound (entropyTerm_ball (CA3_4_9I2PairMass_sound) CA3_4_9I2PairMassTermLog_sound) (by decide +kernel) +def CA3_4_9I2PairH : Ball := ⟨(2818544440909416614068945683947 / 1000000000000000000000000000000), (26936787111 / 20000000000000000000000000000000)⟩ +lemma CA3_4_9I2PairH_sound : CA3_4_9I2PairH.Encloses (homogeneousEntropy CA3_4_9I2PairValue) := by + exact contains_sound (homogeneous_enclosed CA3_4_9I2PairValue CA3_4_9I2PairMassTerm_sound CA3_4_9I2PairEntropy_sound) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA3_5_8I0.lean b/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA3_5_8I0.lean new file mode 100644 index 0000000000000000000000000000000000000000..72a73dc5c5412c7d980599765f0ad8fb4cece3e5 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA3_5_8I0.lean @@ -0,0 +1,75 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Certificates.SplitA3_5_8 + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CA3_5_8I0Value (a : Fin 17) : ℝ := marginal (below (shape 3 5 8)) (fun u => (stageALaw (shape 3 5 8) u : ℝ)) ((Equiv.refl (Fin 3)) 0) a +def CA3_5_8I0Raw (a : Fin 17) : Ball := marginalBall (below (shape 3 5 8)) A3_5_8Law ((Equiv.refl (Fin 3)) 0) a +lemma CA3_5_8I0Raw_sound (a : Fin 17) : + (CA3_5_8I0Raw a).Encloses (CA3_5_8I0Value a) := by + exact marginalBall_sound (below (shape 3 5 8)) A3_5_8Law (fun u => (stageALaw (shape 3 5 8) u : ℝ)) (fun u _ => A3_5_8Law_sound u) ((Equiv.refl (Fin 3)) 0) a +def CA3_5_8I0Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(10061494552782511104772956913071 / 100000000000000000000000000000000), (1 / 2500000000000000000000000000000)⟩ ⟨(23105764125084499096696734641399 / 100000000000000000000000000000000), (1331627733 / 12500000000000000000000000000000)⟩ ⟨(-114822723422806947883364156360731 / 50000000000000000000000000000000), (26469779703 / 25000000000000000000000000000000)⟩ ⟨-4, 10061494552782511104772956913071, 6250000000000000000000000000000⟩, + .log ⟨(39938505447217488895227043086929 / 100000000000000000000000000000000), (1 / 1562500000000000000000000000000)⟩ ⟨(36656729644980840025676973240083 / 100000000000000000000000000000000), (25371922609 / 100000000000000000000000000000000)⟩ ⟨(-91782927865005299505533946601311 / 100000000000000000000000000000000), (63527471209 / 100000000000000000000000000000000)⟩ ⟨-2, 39938505447217488895227043086929, 25000000000000000000000000000000⟩] +lemma CA3_5_8I0Certificates_valid : + CA3_5_8I0Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA3_5_8I0CertificateIndex (a : Fin 17) : ℕ := + match a.val with + | 0 => 1 + | 1 => 2 + | 2 => 2 + | 3 => 1 + | _ => 0 +def CA3_5_8I0P (a : Fin 17) : Ball := + (CompactCertificate.entropyLookup CA3_5_8I0Certificates (CA3_5_8I0CertificateIndex a)).input +lemma CA3_5_8I0P_check : ∀ a : Fin 17, contains (CA3_5_8I0Raw a) (CA3_5_8I0P a) = true := by + decide +kernel +lemma CA3_5_8I0P_sound (a : Fin 17) : + (CA3_5_8I0P a).Encloses (CA3_5_8I0Value a) := + contains_sound (CA3_5_8I0Raw_sound a) (CA3_5_8I0P_check a) +def CA3_5_8I0Terms (a : Fin 17) : Ball := + (CompactCertificate.entropyLookup CA3_5_8I0Certificates (CA3_5_8I0CertificateIndex a)).output +lemma CA3_5_8I0Terms_sound (a : Fin 17) : + (CA3_5_8I0Terms a).Encloses (Foundation.entropyTerm (CA3_5_8I0Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA3_5_8I0Certificates_valid + (CA3_5_8I0CertificateIndex a) (CA3_5_8I0P_sound a) +def CA3_5_8I0Entropy : Ball := ⟨(29881246885032669561186853940741 / 25000000000000000000000000000000), (36024944473 / 50000000000000000000000000000000)⟩ +lemma CA3_5_8I0Entropy_sound : CA3_5_8I0Entropy.Encloses (Foundation.finiteEntropy CA3_5_8I0Value) := by + exact contains_sound (entropyFin_enclosed 17 CA3_5_8I0Value CA3_5_8I0Terms CA3_5_8I0Terms_sound) (by decide +kernel) +def CA3_5_8I0Mass : Ball := ⟨1, (13 / 6250000000000000000000000000000)⟩ +lemma CA3_5_8I0Mass_sound : CA3_5_8I0Mass.Encloses (∑ a, CA3_5_8I0Value a) := by + exact contains_sound (finSumBall_sound 17 CA3_5_8I0P CA3_5_8I0Value CA3_5_8I0P_sound) (by decide +kernel) +def CA3_5_8I0MassTermLogWitness : LogWitness := ⟨0, 1, 1⟩ +def CA3_5_8I0MassTermLog : Ball := ⟨0, (2117582389 / 10000000000000000000000000000000)⟩ +lemma CA3_5_8I0MassTermLog_sound : CA3_5_8I0MassTermLog.Encloses (Real.log ((∑ a, CA3_5_8I0Value a))) := by + exact checkLog_sound logTwoBall_sound (CA3_5_8I0Mass_sound) (w := CA3_5_8I0MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA3_5_8I0MassTerm : Ball := ⟨0, (21175823891 / 100000000000000000000000000000000)⟩ +lemma CA3_5_8I0MassTerm_sound : CA3_5_8I0MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA3_5_8I0Value a))) := by + exact contains_sound (entropyTerm_ball (CA3_5_8I0Mass_sound) CA3_5_8I0MassTermLog_sound) (by decide +kernel) +def CA3_5_8I0H : Ball := ⟨(29881246885032669561186853940741 / 25000000000000000000000000000000), (93225712837 / 100000000000000000000000000000000)⟩ +lemma CA3_5_8I0H_sound : CA3_5_8I0H.Encloses (homogeneousEntropy CA3_5_8I0Value) := by + exact contains_sound (homogeneous_enclosed CA3_5_8I0Value CA3_5_8I0MassTerm_sound CA3_5_8I0Entropy_sound) (by decide +kernel) +lemma CA3_5_8I0_sound : CA3_5_8I0H.Encloses (stageACapacity (shape 3 5 8) 0) := by + exact CA3_5_8I0H_sound + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA3_5_8I1.lean b/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA3_5_8I1.lean new file mode 100644 index 0000000000000000000000000000000000000000..d25a6bca65eb55e3119f6106f49ac85cd32d5de0 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA3_5_8I1.lean @@ -0,0 +1,1107 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Certificates.SupportedContraction + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CA3_5_8I1PairValue (a : PairSlot × PairSlot) : ℝ := pairLaw (below (shape 3 5 8)) (shape 3 5 8) (fun u => (stageALaw (shape 3 5 8) u : ℝ)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) a +def CA3_5_8I1PairRaw (a : PairSlot × PairSlot) : Ball := stageAPairBall (shape 3 5 8) A3_5_8Law 1 a +lemma CA3_5_8I1PairRaw_sound (a : PairSlot × PairSlot) : + (CA3_5_8I1PairRaw a).Encloses (CA3_5_8I1PairValue a) := by + exact stageAPairBall_sound (shape 3 5 8) (by decide +kernel) A3_5_8Law (fun u => (stageALaw (shape 3 5 8) u : ℝ)) (fun u _ => A3_5_8Law_sound u) 1 a +def CA3_5_8I1PairCertificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(5272348913593376577096549739 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(10387001330832544175301137399 / 20000000000000000000000000000000), (714537 / 4000000000000000000000000000000)⟩ ⟨(-492522474378183237630433139810131 / 50000000000000000000000000000000), (169406598947 / 50000000000000000000000000000000)⟩ ⟨-15, 5272348913593376577096549739, 3051757812500000000000000000⟩, + .log ⟨(122811663494084257624940399343 / 100000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ ⟨(823117354555577221946133592311 / 100000000000000000000000000000000), (143035109 / 50000000000000000000000000000000)⟩ ⟨(-167556836854348558096548849152917 / 25000000000000000000000000000000), (46586812591 / 20000000000000000000000000000000)⟩ ⟨-10, 122811663494084257624940399343, 97656250000000000000000000000⟩, + .log ⟨(10175855283941391205947279651 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(93545698188119245893217737667 / 100000000000000000000000000000000), (4040291 / 12500000000000000000000000000000)⟩ ⟨(-229822691994609421192137827073081 / 25000000000000000000000000000000), (19852335317 / 6250000000000000000000000000000)⟩ ⟨-14, 10175855283941391205947279651, 6103515625000000000000000000⟩, + .log ⟨(224235380405963066391746089353 / 50000000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ ⟨(2424918168841216184583813792717 / 100000000000000000000000000000000), (34188257 / 4000000000000000000000000000000)⟩ ⟨(-540708197888099777971623643212661 / 100000000000000000000000000000000), (95291207019 / 50000000000000000000000000000000)⟩ ⟨-8, 224235380405963066391746089353, 195312500000000000000000000000⟩, + .log ⟨(1272000276383149435550995439 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(25150092297347779972067219457 / 50000000000000000000000000000000), (1723883 / 10000000000000000000000000000000)⟩ ⟨(-494302021082504041007144259164429 / 50000000000000000000000000000000), (169406599291 / 50000000000000000000000000000000)⟩ ⟨-15, 1272000276383149435550995439, 762939453125000000000000000⟩, + .log ⟨(1445038215769510822869447212491 / 50000000000000000000000000000000), (17 / 100000000000000000000000000000000)⟩ ⟨(10242104980593555395446867496803 / 100000000000000000000000000000000), (535497813 / 12500000000000000000000000000000)⟩ ⟨(-354388723731414820305031975405399 / 100000000000000000000000000000000), (148230766369 / 100000000000000000000000000000000)⟩ ⟨-6, 1445038215769510822869447212491, 781250000000000000000000000000⟩, + .log ⟨(56502172949873789302552257373 / 25000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ ⟨(688462253558737918048067279589 / 50000000000000000000000000000000), (119648009 / 25000000000000000000000000000000)⟩ ⟨(-609235200714768048615292950822617 / 100000000000000000000000000000000), (105879118857 / 50000000000000000000000000000000)⟩ ⟨-9, 56502172949873789302552257373, 48828125000000000000000000000⟩, + .log ⟨(8530870747574296140629522643 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(2960583019633474529337396359 / 2000000000000000000000000000000), (50581511 / 100000000000000000000000000000000)⟩ ⟨(-867608684750996615247901536153503 / 100000000000000000000000000000000), (148230768711 / 50000000000000000000000000000000)⟩ ⟨-13, 8530870747574296140629522643, 6103515625000000000000000000⟩, + .log ⟨(1543038718015251589792097624553 / 50000000000000000000000000000000), (9 / 50000000000000000000000000000000)⟩ ⟨(5367104262804562149060419304719 / 50000000000000000000000000000000), (4574516297 / 100000000000000000000000000000000)⟩ ⟨(-347826933967545006988298984818507 / 100000000000000000000000000000000), (37057691591 / 25000000000000000000000000000000)⟩ ⟨-6, 1543038718015251589792097624553, 781250000000000000000000000000⟩, + .log ⟨(275427148849361576023785274099 / 100000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ ⟨(6341927758382761730931641897 / 390625000000000000000000000000), (583239689 / 100000000000000000000000000000000)⟩ ⟨(-589460230383440015978482495632837 / 100000000000000000000000000000000), (52939559389 / 25000000000000000000000000000000)⟩ ⟨-9, 275427148849361576023785274099, 195312500000000000000000000000⟩, + .log ⟨(102611484321130106786776176661 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(706169731946585730314410121159 / 100000000000000000000000000000000), (119508553 / 50000000000000000000000000000000)⟩ ⟨(-344098780277155025456198261537853 / 50000000000000000000000000000000), (232934061487 / 100000000000000000000000000000000)⟩ ⟨-10, 102611484321130106786776176661, 97656250000000000000000000000⟩, + .log ⟨(14795629024906978949381729251 / 5000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ ⟨(21538224249032315716749423781 / 1250000000000000000000000000000), (626619277 / 100000000000000000000000000000000)⟩ ⟨(-291143069521070637789728104358841 / 50000000000000000000000000000000), (105879118753 / 50000000000000000000000000000000)⟩ ⟨-9, 14795629024906978949381729251, 9765625000000000000000000000⟩, + .log ⟨(26166849529392501901217802001 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(215835482673605884932772277959 / 100000000000000000000000000000000), (72033607 / 100000000000000000000000000000000)⟩ ⟨(-824843214048996718391164719348457 / 100000000000000000000000000000000), (2752857117 / 1000000000000000000000000000000)⟩ ⟨-12, 26166849529392501901217802001, 24414062500000000000000000000⟩, + .log ⟨(1164646818453221352648590511 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(8647331230472012025573359963 / 10000000000000000000000000000000), (14797419 / 50000000000000000000000000000000)⟩ ⟨(-464053302118051969220549102328361 / 50000000000000000000000000000000), (317637365977 / 100000000000000000000000000000000)⟩ ⟨-14, 1164646818453221352648590511, 762939453125000000000000000⟩, + .log ⟨(11587301268410179668221269739649 / 100000000000000000000000000000000), (1 / 2500000000000000000000000000000)⟩ ⟨(624341290834834164391889313543 / 2500000000000000000000000000000), (6134266279 / 50000000000000000000000000000000)⟩ ⟨(-21552604057579529378221855868007 / 10000000000000000000000000000000), (2646977969 / 2500000000000000000000000000000)⟩ ⟨-4, 11587301268410179668221269739649, 6250000000000000000000000000000⟩, + .log ⟨(1033841032965526914852789528817 / 100000000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ ⟨(2363303306716034923255029059551 / 50000000000000000000000000000000), (875697429 / 50000000000000000000000000000000)⟩ ⟨(-228594458079982059043573057869503 / 50000000000000000000000000000000), (3388131797 / 2000000000000000000000000000000)⟩ ⟨-7, 1033841032965526914852789528817, 781250000000000000000000000000⟩, + .log ⟨(383299402912290949816397030673 / 100000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ ⟨(2132719676734387834400259703423 / 100000000000000000000000000000000), (405834039 / 50000000000000000000000000000000)⟩ ⟨(-556410905034049988938702852231753 / 100000000000000000000000000000000), (52939559403 / 25000000000000000000000000000000)⟩ ⟨-9, 383299402912290949816397030673, 195312500000000000000000000000⟩] +lemma CA3_5_8I1PairCertificates_valid : + CA3_5_8I1PairCertificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA3_5_8I1PairCertificateIndex (a : PairSlot × PairSlot) : ℕ := + match a.1.1.val, a.1.2.val, a.2.1.val, a.2.2.val with + | 0, 0, 1, 5 => 1 + | 0, 0, 2, 4 => 2 + | 0, 0, 3, 4 => 3 + | 0, 0, 4, 2 => 2 + | 0, 0, 4, 3 => 3 + | 0, 0, 5, 1 => 1 + | 1, 0, 4, 1 => 4 + | 1, 0, 5, 0 => 5 + | 1, 0, 2, 2 => 6 + | 1, 0, 2, 3 => 7 + | 1, 0, 3, 2 => 7 + | 1, 0, 3, 3 => 8 + | 1, 0, 1, 4 => 4 + | 1, 0, 0, 5 => 5 + | 0, 1, 4, 1 => 4 + | 0, 1, 5, 0 => 5 + | 0, 1, 2, 2 => 6 + | 0, 1, 2, 3 => 7 + | 0, 1, 3, 2 => 7 + | 0, 1, 3, 3 => 8 + | 0, 1, 1, 4 => 4 + | 0, 1, 0, 5 => 5 + | 2, 0, 2, 1 => 9 + | 2, 0, 3, 1 => 10 + | 2, 0, 4, 0 => 11 + | 2, 0, 1, 2 => 9 + | 2, 0, 1, 3 => 10 + | 2, 0, 0, 4 => 11 + | 3, 0, 2, 1 => 12 + | 3, 0, 3, 1 => 13 + | 3, 0, 4, 0 => 14 + | 3, 0, 1, 2 => 12 + | 3, 0, 1, 3 => 13 + | 3, 0, 0, 4 => 14 + | 1, 1, 2, 1 => 15 + | 1, 1, 3, 1 => 16 + | 1, 1, 4, 0 => 17 + | 1, 1, 1, 2 => 15 + | 1, 1, 1, 3 => 16 + | 1, 1, 0, 4 => 17 + | 0, 2, 2, 1 => 9 + | 0, 2, 3, 1 => 10 + | 0, 2, 4, 0 => 11 + | 0, 2, 1, 2 => 9 + | 0, 2, 1, 3 => 10 + | 0, 2, 0, 4 => 11 + | 0, 3, 2, 1 => 12 + | 0, 3, 3, 1 => 13 + | 0, 3, 4, 0 => 14 + | 0, 3, 1, 2 => 12 + | 0, 3, 1, 3 => 13 + | 0, 3, 0, 4 => 14 + | 4, 0, 1, 1 => 17 + | 4, 0, 2, 0 => 11 + | 4, 0, 3, 0 => 14 + | 4, 0, 0, 2 => 11 + | 4, 0, 0, 3 => 14 + | 2, 1, 1, 1 => 15 + | 2, 1, 2, 0 => 9 + | 2, 1, 3, 0 => 12 + | 2, 1, 0, 2 => 9 + | 2, 1, 0, 3 => 12 + | 3, 1, 1, 1 => 16 + | 3, 1, 2, 0 => 10 + | 3, 1, 3, 0 => 13 + | 3, 1, 0, 2 => 10 + | 3, 1, 0, 3 => 13 + | 1, 2, 1, 1 => 15 + | 1, 2, 2, 0 => 9 + | 1, 2, 3, 0 => 12 + | 1, 2, 0, 2 => 9 + | 1, 2, 0, 3 => 12 + | 1, 3, 1, 1 => 16 + | 1, 3, 2, 0 => 10 + | 1, 3, 3, 0 => 13 + | 1, 3, 0, 2 => 10 + | 1, 3, 0, 3 => 13 + | 0, 4, 1, 1 => 17 + | 0, 4, 2, 0 => 11 + | 0, 4, 3, 0 => 14 + | 0, 4, 0, 2 => 11 + | 0, 4, 0, 3 => 14 + | 0, 5, 0, 1 => 5 + | 0, 5, 1, 0 => 5 + | 1, 4, 0, 1 => 4 + | 1, 4, 1, 0 => 4 + | 2, 2, 0, 1 => 6 + | 2, 2, 1, 0 => 6 + | 2, 3, 0, 1 => 7 + | 2, 3, 1, 0 => 7 + | 3, 2, 0, 1 => 7 + | 3, 2, 1, 0 => 7 + | 3, 3, 0, 1 => 8 + | 3, 3, 1, 0 => 8 + | 4, 1, 0, 1 => 4 + | 4, 1, 1, 0 => 4 + | 5, 0, 0, 1 => 5 + | 5, 0, 1, 0 => 5 + | 1, 5, 0, 0 => 1 + | 2, 4, 0, 0 => 2 + | 3, 4, 0, 0 => 3 + | 4, 2, 0, 0 => 2 + | 4, 3, 0, 0 => 3 + | 5, 1, 0, 0 => 1 + | _, _, _, _ => 0 +def CA3_5_8I1PairP (a : PairSlot × PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_5_8I1PairCertificates (CA3_5_8I1PairCertificateIndex a)).input +lemma CA3_5_8I1PairP_check_0_0 : ∀ k l : Fin 6, contains (CA3_5_8I1PairRaw ((0,0),(k,l))) (CA3_5_8I1PairP ((0,0),(k,l))) = true := by + decide +kernel +lemma CA3_5_8I1PairP_check_0_1 : ∀ k l : Fin 6, contains (CA3_5_8I1PairRaw ((0,1),(k,l))) (CA3_5_8I1PairP ((0,1),(k,l))) = true := by + decide +kernel +lemma CA3_5_8I1PairP_check_0_2 : ∀ k l : Fin 6, contains (CA3_5_8I1PairRaw ((0,2),(k,l))) (CA3_5_8I1PairP ((0,2),(k,l))) = true := by + decide +kernel +lemma CA3_5_8I1PairP_check_0_3 : ∀ k l : Fin 6, contains (CA3_5_8I1PairRaw ((0,3),(k,l))) (CA3_5_8I1PairP ((0,3),(k,l))) = true := by + decide +kernel +lemma CA3_5_8I1PairP_check_0_4 : ∀ k l : Fin 6, contains (CA3_5_8I1PairRaw ((0,4),(k,l))) (CA3_5_8I1PairP ((0,4),(k,l))) = true := by + decide +kernel +lemma CA3_5_8I1PairP_check_0_5 : ∀ k l : Fin 6, contains (CA3_5_8I1PairRaw ((0,5),(k,l))) (CA3_5_8I1PairP ((0,5),(k,l))) = true := by + decide +kernel +lemma CA3_5_8I1PairP_check_1_0 : ∀ k l : Fin 6, contains (CA3_5_8I1PairRaw ((1,0),(k,l))) (CA3_5_8I1PairP ((1,0),(k,l))) = true := by + decide +kernel +lemma CA3_5_8I1PairP_check_1_1 : ∀ k l : Fin 6, contains (CA3_5_8I1PairRaw ((1,1),(k,l))) (CA3_5_8I1PairP ((1,1),(k,l))) = true := by + decide +kernel +lemma CA3_5_8I1PairP_check_1_2 : ∀ k l : Fin 6, contains (CA3_5_8I1PairRaw ((1,2),(k,l))) (CA3_5_8I1PairP ((1,2),(k,l))) = true := by + decide +kernel +lemma CA3_5_8I1PairP_check_1_3 : ∀ k l : Fin 6, contains (CA3_5_8I1PairRaw ((1,3),(k,l))) (CA3_5_8I1PairP ((1,3),(k,l))) = true := by + decide +kernel +lemma CA3_5_8I1PairP_check_1_4 : ∀ k l : Fin 6, contains (CA3_5_8I1PairRaw ((1,4),(k,l))) (CA3_5_8I1PairP ((1,4),(k,l))) = true := by + decide +kernel +lemma CA3_5_8I1PairP_check_1_5 : ∀ k l : Fin 6, contains (CA3_5_8I1PairRaw ((1,5),(k,l))) (CA3_5_8I1PairP ((1,5),(k,l))) = true := by + decide +kernel +lemma CA3_5_8I1PairP_check_2_0 : ∀ k l : Fin 6, contains (CA3_5_8I1PairRaw ((2,0),(k,l))) (CA3_5_8I1PairP ((2,0),(k,l))) = true := by + decide +kernel +lemma CA3_5_8I1PairP_check_2_1 : ∀ k l : Fin 6, contains (CA3_5_8I1PairRaw ((2,1),(k,l))) (CA3_5_8I1PairP ((2,1),(k,l))) = true := by + decide +kernel +lemma CA3_5_8I1PairP_check_2_2 : ∀ k l : Fin 6, contains (CA3_5_8I1PairRaw ((2,2),(k,l))) (CA3_5_8I1PairP ((2,2),(k,l))) = true := by + decide +kernel +lemma CA3_5_8I1PairP_check_2_3 : ∀ k l : Fin 6, contains (CA3_5_8I1PairRaw ((2,3),(k,l))) (CA3_5_8I1PairP ((2,3),(k,l))) = true := by + decide +kernel +lemma CA3_5_8I1PairP_check_2_4 : ∀ k l : Fin 6, contains (CA3_5_8I1PairRaw ((2,4),(k,l))) (CA3_5_8I1PairP ((2,4),(k,l))) = true := by + decide +kernel +lemma CA3_5_8I1PairP_check_2_5 : ∀ k l : Fin 6, contains (CA3_5_8I1PairRaw ((2,5),(k,l))) (CA3_5_8I1PairP ((2,5),(k,l))) = true := by + decide +kernel +lemma CA3_5_8I1PairP_check_3_0 : ∀ k l : Fin 6, contains (CA3_5_8I1PairRaw ((3,0),(k,l))) (CA3_5_8I1PairP ((3,0),(k,l))) = true := by + decide +kernel +lemma CA3_5_8I1PairP_check_3_1 : ∀ k l : Fin 6, contains (CA3_5_8I1PairRaw ((3,1),(k,l))) (CA3_5_8I1PairP ((3,1),(k,l))) = true := by + decide +kernel +lemma CA3_5_8I1PairP_check_3_2 : ∀ k l : Fin 6, contains (CA3_5_8I1PairRaw ((3,2),(k,l))) (CA3_5_8I1PairP ((3,2),(k,l))) = true := by + decide +kernel +lemma CA3_5_8I1PairP_check_3_3 : ∀ k l : Fin 6, contains (CA3_5_8I1PairRaw ((3,3),(k,l))) (CA3_5_8I1PairP ((3,3),(k,l))) = true := by + decide +kernel +lemma CA3_5_8I1PairP_check_3_4 : ∀ k l : Fin 6, contains (CA3_5_8I1PairRaw ((3,4),(k,l))) (CA3_5_8I1PairP ((3,4),(k,l))) = true := by + decide +kernel +lemma CA3_5_8I1PairP_check_3_5 : ∀ k l : Fin 6, contains (CA3_5_8I1PairRaw ((3,5),(k,l))) (CA3_5_8I1PairP ((3,5),(k,l))) = true := by + decide +kernel +lemma CA3_5_8I1PairP_check_4_0 : ∀ k l : Fin 6, contains (CA3_5_8I1PairRaw ((4,0),(k,l))) (CA3_5_8I1PairP ((4,0),(k,l))) = true := by + decide +kernel +lemma CA3_5_8I1PairP_check_4_1 : ∀ k l : Fin 6, contains (CA3_5_8I1PairRaw ((4,1),(k,l))) (CA3_5_8I1PairP ((4,1),(k,l))) = true := by + decide +kernel +lemma CA3_5_8I1PairP_check_4_2 : ∀ k l : Fin 6, contains (CA3_5_8I1PairRaw ((4,2),(k,l))) (CA3_5_8I1PairP ((4,2),(k,l))) = true := by + decide +kernel +lemma CA3_5_8I1PairP_check_4_3 : ∀ k l : Fin 6, contains (CA3_5_8I1PairRaw ((4,3),(k,l))) (CA3_5_8I1PairP ((4,3),(k,l))) = true := by + decide +kernel +lemma CA3_5_8I1PairP_check_4_4 : ∀ k l : Fin 6, contains (CA3_5_8I1PairRaw ((4,4),(k,l))) (CA3_5_8I1PairP ((4,4),(k,l))) = true := by + decide +kernel +lemma CA3_5_8I1PairP_check_4_5 : ∀ k l : Fin 6, contains (CA3_5_8I1PairRaw ((4,5),(k,l))) (CA3_5_8I1PairP ((4,5),(k,l))) = true := by + decide +kernel +lemma CA3_5_8I1PairP_check_5_0 : ∀ k l : Fin 6, contains (CA3_5_8I1PairRaw ((5,0),(k,l))) (CA3_5_8I1PairP ((5,0),(k,l))) = true := by + decide +kernel +lemma CA3_5_8I1PairP_check_5_1 : ∀ k l : Fin 6, contains (CA3_5_8I1PairRaw ((5,1),(k,l))) (CA3_5_8I1PairP ((5,1),(k,l))) = true := by + decide +kernel +lemma CA3_5_8I1PairP_check_5_2 : ∀ k l : Fin 6, contains (CA3_5_8I1PairRaw ((5,2),(k,l))) (CA3_5_8I1PairP ((5,2),(k,l))) = true := by + decide +kernel +lemma CA3_5_8I1PairP_check_5_3 : ∀ k l : Fin 6, contains (CA3_5_8I1PairRaw ((5,3),(k,l))) (CA3_5_8I1PairP ((5,3),(k,l))) = true := by + decide +kernel +lemma CA3_5_8I1PairP_check_5_4 : ∀ k l : Fin 6, contains (CA3_5_8I1PairRaw ((5,4),(k,l))) (CA3_5_8I1PairP ((5,4),(k,l))) = true := by + decide +kernel +lemma CA3_5_8I1PairP_check_5_5 : ∀ k l : Fin 6, contains (CA3_5_8I1PairRaw ((5,5),(k,l))) (CA3_5_8I1PairP ((5,5),(k,l))) = true := by + decide +kernel +lemma CA3_5_8I1PairP_check (a : PairSlot × PairSlot) : contains (CA3_5_8I1PairRaw a) (CA3_5_8I1PairP a) = true := by + rcases a with ⟨⟨i,j⟩,⟨k,l⟩⟩ + revert j i + apply forall_fin6 + · exact forall_fin6 (CA3_5_8I1PairP_check_0_0 k l) (CA3_5_8I1PairP_check_0_1 k l) (CA3_5_8I1PairP_check_0_2 k l) (CA3_5_8I1PairP_check_0_3 k l) (CA3_5_8I1PairP_check_0_4 k l) (CA3_5_8I1PairP_check_0_5 k l) + · exact forall_fin6 (CA3_5_8I1PairP_check_1_0 k l) (CA3_5_8I1PairP_check_1_1 k l) (CA3_5_8I1PairP_check_1_2 k l) (CA3_5_8I1PairP_check_1_3 k l) (CA3_5_8I1PairP_check_1_4 k l) (CA3_5_8I1PairP_check_1_5 k l) + · exact forall_fin6 (CA3_5_8I1PairP_check_2_0 k l) (CA3_5_8I1PairP_check_2_1 k l) (CA3_5_8I1PairP_check_2_2 k l) (CA3_5_8I1PairP_check_2_3 k l) (CA3_5_8I1PairP_check_2_4 k l) (CA3_5_8I1PairP_check_2_5 k l) + · exact forall_fin6 (CA3_5_8I1PairP_check_3_0 k l) (CA3_5_8I1PairP_check_3_1 k l) (CA3_5_8I1PairP_check_3_2 k l) (CA3_5_8I1PairP_check_3_3 k l) (CA3_5_8I1PairP_check_3_4 k l) (CA3_5_8I1PairP_check_3_5 k l) + · exact forall_fin6 (CA3_5_8I1PairP_check_4_0 k l) (CA3_5_8I1PairP_check_4_1 k l) (CA3_5_8I1PairP_check_4_2 k l) (CA3_5_8I1PairP_check_4_3 k l) (CA3_5_8I1PairP_check_4_4 k l) (CA3_5_8I1PairP_check_4_5 k l) + · exact forall_fin6 (CA3_5_8I1PairP_check_5_0 k l) (CA3_5_8I1PairP_check_5_1 k l) (CA3_5_8I1PairP_check_5_2 k l) (CA3_5_8I1PairP_check_5_3 k l) (CA3_5_8I1PairP_check_5_4 k l) (CA3_5_8I1PairP_check_5_5 k l) +lemma CA3_5_8I1PairP_sound (a : PairSlot × PairSlot) : + (CA3_5_8I1PairP a).Encloses (CA3_5_8I1PairValue a) := + contains_sound (CA3_5_8I1PairRaw_sound a) (CA3_5_8I1PairP_check a) +def CA3_5_8I1PairTerms (a : PairSlot × PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_5_8I1PairCertificates (CA3_5_8I1PairCertificateIndex a)).output +lemma CA3_5_8I1PairTerms_sound (a : PairSlot × PairSlot) : + (CA3_5_8I1PairTerms a).Encloses (Foundation.entropyTerm (CA3_5_8I1PairValue a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA3_5_8I1PairCertificates_valid + (CA3_5_8I1PairCertificateIndex a) (CA3_5_8I1PairP_sound a) +def CA3_5_8I1PairEntropy : Ball := ⟨(16214910566568980863325613590037 / 5000000000000000000000000000000), (3445353169 / 2500000000000000000000000000000)⟩ +lemma CA3_5_8I1PairEntropy_sound : CA3_5_8I1PairEntropy.Encloses (Foundation.finiteEntropy CA3_5_8I1PairValue) := by + exact contains_sound (entropyDoublePair_enclosed CA3_5_8I1PairValue CA3_5_8I1PairTerms CA3_5_8I1PairTerms_sound) (by decide +kernel) +def CA3_5_8I1PairMass : Ball := ⟨(12499999999999999999999999999999 / 12500000000000000000000000000000), (67 / 12500000000000000000000000000000)⟩ +lemma CA3_5_8I1PairMass_sound : CA3_5_8I1PairMass.Encloses (∑ a, CA3_5_8I1PairValue a) := by + exact contains_sound (doublePairSumBall_sound CA3_5_8I1PairP CA3_5_8I1PairValue CA3_5_8I1PairP_sound) (by decide +kernel) +def CA3_5_8I1PairMassTermLogWitness : LogWitness := ⟨-1, 12499999999999999999999999999999, 6250000000000000000000000000000⟩ +def CA3_5_8I1PairMassTermLog : Ball := ⟨(-7 / 100000000000000000000000000000000), (21175823951 / 50000000000000000000000000000000)⟩ +lemma CA3_5_8I1PairMassTermLog_sound : CA3_5_8I1PairMassTermLog.Encloses (Real.log ((∑ a, CA3_5_8I1PairValue a))) := by + exact checkLog_sound logTwoBall_sound (CA3_5_8I1PairMass_sound) (w := CA3_5_8I1PairMassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA3_5_8I1PairMassTerm : Ball := ⟨(7 / 100000000000000000000000000000000), (42351647903 / 100000000000000000000000000000000)⟩ +lemma CA3_5_8I1PairMassTerm_sound : CA3_5_8I1PairMassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA3_5_8I1PairValue a))) := by + exact contains_sound (entropyTerm_ball (CA3_5_8I1PairMass_sound) CA3_5_8I1PairMassTermLog_sound) (by decide +kernel) +def CA3_5_8I1PairH : Ball := ⟨(324298211331379617266512271800733 / 100000000000000000000000000000000), (180165774663 / 100000000000000000000000000000000)⟩ +lemma CA3_5_8I1PairH_sound : CA3_5_8I1PairH.Encloses (homogeneousEntropy CA3_5_8I1PairValue) := by + exact contains_sound (homogeneous_enclosed CA3_5_8I1PairValue CA3_5_8I1PairMassTerm_sound CA3_5_8I1PairEntropy_sound) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CA3_5_8I1R0Value (a : PairSlot) : ℝ := residualLaw (below (shape 3 5 8)) (fun u => (stageALaw (shape 3 5 8) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 0 a +def CA3_5_8I1R0Raw (a : PairSlot) : Ball := residualBall (below (shape 3 5 8)) A3_5_8Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 0 a +lemma CA3_5_8I1R0Raw_sound (a : PairSlot) : + (CA3_5_8I1R0Raw a).Encloses (CA3_5_8I1R0Value a) := by + exact residualBall_sound_on (below (shape 3 5 8)) A3_5_8Law (fun u => (stageALaw (shape 3 5 8) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A3_5_8Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 3 5 8) (show (shape 3 5 8) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 0 a +def CA3_5_8I1R0Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(138259867691619025407984228733 / 50000000000000000000000000000000), (1 / 20000000000000000000000000000000)⟩ ⟨(1628879118491678187756967641173 / 100000000000000000000000000000000), (585553351 / 100000000000000000000000000000000)⟩ ⟨(-117812865416941003692582243865407 / 20000000000000000000000000000000), (211758238637 / 100000000000000000000000000000000)⟩ ⟨-9, 138259867691619025407984228733, 97656250000000000000000000000⟩] +lemma CA3_5_8I1R0Certificates_valid : + CA3_5_8I1R0Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA3_5_8I1R0CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 0, 0 => 1 + | _, _ => 0 +def CA3_5_8I1R0P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_5_8I1R0Certificates (CA3_5_8I1R0CertificateIndex a)).input +lemma CA3_5_8I1R0P_check : ∀ a : PairSlot, contains (CA3_5_8I1R0Raw a) (CA3_5_8I1R0P a) = true := by + decide +kernel +lemma CA3_5_8I1R0P_sound (a : PairSlot) : + (CA3_5_8I1R0P a).Encloses (CA3_5_8I1R0Value a) := + contains_sound (CA3_5_8I1R0Raw_sound a) (CA3_5_8I1R0P_check a) +def CA3_5_8I1R0Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_5_8I1R0Certificates (CA3_5_8I1R0CertificateIndex a)).output +lemma CA3_5_8I1R0Terms_sound (a : PairSlot) : + (CA3_5_8I1R0Terms a).Encloses (Foundation.entropyTerm (CA3_5_8I1R0Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA3_5_8I1R0Certificates_valid + (CA3_5_8I1R0CertificateIndex a) (CA3_5_8I1R0P_sound a) +def CA3_5_8I1R0Entropy : Ball := ⟨(1628879118491678187756967641173 / 100000000000000000000000000000000), (585553351 / 100000000000000000000000000000000)⟩ +lemma CA3_5_8I1R0Entropy_sound : CA3_5_8I1R0Entropy.Encloses (Foundation.finiteEntropy CA3_5_8I1R0Value) := by + exact contains_sound (entropyPair_enclosed CA3_5_8I1R0Value CA3_5_8I1R0Terms CA3_5_8I1R0Terms_sound) (by decide +kernel) +def CA3_5_8I1R0Mass : Ball := ⟨(138259867691619025407984228733 / 50000000000000000000000000000000), (1 / 20000000000000000000000000000000)⟩ +lemma CA3_5_8I1R0Mass_sound : CA3_5_8I1R0Mass.Encloses (∑ a, CA3_5_8I1R0Value a) := by + exact contains_sound (pairSumBall_sound CA3_5_8I1R0P CA3_5_8I1R0Value CA3_5_8I1R0P_sound) (by decide +kernel) +def CA3_5_8I1R0MassTermLogWitness : LogWitness := ⟨-9, 138259867691619025407984228733, 97656250000000000000000000000⟩ +def CA3_5_8I1R0MassTermLog : Ball := ⟨(-117812865416941003692582243865407 / 20000000000000000000000000000000), (211758238637 / 100000000000000000000000000000000)⟩ +lemma CA3_5_8I1R0MassTermLog_sound : CA3_5_8I1R0MassTermLog.Encloses (Real.log ((∑ a, CA3_5_8I1R0Value a))) := by + exact checkLog_sound logTwoBall_sound (CA3_5_8I1R0Mass_sound) (w := CA3_5_8I1R0MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA3_5_8I1R0MassTerm : Ball := ⟨(1628879118491678187756967641173 / 100000000000000000000000000000000), (585553351 / 100000000000000000000000000000000)⟩ +lemma CA3_5_8I1R0MassTerm_sound : CA3_5_8I1R0MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA3_5_8I1R0Value a))) := by + exact contains_sound (entropyTerm_ball (CA3_5_8I1R0Mass_sound) CA3_5_8I1R0MassTermLog_sound) (by decide +kernel) +def CA3_5_8I1R0H : Ball := ⟨0, (585553351 / 50000000000000000000000000000000)⟩ +lemma CA3_5_8I1R0H_sound : CA3_5_8I1R0H.Encloses (homogeneousEntropy CA3_5_8I1R0Value) := by + exact contains_sound (homogeneous_enclosed CA3_5_8I1R0Value CA3_5_8I1R0MassTerm_sound CA3_5_8I1R0Entropy_sound) (by decide +kernel) +def CA3_5_8I1R1Value (a : PairSlot) : ℝ := residualLaw (below (shape 3 5 8)) (fun u => (stageALaw (shape 3 5 8) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 1 a +def CA3_5_8I1R1Raw (a : PairSlot) : Ball := residualBall (below (shape 3 5 8)) A3_5_8Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 1 a +lemma CA3_5_8I1R1Raw_sound (a : PairSlot) : + (CA3_5_8I1R1Raw a).Encloses (CA3_5_8I1R1Value a) := by + exact residualBall_sound_on (below (shape 3 5 8)) A3_5_8Law (fun u => (stageALaw (shape 3 5 8) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A3_5_8Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 3 5 8) (show (shape 3 5 8) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 1 a +def CA3_5_8I1R1Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(4266273080468078013491963850177 / 100000000000000000000000000000000), (1 / 5000000000000000000000000000000)⟩ ⟨(13457657893666748061001354681387 / 100000000000000000000000000000000), (1355127719 / 25000000000000000000000000000000)⟩ ⟨(-157721477737545916086942151562357 / 50000000000000000000000000000000), (63527471283 / 50000000000000000000000000000000)⟩ ⟨-5, 4266273080468078013491963850177, 3125000000000000000000000000000⟩] +lemma CA3_5_8I1R1Certificates_valid : + CA3_5_8I1R1Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA3_5_8I1R1CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 1, 0 => 1 + | 0, 1 => 1 + | _, _ => 0 +def CA3_5_8I1R1P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_5_8I1R1Certificates (CA3_5_8I1R1CertificateIndex a)).input +lemma CA3_5_8I1R1P_check : ∀ a : PairSlot, contains (CA3_5_8I1R1Raw a) (CA3_5_8I1R1P a) = true := by + decide +kernel +lemma CA3_5_8I1R1P_sound (a : PairSlot) : + (CA3_5_8I1R1P a).Encloses (CA3_5_8I1R1Value a) := + contains_sound (CA3_5_8I1R1Raw_sound a) (CA3_5_8I1R1P_check a) +def CA3_5_8I1R1Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_5_8I1R1Certificates (CA3_5_8I1R1CertificateIndex a)).output +lemma CA3_5_8I1R1Terms_sound (a : PairSlot) : + (CA3_5_8I1R1Terms a).Encloses (Foundation.entropyTerm (CA3_5_8I1R1Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA3_5_8I1R1Certificates_valid + (CA3_5_8I1R1CertificateIndex a) (CA3_5_8I1R1P_sound a) +def CA3_5_8I1R1Entropy : Ball := ⟨(13457657893666748061001354681387 / 50000000000000000000000000000000), (1355127719 / 12500000000000000000000000000000)⟩ +lemma CA3_5_8I1R1Entropy_sound : CA3_5_8I1R1Entropy.Encloses (Foundation.finiteEntropy CA3_5_8I1R1Value) := by + exact contains_sound (entropyPair_enclosed CA3_5_8I1R1Value CA3_5_8I1R1Terms CA3_5_8I1R1Terms_sound) (by decide +kernel) +def CA3_5_8I1R1Mass : Ball := ⟨(4266273080468078013491963850177 / 50000000000000000000000000000000), (1 / 2500000000000000000000000000000)⟩ +lemma CA3_5_8I1R1Mass_sound : CA3_5_8I1R1Mass.Encloses (∑ a, CA3_5_8I1R1Value a) := by + exact contains_sound (pairSumBall_sound CA3_5_8I1R1P CA3_5_8I1R1Value CA3_5_8I1R1P_sound) (by decide +kernel) +def CA3_5_8I1R1MassTermLogWitness : LogWitness := ⟨-4, 4266273080468078013491963850177, 3125000000000000000000000000000⟩ +def CA3_5_8I1R1MassTermLog : Ball := ⟨(-15383014838693581327010069379649 / 6250000000000000000000000000000), (105879118883 / 100000000000000000000000000000000)⟩ +lemma CA3_5_8I1R1MassTermLog_sound : CA3_5_8I1R1MassTermLog.Encloses (Real.log ((∑ a, CA3_5_8I1R1Value a))) := by + exact checkLog_sound logTwoBall_sound (CA3_5_8I1R1Mass_sound) (w := CA3_5_8I1R1MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA3_5_8I1R1MassTerm : Ball := ⟨(21001005472883014211656585649313 / 100000000000000000000000000000000), (1129273099 / 12500000000000000000000000000000)⟩ +lemma CA3_5_8I1R1MassTerm_sound : CA3_5_8I1R1MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA3_5_8I1R1Value a))) := by + exact contains_sound (entropyTerm_ball (CA3_5_8I1R1Mass_sound) CA3_5_8I1R1MassTermLog_sound) (by decide +kernel) +def CA3_5_8I1R1H : Ball := ⟨(5914310314450481910346123713461 / 100000000000000000000000000000000), (1242200409 / 6250000000000000000000000000000)⟩ +lemma CA3_5_8I1R1H_sound : CA3_5_8I1R1H.Encloses (homogeneousEntropy CA3_5_8I1R1Value) := by + exact contains_sound (homogeneous_enclosed CA3_5_8I1R1Value CA3_5_8I1R1MassTerm_sound CA3_5_8I1R1Entropy_sound) (by decide +kernel) +def CA3_5_8I1R2Value (a : PairSlot) : ℝ := residualLaw (below (shape 3 5 8)) (fun u => (stageALaw (shape 3 5 8) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 2 a +def CA3_5_8I1R2Raw (a : PairSlot) : Ball := residualBall (below (shape 3 5 8)) A3_5_8Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 2 a +lemma CA3_5_8I1R2Raw_sound (a : PairSlot) : + (CA3_5_8I1R2Raw a).Encloses (CA3_5_8I1R2Value a) := by + exact residualBall_sound_on (below (shape 3 5 8)) A3_5_8Law (fun u => (stageALaw (shape 3 5 8) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A3_5_8Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 3 5 8) (show (shape 3 5 8) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 2 a +def CA3_5_8I1R2Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(1732058034600497431197378349933 / 25000000000000000000000000000000), (17 / 50000000000000000000000000000000)⟩ ⟨(18495369548193411776424744414103 / 100000000000000000000000000000000), (1467110247 / 20000000000000000000000000000000)⟩ ⟨(-33369568850177494356769160427099 / 12500000000000000000000000000000), (21175823781 / 20000000000000000000000000000000)⟩ ⟨-4, 1732058034600497431197378349933, 1562500000000000000000000000000⟩, + .log ⟨(662793209150315703420082222219 / 100000000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ ⟨(3324877229360328262507473508913 / 100000000000000000000000000000000), (1263167317 / 100000000000000000000000000000000)⟩ ⟨(-501646242516989214412371807145623 / 100000000000000000000000000000000), (152465931 / 80000000000000000000000000000)⟩ ⟨-8, 662793209150315703420082222219, 390625000000000000000000000000⟩, + .log ⟨(13004441704287997532890456299139 / 50000000000000000000000000000000), (71 / 100000000000000000000000000000000)⟩ ⟨(8756749131682586890617478494347 / 25000000000000000000000000000000), (3304557209 / 20000000000000000000000000000000)⟩ ⟨(-26934640735234931508264669871873 / 20000000000000000000000000000000), (63527471321 / 100000000000000000000000000000000)⟩ ⟨-2, 13004441704287997532890456299139, 12500000000000000000000000000000⟩] +lemma CA3_5_8I1R2Certificates_valid : + CA3_5_8I1R2Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA3_5_8I1R2CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 2, 0 => 1 + | 3, 0 => 2 + | 1, 1 => 3 + | 0, 2 => 1 + | 0, 3 => 2 + | _, _ => 0 +def CA3_5_8I1R2P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_5_8I1R2Certificates (CA3_5_8I1R2CertificateIndex a)).input +lemma CA3_5_8I1R2P_check : ∀ a : PairSlot, contains (CA3_5_8I1R2Raw a) (CA3_5_8I1R2P a) = true := by + decide +kernel +lemma CA3_5_8I1R2P_sound (a : PairSlot) : + (CA3_5_8I1R2P a).Encloses (CA3_5_8I1R2Value a) := + contains_sound (CA3_5_8I1R2Raw_sound a) (CA3_5_8I1R2P_check a) +def CA3_5_8I1R2Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_5_8I1R2Certificates (CA3_5_8I1R2CertificateIndex a)).output +lemma CA3_5_8I1R2Terms_sound (a : PairSlot) : + (CA3_5_8I1R2Terms a).Encloses (Foundation.entropyTerm (CA3_5_8I1R2Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA3_5_8I1R2Certificates_valid + (CA3_5_8I1R2CertificateIndex a) (CA3_5_8I1R2P_sound a) +def CA3_5_8I1R2Entropy : Ball := ⟨(3933374504091891382016717491171 / 5000000000000000000000000000000), (33720223149 / 100000000000000000000000000000000)⟩ +lemma CA3_5_8I1R2Entropy_sound : CA3_5_8I1R2Entropy.Encloses (Foundation.finiteEntropy CA3_5_8I1R2Value) := by + exact contains_sound (entropyPair_enclosed CA3_5_8I1R2Value CA3_5_8I1R2Terms CA3_5_8I1R2Terms_sound) (by decide +kernel) +def CA3_5_8I1R2Mass : Ball := ⟨(2059546705184030296110005192109 / 5000000000000000000000000000000), (147 / 100000000000000000000000000000000)⟩ +lemma CA3_5_8I1R2Mass_sound : CA3_5_8I1R2Mass.Encloses (∑ a, CA3_5_8I1R2Value a) := by + exact contains_sound (pairSumBall_sound CA3_5_8I1R2P CA3_5_8I1R2Value CA3_5_8I1R2P_sound) (by decide +kernel) +def CA3_5_8I1R2MassTermLogWitness : LogWitness := ⟨-2, 2059546705184030296110005192109, 1250000000000000000000000000000⟩ +def CA3_5_8I1R2MassTermLog : Ball := ⟨(-44347599993672980298295301558257 / 50000000000000000000000000000000), (31763735703 / 50000000000000000000000000000000)⟩ +lemma CA3_5_8I1R2MassTermLog_sound : CA3_5_8I1R2MassTermLog.Encloses (Real.log ((∑ a, CA3_5_8I1R2Value a))) := by + exact checkLog_sound logTwoBall_sound (CA3_5_8I1R2Mass_sound) (w := CA3_5_8I1R2MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA3_5_8I1R2MassTerm : Ball := ⟨(18267190689957701875897541677933 / 50000000000000000000000000000000), (3270944877 / 12500000000000000000000000000000)⟩ +lemma CA3_5_8I1R2MassTerm_sound : CA3_5_8I1R2MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA3_5_8I1R2Value a))) := by + exact contains_sound (entropyTerm_ball (CA3_5_8I1R2Mass_sound) CA3_5_8I1R2MassTermLog_sound) (by decide +kernel) +def CA3_5_8I1R2H : Ball := ⟨(21066554350961211944269633233777 / 50000000000000000000000000000000), (11977556433 / 20000000000000000000000000000000)⟩ +lemma CA3_5_8I1R2H_sound : CA3_5_8I1R2H.Encloses (homogeneousEntropy CA3_5_8I1R2Value) := by + exact contains_sound (homogeneous_enclosed CA3_5_8I1R2Value CA3_5_8I1R2MassTerm_sound CA3_5_8I1R2Entropy_sound) (by decide +kernel) +def CA3_5_8I1R3Value (a : PairSlot) : ℝ := residualLaw (below (shape 3 5 8)) (fun u => (stageALaw (shape 3 5 8) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 3 a +def CA3_5_8I1R3Raw (a : PairSlot) : Ball := residualBall (below (shape 3 5 8)) A3_5_8Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 3 a +lemma CA3_5_8I1R3Raw_sound (a : PairSlot) : + (CA3_5_8I1R3Raw a).Encloses (CA3_5_8I1R3Value a) := by + exact residualBall_sound_on (below (shape 3 5 8)) A3_5_8Law (fun u => (stageALaw (shape 3 5 8) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A3_5_8Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 3 5 8) (show (shape 3 5 8) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 3 a +def CA3_5_8I1R3Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(151789180162450676258081708043 / 25000000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ ⟨(309901200454757306092904831649 / 10000000000000000000000000000000), (231426791 / 20000000000000000000000000000000)⟩ ⟨(-255206925917816576652681312921111 / 50000000000000000000000000000000), (38116482761 / 20000000000000000000000000000000)⟩ ⟨-8, 151789180162450676258081708043, 97656250000000000000000000000⟩, + .log ⟨(18351281301467465185364929407901 / 100000000000000000000000000000000), (43 / 100000000000000000000000000000000)⟩ ⟨(31114061373269187099674069289423 / 100000000000000000000000000000000), (3108828001 / 20000000000000000000000000000000)⟩ ⟨(-84773539411608122276290691627311 / 50000000000000000000000000000000), (42351647483 / 50000000000000000000000000000000)⟩ ⟨-3, 18351281301467465185364929407901, 12500000000000000000000000000000⟩, + .log ⟨(1637029029723035070702795681017 / 100000000000000000000000000000000), (1 / 20000000000000000000000000000000)⟩ ⟨(6731933450091206156308259969981 / 100000000000000000000000000000000), (2426580693 / 100000000000000000000000000000000)⟩ ⟨(-205614357713319399022491729032407 / 50000000000000000000000000000000), (29646153217 / 20000000000000000000000000000000)⟩ ⟨-6, 1637029029723035070702795681017, 1562500000000000000000000000000⟩] +lemma CA3_5_8I1R3Certificates_valid : + CA3_5_8I1R3Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA3_5_8I1R3CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 4, 0 => 1 + | 2, 1 => 2 + | 3, 1 => 3 + | 1, 2 => 2 + | 1, 3 => 3 + | 0, 4 => 1 + | _, _ => 0 +def CA3_5_8I1R3P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_5_8I1R3Certificates (CA3_5_8I1R3CertificateIndex a)).input +lemma CA3_5_8I1R3P_check : ∀ a : PairSlot, contains (CA3_5_8I1R3Raw a) (CA3_5_8I1R3P a) = true := by + decide +kernel +lemma CA3_5_8I1R3P_sound (a : PairSlot) : + (CA3_5_8I1R3P a).Encloses (CA3_5_8I1R3Value a) := + contains_sound (CA3_5_8I1R3Raw_sound a) (CA3_5_8I1R3P_check a) +def CA3_5_8I1R3Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_5_8I1R3Certificates (CA3_5_8I1R3CertificateIndex a)).output +lemma CA3_5_8I1R3Terms_sound (a : PairSlot) : + (CA3_5_8I1R3Terms a).Encloses (Foundation.entropyTerm (CA3_5_8I1R3Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA3_5_8I1R3Certificates_valid + (CA3_5_8I1R3CertificateIndex a) (CA3_5_8I1R3P_sound a) +def CA3_5_8I1R3Entropy : Ball := ⟨(20472503413953983158455688787947 / 25000000000000000000000000000000), (19127854653 / 50000000000000000000000000000000)⟩ +lemma CA3_5_8I1R3Entropy_sound : CA3_5_8I1R3Entropy.Encloses (Foundation.finiteEntropy CA3_5_8I1R3Value) := by + exact contains_sound (entropyPair_enclosed CA3_5_8I1R3Value CA3_5_8I1R3Terms CA3_5_8I1R3Terms_sound) (by decide +kernel) +def CA3_5_8I1R3Mass : Ball := ⟨(2059546705184030296110005192109 / 5000000000000000000000000000000), (13 / 12500000000000000000000000000000)⟩ +lemma CA3_5_8I1R3Mass_sound : CA3_5_8I1R3Mass.Encloses (∑ a, CA3_5_8I1R3Value a) := by + exact contains_sound (pairSumBall_sound CA3_5_8I1R3P CA3_5_8I1R3Value CA3_5_8I1R3P_sound) (by decide +kernel) +def CA3_5_8I1R3MassTermLogWitness : LogWitness := ⟨-2, 2059546705184030296110005192109, 1250000000000000000000000000000⟩ +def CA3_5_8I1R3MassTermLog : Ball := ⟨(-44347599993672980298295301558257 / 50000000000000000000000000000000), (63527471301 / 100000000000000000000000000000000)⟩ +lemma CA3_5_8I1R3MassTermLog_sound : CA3_5_8I1R3MassTermLog.Encloses (Real.log ((∑ a, CA3_5_8I1R3Value a))) := by + exact checkLog_sound logTwoBall_sound (CA3_5_8I1R3Mass_sound) (w := CA3_5_8I1R3MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA3_5_8I1R3MassTerm : Ball := ⟨(18267190689957701875897541677933 / 50000000000000000000000000000000), (13083779467 / 50000000000000000000000000000000)⟩ +lemma CA3_5_8I1R3MassTerm_sound : CA3_5_8I1R3MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA3_5_8I1R3Value a))) := by + exact contains_sound (entropyTerm_ball (CA3_5_8I1R3Mass_sound) CA3_5_8I1R3MassTermLog_sound) (by decide +kernel) +def CA3_5_8I1R3H : Ball := ⟨(22677816137950264441013835897961 / 50000000000000000000000000000000), (805290853 / 1250000000000000000000000000000)⟩ +lemma CA3_5_8I1R3H_sound : CA3_5_8I1R3H.Encloses (homogeneousEntropy CA3_5_8I1R3Value) := by + exact contains_sound (homogeneous_enclosed CA3_5_8I1R3Value CA3_5_8I1R3MassTerm_sound CA3_5_8I1R3Entropy_sound) (by decide +kernel) +def CA3_5_8I1R4Value (a : PairSlot) : ℝ := residualLaw (below (shape 3 5 8)) (fun u => (stageALaw (shape 3 5 8) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 4 a +def CA3_5_8I1R4Raw (a : PairSlot) : Ball := residualBall (below (shape 3 5 8)) A3_5_8Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 4 a +lemma CA3_5_8I1R4Raw_sound (a : PairSlot) : + (CA3_5_8I1R4Raw a).Encloses (CA3_5_8I1R4Value a) := by + exact residualBall_sound_on (below (shape 3 5 8)) A3_5_8Law (fun u => (stageALaw (shape 3 5 8) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A3_5_8Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 3 5 8) (show (shape 3 5 8) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 4 a +def CA3_5_8I1R4Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(1272000276383149435550995439 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(93546901947419510135397426799 / 100000000000000000000000000000000), (6464559 / 20000000000000000000000000000000)⟩ ⟨(-14363895689203336735508833207477 / 1562500000000000000000000000000), (19852335317 / 6250000000000000000000000000000)⟩ ⟨-14, 1272000276383149435550995439, 762939453125000000000000000⟩, + .log ⟨(224235380405963066391746089353 / 25000000000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ ⟨(52851548135521399408730381197 / 1250000000000000000000000000000), (379869519 / 25000000000000000000000000000000)⟩ ⟨(-471393479832105247029900450162331 / 100000000000000000000000000000000), (42351647533 / 25000000000000000000000000000000)⟩ ⟨-7, 224235380405963066391746089353, 195312500000000000000000000000⟩, + .log ⟨(1156030572615608658295557769993 / 20000000000000000000000000000000), (3 / 10000000000000000000000000000000)⟩ ⟨(16477713300939069480092853639993 / 100000000000000000000000000000000), (734396999 / 10000000000000000000000000000000)⟩ ⟨(-71268501418855072340827195588763 / 25000000000000000000000000000000), (127054942617 / 100000000000000000000000000000000)⟩ ⟨-5, 1156030572615608658295557769993, 625000000000000000000000000000⟩, + .log ⟨(56502172949873789302552257373 / 12500000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ ⟨(97621377569169130847325550283 / 4000000000000000000000000000000), (430732829 / 50000000000000000000000000000000)⟩ ⟨(-539920482658773517673569757772287 / 100000000000000000000000000000000), (19058241381 / 10000000000000000000000000000000)⟩ ⟨-8, 56502172949873789302552257373, 48828125000000000000000000000⟩, + .log ⟨(8530870747574296140629522643 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(136202852968868853925447540013 / 50000000000000000000000000000000), (93937081 / 100000000000000000000000000000000)⟩ ⟨(-798293966695002084306178343103173 / 100000000000000000000000000000000), (275285710809 / 100000000000000000000000000000000)⟩ ⟨-12, 8530870747574296140629522643, 6103515625000000000000000000⟩] +lemma CA3_5_8I1R4Certificates_valid : + CA3_5_8I1R4Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA3_5_8I1R4CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 0, 5 => 1 + | 1, 4 => 2 + | 2, 2 => 3 + | 2, 3 => 4 + | 3, 2 => 4 + | 3, 3 => 5 + | 4, 1 => 2 + | 5, 0 => 1 + | _, _ => 0 +def CA3_5_8I1R4P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_5_8I1R4Certificates (CA3_5_8I1R4CertificateIndex a)).input +lemma CA3_5_8I1R4P_check : ∀ a : PairSlot, contains (CA3_5_8I1R4Raw a) (CA3_5_8I1R4P a) = true := by + decide +kernel +lemma CA3_5_8I1R4P_sound (a : PairSlot) : + (CA3_5_8I1R4P a).Encloses (CA3_5_8I1R4Value a) := + contains_sound (CA3_5_8I1R4Raw_sound a) (CA3_5_8I1R4P_check a) +def CA3_5_8I1R4Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_5_8I1R4Certificates (CA3_5_8I1R4CertificateIndex a)).output +lemma CA3_5_8I1R4Terms_sound (a : PairSlot) : + (CA3_5_8I1R4Terms a).Encloses (Foundation.entropyTerm (CA3_5_8I1R4Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA3_5_8I1R4Certificates_valid + (CA3_5_8I1R4CertificateIndex a) (CA3_5_8I1R4P_sound a) +def CA3_5_8I1R4Entropy : Ball := ⟨(30274529390913526655977682079287 / 100000000000000000000000000000000), (12264440129 / 100000000000000000000000000000000)⟩ +lemma CA3_5_8I1R4Entropy_sound : CA3_5_8I1R4Entropy.Encloses (Foundation.finiteEntropy CA3_5_8I1R4Value) := by + exact contains_sound (entropyPair_enclosed CA3_5_8I1R4Value CA3_5_8I1R4Terms CA3_5_8I1R4Terms_sound) (by decide +kernel) +def CA3_5_8I1R4Mass : Ball := ⟨(8532546160936156026983927700353 / 100000000000000000000000000000000), (51 / 100000000000000000000000000000000)⟩ +lemma CA3_5_8I1R4Mass_sound : CA3_5_8I1R4Mass.Encloses (∑ a, CA3_5_8I1R4Value a) := by + exact contains_sound (pairSumBall_sound CA3_5_8I1R4P CA3_5_8I1R4Value CA3_5_8I1R4P_sound) (by decide +kernel) +def CA3_5_8I1R4MassTermLogWitness : LogWitness := ⟨-4, 8532546160936156026983927700353, 6250000000000000000000000000000⟩ +def CA3_5_8I1R4MassTermLog : Ball := ⟨(-49225647483819460246432222014879 / 20000000000000000000000000000000), (26469779753 / 25000000000000000000000000000000)⟩ +lemma CA3_5_8I1R4MassTermLog_sound : CA3_5_8I1R4MassTermLog.Encloses (Real.log ((∑ a, CA3_5_8I1R4Value a))) := by + exact checkLog_sound logTwoBall_sound (CA3_5_8I1R4Mass_sound) (w := CA3_5_8I1R4MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA3_5_8I1R4MassTerm : Ball := ⟨(656281421027594194114268301541 / 3125000000000000000000000000000), (9034184831 / 100000000000000000000000000000000)⟩ +lemma CA3_5_8I1R4MassTerm_sound : CA3_5_8I1R4MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA3_5_8I1R4Value a))) := by + exact contains_sound (entropyTerm_ball (CA3_5_8I1R4Mass_sound) CA3_5_8I1R4MassTermLog_sound) (by decide +kernel) +def CA3_5_8I1R4H : Ball := ⟨(370940956721220497772843857199 / 4000000000000000000000000000000), (66558203 / 312500000000000000000000000000)⟩ +lemma CA3_5_8I1R4H_sound : CA3_5_8I1R4H.Encloses (homogeneousEntropy CA3_5_8I1R4Value) := by + exact contains_sound (homogeneous_enclosed CA3_5_8I1R4Value CA3_5_8I1R4MassTerm_sound CA3_5_8I1R4Entropy_sound) (by decide +kernel) +def CA3_5_8I1R5Value (a : PairSlot) : ℝ := residualLaw (below (shape 3 5 8)) (fun u => (stageALaw (shape 3 5 8) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 5 a +def CA3_5_8I1R5Raw (a : PairSlot) : Ball := residualBall (below (shape 3 5 8)) A3_5_8Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 5 a +lemma CA3_5_8I1R5Raw_sound (a : PairSlot) : + (CA3_5_8I1R5Raw a).Encloses (CA3_5_8I1R5Value a) := by + exact residualBall_sound_on (below (shape 3 5 8)) A3_5_8Law (fun u => (stageALaw (shape 3 5 8) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A3_5_8Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 3 5 8) (show (shape 3 5 8) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 5 a +def CA3_5_8I1R5Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(5272203925092215934029514299 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(51933723438763325915614291737 / 100000000000000000000000000000000), (17862933 / 100000000000000000000000000000000)⟩ ⟨(-39401907950937201261276430437901 / 4000000000000000000000000000000), (67762639579 / 20000000000000000000000000000000)⟩ ⟨-15, 5272203925092215934029514299, 3051757812500000000000000000⟩, + .log ⟨(61404626659784376348493931181 / 50000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ ⟨(823103611057719379002926802197 / 100000000000000000000000000000000), (71516151 / 25000000000000000000000000000000)⟩ ⟨(-134045861986616909564646490828711 / 20000000000000000000000000000000), (46586812591 / 20000000000000000000000000000000)⟩ ⟨-10, 61404626659784376348493931181, 48828125000000000000000000000⟩, + .log ⟨(10175601786320755287480586361 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(93543621302358779159912357719 / 100000000000000000000000000000000), (32321523 / 100000000000000000000000000000000)⟩ ⟨(-114911657397146714345255337106347 / 12500000000000000000000000000000), (19852335317 / 6250000000000000000000000000000)⟩ ⟨-14, 10175601786320755287480586361, 6103515625000000000000000000⟩] +lemma CA3_5_8I1R5Certificates_valid : + CA3_5_8I1R5Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA3_5_8I1R5CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 1, 5 => 1 + | 2, 4 => 2 + | 3, 4 => 3 + | 4, 2 => 2 + | 4, 3 => 3 + | 5, 1 => 1 + | _, _ => 0 +def CA3_5_8I1R5P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_5_8I1R5Certificates (CA3_5_8I1R5CertificateIndex a)).input +lemma CA3_5_8I1R5P_check : ∀ a : PairSlot, contains (CA3_5_8I1R5Raw a) (CA3_5_8I1R5P a) = true := by + decide +kernel +lemma CA3_5_8I1R5P_sound (a : PairSlot) : + (CA3_5_8I1R5P a).Encloses (CA3_5_8I1R5Value a) := + contains_sound (CA3_5_8I1R5Raw_sound a) (CA3_5_8I1R5P_check a) +def CA3_5_8I1R5Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_5_8I1R5Certificates (CA3_5_8I1R5CertificateIndex a)).output +lemma CA3_5_8I1R5Terms_sound (a : PairSlot) : + (CA3_5_8I1R5Terms a).Encloses (Foundation.entropyTerm (CA3_5_8I1R5Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA3_5_8I1R5Certificates_valid + (CA3_5_8I1R5CertificateIndex a) (CA3_5_8I1R5P_sound a) +def CA3_5_8I1R5Entropy : Ball := ⟨(968580955798841484078453451653 / 50000000000000000000000000000000), (16812453 / 2500000000000000000000000000000)⟩ +lemma CA3_5_8I1R5Entropy_sound : CA3_5_8I1R5Entropy.Encloses (Foundation.finiteEntropy CA3_5_8I1R5Value) := by + exact contains_sound (entropyPair_enclosed CA3_5_8I1R5Value CA3_5_8I1R5Terms CA3_5_8I1R5Terms_sound) (by decide +kernel) +def CA3_5_8I1R5Mass : Ball := ⟨(69128529515490861959248981511 / 25000000000000000000000000000000), (1 / 10000000000000000000000000000000)⟩ +lemma CA3_5_8I1R5Mass_sound : CA3_5_8I1R5Mass.Encloses (∑ a, CA3_5_8I1R5Value a) := by + exact contains_sound (pairSumBall_sound CA3_5_8I1R5P CA3_5_8I1R5Value CA3_5_8I1R5P_sound) (by decide +kernel) +def CA3_5_8I1R5MassTermLogWitness : LogWitness := ⟨-9, 69128529515490861959248981511, 48828125000000000000000000000⟩ +def CA3_5_8I1R5MassTermLog : Ball := ⟨(-147266589635318730006094524319141 / 25000000000000000000000000000000), (105879120223 / 50000000000000000000000000000000)⟩ +lemma CA3_5_8I1R5MassTermLog_sound : CA3_5_8I1R5MassTermLog.Encloses (Real.log ((∑ a, CA3_5_8I1R5Value a))) := by + exact checkLog_sound logTwoBall_sound (CA3_5_8I1R5Mass_sound) (w := CA3_5_8I1R5MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA3_5_8I1R5MassTerm : Ball := ⟨(1628851646120129836860628761549 / 100000000000000000000000000000000), (585541491 / 100000000000000000000000000000000)⟩ +lemma CA3_5_8I1R5MassTerm_sound : CA3_5_8I1R5MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA3_5_8I1R5Value a))) := by + exact contains_sound (entropyTerm_ball (CA3_5_8I1R5Mass_sound) CA3_5_8I1R5MassTermLog_sound) (by decide +kernel) +def CA3_5_8I1R5H : Ball := ⟨(308310265477553131296278141757 / 100000000000000000000000000000000), (1258039611 / 100000000000000000000000000000000)⟩ +lemma CA3_5_8I1R5H_sound : CA3_5_8I1R5H.Encloses (homogeneousEntropy CA3_5_8I1R5Value) := by + exact contains_sound (homogeneous_enclosed CA3_5_8I1R5Value CA3_5_8I1R5MassTerm_sound CA3_5_8I1R5Entropy_sound) (by decide +kernel) +def CA3_5_8I1R6Value (a : PairSlot) : ℝ := residualLaw (below (shape 3 5 8)) (fun u => (stageALaw (shape 3 5 8) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 6 a +def CA3_5_8I1R6Raw (a : PairSlot) : Ball := residualBall (below (shape 3 5 8)) A3_5_8Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 6 a +lemma CA3_5_8I1R6Raw_sound (a : PairSlot) : + (CA3_5_8I1R6Raw a).Encloses (CA3_5_8I1R6Value a) := by + exact residualBall_sound_on (below (shape 3 5 8)) A3_5_8Law (fun u => (stageALaw (shape 3 5 8) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A3_5_8Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 3 5 8) (show (shape 3 5 8) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 6 a +def CA3_5_8I1R6Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA3_5_8I1R6Certificates_valid : + CA3_5_8I1R6Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA3_5_8I1R6CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA3_5_8I1R6P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_5_8I1R6Certificates (CA3_5_8I1R6CertificateIndex a)).input +lemma CA3_5_8I1R6P_check : ∀ a : PairSlot, contains (CA3_5_8I1R6Raw a) (CA3_5_8I1R6P a) = true := by + decide +kernel +lemma CA3_5_8I1R6P_sound (a : PairSlot) : + (CA3_5_8I1R6P a).Encloses (CA3_5_8I1R6Value a) := + contains_sound (CA3_5_8I1R6Raw_sound a) (CA3_5_8I1R6P_check a) +def CA3_5_8I1R6Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_5_8I1R6Certificates (CA3_5_8I1R6CertificateIndex a)).output +lemma CA3_5_8I1R6Terms_sound (a : PairSlot) : + (CA3_5_8I1R6Terms a).Encloses (Foundation.entropyTerm (CA3_5_8I1R6Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA3_5_8I1R6Certificates_valid + (CA3_5_8I1R6CertificateIndex a) (CA3_5_8I1R6P_sound a) +def CA3_5_8I1R6Entropy : Ball := ⟨0, 0⟩ +lemma CA3_5_8I1R6Entropy_sound : CA3_5_8I1R6Entropy.Encloses (Foundation.finiteEntropy CA3_5_8I1R6Value) := by + exact contains_sound (entropyPair_enclosed CA3_5_8I1R6Value CA3_5_8I1R6Terms CA3_5_8I1R6Terms_sound) (by decide +kernel) +def CA3_5_8I1R6Mass : Ball := ⟨0, 0⟩ +lemma CA3_5_8I1R6Mass_sound : CA3_5_8I1R6Mass.Encloses (∑ a, CA3_5_8I1R6Value a) := by + exact contains_sound (pairSumBall_sound CA3_5_8I1R6P CA3_5_8I1R6Value CA3_5_8I1R6P_sound) (by decide +kernel) +def CA3_5_8I1R6MassTerm : Ball := .exact 0 +lemma CA3_5_8I1R6MassTerm_sound : CA3_5_8I1R6MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA3_5_8I1R6Value a))) := + entropyTerm_zero_ball (CA3_5_8I1R6Mass_sound) +def CA3_5_8I1R6H : Ball := ⟨0, 0⟩ +lemma CA3_5_8I1R6H_sound : CA3_5_8I1R6H.Encloses (homogeneousEntropy CA3_5_8I1R6Value) := by + exact contains_sound (homogeneous_enclosed CA3_5_8I1R6Value CA3_5_8I1R6MassTerm_sound CA3_5_8I1R6Entropy_sound) (by decide +kernel) +def CA3_5_8I1R7Value (a : PairSlot) : ℝ := residualLaw (below (shape 3 5 8)) (fun u => (stageALaw (shape 3 5 8) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 7 a +def CA3_5_8I1R7Raw (a : PairSlot) : Ball := residualBall (below (shape 3 5 8)) A3_5_8Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 7 a +lemma CA3_5_8I1R7Raw_sound (a : PairSlot) : + (CA3_5_8I1R7Raw a).Encloses (CA3_5_8I1R7Value a) := by + exact residualBall_sound_on (below (shape 3 5 8)) A3_5_8Law (fun u => (stageALaw (shape 3 5 8) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A3_5_8Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 3 5 8) (show (shape 3 5 8) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 7 a +def CA3_5_8I1R7Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA3_5_8I1R7Certificates_valid : + CA3_5_8I1R7Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA3_5_8I1R7CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA3_5_8I1R7P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_5_8I1R7Certificates (CA3_5_8I1R7CertificateIndex a)).input +lemma CA3_5_8I1R7P_check : ∀ a : PairSlot, contains (CA3_5_8I1R7Raw a) (CA3_5_8I1R7P a) = true := by + decide +kernel +lemma CA3_5_8I1R7P_sound (a : PairSlot) : + (CA3_5_8I1R7P a).Encloses (CA3_5_8I1R7Value a) := + contains_sound (CA3_5_8I1R7Raw_sound a) (CA3_5_8I1R7P_check a) +def CA3_5_8I1R7Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_5_8I1R7Certificates (CA3_5_8I1R7CertificateIndex a)).output +lemma CA3_5_8I1R7Terms_sound (a : PairSlot) : + (CA3_5_8I1R7Terms a).Encloses (Foundation.entropyTerm (CA3_5_8I1R7Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA3_5_8I1R7Certificates_valid + (CA3_5_8I1R7CertificateIndex a) (CA3_5_8I1R7P_sound a) +def CA3_5_8I1R7Entropy : Ball := ⟨0, 0⟩ +lemma CA3_5_8I1R7Entropy_sound : CA3_5_8I1R7Entropy.Encloses (Foundation.finiteEntropy CA3_5_8I1R7Value) := by + exact contains_sound (entropyPair_enclosed CA3_5_8I1R7Value CA3_5_8I1R7Terms CA3_5_8I1R7Terms_sound) (by decide +kernel) +def CA3_5_8I1R7Mass : Ball := ⟨0, 0⟩ +lemma CA3_5_8I1R7Mass_sound : CA3_5_8I1R7Mass.Encloses (∑ a, CA3_5_8I1R7Value a) := by + exact contains_sound (pairSumBall_sound CA3_5_8I1R7P CA3_5_8I1R7Value CA3_5_8I1R7P_sound) (by decide +kernel) +def CA3_5_8I1R7MassTerm : Ball := .exact 0 +lemma CA3_5_8I1R7MassTerm_sound : CA3_5_8I1R7MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA3_5_8I1R7Value a))) := + entropyTerm_zero_ball (CA3_5_8I1R7Mass_sound) +def CA3_5_8I1R7H : Ball := ⟨0, 0⟩ +lemma CA3_5_8I1R7H_sound : CA3_5_8I1R7H.Encloses (homogeneousEntropy CA3_5_8I1R7Value) := by + exact contains_sound (homogeneous_enclosed CA3_5_8I1R7Value CA3_5_8I1R7MassTerm_sound CA3_5_8I1R7Entropy_sound) (by decide +kernel) +def CA3_5_8I1R8Value (a : PairSlot) : ℝ := residualLaw (below (shape 3 5 8)) (fun u => (stageALaw (shape 3 5 8) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 8 a +def CA3_5_8I1R8Raw (a : PairSlot) : Ball := residualBall (below (shape 3 5 8)) A3_5_8Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 8 a +lemma CA3_5_8I1R8Raw_sound (a : PairSlot) : + (CA3_5_8I1R8Raw a).Encloses (CA3_5_8I1R8Value a) := by + exact residualBall_sound_on (below (shape 3 5 8)) A3_5_8Law (fun u => (stageALaw (shape 3 5 8) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A3_5_8Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 3 5 8) (show (shape 3 5 8) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 8 a +def CA3_5_8I1R8Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA3_5_8I1R8Certificates_valid : + CA3_5_8I1R8Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA3_5_8I1R8CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA3_5_8I1R8P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_5_8I1R8Certificates (CA3_5_8I1R8CertificateIndex a)).input +lemma CA3_5_8I1R8P_check : ∀ a : PairSlot, contains (CA3_5_8I1R8Raw a) (CA3_5_8I1R8P a) = true := by + decide +kernel +lemma CA3_5_8I1R8P_sound (a : PairSlot) : + (CA3_5_8I1R8P a).Encloses (CA3_5_8I1R8Value a) := + contains_sound (CA3_5_8I1R8Raw_sound a) (CA3_5_8I1R8P_check a) +def CA3_5_8I1R8Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_5_8I1R8Certificates (CA3_5_8I1R8CertificateIndex a)).output +lemma CA3_5_8I1R8Terms_sound (a : PairSlot) : + (CA3_5_8I1R8Terms a).Encloses (Foundation.entropyTerm (CA3_5_8I1R8Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA3_5_8I1R8Certificates_valid + (CA3_5_8I1R8CertificateIndex a) (CA3_5_8I1R8P_sound a) +def CA3_5_8I1R8Entropy : Ball := ⟨0, 0⟩ +lemma CA3_5_8I1R8Entropy_sound : CA3_5_8I1R8Entropy.Encloses (Foundation.finiteEntropy CA3_5_8I1R8Value) := by + exact contains_sound (entropyPair_enclosed CA3_5_8I1R8Value CA3_5_8I1R8Terms CA3_5_8I1R8Terms_sound) (by decide +kernel) +def CA3_5_8I1R8Mass : Ball := ⟨0, 0⟩ +lemma CA3_5_8I1R8Mass_sound : CA3_5_8I1R8Mass.Encloses (∑ a, CA3_5_8I1R8Value a) := by + exact contains_sound (pairSumBall_sound CA3_5_8I1R8P CA3_5_8I1R8Value CA3_5_8I1R8P_sound) (by decide +kernel) +def CA3_5_8I1R8MassTerm : Ball := .exact 0 +lemma CA3_5_8I1R8MassTerm_sound : CA3_5_8I1R8MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA3_5_8I1R8Value a))) := + entropyTerm_zero_ball (CA3_5_8I1R8Mass_sound) +def CA3_5_8I1R8H : Ball := ⟨0, 0⟩ +lemma CA3_5_8I1R8H_sound : CA3_5_8I1R8H.Encloses (homogeneousEntropy CA3_5_8I1R8Value) := by + exact contains_sound (homogeneous_enclosed CA3_5_8I1R8Value CA3_5_8I1R8MassTerm_sound CA3_5_8I1R8Entropy_sound) (by decide +kernel) +def CA3_5_8I1R9Value (a : PairSlot) : ℝ := residualLaw (below (shape 3 5 8)) (fun u => (stageALaw (shape 3 5 8) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 9 a +def CA3_5_8I1R9Raw (a : PairSlot) : Ball := residualBall (below (shape 3 5 8)) A3_5_8Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 9 a +lemma CA3_5_8I1R9Raw_sound (a : PairSlot) : + (CA3_5_8I1R9Raw a).Encloses (CA3_5_8I1R9Value a) := by + exact residualBall_sound_on (below (shape 3 5 8)) A3_5_8Law (fun u => (stageALaw (shape 3 5 8) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A3_5_8Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 3 5 8) (show (shape 3 5 8) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 9 a +def CA3_5_8I1R9Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA3_5_8I1R9Certificates_valid : + CA3_5_8I1R9Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA3_5_8I1R9CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA3_5_8I1R9P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_5_8I1R9Certificates (CA3_5_8I1R9CertificateIndex a)).input +lemma CA3_5_8I1R9P_check : ∀ a : PairSlot, contains (CA3_5_8I1R9Raw a) (CA3_5_8I1R9P a) = true := by + decide +kernel +lemma CA3_5_8I1R9P_sound (a : PairSlot) : + (CA3_5_8I1R9P a).Encloses (CA3_5_8I1R9Value a) := + contains_sound (CA3_5_8I1R9Raw_sound a) (CA3_5_8I1R9P_check a) +def CA3_5_8I1R9Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_5_8I1R9Certificates (CA3_5_8I1R9CertificateIndex a)).output +lemma CA3_5_8I1R9Terms_sound (a : PairSlot) : + (CA3_5_8I1R9Terms a).Encloses (Foundation.entropyTerm (CA3_5_8I1R9Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA3_5_8I1R9Certificates_valid + (CA3_5_8I1R9CertificateIndex a) (CA3_5_8I1R9P_sound a) +def CA3_5_8I1R9Entropy : Ball := ⟨0, 0⟩ +lemma CA3_5_8I1R9Entropy_sound : CA3_5_8I1R9Entropy.Encloses (Foundation.finiteEntropy CA3_5_8I1R9Value) := by + exact contains_sound (entropyPair_enclosed CA3_5_8I1R9Value CA3_5_8I1R9Terms CA3_5_8I1R9Terms_sound) (by decide +kernel) +def CA3_5_8I1R9Mass : Ball := ⟨0, 0⟩ +lemma CA3_5_8I1R9Mass_sound : CA3_5_8I1R9Mass.Encloses (∑ a, CA3_5_8I1R9Value a) := by + exact contains_sound (pairSumBall_sound CA3_5_8I1R9P CA3_5_8I1R9Value CA3_5_8I1R9P_sound) (by decide +kernel) +def CA3_5_8I1R9MassTerm : Ball := .exact 0 +lemma CA3_5_8I1R9MassTerm_sound : CA3_5_8I1R9MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA3_5_8I1R9Value a))) := + entropyTerm_zero_ball (CA3_5_8I1R9Mass_sound) +def CA3_5_8I1R9H : Ball := ⟨0, 0⟩ +lemma CA3_5_8I1R9H_sound : CA3_5_8I1R9H.Encloses (homogeneousEntropy CA3_5_8I1R9Value) := by + exact contains_sound (homogeneous_enclosed CA3_5_8I1R9Value CA3_5_8I1R9MassTerm_sound CA3_5_8I1R9Entropy_sound) (by decide +kernel) +def CA3_5_8I1R10Value (a : PairSlot) : ℝ := residualLaw (below (shape 3 5 8)) (fun u => (stageALaw (shape 3 5 8) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 10 a +def CA3_5_8I1R10Raw (a : PairSlot) : Ball := residualBall (below (shape 3 5 8)) A3_5_8Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 10 a +lemma CA3_5_8I1R10Raw_sound (a : PairSlot) : + (CA3_5_8I1R10Raw a).Encloses (CA3_5_8I1R10Value a) := by + exact residualBall_sound_on (below (shape 3 5 8)) A3_5_8Law (fun u => (stageALaw (shape 3 5 8) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A3_5_8Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 3 5 8) (show (shape 3 5 8) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 10 a +def CA3_5_8I1R10Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA3_5_8I1R10Certificates_valid : + CA3_5_8I1R10Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA3_5_8I1R10CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA3_5_8I1R10P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_5_8I1R10Certificates (CA3_5_8I1R10CertificateIndex a)).input +lemma CA3_5_8I1R10P_check : ∀ a : PairSlot, contains (CA3_5_8I1R10Raw a) (CA3_5_8I1R10P a) = true := by + decide +kernel +lemma CA3_5_8I1R10P_sound (a : PairSlot) : + (CA3_5_8I1R10P a).Encloses (CA3_5_8I1R10Value a) := + contains_sound (CA3_5_8I1R10Raw_sound a) (CA3_5_8I1R10P_check a) +def CA3_5_8I1R10Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_5_8I1R10Certificates (CA3_5_8I1R10CertificateIndex a)).output +lemma CA3_5_8I1R10Terms_sound (a : PairSlot) : + (CA3_5_8I1R10Terms a).Encloses (Foundation.entropyTerm (CA3_5_8I1R10Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA3_5_8I1R10Certificates_valid + (CA3_5_8I1R10CertificateIndex a) (CA3_5_8I1R10P_sound a) +def CA3_5_8I1R10Entropy : Ball := ⟨0, 0⟩ +lemma CA3_5_8I1R10Entropy_sound : CA3_5_8I1R10Entropy.Encloses (Foundation.finiteEntropy CA3_5_8I1R10Value) := by + exact contains_sound (entropyPair_enclosed CA3_5_8I1R10Value CA3_5_8I1R10Terms CA3_5_8I1R10Terms_sound) (by decide +kernel) +def CA3_5_8I1R10Mass : Ball := ⟨0, 0⟩ +lemma CA3_5_8I1R10Mass_sound : CA3_5_8I1R10Mass.Encloses (∑ a, CA3_5_8I1R10Value a) := by + exact contains_sound (pairSumBall_sound CA3_5_8I1R10P CA3_5_8I1R10Value CA3_5_8I1R10P_sound) (by decide +kernel) +def CA3_5_8I1R10MassTerm : Ball := .exact 0 +lemma CA3_5_8I1R10MassTerm_sound : CA3_5_8I1R10MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA3_5_8I1R10Value a))) := + entropyTerm_zero_ball (CA3_5_8I1R10Mass_sound) +def CA3_5_8I1R10H : Ball := ⟨0, 0⟩ +lemma CA3_5_8I1R10H_sound : CA3_5_8I1R10H.Encloses (homogeneousEntropy CA3_5_8I1R10Value) := by + exact contains_sound (homogeneous_enclosed CA3_5_8I1R10Value CA3_5_8I1R10MassTerm_sound CA3_5_8I1R10Entropy_sound) (by decide +kernel) +def CA3_5_8I1R11Value (a : PairSlot) : ℝ := residualLaw (below (shape 3 5 8)) (fun u => (stageALaw (shape 3 5 8) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 11 a +def CA3_5_8I1R11Raw (a : PairSlot) : Ball := residualBall (below (shape 3 5 8)) A3_5_8Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 11 a +lemma CA3_5_8I1R11Raw_sound (a : PairSlot) : + (CA3_5_8I1R11Raw a).Encloses (CA3_5_8I1R11Value a) := by + exact residualBall_sound_on (below (shape 3 5 8)) A3_5_8Law (fun u => (stageALaw (shape 3 5 8) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A3_5_8Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 3 5 8) (show (shape 3 5 8) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 11 a +def CA3_5_8I1R11Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA3_5_8I1R11Certificates_valid : + CA3_5_8I1R11Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA3_5_8I1R11CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA3_5_8I1R11P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_5_8I1R11Certificates (CA3_5_8I1R11CertificateIndex a)).input +lemma CA3_5_8I1R11P_check : ∀ a : PairSlot, contains (CA3_5_8I1R11Raw a) (CA3_5_8I1R11P a) = true := by + decide +kernel +lemma CA3_5_8I1R11P_sound (a : PairSlot) : + (CA3_5_8I1R11P a).Encloses (CA3_5_8I1R11Value a) := + contains_sound (CA3_5_8I1R11Raw_sound a) (CA3_5_8I1R11P_check a) +def CA3_5_8I1R11Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_5_8I1R11Certificates (CA3_5_8I1R11CertificateIndex a)).output +lemma CA3_5_8I1R11Terms_sound (a : PairSlot) : + (CA3_5_8I1R11Terms a).Encloses (Foundation.entropyTerm (CA3_5_8I1R11Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA3_5_8I1R11Certificates_valid + (CA3_5_8I1R11CertificateIndex a) (CA3_5_8I1R11P_sound a) +def CA3_5_8I1R11Entropy : Ball := ⟨0, 0⟩ +lemma CA3_5_8I1R11Entropy_sound : CA3_5_8I1R11Entropy.Encloses (Foundation.finiteEntropy CA3_5_8I1R11Value) := by + exact contains_sound (entropyPair_enclosed CA3_5_8I1R11Value CA3_5_8I1R11Terms CA3_5_8I1R11Terms_sound) (by decide +kernel) +def CA3_5_8I1R11Mass : Ball := ⟨0, 0⟩ +lemma CA3_5_8I1R11Mass_sound : CA3_5_8I1R11Mass.Encloses (∑ a, CA3_5_8I1R11Value a) := by + exact contains_sound (pairSumBall_sound CA3_5_8I1R11P CA3_5_8I1R11Value CA3_5_8I1R11P_sound) (by decide +kernel) +def CA3_5_8I1R11MassTerm : Ball := .exact 0 +lemma CA3_5_8I1R11MassTerm_sound : CA3_5_8I1R11MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA3_5_8I1R11Value a))) := + entropyTerm_zero_ball (CA3_5_8I1R11Mass_sound) +def CA3_5_8I1R11H : Ball := ⟨0, 0⟩ +lemma CA3_5_8I1R11H_sound : CA3_5_8I1R11H.Encloses (homogeneousEntropy CA3_5_8I1R11Value) := by + exact contains_sound (homogeneous_enclosed CA3_5_8I1R11Value CA3_5_8I1R11MassTerm_sound CA3_5_8I1R11Entropy_sound) (by decide +kernel) +def CA3_5_8I1R12Value (a : PairSlot) : ℝ := residualLaw (below (shape 3 5 8)) (fun u => (stageALaw (shape 3 5 8) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 12 a +def CA3_5_8I1R12Raw (a : PairSlot) : Ball := residualBall (below (shape 3 5 8)) A3_5_8Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 12 a +lemma CA3_5_8I1R12Raw_sound (a : PairSlot) : + (CA3_5_8I1R12Raw a).Encloses (CA3_5_8I1R12Value a) := by + exact residualBall_sound_on (below (shape 3 5 8)) A3_5_8Law (fun u => (stageALaw (shape 3 5 8) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A3_5_8Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 3 5 8) (show (shape 3 5 8) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 12 a +def CA3_5_8I1R12Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA3_5_8I1R12Certificates_valid : + CA3_5_8I1R12Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA3_5_8I1R12CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA3_5_8I1R12P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_5_8I1R12Certificates (CA3_5_8I1R12CertificateIndex a)).input +lemma CA3_5_8I1R12P_check : ∀ a : PairSlot, contains (CA3_5_8I1R12Raw a) (CA3_5_8I1R12P a) = true := by + decide +kernel +lemma CA3_5_8I1R12P_sound (a : PairSlot) : + (CA3_5_8I1R12P a).Encloses (CA3_5_8I1R12Value a) := + contains_sound (CA3_5_8I1R12Raw_sound a) (CA3_5_8I1R12P_check a) +def CA3_5_8I1R12Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_5_8I1R12Certificates (CA3_5_8I1R12CertificateIndex a)).output +lemma CA3_5_8I1R12Terms_sound (a : PairSlot) : + (CA3_5_8I1R12Terms a).Encloses (Foundation.entropyTerm (CA3_5_8I1R12Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA3_5_8I1R12Certificates_valid + (CA3_5_8I1R12CertificateIndex a) (CA3_5_8I1R12P_sound a) +def CA3_5_8I1R12Entropy : Ball := ⟨0, 0⟩ +lemma CA3_5_8I1R12Entropy_sound : CA3_5_8I1R12Entropy.Encloses (Foundation.finiteEntropy CA3_5_8I1R12Value) := by + exact contains_sound (entropyPair_enclosed CA3_5_8I1R12Value CA3_5_8I1R12Terms CA3_5_8I1R12Terms_sound) (by decide +kernel) +def CA3_5_8I1R12Mass : Ball := ⟨0, 0⟩ +lemma CA3_5_8I1R12Mass_sound : CA3_5_8I1R12Mass.Encloses (∑ a, CA3_5_8I1R12Value a) := by + exact contains_sound (pairSumBall_sound CA3_5_8I1R12P CA3_5_8I1R12Value CA3_5_8I1R12P_sound) (by decide +kernel) +def CA3_5_8I1R12MassTerm : Ball := .exact 0 +lemma CA3_5_8I1R12MassTerm_sound : CA3_5_8I1R12MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA3_5_8I1R12Value a))) := + entropyTerm_zero_ball (CA3_5_8I1R12Mass_sound) +def CA3_5_8I1R12H : Ball := ⟨0, 0⟩ +lemma CA3_5_8I1R12H_sound : CA3_5_8I1R12H.Encloses (homogeneousEntropy CA3_5_8I1R12Value) := by + exact contains_sound (homogeneous_enclosed CA3_5_8I1R12Value CA3_5_8I1R12MassTerm_sound CA3_5_8I1R12Entropy_sound) (by decide +kernel) +def CA3_5_8I1R13Value (a : PairSlot) : ℝ := residualLaw (below (shape 3 5 8)) (fun u => (stageALaw (shape 3 5 8) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 13 a +def CA3_5_8I1R13Raw (a : PairSlot) : Ball := residualBall (below (shape 3 5 8)) A3_5_8Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 13 a +lemma CA3_5_8I1R13Raw_sound (a : PairSlot) : + (CA3_5_8I1R13Raw a).Encloses (CA3_5_8I1R13Value a) := by + exact residualBall_sound_on (below (shape 3 5 8)) A3_5_8Law (fun u => (stageALaw (shape 3 5 8) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A3_5_8Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 3 5 8) (show (shape 3 5 8) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 13 a +def CA3_5_8I1R13Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA3_5_8I1R13Certificates_valid : + CA3_5_8I1R13Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA3_5_8I1R13CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA3_5_8I1R13P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_5_8I1R13Certificates (CA3_5_8I1R13CertificateIndex a)).input +lemma CA3_5_8I1R13P_check : ∀ a : PairSlot, contains (CA3_5_8I1R13Raw a) (CA3_5_8I1R13P a) = true := by + decide +kernel +lemma CA3_5_8I1R13P_sound (a : PairSlot) : + (CA3_5_8I1R13P a).Encloses (CA3_5_8I1R13Value a) := + contains_sound (CA3_5_8I1R13Raw_sound a) (CA3_5_8I1R13P_check a) +def CA3_5_8I1R13Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_5_8I1R13Certificates (CA3_5_8I1R13CertificateIndex a)).output +lemma CA3_5_8I1R13Terms_sound (a : PairSlot) : + (CA3_5_8I1R13Terms a).Encloses (Foundation.entropyTerm (CA3_5_8I1R13Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA3_5_8I1R13Certificates_valid + (CA3_5_8I1R13CertificateIndex a) (CA3_5_8I1R13P_sound a) +def CA3_5_8I1R13Entropy : Ball := ⟨0, 0⟩ +lemma CA3_5_8I1R13Entropy_sound : CA3_5_8I1R13Entropy.Encloses (Foundation.finiteEntropy CA3_5_8I1R13Value) := by + exact contains_sound (entropyPair_enclosed CA3_5_8I1R13Value CA3_5_8I1R13Terms CA3_5_8I1R13Terms_sound) (by decide +kernel) +def CA3_5_8I1R13Mass : Ball := ⟨0, 0⟩ +lemma CA3_5_8I1R13Mass_sound : CA3_5_8I1R13Mass.Encloses (∑ a, CA3_5_8I1R13Value a) := by + exact contains_sound (pairSumBall_sound CA3_5_8I1R13P CA3_5_8I1R13Value CA3_5_8I1R13P_sound) (by decide +kernel) +def CA3_5_8I1R13MassTerm : Ball := .exact 0 +lemma CA3_5_8I1R13MassTerm_sound : CA3_5_8I1R13MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA3_5_8I1R13Value a))) := + entropyTerm_zero_ball (CA3_5_8I1R13Mass_sound) +def CA3_5_8I1R13H : Ball := ⟨0, 0⟩ +lemma CA3_5_8I1R13H_sound : CA3_5_8I1R13H.Encloses (homogeneousEntropy CA3_5_8I1R13Value) := by + exact contains_sound (homogeneous_enclosed CA3_5_8I1R13Value CA3_5_8I1R13MassTerm_sound CA3_5_8I1R13Entropy_sound) (by decide +kernel) +def CA3_5_8I1R14Value (a : PairSlot) : ℝ := residualLaw (below (shape 3 5 8)) (fun u => (stageALaw (shape 3 5 8) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 14 a +def CA3_5_8I1R14Raw (a : PairSlot) : Ball := residualBall (below (shape 3 5 8)) A3_5_8Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 14 a +lemma CA3_5_8I1R14Raw_sound (a : PairSlot) : + (CA3_5_8I1R14Raw a).Encloses (CA3_5_8I1R14Value a) := by + exact residualBall_sound_on (below (shape 3 5 8)) A3_5_8Law (fun u => (stageALaw (shape 3 5 8) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A3_5_8Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 3 5 8) (show (shape 3 5 8) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 14 a +def CA3_5_8I1R14Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA3_5_8I1R14Certificates_valid : + CA3_5_8I1R14Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA3_5_8I1R14CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA3_5_8I1R14P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_5_8I1R14Certificates (CA3_5_8I1R14CertificateIndex a)).input +lemma CA3_5_8I1R14P_check : ∀ a : PairSlot, contains (CA3_5_8I1R14Raw a) (CA3_5_8I1R14P a) = true := by + decide +kernel +lemma CA3_5_8I1R14P_sound (a : PairSlot) : + (CA3_5_8I1R14P a).Encloses (CA3_5_8I1R14Value a) := + contains_sound (CA3_5_8I1R14Raw_sound a) (CA3_5_8I1R14P_check a) +def CA3_5_8I1R14Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_5_8I1R14Certificates (CA3_5_8I1R14CertificateIndex a)).output +lemma CA3_5_8I1R14Terms_sound (a : PairSlot) : + (CA3_5_8I1R14Terms a).Encloses (Foundation.entropyTerm (CA3_5_8I1R14Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA3_5_8I1R14Certificates_valid + (CA3_5_8I1R14CertificateIndex a) (CA3_5_8I1R14P_sound a) +def CA3_5_8I1R14Entropy : Ball := ⟨0, 0⟩ +lemma CA3_5_8I1R14Entropy_sound : CA3_5_8I1R14Entropy.Encloses (Foundation.finiteEntropy CA3_5_8I1R14Value) := by + exact contains_sound (entropyPair_enclosed CA3_5_8I1R14Value CA3_5_8I1R14Terms CA3_5_8I1R14Terms_sound) (by decide +kernel) +def CA3_5_8I1R14Mass : Ball := ⟨0, 0⟩ +lemma CA3_5_8I1R14Mass_sound : CA3_5_8I1R14Mass.Encloses (∑ a, CA3_5_8I1R14Value a) := by + exact contains_sound (pairSumBall_sound CA3_5_8I1R14P CA3_5_8I1R14Value CA3_5_8I1R14P_sound) (by decide +kernel) +def CA3_5_8I1R14MassTerm : Ball := .exact 0 +lemma CA3_5_8I1R14MassTerm_sound : CA3_5_8I1R14MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA3_5_8I1R14Value a))) := + entropyTerm_zero_ball (CA3_5_8I1R14Mass_sound) +def CA3_5_8I1R14H : Ball := ⟨0, 0⟩ +lemma CA3_5_8I1R14H_sound : CA3_5_8I1R14H.Encloses (homogeneousEntropy CA3_5_8I1R14Value) := by + exact contains_sound (homogeneous_enclosed CA3_5_8I1R14Value CA3_5_8I1R14MassTerm_sound CA3_5_8I1R14Entropy_sound) (by decide +kernel) +def CA3_5_8I1R15Value (a : PairSlot) : ℝ := residualLaw (below (shape 3 5 8)) (fun u => (stageALaw (shape 3 5 8) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 15 a +def CA3_5_8I1R15Raw (a : PairSlot) : Ball := residualBall (below (shape 3 5 8)) A3_5_8Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 15 a +lemma CA3_5_8I1R15Raw_sound (a : PairSlot) : + (CA3_5_8I1R15Raw a).Encloses (CA3_5_8I1R15Value a) := by + exact residualBall_sound_on (below (shape 3 5 8)) A3_5_8Law (fun u => (stageALaw (shape 3 5 8) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A3_5_8Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 3 5 8) (show (shape 3 5 8) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 15 a +def CA3_5_8I1R15Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA3_5_8I1R15Certificates_valid : + CA3_5_8I1R15Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA3_5_8I1R15CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA3_5_8I1R15P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_5_8I1R15Certificates (CA3_5_8I1R15CertificateIndex a)).input +lemma CA3_5_8I1R15P_check : ∀ a : PairSlot, contains (CA3_5_8I1R15Raw a) (CA3_5_8I1R15P a) = true := by + decide +kernel +lemma CA3_5_8I1R15P_sound (a : PairSlot) : + (CA3_5_8I1R15P a).Encloses (CA3_5_8I1R15Value a) := + contains_sound (CA3_5_8I1R15Raw_sound a) (CA3_5_8I1R15P_check a) +def CA3_5_8I1R15Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_5_8I1R15Certificates (CA3_5_8I1R15CertificateIndex a)).output +lemma CA3_5_8I1R15Terms_sound (a : PairSlot) : + (CA3_5_8I1R15Terms a).Encloses (Foundation.entropyTerm (CA3_5_8I1R15Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA3_5_8I1R15Certificates_valid + (CA3_5_8I1R15CertificateIndex a) (CA3_5_8I1R15P_sound a) +def CA3_5_8I1R15Entropy : Ball := ⟨0, 0⟩ +lemma CA3_5_8I1R15Entropy_sound : CA3_5_8I1R15Entropy.Encloses (Foundation.finiteEntropy CA3_5_8I1R15Value) := by + exact contains_sound (entropyPair_enclosed CA3_5_8I1R15Value CA3_5_8I1R15Terms CA3_5_8I1R15Terms_sound) (by decide +kernel) +def CA3_5_8I1R15Mass : Ball := ⟨0, 0⟩ +lemma CA3_5_8I1R15Mass_sound : CA3_5_8I1R15Mass.Encloses (∑ a, CA3_5_8I1R15Value a) := by + exact contains_sound (pairSumBall_sound CA3_5_8I1R15P CA3_5_8I1R15Value CA3_5_8I1R15P_sound) (by decide +kernel) +def CA3_5_8I1R15MassTerm : Ball := .exact 0 +lemma CA3_5_8I1R15MassTerm_sound : CA3_5_8I1R15MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA3_5_8I1R15Value a))) := + entropyTerm_zero_ball (CA3_5_8I1R15Mass_sound) +def CA3_5_8I1R15H : Ball := ⟨0, 0⟩ +lemma CA3_5_8I1R15H_sound : CA3_5_8I1R15H.Encloses (homogeneousEntropy CA3_5_8I1R15Value) := by + exact contains_sound (homogeneous_enclosed CA3_5_8I1R15Value CA3_5_8I1R15MassTerm_sound CA3_5_8I1R15Entropy_sound) (by decide +kernel) +def CA3_5_8I1R16Value (a : PairSlot) : ℝ := residualLaw (below (shape 3 5 8)) (fun u => (stageALaw (shape 3 5 8) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 16 a +def CA3_5_8I1R16Raw (a : PairSlot) : Ball := residualBall (below (shape 3 5 8)) A3_5_8Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 16 a +lemma CA3_5_8I1R16Raw_sound (a : PairSlot) : + (CA3_5_8I1R16Raw a).Encloses (CA3_5_8I1R16Value a) := by + exact residualBall_sound_on (below (shape 3 5 8)) A3_5_8Law (fun u => (stageALaw (shape 3 5 8) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A3_5_8Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 3 5 8) (show (shape 3 5 8) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 16 a +def CA3_5_8I1R16Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA3_5_8I1R16Certificates_valid : + CA3_5_8I1R16Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA3_5_8I1R16CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA3_5_8I1R16P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_5_8I1R16Certificates (CA3_5_8I1R16CertificateIndex a)).input +lemma CA3_5_8I1R16P_check : ∀ a : PairSlot, contains (CA3_5_8I1R16Raw a) (CA3_5_8I1R16P a) = true := by + decide +kernel +lemma CA3_5_8I1R16P_sound (a : PairSlot) : + (CA3_5_8I1R16P a).Encloses (CA3_5_8I1R16Value a) := + contains_sound (CA3_5_8I1R16Raw_sound a) (CA3_5_8I1R16P_check a) +def CA3_5_8I1R16Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_5_8I1R16Certificates (CA3_5_8I1R16CertificateIndex a)).output +lemma CA3_5_8I1R16Terms_sound (a : PairSlot) : + (CA3_5_8I1R16Terms a).Encloses (Foundation.entropyTerm (CA3_5_8I1R16Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA3_5_8I1R16Certificates_valid + (CA3_5_8I1R16CertificateIndex a) (CA3_5_8I1R16P_sound a) +def CA3_5_8I1R16Entropy : Ball := ⟨0, 0⟩ +lemma CA3_5_8I1R16Entropy_sound : CA3_5_8I1R16Entropy.Encloses (Foundation.finiteEntropy CA3_5_8I1R16Value) := by + exact contains_sound (entropyPair_enclosed CA3_5_8I1R16Value CA3_5_8I1R16Terms CA3_5_8I1R16Terms_sound) (by decide +kernel) +def CA3_5_8I1R16Mass : Ball := ⟨0, 0⟩ +lemma CA3_5_8I1R16Mass_sound : CA3_5_8I1R16Mass.Encloses (∑ a, CA3_5_8I1R16Value a) := by + exact contains_sound (pairSumBall_sound CA3_5_8I1R16P CA3_5_8I1R16Value CA3_5_8I1R16P_sound) (by decide +kernel) +def CA3_5_8I1R16MassTerm : Ball := .exact 0 +lemma CA3_5_8I1R16MassTerm_sound : CA3_5_8I1R16MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA3_5_8I1R16Value a))) := + entropyTerm_zero_ball (CA3_5_8I1R16Mass_sound) +def CA3_5_8I1R16H : Ball := ⟨0, 0⟩ +lemma CA3_5_8I1R16H_sound : CA3_5_8I1R16H.Encloses (homogeneousEntropy CA3_5_8I1R16Value) := by + exact contains_sound (homogeneous_enclosed CA3_5_8I1R16Value CA3_5_8I1R16MassTerm_sound CA3_5_8I1R16Entropy_sound) (by decide +kernel) +def CA3_5_8I1ResidualEntropies (a : Fin 17) : Ball := + match a.val with + | 0 => CA3_5_8I1R0H + | 1 => CA3_5_8I1R1H + | 2 => CA3_5_8I1R2H + | 3 => CA3_5_8I1R3H + | 4 => CA3_5_8I1R4H + | 5 => CA3_5_8I1R5H + | 6 => CA3_5_8I1R6H + | 7 => CA3_5_8I1R7H + | 8 => CA3_5_8I1R8H + | 9 => CA3_5_8I1R9H + | 10 => CA3_5_8I1R10H + | 11 => CA3_5_8I1R11H + | 12 => CA3_5_8I1R12H + | 13 => CA3_5_8I1R13H + | 14 => CA3_5_8I1R14H + | 15 => CA3_5_8I1R15H + | 16 => CA3_5_8I1R16H + | _ => (.exact 0) +lemma CA3_5_8I1ResidualEntropies_sound (k : Fin 17) : + (CA3_5_8I1ResidualEntropies k).Encloses (homogeneousEntropy + (residualLaw (below (shape 3 5 8)) (fun u => (stageALaw (shape 3 5 8) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) k)) := by + fin_cases k + · exact CA3_5_8I1R0H_sound + · exact CA3_5_8I1R1H_sound + · exact CA3_5_8I1R2H_sound + · exact CA3_5_8I1R3H_sound + · exact CA3_5_8I1R4H_sound + · exact CA3_5_8I1R5H_sound + · exact CA3_5_8I1R6H_sound + · exact CA3_5_8I1R7H_sound + · exact CA3_5_8I1R8H_sound + · exact CA3_5_8I1R9H_sound + · exact CA3_5_8I1R10H_sound + · exact CA3_5_8I1R11H_sound + · exact CA3_5_8I1R12H_sound + · exact CA3_5_8I1R13H_sound + · exact CA3_5_8I1R14H_sound + · exact CA3_5_8I1R15H_sound + · exact CA3_5_8I1R16H_sound +def CA3_5_8I1Singles (s : Shape) : Ball := + match s 0, s 1, s 2 with + | 3, 5, 0 => Z3_5_0H1H + | _, _, _ => (.exact 0) +lemma CA3_5_8I1Singles_sound (u : Shape) (hu : u ∈ below (shape 3 5 8)) + (hd : designated (Equiv.refl (Fin 3)) 1 u) : + (CA3_5_8I1Singles u).Encloses (homogeneousEntropy ((fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) u)) := by + rw [A3_5_8_below] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 0 0 8) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 0 1 7) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 0 2 6) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 0 3 5) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 0 4 4) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 0 5 3) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 1 0 7) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 1 1 6) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 1 2 5) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 1 3 4) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 1 4 3) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 1 5 2) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 2 0 6) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 2 1 5) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 2 2 4) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 2 3 3) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 2 4 2) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 2 5 1) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 3 0 5) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 3 1 4) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 3 2 3) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 3 3 2) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 3 4 1) by decide +kernel) hd |>.elim + · exact Z3_5_0H1H_sound +def CA3_5_8I1Singleton : Ball := ⟨(1677500010387187021113073 / 25000000000000000000000000000000), (333 / 6250000000000000000000000000000)⟩ +lemma CA3_5_8I1Singleton_sound : CA3_5_8I1Singleton.Encloses + (singletonEntropy (below (shape 3 5 8)) (fun u => (stageALaw (shape 3 5 8) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ))) := by + exact contains_sound (singletonBall_sound (below (shape 3 5 8)) A3_5_8Law (fun u => (stageALaw (shape 3 5 8) u : ℝ)) (Equiv.refl (Fin 3)) 1 + CA3_5_8I1Singles (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A3_5_8Law_sound u) CA3_5_8I1Singles_sound) (by decide +kernel) +def CA3_5_8I1Group : Ball := ⟨(102984892185781541805278521000961 / 100000000000000000000000000000000), (3358280671 / 2000000000000000000000000000000)⟩ +lemma CA3_5_8I1Group_sound : CA3_5_8I1Group.Encloses + (groupedEntropy (below (shape 3 5 8)) (fun u => (stageALaw (shape 3 5 8) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ))) := by + exact contains_sound (Ball.add_sound CA3_5_8I1Singleton_sound + (finSumBall_sound 17 CA3_5_8I1ResidualEntropies _ CA3_5_8I1ResidualEntropies_sound)) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CA3_5_8I1H : Ball := ⟨(118328426959816533655955229798811 / 100000000000000000000000000000000), (515993841763 / 100000000000000000000000000000000)⟩ +lemma CA3_5_8I1_sound : CA3_5_8I1H.Encloses (stageACapacity (shape 3 5 8) 1) := by + have hb := contains_sound (Ball.add_sound CA3_5_8I1PairH_sound + (Ball.neg_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) CA3_5_8I1Group_sound))) + (show contains (.add CA3_5_8I1PairH (.neg (.mul (.exact 2) CA3_5_8I1Group))) CA3_5_8I1H = true by decide +kernel) + unfold CA3_5_8I1PairValue at hb + simpa only [stageACapacity, nativeCapacity, + show (1 : Fin 3) ≠ 0 by decide, ite_false, sub_eq_add_neg] using hb + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA3_5_8I2.lean b/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA3_5_8I2.lean new file mode 100644 index 0000000000000000000000000000000000000000..fd0be8c16b75cf9fade70b9456cf25334ccae7c1 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA3_5_8I2.lean @@ -0,0 +1,867 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.CapacityA.CapA3_5_8I2Pair + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CA3_5_8I2R0Value (a : PairSlot) : ℝ := residualLaw (below (shape 3 5 8)) (fun u => (stageALaw (shape 3 5 8) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 0 a +def CA3_5_8I2R0Raw (a : PairSlot) : Ball := residualBall (below (shape 3 5 8)) A3_5_8Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 0 a +lemma CA3_5_8I2R0Raw_sound (a : PairSlot) : + (CA3_5_8I2R0Raw a).Encloses (CA3_5_8I2R0Value a) := by + exact residualBall_sound_on (below (shape 3 5 8)) A3_5_8Law (fun u => (stageALaw (shape 3 5 8) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A3_5_8Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 3 5 8) (show (shape 3 5 8) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 0 a +def CA3_5_8I2R0Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(5617321274602978972531421 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(11722525042486881302899449 / 12500000000000000000000000000000), (15473 / 50000000000000000000000000000000)⟩ ⟨(-834741291760308362723103481718601 / 50000000000000000000000000000000), (550589217837 / 100000000000000000000000000000000)⟩ ⟨-25, 5617321274602978972531421, 2980232238769531250000000⟩] +lemma CA3_5_8I2R0Certificates_valid : + CA3_5_8I2R0Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA3_5_8I2R0CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 0, 0 => 1 + | _, _ => 0 +def CA3_5_8I2R0P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_5_8I2R0Certificates (CA3_5_8I2R0CertificateIndex a)).input +lemma CA3_5_8I2R0P_check : ∀ a : PairSlot, contains (CA3_5_8I2R0Raw a) (CA3_5_8I2R0P a) = true := by + decide +kernel +lemma CA3_5_8I2R0P_sound (a : PairSlot) : + (CA3_5_8I2R0P a).Encloses (CA3_5_8I2R0Value a) := + contains_sound (CA3_5_8I2R0Raw_sound a) (CA3_5_8I2R0P_check a) +def CA3_5_8I2R0Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_5_8I2R0Certificates (CA3_5_8I2R0CertificateIndex a)).output +lemma CA3_5_8I2R0Terms_sound (a : PairSlot) : + (CA3_5_8I2R0Terms a).Encloses (Foundation.entropyTerm (CA3_5_8I2R0Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA3_5_8I2R0Certificates_valid + (CA3_5_8I2R0CertificateIndex a) (CA3_5_8I2R0P_sound a) +def CA3_5_8I2R0Entropy : Ball := ⟨(11722525042486881302899449 / 12500000000000000000000000000000), (15473 / 50000000000000000000000000000000)⟩ +lemma CA3_5_8I2R0Entropy_sound : CA3_5_8I2R0Entropy.Encloses (Foundation.finiteEntropy CA3_5_8I2R0Value) := by + exact contains_sound (entropyPair_enclosed CA3_5_8I2R0Value CA3_5_8I2R0Terms CA3_5_8I2R0Terms_sound) (by decide +kernel) +def CA3_5_8I2R0Mass : Ball := ⟨(5617321274602978972531421 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ +lemma CA3_5_8I2R0Mass_sound : CA3_5_8I2R0Mass.Encloses (∑ a, CA3_5_8I2R0Value a) := by + exact contains_sound (pairSumBall_sound CA3_5_8I2R0P CA3_5_8I2R0Value CA3_5_8I2R0P_sound) (by decide +kernel) +def CA3_5_8I2R0MassTermLogWitness : LogWitness := ⟨-25, 5617321274602978972531421, 2980232238769531250000000⟩ +def CA3_5_8I2R0MassTermLog : Ball := ⟨(-834741291760308362723103481718601 / 50000000000000000000000000000000), (550589217837 / 100000000000000000000000000000000)⟩ +lemma CA3_5_8I2R0MassTermLog_sound : CA3_5_8I2R0MassTermLog.Encloses (Real.log ((∑ a, CA3_5_8I2R0Value a))) := by + exact checkLog_sound logTwoBall_sound (CA3_5_8I2R0Mass_sound) (w := CA3_5_8I2R0MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA3_5_8I2R0MassTerm : Ball := ⟨(11722525042486881302899449 / 12500000000000000000000000000000), (15473 / 50000000000000000000000000000000)⟩ +lemma CA3_5_8I2R0MassTerm_sound : CA3_5_8I2R0MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA3_5_8I2R0Value a))) := by + exact contains_sound (entropyTerm_ball (CA3_5_8I2R0Mass_sound) CA3_5_8I2R0MassTermLog_sound) (by decide +kernel) +def CA3_5_8I2R0H : Ball := ⟨0, (15473 / 25000000000000000000000000000000)⟩ +lemma CA3_5_8I2R0H_sound : CA3_5_8I2R0H.Encloses (homogeneousEntropy CA3_5_8I2R0Value) := by + exact contains_sound (homogeneous_enclosed CA3_5_8I2R0Value CA3_5_8I2R0MassTerm_sound CA3_5_8I2R0Entropy_sound) (by decide +kernel) +def CA3_5_8I2R1Value (a : PairSlot) : ℝ := residualLaw (below (shape 3 5 8)) (fun u => (stageALaw (shape 3 5 8) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 1 a +def CA3_5_8I2R1Raw (a : PairSlot) : Ball := residualBall (below (shape 3 5 8)) A3_5_8Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 1 a +lemma CA3_5_8I2R1Raw_sound (a : PairSlot) : + (CA3_5_8I2R1Raw a).Encloses (CA3_5_8I2R1Value a) := by + exact residualBall_sound_on (below (shape 3 5 8)) A3_5_8Law (fun u => (stageALaw (shape 3 5 8) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A3_5_8Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 3 5 8) (show (shape 3 5 8) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 1 a +def CA3_5_8I2R1Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(819643483877255325795700097 / 25000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ ⟨(33852970621212845371812639747 / 100000000000000000000000000000000), (1388533 / 12500000000000000000000000000000)⟩ ⟨(-516275845643800271607790499417917 / 50000000000000000000000000000000), (338813239929 / 100000000000000000000000000000000)⟩ ⟨-15, 819643483877255325795700097, 762939453125000000000000000⟩] +lemma CA3_5_8I2R1Certificates_valid : + CA3_5_8I2R1Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA3_5_8I2R1CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 1, 0 => 1 + | 0, 1 => 1 + | _, _ => 0 +def CA3_5_8I2R1P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_5_8I2R1Certificates (CA3_5_8I2R1CertificateIndex a)).input +lemma CA3_5_8I2R1P_check : ∀ a : PairSlot, contains (CA3_5_8I2R1Raw a) (CA3_5_8I2R1P a) = true := by + decide +kernel +lemma CA3_5_8I2R1P_sound (a : PairSlot) : + (CA3_5_8I2R1P a).Encloses (CA3_5_8I2R1Value a) := + contains_sound (CA3_5_8I2R1Raw_sound a) (CA3_5_8I2R1P_check a) +def CA3_5_8I2R1Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_5_8I2R1Certificates (CA3_5_8I2R1CertificateIndex a)).output +lemma CA3_5_8I2R1Terms_sound (a : PairSlot) : + (CA3_5_8I2R1Terms a).Encloses (Foundation.entropyTerm (CA3_5_8I2R1Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA3_5_8I2R1Certificates_valid + (CA3_5_8I2R1CertificateIndex a) (CA3_5_8I2R1P_sound a) +def CA3_5_8I2R1Entropy : Ball := ⟨(33852970621212845371812639747 / 50000000000000000000000000000000), (1388533 / 6250000000000000000000000000000)⟩ +lemma CA3_5_8I2R1Entropy_sound : CA3_5_8I2R1Entropy.Encloses (Foundation.finiteEntropy CA3_5_8I2R1Value) := by + exact contains_sound (entropyPair_enclosed CA3_5_8I2R1Value CA3_5_8I2R1Terms CA3_5_8I2R1Terms_sound) (by decide +kernel) +def CA3_5_8I2R1Mass : Ball := ⟨(819643483877255325795700097 / 12500000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ +lemma CA3_5_8I2R1Mass_sound : CA3_5_8I2R1Mass.Encloses (∑ a, CA3_5_8I2R1Value a) := by + exact contains_sound (pairSumBall_sound CA3_5_8I2R1P CA3_5_8I2R1Value CA3_5_8I2R1P_sound) (by decide +kernel) +def CA3_5_8I2R1MassTermLogWitness : LogWitness := ⟨-14, 819643483877255325795700097, 762939453125000000000000000⟩ +def CA3_5_8I2R1MassTermLog : Ball := ⟨(-30101155413487687883558056430797 / 3125000000000000000000000000000), (158818708123 / 50000000000000000000000000000000)⟩ +lemma CA3_5_8I2R1MassTermLog_sound : CA3_5_8I2R1MassTermLog.Encloses (Real.log ((∑ a, CA3_5_8I2R1Value a))) := by + exact checkLog_sound logTwoBall_sound (CA3_5_8I2R1Mass_sound) (w := CA3_5_8I2R1MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA3_5_8I2R1MassTerm : Ball := ⟨(63160872683114886588371371791 / 100000000000000000000000000000000), (10413997 / 50000000000000000000000000000000)⟩ +lemma CA3_5_8I2R1MassTerm_sound : CA3_5_8I2R1MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA3_5_8I2R1Value a))) := by + exact contains_sound (entropyTerm_ball (CA3_5_8I2R1Mass_sound) CA3_5_8I2R1MassTermLog_sound) (by decide +kernel) +def CA3_5_8I2R1H : Ball := ⟨(4545068559310804155253907703 / 100000000000000000000000000000000), (21522261 / 50000000000000000000000000000000)⟩ +lemma CA3_5_8I2R1H_sound : CA3_5_8I2R1H.Encloses (homogeneousEntropy CA3_5_8I2R1Value) := by + exact contains_sound (homogeneous_enclosed CA3_5_8I2R1Value CA3_5_8I2R1MassTerm_sound CA3_5_8I2R1Entropy_sound) (by decide +kernel) +def CA3_5_8I2R2Value (a : PairSlot) : ℝ := residualLaw (below (shape 3 5 8)) (fun u => (stageALaw (shape 3 5 8) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 2 a +def CA3_5_8I2R2Raw (a : PairSlot) : Ball := residualBall (below (shape 3 5 8)) A3_5_8Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 2 a +lemma CA3_5_8I2R2Raw_sound (a : PairSlot) : + (CA3_5_8I2R2Raw a).Encloses (CA3_5_8I2R2Value a) := by + exact residualBall_sound_on (below (shape 3 5 8)) A3_5_8Law (fun u => (stageALaw (shape 3 5 8) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A3_5_8Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 3 5 8) (show (shape 3 5 8) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 2 a +def CA3_5_8I2R2Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(73061871263674035466020477951 / 50000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ ⟨(953964710580137564315522468887 / 100000000000000000000000000000000), (340371983 / 100000000000000000000000000000000)⟩ ⟨(-6528471650673718944305571000311 / 1000000000000000000000000000000), (232934061881 / 100000000000000000000000000000000)⟩ ⟨-10, 73061871263674035466020477951, 48828125000000000000000000000⟩, + .log ⟨(1336872593667894027129692273 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(48892911551732387697467706271 / 50000000000000000000000000000000), (6794253 / 20000000000000000000000000000000)⟩ ⟨(-11428938653006742649771550946379 / 1250000000000000000000000000000), (63527472919 / 20000000000000000000000000000000)⟩ ⟨-14, 1336872593667894027129692273, 762939453125000000000000000⟩, + .log ⟨(267631277469984174023431040809 / 50000000000000000000000000000000), (1 / 20000000000000000000000000000000)⟩ ⟨(2799513130100671885848869370833 / 100000000000000000000000000000000), (510058163 / 50000000000000000000000000000000)⟩ ⟨(-20920672326235467868866129270777 / 4000000000000000000000000000000), (148892511 / 78125000000000000000000000000)⟩ ⟨-8, 267631277469984174023431040809, 195312500000000000000000000000⟩] +lemma CA3_5_8I2R2Certificates_valid : + CA3_5_8I2R2Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA3_5_8I2R2CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 2, 0 => 1 + | 3, 0 => 2 + | 1, 1 => 3 + | 0, 2 => 1 + | 0, 3 => 2 + | _, _ => 0 +def CA3_5_8I2R2P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_5_8I2R2Certificates (CA3_5_8I2R2CertificateIndex a)).input +lemma CA3_5_8I2R2P_check : ∀ a : PairSlot, contains (CA3_5_8I2R2Raw a) (CA3_5_8I2R2P a) = true := by + decide +kernel +lemma CA3_5_8I2R2P_sound (a : PairSlot) : + (CA3_5_8I2R2P a).Encloses (CA3_5_8I2R2Value a) := + contains_sound (CA3_5_8I2R2Raw_sound a) (CA3_5_8I2R2P_check a) +def CA3_5_8I2R2Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_5_8I2R2Certificates (CA3_5_8I2R2CertificateIndex a)).output +lemma CA3_5_8I2R2Terms_sound (a : PairSlot) : + (CA3_5_8I2R2Terms a).Encloses (Foundation.entropyTerm (CA3_5_8I2R2Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA3_5_8I2R2Certificates_valid + (CA3_5_8I2R2CertificateIndex a) (CA3_5_8I2R2P_sound a) +def CA3_5_8I2R2Entropy : Ball := ⟨(4903014197467876565269785133691 / 100000000000000000000000000000000), (884401411 / 50000000000000000000000000000000)⟩ +lemma CA3_5_8I2R2Entropy_sound : CA3_5_8I2R2Entropy.Encloses (Foundation.finiteEntropy CA3_5_8I2R2Value) := by + exact contains_sound (entropyPair_enclosed CA3_5_8I2R2Value CA3_5_8I2R2Terms CA3_5_8I2R2Terms_sound) (by decide +kernel) +def CA3_5_8I2R2Mass : Ball := ⟨(84890000149335079434501906979 / 10000000000000000000000000000000), (11 / 100000000000000000000000000000000)⟩ +lemma CA3_5_8I2R2Mass_sound : CA3_5_8I2R2Mass.Encloses (∑ a, CA3_5_8I2R2Value a) := by + exact contains_sound (pairSumBall_sound CA3_5_8I2R2P CA3_5_8I2R2Value CA3_5_8I2R2P_sound) (by decide +kernel) +def CA3_5_8I2R2MassTermLogWitness : LogWitness := ⟨-7, 84890000149335079434501906979, 78125000000000000000000000000⟩ +def CA3_5_8I2R2MassTermLog : Ball := ⟨(-238449203473357323046087830923007 / 50000000000000000000000000000000), (169406590759 / 100000000000000000000000000000000)⟩ +lemma CA3_5_8I2R2MassTermLog_sound : CA3_5_8I2R2MassTermLog.Encloses (Real.log ((∑ a, CA3_5_8I2R2Value a))) := by + exact checkLog_sound logTwoBall_sound (CA3_5_8I2R2Mass_sound) (w := CA3_5_8I2R2MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA3_5_8I2R2MassTerm : Ball := ⟨(4048390583692426779033983965233 / 100000000000000000000000000000000), (287618521 / 20000000000000000000000000000000)⟩ +lemma CA3_5_8I2R2MassTerm_sound : CA3_5_8I2R2MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA3_5_8I2R2Value a))) := by + exact contains_sound (entropyTerm_ball (CA3_5_8I2R2Mass_sound) CA3_5_8I2R2MassTermLog_sound) (by decide +kernel) +def CA3_5_8I2R2H : Ball := ⟨(427311806887724893117900584229 / 50000000000000000000000000000000), (3206895427 / 100000000000000000000000000000000)⟩ +lemma CA3_5_8I2R2H_sound : CA3_5_8I2R2H.Encloses (homogeneousEntropy CA3_5_8I2R2Value) := by + exact contains_sound (homogeneous_enclosed CA3_5_8I2R2Value CA3_5_8I2R2MassTerm_sound CA3_5_8I2R2Entropy_sound) (by decide +kernel) +def CA3_5_8I2R3Value (a : PairSlot) : ℝ := residualLaw (below (shape 3 5 8)) (fun u => (stageALaw (shape 3 5 8) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 3 a +def CA3_5_8I2R3Raw (a : PairSlot) : Ball := residualBall (below (shape 3 5 8)) A3_5_8Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 3 a +lemma CA3_5_8I2R3Raw_sound (a : PairSlot) : + (CA3_5_8I2R3Raw a).Encloses (CA3_5_8I2R3Value a) := by + exact residualBall_sound_on (below (shape 3 5 8)) A3_5_8Law (fun u => (stageALaw (shape 3 5 8) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A3_5_8Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 3 5 8) (show (shape 3 5 8) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 3 a +def CA3_5_8I2R3Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(114432923476017216855001848883 / 50000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ ⟨(278291232547230390018297663339 / 20000000000000000000000000000000), (484642297 / 100000000000000000000000000000000)⟩ ⟨(-60797894542464105366859956245389 / 10000000000000000000000000000000), (211758237703 / 100000000000000000000000000000000)⟩ ⟨-9, 114432923476017216855001848883, 97656250000000000000000000000⟩, + .log ⟨(2015811315541798639738563494089 / 25000000000000000000000000000000), (3 / 10000000000000000000000000000000)⟩ ⟨(10151037460539537534979681725353 / 50000000000000000000000000000000), (1707458621 / 20000000000000000000000000000000)⟩ ⟨(-251785407252047241134671699626059 / 100000000000000000000000000000000), (105879118787 / 100000000000000000000000000000000)⟩ ⟨-4, 2015811315541798639738563494089, 1562500000000000000000000000000⟩, + .log ⟨(434457685864110007470395693047 / 100000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ ⟨(472588030698096616469765039973 / 20000000000000000000000000000000), (413999981 / 50000000000000000000000000000000)⟩ ⟨(-543882691082041354570493676746759 / 100000000000000000000000000000000), (190582413837 / 100000000000000000000000000000000)⟩ ⟨-8, 434457685864110007470395693047, 390625000000000000000000000000⟩] +lemma CA3_5_8I2R3Certificates_valid : + CA3_5_8I2R3Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA3_5_8I2R3CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 4, 0 => 1 + | 2, 1 => 2 + | 3, 1 => 3 + | 1, 2 => 2 + | 1, 3 => 3 + | 0, 4 => 1 + | _, _ => 0 +def CA3_5_8I2R3P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_5_8I2R3Certificates (CA3_5_8I2R3CertificateIndex a)).input +lemma CA3_5_8I2R3P_check : ∀ a : PairSlot, contains (CA3_5_8I2R3Raw a) (CA3_5_8I2R3P a) = true := by + decide +kernel +lemma CA3_5_8I2R3P_sound (a : PairSlot) : + (CA3_5_8I2R3P a).Encloses (CA3_5_8I2R3Value a) := + contains_sound (CA3_5_8I2R3Raw_sound a) (CA3_5_8I2R3P_check a) +def CA3_5_8I2R3Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_5_8I2R3Certificates (CA3_5_8I2R3CertificateIndex a)).output +lemma CA3_5_8I2R3Terms_sound (a : PairSlot) : + (CA3_5_8I2R3Terms a).Encloses (Foundation.entropyTerm (CA3_5_8I2R3Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA3_5_8I2R3Certificates_valid + (CA3_5_8I2R3CertificateIndex a) (CA3_5_8I2R3P_sound a) +def CA3_5_8I2R3Entropy : Ball := ⟨(12028235618652855051199838483633 / 25000000000000000000000000000000), (2462483841 / 12500000000000000000000000000000)⟩ +lemma CA3_5_8I2R3Entropy_sound : CA3_5_8I2R3Entropy.Encloses (Foundation.finiteEntropy CA3_5_8I2R3Value) := by + exact contains_sound (entropyPair_enclosed CA3_5_8I2R3Value CA3_5_8I2R3Terms CA3_5_8I2R3Terms_sound) (by decide +kernel) +def CA3_5_8I2R3Mass : Ball := ⟨(8726568794983339000134653367169 / 50000000000000000000000000000000), (7 / 10000000000000000000000000000000)⟩ +lemma CA3_5_8I2R3Mass_sound : CA3_5_8I2R3Mass.Encloses (∑ a, CA3_5_8I2R3Value a) := by + exact contains_sound (pairSumBall_sound CA3_5_8I2R3P CA3_5_8I2R3Value CA3_5_8I2R3P_sound) (by decide +kernel) +def CA3_5_8I2R3MassTermLogWitness : LogWitness := ⟨-3, 8726568794983339000134653367169, 6250000000000000000000000000000⟩ +def CA3_5_8I2R3MassTermLog : Ball := ⟨(-174565074891994409889667767275929 / 100000000000000000000000000000000), (21175823783 / 25000000000000000000000000000000)⟩ +lemma CA3_5_8I2R3MassTermLog_sound : CA3_5_8I2R3MassTermLog.Encloses (Real.log ((∑ a, CA3_5_8I2R3Value a))) := by + exact checkLog_sound logTwoBall_sound (CA3_5_8I2R3Mass_sound) (w := CA3_5_8I2R3MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA3_5_8I2R3MassTerm : Ball := ⟨(7616770676232039919841721935443 / 25000000000000000000000000000000), (7391691383 / 50000000000000000000000000000000)⟩ +lemma CA3_5_8I2R3MassTerm_sound : CA3_5_8I2R3MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA3_5_8I2R3Value a))) := by + exact contains_sound (entropyTerm_ball (CA3_5_8I2R3Mass_sound) CA3_5_8I2R3MassTermLog_sound) (by decide +kernel) +def CA3_5_8I2R3H : Ball := ⟨(441146494242081513135811654819 / 2500000000000000000000000000000), (17241626747 / 50000000000000000000000000000000)⟩ +lemma CA3_5_8I2R3H_sound : CA3_5_8I2R3H.Encloses (homogeneousEntropy CA3_5_8I2R3Value) := by + exact contains_sound (homogeneous_enclosed CA3_5_8I2R3Value CA3_5_8I2R3MassTerm_sound CA3_5_8I2R3Entropy_sound) (by decide +kernel) +def CA3_5_8I2R4Value (a : PairSlot) : ℝ := residualLaw (below (shape 3 5 8)) (fun u => (stageALaw (shape 3 5 8) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 4 a +def CA3_5_8I2R4Raw (a : PairSlot) : Ball := residualBall (below (shape 3 5 8)) A3_5_8Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 4 a +lemma CA3_5_8I2R4Raw_sound (a : PairSlot) : + (CA3_5_8I2R4Raw a).Encloses (CA3_5_8I2R4Value a) := by + exact residualBall_sound_on (below (shape 3 5 8)) A3_5_8Law (fun u => (stageALaw (shape 3 5 8) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A3_5_8Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 3 5 8) (show (shape 3 5 8) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 4 a +def CA3_5_8I2R4Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(12022196877875889184523436251 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(54257201109417207674614979791 / 50000000000000000000000000000000), (38186999 / 100000000000000000000000000000000)⟩ ⟨(-902617078402121479264179184702111 / 100000000000000000000000000000000), (158818681781 / 50000000000000000000000000000000)⟩ ⟨-14, 12022196877875889184523436251, 6103515625000000000000000000⟩, + .log ⟨(4313474067026207097462872240937 / 100000000000000000000000000000000), (9 / 50000000000000000000000000000000)⟩ ⟨(6779544470890384077944803063867 / 50000000000000000000000000000000), (5480482053 / 100000000000000000000000000000000)⟩ ⟨(-19646415990754796262843556271099 / 6250000000000000000000000000000), (25410988503 / 20000000000000000000000000000000)⟩ ⟨-5, 4313474067026207097462872240937, 3125000000000000000000000000000⟩, + .log ⟨(45177057741556546528261888037303 / 100000000000000000000000000000000), (101 / 100000000000000000000000000000000)⟩ ⟨(17948411343172564815437949038557 / 50000000000000000000000000000000), (28699842459 / 100000000000000000000000000000000)⟩ ⟨(-79458080009768089968269588345363 / 100000000000000000000000000000000), (7940933909 / 12500000000000000000000000000000)⟩ ⟨-2, 45177057741556546528261888037303, 25000000000000000000000000000000⟩, + .log ⟨(2125556867426515782967876968221 / 100000000000000000000000000000000), (7 / 100000000000000000000000000000000)⟩ ⟨(1023226167887011655843502466643 / 12500000000000000000000000000000), (393841157 / 12500000000000000000000000000000)⟩ ⟨(-24069602266766602361450619164371 / 6250000000000000000000000000000), (14823076611 / 10000000000000000000000000000000)⟩ ⟨-6, 2125556867426515782967876968221, 1562500000000000000000000000000⟩, + .log ⟨(2214285087953012365889331869 / 2500000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ ⟨(311289353354744148483942266479 / 50000000000000000000000000000000), (56267177 / 25000000000000000000000000000000)⟩ ⟨(-702911641884637438998422078641927 / 100000000000000000000000000000000), (127054943227 / 50000000000000000000000000000000)⟩ ⟨-11, 2214285087953012365889331869, 1220703125000000000000000000⟩] +lemma CA3_5_8I2R4Certificates_valid : + CA3_5_8I2R4Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA3_5_8I2R4CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 5, 0 => 1 + | 4, 1 => 2 + | 2, 2 => 3 + | 2, 3 => 4 + | 3, 2 => 4 + | 3, 3 => 5 + | 1, 4 => 2 + | 0, 5 => 1 + | _, _ => 0 +def CA3_5_8I2R4P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_5_8I2R4Certificates (CA3_5_8I2R4CertificateIndex a)).input +lemma CA3_5_8I2R4P_check : ∀ a : PairSlot, contains (CA3_5_8I2R4Raw a) (CA3_5_8I2R4P a) = true := by + decide +kernel +lemma CA3_5_8I2R4P_sound (a : PairSlot) : + (CA3_5_8I2R4P a).Encloses (CA3_5_8I2R4Value a) := + contains_sound (CA3_5_8I2R4Raw_sound a) (CA3_5_8I2R4P_check a) +def CA3_5_8I2R4Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_5_8I2R4Certificates (CA3_5_8I2R4CertificateIndex a)).output +lemma CA3_5_8I2R4Terms_sound (a : PairSlot) : + (CA3_5_8I2R4Terms a).Encloses (Foundation.entropyTerm (CA3_5_8I2R4Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA3_5_8I2R4Certificates_valid + (CA3_5_8I2R4CertificateIndex a) (CA3_5_8I2R4P_sound a) +def CA3_5_8I2R4Entropy : Ball := ⟨(5014139172952875597738593390687 / 6250000000000000000000000000000), (46263707783 / 100000000000000000000000000000000)⟩ +lemma CA3_5_8I2R4Entropy_sound : CA3_5_8I2R4Entropy.Encloses (Foundation.finiteEntropy CA3_5_8I2R4Value) := by + exact contains_sound (entropyPair_enclosed CA3_5_8I2R4Value CA3_5_8I2R4Terms CA3_5_8I2R4Terms_sound) (by decide +kernel) +def CA3_5_8I2R4Mass : Ball := ⟨(58167735407735864562128006602881 / 100000000000000000000000000000000), (31 / 20000000000000000000000000000000)⟩ +lemma CA3_5_8I2R4Mass_sound : CA3_5_8I2R4Mass.Encloses (∑ a, CA3_5_8I2R4Value a) := by + exact contains_sound (pairSumBall_sound CA3_5_8I2R4P CA3_5_8I2R4Value CA3_5_8I2R4P_sound) (by decide +kernel) +def CA3_5_8I2R4MassTermLogWitness : LogWitness := ⟨-1, 58167735407735864562128006602881, 50000000000000000000000000000000⟩ +def CA3_5_8I2R4MassTermLog : Ball := ⟨(-27091967970527579926082113059819 / 50000000000000000000000000000000), (2646977977 / 6250000000000000000000000000000)⟩ +lemma CA3_5_8I2R4MassTermLog_sound : CA3_5_8I2R4MassTermLog.Encloses (Real.log ((∑ a, CA3_5_8I2R4Value a))) := by + exact checkLog_sound logTwoBall_sound (CA3_5_8I2R4Mass_sound) (w := CA3_5_8I2R4MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA3_5_8I2R4MassTerm : Ball := ⟨(3151756849169006124968414455831 / 10000000000000000000000000000000), (1231749721 / 5000000000000000000000000000000)⟩ +lemma CA3_5_8I2R4MassTerm_sound : CA3_5_8I2R4MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA3_5_8I2R4Value a))) := by + exact contains_sound (entropyTerm_ball (CA3_5_8I2R4Mass_sound) CA3_5_8I2R4MassTermLog_sound) (by decide +kernel) +def CA3_5_8I2R4H : Ball := ⟨(24354329137777974157066674846341 / 50000000000000000000000000000000), (70898702203 / 100000000000000000000000000000000)⟩ +lemma CA3_5_8I2R4H_sound : CA3_5_8I2R4H.Encloses (homogeneousEntropy CA3_5_8I2R4Value) := by + exact contains_sound (homogeneous_enclosed CA3_5_8I2R4Value CA3_5_8I2R4MassTerm_sound CA3_5_8I2R4Entropy_sound) (by decide +kernel) +def CA3_5_8I2R5Value (a : PairSlot) : ℝ := residualLaw (below (shape 3 5 8)) (fun u => (stageALaw (shape 3 5 8) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 5 a +def CA3_5_8I2R5Raw (a : PairSlot) : Ball := residualBall (below (shape 3 5 8)) A3_5_8Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 5 a +lemma CA3_5_8I2R5Raw_sound (a : PairSlot) : + (CA3_5_8I2R5Raw a).Encloses (CA3_5_8I2R5Value a) := by + exact residualBall_sound_on (below (shape 3 5 8)) A3_5_8Law (fun u => (stageALaw (shape 3 5 8) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A3_5_8Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 3 5 8) (show (shape 3 5 8) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 5 a +def CA3_5_8I2R5Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(9942282739469559574436285509 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(9162935847997859206549044161 / 10000000000000000000000000000000), (6316083 / 20000000000000000000000000000000)⟩ ⟨(-57600805117559953438689508166951 / 6250000000000000000000000000000), (317637365303 / 100000000000000000000000000000000)⟩ ⟨-14, 9942282739469559574436285509, 6103515625000000000000000000⟩, + .log ⟨(6181633525742884277323392971037 / 100000000000000000000000000000000), (23 / 100000000000000000000000000000000)⟩ ⟨(3441423716775335459622773796143 / 20000000000000000000000000000000), (1570814197 / 20000000000000000000000000000000)⟩ ⟨(-278358762489220740678403150827949 / 100000000000000000000000000000000), (12705494247 / 10000000000000000000000000000000)⟩ ⟨-5, 6181633525742884277323392971037, 3125000000000000000000000000000⟩, + .log ⟨(115092730158440709709968830601 / 50000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ ⟨(1398155723714242694181480175331 / 100000000000000000000000000000000), (487436687 / 100000000000000000000000000000000)⟩ ⟨(-303702006588403158829656558252789 / 50000000000000000000000000000000), (105879118849 / 50000000000000000000000000000000)⟩ ⟨-9, 115092730158440709709968830601, 97656250000000000000000000000⟩] +lemma CA3_5_8I2R5Certificates_valid : + CA3_5_8I2R5Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA3_5_8I2R5CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 5, 1 => 1 + | 4, 2 => 2 + | 4, 3 => 3 + | 2, 4 => 2 + | 3, 4 => 3 + | 1, 5 => 1 + | _, _ => 0 +def CA3_5_8I2R5P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_5_8I2R5Certificates (CA3_5_8I2R5CertificateIndex a)).input +lemma CA3_5_8I2R5P_check : ∀ a : PairSlot, contains (CA3_5_8I2R5Raw a) (CA3_5_8I2R5P a) = true := by + decide +kernel +lemma CA3_5_8I2R5P_sound (a : PairSlot) : + (CA3_5_8I2R5P a).Encloses (CA3_5_8I2R5Value a) := + contains_sound (CA3_5_8I2R5Raw_sound a) (CA3_5_8I2R5P_check a) +def CA3_5_8I2R5Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_5_8I2R5Certificates (CA3_5_8I2R5CertificateIndex a)).output +lemma CA3_5_8I2R5Terms_sound (a : PairSlot) : + (CA3_5_8I2R5Terms a).Encloses (Foundation.entropyTerm (CA3_5_8I2R5Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA3_5_8I2R5Certificates_valid + (CA3_5_8I2R5CertificateIndex a) (CA3_5_8I2R5P_sound a) +def CA3_5_8I2R5Entropy : Ball := ⟨(2337112958258862323045104949707 / 6250000000000000000000000000000), (8373088087 / 50000000000000000000000000000000)⟩ +lemma CA3_5_8I2R5Entropy_sound : CA3_5_8I2R5Entropy.Encloses (Foundation.finiteEntropy CA3_5_8I2R5Value) := by + exact contains_sound (entropyPair_enclosed CA3_5_8I2R5Value CA3_5_8I2R5Terms CA3_5_8I2R5Terms_sound) (by decide +kernel) +def CA3_5_8I2R5Mass : Ball := ⟨(1605440317199808814079441729437 / 12500000000000000000000000000000), (13 / 25000000000000000000000000000000)⟩ +lemma CA3_5_8I2R5Mass_sound : CA3_5_8I2R5Mass.Encloses (∑ a, CA3_5_8I2R5Value a) := by + exact contains_sound (pairSumBall_sound CA3_5_8I2R5P CA3_5_8I2R5Value CA3_5_8I2R5P_sound) (by decide +kernel) +def CA3_5_8I2R5MassTermLogWitness : LogWitness := ⟨-3, 1605440317199808814079441729437, 1562500000000000000000000000000⟩ +def CA3_5_8I2R5MassTermLog : Ball := ⟨(-25654132305205111739328766222689 / 12500000000000000000000000000000), (2646977973 / 3125000000000000000000000000000)⟩ +lemma CA3_5_8I2R5MassTermLog_sound : CA3_5_8I2R5MassTermLog.Encloses (Real.log ((∑ a, CA3_5_8I2R5Value a))) := by + exact checkLog_sound logTwoBall_sound (CA3_5_8I2R5Mass_sound) (w := CA3_5_8I2R5MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA3_5_8I2R5MassTerm : Ball := ⟨(26359154115554788539487055265713 / 100000000000000000000000000000000), (2719721727 / 25000000000000000000000000000000)⟩ +lemma CA3_5_8I2R5MassTerm_sound : CA3_5_8I2R5MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA3_5_8I2R5Value a))) := by + exact contains_sound (entropyTerm_ball (CA3_5_8I2R5Mass_sound) CA3_5_8I2R5MassTermLog_sound) (by decide +kernel) +def CA3_5_8I2R5H : Ball := ⟨(11034653216587008629234623929599 / 100000000000000000000000000000000), (13812531541 / 50000000000000000000000000000000)⟩ +lemma CA3_5_8I2R5H_sound : CA3_5_8I2R5H.Encloses (homogeneousEntropy CA3_5_8I2R5Value) := by + exact contains_sound (homogeneous_enclosed CA3_5_8I2R5Value CA3_5_8I2R5MassTerm_sound CA3_5_8I2R5Entropy_sound) (by decide +kernel) +def CA3_5_8I2R6Value (a : PairSlot) : ℝ := residualLaw (below (shape 3 5 8)) (fun u => (stageALaw (shape 3 5 8) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 6 a +def CA3_5_8I2R6Raw (a : PairSlot) : Ball := residualBall (below (shape 3 5 8)) A3_5_8Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 6 a +lemma CA3_5_8I2R6Raw_sound (a : PairSlot) : + (CA3_5_8I2R6Raw a).Encloses (CA3_5_8I2R6Value a) := by + exact residualBall_sound_on (below (shape 3 5 8)) A3_5_8Law (fun u => (stageALaw (shape 3 5 8) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A3_5_8Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 3 5 8) (show (shape 3 5 8) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 6 a +def CA3_5_8I2R6Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(3201740378379992765626809327 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(6627110113802342717611462361 / 20000000000000000000000000000000), (10847931 / 100000000000000000000000000000000)⟩ ⟨(-1034923093476353088084332758064927 / 100000000000000000000000000000000), (4235165127 / 1250000000000000000000000000000)⟩ ⟨-15, 3201740378379992765626809327, 3051757812500000000000000000⟩, + .log ⟨(40344470469227470177519 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(1972066848508867464967 / 48828125000000000000000000000), (1303 / 100000000000000000000000000000000)⟩ ⟨(-2002154376435168894411699120477917 / 100000000000000000000000000000000), (635770441373 / 100000000000000000000000000000000)⟩ ⟨-29, 40344470469227470177519, 37252902984619140625000⟩, + .log ⟨(335729142967404254620887392339 / 100000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ ⟨(1912521602952815363567260599791 / 100000000000000000000000000000000), (142186827 / 20000000000000000000000000000000)⟩ ⟨(-569662075221900221848765785723993 / 100000000000000000000000000000000), (211758237723 / 100000000000000000000000000000000)⟩ ⟨-9, 335729142967404254620887392339, 195312500000000000000000000000⟩] +lemma CA3_5_8I2R6Certificates_valid : + CA3_5_8I2R6Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA3_5_8I2R6CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 5, 2 => 1 + | 5, 3 => 2 + | 4, 4 => 3 + | 2, 5 => 1 + | 3, 5 => 2 + | _, _ => 0 +def CA3_5_8I2R6P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_5_8I2R6Certificates (CA3_5_8I2R6CertificateIndex a)).input +lemma CA3_5_8I2R6P_check : ∀ a : PairSlot, contains (CA3_5_8I2R6Raw a) (CA3_5_8I2R6P a) = true := by + decide +kernel +lemma CA3_5_8I2R6P_sound (a : PairSlot) : + (CA3_5_8I2R6P a).Encloses (CA3_5_8I2R6Value a) := + contains_sound (CA3_5_8I2R6Raw_sound a) (CA3_5_8I2R6P_check a) +def CA3_5_8I2R6Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_5_8I2R6Certificates (CA3_5_8I2R6CertificateIndex a)).output +lemma CA3_5_8I2R6Terms_sound (a : PairSlot) : + (CA3_5_8I2R6Terms a).Encloses (Foundation.entropyTerm (CA3_5_8I2R6Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA3_5_8I2R6Certificates_valid + (CA3_5_8I2R6CertificateIndex a) (CA3_5_8I2R6P_sound a) +def CA3_5_8I2R6Entropy : Ball := ⟨(1978800781676650283064511728233 / 100000000000000000000000000000000), (732632603 / 100000000000000000000000000000000)⟩ +lemma CA3_5_8I2R6Entropy_sound : CA3_5_8I2R6Entropy.Encloses (Foundation.finiteEntropy CA3_5_8I2R6Value) := by + exact contains_sound (entropyPair_enclosed CA3_5_8I2R6Value CA3_5_8I2R6Terms CA3_5_8I2R6Terms_sound) (by decide +kernel) +def CA3_5_8I2R6Mass : Ball := ⟨(342133027168868932426842786183 / 100000000000000000000000000000000), (7 / 100000000000000000000000000000000)⟩ +lemma CA3_5_8I2R6Mass_sound : CA3_5_8I2R6Mass.Encloses (∑ a, CA3_5_8I2R6Value a) := by + exact contains_sound (pairSumBall_sound CA3_5_8I2R6P CA3_5_8I2R6Value CA3_5_8I2R6P_sound) (by decide +kernel) +def CA3_5_8I2R6MassTermLogWitness : LogWitness := ⟨-9, 342133027168868932426842786183, 195312500000000000000000000000⟩ +def CA3_5_8I2R6MassTermLog : Ball := ⟨(-283886291760308362723103641132293 / 50000000000000000000000000000000), (52939559719 / 25000000000000000000000000000000)⟩ +lemma CA3_5_8I2R6MassTermLog_sound : CA3_5_8I2R6MassTermLog.Encloses (Real.log ((∑ a, CA3_5_8I2R6Value a))) := by + exact checkLog_sound logTwoBall_sound (CA3_5_8I2R6Mass_sound) (w := CA3_5_8I2R6MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA3_5_8I2R6MassTerm : Ball := ⟨(1942537527433980672240958010263 / 100000000000000000000000000000000), (724494913 / 100000000000000000000000000000000)⟩ +lemma CA3_5_8I2R6MassTerm_sound : CA3_5_8I2R6MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA3_5_8I2R6Value a))) := by + exact contains_sound (entropyTerm_ball (CA3_5_8I2R6Mass_sound) CA3_5_8I2R6MassTermLog_sound) (by decide +kernel) +def CA3_5_8I2R6H : Ball := ⟨(3626325424266961082355371797 / 10000000000000000000000000000000), (364281879 / 25000000000000000000000000000000)⟩ +lemma CA3_5_8I2R6H_sound : CA3_5_8I2R6H.Encloses (homogeneousEntropy CA3_5_8I2R6Value) := by + exact contains_sound (homogeneous_enclosed CA3_5_8I2R6Value CA3_5_8I2R6MassTerm_sound CA3_5_8I2R6Entropy_sound) (by decide +kernel) +def CA3_5_8I2R7Value (a : PairSlot) : ℝ := residualLaw (below (shape 3 5 8)) (fun u => (stageALaw (shape 3 5 8) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 7 a +def CA3_5_8I2R7Raw (a : PairSlot) : Ball := residualBall (below (shape 3 5 8)) A3_5_8Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 7 a +lemma CA3_5_8I2R7Raw_sound (a : PairSlot) : + (CA3_5_8I2R7Raw a).Encloses (CA3_5_8I2R7Value a) := by + exact residualBall_sound_on (below (shape 3 5 8)) A3_5_8Law (fun u => (stageALaw (shape 3 5 8) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A3_5_8Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 3 5 8) (show (shape 3 5 8) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 7 a +def CA3_5_8I2R7Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA3_5_8I2R7Certificates_valid : + CA3_5_8I2R7Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA3_5_8I2R7CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA3_5_8I2R7P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_5_8I2R7Certificates (CA3_5_8I2R7CertificateIndex a)).input +lemma CA3_5_8I2R7P_check : ∀ a : PairSlot, contains (CA3_5_8I2R7Raw a) (CA3_5_8I2R7P a) = true := by + decide +kernel +lemma CA3_5_8I2R7P_sound (a : PairSlot) : + (CA3_5_8I2R7P a).Encloses (CA3_5_8I2R7Value a) := + contains_sound (CA3_5_8I2R7Raw_sound a) (CA3_5_8I2R7P_check a) +def CA3_5_8I2R7Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_5_8I2R7Certificates (CA3_5_8I2R7CertificateIndex a)).output +lemma CA3_5_8I2R7Terms_sound (a : PairSlot) : + (CA3_5_8I2R7Terms a).Encloses (Foundation.entropyTerm (CA3_5_8I2R7Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA3_5_8I2R7Certificates_valid + (CA3_5_8I2R7CertificateIndex a) (CA3_5_8I2R7P_sound a) +def CA3_5_8I2R7Entropy : Ball := ⟨0, 0⟩ +lemma CA3_5_8I2R7Entropy_sound : CA3_5_8I2R7Entropy.Encloses (Foundation.finiteEntropy CA3_5_8I2R7Value) := by + exact contains_sound (entropyPair_enclosed CA3_5_8I2R7Value CA3_5_8I2R7Terms CA3_5_8I2R7Terms_sound) (by decide +kernel) +def CA3_5_8I2R7Mass : Ball := ⟨0, 0⟩ +lemma CA3_5_8I2R7Mass_sound : CA3_5_8I2R7Mass.Encloses (∑ a, CA3_5_8I2R7Value a) := by + exact contains_sound (pairSumBall_sound CA3_5_8I2R7P CA3_5_8I2R7Value CA3_5_8I2R7P_sound) (by decide +kernel) +def CA3_5_8I2R7MassTerm : Ball := .exact 0 +lemma CA3_5_8I2R7MassTerm_sound : CA3_5_8I2R7MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA3_5_8I2R7Value a))) := + entropyTerm_zero_ball (CA3_5_8I2R7Mass_sound) +def CA3_5_8I2R7H : Ball := ⟨0, 0⟩ +lemma CA3_5_8I2R7H_sound : CA3_5_8I2R7H.Encloses (homogeneousEntropy CA3_5_8I2R7Value) := by + exact contains_sound (homogeneous_enclosed CA3_5_8I2R7Value CA3_5_8I2R7MassTerm_sound CA3_5_8I2R7Entropy_sound) (by decide +kernel) +def CA3_5_8I2R8Value (a : PairSlot) : ℝ := residualLaw (below (shape 3 5 8)) (fun u => (stageALaw (shape 3 5 8) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 8 a +def CA3_5_8I2R8Raw (a : PairSlot) : Ball := residualBall (below (shape 3 5 8)) A3_5_8Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 8 a +lemma CA3_5_8I2R8Raw_sound (a : PairSlot) : + (CA3_5_8I2R8Raw a).Encloses (CA3_5_8I2R8Value a) := by + exact residualBall_sound_on (below (shape 3 5 8)) A3_5_8Law (fun u => (stageALaw (shape 3 5 8) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A3_5_8Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 3 5 8) (show (shape 3 5 8) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 8 a +def CA3_5_8I2R8Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA3_5_8I2R8Certificates_valid : + CA3_5_8I2R8Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA3_5_8I2R8CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA3_5_8I2R8P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_5_8I2R8Certificates (CA3_5_8I2R8CertificateIndex a)).input +lemma CA3_5_8I2R8P_check : ∀ a : PairSlot, contains (CA3_5_8I2R8Raw a) (CA3_5_8I2R8P a) = true := by + decide +kernel +lemma CA3_5_8I2R8P_sound (a : PairSlot) : + (CA3_5_8I2R8P a).Encloses (CA3_5_8I2R8Value a) := + contains_sound (CA3_5_8I2R8Raw_sound a) (CA3_5_8I2R8P_check a) +def CA3_5_8I2R8Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_5_8I2R8Certificates (CA3_5_8I2R8CertificateIndex a)).output +lemma CA3_5_8I2R8Terms_sound (a : PairSlot) : + (CA3_5_8I2R8Terms a).Encloses (Foundation.entropyTerm (CA3_5_8I2R8Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA3_5_8I2R8Certificates_valid + (CA3_5_8I2R8CertificateIndex a) (CA3_5_8I2R8P_sound a) +def CA3_5_8I2R8Entropy : Ball := ⟨0, 0⟩ +lemma CA3_5_8I2R8Entropy_sound : CA3_5_8I2R8Entropy.Encloses (Foundation.finiteEntropy CA3_5_8I2R8Value) := by + exact contains_sound (entropyPair_enclosed CA3_5_8I2R8Value CA3_5_8I2R8Terms CA3_5_8I2R8Terms_sound) (by decide +kernel) +def CA3_5_8I2R8Mass : Ball := ⟨0, 0⟩ +lemma CA3_5_8I2R8Mass_sound : CA3_5_8I2R8Mass.Encloses (∑ a, CA3_5_8I2R8Value a) := by + exact contains_sound (pairSumBall_sound CA3_5_8I2R8P CA3_5_8I2R8Value CA3_5_8I2R8P_sound) (by decide +kernel) +def CA3_5_8I2R8MassTerm : Ball := .exact 0 +lemma CA3_5_8I2R8MassTerm_sound : CA3_5_8I2R8MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA3_5_8I2R8Value a))) := + entropyTerm_zero_ball (CA3_5_8I2R8Mass_sound) +def CA3_5_8I2R8H : Ball := ⟨0, 0⟩ +lemma CA3_5_8I2R8H_sound : CA3_5_8I2R8H.Encloses (homogeneousEntropy CA3_5_8I2R8Value) := by + exact contains_sound (homogeneous_enclosed CA3_5_8I2R8Value CA3_5_8I2R8MassTerm_sound CA3_5_8I2R8Entropy_sound) (by decide +kernel) +def CA3_5_8I2R9Value (a : PairSlot) : ℝ := residualLaw (below (shape 3 5 8)) (fun u => (stageALaw (shape 3 5 8) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 9 a +def CA3_5_8I2R9Raw (a : PairSlot) : Ball := residualBall (below (shape 3 5 8)) A3_5_8Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 9 a +lemma CA3_5_8I2R9Raw_sound (a : PairSlot) : + (CA3_5_8I2R9Raw a).Encloses (CA3_5_8I2R9Value a) := by + exact residualBall_sound_on (below (shape 3 5 8)) A3_5_8Law (fun u => (stageALaw (shape 3 5 8) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A3_5_8Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 3 5 8) (show (shape 3 5 8) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 9 a +def CA3_5_8I2R9Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA3_5_8I2R9Certificates_valid : + CA3_5_8I2R9Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA3_5_8I2R9CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA3_5_8I2R9P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_5_8I2R9Certificates (CA3_5_8I2R9CertificateIndex a)).input +lemma CA3_5_8I2R9P_check : ∀ a : PairSlot, contains (CA3_5_8I2R9Raw a) (CA3_5_8I2R9P a) = true := by + decide +kernel +lemma CA3_5_8I2R9P_sound (a : PairSlot) : + (CA3_5_8I2R9P a).Encloses (CA3_5_8I2R9Value a) := + contains_sound (CA3_5_8I2R9Raw_sound a) (CA3_5_8I2R9P_check a) +def CA3_5_8I2R9Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_5_8I2R9Certificates (CA3_5_8I2R9CertificateIndex a)).output +lemma CA3_5_8I2R9Terms_sound (a : PairSlot) : + (CA3_5_8I2R9Terms a).Encloses (Foundation.entropyTerm (CA3_5_8I2R9Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA3_5_8I2R9Certificates_valid + (CA3_5_8I2R9CertificateIndex a) (CA3_5_8I2R9P_sound a) +def CA3_5_8I2R9Entropy : Ball := ⟨0, 0⟩ +lemma CA3_5_8I2R9Entropy_sound : CA3_5_8I2R9Entropy.Encloses (Foundation.finiteEntropy CA3_5_8I2R9Value) := by + exact contains_sound (entropyPair_enclosed CA3_5_8I2R9Value CA3_5_8I2R9Terms CA3_5_8I2R9Terms_sound) (by decide +kernel) +def CA3_5_8I2R9Mass : Ball := ⟨0, 0⟩ +lemma CA3_5_8I2R9Mass_sound : CA3_5_8I2R9Mass.Encloses (∑ a, CA3_5_8I2R9Value a) := by + exact contains_sound (pairSumBall_sound CA3_5_8I2R9P CA3_5_8I2R9Value CA3_5_8I2R9P_sound) (by decide +kernel) +def CA3_5_8I2R9MassTerm : Ball := .exact 0 +lemma CA3_5_8I2R9MassTerm_sound : CA3_5_8I2R9MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA3_5_8I2R9Value a))) := + entropyTerm_zero_ball (CA3_5_8I2R9Mass_sound) +def CA3_5_8I2R9H : Ball := ⟨0, 0⟩ +lemma CA3_5_8I2R9H_sound : CA3_5_8I2R9H.Encloses (homogeneousEntropy CA3_5_8I2R9Value) := by + exact contains_sound (homogeneous_enclosed CA3_5_8I2R9Value CA3_5_8I2R9MassTerm_sound CA3_5_8I2R9Entropy_sound) (by decide +kernel) +def CA3_5_8I2R10Value (a : PairSlot) : ℝ := residualLaw (below (shape 3 5 8)) (fun u => (stageALaw (shape 3 5 8) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 10 a +def CA3_5_8I2R10Raw (a : PairSlot) : Ball := residualBall (below (shape 3 5 8)) A3_5_8Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 10 a +lemma CA3_5_8I2R10Raw_sound (a : PairSlot) : + (CA3_5_8I2R10Raw a).Encloses (CA3_5_8I2R10Value a) := by + exact residualBall_sound_on (below (shape 3 5 8)) A3_5_8Law (fun u => (stageALaw (shape 3 5 8) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A3_5_8Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 3 5 8) (show (shape 3 5 8) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 10 a +def CA3_5_8I2R10Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA3_5_8I2R10Certificates_valid : + CA3_5_8I2R10Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA3_5_8I2R10CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA3_5_8I2R10P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_5_8I2R10Certificates (CA3_5_8I2R10CertificateIndex a)).input +lemma CA3_5_8I2R10P_check : ∀ a : PairSlot, contains (CA3_5_8I2R10Raw a) (CA3_5_8I2R10P a) = true := by + decide +kernel +lemma CA3_5_8I2R10P_sound (a : PairSlot) : + (CA3_5_8I2R10P a).Encloses (CA3_5_8I2R10Value a) := + contains_sound (CA3_5_8I2R10Raw_sound a) (CA3_5_8I2R10P_check a) +def CA3_5_8I2R10Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_5_8I2R10Certificates (CA3_5_8I2R10CertificateIndex a)).output +lemma CA3_5_8I2R10Terms_sound (a : PairSlot) : + (CA3_5_8I2R10Terms a).Encloses (Foundation.entropyTerm (CA3_5_8I2R10Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA3_5_8I2R10Certificates_valid + (CA3_5_8I2R10CertificateIndex a) (CA3_5_8I2R10P_sound a) +def CA3_5_8I2R10Entropy : Ball := ⟨0, 0⟩ +lemma CA3_5_8I2R10Entropy_sound : CA3_5_8I2R10Entropy.Encloses (Foundation.finiteEntropy CA3_5_8I2R10Value) := by + exact contains_sound (entropyPair_enclosed CA3_5_8I2R10Value CA3_5_8I2R10Terms CA3_5_8I2R10Terms_sound) (by decide +kernel) +def CA3_5_8I2R10Mass : Ball := ⟨0, 0⟩ +lemma CA3_5_8I2R10Mass_sound : CA3_5_8I2R10Mass.Encloses (∑ a, CA3_5_8I2R10Value a) := by + exact contains_sound (pairSumBall_sound CA3_5_8I2R10P CA3_5_8I2R10Value CA3_5_8I2R10P_sound) (by decide +kernel) +def CA3_5_8I2R10MassTerm : Ball := .exact 0 +lemma CA3_5_8I2R10MassTerm_sound : CA3_5_8I2R10MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA3_5_8I2R10Value a))) := + entropyTerm_zero_ball (CA3_5_8I2R10Mass_sound) +def CA3_5_8I2R10H : Ball := ⟨0, 0⟩ +lemma CA3_5_8I2R10H_sound : CA3_5_8I2R10H.Encloses (homogeneousEntropy CA3_5_8I2R10Value) := by + exact contains_sound (homogeneous_enclosed CA3_5_8I2R10Value CA3_5_8I2R10MassTerm_sound CA3_5_8I2R10Entropy_sound) (by decide +kernel) +def CA3_5_8I2R11Value (a : PairSlot) : ℝ := residualLaw (below (shape 3 5 8)) (fun u => (stageALaw (shape 3 5 8) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 11 a +def CA3_5_8I2R11Raw (a : PairSlot) : Ball := residualBall (below (shape 3 5 8)) A3_5_8Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 11 a +lemma CA3_5_8I2R11Raw_sound (a : PairSlot) : + (CA3_5_8I2R11Raw a).Encloses (CA3_5_8I2R11Value a) := by + exact residualBall_sound_on (below (shape 3 5 8)) A3_5_8Law (fun u => (stageALaw (shape 3 5 8) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A3_5_8Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 3 5 8) (show (shape 3 5 8) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 11 a +def CA3_5_8I2R11Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA3_5_8I2R11Certificates_valid : + CA3_5_8I2R11Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA3_5_8I2R11CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA3_5_8I2R11P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_5_8I2R11Certificates (CA3_5_8I2R11CertificateIndex a)).input +lemma CA3_5_8I2R11P_check : ∀ a : PairSlot, contains (CA3_5_8I2R11Raw a) (CA3_5_8I2R11P a) = true := by + decide +kernel +lemma CA3_5_8I2R11P_sound (a : PairSlot) : + (CA3_5_8I2R11P a).Encloses (CA3_5_8I2R11Value a) := + contains_sound (CA3_5_8I2R11Raw_sound a) (CA3_5_8I2R11P_check a) +def CA3_5_8I2R11Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_5_8I2R11Certificates (CA3_5_8I2R11CertificateIndex a)).output +lemma CA3_5_8I2R11Terms_sound (a : PairSlot) : + (CA3_5_8I2R11Terms a).Encloses (Foundation.entropyTerm (CA3_5_8I2R11Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA3_5_8I2R11Certificates_valid + (CA3_5_8I2R11CertificateIndex a) (CA3_5_8I2R11P_sound a) +def CA3_5_8I2R11Entropy : Ball := ⟨0, 0⟩ +lemma CA3_5_8I2R11Entropy_sound : CA3_5_8I2R11Entropy.Encloses (Foundation.finiteEntropy CA3_5_8I2R11Value) := by + exact contains_sound (entropyPair_enclosed CA3_5_8I2R11Value CA3_5_8I2R11Terms CA3_5_8I2R11Terms_sound) (by decide +kernel) +def CA3_5_8I2R11Mass : Ball := ⟨0, 0⟩ +lemma CA3_5_8I2R11Mass_sound : CA3_5_8I2R11Mass.Encloses (∑ a, CA3_5_8I2R11Value a) := by + exact contains_sound (pairSumBall_sound CA3_5_8I2R11P CA3_5_8I2R11Value CA3_5_8I2R11P_sound) (by decide +kernel) +def CA3_5_8I2R11MassTerm : Ball := .exact 0 +lemma CA3_5_8I2R11MassTerm_sound : CA3_5_8I2R11MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA3_5_8I2R11Value a))) := + entropyTerm_zero_ball (CA3_5_8I2R11Mass_sound) +def CA3_5_8I2R11H : Ball := ⟨0, 0⟩ +lemma CA3_5_8I2R11H_sound : CA3_5_8I2R11H.Encloses (homogeneousEntropy CA3_5_8I2R11Value) := by + exact contains_sound (homogeneous_enclosed CA3_5_8I2R11Value CA3_5_8I2R11MassTerm_sound CA3_5_8I2R11Entropy_sound) (by decide +kernel) +def CA3_5_8I2R12Value (a : PairSlot) : ℝ := residualLaw (below (shape 3 5 8)) (fun u => (stageALaw (shape 3 5 8) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 12 a +def CA3_5_8I2R12Raw (a : PairSlot) : Ball := residualBall (below (shape 3 5 8)) A3_5_8Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 12 a +lemma CA3_5_8I2R12Raw_sound (a : PairSlot) : + (CA3_5_8I2R12Raw a).Encloses (CA3_5_8I2R12Value a) := by + exact residualBall_sound_on (below (shape 3 5 8)) A3_5_8Law (fun u => (stageALaw (shape 3 5 8) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A3_5_8Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 3 5 8) (show (shape 3 5 8) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 12 a +def CA3_5_8I2R12Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA3_5_8I2R12Certificates_valid : + CA3_5_8I2R12Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA3_5_8I2R12CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA3_5_8I2R12P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_5_8I2R12Certificates (CA3_5_8I2R12CertificateIndex a)).input +lemma CA3_5_8I2R12P_check : ∀ a : PairSlot, contains (CA3_5_8I2R12Raw a) (CA3_5_8I2R12P a) = true := by + decide +kernel +lemma CA3_5_8I2R12P_sound (a : PairSlot) : + (CA3_5_8I2R12P a).Encloses (CA3_5_8I2R12Value a) := + contains_sound (CA3_5_8I2R12Raw_sound a) (CA3_5_8I2R12P_check a) +def CA3_5_8I2R12Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_5_8I2R12Certificates (CA3_5_8I2R12CertificateIndex a)).output +lemma CA3_5_8I2R12Terms_sound (a : PairSlot) : + (CA3_5_8I2R12Terms a).Encloses (Foundation.entropyTerm (CA3_5_8I2R12Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA3_5_8I2R12Certificates_valid + (CA3_5_8I2R12CertificateIndex a) (CA3_5_8I2R12P_sound a) +def CA3_5_8I2R12Entropy : Ball := ⟨0, 0⟩ +lemma CA3_5_8I2R12Entropy_sound : CA3_5_8I2R12Entropy.Encloses (Foundation.finiteEntropy CA3_5_8I2R12Value) := by + exact contains_sound (entropyPair_enclosed CA3_5_8I2R12Value CA3_5_8I2R12Terms CA3_5_8I2R12Terms_sound) (by decide +kernel) +def CA3_5_8I2R12Mass : Ball := ⟨0, 0⟩ +lemma CA3_5_8I2R12Mass_sound : CA3_5_8I2R12Mass.Encloses (∑ a, CA3_5_8I2R12Value a) := by + exact contains_sound (pairSumBall_sound CA3_5_8I2R12P CA3_5_8I2R12Value CA3_5_8I2R12P_sound) (by decide +kernel) +def CA3_5_8I2R12MassTerm : Ball := .exact 0 +lemma CA3_5_8I2R12MassTerm_sound : CA3_5_8I2R12MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA3_5_8I2R12Value a))) := + entropyTerm_zero_ball (CA3_5_8I2R12Mass_sound) +def CA3_5_8I2R12H : Ball := ⟨0, 0⟩ +lemma CA3_5_8I2R12H_sound : CA3_5_8I2R12H.Encloses (homogeneousEntropy CA3_5_8I2R12Value) := by + exact contains_sound (homogeneous_enclosed CA3_5_8I2R12Value CA3_5_8I2R12MassTerm_sound CA3_5_8I2R12Entropy_sound) (by decide +kernel) +def CA3_5_8I2R13Value (a : PairSlot) : ℝ := residualLaw (below (shape 3 5 8)) (fun u => (stageALaw (shape 3 5 8) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 13 a +def CA3_5_8I2R13Raw (a : PairSlot) : Ball := residualBall (below (shape 3 5 8)) A3_5_8Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 13 a +lemma CA3_5_8I2R13Raw_sound (a : PairSlot) : + (CA3_5_8I2R13Raw a).Encloses (CA3_5_8I2R13Value a) := by + exact residualBall_sound_on (below (shape 3 5 8)) A3_5_8Law (fun u => (stageALaw (shape 3 5 8) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A3_5_8Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 3 5 8) (show (shape 3 5 8) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 13 a +def CA3_5_8I2R13Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA3_5_8I2R13Certificates_valid : + CA3_5_8I2R13Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA3_5_8I2R13CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA3_5_8I2R13P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_5_8I2R13Certificates (CA3_5_8I2R13CertificateIndex a)).input +lemma CA3_5_8I2R13P_check : ∀ a : PairSlot, contains (CA3_5_8I2R13Raw a) (CA3_5_8I2R13P a) = true := by + decide +kernel +lemma CA3_5_8I2R13P_sound (a : PairSlot) : + (CA3_5_8I2R13P a).Encloses (CA3_5_8I2R13Value a) := + contains_sound (CA3_5_8I2R13Raw_sound a) (CA3_5_8I2R13P_check a) +def CA3_5_8I2R13Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_5_8I2R13Certificates (CA3_5_8I2R13CertificateIndex a)).output +lemma CA3_5_8I2R13Terms_sound (a : PairSlot) : + (CA3_5_8I2R13Terms a).Encloses (Foundation.entropyTerm (CA3_5_8I2R13Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA3_5_8I2R13Certificates_valid + (CA3_5_8I2R13CertificateIndex a) (CA3_5_8I2R13P_sound a) +def CA3_5_8I2R13Entropy : Ball := ⟨0, 0⟩ +lemma CA3_5_8I2R13Entropy_sound : CA3_5_8I2R13Entropy.Encloses (Foundation.finiteEntropy CA3_5_8I2R13Value) := by + exact contains_sound (entropyPair_enclosed CA3_5_8I2R13Value CA3_5_8I2R13Terms CA3_5_8I2R13Terms_sound) (by decide +kernel) +def CA3_5_8I2R13Mass : Ball := ⟨0, 0⟩ +lemma CA3_5_8I2R13Mass_sound : CA3_5_8I2R13Mass.Encloses (∑ a, CA3_5_8I2R13Value a) := by + exact contains_sound (pairSumBall_sound CA3_5_8I2R13P CA3_5_8I2R13Value CA3_5_8I2R13P_sound) (by decide +kernel) +def CA3_5_8I2R13MassTerm : Ball := .exact 0 +lemma CA3_5_8I2R13MassTerm_sound : CA3_5_8I2R13MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA3_5_8I2R13Value a))) := + entropyTerm_zero_ball (CA3_5_8I2R13Mass_sound) +def CA3_5_8I2R13H : Ball := ⟨0, 0⟩ +lemma CA3_5_8I2R13H_sound : CA3_5_8I2R13H.Encloses (homogeneousEntropy CA3_5_8I2R13Value) := by + exact contains_sound (homogeneous_enclosed CA3_5_8I2R13Value CA3_5_8I2R13MassTerm_sound CA3_5_8I2R13Entropy_sound) (by decide +kernel) +def CA3_5_8I2R14Value (a : PairSlot) : ℝ := residualLaw (below (shape 3 5 8)) (fun u => (stageALaw (shape 3 5 8) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 14 a +def CA3_5_8I2R14Raw (a : PairSlot) : Ball := residualBall (below (shape 3 5 8)) A3_5_8Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 14 a +lemma CA3_5_8I2R14Raw_sound (a : PairSlot) : + (CA3_5_8I2R14Raw a).Encloses (CA3_5_8I2R14Value a) := by + exact residualBall_sound_on (below (shape 3 5 8)) A3_5_8Law (fun u => (stageALaw (shape 3 5 8) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A3_5_8Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 3 5 8) (show (shape 3 5 8) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 14 a +def CA3_5_8I2R14Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA3_5_8I2R14Certificates_valid : + CA3_5_8I2R14Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA3_5_8I2R14CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA3_5_8I2R14P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_5_8I2R14Certificates (CA3_5_8I2R14CertificateIndex a)).input +lemma CA3_5_8I2R14P_check : ∀ a : PairSlot, contains (CA3_5_8I2R14Raw a) (CA3_5_8I2R14P a) = true := by + decide +kernel +lemma CA3_5_8I2R14P_sound (a : PairSlot) : + (CA3_5_8I2R14P a).Encloses (CA3_5_8I2R14Value a) := + contains_sound (CA3_5_8I2R14Raw_sound a) (CA3_5_8I2R14P_check a) +def CA3_5_8I2R14Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_5_8I2R14Certificates (CA3_5_8I2R14CertificateIndex a)).output +lemma CA3_5_8I2R14Terms_sound (a : PairSlot) : + (CA3_5_8I2R14Terms a).Encloses (Foundation.entropyTerm (CA3_5_8I2R14Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA3_5_8I2R14Certificates_valid + (CA3_5_8I2R14CertificateIndex a) (CA3_5_8I2R14P_sound a) +def CA3_5_8I2R14Entropy : Ball := ⟨0, 0⟩ +lemma CA3_5_8I2R14Entropy_sound : CA3_5_8I2R14Entropy.Encloses (Foundation.finiteEntropy CA3_5_8I2R14Value) := by + exact contains_sound (entropyPair_enclosed CA3_5_8I2R14Value CA3_5_8I2R14Terms CA3_5_8I2R14Terms_sound) (by decide +kernel) +def CA3_5_8I2R14Mass : Ball := ⟨0, 0⟩ +lemma CA3_5_8I2R14Mass_sound : CA3_5_8I2R14Mass.Encloses (∑ a, CA3_5_8I2R14Value a) := by + exact contains_sound (pairSumBall_sound CA3_5_8I2R14P CA3_5_8I2R14Value CA3_5_8I2R14P_sound) (by decide +kernel) +def CA3_5_8I2R14MassTerm : Ball := .exact 0 +lemma CA3_5_8I2R14MassTerm_sound : CA3_5_8I2R14MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA3_5_8I2R14Value a))) := + entropyTerm_zero_ball (CA3_5_8I2R14Mass_sound) +def CA3_5_8I2R14H : Ball := ⟨0, 0⟩ +lemma CA3_5_8I2R14H_sound : CA3_5_8I2R14H.Encloses (homogeneousEntropy CA3_5_8I2R14Value) := by + exact contains_sound (homogeneous_enclosed CA3_5_8I2R14Value CA3_5_8I2R14MassTerm_sound CA3_5_8I2R14Entropy_sound) (by decide +kernel) +def CA3_5_8I2R15Value (a : PairSlot) : ℝ := residualLaw (below (shape 3 5 8)) (fun u => (stageALaw (shape 3 5 8) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 15 a +def CA3_5_8I2R15Raw (a : PairSlot) : Ball := residualBall (below (shape 3 5 8)) A3_5_8Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 15 a +lemma CA3_5_8I2R15Raw_sound (a : PairSlot) : + (CA3_5_8I2R15Raw a).Encloses (CA3_5_8I2R15Value a) := by + exact residualBall_sound_on (below (shape 3 5 8)) A3_5_8Law (fun u => (stageALaw (shape 3 5 8) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A3_5_8Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 3 5 8) (show (shape 3 5 8) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 15 a +def CA3_5_8I2R15Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA3_5_8I2R15Certificates_valid : + CA3_5_8I2R15Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA3_5_8I2R15CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA3_5_8I2R15P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_5_8I2R15Certificates (CA3_5_8I2R15CertificateIndex a)).input +lemma CA3_5_8I2R15P_check : ∀ a : PairSlot, contains (CA3_5_8I2R15Raw a) (CA3_5_8I2R15P a) = true := by + decide +kernel +lemma CA3_5_8I2R15P_sound (a : PairSlot) : + (CA3_5_8I2R15P a).Encloses (CA3_5_8I2R15Value a) := + contains_sound (CA3_5_8I2R15Raw_sound a) (CA3_5_8I2R15P_check a) +def CA3_5_8I2R15Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_5_8I2R15Certificates (CA3_5_8I2R15CertificateIndex a)).output +lemma CA3_5_8I2R15Terms_sound (a : PairSlot) : + (CA3_5_8I2R15Terms a).Encloses (Foundation.entropyTerm (CA3_5_8I2R15Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA3_5_8I2R15Certificates_valid + (CA3_5_8I2R15CertificateIndex a) (CA3_5_8I2R15P_sound a) +def CA3_5_8I2R15Entropy : Ball := ⟨0, 0⟩ +lemma CA3_5_8I2R15Entropy_sound : CA3_5_8I2R15Entropy.Encloses (Foundation.finiteEntropy CA3_5_8I2R15Value) := by + exact contains_sound (entropyPair_enclosed CA3_5_8I2R15Value CA3_5_8I2R15Terms CA3_5_8I2R15Terms_sound) (by decide +kernel) +def CA3_5_8I2R15Mass : Ball := ⟨0, 0⟩ +lemma CA3_5_8I2R15Mass_sound : CA3_5_8I2R15Mass.Encloses (∑ a, CA3_5_8I2R15Value a) := by + exact contains_sound (pairSumBall_sound CA3_5_8I2R15P CA3_5_8I2R15Value CA3_5_8I2R15P_sound) (by decide +kernel) +def CA3_5_8I2R15MassTerm : Ball := .exact 0 +lemma CA3_5_8I2R15MassTerm_sound : CA3_5_8I2R15MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA3_5_8I2R15Value a))) := + entropyTerm_zero_ball (CA3_5_8I2R15Mass_sound) +def CA3_5_8I2R15H : Ball := ⟨0, 0⟩ +lemma CA3_5_8I2R15H_sound : CA3_5_8I2R15H.Encloses (homogeneousEntropy CA3_5_8I2R15Value) := by + exact contains_sound (homogeneous_enclosed CA3_5_8I2R15Value CA3_5_8I2R15MassTerm_sound CA3_5_8I2R15Entropy_sound) (by decide +kernel) +def CA3_5_8I2R16Value (a : PairSlot) : ℝ := residualLaw (below (shape 3 5 8)) (fun u => (stageALaw (shape 3 5 8) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 16 a +def CA3_5_8I2R16Raw (a : PairSlot) : Ball := residualBall (below (shape 3 5 8)) A3_5_8Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 16 a +lemma CA3_5_8I2R16Raw_sound (a : PairSlot) : + (CA3_5_8I2R16Raw a).Encloses (CA3_5_8I2R16Value a) := by + exact residualBall_sound_on (below (shape 3 5 8)) A3_5_8Law (fun u => (stageALaw (shape 3 5 8) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A3_5_8Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 3 5 8) (show (shape 3 5 8) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 16 a +def CA3_5_8I2R16Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA3_5_8I2R16Certificates_valid : + CA3_5_8I2R16Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA3_5_8I2R16CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA3_5_8I2R16P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_5_8I2R16Certificates (CA3_5_8I2R16CertificateIndex a)).input +lemma CA3_5_8I2R16P_check : ∀ a : PairSlot, contains (CA3_5_8I2R16Raw a) (CA3_5_8I2R16P a) = true := by + decide +kernel +lemma CA3_5_8I2R16P_sound (a : PairSlot) : + (CA3_5_8I2R16P a).Encloses (CA3_5_8I2R16Value a) := + contains_sound (CA3_5_8I2R16Raw_sound a) (CA3_5_8I2R16P_check a) +def CA3_5_8I2R16Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_5_8I2R16Certificates (CA3_5_8I2R16CertificateIndex a)).output +lemma CA3_5_8I2R16Terms_sound (a : PairSlot) : + (CA3_5_8I2R16Terms a).Encloses (Foundation.entropyTerm (CA3_5_8I2R16Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA3_5_8I2R16Certificates_valid + (CA3_5_8I2R16CertificateIndex a) (CA3_5_8I2R16P_sound a) +def CA3_5_8I2R16Entropy : Ball := ⟨0, 0⟩ +lemma CA3_5_8I2R16Entropy_sound : CA3_5_8I2R16Entropy.Encloses (Foundation.finiteEntropy CA3_5_8I2R16Value) := by + exact contains_sound (entropyPair_enclosed CA3_5_8I2R16Value CA3_5_8I2R16Terms CA3_5_8I2R16Terms_sound) (by decide +kernel) +def CA3_5_8I2R16Mass : Ball := ⟨0, 0⟩ +lemma CA3_5_8I2R16Mass_sound : CA3_5_8I2R16Mass.Encloses (∑ a, CA3_5_8I2R16Value a) := by + exact contains_sound (pairSumBall_sound CA3_5_8I2R16P CA3_5_8I2R16Value CA3_5_8I2R16P_sound) (by decide +kernel) +def CA3_5_8I2R16MassTerm : Ball := .exact 0 +lemma CA3_5_8I2R16MassTerm_sound : CA3_5_8I2R16MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA3_5_8I2R16Value a))) := + entropyTerm_zero_ball (CA3_5_8I2R16Mass_sound) +def CA3_5_8I2R16H : Ball := ⟨0, 0⟩ +lemma CA3_5_8I2R16H_sound : CA3_5_8I2R16H.Encloses (homogeneousEntropy CA3_5_8I2R16Value) := by + exact contains_sound (homogeneous_enclosed CA3_5_8I2R16Value CA3_5_8I2R16MassTerm_sound CA3_5_8I2R16Entropy_sound) (by decide +kernel) +def CA3_5_8I2ResidualEntropies (a : Fin 17) : Ball := + match a.val with + | 0 => CA3_5_8I2R0H + | 1 => CA3_5_8I2R1H + | 2 => CA3_5_8I2R2H + | 3 => CA3_5_8I2R3H + | 4 => CA3_5_8I2R4H + | 5 => CA3_5_8I2R5H + | 6 => CA3_5_8I2R6H + | 7 => CA3_5_8I2R7H + | 8 => CA3_5_8I2R8H + | 9 => CA3_5_8I2R9H + | 10 => CA3_5_8I2R10H + | 11 => CA3_5_8I2R11H + | 12 => CA3_5_8I2R12H + | 13 => CA3_5_8I2R13H + | 14 => CA3_5_8I2R14H + | 15 => CA3_5_8I2R15H + | 16 => CA3_5_8I2R16H + | _ => (.exact 0) +lemma CA3_5_8I2ResidualEntropies_sound (k : Fin 17) : + (CA3_5_8I2ResidualEntropies k).Encloses (homogeneousEntropy + (residualLaw (below (shape 3 5 8)) (fun u => (stageALaw (shape 3 5 8) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) k)) := by + fin_cases k + · exact CA3_5_8I2R0H_sound + · exact CA3_5_8I2R1H_sound + · exact CA3_5_8I2R2H_sound + · exact CA3_5_8I2R3H_sound + · exact CA3_5_8I2R4H_sound + · exact CA3_5_8I2R5H_sound + · exact CA3_5_8I2R6H_sound + · exact CA3_5_8I2R7H_sound + · exact CA3_5_8I2R8H_sound + · exact CA3_5_8I2R9H_sound + · exact CA3_5_8I2R10H_sound + · exact CA3_5_8I2R11H_sound + · exact CA3_5_8I2R12H_sound + · exact CA3_5_8I2R13H_sound + · exact CA3_5_8I2R14H_sound + · exact CA3_5_8I2R15H_sound + · exact CA3_5_8I2R16H_sound +def CA3_5_8I2Singles (s : Shape) : Ball := + match s 0, s 1, s 2 with + | 0, 0, 8 => Z0_0_8H2H + | 0, 1, 7 => Z0_1_7H2H + | 0, 2, 6 => Z0_2_6H2H + | 0, 3, 5 => Z0_3_5H2H + | 0, 4, 4 => Z0_4_4H2H + | 0, 5, 3 => Z0_5_3H2H + | 1, 0, 7 => Z1_0_7H2H + | 2, 0, 6 => Z2_0_6H2H + | 3, 0, 5 => Z3_0_5H2H + | _, _, _ => (.exact 0) +lemma CA3_5_8I2Singles_sound (u : Shape) (hu : u ∈ below (shape 3 5 8)) + (hd : designated (Equiv.refl (Fin 3)) 2 u) : + (CA3_5_8I2Singles u).Encloses (homogeneousEntropy ((fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) u)) := by + rw [A3_5_8_below] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl + · exact Z0_0_8H2H_sound + · exact Z0_1_7H2H_sound + · exact Z0_2_6H2H_sound + · exact Z0_3_5H2H_sound + · exact Z0_4_4H2H_sound + · exact Z0_5_3H2H_sound + · exact Z1_0_7H2H_sound + · exact (show ¬ designated (Equiv.refl (Fin 3)) 2 (shape 1 1 6) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 2 (shape 1 2 5) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 2 (shape 1 3 4) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 2 (shape 1 4 3) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 2 (shape 1 5 2) by decide +kernel) hd |>.elim + · exact Z2_0_6H2H_sound + · exact (show ¬ designated (Equiv.refl (Fin 3)) 2 (shape 2 1 5) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 2 (shape 2 2 4) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 2 (shape 2 3 3) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 2 (shape 2 4 2) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 2 (shape 2 5 1) by decide +kernel) hd |>.elim + · exact Z3_0_5H2H_sound + · exact (show ¬ designated (Equiv.refl (Fin 3)) 2 (shape 3 1 4) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 2 (shape 3 2 3) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 2 (shape 3 3 2) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 2 (shape 3 4 1) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 2 (shape 3 5 0) by decide +kernel) hd |>.elim +def CA3_5_8I2Singleton : Ball := ⟨(6211276669360813360008105642437 / 50000000000000000000000000000000), (10316298947 / 100000000000000000000000000000000)⟩ +lemma CA3_5_8I2Singleton_sound : CA3_5_8I2Singleton.Encloses + (singletonEntropy (below (shape 3 5 8)) (fun u => (stageALaw (shape 3 5 8) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ))) := by + exact contains_sound (singletonBall_sound (below (shape 3 5 8)) A3_5_8Law (fun u => (stageALaw (shape 3 5 8) u : ℝ)) (Equiv.refl (Fin 3)) 2 + CA3_5_8I2Singles (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A3_5_8Law_sound u) CA3_5_8I2Singles_sound) (by decide +kernel) +def CA3_5_8I2Group : Ball := ⟨(45353578268562637195015629947023 / 50000000000000000000000000000000), (148030447083 / 100000000000000000000000000000000)⟩ +lemma CA3_5_8I2Group_sound : CA3_5_8I2Group.Encloses + (groupedEntropy (below (shape 3 5 8)) (fun u => (stageALaw (shape 3 5 8) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ))) := by + exact contains_sound (Ball.add_sound CA3_5_8I2Singleton_sound + (finSumBall_sound 17 CA3_5_8I2ResidualEntropies _ CA3_5_8I2ResidualEntropies_sound)) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CA3_5_8I2H : Ball := ⟨(50128905296283211989447316523337 / 50000000000000000000000000000000), (216418519571 / 50000000000000000000000000000000)⟩ +lemma CA3_5_8I2_sound : CA3_5_8I2H.Encloses (stageACapacity (shape 3 5 8) 2) := by + have hb := contains_sound (Ball.add_sound CA3_5_8I2PairH_sound + (Ball.neg_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) CA3_5_8I2Group_sound))) + (show contains (.add CA3_5_8I2PairH (.neg (.mul (.exact 2) CA3_5_8I2Group))) CA3_5_8I2H = true by decide +kernel) + unfold CA3_5_8I2PairValue at hb + simpa only [stageACapacity, nativeCapacity, + show (2 : Fin 3) ≠ 0 by decide, ite_false, sub_eq_add_neg] using hb + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA3_5_8I2Pair.lean b/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA3_5_8I2Pair.lean new file mode 100644 index 0000000000000000000000000000000000000000..70d0639eea9e37a3ca7f886410b7dee09898de1f --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA3_5_8I2Pair.lean @@ -0,0 +1,378 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Certificates.SupportedContraction + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CA3_5_8I2PairValue (a : PairSlot × PairSlot) : ℝ := pairLaw (below (shape 3 5 8)) (shape 3 5 8) (fun u => (stageALaw (shape 3 5 8) u : ℝ)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) a +def CA3_5_8I2PairRaw (a : PairSlot × PairSlot) : Ball := stageAPairBall (shape 3 5 8) A3_5_8Law 2 a +lemma CA3_5_8I2PairRaw_sound (a : PairSlot × PairSlot) : + (CA3_5_8I2PairRaw a).Encloses (CA3_5_8I2PairValue a) := by + exact stageAPairBall_sound (shape 3 5 8) (by decide +kernel) A3_5_8Law (fun u => (stageALaw (shape 3 5 8) u : ℝ)) (fun u _ => A3_5_8Law_sound u) 2 a +def CA3_5_8I2PairCertificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(5617321274602978972531421 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(11722525042486881302899449 / 12500000000000000000000000000000), (15473 / 50000000000000000000000000000000)⟩ ⟨(-834741291760308362723103481718601 / 50000000000000000000000000000000), (550589217837 / 100000000000000000000000000000000)⟩ ⟨-25, 5617321274602978972531421, 2980232238769531250000000⟩, + .log ⟨(819643483877255325795700097 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(18062752450434123724719796799 / 100000000000000000000000000000000), (2950633 / 50000000000000000000000000000000)⟩ ⟨(-275466602335898768539326047971541 / 25000000000000000000000000000000), (89997265903 / 25000000000000000000000000000000)⟩ ⟨-16, 819643483877255325795700097, 762939453125000000000000000⟩, + .log ⟨(8903637489240932084988901397 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(3074717488996372688374108849 / 2000000000000000000000000000000), (5279173 / 10000000000000000000000000000000)⟩ ⟨(-863331838451371993078668532754331 / 100000000000000000000000000000000), (296461537177 / 100000000000000000000000000000000)⟩ ⟨-13, 8903637489240932084988901397, 6103515625000000000000000000⟩, + .log ⟨(1020444693939265399681190447 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(11727651425633897198907733341 / 100000000000000000000000000000000), (3889589 / 100000000000000000000000000000000)⟩ ⟨(-1149268695823303575127924754136643 / 100000000000000000000000000000000), (38116492429 / 10000000000000000000000000000000)⟩ ⟨-17, 1020444693939265399681190447, 762939453125000000000000000⟩, + .log ⟨(64174648252217804580891451477 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(58971024592379863499523416381 / 12500000000000000000000000000000), (81537067 / 50000000000000000000000000000000)⟩ ⟨(-91891465241247957091770648412209 / 12500000000000000000000000000000), (127054942877 / 50000000000000000000000000000000)⟩ ⟨-11, 64174648252217804580891451477, 48828125000000000000000000000⟩, + .log ⟨(1400035840436714329462256367 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(3911849811939442349219721419 / 25000000000000000000000000000000), (5336457 / 100000000000000000000000000000000)⟩ ⟨(-139705345354559488450079014741577 / 12500000000000000000000000000000), (9529122443 / 2500000000000000000000000000000)⟩ ⟨-17, 1400035840436714329462256367, 762939453125000000000000000⟩, + .log ⟨(78416760093953301576126687 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(137804155037120538047747859 / 12500000000000000000000000000000), (182667 / 50000000000000000000000000000000)⟩ ⟨(-1405864306273439980123861879428111 / 100000000000000000000000000000000), (465869396263 / 100000000000000000000000000000000)⟩ ⟨-21, 78416760093953301576126687, 47683715820312500000000000⟩, + .log ⟨(2519370705830409924067689587 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(12465555433905904077210932857 / 25000000000000000000000000000000), (17071931 / 100000000000000000000000000000000)⟩ ⟨(-494788456699036342475879189593621 / 50000000000000000000000000000000), (169406599387 / 50000000000000000000000000000000)⟩ ⟨-15, 2519370705830409924067689587, 1525878906250000000000000000⟩, + .log ⟨(5385456044475545696658041879 / 5000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ ⟨(736029329377867952957143535051 / 100000000000000000000000000000000), (50178249 / 20000000000000000000000000000000)⟩ ⟨(-136669823929376259583582329411437 / 20000000000000000000000000000000), (232934062369 / 100000000000000000000000000000000)⟩ ⟨-10, 5385456044475545696658041879, 4882812500000000000000000000⟩, + .log ⟨(2124314460319178703630725979 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(19911585977747254141237388957 / 25000000000000000000000000000000), (6747619 / 25000000000000000000000000000000)⟩ ⟨(-937318196043138268437526595890727 / 100000000000000000000000000000000), (317637367013 / 100000000000000000000000000000000)⟩ ⟨-14, 2124314460319178703630725979, 1525878906250000000000000000⟩, + .log ⟨(396835775612211099188808420317 / 100000000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ ⟨(548566225428194261620498786593 / 25000000000000000000000000000000), (94537403 / 12500000000000000000000000000000)⟩ ⟨(-22117611733242701707748450871701 / 4000000000000000000000000000000), (95291207077 / 50000000000000000000000000000000)⟩ ⟨-8, 396835775612211099188808420317, 390625000000000000000000000000⟩, + .log ⟨(1926983519145019968589090557 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(20921201541345217215011218629 / 100000000000000000000000000000000), (3468471 / 50000000000000000000000000000000)⟩ ⟨(-135712120352148298657562524433793 / 12500000000000000000000000000000), (71997810901 / 20000000000000000000000000000000)⟩ ⟨-16, 1926983519145019968589090557, 1525878906250000000000000000⟩, + .log ⟨(32691006801542750085404582139 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(479425270114519407312365883573 / 100000000000000000000000000000000), (20767771 / 12500000000000000000000000000000)⟩ ⟨(-733267826569193377169229268641247 / 100000000000000000000000000000000), (10164395429 / 4000000000000000000000000000000)⟩ ⟨-11, 32691006801542750085404582139, 24414062500000000000000000000⟩, + .log ⟨(195646391139131583318183301 / 6250000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(32467230989685725236791665829 / 100000000000000000000000000000000), (1325753 / 12500000000000000000000000000000)⟩ ⟨(-129647288984001449083664943603813 / 12500000000000000000000000000000), (338813210873 / 100000000000000000000000000000000)⟩ ⟨-15, 195646391139131583318183301, 190734863281250000000000000⟩, + .log ⟨(109128938005066014617607295863 / 100000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ ⟨(363428956487879210055315193 / 48828125000000000000000000000), (254198483 / 100000000000000000000000000000000)⟩ ⟨(-170509884108975842773156468305419 / 25000000000000000000000000000000), (46586812469 / 20000000000000000000000000000000)⟩ ⟨-10, 109128938005066014617607295863, 97656250000000000000000000000⟩, + .log ⟨(3813707784333437505670972146961 / 100000000000000000000000000000000), (1 / 5000000000000000000000000000000)⟩ ⟨(12457736947409570130649167160173 / 100000000000000000000000000000000), (4845504303 / 100000000000000000000000000000000)⟩ ⟨(-326656829833304652193801226080571 / 100000000000000000000000000000000), (63527471311 / 50000000000000000000000000000000)⟩ ⟨-5, 3813707784333437505670972146961, 3125000000000000000000000000000⟩, + .log ⟨(41617297379180389563679349409 / 20000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ ⟨(1284928161347738247694315179457 / 100000000000000000000000000000000), (440640291 / 100000000000000000000000000000000)⟩ ⟨(-123499433386132447009470413029971 / 20000000000000000000000000000000), (211758237791 / 100000000000000000000000000000000)⟩ ⟨-9, 41617297379180389563679349409, 39062500000000000000000000000⟩, + .log ⟨(2921105303952607369193418043 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(1779649852244778863282276697 / 3125000000000000000000000000000), (19794191 / 100000000000000000000000000000000)⟩ ⟨(-974781621100313351366086638813699 / 100000000000000000000000000000000), (84703299011 / 25000000000000000000000000000000)⟩ ⟨-15, 2921105303952607369193418043, 1525878906250000000000000000⟩, + .log ⟨(202600551262582314052303348047 / 100000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ ⟨(1256465640998678183004068193931 / 100000000000000000000000000000000), (42902337 / 10000000000000000000000000000000)⟩ ⟨(-620168915221866447135883621977051 / 100000000000000000000000000000000), (26469779727 / 12500000000000000000000000000000)⟩ ⟨-9, 202600551262582314052303348047, 195312500000000000000000000000⟩, + .log ⟨(10601997379467408042590823611 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(3881129604352753001244315229 / 4000000000000000000000000000000), (6735183 / 20000000000000000000000000000000)⟩ ⟨(-457594152478903198608706524215943 / 50000000000000000000000000000000), (317637364677 / 100000000000000000000000000000000)⟩ ⟨-14, 10601997379467408042590823611, 6103515625000000000000000000⟩, + .log ⟨(1330119990662189447809421 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(54953819875058159835380181 / 50000000000000000000000000000000), (17613 / 50000000000000000000000000000000)⟩ ⟨(-1652597367481105110819055843405017 / 100000000000000000000000000000000), (66176328539 / 12500000000000000000000000000000)⟩ ⟨-24, 1330119990662189447809421, 1192092895507812500000000⟩, + .log ⟨(1631492498870467132822097587 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(8992321862459295203685316657 / 50000000000000000000000000000000), (2936603 / 50000000000000000000000000000000)⟩ ⟨(-551171511280925813518881260008877 / 50000000000000000000000000000000), (11249658247 / 3125000000000000000000000000000)⟩ ⟨-16, 1631492498870467132822097587, 1525878906250000000000000000⟩, + .log ⟨(1995633271554203186043621073 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(27914990026038114033709236809 / 20000000000000000000000000000000), (4733029 / 10000000000000000000000000000000)⟩ ⟨(-34970089975872500776427702740343 / 4000000000000000000000000000000), (11858461513 / 4000000000000000000000000000000)⟩ ⟨-13, 1995633271554203186043621073, 1525878906250000000000000000⟩, + .log ⟨(33395558071444192952734659 / 4000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(976267545736087092847422269 / 10000000000000000000000000000000), (3182317 / 100000000000000000000000000000000)⟩ ⟨(-233867640396372832485690305874423 / 20000000000000000000000000000000), (38116494607 / 10000000000000000000000000000000)⟩ ⟨-17, 33395558071444192952734659, 30517578125000000000000000⟩, + .log ⟨(25868768152316322145565979 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(19618413775692061414917321 / 5000000000000000000000000000000), (126009 / 100000000000000000000000000000000)⟩ ⟨(-11849722160726106540499854328881 / 781250000000000000000000000000), (243523905187 / 50000000000000000000000000000000)⟩ ⟨-22, 25868768152316322145565979, 23841857910156250000000000⟩, + .log ⟨(383758737334658633789200271779 / 100000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ ⟨(1067407927006139071983275754023 / 50000000000000000000000000000000), (203160189 / 25000000000000000000000000000000)⟩ ⟨(-22251645592116922311131320214201 / 4000000000000000000000000000000), (52939559403 / 25000000000000000000000000000000)⟩ ⟨-9, 383758737334658633789200271779, 195312500000000000000000000000⟩, + .log ⟨(1876507424749723072543842917371 / 50000000000000000000000000000000), (1 / 5000000000000000000000000000000)⟩ ⟨(1539960842066921585742123263901 / 12500000000000000000000000000000), (476839093 / 10000000000000000000000000000000)⟩ ⟨(-32826107091418772645075992858729 / 10000000000000000000000000000000), (12705494263 / 10000000000000000000000000000000)⟩ ⟨-5, 1876507424749723072543842917371, 1562500000000000000000000000000⟩, + .log ⟨(190415806812329267783599777247 / 100000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ ⟨(1192710407649934539517482845573 / 100000000000000000000000000000000), (221771643 / 50000000000000000000000000000000)⟩ ⟨(-156592883177163251649966848923619 / 25000000000000000000000000000000), (232934061563 / 100000000000000000000000000000000)⟩ ⟨-10, 190415806812329267783599777247, 97656250000000000000000000000⟩, + .log ⟨(8957197016011199063399836861 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(83485269231936043281761200009 / 100000000000000000000000000000000), (5690283 / 20000000000000000000000000000000)⟩ ⟨(-233011702999007872800510493340163 / 25000000000000000000000000000000), (317637366409 / 100000000000000000000000000000000)⟩ ⟨-14, 8957197016011199063399836861, 6103515625000000000000000000⟩, + .log ⟨(9189020944276481774166037225939 / 25000000000000000000000000000000), (1 / 781250000000000000000000000000)⟩ ⟨(18393965158387442646575608391291 / 50000000000000000000000000000000), (23350210737 / 100000000000000000000000000000000)⟩ ⟨(-100086642907503639674737385908597 / 100000000000000000000000000000000), (63527471397 / 100000000000000000000000000000000)⟩ ⟨-2, 9189020944276481774166037225939, 6250000000000000000000000000000⟩, + .log ⟨(115634741001729348611523861267 / 6250000000000000000000000000000), (9 / 100000000000000000000000000000000)⟩ ⟨(7381937412310331895420834495939 / 100000000000000000000000000000000), (2742500239 / 100000000000000000000000000000000)⟩ ⟨(-398990030394495210494790939190677 / 100000000000000000000000000000000), (148230766267 / 100000000000000000000000000000000)⟩ ⟨-6, 115634741001729348611523861267, 97656250000000000000000000000⟩, + .log ⟨(46503556320805771095749341271 / 50000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ ⟨(2028790159444861342324797019 / 312500000000000000000000000000), (236340283 / 100000000000000000000000000000000)⟩ ⟨(-349012474736204574523602699476683 / 50000000000000000000000000000000), (127054943173 / 50000000000000000000000000000000)⟩ ⟨-11, 46503556320805771095749341271, 24414062500000000000000000000⟩, + .log ⟨(93407296422732128323607612567 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(162901297542374271586422076439 / 25000000000000000000000000000000), (237357181 / 100000000000000000000000000000000)⟩ ⟨(-87199450032861506645920714222819 / 12500000000000000000000000000000), (127054942633 / 50000000000000000000000000000000)⟩ ⟨-11, 93407296422732128323607612567, 48828125000000000000000000000⟩, + .log ⟨(152083849761433269849477773 / 3125000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(9665731975525424283768408843 / 20000000000000000000000000000000), (1030561 / 6250000000000000000000000000000)⟩ ⟨(-993051282923819668378977624490419 / 100000000000000000000000000000000), (84703299869 / 25000000000000000000000000000000)⟩ ⟨-15, 152083849761433269849477773, 95367431640625000000000000⟩, + .log ⟨(13837541724386051738744051 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(208948931454478565740040937 / 50000000000000000000000000000000), (134807 / 100000000000000000000000000000000)⟩ ⟨(-1510014825004975914555849677154377 / 100000000000000000000000000000000), (487047558067 / 100000000000000000000000000000000)⟩ ⟨-22, 13837541724386051738744051, 11920928955078125000000000⟩] +lemma CA3_5_8I2PairCertificates_valid : + CA3_5_8I2PairCertificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA3_5_8I2PairCertificateIndex (a : PairSlot × PairSlot) : ℕ := + match a.1.1.val, a.1.2.val, a.2.1.val, a.2.2.val with + | 5, 5, 0, 0 => 1 + | 4, 5, 1, 0 => 2 + | 4, 5, 0, 1 => 2 + | 5, 4, 1, 0 => 2 + | 5, 4, 0, 1 => 2 + | 2, 5, 2, 0 => 3 + | 2, 5, 3, 0 => 4 + | 2, 5, 1, 1 => 5 + | 2, 5, 0, 2 => 3 + | 2, 5, 0, 3 => 4 + | 3, 5, 2, 0 => 6 + | 3, 5, 3, 0 => 7 + | 3, 5, 1, 1 => 8 + | 3, 5, 0, 2 => 6 + | 3, 5, 0, 3 => 7 + | 4, 4, 2, 0 => 9 + | 4, 4, 3, 0 => 10 + | 4, 4, 1, 1 => 11 + | 4, 4, 0, 2 => 9 + | 4, 4, 0, 3 => 10 + | 5, 2, 2, 0 => 3 + | 5, 2, 3, 0 => 4 + | 5, 2, 1, 1 => 5 + | 5, 2, 0, 2 => 3 + | 5, 2, 0, 3 => 4 + | 5, 3, 2, 0 => 6 + | 5, 3, 3, 0 => 7 + | 5, 3, 1, 1 => 8 + | 5, 3, 0, 2 => 6 + | 5, 3, 0, 3 => 7 + | 1, 5, 4, 0 => 12 + | 1, 5, 2, 1 => 13 + | 1, 5, 3, 1 => 14 + | 1, 5, 1, 2 => 13 + | 1, 5, 1, 3 => 14 + | 1, 5, 0, 4 => 12 + | 2, 4, 4, 0 => 15 + | 2, 4, 2, 1 => 16 + | 2, 4, 3, 1 => 17 + | 2, 4, 1, 2 => 16 + | 2, 4, 1, 3 => 17 + | 2, 4, 0, 4 => 15 + | 3, 4, 4, 0 => 18 + | 3, 4, 2, 1 => 19 + | 3, 4, 3, 1 => 20 + | 3, 4, 1, 2 => 19 + | 3, 4, 1, 3 => 20 + | 3, 4, 0, 4 => 18 + | 4, 2, 4, 0 => 15 + | 4, 2, 2, 1 => 16 + | 4, 2, 3, 1 => 17 + | 4, 2, 1, 2 => 16 + | 4, 2, 1, 3 => 17 + | 4, 2, 0, 4 => 15 + | 4, 3, 4, 0 => 18 + | 4, 3, 2, 1 => 19 + | 4, 3, 3, 1 => 20 + | 4, 3, 1, 2 => 19 + | 4, 3, 1, 3 => 20 + | 4, 3, 0, 4 => 18 + | 5, 1, 4, 0 => 12 + | 5, 1, 2, 1 => 13 + | 5, 1, 3, 1 => 14 + | 5, 1, 1, 2 => 13 + | 5, 1, 1, 3 => 14 + | 5, 1, 0, 4 => 12 + | 5, 0, 5, 0 => 21 + | 5, 0, 4, 1 => 22 + | 5, 0, 2, 2 => 23 + | 5, 0, 2, 3 => 24 + | 5, 0, 3, 2 => 24 + | 5, 0, 3, 3 => 25 + | 5, 0, 1, 4 => 22 + | 5, 0, 0, 5 => 21 + | 4, 1, 5, 0 => 22 + | 4, 1, 4, 1 => 26 + | 4, 1, 2, 2 => 27 + | 4, 1, 2, 3 => 28 + | 4, 1, 3, 2 => 28 + | 4, 1, 3, 3 => 29 + | 4, 1, 1, 4 => 26 + | 4, 1, 0, 5 => 22 + | 2, 2, 5, 0 => 23 + | 2, 2, 4, 1 => 27 + | 2, 2, 2, 2 => 30 + | 2, 2, 2, 3 => 31 + | 2, 2, 3, 2 => 31 + | 2, 2, 3, 3 => 32 + | 2, 2, 1, 4 => 27 + | 2, 2, 0, 5 => 23 + | 2, 3, 5, 0 => 24 + | 2, 3, 4, 1 => 28 + | 2, 3, 2, 2 => 31 + | 2, 3, 2, 3 => 33 + | 2, 3, 3, 2 => 33 + | 2, 3, 3, 3 => 34 + | 2, 3, 1, 4 => 28 + | 2, 3, 0, 5 => 24 + | 3, 2, 5, 0 => 24 + | 3, 2, 4, 1 => 28 + | 3, 2, 2, 2 => 31 + | 3, 2, 2, 3 => 33 + | 3, 2, 3, 2 => 33 + | 3, 2, 3, 3 => 34 + | 3, 2, 1, 4 => 28 + | 3, 2, 0, 5 => 24 + | 3, 3, 5, 0 => 25 + | 3, 3, 4, 1 => 29 + | 3, 3, 2, 2 => 32 + | 3, 3, 2, 3 => 34 + | 3, 3, 3, 2 => 34 + | 3, 3, 3, 3 => 35 + | 3, 3, 1, 4 => 29 + | 3, 3, 0, 5 => 25 + | 1, 4, 5, 0 => 22 + | 1, 4, 4, 1 => 26 + | 1, 4, 2, 2 => 27 + | 1, 4, 2, 3 => 28 + | 1, 4, 3, 2 => 28 + | 1, 4, 3, 3 => 29 + | 1, 4, 1, 4 => 26 + | 1, 4, 0, 5 => 22 + | 0, 5, 5, 0 => 21 + | 0, 5, 4, 1 => 22 + | 0, 5, 2, 2 => 23 + | 0, 5, 2, 3 => 24 + | 0, 5, 3, 2 => 24 + | 0, 5, 3, 3 => 25 + | 0, 5, 1, 4 => 22 + | 0, 5, 0, 5 => 21 + | 4, 0, 1, 5 => 12 + | 4, 0, 2, 4 => 15 + | 4, 0, 3, 4 => 18 + | 4, 0, 4, 2 => 15 + | 4, 0, 4, 3 => 18 + | 4, 0, 5, 1 => 12 + | 2, 1, 1, 5 => 13 + | 2, 1, 2, 4 => 16 + | 2, 1, 3, 4 => 19 + | 2, 1, 4, 2 => 16 + | 2, 1, 4, 3 => 19 + | 2, 1, 5, 1 => 13 + | 3, 1, 1, 5 => 14 + | 3, 1, 2, 4 => 17 + | 3, 1, 3, 4 => 20 + | 3, 1, 4, 2 => 17 + | 3, 1, 4, 3 => 20 + | 3, 1, 5, 1 => 14 + | 1, 2, 1, 5 => 13 + | 1, 2, 2, 4 => 16 + | 1, 2, 3, 4 => 19 + | 1, 2, 4, 2 => 16 + | 1, 2, 4, 3 => 19 + | 1, 2, 5, 1 => 13 + | 1, 3, 1, 5 => 14 + | 1, 3, 2, 4 => 17 + | 1, 3, 3, 4 => 20 + | 1, 3, 4, 2 => 17 + | 1, 3, 4, 3 => 20 + | 1, 3, 5, 1 => 14 + | 0, 4, 1, 5 => 12 + | 0, 4, 2, 4 => 15 + | 0, 4, 3, 4 => 18 + | 0, 4, 4, 2 => 15 + | 0, 4, 4, 3 => 18 + | 0, 4, 5, 1 => 12 + | 2, 0, 2, 5 => 3 + | 2, 0, 3, 5 => 6 + | 2, 0, 4, 4 => 9 + | 2, 0, 5, 2 => 3 + | 2, 0, 5, 3 => 6 + | 3, 0, 2, 5 => 4 + | 3, 0, 3, 5 => 7 + | 3, 0, 4, 4 => 10 + | 3, 0, 5, 2 => 4 + | 3, 0, 5, 3 => 7 + | 1, 1, 2, 5 => 5 + | 1, 1, 3, 5 => 8 + | 1, 1, 4, 4 => 11 + | 1, 1, 5, 2 => 5 + | 1, 1, 5, 3 => 8 + | 0, 2, 2, 5 => 3 + | 0, 2, 3, 5 => 6 + | 0, 2, 4, 4 => 9 + | 0, 2, 5, 2 => 3 + | 0, 2, 5, 3 => 6 + | 0, 3, 2, 5 => 4 + | 0, 3, 3, 5 => 7 + | 0, 3, 4, 4 => 10 + | 0, 3, 5, 2 => 4 + | 0, 3, 5, 3 => 7 + | 1, 0, 4, 5 => 2 + | 1, 0, 5, 4 => 2 + | 0, 1, 4, 5 => 2 + | 0, 1, 5, 4 => 2 + | 0, 0, 5, 5 => 1 + | _, _, _, _ => 0 +def CA3_5_8I2PairP (a : PairSlot × PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_5_8I2PairCertificates (CA3_5_8I2PairCertificateIndex a)).input +lemma CA3_5_8I2PairP_check_0_0 : ∀ k l : Fin 6, contains (CA3_5_8I2PairRaw ((0,0),(k,l))) (CA3_5_8I2PairP ((0,0),(k,l))) = true := by + decide +kernel +lemma CA3_5_8I2PairP_check_0_1 : ∀ k l : Fin 6, contains (CA3_5_8I2PairRaw ((0,1),(k,l))) (CA3_5_8I2PairP ((0,1),(k,l))) = true := by + decide +kernel +lemma CA3_5_8I2PairP_check_0_2 : ∀ k l : Fin 6, contains (CA3_5_8I2PairRaw ((0,2),(k,l))) (CA3_5_8I2PairP ((0,2),(k,l))) = true := by + decide +kernel +lemma CA3_5_8I2PairP_check_0_3 : ∀ k l : Fin 6, contains (CA3_5_8I2PairRaw ((0,3),(k,l))) (CA3_5_8I2PairP ((0,3),(k,l))) = true := by + decide +kernel +lemma CA3_5_8I2PairP_check_0_4 : ∀ k l : Fin 6, contains (CA3_5_8I2PairRaw ((0,4),(k,l))) (CA3_5_8I2PairP ((0,4),(k,l))) = true := by + decide +kernel +lemma CA3_5_8I2PairP_check_0_5 : ∀ k l : Fin 6, contains (CA3_5_8I2PairRaw ((0,5),(k,l))) (CA3_5_8I2PairP ((0,5),(k,l))) = true := by + decide +kernel +lemma CA3_5_8I2PairP_check_1_0 : ∀ k l : Fin 6, contains (CA3_5_8I2PairRaw ((1,0),(k,l))) (CA3_5_8I2PairP ((1,0),(k,l))) = true := by + decide +kernel +lemma CA3_5_8I2PairP_check_1_1 : ∀ k l : Fin 6, contains (CA3_5_8I2PairRaw ((1,1),(k,l))) (CA3_5_8I2PairP ((1,1),(k,l))) = true := by + decide +kernel +lemma CA3_5_8I2PairP_check_1_2 : ∀ k l : Fin 6, contains (CA3_5_8I2PairRaw ((1,2),(k,l))) (CA3_5_8I2PairP ((1,2),(k,l))) = true := by + decide +kernel +lemma CA3_5_8I2PairP_check_1_3 : ∀ k l : Fin 6, contains (CA3_5_8I2PairRaw ((1,3),(k,l))) (CA3_5_8I2PairP ((1,3),(k,l))) = true := by + decide +kernel +lemma CA3_5_8I2PairP_check_1_4 : ∀ k l : Fin 6, contains (CA3_5_8I2PairRaw ((1,4),(k,l))) (CA3_5_8I2PairP ((1,4),(k,l))) = true := by + decide +kernel +lemma CA3_5_8I2PairP_check_1_5 : ∀ k l : Fin 6, contains (CA3_5_8I2PairRaw ((1,5),(k,l))) (CA3_5_8I2PairP ((1,5),(k,l))) = true := by + decide +kernel +lemma CA3_5_8I2PairP_check_2_0 : ∀ k l : Fin 6, contains (CA3_5_8I2PairRaw ((2,0),(k,l))) (CA3_5_8I2PairP ((2,0),(k,l))) = true := by + decide +kernel +lemma CA3_5_8I2PairP_check_2_1 : ∀ k l : Fin 6, contains (CA3_5_8I2PairRaw ((2,1),(k,l))) (CA3_5_8I2PairP ((2,1),(k,l))) = true := by + decide +kernel +lemma CA3_5_8I2PairP_check_2_2 : ∀ k l : Fin 6, contains (CA3_5_8I2PairRaw ((2,2),(k,l))) (CA3_5_8I2PairP ((2,2),(k,l))) = true := by + decide +kernel +lemma CA3_5_8I2PairP_check_2_3 : ∀ k l : Fin 6, contains (CA3_5_8I2PairRaw ((2,3),(k,l))) (CA3_5_8I2PairP ((2,3),(k,l))) = true := by + decide +kernel +lemma CA3_5_8I2PairP_check_2_4 : ∀ k l : Fin 6, contains (CA3_5_8I2PairRaw ((2,4),(k,l))) (CA3_5_8I2PairP ((2,4),(k,l))) = true := by + decide +kernel +lemma CA3_5_8I2PairP_check_2_5 : ∀ k l : Fin 6, contains (CA3_5_8I2PairRaw ((2,5),(k,l))) (CA3_5_8I2PairP ((2,5),(k,l))) = true := by + decide +kernel +lemma CA3_5_8I2PairP_check_3_0 : ∀ k l : Fin 6, contains (CA3_5_8I2PairRaw ((3,0),(k,l))) (CA3_5_8I2PairP ((3,0),(k,l))) = true := by + decide +kernel +lemma CA3_5_8I2PairP_check_3_1 : ∀ k l : Fin 6, contains (CA3_5_8I2PairRaw ((3,1),(k,l))) (CA3_5_8I2PairP ((3,1),(k,l))) = true := by + decide +kernel +lemma CA3_5_8I2PairP_check_3_2 : ∀ k l : Fin 6, contains (CA3_5_8I2PairRaw ((3,2),(k,l))) (CA3_5_8I2PairP ((3,2),(k,l))) = true := by + decide +kernel +lemma CA3_5_8I2PairP_check_3_3 : ∀ k l : Fin 6, contains (CA3_5_8I2PairRaw ((3,3),(k,l))) (CA3_5_8I2PairP ((3,3),(k,l))) = true := by + decide +kernel +lemma CA3_5_8I2PairP_check_3_4 : ∀ k l : Fin 6, contains (CA3_5_8I2PairRaw ((3,4),(k,l))) (CA3_5_8I2PairP ((3,4),(k,l))) = true := by + decide +kernel +lemma CA3_5_8I2PairP_check_3_5 : ∀ k l : Fin 6, contains (CA3_5_8I2PairRaw ((3,5),(k,l))) (CA3_5_8I2PairP ((3,5),(k,l))) = true := by + decide +kernel +lemma CA3_5_8I2PairP_check_4_0 : ∀ k l : Fin 6, contains (CA3_5_8I2PairRaw ((4,0),(k,l))) (CA3_5_8I2PairP ((4,0),(k,l))) = true := by + decide +kernel +lemma CA3_5_8I2PairP_check_4_1 : ∀ k l : Fin 6, contains (CA3_5_8I2PairRaw ((4,1),(k,l))) (CA3_5_8I2PairP ((4,1),(k,l))) = true := by + decide +kernel +lemma CA3_5_8I2PairP_check_4_2 : ∀ k l : Fin 6, contains (CA3_5_8I2PairRaw ((4,2),(k,l))) (CA3_5_8I2PairP ((4,2),(k,l))) = true := by + decide +kernel +lemma CA3_5_8I2PairP_check_4_3 : ∀ k l : Fin 6, contains (CA3_5_8I2PairRaw ((4,3),(k,l))) (CA3_5_8I2PairP ((4,3),(k,l))) = true := by + decide +kernel +lemma CA3_5_8I2PairP_check_4_4 : ∀ k l : Fin 6, contains (CA3_5_8I2PairRaw ((4,4),(k,l))) (CA3_5_8I2PairP ((4,4),(k,l))) = true := by + decide +kernel +lemma CA3_5_8I2PairP_check_4_5 : ∀ k l : Fin 6, contains (CA3_5_8I2PairRaw ((4,5),(k,l))) (CA3_5_8I2PairP ((4,5),(k,l))) = true := by + decide +kernel +lemma CA3_5_8I2PairP_check_5_0 : ∀ k l : Fin 6, contains (CA3_5_8I2PairRaw ((5,0),(k,l))) (CA3_5_8I2PairP ((5,0),(k,l))) = true := by + decide +kernel +lemma CA3_5_8I2PairP_check_5_1 : ∀ k l : Fin 6, contains (CA3_5_8I2PairRaw ((5,1),(k,l))) (CA3_5_8I2PairP ((5,1),(k,l))) = true := by + decide +kernel +lemma CA3_5_8I2PairP_check_5_2 : ∀ k l : Fin 6, contains (CA3_5_8I2PairRaw ((5,2),(k,l))) (CA3_5_8I2PairP ((5,2),(k,l))) = true := by + decide +kernel +lemma CA3_5_8I2PairP_check_5_3 : ∀ k l : Fin 6, contains (CA3_5_8I2PairRaw ((5,3),(k,l))) (CA3_5_8I2PairP ((5,3),(k,l))) = true := by + decide +kernel +lemma CA3_5_8I2PairP_check_5_4 : ∀ k l : Fin 6, contains (CA3_5_8I2PairRaw ((5,4),(k,l))) (CA3_5_8I2PairP ((5,4),(k,l))) = true := by + decide +kernel +lemma CA3_5_8I2PairP_check_5_5 : ∀ k l : Fin 6, contains (CA3_5_8I2PairRaw ((5,5),(k,l))) (CA3_5_8I2PairP ((5,5),(k,l))) = true := by + decide +kernel +lemma CA3_5_8I2PairP_check (a : PairSlot × PairSlot) : contains (CA3_5_8I2PairRaw a) (CA3_5_8I2PairP a) = true := by + rcases a with ⟨⟨i,j⟩,⟨k,l⟩⟩ + revert j i + apply forall_fin6 + · exact forall_fin6 (CA3_5_8I2PairP_check_0_0 k l) (CA3_5_8I2PairP_check_0_1 k l) (CA3_5_8I2PairP_check_0_2 k l) (CA3_5_8I2PairP_check_0_3 k l) (CA3_5_8I2PairP_check_0_4 k l) (CA3_5_8I2PairP_check_0_5 k l) + · exact forall_fin6 (CA3_5_8I2PairP_check_1_0 k l) (CA3_5_8I2PairP_check_1_1 k l) (CA3_5_8I2PairP_check_1_2 k l) (CA3_5_8I2PairP_check_1_3 k l) (CA3_5_8I2PairP_check_1_4 k l) (CA3_5_8I2PairP_check_1_5 k l) + · exact forall_fin6 (CA3_5_8I2PairP_check_2_0 k l) (CA3_5_8I2PairP_check_2_1 k l) (CA3_5_8I2PairP_check_2_2 k l) (CA3_5_8I2PairP_check_2_3 k l) (CA3_5_8I2PairP_check_2_4 k l) (CA3_5_8I2PairP_check_2_5 k l) + · exact forall_fin6 (CA3_5_8I2PairP_check_3_0 k l) (CA3_5_8I2PairP_check_3_1 k l) (CA3_5_8I2PairP_check_3_2 k l) (CA3_5_8I2PairP_check_3_3 k l) (CA3_5_8I2PairP_check_3_4 k l) (CA3_5_8I2PairP_check_3_5 k l) + · exact forall_fin6 (CA3_5_8I2PairP_check_4_0 k l) (CA3_5_8I2PairP_check_4_1 k l) (CA3_5_8I2PairP_check_4_2 k l) (CA3_5_8I2PairP_check_4_3 k l) (CA3_5_8I2PairP_check_4_4 k l) (CA3_5_8I2PairP_check_4_5 k l) + · exact forall_fin6 (CA3_5_8I2PairP_check_5_0 k l) (CA3_5_8I2PairP_check_5_1 k l) (CA3_5_8I2PairP_check_5_2 k l) (CA3_5_8I2PairP_check_5_3 k l) (CA3_5_8I2PairP_check_5_4 k l) (CA3_5_8I2PairP_check_5_5 k l) +lemma CA3_5_8I2PairP_sound (a : PairSlot × PairSlot) : + (CA3_5_8I2PairP a).Encloses (CA3_5_8I2PairValue a) := + contains_sound (CA3_5_8I2PairRaw_sound a) (CA3_5_8I2PairP_check a) +def CA3_5_8I2PairTerms (a : PairSlot × PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_5_8I2PairCertificates (CA3_5_8I2PairCertificateIndex a)).output +lemma CA3_5_8I2PairTerms_sound (a : PairSlot × PairSlot) : + (CA3_5_8I2PairTerms a).Encloses (Foundation.entropyTerm (CA3_5_8I2PairValue a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA3_5_8I2PairCertificates_valid + (CA3_5_8I2PairCertificateIndex a) (CA3_5_8I2PairP_sound a) +def CA3_5_8I2PairEntropy : Ball := ⟨(70418030916704243189739288208691 / 25000000000000000000000000000000), (57800160329 / 50000000000000000000000000000000)⟩ +lemma CA3_5_8I2PairEntropy_sound : CA3_5_8I2PairEntropy.Encloses (Foundation.finiteEntropy CA3_5_8I2PairValue) := by + exact contains_sound (entropyDoublePair_enclosed CA3_5_8I2PairValue CA3_5_8I2PairTerms CA3_5_8I2PairTerms_sound) (by decide +kernel) +def CA3_5_8I2PairMass : Ball := ⟨(50000000000000000000000000000001 / 50000000000000000000000000000000), (127 / 20000000000000000000000000000000)⟩ +lemma CA3_5_8I2PairMass_sound : CA3_5_8I2PairMass.Encloses (∑ a, CA3_5_8I2PairValue a) := by + exact contains_sound (doublePairSumBall_sound CA3_5_8I2PairP CA3_5_8I2PairValue CA3_5_8I2PairP_sound) (by decide +kernel) +def CA3_5_8I2PairMassTermLogWitness : LogWitness := ⟨0, 50000000000000000000000000000001, 50000000000000000000000000000000⟩ +def CA3_5_8I2PairMassTermLog : Ball := ⟨(1 / 50000000000000000000000000000000), (21175824317 / 100000000000000000000000000000000)⟩ +lemma CA3_5_8I2PairMassTermLog_sound : CA3_5_8I2PairMassTermLog.Encloses (Real.log ((∑ a, CA3_5_8I2PairValue a))) := by + exact checkLog_sound logTwoBall_sound (CA3_5_8I2PairMass_sound) (w := CA3_5_8I2PairMassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA3_5_8I2PairMassTerm : Ball := ⟨(-1 / 50000000000000000000000000000000), (10587912159 / 50000000000000000000000000000000)⟩ +lemma CA3_5_8I2PairMassTerm_sound : CA3_5_8I2PairMassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA3_5_8I2PairValue a))) := by + exact contains_sound (entropyTerm_ball (CA3_5_8I2PairMass_sound) CA3_5_8I2PairMassTermLog_sound) (by decide +kernel) +def CA3_5_8I2PairH : Ball := ⟨(140836061833408486379478576417383 / 50000000000000000000000000000000), (8548509061 / 6250000000000000000000000000000)⟩ +lemma CA3_5_8I2PairH_sound : CA3_5_8I2PairH.Encloses (homogeneousEntropy CA3_5_8I2PairValue) := by + exact contains_sound (homogeneous_enclosed CA3_5_8I2PairValue CA3_5_8I2PairMassTerm_sound CA3_5_8I2PairEntropy_sound) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA3_6_7I0.lean b/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA3_6_7I0.lean new file mode 100644 index 0000000000000000000000000000000000000000..b9921a6f79f2fb1fbe08caa6a46b22e2a36d1e42 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA3_6_7I0.lean @@ -0,0 +1,75 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Certificates.SplitA3_6_7 + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CA3_6_7I0Value (a : Fin 17) : ℝ := marginal (below (shape 3 6 7)) (fun u => (stageALaw (shape 3 6 7) u : ℝ)) ((Equiv.refl (Fin 3)) 0) a +def CA3_6_7I0Raw (a : Fin 17) : Ball := marginalBall (below (shape 3 6 7)) A3_6_7Law ((Equiv.refl (Fin 3)) 0) a +lemma CA3_6_7I0Raw_sound (a : Fin 17) : + (CA3_6_7I0Raw a).Encloses (CA3_6_7I0Value a) := by + exact marginalBall_sound (below (shape 3 6 7)) A3_6_7Law (fun u => (stageALaw (shape 3 6 7) u : ℝ)) (fun u _ => A3_6_7Law_sound u) ((Equiv.refl (Fin 3)) 0) a +def CA3_6_7I0Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(1221182384919200440510029178837 / 12500000000000000000000000000000), (1 / 2500000000000000000000000000000)⟩ ⟨(22722873647123665018424133843591 / 100000000000000000000000000000000), (10343817281 / 100000000000000000000000000000000)⟩ ⟨(-23259090869365844619034633399283 / 10000000000000000000000000000000), (13234889853 / 12500000000000000000000000000000)⟩ ⟨-4, 1221182384919200440510029178837, 781250000000000000000000000000⟩, + .log ⟨(5028817615080799559489970821163 / 12500000000000000000000000000000), (3 / 4000000000000000000000000000000)⟩ ⟨(4578958471496020170345080397317 / 12500000000000000000000000000000), (1277872269 / 5000000000000000000000000000000)⟩ ⟨(-455271877206710810100848304047 / 500000000000000000000000000000), (12705494247 / 20000000000000000000000000000000)⟩ ⟨-2, 5028817615080799559489970821163, 3125000000000000000000000000000⟩] +lemma CA3_6_7I0Certificates_valid : + CA3_6_7I0Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA3_6_7I0CertificateIndex (a : Fin 17) : ℕ := + match a.val with + | 0 => 1 + | 1 => 2 + | 2 => 2 + | 3 => 1 + | _ => 0 +def CA3_6_7I0P (a : Fin 17) : Ball := + (CompactCertificate.entropyLookup CA3_6_7I0Certificates (CA3_6_7I0CertificateIndex a)).input +lemma CA3_6_7I0P_check : ∀ a : Fin 17, contains (CA3_6_7I0Raw a) (CA3_6_7I0P a) = true := by + decide +kernel +lemma CA3_6_7I0P_sound (a : Fin 17) : + (CA3_6_7I0P a).Encloses (CA3_6_7I0Value a) := + contains_sound (CA3_6_7I0Raw_sound a) (CA3_6_7I0P_check a) +def CA3_6_7I0Terms (a : Fin 17) : Ball := + (CompactCertificate.entropyLookup CA3_6_7I0Certificates (CA3_6_7I0CertificateIndex a)).output +lemma CA3_6_7I0Terms_sound (a : Fin 17) : + (CA3_6_7I0Terms a).Encloses (Foundation.entropyTerm (CA3_6_7I0Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA3_6_7I0Certificates_valid + (CA3_6_7I0CertificateIndex a) (CA3_6_7I0P_sound a) +def CA3_6_7I0Entropy : Ball := ⟨(59354541419091826381184777022127 / 50000000000000000000000000000000), (35901262661 / 50000000000000000000000000000000)⟩ +lemma CA3_6_7I0Entropy_sound : CA3_6_7I0Entropy.Encloses (Foundation.finiteEntropy CA3_6_7I0Value) := by + exact contains_sound (entropyFin_enclosed 17 CA3_6_7I0Value CA3_6_7I0Terms CA3_6_7I0Terms_sound) (by decide +kernel) +def CA3_6_7I0Mass : Ball := ⟨1, (23 / 10000000000000000000000000000000)⟩ +lemma CA3_6_7I0Mass_sound : CA3_6_7I0Mass.Encloses (∑ a, CA3_6_7I0Value a) := by + exact contains_sound (finSumBall_sound 17 CA3_6_7I0P CA3_6_7I0Value CA3_6_7I0P_sound) (by decide +kernel) +def CA3_6_7I0MassTermLogWitness : LogWitness := ⟨0, 1, 1⟩ +def CA3_6_7I0MassTermLog : Ball := ⟨0, (2646977989 / 12500000000000000000000000000000)⟩ +lemma CA3_6_7I0MassTermLog_sound : CA3_6_7I0MassTermLog.Encloses (Real.log ((∑ a, CA3_6_7I0Value a))) := by + exact checkLog_sound logTwoBall_sound (CA3_6_7I0Mass_sound) (w := CA3_6_7I0MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA3_6_7I0MassTerm : Ball := ⟨0, (21175823913 / 100000000000000000000000000000000)⟩ +lemma CA3_6_7I0MassTerm_sound : CA3_6_7I0MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA3_6_7I0Value a))) := by + exact contains_sound (entropyTerm_ball (CA3_6_7I0Mass_sound) CA3_6_7I0MassTermLog_sound) (by decide +kernel) +def CA3_6_7I0H : Ball := ⟨(59354541419091826381184777022127 / 50000000000000000000000000000000), (18595669847 / 20000000000000000000000000000000)⟩ +lemma CA3_6_7I0H_sound : CA3_6_7I0H.Encloses (homogeneousEntropy CA3_6_7I0Value) := by + exact contains_sound (homogeneous_enclosed CA3_6_7I0Value CA3_6_7I0MassTerm_sound CA3_6_7I0Entropy_sound) (by decide +kernel) +lemma CA3_6_7I0_sound : CA3_6_7I0H.Encloses (stageACapacity (shape 3 6 7) 0) := by + exact CA3_6_7I0H_sound + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA3_6_7I1.lean b/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA3_6_7I1.lean new file mode 100644 index 0000000000000000000000000000000000000000..97deff01abc60d0aee33de58093aad5188de2be5 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA3_6_7I1.lean @@ -0,0 +1,862 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.CapacityA.CapA3_6_7I1Pair + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CA3_6_7I1R0Value (a : PairSlot) : ℝ := residualLaw (below (shape 3 6 7)) (fun u => (stageALaw (shape 3 6 7) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 0 a +def CA3_6_7I1R0Raw (a : PairSlot) : Ball := residualBall (below (shape 3 6 7)) A3_6_7Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 0 a +lemma CA3_6_7I1R0Raw_sound (a : PairSlot) : + (CA3_6_7I1R0Raw a).Encloses (CA3_6_7I1R0Value a) := by + exact residualBall_sound_on (below (shape 3 6 7)) A3_6_7Law (fun u => (stageALaw (shape 3 6 7) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A3_6_7Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 3 6 7) (show (shape 3 6 7) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 0 a +def CA3_6_7I1R0Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(15881943617078418930441913137 / 100000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ ⟨(138931155109136038320014250681 / 100000000000000000000000000000000), (47083883 / 100000000000000000000000000000000)⟩ ⟨(-874774262261820556491951653914897 / 100000000000000000000000000000000), (296461550451 / 100000000000000000000000000000000)⟩ ⟨-13, 15881943617078418930441913137, 12207031250000000000000000000⟩] +lemma CA3_6_7I1R0Certificates_valid : + CA3_6_7I1R0Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA3_6_7I1R0CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 0, 0 => 1 + | _, _ => 0 +def CA3_6_7I1R0P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_6_7I1R0Certificates (CA3_6_7I1R0CertificateIndex a)).input +lemma CA3_6_7I1R0P_check : ∀ a : PairSlot, contains (CA3_6_7I1R0Raw a) (CA3_6_7I1R0P a) = true := by + decide +kernel +lemma CA3_6_7I1R0P_sound (a : PairSlot) : + (CA3_6_7I1R0P a).Encloses (CA3_6_7I1R0Value a) := + contains_sound (CA3_6_7I1R0Raw_sound a) (CA3_6_7I1R0P_check a) +def CA3_6_7I1R0Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_6_7I1R0Certificates (CA3_6_7I1R0CertificateIndex a)).output +lemma CA3_6_7I1R0Terms_sound (a : PairSlot) : + (CA3_6_7I1R0Terms a).Encloses (Foundation.entropyTerm (CA3_6_7I1R0Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA3_6_7I1R0Certificates_valid + (CA3_6_7I1R0CertificateIndex a) (CA3_6_7I1R0P_sound a) +def CA3_6_7I1R0Entropy : Ball := ⟨(138931155109136038320014250681 / 100000000000000000000000000000000), (47083883 / 100000000000000000000000000000000)⟩ +lemma CA3_6_7I1R0Entropy_sound : CA3_6_7I1R0Entropy.Encloses (Foundation.finiteEntropy CA3_6_7I1R0Value) := by + exact contains_sound (entropyPair_enclosed CA3_6_7I1R0Value CA3_6_7I1R0Terms CA3_6_7I1R0Terms_sound) (by decide +kernel) +def CA3_6_7I1R0Mass : Ball := ⟨(15881943617078418930441913137 / 100000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +lemma CA3_6_7I1R0Mass_sound : CA3_6_7I1R0Mass.Encloses (∑ a, CA3_6_7I1R0Value a) := by + exact contains_sound (pairSumBall_sound CA3_6_7I1R0P CA3_6_7I1R0Value CA3_6_7I1R0P_sound) (by decide +kernel) +def CA3_6_7I1R0MassTermLogWitness : LogWitness := ⟨-13, 15881943617078418930441913137, 12207031250000000000000000000⟩ +def CA3_6_7I1R0MassTermLog : Ball := ⟨(-874774262261820556491951653914897 / 100000000000000000000000000000000), (296461550451 / 100000000000000000000000000000000)⟩ +lemma CA3_6_7I1R0MassTermLog_sound : CA3_6_7I1R0MassTermLog.Encloses (Real.log ((∑ a, CA3_6_7I1R0Value a))) := by + exact checkLog_sound logTwoBall_sound (CA3_6_7I1R0Mass_sound) (w := CA3_6_7I1R0MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA3_6_7I1R0MassTerm : Ball := ⟨(138931155109136038320014250681 / 100000000000000000000000000000000), (47083883 / 100000000000000000000000000000000)⟩ +lemma CA3_6_7I1R0MassTerm_sound : CA3_6_7I1R0MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA3_6_7I1R0Value a))) := by + exact contains_sound (entropyTerm_ball (CA3_6_7I1R0Mass_sound) CA3_6_7I1R0MassTermLog_sound) (by decide +kernel) +def CA3_6_7I1R0H : Ball := ⟨0, (47083883 / 50000000000000000000000000000000)⟩ +lemma CA3_6_7I1R0H_sound : CA3_6_7I1R0H.Encloses (homogeneousEntropy CA3_6_7I1R0Value) := by + exact contains_sound (homogeneous_enclosed CA3_6_7I1R0Value CA3_6_7I1R0MassTerm_sound CA3_6_7I1R0Entropy_sound) (by decide +kernel) +def CA3_6_7I1R1Value (a : PairSlot) : ℝ := residualLaw (below (shape 3 6 7)) (fun u => (stageALaw (shape 3 6 7) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 1 a +def CA3_6_7I1R1Raw (a : PairSlot) : Ball := residualBall (below (shape 3 6 7)) A3_6_7Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 1 a +lemma CA3_6_7I1R1Raw_sound (a : PairSlot) : + (CA3_6_7I1R1Raw a).Encloses (CA3_6_7I1R1Value a) := by + exact residualBall_sound_on (below (shape 3 6 7)) A3_6_7Law (fun u => (stageALaw (shape 3 6 7) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A3_6_7Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 3 6 7) (show (shape 3 6 7) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 1 a +def CA3_6_7I1R1Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(138476711256890786760421812117 / 20000000000000000000000000000000), (1 / 20000000000000000000000000000000)⟩ ⟨(1721537416766707285586801572237 / 50000000000000000000000000000000), (1319561321 / 100000000000000000000000000000000)⟩ ⟨(-124319634770430849342773192542109 / 25000000000000000000000000000000), (190582413869 / 100000000000000000000000000000000)⟩ ⟨-8, 138476711256890786760421812117, 78125000000000000000000000000⟩] +lemma CA3_6_7I1R1Certificates_valid : + CA3_6_7I1R1Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA3_6_7I1R1CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 1, 0 => 1 + | 0, 1 => 1 + | _, _ => 0 +def CA3_6_7I1R1P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_6_7I1R1Certificates (CA3_6_7I1R1CertificateIndex a)).input +lemma CA3_6_7I1R1P_check : ∀ a : PairSlot, contains (CA3_6_7I1R1Raw a) (CA3_6_7I1R1P a) = true := by + decide +kernel +lemma CA3_6_7I1R1P_sound (a : PairSlot) : + (CA3_6_7I1R1P a).Encloses (CA3_6_7I1R1Value a) := + contains_sound (CA3_6_7I1R1Raw_sound a) (CA3_6_7I1R1P_check a) +def CA3_6_7I1R1Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_6_7I1R1Certificates (CA3_6_7I1R1CertificateIndex a)).output +lemma CA3_6_7I1R1Terms_sound (a : PairSlot) : + (CA3_6_7I1R1Terms a).Encloses (Foundation.entropyTerm (CA3_6_7I1R1Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA3_6_7I1R1Certificates_valid + (CA3_6_7I1R1CertificateIndex a) (CA3_6_7I1R1P_sound a) +def CA3_6_7I1R1Entropy : Ball := ⟨(1721537416766707285586801572237 / 25000000000000000000000000000000), (1319561321 / 50000000000000000000000000000000)⟩ +lemma CA3_6_7I1R1Entropy_sound : CA3_6_7I1R1Entropy.Encloses (Foundation.finiteEntropy CA3_6_7I1R1Value) := by + exact contains_sound (entropyPair_enclosed CA3_6_7I1R1Value CA3_6_7I1R1Terms CA3_6_7I1R1Terms_sound) (by decide +kernel) +def CA3_6_7I1R1Mass : Ball := ⟨(138476711256890786760421812117 / 10000000000000000000000000000000), (1 / 10000000000000000000000000000000)⟩ +lemma CA3_6_7I1R1Mass_sound : CA3_6_7I1R1Mass.Encloses (∑ a, CA3_6_7I1R1Value a) := by + exact contains_sound (pairSumBall_sound CA3_6_7I1R1P CA3_6_7I1R1Value CA3_6_7I1R1P_sound) (by decide +kernel) +def CA3_6_7I1R1MassTermLogWitness : LogWitness := ⟨-7, 138476711256890786760421812117, 78125000000000000000000000000⟩ +def CA3_6_7I1R1MassTermLog : Ball := ⟨(-213981910512864433214684788559053 / 50000000000000000000000000000000), (84703295093 / 50000000000000000000000000000000)⟩ +lemma CA3_6_7I1R1MassTermLog_sound : CA3_6_7I1R1MassTermLog.Encloses (Real.log ((∑ a, CA3_6_7I1R1Value a))) := by + exact checkLog_sound logTwoBall_sound (CA3_6_7I1R1Mass_sound) (w := CA3_6_7I1R1MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA3_6_7I1R1MassTerm : Ball := ⟨(5926302247257554248919325186761 / 100000000000000000000000000000000), (2345886791 / 100000000000000000000000000000000)⟩ +lemma CA3_6_7I1R1MassTerm_sound : CA3_6_7I1R1MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA3_6_7I1R1Value a))) := by + exact contains_sound (entropyTerm_ball (CA3_6_7I1R1Mass_sound) CA3_6_7I1R1MassTermLog_sound) (by decide +kernel) +def CA3_6_7I1R1H : Ball := ⟨(959847419809274893427881102187 / 100000000000000000000000000000000), (4985009433 / 100000000000000000000000000000000)⟩ +lemma CA3_6_7I1R1H_sound : CA3_6_7I1R1H.Encloses (homogeneousEntropy CA3_6_7I1R1Value) := by + exact contains_sound (homogeneous_enclosed CA3_6_7I1R1Value CA3_6_7I1R1MassTerm_sound CA3_6_7I1R1Entropy_sound) (by decide +kernel) +def CA3_6_7I1R2Value (a : PairSlot) : ℝ := residualLaw (below (shape 3 6 7)) (fun u => (stageALaw (shape 3 6 7) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 2 a +def CA3_6_7I1R2Raw (a : PairSlot) : Ball := residualBall (below (shape 3 6 7)) A3_6_7Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 2 a +lemma CA3_6_7I1R2Raw_sound (a : PairSlot) : + (CA3_6_7I1R2Raw a).Encloses (CA3_6_7I1R2Value a) := by + exact residualBall_sound_on (below (shape 3 6 7)) A3_6_7Law (fun u => (stageALaw (shape 3 6 7) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A3_6_7Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 3 6 7) (show (shape 3 6 7) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 2 a +def CA3_6_7I1R2Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(1936089788641060189129286819729 / 50000000000000000000000000000000), (3 / 12500000000000000000000000000000)⟩ ⟨(12589821288125774712078513172711 / 100000000000000000000000000000000), (4919795623 / 100000000000000000000000000000000)⟩ ⟨(-325135263921890724740271087645451 / 100000000000000000000000000000000), (127054942717 / 100000000000000000000000000000000)⟩ ⟨-5, 1936089788641060189129286819729, 1562500000000000000000000000000⟩, + .log ⟨(333731048993478231219649289233 / 100000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ ⟨(1903131355665175153841589552209 / 100000000000000000000000000000000), (353351503 / 50000000000000000000000000000000)⟩ ⟨(-142564750972748577517317797128361 / 25000000000000000000000000000000), (211758237729 / 100000000000000000000000000000000)⟩ ⟨-9, 333731048993478231219649289233, 195312500000000000000000000000⟩, + .log ⟨(719939496830067873823141073131 / 5000000000000000000000000000000), (59 / 100000000000000000000000000000000)⟩ ⟨(2790522948334547780259183485403 / 10000000000000000000000000000000), (3049062413 / 25000000000000000000000000000000)⟩ ⟨(-193802601511749920210944298725863 / 100000000000000000000000000000000), (84703295141 / 100000000000000000000000000000000)⟩ ⟨-3, 719939496830067873823141073131, 625000000000000000000000000000⟩] +lemma CA3_6_7I1R2Certificates_valid : + CA3_6_7I1R2Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA3_6_7I1R2CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 2, 0 => 1 + | 3, 0 => 2 + | 1, 1 => 3 + | 0, 2 => 1 + | 0, 3 => 2 + | _, _ => 0 +def CA3_6_7I1R2P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_6_7I1R2Certificates (CA3_6_7I1R2CertificateIndex a)).input +lemma CA3_6_7I1R2P_check : ∀ a : PairSlot, contains (CA3_6_7I1R2Raw a) (CA3_6_7I1R2P a) = true := by + decide +kernel +lemma CA3_6_7I1R2P_sound (a : PairSlot) : + (CA3_6_7I1R2P a).Encloses (CA3_6_7I1R2Value a) := + contains_sound (CA3_6_7I1R2Raw_sound a) (CA3_6_7I1R2P_check a) +def CA3_6_7I1R2Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_6_7I1R2Certificates (CA3_6_7I1R2CertificateIndex a)).output +lemma CA3_6_7I1R2Terms_sound (a : PairSlot) : + (CA3_6_7I1R2Terms a).Encloses (Foundation.entropyTerm (CA3_6_7I1R2Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA3_6_7I1R2Certificates_valid + (CA3_6_7I1R2CertificateIndex a) (CA3_6_7I1R2P_sound a) +def CA3_6_7I1R2Entropy : Ball := ⟨(5689113477092737753443204030387 / 10000000000000000000000000000000), (2344924691 / 10000000000000000000000000000000)⟩ +lemma CA3_6_7I1R2Entropy_sound : CA3_6_7I1R2Entropy.Encloses (Foundation.finiteEntropy CA3_6_7I1R2Value) := by + exact contains_sound (entropyPair_enclosed CA3_6_7I1R2Value CA3_6_7I1R2Terms CA3_6_7I1R2Terms_sound) (by decide +kernel) +def CA3_6_7I1R2Mass : Ball := ⟨(11405305594576277347709633660001 / 50000000000000000000000000000000), (113 / 100000000000000000000000000000000)⟩ +lemma CA3_6_7I1R2Mass_sound : CA3_6_7I1R2Mass.Encloses (∑ a, CA3_6_7I1R2Value a) := by + exact contains_sound (pairSumBall_sound CA3_6_7I1R2P CA3_6_7I1R2Value CA3_6_7I1R2P_sound) (by decide +kernel) +def CA3_6_7I1R2MassTermLogWitness : LogWitness := ⟨-3, 11405305594576277347709633660001, 6250000000000000000000000000000⟩ +def CA3_6_7I1R2MassTermLog : Ball := ⟨(-147794435526109069104234588319341 / 100000000000000000000000000000000), (84703295227 / 100000000000000000000000000000000)⟩ +lemma CA3_6_7I1R2MassTermLog_sound : CA3_6_7I1R2MassTermLog.Encloses (Real.log ((∑ a, CA3_6_7I1R2Value a))) := by + exact checkLog_sound logTwoBall_sound (CA3_6_7I1R2Mass_sound) (w := CA3_6_7I1R2MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA3_6_7I1R2MassTerm : Ball := ⟨(33712814047063493684397758180661 / 100000000000000000000000000000000), (19321339507 / 100000000000000000000000000000000)⟩ +lemma CA3_6_7I1R2MassTerm_sound : CA3_6_7I1R2MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA3_6_7I1R2Value a))) := by + exact contains_sound (entropyTerm_ball (CA3_6_7I1R2Mass_sound) CA3_6_7I1R2MassTermLog_sound) (by decide +kernel) +def CA3_6_7I1R2H : Ball := ⟨(23178320723863883850034282123209 / 100000000000000000000000000000000), (42770586417 / 100000000000000000000000000000000)⟩ +lemma CA3_6_7I1R2H_sound : CA3_6_7I1R2H.Encloses (homogeneousEntropy CA3_6_7I1R2Value) := by + exact contains_sound (homogeneous_enclosed CA3_6_7I1R2Value CA3_6_7I1R2MassTerm_sound CA3_6_7I1R2Entropy_sound) (by decide +kernel) +def CA3_6_7I1R3Value (a : PairSlot) : ℝ := residualLaw (below (shape 3 6 7)) (fun u => (stageALaw (shape 3 6 7) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 3 a +def CA3_6_7I1R3Raw (a : PairSlot) : Ball := residualBall (below (shape 3 6 7)) A3_6_7Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 3 a +lemma CA3_6_7I1R3Raw_sound (a : PairSlot) : + (CA3_6_7I1R3Raw a).Encloses (CA3_6_7I1R3Value a) := by + exact residualBall_sound_on (below (shape 3 6 7)) A3_6_7Law (fun u => (stageALaw (shape 3 6 7) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A3_6_7Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 3 6 7) (show (shape 3 6 7) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 3 a +def CA3_6_7I1R3Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(714025282738029143876321607229 / 100000000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ ⟨(141148720482341921721354289019 / 4000000000000000000000000000000), (1360806639 / 100000000000000000000000000000000)⟩ ⟨(-247100354663016174472392982140359 / 50000000000000000000000000000000), (190582413707 / 100000000000000000000000000000000)⟩ ⟨-8, 714025282738029143876321607229, 390625000000000000000000000000⟩, + .log ⟨(185451678816837647798748676809 / 800000000000000000000000000000), (49 / 100000000000000000000000000000000)⟩ ⟨(33887060699442188012228079032257 / 100000000000000000000000000000000), (19635460383 / 100000000000000000000000000000000)⟩ ⟨(-73090868555384557148862175438797 / 50000000000000000000000000000000), (84703294943 / 100000000000000000000000000000000)⟩ ⟨-3, 185451678816837647798748676809, 100000000000000000000000000000⟩, + .log ⟨(946627309909361949663083218669 / 50000000000000000000000000000000), (1 / 20000000000000000000000000000000)⟩ ⟨(7510300286690600210744680743823 / 100000000000000000000000000000000), (2806385847 / 100000000000000000000000000000000)⟩ ⟨(-396687281682677179831631117519803 / 100000000000000000000000000000000), (29646153209 / 20000000000000000000000000000000)⟩ ⟨-6, 946627309909361949663083218669, 781250000000000000000000000000⟩] +lemma CA3_6_7I1R3Certificates_valid : + CA3_6_7I1R3Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA3_6_7I1R3CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 4, 0 => 1 + | 2, 1 => 2 + | 3, 1 => 3 + | 1, 2 => 2 + | 1, 3 => 3 + | 0, 4 => 1 + | _, _ => 0 +def CA3_6_7I1R3P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_6_7I1R3Certificates (CA3_6_7I1R3CertificateIndex a)).input +lemma CA3_6_7I1R3P_check : ∀ a : PairSlot, contains (CA3_6_7I1R3Raw a) (CA3_6_7I1R3P a) = true := by + decide +kernel +lemma CA3_6_7I1R3P_sound (a : PairSlot) : + (CA3_6_7I1R3P a).Encloses (CA3_6_7I1R3Value a) := + contains_sound (CA3_6_7I1R3Raw_sound a) (CA3_6_7I1R3P_check a) +def CA3_6_7I1R3Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_6_7I1R3Certificates (CA3_6_7I1R3CertificateIndex a)).output +lemma CA3_6_7I1R3Terms_sound (a : PairSlot) : + (CA3_6_7I1R3Terms a).Encloses (Foundation.entropyTerm (CA3_6_7I1R3Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA3_6_7I1R3Certificates_valid + (CA3_6_7I1R3CertificateIndex a) (CA3_6_7I1R3P_sound a) +def CA3_6_7I1R3Entropy : Ball := ⟨(8985215799638267253201323400311 / 10000000000000000000000000000000), (23802652869 / 50000000000000000000000000000000)⟩ +lemma CA3_6_7I1R3Entropy_sound : CA3_6_7I1R3Entropy.Encloses (Foundation.finiteEntropy CA3_6_7I1R3Value) := by + exact contains_sound (entropyPair_enclosed CA3_6_7I1R3Value CA3_6_7I1R3Terms CA3_6_7I1R3Terms_sound) (by decide +kernel) +def CA3_6_7I1R3Mass : Ball := ⟨(6447184938665364754511518161423 / 12500000000000000000000000000000), (29 / 25000000000000000000000000000000)⟩ +lemma CA3_6_7I1R3Mass_sound : CA3_6_7I1R3Mass.Encloses (∑ a, CA3_6_7I1R3Value a) := by + exact contains_sound (pairSumBall_sound CA3_6_7I1R3P CA3_6_7I1R3Value CA3_6_7I1R3P_sound) (by decide +kernel) +def CA3_6_7I1R3MassTermLogWitness : LogWitness := ⟨-1, 6447184938665364754511518161423, 6250000000000000000000000000000⟩ +def CA3_6_7I1R3MassTermLog : Ball := ⟨(-16552126309689593680616697644509 / 25000000000000000000000000000000), (4235164759 / 10000000000000000000000000000000)⟩ +lemma CA3_6_7I1R3MassTermLog_sound : CA3_6_7I1R3MassTermLog.Encloses (Real.log ((∑ a, CA3_6_7I1R3Value a))) := by + exact checkLog_sound logTwoBall_sound (CA3_6_7I1R3Mass_sound) (w := CA3_6_7I1R3MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA3_6_7I1R3MassTerm : Ball := ⟨(34148678222949591453344708204229 / 100000000000000000000000000000000), (4368782487 / 20000000000000000000000000000000)⟩ +lemma CA3_6_7I1R3MassTerm_sound : CA3_6_7I1R3MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA3_6_7I1R3Value a))) := by + exact contains_sound (entropyTerm_ball (CA3_6_7I1R3Mass_sound) CA3_6_7I1R3MassTermLog_sound) (by decide +kernel) +def CA3_6_7I1R3H : Ball := ⟨(55703479773433081078668525798881 / 100000000000000000000000000000000), (69449218173 / 100000000000000000000000000000000)⟩ +lemma CA3_6_7I1R3H_sound : CA3_6_7I1R3H.Encloses (homogeneousEntropy CA3_6_7I1R3Value) := by + exact contains_sound (homogeneous_enclosed CA3_6_7I1R3Value CA3_6_7I1R3MassTerm_sound CA3_6_7I1R3Entropy_sound) (by decide +kernel) +def CA3_6_7I1R4Value (a : PairSlot) : ℝ := residualLaw (below (shape 3 6 7)) (fun u => (stageALaw (shape 3 6 7) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 4 a +def CA3_6_7I1R4Raw (a : PairSlot) : Ball := residualBall (below (shape 3 6 7)) A3_6_7Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 4 a +lemma CA3_6_7I1R4Raw_sound (a : PairSlot) : + (CA3_6_7I1R4Raw a).Encloses (CA3_6_7I1R4Value a) := by + exact residualBall_sound_on (below (shape 3 6 7)) A3_6_7Law (fun u => (stageALaw (shape 3 6 7) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A3_6_7Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 3 6 7) (show (shape 3 6 7) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 4 a +def CA3_6_7I1R4Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(17449206100240973783884489231 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(4718718634275632143782608717 / 3125000000000000000000000000000), (25865097 / 50000000000000000000000000000000)⟩ ⟨(-432681565652247440412769657972123 / 50000000000000000000000000000000), (74115384323 / 25000000000000000000000000000000)⟩ ⟨-13, 17449206100240973783884489231, 12207031250000000000000000000⟩, + .log ⟨(1048473505461301894896392378231 / 50000000000000000000000000000000), (3 / 25000000000000000000000000000000)⟩ ⟨(8104045327752314063857938746523 / 100000000000000000000000000000000), (3108320671 / 100000000000000000000000000000000)⟩ ⟨(-386468770338013383674099311727149 / 100000000000000000000000000000000), (148230766353 / 100000000000000000000000000000000)⟩ ⟨-6, 1048473505461301894896392378231, 781250000000000000000000000000⟩, + .log ⟨(8205414907246693647788954606813 / 50000000000000000000000000000000), (63 / 100000000000000000000000000000000)⟩ ⟨(2965812287040774310021676538197 / 10000000000000000000000000000000), (13900513723 / 100000000000000000000000000000000)⟩ ⟨(-45180717863844516577247368990531 / 25000000000000000000000000000000), (16940659023 / 20000000000000000000000000000000)⟩ ⟨-3, 8205414907246693647788954606813, 6250000000000000000000000000000⟩, + .log ⟨(1057609165379279431510471778151 / 100000000000000000000000000000000), (1 / 20000000000000000000000000000000)⟩ ⟨(4811232601866174416802018871507 / 100000000000000000000000000000000), (358331929 / 20000000000000000000000000000000)⟩ ⟨(-227457966485226697727280208609967 / 50000000000000000000000000000000), (10587911871 / 6250000000000000000000000000000)⟩ ⟨-7, 1057609165379279431510471778151, 781250000000000000000000000000⟩, + .log ⟨(871415778983109526048063417 / 1562500000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(417815475405063423742098832997 / 100000000000000000000000000000000), (70859321 / 50000000000000000000000000000000)⟩ ⟨(-749167843944980252131526535566319 / 100000000000000000000000000000000), (63527471497 / 25000000000000000000000000000000)⟩ ⟨-11, 871415778983109526048063417, 762939453125000000000000000⟩] +lemma CA3_6_7I1R4Certificates_valid : + CA3_6_7I1R4Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA3_6_7I1R4CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 0, 5 => 1 + | 1, 4 => 2 + | 2, 2 => 3 + | 2, 3 => 4 + | 3, 2 => 4 + | 3, 3 => 5 + | 4, 1 => 2 + | 5, 0 => 1 + | _, _ => 0 +def CA3_6_7I1R4P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_6_7I1R4Certificates (CA3_6_7I1R4CertificateIndex a)).input +lemma CA3_6_7I1R4P_check : ∀ a : PairSlot, contains (CA3_6_7I1R4Raw a) (CA3_6_7I1R4P a) = true := by + decide +kernel +lemma CA3_6_7I1R4P_sound (a : PairSlot) : + (CA3_6_7I1R4P a).Encloses (CA3_6_7I1R4Value a) := + contains_sound (CA3_6_7I1R4Raw_sound a) (CA3_6_7I1R4P_check a) +def CA3_6_7I1R4Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_6_7I1R4Certificates (CA3_6_7I1R4CertificateIndex a)).output +lemma CA3_6_7I1R4Terms_sound (a : PairSlot) : + (CA3_6_7I1R4Terms a).Encloses (Foundation.entropyTerm (CA3_6_7I1R4Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA3_6_7I1R4Certificates_valid + (CA3_6_7I1R4CertificateIndex a) (CA3_6_7I1R4P_sound a) +def CA3_6_7I1R4Entropy : Ball := ⟨(11241698439528684788496173281783 / 20000000000000000000000000000000), (4789130677 / 20000000000000000000000000000000)⟩ +lemma CA3_6_7I1R4Entropy_sound : CA3_6_7I1R4Entropy.Encloses (Foundation.finiteEntropy CA3_6_7I1R4Value) := by + exact contains_sound (entropyPair_enclosed CA3_6_7I1R4Value CA3_6_7I1R4Terms CA3_6_7I1R4Terms_sound) (by decide +kernel) +def CA3_6_7I1R4Mass : Ball := ⟨(11405305594576277347709633660001 / 50000000000000000000000000000000), (1 / 1000000000000000000000000000000)⟩ +lemma CA3_6_7I1R4Mass_sound : CA3_6_7I1R4Mass.Encloses (∑ a, CA3_6_7I1R4Value a) := by + exact contains_sound (pairSumBall_sound CA3_6_7I1R4P CA3_6_7I1R4Value CA3_6_7I1R4P_sound) (by decide +kernel) +def CA3_6_7I1R4MassTermLogWitness : LogWitness := ⟨-3, 11405305594576277347709633660001, 6250000000000000000000000000000⟩ +def CA3_6_7I1R4MassTermLog : Ball := ⟨(-147794435526109069104234588319341 / 100000000000000000000000000000000), (8470329517 / 10000000000000000000000000000000)⟩ +lemma CA3_6_7I1R4MassTermLog_sound : CA3_6_7I1R4MassTermLog.Encloses (Real.log ((∑ a, CA3_6_7I1R4Value a))) := by + exact checkLog_sound logTwoBall_sound (CA3_6_7I1R4Mass_sound) (w := CA3_6_7I1R4MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA3_6_7I1R4MassTerm : Ball := ⟨(33712814047063493684397758180661 / 100000000000000000000000000000000), (9660669737 / 50000000000000000000000000000000)⟩ +lemma CA3_6_7I1R4MassTerm_sound : CA3_6_7I1R4MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA3_6_7I1R4Value a))) := by + exact contains_sound (entropyTerm_ball (CA3_6_7I1R4Mass_sound) CA3_6_7I1R4MassTermLog_sound) (by decide +kernel) +def CA3_6_7I1R4H : Ball := ⟨(11247839075289965129041554114127 / 50000000000000000000000000000000), (43266992859 / 100000000000000000000000000000000)⟩ +lemma CA3_6_7I1R4H_sound : CA3_6_7I1R4H.Encloses (homogeneousEntropy CA3_6_7I1R4Value) := by + exact contains_sound (homogeneous_enclosed CA3_6_7I1R4Value CA3_6_7I1R4MassTerm_sound CA3_6_7I1R4Entropy_sound) (by decide +kernel) +def CA3_6_7I1R5Value (a : PairSlot) : ℝ := residualLaw (below (shape 3 6 7)) (fun u => (stageALaw (shape 3 6 7) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 5 a +def CA3_6_7I1R5Raw (a : PairSlot) : Ball := residualBall (below (shape 3 6 7)) A3_6_7Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 5 a +lemma CA3_6_7I1R5Raw_sound (a : PairSlot) : + (CA3_6_7I1R5Raw a).Encloses (CA3_6_7I1R5Value a) := by + exact residualBall_sound_on (below (shape 3 6 7)) A3_6_7Law (fun u => (stageALaw (shape 3 6 7) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A3_6_7Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 3 6 7) (show (shape 3 6 7) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 5 a +def CA3_6_7I1R5Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(5855664538841071292921855903 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(195795190306519324931963928669 / 100000000000000000000000000000000), (69439181 / 100000000000000000000000000000000)⟩ ⟨(-104490270173326845688227714298293 / 12500000000000000000000000000000), (296461535831 / 100000000000000000000000000000000)⟩ ⟨-13, 5855664538841071292921855903, 3051757812500000000000000000⟩, + .log ⟨(621791820519049148452018590401 / 100000000000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ ⟨(315890149744856668311079715781 / 10000000000000000000000000000000), (592512947 / 50000000000000000000000000000000)⟩ ⟨(-508032012195276362745904241780051 / 100000000000000000000000000000000), (190582414111 / 100000000000000000000000000000000)⟩ ⟨-8, 621791820519049148452018590401, 390625000000000000000000000000⟩, + .log ⟨(2347338985398713592823333543 / 5000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(22487245902897101440296024941 / 6250000000000000000000000000000), (16154723 / 12500000000000000000000000000000)⟩ ⟨(-153278217029757001386507162984137 / 20000000000000000000000000000000), (275285710009 / 100000000000000000000000000000000)⟩ ⟨-12, 2347338985398713592823333543, 1220703125000000000000000000⟩] +lemma CA3_6_7I1R5Certificates_valid : + CA3_6_7I1R5Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA3_6_7I1R5CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 1, 5 => 1 + | 2, 4 => 2 + | 3, 4 => 3 + | 4, 2 => 2 + | 4, 3 => 3 + | 5, 1 => 1 + | _, _ => 0 +def CA3_6_7I1R5P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_6_7I1R5Certificates (CA3_6_7I1R5CertificateIndex a)).input +lemma CA3_6_7I1R5P_check : ∀ a : PairSlot, contains (CA3_6_7I1R5Raw a) (CA3_6_7I1R5P a) = true := by + decide +kernel +lemma CA3_6_7I1R5P_sound (a : PairSlot) : + (CA3_6_7I1R5P a).Encloses (CA3_6_7I1R5Value a) := + contains_sound (CA3_6_7I1R5Raw_sound a) (CA3_6_7I1R5P_check a) +def CA3_6_7I1R5Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_6_7I1R5Certificates (CA3_6_7I1R5CertificateIndex a)).output +lemma CA3_6_7I1R5Terms_sound (a : PairSlot) : + (CA3_6_7I1R5Terms a).Encloses (Foundation.entropyTerm (CA3_6_7I1R5Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA3_6_7I1R5Certificates_valid + (CA3_6_7I1R5CertificateIndex a) (CA3_6_7I1R5P_sound a) +def CA3_6_7I1R5Entropy : Ball := ⟨(742898524440287926217499497107 / 10000000000000000000000000000000), (1383702859 / 50000000000000000000000000000000)⟩ +lemma CA3_6_7I1R5Entropy_sound : CA3_6_7I1R5Entropy.Encloses (Foundation.finiteEntropy CA3_6_7I1R5Value) := by + exact contains_sound (entropyPair_enclosed CA3_6_7I1R5Value CA3_6_7I1R5Terms CA3_6_7I1R5Terms_sound) (by decide +kernel) +def CA3_6_7I1R5Mass : Ball := ⟨(692161258382387705480172684873 / 50000000000000000000000000000000), (1 / 6250000000000000000000000000000)⟩ +lemma CA3_6_7I1R5Mass_sound : CA3_6_7I1R5Mass.Encloses (∑ a, CA3_6_7I1R5Value a) := by + exact contains_sound (pairSumBall_sound CA3_6_7I1R5P CA3_6_7I1R5Value CA3_6_7I1R5P_sound) (by decide +kernel) +def CA3_6_7I1R5MassTermLogWitness : LogWitness := ⟨-7, 692161258382387705480172684873, 390625000000000000000000000000⟩ +def CA3_6_7I1R5MassTermLog : Ball := ⟨(-427995932359594196573051346155393 / 100000000000000000000000000000000), (169406590619 / 100000000000000000000000000000000)⟩ +lemma CA3_6_7I1R5MassTermLog_sound : CA3_6_7I1R5MassTermLog.Encloses (Real.log ((∑ a, CA3_6_7I1R5Value a))) := by + exact checkLog_sound logTwoBall_sound (CA3_6_7I1R5Mass_sound) (w := CA3_6_7I1R5MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA3_6_7I1R5MassTerm : Ball := ⟨(1184968812498240039997339696673 / 20000000000000000000000000000000), (146570853 / 6250000000000000000000000000000)⟩ +lemma CA3_6_7I1R5MassTerm_sound : CA3_6_7I1R5MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA3_6_7I1R5Value a))) := by + exact contains_sound (entropyTerm_ball (CA3_6_7I1R5Mass_sound) CA3_6_7I1R5MassTermLog_sound) (by decide +kernel) +def CA3_6_7I1R5H : Ball := ⟨(300828236382335812437659297541 / 20000000000000000000000000000000), (2556269683 / 50000000000000000000000000000000)⟩ +lemma CA3_6_7I1R5H_sound : CA3_6_7I1R5H.Encloses (homogeneousEntropy CA3_6_7I1R5Value) := by + exact contains_sound (homogeneous_enclosed CA3_6_7I1R5Value CA3_6_7I1R5MassTerm_sound CA3_6_7I1R5Entropy_sound) (by decide +kernel) +def CA3_6_7I1R6Value (a : PairSlot) : ℝ := residualLaw (below (shape 3 6 7)) (fun u => (stageALaw (shape 3 6 7) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 6 a +def CA3_6_7I1R6Raw (a : PairSlot) : Ball := residualBall (below (shape 3 6 7)) A3_6_7Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 6 a +lemma CA3_6_7I1R6Raw_sound (a : PairSlot) : + (CA3_6_7I1R6Raw a).Encloses (CA3_6_7I1R6Value a) := by + exact residualBall_sound_on (below (shape 3 6 7)) A3_6_7Law (fun u => (stageALaw (shape 3 6 7) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A3_6_7Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 3 6 7) (show (shape 3 6 7) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 6 a +def CA3_6_7I1R6Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(1202706634504621470994420091 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(25582060191803512816614429623 / 100000000000000000000000000000000), (1731847 / 20000000000000000000000000000000)⟩ ⟨(-132940046734362282703330741886437 / 12500000000000000000000000000000), (359989044183 / 100000000000000000000000000000000)⟩ ⟨-16, 1202706634504621470994420091, 762939453125000000000000000⟩, + .log ⟨(33207121215600932422330309 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(276210161386504860547519753 / 12500000000000000000000000000000), (738363 / 100000000000000000000000000000000)⟩ ⟨(-1330847848415065571539999428640029 / 100000000000000000000000000000000), (444692899623 / 100000000000000000000000000000000)⟩ ⟨-20, 33207121215600932422330309, 19073486328125000000000000⟩, + .log ⟨(2668391126036809870753132659 / 25000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ ⟨(48805702964877537274965377389 / 50000000000000000000000000000000), (33903249 / 100000000000000000000000000000000)⟩ ⟨(-114314442344715213282645359303173 / 12500000000000000000000000000000), (317637373983 / 100000000000000000000000000000000)⟩ ⟨-14, 2668391126036809870753132659, 1525878906250000000000000000⟩] +lemma CA3_6_7I1R6Certificates_valid : + CA3_6_7I1R6Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA3_6_7I1R6CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 2, 5 => 1 + | 3, 5 => 2 + | 4, 4 => 3 + | 5, 2 => 1 + | 5, 3 => 2 + | _, _ => 0 +def CA3_6_7I1R6P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_6_7I1R6Certificates (CA3_6_7I1R6CertificateIndex a)).input +lemma CA3_6_7I1R6P_check : ∀ a : PairSlot, contains (CA3_6_7I1R6Raw a) (CA3_6_7I1R6P a) = true := by + decide +kernel +lemma CA3_6_7I1R6P_sound (a : PairSlot) : + (CA3_6_7I1R6P a).Encloses (CA3_6_7I1R6Value a) := + contains_sound (CA3_6_7I1R6Raw_sound a) (CA3_6_7I1R6P_check a) +def CA3_6_7I1R6Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_6_7I1R6Certificates (CA3_6_7I1R6CertificateIndex a)).output +lemma CA3_6_7I1R6Terms_sound (a : PairSlot) : + (CA3_6_7I1R6Terms a).Encloses (Foundation.entropyTerm (CA3_6_7I1R6Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA3_6_7I1R6Certificates_valid + (CA3_6_7I1R6CertificateIndex a) (CA3_6_7I1R6P_sound a) +def CA3_6_7I1R6Entropy : Ball := ⟨(19149361111943272243989991259 / 12500000000000000000000000000000), (10539689 / 20000000000000000000000000000000)⟩ +lemma CA3_6_7I1R6Entropy_sound : CA3_6_7I1R6Entropy.Encloses (Foundation.finiteEntropy CA3_6_7I1R6Value) := by + exact contains_sound (entropyPair_enclosed CA3_6_7I1R6Value CA3_6_7I1R6Terms CA3_6_7I1R6Terms_sound) (by decide +kernel) +def CA3_6_7I1R6Mass : Ball := ⟨(1581646225432173469121351409 / 10000000000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ +lemma CA3_6_7I1R6Mass_sound : CA3_6_7I1R6Mass.Encloses (∑ a, CA3_6_7I1R6Value a) := by + exact contains_sound (pairSumBall_sound CA3_6_7I1R6P CA3_6_7I1R6Value CA3_6_7I1R6P_sound) (by decide +kernel) +def CA3_6_7I1R6MassTermLogWitness : LogWitness := ⟨-13, 1581646225432173469121351409, 1220703125000000000000000000⟩ +def CA3_6_7I1R6MassTermLog : Ball := ⟨(-218796853813083489409265359694123 / 25000000000000000000000000000000), (296461569497 / 100000000000000000000000000000000)⟩ +lemma CA3_6_7I1R6MassTermLog_sound : CA3_6_7I1R6MassTermLog.Encloses (Real.log ((∑ a, CA3_6_7I1R6Value a))) := by + exact checkLog_sound logTwoBall_sound (CA3_6_7I1R6Mass_sound) (w := CA3_6_7I1R6MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA3_6_7I1R6MassTerm : Ball := ⟨(138423687187959420791691804753 / 100000000000000000000000000000000), (9377957 / 20000000000000000000000000000000)⟩ +lemma CA3_6_7I1R6MassTerm_sound : CA3_6_7I1R6MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA3_6_7I1R6Value a))) := by + exact contains_sound (entropyTerm_ball (CA3_6_7I1R6Mass_sound) CA3_6_7I1R6MassTermLog_sound) (by decide +kernel) +def CA3_6_7I1R6H : Ball := ⟨(14771201707586757160228125319 / 100000000000000000000000000000000), (9958823 / 10000000000000000000000000000000)⟩ +lemma CA3_6_7I1R6H_sound : CA3_6_7I1R6H.Encloses (homogeneousEntropy CA3_6_7I1R6Value) := by + exact contains_sound (homogeneous_enclosed CA3_6_7I1R6Value CA3_6_7I1R6MassTerm_sound CA3_6_7I1R6Entropy_sound) (by decide +kernel) +def CA3_6_7I1R7Value (a : PairSlot) : ℝ := residualLaw (below (shape 3 6 7)) (fun u => (stageALaw (shape 3 6 7) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 7 a +def CA3_6_7I1R7Raw (a : PairSlot) : Ball := residualBall (below (shape 3 6 7)) A3_6_7Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 7 a +lemma CA3_6_7I1R7Raw_sound (a : PairSlot) : + (CA3_6_7I1R7Raw a).Encloses (CA3_6_7I1R7Value a) := by + exact residualBall_sound_on (below (shape 3 6 7)) A3_6_7Law (fun u => (stageALaw (shape 3 6 7) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A3_6_7Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 3 6 7) (show (shape 3 6 7) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 7 a +def CA3_6_7I1R7Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA3_6_7I1R7Certificates_valid : + CA3_6_7I1R7Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA3_6_7I1R7CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA3_6_7I1R7P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_6_7I1R7Certificates (CA3_6_7I1R7CertificateIndex a)).input +lemma CA3_6_7I1R7P_check : ∀ a : PairSlot, contains (CA3_6_7I1R7Raw a) (CA3_6_7I1R7P a) = true := by + decide +kernel +lemma CA3_6_7I1R7P_sound (a : PairSlot) : + (CA3_6_7I1R7P a).Encloses (CA3_6_7I1R7Value a) := + contains_sound (CA3_6_7I1R7Raw_sound a) (CA3_6_7I1R7P_check a) +def CA3_6_7I1R7Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_6_7I1R7Certificates (CA3_6_7I1R7CertificateIndex a)).output +lemma CA3_6_7I1R7Terms_sound (a : PairSlot) : + (CA3_6_7I1R7Terms a).Encloses (Foundation.entropyTerm (CA3_6_7I1R7Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA3_6_7I1R7Certificates_valid + (CA3_6_7I1R7CertificateIndex a) (CA3_6_7I1R7P_sound a) +def CA3_6_7I1R7Entropy : Ball := ⟨0, 0⟩ +lemma CA3_6_7I1R7Entropy_sound : CA3_6_7I1R7Entropy.Encloses (Foundation.finiteEntropy CA3_6_7I1R7Value) := by + exact contains_sound (entropyPair_enclosed CA3_6_7I1R7Value CA3_6_7I1R7Terms CA3_6_7I1R7Terms_sound) (by decide +kernel) +def CA3_6_7I1R7Mass : Ball := ⟨0, 0⟩ +lemma CA3_6_7I1R7Mass_sound : CA3_6_7I1R7Mass.Encloses (∑ a, CA3_6_7I1R7Value a) := by + exact contains_sound (pairSumBall_sound CA3_6_7I1R7P CA3_6_7I1R7Value CA3_6_7I1R7P_sound) (by decide +kernel) +def CA3_6_7I1R7MassTerm : Ball := .exact 0 +lemma CA3_6_7I1R7MassTerm_sound : CA3_6_7I1R7MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA3_6_7I1R7Value a))) := + entropyTerm_zero_ball (CA3_6_7I1R7Mass_sound) +def CA3_6_7I1R7H : Ball := ⟨0, 0⟩ +lemma CA3_6_7I1R7H_sound : CA3_6_7I1R7H.Encloses (homogeneousEntropy CA3_6_7I1R7Value) := by + exact contains_sound (homogeneous_enclosed CA3_6_7I1R7Value CA3_6_7I1R7MassTerm_sound CA3_6_7I1R7Entropy_sound) (by decide +kernel) +def CA3_6_7I1R8Value (a : PairSlot) : ℝ := residualLaw (below (shape 3 6 7)) (fun u => (stageALaw (shape 3 6 7) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 8 a +def CA3_6_7I1R8Raw (a : PairSlot) : Ball := residualBall (below (shape 3 6 7)) A3_6_7Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 8 a +lemma CA3_6_7I1R8Raw_sound (a : PairSlot) : + (CA3_6_7I1R8Raw a).Encloses (CA3_6_7I1R8Value a) := by + exact residualBall_sound_on (below (shape 3 6 7)) A3_6_7Law (fun u => (stageALaw (shape 3 6 7) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A3_6_7Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 3 6 7) (show (shape 3 6 7) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 8 a +def CA3_6_7I1R8Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA3_6_7I1R8Certificates_valid : + CA3_6_7I1R8Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA3_6_7I1R8CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA3_6_7I1R8P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_6_7I1R8Certificates (CA3_6_7I1R8CertificateIndex a)).input +lemma CA3_6_7I1R8P_check : ∀ a : PairSlot, contains (CA3_6_7I1R8Raw a) (CA3_6_7I1R8P a) = true := by + decide +kernel +lemma CA3_6_7I1R8P_sound (a : PairSlot) : + (CA3_6_7I1R8P a).Encloses (CA3_6_7I1R8Value a) := + contains_sound (CA3_6_7I1R8Raw_sound a) (CA3_6_7I1R8P_check a) +def CA3_6_7I1R8Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_6_7I1R8Certificates (CA3_6_7I1R8CertificateIndex a)).output +lemma CA3_6_7I1R8Terms_sound (a : PairSlot) : + (CA3_6_7I1R8Terms a).Encloses (Foundation.entropyTerm (CA3_6_7I1R8Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA3_6_7I1R8Certificates_valid + (CA3_6_7I1R8CertificateIndex a) (CA3_6_7I1R8P_sound a) +def CA3_6_7I1R8Entropy : Ball := ⟨0, 0⟩ +lemma CA3_6_7I1R8Entropy_sound : CA3_6_7I1R8Entropy.Encloses (Foundation.finiteEntropy CA3_6_7I1R8Value) := by + exact contains_sound (entropyPair_enclosed CA3_6_7I1R8Value CA3_6_7I1R8Terms CA3_6_7I1R8Terms_sound) (by decide +kernel) +def CA3_6_7I1R8Mass : Ball := ⟨0, 0⟩ +lemma CA3_6_7I1R8Mass_sound : CA3_6_7I1R8Mass.Encloses (∑ a, CA3_6_7I1R8Value a) := by + exact contains_sound (pairSumBall_sound CA3_6_7I1R8P CA3_6_7I1R8Value CA3_6_7I1R8P_sound) (by decide +kernel) +def CA3_6_7I1R8MassTerm : Ball := .exact 0 +lemma CA3_6_7I1R8MassTerm_sound : CA3_6_7I1R8MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA3_6_7I1R8Value a))) := + entropyTerm_zero_ball (CA3_6_7I1R8Mass_sound) +def CA3_6_7I1R8H : Ball := ⟨0, 0⟩ +lemma CA3_6_7I1R8H_sound : CA3_6_7I1R8H.Encloses (homogeneousEntropy CA3_6_7I1R8Value) := by + exact contains_sound (homogeneous_enclosed CA3_6_7I1R8Value CA3_6_7I1R8MassTerm_sound CA3_6_7I1R8Entropy_sound) (by decide +kernel) +def CA3_6_7I1R9Value (a : PairSlot) : ℝ := residualLaw (below (shape 3 6 7)) (fun u => (stageALaw (shape 3 6 7) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 9 a +def CA3_6_7I1R9Raw (a : PairSlot) : Ball := residualBall (below (shape 3 6 7)) A3_6_7Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 9 a +lemma CA3_6_7I1R9Raw_sound (a : PairSlot) : + (CA3_6_7I1R9Raw a).Encloses (CA3_6_7I1R9Value a) := by + exact residualBall_sound_on (below (shape 3 6 7)) A3_6_7Law (fun u => (stageALaw (shape 3 6 7) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A3_6_7Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 3 6 7) (show (shape 3 6 7) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 9 a +def CA3_6_7I1R9Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA3_6_7I1R9Certificates_valid : + CA3_6_7I1R9Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA3_6_7I1R9CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA3_6_7I1R9P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_6_7I1R9Certificates (CA3_6_7I1R9CertificateIndex a)).input +lemma CA3_6_7I1R9P_check : ∀ a : PairSlot, contains (CA3_6_7I1R9Raw a) (CA3_6_7I1R9P a) = true := by + decide +kernel +lemma CA3_6_7I1R9P_sound (a : PairSlot) : + (CA3_6_7I1R9P a).Encloses (CA3_6_7I1R9Value a) := + contains_sound (CA3_6_7I1R9Raw_sound a) (CA3_6_7I1R9P_check a) +def CA3_6_7I1R9Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_6_7I1R9Certificates (CA3_6_7I1R9CertificateIndex a)).output +lemma CA3_6_7I1R9Terms_sound (a : PairSlot) : + (CA3_6_7I1R9Terms a).Encloses (Foundation.entropyTerm (CA3_6_7I1R9Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA3_6_7I1R9Certificates_valid + (CA3_6_7I1R9CertificateIndex a) (CA3_6_7I1R9P_sound a) +def CA3_6_7I1R9Entropy : Ball := ⟨0, 0⟩ +lemma CA3_6_7I1R9Entropy_sound : CA3_6_7I1R9Entropy.Encloses (Foundation.finiteEntropy CA3_6_7I1R9Value) := by + exact contains_sound (entropyPair_enclosed CA3_6_7I1R9Value CA3_6_7I1R9Terms CA3_6_7I1R9Terms_sound) (by decide +kernel) +def CA3_6_7I1R9Mass : Ball := ⟨0, 0⟩ +lemma CA3_6_7I1R9Mass_sound : CA3_6_7I1R9Mass.Encloses (∑ a, CA3_6_7I1R9Value a) := by + exact contains_sound (pairSumBall_sound CA3_6_7I1R9P CA3_6_7I1R9Value CA3_6_7I1R9P_sound) (by decide +kernel) +def CA3_6_7I1R9MassTerm : Ball := .exact 0 +lemma CA3_6_7I1R9MassTerm_sound : CA3_6_7I1R9MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA3_6_7I1R9Value a))) := + entropyTerm_zero_ball (CA3_6_7I1R9Mass_sound) +def CA3_6_7I1R9H : Ball := ⟨0, 0⟩ +lemma CA3_6_7I1R9H_sound : CA3_6_7I1R9H.Encloses (homogeneousEntropy CA3_6_7I1R9Value) := by + exact contains_sound (homogeneous_enclosed CA3_6_7I1R9Value CA3_6_7I1R9MassTerm_sound CA3_6_7I1R9Entropy_sound) (by decide +kernel) +def CA3_6_7I1R10Value (a : PairSlot) : ℝ := residualLaw (below (shape 3 6 7)) (fun u => (stageALaw (shape 3 6 7) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 10 a +def CA3_6_7I1R10Raw (a : PairSlot) : Ball := residualBall (below (shape 3 6 7)) A3_6_7Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 10 a +lemma CA3_6_7I1R10Raw_sound (a : PairSlot) : + (CA3_6_7I1R10Raw a).Encloses (CA3_6_7I1R10Value a) := by + exact residualBall_sound_on (below (shape 3 6 7)) A3_6_7Law (fun u => (stageALaw (shape 3 6 7) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A3_6_7Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 3 6 7) (show (shape 3 6 7) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 10 a +def CA3_6_7I1R10Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA3_6_7I1R10Certificates_valid : + CA3_6_7I1R10Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA3_6_7I1R10CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA3_6_7I1R10P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_6_7I1R10Certificates (CA3_6_7I1R10CertificateIndex a)).input +lemma CA3_6_7I1R10P_check : ∀ a : PairSlot, contains (CA3_6_7I1R10Raw a) (CA3_6_7I1R10P a) = true := by + decide +kernel +lemma CA3_6_7I1R10P_sound (a : PairSlot) : + (CA3_6_7I1R10P a).Encloses (CA3_6_7I1R10Value a) := + contains_sound (CA3_6_7I1R10Raw_sound a) (CA3_6_7I1R10P_check a) +def CA3_6_7I1R10Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_6_7I1R10Certificates (CA3_6_7I1R10CertificateIndex a)).output +lemma CA3_6_7I1R10Terms_sound (a : PairSlot) : + (CA3_6_7I1R10Terms a).Encloses (Foundation.entropyTerm (CA3_6_7I1R10Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA3_6_7I1R10Certificates_valid + (CA3_6_7I1R10CertificateIndex a) (CA3_6_7I1R10P_sound a) +def CA3_6_7I1R10Entropy : Ball := ⟨0, 0⟩ +lemma CA3_6_7I1R10Entropy_sound : CA3_6_7I1R10Entropy.Encloses (Foundation.finiteEntropy CA3_6_7I1R10Value) := by + exact contains_sound (entropyPair_enclosed CA3_6_7I1R10Value CA3_6_7I1R10Terms CA3_6_7I1R10Terms_sound) (by decide +kernel) +def CA3_6_7I1R10Mass : Ball := ⟨0, 0⟩ +lemma CA3_6_7I1R10Mass_sound : CA3_6_7I1R10Mass.Encloses (∑ a, CA3_6_7I1R10Value a) := by + exact contains_sound (pairSumBall_sound CA3_6_7I1R10P CA3_6_7I1R10Value CA3_6_7I1R10P_sound) (by decide +kernel) +def CA3_6_7I1R10MassTerm : Ball := .exact 0 +lemma CA3_6_7I1R10MassTerm_sound : CA3_6_7I1R10MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA3_6_7I1R10Value a))) := + entropyTerm_zero_ball (CA3_6_7I1R10Mass_sound) +def CA3_6_7I1R10H : Ball := ⟨0, 0⟩ +lemma CA3_6_7I1R10H_sound : CA3_6_7I1R10H.Encloses (homogeneousEntropy CA3_6_7I1R10Value) := by + exact contains_sound (homogeneous_enclosed CA3_6_7I1R10Value CA3_6_7I1R10MassTerm_sound CA3_6_7I1R10Entropy_sound) (by decide +kernel) +def CA3_6_7I1R11Value (a : PairSlot) : ℝ := residualLaw (below (shape 3 6 7)) (fun u => (stageALaw (shape 3 6 7) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 11 a +def CA3_6_7I1R11Raw (a : PairSlot) : Ball := residualBall (below (shape 3 6 7)) A3_6_7Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 11 a +lemma CA3_6_7I1R11Raw_sound (a : PairSlot) : + (CA3_6_7I1R11Raw a).Encloses (CA3_6_7I1R11Value a) := by + exact residualBall_sound_on (below (shape 3 6 7)) A3_6_7Law (fun u => (stageALaw (shape 3 6 7) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A3_6_7Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 3 6 7) (show (shape 3 6 7) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 11 a +def CA3_6_7I1R11Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA3_6_7I1R11Certificates_valid : + CA3_6_7I1R11Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA3_6_7I1R11CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA3_6_7I1R11P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_6_7I1R11Certificates (CA3_6_7I1R11CertificateIndex a)).input +lemma CA3_6_7I1R11P_check : ∀ a : PairSlot, contains (CA3_6_7I1R11Raw a) (CA3_6_7I1R11P a) = true := by + decide +kernel +lemma CA3_6_7I1R11P_sound (a : PairSlot) : + (CA3_6_7I1R11P a).Encloses (CA3_6_7I1R11Value a) := + contains_sound (CA3_6_7I1R11Raw_sound a) (CA3_6_7I1R11P_check a) +def CA3_6_7I1R11Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_6_7I1R11Certificates (CA3_6_7I1R11CertificateIndex a)).output +lemma CA3_6_7I1R11Terms_sound (a : PairSlot) : + (CA3_6_7I1R11Terms a).Encloses (Foundation.entropyTerm (CA3_6_7I1R11Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA3_6_7I1R11Certificates_valid + (CA3_6_7I1R11CertificateIndex a) (CA3_6_7I1R11P_sound a) +def CA3_6_7I1R11Entropy : Ball := ⟨0, 0⟩ +lemma CA3_6_7I1R11Entropy_sound : CA3_6_7I1R11Entropy.Encloses (Foundation.finiteEntropy CA3_6_7I1R11Value) := by + exact contains_sound (entropyPair_enclosed CA3_6_7I1R11Value CA3_6_7I1R11Terms CA3_6_7I1R11Terms_sound) (by decide +kernel) +def CA3_6_7I1R11Mass : Ball := ⟨0, 0⟩ +lemma CA3_6_7I1R11Mass_sound : CA3_6_7I1R11Mass.Encloses (∑ a, CA3_6_7I1R11Value a) := by + exact contains_sound (pairSumBall_sound CA3_6_7I1R11P CA3_6_7I1R11Value CA3_6_7I1R11P_sound) (by decide +kernel) +def CA3_6_7I1R11MassTerm : Ball := .exact 0 +lemma CA3_6_7I1R11MassTerm_sound : CA3_6_7I1R11MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA3_6_7I1R11Value a))) := + entropyTerm_zero_ball (CA3_6_7I1R11Mass_sound) +def CA3_6_7I1R11H : Ball := ⟨0, 0⟩ +lemma CA3_6_7I1R11H_sound : CA3_6_7I1R11H.Encloses (homogeneousEntropy CA3_6_7I1R11Value) := by + exact contains_sound (homogeneous_enclosed CA3_6_7I1R11Value CA3_6_7I1R11MassTerm_sound CA3_6_7I1R11Entropy_sound) (by decide +kernel) +def CA3_6_7I1R12Value (a : PairSlot) : ℝ := residualLaw (below (shape 3 6 7)) (fun u => (stageALaw (shape 3 6 7) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 12 a +def CA3_6_7I1R12Raw (a : PairSlot) : Ball := residualBall (below (shape 3 6 7)) A3_6_7Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 12 a +lemma CA3_6_7I1R12Raw_sound (a : PairSlot) : + (CA3_6_7I1R12Raw a).Encloses (CA3_6_7I1R12Value a) := by + exact residualBall_sound_on (below (shape 3 6 7)) A3_6_7Law (fun u => (stageALaw (shape 3 6 7) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A3_6_7Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 3 6 7) (show (shape 3 6 7) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 12 a +def CA3_6_7I1R12Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA3_6_7I1R12Certificates_valid : + CA3_6_7I1R12Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA3_6_7I1R12CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA3_6_7I1R12P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_6_7I1R12Certificates (CA3_6_7I1R12CertificateIndex a)).input +lemma CA3_6_7I1R12P_check : ∀ a : PairSlot, contains (CA3_6_7I1R12Raw a) (CA3_6_7I1R12P a) = true := by + decide +kernel +lemma CA3_6_7I1R12P_sound (a : PairSlot) : + (CA3_6_7I1R12P a).Encloses (CA3_6_7I1R12Value a) := + contains_sound (CA3_6_7I1R12Raw_sound a) (CA3_6_7I1R12P_check a) +def CA3_6_7I1R12Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_6_7I1R12Certificates (CA3_6_7I1R12CertificateIndex a)).output +lemma CA3_6_7I1R12Terms_sound (a : PairSlot) : + (CA3_6_7I1R12Terms a).Encloses (Foundation.entropyTerm (CA3_6_7I1R12Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA3_6_7I1R12Certificates_valid + (CA3_6_7I1R12CertificateIndex a) (CA3_6_7I1R12P_sound a) +def CA3_6_7I1R12Entropy : Ball := ⟨0, 0⟩ +lemma CA3_6_7I1R12Entropy_sound : CA3_6_7I1R12Entropy.Encloses (Foundation.finiteEntropy CA3_6_7I1R12Value) := by + exact contains_sound (entropyPair_enclosed CA3_6_7I1R12Value CA3_6_7I1R12Terms CA3_6_7I1R12Terms_sound) (by decide +kernel) +def CA3_6_7I1R12Mass : Ball := ⟨0, 0⟩ +lemma CA3_6_7I1R12Mass_sound : CA3_6_7I1R12Mass.Encloses (∑ a, CA3_6_7I1R12Value a) := by + exact contains_sound (pairSumBall_sound CA3_6_7I1R12P CA3_6_7I1R12Value CA3_6_7I1R12P_sound) (by decide +kernel) +def CA3_6_7I1R12MassTerm : Ball := .exact 0 +lemma CA3_6_7I1R12MassTerm_sound : CA3_6_7I1R12MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA3_6_7I1R12Value a))) := + entropyTerm_zero_ball (CA3_6_7I1R12Mass_sound) +def CA3_6_7I1R12H : Ball := ⟨0, 0⟩ +lemma CA3_6_7I1R12H_sound : CA3_6_7I1R12H.Encloses (homogeneousEntropy CA3_6_7I1R12Value) := by + exact contains_sound (homogeneous_enclosed CA3_6_7I1R12Value CA3_6_7I1R12MassTerm_sound CA3_6_7I1R12Entropy_sound) (by decide +kernel) +def CA3_6_7I1R13Value (a : PairSlot) : ℝ := residualLaw (below (shape 3 6 7)) (fun u => (stageALaw (shape 3 6 7) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 13 a +def CA3_6_7I1R13Raw (a : PairSlot) : Ball := residualBall (below (shape 3 6 7)) A3_6_7Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 13 a +lemma CA3_6_7I1R13Raw_sound (a : PairSlot) : + (CA3_6_7I1R13Raw a).Encloses (CA3_6_7I1R13Value a) := by + exact residualBall_sound_on (below (shape 3 6 7)) A3_6_7Law (fun u => (stageALaw (shape 3 6 7) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A3_6_7Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 3 6 7) (show (shape 3 6 7) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 13 a +def CA3_6_7I1R13Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA3_6_7I1R13Certificates_valid : + CA3_6_7I1R13Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA3_6_7I1R13CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA3_6_7I1R13P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_6_7I1R13Certificates (CA3_6_7I1R13CertificateIndex a)).input +lemma CA3_6_7I1R13P_check : ∀ a : PairSlot, contains (CA3_6_7I1R13Raw a) (CA3_6_7I1R13P a) = true := by + decide +kernel +lemma CA3_6_7I1R13P_sound (a : PairSlot) : + (CA3_6_7I1R13P a).Encloses (CA3_6_7I1R13Value a) := + contains_sound (CA3_6_7I1R13Raw_sound a) (CA3_6_7I1R13P_check a) +def CA3_6_7I1R13Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_6_7I1R13Certificates (CA3_6_7I1R13CertificateIndex a)).output +lemma CA3_6_7I1R13Terms_sound (a : PairSlot) : + (CA3_6_7I1R13Terms a).Encloses (Foundation.entropyTerm (CA3_6_7I1R13Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA3_6_7I1R13Certificates_valid + (CA3_6_7I1R13CertificateIndex a) (CA3_6_7I1R13P_sound a) +def CA3_6_7I1R13Entropy : Ball := ⟨0, 0⟩ +lemma CA3_6_7I1R13Entropy_sound : CA3_6_7I1R13Entropy.Encloses (Foundation.finiteEntropy CA3_6_7I1R13Value) := by + exact contains_sound (entropyPair_enclosed CA3_6_7I1R13Value CA3_6_7I1R13Terms CA3_6_7I1R13Terms_sound) (by decide +kernel) +def CA3_6_7I1R13Mass : Ball := ⟨0, 0⟩ +lemma CA3_6_7I1R13Mass_sound : CA3_6_7I1R13Mass.Encloses (∑ a, CA3_6_7I1R13Value a) := by + exact contains_sound (pairSumBall_sound CA3_6_7I1R13P CA3_6_7I1R13Value CA3_6_7I1R13P_sound) (by decide +kernel) +def CA3_6_7I1R13MassTerm : Ball := .exact 0 +lemma CA3_6_7I1R13MassTerm_sound : CA3_6_7I1R13MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA3_6_7I1R13Value a))) := + entropyTerm_zero_ball (CA3_6_7I1R13Mass_sound) +def CA3_6_7I1R13H : Ball := ⟨0, 0⟩ +lemma CA3_6_7I1R13H_sound : CA3_6_7I1R13H.Encloses (homogeneousEntropy CA3_6_7I1R13Value) := by + exact contains_sound (homogeneous_enclosed CA3_6_7I1R13Value CA3_6_7I1R13MassTerm_sound CA3_6_7I1R13Entropy_sound) (by decide +kernel) +def CA3_6_7I1R14Value (a : PairSlot) : ℝ := residualLaw (below (shape 3 6 7)) (fun u => (stageALaw (shape 3 6 7) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 14 a +def CA3_6_7I1R14Raw (a : PairSlot) : Ball := residualBall (below (shape 3 6 7)) A3_6_7Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 14 a +lemma CA3_6_7I1R14Raw_sound (a : PairSlot) : + (CA3_6_7I1R14Raw a).Encloses (CA3_6_7I1R14Value a) := by + exact residualBall_sound_on (below (shape 3 6 7)) A3_6_7Law (fun u => (stageALaw (shape 3 6 7) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A3_6_7Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 3 6 7) (show (shape 3 6 7) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 14 a +def CA3_6_7I1R14Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA3_6_7I1R14Certificates_valid : + CA3_6_7I1R14Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA3_6_7I1R14CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA3_6_7I1R14P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_6_7I1R14Certificates (CA3_6_7I1R14CertificateIndex a)).input +lemma CA3_6_7I1R14P_check : ∀ a : PairSlot, contains (CA3_6_7I1R14Raw a) (CA3_6_7I1R14P a) = true := by + decide +kernel +lemma CA3_6_7I1R14P_sound (a : PairSlot) : + (CA3_6_7I1R14P a).Encloses (CA3_6_7I1R14Value a) := + contains_sound (CA3_6_7I1R14Raw_sound a) (CA3_6_7I1R14P_check a) +def CA3_6_7I1R14Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_6_7I1R14Certificates (CA3_6_7I1R14CertificateIndex a)).output +lemma CA3_6_7I1R14Terms_sound (a : PairSlot) : + (CA3_6_7I1R14Terms a).Encloses (Foundation.entropyTerm (CA3_6_7I1R14Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA3_6_7I1R14Certificates_valid + (CA3_6_7I1R14CertificateIndex a) (CA3_6_7I1R14P_sound a) +def CA3_6_7I1R14Entropy : Ball := ⟨0, 0⟩ +lemma CA3_6_7I1R14Entropy_sound : CA3_6_7I1R14Entropy.Encloses (Foundation.finiteEntropy CA3_6_7I1R14Value) := by + exact contains_sound (entropyPair_enclosed CA3_6_7I1R14Value CA3_6_7I1R14Terms CA3_6_7I1R14Terms_sound) (by decide +kernel) +def CA3_6_7I1R14Mass : Ball := ⟨0, 0⟩ +lemma CA3_6_7I1R14Mass_sound : CA3_6_7I1R14Mass.Encloses (∑ a, CA3_6_7I1R14Value a) := by + exact contains_sound (pairSumBall_sound CA3_6_7I1R14P CA3_6_7I1R14Value CA3_6_7I1R14P_sound) (by decide +kernel) +def CA3_6_7I1R14MassTerm : Ball := .exact 0 +lemma CA3_6_7I1R14MassTerm_sound : CA3_6_7I1R14MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA3_6_7I1R14Value a))) := + entropyTerm_zero_ball (CA3_6_7I1R14Mass_sound) +def CA3_6_7I1R14H : Ball := ⟨0, 0⟩ +lemma CA3_6_7I1R14H_sound : CA3_6_7I1R14H.Encloses (homogeneousEntropy CA3_6_7I1R14Value) := by + exact contains_sound (homogeneous_enclosed CA3_6_7I1R14Value CA3_6_7I1R14MassTerm_sound CA3_6_7I1R14Entropy_sound) (by decide +kernel) +def CA3_6_7I1R15Value (a : PairSlot) : ℝ := residualLaw (below (shape 3 6 7)) (fun u => (stageALaw (shape 3 6 7) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 15 a +def CA3_6_7I1R15Raw (a : PairSlot) : Ball := residualBall (below (shape 3 6 7)) A3_6_7Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 15 a +lemma CA3_6_7I1R15Raw_sound (a : PairSlot) : + (CA3_6_7I1R15Raw a).Encloses (CA3_6_7I1R15Value a) := by + exact residualBall_sound_on (below (shape 3 6 7)) A3_6_7Law (fun u => (stageALaw (shape 3 6 7) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A3_6_7Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 3 6 7) (show (shape 3 6 7) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 15 a +def CA3_6_7I1R15Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA3_6_7I1R15Certificates_valid : + CA3_6_7I1R15Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA3_6_7I1R15CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA3_6_7I1R15P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_6_7I1R15Certificates (CA3_6_7I1R15CertificateIndex a)).input +lemma CA3_6_7I1R15P_check : ∀ a : PairSlot, contains (CA3_6_7I1R15Raw a) (CA3_6_7I1R15P a) = true := by + decide +kernel +lemma CA3_6_7I1R15P_sound (a : PairSlot) : + (CA3_6_7I1R15P a).Encloses (CA3_6_7I1R15Value a) := + contains_sound (CA3_6_7I1R15Raw_sound a) (CA3_6_7I1R15P_check a) +def CA3_6_7I1R15Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_6_7I1R15Certificates (CA3_6_7I1R15CertificateIndex a)).output +lemma CA3_6_7I1R15Terms_sound (a : PairSlot) : + (CA3_6_7I1R15Terms a).Encloses (Foundation.entropyTerm (CA3_6_7I1R15Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA3_6_7I1R15Certificates_valid + (CA3_6_7I1R15CertificateIndex a) (CA3_6_7I1R15P_sound a) +def CA3_6_7I1R15Entropy : Ball := ⟨0, 0⟩ +lemma CA3_6_7I1R15Entropy_sound : CA3_6_7I1R15Entropy.Encloses (Foundation.finiteEntropy CA3_6_7I1R15Value) := by + exact contains_sound (entropyPair_enclosed CA3_6_7I1R15Value CA3_6_7I1R15Terms CA3_6_7I1R15Terms_sound) (by decide +kernel) +def CA3_6_7I1R15Mass : Ball := ⟨0, 0⟩ +lemma CA3_6_7I1R15Mass_sound : CA3_6_7I1R15Mass.Encloses (∑ a, CA3_6_7I1R15Value a) := by + exact contains_sound (pairSumBall_sound CA3_6_7I1R15P CA3_6_7I1R15Value CA3_6_7I1R15P_sound) (by decide +kernel) +def CA3_6_7I1R15MassTerm : Ball := .exact 0 +lemma CA3_6_7I1R15MassTerm_sound : CA3_6_7I1R15MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA3_6_7I1R15Value a))) := + entropyTerm_zero_ball (CA3_6_7I1R15Mass_sound) +def CA3_6_7I1R15H : Ball := ⟨0, 0⟩ +lemma CA3_6_7I1R15H_sound : CA3_6_7I1R15H.Encloses (homogeneousEntropy CA3_6_7I1R15Value) := by + exact contains_sound (homogeneous_enclosed CA3_6_7I1R15Value CA3_6_7I1R15MassTerm_sound CA3_6_7I1R15Entropy_sound) (by decide +kernel) +def CA3_6_7I1R16Value (a : PairSlot) : ℝ := residualLaw (below (shape 3 6 7)) (fun u => (stageALaw (shape 3 6 7) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 16 a +def CA3_6_7I1R16Raw (a : PairSlot) : Ball := residualBall (below (shape 3 6 7)) A3_6_7Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 16 a +lemma CA3_6_7I1R16Raw_sound (a : PairSlot) : + (CA3_6_7I1R16Raw a).Encloses (CA3_6_7I1R16Value a) := by + exact residualBall_sound_on (below (shape 3 6 7)) A3_6_7Law (fun u => (stageALaw (shape 3 6 7) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A3_6_7Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 3 6 7) (show (shape 3 6 7) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 16 a +def CA3_6_7I1R16Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA3_6_7I1R16Certificates_valid : + CA3_6_7I1R16Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA3_6_7I1R16CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA3_6_7I1R16P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_6_7I1R16Certificates (CA3_6_7I1R16CertificateIndex a)).input +lemma CA3_6_7I1R16P_check : ∀ a : PairSlot, contains (CA3_6_7I1R16Raw a) (CA3_6_7I1R16P a) = true := by + decide +kernel +lemma CA3_6_7I1R16P_sound (a : PairSlot) : + (CA3_6_7I1R16P a).Encloses (CA3_6_7I1R16Value a) := + contains_sound (CA3_6_7I1R16Raw_sound a) (CA3_6_7I1R16P_check a) +def CA3_6_7I1R16Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_6_7I1R16Certificates (CA3_6_7I1R16CertificateIndex a)).output +lemma CA3_6_7I1R16Terms_sound (a : PairSlot) : + (CA3_6_7I1R16Terms a).Encloses (Foundation.entropyTerm (CA3_6_7I1R16Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA3_6_7I1R16Certificates_valid + (CA3_6_7I1R16CertificateIndex a) (CA3_6_7I1R16P_sound a) +def CA3_6_7I1R16Entropy : Ball := ⟨0, 0⟩ +lemma CA3_6_7I1R16Entropy_sound : CA3_6_7I1R16Entropy.Encloses (Foundation.finiteEntropy CA3_6_7I1R16Value) := by + exact contains_sound (entropyPair_enclosed CA3_6_7I1R16Value CA3_6_7I1R16Terms CA3_6_7I1R16Terms_sound) (by decide +kernel) +def CA3_6_7I1R16Mass : Ball := ⟨0, 0⟩ +lemma CA3_6_7I1R16Mass_sound : CA3_6_7I1R16Mass.Encloses (∑ a, CA3_6_7I1R16Value a) := by + exact contains_sound (pairSumBall_sound CA3_6_7I1R16P CA3_6_7I1R16Value CA3_6_7I1R16P_sound) (by decide +kernel) +def CA3_6_7I1R16MassTerm : Ball := .exact 0 +lemma CA3_6_7I1R16MassTerm_sound : CA3_6_7I1R16MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA3_6_7I1R16Value a))) := + entropyTerm_zero_ball (CA3_6_7I1R16Mass_sound) +def CA3_6_7I1R16H : Ball := ⟨0, 0⟩ +lemma CA3_6_7I1R16H_sound : CA3_6_7I1R16H.Encloses (homogeneousEntropy CA3_6_7I1R16Value) := by + exact contains_sound (homogeneous_enclosed CA3_6_7I1R16Value CA3_6_7I1R16MassTerm_sound CA3_6_7I1R16Entropy_sound) (by decide +kernel) +def CA3_6_7I1ResidualEntropies (a : Fin 17) : Ball := + match a.val with + | 0 => CA3_6_7I1R0H + | 1 => CA3_6_7I1R1H + | 2 => CA3_6_7I1R2H + | 3 => CA3_6_7I1R3H + | 4 => CA3_6_7I1R4H + | 5 => CA3_6_7I1R5H + | 6 => CA3_6_7I1R6H + | 7 => CA3_6_7I1R7H + | 8 => CA3_6_7I1R8H + | 9 => CA3_6_7I1R9H + | 10 => CA3_6_7I1R10H + | 11 => CA3_6_7I1R11H + | 12 => CA3_6_7I1R12H + | 13 => CA3_6_7I1R13H + | 14 => CA3_6_7I1R14H + | 15 => CA3_6_7I1R15H + | 16 => CA3_6_7I1R16H + | _ => (.exact 0) +lemma CA3_6_7I1ResidualEntropies_sound (k : Fin 17) : + (CA3_6_7I1ResidualEntropies k).Encloses (homogeneousEntropy + (residualLaw (below (shape 3 6 7)) (fun u => (stageALaw (shape 3 6 7) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) k)) := by + fin_cases k + · exact CA3_6_7I1R0H_sound + · exact CA3_6_7I1R1H_sound + · exact CA3_6_7I1R2H_sound + · exact CA3_6_7I1R3H_sound + · exact CA3_6_7I1R4H_sound + · exact CA3_6_7I1R5H_sound + · exact CA3_6_7I1R6H_sound + · exact CA3_6_7I1R7H_sound + · exact CA3_6_7I1R8H_sound + · exact CA3_6_7I1R9H_sound + · exact CA3_6_7I1R10H_sound + · exact CA3_6_7I1R11H_sound + · exact CA3_6_7I1R12H_sound + · exact CA3_6_7I1R13H_sound + · exact CA3_6_7I1R14H_sound + · exact CA3_6_7I1R15H_sound + · exact CA3_6_7I1R16H_sound +def CA3_6_7I1Singles (s : Shape) : Ball := + match s 0, s 1, s 2 with + | 2, 6, 0 => Z2_6_0H1H + | 3, 5, 0 => Z3_5_0H1H + | _, _, _ => (.exact 0) +lemma CA3_6_7I1Singles_sound (u : Shape) (hu : u ∈ below (shape 3 6 7)) + (hd : designated (Equiv.refl (Fin 3)) 1 u) : + (CA3_6_7I1Singles u).Encloses (homogeneousEntropy ((fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) u)) := by + rw [A3_6_7_below] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 0 1 7) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 0 2 6) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 0 3 5) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 0 4 4) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 0 5 3) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 0 6 2) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 1 0 7) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 1 1 6) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 1 2 5) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 1 3 4) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 1 4 3) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 1 5 2) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 1 6 1) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 2 0 6) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 2 1 5) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 2 2 4) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 2 3 3) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 2 4 2) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 2 5 1) by decide +kernel) hd |>.elim + · exact Z2_6_0H1H_sound + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 3 0 5) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 3 1 4) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 3 2 3) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 3 3 2) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 3 4 1) by decide +kernel) hd |>.elim + · exact Z3_5_0H1H_sound +def CA3_6_7I1Singleton : Ball := ⟨(149742991488449009400997643 / 25000000000000000000000000000000), (237491 / 50000000000000000000000000000000)⟩ +lemma CA3_6_7I1Singleton_sound : CA3_6_7I1Singleton.Encloses + (singletonEntropy (below (shape 3 6 7)) (fun u => (stageALaw (shape 3 6 7) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ))) := by + exact contains_sound (singletonBall_sound (below (shape 3 6 7)) A3_6_7Law (fun u => (stageALaw (shape 3 6 7) u : ℝ)) (Equiv.refl (Fin 3)) 1 + CA3_6_7I1Singles (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A3_6_7Law_sound u) CA3_6_7I1Singles_sound) (by decide +kernel) +def CA3_6_7I1Group : Ball := ⟨(103856837423271389695599925856127 / 100000000000000000000000000000000), (82889288613 / 50000000000000000000000000000000)⟩ +lemma CA3_6_7I1Group_sound : CA3_6_7I1Group.Encloses + (groupedEntropy (below (shape 3 6 7)) (fun u => (stageALaw (shape 3 6 7) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ))) := by + exact contains_sound (Ball.add_sound CA3_6_7I1Singleton_sound + (finSumBall_sound 17 CA3_6_7I1ResidualEntropies _ CA3_6_7I1ResidualEntropies_sound)) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CA3_6_7I1H : Ball := ⟨(11370342936710396139452809161553 / 10000000000000000000000000000000), (508165588943 / 100000000000000000000000000000000)⟩ +lemma CA3_6_7I1_sound : CA3_6_7I1H.Encloses (stageACapacity (shape 3 6 7) 1) := by + have hb := contains_sound (Ball.add_sound CA3_6_7I1PairH_sound + (Ball.neg_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) CA3_6_7I1Group_sound))) + (show contains (.add CA3_6_7I1PairH (.neg (.mul (.exact 2) CA3_6_7I1Group))) CA3_6_7I1H = true by decide +kernel) + simp only [stageACapacity, nativeCapacity, + show (1 : Fin 3) ≠ 0 by decide, ite_false, sub_eq_add_neg] + exact hb + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA3_6_7I1Pair.lean b/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA3_6_7I1Pair.lean new file mode 100644 index 0000000000000000000000000000000000000000..e04894114611179e687da57d6c9f090aa9e07c70 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA3_6_7I1Pair.lean @@ -0,0 +1,324 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Certificates.SupportedContraction + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CA3_6_7I1PairValue (a : PairSlot × PairSlot) : ℝ := pairLaw (below (shape 3 6 7)) (shape 3 6 7) (fun u => (stageALaw (shape 3 6 7) u : ℝ)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) a +def CA3_6_7I1PairRaw (a : PairSlot × PairSlot) : Ball := stageAPairBall (shape 3 6 7) A3_6_7Law 1 a +lemma CA3_6_7I1PairRaw_sound (a : PairSlot × PairSlot) : + (CA3_6_7I1PairRaw a).Encloses (CA3_6_7I1PairValue a) := by + exact stageAPairBall_sound (shape 3 6 7) (by decide +kernel) A3_6_7Law (fun u => (stageALaw (shape 3 6 7) u : ℝ)) (fun u _ => A3_6_7Law_sound u) 1 a +def CA3_6_7I1PairCertificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(2929266700444512277609760161 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(106061470749215350451665048371 / 100000000000000000000000000000000), (72691 / 195312500000000000000000000000)⟩ ⟨(-452593949251533946510100136994297 / 50000000000000000000000000000000), (317637363779 / 100000000000000000000000000000000)⟩ ⟨-14, 2929266700444512277609760161, 1525878906250000000000000000⟩, + .log ⟨(310991289660527074549623273539 / 100000000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ ⟨(7013291594496626911229081217 / 390625000000000000000000000000), (658549699 / 100000000000000000000000000000000)⟩ ⟨(-577316056070563324751674983800397 / 100000000000000000000000000000000), (52939559529 / 25000000000000000000000000000000)⟩ ⟨-9, 310991289660527074549623273539, 195312500000000000000000000000⟩, + .log ⟨(23483421679921843240992216109 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(196242283800875344454820513629 / 100000000000000000000000000000000), (34809661 / 50000000000000000000000000000000)⟩ ⟨(-835663075320327304324570036084851 / 100000000000000000000000000000000), (14823076791 / 5000000000000000000000000000000)⟩ ⟨-13, 23483421679921843240992216109, 12207031250000000000000000000⟩, + .log ⟨(178961767426402357184922167607 / 50000000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ ⟨(2016042282588481832676502285989 / 100000000000000000000000000000000), (378966297 / 50000000000000000000000000000000)⟩ ⟨(-563260609117971215586551088028959 / 100000000000000000000000000000000), (211758237947 / 100000000000000000000000000000000)⟩ ⟨-9, 178961767426402357184922167607, 97656250000000000000000000000⟩, + .log ⟨(378199083829748145816508879 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(6296753618056725311698564253 / 20000000000000000000000000000000), (10891813 / 100000000000000000000000000000000)⟩ ⟨(-520290923425010623289952194268039 / 50000000000000000000000000000000), (179994517831 / 50000000000000000000000000000000)⟩ ⟨-16, 378199083829748145816508879, 190734863281250000000000000⟩, + .log ⟨(2779536899351970099584969577919 / 100000000000000000000000000000000), (1 / 5000000000000000000000000000000)⟩ ⟨(9958763440497143646087681306597 / 100000000000000000000000000000000), (4120128923 / 100000000000000000000000000000000)⟩ ⟨(-179144292756447320594760112120211 / 50000000000000000000000000000000), (296461533 / 200000000000000000000000000000)⟩ ⟨-6, 2779536899351970099584969577919, 1562500000000000000000000000000⟩, + .log ⟨(180525109694938985244864949001 / 100000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ ⟨(1140387152429190574940038576767 / 100000000000000000000000000000000), (420504483 / 100000000000000000000000000000000)⟩ ⟨(-315852779249456754786471920550967 / 50000000000000000000000000000000), (11646703081 / 5000000000000000000000000000000)⟩ ⟨-10, 180525109694938985244864949001, 97656250000000000000000000000⟩, + .log ⟨(2423550873346727277780337761 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(89587986339233634079426974287 / 100000000000000000000000000000000), (30792423 / 100000000000000000000000000000000)⟩ ⟨(-924139733608313819729344378128207 / 100000000000000000000000000000000), (7940934139 / 2500000000000000000000000000000)⟩ ⟨-14, 2423550873346727277780337761, 1525878906250000000000000000⟩, + .log ⟨(28873592604843310284793842637 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(235319723087394420365448900043 / 100000000000000000000000000000000), (19871221 / 25000000000000000000000000000000)⟩ ⟨(-407499901913697866343149485627971 / 50000000000000000000000000000000), (137642855671 / 50000000000000000000000000000000)⟩ ⟨-12, 28873592604843310284793842637, 24414062500000000000000000000⟩, + .log ⟨(196746094106228395512764677 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(323125128919041190539719797 / 12500000000000000000000000000000), (833267 / 100000000000000000000000000000000)⟩ ⟨(-32846916772292051422034798709461 / 2500000000000000000000000000000), (52939622741 / 12500000000000000000000000000000)⟩ ⟨-19, 196746094106228395512764677, 190734863281250000000000000⟩, + .log ⟨(12291001016484964190278258351 / 5000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ ⟨(1476966775584120548877925913239 / 100000000000000000000000000000000), (520544163 / 100000000000000000000000000000000)⟩ ⟨(-600832582148182979020538131917479 / 100000000000000000000000000000000), (4235164761 / 2000000000000000000000000000000)⟩ ⟨-9, 12291001016484964190278258351, 9765625000000000000000000000⟩, + .log ⟨(14587441648734774205096081313 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(12884743626597813355843725887 / 10000000000000000000000000000000), (43246163 / 100000000000000000000000000000000)⟩ ⟨(-883276446745228797559362768323201 / 100000000000000000000000000000000), (296461538417 / 100000000000000000000000000000000)⟩ ⟨-13, 14587441648734774205096081313, 12207031250000000000000000000⟩, + .log ⟨(595467968410321643278744959 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(3582136752860286323300180157 / 50000000000000000000000000000000), (149739 / 6250000000000000000000000000000)⟩ ⟨(-1203133314600703468787883059809963 / 100000000000000000000000000000000), (50292602239 / 12500000000000000000000000000000)⟩ ⟨-18, 595467968410321643278744959, 381469726562500000000000000⟩, + .log ⟨(33083818900182693512087710019 / 2500000000000000000000000000000), (9 / 100000000000000000000000000000000)⟩ ⟨(1430875730844118098766818374343 / 25000000000000000000000000000000), (2241846819 / 100000000000000000000000000000000)⟩ ⟨(-432500170298120148776956564959869 / 100000000000000000000000000000000), (2646977971 / 1562500000000000000000000000000)⟩ ⟨-7, 33083818900182693512087710019, 19531250000000000000000000000⟩, + .log ⟨(2751132142688136664948704453 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(50151040335111475389018816919 / 50000000000000000000000000000000), (4369313 / 12500000000000000000000000000000)⟩ ⟨(-911461858864198259824694637352373 / 100000000000000000000000000000000), (79409341083 / 25000000000000000000000000000000)⟩ ⟨-14, 2751132142688136664948704453, 1525878906250000000000000000⟩, + .log ⟨(2590028993782512132199209930937 / 25000000000000000000000000000000), (51 / 100000000000000000000000000000000)⟩ ⟨(1468032807398830534012873858541 / 6250000000000000000000000000000), (2742299907 / 25000000000000000000000000000000)⟩ ⟨(-22672067547087899893203508395843 / 10000000000000000000000000000000), (105879118907 / 100000000000000000000000000000000)⟩ ⟨-4, 2590028993782512132199209930937, 1562500000000000000000000000000⟩, + .log ⟨(667384062691931912610549717523 / 100000000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ ⟨(668660071472372919732559875381 / 20000000000000000000000000000000), (1271916677 / 100000000000000000000000000000000)⟩ ⟨(-50095597786325174779147175757383 / 10000000000000000000000000000000), (95291206873 / 50000000000000000000000000000000)⟩ ⟨-8, 667384062691931912610549717523, 390625000000000000000000000000⟩, + .log ⟨(17595633465662274079137933341 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(139922720967899682417987057957 / 50000000000000000000000000000000), (48438269 / 50000000000000000000000000000000)⟩ ⟨(-31808510046758511400486344336989 / 4000000000000000000000000000000), (430133923 / 156250000000000000000000000000)⟩ ⟨-12, 17595633465662274079137933341, 12207031250000000000000000000⟩, + .log ⟨(80361480319065030883605706243 / 25000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ ⟨(184513049289447416521492876629 / 10000000000000000000000000000000), (170172059 / 25000000000000000000000000000000)⟩ ⟨(-57400961429798777743888177989037 / 10000000000000000000000000000000), (211758237763 / 100000000000000000000000000000000)⟩ ⟨-9, 80361480319065030883605706243, 48828125000000000000000000000⟩, + .log ⟨(200806880706736655102941189 / 781250000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(212471204961411021031073777523 / 100000000000000000000000000000000), (17689367 / 25000000000000000000000000000000)⟩ ⟨(-413315341316722207253817565210069 / 50000000000000000000000000000000), (34410713971 / 12500000000000000000000000000000)⟩ ⟨-12, 200806880706736655102941189, 190734863281250000000000000⟩, + .log ⟨(197268787245843131011230129 / 2000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(90981257688668129322779184257 / 100000000000000000000000000000000), (31329979 / 100000000000000000000000000000000)⟩ ⟨(-922409053747404696107298222672217 / 100000000000000000000000000000000), (317637365383 / 100000000000000000000000000000000)⟩ ⟨-14, 197268787245843131011230129, 122070312500000000000000000⟩, + .log ⟨(10416239210871049803461313309141 / 100000000000000000000000000000000), (3 / 10000000000000000000000000000000)⟩ ⟨(23559492919048907580123983029633 / 100000000000000000000000000000000), (11028622347 / 100000000000000000000000000000000)⟩ ⟨(-226180413507215945867293429719467 / 100000000000000000000000000000000), (105879118703 / 100000000000000000000000000000000)⟩ ⟨-4, 10416239210871049803461313309141, 6250000000000000000000000000000⟩, + .log ⟨(853044793905043060426056166449 / 100000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ ⟨(1016000534530939383606592946237 / 25000000000000000000000000000000), (144511411 / 10000000000000000000000000000000)⟩ ⟨(-9528226810973640765679649795183 / 2000000000000000000000000000000), (33881317963 / 20000000000000000000000000000000)⟩ ⟨-7, 853044793905043060426056166449, 781250000000000000000000000000⟩, + .log ⟨(67879235273856597383850580027 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(19807691099760979272921875483 / 4000000000000000000000000000000), (34497571 / 20000000000000000000000000000000)⟩ ⟨(-145903905810425566024778656309549 / 20000000000000000000000000000000), (254109885669 / 100000000000000000000000000000000)⟩ ⟨-11, 67879235273856597383850580027, 48828125000000000000000000000⟩, + .log ⟨(604201856322108277929047683 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(12845909132556781884011100269 / 50000000000000000000000000000000), (8700253 / 100000000000000000000000000000000)⟩ ⟨(-265761951038024698093970653962183 / 25000000000000000000000000000000), (359989043987 / 100000000000000000000000000000000)⟩ ⟨-16, 604201856322108277929047683, 381469726562500000000000000⟩, + .log ⟨(33415888045641925687454251 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(444505205386482867356596473 / 20000000000000000000000000000000), (185751 / 25000000000000000000000000000000)⟩ ⟨(-665110567732547351769924240488303 / 50000000000000000000000000000000), (22234644793 / 5000000000000000000000000000000)⟩ ⟨-20, 33415888045641925687454251, 19073486328125000000000000⟩, + .log ⟨(10714169886045133450134989163 / 100000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ ⟨(97942065935230162766327983997 / 100000000000000000000000000000000), (34032237 / 100000000000000000000000000000000)⟩ ⟨(-114266978889793177168340959443213 / 12500000000000000000000000000000), (63527476649 / 20000000000000000000000000000000)⟩ ⟨-14, 10714169886045133450134989163, 6103515625000000000000000000⟩] +lemma CA3_6_7I1PairCertificates_valid : + CA3_6_7I1PairCertificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA3_6_7I1PairCertificateIndex (a : PairSlot × PairSlot) : ℕ := + match a.1.1.val, a.1.2.val, a.2.1.val, a.2.2.val with + | 1, 0, 1, 5 => 1 + | 1, 0, 2, 4 => 2 + | 1, 0, 3, 4 => 3 + | 1, 0, 4, 2 => 2 + | 1, 0, 4, 3 => 3 + | 1, 0, 5, 1 => 1 + | 0, 1, 1, 5 => 1 + | 0, 1, 2, 4 => 2 + | 0, 1, 3, 4 => 3 + | 0, 1, 4, 2 => 2 + | 0, 1, 4, 3 => 3 + | 0, 1, 5, 1 => 1 + | 2, 0, 4, 1 => 4 + | 2, 0, 5, 0 => 5 + | 2, 0, 2, 2 => 6 + | 2, 0, 2, 3 => 7 + | 2, 0, 3, 2 => 7 + | 2, 0, 3, 3 => 8 + | 2, 0, 1, 4 => 4 + | 2, 0, 0, 5 => 5 + | 3, 0, 4, 1 => 9 + | 3, 0, 5, 0 => 10 + | 3, 0, 2, 2 => 11 + | 3, 0, 2, 3 => 12 + | 3, 0, 3, 2 => 12 + | 3, 0, 3, 3 => 13 + | 3, 0, 1, 4 => 9 + | 3, 0, 0, 5 => 10 + | 1, 1, 4, 1 => 14 + | 1, 1, 5, 0 => 15 + | 1, 1, 2, 2 => 16 + | 1, 1, 2, 3 => 17 + | 1, 1, 3, 2 => 17 + | 1, 1, 3, 3 => 18 + | 1, 1, 1, 4 => 14 + | 1, 1, 0, 5 => 15 + | 0, 2, 4, 1 => 4 + | 0, 2, 5, 0 => 5 + | 0, 2, 2, 2 => 6 + | 0, 2, 2, 3 => 7 + | 0, 2, 3, 2 => 7 + | 0, 2, 3, 3 => 8 + | 0, 2, 1, 4 => 4 + | 0, 2, 0, 5 => 5 + | 0, 3, 4, 1 => 9 + | 0, 3, 5, 0 => 10 + | 0, 3, 2, 2 => 11 + | 0, 3, 2, 3 => 12 + | 0, 3, 3, 2 => 12 + | 0, 3, 3, 3 => 13 + | 0, 3, 1, 4 => 9 + | 0, 3, 0, 5 => 10 + | 4, 0, 2, 1 => 19 + | 4, 0, 3, 1 => 20 + | 4, 0, 4, 0 => 21 + | 4, 0, 1, 2 => 19 + | 4, 0, 1, 3 => 20 + | 4, 0, 0, 4 => 21 + | 2, 1, 2, 1 => 22 + | 2, 1, 3, 1 => 23 + | 2, 1, 4, 0 => 19 + | 2, 1, 1, 2 => 22 + | 2, 1, 1, 3 => 23 + | 2, 1, 0, 4 => 19 + | 3, 1, 2, 1 => 23 + | 3, 1, 3, 1 => 24 + | 3, 1, 4, 0 => 20 + | 3, 1, 1, 2 => 23 + | 3, 1, 1, 3 => 24 + | 3, 1, 0, 4 => 20 + | 1, 2, 2, 1 => 22 + | 1, 2, 3, 1 => 23 + | 1, 2, 4, 0 => 19 + | 1, 2, 1, 2 => 22 + | 1, 2, 1, 3 => 23 + | 1, 2, 0, 4 => 19 + | 1, 3, 2, 1 => 23 + | 1, 3, 3, 1 => 24 + | 1, 3, 4, 0 => 20 + | 1, 3, 1, 2 => 23 + | 1, 3, 1, 3 => 24 + | 1, 3, 0, 4 => 20 + | 0, 4, 2, 1 => 19 + | 0, 4, 3, 1 => 20 + | 0, 4, 4, 0 => 21 + | 0, 4, 1, 2 => 19 + | 0, 4, 1, 3 => 20 + | 0, 4, 0, 4 => 21 + | 0, 5, 1, 1 => 15 + | 0, 5, 2, 0 => 5 + | 0, 5, 3, 0 => 10 + | 0, 5, 0, 2 => 5 + | 0, 5, 0, 3 => 10 + | 1, 4, 1, 1 => 14 + | 1, 4, 2, 0 => 4 + | 1, 4, 3, 0 => 9 + | 1, 4, 0, 2 => 4 + | 1, 4, 0, 3 => 9 + | 2, 2, 1, 1 => 16 + | 2, 2, 2, 0 => 6 + | 2, 2, 3, 0 => 11 + | 2, 2, 0, 2 => 6 + | 2, 2, 0, 3 => 11 + | 2, 3, 1, 1 => 17 + | 2, 3, 2, 0 => 7 + | 2, 3, 3, 0 => 12 + | 2, 3, 0, 2 => 7 + | 2, 3, 0, 3 => 12 + | 3, 2, 1, 1 => 17 + | 3, 2, 2, 0 => 7 + | 3, 2, 3, 0 => 12 + | 3, 2, 0, 2 => 7 + | 3, 2, 0, 3 => 12 + | 3, 3, 1, 1 => 18 + | 3, 3, 2, 0 => 8 + | 3, 3, 3, 0 => 13 + | 3, 3, 0, 2 => 8 + | 3, 3, 0, 3 => 13 + | 4, 1, 1, 1 => 14 + | 4, 1, 2, 0 => 4 + | 4, 1, 3, 0 => 9 + | 4, 1, 0, 2 => 4 + | 4, 1, 0, 3 => 9 + | 5, 0, 1, 1 => 15 + | 5, 0, 2, 0 => 5 + | 5, 0, 3, 0 => 10 + | 5, 0, 0, 2 => 5 + | 5, 0, 0, 3 => 10 + | 1, 5, 0, 1 => 1 + | 1, 5, 1, 0 => 1 + | 2, 4, 0, 1 => 2 + | 2, 4, 1, 0 => 2 + | 3, 4, 0, 1 => 3 + | 3, 4, 1, 0 => 3 + | 4, 2, 0, 1 => 2 + | 4, 2, 1, 0 => 2 + | 4, 3, 0, 1 => 3 + | 4, 3, 1, 0 => 3 + | 5, 1, 0, 1 => 1 + | 5, 1, 1, 0 => 1 + | 2, 5, 0, 0 => 25 + | 3, 5, 0, 0 => 26 + | 4, 4, 0, 0 => 27 + | 5, 2, 0, 0 => 25 + | 5, 3, 0, 0 => 26 + | 0, 0, 2, 5 => 25 + | 0, 0, 3, 5 => 26 + | 0, 0, 4, 4 => 27 + | 0, 0, 5, 2 => 25 + | 0, 0, 5, 3 => 26 + | _, _, _, _ => 0 +def CA3_6_7I1PairP (a : PairSlot × PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_6_7I1PairCertificates (CA3_6_7I1PairCertificateIndex a)).input +lemma CA3_6_7I1PairP_check_0_0 : ∀ k l : Fin 6, contains (CA3_6_7I1PairRaw ((0,0),(k,l))) (CA3_6_7I1PairP ((0,0),(k,l))) = true := by + decide +kernel +lemma CA3_6_7I1PairP_check_0_1 : ∀ k l : Fin 6, contains (CA3_6_7I1PairRaw ((0,1),(k,l))) (CA3_6_7I1PairP ((0,1),(k,l))) = true := by + decide +kernel +lemma CA3_6_7I1PairP_check_0_2 : ∀ k l : Fin 6, contains (CA3_6_7I1PairRaw ((0,2),(k,l))) (CA3_6_7I1PairP ((0,2),(k,l))) = true := by + decide +kernel +lemma CA3_6_7I1PairP_check_0_3 : ∀ k l : Fin 6, contains (CA3_6_7I1PairRaw ((0,3),(k,l))) (CA3_6_7I1PairP ((0,3),(k,l))) = true := by + decide +kernel +lemma CA3_6_7I1PairP_check_0_4 : ∀ k l : Fin 6, contains (CA3_6_7I1PairRaw ((0,4),(k,l))) (CA3_6_7I1PairP ((0,4),(k,l))) = true := by + decide +kernel +lemma CA3_6_7I1PairP_check_0_5 : ∀ k l : Fin 6, contains (CA3_6_7I1PairRaw ((0,5),(k,l))) (CA3_6_7I1PairP ((0,5),(k,l))) = true := by + decide +kernel +lemma CA3_6_7I1PairP_check_1_0 : ∀ k l : Fin 6, contains (CA3_6_7I1PairRaw ((1,0),(k,l))) (CA3_6_7I1PairP ((1,0),(k,l))) = true := by + decide +kernel +lemma CA3_6_7I1PairP_check_1_1 : ∀ k l : Fin 6, contains (CA3_6_7I1PairRaw ((1,1),(k,l))) (CA3_6_7I1PairP ((1,1),(k,l))) = true := by + decide +kernel +lemma CA3_6_7I1PairP_check_1_2 : ∀ k l : Fin 6, contains (CA3_6_7I1PairRaw ((1,2),(k,l))) (CA3_6_7I1PairP ((1,2),(k,l))) = true := by + decide +kernel +lemma CA3_6_7I1PairP_check_1_3 : ∀ k l : Fin 6, contains (CA3_6_7I1PairRaw ((1,3),(k,l))) (CA3_6_7I1PairP ((1,3),(k,l))) = true := by + decide +kernel +lemma CA3_6_7I1PairP_check_1_4 : ∀ k l : Fin 6, contains (CA3_6_7I1PairRaw ((1,4),(k,l))) (CA3_6_7I1PairP ((1,4),(k,l))) = true := by + decide +kernel +lemma CA3_6_7I1PairP_check_1_5 : ∀ k l : Fin 6, contains (CA3_6_7I1PairRaw ((1,5),(k,l))) (CA3_6_7I1PairP ((1,5),(k,l))) = true := by + decide +kernel +lemma CA3_6_7I1PairP_check_2_0 : ∀ k l : Fin 6, contains (CA3_6_7I1PairRaw ((2,0),(k,l))) (CA3_6_7I1PairP ((2,0),(k,l))) = true := by + decide +kernel +lemma CA3_6_7I1PairP_check_2_1 : ∀ k l : Fin 6, contains (CA3_6_7I1PairRaw ((2,1),(k,l))) (CA3_6_7I1PairP ((2,1),(k,l))) = true := by + decide +kernel +lemma CA3_6_7I1PairP_check_2_2 : ∀ k l : Fin 6, contains (CA3_6_7I1PairRaw ((2,2),(k,l))) (CA3_6_7I1PairP ((2,2),(k,l))) = true := by + decide +kernel +lemma CA3_6_7I1PairP_check_2_3 : ∀ k l : Fin 6, contains (CA3_6_7I1PairRaw ((2,3),(k,l))) (CA3_6_7I1PairP ((2,3),(k,l))) = true := by + decide +kernel +lemma CA3_6_7I1PairP_check_2_4 : ∀ k l : Fin 6, contains (CA3_6_7I1PairRaw ((2,4),(k,l))) (CA3_6_7I1PairP ((2,4),(k,l))) = true := by + decide +kernel +lemma CA3_6_7I1PairP_check_2_5 : ∀ k l : Fin 6, contains (CA3_6_7I1PairRaw ((2,5),(k,l))) (CA3_6_7I1PairP ((2,5),(k,l))) = true := by + decide +kernel +lemma CA3_6_7I1PairP_check_3_0 : ∀ k l : Fin 6, contains (CA3_6_7I1PairRaw ((3,0),(k,l))) (CA3_6_7I1PairP ((3,0),(k,l))) = true := by + decide +kernel +lemma CA3_6_7I1PairP_check_3_1 : ∀ k l : Fin 6, contains (CA3_6_7I1PairRaw ((3,1),(k,l))) (CA3_6_7I1PairP ((3,1),(k,l))) = true := by + decide +kernel +lemma CA3_6_7I1PairP_check_3_2 : ∀ k l : Fin 6, contains (CA3_6_7I1PairRaw ((3,2),(k,l))) (CA3_6_7I1PairP ((3,2),(k,l))) = true := by + decide +kernel +lemma CA3_6_7I1PairP_check_3_3 : ∀ k l : Fin 6, contains (CA3_6_7I1PairRaw ((3,3),(k,l))) (CA3_6_7I1PairP ((3,3),(k,l))) = true := by + decide +kernel +lemma CA3_6_7I1PairP_check_3_4 : ∀ k l : Fin 6, contains (CA3_6_7I1PairRaw ((3,4),(k,l))) (CA3_6_7I1PairP ((3,4),(k,l))) = true := by + decide +kernel +lemma CA3_6_7I1PairP_check_3_5 : ∀ k l : Fin 6, contains (CA3_6_7I1PairRaw ((3,5),(k,l))) (CA3_6_7I1PairP ((3,5),(k,l))) = true := by + decide +kernel +lemma CA3_6_7I1PairP_check_4_0 : ∀ k l : Fin 6, contains (CA3_6_7I1PairRaw ((4,0),(k,l))) (CA3_6_7I1PairP ((4,0),(k,l))) = true := by + decide +kernel +lemma CA3_6_7I1PairP_check_4_1 : ∀ k l : Fin 6, contains (CA3_6_7I1PairRaw ((4,1),(k,l))) (CA3_6_7I1PairP ((4,1),(k,l))) = true := by + decide +kernel +lemma CA3_6_7I1PairP_check_4_2 : ∀ k l : Fin 6, contains (CA3_6_7I1PairRaw ((4,2),(k,l))) (CA3_6_7I1PairP ((4,2),(k,l))) = true := by + decide +kernel +lemma CA3_6_7I1PairP_check_4_3 : ∀ k l : Fin 6, contains (CA3_6_7I1PairRaw ((4,3),(k,l))) (CA3_6_7I1PairP ((4,3),(k,l))) = true := by + decide +kernel +lemma CA3_6_7I1PairP_check_4_4 : ∀ k l : Fin 6, contains (CA3_6_7I1PairRaw ((4,4),(k,l))) (CA3_6_7I1PairP ((4,4),(k,l))) = true := by + decide +kernel +lemma CA3_6_7I1PairP_check_4_5 : ∀ k l : Fin 6, contains (CA3_6_7I1PairRaw ((4,5),(k,l))) (CA3_6_7I1PairP ((4,5),(k,l))) = true := by + decide +kernel +lemma CA3_6_7I1PairP_check_5_0 : ∀ k l : Fin 6, contains (CA3_6_7I1PairRaw ((5,0),(k,l))) (CA3_6_7I1PairP ((5,0),(k,l))) = true := by + decide +kernel +lemma CA3_6_7I1PairP_check_5_1 : ∀ k l : Fin 6, contains (CA3_6_7I1PairRaw ((5,1),(k,l))) (CA3_6_7I1PairP ((5,1),(k,l))) = true := by + decide +kernel +lemma CA3_6_7I1PairP_check_5_2 : ∀ k l : Fin 6, contains (CA3_6_7I1PairRaw ((5,2),(k,l))) (CA3_6_7I1PairP ((5,2),(k,l))) = true := by + decide +kernel +lemma CA3_6_7I1PairP_check_5_3 : ∀ k l : Fin 6, contains (CA3_6_7I1PairRaw ((5,3),(k,l))) (CA3_6_7I1PairP ((5,3),(k,l))) = true := by + decide +kernel +lemma CA3_6_7I1PairP_check_5_4 : ∀ k l : Fin 6, contains (CA3_6_7I1PairRaw ((5,4),(k,l))) (CA3_6_7I1PairP ((5,4),(k,l))) = true := by + decide +kernel +lemma CA3_6_7I1PairP_check_5_5 : ∀ k l : Fin 6, contains (CA3_6_7I1PairRaw ((5,5),(k,l))) (CA3_6_7I1PairP ((5,5),(k,l))) = true := by + decide +kernel +lemma CA3_6_7I1PairP_check (a : PairSlot × PairSlot) : contains (CA3_6_7I1PairRaw a) (CA3_6_7I1PairP a) = true := by + rcases a with ⟨⟨i,j⟩,⟨k,l⟩⟩ + revert j i + apply forall_fin6 + · exact forall_fin6 (CA3_6_7I1PairP_check_0_0 k l) (CA3_6_7I1PairP_check_0_1 k l) (CA3_6_7I1PairP_check_0_2 k l) (CA3_6_7I1PairP_check_0_3 k l) (CA3_6_7I1PairP_check_0_4 k l) (CA3_6_7I1PairP_check_0_5 k l) + · exact forall_fin6 (CA3_6_7I1PairP_check_1_0 k l) (CA3_6_7I1PairP_check_1_1 k l) (CA3_6_7I1PairP_check_1_2 k l) (CA3_6_7I1PairP_check_1_3 k l) (CA3_6_7I1PairP_check_1_4 k l) (CA3_6_7I1PairP_check_1_5 k l) + · exact forall_fin6 (CA3_6_7I1PairP_check_2_0 k l) (CA3_6_7I1PairP_check_2_1 k l) (CA3_6_7I1PairP_check_2_2 k l) (CA3_6_7I1PairP_check_2_3 k l) (CA3_6_7I1PairP_check_2_4 k l) (CA3_6_7I1PairP_check_2_5 k l) + · exact forall_fin6 (CA3_6_7I1PairP_check_3_0 k l) (CA3_6_7I1PairP_check_3_1 k l) (CA3_6_7I1PairP_check_3_2 k l) (CA3_6_7I1PairP_check_3_3 k l) (CA3_6_7I1PairP_check_3_4 k l) (CA3_6_7I1PairP_check_3_5 k l) + · exact forall_fin6 (CA3_6_7I1PairP_check_4_0 k l) (CA3_6_7I1PairP_check_4_1 k l) (CA3_6_7I1PairP_check_4_2 k l) (CA3_6_7I1PairP_check_4_3 k l) (CA3_6_7I1PairP_check_4_4 k l) (CA3_6_7I1PairP_check_4_5 k l) + · exact forall_fin6 (CA3_6_7I1PairP_check_5_0 k l) (CA3_6_7I1PairP_check_5_1 k l) (CA3_6_7I1PairP_check_5_2 k l) (CA3_6_7I1PairP_check_5_3 k l) (CA3_6_7I1PairP_check_5_4 k l) (CA3_6_7I1PairP_check_5_5 k l) +lemma CA3_6_7I1PairP_sound (a : PairSlot × PairSlot) : + (CA3_6_7I1PairP a).Encloses (CA3_6_7I1PairValue a) := + contains_sound (CA3_6_7I1PairRaw_sound a) (CA3_6_7I1PairP_check a) +def CA3_6_7I1PairTerms (a : PairSlot × PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_6_7I1PairCertificates (CA3_6_7I1PairCertificateIndex a)).output +lemma CA3_6_7I1PairTerms_sound (a : PairSlot × PairSlot) : + (CA3_6_7I1PairTerms a).Encloses (Foundation.entropyTerm (CA3_6_7I1PairValue a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA3_6_7I1PairCertificates_valid + (CA3_6_7I1PairCertificateIndex a) (CA3_6_7I1PairP_sound a) +def CA3_6_7I1PairEntropy : Ball := ⟨(160708552106823370392863971663899 / 50000000000000000000000000000000), (67128393269 / 50000000000000000000000000000000)⟩ +lemma CA3_6_7I1PairEntropy_sound : CA3_6_7I1PairEntropy.Encloses (Foundation.finiteEntropy CA3_6_7I1PairValue) := by + exact contains_sound (entropyDoublePair_enclosed CA3_6_7I1PairValue CA3_6_7I1PairTerms CA3_6_7I1PairTerms_sound) (by decide +kernel) +def CA3_6_7I1PairMass : Ball := ⟨(49999999999999999999999999999993 / 50000000000000000000000000000000), (293 / 50000000000000000000000000000000)⟩ +lemma CA3_6_7I1PairMass_sound : CA3_6_7I1PairMass.Encloses (∑ a, CA3_6_7I1PairValue a) := by + exact contains_sound (doublePairSumBall_sound CA3_6_7I1PairP CA3_6_7I1PairValue CA3_6_7I1PairP_sound) (by decide +kernel) +def CA3_6_7I1PairMassTermLogWitness : LogWitness := ⟨-1, 49999999999999999999999999999993, 25000000000000000000000000000000⟩ +def CA3_6_7I1PairMassTermLog : Ball := ⟨(-7 / 50000000000000000000000000000000), (2646977997 / 6250000000000000000000000000000)⟩ +lemma CA3_6_7I1PairMassTermLog_sound : CA3_6_7I1PairMassTermLog.Encloses (Real.log ((∑ a, CA3_6_7I1PairValue a))) := by + exact checkLog_sound logTwoBall_sound (CA3_6_7I1PairMass_sound) (w := CA3_6_7I1PairMassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA3_6_7I1PairMassTerm : Ball := ⟨(7 / 50000000000000000000000000000000), (42351647953 / 100000000000000000000000000000000)⟩ +lemma CA3_6_7I1PairMassTerm_sound : CA3_6_7I1PairMassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA3_6_7I1PairValue a))) := by + exact contains_sound (entropyTerm_ball (CA3_6_7I1PairMass_sound) CA3_6_7I1PairMassTermLog_sound) (by decide +kernel) +def CA3_6_7I1PairH : Ball := ⟨(40177138026705842598215992915973 / 12500000000000000000000000000000), (176608434491 / 100000000000000000000000000000000)⟩ +lemma CA3_6_7I1PairH_sound : CA3_6_7I1PairH.Encloses (homogeneousEntropy CA3_6_7I1PairValue) := by + exact contains_sound (homogeneous_enclosed CA3_6_7I1PairValue CA3_6_7I1PairMassTerm_sound CA3_6_7I1PairEntropy_sound) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA3_6_7I2.lean b/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA3_6_7I2.lean new file mode 100644 index 0000000000000000000000000000000000000000..f223a08c3765c15e66ccaea0e1f28b786d14039b --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA3_6_7I2.lean @@ -0,0 +1,869 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.CapacityA.CapA3_6_7I2Pair + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CA3_6_7I2R0Value (a : PairSlot) : ℝ := residualLaw (below (shape 3 6 7)) (fun u => (stageALaw (shape 3 6 7) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 0 a +def CA3_6_7I2R0Raw (a : PairSlot) : Ball := residualBall (below (shape 3 6 7)) A3_6_7Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 0 a +lemma CA3_6_7I2R0Raw_sound (a : PairSlot) : + (CA3_6_7I2R0Raw a).Encloses (CA3_6_7I2R0Value a) := by + exact residualBall_sound_on (below (shape 3 6 7)) A3_6_7Law (fun u => (stageALaw (shape 3 6 7) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A3_6_7Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 3 6 7) (show (shape 3 6 7) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 0 a +def CA3_6_7I2R0Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(510077166889140883101150469 / 100000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ ⟨(6215860913120059024385980159 / 100000000000000000000000000000000), (82091 / 4000000000000000000000000000000)⟩ ⟨(-243722374441081436775523471546581 / 20000000000000000000000000000000), (201170521037 / 50000000000000000000000000000000)⟩ ⟨-18, 510077166889140883101150469, 381469726562500000000000000⟩] +lemma CA3_6_7I2R0Certificates_valid : + CA3_6_7I2R0Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA3_6_7I2R0CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 0, 0 => 1 + | _, _ => 0 +def CA3_6_7I2R0P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_6_7I2R0Certificates (CA3_6_7I2R0CertificateIndex a)).input +lemma CA3_6_7I2R0P_check : ∀ a : PairSlot, contains (CA3_6_7I2R0Raw a) (CA3_6_7I2R0P a) = true := by + decide +kernel +lemma CA3_6_7I2R0P_sound (a : PairSlot) : + (CA3_6_7I2R0P a).Encloses (CA3_6_7I2R0Value a) := + contains_sound (CA3_6_7I2R0Raw_sound a) (CA3_6_7I2R0P_check a) +def CA3_6_7I2R0Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_6_7I2R0Certificates (CA3_6_7I2R0CertificateIndex a)).output +lemma CA3_6_7I2R0Terms_sound (a : PairSlot) : + (CA3_6_7I2R0Terms a).Encloses (Foundation.entropyTerm (CA3_6_7I2R0Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA3_6_7I2R0Certificates_valid + (CA3_6_7I2R0CertificateIndex a) (CA3_6_7I2R0P_sound a) +def CA3_6_7I2R0Entropy : Ball := ⟨(6215860913120059024385980159 / 100000000000000000000000000000000), (82091 / 4000000000000000000000000000000)⟩ +lemma CA3_6_7I2R0Entropy_sound : CA3_6_7I2R0Entropy.Encloses (Foundation.finiteEntropy CA3_6_7I2R0Value) := by + exact contains_sound (entropyPair_enclosed CA3_6_7I2R0Value CA3_6_7I2R0Terms CA3_6_7I2R0Terms_sound) (by decide +kernel) +def CA3_6_7I2R0Mass : Ball := ⟨(510077166889140883101150469 / 100000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ +lemma CA3_6_7I2R0Mass_sound : CA3_6_7I2R0Mass.Encloses (∑ a, CA3_6_7I2R0Value a) := by + exact contains_sound (pairSumBall_sound CA3_6_7I2R0P CA3_6_7I2R0Value CA3_6_7I2R0P_sound) (by decide +kernel) +def CA3_6_7I2R0MassTermLogWitness : LogWitness := ⟨-18, 510077166889140883101150469, 381469726562500000000000000⟩ +def CA3_6_7I2R0MassTermLog : Ball := ⟨(-243722374441081436775523471546581 / 20000000000000000000000000000000), (201170521037 / 50000000000000000000000000000000)⟩ +lemma CA3_6_7I2R0MassTermLog_sound : CA3_6_7I2R0MassTermLog.Encloses (Real.log ((∑ a, CA3_6_7I2R0Value a))) := by + exact checkLog_sound logTwoBall_sound (CA3_6_7I2R0Mass_sound) (w := CA3_6_7I2R0MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA3_6_7I2R0MassTerm : Ball := ⟨(6215860913120059024385980159 / 100000000000000000000000000000000), (82091 / 4000000000000000000000000000000)⟩ +lemma CA3_6_7I2R0MassTerm_sound : CA3_6_7I2R0MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA3_6_7I2R0Value a))) := by + exact contains_sound (entropyTerm_ball (CA3_6_7I2R0Mass_sound) CA3_6_7I2R0MassTermLog_sound) (by decide +kernel) +def CA3_6_7I2R0H : Ball := ⟨0, (82091 / 2000000000000000000000000000000)⟩ +lemma CA3_6_7I2R0H_sound : CA3_6_7I2R0H.Encloses (homogeneousEntropy CA3_6_7I2R0Value) := by + exact contains_sound (homogeneous_enclosed CA3_6_7I2R0Value CA3_6_7I2R0MassTerm_sound CA3_6_7I2R0Entropy_sound) (by decide +kernel) +def CA3_6_7I2R1Value (a : PairSlot) : ℝ := residualLaw (below (shape 3 6 7)) (fun u => (stageALaw (shape 3 6 7) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 1 a +def CA3_6_7I2R1Raw (a : PairSlot) : Ball := residualBall (below (shape 3 6 7)) A3_6_7Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 1 a +lemma CA3_6_7I2R1Raw_sound (a : PairSlot) : + (CA3_6_7I2R1Raw a).Encloses (CA3_6_7I2R1Value a) := by + exact residualBall_sound_on (below (shape 3 6 7)) A3_6_7Law (fun u => (stageALaw (shape 3 6 7) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A3_6_7Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 3 6 7) (show (shape 3 6 7) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 1 a +def CA3_6_7I2R1Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(15968760802922606319500670023 / 25000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ ⟨(234932304814444663213154937893 / 50000000000000000000000000000000), (20289103 / 12500000000000000000000000000000)⟩ ⟨(-183899918498565726290099502470069 / 25000000000000000000000000000000), (63527472223 / 25000000000000000000000000000000)⟩ ⟨-11, 15968760802922606319500670023, 12207031250000000000000000000⟩] +lemma CA3_6_7I2R1Certificates_valid : + CA3_6_7I2R1Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA3_6_7I2R1CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 1, 0 => 1 + | 0, 1 => 1 + | _, _ => 0 +def CA3_6_7I2R1P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_6_7I2R1Certificates (CA3_6_7I2R1CertificateIndex a)).input +lemma CA3_6_7I2R1P_check : ∀ a : PairSlot, contains (CA3_6_7I2R1Raw a) (CA3_6_7I2R1P a) = true := by + decide +kernel +lemma CA3_6_7I2R1P_sound (a : PairSlot) : + (CA3_6_7I2R1P a).Encloses (CA3_6_7I2R1Value a) := + contains_sound (CA3_6_7I2R1Raw_sound a) (CA3_6_7I2R1P_check a) +def CA3_6_7I2R1Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_6_7I2R1Certificates (CA3_6_7I2R1CertificateIndex a)).output +lemma CA3_6_7I2R1Terms_sound (a : PairSlot) : + (CA3_6_7I2R1Terms a).Encloses (Foundation.entropyTerm (CA3_6_7I2R1Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA3_6_7I2R1Certificates_valid + (CA3_6_7I2R1CertificateIndex a) (CA3_6_7I2R1P_sound a) +def CA3_6_7I2R1Entropy : Ball := ⟨(234932304814444663213154937893 / 25000000000000000000000000000000), (20289103 / 6250000000000000000000000000000)⟩ +lemma CA3_6_7I2R1Entropy_sound : CA3_6_7I2R1Entropy.Encloses (Foundation.finiteEntropy CA3_6_7I2R1Value) := by + exact contains_sound (entropyPair_enclosed CA3_6_7I2R1Value CA3_6_7I2R1Terms CA3_6_7I2R1Terms_sound) (by decide +kernel) +def CA3_6_7I2R1Mass : Ball := ⟨(15968760802922606319500670023 / 12500000000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ +lemma CA3_6_7I2R1Mass_sound : CA3_6_7I2R1Mass.Encloses (∑ a, CA3_6_7I2R1Value a) := by + exact contains_sound (pairSumBall_sound CA3_6_7I2R1P CA3_6_7I2R1Value CA3_6_7I2R1P_sound) (by decide +kernel) +def CA3_6_7I2R1MassTermLogWitness : LogWitness := ⟨-10, 15968760802922606319500670023, 12207031250000000000000000000⟩ +def CA3_6_7I2R1MassTermLog : Ball := ⟨(-333142477969134187109337408414973 / 50000000000000000000000000000000), (232934065209 / 100000000000000000000000000000000)⟩ +lemma CA3_6_7I2R1MassTermLog_sound : CA3_6_7I2R1MassTermLog.Encloses (Real.log ((∑ a, CA3_6_7I2R1Value a))) := by + exact checkLog_sound logTwoBall_sound (CA3_6_7I2R1Mass_sound) (w := CA3_6_7I2R1MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA3_6_7I2R1MassTerm : Ball := ⟨(34047184281484914742132203749 / 4000000000000000000000000000000), (29757351 / 10000000000000000000000000000000)⟩ +lemma CA3_6_7I2R1MassTerm_sound : CA3_6_7I2R1MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA3_6_7I2R1Value a))) := by + exact contains_sound (entropyTerm_ball (CA3_6_7I2R1Mass_sound) CA3_6_7I2R1MassTermLog_sound) (by decide +kernel) +def CA3_6_7I2R1H : Ball := ⟨(88549612220655784299314657847 / 100000000000000000000000000000000), (311099579 / 50000000000000000000000000000000)⟩ +lemma CA3_6_7I2R1H_sound : CA3_6_7I2R1H.Encloses (homogeneousEntropy CA3_6_7I2R1Value) := by + exact contains_sound (homogeneous_enclosed CA3_6_7I2R1Value CA3_6_7I2R1MassTerm_sound CA3_6_7I2R1Entropy_sound) (by decide +kernel) +def CA3_6_7I2R2Value (a : PairSlot) : ℝ := residualLaw (below (shape 3 6 7)) (fun u => (stageALaw (shape 3 6 7) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 2 a +def CA3_6_7I2R2Raw (a : PairSlot) : Ball := residualBall (below (shape 3 6 7)) A3_6_7Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 2 a +lemma CA3_6_7I2R2Raw_sound (a : PairSlot) : + (CA3_6_7I2R2Raw a).Encloses (CA3_6_7I2R2Value a) := by + exact residualBall_sound_on (below (shape 3 6 7)) A3_6_7Law (fun u => (stageALaw (shape 3 6 7) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A3_6_7Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 3 6 7) (show (shape 3 6 7) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 2 a +def CA3_6_7I2R2Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(477245282311750937119086766437 / 50000000000000000000000000000000), (7 / 100000000000000000000000000000000)⟩ ⟨(1110012323836117085702419072269 / 25000000000000000000000000000000), (50530311 / 3125000000000000000000000000000)⟩ ⟨(-93034954140082938085692056837717 / 20000000000000000000000000000000), (169406590197 / 100000000000000000000000000000000)⟩ ⟨-7, 477245282311750937119086766437, 390625000000000000000000000000⟩, + .log ⟨(38152335994765504602303125379 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(547729532373760281308008249659 / 100000000000000000000000000000000), (96948861 / 50000000000000000000000000000000)⟩ ⟨(-22431847802226837266959381505543 / 3125000000000000000000000000000), (127054942753 / 50000000000000000000000000000000)⟩ ⟨-11, 38152335994765504602303125379, 24414062500000000000000000000⟩, + .log ⟨(879916248847869827298756043493 / 25000000000000000000000000000000), (19 / 100000000000000000000000000000000)⟩ ⟨(5889815098456610719804441545373 / 50000000000000000000000000000000), (894381681 / 20000000000000000000000000000000)⟩ ⟨(-66936087453419792162832007461427 / 20000000000000000000000000000000), (127054942637 / 100000000000000000000000000000000)⟩ ⟨-5, 879916248847869827298756043493, 781250000000000000000000000000⟩] +lemma CA3_6_7I2R2Certificates_valid : + CA3_6_7I2R2Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA3_6_7I2R2CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 2, 0 => 1 + | 3, 0 => 2 + | 1, 1 => 3 + | 0, 2 => 1 + | 0, 3 => 2 + | _, _ => 0 +def CA3_6_7I2R2P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_6_7I2R2Certificates (CA3_6_7I2R2CertificateIndex a)).input +lemma CA3_6_7I2R2P_check : ∀ a : PairSlot, contains (CA3_6_7I2R2Raw a) (CA3_6_7I2R2P a) = true := by + decide +kernel +lemma CA3_6_7I2R2P_sound (a : PairSlot) : + (CA3_6_7I2R2P a).Encloses (CA3_6_7I2R2Value a) := + contains_sound (CA3_6_7I2R2Raw_sound a) (CA3_6_7I2R2P_check a) +def CA3_6_7I2R2Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_6_7I2R2Certificates (CA3_6_7I2R2CertificateIndex a)).output +lemma CA3_6_7I2R2Terms_sound (a : PairSlot) : + (CA3_6_7I2R2Terms a).Encloses (Foundation.entropyTerm (CA3_6_7I2R2Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA3_6_7I2R2Certificates_valid + (CA3_6_7I2R2CertificateIndex a) (CA3_6_7I2R2P_sound a) +def CA3_6_7I2R2Entropy : Ball := ⟨(2719398481543709835980531521027 / 12500000000000000000000000000000), (8093643753 / 100000000000000000000000000000000)⟩ +lemma CA3_6_7I2R2Entropy_sound : CA3_6_7I2R2Entropy.Encloses (Foundation.finiteEntropy CA3_6_7I2R2Value) := by + exact contains_sound (entropyPair_enclosed CA3_6_7I2R2Value CA3_6_7I2R2Terms CA3_6_7I2R2Terms_sound) (by decide +kernel) +def CA3_6_7I2R2Mass : Ball := ⟨(1395313867154386269020145935309 / 25000000000000000000000000000000), (7 / 20000000000000000000000000000000)⟩ +lemma CA3_6_7I2R2Mass_sound : CA3_6_7I2R2Mass.Encloses (∑ a, CA3_6_7I2R2Value a) := by + exact contains_sound (pairSumBall_sound CA3_6_7I2R2P CA3_6_7I2R2Value CA3_6_7I2R2P_sound) (by decide +kernel) +def CA3_6_7I2R2MassTermLogWitness : LogWitness := ⟨-5, 1395313867154386269020145935309, 781250000000000000000000000000⟩ +def CA3_6_7I2R2MassTermLog : Ball := ⟨(-288575644052640630693851869710027 / 100000000000000000000000000000000), (5082197709 / 4000000000000000000000000000000)⟩ +lemma CA3_6_7I2R2MassTermLog_sound : CA3_6_7I2R2MassTermLog.Encloses (Real.log ((∑ a, CA3_6_7I2R2Value a))) := by + exact checkLog_sound logTwoBall_sound (CA3_6_7I2R2Mass_sound) (w := CA3_6_7I2R2MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA3_6_7I2R2MassTerm : Ball := ⟨(1610614391478630667960520793111 / 10000000000000000000000000000000), (7091261041 / 100000000000000000000000000000000)⟩ +lemma CA3_6_7I2R2MassTerm_sound : CA3_6_7I2R2MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA3_6_7I2R2Value a))) := by + exact contains_sound (entropyTerm_ball (CA3_6_7I2R2Mass_sound) CA3_6_7I2R2MassTermLog_sound) (by decide +kernel) +def CA3_6_7I2R2H : Ball := ⟨(2824521968781686004119522118553 / 50000000000000000000000000000000), (7592452397 / 50000000000000000000000000000000)⟩ +lemma CA3_6_7I2R2H_sound : CA3_6_7I2R2H.Encloses (homogeneousEntropy CA3_6_7I2R2Value) := by + exact contains_sound (homogeneous_enclosed CA3_6_7I2R2Value CA3_6_7I2R2MassTerm_sound CA3_6_7I2R2Entropy_sound) (by decide +kernel) +def CA3_6_7I2R3Value (a : PairSlot) : ℝ := residualLaw (below (shape 3 6 7)) (fun u => (stageALaw (shape 3 6 7) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 3 a +def CA3_6_7I2R3Raw (a : PairSlot) : Ball := residualBall (below (shape 3 6 7)) A3_6_7Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 3 a +lemma CA3_6_7I2R3Raw_sound (a : PairSlot) : + (CA3_6_7I2R3Raw a).Encloses (CA3_6_7I2R3Value a) := by + exact residualBall_sound_on (below (shape 3 6 7)) A3_6_7Law (fun u => (stageALaw (shape 3 6 7) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A3_6_7Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 3 6 7) (show (shape 3 6 7) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 3 a +def CA3_6_7I2R3Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(567795852019300251504803927923 / 100000000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ ⟨(1468082600177086758535443553069 / 50000000000000000000000000000000), (541059531 / 50000000000000000000000000000000)⟩ ⟨(-64639544078915901459433614126637 / 12500000000000000000000000000000), (190582413851 / 100000000000000000000000000000000)⟩ ⟨-8, 567795852019300251504803927923, 390625000000000000000000000000⟩, + .log ⟨(311100063325647116279805366219 / 1562500000000000000000000000000), (13 / 25000000000000000000000000000000)⟩ ⟨(32133954095489082123096793032849 / 100000000000000000000000000000000), (4216192091 / 25000000000000000000000000000000)⟩ ⟨(-1260881073557026003992896102513 / 781250000000000000000000000000), (84703294993 / 100000000000000000000000000000000)⟩ ⟨-3, 311100063325647116279805366219, 195312500000000000000000000000⟩, + .log ⟨(47638226062113775386381662603 / 4000000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ ⟨(527642674996320405337245134667 / 10000000000000000000000000000000), (1008778687 / 50000000000000000000000000000000)⟩ ⟨(-221520706630992528807325566725471 / 50000000000000000000000000000000), (169406589799 / 100000000000000000000000000000000)⟩ ⟨-7, 47638226062113775386381662603, 31250000000000000000000000000⟩] +lemma CA3_6_7I2R3Certificates_valid : + CA3_6_7I2R3Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA3_6_7I2R3CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 4, 0 => 1 + | 2, 1 => 2 + | 3, 1 => 3 + | 1, 2 => 2 + | 1, 3 => 3 + | 0, 4 => 1 + | _, _ => 0 +def CA3_6_7I2R3P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_6_7I2R3Certificates (CA3_6_7I2R3CertificateIndex a)).input +lemma CA3_6_7I2R3P_check : ∀ a : PairSlot, contains (CA3_6_7I2R3Raw a) (CA3_6_7I2R3P a) = true := by + decide +kernel +lemma CA3_6_7I2R3P_sound (a : PairSlot) : + (CA3_6_7I2R3P a).Encloses (CA3_6_7I2R3Value a) := + contains_sound (CA3_6_7I2R3Raw_sound a) (CA3_6_7I2R3P_check a) +def CA3_6_7I2R3Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_6_7I2R3Certificates (CA3_6_7I2R3CertificateIndex a)).output +lemma CA3_6_7I2R3Terms_sound (a : PairSlot) : + (CA3_6_7I2R3Terms a).Encloses (Foundation.entropyTerm (CA3_6_7I2R3Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA3_6_7I2R3Certificates_valid + (CA3_6_7I2R3CertificateIndex a) (CA3_6_7I2R3P_sound a) +def CA3_6_7I2R3Entropy : Ball := ⟨(40346546045806459693540131485657 / 50000000000000000000000000000000), (6238889 / 15625000000000000000000000000)⟩ +lemma CA3_6_7I2R3Entropy_sound : CA3_6_7I2R3Entropy.Encloses (Foundation.finiteEntropy CA3_6_7I2R3Value) := by + exact contains_sound (entropyPair_enclosed CA3_6_7I2R3Value CA3_6_7I2R3Terms CA3_6_7I2R3Terms_sound) (by decide +kernel) +def CA3_6_7I2R3Mass : Ball := ⟨(10834577778206780039035944465507 / 25000000000000000000000000000000), (3 / 2500000000000000000000000000000)⟩ +lemma CA3_6_7I2R3Mass_sound : CA3_6_7I2R3Mass.Encloses (∑ a, CA3_6_7I2R3Value a) := by + exact contains_sound (pairSumBall_sound CA3_6_7I2R3P CA3_6_7I2R3Value CA3_6_7I2R3P_sound) (by decide +kernel) +def CA3_6_7I2R3MassTermLogWitness : LogWitness := ⟨-2, 10834577778206780039035944465507, 6250000000000000000000000000000⟩ +def CA3_6_7I2R3MassTermLog : Ball := ⟨(-41806657948170529576606332041273 / 50000000000000000000000000000000), (31763735663 / 50000000000000000000000000000000)⟩ +lemma CA3_6_7I2R3MassTermLog_sound : CA3_6_7I2R3MassTermLog.Encloses (Real.log ((∑ a, CA3_6_7I2R3Value a))) := by + exact checkLog_sound logTwoBall_sound (CA3_6_7I2R3Mass_sound) (w := CA3_6_7I2R3MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA3_6_7I2R3MassTerm : Ball := ⟨(9059149743726805557353515876951 / 25000000000000000000000000000000), (13765866633 / 50000000000000000000000000000000)⟩ +lemma CA3_6_7I2R3MassTerm_sound : CA3_6_7I2R3MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA3_6_7I2R3Value a))) := by + exact contains_sound (entropyTerm_ball (CA3_6_7I2R3Mass_sound) CA3_6_7I2R3MassTermLog_sound) (by decide +kernel) +def CA3_6_7I2R3H : Ball := ⟨(4445649311670569715766619946351 / 10000000000000000000000000000000), (33730311433 / 50000000000000000000000000000000)⟩ +lemma CA3_6_7I2R3H_sound : CA3_6_7I2R3H.Encloses (homogeneousEntropy CA3_6_7I2R3Value) := by + exact contains_sound (homogeneous_enclosed CA3_6_7I2R3Value CA3_6_7I2R3MassTerm_sound CA3_6_7I2R3Entropy_sound) (by decide +kernel) +def CA3_6_7I2R4Value (a : PairSlot) : ℝ := residualLaw (below (shape 3 6 7)) (fun u => (stageALaw (shape 3 6 7) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 4 a +def CA3_6_7I2R4Raw (a : PairSlot) : Ball := residualBall (below (shape 3 6 7)) A3_6_7Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 4 a +lemma CA3_6_7I2R4Raw_sound (a : PairSlot) : + (CA3_6_7I2R4Raw a).Encloses (CA3_6_7I2R4Value a) := by + exact residualBall_sound_on (below (shape 3 6 7)) A3_6_7Law (fun u => (stageALaw (shape 3 6 7) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A3_6_7Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 3 6 7) (show (shape 3 6 7) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 4 a +def CA3_6_7I2R4Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(3768749892159534350335996687 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(71553748748950638591755501697 / 100000000000000000000000000000000), (11970963 / 50000000000000000000000000000000)⟩ ⟨(-474651746576565528898713404248329 / 50000000000000000000000000000000), (317637368511 / 100000000000000000000000000000000)⟩ ⟨-14, 3768749892159534350335996687, 3051757812500000000000000000⟩, + .log ⟨(2792838143596750317951640780591 / 100000000000000000000000000000000), (13 / 100000000000000000000000000000000)⟩ ⟨(4996543630377774947215172552777 / 50000000000000000000000000000000), (1034961357 / 25000000000000000000000000000000)⟩ ⟨(-89452796285985042397580038367151 / 25000000000000000000000000000000), (74115383123 / 50000000000000000000000000000000)⟩ ⟨-6, 2792838143596750317951640780591, 1562500000000000000000000000000⟩, + .log ⟨(29414183677947483565488001407433 / 100000000000000000000000000000000), (37 / 50000000000000000000000000000000)⟩ ⟨(17996968127377864700049875330099 / 50000000000000000000000000000000), (9343043593 / 50000000000000000000000000000000)⟩ ⟨(-61184659497691998813411265309479 / 50000000000000000000000000000000), (635274713 / 1000000000000000000000000000000)⟩ ⟨-2, 29414183677947483565488001407433, 25000000000000000000000000000000⟩, + .log ⟨(282750923241728381146325694403 / 20000000000000000000000000000000), (1 / 20000000000000000000000000000000)⟩ ⟨(240842778697585860676165656007 / 4000000000000000000000000000000), (1197496753 / 50000000000000000000000000000000)⟩ ⟨(-212946058616124691300388830144329 / 50000000000000000000000000000000), (169406589817 / 100000000000000000000000000000000)⟩ ⟨-7, 282750923241728381146325694403, 156250000000000000000000000000⟩, + .log ⟨(9088838716492686883361028827 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(174879263863739341370795689247 / 50000000000000000000000000000000), (125101379 / 100000000000000000000000000000000)⟩ ⟨(-384822020323458676893310429719563 / 50000000000000000000000000000000), (275285710079 / 100000000000000000000000000000000)⟩ ⟨-12, 9088838716492686883361028827, 4882812500000000000000000000⟩] +lemma CA3_6_7I2R4Certificates_valid : + CA3_6_7I2R4Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA3_6_7I2R4CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 5, 0 => 1 + | 4, 1 => 2 + | 2, 2 => 3 + | 2, 3 => 4 + | 3, 2 => 4 + | 3, 3 => 5 + | 1, 4 => 2 + | 0, 5 => 1 + | _, _ => 0 +def CA3_6_7I2R4P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_6_7I2R4Certificates (CA3_6_7I2R4CertificateIndex a)).input +lemma CA3_6_7I2R4P_check : ∀ a : PairSlot, contains (CA3_6_7I2R4Raw a) (CA3_6_7I2R4P a) = true := by + decide +kernel +lemma CA3_6_7I2R4P_sound (a : PairSlot) : + (CA3_6_7I2R4P a).Encloses (CA3_6_7I2R4Value a) := + contains_sound (CA3_6_7I2R4Raw_sound a) (CA3_6_7I2R4P_check a) +def CA3_6_7I2R4Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_6_7I2R4Certificates (CA3_6_7I2R4CertificateIndex a)).output +lemma CA3_6_7I2R4Terms_sound (a : PairSlot) : + (CA3_6_7I2R4Terms a).Encloses (Foundation.entropyTerm (CA3_6_7I2R4Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA3_6_7I2R4Certificates_valid + (CA3_6_7I2R4CertificateIndex a) (CA3_6_7I2R4P_sound a) +def CA3_6_7I2R4Entropy : Ball := ⟨(8564389467046437772836728256693 / 12500000000000000000000000000000), (6385750057 / 20000000000000000000000000000000)⟩ +lemma CA3_6_7I2R4Entropy_sound : CA3_6_7I2R4Entropy.Encloses (Foundation.finiteEntropy CA3_6_7I2R4Value) := by + exact contains_sound (entropyPair_enclosed CA3_6_7I2R4Value CA3_6_7I2R4Terms CA3_6_7I2R4Terms_sound) (by decide +kernel) +def CA3_6_7I2R4Mass : Ball := ⟨(4735986048838671198084086130441 / 12500000000000000000000000000000), (113 / 100000000000000000000000000000000)⟩ +lemma CA3_6_7I2R4Mass_sound : CA3_6_7I2R4Mass.Encloses (∑ a, CA3_6_7I2R4Value a) := by + exact contains_sound (pairSumBall_sound CA3_6_7I2R4P CA3_6_7I2R4Value CA3_6_7I2R4P_sound) (by decide +kernel) +def CA3_6_7I2R4MassTermLogWitness : LogWitness := ⟨-2, 4735986048838671198084086130441, 3125000000000000000000000000000⟩ +def CA3_6_7I2R4MassTermLog : Ball := ⟨(-24263467312493783074333674577909 / 25000000000000000000000000000000), (63527471347 / 100000000000000000000000000000000)⟩ +lemma CA3_6_7I2R4MassTermLog_sound : CA3_6_7I2R4MassTermLog.Encloses (Real.log ((∑ a, CA3_6_7I2R4Value a))) := by + exact checkLog_sound logTwoBall_sound (CA3_6_7I2R4Mass_sound) (w := CA3_6_7I2R4MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA3_6_7I2R4MassTerm : Ball := ⟨(36771661660295578856776336701901 / 100000000000000000000000000000000), (1504326097 / 6250000000000000000000000000000)⟩ +lemma CA3_6_7I2R4MassTerm_sound : CA3_6_7I2R4MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA3_6_7I2R4Value a))) := by + exact contains_sound (entropyTerm_ball (CA3_6_7I2R4Mass_sound) CA3_6_7I2R4MassTermLog_sound) (by decide +kernel) +def CA3_6_7I2R4H : Ball := ⟨(31743454076075923325917489351643 / 100000000000000000000000000000000), (55997967837 / 100000000000000000000000000000000)⟩ +lemma CA3_6_7I2R4H_sound : CA3_6_7I2R4H.Encloses (homogeneousEntropy CA3_6_7I2R4Value) := by + exact contains_sound (homogeneous_enclosed CA3_6_7I2R4Value CA3_6_7I2R4MassTerm_sound CA3_6_7I2R4Entropy_sound) (by decide +kernel) +def CA3_6_7I2R5Value (a : PairSlot) : ℝ := residualLaw (below (shape 3 6 7)) (fun u => (stageALaw (shape 3 6 7) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 5 a +def CA3_6_7I2R5Raw (a : PairSlot) : Ball := residualBall (below (shape 3 6 7)) A3_6_7Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 5 a +lemma CA3_6_7I2R5Raw_sound (a : PairSlot) : + (CA3_6_7I2R5Raw a).Encloses (CA3_6_7I2R5Value a) := by + exact residualBall_sound_on (below (shape 3 6 7)) A3_6_7Law (fun u => (stageALaw (shape 3 6 7) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A3_6_7Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 3 6 7) (show (shape 3 6 7) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 5 a +def CA3_6_7I2R5Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(1216107865961754398594619603 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(25840158610198170353919045319 / 100000000000000000000000000000000), (4377861 / 50000000000000000000000000000000)⟩ ⟨(-33200383747624250480192038192331 / 3125000000000000000000000000000), (14399561749 / 4000000000000000000000000000000)⟩ ⟨-16, 1216107865961754398594619603, 762939453125000000000000000⟩, + .log ⟨(1564187444353850080428827484441 / 100000000000000000000000000000000), (9 / 100000000000000000000000000000000)⟩ ⟨(3251792173155456238670031825677 / 50000000000000000000000000000000), (1159303537 / 50000000000000000000000000000000)⟩ ⟨(-207890185085761157122574860119299 / 50000000000000000000000000000000), (37057691589 / 25000000000000000000000000000000)⟩ ⟨-6, 1564187444353850080428827484441, 1562500000000000000000000000000⟩, + .log ⟨(57974565660091486457204397023 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(432079862146993216554855326163 / 100000000000000000000000000000000), (147319111 / 100000000000000000000000000000000)⟩ ⟨(-372646053685252719502649276073761 / 50000000000000000000000000000000), (1588186787 / 625000000000000000000000000000)⟩ ⟨-11, 57974565660091486457204397023, 48828125000000000000000000000⟩] +lemma CA3_6_7I2R5Certificates_valid : + CA3_6_7I2R5Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA3_6_7I2R5CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 5, 1 => 1 + | 4, 2 => 2 + | 4, 3 => 3 + | 2, 4 => 2 + | 3, 4 => 3 + | 1, 5 => 1 + | _, _ => 0 +def CA3_6_7I2R5P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_6_7I2R5Certificates (CA3_6_7I2R5CertificateIndex a)).input +lemma CA3_6_7I2R5P_check : ∀ a : PairSlot, contains (CA3_6_7I2R5Raw a) (CA3_6_7I2R5P a) = true := by + decide +kernel +lemma CA3_6_7I2R5P_sound (a : PairSlot) : + (CA3_6_7I2R5P a).Encloses (CA3_6_7I2R5Value a) := + contains_sound (CA3_6_7I2R5Raw_sound a) (CA3_6_7I2R5P_check a) +def CA3_6_7I2R5Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_6_7I2R5Certificates (CA3_6_7I2R5CertificateIndex a)).output +lemma CA3_6_7I2R5Terms_sound (a : PairSlot) : + (CA3_6_7I2R5Terms a).Encloses (Foundation.entropyTerm (CA3_6_7I2R5Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA3_6_7I2R5Certificates_valid + (CA3_6_7I2R5CertificateIndex a) (CA3_6_7I2R5P_sound a) +def CA3_6_7I2R5Entropy : Ball := ⟨(1740376091767025966062209505709 / 12500000000000000000000000000000), (2474681907 / 50000000000000000000000000000000)⟩ +lemma CA3_6_7I2R5Entropy_sound : CA3_6_7I2R5Entropy.Encloses (Foundation.finiteEntropy CA3_6_7I2R5Value) := by + exact contains_sound (entropyPair_enclosed CA3_6_7I2R5Value CA3_6_7I2R5Terms CA3_6_7I2R5Terms_sound) (by decide +kernel) +def CA3_6_7I2R5Mass : Ball := ⟨(162459422574586507568322112067 / 5000000000000000000000000000000), (11 / 50000000000000000000000000000000)⟩ +lemma CA3_6_7I2R5Mass_sound : CA3_6_7I2R5Mass.Encloses (∑ a, CA3_6_7I2R5Value a) := by + exact contains_sound (pairSumBall_sound CA3_6_7I2R5P CA3_6_7I2R5Value CA3_6_7I2R5P_sound) (by decide +kernel) +def CA3_6_7I2R5MassTermLogWitness : LogWitness := ⟨-5, 162459422574586507568322112067, 156250000000000000000000000000⟩ +def CA3_6_7I2R5MassTermLog : Ball := ⟨(-342676492806180126403811039545367 / 100000000000000000000000000000000), (63527471387 / 50000000000000000000000000000000)⟩ +lemma CA3_6_7I2R5MassTermLog_sound : CA3_6_7I2R5MassTermLog.Encloses (Real.log ((∑ a, CA3_6_7I2R5Value a))) := by + exact checkLog_sound logTwoBall_sound (CA3_6_7I2R5Mass_sound) (w := CA3_6_7I2R5MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA3_6_7I2R5MassTerm : Ball := ⟨(11134205030235294118142875014453 / 100000000000000000000000000000000), (1032063651 / 25000000000000000000000000000000)⟩ +lemma CA3_6_7I2R5MassTerm_sound : CA3_6_7I2R5MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA3_6_7I2R5Value a))) := by + exact contains_sound (entropyTerm_ball (CA3_6_7I2R5Mass_sound) CA3_6_7I2R5MassTermLog_sound) (by decide +kernel) +def CA3_6_7I2R5H : Ball := ⟨(2788803703900913610354801031219 / 100000000000000000000000000000000), (4538809209 / 50000000000000000000000000000000)⟩ +lemma CA3_6_7I2R5H_sound : CA3_6_7I2R5H.Encloses (homogeneousEntropy CA3_6_7I2R5Value) := by + exact contains_sound (homogeneous_enclosed CA3_6_7I2R5Value CA3_6_7I2R5MassTerm_sound CA3_6_7I2R5Entropy_sound) (by decide +kernel) +def CA3_6_7I2R6Value (a : PairSlot) : ℝ := residualLaw (below (shape 3 6 7)) (fun u => (stageALaw (shape 3 6 7) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 6 a +def CA3_6_7I2R6Raw (a : PairSlot) : Ball := residualBall (below (shape 3 6 7)) A3_6_7Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 6 a +lemma CA3_6_7I2R6Raw_sound (a : PairSlot) : + (CA3_6_7I2R6Raw a).Encloses (CA3_6_7I2R6Value a) := by + exact residualBall_sound_on (below (shape 3 6 7)) A3_6_7Law (fun u => (stageALaw (shape 3 6 7) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A3_6_7Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 3 6 7) (show (shape 3 6 7) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 6 a +def CA3_6_7I2R6Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(55691222659172165829909123 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(44523114681774951754400271 / 1250000000000000000000000000000), (589661 / 50000000000000000000000000000000)⟩ ⟨(-639571013971152418277419202643777 / 50000000000000000000000000000000), (423516832783 / 100000000000000000000000000000000)⟩ ⟨-19, 55691222659172165829909123, 38146972656250000000000000⟩, + .log ⟨(17543840399584406054003 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(39410014844335261591411 / 10000000000000000000000000000000), (151 / 100000000000000000000000000000000)⟩ ⟨(-2246373310901120642882203537001479 / 100000000000000000000000000000000), (181419502869 / 25000000000000000000000000000000)⟩ ⟨-33, 35087680799168812108006, 23283064365386962890625⟩, + .log ⟨(912451327469080514362939317 / 3125000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ ⟨(237640578461297954800636751903 / 100000000000000000000000000000000), (40189579 / 50000000000000000000000000000000)⟩ ⟨(-406940504843925985159635726043001 / 50000000000000000000000000000000), (34410714341 / 12500000000000000000000000000000)⟩ ⟨-12, 912451327469080514362939317, 762939453125000000000000000⟩] +lemma CA3_6_7I2R6Certificates_valid : + CA3_6_7I2R6Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA3_6_7I2R6CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 5, 2 => 1 + | 5, 3 => 2 + | 4, 4 => 3 + | 2, 5 => 1 + | 3, 5 => 2 + | _, _ => 0 +def CA3_6_7I2R6P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_6_7I2R6Certificates (CA3_6_7I2R6CertificateIndex a)).input +lemma CA3_6_7I2R6P_check : ∀ a : PairSlot, contains (CA3_6_7I2R6Raw a) (CA3_6_7I2R6P a) = true := by + decide +kernel +lemma CA3_6_7I2R6P_sound (a : PairSlot) : + (CA3_6_7I2R6P a).Encloses (CA3_6_7I2R6Value a) := + contains_sound (CA3_6_7I2R6Raw_sound a) (CA3_6_7I2R6P_check a) +def CA3_6_7I2R6Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_6_7I2R6Certificates (CA3_6_7I2R6CertificateIndex a)).output +lemma CA3_6_7I2R6Terms_sound (a : PairSlot) : + (CA3_6_7I2R6Terms a).Encloses (Foundation.entropyTerm (CA3_6_7I2R6Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA3_6_7I2R6Certificates_valid + (CA3_6_7I2R6CertificateIndex a) (CA3_6_7I2R6P_sound a) +def CA3_6_7I2R6Entropy : Ball := ⟨(244765065010678833786572623483 / 100000000000000000000000000000000), (10342263 / 12500000000000000000000000000000)⟩ +lemma CA3_6_7I2R6Entropy_sound : CA3_6_7I2R6Entropy.Encloses (Foundation.finiteEntropy CA3_6_7I2R6Value) := by + exact contains_sound (entropyPair_enclosed CA3_6_7I2R6Value CA3_6_7I2R6Terms CA3_6_7I2R6Terms_sound) (by decide +kernel) +def CA3_6_7I2R6Mass : Ball := ⟨(1487769489664154864336262869 / 5000000000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ +lemma CA3_6_7I2R6Mass_sound : CA3_6_7I2R6Mass.Encloses (∑ a, CA3_6_7I2R6Value a) := by + exact contains_sound (pairSumBall_sound CA3_6_7I2R6P CA3_6_7I2R6Value CA3_6_7I2R6P_sound) (by decide +kernel) +def CA3_6_7I2R6MassTermLogWitness : LogWitness := ⟨-12, 1487769489664154864336262869, 1220703125000000000000000000⟩ +def CA3_6_7I2R6MassTermLog : Ball := ⟨(-811991517986568473916712948623463 / 100000000000000000000000000000000), (275285728043 / 100000000000000000000000000000000)⟩ +lemma CA3_6_7I2R6MassTermLog_sound : CA3_6_7I2R6MassTermLog.Encloses (Real.log ((∑ a, CA3_6_7I2R6Value a))) := by + exact checkLog_sound logTwoBall_sound (CA3_6_7I2R6Mass_sound) (w := CA3_6_7I2R6MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA3_6_7I2R6MassTerm : Ball := ⟨(241611241265299880754628677639 / 100000000000000000000000000000000), (81912391 / 100000000000000000000000000000000)⟩ +lemma CA3_6_7I2R6MassTerm_sound : CA3_6_7I2R6MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA3_6_7I2R6Value a))) := by + exact contains_sound (entropyTerm_ball (CA3_6_7I2R6Mass_sound) CA3_6_7I2R6MassTermLog_sound) (by decide +kernel) +def CA3_6_7I2R6H : Ball := ⟨(788455936344738257985986461 / 25000000000000000000000000000000), (32930099 / 20000000000000000000000000000000)⟩ +lemma CA3_6_7I2R6H_sound : CA3_6_7I2R6H.Encloses (homogeneousEntropy CA3_6_7I2R6Value) := by + exact contains_sound (homogeneous_enclosed CA3_6_7I2R6Value CA3_6_7I2R6MassTerm_sound CA3_6_7I2R6Entropy_sound) (by decide +kernel) +def CA3_6_7I2R7Value (a : PairSlot) : ℝ := residualLaw (below (shape 3 6 7)) (fun u => (stageALaw (shape 3 6 7) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 7 a +def CA3_6_7I2R7Raw (a : PairSlot) : Ball := residualBall (below (shape 3 6 7)) A3_6_7Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 7 a +lemma CA3_6_7I2R7Raw_sound (a : PairSlot) : + (CA3_6_7I2R7Raw a).Encloses (CA3_6_7I2R7Value a) := by + exact residualBall_sound_on (below (shape 3 6 7)) A3_6_7Law (fun u => (stageALaw (shape 3 6 7) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A3_6_7Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 3 6 7) (show (shape 3 6 7) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 7 a +def CA3_6_7I2R7Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA3_6_7I2R7Certificates_valid : + CA3_6_7I2R7Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA3_6_7I2R7CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA3_6_7I2R7P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_6_7I2R7Certificates (CA3_6_7I2R7CertificateIndex a)).input +lemma CA3_6_7I2R7P_check : ∀ a : PairSlot, contains (CA3_6_7I2R7Raw a) (CA3_6_7I2R7P a) = true := by + decide +kernel +lemma CA3_6_7I2R7P_sound (a : PairSlot) : + (CA3_6_7I2R7P a).Encloses (CA3_6_7I2R7Value a) := + contains_sound (CA3_6_7I2R7Raw_sound a) (CA3_6_7I2R7P_check a) +def CA3_6_7I2R7Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_6_7I2R7Certificates (CA3_6_7I2R7CertificateIndex a)).output +lemma CA3_6_7I2R7Terms_sound (a : PairSlot) : + (CA3_6_7I2R7Terms a).Encloses (Foundation.entropyTerm (CA3_6_7I2R7Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA3_6_7I2R7Certificates_valid + (CA3_6_7I2R7CertificateIndex a) (CA3_6_7I2R7P_sound a) +def CA3_6_7I2R7Entropy : Ball := ⟨0, 0⟩ +lemma CA3_6_7I2R7Entropy_sound : CA3_6_7I2R7Entropy.Encloses (Foundation.finiteEntropy CA3_6_7I2R7Value) := by + exact contains_sound (entropyPair_enclosed CA3_6_7I2R7Value CA3_6_7I2R7Terms CA3_6_7I2R7Terms_sound) (by decide +kernel) +def CA3_6_7I2R7Mass : Ball := ⟨0, 0⟩ +lemma CA3_6_7I2R7Mass_sound : CA3_6_7I2R7Mass.Encloses (∑ a, CA3_6_7I2R7Value a) := by + exact contains_sound (pairSumBall_sound CA3_6_7I2R7P CA3_6_7I2R7Value CA3_6_7I2R7P_sound) (by decide +kernel) +def CA3_6_7I2R7MassTerm : Ball := .exact 0 +lemma CA3_6_7I2R7MassTerm_sound : CA3_6_7I2R7MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA3_6_7I2R7Value a))) := + entropyTerm_zero_ball (CA3_6_7I2R7Mass_sound) +def CA3_6_7I2R7H : Ball := ⟨0, 0⟩ +lemma CA3_6_7I2R7H_sound : CA3_6_7I2R7H.Encloses (homogeneousEntropy CA3_6_7I2R7Value) := by + exact contains_sound (homogeneous_enclosed CA3_6_7I2R7Value CA3_6_7I2R7MassTerm_sound CA3_6_7I2R7Entropy_sound) (by decide +kernel) +def CA3_6_7I2R8Value (a : PairSlot) : ℝ := residualLaw (below (shape 3 6 7)) (fun u => (stageALaw (shape 3 6 7) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 8 a +def CA3_6_7I2R8Raw (a : PairSlot) : Ball := residualBall (below (shape 3 6 7)) A3_6_7Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 8 a +lemma CA3_6_7I2R8Raw_sound (a : PairSlot) : + (CA3_6_7I2R8Raw a).Encloses (CA3_6_7I2R8Value a) := by + exact residualBall_sound_on (below (shape 3 6 7)) A3_6_7Law (fun u => (stageALaw (shape 3 6 7) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A3_6_7Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 3 6 7) (show (shape 3 6 7) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 8 a +def CA3_6_7I2R8Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA3_6_7I2R8Certificates_valid : + CA3_6_7I2R8Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA3_6_7I2R8CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA3_6_7I2R8P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_6_7I2R8Certificates (CA3_6_7I2R8CertificateIndex a)).input +lemma CA3_6_7I2R8P_check : ∀ a : PairSlot, contains (CA3_6_7I2R8Raw a) (CA3_6_7I2R8P a) = true := by + decide +kernel +lemma CA3_6_7I2R8P_sound (a : PairSlot) : + (CA3_6_7I2R8P a).Encloses (CA3_6_7I2R8Value a) := + contains_sound (CA3_6_7I2R8Raw_sound a) (CA3_6_7I2R8P_check a) +def CA3_6_7I2R8Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_6_7I2R8Certificates (CA3_6_7I2R8CertificateIndex a)).output +lemma CA3_6_7I2R8Terms_sound (a : PairSlot) : + (CA3_6_7I2R8Terms a).Encloses (Foundation.entropyTerm (CA3_6_7I2R8Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA3_6_7I2R8Certificates_valid + (CA3_6_7I2R8CertificateIndex a) (CA3_6_7I2R8P_sound a) +def CA3_6_7I2R8Entropy : Ball := ⟨0, 0⟩ +lemma CA3_6_7I2R8Entropy_sound : CA3_6_7I2R8Entropy.Encloses (Foundation.finiteEntropy CA3_6_7I2R8Value) := by + exact contains_sound (entropyPair_enclosed CA3_6_7I2R8Value CA3_6_7I2R8Terms CA3_6_7I2R8Terms_sound) (by decide +kernel) +def CA3_6_7I2R8Mass : Ball := ⟨0, 0⟩ +lemma CA3_6_7I2R8Mass_sound : CA3_6_7I2R8Mass.Encloses (∑ a, CA3_6_7I2R8Value a) := by + exact contains_sound (pairSumBall_sound CA3_6_7I2R8P CA3_6_7I2R8Value CA3_6_7I2R8P_sound) (by decide +kernel) +def CA3_6_7I2R8MassTerm : Ball := .exact 0 +lemma CA3_6_7I2R8MassTerm_sound : CA3_6_7I2R8MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA3_6_7I2R8Value a))) := + entropyTerm_zero_ball (CA3_6_7I2R8Mass_sound) +def CA3_6_7I2R8H : Ball := ⟨0, 0⟩ +lemma CA3_6_7I2R8H_sound : CA3_6_7I2R8H.Encloses (homogeneousEntropy CA3_6_7I2R8Value) := by + exact contains_sound (homogeneous_enclosed CA3_6_7I2R8Value CA3_6_7I2R8MassTerm_sound CA3_6_7I2R8Entropy_sound) (by decide +kernel) +def CA3_6_7I2R9Value (a : PairSlot) : ℝ := residualLaw (below (shape 3 6 7)) (fun u => (stageALaw (shape 3 6 7) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 9 a +def CA3_6_7I2R9Raw (a : PairSlot) : Ball := residualBall (below (shape 3 6 7)) A3_6_7Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 9 a +lemma CA3_6_7I2R9Raw_sound (a : PairSlot) : + (CA3_6_7I2R9Raw a).Encloses (CA3_6_7I2R9Value a) := by + exact residualBall_sound_on (below (shape 3 6 7)) A3_6_7Law (fun u => (stageALaw (shape 3 6 7) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A3_6_7Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 3 6 7) (show (shape 3 6 7) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 9 a +def CA3_6_7I2R9Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA3_6_7I2R9Certificates_valid : + CA3_6_7I2R9Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA3_6_7I2R9CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA3_6_7I2R9P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_6_7I2R9Certificates (CA3_6_7I2R9CertificateIndex a)).input +lemma CA3_6_7I2R9P_check : ∀ a : PairSlot, contains (CA3_6_7I2R9Raw a) (CA3_6_7I2R9P a) = true := by + decide +kernel +lemma CA3_6_7I2R9P_sound (a : PairSlot) : + (CA3_6_7I2R9P a).Encloses (CA3_6_7I2R9Value a) := + contains_sound (CA3_6_7I2R9Raw_sound a) (CA3_6_7I2R9P_check a) +def CA3_6_7I2R9Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_6_7I2R9Certificates (CA3_6_7I2R9CertificateIndex a)).output +lemma CA3_6_7I2R9Terms_sound (a : PairSlot) : + (CA3_6_7I2R9Terms a).Encloses (Foundation.entropyTerm (CA3_6_7I2R9Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA3_6_7I2R9Certificates_valid + (CA3_6_7I2R9CertificateIndex a) (CA3_6_7I2R9P_sound a) +def CA3_6_7I2R9Entropy : Ball := ⟨0, 0⟩ +lemma CA3_6_7I2R9Entropy_sound : CA3_6_7I2R9Entropy.Encloses (Foundation.finiteEntropy CA3_6_7I2R9Value) := by + exact contains_sound (entropyPair_enclosed CA3_6_7I2R9Value CA3_6_7I2R9Terms CA3_6_7I2R9Terms_sound) (by decide +kernel) +def CA3_6_7I2R9Mass : Ball := ⟨0, 0⟩ +lemma CA3_6_7I2R9Mass_sound : CA3_6_7I2R9Mass.Encloses (∑ a, CA3_6_7I2R9Value a) := by + exact contains_sound (pairSumBall_sound CA3_6_7I2R9P CA3_6_7I2R9Value CA3_6_7I2R9P_sound) (by decide +kernel) +def CA3_6_7I2R9MassTerm : Ball := .exact 0 +lemma CA3_6_7I2R9MassTerm_sound : CA3_6_7I2R9MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA3_6_7I2R9Value a))) := + entropyTerm_zero_ball (CA3_6_7I2R9Mass_sound) +def CA3_6_7I2R9H : Ball := ⟨0, 0⟩ +lemma CA3_6_7I2R9H_sound : CA3_6_7I2R9H.Encloses (homogeneousEntropy CA3_6_7I2R9Value) := by + exact contains_sound (homogeneous_enclosed CA3_6_7I2R9Value CA3_6_7I2R9MassTerm_sound CA3_6_7I2R9Entropy_sound) (by decide +kernel) +def CA3_6_7I2R10Value (a : PairSlot) : ℝ := residualLaw (below (shape 3 6 7)) (fun u => (stageALaw (shape 3 6 7) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 10 a +def CA3_6_7I2R10Raw (a : PairSlot) : Ball := residualBall (below (shape 3 6 7)) A3_6_7Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 10 a +lemma CA3_6_7I2R10Raw_sound (a : PairSlot) : + (CA3_6_7I2R10Raw a).Encloses (CA3_6_7I2R10Value a) := by + exact residualBall_sound_on (below (shape 3 6 7)) A3_6_7Law (fun u => (stageALaw (shape 3 6 7) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A3_6_7Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 3 6 7) (show (shape 3 6 7) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 10 a +def CA3_6_7I2R10Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA3_6_7I2R10Certificates_valid : + CA3_6_7I2R10Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA3_6_7I2R10CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA3_6_7I2R10P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_6_7I2R10Certificates (CA3_6_7I2R10CertificateIndex a)).input +lemma CA3_6_7I2R10P_check : ∀ a : PairSlot, contains (CA3_6_7I2R10Raw a) (CA3_6_7I2R10P a) = true := by + decide +kernel +lemma CA3_6_7I2R10P_sound (a : PairSlot) : + (CA3_6_7I2R10P a).Encloses (CA3_6_7I2R10Value a) := + contains_sound (CA3_6_7I2R10Raw_sound a) (CA3_6_7I2R10P_check a) +def CA3_6_7I2R10Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_6_7I2R10Certificates (CA3_6_7I2R10CertificateIndex a)).output +lemma CA3_6_7I2R10Terms_sound (a : PairSlot) : + (CA3_6_7I2R10Terms a).Encloses (Foundation.entropyTerm (CA3_6_7I2R10Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA3_6_7I2R10Certificates_valid + (CA3_6_7I2R10CertificateIndex a) (CA3_6_7I2R10P_sound a) +def CA3_6_7I2R10Entropy : Ball := ⟨0, 0⟩ +lemma CA3_6_7I2R10Entropy_sound : CA3_6_7I2R10Entropy.Encloses (Foundation.finiteEntropy CA3_6_7I2R10Value) := by + exact contains_sound (entropyPair_enclosed CA3_6_7I2R10Value CA3_6_7I2R10Terms CA3_6_7I2R10Terms_sound) (by decide +kernel) +def CA3_6_7I2R10Mass : Ball := ⟨0, 0⟩ +lemma CA3_6_7I2R10Mass_sound : CA3_6_7I2R10Mass.Encloses (∑ a, CA3_6_7I2R10Value a) := by + exact contains_sound (pairSumBall_sound CA3_6_7I2R10P CA3_6_7I2R10Value CA3_6_7I2R10P_sound) (by decide +kernel) +def CA3_6_7I2R10MassTerm : Ball := .exact 0 +lemma CA3_6_7I2R10MassTerm_sound : CA3_6_7I2R10MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA3_6_7I2R10Value a))) := + entropyTerm_zero_ball (CA3_6_7I2R10Mass_sound) +def CA3_6_7I2R10H : Ball := ⟨0, 0⟩ +lemma CA3_6_7I2R10H_sound : CA3_6_7I2R10H.Encloses (homogeneousEntropy CA3_6_7I2R10Value) := by + exact contains_sound (homogeneous_enclosed CA3_6_7I2R10Value CA3_6_7I2R10MassTerm_sound CA3_6_7I2R10Entropy_sound) (by decide +kernel) +def CA3_6_7I2R11Value (a : PairSlot) : ℝ := residualLaw (below (shape 3 6 7)) (fun u => (stageALaw (shape 3 6 7) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 11 a +def CA3_6_7I2R11Raw (a : PairSlot) : Ball := residualBall (below (shape 3 6 7)) A3_6_7Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 11 a +lemma CA3_6_7I2R11Raw_sound (a : PairSlot) : + (CA3_6_7I2R11Raw a).Encloses (CA3_6_7I2R11Value a) := by + exact residualBall_sound_on (below (shape 3 6 7)) A3_6_7Law (fun u => (stageALaw (shape 3 6 7) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A3_6_7Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 3 6 7) (show (shape 3 6 7) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 11 a +def CA3_6_7I2R11Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA3_6_7I2R11Certificates_valid : + CA3_6_7I2R11Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA3_6_7I2R11CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA3_6_7I2R11P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_6_7I2R11Certificates (CA3_6_7I2R11CertificateIndex a)).input +lemma CA3_6_7I2R11P_check : ∀ a : PairSlot, contains (CA3_6_7I2R11Raw a) (CA3_6_7I2R11P a) = true := by + decide +kernel +lemma CA3_6_7I2R11P_sound (a : PairSlot) : + (CA3_6_7I2R11P a).Encloses (CA3_6_7I2R11Value a) := + contains_sound (CA3_6_7I2R11Raw_sound a) (CA3_6_7I2R11P_check a) +def CA3_6_7I2R11Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_6_7I2R11Certificates (CA3_6_7I2R11CertificateIndex a)).output +lemma CA3_6_7I2R11Terms_sound (a : PairSlot) : + (CA3_6_7I2R11Terms a).Encloses (Foundation.entropyTerm (CA3_6_7I2R11Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA3_6_7I2R11Certificates_valid + (CA3_6_7I2R11CertificateIndex a) (CA3_6_7I2R11P_sound a) +def CA3_6_7I2R11Entropy : Ball := ⟨0, 0⟩ +lemma CA3_6_7I2R11Entropy_sound : CA3_6_7I2R11Entropy.Encloses (Foundation.finiteEntropy CA3_6_7I2R11Value) := by + exact contains_sound (entropyPair_enclosed CA3_6_7I2R11Value CA3_6_7I2R11Terms CA3_6_7I2R11Terms_sound) (by decide +kernel) +def CA3_6_7I2R11Mass : Ball := ⟨0, 0⟩ +lemma CA3_6_7I2R11Mass_sound : CA3_6_7I2R11Mass.Encloses (∑ a, CA3_6_7I2R11Value a) := by + exact contains_sound (pairSumBall_sound CA3_6_7I2R11P CA3_6_7I2R11Value CA3_6_7I2R11P_sound) (by decide +kernel) +def CA3_6_7I2R11MassTerm : Ball := .exact 0 +lemma CA3_6_7I2R11MassTerm_sound : CA3_6_7I2R11MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA3_6_7I2R11Value a))) := + entropyTerm_zero_ball (CA3_6_7I2R11Mass_sound) +def CA3_6_7I2R11H : Ball := ⟨0, 0⟩ +lemma CA3_6_7I2R11H_sound : CA3_6_7I2R11H.Encloses (homogeneousEntropy CA3_6_7I2R11Value) := by + exact contains_sound (homogeneous_enclosed CA3_6_7I2R11Value CA3_6_7I2R11MassTerm_sound CA3_6_7I2R11Entropy_sound) (by decide +kernel) +def CA3_6_7I2R12Value (a : PairSlot) : ℝ := residualLaw (below (shape 3 6 7)) (fun u => (stageALaw (shape 3 6 7) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 12 a +def CA3_6_7I2R12Raw (a : PairSlot) : Ball := residualBall (below (shape 3 6 7)) A3_6_7Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 12 a +lemma CA3_6_7I2R12Raw_sound (a : PairSlot) : + (CA3_6_7I2R12Raw a).Encloses (CA3_6_7I2R12Value a) := by + exact residualBall_sound_on (below (shape 3 6 7)) A3_6_7Law (fun u => (stageALaw (shape 3 6 7) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A3_6_7Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 3 6 7) (show (shape 3 6 7) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 12 a +def CA3_6_7I2R12Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA3_6_7I2R12Certificates_valid : + CA3_6_7I2R12Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA3_6_7I2R12CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA3_6_7I2R12P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_6_7I2R12Certificates (CA3_6_7I2R12CertificateIndex a)).input +lemma CA3_6_7I2R12P_check : ∀ a : PairSlot, contains (CA3_6_7I2R12Raw a) (CA3_6_7I2R12P a) = true := by + decide +kernel +lemma CA3_6_7I2R12P_sound (a : PairSlot) : + (CA3_6_7I2R12P a).Encloses (CA3_6_7I2R12Value a) := + contains_sound (CA3_6_7I2R12Raw_sound a) (CA3_6_7I2R12P_check a) +def CA3_6_7I2R12Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_6_7I2R12Certificates (CA3_6_7I2R12CertificateIndex a)).output +lemma CA3_6_7I2R12Terms_sound (a : PairSlot) : + (CA3_6_7I2R12Terms a).Encloses (Foundation.entropyTerm (CA3_6_7I2R12Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA3_6_7I2R12Certificates_valid + (CA3_6_7I2R12CertificateIndex a) (CA3_6_7I2R12P_sound a) +def CA3_6_7I2R12Entropy : Ball := ⟨0, 0⟩ +lemma CA3_6_7I2R12Entropy_sound : CA3_6_7I2R12Entropy.Encloses (Foundation.finiteEntropy CA3_6_7I2R12Value) := by + exact contains_sound (entropyPair_enclosed CA3_6_7I2R12Value CA3_6_7I2R12Terms CA3_6_7I2R12Terms_sound) (by decide +kernel) +def CA3_6_7I2R12Mass : Ball := ⟨0, 0⟩ +lemma CA3_6_7I2R12Mass_sound : CA3_6_7I2R12Mass.Encloses (∑ a, CA3_6_7I2R12Value a) := by + exact contains_sound (pairSumBall_sound CA3_6_7I2R12P CA3_6_7I2R12Value CA3_6_7I2R12P_sound) (by decide +kernel) +def CA3_6_7I2R12MassTerm : Ball := .exact 0 +lemma CA3_6_7I2R12MassTerm_sound : CA3_6_7I2R12MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA3_6_7I2R12Value a))) := + entropyTerm_zero_ball (CA3_6_7I2R12Mass_sound) +def CA3_6_7I2R12H : Ball := ⟨0, 0⟩ +lemma CA3_6_7I2R12H_sound : CA3_6_7I2R12H.Encloses (homogeneousEntropy CA3_6_7I2R12Value) := by + exact contains_sound (homogeneous_enclosed CA3_6_7I2R12Value CA3_6_7I2R12MassTerm_sound CA3_6_7I2R12Entropy_sound) (by decide +kernel) +def CA3_6_7I2R13Value (a : PairSlot) : ℝ := residualLaw (below (shape 3 6 7)) (fun u => (stageALaw (shape 3 6 7) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 13 a +def CA3_6_7I2R13Raw (a : PairSlot) : Ball := residualBall (below (shape 3 6 7)) A3_6_7Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 13 a +lemma CA3_6_7I2R13Raw_sound (a : PairSlot) : + (CA3_6_7I2R13Raw a).Encloses (CA3_6_7I2R13Value a) := by + exact residualBall_sound_on (below (shape 3 6 7)) A3_6_7Law (fun u => (stageALaw (shape 3 6 7) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A3_6_7Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 3 6 7) (show (shape 3 6 7) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 13 a +def CA3_6_7I2R13Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA3_6_7I2R13Certificates_valid : + CA3_6_7I2R13Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA3_6_7I2R13CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA3_6_7I2R13P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_6_7I2R13Certificates (CA3_6_7I2R13CertificateIndex a)).input +lemma CA3_6_7I2R13P_check : ∀ a : PairSlot, contains (CA3_6_7I2R13Raw a) (CA3_6_7I2R13P a) = true := by + decide +kernel +lemma CA3_6_7I2R13P_sound (a : PairSlot) : + (CA3_6_7I2R13P a).Encloses (CA3_6_7I2R13Value a) := + contains_sound (CA3_6_7I2R13Raw_sound a) (CA3_6_7I2R13P_check a) +def CA3_6_7I2R13Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_6_7I2R13Certificates (CA3_6_7I2R13CertificateIndex a)).output +lemma CA3_6_7I2R13Terms_sound (a : PairSlot) : + (CA3_6_7I2R13Terms a).Encloses (Foundation.entropyTerm (CA3_6_7I2R13Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA3_6_7I2R13Certificates_valid + (CA3_6_7I2R13CertificateIndex a) (CA3_6_7I2R13P_sound a) +def CA3_6_7I2R13Entropy : Ball := ⟨0, 0⟩ +lemma CA3_6_7I2R13Entropy_sound : CA3_6_7I2R13Entropy.Encloses (Foundation.finiteEntropy CA3_6_7I2R13Value) := by + exact contains_sound (entropyPair_enclosed CA3_6_7I2R13Value CA3_6_7I2R13Terms CA3_6_7I2R13Terms_sound) (by decide +kernel) +def CA3_6_7I2R13Mass : Ball := ⟨0, 0⟩ +lemma CA3_6_7I2R13Mass_sound : CA3_6_7I2R13Mass.Encloses (∑ a, CA3_6_7I2R13Value a) := by + exact contains_sound (pairSumBall_sound CA3_6_7I2R13P CA3_6_7I2R13Value CA3_6_7I2R13P_sound) (by decide +kernel) +def CA3_6_7I2R13MassTerm : Ball := .exact 0 +lemma CA3_6_7I2R13MassTerm_sound : CA3_6_7I2R13MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA3_6_7I2R13Value a))) := + entropyTerm_zero_ball (CA3_6_7I2R13Mass_sound) +def CA3_6_7I2R13H : Ball := ⟨0, 0⟩ +lemma CA3_6_7I2R13H_sound : CA3_6_7I2R13H.Encloses (homogeneousEntropy CA3_6_7I2R13Value) := by + exact contains_sound (homogeneous_enclosed CA3_6_7I2R13Value CA3_6_7I2R13MassTerm_sound CA3_6_7I2R13Entropy_sound) (by decide +kernel) +def CA3_6_7I2R14Value (a : PairSlot) : ℝ := residualLaw (below (shape 3 6 7)) (fun u => (stageALaw (shape 3 6 7) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 14 a +def CA3_6_7I2R14Raw (a : PairSlot) : Ball := residualBall (below (shape 3 6 7)) A3_6_7Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 14 a +lemma CA3_6_7I2R14Raw_sound (a : PairSlot) : + (CA3_6_7I2R14Raw a).Encloses (CA3_6_7I2R14Value a) := by + exact residualBall_sound_on (below (shape 3 6 7)) A3_6_7Law (fun u => (stageALaw (shape 3 6 7) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A3_6_7Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 3 6 7) (show (shape 3 6 7) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 14 a +def CA3_6_7I2R14Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA3_6_7I2R14Certificates_valid : + CA3_6_7I2R14Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA3_6_7I2R14CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA3_6_7I2R14P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_6_7I2R14Certificates (CA3_6_7I2R14CertificateIndex a)).input +lemma CA3_6_7I2R14P_check : ∀ a : PairSlot, contains (CA3_6_7I2R14Raw a) (CA3_6_7I2R14P a) = true := by + decide +kernel +lemma CA3_6_7I2R14P_sound (a : PairSlot) : + (CA3_6_7I2R14P a).Encloses (CA3_6_7I2R14Value a) := + contains_sound (CA3_6_7I2R14Raw_sound a) (CA3_6_7I2R14P_check a) +def CA3_6_7I2R14Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_6_7I2R14Certificates (CA3_6_7I2R14CertificateIndex a)).output +lemma CA3_6_7I2R14Terms_sound (a : PairSlot) : + (CA3_6_7I2R14Terms a).Encloses (Foundation.entropyTerm (CA3_6_7I2R14Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA3_6_7I2R14Certificates_valid + (CA3_6_7I2R14CertificateIndex a) (CA3_6_7I2R14P_sound a) +def CA3_6_7I2R14Entropy : Ball := ⟨0, 0⟩ +lemma CA3_6_7I2R14Entropy_sound : CA3_6_7I2R14Entropy.Encloses (Foundation.finiteEntropy CA3_6_7I2R14Value) := by + exact contains_sound (entropyPair_enclosed CA3_6_7I2R14Value CA3_6_7I2R14Terms CA3_6_7I2R14Terms_sound) (by decide +kernel) +def CA3_6_7I2R14Mass : Ball := ⟨0, 0⟩ +lemma CA3_6_7I2R14Mass_sound : CA3_6_7I2R14Mass.Encloses (∑ a, CA3_6_7I2R14Value a) := by + exact contains_sound (pairSumBall_sound CA3_6_7I2R14P CA3_6_7I2R14Value CA3_6_7I2R14P_sound) (by decide +kernel) +def CA3_6_7I2R14MassTerm : Ball := .exact 0 +lemma CA3_6_7I2R14MassTerm_sound : CA3_6_7I2R14MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA3_6_7I2R14Value a))) := + entropyTerm_zero_ball (CA3_6_7I2R14Mass_sound) +def CA3_6_7I2R14H : Ball := ⟨0, 0⟩ +lemma CA3_6_7I2R14H_sound : CA3_6_7I2R14H.Encloses (homogeneousEntropy CA3_6_7I2R14Value) := by + exact contains_sound (homogeneous_enclosed CA3_6_7I2R14Value CA3_6_7I2R14MassTerm_sound CA3_6_7I2R14Entropy_sound) (by decide +kernel) +def CA3_6_7I2R15Value (a : PairSlot) : ℝ := residualLaw (below (shape 3 6 7)) (fun u => (stageALaw (shape 3 6 7) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 15 a +def CA3_6_7I2R15Raw (a : PairSlot) : Ball := residualBall (below (shape 3 6 7)) A3_6_7Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 15 a +lemma CA3_6_7I2R15Raw_sound (a : PairSlot) : + (CA3_6_7I2R15Raw a).Encloses (CA3_6_7I2R15Value a) := by + exact residualBall_sound_on (below (shape 3 6 7)) A3_6_7Law (fun u => (stageALaw (shape 3 6 7) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A3_6_7Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 3 6 7) (show (shape 3 6 7) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 15 a +def CA3_6_7I2R15Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA3_6_7I2R15Certificates_valid : + CA3_6_7I2R15Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA3_6_7I2R15CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA3_6_7I2R15P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_6_7I2R15Certificates (CA3_6_7I2R15CertificateIndex a)).input +lemma CA3_6_7I2R15P_check : ∀ a : PairSlot, contains (CA3_6_7I2R15Raw a) (CA3_6_7I2R15P a) = true := by + decide +kernel +lemma CA3_6_7I2R15P_sound (a : PairSlot) : + (CA3_6_7I2R15P a).Encloses (CA3_6_7I2R15Value a) := + contains_sound (CA3_6_7I2R15Raw_sound a) (CA3_6_7I2R15P_check a) +def CA3_6_7I2R15Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_6_7I2R15Certificates (CA3_6_7I2R15CertificateIndex a)).output +lemma CA3_6_7I2R15Terms_sound (a : PairSlot) : + (CA3_6_7I2R15Terms a).Encloses (Foundation.entropyTerm (CA3_6_7I2R15Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA3_6_7I2R15Certificates_valid + (CA3_6_7I2R15CertificateIndex a) (CA3_6_7I2R15P_sound a) +def CA3_6_7I2R15Entropy : Ball := ⟨0, 0⟩ +lemma CA3_6_7I2R15Entropy_sound : CA3_6_7I2R15Entropy.Encloses (Foundation.finiteEntropy CA3_6_7I2R15Value) := by + exact contains_sound (entropyPair_enclosed CA3_6_7I2R15Value CA3_6_7I2R15Terms CA3_6_7I2R15Terms_sound) (by decide +kernel) +def CA3_6_7I2R15Mass : Ball := ⟨0, 0⟩ +lemma CA3_6_7I2R15Mass_sound : CA3_6_7I2R15Mass.Encloses (∑ a, CA3_6_7I2R15Value a) := by + exact contains_sound (pairSumBall_sound CA3_6_7I2R15P CA3_6_7I2R15Value CA3_6_7I2R15P_sound) (by decide +kernel) +def CA3_6_7I2R15MassTerm : Ball := .exact 0 +lemma CA3_6_7I2R15MassTerm_sound : CA3_6_7I2R15MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA3_6_7I2R15Value a))) := + entropyTerm_zero_ball (CA3_6_7I2R15Mass_sound) +def CA3_6_7I2R15H : Ball := ⟨0, 0⟩ +lemma CA3_6_7I2R15H_sound : CA3_6_7I2R15H.Encloses (homogeneousEntropy CA3_6_7I2R15Value) := by + exact contains_sound (homogeneous_enclosed CA3_6_7I2R15Value CA3_6_7I2R15MassTerm_sound CA3_6_7I2R15Entropy_sound) (by decide +kernel) +def CA3_6_7I2R16Value (a : PairSlot) : ℝ := residualLaw (below (shape 3 6 7)) (fun u => (stageALaw (shape 3 6 7) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 16 a +def CA3_6_7I2R16Raw (a : PairSlot) : Ball := residualBall (below (shape 3 6 7)) A3_6_7Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 16 a +lemma CA3_6_7I2R16Raw_sound (a : PairSlot) : + (CA3_6_7I2R16Raw a).Encloses (CA3_6_7I2R16Value a) := by + exact residualBall_sound_on (below (shape 3 6 7)) A3_6_7Law (fun u => (stageALaw (shape 3 6 7) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A3_6_7Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 3 6 7) (show (shape 3 6 7) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 16 a +def CA3_6_7I2R16Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA3_6_7I2R16Certificates_valid : + CA3_6_7I2R16Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA3_6_7I2R16CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA3_6_7I2R16P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_6_7I2R16Certificates (CA3_6_7I2R16CertificateIndex a)).input +lemma CA3_6_7I2R16P_check : ∀ a : PairSlot, contains (CA3_6_7I2R16Raw a) (CA3_6_7I2R16P a) = true := by + decide +kernel +lemma CA3_6_7I2R16P_sound (a : PairSlot) : + (CA3_6_7I2R16P a).Encloses (CA3_6_7I2R16Value a) := + contains_sound (CA3_6_7I2R16Raw_sound a) (CA3_6_7I2R16P_check a) +def CA3_6_7I2R16Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_6_7I2R16Certificates (CA3_6_7I2R16CertificateIndex a)).output +lemma CA3_6_7I2R16Terms_sound (a : PairSlot) : + (CA3_6_7I2R16Terms a).Encloses (Foundation.entropyTerm (CA3_6_7I2R16Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA3_6_7I2R16Certificates_valid + (CA3_6_7I2R16CertificateIndex a) (CA3_6_7I2R16P_sound a) +def CA3_6_7I2R16Entropy : Ball := ⟨0, 0⟩ +lemma CA3_6_7I2R16Entropy_sound : CA3_6_7I2R16Entropy.Encloses (Foundation.finiteEntropy CA3_6_7I2R16Value) := by + exact contains_sound (entropyPair_enclosed CA3_6_7I2R16Value CA3_6_7I2R16Terms CA3_6_7I2R16Terms_sound) (by decide +kernel) +def CA3_6_7I2R16Mass : Ball := ⟨0, 0⟩ +lemma CA3_6_7I2R16Mass_sound : CA3_6_7I2R16Mass.Encloses (∑ a, CA3_6_7I2R16Value a) := by + exact contains_sound (pairSumBall_sound CA3_6_7I2R16P CA3_6_7I2R16Value CA3_6_7I2R16P_sound) (by decide +kernel) +def CA3_6_7I2R16MassTerm : Ball := .exact 0 +lemma CA3_6_7I2R16MassTerm_sound : CA3_6_7I2R16MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA3_6_7I2R16Value a))) := + entropyTerm_zero_ball (CA3_6_7I2R16Mass_sound) +def CA3_6_7I2R16H : Ball := ⟨0, 0⟩ +lemma CA3_6_7I2R16H_sound : CA3_6_7I2R16H.Encloses (homogeneousEntropy CA3_6_7I2R16Value) := by + exact contains_sound (homogeneous_enclosed CA3_6_7I2R16Value CA3_6_7I2R16MassTerm_sound CA3_6_7I2R16Entropy_sound) (by decide +kernel) +def CA3_6_7I2ResidualEntropies (a : Fin 17) : Ball := + match a.val with + | 0 => CA3_6_7I2R0H + | 1 => CA3_6_7I2R1H + | 2 => CA3_6_7I2R2H + | 3 => CA3_6_7I2R3H + | 4 => CA3_6_7I2R4H + | 5 => CA3_6_7I2R5H + | 6 => CA3_6_7I2R6H + | 7 => CA3_6_7I2R7H + | 8 => CA3_6_7I2R8H + | 9 => CA3_6_7I2R9H + | 10 => CA3_6_7I2R10H + | 11 => CA3_6_7I2R11H + | 12 => CA3_6_7I2R12H + | 13 => CA3_6_7I2R13H + | 14 => CA3_6_7I2R14H + | 15 => CA3_6_7I2R15H + | 16 => CA3_6_7I2R16H + | _ => (.exact 0) +lemma CA3_6_7I2ResidualEntropies_sound (k : Fin 17) : + (CA3_6_7I2ResidualEntropies k).Encloses (homogeneousEntropy + (residualLaw (below (shape 3 6 7)) (fun u => (stageALaw (shape 3 6 7) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) k)) := by + fin_cases k + · exact CA3_6_7I2R0H_sound + · exact CA3_6_7I2R1H_sound + · exact CA3_6_7I2R2H_sound + · exact CA3_6_7I2R3H_sound + · exact CA3_6_7I2R4H_sound + · exact CA3_6_7I2R5H_sound + · exact CA3_6_7I2R6H_sound + · exact CA3_6_7I2R7H_sound + · exact CA3_6_7I2R8H_sound + · exact CA3_6_7I2R9H_sound + · exact CA3_6_7I2R10H_sound + · exact CA3_6_7I2R11H_sound + · exact CA3_6_7I2R12H_sound + · exact CA3_6_7I2R13H_sound + · exact CA3_6_7I2R14H_sound + · exact CA3_6_7I2R15H_sound + · exact CA3_6_7I2R16H_sound +def CA3_6_7I2Singles (s : Shape) : Ball := + match s 0, s 1, s 2 with + | 0, 1, 7 => Z0_1_7H2H + | 0, 2, 6 => Z0_2_6H2H + | 0, 3, 5 => Z0_3_5H2H + | 0, 4, 4 => Z0_4_4H2H + | 0, 5, 3 => Z0_5_3H2H + | 0, 6, 2 => Z0_6_2H2H + | 1, 0, 7 => Z1_0_7H2H + | 2, 0, 6 => Z2_0_6H2H + | 3, 0, 5 => Z3_0_5H2H + | _, _, _ => (.exact 0) +lemma CA3_6_7I2Singles_sound (u : Shape) (hu : u ∈ below (shape 3 6 7)) + (hd : designated (Equiv.refl (Fin 3)) 2 u) : + (CA3_6_7I2Singles u).Encloses (homogeneousEntropy ((fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) u)) := by + rw [A3_6_7_below] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl + · exact Z0_1_7H2H_sound + · exact Z0_2_6H2H_sound + · exact Z0_3_5H2H_sound + · exact Z0_4_4H2H_sound + · exact Z0_5_3H2H_sound + · exact Z0_6_2H2H_sound + · exact Z1_0_7H2H_sound + · exact (show ¬ designated (Equiv.refl (Fin 3)) 2 (shape 1 1 6) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 2 (shape 1 2 5) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 2 (shape 1 3 4) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 2 (shape 1 4 3) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 2 (shape 1 5 2) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 2 (shape 1 6 1) by decide +kernel) hd |>.elim + · exact Z2_0_6H2H_sound + · exact (show ¬ designated (Equiv.refl (Fin 3)) 2 (shape 2 1 5) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 2 (shape 2 2 4) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 2 (shape 2 3 3) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 2 (shape 2 4 2) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 2 (shape 2 5 1) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 2 (shape 2 6 0) by decide +kernel) hd |>.elim + · exact Z3_0_5H2H_sound + · exact (show ¬ designated (Equiv.refl (Fin 3)) 2 (shape 3 1 4) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 2 (shape 3 2 3) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 2 (shape 3 3 2) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 2 (shape 3 4 1) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 2 (shape 3 5 0) by decide +kernel) hd |>.elim +def CA3_6_7I2Singleton : Ball := ⟨(2956785446459103303223532671727 / 25000000000000000000000000000000), (992338599 / 10000000000000000000000000000000)⟩ +lemma CA3_6_7I2Singleton_sound : CA3_6_7I2Singleton.Encloses + (singletonEntropy (below (shape 3 6 7)) (fun u => (stageALaw (shape 3 6 7) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ))) := by + exact contains_sound (singletonBall_sound (below (shape 3 6 7)) A3_6_7Law (fun u => (stageALaw (shape 3 6 7) u : ℝ)) (Equiv.refl (Fin 3)) 2 + CA3_6_7I2Singles (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A3_6_7Law_sound u) CA3_6_7I2Singles_sound) (by decide +kernel) +def CA3_6_7I2Group : Ball := ⟨(96556640056048354052402923374077 / 100000000000000000000000000000000), (39608863527 / 25000000000000000000000000000000)⟩ +lemma CA3_6_7I2Group_sound : CA3_6_7I2Group.Encloses + (groupedEntropy (below (shape 3 6 7)) (fun u => (stageALaw (shape 3 6 7) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ))) := by + exact contains_sound (Ball.add_sound CA3_6_7I2Singleton_sound + (finSumBall_sound 17 CA3_6_7I2ResidualEntropies _ CA3_6_7I2ResidualEntropies_sound)) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CA3_6_7I2H : Ball := ⟨(53605050537661449114373976696383 / 50000000000000000000000000000000), (455932049331 / 100000000000000000000000000000000)⟩ +lemma CA3_6_7I2_sound : CA3_6_7I2H.Encloses (stageACapacity (shape 3 6 7) 2) := by + have hb := contains_sound (Ball.add_sound CA3_6_7I2PairH_sound + (Ball.neg_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) CA3_6_7I2Group_sound))) + (show contains (.add CA3_6_7I2PairH (.neg (.mul (.exact 2) CA3_6_7I2Group))) CA3_6_7I2H = true by decide +kernel) + unfold CA3_6_7I2PairValue at hb + simpa only [stageACapacity, nativeCapacity, + show (2 : Fin 3) ≠ 0 by decide, ite_false, sub_eq_add_neg] using hb + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA3_6_7I2Pair.lean b/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA3_6_7I2Pair.lean new file mode 100644 index 0000000000000000000000000000000000000000..e76a23279458104aca6699fe121aa6a3a549f659 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA3_6_7I2Pair.lean @@ -0,0 +1,355 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Certificates.SupportedContraction + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CA3_6_7I2PairValue (a : PairSlot × PairSlot) : ℝ := pairLaw (below (shape 3 6 7)) (shape 3 6 7) (fun u => (stageALaw (shape 3 6 7) u : ℝ)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) a +def CA3_6_7I2PairRaw (a : PairSlot × PairSlot) : Ball := stageAPairBall (shape 3 6 7) A3_6_7Law 2 a +lemma CA3_6_7I2PairRaw_sound (a : PairSlot × PairSlot) : + (CA3_6_7I2PairRaw a).Encloses (CA3_6_7I2PairValue a) := by + exact stageAPairBall_sound (shape 3 6 7) (by decide +kernel) A3_6_7Law (fun u => (stageALaw (shape 3 6 7) u : ℝ)) (fun u _ => A3_6_7Law_sound u) 2 a +def CA3_6_7I2PairCertificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(127519291722285220775287617 / 50000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ ⟨(1642354865804317929292664323 / 50000000000000000000000000000000), (1080159 / 100000000000000000000000000000000)⟩ ⟨(-321981647565350428704835137744821 / 25000000000000000000000000000000), (211758628927 / 50000000000000000000000000000000)⟩ ⟨-19, 127519291722285220775287617, 95367431640625000000000000⟩, + .log ⟨(961971266590662901331837669 / 10000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(11121723862531995173155077543 / 12500000000000000000000000000000), (7638953 / 25000000000000000000000000000000)⟩ ⟨(-462455553457377871392727790139359 / 50000000000000000000000000000000), (7940934141 / 2500000000000000000000000000000)⟩ ⟨-14, 961971266590662901331837669, 610351562500000000000000000⟩, + .log ⟨(384038731027996185843794897 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(2261371773131636867122367291 / 25000000000000000000000000000000), (1463827 / 50000000000000000000000000000000)⟩ ⟨(-147209876922985683456185312188239 / 12500000000000000000000000000000), (47645619561 / 12500000000000000000000000000000)⟩ ⟨-17, 384038731027996185843794897, 381469726562500000000000000⟩, + .log ⟨(344795703646121460063925977 / 800000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ ⟨(41749452704219867962461562453 / 12500000000000000000000000000000), (2966167 / 2500000000000000000000000000000)⟩ ⟨(-387470746418061982263681445806891 / 50000000000000000000000000000000), (275285712519 / 100000000000000000000000000000000)⟩ ⟨-12, 344795703646121460063925977, 195312500000000000000000000⟩, + .log ⟨(11377827067644414113912586947 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(12915624303888216967390781333 / 12500000000000000000000000000000), (451753 / 1250000000000000000000000000000)⟩ ⟨(-113515737469915489388081828782393 / 12500000000000000000000000000000), (158818682017 / 50000000000000000000000000000000)⟩ ⟨-14, 11377827067644414113912586947, 6103515625000000000000000000⟩, + .log ⟨(292751456779651505332652579 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(440891363439785054319580127 / 6250000000000000000000000000000), (235573 / 10000000000000000000000000000000)⟩ ⟨(-1204820958473687555375725602140673 / 100000000000000000000000000000000), (40234082077 / 10000000000000000000000000000000)⟩ ⟨-18, 292751456779651505332652579, 190734863281250000000000000⟩, + .log ⟨(40824789598580463926588478801 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(318581796981965794904683612147 / 100000000000000000000000000000000), (112384821 / 100000000000000000000000000000000)⟩ ⟨(-156072719597331782786151235323461 / 20000000000000000000000000000000), (34410713791 / 12500000000000000000000000000000)⟩ ⟨-12, 40824789598580463926588478801, 24414062500000000000000000000⟩, + .log ⟨(43959195693810381576518202859 / 10000000000000000000000000000000), (1 / 20000000000000000000000000000000)⟩ ⟨(477140015076766255859682932941 / 20000000000000000000000000000000), (26180781 / 3125000000000000000000000000000)⟩ ⟨(-135676963473182172689335894227381 / 25000000000000000000000000000000), (47645603571 / 25000000000000000000000000000000)⟩ ⟨-8, 43959195693810381576518202859, 39062500000000000000000000000⟩, + .log ⟨(35770391216738420482435661267 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(283866848566623931879007252717 / 100000000000000000000000000000000), (769303 / 781250000000000000000000000000)⟩ ⟨(-793580497475216573379272368915761 / 100000000000000000000000000000000), (137642855337 / 50000000000000000000000000000000)⟩ ⟨-12, 35770391216738420482435661267, 24414062500000000000000000000⟩, + .log ⟨(101483888289111244287398476877 / 6250000000000000000000000000000), (3 / 25000000000000000000000000000000)⟩ ⟨(6690526992740490331391697166177 / 100000000000000000000000000000000), (1203442789 / 50000000000000000000000000000000)⟩ ⟨(-412043669291637768564280768001061 / 100000000000000000000000000000000), (148230766519 / 100000000000000000000000000000000)⟩ ⟨-6, 101483888289111244287398476877, 97656250000000000000000000000⟩, + .log ⟨(13680191085945976795795937277 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(5611497694190205267334584279 / 2500000000000000000000000000000), (1176863 / 1562500000000000000000000000000)⟩ ⟨(-410191470202126467935221242477603 / 50000000000000000000000000000000), (275285711533 / 100000000000000000000000000000000)⟩ ⟨-12, 13680191085945976795795937277, 12207031250000000000000000000⟩, + .log ⟨(1874295315317056395273540219 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(20401128551309935326773126387 / 100000000000000000000000000000000), (6747269 / 100000000000000000000000000000000)⟩ ⟨(-544234635401062022424884604695331 / 50000000000000000000000000000000), (89997263991 / 25000000000000000000000000000000)⟩ ⟨-16, 1874295315317056395273540219, 1525878906250000000000000000⟩, + .log ⟨(49905350494980337063884730493 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(689657016388608604982176381897 / 100000000000000000000000000000000), (232493127 / 100000000000000000000000000000000)⟩ ⟨(-43185312894078914546211832824681 / 6250000000000000000000000000000), (116467030757 / 50000000000000000000000000000000)⟩ ⟨-10, 49905350494980337063884730493, 48828125000000000000000000000⟩, + .log ⟨(258147676319376963631045201 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(3321624598154014115868478727 / 100000000000000000000000000000000), (1093313 / 100000000000000000000000000000000)⟩ ⟨(-643357446697397957352856306351453 / 50000000000000000000000000000000), (84703372207 / 20000000000000000000000000000000)⟩ ⟨-19, 258147676319376963631045201, 190734863281250000000000000⟩, + .log ⟨(1804824899679282440985746661 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(4202094389871438687219909839 / 5000000000000000000000000000000), (14332001 / 50000000000000000000000000000000)⟩ ⟨(-23282559934862109150927121660309 / 2500000000000000000000000000000), (158818683163 / 50000000000000000000000000000000)⟩ ⟨-14, 1804824899679282440985746661, 1220703125000000000000000000⟩, + .log ⟨(471598588544605352264613147 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(5783945680294984457380894037 / 100000000000000000000000000000000), (1897447 / 100000000000000000000000000000000)⟩ ⟨(-1226455256820158987754984822660231 / 100000000000000000000000000000000), (402340862021 / 100000000000000000000000000000000)⟩ ⟨-18, 471598588544605352264613147, 381469726562500000000000000⟩, + .log ⟨(47772586768583824523708440629 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(365291818205488721929236441737 / 100000000000000000000000000000000), (131511113 / 100000000000000000000000000000000)⟩ ⟨(-191161837213780348827778286281711 / 25000000000000000000000000000000), (68821427493 / 25000000000000000000000000000000)⟩ ⟨-12, 47772586768583824523708440629, 24414062500000000000000000000⟩, + .log ⟨(826819030704913161668192288631 / 50000000000000000000000000000000), (9 / 100000000000000000000000000000000)⟩ ⟨(67835415532940061664788140843 / 1000000000000000000000000000000), (2451200409 / 100000000000000000000000000000000)⟩ ⟨(-205109621978301203402004801071621 / 50000000000000000000000000000000), (5929230653 / 4000000000000000000000000000000)⟩ ⟨-6, 826819030704913161668192288631, 781250000000000000000000000000⟩, + .log ⟨(19580729234690236089261650827 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(135673730767716319195025112631 / 20000000000000000000000000000000), (228050947 / 100000000000000000000000000000000)⟩ ⟨(-138578833445436441391766121494693 / 20000000000000000000000000000000), (232934061533 / 100000000000000000000000000000000)⟩ ⟨-10, 19580729234690236089261650827, 19531250000000000000000000000⟩, + .log ⟨(442588073591689198220745486563 / 100000000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ ⟨(1199476965978877475889738843763 / 50000000000000000000000000000000), (843495057 / 100000000000000000000000000000000)⟩ ⟨(-542028598396195435614887070213333 / 100000000000000000000000000000000), (3811648281 / 2000000000000000000000000000000)⟩ ⟨-8, 442588073591689198220745486563, 390625000000000000000000000000⟩, + .log ⟨(7642327468222219430917186297601 / 50000000000000000000000000000000), (11 / 20000000000000000000000000000000)⟩ ⟨(28709485382808015220316352440243 / 100000000000000000000000000000000), (6473303239 / 50000000000000000000000000000000)⟩ ⟨(-93916040310316942241260506488979 / 50000000000000000000000000000000), (84703295091 / 100000000000000000000000000000000)⟩ ⟨-3, 7642327468222219430917186297601, 6250000000000000000000000000000⟩, + .log ⟨(933736871610697479319238564929 / 100000000000000000000000000000000), (1 / 20000000000000000000000000000000)⟩ ⟨(4364034765182847977425840927573 / 100000000000000000000000000000000), (790905909 / 50000000000000000000000000000000)⟩ ⟨(-467373078847671676219626614800823 / 100000000000000000000000000000000), (169406589999 / 100000000000000000000000000000000)⟩ ⟨-7, 933736871610697479319238564929, 781250000000000000000000000000⟩, + .log ⟨(2411643361214355353530619437 / 10000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(803562651410191888389525367 / 400000000000000000000000000000), (35747979 / 50000000000000000000000000000000)⟩ ⟨(-166600639284733861302660643166509 / 20000000000000000000000000000000), (74115383927 / 25000000000000000000000000000000)⟩ ⟨-13, 2411643361214355353530619437, 1220703125000000000000000000⟩, + .log ⟨(835662174779567833493151040057 / 100000000000000000000000000000000), (1 / 20000000000000000000000000000000)⟩ ⟨(3998393668991830395164052341349 / 100000000000000000000000000000000), (70783341 / 5000000000000000000000000000000)⟩ ⟨(-478470103070841085926936994908129 / 100000000000000000000000000000000), (84703295031 / 50000000000000000000000000000000)⟩ ⟨-7, 835662174779567833493151040057, 781250000000000000000000000000⟩, + .log ⟨(23845704915303903447243183119 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(91188052207707603176671322787 / 25000000000000000000000000000000), (32821911 / 25000000000000000000000000000000)⟩ ⟨(-764817417070225872405290375906729 / 100000000000000000000000000000000), (34410713747 / 12500000000000000000000000000000)⟩ ⟨-12, 23845704915303903447243183119, 12207031250000000000000000000⟩, + .log ⟨(581513533256306094157009789 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(13214196434630944688266154541 / 100000000000000000000000000000000), (4433063 / 100000000000000000000000000000000)⟩ ⟨(-568094965934640450367105454202317 / 50000000000000000000000000000000), (95291228069 / 25000000000000000000000000000000)⟩ ⟨-17, 581513533256306094157009789, 381469726562500000000000000⟩, + .log ⟨(20181980212080174508596186921 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(315443872274417054287249674527 / 100000000000000000000000000000000), (1736191 / 1562500000000000000000000000000)⟩ ⟨(-195374703671052688064724014974821 / 25000000000000000000000000000000), (68821427589 / 25000000000000000000000000000000)⟩ ⟨-12, 20181980212080174508596186921, 12207031250000000000000000000⟩, + .log ⟨(2788267931653696829389612583 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(228452918170943167167553297 / 781250000000000000000000000000), (1003747 / 10000000000000000000000000000000)⟩ ⟨(-1048750487494850318690011145871747 / 100000000000000000000000000000000), (14399561539 / 4000000000000000000000000000000)⟩ ⟨-16, 2788267931653696829389612583, 1525878906250000000000000000⟩] +lemma CA3_6_7I2PairCertificates_valid : + CA3_6_7I2PairCertificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA3_6_7I2PairCertificateIndex (a : PairSlot × PairSlot) : ℕ := + match a.1.1.val, a.1.2.val, a.2.1.val, a.2.2.val with + | 4, 5, 0, 0 => 1 + | 5, 4, 0, 0 => 1 + | 2, 5, 1, 0 => 2 + | 2, 5, 0, 1 => 2 + | 3, 5, 1, 0 => 3 + | 3, 5, 0, 1 => 3 + | 4, 4, 1, 0 => 4 + | 4, 4, 0, 1 => 4 + | 5, 2, 1, 0 => 2 + | 5, 2, 0, 1 => 2 + | 5, 3, 1, 0 => 3 + | 5, 3, 0, 1 => 3 + | 1, 5, 2, 0 => 5 + | 1, 5, 3, 0 => 6 + | 1, 5, 1, 1 => 7 + | 1, 5, 0, 2 => 5 + | 1, 5, 0, 3 => 6 + | 2, 4, 2, 0 => 8 + | 2, 4, 3, 0 => 9 + | 2, 4, 1, 1 => 10 + | 2, 4, 0, 2 => 8 + | 2, 4, 0, 3 => 9 + | 3, 4, 2, 0 => 11 + | 3, 4, 3, 0 => 12 + | 3, 4, 1, 1 => 13 + | 3, 4, 0, 2 => 11 + | 3, 4, 0, 3 => 12 + | 4, 2, 2, 0 => 8 + | 4, 2, 3, 0 => 9 + | 4, 2, 1, 1 => 10 + | 4, 2, 0, 2 => 8 + | 4, 2, 0, 3 => 9 + | 4, 3, 2, 0 => 11 + | 4, 3, 3, 0 => 12 + | 4, 3, 1, 1 => 13 + | 4, 3, 0, 2 => 11 + | 4, 3, 0, 3 => 12 + | 5, 1, 2, 0 => 5 + | 5, 1, 3, 0 => 6 + | 5, 1, 1, 1 => 7 + | 5, 1, 0, 2 => 5 + | 5, 1, 0, 3 => 6 + | 5, 0, 4, 0 => 14 + | 5, 0, 2, 1 => 15 + | 5, 0, 3, 1 => 16 + | 5, 0, 1, 2 => 15 + | 5, 0, 1, 3 => 16 + | 5, 0, 0, 4 => 14 + | 4, 1, 4, 0 => 17 + | 4, 1, 2, 1 => 18 + | 4, 1, 3, 1 => 19 + | 4, 1, 1, 2 => 18 + | 4, 1, 1, 3 => 19 + | 4, 1, 0, 4 => 17 + | 2, 2, 4, 0 => 20 + | 2, 2, 2, 1 => 21 + | 2, 2, 3, 1 => 22 + | 2, 2, 1, 2 => 21 + | 2, 2, 1, 3 => 22 + | 2, 2, 0, 4 => 20 + | 2, 3, 4, 0 => 23 + | 2, 3, 2, 1 => 24 + | 2, 3, 3, 1 => 25 + | 2, 3, 1, 2 => 24 + | 2, 3, 1, 3 => 25 + | 2, 3, 0, 4 => 23 + | 3, 2, 4, 0 => 23 + | 3, 2, 2, 1 => 24 + | 3, 2, 3, 1 => 25 + | 3, 2, 1, 2 => 24 + | 3, 2, 1, 3 => 25 + | 3, 2, 0, 4 => 23 + | 3, 3, 4, 0 => 26 + | 3, 3, 2, 1 => 27 + | 3, 3, 3, 1 => 28 + | 3, 3, 1, 2 => 27 + | 3, 3, 1, 3 => 28 + | 3, 3, 0, 4 => 26 + | 1, 4, 4, 0 => 17 + | 1, 4, 2, 1 => 18 + | 1, 4, 3, 1 => 19 + | 1, 4, 1, 2 => 18 + | 1, 4, 1, 3 => 19 + | 1, 4, 0, 4 => 17 + | 0, 5, 4, 0 => 14 + | 0, 5, 2, 1 => 15 + | 0, 5, 3, 1 => 16 + | 0, 5, 1, 2 => 15 + | 0, 5, 1, 3 => 16 + | 0, 5, 0, 4 => 14 + | 4, 0, 5, 0 => 14 + | 4, 0, 4, 1 => 17 + | 4, 0, 2, 2 => 20 + | 4, 0, 2, 3 => 23 + | 4, 0, 3, 2 => 23 + | 4, 0, 3, 3 => 26 + | 4, 0, 1, 4 => 17 + | 4, 0, 0, 5 => 14 + | 2, 1, 5, 0 => 15 + | 2, 1, 4, 1 => 18 + | 2, 1, 2, 2 => 21 + | 2, 1, 2, 3 => 24 + | 2, 1, 3, 2 => 24 + | 2, 1, 3, 3 => 27 + | 2, 1, 1, 4 => 18 + | 2, 1, 0, 5 => 15 + | 3, 1, 5, 0 => 16 + | 3, 1, 4, 1 => 19 + | 3, 1, 2, 2 => 22 + | 3, 1, 2, 3 => 25 + | 3, 1, 3, 2 => 25 + | 3, 1, 3, 3 => 28 + | 3, 1, 1, 4 => 19 + | 3, 1, 0, 5 => 16 + | 1, 2, 5, 0 => 15 + | 1, 2, 4, 1 => 18 + | 1, 2, 2, 2 => 21 + | 1, 2, 2, 3 => 24 + | 1, 2, 3, 2 => 24 + | 1, 2, 3, 3 => 27 + | 1, 2, 1, 4 => 18 + | 1, 2, 0, 5 => 15 + | 1, 3, 5, 0 => 16 + | 1, 3, 4, 1 => 19 + | 1, 3, 2, 2 => 22 + | 1, 3, 2, 3 => 25 + | 1, 3, 3, 2 => 25 + | 1, 3, 3, 3 => 28 + | 1, 3, 1, 4 => 19 + | 1, 3, 0, 5 => 16 + | 0, 4, 5, 0 => 14 + | 0, 4, 4, 1 => 17 + | 0, 4, 2, 2 => 20 + | 0, 4, 2, 3 => 23 + | 0, 4, 3, 2 => 23 + | 0, 4, 3, 3 => 26 + | 0, 4, 1, 4 => 17 + | 0, 4, 0, 5 => 14 + | 2, 0, 1, 5 => 5 + | 2, 0, 2, 4 => 8 + | 2, 0, 3, 4 => 11 + | 2, 0, 4, 2 => 8 + | 2, 0, 4, 3 => 11 + | 2, 0, 5, 1 => 5 + | 3, 0, 1, 5 => 6 + | 3, 0, 2, 4 => 9 + | 3, 0, 3, 4 => 12 + | 3, 0, 4, 2 => 9 + | 3, 0, 4, 3 => 12 + | 3, 0, 5, 1 => 6 + | 1, 1, 1, 5 => 7 + | 1, 1, 2, 4 => 10 + | 1, 1, 3, 4 => 13 + | 1, 1, 4, 2 => 10 + | 1, 1, 4, 3 => 13 + | 1, 1, 5, 1 => 7 + | 0, 2, 1, 5 => 5 + | 0, 2, 2, 4 => 8 + | 0, 2, 3, 4 => 11 + | 0, 2, 4, 2 => 8 + | 0, 2, 4, 3 => 11 + | 0, 2, 5, 1 => 5 + | 0, 3, 1, 5 => 6 + | 0, 3, 2, 4 => 9 + | 0, 3, 3, 4 => 12 + | 0, 3, 4, 2 => 9 + | 0, 3, 4, 3 => 12 + | 0, 3, 5, 1 => 6 + | 1, 0, 2, 5 => 2 + | 1, 0, 3, 5 => 3 + | 1, 0, 4, 4 => 4 + | 1, 0, 5, 2 => 2 + | 1, 0, 5, 3 => 3 + | 0, 1, 2, 5 => 2 + | 0, 1, 3, 5 => 3 + | 0, 1, 4, 4 => 4 + | 0, 1, 5, 2 => 2 + | 0, 1, 5, 3 => 3 + | 0, 0, 4, 5 => 1 + | 0, 0, 5, 4 => 1 + | _, _, _, _ => 0 +def CA3_6_7I2PairP (a : PairSlot × PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_6_7I2PairCertificates (CA3_6_7I2PairCertificateIndex a)).input +lemma CA3_6_7I2PairP_check_0_0 : ∀ k l : Fin 6, contains (CA3_6_7I2PairRaw ((0,0),(k,l))) (CA3_6_7I2PairP ((0,0),(k,l))) = true := by + decide +kernel +lemma CA3_6_7I2PairP_check_0_1 : ∀ k l : Fin 6, contains (CA3_6_7I2PairRaw ((0,1),(k,l))) (CA3_6_7I2PairP ((0,1),(k,l))) = true := by + decide +kernel +lemma CA3_6_7I2PairP_check_0_2 : ∀ k l : Fin 6, contains (CA3_6_7I2PairRaw ((0,2),(k,l))) (CA3_6_7I2PairP ((0,2),(k,l))) = true := by + decide +kernel +lemma CA3_6_7I2PairP_check_0_3 : ∀ k l : Fin 6, contains (CA3_6_7I2PairRaw ((0,3),(k,l))) (CA3_6_7I2PairP ((0,3),(k,l))) = true := by + decide +kernel +lemma CA3_6_7I2PairP_check_0_4 : ∀ k l : Fin 6, contains (CA3_6_7I2PairRaw ((0,4),(k,l))) (CA3_6_7I2PairP ((0,4),(k,l))) = true := by + decide +kernel +lemma CA3_6_7I2PairP_check_0_5 : ∀ k l : Fin 6, contains (CA3_6_7I2PairRaw ((0,5),(k,l))) (CA3_6_7I2PairP ((0,5),(k,l))) = true := by + decide +kernel +lemma CA3_6_7I2PairP_check_1_0 : ∀ k l : Fin 6, contains (CA3_6_7I2PairRaw ((1,0),(k,l))) (CA3_6_7I2PairP ((1,0),(k,l))) = true := by + decide +kernel +lemma CA3_6_7I2PairP_check_1_1 : ∀ k l : Fin 6, contains (CA3_6_7I2PairRaw ((1,1),(k,l))) (CA3_6_7I2PairP ((1,1),(k,l))) = true := by + decide +kernel +lemma CA3_6_7I2PairP_check_1_2 : ∀ k l : Fin 6, contains (CA3_6_7I2PairRaw ((1,2),(k,l))) (CA3_6_7I2PairP ((1,2),(k,l))) = true := by + decide +kernel +lemma CA3_6_7I2PairP_check_1_3 : ∀ k l : Fin 6, contains (CA3_6_7I2PairRaw ((1,3),(k,l))) (CA3_6_7I2PairP ((1,3),(k,l))) = true := by + decide +kernel +lemma CA3_6_7I2PairP_check_1_4 : ∀ k l : Fin 6, contains (CA3_6_7I2PairRaw ((1,4),(k,l))) (CA3_6_7I2PairP ((1,4),(k,l))) = true := by + decide +kernel +lemma CA3_6_7I2PairP_check_1_5 : ∀ k l : Fin 6, contains (CA3_6_7I2PairRaw ((1,5),(k,l))) (CA3_6_7I2PairP ((1,5),(k,l))) = true := by + decide +kernel +lemma CA3_6_7I2PairP_check_2_0 : ∀ k l : Fin 6, contains (CA3_6_7I2PairRaw ((2,0),(k,l))) (CA3_6_7I2PairP ((2,0),(k,l))) = true := by + decide +kernel +lemma CA3_6_7I2PairP_check_2_1 : ∀ k l : Fin 6, contains (CA3_6_7I2PairRaw ((2,1),(k,l))) (CA3_6_7I2PairP ((2,1),(k,l))) = true := by + decide +kernel +lemma CA3_6_7I2PairP_check_2_2 : ∀ k l : Fin 6, contains (CA3_6_7I2PairRaw ((2,2),(k,l))) (CA3_6_7I2PairP ((2,2),(k,l))) = true := by + decide +kernel +lemma CA3_6_7I2PairP_check_2_3 : ∀ k l : Fin 6, contains (CA3_6_7I2PairRaw ((2,3),(k,l))) (CA3_6_7I2PairP ((2,3),(k,l))) = true := by + decide +kernel +lemma CA3_6_7I2PairP_check_2_4 : ∀ k l : Fin 6, contains (CA3_6_7I2PairRaw ((2,4),(k,l))) (CA3_6_7I2PairP ((2,4),(k,l))) = true := by + decide +kernel +lemma CA3_6_7I2PairP_check_2_5 : ∀ k l : Fin 6, contains (CA3_6_7I2PairRaw ((2,5),(k,l))) (CA3_6_7I2PairP ((2,5),(k,l))) = true := by + decide +kernel +lemma CA3_6_7I2PairP_check_3_0 : ∀ k l : Fin 6, contains (CA3_6_7I2PairRaw ((3,0),(k,l))) (CA3_6_7I2PairP ((3,0),(k,l))) = true := by + decide +kernel +lemma CA3_6_7I2PairP_check_3_1 : ∀ k l : Fin 6, contains (CA3_6_7I2PairRaw ((3,1),(k,l))) (CA3_6_7I2PairP ((3,1),(k,l))) = true := by + decide +kernel +lemma CA3_6_7I2PairP_check_3_2 : ∀ k l : Fin 6, contains (CA3_6_7I2PairRaw ((3,2),(k,l))) (CA3_6_7I2PairP ((3,2),(k,l))) = true := by + decide +kernel +lemma CA3_6_7I2PairP_check_3_3 : ∀ k l : Fin 6, contains (CA3_6_7I2PairRaw ((3,3),(k,l))) (CA3_6_7I2PairP ((3,3),(k,l))) = true := by + decide +kernel +lemma CA3_6_7I2PairP_check_3_4 : ∀ k l : Fin 6, contains (CA3_6_7I2PairRaw ((3,4),(k,l))) (CA3_6_7I2PairP ((3,4),(k,l))) = true := by + decide +kernel +lemma CA3_6_7I2PairP_check_3_5 : ∀ k l : Fin 6, contains (CA3_6_7I2PairRaw ((3,5),(k,l))) (CA3_6_7I2PairP ((3,5),(k,l))) = true := by + decide +kernel +lemma CA3_6_7I2PairP_check_4_0 : ∀ k l : Fin 6, contains (CA3_6_7I2PairRaw ((4,0),(k,l))) (CA3_6_7I2PairP ((4,0),(k,l))) = true := by + decide +kernel +lemma CA3_6_7I2PairP_check_4_1 : ∀ k l : Fin 6, contains (CA3_6_7I2PairRaw ((4,1),(k,l))) (CA3_6_7I2PairP ((4,1),(k,l))) = true := by + decide +kernel +lemma CA3_6_7I2PairP_check_4_2 : ∀ k l : Fin 6, contains (CA3_6_7I2PairRaw ((4,2),(k,l))) (CA3_6_7I2PairP ((4,2),(k,l))) = true := by + decide +kernel +lemma CA3_6_7I2PairP_check_4_3 : ∀ k l : Fin 6, contains (CA3_6_7I2PairRaw ((4,3),(k,l))) (CA3_6_7I2PairP ((4,3),(k,l))) = true := by + decide +kernel +lemma CA3_6_7I2PairP_check_4_4 : ∀ k l : Fin 6, contains (CA3_6_7I2PairRaw ((4,4),(k,l))) (CA3_6_7I2PairP ((4,4),(k,l))) = true := by + decide +kernel +lemma CA3_6_7I2PairP_check_4_5 : ∀ k l : Fin 6, contains (CA3_6_7I2PairRaw ((4,5),(k,l))) (CA3_6_7I2PairP ((4,5),(k,l))) = true := by + decide +kernel +lemma CA3_6_7I2PairP_check_5_0 : ∀ k l : Fin 6, contains (CA3_6_7I2PairRaw ((5,0),(k,l))) (CA3_6_7I2PairP ((5,0),(k,l))) = true := by + decide +kernel +lemma CA3_6_7I2PairP_check_5_1 : ∀ k l : Fin 6, contains (CA3_6_7I2PairRaw ((5,1),(k,l))) (CA3_6_7I2PairP ((5,1),(k,l))) = true := by + decide +kernel +lemma CA3_6_7I2PairP_check_5_2 : ∀ k l : Fin 6, contains (CA3_6_7I2PairRaw ((5,2),(k,l))) (CA3_6_7I2PairP ((5,2),(k,l))) = true := by + decide +kernel +lemma CA3_6_7I2PairP_check_5_3 : ∀ k l : Fin 6, contains (CA3_6_7I2PairRaw ((5,3),(k,l))) (CA3_6_7I2PairP ((5,3),(k,l))) = true := by + decide +kernel +lemma CA3_6_7I2PairP_check_5_4 : ∀ k l : Fin 6, contains (CA3_6_7I2PairRaw ((5,4),(k,l))) (CA3_6_7I2PairP ((5,4),(k,l))) = true := by + decide +kernel +lemma CA3_6_7I2PairP_check_5_5 : ∀ k l : Fin 6, contains (CA3_6_7I2PairRaw ((5,5),(k,l))) (CA3_6_7I2PairP ((5,5),(k,l))) = true := by + decide +kernel +lemma CA3_6_7I2PairP_check (a : PairSlot × PairSlot) : contains (CA3_6_7I2PairRaw a) (CA3_6_7I2PairP a) = true := by + rcases a with ⟨⟨i,j⟩,⟨k,l⟩⟩ + revert j i + apply forall_fin6 + · exact forall_fin6 (CA3_6_7I2PairP_check_0_0 k l) (CA3_6_7I2PairP_check_0_1 k l) (CA3_6_7I2PairP_check_0_2 k l) (CA3_6_7I2PairP_check_0_3 k l) (CA3_6_7I2PairP_check_0_4 k l) (CA3_6_7I2PairP_check_0_5 k l) + · exact forall_fin6 (CA3_6_7I2PairP_check_1_0 k l) (CA3_6_7I2PairP_check_1_1 k l) (CA3_6_7I2PairP_check_1_2 k l) (CA3_6_7I2PairP_check_1_3 k l) (CA3_6_7I2PairP_check_1_4 k l) (CA3_6_7I2PairP_check_1_5 k l) + · exact forall_fin6 (CA3_6_7I2PairP_check_2_0 k l) (CA3_6_7I2PairP_check_2_1 k l) (CA3_6_7I2PairP_check_2_2 k l) (CA3_6_7I2PairP_check_2_3 k l) (CA3_6_7I2PairP_check_2_4 k l) (CA3_6_7I2PairP_check_2_5 k l) + · exact forall_fin6 (CA3_6_7I2PairP_check_3_0 k l) (CA3_6_7I2PairP_check_3_1 k l) (CA3_6_7I2PairP_check_3_2 k l) (CA3_6_7I2PairP_check_3_3 k l) (CA3_6_7I2PairP_check_3_4 k l) (CA3_6_7I2PairP_check_3_5 k l) + · exact forall_fin6 (CA3_6_7I2PairP_check_4_0 k l) (CA3_6_7I2PairP_check_4_1 k l) (CA3_6_7I2PairP_check_4_2 k l) (CA3_6_7I2PairP_check_4_3 k l) (CA3_6_7I2PairP_check_4_4 k l) (CA3_6_7I2PairP_check_4_5 k l) + · exact forall_fin6 (CA3_6_7I2PairP_check_5_0 k l) (CA3_6_7I2PairP_check_5_1 k l) (CA3_6_7I2PairP_check_5_2 k l) (CA3_6_7I2PairP_check_5_3 k l) (CA3_6_7I2PairP_check_5_4 k l) (CA3_6_7I2PairP_check_5_5 k l) +lemma CA3_6_7I2PairP_sound (a : PairSlot × PairSlot) : + (CA3_6_7I2PairP a).Encloses (CA3_6_7I2PairValue a) := + contains_sound (CA3_6_7I2PairRaw_sound a) (CA3_6_7I2PairP_check a) +def CA3_6_7I2PairTerms (a : PairSlot × PairSlot) : Ball := + (CompactCertificate.entropyLookup CA3_6_7I2PairCertificates (CA3_6_7I2PairCertificateIndex a)).output +lemma CA3_6_7I2PairTerms_sound (a : PairSlot × PairSlot) : + (CA3_6_7I2PairTerms a).Encloses (Foundation.entropyTerm (CA3_6_7I2PairValue a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA3_6_7I2PairCertificates_valid + (CA3_6_7I2PairCertificateIndex a) (CA3_6_7I2PairP_sound a) +def CA3_6_7I2PairEntropy : Ball := ⟨(75080845296854901583388450035229 / 25000000000000000000000000000000), (29471329207 / 25000000000000000000000000000000)⟩ +lemma CA3_6_7I2PairEntropy_sound : CA3_6_7I2PairEntropy.Encloses (Foundation.finiteEntropy CA3_6_7I2PairValue) := by + exact contains_sound (entropyDoublePair_enclosed CA3_6_7I2PairValue CA3_6_7I2PairTerms CA3_6_7I2PairTerms_sound) (by decide +kernel) +def CA3_6_7I2PairMass : Ball := ⟨(25000000000000000000000000000001 / 25000000000000000000000000000000), (151 / 25000000000000000000000000000000)⟩ +lemma CA3_6_7I2PairMass_sound : CA3_6_7I2PairMass.Encloses (∑ a, CA3_6_7I2PairValue a) := by + exact contains_sound (doublePairSumBall_sound CA3_6_7I2PairP CA3_6_7I2PairValue CA3_6_7I2PairP_sound) (by decide +kernel) +def CA3_6_7I2PairMassTermLogWitness : LogWitness := ⟨0, 25000000000000000000000000000001, 25000000000000000000000000000000⟩ +def CA3_6_7I2PairMassTermLog : Ball := ⟨(1 / 25000000000000000000000000000000), (10587912143 / 50000000000000000000000000000000)⟩ +lemma CA3_6_7I2PairMassTermLog_sound : CA3_6_7I2PairMassTermLog.Encloses (Real.log ((∑ a, CA3_6_7I2PairValue a))) := by + exact checkLog_sound logTwoBall_sound (CA3_6_7I2PairMass_sound) (w := CA3_6_7I2PairMassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA3_6_7I2PairMassTerm : Ball := ⟨(-1 / 25000000000000000000000000000000), (21175824287 / 100000000000000000000000000000000)⟩ +lemma CA3_6_7I2PairMassTerm_sound : CA3_6_7I2PairMassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA3_6_7I2PairValue a))) := by + exact contains_sound (entropyTerm_ball (CA3_6_7I2PairMass_sound) CA3_6_7I2PairMassTermLog_sound) (by decide +kernel) +def CA3_6_7I2PairH : Ball := ⟨(7508084529685490158338845003523 / 2500000000000000000000000000000), (27812228223 / 20000000000000000000000000000000)⟩ +lemma CA3_6_7I2PairH_sound : CA3_6_7I2PairH.Encloses (homogeneousEntropy CA3_6_7I2PairValue) := by + exact contains_sound (homogeneous_enclosed CA3_6_7I2PairValue CA3_6_7I2PairMassTerm_sound CA3_6_7I2PairEntropy_sound) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA4_4_8I0.lean b/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA4_4_8I0.lean new file mode 100644 index 0000000000000000000000000000000000000000..ceca8fb642fc362c9a09b64ab049b44ecf846376 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA4_4_8I0.lean @@ -0,0 +1,77 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Certificates.Terminal1_1_6 + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CA4_4_8I0Value (a : Fin 17) : ℝ := marginal (below (shape 4 4 8)) (fun u => (stageALaw (shape 4 4 8) u : ℝ)) ((Equiv.refl (Fin 3)) 0) a +def CA4_4_8I0Raw (a : Fin 17) : Ball := marginalBall (below (shape 4 4 8)) A4_4_8Law ((Equiv.refl (Fin 3)) 0) a +lemma CA4_4_8I0Raw_sound (a : Fin 17) : + (CA4_4_8I0Raw a).Encloses (CA4_4_8I0Value a) := by + exact marginalBall_sound (below (shape 4 4 8)) A4_4_8Law (fun u => (stageALaw (shape 4 4 8) u : ℝ)) (fun u _ => A4_4_8Law_sound u) ((Equiv.refl (Fin 3)) 0) a +def CA4_4_8I0Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(2589321262873460994222456456713 / 100000000000000000000000000000000), (9 / 50000000000000000000000000000000)⟩ ⟨(4730397878676437863656173314291 / 50000000000000000000000000000000), (3838170821 / 100000000000000000000000000000000)⟩ ⟨(-365377440528715911135389273604699 / 100000000000000000000000000000000), (37057691619 / 25000000000000000000000000000000)⟩ ⟨-6, 2589321262873460994222456456713, 1562500000000000000000000000000⟩, + .log ⟨(23158394703023787685168823300721 / 100000000000000000000000000000000), (99 / 100000000000000000000000000000000)⟩ ⟨(16938198667205440183393994905631 / 50000000000000000000000000000000), (3923184713 / 20000000000000000000000000000000)⟩ ⟨(-73140642451325965370550661695019 / 50000000000000000000000000000000), (84703295159 / 100000000000000000000000000000000)⟩ ⟨-3, 23158394703023787685168823300721, 12500000000000000000000000000000⟩, + .log ⟨(4850456806820550264121744048513 / 10000000000000000000000000000000), (31 / 25000000000000000000000000000000)⟩ ⟨(4386705877521903671413106468791 / 12500000000000000000000000000000), (30813725651 / 100000000000000000000000000000000)⟩ ⟨(-72351220550665899606955299562419 / 100000000000000000000000000000000), (7940933913 / 12500000000000000000000000000000)⟩ ⟨-2, 4850456806820550264121744048513, 2500000000000000000000000000000⟩] +lemma CA4_4_8I0Certificates_valid : + CA4_4_8I0Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA4_4_8I0CertificateIndex (a : Fin 17) : ℕ := + match a.val with + | 0 => 1 + | 1 => 2 + | 2 => 3 + | 3 => 2 + | 4 => 1 + | _ => 0 +def CA4_4_8I0P (a : Fin 17) : Ball := + (CompactCertificate.entropyLookup CA4_4_8I0Certificates (CA4_4_8I0CertificateIndex a)).input +lemma CA4_4_8I0P_check : ∀ a : Fin 17, contains (CA4_4_8I0Raw a) (CA4_4_8I0P a) = true := by + decide +kernel +lemma CA4_4_8I0P_sound (a : Fin 17) : + (CA4_4_8I0P a).Encloses (CA4_4_8I0Value a) := + contains_sound (CA4_4_8I0Raw_sound a) (CA4_4_8I0P_check a) +def CA4_4_8I0Terms (a : Fin 17) : Ball := + (CompactCertificate.entropyLookup CA4_4_8I0Certificates (CA4_4_8I0CertificateIndex a)).output +lemma CA4_4_8I0Terms_sound (a : Fin 17) : + (CA4_4_8I0Terms a).Encloses (Foundation.entropyTerm (CA4_4_8I0Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA4_4_8I0Certificates_valid + (CA4_4_8I0CertificateIndex a) (CA4_4_8I0P_sound a) +def CA4_4_8I0Entropy : Ball := ⟨(237828189850981917108409227793 / 195312500000000000000000000000), (77721914423 / 100000000000000000000000000000000)⟩ +lemma CA4_4_8I0Entropy_sound : CA4_4_8I0Entropy.Encloses (Foundation.finiteEntropy CA4_4_8I0Value) := by + exact contains_sound (entropyFin_enclosed 17 CA4_4_8I0Value CA4_4_8I0Terms CA4_4_8I0Terms_sound) (by decide +kernel) +def CA4_4_8I0Mass : Ball := ⟨(49999999999999999999999999999999 / 50000000000000000000000000000000), (179 / 50000000000000000000000000000000)⟩ +lemma CA4_4_8I0Mass_sound : CA4_4_8I0Mass.Encloses (∑ a, CA4_4_8I0Value a) := by + exact contains_sound (finSumBall_sound 17 CA4_4_8I0P CA4_4_8I0Value CA4_4_8I0P_sound) (by decide +kernel) +def CA4_4_8I0MassTermLogWitness : LogWitness := ⟨-1, 49999999999999999999999999999999, 25000000000000000000000000000000⟩ +def CA4_4_8I0MassTermLog : Ball := ⟨(-1 / 100000000000000000000000000000000), (10587911931 / 25000000000000000000000000000000)⟩ +lemma CA4_4_8I0MassTermLog_sound : CA4_4_8I0MassTermLog.Encloses (Real.log ((∑ a, CA4_4_8I0Value a))) := by + exact checkLog_sound logTwoBall_sound (CA4_4_8I0Mass_sound) (w := CA4_4_8I0MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA4_4_8I0MassTerm : Ball := ⟨(1 / 100000000000000000000000000000000), (1694065909 / 4000000000000000000000000000000)⟩ +lemma CA4_4_8I0MassTerm_sound : CA4_4_8I0MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA4_4_8I0Value a))) := by + exact contains_sound (entropyTerm_ball (CA4_4_8I0Mass_sound) CA4_4_8I0MassTermLog_sound) (by decide +kernel) +def CA4_4_8I0H : Ball := ⟨(24353606640740548311901104926003 / 20000000000000000000000000000000), (30018390537 / 25000000000000000000000000000000)⟩ +lemma CA4_4_8I0H_sound : CA4_4_8I0H.Encloses (homogeneousEntropy CA4_4_8I0Value) := by + exact contains_sound (homogeneous_enclosed CA4_4_8I0Value CA4_4_8I0MassTerm_sound CA4_4_8I0Entropy_sound) (by decide +kernel) +lemma CA4_4_8I0_sound : CA4_4_8I0H.Encloses (stageACapacity (shape 4 4 8) 0) := by + exact CA4_4_8I0H_sound + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA4_4_8I1.lean b/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA4_4_8I1.lean new file mode 100644 index 0000000000000000000000000000000000000000..8622b8b463ec03be21430474836a9f26e6ff1258 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA4_4_8I1.lean @@ -0,0 +1,1051 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Certificates.SupportedContraction + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CA4_4_8I1PairValue (a : PairSlot × PairSlot) : ℝ := pairLaw (below (shape 4 4 8)) (shape 4 4 8) (fun u => (stageALaw (shape 4 4 8) u : ℝ)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) a +def CA4_4_8I1PairRaw (a : PairSlot × PairSlot) : Ball := stageAPairBall (shape 4 4 8) A4_4_8Law 1 a +lemma CA4_4_8I1PairRaw_sound (a : PairSlot × PairSlot) : + (CA4_4_8I1PairRaw a).Encloses (CA4_4_8I1PairValue a) := by + exact stageAPairBall_sound (shape 4 4 8) (by decide +kernel) A4_4_8Law (fun u => (stageALaw (shape 4 4 8) u : ℝ)) (fun u _ => A4_4_8Law_sound u) 1 a +def CA4_4_8I1PairCertificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(314423290018372900986627649 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(6659799119036077092390487787 / 25000000000000000000000000000000), (9055127 / 100000000000000000000000000000000)⟩ ⟨(-1059049906679451244035407109899287 / 100000000000000000000000000000000), (179994521183 / 50000000000000000000000000000000)⟩ ⟨-16, 314423290018372900986627649, 190734863281250000000000000⟩, + .log ⟨(64018459366040132597127547007 / 25000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ ⟨(191013786064334317565099687427 / 12500000000000000000000000000000), (108451493 / 20000000000000000000000000000000)⟩ ⟨(-119349192689670621173759081237297 / 20000000000000000000000000000000), (211758238001 / 100000000000000000000000000000000)⟩ ⟨-9, 64018459366040132597127547007, 48828125000000000000000000000⟩, + .log ⟨(1827992080296839459972808997061 / 100000000000000000000000000000000), (3 / 20000000000000000000000000000000)⟩ ⟨(7315536644731865385667081595021 / 100000000000000000000000000000000), (541929347 / 20000000000000000000000000000000)⟩ ⟨(-400195204540707206000113957516591 / 100000000000000000000000000000000), (148230766601 / 100000000000000000000000000000000)⟩ ⟨-6, 1827992080296839459972808997061, 1562500000000000000000000000000⟩, + .log ⟨(129314048175672016811555022893 / 100000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ ⟨(172005310539915519284643644567 / 20000000000000000000000000000000), (301216479 / 100000000000000000000000000000000)⟩ ⟨(-665068153717714379814276957392311 / 100000000000000000000000000000000), (232934062059 / 100000000000000000000000000000000)⟩ ⟨-10, 129314048175672016811555022893, 97656250000000000000000000000⟩, + .log ⟨(4090207334626568283712673773 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(1924684409518868914061399987 / 2500000000000000000000000000000), (406001 / 1562500000000000000000000000000)⟩ ⟨(-941118262257769198398609961793723 / 100000000000000000000000000000000), (317637367469 / 100000000000000000000000000000000)⟩ ⟨-14, 4090207334626568283712673773, 3051757812500000000000000000⟩, + .log ⟨(81098031324791547309636513431 / 50000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ ⟨(1041966904825690353657890236951 / 100000000000000000000000000000000), (37780989 / 10000000000000000000000000000000)⟩ ⟨(-321205979912351652786817210073577 / 50000000000000000000000000000000), (116467030873 / 50000000000000000000000000000000)⟩ ⟨-10, 81098031324791547309636513431, 48828125000000000000000000000⟩, + .log ⟨(5178381185616060007566540177167 / 100000000000000000000000000000000), (3 / 10000000000000000000000000000000)⟩ ⟨(15331517651686582559443927751529 / 100000000000000000000000000000000), (6579389337 / 100000000000000000000000000000000)⟩ ⟨(-74016942274705427265353197585151 / 25000000000000000000000000000000), (127054942677 / 100000000000000000000000000000000)⟩ ⟨-5, 5178381185616060007566540177167, 3125000000000000000000000000000⟩, + .log ⟨(4467386521082530682319624261 / 1000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ ⟨(2417281274549881012946303494831 / 100000000000000000000000000000000), (212851331 / 25000000000000000000000000000000)⟩ ⟨(-541095171224210276759554985805347 / 100000000000000000000000000000000), (95291206909 / 50000000000000000000000000000000)⟩ ⟨-8, 4467386521082530682319624261, 3906250000000000000000000000⟩, + .log ⟨(688606063331092941255649109809 / 50000000000000000000000000000000), (13 / 100000000000000000000000000000000)⟩ ⟨(2950751990021937892152415086987 / 50000000000000000000000000000000), (2333088163 / 100000000000000000000000000000000)⟩ ⟨(-214255446412121452196666689159527 / 50000000000000000000000000000000), (21175823801 / 12500000000000000000000000000000)⟩ ⟨-7, 688606063331092941255649109809, 390625000000000000000000000000⟩, + .log ⟨(25690597409828756485476917179 / 20000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ ⟨(855158097339175378689003325641 / 100000000000000000000000000000000), (11968431 / 4000000000000000000000000000000)⟩ ⟨(-665736248711762074541608793931601 / 100000000000000000000000000000000), (232934062069 / 100000000000000000000000000000000)⟩ ⟨-10, 25690597409828756485476917179, 19531250000000000000000000000⟩, + .log ⟨(645094128905276122471516286389 / 12500000000000000000000000000000), (9 / 25000000000000000000000000000000)⟩ ⟨(15296924483840307384308119307967 / 100000000000000000000000000000000), (6556991919 / 100000000000000000000000000000000)⟩ ⟨(-296408768085503426043971095985503 / 100000000000000000000000000000000), (25410988559 / 20000000000000000000000000000000)⟩ ⟨-5, 645094128905276122471516286389, 390625000000000000000000000000⟩, + .log ⟨(11743603988387563260835747113 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(106275114935926281010073224109 / 100000000000000000000000000000000), (9325521 / 25000000000000000000000000000000)⟩ ⟨(-904961671400145837811787937931693 / 100000000000000000000000000000000), (3970467047 / 1250000000000000000000000000000)⟩ ⟨-14, 11743603988387563260835747113, 6103515625000000000000000000⟩, + .log ⟨(119982861643270677730165523631 / 25000000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ ⟨(2562489425544086214279198000591 / 100000000000000000000000000000000), (457332479 / 50000000000000000000000000000000)⟩ ⟨(-266964109545369934140924564386159 / 50000000000000000000000000000000), (9529120699 / 5000000000000000000000000000000)⟩ ⟨-8, 119982861643270677730165523631, 97656250000000000000000000000⟩, + .log ⟨(773253199559204660666668449787 / 4000000000000000000000000000000), (47 / 50000000000000000000000000000000)⟩ ⟨(31769940705175036122458851321023 / 100000000000000000000000000000000), (8187136833 / 50000000000000000000000000000000)⟩ ⟨(-164344309073848449609447916900417 / 100000000000000000000000000000000), (42351647609 / 50000000000000000000000000000000)⟩ ⟨-3, 773253199559204660666668449787, 500000000000000000000000000000⟩] +lemma CA4_4_8I1PairCertificates_valid : + CA4_4_8I1PairCertificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA4_4_8I1PairCertificateIndex (a : PairSlot × PairSlot) : ℕ := + match a.1.1.val, a.1.2.val, a.2.1.val, a.2.2.val with + | 0, 0, 5, 0 => 1 + | 0, 0, 4, 1 => 2 + | 0, 0, 2, 2 => 3 + | 0, 0, 2, 3 => 4 + | 0, 0, 3, 2 => 4 + | 0, 0, 3, 3 => 5 + | 0, 0, 1, 4 => 2 + | 0, 0, 0, 5 => 1 + | 1, 0, 4, 0 => 6 + | 1, 0, 2, 1 => 7 + | 1, 0, 3, 1 => 8 + | 1, 0, 1, 2 => 7 + | 1, 0, 1, 3 => 8 + | 1, 0, 0, 4 => 6 + | 0, 1, 4, 0 => 6 + | 0, 1, 2, 1 => 7 + | 0, 1, 3, 1 => 8 + | 0, 1, 1, 2 => 7 + | 0, 1, 1, 3 => 8 + | 0, 1, 0, 4 => 6 + | 2, 0, 2, 0 => 9 + | 2, 0, 3, 0 => 10 + | 2, 0, 1, 1 => 11 + | 2, 0, 0, 2 => 9 + | 2, 0, 0, 3 => 10 + | 3, 0, 2, 0 => 10 + | 3, 0, 3, 0 => 12 + | 3, 0, 1, 1 => 13 + | 3, 0, 0, 2 => 10 + | 3, 0, 0, 3 => 12 + | 1, 1, 2, 0 => 11 + | 1, 1, 3, 0 => 13 + | 1, 1, 1, 1 => 14 + | 1, 1, 0, 2 => 11 + | 1, 1, 0, 3 => 13 + | 0, 2, 2, 0 => 9 + | 0, 2, 3, 0 => 10 + | 0, 2, 1, 1 => 11 + | 0, 2, 0, 2 => 9 + | 0, 2, 0, 3 => 10 + | 0, 3, 2, 0 => 10 + | 0, 3, 3, 0 => 12 + | 0, 3, 1, 1 => 13 + | 0, 3, 0, 2 => 10 + | 0, 3, 0, 3 => 12 + | 4, 0, 1, 0 => 6 + | 4, 0, 0, 1 => 6 + | 2, 1, 1, 0 => 7 + | 2, 1, 0, 1 => 7 + | 3, 1, 1, 0 => 8 + | 3, 1, 0, 1 => 8 + | 1, 2, 1, 0 => 7 + | 1, 2, 0, 1 => 7 + | 1, 3, 1, 0 => 8 + | 1, 3, 0, 1 => 8 + | 0, 4, 1, 0 => 6 + | 0, 4, 0, 1 => 6 + | 0, 5, 0, 0 => 1 + | 1, 4, 0, 0 => 2 + | 2, 2, 0, 0 => 3 + | 2, 3, 0, 0 => 4 + | 3, 2, 0, 0 => 4 + | 3, 3, 0, 0 => 5 + | 4, 1, 0, 0 => 2 + | 5, 0, 0, 0 => 1 + | _, _, _, _ => 0 +def CA4_4_8I1PairP (a : PairSlot × PairSlot) : Ball := + (CompactCertificate.entropyLookup CA4_4_8I1PairCertificates (CA4_4_8I1PairCertificateIndex a)).input +lemma CA4_4_8I1PairP_check_0_0 : ∀ k l : Fin 6, contains (CA4_4_8I1PairRaw ((0,0),(k,l))) (CA4_4_8I1PairP ((0,0),(k,l))) = true := by + decide +kernel +lemma CA4_4_8I1PairP_check_0_1 : ∀ k l : Fin 6, contains (CA4_4_8I1PairRaw ((0,1),(k,l))) (CA4_4_8I1PairP ((0,1),(k,l))) = true := by + decide +kernel +lemma CA4_4_8I1PairP_check_0_2 : ∀ k l : Fin 6, contains (CA4_4_8I1PairRaw ((0,2),(k,l))) (CA4_4_8I1PairP ((0,2),(k,l))) = true := by + decide +kernel +lemma CA4_4_8I1PairP_check_0_3 : ∀ k l : Fin 6, contains (CA4_4_8I1PairRaw ((0,3),(k,l))) (CA4_4_8I1PairP ((0,3),(k,l))) = true := by + decide +kernel +lemma CA4_4_8I1PairP_check_0_4 : ∀ k l : Fin 6, contains (CA4_4_8I1PairRaw ((0,4),(k,l))) (CA4_4_8I1PairP ((0,4),(k,l))) = true := by + decide +kernel +lemma CA4_4_8I1PairP_check_0_5 : ∀ k l : Fin 6, contains (CA4_4_8I1PairRaw ((0,5),(k,l))) (CA4_4_8I1PairP ((0,5),(k,l))) = true := by + decide +kernel +lemma CA4_4_8I1PairP_check_1_0 : ∀ k l : Fin 6, contains (CA4_4_8I1PairRaw ((1,0),(k,l))) (CA4_4_8I1PairP ((1,0),(k,l))) = true := by + decide +kernel +lemma CA4_4_8I1PairP_check_1_1 : ∀ k l : Fin 6, contains (CA4_4_8I1PairRaw ((1,1),(k,l))) (CA4_4_8I1PairP ((1,1),(k,l))) = true := by + decide +kernel +lemma CA4_4_8I1PairP_check_1_2 : ∀ k l : Fin 6, contains (CA4_4_8I1PairRaw ((1,2),(k,l))) (CA4_4_8I1PairP ((1,2),(k,l))) = true := by + decide +kernel +lemma CA4_4_8I1PairP_check_1_3 : ∀ k l : Fin 6, contains (CA4_4_8I1PairRaw ((1,3),(k,l))) (CA4_4_8I1PairP ((1,3),(k,l))) = true := by + decide +kernel +lemma CA4_4_8I1PairP_check_1_4 : ∀ k l : Fin 6, contains (CA4_4_8I1PairRaw ((1,4),(k,l))) (CA4_4_8I1PairP ((1,4),(k,l))) = true := by + decide +kernel +lemma CA4_4_8I1PairP_check_1_5 : ∀ k l : Fin 6, contains (CA4_4_8I1PairRaw ((1,5),(k,l))) (CA4_4_8I1PairP ((1,5),(k,l))) = true := by + decide +kernel +lemma CA4_4_8I1PairP_check_2_0 : ∀ k l : Fin 6, contains (CA4_4_8I1PairRaw ((2,0),(k,l))) (CA4_4_8I1PairP ((2,0),(k,l))) = true := by + decide +kernel +lemma CA4_4_8I1PairP_check_2_1 : ∀ k l : Fin 6, contains (CA4_4_8I1PairRaw ((2,1),(k,l))) (CA4_4_8I1PairP ((2,1),(k,l))) = true := by + decide +kernel +lemma CA4_4_8I1PairP_check_2_2 : ∀ k l : Fin 6, contains (CA4_4_8I1PairRaw ((2,2),(k,l))) (CA4_4_8I1PairP ((2,2),(k,l))) = true := by + decide +kernel +lemma CA4_4_8I1PairP_check_2_3 : ∀ k l : Fin 6, contains (CA4_4_8I1PairRaw ((2,3),(k,l))) (CA4_4_8I1PairP ((2,3),(k,l))) = true := by + decide +kernel +lemma CA4_4_8I1PairP_check_2_4 : ∀ k l : Fin 6, contains (CA4_4_8I1PairRaw ((2,4),(k,l))) (CA4_4_8I1PairP ((2,4),(k,l))) = true := by + decide +kernel +lemma CA4_4_8I1PairP_check_2_5 : ∀ k l : Fin 6, contains (CA4_4_8I1PairRaw ((2,5),(k,l))) (CA4_4_8I1PairP ((2,5),(k,l))) = true := by + decide +kernel +lemma CA4_4_8I1PairP_check_3_0 : ∀ k l : Fin 6, contains (CA4_4_8I1PairRaw ((3,0),(k,l))) (CA4_4_8I1PairP ((3,0),(k,l))) = true := by + decide +kernel +lemma CA4_4_8I1PairP_check_3_1 : ∀ k l : Fin 6, contains (CA4_4_8I1PairRaw ((3,1),(k,l))) (CA4_4_8I1PairP ((3,1),(k,l))) = true := by + decide +kernel +lemma CA4_4_8I1PairP_check_3_2 : ∀ k l : Fin 6, contains (CA4_4_8I1PairRaw ((3,2),(k,l))) (CA4_4_8I1PairP ((3,2),(k,l))) = true := by + decide +kernel +lemma CA4_4_8I1PairP_check_3_3 : ∀ k l : Fin 6, contains (CA4_4_8I1PairRaw ((3,3),(k,l))) (CA4_4_8I1PairP ((3,3),(k,l))) = true := by + decide +kernel +lemma CA4_4_8I1PairP_check_3_4 : ∀ k l : Fin 6, contains (CA4_4_8I1PairRaw ((3,4),(k,l))) (CA4_4_8I1PairP ((3,4),(k,l))) = true := by + decide +kernel +lemma CA4_4_8I1PairP_check_3_5 : ∀ k l : Fin 6, contains (CA4_4_8I1PairRaw ((3,5),(k,l))) (CA4_4_8I1PairP ((3,5),(k,l))) = true := by + decide +kernel +lemma CA4_4_8I1PairP_check_4_0 : ∀ k l : Fin 6, contains (CA4_4_8I1PairRaw ((4,0),(k,l))) (CA4_4_8I1PairP ((4,0),(k,l))) = true := by + decide +kernel +lemma CA4_4_8I1PairP_check_4_1 : ∀ k l : Fin 6, contains (CA4_4_8I1PairRaw ((4,1),(k,l))) (CA4_4_8I1PairP ((4,1),(k,l))) = true := by + decide +kernel +lemma CA4_4_8I1PairP_check_4_2 : ∀ k l : Fin 6, contains (CA4_4_8I1PairRaw ((4,2),(k,l))) (CA4_4_8I1PairP ((4,2),(k,l))) = true := by + decide +kernel +lemma CA4_4_8I1PairP_check_4_3 : ∀ k l : Fin 6, contains (CA4_4_8I1PairRaw ((4,3),(k,l))) (CA4_4_8I1PairP ((4,3),(k,l))) = true := by + decide +kernel +lemma CA4_4_8I1PairP_check_4_4 : ∀ k l : Fin 6, contains (CA4_4_8I1PairRaw ((4,4),(k,l))) (CA4_4_8I1PairP ((4,4),(k,l))) = true := by + decide +kernel +lemma CA4_4_8I1PairP_check_4_5 : ∀ k l : Fin 6, contains (CA4_4_8I1PairRaw ((4,5),(k,l))) (CA4_4_8I1PairP ((4,5),(k,l))) = true := by + decide +kernel +lemma CA4_4_8I1PairP_check_5_0 : ∀ k l : Fin 6, contains (CA4_4_8I1PairRaw ((5,0),(k,l))) (CA4_4_8I1PairP ((5,0),(k,l))) = true := by + decide +kernel +lemma CA4_4_8I1PairP_check_5_1 : ∀ k l : Fin 6, contains (CA4_4_8I1PairRaw ((5,1),(k,l))) (CA4_4_8I1PairP ((5,1),(k,l))) = true := by + decide +kernel +lemma CA4_4_8I1PairP_check_5_2 : ∀ k l : Fin 6, contains (CA4_4_8I1PairRaw ((5,2),(k,l))) (CA4_4_8I1PairP ((5,2),(k,l))) = true := by + decide +kernel +lemma CA4_4_8I1PairP_check_5_3 : ∀ k l : Fin 6, contains (CA4_4_8I1PairRaw ((5,3),(k,l))) (CA4_4_8I1PairP ((5,3),(k,l))) = true := by + decide +kernel +lemma CA4_4_8I1PairP_check_5_4 : ∀ k l : Fin 6, contains (CA4_4_8I1PairRaw ((5,4),(k,l))) (CA4_4_8I1PairP ((5,4),(k,l))) = true := by + decide +kernel +lemma CA4_4_8I1PairP_check_5_5 : ∀ k l : Fin 6, contains (CA4_4_8I1PairRaw ((5,5),(k,l))) (CA4_4_8I1PairP ((5,5),(k,l))) = true := by + decide +kernel +lemma CA4_4_8I1PairP_check (a : PairSlot × PairSlot) : contains (CA4_4_8I1PairRaw a) (CA4_4_8I1PairP a) = true := by + rcases a with ⟨⟨i,j⟩,⟨k,l⟩⟩ + revert j i + apply forall_fin6 + · exact forall_fin6 (CA4_4_8I1PairP_check_0_0 k l) (CA4_4_8I1PairP_check_0_1 k l) (CA4_4_8I1PairP_check_0_2 k l) (CA4_4_8I1PairP_check_0_3 k l) (CA4_4_8I1PairP_check_0_4 k l) (CA4_4_8I1PairP_check_0_5 k l) + · exact forall_fin6 (CA4_4_8I1PairP_check_1_0 k l) (CA4_4_8I1PairP_check_1_1 k l) (CA4_4_8I1PairP_check_1_2 k l) (CA4_4_8I1PairP_check_1_3 k l) (CA4_4_8I1PairP_check_1_4 k l) (CA4_4_8I1PairP_check_1_5 k l) + · exact forall_fin6 (CA4_4_8I1PairP_check_2_0 k l) (CA4_4_8I1PairP_check_2_1 k l) (CA4_4_8I1PairP_check_2_2 k l) (CA4_4_8I1PairP_check_2_3 k l) (CA4_4_8I1PairP_check_2_4 k l) (CA4_4_8I1PairP_check_2_5 k l) + · exact forall_fin6 (CA4_4_8I1PairP_check_3_0 k l) (CA4_4_8I1PairP_check_3_1 k l) (CA4_4_8I1PairP_check_3_2 k l) (CA4_4_8I1PairP_check_3_3 k l) (CA4_4_8I1PairP_check_3_4 k l) (CA4_4_8I1PairP_check_3_5 k l) + · exact forall_fin6 (CA4_4_8I1PairP_check_4_0 k l) (CA4_4_8I1PairP_check_4_1 k l) (CA4_4_8I1PairP_check_4_2 k l) (CA4_4_8I1PairP_check_4_3 k l) (CA4_4_8I1PairP_check_4_4 k l) (CA4_4_8I1PairP_check_4_5 k l) + · exact forall_fin6 (CA4_4_8I1PairP_check_5_0 k l) (CA4_4_8I1PairP_check_5_1 k l) (CA4_4_8I1PairP_check_5_2 k l) (CA4_4_8I1PairP_check_5_3 k l) (CA4_4_8I1PairP_check_5_4 k l) (CA4_4_8I1PairP_check_5_5 k l) +lemma CA4_4_8I1PairP_sound (a : PairSlot × PairSlot) : + (CA4_4_8I1PairP a).Encloses (CA4_4_8I1PairValue a) := + contains_sound (CA4_4_8I1PairRaw_sound a) (CA4_4_8I1PairP_check a) +def CA4_4_8I1PairTerms (a : PairSlot × PairSlot) : Ball := + (CompactCertificate.entropyLookup CA4_4_8I1PairCertificates (CA4_4_8I1PairCertificateIndex a)).output +lemma CA4_4_8I1PairTerms_sound (a : PairSlot × PairSlot) : + (CA4_4_8I1PairTerms a).Encloses (Foundation.entropyTerm (CA4_4_8I1PairValue a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA4_4_8I1PairCertificates_valid + (CA4_4_8I1PairCertificateIndex a) (CA4_4_8I1PairP_sound a) +def CA4_4_8I1PairEntropy : Ball := ⟨(308850256342829279281678118501801 / 100000000000000000000000000000000), (32371590663 / 25000000000000000000000000000000)⟩ +lemma CA4_4_8I1PairEntropy_sound : CA4_4_8I1PairEntropy.Encloses (Foundation.finiteEntropy CA4_4_8I1PairValue) := by + exact contains_sound (entropyDoublePair_enclosed CA4_4_8I1PairValue CA4_4_8I1PairTerms CA4_4_8I1PairTerms_sound) (by decide +kernel) +def CA4_4_8I1PairMass : Ball := ⟨(100000000000000000000000000000001 / 100000000000000000000000000000000), (331 / 50000000000000000000000000000000)⟩ +lemma CA4_4_8I1PairMass_sound : CA4_4_8I1PairMass.Encloses (∑ a, CA4_4_8I1PairValue a) := by + exact contains_sound (doublePairSumBall_sound CA4_4_8I1PairP CA4_4_8I1PairValue CA4_4_8I1PairP_sound) (by decide +kernel) +def CA4_4_8I1PairMassTermLogWitness : LogWitness := ⟨0, 100000000000000000000000000000001, 100000000000000000000000000000000⟩ +def CA4_4_8I1PairMassTermLog : Ball := ⟨(1 / 100000000000000000000000000000000), (2646978043 / 12500000000000000000000000000000)⟩ +lemma CA4_4_8I1PairMassTermLog_sound : CA4_4_8I1PairMassTermLog.Encloses (Real.log ((∑ a, CA4_4_8I1PairValue a))) := by + exact checkLog_sound logTwoBall_sound (CA4_4_8I1PairMass_sound) (w := CA4_4_8I1PairMassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA4_4_8I1PairMassTerm : Ball := ⟨(-1 / 100000000000000000000000000000000), (4235164869 / 20000000000000000000000000000000)⟩ +lemma CA4_4_8I1PairMassTerm_sound : CA4_4_8I1PairMassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA4_4_8I1PairValue a))) := by + exact contains_sound (entropyTerm_ball (CA4_4_8I1PairMass_sound) CA4_4_8I1PairMassTermLog_sound) (by decide +kernel) +def CA4_4_8I1PairH : Ball := ⟨(154425128171414639640839059250901 / 50000000000000000000000000000000), (150662186997 / 100000000000000000000000000000000)⟩ +lemma CA4_4_8I1PairH_sound : CA4_4_8I1PairH.Encloses (homogeneousEntropy CA4_4_8I1PairValue) := by + exact contains_sound (homogeneous_enclosed CA4_4_8I1PairValue CA4_4_8I1PairMassTerm_sound CA4_4_8I1PairEntropy_sound) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CA4_4_8I1R0Value (a : PairSlot) : ℝ := residualLaw (below (shape 4 4 8)) (fun u => (stageALaw (shape 4 4 8) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 0 a +def CA4_4_8I1R0Raw (a : PairSlot) : Ball := residualBall (below (shape 4 4 8)) A4_4_8Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 0 a +lemma CA4_4_8I1R0Raw_sound (a : PairSlot) : + (CA4_4_8I1R0Raw a).Encloses (CA4_4_8I1R0Value a) := by + exact residualBall_sound_on (below (shape 4 4 8)) A4_4_8Law (fun u => (stageALaw (shape 4 4 8) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A4_4_8Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 4 4 8) (show (shape 4 4 8) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 0 a +def CA4_4_8I1R0Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(10203043120648639286547464097 / 390625000000000000000000000000), (9 / 50000000000000000000000000000000)⟩ ⟨(4760412769112588948014764417159 / 50000000000000000000000000000000), (483969577 / 12500000000000000000000000000000)⟩ ⟨(-91126549988371926878531538134997 / 25000000000000000000000000000000), (14823076647 / 10000000000000000000000000000000)⟩ ⟨-6, 10203043120648639286547464097, 6103515625000000000000000000⟩] +lemma CA4_4_8I1R0Certificates_valid : + CA4_4_8I1R0Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA4_4_8I1R0CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 0, 0 => 1 + | _, _ => 0 +def CA4_4_8I1R0P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA4_4_8I1R0Certificates (CA4_4_8I1R0CertificateIndex a)).input +lemma CA4_4_8I1R0P_check : ∀ a : PairSlot, contains (CA4_4_8I1R0Raw a) (CA4_4_8I1R0P a) = true := by + decide +kernel +lemma CA4_4_8I1R0P_sound (a : PairSlot) : + (CA4_4_8I1R0P a).Encloses (CA4_4_8I1R0Value a) := + contains_sound (CA4_4_8I1R0Raw_sound a) (CA4_4_8I1R0P_check a) +def CA4_4_8I1R0Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA4_4_8I1R0Certificates (CA4_4_8I1R0CertificateIndex a)).output +lemma CA4_4_8I1R0Terms_sound (a : PairSlot) : + (CA4_4_8I1R0Terms a).Encloses (Foundation.entropyTerm (CA4_4_8I1R0Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA4_4_8I1R0Certificates_valid + (CA4_4_8I1R0CertificateIndex a) (CA4_4_8I1R0P_sound a) +def CA4_4_8I1R0Entropy : Ball := ⟨(4760412769112588948014764417159 / 50000000000000000000000000000000), (483969577 / 12500000000000000000000000000000)⟩ +lemma CA4_4_8I1R0Entropy_sound : CA4_4_8I1R0Entropy.Encloses (Foundation.finiteEntropy CA4_4_8I1R0Value) := by + exact contains_sound (entropyPair_enclosed CA4_4_8I1R0Value CA4_4_8I1R0Terms CA4_4_8I1R0Terms_sound) (by decide +kernel) +def CA4_4_8I1R0Mass : Ball := ⟨(10203043120648639286547464097 / 390625000000000000000000000000), (9 / 50000000000000000000000000000000)⟩ +lemma CA4_4_8I1R0Mass_sound : CA4_4_8I1R0Mass.Encloses (∑ a, CA4_4_8I1R0Value a) := by + exact contains_sound (pairSumBall_sound CA4_4_8I1R0P CA4_4_8I1R0Value CA4_4_8I1R0P_sound) (by decide +kernel) +def CA4_4_8I1R0MassTermLogWitness : LogWitness := ⟨-6, 10203043120648639286547464097, 6103515625000000000000000000⟩ +def CA4_4_8I1R0MassTermLog : Ball := ⟨(-91126549988371926878531538134997 / 25000000000000000000000000000000), (14823076647 / 10000000000000000000000000000000)⟩ +lemma CA4_4_8I1R0MassTermLog_sound : CA4_4_8I1R0MassTermLog.Encloses (Real.log ((∑ a, CA4_4_8I1R0Value a))) := by + exact checkLog_sound logTwoBall_sound (CA4_4_8I1R0Mass_sound) (w := CA4_4_8I1R0MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA4_4_8I1R0MassTerm : Ball := ⟨(4760412769112588948014764417159 / 50000000000000000000000000000000), (483969577 / 12500000000000000000000000000000)⟩ +lemma CA4_4_8I1R0MassTerm_sound : CA4_4_8I1R0MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA4_4_8I1R0Value a))) := by + exact contains_sound (entropyTerm_ball (CA4_4_8I1R0Mass_sound) CA4_4_8I1R0MassTermLog_sound) (by decide +kernel) +def CA4_4_8I1R0H : Ball := ⟨0, (483969577 / 6250000000000000000000000000000)⟩ +lemma CA4_4_8I1R0H_sound : CA4_4_8I1R0H.Encloses (homogeneousEntropy CA4_4_8I1R0Value) := by + exact contains_sound (homogeneous_enclosed CA4_4_8I1R0Value CA4_4_8I1R0MassTerm_sound CA4_4_8I1R0Entropy_sound) (by decide +kernel) +def CA4_4_8I1R1Value (a : PairSlot) : ℝ := residualLaw (below (shape 4 4 8)) (fun u => (stageALaw (shape 4 4 8) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 1 a +def CA4_4_8I1R1Raw (a : PairSlot) : Ball := residualBall (below (shape 4 4 8)) A4_4_8Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 1 a +lemma CA4_4_8I1R1Raw_sound (a : PairSlot) : + (CA4_4_8I1R1Raw a).Encloses (CA4_4_8I1R1Value a) := by + exact residualBall_sound_on (below (shape 4 4 8)) A4_4_8Law (fun u => (stageALaw (shape 4 4 8) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A4_4_8Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 4 4 8) (show (shape 4 4 8) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 1 a +def CA4_4_8I1R1Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(11574631800747792340835551260257 / 100000000000000000000000000000000), (29 / 50000000000000000000000000000000)⟩ ⟨(4991801634033016332264529747017 / 20000000000000000000000000000000), (6127559147 / 50000000000000000000000000000000)⟩ ⟨(-215635439639233935368668825372491 / 100000000000000000000000000000000), (26469779729 / 25000000000000000000000000000000)⟩ ⟨-4, 11574631800747792340835551260257, 6250000000000000000000000000000⟩] +lemma CA4_4_8I1R1Certificates_valid : + CA4_4_8I1R1Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA4_4_8I1R1CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 1, 0 => 1 + | 0, 1 => 1 + | _, _ => 0 +def CA4_4_8I1R1P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA4_4_8I1R1Certificates (CA4_4_8I1R1CertificateIndex a)).input +lemma CA4_4_8I1R1P_check : ∀ a : PairSlot, contains (CA4_4_8I1R1Raw a) (CA4_4_8I1R1P a) = true := by + decide +kernel +lemma CA4_4_8I1R1P_sound (a : PairSlot) : + (CA4_4_8I1R1P a).Encloses (CA4_4_8I1R1Value a) := + contains_sound (CA4_4_8I1R1Raw_sound a) (CA4_4_8I1R1P_check a) +def CA4_4_8I1R1Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA4_4_8I1R1Certificates (CA4_4_8I1R1CertificateIndex a)).output +lemma CA4_4_8I1R1Terms_sound (a : PairSlot) : + (CA4_4_8I1R1Terms a).Encloses (Foundation.entropyTerm (CA4_4_8I1R1Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA4_4_8I1R1Certificates_valid + (CA4_4_8I1R1CertificateIndex a) (CA4_4_8I1R1P_sound a) +def CA4_4_8I1R1Entropy : Ball := ⟨(4991801634033016332264529747017 / 10000000000000000000000000000000), (6127559147 / 25000000000000000000000000000000)⟩ +lemma CA4_4_8I1R1Entropy_sound : CA4_4_8I1R1Entropy.Encloses (Foundation.finiteEntropy CA4_4_8I1R1Value) := by + exact contains_sound (entropyPair_enclosed CA4_4_8I1R1Value CA4_4_8I1R1Terms CA4_4_8I1R1Terms_sound) (by decide +kernel) +def CA4_4_8I1R1Mass : Ball := ⟨(11574631800747792340835551260257 / 50000000000000000000000000000000), (29 / 25000000000000000000000000000000)⟩ +lemma CA4_4_8I1R1Mass_sound : CA4_4_8I1R1Mass.Encloses (∑ a, CA4_4_8I1R1Value a) := by + exact contains_sound (pairSumBall_sound CA4_4_8I1R1P CA4_4_8I1R1Value CA4_4_8I1R1P_sound) (by decide +kernel) +def CA4_4_8I1R1MassTermLogWitness : LogWitness := ⟨-3, 11574631800747792340835551260257, 6250000000000000000000000000000⟩ +def CA4_4_8I1R1MassTermLog : Ball := ⟨(-146320721583239404426945632322161 / 100000000000000000000000000000000), (84703295233 / 100000000000000000000000000000000)⟩ +lemma CA4_4_8I1R1MassTermLog_sound : CA4_4_8I1R1MassTermLog.Encloses (Real.log ((∑ a, CA4_4_8I1R1Value a))) := by + exact checkLog_sound logTwoBall_sound (CA4_4_8I1R1Mass_sound) (w := CA4_4_8I1R1MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA4_4_8I1R1MassTerm : Ball := ⟨(4234021192864316680996658137711 / 12500000000000000000000000000000), (19608189263 / 100000000000000000000000000000000)⟩ +lemma CA4_4_8I1R1MassTerm_sound : CA4_4_8I1R1MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA4_4_8I1R1Value a))) := by + exact contains_sound (entropyTerm_ball (CA4_4_8I1R1Mass_sound) CA4_4_8I1R1MassTermLog_sound) (by decide +kernel) +def CA4_4_8I1R1H : Ball := ⟨(8022923398707814937336016184241 / 50000000000000000000000000000000), (44118425851 / 100000000000000000000000000000000)⟩ +lemma CA4_4_8I1R1H_sound : CA4_4_8I1R1H.Encloses (homogeneousEntropy CA4_4_8I1R1Value) := by + exact contains_sound (homogeneous_enclosed CA4_4_8I1R1Value CA4_4_8I1R1MassTerm_sound CA4_4_8I1R1Entropy_sound) (by decide +kernel) +def CA4_4_8I1R2Value (a : PairSlot) : ℝ := residualLaw (below (shape 4 4 8)) (fun u => (stageALaw (shape 4 4 8) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 2 a +def CA4_4_8I1R2Raw (a : PairSlot) : Ball := residualBall (below (shape 4 4 8)) A4_4_8Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 2 a +lemma CA4_4_8I1R2Raw_sound (a : PairSlot) : + (CA4_4_8I1R2Raw a).Encloses (CA4_4_8I1R2Value a) := by + exact residualBall_sound_on (below (shape 4 4 8)) A4_4_8Law (fun u => (stageALaw (shape 4 4 8) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A4_4_8Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 4 4 8) (show (shape 4 4 8) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 2 a +def CA4_4_8I1R2Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(8172083258664868309649495902139 / 100000000000000000000000000000000), (3 / 6250000000000000000000000000000)⟩ ⟨(20466543850431517495393125747353 / 100000000000000000000000000000000), (8652529879 / 100000000000000000000000000000000)⟩ ⟨(-250444632079963452857361644712163 / 100000000000000000000000000000000), (52939559501 / 50000000000000000000000000000000)⟩ ⟨-4, 8172083258664868309649495902139, 6250000000000000000000000000000⟩, + .log ⟨(760324628648145402297102760541 / 100000000000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ ⟨(1854880353174384488552949121649 / 50000000000000000000000000000000), (1449045061 / 100000000000000000000000000000000)⟩ ⟨(-97583599598626993472407258008041 / 20000000000000000000000000000000), (11911400871 / 6250000000000000000000000000000)⟩ ⟨-8, 760324628648145402297102760541, 390625000000000000000000000000⟩, + .log ⟨(15306349472305349949026148007973 / 50000000000000000000000000000000), (113 / 100000000000000000000000000000000)⟩ ⟨(9059485887333126540248566425779 / 25000000000000000000000000000000), (9723736853 / 50000000000000000000000000000000)⟩ ⟨(-29593881623194904978274358505653 / 25000000000000000000000000000000), (63527471417 / 100000000000000000000000000000000)⟩ ⟨-2, 15306349472305349949026148007973, 12500000000000000000000000000000⟩] +lemma CA4_4_8I1R2Certificates_valid : + CA4_4_8I1R2Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA4_4_8I1R2CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 2, 0 => 1 + | 3, 0 => 2 + | 1, 1 => 3 + | 0, 2 => 1 + | 0, 3 => 2 + | _, _ => 0 +def CA4_4_8I1R2P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA4_4_8I1R2Certificates (CA4_4_8I1R2CertificateIndex a)).input +lemma CA4_4_8I1R2P_check : ∀ a : PairSlot, contains (CA4_4_8I1R2Raw a) (CA4_4_8I1R2P a) = true := by + decide +kernel +lemma CA4_4_8I1R2P_sound (a : PairSlot) : + (CA4_4_8I1R2P a).Encloses (CA4_4_8I1R2Value a) := + contains_sound (CA4_4_8I1R2Raw_sound a) (CA4_4_8I1R2P_check a) +def CA4_4_8I1R2Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA4_4_8I1R2Certificates (CA4_4_8I1R2CertificateIndex a)).output +lemma CA4_4_8I1R2Terms_sound (a : PairSlot) : + (CA4_4_8I1R2Terms a).Encloses (Foundation.entropyTerm (CA4_4_8I1R2Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA4_4_8I1R2Certificates_valid + (CA4_4_8I1R2CertificateIndex a) (CA4_4_8I1R2P_sound a) +def CA4_4_8I1R2Entropy : Ball := ⟨(42295276331446539552996156842209 / 50000000000000000000000000000000), (19825311793 / 50000000000000000000000000000000)⟩ +lemma CA4_4_8I1R2Entropy_sound : CA4_4_8I1R2Entropy.Encloses (Foundation.finiteEntropy CA4_4_8I1R2Value) := by + exact contains_sound (entropyPair_enclosed CA4_4_8I1R2Value CA4_4_8I1R2Terms CA4_4_8I1R2Terms_sound) (by decide +kernel) +def CA4_4_8I1R2Mass : Ball := ⟨(24238757359618363660972746670653 / 50000000000000000000000000000000), (221 / 100000000000000000000000000000000)⟩ +lemma CA4_4_8I1R2Mass_sound : CA4_4_8I1R2Mass.Encloses (∑ a, CA4_4_8I1R2Value a) := by + exact contains_sound (pairSumBall_sound CA4_4_8I1R2P CA4_4_8I1R2Value CA4_4_8I1R2P_sound) (by decide +kernel) +def CA4_4_8I1R2MassTermLogWitness : LogWitness := ⟨-2, 24238757359618363660972746670653, 12500000000000000000000000000000⟩ +def CA4_4_8I1R2MassTermLog : Ball := ⟨(-7240701095832249874519106100029 / 10000000000000000000000000000000), (3970466969 / 6250000000000000000000000000000)⟩ +lemma CA4_4_8I1R2MassTermLog_sound : CA4_4_8I1R2MassTermLog.Encloses (Real.log ((∑ a, CA4_4_8I1R2Value a))) := by + exact checkLog_sound logTwoBall_sound (CA4_4_8I1R2Mass_sound) (w := CA4_4_8I1R2MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA4_4_8I1R2MassTerm : Ball := ⟨(35101119395080139462631003646157 / 100000000000000000000000000000000), (3079653951 / 10000000000000000000000000000000)⟩ +lemma CA4_4_8I1R2MassTerm_sound : CA4_4_8I1R2MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA4_4_8I1R2Value a))) := by + exact contains_sound (entropyTerm_ball (CA4_4_8I1R2Mass_sound) CA4_4_8I1R2MassTermLog_sound) (by decide +kernel) +def CA4_4_8I1R2H : Ball := ⟨(49489433267812939643361310038261 / 100000000000000000000000000000000), (8805895387 / 12500000000000000000000000000000)⟩ +lemma CA4_4_8I1R2H_sound : CA4_4_8I1R2H.Encloses (homogeneousEntropy CA4_4_8I1R2Value) := by + exact contains_sound (homogeneous_enclosed CA4_4_8I1R2Value CA4_4_8I1R2MassTerm_sound CA4_4_8I1R2Entropy_sound) (by decide +kernel) +def CA4_4_8I1R3Value (a : PairSlot) : ℝ := residualLaw (below (shape 4 4 8)) (fun u => (stageALaw (shape 4 4 8) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 3 a +def CA4_4_8I1R3Raw (a : PairSlot) : Ball := residualBall (below (shape 4 4 8)) A4_4_8Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 3 a +lemma CA4_4_8I1R3Raw_sound (a : PairSlot) : + (CA4_4_8I1R3Raw a).Encloses (CA4_4_8I1R3Value a) := by + exact residualBall_sound_on (below (shape 4 4 8)) A4_4_8Law (fun u => (stageALaw (shape 4 4 8) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A4_4_8Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 4 4 8) (show (shape 4 4 8) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 3 a +def CA4_4_8I1R3Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(324392125299166189238546053723 / 100000000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ ⟨(1859082322604415157920580847503 / 100000000000000000000000000000000), (686927073 / 100000000000000000000000000000000)⟩ ⟨(-143274310442177193657977806774283 / 25000000000000000000000000000000), (105879119031 / 50000000000000000000000000000000)⟩ ⟨-9, 324392125299166189238546053723, 195312500000000000000000000000⟩, + .log ⟨(5178381185616060007566540177167 / 50000000000000000000000000000000), (13 / 25000000000000000000000000000000)⟩ ⟨(23484274666024287494456489420227 / 100000000000000000000000000000000), (2193129773 / 20000000000000000000000000000000)⟩ ⟨(-113376525521413589059844798645137 / 50000000000000000000000000000000), (105879118917 / 100000000000000000000000000000000)⟩ ⟨-4, 5178381185616060007566540177167, 3125000000000000000000000000000⟩, + .log ⟨(4467386521082530682319624261 / 500000000000000000000000000000), (1 / 20000000000000000000000000000000)⟩ ⟨(843050254957558052476631302929 / 20000000000000000000000000000000), (756804729 / 50000000000000000000000000000000)⟩ ⟨(-471780453168215745817831792755017 / 100000000000000000000000000000000), (169406590023 / 100000000000000000000000000000000)⟩ ⟨-7, 4467386521082530682319624261, 3906250000000000000000000000⟩] +lemma CA4_4_8I1R3Certificates_valid : + CA4_4_8I1R3Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA4_4_8I1R3CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 4, 0 => 1 + | 2, 1 => 2 + | 3, 1 => 3 + | 1, 2 => 2 + | 1, 3 => 3 + | 0, 4 => 1 + | _, _ => 0 +def CA4_4_8I1R3P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA4_4_8I1R3Certificates (CA4_4_8I1R3CertificateIndex a)).input +lemma CA4_4_8I1R3P_check : ∀ a : PairSlot, contains (CA4_4_8I1R3Raw a) (CA4_4_8I1R3P a) = true := by + decide +kernel +lemma CA4_4_8I1R3P_sound (a : PairSlot) : + (CA4_4_8I1R3P a).Encloses (CA4_4_8I1R3Value a) := + contains_sound (CA4_4_8I1R3Raw_sound a) (CA4_4_8I1R3P_check a) +def CA4_4_8I1R3Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA4_4_8I1R3Certificates (CA4_4_8I1R3CertificateIndex a)).output +lemma CA4_4_8I1R3Terms_sound (a : PairSlot) : + (CA4_4_8I1R3Terms a).Encloses (Foundation.entropyTerm (CA4_4_8I1R3Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA4_4_8I1R3Certificates_valid + (CA4_4_8I1R3CertificateIndex a) (CA4_4_8I1R3P_sound a) +def CA4_4_8I1R3Entropy : Ball := ⟨(236468866107331943318081814259 / 400000000000000000000000000000), (3291546349 / 12500000000000000000000000000000)⟩ +lemma CA4_4_8I1R3Entropy_sound : CA4_4_8I1R3Entropy.Encloses (Foundation.finiteEntropy CA4_4_8I1R3Value) := by + exact contains_sound (entropyPair_enclosed CA4_4_8I1R3Value CA4_4_8I1R3Terms CA4_4_8I1R3Terms_sound) (by decide +kernel) +def CA4_4_8I1R3Mass : Ball := ⟨(11574631800747792340835551260257 / 50000000000000000000000000000000), (61 / 50000000000000000000000000000000)⟩ +lemma CA4_4_8I1R3Mass_sound : CA4_4_8I1R3Mass.Encloses (∑ a, CA4_4_8I1R3Value a) := by + exact contains_sound (pairSumBall_sound CA4_4_8I1R3P CA4_4_8I1R3Value CA4_4_8I1R3P_sound) (by decide +kernel) +def CA4_4_8I1R3MassTermLogWitness : LogWitness := ⟨-3, 11574631800747792340835551260257, 6250000000000000000000000000000⟩ +def CA4_4_8I1R3MassTermLog : Ball := ⟨(-146320721583239404426945632322161 / 100000000000000000000000000000000), (84703295259 / 100000000000000000000000000000000)⟩ +lemma CA4_4_8I1R3MassTermLog_sound : CA4_4_8I1R3MassTermLog.Encloses (Real.log ((∑ a, CA4_4_8I1R3Value a))) := by + exact checkLog_sound logTwoBall_sound (CA4_4_8I1R3Mass_sound) (w := CA4_4_8I1R3MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA4_4_8I1R3MassTerm : Ball := ⟨(4234021192864316680996658137711 / 12500000000000000000000000000000), (9804094639 / 50000000000000000000000000000000)⟩ +lemma CA4_4_8I1R3MassTerm_sound : CA4_4_8I1R3MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA4_4_8I1R3Value a))) := by + exact contains_sound (entropyTerm_ball (CA4_4_8I1R3Mass_sound) CA4_4_8I1R3MassTermLog_sound) (by decide +kernel) +def CA4_4_8I1R3H : Ball := ⟨(12622523491959226190773594231531 / 50000000000000000000000000000000), (4594056007 / 10000000000000000000000000000000)⟩ +lemma CA4_4_8I1R3H_sound : CA4_4_8I1R3H.Encloses (homogeneousEntropy CA4_4_8I1R3Value) := by + exact contains_sound (homogeneous_enclosed CA4_4_8I1R3Value CA4_4_8I1R3MassTerm_sound CA4_4_8I1R3Entropy_sound) (by decide +kernel) +def CA4_4_8I1R4Value (a : PairSlot) : ℝ := residualLaw (below (shape 4 4 8)) (fun u => (stageALaw (shape 4 4 8) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 4 a +def CA4_4_8I1R4Raw (a : PairSlot) : Ball := residualBall (below (shape 4 4 8)) A4_4_8Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 4 a +lemma CA4_4_8I1R4Raw_sound (a : PairSlot) : + (CA4_4_8I1R4Raw a).Encloses (CA4_4_8I1R4Value a) := by + exact residualBall_sound_on (below (shape 4 4 8)) A4_4_8Law (fun u => (stageALaw (shape 4 4 8) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A4_4_8Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 4 4 8) (show (shape 4 4 8) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 4 a +def CA4_4_8I1R4Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(314421671024778164888076367 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(2663907226045848723925104267 / 10000000000000000000000000000000), (226377 / 2500000000000000000000000000000)⟩ ⟨(-1059050421589705769739076007325759 / 100000000000000000000000000000000), (179994521183 / 50000000000000000000000000000000)⟩ ⟨-16, 314421671024778164888076367, 190734863281250000000000000⟩, + .log ⟨(25607305640862147463658339143 / 10000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ ⟨(1528106408651620834127544871883 / 100000000000000000000000000000000), (542255811 / 100000000000000000000000000000000)⟩ ⟨(-596746268460664378568900799927563 / 100000000000000000000000000000000), (211758238001 / 100000000000000000000000000000000)⟩ ⟨-9, 25607305640862147463658339143, 19531250000000000000000000000⟩, + .log ⟨(1827988448269525491278423848813 / 100000000000000000000000000000000), (3 / 20000000000000000000000000000000)⟩ ⟨(7315525741556433013150138476611 / 100000000000000000000000000000000), (2709641351 / 100000000000000000000000000000000)⟩ ⟨(-200097701615174659640952779378689 / 50000000000000000000000000000000), (148230766601 / 100000000000000000000000000000000)⟩ ⟨-6, 1827988448269525491278423848813, 1562500000000000000000000000000⟩, + .log ⟨(129313644566804189993550425661 / 100000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ ⟨(860024272033770063379074775041 / 100000000000000000000000000000000), (301215539 / 100000000000000000000000000000000)⟩ ⟨(-332534232916726920443613076237221 / 50000000000000000000000000000000), (232934062059 / 100000000000000000000000000000000)⟩ ⟨-10, 129313644566804189993550425661, 97656250000000000000000000000⟩, + .log ⟨(8180370728321901785755684313 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(38493503392719760282224224857 / 50000000000000000000000000000000), (6495981 / 25000000000000000000000000000000)⟩ ⟨(-941118799407180636802482562160497 / 100000000000000000000000000000000), (317637367469 / 100000000000000000000000000000000)⟩ ⟨-14, 8180370728321901785755684313, 6103515625000000000000000000⟩] +lemma CA4_4_8I1R4Certificates_valid : + CA4_4_8I1R4Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA4_4_8I1R4CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 0, 5 => 1 + | 1, 4 => 2 + | 2, 2 => 3 + | 2, 3 => 4 + | 3, 2 => 4 + | 3, 3 => 5 + | 4, 1 => 2 + | 5, 0 => 1 + | _, _ => 0 +def CA4_4_8I1R4P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA4_4_8I1R4Certificates (CA4_4_8I1R4CertificateIndex a)).input +lemma CA4_4_8I1R4P_check : ∀ a : PairSlot, contains (CA4_4_8I1R4Raw a) (CA4_4_8I1R4P a) = true := by + decide +kernel +lemma CA4_4_8I1R4P_sound (a : PairSlot) : + (CA4_4_8I1R4P a).Encloses (CA4_4_8I1R4Value a) := + contains_sound (CA4_4_8I1R4Raw_sound a) (CA4_4_8I1R4P_check a) +def CA4_4_8I1R4Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA4_4_8I1R4Certificates (CA4_4_8I1R4CertificateIndex a)).output +lemma CA4_4_8I1R4Terms_sound (a : PairSlot) : + (CA4_4_8I1R4Terms a).Encloses (Foundation.entropyTerm (CA4_4_8I1R4Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA4_4_8I1R4Certificates_valid + (CA4_4_8I1R4CertificateIndex a) (CA4_4_8I1R4P_sound a) +def CA4_4_8I1R4Entropy : Ball := ⟨(12222052254233571303206328305513 / 100000000000000000000000000000000), (888135627 / 20000000000000000000000000000000)⟩ +lemma CA4_4_8I1R4Entropy_sound : CA4_4_8I1R4Entropy.Encloses (Foundation.finiteEntropy CA4_4_8I1R4Value) := by + exact contains_sound (entropyPair_enclosed CA4_4_8I1R4Value CA4_4_8I1R4Terms CA4_4_8I1R4Terms_sound) (by decide +kernel) +def CA4_4_8I1R4Mass : Ball := ⟨(130598648384254758648132819459 / 5000000000000000000000000000000), (7 / 25000000000000000000000000000000)⟩ +lemma CA4_4_8I1R4Mass_sound : CA4_4_8I1R4Mass.Encloses (∑ a, CA4_4_8I1R4Value a) := by + exact contains_sound (pairSumBall_sound CA4_4_8I1R4P CA4_4_8I1R4Value CA4_4_8I1R4P_sound) (by decide +kernel) +def CA4_4_8I1R4MassTermLogWitness : LogWitness := ⟨-6, 130598648384254758648132819459, 78125000000000000000000000000⟩ +def CA4_4_8I1R4MassTermLog : Ball := ⟨(-91126608097643880853565541221611 / 25000000000000000000000000000000), (148230766853 / 100000000000000000000000000000000)⟩ +lemma CA4_4_8I1R4MassTermLog_sound : CA4_4_8I1R4MassTermLog.Encloses (Real.log ((∑ a, CA4_4_8I1R4Value a))) := by + exact checkLog_sound logTwoBall_sound (CA4_4_8I1R4Mass_sound) (w := CA4_4_8I1R4MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA4_4_8I1R4MassTerm : Ball := ⟨(148762648117424695324148511307 / 1562500000000000000000000000000), (3871747663 / 100000000000000000000000000000000)⟩ +lemma CA4_4_8I1R4MassTerm_sound : CA4_4_8I1R4MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA4_4_8I1R4Value a))) := by + exact contains_sound (entropyTerm_ball (CA4_4_8I1R4Mass_sound) CA4_4_8I1R4MassTermLog_sound) (by decide +kernel) +def CA4_4_8I1R4H : Ball := ⟨(540248554943678160492164716373 / 20000000000000000000000000000000), (4156212899 / 50000000000000000000000000000000)⟩ +lemma CA4_4_8I1R4H_sound : CA4_4_8I1R4H.Encloses (homogeneousEntropy CA4_4_8I1R4Value) := by + exact contains_sound (homogeneous_enclosed CA4_4_8I1R4Value CA4_4_8I1R4MassTerm_sound CA4_4_8I1R4Entropy_sound) (by decide +kernel) +def CA4_4_8I1R5Value (a : PairSlot) : ℝ := residualLaw (below (shape 4 4 8)) (fun u => (stageALaw (shape 4 4 8) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 5 a +def CA4_4_8I1R5Raw (a : PairSlot) : Ball := residualBall (below (shape 4 4 8)) A4_4_8Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 5 a +lemma CA4_4_8I1R5Raw_sound (a : PairSlot) : + (CA4_4_8I1R5Raw a).Encloses (CA4_4_8I1R5Value a) := by + exact residualBall_sound_on (below (shape 4 4 8)) A4_4_8Law (fun u => (stageALaw (shape 4 4 8) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A4_4_8Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 4 4 8) (show (shape 4 4 8) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 5 a +def CA4_4_8I1R5Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA4_4_8I1R5Certificates_valid : + CA4_4_8I1R5Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA4_4_8I1R5CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA4_4_8I1R5P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA4_4_8I1R5Certificates (CA4_4_8I1R5CertificateIndex a)).input +lemma CA4_4_8I1R5P_check : ∀ a : PairSlot, contains (CA4_4_8I1R5Raw a) (CA4_4_8I1R5P a) = true := by + decide +kernel +lemma CA4_4_8I1R5P_sound (a : PairSlot) : + (CA4_4_8I1R5P a).Encloses (CA4_4_8I1R5Value a) := + contains_sound (CA4_4_8I1R5Raw_sound a) (CA4_4_8I1R5P_check a) +def CA4_4_8I1R5Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA4_4_8I1R5Certificates (CA4_4_8I1R5CertificateIndex a)).output +lemma CA4_4_8I1R5Terms_sound (a : PairSlot) : + (CA4_4_8I1R5Terms a).Encloses (Foundation.entropyTerm (CA4_4_8I1R5Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA4_4_8I1R5Certificates_valid + (CA4_4_8I1R5CertificateIndex a) (CA4_4_8I1R5P_sound a) +def CA4_4_8I1R5Entropy : Ball := ⟨0, 0⟩ +lemma CA4_4_8I1R5Entropy_sound : CA4_4_8I1R5Entropy.Encloses (Foundation.finiteEntropy CA4_4_8I1R5Value) := by + exact contains_sound (entropyPair_enclosed CA4_4_8I1R5Value CA4_4_8I1R5Terms CA4_4_8I1R5Terms_sound) (by decide +kernel) +def CA4_4_8I1R5Mass : Ball := ⟨0, 0⟩ +lemma CA4_4_8I1R5Mass_sound : CA4_4_8I1R5Mass.Encloses (∑ a, CA4_4_8I1R5Value a) := by + exact contains_sound (pairSumBall_sound CA4_4_8I1R5P CA4_4_8I1R5Value CA4_4_8I1R5P_sound) (by decide +kernel) +def CA4_4_8I1R5MassTerm : Ball := .exact 0 +lemma CA4_4_8I1R5MassTerm_sound : CA4_4_8I1R5MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA4_4_8I1R5Value a))) := + entropyTerm_zero_ball (CA4_4_8I1R5Mass_sound) +def CA4_4_8I1R5H : Ball := ⟨0, 0⟩ +lemma CA4_4_8I1R5H_sound : CA4_4_8I1R5H.Encloses (homogeneousEntropy CA4_4_8I1R5Value) := by + exact contains_sound (homogeneous_enclosed CA4_4_8I1R5Value CA4_4_8I1R5MassTerm_sound CA4_4_8I1R5Entropy_sound) (by decide +kernel) +def CA4_4_8I1R6Value (a : PairSlot) : ℝ := residualLaw (below (shape 4 4 8)) (fun u => (stageALaw (shape 4 4 8) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 6 a +def CA4_4_8I1R6Raw (a : PairSlot) : Ball := residualBall (below (shape 4 4 8)) A4_4_8Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 6 a +lemma CA4_4_8I1R6Raw_sound (a : PairSlot) : + (CA4_4_8I1R6Raw a).Encloses (CA4_4_8I1R6Value a) := by + exact residualBall_sound_on (below (shape 4 4 8)) A4_4_8Law (fun u => (stageALaw (shape 4 4 8) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A4_4_8Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 4 4 8) (show (shape 4 4 8) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 6 a +def CA4_4_8I1R6Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA4_4_8I1R6Certificates_valid : + CA4_4_8I1R6Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA4_4_8I1R6CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA4_4_8I1R6P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA4_4_8I1R6Certificates (CA4_4_8I1R6CertificateIndex a)).input +lemma CA4_4_8I1R6P_check : ∀ a : PairSlot, contains (CA4_4_8I1R6Raw a) (CA4_4_8I1R6P a) = true := by + decide +kernel +lemma CA4_4_8I1R6P_sound (a : PairSlot) : + (CA4_4_8I1R6P a).Encloses (CA4_4_8I1R6Value a) := + contains_sound (CA4_4_8I1R6Raw_sound a) (CA4_4_8I1R6P_check a) +def CA4_4_8I1R6Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA4_4_8I1R6Certificates (CA4_4_8I1R6CertificateIndex a)).output +lemma CA4_4_8I1R6Terms_sound (a : PairSlot) : + (CA4_4_8I1R6Terms a).Encloses (Foundation.entropyTerm (CA4_4_8I1R6Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA4_4_8I1R6Certificates_valid + (CA4_4_8I1R6CertificateIndex a) (CA4_4_8I1R6P_sound a) +def CA4_4_8I1R6Entropy : Ball := ⟨0, 0⟩ +lemma CA4_4_8I1R6Entropy_sound : CA4_4_8I1R6Entropy.Encloses (Foundation.finiteEntropy CA4_4_8I1R6Value) := by + exact contains_sound (entropyPair_enclosed CA4_4_8I1R6Value CA4_4_8I1R6Terms CA4_4_8I1R6Terms_sound) (by decide +kernel) +def CA4_4_8I1R6Mass : Ball := ⟨0, 0⟩ +lemma CA4_4_8I1R6Mass_sound : CA4_4_8I1R6Mass.Encloses (∑ a, CA4_4_8I1R6Value a) := by + exact contains_sound (pairSumBall_sound CA4_4_8I1R6P CA4_4_8I1R6Value CA4_4_8I1R6P_sound) (by decide +kernel) +def CA4_4_8I1R6MassTerm : Ball := .exact 0 +lemma CA4_4_8I1R6MassTerm_sound : CA4_4_8I1R6MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA4_4_8I1R6Value a))) := + entropyTerm_zero_ball (CA4_4_8I1R6Mass_sound) +def CA4_4_8I1R6H : Ball := ⟨0, 0⟩ +lemma CA4_4_8I1R6H_sound : CA4_4_8I1R6H.Encloses (homogeneousEntropy CA4_4_8I1R6Value) := by + exact contains_sound (homogeneous_enclosed CA4_4_8I1R6Value CA4_4_8I1R6MassTerm_sound CA4_4_8I1R6Entropy_sound) (by decide +kernel) +def CA4_4_8I1R7Value (a : PairSlot) : ℝ := residualLaw (below (shape 4 4 8)) (fun u => (stageALaw (shape 4 4 8) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 7 a +def CA4_4_8I1R7Raw (a : PairSlot) : Ball := residualBall (below (shape 4 4 8)) A4_4_8Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 7 a +lemma CA4_4_8I1R7Raw_sound (a : PairSlot) : + (CA4_4_8I1R7Raw a).Encloses (CA4_4_8I1R7Value a) := by + exact residualBall_sound_on (below (shape 4 4 8)) A4_4_8Law (fun u => (stageALaw (shape 4 4 8) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A4_4_8Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 4 4 8) (show (shape 4 4 8) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 7 a +def CA4_4_8I1R7Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA4_4_8I1R7Certificates_valid : + CA4_4_8I1R7Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA4_4_8I1R7CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA4_4_8I1R7P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA4_4_8I1R7Certificates (CA4_4_8I1R7CertificateIndex a)).input +lemma CA4_4_8I1R7P_check : ∀ a : PairSlot, contains (CA4_4_8I1R7Raw a) (CA4_4_8I1R7P a) = true := by + decide +kernel +lemma CA4_4_8I1R7P_sound (a : PairSlot) : + (CA4_4_8I1R7P a).Encloses (CA4_4_8I1R7Value a) := + contains_sound (CA4_4_8I1R7Raw_sound a) (CA4_4_8I1R7P_check a) +def CA4_4_8I1R7Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA4_4_8I1R7Certificates (CA4_4_8I1R7CertificateIndex a)).output +lemma CA4_4_8I1R7Terms_sound (a : PairSlot) : + (CA4_4_8I1R7Terms a).Encloses (Foundation.entropyTerm (CA4_4_8I1R7Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA4_4_8I1R7Certificates_valid + (CA4_4_8I1R7CertificateIndex a) (CA4_4_8I1R7P_sound a) +def CA4_4_8I1R7Entropy : Ball := ⟨0, 0⟩ +lemma CA4_4_8I1R7Entropy_sound : CA4_4_8I1R7Entropy.Encloses (Foundation.finiteEntropy CA4_4_8I1R7Value) := by + exact contains_sound (entropyPair_enclosed CA4_4_8I1R7Value CA4_4_8I1R7Terms CA4_4_8I1R7Terms_sound) (by decide +kernel) +def CA4_4_8I1R7Mass : Ball := ⟨0, 0⟩ +lemma CA4_4_8I1R7Mass_sound : CA4_4_8I1R7Mass.Encloses (∑ a, CA4_4_8I1R7Value a) := by + exact contains_sound (pairSumBall_sound CA4_4_8I1R7P CA4_4_8I1R7Value CA4_4_8I1R7P_sound) (by decide +kernel) +def CA4_4_8I1R7MassTerm : Ball := .exact 0 +lemma CA4_4_8I1R7MassTerm_sound : CA4_4_8I1R7MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA4_4_8I1R7Value a))) := + entropyTerm_zero_ball (CA4_4_8I1R7Mass_sound) +def CA4_4_8I1R7H : Ball := ⟨0, 0⟩ +lemma CA4_4_8I1R7H_sound : CA4_4_8I1R7H.Encloses (homogeneousEntropy CA4_4_8I1R7Value) := by + exact contains_sound (homogeneous_enclosed CA4_4_8I1R7Value CA4_4_8I1R7MassTerm_sound CA4_4_8I1R7Entropy_sound) (by decide +kernel) +def CA4_4_8I1R8Value (a : PairSlot) : ℝ := residualLaw (below (shape 4 4 8)) (fun u => (stageALaw (shape 4 4 8) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 8 a +def CA4_4_8I1R8Raw (a : PairSlot) : Ball := residualBall (below (shape 4 4 8)) A4_4_8Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 8 a +lemma CA4_4_8I1R8Raw_sound (a : PairSlot) : + (CA4_4_8I1R8Raw a).Encloses (CA4_4_8I1R8Value a) := by + exact residualBall_sound_on (below (shape 4 4 8)) A4_4_8Law (fun u => (stageALaw (shape 4 4 8) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A4_4_8Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 4 4 8) (show (shape 4 4 8) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 8 a +def CA4_4_8I1R8Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA4_4_8I1R8Certificates_valid : + CA4_4_8I1R8Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA4_4_8I1R8CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA4_4_8I1R8P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA4_4_8I1R8Certificates (CA4_4_8I1R8CertificateIndex a)).input +lemma CA4_4_8I1R8P_check : ∀ a : PairSlot, contains (CA4_4_8I1R8Raw a) (CA4_4_8I1R8P a) = true := by + decide +kernel +lemma CA4_4_8I1R8P_sound (a : PairSlot) : + (CA4_4_8I1R8P a).Encloses (CA4_4_8I1R8Value a) := + contains_sound (CA4_4_8I1R8Raw_sound a) (CA4_4_8I1R8P_check a) +def CA4_4_8I1R8Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA4_4_8I1R8Certificates (CA4_4_8I1R8CertificateIndex a)).output +lemma CA4_4_8I1R8Terms_sound (a : PairSlot) : + (CA4_4_8I1R8Terms a).Encloses (Foundation.entropyTerm (CA4_4_8I1R8Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA4_4_8I1R8Certificates_valid + (CA4_4_8I1R8CertificateIndex a) (CA4_4_8I1R8P_sound a) +def CA4_4_8I1R8Entropy : Ball := ⟨0, 0⟩ +lemma CA4_4_8I1R8Entropy_sound : CA4_4_8I1R8Entropy.Encloses (Foundation.finiteEntropy CA4_4_8I1R8Value) := by + exact contains_sound (entropyPair_enclosed CA4_4_8I1R8Value CA4_4_8I1R8Terms CA4_4_8I1R8Terms_sound) (by decide +kernel) +def CA4_4_8I1R8Mass : Ball := ⟨0, 0⟩ +lemma CA4_4_8I1R8Mass_sound : CA4_4_8I1R8Mass.Encloses (∑ a, CA4_4_8I1R8Value a) := by + exact contains_sound (pairSumBall_sound CA4_4_8I1R8P CA4_4_8I1R8Value CA4_4_8I1R8P_sound) (by decide +kernel) +def CA4_4_8I1R8MassTerm : Ball := .exact 0 +lemma CA4_4_8I1R8MassTerm_sound : CA4_4_8I1R8MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA4_4_8I1R8Value a))) := + entropyTerm_zero_ball (CA4_4_8I1R8Mass_sound) +def CA4_4_8I1R8H : Ball := ⟨0, 0⟩ +lemma CA4_4_8I1R8H_sound : CA4_4_8I1R8H.Encloses (homogeneousEntropy CA4_4_8I1R8Value) := by + exact contains_sound (homogeneous_enclosed CA4_4_8I1R8Value CA4_4_8I1R8MassTerm_sound CA4_4_8I1R8Entropy_sound) (by decide +kernel) +def CA4_4_8I1R9Value (a : PairSlot) : ℝ := residualLaw (below (shape 4 4 8)) (fun u => (stageALaw (shape 4 4 8) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 9 a +def CA4_4_8I1R9Raw (a : PairSlot) : Ball := residualBall (below (shape 4 4 8)) A4_4_8Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 9 a +lemma CA4_4_8I1R9Raw_sound (a : PairSlot) : + (CA4_4_8I1R9Raw a).Encloses (CA4_4_8I1R9Value a) := by + exact residualBall_sound_on (below (shape 4 4 8)) A4_4_8Law (fun u => (stageALaw (shape 4 4 8) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A4_4_8Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 4 4 8) (show (shape 4 4 8) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 9 a +def CA4_4_8I1R9Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA4_4_8I1R9Certificates_valid : + CA4_4_8I1R9Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA4_4_8I1R9CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA4_4_8I1R9P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA4_4_8I1R9Certificates (CA4_4_8I1R9CertificateIndex a)).input +lemma CA4_4_8I1R9P_check : ∀ a : PairSlot, contains (CA4_4_8I1R9Raw a) (CA4_4_8I1R9P a) = true := by + decide +kernel +lemma CA4_4_8I1R9P_sound (a : PairSlot) : + (CA4_4_8I1R9P a).Encloses (CA4_4_8I1R9Value a) := + contains_sound (CA4_4_8I1R9Raw_sound a) (CA4_4_8I1R9P_check a) +def CA4_4_8I1R9Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA4_4_8I1R9Certificates (CA4_4_8I1R9CertificateIndex a)).output +lemma CA4_4_8I1R9Terms_sound (a : PairSlot) : + (CA4_4_8I1R9Terms a).Encloses (Foundation.entropyTerm (CA4_4_8I1R9Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA4_4_8I1R9Certificates_valid + (CA4_4_8I1R9CertificateIndex a) (CA4_4_8I1R9P_sound a) +def CA4_4_8I1R9Entropy : Ball := ⟨0, 0⟩ +lemma CA4_4_8I1R9Entropy_sound : CA4_4_8I1R9Entropy.Encloses (Foundation.finiteEntropy CA4_4_8I1R9Value) := by + exact contains_sound (entropyPair_enclosed CA4_4_8I1R9Value CA4_4_8I1R9Terms CA4_4_8I1R9Terms_sound) (by decide +kernel) +def CA4_4_8I1R9Mass : Ball := ⟨0, 0⟩ +lemma CA4_4_8I1R9Mass_sound : CA4_4_8I1R9Mass.Encloses (∑ a, CA4_4_8I1R9Value a) := by + exact contains_sound (pairSumBall_sound CA4_4_8I1R9P CA4_4_8I1R9Value CA4_4_8I1R9P_sound) (by decide +kernel) +def CA4_4_8I1R9MassTerm : Ball := .exact 0 +lemma CA4_4_8I1R9MassTerm_sound : CA4_4_8I1R9MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA4_4_8I1R9Value a))) := + entropyTerm_zero_ball (CA4_4_8I1R9Mass_sound) +def CA4_4_8I1R9H : Ball := ⟨0, 0⟩ +lemma CA4_4_8I1R9H_sound : CA4_4_8I1R9H.Encloses (homogeneousEntropy CA4_4_8I1R9Value) := by + exact contains_sound (homogeneous_enclosed CA4_4_8I1R9Value CA4_4_8I1R9MassTerm_sound CA4_4_8I1R9Entropy_sound) (by decide +kernel) +def CA4_4_8I1R10Value (a : PairSlot) : ℝ := residualLaw (below (shape 4 4 8)) (fun u => (stageALaw (shape 4 4 8) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 10 a +def CA4_4_8I1R10Raw (a : PairSlot) : Ball := residualBall (below (shape 4 4 8)) A4_4_8Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 10 a +lemma CA4_4_8I1R10Raw_sound (a : PairSlot) : + (CA4_4_8I1R10Raw a).Encloses (CA4_4_8I1R10Value a) := by + exact residualBall_sound_on (below (shape 4 4 8)) A4_4_8Law (fun u => (stageALaw (shape 4 4 8) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A4_4_8Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 4 4 8) (show (shape 4 4 8) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 10 a +def CA4_4_8I1R10Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA4_4_8I1R10Certificates_valid : + CA4_4_8I1R10Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA4_4_8I1R10CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA4_4_8I1R10P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA4_4_8I1R10Certificates (CA4_4_8I1R10CertificateIndex a)).input +lemma CA4_4_8I1R10P_check : ∀ a : PairSlot, contains (CA4_4_8I1R10Raw a) (CA4_4_8I1R10P a) = true := by + decide +kernel +lemma CA4_4_8I1R10P_sound (a : PairSlot) : + (CA4_4_8I1R10P a).Encloses (CA4_4_8I1R10Value a) := + contains_sound (CA4_4_8I1R10Raw_sound a) (CA4_4_8I1R10P_check a) +def CA4_4_8I1R10Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA4_4_8I1R10Certificates (CA4_4_8I1R10CertificateIndex a)).output +lemma CA4_4_8I1R10Terms_sound (a : PairSlot) : + (CA4_4_8I1R10Terms a).Encloses (Foundation.entropyTerm (CA4_4_8I1R10Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA4_4_8I1R10Certificates_valid + (CA4_4_8I1R10CertificateIndex a) (CA4_4_8I1R10P_sound a) +def CA4_4_8I1R10Entropy : Ball := ⟨0, 0⟩ +lemma CA4_4_8I1R10Entropy_sound : CA4_4_8I1R10Entropy.Encloses (Foundation.finiteEntropy CA4_4_8I1R10Value) := by + exact contains_sound (entropyPair_enclosed CA4_4_8I1R10Value CA4_4_8I1R10Terms CA4_4_8I1R10Terms_sound) (by decide +kernel) +def CA4_4_8I1R10Mass : Ball := ⟨0, 0⟩ +lemma CA4_4_8I1R10Mass_sound : CA4_4_8I1R10Mass.Encloses (∑ a, CA4_4_8I1R10Value a) := by + exact contains_sound (pairSumBall_sound CA4_4_8I1R10P CA4_4_8I1R10Value CA4_4_8I1R10P_sound) (by decide +kernel) +def CA4_4_8I1R10MassTerm : Ball := .exact 0 +lemma CA4_4_8I1R10MassTerm_sound : CA4_4_8I1R10MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA4_4_8I1R10Value a))) := + entropyTerm_zero_ball (CA4_4_8I1R10Mass_sound) +def CA4_4_8I1R10H : Ball := ⟨0, 0⟩ +lemma CA4_4_8I1R10H_sound : CA4_4_8I1R10H.Encloses (homogeneousEntropy CA4_4_8I1R10Value) := by + exact contains_sound (homogeneous_enclosed CA4_4_8I1R10Value CA4_4_8I1R10MassTerm_sound CA4_4_8I1R10Entropy_sound) (by decide +kernel) +def CA4_4_8I1R11Value (a : PairSlot) : ℝ := residualLaw (below (shape 4 4 8)) (fun u => (stageALaw (shape 4 4 8) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 11 a +def CA4_4_8I1R11Raw (a : PairSlot) : Ball := residualBall (below (shape 4 4 8)) A4_4_8Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 11 a +lemma CA4_4_8I1R11Raw_sound (a : PairSlot) : + (CA4_4_8I1R11Raw a).Encloses (CA4_4_8I1R11Value a) := by + exact residualBall_sound_on (below (shape 4 4 8)) A4_4_8Law (fun u => (stageALaw (shape 4 4 8) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A4_4_8Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 4 4 8) (show (shape 4 4 8) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 11 a +def CA4_4_8I1R11Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA4_4_8I1R11Certificates_valid : + CA4_4_8I1R11Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA4_4_8I1R11CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA4_4_8I1R11P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA4_4_8I1R11Certificates (CA4_4_8I1R11CertificateIndex a)).input +lemma CA4_4_8I1R11P_check : ∀ a : PairSlot, contains (CA4_4_8I1R11Raw a) (CA4_4_8I1R11P a) = true := by + decide +kernel +lemma CA4_4_8I1R11P_sound (a : PairSlot) : + (CA4_4_8I1R11P a).Encloses (CA4_4_8I1R11Value a) := + contains_sound (CA4_4_8I1R11Raw_sound a) (CA4_4_8I1R11P_check a) +def CA4_4_8I1R11Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA4_4_8I1R11Certificates (CA4_4_8I1R11CertificateIndex a)).output +lemma CA4_4_8I1R11Terms_sound (a : PairSlot) : + (CA4_4_8I1R11Terms a).Encloses (Foundation.entropyTerm (CA4_4_8I1R11Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA4_4_8I1R11Certificates_valid + (CA4_4_8I1R11CertificateIndex a) (CA4_4_8I1R11P_sound a) +def CA4_4_8I1R11Entropy : Ball := ⟨0, 0⟩ +lemma CA4_4_8I1R11Entropy_sound : CA4_4_8I1R11Entropy.Encloses (Foundation.finiteEntropy CA4_4_8I1R11Value) := by + exact contains_sound (entropyPair_enclosed CA4_4_8I1R11Value CA4_4_8I1R11Terms CA4_4_8I1R11Terms_sound) (by decide +kernel) +def CA4_4_8I1R11Mass : Ball := ⟨0, 0⟩ +lemma CA4_4_8I1R11Mass_sound : CA4_4_8I1R11Mass.Encloses (∑ a, CA4_4_8I1R11Value a) := by + exact contains_sound (pairSumBall_sound CA4_4_8I1R11P CA4_4_8I1R11Value CA4_4_8I1R11P_sound) (by decide +kernel) +def CA4_4_8I1R11MassTerm : Ball := .exact 0 +lemma CA4_4_8I1R11MassTerm_sound : CA4_4_8I1R11MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA4_4_8I1R11Value a))) := + entropyTerm_zero_ball (CA4_4_8I1R11Mass_sound) +def CA4_4_8I1R11H : Ball := ⟨0, 0⟩ +lemma CA4_4_8I1R11H_sound : CA4_4_8I1R11H.Encloses (homogeneousEntropy CA4_4_8I1R11Value) := by + exact contains_sound (homogeneous_enclosed CA4_4_8I1R11Value CA4_4_8I1R11MassTerm_sound CA4_4_8I1R11Entropy_sound) (by decide +kernel) +def CA4_4_8I1R12Value (a : PairSlot) : ℝ := residualLaw (below (shape 4 4 8)) (fun u => (stageALaw (shape 4 4 8) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 12 a +def CA4_4_8I1R12Raw (a : PairSlot) : Ball := residualBall (below (shape 4 4 8)) A4_4_8Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 12 a +lemma CA4_4_8I1R12Raw_sound (a : PairSlot) : + (CA4_4_8I1R12Raw a).Encloses (CA4_4_8I1R12Value a) := by + exact residualBall_sound_on (below (shape 4 4 8)) A4_4_8Law (fun u => (stageALaw (shape 4 4 8) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A4_4_8Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 4 4 8) (show (shape 4 4 8) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 12 a +def CA4_4_8I1R12Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA4_4_8I1R12Certificates_valid : + CA4_4_8I1R12Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA4_4_8I1R12CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA4_4_8I1R12P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA4_4_8I1R12Certificates (CA4_4_8I1R12CertificateIndex a)).input +lemma CA4_4_8I1R12P_check : ∀ a : PairSlot, contains (CA4_4_8I1R12Raw a) (CA4_4_8I1R12P a) = true := by + decide +kernel +lemma CA4_4_8I1R12P_sound (a : PairSlot) : + (CA4_4_8I1R12P a).Encloses (CA4_4_8I1R12Value a) := + contains_sound (CA4_4_8I1R12Raw_sound a) (CA4_4_8I1R12P_check a) +def CA4_4_8I1R12Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA4_4_8I1R12Certificates (CA4_4_8I1R12CertificateIndex a)).output +lemma CA4_4_8I1R12Terms_sound (a : PairSlot) : + (CA4_4_8I1R12Terms a).Encloses (Foundation.entropyTerm (CA4_4_8I1R12Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA4_4_8I1R12Certificates_valid + (CA4_4_8I1R12CertificateIndex a) (CA4_4_8I1R12P_sound a) +def CA4_4_8I1R12Entropy : Ball := ⟨0, 0⟩ +lemma CA4_4_8I1R12Entropy_sound : CA4_4_8I1R12Entropy.Encloses (Foundation.finiteEntropy CA4_4_8I1R12Value) := by + exact contains_sound (entropyPair_enclosed CA4_4_8I1R12Value CA4_4_8I1R12Terms CA4_4_8I1R12Terms_sound) (by decide +kernel) +def CA4_4_8I1R12Mass : Ball := ⟨0, 0⟩ +lemma CA4_4_8I1R12Mass_sound : CA4_4_8I1R12Mass.Encloses (∑ a, CA4_4_8I1R12Value a) := by + exact contains_sound (pairSumBall_sound CA4_4_8I1R12P CA4_4_8I1R12Value CA4_4_8I1R12P_sound) (by decide +kernel) +def CA4_4_8I1R12MassTerm : Ball := .exact 0 +lemma CA4_4_8I1R12MassTerm_sound : CA4_4_8I1R12MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA4_4_8I1R12Value a))) := + entropyTerm_zero_ball (CA4_4_8I1R12Mass_sound) +def CA4_4_8I1R12H : Ball := ⟨0, 0⟩ +lemma CA4_4_8I1R12H_sound : CA4_4_8I1R12H.Encloses (homogeneousEntropy CA4_4_8I1R12Value) := by + exact contains_sound (homogeneous_enclosed CA4_4_8I1R12Value CA4_4_8I1R12MassTerm_sound CA4_4_8I1R12Entropy_sound) (by decide +kernel) +def CA4_4_8I1R13Value (a : PairSlot) : ℝ := residualLaw (below (shape 4 4 8)) (fun u => (stageALaw (shape 4 4 8) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 13 a +def CA4_4_8I1R13Raw (a : PairSlot) : Ball := residualBall (below (shape 4 4 8)) A4_4_8Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 13 a +lemma CA4_4_8I1R13Raw_sound (a : PairSlot) : + (CA4_4_8I1R13Raw a).Encloses (CA4_4_8I1R13Value a) := by + exact residualBall_sound_on (below (shape 4 4 8)) A4_4_8Law (fun u => (stageALaw (shape 4 4 8) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A4_4_8Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 4 4 8) (show (shape 4 4 8) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 13 a +def CA4_4_8I1R13Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA4_4_8I1R13Certificates_valid : + CA4_4_8I1R13Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA4_4_8I1R13CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA4_4_8I1R13P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA4_4_8I1R13Certificates (CA4_4_8I1R13CertificateIndex a)).input +lemma CA4_4_8I1R13P_check : ∀ a : PairSlot, contains (CA4_4_8I1R13Raw a) (CA4_4_8I1R13P a) = true := by + decide +kernel +lemma CA4_4_8I1R13P_sound (a : PairSlot) : + (CA4_4_8I1R13P a).Encloses (CA4_4_8I1R13Value a) := + contains_sound (CA4_4_8I1R13Raw_sound a) (CA4_4_8I1R13P_check a) +def CA4_4_8I1R13Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA4_4_8I1R13Certificates (CA4_4_8I1R13CertificateIndex a)).output +lemma CA4_4_8I1R13Terms_sound (a : PairSlot) : + (CA4_4_8I1R13Terms a).Encloses (Foundation.entropyTerm (CA4_4_8I1R13Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA4_4_8I1R13Certificates_valid + (CA4_4_8I1R13CertificateIndex a) (CA4_4_8I1R13P_sound a) +def CA4_4_8I1R13Entropy : Ball := ⟨0, 0⟩ +lemma CA4_4_8I1R13Entropy_sound : CA4_4_8I1R13Entropy.Encloses (Foundation.finiteEntropy CA4_4_8I1R13Value) := by + exact contains_sound (entropyPair_enclosed CA4_4_8I1R13Value CA4_4_8I1R13Terms CA4_4_8I1R13Terms_sound) (by decide +kernel) +def CA4_4_8I1R13Mass : Ball := ⟨0, 0⟩ +lemma CA4_4_8I1R13Mass_sound : CA4_4_8I1R13Mass.Encloses (∑ a, CA4_4_8I1R13Value a) := by + exact contains_sound (pairSumBall_sound CA4_4_8I1R13P CA4_4_8I1R13Value CA4_4_8I1R13P_sound) (by decide +kernel) +def CA4_4_8I1R13MassTerm : Ball := .exact 0 +lemma CA4_4_8I1R13MassTerm_sound : CA4_4_8I1R13MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA4_4_8I1R13Value a))) := + entropyTerm_zero_ball (CA4_4_8I1R13Mass_sound) +def CA4_4_8I1R13H : Ball := ⟨0, 0⟩ +lemma CA4_4_8I1R13H_sound : CA4_4_8I1R13H.Encloses (homogeneousEntropy CA4_4_8I1R13Value) := by + exact contains_sound (homogeneous_enclosed CA4_4_8I1R13Value CA4_4_8I1R13MassTerm_sound CA4_4_8I1R13Entropy_sound) (by decide +kernel) +def CA4_4_8I1R14Value (a : PairSlot) : ℝ := residualLaw (below (shape 4 4 8)) (fun u => (stageALaw (shape 4 4 8) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 14 a +def CA4_4_8I1R14Raw (a : PairSlot) : Ball := residualBall (below (shape 4 4 8)) A4_4_8Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 14 a +lemma CA4_4_8I1R14Raw_sound (a : PairSlot) : + (CA4_4_8I1R14Raw a).Encloses (CA4_4_8I1R14Value a) := by + exact residualBall_sound_on (below (shape 4 4 8)) A4_4_8Law (fun u => (stageALaw (shape 4 4 8) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A4_4_8Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 4 4 8) (show (shape 4 4 8) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 14 a +def CA4_4_8I1R14Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA4_4_8I1R14Certificates_valid : + CA4_4_8I1R14Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA4_4_8I1R14CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA4_4_8I1R14P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA4_4_8I1R14Certificates (CA4_4_8I1R14CertificateIndex a)).input +lemma CA4_4_8I1R14P_check : ∀ a : PairSlot, contains (CA4_4_8I1R14Raw a) (CA4_4_8I1R14P a) = true := by + decide +kernel +lemma CA4_4_8I1R14P_sound (a : PairSlot) : + (CA4_4_8I1R14P a).Encloses (CA4_4_8I1R14Value a) := + contains_sound (CA4_4_8I1R14Raw_sound a) (CA4_4_8I1R14P_check a) +def CA4_4_8I1R14Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA4_4_8I1R14Certificates (CA4_4_8I1R14CertificateIndex a)).output +lemma CA4_4_8I1R14Terms_sound (a : PairSlot) : + (CA4_4_8I1R14Terms a).Encloses (Foundation.entropyTerm (CA4_4_8I1R14Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA4_4_8I1R14Certificates_valid + (CA4_4_8I1R14CertificateIndex a) (CA4_4_8I1R14P_sound a) +def CA4_4_8I1R14Entropy : Ball := ⟨0, 0⟩ +lemma CA4_4_8I1R14Entropy_sound : CA4_4_8I1R14Entropy.Encloses (Foundation.finiteEntropy CA4_4_8I1R14Value) := by + exact contains_sound (entropyPair_enclosed CA4_4_8I1R14Value CA4_4_8I1R14Terms CA4_4_8I1R14Terms_sound) (by decide +kernel) +def CA4_4_8I1R14Mass : Ball := ⟨0, 0⟩ +lemma CA4_4_8I1R14Mass_sound : CA4_4_8I1R14Mass.Encloses (∑ a, CA4_4_8I1R14Value a) := by + exact contains_sound (pairSumBall_sound CA4_4_8I1R14P CA4_4_8I1R14Value CA4_4_8I1R14P_sound) (by decide +kernel) +def CA4_4_8I1R14MassTerm : Ball := .exact 0 +lemma CA4_4_8I1R14MassTerm_sound : CA4_4_8I1R14MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA4_4_8I1R14Value a))) := + entropyTerm_zero_ball (CA4_4_8I1R14Mass_sound) +def CA4_4_8I1R14H : Ball := ⟨0, 0⟩ +lemma CA4_4_8I1R14H_sound : CA4_4_8I1R14H.Encloses (homogeneousEntropy CA4_4_8I1R14Value) := by + exact contains_sound (homogeneous_enclosed CA4_4_8I1R14Value CA4_4_8I1R14MassTerm_sound CA4_4_8I1R14Entropy_sound) (by decide +kernel) +def CA4_4_8I1R15Value (a : PairSlot) : ℝ := residualLaw (below (shape 4 4 8)) (fun u => (stageALaw (shape 4 4 8) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 15 a +def CA4_4_8I1R15Raw (a : PairSlot) : Ball := residualBall (below (shape 4 4 8)) A4_4_8Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 15 a +lemma CA4_4_8I1R15Raw_sound (a : PairSlot) : + (CA4_4_8I1R15Raw a).Encloses (CA4_4_8I1R15Value a) := by + exact residualBall_sound_on (below (shape 4 4 8)) A4_4_8Law (fun u => (stageALaw (shape 4 4 8) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A4_4_8Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 4 4 8) (show (shape 4 4 8) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 15 a +def CA4_4_8I1R15Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA4_4_8I1R15Certificates_valid : + CA4_4_8I1R15Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA4_4_8I1R15CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA4_4_8I1R15P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA4_4_8I1R15Certificates (CA4_4_8I1R15CertificateIndex a)).input +lemma CA4_4_8I1R15P_check : ∀ a : PairSlot, contains (CA4_4_8I1R15Raw a) (CA4_4_8I1R15P a) = true := by + decide +kernel +lemma CA4_4_8I1R15P_sound (a : PairSlot) : + (CA4_4_8I1R15P a).Encloses (CA4_4_8I1R15Value a) := + contains_sound (CA4_4_8I1R15Raw_sound a) (CA4_4_8I1R15P_check a) +def CA4_4_8I1R15Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA4_4_8I1R15Certificates (CA4_4_8I1R15CertificateIndex a)).output +lemma CA4_4_8I1R15Terms_sound (a : PairSlot) : + (CA4_4_8I1R15Terms a).Encloses (Foundation.entropyTerm (CA4_4_8I1R15Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA4_4_8I1R15Certificates_valid + (CA4_4_8I1R15CertificateIndex a) (CA4_4_8I1R15P_sound a) +def CA4_4_8I1R15Entropy : Ball := ⟨0, 0⟩ +lemma CA4_4_8I1R15Entropy_sound : CA4_4_8I1R15Entropy.Encloses (Foundation.finiteEntropy CA4_4_8I1R15Value) := by + exact contains_sound (entropyPair_enclosed CA4_4_8I1R15Value CA4_4_8I1R15Terms CA4_4_8I1R15Terms_sound) (by decide +kernel) +def CA4_4_8I1R15Mass : Ball := ⟨0, 0⟩ +lemma CA4_4_8I1R15Mass_sound : CA4_4_8I1R15Mass.Encloses (∑ a, CA4_4_8I1R15Value a) := by + exact contains_sound (pairSumBall_sound CA4_4_8I1R15P CA4_4_8I1R15Value CA4_4_8I1R15P_sound) (by decide +kernel) +def CA4_4_8I1R15MassTerm : Ball := .exact 0 +lemma CA4_4_8I1R15MassTerm_sound : CA4_4_8I1R15MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA4_4_8I1R15Value a))) := + entropyTerm_zero_ball (CA4_4_8I1R15Mass_sound) +def CA4_4_8I1R15H : Ball := ⟨0, 0⟩ +lemma CA4_4_8I1R15H_sound : CA4_4_8I1R15H.Encloses (homogeneousEntropy CA4_4_8I1R15Value) := by + exact contains_sound (homogeneous_enclosed CA4_4_8I1R15Value CA4_4_8I1R15MassTerm_sound CA4_4_8I1R15Entropy_sound) (by decide +kernel) +def CA4_4_8I1R16Value (a : PairSlot) : ℝ := residualLaw (below (shape 4 4 8)) (fun u => (stageALaw (shape 4 4 8) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 16 a +def CA4_4_8I1R16Raw (a : PairSlot) : Ball := residualBall (below (shape 4 4 8)) A4_4_8Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 16 a +lemma CA4_4_8I1R16Raw_sound (a : PairSlot) : + (CA4_4_8I1R16Raw a).Encloses (CA4_4_8I1R16Value a) := by + exact residualBall_sound_on (below (shape 4 4 8)) A4_4_8Law (fun u => (stageALaw (shape 4 4 8) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A4_4_8Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 4 4 8) (show (shape 4 4 8) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 16 a +def CA4_4_8I1R16Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA4_4_8I1R16Certificates_valid : + CA4_4_8I1R16Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA4_4_8I1R16CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA4_4_8I1R16P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA4_4_8I1R16Certificates (CA4_4_8I1R16CertificateIndex a)).input +lemma CA4_4_8I1R16P_check : ∀ a : PairSlot, contains (CA4_4_8I1R16Raw a) (CA4_4_8I1R16P a) = true := by + decide +kernel +lemma CA4_4_8I1R16P_sound (a : PairSlot) : + (CA4_4_8I1R16P a).Encloses (CA4_4_8I1R16Value a) := + contains_sound (CA4_4_8I1R16Raw_sound a) (CA4_4_8I1R16P_check a) +def CA4_4_8I1R16Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA4_4_8I1R16Certificates (CA4_4_8I1R16CertificateIndex a)).output +lemma CA4_4_8I1R16Terms_sound (a : PairSlot) : + (CA4_4_8I1R16Terms a).Encloses (Foundation.entropyTerm (CA4_4_8I1R16Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA4_4_8I1R16Certificates_valid + (CA4_4_8I1R16CertificateIndex a) (CA4_4_8I1R16P_sound a) +def CA4_4_8I1R16Entropy : Ball := ⟨0, 0⟩ +lemma CA4_4_8I1R16Entropy_sound : CA4_4_8I1R16Entropy.Encloses (Foundation.finiteEntropy CA4_4_8I1R16Value) := by + exact contains_sound (entropyPair_enclosed CA4_4_8I1R16Value CA4_4_8I1R16Terms CA4_4_8I1R16Terms_sound) (by decide +kernel) +def CA4_4_8I1R16Mass : Ball := ⟨0, 0⟩ +lemma CA4_4_8I1R16Mass_sound : CA4_4_8I1R16Mass.Encloses (∑ a, CA4_4_8I1R16Value a) := by + exact contains_sound (pairSumBall_sound CA4_4_8I1R16P CA4_4_8I1R16Value CA4_4_8I1R16P_sound) (by decide +kernel) +def CA4_4_8I1R16MassTerm : Ball := .exact 0 +lemma CA4_4_8I1R16MassTerm_sound : CA4_4_8I1R16MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA4_4_8I1R16Value a))) := + entropyTerm_zero_ball (CA4_4_8I1R16Mass_sound) +def CA4_4_8I1R16H : Ball := ⟨0, 0⟩ +lemma CA4_4_8I1R16H_sound : CA4_4_8I1R16H.Encloses (homogeneousEntropy CA4_4_8I1R16Value) := by + exact contains_sound (homogeneous_enclosed CA4_4_8I1R16Value CA4_4_8I1R16MassTerm_sound CA4_4_8I1R16Entropy_sound) (by decide +kernel) +def CA4_4_8I1ResidualEntropies (a : Fin 17) : Ball := + match a.val with + | 0 => CA4_4_8I1R0H + | 1 => CA4_4_8I1R1H + | 2 => CA4_4_8I1R2H + | 3 => CA4_4_8I1R3H + | 4 => CA4_4_8I1R4H + | 5 => CA4_4_8I1R5H + | 6 => CA4_4_8I1R6H + | 7 => CA4_4_8I1R7H + | 8 => CA4_4_8I1R8H + | 9 => CA4_4_8I1R9H + | 10 => CA4_4_8I1R10H + | 11 => CA4_4_8I1R11H + | 12 => CA4_4_8I1R12H + | 13 => CA4_4_8I1R13H + | 14 => CA4_4_8I1R14H + | 15 => CA4_4_8I1R15H + | 16 => CA4_4_8I1R16H + | _ => (.exact 0) +lemma CA4_4_8I1ResidualEntropies_sound (k : Fin 17) : + (CA4_4_8I1ResidualEntropies k).Encloses (homogeneousEntropy + (residualLaw (below (shape 4 4 8)) (fun u => (stageALaw (shape 4 4 8) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) k)) := by + fin_cases k + · exact CA4_4_8I1R0H_sound + · exact CA4_4_8I1R1H_sound + · exact CA4_4_8I1R2H_sound + · exact CA4_4_8I1R3H_sound + · exact CA4_4_8I1R4H_sound + · exact CA4_4_8I1R5H_sound + · exact CA4_4_8I1R6H_sound + · exact CA4_4_8I1R7H_sound + · exact CA4_4_8I1R8H_sound + · exact CA4_4_8I1R9H_sound + · exact CA4_4_8I1R10H_sound + · exact CA4_4_8I1R11H_sound + · exact CA4_4_8I1R12H_sound + · exact CA4_4_8I1R13H_sound + · exact CA4_4_8I1R14H_sound + · exact CA4_4_8I1R15H_sound + · exact CA4_4_8I1R16H_sound +def CA4_4_8I1Singles (s : Shape) : Ball := + match s 0, s 1, s 2 with + | 4, 4, 0 => Z4_4_0H1H + | _, _, _ => (.exact 0) +lemma CA4_4_8I1Singles_sound (u : Shape) (hu : u ∈ below (shape 4 4 8)) + (hd : designated (Equiv.refl (Fin 3)) 1 u) : + (CA4_4_8I1Singles u).Encloses (homogeneousEntropy ((fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) u)) := by + rw [A4_4_8_below] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 0 0 8) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 0 1 7) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 0 2 6) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 0 3 5) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 0 4 4) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 1 0 7) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 1 1 6) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 1 2 5) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 1 3 4) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 1 4 3) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 2 0 6) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 2 1 5) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 2 2 4) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 2 3 3) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 2 4 2) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 3 0 5) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 3 1 4) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 3 2 3) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 3 3 2) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 3 4 1) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 4 0 4) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 4 1 3) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 4 2 2) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 4 3 1) by decide +kernel) hd |>.elim + · exact Z4_4_0H1H_sound +def CA4_4_8I1Singleton : Ball := ⟨(119273563983486045807973 / 1562500000000000000000000000000), (1607 / 25000000000000000000000000000000)⟩ +lemma CA4_4_8I1Singleton_sound : CA4_4_8I1Singleton.Encloses + (singletonEntropy (below (shape 4 4 8)) (fun u => (stageALaw (shape 4 4 8) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ))) := by + exact contains_sound (singletonBall_sound (below (shape 4 4 8)) A4_4_8Law (fun u => (stageALaw (shape 4 4 8) u : ℝ)) (Equiv.refl (Fin 3)) 1 + CA4_4_8I1Singles (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A4_4_8Law_sound u) CA4_4_8I1Singles_sound) (by decide +kernel) +def CA4_4_8I1Group : Ball := ⟨(46740788728686753822574143080971 / 50000000000000000000000000000000), (7062483779 / 4000000000000000000000000000000)⟩ +lemma CA4_4_8I1Group_sound : CA4_4_8I1Group.Encloses + (groupedEntropy (below (shape 4 4 8)) (fun u => (stageALaw (shape 4 4 8) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ))) := by + exact contains_sound (Ball.add_sound CA4_4_8I1Singleton_sound + (finSumBall_sound 17 CA4_4_8I1ResidualEntropies _ CA4_4_8I1ResidualEntropies_sound)) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CA4_4_8I1H : Ball := ⟨(60943550714041131995690773088959 / 50000000000000000000000000000000), (503786375947 / 100000000000000000000000000000000)⟩ +lemma CA4_4_8I1_sound : CA4_4_8I1H.Encloses (stageACapacity (shape 4 4 8) 1) := by + have hb := contains_sound (Ball.add_sound CA4_4_8I1PairH_sound + (Ball.neg_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) CA4_4_8I1Group_sound))) + (show contains (.add CA4_4_8I1PairH (.neg (.mul (.exact 2) CA4_4_8I1Group))) CA4_4_8I1H = true by decide +kernel) + unfold CA4_4_8I1PairValue at hb + simpa only [stageACapacity, nativeCapacity, + show (1 : Fin 3) ≠ 0 by decide, ite_false, sub_eq_add_neg] using hb + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA4_4_8I2.lean b/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA4_4_8I2.lean new file mode 100644 index 0000000000000000000000000000000000000000..19ce74dee70ab67d6acc31ce529a38c4748e1624 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA4_4_8I2.lean @@ -0,0 +1,868 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.CapacityA.CapA4_4_8I2Pair + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CA4_4_8I2R0Value (a : PairSlot) : ℝ := residualLaw (below (shape 4 4 8)) (fun u => (stageALaw (shape 4 4 8) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 0 a +def CA4_4_8I2R0Raw (a : PairSlot) : Ball := residualBall (below (shape 4 4 8)) A4_4_8Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 0 a +lemma CA4_4_8I2R0Raw_sound (a : PairSlot) : + (CA4_4_8I2R0Raw a).Encloses (CA4_4_8I2R0Value a) := by + exact residualBall_sound_on (below (shape 4 4 8)) A4_4_8Law (fun u => (stageALaw (shape 4 4 8) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A4_4_8Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 4 4 8) (show (shape 4 4 8) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 0 a +def CA4_4_8I2R0Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(3035600478242196747209827 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(100885900988501493060513433 / 100000000000000000000000000000000), (32159 / 100000000000000000000000000000000)⟩ ⟨(-415428107682506870021708107576163 / 25000000000000000000000000000000), (6617650791 / 1250000000000000000000000000000)⟩ ⟨-24, 3035600478242196747209827, 2980232238769531250000000⟩] +lemma CA4_4_8I2R0Certificates_valid : + CA4_4_8I2R0Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA4_4_8I2R0CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 0, 0 => 1 + | _, _ => 0 +def CA4_4_8I2R0P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA4_4_8I2R0Certificates (CA4_4_8I2R0CertificateIndex a)).input +lemma CA4_4_8I2R0P_check : ∀ a : PairSlot, contains (CA4_4_8I2R0Raw a) (CA4_4_8I2R0P a) = true := by + decide +kernel +lemma CA4_4_8I2R0P_sound (a : PairSlot) : + (CA4_4_8I2R0P a).Encloses (CA4_4_8I2R0Value a) := + contains_sound (CA4_4_8I2R0Raw_sound a) (CA4_4_8I2R0P_check a) +def CA4_4_8I2R0Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA4_4_8I2R0Certificates (CA4_4_8I2R0CertificateIndex a)).output +lemma CA4_4_8I2R0Terms_sound (a : PairSlot) : + (CA4_4_8I2R0Terms a).Encloses (Foundation.entropyTerm (CA4_4_8I2R0Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA4_4_8I2R0Certificates_valid + (CA4_4_8I2R0CertificateIndex a) (CA4_4_8I2R0P_sound a) +def CA4_4_8I2R0Entropy : Ball := ⟨(100885900988501493060513433 / 100000000000000000000000000000000), (32159 / 100000000000000000000000000000000)⟩ +lemma CA4_4_8I2R0Entropy_sound : CA4_4_8I2R0Entropy.Encloses (Foundation.finiteEntropy CA4_4_8I2R0Value) := by + exact contains_sound (entropyPair_enclosed CA4_4_8I2R0Value CA4_4_8I2R0Terms CA4_4_8I2R0Terms_sound) (by decide +kernel) +def CA4_4_8I2R0Mass : Ball := ⟨(3035600478242196747209827 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ +lemma CA4_4_8I2R0Mass_sound : CA4_4_8I2R0Mass.Encloses (∑ a, CA4_4_8I2R0Value a) := by + exact contains_sound (pairSumBall_sound CA4_4_8I2R0P CA4_4_8I2R0Value CA4_4_8I2R0P_sound) (by decide +kernel) +def CA4_4_8I2R0MassTermLogWitness : LogWitness := ⟨-24, 3035600478242196747209827, 2980232238769531250000000⟩ +def CA4_4_8I2R0MassTermLog : Ball := ⟨(-415428107682506870021708107576163 / 25000000000000000000000000000000), (6617650791 / 1250000000000000000000000000000)⟩ +lemma CA4_4_8I2R0MassTermLog_sound : CA4_4_8I2R0MassTermLog.Encloses (Real.log ((∑ a, CA4_4_8I2R0Value a))) := by + exact checkLog_sound logTwoBall_sound (CA4_4_8I2R0Mass_sound) (w := CA4_4_8I2R0MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA4_4_8I2R0MassTerm : Ball := ⟨(100885900988501493060513433 / 100000000000000000000000000000000), (32159 / 100000000000000000000000000000000)⟩ +lemma CA4_4_8I2R0MassTerm_sound : CA4_4_8I2R0MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA4_4_8I2R0Value a))) := by + exact contains_sound (entropyTerm_ball (CA4_4_8I2R0Mass_sound) CA4_4_8I2R0MassTermLog_sound) (by decide +kernel) +def CA4_4_8I2R0H : Ball := ⟨0, (32159 / 50000000000000000000000000000000)⟩ +lemma CA4_4_8I2R0H_sound : CA4_4_8I2R0H.Encloses (homogeneousEntropy CA4_4_8I2R0Value) := by + exact contains_sound (homogeneous_enclosed CA4_4_8I2R0Value CA4_4_8I2R0MassTerm_sound CA4_4_8I2R0Entropy_sound) (by decide +kernel) +def CA4_4_8I2R1Value (a : PairSlot) : ℝ := residualLaw (below (shape 4 4 8)) (fun u => (stageALaw (shape 4 4 8) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 1 a +def CA4_4_8I2R1Raw (a : PairSlot) : Ball := residualBall (below (shape 4 4 8)) A4_4_8Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 1 a +lemma CA4_4_8I2R1Raw_sound (a : PairSlot) : + (CA4_4_8I2R1Raw a).Encloses (CA4_4_8I2R1Value a) := by + exact residualBall_sound_on (below (shape 4 4 8)) A4_4_8Law (fun u => (stageALaw (shape 4 4 8) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A4_4_8Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 4 4 8) (show (shape 4 4 8) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 1 a +def CA4_4_8I2R1Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(809072654081018314756371891 / 25000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ ⟨(8364595743039152683402561227 / 25000000000000000000000000000000), (10965003 / 100000000000000000000000000000000)⟩ ⟨(-1033849766253692344627325607201383 / 100000000000000000000000000000000), (169406620363 / 50000000000000000000000000000000)⟩ ⟨-15, 809072654081018314756371891, 762939453125000000000000000⟩] +lemma CA4_4_8I2R1Certificates_valid : + CA4_4_8I2R1Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA4_4_8I2R1CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 1, 0 => 1 + | 0, 1 => 1 + | _, _ => 0 +def CA4_4_8I2R1P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA4_4_8I2R1Certificates (CA4_4_8I2R1CertificateIndex a)).input +lemma CA4_4_8I2R1P_check : ∀ a : PairSlot, contains (CA4_4_8I2R1Raw a) (CA4_4_8I2R1P a) = true := by + decide +kernel +lemma CA4_4_8I2R1P_sound (a : PairSlot) : + (CA4_4_8I2R1P a).Encloses (CA4_4_8I2R1Value a) := + contains_sound (CA4_4_8I2R1Raw_sound a) (CA4_4_8I2R1P_check a) +def CA4_4_8I2R1Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA4_4_8I2R1Certificates (CA4_4_8I2R1CertificateIndex a)).output +lemma CA4_4_8I2R1Terms_sound (a : PairSlot) : + (CA4_4_8I2R1Terms a).Encloses (Foundation.entropyTerm (CA4_4_8I2R1Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA4_4_8I2R1Certificates_valid + (CA4_4_8I2R1CertificateIndex a) (CA4_4_8I2R1P_sound a) +def CA4_4_8I2R1Entropy : Ball := ⟨(8364595743039152683402561227 / 12500000000000000000000000000000), (10965003 / 50000000000000000000000000000000)⟩ +lemma CA4_4_8I2R1Entropy_sound : CA4_4_8I2R1Entropy.Encloses (Foundation.finiteEntropy CA4_4_8I2R1Value) := by + exact contains_sound (entropyPair_enclosed CA4_4_8I2R1Value CA4_4_8I2R1Terms CA4_4_8I2R1Terms_sound) (by decide +kernel) +def CA4_4_8I2R1Mass : Ball := ⟨(809072654081018314756371891 / 12500000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ +lemma CA4_4_8I2R1Mass_sound : CA4_4_8I2R1Mass.Encloses (∑ a, CA4_4_8I2R1Value a) := by + exact contains_sound (pairSumBall_sound CA4_4_8I2R1P CA4_4_8I2R1Value CA4_4_8I2R1P_sound) (by decide +kernel) +def CA4_4_8I2R1MassTermLogWitness : LogWitness := ⟨-14, 809072654081018314756371891, 762939453125000000000000000⟩ +def CA4_4_8I2R1MassTermLog : Ball := ⟨(-964535048197697813685602414151053 / 100000000000000000000000000000000), (317637417043 / 100000000000000000000000000000000)⟩ +lemma CA4_4_8I2R1MassTermLog_sound : CA4_4_8I2R1MassTermLog.Encloses (Real.log ((∑ a, CA4_4_8I2R1Value a))) := by + exact checkLog_sound logTwoBall_sound (CA4_4_8I2R1Mass_sound) (w := CA4_4_8I2R1MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA4_4_8I2R1MassTerm : Ball := ⟨(12486062902391588654992660491 / 20000000000000000000000000000000), (20559379 / 100000000000000000000000000000000)⟩ +lemma CA4_4_8I2R1MassTerm_sound : CA4_4_8I2R1MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA4_4_8I2R1Value a))) := by + exact contains_sound (entropyTerm_ball (CA4_4_8I2R1Mass_sound) CA4_4_8I2R1MassTermLog_sound) (by decide +kernel) +def CA4_4_8I2R1H : Ball := ⟨(4486451432355278192257187361 / 100000000000000000000000000000000), (8497877 / 20000000000000000000000000000000)⟩ +lemma CA4_4_8I2R1H_sound : CA4_4_8I2R1H.Encloses (homogeneousEntropy CA4_4_8I2R1Value) := by + exact contains_sound (homogeneous_enclosed CA4_4_8I2R1Value CA4_4_8I2R1MassTerm_sound CA4_4_8I2R1Entropy_sound) (by decide +kernel) +def CA4_4_8I2R2Value (a : PairSlot) : ℝ := residualLaw (below (shape 4 4 8)) (fun u => (stageALaw (shape 4 4 8) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 2 a +def CA4_4_8I2R2Raw (a : PairSlot) : Ball := residualBall (below (shape 4 4 8)) A4_4_8Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 2 a +lemma CA4_4_8I2R2Raw_sound (a : PairSlot) : + (CA4_4_8I2R2Raw a).Encloses (CA4_4_8I2R2Value a) := by + exact residualBall_sound_on (below (shape 4 4 8)) A4_4_8Law (fun u => (stageALaw (shape 4 4 8) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A4_4_8Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 4 4 8) (show (shape 4 4 8) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 2 a +def CA4_4_8I2R2Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(144056175636722908392748111579 / 100000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ ⟨(235629882179052930029979856781 / 25000000000000000000000000000000), (67111183 / 20000000000000000000000000000000)⟩ ⟨(-327136106643922294503498786915473 / 50000000000000000000000000000000), (232934061901 / 100000000000000000000000000000000)⟩ ⟨-10, 144056175636722908392748111579, 97656250000000000000000000000⟩, + .log ⟨(325539556588240870788601551 / 3125000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(4776035556690193219567774997 / 5000000000000000000000000000000), (33089139 / 100000000000000000000000000000000)⟩ ⟨(-916946086127093913138421118852279 / 100000000000000000000000000000000), (79409341211 / 25000000000000000000000000000000)⟩ ⟨-14, 325539556588240870788601551, 190734863281250000000000000⟩, + .log ⟨(527409107345197692454915661913 / 100000000000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ ⟨(110649353178165597293078182089 / 4000000000000000000000000000000), (502574521 / 50000000000000000000000000000000)⟩ ⟨(-524494892281713229333103824387583 / 100000000000000000000000000000000), (47645603571 / 25000000000000000000000000000000)⟩ ⟨-8, 527409107345197692454915661913, 390625000000000000000000000000⟩] +lemma CA4_4_8I2R2Certificates_valid : + CA4_4_8I2R2Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA4_4_8I2R2CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 2, 0 => 1 + | 3, 0 => 2 + | 1, 1 => 3 + | 0, 2 => 1 + | 0, 3 => 2 + | _, _ => 0 +def CA4_4_8I2R2P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA4_4_8I2R2Certificates (CA4_4_8I2R2CertificateIndex a)).input +lemma CA4_4_8I2R2P_check : ∀ a : PairSlot, contains (CA4_4_8I2R2Raw a) (CA4_4_8I2R2P a) = true := by + decide +kernel +lemma CA4_4_8I2R2P_sound (a : PairSlot) : + (CA4_4_8I2R2P a).Encloses (CA4_4_8I2R2Value a) := + contains_sound (CA4_4_8I2R2Raw_sound a) (CA4_4_8I2R2P_check a) +def CA4_4_8I2R2Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA4_4_8I2R2Certificates (CA4_4_8I2R2CertificateIndex a)).output +lemma CA4_4_8I2R2Terms_sound (a : PairSlot) : + (CA4_4_8I2R2Terms a).Encloses (Foundation.entropyTerm (CA4_4_8I2R2Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA4_4_8I2R2Certificates_valid + (CA4_4_8I2R2CertificateIndex a) (CA4_4_8I2R2P_sound a) +def CA4_4_8I2R2Entropy : Ball := ⟨(4842314309154171101349504406353 / 100000000000000000000000000000000), (34848783 / 2000000000000000000000000000000)⟩ +lemma CA4_4_8I2R2Entropy_sound : CA4_4_8I2R2Entropy.Encloses (Foundation.finiteEntropy CA4_4_8I2R2Value) := by + exact contains_sound (entropyPair_enclosed CA4_4_8I2R2Value CA4_4_8I2R2Terms CA4_4_8I2R2Terms_sound) (by decide +kernel) +def CA4_4_8I2R2Mass : Ball := ⟨(167271198048058184994176476867 / 20000000000000000000000000000000), (3 / 25000000000000000000000000000000)⟩ +lemma CA4_4_8I2R2Mass_sound : CA4_4_8I2R2Mass.Encloses (∑ a, CA4_4_8I2R2Value a) := by + exact contains_sound (pairSumBall_sound CA4_4_8I2R2P CA4_4_8I2R2Value CA4_4_8I2R2P_sound) (by decide +kernel) +def CA4_4_8I2R2MassTermLogWitness : LogWitness := ⟨-7, 167271198048058184994176476867, 156250000000000000000000000000⟩ +def CA4_4_8I2R2MassTermLog : Ball := ⟨(-1913548446750902621982351257567 / 400000000000000000000000000000), (84703295449 / 50000000000000000000000000000000)⟩ +lemma CA4_4_8I2R2MassTermLog_sound : CA4_4_8I2R2MassTermLog.Encloses (Real.log ((∑ a, CA4_4_8I2R2Value a))) := by + exact checkLog_sound logTwoBall_sound (CA4_4_8I2R2Mass_sound) (w := CA4_4_8I2R2MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA4_4_8I2R2MassTerm : Ball := ⟨(250063704071112776882502314991 / 6250000000000000000000000000000), (1416842229 / 100000000000000000000000000000000)⟩ +lemma CA4_4_8I2R2MassTerm_sound : CA4_4_8I2R2MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA4_4_8I2R2Value a))) := by + exact contains_sound (entropyTerm_ball (CA4_4_8I2R2Mass_sound) CA4_4_8I2R2MassTermLog_sound) (by decide +kernel) +def CA4_4_8I2R2H : Ball := ⟨(841295044016366671229467366497 / 100000000000000000000000000000000), (3159281379 / 100000000000000000000000000000000)⟩ +lemma CA4_4_8I2R2H_sound : CA4_4_8I2R2H.Encloses (homogeneousEntropy CA4_4_8I2R2Value) := by + exact contains_sound (homogeneous_enclosed CA4_4_8I2R2Value CA4_4_8I2R2MassTerm_sound CA4_4_8I2R2Entropy_sound) (by decide +kernel) +def CA4_4_8I2R3Value (a : PairSlot) : ℝ := residualLaw (below (shape 4 4 8)) (fun u => (stageALaw (shape 4 4 8) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 3 a +def CA4_4_8I2R3Raw (a : PairSlot) : Ball := residualBall (below (shape 4 4 8)) A4_4_8Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 3 a +lemma CA4_4_8I2R3Raw_sound (a : PairSlot) : + (CA4_4_8I2R3Raw a).Encloses (CA4_4_8I2R3Value a) := by + exact residualBall_sound_on (below (shape 4 4 8)) A4_4_8Law (fun u => (stageALaw (shape 4 4 8) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A4_4_8Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 4 4 8) (show (shape 4 4 8) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 3 a +def CA4_4_8I2R3Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(231085541255582019869870639891 / 100000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ ⟨(1402721013040971449198777249589 / 100000000000000000000000000000000), (489342689 / 100000000000000000000000000000000)⟩ ⟨(-151753437863249246125196915349431 / 25000000000000000000000000000000), (211758238127 / 100000000000000000000000000000000)⟩ ⟨-9, 231085541255582019869870639891, 195312500000000000000000000000⟩, + .log ⟨(8143462990423164618805902263813 / 100000000000000000000000000000000), (43 / 100000000000000000000000000000000)⟩ ⟨(20423436017617139668532376373777 / 100000000000000000000000000000000), (4311113487 / 50000000000000000000000000000000)⟩ ⟨(-250795466764390145372495411941297 / 100000000000000000000000000000000), (105879118943 / 100000000000000000000000000000000)⟩ ⟨-4, 8143462990423164618805902263813, 6250000000000000000000000000000⟩, + .log ⟨(105117771726331581854672918031 / 25000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ ⟨(2300628469079708160672363099159 / 100000000000000000000000000000000), (200335991 / 25000000000000000000000000000000)⟩ ⟨(-109430994935341172217633508801731 / 20000000000000000000000000000000), (9529120693 / 5000000000000000000000000000000)⟩ ⟨-8, 105117771726331581854672918031, 97656250000000000000000000000⟩] +lemma CA4_4_8I2R3Certificates_valid : + CA4_4_8I2R3Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA4_4_8I2R3CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 4, 0 => 1 + | 2, 1 => 2 + | 3, 1 => 3 + | 1, 2 => 2 + | 1, 3 => 3 + | 0, 4 => 1 + | _, _ => 0 +def CA4_4_8I2R3P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA4_4_8I2R3Certificates (CA4_4_8I2R3CertificateIndex a)).input +lemma CA4_4_8I2R3P_check : ∀ a : PairSlot, contains (CA4_4_8I2R3Raw a) (CA4_4_8I2R3P a) = true := by + decide +kernel +lemma CA4_4_8I2R3P_sound (a : PairSlot) : + (CA4_4_8I2R3P a).Encloses (CA4_4_8I2R3Value a) := + contains_sound (CA4_4_8I2R3Raw_sound a) (CA4_4_8I2R3P_check a) +def CA4_4_8I2R3Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA4_4_8I2R3Certificates (CA4_4_8I2R3CertificateIndex a)).output +lemma CA4_4_8I2R3Terms_sound (a : PairSlot) : + (CA4_4_8I2R3Terms a).Encloses (Foundation.entropyTerm (CA4_4_8I2R3Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA4_4_8I2R3Certificates_valid + (CA4_4_8I2R3CertificateIndex a) (CA4_4_8I2R3P_sound a) +def CA4_4_8I2R3Entropy : Ball := ⟨(965071419989512771136140668901 / 2000000000000000000000000000000), (9912913627 / 50000000000000000000000000000000)⟩ +lemma CA4_4_8I2R3Entropy_sound : CA4_4_8I2R3Entropy.Encloses (Foundation.finiteEntropy CA4_4_8I2R3Value) := by + exact contains_sound (entropyPair_enclosed CA4_4_8I2R3Value CA4_4_8I2R3Terms CA4_4_8I2R3Terms_sound) (by decide +kernel) +def CA4_4_8I2R3Mass : Ball := ⟨(2198754904646018241523616143957 / 12500000000000000000000000000000), (49 / 50000000000000000000000000000000)⟩ +lemma CA4_4_8I2R3Mass_sound : CA4_4_8I2R3Mass.Encloses (∑ a, CA4_4_8I2R3Value a) := by + exact contains_sound (pairSumBall_sound CA4_4_8I2R3P CA4_4_8I2R3Value CA4_4_8I2R3P_sound) (by decide +kernel) +def CA4_4_8I2R3MassTermLogWitness : LogWitness := ⟨-3, 2198754904646018241523616143957, 1562500000000000000000000000000⟩ +def CA4_4_8I2R3MassTermLog : Ball := ⟨(-173783739658914282888710670776333 / 100000000000000000000000000000000), (10587911911 / 12500000000000000000000000000000)⟩ +lemma CA4_4_8I2R3MassTermLog_sound : CA4_4_8I2R3MassTermLog.Encloses (Real.log ((∑ a, CA4_4_8I2R3Value a))) := by + exact checkLog_sound logTwoBall_sound (CA4_4_8I2R3Mass_sound) (w := CA4_4_8I2R3MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA4_4_8I2R3MassTerm : Ball := ⟨(30568627993821162617363647220061 / 100000000000000000000000000000000), (14899343047 / 100000000000000000000000000000000)⟩ +lemma CA4_4_8I2R3MassTerm_sound : CA4_4_8I2R3MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA4_4_8I2R3Value a))) := by + exact contains_sound (entropyTerm_ball (CA4_4_8I2R3Mass_sound) CA4_4_8I2R3MassTermLog_sound) (by decide +kernel) +def CA4_4_8I2R3H : Ball := ⟨(17684943005654475939443386224989 / 100000000000000000000000000000000), (34725170301 / 100000000000000000000000000000000)⟩ +lemma CA4_4_8I2R3H_sound : CA4_4_8I2R3H.Encloses (homogeneousEntropy CA4_4_8I2R3Value) := by + exact contains_sound (homogeneous_enclosed CA4_4_8I2R3Value CA4_4_8I2R3MassTerm_sound CA4_4_8I2R3Entropy_sound) (by decide +kernel) +def CA4_4_8I2R4Value (a : PairSlot) : ℝ := residualLaw (below (shape 4 4 8)) (fun u => (stageALaw (shape 4 4 8) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 4 a +def CA4_4_8I2R4Raw (a : PairSlot) : Ball := residualBall (below (shape 4 4 8)) A4_4_8Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 4 a +lemma CA4_4_8I2R4Raw_sound (a : PairSlot) : + (CA4_4_8I2R4Raw a).Encloses (CA4_4_8I2R4Value a) := by + exact residualBall_sound_on (below (shape 4 4 8)) A4_4_8Law (fun u => (stageALaw (shape 4 4 8) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A4_4_8Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 4 4 8) (show (shape 4 4 8) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 4 a +def CA4_4_8I2R4Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(13403335035357123995044009011 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(956185547634562661408467281 / 800000000000000000000000000000), (39735743 / 100000000000000000000000000000000)⟩ ⟨(-44587109528720255309049705569641 / 5000000000000000000000000000000), (148230769511 / 50000000000000000000000000000000)⟩ ⟨-13, 13403335035357123995044009011, 12207031250000000000000000000⟩, + .log ⟨(913523187809309878302768426799 / 20000000000000000000000000000000), (13 / 50000000000000000000000000000000)⟩ ⟨(14096479448211469622923358799501 / 100000000000000000000000000000000), (2901690947 / 50000000000000000000000000000000)⟩ ⟨(-154308939677993030556111997454381 / 50000000000000000000000000000000), (127054942667 / 100000000000000000000000000000000)⟩ ⟨-5, 913523187809309878302768426799, 625000000000000000000000000000⟩, + .log ⟨(47338644618955604669010009940067 / 100000000000000000000000000000000), (187 / 100000000000000000000000000000000)⟩ ⟨(1770094204759252533873753877557 / 5000000000000000000000000000000), (30073044083 / 100000000000000000000000000000000)⟩ ⟨(-18696080327260378709560136191337 / 25000000000000000000000000000000), (15881867861 / 25000000000000000000000000000000)⟩ ⟨-2, 47338644618955604669010009940067, 25000000000000000000000000000000⟩, + .log ⟨(2194750548526808701414581112929 / 100000000000000000000000000000000), (11 / 100000000000000000000000000000000)⟩ ⟨(4190987875598734809524401416881 / 50000000000000000000000000000000), (3253295599 / 100000000000000000000000000000000)⟩ ⟨(-190955089561857887364725130187723 / 50000000000000000000000000000000), (74115383141 / 50000000000000000000000000000000)⟩ ⟨-6, 2194750548526808701414581112929, 1562500000000000000000000000000⟩, + .log ⟨(5482600270839383620453587239 / 5000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ ⟨(74734571046284442454206984143 / 10000000000000000000000000000000), (51083377 / 20000000000000000000000000000000)⟩ ⟨(-340780685050939403276333226608717 / 50000000000000000000000000000000), (909898681 / 390625000000000000000000000000)⟩ ⟨-10, 5482600270839383620453587239, 4882812500000000000000000000⟩] +lemma CA4_4_8I2R4Certificates_valid : + CA4_4_8I2R4Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA4_4_8I2R4CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 5, 0 => 1 + | 4, 1 => 2 + | 2, 2 => 3 + | 2, 3 => 4 + | 3, 2 => 4 + | 3, 3 => 5 + | 1, 4 => 2 + | 0, 5 => 1 + | _, _ => 0 +def CA4_4_8I2R4P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA4_4_8I2R4Certificates (CA4_4_8I2R4CertificateIndex a)).input +lemma CA4_4_8I2R4P_check : ∀ a : PairSlot, contains (CA4_4_8I2R4Raw a) (CA4_4_8I2R4P a) = true := by + decide +kernel +lemma CA4_4_8I2R4P_sound (a : PairSlot) : + (CA4_4_8I2R4P a).Encloses (CA4_4_8I2R4Value a) := + contains_sound (CA4_4_8I2R4Raw_sound a) (CA4_4_8I2R4P_check a) +def CA4_4_8I2R4Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA4_4_8I2R4Certificates (CA4_4_8I2R4CertificateIndex a)).output +lemma CA4_4_8I2R4Terms_sound (a : PairSlot) : + (CA4_4_8I2R4Terms a).Encloses (Foundation.entropyTerm (CA4_4_8I2R4Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA4_4_8I2R4Certificates_valid + (CA4_4_8I2R4CertificateIndex a) (CA4_4_8I2R4P_sound a) +def CA4_4_8I2R4Entropy : Ball := ⟨(40672593295687207125656793739673 / 50000000000000000000000000000000), (606516093 / 1250000000000000000000000000000)⟩ +lemma CA4_4_8I2R4Entropy_sound : CA4_4_8I2R4Entropy.Encloses (Foundation.finiteEntropy CA4_4_8I2R4Value) := by + exact contains_sound (entropyPair_enclosed CA4_4_8I2R4Value CA4_4_8I2R4Terms CA4_4_8I2R4Terms_sound) (by decide +kernel) +def CA4_4_8I2R4Mass : Ball := ⟨(60999836269589822775266016196717 / 100000000000000000000000000000000), (53 / 20000000000000000000000000000000)⟩ +lemma CA4_4_8I2R4Mass_sound : CA4_4_8I2R4Mass.Encloses (∑ a, CA4_4_8I2R4Value a) := by + exact contains_sound (pairSumBall_sound CA4_4_8I2R4P CA4_4_8I2R4Value CA4_4_8I2R4P_sound) (by decide +kernel) +def CA4_4_8I2R4MassTermLogWitness : LogWitness := ⟨-1, 60999836269589822775266016196717, 50000000000000000000000000000000⟩ +def CA4_4_8I2R4MassTermLog : Ball := ⟨(-24714950296173360416017773017097 / 50000000000000000000000000000000), (211758239 / 500000000000000000000000000000)⟩ +lemma CA4_4_8I2R4MassTermLog_sound : CA4_4_8I2R4MassTermLog.Encloses (Real.log ((∑ a, CA4_4_8I2R4Value a))) := by + exact checkLog_sound logTwoBall_sound (CA4_4_8I2R4Mass_sound) (w := CA4_4_8I2R4MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA4_4_8I2R4MassTerm : Ball := ⟨(942254950923515926994287812149 / 3125000000000000000000000000000), (25834435947 / 100000000000000000000000000000000)⟩ +lemma CA4_4_8I2R4MassTerm_sound : CA4_4_8I2R4MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA4_4_8I2R4Value a))) := by + exact contains_sound (entropyTerm_ball (CA4_4_8I2R4Mass_sound) CA4_4_8I2R4MassTermLog_sound) (by decide +kernel) +def CA4_4_8I2R4H : Ball := ⟨(25596514080910952293748188745289 / 50000000000000000000000000000000), (74355723387 / 100000000000000000000000000000000)⟩ +lemma CA4_4_8I2R4H_sound : CA4_4_8I2R4H.Encloses (homogeneousEntropy CA4_4_8I2R4Value) := by + exact contains_sound (homogeneous_enclosed CA4_4_8I2R4Value CA4_4_8I2R4MassTerm_sound CA4_4_8I2R4Entropy_sound) (by decide +kernel) +def CA4_4_8I2R5Value (a : PairSlot) : ℝ := residualLaw (below (shape 4 4 8)) (fun u => (stageALaw (shape 4 4 8) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 5 a +def CA4_4_8I2R5Raw (a : PairSlot) : Ball := residualBall (below (shape 4 4 8)) A4_4_8Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 5 a +lemma CA4_4_8I2R5Raw_sound (a : PairSlot) : + (CA4_4_8I2R5Raw a).Encloses (CA4_4_8I2R5Value a) := by + exact residualBall_sound_on (below (shape 4 4 8)) A4_4_8Law (fun u => (stageALaw (shape 4 4 8) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A4_4_8Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 4 4 8) (show (shape 4 4 8) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 5 a +def CA4_4_8I2R5Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(6093665150867149565350245629 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(27459665581402125750187161693 / 25000000000000000000000000000000), (9677881 / 25000000000000000000000000000000)⟩ ⟨(-450626427635173236284494854820431 / 50000000000000000000000000000000), (6352747269 / 2000000000000000000000000000000)⟩ ⟨-14, 6093665150867149565350245629, 3051757812500000000000000000⟩, + .log ⟨(897023998498120010140493588531 / 12500000000000000000000000000000), (37 / 100000000000000000000000000000000)⟩ ⟨(3780993911075951227238194369531 / 20000000000000000000000000000000), (1899522237 / 25000000000000000000000000000000)⟩ ⟨(-16465008171318605507518053250799 / 6250000000000000000000000000000), (10587911893 / 10000000000000000000000000000000)⟩ ⟨-4, 897023998498120010140493588531, 781250000000000000000000000000⟩, + .log ⟨(134656865576371148188256119323 / 50000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ ⟨(15935424030593622966483144189 / 1000000000000000000000000000000), (570294023 / 100000000000000000000000000000000)⟩ ⟨(-591704847813934419974362172129767 / 100000000000000000000000000000000), (52939559393 / 25000000000000000000000000000000)⟩ ⟨-9, 134656865576371148188256119323, 97656250000000000000000000000⟩] +lemma CA4_4_8I2R5Certificates_valid : + CA4_4_8I2R5Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA4_4_8I2R5CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 5, 1 => 1 + | 4, 2 => 2 + | 4, 3 => 3 + | 2, 4 => 2 + | 3, 4 => 3 + | 1, 5 => 1 + | _, _ => 0 +def CA4_4_8I2R5P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA4_4_8I2R5Certificates (CA4_4_8I2R5CertificateIndex a)).input +lemma CA4_4_8I2R5P_check : ∀ a : PairSlot, contains (CA4_4_8I2R5Raw a) (CA4_4_8I2R5P a) = true := by + decide +kernel +lemma CA4_4_8I2R5P_sound (a : PairSlot) : + (CA4_4_8I2R5P a).Encloses (CA4_4_8I2R5Value a) := + contains_sound (CA4_4_8I2R5Raw_sound a) (CA4_4_8I2R5P_check a) +def CA4_4_8I2R5Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA4_4_8I2R5Certificates (CA4_4_8I2R5CertificateIndex a)).output +lemma CA4_4_8I2R5Terms_sound (a : PairSlot) : + (CA4_4_8I2R5Terms a).Encloses (Foundation.entropyTerm (CA4_4_8I2R5Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA4_4_8I2R5Certificates_valid + (CA4_4_8I2R5CertificateIndex a) (CA4_4_8I2R5P_sound a) +def CA4_4_8I2R5Entropy : Ball := ⟨(20608350620764726935840034913327 / 50000000000000000000000000000000), (1641418899 / 10000000000000000000000000000000)⟩ +lemma CA4_4_8I2R5Entropy_sound : CA4_4_8I2R5Entropy.Encloses (Foundation.finiteEntropy CA4_4_8I2R5Value) := by + exact contains_sound (entropyPair_enclosed CA4_4_8I2R5Value CA4_4_8I2R5Terms CA4_4_8I2R5Terms_sound) (by decide +kernel) +def CA4_4_8I2R5Mass : Ball := ⟨(932211631179929584578895179769 / 6250000000000000000000000000000), (1 / 1250000000000000000000000000000)⟩ +lemma CA4_4_8I2R5Mass_sound : CA4_4_8I2R5Mass.Encloses (∑ a, CA4_4_8I2R5Value a) := by + exact contains_sound (pairSumBall_sound CA4_4_8I2R5P CA4_4_8I2R5Value CA4_4_8I2R5P_sound) (by decide +kernel) +def CA4_4_8I2R5MassTermLogWitness : LogWitness := ⟨-3, 932211631179929584578895179769, 781250000000000000000000000000⟩ +def CA4_4_8I2R5MassTermLog : Ball := ⟨(-2973088877719296093409086138257 / 1562500000000000000000000000000), (21175823817 / 25000000000000000000000000000000)⟩ +lemma CA4_4_8I2R5MassTermLog_sound : CA4_4_8I2R5MassTermLog.Encloses (Real.log ((∑ a, CA4_4_8I2R5Value a))) := by + exact checkLog_sound logTwoBall_sound (CA4_4_8I2R5Mass_sound) (w := CA4_4_8I2R5MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA4_4_8I2R5MassTerm : Ball := ⟨(28380651851178098873272106745451 / 100000000000000000000000000000000), (12633823681 / 100000000000000000000000000000000)⟩ +lemma CA4_4_8I2R5MassTerm_sound : CA4_4_8I2R5MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA4_4_8I2R5Value a))) := by + exact contains_sound (entropyTerm_ball (CA4_4_8I2R5Mass_sound) CA4_4_8I2R5MassTermLog_sound) (by decide +kernel) +def CA4_4_8I2R5H : Ball := ⟨(12836049390351354998407963081203 / 100000000000000000000000000000000), (29048012671 / 100000000000000000000000000000000)⟩ +lemma CA4_4_8I2R5H_sound : CA4_4_8I2R5H.Encloses (homogeneousEntropy CA4_4_8I2R5Value) := by + exact contains_sound (homogeneous_enclosed CA4_4_8I2R5Value CA4_4_8I2R5MassTerm_sound CA4_4_8I2R5Entropy_sound) (by decide +kernel) +def CA4_4_8I2R6Value (a : PairSlot) : ℝ := residualLaw (below (shape 4 4 8)) (fun u => (stageALaw (shape 4 4 8) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 6 a +def CA4_4_8I2R6Raw (a : PairSlot) : Ball := residualBall (below (shape 4 4 8)) A4_4_8Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 6 a +lemma CA4_4_8I2R6Raw_sound (a : PairSlot) : + (CA4_4_8I2R6Raw a).Encloses (CA4_4_8I2R6Value a) := by + exact residualBall_sound_on (below (shape 4 4 8)) A4_4_8Law (fun u => (stageALaw (shape 4 4 8) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A4_4_8Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 4 4 8) (show (shape 4 4 8) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 6 a +def CA4_4_8I2R6Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(1054220569280610738843304011 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(5310019086066608398805522157 / 12500000000000000000000000000000), (2857473 / 20000000000000000000000000000000)⟩ ⟨(-201476588137152768544991639014469 / 20000000000000000000000000000000), (169406601321 / 50000000000000000000000000000000)⟩ ⟨-15, 1054220569280610738843304011, 762939453125000000000000000⟩, + .log ⟨(265680321318957000479543 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(1049232282837749481896411 / 20000000000000000000000000000000), (171 / 10000000000000000000000000000000)⟩ ⟨(-394922844728915929810464907407031 / 20000000000000000000000000000000), (635651102687 / 100000000000000000000000000000000)⟩ ⟨-29, 265680321318957000479543, 186264514923095703125000⟩, + .log ⟨(442175225215818692390443759141 / 100000000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ ⟨(1198564415727487612447426992829 / 50000000000000000000000000000000), (842708241 / 100000000000000000000000000000000)⟩ ⟨(-542121922431310976489391241826871 / 100000000000000000000000000000000), (190582414051 / 100000000000000000000000000000000)⟩ ⟨-8, 442175225215818692390443759141, 390625000000000000000000000000⟩] +lemma CA4_4_8I2R6Certificates_valid : + CA4_4_8I2R6Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA4_4_8I2R6CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 5, 2 => 1 + | 5, 3 => 2 + | 4, 4 => 3 + | 2, 5 => 1 + | 3, 5 => 2 + | _, _ => 0 +def CA4_4_8I2R6P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA4_4_8I2R6Certificates (CA4_4_8I2R6CertificateIndex a)).input +lemma CA4_4_8I2R6P_check : ∀ a : PairSlot, contains (CA4_4_8I2R6Raw a) (CA4_4_8I2R6P a) = true := by + decide +kernel +lemma CA4_4_8I2R6P_sound (a : PairSlot) : + (CA4_4_8I2R6P a).Encloses (CA4_4_8I2R6Value a) := + contains_sound (CA4_4_8I2R6Raw_sound a) (CA4_4_8I2R6P_check a) +def CA4_4_8I2R6Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA4_4_8I2R6Certificates (CA4_4_8I2R6CertificateIndex a)).output +lemma CA4_4_8I2R6Terms_sound (a : PairSlot) : + (CA4_4_8I2R6Terms a).Encloses (Foundation.entropyTerm (CA4_4_8I2R6Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA4_4_8I2R6Certificates_valid + (CA4_4_8I2R6CertificateIndex a) (CA4_4_8I2R6P_sound a) +def CA4_4_8I2R6Entropy : Ball := ⟨(62052490728871733419264032607 / 2500000000000000000000000000000), (871286391 / 100000000000000000000000000000000)⟩ +lemma CA4_4_8I2R6Entropy_sound : CA4_4_8I2R6Entropy.Encloses (Foundation.finiteEntropy CA4_4_8I2R6Value) := by + exact contains_sound (entropyPair_enclosed CA4_4_8I2R6Value CA4_4_8I2R6Terms CA4_4_8I2R6Terms_sound) (by decide +kernel) +def CA4_4_8I2R6Mass : Ball := ⟨(90121904226141243243038230063 / 20000000000000000000000000000000), (1 / 12500000000000000000000000000000)⟩ +lemma CA4_4_8I2R6Mass_sound : CA4_4_8I2R6Mass.Encloses (∑ a, CA4_4_8I2R6Value a) := by + exact contains_sound (pairSumBall_sound CA4_4_8I2R6P CA4_4_8I2R6Value CA4_4_8I2R6P_sound) (by decide +kernel) +def CA4_4_8I2R6MassTermLogWitness : LogWitness := ⟨-8, 90121904226141243243038230063, 78125000000000000000000000000⟩ +def CA4_4_8I2R6MassTermLog : Ball := ⟨(-270116215365013740043416369183291 / 50000000000000000000000000000000), (95291207461 / 50000000000000000000000000000000)⟩ +lemma CA4_4_8I2R6MassTermLog_sound : CA4_4_8I2R6MassTermLog.Encloses (Real.log ((∑ a, CA4_4_8I2R6Value a))) := by + exact checkLog_sound logTwoBall_sound (CA4_4_8I2R6Mass_sound) (w := CA4_4_8I2R6MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA4_4_8I2R6MassTerm : Ball := ⟨(2434338769105351000162219863469 / 100000000000000000000000000000000), (858782551 / 100000000000000000000000000000000)⟩ +lemma CA4_4_8I2R6MassTerm_sound : CA4_4_8I2R6MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA4_4_8I2R6Value a))) := by + exact contains_sound (entropyTerm_ball (CA4_4_8I2R6Mass_sound) CA4_4_8I2R6MassTermLog_sound) (by decide +kernel) +def CA4_4_8I2R6H : Ball := ⟨(47760860049518336608341440811 / 100000000000000000000000000000000), (865034471 / 50000000000000000000000000000000)⟩ +lemma CA4_4_8I2R6H_sound : CA4_4_8I2R6H.Encloses (homogeneousEntropy CA4_4_8I2R6Value) := by + exact contains_sound (homogeneous_enclosed CA4_4_8I2R6Value CA4_4_8I2R6MassTerm_sound CA4_4_8I2R6Entropy_sound) (by decide +kernel) +def CA4_4_8I2R7Value (a : PairSlot) : ℝ := residualLaw (below (shape 4 4 8)) (fun u => (stageALaw (shape 4 4 8) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 7 a +def CA4_4_8I2R7Raw (a : PairSlot) : Ball := residualBall (below (shape 4 4 8)) A4_4_8Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 7 a +lemma CA4_4_8I2R7Raw_sound (a : PairSlot) : + (CA4_4_8I2R7Raw a).Encloses (CA4_4_8I2R7Value a) := by + exact residualBall_sound_on (below (shape 4 4 8)) A4_4_8Law (fun u => (stageALaw (shape 4 4 8) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A4_4_8Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 4 4 8) (show (shape 4 4 8) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 7 a +def CA4_4_8I2R7Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA4_4_8I2R7Certificates_valid : + CA4_4_8I2R7Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA4_4_8I2R7CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA4_4_8I2R7P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA4_4_8I2R7Certificates (CA4_4_8I2R7CertificateIndex a)).input +lemma CA4_4_8I2R7P_check : ∀ a : PairSlot, contains (CA4_4_8I2R7Raw a) (CA4_4_8I2R7P a) = true := by + decide +kernel +lemma CA4_4_8I2R7P_sound (a : PairSlot) : + (CA4_4_8I2R7P a).Encloses (CA4_4_8I2R7Value a) := + contains_sound (CA4_4_8I2R7Raw_sound a) (CA4_4_8I2R7P_check a) +def CA4_4_8I2R7Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA4_4_8I2R7Certificates (CA4_4_8I2R7CertificateIndex a)).output +lemma CA4_4_8I2R7Terms_sound (a : PairSlot) : + (CA4_4_8I2R7Terms a).Encloses (Foundation.entropyTerm (CA4_4_8I2R7Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA4_4_8I2R7Certificates_valid + (CA4_4_8I2R7CertificateIndex a) (CA4_4_8I2R7P_sound a) +def CA4_4_8I2R7Entropy : Ball := ⟨0, 0⟩ +lemma CA4_4_8I2R7Entropy_sound : CA4_4_8I2R7Entropy.Encloses (Foundation.finiteEntropy CA4_4_8I2R7Value) := by + exact contains_sound (entropyPair_enclosed CA4_4_8I2R7Value CA4_4_8I2R7Terms CA4_4_8I2R7Terms_sound) (by decide +kernel) +def CA4_4_8I2R7Mass : Ball := ⟨0, 0⟩ +lemma CA4_4_8I2R7Mass_sound : CA4_4_8I2R7Mass.Encloses (∑ a, CA4_4_8I2R7Value a) := by + exact contains_sound (pairSumBall_sound CA4_4_8I2R7P CA4_4_8I2R7Value CA4_4_8I2R7P_sound) (by decide +kernel) +def CA4_4_8I2R7MassTerm : Ball := .exact 0 +lemma CA4_4_8I2R7MassTerm_sound : CA4_4_8I2R7MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA4_4_8I2R7Value a))) := + entropyTerm_zero_ball (CA4_4_8I2R7Mass_sound) +def CA4_4_8I2R7H : Ball := ⟨0, 0⟩ +lemma CA4_4_8I2R7H_sound : CA4_4_8I2R7H.Encloses (homogeneousEntropy CA4_4_8I2R7Value) := by + exact contains_sound (homogeneous_enclosed CA4_4_8I2R7Value CA4_4_8I2R7MassTerm_sound CA4_4_8I2R7Entropy_sound) (by decide +kernel) +def CA4_4_8I2R8Value (a : PairSlot) : ℝ := residualLaw (below (shape 4 4 8)) (fun u => (stageALaw (shape 4 4 8) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 8 a +def CA4_4_8I2R8Raw (a : PairSlot) : Ball := residualBall (below (shape 4 4 8)) A4_4_8Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 8 a +lemma CA4_4_8I2R8Raw_sound (a : PairSlot) : + (CA4_4_8I2R8Raw a).Encloses (CA4_4_8I2R8Value a) := by + exact residualBall_sound_on (below (shape 4 4 8)) A4_4_8Law (fun u => (stageALaw (shape 4 4 8) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A4_4_8Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 4 4 8) (show (shape 4 4 8) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 8 a +def CA4_4_8I2R8Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA4_4_8I2R8Certificates_valid : + CA4_4_8I2R8Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA4_4_8I2R8CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA4_4_8I2R8P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA4_4_8I2R8Certificates (CA4_4_8I2R8CertificateIndex a)).input +lemma CA4_4_8I2R8P_check : ∀ a : PairSlot, contains (CA4_4_8I2R8Raw a) (CA4_4_8I2R8P a) = true := by + decide +kernel +lemma CA4_4_8I2R8P_sound (a : PairSlot) : + (CA4_4_8I2R8P a).Encloses (CA4_4_8I2R8Value a) := + contains_sound (CA4_4_8I2R8Raw_sound a) (CA4_4_8I2R8P_check a) +def CA4_4_8I2R8Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA4_4_8I2R8Certificates (CA4_4_8I2R8CertificateIndex a)).output +lemma CA4_4_8I2R8Terms_sound (a : PairSlot) : + (CA4_4_8I2R8Terms a).Encloses (Foundation.entropyTerm (CA4_4_8I2R8Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA4_4_8I2R8Certificates_valid + (CA4_4_8I2R8CertificateIndex a) (CA4_4_8I2R8P_sound a) +def CA4_4_8I2R8Entropy : Ball := ⟨0, 0⟩ +lemma CA4_4_8I2R8Entropy_sound : CA4_4_8I2R8Entropy.Encloses (Foundation.finiteEntropy CA4_4_8I2R8Value) := by + exact contains_sound (entropyPair_enclosed CA4_4_8I2R8Value CA4_4_8I2R8Terms CA4_4_8I2R8Terms_sound) (by decide +kernel) +def CA4_4_8I2R8Mass : Ball := ⟨0, 0⟩ +lemma CA4_4_8I2R8Mass_sound : CA4_4_8I2R8Mass.Encloses (∑ a, CA4_4_8I2R8Value a) := by + exact contains_sound (pairSumBall_sound CA4_4_8I2R8P CA4_4_8I2R8Value CA4_4_8I2R8P_sound) (by decide +kernel) +def CA4_4_8I2R8MassTerm : Ball := .exact 0 +lemma CA4_4_8I2R8MassTerm_sound : CA4_4_8I2R8MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA4_4_8I2R8Value a))) := + entropyTerm_zero_ball (CA4_4_8I2R8Mass_sound) +def CA4_4_8I2R8H : Ball := ⟨0, 0⟩ +lemma CA4_4_8I2R8H_sound : CA4_4_8I2R8H.Encloses (homogeneousEntropy CA4_4_8I2R8Value) := by + exact contains_sound (homogeneous_enclosed CA4_4_8I2R8Value CA4_4_8I2R8MassTerm_sound CA4_4_8I2R8Entropy_sound) (by decide +kernel) +def CA4_4_8I2R9Value (a : PairSlot) : ℝ := residualLaw (below (shape 4 4 8)) (fun u => (stageALaw (shape 4 4 8) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 9 a +def CA4_4_8I2R9Raw (a : PairSlot) : Ball := residualBall (below (shape 4 4 8)) A4_4_8Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 9 a +lemma CA4_4_8I2R9Raw_sound (a : PairSlot) : + (CA4_4_8I2R9Raw a).Encloses (CA4_4_8I2R9Value a) := by + exact residualBall_sound_on (below (shape 4 4 8)) A4_4_8Law (fun u => (stageALaw (shape 4 4 8) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A4_4_8Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 4 4 8) (show (shape 4 4 8) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 9 a +def CA4_4_8I2R9Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA4_4_8I2R9Certificates_valid : + CA4_4_8I2R9Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA4_4_8I2R9CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA4_4_8I2R9P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA4_4_8I2R9Certificates (CA4_4_8I2R9CertificateIndex a)).input +lemma CA4_4_8I2R9P_check : ∀ a : PairSlot, contains (CA4_4_8I2R9Raw a) (CA4_4_8I2R9P a) = true := by + decide +kernel +lemma CA4_4_8I2R9P_sound (a : PairSlot) : + (CA4_4_8I2R9P a).Encloses (CA4_4_8I2R9Value a) := + contains_sound (CA4_4_8I2R9Raw_sound a) (CA4_4_8I2R9P_check a) +def CA4_4_8I2R9Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA4_4_8I2R9Certificates (CA4_4_8I2R9CertificateIndex a)).output +lemma CA4_4_8I2R9Terms_sound (a : PairSlot) : + (CA4_4_8I2R9Terms a).Encloses (Foundation.entropyTerm (CA4_4_8I2R9Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA4_4_8I2R9Certificates_valid + (CA4_4_8I2R9CertificateIndex a) (CA4_4_8I2R9P_sound a) +def CA4_4_8I2R9Entropy : Ball := ⟨0, 0⟩ +lemma CA4_4_8I2R9Entropy_sound : CA4_4_8I2R9Entropy.Encloses (Foundation.finiteEntropy CA4_4_8I2R9Value) := by + exact contains_sound (entropyPair_enclosed CA4_4_8I2R9Value CA4_4_8I2R9Terms CA4_4_8I2R9Terms_sound) (by decide +kernel) +def CA4_4_8I2R9Mass : Ball := ⟨0, 0⟩ +lemma CA4_4_8I2R9Mass_sound : CA4_4_8I2R9Mass.Encloses (∑ a, CA4_4_8I2R9Value a) := by + exact contains_sound (pairSumBall_sound CA4_4_8I2R9P CA4_4_8I2R9Value CA4_4_8I2R9P_sound) (by decide +kernel) +def CA4_4_8I2R9MassTerm : Ball := .exact 0 +lemma CA4_4_8I2R9MassTerm_sound : CA4_4_8I2R9MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA4_4_8I2R9Value a))) := + entropyTerm_zero_ball (CA4_4_8I2R9Mass_sound) +def CA4_4_8I2R9H : Ball := ⟨0, 0⟩ +lemma CA4_4_8I2R9H_sound : CA4_4_8I2R9H.Encloses (homogeneousEntropy CA4_4_8I2R9Value) := by + exact contains_sound (homogeneous_enclosed CA4_4_8I2R9Value CA4_4_8I2R9MassTerm_sound CA4_4_8I2R9Entropy_sound) (by decide +kernel) +def CA4_4_8I2R10Value (a : PairSlot) : ℝ := residualLaw (below (shape 4 4 8)) (fun u => (stageALaw (shape 4 4 8) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 10 a +def CA4_4_8I2R10Raw (a : PairSlot) : Ball := residualBall (below (shape 4 4 8)) A4_4_8Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 10 a +lemma CA4_4_8I2R10Raw_sound (a : PairSlot) : + (CA4_4_8I2R10Raw a).Encloses (CA4_4_8I2R10Value a) := by + exact residualBall_sound_on (below (shape 4 4 8)) A4_4_8Law (fun u => (stageALaw (shape 4 4 8) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A4_4_8Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 4 4 8) (show (shape 4 4 8) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 10 a +def CA4_4_8I2R10Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA4_4_8I2R10Certificates_valid : + CA4_4_8I2R10Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA4_4_8I2R10CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA4_4_8I2R10P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA4_4_8I2R10Certificates (CA4_4_8I2R10CertificateIndex a)).input +lemma CA4_4_8I2R10P_check : ∀ a : PairSlot, contains (CA4_4_8I2R10Raw a) (CA4_4_8I2R10P a) = true := by + decide +kernel +lemma CA4_4_8I2R10P_sound (a : PairSlot) : + (CA4_4_8I2R10P a).Encloses (CA4_4_8I2R10Value a) := + contains_sound (CA4_4_8I2R10Raw_sound a) (CA4_4_8I2R10P_check a) +def CA4_4_8I2R10Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA4_4_8I2R10Certificates (CA4_4_8I2R10CertificateIndex a)).output +lemma CA4_4_8I2R10Terms_sound (a : PairSlot) : + (CA4_4_8I2R10Terms a).Encloses (Foundation.entropyTerm (CA4_4_8I2R10Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA4_4_8I2R10Certificates_valid + (CA4_4_8I2R10CertificateIndex a) (CA4_4_8I2R10P_sound a) +def CA4_4_8I2R10Entropy : Ball := ⟨0, 0⟩ +lemma CA4_4_8I2R10Entropy_sound : CA4_4_8I2R10Entropy.Encloses (Foundation.finiteEntropy CA4_4_8I2R10Value) := by + exact contains_sound (entropyPair_enclosed CA4_4_8I2R10Value CA4_4_8I2R10Terms CA4_4_8I2R10Terms_sound) (by decide +kernel) +def CA4_4_8I2R10Mass : Ball := ⟨0, 0⟩ +lemma CA4_4_8I2R10Mass_sound : CA4_4_8I2R10Mass.Encloses (∑ a, CA4_4_8I2R10Value a) := by + exact contains_sound (pairSumBall_sound CA4_4_8I2R10P CA4_4_8I2R10Value CA4_4_8I2R10P_sound) (by decide +kernel) +def CA4_4_8I2R10MassTerm : Ball := .exact 0 +lemma CA4_4_8I2R10MassTerm_sound : CA4_4_8I2R10MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA4_4_8I2R10Value a))) := + entropyTerm_zero_ball (CA4_4_8I2R10Mass_sound) +def CA4_4_8I2R10H : Ball := ⟨0, 0⟩ +lemma CA4_4_8I2R10H_sound : CA4_4_8I2R10H.Encloses (homogeneousEntropy CA4_4_8I2R10Value) := by + exact contains_sound (homogeneous_enclosed CA4_4_8I2R10Value CA4_4_8I2R10MassTerm_sound CA4_4_8I2R10Entropy_sound) (by decide +kernel) +def CA4_4_8I2R11Value (a : PairSlot) : ℝ := residualLaw (below (shape 4 4 8)) (fun u => (stageALaw (shape 4 4 8) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 11 a +def CA4_4_8I2R11Raw (a : PairSlot) : Ball := residualBall (below (shape 4 4 8)) A4_4_8Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 11 a +lemma CA4_4_8I2R11Raw_sound (a : PairSlot) : + (CA4_4_8I2R11Raw a).Encloses (CA4_4_8I2R11Value a) := by + exact residualBall_sound_on (below (shape 4 4 8)) A4_4_8Law (fun u => (stageALaw (shape 4 4 8) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A4_4_8Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 4 4 8) (show (shape 4 4 8) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 11 a +def CA4_4_8I2R11Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA4_4_8I2R11Certificates_valid : + CA4_4_8I2R11Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA4_4_8I2R11CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA4_4_8I2R11P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA4_4_8I2R11Certificates (CA4_4_8I2R11CertificateIndex a)).input +lemma CA4_4_8I2R11P_check : ∀ a : PairSlot, contains (CA4_4_8I2R11Raw a) (CA4_4_8I2R11P a) = true := by + decide +kernel +lemma CA4_4_8I2R11P_sound (a : PairSlot) : + (CA4_4_8I2R11P a).Encloses (CA4_4_8I2R11Value a) := + contains_sound (CA4_4_8I2R11Raw_sound a) (CA4_4_8I2R11P_check a) +def CA4_4_8I2R11Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA4_4_8I2R11Certificates (CA4_4_8I2R11CertificateIndex a)).output +lemma CA4_4_8I2R11Terms_sound (a : PairSlot) : + (CA4_4_8I2R11Terms a).Encloses (Foundation.entropyTerm (CA4_4_8I2R11Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA4_4_8I2R11Certificates_valid + (CA4_4_8I2R11CertificateIndex a) (CA4_4_8I2R11P_sound a) +def CA4_4_8I2R11Entropy : Ball := ⟨0, 0⟩ +lemma CA4_4_8I2R11Entropy_sound : CA4_4_8I2R11Entropy.Encloses (Foundation.finiteEntropy CA4_4_8I2R11Value) := by + exact contains_sound (entropyPair_enclosed CA4_4_8I2R11Value CA4_4_8I2R11Terms CA4_4_8I2R11Terms_sound) (by decide +kernel) +def CA4_4_8I2R11Mass : Ball := ⟨0, 0⟩ +lemma CA4_4_8I2R11Mass_sound : CA4_4_8I2R11Mass.Encloses (∑ a, CA4_4_8I2R11Value a) := by + exact contains_sound (pairSumBall_sound CA4_4_8I2R11P CA4_4_8I2R11Value CA4_4_8I2R11P_sound) (by decide +kernel) +def CA4_4_8I2R11MassTerm : Ball := .exact 0 +lemma CA4_4_8I2R11MassTerm_sound : CA4_4_8I2R11MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA4_4_8I2R11Value a))) := + entropyTerm_zero_ball (CA4_4_8I2R11Mass_sound) +def CA4_4_8I2R11H : Ball := ⟨0, 0⟩ +lemma CA4_4_8I2R11H_sound : CA4_4_8I2R11H.Encloses (homogeneousEntropy CA4_4_8I2R11Value) := by + exact contains_sound (homogeneous_enclosed CA4_4_8I2R11Value CA4_4_8I2R11MassTerm_sound CA4_4_8I2R11Entropy_sound) (by decide +kernel) +def CA4_4_8I2R12Value (a : PairSlot) : ℝ := residualLaw (below (shape 4 4 8)) (fun u => (stageALaw (shape 4 4 8) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 12 a +def CA4_4_8I2R12Raw (a : PairSlot) : Ball := residualBall (below (shape 4 4 8)) A4_4_8Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 12 a +lemma CA4_4_8I2R12Raw_sound (a : PairSlot) : + (CA4_4_8I2R12Raw a).Encloses (CA4_4_8I2R12Value a) := by + exact residualBall_sound_on (below (shape 4 4 8)) A4_4_8Law (fun u => (stageALaw (shape 4 4 8) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A4_4_8Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 4 4 8) (show (shape 4 4 8) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 12 a +def CA4_4_8I2R12Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA4_4_8I2R12Certificates_valid : + CA4_4_8I2R12Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA4_4_8I2R12CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA4_4_8I2R12P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA4_4_8I2R12Certificates (CA4_4_8I2R12CertificateIndex a)).input +lemma CA4_4_8I2R12P_check : ∀ a : PairSlot, contains (CA4_4_8I2R12Raw a) (CA4_4_8I2R12P a) = true := by + decide +kernel +lemma CA4_4_8I2R12P_sound (a : PairSlot) : + (CA4_4_8I2R12P a).Encloses (CA4_4_8I2R12Value a) := + contains_sound (CA4_4_8I2R12Raw_sound a) (CA4_4_8I2R12P_check a) +def CA4_4_8I2R12Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA4_4_8I2R12Certificates (CA4_4_8I2R12CertificateIndex a)).output +lemma CA4_4_8I2R12Terms_sound (a : PairSlot) : + (CA4_4_8I2R12Terms a).Encloses (Foundation.entropyTerm (CA4_4_8I2R12Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA4_4_8I2R12Certificates_valid + (CA4_4_8I2R12CertificateIndex a) (CA4_4_8I2R12P_sound a) +def CA4_4_8I2R12Entropy : Ball := ⟨0, 0⟩ +lemma CA4_4_8I2R12Entropy_sound : CA4_4_8I2R12Entropy.Encloses (Foundation.finiteEntropy CA4_4_8I2R12Value) := by + exact contains_sound (entropyPair_enclosed CA4_4_8I2R12Value CA4_4_8I2R12Terms CA4_4_8I2R12Terms_sound) (by decide +kernel) +def CA4_4_8I2R12Mass : Ball := ⟨0, 0⟩ +lemma CA4_4_8I2R12Mass_sound : CA4_4_8I2R12Mass.Encloses (∑ a, CA4_4_8I2R12Value a) := by + exact contains_sound (pairSumBall_sound CA4_4_8I2R12P CA4_4_8I2R12Value CA4_4_8I2R12P_sound) (by decide +kernel) +def CA4_4_8I2R12MassTerm : Ball := .exact 0 +lemma CA4_4_8I2R12MassTerm_sound : CA4_4_8I2R12MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA4_4_8I2R12Value a))) := + entropyTerm_zero_ball (CA4_4_8I2R12Mass_sound) +def CA4_4_8I2R12H : Ball := ⟨0, 0⟩ +lemma CA4_4_8I2R12H_sound : CA4_4_8I2R12H.Encloses (homogeneousEntropy CA4_4_8I2R12Value) := by + exact contains_sound (homogeneous_enclosed CA4_4_8I2R12Value CA4_4_8I2R12MassTerm_sound CA4_4_8I2R12Entropy_sound) (by decide +kernel) +def CA4_4_8I2R13Value (a : PairSlot) : ℝ := residualLaw (below (shape 4 4 8)) (fun u => (stageALaw (shape 4 4 8) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 13 a +def CA4_4_8I2R13Raw (a : PairSlot) : Ball := residualBall (below (shape 4 4 8)) A4_4_8Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 13 a +lemma CA4_4_8I2R13Raw_sound (a : PairSlot) : + (CA4_4_8I2R13Raw a).Encloses (CA4_4_8I2R13Value a) := by + exact residualBall_sound_on (below (shape 4 4 8)) A4_4_8Law (fun u => (stageALaw (shape 4 4 8) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A4_4_8Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 4 4 8) (show (shape 4 4 8) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 13 a +def CA4_4_8I2R13Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA4_4_8I2R13Certificates_valid : + CA4_4_8I2R13Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA4_4_8I2R13CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA4_4_8I2R13P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA4_4_8I2R13Certificates (CA4_4_8I2R13CertificateIndex a)).input +lemma CA4_4_8I2R13P_check : ∀ a : PairSlot, contains (CA4_4_8I2R13Raw a) (CA4_4_8I2R13P a) = true := by + decide +kernel +lemma CA4_4_8I2R13P_sound (a : PairSlot) : + (CA4_4_8I2R13P a).Encloses (CA4_4_8I2R13Value a) := + contains_sound (CA4_4_8I2R13Raw_sound a) (CA4_4_8I2R13P_check a) +def CA4_4_8I2R13Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA4_4_8I2R13Certificates (CA4_4_8I2R13CertificateIndex a)).output +lemma CA4_4_8I2R13Terms_sound (a : PairSlot) : + (CA4_4_8I2R13Terms a).Encloses (Foundation.entropyTerm (CA4_4_8I2R13Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA4_4_8I2R13Certificates_valid + (CA4_4_8I2R13CertificateIndex a) (CA4_4_8I2R13P_sound a) +def CA4_4_8I2R13Entropy : Ball := ⟨0, 0⟩ +lemma CA4_4_8I2R13Entropy_sound : CA4_4_8I2R13Entropy.Encloses (Foundation.finiteEntropy CA4_4_8I2R13Value) := by + exact contains_sound (entropyPair_enclosed CA4_4_8I2R13Value CA4_4_8I2R13Terms CA4_4_8I2R13Terms_sound) (by decide +kernel) +def CA4_4_8I2R13Mass : Ball := ⟨0, 0⟩ +lemma CA4_4_8I2R13Mass_sound : CA4_4_8I2R13Mass.Encloses (∑ a, CA4_4_8I2R13Value a) := by + exact contains_sound (pairSumBall_sound CA4_4_8I2R13P CA4_4_8I2R13Value CA4_4_8I2R13P_sound) (by decide +kernel) +def CA4_4_8I2R13MassTerm : Ball := .exact 0 +lemma CA4_4_8I2R13MassTerm_sound : CA4_4_8I2R13MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA4_4_8I2R13Value a))) := + entropyTerm_zero_ball (CA4_4_8I2R13Mass_sound) +def CA4_4_8I2R13H : Ball := ⟨0, 0⟩ +lemma CA4_4_8I2R13H_sound : CA4_4_8I2R13H.Encloses (homogeneousEntropy CA4_4_8I2R13Value) := by + exact contains_sound (homogeneous_enclosed CA4_4_8I2R13Value CA4_4_8I2R13MassTerm_sound CA4_4_8I2R13Entropy_sound) (by decide +kernel) +def CA4_4_8I2R14Value (a : PairSlot) : ℝ := residualLaw (below (shape 4 4 8)) (fun u => (stageALaw (shape 4 4 8) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 14 a +def CA4_4_8I2R14Raw (a : PairSlot) : Ball := residualBall (below (shape 4 4 8)) A4_4_8Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 14 a +lemma CA4_4_8I2R14Raw_sound (a : PairSlot) : + (CA4_4_8I2R14Raw a).Encloses (CA4_4_8I2R14Value a) := by + exact residualBall_sound_on (below (shape 4 4 8)) A4_4_8Law (fun u => (stageALaw (shape 4 4 8) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A4_4_8Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 4 4 8) (show (shape 4 4 8) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 14 a +def CA4_4_8I2R14Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA4_4_8I2R14Certificates_valid : + CA4_4_8I2R14Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA4_4_8I2R14CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA4_4_8I2R14P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA4_4_8I2R14Certificates (CA4_4_8I2R14CertificateIndex a)).input +lemma CA4_4_8I2R14P_check : ∀ a : PairSlot, contains (CA4_4_8I2R14Raw a) (CA4_4_8I2R14P a) = true := by + decide +kernel +lemma CA4_4_8I2R14P_sound (a : PairSlot) : + (CA4_4_8I2R14P a).Encloses (CA4_4_8I2R14Value a) := + contains_sound (CA4_4_8I2R14Raw_sound a) (CA4_4_8I2R14P_check a) +def CA4_4_8I2R14Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA4_4_8I2R14Certificates (CA4_4_8I2R14CertificateIndex a)).output +lemma CA4_4_8I2R14Terms_sound (a : PairSlot) : + (CA4_4_8I2R14Terms a).Encloses (Foundation.entropyTerm (CA4_4_8I2R14Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA4_4_8I2R14Certificates_valid + (CA4_4_8I2R14CertificateIndex a) (CA4_4_8I2R14P_sound a) +def CA4_4_8I2R14Entropy : Ball := ⟨0, 0⟩ +lemma CA4_4_8I2R14Entropy_sound : CA4_4_8I2R14Entropy.Encloses (Foundation.finiteEntropy CA4_4_8I2R14Value) := by + exact contains_sound (entropyPair_enclosed CA4_4_8I2R14Value CA4_4_8I2R14Terms CA4_4_8I2R14Terms_sound) (by decide +kernel) +def CA4_4_8I2R14Mass : Ball := ⟨0, 0⟩ +lemma CA4_4_8I2R14Mass_sound : CA4_4_8I2R14Mass.Encloses (∑ a, CA4_4_8I2R14Value a) := by + exact contains_sound (pairSumBall_sound CA4_4_8I2R14P CA4_4_8I2R14Value CA4_4_8I2R14P_sound) (by decide +kernel) +def CA4_4_8I2R14MassTerm : Ball := .exact 0 +lemma CA4_4_8I2R14MassTerm_sound : CA4_4_8I2R14MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA4_4_8I2R14Value a))) := + entropyTerm_zero_ball (CA4_4_8I2R14Mass_sound) +def CA4_4_8I2R14H : Ball := ⟨0, 0⟩ +lemma CA4_4_8I2R14H_sound : CA4_4_8I2R14H.Encloses (homogeneousEntropy CA4_4_8I2R14Value) := by + exact contains_sound (homogeneous_enclosed CA4_4_8I2R14Value CA4_4_8I2R14MassTerm_sound CA4_4_8I2R14Entropy_sound) (by decide +kernel) +def CA4_4_8I2R15Value (a : PairSlot) : ℝ := residualLaw (below (shape 4 4 8)) (fun u => (stageALaw (shape 4 4 8) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 15 a +def CA4_4_8I2R15Raw (a : PairSlot) : Ball := residualBall (below (shape 4 4 8)) A4_4_8Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 15 a +lemma CA4_4_8I2R15Raw_sound (a : PairSlot) : + (CA4_4_8I2R15Raw a).Encloses (CA4_4_8I2R15Value a) := by + exact residualBall_sound_on (below (shape 4 4 8)) A4_4_8Law (fun u => (stageALaw (shape 4 4 8) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A4_4_8Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 4 4 8) (show (shape 4 4 8) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 15 a +def CA4_4_8I2R15Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA4_4_8I2R15Certificates_valid : + CA4_4_8I2R15Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA4_4_8I2R15CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA4_4_8I2R15P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA4_4_8I2R15Certificates (CA4_4_8I2R15CertificateIndex a)).input +lemma CA4_4_8I2R15P_check : ∀ a : PairSlot, contains (CA4_4_8I2R15Raw a) (CA4_4_8I2R15P a) = true := by + decide +kernel +lemma CA4_4_8I2R15P_sound (a : PairSlot) : + (CA4_4_8I2R15P a).Encloses (CA4_4_8I2R15Value a) := + contains_sound (CA4_4_8I2R15Raw_sound a) (CA4_4_8I2R15P_check a) +def CA4_4_8I2R15Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA4_4_8I2R15Certificates (CA4_4_8I2R15CertificateIndex a)).output +lemma CA4_4_8I2R15Terms_sound (a : PairSlot) : + (CA4_4_8I2R15Terms a).Encloses (Foundation.entropyTerm (CA4_4_8I2R15Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA4_4_8I2R15Certificates_valid + (CA4_4_8I2R15CertificateIndex a) (CA4_4_8I2R15P_sound a) +def CA4_4_8I2R15Entropy : Ball := ⟨0, 0⟩ +lemma CA4_4_8I2R15Entropy_sound : CA4_4_8I2R15Entropy.Encloses (Foundation.finiteEntropy CA4_4_8I2R15Value) := by + exact contains_sound (entropyPair_enclosed CA4_4_8I2R15Value CA4_4_8I2R15Terms CA4_4_8I2R15Terms_sound) (by decide +kernel) +def CA4_4_8I2R15Mass : Ball := ⟨0, 0⟩ +lemma CA4_4_8I2R15Mass_sound : CA4_4_8I2R15Mass.Encloses (∑ a, CA4_4_8I2R15Value a) := by + exact contains_sound (pairSumBall_sound CA4_4_8I2R15P CA4_4_8I2R15Value CA4_4_8I2R15P_sound) (by decide +kernel) +def CA4_4_8I2R15MassTerm : Ball := .exact 0 +lemma CA4_4_8I2R15MassTerm_sound : CA4_4_8I2R15MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA4_4_8I2R15Value a))) := + entropyTerm_zero_ball (CA4_4_8I2R15Mass_sound) +def CA4_4_8I2R15H : Ball := ⟨0, 0⟩ +lemma CA4_4_8I2R15H_sound : CA4_4_8I2R15H.Encloses (homogeneousEntropy CA4_4_8I2R15Value) := by + exact contains_sound (homogeneous_enclosed CA4_4_8I2R15Value CA4_4_8I2R15MassTerm_sound CA4_4_8I2R15Entropy_sound) (by decide +kernel) +def CA4_4_8I2R16Value (a : PairSlot) : ℝ := residualLaw (below (shape 4 4 8)) (fun u => (stageALaw (shape 4 4 8) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 16 a +def CA4_4_8I2R16Raw (a : PairSlot) : Ball := residualBall (below (shape 4 4 8)) A4_4_8Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 16 a +lemma CA4_4_8I2R16Raw_sound (a : PairSlot) : + (CA4_4_8I2R16Raw a).Encloses (CA4_4_8I2R16Value a) := by + exact residualBall_sound_on (below (shape 4 4 8)) A4_4_8Law (fun u => (stageALaw (shape 4 4 8) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A4_4_8Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 4 4 8) (show (shape 4 4 8) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 16 a +def CA4_4_8I2R16Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA4_4_8I2R16Certificates_valid : + CA4_4_8I2R16Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA4_4_8I2R16CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA4_4_8I2R16P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA4_4_8I2R16Certificates (CA4_4_8I2R16CertificateIndex a)).input +lemma CA4_4_8I2R16P_check : ∀ a : PairSlot, contains (CA4_4_8I2R16Raw a) (CA4_4_8I2R16P a) = true := by + decide +kernel +lemma CA4_4_8I2R16P_sound (a : PairSlot) : + (CA4_4_8I2R16P a).Encloses (CA4_4_8I2R16Value a) := + contains_sound (CA4_4_8I2R16Raw_sound a) (CA4_4_8I2R16P_check a) +def CA4_4_8I2R16Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA4_4_8I2R16Certificates (CA4_4_8I2R16CertificateIndex a)).output +lemma CA4_4_8I2R16Terms_sound (a : PairSlot) : + (CA4_4_8I2R16Terms a).Encloses (Foundation.entropyTerm (CA4_4_8I2R16Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA4_4_8I2R16Certificates_valid + (CA4_4_8I2R16CertificateIndex a) (CA4_4_8I2R16P_sound a) +def CA4_4_8I2R16Entropy : Ball := ⟨0, 0⟩ +lemma CA4_4_8I2R16Entropy_sound : CA4_4_8I2R16Entropy.Encloses (Foundation.finiteEntropy CA4_4_8I2R16Value) := by + exact contains_sound (entropyPair_enclosed CA4_4_8I2R16Value CA4_4_8I2R16Terms CA4_4_8I2R16Terms_sound) (by decide +kernel) +def CA4_4_8I2R16Mass : Ball := ⟨0, 0⟩ +lemma CA4_4_8I2R16Mass_sound : CA4_4_8I2R16Mass.Encloses (∑ a, CA4_4_8I2R16Value a) := by + exact contains_sound (pairSumBall_sound CA4_4_8I2R16P CA4_4_8I2R16Value CA4_4_8I2R16P_sound) (by decide +kernel) +def CA4_4_8I2R16MassTerm : Ball := .exact 0 +lemma CA4_4_8I2R16MassTerm_sound : CA4_4_8I2R16MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA4_4_8I2R16Value a))) := + entropyTerm_zero_ball (CA4_4_8I2R16Mass_sound) +def CA4_4_8I2R16H : Ball := ⟨0, 0⟩ +lemma CA4_4_8I2R16H_sound : CA4_4_8I2R16H.Encloses (homogeneousEntropy CA4_4_8I2R16Value) := by + exact contains_sound (homogeneous_enclosed CA4_4_8I2R16Value CA4_4_8I2R16MassTerm_sound CA4_4_8I2R16Entropy_sound) (by decide +kernel) +def CA4_4_8I2ResidualEntropies (a : Fin 17) : Ball := + match a.val with + | 0 => CA4_4_8I2R0H + | 1 => CA4_4_8I2R1H + | 2 => CA4_4_8I2R2H + | 3 => CA4_4_8I2R3H + | 4 => CA4_4_8I2R4H + | 5 => CA4_4_8I2R5H + | 6 => CA4_4_8I2R6H + | 7 => CA4_4_8I2R7H + | 8 => CA4_4_8I2R8H + | 9 => CA4_4_8I2R9H + | 10 => CA4_4_8I2R10H + | 11 => CA4_4_8I2R11H + | 12 => CA4_4_8I2R12H + | 13 => CA4_4_8I2R13H + | 14 => CA4_4_8I2R14H + | 15 => CA4_4_8I2R15H + | 16 => CA4_4_8I2R16H + | _ => (.exact 0) +lemma CA4_4_8I2ResidualEntropies_sound (k : Fin 17) : + (CA4_4_8I2ResidualEntropies k).Encloses (homogeneousEntropy + (residualLaw (below (shape 4 4 8)) (fun u => (stageALaw (shape 4 4 8) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) k)) := by + fin_cases k + · exact CA4_4_8I2R0H_sound + · exact CA4_4_8I2R1H_sound + · exact CA4_4_8I2R2H_sound + · exact CA4_4_8I2R3H_sound + · exact CA4_4_8I2R4H_sound + · exact CA4_4_8I2R5H_sound + · exact CA4_4_8I2R6H_sound + · exact CA4_4_8I2R7H_sound + · exact CA4_4_8I2R8H_sound + · exact CA4_4_8I2R9H_sound + · exact CA4_4_8I2R10H_sound + · exact CA4_4_8I2R11H_sound + · exact CA4_4_8I2R12H_sound + · exact CA4_4_8I2R13H_sound + · exact CA4_4_8I2R14H_sound + · exact CA4_4_8I2R15H_sound + · exact CA4_4_8I2R16H_sound +def CA4_4_8I2Singles (s : Shape) : Ball := + match s 0, s 1, s 2 with + | 0, 0, 8 => Z0_0_8H2H + | 0, 1, 7 => Z0_1_7H2H + | 0, 2, 6 => Z0_2_6H2H + | 0, 3, 5 => Z0_3_5H2H + | 0, 4, 4 => Z0_4_4H2H + | 1, 0, 7 => Z1_0_7H2H + | 2, 0, 6 => Z2_0_6H2H + | 3, 0, 5 => Z3_0_5H2H + | 4, 0, 4 => Z4_0_4H2H + | _, _, _ => (.exact 0) +lemma CA4_4_8I2Singles_sound (u : Shape) (hu : u ∈ below (shape 4 4 8)) + (hd : designated (Equiv.refl (Fin 3)) 2 u) : + (CA4_4_8I2Singles u).Encloses (homogeneousEntropy ((fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) u)) := by + rw [A4_4_8_below] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl + · exact Z0_0_8H2H_sound + · exact Z0_1_7H2H_sound + · exact Z0_2_6H2H_sound + · exact Z0_3_5H2H_sound + · exact Z0_4_4H2H_sound + · exact Z1_0_7H2H_sound + · exact (show ¬ designated (Equiv.refl (Fin 3)) 2 (shape 1 1 6) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 2 (shape 1 2 5) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 2 (shape 1 3 4) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 2 (shape 1 4 3) by decide +kernel) hd |>.elim + · exact Z2_0_6H2H_sound + · exact (show ¬ designated (Equiv.refl (Fin 3)) 2 (shape 2 1 5) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 2 (shape 2 2 4) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 2 (shape 2 3 3) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 2 (shape 2 4 2) by decide +kernel) hd |>.elim + · exact Z3_0_5H2H_sound + · exact (show ¬ designated (Equiv.refl (Fin 3)) 2 (shape 3 1 4) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 2 (shape 3 2 3) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 2 (shape 3 3 2) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 2 (shape 3 4 1) by decide +kernel) hd |>.elim + · exact Z4_0_4H2H_sound + · exact (show ¬ designated (Equiv.refl (Fin 3)) 2 (shape 4 1 3) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 2 (shape 4 2 2) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 2 (shape 4 3 1) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 2 (shape 4 4 0) by decide +kernel) hd |>.elim +def CA4_4_8I2Singleton : Ball := ⟨(6400259021839332148975225827439 / 100000000000000000000000000000000), (2472876643 / 50000000000000000000000000000000)⟩ +lemma CA4_4_8I2Singleton_sound : CA4_4_8I2Singleton.Encloses + (singletonEntropy (below (shape 4 4 8)) (fun u => (stageALaw (shape 4 4 8) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ))) := by + exact contains_sound (singletonBall_sound (below (shape 4 4 8)) A4_4_8Law (fun u => (stageALaw (shape 4 4 8) u : ℝ)) (Equiv.refl (Fin 3)) 2 + CA4_4_8I2Singles (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A4_4_8Law_sound u) CA4_4_8I2Singles_sound) (by decide +kernel) +def CA4_4_8I2Group : Ball := ⟨(44503910967582653980176509309439 / 50000000000000000000000000000000), (148006563669 / 100000000000000000000000000000000)⟩ +lemma CA4_4_8I2Group_sound : CA4_4_8I2Group.Encloses + (groupedEntropy (below (shape 4 4 8)) (fun u => (stageALaw (shape 4 4 8) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ))) := by + exact contains_sound (Ball.add_sound CA4_4_8I2Singleton_sound + (finSumBall_sound 17 CA4_4_8I2ResidualEntropies _ CA4_4_8I2ResidualEntropies_sound)) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CA4_4_8I2H : Ball := ⟨(99575014003799578575617859383359 / 100000000000000000000000000000000), (453154407911 / 100000000000000000000000000000000)⟩ +lemma CA4_4_8I2_sound : CA4_4_8I2H.Encloses (stageACapacity (shape 4 4 8) 2) := by + have hb := contains_sound (Ball.add_sound CA4_4_8I2PairH_sound + (Ball.neg_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) CA4_4_8I2Group_sound))) + (show contains (.add CA4_4_8I2PairH (.neg (.mul (.exact 2) CA4_4_8I2Group))) CA4_4_8I2H = true by decide +kernel) + simp only [stageACapacity, nativeCapacity, + show (2 : Fin 3) ≠ 0 by decide, ite_false, sub_eq_add_neg] + exact hb + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA4_4_8I2Pair.lean b/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA4_4_8I2Pair.lean new file mode 100644 index 0000000000000000000000000000000000000000..c614c9fc4576bc99a95bbec77a9589ef7dced7a2 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA4_4_8I2Pair.lean @@ -0,0 +1,378 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Certificates.SupportedContraction + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CA4_4_8I2PairValue (a : PairSlot × PairSlot) : ℝ := pairLaw (below (shape 4 4 8)) (shape 4 4 8) (fun u => (stageALaw (shape 4 4 8) u : ℝ)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) a +def CA4_4_8I2PairRaw (a : PairSlot × PairSlot) : Ball := stageAPairBall (shape 4 4 8) A4_4_8Law 2 a +lemma CA4_4_8I2PairRaw_sound (a : PairSlot × PairSlot) : + (CA4_4_8I2PairRaw a).Encloses (CA4_4_8I2PairValue a) := by + exact stageAPairBall_sound (shape 4 4 8) (by decide +kernel) A4_4_8Law (fun u => (stageALaw (shape 4 4 8) u : ℝ)) (fun u _ => A4_4_8Law_sound u) 2 a +def CA4_4_8I2PairCertificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(3035600478242196747209827 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(100885900988501493060513433 / 100000000000000000000000000000000), (32159 / 100000000000000000000000000000000)⟩ ⟨(-415428107682506870021708107576163 / 25000000000000000000000000000000), (6617650791 / 1250000000000000000000000000000)⟩ ⟨-24, 3035600478242196747209827, 2980232238769531250000000⟩, + .log ⟨(809072654081018314756371891 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(8925402172083562457434709647 / 50000000000000000000000000000000), (2912579 / 50000000000000000000000000000000)⟩ ⟨(-1103164484309686875569048800251713 / 100000000000000000000000000000000), (359989064409 / 100000000000000000000000000000000)⟩ ⟨-16, 809072654081018314756371891, 762939453125000000000000000⟩, + .log ⟨(2750679877070495563891136347 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(24458053691093193815721505683 / 20000000000000000000000000000000), (40773549 / 100000000000000000000000000000000)⟩ ⟨(-444581972169391281718443516194209 / 50000000000000000000000000000000), (18528846177 / 6250000000000000000000000000000)⟩ ⟨-13, 2750679877070495563891136347, 2441406250000000000000000000⟩, + .log ⟨(1344323656511829158575919399 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(15079324748227649818003656727 / 100000000000000000000000000000000), (2562051 / 50000000000000000000000000000000)⟩ ⟨(-1121703443600373905858482516304113 / 100000000000000000000000000000000), (381164900681 / 100000000000000000000000000000000)⟩ ⟨-17, 1344323656511829158575919399, 762939453125000000000000000⟩, + .log ⟨(12910244098207040464121516743 / 25000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ ⟨(48856301237106636288865036361 / 12500000000000000000000000000000), (131224843 / 100000000000000000000000000000000)⟩ ⟨(-94607624893575292696547566034011 / 12500000000000000000000000000000), (63527472017 / 25000000000000000000000000000000)⟩ ⟨-11, 12910244098207040464121516743, 12207031250000000000000000000⟩, + .log ⟨(264609857763197813506092263 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(3031404897138629301056078669 / 25000000000000000000000000000000), (1008603 / 25000000000000000000000000000000)⟩ ⟨(-1145612987650469887093387345717353 / 100000000000000000000000000000000), (95291230193 / 25000000000000000000000000000000)⟩ ⟨-17, 264609857763197813506092263, 190734863281250000000000000⟩, + .log ⟨(106379880799866778627961161 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(365778291537999299087647577 / 25000000000000000000000000000000), (473079 / 100000000000000000000000000000000)⟩ ⟨(-275073285503028967179645034497683 / 20000000000000000000000000000000), (44469323737 / 10000000000000000000000000000000)⟩ ⟨-20, 106379880799866778627961161, 95367431640625000000000000⟩, + .log ⟨(996242130081600088418081949 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(40369309366858055700978999981 / 100000000000000000000000000000000), (1350161 / 10000000000000000000000000000000)⟩ ⟨(-1013039605230093281807586831235463 / 100000000000000000000000000000000), (169406602011 / 50000000000000000000000000000000)⟩ ⟨-15, 996242130081600088418081949, 762939453125000000000000000⟩, + .log ⟨(28608124500978092561447002501 / 25000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ ⟨(77504448341441715498775898581 / 10000000000000000000000000000000), (266552281 / 100000000000000000000000000000000)⟩ ⟨(-27091761411619937010360696009757 / 4000000000000000000000000000000), (11646703113 / 5000000000000000000000000000000)⟩ ⟨-10, 28608124500978092561447002501, 24414062500000000000000000000⟩, + .log ⟨(29358823188282484339169877 / 390625000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(14273983894910242192731661163 / 20000000000000000000000000000000), (11936593 / 50000000000000000000000000000000)⟩ ⟨(-474795508933638293886426215346007 / 50000000000000000000000000000000), (317637368549 / 100000000000000000000000000000000)⟩ ⟨-14, 29358823188282484339169877, 23841857910156250000000000⟩, + .log ⟨(52019652189861071004324859047 / 12500000000000000000000000000000), (1 / 20000000000000000000000000000000)⟩ ⟨(1140658291069183495395497195263 / 50000000000000000000000000000000), (793122501 / 100000000000000000000000000000000)⟩ ⟨(-548186234937718570469939622009697 / 100000000000000000000000000000000), (190582414347 / 100000000000000000000000000000000)⟩ ⟨-8, 52019652189861071004324859047, 48828125000000000000000000000⟩, + .log ⟨(651752462390329249536035849 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(1466165228605450526526411017 / 10000000000000000000000000000000), (993703 / 20000000000000000000000000000000)⟩ ⟨(-1124786873246499599936939004973107 / 100000000000000000000000000000000), (38116490301 / 10000000000000000000000000000000)⟩ ⟨-17, 651752462390329249536035849, 381469726562500000000000000⟩, + .log ⟨(22162996208765660811557571241 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(171128344386270943336640767127 / 50000000000000000000000000000000), (122023131 / 100000000000000000000000000000000)⟩ ⟨(-386067711184709247944215496746859 / 50000000000000000000000000000000), (55057142027 / 20000000000000000000000000000000)⟩ ⟨-12, 22162996208765660811557571241, 12207031250000000000000000000⟩, + .log ⟨(998786745302239058995620697 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(20231114878995099120815760541 / 50000000000000000000000000000000), (13536097 / 100000000000000000000000000000000)⟩ ⟨(-1012784509513742013987193415751681 / 100000000000000000000000000000000), (169406601979 / 50000000000000000000000000000000)⟩ ⟨-15, 998786745302239058995620697, 762939453125000000000000000⟩, + .log ⟨(13638562854032849724150394181 / 12500000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ ⟨(744183560188687459141052595391 / 100000000000000000000000000000000), (127075441 / 50000000000000000000000000000000)⟩ ⟨(-682058263903366824153761023943489 / 100000000000000000000000000000000), (46586812469 / 20000000000000000000000000000000)⟩ ⟨-10, 13638562854032849724150394181, 12207031250000000000000000000⟩, + .log ⟨(3848002067954721685261713222913 / 100000000000000000000000000000000), (1 / 4000000000000000000000000000000)⟩ ⟨(626765677505146166240688871211 / 5000000000000000000000000000000), (2444538453 / 50000000000000000000000000000000)⟩ ⟨(-162880805788725250401818790268257 / 50000000000000000000000000000000), (127054942747 / 100000000000000000000000000000000)⟩ ⟨-5, 3848002067954721685261713222913, 3125000000000000000000000000000⟩, + .log ⟨(195511048476430058499788530609 / 100000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ ⟨(121946273881652259018258605047 / 10000000000000000000000000000000), (103502691 / 25000000000000000000000000000000)⟩ ⟨(-974579464561832349249862857323 / 156250000000000000000000000000), (52939559463 / 25000000000000000000000000000000)⟩ ⟨-9, 195511048476430058499788530609, 195312500000000000000000000000⟩, + .log ⟨(5130762870747553642660094799 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(25339994088001218249069637407 / 50000000000000000000000000000000), (543241 / 3125000000000000000000000000000)⟩ ⟨(-493883555454769511493099243514939 / 50000000000000000000000000000000), (169406599209 / 50000000000000000000000000000000)⟩ ⟨-15, 5130762870747553642660094799, 3051757812500000000000000000⟩, + .log ⟨(179403434839329302518122766511 / 100000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ ⟨(1134419652926122286351216590589 / 100000000000000000000000000000000), (417891721 / 100000000000000000000000000000000)⟩ ⟨(-316164418463361484416511999842201 / 50000000000000000000000000000000), (58233515407 / 25000000000000000000000000000000)⟩ ⟨-10, 179403434839329302518122766511, 97656250000000000000000000000⟩, + .log ⟨(2145869599004829794714964533 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(19613125122607694098603662991 / 20000000000000000000000000000000), (8520107 / 25000000000000000000000000000000)⟩ ⟨(-913994267485009001787791916483829 / 100000000000000000000000000000000), (63527472913 / 20000000000000000000000000000000)⟩ ⟨-14, 2145869599004829794714964533, 1220703125000000000000000000⟩, + .log ⟨(13949595022904408135313679 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(110098784782036514511280061 / 50000000000000000000000000000000), (277 / 390625000000000000000000000000)⟩ ⟨(-63140921066890235159842341404951 / 4000000000000000000000000000000), (254113468529 / 50000000000000000000000000000000)⟩ ⟨-23, 13949595022904408135313679, 11920928955078125000000000⟩, + .log ⟨(819332065032041562056071307 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(361130246609844099287914409 / 2000000000000000000000000000000), (5899023 / 100000000000000000000000000000000)⟩ ⟨(-1101904410990315031372757444217477 / 100000000000000000000000000000000), (89997265909 / 25000000000000000000000000000000)⟩ ⟨-16, 819332065032041562056071307, 762939453125000000000000000⟩, + .log ⟨(13378786217921639813557877483 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(954630460916170377048628061 / 800000000000000000000000000000), (7932593 / 20000000000000000000000000000000)⟩ ⟨(-222981378263361476088936571202803 / 25000000000000000000000000000000), (74115384759 / 25000000000000000000000000000000)⟩ ⟨-13, 13378786217921639813557877483, 12207031250000000000000000000⟩, + .log ⟨(160505205744607403945955063 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(2353992711978204174929850267 / 25000000000000000000000000000000), (38237 / 1250000000000000000000000000000)⟩ ⟨(-58664582274641712638693206510113 / 5000000000000000000000000000000), (3811649509 / 1000000000000000000000000000000)⟩ ⟨-17, 160505205744607403945955063, 152587890625000000000000000⟩, + .log ⟨(58815375599866618549237361 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(843781695707465957036465463 / 100000000000000000000000000000000), (137009 / 50000000000000000000000000000000)⟩ ⟨(-286925548668732631313360362052209 / 20000000000000000000000000000000), (465869821261 / 100000000000000000000000000000000)⟩ ⟨-21, 58815375599866618549237361, 47683715820312500000000000⟩, + .log ⟨(188821767900792333368784400593 / 50000000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ ⟨(2106863747437255691984522759929 / 100000000000000000000000000000000), (19992283 / 2500000000000000000000000000000)⟩ ⟨(-55789747412602603756320171505039 / 10000000000000000000000000000000), (211758237889 / 100000000000000000000000000000000)⟩ ⟨-9, 188821767900792333368784400593, 97656250000000000000000000000⟩, + .log ⟨(3710406083276166176446180484193 / 100000000000000000000000000000000), (13 / 50000000000000000000000000000000)⟩ ⟨(3055546179183825669927982820343 / 25000000000000000000000000000000), (4714254413 / 100000000000000000000000000000000)⟩ ⟨(-329402885894999308210015591585307 / 100000000000000000000000000000000), (63527471399 / 50000000000000000000000000000000)⟩ ⟨-5, 3710406083276166176446180484193, 3125000000000000000000000000000⟩, + .log ⟨(45580563891877530814463243249 / 25000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ ⟨(1149933761079986411477269199961 / 100000000000000000000000000000000), (424690649 / 100000000000000000000000000000000)⟩ ⟨(-315357485431664692531654224381661 / 50000000000000000000000000000000), (232934061609 / 100000000000000000000000000000000)⟩ ⟨-10, 45580563891877530814463243249, 24414062500000000000000000000⟩, + .log ⟨(101745041947760263291839489 / 1000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(11691828593702689723126484751 / 12500000000000000000000000000000), (32318037 / 100000000000000000000000000000000)⟩ ⟨(-183860809252298935837009080361897 / 20000000000000000000000000000000), (317637365073 / 100000000000000000000000000000000)⟩ ⟨-14, 101745041947760263291839489, 61035156250000000000000000⟩, + .log ⟨(3750323024967151243830993522677 / 10000000000000000000000000000000), (49 / 25000000000000000000000000000000)⟩ ⟨(18390517461258863890750563453571 / 50000000000000000000000000000000), (1489053383 / 6250000000000000000000000000000)⟩ ⟨(-49037155836516095432286376081033 / 50000000000000000000000000000000), (63527471571 / 100000000000000000000000000000000)⟩ ⟨-2, 3750323024967151243830993522677, 2500000000000000000000000000000⟩, + .log ⟨(1785416664818590571417095816563 / 100000000000000000000000000000000), (3 / 25000000000000000000000000000000)⟩ ⟨(1796806896621661653403260644373 / 25000000000000000000000000000000), (330817107 / 12500000000000000000000000000000)⟩ ⟨(-402551837232734332144644144336309 / 100000000000000000000000000000000), (37057691613 / 25000000000000000000000000000000)⟩ ⟨-6, 1785416664818590571417095816563, 1562500000000000000000000000000⟩, + .log ⟨(23671928974121184168120750921 / 25000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ ⟨(659248184494925194843335562857 / 100000000000000000000000000000000), (120305431 / 50000000000000000000000000000000)⟩ ⟨(-348117059458712562259251245925273 / 50000000000000000000000000000000), (63527471577 / 25000000000000000000000000000000)⟩ ⟨-11, 23671928974121184168120750921, 12207031250000000000000000000⟩, + .log ⟨(89137466645652285116568375711 / 100000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ ⟨(156497440545451328737063469521 / 25000000000000000000000000000000), (22650713 / 10000000000000000000000000000000)⟩ ⟨(-87784321472571574793026936820577 / 12500000000000000000000000000000), (254109886439 / 100000000000000000000000000000000)⟩ ⟨-11, 89137466645652285116568375711, 48828125000000000000000000000⟩, + .log ⟨(908796437933929232610554049 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(22717915465580970147834815457 / 50000000000000000000000000000000), (7697811 / 50000000000000000000000000000000)⟩ ⟨(-499956085154299301032102032010951 / 50000000000000000000000000000000), (67762640187 / 20000000000000000000000000000000)⟩ ⟨-15, 908796437933929232610554049, 610351562500000000000000000⟩, + .log ⟨(443840581122032789255275633 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(5470430720106122785186319589 / 100000000000000000000000000000000), (357153 / 20000000000000000000000000000000)⟩ ⟨(-9860172238017221564979838073991 / 800000000000000000000000000000), (201170437641 / 50000000000000000000000000000000)⟩ ⟨-18, 443840581122032789255275633, 381469726562500000000000000⟩] +lemma CA4_4_8I2PairCertificates_valid : + CA4_4_8I2PairCertificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA4_4_8I2PairCertificateIndex (a : PairSlot × PairSlot) : ℕ := + match a.1.1.val, a.1.2.val, a.2.1.val, a.2.2.val with + | 5, 5, 0, 0 => 1 + | 4, 5, 1, 0 => 2 + | 4, 5, 0, 1 => 2 + | 5, 4, 1, 0 => 2 + | 5, 4, 0, 1 => 2 + | 2, 5, 2, 0 => 3 + | 2, 5, 3, 0 => 4 + | 2, 5, 1, 1 => 5 + | 2, 5, 0, 2 => 3 + | 2, 5, 0, 3 => 4 + | 3, 5, 2, 0 => 6 + | 3, 5, 3, 0 => 7 + | 3, 5, 1, 1 => 8 + | 3, 5, 0, 2 => 6 + | 3, 5, 0, 3 => 7 + | 4, 4, 2, 0 => 9 + | 4, 4, 3, 0 => 10 + | 4, 4, 1, 1 => 11 + | 4, 4, 0, 2 => 9 + | 4, 4, 0, 3 => 10 + | 5, 2, 2, 0 => 3 + | 5, 2, 3, 0 => 4 + | 5, 2, 1, 1 => 5 + | 5, 2, 0, 2 => 3 + | 5, 2, 0, 3 => 4 + | 5, 3, 2, 0 => 6 + | 5, 3, 3, 0 => 7 + | 5, 3, 1, 1 => 8 + | 5, 3, 0, 2 => 6 + | 5, 3, 0, 3 => 7 + | 1, 5, 4, 0 => 12 + | 1, 5, 2, 1 => 13 + | 1, 5, 3, 1 => 14 + | 1, 5, 1, 2 => 13 + | 1, 5, 1, 3 => 14 + | 1, 5, 0, 4 => 12 + | 2, 4, 4, 0 => 15 + | 2, 4, 2, 1 => 16 + | 2, 4, 3, 1 => 17 + | 2, 4, 1, 2 => 16 + | 2, 4, 1, 3 => 17 + | 2, 4, 0, 4 => 15 + | 3, 4, 4, 0 => 18 + | 3, 4, 2, 1 => 19 + | 3, 4, 3, 1 => 20 + | 3, 4, 1, 2 => 19 + | 3, 4, 1, 3 => 20 + | 3, 4, 0, 4 => 18 + | 4, 2, 4, 0 => 15 + | 4, 2, 2, 1 => 16 + | 4, 2, 3, 1 => 17 + | 4, 2, 1, 2 => 16 + | 4, 2, 1, 3 => 17 + | 4, 2, 0, 4 => 15 + | 4, 3, 4, 0 => 18 + | 4, 3, 2, 1 => 19 + | 4, 3, 3, 1 => 20 + | 4, 3, 1, 2 => 19 + | 4, 3, 1, 3 => 20 + | 4, 3, 0, 4 => 18 + | 5, 1, 4, 0 => 12 + | 5, 1, 2, 1 => 13 + | 5, 1, 3, 1 => 14 + | 5, 1, 1, 2 => 13 + | 5, 1, 1, 3 => 14 + | 5, 1, 0, 4 => 12 + | 5, 0, 5, 0 => 21 + | 5, 0, 4, 1 => 22 + | 5, 0, 2, 2 => 23 + | 5, 0, 2, 3 => 24 + | 5, 0, 3, 2 => 24 + | 5, 0, 3, 3 => 25 + | 5, 0, 1, 4 => 22 + | 5, 0, 0, 5 => 21 + | 4, 1, 5, 0 => 22 + | 4, 1, 4, 1 => 26 + | 4, 1, 2, 2 => 27 + | 4, 1, 2, 3 => 28 + | 4, 1, 3, 2 => 28 + | 4, 1, 3, 3 => 29 + | 4, 1, 1, 4 => 26 + | 4, 1, 0, 5 => 22 + | 2, 2, 5, 0 => 23 + | 2, 2, 4, 1 => 27 + | 2, 2, 2, 2 => 30 + | 2, 2, 2, 3 => 31 + | 2, 2, 3, 2 => 31 + | 2, 2, 3, 3 => 32 + | 2, 2, 1, 4 => 27 + | 2, 2, 0, 5 => 23 + | 2, 3, 5, 0 => 24 + | 2, 3, 4, 1 => 28 + | 2, 3, 2, 2 => 31 + | 2, 3, 2, 3 => 33 + | 2, 3, 3, 2 => 33 + | 2, 3, 3, 3 => 34 + | 2, 3, 1, 4 => 28 + | 2, 3, 0, 5 => 24 + | 3, 2, 5, 0 => 24 + | 3, 2, 4, 1 => 28 + | 3, 2, 2, 2 => 31 + | 3, 2, 2, 3 => 33 + | 3, 2, 3, 2 => 33 + | 3, 2, 3, 3 => 34 + | 3, 2, 1, 4 => 28 + | 3, 2, 0, 5 => 24 + | 3, 3, 5, 0 => 25 + | 3, 3, 4, 1 => 29 + | 3, 3, 2, 2 => 32 + | 3, 3, 2, 3 => 34 + | 3, 3, 3, 2 => 34 + | 3, 3, 3, 3 => 35 + | 3, 3, 1, 4 => 29 + | 3, 3, 0, 5 => 25 + | 1, 4, 5, 0 => 22 + | 1, 4, 4, 1 => 26 + | 1, 4, 2, 2 => 27 + | 1, 4, 2, 3 => 28 + | 1, 4, 3, 2 => 28 + | 1, 4, 3, 3 => 29 + | 1, 4, 1, 4 => 26 + | 1, 4, 0, 5 => 22 + | 0, 5, 5, 0 => 21 + | 0, 5, 4, 1 => 22 + | 0, 5, 2, 2 => 23 + | 0, 5, 2, 3 => 24 + | 0, 5, 3, 2 => 24 + | 0, 5, 3, 3 => 25 + | 0, 5, 1, 4 => 22 + | 0, 5, 0, 5 => 21 + | 4, 0, 1, 5 => 12 + | 4, 0, 2, 4 => 15 + | 4, 0, 3, 4 => 18 + | 4, 0, 4, 2 => 15 + | 4, 0, 4, 3 => 18 + | 4, 0, 5, 1 => 12 + | 2, 1, 1, 5 => 13 + | 2, 1, 2, 4 => 16 + | 2, 1, 3, 4 => 19 + | 2, 1, 4, 2 => 16 + | 2, 1, 4, 3 => 19 + | 2, 1, 5, 1 => 13 + | 3, 1, 1, 5 => 14 + | 3, 1, 2, 4 => 17 + | 3, 1, 3, 4 => 20 + | 3, 1, 4, 2 => 17 + | 3, 1, 4, 3 => 20 + | 3, 1, 5, 1 => 14 + | 1, 2, 1, 5 => 13 + | 1, 2, 2, 4 => 16 + | 1, 2, 3, 4 => 19 + | 1, 2, 4, 2 => 16 + | 1, 2, 4, 3 => 19 + | 1, 2, 5, 1 => 13 + | 1, 3, 1, 5 => 14 + | 1, 3, 2, 4 => 17 + | 1, 3, 3, 4 => 20 + | 1, 3, 4, 2 => 17 + | 1, 3, 4, 3 => 20 + | 1, 3, 5, 1 => 14 + | 0, 4, 1, 5 => 12 + | 0, 4, 2, 4 => 15 + | 0, 4, 3, 4 => 18 + | 0, 4, 4, 2 => 15 + | 0, 4, 4, 3 => 18 + | 0, 4, 5, 1 => 12 + | 2, 0, 2, 5 => 3 + | 2, 0, 3, 5 => 6 + | 2, 0, 4, 4 => 9 + | 2, 0, 5, 2 => 3 + | 2, 0, 5, 3 => 6 + | 3, 0, 2, 5 => 4 + | 3, 0, 3, 5 => 7 + | 3, 0, 4, 4 => 10 + | 3, 0, 5, 2 => 4 + | 3, 0, 5, 3 => 7 + | 1, 1, 2, 5 => 5 + | 1, 1, 3, 5 => 8 + | 1, 1, 4, 4 => 11 + | 1, 1, 5, 2 => 5 + | 1, 1, 5, 3 => 8 + | 0, 2, 2, 5 => 3 + | 0, 2, 3, 5 => 6 + | 0, 2, 4, 4 => 9 + | 0, 2, 5, 2 => 3 + | 0, 2, 5, 3 => 6 + | 0, 3, 2, 5 => 4 + | 0, 3, 3, 5 => 7 + | 0, 3, 4, 4 => 10 + | 0, 3, 5, 2 => 4 + | 0, 3, 5, 3 => 7 + | 1, 0, 4, 5 => 2 + | 1, 0, 5, 4 => 2 + | 0, 1, 4, 5 => 2 + | 0, 1, 5, 4 => 2 + | 0, 0, 5, 5 => 1 + | _, _, _, _ => 0 +def CA4_4_8I2PairP (a : PairSlot × PairSlot) : Ball := + (CompactCertificate.entropyLookup CA4_4_8I2PairCertificates (CA4_4_8I2PairCertificateIndex a)).input +lemma CA4_4_8I2PairP_check_0_0 : ∀ k l : Fin 6, contains (CA4_4_8I2PairRaw ((0,0),(k,l))) (CA4_4_8I2PairP ((0,0),(k,l))) = true := by + decide +kernel +lemma CA4_4_8I2PairP_check_0_1 : ∀ k l : Fin 6, contains (CA4_4_8I2PairRaw ((0,1),(k,l))) (CA4_4_8I2PairP ((0,1),(k,l))) = true := by + decide +kernel +lemma CA4_4_8I2PairP_check_0_2 : ∀ k l : Fin 6, contains (CA4_4_8I2PairRaw ((0,2),(k,l))) (CA4_4_8I2PairP ((0,2),(k,l))) = true := by + decide +kernel +lemma CA4_4_8I2PairP_check_0_3 : ∀ k l : Fin 6, contains (CA4_4_8I2PairRaw ((0,3),(k,l))) (CA4_4_8I2PairP ((0,3),(k,l))) = true := by + decide +kernel +lemma CA4_4_8I2PairP_check_0_4 : ∀ k l : Fin 6, contains (CA4_4_8I2PairRaw ((0,4),(k,l))) (CA4_4_8I2PairP ((0,4),(k,l))) = true := by + decide +kernel +lemma CA4_4_8I2PairP_check_0_5 : ∀ k l : Fin 6, contains (CA4_4_8I2PairRaw ((0,5),(k,l))) (CA4_4_8I2PairP ((0,5),(k,l))) = true := by + decide +kernel +lemma CA4_4_8I2PairP_check_1_0 : ∀ k l : Fin 6, contains (CA4_4_8I2PairRaw ((1,0),(k,l))) (CA4_4_8I2PairP ((1,0),(k,l))) = true := by + decide +kernel +lemma CA4_4_8I2PairP_check_1_1 : ∀ k l : Fin 6, contains (CA4_4_8I2PairRaw ((1,1),(k,l))) (CA4_4_8I2PairP ((1,1),(k,l))) = true := by + decide +kernel +lemma CA4_4_8I2PairP_check_1_2 : ∀ k l : Fin 6, contains (CA4_4_8I2PairRaw ((1,2),(k,l))) (CA4_4_8I2PairP ((1,2),(k,l))) = true := by + decide +kernel +lemma CA4_4_8I2PairP_check_1_3 : ∀ k l : Fin 6, contains (CA4_4_8I2PairRaw ((1,3),(k,l))) (CA4_4_8I2PairP ((1,3),(k,l))) = true := by + decide +kernel +lemma CA4_4_8I2PairP_check_1_4 : ∀ k l : Fin 6, contains (CA4_4_8I2PairRaw ((1,4),(k,l))) (CA4_4_8I2PairP ((1,4),(k,l))) = true := by + decide +kernel +lemma CA4_4_8I2PairP_check_1_5 : ∀ k l : Fin 6, contains (CA4_4_8I2PairRaw ((1,5),(k,l))) (CA4_4_8I2PairP ((1,5),(k,l))) = true := by + decide +kernel +lemma CA4_4_8I2PairP_check_2_0 : ∀ k l : Fin 6, contains (CA4_4_8I2PairRaw ((2,0),(k,l))) (CA4_4_8I2PairP ((2,0),(k,l))) = true := by + decide +kernel +lemma CA4_4_8I2PairP_check_2_1 : ∀ k l : Fin 6, contains (CA4_4_8I2PairRaw ((2,1),(k,l))) (CA4_4_8I2PairP ((2,1),(k,l))) = true := by + decide +kernel +lemma CA4_4_8I2PairP_check_2_2 : ∀ k l : Fin 6, contains (CA4_4_8I2PairRaw ((2,2),(k,l))) (CA4_4_8I2PairP ((2,2),(k,l))) = true := by + decide +kernel +lemma CA4_4_8I2PairP_check_2_3 : ∀ k l : Fin 6, contains (CA4_4_8I2PairRaw ((2,3),(k,l))) (CA4_4_8I2PairP ((2,3),(k,l))) = true := by + decide +kernel +lemma CA4_4_8I2PairP_check_2_4 : ∀ k l : Fin 6, contains (CA4_4_8I2PairRaw ((2,4),(k,l))) (CA4_4_8I2PairP ((2,4),(k,l))) = true := by + decide +kernel +lemma CA4_4_8I2PairP_check_2_5 : ∀ k l : Fin 6, contains (CA4_4_8I2PairRaw ((2,5),(k,l))) (CA4_4_8I2PairP ((2,5),(k,l))) = true := by + decide +kernel +lemma CA4_4_8I2PairP_check_3_0 : ∀ k l : Fin 6, contains (CA4_4_8I2PairRaw ((3,0),(k,l))) (CA4_4_8I2PairP ((3,0),(k,l))) = true := by + decide +kernel +lemma CA4_4_8I2PairP_check_3_1 : ∀ k l : Fin 6, contains (CA4_4_8I2PairRaw ((3,1),(k,l))) (CA4_4_8I2PairP ((3,1),(k,l))) = true := by + decide +kernel +lemma CA4_4_8I2PairP_check_3_2 : ∀ k l : Fin 6, contains (CA4_4_8I2PairRaw ((3,2),(k,l))) (CA4_4_8I2PairP ((3,2),(k,l))) = true := by + decide +kernel +lemma CA4_4_8I2PairP_check_3_3 : ∀ k l : Fin 6, contains (CA4_4_8I2PairRaw ((3,3),(k,l))) (CA4_4_8I2PairP ((3,3),(k,l))) = true := by + decide +kernel +lemma CA4_4_8I2PairP_check_3_4 : ∀ k l : Fin 6, contains (CA4_4_8I2PairRaw ((3,4),(k,l))) (CA4_4_8I2PairP ((3,4),(k,l))) = true := by + decide +kernel +lemma CA4_4_8I2PairP_check_3_5 : ∀ k l : Fin 6, contains (CA4_4_8I2PairRaw ((3,5),(k,l))) (CA4_4_8I2PairP ((3,5),(k,l))) = true := by + decide +kernel +lemma CA4_4_8I2PairP_check_4_0 : ∀ k l : Fin 6, contains (CA4_4_8I2PairRaw ((4,0),(k,l))) (CA4_4_8I2PairP ((4,0),(k,l))) = true := by + decide +kernel +lemma CA4_4_8I2PairP_check_4_1 : ∀ k l : Fin 6, contains (CA4_4_8I2PairRaw ((4,1),(k,l))) (CA4_4_8I2PairP ((4,1),(k,l))) = true := by + decide +kernel +lemma CA4_4_8I2PairP_check_4_2 : ∀ k l : Fin 6, contains (CA4_4_8I2PairRaw ((4,2),(k,l))) (CA4_4_8I2PairP ((4,2),(k,l))) = true := by + decide +kernel +lemma CA4_4_8I2PairP_check_4_3 : ∀ k l : Fin 6, contains (CA4_4_8I2PairRaw ((4,3),(k,l))) (CA4_4_8I2PairP ((4,3),(k,l))) = true := by + decide +kernel +lemma CA4_4_8I2PairP_check_4_4 : ∀ k l : Fin 6, contains (CA4_4_8I2PairRaw ((4,4),(k,l))) (CA4_4_8I2PairP ((4,4),(k,l))) = true := by + decide +kernel +lemma CA4_4_8I2PairP_check_4_5 : ∀ k l : Fin 6, contains (CA4_4_8I2PairRaw ((4,5),(k,l))) (CA4_4_8I2PairP ((4,5),(k,l))) = true := by + decide +kernel +lemma CA4_4_8I2PairP_check_5_0 : ∀ k l : Fin 6, contains (CA4_4_8I2PairRaw ((5,0),(k,l))) (CA4_4_8I2PairP ((5,0),(k,l))) = true := by + decide +kernel +lemma CA4_4_8I2PairP_check_5_1 : ∀ k l : Fin 6, contains (CA4_4_8I2PairRaw ((5,1),(k,l))) (CA4_4_8I2PairP ((5,1),(k,l))) = true := by + decide +kernel +lemma CA4_4_8I2PairP_check_5_2 : ∀ k l : Fin 6, contains (CA4_4_8I2PairRaw ((5,2),(k,l))) (CA4_4_8I2PairP ((5,2),(k,l))) = true := by + decide +kernel +lemma CA4_4_8I2PairP_check_5_3 : ∀ k l : Fin 6, contains (CA4_4_8I2PairRaw ((5,3),(k,l))) (CA4_4_8I2PairP ((5,3),(k,l))) = true := by + decide +kernel +lemma CA4_4_8I2PairP_check_5_4 : ∀ k l : Fin 6, contains (CA4_4_8I2PairRaw ((5,4),(k,l))) (CA4_4_8I2PairP ((5,4),(k,l))) = true := by + decide +kernel +lemma CA4_4_8I2PairP_check_5_5 : ∀ k l : Fin 6, contains (CA4_4_8I2PairRaw ((5,5),(k,l))) (CA4_4_8I2PairP ((5,5),(k,l))) = true := by + decide +kernel +lemma CA4_4_8I2PairP_check (a : PairSlot × PairSlot) : contains (CA4_4_8I2PairRaw a) (CA4_4_8I2PairP a) = true := by + rcases a with ⟨⟨i,j⟩,⟨k,l⟩⟩ + revert j i + apply forall_fin6 + · exact forall_fin6 (CA4_4_8I2PairP_check_0_0 k l) (CA4_4_8I2PairP_check_0_1 k l) (CA4_4_8I2PairP_check_0_2 k l) (CA4_4_8I2PairP_check_0_3 k l) (CA4_4_8I2PairP_check_0_4 k l) (CA4_4_8I2PairP_check_0_5 k l) + · exact forall_fin6 (CA4_4_8I2PairP_check_1_0 k l) (CA4_4_8I2PairP_check_1_1 k l) (CA4_4_8I2PairP_check_1_2 k l) (CA4_4_8I2PairP_check_1_3 k l) (CA4_4_8I2PairP_check_1_4 k l) (CA4_4_8I2PairP_check_1_5 k l) + · exact forall_fin6 (CA4_4_8I2PairP_check_2_0 k l) (CA4_4_8I2PairP_check_2_1 k l) (CA4_4_8I2PairP_check_2_2 k l) (CA4_4_8I2PairP_check_2_3 k l) (CA4_4_8I2PairP_check_2_4 k l) (CA4_4_8I2PairP_check_2_5 k l) + · exact forall_fin6 (CA4_4_8I2PairP_check_3_0 k l) (CA4_4_8I2PairP_check_3_1 k l) (CA4_4_8I2PairP_check_3_2 k l) (CA4_4_8I2PairP_check_3_3 k l) (CA4_4_8I2PairP_check_3_4 k l) (CA4_4_8I2PairP_check_3_5 k l) + · exact forall_fin6 (CA4_4_8I2PairP_check_4_0 k l) (CA4_4_8I2PairP_check_4_1 k l) (CA4_4_8I2PairP_check_4_2 k l) (CA4_4_8I2PairP_check_4_3 k l) (CA4_4_8I2PairP_check_4_4 k l) (CA4_4_8I2PairP_check_4_5 k l) + · exact forall_fin6 (CA4_4_8I2PairP_check_5_0 k l) (CA4_4_8I2PairP_check_5_1 k l) (CA4_4_8I2PairP_check_5_2 k l) (CA4_4_8I2PairP_check_5_3 k l) (CA4_4_8I2PairP_check_5_4 k l) (CA4_4_8I2PairP_check_5_5 k l) +lemma CA4_4_8I2PairP_sound (a : PairSlot × PairSlot) : + (CA4_4_8I2PairP a).Encloses (CA4_4_8I2PairValue a) := + contains_sound (CA4_4_8I2PairRaw_sound a) (CA4_4_8I2PairP_check a) +def CA4_4_8I2PairTerms (a : PairSlot × PairSlot) : Ball := + (CompactCertificate.entropyLookup CA4_4_8I2PairCertificates (CA4_4_8I2PairCertificateIndex a)).output +lemma CA4_4_8I2PairTerms_sound (a : PairSlot × PairSlot) : + (CA4_4_8I2PairTerms a).Encloses (Foundation.entropyTerm (CA4_4_8I2PairValue a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA4_4_8I2PairCertificates_valid + (CA4_4_8I2PairCertificateIndex a) (CA4_4_8I2PairP_sound a) +def CA4_4_8I2PairEntropy : Ball := ⟨(277590657874130194496323896621127 / 100000000000000000000000000000000), (114789632413 / 100000000000000000000000000000000)⟩ +lemma CA4_4_8I2PairEntropy_sound : CA4_4_8I2PairEntropy.Encloses (Foundation.finiteEntropy CA4_4_8I2PairValue) := by + exact contains_sound (entropyDoublePair_enclosed CA4_4_8I2PairValue CA4_4_8I2PairTerms CA4_4_8I2PairTerms_sound) (by decide +kernel) +def CA4_4_8I2PairMass : Ball := ⟨(99999999999999999999999999999987 / 100000000000000000000000000000000), (793 / 100000000000000000000000000000000)⟩ +lemma CA4_4_8I2PairMass_sound : CA4_4_8I2PairMass.Encloses (∑ a, CA4_4_8I2PairValue a) := by + exact contains_sound (doublePairSumBall_sound CA4_4_8I2PairP CA4_4_8I2PairValue CA4_4_8I2PairP_sound) (by decide +kernel) +def CA4_4_8I2PairMassTermLogWitness : LogWitness := ⟨-1, 99999999999999999999999999999987, 50000000000000000000000000000000⟩ +def CA4_4_8I2PairMassTermLog : Ball := ⟨(-3 / 25000000000000000000000000000000), (42351648159 / 100000000000000000000000000000000)⟩ +lemma CA4_4_8I2PairMassTermLog_sound : CA4_4_8I2PairMassTermLog.Encloses (Real.log ((∑ a, CA4_4_8I2PairValue a))) := by + exact checkLog_sound logTwoBall_sound (CA4_4_8I2PairMass_sound) (w := CA4_4_8I2PairMassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA4_4_8I2PairMassTerm : Ball := ⟨(3 / 25000000000000000000000000000000), (264697801 / 625000000000000000000000000000)⟩ +lemma CA4_4_8I2PairMassTerm_sound : CA4_4_8I2PairMassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA4_4_8I2PairValue a))) := by + exact contains_sound (entropyTerm_ball (CA4_4_8I2PairMass_sound) CA4_4_8I2PairMassTermLog_sound) (by decide +kernel) +def CA4_4_8I2PairH : Ball := ⟨(55518131574826038899264779324223 / 20000000000000000000000000000000), (157141280573 / 100000000000000000000000000000000)⟩ +lemma CA4_4_8I2PairH_sound : CA4_4_8I2PairH.Encloses (homogeneousEntropy CA4_4_8I2PairValue) := by + exact contains_sound (homogeneous_enclosed CA4_4_8I2PairValue CA4_4_8I2PairMassTerm_sound CA4_4_8I2PairEntropy_sound) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA4_5_7I0.lean b/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA4_5_7I0.lean new file mode 100644 index 0000000000000000000000000000000000000000..2d408d75aec1f5bb4a09d51d9864b94b604bc3e6 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA4_5_7I0.lean @@ -0,0 +1,77 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Certificates.SplitA4_5_7 + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CA4_5_7I0Value (a : Fin 17) : ℝ := marginal (below (shape 4 5 7)) (fun u => (stageALaw (shape 4 5 7) u : ℝ)) ((Equiv.refl (Fin 3)) 0) a +def CA4_5_7I0Raw (a : Fin 17) : Ball := marginalBall (below (shape 4 5 7)) A4_5_7Law ((Equiv.refl (Fin 3)) 0) a +lemma CA4_5_7I0Raw_sound (a : Fin 17) : + (CA4_5_7I0Raw a).Encloses (CA4_5_7I0Value a) := by + exact marginalBall_sound (below (shape 4 5 7)) A4_5_7Law (fun u => (stageALaw (shape 4 5 7) u : ℝ)) (fun u _ => A4_5_7Law_sound u) ((Equiv.refl (Fin 3)) 0) a +def CA4_5_7I0Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(2588932326140645866727491993891 / 100000000000000000000000000000000), (1 / 6250000000000000000000000000000)⟩ ⟨(4729881788896945270895752580327 / 50000000000000000000000000000000), (239849643 / 6250000000000000000000000000000)⟩ ⟨(-584627939928931531044673636001 / 160000000000000000000000000000), (148230766399 / 100000000000000000000000000000000)⟩ ⟨-6, 2588932326140645866727491993891, 1562500000000000000000000000000⟩, + .log ⟨(23161658632779186440713669476377 / 100000000000000000000000000000000), (71 / 100000000000000000000000000000000)⟩ ⟨(1355116307721707533931494734763 / 4000000000000000000000000000000), (2452336019 / 12500000000000000000000000000000)⟩ ⟨(-146267191957908803624313377112513 / 100000000000000000000000000000000), (42351647519 / 50000000000000000000000000000000)⟩ ⟨-3, 23161658632779186440713669476377, 12500000000000000000000000000000⟩, + .log ⟨(6062352260270041923139709632433 / 12500000000000000000000000000000), (7 / 10000000000000000000000000000000)⟩ ⟨(35095236480304996425570291454063 / 100000000000000000000000000000000), (15405036369 / 50000000000000000000000000000000)⟩ ⟨(-72363075778158656714578664123817 / 100000000000000000000000000000000), (63527471193 / 100000000000000000000000000000000)⟩ ⟨-2, 6062352260270041923139709632433, 3125000000000000000000000000000⟩] +lemma CA4_5_7I0Certificates_valid : + CA4_5_7I0Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA4_5_7I0CertificateIndex (a : Fin 17) : ℕ := + match a.val with + | 0 => 1 + | 1 => 2 + | 2 => 3 + | 3 => 2 + | 4 => 1 + | _ => 0 +def CA4_5_7I0P (a : Fin 17) : Ball := + (CompactCertificate.entropyLookup CA4_5_7I0Certificates (CA4_5_7I0CertificateIndex a)).input +lemma CA4_5_7I0P_check : ∀ a : Fin 17, contains (CA4_5_7I0Raw a) (CA4_5_7I0P a) = true := by + decide +kernel +lemma CA4_5_7I0P_sound (a : Fin 17) : + (CA4_5_7I0P a).Encloses (CA4_5_7I0Value a) := + contains_sound (CA4_5_7I0Raw_sound a) (CA4_5_7I0P_check a) +def CA4_5_7I0Terms (a : Fin 17) : Ball := + (CompactCertificate.entropyLookup CA4_5_7I0Certificates (CA4_5_7I0CertificateIndex a)).output +lemma CA4_5_7I0Terms_sound (a : Fin 17) : + (CA4_5_7I0Terms a).Encloses (Foundation.entropyTerm (CA4_5_7I0Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA4_5_7I0Certificates_valid + (CA4_5_7I0CertificateIndex a) (CA4_5_7I0P_sound a) +def CA4_5_7I0Entropy : Ball := ⟨(121770579021978154205728038513521 / 100000000000000000000000000000000), (38861318809 / 50000000000000000000000000000000)⟩ +lemma CA4_5_7I0Entropy_sound : CA4_5_7I0Entropy.Encloses (Foundation.finiteEntropy CA4_5_7I0Value) := by + exact contains_sound (entropyFin_enclosed 17 CA4_5_7I0Value CA4_5_7I0Terms CA4_5_7I0Terms_sound) (by decide +kernel) +def CA4_5_7I0Mass : Ball := ⟨1, (61 / 25000000000000000000000000000000)⟩ +lemma CA4_5_7I0Mass_sound : CA4_5_7I0Mass.Encloses (∑ a, CA4_5_7I0Value a) := by + exact contains_sound (finSumBall_sound 17 CA4_5_7I0P CA4_5_7I0Value CA4_5_7I0P_sound) (by decide +kernel) +def CA4_5_7I0MassTermLogWitness : LogWitness := ⟨0, 1, 1⟩ +def CA4_5_7I0MassTermLog : Ball := ⟨0, (10587911963 / 50000000000000000000000000000000)⟩ +lemma CA4_5_7I0MassTermLog_sound : CA4_5_7I0MassTermLog.Encloses (Real.log ((∑ a, CA4_5_7I0Value a))) := by + exact checkLog_sound logTwoBall_sound (CA4_5_7I0Mass_sound) (w := CA4_5_7I0MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA4_5_7I0MassTerm : Ball := ⟨0, (21175823927 / 100000000000000000000000000000000)⟩ +lemma CA4_5_7I0MassTerm_sound : CA4_5_7I0MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA4_5_7I0Value a))) := by + exact contains_sound (entropyTerm_ball (CA4_5_7I0Mass_sound) CA4_5_7I0MassTermLog_sound) (by decide +kernel) +def CA4_5_7I0H : Ball := ⟨(121770579021978154205728038513521 / 100000000000000000000000000000000), (19779692309 / 20000000000000000000000000000000)⟩ +lemma CA4_5_7I0H_sound : CA4_5_7I0H.Encloses (homogeneousEntropy CA4_5_7I0Value) := by + exact contains_sound (homogeneous_enclosed CA4_5_7I0Value CA4_5_7I0MassTerm_sound CA4_5_7I0Entropy_sound) (by decide +kernel) +lemma CA4_5_7I0_sound : CA4_5_7I0H.Encloses (stageACapacity (shape 4 5 7) 0) := by + exact CA4_5_7I0H_sound + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA4_5_7I1.lean b/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA4_5_7I1.lean new file mode 100644 index 0000000000000000000000000000000000000000..e3a37c59638a865280fdeb5c2ad578f3bc41d9f5 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA4_5_7I1.lean @@ -0,0 +1,1112 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Certificates.SupportedContraction + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CA4_5_7I1PairValue (a : PairSlot × PairSlot) : ℝ := pairLaw (below (shape 4 5 7)) (shape 4 5 7) (fun u => (stageALaw (shape 4 5 7) u : ℝ)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) a +def CA4_5_7I1PairRaw (a : PairSlot × PairSlot) : Ball := stageAPairBall (shape 4 5 7) A4_5_7Law 1 a +lemma CA4_5_7I1PairRaw_sound (a : PairSlot × PairSlot) : + (CA4_5_7I1PairRaw a).Encloses (CA4_5_7I1PairValue a) := by + exact stageAPairBall_sound (shape 4 5 7) (by decide +kernel) A4_5_7Law (fun u => (stageALaw (shape 4 5 7) u : ℝ)) (fun u _ => A4_5_7Law_sound u) 1 a +def CA4_5_7I1PairCertificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(131794220390007136329424907 / 5000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(27791992092679985132458046441 / 100000000000000000000000000000000), (4744453 / 50000000000000000000000000000000)⟩ ⟨(-1054370670065711834708874697388963 / 100000000000000000000000000000000), (359989040549 / 100000000000000000000000000000000)⟩ ⟨-16, 131794220390007136329424907, 76293945312500000000000000⟩, + .log ⟨(377411862302807953596773654799 / 100000000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ ⟨(1052901424630535930823425080789 / 50000000000000000000000000000000), (199800183 / 25000000000000000000000000000000)⟩ ⟨(-278979420044239112450397027748341 / 50000000000000000000000000000000), (21175823789 / 10000000000000000000000000000000)⟩ ⟨-9, 377411862302807953596773654799, 195312500000000000000000000000⟩, + .log ⟨(3186169705805219561965232708489 / 100000000000000000000000000000000), (19 / 100000000000000000000000000000000)⟩ ⟨(10980658227194429059378781851311 / 100000000000000000000000000000000), (50602327 / 1250000000000000000000000000000)⟩ ⟨(-86158767745387247431964584064633 / 25000000000000000000000000000000), (63527471347 / 50000000000000000000000000000000)⟩ ⟨-5, 3186169705805219561965232708489, 3125000000000000000000000000000⟩, + .log ⟨(47312519104068208707250512221 / 25000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ ⟨(1186570759077300075585801004589 / 100000000000000000000000000000000), (440827903 / 100000000000000000000000000000000)⟩ ⟨(-125397123377359095401476223498831 / 20000000000000000000000000000000), (232934061569 / 100000000000000000000000000000000)⟩ ⟨-10, 47312519104068208707250512221, 24414062500000000000000000000⟩, + .log ⟨(67172672180169755099908137 / 781250000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(16098026935998894697178381407 / 20000000000000000000000000000000), (5462159 / 20000000000000000000000000000000)⟩ ⟨(-936138397919943641932190124581857 / 100000000000000000000000000000000), (508219787 / 160000000000000000000000000000)⟩ ⟨-14, 67172672180169755099908137, 47683715820312500000000000⟩, + .log ⟨(94528763353595906667120753367 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(658300321709569515053402382199 / 100000000000000000000000000000000), (12010347 / 5000000000000000000000000000000)⟩ ⟨(-696402130267080812732495637082817 / 100000000000000000000000000000000), (127054942627 / 50000000000000000000000000000000)⟩ ⟨-11, 94528763353595906667120753367, 48828125000000000000000000000⟩, + .log ⟨(3158204452479637785265735441619 / 100000000000000000000000000000000), (19 / 100000000000000000000000000000000)⟩ ⟨(136401529033144056411712257561 / 1250000000000000000000000000000), (1003163731 / 25000000000000000000000000000000)⟩ ⟨(-172758326556153814360857194562627 / 50000000000000000000000000000000), (127054942699 / 100000000000000000000000000000000)⟩ ⟨-5, 3158204452479637785265735441619, 3125000000000000000000000000000⟩, + .log ⟨(123646948969556226163537835817 / 50000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ ⟨(296868805033987460946432267897 / 20000000000000000000000000000000), (523665213 / 100000000000000000000000000000000)⟩ ⟨(-600234796547792518774433674099017 / 100000000000000000000000000000000), (105879118819 / 50000000000000000000000000000000)⟩ ⟨-9, 123646948969556226163537835817, 97656250000000000000000000000⟩, + .log ⟨(7768582797325641064715771043 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(7351283825861274033650453433 / 10000000000000000000000000000000), (6168983 / 25000000000000000000000000000000)⟩ ⟨(-473141885569654769741999935881977 / 50000000000000000000000000000000), (317637368117 / 100000000000000000000000000000000)⟩ ⟨-14, 7768582797325641064715771043, 6103515625000000000000000000⟩, + .log ⟨(259468022630881803478559515433 / 100000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ ⟨(308989674116005551405011691349 / 20000000000000000000000000000000), (137361231 / 25000000000000000000000000000000)⟩ ⟨(-595429199681328469693864648972639 / 100000000000000000000000000000000), (264697797 / 125000000000000000000000000000)⟩ ⟨-9, 259468022630881803478559515433, 195312500000000000000000000000⟩, + .log ⟨(9641049911379663411659830799 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(82467113998031999808550973423 / 50000000000000000000000000000000), (57164019 / 100000000000000000000000000000000)⟩ ⟨(-8553748269749461994874068234803 / 1000000000000000000000000000000), (74115384187 / 25000000000000000000000000000000)⟩ ⟨-13, 9641049911379663411659830799, 6103515625000000000000000000⟩, + .log ⟨(87507066082348384129744274031 / 25000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ ⟨(395875775553028340174026009333 / 20000000000000000000000000000000), (370606851 / 50000000000000000000000000000000)⟩ ⟨(-113098231170409163524408178659583 / 20000000000000000000000000000000), (211758237687 / 100000000000000000000000000000000)⟩ ⟨-9, 87507066082348384129744274031, 48828125000000000000000000000⟩, + .log ⟨(5847500774950566418128630911669 / 50000000000000000000000000000000), (11 / 25000000000000000000000000000000)⟩ ⟨(25097574527908256672553315379171 / 100000000000000000000000000000000), (12382564679 / 100000000000000000000000000000000)⟩ ⟨(-107300432671257005782461105230159 / 50000000000000000000000000000000), (105879118791 / 100000000000000000000000000000000)⟩ ⟨-4, 5847500774950566418128630911669, 3125000000000000000000000000000⟩, + .log ⟨(911391632325853421721799278929 / 100000000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ ⟨(171266993647321960926644457731 / 4000000000000000000000000000000), (1507771 / 97656250000000000000000000000)⟩ ⟨(-234897638365205279767845880759631 / 50000000000000000000000000000000), (84703294951 / 50000000000000000000000000000000)⟩ ⟨-7, 911391632325853421721799278929, 781250000000000000000000000000⟩, + .log ⟨(841560374014546517764872623 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(10599437210091078121584854003 / 25000000000000000000000000000000), (14256599 / 100000000000000000000000000000000)⟩ ⟨(-503799253737575101259426639421981 / 50000000000000000000000000000000), (338813202693 / 100000000000000000000000000000000)⟩ ⟨-15, 841560374014546517764872623, 610351562500000000000000000⟩, + .log ⟨(4967864196250324691748968943 / 4000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ ⟨(415503444731472158054937260161 / 50000000000000000000000000000000), (289296219 / 100000000000000000000000000000000)⟩ ⟨(-669105963154288189496535891004513 / 100000000000000000000000000000000), (14558378933 / 6250000000000000000000000000000)⟩ ⟨-10, 4967864196250324691748968943, 3906250000000000000000000000⟩, + .log ⟨(4359527261310185721805115931 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(1018757725742407205414154101 / 1250000000000000000000000000000), (5538997 / 20000000000000000000000000000000)⟩ ⟨(-93474146592329001732741510517769 / 10000000000000000000000000000000), (158818683357 / 50000000000000000000000000000000)⟩ ⟨-14, 4359527261310185721805115931, 3051757812500000000000000000⟩] +lemma CA4_5_7I1PairCertificates_valid : + CA4_5_7I1PairCertificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA4_5_7I1PairCertificateIndex (a : PairSlot × PairSlot) : ℕ := + match a.1.1.val, a.1.2.val, a.2.1.val, a.2.2.val with + | 1, 0, 5, 0 => 1 + | 1, 0, 4, 1 => 2 + | 1, 0, 2, 2 => 3 + | 1, 0, 2, 3 => 4 + | 1, 0, 3, 2 => 4 + | 1, 0, 3, 3 => 5 + | 1, 0, 1, 4 => 2 + | 1, 0, 0, 5 => 1 + | 0, 1, 5, 0 => 1 + | 0, 1, 4, 1 => 2 + | 0, 1, 2, 2 => 3 + | 0, 1, 2, 3 => 4 + | 0, 1, 3, 2 => 4 + | 0, 1, 3, 3 => 5 + | 0, 1, 1, 4 => 2 + | 0, 1, 0, 5 => 1 + | 2, 0, 4, 0 => 6 + | 2, 0, 2, 1 => 7 + | 2, 0, 3, 1 => 8 + | 2, 0, 1, 2 => 7 + | 2, 0, 1, 3 => 8 + | 2, 0, 0, 4 => 6 + | 3, 0, 4, 0 => 9 + | 3, 0, 2, 1 => 10 + | 3, 0, 3, 1 => 11 + | 3, 0, 1, 2 => 10 + | 3, 0, 1, 3 => 11 + | 3, 0, 0, 4 => 9 + | 1, 1, 4, 0 => 12 + | 1, 1, 2, 1 => 13 + | 1, 1, 3, 1 => 14 + | 1, 1, 1, 2 => 13 + | 1, 1, 1, 3 => 14 + | 1, 1, 0, 4 => 12 + | 0, 2, 4, 0 => 6 + | 0, 2, 2, 1 => 7 + | 0, 2, 3, 1 => 8 + | 0, 2, 1, 2 => 7 + | 0, 2, 1, 3 => 8 + | 0, 2, 0, 4 => 6 + | 0, 3, 4, 0 => 9 + | 0, 3, 2, 1 => 10 + | 0, 3, 3, 1 => 11 + | 0, 3, 1, 2 => 10 + | 0, 3, 1, 3 => 11 + | 0, 3, 0, 4 => 9 + | 4, 0, 2, 0 => 6 + | 4, 0, 3, 0 => 9 + | 4, 0, 1, 1 => 12 + | 4, 0, 0, 2 => 6 + | 4, 0, 0, 3 => 9 + | 2, 1, 2, 0 => 7 + | 2, 1, 3, 0 => 10 + | 2, 1, 1, 1 => 13 + | 2, 1, 0, 2 => 7 + | 2, 1, 0, 3 => 10 + | 3, 1, 2, 0 => 8 + | 3, 1, 3, 0 => 11 + | 3, 1, 1, 1 => 14 + | 3, 1, 0, 2 => 8 + | 3, 1, 0, 3 => 11 + | 1, 2, 2, 0 => 7 + | 1, 2, 3, 0 => 10 + | 1, 2, 1, 1 => 13 + | 1, 2, 0, 2 => 7 + | 1, 2, 0, 3 => 10 + | 1, 3, 2, 0 => 8 + | 1, 3, 3, 0 => 11 + | 1, 3, 1, 1 => 14 + | 1, 3, 0, 2 => 8 + | 1, 3, 0, 3 => 11 + | 0, 4, 2, 0 => 6 + | 0, 4, 3, 0 => 9 + | 0, 4, 1, 1 => 12 + | 0, 4, 0, 2 => 6 + | 0, 4, 0, 3 => 9 + | 0, 5, 1, 0 => 1 + | 0, 5, 0, 1 => 1 + | 1, 4, 1, 0 => 2 + | 1, 4, 0, 1 => 2 + | 2, 2, 1, 0 => 3 + | 2, 2, 0, 1 => 3 + | 2, 3, 1, 0 => 4 + | 2, 3, 0, 1 => 4 + | 3, 2, 1, 0 => 4 + | 3, 2, 0, 1 => 4 + | 3, 3, 1, 0 => 5 + | 3, 3, 0, 1 => 5 + | 4, 1, 1, 0 => 2 + | 4, 1, 0, 1 => 2 + | 5, 0, 1, 0 => 1 + | 5, 0, 0, 1 => 1 + | 1, 5, 0, 0 => 15 + | 2, 4, 0, 0 => 16 + | 3, 4, 0, 0 => 17 + | 4, 2, 0, 0 => 16 + | 4, 3, 0, 0 => 17 + | 5, 1, 0, 0 => 15 + | 0, 0, 1, 5 => 15 + | 0, 0, 2, 4 => 16 + | 0, 0, 3, 4 => 17 + | 0, 0, 4, 2 => 16 + | 0, 0, 4, 3 => 17 + | 0, 0, 5, 1 => 15 + | _, _, _, _ => 0 +def CA4_5_7I1PairP (a : PairSlot × PairSlot) : Ball := + (CompactCertificate.entropyLookup CA4_5_7I1PairCertificates (CA4_5_7I1PairCertificateIndex a)).input +lemma CA4_5_7I1PairP_check_0_0 : ∀ k l : Fin 6, contains (CA4_5_7I1PairRaw ((0,0),(k,l))) (CA4_5_7I1PairP ((0,0),(k,l))) = true := by + decide +kernel +lemma CA4_5_7I1PairP_check_0_1 : ∀ k l : Fin 6, contains (CA4_5_7I1PairRaw ((0,1),(k,l))) (CA4_5_7I1PairP ((0,1),(k,l))) = true := by + decide +kernel +lemma CA4_5_7I1PairP_check_0_2 : ∀ k l : Fin 6, contains (CA4_5_7I1PairRaw ((0,2),(k,l))) (CA4_5_7I1PairP ((0,2),(k,l))) = true := by + decide +kernel +lemma CA4_5_7I1PairP_check_0_3 : ∀ k l : Fin 6, contains (CA4_5_7I1PairRaw ((0,3),(k,l))) (CA4_5_7I1PairP ((0,3),(k,l))) = true := by + decide +kernel +lemma CA4_5_7I1PairP_check_0_4 : ∀ k l : Fin 6, contains (CA4_5_7I1PairRaw ((0,4),(k,l))) (CA4_5_7I1PairP ((0,4),(k,l))) = true := by + decide +kernel +lemma CA4_5_7I1PairP_check_0_5 : ∀ k l : Fin 6, contains (CA4_5_7I1PairRaw ((0,5),(k,l))) (CA4_5_7I1PairP ((0,5),(k,l))) = true := by + decide +kernel +lemma CA4_5_7I1PairP_check_1_0 : ∀ k l : Fin 6, contains (CA4_5_7I1PairRaw ((1,0),(k,l))) (CA4_5_7I1PairP ((1,0),(k,l))) = true := by + decide +kernel +lemma CA4_5_7I1PairP_check_1_1 : ∀ k l : Fin 6, contains (CA4_5_7I1PairRaw ((1,1),(k,l))) (CA4_5_7I1PairP ((1,1),(k,l))) = true := by + decide +kernel +lemma CA4_5_7I1PairP_check_1_2 : ∀ k l : Fin 6, contains (CA4_5_7I1PairRaw ((1,2),(k,l))) (CA4_5_7I1PairP ((1,2),(k,l))) = true := by + decide +kernel +lemma CA4_5_7I1PairP_check_1_3 : ∀ k l : Fin 6, contains (CA4_5_7I1PairRaw ((1,3),(k,l))) (CA4_5_7I1PairP ((1,3),(k,l))) = true := by + decide +kernel +lemma CA4_5_7I1PairP_check_1_4 : ∀ k l : Fin 6, contains (CA4_5_7I1PairRaw ((1,4),(k,l))) (CA4_5_7I1PairP ((1,4),(k,l))) = true := by + decide +kernel +lemma CA4_5_7I1PairP_check_1_5 : ∀ k l : Fin 6, contains (CA4_5_7I1PairRaw ((1,5),(k,l))) (CA4_5_7I1PairP ((1,5),(k,l))) = true := by + decide +kernel +lemma CA4_5_7I1PairP_check_2_0 : ∀ k l : Fin 6, contains (CA4_5_7I1PairRaw ((2,0),(k,l))) (CA4_5_7I1PairP ((2,0),(k,l))) = true := by + decide +kernel +lemma CA4_5_7I1PairP_check_2_1 : ∀ k l : Fin 6, contains (CA4_5_7I1PairRaw ((2,1),(k,l))) (CA4_5_7I1PairP ((2,1),(k,l))) = true := by + decide +kernel +lemma CA4_5_7I1PairP_check_2_2 : ∀ k l : Fin 6, contains (CA4_5_7I1PairRaw ((2,2),(k,l))) (CA4_5_7I1PairP ((2,2),(k,l))) = true := by + decide +kernel +lemma CA4_5_7I1PairP_check_2_3 : ∀ k l : Fin 6, contains (CA4_5_7I1PairRaw ((2,3),(k,l))) (CA4_5_7I1PairP ((2,3),(k,l))) = true := by + decide +kernel +lemma CA4_5_7I1PairP_check_2_4 : ∀ k l : Fin 6, contains (CA4_5_7I1PairRaw ((2,4),(k,l))) (CA4_5_7I1PairP ((2,4),(k,l))) = true := by + decide +kernel +lemma CA4_5_7I1PairP_check_2_5 : ∀ k l : Fin 6, contains (CA4_5_7I1PairRaw ((2,5),(k,l))) (CA4_5_7I1PairP ((2,5),(k,l))) = true := by + decide +kernel +lemma CA4_5_7I1PairP_check_3_0 : ∀ k l : Fin 6, contains (CA4_5_7I1PairRaw ((3,0),(k,l))) (CA4_5_7I1PairP ((3,0),(k,l))) = true := by + decide +kernel +lemma CA4_5_7I1PairP_check_3_1 : ∀ k l : Fin 6, contains (CA4_5_7I1PairRaw ((3,1),(k,l))) (CA4_5_7I1PairP ((3,1),(k,l))) = true := by + decide +kernel +lemma CA4_5_7I1PairP_check_3_2 : ∀ k l : Fin 6, contains (CA4_5_7I1PairRaw ((3,2),(k,l))) (CA4_5_7I1PairP ((3,2),(k,l))) = true := by + decide +kernel +lemma CA4_5_7I1PairP_check_3_3 : ∀ k l : Fin 6, contains (CA4_5_7I1PairRaw ((3,3),(k,l))) (CA4_5_7I1PairP ((3,3),(k,l))) = true := by + decide +kernel +lemma CA4_5_7I1PairP_check_3_4 : ∀ k l : Fin 6, contains (CA4_5_7I1PairRaw ((3,4),(k,l))) (CA4_5_7I1PairP ((3,4),(k,l))) = true := by + decide +kernel +lemma CA4_5_7I1PairP_check_3_5 : ∀ k l : Fin 6, contains (CA4_5_7I1PairRaw ((3,5),(k,l))) (CA4_5_7I1PairP ((3,5),(k,l))) = true := by + decide +kernel +lemma CA4_5_7I1PairP_check_4_0 : ∀ k l : Fin 6, contains (CA4_5_7I1PairRaw ((4,0),(k,l))) (CA4_5_7I1PairP ((4,0),(k,l))) = true := by + decide +kernel +lemma CA4_5_7I1PairP_check_4_1 : ∀ k l : Fin 6, contains (CA4_5_7I1PairRaw ((4,1),(k,l))) (CA4_5_7I1PairP ((4,1),(k,l))) = true := by + decide +kernel +lemma CA4_5_7I1PairP_check_4_2 : ∀ k l : Fin 6, contains (CA4_5_7I1PairRaw ((4,2),(k,l))) (CA4_5_7I1PairP ((4,2),(k,l))) = true := by + decide +kernel +lemma CA4_5_7I1PairP_check_4_3 : ∀ k l : Fin 6, contains (CA4_5_7I1PairRaw ((4,3),(k,l))) (CA4_5_7I1PairP ((4,3),(k,l))) = true := by + decide +kernel +lemma CA4_5_7I1PairP_check_4_4 : ∀ k l : Fin 6, contains (CA4_5_7I1PairRaw ((4,4),(k,l))) (CA4_5_7I1PairP ((4,4),(k,l))) = true := by + decide +kernel +lemma CA4_5_7I1PairP_check_4_5 : ∀ k l : Fin 6, contains (CA4_5_7I1PairRaw ((4,5),(k,l))) (CA4_5_7I1PairP ((4,5),(k,l))) = true := by + decide +kernel +lemma CA4_5_7I1PairP_check_5_0 : ∀ k l : Fin 6, contains (CA4_5_7I1PairRaw ((5,0),(k,l))) (CA4_5_7I1PairP ((5,0),(k,l))) = true := by + decide +kernel +lemma CA4_5_7I1PairP_check_5_1 : ∀ k l : Fin 6, contains (CA4_5_7I1PairRaw ((5,1),(k,l))) (CA4_5_7I1PairP ((5,1),(k,l))) = true := by + decide +kernel +lemma CA4_5_7I1PairP_check_5_2 : ∀ k l : Fin 6, contains (CA4_5_7I1PairRaw ((5,2),(k,l))) (CA4_5_7I1PairP ((5,2),(k,l))) = true := by + decide +kernel +lemma CA4_5_7I1PairP_check_5_3 : ∀ k l : Fin 6, contains (CA4_5_7I1PairRaw ((5,3),(k,l))) (CA4_5_7I1PairP ((5,3),(k,l))) = true := by + decide +kernel +lemma CA4_5_7I1PairP_check_5_4 : ∀ k l : Fin 6, contains (CA4_5_7I1PairRaw ((5,4),(k,l))) (CA4_5_7I1PairP ((5,4),(k,l))) = true := by + decide +kernel +lemma CA4_5_7I1PairP_check_5_5 : ∀ k l : Fin 6, contains (CA4_5_7I1PairRaw ((5,5),(k,l))) (CA4_5_7I1PairP ((5,5),(k,l))) = true := by + decide +kernel +lemma CA4_5_7I1PairP_check (a : PairSlot × PairSlot) : contains (CA4_5_7I1PairRaw a) (CA4_5_7I1PairP a) = true := by + rcases a with ⟨⟨i,j⟩,⟨k,l⟩⟩ + revert j i + apply forall_fin6 + · exact forall_fin6 (CA4_5_7I1PairP_check_0_0 k l) (CA4_5_7I1PairP_check_0_1 k l) (CA4_5_7I1PairP_check_0_2 k l) (CA4_5_7I1PairP_check_0_3 k l) (CA4_5_7I1PairP_check_0_4 k l) (CA4_5_7I1PairP_check_0_5 k l) + · exact forall_fin6 (CA4_5_7I1PairP_check_1_0 k l) (CA4_5_7I1PairP_check_1_1 k l) (CA4_5_7I1PairP_check_1_2 k l) (CA4_5_7I1PairP_check_1_3 k l) (CA4_5_7I1PairP_check_1_4 k l) (CA4_5_7I1PairP_check_1_5 k l) + · exact forall_fin6 (CA4_5_7I1PairP_check_2_0 k l) (CA4_5_7I1PairP_check_2_1 k l) (CA4_5_7I1PairP_check_2_2 k l) (CA4_5_7I1PairP_check_2_3 k l) (CA4_5_7I1PairP_check_2_4 k l) (CA4_5_7I1PairP_check_2_5 k l) + · exact forall_fin6 (CA4_5_7I1PairP_check_3_0 k l) (CA4_5_7I1PairP_check_3_1 k l) (CA4_5_7I1PairP_check_3_2 k l) (CA4_5_7I1PairP_check_3_3 k l) (CA4_5_7I1PairP_check_3_4 k l) (CA4_5_7I1PairP_check_3_5 k l) + · exact forall_fin6 (CA4_5_7I1PairP_check_4_0 k l) (CA4_5_7I1PairP_check_4_1 k l) (CA4_5_7I1PairP_check_4_2 k l) (CA4_5_7I1PairP_check_4_3 k l) (CA4_5_7I1PairP_check_4_4 k l) (CA4_5_7I1PairP_check_4_5 k l) + · exact forall_fin6 (CA4_5_7I1PairP_check_5_0 k l) (CA4_5_7I1PairP_check_5_1 k l) (CA4_5_7I1PairP_check_5_2 k l) (CA4_5_7I1PairP_check_5_3 k l) (CA4_5_7I1PairP_check_5_4 k l) (CA4_5_7I1PairP_check_5_5 k l) +lemma CA4_5_7I1PairP_sound (a : PairSlot × PairSlot) : + (CA4_5_7I1PairP a).Encloses (CA4_5_7I1PairValue a) := + contains_sound (CA4_5_7I1PairRaw_sound a) (CA4_5_7I1PairP_check a) +def CA4_5_7I1PairTerms (a : PairSlot × PairSlot) : Ball := + (CompactCertificate.entropyLookup CA4_5_7I1PairCertificates (CA4_5_7I1PairCertificateIndex a)).output +lemma CA4_5_7I1PairTerms_sound (a : PairSlot × PairSlot) : + (CA4_5_7I1PairTerms a).Encloses (Foundation.entropyTerm (CA4_5_7I1PairValue a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA4_5_7I1PairCertificates_valid + (CA4_5_7I1PairCertificateIndex a) (CA4_5_7I1PairP_sound a) +def CA4_5_7I1PairEntropy : Ball := ⟨(79691337278687147638616213846057 / 25000000000000000000000000000000), (32389139629 / 25000000000000000000000000000000)⟩ +lemma CA4_5_7I1PairEntropy_sound : CA4_5_7I1PairEntropy.Encloses (Foundation.finiteEntropy CA4_5_7I1PairValue) := by + exact contains_sound (entropyDoublePair_enclosed CA4_5_7I1PairValue CA4_5_7I1PairTerms CA4_5_7I1PairTerms_sound) (by decide +kernel) +def CA4_5_7I1PairMass : Ball := ⟨(12500000000000000000000000000001 / 12500000000000000000000000000000), (71 / 12500000000000000000000000000000)⟩ +lemma CA4_5_7I1PairMass_sound : CA4_5_7I1PairMass.Encloses (∑ a, CA4_5_7I1PairValue a) := by + exact contains_sound (doublePairSumBall_sound CA4_5_7I1PairP CA4_5_7I1PairValue CA4_5_7I1PairP_sound) (by decide +kernel) +def CA4_5_7I1PairMassTermLogWitness : LogWitness := ⟨0, 12500000000000000000000000000001, 12500000000000000000000000000000⟩ +def CA4_5_7I1PairMassTermLog : Ball := ⟨(1 / 12500000000000000000000000000000), (84703297 / 400000000000000000000000000000)⟩ +lemma CA4_5_7I1PairMassTermLog_sound : CA4_5_7I1PairMassTermLog.Encloses (Real.log ((∑ a, CA4_5_7I1PairValue a))) := by + exact checkLog_sound logTwoBall_sound (CA4_5_7I1PairMass_sound) (w := CA4_5_7I1PairMassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA4_5_7I1PairMassTerm : Ball := ⟨(-1 / 12500000000000000000000000000000), (21175824251 / 100000000000000000000000000000000)⟩ +lemma CA4_5_7I1PairMassTerm_sound : CA4_5_7I1PairMassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA4_5_7I1PairValue a))) := by + exact contains_sound (entropyTerm_ball (CA4_5_7I1PairMass_sound) CA4_5_7I1PairMassTermLog_sound) (by decide +kernel) +def CA4_5_7I1PairH : Ball := ⟨(79691337278687147638616213846059 / 25000000000000000000000000000000), (150732382767 / 100000000000000000000000000000000)⟩ +lemma CA4_5_7I1PairH_sound : CA4_5_7I1PairH.Encloses (homogeneousEntropy CA4_5_7I1PairValue) := by + exact contains_sound (homogeneous_enclosed CA4_5_7I1PairValue CA4_5_7I1PairMassTerm_sound CA4_5_7I1PairEntropy_sound) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CA4_5_7I1R0Value (a : PairSlot) : ℝ := residualLaw (below (shape 4 5 7)) (fun u => (stageALaw (shape 4 5 7) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 0 a +def CA4_5_7I1R0Raw (a : PairSlot) : Ball := residualBall (below (shape 4 5 7)) A4_5_7Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 0 a +lemma CA4_5_7I1R0Raw_sound (a : PairSlot) : + (CA4_5_7I1R0Raw a).Encloses (CA4_5_7I1R0Value a) := by + exact residualBall_sound_on (below (shape 4 5 7)) A4_5_7Law (fun u => (stageALaw (shape 4 5 7) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A4_5_7Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 4 5 7) (show (shape 4 5 7) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 0 a +def CA4_5_7I1R0Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(274246922597902442652317637103 / 100000000000000000000000000000000), (1 / 20000000000000000000000000000000)⟩ ⟨(1617754235717366730301305147667 / 100000000000000000000000000000000), (580740483 / 100000000000000000000000000000000)⟩ ⟨(-147472414675852045839935424960033 / 25000000000000000000000000000000), (211758238653 / 100000000000000000000000000000000)⟩ ⟨-9, 274246922597902442652317637103, 195312500000000000000000000000⟩] +lemma CA4_5_7I1R0Certificates_valid : + CA4_5_7I1R0Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA4_5_7I1R0CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 0, 0 => 1 + | _, _ => 0 +def CA4_5_7I1R0P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA4_5_7I1R0Certificates (CA4_5_7I1R0CertificateIndex a)).input +lemma CA4_5_7I1R0P_check : ∀ a : PairSlot, contains (CA4_5_7I1R0Raw a) (CA4_5_7I1R0P a) = true := by + decide +kernel +lemma CA4_5_7I1R0P_sound (a : PairSlot) : + (CA4_5_7I1R0P a).Encloses (CA4_5_7I1R0Value a) := + contains_sound (CA4_5_7I1R0Raw_sound a) (CA4_5_7I1R0P_check a) +def CA4_5_7I1R0Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA4_5_7I1R0Certificates (CA4_5_7I1R0CertificateIndex a)).output +lemma CA4_5_7I1R0Terms_sound (a : PairSlot) : + (CA4_5_7I1R0Terms a).Encloses (Foundation.entropyTerm (CA4_5_7I1R0Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA4_5_7I1R0Certificates_valid + (CA4_5_7I1R0CertificateIndex a) (CA4_5_7I1R0P_sound a) +def CA4_5_7I1R0Entropy : Ball := ⟨(1617754235717366730301305147667 / 100000000000000000000000000000000), (580740483 / 100000000000000000000000000000000)⟩ +lemma CA4_5_7I1R0Entropy_sound : CA4_5_7I1R0Entropy.Encloses (Foundation.finiteEntropy CA4_5_7I1R0Value) := by + exact contains_sound (entropyPair_enclosed CA4_5_7I1R0Value CA4_5_7I1R0Terms CA4_5_7I1R0Terms_sound) (by decide +kernel) +def CA4_5_7I1R0Mass : Ball := ⟨(274246922597902442652317637103 / 100000000000000000000000000000000), (1 / 20000000000000000000000000000000)⟩ +lemma CA4_5_7I1R0Mass_sound : CA4_5_7I1R0Mass.Encloses (∑ a, CA4_5_7I1R0Value a) := by + exact contains_sound (pairSumBall_sound CA4_5_7I1R0P CA4_5_7I1R0Value CA4_5_7I1R0P_sound) (by decide +kernel) +def CA4_5_7I1R0MassTermLogWitness : LogWitness := ⟨-9, 274246922597902442652317637103, 195312500000000000000000000000⟩ +def CA4_5_7I1R0MassTermLog : Ball := ⟨(-147472414675852045839935424960033 / 25000000000000000000000000000000), (211758238653 / 100000000000000000000000000000000)⟩ +lemma CA4_5_7I1R0MassTermLog_sound : CA4_5_7I1R0MassTermLog.Encloses (Real.log ((∑ a, CA4_5_7I1R0Value a))) := by + exact checkLog_sound logTwoBall_sound (CA4_5_7I1R0Mass_sound) (w := CA4_5_7I1R0MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA4_5_7I1R0MassTerm : Ball := ⟨(1617754235717366730301305147667 / 100000000000000000000000000000000), (580740483 / 100000000000000000000000000000000)⟩ +lemma CA4_5_7I1R0MassTerm_sound : CA4_5_7I1R0MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA4_5_7I1R0Value a))) := by + exact contains_sound (entropyTerm_ball (CA4_5_7I1R0Mass_sound) CA4_5_7I1R0MassTermLog_sound) (by decide +kernel) +def CA4_5_7I1R0H : Ball := ⟨0, (580740483 / 50000000000000000000000000000000)⟩ +lemma CA4_5_7I1R0H_sound : CA4_5_7I1R0H.Encloses (homogeneousEntropy CA4_5_7I1R0Value) := by + exact contains_sound (homogeneous_enclosed CA4_5_7I1R0Value CA4_5_7I1R0MassTerm_sound CA4_5_7I1R0Entropy_sound) (by decide +kernel) +def CA4_5_7I1R1Value (a : PairSlot) : ℝ := residualLaw (below (shape 4 5 7)) (fun u => (stageALaw (shape 4 5 7) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 1 a +def CA4_5_7I1R1Raw (a : PairSlot) : Ball := residualBall (below (shape 4 5 7)) A4_5_7Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 1 a +lemma CA4_5_7I1R1Raw_sound (a : PairSlot) : + (CA4_5_7I1R1Raw a).Encloses (CA4_5_7I1R1Value a) := by + exact residualBall_sound_on (below (shape 4 5 7)) A4_5_7Law (fun u => (stageALaw (shape 4 5 7) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A4_5_7Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 4 5 7) (show (shape 4 5 7) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 1 a +def CA4_5_7I1R1Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(433336345409804315292274935367 / 10000000000000000000000000000000), (23 / 100000000000000000000000000000000)⟩ ⟨(13601674597694605000986940575089 / 100000000000000000000000000000000), (5505752523 / 100000000000000000000000000000000)⟩ ⟨(-78470654156827994211266879368857 / 25000000000000000000000000000000), (31763735657 / 25000000000000000000000000000000)⟩ ⟨-5, 433336345409804315292274935367, 312500000000000000000000000000⟩] +lemma CA4_5_7I1R1Certificates_valid : + CA4_5_7I1R1Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA4_5_7I1R1CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 1, 0 => 1 + | 0, 1 => 1 + | _, _ => 0 +def CA4_5_7I1R1P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA4_5_7I1R1Certificates (CA4_5_7I1R1CertificateIndex a)).input +lemma CA4_5_7I1R1P_check : ∀ a : PairSlot, contains (CA4_5_7I1R1Raw a) (CA4_5_7I1R1P a) = true := by + decide +kernel +lemma CA4_5_7I1R1P_sound (a : PairSlot) : + (CA4_5_7I1R1P a).Encloses (CA4_5_7I1R1Value a) := + contains_sound (CA4_5_7I1R1Raw_sound a) (CA4_5_7I1R1P_check a) +def CA4_5_7I1R1Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA4_5_7I1R1Certificates (CA4_5_7I1R1CertificateIndex a)).output +lemma CA4_5_7I1R1Terms_sound (a : PairSlot) : + (CA4_5_7I1R1Terms a).Encloses (Foundation.entropyTerm (CA4_5_7I1R1Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA4_5_7I1R1Certificates_valid + (CA4_5_7I1R1CertificateIndex a) (CA4_5_7I1R1P_sound a) +def CA4_5_7I1R1Entropy : Ball := ⟨(13601674597694605000986940575089 / 50000000000000000000000000000000), (5505752523 / 50000000000000000000000000000000)⟩ +lemma CA4_5_7I1R1Entropy_sound : CA4_5_7I1R1Entropy.Encloses (Foundation.finiteEntropy CA4_5_7I1R1Value) := by + exact contains_sound (entropyPair_enclosed CA4_5_7I1R1Value CA4_5_7I1R1Terms CA4_5_7I1R1Terms_sound) (by decide +kernel) +def CA4_5_7I1R1Mass : Ball := ⟨(433336345409804315292274935367 / 5000000000000000000000000000000), (23 / 50000000000000000000000000000000)⟩ +lemma CA4_5_7I1R1Mass_sound : CA4_5_7I1R1Mass.Encloses (∑ a, CA4_5_7I1R1Value a) := by + exact contains_sound (pairSumBall_sound CA4_5_7I1R1P CA4_5_7I1R1Value CA4_5_7I1R1P_sound) (by decide +kernel) +def CA4_5_7I1R1MassTermLogWitness : LogWitness := ⟨-4, 433336345409804315292274935367, 312500000000000000000000000000⟩ +def CA4_5_7I1R1MassTermLog : Ball := ⟨(-122283949285658722951672162212549 / 50000000000000000000000000000000), (21175823789 / 20000000000000000000000000000000)⟩ +lemma CA4_5_7I1R1MassTermLog_sound : CA4_5_7I1R1MassTermLog.Encloses (Real.log ((∑ a, CA4_5_7I1R1Value a))) := by + exact checkLog_sound logTwoBall_sound (CA4_5_7I1R1Mass_sound) (w := CA4_5_7I1R1MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA4_5_7I1R1MassTerm : Ball := ⟨(10598015937145040405897974413661 / 50000000000000000000000000000000), (1835250841 / 20000000000000000000000000000000)⟩ +lemma CA4_5_7I1R1MassTerm_sound : CA4_5_7I1R1MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA4_5_7I1R1Value a))) := by + exact contains_sound (entropyTerm_ball (CA4_5_7I1R1Mass_sound) CA4_5_7I1R1MassTermLog_sound) (by decide +kernel) +def CA4_5_7I1R1H : Ball := ⟨(750914665137391148772241540357 / 12500000000000000000000000000000), (20187759251 / 100000000000000000000000000000000)⟩ +lemma CA4_5_7I1R1H_sound : CA4_5_7I1R1H.Encloses (homogeneousEntropy CA4_5_7I1R1Value) := by + exact contains_sound (homogeneous_enclosed CA4_5_7I1R1Value CA4_5_7I1R1MassTerm_sound CA4_5_7I1R1Entropy_sound) (by decide +kernel) +def CA4_5_7I1R2Value (a : PairSlot) : ℝ := residualLaw (below (shape 4 5 7)) (fun u => (stageALaw (shape 4 5 7) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 2 a +def CA4_5_7I1R2Raw (a : PairSlot) : Ball := residualBall (below (shape 4 5 7)) A4_5_7Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 2 a +lemma CA4_5_7I1R2Raw_sound (a : PairSlot) : + (CA4_5_7I1R2Raw a).Encloses (CA4_5_7I1R2Value a) := by + exact residualBall_sound_on (below (shape 4 5 7)) A4_5_7Law (fun u => (stageALaw (shape 4 5 7) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A4_5_7Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 4 5 7) (show (shape 4 5 7) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 2 a +def CA4_5_7I1R2Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(175001355688617307212996593331 / 2500000000000000000000000000000), (7 / 20000000000000000000000000000000)⟩ ⟨(18614910235917211126043375071177 / 100000000000000000000000000000000), (7411595833 / 100000000000000000000000000000000)⟩ ⟨(-6648130725426713508786156902229 / 2500000000000000000000000000000), (52939559457 / 50000000000000000000000000000000)⟩ ⟨-4, 175001355688617307212996593331, 156250000000000000000000000000⟩, + .log ⟨(573037410501933542733189896149 / 100000000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ ⟨(92437639953913351815423558279 / 3125000000000000000000000000000), (1092108551 / 100000000000000000000000000000000)⟩ ⟨(-516197446155262206896439087820737 / 100000000000000000000000000000000), (47645603461 / 25000000000000000000000000000000)⟩ ⟨-8, 573037410501933542733189896149, 390625000000000000000000000000⟩, + .log ⟨(25912842893112759588996076396781 / 100000000000000000000000000000000), (39 / 50000000000000000000000000000000)⟩ ⟨(174967593323596970613469417049 / 500000000000000000000000000000), (16461773951 / 100000000000000000000000000000000)⟩ ⟨(-67521573779193753290625642121891 / 50000000000000000000000000000000), (63527471349 / 100000000000000000000000000000000)⟩ ⟨-2, 25912842893112759588996076396781, 25000000000000000000000000000000⟩] +lemma CA4_5_7I1R2Certificates_valid : + CA4_5_7I1R2Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA4_5_7I1R2CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 2, 0 => 1 + | 3, 0 => 2 + | 1, 1 => 3 + | 0, 2 => 1 + | 0, 3 => 2 + | _, _ => 0 +def CA4_5_7I1R2P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA4_5_7I1R2Certificates (CA4_5_7I1R2CertificateIndex a)).input +lemma CA4_5_7I1R2P_check : ∀ a : PairSlot, contains (CA4_5_7I1R2Raw a) (CA4_5_7I1R2P a) = true := by + decide +kernel +lemma CA4_5_7I1R2P_sound (a : PairSlot) : + (CA4_5_7I1R2P a).Encloses (CA4_5_7I1R2Value a) := + contains_sound (CA4_5_7I1R2Raw_sound a) (CA4_5_7I1R2P_check a) +def CA4_5_7I1R2Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA4_5_7I1R2Certificates (CA4_5_7I1R2CertificateIndex a)).output +lemma CA4_5_7I1R2Terms_sound (a : PairSlot) : + (CA4_5_7I1R2Terms a).Encloses (Foundation.entropyTerm (CA4_5_7I1R2Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA4_5_7I1R2Certificates_valid + (CA4_5_7I1R2CertificateIndex a) (CA4_5_7I1R2P_sound a) +def CA4_5_7I1R2Entropy : Ball := ⟨(7813934809360427089096774128201 / 10000000000000000000000000000000), (33469182719 / 100000000000000000000000000000000)⟩ +lemma CA4_5_7I1R2Entropy_sound : CA4_5_7I1R2Entropy.Encloses (Foundation.finiteEntropy CA4_5_7I1R2Value) := by + exact contains_sound (entropyPair_enclosed CA4_5_7I1R2Value CA4_5_7I1R2Terms CA4_5_7I1R2Terms_sound) (by decide +kernel) +def CA4_5_7I1R2Mass : Ball := ⟨(41059026169206011251502183655559 / 100000000000000000000000000000000), (39 / 25000000000000000000000000000000)⟩ +lemma CA4_5_7I1R2Mass_sound : CA4_5_7I1R2Mass.Encloses (∑ a, CA4_5_7I1R2Value a) := by + exact contains_sound (pairSumBall_sound CA4_5_7I1R2P CA4_5_7I1R2Value CA4_5_7I1R2P_sound) (by decide +kernel) +def CA4_5_7I1R2MassTermLogWitness : LogWitness := ⟨-2, 41059026169206011251502183655559, 25000000000000000000000000000000⟩ +def CA4_5_7I1R2MassTermLog : Ball := ⟨(-44507974597047939457626321697919 / 50000000000000000000000000000000), (15881867857 / 25000000000000000000000000000000)⟩ +lemma CA4_5_7I1R2MassTermLog_sound : CA4_5_7I1R2MassTermLog.Encloses (Real.log ((∑ a, CA4_5_7I1R2Value a))) := by + exact checkLog_sound logTwoBall_sound (CA4_5_7I1R2Mass_sound) (w := CA4_5_7I1R2MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA4_5_7I1R2MassTerm : Ball := ⟨(9137270468592738599433860267587 / 25000000000000000000000000000000), (13041880629 / 50000000000000000000000000000000)⟩ +lemma CA4_5_7I1R2MassTerm_sound : CA4_5_7I1R2MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA4_5_7I1R2Value a))) := by + exact contains_sound (entropyTerm_ball (CA4_5_7I1R2Mass_sound) CA4_5_7I1R2MassTermLog_sound) (by decide +kernel) +def CA4_5_7I1R2H : Ball := ⟨(20795133109616658246616150105831 / 50000000000000000000000000000000), (59552943977 / 100000000000000000000000000000000)⟩ +lemma CA4_5_7I1R2H_sound : CA4_5_7I1R2H.Encloses (homogeneousEntropy CA4_5_7I1R2Value) := by + exact contains_sound (homogeneous_enclosed CA4_5_7I1R2Value CA4_5_7I1R2MassTerm_sound CA4_5_7I1R2Entropy_sound) (by decide +kernel) +def CA4_5_7I1R3Value (a : PairSlot) : ℝ := residualLaw (below (shape 4 5 7)) (fun u => (stageALaw (shape 4 5 7) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 3 a +def CA4_5_7I1R3Raw (a : PairSlot) : Ball := residualBall (below (shape 4 5 7)) A4_5_7Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 3 a +lemma CA4_5_7I1R3Raw_sound (a : PairSlot) : + (CA4_5_7I1R3Raw a).Encloses (CA4_5_7I1R3Value a) := by + exact residualBall_sound_on (below (shape 4 5 7)) A4_5_7Law (fun u => (stageALaw (shape 4 5 7) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A4_5_7Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 4 5 7) (show (shape 4 5 7) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 3 a +def CA4_5_7I1R3Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(34663934789452289498915634059 / 6250000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ ⟨(2881064898018432527557952332239 / 100000000000000000000000000000000), (13212673 / 1250000000000000000000000000000)⟩ ⟨(-51946369395128091335029867965229 / 10000000000000000000000000000000), (47645603467 / 25000000000000000000000000000000)⟩ ⟨-8, 34663934789452289498915634059, 24414062500000000000000000000⟩, + .log ⟨(9265173250061086006872925868721 / 50000000000000000000000000000000), (1 / 2000000000000000000000000000000)⟩ ⟨(6247545037793812001820879868087 / 20000000000000000000000000000000), (7847907073 / 50000000000000000000000000000000)⟩ ⟨(-21072005580658669321609938394017 / 12500000000000000000000000000000), (84703295001 / 100000000000000000000000000000000)⟩ ⟨-3, 9265173250061086006872925868721, 6250000000000000000000000000000⟩, + .log ⟨(722271813924798490011294972697 / 50000000000000000000000000000000), (1 / 20000000000000000000000000000000)⟩ ⟨(47820902910853977069879978091 / 781250000000000000000000000000), (61178803 / 2500000000000000000000000000000)⟩ ⟨(-423737674278580066800285156911857 / 100000000000000000000000000000000), (16940658981 / 10000000000000000000000000000000)⟩ ⟨-7, 722271813924798490011294972697, 390625000000000000000000000000⟩] +lemma CA4_5_7I1R3Certificates_valid : + CA4_5_7I1R3Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA4_5_7I1R3CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 4, 0 => 1 + | 2, 1 => 2 + | 3, 1 => 3 + | 1, 2 => 2 + | 1, 3 => 3 + | 0, 4 => 1 + | _, _ => 0 +def CA4_5_7I1R3P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA4_5_7I1R3Certificates (CA4_5_7I1R3CertificateIndex a)).input +lemma CA4_5_7I1R3P_check : ∀ a : PairSlot, contains (CA4_5_7I1R3Raw a) (CA4_5_7I1R3P a) = true := by + decide +kernel +lemma CA4_5_7I1R3P_sound (a : PairSlot) : + (CA4_5_7I1R3P a).Encloses (CA4_5_7I1R3Value a) := + contains_sound (CA4_5_7I1R3Raw_sound a) (CA4_5_7I1R3P_check a) +def CA4_5_7I1R3Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA4_5_7I1R3Certificates (CA4_5_7I1R3CertificateIndex a)).output +lemma CA4_5_7I1R3Terms_sound (a : PairSlot) : + (CA4_5_7I1R3Terms a).Encloses (Foundation.entropyTerm (CA4_5_7I1R3Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA4_5_7I1R3Certificates_valid + (CA4_5_7I1R3CertificateIndex a) (CA4_5_7I1R3P_sound a) +def CA4_5_7I1R3Entropy : Ball := ⟨(20119932829788400800803494434161 / 25000000000000000000000000000000), (9599990053 / 25000000000000000000000000000000)⟩ +lemma CA4_5_7I1R3Entropy_sound : CA4_5_7I1R3Entropy.Encloses (Foundation.finiteEntropy CA4_5_7I1R3Value) := by + exact contains_sound (entropyPair_enclosed CA4_5_7I1R3Value CA4_5_7I1R3Terms CA4_5_7I1R3Terms_sound) (by decide +kernel) +def CA4_5_7I1R3Mass : Ball := ⟨(1026475654230150281287554591389 / 2500000000000000000000000000000), (59 / 50000000000000000000000000000000)⟩ +lemma CA4_5_7I1R3Mass_sound : CA4_5_7I1R3Mass.Encloses (∑ a, CA4_5_7I1R3Value a) := by + exact contains_sound (pairSumBall_sound CA4_5_7I1R3P CA4_5_7I1R3Value CA4_5_7I1R3P_sound) (by decide +kernel) +def CA4_5_7I1R3MassTermLogWitness : LogWitness := ⟨-2, 1026475654230150281287554591389, 625000000000000000000000000000⟩ +def CA4_5_7I1R3MassTermLog : Ball := ⟨(-22253987298523969728813160848959 / 25000000000000000000000000000000), (7940933917 / 12500000000000000000000000000000)⟩ +lemma CA4_5_7I1R3MassTermLog_sound : CA4_5_7I1R3MassTermLog.Encloses (Real.log ((∑ a, CA4_5_7I1R3Value a))) := by + exact checkLog_sound logTwoBall_sound (CA4_5_7I1R3Mass_sound) (w := CA4_5_7I1R3MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA4_5_7I1R3MassTerm : Ball := ⟨(9137270468592738599433860267587 / 25000000000000000000000000000000), (13041880593 / 50000000000000000000000000000000)⟩ +lemma CA4_5_7I1R3MassTerm_sound : CA4_5_7I1R3MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA4_5_7I1R3Value a))) := by + exact contains_sound (entropyTerm_ball (CA4_5_7I1R3Mass_sound) CA4_5_7I1R3MassTermLog_sound) (by decide +kernel) +def CA4_5_7I1R3H : Ball := ⟨(5491331180597831100684817083287 / 12500000000000000000000000000000), (32241860699 / 50000000000000000000000000000000)⟩ +lemma CA4_5_7I1R3H_sound : CA4_5_7I1R3H.Encloses (homogeneousEntropy CA4_5_7I1R3Value) := by + exact contains_sound (homogeneous_enclosed CA4_5_7I1R3Value CA4_5_7I1R3MassTerm_sound CA4_5_7I1R3Entropy_sound) (by decide +kernel) +def CA4_5_7I1R4Value (a : PairSlot) : ℝ := residualLaw (below (shape 4 5 7)) (fun u => (stageALaw (shape 4 5 7) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 4 a +def CA4_5_7I1R4Raw (a : PairSlot) : Ball := residualBall (below (shape 4 5 7)) A4_5_7Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 4 a +lemma CA4_5_7I1R4Raw_sound (a : PairSlot) : + (CA4_5_7I1R4Raw a).Encloses (CA4_5_7I1R4Value a) := by + exact residualBall_sound_on (below (shape 4 5 7)) A4_5_7Law (fun u => (stageALaw (shape 4 5 7) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A4_5_7Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 4 5 7) (show (shape 4 5 7) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 4 a +def CA4_5_7I1R4Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(658874712842399214977204153 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(12980761914397518637762388271 / 25000000000000000000000000000000), (8929423 / 50000000000000000000000000000000)⟩ ⟨(-985070580292741980894805713655271 / 100000000000000000000000000000000), (338813197899 / 100000000000000000000000000000000)⟩ ⟨-15, 658874712842399214977204153, 381469726562500000000000000⟩, + .log ⟨(754777223342937116225266002401 / 100000000000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ ⟨(184411051806776859203012729963 / 5000000000000000000000000000000), (719236341 / 50000000000000000000000000000000)⟩ ⟨(-488650282768240609177503271384849 / 100000000000000000000000000000000), (95291206971 / 50000000000000000000000000000000)⟩ ⟨-8, 754777223342937116225266002401, 390625000000000000000000000000⟩, + .log ⟨(6372123173650731951081423713949 / 100000000000000000000000000000000), (33 / 100000000000000000000000000000000)⟩ ⟨(8771984122418504944039848966003 / 50000000000000000000000000000000), (1349349593 / 20000000000000000000000000000000)⟩ ⟨(-275323746367345845113860573948821 / 100000000000000000000000000000000), (26469779733 / 25000000000000000000000000000000)⟩ ⟨-4, 6372123173650731951081423713949, 6250000000000000000000000000000⟩, + .log ⟨(378476123399241868964196248359 / 100000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ ⟨(2110675227891045696596471406763 / 100000000000000000000000000000000), (400727193 / 50000000000000000000000000000000)⟩ ⟨(-139419311906273452710645510129687 / 25000000000000000000000000000000), (105879118811 / 50000000000000000000000000000000)⟩ ⟨-9, 378476123399241868964196248359, 195312500000000000000000000000⟩, + .log ⟨(8596793995853834942853549759 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(149040708017777450506454299703 / 100000000000000000000000000000000), (10194477 / 20000000000000000000000000000000)⟩ ⟨(-216709723545862843129706562076591 / 25000000000000000000000000000000), (296461537377 / 100000000000000000000000000000000)⟩ ⟨-13, 8596793995853834942853549759, 6103515625000000000000000000⟩] +lemma CA4_5_7I1R4Certificates_valid : + CA4_5_7I1R4Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA4_5_7I1R4CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 0, 5 => 1 + | 1, 4 => 2 + | 2, 2 => 3 + | 2, 3 => 4 + | 3, 2 => 4 + | 3, 3 => 5 + | 4, 1 => 2 + | 5, 0 => 1 + | _, _ => 0 +def CA4_5_7I1R4P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA4_5_7I1R4Certificates (CA4_5_7I1R4CertificateIndex a)).input +lemma CA4_5_7I1R4P_check : ∀ a : PairSlot, contains (CA4_5_7I1R4Raw a) (CA4_5_7I1R4P a) = true := by + decide +kernel +lemma CA4_5_7I1R4P_sound (a : PairSlot) : + (CA4_5_7I1R4P a).Encloses (CA4_5_7I1R4Value a) := + contains_sound (CA4_5_7I1R4Raw_sound a) (CA4_5_7I1R4P_check a) +def CA4_5_7I1R4Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA4_5_7I1R4Certificates (CA4_5_7I1R4CertificateIndex a)).output +lemma CA4_5_7I1R4Terms_sound (a : PairSlot) : + (CA4_5_7I1R4Terms a).Encloses (Foundation.entropyTerm (CA4_5_7I1R4Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA4_5_7I1R4Certificates_valid + (CA4_5_7I1R4CertificateIndex a) (CA4_5_7I1R4P_sound a) +def CA4_5_7I1R4Entropy : Ball := ⟨(29394647576223133249001703349923 / 100000000000000000000000000000000), (5656646089 / 50000000000000000000000000000000)⟩ +lemma CA4_5_7I1R4Entropy_sound : CA4_5_7I1R4Entropy.Encloses (Foundation.finiteEntropy CA4_5_7I1R4Value) := by + exact contains_sound (entropyPair_enclosed CA4_5_7I1R4Value CA4_5_7I1R4Terms CA4_5_7I1R4Terms_sound) (by decide +kernel) +def CA4_5_7I1R4Mass : Ball := ⟨(1733273090106455195757138116287 / 20000000000000000000000000000000), (27 / 50000000000000000000000000000000)⟩ +lemma CA4_5_7I1R4Mass_sound : CA4_5_7I1R4Mass.Encloses (∑ a, CA4_5_7I1R4Value a) := by + exact contains_sound (pairSumBall_sound CA4_5_7I1R4P CA4_5_7I1R4Value CA4_5_7I1R4P_sound) (by decide +kernel) +def CA4_5_7I1R4MassTermLogWitness : LogWitness := ⟨-4, 1733273090106455195757138116287, 1250000000000000000000000000000⟩ +def CA4_5_7I1R4MassTermLog : Ball := ⟨(-122286034647326346589745223372571 / 50000000000000000000000000000000), (52939559519 / 50000000000000000000000000000000)⟩ +lemma CA4_5_7I1R4MassTermLog_sound : CA4_5_7I1R4MassTermLog.Encloses (Real.log ((∑ a, CA4_5_7I1R4Value a))) := by + exact checkLog_sound logTwoBall_sound (CA4_5_7I1R4Mass_sound) (w := CA4_5_7I1R4MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA4_5_7I1R4MassTerm : Ball := ⟨(4239101863000727614975279320073 / 20000000000000000000000000000000), (2293967881 / 25000000000000000000000000000000)⟩ +lemma CA4_5_7I1R4MassTerm_sound : CA4_5_7I1R4MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA4_5_7I1R4Value a))) := by + exact contains_sound (entropyTerm_ball (CA4_5_7I1R4Mass_sound) CA4_5_7I1R4MassTermLog_sound) (by decide +kernel) +def CA4_5_7I1R4H : Ball := ⟨(4099569130609747587062653374779 / 50000000000000000000000000000000), (10244581851 / 50000000000000000000000000000000)⟩ +lemma CA4_5_7I1R4H_sound : CA4_5_7I1R4H.Encloses (homogeneousEntropy CA4_5_7I1R4Value) := by + exact contains_sound (homogeneous_enclosed CA4_5_7I1R4Value CA4_5_7I1R4MassTerm_sound CA4_5_7I1R4Entropy_sound) (by decide +kernel) +def CA4_5_7I1R5Value (a : PairSlot) : ℝ := residualLaw (below (shape 4 5 7)) (fun u => (stageALaw (shape 4 5 7) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 5 a +def CA4_5_7I1R5Raw (a : PairSlot) : Ball := residualBall (below (shape 4 5 7)) A4_5_7Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 5 a +lemma CA4_5_7I1R5Raw_sound (a : PairSlot) : + (CA4_5_7I1R5Raw a).Encloses (CA4_5_7I1R5Value a) := by + exact residualBall_sound_on (below (shape 4 5 7)) A4_5_7Law (fun u => (stageALaw (shape 4 5 7) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A4_5_7Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 4 5 7) (show (shape 4 5 7) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 5 a +def CA4_5_7I1R5Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(2102259875666009394668516601 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(21183979549643899692768589869 / 50000000000000000000000000000000), (14245479 / 100000000000000000000000000000000)⟩ ⟨(-100767653870255594718702589503333 / 10000000000000000000000000000000), (338813202711 / 100000000000000000000000000000000)⟩ ⟨-15, 2102259875666009394668516601, 1525878906250000000000000000⟩, + .log ⟨(124142045552361735235235821983 / 100000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ ⟨(830696376940791392993809008323 / 100000000000000000000000000000000), (289169131 / 100000000000000000000000000000000)⟩ ⟨(-669149902633441699371747479833533 / 100000000000000000000000000000000), (232934062929 / 100000000000000000000000000000000)⟩ ⟨-10, 124142045552361735235235821983, 97656250000000000000000000000⟩, + .log ⟨(8713316072434631107206395521 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(81452714947394473747296396707 / 100000000000000000000000000000000), (13838379 / 50000000000000000000000000000000)⟩ ⟨(-934807302641959186552706162933163 / 100000000000000000000000000000000), (317637366721 / 100000000000000000000000000000000)⟩ ⟨-14, 8713316072434631107206395521, 6103515625000000000000000000⟩] +lemma CA4_5_7I1R5Certificates_valid : + CA4_5_7I1R5Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA4_5_7I1R5CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 1, 5 => 1 + | 2, 4 => 2 + | 3, 4 => 3 + | 4, 2 => 2 + | 4, 3 => 3 + | 5, 1 => 1 + | _, _ => 0 +def CA4_5_7I1R5P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA4_5_7I1R5Certificates (CA4_5_7I1R5CertificateIndex a)).input +lemma CA4_5_7I1R5P_check : ∀ a : PairSlot, contains (CA4_5_7I1R5Raw a) (CA4_5_7I1R5P a) = true := by + decide +kernel +lemma CA4_5_7I1R5P_sound (a : PairSlot) : + (CA4_5_7I1R5P a).Encloses (CA4_5_7I1R5Value a) := + contains_sound (CA4_5_7I1R5Raw_sound a) (CA4_5_7I1R5P_check a) +def CA4_5_7I1R5Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA4_5_7I1R5Certificates (CA4_5_7I1R5CertificateIndex a)).output +lemma CA4_5_7I1R5Terms_sound (a : PairSlot) : + (CA4_5_7I1R5Terms a).Encloses (Foundation.entropyTerm (CA4_5_7I1R5Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA4_5_7I1R5Certificates_valid + (CA4_5_7I1R5CertificateIndex a) (CA4_5_7I1R5P_sound a) +def CA4_5_7I1R5Entropy : Ball := ⟨(14914328921679276033228790387 / 781250000000000000000000000000), (41386421 / 6250000000000000000000000000000)⟩ +lemma CA4_5_7I1R5Entropy_sound : CA4_5_7I1R5Entropy.Encloses (Foundation.finiteEntropy CA4_5_7I1R5Value) := by + exact contains_sound (entropyPair_enclosed CA4_5_7I1R5Value CA4_5_7I1R5Terms CA4_5_7I1R5Terms_sound) (by decide +kernel) +def CA4_5_7I1R5Mass : Ball := ⟨(68529940688064192565889625353 / 25000000000000000000000000000000), (1 / 10000000000000000000000000000000)⟩ +lemma CA4_5_7I1R5Mass_sound : CA4_5_7I1R5Mass.Encloses (∑ a, CA4_5_7I1R5Value a) := by + exact contains_sound (pairSumBall_sound CA4_5_7I1R5P CA4_5_7I1R5Value CA4_5_7I1R5P_sound) (by decide +kernel) +def CA4_5_7I1R5MassTermLogWitness : LogWitness := ⟨-9, 68529940688064192565889625353, 48828125000000000000000000000⟩ +def CA4_5_7I1R5MassTermLog : Ball := ⟨(-294968018187080496147774346415151 / 50000000000000000000000000000000), (211758240477 / 100000000000000000000000000000000)⟩ +lemma CA4_5_7I1R5MassTermLog_sound : CA4_5_7I1R5MassTermLog.Encloses (Real.log ((∑ a, CA4_5_7I1R5Value a))) := by + exact checkLog_sound logTwoBall_sound (CA4_5_7I1R5Mass_sound) (w := CA4_5_7I1R5MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA4_5_7I1R5MassTerm : Ball := ⟨(80856563164945865771325579269 / 5000000000000000000000000000000), (290235623 / 50000000000000000000000000000000)⟩ +lemma CA4_5_7I1R5MassTerm_sound : CA4_5_7I1R5MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA4_5_7I1R5Value a))) := by + exact contains_sound (entropyTerm_ball (CA4_5_7I1R5Mass_sound) CA4_5_7I1R5MassTermLog_sound) (by decide +kernel) +def CA4_5_7I1R5H : Ball := ⟨(72975709669007504206693396039 / 25000000000000000000000000000000), (621326991 / 50000000000000000000000000000000)⟩ +lemma CA4_5_7I1R5H_sound : CA4_5_7I1R5H.Encloses (homogeneousEntropy CA4_5_7I1R5Value) := by + exact contains_sound (homogeneous_enclosed CA4_5_7I1R5Value CA4_5_7I1R5MassTerm_sound CA4_5_7I1R5Entropy_sound) (by decide +kernel) +def CA4_5_7I1R6Value (a : PairSlot) : ℝ := residualLaw (below (shape 4 5 7)) (fun u => (stageALaw (shape 4 5 7) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 6 a +def CA4_5_7I1R6Raw (a : PairSlot) : Ball := residualBall (below (shape 4 5 7)) A4_5_7Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 6 a +lemma CA4_5_7I1R6Raw_sound (a : PairSlot) : + (CA4_5_7I1R6Raw a).Encloses (CA4_5_7I1R6Value a) := by + exact residualBall_sound_on (below (shape 4 5 7)) A4_5_7Law (fun u => (stageALaw (shape 4 5 7) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A4_5_7Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 4 5 7) (show (shape 4 5 7) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 6 a +def CA4_5_7I1R6Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA4_5_7I1R6Certificates_valid : + CA4_5_7I1R6Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA4_5_7I1R6CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA4_5_7I1R6P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA4_5_7I1R6Certificates (CA4_5_7I1R6CertificateIndex a)).input +lemma CA4_5_7I1R6P_check : ∀ a : PairSlot, contains (CA4_5_7I1R6Raw a) (CA4_5_7I1R6P a) = true := by + decide +kernel +lemma CA4_5_7I1R6P_sound (a : PairSlot) : + (CA4_5_7I1R6P a).Encloses (CA4_5_7I1R6Value a) := + contains_sound (CA4_5_7I1R6Raw_sound a) (CA4_5_7I1R6P_check a) +def CA4_5_7I1R6Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA4_5_7I1R6Certificates (CA4_5_7I1R6CertificateIndex a)).output +lemma CA4_5_7I1R6Terms_sound (a : PairSlot) : + (CA4_5_7I1R6Terms a).Encloses (Foundation.entropyTerm (CA4_5_7I1R6Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA4_5_7I1R6Certificates_valid + (CA4_5_7I1R6CertificateIndex a) (CA4_5_7I1R6P_sound a) +def CA4_5_7I1R6Entropy : Ball := ⟨0, 0⟩ +lemma CA4_5_7I1R6Entropy_sound : CA4_5_7I1R6Entropy.Encloses (Foundation.finiteEntropy CA4_5_7I1R6Value) := by + exact contains_sound (entropyPair_enclosed CA4_5_7I1R6Value CA4_5_7I1R6Terms CA4_5_7I1R6Terms_sound) (by decide +kernel) +def CA4_5_7I1R6Mass : Ball := ⟨0, 0⟩ +lemma CA4_5_7I1R6Mass_sound : CA4_5_7I1R6Mass.Encloses (∑ a, CA4_5_7I1R6Value a) := by + exact contains_sound (pairSumBall_sound CA4_5_7I1R6P CA4_5_7I1R6Value CA4_5_7I1R6P_sound) (by decide +kernel) +def CA4_5_7I1R6MassTerm : Ball := .exact 0 +lemma CA4_5_7I1R6MassTerm_sound : CA4_5_7I1R6MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA4_5_7I1R6Value a))) := + entropyTerm_zero_ball (CA4_5_7I1R6Mass_sound) +def CA4_5_7I1R6H : Ball := ⟨0, 0⟩ +lemma CA4_5_7I1R6H_sound : CA4_5_7I1R6H.Encloses (homogeneousEntropy CA4_5_7I1R6Value) := by + exact contains_sound (homogeneous_enclosed CA4_5_7I1R6Value CA4_5_7I1R6MassTerm_sound CA4_5_7I1R6Entropy_sound) (by decide +kernel) +def CA4_5_7I1R7Value (a : PairSlot) : ℝ := residualLaw (below (shape 4 5 7)) (fun u => (stageALaw (shape 4 5 7) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 7 a +def CA4_5_7I1R7Raw (a : PairSlot) : Ball := residualBall (below (shape 4 5 7)) A4_5_7Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 7 a +lemma CA4_5_7I1R7Raw_sound (a : PairSlot) : + (CA4_5_7I1R7Raw a).Encloses (CA4_5_7I1R7Value a) := by + exact residualBall_sound_on (below (shape 4 5 7)) A4_5_7Law (fun u => (stageALaw (shape 4 5 7) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A4_5_7Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 4 5 7) (show (shape 4 5 7) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 7 a +def CA4_5_7I1R7Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA4_5_7I1R7Certificates_valid : + CA4_5_7I1R7Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA4_5_7I1R7CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA4_5_7I1R7P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA4_5_7I1R7Certificates (CA4_5_7I1R7CertificateIndex a)).input +lemma CA4_5_7I1R7P_check : ∀ a : PairSlot, contains (CA4_5_7I1R7Raw a) (CA4_5_7I1R7P a) = true := by + decide +kernel +lemma CA4_5_7I1R7P_sound (a : PairSlot) : + (CA4_5_7I1R7P a).Encloses (CA4_5_7I1R7Value a) := + contains_sound (CA4_5_7I1R7Raw_sound a) (CA4_5_7I1R7P_check a) +def CA4_5_7I1R7Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA4_5_7I1R7Certificates (CA4_5_7I1R7CertificateIndex a)).output +lemma CA4_5_7I1R7Terms_sound (a : PairSlot) : + (CA4_5_7I1R7Terms a).Encloses (Foundation.entropyTerm (CA4_5_7I1R7Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA4_5_7I1R7Certificates_valid + (CA4_5_7I1R7CertificateIndex a) (CA4_5_7I1R7P_sound a) +def CA4_5_7I1R7Entropy : Ball := ⟨0, 0⟩ +lemma CA4_5_7I1R7Entropy_sound : CA4_5_7I1R7Entropy.Encloses (Foundation.finiteEntropy CA4_5_7I1R7Value) := by + exact contains_sound (entropyPair_enclosed CA4_5_7I1R7Value CA4_5_7I1R7Terms CA4_5_7I1R7Terms_sound) (by decide +kernel) +def CA4_5_7I1R7Mass : Ball := ⟨0, 0⟩ +lemma CA4_5_7I1R7Mass_sound : CA4_5_7I1R7Mass.Encloses (∑ a, CA4_5_7I1R7Value a) := by + exact contains_sound (pairSumBall_sound CA4_5_7I1R7P CA4_5_7I1R7Value CA4_5_7I1R7P_sound) (by decide +kernel) +def CA4_5_7I1R7MassTerm : Ball := .exact 0 +lemma CA4_5_7I1R7MassTerm_sound : CA4_5_7I1R7MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA4_5_7I1R7Value a))) := + entropyTerm_zero_ball (CA4_5_7I1R7Mass_sound) +def CA4_5_7I1R7H : Ball := ⟨0, 0⟩ +lemma CA4_5_7I1R7H_sound : CA4_5_7I1R7H.Encloses (homogeneousEntropy CA4_5_7I1R7Value) := by + exact contains_sound (homogeneous_enclosed CA4_5_7I1R7Value CA4_5_7I1R7MassTerm_sound CA4_5_7I1R7Entropy_sound) (by decide +kernel) +def CA4_5_7I1R8Value (a : PairSlot) : ℝ := residualLaw (below (shape 4 5 7)) (fun u => (stageALaw (shape 4 5 7) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 8 a +def CA4_5_7I1R8Raw (a : PairSlot) : Ball := residualBall (below (shape 4 5 7)) A4_5_7Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 8 a +lemma CA4_5_7I1R8Raw_sound (a : PairSlot) : + (CA4_5_7I1R8Raw a).Encloses (CA4_5_7I1R8Value a) := by + exact residualBall_sound_on (below (shape 4 5 7)) A4_5_7Law (fun u => (stageALaw (shape 4 5 7) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A4_5_7Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 4 5 7) (show (shape 4 5 7) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 8 a +def CA4_5_7I1R8Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA4_5_7I1R8Certificates_valid : + CA4_5_7I1R8Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA4_5_7I1R8CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA4_5_7I1R8P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA4_5_7I1R8Certificates (CA4_5_7I1R8CertificateIndex a)).input +lemma CA4_5_7I1R8P_check : ∀ a : PairSlot, contains (CA4_5_7I1R8Raw a) (CA4_5_7I1R8P a) = true := by + decide +kernel +lemma CA4_5_7I1R8P_sound (a : PairSlot) : + (CA4_5_7I1R8P a).Encloses (CA4_5_7I1R8Value a) := + contains_sound (CA4_5_7I1R8Raw_sound a) (CA4_5_7I1R8P_check a) +def CA4_5_7I1R8Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA4_5_7I1R8Certificates (CA4_5_7I1R8CertificateIndex a)).output +lemma CA4_5_7I1R8Terms_sound (a : PairSlot) : + (CA4_5_7I1R8Terms a).Encloses (Foundation.entropyTerm (CA4_5_7I1R8Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA4_5_7I1R8Certificates_valid + (CA4_5_7I1R8CertificateIndex a) (CA4_5_7I1R8P_sound a) +def CA4_5_7I1R8Entropy : Ball := ⟨0, 0⟩ +lemma CA4_5_7I1R8Entropy_sound : CA4_5_7I1R8Entropy.Encloses (Foundation.finiteEntropy CA4_5_7I1R8Value) := by + exact contains_sound (entropyPair_enclosed CA4_5_7I1R8Value CA4_5_7I1R8Terms CA4_5_7I1R8Terms_sound) (by decide +kernel) +def CA4_5_7I1R8Mass : Ball := ⟨0, 0⟩ +lemma CA4_5_7I1R8Mass_sound : CA4_5_7I1R8Mass.Encloses (∑ a, CA4_5_7I1R8Value a) := by + exact contains_sound (pairSumBall_sound CA4_5_7I1R8P CA4_5_7I1R8Value CA4_5_7I1R8P_sound) (by decide +kernel) +def CA4_5_7I1R8MassTerm : Ball := .exact 0 +lemma CA4_5_7I1R8MassTerm_sound : CA4_5_7I1R8MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA4_5_7I1R8Value a))) := + entropyTerm_zero_ball (CA4_5_7I1R8Mass_sound) +def CA4_5_7I1R8H : Ball := ⟨0, 0⟩ +lemma CA4_5_7I1R8H_sound : CA4_5_7I1R8H.Encloses (homogeneousEntropy CA4_5_7I1R8Value) := by + exact contains_sound (homogeneous_enclosed CA4_5_7I1R8Value CA4_5_7I1R8MassTerm_sound CA4_5_7I1R8Entropy_sound) (by decide +kernel) +def CA4_5_7I1R9Value (a : PairSlot) : ℝ := residualLaw (below (shape 4 5 7)) (fun u => (stageALaw (shape 4 5 7) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 9 a +def CA4_5_7I1R9Raw (a : PairSlot) : Ball := residualBall (below (shape 4 5 7)) A4_5_7Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 9 a +lemma CA4_5_7I1R9Raw_sound (a : PairSlot) : + (CA4_5_7I1R9Raw a).Encloses (CA4_5_7I1R9Value a) := by + exact residualBall_sound_on (below (shape 4 5 7)) A4_5_7Law (fun u => (stageALaw (shape 4 5 7) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A4_5_7Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 4 5 7) (show (shape 4 5 7) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 9 a +def CA4_5_7I1R9Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA4_5_7I1R9Certificates_valid : + CA4_5_7I1R9Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA4_5_7I1R9CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA4_5_7I1R9P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA4_5_7I1R9Certificates (CA4_5_7I1R9CertificateIndex a)).input +lemma CA4_5_7I1R9P_check : ∀ a : PairSlot, contains (CA4_5_7I1R9Raw a) (CA4_5_7I1R9P a) = true := by + decide +kernel +lemma CA4_5_7I1R9P_sound (a : PairSlot) : + (CA4_5_7I1R9P a).Encloses (CA4_5_7I1R9Value a) := + contains_sound (CA4_5_7I1R9Raw_sound a) (CA4_5_7I1R9P_check a) +def CA4_5_7I1R9Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA4_5_7I1R9Certificates (CA4_5_7I1R9CertificateIndex a)).output +lemma CA4_5_7I1R9Terms_sound (a : PairSlot) : + (CA4_5_7I1R9Terms a).Encloses (Foundation.entropyTerm (CA4_5_7I1R9Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA4_5_7I1R9Certificates_valid + (CA4_5_7I1R9CertificateIndex a) (CA4_5_7I1R9P_sound a) +def CA4_5_7I1R9Entropy : Ball := ⟨0, 0⟩ +lemma CA4_5_7I1R9Entropy_sound : CA4_5_7I1R9Entropy.Encloses (Foundation.finiteEntropy CA4_5_7I1R9Value) := by + exact contains_sound (entropyPair_enclosed CA4_5_7I1R9Value CA4_5_7I1R9Terms CA4_5_7I1R9Terms_sound) (by decide +kernel) +def CA4_5_7I1R9Mass : Ball := ⟨0, 0⟩ +lemma CA4_5_7I1R9Mass_sound : CA4_5_7I1R9Mass.Encloses (∑ a, CA4_5_7I1R9Value a) := by + exact contains_sound (pairSumBall_sound CA4_5_7I1R9P CA4_5_7I1R9Value CA4_5_7I1R9P_sound) (by decide +kernel) +def CA4_5_7I1R9MassTerm : Ball := .exact 0 +lemma CA4_5_7I1R9MassTerm_sound : CA4_5_7I1R9MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA4_5_7I1R9Value a))) := + entropyTerm_zero_ball (CA4_5_7I1R9Mass_sound) +def CA4_5_7I1R9H : Ball := ⟨0, 0⟩ +lemma CA4_5_7I1R9H_sound : CA4_5_7I1R9H.Encloses (homogeneousEntropy CA4_5_7I1R9Value) := by + exact contains_sound (homogeneous_enclosed CA4_5_7I1R9Value CA4_5_7I1R9MassTerm_sound CA4_5_7I1R9Entropy_sound) (by decide +kernel) +def CA4_5_7I1R10Value (a : PairSlot) : ℝ := residualLaw (below (shape 4 5 7)) (fun u => (stageALaw (shape 4 5 7) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 10 a +def CA4_5_7I1R10Raw (a : PairSlot) : Ball := residualBall (below (shape 4 5 7)) A4_5_7Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 10 a +lemma CA4_5_7I1R10Raw_sound (a : PairSlot) : + (CA4_5_7I1R10Raw a).Encloses (CA4_5_7I1R10Value a) := by + exact residualBall_sound_on (below (shape 4 5 7)) A4_5_7Law (fun u => (stageALaw (shape 4 5 7) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A4_5_7Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 4 5 7) (show (shape 4 5 7) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 10 a +def CA4_5_7I1R10Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA4_5_7I1R10Certificates_valid : + CA4_5_7I1R10Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA4_5_7I1R10CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA4_5_7I1R10P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA4_5_7I1R10Certificates (CA4_5_7I1R10CertificateIndex a)).input +lemma CA4_5_7I1R10P_check : ∀ a : PairSlot, contains (CA4_5_7I1R10Raw a) (CA4_5_7I1R10P a) = true := by + decide +kernel +lemma CA4_5_7I1R10P_sound (a : PairSlot) : + (CA4_5_7I1R10P a).Encloses (CA4_5_7I1R10Value a) := + contains_sound (CA4_5_7I1R10Raw_sound a) (CA4_5_7I1R10P_check a) +def CA4_5_7I1R10Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA4_5_7I1R10Certificates (CA4_5_7I1R10CertificateIndex a)).output +lemma CA4_5_7I1R10Terms_sound (a : PairSlot) : + (CA4_5_7I1R10Terms a).Encloses (Foundation.entropyTerm (CA4_5_7I1R10Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA4_5_7I1R10Certificates_valid + (CA4_5_7I1R10CertificateIndex a) (CA4_5_7I1R10P_sound a) +def CA4_5_7I1R10Entropy : Ball := ⟨0, 0⟩ +lemma CA4_5_7I1R10Entropy_sound : CA4_5_7I1R10Entropy.Encloses (Foundation.finiteEntropy CA4_5_7I1R10Value) := by + exact contains_sound (entropyPair_enclosed CA4_5_7I1R10Value CA4_5_7I1R10Terms CA4_5_7I1R10Terms_sound) (by decide +kernel) +def CA4_5_7I1R10Mass : Ball := ⟨0, 0⟩ +lemma CA4_5_7I1R10Mass_sound : CA4_5_7I1R10Mass.Encloses (∑ a, CA4_5_7I1R10Value a) := by + exact contains_sound (pairSumBall_sound CA4_5_7I1R10P CA4_5_7I1R10Value CA4_5_7I1R10P_sound) (by decide +kernel) +def CA4_5_7I1R10MassTerm : Ball := .exact 0 +lemma CA4_5_7I1R10MassTerm_sound : CA4_5_7I1R10MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA4_5_7I1R10Value a))) := + entropyTerm_zero_ball (CA4_5_7I1R10Mass_sound) +def CA4_5_7I1R10H : Ball := ⟨0, 0⟩ +lemma CA4_5_7I1R10H_sound : CA4_5_7I1R10H.Encloses (homogeneousEntropy CA4_5_7I1R10Value) := by + exact contains_sound (homogeneous_enclosed CA4_5_7I1R10Value CA4_5_7I1R10MassTerm_sound CA4_5_7I1R10Entropy_sound) (by decide +kernel) +def CA4_5_7I1R11Value (a : PairSlot) : ℝ := residualLaw (below (shape 4 5 7)) (fun u => (stageALaw (shape 4 5 7) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 11 a +def CA4_5_7I1R11Raw (a : PairSlot) : Ball := residualBall (below (shape 4 5 7)) A4_5_7Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 11 a +lemma CA4_5_7I1R11Raw_sound (a : PairSlot) : + (CA4_5_7I1R11Raw a).Encloses (CA4_5_7I1R11Value a) := by + exact residualBall_sound_on (below (shape 4 5 7)) A4_5_7Law (fun u => (stageALaw (shape 4 5 7) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A4_5_7Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 4 5 7) (show (shape 4 5 7) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 11 a +def CA4_5_7I1R11Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA4_5_7I1R11Certificates_valid : + CA4_5_7I1R11Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA4_5_7I1R11CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA4_5_7I1R11P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA4_5_7I1R11Certificates (CA4_5_7I1R11CertificateIndex a)).input +lemma CA4_5_7I1R11P_check : ∀ a : PairSlot, contains (CA4_5_7I1R11Raw a) (CA4_5_7I1R11P a) = true := by + decide +kernel +lemma CA4_5_7I1R11P_sound (a : PairSlot) : + (CA4_5_7I1R11P a).Encloses (CA4_5_7I1R11Value a) := + contains_sound (CA4_5_7I1R11Raw_sound a) (CA4_5_7I1R11P_check a) +def CA4_5_7I1R11Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA4_5_7I1R11Certificates (CA4_5_7I1R11CertificateIndex a)).output +lemma CA4_5_7I1R11Terms_sound (a : PairSlot) : + (CA4_5_7I1R11Terms a).Encloses (Foundation.entropyTerm (CA4_5_7I1R11Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA4_5_7I1R11Certificates_valid + (CA4_5_7I1R11CertificateIndex a) (CA4_5_7I1R11P_sound a) +def CA4_5_7I1R11Entropy : Ball := ⟨0, 0⟩ +lemma CA4_5_7I1R11Entropy_sound : CA4_5_7I1R11Entropy.Encloses (Foundation.finiteEntropy CA4_5_7I1R11Value) := by + exact contains_sound (entropyPair_enclosed CA4_5_7I1R11Value CA4_5_7I1R11Terms CA4_5_7I1R11Terms_sound) (by decide +kernel) +def CA4_5_7I1R11Mass : Ball := ⟨0, 0⟩ +lemma CA4_5_7I1R11Mass_sound : CA4_5_7I1R11Mass.Encloses (∑ a, CA4_5_7I1R11Value a) := by + exact contains_sound (pairSumBall_sound CA4_5_7I1R11P CA4_5_7I1R11Value CA4_5_7I1R11P_sound) (by decide +kernel) +def CA4_5_7I1R11MassTerm : Ball := .exact 0 +lemma CA4_5_7I1R11MassTerm_sound : CA4_5_7I1R11MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA4_5_7I1R11Value a))) := + entropyTerm_zero_ball (CA4_5_7I1R11Mass_sound) +def CA4_5_7I1R11H : Ball := ⟨0, 0⟩ +lemma CA4_5_7I1R11H_sound : CA4_5_7I1R11H.Encloses (homogeneousEntropy CA4_5_7I1R11Value) := by + exact contains_sound (homogeneous_enclosed CA4_5_7I1R11Value CA4_5_7I1R11MassTerm_sound CA4_5_7I1R11Entropy_sound) (by decide +kernel) +def CA4_5_7I1R12Value (a : PairSlot) : ℝ := residualLaw (below (shape 4 5 7)) (fun u => (stageALaw (shape 4 5 7) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 12 a +def CA4_5_7I1R12Raw (a : PairSlot) : Ball := residualBall (below (shape 4 5 7)) A4_5_7Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 12 a +lemma CA4_5_7I1R12Raw_sound (a : PairSlot) : + (CA4_5_7I1R12Raw a).Encloses (CA4_5_7I1R12Value a) := by + exact residualBall_sound_on (below (shape 4 5 7)) A4_5_7Law (fun u => (stageALaw (shape 4 5 7) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A4_5_7Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 4 5 7) (show (shape 4 5 7) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 12 a +def CA4_5_7I1R12Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA4_5_7I1R12Certificates_valid : + CA4_5_7I1R12Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA4_5_7I1R12CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA4_5_7I1R12P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA4_5_7I1R12Certificates (CA4_5_7I1R12CertificateIndex a)).input +lemma CA4_5_7I1R12P_check : ∀ a : PairSlot, contains (CA4_5_7I1R12Raw a) (CA4_5_7I1R12P a) = true := by + decide +kernel +lemma CA4_5_7I1R12P_sound (a : PairSlot) : + (CA4_5_7I1R12P a).Encloses (CA4_5_7I1R12Value a) := + contains_sound (CA4_5_7I1R12Raw_sound a) (CA4_5_7I1R12P_check a) +def CA4_5_7I1R12Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA4_5_7I1R12Certificates (CA4_5_7I1R12CertificateIndex a)).output +lemma CA4_5_7I1R12Terms_sound (a : PairSlot) : + (CA4_5_7I1R12Terms a).Encloses (Foundation.entropyTerm (CA4_5_7I1R12Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA4_5_7I1R12Certificates_valid + (CA4_5_7I1R12CertificateIndex a) (CA4_5_7I1R12P_sound a) +def CA4_5_7I1R12Entropy : Ball := ⟨0, 0⟩ +lemma CA4_5_7I1R12Entropy_sound : CA4_5_7I1R12Entropy.Encloses (Foundation.finiteEntropy CA4_5_7I1R12Value) := by + exact contains_sound (entropyPair_enclosed CA4_5_7I1R12Value CA4_5_7I1R12Terms CA4_5_7I1R12Terms_sound) (by decide +kernel) +def CA4_5_7I1R12Mass : Ball := ⟨0, 0⟩ +lemma CA4_5_7I1R12Mass_sound : CA4_5_7I1R12Mass.Encloses (∑ a, CA4_5_7I1R12Value a) := by + exact contains_sound (pairSumBall_sound CA4_5_7I1R12P CA4_5_7I1R12Value CA4_5_7I1R12P_sound) (by decide +kernel) +def CA4_5_7I1R12MassTerm : Ball := .exact 0 +lemma CA4_5_7I1R12MassTerm_sound : CA4_5_7I1R12MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA4_5_7I1R12Value a))) := + entropyTerm_zero_ball (CA4_5_7I1R12Mass_sound) +def CA4_5_7I1R12H : Ball := ⟨0, 0⟩ +lemma CA4_5_7I1R12H_sound : CA4_5_7I1R12H.Encloses (homogeneousEntropy CA4_5_7I1R12Value) := by + exact contains_sound (homogeneous_enclosed CA4_5_7I1R12Value CA4_5_7I1R12MassTerm_sound CA4_5_7I1R12Entropy_sound) (by decide +kernel) +def CA4_5_7I1R13Value (a : PairSlot) : ℝ := residualLaw (below (shape 4 5 7)) (fun u => (stageALaw (shape 4 5 7) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 13 a +def CA4_5_7I1R13Raw (a : PairSlot) : Ball := residualBall (below (shape 4 5 7)) A4_5_7Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 13 a +lemma CA4_5_7I1R13Raw_sound (a : PairSlot) : + (CA4_5_7I1R13Raw a).Encloses (CA4_5_7I1R13Value a) := by + exact residualBall_sound_on (below (shape 4 5 7)) A4_5_7Law (fun u => (stageALaw (shape 4 5 7) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A4_5_7Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 4 5 7) (show (shape 4 5 7) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 13 a +def CA4_5_7I1R13Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA4_5_7I1R13Certificates_valid : + CA4_5_7I1R13Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA4_5_7I1R13CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA4_5_7I1R13P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA4_5_7I1R13Certificates (CA4_5_7I1R13CertificateIndex a)).input +lemma CA4_5_7I1R13P_check : ∀ a : PairSlot, contains (CA4_5_7I1R13Raw a) (CA4_5_7I1R13P a) = true := by + decide +kernel +lemma CA4_5_7I1R13P_sound (a : PairSlot) : + (CA4_5_7I1R13P a).Encloses (CA4_5_7I1R13Value a) := + contains_sound (CA4_5_7I1R13Raw_sound a) (CA4_5_7I1R13P_check a) +def CA4_5_7I1R13Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA4_5_7I1R13Certificates (CA4_5_7I1R13CertificateIndex a)).output +lemma CA4_5_7I1R13Terms_sound (a : PairSlot) : + (CA4_5_7I1R13Terms a).Encloses (Foundation.entropyTerm (CA4_5_7I1R13Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA4_5_7I1R13Certificates_valid + (CA4_5_7I1R13CertificateIndex a) (CA4_5_7I1R13P_sound a) +def CA4_5_7I1R13Entropy : Ball := ⟨0, 0⟩ +lemma CA4_5_7I1R13Entropy_sound : CA4_5_7I1R13Entropy.Encloses (Foundation.finiteEntropy CA4_5_7I1R13Value) := by + exact contains_sound (entropyPair_enclosed CA4_5_7I1R13Value CA4_5_7I1R13Terms CA4_5_7I1R13Terms_sound) (by decide +kernel) +def CA4_5_7I1R13Mass : Ball := ⟨0, 0⟩ +lemma CA4_5_7I1R13Mass_sound : CA4_5_7I1R13Mass.Encloses (∑ a, CA4_5_7I1R13Value a) := by + exact contains_sound (pairSumBall_sound CA4_5_7I1R13P CA4_5_7I1R13Value CA4_5_7I1R13P_sound) (by decide +kernel) +def CA4_5_7I1R13MassTerm : Ball := .exact 0 +lemma CA4_5_7I1R13MassTerm_sound : CA4_5_7I1R13MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA4_5_7I1R13Value a))) := + entropyTerm_zero_ball (CA4_5_7I1R13Mass_sound) +def CA4_5_7I1R13H : Ball := ⟨0, 0⟩ +lemma CA4_5_7I1R13H_sound : CA4_5_7I1R13H.Encloses (homogeneousEntropy CA4_5_7I1R13Value) := by + exact contains_sound (homogeneous_enclosed CA4_5_7I1R13Value CA4_5_7I1R13MassTerm_sound CA4_5_7I1R13Entropy_sound) (by decide +kernel) +def CA4_5_7I1R14Value (a : PairSlot) : ℝ := residualLaw (below (shape 4 5 7)) (fun u => (stageALaw (shape 4 5 7) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 14 a +def CA4_5_7I1R14Raw (a : PairSlot) : Ball := residualBall (below (shape 4 5 7)) A4_5_7Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 14 a +lemma CA4_5_7I1R14Raw_sound (a : PairSlot) : + (CA4_5_7I1R14Raw a).Encloses (CA4_5_7I1R14Value a) := by + exact residualBall_sound_on (below (shape 4 5 7)) A4_5_7Law (fun u => (stageALaw (shape 4 5 7) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A4_5_7Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 4 5 7) (show (shape 4 5 7) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 14 a +def CA4_5_7I1R14Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA4_5_7I1R14Certificates_valid : + CA4_5_7I1R14Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA4_5_7I1R14CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA4_5_7I1R14P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA4_5_7I1R14Certificates (CA4_5_7I1R14CertificateIndex a)).input +lemma CA4_5_7I1R14P_check : ∀ a : PairSlot, contains (CA4_5_7I1R14Raw a) (CA4_5_7I1R14P a) = true := by + decide +kernel +lemma CA4_5_7I1R14P_sound (a : PairSlot) : + (CA4_5_7I1R14P a).Encloses (CA4_5_7I1R14Value a) := + contains_sound (CA4_5_7I1R14Raw_sound a) (CA4_5_7I1R14P_check a) +def CA4_5_7I1R14Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA4_5_7I1R14Certificates (CA4_5_7I1R14CertificateIndex a)).output +lemma CA4_5_7I1R14Terms_sound (a : PairSlot) : + (CA4_5_7I1R14Terms a).Encloses (Foundation.entropyTerm (CA4_5_7I1R14Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA4_5_7I1R14Certificates_valid + (CA4_5_7I1R14CertificateIndex a) (CA4_5_7I1R14P_sound a) +def CA4_5_7I1R14Entropy : Ball := ⟨0, 0⟩ +lemma CA4_5_7I1R14Entropy_sound : CA4_5_7I1R14Entropy.Encloses (Foundation.finiteEntropy CA4_5_7I1R14Value) := by + exact contains_sound (entropyPair_enclosed CA4_5_7I1R14Value CA4_5_7I1R14Terms CA4_5_7I1R14Terms_sound) (by decide +kernel) +def CA4_5_7I1R14Mass : Ball := ⟨0, 0⟩ +lemma CA4_5_7I1R14Mass_sound : CA4_5_7I1R14Mass.Encloses (∑ a, CA4_5_7I1R14Value a) := by + exact contains_sound (pairSumBall_sound CA4_5_7I1R14P CA4_5_7I1R14Value CA4_5_7I1R14P_sound) (by decide +kernel) +def CA4_5_7I1R14MassTerm : Ball := .exact 0 +lemma CA4_5_7I1R14MassTerm_sound : CA4_5_7I1R14MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA4_5_7I1R14Value a))) := + entropyTerm_zero_ball (CA4_5_7I1R14Mass_sound) +def CA4_5_7I1R14H : Ball := ⟨0, 0⟩ +lemma CA4_5_7I1R14H_sound : CA4_5_7I1R14H.Encloses (homogeneousEntropy CA4_5_7I1R14Value) := by + exact contains_sound (homogeneous_enclosed CA4_5_7I1R14Value CA4_5_7I1R14MassTerm_sound CA4_5_7I1R14Entropy_sound) (by decide +kernel) +def CA4_5_7I1R15Value (a : PairSlot) : ℝ := residualLaw (below (shape 4 5 7)) (fun u => (stageALaw (shape 4 5 7) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 15 a +def CA4_5_7I1R15Raw (a : PairSlot) : Ball := residualBall (below (shape 4 5 7)) A4_5_7Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 15 a +lemma CA4_5_7I1R15Raw_sound (a : PairSlot) : + (CA4_5_7I1R15Raw a).Encloses (CA4_5_7I1R15Value a) := by + exact residualBall_sound_on (below (shape 4 5 7)) A4_5_7Law (fun u => (stageALaw (shape 4 5 7) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A4_5_7Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 4 5 7) (show (shape 4 5 7) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 15 a +def CA4_5_7I1R15Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA4_5_7I1R15Certificates_valid : + CA4_5_7I1R15Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA4_5_7I1R15CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA4_5_7I1R15P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA4_5_7I1R15Certificates (CA4_5_7I1R15CertificateIndex a)).input +lemma CA4_5_7I1R15P_check : ∀ a : PairSlot, contains (CA4_5_7I1R15Raw a) (CA4_5_7I1R15P a) = true := by + decide +kernel +lemma CA4_5_7I1R15P_sound (a : PairSlot) : + (CA4_5_7I1R15P a).Encloses (CA4_5_7I1R15Value a) := + contains_sound (CA4_5_7I1R15Raw_sound a) (CA4_5_7I1R15P_check a) +def CA4_5_7I1R15Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA4_5_7I1R15Certificates (CA4_5_7I1R15CertificateIndex a)).output +lemma CA4_5_7I1R15Terms_sound (a : PairSlot) : + (CA4_5_7I1R15Terms a).Encloses (Foundation.entropyTerm (CA4_5_7I1R15Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA4_5_7I1R15Certificates_valid + (CA4_5_7I1R15CertificateIndex a) (CA4_5_7I1R15P_sound a) +def CA4_5_7I1R15Entropy : Ball := ⟨0, 0⟩ +lemma CA4_5_7I1R15Entropy_sound : CA4_5_7I1R15Entropy.Encloses (Foundation.finiteEntropy CA4_5_7I1R15Value) := by + exact contains_sound (entropyPair_enclosed CA4_5_7I1R15Value CA4_5_7I1R15Terms CA4_5_7I1R15Terms_sound) (by decide +kernel) +def CA4_5_7I1R15Mass : Ball := ⟨0, 0⟩ +lemma CA4_5_7I1R15Mass_sound : CA4_5_7I1R15Mass.Encloses (∑ a, CA4_5_7I1R15Value a) := by + exact contains_sound (pairSumBall_sound CA4_5_7I1R15P CA4_5_7I1R15Value CA4_5_7I1R15P_sound) (by decide +kernel) +def CA4_5_7I1R15MassTerm : Ball := .exact 0 +lemma CA4_5_7I1R15MassTerm_sound : CA4_5_7I1R15MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA4_5_7I1R15Value a))) := + entropyTerm_zero_ball (CA4_5_7I1R15Mass_sound) +def CA4_5_7I1R15H : Ball := ⟨0, 0⟩ +lemma CA4_5_7I1R15H_sound : CA4_5_7I1R15H.Encloses (homogeneousEntropy CA4_5_7I1R15Value) := by + exact contains_sound (homogeneous_enclosed CA4_5_7I1R15Value CA4_5_7I1R15MassTerm_sound CA4_5_7I1R15Entropy_sound) (by decide +kernel) +def CA4_5_7I1R16Value (a : PairSlot) : ℝ := residualLaw (below (shape 4 5 7)) (fun u => (stageALaw (shape 4 5 7) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 16 a +def CA4_5_7I1R16Raw (a : PairSlot) : Ball := residualBall (below (shape 4 5 7)) A4_5_7Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 16 a +lemma CA4_5_7I1R16Raw_sound (a : PairSlot) : + (CA4_5_7I1R16Raw a).Encloses (CA4_5_7I1R16Value a) := by + exact residualBall_sound_on (below (shape 4 5 7)) A4_5_7Law (fun u => (stageALaw (shape 4 5 7) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A4_5_7Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 4 5 7) (show (shape 4 5 7) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 16 a +def CA4_5_7I1R16Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA4_5_7I1R16Certificates_valid : + CA4_5_7I1R16Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA4_5_7I1R16CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA4_5_7I1R16P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA4_5_7I1R16Certificates (CA4_5_7I1R16CertificateIndex a)).input +lemma CA4_5_7I1R16P_check : ∀ a : PairSlot, contains (CA4_5_7I1R16Raw a) (CA4_5_7I1R16P a) = true := by + decide +kernel +lemma CA4_5_7I1R16P_sound (a : PairSlot) : + (CA4_5_7I1R16P a).Encloses (CA4_5_7I1R16Value a) := + contains_sound (CA4_5_7I1R16Raw_sound a) (CA4_5_7I1R16P_check a) +def CA4_5_7I1R16Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA4_5_7I1R16Certificates (CA4_5_7I1R16CertificateIndex a)).output +lemma CA4_5_7I1R16Terms_sound (a : PairSlot) : + (CA4_5_7I1R16Terms a).Encloses (Foundation.entropyTerm (CA4_5_7I1R16Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA4_5_7I1R16Certificates_valid + (CA4_5_7I1R16CertificateIndex a) (CA4_5_7I1R16P_sound a) +def CA4_5_7I1R16Entropy : Ball := ⟨0, 0⟩ +lemma CA4_5_7I1R16Entropy_sound : CA4_5_7I1R16Entropy.Encloses (Foundation.finiteEntropy CA4_5_7I1R16Value) := by + exact contains_sound (entropyPair_enclosed CA4_5_7I1R16Value CA4_5_7I1R16Terms CA4_5_7I1R16Terms_sound) (by decide +kernel) +def CA4_5_7I1R16Mass : Ball := ⟨0, 0⟩ +lemma CA4_5_7I1R16Mass_sound : CA4_5_7I1R16Mass.Encloses (∑ a, CA4_5_7I1R16Value a) := by + exact contains_sound (pairSumBall_sound CA4_5_7I1R16P CA4_5_7I1R16Value CA4_5_7I1R16P_sound) (by decide +kernel) +def CA4_5_7I1R16MassTerm : Ball := .exact 0 +lemma CA4_5_7I1R16MassTerm_sound : CA4_5_7I1R16MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA4_5_7I1R16Value a))) := + entropyTerm_zero_ball (CA4_5_7I1R16Mass_sound) +def CA4_5_7I1R16H : Ball := ⟨0, 0⟩ +lemma CA4_5_7I1R16H_sound : CA4_5_7I1R16H.Encloses (homogeneousEntropy CA4_5_7I1R16Value) := by + exact contains_sound (homogeneous_enclosed CA4_5_7I1R16Value CA4_5_7I1R16MassTerm_sound CA4_5_7I1R16Entropy_sound) (by decide +kernel) +def CA4_5_7I1ResidualEntropies (a : Fin 17) : Ball := + match a.val with + | 0 => CA4_5_7I1R0H + | 1 => CA4_5_7I1R1H + | 2 => CA4_5_7I1R2H + | 3 => CA4_5_7I1R3H + | 4 => CA4_5_7I1R4H + | 5 => CA4_5_7I1R5H + | 6 => CA4_5_7I1R6H + | 7 => CA4_5_7I1R7H + | 8 => CA4_5_7I1R8H + | 9 => CA4_5_7I1R9H + | 10 => CA4_5_7I1R10H + | 11 => CA4_5_7I1R11H + | 12 => CA4_5_7I1R12H + | 13 => CA4_5_7I1R13H + | 14 => CA4_5_7I1R14H + | 15 => CA4_5_7I1R15H + | 16 => CA4_5_7I1R16H + | _ => (.exact 0) +lemma CA4_5_7I1ResidualEntropies_sound (k : Fin 17) : + (CA4_5_7I1ResidualEntropies k).Encloses (homogeneousEntropy + (residualLaw (below (shape 4 5 7)) (fun u => (stageALaw (shape 4 5 7) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) k)) := by + fin_cases k + · exact CA4_5_7I1R0H_sound + · exact CA4_5_7I1R1H_sound + · exact CA4_5_7I1R2H_sound + · exact CA4_5_7I1R3H_sound + · exact CA4_5_7I1R4H_sound + · exact CA4_5_7I1R5H_sound + · exact CA4_5_7I1R6H_sound + · exact CA4_5_7I1R7H_sound + · exact CA4_5_7I1R8H_sound + · exact CA4_5_7I1R9H_sound + · exact CA4_5_7I1R10H_sound + · exact CA4_5_7I1R11H_sound + · exact CA4_5_7I1R12H_sound + · exact CA4_5_7I1R13H_sound + · exact CA4_5_7I1R14H_sound + · exact CA4_5_7I1R15H_sound + · exact CA4_5_7I1R16H_sound +def CA4_5_7I1Singles (s : Shape) : Ball := + match s 0, s 1, s 2 with + | 3, 5, 0 => Z3_5_0H1H + | 4, 4, 0 => Z4_4_0H1H + | _, _, _ => (.exact 0) +lemma CA4_5_7I1Singles_sound (u : Shape) (hu : u ∈ below (shape 4 5 7)) + (hd : designated (Equiv.refl (Fin 3)) 1 u) : + (CA4_5_7I1Singles u).Encloses (homogeneousEntropy ((fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) u)) := by + rw [A4_5_7_below] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 0 1 7) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 0 2 6) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 0 3 5) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 0 4 4) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 0 5 3) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 1 0 7) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 1 1 6) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 1 2 5) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 1 3 4) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 1 4 3) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 1 5 2) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 2 0 6) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 2 1 5) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 2 2 4) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 2 3 3) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 2 4 2) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 2 5 1) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 3 0 5) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 3 1 4) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 3 2 3) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 3 3 2) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 3 4 1) by decide +kernel) hd |>.elim + · exact Z3_5_0H1H_sound + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 4 0 4) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 4 1 3) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 4 2 2) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 4 3 1) by decide +kernel) hd |>.elim + · exact Z4_4_0H1H_sound +def CA4_5_7I1Singleton : Ball := ⟨(303183391302263079046188083 / 50000000000000000000000000000000), (251569 / 50000000000000000000000000000000)⟩ +lemma CA4_5_7I1Singleton_sound : CA4_5_7I1Singleton.Encloses + (singletonEntropy (below (shape 4 5 7)) (fun u => (stageALaw (shape 4 5 7) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ))) := by + exact contains_sound (singletonBall_sound (below (shape 4 5 7)) A4_5_7Law (fun u => (stageALaw (shape 4 5 7) u : ℝ)) (Equiv.refl (Fin 3)) 1 + CA4_5_7I1Singles (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A4_5_7Law_sound u) CA4_5_7I1Singles_sound) (by decide +kernel) +def CA4_5_7I1Group : Ball := ⟨(50009940225896612102999470955347 / 50000000000000000000000000000000), (83559113207 / 50000000000000000000000000000000)⟩ +lemma CA4_5_7I1Group_sound : CA4_5_7I1Group.Encloses + (groupedEntropy (below (shape 4 5 7)) (fun u => (stageALaw (shape 4 5 7) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ))) := by + exact contains_sound (Ball.add_sound CA4_5_7I1Singleton_sound + (finSumBall_sound 17 CA4_5_7I1ResidualEntropies _ CA4_5_7I1ResidualEntropies_sound)) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CA4_5_7I1H : Ball := ⟨(3710174631598816941952092861339 / 3125000000000000000000000000000), (96993767119 / 20000000000000000000000000000000)⟩ +lemma CA4_5_7I1_sound : CA4_5_7I1H.Encloses (stageACapacity (shape 4 5 7) 1) := by + have hb := contains_sound (Ball.add_sound CA4_5_7I1PairH_sound + (Ball.neg_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) CA4_5_7I1Group_sound))) + (show contains (.add CA4_5_7I1PairH (.neg (.mul (.exact 2) CA4_5_7I1Group))) CA4_5_7I1H = true by decide +kernel) + unfold CA4_5_7I1PairValue at hb + simpa only [stageACapacity, nativeCapacity, + show (1 : Fin 3) ≠ 0 by decide, ite_false, sub_eq_add_neg] using hb + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA4_5_7I2.lean b/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA4_5_7I2.lean new file mode 100644 index 0000000000000000000000000000000000000000..ff569464f0fbd119134c63069f43f9c730c746e1 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA4_5_7I2.lean @@ -0,0 +1,871 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.CapacityA.CapA4_5_7I2Pair + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CA4_5_7I2R0Value (a : PairSlot) : ℝ := residualLaw (below (shape 4 5 7)) (fun u => (stageALaw (shape 4 5 7) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 0 a +def CA4_5_7I2R0Raw (a : PairSlot) : Ball := residualBall (below (shape 4 5 7)) A4_5_7Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 0 a +lemma CA4_5_7I2R0Raw_sound (a : PairSlot) : + (CA4_5_7I2R0Raw a).Encloses (CA4_5_7I2R0Value a) := by + exact residualBall_sound_on (below (shape 4 5 7)) A4_5_7Law (fun u => (stageALaw (shape 4 5 7) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A4_5_7Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 4 5 7) (show (shape 4 5 7) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 0 a +def CA4_5_7I2R0Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(244308754727999724283630797 / 50000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ ⟨(373459546953319618009331341 / 6250000000000000000000000000000), (982967 / 50000000000000000000000000000000)⟩ ⟨(-1222910074979865424709459157630799 / 100000000000000000000000000000000), (201170529647 / 50000000000000000000000000000000)⟩ ⟨-18, 244308754727999724283630797, 190734863281250000000000000⟩] +lemma CA4_5_7I2R0Certificates_valid : + CA4_5_7I2R0Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA4_5_7I2R0CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 0, 0 => 1 + | _, _ => 0 +def CA4_5_7I2R0P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA4_5_7I2R0Certificates (CA4_5_7I2R0CertificateIndex a)).input +lemma CA4_5_7I2R0P_check : ∀ a : PairSlot, contains (CA4_5_7I2R0Raw a) (CA4_5_7I2R0P a) = true := by + decide +kernel +lemma CA4_5_7I2R0P_sound (a : PairSlot) : + (CA4_5_7I2R0P a).Encloses (CA4_5_7I2R0Value a) := + contains_sound (CA4_5_7I2R0Raw_sound a) (CA4_5_7I2R0P_check a) +def CA4_5_7I2R0Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA4_5_7I2R0Certificates (CA4_5_7I2R0CertificateIndex a)).output +lemma CA4_5_7I2R0Terms_sound (a : PairSlot) : + (CA4_5_7I2R0Terms a).Encloses (Foundation.entropyTerm (CA4_5_7I2R0Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA4_5_7I2R0Certificates_valid + (CA4_5_7I2R0CertificateIndex a) (CA4_5_7I2R0P_sound a) +def CA4_5_7I2R0Entropy : Ball := ⟨(373459546953319618009331341 / 6250000000000000000000000000000), (982967 / 50000000000000000000000000000000)⟩ +lemma CA4_5_7I2R0Entropy_sound : CA4_5_7I2R0Entropy.Encloses (Foundation.finiteEntropy CA4_5_7I2R0Value) := by + exact contains_sound (entropyPair_enclosed CA4_5_7I2R0Value CA4_5_7I2R0Terms CA4_5_7I2R0Terms_sound) (by decide +kernel) +def CA4_5_7I2R0Mass : Ball := ⟨(244308754727999724283630797 / 50000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ +lemma CA4_5_7I2R0Mass_sound : CA4_5_7I2R0Mass.Encloses (∑ a, CA4_5_7I2R0Value a) := by + exact contains_sound (pairSumBall_sound CA4_5_7I2R0P CA4_5_7I2R0Value CA4_5_7I2R0P_sound) (by decide +kernel) +def CA4_5_7I2R0MassTermLogWitness : LogWitness := ⟨-18, 244308754727999724283630797, 190734863281250000000000000⟩ +def CA4_5_7I2R0MassTermLog : Ball := ⟨(-1222910074979865424709459157630799 / 100000000000000000000000000000000), (201170529647 / 50000000000000000000000000000000)⟩ +lemma CA4_5_7I2R0MassTermLog_sound : CA4_5_7I2R0MassTermLog.Encloses (Real.log ((∑ a, CA4_5_7I2R0Value a))) := by + exact checkLog_sound logTwoBall_sound (CA4_5_7I2R0Mass_sound) (w := CA4_5_7I2R0MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA4_5_7I2R0MassTerm : Ball := ⟨(373459546953319618009331341 / 6250000000000000000000000000000), (982967 / 50000000000000000000000000000000)⟩ +lemma CA4_5_7I2R0MassTerm_sound : CA4_5_7I2R0MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA4_5_7I2R0Value a))) := by + exact contains_sound (entropyTerm_ball (CA4_5_7I2R0Mass_sound) CA4_5_7I2R0MassTermLog_sound) (by decide +kernel) +def CA4_5_7I2R0H : Ball := ⟨0, (982967 / 25000000000000000000000000000000)⟩ +lemma CA4_5_7I2R0H_sound : CA4_5_7I2R0H.Encloses (homogeneousEntropy CA4_5_7I2R0Value) := by + exact contains_sound (homogeneous_enclosed CA4_5_7I2R0Value CA4_5_7I2R0MassTerm_sound CA4_5_7I2R0Entropy_sound) (by decide +kernel) +def CA4_5_7I2R1Value (a : PairSlot) : ℝ := residualLaw (below (shape 4 5 7)) (fun u => (stageALaw (shape 4 5 7) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 1 a +def CA4_5_7I2R1Raw (a : PairSlot) : Ball := residualBall (below (shape 4 5 7)) A4_5_7Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 1 a +lemma CA4_5_7I2R1Raw_sound (a : PairSlot) : + (CA4_5_7I2R1Raw a).Encloses (CA4_5_7I2R1Value a) := by + exact residualBall_sound_on (below (shape 4 5 7)) A4_5_7Law (fun u => (stageALaw (shape 4 5 7) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A4_5_7Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 4 5 7) (show (shape 4 5 7) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 1 a +def CA4_5_7I2R1Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(2512377436904649203704730017 / 4000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ ⟨(463082674732548310216718970043 / 100000000000000000000000000000000), (159605011 / 100000000000000000000000000000000)⟩ ⟨(-184320503730954107044470613908181 / 25000000000000000000000000000000), (63527472243 / 25000000000000000000000000000000)⟩ ⟨-11, 2512377436904649203704730017, 1953125000000000000000000000⟩] +lemma CA4_5_7I2R1Certificates_valid : + CA4_5_7I2R1Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA4_5_7I2R1CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 1, 0 => 1 + | 0, 1 => 1 + | _, _ => 0 +def CA4_5_7I2R1P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA4_5_7I2R1Certificates (CA4_5_7I2R1CertificateIndex a)).input +lemma CA4_5_7I2R1P_check : ∀ a : PairSlot, contains (CA4_5_7I2R1Raw a) (CA4_5_7I2R1P a) = true := by + decide +kernel +lemma CA4_5_7I2R1P_sound (a : PairSlot) : + (CA4_5_7I2R1P a).Encloses (CA4_5_7I2R1Value a) := + contains_sound (CA4_5_7I2R1Raw_sound a) (CA4_5_7I2R1P_check a) +def CA4_5_7I2R1Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA4_5_7I2R1Certificates (CA4_5_7I2R1CertificateIndex a)).output +lemma CA4_5_7I2R1Terms_sound (a : PairSlot) : + (CA4_5_7I2R1Terms a).Encloses (Foundation.entropyTerm (CA4_5_7I2R1Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA4_5_7I2R1Certificates_valid + (CA4_5_7I2R1CertificateIndex a) (CA4_5_7I2R1P_sound a) +def CA4_5_7I2R1Entropy : Ball := ⟨(463082674732548310216718970043 / 50000000000000000000000000000000), (159605011 / 50000000000000000000000000000000)⟩ +lemma CA4_5_7I2R1Entropy_sound : CA4_5_7I2R1Entropy.Encloses (Foundation.finiteEntropy CA4_5_7I2R1Value) := by + exact contains_sound (entropyPair_enclosed CA4_5_7I2R1Value CA4_5_7I2R1Terms CA4_5_7I2R1Terms_sound) (by decide +kernel) +def CA4_5_7I2R1Mass : Ball := ⟨(2512377436904649203704730017 / 2000000000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ +lemma CA4_5_7I2R1Mass_sound : CA4_5_7I2R1Mass.Encloses (∑ a, CA4_5_7I2R1Value a) := by + exact contains_sound (pairSumBall_sound CA4_5_7I2R1P CA4_5_7I2R1Value CA4_5_7I2R1P_sound) (by decide +kernel) +def CA4_5_7I2R1MassTermLogWitness : LogWitness := ⟨-10, 2512377436904649203704730017, 1953125000000000000000000000⟩ +def CA4_5_7I2R1MassTermLog : Ball := ⟨(-333983648433910948618079631291197 / 50000000000000000000000000000000), (232934065289 / 100000000000000000000000000000000)⟩ +lemma CA4_5_7I2R1MassTermLog_sound : CA4_5_7I2R1MassTermLog.Encloses (Real.log ((∑ a, CA4_5_7I2R1Value a))) := by + exact checkLog_sound logTwoBall_sound (CA4_5_7I2R1Mass_sound) (w := CA4_5_7I2R1MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA4_5_7I2R1MassTerm : Ball := ⟨(419546491310226323073778343693 / 50000000000000000000000000000000), (146304593 / 50000000000000000000000000000000)⟩ +lemma CA4_5_7I2R1MassTerm_sound : CA4_5_7I2R1MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA4_5_7I2R1Value a))) := by + exact contains_sound (entropyTerm_ball (CA4_5_7I2R1Mass_sound) CA4_5_7I2R1MassTermLog_sound) (by decide +kernel) +def CA4_5_7I2R1H : Ball := ⟨(870723668446439742858812527 / 1000000000000000000000000000000), (76477401 / 12500000000000000000000000000000)⟩ +lemma CA4_5_7I2R1H_sound : CA4_5_7I2R1H.Encloses (homogeneousEntropy CA4_5_7I2R1Value) := by + exact contains_sound (homogeneous_enclosed CA4_5_7I2R1Value CA4_5_7I2R1MassTerm_sound CA4_5_7I2R1Entropy_sound) (by decide +kernel) +def CA4_5_7I2R2Value (a : PairSlot) : ℝ := residualLaw (below (shape 4 5 7)) (fun u => (stageALaw (shape 4 5 7) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 2 a +def CA4_5_7I2R2Raw (a : PairSlot) : Ball := residualBall (below (shape 4 5 7)) A4_5_7Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 2 a +lemma CA4_5_7I2R2Raw_sound (a : PairSlot) : + (CA4_5_7I2R2Raw a).Encloses (CA4_5_7I2R2Value a) := by + exact residualBall_sound_on (below (shape 4 5 7)) A4_5_7Law (fun u => (stageALaw (shape 4 5 7) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A4_5_7Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 4 5 7) (show (shape 4 5 7) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 2 a +def CA4_5_7I2R2Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(11861293865407860378199682309 / 1250000000000000000000000000000), (1 / 12500000000000000000000000000000)⟩ ⟨(4419630394880539011440438632171 / 100000000000000000000000000000000), (803752559 / 50000000000000000000000000000000)⟩ ⟨(-465761834778613164915189054701271 / 100000000000000000000000000000000), (84703295153 / 50000000000000000000000000000000)⟩ ⟨-7, 11861293865407860378199682309, 9765625000000000000000000000⟩, + .log ⟨(17361489450416797219897770733 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(246600175055478176600599481 / 48828125000000000000000000000), (44117263 / 25000000000000000000000000000000)⟩ ⟨(-727237660046348846356521279330671 / 100000000000000000000000000000000), (50821977127 / 20000000000000000000000000000000)⟩ ⟨-11, 17361489450416797219897770733, 12207031250000000000000000000⟩, + .log ⟨(3476671813135011662133058136131 / 100000000000000000000000000000000), (21 / 100000000000000000000000000000000)⟩ ⟨(2919617487324360121442435864997 / 25000000000000000000000000000000), (4417283451 / 100000000000000000000000000000000)⟩ ⟨(-83977368133912525867429162989171 / 25000000000000000000000000000000), (127054942701 / 100000000000000000000000000000000)⟩ ⟨-5, 3476671813135011662133058136131, 3125000000000000000000000000000⟩] +lemma CA4_5_7I2R2Certificates_valid : + CA4_5_7I2R2Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA4_5_7I2R2CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 2, 0 => 1 + | 3, 0 => 2 + | 1, 1 => 3 + | 0, 2 => 1 + | 0, 3 => 2 + | _, _ => 0 +def CA4_5_7I2R2P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA4_5_7I2R2Certificates (CA4_5_7I2R2CertificateIndex a)).input +lemma CA4_5_7I2R2P_check : ∀ a : PairSlot, contains (CA4_5_7I2R2Raw a) (CA4_5_7I2R2P a) = true := by + decide +kernel +lemma CA4_5_7I2R2P_sound (a : PairSlot) : + (CA4_5_7I2R2P a).Encloses (CA4_5_7I2R2Value a) := + contains_sound (CA4_5_7I2R2Raw_sound a) (CA4_5_7I2R2P_check a) +def CA4_5_7I2R2Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA4_5_7I2R2Certificates (CA4_5_7I2R2CertificateIndex a)).output +lemma CA4_5_7I2R2Terms_sound (a : PairSlot) : + (CA4_5_7I2R2Terms a).Encloses (Foundation.entropyTerm (CA4_5_7I2R2Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA4_5_7I2R2Certificates_valid + (CA4_5_7I2R2CertificateIndex a) (CA4_5_7I2R2P_sound a) +def CA4_5_7I2R2Entropy : Ball := ⟨(10763902528042878560003338099253 / 50000000000000000000000000000000), (7985231791 / 100000000000000000000000000000000)⟩ +lemma CA4_5_7I2R2Entropy_sound : CA4_5_7I2R2Entropy.Encloses (Foundation.finiteEntropy CA4_5_7I2R2Value) := by + exact contains_sound (entropyPair_enclosed CA4_5_7I2R2Value CA4_5_7I2R2Terms CA4_5_7I2R2Terms_sound) (by decide +kernel) +def CA4_5_7I2R2Mass : Ball := ⟨(1102674149440720740080837894287 / 20000000000000000000000000000000), (39 / 100000000000000000000000000000000)⟩ +lemma CA4_5_7I2R2Mass_sound : CA4_5_7I2R2Mass.Encloses (∑ a, CA4_5_7I2R2Value a) := by + exact contains_sound (pairSumBall_sound CA4_5_7I2R2P CA4_5_7I2R2Value CA4_5_7I2R2P_sound) (by decide +kernel) +def CA4_5_7I2R2MassTermLogWitness : LogWitness := ⟨-5, 1102674149440720740080837894287, 625000000000000000000000000000⟩ +def CA4_5_7I2R2MassTermLog : Ball := ⟨(-144899699950644721659372497607277 / 50000000000000000000000000000000), (25410988561 / 20000000000000000000000000000000)⟩ +lemma CA4_5_7I2R2MassTermLog_sound : CA4_5_7I2R2MassTermLog.Encloses (Real.log ((∑ a, CA4_5_7I2R2Value a))) := by + exact checkLog_sound logTwoBall_sound (CA4_5_7I2R2Mass_sound) (w := CA4_5_7I2R2MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA4_5_7I2R2MassTerm : Ball := ⟨(639108613589171253827319714027 / 4000000000000000000000000000000), (7005010163 / 100000000000000000000000000000000)⟩ +lemma CA4_5_7I2R2MassTerm_sound : CA4_5_7I2R2MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA4_5_7I2R2Value a))) := by + exact contains_sound (entropyTerm_ball (CA4_5_7I2R2Mass_sound) CA4_5_7I2R2MassTermLog_sound) (by decide +kernel) +def CA4_5_7I2R2H : Ball := ⟨(5550089716356475774323683347831 / 100000000000000000000000000000000), (7495120977 / 50000000000000000000000000000000)⟩ +lemma CA4_5_7I2R2H_sound : CA4_5_7I2R2H.Encloses (homogeneousEntropy CA4_5_7I2R2Value) := by + exact contains_sound (homogeneous_enclosed CA4_5_7I2R2Value CA4_5_7I2R2MassTerm_sound CA4_5_7I2R2Entropy_sound) (by decide +kernel) +def CA4_5_7I2R3Value (a : PairSlot) : ℝ := residualLaw (below (shape 4 5 7)) (fun u => (stageALaw (shape 4 5 7) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 3 a +def CA4_5_7I2R3Raw (a : PairSlot) : Ball := residualBall (below (shape 4 5 7)) A4_5_7Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 3 a +lemma CA4_5_7I2R3Raw_sound (a : PairSlot) : + (CA4_5_7I2R3Raw a).Encloses (CA4_5_7I2R3Value a) := by + exact residualBall_sound_on (below (shape 4 5 7)) A4_5_7Law (fun u => (stageALaw (shape 4 5 7) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A4_5_7Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 4 5 7) (show (shape 4 5 7) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 3 a +def CA4_5_7I2R3Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(116038587245685451541394719653 / 20000000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ ⟨(746935275772026258957873496579 / 25000000000000000000000000000000), (276436431 / 25000000000000000000000000000000)⟩ ⟨(-128739119201884081430611870402243 / 25000000000000000000000000000000), (47645603459 / 25000000000000000000000000000000)⟩ ⟨-8, 116038587245685451541394719653, 78125000000000000000000000000⟩, + .log ⟨(20460621977683097735074437540931 / 100000000000000000000000000000000), (29 / 50000000000000000000000000000000)⟩ ⟨(507253354513740914667508186421 / 1562500000000000000000000000000), (17330821089 / 100000000000000000000000000000000)⟩ ⟨(-79333401311770809819707962449341 / 50000000000000000000000000000000), (16940659003 / 20000000000000000000000000000000)⟩ ⟨-3, 20460621977683097735074437540931, 12500000000000000000000000000000⟩, + .log ⟨(1061521307796356016541019948227 / 100000000000000000000000000000000), (1 / 20000000000000000000000000000000)⟩ ⟨(4825110191937311571603185667661 / 100000000000000000000000000000000), (56196471 / 3125000000000000000000000000000)⟩ ⟨(-454546711073930566895028232307551 / 100000000000000000000000000000000), (84703294967 / 50000000000000000000000000000000)⟩ ⟨-7, 1061521307796356016541019948227, 781250000000000000000000000000⟩] +lemma CA4_5_7I2R3Certificates_valid : + CA4_5_7I2R3Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA4_5_7I2R3CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 4, 0 => 1 + | 2, 1 => 2 + | 3, 1 => 3 + | 1, 2 => 2 + | 1, 3 => 3 + | 0, 4 => 1 + | _, _ => 0 +def CA4_5_7I2R3P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA4_5_7I2R3Certificates (CA4_5_7I2R3CertificateIndex a)).input +lemma CA4_5_7I2R3P_check : ∀ a : PairSlot, contains (CA4_5_7I2R3Raw a) (CA4_5_7I2R3P a) = true := by + decide +kernel +lemma CA4_5_7I2R3P_sound (a : PairSlot) : + (CA4_5_7I2R3P a).Encloses (CA4_5_7I2R3Value a) := + contains_sound (CA4_5_7I2R3Raw_sound a) (CA4_5_7I2R3P_check a) +def CA4_5_7I2R3Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA4_5_7I2R3Certificates (CA4_5_7I2R3CertificateIndex a)).output +lemma CA4_5_7I2R3Terms_sound (a : PairSlot) : + (CA4_5_7I2R3Terms a).Encloses (Foundation.entropyTerm (CA4_5_7I2R3Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA4_5_7I2R3Certificates_valid + (CA4_5_7I2R3CertificateIndex a) (CA4_5_7I2R3P_sound a) +def CA4_5_7I2R3Entropy : Ball := ⟨(40277065983904835146155203584921 / 50000000000000000000000000000000), (4046970777 / 10000000000000000000000000000000)⟩ +lemma CA4_5_7I2R3Entropy_sound : CA4_5_7I2R3Entropy.Encloses (Foundation.finiteEntropy CA4_5_7I2R3Value) := by + exact contains_sound (entropyPair_enclosed CA4_5_7I2R3Value CA4_5_7I2R3Terms CA4_5_7I2R3Terms_sound) (by decide +kernel) +def CA4_5_7I2R3Mass : Ball := ⟨(22102336221707881009322431087423 / 50000000000000000000000000000000), (67 / 50000000000000000000000000000000)⟩ +lemma CA4_5_7I2R3Mass_sound : CA4_5_7I2R3Mass.Encloses (∑ a, CA4_5_7I2R3Value a) := by + exact contains_sound (pairSumBall_sound CA4_5_7I2R3P CA4_5_7I2R3Value CA4_5_7I2R3P_sound) (by decide +kernel) +def CA4_5_7I2R3MassTermLogWitness : LogWitness := ⟨-2, 22102336221707881009322431087423, 12500000000000000000000000000000⟩ +def CA4_5_7I2R3MassTermLog : Ball := ⟨(-81633969110199724265404696715543 / 100000000000000000000000000000000), (7940933919 / 12500000000000000000000000000000)⟩ +lemma CA4_5_7I2R3MassTermLog_sound : CA4_5_7I2R3MassTermLog.Encloses (Real.log ((∑ a, CA4_5_7I2R3Value a))) := by + exact checkLog_sound logTwoBall_sound (CA4_5_7I2R3Mass_sound) (w := CA4_5_7I2R3MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA4_5_7I2R3MassTerm : Ball := ⟨(36086028647722992852483823757497 / 100000000000000000000000000000000), (28082110733 / 100000000000000000000000000000000)⟩ +lemma CA4_5_7I2R3MassTerm_sound : CA4_5_7I2R3MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA4_5_7I2R3Value a))) := by + exact contains_sound (entropyTerm_ball (CA4_5_7I2R3Mass_sound) CA4_5_7I2R3MassTermLog_sound) (by decide +kernel) +def CA4_5_7I2R3H : Ball := ⟨(8893620664017335487965316682469 / 20000000000000000000000000000000), (68551818503 / 100000000000000000000000000000000)⟩ +lemma CA4_5_7I2R3H_sound : CA4_5_7I2R3H.Encloses (homogeneousEntropy CA4_5_7I2R3Value) := by + exact contains_sound (homogeneous_enclosed CA4_5_7I2R3Value CA4_5_7I2R3MassTerm_sound CA4_5_7I2R3Entropy_sound) (by decide +kernel) +def CA4_5_7I2R4Value (a : PairSlot) : ℝ := residualLaw (below (shape 4 5 7)) (fun u => (stageALaw (shape 4 5 7) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 4 a +def CA4_5_7I2R4Raw (a : PairSlot) : Ball := residualBall (below (shape 4 5 7)) A4_5_7Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 4 a +lemma CA4_5_7I2R4Raw_sound (a : PairSlot) : + (CA4_5_7I2R4Raw a).Encloses (CA4_5_7I2R4Value a) := by + exact residualBall_sound_on (below (shape 4 5 7)) A4_5_7Law (fun u => (stageALaw (shape 4 5 7) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A4_5_7Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 4 5 7) (show (shape 4 5 7) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 4 a +def CA4_5_7I2R4Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(226473706787275519218486833 / 2500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(84331311552445100421913750733 / 100000000000000000000000000000000), (5754923 / 20000000000000000000000000000000)⟩ ⟨(-930917243647809581534875730636993 / 100000000000000000000000000000000), (317637366283 / 100000000000000000000000000000000)⟩ ⟨-14, 226473706787275519218486833, 152587890625000000000000000⟩, + .log ⟨(3177125346425778831075447458091 / 100000000000000000000000000000000), (1 / 6250000000000000000000000000000)⟩ ⟨(10958519703244693898392362883243 / 100000000000000000000000000000000), (4036694841 / 100000000000000000000000000000000)⟩ ⟨(-6898386754285835075843605989883 / 2000000000000000000000000000000), (127054942601 / 100000000000000000000000000000000)⟩ ⟨-5, 3177125346425778831075447458091, 3125000000000000000000000000000⟩, + .log ⟨(8284523162059862942498959658483 / 25000000000000000000000000000000), (51 / 50000000000000000000000000000000)⟩ ⟨(36600583587959685855884743349303 / 100000000000000000000000000000000), (5262948107 / 25000000000000000000000000000000)⟩ ⟨(-110448673001414244079839114916649 / 100000000000000000000000000000000), (15881867839 / 25000000000000000000000000000000)⟩ ⟨-2, 8284523162059862942498959658483, 6250000000000000000000000000000⟩, + .log ⟨(768235467440488083710341295643 / 50000000000000000000000000000000), (7 / 100000000000000000000000000000000)⟩ ⟨(400988376646451096965158174859 / 6250000000000000000000000000000), (1301441523 / 50000000000000000000000000000000)⟩ ⟨(-208784100001222061083697270247223 / 50000000000000000000000000000000), (169406589919 / 100000000000000000000000000000000)⟩ ⟨-7, 768235467440488083710341295643, 390625000000000000000000000000⟩, + .log ⟨(7439805246988084802149349047 / 10000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ ⟨(267963025525865227547179212149 / 50000000000000000000000000000000), (94526411 / 50000000000000000000000000000000)⟩ ⟨(-720349569995388840128291954778389 / 100000000000000000000000000000000), (63527471721 / 25000000000000000000000000000000)⟩ ⟨-11, 7439805246988084802149349047, 4882812500000000000000000000⟩] +lemma CA4_5_7I2R4Certificates_valid : + CA4_5_7I2R4Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA4_5_7I2R4CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 5, 0 => 1 + | 4, 1 => 2 + | 2, 2 => 3 + | 2, 3 => 4 + | 3, 2 => 4 + | 3, 3 => 5 + | 1, 4 => 2 + | 0, 5 => 1 + | _, _ => 0 +def CA4_5_7I2R4P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA4_5_7I2R4Certificates (CA4_5_7I2R4CertificateIndex a)).input +lemma CA4_5_7I2R4P_check : ∀ a : PairSlot, contains (CA4_5_7I2R4Raw a) (CA4_5_7I2R4P a) = true := by + decide +kernel +lemma CA4_5_7I2R4P_sound (a : PairSlot) : + (CA4_5_7I2R4P a).Encloses (CA4_5_7I2R4Value a) := + contains_sound (CA4_5_7I2R4Raw_sound a) (CA4_5_7I2R4P_check a) +def CA4_5_7I2R4Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA4_5_7I2R4Certificates (CA4_5_7I2R4CertificateIndex a)).output +lemma CA4_5_7I2R4Terms_sound (a : PairSlot) : + (CA4_5_7I2R4Terms a).Encloses (Foundation.entropyTerm (CA4_5_7I2R4Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA4_5_7I2R4Certificates_valid + (CA4_5_7I2R4CertificateIndex a) (CA4_5_7I2R4P_sound a) +def CA4_5_7I2R4Entropy : Ball := ⟨(72053839721292129411492716637041 / 100000000000000000000000000000000), (17288775127 / 50000000000000000000000000000000)⟩ +lemma CA4_5_7I2R4Entropy_sound : CA4_5_7I2R4Entropy.Encloses (Foundation.finiteEntropy CA4_5_7I2R4Value) := by + exact contains_sound (entropyPair_enclosed CA4_5_7I2R4Value CA4_5_7I2R4Terms CA4_5_7I2R4Terms_sound) (by decide +kernel) +def CA4_5_7I2R4Mass : Ball := ⟨(10664450289966456164136767792449 / 25000000000000000000000000000000), (19 / 12500000000000000000000000000000)⟩ +lemma CA4_5_7I2R4Mass_sound : CA4_5_7I2R4Mass.Encloses (∑ a, CA4_5_7I2R4Value a) := by + exact contains_sound (pairSumBall_sound CA4_5_7I2R4P CA4_5_7I2R4Value CA4_5_7I2R4P_sound) (by decide +kernel) +def CA4_5_7I2R4MassTermLogWitness : LogWitness := ⟨-2, 10664450289966456164136767792449, 6250000000000000000000000000000⟩ +def CA4_5_7I2R4MassTermLog : Ball := ⟨(-21299000441064703795460550474203 / 25000000000000000000000000000000), (12705494281 / 20000000000000000000000000000000)⟩ +lemma CA4_5_7I2R4MassTermLog_sound : CA4_5_7I2R4MassTermLog.Encloses (Real.log ((∑ a, CA4_5_7I2R4Value a))) := by + exact checkLog_sound logTwoBall_sound (CA4_5_7I2R4Mass_sound) (w := CA4_5_7I2R4MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA4_5_7I2R4MassTerm : Ball := ⟨(18171370514376652650033390669629 / 50000000000000000000000000000000), (6774855641 / 25000000000000000000000000000000)⟩ +lemma CA4_5_7I2R4MassTerm_sound : CA4_5_7I2R4MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA4_5_7I2R4Value a))) := by + exact contains_sound (entropyTerm_ball (CA4_5_7I2R4Mass_sound) CA4_5_7I2R4MassTermLog_sound) (by decide +kernel) +def CA4_5_7I2R4H : Ball := ⟨(35711098692538824111425935297783 / 100000000000000000000000000000000), (30838486409 / 50000000000000000000000000000000)⟩ +lemma CA4_5_7I2R4H_sound : CA4_5_7I2R4H.Encloses (homogeneousEntropy CA4_5_7I2R4Value) := by + exact contains_sound (homogeneous_enclosed CA4_5_7I2R4Value CA4_5_7I2R4MassTerm_sound CA4_5_7I2R4Entropy_sound) (by decide +kernel) +def CA4_5_7I2R5Value (a : PairSlot) : ℝ := residualLaw (below (shape 4 5 7)) (fun u => (stageALaw (shape 4 5 7) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 5 a +def CA4_5_7I2R5Raw (a : PairSlot) : Ball := residualBall (below (shape 4 5 7)) A4_5_7Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 5 a +lemma CA4_5_7I2R5Raw_sound (a : PairSlot) : + (CA4_5_7I2R5Raw a).Encloses (CA4_5_7I2R5Value a) := by + exact residualBall_sound_on (below (shape 4 5 7)) A4_5_7Law (fun u => (stageALaw (shape 4 5 7) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A4_5_7Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 4 5 7) (show (shape 4 5 7) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 5 a +def CA4_5_7I2R5Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(144697917097217142068111639 / 4000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(36996206736220144249603357241 / 100000000000000000000000000000000), (6128201 / 50000000000000000000000000000000)⟩ ⟨(-25567891700447747738730852352753 / 2500000000000000000000000000000), (338813206571 / 100000000000000000000000000000000)⟩ ⟨-15, 144697917097217142068111639, 122070312500000000000000000⟩, + .log ⟨(549793017508480599404902018279 / 25000000000000000000000000000000), (3 / 25000000000000000000000000000000)⟩ ⟨(4197218009805251425058918058719 / 50000000000000000000000000000000), (3259849659 / 100000000000000000000000000000000)⟩ ⟨(-19085446141285838610089690603983 / 5000000000000000000000000000000), (74115383163 / 50000000000000000000000000000000)⟩ ⟨-6, 549793017508480599404902018279, 390625000000000000000000000000⟩, + .log ⟨(82151359982399290296125908147 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(72954125688653551987601937681 / 12500000000000000000000000000000), (104377367 / 50000000000000000000000000000000)⟩ ⟨(-177609051643901643944605201016889 / 25000000000000000000000000000000), (254109885413 / 100000000000000000000000000000000)⟩ ⟨-11, 82151359982399290296125908147, 48828125000000000000000000000⟩] +lemma CA4_5_7I2R5Certificates_valid : + CA4_5_7I2R5Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA4_5_7I2R5CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 5, 1 => 1 + | 4, 2 => 2 + | 4, 3 => 3 + | 2, 4 => 2 + | 3, 4 => 3 + | 1, 5 => 1 + | _, _ => 0 +def CA4_5_7I2R5P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA4_5_7I2R5Certificates (CA4_5_7I2R5CertificateIndex a)).input +lemma CA4_5_7I2R5P_check : ∀ a : PairSlot, contains (CA4_5_7I2R5Raw a) (CA4_5_7I2R5P a) = true := by + decide +kernel +lemma CA4_5_7I2R5P_sound (a : PairSlot) : + (CA4_5_7I2R5P a).Encloses (CA4_5_7I2R5Value a) := + contains_sound (CA4_5_7I2R5Raw_sound a) (CA4_5_7I2R5P_check a) +def CA4_5_7I2R5Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA4_5_7I2R5Certificates (CA4_5_7I2R5CertificateIndex a)).output +lemma CA4_5_7I2R5Terms_sound (a : PairSlot) : + (CA4_5_7I2R5Terms a).Encloses (Foundation.entropyTerm (CA4_5_7I2R5Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA4_5_7I2R5Certificates_valid + (CA4_5_7I2R5CertificateIndex a) (CA4_5_7I2R5P_sound a) +def CA4_5_7I2R5Entropy : Ball := ⟨(9015065231855951410268254976127 / 50000000000000000000000000000000), (696172159 / 10000000000000000000000000000000)⟩ +lemma CA4_5_7I2R5Entropy_sound : CA4_5_7I2R5Entropy.Encloses (Foundation.finiteEntropy CA4_5_7I2R5Value) := by + exact contains_sound (entropyPair_enclosed CA4_5_7I2R5Value CA4_5_7I2R5Terms CA4_5_7I2R5Terms_sound) (by decide +kernel) +def CA4_5_7I2R5Mass : Ball := ⟨(1142470438971876058233718386119 / 25000000000000000000000000000000), (7 / 25000000000000000000000000000000)⟩ +lemma CA4_5_7I2R5Mass_sound : CA4_5_7I2R5Mass.Encloses (∑ a, CA4_5_7I2R5Value a) := by + exact contains_sound (pairSumBall_sound CA4_5_7I2R5P CA4_5_7I2R5Value CA4_5_7I2R5P_sound) (by decide +kernel) +def CA4_5_7I2R5MassTermLogWitness : LogWitness := ⟨-5, 1142470438971876058233718386119, 781250000000000000000000000000⟩ +def CA4_5_7I2R5MassTermLog : Ball := ⟨(-308568285540194419975053007221709 / 100000000000000000000000000000000), (12705494271 / 10000000000000000000000000000000)⟩ +lemma CA4_5_7I2R5MassTermLog_sound : CA4_5_7I2R5MassTermLog.Encloses (Real.log ((∑ a, CA4_5_7I2R5Value a))) := by + exact checkLog_sound logTwoBall_sound (CA4_5_7I2R5Mass_sound) (w := CA4_5_7I2R5MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA4_5_7I2R5MassTerm : Ball := ⟨(14101205785356204585631815735069 / 100000000000000000000000000000000), (2903130367 / 50000000000000000000000000000000)⟩ +lemma CA4_5_7I2R5MassTerm_sound : CA4_5_7I2R5MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA4_5_7I2R5Value a))) := by + exact contains_sound (entropyTerm_ball (CA4_5_7I2R5Mass_sound) CA4_5_7I2R5MassTermLog_sound) (by decide +kernel) +def CA4_5_7I2R5H : Ball := ⟨(785784935671139646980938843437 / 20000000000000000000000000000000), (3191995581 / 25000000000000000000000000000000)⟩ +lemma CA4_5_7I2R5H_sound : CA4_5_7I2R5H.Encloses (homogeneousEntropy CA4_5_7I2R5Value) := by + exact contains_sound (homogeneous_enclosed CA4_5_7I2R5Value CA4_5_7I2R5MassTerm_sound CA4_5_7I2R5Entropy_sound) (by decide +kernel) +def CA4_5_7I2R6Value (a : PairSlot) : ℝ := residualLaw (below (shape 4 5 7)) (fun u => (stageALaw (shape 4 5 7) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 6 a +def CA4_5_7I2R6Raw (a : PairSlot) : Ball := residualBall (below (shape 4 5 7)) A4_5_7Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 6 a +lemma CA4_5_7I2R6Raw_sound (a : PairSlot) : + (CA4_5_7I2R6Raw a).Encloses (CA4_5_7I2R6Value a) := by + exact residualBall_sound_on (below (shape 4 5 7)) A4_5_7Law (fun u => (stageALaw (shape 4 5 7) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A4_5_7Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 4 5 7) (show (shape 4 5 7) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 6 a +def CA4_5_7I2R6Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(304080552630759022733618587 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(7304161393171340453107880699 / 100000000000000000000000000000000), (2446893 / 100000000000000000000000000000000)⟩ ⟨(-9608192737061599125806395148961 / 800000000000000000000000000000), (402340814407 / 100000000000000000000000000000000)⟩ ⟨-18, 304080552630759022733618587, 190734863281250000000000000⟩, + .log ⟨(38316563574980860658657 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(415400474632440168347527 / 50000000000000000000000000000000), (291 / 100000000000000000000000000000000)⟩ ⟨(-433651075018303139410633388816849 / 20000000000000000000000000000000), (350706009461 / 50000000000000000000000000000000)⟩ ⟨-32, 38316563574980860658657, 23283064365386962890625⟩, + .log ⟨(1275415133808368728054689087 / 2000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ ⟨(458204765293789606800601001 / 97656250000000000000000000000), (81023907 / 50000000000000000000000000000000)⟩ ⟨(-36788153693912351224511622022271 / 5000000000000000000000000000000), (63527471833 / 25000000000000000000000000000000)⟩ ⟨-11, 1275415133808368728054689087, 976562500000000000000000000⟩] +lemma CA4_5_7I2R6Certificates_valid : + CA4_5_7I2R6Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA4_5_7I2R6CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 5, 2 => 1 + | 5, 3 => 2 + | 4, 4 => 3 + | 2, 5 => 1 + | 3, 5 => 2 + | _, _ => 0 +def CA4_5_7I2R6P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA4_5_7I2R6Certificates (CA4_5_7I2R6CertificateIndex a)).input +lemma CA4_5_7I2R6P_check : ∀ a : PairSlot, contains (CA4_5_7I2R6Raw a) (CA4_5_7I2R6P a) = true := by + decide +kernel +lemma CA4_5_7I2R6P_sound (a : PairSlot) : + (CA4_5_7I2R6P a).Encloses (CA4_5_7I2R6Value a) := + contains_sound (CA4_5_7I2R6Raw_sound a) (CA4_5_7I2R6P_check a) +def CA4_5_7I2R6Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA4_5_7I2R6Certificates (CA4_5_7I2R6CertificateIndex a)).output +lemma CA4_5_7I2R6Terms_sound (a : PairSlot) : + (CA4_5_7I2R6Terms a).Encloses (Foundation.entropyTerm (CA4_5_7I2R6Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA4_5_7I2R6Certificates_valid + (CA4_5_7I2R6CertificateIndex a) (CA4_5_7I2R6P_sound a) +def CA4_5_7I2R6Entropy : Ball := ⟨(48381166404908176803070457653 / 10000000000000000000000000000000), (83471091 / 50000000000000000000000000000000)⟩ +lemma CA4_5_7I2R6Entropy_sound : CA4_5_7I2R6Entropy.Encloses (Foundation.finiteEntropy CA4_5_7I2R6Value) := by + exact contains_sound (entropyPair_enclosed CA4_5_7I2R6Value CA4_5_7I2R6Terms CA4_5_7I2R6Terms_sound) (by decide +kernel) +def CA4_5_7I2R6Mass : Ball := ⟨(16246788883517155613847561503 / 25000000000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ +lemma CA4_5_7I2R6Mass_sound : CA4_5_7I2R6Mass.Encloses (∑ a, CA4_5_7I2R6Value a) := by + exact contains_sound (pairSumBall_sound CA4_5_7I2R6P CA4_5_7I2R6Value CA4_5_7I2R6P_sound) (by decide +kernel) +def CA4_5_7I2R6MassTermLogWitness : LogWitness := ⟨-11, 16246788883517155613847561503, 12207031250000000000000000000⟩ +def CA4_5_7I2R6MassTermLog : Ball := ⟨(-733873582176963528087673936985231 / 100000000000000000000000000000000), (63527473357 / 25000000000000000000000000000000)⟩ +lemma CA4_5_7I2R6MassTermLog_sound : CA4_5_7I2R6MassTermLog.Encloses (Real.log ((∑ a, CA4_5_7I2R6Value a))) := by + exact checkLog_sound logTwoBall_sound (CA4_5_7I2R6Mass_sound) (w := CA4_5_7I2R6MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA4_5_7I2R6MassTerm : Ball := ⟨(119230891568196048297085156129 / 25000000000000000000000000000000), (165138837 / 100000000000000000000000000000000)⟩ +lemma CA4_5_7I2R6MassTerm_sound : CA4_5_7I2R6MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA4_5_7I2R6Value a))) := by + exact contains_sound (entropyTerm_ball (CA4_5_7I2R6Mass_sound) CA4_5_7I2R6MassTermLog_sound) (by decide +kernel) +def CA4_5_7I2R6H : Ball := ⟨(3444048888148787421181976007 / 50000000000000000000000000000000), (332081019 / 100000000000000000000000000000000)⟩ +lemma CA4_5_7I2R6H_sound : CA4_5_7I2R6H.Encloses (homogeneousEntropy CA4_5_7I2R6Value) := by + exact contains_sound (homogeneous_enclosed CA4_5_7I2R6Value CA4_5_7I2R6MassTerm_sound CA4_5_7I2R6Entropy_sound) (by decide +kernel) +def CA4_5_7I2R7Value (a : PairSlot) : ℝ := residualLaw (below (shape 4 5 7)) (fun u => (stageALaw (shape 4 5 7) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 7 a +def CA4_5_7I2R7Raw (a : PairSlot) : Ball := residualBall (below (shape 4 5 7)) A4_5_7Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 7 a +lemma CA4_5_7I2R7Raw_sound (a : PairSlot) : + (CA4_5_7I2R7Raw a).Encloses (CA4_5_7I2R7Value a) := by + exact residualBall_sound_on (below (shape 4 5 7)) A4_5_7Law (fun u => (stageALaw (shape 4 5 7) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A4_5_7Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 4 5 7) (show (shape 4 5 7) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 7 a +def CA4_5_7I2R7Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA4_5_7I2R7Certificates_valid : + CA4_5_7I2R7Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA4_5_7I2R7CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA4_5_7I2R7P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA4_5_7I2R7Certificates (CA4_5_7I2R7CertificateIndex a)).input +lemma CA4_5_7I2R7P_check : ∀ a : PairSlot, contains (CA4_5_7I2R7Raw a) (CA4_5_7I2R7P a) = true := by + decide +kernel +lemma CA4_5_7I2R7P_sound (a : PairSlot) : + (CA4_5_7I2R7P a).Encloses (CA4_5_7I2R7Value a) := + contains_sound (CA4_5_7I2R7Raw_sound a) (CA4_5_7I2R7P_check a) +def CA4_5_7I2R7Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA4_5_7I2R7Certificates (CA4_5_7I2R7CertificateIndex a)).output +lemma CA4_5_7I2R7Terms_sound (a : PairSlot) : + (CA4_5_7I2R7Terms a).Encloses (Foundation.entropyTerm (CA4_5_7I2R7Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA4_5_7I2R7Certificates_valid + (CA4_5_7I2R7CertificateIndex a) (CA4_5_7I2R7P_sound a) +def CA4_5_7I2R7Entropy : Ball := ⟨0, 0⟩ +lemma CA4_5_7I2R7Entropy_sound : CA4_5_7I2R7Entropy.Encloses (Foundation.finiteEntropy CA4_5_7I2R7Value) := by + exact contains_sound (entropyPair_enclosed CA4_5_7I2R7Value CA4_5_7I2R7Terms CA4_5_7I2R7Terms_sound) (by decide +kernel) +def CA4_5_7I2R7Mass : Ball := ⟨0, 0⟩ +lemma CA4_5_7I2R7Mass_sound : CA4_5_7I2R7Mass.Encloses (∑ a, CA4_5_7I2R7Value a) := by + exact contains_sound (pairSumBall_sound CA4_5_7I2R7P CA4_5_7I2R7Value CA4_5_7I2R7P_sound) (by decide +kernel) +def CA4_5_7I2R7MassTerm : Ball := .exact 0 +lemma CA4_5_7I2R7MassTerm_sound : CA4_5_7I2R7MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA4_5_7I2R7Value a))) := + entropyTerm_zero_ball (CA4_5_7I2R7Mass_sound) +def CA4_5_7I2R7H : Ball := ⟨0, 0⟩ +lemma CA4_5_7I2R7H_sound : CA4_5_7I2R7H.Encloses (homogeneousEntropy CA4_5_7I2R7Value) := by + exact contains_sound (homogeneous_enclosed CA4_5_7I2R7Value CA4_5_7I2R7MassTerm_sound CA4_5_7I2R7Entropy_sound) (by decide +kernel) +def CA4_5_7I2R8Value (a : PairSlot) : ℝ := residualLaw (below (shape 4 5 7)) (fun u => (stageALaw (shape 4 5 7) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 8 a +def CA4_5_7I2R8Raw (a : PairSlot) : Ball := residualBall (below (shape 4 5 7)) A4_5_7Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 8 a +lemma CA4_5_7I2R8Raw_sound (a : PairSlot) : + (CA4_5_7I2R8Raw a).Encloses (CA4_5_7I2R8Value a) := by + exact residualBall_sound_on (below (shape 4 5 7)) A4_5_7Law (fun u => (stageALaw (shape 4 5 7) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A4_5_7Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 4 5 7) (show (shape 4 5 7) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 8 a +def CA4_5_7I2R8Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA4_5_7I2R8Certificates_valid : + CA4_5_7I2R8Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA4_5_7I2R8CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA4_5_7I2R8P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA4_5_7I2R8Certificates (CA4_5_7I2R8CertificateIndex a)).input +lemma CA4_5_7I2R8P_check : ∀ a : PairSlot, contains (CA4_5_7I2R8Raw a) (CA4_5_7I2R8P a) = true := by + decide +kernel +lemma CA4_5_7I2R8P_sound (a : PairSlot) : + (CA4_5_7I2R8P a).Encloses (CA4_5_7I2R8Value a) := + contains_sound (CA4_5_7I2R8Raw_sound a) (CA4_5_7I2R8P_check a) +def CA4_5_7I2R8Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA4_5_7I2R8Certificates (CA4_5_7I2R8CertificateIndex a)).output +lemma CA4_5_7I2R8Terms_sound (a : PairSlot) : + (CA4_5_7I2R8Terms a).Encloses (Foundation.entropyTerm (CA4_5_7I2R8Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA4_5_7I2R8Certificates_valid + (CA4_5_7I2R8CertificateIndex a) (CA4_5_7I2R8P_sound a) +def CA4_5_7I2R8Entropy : Ball := ⟨0, 0⟩ +lemma CA4_5_7I2R8Entropy_sound : CA4_5_7I2R8Entropy.Encloses (Foundation.finiteEntropy CA4_5_7I2R8Value) := by + exact contains_sound (entropyPair_enclosed CA4_5_7I2R8Value CA4_5_7I2R8Terms CA4_5_7I2R8Terms_sound) (by decide +kernel) +def CA4_5_7I2R8Mass : Ball := ⟨0, 0⟩ +lemma CA4_5_7I2R8Mass_sound : CA4_5_7I2R8Mass.Encloses (∑ a, CA4_5_7I2R8Value a) := by + exact contains_sound (pairSumBall_sound CA4_5_7I2R8P CA4_5_7I2R8Value CA4_5_7I2R8P_sound) (by decide +kernel) +def CA4_5_7I2R8MassTerm : Ball := .exact 0 +lemma CA4_5_7I2R8MassTerm_sound : CA4_5_7I2R8MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA4_5_7I2R8Value a))) := + entropyTerm_zero_ball (CA4_5_7I2R8Mass_sound) +def CA4_5_7I2R8H : Ball := ⟨0, 0⟩ +lemma CA4_5_7I2R8H_sound : CA4_5_7I2R8H.Encloses (homogeneousEntropy CA4_5_7I2R8Value) := by + exact contains_sound (homogeneous_enclosed CA4_5_7I2R8Value CA4_5_7I2R8MassTerm_sound CA4_5_7I2R8Entropy_sound) (by decide +kernel) +def CA4_5_7I2R9Value (a : PairSlot) : ℝ := residualLaw (below (shape 4 5 7)) (fun u => (stageALaw (shape 4 5 7) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 9 a +def CA4_5_7I2R9Raw (a : PairSlot) : Ball := residualBall (below (shape 4 5 7)) A4_5_7Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 9 a +lemma CA4_5_7I2R9Raw_sound (a : PairSlot) : + (CA4_5_7I2R9Raw a).Encloses (CA4_5_7I2R9Value a) := by + exact residualBall_sound_on (below (shape 4 5 7)) A4_5_7Law (fun u => (stageALaw (shape 4 5 7) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A4_5_7Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 4 5 7) (show (shape 4 5 7) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 9 a +def CA4_5_7I2R9Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA4_5_7I2R9Certificates_valid : + CA4_5_7I2R9Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA4_5_7I2R9CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA4_5_7I2R9P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA4_5_7I2R9Certificates (CA4_5_7I2R9CertificateIndex a)).input +lemma CA4_5_7I2R9P_check : ∀ a : PairSlot, contains (CA4_5_7I2R9Raw a) (CA4_5_7I2R9P a) = true := by + decide +kernel +lemma CA4_5_7I2R9P_sound (a : PairSlot) : + (CA4_5_7I2R9P a).Encloses (CA4_5_7I2R9Value a) := + contains_sound (CA4_5_7I2R9Raw_sound a) (CA4_5_7I2R9P_check a) +def CA4_5_7I2R9Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA4_5_7I2R9Certificates (CA4_5_7I2R9CertificateIndex a)).output +lemma CA4_5_7I2R9Terms_sound (a : PairSlot) : + (CA4_5_7I2R9Terms a).Encloses (Foundation.entropyTerm (CA4_5_7I2R9Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA4_5_7I2R9Certificates_valid + (CA4_5_7I2R9CertificateIndex a) (CA4_5_7I2R9P_sound a) +def CA4_5_7I2R9Entropy : Ball := ⟨0, 0⟩ +lemma CA4_5_7I2R9Entropy_sound : CA4_5_7I2R9Entropy.Encloses (Foundation.finiteEntropy CA4_5_7I2R9Value) := by + exact contains_sound (entropyPair_enclosed CA4_5_7I2R9Value CA4_5_7I2R9Terms CA4_5_7I2R9Terms_sound) (by decide +kernel) +def CA4_5_7I2R9Mass : Ball := ⟨0, 0⟩ +lemma CA4_5_7I2R9Mass_sound : CA4_5_7I2R9Mass.Encloses (∑ a, CA4_5_7I2R9Value a) := by + exact contains_sound (pairSumBall_sound CA4_5_7I2R9P CA4_5_7I2R9Value CA4_5_7I2R9P_sound) (by decide +kernel) +def CA4_5_7I2R9MassTerm : Ball := .exact 0 +lemma CA4_5_7I2R9MassTerm_sound : CA4_5_7I2R9MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA4_5_7I2R9Value a))) := + entropyTerm_zero_ball (CA4_5_7I2R9Mass_sound) +def CA4_5_7I2R9H : Ball := ⟨0, 0⟩ +lemma CA4_5_7I2R9H_sound : CA4_5_7I2R9H.Encloses (homogeneousEntropy CA4_5_7I2R9Value) := by + exact contains_sound (homogeneous_enclosed CA4_5_7I2R9Value CA4_5_7I2R9MassTerm_sound CA4_5_7I2R9Entropy_sound) (by decide +kernel) +def CA4_5_7I2R10Value (a : PairSlot) : ℝ := residualLaw (below (shape 4 5 7)) (fun u => (stageALaw (shape 4 5 7) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 10 a +def CA4_5_7I2R10Raw (a : PairSlot) : Ball := residualBall (below (shape 4 5 7)) A4_5_7Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 10 a +lemma CA4_5_7I2R10Raw_sound (a : PairSlot) : + (CA4_5_7I2R10Raw a).Encloses (CA4_5_7I2R10Value a) := by + exact residualBall_sound_on (below (shape 4 5 7)) A4_5_7Law (fun u => (stageALaw (shape 4 5 7) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A4_5_7Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 4 5 7) (show (shape 4 5 7) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 10 a +def CA4_5_7I2R10Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA4_5_7I2R10Certificates_valid : + CA4_5_7I2R10Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA4_5_7I2R10CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA4_5_7I2R10P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA4_5_7I2R10Certificates (CA4_5_7I2R10CertificateIndex a)).input +lemma CA4_5_7I2R10P_check : ∀ a : PairSlot, contains (CA4_5_7I2R10Raw a) (CA4_5_7I2R10P a) = true := by + decide +kernel +lemma CA4_5_7I2R10P_sound (a : PairSlot) : + (CA4_5_7I2R10P a).Encloses (CA4_5_7I2R10Value a) := + contains_sound (CA4_5_7I2R10Raw_sound a) (CA4_5_7I2R10P_check a) +def CA4_5_7I2R10Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA4_5_7I2R10Certificates (CA4_5_7I2R10CertificateIndex a)).output +lemma CA4_5_7I2R10Terms_sound (a : PairSlot) : + (CA4_5_7I2R10Terms a).Encloses (Foundation.entropyTerm (CA4_5_7I2R10Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA4_5_7I2R10Certificates_valid + (CA4_5_7I2R10CertificateIndex a) (CA4_5_7I2R10P_sound a) +def CA4_5_7I2R10Entropy : Ball := ⟨0, 0⟩ +lemma CA4_5_7I2R10Entropy_sound : CA4_5_7I2R10Entropy.Encloses (Foundation.finiteEntropy CA4_5_7I2R10Value) := by + exact contains_sound (entropyPair_enclosed CA4_5_7I2R10Value CA4_5_7I2R10Terms CA4_5_7I2R10Terms_sound) (by decide +kernel) +def CA4_5_7I2R10Mass : Ball := ⟨0, 0⟩ +lemma CA4_5_7I2R10Mass_sound : CA4_5_7I2R10Mass.Encloses (∑ a, CA4_5_7I2R10Value a) := by + exact contains_sound (pairSumBall_sound CA4_5_7I2R10P CA4_5_7I2R10Value CA4_5_7I2R10P_sound) (by decide +kernel) +def CA4_5_7I2R10MassTerm : Ball := .exact 0 +lemma CA4_5_7I2R10MassTerm_sound : CA4_5_7I2R10MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA4_5_7I2R10Value a))) := + entropyTerm_zero_ball (CA4_5_7I2R10Mass_sound) +def CA4_5_7I2R10H : Ball := ⟨0, 0⟩ +lemma CA4_5_7I2R10H_sound : CA4_5_7I2R10H.Encloses (homogeneousEntropy CA4_5_7I2R10Value) := by + exact contains_sound (homogeneous_enclosed CA4_5_7I2R10Value CA4_5_7I2R10MassTerm_sound CA4_5_7I2R10Entropy_sound) (by decide +kernel) +def CA4_5_7I2R11Value (a : PairSlot) : ℝ := residualLaw (below (shape 4 5 7)) (fun u => (stageALaw (shape 4 5 7) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 11 a +def CA4_5_7I2R11Raw (a : PairSlot) : Ball := residualBall (below (shape 4 5 7)) A4_5_7Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 11 a +lemma CA4_5_7I2R11Raw_sound (a : PairSlot) : + (CA4_5_7I2R11Raw a).Encloses (CA4_5_7I2R11Value a) := by + exact residualBall_sound_on (below (shape 4 5 7)) A4_5_7Law (fun u => (stageALaw (shape 4 5 7) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A4_5_7Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 4 5 7) (show (shape 4 5 7) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 11 a +def CA4_5_7I2R11Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA4_5_7I2R11Certificates_valid : + CA4_5_7I2R11Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA4_5_7I2R11CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA4_5_7I2R11P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA4_5_7I2R11Certificates (CA4_5_7I2R11CertificateIndex a)).input +lemma CA4_5_7I2R11P_check : ∀ a : PairSlot, contains (CA4_5_7I2R11Raw a) (CA4_5_7I2R11P a) = true := by + decide +kernel +lemma CA4_5_7I2R11P_sound (a : PairSlot) : + (CA4_5_7I2R11P a).Encloses (CA4_5_7I2R11Value a) := + contains_sound (CA4_5_7I2R11Raw_sound a) (CA4_5_7I2R11P_check a) +def CA4_5_7I2R11Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA4_5_7I2R11Certificates (CA4_5_7I2R11CertificateIndex a)).output +lemma CA4_5_7I2R11Terms_sound (a : PairSlot) : + (CA4_5_7I2R11Terms a).Encloses (Foundation.entropyTerm (CA4_5_7I2R11Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA4_5_7I2R11Certificates_valid + (CA4_5_7I2R11CertificateIndex a) (CA4_5_7I2R11P_sound a) +def CA4_5_7I2R11Entropy : Ball := ⟨0, 0⟩ +lemma CA4_5_7I2R11Entropy_sound : CA4_5_7I2R11Entropy.Encloses (Foundation.finiteEntropy CA4_5_7I2R11Value) := by + exact contains_sound (entropyPair_enclosed CA4_5_7I2R11Value CA4_5_7I2R11Terms CA4_5_7I2R11Terms_sound) (by decide +kernel) +def CA4_5_7I2R11Mass : Ball := ⟨0, 0⟩ +lemma CA4_5_7I2R11Mass_sound : CA4_5_7I2R11Mass.Encloses (∑ a, CA4_5_7I2R11Value a) := by + exact contains_sound (pairSumBall_sound CA4_5_7I2R11P CA4_5_7I2R11Value CA4_5_7I2R11P_sound) (by decide +kernel) +def CA4_5_7I2R11MassTerm : Ball := .exact 0 +lemma CA4_5_7I2R11MassTerm_sound : CA4_5_7I2R11MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA4_5_7I2R11Value a))) := + entropyTerm_zero_ball (CA4_5_7I2R11Mass_sound) +def CA4_5_7I2R11H : Ball := ⟨0, 0⟩ +lemma CA4_5_7I2R11H_sound : CA4_5_7I2R11H.Encloses (homogeneousEntropy CA4_5_7I2R11Value) := by + exact contains_sound (homogeneous_enclosed CA4_5_7I2R11Value CA4_5_7I2R11MassTerm_sound CA4_5_7I2R11Entropy_sound) (by decide +kernel) +def CA4_5_7I2R12Value (a : PairSlot) : ℝ := residualLaw (below (shape 4 5 7)) (fun u => (stageALaw (shape 4 5 7) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 12 a +def CA4_5_7I2R12Raw (a : PairSlot) : Ball := residualBall (below (shape 4 5 7)) A4_5_7Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 12 a +lemma CA4_5_7I2R12Raw_sound (a : PairSlot) : + (CA4_5_7I2R12Raw a).Encloses (CA4_5_7I2R12Value a) := by + exact residualBall_sound_on (below (shape 4 5 7)) A4_5_7Law (fun u => (stageALaw (shape 4 5 7) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A4_5_7Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 4 5 7) (show (shape 4 5 7) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 12 a +def CA4_5_7I2R12Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA4_5_7I2R12Certificates_valid : + CA4_5_7I2R12Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA4_5_7I2R12CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA4_5_7I2R12P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA4_5_7I2R12Certificates (CA4_5_7I2R12CertificateIndex a)).input +lemma CA4_5_7I2R12P_check : ∀ a : PairSlot, contains (CA4_5_7I2R12Raw a) (CA4_5_7I2R12P a) = true := by + decide +kernel +lemma CA4_5_7I2R12P_sound (a : PairSlot) : + (CA4_5_7I2R12P a).Encloses (CA4_5_7I2R12Value a) := + contains_sound (CA4_5_7I2R12Raw_sound a) (CA4_5_7I2R12P_check a) +def CA4_5_7I2R12Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA4_5_7I2R12Certificates (CA4_5_7I2R12CertificateIndex a)).output +lemma CA4_5_7I2R12Terms_sound (a : PairSlot) : + (CA4_5_7I2R12Terms a).Encloses (Foundation.entropyTerm (CA4_5_7I2R12Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA4_5_7I2R12Certificates_valid + (CA4_5_7I2R12CertificateIndex a) (CA4_5_7I2R12P_sound a) +def CA4_5_7I2R12Entropy : Ball := ⟨0, 0⟩ +lemma CA4_5_7I2R12Entropy_sound : CA4_5_7I2R12Entropy.Encloses (Foundation.finiteEntropy CA4_5_7I2R12Value) := by + exact contains_sound (entropyPair_enclosed CA4_5_7I2R12Value CA4_5_7I2R12Terms CA4_5_7I2R12Terms_sound) (by decide +kernel) +def CA4_5_7I2R12Mass : Ball := ⟨0, 0⟩ +lemma CA4_5_7I2R12Mass_sound : CA4_5_7I2R12Mass.Encloses (∑ a, CA4_5_7I2R12Value a) := by + exact contains_sound (pairSumBall_sound CA4_5_7I2R12P CA4_5_7I2R12Value CA4_5_7I2R12P_sound) (by decide +kernel) +def CA4_5_7I2R12MassTerm : Ball := .exact 0 +lemma CA4_5_7I2R12MassTerm_sound : CA4_5_7I2R12MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA4_5_7I2R12Value a))) := + entropyTerm_zero_ball (CA4_5_7I2R12Mass_sound) +def CA4_5_7I2R12H : Ball := ⟨0, 0⟩ +lemma CA4_5_7I2R12H_sound : CA4_5_7I2R12H.Encloses (homogeneousEntropy CA4_5_7I2R12Value) := by + exact contains_sound (homogeneous_enclosed CA4_5_7I2R12Value CA4_5_7I2R12MassTerm_sound CA4_5_7I2R12Entropy_sound) (by decide +kernel) +def CA4_5_7I2R13Value (a : PairSlot) : ℝ := residualLaw (below (shape 4 5 7)) (fun u => (stageALaw (shape 4 5 7) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 13 a +def CA4_5_7I2R13Raw (a : PairSlot) : Ball := residualBall (below (shape 4 5 7)) A4_5_7Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 13 a +lemma CA4_5_7I2R13Raw_sound (a : PairSlot) : + (CA4_5_7I2R13Raw a).Encloses (CA4_5_7I2R13Value a) := by + exact residualBall_sound_on (below (shape 4 5 7)) A4_5_7Law (fun u => (stageALaw (shape 4 5 7) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A4_5_7Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 4 5 7) (show (shape 4 5 7) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 13 a +def CA4_5_7I2R13Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA4_5_7I2R13Certificates_valid : + CA4_5_7I2R13Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA4_5_7I2R13CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA4_5_7I2R13P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA4_5_7I2R13Certificates (CA4_5_7I2R13CertificateIndex a)).input +lemma CA4_5_7I2R13P_check : ∀ a : PairSlot, contains (CA4_5_7I2R13Raw a) (CA4_5_7I2R13P a) = true := by + decide +kernel +lemma CA4_5_7I2R13P_sound (a : PairSlot) : + (CA4_5_7I2R13P a).Encloses (CA4_5_7I2R13Value a) := + contains_sound (CA4_5_7I2R13Raw_sound a) (CA4_5_7I2R13P_check a) +def CA4_5_7I2R13Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA4_5_7I2R13Certificates (CA4_5_7I2R13CertificateIndex a)).output +lemma CA4_5_7I2R13Terms_sound (a : PairSlot) : + (CA4_5_7I2R13Terms a).Encloses (Foundation.entropyTerm (CA4_5_7I2R13Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA4_5_7I2R13Certificates_valid + (CA4_5_7I2R13CertificateIndex a) (CA4_5_7I2R13P_sound a) +def CA4_5_7I2R13Entropy : Ball := ⟨0, 0⟩ +lemma CA4_5_7I2R13Entropy_sound : CA4_5_7I2R13Entropy.Encloses (Foundation.finiteEntropy CA4_5_7I2R13Value) := by + exact contains_sound (entropyPair_enclosed CA4_5_7I2R13Value CA4_5_7I2R13Terms CA4_5_7I2R13Terms_sound) (by decide +kernel) +def CA4_5_7I2R13Mass : Ball := ⟨0, 0⟩ +lemma CA4_5_7I2R13Mass_sound : CA4_5_7I2R13Mass.Encloses (∑ a, CA4_5_7I2R13Value a) := by + exact contains_sound (pairSumBall_sound CA4_5_7I2R13P CA4_5_7I2R13Value CA4_5_7I2R13P_sound) (by decide +kernel) +def CA4_5_7I2R13MassTerm : Ball := .exact 0 +lemma CA4_5_7I2R13MassTerm_sound : CA4_5_7I2R13MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA4_5_7I2R13Value a))) := + entropyTerm_zero_ball (CA4_5_7I2R13Mass_sound) +def CA4_5_7I2R13H : Ball := ⟨0, 0⟩ +lemma CA4_5_7I2R13H_sound : CA4_5_7I2R13H.Encloses (homogeneousEntropy CA4_5_7I2R13Value) := by + exact contains_sound (homogeneous_enclosed CA4_5_7I2R13Value CA4_5_7I2R13MassTerm_sound CA4_5_7I2R13Entropy_sound) (by decide +kernel) +def CA4_5_7I2R14Value (a : PairSlot) : ℝ := residualLaw (below (shape 4 5 7)) (fun u => (stageALaw (shape 4 5 7) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 14 a +def CA4_5_7I2R14Raw (a : PairSlot) : Ball := residualBall (below (shape 4 5 7)) A4_5_7Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 14 a +lemma CA4_5_7I2R14Raw_sound (a : PairSlot) : + (CA4_5_7I2R14Raw a).Encloses (CA4_5_7I2R14Value a) := by + exact residualBall_sound_on (below (shape 4 5 7)) A4_5_7Law (fun u => (stageALaw (shape 4 5 7) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A4_5_7Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 4 5 7) (show (shape 4 5 7) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 14 a +def CA4_5_7I2R14Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA4_5_7I2R14Certificates_valid : + CA4_5_7I2R14Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA4_5_7I2R14CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA4_5_7I2R14P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA4_5_7I2R14Certificates (CA4_5_7I2R14CertificateIndex a)).input +lemma CA4_5_7I2R14P_check : ∀ a : PairSlot, contains (CA4_5_7I2R14Raw a) (CA4_5_7I2R14P a) = true := by + decide +kernel +lemma CA4_5_7I2R14P_sound (a : PairSlot) : + (CA4_5_7I2R14P a).Encloses (CA4_5_7I2R14Value a) := + contains_sound (CA4_5_7I2R14Raw_sound a) (CA4_5_7I2R14P_check a) +def CA4_5_7I2R14Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA4_5_7I2R14Certificates (CA4_5_7I2R14CertificateIndex a)).output +lemma CA4_5_7I2R14Terms_sound (a : PairSlot) : + (CA4_5_7I2R14Terms a).Encloses (Foundation.entropyTerm (CA4_5_7I2R14Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA4_5_7I2R14Certificates_valid + (CA4_5_7I2R14CertificateIndex a) (CA4_5_7I2R14P_sound a) +def CA4_5_7I2R14Entropy : Ball := ⟨0, 0⟩ +lemma CA4_5_7I2R14Entropy_sound : CA4_5_7I2R14Entropy.Encloses (Foundation.finiteEntropy CA4_5_7I2R14Value) := by + exact contains_sound (entropyPair_enclosed CA4_5_7I2R14Value CA4_5_7I2R14Terms CA4_5_7I2R14Terms_sound) (by decide +kernel) +def CA4_5_7I2R14Mass : Ball := ⟨0, 0⟩ +lemma CA4_5_7I2R14Mass_sound : CA4_5_7I2R14Mass.Encloses (∑ a, CA4_5_7I2R14Value a) := by + exact contains_sound (pairSumBall_sound CA4_5_7I2R14P CA4_5_7I2R14Value CA4_5_7I2R14P_sound) (by decide +kernel) +def CA4_5_7I2R14MassTerm : Ball := .exact 0 +lemma CA4_5_7I2R14MassTerm_sound : CA4_5_7I2R14MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA4_5_7I2R14Value a))) := + entropyTerm_zero_ball (CA4_5_7I2R14Mass_sound) +def CA4_5_7I2R14H : Ball := ⟨0, 0⟩ +lemma CA4_5_7I2R14H_sound : CA4_5_7I2R14H.Encloses (homogeneousEntropy CA4_5_7I2R14Value) := by + exact contains_sound (homogeneous_enclosed CA4_5_7I2R14Value CA4_5_7I2R14MassTerm_sound CA4_5_7I2R14Entropy_sound) (by decide +kernel) +def CA4_5_7I2R15Value (a : PairSlot) : ℝ := residualLaw (below (shape 4 5 7)) (fun u => (stageALaw (shape 4 5 7) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 15 a +def CA4_5_7I2R15Raw (a : PairSlot) : Ball := residualBall (below (shape 4 5 7)) A4_5_7Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 15 a +lemma CA4_5_7I2R15Raw_sound (a : PairSlot) : + (CA4_5_7I2R15Raw a).Encloses (CA4_5_7I2R15Value a) := by + exact residualBall_sound_on (below (shape 4 5 7)) A4_5_7Law (fun u => (stageALaw (shape 4 5 7) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A4_5_7Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 4 5 7) (show (shape 4 5 7) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 15 a +def CA4_5_7I2R15Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA4_5_7I2R15Certificates_valid : + CA4_5_7I2R15Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA4_5_7I2R15CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA4_5_7I2R15P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA4_5_7I2R15Certificates (CA4_5_7I2R15CertificateIndex a)).input +lemma CA4_5_7I2R15P_check : ∀ a : PairSlot, contains (CA4_5_7I2R15Raw a) (CA4_5_7I2R15P a) = true := by + decide +kernel +lemma CA4_5_7I2R15P_sound (a : PairSlot) : + (CA4_5_7I2R15P a).Encloses (CA4_5_7I2R15Value a) := + contains_sound (CA4_5_7I2R15Raw_sound a) (CA4_5_7I2R15P_check a) +def CA4_5_7I2R15Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA4_5_7I2R15Certificates (CA4_5_7I2R15CertificateIndex a)).output +lemma CA4_5_7I2R15Terms_sound (a : PairSlot) : + (CA4_5_7I2R15Terms a).Encloses (Foundation.entropyTerm (CA4_5_7I2R15Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA4_5_7I2R15Certificates_valid + (CA4_5_7I2R15CertificateIndex a) (CA4_5_7I2R15P_sound a) +def CA4_5_7I2R15Entropy : Ball := ⟨0, 0⟩ +lemma CA4_5_7I2R15Entropy_sound : CA4_5_7I2R15Entropy.Encloses (Foundation.finiteEntropy CA4_5_7I2R15Value) := by + exact contains_sound (entropyPair_enclosed CA4_5_7I2R15Value CA4_5_7I2R15Terms CA4_5_7I2R15Terms_sound) (by decide +kernel) +def CA4_5_7I2R15Mass : Ball := ⟨0, 0⟩ +lemma CA4_5_7I2R15Mass_sound : CA4_5_7I2R15Mass.Encloses (∑ a, CA4_5_7I2R15Value a) := by + exact contains_sound (pairSumBall_sound CA4_5_7I2R15P CA4_5_7I2R15Value CA4_5_7I2R15P_sound) (by decide +kernel) +def CA4_5_7I2R15MassTerm : Ball := .exact 0 +lemma CA4_5_7I2R15MassTerm_sound : CA4_5_7I2R15MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA4_5_7I2R15Value a))) := + entropyTerm_zero_ball (CA4_5_7I2R15Mass_sound) +def CA4_5_7I2R15H : Ball := ⟨0, 0⟩ +lemma CA4_5_7I2R15H_sound : CA4_5_7I2R15H.Encloses (homogeneousEntropy CA4_5_7I2R15Value) := by + exact contains_sound (homogeneous_enclosed CA4_5_7I2R15Value CA4_5_7I2R15MassTerm_sound CA4_5_7I2R15Entropy_sound) (by decide +kernel) +def CA4_5_7I2R16Value (a : PairSlot) : ℝ := residualLaw (below (shape 4 5 7)) (fun u => (stageALaw (shape 4 5 7) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 16 a +def CA4_5_7I2R16Raw (a : PairSlot) : Ball := residualBall (below (shape 4 5 7)) A4_5_7Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 16 a +lemma CA4_5_7I2R16Raw_sound (a : PairSlot) : + (CA4_5_7I2R16Raw a).Encloses (CA4_5_7I2R16Value a) := by + exact residualBall_sound_on (below (shape 4 5 7)) A4_5_7Law (fun u => (stageALaw (shape 4 5 7) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A4_5_7Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 4 5 7) (show (shape 4 5 7) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 16 a +def CA4_5_7I2R16Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA4_5_7I2R16Certificates_valid : + CA4_5_7I2R16Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA4_5_7I2R16CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA4_5_7I2R16P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA4_5_7I2R16Certificates (CA4_5_7I2R16CertificateIndex a)).input +lemma CA4_5_7I2R16P_check : ∀ a : PairSlot, contains (CA4_5_7I2R16Raw a) (CA4_5_7I2R16P a) = true := by + decide +kernel +lemma CA4_5_7I2R16P_sound (a : PairSlot) : + (CA4_5_7I2R16P a).Encloses (CA4_5_7I2R16Value a) := + contains_sound (CA4_5_7I2R16Raw_sound a) (CA4_5_7I2R16P_check a) +def CA4_5_7I2R16Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA4_5_7I2R16Certificates (CA4_5_7I2R16CertificateIndex a)).output +lemma CA4_5_7I2R16Terms_sound (a : PairSlot) : + (CA4_5_7I2R16Terms a).Encloses (Foundation.entropyTerm (CA4_5_7I2R16Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA4_5_7I2R16Certificates_valid + (CA4_5_7I2R16CertificateIndex a) (CA4_5_7I2R16P_sound a) +def CA4_5_7I2R16Entropy : Ball := ⟨0, 0⟩ +lemma CA4_5_7I2R16Entropy_sound : CA4_5_7I2R16Entropy.Encloses (Foundation.finiteEntropy CA4_5_7I2R16Value) := by + exact contains_sound (entropyPair_enclosed CA4_5_7I2R16Value CA4_5_7I2R16Terms CA4_5_7I2R16Terms_sound) (by decide +kernel) +def CA4_5_7I2R16Mass : Ball := ⟨0, 0⟩ +lemma CA4_5_7I2R16Mass_sound : CA4_5_7I2R16Mass.Encloses (∑ a, CA4_5_7I2R16Value a) := by + exact contains_sound (pairSumBall_sound CA4_5_7I2R16P CA4_5_7I2R16Value CA4_5_7I2R16P_sound) (by decide +kernel) +def CA4_5_7I2R16MassTerm : Ball := .exact 0 +lemma CA4_5_7I2R16MassTerm_sound : CA4_5_7I2R16MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA4_5_7I2R16Value a))) := + entropyTerm_zero_ball (CA4_5_7I2R16Mass_sound) +def CA4_5_7I2R16H : Ball := ⟨0, 0⟩ +lemma CA4_5_7I2R16H_sound : CA4_5_7I2R16H.Encloses (homogeneousEntropy CA4_5_7I2R16Value) := by + exact contains_sound (homogeneous_enclosed CA4_5_7I2R16Value CA4_5_7I2R16MassTerm_sound CA4_5_7I2R16Entropy_sound) (by decide +kernel) +def CA4_5_7I2ResidualEntropies (a : Fin 17) : Ball := + match a.val with + | 0 => CA4_5_7I2R0H + | 1 => CA4_5_7I2R1H + | 2 => CA4_5_7I2R2H + | 3 => CA4_5_7I2R3H + | 4 => CA4_5_7I2R4H + | 5 => CA4_5_7I2R5H + | 6 => CA4_5_7I2R6H + | 7 => CA4_5_7I2R7H + | 8 => CA4_5_7I2R8H + | 9 => CA4_5_7I2R9H + | 10 => CA4_5_7I2R10H + | 11 => CA4_5_7I2R11H + | 12 => CA4_5_7I2R12H + | 13 => CA4_5_7I2R13H + | 14 => CA4_5_7I2R14H + | 15 => CA4_5_7I2R15H + | 16 => CA4_5_7I2R16H + | _ => (.exact 0) +lemma CA4_5_7I2ResidualEntropies_sound (k : Fin 17) : + (CA4_5_7I2ResidualEntropies k).Encloses (homogeneousEntropy + (residualLaw (below (shape 4 5 7)) (fun u => (stageALaw (shape 4 5 7) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) k)) := by + fin_cases k + · exact CA4_5_7I2R0H_sound + · exact CA4_5_7I2R1H_sound + · exact CA4_5_7I2R2H_sound + · exact CA4_5_7I2R3H_sound + · exact CA4_5_7I2R4H_sound + · exact CA4_5_7I2R5H_sound + · exact CA4_5_7I2R6H_sound + · exact CA4_5_7I2R7H_sound + · exact CA4_5_7I2R8H_sound + · exact CA4_5_7I2R9H_sound + · exact CA4_5_7I2R10H_sound + · exact CA4_5_7I2R11H_sound + · exact CA4_5_7I2R12H_sound + · exact CA4_5_7I2R13H_sound + · exact CA4_5_7I2R14H_sound + · exact CA4_5_7I2R15H_sound + · exact CA4_5_7I2R16H_sound +def CA4_5_7I2Singles (s : Shape) : Ball := + match s 0, s 1, s 2 with + | 0, 1, 7 => Z0_1_7H2H + | 0, 2, 6 => Z0_2_6H2H + | 0, 3, 5 => Z0_3_5H2H + | 0, 4, 4 => Z0_4_4H2H + | 0, 5, 3 => Z0_5_3H2H + | 1, 0, 7 => Z1_0_7H2H + | 2, 0, 6 => Z2_0_6H2H + | 3, 0, 5 => Z3_0_5H2H + | 4, 0, 4 => Z4_0_4H2H + | _, _, _ => (.exact 0) +lemma CA4_5_7I2Singles_sound (u : Shape) (hu : u ∈ below (shape 4 5 7)) + (hd : designated (Equiv.refl (Fin 3)) 2 u) : + (CA4_5_7I2Singles u).Encloses (homogeneousEntropy ((fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) u)) := by + rw [A4_5_7_below] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl + · exact Z0_1_7H2H_sound + · exact Z0_2_6H2H_sound + · exact Z0_3_5H2H_sound + · exact Z0_4_4H2H_sound + · exact Z0_5_3H2H_sound + · exact Z1_0_7H2H_sound + · exact (show ¬ designated (Equiv.refl (Fin 3)) 2 (shape 1 1 6) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 2 (shape 1 2 5) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 2 (shape 1 3 4) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 2 (shape 1 4 3) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 2 (shape 1 5 2) by decide +kernel) hd |>.elim + · exact Z2_0_6H2H_sound + · exact (show ¬ designated (Equiv.refl (Fin 3)) 2 (shape 2 1 5) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 2 (shape 2 2 4) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 2 (shape 2 3 3) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 2 (shape 2 4 2) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 2 (shape 2 5 1) by decide +kernel) hd |>.elim + · exact Z3_0_5H2H_sound + · exact (show ¬ designated (Equiv.refl (Fin 3)) 2 (shape 3 1 4) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 2 (shape 3 2 3) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 2 (shape 3 3 2) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 2 (shape 3 4 1) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 2 (shape 3 5 0) by decide +kernel) hd |>.elim + · exact Z4_0_4H2H_sound + · exact (show ¬ designated (Equiv.refl (Fin 3)) 2 (shape 4 1 3) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 2 (shape 4 2 2) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 2 (shape 4 3 1) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 2 (shape 4 4 0) by decide +kernel) hd |>.elim +def CA4_5_7I2Singleton : Ball := ⟨(1736985044719429942832526678359 / 50000000000000000000000000000000), (714924641 / 25000000000000000000000000000000)⟩ +lemma CA4_5_7I2Singleton_sound : CA4_5_7I2Singleton.Encloses + (singletonEntropy (below (shape 4 5 7)) (fun u => (stageALaw (shape 4 5 7) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ))) := by + exact contains_sound (singletonBall_sound (below (shape 4 5 7)) A4_5_7Law (fun u => (stageALaw (shape 4 5 7) u : ℝ)) (Equiv.refl (Fin 3)) 2 + CA4_5_7I2Singles (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A4_5_7Law_sound u) CA4_5_7I2Singles_sound) (by decide +kernel) +def CA4_5_7I2Group : Ball := ⟨(2913317092543671156102318588643 / 3125000000000000000000000000000), (80897273129 / 50000000000000000000000000000000)⟩ +lemma CA4_5_7I2Group_sound : CA4_5_7I2Group.Encloses + (groupedEntropy (below (shape 4 5 7)) (fun u => (stageALaw (shape 4 5 7) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ))) := by + exact contains_sound (Ball.add_sound CA4_5_7I2Singleton_sound + (finSumBall_sound 17 CA4_5_7I2ResidualEntropies _ CA4_5_7I2ResidualEntropies_sound)) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CA4_5_7I2H : Ball := ⟨(13279825312184419225649811606321 / 12500000000000000000000000000000), (461940268267 / 100000000000000000000000000000000)⟩ +lemma CA4_5_7I2_sound : CA4_5_7I2H.Encloses (stageACapacity (shape 4 5 7) 2) := by + have hb := contains_sound (Ball.add_sound CA4_5_7I2PairH_sound + (Ball.neg_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) CA4_5_7I2Group_sound))) + (show contains (.add CA4_5_7I2PairH (.neg (.mul (.exact 2) CA4_5_7I2Group))) CA4_5_7I2H = true by decide +kernel) + unfold CA4_5_7I2PairValue at hb + simpa only [stageACapacity, nativeCapacity, + show (2 : Fin 3) ≠ 0 by decide, ite_false, sub_eq_add_neg] using hb + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA4_5_7I2Pair.lean b/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA4_5_7I2Pair.lean new file mode 100644 index 0000000000000000000000000000000000000000..8ea14bbb62c4e05a94e36217920f7327e5dadd4b --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA4_5_7I2Pair.lean @@ -0,0 +1,355 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Certificates.SupportedContraction + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CA4_5_7I2PairValue (a : PairSlot × PairSlot) : ℝ := pairLaw (below (shape 4 5 7)) (shape 4 5 7) (fun u => (stageALaw (shape 4 5 7) u : ℝ)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) a +def CA4_5_7I2PairRaw (a : PairSlot × PairSlot) : Ball := stageAPairBall (shape 4 5 7) A4_5_7Law 2 a +lemma CA4_5_7I2PairRaw_sound (a : PairSlot × PairSlot) : + (CA4_5_7I2PairRaw a).Encloses (CA4_5_7I2PairValue a) := by + exact stageAPairBall_sound (shape 4 5 7) (by decide +kernel) A4_5_7Law (fun u => (stageALaw (shape 4 5 7) u : ℝ)) (fun u _ => A4_5_7Law_sound u) 2 a +def CA4_5_7I2PairCertificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(244308754727999724283630797 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(631403660030476232252427073 / 20000000000000000000000000000000), (517351 / 50000000000000000000000000000000)⟩ ⟨(-1292224793035859955651182350681129 / 100000000000000000000000000000000), (423516882977 / 100000000000000000000000000000000)⟩ ⟨-19, 244308754727999724283630797, 190734863281250000000000000⟩, + .log ⟨(6240297449315846932943528441 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(15104480248737473833865823309 / 25000000000000000000000000000000), (19821527 / 100000000000000000000000000000000)⟩ ⟨(-193637952311307837686740701390711 / 20000000000000000000000000000000), (317637371269 / 100000000000000000000000000000000)⟩ ⟨-14, 6240297449315846932943528441, 6103515625000000000000000000⟩, + .log ⟨(481558755099559397470488577 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(2948019026689072314246915699 / 50000000000000000000000000000000), (24219 / 1250000000000000000000000000000)⟩ ⟨(-612182624751487901331024970365541 / 50000000000000000000000000000000), (80468171527 / 20000000000000000000000000000000)⟩ ⟨-18, 481558755099559397470488577, 381469726562500000000000000⟩, + .log ⟨(12341430878446354357947554097 / 25000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ ⟨(375854285572305196849223614759 / 100000000000000000000000000000000), (125443201 / 100000000000000000000000000000000)⟩ ⟨(-761366913760207706871430250321343 / 100000000000000000000000000000000), (254109888247 / 100000000000000000000000000000000)⟩ ⟨-11, 12341430878446354357947554097, 12207031250000000000000000000⟩, + .log ⟨(1255602034323317502391391867 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(49716898196528641871069813209 / 100000000000000000000000000000000), (17016593 / 100000000000000000000000000000000)⟩ ⟨(-197980318753316631831272656124019 / 20000000000000000000000000000000), (169406599419 / 50000000000000000000000000000000)⟩ ⟨-15, 1255602034323317502391391867, 762939453125000000000000000⟩, + .log ⟨(19960961801890083194980107 / 4000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(6092098747557429746210164211 / 100000000000000000000000000000000), (200779 / 10000000000000000000000000000000)⟩ ⟨(-610401323144716914860829859490321 / 50000000000000000000000000000000), (6286575787 / 1562500000000000000000000000000)⟩ ⟨-18, 19960961801890083194980107, 15258789062500000000000000⟩, + .log ⟨(1887374343057418699016539439 / 10000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(8092262583293746169190319243 / 5000000000000000000000000000000), (55953399 / 100000000000000000000000000000000)⟩ ⟨(-428757687263292371842438145422769 / 50000000000000000000000000000000), (14823076843 / 5000000000000000000000000000000)⟩ ⟨-13, 1887374343057418699016539439, 1220703125000000000000000000⟩, + .log ⟨(448376595533775546671192087393 / 100000000000000000000000000000000), (1 / 20000000000000000000000000000000)⟩ ⟨(606125791213555522686160342691 / 25000000000000000000000000000000), (106815871 / 12500000000000000000000000000000)⟩ ⟨(-270364598532171584815181539620291 / 50000000000000000000000000000000), (190582414261 / 100000000000000000000000000000000)⟩ ⟨-8, 448376595533775546671192087393, 390625000000000000000000000000⟩, + .log ⟨(32558346155248311994033429677 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(261439994172576248113101690527 / 100000000000000000000000000000000), (89628483 / 100000000000000000000000000000000)⟩ ⟨(-401494585944183272180879550299141 / 50000000000000000000000000000000), (5505714219 / 2000000000000000000000000000000)⟩ ⟨-12, 32558346155248311994033429677, 24414062500000000000000000000⟩, + .log ⟨(410469128717337197494586283691 / 25000000000000000000000000000000), (3 / 25000000000000000000000000000000)⟩ ⟨(6747013045855879704857614481737 / 100000000000000000000000000000000), (2433766193 / 100000000000000000000000000000000)⟩ ⟨(-410933038188488169686112073523913 / 100000000000000000000000000000000), (148230766511 / 100000000000000000000000000000000)⟩ ⟨-6, 410469128717337197494586283691, 390625000000000000000000000000⟩, + .log ⟨(1684220075619647875778371 / 8000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(178230362692888675728631848619 / 100000000000000000000000000000000), (31206659 / 50000000000000000000000000000000)⟩ ⟨(-42329471135727973922515459299983 / 5000000000000000000000000000000), (296461536311 / 100000000000000000000000000000000)⟩ ⟨-13, 1684220075619647875778371, 976562500000000000000000⟩, + .log ⟨(832804350269015182943804557 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(4581562712491931297793836039 / 25000000000000000000000000000000), (5996021 / 100000000000000000000000000000000)⟩ ⟨(-550136741121966994675699286845813 / 50000000000000000000000000000000), (44998632831 / 12500000000000000000000000000000)⟩ ⟨-16, 832804350269015182943804557, 762939453125000000000000000⟩, + .log ⟨(77585648267582854098018538911 / 100000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ ⟨(277816478121351496258994797383 / 50000000000000000000000000000000), (98576409 / 50000000000000000000000000000000)⟩ ⟨(-17903857499727168511291728366183 / 2500000000000000000000000000000), (254109886773 / 100000000000000000000000000000000)⟩ ⟨-11, 77585648267582854098018538911, 48828125000000000000000000000⟩, + .log ⟨(33301771431857496433935907 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(2215505618030011927831087657 / 100000000000000000000000000000000), (740467 / 100000000000000000000000000000000)⟩ ⟨(-1330563223979485529516577889564779 / 100000000000000000000000000000000), (444692897911 / 100000000000000000000000000000000)⟩ ⟨-20, 33301771431857496433935907, 19073486328125000000000000⟩, + .log ⟨(5669095443215932125346232257 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(55431825055678133538704021533 / 100000000000000000000000000000000), (9603827 / 50000000000000000000000000000000)⟩ ⟨(-977789589378179246451355287866067 / 100000000000000000000000000000000), (338813196567 / 100000000000000000000000000000000)⟩ ⟨-15, 5669095443215932125346232257, 3051757812500000000000000000⟩, + .log ⟨(8950644906062608979755233 / 2500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(4489670588724214358851156849 / 100000000000000000000000000000000), (1516313 / 100000000000000000000000000000000)⟩ ⟨(-250801514072086098296217830251099 / 20000000000000000000000000000000), (423516752969 / 100000000000000000000000000000000)⟩ ⟨-19, 8950644906062608979755233, 4768371582031250000000000⟩, + .log ⟨(22357651077199841649710268871 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(10777239774071948771362877419 / 3125000000000000000000000000000), (24618969 / 20000000000000000000000000000000)⟩ ⟨(-192815242296405527379067079434681 / 25000000000000000000000000000000), (55057142023 / 20000000000000000000000000000000)⟩ ⟨-12, 22357651077199841649710268871, 12207031250000000000000000000⟩, + .log ⟨(1568166907374189999232255620981 / 100000000000000000000000000000000), (1 / 10000000000000000000000000000000)⟩ ⟨(6516145651561350022317675276339 / 100000000000000000000000000000000), (581126467 / 25000000000000000000000000000000)⟩ ⟨(-207763141184769697142616576498829 / 50000000000000000000000000000000), (74115383209 / 50000000000000000000000000000000)⟩ ⟨-6, 1568166907374189999232255620981, 1562500000000000000000000000000⟩, + .log ⟨(41783409606579625098817874727 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(592261356474006473103282606251 / 100000000000000000000000000000000), (53087889 / 25000000000000000000000000000000)⟩ ⟨(-70872789230290961766642458355741 / 10000000000000000000000000000000), (15881867837 / 6250000000000000000000000000000)⟩ ⟨-11, 41783409606579625098817874727, 24414062500000000000000000000⟩, + .log ⟨(28081250597547149688346248801 / 6250000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ ⟨(121428598493274595927652426279 / 5000000000000000000000000000000), (856286827 / 100000000000000000000000000000000)⟩ ⟨(-540523462761489249166389938857843 / 100000000000000000000000000000000), (190582414037 / 100000000000000000000000000000000)⟩ ⟨-8, 28081250597547149688346248801, 24414062500000000000000000000⟩, + .log ⟨(7911317241855725128353099123733 / 50000000000000000000000000000000), (1 / 1562500000000000000000000000000)⟩ ⟨(29172645446995093192811483949213 / 100000000000000000000000000000000), (1675286613 / 12500000000000000000000000000000)⟩ ⟨(-184372870883333366385870150481859 / 100000000000000000000000000000000), (2646977973 / 3125000000000000000000000000000)⟩ ⟨-3, 7911317241855725128353099123733, 6250000000000000000000000000000⟩, + .log ⟨(407908615984863558554711237609 / 50000000000000000000000000000000), (1 / 20000000000000000000000000000000)⟩ ⟨(196152448561069379598333516273 / 5000000000000000000000000000000), (1382048179 / 100000000000000000000000000000000)⟩ ⟨(-240436755776136993081478451421209 / 50000000000000000000000000000000), (42351647519 / 25000000000000000000000000000000)⟩ ⟨-7, 407908615984863558554711237609, 390625000000000000000000000000⟩, + .log ⟨(10838369213330020259531305151 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(178593583986227428318627737 / 97656250000000000000000000000), (64263201 / 100000000000000000000000000000000)⟩ ⟨(-843668574129097313315640161745899 / 100000000000000000000000000000000), (11858461447 / 4000000000000000000000000000000)⟩ ⟨-13, 10838369213330020259531305151, 6103515625000000000000000000⟩, + .log ⟨(75939789920628151088676106721 / 10000000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ ⟨(741233038208930406772718451399 / 20000000000000000000000000000000), (723639433 / 50000000000000000000000000000000)⟩ ⟨(-488039958356260323816774075426233 / 100000000000000000000000000000000), (95291206837 / 50000000000000000000000000000000)⟩ ⟨-8, 75939789920628151088676106721, 39062500000000000000000000000⟩, + .log ⟨(41038192110414766501524724787 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(16001657660094968803034851791 / 5000000000000000000000000000000), (112972287 / 100000000000000000000000000000000)⟩ ⟨(-779842231696850574831220727170911 / 100000000000000000000000000000000), (55057142063 / 20000000000000000000000000000000)⟩ ⟨-12, 41038192110414766501524724787, 24414062500000000000000000000⟩, + .log ⟨(569380623526455575039132179 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(3240625382973149266205834759 / 25000000000000000000000000000000), (434057 / 10000000000000000000000000000000)⟩ ⟨(-284574610469035180205419069669497 / 25000000000000000000000000000000), (95291228527 / 25000000000000000000000000000000)⟩ ⟨-17, 569380623526455575039132179, 381469726562500000000000000⟩, + .log ⟨(9954988712332686778699684149 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(62346559645904087409857995761 / 20000000000000000000000000000000), (54809327 / 50000000000000000000000000000000)⟩ ⟨(-97856966252549543514052632879859 / 12500000000000000000000000000000), (27528571039 / 10000000000000000000000000000000)⟩ ⟨-12, 9954988712332686778699684149, 6103515625000000000000000000⟩, + .log ⟨(407892643818508736046563087 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(2753336228757410637361618253 / 12500000000000000000000000000000), (229433 / 3125000000000000000000000000000)⟩ ⟨(-108002388196341339613689226896351 / 10000000000000000000000000000000), (359989051643 / 100000000000000000000000000000000)⟩ ⟨-16, 407892643818508736046563087, 305175781250000000000000000⟩] +lemma CA4_5_7I2PairCertificates_valid : + CA4_5_7I2PairCertificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA4_5_7I2PairCertificateIndex (a : PairSlot × PairSlot) : ℕ := + match a.1.1.val, a.1.2.val, a.2.1.val, a.2.2.val with + | 4, 5, 0, 0 => 1 + | 5, 4, 0, 0 => 1 + | 2, 5, 1, 0 => 2 + | 2, 5, 0, 1 => 2 + | 3, 5, 1, 0 => 3 + | 3, 5, 0, 1 => 3 + | 4, 4, 1, 0 => 4 + | 4, 4, 0, 1 => 4 + | 5, 2, 1, 0 => 2 + | 5, 2, 0, 1 => 2 + | 5, 3, 1, 0 => 3 + | 5, 3, 0, 1 => 3 + | 1, 5, 2, 0 => 5 + | 1, 5, 3, 0 => 6 + | 1, 5, 1, 1 => 7 + | 1, 5, 0, 2 => 5 + | 1, 5, 0, 3 => 6 + | 2, 4, 2, 0 => 8 + | 2, 4, 3, 0 => 9 + | 2, 4, 1, 1 => 10 + | 2, 4, 0, 2 => 8 + | 2, 4, 0, 3 => 9 + | 3, 4, 2, 0 => 11 + | 3, 4, 3, 0 => 12 + | 3, 4, 1, 1 => 13 + | 3, 4, 0, 2 => 11 + | 3, 4, 0, 3 => 12 + | 4, 2, 2, 0 => 8 + | 4, 2, 3, 0 => 9 + | 4, 2, 1, 1 => 10 + | 4, 2, 0, 2 => 8 + | 4, 2, 0, 3 => 9 + | 4, 3, 2, 0 => 11 + | 4, 3, 3, 0 => 12 + | 4, 3, 1, 1 => 13 + | 4, 3, 0, 2 => 11 + | 4, 3, 0, 3 => 12 + | 5, 1, 2, 0 => 5 + | 5, 1, 3, 0 => 6 + | 5, 1, 1, 1 => 7 + | 5, 1, 0, 2 => 5 + | 5, 1, 0, 3 => 6 + | 5, 0, 4, 0 => 14 + | 5, 0, 2, 1 => 15 + | 5, 0, 3, 1 => 16 + | 5, 0, 1, 2 => 15 + | 5, 0, 1, 3 => 16 + | 5, 0, 0, 4 => 14 + | 4, 1, 4, 0 => 17 + | 4, 1, 2, 1 => 18 + | 4, 1, 3, 1 => 19 + | 4, 1, 1, 2 => 18 + | 4, 1, 1, 3 => 19 + | 4, 1, 0, 4 => 17 + | 2, 2, 4, 0 => 20 + | 2, 2, 2, 1 => 21 + | 2, 2, 3, 1 => 22 + | 2, 2, 1, 2 => 21 + | 2, 2, 1, 3 => 22 + | 2, 2, 0, 4 => 20 + | 2, 3, 4, 0 => 23 + | 2, 3, 2, 1 => 24 + | 2, 3, 3, 1 => 25 + | 2, 3, 1, 2 => 24 + | 2, 3, 1, 3 => 25 + | 2, 3, 0, 4 => 23 + | 3, 2, 4, 0 => 23 + | 3, 2, 2, 1 => 24 + | 3, 2, 3, 1 => 25 + | 3, 2, 1, 2 => 24 + | 3, 2, 1, 3 => 25 + | 3, 2, 0, 4 => 23 + | 3, 3, 4, 0 => 26 + | 3, 3, 2, 1 => 27 + | 3, 3, 3, 1 => 28 + | 3, 3, 1, 2 => 27 + | 3, 3, 1, 3 => 28 + | 3, 3, 0, 4 => 26 + | 1, 4, 4, 0 => 17 + | 1, 4, 2, 1 => 18 + | 1, 4, 3, 1 => 19 + | 1, 4, 1, 2 => 18 + | 1, 4, 1, 3 => 19 + | 1, 4, 0, 4 => 17 + | 0, 5, 4, 0 => 14 + | 0, 5, 2, 1 => 15 + | 0, 5, 3, 1 => 16 + | 0, 5, 1, 2 => 15 + | 0, 5, 1, 3 => 16 + | 0, 5, 0, 4 => 14 + | 4, 0, 5, 0 => 14 + | 4, 0, 4, 1 => 17 + | 4, 0, 2, 2 => 20 + | 4, 0, 2, 3 => 23 + | 4, 0, 3, 2 => 23 + | 4, 0, 3, 3 => 26 + | 4, 0, 1, 4 => 17 + | 4, 0, 0, 5 => 14 + | 2, 1, 5, 0 => 15 + | 2, 1, 4, 1 => 18 + | 2, 1, 2, 2 => 21 + | 2, 1, 2, 3 => 24 + | 2, 1, 3, 2 => 24 + | 2, 1, 3, 3 => 27 + | 2, 1, 1, 4 => 18 + | 2, 1, 0, 5 => 15 + | 3, 1, 5, 0 => 16 + | 3, 1, 4, 1 => 19 + | 3, 1, 2, 2 => 22 + | 3, 1, 2, 3 => 25 + | 3, 1, 3, 2 => 25 + | 3, 1, 3, 3 => 28 + | 3, 1, 1, 4 => 19 + | 3, 1, 0, 5 => 16 + | 1, 2, 5, 0 => 15 + | 1, 2, 4, 1 => 18 + | 1, 2, 2, 2 => 21 + | 1, 2, 2, 3 => 24 + | 1, 2, 3, 2 => 24 + | 1, 2, 3, 3 => 27 + | 1, 2, 1, 4 => 18 + | 1, 2, 0, 5 => 15 + | 1, 3, 5, 0 => 16 + | 1, 3, 4, 1 => 19 + | 1, 3, 2, 2 => 22 + | 1, 3, 2, 3 => 25 + | 1, 3, 3, 2 => 25 + | 1, 3, 3, 3 => 28 + | 1, 3, 1, 4 => 19 + | 1, 3, 0, 5 => 16 + | 0, 4, 5, 0 => 14 + | 0, 4, 4, 1 => 17 + | 0, 4, 2, 2 => 20 + | 0, 4, 2, 3 => 23 + | 0, 4, 3, 2 => 23 + | 0, 4, 3, 3 => 26 + | 0, 4, 1, 4 => 17 + | 0, 4, 0, 5 => 14 + | 2, 0, 1, 5 => 5 + | 2, 0, 2, 4 => 8 + | 2, 0, 3, 4 => 11 + | 2, 0, 4, 2 => 8 + | 2, 0, 4, 3 => 11 + | 2, 0, 5, 1 => 5 + | 3, 0, 1, 5 => 6 + | 3, 0, 2, 4 => 9 + | 3, 0, 3, 4 => 12 + | 3, 0, 4, 2 => 9 + | 3, 0, 4, 3 => 12 + | 3, 0, 5, 1 => 6 + | 1, 1, 1, 5 => 7 + | 1, 1, 2, 4 => 10 + | 1, 1, 3, 4 => 13 + | 1, 1, 4, 2 => 10 + | 1, 1, 4, 3 => 13 + | 1, 1, 5, 1 => 7 + | 0, 2, 1, 5 => 5 + | 0, 2, 2, 4 => 8 + | 0, 2, 3, 4 => 11 + | 0, 2, 4, 2 => 8 + | 0, 2, 4, 3 => 11 + | 0, 2, 5, 1 => 5 + | 0, 3, 1, 5 => 6 + | 0, 3, 2, 4 => 9 + | 0, 3, 3, 4 => 12 + | 0, 3, 4, 2 => 9 + | 0, 3, 4, 3 => 12 + | 0, 3, 5, 1 => 6 + | 1, 0, 2, 5 => 2 + | 1, 0, 3, 5 => 3 + | 1, 0, 4, 4 => 4 + | 1, 0, 5, 2 => 2 + | 1, 0, 5, 3 => 3 + | 0, 1, 2, 5 => 2 + | 0, 1, 3, 5 => 3 + | 0, 1, 4, 4 => 4 + | 0, 1, 5, 2 => 2 + | 0, 1, 5, 3 => 3 + | 0, 0, 4, 5 => 1 + | 0, 0, 5, 4 => 1 + | _, _, _, _ => 0 +def CA4_5_7I2PairP (a : PairSlot × PairSlot) : Ball := + (CompactCertificate.entropyLookup CA4_5_7I2PairCertificates (CA4_5_7I2PairCertificateIndex a)).input +lemma CA4_5_7I2PairP_check_0_0 : ∀ k l : Fin 6, contains (CA4_5_7I2PairRaw ((0,0),(k,l))) (CA4_5_7I2PairP ((0,0),(k,l))) = true := by + decide +kernel +lemma CA4_5_7I2PairP_check_0_1 : ∀ k l : Fin 6, contains (CA4_5_7I2PairRaw ((0,1),(k,l))) (CA4_5_7I2PairP ((0,1),(k,l))) = true := by + decide +kernel +lemma CA4_5_7I2PairP_check_0_2 : ∀ k l : Fin 6, contains (CA4_5_7I2PairRaw ((0,2),(k,l))) (CA4_5_7I2PairP ((0,2),(k,l))) = true := by + decide +kernel +lemma CA4_5_7I2PairP_check_0_3 : ∀ k l : Fin 6, contains (CA4_5_7I2PairRaw ((0,3),(k,l))) (CA4_5_7I2PairP ((0,3),(k,l))) = true := by + decide +kernel +lemma CA4_5_7I2PairP_check_0_4 : ∀ k l : Fin 6, contains (CA4_5_7I2PairRaw ((0,4),(k,l))) (CA4_5_7I2PairP ((0,4),(k,l))) = true := by + decide +kernel +lemma CA4_5_7I2PairP_check_0_5 : ∀ k l : Fin 6, contains (CA4_5_7I2PairRaw ((0,5),(k,l))) (CA4_5_7I2PairP ((0,5),(k,l))) = true := by + decide +kernel +lemma CA4_5_7I2PairP_check_1_0 : ∀ k l : Fin 6, contains (CA4_5_7I2PairRaw ((1,0),(k,l))) (CA4_5_7I2PairP ((1,0),(k,l))) = true := by + decide +kernel +lemma CA4_5_7I2PairP_check_1_1 : ∀ k l : Fin 6, contains (CA4_5_7I2PairRaw ((1,1),(k,l))) (CA4_5_7I2PairP ((1,1),(k,l))) = true := by + decide +kernel +lemma CA4_5_7I2PairP_check_1_2 : ∀ k l : Fin 6, contains (CA4_5_7I2PairRaw ((1,2),(k,l))) (CA4_5_7I2PairP ((1,2),(k,l))) = true := by + decide +kernel +lemma CA4_5_7I2PairP_check_1_3 : ∀ k l : Fin 6, contains (CA4_5_7I2PairRaw ((1,3),(k,l))) (CA4_5_7I2PairP ((1,3),(k,l))) = true := by + decide +kernel +lemma CA4_5_7I2PairP_check_1_4 : ∀ k l : Fin 6, contains (CA4_5_7I2PairRaw ((1,4),(k,l))) (CA4_5_7I2PairP ((1,4),(k,l))) = true := by + decide +kernel +lemma CA4_5_7I2PairP_check_1_5 : ∀ k l : Fin 6, contains (CA4_5_7I2PairRaw ((1,5),(k,l))) (CA4_5_7I2PairP ((1,5),(k,l))) = true := by + decide +kernel +lemma CA4_5_7I2PairP_check_2_0 : ∀ k l : Fin 6, contains (CA4_5_7I2PairRaw ((2,0),(k,l))) (CA4_5_7I2PairP ((2,0),(k,l))) = true := by + decide +kernel +lemma CA4_5_7I2PairP_check_2_1 : ∀ k l : Fin 6, contains (CA4_5_7I2PairRaw ((2,1),(k,l))) (CA4_5_7I2PairP ((2,1),(k,l))) = true := by + decide +kernel +lemma CA4_5_7I2PairP_check_2_2 : ∀ k l : Fin 6, contains (CA4_5_7I2PairRaw ((2,2),(k,l))) (CA4_5_7I2PairP ((2,2),(k,l))) = true := by + decide +kernel +lemma CA4_5_7I2PairP_check_2_3 : ∀ k l : Fin 6, contains (CA4_5_7I2PairRaw ((2,3),(k,l))) (CA4_5_7I2PairP ((2,3),(k,l))) = true := by + decide +kernel +lemma CA4_5_7I2PairP_check_2_4 : ∀ k l : Fin 6, contains (CA4_5_7I2PairRaw ((2,4),(k,l))) (CA4_5_7I2PairP ((2,4),(k,l))) = true := by + decide +kernel +lemma CA4_5_7I2PairP_check_2_5 : ∀ k l : Fin 6, contains (CA4_5_7I2PairRaw ((2,5),(k,l))) (CA4_5_7I2PairP ((2,5),(k,l))) = true := by + decide +kernel +lemma CA4_5_7I2PairP_check_3_0 : ∀ k l : Fin 6, contains (CA4_5_7I2PairRaw ((3,0),(k,l))) (CA4_5_7I2PairP ((3,0),(k,l))) = true := by + decide +kernel +lemma CA4_5_7I2PairP_check_3_1 : ∀ k l : Fin 6, contains (CA4_5_7I2PairRaw ((3,1),(k,l))) (CA4_5_7I2PairP ((3,1),(k,l))) = true := by + decide +kernel +lemma CA4_5_7I2PairP_check_3_2 : ∀ k l : Fin 6, contains (CA4_5_7I2PairRaw ((3,2),(k,l))) (CA4_5_7I2PairP ((3,2),(k,l))) = true := by + decide +kernel +lemma CA4_5_7I2PairP_check_3_3 : ∀ k l : Fin 6, contains (CA4_5_7I2PairRaw ((3,3),(k,l))) (CA4_5_7I2PairP ((3,3),(k,l))) = true := by + decide +kernel +lemma CA4_5_7I2PairP_check_3_4 : ∀ k l : Fin 6, contains (CA4_5_7I2PairRaw ((3,4),(k,l))) (CA4_5_7I2PairP ((3,4),(k,l))) = true := by + decide +kernel +lemma CA4_5_7I2PairP_check_3_5 : ∀ k l : Fin 6, contains (CA4_5_7I2PairRaw ((3,5),(k,l))) (CA4_5_7I2PairP ((3,5),(k,l))) = true := by + decide +kernel +lemma CA4_5_7I2PairP_check_4_0 : ∀ k l : Fin 6, contains (CA4_5_7I2PairRaw ((4,0),(k,l))) (CA4_5_7I2PairP ((4,0),(k,l))) = true := by + decide +kernel +lemma CA4_5_7I2PairP_check_4_1 : ∀ k l : Fin 6, contains (CA4_5_7I2PairRaw ((4,1),(k,l))) (CA4_5_7I2PairP ((4,1),(k,l))) = true := by + decide +kernel +lemma CA4_5_7I2PairP_check_4_2 : ∀ k l : Fin 6, contains (CA4_5_7I2PairRaw ((4,2),(k,l))) (CA4_5_7I2PairP ((4,2),(k,l))) = true := by + decide +kernel +lemma CA4_5_7I2PairP_check_4_3 : ∀ k l : Fin 6, contains (CA4_5_7I2PairRaw ((4,3),(k,l))) (CA4_5_7I2PairP ((4,3),(k,l))) = true := by + decide +kernel +lemma CA4_5_7I2PairP_check_4_4 : ∀ k l : Fin 6, contains (CA4_5_7I2PairRaw ((4,4),(k,l))) (CA4_5_7I2PairP ((4,4),(k,l))) = true := by + decide +kernel +lemma CA4_5_7I2PairP_check_4_5 : ∀ k l : Fin 6, contains (CA4_5_7I2PairRaw ((4,5),(k,l))) (CA4_5_7I2PairP ((4,5),(k,l))) = true := by + decide +kernel +lemma CA4_5_7I2PairP_check_5_0 : ∀ k l : Fin 6, contains (CA4_5_7I2PairRaw ((5,0),(k,l))) (CA4_5_7I2PairP ((5,0),(k,l))) = true := by + decide +kernel +lemma CA4_5_7I2PairP_check_5_1 : ∀ k l : Fin 6, contains (CA4_5_7I2PairRaw ((5,1),(k,l))) (CA4_5_7I2PairP ((5,1),(k,l))) = true := by + decide +kernel +lemma CA4_5_7I2PairP_check_5_2 : ∀ k l : Fin 6, contains (CA4_5_7I2PairRaw ((5,2),(k,l))) (CA4_5_7I2PairP ((5,2),(k,l))) = true := by + decide +kernel +lemma CA4_5_7I2PairP_check_5_3 : ∀ k l : Fin 6, contains (CA4_5_7I2PairRaw ((5,3),(k,l))) (CA4_5_7I2PairP ((5,3),(k,l))) = true := by + decide +kernel +lemma CA4_5_7I2PairP_check_5_4 : ∀ k l : Fin 6, contains (CA4_5_7I2PairRaw ((5,4),(k,l))) (CA4_5_7I2PairP ((5,4),(k,l))) = true := by + decide +kernel +lemma CA4_5_7I2PairP_check_5_5 : ∀ k l : Fin 6, contains (CA4_5_7I2PairRaw ((5,5),(k,l))) (CA4_5_7I2PairP ((5,5),(k,l))) = true := by + decide +kernel +lemma CA4_5_7I2PairP_check (a : PairSlot × PairSlot) : contains (CA4_5_7I2PairRaw a) (CA4_5_7I2PairP a) = true := by + rcases a with ⟨⟨i,j⟩,⟨k,l⟩⟩ + revert j i + apply forall_fin6 + · exact forall_fin6 (CA4_5_7I2PairP_check_0_0 k l) (CA4_5_7I2PairP_check_0_1 k l) (CA4_5_7I2PairP_check_0_2 k l) (CA4_5_7I2PairP_check_0_3 k l) (CA4_5_7I2PairP_check_0_4 k l) (CA4_5_7I2PairP_check_0_5 k l) + · exact forall_fin6 (CA4_5_7I2PairP_check_1_0 k l) (CA4_5_7I2PairP_check_1_1 k l) (CA4_5_7I2PairP_check_1_2 k l) (CA4_5_7I2PairP_check_1_3 k l) (CA4_5_7I2PairP_check_1_4 k l) (CA4_5_7I2PairP_check_1_5 k l) + · exact forall_fin6 (CA4_5_7I2PairP_check_2_0 k l) (CA4_5_7I2PairP_check_2_1 k l) (CA4_5_7I2PairP_check_2_2 k l) (CA4_5_7I2PairP_check_2_3 k l) (CA4_5_7I2PairP_check_2_4 k l) (CA4_5_7I2PairP_check_2_5 k l) + · exact forall_fin6 (CA4_5_7I2PairP_check_3_0 k l) (CA4_5_7I2PairP_check_3_1 k l) (CA4_5_7I2PairP_check_3_2 k l) (CA4_5_7I2PairP_check_3_3 k l) (CA4_5_7I2PairP_check_3_4 k l) (CA4_5_7I2PairP_check_3_5 k l) + · exact forall_fin6 (CA4_5_7I2PairP_check_4_0 k l) (CA4_5_7I2PairP_check_4_1 k l) (CA4_5_7I2PairP_check_4_2 k l) (CA4_5_7I2PairP_check_4_3 k l) (CA4_5_7I2PairP_check_4_4 k l) (CA4_5_7I2PairP_check_4_5 k l) + · exact forall_fin6 (CA4_5_7I2PairP_check_5_0 k l) (CA4_5_7I2PairP_check_5_1 k l) (CA4_5_7I2PairP_check_5_2 k l) (CA4_5_7I2PairP_check_5_3 k l) (CA4_5_7I2PairP_check_5_4 k l) (CA4_5_7I2PairP_check_5_5 k l) +lemma CA4_5_7I2PairP_sound (a : PairSlot × PairSlot) : + (CA4_5_7I2PairP a).Encloses (CA4_5_7I2PairValue a) := + contains_sound (CA4_5_7I2PairRaw_sound a) (CA4_5_7I2PairP_check a) +def CA4_5_7I2PairTerms (a : PairSlot × PairSlot) : Ball := + (CompactCertificate.entropyLookup CA4_5_7I2PairCertificates (CA4_5_7I2PairCertificateIndex a)).output +lemma CA4_5_7I2PairTerms_sound (a : PairSlot × PairSlot) : + (CA4_5_7I2PairTerms a).Encloses (Foundation.entropyTerm (CA4_5_7I2PairValue a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA4_5_7I2PairCertificates_valid + (CA4_5_7I2PairCertificateIndex a) (CA4_5_7I2PairP_sound a) +def CA4_5_7I2PairEntropy : Ball := ⟨(2926908964202703077957468825237 / 1000000000000000000000000000000), (29293837857 / 25000000000000000000000000000000)⟩ +lemma CA4_5_7I2PairEntropy_sound : CA4_5_7I2PairEntropy.Encloses (Foundation.finiteEntropy CA4_5_7I2PairValue) := by + exact contains_sound (entropyDoublePair_enclosed CA4_5_7I2PairValue CA4_5_7I2PairTerms CA4_5_7I2PairTerms_sound) (by decide +kernel) +def CA4_5_7I2PairMass : Ball := ⟨(5000000000000000000000000000001 / 5000000000000000000000000000000), (1 / 156250000000000000000000000000)⟩ +lemma CA4_5_7I2PairMass_sound : CA4_5_7I2PairMass.Encloses (∑ a, CA4_5_7I2PairValue a) := by + exact contains_sound (doublePairSumBall_sound CA4_5_7I2PairP CA4_5_7I2PairValue CA4_5_7I2PairP_sound) (by decide +kernel) +def CA4_5_7I2PairMassTermLogWitness : LogWitness := ⟨0, 5000000000000000000000000000001, 5000000000000000000000000000000⟩ +def CA4_5_7I2PairMassTermLog : Ball := ⟨(1 / 5000000000000000000000000000000), (10587912161 / 50000000000000000000000000000000)⟩ +lemma CA4_5_7I2PairMassTermLog_sound : CA4_5_7I2PairMassTermLog.Encloses (Real.log ((∑ a, CA4_5_7I2PairValue a))) := by + exact checkLog_sound logTwoBall_sound (CA4_5_7I2PairMass_sound) (w := CA4_5_7I2PairMassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA4_5_7I2PairMassTerm : Ball := ⟨(-1 / 5000000000000000000000000000000), (21175824323 / 100000000000000000000000000000000)⟩ +lemma CA4_5_7I2PairMassTerm_sound : CA4_5_7I2PairMassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA4_5_7I2PairValue a))) := by + exact contains_sound (entropyTerm_ball (CA4_5_7I2PairMass_sound) CA4_5_7I2PairMassTermLog_sound) (by decide +kernel) +def CA4_5_7I2PairH : Ball := ⟨(7317272410506757694893672063093 / 2500000000000000000000000000000), (138351175751 / 100000000000000000000000000000000)⟩ +lemma CA4_5_7I2PairH_sound : CA4_5_7I2PairH.Encloses (homogeneousEntropy CA4_5_7I2PairValue) := by + exact contains_sound (homogeneous_enclosed CA4_5_7I2PairValue CA4_5_7I2PairMassTerm_sound CA4_5_7I2PairEntropy_sound) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA4_6_6I0.lean b/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA4_6_6I0.lean new file mode 100644 index 0000000000000000000000000000000000000000..9cdaf0e157a8a7d8f4f0b04a46d4b49a8d791237 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA4_6_6I0.lean @@ -0,0 +1,77 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Certificates.SplitA4_6_6 + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CA4_6_6I0Value (a : Fin 17) : ℝ := marginal (below (shape 4 6 6)) (fun u => (stageALaw (shape 4 6 6) u : ℝ)) ((Equiv.refl (Fin 3)) 0) a +def CA4_6_6I0Raw (a : Fin 17) : Ball := marginalBall (below (shape 4 6 6)) A4_6_6Law ((Equiv.refl (Fin 3)) 0) a +lemma CA4_6_6I0Raw_sound (a : Fin 17) : + (CA4_6_6I0Raw a).Encloses (CA4_6_6I0Value a) := by + exact marginalBall_sound (below (shape 4 6 6)) A4_6_6Law (fun u => (stageALaw (shape 4 6 6) u : ℝ)) (fun u _ => A4_6_6Law_sound u) ((Equiv.refl (Fin 3)) 0) a +def CA4_6_6I0Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(1269317881239145350260745246849 / 50000000000000000000000000000000), (19 / 100000000000000000000000000000000)⟩ ⟨(9325788524935738087929366566497 / 100000000000000000000000000000000), (94075983 / 2500000000000000000000000000000)⟩ ⟨(-91838583765869091870909778712293 / 25000000000000000000000000000000), (148230766529 / 100000000000000000000000000000000)⟩ ⟨-6, 1269317881239145350260745246849, 781250000000000000000000000000⟩, + .log ⟨(11588820373098244973492919766751 / 50000000000000000000000000000000), (7 / 6250000000000000000000000000000)⟩ ⟨(16942648327689404538018829373863 / 50000000000000000000000000000000), (1963222563 / 10000000000000000000000000000000)⟩ ⟨(-36549553324295391039878643229909 / 25000000000000000000000000000000), (16940659043 / 20000000000000000000000000000000)⟩ ⟨-3, 11588820373098244973492919766751, 6250000000000000000000000000000⟩, + .log ⟨(24283723491325219352492669972801 / 50000000000000000000000000000000), (77 / 50000000000000000000000000000000)⟩ ⟨(35076221028848599746831186638677 / 100000000000000000000000000000000), (30853671087 / 100000000000000000000000000000000)⟩ ⟨(-72221669467984888230715756913543 / 100000000000000000000000000000000), (31763735683 / 50000000000000000000000000000000)⟩ ⟨-2, 24283723491325219352492669972801, 12500000000000000000000000000000⟩] +lemma CA4_6_6I0Certificates_valid : + CA4_6_6I0Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA4_6_6I0CertificateIndex (a : Fin 17) : ℕ := + match a.val with + | 0 => 1 + | 1 => 2 + | 2 => 3 + | 3 => 2 + | 4 => 1 + | _ => 0 +def CA4_6_6I0P (a : Fin 17) : Ball := + (CompactCertificate.entropyLookup CA4_6_6I0Certificates (CA4_6_6I0CertificateIndex a)).input +lemma CA4_6_6I0P_check : ∀ a : Fin 17, contains (CA4_6_6I0Raw a) (CA4_6_6I0P a) = true := by + decide +kernel +lemma CA4_6_6I0P_sound (a : Fin 17) : + (CA4_6_6I0P a).Encloses (CA4_6_6I0Value a) := + contains_sound (CA4_6_6I0Raw_sound a) (CA4_6_6I0P_check a) +def CA4_6_6I0Terms (a : Fin 17) : Ball := + (CompactCertificate.entropyLookup CA4_6_6I0Certificates (CA4_6_6I0CertificateIndex a)).output +lemma CA4_6_6I0Terms_sound (a : Fin 17) : + (CA4_6_6I0Terms a).Encloses (Foundation.entropyTerm (CA4_6_6I0Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA4_6_6I0Certificates_valid + (CA4_6_6I0CertificateIndex a) (CA4_6_6I0P_sound a) +def CA4_6_6I0Entropy : Ball := ⟨(121498391389477694074765237267123 / 100000000000000000000000000000000), (77644200987 / 100000000000000000000000000000000)⟩ +lemma CA4_6_6I0Entropy_sound : CA4_6_6I0Entropy.Encloses (Foundation.finiteEntropy CA4_6_6I0Value) := by + exact contains_sound (entropyFin_enclosed 17 CA4_6_6I0Value CA4_6_6I0Terms CA4_6_6I0Terms_sound) (by decide +kernel) +def CA4_6_6I0Mass : Ball := ⟨(50000000000000000000000000000001 / 50000000000000000000000000000000), (13 / 3125000000000000000000000000000)⟩ +lemma CA4_6_6I0Mass_sound : CA4_6_6I0Mass.Encloses (∑ a, CA4_6_6I0Value a) := by + exact contains_sound (finSumBall_sound 17 CA4_6_6I0P CA4_6_6I0Value CA4_6_6I0P_sound) (by decide +kernel) +def CA4_6_6I0MassTermLogWitness : LogWitness := ⟨0, 50000000000000000000000000000001, 50000000000000000000000000000000⟩ +def CA4_6_6I0MassTermLog : Ball := ⟨(1 / 50000000000000000000000000000000), (10587912049 / 50000000000000000000000000000000)⟩ +lemma CA4_6_6I0MassTermLog_sound : CA4_6_6I0MassTermLog.Encloses (Real.log ((∑ a, CA4_6_6I0Value a))) := by + exact checkLog_sound logTwoBall_sound (CA4_6_6I0Mass_sound) (w := CA4_6_6I0MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA4_6_6I0MassTerm : Ball := ⟨(-1 / 50000000000000000000000000000000), (21175824099 / 100000000000000000000000000000000)⟩ +lemma CA4_6_6I0MassTerm_sound : CA4_6_6I0MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA4_6_6I0Value a))) := by + exact contains_sound (entropyTerm_ball (CA4_6_6I0Mass_sound) CA4_6_6I0MassTermLog_sound) (by decide +kernel) +def CA4_6_6I0H : Ball := ⟨(971987131115821552598121898137 / 800000000000000000000000000000), (49410012543 / 50000000000000000000000000000000)⟩ +lemma CA4_6_6I0H_sound : CA4_6_6I0H.Encloses (homogeneousEntropy CA4_6_6I0Value) := by + exact contains_sound (homogeneous_enclosed CA4_6_6I0Value CA4_6_6I0MassTerm_sound CA4_6_6I0Entropy_sound) (by decide +kernel) +lemma CA4_6_6I0_sound : CA4_6_6I0H.Encloses (stageACapacity (shape 4 6 6) 0) := by + exact CA4_6_6I0H_sound + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA4_6_6I1.lean b/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA4_6_6I1.lean new file mode 100644 index 0000000000000000000000000000000000000000..1599579bfedc0ef48a514a980d01dc650b1cf655 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA4_6_6I1.lean @@ -0,0 +1,866 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.CapacityA.CapA4_6_6I1Pair + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CA4_6_6I1R0Value (a : PairSlot) : ℝ := residualLaw (below (shape 4 6 6)) (fun u => (stageALaw (shape 4 6 6) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 0 a +def CA4_6_6I1R0Raw (a : PairSlot) : Ball := residualBall (below (shape 4 6 6)) A4_6_6Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 0 a +lemma CA4_6_6I1R0Raw_sound (a : PairSlot) : + (CA4_6_6I1R0Raw a).Encloses (CA4_6_6I1R0Value a) := by + exact residualBall_sound_on (below (shape 4 6 6)) A4_6_6Law (fun u => (stageALaw (shape 4 6 6) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A4_6_6Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 4 6 6) (show (shape 4 6 6) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 0 a +def CA4_6_6I1R0Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(15773965556059223716466861929 / 100000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ ⟨(69047100494242373905364798197 / 50000000000000000000000000000000), (4676377 / 10000000000000000000000000000000)⟩ ⟨(-437728231679315675174532705087319 / 50000000000000000000000000000000), (14823077529 / 5000000000000000000000000000000)⟩ ⟨-13, 15773965556059223716466861929, 12207031250000000000000000000⟩] +lemma CA4_6_6I1R0Certificates_valid : + CA4_6_6I1R0Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA4_6_6I1R0CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 0, 0 => 1 + | _, _ => 0 +def CA4_6_6I1R0P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA4_6_6I1R0Certificates (CA4_6_6I1R0CertificateIndex a)).input +lemma CA4_6_6I1R0P_check : ∀ a : PairSlot, contains (CA4_6_6I1R0Raw a) (CA4_6_6I1R0P a) = true := by + decide +kernel +lemma CA4_6_6I1R0P_sound (a : PairSlot) : + (CA4_6_6I1R0P a).Encloses (CA4_6_6I1R0Value a) := + contains_sound (CA4_6_6I1R0Raw_sound a) (CA4_6_6I1R0P_check a) +def CA4_6_6I1R0Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA4_6_6I1R0Certificates (CA4_6_6I1R0CertificateIndex a)).output +lemma CA4_6_6I1R0Terms_sound (a : PairSlot) : + (CA4_6_6I1R0Terms a).Encloses (Foundation.entropyTerm (CA4_6_6I1R0Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA4_6_6I1R0Certificates_valid + (CA4_6_6I1R0CertificateIndex a) (CA4_6_6I1R0P_sound a) +def CA4_6_6I1R0Entropy : Ball := ⟨(69047100494242373905364798197 / 50000000000000000000000000000000), (4676377 / 10000000000000000000000000000000)⟩ +lemma CA4_6_6I1R0Entropy_sound : CA4_6_6I1R0Entropy.Encloses (Foundation.finiteEntropy CA4_6_6I1R0Value) := by + exact contains_sound (entropyPair_enclosed CA4_6_6I1R0Value CA4_6_6I1R0Terms CA4_6_6I1R0Terms_sound) (by decide +kernel) +def CA4_6_6I1R0Mass : Ball := ⟨(15773965556059223716466861929 / 100000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +lemma CA4_6_6I1R0Mass_sound : CA4_6_6I1R0Mass.Encloses (∑ a, CA4_6_6I1R0Value a) := by + exact contains_sound (pairSumBall_sound CA4_6_6I1R0P CA4_6_6I1R0Value CA4_6_6I1R0P_sound) (by decide +kernel) +def CA4_6_6I1R0MassTermLogWitness : LogWitness := ⟨-13, 15773965556059223716466861929, 12207031250000000000000000000⟩ +def CA4_6_6I1R0MassTermLog : Ball := ⟨(-437728231679315675174532705087319 / 50000000000000000000000000000000), (14823077529 / 5000000000000000000000000000000)⟩ +lemma CA4_6_6I1R0MassTermLog_sound : CA4_6_6I1R0MassTermLog.Encloses (Real.log ((∑ a, CA4_6_6I1R0Value a))) := by + exact checkLog_sound logTwoBall_sound (CA4_6_6I1R0Mass_sound) (w := CA4_6_6I1R0MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA4_6_6I1R0MassTerm : Ball := ⟨(69047100494242373905364798197 / 50000000000000000000000000000000), (4676377 / 10000000000000000000000000000000)⟩ +lemma CA4_6_6I1R0MassTerm_sound : CA4_6_6I1R0MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA4_6_6I1R0Value a))) := by + exact contains_sound (entropyTerm_ball (CA4_6_6I1R0Mass_sound) CA4_6_6I1R0MassTermLog_sound) (by decide +kernel) +def CA4_6_6I1R0H : Ball := ⟨0, (4676377 / 5000000000000000000000000000000)⟩ +lemma CA4_6_6I1R0H_sound : CA4_6_6I1R0H.Encloses (homogeneousEntropy CA4_6_6I1R0Value) := by + exact contains_sound (homogeneous_enclosed CA4_6_6I1R0Value CA4_6_6I1R0MassTerm_sound CA4_6_6I1R0Entropy_sound) (by decide +kernel) +def CA4_6_6I1R1Value (a : PairSlot) : ℝ := residualLaw (below (shape 4 6 6)) (fun u => (stageALaw (shape 4 6 6) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 1 a +def CA4_6_6I1R1Raw (a : PairSlot) : Ball := residualBall (below (shape 4 6 6)) A4_6_6Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 1 a +lemma CA4_6_6I1R1Raw_sound (a : PairSlot) : + (CA4_6_6I1R1Raw a).Encloses (CA4_6_6I1R1Value a) := by + exact residualBall_sound_on (below (shape 4 6 6)) A4_6_6Law (fun u => (stageALaw (shape 4 6 6) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A4_6_6Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 4 6 6) (show (shape 4 6 6) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 1 a +def CA4_6_6I1R1Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(85018587892439093136197242101 / 12500000000000000000000000000000), (7 / 100000000000000000000000000000000)⟩ ⟨(848589911628194458485256767603 / 25000000000000000000000000000000), (648121927 / 50000000000000000000000000000000)⟩ ⟨(-99812280192395620102401815789463 / 20000000000000000000000000000000), (5955700443 / 3125000000000000000000000000000)⟩ ⟨-8, 85018587892439093136197242101, 48828125000000000000000000000⟩] +lemma CA4_6_6I1R1Certificates_valid : + CA4_6_6I1R1Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA4_6_6I1R1CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 0, 1 => 1 + | 1, 0 => 1 + | _, _ => 0 +def CA4_6_6I1R1P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA4_6_6I1R1Certificates (CA4_6_6I1R1CertificateIndex a)).input +lemma CA4_6_6I1R1P_check : ∀ a : PairSlot, contains (CA4_6_6I1R1Raw a) (CA4_6_6I1R1P a) = true := by + decide +kernel +lemma CA4_6_6I1R1P_sound (a : PairSlot) : + (CA4_6_6I1R1P a).Encloses (CA4_6_6I1R1Value a) := + contains_sound (CA4_6_6I1R1Raw_sound a) (CA4_6_6I1R1P_check a) +def CA4_6_6I1R1Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA4_6_6I1R1Certificates (CA4_6_6I1R1CertificateIndex a)).output +lemma CA4_6_6I1R1Terms_sound (a : PairSlot) : + (CA4_6_6I1R1Terms a).Encloses (Foundation.entropyTerm (CA4_6_6I1R1Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA4_6_6I1R1Certificates_valid + (CA4_6_6I1R1CertificateIndex a) (CA4_6_6I1R1P_sound a) +def CA4_6_6I1R1Entropy : Ball := ⟨(848589911628194458485256767603 / 12500000000000000000000000000000), (648121927 / 25000000000000000000000000000000)⟩ +lemma CA4_6_6I1R1Entropy_sound : CA4_6_6I1R1Entropy.Encloses (Foundation.finiteEntropy CA4_6_6I1R1Value) := by + exact contains_sound (entropyPair_enclosed CA4_6_6I1R1Value CA4_6_6I1R1Terms CA4_6_6I1R1Terms_sound) (by decide +kernel) +def CA4_6_6I1R1Mass : Ball := ⟨(85018587892439093136197242101 / 6250000000000000000000000000000), (7 / 50000000000000000000000000000000)⟩ +lemma CA4_6_6I1R1Mass_sound : CA4_6_6I1R1Mass.Encloses (∑ a, CA4_6_6I1R1Value a) := by + exact contains_sound (pairSumBall_sound CA4_6_6I1R1P CA4_6_6I1R1Value CA4_6_6I1R1P_sound) (by decide +kernel) +def CA4_6_6I1R1MassTermLogWitness : LogWitness := ⟨-7, 85018587892439093136197242101, 48828125000000000000000000000⟩ +def CA4_6_6I1R1MassTermLog : Ball := ⟨(-85949336581196713914057177179397 / 20000000000000000000000000000000), (169406590493 / 100000000000000000000000000000000)⟩ +lemma CA4_6_6I1R1MassTermLog_sound : CA4_6_6I1R1MassTermLog.Encloses (Real.log ((∑ a, CA4_6_6I1R1Value a))) := by + exact checkLog_sound logTwoBall_sound (CA4_6_6I1R1Mass_sound) (w := CA4_6_6I1R1MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA4_6_6I1R1MassTerm : Ball := ⟨(116916659622804854083157751421 / 2000000000000000000000000000000), (2304433517 / 100000000000000000000000000000000)⟩ +lemma CA4_6_6I1R1MassTerm_sound : CA4_6_6I1R1MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA4_6_6I1R1Value a))) := by + exact contains_sound (entropyTerm_ball (CA4_6_6I1R1Mass_sound) CA4_6_6I1R1MassTermLog_sound) (by decide +kernel) +def CA4_6_6I1R1H : Ball := ⟨(471443155942656481862083284887 / 50000000000000000000000000000000), (195876849 / 4000000000000000000000000000000)⟩ +lemma CA4_6_6I1R1H_sound : CA4_6_6I1R1H.Encloses (homogeneousEntropy CA4_6_6I1R1Value) := by + exact contains_sound (homogeneous_enclosed CA4_6_6I1R1Value CA4_6_6I1R1MassTerm_sound CA4_6_6I1R1Entropy_sound) (by decide +kernel) +def CA4_6_6I1R2Value (a : PairSlot) : ℝ := residualLaw (below (shape 4 6 6)) (fun u => (stageALaw (shape 4 6 6) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 2 a +def CA4_6_6I1R2Raw (a : PairSlot) : Ball := residualBall (below (shape 4 6 6)) A4_6_6Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 2 a +lemma CA4_6_6I1R2Raw_sound (a : PairSlot) : + (CA4_6_6I1R2Raw a).Encloses (CA4_6_6I1R2Value a) := by + exact residualBall_sound_on (below (shape 4 6 6)) A4_6_6Law (fun u => (stageALaw (shape 4 6 6) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A4_6_6Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 4 6 6) (show (shape 4 6 6) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 2 a +def CA4_6_6I1R2Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(3927628248579179230197115299127 / 100000000000000000000000000000000), (1 / 3125000000000000000000000000000)⟩ ⟨(6357130338196642077599139921997 / 50000000000000000000000000000000), (4990245933 / 100000000000000000000000000000000)⟩ ⟨(-6474268882750128912606853797771 / 2000000000000000000000000000000), (1985233483 / 1562500000000000000000000000000)⟩ ⟨-5, 3927628248579179230197115299127, 3125000000000000000000000000000⟩, + .log ⟨(148915355886952601084273077897 / 50000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ ⟨(866151308917933645944085708067 / 50000000000000000000000000000000), (126136217 / 20000000000000000000000000000000)⟩ ⟨(-116328004423595181413166850775563 / 20000000000000000000000000000000), (211758237837 / 100000000000000000000000000000000)⟩ ⟨-9, 148915355886952601084273077897, 97656250000000000000000000000⟩, + .log ⟨(7222314512261821528821625985319 / 50000000000000000000000000000000), (43 / 50000000000000000000000000000000)⟩ ⟨(27948154852403997103055724563901 / 100000000000000000000000000000000), (12235076949 / 100000000000000000000000000000000)⟩ ⟨(-193484753432950661454840799555697 / 100000000000000000000000000000000), (84703295327 / 100000000000000000000000000000000)⟩ ⟨-3, 7222314512261821528821625985319, 6250000000000000000000000000000⟩] +lemma CA4_6_6I1R2Certificates_valid : + CA4_6_6I1R2Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA4_6_6I1R2CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 2, 0 => 1 + | 3, 0 => 2 + | 1, 1 => 3 + | 0, 2 => 1 + | 0, 3 => 2 + | _, _ => 0 +def CA4_6_6I1R2P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA4_6_6I1R2Certificates (CA4_6_6I1R2CertificateIndex a)).input +lemma CA4_6_6I1R2P_check : ∀ a : PairSlot, contains (CA4_6_6I1R2Raw a) (CA4_6_6I1R2P a) = true := by + decide +kernel +lemma CA4_6_6I1R2P_sound (a : PairSlot) : + (CA4_6_6I1R2P a).Encloses (CA4_6_6I1R2Value a) := + contains_sound (CA4_6_6I1R2Raw_sound a) (CA4_6_6I1R2P_check a) +def CA4_6_6I1R2Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA4_6_6I1R2Certificates (CA4_6_6I1R2CertificateIndex a)).output +lemma CA4_6_6I1R2Terms_sound (a : PairSlot) : + (CA4_6_6I1R2Terms a).Encloses (Foundation.entropyTerm (CA4_6_6I1R2Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA4_6_6I1R2Certificates_valid + (CA4_6_6I1R2CertificateIndex a) (CA4_6_6I1R2P_sound a) +def CA4_6_6I1R2Entropy : Ball := ⟨(56841281440862299997228627084157 / 100000000000000000000000000000000), (4695386197 / 20000000000000000000000000000000)⟩ +lemma CA4_6_6I1R2Entropy_sound : CA4_6_6I1R2Entropy.Encloses (Foundation.finiteEntropy CA4_6_6I1R2Value) := by + exact contains_sound (entropyPair_enclosed CA4_6_6I1R2Value CA4_6_6I1R2Terms CA4_6_6I1R2Terms_sound) (by decide +kernel) +def CA4_6_6I1R2Mass : Ball := ⟨(143097168407686324514841093003 / 625000000000000000000000000000), (39 / 25000000000000000000000000000000)⟩ +lemma CA4_6_6I1R2Mass_sound : CA4_6_6I1R2Mass.Encloses (∑ a, CA4_6_6I1R2Value a) := by + exact contains_sound (pairSumBall_sound CA4_6_6I1R2P CA4_6_6I1R2Value CA4_6_6I1R2P_sound) (by decide +kernel) +def CA4_6_6I1R2MassTermLogWitness : LogWitness := ⟨-3, 143097168407686324514841093003, 78125000000000000000000000000⟩ +def CA4_6_6I1R2MassTermLog : Ball := ⟨(-73711387543860233702273399980243 / 50000000000000000000000000000000), (84703295413 / 100000000000000000000000000000000)⟩ +lemma CA4_6_6I1R2MassTermLog_sound : CA4_6_6I1R2MassTermLog.Encloses (Real.log ((∑ a, CA4_6_6I1R2Value a))) := by + exact checkLog_sound logTwoBall_sound (CA4_6_6I1R2Mass_sound) (w := CA4_6_6I1R2MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA4_6_6I1R2MassTerm : Ball := ⟨(33753250678169599658428471925163 / 100000000000000000000000000000000), (4848320749 / 25000000000000000000000000000000)⟩ +lemma CA4_6_6I1R2MassTerm_sound : CA4_6_6I1R2MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA4_6_6I1R2Value a))) := by + exact contains_sound (entropyTerm_ball (CA4_6_6I1R2Mass_sound) CA4_6_6I1R2MassTermLog_sound) (by decide +kernel) +def CA4_6_6I1R2H : Ball := ⟨(11544015381346350169400077579497 / 50000000000000000000000000000000), (42870213981 / 100000000000000000000000000000000)⟩ +lemma CA4_6_6I1R2H_sound : CA4_6_6I1R2H.Encloses (homogeneousEntropy CA4_6_6I1R2Value) := by + exact contains_sound (homogeneous_enclosed CA4_6_6I1R2Value CA4_6_6I1R2MassTerm_sound CA4_6_6I1R2Entropy_sound) (by decide +kernel) +def CA4_6_6I1R3Value (a : PairSlot) : ℝ := residualLaw (below (shape 4 6 6)) (fun u => (stageALaw (shape 4 6 6) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 3 a +def CA4_6_6I1R3Raw (a : PairSlot) : Ball := residualBall (below (shape 4 6 6)) A4_6_6Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 3 a +lemma CA4_6_6I1R3Raw_sound (a : PairSlot) : + (CA4_6_6I1R3Raw a).Encloses (CA4_6_6I1R3Value a) := by + exact residualBall_sound_on (below (shape 4 6 6)) A4_6_6Law (fun u => (stageALaw (shape 4 6 6) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A4_6_6Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 4 6 6) (show (shape 4 6 6) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 3 a +def CA4_6_6I1R3Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(171471744879298233733151873831 / 25000000000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ ⟨(1708617377034878150805047333371 / 50000000000000000000000000000000), (653589997 / 50000000000000000000000000000000)⟩ ⟨(-249110630185399039528940815840401 / 50000000000000000000000000000000), (95291207011 / 50000000000000000000000000000000)⟩ ⟨-8, 171471744879298233733151873831, 97656250000000000000000000000⟩, + .log ⟨(23394597168243240399713481862367 / 100000000000000000000000000000000), (93 / 100000000000000000000000000000000)⟩ ⟨(8496128594841533449942219230593 / 25000000000000000000000000000000), (990799741 / 5000000000000000000000000000000)⟩ ⟨(-145266508052970749767308041011161 / 100000000000000000000000000000000), (84703295129 / 100000000000000000000000000000000)⟩ ⟨-3, 23394597168243240399713481862367, 12500000000000000000000000000000⟩, + .log ⟨(329579507034934005816742605257 / 20000000000000000000000000000000), (1 / 12500000000000000000000000000000)⟩ ⟨(6765723360675774378114648377973 / 100000000000000000000000000000000), (2442691177 / 100000000000000000000000000000000)⟩ ⟨(-410566993169186146742910496645879 / 100000000000000000000000000000000), (74115383133 / 50000000000000000000000000000000)⟩ ⟨-6, 329579507034934005816742605257, 312500000000000000000000000000⟩] +lemma CA4_6_6I1R3Certificates_valid : + CA4_6_6I1R3Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA4_6_6I1R3CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 4, 0 => 1 + | 2, 1 => 2 + | 3, 1 => 3 + | 1, 2 => 2 + | 1, 3 => 3 + | 0, 4 => 1 + | _, _ => 0 +def CA4_6_6I1R3P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA4_6_6I1R3Certificates (CA4_6_6I1R3CertificateIndex a)).input +lemma CA4_6_6I1R3P_check : ∀ a : PairSlot, contains (CA4_6_6I1R3Raw a) (CA4_6_6I1R3P a) = true := by + decide +kernel +lemma CA4_6_6I1R3P_sound (a : PairSlot) : + (CA4_6_6I1R3P a).Encloses (CA4_6_6I1R3Value a) := + contains_sound (CA4_6_6I1R3Raw_sound a) (CA4_6_6I1R3P_check a) +def CA4_6_6I1R3Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA4_6_6I1R3Certificates (CA4_6_6I1R3CertificateIndex a)).output +lemma CA4_6_6I1R3Terms_sound (a : PairSlot) : + (CA4_6_6I1R3Terms a).Encloses (Foundation.entropyTerm (CA4_6_6I1R3Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA4_6_6I1R3Certificates_valid + (CA4_6_6I1R3CertificateIndex a) (CA4_6_6I1R3P_sound a) +def CA4_6_6I1R3Entropy : Ball := ⟨(44167472494111664479493619967087 / 50000000000000000000000000000000), (23565865991 / 50000000000000000000000000000000)⟩ +lemma CA4_6_6I1R3Entropy_sound : CA4_6_6I1R3Entropy.Encloses (Foundation.finiteEntropy CA4_6_6I1R3Value) := by + exact contains_sound (entropyPair_enclosed CA4_6_6I1R3Value CA4_6_6I1R3Terms CA4_6_6I1R3Terms_sound) (by decide +kernel) +def CA4_6_6I1R3Mass : Ball := ⟨(3216047710366887920466225297997 / 6250000000000000000000000000000), (107 / 50000000000000000000000000000000)⟩ +lemma CA4_6_6I1R3Mass_sound : CA4_6_6I1R3Mass.Encloses (∑ a, CA4_6_6I1R3Value a) := by + exact contains_sound (pairSumBall_sound CA4_6_6I1R3P CA4_6_6I1R3Value CA4_6_6I1R3P_sound) (by decide +kernel) +def CA4_6_6I1R3MassTermLogWitness : LogWitness := ⟨-1, 3216047710366887920466225297997, 3125000000000000000000000000000⟩ +def CA4_6_6I1R3MassTermLog : Ball := ⟨(-16610706930713633064934840352097 / 25000000000000000000000000000000), (42351647781 / 100000000000000000000000000000000)⟩ +lemma CA4_6_6I1R3MassTermLog_sound : CA4_6_6I1R3MassTermLog.Encloses (Real.log ((∑ a, CA4_6_6I1R3Value a))) := by + exact checkLog_sound logTwoBall_sound (CA4_6_6I1R3Mass_sound) (w := CA4_6_6I1R3MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA4_6_6I1R3MassTerm : Ball := ⟨(34189328634942064644830345826001 / 100000000000000000000000000000000), (21792787323 / 100000000000000000000000000000000)⟩ +lemma CA4_6_6I1R3MassTerm_sound : CA4_6_6I1R3MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA4_6_6I1R3Value a))) := by + exact contains_sound (entropyTerm_ball (CA4_6_6I1R3Mass_sound) CA4_6_6I1R3MassTermLog_sound) (by decide +kernel) +def CA4_6_6I1R3H : Ball := ⟨(54145616353281264314156894108173 / 100000000000000000000000000000000), (13784903861 / 20000000000000000000000000000000)⟩ +lemma CA4_6_6I1R3H_sound : CA4_6_6I1R3H.Encloses (homogeneousEntropy CA4_6_6I1R3Value) := by + exact contains_sound (homogeneous_enclosed CA4_6_6I1R3Value CA4_6_6I1R3MassTerm_sound CA4_6_6I1R3Entropy_sound) (by decide +kernel) +def CA4_6_6I1R4Value (a : PairSlot) : ℝ := residualLaw (below (shape 4 6 6)) (fun u => (stageALaw (shape 4 6 6) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 4 a +def CA4_6_6I1R4Raw (a : PairSlot) : Ball := residualBall (below (shape 4 6 6)) A4_6_6Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 4 a +lemma CA4_6_6I1R4Raw_sound (a : PairSlot) : + (CA4_6_6I1R4Raw a).Encloses (CA4_6_6I1R4Value a) := by + exact residualBall_sound_on (below (shape 4 6 6)) A4_6_6Law (fun u => (stageALaw (shape 4 6 6) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A4_6_6Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 4 6 6) (show (shape 4 6 6) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 4 a +def CA4_6_6I1R4Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(10264217402454907457895936341 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(11783657290823565372434024863 / 12500000000000000000000000000000), (32603 / 100000000000000000000000000000)⟩ ⟨(-459213082840792180331679723458093 / 50000000000000000000000000000000), (317637364987 / 100000000000000000000000000000000)⟩ ⟨-14, 10264217402454907457895936341, 6103515625000000000000000000⟩, + .log ⟨(1880250476688399864795208175819 / 100000000000000000000000000000000), (3 / 20000000000000000000000000000000)⟩ ⟨(1867918471183757579202867080319 / 25000000000000000000000000000000), (557421951 / 20000000000000000000000000000000)⟩ ⟨(-15895060742959207526817365160531 / 4000000000000000000000000000000), (74115383289 / 50000000000000000000000000000000)⟩ ⟨-6, 1880250476688399864795208175819, 1562500000000000000000000000000⟩, + .log ⟨(4309934616831163963269990063673 / 25000000000000000000000000000000), (51 / 50000000000000000000000000000000)⟩ ⟨(7576662881564488862285429189061 / 25000000000000000000000000000000), (14602626767 / 100000000000000000000000000000000)⟩ ⟨(-175795309097639025620586427413949 / 100000000000000000000000000000000), (84703295323 / 100000000000000000000000000000000)⟩ ⟨-3, 4309934616831163963269990063673, 3125000000000000000000000000000⟩, + .log ⟨(113640784216833638854226749691 / 12500000000000000000000000000000), (7 / 100000000000000000000000000000000)⟩ ⟨(2136647417192110385904686834403 / 50000000000000000000000000000000), (308023971 / 20000000000000000000000000000000)⟩ ⟨(-94008829308818173817478303915327 / 20000000000000000000000000000000), (169406590233 / 100000000000000000000000000000000)⟩ ⟨-7, 113640784216833638854226749691, 97656250000000000000000000000⟩, + .log ⟨(11438790751530144583616577951 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(2198999089973185030179928287 / 625000000000000000000000000000), (62978717 / 50000000000000000000000000000000)⟩ ⟨(-768962082702327337779670801763771 / 100000000000000000000000000000000), (17205356879 / 6250000000000000000000000000000)⟩ ⟨-12, 11438790751530144583616577951, 6103515625000000000000000000⟩] +lemma CA4_6_6I1R4Certificates_valid : + CA4_6_6I1R4Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA4_6_6I1R4CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 0, 5 => 1 + | 1, 4 => 2 + | 2, 2 => 3 + | 2, 3 => 4 + | 3, 2 => 4 + | 3, 3 => 5 + | 4, 1 => 2 + | 5, 0 => 1 + | _, _ => 0 +def CA4_6_6I1R4P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA4_6_6I1R4Certificates (CA4_6_6I1R4CertificateIndex a)).input +lemma CA4_6_6I1R4P_check : ∀ a : PairSlot, contains (CA4_6_6I1R4Raw a) (CA4_6_6I1R4P a) = true := by + decide +kernel +lemma CA4_6_6I1R4P_sound (a : PairSlot) : + (CA4_6_6I1R4P a).Encloses (CA4_6_6I1R4Value a) := + contains_sound (CA4_6_6I1R4Raw_sound a) (CA4_6_6I1R4P_check a) +def CA4_6_6I1R4Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA4_6_6I1R4Certificates (CA4_6_6I1R4CertificateIndex a)).output +lemma CA4_6_6I1R4Terms_sound (a : PairSlot) : + (CA4_6_6I1R4Terms a).Encloses (Foundation.entropyTerm (CA4_6_6I1R4Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA4_6_6I1R4Certificates_valid + (CA4_6_6I1R4CertificateIndex a) (CA4_6_6I1R4P_sound a) +def CA4_6_6I1R4Entropy : Ball := ⟨(6792120916943168034646391707517 / 12500000000000000000000000000000), (23448249421 / 100000000000000000000000000000000)⟩ +lemma CA4_6_6I1R4Entropy_sound : CA4_6_6I1R4Entropy.Encloses (Foundation.finiteEntropy CA4_6_6I1R4Value) := by + exact contains_sound (entropyPair_enclosed CA4_6_6I1R4Value CA4_6_6I1R4Terms CA4_6_6I1R4Terms_sound) (by decide +kernel) +def CA4_6_6I1R4Mass : Ball := ⟨(1430298472873864012349266424117 / 6250000000000000000000000000000), (149 / 100000000000000000000000000000000)⟩ +lemma CA4_6_6I1R4Mass_sound : CA4_6_6I1R4Mass.Encloses (∑ a, CA4_6_6I1R4Value a) := by + exact contains_sound (pairSumBall_sound CA4_6_6I1R4P CA4_6_6I1R4Value CA4_6_6I1R4P_sound) (by decide +kernel) +def CA4_6_6I1R4MassTermLogWitness : LogWitness := ⟨-3, 1430298472873864012349266424117, 781250000000000000000000000000⟩ +def CA4_6_6I1R4MassTermLog : Ball := ⟨(-29493966379330907074674043622459 / 20000000000000000000000000000000), (84703295383 / 100000000000000000000000000000000)⟩ +lemma CA4_6_6I1R4MassTermLog_sound : CA4_6_6I1R4MassTermLog.Encloses (Real.log ((∑ a, CA4_6_6I1R4Value a))) := by + exact checkLog_sound logTwoBall_sound (CA4_6_6I1R4Mass_sound) (w := CA4_6_6I1R4MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA4_6_6I1R4MassTerm : Ball := ⟨(33748140057080067657293397594779 / 100000000000000000000000000000000), (9692079633 / 50000000000000000000000000000000)⟩ +lemma CA4_6_6I1R4MassTerm_sound : CA4_6_6I1R4MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA4_6_6I1R4Value a))) := by + exact contains_sound (entropyTerm_ball (CA4_6_6I1R4Mass_sound) CA4_6_6I1R4MassTermLog_sound) (by decide +kernel) +def CA4_6_6I1R4H : Ball := ⟨(20588827278465276619877736065357 / 100000000000000000000000000000000), (42832408687 / 100000000000000000000000000000000)⟩ +lemma CA4_6_6I1R4H_sound : CA4_6_6I1R4H.Encloses (homogeneousEntropy CA4_6_6I1R4Value) := by + exact contains_sound (homogeneous_enclosed CA4_6_6I1R4Value CA4_6_6I1R4MassTerm_sound CA4_6_6I1R4Entropy_sound) (by decide +kernel) +def CA4_6_6I1R5Value (a : PairSlot) : ℝ := residualLaw (below (shape 4 6 6)) (fun u => (stageALaw (shape 4 6 6) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 5 a +def CA4_6_6I1R5Raw (a : PairSlot) : Ball := residualBall (below (shape 4 6 6)) A4_6_6Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 5 a +lemma CA4_6_6I1R5Raw_sound (a : PairSlot) : + (CA4_6_6I1R5Raw a).Encloses (CA4_6_6I1R5Value a) := by + exact residualBall_sound_on (below (shape 4 6 6)) A4_6_6Law (fun u => (stageALaw (shape 4 6 6) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A4_6_6Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 4 6 6) (show (shape 4 6 6) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 5 a +def CA4_6_6I1R5Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(3825868585720216092964071611 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(2688773179135836767367696879 / 2000000000000000000000000000000), (1814757 / 4000000000000000000000000000000)⟩ ⟨(-219621139527920902374457498962489 / 25000000000000000000000000000000), (18528846131 / 6250000000000000000000000000000)⟩ ⟨-13, 3825868585720216092964071611, 3051757812500000000000000000⟩, + .log ⟨(31332244156975329096401611801 / 5000000000000000000000000000000), (7 / 100000000000000000000000000000000)⟩ ⟨(635736931320862753580964465469 / 20000000000000000000000000000000), (1194274983 / 100000000000000000000000000000000)⟩ ⟨(-253627272968305742089183828342649 / 50000000000000000000000000000000), (23822801783 / 12500000000000000000000000000000)⟩ ⟨-8, 31332244156975329096401611801, 19531250000000000000000000000⟩, + .log ⟨(35706451602411539604070028661 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(56684663738269144205581058141 / 20000000000000000000000000000000), (6143423 / 6250000000000000000000000000000)⟩ ⟨(-31750376301430512188351838480739 / 4000000000000000000000000000000), (275285710679 / 100000000000000000000000000000000)⟩ ⟨-12, 35706451602411539604070028661, 24414062500000000000000000000⟩] +lemma CA4_6_6I1R5Certificates_valid : + CA4_6_6I1R5Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA4_6_6I1R5CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 1, 5 => 1 + | 2, 4 => 2 + | 3, 4 => 3 + | 4, 2 => 2 + | 4, 3 => 3 + | 5, 1 => 1 + | _, _ => 0 +def CA4_6_6I1R5P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA4_6_6I1R5Certificates (CA4_6_6I1R5CertificateIndex a)).input +lemma CA4_6_6I1R5P_check : ∀ a : PairSlot, contains (CA4_6_6I1R5Raw a) (CA4_6_6I1R5P a) = true := by + decide +kernel +lemma CA4_6_6I1R5P_sound (a : PairSlot) : + (CA4_6_6I1R5P a).Encloses (CA4_6_6I1R5Value a) := + contains_sound (CA4_6_6I1R5Raw_sound a) (CA4_6_6I1R5P_check a) +def CA4_6_6I1R5Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA4_6_6I1R5Certificates (CA4_6_6I1R5CertificateIndex a)).output +lemma CA4_6_6I1R5Terms_sound (a : PairSlot) : + (CA4_6_6I1R5Terms a).Encloses (Foundation.entropyTerm (CA4_6_6I1R5Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA4_6_6I1R5Certificates_valid + (CA4_6_6I1R5CertificateIndex a) (CA4_6_6I1R5P_sound a) +def CA4_6_6I1R5Entropy : Ball := ⟨(1798273317126225663650556231 / 25000000000000000000000000000), (334484669 / 12500000000000000000000000000000)⟩ +lemma CA4_6_6I1R5Entropy_sound : CA4_6_6I1R5Entropy.Encloses (Foundation.finiteEntropy CA4_6_6I1R5Value) := by + exact contains_sound (entropyPair_enclosed CA4_6_6I1R5Value CA4_6_6I1R5Terms CA4_6_6I1R5Terms_sound) (by decide +kernel) +def CA4_6_6I1R5Mass : Ball := ⟨(5421238472678391887231668409 / 400000000000000000000000000000), (9 / 50000000000000000000000000000000)⟩ +lemma CA4_6_6I1R5Mass_sound : CA4_6_6I1R5Mass.Encloses (∑ a, CA4_6_6I1R5Value a) := by + exact contains_sound (pairSumBall_sound CA4_6_6I1R5P CA4_6_6I1R5Value CA4_6_6I1R5P_sound) (by decide +kernel) +def CA4_6_6I1R5MassTermLogWitness : LogWitness := ⟨-7, 5421238472678391887231668409, 3125000000000000000000000000⟩ +def CA4_6_6I1R5MassTermLog : Ball := ⟨(-430114025726452064064942892187163 / 100000000000000000000000000000000), (21175823849 / 12500000000000000000000000000000)⟩ +lemma CA4_6_6I1R5MassTermLog_sound : CA4_6_6I1R5MassTermLog.Encloses (Real.log ((∑ a, CA4_6_6I1R5Value a))) := by + exact checkLog_sound logTwoBall_sound (CA4_6_6I1R5Mass_sound) (w := CA4_6_6I1R5MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA4_6_6I1R5MassTerm : Ball := ⟨(2914688379883531929262569133991 / 50000000000000000000000000000000), (2295983897 / 100000000000000000000000000000000)⟩ +lemma CA4_6_6I1R5MassTerm_sound : CA4_6_6I1R5MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA4_6_6I1R5Value a))) := by + exact contains_sound (entropyTerm_ball (CA4_6_6I1R5Mass_sound) CA4_6_6I1R5MassTermLog_sound) (by decide +kernel) +def CA4_6_6I1R5H : Ball := ⟨(681858254368919398038543328009 / 50000000000000000000000000000000), (4971861249 / 100000000000000000000000000000000)⟩ +lemma CA4_6_6I1R5H_sound : CA4_6_6I1R5H.Encloses (homogeneousEntropy CA4_6_6I1R5Value) := by + exact contains_sound (homogeneous_enclosed CA4_6_6I1R5Value CA4_6_6I1R5MassTerm_sound CA4_6_6I1R5Entropy_sound) (by decide +kernel) +def CA4_6_6I1R6Value (a : PairSlot) : ℝ := residualLaw (below (shape 4 6 6)) (fun u => (stageALaw (shape 4 6 6) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 6 a +def CA4_6_6I1R6Raw (a : PairSlot) : Ball := residualBall (below (shape 4 6 6)) A4_6_6Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 6 a +lemma CA4_6_6I1R6Raw_sound (a : PairSlot) : + (CA4_6_6I1R6Raw a).Encloses (CA4_6_6I1R6Value a) := by + exact residualBall_sound_on (below (shape 4 6 6)) A4_6_6Law (fun u => (stageALaw (shape 4 6 6) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A4_6_6Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 4 6 6) (show (shape 4 6 6) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 6 a +def CA4_6_6I1R6Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(2216061498608268849636149949 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(23749960873281983223153963687 / 100000000000000000000000000000000), (797759 / 10000000000000000000000000000000)⟩ ⟨(-267929848609768229357052599996109 / 25000000000000000000000000000000), (44998630967 / 12500000000000000000000000000000)⟩ ⟨-16, 2216061498608268849636149949, 1525878906250000000000000000⟩, + .log ⟨(143464820076889544050307539 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(1930260461968944409326252621 / 100000000000000000000000000000000), (79749 / 12500000000000000000000000000000)⟩ ⟨(-672729544753350350985395320593371 / 50000000000000000000000000000000), (222346497189 / 50000000000000000000000000000000)⟩ ⟨-20, 143464820076889544050307539, 95367431640625000000000000⟩, + .log ⟨(10693526489845127047010417541 / 100000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ ⟨(97773980750015420343107907517 / 100000000000000000000000000000000), (530729 / 1562500000000000000000000000000)⟩ ⟨(-91432869075383445547072618074003 / 10000000000000000000000000000000), (317637373947 / 100000000000000000000000000000000)⟩ ⟨-14, 10693526489845127047010417541, 6103515625000000000000000000⟩] +lemma CA4_6_6I1R6Certificates_valid : + CA4_6_6I1R6Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA4_6_6I1R6CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 2, 5 => 1 + | 3, 5 => 2 + | 4, 4 => 3 + | 5, 2 => 1 + | 5, 3 => 2 + | _, _ => 0 +def CA4_6_6I1R6P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA4_6_6I1R6Certificates (CA4_6_6I1R6CertificateIndex a)).input +lemma CA4_6_6I1R6P_check : ∀ a : PairSlot, contains (CA4_6_6I1R6Raw a) (CA4_6_6I1R6P a) = true := by + decide +kernel +lemma CA4_6_6I1R6P_sound (a : PairSlot) : + (CA4_6_6I1R6P a).Encloses (CA4_6_6I1R6Value a) := + contains_sound (CA4_6_6I1R6Raw_sound a) (CA4_6_6I1R6P_check a) +def CA4_6_6I1R6Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA4_6_6I1R6Certificates (CA4_6_6I1R6CertificateIndex a)).output +lemma CA4_6_6I1R6Terms_sound (a : PairSlot) : + (CA4_6_6I1R6Terms a).Encloses (Foundation.entropyTerm (CA4_6_6I1R6Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA4_6_6I1R6Certificates_valid + (CA4_6_6I1R6CertificateIndex a) (CA4_6_6I1R6P_sound a) +def CA4_6_6I1R6Entropy : Ball := ⟨(149134423420517275608068340133 / 100000000000000000000000000000000), (2559891 / 5000000000000000000000000000000)⟩ +lemma CA4_6_6I1R6Entropy_sound : CA4_6_6I1R6Entropy.Encloses (Foundation.finiteEntropy CA4_6_6I1R6Value) := by + exact contains_sound (entropyPair_enclosed CA4_6_6I1R6Value CA4_6_6I1R6Terms CA4_6_6I1R6Terms_sound) (by decide +kernel) +def CA4_6_6I1R6Mass : Ball := ⟨(15412579127215443834383332517 / 100000000000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ +lemma CA4_6_6I1R6Mass_sound : CA4_6_6I1R6Mass.Encloses (∑ a, CA4_6_6I1R6Value a) := by + exact contains_sound (pairSumBall_sound CA4_6_6I1R6P CA4_6_6I1R6Value CA4_6_6I1R6P_sound) (by decide +kernel) +def CA4_6_6I1R6MassTermLogWitness : LogWitness := ⟨-13, 15412579127215443834383332517, 12207031250000000000000000000⟩ +def CA4_6_6I1R6MassTermLog : Ball := ⟨(-438887073126462491403995506839213 / 50000000000000000000000000000000), (29646157049 / 10000000000000000000000000000000)⟩ +lemma CA4_6_6I1R6MassTermLog_sound : CA4_6_6I1R6MassTermLog.Encloses (Real.log ((∑ a, CA4_6_6I1R6Value a))) := by + exact checkLog_sound logTwoBall_sound (CA4_6_6I1R6Mass_sound) (w := CA4_6_6I1R6MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA4_6_6I1R6MassTerm : Ball := ⟨(135287634849471878805145624111 / 100000000000000000000000000000000), (11423107 / 25000000000000000000000000000000)⟩ +lemma CA4_6_6I1R6MassTerm_sound : CA4_6_6I1R6MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA4_6_6I1R6Value a))) := by + exact contains_sound (entropyTerm_ball (CA4_6_6I1R6Mass_sound) CA4_6_6I1R6MassTermLog_sound) (by decide +kernel) +def CA4_6_6I1R6H : Ball := ⟨(6923394285522698401461358011 / 50000000000000000000000000000000), (12111281 / 12500000000000000000000000000000)⟩ +lemma CA4_6_6I1R6H_sound : CA4_6_6I1R6H.Encloses (homogeneousEntropy CA4_6_6I1R6Value) := by + exact contains_sound (homogeneous_enclosed CA4_6_6I1R6Value CA4_6_6I1R6MassTerm_sound CA4_6_6I1R6Entropy_sound) (by decide +kernel) +def CA4_6_6I1R7Value (a : PairSlot) : ℝ := residualLaw (below (shape 4 6 6)) (fun u => (stageALaw (shape 4 6 6) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 7 a +def CA4_6_6I1R7Raw (a : PairSlot) : Ball := residualBall (below (shape 4 6 6)) A4_6_6Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 7 a +lemma CA4_6_6I1R7Raw_sound (a : PairSlot) : + (CA4_6_6I1R7Raw a).Encloses (CA4_6_6I1R7Value a) := by + exact residualBall_sound_on (below (shape 4 6 6)) A4_6_6Law (fun u => (stageALaw (shape 4 6 6) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A4_6_6Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 4 6 6) (show (shape 4 6 6) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 7 a +def CA4_6_6I1R7Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA4_6_6I1R7Certificates_valid : + CA4_6_6I1R7Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA4_6_6I1R7CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA4_6_6I1R7P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA4_6_6I1R7Certificates (CA4_6_6I1R7CertificateIndex a)).input +lemma CA4_6_6I1R7P_check : ∀ a : PairSlot, contains (CA4_6_6I1R7Raw a) (CA4_6_6I1R7P a) = true := by + decide +kernel +lemma CA4_6_6I1R7P_sound (a : PairSlot) : + (CA4_6_6I1R7P a).Encloses (CA4_6_6I1R7Value a) := + contains_sound (CA4_6_6I1R7Raw_sound a) (CA4_6_6I1R7P_check a) +def CA4_6_6I1R7Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA4_6_6I1R7Certificates (CA4_6_6I1R7CertificateIndex a)).output +lemma CA4_6_6I1R7Terms_sound (a : PairSlot) : + (CA4_6_6I1R7Terms a).Encloses (Foundation.entropyTerm (CA4_6_6I1R7Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA4_6_6I1R7Certificates_valid + (CA4_6_6I1R7CertificateIndex a) (CA4_6_6I1R7P_sound a) +def CA4_6_6I1R7Entropy : Ball := ⟨0, 0⟩ +lemma CA4_6_6I1R7Entropy_sound : CA4_6_6I1R7Entropy.Encloses (Foundation.finiteEntropy CA4_6_6I1R7Value) := by + exact contains_sound (entropyPair_enclosed CA4_6_6I1R7Value CA4_6_6I1R7Terms CA4_6_6I1R7Terms_sound) (by decide +kernel) +def CA4_6_6I1R7Mass : Ball := ⟨0, 0⟩ +lemma CA4_6_6I1R7Mass_sound : CA4_6_6I1R7Mass.Encloses (∑ a, CA4_6_6I1R7Value a) := by + exact contains_sound (pairSumBall_sound CA4_6_6I1R7P CA4_6_6I1R7Value CA4_6_6I1R7P_sound) (by decide +kernel) +def CA4_6_6I1R7MassTerm : Ball := .exact 0 +lemma CA4_6_6I1R7MassTerm_sound : CA4_6_6I1R7MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA4_6_6I1R7Value a))) := + entropyTerm_zero_ball (CA4_6_6I1R7Mass_sound) +def CA4_6_6I1R7H : Ball := ⟨0, 0⟩ +lemma CA4_6_6I1R7H_sound : CA4_6_6I1R7H.Encloses (homogeneousEntropy CA4_6_6I1R7Value) := by + exact contains_sound (homogeneous_enclosed CA4_6_6I1R7Value CA4_6_6I1R7MassTerm_sound CA4_6_6I1R7Entropy_sound) (by decide +kernel) +def CA4_6_6I1R8Value (a : PairSlot) : ℝ := residualLaw (below (shape 4 6 6)) (fun u => (stageALaw (shape 4 6 6) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 8 a +def CA4_6_6I1R8Raw (a : PairSlot) : Ball := residualBall (below (shape 4 6 6)) A4_6_6Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 8 a +lemma CA4_6_6I1R8Raw_sound (a : PairSlot) : + (CA4_6_6I1R8Raw a).Encloses (CA4_6_6I1R8Value a) := by + exact residualBall_sound_on (below (shape 4 6 6)) A4_6_6Law (fun u => (stageALaw (shape 4 6 6) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A4_6_6Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 4 6 6) (show (shape 4 6 6) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 8 a +def CA4_6_6I1R8Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA4_6_6I1R8Certificates_valid : + CA4_6_6I1R8Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA4_6_6I1R8CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA4_6_6I1R8P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA4_6_6I1R8Certificates (CA4_6_6I1R8CertificateIndex a)).input +lemma CA4_6_6I1R8P_check : ∀ a : PairSlot, contains (CA4_6_6I1R8Raw a) (CA4_6_6I1R8P a) = true := by + decide +kernel +lemma CA4_6_6I1R8P_sound (a : PairSlot) : + (CA4_6_6I1R8P a).Encloses (CA4_6_6I1R8Value a) := + contains_sound (CA4_6_6I1R8Raw_sound a) (CA4_6_6I1R8P_check a) +def CA4_6_6I1R8Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA4_6_6I1R8Certificates (CA4_6_6I1R8CertificateIndex a)).output +lemma CA4_6_6I1R8Terms_sound (a : PairSlot) : + (CA4_6_6I1R8Terms a).Encloses (Foundation.entropyTerm (CA4_6_6I1R8Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA4_6_6I1R8Certificates_valid + (CA4_6_6I1R8CertificateIndex a) (CA4_6_6I1R8P_sound a) +def CA4_6_6I1R8Entropy : Ball := ⟨0, 0⟩ +lemma CA4_6_6I1R8Entropy_sound : CA4_6_6I1R8Entropy.Encloses (Foundation.finiteEntropy CA4_6_6I1R8Value) := by + exact contains_sound (entropyPair_enclosed CA4_6_6I1R8Value CA4_6_6I1R8Terms CA4_6_6I1R8Terms_sound) (by decide +kernel) +def CA4_6_6I1R8Mass : Ball := ⟨0, 0⟩ +lemma CA4_6_6I1R8Mass_sound : CA4_6_6I1R8Mass.Encloses (∑ a, CA4_6_6I1R8Value a) := by + exact contains_sound (pairSumBall_sound CA4_6_6I1R8P CA4_6_6I1R8Value CA4_6_6I1R8P_sound) (by decide +kernel) +def CA4_6_6I1R8MassTerm : Ball := .exact 0 +lemma CA4_6_6I1R8MassTerm_sound : CA4_6_6I1R8MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA4_6_6I1R8Value a))) := + entropyTerm_zero_ball (CA4_6_6I1R8Mass_sound) +def CA4_6_6I1R8H : Ball := ⟨0, 0⟩ +lemma CA4_6_6I1R8H_sound : CA4_6_6I1R8H.Encloses (homogeneousEntropy CA4_6_6I1R8Value) := by + exact contains_sound (homogeneous_enclosed CA4_6_6I1R8Value CA4_6_6I1R8MassTerm_sound CA4_6_6I1R8Entropy_sound) (by decide +kernel) +def CA4_6_6I1R9Value (a : PairSlot) : ℝ := residualLaw (below (shape 4 6 6)) (fun u => (stageALaw (shape 4 6 6) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 9 a +def CA4_6_6I1R9Raw (a : PairSlot) : Ball := residualBall (below (shape 4 6 6)) A4_6_6Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 9 a +lemma CA4_6_6I1R9Raw_sound (a : PairSlot) : + (CA4_6_6I1R9Raw a).Encloses (CA4_6_6I1R9Value a) := by + exact residualBall_sound_on (below (shape 4 6 6)) A4_6_6Law (fun u => (stageALaw (shape 4 6 6) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A4_6_6Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 4 6 6) (show (shape 4 6 6) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 9 a +def CA4_6_6I1R9Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA4_6_6I1R9Certificates_valid : + CA4_6_6I1R9Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA4_6_6I1R9CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA4_6_6I1R9P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA4_6_6I1R9Certificates (CA4_6_6I1R9CertificateIndex a)).input +lemma CA4_6_6I1R9P_check : ∀ a : PairSlot, contains (CA4_6_6I1R9Raw a) (CA4_6_6I1R9P a) = true := by + decide +kernel +lemma CA4_6_6I1R9P_sound (a : PairSlot) : + (CA4_6_6I1R9P a).Encloses (CA4_6_6I1R9Value a) := + contains_sound (CA4_6_6I1R9Raw_sound a) (CA4_6_6I1R9P_check a) +def CA4_6_6I1R9Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA4_6_6I1R9Certificates (CA4_6_6I1R9CertificateIndex a)).output +lemma CA4_6_6I1R9Terms_sound (a : PairSlot) : + (CA4_6_6I1R9Terms a).Encloses (Foundation.entropyTerm (CA4_6_6I1R9Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA4_6_6I1R9Certificates_valid + (CA4_6_6I1R9CertificateIndex a) (CA4_6_6I1R9P_sound a) +def CA4_6_6I1R9Entropy : Ball := ⟨0, 0⟩ +lemma CA4_6_6I1R9Entropy_sound : CA4_6_6I1R9Entropy.Encloses (Foundation.finiteEntropy CA4_6_6I1R9Value) := by + exact contains_sound (entropyPair_enclosed CA4_6_6I1R9Value CA4_6_6I1R9Terms CA4_6_6I1R9Terms_sound) (by decide +kernel) +def CA4_6_6I1R9Mass : Ball := ⟨0, 0⟩ +lemma CA4_6_6I1R9Mass_sound : CA4_6_6I1R9Mass.Encloses (∑ a, CA4_6_6I1R9Value a) := by + exact contains_sound (pairSumBall_sound CA4_6_6I1R9P CA4_6_6I1R9Value CA4_6_6I1R9P_sound) (by decide +kernel) +def CA4_6_6I1R9MassTerm : Ball := .exact 0 +lemma CA4_6_6I1R9MassTerm_sound : CA4_6_6I1R9MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA4_6_6I1R9Value a))) := + entropyTerm_zero_ball (CA4_6_6I1R9Mass_sound) +def CA4_6_6I1R9H : Ball := ⟨0, 0⟩ +lemma CA4_6_6I1R9H_sound : CA4_6_6I1R9H.Encloses (homogeneousEntropy CA4_6_6I1R9Value) := by + exact contains_sound (homogeneous_enclosed CA4_6_6I1R9Value CA4_6_6I1R9MassTerm_sound CA4_6_6I1R9Entropy_sound) (by decide +kernel) +def CA4_6_6I1R10Value (a : PairSlot) : ℝ := residualLaw (below (shape 4 6 6)) (fun u => (stageALaw (shape 4 6 6) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 10 a +def CA4_6_6I1R10Raw (a : PairSlot) : Ball := residualBall (below (shape 4 6 6)) A4_6_6Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 10 a +lemma CA4_6_6I1R10Raw_sound (a : PairSlot) : + (CA4_6_6I1R10Raw a).Encloses (CA4_6_6I1R10Value a) := by + exact residualBall_sound_on (below (shape 4 6 6)) A4_6_6Law (fun u => (stageALaw (shape 4 6 6) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A4_6_6Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 4 6 6) (show (shape 4 6 6) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 10 a +def CA4_6_6I1R10Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA4_6_6I1R10Certificates_valid : + CA4_6_6I1R10Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA4_6_6I1R10CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA4_6_6I1R10P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA4_6_6I1R10Certificates (CA4_6_6I1R10CertificateIndex a)).input +lemma CA4_6_6I1R10P_check : ∀ a : PairSlot, contains (CA4_6_6I1R10Raw a) (CA4_6_6I1R10P a) = true := by + decide +kernel +lemma CA4_6_6I1R10P_sound (a : PairSlot) : + (CA4_6_6I1R10P a).Encloses (CA4_6_6I1R10Value a) := + contains_sound (CA4_6_6I1R10Raw_sound a) (CA4_6_6I1R10P_check a) +def CA4_6_6I1R10Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA4_6_6I1R10Certificates (CA4_6_6I1R10CertificateIndex a)).output +lemma CA4_6_6I1R10Terms_sound (a : PairSlot) : + (CA4_6_6I1R10Terms a).Encloses (Foundation.entropyTerm (CA4_6_6I1R10Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA4_6_6I1R10Certificates_valid + (CA4_6_6I1R10CertificateIndex a) (CA4_6_6I1R10P_sound a) +def CA4_6_6I1R10Entropy : Ball := ⟨0, 0⟩ +lemma CA4_6_6I1R10Entropy_sound : CA4_6_6I1R10Entropy.Encloses (Foundation.finiteEntropy CA4_6_6I1R10Value) := by + exact contains_sound (entropyPair_enclosed CA4_6_6I1R10Value CA4_6_6I1R10Terms CA4_6_6I1R10Terms_sound) (by decide +kernel) +def CA4_6_6I1R10Mass : Ball := ⟨0, 0⟩ +lemma CA4_6_6I1R10Mass_sound : CA4_6_6I1R10Mass.Encloses (∑ a, CA4_6_6I1R10Value a) := by + exact contains_sound (pairSumBall_sound CA4_6_6I1R10P CA4_6_6I1R10Value CA4_6_6I1R10P_sound) (by decide +kernel) +def CA4_6_6I1R10MassTerm : Ball := .exact 0 +lemma CA4_6_6I1R10MassTerm_sound : CA4_6_6I1R10MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA4_6_6I1R10Value a))) := + entropyTerm_zero_ball (CA4_6_6I1R10Mass_sound) +def CA4_6_6I1R10H : Ball := ⟨0, 0⟩ +lemma CA4_6_6I1R10H_sound : CA4_6_6I1R10H.Encloses (homogeneousEntropy CA4_6_6I1R10Value) := by + exact contains_sound (homogeneous_enclosed CA4_6_6I1R10Value CA4_6_6I1R10MassTerm_sound CA4_6_6I1R10Entropy_sound) (by decide +kernel) +def CA4_6_6I1R11Value (a : PairSlot) : ℝ := residualLaw (below (shape 4 6 6)) (fun u => (stageALaw (shape 4 6 6) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 11 a +def CA4_6_6I1R11Raw (a : PairSlot) : Ball := residualBall (below (shape 4 6 6)) A4_6_6Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 11 a +lemma CA4_6_6I1R11Raw_sound (a : PairSlot) : + (CA4_6_6I1R11Raw a).Encloses (CA4_6_6I1R11Value a) := by + exact residualBall_sound_on (below (shape 4 6 6)) A4_6_6Law (fun u => (stageALaw (shape 4 6 6) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A4_6_6Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 4 6 6) (show (shape 4 6 6) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 11 a +def CA4_6_6I1R11Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA4_6_6I1R11Certificates_valid : + CA4_6_6I1R11Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA4_6_6I1R11CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA4_6_6I1R11P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA4_6_6I1R11Certificates (CA4_6_6I1R11CertificateIndex a)).input +lemma CA4_6_6I1R11P_check : ∀ a : PairSlot, contains (CA4_6_6I1R11Raw a) (CA4_6_6I1R11P a) = true := by + decide +kernel +lemma CA4_6_6I1R11P_sound (a : PairSlot) : + (CA4_6_6I1R11P a).Encloses (CA4_6_6I1R11Value a) := + contains_sound (CA4_6_6I1R11Raw_sound a) (CA4_6_6I1R11P_check a) +def CA4_6_6I1R11Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA4_6_6I1R11Certificates (CA4_6_6I1R11CertificateIndex a)).output +lemma CA4_6_6I1R11Terms_sound (a : PairSlot) : + (CA4_6_6I1R11Terms a).Encloses (Foundation.entropyTerm (CA4_6_6I1R11Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA4_6_6I1R11Certificates_valid + (CA4_6_6I1R11CertificateIndex a) (CA4_6_6I1R11P_sound a) +def CA4_6_6I1R11Entropy : Ball := ⟨0, 0⟩ +lemma CA4_6_6I1R11Entropy_sound : CA4_6_6I1R11Entropy.Encloses (Foundation.finiteEntropy CA4_6_6I1R11Value) := by + exact contains_sound (entropyPair_enclosed CA4_6_6I1R11Value CA4_6_6I1R11Terms CA4_6_6I1R11Terms_sound) (by decide +kernel) +def CA4_6_6I1R11Mass : Ball := ⟨0, 0⟩ +lemma CA4_6_6I1R11Mass_sound : CA4_6_6I1R11Mass.Encloses (∑ a, CA4_6_6I1R11Value a) := by + exact contains_sound (pairSumBall_sound CA4_6_6I1R11P CA4_6_6I1R11Value CA4_6_6I1R11P_sound) (by decide +kernel) +def CA4_6_6I1R11MassTerm : Ball := .exact 0 +lemma CA4_6_6I1R11MassTerm_sound : CA4_6_6I1R11MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA4_6_6I1R11Value a))) := + entropyTerm_zero_ball (CA4_6_6I1R11Mass_sound) +def CA4_6_6I1R11H : Ball := ⟨0, 0⟩ +lemma CA4_6_6I1R11H_sound : CA4_6_6I1R11H.Encloses (homogeneousEntropy CA4_6_6I1R11Value) := by + exact contains_sound (homogeneous_enclosed CA4_6_6I1R11Value CA4_6_6I1R11MassTerm_sound CA4_6_6I1R11Entropy_sound) (by decide +kernel) +def CA4_6_6I1R12Value (a : PairSlot) : ℝ := residualLaw (below (shape 4 6 6)) (fun u => (stageALaw (shape 4 6 6) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 12 a +def CA4_6_6I1R12Raw (a : PairSlot) : Ball := residualBall (below (shape 4 6 6)) A4_6_6Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 12 a +lemma CA4_6_6I1R12Raw_sound (a : PairSlot) : + (CA4_6_6I1R12Raw a).Encloses (CA4_6_6I1R12Value a) := by + exact residualBall_sound_on (below (shape 4 6 6)) A4_6_6Law (fun u => (stageALaw (shape 4 6 6) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A4_6_6Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 4 6 6) (show (shape 4 6 6) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 12 a +def CA4_6_6I1R12Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA4_6_6I1R12Certificates_valid : + CA4_6_6I1R12Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA4_6_6I1R12CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA4_6_6I1R12P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA4_6_6I1R12Certificates (CA4_6_6I1R12CertificateIndex a)).input +lemma CA4_6_6I1R12P_check : ∀ a : PairSlot, contains (CA4_6_6I1R12Raw a) (CA4_6_6I1R12P a) = true := by + decide +kernel +lemma CA4_6_6I1R12P_sound (a : PairSlot) : + (CA4_6_6I1R12P a).Encloses (CA4_6_6I1R12Value a) := + contains_sound (CA4_6_6I1R12Raw_sound a) (CA4_6_6I1R12P_check a) +def CA4_6_6I1R12Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA4_6_6I1R12Certificates (CA4_6_6I1R12CertificateIndex a)).output +lemma CA4_6_6I1R12Terms_sound (a : PairSlot) : + (CA4_6_6I1R12Terms a).Encloses (Foundation.entropyTerm (CA4_6_6I1R12Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA4_6_6I1R12Certificates_valid + (CA4_6_6I1R12CertificateIndex a) (CA4_6_6I1R12P_sound a) +def CA4_6_6I1R12Entropy : Ball := ⟨0, 0⟩ +lemma CA4_6_6I1R12Entropy_sound : CA4_6_6I1R12Entropy.Encloses (Foundation.finiteEntropy CA4_6_6I1R12Value) := by + exact contains_sound (entropyPair_enclosed CA4_6_6I1R12Value CA4_6_6I1R12Terms CA4_6_6I1R12Terms_sound) (by decide +kernel) +def CA4_6_6I1R12Mass : Ball := ⟨0, 0⟩ +lemma CA4_6_6I1R12Mass_sound : CA4_6_6I1R12Mass.Encloses (∑ a, CA4_6_6I1R12Value a) := by + exact contains_sound (pairSumBall_sound CA4_6_6I1R12P CA4_6_6I1R12Value CA4_6_6I1R12P_sound) (by decide +kernel) +def CA4_6_6I1R12MassTerm : Ball := .exact 0 +lemma CA4_6_6I1R12MassTerm_sound : CA4_6_6I1R12MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA4_6_6I1R12Value a))) := + entropyTerm_zero_ball (CA4_6_6I1R12Mass_sound) +def CA4_6_6I1R12H : Ball := ⟨0, 0⟩ +lemma CA4_6_6I1R12H_sound : CA4_6_6I1R12H.Encloses (homogeneousEntropy CA4_6_6I1R12Value) := by + exact contains_sound (homogeneous_enclosed CA4_6_6I1R12Value CA4_6_6I1R12MassTerm_sound CA4_6_6I1R12Entropy_sound) (by decide +kernel) +def CA4_6_6I1R13Value (a : PairSlot) : ℝ := residualLaw (below (shape 4 6 6)) (fun u => (stageALaw (shape 4 6 6) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 13 a +def CA4_6_6I1R13Raw (a : PairSlot) : Ball := residualBall (below (shape 4 6 6)) A4_6_6Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 13 a +lemma CA4_6_6I1R13Raw_sound (a : PairSlot) : + (CA4_6_6I1R13Raw a).Encloses (CA4_6_6I1R13Value a) := by + exact residualBall_sound_on (below (shape 4 6 6)) A4_6_6Law (fun u => (stageALaw (shape 4 6 6) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A4_6_6Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 4 6 6) (show (shape 4 6 6) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 13 a +def CA4_6_6I1R13Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA4_6_6I1R13Certificates_valid : + CA4_6_6I1R13Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA4_6_6I1R13CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA4_6_6I1R13P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA4_6_6I1R13Certificates (CA4_6_6I1R13CertificateIndex a)).input +lemma CA4_6_6I1R13P_check : ∀ a : PairSlot, contains (CA4_6_6I1R13Raw a) (CA4_6_6I1R13P a) = true := by + decide +kernel +lemma CA4_6_6I1R13P_sound (a : PairSlot) : + (CA4_6_6I1R13P a).Encloses (CA4_6_6I1R13Value a) := + contains_sound (CA4_6_6I1R13Raw_sound a) (CA4_6_6I1R13P_check a) +def CA4_6_6I1R13Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA4_6_6I1R13Certificates (CA4_6_6I1R13CertificateIndex a)).output +lemma CA4_6_6I1R13Terms_sound (a : PairSlot) : + (CA4_6_6I1R13Terms a).Encloses (Foundation.entropyTerm (CA4_6_6I1R13Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA4_6_6I1R13Certificates_valid + (CA4_6_6I1R13CertificateIndex a) (CA4_6_6I1R13P_sound a) +def CA4_6_6I1R13Entropy : Ball := ⟨0, 0⟩ +lemma CA4_6_6I1R13Entropy_sound : CA4_6_6I1R13Entropy.Encloses (Foundation.finiteEntropy CA4_6_6I1R13Value) := by + exact contains_sound (entropyPair_enclosed CA4_6_6I1R13Value CA4_6_6I1R13Terms CA4_6_6I1R13Terms_sound) (by decide +kernel) +def CA4_6_6I1R13Mass : Ball := ⟨0, 0⟩ +lemma CA4_6_6I1R13Mass_sound : CA4_6_6I1R13Mass.Encloses (∑ a, CA4_6_6I1R13Value a) := by + exact contains_sound (pairSumBall_sound CA4_6_6I1R13P CA4_6_6I1R13Value CA4_6_6I1R13P_sound) (by decide +kernel) +def CA4_6_6I1R13MassTerm : Ball := .exact 0 +lemma CA4_6_6I1R13MassTerm_sound : CA4_6_6I1R13MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA4_6_6I1R13Value a))) := + entropyTerm_zero_ball (CA4_6_6I1R13Mass_sound) +def CA4_6_6I1R13H : Ball := ⟨0, 0⟩ +lemma CA4_6_6I1R13H_sound : CA4_6_6I1R13H.Encloses (homogeneousEntropy CA4_6_6I1R13Value) := by + exact contains_sound (homogeneous_enclosed CA4_6_6I1R13Value CA4_6_6I1R13MassTerm_sound CA4_6_6I1R13Entropy_sound) (by decide +kernel) +def CA4_6_6I1R14Value (a : PairSlot) : ℝ := residualLaw (below (shape 4 6 6)) (fun u => (stageALaw (shape 4 6 6) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 14 a +def CA4_6_6I1R14Raw (a : PairSlot) : Ball := residualBall (below (shape 4 6 6)) A4_6_6Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 14 a +lemma CA4_6_6I1R14Raw_sound (a : PairSlot) : + (CA4_6_6I1R14Raw a).Encloses (CA4_6_6I1R14Value a) := by + exact residualBall_sound_on (below (shape 4 6 6)) A4_6_6Law (fun u => (stageALaw (shape 4 6 6) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A4_6_6Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 4 6 6) (show (shape 4 6 6) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 14 a +def CA4_6_6I1R14Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA4_6_6I1R14Certificates_valid : + CA4_6_6I1R14Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA4_6_6I1R14CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA4_6_6I1R14P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA4_6_6I1R14Certificates (CA4_6_6I1R14CertificateIndex a)).input +lemma CA4_6_6I1R14P_check : ∀ a : PairSlot, contains (CA4_6_6I1R14Raw a) (CA4_6_6I1R14P a) = true := by + decide +kernel +lemma CA4_6_6I1R14P_sound (a : PairSlot) : + (CA4_6_6I1R14P a).Encloses (CA4_6_6I1R14Value a) := + contains_sound (CA4_6_6I1R14Raw_sound a) (CA4_6_6I1R14P_check a) +def CA4_6_6I1R14Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA4_6_6I1R14Certificates (CA4_6_6I1R14CertificateIndex a)).output +lemma CA4_6_6I1R14Terms_sound (a : PairSlot) : + (CA4_6_6I1R14Terms a).Encloses (Foundation.entropyTerm (CA4_6_6I1R14Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA4_6_6I1R14Certificates_valid + (CA4_6_6I1R14CertificateIndex a) (CA4_6_6I1R14P_sound a) +def CA4_6_6I1R14Entropy : Ball := ⟨0, 0⟩ +lemma CA4_6_6I1R14Entropy_sound : CA4_6_6I1R14Entropy.Encloses (Foundation.finiteEntropy CA4_6_6I1R14Value) := by + exact contains_sound (entropyPair_enclosed CA4_6_6I1R14Value CA4_6_6I1R14Terms CA4_6_6I1R14Terms_sound) (by decide +kernel) +def CA4_6_6I1R14Mass : Ball := ⟨0, 0⟩ +lemma CA4_6_6I1R14Mass_sound : CA4_6_6I1R14Mass.Encloses (∑ a, CA4_6_6I1R14Value a) := by + exact contains_sound (pairSumBall_sound CA4_6_6I1R14P CA4_6_6I1R14Value CA4_6_6I1R14P_sound) (by decide +kernel) +def CA4_6_6I1R14MassTerm : Ball := .exact 0 +lemma CA4_6_6I1R14MassTerm_sound : CA4_6_6I1R14MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA4_6_6I1R14Value a))) := + entropyTerm_zero_ball (CA4_6_6I1R14Mass_sound) +def CA4_6_6I1R14H : Ball := ⟨0, 0⟩ +lemma CA4_6_6I1R14H_sound : CA4_6_6I1R14H.Encloses (homogeneousEntropy CA4_6_6I1R14Value) := by + exact contains_sound (homogeneous_enclosed CA4_6_6I1R14Value CA4_6_6I1R14MassTerm_sound CA4_6_6I1R14Entropy_sound) (by decide +kernel) +def CA4_6_6I1R15Value (a : PairSlot) : ℝ := residualLaw (below (shape 4 6 6)) (fun u => (stageALaw (shape 4 6 6) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 15 a +def CA4_6_6I1R15Raw (a : PairSlot) : Ball := residualBall (below (shape 4 6 6)) A4_6_6Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 15 a +lemma CA4_6_6I1R15Raw_sound (a : PairSlot) : + (CA4_6_6I1R15Raw a).Encloses (CA4_6_6I1R15Value a) := by + exact residualBall_sound_on (below (shape 4 6 6)) A4_6_6Law (fun u => (stageALaw (shape 4 6 6) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A4_6_6Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 4 6 6) (show (shape 4 6 6) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 15 a +def CA4_6_6I1R15Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA4_6_6I1R15Certificates_valid : + CA4_6_6I1R15Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA4_6_6I1R15CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA4_6_6I1R15P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA4_6_6I1R15Certificates (CA4_6_6I1R15CertificateIndex a)).input +lemma CA4_6_6I1R15P_check : ∀ a : PairSlot, contains (CA4_6_6I1R15Raw a) (CA4_6_6I1R15P a) = true := by + decide +kernel +lemma CA4_6_6I1R15P_sound (a : PairSlot) : + (CA4_6_6I1R15P a).Encloses (CA4_6_6I1R15Value a) := + contains_sound (CA4_6_6I1R15Raw_sound a) (CA4_6_6I1R15P_check a) +def CA4_6_6I1R15Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA4_6_6I1R15Certificates (CA4_6_6I1R15CertificateIndex a)).output +lemma CA4_6_6I1R15Terms_sound (a : PairSlot) : + (CA4_6_6I1R15Terms a).Encloses (Foundation.entropyTerm (CA4_6_6I1R15Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA4_6_6I1R15Certificates_valid + (CA4_6_6I1R15CertificateIndex a) (CA4_6_6I1R15P_sound a) +def CA4_6_6I1R15Entropy : Ball := ⟨0, 0⟩ +lemma CA4_6_6I1R15Entropy_sound : CA4_6_6I1R15Entropy.Encloses (Foundation.finiteEntropy CA4_6_6I1R15Value) := by + exact contains_sound (entropyPair_enclosed CA4_6_6I1R15Value CA4_6_6I1R15Terms CA4_6_6I1R15Terms_sound) (by decide +kernel) +def CA4_6_6I1R15Mass : Ball := ⟨0, 0⟩ +lemma CA4_6_6I1R15Mass_sound : CA4_6_6I1R15Mass.Encloses (∑ a, CA4_6_6I1R15Value a) := by + exact contains_sound (pairSumBall_sound CA4_6_6I1R15P CA4_6_6I1R15Value CA4_6_6I1R15P_sound) (by decide +kernel) +def CA4_6_6I1R15MassTerm : Ball := .exact 0 +lemma CA4_6_6I1R15MassTerm_sound : CA4_6_6I1R15MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA4_6_6I1R15Value a))) := + entropyTerm_zero_ball (CA4_6_6I1R15Mass_sound) +def CA4_6_6I1R15H : Ball := ⟨0, 0⟩ +lemma CA4_6_6I1R15H_sound : CA4_6_6I1R15H.Encloses (homogeneousEntropy CA4_6_6I1R15Value) := by + exact contains_sound (homogeneous_enclosed CA4_6_6I1R15Value CA4_6_6I1R15MassTerm_sound CA4_6_6I1R15Entropy_sound) (by decide +kernel) +def CA4_6_6I1R16Value (a : PairSlot) : ℝ := residualLaw (below (shape 4 6 6)) (fun u => (stageALaw (shape 4 6 6) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 16 a +def CA4_6_6I1R16Raw (a : PairSlot) : Ball := residualBall (below (shape 4 6 6)) A4_6_6Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 16 a +lemma CA4_6_6I1R16Raw_sound (a : PairSlot) : + (CA4_6_6I1R16Raw a).Encloses (CA4_6_6I1R16Value a) := by + exact residualBall_sound_on (below (shape 4 6 6)) A4_6_6Law (fun u => (stageALaw (shape 4 6 6) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A4_6_6Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 4 6 6) (show (shape 4 6 6) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 16 a +def CA4_6_6I1R16Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA4_6_6I1R16Certificates_valid : + CA4_6_6I1R16Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA4_6_6I1R16CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA4_6_6I1R16P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA4_6_6I1R16Certificates (CA4_6_6I1R16CertificateIndex a)).input +lemma CA4_6_6I1R16P_check : ∀ a : PairSlot, contains (CA4_6_6I1R16Raw a) (CA4_6_6I1R16P a) = true := by + decide +kernel +lemma CA4_6_6I1R16P_sound (a : PairSlot) : + (CA4_6_6I1R16P a).Encloses (CA4_6_6I1R16Value a) := + contains_sound (CA4_6_6I1R16Raw_sound a) (CA4_6_6I1R16P_check a) +def CA4_6_6I1R16Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA4_6_6I1R16Certificates (CA4_6_6I1R16CertificateIndex a)).output +lemma CA4_6_6I1R16Terms_sound (a : PairSlot) : + (CA4_6_6I1R16Terms a).Encloses (Foundation.entropyTerm (CA4_6_6I1R16Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA4_6_6I1R16Certificates_valid + (CA4_6_6I1R16CertificateIndex a) (CA4_6_6I1R16P_sound a) +def CA4_6_6I1R16Entropy : Ball := ⟨0, 0⟩ +lemma CA4_6_6I1R16Entropy_sound : CA4_6_6I1R16Entropy.Encloses (Foundation.finiteEntropy CA4_6_6I1R16Value) := by + exact contains_sound (entropyPair_enclosed CA4_6_6I1R16Value CA4_6_6I1R16Terms CA4_6_6I1R16Terms_sound) (by decide +kernel) +def CA4_6_6I1R16Mass : Ball := ⟨0, 0⟩ +lemma CA4_6_6I1R16Mass_sound : CA4_6_6I1R16Mass.Encloses (∑ a, CA4_6_6I1R16Value a) := by + exact contains_sound (pairSumBall_sound CA4_6_6I1R16P CA4_6_6I1R16Value CA4_6_6I1R16P_sound) (by decide +kernel) +def CA4_6_6I1R16MassTerm : Ball := .exact 0 +lemma CA4_6_6I1R16MassTerm_sound : CA4_6_6I1R16MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA4_6_6I1R16Value a))) := + entropyTerm_zero_ball (CA4_6_6I1R16Mass_sound) +def CA4_6_6I1R16H : Ball := ⟨0, 0⟩ +lemma CA4_6_6I1R16H_sound : CA4_6_6I1R16H.Encloses (homogeneousEntropy CA4_6_6I1R16Value) := by + exact contains_sound (homogeneous_enclosed CA4_6_6I1R16Value CA4_6_6I1R16MassTerm_sound CA4_6_6I1R16Entropy_sound) (by decide +kernel) +def CA4_6_6I1ResidualEntropies (a : Fin 17) : Ball := + match a.val with + | 0 => CA4_6_6I1R0H + | 1 => CA4_6_6I1R1H + | 2 => CA4_6_6I1R2H + | 3 => CA4_6_6I1R3H + | 4 => CA4_6_6I1R4H + | 5 => CA4_6_6I1R5H + | 6 => CA4_6_6I1R6H + | 7 => CA4_6_6I1R7H + | 8 => CA4_6_6I1R8H + | 9 => CA4_6_6I1R9H + | 10 => CA4_6_6I1R10H + | 11 => CA4_6_6I1R11H + | 12 => CA4_6_6I1R12H + | 13 => CA4_6_6I1R13H + | 14 => CA4_6_6I1R14H + | 15 => CA4_6_6I1R15H + | 16 => CA4_6_6I1R16H + | _ => (.exact 0) +lemma CA4_6_6I1ResidualEntropies_sound (k : Fin 17) : + (CA4_6_6I1ResidualEntropies k).Encloses (homogeneousEntropy + (residualLaw (below (shape 4 6 6)) (fun u => (stageALaw (shape 4 6 6) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) k)) := by + fin_cases k + · exact CA4_6_6I1R0H_sound + · exact CA4_6_6I1R1H_sound + · exact CA4_6_6I1R2H_sound + · exact CA4_6_6I1R3H_sound + · exact CA4_6_6I1R4H_sound + · exact CA4_6_6I1R5H_sound + · exact CA4_6_6I1R6H_sound + · exact CA4_6_6I1R7H_sound + · exact CA4_6_6I1R8H_sound + · exact CA4_6_6I1R9H_sound + · exact CA4_6_6I1R10H_sound + · exact CA4_6_6I1R11H_sound + · exact CA4_6_6I1R12H_sound + · exact CA4_6_6I1R13H_sound + · exact CA4_6_6I1R14H_sound + · exact CA4_6_6I1R15H_sound + · exact CA4_6_6I1R16H_sound +def CA4_6_6I1Singles (s : Shape) : Ball := + match s 0, s 1, s 2 with + | 2, 6, 0 => Z2_6_0H1H + | 3, 5, 0 => Z3_5_0H1H + | 4, 4, 0 => Z4_4_0H1H + | _, _, _ => (.exact 0) +lemma CA4_6_6I1Singles_sound (u : Shape) (hu : u ∈ below (shape 4 6 6)) + (hd : designated (Equiv.refl (Fin 3)) 1 u) : + (CA4_6_6I1Singles u).Encloses (homogeneousEntropy ((fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) u)) := by + rw [A4_6_6_below] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 0 2 6) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 0 3 5) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 0 4 4) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 0 5 3) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 0 6 2) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 1 1 6) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 1 2 5) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 1 3 4) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 1 4 3) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 1 5 2) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 1 6 1) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 2 0 6) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 2 1 5) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 2 2 4) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 2 3 3) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 2 4 2) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 2 5 1) by decide +kernel) hd |>.elim + · exact Z2_6_0H1H_sound + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 3 0 5) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 3 1 4) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 3 2 3) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 3 3 2) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 3 4 1) by decide +kernel) hd |>.elim + · exact Z3_5_0H1H_sound + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 4 0 4) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 4 1 3) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 4 2 2) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 4 3 1) by decide +kernel) hd |>.elim + · exact Z4_4_0H1H_sound +def CA4_6_6I1Singleton : Ball := ⟨(1242243551352522190804190177 / 6250000000000000000000000000000), (16424641 / 100000000000000000000000000000000)⟩ +lemma CA4_6_6I1Singleton_sound : CA4_6_6I1Singleton.Encloses + (singletonEntropy (below (shape 4 6 6)) (fun u => (stageALaw (shape 4 6 6) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ))) := by + exact contains_sound (singletonBall_sound (below (shape 4 6 6)) A4_6_6Law (fun u => (stageALaw (shape 4 6 6) u : ℝ)) (Equiv.refl (Fin 3)) 1 + CA4_6_6I1Singles (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A4_6_6Law_sound u) CA4_6_6I1Singles_sound) (by decide +kernel) +def CA4_6_6I1Group : Ball := ⟨(10016279990045507878449182831717 / 10000000000000000000000000000000), (41175691719 / 25000000000000000000000000000000)⟩ +lemma CA4_6_6I1Group_sound : CA4_6_6I1Group.Encloses + (groupedEntropy (below (shape 4 6 6)) (fun u => (stageALaw (shape 4 6 6) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ))) := by + exact contains_sound (Ball.add_sound CA4_6_6I1Singleton_sound + (finSumBall_sound 17 CA4_6_6I1ResidualEntropies _ CA4_6_6I1ResidualEntropies_sound)) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CA4_6_6I1H : Ball := ⟨(113664929699492447966129481449713 / 100000000000000000000000000000000), (101052621527 / 20000000000000000000000000000000)⟩ +lemma CA4_6_6I1_sound : CA4_6_6I1H.Encloses (stageACapacity (shape 4 6 6) 1) := by + have hb := contains_sound (Ball.add_sound CA4_6_6I1PairH_sound + (Ball.neg_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) CA4_6_6I1Group_sound))) + (show contains (.add CA4_6_6I1PairH (.neg (.mul (.exact 2) CA4_6_6I1Group))) CA4_6_6I1H = true by decide +kernel) + unfold CA4_6_6I1PairValue at hb + simpa only [stageACapacity, nativeCapacity, + show (1 : Fin 3) ≠ 0 by decide, ite_false, sub_eq_add_neg] using hb + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA4_6_6I1Pair.lean b/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA4_6_6I1Pair.lean new file mode 100644 index 0000000000000000000000000000000000000000..120d8d5a99118f073e612dbceba17747b476cf8c --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA4_6_6I1Pair.lean @@ -0,0 +1,324 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Certificates.SupportedContraction + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CA4_6_6I1PairValue (a : PairSlot × PairSlot) : ℝ := pairLaw (below (shape 4 6 6)) (shape 4 6 6) (fun u => (stageALaw (shape 4 6 6) u : ℝ)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) a +def CA4_6_6I1PairRaw (a : PairSlot × PairSlot) : Ball := stageAPairBall (shape 4 6 6) A4_6_6Law 1 a +lemma CA4_6_6I1PairRaw_sound (a : PairSlot × PairSlot) : + (CA4_6_6I1PairRaw a).Encloses (CA4_6_6I1PairValue a) := by + exact stageAPairBall_sound (shape 4 6 6) (by decide +kernel) A4_6_6Law (fun u => (stageALaw (shape 4 6 6) u : ℝ)) (fun u _ => A4_6_6Law_sound u) 1 a +def CA4_6_6I1PairCertificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(350955637460838312116965049 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(9607922097754635353432764331 / 50000000000000000000000000000000), (6317021 / 100000000000000000000000000000000)⟩ ⟨(-547529150252031135296091881167793 / 50000000000000000000000000000000), (179994529799 / 50000000000000000000000000000000)⟩ ⟨-16, 350955637460838312116965049, 305175781250000000000000000⟩, + .log ⟨(1289917026795402027616042119 / 400000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ ⟨(14453335492325513263833546131 / 781250000000000000000000000000), (1333743 / 195312500000000000000000000000)⟩ ⟨(-114737733022333663135649784246429 / 20000000000000000000000000000000), (21175823807 / 10000000000000000000000000000000)⟩ ⟨-9, 1289917026795402027616042119, 781250000000000000000000000⟩, + .log ⟨(591799892620090875464291897901 / 20000000000000000000000000000000), (27 / 100000000000000000000000000000000)⟩ ⟨(2604155503309152884378594680077 / 25000000000000000000000000000000), (2193073843 / 50000000000000000000000000000000)⟩ ⟨(-352031899401631627974295546328059 / 100000000000000000000000000000000), (148230766693 / 100000000000000000000000000000000)⟩ ⟨-6, 591799892620090875464291897901, 312500000000000000000000000000⟩, + .log ⟨(31245664197141811739312699229 / 20000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ ⟨(1009486001804619198663697638999 / 100000000000000000000000000000000), (363908987 / 100000000000000000000000000000000)⟩ ⟨(-323080346583562670448877822060853 / 50000000000000000000000000000000), (232934061793 / 100000000000000000000000000000000)⟩ ⟨-10, 31245664197141811739312699229, 19531250000000000000000000000⟩, + .log ⟨(385203686749866927666905367 / 5000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(36483319976161832787580721781 / 50000000000000000000000000000000), (24471027 / 100000000000000000000000000000000)⟩ ⟨(-947117621951847435238690354372917 / 100000000000000000000000000000000), (12705494729 / 4000000000000000000000000000000)⟩ ⟨-14, 385203686749866927666905367, 305175781250000000000000000⟩, + .log ⟨(143942139341538081461293307 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(968102242487693149917022137 / 50000000000000000000000000000000), (128023 / 20000000000000000000000000000000)⟩ ⟨(-1345126933525189296966739241104313 / 100000000000000000000000000000000), (222346496033 / 50000000000000000000000000000000)⟩ ⟨-20, 143942139341538081461293307, 95367431640625000000000000⟩, + .log ⟨(2478797044781559014865685107 / 10000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(41160757048079573498573174737 / 20000000000000000000000000000000), (272951 / 400000000000000000000000000000)⟩ ⟨(-830256699206828676132201436969067 / 100000000000000000000000000000000), (34410713989 / 12500000000000000000000000000000)⟩ ⟨-12, 2478797044781559014865685107, 2441406250000000000000000000⟩, + .log ⟨(111904025404662966558442042531 / 50000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ ⟨(1365707319817381687797716951317 / 100000000000000000000000000000000), (118483001 / 25000000000000000000000000000000)⟩ ⟨(-610213669650740539444439364157891 / 100000000000000000000000000000000), (21175823817 / 10000000000000000000000000000000)⟩ ⟨-9, 111904025404662966558442042531, 97656250000000000000000000000⟩, + .log ⟨(11705100398859448652586644809 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(26491278152106248283430487983 / 25000000000000000000000000000000), (18589891 / 50000000000000000000000000000000)⟩ ⟨(-226322519665765300321372979398071 / 25000000000000000000000000000000), (79409340947 / 25000000000000000000000000000000)⟩ ⟨-14, 11705100398859448652586644809, 6103515625000000000000000000⟩, + .log ⟨(18715874813652882156312309 / 2500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(276115984386050205585725513 / 3125000000000000000000000000000), (753019 / 25000000000000000000000000000000)⟩ ⟨(-73765182534943206797909391872199 / 6250000000000000000000000000000), (402340783553 / 100000000000000000000000000000000)⟩ ⟨-18, 18715874813652882156312309, 9536743164062500000000000⟩, + .log ⟨(6489755786271867153923531917 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(12515754356355787237269931367 / 20000000000000000000000000000000), (206139 / 1000000000000000000000000000000)⟩ ⟨(-38570802256784583806109227398829 / 4000000000000000000000000000000), (317637370653 / 100000000000000000000000000000000)⟩ ⟨-14, 6489755786271867153923531917, 6103515625000000000000000000⟩, + .log ⟨(1187101752415406624133142481991 / 100000000000000000000000000000000), (11 / 100000000000000000000000000000000)⟩ ⟨(1052640007520934483978573754101 / 20000000000000000000000000000000), (2011028653 / 100000000000000000000000000000000)⟩ ⟨(-110841383792408525938955298355987 / 25000000000000000000000000000000), (16940659039 / 10000000000000000000000000000000)⟩ ⟨-7, 1187101752415406624133142481991, 781250000000000000000000000000⟩, + .log ⟨(1360070911916048179028811049801 / 12500000000000000000000000000000), (19 / 25000000000000000000000000000000)⟩ ⟨(6033796301531285488105933240487 / 25000000000000000000000000000000), (720015561 / 6250000000000000000000000000000)⟩ ⟨(-221819180480485416434647066580553 / 100000000000000000000000000000000), (105879119113 / 100000000000000000000000000000000)⟩ ⟨-4, 1360070911916048179028811049801, 781250000000000000000000000000⟩, + .log ⟨(143493876036707703891870556601 / 25000000000000000000000000000000), (1 / 20000000000000000000000000000000)⟩ ⟨(118476321315245827273207138167 / 4000000000000000000000000000000), (546948199 / 50000000000000000000000000000000)⟩ ⟨(-516033874526368103552139440722193 / 100000000000000000000000000000000), (95291207009 / 50000000000000000000000000000000)⟩ ⟨-8, 143493876036707703891870556601, 97656250000000000000000000000⟩, + .log ⟨(14463852249119505851833545803 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(235706572345217052875190714821 / 100000000000000000000000000000000), (39816923 / 50000000000000000000000000000000)⟩ ⟨(-814812569589010447969359696519109 / 100000000000000000000000000000000), (55057142267 / 20000000000000000000000000000000)⟩ ⟨-12, 14463852249119505851833545803, 12207031250000000000000000000⟩, + .log ⟨(1142793333319279907809131399 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(42511950239948807710825528199 / 50000000000000000000000000000000), (29039519 / 100000000000000000000000000000000)⟩ ⟨(-11625010456962799014381112613619 / 1250000000000000000000000000000), (317637366183 / 100000000000000000000000000000000)⟩ ⟨-14, 1142793333319279907809131399, 762939453125000000000000000⟩, + .log ⟨(77946417746466909080968075963 / 25000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ ⟨(1799193344101268964624977139341 / 100000000000000000000000000000000), (660231861 / 100000000000000000000000000000000)⟩ ⟨(-577060946518873638750361015964959 / 100000000000000000000000000000000), (6617444931 / 3125000000000000000000000000000)⟩ ⟨-9, 77946417746466909080968075963, 48828125000000000000000000000⟩, + .log ⟨(11007736053087295939979196309 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(185396252978115614810822174527 / 100000000000000000000000000000000), (8158427 / 12500000000000000000000000000000)⟩ ⟨(-842117998124229483495724499038939 / 100000000000000000000000000000000), (37057692013 / 12500000000000000000000000000000)⟩ ⟨-13, 11007736053087295939979196309, 6103515625000000000000000000⟩, + .log ⟨(10633925292569538579319735870887 / 100000000000000000000000000000000), (51 / 100000000000000000000000000000000)⟩ ⟨(5957977779782664368830314094011 / 25000000000000000000000000000000), (11259106519 / 100000000000000000000000000000000)⟩ ⟨(-22411207962673218224572092180529 / 10000000000000000000000000000000), (52939559447 / 50000000000000000000000000000000)⟩ ⟨-4, 10633925292569538579319735870887, 6250000000000000000000000000000⟩, + .log ⟨(150317524113242796842626551289 / 20000000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ ⟨(229738617935105291520327211947 / 6250000000000000000000000000000), (179049231 / 12500000000000000000000000000000)⟩ ⟨(-489073766834062621120986845784583 / 100000000000000000000000000000000), (190582413679 / 100000000000000000000000000000000)⟩ ⟨-8, 150317524113242796842626551289, 78125000000000000000000000000⟩, + .log ⟨(629320936436830480609567051 / 1250000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(191162848603050590009862444193 / 50000000000000000000000000000000), (63966673 / 50000000000000000000000000000000)⟩ ⟨(-37970063749467954383734056290793 / 5000000000000000000000000000000), (254109886181 / 100000000000000000000000000000000)⟩ ⟨-11, 629320936436830480609567051, 610351562500000000000000000⟩, + .log ⟨(7716106991746275897956951483 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(18267141599512396606455688107 / 25000000000000000000000000000000), (24509249 / 100000000000000000000000000000000)⟩ ⟨(-946961550380381974312290705988987 / 100000000000000000000000000000000), (79409342051 / 25000000000000000000000000000000)⟩ ⟨-14, 7716106991746275897956951483, 6103515625000000000000000000⟩, + .log ⟨(314392474704980220009959103637 / 100000000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ ⟨(905809259625545714685797644691 / 50000000000000000000000000000000), (665751989 / 100000000000000000000000000000000)⟩ ⟨(-23049133360473452713696061475649 / 4000000000000000000000000000000), (105879119051 / 50000000000000000000000000000000)⟩ ⟨-9, 314392474704980220009959103637, 195312500000000000000000000000⟩, + .log ⟨(17965769873029876636872913283 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(19368126647273236930134903311 / 12500000000000000000000000000000), (53261607 / 100000000000000000000000000000000)⟩ ⟨(-10780571489089688958284421772753 / 1250000000000000000000000000000), (296461537127 / 100000000000000000000000000000000)⟩ ⟨-13, 17965769873029876636872913283, 12207031250000000000000000000⟩, + .log ⟨(2278944940156744229302286769 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(6090031898734875129331187347 / 25000000000000000000000000000000), (2050991 / 25000000000000000000000000000000)⟩ ⟨(-213784257492978554220268454098969 / 20000000000000000000000000000000), (35998904649 / 10000000000000000000000000000000)⟩ ⟨-16, 2278944940156744229302286769, 1525878906250000000000000000⟩, + .log ⟨(149225657664363969173814413 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(2001895191764416380795917087 / 100000000000000000000000000000000), (66361 / 10000000000000000000000000000000)⟩ ⟨(-1341522110270773906967411194047249 / 100000000000000000000000000000000), (111173241867 / 25000000000000000000000000000000)⟩ ⟨-20, 149225657664363969173814413, 95367431640625000000000000⟩, + .log ⟨(2183524872083401463902931913 / 20000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ ⟨(24899135523933509979125325467 / 25000000000000000000000000000000), (8669621 / 25000000000000000000000000000000)⟩ ⟨(-912254706773313741457941027033801 / 100000000000000000000000000000000), (317637382723 / 100000000000000000000000000000000)⟩ ⟨-14, 2183524872083401463902931913, 1220703125000000000000000000⟩] +lemma CA4_6_6I1PairCertificates_valid : + CA4_6_6I1PairCertificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA4_6_6I1PairCertificateIndex (a : PairSlot × PairSlot) : ℕ := + match a.1.1.val, a.1.2.val, a.2.1.val, a.2.2.val with + | 2, 0, 5, 0 => 1 + | 2, 0, 4, 1 => 2 + | 2, 0, 2, 2 => 3 + | 2, 0, 2, 3 => 4 + | 2, 0, 3, 2 => 4 + | 2, 0, 3, 3 => 5 + | 2, 0, 1, 4 => 2 + | 2, 0, 0, 5 => 1 + | 3, 0, 5, 0 => 6 + | 3, 0, 4, 1 => 7 + | 3, 0, 2, 2 => 8 + | 3, 0, 2, 3 => 9 + | 3, 0, 3, 2 => 9 + | 3, 0, 3, 3 => 10 + | 3, 0, 1, 4 => 7 + | 3, 0, 0, 5 => 6 + | 1, 1, 5, 0 => 11 + | 1, 1, 4, 1 => 12 + | 1, 1, 2, 2 => 13 + | 1, 1, 2, 3 => 14 + | 1, 1, 3, 2 => 14 + | 1, 1, 3, 3 => 15 + | 1, 1, 1, 4 => 12 + | 1, 1, 0, 5 => 11 + | 0, 2, 5, 0 => 1 + | 0, 2, 4, 1 => 2 + | 0, 2, 2, 2 => 3 + | 0, 2, 2, 3 => 4 + | 0, 2, 3, 2 => 4 + | 0, 2, 3, 3 => 5 + | 0, 2, 1, 4 => 2 + | 0, 2, 0, 5 => 1 + | 0, 3, 5, 0 => 6 + | 0, 3, 4, 1 => 7 + | 0, 3, 2, 2 => 8 + | 0, 3, 2, 3 => 9 + | 0, 3, 3, 2 => 9 + | 0, 3, 3, 3 => 10 + | 0, 3, 1, 4 => 7 + | 0, 3, 0, 5 => 6 + | 4, 0, 4, 0 => 16 + | 4, 0, 2, 1 => 17 + | 4, 0, 3, 1 => 18 + | 4, 0, 1, 2 => 17 + | 4, 0, 1, 3 => 18 + | 4, 0, 0, 4 => 16 + | 2, 1, 4, 0 => 17 + | 2, 1, 2, 1 => 19 + | 2, 1, 3, 1 => 20 + | 2, 1, 1, 2 => 19 + | 2, 1, 1, 3 => 20 + | 2, 1, 0, 4 => 17 + | 3, 1, 4, 0 => 18 + | 3, 1, 2, 1 => 20 + | 3, 1, 3, 1 => 21 + | 3, 1, 1, 2 => 20 + | 3, 1, 1, 3 => 21 + | 3, 1, 0, 4 => 18 + | 1, 2, 4, 0 => 17 + | 1, 2, 2, 1 => 19 + | 1, 2, 3, 1 => 20 + | 1, 2, 1, 2 => 19 + | 1, 2, 1, 3 => 20 + | 1, 2, 0, 4 => 17 + | 1, 3, 4, 0 => 18 + | 1, 3, 2, 1 => 20 + | 1, 3, 3, 1 => 21 + | 1, 3, 1, 2 => 20 + | 1, 3, 1, 3 => 21 + | 1, 3, 0, 4 => 18 + | 0, 4, 4, 0 => 16 + | 0, 4, 2, 1 => 17 + | 0, 4, 3, 1 => 18 + | 0, 4, 1, 2 => 17 + | 0, 4, 1, 3 => 18 + | 0, 4, 0, 4 => 16 + | 0, 5, 2, 0 => 1 + | 0, 5, 3, 0 => 6 + | 0, 5, 1, 1 => 11 + | 0, 5, 0, 2 => 1 + | 0, 5, 0, 3 => 6 + | 1, 4, 2, 0 => 2 + | 1, 4, 3, 0 => 7 + | 1, 4, 1, 1 => 12 + | 1, 4, 0, 2 => 2 + | 1, 4, 0, 3 => 7 + | 2, 2, 2, 0 => 3 + | 2, 2, 3, 0 => 8 + | 2, 2, 1, 1 => 13 + | 2, 2, 0, 2 => 3 + | 2, 2, 0, 3 => 8 + | 2, 3, 2, 0 => 4 + | 2, 3, 3, 0 => 9 + | 2, 3, 1, 1 => 14 + | 2, 3, 0, 2 => 4 + | 2, 3, 0, 3 => 9 + | 3, 2, 2, 0 => 4 + | 3, 2, 3, 0 => 9 + | 3, 2, 1, 1 => 14 + | 3, 2, 0, 2 => 4 + | 3, 2, 0, 3 => 9 + | 3, 3, 2, 0 => 5 + | 3, 3, 3, 0 => 10 + | 3, 3, 1, 1 => 15 + | 3, 3, 0, 2 => 5 + | 3, 3, 0, 3 => 10 + | 4, 1, 2, 0 => 2 + | 4, 1, 3, 0 => 7 + | 4, 1, 1, 1 => 12 + | 4, 1, 0, 2 => 2 + | 4, 1, 0, 3 => 7 + | 5, 0, 2, 0 => 1 + | 5, 0, 3, 0 => 6 + | 5, 0, 1, 1 => 11 + | 5, 0, 0, 2 => 1 + | 5, 0, 0, 3 => 6 + | 1, 5, 1, 0 => 22 + | 1, 5, 0, 1 => 22 + | 2, 4, 1, 0 => 23 + | 2, 4, 0, 1 => 23 + | 3, 4, 1, 0 => 24 + | 3, 4, 0, 1 => 24 + | 4, 2, 1, 0 => 23 + | 4, 2, 0, 1 => 23 + | 4, 3, 1, 0 => 24 + | 4, 3, 0, 1 => 24 + | 5, 1, 1, 0 => 22 + | 5, 1, 0, 1 => 22 + | 2, 5, 0, 0 => 25 + | 3, 5, 0, 0 => 26 + | 4, 4, 0, 0 => 27 + | 5, 2, 0, 0 => 25 + | 5, 3, 0, 0 => 26 + | 0, 1, 1, 5 => 22 + | 0, 1, 2, 4 => 23 + | 0, 1, 3, 4 => 24 + | 0, 1, 4, 2 => 23 + | 0, 1, 4, 3 => 24 + | 0, 1, 5, 1 => 22 + | 1, 0, 1, 5 => 22 + | 1, 0, 2, 4 => 23 + | 1, 0, 3, 4 => 24 + | 1, 0, 4, 2 => 23 + | 1, 0, 4, 3 => 24 + | 1, 0, 5, 1 => 22 + | 0, 0, 2, 5 => 25 + | 0, 0, 3, 5 => 26 + | 0, 0, 4, 4 => 27 + | 0, 0, 5, 2 => 25 + | 0, 0, 5, 3 => 26 + | _, _, _, _ => 0 +def CA4_6_6I1PairP (a : PairSlot × PairSlot) : Ball := + (CompactCertificate.entropyLookup CA4_6_6I1PairCertificates (CA4_6_6I1PairCertificateIndex a)).input +lemma CA4_6_6I1PairP_check_0_0 : ∀ k l : Fin 6, contains (CA4_6_6I1PairRaw ((0,0),(k,l))) (CA4_6_6I1PairP ((0,0),(k,l))) = true := by + decide +kernel +lemma CA4_6_6I1PairP_check_0_1 : ∀ k l : Fin 6, contains (CA4_6_6I1PairRaw ((0,1),(k,l))) (CA4_6_6I1PairP ((0,1),(k,l))) = true := by + decide +kernel +lemma CA4_6_6I1PairP_check_0_2 : ∀ k l : Fin 6, contains (CA4_6_6I1PairRaw ((0,2),(k,l))) (CA4_6_6I1PairP ((0,2),(k,l))) = true := by + decide +kernel +lemma CA4_6_6I1PairP_check_0_3 : ∀ k l : Fin 6, contains (CA4_6_6I1PairRaw ((0,3),(k,l))) (CA4_6_6I1PairP ((0,3),(k,l))) = true := by + decide +kernel +lemma CA4_6_6I1PairP_check_0_4 : ∀ k l : Fin 6, contains (CA4_6_6I1PairRaw ((0,4),(k,l))) (CA4_6_6I1PairP ((0,4),(k,l))) = true := by + decide +kernel +lemma CA4_6_6I1PairP_check_0_5 : ∀ k l : Fin 6, contains (CA4_6_6I1PairRaw ((0,5),(k,l))) (CA4_6_6I1PairP ((0,5),(k,l))) = true := by + decide +kernel +lemma CA4_6_6I1PairP_check_1_0 : ∀ k l : Fin 6, contains (CA4_6_6I1PairRaw ((1,0),(k,l))) (CA4_6_6I1PairP ((1,0),(k,l))) = true := by + decide +kernel +lemma CA4_6_6I1PairP_check_1_1 : ∀ k l : Fin 6, contains (CA4_6_6I1PairRaw ((1,1),(k,l))) (CA4_6_6I1PairP ((1,1),(k,l))) = true := by + decide +kernel +lemma CA4_6_6I1PairP_check_1_2 : ∀ k l : Fin 6, contains (CA4_6_6I1PairRaw ((1,2),(k,l))) (CA4_6_6I1PairP ((1,2),(k,l))) = true := by + decide +kernel +lemma CA4_6_6I1PairP_check_1_3 : ∀ k l : Fin 6, contains (CA4_6_6I1PairRaw ((1,3),(k,l))) (CA4_6_6I1PairP ((1,3),(k,l))) = true := by + decide +kernel +lemma CA4_6_6I1PairP_check_1_4 : ∀ k l : Fin 6, contains (CA4_6_6I1PairRaw ((1,4),(k,l))) (CA4_6_6I1PairP ((1,4),(k,l))) = true := by + decide +kernel +lemma CA4_6_6I1PairP_check_1_5 : ∀ k l : Fin 6, contains (CA4_6_6I1PairRaw ((1,5),(k,l))) (CA4_6_6I1PairP ((1,5),(k,l))) = true := by + decide +kernel +lemma CA4_6_6I1PairP_check_2_0 : ∀ k l : Fin 6, contains (CA4_6_6I1PairRaw ((2,0),(k,l))) (CA4_6_6I1PairP ((2,0),(k,l))) = true := by + decide +kernel +lemma CA4_6_6I1PairP_check_2_1 : ∀ k l : Fin 6, contains (CA4_6_6I1PairRaw ((2,1),(k,l))) (CA4_6_6I1PairP ((2,1),(k,l))) = true := by + decide +kernel +lemma CA4_6_6I1PairP_check_2_2 : ∀ k l : Fin 6, contains (CA4_6_6I1PairRaw ((2,2),(k,l))) (CA4_6_6I1PairP ((2,2),(k,l))) = true := by + decide +kernel +lemma CA4_6_6I1PairP_check_2_3 : ∀ k l : Fin 6, contains (CA4_6_6I1PairRaw ((2,3),(k,l))) (CA4_6_6I1PairP ((2,3),(k,l))) = true := by + decide +kernel +lemma CA4_6_6I1PairP_check_2_4 : ∀ k l : Fin 6, contains (CA4_6_6I1PairRaw ((2,4),(k,l))) (CA4_6_6I1PairP ((2,4),(k,l))) = true := by + decide +kernel +lemma CA4_6_6I1PairP_check_2_5 : ∀ k l : Fin 6, contains (CA4_6_6I1PairRaw ((2,5),(k,l))) (CA4_6_6I1PairP ((2,5),(k,l))) = true := by + decide +kernel +lemma CA4_6_6I1PairP_check_3_0 : ∀ k l : Fin 6, contains (CA4_6_6I1PairRaw ((3,0),(k,l))) (CA4_6_6I1PairP ((3,0),(k,l))) = true := by + decide +kernel +lemma CA4_6_6I1PairP_check_3_1 : ∀ k l : Fin 6, contains (CA4_6_6I1PairRaw ((3,1),(k,l))) (CA4_6_6I1PairP ((3,1),(k,l))) = true := by + decide +kernel +lemma CA4_6_6I1PairP_check_3_2 : ∀ k l : Fin 6, contains (CA4_6_6I1PairRaw ((3,2),(k,l))) (CA4_6_6I1PairP ((3,2),(k,l))) = true := by + decide +kernel +lemma CA4_6_6I1PairP_check_3_3 : ∀ k l : Fin 6, contains (CA4_6_6I1PairRaw ((3,3),(k,l))) (CA4_6_6I1PairP ((3,3),(k,l))) = true := by + decide +kernel +lemma CA4_6_6I1PairP_check_3_4 : ∀ k l : Fin 6, contains (CA4_6_6I1PairRaw ((3,4),(k,l))) (CA4_6_6I1PairP ((3,4),(k,l))) = true := by + decide +kernel +lemma CA4_6_6I1PairP_check_3_5 : ∀ k l : Fin 6, contains (CA4_6_6I1PairRaw ((3,5),(k,l))) (CA4_6_6I1PairP ((3,5),(k,l))) = true := by + decide +kernel +lemma CA4_6_6I1PairP_check_4_0 : ∀ k l : Fin 6, contains (CA4_6_6I1PairRaw ((4,0),(k,l))) (CA4_6_6I1PairP ((4,0),(k,l))) = true := by + decide +kernel +lemma CA4_6_6I1PairP_check_4_1 : ∀ k l : Fin 6, contains (CA4_6_6I1PairRaw ((4,1),(k,l))) (CA4_6_6I1PairP ((4,1),(k,l))) = true := by + decide +kernel +lemma CA4_6_6I1PairP_check_4_2 : ∀ k l : Fin 6, contains (CA4_6_6I1PairRaw ((4,2),(k,l))) (CA4_6_6I1PairP ((4,2),(k,l))) = true := by + decide +kernel +lemma CA4_6_6I1PairP_check_4_3 : ∀ k l : Fin 6, contains (CA4_6_6I1PairRaw ((4,3),(k,l))) (CA4_6_6I1PairP ((4,3),(k,l))) = true := by + decide +kernel +lemma CA4_6_6I1PairP_check_4_4 : ∀ k l : Fin 6, contains (CA4_6_6I1PairRaw ((4,4),(k,l))) (CA4_6_6I1PairP ((4,4),(k,l))) = true := by + decide +kernel +lemma CA4_6_6I1PairP_check_4_5 : ∀ k l : Fin 6, contains (CA4_6_6I1PairRaw ((4,5),(k,l))) (CA4_6_6I1PairP ((4,5),(k,l))) = true := by + decide +kernel +lemma CA4_6_6I1PairP_check_5_0 : ∀ k l : Fin 6, contains (CA4_6_6I1PairRaw ((5,0),(k,l))) (CA4_6_6I1PairP ((5,0),(k,l))) = true := by + decide +kernel +lemma CA4_6_6I1PairP_check_5_1 : ∀ k l : Fin 6, contains (CA4_6_6I1PairRaw ((5,1),(k,l))) (CA4_6_6I1PairP ((5,1),(k,l))) = true := by + decide +kernel +lemma CA4_6_6I1PairP_check_5_2 : ∀ k l : Fin 6, contains (CA4_6_6I1PairRaw ((5,2),(k,l))) (CA4_6_6I1PairP ((5,2),(k,l))) = true := by + decide +kernel +lemma CA4_6_6I1PairP_check_5_3 : ∀ k l : Fin 6, contains (CA4_6_6I1PairRaw ((5,3),(k,l))) (CA4_6_6I1PairP ((5,3),(k,l))) = true := by + decide +kernel +lemma CA4_6_6I1PairP_check_5_4 : ∀ k l : Fin 6, contains (CA4_6_6I1PairRaw ((5,4),(k,l))) (CA4_6_6I1PairP ((5,4),(k,l))) = true := by + decide +kernel +lemma CA4_6_6I1PairP_check_5_5 : ∀ k l : Fin 6, contains (CA4_6_6I1PairRaw ((5,5),(k,l))) (CA4_6_6I1PairP ((5,5),(k,l))) = true := by + decide +kernel +lemma CA4_6_6I1PairP_check (a : PairSlot × PairSlot) : contains (CA4_6_6I1PairRaw a) (CA4_6_6I1PairP a) = true := by + rcases a with ⟨⟨i,j⟩,⟨k,l⟩⟩ + revert j i + apply forall_fin6 + · exact forall_fin6 (CA4_6_6I1PairP_check_0_0 k l) (CA4_6_6I1PairP_check_0_1 k l) (CA4_6_6I1PairP_check_0_2 k l) (CA4_6_6I1PairP_check_0_3 k l) (CA4_6_6I1PairP_check_0_4 k l) (CA4_6_6I1PairP_check_0_5 k l) + · exact forall_fin6 (CA4_6_6I1PairP_check_1_0 k l) (CA4_6_6I1PairP_check_1_1 k l) (CA4_6_6I1PairP_check_1_2 k l) (CA4_6_6I1PairP_check_1_3 k l) (CA4_6_6I1PairP_check_1_4 k l) (CA4_6_6I1PairP_check_1_5 k l) + · exact forall_fin6 (CA4_6_6I1PairP_check_2_0 k l) (CA4_6_6I1PairP_check_2_1 k l) (CA4_6_6I1PairP_check_2_2 k l) (CA4_6_6I1PairP_check_2_3 k l) (CA4_6_6I1PairP_check_2_4 k l) (CA4_6_6I1PairP_check_2_5 k l) + · exact forall_fin6 (CA4_6_6I1PairP_check_3_0 k l) (CA4_6_6I1PairP_check_3_1 k l) (CA4_6_6I1PairP_check_3_2 k l) (CA4_6_6I1PairP_check_3_3 k l) (CA4_6_6I1PairP_check_3_4 k l) (CA4_6_6I1PairP_check_3_5 k l) + · exact forall_fin6 (CA4_6_6I1PairP_check_4_0 k l) (CA4_6_6I1PairP_check_4_1 k l) (CA4_6_6I1PairP_check_4_2 k l) (CA4_6_6I1PairP_check_4_3 k l) (CA4_6_6I1PairP_check_4_4 k l) (CA4_6_6I1PairP_check_4_5 k l) + · exact forall_fin6 (CA4_6_6I1PairP_check_5_0 k l) (CA4_6_6I1PairP_check_5_1 k l) (CA4_6_6I1PairP_check_5_2 k l) (CA4_6_6I1PairP_check_5_3 k l) (CA4_6_6I1PairP_check_5_4 k l) (CA4_6_6I1PairP_check_5_5 k l) +lemma CA4_6_6I1PairP_sound (a : PairSlot × PairSlot) : + (CA4_6_6I1PairP a).Encloses (CA4_6_6I1PairValue a) := + contains_sound (CA4_6_6I1PairRaw_sound a) (CA4_6_6I1PairP_check a) +def CA4_6_6I1PairTerms (a : PairSlot × PairSlot) : Ball := + (CompactCertificate.entropyLookup CA4_6_6I1PairCertificates (CA4_6_6I1PairCertificateIndex a)).output +lemma CA4_6_6I1PairTerms_sound (a : PairSlot × PairSlot) : + (CA4_6_6I1PairTerms a).Encloses (Foundation.entropyTerm (CA4_6_6I1PairValue a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA4_6_6I1PairCertificates_valid + (CA4_6_6I1PairCertificateIndex a) (CA4_6_6I1PairP_sound a) +def CA4_6_6I1PairEntropy : Ball := ⟨(156995264750201302767556569042031 / 50000000000000000000000000000000), (33376481437 / 25000000000000000000000000000000)⟩ +lemma CA4_6_6I1PairEntropy_sound : CA4_6_6I1PairEntropy.Encloses (Foundation.finiteEntropy CA4_6_6I1PairValue) := by + exact contains_sound (entropyDoublePair_enclosed CA4_6_6I1PairValue CA4_6_6I1PairTerms CA4_6_6I1PairTerms_sound) (by decide +kernel) +def CA4_6_6I1PairMass : Ball := ⟨(9999999999999999999999999999999 / 10000000000000000000000000000000), (3 / 390625000000000000000000000000)⟩ +lemma CA4_6_6I1PairMass_sound : CA4_6_6I1PairMass.Encloses (∑ a, CA4_6_6I1PairValue a) := by + exact contains_sound (doublePairSumBall_sound CA4_6_6I1PairP CA4_6_6I1PairValue CA4_6_6I1PairP_sound) (by decide +kernel) +def CA4_6_6I1PairMassTermLogWitness : LogWitness := ⟨-1, 9999999999999999999999999999999, 5000000000000000000000000000000⟩ +def CA4_6_6I1PairMassTermLog : Ball := ⟨(-9 / 100000000000000000000000000000000), (21175824067 / 50000000000000000000000000000000)⟩ +lemma CA4_6_6I1PairMassTermLog_sound : CA4_6_6I1PairMassTermLog.Encloses (Real.log ((∑ a, CA4_6_6I1PairValue a))) := by + exact checkLog_sound logTwoBall_sound (CA4_6_6I1PairMass_sound) (w := CA4_6_6I1PairMassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA4_6_6I1PairMassTerm : Ball := ⟨(9 / 100000000000000000000000000000000), (8470329627 / 20000000000000000000000000000000)⟩ +lemma CA4_6_6I1PairMassTerm_sound : CA4_6_6I1PairMassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA4_6_6I1PairValue a))) := by + exact contains_sound (entropyTerm_ball (CA4_6_6I1PairMass_sound) CA4_6_6I1PairMassTermLog_sound) (by decide +kernel) +def CA4_6_6I1PairH : Ball := ⟨(313990529500402605535113138084053 / 100000000000000000000000000000000), (175857573883 / 100000000000000000000000000000000)⟩ +lemma CA4_6_6I1PairH_sound : CA4_6_6I1PairH.Encloses (homogeneousEntropy CA4_6_6I1PairValue) := by + exact contains_sound (homogeneous_enclosed CA4_6_6I1PairValue CA4_6_6I1PairMassTerm_sound CA4_6_6I1PairEntropy_sound) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA4_6_6I2.lean b/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA4_6_6I2.lean new file mode 100644 index 0000000000000000000000000000000000000000..7ba0f7e41b1e638baea1ba8d5fbad89c7e661648 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA4_6_6I2.lean @@ -0,0 +1,871 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.CapacityA.CapA4_6_6I2Pair + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CA4_6_6I2R0Value (a : PairSlot) : ℝ := residualLaw (below (shape 4 6 6)) (fun u => (stageALaw (shape 4 6 6) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 0 a +def CA4_6_6I2R0Raw (a : PairSlot) : Ball := residualBall (below (shape 4 6 6)) A4_6_6Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 0 a +lemma CA4_6_6I2R0Raw_sound (a : PairSlot) : + (CA4_6_6I2R0Raw a).Encloses (CA4_6_6I2R0Value a) := by + exact residualBall_sound_on (below (shape 4 6 6)) A4_6_6Law (fun u => (stageALaw (shape 4 6 6) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A4_6_6Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 4 6 6) (show (shape 4 6 6) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 0 a +def CA4_6_6I2R0Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(16120553786259023039634395387 / 100000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ ⟨(35194515439582966269226210913 / 25000000000000000000000000000000), (47791271 / 100000000000000000000000000000000)⟩ ⟨(-106601933282416248877794389871 / 12207031250000000000000000000), (296461550171 / 100000000000000000000000000000000)⟩ ⟨-13, 16120553786259023039634395387, 12207031250000000000000000000⟩] +lemma CA4_6_6I2R0Certificates_valid : + CA4_6_6I2R0Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA4_6_6I2R0CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 0, 0 => 1 + | _, _ => 0 +def CA4_6_6I2R0P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA4_6_6I2R0Certificates (CA4_6_6I2R0CertificateIndex a)).input +lemma CA4_6_6I2R0P_check : ∀ a : PairSlot, contains (CA4_6_6I2R0Raw a) (CA4_6_6I2R0P a) = true := by + decide +kernel +lemma CA4_6_6I2R0P_sound (a : PairSlot) : + (CA4_6_6I2R0P a).Encloses (CA4_6_6I2R0Value a) := + contains_sound (CA4_6_6I2R0Raw_sound a) (CA4_6_6I2R0P_check a) +def CA4_6_6I2R0Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA4_6_6I2R0Certificates (CA4_6_6I2R0CertificateIndex a)).output +lemma CA4_6_6I2R0Terms_sound (a : PairSlot) : + (CA4_6_6I2R0Terms a).Encloses (Foundation.entropyTerm (CA4_6_6I2R0Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA4_6_6I2R0Certificates_valid + (CA4_6_6I2R0CertificateIndex a) (CA4_6_6I2R0P_sound a) +def CA4_6_6I2R0Entropy : Ball := ⟨(35194515439582966269226210913 / 25000000000000000000000000000000), (47791271 / 100000000000000000000000000000000)⟩ +lemma CA4_6_6I2R0Entropy_sound : CA4_6_6I2R0Entropy.Encloses (Foundation.finiteEntropy CA4_6_6I2R0Value) := by + exact contains_sound (entropyPair_enclosed CA4_6_6I2R0Value CA4_6_6I2R0Terms CA4_6_6I2R0Terms_sound) (by decide +kernel) +def CA4_6_6I2R0Mass : Ball := ⟨(16120553786259023039634395387 / 100000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +lemma CA4_6_6I2R0Mass_sound : CA4_6_6I2R0Mass.Encloses (∑ a, CA4_6_6I2R0Value a) := by + exact contains_sound (pairSumBall_sound CA4_6_6I2R0P CA4_6_6I2R0Value CA4_6_6I2R0P_sound) (by decide +kernel) +def CA4_6_6I2R0MassTermLogWitness : LogWitness := ⟨-13, 16120553786259023039634395387, 12207031250000000000000000000⟩ +def CA4_6_6I2R0MassTermLog : Ball := ⟨(-106601933282416248877794389871 / 12207031250000000000000000000), (296461550171 / 100000000000000000000000000000000)⟩ +lemma CA4_6_6I2R0MassTermLog_sound : CA4_6_6I2R0MassTermLog.Encloses (Real.log ((∑ a, CA4_6_6I2R0Value a))) := by + exact checkLog_sound logTwoBall_sound (CA4_6_6I2R0Mass_sound) (w := CA4_6_6I2R0MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA4_6_6I2R0MassTerm : Ball := ⟨(35194515439582966269226210913 / 25000000000000000000000000000000), (47791271 / 100000000000000000000000000000000)⟩ +lemma CA4_6_6I2R0MassTerm_sound : CA4_6_6I2R0MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA4_6_6I2R0Value a))) := by + exact contains_sound (entropyTerm_ball (CA4_6_6I2R0Mass_sound) CA4_6_6I2R0MassTermLog_sound) (by decide +kernel) +def CA4_6_6I2R0H : Ball := ⟨0, (47791271 / 50000000000000000000000000000000)⟩ +lemma CA4_6_6I2R0H_sound : CA4_6_6I2R0H.Encloses (homogeneousEntropy CA4_6_6I2R0Value) := by + exact contains_sound (homogeneous_enclosed CA4_6_6I2R0Value CA4_6_6I2R0MassTerm_sound CA4_6_6I2R0Entropy_sound) (by decide +kernel) +def CA4_6_6I2R1Value (a : PairSlot) : ℝ := residualLaw (below (shape 4 6 6)) (fun u => (stageALaw (shape 4 6 6) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 1 a +def CA4_6_6I2R1Raw (a : PairSlot) : Ball := residualBall (below (shape 4 6 6)) A4_6_6Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 1 a +lemma CA4_6_6I2R1Raw_sound (a : PairSlot) : + (CA4_6_6I2R1Raw a).Encloses (CA4_6_6I2R1Value a) := by + exact residualBall_sound_on (below (shape 4 6 6)) A4_6_6Law (fun u => (stageALaw (shape 4 6 6) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A4_6_6Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 4 6 6) (show (shape 4 6 6) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 1 a +def CA4_6_6I2R1Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(342689840677687947278184466827 / 50000000000000000000000000000000), (7 / 100000000000000000000000000000000)⟩ ⟨(1707607198642413904839239804119 / 50000000000000000000000000000000), (1306213179 / 100000000000000000000000000000000)⟩ ⟨(-124573812522828737285493488462043 / 25000000000000000000000000000000), (23822801771 / 12500000000000000000000000000000)⟩ ⟨-8, 342689840677687947278184466827, 195312500000000000000000000000⟩] +lemma CA4_6_6I2R1Certificates_valid : + CA4_6_6I2R1Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA4_6_6I2R1CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 1, 0 => 1 + | 0, 1 => 1 + | _, _ => 0 +def CA4_6_6I2R1P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA4_6_6I2R1Certificates (CA4_6_6I2R1CertificateIndex a)).input +lemma CA4_6_6I2R1P_check : ∀ a : PairSlot, contains (CA4_6_6I2R1Raw a) (CA4_6_6I2R1P a) = true := by + decide +kernel +lemma CA4_6_6I2R1P_sound (a : PairSlot) : + (CA4_6_6I2R1P a).Encloses (CA4_6_6I2R1Value a) := + contains_sound (CA4_6_6I2R1Raw_sound a) (CA4_6_6I2R1P_check a) +def CA4_6_6I2R1Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA4_6_6I2R1Certificates (CA4_6_6I2R1CertificateIndex a)).output +lemma CA4_6_6I2R1Terms_sound (a : PairSlot) : + (CA4_6_6I2R1Terms a).Encloses (Foundation.entropyTerm (CA4_6_6I2R1Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA4_6_6I2R1Certificates_valid + (CA4_6_6I2R1CertificateIndex a) (CA4_6_6I2R1P_sound a) +def CA4_6_6I2R1Entropy : Ball := ⟨(1707607198642413904839239804119 / 25000000000000000000000000000000), (1306213179 / 50000000000000000000000000000000)⟩ +lemma CA4_6_6I2R1Entropy_sound : CA4_6_6I2R1Entropy.Encloses (Foundation.finiteEntropy CA4_6_6I2R1Value) := by + exact contains_sound (entropyPair_enclosed CA4_6_6I2R1Value CA4_6_6I2R1Terms CA4_6_6I2R1Terms_sound) (by decide +kernel) +def CA4_6_6I2R1Mass : Ball := ⟨(342689840677687947278184466827 / 25000000000000000000000000000000), (7 / 50000000000000000000000000000000)⟩ +lemma CA4_6_6I2R1Mass_sound : CA4_6_6I2R1Mass.Encloses (∑ a, CA4_6_6I2R1Value a) := by + exact contains_sound (pairSumBall_sound CA4_6_6I2R1P CA4_6_6I2R1Value CA4_6_6I2R1P_sound) (by decide +kernel) +def CA4_6_6I2R1MassTermLogWitness : LogWitness := ⟨-7, 342689840677687947278184466827, 195312500000000000000000000000⟩ +def CA4_6_6I2R1MassTermLog : Ball := ⟨(-214490266017660209100125380398921 / 50000000000000000000000000000000), (33881318097 / 20000000000000000000000000000000)⟩ +lemma CA4_6_6I2R1MassTermLog_sound : CA4_6_6I2R1MassTermLog.Encloses (Real.log ((∑ a, CA4_6_6I2R1Value a))) := by + exact checkLog_sound logTwoBall_sound (CA4_6_6I2R1Mass_sound) (w := CA4_6_6I2R1MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA4_6_6I2R1MassTerm : Ball := ⟨(183759087721267205798870959323 / 3125000000000000000000000000000), (2322156761 / 100000000000000000000000000000000)⟩ +lemma CA4_6_6I2R1MassTerm_sound : CA4_6_6I2R1MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA4_6_6I2R1Value a))) := by + exact contains_sound (entropyTerm_ball (CA4_6_6I2R1Mass_sound) CA4_6_6I2R1MassTermLog_sound) (by decide +kernel) +def CA4_6_6I2R1H : Ball := ⟨(47506899374455251689654425907 / 5000000000000000000000000000000), (4934583119 / 100000000000000000000000000000000)⟩ +lemma CA4_6_6I2R1H_sound : CA4_6_6I2R1H.Encloses (homogeneousEntropy CA4_6_6I2R1Value) := by + exact contains_sound (homogeneous_enclosed CA4_6_6I2R1Value CA4_6_6I2R1MassTerm_sound CA4_6_6I2R1Entropy_sound) (by decide +kernel) +def CA4_6_6I2R2Value (a : PairSlot) : ℝ := residualLaw (below (shape 4 6 6)) (fun u => (stageALaw (shape 4 6 6) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 2 a +def CA4_6_6I2R2Raw (a : PairSlot) : Ball := residualBall (below (shape 4 6 6)) A4_6_6Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 2 a +lemma CA4_6_6I2R2Raw_sound (a : PairSlot) : + (CA4_6_6I2R2Raw a).Encloses (CA4_6_6I2R2Value a) := by + exact residualBall_sound_on (below (shape 4 6 6)) A4_6_6Law (fun u => (stageALaw (shape 4 6 6) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A4_6_6Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 4 6 6) (show (shape 4 6 6) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 2 a +def CA4_6_6I2R2Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(392578074076873432328971580703 / 10000000000000000000000000000000), (31 / 100000000000000000000000000000000)⟩ ⟨(12710127118449255107747581091313 / 100000000000000000000000000000000), (4987898579 / 100000000000000000000000000000000)⟩ ⟨(-161880246984455849479716824224667 / 50000000000000000000000000000000), (127054942887 / 100000000000000000000000000000000)⟩ ⟨-5, 392578074076873432328971580703, 312500000000000000000000000000⟩, + .log ⟨(150055798188837320755194742107 / 50000000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ ⟨(871639779638983671793257631171 / 50000000000000000000000000000000), (635511053 / 100000000000000000000000000000000)⟩ ⟨(-290438553577940022604062310221717 / 50000000000000000000000000000000), (105879119081 / 50000000000000000000000000000000)⟩ ⟨-9, 150055798188837320755194742107, 97656250000000000000000000000⟩, + .log ⟨(14429221027212306203050005222897 / 100000000000000000000000000000000), (43 / 50000000000000000000000000000000)⟩ ⟨(27933742503376835608680350860191 / 100000000000000000000000000000000), (12222025867 / 100000000000000000000000000000000)⟩ ⟨(-193591479752760938066881720058871 / 100000000000000000000000000000000), (84703295327 / 100000000000000000000000000000000)⟩ ⟨-3, 14429221027212306203050005222897, 12500000000000000000000000000000⟩] +lemma CA4_6_6I2R2Certificates_valid : + CA4_6_6I2R2Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA4_6_6I2R2CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 2, 0 => 1 + | 3, 0 => 2 + | 1, 1 => 3 + | 0, 2 => 1 + | 0, 3 => 2 + | _, _ => 0 +def CA4_6_6I2R2P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA4_6_6I2R2Certificates (CA4_6_6I2R2CertificateIndex a)).input +lemma CA4_6_6I2R2P_check : ∀ a : PairSlot, contains (CA4_6_6I2R2Raw a) (CA4_6_6I2R2P a) = true := by + decide +kernel +lemma CA4_6_6I2R2P_sound (a : PairSlot) : + (CA4_6_6I2R2P a).Encloses (CA4_6_6I2R2Value a) := + contains_sound (CA4_6_6I2R2Raw_sound a) (CA4_6_6I2R2P_check a) +def CA4_6_6I2R2Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA4_6_6I2R2Certificates (CA4_6_6I2R2CertificateIndex a)).output +lemma CA4_6_6I2R2Terms_sound (a : PairSlot) : + (CA4_6_6I2R2Terms a).Encloses (Foundation.entropyTerm (CA4_6_6I2R2Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA4_6_6I2R2Certificates_valid + (CA4_6_6I2R2CertificateIndex a) (CA4_6_6I2R2P_sound a) +def CA4_6_6I2R2Entropy : Ball := ⟨(56840555858831280511348543567501 / 100000000000000000000000000000000), (23468845131 / 100000000000000000000000000000000)⟩ +lemma CA4_6_6I2R2Entropy_sound : CA4_6_6I2R2Entropy.Encloses (Foundation.finiteEntropy CA4_6_6I2R2Value) := by + exact contains_sound (entropyPair_enclosed CA4_6_6I2R2Value CA4_6_6I2R2Terms CA4_6_6I2R2Terms_sound) (by decide +kernel) +def CA4_6_6I2R2Mass : Ball := ⟨(4576201140301024826530043161077 / 20000000000000000000000000000000), (39 / 25000000000000000000000000000000)⟩ +lemma CA4_6_6I2R2Mass_sound : CA4_6_6I2R2Mass.Encloses (∑ a, CA4_6_6I2R2Value a) := by + exact contains_sound (pairSumBall_sound CA4_6_6I2R2P CA4_6_6I2R2Value CA4_6_6I2R2P_sound) (by decide +kernel) +def CA4_6_6I2R2MassTermLogWitness : LogWitness := ⟨-3, 4576201140301024826530043161077, 2500000000000000000000000000000⟩ +def CA4_6_6I2R2MassTermLog : Ball := ⟨(-147486306495714444044522497902991 / 100000000000000000000000000000000), (42351647707 / 50000000000000000000000000000000)⟩ +lemma CA4_6_6I2R2MassTermLog_sound : CA4_6_6I2R2MassTermLog.Encloses (Real.log ((∑ a, CA4_6_6I2R2Value a))) := by + exact checkLog_sound logTwoBall_sound (CA4_6_6I2R2Mass_sound) (w := CA4_6_6I2R2MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA4_6_6I2R2MassTerm : Ball := ⟨(33746350198223744188971964201703 / 100000000000000000000000000000000), (4845241521 / 25000000000000000000000000000000)⟩ +lemma CA4_6_6I2R2MassTerm_sound : CA4_6_6I2R2MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA4_6_6I2R2Value a))) := by + exact contains_sound (entropyTerm_ball (CA4_6_6I2R2Mass_sound) CA4_6_6I2R2MassTermLog_sound) (by decide +kernel) +def CA4_6_6I2R2H : Ball := ⟨(11547102830303768161188289682899 / 50000000000000000000000000000000), (8569962243 / 20000000000000000000000000000000)⟩ +lemma CA4_6_6I2R2H_sound : CA4_6_6I2R2H.Encloses (homogeneousEntropy CA4_6_6I2R2Value) := by + exact contains_sound (homogeneous_enclosed CA4_6_6I2R2Value CA4_6_6I2R2MassTerm_sound CA4_6_6I2R2Entropy_sound) (by decide +kernel) +def CA4_6_6I2R3Value (a : PairSlot) : ℝ := residualLaw (below (shape 4 6 6)) (fun u => (stageALaw (shape 4 6 6) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 3 a +def CA4_6_6I2R3Raw (a : PairSlot) : Ball := residualBall (below (shape 4 6 6)) A4_6_6Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 3 a +lemma CA4_6_6I2R3Raw_sound (a : PairSlot) : + (CA4_6_6I2R3Raw a).Encloses (CA4_6_6I2R3Value a) := by + exact residualBall_sound_on (below (shape 4 6 6)) A4_6_6Law (fun u => (stageALaw (shape 4 6 6) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A4_6_6Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 4 6 6) (show (shape 4 6 6) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 3 a +def CA4_6_6I2R3Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(41833881572148228222134364679 / 6250000000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ ⟨(67022967522245838608633604997 / 2000000000000000000000000000000), (1275648373 / 100000000000000000000000000000000)⟩ ⟨(-15645719273757112229711772937109 / 3125000000000000000000000000000), (190582414043 / 100000000000000000000000000000000)⟩ ⟨-8, 41833881572148228222134364679, 24414062500000000000000000000⟩, + .log ⟨(23560010139129578072062203869873 / 100000000000000000000000000000000), (23 / 25000000000000000000000000000000)⟩ ⟨(34058807647137848371923715806317 / 100000000000000000000000000000000), (4989026263 / 25000000000000000000000000000000)⟩ ⟨(-18070242460640631962391026863803 / 12500000000000000000000000000000), (42351647561 / 50000000000000000000000000000000)⟩ ⟨-3, 23560010139129578072062203869873, 12500000000000000000000000000000⟩, + .log ⟨(1296524902521145729802750542957 / 100000000000000000000000000000000), (7 / 100000000000000000000000000000000)⟩ ⟨(2817013236335323675411586281071 / 50000000000000000000000000000000), (2196398657 / 100000000000000000000000000000000)⟩ ⟨(-21727413263389898323943316318353 / 5000000000000000000000000000000), (42351647501 / 25000000000000000000000000000000)⟩ ⟨-7, 1296524902521145729802750542957, 781250000000000000000000000000⟩] +lemma CA4_6_6I2R3Certificates_valid : + CA4_6_6I2R3Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA4_6_6I2R3CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 4, 0 => 1 + | 2, 1 => 2 + | 3, 1 => 3 + | 1, 2 => 2 + | 1, 3 => 3 + | 0, 4 => 1 + | _, _ => 0 +def CA4_6_6I2R3P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA4_6_6I2R3Certificates (CA4_6_6I2R3CertificateIndex a)).input +lemma CA4_6_6I2R3P_check : ∀ a : PairSlot, contains (CA4_6_6I2R3Raw a) (CA4_6_6I2R3P a) = true := by + decide +kernel +lemma CA4_6_6I2R3P_sound (a : PairSlot) : + (CA4_6_6I2R3P a).Encloses (CA4_6_6I2R3Value a) := + contains_sound (CA4_6_6I2R3Raw_sound a) (CA4_6_6I2R3P_check a) +def CA4_6_6I2R3Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA4_6_6I2R3Certificates (CA4_6_6I2R3CertificateIndex a)).output +lemma CA4_6_6I2R3Terms_sound (a : PairSlot) : + (CA4_6_6I2R3Terms a).Encloses (Foundation.entropyTerm (CA4_6_6I2R3Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA4_6_6I2R3Certificates_valid + (CA4_6_6I2R3CertificateIndex a) (CA4_6_6I2R3P_sound a) +def CA4_6_6I2R3Entropy : Ball := ⟨(43043982495920787653178568618309 / 50000000000000000000000000000000), (11714076041 / 25000000000000000000000000000000)⟩ +lemma CA4_6_6I2R3Entropy_sound : CA4_6_6I2R3Entropy.Encloses (Foundation.finiteEntropy CA4_6_6I2R3Value) := by + exact contains_sound (entropyPair_enclosed CA4_6_6I2R3Value CA4_6_6I2R3Terms CA4_6_6I2R3Terms_sound) (by decide +kernel) +def CA4_6_6I2R3Mass : Ball := ⟨(12762938573402547726709552123847 / 25000000000000000000000000000000), (21 / 10000000000000000000000000000000)⟩ +lemma CA4_6_6I2R3Mass_sound : CA4_6_6I2R3Mass.Encloses (∑ a, CA4_6_6I2R3Value a) := by + exact contains_sound (pairSumBall_sound CA4_6_6I2R3P CA4_6_6I2R3Value CA4_6_6I2R3P_sound) (by decide +kernel) +def CA4_6_6I2R3MassTermLogWitness : LogWitness := ⟨-1, 12762938573402547726709552123847, 12500000000000000000000000000000⟩ +def CA4_6_6I2R3MassTermLog : Ball := ⟨(-2689321110977372408220498540859 / 4000000000000000000000000000000), (42351647777 / 100000000000000000000000000000000)⟩ +lemma CA4_6_6I2R3MassTermLog_sound : CA4_6_6I2R3MassTermLog.Encloses (Real.log ((∑ a, CA4_6_6I2R3Value a))) := by + exact checkLog_sound logTwoBall_sound (CA4_6_6I2R3Mass_sound) (w := CA4_6_6I2R3MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA4_6_6I2R3MassTerm : Ball := ⟨(8580910035889725034669812880701 / 25000000000000000000000000000000), (4324251861 / 20000000000000000000000000000000)⟩ +lemma CA4_6_6I2R3MassTerm_sound : CA4_6_6I2R3MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA4_6_6I2R3Value a))) := by + exact contains_sound (entropyTerm_ball (CA4_6_6I2R3Mass_sound) CA4_6_6I2R3MassTermLog_sound) (by decide +kernel) +def CA4_6_6I2R3H : Ball := ⟨(25882162424141337583838942856907 / 50000000000000000000000000000000), (68477563469 / 100000000000000000000000000000000)⟩ +lemma CA4_6_6I2R3H_sound : CA4_6_6I2R3H.Encloses (homogeneousEntropy CA4_6_6I2R3Value) := by + exact contains_sound (homogeneous_enclosed CA4_6_6I2R3Value CA4_6_6I2R3MassTerm_sound CA4_6_6I2R3Entropy_sound) (by decide +kernel) +def CA4_6_6I2R4Value (a : PairSlot) : ℝ := residualLaw (below (shape 4 6 6)) (fun u => (stageALaw (shape 4 6 6) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 4 a +def CA4_6_6I2R4Raw (a : PairSlot) : Ball := residualBall (below (shape 4 6 6)) A4_6_6Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 4 a +lemma CA4_6_6I2R4Raw_sound (a : PairSlot) : + (CA4_6_6I2R4Raw a).Encloses (CA4_6_6I2R4Value a) := by + exact residualBall_sound_on (below (shape 4 6 6)) A4_6_6Law (fun u => (stageALaw (shape 4 6 6) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A4_6_6Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 4 6 6) (show (shape 4 6 6) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 4 a +def CA4_6_6I2R4Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(537944720769634333105778087 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(21632873274805694756710200643 / 50000000000000000000000000000000), (14581033 / 100000000000000000000000000000000)⟩ ⟨(-251337084922216436087667882147817 / 25000000000000000000000000000000), (84703300541 / 25000000000000000000000000000000)⟩ ⟨-15, 537944720769634333105778087, 381469726562500000000000000⟩, + .log ⟨(1564721597811605367484139850661 / 100000000000000000000000000000000), (3 / 25000000000000000000000000000000)⟩ ⟨(1301054201376719947245861971097 / 20000000000000000000000000000000), (231939887 / 10000000000000000000000000000000)⟩ ⟨(-207873113529645396793973769755997 / 50000000000000000000000000000000), (148230766547 / 100000000000000000000000000000000)⟩ ⟨-6, 1564721597811605367484139850661, 1562500000000000000000000000000⟩, + .log ⟨(16433806017972605324744269093053 / 100000000000000000000000000000000), (19 / 20000000000000000000000000000000)⟩ ⟨(14838326922518451431311550396907 / 50000000000000000000000000000000), (6959987707 / 50000000000000000000000000000000)⟩ ⟨(-90291481512503675759619089157319 / 50000000000000000000000000000000), (84703295309 / 100000000000000000000000000000000)⟩ ⟨-3, 16433806017972605324744269093053, 12500000000000000000000000000000⟩, + .log ⟨(386641586375149809325801854211 / 50000000000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ ⟨(3759919424212129235666645789669 / 100000000000000000000000000000000), (1473741767 / 100000000000000000000000000000000)⟩ ⟨(-121557003847613869011454362955111 / 25000000000000000000000000000000), (190582413923 / 100000000000000000000000000000000)⟩ ⟨-8, 386641586375149809325801854211, 195312500000000000000000000000⟩, + .log ⟨(31690359963280958440486636419 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(51065294204368170268623218623 / 20000000000000000000000000000000), (87239041 / 100000000000000000000000000000000)⟩ ⟨(-100711411655501456969392828743963 / 12500000000000000000000000000000), (137642855517 / 50000000000000000000000000000000)⟩ ⟨-12, 31690359963280958440486636419, 24414062500000000000000000000⟩] +lemma CA4_6_6I2R4Certificates_valid : + CA4_6_6I2R4Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA4_6_6I2R4CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 5, 0 => 1 + | 4, 1 => 2 + | 2, 2 => 3 + | 2, 3 => 4 + | 3, 2 => 4 + | 3, 3 => 5 + | 1, 4 => 2 + | 0, 5 => 1 + | _, _ => 0 +def CA4_6_6I2R4P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA4_6_6I2R4Certificates (CA4_6_6I2R4CertificateIndex a)).input +lemma CA4_6_6I2R4P_check : ∀ a : PairSlot, contains (CA4_6_6I2R4Raw a) (CA4_6_6I2R4P a) = true := by + decide +kernel +lemma CA4_6_6I2R4P_sound (a : PairSlot) : + (CA4_6_6I2R4P a).Encloses (CA4_6_6I2R4Value a) := + contains_sound (CA4_6_6I2R4Raw_sound a) (CA4_6_6I2R4P_check a) +def CA4_6_6I2R4Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA4_6_6I2R4Certificates (CA4_6_6I2R4CertificateIndex a)).output +lemma CA4_6_6I2R4Terms_sound (a : PairSlot) : + (CA4_6_6I2R4Terms a).Encloses (Foundation.entropyTerm (CA4_6_6I2R4Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA4_6_6I2R4Certificates_valid + (CA4_6_6I2R4CertificateIndex a) (CA4_6_6I2R4P_sound a) +def CA4_6_6I2R4Entropy : Ball := ⟨(50548892671349424436784968979809 / 100000000000000000000000000000000), (4324531559 / 20000000000000000000000000000000)⟩ +lemma CA4_6_6I2R4Entropy_sound : CA4_6_6I2R4Entropy.Encloses (Foundation.finiteEntropy CA4_6_6I2R4Value) := by + exact contains_sound (entropyPair_enclosed CA4_6_6I2R4Value CA4_6_6I2R4Terms CA4_6_6I2R4Terms_sound) (by decide +kernel) +def CA4_6_6I2R4Mass : Ball := ⟨(2115011303459201040478593529703 / 10000000000000000000000000000000), (67 / 50000000000000000000000000000000)⟩ +lemma CA4_6_6I2R4Mass_sound : CA4_6_6I2R4Mass.Encloses (∑ a, CA4_6_6I2R4Value a) := by + exact contains_sound (pairSumBall_sound CA4_6_6I2R4P CA4_6_6I2R4Value CA4_6_6I2R4P_sound) (by decide +kernel) +def CA4_6_6I2R4MassTermLogWitness : LogWitness := ⟨-3, 2115011303459201040478593529703, 1250000000000000000000000000000⟩ +def CA4_6_6I2R4MassTermLog : Ball := ⟨(-3107049872169863249670890214253 / 2000000000000000000000000000000), (16940659073 / 20000000000000000000000000000000)⟩ +lemma CA4_6_6I2R4MassTermLog_sound : CA4_6_6I2R4MassTermLog.Encloses (Real.log ((∑ a, CA4_6_6I2R4Value a))) := by + exact checkLog_sound logTwoBall_sound (CA4_6_6I2R4Mass_sound) (w := CA4_6_6I2R4MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA4_6_6I2R4MassTerm : Ball := ⟨(8214307000063408053921907574261 / 25000000000000000000000000000000), (17914842923 / 100000000000000000000000000000000)⟩ +lemma CA4_6_6I2R4MassTerm_sound : CA4_6_6I2R4MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA4_6_6I2R4Value a))) := by + exact contains_sound (entropyTerm_ball (CA4_6_6I2R4Mass_sound) CA4_6_6I2R4MassTermLog_sound) (by decide +kernel) +def CA4_6_6I2R4H : Ball := ⟨(3538332934219158444219467736553 / 20000000000000000000000000000000), (19768750359 / 50000000000000000000000000000000)⟩ +lemma CA4_6_6I2R4H_sound : CA4_6_6I2R4H.Encloses (homogeneousEntropy CA4_6_6I2R4Value) := by + exact contains_sound (homogeneous_enclosed CA4_6_6I2R4Value CA4_6_6I2R4MassTerm_sound CA4_6_6I2R4Entropy_sound) (by decide +kernel) +def CA4_6_6I2R5Value (a : PairSlot) : ℝ := residualLaw (below (shape 4 6 6)) (fun u => (stageALaw (shape 4 6 6) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 5 a +def CA4_6_6I2R5Raw (a : PairSlot) : Ball := residualBall (below (shape 4 6 6)) A4_6_6Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 5 a +lemma CA4_6_6I2R5Raw_sound (a : PairSlot) : + (CA4_6_6I2R5Raw a).Encloses (CA4_6_6I2R5Value a) := by + exact residualBall_sound_on (below (shape 4 6 6)) A4_6_6Law (fun u => (stageALaw (shape 4 6 6) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A4_6_6Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 4 6 6) (show (shape 4 6 6) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 5 a +def CA4_6_6I2R5Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(366867964914050562920159919 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(8674616178805014278614289101 / 100000000000000000000000000000000), (2952131 / 100000000000000000000000000000000)⟩ ⟨(-1182253154869667366780382040839071 / 100000000000000000000000000000000), (201170393133 / 50000000000000000000000000000000)⟩ ⟨-18, 366867964914050562920159919, 190734863281250000000000000⟩, + .log ⟨(18693864025217342876314549801 / 4000000000000000000000000000000), (1 / 20000000000000000000000000000000)⟩ ⟨(626928441304711925665858511673 / 25000000000000000000000000000000), (445340231 / 50000000000000000000000000000000)⟩ ⟨(-524009208699282499991064633567 / 97656250000000000000000000000), (23822801777 / 12500000000000000000000000000000)⟩ ⟨-8, 18693864025217342876314549801, 15625000000000000000000000000⟩, + .log ⟨(1084027016605092340520746337 / 6250000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(30039356161377808794623549681 / 20000000000000000000000000000000), (2570979 / 5000000000000000000000000000000)⟩ ⟨(-54122836980975867761544448498667 / 6250000000000000000000000000000), (296461537327 / 100000000000000000000000000000000)⟩ ⟨-13, 1084027016605092340520746337, 762939453125000000000000000⟩] +lemma CA4_6_6I2R5Certificates_valid : + CA4_6_6I2R5Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA4_6_6I2R5CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 5, 1 => 1 + | 4, 2 => 2 + | 4, 3 => 3 + | 2, 4 => 2 + | 3, 4 => 3 + | 1, 5 => 1 + | _, _ => 0 +def CA4_6_6I2R5P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA4_6_6I2R5Certificates (CA4_6_6I2R5CertificateIndex a)).input +lemma CA4_6_6I2R5P_check : ∀ a : PairSlot, contains (CA4_6_6I2R5Raw a) (CA4_6_6I2R5P a) = true := by + decide +kernel +lemma CA4_6_6I2R5P_sound (a : PairSlot) : + (CA4_6_6I2R5P a).Encloses (CA4_6_6I2R5Value a) := + contains_sound (CA4_6_6I2R5Raw_sound a) (CA4_6_6I2R5P_check a) +def CA4_6_6I2R5Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA4_6_6I2R5Certificates (CA4_6_6I2R5CertificateIndex a)).output +lemma CA4_6_6I2R5Terms_sound (a : PairSlot) : + (CA4_6_6I2R5Terms a).Encloses (Foundation.entropyTerm (CA4_6_6I2R5Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA4_6_6I2R5Certificates_valid + (CA4_6_6I2R5CertificateIndex a) (CA4_6_6I2R5P_sound a) +def CA4_6_6I2R5Entropy : Ball := ⟨(1333292581102270880457583042099 / 25000000000000000000000000000000), (945052173 / 50000000000000000000000000000000)⟩ +lemma CA4_6_6I2R5Entropy_sound : CA4_6_6I2R5Entropy.Encloses (Foundation.finiteEntropy CA4_6_6I2R5Value) := by + exact contains_sound (entropyPair_enclosed CA4_6_6I2R5Value CA4_6_6I2R5Terms CA4_6_6I2R5Terms_sound) (by decide +kernel) +def CA4_6_6I2R5Mass : Ball := ⟨(97084953765188630096407201251 / 10000000000000000000000000000000), (7 / 50000000000000000000000000000000)⟩ +lemma CA4_6_6I2R5Mass_sound : CA4_6_6I2R5Mass.Encloses (∑ a, CA4_6_6I2R5Value a) := by + exact contains_sound (pairSumBall_sound CA4_6_6I2R5P CA4_6_6I2R5Value CA4_6_6I2R5P_sound) (by decide +kernel) +def CA4_6_6I2R5MassTermLogWitness : LogWitness := ⟨-7, 97084953765188630096407201251, 78125000000000000000000000000⟩ +def CA4_6_6I2R5MassTermLog : Ball := ⟨(-231737698238005191053161152691633 / 50000000000000000000000000000000), (84703295453 / 50000000000000000000000000000000)⟩ +lemma CA4_6_6I2R5MassTermLog_sound : CA4_6_6I2R5MassTermLog.Encloses (Real.log ((∑ a, CA4_6_6I2R5Value a))) := by + exact checkLog_sound logTwoBall_sound (CA4_6_6I2R5Mass_sound) (w := CA4_6_6I2R5MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA4_6_6I2R5MassTerm : Ball := ⟨(899929748763518745743438399873 / 20000000000000000000000000000000), (164468317 / 10000000000000000000000000000000)⟩ +lemma CA4_6_6I2R5MassTerm_sound : CA4_6_6I2R5MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA4_6_6I2R5Value a))) := by + exact contains_sound (entropyTerm_ball (CA4_6_6I2R5Mass_sound) CA4_6_6I2R5MassTermLog_sound) (by decide +kernel) +def CA4_6_6I2R5H : Ball := ⟨(833521580591489793113140169031 / 100000000000000000000000000000000), (883696879 / 25000000000000000000000000000000)⟩ +lemma CA4_6_6I2R5H_sound : CA4_6_6I2R5H.Encloses (homogeneousEntropy CA4_6_6I2R5Value) := by + exact contains_sound (homogeneous_enclosed CA4_6_6I2R5Value CA4_6_6I2R5MassTerm_sound CA4_6_6I2R5Entropy_sound) (by decide +kernel) +def CA4_6_6I2R6Value (a : PairSlot) : ℝ := residualLaw (below (shape 4 6 6)) (fun u => (stageALaw (shape 4 6 6) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 6 a +def CA4_6_6I2R6Raw (a : PairSlot) : Ball := residualBall (below (shape 4 6 6)) A4_6_6Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 6 a +lemma CA4_6_6I2R6Raw_sound (a : PairSlot) : + (CA4_6_6I2R6Raw a).Encloses (CA4_6_6I2R6Value a) := by + exact residualBall_sound_on (below (shape 4 6 6)) A4_6_6Law (fun u => (stageALaw (shape 4 6 6) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A4_6_6Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 4 6 6) (show (shape 4 6 6) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 6 a +def CA4_6_6I2R6Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(46676588696815480865680291 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(68042507860451276832750281 / 10000000000000000000000000000000), (28419 / 12500000000000000000000000000000)⟩ ⟨(-1457743801767876191483891357708957 / 100000000000000000000000000000000), (48704608711 / 10000000000000000000000000000000)⟩ ⟨-22, 46676588696815480865680291, 23841857910156250000000000⟩, + .log ⟨(1470405179475994634931 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(8914239811705917108227 / 12500000000000000000000000000000), (49 / 100000000000000000000000000000000)⟩ ⟨(-484995016945338399562250601604557 / 20000000000000000000000000000000), (159266777073 / 20000000000000000000000000000000)⟩ ⟨-35, 23526482871615914158896, 23283064365386962890625⟩, + .log ⟨(2447214525206584752764435531 / 50000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ ⟨(1214409141915755952238289027 / 2500000000000000000000000000000), (16582993 / 100000000000000000000000000000000)⟩ ⟨(-198496556702684665049664880038973 / 20000000000000000000000000000000), (33881321979 / 10000000000000000000000000000000)⟩ ⟨-15, 2447214525206584752764435531, 1525878906250000000000000000⟩] +lemma CA4_6_6I2R6Certificates_valid : + CA4_6_6I2R6Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA4_6_6I2R6CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 5, 2 => 1 + | 5, 3 => 2 + | 4, 4 => 3 + | 2, 5 => 1 + | 3, 5 => 2 + | _, _ => 0 +def CA4_6_6I2R6P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA4_6_6I2R6Certificates (CA4_6_6I2R6CertificateIndex a)).input +lemma CA4_6_6I2R6P_check : ∀ a : PairSlot, contains (CA4_6_6I2R6Raw a) (CA4_6_6I2R6P a) = true := by + decide +kernel +lemma CA4_6_6I2R6P_sound (a : PairSlot) : + (CA4_6_6I2R6P a).Encloses (CA4_6_6I2R6Value a) := + contains_sound (CA4_6_6I2R6Raw_sound a) (CA4_6_6I2R6P_check a) +def CA4_6_6I2R6Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA4_6_6I2R6Certificates (CA4_6_6I2R6CertificateIndex a)).output +lemma CA4_6_6I2R6Terms_sound (a : PairSlot) : + (CA4_6_6I2R6Terms a).Encloses (Foundation.entropyTerm (CA4_6_6I2R6Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA4_6_6I2R6Certificates_valid + (CA4_6_6I2R6CertificateIndex a) (CA4_6_6I2R6P_sound a) +def CA4_6_6I2R6Entropy : Ball := ⟨(12484339615419062730215074583 / 25000000000000000000000000000000), (3407559 / 20000000000000000000000000000000)⟩ +lemma CA4_6_6I2R6Entropy_sound : CA4_6_6I2R6Entropy.Encloses (Foundation.finiteEntropy CA4_6_6I2R6Value) := by + exact contains_sound (entropyPair_enclosed CA4_6_6I2R6Value CA4_6_6I2R6Terms CA4_6_6I2R6Terms_sound) (by decide +kernel) +def CA4_6_6I2R6Mass : Ball := ⟨(623473513678439796404846421 / 12500000000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ +lemma CA4_6_6I2R6Mass_sound : CA4_6_6I2R6Mass.Encloses (∑ a, CA4_6_6I2R6Value a) := by + exact contains_sound (pairSumBall_sound CA4_6_6I2R6P CA4_6_6I2R6Value CA4_6_6I2R6P_sound) (by decide +kernel) +def CA4_6_6I2R6MassTermLogWitness : LogWitness := ⟨-15, 623473513678439796404846421, 381469726562500000000000000⟩ +def CA4_6_6I2R6MassTermLog : Ball := ⟨(-990593291812139828845765896723109 / 100000000000000000000000000000000), (338813299221 / 100000000000000000000000000000000)⟩ +lemma CA4_6_6I2R6MassTermLog_sound : CA4_6_6I2R6MassTermLog.Encloses (Real.log ((∑ a, CA4_6_6I2R6Value a))) := by + exact checkLog_sound logTwoBall_sound (CA4_6_6I2R6Mass_sound) (w := CA4_6_6I2R6MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA4_6_6I2R6MassTerm : Ball := ⟨(49408694421792549308377853077 / 100000000000000000000000000000000), (337987 / 2000000000000000000000000000000)⟩ +lemma CA4_6_6I2R6MassTerm_sound : CA4_6_6I2R6MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA4_6_6I2R6Value a))) := by + exact contains_sound (entropyTerm_ball (CA4_6_6I2R6Mass_sound) CA4_6_6I2R6MassTermLog_sound) (by decide +kernel) +def CA4_6_6I2R6H : Ball := ⟨(105732807976740322496489051 / 20000000000000000000000000000000), (6787429 / 20000000000000000000000000000000)⟩ +lemma CA4_6_6I2R6H_sound : CA4_6_6I2R6H.Encloses (homogeneousEntropy CA4_6_6I2R6Value) := by + exact contains_sound (homogeneous_enclosed CA4_6_6I2R6Value CA4_6_6I2R6MassTerm_sound CA4_6_6I2R6Entropy_sound) (by decide +kernel) +def CA4_6_6I2R7Value (a : PairSlot) : ℝ := residualLaw (below (shape 4 6 6)) (fun u => (stageALaw (shape 4 6 6) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 7 a +def CA4_6_6I2R7Raw (a : PairSlot) : Ball := residualBall (below (shape 4 6 6)) A4_6_6Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 7 a +lemma CA4_6_6I2R7Raw_sound (a : PairSlot) : + (CA4_6_6I2R7Raw a).Encloses (CA4_6_6I2R7Value a) := by + exact residualBall_sound_on (below (shape 4 6 6)) A4_6_6Law (fun u => (stageALaw (shape 4 6 6) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A4_6_6Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 4 6 6) (show (shape 4 6 6) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 7 a +def CA4_6_6I2R7Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA4_6_6I2R7Certificates_valid : + CA4_6_6I2R7Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA4_6_6I2R7CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA4_6_6I2R7P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA4_6_6I2R7Certificates (CA4_6_6I2R7CertificateIndex a)).input +lemma CA4_6_6I2R7P_check : ∀ a : PairSlot, contains (CA4_6_6I2R7Raw a) (CA4_6_6I2R7P a) = true := by + decide +kernel +lemma CA4_6_6I2R7P_sound (a : PairSlot) : + (CA4_6_6I2R7P a).Encloses (CA4_6_6I2R7Value a) := + contains_sound (CA4_6_6I2R7Raw_sound a) (CA4_6_6I2R7P_check a) +def CA4_6_6I2R7Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA4_6_6I2R7Certificates (CA4_6_6I2R7CertificateIndex a)).output +lemma CA4_6_6I2R7Terms_sound (a : PairSlot) : + (CA4_6_6I2R7Terms a).Encloses (Foundation.entropyTerm (CA4_6_6I2R7Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA4_6_6I2R7Certificates_valid + (CA4_6_6I2R7CertificateIndex a) (CA4_6_6I2R7P_sound a) +def CA4_6_6I2R7Entropy : Ball := ⟨0, 0⟩ +lemma CA4_6_6I2R7Entropy_sound : CA4_6_6I2R7Entropy.Encloses (Foundation.finiteEntropy CA4_6_6I2R7Value) := by + exact contains_sound (entropyPair_enclosed CA4_6_6I2R7Value CA4_6_6I2R7Terms CA4_6_6I2R7Terms_sound) (by decide +kernel) +def CA4_6_6I2R7Mass : Ball := ⟨0, 0⟩ +lemma CA4_6_6I2R7Mass_sound : CA4_6_6I2R7Mass.Encloses (∑ a, CA4_6_6I2R7Value a) := by + exact contains_sound (pairSumBall_sound CA4_6_6I2R7P CA4_6_6I2R7Value CA4_6_6I2R7P_sound) (by decide +kernel) +def CA4_6_6I2R7MassTerm : Ball := .exact 0 +lemma CA4_6_6I2R7MassTerm_sound : CA4_6_6I2R7MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA4_6_6I2R7Value a))) := + entropyTerm_zero_ball (CA4_6_6I2R7Mass_sound) +def CA4_6_6I2R7H : Ball := ⟨0, 0⟩ +lemma CA4_6_6I2R7H_sound : CA4_6_6I2R7H.Encloses (homogeneousEntropy CA4_6_6I2R7Value) := by + exact contains_sound (homogeneous_enclosed CA4_6_6I2R7Value CA4_6_6I2R7MassTerm_sound CA4_6_6I2R7Entropy_sound) (by decide +kernel) +def CA4_6_6I2R8Value (a : PairSlot) : ℝ := residualLaw (below (shape 4 6 6)) (fun u => (stageALaw (shape 4 6 6) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 8 a +def CA4_6_6I2R8Raw (a : PairSlot) : Ball := residualBall (below (shape 4 6 6)) A4_6_6Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 8 a +lemma CA4_6_6I2R8Raw_sound (a : PairSlot) : + (CA4_6_6I2R8Raw a).Encloses (CA4_6_6I2R8Value a) := by + exact residualBall_sound_on (below (shape 4 6 6)) A4_6_6Law (fun u => (stageALaw (shape 4 6 6) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A4_6_6Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 4 6 6) (show (shape 4 6 6) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 8 a +def CA4_6_6I2R8Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA4_6_6I2R8Certificates_valid : + CA4_6_6I2R8Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA4_6_6I2R8CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA4_6_6I2R8P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA4_6_6I2R8Certificates (CA4_6_6I2R8CertificateIndex a)).input +lemma CA4_6_6I2R8P_check : ∀ a : PairSlot, contains (CA4_6_6I2R8Raw a) (CA4_6_6I2R8P a) = true := by + decide +kernel +lemma CA4_6_6I2R8P_sound (a : PairSlot) : + (CA4_6_6I2R8P a).Encloses (CA4_6_6I2R8Value a) := + contains_sound (CA4_6_6I2R8Raw_sound a) (CA4_6_6I2R8P_check a) +def CA4_6_6I2R8Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA4_6_6I2R8Certificates (CA4_6_6I2R8CertificateIndex a)).output +lemma CA4_6_6I2R8Terms_sound (a : PairSlot) : + (CA4_6_6I2R8Terms a).Encloses (Foundation.entropyTerm (CA4_6_6I2R8Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA4_6_6I2R8Certificates_valid + (CA4_6_6I2R8CertificateIndex a) (CA4_6_6I2R8P_sound a) +def CA4_6_6I2R8Entropy : Ball := ⟨0, 0⟩ +lemma CA4_6_6I2R8Entropy_sound : CA4_6_6I2R8Entropy.Encloses (Foundation.finiteEntropy CA4_6_6I2R8Value) := by + exact contains_sound (entropyPair_enclosed CA4_6_6I2R8Value CA4_6_6I2R8Terms CA4_6_6I2R8Terms_sound) (by decide +kernel) +def CA4_6_6I2R8Mass : Ball := ⟨0, 0⟩ +lemma CA4_6_6I2R8Mass_sound : CA4_6_6I2R8Mass.Encloses (∑ a, CA4_6_6I2R8Value a) := by + exact contains_sound (pairSumBall_sound CA4_6_6I2R8P CA4_6_6I2R8Value CA4_6_6I2R8P_sound) (by decide +kernel) +def CA4_6_6I2R8MassTerm : Ball := .exact 0 +lemma CA4_6_6I2R8MassTerm_sound : CA4_6_6I2R8MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA4_6_6I2R8Value a))) := + entropyTerm_zero_ball (CA4_6_6I2R8Mass_sound) +def CA4_6_6I2R8H : Ball := ⟨0, 0⟩ +lemma CA4_6_6I2R8H_sound : CA4_6_6I2R8H.Encloses (homogeneousEntropy CA4_6_6I2R8Value) := by + exact contains_sound (homogeneous_enclosed CA4_6_6I2R8Value CA4_6_6I2R8MassTerm_sound CA4_6_6I2R8Entropy_sound) (by decide +kernel) +def CA4_6_6I2R9Value (a : PairSlot) : ℝ := residualLaw (below (shape 4 6 6)) (fun u => (stageALaw (shape 4 6 6) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 9 a +def CA4_6_6I2R9Raw (a : PairSlot) : Ball := residualBall (below (shape 4 6 6)) A4_6_6Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 9 a +lemma CA4_6_6I2R9Raw_sound (a : PairSlot) : + (CA4_6_6I2R9Raw a).Encloses (CA4_6_6I2R9Value a) := by + exact residualBall_sound_on (below (shape 4 6 6)) A4_6_6Law (fun u => (stageALaw (shape 4 6 6) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A4_6_6Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 4 6 6) (show (shape 4 6 6) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 9 a +def CA4_6_6I2R9Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA4_6_6I2R9Certificates_valid : + CA4_6_6I2R9Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA4_6_6I2R9CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA4_6_6I2R9P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA4_6_6I2R9Certificates (CA4_6_6I2R9CertificateIndex a)).input +lemma CA4_6_6I2R9P_check : ∀ a : PairSlot, contains (CA4_6_6I2R9Raw a) (CA4_6_6I2R9P a) = true := by + decide +kernel +lemma CA4_6_6I2R9P_sound (a : PairSlot) : + (CA4_6_6I2R9P a).Encloses (CA4_6_6I2R9Value a) := + contains_sound (CA4_6_6I2R9Raw_sound a) (CA4_6_6I2R9P_check a) +def CA4_6_6I2R9Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA4_6_6I2R9Certificates (CA4_6_6I2R9CertificateIndex a)).output +lemma CA4_6_6I2R9Terms_sound (a : PairSlot) : + (CA4_6_6I2R9Terms a).Encloses (Foundation.entropyTerm (CA4_6_6I2R9Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA4_6_6I2R9Certificates_valid + (CA4_6_6I2R9CertificateIndex a) (CA4_6_6I2R9P_sound a) +def CA4_6_6I2R9Entropy : Ball := ⟨0, 0⟩ +lemma CA4_6_6I2R9Entropy_sound : CA4_6_6I2R9Entropy.Encloses (Foundation.finiteEntropy CA4_6_6I2R9Value) := by + exact contains_sound (entropyPair_enclosed CA4_6_6I2R9Value CA4_6_6I2R9Terms CA4_6_6I2R9Terms_sound) (by decide +kernel) +def CA4_6_6I2R9Mass : Ball := ⟨0, 0⟩ +lemma CA4_6_6I2R9Mass_sound : CA4_6_6I2R9Mass.Encloses (∑ a, CA4_6_6I2R9Value a) := by + exact contains_sound (pairSumBall_sound CA4_6_6I2R9P CA4_6_6I2R9Value CA4_6_6I2R9P_sound) (by decide +kernel) +def CA4_6_6I2R9MassTerm : Ball := .exact 0 +lemma CA4_6_6I2R9MassTerm_sound : CA4_6_6I2R9MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA4_6_6I2R9Value a))) := + entropyTerm_zero_ball (CA4_6_6I2R9Mass_sound) +def CA4_6_6I2R9H : Ball := ⟨0, 0⟩ +lemma CA4_6_6I2R9H_sound : CA4_6_6I2R9H.Encloses (homogeneousEntropy CA4_6_6I2R9Value) := by + exact contains_sound (homogeneous_enclosed CA4_6_6I2R9Value CA4_6_6I2R9MassTerm_sound CA4_6_6I2R9Entropy_sound) (by decide +kernel) +def CA4_6_6I2R10Value (a : PairSlot) : ℝ := residualLaw (below (shape 4 6 6)) (fun u => (stageALaw (shape 4 6 6) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 10 a +def CA4_6_6I2R10Raw (a : PairSlot) : Ball := residualBall (below (shape 4 6 6)) A4_6_6Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 10 a +lemma CA4_6_6I2R10Raw_sound (a : PairSlot) : + (CA4_6_6I2R10Raw a).Encloses (CA4_6_6I2R10Value a) := by + exact residualBall_sound_on (below (shape 4 6 6)) A4_6_6Law (fun u => (stageALaw (shape 4 6 6) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A4_6_6Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 4 6 6) (show (shape 4 6 6) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 10 a +def CA4_6_6I2R10Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA4_6_6I2R10Certificates_valid : + CA4_6_6I2R10Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA4_6_6I2R10CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA4_6_6I2R10P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA4_6_6I2R10Certificates (CA4_6_6I2R10CertificateIndex a)).input +lemma CA4_6_6I2R10P_check : ∀ a : PairSlot, contains (CA4_6_6I2R10Raw a) (CA4_6_6I2R10P a) = true := by + decide +kernel +lemma CA4_6_6I2R10P_sound (a : PairSlot) : + (CA4_6_6I2R10P a).Encloses (CA4_6_6I2R10Value a) := + contains_sound (CA4_6_6I2R10Raw_sound a) (CA4_6_6I2R10P_check a) +def CA4_6_6I2R10Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA4_6_6I2R10Certificates (CA4_6_6I2R10CertificateIndex a)).output +lemma CA4_6_6I2R10Terms_sound (a : PairSlot) : + (CA4_6_6I2R10Terms a).Encloses (Foundation.entropyTerm (CA4_6_6I2R10Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA4_6_6I2R10Certificates_valid + (CA4_6_6I2R10CertificateIndex a) (CA4_6_6I2R10P_sound a) +def CA4_6_6I2R10Entropy : Ball := ⟨0, 0⟩ +lemma CA4_6_6I2R10Entropy_sound : CA4_6_6I2R10Entropy.Encloses (Foundation.finiteEntropy CA4_6_6I2R10Value) := by + exact contains_sound (entropyPair_enclosed CA4_6_6I2R10Value CA4_6_6I2R10Terms CA4_6_6I2R10Terms_sound) (by decide +kernel) +def CA4_6_6I2R10Mass : Ball := ⟨0, 0⟩ +lemma CA4_6_6I2R10Mass_sound : CA4_6_6I2R10Mass.Encloses (∑ a, CA4_6_6I2R10Value a) := by + exact contains_sound (pairSumBall_sound CA4_6_6I2R10P CA4_6_6I2R10Value CA4_6_6I2R10P_sound) (by decide +kernel) +def CA4_6_6I2R10MassTerm : Ball := .exact 0 +lemma CA4_6_6I2R10MassTerm_sound : CA4_6_6I2R10MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA4_6_6I2R10Value a))) := + entropyTerm_zero_ball (CA4_6_6I2R10Mass_sound) +def CA4_6_6I2R10H : Ball := ⟨0, 0⟩ +lemma CA4_6_6I2R10H_sound : CA4_6_6I2R10H.Encloses (homogeneousEntropy CA4_6_6I2R10Value) := by + exact contains_sound (homogeneous_enclosed CA4_6_6I2R10Value CA4_6_6I2R10MassTerm_sound CA4_6_6I2R10Entropy_sound) (by decide +kernel) +def CA4_6_6I2R11Value (a : PairSlot) : ℝ := residualLaw (below (shape 4 6 6)) (fun u => (stageALaw (shape 4 6 6) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 11 a +def CA4_6_6I2R11Raw (a : PairSlot) : Ball := residualBall (below (shape 4 6 6)) A4_6_6Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 11 a +lemma CA4_6_6I2R11Raw_sound (a : PairSlot) : + (CA4_6_6I2R11Raw a).Encloses (CA4_6_6I2R11Value a) := by + exact residualBall_sound_on (below (shape 4 6 6)) A4_6_6Law (fun u => (stageALaw (shape 4 6 6) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A4_6_6Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 4 6 6) (show (shape 4 6 6) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 11 a +def CA4_6_6I2R11Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA4_6_6I2R11Certificates_valid : + CA4_6_6I2R11Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA4_6_6I2R11CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA4_6_6I2R11P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA4_6_6I2R11Certificates (CA4_6_6I2R11CertificateIndex a)).input +lemma CA4_6_6I2R11P_check : ∀ a : PairSlot, contains (CA4_6_6I2R11Raw a) (CA4_6_6I2R11P a) = true := by + decide +kernel +lemma CA4_6_6I2R11P_sound (a : PairSlot) : + (CA4_6_6I2R11P a).Encloses (CA4_6_6I2R11Value a) := + contains_sound (CA4_6_6I2R11Raw_sound a) (CA4_6_6I2R11P_check a) +def CA4_6_6I2R11Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA4_6_6I2R11Certificates (CA4_6_6I2R11CertificateIndex a)).output +lemma CA4_6_6I2R11Terms_sound (a : PairSlot) : + (CA4_6_6I2R11Terms a).Encloses (Foundation.entropyTerm (CA4_6_6I2R11Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA4_6_6I2R11Certificates_valid + (CA4_6_6I2R11CertificateIndex a) (CA4_6_6I2R11P_sound a) +def CA4_6_6I2R11Entropy : Ball := ⟨0, 0⟩ +lemma CA4_6_6I2R11Entropy_sound : CA4_6_6I2R11Entropy.Encloses (Foundation.finiteEntropy CA4_6_6I2R11Value) := by + exact contains_sound (entropyPair_enclosed CA4_6_6I2R11Value CA4_6_6I2R11Terms CA4_6_6I2R11Terms_sound) (by decide +kernel) +def CA4_6_6I2R11Mass : Ball := ⟨0, 0⟩ +lemma CA4_6_6I2R11Mass_sound : CA4_6_6I2R11Mass.Encloses (∑ a, CA4_6_6I2R11Value a) := by + exact contains_sound (pairSumBall_sound CA4_6_6I2R11P CA4_6_6I2R11Value CA4_6_6I2R11P_sound) (by decide +kernel) +def CA4_6_6I2R11MassTerm : Ball := .exact 0 +lemma CA4_6_6I2R11MassTerm_sound : CA4_6_6I2R11MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA4_6_6I2R11Value a))) := + entropyTerm_zero_ball (CA4_6_6I2R11Mass_sound) +def CA4_6_6I2R11H : Ball := ⟨0, 0⟩ +lemma CA4_6_6I2R11H_sound : CA4_6_6I2R11H.Encloses (homogeneousEntropy CA4_6_6I2R11Value) := by + exact contains_sound (homogeneous_enclosed CA4_6_6I2R11Value CA4_6_6I2R11MassTerm_sound CA4_6_6I2R11Entropy_sound) (by decide +kernel) +def CA4_6_6I2R12Value (a : PairSlot) : ℝ := residualLaw (below (shape 4 6 6)) (fun u => (stageALaw (shape 4 6 6) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 12 a +def CA4_6_6I2R12Raw (a : PairSlot) : Ball := residualBall (below (shape 4 6 6)) A4_6_6Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 12 a +lemma CA4_6_6I2R12Raw_sound (a : PairSlot) : + (CA4_6_6I2R12Raw a).Encloses (CA4_6_6I2R12Value a) := by + exact residualBall_sound_on (below (shape 4 6 6)) A4_6_6Law (fun u => (stageALaw (shape 4 6 6) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A4_6_6Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 4 6 6) (show (shape 4 6 6) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 12 a +def CA4_6_6I2R12Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA4_6_6I2R12Certificates_valid : + CA4_6_6I2R12Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA4_6_6I2R12CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA4_6_6I2R12P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA4_6_6I2R12Certificates (CA4_6_6I2R12CertificateIndex a)).input +lemma CA4_6_6I2R12P_check : ∀ a : PairSlot, contains (CA4_6_6I2R12Raw a) (CA4_6_6I2R12P a) = true := by + decide +kernel +lemma CA4_6_6I2R12P_sound (a : PairSlot) : + (CA4_6_6I2R12P a).Encloses (CA4_6_6I2R12Value a) := + contains_sound (CA4_6_6I2R12Raw_sound a) (CA4_6_6I2R12P_check a) +def CA4_6_6I2R12Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA4_6_6I2R12Certificates (CA4_6_6I2R12CertificateIndex a)).output +lemma CA4_6_6I2R12Terms_sound (a : PairSlot) : + (CA4_6_6I2R12Terms a).Encloses (Foundation.entropyTerm (CA4_6_6I2R12Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA4_6_6I2R12Certificates_valid + (CA4_6_6I2R12CertificateIndex a) (CA4_6_6I2R12P_sound a) +def CA4_6_6I2R12Entropy : Ball := ⟨0, 0⟩ +lemma CA4_6_6I2R12Entropy_sound : CA4_6_6I2R12Entropy.Encloses (Foundation.finiteEntropy CA4_6_6I2R12Value) := by + exact contains_sound (entropyPair_enclosed CA4_6_6I2R12Value CA4_6_6I2R12Terms CA4_6_6I2R12Terms_sound) (by decide +kernel) +def CA4_6_6I2R12Mass : Ball := ⟨0, 0⟩ +lemma CA4_6_6I2R12Mass_sound : CA4_6_6I2R12Mass.Encloses (∑ a, CA4_6_6I2R12Value a) := by + exact contains_sound (pairSumBall_sound CA4_6_6I2R12P CA4_6_6I2R12Value CA4_6_6I2R12P_sound) (by decide +kernel) +def CA4_6_6I2R12MassTerm : Ball := .exact 0 +lemma CA4_6_6I2R12MassTerm_sound : CA4_6_6I2R12MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA4_6_6I2R12Value a))) := + entropyTerm_zero_ball (CA4_6_6I2R12Mass_sound) +def CA4_6_6I2R12H : Ball := ⟨0, 0⟩ +lemma CA4_6_6I2R12H_sound : CA4_6_6I2R12H.Encloses (homogeneousEntropy CA4_6_6I2R12Value) := by + exact contains_sound (homogeneous_enclosed CA4_6_6I2R12Value CA4_6_6I2R12MassTerm_sound CA4_6_6I2R12Entropy_sound) (by decide +kernel) +def CA4_6_6I2R13Value (a : PairSlot) : ℝ := residualLaw (below (shape 4 6 6)) (fun u => (stageALaw (shape 4 6 6) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 13 a +def CA4_6_6I2R13Raw (a : PairSlot) : Ball := residualBall (below (shape 4 6 6)) A4_6_6Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 13 a +lemma CA4_6_6I2R13Raw_sound (a : PairSlot) : + (CA4_6_6I2R13Raw a).Encloses (CA4_6_6I2R13Value a) := by + exact residualBall_sound_on (below (shape 4 6 6)) A4_6_6Law (fun u => (stageALaw (shape 4 6 6) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A4_6_6Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 4 6 6) (show (shape 4 6 6) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 13 a +def CA4_6_6I2R13Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA4_6_6I2R13Certificates_valid : + CA4_6_6I2R13Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA4_6_6I2R13CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA4_6_6I2R13P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA4_6_6I2R13Certificates (CA4_6_6I2R13CertificateIndex a)).input +lemma CA4_6_6I2R13P_check : ∀ a : PairSlot, contains (CA4_6_6I2R13Raw a) (CA4_6_6I2R13P a) = true := by + decide +kernel +lemma CA4_6_6I2R13P_sound (a : PairSlot) : + (CA4_6_6I2R13P a).Encloses (CA4_6_6I2R13Value a) := + contains_sound (CA4_6_6I2R13Raw_sound a) (CA4_6_6I2R13P_check a) +def CA4_6_6I2R13Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA4_6_6I2R13Certificates (CA4_6_6I2R13CertificateIndex a)).output +lemma CA4_6_6I2R13Terms_sound (a : PairSlot) : + (CA4_6_6I2R13Terms a).Encloses (Foundation.entropyTerm (CA4_6_6I2R13Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA4_6_6I2R13Certificates_valid + (CA4_6_6I2R13CertificateIndex a) (CA4_6_6I2R13P_sound a) +def CA4_6_6I2R13Entropy : Ball := ⟨0, 0⟩ +lemma CA4_6_6I2R13Entropy_sound : CA4_6_6I2R13Entropy.Encloses (Foundation.finiteEntropy CA4_6_6I2R13Value) := by + exact contains_sound (entropyPair_enclosed CA4_6_6I2R13Value CA4_6_6I2R13Terms CA4_6_6I2R13Terms_sound) (by decide +kernel) +def CA4_6_6I2R13Mass : Ball := ⟨0, 0⟩ +lemma CA4_6_6I2R13Mass_sound : CA4_6_6I2R13Mass.Encloses (∑ a, CA4_6_6I2R13Value a) := by + exact contains_sound (pairSumBall_sound CA4_6_6I2R13P CA4_6_6I2R13Value CA4_6_6I2R13P_sound) (by decide +kernel) +def CA4_6_6I2R13MassTerm : Ball := .exact 0 +lemma CA4_6_6I2R13MassTerm_sound : CA4_6_6I2R13MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA4_6_6I2R13Value a))) := + entropyTerm_zero_ball (CA4_6_6I2R13Mass_sound) +def CA4_6_6I2R13H : Ball := ⟨0, 0⟩ +lemma CA4_6_6I2R13H_sound : CA4_6_6I2R13H.Encloses (homogeneousEntropy CA4_6_6I2R13Value) := by + exact contains_sound (homogeneous_enclosed CA4_6_6I2R13Value CA4_6_6I2R13MassTerm_sound CA4_6_6I2R13Entropy_sound) (by decide +kernel) +def CA4_6_6I2R14Value (a : PairSlot) : ℝ := residualLaw (below (shape 4 6 6)) (fun u => (stageALaw (shape 4 6 6) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 14 a +def CA4_6_6I2R14Raw (a : PairSlot) : Ball := residualBall (below (shape 4 6 6)) A4_6_6Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 14 a +lemma CA4_6_6I2R14Raw_sound (a : PairSlot) : + (CA4_6_6I2R14Raw a).Encloses (CA4_6_6I2R14Value a) := by + exact residualBall_sound_on (below (shape 4 6 6)) A4_6_6Law (fun u => (stageALaw (shape 4 6 6) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A4_6_6Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 4 6 6) (show (shape 4 6 6) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 14 a +def CA4_6_6I2R14Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA4_6_6I2R14Certificates_valid : + CA4_6_6I2R14Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA4_6_6I2R14CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA4_6_6I2R14P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA4_6_6I2R14Certificates (CA4_6_6I2R14CertificateIndex a)).input +lemma CA4_6_6I2R14P_check : ∀ a : PairSlot, contains (CA4_6_6I2R14Raw a) (CA4_6_6I2R14P a) = true := by + decide +kernel +lemma CA4_6_6I2R14P_sound (a : PairSlot) : + (CA4_6_6I2R14P a).Encloses (CA4_6_6I2R14Value a) := + contains_sound (CA4_6_6I2R14Raw_sound a) (CA4_6_6I2R14P_check a) +def CA4_6_6I2R14Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA4_6_6I2R14Certificates (CA4_6_6I2R14CertificateIndex a)).output +lemma CA4_6_6I2R14Terms_sound (a : PairSlot) : + (CA4_6_6I2R14Terms a).Encloses (Foundation.entropyTerm (CA4_6_6I2R14Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA4_6_6I2R14Certificates_valid + (CA4_6_6I2R14CertificateIndex a) (CA4_6_6I2R14P_sound a) +def CA4_6_6I2R14Entropy : Ball := ⟨0, 0⟩ +lemma CA4_6_6I2R14Entropy_sound : CA4_6_6I2R14Entropy.Encloses (Foundation.finiteEntropy CA4_6_6I2R14Value) := by + exact contains_sound (entropyPair_enclosed CA4_6_6I2R14Value CA4_6_6I2R14Terms CA4_6_6I2R14Terms_sound) (by decide +kernel) +def CA4_6_6I2R14Mass : Ball := ⟨0, 0⟩ +lemma CA4_6_6I2R14Mass_sound : CA4_6_6I2R14Mass.Encloses (∑ a, CA4_6_6I2R14Value a) := by + exact contains_sound (pairSumBall_sound CA4_6_6I2R14P CA4_6_6I2R14Value CA4_6_6I2R14P_sound) (by decide +kernel) +def CA4_6_6I2R14MassTerm : Ball := .exact 0 +lemma CA4_6_6I2R14MassTerm_sound : CA4_6_6I2R14MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA4_6_6I2R14Value a))) := + entropyTerm_zero_ball (CA4_6_6I2R14Mass_sound) +def CA4_6_6I2R14H : Ball := ⟨0, 0⟩ +lemma CA4_6_6I2R14H_sound : CA4_6_6I2R14H.Encloses (homogeneousEntropy CA4_6_6I2R14Value) := by + exact contains_sound (homogeneous_enclosed CA4_6_6I2R14Value CA4_6_6I2R14MassTerm_sound CA4_6_6I2R14Entropy_sound) (by decide +kernel) +def CA4_6_6I2R15Value (a : PairSlot) : ℝ := residualLaw (below (shape 4 6 6)) (fun u => (stageALaw (shape 4 6 6) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 15 a +def CA4_6_6I2R15Raw (a : PairSlot) : Ball := residualBall (below (shape 4 6 6)) A4_6_6Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 15 a +lemma CA4_6_6I2R15Raw_sound (a : PairSlot) : + (CA4_6_6I2R15Raw a).Encloses (CA4_6_6I2R15Value a) := by + exact residualBall_sound_on (below (shape 4 6 6)) A4_6_6Law (fun u => (stageALaw (shape 4 6 6) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A4_6_6Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 4 6 6) (show (shape 4 6 6) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 15 a +def CA4_6_6I2R15Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA4_6_6I2R15Certificates_valid : + CA4_6_6I2R15Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA4_6_6I2R15CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA4_6_6I2R15P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA4_6_6I2R15Certificates (CA4_6_6I2R15CertificateIndex a)).input +lemma CA4_6_6I2R15P_check : ∀ a : PairSlot, contains (CA4_6_6I2R15Raw a) (CA4_6_6I2R15P a) = true := by + decide +kernel +lemma CA4_6_6I2R15P_sound (a : PairSlot) : + (CA4_6_6I2R15P a).Encloses (CA4_6_6I2R15Value a) := + contains_sound (CA4_6_6I2R15Raw_sound a) (CA4_6_6I2R15P_check a) +def CA4_6_6I2R15Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA4_6_6I2R15Certificates (CA4_6_6I2R15CertificateIndex a)).output +lemma CA4_6_6I2R15Terms_sound (a : PairSlot) : + (CA4_6_6I2R15Terms a).Encloses (Foundation.entropyTerm (CA4_6_6I2R15Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA4_6_6I2R15Certificates_valid + (CA4_6_6I2R15CertificateIndex a) (CA4_6_6I2R15P_sound a) +def CA4_6_6I2R15Entropy : Ball := ⟨0, 0⟩ +lemma CA4_6_6I2R15Entropy_sound : CA4_6_6I2R15Entropy.Encloses (Foundation.finiteEntropy CA4_6_6I2R15Value) := by + exact contains_sound (entropyPair_enclosed CA4_6_6I2R15Value CA4_6_6I2R15Terms CA4_6_6I2R15Terms_sound) (by decide +kernel) +def CA4_6_6I2R15Mass : Ball := ⟨0, 0⟩ +lemma CA4_6_6I2R15Mass_sound : CA4_6_6I2R15Mass.Encloses (∑ a, CA4_6_6I2R15Value a) := by + exact contains_sound (pairSumBall_sound CA4_6_6I2R15P CA4_6_6I2R15Value CA4_6_6I2R15P_sound) (by decide +kernel) +def CA4_6_6I2R15MassTerm : Ball := .exact 0 +lemma CA4_6_6I2R15MassTerm_sound : CA4_6_6I2R15MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA4_6_6I2R15Value a))) := + entropyTerm_zero_ball (CA4_6_6I2R15Mass_sound) +def CA4_6_6I2R15H : Ball := ⟨0, 0⟩ +lemma CA4_6_6I2R15H_sound : CA4_6_6I2R15H.Encloses (homogeneousEntropy CA4_6_6I2R15Value) := by + exact contains_sound (homogeneous_enclosed CA4_6_6I2R15Value CA4_6_6I2R15MassTerm_sound CA4_6_6I2R15Entropy_sound) (by decide +kernel) +def CA4_6_6I2R16Value (a : PairSlot) : ℝ := residualLaw (below (shape 4 6 6)) (fun u => (stageALaw (shape 4 6 6) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 16 a +def CA4_6_6I2R16Raw (a : PairSlot) : Ball := residualBall (below (shape 4 6 6)) A4_6_6Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 16 a +lemma CA4_6_6I2R16Raw_sound (a : PairSlot) : + (CA4_6_6I2R16Raw a).Encloses (CA4_6_6I2R16Value a) := by + exact residualBall_sound_on (below (shape 4 6 6)) A4_6_6Law (fun u => (stageALaw (shape 4 6 6) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A4_6_6Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 4 6 6) (show (shape 4 6 6) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 16 a +def CA4_6_6I2R16Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA4_6_6I2R16Certificates_valid : + CA4_6_6I2R16Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA4_6_6I2R16CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA4_6_6I2R16P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA4_6_6I2R16Certificates (CA4_6_6I2R16CertificateIndex a)).input +lemma CA4_6_6I2R16P_check : ∀ a : PairSlot, contains (CA4_6_6I2R16Raw a) (CA4_6_6I2R16P a) = true := by + decide +kernel +lemma CA4_6_6I2R16P_sound (a : PairSlot) : + (CA4_6_6I2R16P a).Encloses (CA4_6_6I2R16Value a) := + contains_sound (CA4_6_6I2R16Raw_sound a) (CA4_6_6I2R16P_check a) +def CA4_6_6I2R16Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA4_6_6I2R16Certificates (CA4_6_6I2R16CertificateIndex a)).output +lemma CA4_6_6I2R16Terms_sound (a : PairSlot) : + (CA4_6_6I2R16Terms a).Encloses (Foundation.entropyTerm (CA4_6_6I2R16Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA4_6_6I2R16Certificates_valid + (CA4_6_6I2R16CertificateIndex a) (CA4_6_6I2R16P_sound a) +def CA4_6_6I2R16Entropy : Ball := ⟨0, 0⟩ +lemma CA4_6_6I2R16Entropy_sound : CA4_6_6I2R16Entropy.Encloses (Foundation.finiteEntropy CA4_6_6I2R16Value) := by + exact contains_sound (entropyPair_enclosed CA4_6_6I2R16Value CA4_6_6I2R16Terms CA4_6_6I2R16Terms_sound) (by decide +kernel) +def CA4_6_6I2R16Mass : Ball := ⟨0, 0⟩ +lemma CA4_6_6I2R16Mass_sound : CA4_6_6I2R16Mass.Encloses (∑ a, CA4_6_6I2R16Value a) := by + exact contains_sound (pairSumBall_sound CA4_6_6I2R16P CA4_6_6I2R16Value CA4_6_6I2R16P_sound) (by decide +kernel) +def CA4_6_6I2R16MassTerm : Ball := .exact 0 +lemma CA4_6_6I2R16MassTerm_sound : CA4_6_6I2R16MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA4_6_6I2R16Value a))) := + entropyTerm_zero_ball (CA4_6_6I2R16Mass_sound) +def CA4_6_6I2R16H : Ball := ⟨0, 0⟩ +lemma CA4_6_6I2R16H_sound : CA4_6_6I2R16H.Encloses (homogeneousEntropy CA4_6_6I2R16Value) := by + exact contains_sound (homogeneous_enclosed CA4_6_6I2R16Value CA4_6_6I2R16MassTerm_sound CA4_6_6I2R16Entropy_sound) (by decide +kernel) +def CA4_6_6I2ResidualEntropies (a : Fin 17) : Ball := + match a.val with + | 0 => CA4_6_6I2R0H + | 1 => CA4_6_6I2R1H + | 2 => CA4_6_6I2R2H + | 3 => CA4_6_6I2R3H + | 4 => CA4_6_6I2R4H + | 5 => CA4_6_6I2R5H + | 6 => CA4_6_6I2R6H + | 7 => CA4_6_6I2R7H + | 8 => CA4_6_6I2R8H + | 9 => CA4_6_6I2R9H + | 10 => CA4_6_6I2R10H + | 11 => CA4_6_6I2R11H + | 12 => CA4_6_6I2R12H + | 13 => CA4_6_6I2R13H + | 14 => CA4_6_6I2R14H + | 15 => CA4_6_6I2R15H + | 16 => CA4_6_6I2R16H + | _ => (.exact 0) +lemma CA4_6_6I2ResidualEntropies_sound (k : Fin 17) : + (CA4_6_6I2ResidualEntropies k).Encloses (homogeneousEntropy + (residualLaw (below (shape 4 6 6)) (fun u => (stageALaw (shape 4 6 6) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) k)) := by + fin_cases k + · exact CA4_6_6I2R0H_sound + · exact CA4_6_6I2R1H_sound + · exact CA4_6_6I2R2H_sound + · exact CA4_6_6I2R3H_sound + · exact CA4_6_6I2R4H_sound + · exact CA4_6_6I2R5H_sound + · exact CA4_6_6I2R6H_sound + · exact CA4_6_6I2R7H_sound + · exact CA4_6_6I2R8H_sound + · exact CA4_6_6I2R9H_sound + · exact CA4_6_6I2R10H_sound + · exact CA4_6_6I2R11H_sound + · exact CA4_6_6I2R12H_sound + · exact CA4_6_6I2R13H_sound + · exact CA4_6_6I2R14H_sound + · exact CA4_6_6I2R15H_sound + · exact CA4_6_6I2R16H_sound +def CA4_6_6I2Singles (s : Shape) : Ball := + match s 0, s 1, s 2 with + | 0, 2, 6 => Z0_2_6H2H + | 0, 3, 5 => Z0_3_5H2H + | 0, 4, 4 => Z0_4_4H2H + | 0, 5, 3 => Z0_5_3H2H + | 0, 6, 2 => Z0_6_2H2H + | 2, 0, 6 => Z2_0_6H2H + | 3, 0, 5 => Z3_0_5H2H + | 4, 0, 4 => Z4_0_4H2H + | _, _, _ => (.exact 0) +lemma CA4_6_6I2Singles_sound (u : Shape) (hu : u ∈ below (shape 4 6 6)) + (hd : designated (Equiv.refl (Fin 3)) 2 u) : + (CA4_6_6I2Singles u).Encloses (homogeneousEntropy ((fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) u)) := by + rw [A4_6_6_below] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl + · exact Z0_2_6H2H_sound + · exact Z0_3_5H2H_sound + · exact Z0_4_4H2H_sound + · exact Z0_5_3H2H_sound + · exact Z0_6_2H2H_sound + · exact (show ¬ designated (Equiv.refl (Fin 3)) 2 (shape 1 1 6) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 2 (shape 1 2 5) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 2 (shape 1 3 4) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 2 (shape 1 4 3) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 2 (shape 1 5 2) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 2 (shape 1 6 1) by decide +kernel) hd |>.elim + · exact Z2_0_6H2H_sound + · exact (show ¬ designated (Equiv.refl (Fin 3)) 2 (shape 2 1 5) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 2 (shape 2 2 4) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 2 (shape 2 3 3) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 2 (shape 2 4 2) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 2 (shape 2 5 1) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 2 (shape 2 6 0) by decide +kernel) hd |>.elim + · exact Z3_0_5H2H_sound + · exact (show ¬ designated (Equiv.refl (Fin 3)) 2 (shape 3 1 4) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 2 (shape 3 2 3) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 2 (shape 3 3 2) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 2 (shape 3 4 1) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 2 (shape 3 5 0) by decide +kernel) hd |>.elim + · exact Z4_0_4H2H_sound + · exact (show ¬ designated (Equiv.refl (Fin 3)) 2 (shape 4 1 3) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 2 (shape 4 2 2) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 2 (shape 4 3 1) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 2 (shape 4 4 0) by decide +kernel) hd |>.elim +def CA4_6_6I2Singleton : Ball := ⟨(385647486515267613255081256021 / 12500000000000000000000000000000), (648017637 / 25000000000000000000000000000000)⟩ +lemma CA4_6_6I2Singleton_sound : CA4_6_6I2Singleton.Encloses + (singletonEntropy (below (shape 4 6 6)) (fun u => (stageALaw (shape 4 6 6) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ))) := by + exact contains_sound (singletonBall_sound (below (shape 4 6 6)) A4_6_6Law (fun u => (stageALaw (shape 4 6 6) u : ℝ)) (Equiv.refl (Fin 3)) 2 + CA4_6_6I2Singles (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A4_6_6Law_sound u) CA4_6_6I2Singles_sound) (by decide +kernel) +def CA4_6_6I2Group : Ball := ⟨(97419563304228623145711164942971 / 100000000000000000000000000000000), (10128489767 / 6250000000000000000000000000000)⟩ +lemma CA4_6_6I2Group_sound : CA4_6_6I2Group.Encloses + (groupedEntropy (below (shape 4 6 6)) (fun u => (stageALaw (shape 4 6 6) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ))) := by + exact contains_sound (Ball.add_sound CA4_6_6I2Singleton_sound + (finSumBall_sound 17 CA4_6_6I2ResidualEntropies _ CA4_6_6I2ResidualEntropies_sound)) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CA4_6_6I2H : Ball := ⟨(57023359862945864118495179339019 / 50000000000000000000000000000000), (477361653827 / 100000000000000000000000000000000)⟩ +lemma CA4_6_6I2_sound : CA4_6_6I2H.Encloses (stageACapacity (shape 4 6 6) 2) := by + have hb := contains_sound (Ball.add_sound CA4_6_6I2PairH_sound + (Ball.neg_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) CA4_6_6I2Group_sound))) + (show contains (.add CA4_6_6I2PairH (.neg (.mul (.exact 2) CA4_6_6I2Group))) CA4_6_6I2H = true by decide +kernel) + simp only [stageACapacity, nativeCapacity, + show (2 : Fin 3) ≠ 0 by decide, ite_false, sub_eq_add_neg] + exact hb + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA4_6_6I2Pair.lean b/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA4_6_6I2Pair.lean new file mode 100644 index 0000000000000000000000000000000000000000..4024eebd171672ec9fa59d8ad099505e7da76fb5 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA4_6_6I2Pair.lean @@ -0,0 +1,324 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Certificates.SupportedContraction + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CA4_6_6I2PairValue (a : PairSlot × PairSlot) : ℝ := pairLaw (below (shape 4 6 6)) (shape 4 6 6) (fun u => (stageALaw (shape 4 6 6) u : ℝ)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) a +def CA4_6_6I2PairRaw (a : PairSlot × PairSlot) : Ball := stageAPairBall (shape 4 6 6) A4_6_6Law 2 a +lemma CA4_6_6I2PairRaw_sound (a : PairSlot × PairSlot) : + (CA4_6_6I2PairRaw a).Encloses (CA4_6_6I2PairValue a) := by + exact stageAPairBall_sound (shape 4 6 6) (by decide +kernel) A4_6_6Law (fun u => (stageALaw (shape 4 6 6) u : ℝ)) (fun u _ => A4_6_6Law_sound u) 2 a +def CA4_6_6I2PairCertificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(550690994498094375742417861 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(11810353155210792662618443343 / 50000000000000000000000000000000), (7929721 / 100000000000000000000000000000000)⟩ ⟨(-1072321253952488730091944379578301 / 100000000000000000000000000000000), (44998631001 / 12500000000000000000000000000000)⟩ ⟨-16, 550690994498094375742417861, 381469726562500000000000000⟩, + .log ⟨(174697500731703372737066689 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(463214784791771771358579099 / 20000000000000000000000000000000), (776881 / 100000000000000000000000000000000)⟩ ⟨(-165720310412156016258406710473541 / 12500000000000000000000000000000), (444692869761 / 100000000000000000000000000000000)⟩ ⟨-20, 174697500731703372737066689, 95367431640625000000000000⟩, + .log ⟨(5682815414405430644110459561 / 50000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ ⟨(25806606731799685278020237969 / 25000000000000000000000000000000), (451269 / 1250000000000000000000000000000)⟩ ⟨(-908233150293153530972354495318629 / 100000000000000000000000000000000), (7940934541 / 2500000000000000000000000000000)⟩ ⟨-14, 5682815414405430644110459561, 3051757812500000000000000000⟩, + .log ⟨(5694327471125167081861393053 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(27826626550790499676896173669 / 50000000000000000000000000000000), (2411643 / 12500000000000000000000000000000)⟩ ⟨(-488672748307749058466249458340137 / 50000000000000000000000000000000), (338813196489 / 100000000000000000000000000000000)⟩ ⟨-15, 5694327471125167081861393053, 3051757812500000000000000000⟩, + .log ⟨(319766739878038796172896820333 / 100000000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ ⟨(918583309041297001866321181357 / 50000000000000000000000000000000), (338566219 / 50000000000000000000000000000000)⟩ ⟨(-574533367286198000099473023888929 / 100000000000000000000000000000000), (330872247 / 156250000000000000000000000000)⟩ ⟨-9, 319766739878038796172896820333, 195312500000000000000000000000⟩, + .log ⟨(17228773328523984023426253441 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(37327621722010995277417763519 / 25000000000000000000000000000000), (6384587 / 12500000000000000000000000000000)⟩ ⟨(-216658615272460091350349907618279 / 25000000000000000000000000000000), (148230768683 / 50000000000000000000000000000000)⟩ ⟨-13, 17228773328523984023426253441, 12207031250000000000000000000⟩, + .log ⟨(1286026954664698239243475709 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(226287853736970116557285571 / 1562500000000000000000000000000), (980379 / 20000000000000000000000000000000)⟩ ⟨(-1126136787929304634063459493221373 / 100000000000000000000000000000000), (381164904053 / 100000000000000000000000000000000)⟩ ⟨-17, 1286026954664698239243475709, 762939453125000000000000000⟩, + .log ⟨(27976581087927300800158509 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(766727222715192377945781411 / 50000000000000000000000000000000), (248827 / 50000000000000000000000000000000)⟩ ⟨(-685150930617159311881642586104503 / 50000000000000000000000000000000), (444693190947 / 100000000000000000000000000000000)⟩ ⟨-20, 27976581087927300800158509, 23841857910156250000000000⟩, + .log ⟨(1194926158952117298796439111 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(47551114839132528886449128621 / 100000000000000000000000000000000), (16194281 / 100000000000000000000000000000000)⟩ ⟨(-497427335602395809264183186923907 / 50000000000000000000000000000000), (338813199849 / 100000000000000000000000000000000)⟩ ⟨-15, 1194926158952117298796439111, 762939453125000000000000000⟩, + .log ⟨(152835348128075190513513375639 / 50000000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ ⟨(884980413058324710748485516079 / 50000000000000000000000000000000), (129456581 / 20000000000000000000000000000000)⟩ ⟨(-289520854925758384671407973384867 / 50000000000000000000000000000000), (105879119069 / 50000000000000000000000000000000)⟩ ⟨-9, 152835348128075190513513375639, 97656250000000000000000000000⟩, + .log ⟨(5961795363222115227463556627 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(19891552723710497204293897817 / 10000000000000000000000000000000), (7069773 / 10000000000000000000000000000000)⟩ ⟨(-834125943269541274164479664511117 / 100000000000000000000000000000000), (59292307151 / 20000000000000000000000000000000)⟩ ⟨-13, 5961795363222115227463556627, 3051757812500000000000000000⟩, + .log ⟨(1125387257796726993506746091199 / 100000000000000000000000000000000), (1 / 10000000000000000000000000000000)⟩ ⟨(2524830497671138948158638131397 / 50000000000000000000000000000000), (1906480227 / 100000000000000000000000000000000)⟩ ⟨(-8974085960824647284588572972903 / 2000000000000000000000000000000), (10587911897 / 6250000000000000000000000000000)⟩ ⟨-7, 1125387257796726993506746091199, 781250000000000000000000000000⟩, + .log ⟨(4804923582971263758780737853 / 160000000000000000000000000000), (27 / 100000000000000000000000000000000)⟩ ⟨(2105477078575589263635468258549 / 20000000000000000000000000000000), (4451484511 / 100000000000000000000000000000000)⟩ ⟨(-350553267658605548767582317597331 / 100000000000000000000000000000000), (3705769167 / 2500000000000000000000000000000)⟩ ⟨-6, 4804923582971263758780737853, 2500000000000000000000000000⟩, + .log ⟨(228703043582168857440492073269 / 100000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ ⟨(1390629097976093968260955651871 / 100000000000000000000000000000000), (96859511 / 20000000000000000000000000000000)⟩ ⟨(-608050105584391203712405214567859 / 100000000000000000000000000000000), (211758238141 / 100000000000000000000000000000000)⟩ ⟨-9, 228703043582168857440492073269, 195312500000000000000000000000⟩, + .log ⟨(11035106484915945038262617710741 / 100000000000000000000000000000000), (77 / 100000000000000000000000000000000)⟩ ⟨(24322351261969208553123981643289 / 100000000000000000000000000000000), (1168387371 / 10000000000000000000000000000000)⟩ ⟨(-220408849658277430998166314409843 / 100000000000000000000000000000000), (13234889889 / 12500000000000000000000000000000)⟩ ⟨-4, 11035106484915945038262617710741, 6250000000000000000000000000000⟩, + .log ⟨(151577636137946079338751499779 / 100000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ ⟨(196803173985541122493417000073 / 20000000000000000000000000000000), (353075959 / 100000000000000000000000000000000)⟩ ⟨(-649182752152292082276302062801987 / 100000000000000000000000000000000), (29116757729 / 12500000000000000000000000000000)⟩ ⟨-10, 151577636137946079338751499779, 97656250000000000000000000000⟩, + .log ⟨(11442654886302869154866048451 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(103848700487906400504744675091 / 100000000000000000000000000000000), (36346157 / 100000000000000000000000000000000)⟩ ⟨(-907557743546174517011864347443039 / 100000000000000000000000000000000), (19852335249 / 6250000000000000000000000000000)⟩ ⟨-14, 11442654886302869154866048451, 6103515625000000000000000000⟩, + .log ⟨(556649104624505368647729855661 / 100000000000000000000000000000000), (1 / 20000000000000000000000000000000)⟩ ⟨(2889560156773641956335086432297 / 100000000000000000000000000000000), (16576177 / 1562500000000000000000000000000)⟩ ⟨(-10381980794607874136163041573719 / 2000000000000000000000000000000), (38116482809 / 20000000000000000000000000000000)⟩ ⟨-8, 556649104624505368647729855661, 390625000000000000000000000000⟩, + .log ⟨(455849742624759943262109273 / 6250000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(69478274909502352519416670169 / 100000000000000000000000000000000), (5791799 / 25000000000000000000000000000000)⟩ ⟨(-190518575565738866182010355481457 / 20000000000000000000000000000000), (63527473791 / 20000000000000000000000000000000)⟩ ⟨-14, 455849742624759943262109273, 381469726562500000000000000⟩, + .log ⟨(144821448339707124967739747 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(857034594177132324159206517 / 10000000000000000000000000000000), (2913391 / 100000000000000000000000000000000)⟩ ⟨(-591787061932145237312126919143033 / 50000000000000000000000000000000), (201170394039 / 50000000000000000000000000000000)⟩ ⟨-18, 144821448339707124967739747, 76293945312500000000000000⟩, + .log ⟨(13716067623426276681419945113 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(112488355337070447541613540187 / 50000000000000000000000000000000), (75516757 / 100000000000000000000000000000000)⟩ ⟨(-32804841278252850102024646860431 / 4000000000000000000000000000000), (68821427881 / 25000000000000000000000000000000)⟩ ⟨-12, 13716067623426276681419945113, 12207031250000000000000000000⟩, + .log ⟨(178616938092644843843083157 / 2000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(8326598517406045887022915553 / 10000000000000000000000000000000), (28367717 / 100000000000000000000000000000000)⟩ ⟨(-932341423643396530168812997386717 / 100000000000000000000000000000000), (158818683221 / 50000000000000000000000000000000)⟩ ⟨-14, 178616938092644843843083157, 122070312500000000000000000⟩, + .log ⟨(19537744851704008563473306437 / 6250000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ ⟨(1803095806513188159655461814767 / 100000000000000000000000000000000), (132392913 / 20000000000000000000000000000000)⟩ ⟨(-288399425733225188871944890357949 / 50000000000000000000000000000000), (211758237789 / 100000000000000000000000000000000)⟩ ⟨-9, 19537744851704008563473306437, 12207031250000000000000000000⟩, + .log ⟨(867990500444120037515467797 / 5000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(150314562182817005406880670339 / 100000000000000000000000000000000), (51465169 / 100000000000000000000000000000000)⟩ ⟨(-216469192499667854503828475216463 / 25000000000000000000000000000000), (148230768661 / 50000000000000000000000000000000)⟩ ⟨-13, 867990500444120037515467797, 610351562500000000000000000⟩, + .log ⟨(2736735395542982099916004689091 / 25000000000000000000000000000000), (51 / 100000000000000000000000000000000)⟩ ⟨(968633591145093269072875048867 / 4000000000000000000000000000000), (2318105081 / 20000000000000000000000000000000)⟩ ⟨(-221211007630341140716268967830469 / 100000000000000000000000000000000), (661744493 / 625000000000000000000000000000)⟩ ⟨-4, 2736735395542982099916004689091, 1562500000000000000000000000000⟩, + .log ⟨(606238153499132674882276367377 / 100000000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ ⟨(1547620691261101416868286971747 / 50000000000000000000000000000000), (1155383327 / 100000000000000000000000000000000)⟩ ⟨(-127641314088236080247269239402783 / 25000000000000000000000000000000), (95291206903 / 50000000000000000000000000000000)⟩ ⟨-8, 606238153499132674882276367377, 390625000000000000000000000000⟩, + .log ⟨(32528283178424102467562248017 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(261228640817050840386635204413 / 100000000000000000000000000000000), (22386431 / 25000000000000000000000000000000)⟩ ⟨(-803081550244013163194533690853003 / 100000000000000000000000000000000), (275285710953 / 100000000000000000000000000000000)⟩ ⟨-12, 32528283178424102467562248017, 24414062500000000000000000000⟩] +lemma CA4_6_6I2PairCertificates_valid : + CA4_6_6I2PairCertificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA4_6_6I2PairCertificateIndex (a : PairSlot × PairSlot) : ℕ := + match a.1.1.val, a.1.2.val, a.2.1.val, a.2.2.val with + | 2, 5, 0, 0 => 1 + | 3, 5, 0, 0 => 2 + | 4, 4, 0, 0 => 3 + | 5, 2, 0, 0 => 1 + | 5, 3, 0, 0 => 2 + | 1, 5, 1, 0 => 4 + | 1, 5, 0, 1 => 4 + | 2, 4, 1, 0 => 5 + | 2, 4, 0, 1 => 5 + | 3, 4, 1, 0 => 6 + | 3, 4, 0, 1 => 6 + | 4, 2, 1, 0 => 5 + | 4, 2, 0, 1 => 5 + | 4, 3, 1, 0 => 6 + | 4, 3, 0, 1 => 6 + | 5, 1, 1, 0 => 4 + | 5, 1, 0, 1 => 4 + | 5, 0, 2, 0 => 7 + | 5, 0, 3, 0 => 8 + | 5, 0, 1, 1 => 9 + | 5, 0, 0, 2 => 7 + | 5, 0, 0, 3 => 8 + | 4, 1, 2, 0 => 10 + | 4, 1, 3, 0 => 11 + | 4, 1, 1, 1 => 12 + | 4, 1, 0, 2 => 10 + | 4, 1, 0, 3 => 11 + | 2, 2, 2, 0 => 13 + | 2, 2, 3, 0 => 14 + | 2, 2, 1, 1 => 15 + | 2, 2, 0, 2 => 13 + | 2, 2, 0, 3 => 14 + | 2, 3, 2, 0 => 16 + | 2, 3, 3, 0 => 17 + | 2, 3, 1, 1 => 18 + | 2, 3, 0, 2 => 16 + | 2, 3, 0, 3 => 17 + | 3, 2, 2, 0 => 16 + | 3, 2, 3, 0 => 17 + | 3, 2, 1, 1 => 18 + | 3, 2, 0, 2 => 16 + | 3, 2, 0, 3 => 17 + | 3, 3, 2, 0 => 19 + | 3, 3, 3, 0 => 20 + | 3, 3, 1, 1 => 21 + | 3, 3, 0, 2 => 19 + | 3, 3, 0, 3 => 20 + | 1, 4, 2, 0 => 10 + | 1, 4, 3, 0 => 11 + | 1, 4, 1, 1 => 12 + | 1, 4, 0, 2 => 10 + | 1, 4, 0, 3 => 11 + | 0, 5, 2, 0 => 7 + | 0, 5, 3, 0 => 8 + | 0, 5, 1, 1 => 9 + | 0, 5, 0, 2 => 7 + | 0, 5, 0, 3 => 8 + | 4, 0, 4, 0 => 22 + | 4, 0, 2, 1 => 23 + | 4, 0, 3, 1 => 24 + | 4, 0, 1, 2 => 23 + | 4, 0, 1, 3 => 24 + | 4, 0, 0, 4 => 22 + | 2, 1, 4, 0 => 23 + | 2, 1, 2, 1 => 25 + | 2, 1, 3, 1 => 26 + | 2, 1, 1, 2 => 25 + | 2, 1, 1, 3 => 26 + | 2, 1, 0, 4 => 23 + | 3, 1, 4, 0 => 24 + | 3, 1, 2, 1 => 26 + | 3, 1, 3, 1 => 27 + | 3, 1, 1, 2 => 26 + | 3, 1, 1, 3 => 27 + | 3, 1, 0, 4 => 24 + | 1, 2, 4, 0 => 23 + | 1, 2, 2, 1 => 25 + | 1, 2, 3, 1 => 26 + | 1, 2, 1, 2 => 25 + | 1, 2, 1, 3 => 26 + | 1, 2, 0, 4 => 23 + | 1, 3, 4, 0 => 24 + | 1, 3, 2, 1 => 26 + | 1, 3, 3, 1 => 27 + | 1, 3, 1, 2 => 26 + | 1, 3, 1, 3 => 27 + | 1, 3, 0, 4 => 24 + | 0, 4, 4, 0 => 22 + | 0, 4, 2, 1 => 23 + | 0, 4, 3, 1 => 24 + | 0, 4, 1, 2 => 23 + | 0, 4, 1, 3 => 24 + | 0, 4, 0, 4 => 22 + | 2, 0, 5, 0 => 7 + | 2, 0, 4, 1 => 10 + | 2, 0, 2, 2 => 13 + | 2, 0, 2, 3 => 16 + | 2, 0, 3, 2 => 16 + | 2, 0, 3, 3 => 19 + | 2, 0, 1, 4 => 10 + | 2, 0, 0, 5 => 7 + | 3, 0, 5, 0 => 8 + | 3, 0, 4, 1 => 11 + | 3, 0, 2, 2 => 14 + | 3, 0, 2, 3 => 17 + | 3, 0, 3, 2 => 17 + | 3, 0, 3, 3 => 20 + | 3, 0, 1, 4 => 11 + | 3, 0, 0, 5 => 8 + | 1, 1, 5, 0 => 9 + | 1, 1, 4, 1 => 12 + | 1, 1, 2, 2 => 15 + | 1, 1, 2, 3 => 18 + | 1, 1, 3, 2 => 18 + | 1, 1, 3, 3 => 21 + | 1, 1, 1, 4 => 12 + | 1, 1, 0, 5 => 9 + | 0, 2, 5, 0 => 7 + | 0, 2, 4, 1 => 10 + | 0, 2, 2, 2 => 13 + | 0, 2, 2, 3 => 16 + | 0, 2, 3, 2 => 16 + | 0, 2, 3, 3 => 19 + | 0, 2, 1, 4 => 10 + | 0, 2, 0, 5 => 7 + | 0, 3, 5, 0 => 8 + | 0, 3, 4, 1 => 11 + | 0, 3, 2, 2 => 14 + | 0, 3, 2, 3 => 17 + | 0, 3, 3, 2 => 17 + | 0, 3, 3, 3 => 20 + | 0, 3, 1, 4 => 11 + | 0, 3, 0, 5 => 8 + | 1, 0, 1, 5 => 4 + | 1, 0, 2, 4 => 5 + | 1, 0, 3, 4 => 6 + | 1, 0, 4, 2 => 5 + | 1, 0, 4, 3 => 6 + | 1, 0, 5, 1 => 4 + | 0, 1, 1, 5 => 4 + | 0, 1, 2, 4 => 5 + | 0, 1, 3, 4 => 6 + | 0, 1, 4, 2 => 5 + | 0, 1, 4, 3 => 6 + | 0, 1, 5, 1 => 4 + | 0, 0, 2, 5 => 1 + | 0, 0, 3, 5 => 2 + | 0, 0, 4, 4 => 3 + | 0, 0, 5, 2 => 1 + | 0, 0, 5, 3 => 2 + | _, _, _, _ => 0 +def CA4_6_6I2PairP (a : PairSlot × PairSlot) : Ball := + (CompactCertificate.entropyLookup CA4_6_6I2PairCertificates (CA4_6_6I2PairCertificateIndex a)).input +lemma CA4_6_6I2PairP_check_0_0 : ∀ k l : Fin 6, contains (CA4_6_6I2PairRaw ((0,0),(k,l))) (CA4_6_6I2PairP ((0,0),(k,l))) = true := by + decide +kernel +lemma CA4_6_6I2PairP_check_0_1 : ∀ k l : Fin 6, contains (CA4_6_6I2PairRaw ((0,1),(k,l))) (CA4_6_6I2PairP ((0,1),(k,l))) = true := by + decide +kernel +lemma CA4_6_6I2PairP_check_0_2 : ∀ k l : Fin 6, contains (CA4_6_6I2PairRaw ((0,2),(k,l))) (CA4_6_6I2PairP ((0,2),(k,l))) = true := by + decide +kernel +lemma CA4_6_6I2PairP_check_0_3 : ∀ k l : Fin 6, contains (CA4_6_6I2PairRaw ((0,3),(k,l))) (CA4_6_6I2PairP ((0,3),(k,l))) = true := by + decide +kernel +lemma CA4_6_6I2PairP_check_0_4 : ∀ k l : Fin 6, contains (CA4_6_6I2PairRaw ((0,4),(k,l))) (CA4_6_6I2PairP ((0,4),(k,l))) = true := by + decide +kernel +lemma CA4_6_6I2PairP_check_0_5 : ∀ k l : Fin 6, contains (CA4_6_6I2PairRaw ((0,5),(k,l))) (CA4_6_6I2PairP ((0,5),(k,l))) = true := by + decide +kernel +lemma CA4_6_6I2PairP_check_1_0 : ∀ k l : Fin 6, contains (CA4_6_6I2PairRaw ((1,0),(k,l))) (CA4_6_6I2PairP ((1,0),(k,l))) = true := by + decide +kernel +lemma CA4_6_6I2PairP_check_1_1 : ∀ k l : Fin 6, contains (CA4_6_6I2PairRaw ((1,1),(k,l))) (CA4_6_6I2PairP ((1,1),(k,l))) = true := by + decide +kernel +lemma CA4_6_6I2PairP_check_1_2 : ∀ k l : Fin 6, contains (CA4_6_6I2PairRaw ((1,2),(k,l))) (CA4_6_6I2PairP ((1,2),(k,l))) = true := by + decide +kernel +lemma CA4_6_6I2PairP_check_1_3 : ∀ k l : Fin 6, contains (CA4_6_6I2PairRaw ((1,3),(k,l))) (CA4_6_6I2PairP ((1,3),(k,l))) = true := by + decide +kernel +lemma CA4_6_6I2PairP_check_1_4 : ∀ k l : Fin 6, contains (CA4_6_6I2PairRaw ((1,4),(k,l))) (CA4_6_6I2PairP ((1,4),(k,l))) = true := by + decide +kernel +lemma CA4_6_6I2PairP_check_1_5 : ∀ k l : Fin 6, contains (CA4_6_6I2PairRaw ((1,5),(k,l))) (CA4_6_6I2PairP ((1,5),(k,l))) = true := by + decide +kernel +lemma CA4_6_6I2PairP_check_2_0 : ∀ k l : Fin 6, contains (CA4_6_6I2PairRaw ((2,0),(k,l))) (CA4_6_6I2PairP ((2,0),(k,l))) = true := by + decide +kernel +lemma CA4_6_6I2PairP_check_2_1 : ∀ k l : Fin 6, contains (CA4_6_6I2PairRaw ((2,1),(k,l))) (CA4_6_6I2PairP ((2,1),(k,l))) = true := by + decide +kernel +lemma CA4_6_6I2PairP_check_2_2 : ∀ k l : Fin 6, contains (CA4_6_6I2PairRaw ((2,2),(k,l))) (CA4_6_6I2PairP ((2,2),(k,l))) = true := by + decide +kernel +lemma CA4_6_6I2PairP_check_2_3 : ∀ k l : Fin 6, contains (CA4_6_6I2PairRaw ((2,3),(k,l))) (CA4_6_6I2PairP ((2,3),(k,l))) = true := by + decide +kernel +lemma CA4_6_6I2PairP_check_2_4 : ∀ k l : Fin 6, contains (CA4_6_6I2PairRaw ((2,4),(k,l))) (CA4_6_6I2PairP ((2,4),(k,l))) = true := by + decide +kernel +lemma CA4_6_6I2PairP_check_2_5 : ∀ k l : Fin 6, contains (CA4_6_6I2PairRaw ((2,5),(k,l))) (CA4_6_6I2PairP ((2,5),(k,l))) = true := by + decide +kernel +lemma CA4_6_6I2PairP_check_3_0 : ∀ k l : Fin 6, contains (CA4_6_6I2PairRaw ((3,0),(k,l))) (CA4_6_6I2PairP ((3,0),(k,l))) = true := by + decide +kernel +lemma CA4_6_6I2PairP_check_3_1 : ∀ k l : Fin 6, contains (CA4_6_6I2PairRaw ((3,1),(k,l))) (CA4_6_6I2PairP ((3,1),(k,l))) = true := by + decide +kernel +lemma CA4_6_6I2PairP_check_3_2 : ∀ k l : Fin 6, contains (CA4_6_6I2PairRaw ((3,2),(k,l))) (CA4_6_6I2PairP ((3,2),(k,l))) = true := by + decide +kernel +lemma CA4_6_6I2PairP_check_3_3 : ∀ k l : Fin 6, contains (CA4_6_6I2PairRaw ((3,3),(k,l))) (CA4_6_6I2PairP ((3,3),(k,l))) = true := by + decide +kernel +lemma CA4_6_6I2PairP_check_3_4 : ∀ k l : Fin 6, contains (CA4_6_6I2PairRaw ((3,4),(k,l))) (CA4_6_6I2PairP ((3,4),(k,l))) = true := by + decide +kernel +lemma CA4_6_6I2PairP_check_3_5 : ∀ k l : Fin 6, contains (CA4_6_6I2PairRaw ((3,5),(k,l))) (CA4_6_6I2PairP ((3,5),(k,l))) = true := by + decide +kernel +lemma CA4_6_6I2PairP_check_4_0 : ∀ k l : Fin 6, contains (CA4_6_6I2PairRaw ((4,0),(k,l))) (CA4_6_6I2PairP ((4,0),(k,l))) = true := by + decide +kernel +lemma CA4_6_6I2PairP_check_4_1 : ∀ k l : Fin 6, contains (CA4_6_6I2PairRaw ((4,1),(k,l))) (CA4_6_6I2PairP ((4,1),(k,l))) = true := by + decide +kernel +lemma CA4_6_6I2PairP_check_4_2 : ∀ k l : Fin 6, contains (CA4_6_6I2PairRaw ((4,2),(k,l))) (CA4_6_6I2PairP ((4,2),(k,l))) = true := by + decide +kernel +lemma CA4_6_6I2PairP_check_4_3 : ∀ k l : Fin 6, contains (CA4_6_6I2PairRaw ((4,3),(k,l))) (CA4_6_6I2PairP ((4,3),(k,l))) = true := by + decide +kernel +lemma CA4_6_6I2PairP_check_4_4 : ∀ k l : Fin 6, contains (CA4_6_6I2PairRaw ((4,4),(k,l))) (CA4_6_6I2PairP ((4,4),(k,l))) = true := by + decide +kernel +lemma CA4_6_6I2PairP_check_4_5 : ∀ k l : Fin 6, contains (CA4_6_6I2PairRaw ((4,5),(k,l))) (CA4_6_6I2PairP ((4,5),(k,l))) = true := by + decide +kernel +lemma CA4_6_6I2PairP_check_5_0 : ∀ k l : Fin 6, contains (CA4_6_6I2PairRaw ((5,0),(k,l))) (CA4_6_6I2PairP ((5,0),(k,l))) = true := by + decide +kernel +lemma CA4_6_6I2PairP_check_5_1 : ∀ k l : Fin 6, contains (CA4_6_6I2PairRaw ((5,1),(k,l))) (CA4_6_6I2PairP ((5,1),(k,l))) = true := by + decide +kernel +lemma CA4_6_6I2PairP_check_5_2 : ∀ k l : Fin 6, contains (CA4_6_6I2PairRaw ((5,2),(k,l))) (CA4_6_6I2PairP ((5,2),(k,l))) = true := by + decide +kernel +lemma CA4_6_6I2PairP_check_5_3 : ∀ k l : Fin 6, contains (CA4_6_6I2PairRaw ((5,3),(k,l))) (CA4_6_6I2PairP ((5,3),(k,l))) = true := by + decide +kernel +lemma CA4_6_6I2PairP_check_5_4 : ∀ k l : Fin 6, contains (CA4_6_6I2PairRaw ((5,4),(k,l))) (CA4_6_6I2PairP ((5,4),(k,l))) = true := by + decide +kernel +lemma CA4_6_6I2PairP_check_5_5 : ∀ k l : Fin 6, contains (CA4_6_6I2PairRaw ((5,5),(k,l))) (CA4_6_6I2PairP ((5,5),(k,l))) = true := by + decide +kernel +lemma CA4_6_6I2PairP_check (a : PairSlot × PairSlot) : contains (CA4_6_6I2PairRaw a) (CA4_6_6I2PairP a) = true := by + rcases a with ⟨⟨i,j⟩,⟨k,l⟩⟩ + revert j i + apply forall_fin6 + · exact forall_fin6 (CA4_6_6I2PairP_check_0_0 k l) (CA4_6_6I2PairP_check_0_1 k l) (CA4_6_6I2PairP_check_0_2 k l) (CA4_6_6I2PairP_check_0_3 k l) (CA4_6_6I2PairP_check_0_4 k l) (CA4_6_6I2PairP_check_0_5 k l) + · exact forall_fin6 (CA4_6_6I2PairP_check_1_0 k l) (CA4_6_6I2PairP_check_1_1 k l) (CA4_6_6I2PairP_check_1_2 k l) (CA4_6_6I2PairP_check_1_3 k l) (CA4_6_6I2PairP_check_1_4 k l) (CA4_6_6I2PairP_check_1_5 k l) + · exact forall_fin6 (CA4_6_6I2PairP_check_2_0 k l) (CA4_6_6I2PairP_check_2_1 k l) (CA4_6_6I2PairP_check_2_2 k l) (CA4_6_6I2PairP_check_2_3 k l) (CA4_6_6I2PairP_check_2_4 k l) (CA4_6_6I2PairP_check_2_5 k l) + · exact forall_fin6 (CA4_6_6I2PairP_check_3_0 k l) (CA4_6_6I2PairP_check_3_1 k l) (CA4_6_6I2PairP_check_3_2 k l) (CA4_6_6I2PairP_check_3_3 k l) (CA4_6_6I2PairP_check_3_4 k l) (CA4_6_6I2PairP_check_3_5 k l) + · exact forall_fin6 (CA4_6_6I2PairP_check_4_0 k l) (CA4_6_6I2PairP_check_4_1 k l) (CA4_6_6I2PairP_check_4_2 k l) (CA4_6_6I2PairP_check_4_3 k l) (CA4_6_6I2PairP_check_4_4 k l) (CA4_6_6I2PairP_check_4_5 k l) + · exact forall_fin6 (CA4_6_6I2PairP_check_5_0 k l) (CA4_6_6I2PairP_check_5_1 k l) (CA4_6_6I2PairP_check_5_2 k l) (CA4_6_6I2PairP_check_5_3 k l) (CA4_6_6I2PairP_check_5_4 k l) (CA4_6_6I2PairP_check_5_5 k l) +lemma CA4_6_6I2PairP_sound (a : PairSlot × PairSlot) : + (CA4_6_6I2PairP a).Encloses (CA4_6_6I2PairValue a) := + contains_sound (CA4_6_6I2PairRaw_sound a) (CA4_6_6I2PairP_check a) +def CA4_6_6I2PairTerms (a : PairSlot × PairSlot) : Ball := + (CompactCertificate.entropyLookup CA4_6_6I2PairCertificates (CA4_6_6I2PairCertificateIndex a)).output +lemma CA4_6_6I2PairTerms_sound (a : PairSlot × PairSlot) : + (CA4_6_6I2PairTerms a).Encloses (Foundation.entropyTerm (CA4_6_6I2PairValue a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA4_6_6I2PairCertificates_valid + (CA4_6_6I2PairCertificateIndex a) (CA4_6_6I2PairP_sound a) +def CA4_6_6I2PairEntropy : Ball := ⟨(154442923167174487264206344281983 / 50000000000000000000000000000000), (66037078417 / 50000000000000000000000000000000)⟩ +lemma CA4_6_6I2PairEntropy_sound : CA4_6_6I2PairEntropy.Encloses (Foundation.finiteEntropy CA4_6_6I2PairValue) := by + exact contains_sound (entropyDoublePair_enclosed CA4_6_6I2PairValue CA4_6_6I2PairTerms CA4_6_6I2PairTerms_sound) (by decide +kernel) +def CA4_6_6I2PairMass : Ball := ⟨(50000000000000000000000000000007 / 50000000000000000000000000000000), (383 / 50000000000000000000000000000000)⟩ +lemma CA4_6_6I2PairMass_sound : CA4_6_6I2PairMass.Encloses (∑ a, CA4_6_6I2PairValue a) := by + exact contains_sound (doublePairSumBall_sound CA4_6_6I2PairP CA4_6_6I2PairValue CA4_6_6I2PairP_sound) (by decide +kernel) +def CA4_6_6I2PairMassTermLogWitness : LogWitness := ⟨0, 50000000000000000000000000000007, 50000000000000000000000000000000⟩ +def CA4_6_6I2PairMassTermLog : Ball := ⟨(7 / 50000000000000000000000000000000), (330872257 / 1562500000000000000000000000000)⟩ +lemma CA4_6_6I2PairMassTermLog_sound : CA4_6_6I2PairMassTermLog.Encloses (Real.log ((∑ a, CA4_6_6I2PairValue a))) := by + exact checkLog_sound logTwoBall_sound (CA4_6_6I2PairMass_sound) (w := CA4_6_6I2PairMassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA4_6_6I2PairMassTerm : Ball := ⟨(-7 / 50000000000000000000000000000000), (21175824449 / 100000000000000000000000000000000)⟩ +lemma CA4_6_6I2PairMassTerm_sound : CA4_6_6I2PairMassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA4_6_6I2PairValue a))) := by + exact contains_sound (entropyTerm_ball (CA4_6_6I2PairMass_sound) CA4_6_6I2PairMassTermLog_sound) (by decide +kernel) +def CA4_6_6I2PairH : Ball := ⟨(15444292316717448726420634428199 / 5000000000000000000000000000000), (153249981283 / 100000000000000000000000000000000)⟩ +lemma CA4_6_6I2PairH_sound : CA4_6_6I2PairH.Encloses (homogeneousEntropy CA4_6_6I2PairValue) := by + exact contains_sound (homogeneous_enclosed CA4_6_6I2PairValue CA4_6_6I2PairMassTerm_sound CA4_6_6I2PairEntropy_sound) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA5_5_6I0.lean b/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA5_5_6I0.lean new file mode 100644 index 0000000000000000000000000000000000000000..bc245589402e175d9195ba4edfd367afd3bed349 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA5_5_6I0.lean @@ -0,0 +1,78 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Certificates.Terminal1_1_6 + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CA5_5_6I0Value (a : Fin 17) : ℝ := marginal (below (shape 5 5 6)) (fun u => (stageALaw (shape 5 5 6) u : ℝ)) ((Equiv.refl (Fin 3)) 0) a +def CA5_5_6I0Raw (a : Fin 17) : Ball := marginalBall (below (shape 5 5 6)) A5_5_6Law ((Equiv.refl (Fin 3)) 0) a +lemma CA5_5_6I0Raw_sound (a : Fin 17) : + (CA5_5_6I0Raw a).Encloses (CA5_5_6I0Value a) := by + exact marginalBall_sound (below (shape 5 5 6)) A5_5_6Law (fun u => (stageALaw (shape 5 5 6) u : ℝ)) (fun u _ => A5_5_6Law_sound u) ((Equiv.refl (Fin 3)) 0) a +def CA5_5_6I0Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(270590761901983101291232024027 / 100000000000000000000000000000000), (1 / 20000000000000000000000000000000)⟩ ⟨(199977325278267617159334197177 / 12500000000000000000000000000000), (286499131 / 50000000000000000000000000000000)⟩ ⟨(-591231788912900138456119133348293 / 100000000000000000000000000000000), (211758238677 / 100000000000000000000000000000000)⟩ ⟨-9, 270590761901983101291232024027, 195312500000000000000000000000⟩, + .log ⟨(871492139876430027300788537499 / 10000000000000000000000000000000), (19 / 50000000000000000000000000000000)⟩ ⟨(4253114376545020880061123764263 / 20000000000000000000000000000000), (9227282079 / 100000000000000000000000000000000)⟩ ⟨(-244013352613144356441017926244217 / 100000000000000000000000000000000), (105879118851 / 100000000000000000000000000000000)⟩ ⟨-4, 871492139876430027300788537499, 625000000000000000000000000000⟩, + .log ⟨(20507243919666858312850441300491 / 50000000000000000000000000000000), (21 / 25000000000000000000000000000000)⟩ ⟨(36553949822179816556948326600019 / 100000000000000000000000000000000), (26055467047 / 100000000000000000000000000000000)⟩ ⟨(-44562240988321991640392161064429 / 50000000000000000000000000000000), (63527471253 / 100000000000000000000000000000000)⟩ ⟨-2, 20507243919666858312850441300491, 12500000000000000000000000000000⟩] +lemma CA5_5_6I0Certificates_valid : + CA5_5_6I0Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA5_5_6I0CertificateIndex (a : Fin 17) : ℕ := + match a.val with + | 0 => 1 + | 1 => 2 + | 2 => 3 + | 3 => 3 + | 4 => 2 + | 5 => 1 + | _ => 0 +def CA5_5_6I0P (a : Fin 17) : Ball := + (CompactCertificate.entropyLookup CA5_5_6I0Certificates (CA5_5_6I0CertificateIndex a)).input +lemma CA5_5_6I0P_check : ∀ a : Fin 17, contains (CA5_5_6I0Raw a) (CA5_5_6I0P a) = true := by + decide +kernel +lemma CA5_5_6I0P_sound (a : Fin 17) : + (CA5_5_6I0P a).Encloses (CA5_5_6I0Value a) := + contains_sound (CA5_5_6I0Raw_sound a) (CA5_5_6I0P_check a) +def CA5_5_6I0Terms (a : Fin 17) : Ball := + (CompactCertificate.entropyLookup CA5_5_6I0Certificates (CA5_5_6I0CertificateIndex a)).output +lemma CA5_5_6I0Terms_sound (a : Fin 17) : + (CA5_5_6I0Terms a).Encloses (Foundation.entropyTerm (CA5_5_6I0Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA5_5_6I0Certificates_valid + (CA5_5_6I0CertificateIndex a) (CA5_5_6I0P_sound a) +def CA5_5_6I0Entropy : Ball := ⟨(47535472245704849515622895199 / 40000000000000000000000000000), (8963936847 / 12500000000000000000000000000000)⟩ +lemma CA5_5_6I0Entropy_sound : CA5_5_6I0Entropy.Encloses (Foundation.finiteEntropy CA5_5_6I0Value) := by + exact contains_sound (entropyFin_enclosed 17 CA5_5_6I0Value CA5_5_6I0Terms CA5_5_6I0Terms_sound) (by decide +kernel) +def CA5_5_6I0Mass : Ball := ⟨(49999999999999999999999999999999 / 50000000000000000000000000000000), (127 / 50000000000000000000000000000000)⟩ +lemma CA5_5_6I0Mass_sound : CA5_5_6I0Mass.Encloses (∑ a, CA5_5_6I0Value a) := by + exact contains_sound (finSumBall_sound 17 CA5_5_6I0P CA5_5_6I0Value CA5_5_6I0P_sound) (by decide +kernel) +def CA5_5_6I0MassTermLogWitness : LogWitness := ⟨-1, 49999999999999999999999999999999, 25000000000000000000000000000000⟩ +def CA5_5_6I0MassTermLog : Ball := ⟨(-1 / 100000000000000000000000000000000), (2117582381 / 5000000000000000000000000000000)⟩ +lemma CA5_5_6I0MassTermLog_sound : CA5_5_6I0MassTermLog.Encloses (Real.log ((∑ a, CA5_5_6I0Value a))) := by + exact checkLog_sound logTwoBall_sound (CA5_5_6I0Mass_sound) (w := CA5_5_6I0MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA5_5_6I0MassTerm : Ball := ⟨(1 / 100000000000000000000000000000000), (42351647621 / 100000000000000000000000000000000)⟩ +lemma CA5_5_6I0MassTerm_sound : CA5_5_6I0MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA5_5_6I0Value a))) := by + exact contains_sound (entropyTerm_ball (CA5_5_6I0Mass_sound) CA5_5_6I0MassTermLog_sound) (by decide +kernel) +def CA5_5_6I0H : Ball := ⟨(118838680614262123789057237997499 / 100000000000000000000000000000000), (114063142397 / 100000000000000000000000000000000)⟩ +lemma CA5_5_6I0H_sound : CA5_5_6I0H.Encloses (homogeneousEntropy CA5_5_6I0Value) := by + exact contains_sound (homogeneous_enclosed CA5_5_6I0Value CA5_5_6I0MassTerm_sound CA5_5_6I0Entropy_sound) (by decide +kernel) +lemma CA5_5_6I0_sound : CA5_5_6I0H.Encloses (stageACapacity (shape 5 5 6) 0) := by + exact CA5_5_6I0H_sound + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA5_5_6I1.lean b/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA5_5_6I1.lean new file mode 100644 index 0000000000000000000000000000000000000000..ab2e32efb1986b53e94343a7863f56b076d89715 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA5_5_6I1.lean @@ -0,0 +1,1116 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Certificates.SupportedContraction + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CA5_5_6I1PairValue (a : PairSlot × PairSlot) : ℝ := pairLaw (below (shape 5 5 6)) (shape 5 5 6) (fun u => (stageALaw (shape 5 5 6) u : ℝ)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) a +def CA5_5_6I1PairRaw (a : PairSlot × PairSlot) : Ball := stageAPairBall (shape 5 5 6) A5_5_6Law 1 a +lemma CA5_5_6I1PairRaw_sound (a : PairSlot × PairSlot) : + (CA5_5_6I1PairRaw a).Encloses (CA5_5_6I1PairValue a) := by + exact stageAPairBall_sound (shape 5 5 6) (by decide +kernel) A5_5_6Law (fun u => (stageALaw (shape 5 5 6) u : ℝ)) (fun u _ => A5_5_6Law_sound u) 1 a +def CA5_5_6I1PairCertificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(93537288070256079402972541309 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(652381924125339307024405155381 / 100000000000000000000000000000000), (237687503 / 100000000000000000000000000000000)⟩ ⟨(-697456530528588441793418937411939 / 100000000000000000000000000000000), (50821977053 / 20000000000000000000000000000000)⟩ ⟨-11, 93537288070256079402972541309, 48828125000000000000000000000⟩, + .log ⟨(1613642536704346184787405822127 / 50000000000000000000000000000000), (19 / 100000000000000000000000000000000)⟩ ⟨(11080976686687357950484078695309 / 100000000000000000000000000000000), (2050212633 / 50000000000000000000000000000000)⟩ ⟨(-85838223418728811451671099437089 / 25000000000000000000000000000000), (63527471343 / 50000000000000000000000000000000)⟩ ⟨-5, 1613642536704346184787405822127, 1562500000000000000000000000000⟩, + .log ⟨(105748458053799922176503947421 / 50000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ ⟨(1302549239761697377852668102557 / 100000000000000000000000000000000), (111965539 / 25000000000000000000000000000000)⟩ ⟨(-307935752382086885208266943192763 / 50000000000000000000000000000000), (8470329511 / 4000000000000000000000000000000)⟩ ⟨-9, 105748458053799922176503947421, 97656250000000000000000000000⟩, + .log ⟨(839006469603486263195888899 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(32248122419825969306621328061 / 50000000000000000000000000000000), (4263999 / 20000000000000000000000000000000)⟩ ⟨(-960902078474627384583035355219307 / 100000000000000000000000000000000), (317637370143 / 100000000000000000000000000000000)⟩ ⟨-14, 839006469603486263195888899, 762939453125000000000000000⟩, + .log ⟨(115894106530178325567094543839 / 50000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ ⟨(1406282588477668427903360339541 / 100000000000000000000000000000000), (61353831 / 12500000000000000000000000000000)⟩ ⟨(-606710138496765798101697242384949 / 100000000000000000000000000000000), (52939559423 / 25000000000000000000000000000000)⟩ ⟨-9, 115894106530178325567094543839, 97656250000000000000000000000⟩, + .log ⟨(14720923342416175865597814517 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(129892358078622649085042416827 / 100000000000000000000000000000000), (8728377 / 20000000000000000000000000000000)⟩ ⟨(-220591390664261052584519050398637 / 25000000000000000000000000000000), (148230769177 / 50000000000000000000000000000000)⟩ ⟨-13, 14720923342416175865597814517, 12207031250000000000000000000⟩, + .log ⟨(342478869926790246694714177923 / 100000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ ⟨(972077555150069540765137454643 / 50000000000000000000000000000000), (725227237 / 100000000000000000000000000000000)⟩ ⟨(-283835775140774381653923397150353 / 50000000000000000000000000000000), (105879118853 / 50000000000000000000000000000000)⟩ ⟨-9, 342478869926790246694714177923, 195312500000000000000000000000⟩, + .log ⟨(5908704031647045563643605658289 / 50000000000000000000000000000000), (23 / 50000000000000000000000000000000)⟩ ⟨(12618607543410798900927802926913 / 50000000000000000000000000000000), (6256083811 / 50000000000000000000000000000000)⟩ ⟨(-213559648204165917402503523662071 / 100000000000000000000000000000000), (26469779701 / 25000000000000000000000000000000)⟩ ⟨-4, 5908704031647045563643605658289, 3125000000000000000000000000000⟩, + .log ⟨(77270193648899215581010397217 / 10000000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ ⟨(1878837154219123850744917697371 / 50000000000000000000000000000000), (1472634021 / 100000000000000000000000000000000)⟩ ⟨(-243151604195040036693364802809577 / 50000000000000000000000000000000), (38116482733 / 20000000000000000000000000000000)⟩ ⟨-8, 77270193648899215581010397217, 39062500000000000000000000000⟩, + .log ⟨(1589189209993002088149044443 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(17560066412729960079394565853 / 100000000000000000000000000000000), (5720919 / 100000000000000000000000000000000)⟩ ⟨(-1104970150961903706641593068790249 / 100000000000000000000000000000000), (71997813107 / 20000000000000000000000000000000)⟩ ⟨-16, 1589189209993002088149044443, 1525878906250000000000000000⟩, + .log ⟨(346874733494015276613142148599 / 100000000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ ⟨(982342611063375921042667996777 / 50000000000000000000000000000000), (734535847 / 100000000000000000000000000000000)⟩ ⟨(-283198087438768307756480081269003 / 50000000000000000000000000000000), (211758237983 / 100000000000000000000000000000000)⟩ ⟨-9, 346874733494015276613142148599, 195312500000000000000000000000⟩, + .log ⟨(3326635926250490731224746288949 / 100000000000000000000000000000000), (21 / 100000000000000000000000000000000)⟩ ⟨(1132123607638928403432988160347 / 10000000000000000000000000000000), (4226655443 / 100000000000000000000000000000000)⟩ ⟨(-170160431249079401322918921789431 / 50000000000000000000000000000000), (15881867841 / 12500000000000000000000000000000)⟩ ⟨-5, 3326635926250490731224746288949, 3125000000000000000000000000000⟩, + .log ⟨(10232154009125278381983263637 / 6250000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ ⟨(1050195810943384143989541388881 / 100000000000000000000000000000000), (76269353 / 20000000000000000000000000000000)⟩ ⟨(-320740081342719521173649740126007 / 50000000000000000000000000000000), (116467030867 / 50000000000000000000000000000000)⟩ ⟨-10, 10232154009125278381983263637, 6103515625000000000000000000⟩, + .log ⟨(8931430846063090726447876807 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(10408855692673650400315948783 / 12500000000000000000000000000000), (7092393 / 25000000000000000000000000000000)⟩ ⟨(-932334885379472895606571449505183 / 100000000000000000000000000000000), (317637366441 / 100000000000000000000000000000000)⟩ ⟨-14, 8931430846063090726447876807, 6103515625000000000000000000⟩, + .log ⟨(1217655791446770390904187641 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(517399029813141660603578609 / 2000000000000000000000000000000), (4383433 / 50000000000000000000000000000000)⟩ ⟨(-531142537825066128646635079222143 / 50000000000000000000000000000000), (359989043673 / 100000000000000000000000000000000)⟩ ⟨-16, 1217655791446770390904187641, 762939453125000000000000000⟩, + .log ⟨(63826366823931803670370729979 / 50000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ ⟨(425314137905799802263071395953 / 50000000000000000000000000000000), (1858417 / 625000000000000000000000000000)⟩ ⟨(-666361190633096713230454251391847 / 100000000000000000000000000000000), (232934062863 / 100000000000000000000000000000000)⟩ ⟨-10, 63826366823931803670370729979, 48828125000000000000000000000⟩, + .log ⟨(6318022770492013635887522281 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(61092242223303530802112754089 / 100000000000000000000000000000000), (5017103 / 25000000000000000000000000000000)⟩ ⟨(-966951915853035071028086549271659 / 100000000000000000000000000000000), (4963083923 / 1562500000000000000000000000000)⟩ ⟨-14, 6318022770492013635887522281, 6103515625000000000000000000⟩] +lemma CA5_5_6I1PairCertificates_valid : + CA5_5_6I1PairCertificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA5_5_6I1PairCertificateIndex (a : PairSlot × PairSlot) : ℕ := + match a.1.1.val, a.1.2.val, a.2.1.val, a.2.2.val with + | 2, 0, 4, 0 => 1 + | 2, 0, 2, 1 => 2 + | 2, 0, 3, 1 => 3 + | 2, 0, 1, 2 => 2 + | 2, 0, 1, 3 => 3 + | 2, 0, 0, 4 => 1 + | 3, 0, 4, 0 => 4 + | 3, 0, 2, 1 => 5 + | 3, 0, 3, 1 => 6 + | 3, 0, 1, 2 => 5 + | 3, 0, 1, 3 => 6 + | 3, 0, 0, 4 => 4 + | 1, 1, 4, 0 => 7 + | 1, 1, 2, 1 => 8 + | 1, 1, 3, 1 => 9 + | 1, 1, 1, 2 => 8 + | 1, 1, 1, 3 => 9 + | 1, 1, 0, 4 => 7 + | 0, 2, 4, 0 => 1 + | 0, 2, 2, 1 => 2 + | 0, 2, 3, 1 => 3 + | 0, 2, 1, 2 => 2 + | 0, 2, 1, 3 => 3 + | 0, 2, 0, 4 => 1 + | 0, 3, 4, 0 => 4 + | 0, 3, 2, 1 => 5 + | 0, 3, 3, 1 => 6 + | 0, 3, 1, 2 => 5 + | 0, 3, 1, 3 => 6 + | 0, 3, 0, 4 => 4 + | 4, 0, 2, 0 => 1 + | 4, 0, 3, 0 => 4 + | 4, 0, 1, 1 => 7 + | 4, 0, 0, 2 => 1 + | 4, 0, 0, 3 => 4 + | 2, 1, 2, 0 => 2 + | 2, 1, 3, 0 => 5 + | 2, 1, 1, 1 => 8 + | 2, 1, 0, 2 => 2 + | 2, 1, 0, 3 => 5 + | 3, 1, 2, 0 => 3 + | 3, 1, 3, 0 => 6 + | 3, 1, 1, 1 => 9 + | 3, 1, 0, 2 => 3 + | 3, 1, 0, 3 => 6 + | 1, 2, 2, 0 => 2 + | 1, 2, 3, 0 => 5 + | 1, 2, 1, 1 => 8 + | 1, 2, 0, 2 => 2 + | 1, 2, 0, 3 => 5 + | 1, 3, 2, 0 => 3 + | 1, 3, 3, 0 => 6 + | 1, 3, 1, 1 => 9 + | 1, 3, 0, 2 => 3 + | 1, 3, 0, 3 => 6 + | 0, 4, 2, 0 => 1 + | 0, 4, 3, 0 => 4 + | 0, 4, 1, 1 => 7 + | 0, 4, 0, 2 => 1 + | 0, 4, 0, 3 => 4 + | 0, 5, 1, 0 => 10 + | 0, 5, 0, 1 => 10 + | 1, 4, 1, 0 => 11 + | 1, 4, 0, 1 => 11 + | 2, 2, 1, 0 => 12 + | 2, 2, 0, 1 => 12 + | 2, 3, 1, 0 => 13 + | 2, 3, 0, 1 => 13 + | 3, 2, 1, 0 => 13 + | 3, 2, 0, 1 => 13 + | 3, 3, 1, 0 => 14 + | 3, 3, 0, 1 => 14 + | 4, 1, 1, 0 => 11 + | 4, 1, 0, 1 => 11 + | 5, 0, 1, 0 => 10 + | 5, 0, 0, 1 => 10 + | 1, 5, 0, 0 => 15 + | 2, 4, 0, 0 => 16 + | 3, 4, 0, 0 => 17 + | 4, 2, 0, 0 => 16 + | 4, 3, 0, 0 => 17 + | 5, 1, 0, 0 => 15 + | 0, 1, 5, 0 => 10 + | 0, 1, 4, 1 => 11 + | 0, 1, 2, 2 => 12 + | 0, 1, 2, 3 => 13 + | 0, 1, 3, 2 => 13 + | 0, 1, 3, 3 => 14 + | 0, 1, 1, 4 => 11 + | 0, 1, 0, 5 => 10 + | 1, 0, 5, 0 => 10 + | 1, 0, 4, 1 => 11 + | 1, 0, 2, 2 => 12 + | 1, 0, 2, 3 => 13 + | 1, 0, 3, 2 => 13 + | 1, 0, 3, 3 => 14 + | 1, 0, 1, 4 => 11 + | 1, 0, 0, 5 => 10 + | 0, 0, 1, 5 => 15 + | 0, 0, 2, 4 => 16 + | 0, 0, 3, 4 => 17 + | 0, 0, 4, 2 => 16 + | 0, 0, 4, 3 => 17 + | 0, 0, 5, 1 => 15 + | _, _, _, _ => 0 +def CA5_5_6I1PairP (a : PairSlot × PairSlot) : Ball := + (CompactCertificate.entropyLookup CA5_5_6I1PairCertificates (CA5_5_6I1PairCertificateIndex a)).input +lemma CA5_5_6I1PairP_check_0_0 : ∀ k l : Fin 6, contains (CA5_5_6I1PairRaw ((0,0),(k,l))) (CA5_5_6I1PairP ((0,0),(k,l))) = true := by + decide +kernel +lemma CA5_5_6I1PairP_check_0_1 : ∀ k l : Fin 6, contains (CA5_5_6I1PairRaw ((0,1),(k,l))) (CA5_5_6I1PairP ((0,1),(k,l))) = true := by + decide +kernel +lemma CA5_5_6I1PairP_check_0_2 : ∀ k l : Fin 6, contains (CA5_5_6I1PairRaw ((0,2),(k,l))) (CA5_5_6I1PairP ((0,2),(k,l))) = true := by + decide +kernel +lemma CA5_5_6I1PairP_check_0_3 : ∀ k l : Fin 6, contains (CA5_5_6I1PairRaw ((0,3),(k,l))) (CA5_5_6I1PairP ((0,3),(k,l))) = true := by + decide +kernel +lemma CA5_5_6I1PairP_check_0_4 : ∀ k l : Fin 6, contains (CA5_5_6I1PairRaw ((0,4),(k,l))) (CA5_5_6I1PairP ((0,4),(k,l))) = true := by + decide +kernel +lemma CA5_5_6I1PairP_check_0_5 : ∀ k l : Fin 6, contains (CA5_5_6I1PairRaw ((0,5),(k,l))) (CA5_5_6I1PairP ((0,5),(k,l))) = true := by + decide +kernel +lemma CA5_5_6I1PairP_check_1_0 : ∀ k l : Fin 6, contains (CA5_5_6I1PairRaw ((1,0),(k,l))) (CA5_5_6I1PairP ((1,0),(k,l))) = true := by + decide +kernel +lemma CA5_5_6I1PairP_check_1_1 : ∀ k l : Fin 6, contains (CA5_5_6I1PairRaw ((1,1),(k,l))) (CA5_5_6I1PairP ((1,1),(k,l))) = true := by + decide +kernel +lemma CA5_5_6I1PairP_check_1_2 : ∀ k l : Fin 6, contains (CA5_5_6I1PairRaw ((1,2),(k,l))) (CA5_5_6I1PairP ((1,2),(k,l))) = true := by + decide +kernel +lemma CA5_5_6I1PairP_check_1_3 : ∀ k l : Fin 6, contains (CA5_5_6I1PairRaw ((1,3),(k,l))) (CA5_5_6I1PairP ((1,3),(k,l))) = true := by + decide +kernel +lemma CA5_5_6I1PairP_check_1_4 : ∀ k l : Fin 6, contains (CA5_5_6I1PairRaw ((1,4),(k,l))) (CA5_5_6I1PairP ((1,4),(k,l))) = true := by + decide +kernel +lemma CA5_5_6I1PairP_check_1_5 : ∀ k l : Fin 6, contains (CA5_5_6I1PairRaw ((1,5),(k,l))) (CA5_5_6I1PairP ((1,5),(k,l))) = true := by + decide +kernel +lemma CA5_5_6I1PairP_check_2_0 : ∀ k l : Fin 6, contains (CA5_5_6I1PairRaw ((2,0),(k,l))) (CA5_5_6I1PairP ((2,0),(k,l))) = true := by + decide +kernel +lemma CA5_5_6I1PairP_check_2_1 : ∀ k l : Fin 6, contains (CA5_5_6I1PairRaw ((2,1),(k,l))) (CA5_5_6I1PairP ((2,1),(k,l))) = true := by + decide +kernel +lemma CA5_5_6I1PairP_check_2_2 : ∀ k l : Fin 6, contains (CA5_5_6I1PairRaw ((2,2),(k,l))) (CA5_5_6I1PairP ((2,2),(k,l))) = true := by + decide +kernel +lemma CA5_5_6I1PairP_check_2_3 : ∀ k l : Fin 6, contains (CA5_5_6I1PairRaw ((2,3),(k,l))) (CA5_5_6I1PairP ((2,3),(k,l))) = true := by + decide +kernel +lemma CA5_5_6I1PairP_check_2_4 : ∀ k l : Fin 6, contains (CA5_5_6I1PairRaw ((2,4),(k,l))) (CA5_5_6I1PairP ((2,4),(k,l))) = true := by + decide +kernel +lemma CA5_5_6I1PairP_check_2_5 : ∀ k l : Fin 6, contains (CA5_5_6I1PairRaw ((2,5),(k,l))) (CA5_5_6I1PairP ((2,5),(k,l))) = true := by + decide +kernel +lemma CA5_5_6I1PairP_check_3_0 : ∀ k l : Fin 6, contains (CA5_5_6I1PairRaw ((3,0),(k,l))) (CA5_5_6I1PairP ((3,0),(k,l))) = true := by + decide +kernel +lemma CA5_5_6I1PairP_check_3_1 : ∀ k l : Fin 6, contains (CA5_5_6I1PairRaw ((3,1),(k,l))) (CA5_5_6I1PairP ((3,1),(k,l))) = true := by + decide +kernel +lemma CA5_5_6I1PairP_check_3_2 : ∀ k l : Fin 6, contains (CA5_5_6I1PairRaw ((3,2),(k,l))) (CA5_5_6I1PairP ((3,2),(k,l))) = true := by + decide +kernel +lemma CA5_5_6I1PairP_check_3_3 : ∀ k l : Fin 6, contains (CA5_5_6I1PairRaw ((3,3),(k,l))) (CA5_5_6I1PairP ((3,3),(k,l))) = true := by + decide +kernel +lemma CA5_5_6I1PairP_check_3_4 : ∀ k l : Fin 6, contains (CA5_5_6I1PairRaw ((3,4),(k,l))) (CA5_5_6I1PairP ((3,4),(k,l))) = true := by + decide +kernel +lemma CA5_5_6I1PairP_check_3_5 : ∀ k l : Fin 6, contains (CA5_5_6I1PairRaw ((3,5),(k,l))) (CA5_5_6I1PairP ((3,5),(k,l))) = true := by + decide +kernel +lemma CA5_5_6I1PairP_check_4_0 : ∀ k l : Fin 6, contains (CA5_5_6I1PairRaw ((4,0),(k,l))) (CA5_5_6I1PairP ((4,0),(k,l))) = true := by + decide +kernel +lemma CA5_5_6I1PairP_check_4_1 : ∀ k l : Fin 6, contains (CA5_5_6I1PairRaw ((4,1),(k,l))) (CA5_5_6I1PairP ((4,1),(k,l))) = true := by + decide +kernel +lemma CA5_5_6I1PairP_check_4_2 : ∀ k l : Fin 6, contains (CA5_5_6I1PairRaw ((4,2),(k,l))) (CA5_5_6I1PairP ((4,2),(k,l))) = true := by + decide +kernel +lemma CA5_5_6I1PairP_check_4_3 : ∀ k l : Fin 6, contains (CA5_5_6I1PairRaw ((4,3),(k,l))) (CA5_5_6I1PairP ((4,3),(k,l))) = true := by + decide +kernel +lemma CA5_5_6I1PairP_check_4_4 : ∀ k l : Fin 6, contains (CA5_5_6I1PairRaw ((4,4),(k,l))) (CA5_5_6I1PairP ((4,4),(k,l))) = true := by + decide +kernel +lemma CA5_5_6I1PairP_check_4_5 : ∀ k l : Fin 6, contains (CA5_5_6I1PairRaw ((4,5),(k,l))) (CA5_5_6I1PairP ((4,5),(k,l))) = true := by + decide +kernel +lemma CA5_5_6I1PairP_check_5_0 : ∀ k l : Fin 6, contains (CA5_5_6I1PairRaw ((5,0),(k,l))) (CA5_5_6I1PairP ((5,0),(k,l))) = true := by + decide +kernel +lemma CA5_5_6I1PairP_check_5_1 : ∀ k l : Fin 6, contains (CA5_5_6I1PairRaw ((5,1),(k,l))) (CA5_5_6I1PairP ((5,1),(k,l))) = true := by + decide +kernel +lemma CA5_5_6I1PairP_check_5_2 : ∀ k l : Fin 6, contains (CA5_5_6I1PairRaw ((5,2),(k,l))) (CA5_5_6I1PairP ((5,2),(k,l))) = true := by + decide +kernel +lemma CA5_5_6I1PairP_check_5_3 : ∀ k l : Fin 6, contains (CA5_5_6I1PairRaw ((5,3),(k,l))) (CA5_5_6I1PairP ((5,3),(k,l))) = true := by + decide +kernel +lemma CA5_5_6I1PairP_check_5_4 : ∀ k l : Fin 6, contains (CA5_5_6I1PairRaw ((5,4),(k,l))) (CA5_5_6I1PairP ((5,4),(k,l))) = true := by + decide +kernel +lemma CA5_5_6I1PairP_check_5_5 : ∀ k l : Fin 6, contains (CA5_5_6I1PairRaw ((5,5),(k,l))) (CA5_5_6I1PairP ((5,5),(k,l))) = true := by + decide +kernel +lemma CA5_5_6I1PairP_check (a : PairSlot × PairSlot) : contains (CA5_5_6I1PairRaw a) (CA5_5_6I1PairP a) = true := by + rcases a with ⟨⟨i,j⟩,⟨k,l⟩⟩ + revert j i + apply forall_fin6 + · exact forall_fin6 (CA5_5_6I1PairP_check_0_0 k l) (CA5_5_6I1PairP_check_0_1 k l) (CA5_5_6I1PairP_check_0_2 k l) (CA5_5_6I1PairP_check_0_3 k l) (CA5_5_6I1PairP_check_0_4 k l) (CA5_5_6I1PairP_check_0_5 k l) + · exact forall_fin6 (CA5_5_6I1PairP_check_1_0 k l) (CA5_5_6I1PairP_check_1_1 k l) (CA5_5_6I1PairP_check_1_2 k l) (CA5_5_6I1PairP_check_1_3 k l) (CA5_5_6I1PairP_check_1_4 k l) (CA5_5_6I1PairP_check_1_5 k l) + · exact forall_fin6 (CA5_5_6I1PairP_check_2_0 k l) (CA5_5_6I1PairP_check_2_1 k l) (CA5_5_6I1PairP_check_2_2 k l) (CA5_5_6I1PairP_check_2_3 k l) (CA5_5_6I1PairP_check_2_4 k l) (CA5_5_6I1PairP_check_2_5 k l) + · exact forall_fin6 (CA5_5_6I1PairP_check_3_0 k l) (CA5_5_6I1PairP_check_3_1 k l) (CA5_5_6I1PairP_check_3_2 k l) (CA5_5_6I1PairP_check_3_3 k l) (CA5_5_6I1PairP_check_3_4 k l) (CA5_5_6I1PairP_check_3_5 k l) + · exact forall_fin6 (CA5_5_6I1PairP_check_4_0 k l) (CA5_5_6I1PairP_check_4_1 k l) (CA5_5_6I1PairP_check_4_2 k l) (CA5_5_6I1PairP_check_4_3 k l) (CA5_5_6I1PairP_check_4_4 k l) (CA5_5_6I1PairP_check_4_5 k l) + · exact forall_fin6 (CA5_5_6I1PairP_check_5_0 k l) (CA5_5_6I1PairP_check_5_1 k l) (CA5_5_6I1PairP_check_5_2 k l) (CA5_5_6I1PairP_check_5_3 k l) (CA5_5_6I1PairP_check_5_4 k l) (CA5_5_6I1PairP_check_5_5 k l) +lemma CA5_5_6I1PairP_sound (a : PairSlot × PairSlot) : + (CA5_5_6I1PairP a).Encloses (CA5_5_6I1PairValue a) := + contains_sound (CA5_5_6I1PairRaw_sound a) (CA5_5_6I1PairP_check a) +def CA5_5_6I1PairTerms (a : PairSlot × PairSlot) : Ball := + (CompactCertificate.entropyLookup CA5_5_6I1PairCertificates (CA5_5_6I1PairCertificateIndex a)).output +lemma CA5_5_6I1PairTerms_sound (a : PairSlot × PairSlot) : + (CA5_5_6I1PairTerms a).Encloses (Foundation.entropyTerm (CA5_5_6I1PairValue a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA5_5_6I1PairCertificates_valid + (CA5_5_6I1PairCertificateIndex a) (CA5_5_6I1PairP_sound a) +def CA5_5_6I1PairEntropy : Ball := ⟨(78619182179922625235000698456083 / 25000000000000000000000000000000), (32217977861 / 25000000000000000000000000000000)⟩ +lemma CA5_5_6I1PairEntropy_sound : CA5_5_6I1PairEntropy.Encloses (Foundation.finiteEntropy CA5_5_6I1PairValue) := by + exact contains_sound (entropyDoublePair_enclosed CA5_5_6I1PairValue CA5_5_6I1PairTerms CA5_5_6I1PairTerms_sound) (by decide +kernel) +def CA5_5_6I1PairMass : Ball := ⟨1, (73 / 12500000000000000000000000000000)⟩ +lemma CA5_5_6I1PairMass_sound : CA5_5_6I1PairMass.Encloses (∑ a, CA5_5_6I1PairValue a) := by + exact contains_sound (doublePairSumBall_sound CA5_5_6I1PairP CA5_5_6I1PairValue CA5_5_6I1PairP_sound) (by decide +kernel) +def CA5_5_6I1PairMassTermLogWitness : LogWitness := ⟨0, 1, 1⟩ +def CA5_5_6I1PairMassTermLog : Ball := ⟨0, (10587912133 / 50000000000000000000000000000000)⟩ +lemma CA5_5_6I1PairMassTermLog_sound : CA5_5_6I1PairMassTermLog.Encloses (Real.log ((∑ a, CA5_5_6I1PairValue a))) := by + exact checkLog_sound logTwoBall_sound (CA5_5_6I1PairMass_sound) (w := CA5_5_6I1PairMassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA5_5_6I1PairMassTerm : Ball := ⟨0, (21175824267 / 100000000000000000000000000000000)⟩ +lemma CA5_5_6I1PairMassTerm_sound : CA5_5_6I1PairMassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA5_5_6I1PairValue a))) := by + exact contains_sound (entropyTerm_ball (CA5_5_6I1PairMass_sound) CA5_5_6I1PairMassTermLog_sound) (by decide +kernel) +def CA5_5_6I1PairH : Ball := ⟨(78619182179922625235000698456083 / 25000000000000000000000000000000), (150047735711 / 100000000000000000000000000000000)⟩ +lemma CA5_5_6I1PairH_sound : CA5_5_6I1PairH.Encloses (homogeneousEntropy CA5_5_6I1PairValue) := by + exact contains_sound (homogeneous_enclosed CA5_5_6I1PairValue CA5_5_6I1PairMassTerm_sound CA5_5_6I1PairEntropy_sound) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CA5_5_6I1R0Value (a : PairSlot) : ℝ := residualLaw (below (shape 5 5 6)) (fun u => (stageALaw (shape 5 5 6) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 0 a +def CA5_5_6I1R0Raw (a : PairSlot) : Ball := residualBall (below (shape 5 5 6)) A5_5_6Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 0 a +lemma CA5_5_6I1R0Raw_sound (a : PairSlot) : + (CA5_5_6I1R0Raw a).Encloses (CA5_5_6I1R0Value a) := by + exact residualBall_sound_on (below (shape 5 5 6)) A5_5_6Law (fun u => (stageALaw (shape 5 5 6) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A5_5_6Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 5 5 6) (show (shape 5 5 6) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 0 a +def CA5_5_6I1R0Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(272812136002498323516874715041 / 100000000000000000000000000000000), (1 / 20000000000000000000000000000000)⟩ ⟨(402680401197399720458807296919 / 25000000000000000000000000000000), (144425551 / 25000000000000000000000000000000)⟩ ⟨(-18450443916180478597926154971713 / 3125000000000000000000000000000), (105879119331 / 50000000000000000000000000000000)⟩ ⟨-9, 272812136002498323516874715041, 195312500000000000000000000000⟩] +lemma CA5_5_6I1R0Certificates_valid : + CA5_5_6I1R0Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA5_5_6I1R0CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 0, 0 => 1 + | _, _ => 0 +def CA5_5_6I1R0P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA5_5_6I1R0Certificates (CA5_5_6I1R0CertificateIndex a)).input +lemma CA5_5_6I1R0P_check : ∀ a : PairSlot, contains (CA5_5_6I1R0Raw a) (CA5_5_6I1R0P a) = true := by + decide +kernel +lemma CA5_5_6I1R0P_sound (a : PairSlot) : + (CA5_5_6I1R0P a).Encloses (CA5_5_6I1R0Value a) := + contains_sound (CA5_5_6I1R0Raw_sound a) (CA5_5_6I1R0P_check a) +def CA5_5_6I1R0Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA5_5_6I1R0Certificates (CA5_5_6I1R0CertificateIndex a)).output +lemma CA5_5_6I1R0Terms_sound (a : PairSlot) : + (CA5_5_6I1R0Terms a).Encloses (Foundation.entropyTerm (CA5_5_6I1R0Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA5_5_6I1R0Certificates_valid + (CA5_5_6I1R0CertificateIndex a) (CA5_5_6I1R0P_sound a) +def CA5_5_6I1R0Entropy : Ball := ⟨(402680401197399720458807296919 / 25000000000000000000000000000000), (144425551 / 25000000000000000000000000000000)⟩ +lemma CA5_5_6I1R0Entropy_sound : CA5_5_6I1R0Entropy.Encloses (Foundation.finiteEntropy CA5_5_6I1R0Value) := by + exact contains_sound (entropyPair_enclosed CA5_5_6I1R0Value CA5_5_6I1R0Terms CA5_5_6I1R0Terms_sound) (by decide +kernel) +def CA5_5_6I1R0Mass : Ball := ⟨(272812136002498323516874715041 / 100000000000000000000000000000000), (1 / 20000000000000000000000000000000)⟩ +lemma CA5_5_6I1R0Mass_sound : CA5_5_6I1R0Mass.Encloses (∑ a, CA5_5_6I1R0Value a) := by + exact contains_sound (pairSumBall_sound CA5_5_6I1R0P CA5_5_6I1R0Value CA5_5_6I1R0P_sound) (by decide +kernel) +def CA5_5_6I1R0MassTermLogWitness : LogWitness := ⟨-9, 272812136002498323516874715041, 195312500000000000000000000000⟩ +def CA5_5_6I1R0MassTermLog : Ball := ⟨(-18450443916180478597926154971713 / 3125000000000000000000000000000), (105879119331 / 50000000000000000000000000000000)⟩ +lemma CA5_5_6I1R0MassTermLog_sound : CA5_5_6I1R0MassTermLog.Encloses (Real.log ((∑ a, CA5_5_6I1R0Value a))) := by + exact checkLog_sound logTwoBall_sound (CA5_5_6I1R0Mass_sound) (w := CA5_5_6I1R0MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA5_5_6I1R0MassTerm : Ball := ⟨(402680401197399720458807296919 / 25000000000000000000000000000000), (144425551 / 25000000000000000000000000000000)⟩ +lemma CA5_5_6I1R0MassTerm_sound : CA5_5_6I1R0MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA5_5_6I1R0Value a))) := by + exact contains_sound (entropyTerm_ball (CA5_5_6I1R0Mass_sound) CA5_5_6I1R0MassTermLog_sound) (by decide +kernel) +def CA5_5_6I1R0H : Ball := ⟨0, (144425551 / 12500000000000000000000000000000)⟩ +lemma CA5_5_6I1R0H_sound : CA5_5_6I1R0H.Encloses (homogeneousEntropy CA5_5_6I1R0Value) := by + exact contains_sound (homogeneous_enclosed CA5_5_6I1R0Value CA5_5_6I1R0MassTerm_sound CA5_5_6I1R0Entropy_sound) (by decide +kernel) +def CA5_5_6I1R1Value (a : PairSlot) : ℝ := residualLaw (below (shape 5 5 6)) (fun u => (stageALaw (shape 5 5 6) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 1 a +def CA5_5_6I1R1Raw (a : PairSlot) : Ball := residualBall (below (shape 5 5 6)) A5_5_6Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 1 a +lemma CA5_5_6I1R1Raw_sound (a : PairSlot) : + (CA5_5_6I1R1Raw a).Encloses (CA5_5_6I1R1Value a) := by + exact residualBall_sound_on (below (shape 5 5 6)) A5_5_6Law (fun u => (stageALaw (shape 5 5 6) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A5_5_6Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 5 5 6) (show (shape 5 5 6) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 1 a +def CA5_5_6I1R1Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(4359924130796579287577240988223 / 100000000000000000000000000000000), (23 / 100000000000000000000000000000000)⟩ ⟨(1365840203404610014013524827681 / 10000000000000000000000000000000), (692437397 / 12500000000000000000000000000000)⟩ ⟨(-313271552997199605743781525828231 / 100000000000000000000000000000000), (1016439541 / 800000000000000000000000000000)⟩ ⟨-5, 4359924130796579287577240988223, 3125000000000000000000000000000⟩] +lemma CA5_5_6I1R1Certificates_valid : + CA5_5_6I1R1Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA5_5_6I1R1CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 0, 1 => 1 + | 1, 0 => 1 + | _, _ => 0 +def CA5_5_6I1R1P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA5_5_6I1R1Certificates (CA5_5_6I1R1CertificateIndex a)).input +lemma CA5_5_6I1R1P_check : ∀ a : PairSlot, contains (CA5_5_6I1R1Raw a) (CA5_5_6I1R1P a) = true := by + decide +kernel +lemma CA5_5_6I1R1P_sound (a : PairSlot) : + (CA5_5_6I1R1P a).Encloses (CA5_5_6I1R1Value a) := + contains_sound (CA5_5_6I1R1Raw_sound a) (CA5_5_6I1R1P_check a) +def CA5_5_6I1R1Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA5_5_6I1R1Certificates (CA5_5_6I1R1CertificateIndex a)).output +lemma CA5_5_6I1R1Terms_sound (a : PairSlot) : + (CA5_5_6I1R1Terms a).Encloses (Foundation.entropyTerm (CA5_5_6I1R1Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA5_5_6I1R1Certificates_valid + (CA5_5_6I1R1CertificateIndex a) (CA5_5_6I1R1P_sound a) +def CA5_5_6I1R1Entropy : Ball := ⟨(1365840203404610014013524827681 / 5000000000000000000000000000000), (692437397 / 6250000000000000000000000000000)⟩ +lemma CA5_5_6I1R1Entropy_sound : CA5_5_6I1R1Entropy.Encloses (Foundation.finiteEntropy CA5_5_6I1R1Value) := by + exact contains_sound (entropyPair_enclosed CA5_5_6I1R1Value CA5_5_6I1R1Terms CA5_5_6I1R1Terms_sound) (by decide +kernel) +def CA5_5_6I1R1Mass : Ball := ⟨(4359924130796579287577240988223 / 50000000000000000000000000000000), (23 / 50000000000000000000000000000000)⟩ +lemma CA5_5_6I1R1Mass_sound : CA5_5_6I1R1Mass.Encloses (∑ a, CA5_5_6I1R1Value a) := by + exact contains_sound (pairSumBall_sound CA5_5_6I1R1P CA5_5_6I1R1Value CA5_5_6I1R1P_sound) (by decide +kernel) +def CA5_5_6I1R1MassTermLogWitness : LogWitness := ⟨-4, 4359924130796579287577240988223, 3125000000000000000000000000000⟩ +def CA5_5_6I1R1MassTermLog : Ball := ⟨(-243956834941205074802058332777901 / 100000000000000000000000000000000), (52939559471 / 50000000000000000000000000000000)⟩ +lemma CA5_5_6I1R1MassTermLog_sound : CA5_5_6I1R1MassTermLog.Encloses (Real.log ((∑ a, CA5_5_6I1R1Value a))) := by + exact checkLog_sound logTwoBall_sound (CA5_5_6I1R1Mass_sound) (w := CA5_5_6I1R1MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA5_5_6I1R1MassTerm : Ball := ⟨(4254533166131672394740051234551 / 20000000000000000000000000000000), (73859989 / 800000000000000000000000000000)⟩ +lemma CA5_5_6I1R1MassTerm_sound : CA5_5_6I1R1MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA5_5_6I1R1Value a))) := by + exact contains_sound (entropyTerm_ball (CA5_5_6I1R1Mass_sound) CA5_5_6I1R1MassTermLog_sound) (by decide +kernel) +def CA5_5_6I1R1H : Ball := ⟨(1208827647486767661314048076173 / 20000000000000000000000000000000), (20311496977 / 100000000000000000000000000000000)⟩ +lemma CA5_5_6I1R1H_sound : CA5_5_6I1R1H.Encloses (homogeneousEntropy CA5_5_6I1R1Value) := by + exact contains_sound (homogeneous_enclosed CA5_5_6I1R1Value CA5_5_6I1R1MassTerm_sound CA5_5_6I1R1Entropy_sound) (by decide +kernel) +def CA5_5_6I1R2Value (a : PairSlot) : ℝ := residualLaw (below (shape 5 5 6)) (fun u => (stageALaw (shape 5 5 6) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 2 a +def CA5_5_6I1R2Raw (a : PairSlot) : Ball := residualBall (below (shape 5 5 6)) A5_5_6Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 2 a +lemma CA5_5_6I1R2Raw_sound (a : PairSlot) : + (CA5_5_6I1R2Raw a).Encloses (CA5_5_6I1R2Value a) := by + exact residualBall_sound_on (below (shape 5 5 6)) A5_5_6Law (fun u => (stageALaw (shape 5 5 6) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A5_5_6Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 5 5 6) (show (shape 5 5 6) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 2 a +def CA5_5_6I1R2Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(706463855517309658666158416081 / 10000000000000000000000000000000), (7 / 20000000000000000000000000000000)⟩ ⟨(18721774905585311917576443552047 / 100000000000000000000000000000000), (149599543 / 2000000000000000000000000000000)⟩ ⟨(-265006833107919618614468150433133 / 100000000000000000000000000000000), (10587911891 / 10000000000000000000000000000000)⟩ ⟨-4, 706463855517309658666158416081, 625000000000000000000000000000⟩, + .log ⟨(20257695052768057368428321071 / 4000000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ ⟨(1338404367096807668078744925419 / 50000000000000000000000000000000), (60324383 / 6250000000000000000000000000000)⟩ ⟨(-528551491612635391787962770436149 / 100000000000000000000000000000000), (11911400871 / 6250000000000000000000000000000)⟩ ⟨-8, 20257695052768057368428321071, 15625000000000000000000000000⟩, + .log ⟨(12932588869709873529792029466671 / 50000000000000000000000000000000), (39 / 50000000000000000000000000000000)⟩ ⟨(34976771429046153962921539625079 / 100000000000000000000000000000000), (4107873371 / 25000000000000000000000000000000)⟩ ⟨(-135227261074413224277923572694637 / 100000000000000000000000000000000), (1270549427 / 2000000000000000000000000000000)⟩ ⟨-2, 12932588869709873529792029466671, 12500000000000000000000000000000⟩] +lemma CA5_5_6I1R2Certificates_valid : + CA5_5_6I1R2Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA5_5_6I1R2CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 2, 0 => 1 + | 3, 0 => 2 + | 1, 1 => 3 + | 0, 2 => 1 + | 0, 3 => 2 + | _, _ => 0 +def CA5_5_6I1R2P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA5_5_6I1R2Certificates (CA5_5_6I1R2CertificateIndex a)).input +lemma CA5_5_6I1R2P_check : ∀ a : PairSlot, contains (CA5_5_6I1R2Raw a) (CA5_5_6I1R2P a) = true := by + decide +kernel +lemma CA5_5_6I1R2P_sound (a : PairSlot) : + (CA5_5_6I1R2P a).Encloses (CA5_5_6I1R2Value a) := + contains_sound (CA5_5_6I1R2Raw_sound a) (CA5_5_6I1R2P_check a) +def CA5_5_6I1R2Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA5_5_6I1R2Certificates (CA5_5_6I1R2CertificateIndex a)).output +lemma CA5_5_6I1R2Terms_sound (a : PairSlot) : + (CA5_5_6I1R2Terms a).Encloses (Foundation.entropyTerm (CA5_5_6I1R2Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA5_5_6I1R2Certificates_valid + (CA5_5_6I1R2CertificateIndex a) (CA5_5_6I1R2P_sound a) +def CA5_5_6I1R2Entropy : Ball := ⟨(77773938708604008470389406430849 / 100000000000000000000000000000000), (833045701 / 2500000000000000000000000000000)⟩ +lemma CA5_5_6I1R2Entropy_sound : CA5_5_6I1R2Entropy.Encloses (Foundation.finiteEntropy CA5_5_6I1R2Value) := by + exact contains_sound (entropyPair_enclosed CA5_5_6I1R2Value CA5_5_6I1R2Terms CA5_5_6I1R2Terms_sound) (by decide +kernel) +def CA5_5_6I1R2Mass : Ball := ⟨(1281479362575135721916520103391 / 3125000000000000000000000000000), (39 / 25000000000000000000000000000000)⟩ +lemma CA5_5_6I1R2Mass_sound : CA5_5_6I1R2Mass.Encloses (∑ a, CA5_5_6I1R2Value a) := by + exact contains_sound (pairSumBall_sound CA5_5_6I1R2P CA5_5_6I1R2Value CA5_5_6I1R2P_sound) (by decide +kernel) +def CA5_5_6I1R2MassTermLogWitness : LogWitness := ⟨-2, 1281479362575135721916520103391, 781250000000000000000000000000⟩ +def CA5_5_6I1R2MassTermLog : Ball := ⟨(-17828382412244256628210000201737 / 20000000000000000000000000000000), (63527471429 / 100000000000000000000000000000000)⟩ +lemma CA5_5_6I1R2MassTermLog_sound : CA5_5_6I1R2MassTermLog.Encloses (Real.log ((∑ a, CA5_5_6I1R2Value a))) := by + exact checkLog_sound logTwoBall_sound (CA5_5_6I1R2Mass_sound) (w := CA5_5_6I1R2MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA5_5_6I1R2MassTerm : Ball := ⟨(36554726607021648898164340666049 / 100000000000000000000000000000000), (2605092609 / 10000000000000000000000000000000)⟩ +lemma CA5_5_6I1R2MassTerm_sound : CA5_5_6I1R2MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA5_5_6I1R2Value a))) := by + exact contains_sound (entropyTerm_ball (CA5_5_6I1R2Mass_sound) CA5_5_6I1R2MassTermLog_sound) (by decide +kernel) +def CA5_5_6I1R2H : Ball := ⟨(25762007563488974732640666103 / 62500000000000000000000000000), (5937275413 / 10000000000000000000000000000000)⟩ +lemma CA5_5_6I1R2H_sound : CA5_5_6I1R2H.Encloses (homogeneousEntropy CA5_5_6I1R2Value) := by + exact contains_sound (homogeneous_enclosed CA5_5_6I1R2Value CA5_5_6I1R2MassTerm_sound CA5_5_6I1R2Entropy_sound) (by decide +kernel) +def CA5_5_6I1R3Value (a : PairSlot) : ℝ := residualLaw (below (shape 5 5 6)) (fun u => (stageALaw (shape 5 5 6) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 3 a +def CA5_5_6I1R3Raw (a : PairSlot) : Ball := residualBall (below (shape 5 5 6)) A5_5_6Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 3 a +lemma CA5_5_6I1R3Raw_sound (a : PairSlot) : + (CA5_5_6I1R3Raw a).Encloses (CA5_5_6I1R3Value a) := by + exact residualBall_sound_on (below (shape 5 5 6)) A5_5_6Law (fun u => (stageALaw (shape 5 5 6) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A5_5_6Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 5 5 6) (show (shape 5 5 6) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 3 a +def CA5_5_6I1R3Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(271458879193725131923505208621 / 50000000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ ⟨(1415920722504171364818907810507 / 50000000000000000000000000000000), (1034705791 / 100000000000000000000000000000000)⟩ ⟨(-104319352287143818244296975851629 / 20000000000000000000000000000000), (190582413883 / 100000000000000000000000000000000)⟩ ⟨-8, 271458879193725131923505208621, 195312500000000000000000000000⟩, + .log ⟨(3746874575659416762664980149143 / 20000000000000000000000000000000), (27 / 50000000000000000000000000000000)⟩ ⟨(15688259651860853458808066430393 / 50000000000000000000000000000000), (793431561 / 5000000000000000000000000000000)⟩ ⟨(-5233781961162877534054015531269 / 3125000000000000000000000000000), (4235164751 / 5000000000000000000000000000000)⟩ ⟨-3, 3746874575659416762664980149143, 2500000000000000000000000000000⟩, + .log ⟨(1225028089781086675900339639741 / 100000000000000000000000000000000), (1 / 20000000000000000000000000000000)⟩ ⟨(134820662787370913389849792629 / 2500000000000000000000000000000), (415055667 / 20000000000000000000000000000000)⟩ ⟨(-110055160295518982233674994553211 / 25000000000000000000000000000000), (10587911867 / 6250000000000000000000000000000)⟩ ⟨-7, 1225028089781086675900339639741, 781250000000000000000000000000⟩] +lemma CA5_5_6I1R3Certificates_valid : + CA5_5_6I1R3Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA5_5_6I1R3CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 4, 0 => 1 + | 2, 1 => 2 + | 3, 1 => 3 + | 1, 2 => 2 + | 1, 3 => 3 + | 0, 4 => 1 + | _, _ => 0 +def CA5_5_6I1R3P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA5_5_6I1R3Certificates (CA5_5_6I1R3CertificateIndex a)).input +lemma CA5_5_6I1R3P_check : ∀ a : PairSlot, contains (CA5_5_6I1R3Raw a) (CA5_5_6I1R3P a) = true := by + decide +kernel +lemma CA5_5_6I1R3P_sound (a : PairSlot) : + (CA5_5_6I1R3P a).Encloses (CA5_5_6I1R3Value a) := + contains_sound (CA5_5_6I1R3Raw_sound a) (CA5_5_6I1R3P_check a) +def CA5_5_6I1R3Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA5_5_6I1R3Certificates (CA5_5_6I1R3CertificateIndex a)).output +lemma CA5_5_6I1R3Terms_sound (a : PairSlot) : + (CA5_5_6I1R3Terms a).Encloses (Foundation.entropyTerm (CA5_5_6I1R3Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA5_5_6I1R3Certificates_valid + (CA5_5_6I1R3CertificateIndex a) (CA5_5_6I1R3P_sound a) +def CA5_5_6I1R3Entropy : Ball := ⟨(495014840752811077285599252337 / 625000000000000000000000000000), (9489307673 / 25000000000000000000000000000000)⟩ +lemma CA5_5_6I1R3Entropy_sound : CA5_5_6I1R3Entropy.Encloses (Foundation.finiteEntropy CA5_5_6I1R3Value) := by + exact contains_sound (entropyPair_enclosed CA5_5_6I1R3Value CA5_5_6I1R3Terms CA5_5_6I1R3Terms_sound) (by decide +kernel) +def CA5_5_6I1R3Mass : Ball := ⟨(10251159363232810376536125401349 / 25000000000000000000000000000000), (63 / 50000000000000000000000000000000)⟩ +lemma CA5_5_6I1R3Mass_sound : CA5_5_6I1R3Mass.Encloses (∑ a, CA5_5_6I1R3Value a) := by + exact contains_sound (pairSumBall_sound CA5_5_6I1R3P CA5_5_6I1R3Value CA5_5_6I1R3P_sound) (by decide +kernel) +def CA5_5_6I1R3MassTermLogWitness : LogWitness := ⟨-2, 10251159363232810376536125401349, 6250000000000000000000000000000⟩ +def CA5_5_6I1R3MassTermLog : Ball := ⟨(-44574250853600040046678633920341 / 50000000000000000000000000000000), (15881867839 / 25000000000000000000000000000000)⟩ +lemma CA5_5_6I1R3MassTermLog_sound : CA5_5_6I1R3MassTermLog.Encloses (Real.log ((∑ a, CA5_5_6I1R3Value a))) := by + exact checkLog_sound logTwoBall_sound (CA5_5_6I1R3Mass_sound) (w := CA5_5_6I1R3MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA5_5_6I1R3MassTerm : Ball := ⟨(9138754979939402818134539391403 / 25000000000000000000000000000000), (13024604713 / 50000000000000000000000000000000)⟩ +lemma CA5_5_6I1R3MassTerm_sound : CA5_5_6I1R3MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA5_5_6I1R3Value a))) := by + exact contains_sound (entropyTerm_ball (CA5_5_6I1R3Mass_sound) CA5_5_6I1R3MassTermLog_sound) (by decide +kernel) +def CA5_5_6I1R3H : Ball := ⟨(10661838650173040273289430702077 / 25000000000000000000000000000000), (32003220059 / 50000000000000000000000000000000)⟩ +lemma CA5_5_6I1R3H_sound : CA5_5_6I1R3H.Encloses (homogeneousEntropy CA5_5_6I1R3Value) := by + exact contains_sound (homogeneous_enclosed CA5_5_6I1R3Value CA5_5_6I1R3MassTerm_sound CA5_5_6I1R3Entropy_sound) (by decide +kernel) +def CA5_5_6I1R4Value (a : PairSlot) : ℝ := residualLaw (below (shape 5 5 6)) (fun u => (stageALaw (shape 5 5 6) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 4 a +def CA5_5_6I1R4Raw (a : PairSlot) : Ball := residualBall (below (shape 5 5 6)) A5_5_6Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 4 a +lemma CA5_5_6I1R4Raw_sound (a : PairSlot) : + (CA5_5_6I1R4Raw a).Encloses (CA5_5_6I1R4Value a) := by + exact residualBall_sound_on (below (shape 5 5 6)) A5_5_6Law (fun u => (stageALaw (shape 5 5 6) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A5_5_6Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 5 5 6) (show (shape 5 5 6) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 4 a +def CA5_5_6I1R4Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(394592318926025536485814717 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(32714500344003059911566981341 / 100000000000000000000000000000000), (5347729 / 50000000000000000000000000000000)⟩ ⟨(-207267721486844674945926562184131 / 20000000000000000000000000000000), (67762642121 / 20000000000000000000000000000000)⟩ ⟨-15, 394592318926025536485814717, 381469726562500000000000000⟩, + .log ⟨(346222247156512031659066700391 / 50000000000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ ⟨(1721658462280752209912386633821 / 50000000000000000000000000000000), (164959683 / 12500000000000000000000000000000)⟩ ⟨(-497269738273769923200338345290949 / 100000000000000000000000000000000), (190582414013 / 100000000000000000000000000000000)⟩ ⟨-8, 346222247156512031659066700391, 195312500000000000000000000000⟩, + .log ⟨(6647203530643439341023305867833 / 100000000000000000000000000000000), (19 / 50000000000000000000000000000000)⟩ ⟨(18020395555235912452468847350461 / 100000000000000000000000000000000), (7038000639 / 100000000000000000000000000000000)⟩ ⟨(-67774348536803284726700195379887 / 25000000000000000000000000000000), (52939559493 / 50000000000000000000000000000000)⟩ ⟨-4, 6647203530643439341023305867833, 6250000000000000000000000000000⟩, + .log ⟨(326754586305341673734263853161 / 100000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ ⟨(935125239342346232274455191849 / 50000000000000000000000000000000), (172982443 / 25000000000000000000000000000000)⟩ ⟨(-572371607643481832506121049572673 / 100000000000000000000000000000000), (52939559437 / 25000000000000000000000000000000)⟩ ⟨-9, 326754586305341673734263853161, 195312500000000000000000000000⟩, + .log ⟨(8894723011787277341472726829 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(153599771432237162935399418387 / 100000000000000000000000000000000), (26369437 / 50000000000000000000000000000000)⟩ ⟨(-863432010354267982849928330105699 / 100000000000000000000000000000000), (296461537183 / 100000000000000000000000000000000)⟩ ⟨-13, 8894723011787277341472726829, 6103515625000000000000000000⟩] +lemma CA5_5_6I1R4Certificates_valid : + CA5_5_6I1R4Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA5_5_6I1R4CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 0, 5 => 1 + | 1, 4 => 2 + | 2, 2 => 3 + | 2, 3 => 4 + | 3, 2 => 4 + | 3, 3 => 5 + | 4, 1 => 2 + | 5, 0 => 1 + | _, _ => 0 +def CA5_5_6I1R4P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA5_5_6I1R4Certificates (CA5_5_6I1R4CertificateIndex a)).input +lemma CA5_5_6I1R4P_check : ∀ a : PairSlot, contains (CA5_5_6I1R4Raw a) (CA5_5_6I1R4P a) = true := by + decide +kernel +lemma CA5_5_6I1R4P_sound (a : PairSlot) : + (CA5_5_6I1R4P a).Encloses (CA5_5_6I1R4Value a) := + contains_sound (CA5_5_6I1R4Raw_sound a) (CA5_5_6I1R4P_check a) +def CA5_5_6I1R4Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA5_5_6I1R4Certificates (CA5_5_6I1R4CertificateIndex a)).output +lemma CA5_5_6I1R4Terms_sound (a : PairSlot) : + (CA5_5_6I1R4Terms a).Encloses (Foundation.entropyTerm (CA5_5_6I1R4Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA5_5_6I1R4Certificates_valid + (CA5_5_6I1R4CertificateIndex a) (CA5_5_6I1R4P_sound a) +def CA5_5_6I1R4Entropy : Ball := ⟨(2886655913384854950397474803421 / 10000000000000000000000000000000), (11135344901 / 100000000000000000000000000000000)⟩ +lemma CA5_5_6I1R4Entropy_sound : CA5_5_6I1R4Entropy.Encloses (Foundation.finiteEntropy CA5_5_6I1R4Value) := by + exact contains_sound (entropyPair_enclosed CA5_5_6I1R4Value CA5_5_6I1R4Terms CA5_5_6I1R4Terms_sound) (by decide +kernel) +def CA5_5_6I1R4Mass : Ball := ⟨(8709704615006561778394818864849 / 100000000000000000000000000000000), (59 / 100000000000000000000000000000000)⟩ +lemma CA5_5_6I1R4Mass_sound : CA5_5_6I1R4Mass.Encloses (∑ a, CA5_5_6I1R4Value a) := by + exact contains_sound (pairSumBall_sound CA5_5_6I1R4P CA5_5_6I1R4Value CA5_5_6I1R4P_sound) (by decide +kernel) +def CA5_5_6I1R4MassTermLogWitness : LogWitness := ⟨-4, 8709704615006561778394818864849, 6250000000000000000000000000000⟩ +def CA5_5_6I1R4MassTermLog : Ball := ⟨(-244073230901602138310941379700737 / 100000000000000000000000000000000), (26469779773 / 25000000000000000000000000000000)⟩ +lemma CA5_5_6I1R4MassTermLog_sound : CA5_5_6I1R4MassTermLog.Encloses (Real.log ((∑ a, CA5_5_6I1R4Value a))) := by + exact checkLog_sound logTwoBall_sound (CA5_5_6I1R4Mass_sound) (w := CA5_5_6I1R4MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA5_5_6I1R4MassTerm : Ball := ⟨(4251611491166492618787916417629 / 20000000000000000000000000000000), (4610879333 / 50000000000000000000000000000000)⟩ +lemma CA5_5_6I1R4MassTerm_sound : CA5_5_6I1R4MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA5_5_6I1R4Value a))) := by + exact contains_sound (entropyTerm_ball (CA5_5_6I1R4Mass_sound) CA5_5_6I1R4MassTermLog_sound) (by decide +kernel) +def CA5_5_6I1R4H : Ball := ⟨(1521700335603217282007033189213 / 20000000000000000000000000000000), (20357103567 / 100000000000000000000000000000000)⟩ +lemma CA5_5_6I1R4H_sound : CA5_5_6I1R4H.Encloses (homogeneousEntropy CA5_5_6I1R4Value) := by + exact contains_sound (homogeneous_enclosed CA5_5_6I1R4Value CA5_5_6I1R4MassTerm_sound CA5_5_6I1R4Entropy_sound) (by decide +kernel) +def CA5_5_6I1R5Value (a : PairSlot) : ℝ := residualLaw (below (shape 5 5 6)) (fun u => (stageALaw (shape 5 5 6) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 5 a +def CA5_5_6I1R5Raw (a : PairSlot) : Ball := residualBall (below (shape 5 5 6)) A5_5_6Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 5 a +lemma CA5_5_6I1R5Raw_sound (a : PairSlot) : + (CA5_5_6I1R5Raw a).Encloses (CA5_5_6I1R5Value a) := by + exact residualBall_sound_on (below (shape 5 5 6)) A5_5_6Law (fun u => (stageALaw (shape 5 5 6) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A5_5_6Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 5 5 6) (show (shape 5 5 6) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 5 a +def CA5_5_6I1R5Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(1182429246892354719670022127 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(6297740714917424058006949267 / 25000000000000000000000000000000), (8513243 / 100000000000000000000000000000000)⟩ ⟨(-213044145566225290681104832862459 / 20000000000000000000000000000000), (359989044897 / 100000000000000000000000000000000)⟩ ⟨-16, 1182429246892354719670022127, 762939453125000000000000000⟩, + .log ⟨(3162039426222401142649858937 / 2500000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ ⟨(168797982085904458943340093419 / 20000000000000000000000000000000), (294618697 / 100000000000000000000000000000000)⟩ ⟨(-333641440169285425875927063846407 / 50000000000000000000000000000000), (58233515721 / 25000000000000000000000000000000)⟩ ⟨-10, 3162039426222401142649858937, 2441406250000000000000000000⟩, + .log ⟨(6194842723022241767055626031 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(60023121764133098394063297447 / 100000000000000000000000000000000), (9838573 / 50000000000000000000000000000000)⟩ ⟨(-968920833793984817510231564930619 / 100000000000000000000000000000000), (317637371387 / 100000000000000000000000000000000)⟩ ⟨-14, 6194842723022241767055626031, 6103515625000000000000000000⟩] +lemma CA5_5_6I1R5Certificates_valid : + CA5_5_6I1R5Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA5_5_6I1R5CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 1, 5 => 1 + | 2, 4 => 2 + | 3, 4 => 3 + | 4, 2 => 2 + | 4, 3 => 3 + | 5, 1 => 1 + | _, _ => 0 +def CA5_5_6I1R5P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA5_5_6I1R5Certificates (CA5_5_6I1R5CertificateIndex a)).input +lemma CA5_5_6I1R5P_check : ∀ a : PairSlot, contains (CA5_5_6I1R5Raw a) (CA5_5_6I1R5P a) = true := by + decide +kernel +lemma CA5_5_6I1R5P_sound (a : PairSlot) : + (CA5_5_6I1R5P a).Encloses (CA5_5_6I1R5Value a) := + contains_sound (CA5_5_6I1R5Raw_sound a) (CA5_5_6I1R5P_check a) +def CA5_5_6I1R5Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA5_5_6I1R5Certificates (CA5_5_6I1R5CertificateIndex a)).output +lemma CA5_5_6I1R5Terms_sound (a : PairSlot) : + (CA5_5_6I1R5Terms a).Encloses (Foundation.entropyTerm (CA5_5_6I1R5Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA5_5_6I1R5Certificates_valid + (CA5_5_6I1R5CertificateIndex a) (CA5_5_6I1R5P_sound a) +def CA5_5_6I1R5Entropy : Ball := ⟨(92920399505332508934279156161 / 5000000000000000000000000000000), (161404543 / 25000000000000000000000000000000)⟩ +lemma CA5_5_6I1R5Entropy_sound : CA5_5_6I1R5Entropy.Encloses (Foundation.finiteEntropy CA5_5_6I1R5Value) := by + exact contains_sound (entropyPair_enclosed CA5_5_6I1R5Value CA5_5_6I1R5Terms CA5_5_6I1R5Terms_sound) (by decide +kernel) +def CA5_5_6I1R5Mass : Ball := ⟨(27008255653140599382478005553 / 10000000000000000000000000000000), (1 / 10000000000000000000000000000000)⟩ +lemma CA5_5_6I1R5Mass_sound : CA5_5_6I1R5Mass.Encloses (∑ a, CA5_5_6I1R5Value a) := by + exact contains_sound (pairSumBall_sound CA5_5_6I1R5P CA5_5_6I1R5Value CA5_5_6I1R5P_sound) (by decide +kernel) +def CA5_5_6I1R5MassTermLogWitness : LogWitness := ⟨-9, 27008255653140599382478005553, 19531250000000000000000000000⟩ +def CA5_5_6I1R5MassTermLog : Ball := ⟨(-591419778777729021357025396717877 / 100000000000000000000000000000000), (52939560133 / 25000000000000000000000000000000)⟩ +lemma CA5_5_6I1R5MassTermLog_sound : CA5_5_6I1R5MassTermLog.Encloses (Real.log ((∑ a, CA5_5_6I1R5Value a))) := by + exact checkLog_sound logTwoBall_sound (CA5_5_6I1R5Mass_sound) (w := CA5_5_6I1R5MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA5_5_6I1R5MassTerm : Ball := ⟨(319464331671055250544989325127 / 20000000000000000000000000000000), (57192213 / 10000000000000000000000000000000)⟩ +lemma CA5_5_6I1R5MassTerm_sound : CA5_5_6I1R5MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA5_5_6I1R5Value a))) := by + exact contains_sound (entropyTerm_ball (CA5_5_6I1R5Mass_sound) CA5_5_6I1R5MassTermLog_sound) (by decide +kernel) +def CA5_5_6I1R5H : Ball := ⟨(52217266350274785192127299517 / 20000000000000000000000000000000), (608770151 / 50000000000000000000000000000000)⟩ +lemma CA5_5_6I1R5H_sound : CA5_5_6I1R5H.Encloses (homogeneousEntropy CA5_5_6I1R5Value) := by + exact contains_sound (homogeneous_enclosed CA5_5_6I1R5Value CA5_5_6I1R5MassTerm_sound CA5_5_6I1R5Entropy_sound) (by decide +kernel) +def CA5_5_6I1R6Value (a : PairSlot) : ℝ := residualLaw (below (shape 5 5 6)) (fun u => (stageALaw (shape 5 5 6) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 6 a +def CA5_5_6I1R6Raw (a : PairSlot) : Ball := residualBall (below (shape 5 5 6)) A5_5_6Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 6 a +lemma CA5_5_6I1R6Raw_sound (a : PairSlot) : + (CA5_5_6I1R6Raw a).Encloses (CA5_5_6I1R6Value a) := by + exact residualBall_sound_on (below (shape 5 5 6)) A5_5_6Law (fun u => (stageALaw (shape 5 5 6) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A5_5_6Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 5 5 6) (show (shape 5 5 6) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 6 a +def CA5_5_6I1R6Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA5_5_6I1R6Certificates_valid : + CA5_5_6I1R6Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA5_5_6I1R6CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA5_5_6I1R6P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA5_5_6I1R6Certificates (CA5_5_6I1R6CertificateIndex a)).input +lemma CA5_5_6I1R6P_check : ∀ a : PairSlot, contains (CA5_5_6I1R6Raw a) (CA5_5_6I1R6P a) = true := by + decide +kernel +lemma CA5_5_6I1R6P_sound (a : PairSlot) : + (CA5_5_6I1R6P a).Encloses (CA5_5_6I1R6Value a) := + contains_sound (CA5_5_6I1R6Raw_sound a) (CA5_5_6I1R6P_check a) +def CA5_5_6I1R6Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA5_5_6I1R6Certificates (CA5_5_6I1R6CertificateIndex a)).output +lemma CA5_5_6I1R6Terms_sound (a : PairSlot) : + (CA5_5_6I1R6Terms a).Encloses (Foundation.entropyTerm (CA5_5_6I1R6Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA5_5_6I1R6Certificates_valid + (CA5_5_6I1R6CertificateIndex a) (CA5_5_6I1R6P_sound a) +def CA5_5_6I1R6Entropy : Ball := ⟨0, 0⟩ +lemma CA5_5_6I1R6Entropy_sound : CA5_5_6I1R6Entropy.Encloses (Foundation.finiteEntropy CA5_5_6I1R6Value) := by + exact contains_sound (entropyPair_enclosed CA5_5_6I1R6Value CA5_5_6I1R6Terms CA5_5_6I1R6Terms_sound) (by decide +kernel) +def CA5_5_6I1R6Mass : Ball := ⟨0, 0⟩ +lemma CA5_5_6I1R6Mass_sound : CA5_5_6I1R6Mass.Encloses (∑ a, CA5_5_6I1R6Value a) := by + exact contains_sound (pairSumBall_sound CA5_5_6I1R6P CA5_5_6I1R6Value CA5_5_6I1R6P_sound) (by decide +kernel) +def CA5_5_6I1R6MassTerm : Ball := .exact 0 +lemma CA5_5_6I1R6MassTerm_sound : CA5_5_6I1R6MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA5_5_6I1R6Value a))) := + entropyTerm_zero_ball (CA5_5_6I1R6Mass_sound) +def CA5_5_6I1R6H : Ball := ⟨0, 0⟩ +lemma CA5_5_6I1R6H_sound : CA5_5_6I1R6H.Encloses (homogeneousEntropy CA5_5_6I1R6Value) := by + exact contains_sound (homogeneous_enclosed CA5_5_6I1R6Value CA5_5_6I1R6MassTerm_sound CA5_5_6I1R6Entropy_sound) (by decide +kernel) +def CA5_5_6I1R7Value (a : PairSlot) : ℝ := residualLaw (below (shape 5 5 6)) (fun u => (stageALaw (shape 5 5 6) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 7 a +def CA5_5_6I1R7Raw (a : PairSlot) : Ball := residualBall (below (shape 5 5 6)) A5_5_6Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 7 a +lemma CA5_5_6I1R7Raw_sound (a : PairSlot) : + (CA5_5_6I1R7Raw a).Encloses (CA5_5_6I1R7Value a) := by + exact residualBall_sound_on (below (shape 5 5 6)) A5_5_6Law (fun u => (stageALaw (shape 5 5 6) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A5_5_6Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 5 5 6) (show (shape 5 5 6) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 7 a +def CA5_5_6I1R7Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA5_5_6I1R7Certificates_valid : + CA5_5_6I1R7Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA5_5_6I1R7CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA5_5_6I1R7P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA5_5_6I1R7Certificates (CA5_5_6I1R7CertificateIndex a)).input +lemma CA5_5_6I1R7P_check : ∀ a : PairSlot, contains (CA5_5_6I1R7Raw a) (CA5_5_6I1R7P a) = true := by + decide +kernel +lemma CA5_5_6I1R7P_sound (a : PairSlot) : + (CA5_5_6I1R7P a).Encloses (CA5_5_6I1R7Value a) := + contains_sound (CA5_5_6I1R7Raw_sound a) (CA5_5_6I1R7P_check a) +def CA5_5_6I1R7Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA5_5_6I1R7Certificates (CA5_5_6I1R7CertificateIndex a)).output +lemma CA5_5_6I1R7Terms_sound (a : PairSlot) : + (CA5_5_6I1R7Terms a).Encloses (Foundation.entropyTerm (CA5_5_6I1R7Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA5_5_6I1R7Certificates_valid + (CA5_5_6I1R7CertificateIndex a) (CA5_5_6I1R7P_sound a) +def CA5_5_6I1R7Entropy : Ball := ⟨0, 0⟩ +lemma CA5_5_6I1R7Entropy_sound : CA5_5_6I1R7Entropy.Encloses (Foundation.finiteEntropy CA5_5_6I1R7Value) := by + exact contains_sound (entropyPair_enclosed CA5_5_6I1R7Value CA5_5_6I1R7Terms CA5_5_6I1R7Terms_sound) (by decide +kernel) +def CA5_5_6I1R7Mass : Ball := ⟨0, 0⟩ +lemma CA5_5_6I1R7Mass_sound : CA5_5_6I1R7Mass.Encloses (∑ a, CA5_5_6I1R7Value a) := by + exact contains_sound (pairSumBall_sound CA5_5_6I1R7P CA5_5_6I1R7Value CA5_5_6I1R7P_sound) (by decide +kernel) +def CA5_5_6I1R7MassTerm : Ball := .exact 0 +lemma CA5_5_6I1R7MassTerm_sound : CA5_5_6I1R7MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA5_5_6I1R7Value a))) := + entropyTerm_zero_ball (CA5_5_6I1R7Mass_sound) +def CA5_5_6I1R7H : Ball := ⟨0, 0⟩ +lemma CA5_5_6I1R7H_sound : CA5_5_6I1R7H.Encloses (homogeneousEntropy CA5_5_6I1R7Value) := by + exact contains_sound (homogeneous_enclosed CA5_5_6I1R7Value CA5_5_6I1R7MassTerm_sound CA5_5_6I1R7Entropy_sound) (by decide +kernel) +def CA5_5_6I1R8Value (a : PairSlot) : ℝ := residualLaw (below (shape 5 5 6)) (fun u => (stageALaw (shape 5 5 6) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 8 a +def CA5_5_6I1R8Raw (a : PairSlot) : Ball := residualBall (below (shape 5 5 6)) A5_5_6Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 8 a +lemma CA5_5_6I1R8Raw_sound (a : PairSlot) : + (CA5_5_6I1R8Raw a).Encloses (CA5_5_6I1R8Value a) := by + exact residualBall_sound_on (below (shape 5 5 6)) A5_5_6Law (fun u => (stageALaw (shape 5 5 6) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A5_5_6Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 5 5 6) (show (shape 5 5 6) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 8 a +def CA5_5_6I1R8Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA5_5_6I1R8Certificates_valid : + CA5_5_6I1R8Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA5_5_6I1R8CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA5_5_6I1R8P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA5_5_6I1R8Certificates (CA5_5_6I1R8CertificateIndex a)).input +lemma CA5_5_6I1R8P_check : ∀ a : PairSlot, contains (CA5_5_6I1R8Raw a) (CA5_5_6I1R8P a) = true := by + decide +kernel +lemma CA5_5_6I1R8P_sound (a : PairSlot) : + (CA5_5_6I1R8P a).Encloses (CA5_5_6I1R8Value a) := + contains_sound (CA5_5_6I1R8Raw_sound a) (CA5_5_6I1R8P_check a) +def CA5_5_6I1R8Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA5_5_6I1R8Certificates (CA5_5_6I1R8CertificateIndex a)).output +lemma CA5_5_6I1R8Terms_sound (a : PairSlot) : + (CA5_5_6I1R8Terms a).Encloses (Foundation.entropyTerm (CA5_5_6I1R8Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA5_5_6I1R8Certificates_valid + (CA5_5_6I1R8CertificateIndex a) (CA5_5_6I1R8P_sound a) +def CA5_5_6I1R8Entropy : Ball := ⟨0, 0⟩ +lemma CA5_5_6I1R8Entropy_sound : CA5_5_6I1R8Entropy.Encloses (Foundation.finiteEntropy CA5_5_6I1R8Value) := by + exact contains_sound (entropyPair_enclosed CA5_5_6I1R8Value CA5_5_6I1R8Terms CA5_5_6I1R8Terms_sound) (by decide +kernel) +def CA5_5_6I1R8Mass : Ball := ⟨0, 0⟩ +lemma CA5_5_6I1R8Mass_sound : CA5_5_6I1R8Mass.Encloses (∑ a, CA5_5_6I1R8Value a) := by + exact contains_sound (pairSumBall_sound CA5_5_6I1R8P CA5_5_6I1R8Value CA5_5_6I1R8P_sound) (by decide +kernel) +def CA5_5_6I1R8MassTerm : Ball := .exact 0 +lemma CA5_5_6I1R8MassTerm_sound : CA5_5_6I1R8MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA5_5_6I1R8Value a))) := + entropyTerm_zero_ball (CA5_5_6I1R8Mass_sound) +def CA5_5_6I1R8H : Ball := ⟨0, 0⟩ +lemma CA5_5_6I1R8H_sound : CA5_5_6I1R8H.Encloses (homogeneousEntropy CA5_5_6I1R8Value) := by + exact contains_sound (homogeneous_enclosed CA5_5_6I1R8Value CA5_5_6I1R8MassTerm_sound CA5_5_6I1R8Entropy_sound) (by decide +kernel) +def CA5_5_6I1R9Value (a : PairSlot) : ℝ := residualLaw (below (shape 5 5 6)) (fun u => (stageALaw (shape 5 5 6) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 9 a +def CA5_5_6I1R9Raw (a : PairSlot) : Ball := residualBall (below (shape 5 5 6)) A5_5_6Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 9 a +lemma CA5_5_6I1R9Raw_sound (a : PairSlot) : + (CA5_5_6I1R9Raw a).Encloses (CA5_5_6I1R9Value a) := by + exact residualBall_sound_on (below (shape 5 5 6)) A5_5_6Law (fun u => (stageALaw (shape 5 5 6) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A5_5_6Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 5 5 6) (show (shape 5 5 6) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 9 a +def CA5_5_6I1R9Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA5_5_6I1R9Certificates_valid : + CA5_5_6I1R9Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA5_5_6I1R9CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA5_5_6I1R9P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA5_5_6I1R9Certificates (CA5_5_6I1R9CertificateIndex a)).input +lemma CA5_5_6I1R9P_check : ∀ a : PairSlot, contains (CA5_5_6I1R9Raw a) (CA5_5_6I1R9P a) = true := by + decide +kernel +lemma CA5_5_6I1R9P_sound (a : PairSlot) : + (CA5_5_6I1R9P a).Encloses (CA5_5_6I1R9Value a) := + contains_sound (CA5_5_6I1R9Raw_sound a) (CA5_5_6I1R9P_check a) +def CA5_5_6I1R9Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA5_5_6I1R9Certificates (CA5_5_6I1R9CertificateIndex a)).output +lemma CA5_5_6I1R9Terms_sound (a : PairSlot) : + (CA5_5_6I1R9Terms a).Encloses (Foundation.entropyTerm (CA5_5_6I1R9Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA5_5_6I1R9Certificates_valid + (CA5_5_6I1R9CertificateIndex a) (CA5_5_6I1R9P_sound a) +def CA5_5_6I1R9Entropy : Ball := ⟨0, 0⟩ +lemma CA5_5_6I1R9Entropy_sound : CA5_5_6I1R9Entropy.Encloses (Foundation.finiteEntropy CA5_5_6I1R9Value) := by + exact contains_sound (entropyPair_enclosed CA5_5_6I1R9Value CA5_5_6I1R9Terms CA5_5_6I1R9Terms_sound) (by decide +kernel) +def CA5_5_6I1R9Mass : Ball := ⟨0, 0⟩ +lemma CA5_5_6I1R9Mass_sound : CA5_5_6I1R9Mass.Encloses (∑ a, CA5_5_6I1R9Value a) := by + exact contains_sound (pairSumBall_sound CA5_5_6I1R9P CA5_5_6I1R9Value CA5_5_6I1R9P_sound) (by decide +kernel) +def CA5_5_6I1R9MassTerm : Ball := .exact 0 +lemma CA5_5_6I1R9MassTerm_sound : CA5_5_6I1R9MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA5_5_6I1R9Value a))) := + entropyTerm_zero_ball (CA5_5_6I1R9Mass_sound) +def CA5_5_6I1R9H : Ball := ⟨0, 0⟩ +lemma CA5_5_6I1R9H_sound : CA5_5_6I1R9H.Encloses (homogeneousEntropy CA5_5_6I1R9Value) := by + exact contains_sound (homogeneous_enclosed CA5_5_6I1R9Value CA5_5_6I1R9MassTerm_sound CA5_5_6I1R9Entropy_sound) (by decide +kernel) +def CA5_5_6I1R10Value (a : PairSlot) : ℝ := residualLaw (below (shape 5 5 6)) (fun u => (stageALaw (shape 5 5 6) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 10 a +def CA5_5_6I1R10Raw (a : PairSlot) : Ball := residualBall (below (shape 5 5 6)) A5_5_6Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 10 a +lemma CA5_5_6I1R10Raw_sound (a : PairSlot) : + (CA5_5_6I1R10Raw a).Encloses (CA5_5_6I1R10Value a) := by + exact residualBall_sound_on (below (shape 5 5 6)) A5_5_6Law (fun u => (stageALaw (shape 5 5 6) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A5_5_6Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 5 5 6) (show (shape 5 5 6) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 10 a +def CA5_5_6I1R10Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA5_5_6I1R10Certificates_valid : + CA5_5_6I1R10Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA5_5_6I1R10CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA5_5_6I1R10P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA5_5_6I1R10Certificates (CA5_5_6I1R10CertificateIndex a)).input +lemma CA5_5_6I1R10P_check : ∀ a : PairSlot, contains (CA5_5_6I1R10Raw a) (CA5_5_6I1R10P a) = true := by + decide +kernel +lemma CA5_5_6I1R10P_sound (a : PairSlot) : + (CA5_5_6I1R10P a).Encloses (CA5_5_6I1R10Value a) := + contains_sound (CA5_5_6I1R10Raw_sound a) (CA5_5_6I1R10P_check a) +def CA5_5_6I1R10Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA5_5_6I1R10Certificates (CA5_5_6I1R10CertificateIndex a)).output +lemma CA5_5_6I1R10Terms_sound (a : PairSlot) : + (CA5_5_6I1R10Terms a).Encloses (Foundation.entropyTerm (CA5_5_6I1R10Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA5_5_6I1R10Certificates_valid + (CA5_5_6I1R10CertificateIndex a) (CA5_5_6I1R10P_sound a) +def CA5_5_6I1R10Entropy : Ball := ⟨0, 0⟩ +lemma CA5_5_6I1R10Entropy_sound : CA5_5_6I1R10Entropy.Encloses (Foundation.finiteEntropy CA5_5_6I1R10Value) := by + exact contains_sound (entropyPair_enclosed CA5_5_6I1R10Value CA5_5_6I1R10Terms CA5_5_6I1R10Terms_sound) (by decide +kernel) +def CA5_5_6I1R10Mass : Ball := ⟨0, 0⟩ +lemma CA5_5_6I1R10Mass_sound : CA5_5_6I1R10Mass.Encloses (∑ a, CA5_5_6I1R10Value a) := by + exact contains_sound (pairSumBall_sound CA5_5_6I1R10P CA5_5_6I1R10Value CA5_5_6I1R10P_sound) (by decide +kernel) +def CA5_5_6I1R10MassTerm : Ball := .exact 0 +lemma CA5_5_6I1R10MassTerm_sound : CA5_5_6I1R10MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA5_5_6I1R10Value a))) := + entropyTerm_zero_ball (CA5_5_6I1R10Mass_sound) +def CA5_5_6I1R10H : Ball := ⟨0, 0⟩ +lemma CA5_5_6I1R10H_sound : CA5_5_6I1R10H.Encloses (homogeneousEntropy CA5_5_6I1R10Value) := by + exact contains_sound (homogeneous_enclosed CA5_5_6I1R10Value CA5_5_6I1R10MassTerm_sound CA5_5_6I1R10Entropy_sound) (by decide +kernel) +def CA5_5_6I1R11Value (a : PairSlot) : ℝ := residualLaw (below (shape 5 5 6)) (fun u => (stageALaw (shape 5 5 6) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 11 a +def CA5_5_6I1R11Raw (a : PairSlot) : Ball := residualBall (below (shape 5 5 6)) A5_5_6Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 11 a +lemma CA5_5_6I1R11Raw_sound (a : PairSlot) : + (CA5_5_6I1R11Raw a).Encloses (CA5_5_6I1R11Value a) := by + exact residualBall_sound_on (below (shape 5 5 6)) A5_5_6Law (fun u => (stageALaw (shape 5 5 6) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A5_5_6Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 5 5 6) (show (shape 5 5 6) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 11 a +def CA5_5_6I1R11Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA5_5_6I1R11Certificates_valid : + CA5_5_6I1R11Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA5_5_6I1R11CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA5_5_6I1R11P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA5_5_6I1R11Certificates (CA5_5_6I1R11CertificateIndex a)).input +lemma CA5_5_6I1R11P_check : ∀ a : PairSlot, contains (CA5_5_6I1R11Raw a) (CA5_5_6I1R11P a) = true := by + decide +kernel +lemma CA5_5_6I1R11P_sound (a : PairSlot) : + (CA5_5_6I1R11P a).Encloses (CA5_5_6I1R11Value a) := + contains_sound (CA5_5_6I1R11Raw_sound a) (CA5_5_6I1R11P_check a) +def CA5_5_6I1R11Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA5_5_6I1R11Certificates (CA5_5_6I1R11CertificateIndex a)).output +lemma CA5_5_6I1R11Terms_sound (a : PairSlot) : + (CA5_5_6I1R11Terms a).Encloses (Foundation.entropyTerm (CA5_5_6I1R11Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA5_5_6I1R11Certificates_valid + (CA5_5_6I1R11CertificateIndex a) (CA5_5_6I1R11P_sound a) +def CA5_5_6I1R11Entropy : Ball := ⟨0, 0⟩ +lemma CA5_5_6I1R11Entropy_sound : CA5_5_6I1R11Entropy.Encloses (Foundation.finiteEntropy CA5_5_6I1R11Value) := by + exact contains_sound (entropyPair_enclosed CA5_5_6I1R11Value CA5_5_6I1R11Terms CA5_5_6I1R11Terms_sound) (by decide +kernel) +def CA5_5_6I1R11Mass : Ball := ⟨0, 0⟩ +lemma CA5_5_6I1R11Mass_sound : CA5_5_6I1R11Mass.Encloses (∑ a, CA5_5_6I1R11Value a) := by + exact contains_sound (pairSumBall_sound CA5_5_6I1R11P CA5_5_6I1R11Value CA5_5_6I1R11P_sound) (by decide +kernel) +def CA5_5_6I1R11MassTerm : Ball := .exact 0 +lemma CA5_5_6I1R11MassTerm_sound : CA5_5_6I1R11MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA5_5_6I1R11Value a))) := + entropyTerm_zero_ball (CA5_5_6I1R11Mass_sound) +def CA5_5_6I1R11H : Ball := ⟨0, 0⟩ +lemma CA5_5_6I1R11H_sound : CA5_5_6I1R11H.Encloses (homogeneousEntropy CA5_5_6I1R11Value) := by + exact contains_sound (homogeneous_enclosed CA5_5_6I1R11Value CA5_5_6I1R11MassTerm_sound CA5_5_6I1R11Entropy_sound) (by decide +kernel) +def CA5_5_6I1R12Value (a : PairSlot) : ℝ := residualLaw (below (shape 5 5 6)) (fun u => (stageALaw (shape 5 5 6) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 12 a +def CA5_5_6I1R12Raw (a : PairSlot) : Ball := residualBall (below (shape 5 5 6)) A5_5_6Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 12 a +lemma CA5_5_6I1R12Raw_sound (a : PairSlot) : + (CA5_5_6I1R12Raw a).Encloses (CA5_5_6I1R12Value a) := by + exact residualBall_sound_on (below (shape 5 5 6)) A5_5_6Law (fun u => (stageALaw (shape 5 5 6) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A5_5_6Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 5 5 6) (show (shape 5 5 6) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 12 a +def CA5_5_6I1R12Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA5_5_6I1R12Certificates_valid : + CA5_5_6I1R12Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA5_5_6I1R12CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA5_5_6I1R12P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA5_5_6I1R12Certificates (CA5_5_6I1R12CertificateIndex a)).input +lemma CA5_5_6I1R12P_check : ∀ a : PairSlot, contains (CA5_5_6I1R12Raw a) (CA5_5_6I1R12P a) = true := by + decide +kernel +lemma CA5_5_6I1R12P_sound (a : PairSlot) : + (CA5_5_6I1R12P a).Encloses (CA5_5_6I1R12Value a) := + contains_sound (CA5_5_6I1R12Raw_sound a) (CA5_5_6I1R12P_check a) +def CA5_5_6I1R12Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA5_5_6I1R12Certificates (CA5_5_6I1R12CertificateIndex a)).output +lemma CA5_5_6I1R12Terms_sound (a : PairSlot) : + (CA5_5_6I1R12Terms a).Encloses (Foundation.entropyTerm (CA5_5_6I1R12Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA5_5_6I1R12Certificates_valid + (CA5_5_6I1R12CertificateIndex a) (CA5_5_6I1R12P_sound a) +def CA5_5_6I1R12Entropy : Ball := ⟨0, 0⟩ +lemma CA5_5_6I1R12Entropy_sound : CA5_5_6I1R12Entropy.Encloses (Foundation.finiteEntropy CA5_5_6I1R12Value) := by + exact contains_sound (entropyPair_enclosed CA5_5_6I1R12Value CA5_5_6I1R12Terms CA5_5_6I1R12Terms_sound) (by decide +kernel) +def CA5_5_6I1R12Mass : Ball := ⟨0, 0⟩ +lemma CA5_5_6I1R12Mass_sound : CA5_5_6I1R12Mass.Encloses (∑ a, CA5_5_6I1R12Value a) := by + exact contains_sound (pairSumBall_sound CA5_5_6I1R12P CA5_5_6I1R12Value CA5_5_6I1R12P_sound) (by decide +kernel) +def CA5_5_6I1R12MassTerm : Ball := .exact 0 +lemma CA5_5_6I1R12MassTerm_sound : CA5_5_6I1R12MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA5_5_6I1R12Value a))) := + entropyTerm_zero_ball (CA5_5_6I1R12Mass_sound) +def CA5_5_6I1R12H : Ball := ⟨0, 0⟩ +lemma CA5_5_6I1R12H_sound : CA5_5_6I1R12H.Encloses (homogeneousEntropy CA5_5_6I1R12Value) := by + exact contains_sound (homogeneous_enclosed CA5_5_6I1R12Value CA5_5_6I1R12MassTerm_sound CA5_5_6I1R12Entropy_sound) (by decide +kernel) +def CA5_5_6I1R13Value (a : PairSlot) : ℝ := residualLaw (below (shape 5 5 6)) (fun u => (stageALaw (shape 5 5 6) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 13 a +def CA5_5_6I1R13Raw (a : PairSlot) : Ball := residualBall (below (shape 5 5 6)) A5_5_6Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 13 a +lemma CA5_5_6I1R13Raw_sound (a : PairSlot) : + (CA5_5_6I1R13Raw a).Encloses (CA5_5_6I1R13Value a) := by + exact residualBall_sound_on (below (shape 5 5 6)) A5_5_6Law (fun u => (stageALaw (shape 5 5 6) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A5_5_6Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 5 5 6) (show (shape 5 5 6) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 13 a +def CA5_5_6I1R13Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA5_5_6I1R13Certificates_valid : + CA5_5_6I1R13Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA5_5_6I1R13CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA5_5_6I1R13P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA5_5_6I1R13Certificates (CA5_5_6I1R13CertificateIndex a)).input +lemma CA5_5_6I1R13P_check : ∀ a : PairSlot, contains (CA5_5_6I1R13Raw a) (CA5_5_6I1R13P a) = true := by + decide +kernel +lemma CA5_5_6I1R13P_sound (a : PairSlot) : + (CA5_5_6I1R13P a).Encloses (CA5_5_6I1R13Value a) := + contains_sound (CA5_5_6I1R13Raw_sound a) (CA5_5_6I1R13P_check a) +def CA5_5_6I1R13Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA5_5_6I1R13Certificates (CA5_5_6I1R13CertificateIndex a)).output +lemma CA5_5_6I1R13Terms_sound (a : PairSlot) : + (CA5_5_6I1R13Terms a).Encloses (Foundation.entropyTerm (CA5_5_6I1R13Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA5_5_6I1R13Certificates_valid + (CA5_5_6I1R13CertificateIndex a) (CA5_5_6I1R13P_sound a) +def CA5_5_6I1R13Entropy : Ball := ⟨0, 0⟩ +lemma CA5_5_6I1R13Entropy_sound : CA5_5_6I1R13Entropy.Encloses (Foundation.finiteEntropy CA5_5_6I1R13Value) := by + exact contains_sound (entropyPair_enclosed CA5_5_6I1R13Value CA5_5_6I1R13Terms CA5_5_6I1R13Terms_sound) (by decide +kernel) +def CA5_5_6I1R13Mass : Ball := ⟨0, 0⟩ +lemma CA5_5_6I1R13Mass_sound : CA5_5_6I1R13Mass.Encloses (∑ a, CA5_5_6I1R13Value a) := by + exact contains_sound (pairSumBall_sound CA5_5_6I1R13P CA5_5_6I1R13Value CA5_5_6I1R13P_sound) (by decide +kernel) +def CA5_5_6I1R13MassTerm : Ball := .exact 0 +lemma CA5_5_6I1R13MassTerm_sound : CA5_5_6I1R13MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA5_5_6I1R13Value a))) := + entropyTerm_zero_ball (CA5_5_6I1R13Mass_sound) +def CA5_5_6I1R13H : Ball := ⟨0, 0⟩ +lemma CA5_5_6I1R13H_sound : CA5_5_6I1R13H.Encloses (homogeneousEntropy CA5_5_6I1R13Value) := by + exact contains_sound (homogeneous_enclosed CA5_5_6I1R13Value CA5_5_6I1R13MassTerm_sound CA5_5_6I1R13Entropy_sound) (by decide +kernel) +def CA5_5_6I1R14Value (a : PairSlot) : ℝ := residualLaw (below (shape 5 5 6)) (fun u => (stageALaw (shape 5 5 6) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 14 a +def CA5_5_6I1R14Raw (a : PairSlot) : Ball := residualBall (below (shape 5 5 6)) A5_5_6Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 14 a +lemma CA5_5_6I1R14Raw_sound (a : PairSlot) : + (CA5_5_6I1R14Raw a).Encloses (CA5_5_6I1R14Value a) := by + exact residualBall_sound_on (below (shape 5 5 6)) A5_5_6Law (fun u => (stageALaw (shape 5 5 6) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A5_5_6Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 5 5 6) (show (shape 5 5 6) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 14 a +def CA5_5_6I1R14Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA5_5_6I1R14Certificates_valid : + CA5_5_6I1R14Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA5_5_6I1R14CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA5_5_6I1R14P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA5_5_6I1R14Certificates (CA5_5_6I1R14CertificateIndex a)).input +lemma CA5_5_6I1R14P_check : ∀ a : PairSlot, contains (CA5_5_6I1R14Raw a) (CA5_5_6I1R14P a) = true := by + decide +kernel +lemma CA5_5_6I1R14P_sound (a : PairSlot) : + (CA5_5_6I1R14P a).Encloses (CA5_5_6I1R14Value a) := + contains_sound (CA5_5_6I1R14Raw_sound a) (CA5_5_6I1R14P_check a) +def CA5_5_6I1R14Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA5_5_6I1R14Certificates (CA5_5_6I1R14CertificateIndex a)).output +lemma CA5_5_6I1R14Terms_sound (a : PairSlot) : + (CA5_5_6I1R14Terms a).Encloses (Foundation.entropyTerm (CA5_5_6I1R14Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA5_5_6I1R14Certificates_valid + (CA5_5_6I1R14CertificateIndex a) (CA5_5_6I1R14P_sound a) +def CA5_5_6I1R14Entropy : Ball := ⟨0, 0⟩ +lemma CA5_5_6I1R14Entropy_sound : CA5_5_6I1R14Entropy.Encloses (Foundation.finiteEntropy CA5_5_6I1R14Value) := by + exact contains_sound (entropyPair_enclosed CA5_5_6I1R14Value CA5_5_6I1R14Terms CA5_5_6I1R14Terms_sound) (by decide +kernel) +def CA5_5_6I1R14Mass : Ball := ⟨0, 0⟩ +lemma CA5_5_6I1R14Mass_sound : CA5_5_6I1R14Mass.Encloses (∑ a, CA5_5_6I1R14Value a) := by + exact contains_sound (pairSumBall_sound CA5_5_6I1R14P CA5_5_6I1R14Value CA5_5_6I1R14P_sound) (by decide +kernel) +def CA5_5_6I1R14MassTerm : Ball := .exact 0 +lemma CA5_5_6I1R14MassTerm_sound : CA5_5_6I1R14MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA5_5_6I1R14Value a))) := + entropyTerm_zero_ball (CA5_5_6I1R14Mass_sound) +def CA5_5_6I1R14H : Ball := ⟨0, 0⟩ +lemma CA5_5_6I1R14H_sound : CA5_5_6I1R14H.Encloses (homogeneousEntropy CA5_5_6I1R14Value) := by + exact contains_sound (homogeneous_enclosed CA5_5_6I1R14Value CA5_5_6I1R14MassTerm_sound CA5_5_6I1R14Entropy_sound) (by decide +kernel) +def CA5_5_6I1R15Value (a : PairSlot) : ℝ := residualLaw (below (shape 5 5 6)) (fun u => (stageALaw (shape 5 5 6) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 15 a +def CA5_5_6I1R15Raw (a : PairSlot) : Ball := residualBall (below (shape 5 5 6)) A5_5_6Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 15 a +lemma CA5_5_6I1R15Raw_sound (a : PairSlot) : + (CA5_5_6I1R15Raw a).Encloses (CA5_5_6I1R15Value a) := by + exact residualBall_sound_on (below (shape 5 5 6)) A5_5_6Law (fun u => (stageALaw (shape 5 5 6) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A5_5_6Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 5 5 6) (show (shape 5 5 6) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 15 a +def CA5_5_6I1R15Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA5_5_6I1R15Certificates_valid : + CA5_5_6I1R15Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA5_5_6I1R15CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA5_5_6I1R15P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA5_5_6I1R15Certificates (CA5_5_6I1R15CertificateIndex a)).input +lemma CA5_5_6I1R15P_check : ∀ a : PairSlot, contains (CA5_5_6I1R15Raw a) (CA5_5_6I1R15P a) = true := by + decide +kernel +lemma CA5_5_6I1R15P_sound (a : PairSlot) : + (CA5_5_6I1R15P a).Encloses (CA5_5_6I1R15Value a) := + contains_sound (CA5_5_6I1R15Raw_sound a) (CA5_5_6I1R15P_check a) +def CA5_5_6I1R15Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA5_5_6I1R15Certificates (CA5_5_6I1R15CertificateIndex a)).output +lemma CA5_5_6I1R15Terms_sound (a : PairSlot) : + (CA5_5_6I1R15Terms a).Encloses (Foundation.entropyTerm (CA5_5_6I1R15Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA5_5_6I1R15Certificates_valid + (CA5_5_6I1R15CertificateIndex a) (CA5_5_6I1R15P_sound a) +def CA5_5_6I1R15Entropy : Ball := ⟨0, 0⟩ +lemma CA5_5_6I1R15Entropy_sound : CA5_5_6I1R15Entropy.Encloses (Foundation.finiteEntropy CA5_5_6I1R15Value) := by + exact contains_sound (entropyPair_enclosed CA5_5_6I1R15Value CA5_5_6I1R15Terms CA5_5_6I1R15Terms_sound) (by decide +kernel) +def CA5_5_6I1R15Mass : Ball := ⟨0, 0⟩ +lemma CA5_5_6I1R15Mass_sound : CA5_5_6I1R15Mass.Encloses (∑ a, CA5_5_6I1R15Value a) := by + exact contains_sound (pairSumBall_sound CA5_5_6I1R15P CA5_5_6I1R15Value CA5_5_6I1R15P_sound) (by decide +kernel) +def CA5_5_6I1R15MassTerm : Ball := .exact 0 +lemma CA5_5_6I1R15MassTerm_sound : CA5_5_6I1R15MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA5_5_6I1R15Value a))) := + entropyTerm_zero_ball (CA5_5_6I1R15Mass_sound) +def CA5_5_6I1R15H : Ball := ⟨0, 0⟩ +lemma CA5_5_6I1R15H_sound : CA5_5_6I1R15H.Encloses (homogeneousEntropy CA5_5_6I1R15Value) := by + exact contains_sound (homogeneous_enclosed CA5_5_6I1R15Value CA5_5_6I1R15MassTerm_sound CA5_5_6I1R15Entropy_sound) (by decide +kernel) +def CA5_5_6I1R16Value (a : PairSlot) : ℝ := residualLaw (below (shape 5 5 6)) (fun u => (stageALaw (shape 5 5 6) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) 16 a +def CA5_5_6I1R16Raw (a : PairSlot) : Ball := residualBall (below (shape 5 5 6)) A5_5_6Law (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) 16 a +lemma CA5_5_6I1R16Raw_sound (a : PairSlot) : + (CA5_5_6I1R16Raw a).Encloses (CA5_5_6I1R16Value a) := by + exact residualBall_sound_on (below (shape 5 5 6)) A5_5_6Law (fun u => (stageALaw (shape 5 5 6) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u => halfTable u ((Equiv.refl (Fin 3)) 1)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A5_5_6Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 5 5 6) (show (shape 5 5 6) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 1) a) 16 a +def CA5_5_6I1R16Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA5_5_6I1R16Certificates_valid : + CA5_5_6I1R16Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA5_5_6I1R16CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA5_5_6I1R16P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA5_5_6I1R16Certificates (CA5_5_6I1R16CertificateIndex a)).input +lemma CA5_5_6I1R16P_check : ∀ a : PairSlot, contains (CA5_5_6I1R16Raw a) (CA5_5_6I1R16P a) = true := by + decide +kernel +lemma CA5_5_6I1R16P_sound (a : PairSlot) : + (CA5_5_6I1R16P a).Encloses (CA5_5_6I1R16Value a) := + contains_sound (CA5_5_6I1R16Raw_sound a) (CA5_5_6I1R16P_check a) +def CA5_5_6I1R16Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA5_5_6I1R16Certificates (CA5_5_6I1R16CertificateIndex a)).output +lemma CA5_5_6I1R16Terms_sound (a : PairSlot) : + (CA5_5_6I1R16Terms a).Encloses (Foundation.entropyTerm (CA5_5_6I1R16Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA5_5_6I1R16Certificates_valid + (CA5_5_6I1R16CertificateIndex a) (CA5_5_6I1R16P_sound a) +def CA5_5_6I1R16Entropy : Ball := ⟨0, 0⟩ +lemma CA5_5_6I1R16Entropy_sound : CA5_5_6I1R16Entropy.Encloses (Foundation.finiteEntropy CA5_5_6I1R16Value) := by + exact contains_sound (entropyPair_enclosed CA5_5_6I1R16Value CA5_5_6I1R16Terms CA5_5_6I1R16Terms_sound) (by decide +kernel) +def CA5_5_6I1R16Mass : Ball := ⟨0, 0⟩ +lemma CA5_5_6I1R16Mass_sound : CA5_5_6I1R16Mass.Encloses (∑ a, CA5_5_6I1R16Value a) := by + exact contains_sound (pairSumBall_sound CA5_5_6I1R16P CA5_5_6I1R16Value CA5_5_6I1R16P_sound) (by decide +kernel) +def CA5_5_6I1R16MassTerm : Ball := .exact 0 +lemma CA5_5_6I1R16MassTerm_sound : CA5_5_6I1R16MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA5_5_6I1R16Value a))) := + entropyTerm_zero_ball (CA5_5_6I1R16Mass_sound) +def CA5_5_6I1R16H : Ball := ⟨0, 0⟩ +lemma CA5_5_6I1R16H_sound : CA5_5_6I1R16H.Encloses (homogeneousEntropy CA5_5_6I1R16Value) := by + exact contains_sound (homogeneous_enclosed CA5_5_6I1R16Value CA5_5_6I1R16MassTerm_sound CA5_5_6I1R16Entropy_sound) (by decide +kernel) +def CA5_5_6I1ResidualEntropies (a : Fin 17) : Ball := + match a.val with + | 0 => CA5_5_6I1R0H + | 1 => CA5_5_6I1R1H + | 2 => CA5_5_6I1R2H + | 3 => CA5_5_6I1R3H + | 4 => CA5_5_6I1R4H + | 5 => CA5_5_6I1R5H + | 6 => CA5_5_6I1R6H + | 7 => CA5_5_6I1R7H + | 8 => CA5_5_6I1R8H + | 9 => CA5_5_6I1R9H + | 10 => CA5_5_6I1R10H + | 11 => CA5_5_6I1R11H + | 12 => CA5_5_6I1R12H + | 13 => CA5_5_6I1R13H + | 14 => CA5_5_6I1R14H + | 15 => CA5_5_6I1R15H + | 16 => CA5_5_6I1R16H + | _ => (.exact 0) +lemma CA5_5_6I1ResidualEntropies_sound (k : Fin 17) : + (CA5_5_6I1ResidualEntropies k).Encloses (homogeneousEntropy + (residualLaw (below (shape 5 5 6)) (fun u => (stageALaw (shape 5 5 6) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) k)) := by + fin_cases k + · exact CA5_5_6I1R0H_sound + · exact CA5_5_6I1R1H_sound + · exact CA5_5_6I1R2H_sound + · exact CA5_5_6I1R3H_sound + · exact CA5_5_6I1R4H_sound + · exact CA5_5_6I1R5H_sound + · exact CA5_5_6I1R6H_sound + · exact CA5_5_6I1R7H_sound + · exact CA5_5_6I1R8H_sound + · exact CA5_5_6I1R9H_sound + · exact CA5_5_6I1R10H_sound + · exact CA5_5_6I1R11H_sound + · exact CA5_5_6I1R12H_sound + · exact CA5_5_6I1R13H_sound + · exact CA5_5_6I1R14H_sound + · exact CA5_5_6I1R15H_sound + · exact CA5_5_6I1R16H_sound +def CA5_5_6I1Singles (s : Shape) : Ball := + match s 0, s 1, s 2 with + | 3, 5, 0 => Z3_5_0H1H + | 4, 4, 0 => Z4_4_0H1H + | 5, 3, 0 => Z5_3_0H1H + | _, _, _ => (.exact 0) +lemma CA5_5_6I1Singles_sound (u : Shape) (hu : u ∈ below (shape 5 5 6)) + (hd : designated (Equiv.refl (Fin 3)) 1 u) : + (CA5_5_6I1Singles u).Encloses (homogeneousEntropy ((fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) u)) := by + rw [A5_5_6_below] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 0 2 6) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 0 3 5) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 0 4 4) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 0 5 3) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 1 1 6) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 1 2 5) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 1 3 4) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 1 4 3) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 1 5 2) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 2 0 6) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 2 1 5) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 2 2 4) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 2 3 3) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 2 4 2) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 2 5 1) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 3 0 5) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 3 1 4) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 3 2 3) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 3 3 2) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 3 4 1) by decide +kernel) hd |>.elim + · exact Z3_5_0H1H_sound + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 4 0 4) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 4 1 3) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 4 2 2) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 4 3 1) by decide +kernel) hd |>.elim + · exact Z4_4_0H1H_sound + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 5 0 3) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 5 1 2) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 1 (shape 5 2 1) by decide +kernel) hd |>.elim + · exact Z5_3_0H1H_sound +def CA5_5_6I1Singleton : Ball := ⟨(19127110369820477968402652613 / 100000000000000000000000000000000), (317069 / 2000000000000000000000000000000)⟩ +lemma CA5_5_6I1Singleton_sound : CA5_5_6I1Singleton.Encloses + (singletonEntropy (below (shape 5 5 6)) (fun u => (stageALaw (shape 5 5 6) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ))) := by + exact contains_sound (singletonBall_sound (below (shape 5 5 6)) A5_5_6Law (fun u => (stageALaw (shape 5 5 6) u : ℝ)) (Equiv.refl (Fin 3)) 1 + CA5_5_6I1Singles (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ)) (fun u _ => A5_5_6Law_sound u) CA5_5_6I1Singles_sound) (by decide +kernel) +def CA5_5_6I1Group : Ball := ⟨(24449855014961409946479308512559 / 25000000000000000000000000000000), (20804574119 / 12500000000000000000000000000000)⟩ +lemma CA5_5_6I1Group_sound : CA5_5_6I1Group.Encloses + (groupedEntropy (below (shape 5 5 6)) (fun u => (stageALaw (shape 5 5 6) u : ℝ)) (Equiv.refl (Fin 3)) 1 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 1) a : ℝ))) := by + exact contains_sound (Ball.add_sound CA5_5_6I1Singleton_sound + (finSumBall_sound 17 CA5_5_6I1ResidualEntropies _ CA5_5_6I1ResidualEntropies_sound)) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CA5_5_6I1H : Ball := ⟨(5943894429999961068408416286193 / 5000000000000000000000000000000), (96584184323 / 20000000000000000000000000000000)⟩ +lemma CA5_5_6I1_sound : CA5_5_6I1H.Encloses (stageACapacity (shape 5 5 6) 1) := by + have hb := contains_sound (Ball.add_sound CA5_5_6I1PairH_sound + (Ball.neg_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) CA5_5_6I1Group_sound))) + (show contains (.add CA5_5_6I1PairH (.neg (.mul (.exact 2) CA5_5_6I1Group))) CA5_5_6I1H = true by decide +kernel) + simp only [stageACapacity, nativeCapacity, + show (1 : Fin 3) ≠ 0 by decide, ite_false] + change CA5_5_6I1H.Encloses (homogeneousEntropy CA5_5_6I1PairValue - _) + simpa only [sub_eq_add_neg] using hb + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA5_5_6I2.lean b/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA5_5_6I2.lean new file mode 100644 index 0000000000000000000000000000000000000000..fa96bfe2e33c9e9490723f08708c4bb4c7d08e23 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA5_5_6I2.lean @@ -0,0 +1,872 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.CapacityA.CapA5_5_6I2Pair + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CA5_5_6I2R0Value (a : PairSlot) : ℝ := residualLaw (below (shape 5 5 6)) (fun u => (stageALaw (shape 5 5 6) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 0 a +def CA5_5_6I2R0Raw (a : PairSlot) : Ball := residualBall (below (shape 5 5 6)) A5_5_6Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 0 a +lemma CA5_5_6I2R0Raw_sound (a : PairSlot) : + (CA5_5_6I2R0Raw a).Encloses (CA5_5_6I2R0Value a) := by + exact residualBall_sound_on (below (shape 5 5 6)) A5_5_6Law (fun u => (stageALaw (shape 5 5 6) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A5_5_6Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 5 5 6) (show (shape 5 5 6) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 0 a +def CA5_5_6I2R0Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(15575375530790721635899474223 / 100000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ ⟨(68276483212391443391781487719 / 50000000000000000000000000000000), (46175027 / 100000000000000000000000000000000)⟩ ⟨(-87672342894611700539772651333191 / 10000000000000000000000000000000), (296461550823 / 100000000000000000000000000000000)⟩ ⟨-13, 15575375530790721635899474223, 12207031250000000000000000000⟩] +lemma CA5_5_6I2R0Certificates_valid : + CA5_5_6I2R0Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA5_5_6I2R0CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 0, 0 => 1 + | _, _ => 0 +def CA5_5_6I2R0P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA5_5_6I2R0Certificates (CA5_5_6I2R0CertificateIndex a)).input +lemma CA5_5_6I2R0P_check : ∀ a : PairSlot, contains (CA5_5_6I2R0Raw a) (CA5_5_6I2R0P a) = true := by + decide +kernel +lemma CA5_5_6I2R0P_sound (a : PairSlot) : + (CA5_5_6I2R0P a).Encloses (CA5_5_6I2R0Value a) := + contains_sound (CA5_5_6I2R0Raw_sound a) (CA5_5_6I2R0P_check a) +def CA5_5_6I2R0Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA5_5_6I2R0Certificates (CA5_5_6I2R0CertificateIndex a)).output +lemma CA5_5_6I2R0Terms_sound (a : PairSlot) : + (CA5_5_6I2R0Terms a).Encloses (Foundation.entropyTerm (CA5_5_6I2R0Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA5_5_6I2R0Certificates_valid + (CA5_5_6I2R0CertificateIndex a) (CA5_5_6I2R0P_sound a) +def CA5_5_6I2R0Entropy : Ball := ⟨(68276483212391443391781487719 / 50000000000000000000000000000000), (46175027 / 100000000000000000000000000000000)⟩ +lemma CA5_5_6I2R0Entropy_sound : CA5_5_6I2R0Entropy.Encloses (Foundation.finiteEntropy CA5_5_6I2R0Value) := by + exact contains_sound (entropyPair_enclosed CA5_5_6I2R0Value CA5_5_6I2R0Terms CA5_5_6I2R0Terms_sound) (by decide +kernel) +def CA5_5_6I2R0Mass : Ball := ⟨(15575375530790721635899474223 / 100000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +lemma CA5_5_6I2R0Mass_sound : CA5_5_6I2R0Mass.Encloses (∑ a, CA5_5_6I2R0Value a) := by + exact contains_sound (pairSumBall_sound CA5_5_6I2R0P CA5_5_6I2R0Value CA5_5_6I2R0P_sound) (by decide +kernel) +def CA5_5_6I2R0MassTermLogWitness : LogWitness := ⟨-13, 15575375530790721635899474223, 12207031250000000000000000000⟩ +def CA5_5_6I2R0MassTermLog : Ball := ⟨(-87672342894611700539772651333191 / 10000000000000000000000000000000), (296461550823 / 100000000000000000000000000000000)⟩ +lemma CA5_5_6I2R0MassTermLog_sound : CA5_5_6I2R0MassTermLog.Encloses (Real.log ((∑ a, CA5_5_6I2R0Value a))) := by + exact checkLog_sound logTwoBall_sound (CA5_5_6I2R0Mass_sound) (w := CA5_5_6I2R0MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA5_5_6I2R0MassTerm : Ball := ⟨(68276483212391443391781487719 / 50000000000000000000000000000000), (46175027 / 100000000000000000000000000000000)⟩ +lemma CA5_5_6I2R0MassTerm_sound : CA5_5_6I2R0MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA5_5_6I2R0Value a))) := by + exact contains_sound (entropyTerm_ball (CA5_5_6I2R0Mass_sound) CA5_5_6I2R0MassTermLog_sound) (by decide +kernel) +def CA5_5_6I2R0H : Ball := ⟨0, (46175027 / 50000000000000000000000000000000)⟩ +lemma CA5_5_6I2R0H_sound : CA5_5_6I2R0H.Encloses (homogeneousEntropy CA5_5_6I2R0Value) := by + exact contains_sound (homogeneous_enclosed CA5_5_6I2R0Value CA5_5_6I2R0MassTerm_sound CA5_5_6I2R0Entropy_sound) (by decide +kernel) +def CA5_5_6I2R1Value (a : PairSlot) : ℝ := residualLaw (below (shape 5 5 6)) (fun u => (stageALaw (shape 5 5 6) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 1 a +def CA5_5_6I2R1Raw (a : PairSlot) : Ball := residualBall (below (shape 5 5 6)) A5_5_6Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 1 a +lemma CA5_5_6I2R1Raw_sound (a : PairSlot) : + (CA5_5_6I2R1Raw a).Encloses (CA5_5_6I2R1Value a) := by + exact residualBall_sound_on (below (shape 5 5 6)) A5_5_6Law (fun u => (stageALaw (shape 5 5 6) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A5_5_6Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 5 5 6) (show (shape 5 5 6) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 1 a +def CA5_5_6I2R1Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(135103909759799156335132177059 / 20000000000000000000000000000000), (1 / 20000000000000000000000000000000)⟩ ⟨(168793534463164199850227551857 / 5000000000000000000000000000000), (80463843 / 6250000000000000000000000000000)⟩ ⟨(-499744336824187333009094186636727 / 100000000000000000000000000000000), (190582413887 / 100000000000000000000000000000000)⟩ ⟨-8, 135103909759799156335132177059, 78125000000000000000000000000⟩] +lemma CA5_5_6I2R1Certificates_valid : + CA5_5_6I2R1Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA5_5_6I2R1CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 1, 0 => 1 + | 0, 1 => 1 + | _, _ => 0 +def CA5_5_6I2R1P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA5_5_6I2R1Certificates (CA5_5_6I2R1CertificateIndex a)).input +lemma CA5_5_6I2R1P_check : ∀ a : PairSlot, contains (CA5_5_6I2R1Raw a) (CA5_5_6I2R1P a) = true := by + decide +kernel +lemma CA5_5_6I2R1P_sound (a : PairSlot) : + (CA5_5_6I2R1P a).Encloses (CA5_5_6I2R1Value a) := + contains_sound (CA5_5_6I2R1Raw_sound a) (CA5_5_6I2R1P_check a) +def CA5_5_6I2R1Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA5_5_6I2R1Certificates (CA5_5_6I2R1CertificateIndex a)).output +lemma CA5_5_6I2R1Terms_sound (a : PairSlot) : + (CA5_5_6I2R1Terms a).Encloses (Foundation.entropyTerm (CA5_5_6I2R1Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA5_5_6I2R1Certificates_valid + (CA5_5_6I2R1CertificateIndex a) (CA5_5_6I2R1P_sound a) +def CA5_5_6I2R1Entropy : Ball := ⟨(168793534463164199850227551857 / 2500000000000000000000000000000), (80463843 / 3125000000000000000000000000000)⟩ +lemma CA5_5_6I2R1Entropy_sound : CA5_5_6I2R1Entropy.Encloses (Foundation.finiteEntropy CA5_5_6I2R1Value) := by + exact contains_sound (entropyPair_enclosed CA5_5_6I2R1Value CA5_5_6I2R1Terms CA5_5_6I2R1Terms_sound) (by decide +kernel) +def CA5_5_6I2R1Mass : Ball := ⟨(135103909759799156335132177059 / 10000000000000000000000000000000), (1 / 10000000000000000000000000000000)⟩ +lemma CA5_5_6I2R1Mass_sound : CA5_5_6I2R1Mass.Encloses (∑ a, CA5_5_6I2R1Value a) := by + exact contains_sound (pairSumBall_sound CA5_5_6I2R1P CA5_5_6I2R1Value CA5_5_6I2R1P_sound) (by decide +kernel) +def CA5_5_6I2R1MassTermLogWitness : LogWitness := ⟨-7, 135103909759799156335132177059, 78125000000000000000000000000⟩ +def CA5_5_6I2R1MassTermLog : Ball := ⟨(-430429618768192802067370993586397 / 100000000000000000000000000000000), (42351647551 / 25000000000000000000000000000000)⟩ +lemma CA5_5_6I2R1MassTermLog_sound : CA5_5_6I2R1MassTermLog.Encloses (Real.log ((∑ a, CA5_5_6I2R1Value a))) := by + exact checkLog_sound logTwoBall_sound (CA5_5_6I2R1Mass_sound) (w := CA5_5_6I2R1MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA5_5_6I2R1MassTerm : Ball := ⟨(2907636218600133681334528422563 / 50000000000000000000000000000000), (2288749311 / 100000000000000000000000000000000)⟩ +lemma CA5_5_6I2R1MassTerm_sound : CA5_5_6I2R1MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA5_5_6I2R1Value a))) := by + exact contains_sound (entropyTerm_ball (CA5_5_6I2R1Mass_sound) CA5_5_6I2R1MassTermLog_sound) (by decide +kernel) +def CA5_5_6I2R1H : Ball := ⟨(468234470663150315670022614577 / 50000000000000000000000000000000), (4863592287 / 100000000000000000000000000000000)⟩ +lemma CA5_5_6I2R1H_sound : CA5_5_6I2R1H.Encloses (homogeneousEntropy CA5_5_6I2R1Value) := by + exact contains_sound (homogeneous_enclosed CA5_5_6I2R1Value CA5_5_6I2R1MassTerm_sound CA5_5_6I2R1Entropy_sound) (by decide +kernel) +def CA5_5_6I2R2Value (a : PairSlot) : ℝ := residualLaw (below (shape 5 5 6)) (fun u => (stageALaw (shape 5 5 6) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 2 a +def CA5_5_6I2R2Raw (a : PairSlot) : Ball := residualBall (below (shape 5 5 6)) A5_5_6Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 2 a +lemma CA5_5_6I2R2Raw_sound (a : PairSlot) : + (CA5_5_6I2R2Raw a).Encloses (CA5_5_6I2R2Value a) := by + exact residualBall_sound_on (below (shape 5 5 6)) A5_5_6Law (fun u => (stageALaw (shape 5 5 6) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A5_5_6Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 5 5 6) (show (shape 5 5 6) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 2 a +def CA5_5_6I2R2Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(3951118845839213081490416122221 / 100000000000000000000000000000000), (1 / 4000000000000000000000000000000)⟩ ⟨(6383371096603122616951384715983 / 50000000000000000000000000000000), (1255022967 / 25000000000000000000000000000000)⟩ ⟨(-80779284876804331676718801287667 / 25000000000000000000000000000000), (12705494273 / 10000000000000000000000000000000)⟩ ⟨-5, 3951118845839213081490416122221, 3125000000000000000000000000000⟩, + .log ⟨(281558190561078073003273087287 / 100000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ ⟨(1653474778941073973050826271497 / 100000000000000000000000000000000), (596222681 / 100000000000000000000000000000000)⟩ ⟨(-587258632272815276852410766544829 / 100000000000000000000000000000000), (42351647579 / 20000000000000000000000000000000)⟩ ⟨-9, 281558190561078073003273087287, 195312500000000000000000000000⟩, + .log ⟨(722452624872225808991855817413 / 5000000000000000000000000000000), (31 / 50000000000000000000000000000000)⟩ ⟨(1747018090494493839300854826657 / 6250000000000000000000000000000), (2447764741 / 20000000000000000000000000000000)⟩ ⟨(-38690826893812712680788923223139 / 20000000000000000000000000000000), (2117582379 / 2500000000000000000000000000000)⟩ ⟨-3, 722452624872225808991855817413, 625000000000000000000000000000⟩] +lemma CA5_5_6I2R2Certificates_valid : + CA5_5_6I2R2Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA5_5_6I2R2CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 2, 0 => 1 + | 3, 0 => 2 + | 1, 1 => 3 + | 0, 2 => 1 + | 0, 3 => 2 + | _, _ => 0 +def CA5_5_6I2R2P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA5_5_6I2R2Certificates (CA5_5_6I2R2CertificateIndex a)).input +lemma CA5_5_6I2R2P_check : ∀ a : PairSlot, contains (CA5_5_6I2R2Raw a) (CA5_5_6I2R2P a) = true := by + decide +kernel +lemma CA5_5_6I2R2P_sound (a : PairSlot) : + (CA5_5_6I2R2P a).Encloses (CA5_5_6I2R2Value a) := + contains_sound (CA5_5_6I2R2Raw_sound a) (CA5_5_6I2R2P_check a) +def CA5_5_6I2R2Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA5_5_6I2R2Certificates (CA5_5_6I2R2CertificateIndex a)).output +lemma CA5_5_6I2R2Terms_sound (a : PairSlot) : + (CA5_5_6I2R2Terms a).Encloses (Foundation.entropyTerm (CA5_5_6I2R2Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA5_5_6I2R2Certificates_valid + (CA5_5_6I2R2CertificateIndex a) (CA5_5_6I2R2P_sound a) +def CA5_5_6I2R2Entropy : Ball := ⟨(28396361696103269921360434316719 / 50000000000000000000000000000000), (23471452803 / 100000000000000000000000000000000)⟩ +lemma CA5_5_6I2R2Entropy_sound : CA5_5_6I2R2Entropy.Encloses (Foundation.finiteEntropy CA5_5_6I2R2Value) := by + exact contains_sound (entropyPair_enclosed CA5_5_6I2R2Value CA5_5_6I2R2Terms CA5_5_6I2R2Terms_sound) (by decide +kernel) +def CA5_5_6I2R2Mass : Ball := ⟨(5728601642561274622206123691819 / 25000000000000000000000000000000), (59 / 50000000000000000000000000000000)⟩ +lemma CA5_5_6I2R2Mass_sound : CA5_5_6I2R2Mass.Encloses (∑ a, CA5_5_6I2R2Value a) := by + exact contains_sound (pairSumBall_sound CA5_5_6I2R2P CA5_5_6I2R2Value CA5_5_6I2R2P_sound) (by decide +kernel) +def CA5_5_6I2R2MassTermLogWitness : LogWitness := ⟨-3, 5728601642561274622206123691819, 3125000000000000000000000000000⟩ +def CA5_5_6I2R2MassTermLog : Ball := ⟨(-147340436536233278409874066759607 / 100000000000000000000000000000000), (84703295247 / 100000000000000000000000000000000)⟩ +lemma CA5_5_6I2R2MassTermLog_sound : CA5_5_6I2R2MassTermLog.Encloses (Real.log ((∑ a, CA5_5_6I2R2Value a))) := by + exact checkLog_sound logTwoBall_sound (CA5_5_6I2R2Mass_sound) (w := CA5_5_6I2R2MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA5_5_6I2R2MassTerm : Ball := ⟨(8440546667571611990464074052287 / 25000000000000000000000000000000), (9704628813 / 50000000000000000000000000000000)⟩ +lemma CA5_5_6I2R2MassTerm_sound : CA5_5_6I2R2MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA5_5_6I2R2Value a))) := by + exact contains_sound (entropyTerm_ball (CA5_5_6I2R2Mass_sound) CA5_5_6I2R2MassTermLog_sound) (by decide +kernel) +def CA5_5_6I2R2H : Ball := ⟨(2303053672192009188086457242429 / 10000000000000000000000000000000), (42880710429 / 100000000000000000000000000000000)⟩ +lemma CA5_5_6I2R2H_sound : CA5_5_6I2R2H.Encloses (homogeneousEntropy CA5_5_6I2R2Value) := by + exact contains_sound (homogeneous_enclosed CA5_5_6I2R2Value CA5_5_6I2R2MassTerm_sound CA5_5_6I2R2Entropy_sound) (by decide +kernel) +def CA5_5_6I2R3Value (a : PairSlot) : ℝ := residualLaw (below (shape 5 5 6)) (fun u => (stageALaw (shape 5 5 6) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 3 a +def CA5_5_6I2R3Raw (a : PairSlot) : Ball := residualBall (below (shape 5 5 6)) A5_5_6Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 3 a +lemma CA5_5_6I2R3Raw_sound (a : PairSlot) : + (CA5_5_6I2R3Raw a).Encloses (CA5_5_6I2R3Value a) := by + exact residualBall_sound_on (below (shape 5 5 6)) A5_5_6Law (fun u => (stageALaw (shape 5 5 6) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A5_5_6Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 5 5 6) (show (shape 5 5 6) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 3 a +def CA5_5_6I2R3Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(4218292811255398071967879579 / 625000000000000000000000000000), (1 / 20000000000000000000000000000000)⟩ ⟨(1686750574245760453707469062551 / 50000000000000000000000000000000), (321572977 / 25000000000000000000000000000000)⟩ ⟨(-249916057531780527769469189548311 / 50000000000000000000000000000000), (2977850217 / 1562500000000000000000000000000)⟩ ⟨-8, 4218292811255398071967879579, 2441406250000000000000000000⟩, + .log ⟨(11910576392475085462818371511423 / 50000000000000000000000000000000), (29 / 50000000000000000000000000000000)⟩ ⟨(3417373592137605936813181049017 / 10000000000000000000000000000000), (10088650697 / 50000000000000000000000000000000)⟩ ⟨(-5738384910232637840030721913069 / 4000000000000000000000000000000), (3388131799 / 4000000000000000000000000000000)⟩ ⟨-3, 11910576392475085462818371511423, 6250000000000000000000000000000⟩, + .log ⟨(596096822416447657692314672391 / 50000000000000000000000000000000), (1 / 20000000000000000000000000000000)⟩ ⟨(5280672936385669574238866191791 / 100000000000000000000000000000000), (1009827311 / 50000000000000000000000000000000)⟩ ⟨(-442937517682023788694542460294741 / 100000000000000000000000000000000), (169406589883 / 100000000000000000000000000000000)⟩ ⟨-7, 596096822416447657692314672391, 390625000000000000000000000000⟩] +lemma CA5_5_6I2R3Certificates_valid : + CA5_5_6I2R3Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA5_5_6I2R3CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 4, 0 => 1 + | 2, 1 => 2 + | 3, 1 => 3 + | 1, 2 => 2 + | 1, 3 => 3 + | 0, 4 => 1 + | _, _ => 0 +def CA5_5_6I2R3P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA5_5_6I2R3Certificates (CA5_5_6I2R3CertificateIndex a)).input +lemma CA5_5_6I2R3P_check : ∀ a : PairSlot, contains (CA5_5_6I2R3Raw a) (CA5_5_6I2R3P a) = true := by + decide +kernel +lemma CA5_5_6I2R3P_sound (a : PairSlot) : + (CA5_5_6I2R3P a).Encloses (CA5_5_6I2R3Value a) := + contains_sound (CA5_5_6I2R3Raw_sound a) (CA5_5_6I2R3P_check a) +def CA5_5_6I2R3Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA5_5_6I2R3Certificates (CA5_5_6I2R3CertificateIndex a)).output +lemma CA5_5_6I2R3Terms_sound (a : PairSlot) : + (CA5_5_6I2R3Terms a).Encloses (Foundation.entropyTerm (CA5_5_6I2R3Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA5_5_6I2R3Certificates_valid + (CA5_5_6I2R3CertificateIndex a) (CA5_5_6I2R3P_sound a) +def CA5_5_6I2R3Entropy : Ball := ⟨(42827910006253249849785614807063 / 50000000000000000000000000000000), (5870811981 / 12500000000000000000000000000000)⟩ +lemma CA5_5_6I2R3Entropy_sound : CA5_5_6I2R3Entropy.Encloses (Foundation.finiteEntropy CA5_5_6I2R3Value) := by + exact contains_sound (entropyPair_enclosed CA5_5_6I2R3Value CA5_5_6I2R3Terms CA5_5_6I2R3Terms_sound) (by decide +kernel) +def CA5_5_6I2R3Mass : Ball := ⟨(6422068319895982483134058275067 / 12500000000000000000000000000000), (17 / 12500000000000000000000000000000)⟩ +lemma CA5_5_6I2R3Mass_sound : CA5_5_6I2R3Mass.Encloses (∑ a, CA5_5_6I2R3Value a) := by + exact contains_sound (pairSumBall_sound CA5_5_6I2R3P CA5_5_6I2R3Value CA5_5_6I2R3P_sound) (by decide +kernel) +def CA5_5_6I2R3MassTermLogWitness : LogWitness := ⟨-1, 6422068319895982483134058275067, 6250000000000000000000000000000⟩ +def CA5_5_6I2R3MassTermLog : Ball := ⟨(-66598841028332232150207658845161 / 100000000000000000000000000000000), (4235164763 / 10000000000000000000000000000000)⟩ +lemma CA5_5_6I2R3MassTermLog_sound : CA5_5_6I2R3MassTermLog.Encloses (Real.log ((∑ a, CA5_5_6I2R3Value a))) := by + exact checkLog_sound logTwoBall_sound (CA5_5_6I2R3Mass_sound) (w := CA5_5_6I2R3MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA5_5_6I2R3MassTerm : Ball := ⟨(34216184568787296356545389408101 / 100000000000000000000000000000000), (10879407027 / 50000000000000000000000000000000)⟩ +lemma CA5_5_6I2R3MassTerm_sound : CA5_5_6I2R3MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA5_5_6I2R3Value a))) := by + exact contains_sound (entropyTerm_ball (CA5_5_6I2R3Mass_sound) CA5_5_6I2R3MassTermLog_sound) (by decide +kernel) +def CA5_5_6I2R3H : Ball := ⟨(2057585417748768133721033608241 / 4000000000000000000000000000000), (34362654951 / 50000000000000000000000000000000)⟩ +lemma CA5_5_6I2R3H_sound : CA5_5_6I2R3H.Encloses (homogeneousEntropy CA5_5_6I2R3Value) := by + exact contains_sound (homogeneous_enclosed CA5_5_6I2R3Value CA5_5_6I2R3MassTerm_sound CA5_5_6I2R3Entropy_sound) (by decide +kernel) +def CA5_5_6I2R4Value (a : PairSlot) : ℝ := residualLaw (below (shape 5 5 6)) (fun u => (stageALaw (shape 5 5 6) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 4 a +def CA5_5_6I2R4Raw (a : PairSlot) : Ball := residualBall (below (shape 5 5 6)) A5_5_6Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 4 a +lemma CA5_5_6I2R4Raw_sound (a : PairSlot) : + (CA5_5_6I2R4Raw a).Encloses (CA5_5_6I2R4Value a) := by + exact residualBall_sound_on (below (shape 5 5 6)) A5_5_6Law (fun u => (stageALaw (shape 5 5 6) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A5_5_6Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 5 5 6) (show (shape 5 5 6) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 4 a +def CA5_5_6I2R4Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(4960161490237224639411177757 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(24581288476501505831839546427 / 50000000000000000000000000000000), (4201423 / 25000000000000000000000000000000)⟩ ⟨(-7929189732998271827579135213163 / 800000000000000000000000000000), (21175824943 / 6250000000000000000000000000000)⟩ ⟨-15, 4960161490237224639411177757, 3051757812500000000000000000⟩, + .log ⟨(337922164090609540743223917433 / 20000000000000000000000000000000), (11 / 100000000000000000000000000000000)⟩ ⟨(6894747510716945775985992392651 / 100000000000000000000000000000000), (1252261557 / 50000000000000000000000000000000)⟩ ⟨(-204033598366403889138484168240683 / 50000000000000000000000000000000), (148230766431 / 100000000000000000000000000000000)⟩ ⟨-6, 337922164090609540743223917433, 312500000000000000000000000000⟩, + .log ⟨(17515991896721353725343536815071 / 100000000000000000000000000000000), (77 / 100000000000000000000000000000000)⟩ ⟨(15256918511132685778460382634431 / 50000000000000000000000000000000), (14836622453 / 100000000000000000000000000000000)⟩ ⟨(-5443924686470538360330274896351 / 3125000000000000000000000000000), (84703295171 / 100000000000000000000000000000000)⟩ ⟨-3, 17515991896721353725343536815071, 12500000000000000000000000000000⟩, + .log ⟨(806108168804297215259309824889 / 100000000000000000000000000000000), (1 / 20000000000000000000000000000000)⟩ ⟨(485751464616018194882233335333 / 12500000000000000000000000000000), (682800193 / 50000000000000000000000000000000)⟩ ⟨(-241035376349819092734654105203851 / 50000000000000000000000000000000), (169406590083 / 100000000000000000000000000000000)⟩ ⟨-7, 806108168804297215259309824889, 781250000000000000000000000000⟩, + .log ⟨(8522171377249288492257505981 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(33069503641589594789331568149 / 10000000000000000000000000000000), (117301609 / 100000000000000000000000000000000)⟩ ⟨(-97010204846008031883965721999079 / 12500000000000000000000000000000), (11011428409 / 4000000000000000000000000000000)⟩ ⟨-12, 8522171377249288492257505981, 4882812500000000000000000000⟩] +lemma CA5_5_6I2R4Certificates_valid : + CA5_5_6I2R4Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA5_5_6I2R4CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 5, 0 => 1 + | 4, 1 => 2 + | 2, 2 => 3 + | 2, 3 => 4 + | 3, 2 => 4 + | 3, 3 => 5 + | 1, 4 => 2 + | 0, 5 => 1 + | _, _ => 0 +def CA5_5_6I2R4P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA5_5_6I2R4Certificates (CA5_5_6I2R4CertificateIndex a)).input +lemma CA5_5_6I2R4P_check : ∀ a : PairSlot, contains (CA5_5_6I2R4Raw a) (CA5_5_6I2R4P a) = true := by + decide +kernel +lemma CA5_5_6I2R4P_sound (a : PairSlot) : + (CA5_5_6I2R4P a).Encloses (CA5_5_6I2R4Value a) := + contains_sound (CA5_5_6I2R4Raw_sound a) (CA5_5_6I2R4P_check a) +def CA5_5_6I2R4Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA5_5_6I2R4Certificates (CA5_5_6I2R4CertificateIndex a)).output +lemma CA5_5_6I2R4Terms_sound (a : PairSlot) : + (CA5_5_6I2R4Terms a).Encloses (Foundation.entropyTerm (CA5_5_6I2R4Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA5_5_6I2R4Certificates_valid + (CA5_5_6I2R4CertificateIndex a) (CA5_5_6I2R4P_sound a) +def CA5_5_6I2R4Entropy : Ball := ⟨(5250437566787745619822915728669 / 10000000000000000000000000000000), (11363891223 / 50000000000000000000000000000000)⟩ +lemma CA5_5_6I2R4Entropy_sound : CA5_5_6I2R4Entropy.Encloses (Foundation.finiteEntropy CA5_5_6I2R4Value) := by + exact contains_sound (entropyPair_enclosed CA5_5_6I2R4Value CA5_5_6I2R4Terms CA5_5_6I2R4Terms_sound) (by decide +kernel) +def CA5_5_6I2R4Mass : Ball := ⟨(11279980527551382227517252762299 / 50000000000000000000000000000000), (7 / 6250000000000000000000000000000)⟩ +lemma CA5_5_6I2R4Mass_sound : CA5_5_6I2R4Mass.Encloses (∑ a, CA5_5_6I2R4Value a) := by + exact contains_sound (pairSumBall_sound CA5_5_6I2R4P CA5_5_6I2R4Value CA5_5_6I2R4P_sound) (by decide +kernel) +def CA5_5_6I2R4MassTermLogWitness : LogWitness := ⟨-3, 11279980527551382227517252762299, 6250000000000000000000000000000⟩ +def CA5_5_6I2R4MassTermLog : Ball := ⟨(-74449674282031453783921025571407 / 50000000000000000000000000000000), (21175823807 / 25000000000000000000000000000000)⟩ +lemma CA5_5_6I2R4MassTermLog_sound : CA5_5_6I2R4MassTermLog.Encloses (Real.log ((∑ a, CA5_5_6I2R4Value a))) := by + exact checkLog_sound logTwoBall_sound (CA5_5_6I2R4Mass_sound) (w := CA5_5_6I2R4MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA5_5_6I2R4MassTerm : Ball := ⟨(4198954380919288659638450314487 / 12500000000000000000000000000000), (19109030583 / 100000000000000000000000000000000)⟩ +lemma CA5_5_6I2R4MassTerm_sound : CA5_5_6I2R4MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA5_5_6I2R4Value a))) := by + exact contains_sound (entropyTerm_ball (CA5_5_6I2R4Mass_sound) CA5_5_6I2R4MassTermLog_sound) (by decide +kernel) +def CA5_5_6I2R4H : Ball := ⟨(9456370310261573460560777385397 / 50000000000000000000000000000000), (41836813029 / 100000000000000000000000000000000)⟩ +lemma CA5_5_6I2R4H_sound : CA5_5_6I2R4H.Encloses (homogeneousEntropy CA5_5_6I2R4Value) := by + exact contains_sound (homogeneous_enclosed CA5_5_6I2R4Value CA5_5_6I2R4MassTerm_sound CA5_5_6I2R4Entropy_sound) (by decide +kernel) +def CA5_5_6I2R5Value (a : PairSlot) : ℝ := residualLaw (below (shape 5 5 6)) (fun u => (stageALaw (shape 5 5 6) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 5 a +def CA5_5_6I2R5Raw (a : PairSlot) : Ball := residualBall (below (shape 5 5 6)) A5_5_6Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 5 a +lemma CA5_5_6I2R5Raw_sound (a : PairSlot) : + (CA5_5_6I2R5Raw a).Encloses (CA5_5_6I2R5Value a) := by + exact residualBall_sound_on (below (shape 5 5 6)) A5_5_6Law (fun u => (stageALaw (shape 5 5 6) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A5_5_6Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 5 5 6) (show (shape 5 5 6) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 5 a +def CA5_5_6I2R5Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(1004140529770394352762712983 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(11556445985644917048012031137 / 100000000000000000000000000000000), (956861 / 25000000000000000000000000000000)⟩ ⟨(-1150879348360473112736059622484469 / 100000000000000000000000000000000), (381164925881 / 100000000000000000000000000000000)⟩ ⟨-17, 1004140529770394352762712983, 762939453125000000000000000⟩, + .log ⟨(591268702244544564569689056257 / 100000000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ ⟨(3033595660817007418639026556429 / 100000000000000000000000000000000), (563427093 / 50000000000000000000000000000000)⟩ ⟨(-513065489396111085148890990305593 / 100000000000000000000000000000000), (190582413823 / 100000000000000000000000000000000)⟩ ⟨-8, 591268702244544564569689056257, 390625000000000000000000000000⟩, + .log ⟨(4437911231578676666863887363 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(46671868898246297818604784281 / 25000000000000000000000000000000), (16445877 / 25000000000000000000000000000000)⟩ ⟨(-84133037301233156853611154534429 / 10000000000000000000000000000000), (74115384017 / 25000000000000000000000000000000)⟩ ⟨-13, 4437911231578676666863887363, 2441406250000000000000000000⟩] +lemma CA5_5_6I2R5Certificates_valid : + CA5_5_6I2R5Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA5_5_6I2R5CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 5, 1 => 1 + | 4, 2 => 2 + | 4, 3 => 3 + | 2, 4 => 2 + | 3, 4 => 3 + | 1, 5 => 1 + | _, _ => 0 +def CA5_5_6I2R5P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA5_5_6I2R5Certificates (CA5_5_6I2R5CertificateIndex a)).input +lemma CA5_5_6I2R5P_check : ∀ a : PairSlot, contains (CA5_5_6I2R5Raw a) (CA5_5_6I2R5P a) = true := by + decide +kernel +lemma CA5_5_6I2R5P_sound (a : PairSlot) : + (CA5_5_6I2R5P a).Encloses (CA5_5_6I2R5Value a) := + contains_sound (CA5_5_6I2R5Raw_sound a) (CA5_5_6I2R5P_check a) +def CA5_5_6I2R5Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA5_5_6I2R5Certificates (CA5_5_6I2R5CertificateIndex a)).output +lemma CA5_5_6I2R5Terms_sound (a : PairSlot) : + (CA5_5_6I2R5Terms a).Encloses (Foundation.entropyTerm (CA5_5_6I2R5Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA5_5_6I2R5Certificates_valid + (CA5_5_6I2R5CertificateIndex a) (CA5_5_6I2R5P_sound a) +def CA5_5_6I2R5Entropy : Ball := ⟨(323183958239563752696145772469 / 5000000000000000000000000000000), (598232569 / 25000000000000000000000000000000)⟩ +lemma CA5_5_6I2R5Entropy_sound : CA5_5_6I2R5Entropy.Encloses (Foundation.finiteEntropy CA5_5_6I2R5Value) := by + exact contains_sound (entropyPair_enclosed CA5_5_6I2R5Value CA5_5_6I2R5Terms CA5_5_6I2R5Terms_sound) (by decide +kernel) +def CA5_5_6I2R5Mass : Ball := ⟨(122892479786441668451354241211 / 10000000000000000000000000000000), (3 / 25000000000000000000000000000000)⟩ +lemma CA5_5_6I2R5Mass_sound : CA5_5_6I2R5Mass.Encloses (∑ a, CA5_5_6I2R5Value a) := by + exact contains_sound (pairSumBall_sound CA5_5_6I2R5P CA5_5_6I2R5Value CA5_5_6I2R5P_sound) (by decide +kernel) +def CA5_5_6I2R5MassTermLogWitness : LogWitness := ⟨-7, 122892479786441668451354241211, 78125000000000000000000000000⟩ +def CA5_5_6I2R5MassTermLog : Ball := ⟨(-439903054697170788664264893857777 / 100000000000000000000000000000000), (4235164761 / 2500000000000000000000000000000)⟩ +lemma CA5_5_6I2R5MassTermLog_sound : CA5_5_6I2R5MassTermLog.Encloses (Real.log ((∑ a, CA5_5_6I2R5Value a))) := by + exact checkLog_sound logTwoBall_sound (CA5_5_6I2R5Mass_sound) (w := CA5_5_6I2R5MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA5_5_6I2R5MassTerm : Ball := ⟨(540607772573660047982269508961 / 10000000000000000000000000000000), (2081879653 / 100000000000000000000000000000000)⟩ +lemma CA5_5_6I2R5MassTerm_sound : CA5_5_6I2R5MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA5_5_6I2R5Value a))) := by + exact contains_sound (entropyTerm_ball (CA5_5_6I2R5Mass_sound) CA5_5_6I2R5MassTermLog_sound) (by decide +kernel) +def CA5_5_6I2R5H : Ball := ⟨(105760143905467457410022035977 / 10000000000000000000000000000000), (4474809929 / 100000000000000000000000000000000)⟩ +lemma CA5_5_6I2R5H_sound : CA5_5_6I2R5H.Encloses (homogeneousEntropy CA5_5_6I2R5Value) := by + exact contains_sound (homogeneous_enclosed CA5_5_6I2R5Value CA5_5_6I2R5MassTerm_sound CA5_5_6I2R5Entropy_sound) (by decide +kernel) +def CA5_5_6I2R6Value (a : PairSlot) : ℝ := residualLaw (below (shape 5 5 6)) (fun u => (stageALaw (shape 5 5 6) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 6 a +def CA5_5_6I2R6Raw (a : PairSlot) : Ball := residualBall (below (shape 5 5 6)) A5_5_6Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 6 a +lemma CA5_5_6I2R6Raw_sound (a : PairSlot) : + (CA5_5_6I2R6Raw a).Encloses (CA5_5_6I2R6Value a) := by + exact residualBall_sound_on (below (shape 5 5 6)) A5_5_6Law (fun u => (stageALaw (shape 5 5 6) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A5_5_6Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 5 5 6) (show (shape 5 5 6) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 6 a +def CA5_5_6I2R6Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(94926009128879850262804749 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(329098577781607517737011613 / 25000000000000000000000000000000), (221123 / 50000000000000000000000000000000)⟩ ⟨(-1386758300708900602244217122892999 / 100000000000000000000000000000000), (232934587239 / 50000000000000000000000000000000)⟩ ⟨-21, 94926009128879850262804749, 47683715820312500000000000⟩, + .log ⟨(1196143072037424471053 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(140785416607620007360333 / 100000000000000000000000000000000), (69 / 100000000000000000000000000000000)⟩ ⟨(-1176994791833858204285792444680329 / 50000000000000000000000000000000), (94734279593 / 12500000000000000000000000000000)⟩ ⟨-34, 4784572288149697884212, 4656612873077392578125⟩, + .log ⟨(9953782606908316684892791569 / 100000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ ⟨(45861918112041811093778610697 / 50000000000000000000000000000000), (31616953 / 100000000000000000000000000000000)⟩ ⟨(-230374320613611934002162538946137 / 25000000000000000000000000000000), (317637375337 / 100000000000000000000000000000000)⟩ ⟨-14, 9953782606908316684892791569, 6103515625000000000000000000⟩] +lemma CA5_5_6I2R6Certificates_valid : + CA5_5_6I2R6Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA5_5_6I2R6CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 5, 2 => 1 + | 5, 3 => 2 + | 4, 4 => 3 + | 2, 5 => 1 + | 3, 5 => 2 + | _, _ => 0 +def CA5_5_6I2R6P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA5_5_6I2R6Certificates (CA5_5_6I2R6CertificateIndex a)).input +lemma CA5_5_6I2R6P_check : ∀ a : PairSlot, contains (CA5_5_6I2R6Raw a) (CA5_5_6I2R6P a) = true := by + decide +kernel +lemma CA5_5_6I2R6P_sound (a : PairSlot) : + (CA5_5_6I2R6P a).Encloses (CA5_5_6I2R6Value a) := + contains_sound (CA5_5_6I2R6Raw_sound a) (CA5_5_6I2R6P_check a) +def CA5_5_6I2R6Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA5_5_6I2R6Certificates (CA5_5_6I2R6CertificateIndex a)).output +lemma CA5_5_6I2R6Terms_sound (a : PairSlot) : + (CA5_5_6I2R6Terms a).Encloses (Foundation.entropyTerm (CA5_5_6I2R6Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA5_5_6I2R6Certificates_valid + (CA5_5_6I2R6CertificateIndex a) (CA5_5_6I2R6P_sound a) +def CA5_5_6I2R6Entropy : Ball := ⟨(23589226604292424392367008741 / 25000000000000000000000000000000), (32501583 / 100000000000000000000000000000000)⟩ +lemma CA5_5_6I2R6Entropy_sound : CA5_5_6I2R6Entropy.Encloses (Foundation.finiteEntropy CA5_5_6I2R6Value) := by + exact contains_sound (entropyPair_enclosed CA5_5_6I2R6Value CA5_5_6I2R6Terms CA5_5_6I2R6Terms_sound) (by decide +kernel) +def CA5_5_6I2R6Mass : Ball := ⟨(10143646586596796759663111597 / 100000000000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ +lemma CA5_5_6I2R6Mass_sound : CA5_5_6I2R6Mass.Encloses (∑ a, CA5_5_6I2R6Value a) := by + exact contains_sound (pairSumBall_sound CA5_5_6I2R6P CA5_5_6I2R6Value CA5_5_6I2R6P_sound) (by decide +kernel) +def CA5_5_6I2R6MassTermLogWitness : LogWitness := ⟨-14, 10143646586596796759663111597, 6103515625000000000000000000⟩ +def CA5_5_6I2R6MassTermLog : Ball := ⟨(-919607790753164239606091652322159 / 100000000000000000000000000000000), (63527482879 / 20000000000000000000000000000000)⟩ +lemma CA5_5_6I2R6MassTermLog_sound : CA5_5_6I2R6MassTermLog.Encloses (Real.log ((∑ a, CA5_5_6I2R6Value a))) := by + exact checkLog_sound logTwoBall_sound (CA5_5_6I2R6Mass_sound) (w := CA5_5_6I2R6MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA5_5_6I2R6MassTerm : Ball := ⟨(46640882138405778787300293759 / 50000000000000000000000000000000), (32220073 / 100000000000000000000000000000000)⟩ +lemma CA5_5_6I2R6MassTerm_sound : CA5_5_6I2R6MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA5_5_6I2R6Value a))) := by + exact contains_sound (entropyTerm_ball (CA5_5_6I2R6Mass_sound) CA5_5_6I2R6MassTermLog_sound) (by decide +kernel) +def CA5_5_6I2R6H : Ball := ⟨(537571070179069997433723723 / 50000000000000000000000000000000), (8090207 / 12500000000000000000000000000000)⟩ +lemma CA5_5_6I2R6H_sound : CA5_5_6I2R6H.Encloses (homogeneousEntropy CA5_5_6I2R6Value) := by + exact contains_sound (homogeneous_enclosed CA5_5_6I2R6Value CA5_5_6I2R6MassTerm_sound CA5_5_6I2R6Entropy_sound) (by decide +kernel) +def CA5_5_6I2R7Value (a : PairSlot) : ℝ := residualLaw (below (shape 5 5 6)) (fun u => (stageALaw (shape 5 5 6) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 7 a +def CA5_5_6I2R7Raw (a : PairSlot) : Ball := residualBall (below (shape 5 5 6)) A5_5_6Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 7 a +lemma CA5_5_6I2R7Raw_sound (a : PairSlot) : + (CA5_5_6I2R7Raw a).Encloses (CA5_5_6I2R7Value a) := by + exact residualBall_sound_on (below (shape 5 5 6)) A5_5_6Law (fun u => (stageALaw (shape 5 5 6) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A5_5_6Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 5 5 6) (show (shape 5 5 6) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 7 a +def CA5_5_6I2R7Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA5_5_6I2R7Certificates_valid : + CA5_5_6I2R7Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA5_5_6I2R7CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA5_5_6I2R7P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA5_5_6I2R7Certificates (CA5_5_6I2R7CertificateIndex a)).input +lemma CA5_5_6I2R7P_check : ∀ a : PairSlot, contains (CA5_5_6I2R7Raw a) (CA5_5_6I2R7P a) = true := by + decide +kernel +lemma CA5_5_6I2R7P_sound (a : PairSlot) : + (CA5_5_6I2R7P a).Encloses (CA5_5_6I2R7Value a) := + contains_sound (CA5_5_6I2R7Raw_sound a) (CA5_5_6I2R7P_check a) +def CA5_5_6I2R7Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA5_5_6I2R7Certificates (CA5_5_6I2R7CertificateIndex a)).output +lemma CA5_5_6I2R7Terms_sound (a : PairSlot) : + (CA5_5_6I2R7Terms a).Encloses (Foundation.entropyTerm (CA5_5_6I2R7Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA5_5_6I2R7Certificates_valid + (CA5_5_6I2R7CertificateIndex a) (CA5_5_6I2R7P_sound a) +def CA5_5_6I2R7Entropy : Ball := ⟨0, 0⟩ +lemma CA5_5_6I2R7Entropy_sound : CA5_5_6I2R7Entropy.Encloses (Foundation.finiteEntropy CA5_5_6I2R7Value) := by + exact contains_sound (entropyPair_enclosed CA5_5_6I2R7Value CA5_5_6I2R7Terms CA5_5_6I2R7Terms_sound) (by decide +kernel) +def CA5_5_6I2R7Mass : Ball := ⟨0, 0⟩ +lemma CA5_5_6I2R7Mass_sound : CA5_5_6I2R7Mass.Encloses (∑ a, CA5_5_6I2R7Value a) := by + exact contains_sound (pairSumBall_sound CA5_5_6I2R7P CA5_5_6I2R7Value CA5_5_6I2R7P_sound) (by decide +kernel) +def CA5_5_6I2R7MassTerm : Ball := .exact 0 +lemma CA5_5_6I2R7MassTerm_sound : CA5_5_6I2R7MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA5_5_6I2R7Value a))) := + entropyTerm_zero_ball (CA5_5_6I2R7Mass_sound) +def CA5_5_6I2R7H : Ball := ⟨0, 0⟩ +lemma CA5_5_6I2R7H_sound : CA5_5_6I2R7H.Encloses (homogeneousEntropy CA5_5_6I2R7Value) := by + exact contains_sound (homogeneous_enclosed CA5_5_6I2R7Value CA5_5_6I2R7MassTerm_sound CA5_5_6I2R7Entropy_sound) (by decide +kernel) +def CA5_5_6I2R8Value (a : PairSlot) : ℝ := residualLaw (below (shape 5 5 6)) (fun u => (stageALaw (shape 5 5 6) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 8 a +def CA5_5_6I2R8Raw (a : PairSlot) : Ball := residualBall (below (shape 5 5 6)) A5_5_6Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 8 a +lemma CA5_5_6I2R8Raw_sound (a : PairSlot) : + (CA5_5_6I2R8Raw a).Encloses (CA5_5_6I2R8Value a) := by + exact residualBall_sound_on (below (shape 5 5 6)) A5_5_6Law (fun u => (stageALaw (shape 5 5 6) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A5_5_6Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 5 5 6) (show (shape 5 5 6) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 8 a +def CA5_5_6I2R8Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA5_5_6I2R8Certificates_valid : + CA5_5_6I2R8Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA5_5_6I2R8CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA5_5_6I2R8P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA5_5_6I2R8Certificates (CA5_5_6I2R8CertificateIndex a)).input +lemma CA5_5_6I2R8P_check : ∀ a : PairSlot, contains (CA5_5_6I2R8Raw a) (CA5_5_6I2R8P a) = true := by + decide +kernel +lemma CA5_5_6I2R8P_sound (a : PairSlot) : + (CA5_5_6I2R8P a).Encloses (CA5_5_6I2R8Value a) := + contains_sound (CA5_5_6I2R8Raw_sound a) (CA5_5_6I2R8P_check a) +def CA5_5_6I2R8Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA5_5_6I2R8Certificates (CA5_5_6I2R8CertificateIndex a)).output +lemma CA5_5_6I2R8Terms_sound (a : PairSlot) : + (CA5_5_6I2R8Terms a).Encloses (Foundation.entropyTerm (CA5_5_6I2R8Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA5_5_6I2R8Certificates_valid + (CA5_5_6I2R8CertificateIndex a) (CA5_5_6I2R8P_sound a) +def CA5_5_6I2R8Entropy : Ball := ⟨0, 0⟩ +lemma CA5_5_6I2R8Entropy_sound : CA5_5_6I2R8Entropy.Encloses (Foundation.finiteEntropy CA5_5_6I2R8Value) := by + exact contains_sound (entropyPair_enclosed CA5_5_6I2R8Value CA5_5_6I2R8Terms CA5_5_6I2R8Terms_sound) (by decide +kernel) +def CA5_5_6I2R8Mass : Ball := ⟨0, 0⟩ +lemma CA5_5_6I2R8Mass_sound : CA5_5_6I2R8Mass.Encloses (∑ a, CA5_5_6I2R8Value a) := by + exact contains_sound (pairSumBall_sound CA5_5_6I2R8P CA5_5_6I2R8Value CA5_5_6I2R8P_sound) (by decide +kernel) +def CA5_5_6I2R8MassTerm : Ball := .exact 0 +lemma CA5_5_6I2R8MassTerm_sound : CA5_5_6I2R8MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA5_5_6I2R8Value a))) := + entropyTerm_zero_ball (CA5_5_6I2R8Mass_sound) +def CA5_5_6I2R8H : Ball := ⟨0, 0⟩ +lemma CA5_5_6I2R8H_sound : CA5_5_6I2R8H.Encloses (homogeneousEntropy CA5_5_6I2R8Value) := by + exact contains_sound (homogeneous_enclosed CA5_5_6I2R8Value CA5_5_6I2R8MassTerm_sound CA5_5_6I2R8Entropy_sound) (by decide +kernel) +def CA5_5_6I2R9Value (a : PairSlot) : ℝ := residualLaw (below (shape 5 5 6)) (fun u => (stageALaw (shape 5 5 6) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 9 a +def CA5_5_6I2R9Raw (a : PairSlot) : Ball := residualBall (below (shape 5 5 6)) A5_5_6Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 9 a +lemma CA5_5_6I2R9Raw_sound (a : PairSlot) : + (CA5_5_6I2R9Raw a).Encloses (CA5_5_6I2R9Value a) := by + exact residualBall_sound_on (below (shape 5 5 6)) A5_5_6Law (fun u => (stageALaw (shape 5 5 6) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A5_5_6Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 5 5 6) (show (shape 5 5 6) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 9 a +def CA5_5_6I2R9Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA5_5_6I2R9Certificates_valid : + CA5_5_6I2R9Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA5_5_6I2R9CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA5_5_6I2R9P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA5_5_6I2R9Certificates (CA5_5_6I2R9CertificateIndex a)).input +lemma CA5_5_6I2R9P_check : ∀ a : PairSlot, contains (CA5_5_6I2R9Raw a) (CA5_5_6I2R9P a) = true := by + decide +kernel +lemma CA5_5_6I2R9P_sound (a : PairSlot) : + (CA5_5_6I2R9P a).Encloses (CA5_5_6I2R9Value a) := + contains_sound (CA5_5_6I2R9Raw_sound a) (CA5_5_6I2R9P_check a) +def CA5_5_6I2R9Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA5_5_6I2R9Certificates (CA5_5_6I2R9CertificateIndex a)).output +lemma CA5_5_6I2R9Terms_sound (a : PairSlot) : + (CA5_5_6I2R9Terms a).Encloses (Foundation.entropyTerm (CA5_5_6I2R9Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA5_5_6I2R9Certificates_valid + (CA5_5_6I2R9CertificateIndex a) (CA5_5_6I2R9P_sound a) +def CA5_5_6I2R9Entropy : Ball := ⟨0, 0⟩ +lemma CA5_5_6I2R9Entropy_sound : CA5_5_6I2R9Entropy.Encloses (Foundation.finiteEntropy CA5_5_6I2R9Value) := by + exact contains_sound (entropyPair_enclosed CA5_5_6I2R9Value CA5_5_6I2R9Terms CA5_5_6I2R9Terms_sound) (by decide +kernel) +def CA5_5_6I2R9Mass : Ball := ⟨0, 0⟩ +lemma CA5_5_6I2R9Mass_sound : CA5_5_6I2R9Mass.Encloses (∑ a, CA5_5_6I2R9Value a) := by + exact contains_sound (pairSumBall_sound CA5_5_6I2R9P CA5_5_6I2R9Value CA5_5_6I2R9P_sound) (by decide +kernel) +def CA5_5_6I2R9MassTerm : Ball := .exact 0 +lemma CA5_5_6I2R9MassTerm_sound : CA5_5_6I2R9MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA5_5_6I2R9Value a))) := + entropyTerm_zero_ball (CA5_5_6I2R9Mass_sound) +def CA5_5_6I2R9H : Ball := ⟨0, 0⟩ +lemma CA5_5_6I2R9H_sound : CA5_5_6I2R9H.Encloses (homogeneousEntropy CA5_5_6I2R9Value) := by + exact contains_sound (homogeneous_enclosed CA5_5_6I2R9Value CA5_5_6I2R9MassTerm_sound CA5_5_6I2R9Entropy_sound) (by decide +kernel) +def CA5_5_6I2R10Value (a : PairSlot) : ℝ := residualLaw (below (shape 5 5 6)) (fun u => (stageALaw (shape 5 5 6) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 10 a +def CA5_5_6I2R10Raw (a : PairSlot) : Ball := residualBall (below (shape 5 5 6)) A5_5_6Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 10 a +lemma CA5_5_6I2R10Raw_sound (a : PairSlot) : + (CA5_5_6I2R10Raw a).Encloses (CA5_5_6I2R10Value a) := by + exact residualBall_sound_on (below (shape 5 5 6)) A5_5_6Law (fun u => (stageALaw (shape 5 5 6) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A5_5_6Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 5 5 6) (show (shape 5 5 6) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 10 a +def CA5_5_6I2R10Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA5_5_6I2R10Certificates_valid : + CA5_5_6I2R10Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA5_5_6I2R10CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA5_5_6I2R10P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA5_5_6I2R10Certificates (CA5_5_6I2R10CertificateIndex a)).input +lemma CA5_5_6I2R10P_check : ∀ a : PairSlot, contains (CA5_5_6I2R10Raw a) (CA5_5_6I2R10P a) = true := by + decide +kernel +lemma CA5_5_6I2R10P_sound (a : PairSlot) : + (CA5_5_6I2R10P a).Encloses (CA5_5_6I2R10Value a) := + contains_sound (CA5_5_6I2R10Raw_sound a) (CA5_5_6I2R10P_check a) +def CA5_5_6I2R10Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA5_5_6I2R10Certificates (CA5_5_6I2R10CertificateIndex a)).output +lemma CA5_5_6I2R10Terms_sound (a : PairSlot) : + (CA5_5_6I2R10Terms a).Encloses (Foundation.entropyTerm (CA5_5_6I2R10Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA5_5_6I2R10Certificates_valid + (CA5_5_6I2R10CertificateIndex a) (CA5_5_6I2R10P_sound a) +def CA5_5_6I2R10Entropy : Ball := ⟨0, 0⟩ +lemma CA5_5_6I2R10Entropy_sound : CA5_5_6I2R10Entropy.Encloses (Foundation.finiteEntropy CA5_5_6I2R10Value) := by + exact contains_sound (entropyPair_enclosed CA5_5_6I2R10Value CA5_5_6I2R10Terms CA5_5_6I2R10Terms_sound) (by decide +kernel) +def CA5_5_6I2R10Mass : Ball := ⟨0, 0⟩ +lemma CA5_5_6I2R10Mass_sound : CA5_5_6I2R10Mass.Encloses (∑ a, CA5_5_6I2R10Value a) := by + exact contains_sound (pairSumBall_sound CA5_5_6I2R10P CA5_5_6I2R10Value CA5_5_6I2R10P_sound) (by decide +kernel) +def CA5_5_6I2R10MassTerm : Ball := .exact 0 +lemma CA5_5_6I2R10MassTerm_sound : CA5_5_6I2R10MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA5_5_6I2R10Value a))) := + entropyTerm_zero_ball (CA5_5_6I2R10Mass_sound) +def CA5_5_6I2R10H : Ball := ⟨0, 0⟩ +lemma CA5_5_6I2R10H_sound : CA5_5_6I2R10H.Encloses (homogeneousEntropy CA5_5_6I2R10Value) := by + exact contains_sound (homogeneous_enclosed CA5_5_6I2R10Value CA5_5_6I2R10MassTerm_sound CA5_5_6I2R10Entropy_sound) (by decide +kernel) +def CA5_5_6I2R11Value (a : PairSlot) : ℝ := residualLaw (below (shape 5 5 6)) (fun u => (stageALaw (shape 5 5 6) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 11 a +def CA5_5_6I2R11Raw (a : PairSlot) : Ball := residualBall (below (shape 5 5 6)) A5_5_6Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 11 a +lemma CA5_5_6I2R11Raw_sound (a : PairSlot) : + (CA5_5_6I2R11Raw a).Encloses (CA5_5_6I2R11Value a) := by + exact residualBall_sound_on (below (shape 5 5 6)) A5_5_6Law (fun u => (stageALaw (shape 5 5 6) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A5_5_6Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 5 5 6) (show (shape 5 5 6) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 11 a +def CA5_5_6I2R11Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA5_5_6I2R11Certificates_valid : + CA5_5_6I2R11Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA5_5_6I2R11CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA5_5_6I2R11P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA5_5_6I2R11Certificates (CA5_5_6I2R11CertificateIndex a)).input +lemma CA5_5_6I2R11P_check : ∀ a : PairSlot, contains (CA5_5_6I2R11Raw a) (CA5_5_6I2R11P a) = true := by + decide +kernel +lemma CA5_5_6I2R11P_sound (a : PairSlot) : + (CA5_5_6I2R11P a).Encloses (CA5_5_6I2R11Value a) := + contains_sound (CA5_5_6I2R11Raw_sound a) (CA5_5_6I2R11P_check a) +def CA5_5_6I2R11Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA5_5_6I2R11Certificates (CA5_5_6I2R11CertificateIndex a)).output +lemma CA5_5_6I2R11Terms_sound (a : PairSlot) : + (CA5_5_6I2R11Terms a).Encloses (Foundation.entropyTerm (CA5_5_6I2R11Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA5_5_6I2R11Certificates_valid + (CA5_5_6I2R11CertificateIndex a) (CA5_5_6I2R11P_sound a) +def CA5_5_6I2R11Entropy : Ball := ⟨0, 0⟩ +lemma CA5_5_6I2R11Entropy_sound : CA5_5_6I2R11Entropy.Encloses (Foundation.finiteEntropy CA5_5_6I2R11Value) := by + exact contains_sound (entropyPair_enclosed CA5_5_6I2R11Value CA5_5_6I2R11Terms CA5_5_6I2R11Terms_sound) (by decide +kernel) +def CA5_5_6I2R11Mass : Ball := ⟨0, 0⟩ +lemma CA5_5_6I2R11Mass_sound : CA5_5_6I2R11Mass.Encloses (∑ a, CA5_5_6I2R11Value a) := by + exact contains_sound (pairSumBall_sound CA5_5_6I2R11P CA5_5_6I2R11Value CA5_5_6I2R11P_sound) (by decide +kernel) +def CA5_5_6I2R11MassTerm : Ball := .exact 0 +lemma CA5_5_6I2R11MassTerm_sound : CA5_5_6I2R11MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA5_5_6I2R11Value a))) := + entropyTerm_zero_ball (CA5_5_6I2R11Mass_sound) +def CA5_5_6I2R11H : Ball := ⟨0, 0⟩ +lemma CA5_5_6I2R11H_sound : CA5_5_6I2R11H.Encloses (homogeneousEntropy CA5_5_6I2R11Value) := by + exact contains_sound (homogeneous_enclosed CA5_5_6I2R11Value CA5_5_6I2R11MassTerm_sound CA5_5_6I2R11Entropy_sound) (by decide +kernel) +def CA5_5_6I2R12Value (a : PairSlot) : ℝ := residualLaw (below (shape 5 5 6)) (fun u => (stageALaw (shape 5 5 6) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 12 a +def CA5_5_6I2R12Raw (a : PairSlot) : Ball := residualBall (below (shape 5 5 6)) A5_5_6Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 12 a +lemma CA5_5_6I2R12Raw_sound (a : PairSlot) : + (CA5_5_6I2R12Raw a).Encloses (CA5_5_6I2R12Value a) := by + exact residualBall_sound_on (below (shape 5 5 6)) A5_5_6Law (fun u => (stageALaw (shape 5 5 6) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A5_5_6Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 5 5 6) (show (shape 5 5 6) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 12 a +def CA5_5_6I2R12Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA5_5_6I2R12Certificates_valid : + CA5_5_6I2R12Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA5_5_6I2R12CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA5_5_6I2R12P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA5_5_6I2R12Certificates (CA5_5_6I2R12CertificateIndex a)).input +lemma CA5_5_6I2R12P_check : ∀ a : PairSlot, contains (CA5_5_6I2R12Raw a) (CA5_5_6I2R12P a) = true := by + decide +kernel +lemma CA5_5_6I2R12P_sound (a : PairSlot) : + (CA5_5_6I2R12P a).Encloses (CA5_5_6I2R12Value a) := + contains_sound (CA5_5_6I2R12Raw_sound a) (CA5_5_6I2R12P_check a) +def CA5_5_6I2R12Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA5_5_6I2R12Certificates (CA5_5_6I2R12CertificateIndex a)).output +lemma CA5_5_6I2R12Terms_sound (a : PairSlot) : + (CA5_5_6I2R12Terms a).Encloses (Foundation.entropyTerm (CA5_5_6I2R12Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA5_5_6I2R12Certificates_valid + (CA5_5_6I2R12CertificateIndex a) (CA5_5_6I2R12P_sound a) +def CA5_5_6I2R12Entropy : Ball := ⟨0, 0⟩ +lemma CA5_5_6I2R12Entropy_sound : CA5_5_6I2R12Entropy.Encloses (Foundation.finiteEntropy CA5_5_6I2R12Value) := by + exact contains_sound (entropyPair_enclosed CA5_5_6I2R12Value CA5_5_6I2R12Terms CA5_5_6I2R12Terms_sound) (by decide +kernel) +def CA5_5_6I2R12Mass : Ball := ⟨0, 0⟩ +lemma CA5_5_6I2R12Mass_sound : CA5_5_6I2R12Mass.Encloses (∑ a, CA5_5_6I2R12Value a) := by + exact contains_sound (pairSumBall_sound CA5_5_6I2R12P CA5_5_6I2R12Value CA5_5_6I2R12P_sound) (by decide +kernel) +def CA5_5_6I2R12MassTerm : Ball := .exact 0 +lemma CA5_5_6I2R12MassTerm_sound : CA5_5_6I2R12MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA5_5_6I2R12Value a))) := + entropyTerm_zero_ball (CA5_5_6I2R12Mass_sound) +def CA5_5_6I2R12H : Ball := ⟨0, 0⟩ +lemma CA5_5_6I2R12H_sound : CA5_5_6I2R12H.Encloses (homogeneousEntropy CA5_5_6I2R12Value) := by + exact contains_sound (homogeneous_enclosed CA5_5_6I2R12Value CA5_5_6I2R12MassTerm_sound CA5_5_6I2R12Entropy_sound) (by decide +kernel) +def CA5_5_6I2R13Value (a : PairSlot) : ℝ := residualLaw (below (shape 5 5 6)) (fun u => (stageALaw (shape 5 5 6) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 13 a +def CA5_5_6I2R13Raw (a : PairSlot) : Ball := residualBall (below (shape 5 5 6)) A5_5_6Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 13 a +lemma CA5_5_6I2R13Raw_sound (a : PairSlot) : + (CA5_5_6I2R13Raw a).Encloses (CA5_5_6I2R13Value a) := by + exact residualBall_sound_on (below (shape 5 5 6)) A5_5_6Law (fun u => (stageALaw (shape 5 5 6) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A5_5_6Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 5 5 6) (show (shape 5 5 6) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 13 a +def CA5_5_6I2R13Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA5_5_6I2R13Certificates_valid : + CA5_5_6I2R13Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA5_5_6I2R13CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA5_5_6I2R13P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA5_5_6I2R13Certificates (CA5_5_6I2R13CertificateIndex a)).input +lemma CA5_5_6I2R13P_check : ∀ a : PairSlot, contains (CA5_5_6I2R13Raw a) (CA5_5_6I2R13P a) = true := by + decide +kernel +lemma CA5_5_6I2R13P_sound (a : PairSlot) : + (CA5_5_6I2R13P a).Encloses (CA5_5_6I2R13Value a) := + contains_sound (CA5_5_6I2R13Raw_sound a) (CA5_5_6I2R13P_check a) +def CA5_5_6I2R13Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA5_5_6I2R13Certificates (CA5_5_6I2R13CertificateIndex a)).output +lemma CA5_5_6I2R13Terms_sound (a : PairSlot) : + (CA5_5_6I2R13Terms a).Encloses (Foundation.entropyTerm (CA5_5_6I2R13Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA5_5_6I2R13Certificates_valid + (CA5_5_6I2R13CertificateIndex a) (CA5_5_6I2R13P_sound a) +def CA5_5_6I2R13Entropy : Ball := ⟨0, 0⟩ +lemma CA5_5_6I2R13Entropy_sound : CA5_5_6I2R13Entropy.Encloses (Foundation.finiteEntropy CA5_5_6I2R13Value) := by + exact contains_sound (entropyPair_enclosed CA5_5_6I2R13Value CA5_5_6I2R13Terms CA5_5_6I2R13Terms_sound) (by decide +kernel) +def CA5_5_6I2R13Mass : Ball := ⟨0, 0⟩ +lemma CA5_5_6I2R13Mass_sound : CA5_5_6I2R13Mass.Encloses (∑ a, CA5_5_6I2R13Value a) := by + exact contains_sound (pairSumBall_sound CA5_5_6I2R13P CA5_5_6I2R13Value CA5_5_6I2R13P_sound) (by decide +kernel) +def CA5_5_6I2R13MassTerm : Ball := .exact 0 +lemma CA5_5_6I2R13MassTerm_sound : CA5_5_6I2R13MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA5_5_6I2R13Value a))) := + entropyTerm_zero_ball (CA5_5_6I2R13Mass_sound) +def CA5_5_6I2R13H : Ball := ⟨0, 0⟩ +lemma CA5_5_6I2R13H_sound : CA5_5_6I2R13H.Encloses (homogeneousEntropy CA5_5_6I2R13Value) := by + exact contains_sound (homogeneous_enclosed CA5_5_6I2R13Value CA5_5_6I2R13MassTerm_sound CA5_5_6I2R13Entropy_sound) (by decide +kernel) +def CA5_5_6I2R14Value (a : PairSlot) : ℝ := residualLaw (below (shape 5 5 6)) (fun u => (stageALaw (shape 5 5 6) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 14 a +def CA5_5_6I2R14Raw (a : PairSlot) : Ball := residualBall (below (shape 5 5 6)) A5_5_6Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 14 a +lemma CA5_5_6I2R14Raw_sound (a : PairSlot) : + (CA5_5_6I2R14Raw a).Encloses (CA5_5_6I2R14Value a) := by + exact residualBall_sound_on (below (shape 5 5 6)) A5_5_6Law (fun u => (stageALaw (shape 5 5 6) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A5_5_6Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 5 5 6) (show (shape 5 5 6) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 14 a +def CA5_5_6I2R14Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA5_5_6I2R14Certificates_valid : + CA5_5_6I2R14Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA5_5_6I2R14CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA5_5_6I2R14P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA5_5_6I2R14Certificates (CA5_5_6I2R14CertificateIndex a)).input +lemma CA5_5_6I2R14P_check : ∀ a : PairSlot, contains (CA5_5_6I2R14Raw a) (CA5_5_6I2R14P a) = true := by + decide +kernel +lemma CA5_5_6I2R14P_sound (a : PairSlot) : + (CA5_5_6I2R14P a).Encloses (CA5_5_6I2R14Value a) := + contains_sound (CA5_5_6I2R14Raw_sound a) (CA5_5_6I2R14P_check a) +def CA5_5_6I2R14Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA5_5_6I2R14Certificates (CA5_5_6I2R14CertificateIndex a)).output +lemma CA5_5_6I2R14Terms_sound (a : PairSlot) : + (CA5_5_6I2R14Terms a).Encloses (Foundation.entropyTerm (CA5_5_6I2R14Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA5_5_6I2R14Certificates_valid + (CA5_5_6I2R14CertificateIndex a) (CA5_5_6I2R14P_sound a) +def CA5_5_6I2R14Entropy : Ball := ⟨0, 0⟩ +lemma CA5_5_6I2R14Entropy_sound : CA5_5_6I2R14Entropy.Encloses (Foundation.finiteEntropy CA5_5_6I2R14Value) := by + exact contains_sound (entropyPair_enclosed CA5_5_6I2R14Value CA5_5_6I2R14Terms CA5_5_6I2R14Terms_sound) (by decide +kernel) +def CA5_5_6I2R14Mass : Ball := ⟨0, 0⟩ +lemma CA5_5_6I2R14Mass_sound : CA5_5_6I2R14Mass.Encloses (∑ a, CA5_5_6I2R14Value a) := by + exact contains_sound (pairSumBall_sound CA5_5_6I2R14P CA5_5_6I2R14Value CA5_5_6I2R14P_sound) (by decide +kernel) +def CA5_5_6I2R14MassTerm : Ball := .exact 0 +lemma CA5_5_6I2R14MassTerm_sound : CA5_5_6I2R14MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA5_5_6I2R14Value a))) := + entropyTerm_zero_ball (CA5_5_6I2R14Mass_sound) +def CA5_5_6I2R14H : Ball := ⟨0, 0⟩ +lemma CA5_5_6I2R14H_sound : CA5_5_6I2R14H.Encloses (homogeneousEntropy CA5_5_6I2R14Value) := by + exact contains_sound (homogeneous_enclosed CA5_5_6I2R14Value CA5_5_6I2R14MassTerm_sound CA5_5_6I2R14Entropy_sound) (by decide +kernel) +def CA5_5_6I2R15Value (a : PairSlot) : ℝ := residualLaw (below (shape 5 5 6)) (fun u => (stageALaw (shape 5 5 6) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 15 a +def CA5_5_6I2R15Raw (a : PairSlot) : Ball := residualBall (below (shape 5 5 6)) A5_5_6Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 15 a +lemma CA5_5_6I2R15Raw_sound (a : PairSlot) : + (CA5_5_6I2R15Raw a).Encloses (CA5_5_6I2R15Value a) := by + exact residualBall_sound_on (below (shape 5 5 6)) A5_5_6Law (fun u => (stageALaw (shape 5 5 6) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A5_5_6Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 5 5 6) (show (shape 5 5 6) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 15 a +def CA5_5_6I2R15Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA5_5_6I2R15Certificates_valid : + CA5_5_6I2R15Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA5_5_6I2R15CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA5_5_6I2R15P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA5_5_6I2R15Certificates (CA5_5_6I2R15CertificateIndex a)).input +lemma CA5_5_6I2R15P_check : ∀ a : PairSlot, contains (CA5_5_6I2R15Raw a) (CA5_5_6I2R15P a) = true := by + decide +kernel +lemma CA5_5_6I2R15P_sound (a : PairSlot) : + (CA5_5_6I2R15P a).Encloses (CA5_5_6I2R15Value a) := + contains_sound (CA5_5_6I2R15Raw_sound a) (CA5_5_6I2R15P_check a) +def CA5_5_6I2R15Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA5_5_6I2R15Certificates (CA5_5_6I2R15CertificateIndex a)).output +lemma CA5_5_6I2R15Terms_sound (a : PairSlot) : + (CA5_5_6I2R15Terms a).Encloses (Foundation.entropyTerm (CA5_5_6I2R15Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA5_5_6I2R15Certificates_valid + (CA5_5_6I2R15CertificateIndex a) (CA5_5_6I2R15P_sound a) +def CA5_5_6I2R15Entropy : Ball := ⟨0, 0⟩ +lemma CA5_5_6I2R15Entropy_sound : CA5_5_6I2R15Entropy.Encloses (Foundation.finiteEntropy CA5_5_6I2R15Value) := by + exact contains_sound (entropyPair_enclosed CA5_5_6I2R15Value CA5_5_6I2R15Terms CA5_5_6I2R15Terms_sound) (by decide +kernel) +def CA5_5_6I2R15Mass : Ball := ⟨0, 0⟩ +lemma CA5_5_6I2R15Mass_sound : CA5_5_6I2R15Mass.Encloses (∑ a, CA5_5_6I2R15Value a) := by + exact contains_sound (pairSumBall_sound CA5_5_6I2R15P CA5_5_6I2R15Value CA5_5_6I2R15P_sound) (by decide +kernel) +def CA5_5_6I2R15MassTerm : Ball := .exact 0 +lemma CA5_5_6I2R15MassTerm_sound : CA5_5_6I2R15MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA5_5_6I2R15Value a))) := + entropyTerm_zero_ball (CA5_5_6I2R15Mass_sound) +def CA5_5_6I2R15H : Ball := ⟨0, 0⟩ +lemma CA5_5_6I2R15H_sound : CA5_5_6I2R15H.Encloses (homogeneousEntropy CA5_5_6I2R15Value) := by + exact contains_sound (homogeneous_enclosed CA5_5_6I2R15Value CA5_5_6I2R15MassTerm_sound CA5_5_6I2R15Entropy_sound) (by decide +kernel) +def CA5_5_6I2R16Value (a : PairSlot) : ℝ := residualLaw (below (shape 5 5 6)) (fun u => (stageALaw (shape 5 5 6) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) 16 a +def CA5_5_6I2R16Raw (a : PairSlot) : Ball := residualBall (below (shape 5 5 6)) A5_5_6Law (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) 16 a +lemma CA5_5_6I2R16Raw_sound (a : PairSlot) : + (CA5_5_6I2R16Raw a).Encloses (CA5_5_6I2R16Value a) := by + exact residualBall_sound_on (below (shape 5 5 6)) A5_5_6Law (fun u => (stageALaw (shape 5 5 6) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u => halfTable u ((Equiv.refl (Fin 3)) 2)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A5_5_6Law_sound u) (fun u hu a => halfTable_sound u (stageA_children_size (shape 5 5 6) (show (shape 5 5 6) ∈ positiveInitial by decide +kernel) u hu) ((Equiv.refl (Fin 3)) 2) a) 16 a +def CA5_5_6I2R16Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CA5_5_6I2R16Certificates_valid : + CA5_5_6I2R16Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA5_5_6I2R16CertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | _, _ => 0 +def CA5_5_6I2R16P (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA5_5_6I2R16Certificates (CA5_5_6I2R16CertificateIndex a)).input +lemma CA5_5_6I2R16P_check : ∀ a : PairSlot, contains (CA5_5_6I2R16Raw a) (CA5_5_6I2R16P a) = true := by + decide +kernel +lemma CA5_5_6I2R16P_sound (a : PairSlot) : + (CA5_5_6I2R16P a).Encloses (CA5_5_6I2R16Value a) := + contains_sound (CA5_5_6I2R16Raw_sound a) (CA5_5_6I2R16P_check a) +def CA5_5_6I2R16Terms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CA5_5_6I2R16Certificates (CA5_5_6I2R16CertificateIndex a)).output +lemma CA5_5_6I2R16Terms_sound (a : PairSlot) : + (CA5_5_6I2R16Terms a).Encloses (Foundation.entropyTerm (CA5_5_6I2R16Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA5_5_6I2R16Certificates_valid + (CA5_5_6I2R16CertificateIndex a) (CA5_5_6I2R16P_sound a) +def CA5_5_6I2R16Entropy : Ball := ⟨0, 0⟩ +lemma CA5_5_6I2R16Entropy_sound : CA5_5_6I2R16Entropy.Encloses (Foundation.finiteEntropy CA5_5_6I2R16Value) := by + exact contains_sound (entropyPair_enclosed CA5_5_6I2R16Value CA5_5_6I2R16Terms CA5_5_6I2R16Terms_sound) (by decide +kernel) +def CA5_5_6I2R16Mass : Ball := ⟨0, 0⟩ +lemma CA5_5_6I2R16Mass_sound : CA5_5_6I2R16Mass.Encloses (∑ a, CA5_5_6I2R16Value a) := by + exact contains_sound (pairSumBall_sound CA5_5_6I2R16P CA5_5_6I2R16Value CA5_5_6I2R16P_sound) (by decide +kernel) +def CA5_5_6I2R16MassTerm : Ball := .exact 0 +lemma CA5_5_6I2R16MassTerm_sound : CA5_5_6I2R16MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA5_5_6I2R16Value a))) := + entropyTerm_zero_ball (CA5_5_6I2R16Mass_sound) +def CA5_5_6I2R16H : Ball := ⟨0, 0⟩ +lemma CA5_5_6I2R16H_sound : CA5_5_6I2R16H.Encloses (homogeneousEntropy CA5_5_6I2R16Value) := by + exact contains_sound (homogeneous_enclosed CA5_5_6I2R16Value CA5_5_6I2R16MassTerm_sound CA5_5_6I2R16Entropy_sound) (by decide +kernel) +def CA5_5_6I2ResidualEntropies (a : Fin 17) : Ball := + match a.val with + | 0 => CA5_5_6I2R0H + | 1 => CA5_5_6I2R1H + | 2 => CA5_5_6I2R2H + | 3 => CA5_5_6I2R3H + | 4 => CA5_5_6I2R4H + | 5 => CA5_5_6I2R5H + | 6 => CA5_5_6I2R6H + | 7 => CA5_5_6I2R7H + | 8 => CA5_5_6I2R8H + | 9 => CA5_5_6I2R9H + | 10 => CA5_5_6I2R10H + | 11 => CA5_5_6I2R11H + | 12 => CA5_5_6I2R12H + | 13 => CA5_5_6I2R13H + | 14 => CA5_5_6I2R14H + | 15 => CA5_5_6I2R15H + | 16 => CA5_5_6I2R16H + | _ => (.exact 0) +lemma CA5_5_6I2ResidualEntropies_sound (k : Fin 17) : + (CA5_5_6I2ResidualEntropies k).Encloses (homogeneousEntropy + (residualLaw (below (shape 5 5 6)) (fun u => (stageALaw (shape 5 5 6) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) k)) := by + fin_cases k + · exact CA5_5_6I2R0H_sound + · exact CA5_5_6I2R1H_sound + · exact CA5_5_6I2R2H_sound + · exact CA5_5_6I2R3H_sound + · exact CA5_5_6I2R4H_sound + · exact CA5_5_6I2R5H_sound + · exact CA5_5_6I2R6H_sound + · exact CA5_5_6I2R7H_sound + · exact CA5_5_6I2R8H_sound + · exact CA5_5_6I2R9H_sound + · exact CA5_5_6I2R10H_sound + · exact CA5_5_6I2R11H_sound + · exact CA5_5_6I2R12H_sound + · exact CA5_5_6I2R13H_sound + · exact CA5_5_6I2R14H_sound + · exact CA5_5_6I2R15H_sound + · exact CA5_5_6I2R16H_sound +def CA5_5_6I2Singles (s : Shape) : Ball := + match s 0, s 1, s 2 with + | 0, 2, 6 => Z0_2_6H2H + | 0, 3, 5 => Z0_3_5H2H + | 0, 4, 4 => Z0_4_4H2H + | 0, 5, 3 => Z0_5_3H2H + | 2, 0, 6 => Z2_0_6H2H + | 3, 0, 5 => Z3_0_5H2H + | 4, 0, 4 => Z4_0_4H2H + | 5, 0, 3 => Z5_0_3H2H + | _, _, _ => (.exact 0) +lemma CA5_5_6I2Singles_sound (u : Shape) (hu : u ∈ below (shape 5 5 6)) + (hd : designated (Equiv.refl (Fin 3)) 2 u) : + (CA5_5_6I2Singles u).Encloses (homogeneousEntropy ((fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) u)) := by + rw [A5_5_6_below] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl + · exact Z0_2_6H2H_sound + · exact Z0_3_5H2H_sound + · exact Z0_4_4H2H_sound + · exact Z0_5_3H2H_sound + · exact (show ¬ designated (Equiv.refl (Fin 3)) 2 (shape 1 1 6) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 2 (shape 1 2 5) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 2 (shape 1 3 4) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 2 (shape 1 4 3) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 2 (shape 1 5 2) by decide +kernel) hd |>.elim + · exact Z2_0_6H2H_sound + · exact (show ¬ designated (Equiv.refl (Fin 3)) 2 (shape 2 1 5) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 2 (shape 2 2 4) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 2 (shape 2 3 3) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 2 (shape 2 4 2) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 2 (shape 2 5 1) by decide +kernel) hd |>.elim + · exact Z3_0_5H2H_sound + · exact (show ¬ designated (Equiv.refl (Fin 3)) 2 (shape 3 1 4) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 2 (shape 3 2 3) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 2 (shape 3 3 2) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 2 (shape 3 4 1) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 2 (shape 3 5 0) by decide +kernel) hd |>.elim + · exact Z4_0_4H2H_sound + · exact (show ¬ designated (Equiv.refl (Fin 3)) 2 (shape 4 1 3) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 2 (shape 4 2 2) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 2 (shape 4 3 1) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 2 (shape 4 4 0) by decide +kernel) hd |>.elim + · exact Z5_0_3H2H_sound + · exact (show ¬ designated (Equiv.refl (Fin 3)) 2 (shape 5 1 2) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 2 (shape 5 2 1) by decide +kernel) hd |>.elim + · exact (show ¬ designated (Equiv.refl (Fin 3)) 2 (shape 5 3 0) by decide +kernel) hd |>.elim +def CA5_5_6I2Singleton : Ball := ⟨(67303983500677611484406205059 / 10000000000000000000000000000000), (8071347 / 1562500000000000000000000000000)⟩ +lemma CA5_5_6I2Singleton_sound : CA5_5_6I2Singleton.Encloses + (singletonEntropy (below (shape 5 5 6)) (fun u => (stageALaw (shape 5 5 6) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ))) := by + exact contains_sound (singletonBall_sound (below (shape 5 5 6)) A5_5_6Law (fun u => (stageALaw (shape 5 5 6) u : ℝ)) (Equiv.refl (Fin 3)) 2 + CA5_5_6I2Singles (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) (fun u _ => A5_5_6Law_sound u) CA5_5_6I2Singles_sound) (by decide +kernel) +def CA5_5_6I2Group : Ball := ⟨(96051098143690551605291162488069 / 100000000000000000000000000000000), (81727436747 / 50000000000000000000000000000000)⟩ +lemma CA5_5_6I2Group_sound : CA5_5_6I2Group.Encloses + (groupedEntropy (below (shape 5 5 6)) (fun u => (stageALaw (shape 5 5 6) u : ℝ)) (Equiv.refl (Fin 3)) 2 (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ))) := by + exact contains_sound (Ball.add_sound CA5_5_6I2Singleton_sound + (finSumBall_sound 17 CA5_5_6I2ResidualEntropies _ CA5_5_6I2ResidualEntropies_sound)) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CA5_5_6I2H : Ball := ⟨(56863282770715546115407429474149 / 50000000000000000000000000000000), (500468822189 / 100000000000000000000000000000000)⟩ +lemma CA5_5_6I2_sound : CA5_5_6I2H.Encloses (stageACapacity (shape 5 5 6) 2) := by + have hb := contains_sound (Ball.add_sound CA5_5_6I2PairH_sound + (Ball.neg_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) CA5_5_6I2Group_sound))) + (show contains (.add CA5_5_6I2PairH (.neg (.mul (.exact 2) CA5_5_6I2Group))) CA5_5_6I2H = true by decide +kernel) + unfold CA5_5_6I2PairValue at hb + simpa only [stageACapacity, nativeCapacity, + show (2 : Fin 3) ≠ 0 by decide, ite_false, sub_eq_add_neg] using hb + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA5_5_6I2Pair.lean b/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA5_5_6I2Pair.lean new file mode 100644 index 0000000000000000000000000000000000000000..374876b793f9c9b8ea9f7205bcb1d679cc264faf --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/CapacityA/CapA5_5_6I2Pair.lean @@ -0,0 +1,324 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Certificates.SupportedContraction + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CA5_5_6I2PairValue (a : PairSlot × PairSlot) : ℝ := pairLaw (below (shape 5 5 6)) (shape 5 5 6) (fun u => (stageALaw (shape 5 5 6) u : ℝ)) (fun u a => (halfLaw u ((Equiv.refl (Fin 3)) 2) a : ℝ)) a +def CA5_5_6I2PairRaw (a : PairSlot × PairSlot) : Ball := stageAPairBall (shape 5 5 6) A5_5_6Law 2 a +lemma CA5_5_6I2PairRaw_sound (a : PairSlot × PairSlot) : + (CA5_5_6I2PairRaw a).Encloses (CA5_5_6I2PairValue a) := by + exact stageAPairBall_sound (shape 5 5 6) (by decide +kernel) A5_5_6Law (fun u => (stageALaw (shape 5 5 6) u : ℝ)) (fun u _ => A5_5_6Law_sound u) 2 a +def CA5_5_6I2PairCertificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(1187765125736794018289552209 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(1683783558142653602993899619 / 12500000000000000000000000000000), (1131839 / 25000000000000000000000000000000)⟩ ⟨(-567042598459243233410666927459989 / 50000000000000000000000000000000), (76232982097 / 20000000000000000000000000000000)⟩ ⟨-17, 1187765125736794018289552209, 762939453125000000000000000⟩, + .log ⟨(88907255612828524640567157 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(1238752526435290889864423581 / 100000000000000000000000000000000), (207103 / 50000000000000000000000000000000)⟩ ⟨(-1393308698932047498835134668979081 / 100000000000000000000000000000000), (465869245793 / 100000000000000000000000000000000)⟩ ⟨-21, 88907255612828524640567157, 47683715820312500000000000⟩, + .log ⟨(13022030768091476550039235491 / 100000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ ⟨(23299754151816037722625650577 / 20000000000000000000000000000000), (38605343 / 100000000000000000000000000000000)⟩ ⟨(-111828535842257861651008074177151 / 12500000000000000000000000000000), (296461554599 / 100000000000000000000000000000000)⟩ ⟨-13, 13022030768091476550039235491, 12207031250000000000000000000⟩, + .log ⟨(2488700357135955674723460131 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(6595780678153238523467056851 / 25000000000000000000000000000000), (447953 / 5000000000000000000000000000000)⟩ ⟨(-1060116483567959948493662232680153 / 100000000000000000000000000000000), (44998630349 / 12500000000000000000000000000000)⟩ ⟨-16, 2488700357135955674723460131, 1525878906250000000000000000⟩, + .log ⟨(321409582972087700142486306757 / 100000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ ⟨(922479121892494698252730151589 / 50000000000000000000000000000000), (680611287 / 100000000000000000000000000000000)⟩ ⟨(-143505229894250837942707747564011 / 25000000000000000000000000000000), (211758237763 / 100000000000000000000000000000000)⟩ ⟨-9, 321409582972087700142486306757, 195312500000000000000000000000⟩, + .log ⟨(173268638378427937757758447 / 1250000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(7696429087951494475862065999 / 6250000000000000000000000000000), (41093999 / 100000000000000000000000000000000)⟩ ⟨(-888381089616700662416489317261767 / 100000000000000000000000000000000), (11858461551 / 4000000000000000000000000000000)⟩ ⟨-13, 173268638378427937757758447, 152587890625000000000000000⟩, + .log ⟨(247932920045118231973081667 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(571298347891424530581160413 / 5000000000000000000000000000000), (1890073 / 50000000000000000000000000000000)⟩ ⟨(-230424563138876854941732595490259 / 20000000000000000000000000000000), (381164927127 / 100000000000000000000000000000000)⟩ ⟨-17, 247932920045118231973081667, 190734863281250000000000000⟩, + .log ⟨(76475383411711594687098983 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(269264315713122984982530269 / 25000000000000000000000000000000), (35629 / 10000000000000000000000000000000)⟩ ⟨(-1408371184037175046272197234734311 / 100000000000000000000000000000000), (116467357159 / 25000000000000000000000000000000)⟩ ⟨-21, 76475383411711594687098983, 47683715820312500000000000⟩, + .log ⟨(1822773776670546293800538013 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(4656922191556450914094680223 / 12500000000000000000000000000000), (1543951 / 12500000000000000000000000000000)⟩ ⟨(-63871368064976245146741206563103 / 6250000000000000000000000000000), (169406603179 / 50000000000000000000000000000000)⟩ ⟨-15, 1822773776670546293800538013, 1525878906250000000000000000⟩, + .log ⟨(299128849709836838102007292969 / 100000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ ⟨(434638036179659802757143970453 / 25000000000000000000000000000000), (633429999 / 100000000000000000000000000000000)⟩ ⟨(-290602552446058332470453233019053 / 50000000000000000000000000000000), (26469779729 / 12500000000000000000000000000000)⟩ ⟨-9, 299128849709836838102007292969, 195312500000000000000000000000⟩, + .log ⟨(21448708559528073230082505801 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(90591419962459940726045608149 / 50000000000000000000000000000000), (3179359 / 5000000000000000000000000000000)⟩ ⟨(-422363051421186288112549083352977 / 50000000000000000000000000000000), (9264423007 / 3125000000000000000000000000000)⟩ ⟨-13, 21448708559528073230082505801, 12207031250000000000000000000⟩, + .log ⟨(1094322806221152141574166857903 / 100000000000000000000000000000000), (9 / 100000000000000000000000000000000)⟩ ⟨(494090517590090830415503883347 / 10000000000000000000000000000000), (926927497 / 50000000000000000000000000000000)⟩ ⟨(-451503445584081043538508737217649 / 100000000000000000000000000000000), (84703295143 / 50000000000000000000000000000000)⟩ ⟨-7, 1094322806221152141574166857903, 781250000000000000000000000000⟩, + .log ⟨(764478012325403559830358836081 / 25000000000000000000000000000000), (23 / 100000000000000000000000000000000)⟩ ⟨(2132855638273033781740336572597 / 20000000000000000000000000000000), (4532766551 / 100000000000000000000000000000000)⟩ ⟨(-348743783975106342160345637096129 / 100000000000000000000000000000000), (148230766533 / 100000000000000000000000000000000)⟩ ⟨-6, 764478012325403559830358836081, 390625000000000000000000000000⟩, + .log ⟨(108395513688015916956975563429 / 50000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ ⟨(1329794337173496432734191301591 / 100000000000000000000000000000000), (57384109 / 12500000000000000000000000000000)⟩ ⟨(-613399158290310755621078259157243 / 100000000000000000000000000000000), (26469779719 / 12500000000000000000000000000000)⟩ ⟨-9, 108395513688015916956975563429, 97656250000000000000000000000⟩, + .log ⟨(11178738741687075968837676029933 / 100000000000000000000000000000000), (31 / 50000000000000000000000000000000)⟩ ⟨(12247183242611232187509126046757 / 50000000000000000000000000000000), (2958987557 / 25000000000000000000000000000000)⟩ ⟨(-219115653842768104938065343667409 / 100000000000000000000000000000000), (105879118969 / 100000000000000000000000000000000)⟩ ⟨-4, 11178738741687075968837676029933, 6250000000000000000000000000000⟩, + .log ⟨(71264129462032890496350810347 / 50000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ ⟨(467021289645700662481682329451 / 50000000000000000000000000000000), (331996877 / 100000000000000000000000000000000)⟩ ⟨(-81917314708536809374833359350743 / 12500000000000000000000000000000), (58233515479 / 25000000000000000000000000000000)⟩ ⟨-10, 71264129462032890496350810347, 48828125000000000000000000000⟩, + .log ⟨(665187240879226491671582469 / 6250000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(97362375709340753290899066779 / 100000000000000000000000000000000), (33806141 / 100000000000000000000000000000000)⟩ ⟨(-57175146596605383171985797992379 / 6250000000000000000000000000000), (317637364641 / 100000000000000000000000000000000)⟩ ⟨-14, 665187240879226491671582469, 381469726562500000000000000⟩, + .log ⟨(20918979592024280514060004269 / 4000000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ ⟨(2747390408197763298105643116427 / 100000000000000000000000000000000), (249174357 / 25000000000000000000000000000000)⟩ ⟨(-525339277876680557961501128740157 / 100000000000000000000000000000000), (190582413911 / 100000000000000000000000000000000)⟩ ⟨-8, 20918979592024280514060004269, 15625000000000000000000000000⟩, + .log ⟨(3954557954716329061889148617 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(37350441829327336035465334491 / 50000000000000000000000000000000), (12561159 / 50000000000000000000000000000000)⟩ ⟨(-944490945815626120007958617263197 / 100000000000000000000000000000000), (19852335493 / 6250000000000000000000000000000)⟩ ⟨-14, 3954557954716329061889148617, 3051757812500000000000000000⟩, + .log ⟨(430803591031421706292111853 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(332661914321629038838998061 / 6250000000000000000000000000000), (27083 / 1562500000000000000000000000000)⟩ ⟨(-1235502846297733981941114520860687 / 100000000000000000000000000000000), (402340882101 / 100000000000000000000000000000000)⟩ ⟨-18, 430803591031421706292111853, 381469726562500000000000000⟩, + .log ⟨(1421403430361985848645211851 / 5000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(46426154461932689458716118827 / 20000000000000000000000000000000), (3912921 / 5000000000000000000000000000000)⟩ ⟨(-408277423831999595277073638378021 / 50000000000000000000000000000000), (68821427849 / 25000000000000000000000000000000)⟩ ⟨-12, 1421403430361985848645211851, 1220703125000000000000000000⟩, + .log ⟨(8895612986622697409409561631 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(82972649085403835394241706283 / 100000000000000000000000000000000), (28255801 / 100000000000000000000000000000000)⟩ ⟨(-932736723260992235593238920917811 / 100000000000000000000000000000000), (158818683243 / 50000000000000000000000000000000)⟩ ⟨-14, 8895612986622697409409561631, 6103515625000000000000000000⟩, + .log ⟨(156757568645756397599532000707 / 50000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ ⟨(361487832924557811857896749707 / 20000000000000000000000000000000), (165973537 / 25000000000000000000000000000000)⟩ ⟨(-18015868191379734611897302298277 / 3125000000000000000000000000000), (105879118893 / 50000000000000000000000000000000)⟩ ⟨-9, 156757568645756397599532000707, 97656250000000000000000000000⟩, + .log ⟨(982690147333954476358117619 / 6250000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(8606201966640296860094212731 / 6250000000000000000000000000000), (46612783 / 100000000000000000000000000000000)⟩ ⟨(-109472477031404373090278835733323 / 12500000000000000000000000000000), (296461537921 / 100000000000000000000000000000000)⟩ ⟨-13, 982690147333954476358117619, 762939453125000000000000000⟩, + .log ⟨(5529609870094332369868939329201 / 50000000000000000000000000000000), (37 / 100000000000000000000000000000000)⟩ ⟨(12175679714502273113702367603707 / 50000000000000000000000000000000), (2927351121 / 25000000000000000000000000000000)⟩ ⟨(-44038114805717974194057120865921 / 20000000000000000000000000000000), (105879118749 / 100000000000000000000000000000000)⟩ ⟨-4, 5529609870094332369868939329201, 3125000000000000000000000000000⟩, + .log ⟨(27558332552364650662031741331 / 5000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ ⟨(716639039744644849659808911997 / 25000000000000000000000000000000), (1050426723 / 100000000000000000000000000000000)⟩ ⟨(-520088824955523973055103729233329 / 100000000000000000000000000000000), (190582413691 / 100000000000000000000000000000000)⟩ ⟨-8, 27558332552364650662031741331, 19531250000000000000000000000⟩, + .log ⟨(6112892749094803164799270809 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(123680438921742869146344851287 / 50000000000000000000000000000000), (8413961 / 10000000000000000000000000000000)⟩ ⟨(-809308744636865824318504542640653 / 100000000000000000000000000000000), (5505714223 / 2000000000000000000000000000000)⟩ ⟨-12, 6112892749094803164799270809, 4882812500000000000000000000⟩] +lemma CA5_5_6I2PairCertificates_valid : + CA5_5_6I2PairCertificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CA5_5_6I2PairCertificateIndex (a : PairSlot × PairSlot) : ℕ := + match a.1.1.val, a.1.2.val, a.2.1.val, a.2.2.val with + | 2, 5, 0, 0 => 1 + | 3, 5, 0, 0 => 2 + | 4, 4, 0, 0 => 3 + | 5, 2, 0, 0 => 1 + | 5, 3, 0, 0 => 2 + | 1, 5, 1, 0 => 4 + | 1, 5, 0, 1 => 4 + | 2, 4, 1, 0 => 5 + | 2, 4, 0, 1 => 5 + | 3, 4, 1, 0 => 6 + | 3, 4, 0, 1 => 6 + | 4, 2, 1, 0 => 5 + | 4, 2, 0, 1 => 5 + | 4, 3, 1, 0 => 6 + | 4, 3, 0, 1 => 6 + | 5, 1, 1, 0 => 4 + | 5, 1, 0, 1 => 4 + | 5, 0, 2, 0 => 7 + | 5, 0, 3, 0 => 8 + | 5, 0, 1, 1 => 9 + | 5, 0, 0, 2 => 7 + | 5, 0, 0, 3 => 8 + | 4, 1, 2, 0 => 10 + | 4, 1, 3, 0 => 11 + | 4, 1, 1, 1 => 12 + | 4, 1, 0, 2 => 10 + | 4, 1, 0, 3 => 11 + | 2, 2, 2, 0 => 13 + | 2, 2, 3, 0 => 14 + | 2, 2, 1, 1 => 15 + | 2, 2, 0, 2 => 13 + | 2, 2, 0, 3 => 14 + | 2, 3, 2, 0 => 16 + | 2, 3, 3, 0 => 17 + | 2, 3, 1, 1 => 18 + | 2, 3, 0, 2 => 16 + | 2, 3, 0, 3 => 17 + | 3, 2, 2, 0 => 16 + | 3, 2, 3, 0 => 17 + | 3, 2, 1, 1 => 18 + | 3, 2, 0, 2 => 16 + | 3, 2, 0, 3 => 17 + | 3, 3, 2, 0 => 19 + | 3, 3, 3, 0 => 20 + | 3, 3, 1, 1 => 21 + | 3, 3, 0, 2 => 19 + | 3, 3, 0, 3 => 20 + | 1, 4, 2, 0 => 10 + | 1, 4, 3, 0 => 11 + | 1, 4, 1, 1 => 12 + | 1, 4, 0, 2 => 10 + | 1, 4, 0, 3 => 11 + | 0, 5, 2, 0 => 7 + | 0, 5, 3, 0 => 8 + | 0, 5, 1, 1 => 9 + | 0, 5, 0, 2 => 7 + | 0, 5, 0, 3 => 8 + | 4, 0, 4, 0 => 22 + | 4, 0, 2, 1 => 23 + | 4, 0, 3, 1 => 24 + | 4, 0, 1, 2 => 23 + | 4, 0, 1, 3 => 24 + | 4, 0, 0, 4 => 22 + | 2, 1, 4, 0 => 23 + | 2, 1, 2, 1 => 25 + | 2, 1, 3, 1 => 26 + | 2, 1, 1, 2 => 25 + | 2, 1, 1, 3 => 26 + | 2, 1, 0, 4 => 23 + | 3, 1, 4, 0 => 24 + | 3, 1, 2, 1 => 26 + | 3, 1, 3, 1 => 27 + | 3, 1, 1, 2 => 26 + | 3, 1, 1, 3 => 27 + | 3, 1, 0, 4 => 24 + | 1, 2, 4, 0 => 23 + | 1, 2, 2, 1 => 25 + | 1, 2, 3, 1 => 26 + | 1, 2, 1, 2 => 25 + | 1, 2, 1, 3 => 26 + | 1, 2, 0, 4 => 23 + | 1, 3, 4, 0 => 24 + | 1, 3, 2, 1 => 26 + | 1, 3, 3, 1 => 27 + | 1, 3, 1, 2 => 26 + | 1, 3, 1, 3 => 27 + | 1, 3, 0, 4 => 24 + | 0, 4, 4, 0 => 22 + | 0, 4, 2, 1 => 23 + | 0, 4, 3, 1 => 24 + | 0, 4, 1, 2 => 23 + | 0, 4, 1, 3 => 24 + | 0, 4, 0, 4 => 22 + | 2, 0, 5, 0 => 7 + | 2, 0, 4, 1 => 10 + | 2, 0, 2, 2 => 13 + | 2, 0, 2, 3 => 16 + | 2, 0, 3, 2 => 16 + | 2, 0, 3, 3 => 19 + | 2, 0, 1, 4 => 10 + | 2, 0, 0, 5 => 7 + | 3, 0, 5, 0 => 8 + | 3, 0, 4, 1 => 11 + | 3, 0, 2, 2 => 14 + | 3, 0, 2, 3 => 17 + | 3, 0, 3, 2 => 17 + | 3, 0, 3, 3 => 20 + | 3, 0, 1, 4 => 11 + | 3, 0, 0, 5 => 8 + | 1, 1, 5, 0 => 9 + | 1, 1, 4, 1 => 12 + | 1, 1, 2, 2 => 15 + | 1, 1, 2, 3 => 18 + | 1, 1, 3, 2 => 18 + | 1, 1, 3, 3 => 21 + | 1, 1, 1, 4 => 12 + | 1, 1, 0, 5 => 9 + | 0, 2, 5, 0 => 7 + | 0, 2, 4, 1 => 10 + | 0, 2, 2, 2 => 13 + | 0, 2, 2, 3 => 16 + | 0, 2, 3, 2 => 16 + | 0, 2, 3, 3 => 19 + | 0, 2, 1, 4 => 10 + | 0, 2, 0, 5 => 7 + | 0, 3, 5, 0 => 8 + | 0, 3, 4, 1 => 11 + | 0, 3, 2, 2 => 14 + | 0, 3, 2, 3 => 17 + | 0, 3, 3, 2 => 17 + | 0, 3, 3, 3 => 20 + | 0, 3, 1, 4 => 11 + | 0, 3, 0, 5 => 8 + | 1, 0, 1, 5 => 4 + | 1, 0, 2, 4 => 5 + | 1, 0, 3, 4 => 6 + | 1, 0, 4, 2 => 5 + | 1, 0, 4, 3 => 6 + | 1, 0, 5, 1 => 4 + | 0, 1, 1, 5 => 4 + | 0, 1, 2, 4 => 5 + | 0, 1, 3, 4 => 6 + | 0, 1, 4, 2 => 5 + | 0, 1, 4, 3 => 6 + | 0, 1, 5, 1 => 4 + | 0, 0, 2, 5 => 1 + | 0, 0, 3, 5 => 2 + | 0, 0, 4, 4 => 3 + | 0, 0, 5, 2 => 1 + | 0, 0, 5, 3 => 2 + | _, _, _, _ => 0 +def CA5_5_6I2PairP (a : PairSlot × PairSlot) : Ball := + (CompactCertificate.entropyLookup CA5_5_6I2PairCertificates (CA5_5_6I2PairCertificateIndex a)).input +lemma CA5_5_6I2PairP_check_0_0 : ∀ k l : Fin 6, contains (CA5_5_6I2PairRaw ((0,0),(k,l))) (CA5_5_6I2PairP ((0,0),(k,l))) = true := by + decide +kernel +lemma CA5_5_6I2PairP_check_0_1 : ∀ k l : Fin 6, contains (CA5_5_6I2PairRaw ((0,1),(k,l))) (CA5_5_6I2PairP ((0,1),(k,l))) = true := by + decide +kernel +lemma CA5_5_6I2PairP_check_0_2 : ∀ k l : Fin 6, contains (CA5_5_6I2PairRaw ((0,2),(k,l))) (CA5_5_6I2PairP ((0,2),(k,l))) = true := by + decide +kernel +lemma CA5_5_6I2PairP_check_0_3 : ∀ k l : Fin 6, contains (CA5_5_6I2PairRaw ((0,3),(k,l))) (CA5_5_6I2PairP ((0,3),(k,l))) = true := by + decide +kernel +lemma CA5_5_6I2PairP_check_0_4 : ∀ k l : Fin 6, contains (CA5_5_6I2PairRaw ((0,4),(k,l))) (CA5_5_6I2PairP ((0,4),(k,l))) = true := by + decide +kernel +lemma CA5_5_6I2PairP_check_0_5 : ∀ k l : Fin 6, contains (CA5_5_6I2PairRaw ((0,5),(k,l))) (CA5_5_6I2PairP ((0,5),(k,l))) = true := by + decide +kernel +lemma CA5_5_6I2PairP_check_1_0 : ∀ k l : Fin 6, contains (CA5_5_6I2PairRaw ((1,0),(k,l))) (CA5_5_6I2PairP ((1,0),(k,l))) = true := by + decide +kernel +lemma CA5_5_6I2PairP_check_1_1 : ∀ k l : Fin 6, contains (CA5_5_6I2PairRaw ((1,1),(k,l))) (CA5_5_6I2PairP ((1,1),(k,l))) = true := by + decide +kernel +lemma CA5_5_6I2PairP_check_1_2 : ∀ k l : Fin 6, contains (CA5_5_6I2PairRaw ((1,2),(k,l))) (CA5_5_6I2PairP ((1,2),(k,l))) = true := by + decide +kernel +lemma CA5_5_6I2PairP_check_1_3 : ∀ k l : Fin 6, contains (CA5_5_6I2PairRaw ((1,3),(k,l))) (CA5_5_6I2PairP ((1,3),(k,l))) = true := by + decide +kernel +lemma CA5_5_6I2PairP_check_1_4 : ∀ k l : Fin 6, contains (CA5_5_6I2PairRaw ((1,4),(k,l))) (CA5_5_6I2PairP ((1,4),(k,l))) = true := by + decide +kernel +lemma CA5_5_6I2PairP_check_1_5 : ∀ k l : Fin 6, contains (CA5_5_6I2PairRaw ((1,5),(k,l))) (CA5_5_6I2PairP ((1,5),(k,l))) = true := by + decide +kernel +lemma CA5_5_6I2PairP_check_2_0 : ∀ k l : Fin 6, contains (CA5_5_6I2PairRaw ((2,0),(k,l))) (CA5_5_6I2PairP ((2,0),(k,l))) = true := by + decide +kernel +lemma CA5_5_6I2PairP_check_2_1 : ∀ k l : Fin 6, contains (CA5_5_6I2PairRaw ((2,1),(k,l))) (CA5_5_6I2PairP ((2,1),(k,l))) = true := by + decide +kernel +lemma CA5_5_6I2PairP_check_2_2 : ∀ k l : Fin 6, contains (CA5_5_6I2PairRaw ((2,2),(k,l))) (CA5_5_6I2PairP ((2,2),(k,l))) = true := by + decide +kernel +lemma CA5_5_6I2PairP_check_2_3 : ∀ k l : Fin 6, contains (CA5_5_6I2PairRaw ((2,3),(k,l))) (CA5_5_6I2PairP ((2,3),(k,l))) = true := by + decide +kernel +lemma CA5_5_6I2PairP_check_2_4 : ∀ k l : Fin 6, contains (CA5_5_6I2PairRaw ((2,4),(k,l))) (CA5_5_6I2PairP ((2,4),(k,l))) = true := by + decide +kernel +lemma CA5_5_6I2PairP_check_2_5 : ∀ k l : Fin 6, contains (CA5_5_6I2PairRaw ((2,5),(k,l))) (CA5_5_6I2PairP ((2,5),(k,l))) = true := by + decide +kernel +lemma CA5_5_6I2PairP_check_3_0 : ∀ k l : Fin 6, contains (CA5_5_6I2PairRaw ((3,0),(k,l))) (CA5_5_6I2PairP ((3,0),(k,l))) = true := by + decide +kernel +lemma CA5_5_6I2PairP_check_3_1 : ∀ k l : Fin 6, contains (CA5_5_6I2PairRaw ((3,1),(k,l))) (CA5_5_6I2PairP ((3,1),(k,l))) = true := by + decide +kernel +lemma CA5_5_6I2PairP_check_3_2 : ∀ k l : Fin 6, contains (CA5_5_6I2PairRaw ((3,2),(k,l))) (CA5_5_6I2PairP ((3,2),(k,l))) = true := by + decide +kernel +lemma CA5_5_6I2PairP_check_3_3 : ∀ k l : Fin 6, contains (CA5_5_6I2PairRaw ((3,3),(k,l))) (CA5_5_6I2PairP ((3,3),(k,l))) = true := by + decide +kernel +lemma CA5_5_6I2PairP_check_3_4 : ∀ k l : Fin 6, contains (CA5_5_6I2PairRaw ((3,4),(k,l))) (CA5_5_6I2PairP ((3,4),(k,l))) = true := by + decide +kernel +lemma CA5_5_6I2PairP_check_3_5 : ∀ k l : Fin 6, contains (CA5_5_6I2PairRaw ((3,5),(k,l))) (CA5_5_6I2PairP ((3,5),(k,l))) = true := by + decide +kernel +lemma CA5_5_6I2PairP_check_4_0 : ∀ k l : Fin 6, contains (CA5_5_6I2PairRaw ((4,0),(k,l))) (CA5_5_6I2PairP ((4,0),(k,l))) = true := by + decide +kernel +lemma CA5_5_6I2PairP_check_4_1 : ∀ k l : Fin 6, contains (CA5_5_6I2PairRaw ((4,1),(k,l))) (CA5_5_6I2PairP ((4,1),(k,l))) = true := by + decide +kernel +lemma CA5_5_6I2PairP_check_4_2 : ∀ k l : Fin 6, contains (CA5_5_6I2PairRaw ((4,2),(k,l))) (CA5_5_6I2PairP ((4,2),(k,l))) = true := by + decide +kernel +lemma CA5_5_6I2PairP_check_4_3 : ∀ k l : Fin 6, contains (CA5_5_6I2PairRaw ((4,3),(k,l))) (CA5_5_6I2PairP ((4,3),(k,l))) = true := by + decide +kernel +lemma CA5_5_6I2PairP_check_4_4 : ∀ k l : Fin 6, contains (CA5_5_6I2PairRaw ((4,4),(k,l))) (CA5_5_6I2PairP ((4,4),(k,l))) = true := by + decide +kernel +lemma CA5_5_6I2PairP_check_4_5 : ∀ k l : Fin 6, contains (CA5_5_6I2PairRaw ((4,5),(k,l))) (CA5_5_6I2PairP ((4,5),(k,l))) = true := by + decide +kernel +lemma CA5_5_6I2PairP_check_5_0 : ∀ k l : Fin 6, contains (CA5_5_6I2PairRaw ((5,0),(k,l))) (CA5_5_6I2PairP ((5,0),(k,l))) = true := by + decide +kernel +lemma CA5_5_6I2PairP_check_5_1 : ∀ k l : Fin 6, contains (CA5_5_6I2PairRaw ((5,1),(k,l))) (CA5_5_6I2PairP ((5,1),(k,l))) = true := by + decide +kernel +lemma CA5_5_6I2PairP_check_5_2 : ∀ k l : Fin 6, contains (CA5_5_6I2PairRaw ((5,2),(k,l))) (CA5_5_6I2PairP ((5,2),(k,l))) = true := by + decide +kernel +lemma CA5_5_6I2PairP_check_5_3 : ∀ k l : Fin 6, contains (CA5_5_6I2PairRaw ((5,3),(k,l))) (CA5_5_6I2PairP ((5,3),(k,l))) = true := by + decide +kernel +lemma CA5_5_6I2PairP_check_5_4 : ∀ k l : Fin 6, contains (CA5_5_6I2PairRaw ((5,4),(k,l))) (CA5_5_6I2PairP ((5,4),(k,l))) = true := by + decide +kernel +lemma CA5_5_6I2PairP_check_5_5 : ∀ k l : Fin 6, contains (CA5_5_6I2PairRaw ((5,5),(k,l))) (CA5_5_6I2PairP ((5,5),(k,l))) = true := by + decide +kernel +lemma CA5_5_6I2PairP_check (a : PairSlot × PairSlot) : contains (CA5_5_6I2PairRaw a) (CA5_5_6I2PairP a) = true := by + rcases a with ⟨⟨i,j⟩,⟨k,l⟩⟩ + revert j i + apply forall_fin6 + · exact forall_fin6 (CA5_5_6I2PairP_check_0_0 k l) (CA5_5_6I2PairP_check_0_1 k l) (CA5_5_6I2PairP_check_0_2 k l) (CA5_5_6I2PairP_check_0_3 k l) (CA5_5_6I2PairP_check_0_4 k l) (CA5_5_6I2PairP_check_0_5 k l) + · exact forall_fin6 (CA5_5_6I2PairP_check_1_0 k l) (CA5_5_6I2PairP_check_1_1 k l) (CA5_5_6I2PairP_check_1_2 k l) (CA5_5_6I2PairP_check_1_3 k l) (CA5_5_6I2PairP_check_1_4 k l) (CA5_5_6I2PairP_check_1_5 k l) + · exact forall_fin6 (CA5_5_6I2PairP_check_2_0 k l) (CA5_5_6I2PairP_check_2_1 k l) (CA5_5_6I2PairP_check_2_2 k l) (CA5_5_6I2PairP_check_2_3 k l) (CA5_5_6I2PairP_check_2_4 k l) (CA5_5_6I2PairP_check_2_5 k l) + · exact forall_fin6 (CA5_5_6I2PairP_check_3_0 k l) (CA5_5_6I2PairP_check_3_1 k l) (CA5_5_6I2PairP_check_3_2 k l) (CA5_5_6I2PairP_check_3_3 k l) (CA5_5_6I2PairP_check_3_4 k l) (CA5_5_6I2PairP_check_3_5 k l) + · exact forall_fin6 (CA5_5_6I2PairP_check_4_0 k l) (CA5_5_6I2PairP_check_4_1 k l) (CA5_5_6I2PairP_check_4_2 k l) (CA5_5_6I2PairP_check_4_3 k l) (CA5_5_6I2PairP_check_4_4 k l) (CA5_5_6I2PairP_check_4_5 k l) + · exact forall_fin6 (CA5_5_6I2PairP_check_5_0 k l) (CA5_5_6I2PairP_check_5_1 k l) (CA5_5_6I2PairP_check_5_2 k l) (CA5_5_6I2PairP_check_5_3 k l) (CA5_5_6I2PairP_check_5_4 k l) (CA5_5_6I2PairP_check_5_5 k l) +lemma CA5_5_6I2PairP_sound (a : PairSlot × PairSlot) : + (CA5_5_6I2PairP a).Encloses (CA5_5_6I2PairValue a) := + contains_sound (CA5_5_6I2PairRaw_sound a) (CA5_5_6I2PairP_check a) +def CA5_5_6I2PairTerms (a : PairSlot × PairSlot) : Ball := + (CompactCertificate.entropyLookup CA5_5_6I2PairCertificates (CA5_5_6I2PairCertificateIndex a)).output +lemma CA5_5_6I2PairTerms_sound (a : PairSlot × PairSlot) : + (CA5_5_6I2PairTerms a).Encloses (Foundation.entropyTerm (CA5_5_6I2PairValue a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CA5_5_6I2PairCertificates_valid + (CA5_5_6I2PairCertificateIndex a) (CA5_5_6I2PairP_sound a) +def CA5_5_6I2PairEntropy : Ball := ⟨(7645719045720304886034929598111 / 2500000000000000000000000000000), (65603713603 / 50000000000000000000000000000000)⟩ +lemma CA5_5_6I2PairEntropy_sound : CA5_5_6I2PairEntropy.Encloses (Foundation.finiteEntropy CA5_5_6I2PairValue) := by + exact contains_sound (entropyDoublePair_enclosed CA5_5_6I2PairValue CA5_5_6I2PairTerms CA5_5_6I2PairTerms_sound) (by decide +kernel) +def CA5_5_6I2PairMass : Ball := ⟨(24999999999999999999999999999999 / 25000000000000000000000000000000), (157 / 25000000000000000000000000000000)⟩ +lemma CA5_5_6I2PairMass_sound : CA5_5_6I2PairMass.Encloses (∑ a, CA5_5_6I2PairValue a) := by + exact contains_sound (doublePairSumBall_sound CA5_5_6I2PairP CA5_5_6I2PairValue CA5_5_6I2PairP_sound) (by decide +kernel) +def CA5_5_6I2PairMassTermLogWitness : LogWitness := ⟨-1, 24999999999999999999999999999999, 12500000000000000000000000000000⟩ +def CA5_5_6I2PairMassTermLog : Ball := ⟨(-1 / 25000000000000000000000000000000), (21175823997 / 50000000000000000000000000000000)⟩ +lemma CA5_5_6I2PairMassTermLog_sound : CA5_5_6I2PairMassTermLog.Encloses (Real.log ((∑ a, CA5_5_6I2PairValue a))) := by + exact checkLog_sound logTwoBall_sound (CA5_5_6I2PairMass_sound) (w := CA5_5_6I2PairMassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CA5_5_6I2PairMassTerm : Ball := ⟨(1 / 25000000000000000000000000000000), (8470329599 / 20000000000000000000000000000000)⟩ +lemma CA5_5_6I2PairMassTerm_sound : CA5_5_6I2PairMassTerm.Encloses (Foundation.entropyTerm ((∑ a, CA5_5_6I2PairValue a))) := by + exact contains_sound (entropyTerm_ball (CA5_5_6I2PairMass_sound) CA5_5_6I2PairMassTermLog_sound) (by decide +kernel) +def CA5_5_6I2PairH : Ball := ⟨(76457190457203048860349295981109 / 25000000000000000000000000000000), (173559075201 / 100000000000000000000000000000000)⟩ +lemma CA5_5_6I2PairH_sound : CA5_5_6I2PairH.Encloses (homogeneousEntropy CA5_5_6I2PairValue) := by + exact contains_sound (homogeneous_enclosed CA5_5_6I2PairValue CA5_5_6I2PairMassTerm_sound CA5_5_6I2PairEntropy_sound) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/CapacityB/CapB1_1_6I0.lean b/lean/OAI/LinearAlgebra/MatrixFields/CapacityB/CapB1_1_6I0.lean new file mode 100644 index 0000000000000000000000000000000000000000..0a9ce5386149bc81138cb28de9e52437ca051974 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/CapacityB/CapB1_1_6I0.lean @@ -0,0 +1,72 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Certificates.SplitB1_1_6 + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CB1_1_6I0Value (a : Fin 17) : ℝ := marginal (below (shape 1 1 6)) (fun u => (stageBLaw (shape 1 1 6) u : ℝ)) ((stageBPriority (shape 1 1 6)) 0) a +def CB1_1_6I0Raw (a : Fin 17) : Ball := marginalBall (below (shape 1 1 6)) B1_1_6Law ((stageBPriority (shape 1 1 6)) 0) a +lemma CB1_1_6I0Raw_sound (a : Fin 17) : + (CB1_1_6I0Raw a).Encloses (CB1_1_6I0Value a) := by + exact marginalBall_sound (below (shape 1 1 6)) B1_1_6Law (fun u => (stageBLaw (shape 1 1 6) u : ℝ)) (fun u _ => B1_1_6Law_sound u) ((stageBPriority (shape 1 1 6)) 0) a +def CB1_1_6I0Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(1 / 2), (3 / 50000000000000000000000000000000)⟩ ⟨(6931471805599453094172319305033 / 20000000000000000000000000000000), (21175823693 / 100000000000000000000000000000000)⟩ ⟨(-6931471805599453094172319305033 / 10000000000000000000000000000000), (42351647377 / 100000000000000000000000000000000)⟩ ⟨-1, 1, 1⟩] +lemma CB1_1_6I0Certificates_valid : + CB1_1_6I0Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_1_6I0CertificateIndex (a : Fin 17) : ℕ := + match a.val with + | 0 => 1 + | 1 => 1 + | _ => 0 +def CB1_1_6I0P (a : Fin 17) : Ball := + (CompactCertificate.entropyLookup CB1_1_6I0Certificates (CB1_1_6I0CertificateIndex a)).input +lemma CB1_1_6I0P_check : ∀ a : Fin 17, contains (CB1_1_6I0Raw a) (CB1_1_6I0P a) = true := by + decide +kernel +lemma CB1_1_6I0P_sound (a : Fin 17) : + (CB1_1_6I0P a).Encloses (CB1_1_6I0Value a) := + contains_sound (CB1_1_6I0Raw_sound a) (CB1_1_6I0P_check a) +def CB1_1_6I0Terms (a : Fin 17) : Ball := + (CompactCertificate.entropyLookup CB1_1_6I0Certificates (CB1_1_6I0CertificateIndex a)).output +lemma CB1_1_6I0Terms_sound (a : Fin 17) : + (CB1_1_6I0Terms a).Encloses (Foundation.entropyTerm (CB1_1_6I0Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_1_6I0Certificates_valid + (CB1_1_6I0CertificateIndex a) (CB1_1_6I0P_sound a) +def CB1_1_6I0Entropy : Ball := ⟨(6931471805599453094172319305033 / 10000000000000000000000000000000), (21175823693 / 50000000000000000000000000000000)⟩ +lemma CB1_1_6I0Entropy_sound : CB1_1_6I0Entropy.Encloses (Foundation.finiteEntropy CB1_1_6I0Value) := by + exact contains_sound (entropyFin_enclosed 17 CB1_1_6I0Value CB1_1_6I0Terms CB1_1_6I0Terms_sound) (by decide +kernel) +def CB1_1_6I0Mass : Ball := ⟨1, (3 / 25000000000000000000000000000000)⟩ +lemma CB1_1_6I0Mass_sound : CB1_1_6I0Mass.Encloses (∑ a, CB1_1_6I0Value a) := by + exact contains_sound (finSumBall_sound 17 CB1_1_6I0P CB1_1_6I0Value CB1_1_6I0P_sound) (by decide +kernel) +def CB1_1_6I0MassTermLogWitness : LogWitness := ⟨0, 1, 1⟩ +def CB1_1_6I0MassTermLog : Ball := ⟨0, (10587911847 / 50000000000000000000000000000000)⟩ +lemma CB1_1_6I0MassTermLog_sound : CB1_1_6I0MassTermLog.Encloses (Real.log ((∑ a, CB1_1_6I0Value a))) := by + exact checkLog_sound logTwoBall_sound (CB1_1_6I0Mass_sound) (w := CB1_1_6I0MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB1_1_6I0MassTerm : Ball := ⟨0, (4235164739 / 20000000000000000000000000000000)⟩ +lemma CB1_1_6I0MassTerm_sound : CB1_1_6I0MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_1_6I0Value a))) := by + exact contains_sound (entropyTerm_ball (CB1_1_6I0Mass_sound) CB1_1_6I0MassTermLog_sound) (by decide +kernel) +def CB1_1_6I0H : Ball := ⟨(6931471805599453094172319305033 / 10000000000000000000000000000000), (63527471081 / 100000000000000000000000000000000)⟩ +lemma CB1_1_6I0H_sound : CB1_1_6I0H.Encloses (homogeneousEntropy CB1_1_6I0Value) := by + exact contains_sound (homogeneous_enclosed CB1_1_6I0Value CB1_1_6I0MassTerm_sound CB1_1_6I0Entropy_sound) (by decide +kernel) +lemma CB1_1_6I0_sound : CB1_1_6I0H.Encloses (stageBCapacity (shape 1 1 6) 0) := by + exact CB1_1_6I0H_sound + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/CapacityB/CapB1_1_6I1.lean b/lean/OAI/LinearAlgebra/MatrixFields/CapacityB/CapB1_1_6I1.lean new file mode 100644 index 0000000000000000000000000000000000000000..903893bbfe682c08d744fd41839b2b3d1566a318 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/CapacityB/CapB1_1_6I1.lean @@ -0,0 +1,824 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Certificates.LittleB1_3_4 + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CB1_1_6I1PairValue (a : PairSlot) : ℝ := pairLaw (below (shape 1 1 6)) (shape 1 1 6) (fun u => (stageBLaw (shape 1 1 6) u : ℝ)) (fun u a => (littleLaw (shape 1 1 6) u ((stageBPriority (shape 1 1 6)) 1) a : ℝ)) a +def CB1_1_6I1PairRaw (a : PairSlot) : Ball := pairLawBall (below (shape 1 1 6)) (shape 1 1 6) B1_1_6Law (fun u => B1_1_6Little u ((stageBPriority (shape 1 1 6)) 1)) a +lemma CB1_1_6I1PairRaw_sound (a : PairSlot) : + (CB1_1_6I1PairRaw a).Encloses (CB1_1_6I1PairValue a) := by + exact pairLawBall_sound_on (below (shape 1 1 6)) (shape 1 1 6) B1_1_6Law (fun u => (stageBLaw (shape 1 1 6) u : ℝ)) (fun u => B1_1_6Little u ((stageBPriority (shape 1 1 6)) 1)) (fun u a => (littleLaw (shape 1 1 6) u ((stageBPriority (shape 1 1 6)) 1) a : ℝ)) (fun u _ => B1_1_6Law_sound u) (fun u _ a => B1_1_6Little_sound u ((stageBPriority (shape 1 1 6)) 1) a) (fun u _ a => B1_1_6Little_sound (complement (shape 1 1 6) u) ((stageBPriority (shape 1 1 6)) 1) a) a +def CB1_1_6I1PairCertificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(1 / 2), (3 / 50000000000000000000000000000000)⟩ ⟨(6931471805599453094172319305033 / 20000000000000000000000000000000), (21175823693 / 100000000000000000000000000000000)⟩ ⟨(-6931471805599453094172319305033 / 10000000000000000000000000000000), (42351647377 / 100000000000000000000000000000000)⟩ ⟨-1, 1, 1⟩] +lemma CB1_1_6I1PairCertificates_valid : + CB1_1_6I1PairCertificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_1_6I1PairCertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 0, 1 => 1 + | 1, 0 => 1 + | _, _ => 0 +def CB1_1_6I1PairP (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CB1_1_6I1PairCertificates (CB1_1_6I1PairCertificateIndex a)).input +lemma CB1_1_6I1PairP_check : ∀ a : PairSlot, contains (CB1_1_6I1PairRaw a) (CB1_1_6I1PairP a) = true := by + decide +kernel +lemma CB1_1_6I1PairP_sound (a : PairSlot) : + (CB1_1_6I1PairP a).Encloses (CB1_1_6I1PairValue a) := + contains_sound (CB1_1_6I1PairRaw_sound a) (CB1_1_6I1PairP_check a) +def CB1_1_6I1PairTerms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CB1_1_6I1PairCertificates (CB1_1_6I1PairCertificateIndex a)).output +lemma CB1_1_6I1PairTerms_sound (a : PairSlot) : + (CB1_1_6I1PairTerms a).Encloses (Foundation.entropyTerm (CB1_1_6I1PairValue a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_1_6I1PairCertificates_valid + (CB1_1_6I1PairCertificateIndex a) (CB1_1_6I1PairP_sound a) +def CB1_1_6I1PairEntropy : Ball := ⟨(6931471805599453094172319305033 / 10000000000000000000000000000000), (21175823693 / 50000000000000000000000000000000)⟩ +lemma CB1_1_6I1PairEntropy_sound : CB1_1_6I1PairEntropy.Encloses (Foundation.finiteEntropy CB1_1_6I1PairValue) := by + exact contains_sound (entropyPair_enclosed CB1_1_6I1PairValue CB1_1_6I1PairTerms CB1_1_6I1PairTerms_sound) (by decide +kernel) +def CB1_1_6I1PairMass : Ball := ⟨1, (3 / 25000000000000000000000000000000)⟩ +lemma CB1_1_6I1PairMass_sound : CB1_1_6I1PairMass.Encloses (∑ a, CB1_1_6I1PairValue a) := by + exact contains_sound (pairSumBall_sound CB1_1_6I1PairP CB1_1_6I1PairValue CB1_1_6I1PairP_sound) (by decide +kernel) +def CB1_1_6I1PairMassTermLogWitness : LogWitness := ⟨0, 1, 1⟩ +def CB1_1_6I1PairMassTermLog : Ball := ⟨0, (10587911847 / 50000000000000000000000000000000)⟩ +lemma CB1_1_6I1PairMassTermLog_sound : CB1_1_6I1PairMassTermLog.Encloses (Real.log ((∑ a, CB1_1_6I1PairValue a))) := by + exact checkLog_sound logTwoBall_sound (CB1_1_6I1PairMass_sound) (w := CB1_1_6I1PairMassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB1_1_6I1PairMassTerm : Ball := ⟨0, (4235164739 / 20000000000000000000000000000000)⟩ +lemma CB1_1_6I1PairMassTerm_sound : CB1_1_6I1PairMassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_1_6I1PairValue a))) := by + exact contains_sound (entropyTerm_ball (CB1_1_6I1PairMass_sound) CB1_1_6I1PairMassTermLog_sound) (by decide +kernel) +def CB1_1_6I1PairH : Ball := ⟨(6931471805599453094172319305033 / 10000000000000000000000000000000), (63527471081 / 100000000000000000000000000000000)⟩ +lemma CB1_1_6I1PairH_sound : CB1_1_6I1PairH.Encloses (homogeneousEntropy CB1_1_6I1PairValue) := by + exact contains_sound (homogeneous_enclosed CB1_1_6I1PairValue CB1_1_6I1PairMassTerm_sound CB1_1_6I1PairEntropy_sound) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CB1_1_6I1R0Value (a : Fin 6) : ℝ := residualLaw (below (shape 1 1 6)) (fun u => (stageBLaw (shape 1 1 6) u : ℝ)) (stageBPriority (shape 1 1 6)) 1 (fun u a => (littleLaw (shape 1 1 6) u ((stageBPriority (shape 1 1 6)) 1) a : ℝ)) 0 a +def CB1_1_6I1R0Raw (a : Fin 6) : Ball := residualBall (below (shape 1 1 6)) B1_1_6Law (stageBPriority (shape 1 1 6)) 1 (fun u => B1_1_6Little u ((stageBPriority (shape 1 1 6)) 1)) 0 a +lemma CB1_1_6I1R0Raw_sound (a : Fin 6) : + (CB1_1_6I1R0Raw a).Encloses (CB1_1_6I1R0Value a) := by + exact residualBall_sound_on (below (shape 1 1 6)) B1_1_6Law (fun u => (stageBLaw (shape 1 1 6) u : ℝ)) (stageBPriority (shape 1 1 6)) 1 (fun u => B1_1_6Little u ((stageBPriority (shape 1 1 6)) 1)) (fun u a => (littleLaw (shape 1 1 6) u ((stageBPriority (shape 1 1 6)) 1) a : ℝ)) (fun u _ => B1_1_6Law_sound u) (fun u _ a => B1_1_6Little_sound u ((stageBPriority (shape 1 1 6)) 1) a) 0 a +def CB1_1_6I1R0Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(1 / 2), (3 / 50000000000000000000000000000000)⟩ ⟨(6931471805599453094172319305033 / 20000000000000000000000000000000), (21175823693 / 100000000000000000000000000000000)⟩ ⟨(-6931471805599453094172319305033 / 10000000000000000000000000000000), (42351647377 / 100000000000000000000000000000000)⟩ ⟨-1, 1, 1⟩] +lemma CB1_1_6I1R0Certificates_valid : + CB1_1_6I1R0Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_1_6I1R0CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | 0 => 1 + | _ => 0 +def CB1_1_6I1R0P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_1_6I1R0Certificates (CB1_1_6I1R0CertificateIndex a)).input +lemma CB1_1_6I1R0P_check : ∀ a : Fin 6, contains (CB1_1_6I1R0Raw a) (CB1_1_6I1R0P a) = true := by + decide +kernel +lemma CB1_1_6I1R0P_sound (a : Fin 6) : + (CB1_1_6I1R0P a).Encloses (CB1_1_6I1R0Value a) := + contains_sound (CB1_1_6I1R0Raw_sound a) (CB1_1_6I1R0P_check a) +def CB1_1_6I1R0Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_1_6I1R0Certificates (CB1_1_6I1R0CertificateIndex a)).output +lemma CB1_1_6I1R0Terms_sound (a : Fin 6) : + (CB1_1_6I1R0Terms a).Encloses (Foundation.entropyTerm (CB1_1_6I1R0Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_1_6I1R0Certificates_valid + (CB1_1_6I1R0CertificateIndex a) (CB1_1_6I1R0P_sound a) +def CB1_1_6I1R0Entropy : Ball := ⟨(6931471805599453094172319305033 / 20000000000000000000000000000000), (21175823693 / 100000000000000000000000000000000)⟩ +lemma CB1_1_6I1R0Entropy_sound : CB1_1_6I1R0Entropy.Encloses (Foundation.finiteEntropy CB1_1_6I1R0Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_1_6I1R0Value CB1_1_6I1R0Terms CB1_1_6I1R0Terms_sound) (by decide +kernel) +def CB1_1_6I1R0Mass : Ball := ⟨(1 / 2), (3 / 50000000000000000000000000000000)⟩ +lemma CB1_1_6I1R0Mass_sound : CB1_1_6I1R0Mass.Encloses (∑ a, CB1_1_6I1R0Value a) := by + exact contains_sound (finSumBall_sound 6 CB1_1_6I1R0P CB1_1_6I1R0Value CB1_1_6I1R0P_sound) (by decide +kernel) +def CB1_1_6I1R0MassTermLogWitness : LogWitness := ⟨-1, 1, 1⟩ +def CB1_1_6I1R0MassTermLog : Ball := ⟨(-6931471805599453094172319305033 / 10000000000000000000000000000000), (42351647377 / 100000000000000000000000000000000)⟩ +lemma CB1_1_6I1R0MassTermLog_sound : CB1_1_6I1R0MassTermLog.Encloses (Real.log ((∑ a, CB1_1_6I1R0Value a))) := by + exact checkLog_sound logTwoBall_sound (CB1_1_6I1R0Mass_sound) (w := CB1_1_6I1R0MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB1_1_6I1R0MassTerm : Ball := ⟨(6931471805599453094172319305033 / 20000000000000000000000000000000), (21175823693 / 100000000000000000000000000000000)⟩ +lemma CB1_1_6I1R0MassTerm_sound : CB1_1_6I1R0MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_1_6I1R0Value a))) := by + exact contains_sound (entropyTerm_ball (CB1_1_6I1R0Mass_sound) CB1_1_6I1R0MassTermLog_sound) (by decide +kernel) +def CB1_1_6I1R0H : Ball := ⟨0, (21175823693 / 50000000000000000000000000000000)⟩ +lemma CB1_1_6I1R0H_sound : CB1_1_6I1R0H.Encloses (homogeneousEntropy CB1_1_6I1R0Value) := by + exact contains_sound (homogeneous_enclosed CB1_1_6I1R0Value CB1_1_6I1R0MassTerm_sound CB1_1_6I1R0Entropy_sound) (by decide +kernel) +def CB1_1_6I1R1Value (a : Fin 6) : ℝ := residualLaw (below (shape 1 1 6)) (fun u => (stageBLaw (shape 1 1 6) u : ℝ)) (stageBPriority (shape 1 1 6)) 1 (fun u a => (littleLaw (shape 1 1 6) u ((stageBPriority (shape 1 1 6)) 1) a : ℝ)) 1 a +def CB1_1_6I1R1Raw (a : Fin 6) : Ball := residualBall (below (shape 1 1 6)) B1_1_6Law (stageBPriority (shape 1 1 6)) 1 (fun u => B1_1_6Little u ((stageBPriority (shape 1 1 6)) 1)) 1 a +lemma CB1_1_6I1R1Raw_sound (a : Fin 6) : + (CB1_1_6I1R1Raw a).Encloses (CB1_1_6I1R1Value a) := by + exact residualBall_sound_on (below (shape 1 1 6)) B1_1_6Law (fun u => (stageBLaw (shape 1 1 6) u : ℝ)) (stageBPriority (shape 1 1 6)) 1 (fun u => B1_1_6Little u ((stageBPriority (shape 1 1 6)) 1)) (fun u a => (littleLaw (shape 1 1 6) u ((stageBPriority (shape 1 1 6)) 1) a : ℝ)) (fun u _ => B1_1_6Law_sound u) (fun u _ a => B1_1_6Little_sound u ((stageBPriority (shape 1 1 6)) 1) a) 1 a +def CB1_1_6I1R1Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(1 / 2), (3 / 50000000000000000000000000000000)⟩ ⟨(6931471805599453094172319305033 / 20000000000000000000000000000000), (21175823693 / 100000000000000000000000000000000)⟩ ⟨(-6931471805599453094172319305033 / 10000000000000000000000000000000), (42351647377 / 100000000000000000000000000000000)⟩ ⟨-1, 1, 1⟩] +lemma CB1_1_6I1R1Certificates_valid : + CB1_1_6I1R1Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_1_6I1R1CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | 1 => 1 + | _ => 0 +def CB1_1_6I1R1P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_1_6I1R1Certificates (CB1_1_6I1R1CertificateIndex a)).input +lemma CB1_1_6I1R1P_check : ∀ a : Fin 6, contains (CB1_1_6I1R1Raw a) (CB1_1_6I1R1P a) = true := by + decide +kernel +lemma CB1_1_6I1R1P_sound (a : Fin 6) : + (CB1_1_6I1R1P a).Encloses (CB1_1_6I1R1Value a) := + contains_sound (CB1_1_6I1R1Raw_sound a) (CB1_1_6I1R1P_check a) +def CB1_1_6I1R1Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_1_6I1R1Certificates (CB1_1_6I1R1CertificateIndex a)).output +lemma CB1_1_6I1R1Terms_sound (a : Fin 6) : + (CB1_1_6I1R1Terms a).Encloses (Foundation.entropyTerm (CB1_1_6I1R1Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_1_6I1R1Certificates_valid + (CB1_1_6I1R1CertificateIndex a) (CB1_1_6I1R1P_sound a) +def CB1_1_6I1R1Entropy : Ball := ⟨(6931471805599453094172319305033 / 20000000000000000000000000000000), (21175823693 / 100000000000000000000000000000000)⟩ +lemma CB1_1_6I1R1Entropy_sound : CB1_1_6I1R1Entropy.Encloses (Foundation.finiteEntropy CB1_1_6I1R1Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_1_6I1R1Value CB1_1_6I1R1Terms CB1_1_6I1R1Terms_sound) (by decide +kernel) +def CB1_1_6I1R1Mass : Ball := ⟨(1 / 2), (3 / 50000000000000000000000000000000)⟩ +lemma CB1_1_6I1R1Mass_sound : CB1_1_6I1R1Mass.Encloses (∑ a, CB1_1_6I1R1Value a) := by + exact contains_sound (finSumBall_sound 6 CB1_1_6I1R1P CB1_1_6I1R1Value CB1_1_6I1R1P_sound) (by decide +kernel) +def CB1_1_6I1R1MassTermLogWitness : LogWitness := ⟨-1, 1, 1⟩ +def CB1_1_6I1R1MassTermLog : Ball := ⟨(-6931471805599453094172319305033 / 10000000000000000000000000000000), (42351647377 / 100000000000000000000000000000000)⟩ +lemma CB1_1_6I1R1MassTermLog_sound : CB1_1_6I1R1MassTermLog.Encloses (Real.log ((∑ a, CB1_1_6I1R1Value a))) := by + exact checkLog_sound logTwoBall_sound (CB1_1_6I1R1Mass_sound) (w := CB1_1_6I1R1MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB1_1_6I1R1MassTerm : Ball := ⟨(6931471805599453094172319305033 / 20000000000000000000000000000000), (21175823693 / 100000000000000000000000000000000)⟩ +lemma CB1_1_6I1R1MassTerm_sound : CB1_1_6I1R1MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_1_6I1R1Value a))) := by + exact contains_sound (entropyTerm_ball (CB1_1_6I1R1Mass_sound) CB1_1_6I1R1MassTermLog_sound) (by decide +kernel) +def CB1_1_6I1R1H : Ball := ⟨0, (21175823693 / 50000000000000000000000000000000)⟩ +lemma CB1_1_6I1R1H_sound : CB1_1_6I1R1H.Encloses (homogeneousEntropy CB1_1_6I1R1Value) := by + exact contains_sound (homogeneous_enclosed CB1_1_6I1R1Value CB1_1_6I1R1MassTerm_sound CB1_1_6I1R1Entropy_sound) (by decide +kernel) +def CB1_1_6I1R2Value (a : Fin 6) : ℝ := residualLaw (below (shape 1 1 6)) (fun u => (stageBLaw (shape 1 1 6) u : ℝ)) (stageBPriority (shape 1 1 6)) 1 (fun u a => (littleLaw (shape 1 1 6) u ((stageBPriority (shape 1 1 6)) 1) a : ℝ)) 2 a +def CB1_1_6I1R2Raw (a : Fin 6) : Ball := residualBall (below (shape 1 1 6)) B1_1_6Law (stageBPriority (shape 1 1 6)) 1 (fun u => B1_1_6Little u ((stageBPriority (shape 1 1 6)) 1)) 2 a +lemma CB1_1_6I1R2Raw_sound (a : Fin 6) : + (CB1_1_6I1R2Raw a).Encloses (CB1_1_6I1R2Value a) := by + exact residualBall_sound_on (below (shape 1 1 6)) B1_1_6Law (fun u => (stageBLaw (shape 1 1 6) u : ℝ)) (stageBPriority (shape 1 1 6)) 1 (fun u => B1_1_6Little u ((stageBPriority (shape 1 1 6)) 1)) (fun u a => (littleLaw (shape 1 1 6) u ((stageBPriority (shape 1 1 6)) 1) a : ℝ)) (fun u _ => B1_1_6Law_sound u) (fun u _ a => B1_1_6Little_sound u ((stageBPriority (shape 1 1 6)) 1) a) 2 a +def CB1_1_6I1R2Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB1_1_6I1R2Certificates_valid : + CB1_1_6I1R2Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_1_6I1R2CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB1_1_6I1R2P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_1_6I1R2Certificates (CB1_1_6I1R2CertificateIndex a)).input +lemma CB1_1_6I1R2P_check : ∀ a : Fin 6, contains (CB1_1_6I1R2Raw a) (CB1_1_6I1R2P a) = true := by + decide +kernel +lemma CB1_1_6I1R2P_sound (a : Fin 6) : + (CB1_1_6I1R2P a).Encloses (CB1_1_6I1R2Value a) := + contains_sound (CB1_1_6I1R2Raw_sound a) (CB1_1_6I1R2P_check a) +def CB1_1_6I1R2Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_1_6I1R2Certificates (CB1_1_6I1R2CertificateIndex a)).output +lemma CB1_1_6I1R2Terms_sound (a : Fin 6) : + (CB1_1_6I1R2Terms a).Encloses (Foundation.entropyTerm (CB1_1_6I1R2Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_1_6I1R2Certificates_valid + (CB1_1_6I1R2CertificateIndex a) (CB1_1_6I1R2P_sound a) +def CB1_1_6I1R2Entropy : Ball := ⟨0, 0⟩ +lemma CB1_1_6I1R2Entropy_sound : CB1_1_6I1R2Entropy.Encloses (Foundation.finiteEntropy CB1_1_6I1R2Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_1_6I1R2Value CB1_1_6I1R2Terms CB1_1_6I1R2Terms_sound) (by decide +kernel) +def CB1_1_6I1R2Mass : Ball := ⟨0, 0⟩ +lemma CB1_1_6I1R2Mass_sound : CB1_1_6I1R2Mass.Encloses (∑ a, CB1_1_6I1R2Value a) := by + exact contains_sound (finSumBall_sound 6 CB1_1_6I1R2P CB1_1_6I1R2Value CB1_1_6I1R2P_sound) (by decide +kernel) +def CB1_1_6I1R2MassTerm : Ball := .exact 0 +lemma CB1_1_6I1R2MassTerm_sound : CB1_1_6I1R2MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_1_6I1R2Value a))) := + entropyTerm_zero_ball (CB1_1_6I1R2Mass_sound) +def CB1_1_6I1R2H : Ball := ⟨0, 0⟩ +lemma CB1_1_6I1R2H_sound : CB1_1_6I1R2H.Encloses (homogeneousEntropy CB1_1_6I1R2Value) := by + exact contains_sound (homogeneous_enclosed CB1_1_6I1R2Value CB1_1_6I1R2MassTerm_sound CB1_1_6I1R2Entropy_sound) (by decide +kernel) +def CB1_1_6I1R3Value (a : Fin 6) : ℝ := residualLaw (below (shape 1 1 6)) (fun u => (stageBLaw (shape 1 1 6) u : ℝ)) (stageBPriority (shape 1 1 6)) 1 (fun u a => (littleLaw (shape 1 1 6) u ((stageBPriority (shape 1 1 6)) 1) a : ℝ)) 3 a +def CB1_1_6I1R3Raw (a : Fin 6) : Ball := residualBall (below (shape 1 1 6)) B1_1_6Law (stageBPriority (shape 1 1 6)) 1 (fun u => B1_1_6Little u ((stageBPriority (shape 1 1 6)) 1)) 3 a +lemma CB1_1_6I1R3Raw_sound (a : Fin 6) : + (CB1_1_6I1R3Raw a).Encloses (CB1_1_6I1R3Value a) := by + exact residualBall_sound_on (below (shape 1 1 6)) B1_1_6Law (fun u => (stageBLaw (shape 1 1 6) u : ℝ)) (stageBPriority (shape 1 1 6)) 1 (fun u => B1_1_6Little u ((stageBPriority (shape 1 1 6)) 1)) (fun u a => (littleLaw (shape 1 1 6) u ((stageBPriority (shape 1 1 6)) 1) a : ℝ)) (fun u _ => B1_1_6Law_sound u) (fun u _ a => B1_1_6Little_sound u ((stageBPriority (shape 1 1 6)) 1) a) 3 a +def CB1_1_6I1R3Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB1_1_6I1R3Certificates_valid : + CB1_1_6I1R3Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_1_6I1R3CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB1_1_6I1R3P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_1_6I1R3Certificates (CB1_1_6I1R3CertificateIndex a)).input +lemma CB1_1_6I1R3P_check : ∀ a : Fin 6, contains (CB1_1_6I1R3Raw a) (CB1_1_6I1R3P a) = true := by + decide +kernel +lemma CB1_1_6I1R3P_sound (a : Fin 6) : + (CB1_1_6I1R3P a).Encloses (CB1_1_6I1R3Value a) := + contains_sound (CB1_1_6I1R3Raw_sound a) (CB1_1_6I1R3P_check a) +def CB1_1_6I1R3Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_1_6I1R3Certificates (CB1_1_6I1R3CertificateIndex a)).output +lemma CB1_1_6I1R3Terms_sound (a : Fin 6) : + (CB1_1_6I1R3Terms a).Encloses (Foundation.entropyTerm (CB1_1_6I1R3Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_1_6I1R3Certificates_valid + (CB1_1_6I1R3CertificateIndex a) (CB1_1_6I1R3P_sound a) +def CB1_1_6I1R3Entropy : Ball := ⟨0, 0⟩ +lemma CB1_1_6I1R3Entropy_sound : CB1_1_6I1R3Entropy.Encloses (Foundation.finiteEntropy CB1_1_6I1R3Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_1_6I1R3Value CB1_1_6I1R3Terms CB1_1_6I1R3Terms_sound) (by decide +kernel) +def CB1_1_6I1R3Mass : Ball := ⟨0, 0⟩ +lemma CB1_1_6I1R3Mass_sound : CB1_1_6I1R3Mass.Encloses (∑ a, CB1_1_6I1R3Value a) := by + exact contains_sound (finSumBall_sound 6 CB1_1_6I1R3P CB1_1_6I1R3Value CB1_1_6I1R3P_sound) (by decide +kernel) +def CB1_1_6I1R3MassTerm : Ball := .exact 0 +lemma CB1_1_6I1R3MassTerm_sound : CB1_1_6I1R3MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_1_6I1R3Value a))) := + entropyTerm_zero_ball (CB1_1_6I1R3Mass_sound) +def CB1_1_6I1R3H : Ball := ⟨0, 0⟩ +lemma CB1_1_6I1R3H_sound : CB1_1_6I1R3H.Encloses (homogeneousEntropy CB1_1_6I1R3Value) := by + exact contains_sound (homogeneous_enclosed CB1_1_6I1R3Value CB1_1_6I1R3MassTerm_sound CB1_1_6I1R3Entropy_sound) (by decide +kernel) +def CB1_1_6I1R4Value (a : Fin 6) : ℝ := residualLaw (below (shape 1 1 6)) (fun u => (stageBLaw (shape 1 1 6) u : ℝ)) (stageBPriority (shape 1 1 6)) 1 (fun u a => (littleLaw (shape 1 1 6) u ((stageBPriority (shape 1 1 6)) 1) a : ℝ)) 4 a +def CB1_1_6I1R4Raw (a : Fin 6) : Ball := residualBall (below (shape 1 1 6)) B1_1_6Law (stageBPriority (shape 1 1 6)) 1 (fun u => B1_1_6Little u ((stageBPriority (shape 1 1 6)) 1)) 4 a +lemma CB1_1_6I1R4Raw_sound (a : Fin 6) : + (CB1_1_6I1R4Raw a).Encloses (CB1_1_6I1R4Value a) := by + exact residualBall_sound_on (below (shape 1 1 6)) B1_1_6Law (fun u => (stageBLaw (shape 1 1 6) u : ℝ)) (stageBPriority (shape 1 1 6)) 1 (fun u => B1_1_6Little u ((stageBPriority (shape 1 1 6)) 1)) (fun u a => (littleLaw (shape 1 1 6) u ((stageBPriority (shape 1 1 6)) 1) a : ℝ)) (fun u _ => B1_1_6Law_sound u) (fun u _ a => B1_1_6Little_sound u ((stageBPriority (shape 1 1 6)) 1) a) 4 a +def CB1_1_6I1R4Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB1_1_6I1R4Certificates_valid : + CB1_1_6I1R4Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_1_6I1R4CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB1_1_6I1R4P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_1_6I1R4Certificates (CB1_1_6I1R4CertificateIndex a)).input +lemma CB1_1_6I1R4P_check : ∀ a : Fin 6, contains (CB1_1_6I1R4Raw a) (CB1_1_6I1R4P a) = true := by + decide +kernel +lemma CB1_1_6I1R4P_sound (a : Fin 6) : + (CB1_1_6I1R4P a).Encloses (CB1_1_6I1R4Value a) := + contains_sound (CB1_1_6I1R4Raw_sound a) (CB1_1_6I1R4P_check a) +def CB1_1_6I1R4Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_1_6I1R4Certificates (CB1_1_6I1R4CertificateIndex a)).output +lemma CB1_1_6I1R4Terms_sound (a : Fin 6) : + (CB1_1_6I1R4Terms a).Encloses (Foundation.entropyTerm (CB1_1_6I1R4Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_1_6I1R4Certificates_valid + (CB1_1_6I1R4CertificateIndex a) (CB1_1_6I1R4P_sound a) +def CB1_1_6I1R4Entropy : Ball := ⟨0, 0⟩ +lemma CB1_1_6I1R4Entropy_sound : CB1_1_6I1R4Entropy.Encloses (Foundation.finiteEntropy CB1_1_6I1R4Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_1_6I1R4Value CB1_1_6I1R4Terms CB1_1_6I1R4Terms_sound) (by decide +kernel) +def CB1_1_6I1R4Mass : Ball := ⟨0, 0⟩ +lemma CB1_1_6I1R4Mass_sound : CB1_1_6I1R4Mass.Encloses (∑ a, CB1_1_6I1R4Value a) := by + exact contains_sound (finSumBall_sound 6 CB1_1_6I1R4P CB1_1_6I1R4Value CB1_1_6I1R4P_sound) (by decide +kernel) +def CB1_1_6I1R4MassTerm : Ball := .exact 0 +lemma CB1_1_6I1R4MassTerm_sound : CB1_1_6I1R4MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_1_6I1R4Value a))) := + entropyTerm_zero_ball (CB1_1_6I1R4Mass_sound) +def CB1_1_6I1R4H : Ball := ⟨0, 0⟩ +lemma CB1_1_6I1R4H_sound : CB1_1_6I1R4H.Encloses (homogeneousEntropy CB1_1_6I1R4Value) := by + exact contains_sound (homogeneous_enclosed CB1_1_6I1R4Value CB1_1_6I1R4MassTerm_sound CB1_1_6I1R4Entropy_sound) (by decide +kernel) +def CB1_1_6I1R5Value (a : Fin 6) : ℝ := residualLaw (below (shape 1 1 6)) (fun u => (stageBLaw (shape 1 1 6) u : ℝ)) (stageBPriority (shape 1 1 6)) 1 (fun u a => (littleLaw (shape 1 1 6) u ((stageBPriority (shape 1 1 6)) 1) a : ℝ)) 5 a +def CB1_1_6I1R5Raw (a : Fin 6) : Ball := residualBall (below (shape 1 1 6)) B1_1_6Law (stageBPriority (shape 1 1 6)) 1 (fun u => B1_1_6Little u ((stageBPriority (shape 1 1 6)) 1)) 5 a +lemma CB1_1_6I1R5Raw_sound (a : Fin 6) : + (CB1_1_6I1R5Raw a).Encloses (CB1_1_6I1R5Value a) := by + exact residualBall_sound_on (below (shape 1 1 6)) B1_1_6Law (fun u => (stageBLaw (shape 1 1 6) u : ℝ)) (stageBPriority (shape 1 1 6)) 1 (fun u => B1_1_6Little u ((stageBPriority (shape 1 1 6)) 1)) (fun u a => (littleLaw (shape 1 1 6) u ((stageBPriority (shape 1 1 6)) 1) a : ℝ)) (fun u _ => B1_1_6Law_sound u) (fun u _ a => B1_1_6Little_sound u ((stageBPriority (shape 1 1 6)) 1) a) 5 a +def CB1_1_6I1R5Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB1_1_6I1R5Certificates_valid : + CB1_1_6I1R5Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_1_6I1R5CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB1_1_6I1R5P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_1_6I1R5Certificates (CB1_1_6I1R5CertificateIndex a)).input +lemma CB1_1_6I1R5P_check : ∀ a : Fin 6, contains (CB1_1_6I1R5Raw a) (CB1_1_6I1R5P a) = true := by + decide +kernel +lemma CB1_1_6I1R5P_sound (a : Fin 6) : + (CB1_1_6I1R5P a).Encloses (CB1_1_6I1R5Value a) := + contains_sound (CB1_1_6I1R5Raw_sound a) (CB1_1_6I1R5P_check a) +def CB1_1_6I1R5Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_1_6I1R5Certificates (CB1_1_6I1R5CertificateIndex a)).output +lemma CB1_1_6I1R5Terms_sound (a : Fin 6) : + (CB1_1_6I1R5Terms a).Encloses (Foundation.entropyTerm (CB1_1_6I1R5Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_1_6I1R5Certificates_valid + (CB1_1_6I1R5CertificateIndex a) (CB1_1_6I1R5P_sound a) +def CB1_1_6I1R5Entropy : Ball := ⟨0, 0⟩ +lemma CB1_1_6I1R5Entropy_sound : CB1_1_6I1R5Entropy.Encloses (Foundation.finiteEntropy CB1_1_6I1R5Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_1_6I1R5Value CB1_1_6I1R5Terms CB1_1_6I1R5Terms_sound) (by decide +kernel) +def CB1_1_6I1R5Mass : Ball := ⟨0, 0⟩ +lemma CB1_1_6I1R5Mass_sound : CB1_1_6I1R5Mass.Encloses (∑ a, CB1_1_6I1R5Value a) := by + exact contains_sound (finSumBall_sound 6 CB1_1_6I1R5P CB1_1_6I1R5Value CB1_1_6I1R5P_sound) (by decide +kernel) +def CB1_1_6I1R5MassTerm : Ball := .exact 0 +lemma CB1_1_6I1R5MassTerm_sound : CB1_1_6I1R5MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_1_6I1R5Value a))) := + entropyTerm_zero_ball (CB1_1_6I1R5Mass_sound) +def CB1_1_6I1R5H : Ball := ⟨0, 0⟩ +lemma CB1_1_6I1R5H_sound : CB1_1_6I1R5H.Encloses (homogeneousEntropy CB1_1_6I1R5Value) := by + exact contains_sound (homogeneous_enclosed CB1_1_6I1R5Value CB1_1_6I1R5MassTerm_sound CB1_1_6I1R5Entropy_sound) (by decide +kernel) +def CB1_1_6I1R6Value (a : Fin 6) : ℝ := residualLaw (below (shape 1 1 6)) (fun u => (stageBLaw (shape 1 1 6) u : ℝ)) (stageBPriority (shape 1 1 6)) 1 (fun u a => (littleLaw (shape 1 1 6) u ((stageBPriority (shape 1 1 6)) 1) a : ℝ)) 6 a +def CB1_1_6I1R6Raw (a : Fin 6) : Ball := residualBall (below (shape 1 1 6)) B1_1_6Law (stageBPriority (shape 1 1 6)) 1 (fun u => B1_1_6Little u ((stageBPriority (shape 1 1 6)) 1)) 6 a +lemma CB1_1_6I1R6Raw_sound (a : Fin 6) : + (CB1_1_6I1R6Raw a).Encloses (CB1_1_6I1R6Value a) := by + exact residualBall_sound_on (below (shape 1 1 6)) B1_1_6Law (fun u => (stageBLaw (shape 1 1 6) u : ℝ)) (stageBPriority (shape 1 1 6)) 1 (fun u => B1_1_6Little u ((stageBPriority (shape 1 1 6)) 1)) (fun u a => (littleLaw (shape 1 1 6) u ((stageBPriority (shape 1 1 6)) 1) a : ℝ)) (fun u _ => B1_1_6Law_sound u) (fun u _ a => B1_1_6Little_sound u ((stageBPriority (shape 1 1 6)) 1) a) 6 a +def CB1_1_6I1R6Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB1_1_6I1R6Certificates_valid : + CB1_1_6I1R6Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_1_6I1R6CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB1_1_6I1R6P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_1_6I1R6Certificates (CB1_1_6I1R6CertificateIndex a)).input +lemma CB1_1_6I1R6P_check : ∀ a : Fin 6, contains (CB1_1_6I1R6Raw a) (CB1_1_6I1R6P a) = true := by + decide +kernel +lemma CB1_1_6I1R6P_sound (a : Fin 6) : + (CB1_1_6I1R6P a).Encloses (CB1_1_6I1R6Value a) := + contains_sound (CB1_1_6I1R6Raw_sound a) (CB1_1_6I1R6P_check a) +def CB1_1_6I1R6Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_1_6I1R6Certificates (CB1_1_6I1R6CertificateIndex a)).output +lemma CB1_1_6I1R6Terms_sound (a : Fin 6) : + (CB1_1_6I1R6Terms a).Encloses (Foundation.entropyTerm (CB1_1_6I1R6Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_1_6I1R6Certificates_valid + (CB1_1_6I1R6CertificateIndex a) (CB1_1_6I1R6P_sound a) +def CB1_1_6I1R6Entropy : Ball := ⟨0, 0⟩ +lemma CB1_1_6I1R6Entropy_sound : CB1_1_6I1R6Entropy.Encloses (Foundation.finiteEntropy CB1_1_6I1R6Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_1_6I1R6Value CB1_1_6I1R6Terms CB1_1_6I1R6Terms_sound) (by decide +kernel) +def CB1_1_6I1R6Mass : Ball := ⟨0, 0⟩ +lemma CB1_1_6I1R6Mass_sound : CB1_1_6I1R6Mass.Encloses (∑ a, CB1_1_6I1R6Value a) := by + exact contains_sound (finSumBall_sound 6 CB1_1_6I1R6P CB1_1_6I1R6Value CB1_1_6I1R6P_sound) (by decide +kernel) +def CB1_1_6I1R6MassTerm : Ball := .exact 0 +lemma CB1_1_6I1R6MassTerm_sound : CB1_1_6I1R6MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_1_6I1R6Value a))) := + entropyTerm_zero_ball (CB1_1_6I1R6Mass_sound) +def CB1_1_6I1R6H : Ball := ⟨0, 0⟩ +lemma CB1_1_6I1R6H_sound : CB1_1_6I1R6H.Encloses (homogeneousEntropy CB1_1_6I1R6Value) := by + exact contains_sound (homogeneous_enclosed CB1_1_6I1R6Value CB1_1_6I1R6MassTerm_sound CB1_1_6I1R6Entropy_sound) (by decide +kernel) +def CB1_1_6I1R7Value (a : Fin 6) : ℝ := residualLaw (below (shape 1 1 6)) (fun u => (stageBLaw (shape 1 1 6) u : ℝ)) (stageBPriority (shape 1 1 6)) 1 (fun u a => (littleLaw (shape 1 1 6) u ((stageBPriority (shape 1 1 6)) 1) a : ℝ)) 7 a +def CB1_1_6I1R7Raw (a : Fin 6) : Ball := residualBall (below (shape 1 1 6)) B1_1_6Law (stageBPriority (shape 1 1 6)) 1 (fun u => B1_1_6Little u ((stageBPriority (shape 1 1 6)) 1)) 7 a +lemma CB1_1_6I1R7Raw_sound (a : Fin 6) : + (CB1_1_6I1R7Raw a).Encloses (CB1_1_6I1R7Value a) := by + exact residualBall_sound_on (below (shape 1 1 6)) B1_1_6Law (fun u => (stageBLaw (shape 1 1 6) u : ℝ)) (stageBPriority (shape 1 1 6)) 1 (fun u => B1_1_6Little u ((stageBPriority (shape 1 1 6)) 1)) (fun u a => (littleLaw (shape 1 1 6) u ((stageBPriority (shape 1 1 6)) 1) a : ℝ)) (fun u _ => B1_1_6Law_sound u) (fun u _ a => B1_1_6Little_sound u ((stageBPriority (shape 1 1 6)) 1) a) 7 a +def CB1_1_6I1R7Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB1_1_6I1R7Certificates_valid : + CB1_1_6I1R7Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_1_6I1R7CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB1_1_6I1R7P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_1_6I1R7Certificates (CB1_1_6I1R7CertificateIndex a)).input +lemma CB1_1_6I1R7P_check : ∀ a : Fin 6, contains (CB1_1_6I1R7Raw a) (CB1_1_6I1R7P a) = true := by + decide +kernel +lemma CB1_1_6I1R7P_sound (a : Fin 6) : + (CB1_1_6I1R7P a).Encloses (CB1_1_6I1R7Value a) := + contains_sound (CB1_1_6I1R7Raw_sound a) (CB1_1_6I1R7P_check a) +def CB1_1_6I1R7Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_1_6I1R7Certificates (CB1_1_6I1R7CertificateIndex a)).output +lemma CB1_1_6I1R7Terms_sound (a : Fin 6) : + (CB1_1_6I1R7Terms a).Encloses (Foundation.entropyTerm (CB1_1_6I1R7Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_1_6I1R7Certificates_valid + (CB1_1_6I1R7CertificateIndex a) (CB1_1_6I1R7P_sound a) +def CB1_1_6I1R7Entropy : Ball := ⟨0, 0⟩ +lemma CB1_1_6I1R7Entropy_sound : CB1_1_6I1R7Entropy.Encloses (Foundation.finiteEntropy CB1_1_6I1R7Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_1_6I1R7Value CB1_1_6I1R7Terms CB1_1_6I1R7Terms_sound) (by decide +kernel) +def CB1_1_6I1R7Mass : Ball := ⟨0, 0⟩ +lemma CB1_1_6I1R7Mass_sound : CB1_1_6I1R7Mass.Encloses (∑ a, CB1_1_6I1R7Value a) := by + exact contains_sound (finSumBall_sound 6 CB1_1_6I1R7P CB1_1_6I1R7Value CB1_1_6I1R7P_sound) (by decide +kernel) +def CB1_1_6I1R7MassTerm : Ball := .exact 0 +lemma CB1_1_6I1R7MassTerm_sound : CB1_1_6I1R7MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_1_6I1R7Value a))) := + entropyTerm_zero_ball (CB1_1_6I1R7Mass_sound) +def CB1_1_6I1R7H : Ball := ⟨0, 0⟩ +lemma CB1_1_6I1R7H_sound : CB1_1_6I1R7H.Encloses (homogeneousEntropy CB1_1_6I1R7Value) := by + exact contains_sound (homogeneous_enclosed CB1_1_6I1R7Value CB1_1_6I1R7MassTerm_sound CB1_1_6I1R7Entropy_sound) (by decide +kernel) +def CB1_1_6I1R8Value (a : Fin 6) : ℝ := residualLaw (below (shape 1 1 6)) (fun u => (stageBLaw (shape 1 1 6) u : ℝ)) (stageBPriority (shape 1 1 6)) 1 (fun u a => (littleLaw (shape 1 1 6) u ((stageBPriority (shape 1 1 6)) 1) a : ℝ)) 8 a +def CB1_1_6I1R8Raw (a : Fin 6) : Ball := residualBall (below (shape 1 1 6)) B1_1_6Law (stageBPriority (shape 1 1 6)) 1 (fun u => B1_1_6Little u ((stageBPriority (shape 1 1 6)) 1)) 8 a +lemma CB1_1_6I1R8Raw_sound (a : Fin 6) : + (CB1_1_6I1R8Raw a).Encloses (CB1_1_6I1R8Value a) := by + exact residualBall_sound_on (below (shape 1 1 6)) B1_1_6Law (fun u => (stageBLaw (shape 1 1 6) u : ℝ)) (stageBPriority (shape 1 1 6)) 1 (fun u => B1_1_6Little u ((stageBPriority (shape 1 1 6)) 1)) (fun u a => (littleLaw (shape 1 1 6) u ((stageBPriority (shape 1 1 6)) 1) a : ℝ)) (fun u _ => B1_1_6Law_sound u) (fun u _ a => B1_1_6Little_sound u ((stageBPriority (shape 1 1 6)) 1) a) 8 a +def CB1_1_6I1R8Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB1_1_6I1R8Certificates_valid : + CB1_1_6I1R8Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_1_6I1R8CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB1_1_6I1R8P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_1_6I1R8Certificates (CB1_1_6I1R8CertificateIndex a)).input +lemma CB1_1_6I1R8P_check : ∀ a : Fin 6, contains (CB1_1_6I1R8Raw a) (CB1_1_6I1R8P a) = true := by + decide +kernel +lemma CB1_1_6I1R8P_sound (a : Fin 6) : + (CB1_1_6I1R8P a).Encloses (CB1_1_6I1R8Value a) := + contains_sound (CB1_1_6I1R8Raw_sound a) (CB1_1_6I1R8P_check a) +def CB1_1_6I1R8Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_1_6I1R8Certificates (CB1_1_6I1R8CertificateIndex a)).output +lemma CB1_1_6I1R8Terms_sound (a : Fin 6) : + (CB1_1_6I1R8Terms a).Encloses (Foundation.entropyTerm (CB1_1_6I1R8Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_1_6I1R8Certificates_valid + (CB1_1_6I1R8CertificateIndex a) (CB1_1_6I1R8P_sound a) +def CB1_1_6I1R8Entropy : Ball := ⟨0, 0⟩ +lemma CB1_1_6I1R8Entropy_sound : CB1_1_6I1R8Entropy.Encloses (Foundation.finiteEntropy CB1_1_6I1R8Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_1_6I1R8Value CB1_1_6I1R8Terms CB1_1_6I1R8Terms_sound) (by decide +kernel) +def CB1_1_6I1R8Mass : Ball := ⟨0, 0⟩ +lemma CB1_1_6I1R8Mass_sound : CB1_1_6I1R8Mass.Encloses (∑ a, CB1_1_6I1R8Value a) := by + exact contains_sound (finSumBall_sound 6 CB1_1_6I1R8P CB1_1_6I1R8Value CB1_1_6I1R8P_sound) (by decide +kernel) +def CB1_1_6I1R8MassTerm : Ball := .exact 0 +lemma CB1_1_6I1R8MassTerm_sound : CB1_1_6I1R8MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_1_6I1R8Value a))) := + entropyTerm_zero_ball (CB1_1_6I1R8Mass_sound) +def CB1_1_6I1R8H : Ball := ⟨0, 0⟩ +lemma CB1_1_6I1R8H_sound : CB1_1_6I1R8H.Encloses (homogeneousEntropy CB1_1_6I1R8Value) := by + exact contains_sound (homogeneous_enclosed CB1_1_6I1R8Value CB1_1_6I1R8MassTerm_sound CB1_1_6I1R8Entropy_sound) (by decide +kernel) +def CB1_1_6I1R9Value (a : Fin 6) : ℝ := residualLaw (below (shape 1 1 6)) (fun u => (stageBLaw (shape 1 1 6) u : ℝ)) (stageBPriority (shape 1 1 6)) 1 (fun u a => (littleLaw (shape 1 1 6) u ((stageBPriority (shape 1 1 6)) 1) a : ℝ)) 9 a +def CB1_1_6I1R9Raw (a : Fin 6) : Ball := residualBall (below (shape 1 1 6)) B1_1_6Law (stageBPriority (shape 1 1 6)) 1 (fun u => B1_1_6Little u ((stageBPriority (shape 1 1 6)) 1)) 9 a +lemma CB1_1_6I1R9Raw_sound (a : Fin 6) : + (CB1_1_6I1R9Raw a).Encloses (CB1_1_6I1R9Value a) := by + exact residualBall_sound_on (below (shape 1 1 6)) B1_1_6Law (fun u => (stageBLaw (shape 1 1 6) u : ℝ)) (stageBPriority (shape 1 1 6)) 1 (fun u => B1_1_6Little u ((stageBPriority (shape 1 1 6)) 1)) (fun u a => (littleLaw (shape 1 1 6) u ((stageBPriority (shape 1 1 6)) 1) a : ℝ)) (fun u _ => B1_1_6Law_sound u) (fun u _ a => B1_1_6Little_sound u ((stageBPriority (shape 1 1 6)) 1) a) 9 a +def CB1_1_6I1R9Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB1_1_6I1R9Certificates_valid : + CB1_1_6I1R9Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_1_6I1R9CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB1_1_6I1R9P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_1_6I1R9Certificates (CB1_1_6I1R9CertificateIndex a)).input +lemma CB1_1_6I1R9P_check : ∀ a : Fin 6, contains (CB1_1_6I1R9Raw a) (CB1_1_6I1R9P a) = true := by + decide +kernel +lemma CB1_1_6I1R9P_sound (a : Fin 6) : + (CB1_1_6I1R9P a).Encloses (CB1_1_6I1R9Value a) := + contains_sound (CB1_1_6I1R9Raw_sound a) (CB1_1_6I1R9P_check a) +def CB1_1_6I1R9Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_1_6I1R9Certificates (CB1_1_6I1R9CertificateIndex a)).output +lemma CB1_1_6I1R9Terms_sound (a : Fin 6) : + (CB1_1_6I1R9Terms a).Encloses (Foundation.entropyTerm (CB1_1_6I1R9Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_1_6I1R9Certificates_valid + (CB1_1_6I1R9CertificateIndex a) (CB1_1_6I1R9P_sound a) +def CB1_1_6I1R9Entropy : Ball := ⟨0, 0⟩ +lemma CB1_1_6I1R9Entropy_sound : CB1_1_6I1R9Entropy.Encloses (Foundation.finiteEntropy CB1_1_6I1R9Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_1_6I1R9Value CB1_1_6I1R9Terms CB1_1_6I1R9Terms_sound) (by decide +kernel) +def CB1_1_6I1R9Mass : Ball := ⟨0, 0⟩ +lemma CB1_1_6I1R9Mass_sound : CB1_1_6I1R9Mass.Encloses (∑ a, CB1_1_6I1R9Value a) := by + exact contains_sound (finSumBall_sound 6 CB1_1_6I1R9P CB1_1_6I1R9Value CB1_1_6I1R9P_sound) (by decide +kernel) +def CB1_1_6I1R9MassTerm : Ball := .exact 0 +lemma CB1_1_6I1R9MassTerm_sound : CB1_1_6I1R9MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_1_6I1R9Value a))) := + entropyTerm_zero_ball (CB1_1_6I1R9Mass_sound) +def CB1_1_6I1R9H : Ball := ⟨0, 0⟩ +lemma CB1_1_6I1R9H_sound : CB1_1_6I1R9H.Encloses (homogeneousEntropy CB1_1_6I1R9Value) := by + exact contains_sound (homogeneous_enclosed CB1_1_6I1R9Value CB1_1_6I1R9MassTerm_sound CB1_1_6I1R9Entropy_sound) (by decide +kernel) +def CB1_1_6I1R10Value (a : Fin 6) : ℝ := residualLaw (below (shape 1 1 6)) (fun u => (stageBLaw (shape 1 1 6) u : ℝ)) (stageBPriority (shape 1 1 6)) 1 (fun u a => (littleLaw (shape 1 1 6) u ((stageBPriority (shape 1 1 6)) 1) a : ℝ)) 10 a +def CB1_1_6I1R10Raw (a : Fin 6) : Ball := residualBall (below (shape 1 1 6)) B1_1_6Law (stageBPriority (shape 1 1 6)) 1 (fun u => B1_1_6Little u ((stageBPriority (shape 1 1 6)) 1)) 10 a +lemma CB1_1_6I1R10Raw_sound (a : Fin 6) : + (CB1_1_6I1R10Raw a).Encloses (CB1_1_6I1R10Value a) := by + exact residualBall_sound_on (below (shape 1 1 6)) B1_1_6Law (fun u => (stageBLaw (shape 1 1 6) u : ℝ)) (stageBPriority (shape 1 1 6)) 1 (fun u => B1_1_6Little u ((stageBPriority (shape 1 1 6)) 1)) (fun u a => (littleLaw (shape 1 1 6) u ((stageBPriority (shape 1 1 6)) 1) a : ℝ)) (fun u _ => B1_1_6Law_sound u) (fun u _ a => B1_1_6Little_sound u ((stageBPriority (shape 1 1 6)) 1) a) 10 a +def CB1_1_6I1R10Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB1_1_6I1R10Certificates_valid : + CB1_1_6I1R10Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_1_6I1R10CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB1_1_6I1R10P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_1_6I1R10Certificates (CB1_1_6I1R10CertificateIndex a)).input +lemma CB1_1_6I1R10P_check : ∀ a : Fin 6, contains (CB1_1_6I1R10Raw a) (CB1_1_6I1R10P a) = true := by + decide +kernel +lemma CB1_1_6I1R10P_sound (a : Fin 6) : + (CB1_1_6I1R10P a).Encloses (CB1_1_6I1R10Value a) := + contains_sound (CB1_1_6I1R10Raw_sound a) (CB1_1_6I1R10P_check a) +def CB1_1_6I1R10Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_1_6I1R10Certificates (CB1_1_6I1R10CertificateIndex a)).output +lemma CB1_1_6I1R10Terms_sound (a : Fin 6) : + (CB1_1_6I1R10Terms a).Encloses (Foundation.entropyTerm (CB1_1_6I1R10Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_1_6I1R10Certificates_valid + (CB1_1_6I1R10CertificateIndex a) (CB1_1_6I1R10P_sound a) +def CB1_1_6I1R10Entropy : Ball := ⟨0, 0⟩ +lemma CB1_1_6I1R10Entropy_sound : CB1_1_6I1R10Entropy.Encloses (Foundation.finiteEntropy CB1_1_6I1R10Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_1_6I1R10Value CB1_1_6I1R10Terms CB1_1_6I1R10Terms_sound) (by decide +kernel) +def CB1_1_6I1R10Mass : Ball := ⟨0, 0⟩ +lemma CB1_1_6I1R10Mass_sound : CB1_1_6I1R10Mass.Encloses (∑ a, CB1_1_6I1R10Value a) := by + exact contains_sound (finSumBall_sound 6 CB1_1_6I1R10P CB1_1_6I1R10Value CB1_1_6I1R10P_sound) (by decide +kernel) +def CB1_1_6I1R10MassTerm : Ball := .exact 0 +lemma CB1_1_6I1R10MassTerm_sound : CB1_1_6I1R10MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_1_6I1R10Value a))) := + entropyTerm_zero_ball (CB1_1_6I1R10Mass_sound) +def CB1_1_6I1R10H : Ball := ⟨0, 0⟩ +lemma CB1_1_6I1R10H_sound : CB1_1_6I1R10H.Encloses (homogeneousEntropy CB1_1_6I1R10Value) := by + exact contains_sound (homogeneous_enclosed CB1_1_6I1R10Value CB1_1_6I1R10MassTerm_sound CB1_1_6I1R10Entropy_sound) (by decide +kernel) +def CB1_1_6I1R11Value (a : Fin 6) : ℝ := residualLaw (below (shape 1 1 6)) (fun u => (stageBLaw (shape 1 1 6) u : ℝ)) (stageBPriority (shape 1 1 6)) 1 (fun u a => (littleLaw (shape 1 1 6) u ((stageBPriority (shape 1 1 6)) 1) a : ℝ)) 11 a +def CB1_1_6I1R11Raw (a : Fin 6) : Ball := residualBall (below (shape 1 1 6)) B1_1_6Law (stageBPriority (shape 1 1 6)) 1 (fun u => B1_1_6Little u ((stageBPriority (shape 1 1 6)) 1)) 11 a +lemma CB1_1_6I1R11Raw_sound (a : Fin 6) : + (CB1_1_6I1R11Raw a).Encloses (CB1_1_6I1R11Value a) := by + exact residualBall_sound_on (below (shape 1 1 6)) B1_1_6Law (fun u => (stageBLaw (shape 1 1 6) u : ℝ)) (stageBPriority (shape 1 1 6)) 1 (fun u => B1_1_6Little u ((stageBPriority (shape 1 1 6)) 1)) (fun u a => (littleLaw (shape 1 1 6) u ((stageBPriority (shape 1 1 6)) 1) a : ℝ)) (fun u _ => B1_1_6Law_sound u) (fun u _ a => B1_1_6Little_sound u ((stageBPriority (shape 1 1 6)) 1) a) 11 a +def CB1_1_6I1R11Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB1_1_6I1R11Certificates_valid : + CB1_1_6I1R11Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_1_6I1R11CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB1_1_6I1R11P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_1_6I1R11Certificates (CB1_1_6I1R11CertificateIndex a)).input +lemma CB1_1_6I1R11P_check : ∀ a : Fin 6, contains (CB1_1_6I1R11Raw a) (CB1_1_6I1R11P a) = true := by + decide +kernel +lemma CB1_1_6I1R11P_sound (a : Fin 6) : + (CB1_1_6I1R11P a).Encloses (CB1_1_6I1R11Value a) := + contains_sound (CB1_1_6I1R11Raw_sound a) (CB1_1_6I1R11P_check a) +def CB1_1_6I1R11Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_1_6I1R11Certificates (CB1_1_6I1R11CertificateIndex a)).output +lemma CB1_1_6I1R11Terms_sound (a : Fin 6) : + (CB1_1_6I1R11Terms a).Encloses (Foundation.entropyTerm (CB1_1_6I1R11Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_1_6I1R11Certificates_valid + (CB1_1_6I1R11CertificateIndex a) (CB1_1_6I1R11P_sound a) +def CB1_1_6I1R11Entropy : Ball := ⟨0, 0⟩ +lemma CB1_1_6I1R11Entropy_sound : CB1_1_6I1R11Entropy.Encloses (Foundation.finiteEntropy CB1_1_6I1R11Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_1_6I1R11Value CB1_1_6I1R11Terms CB1_1_6I1R11Terms_sound) (by decide +kernel) +def CB1_1_6I1R11Mass : Ball := ⟨0, 0⟩ +lemma CB1_1_6I1R11Mass_sound : CB1_1_6I1R11Mass.Encloses (∑ a, CB1_1_6I1R11Value a) := by + exact contains_sound (finSumBall_sound 6 CB1_1_6I1R11P CB1_1_6I1R11Value CB1_1_6I1R11P_sound) (by decide +kernel) +def CB1_1_6I1R11MassTerm : Ball := .exact 0 +lemma CB1_1_6I1R11MassTerm_sound : CB1_1_6I1R11MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_1_6I1R11Value a))) := + entropyTerm_zero_ball (CB1_1_6I1R11Mass_sound) +def CB1_1_6I1R11H : Ball := ⟨0, 0⟩ +lemma CB1_1_6I1R11H_sound : CB1_1_6I1R11H.Encloses (homogeneousEntropy CB1_1_6I1R11Value) := by + exact contains_sound (homogeneous_enclosed CB1_1_6I1R11Value CB1_1_6I1R11MassTerm_sound CB1_1_6I1R11Entropy_sound) (by decide +kernel) +def CB1_1_6I1R12Value (a : Fin 6) : ℝ := residualLaw (below (shape 1 1 6)) (fun u => (stageBLaw (shape 1 1 6) u : ℝ)) (stageBPriority (shape 1 1 6)) 1 (fun u a => (littleLaw (shape 1 1 6) u ((stageBPriority (shape 1 1 6)) 1) a : ℝ)) 12 a +def CB1_1_6I1R12Raw (a : Fin 6) : Ball := residualBall (below (shape 1 1 6)) B1_1_6Law (stageBPriority (shape 1 1 6)) 1 (fun u => B1_1_6Little u ((stageBPriority (shape 1 1 6)) 1)) 12 a +lemma CB1_1_6I1R12Raw_sound (a : Fin 6) : + (CB1_1_6I1R12Raw a).Encloses (CB1_1_6I1R12Value a) := by + exact residualBall_sound_on (below (shape 1 1 6)) B1_1_6Law (fun u => (stageBLaw (shape 1 1 6) u : ℝ)) (stageBPriority (shape 1 1 6)) 1 (fun u => B1_1_6Little u ((stageBPriority (shape 1 1 6)) 1)) (fun u a => (littleLaw (shape 1 1 6) u ((stageBPriority (shape 1 1 6)) 1) a : ℝ)) (fun u _ => B1_1_6Law_sound u) (fun u _ a => B1_1_6Little_sound u ((stageBPriority (shape 1 1 6)) 1) a) 12 a +def CB1_1_6I1R12Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB1_1_6I1R12Certificates_valid : + CB1_1_6I1R12Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_1_6I1R12CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB1_1_6I1R12P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_1_6I1R12Certificates (CB1_1_6I1R12CertificateIndex a)).input +lemma CB1_1_6I1R12P_check : ∀ a : Fin 6, contains (CB1_1_6I1R12Raw a) (CB1_1_6I1R12P a) = true := by + decide +kernel +lemma CB1_1_6I1R12P_sound (a : Fin 6) : + (CB1_1_6I1R12P a).Encloses (CB1_1_6I1R12Value a) := + contains_sound (CB1_1_6I1R12Raw_sound a) (CB1_1_6I1R12P_check a) +def CB1_1_6I1R12Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_1_6I1R12Certificates (CB1_1_6I1R12CertificateIndex a)).output +lemma CB1_1_6I1R12Terms_sound (a : Fin 6) : + (CB1_1_6I1R12Terms a).Encloses (Foundation.entropyTerm (CB1_1_6I1R12Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_1_6I1R12Certificates_valid + (CB1_1_6I1R12CertificateIndex a) (CB1_1_6I1R12P_sound a) +def CB1_1_6I1R12Entropy : Ball := ⟨0, 0⟩ +lemma CB1_1_6I1R12Entropy_sound : CB1_1_6I1R12Entropy.Encloses (Foundation.finiteEntropy CB1_1_6I1R12Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_1_6I1R12Value CB1_1_6I1R12Terms CB1_1_6I1R12Terms_sound) (by decide +kernel) +def CB1_1_6I1R12Mass : Ball := ⟨0, 0⟩ +lemma CB1_1_6I1R12Mass_sound : CB1_1_6I1R12Mass.Encloses (∑ a, CB1_1_6I1R12Value a) := by + exact contains_sound (finSumBall_sound 6 CB1_1_6I1R12P CB1_1_6I1R12Value CB1_1_6I1R12P_sound) (by decide +kernel) +def CB1_1_6I1R12MassTerm : Ball := .exact 0 +lemma CB1_1_6I1R12MassTerm_sound : CB1_1_6I1R12MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_1_6I1R12Value a))) := + entropyTerm_zero_ball (CB1_1_6I1R12Mass_sound) +def CB1_1_6I1R12H : Ball := ⟨0, 0⟩ +lemma CB1_1_6I1R12H_sound : CB1_1_6I1R12H.Encloses (homogeneousEntropy CB1_1_6I1R12Value) := by + exact contains_sound (homogeneous_enclosed CB1_1_6I1R12Value CB1_1_6I1R12MassTerm_sound CB1_1_6I1R12Entropy_sound) (by decide +kernel) +def CB1_1_6I1R13Value (a : Fin 6) : ℝ := residualLaw (below (shape 1 1 6)) (fun u => (stageBLaw (shape 1 1 6) u : ℝ)) (stageBPriority (shape 1 1 6)) 1 (fun u a => (littleLaw (shape 1 1 6) u ((stageBPriority (shape 1 1 6)) 1) a : ℝ)) 13 a +def CB1_1_6I1R13Raw (a : Fin 6) : Ball := residualBall (below (shape 1 1 6)) B1_1_6Law (stageBPriority (shape 1 1 6)) 1 (fun u => B1_1_6Little u ((stageBPriority (shape 1 1 6)) 1)) 13 a +lemma CB1_1_6I1R13Raw_sound (a : Fin 6) : + (CB1_1_6I1R13Raw a).Encloses (CB1_1_6I1R13Value a) := by + exact residualBall_sound_on (below (shape 1 1 6)) B1_1_6Law (fun u => (stageBLaw (shape 1 1 6) u : ℝ)) (stageBPriority (shape 1 1 6)) 1 (fun u => B1_1_6Little u ((stageBPriority (shape 1 1 6)) 1)) (fun u a => (littleLaw (shape 1 1 6) u ((stageBPriority (shape 1 1 6)) 1) a : ℝ)) (fun u _ => B1_1_6Law_sound u) (fun u _ a => B1_1_6Little_sound u ((stageBPriority (shape 1 1 6)) 1) a) 13 a +def CB1_1_6I1R13Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB1_1_6I1R13Certificates_valid : + CB1_1_6I1R13Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_1_6I1R13CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB1_1_6I1R13P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_1_6I1R13Certificates (CB1_1_6I1R13CertificateIndex a)).input +lemma CB1_1_6I1R13P_check : ∀ a : Fin 6, contains (CB1_1_6I1R13Raw a) (CB1_1_6I1R13P a) = true := by + decide +kernel +lemma CB1_1_6I1R13P_sound (a : Fin 6) : + (CB1_1_6I1R13P a).Encloses (CB1_1_6I1R13Value a) := + contains_sound (CB1_1_6I1R13Raw_sound a) (CB1_1_6I1R13P_check a) +def CB1_1_6I1R13Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_1_6I1R13Certificates (CB1_1_6I1R13CertificateIndex a)).output +lemma CB1_1_6I1R13Terms_sound (a : Fin 6) : + (CB1_1_6I1R13Terms a).Encloses (Foundation.entropyTerm (CB1_1_6I1R13Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_1_6I1R13Certificates_valid + (CB1_1_6I1R13CertificateIndex a) (CB1_1_6I1R13P_sound a) +def CB1_1_6I1R13Entropy : Ball := ⟨0, 0⟩ +lemma CB1_1_6I1R13Entropy_sound : CB1_1_6I1R13Entropy.Encloses (Foundation.finiteEntropy CB1_1_6I1R13Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_1_6I1R13Value CB1_1_6I1R13Terms CB1_1_6I1R13Terms_sound) (by decide +kernel) +def CB1_1_6I1R13Mass : Ball := ⟨0, 0⟩ +lemma CB1_1_6I1R13Mass_sound : CB1_1_6I1R13Mass.Encloses (∑ a, CB1_1_6I1R13Value a) := by + exact contains_sound (finSumBall_sound 6 CB1_1_6I1R13P CB1_1_6I1R13Value CB1_1_6I1R13P_sound) (by decide +kernel) +def CB1_1_6I1R13MassTerm : Ball := .exact 0 +lemma CB1_1_6I1R13MassTerm_sound : CB1_1_6I1R13MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_1_6I1R13Value a))) := + entropyTerm_zero_ball (CB1_1_6I1R13Mass_sound) +def CB1_1_6I1R13H : Ball := ⟨0, 0⟩ +lemma CB1_1_6I1R13H_sound : CB1_1_6I1R13H.Encloses (homogeneousEntropy CB1_1_6I1R13Value) := by + exact contains_sound (homogeneous_enclosed CB1_1_6I1R13Value CB1_1_6I1R13MassTerm_sound CB1_1_6I1R13Entropy_sound) (by decide +kernel) +def CB1_1_6I1R14Value (a : Fin 6) : ℝ := residualLaw (below (shape 1 1 6)) (fun u => (stageBLaw (shape 1 1 6) u : ℝ)) (stageBPriority (shape 1 1 6)) 1 (fun u a => (littleLaw (shape 1 1 6) u ((stageBPriority (shape 1 1 6)) 1) a : ℝ)) 14 a +def CB1_1_6I1R14Raw (a : Fin 6) : Ball := residualBall (below (shape 1 1 6)) B1_1_6Law (stageBPriority (shape 1 1 6)) 1 (fun u => B1_1_6Little u ((stageBPriority (shape 1 1 6)) 1)) 14 a +lemma CB1_1_6I1R14Raw_sound (a : Fin 6) : + (CB1_1_6I1R14Raw a).Encloses (CB1_1_6I1R14Value a) := by + exact residualBall_sound_on (below (shape 1 1 6)) B1_1_6Law (fun u => (stageBLaw (shape 1 1 6) u : ℝ)) (stageBPriority (shape 1 1 6)) 1 (fun u => B1_1_6Little u ((stageBPriority (shape 1 1 6)) 1)) (fun u a => (littleLaw (shape 1 1 6) u ((stageBPriority (shape 1 1 6)) 1) a : ℝ)) (fun u _ => B1_1_6Law_sound u) (fun u _ a => B1_1_6Little_sound u ((stageBPriority (shape 1 1 6)) 1) a) 14 a +def CB1_1_6I1R14Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB1_1_6I1R14Certificates_valid : + CB1_1_6I1R14Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_1_6I1R14CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB1_1_6I1R14P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_1_6I1R14Certificates (CB1_1_6I1R14CertificateIndex a)).input +lemma CB1_1_6I1R14P_check : ∀ a : Fin 6, contains (CB1_1_6I1R14Raw a) (CB1_1_6I1R14P a) = true := by + decide +kernel +lemma CB1_1_6I1R14P_sound (a : Fin 6) : + (CB1_1_6I1R14P a).Encloses (CB1_1_6I1R14Value a) := + contains_sound (CB1_1_6I1R14Raw_sound a) (CB1_1_6I1R14P_check a) +def CB1_1_6I1R14Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_1_6I1R14Certificates (CB1_1_6I1R14CertificateIndex a)).output +lemma CB1_1_6I1R14Terms_sound (a : Fin 6) : + (CB1_1_6I1R14Terms a).Encloses (Foundation.entropyTerm (CB1_1_6I1R14Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_1_6I1R14Certificates_valid + (CB1_1_6I1R14CertificateIndex a) (CB1_1_6I1R14P_sound a) +def CB1_1_6I1R14Entropy : Ball := ⟨0, 0⟩ +lemma CB1_1_6I1R14Entropy_sound : CB1_1_6I1R14Entropy.Encloses (Foundation.finiteEntropy CB1_1_6I1R14Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_1_6I1R14Value CB1_1_6I1R14Terms CB1_1_6I1R14Terms_sound) (by decide +kernel) +def CB1_1_6I1R14Mass : Ball := ⟨0, 0⟩ +lemma CB1_1_6I1R14Mass_sound : CB1_1_6I1R14Mass.Encloses (∑ a, CB1_1_6I1R14Value a) := by + exact contains_sound (finSumBall_sound 6 CB1_1_6I1R14P CB1_1_6I1R14Value CB1_1_6I1R14P_sound) (by decide +kernel) +def CB1_1_6I1R14MassTerm : Ball := .exact 0 +lemma CB1_1_6I1R14MassTerm_sound : CB1_1_6I1R14MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_1_6I1R14Value a))) := + entropyTerm_zero_ball (CB1_1_6I1R14Mass_sound) +def CB1_1_6I1R14H : Ball := ⟨0, 0⟩ +lemma CB1_1_6I1R14H_sound : CB1_1_6I1R14H.Encloses (homogeneousEntropy CB1_1_6I1R14Value) := by + exact contains_sound (homogeneous_enclosed CB1_1_6I1R14Value CB1_1_6I1R14MassTerm_sound CB1_1_6I1R14Entropy_sound) (by decide +kernel) +def CB1_1_6I1R15Value (a : Fin 6) : ℝ := residualLaw (below (shape 1 1 6)) (fun u => (stageBLaw (shape 1 1 6) u : ℝ)) (stageBPriority (shape 1 1 6)) 1 (fun u a => (littleLaw (shape 1 1 6) u ((stageBPriority (shape 1 1 6)) 1) a : ℝ)) 15 a +def CB1_1_6I1R15Raw (a : Fin 6) : Ball := residualBall (below (shape 1 1 6)) B1_1_6Law (stageBPriority (shape 1 1 6)) 1 (fun u => B1_1_6Little u ((stageBPriority (shape 1 1 6)) 1)) 15 a +lemma CB1_1_6I1R15Raw_sound (a : Fin 6) : + (CB1_1_6I1R15Raw a).Encloses (CB1_1_6I1R15Value a) := by + exact residualBall_sound_on (below (shape 1 1 6)) B1_1_6Law (fun u => (stageBLaw (shape 1 1 6) u : ℝ)) (stageBPriority (shape 1 1 6)) 1 (fun u => B1_1_6Little u ((stageBPriority (shape 1 1 6)) 1)) (fun u a => (littleLaw (shape 1 1 6) u ((stageBPriority (shape 1 1 6)) 1) a : ℝ)) (fun u _ => B1_1_6Law_sound u) (fun u _ a => B1_1_6Little_sound u ((stageBPriority (shape 1 1 6)) 1) a) 15 a +def CB1_1_6I1R15Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB1_1_6I1R15Certificates_valid : + CB1_1_6I1R15Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_1_6I1R15CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB1_1_6I1R15P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_1_6I1R15Certificates (CB1_1_6I1R15CertificateIndex a)).input +lemma CB1_1_6I1R15P_check : ∀ a : Fin 6, contains (CB1_1_6I1R15Raw a) (CB1_1_6I1R15P a) = true := by + decide +kernel +lemma CB1_1_6I1R15P_sound (a : Fin 6) : + (CB1_1_6I1R15P a).Encloses (CB1_1_6I1R15Value a) := + contains_sound (CB1_1_6I1R15Raw_sound a) (CB1_1_6I1R15P_check a) +def CB1_1_6I1R15Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_1_6I1R15Certificates (CB1_1_6I1R15CertificateIndex a)).output +lemma CB1_1_6I1R15Terms_sound (a : Fin 6) : + (CB1_1_6I1R15Terms a).Encloses (Foundation.entropyTerm (CB1_1_6I1R15Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_1_6I1R15Certificates_valid + (CB1_1_6I1R15CertificateIndex a) (CB1_1_6I1R15P_sound a) +def CB1_1_6I1R15Entropy : Ball := ⟨0, 0⟩ +lemma CB1_1_6I1R15Entropy_sound : CB1_1_6I1R15Entropy.Encloses (Foundation.finiteEntropy CB1_1_6I1R15Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_1_6I1R15Value CB1_1_6I1R15Terms CB1_1_6I1R15Terms_sound) (by decide +kernel) +def CB1_1_6I1R15Mass : Ball := ⟨0, 0⟩ +lemma CB1_1_6I1R15Mass_sound : CB1_1_6I1R15Mass.Encloses (∑ a, CB1_1_6I1R15Value a) := by + exact contains_sound (finSumBall_sound 6 CB1_1_6I1R15P CB1_1_6I1R15Value CB1_1_6I1R15P_sound) (by decide +kernel) +def CB1_1_6I1R15MassTerm : Ball := .exact 0 +lemma CB1_1_6I1R15MassTerm_sound : CB1_1_6I1R15MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_1_6I1R15Value a))) := + entropyTerm_zero_ball (CB1_1_6I1R15Mass_sound) +def CB1_1_6I1R15H : Ball := ⟨0, 0⟩ +lemma CB1_1_6I1R15H_sound : CB1_1_6I1R15H.Encloses (homogeneousEntropy CB1_1_6I1R15Value) := by + exact contains_sound (homogeneous_enclosed CB1_1_6I1R15Value CB1_1_6I1R15MassTerm_sound CB1_1_6I1R15Entropy_sound) (by decide +kernel) +def CB1_1_6I1R16Value (a : Fin 6) : ℝ := residualLaw (below (shape 1 1 6)) (fun u => (stageBLaw (shape 1 1 6) u : ℝ)) (stageBPriority (shape 1 1 6)) 1 (fun u a => (littleLaw (shape 1 1 6) u ((stageBPriority (shape 1 1 6)) 1) a : ℝ)) 16 a +def CB1_1_6I1R16Raw (a : Fin 6) : Ball := residualBall (below (shape 1 1 6)) B1_1_6Law (stageBPriority (shape 1 1 6)) 1 (fun u => B1_1_6Little u ((stageBPriority (shape 1 1 6)) 1)) 16 a +lemma CB1_1_6I1R16Raw_sound (a : Fin 6) : + (CB1_1_6I1R16Raw a).Encloses (CB1_1_6I1R16Value a) := by + exact residualBall_sound_on (below (shape 1 1 6)) B1_1_6Law (fun u => (stageBLaw (shape 1 1 6) u : ℝ)) (stageBPriority (shape 1 1 6)) 1 (fun u => B1_1_6Little u ((stageBPriority (shape 1 1 6)) 1)) (fun u a => (littleLaw (shape 1 1 6) u ((stageBPriority (shape 1 1 6)) 1) a : ℝ)) (fun u _ => B1_1_6Law_sound u) (fun u _ a => B1_1_6Little_sound u ((stageBPriority (shape 1 1 6)) 1) a) 16 a +def CB1_1_6I1R16Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB1_1_6I1R16Certificates_valid : + CB1_1_6I1R16Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_1_6I1R16CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB1_1_6I1R16P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_1_6I1R16Certificates (CB1_1_6I1R16CertificateIndex a)).input +lemma CB1_1_6I1R16P_check : ∀ a : Fin 6, contains (CB1_1_6I1R16Raw a) (CB1_1_6I1R16P a) = true := by + decide +kernel +lemma CB1_1_6I1R16P_sound (a : Fin 6) : + (CB1_1_6I1R16P a).Encloses (CB1_1_6I1R16Value a) := + contains_sound (CB1_1_6I1R16Raw_sound a) (CB1_1_6I1R16P_check a) +def CB1_1_6I1R16Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_1_6I1R16Certificates (CB1_1_6I1R16CertificateIndex a)).output +lemma CB1_1_6I1R16Terms_sound (a : Fin 6) : + (CB1_1_6I1R16Terms a).Encloses (Foundation.entropyTerm (CB1_1_6I1R16Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_1_6I1R16Certificates_valid + (CB1_1_6I1R16CertificateIndex a) (CB1_1_6I1R16P_sound a) +def CB1_1_6I1R16Entropy : Ball := ⟨0, 0⟩ +lemma CB1_1_6I1R16Entropy_sound : CB1_1_6I1R16Entropy.Encloses (Foundation.finiteEntropy CB1_1_6I1R16Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_1_6I1R16Value CB1_1_6I1R16Terms CB1_1_6I1R16Terms_sound) (by decide +kernel) +def CB1_1_6I1R16Mass : Ball := ⟨0, 0⟩ +lemma CB1_1_6I1R16Mass_sound : CB1_1_6I1R16Mass.Encloses (∑ a, CB1_1_6I1R16Value a) := by + exact contains_sound (finSumBall_sound 6 CB1_1_6I1R16P CB1_1_6I1R16Value CB1_1_6I1R16P_sound) (by decide +kernel) +def CB1_1_6I1R16MassTerm : Ball := .exact 0 +lemma CB1_1_6I1R16MassTerm_sound : CB1_1_6I1R16MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_1_6I1R16Value a))) := + entropyTerm_zero_ball (CB1_1_6I1R16Mass_sound) +def CB1_1_6I1R16H : Ball := ⟨0, 0⟩ +lemma CB1_1_6I1R16H_sound : CB1_1_6I1R16H.Encloses (homogeneousEntropy CB1_1_6I1R16Value) := by + exact contains_sound (homogeneous_enclosed CB1_1_6I1R16Value CB1_1_6I1R16MassTerm_sound CB1_1_6I1R16Entropy_sound) (by decide +kernel) +def CB1_1_6I1ResidualEntropies (a : Fin 17) : Ball := + match a.val with + | 0 => CB1_1_6I1R0H + | 1 => CB1_1_6I1R1H + | 2 => CB1_1_6I1R2H + | 3 => CB1_1_6I1R3H + | 4 => CB1_1_6I1R4H + | 5 => CB1_1_6I1R5H + | 6 => CB1_1_6I1R6H + | 7 => CB1_1_6I1R7H + | 8 => CB1_1_6I1R8H + | 9 => CB1_1_6I1R9H + | 10 => CB1_1_6I1R10H + | 11 => CB1_1_6I1R11H + | 12 => CB1_1_6I1R12H + | 13 => CB1_1_6I1R13H + | 14 => CB1_1_6I1R14H + | 15 => CB1_1_6I1R15H + | 16 => CB1_1_6I1R16H + | _ => (.exact 0) +lemma CB1_1_6I1ResidualEntropies_sound (k : Fin 17) : + (CB1_1_6I1ResidualEntropies k).Encloses (homogeneousEntropy + (residualLaw (below (shape 1 1 6)) (fun u => (stageBLaw (shape 1 1 6) u : ℝ)) (stageBPriority (shape 1 1 6)) 1 (fun u a => (littleLaw (shape 1 1 6) u ((stageBPriority (shape 1 1 6)) 1) a : ℝ)) k)) := by + fin_cases k + · exact CB1_1_6I1R0H_sound + · exact CB1_1_6I1R1H_sound + · exact CB1_1_6I1R2H_sound + · exact CB1_1_6I1R3H_sound + · exact CB1_1_6I1R4H_sound + · exact CB1_1_6I1R5H_sound + · exact CB1_1_6I1R6H_sound + · exact CB1_1_6I1R7H_sound + · exact CB1_1_6I1R8H_sound + · exact CB1_1_6I1R9H_sound + · exact CB1_1_6I1R10H_sound + · exact CB1_1_6I1R11H_sound + · exact CB1_1_6I1R12H_sound + · exact CB1_1_6I1R13H_sound + · exact CB1_1_6I1R14H_sound + · exact CB1_1_6I1R15H_sound + · exact CB1_1_6I1R16H_sound +def CB1_1_6I1Singles (s : Shape) : Ball := + match s 0, s 1, s 2 with + | _, _, _ => (.exact 0) +lemma CB1_1_6I1Singles_sound (u : Shape) (hu : u ∈ below (shape 1 1 6)) + (hd : designated (stageBPriority (shape 1 1 6)) 1 u) : + (CB1_1_6I1Singles u).Encloses (homogeneousEntropy ((fun u a => (littleLaw (shape 1 1 6) u ((stageBPriority (shape 1 1 6)) 1) a : ℝ)) u)) := by + rw [B1_1_6_below] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl + · exact (show ¬ designated (stageBPriority (shape 1 1 6)) 1 (shape 0 0 4) by decide +kernel) hd |>.elim + · exact (show ¬ designated (stageBPriority (shape 1 1 6)) 1 (shape 0 1 3) by decide +kernel) hd |>.elim + · exact (show ¬ designated (stageBPriority (shape 1 1 6)) 1 (shape 1 0 3) by decide +kernel) hd |>.elim + · exact (show ¬ designated (stageBPriority (shape 1 1 6)) 1 (shape 1 1 2) by decide +kernel) hd |>.elim +def CB1_1_6I1Singleton : Ball := ⟨0, 0⟩ +lemma CB1_1_6I1Singleton_sound : CB1_1_6I1Singleton.Encloses + (singletonEntropy (below (shape 1 1 6)) (fun u => (stageBLaw (shape 1 1 6) u : ℝ)) (stageBPriority (shape 1 1 6)) 1 (fun u a => (littleLaw (shape 1 1 6) u ((stageBPriority (shape 1 1 6)) 1) a : ℝ))) := by + exact contains_sound (singletonBall_sound (below (shape 1 1 6)) B1_1_6Law (fun u => (stageBLaw (shape 1 1 6) u : ℝ)) (stageBPriority (shape 1 1 6)) 1 + CB1_1_6I1Singles (fun u a => (littleLaw (shape 1 1 6) u ((stageBPriority (shape 1 1 6)) 1) a : ℝ)) (fun u _ => B1_1_6Law_sound u) CB1_1_6I1Singles_sound) (by decide +kernel) +def CB1_1_6I1Group : Ball := ⟨0, (21175823693 / 25000000000000000000000000000000)⟩ +lemma CB1_1_6I1Group_sound : CB1_1_6I1Group.Encloses + (groupedEntropy (below (shape 1 1 6)) (fun u => (stageBLaw (shape 1 1 6) u : ℝ)) (stageBPriority (shape 1 1 6)) 1 (fun u a => (littleLaw (shape 1 1 6) u ((stageBPriority (shape 1 1 6)) 1) a : ℝ))) := by + exact contains_sound (Ball.add_sound CB1_1_6I1Singleton_sound + (finSumBall_sound 17 CB1_1_6I1ResidualEntropies _ CB1_1_6I1ResidualEntropies_sound)) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CB1_1_6I1H : Ball := ⟨(6931471805599453094172319305033 / 10000000000000000000000000000000), (372694497 / 160000000000000000000000000000)⟩ +lemma CB1_1_6I1_sound : CB1_1_6I1H.Encloses (stageBCapacity (shape 1 1 6) 1) := by + have hb := contains_sound (Ball.add_sound CB1_1_6I1PairH_sound + (Ball.neg_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) CB1_1_6I1Group_sound))) + (show contains (.add CB1_1_6I1PairH (.neg (.mul (.exact 2) CB1_1_6I1Group))) CB1_1_6I1H = true by decide +kernel) + unfold CB1_1_6I1PairValue at hb + simpa only [stageBCapacity, nativeCapacity, + show (1 : Fin 3) ≠ 0 by decide, ite_false, sub_eq_add_neg] using hb + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/CapacityB/CapB1_1_6I2.lean b/lean/OAI/LinearAlgebra/MatrixFields/CapacityB/CapB1_1_6I2.lean new file mode 100644 index 0000000000000000000000000000000000000000..d7aa2bad919e92aaf428a48e1cc015dcc26ced06 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/CapacityB/CapB1_1_6I2.lean @@ -0,0 +1,931 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Certificates.LittleB1_3_4 + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CB1_1_6I2PairValue (a : PairSlot) : ℝ := pairLaw (below (shape 1 1 6)) (shape 1 1 6) (fun u => (stageBLaw (shape 1 1 6) u : ℝ)) (fun u a => (littleLaw (shape 1 1 6) u ((stageBPriority (shape 1 1 6)) 2) a : ℝ)) a +def CB1_1_6I2PairRaw (a : PairSlot) : Ball := pairLawBall (below (shape 1 1 6)) (shape 1 1 6) B1_1_6Law (fun u => B1_1_6Little u ((stageBPriority (shape 1 1 6)) 2)) a +lemma CB1_1_6I2PairRaw_sound (a : PairSlot) : + (CB1_1_6I2PairRaw a).Encloses (CB1_1_6I2PairValue a) := by + exact pairLawBall_sound_on (below (shape 1 1 6)) (shape 1 1 6) B1_1_6Law (fun u => (stageBLaw (shape 1 1 6) u : ℝ)) (fun u => B1_1_6Little u ((stageBPriority (shape 1 1 6)) 2)) (fun u a => (littleLaw (shape 1 1 6) u ((stageBPriority (shape 1 1 6)) 2) a : ℝ)) (fun u _ => B1_1_6Law_sound u) (fun u _ a => B1_1_6Little_sound u ((stageBPriority (shape 1 1 6)) 2) a) (fun u _ a => B1_1_6Little_sound (complement (shape 1 1 6) u) ((stageBPriority (shape 1 1 6)) 2) a) a +def CB1_1_6I2PairCertificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(23395434846455848905473447711 / 2500000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ ⟨(4371675727663221785883191262821 / 100000000000000000000000000000000), (792668177 / 50000000000000000000000000000000)⟩ ⟨(-233575254977868181319062728355239 / 50000000000000000000000000000000), (169406589891 / 100000000000000000000000000000000)⟩ ⟨-7, 23395434846455848905473447711, 19531250000000000000000000000⟩, + .log ⟨(58960210306318037278141611 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(3382858086791820938049931 / 400000000000000000000000000000), (274693 / 100000000000000000000000000000000)⟩ ⟨(-717190896457276084482745932971173 / 50000000000000000000000000000000), (93173963417 / 20000000000000000000000000000000)⟩ ⟨-21, 58960210306318037278141611, 47683715820312500000000000⟩, + .log ⟨(49064123645931459725743783949949 / 50000000000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ ⟨(185412508919469716229830236443 / 10000000000000000000000000000000), (20779464633 / 50000000000000000000000000000000)⟩ ⟨(-1889491701283496402558489780081 / 100000000000000000000000000000000), (10587911843 / 25000000000000000000000000000000)⟩ ⟨-1, 49064123645931459725743783949949, 25000000000000000000000000000000⟩] +lemma CB1_1_6I2PairCertificates_valid : + CB1_1_6I2PairCertificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_1_6I2PairCertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 5, 2 => 1 + | 5, 3 => 2 + | 4, 4 => 3 + | 2, 5 => 1 + | 3, 5 => 2 + | _, _ => 0 +def CB1_1_6I2PairP (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CB1_1_6I2PairCertificates (CB1_1_6I2PairCertificateIndex a)).input +lemma CB1_1_6I2PairP_check : ∀ a : PairSlot, contains (CB1_1_6I2PairRaw a) (CB1_1_6I2PairP a) = true := by + decide +kernel +lemma CB1_1_6I2PairP_sound (a : PairSlot) : + (CB1_1_6I2PairP a).Encloses (CB1_1_6I2PairValue a) := + contains_sound (CB1_1_6I2PairRaw_sound a) (CB1_1_6I2PairP_check a) +def CB1_1_6I2PairTerms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CB1_1_6I2PairCertificates (CB1_1_6I2PairCertificateIndex a)).output +lemma CB1_1_6I2PairTerms_sound (a : PairSlot) : + (CB1_1_6I2PairTerms a).Encloses (Foundation.entropyTerm (CB1_1_6I2PairValue a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_1_6I2PairCertificates_valid + (CB1_1_6I2PairCertificateIndex a) (CB1_1_6I2PairP_sound a) +def CB1_1_6I2PairEntropy : Ball := ⟨(2649791993391134161133427463893 / 25000000000000000000000000000000), (139781723 / 312500000000000000000000000000)⟩ +lemma CB1_1_6I2PairEntropy_sound : CB1_1_6I2PairEntropy.Encloses (Foundation.finiteEntropy CB1_1_6I2PairValue) := by + exact contains_sound (entropyPair_enclosed CB1_1_6I2PairValue CB1_1_6I2PairTerms CB1_1_6I2PairTerms_sound) (by decide +kernel) +def CB1_1_6I2PairMass : Ball := ⟨1, (1 / 6250000000000000000000000000000)⟩ +lemma CB1_1_6I2PairMass_sound : CB1_1_6I2PairMass.Encloses (∑ a, CB1_1_6I2PairValue a) := by + exact contains_sound (pairSumBall_sound CB1_1_6I2PairP CB1_1_6I2PairValue CB1_1_6I2PairP_sound) (by decide +kernel) +def CB1_1_6I2PairMassTermLogWitness : LogWitness := ⟨0, 1, 1⟩ +def CB1_1_6I2PairMassTermLog : Ball := ⟨0, (10587911849 / 50000000000000000000000000000000)⟩ +lemma CB1_1_6I2PairMassTermLog_sound : CB1_1_6I2PairMassTermLog.Encloses (Real.log ((∑ a, CB1_1_6I2PairValue a))) := by + exact checkLog_sound logTwoBall_sound (CB1_1_6I2PairMass_sound) (w := CB1_1_6I2PairMassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB1_1_6I2PairMassTerm : Ball := ⟨0, (21175823699 / 100000000000000000000000000000000)⟩ +lemma CB1_1_6I2PairMassTerm_sound : CB1_1_6I2PairMassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_1_6I2PairValue a))) := by + exact contains_sound (entropyTerm_ball (CB1_1_6I2PairMass_sound) CB1_1_6I2PairMassTermLog_sound) (by decide +kernel) +def CB1_1_6I2PairH : Ball := ⟨(2649791993391134161133427463893 / 25000000000000000000000000000000), (65905975059 / 100000000000000000000000000000000)⟩ +lemma CB1_1_6I2PairH_sound : CB1_1_6I2PairH.Encloses (homogeneousEntropy CB1_1_6I2PairValue) := by + exact contains_sound (homogeneous_enclosed CB1_1_6I2PairValue CB1_1_6I2PairMassTerm_sound CB1_1_6I2PairEntropy_sound) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CB1_1_6I2R0Value (a : Fin 6) : ℝ := residualLaw (below (shape 1 1 6)) (fun u => (stageBLaw (shape 1 1 6) u : ℝ)) (stageBPriority (shape 1 1 6)) 2 (fun u a => (littleLaw (shape 1 1 6) u ((stageBPriority (shape 1 1 6)) 2) a : ℝ)) 0 a +def CB1_1_6I2R0Raw (a : Fin 6) : Ball := residualBall (below (shape 1 1 6)) B1_1_6Law (stageBPriority (shape 1 1 6)) 2 (fun u => B1_1_6Little u ((stageBPriority (shape 1 1 6)) 2)) 0 a +lemma CB1_1_6I2R0Raw_sound (a : Fin 6) : + (CB1_1_6I2R0Raw a).Encloses (CB1_1_6I2R0Value a) := by + exact residualBall_sound_on (below (shape 1 1 6)) B1_1_6Law (fun u => (stageBLaw (shape 1 1 6) u : ℝ)) (stageBPriority (shape 1 1 6)) 2 (fun u => B1_1_6Little u ((stageBPriority (shape 1 1 6)) 2)) (fun u a => (littleLaw (shape 1 1 6) u ((stageBPriority (shape 1 1 6)) 2) a : ℝ)) (fun u _ => B1_1_6Law_sound u) (fun u _ a => B1_1_6Little_sound u ((stageBPriority (shape 1 1 6)) 2) a) 0 a +def CB1_1_6I2R0Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB1_1_6I2R0Certificates_valid : + CB1_1_6I2R0Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_1_6I2R0CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB1_1_6I2R0P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_1_6I2R0Certificates (CB1_1_6I2R0CertificateIndex a)).input +lemma CB1_1_6I2R0P_check : ∀ a : Fin 6, contains (CB1_1_6I2R0Raw a) (CB1_1_6I2R0P a) = true := by + decide +kernel +lemma CB1_1_6I2R0P_sound (a : Fin 6) : + (CB1_1_6I2R0P a).Encloses (CB1_1_6I2R0Value a) := + contains_sound (CB1_1_6I2R0Raw_sound a) (CB1_1_6I2R0P_check a) +def CB1_1_6I2R0Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_1_6I2R0Certificates (CB1_1_6I2R0CertificateIndex a)).output +lemma CB1_1_6I2R0Terms_sound (a : Fin 6) : + (CB1_1_6I2R0Terms a).Encloses (Foundation.entropyTerm (CB1_1_6I2R0Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_1_6I2R0Certificates_valid + (CB1_1_6I2R0CertificateIndex a) (CB1_1_6I2R0P_sound a) +def CB1_1_6I2R0Entropy : Ball := ⟨0, 0⟩ +lemma CB1_1_6I2R0Entropy_sound : CB1_1_6I2R0Entropy.Encloses (Foundation.finiteEntropy CB1_1_6I2R0Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_1_6I2R0Value CB1_1_6I2R0Terms CB1_1_6I2R0Terms_sound) (by decide +kernel) +def CB1_1_6I2R0Mass : Ball := ⟨0, 0⟩ +lemma CB1_1_6I2R0Mass_sound : CB1_1_6I2R0Mass.Encloses (∑ a, CB1_1_6I2R0Value a) := by + exact contains_sound (finSumBall_sound 6 CB1_1_6I2R0P CB1_1_6I2R0Value CB1_1_6I2R0P_sound) (by decide +kernel) +def CB1_1_6I2R0MassTerm : Ball := .exact 0 +lemma CB1_1_6I2R0MassTerm_sound : CB1_1_6I2R0MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_1_6I2R0Value a))) := + entropyTerm_zero_ball (CB1_1_6I2R0Mass_sound) +def CB1_1_6I2R0H : Ball := ⟨0, 0⟩ +lemma CB1_1_6I2R0H_sound : CB1_1_6I2R0H.Encloses (homogeneousEntropy CB1_1_6I2R0Value) := by + exact contains_sound (homogeneous_enclosed CB1_1_6I2R0Value CB1_1_6I2R0MassTerm_sound CB1_1_6I2R0Entropy_sound) (by decide +kernel) +def CB1_1_6I2R1Value (a : Fin 6) : ℝ := residualLaw (below (shape 1 1 6)) (fun u => (stageBLaw (shape 1 1 6) u : ℝ)) (stageBPriority (shape 1 1 6)) 2 (fun u a => (littleLaw (shape 1 1 6) u ((stageBPriority (shape 1 1 6)) 2) a : ℝ)) 1 a +def CB1_1_6I2R1Raw (a : Fin 6) : Ball := residualBall (below (shape 1 1 6)) B1_1_6Law (stageBPriority (shape 1 1 6)) 2 (fun u => B1_1_6Little u ((stageBPriority (shape 1 1 6)) 2)) 1 a +lemma CB1_1_6I2R1Raw_sound (a : Fin 6) : + (CB1_1_6I2R1Raw a).Encloses (CB1_1_6I2R1Value a) := by + exact residualBall_sound_on (below (shape 1 1 6)) B1_1_6Law (fun u => (stageBLaw (shape 1 1 6) u : ℝ)) (stageBPriority (shape 1 1 6)) 2 (fun u => B1_1_6Little u ((stageBPriority (shape 1 1 6)) 2)) (fun u a => (littleLaw (shape 1 1 6) u ((stageBPriority (shape 1 1 6)) 2) a : ℝ)) (fun u _ => B1_1_6Law_sound u) (fun u _ a => B1_1_6Little_sound u ((stageBPriority (shape 1 1 6)) 2) a) 1 a +def CB1_1_6I2R1Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB1_1_6I2R1Certificates_valid : + CB1_1_6I2R1Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_1_6I2R1CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB1_1_6I2R1P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_1_6I2R1Certificates (CB1_1_6I2R1CertificateIndex a)).input +lemma CB1_1_6I2R1P_check : ∀ a : Fin 6, contains (CB1_1_6I2R1Raw a) (CB1_1_6I2R1P a) = true := by + decide +kernel +lemma CB1_1_6I2R1P_sound (a : Fin 6) : + (CB1_1_6I2R1P a).Encloses (CB1_1_6I2R1Value a) := + contains_sound (CB1_1_6I2R1Raw_sound a) (CB1_1_6I2R1P_check a) +def CB1_1_6I2R1Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_1_6I2R1Certificates (CB1_1_6I2R1CertificateIndex a)).output +lemma CB1_1_6I2R1Terms_sound (a : Fin 6) : + (CB1_1_6I2R1Terms a).Encloses (Foundation.entropyTerm (CB1_1_6I2R1Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_1_6I2R1Certificates_valid + (CB1_1_6I2R1CertificateIndex a) (CB1_1_6I2R1P_sound a) +def CB1_1_6I2R1Entropy : Ball := ⟨0, 0⟩ +lemma CB1_1_6I2R1Entropy_sound : CB1_1_6I2R1Entropy.Encloses (Foundation.finiteEntropy CB1_1_6I2R1Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_1_6I2R1Value CB1_1_6I2R1Terms CB1_1_6I2R1Terms_sound) (by decide +kernel) +def CB1_1_6I2R1Mass : Ball := ⟨0, 0⟩ +lemma CB1_1_6I2R1Mass_sound : CB1_1_6I2R1Mass.Encloses (∑ a, CB1_1_6I2R1Value a) := by + exact contains_sound (finSumBall_sound 6 CB1_1_6I2R1P CB1_1_6I2R1Value CB1_1_6I2R1P_sound) (by decide +kernel) +def CB1_1_6I2R1MassTerm : Ball := .exact 0 +lemma CB1_1_6I2R1MassTerm_sound : CB1_1_6I2R1MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_1_6I2R1Value a))) := + entropyTerm_zero_ball (CB1_1_6I2R1Mass_sound) +def CB1_1_6I2R1H : Ball := ⟨0, 0⟩ +lemma CB1_1_6I2R1H_sound : CB1_1_6I2R1H.Encloses (homogeneousEntropy CB1_1_6I2R1Value) := by + exact contains_sound (homogeneous_enclosed CB1_1_6I2R1Value CB1_1_6I2R1MassTerm_sound CB1_1_6I2R1Entropy_sound) (by decide +kernel) +def CB1_1_6I2R2Value (a : Fin 6) : ℝ := residualLaw (below (shape 1 1 6)) (fun u => (stageBLaw (shape 1 1 6) u : ℝ)) (stageBPriority (shape 1 1 6)) 2 (fun u a => (littleLaw (shape 1 1 6) u ((stageBPriority (shape 1 1 6)) 2) a : ℝ)) 2 a +def CB1_1_6I2R2Raw (a : Fin 6) : Ball := residualBall (below (shape 1 1 6)) B1_1_6Law (stageBPriority (shape 1 1 6)) 2 (fun u => B1_1_6Little u ((stageBPriority (shape 1 1 6)) 2)) 2 a +lemma CB1_1_6I2R2Raw_sound (a : Fin 6) : + (CB1_1_6I2R2Raw a).Encloses (CB1_1_6I2R2Value a) := by + exact residualBall_sound_on (below (shape 1 1 6)) B1_1_6Law (fun u => (stageBLaw (shape 1 1 6) u : ℝ)) (stageBPriority (shape 1 1 6)) 2 (fun u => B1_1_6Little u ((stageBPriority (shape 1 1 6)) 2)) (fun u a => (littleLaw (shape 1 1 6) u ((stageBPriority (shape 1 1 6)) 2) a : ℝ)) (fun u _ => B1_1_6Law_sound u) (fun u _ a => B1_1_6Little_sound u ((stageBPriority (shape 1 1 6)) 2) a) 2 a +def CB1_1_6I2R2Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(23395434846455848905473447711 / 2500000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ ⟨(4371675727663221785883191262821 / 100000000000000000000000000000000), (792668177 / 50000000000000000000000000000000)⟩ ⟨(-233575254977868181319062728355239 / 50000000000000000000000000000000), (169406589891 / 100000000000000000000000000000000)⟩ ⟨-7, 23395434846455848905473447711, 19531250000000000000000000000⟩, + .log ⟨(58960210306318037278141611 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(3382858086791820938049931 / 400000000000000000000000000000), (274693 / 100000000000000000000000000000000)⟩ ⟨(-717190896457276084482745932971173 / 50000000000000000000000000000000), (93173963417 / 20000000000000000000000000000000)⟩ ⟨-21, 58960210306318037278141611, 47683715820312500000000000⟩] +lemma CB1_1_6I2R2Certificates_valid : + CB1_1_6I2R2Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_1_6I2R2CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | 2 => 1 + | 3 => 2 + | _ => 0 +def CB1_1_6I2R2P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_1_6I2R2Certificates (CB1_1_6I2R2CertificateIndex a)).input +lemma CB1_1_6I2R2P_check : ∀ a : Fin 6, contains (CB1_1_6I2R2Raw a) (CB1_1_6I2R2P a) = true := by + decide +kernel +lemma CB1_1_6I2R2P_sound (a : Fin 6) : + (CB1_1_6I2R2P a).Encloses (CB1_1_6I2R2Value a) := + contains_sound (CB1_1_6I2R2Raw_sound a) (CB1_1_6I2R2P_check a) +def CB1_1_6I2R2Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_1_6I2R2Certificates (CB1_1_6I2R2CertificateIndex a)).output +lemma CB1_1_6I2R2Terms_sound (a : Fin 6) : + (CB1_1_6I2R2Terms a).Encloses (Foundation.entropyTerm (CB1_1_6I2R2Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_1_6I2R2Certificates_valid + (CB1_1_6I2R2CertificateIndex a) (CB1_1_6I2R2P_sound a) +def CB1_1_6I2R2Entropy : Ball := ⟨(4372521442184919741117703745571 / 100000000000000000000000000000000), (1585611047 / 100000000000000000000000000000000)⟩ +lemma CB1_1_6I2R2Entropy_sound : CB1_1_6I2R2Entropy.Encloses (Foundation.finiteEntropy CB1_1_6I2R2Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_1_6I2R2Value CB1_1_6I2R2Terms CB1_1_6I2R2Terms_sound) (by decide +kernel) +def CB1_1_6I2R2Mass : Ball := ⟨(935876354068540274256216050051 / 100000000000000000000000000000000), (1 / 20000000000000000000000000000000)⟩ +lemma CB1_1_6I2R2Mass_sound : CB1_1_6I2R2Mass.Encloses (∑ a, CB1_1_6I2R2Value a) := by + exact contains_sound (finSumBall_sound 6 CB1_1_6I2R2P CB1_1_6I2R2Value CB1_1_6I2R2P_sound) (by decide +kernel) +def CB1_1_6I2R2MassTermLogWitness : LogWitness := ⟨-7, 935876354068540274256216050051, 781250000000000000000000000000⟩ +def CB1_1_6I2R2MassTermLog : Ball := ⟨(-5839302621965975341803519774219 / 1250000000000000000000000000000), (169406589997 / 100000000000000000000000000000000)⟩ +lemma CB1_1_6I2R2MassTermLog_sound : CB1_1_6I2R2MassTermLog.Encloses (Real.log ((∑ a, CB1_1_6I2R2Value a))) := by + exact checkLog_sound logTwoBall_sound (CB1_1_6I2R2Mass_sound) (w := CB1_1_6I2R2MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB1_1_6I2R2MassTerm : Ball := ⟨(136621631203709617952889282303 / 3125000000000000000000000000000), (792718121 / 50000000000000000000000000000000)⟩ +lemma CB1_1_6I2R2MassTerm_sound : CB1_1_6I2R2MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_1_6I2R2Value a))) := by + exact contains_sound (entropyTerm_ball (CB1_1_6I2R2Mass_sound) CB1_1_6I2R2MassTermLog_sound) (by decide +kernel) +def CB1_1_6I2R2H : Ball := ⟨(1006789865939146600394739 / 160000000000000000000000000000), (3171047289 / 100000000000000000000000000000000)⟩ +lemma CB1_1_6I2R2H_sound : CB1_1_6I2R2H.Encloses (homogeneousEntropy CB1_1_6I2R2Value) := by + exact contains_sound (homogeneous_enclosed CB1_1_6I2R2Value CB1_1_6I2R2MassTerm_sound CB1_1_6I2R2Entropy_sound) (by decide +kernel) +def CB1_1_6I2R3Value (a : Fin 6) : ℝ := residualLaw (below (shape 1 1 6)) (fun u => (stageBLaw (shape 1 1 6) u : ℝ)) (stageBPriority (shape 1 1 6)) 2 (fun u a => (littleLaw (shape 1 1 6) u ((stageBPriority (shape 1 1 6)) 2) a : ℝ)) 3 a +def CB1_1_6I2R3Raw (a : Fin 6) : Ball := residualBall (below (shape 1 1 6)) B1_1_6Law (stageBPriority (shape 1 1 6)) 2 (fun u => B1_1_6Little u ((stageBPriority (shape 1 1 6)) 2)) 3 a +lemma CB1_1_6I2R3Raw_sound (a : Fin 6) : + (CB1_1_6I2R3Raw a).Encloses (CB1_1_6I2R3Value a) := by + exact residualBall_sound_on (below (shape 1 1 6)) B1_1_6Law (fun u => (stageBLaw (shape 1 1 6) u : ℝ)) (stageBPriority (shape 1 1 6)) 2 (fun u => B1_1_6Little u ((stageBPriority (shape 1 1 6)) 2)) (fun u a => (littleLaw (shape 1 1 6) u ((stageBPriority (shape 1 1 6)) 2) a : ℝ)) (fun u _ => B1_1_6Law_sound u) (fun u _ a => B1_1_6Little_sound u ((stageBPriority (shape 1 1 6)) 2) a) 3 a +def CB1_1_6I2R3Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB1_1_6I2R3Certificates_valid : + CB1_1_6I2R3Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_1_6I2R3CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB1_1_6I2R3P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_1_6I2R3Certificates (CB1_1_6I2R3CertificateIndex a)).input +lemma CB1_1_6I2R3P_check : ∀ a : Fin 6, contains (CB1_1_6I2R3Raw a) (CB1_1_6I2R3P a) = true := by + decide +kernel +lemma CB1_1_6I2R3P_sound (a : Fin 6) : + (CB1_1_6I2R3P a).Encloses (CB1_1_6I2R3Value a) := + contains_sound (CB1_1_6I2R3Raw_sound a) (CB1_1_6I2R3P_check a) +def CB1_1_6I2R3Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_1_6I2R3Certificates (CB1_1_6I2R3CertificateIndex a)).output +lemma CB1_1_6I2R3Terms_sound (a : Fin 6) : + (CB1_1_6I2R3Terms a).Encloses (Foundation.entropyTerm (CB1_1_6I2R3Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_1_6I2R3Certificates_valid + (CB1_1_6I2R3CertificateIndex a) (CB1_1_6I2R3P_sound a) +def CB1_1_6I2R3Entropy : Ball := ⟨0, 0⟩ +lemma CB1_1_6I2R3Entropy_sound : CB1_1_6I2R3Entropy.Encloses (Foundation.finiteEntropy CB1_1_6I2R3Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_1_6I2R3Value CB1_1_6I2R3Terms CB1_1_6I2R3Terms_sound) (by decide +kernel) +def CB1_1_6I2R3Mass : Ball := ⟨0, 0⟩ +lemma CB1_1_6I2R3Mass_sound : CB1_1_6I2R3Mass.Encloses (∑ a, CB1_1_6I2R3Value a) := by + exact contains_sound (finSumBall_sound 6 CB1_1_6I2R3P CB1_1_6I2R3Value CB1_1_6I2R3P_sound) (by decide +kernel) +def CB1_1_6I2R3MassTerm : Ball := .exact 0 +lemma CB1_1_6I2R3MassTerm_sound : CB1_1_6I2R3MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_1_6I2R3Value a))) := + entropyTerm_zero_ball (CB1_1_6I2R3Mass_sound) +def CB1_1_6I2R3H : Ball := ⟨0, 0⟩ +lemma CB1_1_6I2R3H_sound : CB1_1_6I2R3H.Encloses (homogeneousEntropy CB1_1_6I2R3Value) := by + exact contains_sound (homogeneous_enclosed CB1_1_6I2R3Value CB1_1_6I2R3MassTerm_sound CB1_1_6I2R3Entropy_sound) (by decide +kernel) +def CB1_1_6I2R4Value (a : Fin 6) : ℝ := residualLaw (below (shape 1 1 6)) (fun u => (stageBLaw (shape 1 1 6) u : ℝ)) (stageBPriority (shape 1 1 6)) 2 (fun u a => (littleLaw (shape 1 1 6) u ((stageBPriority (shape 1 1 6)) 2) a : ℝ)) 4 a +def CB1_1_6I2R4Raw (a : Fin 6) : Ball := residualBall (below (shape 1 1 6)) B1_1_6Law (stageBPriority (shape 1 1 6)) 2 (fun u => B1_1_6Little u ((stageBPriority (shape 1 1 6)) 2)) 4 a +lemma CB1_1_6I2R4Raw_sound (a : Fin 6) : + (CB1_1_6I2R4Raw a).Encloses (CB1_1_6I2R4Value a) := by + exact residualBall_sound_on (below (shape 1 1 6)) B1_1_6Law (fun u => (stageBLaw (shape 1 1 6) u : ℝ)) (stageBPriority (shape 1 1 6)) 2 (fun u => B1_1_6Little u ((stageBPriority (shape 1 1 6)) 2)) (fun u a => (littleLaw (shape 1 1 6) u ((stageBPriority (shape 1 1 6)) 2) a : ℝ)) (fun u _ => B1_1_6Law_sound u) (fun u _ a => B1_1_6Little_sound u ((stageBPriority (shape 1 1 6)) 2) a) 4 a +def CB1_1_6I2R4Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB1_1_6I2R4Certificates_valid : + CB1_1_6I2R4Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_1_6I2R4CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB1_1_6I2R4P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_1_6I2R4Certificates (CB1_1_6I2R4CertificateIndex a)).input +lemma CB1_1_6I2R4P_check : ∀ a : Fin 6, contains (CB1_1_6I2R4Raw a) (CB1_1_6I2R4P a) = true := by + decide +kernel +lemma CB1_1_6I2R4P_sound (a : Fin 6) : + (CB1_1_6I2R4P a).Encloses (CB1_1_6I2R4Value a) := + contains_sound (CB1_1_6I2R4Raw_sound a) (CB1_1_6I2R4P_check a) +def CB1_1_6I2R4Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_1_6I2R4Certificates (CB1_1_6I2R4CertificateIndex a)).output +lemma CB1_1_6I2R4Terms_sound (a : Fin 6) : + (CB1_1_6I2R4Terms a).Encloses (Foundation.entropyTerm (CB1_1_6I2R4Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_1_6I2R4Certificates_valid + (CB1_1_6I2R4CertificateIndex a) (CB1_1_6I2R4P_sound a) +def CB1_1_6I2R4Entropy : Ball := ⟨0, 0⟩ +lemma CB1_1_6I2R4Entropy_sound : CB1_1_6I2R4Entropy.Encloses (Foundation.finiteEntropy CB1_1_6I2R4Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_1_6I2R4Value CB1_1_6I2R4Terms CB1_1_6I2R4Terms_sound) (by decide +kernel) +def CB1_1_6I2R4Mass : Ball := ⟨0, 0⟩ +lemma CB1_1_6I2R4Mass_sound : CB1_1_6I2R4Mass.Encloses (∑ a, CB1_1_6I2R4Value a) := by + exact contains_sound (finSumBall_sound 6 CB1_1_6I2R4P CB1_1_6I2R4Value CB1_1_6I2R4P_sound) (by decide +kernel) +def CB1_1_6I2R4MassTerm : Ball := .exact 0 +lemma CB1_1_6I2R4MassTerm_sound : CB1_1_6I2R4MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_1_6I2R4Value a))) := + entropyTerm_zero_ball (CB1_1_6I2R4Mass_sound) +def CB1_1_6I2R4H : Ball := ⟨0, 0⟩ +lemma CB1_1_6I2R4H_sound : CB1_1_6I2R4H.Encloses (homogeneousEntropy CB1_1_6I2R4Value) := by + exact contains_sound (homogeneous_enclosed CB1_1_6I2R4Value CB1_1_6I2R4MassTerm_sound CB1_1_6I2R4Entropy_sound) (by decide +kernel) +def CB1_1_6I2R5Value (a : Fin 6) : ℝ := residualLaw (below (shape 1 1 6)) (fun u => (stageBLaw (shape 1 1 6) u : ℝ)) (stageBPriority (shape 1 1 6)) 2 (fun u a => (littleLaw (shape 1 1 6) u ((stageBPriority (shape 1 1 6)) 2) a : ℝ)) 5 a +def CB1_1_6I2R5Raw (a : Fin 6) : Ball := residualBall (below (shape 1 1 6)) B1_1_6Law (stageBPriority (shape 1 1 6)) 2 (fun u => B1_1_6Little u ((stageBPriority (shape 1 1 6)) 2)) 5 a +lemma CB1_1_6I2R5Raw_sound (a : Fin 6) : + (CB1_1_6I2R5Raw a).Encloses (CB1_1_6I2R5Value a) := by + exact residualBall_sound_on (below (shape 1 1 6)) B1_1_6Law (fun u => (stageBLaw (shape 1 1 6) u : ℝ)) (stageBPriority (shape 1 1 6)) 2 (fun u => B1_1_6Little u ((stageBPriority (shape 1 1 6)) 2)) (fun u a => (littleLaw (shape 1 1 6) u ((stageBPriority (shape 1 1 6)) 2) a : ℝ)) (fun u _ => B1_1_6Law_sound u) (fun u _ a => B1_1_6Little_sound u ((stageBPriority (shape 1 1 6)) 2) a) 5 a +def CB1_1_6I2R5Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB1_1_6I2R5Certificates_valid : + CB1_1_6I2R5Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_1_6I2R5CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB1_1_6I2R5P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_1_6I2R5Certificates (CB1_1_6I2R5CertificateIndex a)).input +lemma CB1_1_6I2R5P_check : ∀ a : Fin 6, contains (CB1_1_6I2R5Raw a) (CB1_1_6I2R5P a) = true := by + decide +kernel +lemma CB1_1_6I2R5P_sound (a : Fin 6) : + (CB1_1_6I2R5P a).Encloses (CB1_1_6I2R5Value a) := + contains_sound (CB1_1_6I2R5Raw_sound a) (CB1_1_6I2R5P_check a) +def CB1_1_6I2R5Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_1_6I2R5Certificates (CB1_1_6I2R5CertificateIndex a)).output +lemma CB1_1_6I2R5Terms_sound (a : Fin 6) : + (CB1_1_6I2R5Terms a).Encloses (Foundation.entropyTerm (CB1_1_6I2R5Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_1_6I2R5Certificates_valid + (CB1_1_6I2R5CertificateIndex a) (CB1_1_6I2R5P_sound a) +def CB1_1_6I2R5Entropy : Ball := ⟨0, 0⟩ +lemma CB1_1_6I2R5Entropy_sound : CB1_1_6I2R5Entropy.Encloses (Foundation.finiteEntropy CB1_1_6I2R5Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_1_6I2R5Value CB1_1_6I2R5Terms CB1_1_6I2R5Terms_sound) (by decide +kernel) +def CB1_1_6I2R5Mass : Ball := ⟨0, 0⟩ +lemma CB1_1_6I2R5Mass_sound : CB1_1_6I2R5Mass.Encloses (∑ a, CB1_1_6I2R5Value a) := by + exact contains_sound (finSumBall_sound 6 CB1_1_6I2R5P CB1_1_6I2R5Value CB1_1_6I2R5P_sound) (by decide +kernel) +def CB1_1_6I2R5MassTerm : Ball := .exact 0 +lemma CB1_1_6I2R5MassTerm_sound : CB1_1_6I2R5MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_1_6I2R5Value a))) := + entropyTerm_zero_ball (CB1_1_6I2R5Mass_sound) +def CB1_1_6I2R5H : Ball := ⟨0, 0⟩ +lemma CB1_1_6I2R5H_sound : CB1_1_6I2R5H.Encloses (homogeneousEntropy CB1_1_6I2R5Value) := by + exact contains_sound (homogeneous_enclosed CB1_1_6I2R5Value CB1_1_6I2R5MassTerm_sound CB1_1_6I2R5Entropy_sound) (by decide +kernel) +def CB1_1_6I2R6Value (a : Fin 6) : ℝ := residualLaw (below (shape 1 1 6)) (fun u => (stageBLaw (shape 1 1 6) u : ℝ)) (stageBPriority (shape 1 1 6)) 2 (fun u a => (littleLaw (shape 1 1 6) u ((stageBPriority (shape 1 1 6)) 2) a : ℝ)) 6 a +def CB1_1_6I2R6Raw (a : Fin 6) : Ball := residualBall (below (shape 1 1 6)) B1_1_6Law (stageBPriority (shape 1 1 6)) 2 (fun u => B1_1_6Little u ((stageBPriority (shape 1 1 6)) 2)) 6 a +lemma CB1_1_6I2R6Raw_sound (a : Fin 6) : + (CB1_1_6I2R6Raw a).Encloses (CB1_1_6I2R6Value a) := by + exact residualBall_sound_on (below (shape 1 1 6)) B1_1_6Law (fun u => (stageBLaw (shape 1 1 6) u : ℝ)) (stageBPriority (shape 1 1 6)) 2 (fun u => B1_1_6Little u ((stageBPriority (shape 1 1 6)) 2)) (fun u a => (littleLaw (shape 1 1 6) u ((stageBPriority (shape 1 1 6)) 2) a : ℝ)) (fun u _ => B1_1_6Law_sound u) (fun u _ a => B1_1_6Little_sound u ((stageBPriority (shape 1 1 6)) 2) a) 6 a +def CB1_1_6I2R6Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB1_1_6I2R6Certificates_valid : + CB1_1_6I2R6Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_1_6I2R6CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB1_1_6I2R6P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_1_6I2R6Certificates (CB1_1_6I2R6CertificateIndex a)).input +lemma CB1_1_6I2R6P_check : ∀ a : Fin 6, contains (CB1_1_6I2R6Raw a) (CB1_1_6I2R6P a) = true := by + decide +kernel +lemma CB1_1_6I2R6P_sound (a : Fin 6) : + (CB1_1_6I2R6P a).Encloses (CB1_1_6I2R6Value a) := + contains_sound (CB1_1_6I2R6Raw_sound a) (CB1_1_6I2R6P_check a) +def CB1_1_6I2R6Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_1_6I2R6Certificates (CB1_1_6I2R6CertificateIndex a)).output +lemma CB1_1_6I2R6Terms_sound (a : Fin 6) : + (CB1_1_6I2R6Terms a).Encloses (Foundation.entropyTerm (CB1_1_6I2R6Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_1_6I2R6Certificates_valid + (CB1_1_6I2R6CertificateIndex a) (CB1_1_6I2R6P_sound a) +def CB1_1_6I2R6Entropy : Ball := ⟨0, 0⟩ +lemma CB1_1_6I2R6Entropy_sound : CB1_1_6I2R6Entropy.Encloses (Foundation.finiteEntropy CB1_1_6I2R6Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_1_6I2R6Value CB1_1_6I2R6Terms CB1_1_6I2R6Terms_sound) (by decide +kernel) +def CB1_1_6I2R6Mass : Ball := ⟨0, 0⟩ +lemma CB1_1_6I2R6Mass_sound : CB1_1_6I2R6Mass.Encloses (∑ a, CB1_1_6I2R6Value a) := by + exact contains_sound (finSumBall_sound 6 CB1_1_6I2R6P CB1_1_6I2R6Value CB1_1_6I2R6P_sound) (by decide +kernel) +def CB1_1_6I2R6MassTerm : Ball := .exact 0 +lemma CB1_1_6I2R6MassTerm_sound : CB1_1_6I2R6MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_1_6I2R6Value a))) := + entropyTerm_zero_ball (CB1_1_6I2R6Mass_sound) +def CB1_1_6I2R6H : Ball := ⟨0, 0⟩ +lemma CB1_1_6I2R6H_sound : CB1_1_6I2R6H.Encloses (homogeneousEntropy CB1_1_6I2R6Value) := by + exact contains_sound (homogeneous_enclosed CB1_1_6I2R6Value CB1_1_6I2R6MassTerm_sound CB1_1_6I2R6Entropy_sound) (by decide +kernel) +def CB1_1_6I2R7Value (a : Fin 6) : ℝ := residualLaw (below (shape 1 1 6)) (fun u => (stageBLaw (shape 1 1 6) u : ℝ)) (stageBPriority (shape 1 1 6)) 2 (fun u a => (littleLaw (shape 1 1 6) u ((stageBPriority (shape 1 1 6)) 2) a : ℝ)) 7 a +def CB1_1_6I2R7Raw (a : Fin 6) : Ball := residualBall (below (shape 1 1 6)) B1_1_6Law (stageBPriority (shape 1 1 6)) 2 (fun u => B1_1_6Little u ((stageBPriority (shape 1 1 6)) 2)) 7 a +lemma CB1_1_6I2R7Raw_sound (a : Fin 6) : + (CB1_1_6I2R7Raw a).Encloses (CB1_1_6I2R7Value a) := by + exact residualBall_sound_on (below (shape 1 1 6)) B1_1_6Law (fun u => (stageBLaw (shape 1 1 6) u : ℝ)) (stageBPriority (shape 1 1 6)) 2 (fun u => B1_1_6Little u ((stageBPriority (shape 1 1 6)) 2)) (fun u a => (littleLaw (shape 1 1 6) u ((stageBPriority (shape 1 1 6)) 2) a : ℝ)) (fun u _ => B1_1_6Law_sound u) (fun u _ a => B1_1_6Little_sound u ((stageBPriority (shape 1 1 6)) 2) a) 7 a +def CB1_1_6I2R7Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB1_1_6I2R7Certificates_valid : + CB1_1_6I2R7Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_1_6I2R7CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB1_1_6I2R7P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_1_6I2R7Certificates (CB1_1_6I2R7CertificateIndex a)).input +lemma CB1_1_6I2R7P_check : ∀ a : Fin 6, contains (CB1_1_6I2R7Raw a) (CB1_1_6I2R7P a) = true := by + decide +kernel +lemma CB1_1_6I2R7P_sound (a : Fin 6) : + (CB1_1_6I2R7P a).Encloses (CB1_1_6I2R7Value a) := + contains_sound (CB1_1_6I2R7Raw_sound a) (CB1_1_6I2R7P_check a) +def CB1_1_6I2R7Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_1_6I2R7Certificates (CB1_1_6I2R7CertificateIndex a)).output +lemma CB1_1_6I2R7Terms_sound (a : Fin 6) : + (CB1_1_6I2R7Terms a).Encloses (Foundation.entropyTerm (CB1_1_6I2R7Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_1_6I2R7Certificates_valid + (CB1_1_6I2R7CertificateIndex a) (CB1_1_6I2R7P_sound a) +def CB1_1_6I2R7Entropy : Ball := ⟨0, 0⟩ +lemma CB1_1_6I2R7Entropy_sound : CB1_1_6I2R7Entropy.Encloses (Foundation.finiteEntropy CB1_1_6I2R7Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_1_6I2R7Value CB1_1_6I2R7Terms CB1_1_6I2R7Terms_sound) (by decide +kernel) +def CB1_1_6I2R7Mass : Ball := ⟨0, 0⟩ +lemma CB1_1_6I2R7Mass_sound : CB1_1_6I2R7Mass.Encloses (∑ a, CB1_1_6I2R7Value a) := by + exact contains_sound (finSumBall_sound 6 CB1_1_6I2R7P CB1_1_6I2R7Value CB1_1_6I2R7P_sound) (by decide +kernel) +def CB1_1_6I2R7MassTerm : Ball := .exact 0 +lemma CB1_1_6I2R7MassTerm_sound : CB1_1_6I2R7MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_1_6I2R7Value a))) := + entropyTerm_zero_ball (CB1_1_6I2R7Mass_sound) +def CB1_1_6I2R7H : Ball := ⟨0, 0⟩ +lemma CB1_1_6I2R7H_sound : CB1_1_6I2R7H.Encloses (homogeneousEntropy CB1_1_6I2R7Value) := by + exact contains_sound (homogeneous_enclosed CB1_1_6I2R7Value CB1_1_6I2R7MassTerm_sound CB1_1_6I2R7Entropy_sound) (by decide +kernel) +def CB1_1_6I2R8Value (a : Fin 6) : ℝ := residualLaw (below (shape 1 1 6)) (fun u => (stageBLaw (shape 1 1 6) u : ℝ)) (stageBPriority (shape 1 1 6)) 2 (fun u a => (littleLaw (shape 1 1 6) u ((stageBPriority (shape 1 1 6)) 2) a : ℝ)) 8 a +def CB1_1_6I2R8Raw (a : Fin 6) : Ball := residualBall (below (shape 1 1 6)) B1_1_6Law (stageBPriority (shape 1 1 6)) 2 (fun u => B1_1_6Little u ((stageBPriority (shape 1 1 6)) 2)) 8 a +lemma CB1_1_6I2R8Raw_sound (a : Fin 6) : + (CB1_1_6I2R8Raw a).Encloses (CB1_1_6I2R8Value a) := by + exact residualBall_sound_on (below (shape 1 1 6)) B1_1_6Law (fun u => (stageBLaw (shape 1 1 6) u : ℝ)) (stageBPriority (shape 1 1 6)) 2 (fun u => B1_1_6Little u ((stageBPriority (shape 1 1 6)) 2)) (fun u a => (littleLaw (shape 1 1 6) u ((stageBPriority (shape 1 1 6)) 2) a : ℝ)) (fun u _ => B1_1_6Law_sound u) (fun u _ a => B1_1_6Little_sound u ((stageBPriority (shape 1 1 6)) 2) a) 8 a +def CB1_1_6I2R8Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB1_1_6I2R8Certificates_valid : + CB1_1_6I2R8Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_1_6I2R8CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB1_1_6I2R8P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_1_6I2R8Certificates (CB1_1_6I2R8CertificateIndex a)).input +lemma CB1_1_6I2R8P_check : ∀ a : Fin 6, contains (CB1_1_6I2R8Raw a) (CB1_1_6I2R8P a) = true := by + decide +kernel +lemma CB1_1_6I2R8P_sound (a : Fin 6) : + (CB1_1_6I2R8P a).Encloses (CB1_1_6I2R8Value a) := + contains_sound (CB1_1_6I2R8Raw_sound a) (CB1_1_6I2R8P_check a) +def CB1_1_6I2R8Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_1_6I2R8Certificates (CB1_1_6I2R8CertificateIndex a)).output +lemma CB1_1_6I2R8Terms_sound (a : Fin 6) : + (CB1_1_6I2R8Terms a).Encloses (Foundation.entropyTerm (CB1_1_6I2R8Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_1_6I2R8Certificates_valid + (CB1_1_6I2R8CertificateIndex a) (CB1_1_6I2R8P_sound a) +def CB1_1_6I2R8Entropy : Ball := ⟨0, 0⟩ +lemma CB1_1_6I2R8Entropy_sound : CB1_1_6I2R8Entropy.Encloses (Foundation.finiteEntropy CB1_1_6I2R8Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_1_6I2R8Value CB1_1_6I2R8Terms CB1_1_6I2R8Terms_sound) (by decide +kernel) +def CB1_1_6I2R8Mass : Ball := ⟨0, 0⟩ +lemma CB1_1_6I2R8Mass_sound : CB1_1_6I2R8Mass.Encloses (∑ a, CB1_1_6I2R8Value a) := by + exact contains_sound (finSumBall_sound 6 CB1_1_6I2R8P CB1_1_6I2R8Value CB1_1_6I2R8P_sound) (by decide +kernel) +def CB1_1_6I2R8MassTerm : Ball := .exact 0 +lemma CB1_1_6I2R8MassTerm_sound : CB1_1_6I2R8MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_1_6I2R8Value a))) := + entropyTerm_zero_ball (CB1_1_6I2R8Mass_sound) +def CB1_1_6I2R8H : Ball := ⟨0, 0⟩ +lemma CB1_1_6I2R8H_sound : CB1_1_6I2R8H.Encloses (homogeneousEntropy CB1_1_6I2R8Value) := by + exact contains_sound (homogeneous_enclosed CB1_1_6I2R8Value CB1_1_6I2R8MassTerm_sound CB1_1_6I2R8Entropy_sound) (by decide +kernel) +def CB1_1_6I2R9Value (a : Fin 6) : ℝ := residualLaw (below (shape 1 1 6)) (fun u => (stageBLaw (shape 1 1 6) u : ℝ)) (stageBPriority (shape 1 1 6)) 2 (fun u a => (littleLaw (shape 1 1 6) u ((stageBPriority (shape 1 1 6)) 2) a : ℝ)) 9 a +def CB1_1_6I2R9Raw (a : Fin 6) : Ball := residualBall (below (shape 1 1 6)) B1_1_6Law (stageBPriority (shape 1 1 6)) 2 (fun u => B1_1_6Little u ((stageBPriority (shape 1 1 6)) 2)) 9 a +lemma CB1_1_6I2R9Raw_sound (a : Fin 6) : + (CB1_1_6I2R9Raw a).Encloses (CB1_1_6I2R9Value a) := by + exact residualBall_sound_on (below (shape 1 1 6)) B1_1_6Law (fun u => (stageBLaw (shape 1 1 6) u : ℝ)) (stageBPriority (shape 1 1 6)) 2 (fun u => B1_1_6Little u ((stageBPriority (shape 1 1 6)) 2)) (fun u a => (littleLaw (shape 1 1 6) u ((stageBPriority (shape 1 1 6)) 2) a : ℝ)) (fun u _ => B1_1_6Law_sound u) (fun u _ a => B1_1_6Little_sound u ((stageBPriority (shape 1 1 6)) 2) a) 9 a +def CB1_1_6I2R9Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB1_1_6I2R9Certificates_valid : + CB1_1_6I2R9Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_1_6I2R9CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB1_1_6I2R9P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_1_6I2R9Certificates (CB1_1_6I2R9CertificateIndex a)).input +lemma CB1_1_6I2R9P_check : ∀ a : Fin 6, contains (CB1_1_6I2R9Raw a) (CB1_1_6I2R9P a) = true := by + decide +kernel +lemma CB1_1_6I2R9P_sound (a : Fin 6) : + (CB1_1_6I2R9P a).Encloses (CB1_1_6I2R9Value a) := + contains_sound (CB1_1_6I2R9Raw_sound a) (CB1_1_6I2R9P_check a) +def CB1_1_6I2R9Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_1_6I2R9Certificates (CB1_1_6I2R9CertificateIndex a)).output +lemma CB1_1_6I2R9Terms_sound (a : Fin 6) : + (CB1_1_6I2R9Terms a).Encloses (Foundation.entropyTerm (CB1_1_6I2R9Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_1_6I2R9Certificates_valid + (CB1_1_6I2R9CertificateIndex a) (CB1_1_6I2R9P_sound a) +def CB1_1_6I2R9Entropy : Ball := ⟨0, 0⟩ +lemma CB1_1_6I2R9Entropy_sound : CB1_1_6I2R9Entropy.Encloses (Foundation.finiteEntropy CB1_1_6I2R9Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_1_6I2R9Value CB1_1_6I2R9Terms CB1_1_6I2R9Terms_sound) (by decide +kernel) +def CB1_1_6I2R9Mass : Ball := ⟨0, 0⟩ +lemma CB1_1_6I2R9Mass_sound : CB1_1_6I2R9Mass.Encloses (∑ a, CB1_1_6I2R9Value a) := by + exact contains_sound (finSumBall_sound 6 CB1_1_6I2R9P CB1_1_6I2R9Value CB1_1_6I2R9P_sound) (by decide +kernel) +def CB1_1_6I2R9MassTerm : Ball := .exact 0 +lemma CB1_1_6I2R9MassTerm_sound : CB1_1_6I2R9MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_1_6I2R9Value a))) := + entropyTerm_zero_ball (CB1_1_6I2R9Mass_sound) +def CB1_1_6I2R9H : Ball := ⟨0, 0⟩ +lemma CB1_1_6I2R9H_sound : CB1_1_6I2R9H.Encloses (homogeneousEntropy CB1_1_6I2R9Value) := by + exact contains_sound (homogeneous_enclosed CB1_1_6I2R9Value CB1_1_6I2R9MassTerm_sound CB1_1_6I2R9Entropy_sound) (by decide +kernel) +def CB1_1_6I2R10Value (a : Fin 6) : ℝ := residualLaw (below (shape 1 1 6)) (fun u => (stageBLaw (shape 1 1 6) u : ℝ)) (stageBPriority (shape 1 1 6)) 2 (fun u a => (littleLaw (shape 1 1 6) u ((stageBPriority (shape 1 1 6)) 2) a : ℝ)) 10 a +def CB1_1_6I2R10Raw (a : Fin 6) : Ball := residualBall (below (shape 1 1 6)) B1_1_6Law (stageBPriority (shape 1 1 6)) 2 (fun u => B1_1_6Little u ((stageBPriority (shape 1 1 6)) 2)) 10 a +lemma CB1_1_6I2R10Raw_sound (a : Fin 6) : + (CB1_1_6I2R10Raw a).Encloses (CB1_1_6I2R10Value a) := by + exact residualBall_sound_on (below (shape 1 1 6)) B1_1_6Law (fun u => (stageBLaw (shape 1 1 6) u : ℝ)) (stageBPriority (shape 1 1 6)) 2 (fun u => B1_1_6Little u ((stageBPriority (shape 1 1 6)) 2)) (fun u a => (littleLaw (shape 1 1 6) u ((stageBPriority (shape 1 1 6)) 2) a : ℝ)) (fun u _ => B1_1_6Law_sound u) (fun u _ a => B1_1_6Little_sound u ((stageBPriority (shape 1 1 6)) 2) a) 10 a +def CB1_1_6I2R10Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB1_1_6I2R10Certificates_valid : + CB1_1_6I2R10Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_1_6I2R10CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB1_1_6I2R10P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_1_6I2R10Certificates (CB1_1_6I2R10CertificateIndex a)).input +lemma CB1_1_6I2R10P_check : ∀ a : Fin 6, contains (CB1_1_6I2R10Raw a) (CB1_1_6I2R10P a) = true := by + decide +kernel +lemma CB1_1_6I2R10P_sound (a : Fin 6) : + (CB1_1_6I2R10P a).Encloses (CB1_1_6I2R10Value a) := + contains_sound (CB1_1_6I2R10Raw_sound a) (CB1_1_6I2R10P_check a) +def CB1_1_6I2R10Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_1_6I2R10Certificates (CB1_1_6I2R10CertificateIndex a)).output +lemma CB1_1_6I2R10Terms_sound (a : Fin 6) : + (CB1_1_6I2R10Terms a).Encloses (Foundation.entropyTerm (CB1_1_6I2R10Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_1_6I2R10Certificates_valid + (CB1_1_6I2R10CertificateIndex a) (CB1_1_6I2R10P_sound a) +def CB1_1_6I2R10Entropy : Ball := ⟨0, 0⟩ +lemma CB1_1_6I2R10Entropy_sound : CB1_1_6I2R10Entropy.Encloses (Foundation.finiteEntropy CB1_1_6I2R10Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_1_6I2R10Value CB1_1_6I2R10Terms CB1_1_6I2R10Terms_sound) (by decide +kernel) +def CB1_1_6I2R10Mass : Ball := ⟨0, 0⟩ +lemma CB1_1_6I2R10Mass_sound : CB1_1_6I2R10Mass.Encloses (∑ a, CB1_1_6I2R10Value a) := by + exact contains_sound (finSumBall_sound 6 CB1_1_6I2R10P CB1_1_6I2R10Value CB1_1_6I2R10P_sound) (by decide +kernel) +def CB1_1_6I2R10MassTerm : Ball := .exact 0 +lemma CB1_1_6I2R10MassTerm_sound : CB1_1_6I2R10MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_1_6I2R10Value a))) := + entropyTerm_zero_ball (CB1_1_6I2R10Mass_sound) +def CB1_1_6I2R10H : Ball := ⟨0, 0⟩ +lemma CB1_1_6I2R10H_sound : CB1_1_6I2R10H.Encloses (homogeneousEntropy CB1_1_6I2R10Value) := by + exact contains_sound (homogeneous_enclosed CB1_1_6I2R10Value CB1_1_6I2R10MassTerm_sound CB1_1_6I2R10Entropy_sound) (by decide +kernel) +def CB1_1_6I2R11Value (a : Fin 6) : ℝ := residualLaw (below (shape 1 1 6)) (fun u => (stageBLaw (shape 1 1 6) u : ℝ)) (stageBPriority (shape 1 1 6)) 2 (fun u a => (littleLaw (shape 1 1 6) u ((stageBPriority (shape 1 1 6)) 2) a : ℝ)) 11 a +def CB1_1_6I2R11Raw (a : Fin 6) : Ball := residualBall (below (shape 1 1 6)) B1_1_6Law (stageBPriority (shape 1 1 6)) 2 (fun u => B1_1_6Little u ((stageBPriority (shape 1 1 6)) 2)) 11 a +lemma CB1_1_6I2R11Raw_sound (a : Fin 6) : + (CB1_1_6I2R11Raw a).Encloses (CB1_1_6I2R11Value a) := by + exact residualBall_sound_on (below (shape 1 1 6)) B1_1_6Law (fun u => (stageBLaw (shape 1 1 6) u : ℝ)) (stageBPriority (shape 1 1 6)) 2 (fun u => B1_1_6Little u ((stageBPriority (shape 1 1 6)) 2)) (fun u a => (littleLaw (shape 1 1 6) u ((stageBPriority (shape 1 1 6)) 2) a : ℝ)) (fun u _ => B1_1_6Law_sound u) (fun u _ a => B1_1_6Little_sound u ((stageBPriority (shape 1 1 6)) 2) a) 11 a +def CB1_1_6I2R11Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB1_1_6I2R11Certificates_valid : + CB1_1_6I2R11Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_1_6I2R11CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB1_1_6I2R11P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_1_6I2R11Certificates (CB1_1_6I2R11CertificateIndex a)).input +lemma CB1_1_6I2R11P_check : ∀ a : Fin 6, contains (CB1_1_6I2R11Raw a) (CB1_1_6I2R11P a) = true := by + decide +kernel +lemma CB1_1_6I2R11P_sound (a : Fin 6) : + (CB1_1_6I2R11P a).Encloses (CB1_1_6I2R11Value a) := + contains_sound (CB1_1_6I2R11Raw_sound a) (CB1_1_6I2R11P_check a) +def CB1_1_6I2R11Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_1_6I2R11Certificates (CB1_1_6I2R11CertificateIndex a)).output +lemma CB1_1_6I2R11Terms_sound (a : Fin 6) : + (CB1_1_6I2R11Terms a).Encloses (Foundation.entropyTerm (CB1_1_6I2R11Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_1_6I2R11Certificates_valid + (CB1_1_6I2R11CertificateIndex a) (CB1_1_6I2R11P_sound a) +def CB1_1_6I2R11Entropy : Ball := ⟨0, 0⟩ +lemma CB1_1_6I2R11Entropy_sound : CB1_1_6I2R11Entropy.Encloses (Foundation.finiteEntropy CB1_1_6I2R11Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_1_6I2R11Value CB1_1_6I2R11Terms CB1_1_6I2R11Terms_sound) (by decide +kernel) +def CB1_1_6I2R11Mass : Ball := ⟨0, 0⟩ +lemma CB1_1_6I2R11Mass_sound : CB1_1_6I2R11Mass.Encloses (∑ a, CB1_1_6I2R11Value a) := by + exact contains_sound (finSumBall_sound 6 CB1_1_6I2R11P CB1_1_6I2R11Value CB1_1_6I2R11P_sound) (by decide +kernel) +def CB1_1_6I2R11MassTerm : Ball := .exact 0 +lemma CB1_1_6I2R11MassTerm_sound : CB1_1_6I2R11MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_1_6I2R11Value a))) := + entropyTerm_zero_ball (CB1_1_6I2R11Mass_sound) +def CB1_1_6I2R11H : Ball := ⟨0, 0⟩ +lemma CB1_1_6I2R11H_sound : CB1_1_6I2R11H.Encloses (homogeneousEntropy CB1_1_6I2R11Value) := by + exact contains_sound (homogeneous_enclosed CB1_1_6I2R11Value CB1_1_6I2R11MassTerm_sound CB1_1_6I2R11Entropy_sound) (by decide +kernel) +def CB1_1_6I2R12Value (a : Fin 6) : ℝ := residualLaw (below (shape 1 1 6)) (fun u => (stageBLaw (shape 1 1 6) u : ℝ)) (stageBPriority (shape 1 1 6)) 2 (fun u a => (littleLaw (shape 1 1 6) u ((stageBPriority (shape 1 1 6)) 2) a : ℝ)) 12 a +def CB1_1_6I2R12Raw (a : Fin 6) : Ball := residualBall (below (shape 1 1 6)) B1_1_6Law (stageBPriority (shape 1 1 6)) 2 (fun u => B1_1_6Little u ((stageBPriority (shape 1 1 6)) 2)) 12 a +lemma CB1_1_6I2R12Raw_sound (a : Fin 6) : + (CB1_1_6I2R12Raw a).Encloses (CB1_1_6I2R12Value a) := by + exact residualBall_sound_on (below (shape 1 1 6)) B1_1_6Law (fun u => (stageBLaw (shape 1 1 6) u : ℝ)) (stageBPriority (shape 1 1 6)) 2 (fun u => B1_1_6Little u ((stageBPriority (shape 1 1 6)) 2)) (fun u a => (littleLaw (shape 1 1 6) u ((stageBPriority (shape 1 1 6)) 2) a : ℝ)) (fun u _ => B1_1_6Law_sound u) (fun u _ a => B1_1_6Little_sound u ((stageBPriority (shape 1 1 6)) 2) a) 12 a +def CB1_1_6I2R12Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB1_1_6I2R12Certificates_valid : + CB1_1_6I2R12Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_1_6I2R12CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB1_1_6I2R12P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_1_6I2R12Certificates (CB1_1_6I2R12CertificateIndex a)).input +lemma CB1_1_6I2R12P_check : ∀ a : Fin 6, contains (CB1_1_6I2R12Raw a) (CB1_1_6I2R12P a) = true := by + decide +kernel +lemma CB1_1_6I2R12P_sound (a : Fin 6) : + (CB1_1_6I2R12P a).Encloses (CB1_1_6I2R12Value a) := + contains_sound (CB1_1_6I2R12Raw_sound a) (CB1_1_6I2R12P_check a) +def CB1_1_6I2R12Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_1_6I2R12Certificates (CB1_1_6I2R12CertificateIndex a)).output +lemma CB1_1_6I2R12Terms_sound (a : Fin 6) : + (CB1_1_6I2R12Terms a).Encloses (Foundation.entropyTerm (CB1_1_6I2R12Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_1_6I2R12Certificates_valid + (CB1_1_6I2R12CertificateIndex a) (CB1_1_6I2R12P_sound a) +def CB1_1_6I2R12Entropy : Ball := ⟨0, 0⟩ +lemma CB1_1_6I2R12Entropy_sound : CB1_1_6I2R12Entropy.Encloses (Foundation.finiteEntropy CB1_1_6I2R12Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_1_6I2R12Value CB1_1_6I2R12Terms CB1_1_6I2R12Terms_sound) (by decide +kernel) +def CB1_1_6I2R12Mass : Ball := ⟨0, 0⟩ +lemma CB1_1_6I2R12Mass_sound : CB1_1_6I2R12Mass.Encloses (∑ a, CB1_1_6I2R12Value a) := by + exact contains_sound (finSumBall_sound 6 CB1_1_6I2R12P CB1_1_6I2R12Value CB1_1_6I2R12P_sound) (by decide +kernel) +def CB1_1_6I2R12MassTerm : Ball := .exact 0 +lemma CB1_1_6I2R12MassTerm_sound : CB1_1_6I2R12MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_1_6I2R12Value a))) := + entropyTerm_zero_ball (CB1_1_6I2R12Mass_sound) +def CB1_1_6I2R12H : Ball := ⟨0, 0⟩ +lemma CB1_1_6I2R12H_sound : CB1_1_6I2R12H.Encloses (homogeneousEntropy CB1_1_6I2R12Value) := by + exact contains_sound (homogeneous_enclosed CB1_1_6I2R12Value CB1_1_6I2R12MassTerm_sound CB1_1_6I2R12Entropy_sound) (by decide +kernel) +def CB1_1_6I2R13Value (a : Fin 6) : ℝ := residualLaw (below (shape 1 1 6)) (fun u => (stageBLaw (shape 1 1 6) u : ℝ)) (stageBPriority (shape 1 1 6)) 2 (fun u a => (littleLaw (shape 1 1 6) u ((stageBPriority (shape 1 1 6)) 2) a : ℝ)) 13 a +def CB1_1_6I2R13Raw (a : Fin 6) : Ball := residualBall (below (shape 1 1 6)) B1_1_6Law (stageBPriority (shape 1 1 6)) 2 (fun u => B1_1_6Little u ((stageBPriority (shape 1 1 6)) 2)) 13 a +lemma CB1_1_6I2R13Raw_sound (a : Fin 6) : + (CB1_1_6I2R13Raw a).Encloses (CB1_1_6I2R13Value a) := by + exact residualBall_sound_on (below (shape 1 1 6)) B1_1_6Law (fun u => (stageBLaw (shape 1 1 6) u : ℝ)) (stageBPriority (shape 1 1 6)) 2 (fun u => B1_1_6Little u ((stageBPriority (shape 1 1 6)) 2)) (fun u a => (littleLaw (shape 1 1 6) u ((stageBPriority (shape 1 1 6)) 2) a : ℝ)) (fun u _ => B1_1_6Law_sound u) (fun u _ a => B1_1_6Little_sound u ((stageBPriority (shape 1 1 6)) 2) a) 13 a +def CB1_1_6I2R13Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB1_1_6I2R13Certificates_valid : + CB1_1_6I2R13Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_1_6I2R13CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB1_1_6I2R13P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_1_6I2R13Certificates (CB1_1_6I2R13CertificateIndex a)).input +lemma CB1_1_6I2R13P_check : ∀ a : Fin 6, contains (CB1_1_6I2R13Raw a) (CB1_1_6I2R13P a) = true := by + decide +kernel +lemma CB1_1_6I2R13P_sound (a : Fin 6) : + (CB1_1_6I2R13P a).Encloses (CB1_1_6I2R13Value a) := + contains_sound (CB1_1_6I2R13Raw_sound a) (CB1_1_6I2R13P_check a) +def CB1_1_6I2R13Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_1_6I2R13Certificates (CB1_1_6I2R13CertificateIndex a)).output +lemma CB1_1_6I2R13Terms_sound (a : Fin 6) : + (CB1_1_6I2R13Terms a).Encloses (Foundation.entropyTerm (CB1_1_6I2R13Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_1_6I2R13Certificates_valid + (CB1_1_6I2R13CertificateIndex a) (CB1_1_6I2R13P_sound a) +def CB1_1_6I2R13Entropy : Ball := ⟨0, 0⟩ +lemma CB1_1_6I2R13Entropy_sound : CB1_1_6I2R13Entropy.Encloses (Foundation.finiteEntropy CB1_1_6I2R13Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_1_6I2R13Value CB1_1_6I2R13Terms CB1_1_6I2R13Terms_sound) (by decide +kernel) +def CB1_1_6I2R13Mass : Ball := ⟨0, 0⟩ +lemma CB1_1_6I2R13Mass_sound : CB1_1_6I2R13Mass.Encloses (∑ a, CB1_1_6I2R13Value a) := by + exact contains_sound (finSumBall_sound 6 CB1_1_6I2R13P CB1_1_6I2R13Value CB1_1_6I2R13P_sound) (by decide +kernel) +def CB1_1_6I2R13MassTerm : Ball := .exact 0 +lemma CB1_1_6I2R13MassTerm_sound : CB1_1_6I2R13MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_1_6I2R13Value a))) := + entropyTerm_zero_ball (CB1_1_6I2R13Mass_sound) +def CB1_1_6I2R13H : Ball := ⟨0, 0⟩ +lemma CB1_1_6I2R13H_sound : CB1_1_6I2R13H.Encloses (homogeneousEntropy CB1_1_6I2R13Value) := by + exact contains_sound (homogeneous_enclosed CB1_1_6I2R13Value CB1_1_6I2R13MassTerm_sound CB1_1_6I2R13Entropy_sound) (by decide +kernel) +def CB1_1_6I2R14Value (a : Fin 6) : ℝ := residualLaw (below (shape 1 1 6)) (fun u => (stageBLaw (shape 1 1 6) u : ℝ)) (stageBPriority (shape 1 1 6)) 2 (fun u a => (littleLaw (shape 1 1 6) u ((stageBPriority (shape 1 1 6)) 2) a : ℝ)) 14 a +def CB1_1_6I2R14Raw (a : Fin 6) : Ball := residualBall (below (shape 1 1 6)) B1_1_6Law (stageBPriority (shape 1 1 6)) 2 (fun u => B1_1_6Little u ((stageBPriority (shape 1 1 6)) 2)) 14 a +lemma CB1_1_6I2R14Raw_sound (a : Fin 6) : + (CB1_1_6I2R14Raw a).Encloses (CB1_1_6I2R14Value a) := by + exact residualBall_sound_on (below (shape 1 1 6)) B1_1_6Law (fun u => (stageBLaw (shape 1 1 6) u : ℝ)) (stageBPriority (shape 1 1 6)) 2 (fun u => B1_1_6Little u ((stageBPriority (shape 1 1 6)) 2)) (fun u a => (littleLaw (shape 1 1 6) u ((stageBPriority (shape 1 1 6)) 2) a : ℝ)) (fun u _ => B1_1_6Law_sound u) (fun u _ a => B1_1_6Little_sound u ((stageBPriority (shape 1 1 6)) 2) a) 14 a +def CB1_1_6I2R14Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB1_1_6I2R14Certificates_valid : + CB1_1_6I2R14Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_1_6I2R14CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB1_1_6I2R14P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_1_6I2R14Certificates (CB1_1_6I2R14CertificateIndex a)).input +lemma CB1_1_6I2R14P_check : ∀ a : Fin 6, contains (CB1_1_6I2R14Raw a) (CB1_1_6I2R14P a) = true := by + decide +kernel +lemma CB1_1_6I2R14P_sound (a : Fin 6) : + (CB1_1_6I2R14P a).Encloses (CB1_1_6I2R14Value a) := + contains_sound (CB1_1_6I2R14Raw_sound a) (CB1_1_6I2R14P_check a) +def CB1_1_6I2R14Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_1_6I2R14Certificates (CB1_1_6I2R14CertificateIndex a)).output +lemma CB1_1_6I2R14Terms_sound (a : Fin 6) : + (CB1_1_6I2R14Terms a).Encloses (Foundation.entropyTerm (CB1_1_6I2R14Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_1_6I2R14Certificates_valid + (CB1_1_6I2R14CertificateIndex a) (CB1_1_6I2R14P_sound a) +def CB1_1_6I2R14Entropy : Ball := ⟨0, 0⟩ +lemma CB1_1_6I2R14Entropy_sound : CB1_1_6I2R14Entropy.Encloses (Foundation.finiteEntropy CB1_1_6I2R14Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_1_6I2R14Value CB1_1_6I2R14Terms CB1_1_6I2R14Terms_sound) (by decide +kernel) +def CB1_1_6I2R14Mass : Ball := ⟨0, 0⟩ +lemma CB1_1_6I2R14Mass_sound : CB1_1_6I2R14Mass.Encloses (∑ a, CB1_1_6I2R14Value a) := by + exact contains_sound (finSumBall_sound 6 CB1_1_6I2R14P CB1_1_6I2R14Value CB1_1_6I2R14P_sound) (by decide +kernel) +def CB1_1_6I2R14MassTerm : Ball := .exact 0 +lemma CB1_1_6I2R14MassTerm_sound : CB1_1_6I2R14MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_1_6I2R14Value a))) := + entropyTerm_zero_ball (CB1_1_6I2R14Mass_sound) +def CB1_1_6I2R14H : Ball := ⟨0, 0⟩ +lemma CB1_1_6I2R14H_sound : CB1_1_6I2R14H.Encloses (homogeneousEntropy CB1_1_6I2R14Value) := by + exact contains_sound (homogeneous_enclosed CB1_1_6I2R14Value CB1_1_6I2R14MassTerm_sound CB1_1_6I2R14Entropy_sound) (by decide +kernel) +def CB1_1_6I2R15Value (a : Fin 6) : ℝ := residualLaw (below (shape 1 1 6)) (fun u => (stageBLaw (shape 1 1 6) u : ℝ)) (stageBPriority (shape 1 1 6)) 2 (fun u a => (littleLaw (shape 1 1 6) u ((stageBPriority (shape 1 1 6)) 2) a : ℝ)) 15 a +def CB1_1_6I2R15Raw (a : Fin 6) : Ball := residualBall (below (shape 1 1 6)) B1_1_6Law (stageBPriority (shape 1 1 6)) 2 (fun u => B1_1_6Little u ((stageBPriority (shape 1 1 6)) 2)) 15 a +lemma CB1_1_6I2R15Raw_sound (a : Fin 6) : + (CB1_1_6I2R15Raw a).Encloses (CB1_1_6I2R15Value a) := by + exact residualBall_sound_on (below (shape 1 1 6)) B1_1_6Law (fun u => (stageBLaw (shape 1 1 6) u : ℝ)) (stageBPriority (shape 1 1 6)) 2 (fun u => B1_1_6Little u ((stageBPriority (shape 1 1 6)) 2)) (fun u a => (littleLaw (shape 1 1 6) u ((stageBPriority (shape 1 1 6)) 2) a : ℝ)) (fun u _ => B1_1_6Law_sound u) (fun u _ a => B1_1_6Little_sound u ((stageBPriority (shape 1 1 6)) 2) a) 15 a +def CB1_1_6I2R15Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB1_1_6I2R15Certificates_valid : + CB1_1_6I2R15Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_1_6I2R15CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB1_1_6I2R15P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_1_6I2R15Certificates (CB1_1_6I2R15CertificateIndex a)).input +lemma CB1_1_6I2R15P_check : ∀ a : Fin 6, contains (CB1_1_6I2R15Raw a) (CB1_1_6I2R15P a) = true := by + decide +kernel +lemma CB1_1_6I2R15P_sound (a : Fin 6) : + (CB1_1_6I2R15P a).Encloses (CB1_1_6I2R15Value a) := + contains_sound (CB1_1_6I2R15Raw_sound a) (CB1_1_6I2R15P_check a) +def CB1_1_6I2R15Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_1_6I2R15Certificates (CB1_1_6I2R15CertificateIndex a)).output +lemma CB1_1_6I2R15Terms_sound (a : Fin 6) : + (CB1_1_6I2R15Terms a).Encloses (Foundation.entropyTerm (CB1_1_6I2R15Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_1_6I2R15Certificates_valid + (CB1_1_6I2R15CertificateIndex a) (CB1_1_6I2R15P_sound a) +def CB1_1_6I2R15Entropy : Ball := ⟨0, 0⟩ +lemma CB1_1_6I2R15Entropy_sound : CB1_1_6I2R15Entropy.Encloses (Foundation.finiteEntropy CB1_1_6I2R15Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_1_6I2R15Value CB1_1_6I2R15Terms CB1_1_6I2R15Terms_sound) (by decide +kernel) +def CB1_1_6I2R15Mass : Ball := ⟨0, 0⟩ +lemma CB1_1_6I2R15Mass_sound : CB1_1_6I2R15Mass.Encloses (∑ a, CB1_1_6I2R15Value a) := by + exact contains_sound (finSumBall_sound 6 CB1_1_6I2R15P CB1_1_6I2R15Value CB1_1_6I2R15P_sound) (by decide +kernel) +def CB1_1_6I2R15MassTerm : Ball := .exact 0 +lemma CB1_1_6I2R15MassTerm_sound : CB1_1_6I2R15MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_1_6I2R15Value a))) := + entropyTerm_zero_ball (CB1_1_6I2R15Mass_sound) +def CB1_1_6I2R15H : Ball := ⟨0, 0⟩ +lemma CB1_1_6I2R15H_sound : CB1_1_6I2R15H.Encloses (homogeneousEntropy CB1_1_6I2R15Value) := by + exact contains_sound (homogeneous_enclosed CB1_1_6I2R15Value CB1_1_6I2R15MassTerm_sound CB1_1_6I2R15Entropy_sound) (by decide +kernel) +def CB1_1_6I2R16Value (a : Fin 6) : ℝ := residualLaw (below (shape 1 1 6)) (fun u => (stageBLaw (shape 1 1 6) u : ℝ)) (stageBPriority (shape 1 1 6)) 2 (fun u a => (littleLaw (shape 1 1 6) u ((stageBPriority (shape 1 1 6)) 2) a : ℝ)) 16 a +def CB1_1_6I2R16Raw (a : Fin 6) : Ball := residualBall (below (shape 1 1 6)) B1_1_6Law (stageBPriority (shape 1 1 6)) 2 (fun u => B1_1_6Little u ((stageBPriority (shape 1 1 6)) 2)) 16 a +lemma CB1_1_6I2R16Raw_sound (a : Fin 6) : + (CB1_1_6I2R16Raw a).Encloses (CB1_1_6I2R16Value a) := by + exact residualBall_sound_on (below (shape 1 1 6)) B1_1_6Law (fun u => (stageBLaw (shape 1 1 6) u : ℝ)) (stageBPriority (shape 1 1 6)) 2 (fun u => B1_1_6Little u ((stageBPriority (shape 1 1 6)) 2)) (fun u a => (littleLaw (shape 1 1 6) u ((stageBPriority (shape 1 1 6)) 2) a : ℝ)) (fun u _ => B1_1_6Law_sound u) (fun u _ a => B1_1_6Little_sound u ((stageBPriority (shape 1 1 6)) 2) a) 16 a +def CB1_1_6I2R16Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB1_1_6I2R16Certificates_valid : + CB1_1_6I2R16Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_1_6I2R16CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB1_1_6I2R16P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_1_6I2R16Certificates (CB1_1_6I2R16CertificateIndex a)).input +lemma CB1_1_6I2R16P_check : ∀ a : Fin 6, contains (CB1_1_6I2R16Raw a) (CB1_1_6I2R16P a) = true := by + decide +kernel +lemma CB1_1_6I2R16P_sound (a : Fin 6) : + (CB1_1_6I2R16P a).Encloses (CB1_1_6I2R16Value a) := + contains_sound (CB1_1_6I2R16Raw_sound a) (CB1_1_6I2R16P_check a) +def CB1_1_6I2R16Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_1_6I2R16Certificates (CB1_1_6I2R16CertificateIndex a)).output +lemma CB1_1_6I2R16Terms_sound (a : Fin 6) : + (CB1_1_6I2R16Terms a).Encloses (Foundation.entropyTerm (CB1_1_6I2R16Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_1_6I2R16Certificates_valid + (CB1_1_6I2R16CertificateIndex a) (CB1_1_6I2R16P_sound a) +def CB1_1_6I2R16Entropy : Ball := ⟨0, 0⟩ +lemma CB1_1_6I2R16Entropy_sound : CB1_1_6I2R16Entropy.Encloses (Foundation.finiteEntropy CB1_1_6I2R16Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_1_6I2R16Value CB1_1_6I2R16Terms CB1_1_6I2R16Terms_sound) (by decide +kernel) +def CB1_1_6I2R16Mass : Ball := ⟨0, 0⟩ +lemma CB1_1_6I2R16Mass_sound : CB1_1_6I2R16Mass.Encloses (∑ a, CB1_1_6I2R16Value a) := by + exact contains_sound (finSumBall_sound 6 CB1_1_6I2R16P CB1_1_6I2R16Value CB1_1_6I2R16P_sound) (by decide +kernel) +def CB1_1_6I2R16MassTerm : Ball := .exact 0 +lemma CB1_1_6I2R16MassTerm_sound : CB1_1_6I2R16MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_1_6I2R16Value a))) := + entropyTerm_zero_ball (CB1_1_6I2R16Mass_sound) +def CB1_1_6I2R16H : Ball := ⟨0, 0⟩ +lemma CB1_1_6I2R16H_sound : CB1_1_6I2R16H.Encloses (homogeneousEntropy CB1_1_6I2R16Value) := by + exact contains_sound (homogeneous_enclosed CB1_1_6I2R16Value CB1_1_6I2R16MassTerm_sound CB1_1_6I2R16Entropy_sound) (by decide +kernel) +def CB1_1_6I2ResidualEntropies (a : Fin 17) : Ball := + match a.val with + | 0 => CB1_1_6I2R0H + | 1 => CB1_1_6I2R1H + | 2 => CB1_1_6I2R2H + | 3 => CB1_1_6I2R3H + | 4 => CB1_1_6I2R4H + | 5 => CB1_1_6I2R5H + | 6 => CB1_1_6I2R6H + | 7 => CB1_1_6I2R7H + | 8 => CB1_1_6I2R8H + | 9 => CB1_1_6I2R9H + | 10 => CB1_1_6I2R10H + | 11 => CB1_1_6I2R11H + | 12 => CB1_1_6I2R12H + | 13 => CB1_1_6I2R13H + | 14 => CB1_1_6I2R14H + | 15 => CB1_1_6I2R15H + | 16 => CB1_1_6I2R16H + | _ => (.exact 0) +lemma CB1_1_6I2ResidualEntropies_sound (k : Fin 17) : + (CB1_1_6I2ResidualEntropies k).Encloses (homogeneousEntropy + (residualLaw (below (shape 1 1 6)) (fun u => (stageBLaw (shape 1 1 6) u : ℝ)) (stageBPriority (shape 1 1 6)) 2 (fun u a => (littleLaw (shape 1 1 6) u ((stageBPriority (shape 1 1 6)) 2) a : ℝ)) k)) := by + fin_cases k + · exact CB1_1_6I2R0H_sound + · exact CB1_1_6I2R1H_sound + · exact CB1_1_6I2R2H_sound + · exact CB1_1_6I2R3H_sound + · exact CB1_1_6I2R4H_sound + · exact CB1_1_6I2R5H_sound + · exact CB1_1_6I2R6H_sound + · exact CB1_1_6I2R7H_sound + · exact CB1_1_6I2R8H_sound + · exact CB1_1_6I2R9H_sound + · exact CB1_1_6I2R10H_sound + · exact CB1_1_6I2R11H_sound + · exact CB1_1_6I2R12H_sound + · exact CB1_1_6I2R13H_sound + · exact CB1_1_6I2R14H_sound + · exact CB1_1_6I2R15H_sound + · exact CB1_1_6I2R16H_sound +def CB1_1_6I2S0_0_4Value (a : Fin 6) : ℝ := (littleLaw (shape 1 1 6) (shape 0 0 4) ((stageBPriority (shape 1 1 6)) 2) a : ℝ) +def CB1_1_6I2S0_0_4E_5Log : Ball := .exact 0 +lemma CB1_1_6I2S0_0_4E_5Log_sound : CB1_1_6I2S0_0_4E_5Log.Encloses (Real.log (CB1_1_6I2S0_0_4Value (5 : Fin 6))) := by + exact log_exact_one_ball ((B1_1_6Little_sound (shape 0 0 4) ((stageBPriority (shape 1 1 6)) 2)) (5 : Fin 6)) +def CB1_1_6I2S0_0_4E_5 : Ball := ⟨0, 0⟩ +lemma CB1_1_6I2S0_0_4E_5_sound : CB1_1_6I2S0_0_4E_5.Encloses (Foundation.entropyTerm (CB1_1_6I2S0_0_4Value (5 : Fin 6))) := by + exact contains_sound (entropyTerm_ball ((B1_1_6Little_sound (shape 0 0 4) ((stageBPriority (shape 1 1 6)) 2)) (5 : Fin 6)) CB1_1_6I2S0_0_4E_5Log_sound) (by decide +kernel) +def CB1_1_6I2S0_0_4Terms (a : Fin 6) : Ball := + match a.val with + | 5 => ⟨0, 0⟩ + | _ => (.exact 0) +lemma CB1_1_6I2S0_0_4Terms_sound (a : Fin 6) : + (CB1_1_6I2S0_0_4Terms a).Encloses (Foundation.entropyTerm (CB1_1_6I2S0_0_4Value a)) := by + fin_cases a + · exact (entropyTerm_zero_ball ((B1_1_6Little_sound (shape 0 0 4) ((stageBPriority (shape 1 1 6)) 2)) (0 : Fin 6))) + · exact (entropyTerm_zero_ball ((B1_1_6Little_sound (shape 0 0 4) ((stageBPriority (shape 1 1 6)) 2)) (1 : Fin 6))) + · exact (entropyTerm_zero_ball ((B1_1_6Little_sound (shape 0 0 4) ((stageBPriority (shape 1 1 6)) 2)) (2 : Fin 6))) + · exact (entropyTerm_zero_ball ((B1_1_6Little_sound (shape 0 0 4) ((stageBPriority (shape 1 1 6)) 2)) (3 : Fin 6))) + · exact (entropyTerm_zero_ball ((B1_1_6Little_sound (shape 0 0 4) ((stageBPriority (shape 1 1 6)) 2)) (4 : Fin 6))) + · exact CB1_1_6I2S0_0_4E_5_sound +def CB1_1_6I2S0_0_4Entropy : Ball := ⟨0, 0⟩ +lemma CB1_1_6I2S0_0_4Entropy_sound : CB1_1_6I2S0_0_4Entropy.Encloses (Foundation.finiteEntropy CB1_1_6I2S0_0_4Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_1_6I2S0_0_4Value CB1_1_6I2S0_0_4Terms CB1_1_6I2S0_0_4Terms_sound) (by decide +kernel) +def CB1_1_6I2S0_0_4Mass : Ball := ⟨1, 0⟩ +lemma CB1_1_6I2S0_0_4Mass_sound : CB1_1_6I2S0_0_4Mass.Encloses (∑ a, CB1_1_6I2S0_0_4Value a) := by + exact contains_sound (finSumBall_sound 6 (B1_1_6Little (shape 0 0 4) ((stageBPriority (shape 1 1 6)) 2)) CB1_1_6I2S0_0_4Value (B1_1_6Little_sound (shape 0 0 4) ((stageBPriority (shape 1 1 6)) 2))) (by decide +kernel) +def CB1_1_6I2S0_0_4MassTermLog : Ball := .exact 0 +lemma CB1_1_6I2S0_0_4MassTermLog_sound : CB1_1_6I2S0_0_4MassTermLog.Encloses (Real.log ((∑ a, CB1_1_6I2S0_0_4Value a))) := by + exact log_exact_one_ball (CB1_1_6I2S0_0_4Mass_sound) +def CB1_1_6I2S0_0_4MassTerm : Ball := ⟨0, 0⟩ +lemma CB1_1_6I2S0_0_4MassTerm_sound : CB1_1_6I2S0_0_4MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_1_6I2S0_0_4Value a))) := by + exact contains_sound (entropyTerm_ball (CB1_1_6I2S0_0_4Mass_sound) CB1_1_6I2S0_0_4MassTermLog_sound) (by decide +kernel) +def CB1_1_6I2S0_0_4H : Ball := ⟨0, 0⟩ +lemma CB1_1_6I2S0_0_4H_sound : CB1_1_6I2S0_0_4H.Encloses (homogeneousEntropy CB1_1_6I2S0_0_4Value) := by + exact contains_sound (homogeneous_enclosed CB1_1_6I2S0_0_4Value CB1_1_6I2S0_0_4MassTerm_sound CB1_1_6I2S0_0_4Entropy_sound) (by decide +kernel) +def CB1_1_6I2S0_1_3Value (a : Fin 6) : ℝ := (littleLaw (shape 1 1 6) (shape 0 1 3) ((stageBPriority (shape 1 1 6)) 2) a : ℝ) +def CB1_1_6I2S0_1_3E_4Log : Ball := .exact 0 +lemma CB1_1_6I2S0_1_3E_4Log_sound : CB1_1_6I2S0_1_3E_4Log.Encloses (Real.log (CB1_1_6I2S0_1_3Value (4 : Fin 6))) := by + exact log_exact_one_ball ((B1_1_6Little_sound (shape 0 1 3) ((stageBPriority (shape 1 1 6)) 2)) (4 : Fin 6)) +def CB1_1_6I2S0_1_3E_4 : Ball := ⟨0, 0⟩ +lemma CB1_1_6I2S0_1_3E_4_sound : CB1_1_6I2S0_1_3E_4.Encloses (Foundation.entropyTerm (CB1_1_6I2S0_1_3Value (4 : Fin 6))) := by + exact contains_sound (entropyTerm_ball ((B1_1_6Little_sound (shape 0 1 3) ((stageBPriority (shape 1 1 6)) 2)) (4 : Fin 6)) CB1_1_6I2S0_1_3E_4Log_sound) (by decide +kernel) +def CB1_1_6I2S0_1_3Terms (a : Fin 6) : Ball := + match a.val with + | 4 => ⟨0, 0⟩ + | _ => (.exact 0) +lemma CB1_1_6I2S0_1_3Terms_sound (a : Fin 6) : + (CB1_1_6I2S0_1_3Terms a).Encloses (Foundation.entropyTerm (CB1_1_6I2S0_1_3Value a)) := by + fin_cases a + · exact (entropyTerm_zero_ball ((B1_1_6Little_sound (shape 0 1 3) ((stageBPriority (shape 1 1 6)) 2)) (0 : Fin 6))) + · exact (entropyTerm_zero_ball ((B1_1_6Little_sound (shape 0 1 3) ((stageBPriority (shape 1 1 6)) 2)) (1 : Fin 6))) + · exact (entropyTerm_zero_ball ((B1_1_6Little_sound (shape 0 1 3) ((stageBPriority (shape 1 1 6)) 2)) (2 : Fin 6))) + · exact (entropyTerm_zero_ball ((B1_1_6Little_sound (shape 0 1 3) ((stageBPriority (shape 1 1 6)) 2)) (3 : Fin 6))) + · exact CB1_1_6I2S0_1_3E_4_sound + · exact (entropyTerm_zero_ball ((B1_1_6Little_sound (shape 0 1 3) ((stageBPriority (shape 1 1 6)) 2)) (5 : Fin 6))) +def CB1_1_6I2S0_1_3Entropy : Ball := ⟨0, 0⟩ +lemma CB1_1_6I2S0_1_3Entropy_sound : CB1_1_6I2S0_1_3Entropy.Encloses (Foundation.finiteEntropy CB1_1_6I2S0_1_3Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_1_6I2S0_1_3Value CB1_1_6I2S0_1_3Terms CB1_1_6I2S0_1_3Terms_sound) (by decide +kernel) +def CB1_1_6I2S0_1_3Mass : Ball := ⟨1, 0⟩ +lemma CB1_1_6I2S0_1_3Mass_sound : CB1_1_6I2S0_1_3Mass.Encloses (∑ a, CB1_1_6I2S0_1_3Value a) := by + exact contains_sound (finSumBall_sound 6 (B1_1_6Little (shape 0 1 3) ((stageBPriority (shape 1 1 6)) 2)) CB1_1_6I2S0_1_3Value (B1_1_6Little_sound (shape 0 1 3) ((stageBPriority (shape 1 1 6)) 2))) (by decide +kernel) +def CB1_1_6I2S0_1_3MassTermLog : Ball := .exact 0 +lemma CB1_1_6I2S0_1_3MassTermLog_sound : CB1_1_6I2S0_1_3MassTermLog.Encloses (Real.log ((∑ a, CB1_1_6I2S0_1_3Value a))) := by + exact log_exact_one_ball (CB1_1_6I2S0_1_3Mass_sound) +def CB1_1_6I2S0_1_3MassTerm : Ball := ⟨0, 0⟩ +lemma CB1_1_6I2S0_1_3MassTerm_sound : CB1_1_6I2S0_1_3MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_1_6I2S0_1_3Value a))) := by + exact contains_sound (entropyTerm_ball (CB1_1_6I2S0_1_3Mass_sound) CB1_1_6I2S0_1_3MassTermLog_sound) (by decide +kernel) +def CB1_1_6I2S0_1_3H : Ball := ⟨0, 0⟩ +lemma CB1_1_6I2S0_1_3H_sound : CB1_1_6I2S0_1_3H.Encloses (homogeneousEntropy CB1_1_6I2S0_1_3Value) := by + exact contains_sound (homogeneous_enclosed CB1_1_6I2S0_1_3Value CB1_1_6I2S0_1_3MassTerm_sound CB1_1_6I2S0_1_3Entropy_sound) (by decide +kernel) +def CB1_1_6I2S1_0_3Value (a : Fin 6) : ℝ := (littleLaw (shape 1 1 6) (shape 1 0 3) ((stageBPriority (shape 1 1 6)) 2) a : ℝ) +def CB1_1_6I2S1_0_3E_4Log : Ball := .exact 0 +lemma CB1_1_6I2S1_0_3E_4Log_sound : CB1_1_6I2S1_0_3E_4Log.Encloses (Real.log (CB1_1_6I2S1_0_3Value (4 : Fin 6))) := by + exact log_exact_one_ball ((B1_1_6Little_sound (shape 1 0 3) ((stageBPriority (shape 1 1 6)) 2)) (4 : Fin 6)) +def CB1_1_6I2S1_0_3E_4 : Ball := ⟨0, 0⟩ +lemma CB1_1_6I2S1_0_3E_4_sound : CB1_1_6I2S1_0_3E_4.Encloses (Foundation.entropyTerm (CB1_1_6I2S1_0_3Value (4 : Fin 6))) := by + exact contains_sound (entropyTerm_ball ((B1_1_6Little_sound (shape 1 0 3) ((stageBPriority (shape 1 1 6)) 2)) (4 : Fin 6)) CB1_1_6I2S1_0_3E_4Log_sound) (by decide +kernel) +def CB1_1_6I2S1_0_3Terms (a : Fin 6) : Ball := + match a.val with + | 4 => ⟨0, 0⟩ + | _ => (.exact 0) +lemma CB1_1_6I2S1_0_3Terms_sound (a : Fin 6) : + (CB1_1_6I2S1_0_3Terms a).Encloses (Foundation.entropyTerm (CB1_1_6I2S1_0_3Value a)) := by + fin_cases a + · exact (entropyTerm_zero_ball ((B1_1_6Little_sound (shape 1 0 3) ((stageBPriority (shape 1 1 6)) 2)) (0 : Fin 6))) + · exact (entropyTerm_zero_ball ((B1_1_6Little_sound (shape 1 0 3) ((stageBPriority (shape 1 1 6)) 2)) (1 : Fin 6))) + · exact (entropyTerm_zero_ball ((B1_1_6Little_sound (shape 1 0 3) ((stageBPriority (shape 1 1 6)) 2)) (2 : Fin 6))) + · exact (entropyTerm_zero_ball ((B1_1_6Little_sound (shape 1 0 3) ((stageBPriority (shape 1 1 6)) 2)) (3 : Fin 6))) + · exact CB1_1_6I2S1_0_3E_4_sound + · exact (entropyTerm_zero_ball ((B1_1_6Little_sound (shape 1 0 3) ((stageBPriority (shape 1 1 6)) 2)) (5 : Fin 6))) +def CB1_1_6I2S1_0_3Entropy : Ball := ⟨0, 0⟩ +lemma CB1_1_6I2S1_0_3Entropy_sound : CB1_1_6I2S1_0_3Entropy.Encloses (Foundation.finiteEntropy CB1_1_6I2S1_0_3Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_1_6I2S1_0_3Value CB1_1_6I2S1_0_3Terms CB1_1_6I2S1_0_3Terms_sound) (by decide +kernel) +def CB1_1_6I2S1_0_3Mass : Ball := ⟨1, 0⟩ +lemma CB1_1_6I2S1_0_3Mass_sound : CB1_1_6I2S1_0_3Mass.Encloses (∑ a, CB1_1_6I2S1_0_3Value a) := by + exact contains_sound (finSumBall_sound 6 (B1_1_6Little (shape 1 0 3) ((stageBPriority (shape 1 1 6)) 2)) CB1_1_6I2S1_0_3Value (B1_1_6Little_sound (shape 1 0 3) ((stageBPriority (shape 1 1 6)) 2))) (by decide +kernel) +def CB1_1_6I2S1_0_3MassTermLog : Ball := .exact 0 +lemma CB1_1_6I2S1_0_3MassTermLog_sound : CB1_1_6I2S1_0_3MassTermLog.Encloses (Real.log ((∑ a, CB1_1_6I2S1_0_3Value a))) := by + exact log_exact_one_ball (CB1_1_6I2S1_0_3Mass_sound) +def CB1_1_6I2S1_0_3MassTerm : Ball := ⟨0, 0⟩ +lemma CB1_1_6I2S1_0_3MassTerm_sound : CB1_1_6I2S1_0_3MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_1_6I2S1_0_3Value a))) := by + exact contains_sound (entropyTerm_ball (CB1_1_6I2S1_0_3Mass_sound) CB1_1_6I2S1_0_3MassTermLog_sound) (by decide +kernel) +def CB1_1_6I2S1_0_3H : Ball := ⟨0, 0⟩ +lemma CB1_1_6I2S1_0_3H_sound : CB1_1_6I2S1_0_3H.Encloses (homogeneousEntropy CB1_1_6I2S1_0_3Value) := by + exact contains_sound (homogeneous_enclosed CB1_1_6I2S1_0_3Value CB1_1_6I2S1_0_3MassTerm_sound CB1_1_6I2S1_0_3Entropy_sound) (by decide +kernel) +def CB1_1_6I2Singles (s : Shape) : Ball := + match s 0, s 1, s 2 with + | 0, 0, 4 => CB1_1_6I2S0_0_4H + | 0, 1, 3 => CB1_1_6I2S0_1_3H + | 1, 0, 3 => CB1_1_6I2S1_0_3H + | _, _, _ => (.exact 0) +lemma CB1_1_6I2Singles_sound (u : Shape) (hu : u ∈ below (shape 1 1 6)) + (hd : designated (stageBPriority (shape 1 1 6)) 2 u) : + (CB1_1_6I2Singles u).Encloses (homogeneousEntropy ((fun u a => (littleLaw (shape 1 1 6) u ((stageBPriority (shape 1 1 6)) 2) a : ℝ)) u)) := by + rw [B1_1_6_below] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl + · exact CB1_1_6I2S0_0_4H_sound + · exact CB1_1_6I2S0_1_3H_sound + · exact CB1_1_6I2S1_0_3H_sound + · exact (show ¬ designated (stageBPriority (shape 1 1 6)) 2 (shape 1 1 2) by decide +kernel) hd |>.elim +def CB1_1_6I2Singleton : Ball := ⟨0, 0⟩ +lemma CB1_1_6I2Singleton_sound : CB1_1_6I2Singleton.Encloses + (singletonEntropy (below (shape 1 1 6)) (fun u => (stageBLaw (shape 1 1 6) u : ℝ)) (stageBPriority (shape 1 1 6)) 2 (fun u a => (littleLaw (shape 1 1 6) u ((stageBPriority (shape 1 1 6)) 2) a : ℝ))) := by + exact contains_sound (singletonBall_sound (below (shape 1 1 6)) B1_1_6Law (fun u => (stageBLaw (shape 1 1 6) u : ℝ)) (stageBPriority (shape 1 1 6)) 2 + CB1_1_6I2Singles (fun u a => (littleLaw (shape 1 1 6) u ((stageBPriority (shape 1 1 6)) 2) a : ℝ)) (fun u _ => B1_1_6Law_sound u) CB1_1_6I2Singles_sound) (by decide +kernel) +def CB1_1_6I2Group : Ball := ⟨(1006789865939146600394739 / 160000000000000000000000000000), (3171047289 / 100000000000000000000000000000000)⟩ +lemma CB1_1_6I2Group_sound : CB1_1_6I2Group.Encloses + (groupedEntropy (below (shape 1 1 6)) (fun u => (stageBLaw (shape 1 1 6) u : ℝ)) (stageBPriority (shape 1 1 6)) 2 (fun u a => (littleLaw (shape 1 1 6) u ((stageBPriority (shape 1 1 6)) 2) a : ℝ))) := by + exact contains_sound (Ball.add_sound CB1_1_6I2Singleton_sound + (finSumBall_sound 17 CB1_1_6I2ResidualEntropies _ CB1_1_6I2ResidualEntropies_sound)) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CB1_1_6I2H : Ball := ⟨(5298954743116056355641608215911 / 50000000000000000000000000000000), (72248069637 / 100000000000000000000000000000000)⟩ +lemma CB1_1_6I2_sound : CB1_1_6I2H.Encloses (stageBCapacity (shape 1 1 6) 2) := by + have hb := contains_sound (Ball.add_sound CB1_1_6I2PairH_sound + (Ball.neg_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) CB1_1_6I2Group_sound))) + (show contains (.add CB1_1_6I2PairH (.neg (.mul (.exact 2) CB1_1_6I2Group))) CB1_1_6I2H = true by decide +kernel) + unfold CB1_1_6I2PairValue at hb + simpa only [stageBCapacity, nativeCapacity, + show (2 : Fin 3) ≠ 0 by decide, ite_false, sub_eq_add_neg] using hb + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/CapacityB/CapB1_2_5I0.lean b/lean/OAI/LinearAlgebra/MatrixFields/CapacityB/CapB1_2_5I0.lean new file mode 100644 index 0000000000000000000000000000000000000000..cbd94f720f0b0c52fdd87099e04e64498b535101 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/CapacityB/CapB1_2_5I0.lean @@ -0,0 +1,72 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Certificates.LittleB1_3_4 + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CB1_2_5I0Value (a : Fin 17) : ℝ := marginal (below (shape 1 2 5)) (fun u => (stageBLaw (shape 1 2 5) u : ℝ)) ((stageBPriority (shape 1 2 5)) 0) a +def CB1_2_5I0Raw (a : Fin 17) : Ball := marginalBall (below (shape 1 2 5)) B1_2_5Law ((stageBPriority (shape 1 2 5)) 0) a +lemma CB1_2_5I0Raw_sound (a : Fin 17) : + (CB1_2_5I0Raw a).Encloses (CB1_2_5I0Value a) := by + exact marginalBall_sound (below (shape 1 2 5)) B1_2_5Law (fun u => (stageBLaw (shape 1 2 5) u : ℝ)) (fun u _ => B1_2_5Law_sound u) ((stageBPriority (shape 1 2 5)) 0) a +def CB1_2_5I0Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(1 / 2), (1 / 2000000000000000000000000000000)⟩ ⟨(6931471805599453094172319305033 / 20000000000000000000000000000000), (2646977971 / 12500000000000000000000000000000)⟩ ⟨(-6931471805599453094172319305033 / 10000000000000000000000000000000), (8470329493 / 20000000000000000000000000000000)⟩ ⟨-1, 1, 1⟩] +lemma CB1_2_5I0Certificates_valid : + CB1_2_5I0Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_2_5I0CertificateIndex (a : Fin 17) : ℕ := + match a.val with + | 0 => 1 + | 1 => 1 + | _ => 0 +def CB1_2_5I0P (a : Fin 17) : Ball := + (CompactCertificate.entropyLookup CB1_2_5I0Certificates (CB1_2_5I0CertificateIndex a)).input +lemma CB1_2_5I0P_check : ∀ a : Fin 17, contains (CB1_2_5I0Raw a) (CB1_2_5I0P a) = true := by + decide +kernel +lemma CB1_2_5I0P_sound (a : Fin 17) : + (CB1_2_5I0P a).Encloses (CB1_2_5I0Value a) := + contains_sound (CB1_2_5I0Raw_sound a) (CB1_2_5I0P_check a) +def CB1_2_5I0Terms (a : Fin 17) : Ball := + (CompactCertificate.entropyLookup CB1_2_5I0Certificates (CB1_2_5I0CertificateIndex a)).output +lemma CB1_2_5I0Terms_sound (a : Fin 17) : + (CB1_2_5I0Terms a).Encloses (Foundation.entropyTerm (CB1_2_5I0Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_2_5I0Certificates_valid + (CB1_2_5I0CertificateIndex a) (CB1_2_5I0P_sound a) +def CB1_2_5I0Entropy : Ball := ⟨(6931471805599453094172319305033 / 10000000000000000000000000000000), (2646977971 / 6250000000000000000000000000000)⟩ +lemma CB1_2_5I0Entropy_sound : CB1_2_5I0Entropy.Encloses (Foundation.finiteEntropy CB1_2_5I0Value) := by + exact contains_sound (entropyFin_enclosed 17 CB1_2_5I0Value CB1_2_5I0Terms CB1_2_5I0Terms_sound) (by decide +kernel) +def CB1_2_5I0Mass : Ball := ⟨1, (1 / 1000000000000000000000000000000)⟩ +lemma CB1_2_5I0Mass_sound : CB1_2_5I0Mass.Encloses (∑ a, CB1_2_5I0Value a) := by + exact contains_sound (finSumBall_sound 17 CB1_2_5I0P CB1_2_5I0Value CB1_2_5I0P_sound) (by decide +kernel) +def CB1_2_5I0MassTermLogWitness : LogWitness := ⟨0, 1, 1⟩ +def CB1_2_5I0MassTermLog : Ball := ⟨0, (10587911891 / 50000000000000000000000000000000)⟩ +lemma CB1_2_5I0MassTermLog_sound : CB1_2_5I0MassTermLog.Encloses (Real.log ((∑ a, CB1_2_5I0Value a))) := by + exact checkLog_sound logTwoBall_sound (CB1_2_5I0Mass_sound) (w := CB1_2_5I0MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB1_2_5I0MassTerm : Ball := ⟨0, (21175823783 / 100000000000000000000000000000000)⟩ +lemma CB1_2_5I0MassTerm_sound : CB1_2_5I0MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_2_5I0Value a))) := by + exact contains_sound (entropyTerm_ball (CB1_2_5I0Mass_sound) CB1_2_5I0MassTermLog_sound) (by decide +kernel) +def CB1_2_5I0H : Ball := ⟨(6931471805599453094172319305033 / 10000000000000000000000000000000), (63527471319 / 100000000000000000000000000000000)⟩ +lemma CB1_2_5I0H_sound : CB1_2_5I0H.Encloses (homogeneousEntropy CB1_2_5I0Value) := by + exact contains_sound (homogeneous_enclosed CB1_2_5I0Value CB1_2_5I0MassTerm_sound CB1_2_5I0Entropy_sound) (by decide +kernel) +lemma CB1_2_5I0_sound : CB1_2_5I0H.Encloses (stageBCapacity (shape 1 2 5) 0) := by + exact CB1_2_5I0H_sound + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/CapacityB/CapB1_2_5I1.lean b/lean/OAI/LinearAlgebra/MatrixFields/CapacityB/CapB1_2_5I1.lean new file mode 100644 index 0000000000000000000000000000000000000000..652042439b3cbefd425858b7b947ecf1c70e6037 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/CapacityB/CapB1_2_5I1.lean @@ -0,0 +1,841 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Certificates.LittleB1_3_4 + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CB1_2_5I1PairValue (a : PairSlot) : ℝ := pairLaw (below (shape 1 2 5)) (shape 1 2 5) (fun u => (stageBLaw (shape 1 2 5) u : ℝ)) (fun u a => (littleLaw (shape 1 2 5) u ((stageBPriority (shape 1 2 5)) 1) a : ℝ)) a +def CB1_2_5I1PairRaw (a : PairSlot) : Ball := pairLawBall (below (shape 1 2 5)) (shape 1 2 5) B1_2_5Law (fun u => B1_2_5Little u ((stageBPriority (shape 1 2 5)) 1)) a +lemma CB1_2_5I1PairRaw_sound (a : PairSlot) : + (CB1_2_5I1PairRaw a).Encloses (CB1_2_5I1PairValue a) := by + exact pairLawBall_sound_on (below (shape 1 2 5)) (shape 1 2 5) B1_2_5Law (fun u => (stageBLaw (shape 1 2 5) u : ℝ)) (fun u => B1_2_5Little u ((stageBPriority (shape 1 2 5)) 1)) (fun u a => (littleLaw (shape 1 2 5) u ((stageBPriority (shape 1 2 5)) 1) a : ℝ)) (fun u _ => B1_2_5Law_sound u) (fun u _ a => B1_2_5Little_sound u ((stageBPriority (shape 1 2 5)) 1) a) (fun u _ a => B1_2_5Little_sound (complement (shape 1 2 5) u) ((stageBPriority (shape 1 2 5)) 1) a) a +def CB1_2_5I1PairCertificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(3297719669499762242862115497643 / 20000000000000000000000000000000), (1 / 3125000000000000000000000000000)⟩ ⟨(1188828635473791325464070514807 / 4000000000000000000000000000000), (6983193073 / 50000000000000000000000000000000)⟩ ⟨(-180250105318098057479891278100933 / 100000000000000000000000000000000), (3388131797 / 4000000000000000000000000000000)⟩ ⟨-3, 3297719669499762242862115497643, 2500000000000000000000000000000⟩, + .log ⟨(355998814646362178458756161701 / 20000000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ ⟨(7170813193033597016657214530243 / 100000000000000000000000000000000), (2638498867 / 100000000000000000000000000000000)⟩ ⟨(-402856015133469092923049928437821 / 100000000000000000000000000000000), (29646153201 / 20000000000000000000000000000000)⟩ ⟨-6, 355998814646362178458756161701, 312500000000000000000000000000⟩, + .log ⟨(396642594740867223667445521291 / 625000000000000000000000000000), (1 / 3125000000000000000000000000000)⟩ ⟨(28857559975047847690218380534771 / 100000000000000000000000000000000), (26877547731 / 100000000000000000000000000000000)⟩ ⟨(-45471603966760271388874596887337 / 100000000000000000000000000000000), (5293955927 / 12500000000000000000000000000000)⟩ ⟨-1, 396642594740867223667445521291, 312500000000000000000000000000⟩] +lemma CB1_2_5I1PairCertificates_valid : + CB1_2_5I1PairCertificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_2_5I1PairCertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 0, 2 => 1 + | 0, 3 => 2 + | 1, 1 => 3 + | 2, 0 => 1 + | 3, 0 => 2 + | _, _ => 0 +def CB1_2_5I1PairP (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CB1_2_5I1PairCertificates (CB1_2_5I1PairCertificateIndex a)).input +lemma CB1_2_5I1PairP_check : ∀ a : PairSlot, contains (CB1_2_5I1PairRaw a) (CB1_2_5I1PairP a) = true := by + decide +kernel +lemma CB1_2_5I1PairP_sound (a : PairSlot) : + (CB1_2_5I1PairP a).Encloses (CB1_2_5I1PairValue a) := + contains_sound (CB1_2_5I1PairRaw_sound a) (CB1_2_5I1PairP_check a) +def CB1_2_5I1PairTerms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CB1_2_5I1PairCertificates (CB1_2_5I1PairCertificateIndex a)).output +lemma CB1_2_5I1PairTerms_sound (a : PairSlot) : + (CB1_2_5I1PairTerms a).Encloses (Foundation.entropyTerm (CB1_2_5I1PairValue a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_2_5I1PairCertificates_valid + (CB1_2_5I1PairCertificateIndex a) (CB1_2_5I1PairP_sound a) +def CB1_2_5I1PairEntropy : Ball := ⟨(102640618134804607996736335335607 / 100000000000000000000000000000000), (60087317757 / 100000000000000000000000000000000)⟩ +lemma CB1_2_5I1PairEntropy_sound : CB1_2_5I1PairEntropy.Encloses (Foundation.finiteEntropy CB1_2_5I1PairValue) := by + exact contains_sound (entropyPair_enclosed CB1_2_5I1PairValue CB1_2_5I1PairTerms CB1_2_5I1PairTerms_sound) (by decide +kernel) +def CB1_2_5I1PairMass : Ball := ⟨1, (13 / 12500000000000000000000000000000)⟩ +lemma CB1_2_5I1PairMass_sound : CB1_2_5I1PairMass.Encloses (∑ a, CB1_2_5I1PairValue a) := by + exact contains_sound (pairSumBall_sound CB1_2_5I1PairP CB1_2_5I1PairValue CB1_2_5I1PairP_sound) (by decide +kernel) +def CB1_2_5I1PairMassTermLogWitness : LogWitness := ⟨0, 1, 1⟩ +def CB1_2_5I1PairMassTermLog : Ball := ⟨0, (10587911893 / 50000000000000000000000000000000)⟩ +lemma CB1_2_5I1PairMassTermLog_sound : CB1_2_5I1PairMassTermLog.Encloses (Real.log ((∑ a, CB1_2_5I1PairValue a))) := by + exact checkLog_sound logTwoBall_sound (CB1_2_5I1PairMass_sound) (w := CB1_2_5I1PairMassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB1_2_5I1PairMassTerm : Ball := ⟨0, (21175823787 / 100000000000000000000000000000000)⟩ +lemma CB1_2_5I1PairMassTerm_sound : CB1_2_5I1PairMassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_2_5I1PairValue a))) := by + exact contains_sound (entropyTerm_ball (CB1_2_5I1PairMass_sound) CB1_2_5I1PairMassTermLog_sound) (by decide +kernel) +def CB1_2_5I1PairH : Ball := ⟨(102640618134804607996736335335607 / 100000000000000000000000000000000), (10157892693 / 12500000000000000000000000000000)⟩ +lemma CB1_2_5I1PairH_sound : CB1_2_5I1PairH.Encloses (homogeneousEntropy CB1_2_5I1PairValue) := by + exact contains_sound (homogeneous_enclosed CB1_2_5I1PairValue CB1_2_5I1PairMassTerm_sound CB1_2_5I1PairEntropy_sound) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CB1_2_5I1R0Value (a : Fin 6) : ℝ := residualLaw (below (shape 1 2 5)) (fun u => (stageBLaw (shape 1 2 5) u : ℝ)) (stageBPriority (shape 1 2 5)) 1 (fun u a => (littleLaw (shape 1 2 5) u ((stageBPriority (shape 1 2 5)) 1) a : ℝ)) 0 a +def CB1_2_5I1R0Raw (a : Fin 6) : Ball := residualBall (below (shape 1 2 5)) B1_2_5Law (stageBPriority (shape 1 2 5)) 1 (fun u => B1_2_5Little u ((stageBPriority (shape 1 2 5)) 1)) 0 a +lemma CB1_2_5I1R0Raw_sound (a : Fin 6) : + (CB1_2_5I1R0Raw a).Encloses (CB1_2_5I1R0Value a) := by + exact residualBall_sound_on (below (shape 1 2 5)) B1_2_5Law (fun u => (stageBLaw (shape 1 2 5) u : ℝ)) (stageBPriority (shape 1 2 5)) 1 (fun u => B1_2_5Little u ((stageBPriority (shape 1 2 5)) 1)) (fun u a => (littleLaw (shape 1 2 5) u ((stageBPriority (shape 1 2 5)) 1) a : ℝ)) (fun u _ => B1_2_5Law_sound u) (fun u _ a => B1_2_5Little_sound u ((stageBPriority (shape 1 2 5)) 1) a) 0 a +def CB1_2_5I1R0Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(228357405259132776332554478709 / 1250000000000000000000000000000), (17 / 50000000000000000000000000000000)⟩ ⟨(31056367098208207478678397415287 / 100000000000000000000000000000000), (7737049887 / 50000000000000000000000000000000)⟩ ⟨(-169998686176645017605219863694851 / 100000000000000000000000000000000), (42351647459 / 50000000000000000000000000000000)⟩ ⟨-3, 228357405259132776332554478709, 156250000000000000000000000000⟩] +lemma CB1_2_5I1R0Certificates_valid : + CB1_2_5I1R0Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_2_5I1R0CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | 0 => 1 + | _ => 0 +def CB1_2_5I1R0P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_2_5I1R0Certificates (CB1_2_5I1R0CertificateIndex a)).input +lemma CB1_2_5I1R0P_check : ∀ a : Fin 6, contains (CB1_2_5I1R0Raw a) (CB1_2_5I1R0P a) = true := by + decide +kernel +lemma CB1_2_5I1R0P_sound (a : Fin 6) : + (CB1_2_5I1R0P a).Encloses (CB1_2_5I1R0Value a) := + contains_sound (CB1_2_5I1R0Raw_sound a) (CB1_2_5I1R0P_check a) +def CB1_2_5I1R0Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_2_5I1R0Certificates (CB1_2_5I1R0CertificateIndex a)).output +lemma CB1_2_5I1R0Terms_sound (a : Fin 6) : + (CB1_2_5I1R0Terms a).Encloses (Foundation.entropyTerm (CB1_2_5I1R0Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_2_5I1R0Certificates_valid + (CB1_2_5I1R0CertificateIndex a) (CB1_2_5I1R0P_sound a) +def CB1_2_5I1R0Entropy : Ball := ⟨(31056367098208207478678397415287 / 100000000000000000000000000000000), (7737049887 / 50000000000000000000000000000000)⟩ +lemma CB1_2_5I1R0Entropy_sound : CB1_2_5I1R0Entropy.Encloses (Foundation.finiteEntropy CB1_2_5I1R0Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_2_5I1R0Value CB1_2_5I1R0Terms CB1_2_5I1R0Terms_sound) (by decide +kernel) +def CB1_2_5I1R0Mass : Ball := ⟨(228357405259132776332554478709 / 1250000000000000000000000000000), (17 / 50000000000000000000000000000000)⟩ +lemma CB1_2_5I1R0Mass_sound : CB1_2_5I1R0Mass.Encloses (∑ a, CB1_2_5I1R0Value a) := by + exact contains_sound (finSumBall_sound 6 CB1_2_5I1R0P CB1_2_5I1R0Value CB1_2_5I1R0P_sound) (by decide +kernel) +def CB1_2_5I1R0MassTermLogWitness : LogWitness := ⟨-3, 228357405259132776332554478709, 156250000000000000000000000000⟩ +def CB1_2_5I1R0MassTermLog : Ball := ⟨(-169998686176645017605219863694851 / 100000000000000000000000000000000), (42351647459 / 50000000000000000000000000000000)⟩ +lemma CB1_2_5I1R0MassTermLog_sound : CB1_2_5I1R0MassTermLog.Encloses (Real.log ((∑ a, CB1_2_5I1R0Value a))) := by + exact checkLog_sound logTwoBall_sound (CB1_2_5I1R0Mass_sound) (w := CB1_2_5I1R0MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB1_2_5I1R0MassTerm : Ball := ⟨(31056367098208207478678397415287 / 100000000000000000000000000000000), (7737049887 / 50000000000000000000000000000000)⟩ +lemma CB1_2_5I1R0MassTerm_sound : CB1_2_5I1R0MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_2_5I1R0Value a))) := by + exact contains_sound (entropyTerm_ball (CB1_2_5I1R0Mass_sound) CB1_2_5I1R0MassTermLog_sound) (by decide +kernel) +def CB1_2_5I1R0H : Ball := ⟨0, (7737049887 / 25000000000000000000000000000000)⟩ +lemma CB1_2_5I1R0H_sound : CB1_2_5I1R0H.Encloses (homogeneousEntropy CB1_2_5I1R0Value) := by + exact contains_sound (homogeneous_enclosed CB1_2_5I1R0Value CB1_2_5I1R0MassTerm_sound CB1_2_5I1R0Entropy_sound) (by decide +kernel) +def CB1_2_5I1R1Value (a : Fin 6) : ℝ := residualLaw (below (shape 1 2 5)) (fun u => (stageBLaw (shape 1 2 5) u : ℝ)) (stageBPriority (shape 1 2 5)) 1 (fun u a => (littleLaw (shape 1 2 5) u ((stageBPriority (shape 1 2 5)) 1) a : ℝ)) 1 a +def CB1_2_5I1R1Raw (a : Fin 6) : Ball := residualBall (below (shape 1 2 5)) B1_2_5Law (stageBPriority (shape 1 2 5)) 1 (fun u => B1_2_5Little u ((stageBPriority (shape 1 2 5)) 1)) 1 a +lemma CB1_2_5I1R1Raw_sound (a : Fin 6) : + (CB1_2_5I1R1Raw a).Encloses (CB1_2_5I1R1Value a) := by + exact residualBall_sound_on (below (shape 1 2 5)) B1_2_5Law (fun u => (stageBLaw (shape 1 2 5) u : ℝ)) (stageBPriority (shape 1 2 5)) 1 (fun u => B1_2_5Little u ((stageBPriority (shape 1 2 5)) 1)) (fun u a => (littleLaw (shape 1 2 5) u ((stageBPriority (shape 1 2 5)) 1) a : ℝ)) (fun u _ => B1_2_5Law_sound u) (fun u _ a => B1_2_5Little_sound u ((stageBPriority (shape 1 2 5)) 1) a) 1 a +def CB1_2_5I1R1Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(396642594740867223667445521291 / 625000000000000000000000000000), (1 / 3125000000000000000000000000000)⟩ ⟨(28857559975047847690218380534771 / 100000000000000000000000000000000), (26877547731 / 100000000000000000000000000000000)⟩ ⟨(-45471603966760271388874596887337 / 100000000000000000000000000000000), (5293955927 / 12500000000000000000000000000000)⟩ ⟨-1, 396642594740867223667445521291, 312500000000000000000000000000⟩] +lemma CB1_2_5I1R1Certificates_valid : + CB1_2_5I1R1Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_2_5I1R1CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | 1 => 1 + | _ => 0 +def CB1_2_5I1R1P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_2_5I1R1Certificates (CB1_2_5I1R1CertificateIndex a)).input +lemma CB1_2_5I1R1P_check : ∀ a : Fin 6, contains (CB1_2_5I1R1Raw a) (CB1_2_5I1R1P a) = true := by + decide +kernel +lemma CB1_2_5I1R1P_sound (a : Fin 6) : + (CB1_2_5I1R1P a).Encloses (CB1_2_5I1R1Value a) := + contains_sound (CB1_2_5I1R1Raw_sound a) (CB1_2_5I1R1P_check a) +def CB1_2_5I1R1Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_2_5I1R1Certificates (CB1_2_5I1R1CertificateIndex a)).output +lemma CB1_2_5I1R1Terms_sound (a : Fin 6) : + (CB1_2_5I1R1Terms a).Encloses (Foundation.entropyTerm (CB1_2_5I1R1Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_2_5I1R1Certificates_valid + (CB1_2_5I1R1CertificateIndex a) (CB1_2_5I1R1P_sound a) +def CB1_2_5I1R1Entropy : Ball := ⟨(28857559975047847690218380534771 / 100000000000000000000000000000000), (26877547731 / 100000000000000000000000000000000)⟩ +lemma CB1_2_5I1R1Entropy_sound : CB1_2_5I1R1Entropy.Encloses (Foundation.finiteEntropy CB1_2_5I1R1Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_2_5I1R1Value CB1_2_5I1R1Terms CB1_2_5I1R1Terms_sound) (by decide +kernel) +def CB1_2_5I1R1Mass : Ball := ⟨(396642594740867223667445521291 / 625000000000000000000000000000), (1 / 3125000000000000000000000000000)⟩ +lemma CB1_2_5I1R1Mass_sound : CB1_2_5I1R1Mass.Encloses (∑ a, CB1_2_5I1R1Value a) := by + exact contains_sound (finSumBall_sound 6 CB1_2_5I1R1P CB1_2_5I1R1Value CB1_2_5I1R1P_sound) (by decide +kernel) +def CB1_2_5I1R1MassTermLogWitness : LogWitness := ⟨-1, 396642594740867223667445521291, 312500000000000000000000000000⟩ +def CB1_2_5I1R1MassTermLog : Ball := ⟨(-45471603966760271388874596887337 / 100000000000000000000000000000000), (5293955927 / 12500000000000000000000000000000)⟩ +lemma CB1_2_5I1R1MassTermLog_sound : CB1_2_5I1R1MassTermLog.Encloses (Real.log ((∑ a, CB1_2_5I1R1Value a))) := by + exact checkLog_sound logTwoBall_sound (CB1_2_5I1R1Mass_sound) (w := CB1_2_5I1R1MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB1_2_5I1R1MassTerm : Ball := ⟨(28857559975047847690218380534771 / 100000000000000000000000000000000), (26877547731 / 100000000000000000000000000000000)⟩ +lemma CB1_2_5I1R1MassTerm_sound : CB1_2_5I1R1MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_2_5I1R1Value a))) := by + exact contains_sound (entropyTerm_ball (CB1_2_5I1R1Mass_sound) CB1_2_5I1R1MassTermLog_sound) (by decide +kernel) +def CB1_2_5I1R1H : Ball := ⟨0, (26877547731 / 50000000000000000000000000000000)⟩ +lemma CB1_2_5I1R1H_sound : CB1_2_5I1R1H.Encloses (homogeneousEntropy CB1_2_5I1R1Value) := by + exact contains_sound (homogeneous_enclosed CB1_2_5I1R1Value CB1_2_5I1R1MassTerm_sound CB1_2_5I1R1Entropy_sound) (by decide +kernel) +def CB1_2_5I1R2Value (a : Fin 6) : ℝ := residualLaw (below (shape 1 2 5)) (fun u => (stageBLaw (shape 1 2 5) u : ℝ)) (stageBPriority (shape 1 2 5)) 1 (fun u a => (littleLaw (shape 1 2 5) u ((stageBPriority (shape 1 2 5)) 1) a : ℝ)) 2 a +def CB1_2_5I1R2Raw (a : Fin 6) : Ball := residualBall (below (shape 1 2 5)) B1_2_5Law (stageBPriority (shape 1 2 5)) 1 (fun u => B1_2_5Little u ((stageBPriority (shape 1 2 5)) 1)) 2 a +lemma CB1_2_5I1R2Raw_sound (a : Fin 6) : + (CB1_2_5I1R2Raw a).Encloses (CB1_2_5I1R2Value a) := by + exact residualBall_sound_on (below (shape 1 2 5)) B1_2_5Law (fun u => (stageBLaw (shape 1 2 5) u : ℝ)) (stageBPriority (shape 1 2 5)) 1 (fun u => B1_2_5Little u ((stageBPriority (shape 1 2 5)) 1)) (fun u a => (littleLaw (shape 1 2 5) u ((stageBPriority (shape 1 2 5)) 1) a : ℝ)) (fun u _ => B1_2_5Law_sound u) (fun u _ a => B1_2_5Little_sound u ((stageBPriority (shape 1 2 5)) 1) a) 2 a +def CB1_2_5I1R2Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(3297719669499762242862115497643 / 20000000000000000000000000000000), (1 / 3125000000000000000000000000000)⟩ ⟨(1188828635473791325464070514807 / 4000000000000000000000000000000), (6983193073 / 50000000000000000000000000000000)⟩ ⟨(-180250105318098057479891278100933 / 100000000000000000000000000000000), (3388131797 / 4000000000000000000000000000000)⟩ ⟨-3, 3297719669499762242862115497643, 2500000000000000000000000000000⟩, + .log ⟨(355998814646362178458756161701 / 20000000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ ⟨(7170813193033597016657214530243 / 100000000000000000000000000000000), (2638498867 / 100000000000000000000000000000000)⟩ ⟨(-402856015133469092923049928437821 / 100000000000000000000000000000000), (29646153201 / 20000000000000000000000000000000)⟩ ⟨-6, 355998814646362178458756161701, 312500000000000000000000000000⟩] +lemma CB1_2_5I1R2Certificates_valid : + CB1_2_5I1R2Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_2_5I1R2CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | 2 => 1 + | 3 => 2 + | _ => 0 +def CB1_2_5I1R2P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_2_5I1R2Certificates (CB1_2_5I1R2CertificateIndex a)).input +lemma CB1_2_5I1R2P_check : ∀ a : Fin 6, contains (CB1_2_5I1R2Raw a) (CB1_2_5I1R2P a) = true := by + decide +kernel +lemma CB1_2_5I1R2P_sound (a : Fin 6) : + (CB1_2_5I1R2P a).Encloses (CB1_2_5I1R2Value a) := + contains_sound (CB1_2_5I1R2Raw_sound a) (CB1_2_5I1R2P_check a) +def CB1_2_5I1R2Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_2_5I1R2Certificates (CB1_2_5I1R2CertificateIndex a)).output +lemma CB1_2_5I1R2Terms_sound (a : Fin 6) : + (CB1_2_5I1R2Terms a).Encloses (Foundation.entropyTerm (CB1_2_5I1R2Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_2_5I1R2Certificates_valid + (CB1_2_5I1R2CertificateIndex a) (CB1_2_5I1R2P_sound a) +def CB1_2_5I1R2Entropy : Ball := ⟨(18445764539939190076629488700209 / 50000000000000000000000000000000), (16604885013 / 100000000000000000000000000000000)⟩ +lemma CB1_2_5I1R2Entropy_sound : CB1_2_5I1R2Entropy.Encloses (Foundation.finiteEntropy CB1_2_5I1R2Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_2_5I1R2Value CB1_2_5I1R2Terms CB1_2_5I1R2Terms_sound) (by decide +kernel) +def CB1_2_5I1R2Mass : Ball := ⟨(228357405259132776332554478709 / 1250000000000000000000000000000), (9 / 25000000000000000000000000000000)⟩ +lemma CB1_2_5I1R2Mass_sound : CB1_2_5I1R2Mass.Encloses (∑ a, CB1_2_5I1R2Value a) := by + exact contains_sound (finSumBall_sound 6 CB1_2_5I1R2P CB1_2_5I1R2Value CB1_2_5I1R2P_sound) (by decide +kernel) +def CB1_2_5I1R2MassTermLogWitness : LogWitness := ⟨-3, 228357405259132776332554478709, 156250000000000000000000000000⟩ +def CB1_2_5I1R2MassTermLog : Ball := ⟨(-169998686176645017605219863694851 / 100000000000000000000000000000000), (84703294929 / 100000000000000000000000000000000)⟩ +lemma CB1_2_5I1R2MassTermLog_sound : CB1_2_5I1R2MassTermLog.Encloses (Real.log ((∑ a, CB1_2_5I1R2Value a))) := by + exact checkLog_sound logTwoBall_sound (CB1_2_5I1R2Mass_sound) (w := CB1_2_5I1R2MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB1_2_5I1R2MassTerm : Ball := ⟨(31056367098208207478678397415287 / 100000000000000000000000000000000), (15474099779 / 100000000000000000000000000000000)⟩ +lemma CB1_2_5I1R2MassTerm_sound : CB1_2_5I1R2MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_2_5I1R2Value a))) := by + exact contains_sound (entropyTerm_ball (CB1_2_5I1R2Mass_sound) CB1_2_5I1R2MassTermLog_sound) (by decide +kernel) +def CB1_2_5I1R2H : Ball := ⟨(5835161981670172674580579985131 / 100000000000000000000000000000000), (4009873099 / 12500000000000000000000000000000)⟩ +lemma CB1_2_5I1R2H_sound : CB1_2_5I1R2H.Encloses (homogeneousEntropy CB1_2_5I1R2Value) := by + exact contains_sound (homogeneous_enclosed CB1_2_5I1R2Value CB1_2_5I1R2MassTerm_sound CB1_2_5I1R2Entropy_sound) (by decide +kernel) +def CB1_2_5I1R3Value (a : Fin 6) : ℝ := residualLaw (below (shape 1 2 5)) (fun u => (stageBLaw (shape 1 2 5) u : ℝ)) (stageBPriority (shape 1 2 5)) 1 (fun u a => (littleLaw (shape 1 2 5) u ((stageBPriority (shape 1 2 5)) 1) a : ℝ)) 3 a +def CB1_2_5I1R3Raw (a : Fin 6) : Ball := residualBall (below (shape 1 2 5)) B1_2_5Law (stageBPriority (shape 1 2 5)) 1 (fun u => B1_2_5Little u ((stageBPriority (shape 1 2 5)) 1)) 3 a +lemma CB1_2_5I1R3Raw_sound (a : Fin 6) : + (CB1_2_5I1R3Raw a).Encloses (CB1_2_5I1R3Value a) := by + exact residualBall_sound_on (below (shape 1 2 5)) B1_2_5Law (fun u => (stageBLaw (shape 1 2 5) u : ℝ)) (stageBPriority (shape 1 2 5)) 1 (fun u => B1_2_5Little u ((stageBPriority (shape 1 2 5)) 1)) (fun u a => (littleLaw (shape 1 2 5) u ((stageBPriority (shape 1 2 5)) 1) a : ℝ)) (fun u _ => B1_2_5Law_sound u) (fun u _ a => B1_2_5Little_sound u ((stageBPriority (shape 1 2 5)) 1) a) 3 a +def CB1_2_5I1R3Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB1_2_5I1R3Certificates_valid : + CB1_2_5I1R3Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_2_5I1R3CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB1_2_5I1R3P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_2_5I1R3Certificates (CB1_2_5I1R3CertificateIndex a)).input +lemma CB1_2_5I1R3P_check : ∀ a : Fin 6, contains (CB1_2_5I1R3Raw a) (CB1_2_5I1R3P a) = true := by + decide +kernel +lemma CB1_2_5I1R3P_sound (a : Fin 6) : + (CB1_2_5I1R3P a).Encloses (CB1_2_5I1R3Value a) := + contains_sound (CB1_2_5I1R3Raw_sound a) (CB1_2_5I1R3P_check a) +def CB1_2_5I1R3Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_2_5I1R3Certificates (CB1_2_5I1R3CertificateIndex a)).output +lemma CB1_2_5I1R3Terms_sound (a : Fin 6) : + (CB1_2_5I1R3Terms a).Encloses (Foundation.entropyTerm (CB1_2_5I1R3Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_2_5I1R3Certificates_valid + (CB1_2_5I1R3CertificateIndex a) (CB1_2_5I1R3P_sound a) +def CB1_2_5I1R3Entropy : Ball := ⟨0, 0⟩ +lemma CB1_2_5I1R3Entropy_sound : CB1_2_5I1R3Entropy.Encloses (Foundation.finiteEntropy CB1_2_5I1R3Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_2_5I1R3Value CB1_2_5I1R3Terms CB1_2_5I1R3Terms_sound) (by decide +kernel) +def CB1_2_5I1R3Mass : Ball := ⟨0, 0⟩ +lemma CB1_2_5I1R3Mass_sound : CB1_2_5I1R3Mass.Encloses (∑ a, CB1_2_5I1R3Value a) := by + exact contains_sound (finSumBall_sound 6 CB1_2_5I1R3P CB1_2_5I1R3Value CB1_2_5I1R3P_sound) (by decide +kernel) +def CB1_2_5I1R3MassTerm : Ball := .exact 0 +lemma CB1_2_5I1R3MassTerm_sound : CB1_2_5I1R3MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_2_5I1R3Value a))) := + entropyTerm_zero_ball (CB1_2_5I1R3Mass_sound) +def CB1_2_5I1R3H : Ball := ⟨0, 0⟩ +lemma CB1_2_5I1R3H_sound : CB1_2_5I1R3H.Encloses (homogeneousEntropy CB1_2_5I1R3Value) := by + exact contains_sound (homogeneous_enclosed CB1_2_5I1R3Value CB1_2_5I1R3MassTerm_sound CB1_2_5I1R3Entropy_sound) (by decide +kernel) +def CB1_2_5I1R4Value (a : Fin 6) : ℝ := residualLaw (below (shape 1 2 5)) (fun u => (stageBLaw (shape 1 2 5) u : ℝ)) (stageBPriority (shape 1 2 5)) 1 (fun u a => (littleLaw (shape 1 2 5) u ((stageBPriority (shape 1 2 5)) 1) a : ℝ)) 4 a +def CB1_2_5I1R4Raw (a : Fin 6) : Ball := residualBall (below (shape 1 2 5)) B1_2_5Law (stageBPriority (shape 1 2 5)) 1 (fun u => B1_2_5Little u ((stageBPriority (shape 1 2 5)) 1)) 4 a +lemma CB1_2_5I1R4Raw_sound (a : Fin 6) : + (CB1_2_5I1R4Raw a).Encloses (CB1_2_5I1R4Value a) := by + exact residualBall_sound_on (below (shape 1 2 5)) B1_2_5Law (fun u => (stageBLaw (shape 1 2 5) u : ℝ)) (stageBPriority (shape 1 2 5)) 1 (fun u => B1_2_5Little u ((stageBPriority (shape 1 2 5)) 1)) (fun u a => (littleLaw (shape 1 2 5) u ((stageBPriority (shape 1 2 5)) 1) a : ℝ)) (fun u _ => B1_2_5Law_sound u) (fun u _ a => B1_2_5Little_sound u ((stageBPriority (shape 1 2 5)) 1) a) 4 a +def CB1_2_5I1R4Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB1_2_5I1R4Certificates_valid : + CB1_2_5I1R4Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_2_5I1R4CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB1_2_5I1R4P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_2_5I1R4Certificates (CB1_2_5I1R4CertificateIndex a)).input +lemma CB1_2_5I1R4P_check : ∀ a : Fin 6, contains (CB1_2_5I1R4Raw a) (CB1_2_5I1R4P a) = true := by + decide +kernel +lemma CB1_2_5I1R4P_sound (a : Fin 6) : + (CB1_2_5I1R4P a).Encloses (CB1_2_5I1R4Value a) := + contains_sound (CB1_2_5I1R4Raw_sound a) (CB1_2_5I1R4P_check a) +def CB1_2_5I1R4Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_2_5I1R4Certificates (CB1_2_5I1R4CertificateIndex a)).output +lemma CB1_2_5I1R4Terms_sound (a : Fin 6) : + (CB1_2_5I1R4Terms a).Encloses (Foundation.entropyTerm (CB1_2_5I1R4Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_2_5I1R4Certificates_valid + (CB1_2_5I1R4CertificateIndex a) (CB1_2_5I1R4P_sound a) +def CB1_2_5I1R4Entropy : Ball := ⟨0, 0⟩ +lemma CB1_2_5I1R4Entropy_sound : CB1_2_5I1R4Entropy.Encloses (Foundation.finiteEntropy CB1_2_5I1R4Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_2_5I1R4Value CB1_2_5I1R4Terms CB1_2_5I1R4Terms_sound) (by decide +kernel) +def CB1_2_5I1R4Mass : Ball := ⟨0, 0⟩ +lemma CB1_2_5I1R4Mass_sound : CB1_2_5I1R4Mass.Encloses (∑ a, CB1_2_5I1R4Value a) := by + exact contains_sound (finSumBall_sound 6 CB1_2_5I1R4P CB1_2_5I1R4Value CB1_2_5I1R4P_sound) (by decide +kernel) +def CB1_2_5I1R4MassTerm : Ball := .exact 0 +lemma CB1_2_5I1R4MassTerm_sound : CB1_2_5I1R4MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_2_5I1R4Value a))) := + entropyTerm_zero_ball (CB1_2_5I1R4Mass_sound) +def CB1_2_5I1R4H : Ball := ⟨0, 0⟩ +lemma CB1_2_5I1R4H_sound : CB1_2_5I1R4H.Encloses (homogeneousEntropy CB1_2_5I1R4Value) := by + exact contains_sound (homogeneous_enclosed CB1_2_5I1R4Value CB1_2_5I1R4MassTerm_sound CB1_2_5I1R4Entropy_sound) (by decide +kernel) +def CB1_2_5I1R5Value (a : Fin 6) : ℝ := residualLaw (below (shape 1 2 5)) (fun u => (stageBLaw (shape 1 2 5) u : ℝ)) (stageBPriority (shape 1 2 5)) 1 (fun u a => (littleLaw (shape 1 2 5) u ((stageBPriority (shape 1 2 5)) 1) a : ℝ)) 5 a +def CB1_2_5I1R5Raw (a : Fin 6) : Ball := residualBall (below (shape 1 2 5)) B1_2_5Law (stageBPriority (shape 1 2 5)) 1 (fun u => B1_2_5Little u ((stageBPriority (shape 1 2 5)) 1)) 5 a +lemma CB1_2_5I1R5Raw_sound (a : Fin 6) : + (CB1_2_5I1R5Raw a).Encloses (CB1_2_5I1R5Value a) := by + exact residualBall_sound_on (below (shape 1 2 5)) B1_2_5Law (fun u => (stageBLaw (shape 1 2 5) u : ℝ)) (stageBPriority (shape 1 2 5)) 1 (fun u => B1_2_5Little u ((stageBPriority (shape 1 2 5)) 1)) (fun u a => (littleLaw (shape 1 2 5) u ((stageBPriority (shape 1 2 5)) 1) a : ℝ)) (fun u _ => B1_2_5Law_sound u) (fun u _ a => B1_2_5Little_sound u ((stageBPriority (shape 1 2 5)) 1) a) 5 a +def CB1_2_5I1R5Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB1_2_5I1R5Certificates_valid : + CB1_2_5I1R5Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_2_5I1R5CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB1_2_5I1R5P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_2_5I1R5Certificates (CB1_2_5I1R5CertificateIndex a)).input +lemma CB1_2_5I1R5P_check : ∀ a : Fin 6, contains (CB1_2_5I1R5Raw a) (CB1_2_5I1R5P a) = true := by + decide +kernel +lemma CB1_2_5I1R5P_sound (a : Fin 6) : + (CB1_2_5I1R5P a).Encloses (CB1_2_5I1R5Value a) := + contains_sound (CB1_2_5I1R5Raw_sound a) (CB1_2_5I1R5P_check a) +def CB1_2_5I1R5Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_2_5I1R5Certificates (CB1_2_5I1R5CertificateIndex a)).output +lemma CB1_2_5I1R5Terms_sound (a : Fin 6) : + (CB1_2_5I1R5Terms a).Encloses (Foundation.entropyTerm (CB1_2_5I1R5Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_2_5I1R5Certificates_valid + (CB1_2_5I1R5CertificateIndex a) (CB1_2_5I1R5P_sound a) +def CB1_2_5I1R5Entropy : Ball := ⟨0, 0⟩ +lemma CB1_2_5I1R5Entropy_sound : CB1_2_5I1R5Entropy.Encloses (Foundation.finiteEntropy CB1_2_5I1R5Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_2_5I1R5Value CB1_2_5I1R5Terms CB1_2_5I1R5Terms_sound) (by decide +kernel) +def CB1_2_5I1R5Mass : Ball := ⟨0, 0⟩ +lemma CB1_2_5I1R5Mass_sound : CB1_2_5I1R5Mass.Encloses (∑ a, CB1_2_5I1R5Value a) := by + exact contains_sound (finSumBall_sound 6 CB1_2_5I1R5P CB1_2_5I1R5Value CB1_2_5I1R5P_sound) (by decide +kernel) +def CB1_2_5I1R5MassTerm : Ball := .exact 0 +lemma CB1_2_5I1R5MassTerm_sound : CB1_2_5I1R5MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_2_5I1R5Value a))) := + entropyTerm_zero_ball (CB1_2_5I1R5Mass_sound) +def CB1_2_5I1R5H : Ball := ⟨0, 0⟩ +lemma CB1_2_5I1R5H_sound : CB1_2_5I1R5H.Encloses (homogeneousEntropy CB1_2_5I1R5Value) := by + exact contains_sound (homogeneous_enclosed CB1_2_5I1R5Value CB1_2_5I1R5MassTerm_sound CB1_2_5I1R5Entropy_sound) (by decide +kernel) +def CB1_2_5I1R6Value (a : Fin 6) : ℝ := residualLaw (below (shape 1 2 5)) (fun u => (stageBLaw (shape 1 2 5) u : ℝ)) (stageBPriority (shape 1 2 5)) 1 (fun u a => (littleLaw (shape 1 2 5) u ((stageBPriority (shape 1 2 5)) 1) a : ℝ)) 6 a +def CB1_2_5I1R6Raw (a : Fin 6) : Ball := residualBall (below (shape 1 2 5)) B1_2_5Law (stageBPriority (shape 1 2 5)) 1 (fun u => B1_2_5Little u ((stageBPriority (shape 1 2 5)) 1)) 6 a +lemma CB1_2_5I1R6Raw_sound (a : Fin 6) : + (CB1_2_5I1R6Raw a).Encloses (CB1_2_5I1R6Value a) := by + exact residualBall_sound_on (below (shape 1 2 5)) B1_2_5Law (fun u => (stageBLaw (shape 1 2 5) u : ℝ)) (stageBPriority (shape 1 2 5)) 1 (fun u => B1_2_5Little u ((stageBPriority (shape 1 2 5)) 1)) (fun u a => (littleLaw (shape 1 2 5) u ((stageBPriority (shape 1 2 5)) 1) a : ℝ)) (fun u _ => B1_2_5Law_sound u) (fun u _ a => B1_2_5Little_sound u ((stageBPriority (shape 1 2 5)) 1) a) 6 a +def CB1_2_5I1R6Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB1_2_5I1R6Certificates_valid : + CB1_2_5I1R6Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_2_5I1R6CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB1_2_5I1R6P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_2_5I1R6Certificates (CB1_2_5I1R6CertificateIndex a)).input +lemma CB1_2_5I1R6P_check : ∀ a : Fin 6, contains (CB1_2_5I1R6Raw a) (CB1_2_5I1R6P a) = true := by + decide +kernel +lemma CB1_2_5I1R6P_sound (a : Fin 6) : + (CB1_2_5I1R6P a).Encloses (CB1_2_5I1R6Value a) := + contains_sound (CB1_2_5I1R6Raw_sound a) (CB1_2_5I1R6P_check a) +def CB1_2_5I1R6Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_2_5I1R6Certificates (CB1_2_5I1R6CertificateIndex a)).output +lemma CB1_2_5I1R6Terms_sound (a : Fin 6) : + (CB1_2_5I1R6Terms a).Encloses (Foundation.entropyTerm (CB1_2_5I1R6Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_2_5I1R6Certificates_valid + (CB1_2_5I1R6CertificateIndex a) (CB1_2_5I1R6P_sound a) +def CB1_2_5I1R6Entropy : Ball := ⟨0, 0⟩ +lemma CB1_2_5I1R6Entropy_sound : CB1_2_5I1R6Entropy.Encloses (Foundation.finiteEntropy CB1_2_5I1R6Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_2_5I1R6Value CB1_2_5I1R6Terms CB1_2_5I1R6Terms_sound) (by decide +kernel) +def CB1_2_5I1R6Mass : Ball := ⟨0, 0⟩ +lemma CB1_2_5I1R6Mass_sound : CB1_2_5I1R6Mass.Encloses (∑ a, CB1_2_5I1R6Value a) := by + exact contains_sound (finSumBall_sound 6 CB1_2_5I1R6P CB1_2_5I1R6Value CB1_2_5I1R6P_sound) (by decide +kernel) +def CB1_2_5I1R6MassTerm : Ball := .exact 0 +lemma CB1_2_5I1R6MassTerm_sound : CB1_2_5I1R6MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_2_5I1R6Value a))) := + entropyTerm_zero_ball (CB1_2_5I1R6Mass_sound) +def CB1_2_5I1R6H : Ball := ⟨0, 0⟩ +lemma CB1_2_5I1R6H_sound : CB1_2_5I1R6H.Encloses (homogeneousEntropy CB1_2_5I1R6Value) := by + exact contains_sound (homogeneous_enclosed CB1_2_5I1R6Value CB1_2_5I1R6MassTerm_sound CB1_2_5I1R6Entropy_sound) (by decide +kernel) +def CB1_2_5I1R7Value (a : Fin 6) : ℝ := residualLaw (below (shape 1 2 5)) (fun u => (stageBLaw (shape 1 2 5) u : ℝ)) (stageBPriority (shape 1 2 5)) 1 (fun u a => (littleLaw (shape 1 2 5) u ((stageBPriority (shape 1 2 5)) 1) a : ℝ)) 7 a +def CB1_2_5I1R7Raw (a : Fin 6) : Ball := residualBall (below (shape 1 2 5)) B1_2_5Law (stageBPriority (shape 1 2 5)) 1 (fun u => B1_2_5Little u ((stageBPriority (shape 1 2 5)) 1)) 7 a +lemma CB1_2_5I1R7Raw_sound (a : Fin 6) : + (CB1_2_5I1R7Raw a).Encloses (CB1_2_5I1R7Value a) := by + exact residualBall_sound_on (below (shape 1 2 5)) B1_2_5Law (fun u => (stageBLaw (shape 1 2 5) u : ℝ)) (stageBPriority (shape 1 2 5)) 1 (fun u => B1_2_5Little u ((stageBPriority (shape 1 2 5)) 1)) (fun u a => (littleLaw (shape 1 2 5) u ((stageBPriority (shape 1 2 5)) 1) a : ℝ)) (fun u _ => B1_2_5Law_sound u) (fun u _ a => B1_2_5Little_sound u ((stageBPriority (shape 1 2 5)) 1) a) 7 a +def CB1_2_5I1R7Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB1_2_5I1R7Certificates_valid : + CB1_2_5I1R7Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_2_5I1R7CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB1_2_5I1R7P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_2_5I1R7Certificates (CB1_2_5I1R7CertificateIndex a)).input +lemma CB1_2_5I1R7P_check : ∀ a : Fin 6, contains (CB1_2_5I1R7Raw a) (CB1_2_5I1R7P a) = true := by + decide +kernel +lemma CB1_2_5I1R7P_sound (a : Fin 6) : + (CB1_2_5I1R7P a).Encloses (CB1_2_5I1R7Value a) := + contains_sound (CB1_2_5I1R7Raw_sound a) (CB1_2_5I1R7P_check a) +def CB1_2_5I1R7Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_2_5I1R7Certificates (CB1_2_5I1R7CertificateIndex a)).output +lemma CB1_2_5I1R7Terms_sound (a : Fin 6) : + (CB1_2_5I1R7Terms a).Encloses (Foundation.entropyTerm (CB1_2_5I1R7Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_2_5I1R7Certificates_valid + (CB1_2_5I1R7CertificateIndex a) (CB1_2_5I1R7P_sound a) +def CB1_2_5I1R7Entropy : Ball := ⟨0, 0⟩ +lemma CB1_2_5I1R7Entropy_sound : CB1_2_5I1R7Entropy.Encloses (Foundation.finiteEntropy CB1_2_5I1R7Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_2_5I1R7Value CB1_2_5I1R7Terms CB1_2_5I1R7Terms_sound) (by decide +kernel) +def CB1_2_5I1R7Mass : Ball := ⟨0, 0⟩ +lemma CB1_2_5I1R7Mass_sound : CB1_2_5I1R7Mass.Encloses (∑ a, CB1_2_5I1R7Value a) := by + exact contains_sound (finSumBall_sound 6 CB1_2_5I1R7P CB1_2_5I1R7Value CB1_2_5I1R7P_sound) (by decide +kernel) +def CB1_2_5I1R7MassTerm : Ball := .exact 0 +lemma CB1_2_5I1R7MassTerm_sound : CB1_2_5I1R7MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_2_5I1R7Value a))) := + entropyTerm_zero_ball (CB1_2_5I1R7Mass_sound) +def CB1_2_5I1R7H : Ball := ⟨0, 0⟩ +lemma CB1_2_5I1R7H_sound : CB1_2_5I1R7H.Encloses (homogeneousEntropy CB1_2_5I1R7Value) := by + exact contains_sound (homogeneous_enclosed CB1_2_5I1R7Value CB1_2_5I1R7MassTerm_sound CB1_2_5I1R7Entropy_sound) (by decide +kernel) +def CB1_2_5I1R8Value (a : Fin 6) : ℝ := residualLaw (below (shape 1 2 5)) (fun u => (stageBLaw (shape 1 2 5) u : ℝ)) (stageBPriority (shape 1 2 5)) 1 (fun u a => (littleLaw (shape 1 2 5) u ((stageBPriority (shape 1 2 5)) 1) a : ℝ)) 8 a +def CB1_2_5I1R8Raw (a : Fin 6) : Ball := residualBall (below (shape 1 2 5)) B1_2_5Law (stageBPriority (shape 1 2 5)) 1 (fun u => B1_2_5Little u ((stageBPriority (shape 1 2 5)) 1)) 8 a +lemma CB1_2_5I1R8Raw_sound (a : Fin 6) : + (CB1_2_5I1R8Raw a).Encloses (CB1_2_5I1R8Value a) := by + exact residualBall_sound_on (below (shape 1 2 5)) B1_2_5Law (fun u => (stageBLaw (shape 1 2 5) u : ℝ)) (stageBPriority (shape 1 2 5)) 1 (fun u => B1_2_5Little u ((stageBPriority (shape 1 2 5)) 1)) (fun u a => (littleLaw (shape 1 2 5) u ((stageBPriority (shape 1 2 5)) 1) a : ℝ)) (fun u _ => B1_2_5Law_sound u) (fun u _ a => B1_2_5Little_sound u ((stageBPriority (shape 1 2 5)) 1) a) 8 a +def CB1_2_5I1R8Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB1_2_5I1R8Certificates_valid : + CB1_2_5I1R8Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_2_5I1R8CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB1_2_5I1R8P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_2_5I1R8Certificates (CB1_2_5I1R8CertificateIndex a)).input +lemma CB1_2_5I1R8P_check : ∀ a : Fin 6, contains (CB1_2_5I1R8Raw a) (CB1_2_5I1R8P a) = true := by + decide +kernel +lemma CB1_2_5I1R8P_sound (a : Fin 6) : + (CB1_2_5I1R8P a).Encloses (CB1_2_5I1R8Value a) := + contains_sound (CB1_2_5I1R8Raw_sound a) (CB1_2_5I1R8P_check a) +def CB1_2_5I1R8Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_2_5I1R8Certificates (CB1_2_5I1R8CertificateIndex a)).output +lemma CB1_2_5I1R8Terms_sound (a : Fin 6) : + (CB1_2_5I1R8Terms a).Encloses (Foundation.entropyTerm (CB1_2_5I1R8Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_2_5I1R8Certificates_valid + (CB1_2_5I1R8CertificateIndex a) (CB1_2_5I1R8P_sound a) +def CB1_2_5I1R8Entropy : Ball := ⟨0, 0⟩ +lemma CB1_2_5I1R8Entropy_sound : CB1_2_5I1R8Entropy.Encloses (Foundation.finiteEntropy CB1_2_5I1R8Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_2_5I1R8Value CB1_2_5I1R8Terms CB1_2_5I1R8Terms_sound) (by decide +kernel) +def CB1_2_5I1R8Mass : Ball := ⟨0, 0⟩ +lemma CB1_2_5I1R8Mass_sound : CB1_2_5I1R8Mass.Encloses (∑ a, CB1_2_5I1R8Value a) := by + exact contains_sound (finSumBall_sound 6 CB1_2_5I1R8P CB1_2_5I1R8Value CB1_2_5I1R8P_sound) (by decide +kernel) +def CB1_2_5I1R8MassTerm : Ball := .exact 0 +lemma CB1_2_5I1R8MassTerm_sound : CB1_2_5I1R8MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_2_5I1R8Value a))) := + entropyTerm_zero_ball (CB1_2_5I1R8Mass_sound) +def CB1_2_5I1R8H : Ball := ⟨0, 0⟩ +lemma CB1_2_5I1R8H_sound : CB1_2_5I1R8H.Encloses (homogeneousEntropy CB1_2_5I1R8Value) := by + exact contains_sound (homogeneous_enclosed CB1_2_5I1R8Value CB1_2_5I1R8MassTerm_sound CB1_2_5I1R8Entropy_sound) (by decide +kernel) +def CB1_2_5I1R9Value (a : Fin 6) : ℝ := residualLaw (below (shape 1 2 5)) (fun u => (stageBLaw (shape 1 2 5) u : ℝ)) (stageBPriority (shape 1 2 5)) 1 (fun u a => (littleLaw (shape 1 2 5) u ((stageBPriority (shape 1 2 5)) 1) a : ℝ)) 9 a +def CB1_2_5I1R9Raw (a : Fin 6) : Ball := residualBall (below (shape 1 2 5)) B1_2_5Law (stageBPriority (shape 1 2 5)) 1 (fun u => B1_2_5Little u ((stageBPriority (shape 1 2 5)) 1)) 9 a +lemma CB1_2_5I1R9Raw_sound (a : Fin 6) : + (CB1_2_5I1R9Raw a).Encloses (CB1_2_5I1R9Value a) := by + exact residualBall_sound_on (below (shape 1 2 5)) B1_2_5Law (fun u => (stageBLaw (shape 1 2 5) u : ℝ)) (stageBPriority (shape 1 2 5)) 1 (fun u => B1_2_5Little u ((stageBPriority (shape 1 2 5)) 1)) (fun u a => (littleLaw (shape 1 2 5) u ((stageBPriority (shape 1 2 5)) 1) a : ℝ)) (fun u _ => B1_2_5Law_sound u) (fun u _ a => B1_2_5Little_sound u ((stageBPriority (shape 1 2 5)) 1) a) 9 a +def CB1_2_5I1R9Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB1_2_5I1R9Certificates_valid : + CB1_2_5I1R9Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_2_5I1R9CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB1_2_5I1R9P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_2_5I1R9Certificates (CB1_2_5I1R9CertificateIndex a)).input +lemma CB1_2_5I1R9P_check : ∀ a : Fin 6, contains (CB1_2_5I1R9Raw a) (CB1_2_5I1R9P a) = true := by + decide +kernel +lemma CB1_2_5I1R9P_sound (a : Fin 6) : + (CB1_2_5I1R9P a).Encloses (CB1_2_5I1R9Value a) := + contains_sound (CB1_2_5I1R9Raw_sound a) (CB1_2_5I1R9P_check a) +def CB1_2_5I1R9Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_2_5I1R9Certificates (CB1_2_5I1R9CertificateIndex a)).output +lemma CB1_2_5I1R9Terms_sound (a : Fin 6) : + (CB1_2_5I1R9Terms a).Encloses (Foundation.entropyTerm (CB1_2_5I1R9Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_2_5I1R9Certificates_valid + (CB1_2_5I1R9CertificateIndex a) (CB1_2_5I1R9P_sound a) +def CB1_2_5I1R9Entropy : Ball := ⟨0, 0⟩ +lemma CB1_2_5I1R9Entropy_sound : CB1_2_5I1R9Entropy.Encloses (Foundation.finiteEntropy CB1_2_5I1R9Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_2_5I1R9Value CB1_2_5I1R9Terms CB1_2_5I1R9Terms_sound) (by decide +kernel) +def CB1_2_5I1R9Mass : Ball := ⟨0, 0⟩ +lemma CB1_2_5I1R9Mass_sound : CB1_2_5I1R9Mass.Encloses (∑ a, CB1_2_5I1R9Value a) := by + exact contains_sound (finSumBall_sound 6 CB1_2_5I1R9P CB1_2_5I1R9Value CB1_2_5I1R9P_sound) (by decide +kernel) +def CB1_2_5I1R9MassTerm : Ball := .exact 0 +lemma CB1_2_5I1R9MassTerm_sound : CB1_2_5I1R9MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_2_5I1R9Value a))) := + entropyTerm_zero_ball (CB1_2_5I1R9Mass_sound) +def CB1_2_5I1R9H : Ball := ⟨0, 0⟩ +lemma CB1_2_5I1R9H_sound : CB1_2_5I1R9H.Encloses (homogeneousEntropy CB1_2_5I1R9Value) := by + exact contains_sound (homogeneous_enclosed CB1_2_5I1R9Value CB1_2_5I1R9MassTerm_sound CB1_2_5I1R9Entropy_sound) (by decide +kernel) +def CB1_2_5I1R10Value (a : Fin 6) : ℝ := residualLaw (below (shape 1 2 5)) (fun u => (stageBLaw (shape 1 2 5) u : ℝ)) (stageBPriority (shape 1 2 5)) 1 (fun u a => (littleLaw (shape 1 2 5) u ((stageBPriority (shape 1 2 5)) 1) a : ℝ)) 10 a +def CB1_2_5I1R10Raw (a : Fin 6) : Ball := residualBall (below (shape 1 2 5)) B1_2_5Law (stageBPriority (shape 1 2 5)) 1 (fun u => B1_2_5Little u ((stageBPriority (shape 1 2 5)) 1)) 10 a +lemma CB1_2_5I1R10Raw_sound (a : Fin 6) : + (CB1_2_5I1R10Raw a).Encloses (CB1_2_5I1R10Value a) := by + exact residualBall_sound_on (below (shape 1 2 5)) B1_2_5Law (fun u => (stageBLaw (shape 1 2 5) u : ℝ)) (stageBPriority (shape 1 2 5)) 1 (fun u => B1_2_5Little u ((stageBPriority (shape 1 2 5)) 1)) (fun u a => (littleLaw (shape 1 2 5) u ((stageBPriority (shape 1 2 5)) 1) a : ℝ)) (fun u _ => B1_2_5Law_sound u) (fun u _ a => B1_2_5Little_sound u ((stageBPriority (shape 1 2 5)) 1) a) 10 a +def CB1_2_5I1R10Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB1_2_5I1R10Certificates_valid : + CB1_2_5I1R10Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_2_5I1R10CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB1_2_5I1R10P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_2_5I1R10Certificates (CB1_2_5I1R10CertificateIndex a)).input +lemma CB1_2_5I1R10P_check : ∀ a : Fin 6, contains (CB1_2_5I1R10Raw a) (CB1_2_5I1R10P a) = true := by + decide +kernel +lemma CB1_2_5I1R10P_sound (a : Fin 6) : + (CB1_2_5I1R10P a).Encloses (CB1_2_5I1R10Value a) := + contains_sound (CB1_2_5I1R10Raw_sound a) (CB1_2_5I1R10P_check a) +def CB1_2_5I1R10Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_2_5I1R10Certificates (CB1_2_5I1R10CertificateIndex a)).output +lemma CB1_2_5I1R10Terms_sound (a : Fin 6) : + (CB1_2_5I1R10Terms a).Encloses (Foundation.entropyTerm (CB1_2_5I1R10Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_2_5I1R10Certificates_valid + (CB1_2_5I1R10CertificateIndex a) (CB1_2_5I1R10P_sound a) +def CB1_2_5I1R10Entropy : Ball := ⟨0, 0⟩ +lemma CB1_2_5I1R10Entropy_sound : CB1_2_5I1R10Entropy.Encloses (Foundation.finiteEntropy CB1_2_5I1R10Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_2_5I1R10Value CB1_2_5I1R10Terms CB1_2_5I1R10Terms_sound) (by decide +kernel) +def CB1_2_5I1R10Mass : Ball := ⟨0, 0⟩ +lemma CB1_2_5I1R10Mass_sound : CB1_2_5I1R10Mass.Encloses (∑ a, CB1_2_5I1R10Value a) := by + exact contains_sound (finSumBall_sound 6 CB1_2_5I1R10P CB1_2_5I1R10Value CB1_2_5I1R10P_sound) (by decide +kernel) +def CB1_2_5I1R10MassTerm : Ball := .exact 0 +lemma CB1_2_5I1R10MassTerm_sound : CB1_2_5I1R10MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_2_5I1R10Value a))) := + entropyTerm_zero_ball (CB1_2_5I1R10Mass_sound) +def CB1_2_5I1R10H : Ball := ⟨0, 0⟩ +lemma CB1_2_5I1R10H_sound : CB1_2_5I1R10H.Encloses (homogeneousEntropy CB1_2_5I1R10Value) := by + exact contains_sound (homogeneous_enclosed CB1_2_5I1R10Value CB1_2_5I1R10MassTerm_sound CB1_2_5I1R10Entropy_sound) (by decide +kernel) +def CB1_2_5I1R11Value (a : Fin 6) : ℝ := residualLaw (below (shape 1 2 5)) (fun u => (stageBLaw (shape 1 2 5) u : ℝ)) (stageBPriority (shape 1 2 5)) 1 (fun u a => (littleLaw (shape 1 2 5) u ((stageBPriority (shape 1 2 5)) 1) a : ℝ)) 11 a +def CB1_2_5I1R11Raw (a : Fin 6) : Ball := residualBall (below (shape 1 2 5)) B1_2_5Law (stageBPriority (shape 1 2 5)) 1 (fun u => B1_2_5Little u ((stageBPriority (shape 1 2 5)) 1)) 11 a +lemma CB1_2_5I1R11Raw_sound (a : Fin 6) : + (CB1_2_5I1R11Raw a).Encloses (CB1_2_5I1R11Value a) := by + exact residualBall_sound_on (below (shape 1 2 5)) B1_2_5Law (fun u => (stageBLaw (shape 1 2 5) u : ℝ)) (stageBPriority (shape 1 2 5)) 1 (fun u => B1_2_5Little u ((stageBPriority (shape 1 2 5)) 1)) (fun u a => (littleLaw (shape 1 2 5) u ((stageBPriority (shape 1 2 5)) 1) a : ℝ)) (fun u _ => B1_2_5Law_sound u) (fun u _ a => B1_2_5Little_sound u ((stageBPriority (shape 1 2 5)) 1) a) 11 a +def CB1_2_5I1R11Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB1_2_5I1R11Certificates_valid : + CB1_2_5I1R11Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_2_5I1R11CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB1_2_5I1R11P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_2_5I1R11Certificates (CB1_2_5I1R11CertificateIndex a)).input +lemma CB1_2_5I1R11P_check : ∀ a : Fin 6, contains (CB1_2_5I1R11Raw a) (CB1_2_5I1R11P a) = true := by + decide +kernel +lemma CB1_2_5I1R11P_sound (a : Fin 6) : + (CB1_2_5I1R11P a).Encloses (CB1_2_5I1R11Value a) := + contains_sound (CB1_2_5I1R11Raw_sound a) (CB1_2_5I1R11P_check a) +def CB1_2_5I1R11Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_2_5I1R11Certificates (CB1_2_5I1R11CertificateIndex a)).output +lemma CB1_2_5I1R11Terms_sound (a : Fin 6) : + (CB1_2_5I1R11Terms a).Encloses (Foundation.entropyTerm (CB1_2_5I1R11Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_2_5I1R11Certificates_valid + (CB1_2_5I1R11CertificateIndex a) (CB1_2_5I1R11P_sound a) +def CB1_2_5I1R11Entropy : Ball := ⟨0, 0⟩ +lemma CB1_2_5I1R11Entropy_sound : CB1_2_5I1R11Entropy.Encloses (Foundation.finiteEntropy CB1_2_5I1R11Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_2_5I1R11Value CB1_2_5I1R11Terms CB1_2_5I1R11Terms_sound) (by decide +kernel) +def CB1_2_5I1R11Mass : Ball := ⟨0, 0⟩ +lemma CB1_2_5I1R11Mass_sound : CB1_2_5I1R11Mass.Encloses (∑ a, CB1_2_5I1R11Value a) := by + exact contains_sound (finSumBall_sound 6 CB1_2_5I1R11P CB1_2_5I1R11Value CB1_2_5I1R11P_sound) (by decide +kernel) +def CB1_2_5I1R11MassTerm : Ball := .exact 0 +lemma CB1_2_5I1R11MassTerm_sound : CB1_2_5I1R11MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_2_5I1R11Value a))) := + entropyTerm_zero_ball (CB1_2_5I1R11Mass_sound) +def CB1_2_5I1R11H : Ball := ⟨0, 0⟩ +lemma CB1_2_5I1R11H_sound : CB1_2_5I1R11H.Encloses (homogeneousEntropy CB1_2_5I1R11Value) := by + exact contains_sound (homogeneous_enclosed CB1_2_5I1R11Value CB1_2_5I1R11MassTerm_sound CB1_2_5I1R11Entropy_sound) (by decide +kernel) +def CB1_2_5I1R12Value (a : Fin 6) : ℝ := residualLaw (below (shape 1 2 5)) (fun u => (stageBLaw (shape 1 2 5) u : ℝ)) (stageBPriority (shape 1 2 5)) 1 (fun u a => (littleLaw (shape 1 2 5) u ((stageBPriority (shape 1 2 5)) 1) a : ℝ)) 12 a +def CB1_2_5I1R12Raw (a : Fin 6) : Ball := residualBall (below (shape 1 2 5)) B1_2_5Law (stageBPriority (shape 1 2 5)) 1 (fun u => B1_2_5Little u ((stageBPriority (shape 1 2 5)) 1)) 12 a +lemma CB1_2_5I1R12Raw_sound (a : Fin 6) : + (CB1_2_5I1R12Raw a).Encloses (CB1_2_5I1R12Value a) := by + exact residualBall_sound_on (below (shape 1 2 5)) B1_2_5Law (fun u => (stageBLaw (shape 1 2 5) u : ℝ)) (stageBPriority (shape 1 2 5)) 1 (fun u => B1_2_5Little u ((stageBPriority (shape 1 2 5)) 1)) (fun u a => (littleLaw (shape 1 2 5) u ((stageBPriority (shape 1 2 5)) 1) a : ℝ)) (fun u _ => B1_2_5Law_sound u) (fun u _ a => B1_2_5Little_sound u ((stageBPriority (shape 1 2 5)) 1) a) 12 a +def CB1_2_5I1R12Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB1_2_5I1R12Certificates_valid : + CB1_2_5I1R12Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_2_5I1R12CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB1_2_5I1R12P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_2_5I1R12Certificates (CB1_2_5I1R12CertificateIndex a)).input +lemma CB1_2_5I1R12P_check : ∀ a : Fin 6, contains (CB1_2_5I1R12Raw a) (CB1_2_5I1R12P a) = true := by + decide +kernel +lemma CB1_2_5I1R12P_sound (a : Fin 6) : + (CB1_2_5I1R12P a).Encloses (CB1_2_5I1R12Value a) := + contains_sound (CB1_2_5I1R12Raw_sound a) (CB1_2_5I1R12P_check a) +def CB1_2_5I1R12Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_2_5I1R12Certificates (CB1_2_5I1R12CertificateIndex a)).output +lemma CB1_2_5I1R12Terms_sound (a : Fin 6) : + (CB1_2_5I1R12Terms a).Encloses (Foundation.entropyTerm (CB1_2_5I1R12Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_2_5I1R12Certificates_valid + (CB1_2_5I1R12CertificateIndex a) (CB1_2_5I1R12P_sound a) +def CB1_2_5I1R12Entropy : Ball := ⟨0, 0⟩ +lemma CB1_2_5I1R12Entropy_sound : CB1_2_5I1R12Entropy.Encloses (Foundation.finiteEntropy CB1_2_5I1R12Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_2_5I1R12Value CB1_2_5I1R12Terms CB1_2_5I1R12Terms_sound) (by decide +kernel) +def CB1_2_5I1R12Mass : Ball := ⟨0, 0⟩ +lemma CB1_2_5I1R12Mass_sound : CB1_2_5I1R12Mass.Encloses (∑ a, CB1_2_5I1R12Value a) := by + exact contains_sound (finSumBall_sound 6 CB1_2_5I1R12P CB1_2_5I1R12Value CB1_2_5I1R12P_sound) (by decide +kernel) +def CB1_2_5I1R12MassTerm : Ball := .exact 0 +lemma CB1_2_5I1R12MassTerm_sound : CB1_2_5I1R12MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_2_5I1R12Value a))) := + entropyTerm_zero_ball (CB1_2_5I1R12Mass_sound) +def CB1_2_5I1R12H : Ball := ⟨0, 0⟩ +lemma CB1_2_5I1R12H_sound : CB1_2_5I1R12H.Encloses (homogeneousEntropy CB1_2_5I1R12Value) := by + exact contains_sound (homogeneous_enclosed CB1_2_5I1R12Value CB1_2_5I1R12MassTerm_sound CB1_2_5I1R12Entropy_sound) (by decide +kernel) +def CB1_2_5I1R13Value (a : Fin 6) : ℝ := residualLaw (below (shape 1 2 5)) (fun u => (stageBLaw (shape 1 2 5) u : ℝ)) (stageBPriority (shape 1 2 5)) 1 (fun u a => (littleLaw (shape 1 2 5) u ((stageBPriority (shape 1 2 5)) 1) a : ℝ)) 13 a +def CB1_2_5I1R13Raw (a : Fin 6) : Ball := residualBall (below (shape 1 2 5)) B1_2_5Law (stageBPriority (shape 1 2 5)) 1 (fun u => B1_2_5Little u ((stageBPriority (shape 1 2 5)) 1)) 13 a +lemma CB1_2_5I1R13Raw_sound (a : Fin 6) : + (CB1_2_5I1R13Raw a).Encloses (CB1_2_5I1R13Value a) := by + exact residualBall_sound_on (below (shape 1 2 5)) B1_2_5Law (fun u => (stageBLaw (shape 1 2 5) u : ℝ)) (stageBPriority (shape 1 2 5)) 1 (fun u => B1_2_5Little u ((stageBPriority (shape 1 2 5)) 1)) (fun u a => (littleLaw (shape 1 2 5) u ((stageBPriority (shape 1 2 5)) 1) a : ℝ)) (fun u _ => B1_2_5Law_sound u) (fun u _ a => B1_2_5Little_sound u ((stageBPriority (shape 1 2 5)) 1) a) 13 a +def CB1_2_5I1R13Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB1_2_5I1R13Certificates_valid : + CB1_2_5I1R13Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_2_5I1R13CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB1_2_5I1R13P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_2_5I1R13Certificates (CB1_2_5I1R13CertificateIndex a)).input +lemma CB1_2_5I1R13P_check : ∀ a : Fin 6, contains (CB1_2_5I1R13Raw a) (CB1_2_5I1R13P a) = true := by + decide +kernel +lemma CB1_2_5I1R13P_sound (a : Fin 6) : + (CB1_2_5I1R13P a).Encloses (CB1_2_5I1R13Value a) := + contains_sound (CB1_2_5I1R13Raw_sound a) (CB1_2_5I1R13P_check a) +def CB1_2_5I1R13Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_2_5I1R13Certificates (CB1_2_5I1R13CertificateIndex a)).output +lemma CB1_2_5I1R13Terms_sound (a : Fin 6) : + (CB1_2_5I1R13Terms a).Encloses (Foundation.entropyTerm (CB1_2_5I1R13Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_2_5I1R13Certificates_valid + (CB1_2_5I1R13CertificateIndex a) (CB1_2_5I1R13P_sound a) +def CB1_2_5I1R13Entropy : Ball := ⟨0, 0⟩ +lemma CB1_2_5I1R13Entropy_sound : CB1_2_5I1R13Entropy.Encloses (Foundation.finiteEntropy CB1_2_5I1R13Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_2_5I1R13Value CB1_2_5I1R13Terms CB1_2_5I1R13Terms_sound) (by decide +kernel) +def CB1_2_5I1R13Mass : Ball := ⟨0, 0⟩ +lemma CB1_2_5I1R13Mass_sound : CB1_2_5I1R13Mass.Encloses (∑ a, CB1_2_5I1R13Value a) := by + exact contains_sound (finSumBall_sound 6 CB1_2_5I1R13P CB1_2_5I1R13Value CB1_2_5I1R13P_sound) (by decide +kernel) +def CB1_2_5I1R13MassTerm : Ball := .exact 0 +lemma CB1_2_5I1R13MassTerm_sound : CB1_2_5I1R13MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_2_5I1R13Value a))) := + entropyTerm_zero_ball (CB1_2_5I1R13Mass_sound) +def CB1_2_5I1R13H : Ball := ⟨0, 0⟩ +lemma CB1_2_5I1R13H_sound : CB1_2_5I1R13H.Encloses (homogeneousEntropy CB1_2_5I1R13Value) := by + exact contains_sound (homogeneous_enclosed CB1_2_5I1R13Value CB1_2_5I1R13MassTerm_sound CB1_2_5I1R13Entropy_sound) (by decide +kernel) +def CB1_2_5I1R14Value (a : Fin 6) : ℝ := residualLaw (below (shape 1 2 5)) (fun u => (stageBLaw (shape 1 2 5) u : ℝ)) (stageBPriority (shape 1 2 5)) 1 (fun u a => (littleLaw (shape 1 2 5) u ((stageBPriority (shape 1 2 5)) 1) a : ℝ)) 14 a +def CB1_2_5I1R14Raw (a : Fin 6) : Ball := residualBall (below (shape 1 2 5)) B1_2_5Law (stageBPriority (shape 1 2 5)) 1 (fun u => B1_2_5Little u ((stageBPriority (shape 1 2 5)) 1)) 14 a +lemma CB1_2_5I1R14Raw_sound (a : Fin 6) : + (CB1_2_5I1R14Raw a).Encloses (CB1_2_5I1R14Value a) := by + exact residualBall_sound_on (below (shape 1 2 5)) B1_2_5Law (fun u => (stageBLaw (shape 1 2 5) u : ℝ)) (stageBPriority (shape 1 2 5)) 1 (fun u => B1_2_5Little u ((stageBPriority (shape 1 2 5)) 1)) (fun u a => (littleLaw (shape 1 2 5) u ((stageBPriority (shape 1 2 5)) 1) a : ℝ)) (fun u _ => B1_2_5Law_sound u) (fun u _ a => B1_2_5Little_sound u ((stageBPriority (shape 1 2 5)) 1) a) 14 a +def CB1_2_5I1R14Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB1_2_5I1R14Certificates_valid : + CB1_2_5I1R14Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_2_5I1R14CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB1_2_5I1R14P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_2_5I1R14Certificates (CB1_2_5I1R14CertificateIndex a)).input +lemma CB1_2_5I1R14P_check : ∀ a : Fin 6, contains (CB1_2_5I1R14Raw a) (CB1_2_5I1R14P a) = true := by + decide +kernel +lemma CB1_2_5I1R14P_sound (a : Fin 6) : + (CB1_2_5I1R14P a).Encloses (CB1_2_5I1R14Value a) := + contains_sound (CB1_2_5I1R14Raw_sound a) (CB1_2_5I1R14P_check a) +def CB1_2_5I1R14Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_2_5I1R14Certificates (CB1_2_5I1R14CertificateIndex a)).output +lemma CB1_2_5I1R14Terms_sound (a : Fin 6) : + (CB1_2_5I1R14Terms a).Encloses (Foundation.entropyTerm (CB1_2_5I1R14Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_2_5I1R14Certificates_valid + (CB1_2_5I1R14CertificateIndex a) (CB1_2_5I1R14P_sound a) +def CB1_2_5I1R14Entropy : Ball := ⟨0, 0⟩ +lemma CB1_2_5I1R14Entropy_sound : CB1_2_5I1R14Entropy.Encloses (Foundation.finiteEntropy CB1_2_5I1R14Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_2_5I1R14Value CB1_2_5I1R14Terms CB1_2_5I1R14Terms_sound) (by decide +kernel) +def CB1_2_5I1R14Mass : Ball := ⟨0, 0⟩ +lemma CB1_2_5I1R14Mass_sound : CB1_2_5I1R14Mass.Encloses (∑ a, CB1_2_5I1R14Value a) := by + exact contains_sound (finSumBall_sound 6 CB1_2_5I1R14P CB1_2_5I1R14Value CB1_2_5I1R14P_sound) (by decide +kernel) +def CB1_2_5I1R14MassTerm : Ball := .exact 0 +lemma CB1_2_5I1R14MassTerm_sound : CB1_2_5I1R14MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_2_5I1R14Value a))) := + entropyTerm_zero_ball (CB1_2_5I1R14Mass_sound) +def CB1_2_5I1R14H : Ball := ⟨0, 0⟩ +lemma CB1_2_5I1R14H_sound : CB1_2_5I1R14H.Encloses (homogeneousEntropy CB1_2_5I1R14Value) := by + exact contains_sound (homogeneous_enclosed CB1_2_5I1R14Value CB1_2_5I1R14MassTerm_sound CB1_2_5I1R14Entropy_sound) (by decide +kernel) +def CB1_2_5I1R15Value (a : Fin 6) : ℝ := residualLaw (below (shape 1 2 5)) (fun u => (stageBLaw (shape 1 2 5) u : ℝ)) (stageBPriority (shape 1 2 5)) 1 (fun u a => (littleLaw (shape 1 2 5) u ((stageBPriority (shape 1 2 5)) 1) a : ℝ)) 15 a +def CB1_2_5I1R15Raw (a : Fin 6) : Ball := residualBall (below (shape 1 2 5)) B1_2_5Law (stageBPriority (shape 1 2 5)) 1 (fun u => B1_2_5Little u ((stageBPriority (shape 1 2 5)) 1)) 15 a +lemma CB1_2_5I1R15Raw_sound (a : Fin 6) : + (CB1_2_5I1R15Raw a).Encloses (CB1_2_5I1R15Value a) := by + exact residualBall_sound_on (below (shape 1 2 5)) B1_2_5Law (fun u => (stageBLaw (shape 1 2 5) u : ℝ)) (stageBPriority (shape 1 2 5)) 1 (fun u => B1_2_5Little u ((stageBPriority (shape 1 2 5)) 1)) (fun u a => (littleLaw (shape 1 2 5) u ((stageBPriority (shape 1 2 5)) 1) a : ℝ)) (fun u _ => B1_2_5Law_sound u) (fun u _ a => B1_2_5Little_sound u ((stageBPriority (shape 1 2 5)) 1) a) 15 a +def CB1_2_5I1R15Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB1_2_5I1R15Certificates_valid : + CB1_2_5I1R15Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_2_5I1R15CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB1_2_5I1R15P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_2_5I1R15Certificates (CB1_2_5I1R15CertificateIndex a)).input +lemma CB1_2_5I1R15P_check : ∀ a : Fin 6, contains (CB1_2_5I1R15Raw a) (CB1_2_5I1R15P a) = true := by + decide +kernel +lemma CB1_2_5I1R15P_sound (a : Fin 6) : + (CB1_2_5I1R15P a).Encloses (CB1_2_5I1R15Value a) := + contains_sound (CB1_2_5I1R15Raw_sound a) (CB1_2_5I1R15P_check a) +def CB1_2_5I1R15Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_2_5I1R15Certificates (CB1_2_5I1R15CertificateIndex a)).output +lemma CB1_2_5I1R15Terms_sound (a : Fin 6) : + (CB1_2_5I1R15Terms a).Encloses (Foundation.entropyTerm (CB1_2_5I1R15Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_2_5I1R15Certificates_valid + (CB1_2_5I1R15CertificateIndex a) (CB1_2_5I1R15P_sound a) +def CB1_2_5I1R15Entropy : Ball := ⟨0, 0⟩ +lemma CB1_2_5I1R15Entropy_sound : CB1_2_5I1R15Entropy.Encloses (Foundation.finiteEntropy CB1_2_5I1R15Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_2_5I1R15Value CB1_2_5I1R15Terms CB1_2_5I1R15Terms_sound) (by decide +kernel) +def CB1_2_5I1R15Mass : Ball := ⟨0, 0⟩ +lemma CB1_2_5I1R15Mass_sound : CB1_2_5I1R15Mass.Encloses (∑ a, CB1_2_5I1R15Value a) := by + exact contains_sound (finSumBall_sound 6 CB1_2_5I1R15P CB1_2_5I1R15Value CB1_2_5I1R15P_sound) (by decide +kernel) +def CB1_2_5I1R15MassTerm : Ball := .exact 0 +lemma CB1_2_5I1R15MassTerm_sound : CB1_2_5I1R15MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_2_5I1R15Value a))) := + entropyTerm_zero_ball (CB1_2_5I1R15Mass_sound) +def CB1_2_5I1R15H : Ball := ⟨0, 0⟩ +lemma CB1_2_5I1R15H_sound : CB1_2_5I1R15H.Encloses (homogeneousEntropy CB1_2_5I1R15Value) := by + exact contains_sound (homogeneous_enclosed CB1_2_5I1R15Value CB1_2_5I1R15MassTerm_sound CB1_2_5I1R15Entropy_sound) (by decide +kernel) +def CB1_2_5I1R16Value (a : Fin 6) : ℝ := residualLaw (below (shape 1 2 5)) (fun u => (stageBLaw (shape 1 2 5) u : ℝ)) (stageBPriority (shape 1 2 5)) 1 (fun u a => (littleLaw (shape 1 2 5) u ((stageBPriority (shape 1 2 5)) 1) a : ℝ)) 16 a +def CB1_2_5I1R16Raw (a : Fin 6) : Ball := residualBall (below (shape 1 2 5)) B1_2_5Law (stageBPriority (shape 1 2 5)) 1 (fun u => B1_2_5Little u ((stageBPriority (shape 1 2 5)) 1)) 16 a +lemma CB1_2_5I1R16Raw_sound (a : Fin 6) : + (CB1_2_5I1R16Raw a).Encloses (CB1_2_5I1R16Value a) := by + exact residualBall_sound_on (below (shape 1 2 5)) B1_2_5Law (fun u => (stageBLaw (shape 1 2 5) u : ℝ)) (stageBPriority (shape 1 2 5)) 1 (fun u => B1_2_5Little u ((stageBPriority (shape 1 2 5)) 1)) (fun u a => (littleLaw (shape 1 2 5) u ((stageBPriority (shape 1 2 5)) 1) a : ℝ)) (fun u _ => B1_2_5Law_sound u) (fun u _ a => B1_2_5Little_sound u ((stageBPriority (shape 1 2 5)) 1) a) 16 a +def CB1_2_5I1R16Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB1_2_5I1R16Certificates_valid : + CB1_2_5I1R16Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_2_5I1R16CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB1_2_5I1R16P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_2_5I1R16Certificates (CB1_2_5I1R16CertificateIndex a)).input +lemma CB1_2_5I1R16P_check : ∀ a : Fin 6, contains (CB1_2_5I1R16Raw a) (CB1_2_5I1R16P a) = true := by + decide +kernel +lemma CB1_2_5I1R16P_sound (a : Fin 6) : + (CB1_2_5I1R16P a).Encloses (CB1_2_5I1R16Value a) := + contains_sound (CB1_2_5I1R16Raw_sound a) (CB1_2_5I1R16P_check a) +def CB1_2_5I1R16Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_2_5I1R16Certificates (CB1_2_5I1R16CertificateIndex a)).output +lemma CB1_2_5I1R16Terms_sound (a : Fin 6) : + (CB1_2_5I1R16Terms a).Encloses (Foundation.entropyTerm (CB1_2_5I1R16Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_2_5I1R16Certificates_valid + (CB1_2_5I1R16CertificateIndex a) (CB1_2_5I1R16P_sound a) +def CB1_2_5I1R16Entropy : Ball := ⟨0, 0⟩ +lemma CB1_2_5I1R16Entropy_sound : CB1_2_5I1R16Entropy.Encloses (Foundation.finiteEntropy CB1_2_5I1R16Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_2_5I1R16Value CB1_2_5I1R16Terms CB1_2_5I1R16Terms_sound) (by decide +kernel) +def CB1_2_5I1R16Mass : Ball := ⟨0, 0⟩ +lemma CB1_2_5I1R16Mass_sound : CB1_2_5I1R16Mass.Encloses (∑ a, CB1_2_5I1R16Value a) := by + exact contains_sound (finSumBall_sound 6 CB1_2_5I1R16P CB1_2_5I1R16Value CB1_2_5I1R16P_sound) (by decide +kernel) +def CB1_2_5I1R16MassTerm : Ball := .exact 0 +lemma CB1_2_5I1R16MassTerm_sound : CB1_2_5I1R16MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_2_5I1R16Value a))) := + entropyTerm_zero_ball (CB1_2_5I1R16Mass_sound) +def CB1_2_5I1R16H : Ball := ⟨0, 0⟩ +lemma CB1_2_5I1R16H_sound : CB1_2_5I1R16H.Encloses (homogeneousEntropy CB1_2_5I1R16Value) := by + exact contains_sound (homogeneous_enclosed CB1_2_5I1R16Value CB1_2_5I1R16MassTerm_sound CB1_2_5I1R16Entropy_sound) (by decide +kernel) +def CB1_2_5I1ResidualEntropies (a : Fin 17) : Ball := + match a.val with + | 0 => CB1_2_5I1R0H + | 1 => CB1_2_5I1R1H + | 2 => CB1_2_5I1R2H + | 3 => CB1_2_5I1R3H + | 4 => CB1_2_5I1R4H + | 5 => CB1_2_5I1R5H + | 6 => CB1_2_5I1R6H + | 7 => CB1_2_5I1R7H + | 8 => CB1_2_5I1R8H + | 9 => CB1_2_5I1R9H + | 10 => CB1_2_5I1R10H + | 11 => CB1_2_5I1R11H + | 12 => CB1_2_5I1R12H + | 13 => CB1_2_5I1R13H + | 14 => CB1_2_5I1R14H + | 15 => CB1_2_5I1R15H + | 16 => CB1_2_5I1R16H + | _ => (.exact 0) +lemma CB1_2_5I1ResidualEntropies_sound (k : Fin 17) : + (CB1_2_5I1ResidualEntropies k).Encloses (homogeneousEntropy + (residualLaw (below (shape 1 2 5)) (fun u => (stageBLaw (shape 1 2 5) u : ℝ)) (stageBPriority (shape 1 2 5)) 1 (fun u a => (littleLaw (shape 1 2 5) u ((stageBPriority (shape 1 2 5)) 1) a : ℝ)) k)) := by + fin_cases k + · exact CB1_2_5I1R0H_sound + · exact CB1_2_5I1R1H_sound + · exact CB1_2_5I1R2H_sound + · exact CB1_2_5I1R3H_sound + · exact CB1_2_5I1R4H_sound + · exact CB1_2_5I1R5H_sound + · exact CB1_2_5I1R6H_sound + · exact CB1_2_5I1R7H_sound + · exact CB1_2_5I1R8H_sound + · exact CB1_2_5I1R9H_sound + · exact CB1_2_5I1R10H_sound + · exact CB1_2_5I1R11H_sound + · exact CB1_2_5I1R12H_sound + · exact CB1_2_5I1R13H_sound + · exact CB1_2_5I1R14H_sound + · exact CB1_2_5I1R15H_sound + · exact CB1_2_5I1R16H_sound +def CB1_2_5I1Singles (s : Shape) : Ball := + match s 0, s 1, s 2 with + | _, _, _ => (.exact 0) +lemma CB1_2_5I1Singles_sound (u : Shape) (hu : u ∈ below (shape 1 2 5)) + (hd : designated (stageBPriority (shape 1 2 5)) 1 u) : + (CB1_2_5I1Singles u).Encloses (homogeneousEntropy ((fun u a => (littleLaw (shape 1 2 5) u ((stageBPriority (shape 1 2 5)) 1) a : ℝ)) u)) := by + rw [B1_2_5_below] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl | rfl | rfl + · exact (show ¬ designated (stageBPriority (shape 1 2 5)) 1 (shape 0 0 4) by decide +kernel) hd |>.elim + · exact (show ¬ designated (stageBPriority (shape 1 2 5)) 1 (shape 0 1 3) by decide +kernel) hd |>.elim + · exact (show ¬ designated (stageBPriority (shape 1 2 5)) 1 (shape 0 2 2) by decide +kernel) hd |>.elim + · exact (show ¬ designated (stageBPriority (shape 1 2 5)) 1 (shape 1 0 3) by decide +kernel) hd |>.elim + · exact (show ¬ designated (stageBPriority (shape 1 2 5)) 1 (shape 1 1 2) by decide +kernel) hd |>.elim + · exact (show ¬ designated (stageBPriority (shape 1 2 5)) 1 (shape 1 2 1) by decide +kernel) hd |>.elim +def CB1_2_5I1Singleton : Ball := ⟨0, 0⟩ +lemma CB1_2_5I1Singleton_sound : CB1_2_5I1Singleton.Encloses + (singletonEntropy (below (shape 1 2 5)) (fun u => (stageBLaw (shape 1 2 5) u : ℝ)) (stageBPriority (shape 1 2 5)) 1 (fun u a => (littleLaw (shape 1 2 5) u ((stageBPriority (shape 1 2 5)) 1) a : ℝ))) := by + exact contains_sound (singletonBall_sound (below (shape 1 2 5)) B1_2_5Law (fun u => (stageBLaw (shape 1 2 5) u : ℝ)) (stageBPriority (shape 1 2 5)) 1 + CB1_2_5I1Singles (fun u a => (littleLaw (shape 1 2 5) u ((stageBPriority (shape 1 2 5)) 1) a : ℝ)) (fun u _ => B1_2_5Law_sound u) CB1_2_5I1Singles_sound) (by decide +kernel) +def CB1_2_5I1Group : Ball := ⟨(5835161981670172674580579985131 / 100000000000000000000000000000000), (58391139901 / 50000000000000000000000000000000)⟩ +lemma CB1_2_5I1Group_sound : CB1_2_5I1Group.Encloses + (groupedEntropy (below (shape 1 2 5)) (fun u => (stageBLaw (shape 1 2 5) u : ℝ)) (stageBPriority (shape 1 2 5)) 1 (fun u a => (littleLaw (shape 1 2 5) u ((stageBPriority (shape 1 2 5)) 1) a : ℝ))) := by + exact contains_sound (Ball.add_sound CB1_2_5I1Singleton_sound + (finSumBall_sound 17 CB1_2_5I1ResidualEntropies _ CB1_2_5I1ResidualEntropies_sound)) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CB1_2_5I1H : Ball := ⟨(18194058834292852529515035073069 / 20000000000000000000000000000000), (78706925287 / 25000000000000000000000000000000)⟩ +lemma CB1_2_5I1_sound : CB1_2_5I1H.Encloses (stageBCapacity (shape 1 2 5) 1) := by + have hb := contains_sound (Ball.add_sound CB1_2_5I1PairH_sound + (Ball.neg_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) CB1_2_5I1Group_sound))) + (show contains (.add CB1_2_5I1PairH (.neg (.mul (.exact 2) CB1_2_5I1Group))) CB1_2_5I1H = true by decide +kernel) + unfold CB1_2_5I1PairValue at hb + simpa only [stageBCapacity, nativeCapacity, + show (1 : Fin 3) ≠ 0 by decide, ite_false, sub_eq_add_neg] using hb + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/CapacityB/CapB1_2_5I2.lean b/lean/OAI/LinearAlgebra/MatrixFields/CapacityB/CapB1_2_5I2.lean new file mode 100644 index 0000000000000000000000000000000000000000..048c082cb6a096b28c61cd722d9dcc41acd53be8 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/CapacityB/CapB1_2_5I2.lean @@ -0,0 +1,989 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Certificates.LittleB1_3_4 + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CB1_2_5I2PairValue (a : PairSlot) : ℝ := pairLaw (below (shape 1 2 5)) (shape 1 2 5) (fun u => (stageBLaw (shape 1 2 5) u : ℝ)) (fun u a => (littleLaw (shape 1 2 5) u ((stageBPriority (shape 1 2 5)) 2) a : ℝ)) a +def CB1_2_5I2PairRaw (a : PairSlot) : Ball := pairLawBall (below (shape 1 2 5)) (shape 1 2 5) B1_2_5Law (fun u => B1_2_5Little u ((stageBPriority (shape 1 2 5)) 2)) a +lemma CB1_2_5I2PairRaw_sound (a : PairSlot) : + (CB1_2_5I2PairRaw a).Encloses (CB1_2_5I2PairValue a) := by + exact pairLawBall_sound_on (below (shape 1 2 5)) (shape 1 2 5) B1_2_5Law (fun u => (stageBLaw (shape 1 2 5) u : ℝ)) (fun u => B1_2_5Little u ((stageBPriority (shape 1 2 5)) 2)) (fun u a => (littleLaw (shape 1 2 5) u ((stageBPriority (shape 1 2 5)) 2) a : ℝ)) (fun u _ => B1_2_5Law_sound u) (fun u _ a => B1_2_5Little_sound u ((stageBPriority (shape 1 2 5)) 2) a) (fun u _ a => B1_2_5Little_sound (complement (shape 1 2 5) u) ((stageBPriority (shape 1 2 5)) 2) a) a +def CB1_2_5I2PairCertificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(36249118515191988245121850051 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(104823217663759354529068898563 / 20000000000000000000000000000000), (36845039 / 20000000000000000000000000000000)⟩ ⟨(-180734080505688700582649404519601 / 25000000000000000000000000000000), (10164395423 / 4000000000000000000000000000000)⟩ ⟨-11, 36249118515191988245121850051, 24414062500000000000000000000⟩, + .log ⟨(9630112437092073853782692487793 / 20000000000000000000000000000000), (47 / 100000000000000000000000000000000)⟩ ⟨(7038046066567514544201224208257 / 20000000000000000000000000000000), (15294417267 / 50000000000000000000000000000000)⟩ ⟨(-36541868605081082766507538514009 / 50000000000000000000000000000000), (31763735573 / 50000000000000000000000000000000)⟩ ⟨-2, 9630112437092073853782692487793, 5000000000000000000000000000000⟩, + .log ⟨(1776939577509246754596293860933 / 100000000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ ⟨(7161559846725884578897458412633 / 100000000000000000000000000000000), (658492791 / 25000000000000000000000000000000)⟩ ⟨(-403027763992083044849969306255681 / 100000000000000000000000000000000), (29646153201 / 20000000000000000000000000000000)⟩ ⟨-6, 1776939577509246754596293860933, 1562500000000000000000000000000⟩] +lemma CB1_2_5I2PairCertificates_valid : + CB1_2_5I2PairCertificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_2_5I2PairCertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 5, 1 => 1 + | 4, 2 => 2 + | 4, 3 => 3 + | 2, 4 => 2 + | 3, 4 => 3 + | 1, 5 => 1 + | _, _ => 0 +def CB1_2_5I2PairP (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CB1_2_5I2PairCertificates (CB1_2_5I2PairCertificateIndex a)).input +lemma CB1_2_5I2PairP_check : ∀ a : PairSlot, contains (CB1_2_5I2PairRaw a) (CB1_2_5I2PairP a) = true := by + decide +kernel +lemma CB1_2_5I2PairP_sound (a : PairSlot) : + (CB1_2_5I2PairP a).Encloses (CB1_2_5I2PairValue a) := + contains_sound (CB1_2_5I2PairRaw_sound a) (CB1_2_5I2PairP_check a) +def CB1_2_5I2PairTerms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CB1_2_5I2PairCertificates (CB1_2_5I2PairCertificateIndex a)).output +lemma CB1_2_5I2PairTerms_sound (a : PairSlot) : + (CB1_2_5I2PairTerms a).Encloses (Foundation.entropyTerm (CB1_2_5I2PairValue a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_2_5I2PairCertificates_valid + (CB1_2_5I2PairCertificateIndex a) (CB1_2_5I2PairP_sound a) +def CB1_2_5I2PairEntropy : Ball := ⟨(42875906267882254072548923946733 / 50000000000000000000000000000000), (33407030893 / 50000000000000000000000000000000)⟩ +lemma CB1_2_5I2PairEntropy_sound : CB1_2_5I2PairEntropy.Encloses (Foundation.finiteEntropy CB1_2_5I2PairValue) := by + exact contains_sound (entropyPair_enclosed CB1_2_5I2PairValue CB1_2_5I2PairTerms CB1_2_5I2PairTerms_sound) (by decide +kernel) +def CB1_2_5I2PairMass : Ball := ⟨1, (13 / 12500000000000000000000000000000)⟩ +lemma CB1_2_5I2PairMass_sound : CB1_2_5I2PairMass.Encloses (∑ a, CB1_2_5I2PairValue a) := by + exact contains_sound (pairSumBall_sound CB1_2_5I2PairP CB1_2_5I2PairValue CB1_2_5I2PairP_sound) (by decide +kernel) +def CB1_2_5I2PairMassTermLogWitness : LogWitness := ⟨0, 1, 1⟩ +def CB1_2_5I2PairMassTermLog : Ball := ⟨0, (10587911893 / 50000000000000000000000000000000)⟩ +lemma CB1_2_5I2PairMassTermLog_sound : CB1_2_5I2PairMassTermLog.Encloses (Real.log ((∑ a, CB1_2_5I2PairValue a))) := by + exact checkLog_sound logTwoBall_sound (CB1_2_5I2PairMass_sound) (w := CB1_2_5I2PairMassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB1_2_5I2PairMassTerm : Ball := ⟨0, (21175823787 / 100000000000000000000000000000000)⟩ +lemma CB1_2_5I2PairMassTerm_sound : CB1_2_5I2PairMassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_2_5I2PairValue a))) := by + exact contains_sound (entropyTerm_ball (CB1_2_5I2PairMass_sound) CB1_2_5I2PairMassTermLog_sound) (by decide +kernel) +def CB1_2_5I2PairH : Ball := ⟨(42875906267882254072548923946733 / 50000000000000000000000000000000), (87989885573 / 100000000000000000000000000000000)⟩ +lemma CB1_2_5I2PairH_sound : CB1_2_5I2PairH.Encloses (homogeneousEntropy CB1_2_5I2PairValue) := by + exact contains_sound (homogeneous_enclosed CB1_2_5I2PairValue CB1_2_5I2PairMassTerm_sound CB1_2_5I2PairEntropy_sound) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CB1_2_5I2R0Value (a : Fin 6) : ℝ := residualLaw (below (shape 1 2 5)) (fun u => (stageBLaw (shape 1 2 5) u : ℝ)) (stageBPriority (shape 1 2 5)) 2 (fun u a => (littleLaw (shape 1 2 5) u ((stageBPriority (shape 1 2 5)) 2) a : ℝ)) 0 a +def CB1_2_5I2R0Raw (a : Fin 6) : Ball := residualBall (below (shape 1 2 5)) B1_2_5Law (stageBPriority (shape 1 2 5)) 2 (fun u => B1_2_5Little u ((stageBPriority (shape 1 2 5)) 2)) 0 a +lemma CB1_2_5I2R0Raw_sound (a : Fin 6) : + (CB1_2_5I2R0Raw a).Encloses (CB1_2_5I2R0Value a) := by + exact residualBall_sound_on (below (shape 1 2 5)) B1_2_5Law (fun u => (stageBLaw (shape 1 2 5) u : ℝ)) (stageBPriority (shape 1 2 5)) 2 (fun u => B1_2_5Little u ((stageBPriority (shape 1 2 5)) 2)) (fun u a => (littleLaw (shape 1 2 5) u ((stageBPriority (shape 1 2 5)) 2) a : ℝ)) (fun u _ => B1_2_5Law_sound u) (fun u _ a => B1_2_5Little_sound u ((stageBPriority (shape 1 2 5)) 2) a) 0 a +def CB1_2_5I2R0Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB1_2_5I2R0Certificates_valid : + CB1_2_5I2R0Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_2_5I2R0CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB1_2_5I2R0P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_2_5I2R0Certificates (CB1_2_5I2R0CertificateIndex a)).input +lemma CB1_2_5I2R0P_check : ∀ a : Fin 6, contains (CB1_2_5I2R0Raw a) (CB1_2_5I2R0P a) = true := by + decide +kernel +lemma CB1_2_5I2R0P_sound (a : Fin 6) : + (CB1_2_5I2R0P a).Encloses (CB1_2_5I2R0Value a) := + contains_sound (CB1_2_5I2R0Raw_sound a) (CB1_2_5I2R0P_check a) +def CB1_2_5I2R0Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_2_5I2R0Certificates (CB1_2_5I2R0CertificateIndex a)).output +lemma CB1_2_5I2R0Terms_sound (a : Fin 6) : + (CB1_2_5I2R0Terms a).Encloses (Foundation.entropyTerm (CB1_2_5I2R0Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_2_5I2R0Certificates_valid + (CB1_2_5I2R0CertificateIndex a) (CB1_2_5I2R0P_sound a) +def CB1_2_5I2R0Entropy : Ball := ⟨0, 0⟩ +lemma CB1_2_5I2R0Entropy_sound : CB1_2_5I2R0Entropy.Encloses (Foundation.finiteEntropy CB1_2_5I2R0Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_2_5I2R0Value CB1_2_5I2R0Terms CB1_2_5I2R0Terms_sound) (by decide +kernel) +def CB1_2_5I2R0Mass : Ball := ⟨0, 0⟩ +lemma CB1_2_5I2R0Mass_sound : CB1_2_5I2R0Mass.Encloses (∑ a, CB1_2_5I2R0Value a) := by + exact contains_sound (finSumBall_sound 6 CB1_2_5I2R0P CB1_2_5I2R0Value CB1_2_5I2R0P_sound) (by decide +kernel) +def CB1_2_5I2R0MassTerm : Ball := .exact 0 +lemma CB1_2_5I2R0MassTerm_sound : CB1_2_5I2R0MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_2_5I2R0Value a))) := + entropyTerm_zero_ball (CB1_2_5I2R0Mass_sound) +def CB1_2_5I2R0H : Ball := ⟨0, 0⟩ +lemma CB1_2_5I2R0H_sound : CB1_2_5I2R0H.Encloses (homogeneousEntropy CB1_2_5I2R0Value) := by + exact contains_sound (homogeneous_enclosed CB1_2_5I2R0Value CB1_2_5I2R0MassTerm_sound CB1_2_5I2R0Entropy_sound) (by decide +kernel) +def CB1_2_5I2R1Value (a : Fin 6) : ℝ := residualLaw (below (shape 1 2 5)) (fun u => (stageBLaw (shape 1 2 5) u : ℝ)) (stageBPriority (shape 1 2 5)) 2 (fun u a => (littleLaw (shape 1 2 5) u ((stageBPriority (shape 1 2 5)) 2) a : ℝ)) 1 a +def CB1_2_5I2R1Raw (a : Fin 6) : Ball := residualBall (below (shape 1 2 5)) B1_2_5Law (stageBPriority (shape 1 2 5)) 2 (fun u => B1_2_5Little u ((stageBPriority (shape 1 2 5)) 2)) 1 a +lemma CB1_2_5I2R1Raw_sound (a : Fin 6) : + (CB1_2_5I2R1Raw a).Encloses (CB1_2_5I2R1Value a) := by + exact residualBall_sound_on (below (shape 1 2 5)) B1_2_5Law (fun u => (stageBLaw (shape 1 2 5) u : ℝ)) (stageBPriority (shape 1 2 5)) 2 (fun u => B1_2_5Little u ((stageBPriority (shape 1 2 5)) 2)) (fun u a => (littleLaw (shape 1 2 5) u ((stageBPriority (shape 1 2 5)) 2) a : ℝ)) (fun u _ => B1_2_5Law_sound u) (fun u _ a => B1_2_5Little_sound u ((stageBPriority (shape 1 2 5)) 2) a) 1 a +def CB1_2_5I2R1Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(36249118515191988245121850051 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(104823217663759354529068898563 / 20000000000000000000000000000000), (36845039 / 20000000000000000000000000000000)⟩ ⟨(-180734080505688700582649404519601 / 25000000000000000000000000000000), (10164395423 / 4000000000000000000000000000000)⟩ ⟨-11, 36249118515191988245121850051, 24414062500000000000000000000⟩] +lemma CB1_2_5I2R1Certificates_valid : + CB1_2_5I2R1Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_2_5I2R1CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | 1 => 1 + | _ => 0 +def CB1_2_5I2R1P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_2_5I2R1Certificates (CB1_2_5I2R1CertificateIndex a)).input +lemma CB1_2_5I2R1P_check : ∀ a : Fin 6, contains (CB1_2_5I2R1Raw a) (CB1_2_5I2R1P a) = true := by + decide +kernel +lemma CB1_2_5I2R1P_sound (a : Fin 6) : + (CB1_2_5I2R1P a).Encloses (CB1_2_5I2R1Value a) := + contains_sound (CB1_2_5I2R1Raw_sound a) (CB1_2_5I2R1P_check a) +def CB1_2_5I2R1Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_2_5I2R1Certificates (CB1_2_5I2R1CertificateIndex a)).output +lemma CB1_2_5I2R1Terms_sound (a : Fin 6) : + (CB1_2_5I2R1Terms a).Encloses (Foundation.entropyTerm (CB1_2_5I2R1Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_2_5I2R1Certificates_valid + (CB1_2_5I2R1CertificateIndex a) (CB1_2_5I2R1P_sound a) +def CB1_2_5I2R1Entropy : Ball := ⟨(104823217663759354529068898563 / 20000000000000000000000000000000), (36845039 / 20000000000000000000000000000000)⟩ +lemma CB1_2_5I2R1Entropy_sound : CB1_2_5I2R1Entropy.Encloses (Foundation.finiteEntropy CB1_2_5I2R1Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_2_5I2R1Value CB1_2_5I2R1Terms CB1_2_5I2R1Terms_sound) (by decide +kernel) +def CB1_2_5I2R1Mass : Ball := ⟨(36249118515191988245121850051 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ +lemma CB1_2_5I2R1Mass_sound : CB1_2_5I2R1Mass.Encloses (∑ a, CB1_2_5I2R1Value a) := by + exact contains_sound (finSumBall_sound 6 CB1_2_5I2R1P CB1_2_5I2R1Value CB1_2_5I2R1P_sound) (by decide +kernel) +def CB1_2_5I2R1MassTermLogWitness : LogWitness := ⟨-11, 36249118515191988245121850051, 24414062500000000000000000000⟩ +def CB1_2_5I2R1MassTermLog : Ball := ⟨(-180734080505688700582649404519601 / 25000000000000000000000000000000), (10164395423 / 4000000000000000000000000000000)⟩ +lemma CB1_2_5I2R1MassTermLog_sound : CB1_2_5I2R1MassTermLog.Encloses (Real.log ((∑ a, CB1_2_5I2R1Value a))) := by + exact checkLog_sound logTwoBall_sound (CB1_2_5I2R1Mass_sound) (w := CB1_2_5I2R1MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB1_2_5I2R1MassTerm : Ball := ⟨(104823217663759354529068898563 / 20000000000000000000000000000000), (36845039 / 20000000000000000000000000000000)⟩ +lemma CB1_2_5I2R1MassTerm_sound : CB1_2_5I2R1MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_2_5I2R1Value a))) := by + exact contains_sound (entropyTerm_ball (CB1_2_5I2R1Mass_sound) CB1_2_5I2R1MassTermLog_sound) (by decide +kernel) +def CB1_2_5I2R1H : Ball := ⟨0, (36845039 / 10000000000000000000000000000000)⟩ +lemma CB1_2_5I2R1H_sound : CB1_2_5I2R1H.Encloses (homogeneousEntropy CB1_2_5I2R1Value) := by + exact contains_sound (homogeneous_enclosed CB1_2_5I2R1Value CB1_2_5I2R1MassTerm_sound CB1_2_5I2R1Entropy_sound) (by decide +kernel) +def CB1_2_5I2R2Value (a : Fin 6) : ℝ := residualLaw (below (shape 1 2 5)) (fun u => (stageBLaw (shape 1 2 5) u : ℝ)) (stageBPriority (shape 1 2 5)) 2 (fun u a => (littleLaw (shape 1 2 5) u ((stageBPriority (shape 1 2 5)) 2) a : ℝ)) 2 a +def CB1_2_5I2R2Raw (a : Fin 6) : Ball := residualBall (below (shape 1 2 5)) B1_2_5Law (stageBPriority (shape 1 2 5)) 2 (fun u => B1_2_5Little u ((stageBPriority (shape 1 2 5)) 2)) 2 a +lemma CB1_2_5I2R2Raw_sound (a : Fin 6) : + (CB1_2_5I2R2Raw a).Encloses (CB1_2_5I2R2Value a) := by + exact residualBall_sound_on (below (shape 1 2 5)) B1_2_5Law (fun u => (stageBLaw (shape 1 2 5) u : ℝ)) (stageBPriority (shape 1 2 5)) 2 (fun u => B1_2_5Little u ((stageBPriority (shape 1 2 5)) 2)) (fun u a => (littleLaw (shape 1 2 5) u ((stageBPriority (shape 1 2 5)) 2) a : ℝ)) (fun u _ => B1_2_5Law_sound u) (fun u _ a => B1_2_5Little_sound u ((stageBPriority (shape 1 2 5)) 2) a) 2 a +def CB1_2_5I2R2Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(396642594740867223667445521291 / 1250000000000000000000000000000), (1 / 6250000000000000000000000000000)⟩ ⟨(7284663137258594485497802035789 / 20000000000000000000000000000000), (10079080399 / 50000000000000000000000000000000)⟩ ⟨(-114786322022754802330597789937667 / 100000000000000000000000000000000), (63527471099 / 100000000000000000000000000000000)⟩ ⟨-2, 396642594740867223667445521291, 312500000000000000000000000000⟩] +lemma CB1_2_5I2R2Certificates_valid : + CB1_2_5I2R2Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_2_5I2R2CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | 2 => 1 + | _ => 0 +def CB1_2_5I2R2P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_2_5I2R2Certificates (CB1_2_5I2R2CertificateIndex a)).input +lemma CB1_2_5I2R2P_check : ∀ a : Fin 6, contains (CB1_2_5I2R2Raw a) (CB1_2_5I2R2P a) = true := by + decide +kernel +lemma CB1_2_5I2R2P_sound (a : Fin 6) : + (CB1_2_5I2R2P a).Encloses (CB1_2_5I2R2Value a) := + contains_sound (CB1_2_5I2R2Raw_sound a) (CB1_2_5I2R2P_check a) +def CB1_2_5I2R2Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_2_5I2R2Certificates (CB1_2_5I2R2CertificateIndex a)).output +lemma CB1_2_5I2R2Terms_sound (a : Fin 6) : + (CB1_2_5I2R2Terms a).Encloses (Foundation.entropyTerm (CB1_2_5I2R2Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_2_5I2R2Certificates_valid + (CB1_2_5I2R2CertificateIndex a) (CB1_2_5I2R2P_sound a) +def CB1_2_5I2R2Entropy : Ball := ⟨(7284663137258594485497802035789 / 20000000000000000000000000000000), (10079080399 / 50000000000000000000000000000000)⟩ +lemma CB1_2_5I2R2Entropy_sound : CB1_2_5I2R2Entropy.Encloses (Foundation.finiteEntropy CB1_2_5I2R2Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_2_5I2R2Value CB1_2_5I2R2Terms CB1_2_5I2R2Terms_sound) (by decide +kernel) +def CB1_2_5I2R2Mass : Ball := ⟨(396642594740867223667445521291 / 1250000000000000000000000000000), (1 / 6250000000000000000000000000000)⟩ +lemma CB1_2_5I2R2Mass_sound : CB1_2_5I2R2Mass.Encloses (∑ a, CB1_2_5I2R2Value a) := by + exact contains_sound (finSumBall_sound 6 CB1_2_5I2R2P CB1_2_5I2R2Value CB1_2_5I2R2P_sound) (by decide +kernel) +def CB1_2_5I2R2MassTermLogWitness : LogWitness := ⟨-2, 396642594740867223667445521291, 312500000000000000000000000000⟩ +def CB1_2_5I2R2MassTermLog : Ball := ⟨(-114786322022754802330597789937667 / 100000000000000000000000000000000), (63527471099 / 100000000000000000000000000000000)⟩ +lemma CB1_2_5I2R2MassTermLog_sound : CB1_2_5I2R2MassTermLog.Encloses (Real.log ((∑ a, CB1_2_5I2R2Value a))) := by + exact checkLog_sound logTwoBall_sound (CB1_2_5I2R2Mass_sound) (w := CB1_2_5I2R2MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB1_2_5I2R2MassTerm : Ball := ⟨(7284663137258594485497802035789 / 20000000000000000000000000000000), (10079080399 / 50000000000000000000000000000000)⟩ +lemma CB1_2_5I2R2MassTerm_sound : CB1_2_5I2R2MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_2_5I2R2Value a))) := by + exact contains_sound (entropyTerm_ball (CB1_2_5I2R2Mass_sound) CB1_2_5I2R2MassTermLog_sound) (by decide +kernel) +def CB1_2_5I2R2H : Ball := ⟨0, (10079080399 / 25000000000000000000000000000000)⟩ +lemma CB1_2_5I2R2H_sound : CB1_2_5I2R2H.Encloses (homogeneousEntropy CB1_2_5I2R2Value) := by + exact contains_sound (homogeneous_enclosed CB1_2_5I2R2Value CB1_2_5I2R2MassTerm_sound CB1_2_5I2R2Entropy_sound) (by decide +kernel) +def CB1_2_5I2R3Value (a : Fin 6) : ℝ := residualLaw (below (shape 1 2 5)) (fun u => (stageBLaw (shape 1 2 5) u : ℝ)) (stageBPriority (shape 1 2 5)) 2 (fun u a => (littleLaw (shape 1 2 5) u ((stageBPriority (shape 1 2 5)) 2) a : ℝ)) 3 a +def CB1_2_5I2R3Raw (a : Fin 6) : Ball := residualBall (below (shape 1 2 5)) B1_2_5Law (stageBPriority (shape 1 2 5)) 2 (fun u => B1_2_5Little u ((stageBPriority (shape 1 2 5)) 2)) 3 a +lemma CB1_2_5I2R3Raw_sound (a : Fin 6) : + (CB1_2_5I2R3Raw a).Encloses (CB1_2_5I2R3Value a) := by + exact residualBall_sound_on (below (shape 1 2 5)) B1_2_5Law (fun u => (stageBLaw (shape 1 2 5) u : ℝ)) (stageBPriority (shape 1 2 5)) 2 (fun u => B1_2_5Little u ((stageBPriority (shape 1 2 5)) 2)) (fun u a => (littleLaw (shape 1 2 5) u ((stageBPriority (shape 1 2 5)) 2) a : ℝ)) (fun u _ => B1_2_5Law_sound u) (fun u _ a => B1_2_5Little_sound u ((stageBPriority (shape 1 2 5)) 2) a) 3 a +def CB1_2_5I2R3Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB1_2_5I2R3Certificates_valid : + CB1_2_5I2R3Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_2_5I2R3CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB1_2_5I2R3P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_2_5I2R3Certificates (CB1_2_5I2R3CertificateIndex a)).input +lemma CB1_2_5I2R3P_check : ∀ a : Fin 6, contains (CB1_2_5I2R3Raw a) (CB1_2_5I2R3P a) = true := by + decide +kernel +lemma CB1_2_5I2R3P_sound (a : Fin 6) : + (CB1_2_5I2R3P a).Encloses (CB1_2_5I2R3Value a) := + contains_sound (CB1_2_5I2R3Raw_sound a) (CB1_2_5I2R3P_check a) +def CB1_2_5I2R3Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_2_5I2R3Certificates (CB1_2_5I2R3CertificateIndex a)).output +lemma CB1_2_5I2R3Terms_sound (a : Fin 6) : + (CB1_2_5I2R3Terms a).Encloses (Foundation.entropyTerm (CB1_2_5I2R3Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_2_5I2R3Certificates_valid + (CB1_2_5I2R3CertificateIndex a) (CB1_2_5I2R3P_sound a) +def CB1_2_5I2R3Entropy : Ball := ⟨0, 0⟩ +lemma CB1_2_5I2R3Entropy_sound : CB1_2_5I2R3Entropy.Encloses (Foundation.finiteEntropy CB1_2_5I2R3Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_2_5I2R3Value CB1_2_5I2R3Terms CB1_2_5I2R3Terms_sound) (by decide +kernel) +def CB1_2_5I2R3Mass : Ball := ⟨0, 0⟩ +lemma CB1_2_5I2R3Mass_sound : CB1_2_5I2R3Mass.Encloses (∑ a, CB1_2_5I2R3Value a) := by + exact contains_sound (finSumBall_sound 6 CB1_2_5I2R3P CB1_2_5I2R3Value CB1_2_5I2R3P_sound) (by decide +kernel) +def CB1_2_5I2R3MassTerm : Ball := .exact 0 +lemma CB1_2_5I2R3MassTerm_sound : CB1_2_5I2R3MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_2_5I2R3Value a))) := + entropyTerm_zero_ball (CB1_2_5I2R3Mass_sound) +def CB1_2_5I2R3H : Ball := ⟨0, 0⟩ +lemma CB1_2_5I2R3H_sound : CB1_2_5I2R3H.Encloses (homogeneousEntropy CB1_2_5I2R3Value) := by + exact contains_sound (homogeneous_enclosed CB1_2_5I2R3Value CB1_2_5I2R3MassTerm_sound CB1_2_5I2R3Entropy_sound) (by decide +kernel) +def CB1_2_5I2R4Value (a : Fin 6) : ℝ := residualLaw (below (shape 1 2 5)) (fun u => (stageBLaw (shape 1 2 5) u : ℝ)) (stageBPriority (shape 1 2 5)) 2 (fun u a => (littleLaw (shape 1 2 5) u ((stageBPriority (shape 1 2 5)) 2) a : ℝ)) 4 a +def CB1_2_5I2R4Raw (a : Fin 6) : Ball := residualBall (below (shape 1 2 5)) B1_2_5Law (stageBPriority (shape 1 2 5)) 2 (fun u => B1_2_5Little u ((stageBPriority (shape 1 2 5)) 2)) 4 a +lemma CB1_2_5I2R4Raw_sound (a : Fin 6) : + (CB1_2_5I2R4Raw a).Encloses (CB1_2_5I2R4Value a) := by + exact residualBall_sound_on (below (shape 1 2 5)) B1_2_5Law (fun u => (stageBLaw (shape 1 2 5) u : ℝ)) (stageBPriority (shape 1 2 5)) 2 (fun u => B1_2_5Little u ((stageBPriority (shape 1 2 5)) 2)) (fun u a => (littleLaw (shape 1 2 5) u ((stageBPriority (shape 1 2 5)) 2) a : ℝ)) (fun u _ => B1_2_5Law_sound u) (fun u _ a => B1_2_5Little_sound u ((stageBPriority (shape 1 2 5)) 2) a) 4 a +def CB1_2_5I2R4Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB1_2_5I2R4Certificates_valid : + CB1_2_5I2R4Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_2_5I2R4CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB1_2_5I2R4P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_2_5I2R4Certificates (CB1_2_5I2R4CertificateIndex a)).input +lemma CB1_2_5I2R4P_check : ∀ a : Fin 6, contains (CB1_2_5I2R4Raw a) (CB1_2_5I2R4P a) = true := by + decide +kernel +lemma CB1_2_5I2R4P_sound (a : Fin 6) : + (CB1_2_5I2R4P a).Encloses (CB1_2_5I2R4Value a) := + contains_sound (CB1_2_5I2R4Raw_sound a) (CB1_2_5I2R4P_check a) +def CB1_2_5I2R4Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_2_5I2R4Certificates (CB1_2_5I2R4CertificateIndex a)).output +lemma CB1_2_5I2R4Terms_sound (a : Fin 6) : + (CB1_2_5I2R4Terms a).Encloses (Foundation.entropyTerm (CB1_2_5I2R4Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_2_5I2R4Certificates_valid + (CB1_2_5I2R4CertificateIndex a) (CB1_2_5I2R4P_sound a) +def CB1_2_5I2R4Entropy : Ball := ⟨0, 0⟩ +lemma CB1_2_5I2R4Entropy_sound : CB1_2_5I2R4Entropy.Encloses (Foundation.finiteEntropy CB1_2_5I2R4Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_2_5I2R4Value CB1_2_5I2R4Terms CB1_2_5I2R4Terms_sound) (by decide +kernel) +def CB1_2_5I2R4Mass : Ball := ⟨0, 0⟩ +lemma CB1_2_5I2R4Mass_sound : CB1_2_5I2R4Mass.Encloses (∑ a, CB1_2_5I2R4Value a) := by + exact contains_sound (finSumBall_sound 6 CB1_2_5I2R4P CB1_2_5I2R4Value CB1_2_5I2R4P_sound) (by decide +kernel) +def CB1_2_5I2R4MassTerm : Ball := .exact 0 +lemma CB1_2_5I2R4MassTerm_sound : CB1_2_5I2R4MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_2_5I2R4Value a))) := + entropyTerm_zero_ball (CB1_2_5I2R4Mass_sound) +def CB1_2_5I2R4H : Ball := ⟨0, 0⟩ +lemma CB1_2_5I2R4H_sound : CB1_2_5I2R4H.Encloses (homogeneousEntropy CB1_2_5I2R4Value) := by + exact contains_sound (homogeneous_enclosed CB1_2_5I2R4Value CB1_2_5I2R4MassTerm_sound CB1_2_5I2R4Entropy_sound) (by decide +kernel) +def CB1_2_5I2R5Value (a : Fin 6) : ℝ := residualLaw (below (shape 1 2 5)) (fun u => (stageBLaw (shape 1 2 5) u : ℝ)) (stageBPriority (shape 1 2 5)) 2 (fun u a => (littleLaw (shape 1 2 5) u ((stageBPriority (shape 1 2 5)) 2) a : ℝ)) 5 a +def CB1_2_5I2R5Raw (a : Fin 6) : Ball := residualBall (below (shape 1 2 5)) B1_2_5Law (stageBPriority (shape 1 2 5)) 2 (fun u => B1_2_5Little u ((stageBPriority (shape 1 2 5)) 2)) 5 a +lemma CB1_2_5I2R5Raw_sound (a : Fin 6) : + (CB1_2_5I2R5Raw a).Encloses (CB1_2_5I2R5Value a) := by + exact residualBall_sound_on (below (shape 1 2 5)) B1_2_5Law (fun u => (stageBLaw (shape 1 2 5) u : ℝ)) (stageBPriority (shape 1 2 5)) 2 (fun u => B1_2_5Little u ((stageBPriority (shape 1 2 5)) 2)) (fun u a => (littleLaw (shape 1 2 5) u ((stageBPriority (shape 1 2 5)) 2) a : ℝ)) (fun u _ => B1_2_5Law_sound u) (fun u _ a => B1_2_5Little_sound u ((stageBPriority (shape 1 2 5)) 2) a) 5 a +def CB1_2_5I2R5Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB1_2_5I2R5Certificates_valid : + CB1_2_5I2R5Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_2_5I2R5CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB1_2_5I2R5P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_2_5I2R5Certificates (CB1_2_5I2R5CertificateIndex a)).input +lemma CB1_2_5I2R5P_check : ∀ a : Fin 6, contains (CB1_2_5I2R5Raw a) (CB1_2_5I2R5P a) = true := by + decide +kernel +lemma CB1_2_5I2R5P_sound (a : Fin 6) : + (CB1_2_5I2R5P a).Encloses (CB1_2_5I2R5Value a) := + contains_sound (CB1_2_5I2R5Raw_sound a) (CB1_2_5I2R5P_check a) +def CB1_2_5I2R5Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_2_5I2R5Certificates (CB1_2_5I2R5CertificateIndex a)).output +lemma CB1_2_5I2R5Terms_sound (a : Fin 6) : + (CB1_2_5I2R5Terms a).Encloses (Foundation.entropyTerm (CB1_2_5I2R5Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_2_5I2R5Certificates_valid + (CB1_2_5I2R5CertificateIndex a) (CB1_2_5I2R5P_sound a) +def CB1_2_5I2R5Entropy : Ball := ⟨0, 0⟩ +lemma CB1_2_5I2R5Entropy_sound : CB1_2_5I2R5Entropy.Encloses (Foundation.finiteEntropy CB1_2_5I2R5Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_2_5I2R5Value CB1_2_5I2R5Terms CB1_2_5I2R5Terms_sound) (by decide +kernel) +def CB1_2_5I2R5Mass : Ball := ⟨0, 0⟩ +lemma CB1_2_5I2R5Mass_sound : CB1_2_5I2R5Mass.Encloses (∑ a, CB1_2_5I2R5Value a) := by + exact contains_sound (finSumBall_sound 6 CB1_2_5I2R5P CB1_2_5I2R5Value CB1_2_5I2R5P_sound) (by decide +kernel) +def CB1_2_5I2R5MassTerm : Ball := .exact 0 +lemma CB1_2_5I2R5MassTerm_sound : CB1_2_5I2R5MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_2_5I2R5Value a))) := + entropyTerm_zero_ball (CB1_2_5I2R5Mass_sound) +def CB1_2_5I2R5H : Ball := ⟨0, 0⟩ +lemma CB1_2_5I2R5H_sound : CB1_2_5I2R5H.Encloses (homogeneousEntropy CB1_2_5I2R5Value) := by + exact contains_sound (homogeneous_enclosed CB1_2_5I2R5Value CB1_2_5I2R5MassTerm_sound CB1_2_5I2R5Entropy_sound) (by decide +kernel) +def CB1_2_5I2R6Value (a : Fin 6) : ℝ := residualLaw (below (shape 1 2 5)) (fun u => (stageBLaw (shape 1 2 5) u : ℝ)) (stageBPriority (shape 1 2 5)) 2 (fun u a => (littleLaw (shape 1 2 5) u ((stageBPriority (shape 1 2 5)) 2) a : ℝ)) 6 a +def CB1_2_5I2R6Raw (a : Fin 6) : Ball := residualBall (below (shape 1 2 5)) B1_2_5Law (stageBPriority (shape 1 2 5)) 2 (fun u => B1_2_5Little u ((stageBPriority (shape 1 2 5)) 2)) 6 a +lemma CB1_2_5I2R6Raw_sound (a : Fin 6) : + (CB1_2_5I2R6Raw a).Encloses (CB1_2_5I2R6Value a) := by + exact residualBall_sound_on (below (shape 1 2 5)) B1_2_5Law (fun u => (stageBLaw (shape 1 2 5) u : ℝ)) (stageBPriority (shape 1 2 5)) 2 (fun u => B1_2_5Little u ((stageBPriority (shape 1 2 5)) 2)) (fun u a => (littleLaw (shape 1 2 5) u ((stageBPriority (shape 1 2 5)) 2) a : ℝ)) (fun u _ => B1_2_5Law_sound u) (fun u _ a => B1_2_5Little_sound u ((stageBPriority (shape 1 2 5)) 2) a) 6 a +def CB1_2_5I2R6Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB1_2_5I2R6Certificates_valid : + CB1_2_5I2R6Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_2_5I2R6CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB1_2_5I2R6P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_2_5I2R6Certificates (CB1_2_5I2R6CertificateIndex a)).input +lemma CB1_2_5I2R6P_check : ∀ a : Fin 6, contains (CB1_2_5I2R6Raw a) (CB1_2_5I2R6P a) = true := by + decide +kernel +lemma CB1_2_5I2R6P_sound (a : Fin 6) : + (CB1_2_5I2R6P a).Encloses (CB1_2_5I2R6Value a) := + contains_sound (CB1_2_5I2R6Raw_sound a) (CB1_2_5I2R6P_check a) +def CB1_2_5I2R6Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_2_5I2R6Certificates (CB1_2_5I2R6CertificateIndex a)).output +lemma CB1_2_5I2R6Terms_sound (a : Fin 6) : + (CB1_2_5I2R6Terms a).Encloses (Foundation.entropyTerm (CB1_2_5I2R6Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_2_5I2R6Certificates_valid + (CB1_2_5I2R6CertificateIndex a) (CB1_2_5I2R6P_sound a) +def CB1_2_5I2R6Entropy : Ball := ⟨0, 0⟩ +lemma CB1_2_5I2R6Entropy_sound : CB1_2_5I2R6Entropy.Encloses (Foundation.finiteEntropy CB1_2_5I2R6Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_2_5I2R6Value CB1_2_5I2R6Terms CB1_2_5I2R6Terms_sound) (by decide +kernel) +def CB1_2_5I2R6Mass : Ball := ⟨0, 0⟩ +lemma CB1_2_5I2R6Mass_sound : CB1_2_5I2R6Mass.Encloses (∑ a, CB1_2_5I2R6Value a) := by + exact contains_sound (finSumBall_sound 6 CB1_2_5I2R6P CB1_2_5I2R6Value CB1_2_5I2R6P_sound) (by decide +kernel) +def CB1_2_5I2R6MassTerm : Ball := .exact 0 +lemma CB1_2_5I2R6MassTerm_sound : CB1_2_5I2R6MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_2_5I2R6Value a))) := + entropyTerm_zero_ball (CB1_2_5I2R6Mass_sound) +def CB1_2_5I2R6H : Ball := ⟨0, 0⟩ +lemma CB1_2_5I2R6H_sound : CB1_2_5I2R6H.Encloses (homogeneousEntropy CB1_2_5I2R6Value) := by + exact contains_sound (homogeneous_enclosed CB1_2_5I2R6Value CB1_2_5I2R6MassTerm_sound CB1_2_5I2R6Entropy_sound) (by decide +kernel) +def CB1_2_5I2R7Value (a : Fin 6) : ℝ := residualLaw (below (shape 1 2 5)) (fun u => (stageBLaw (shape 1 2 5) u : ℝ)) (stageBPriority (shape 1 2 5)) 2 (fun u a => (littleLaw (shape 1 2 5) u ((stageBPriority (shape 1 2 5)) 2) a : ℝ)) 7 a +def CB1_2_5I2R7Raw (a : Fin 6) : Ball := residualBall (below (shape 1 2 5)) B1_2_5Law (stageBPriority (shape 1 2 5)) 2 (fun u => B1_2_5Little u ((stageBPriority (shape 1 2 5)) 2)) 7 a +lemma CB1_2_5I2R7Raw_sound (a : Fin 6) : + (CB1_2_5I2R7Raw a).Encloses (CB1_2_5I2R7Value a) := by + exact residualBall_sound_on (below (shape 1 2 5)) B1_2_5Law (fun u => (stageBLaw (shape 1 2 5) u : ℝ)) (stageBPriority (shape 1 2 5)) 2 (fun u => B1_2_5Little u ((stageBPriority (shape 1 2 5)) 2)) (fun u a => (littleLaw (shape 1 2 5) u ((stageBPriority (shape 1 2 5)) 2) a : ℝ)) (fun u _ => B1_2_5Law_sound u) (fun u _ a => B1_2_5Little_sound u ((stageBPriority (shape 1 2 5)) 2) a) 7 a +def CB1_2_5I2R7Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB1_2_5I2R7Certificates_valid : + CB1_2_5I2R7Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_2_5I2R7CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB1_2_5I2R7P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_2_5I2R7Certificates (CB1_2_5I2R7CertificateIndex a)).input +lemma CB1_2_5I2R7P_check : ∀ a : Fin 6, contains (CB1_2_5I2R7Raw a) (CB1_2_5I2R7P a) = true := by + decide +kernel +lemma CB1_2_5I2R7P_sound (a : Fin 6) : + (CB1_2_5I2R7P a).Encloses (CB1_2_5I2R7Value a) := + contains_sound (CB1_2_5I2R7Raw_sound a) (CB1_2_5I2R7P_check a) +def CB1_2_5I2R7Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_2_5I2R7Certificates (CB1_2_5I2R7CertificateIndex a)).output +lemma CB1_2_5I2R7Terms_sound (a : Fin 6) : + (CB1_2_5I2R7Terms a).Encloses (Foundation.entropyTerm (CB1_2_5I2R7Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_2_5I2R7Certificates_valid + (CB1_2_5I2R7CertificateIndex a) (CB1_2_5I2R7P_sound a) +def CB1_2_5I2R7Entropy : Ball := ⟨0, 0⟩ +lemma CB1_2_5I2R7Entropy_sound : CB1_2_5I2R7Entropy.Encloses (Foundation.finiteEntropy CB1_2_5I2R7Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_2_5I2R7Value CB1_2_5I2R7Terms CB1_2_5I2R7Terms_sound) (by decide +kernel) +def CB1_2_5I2R7Mass : Ball := ⟨0, 0⟩ +lemma CB1_2_5I2R7Mass_sound : CB1_2_5I2R7Mass.Encloses (∑ a, CB1_2_5I2R7Value a) := by + exact contains_sound (finSumBall_sound 6 CB1_2_5I2R7P CB1_2_5I2R7Value CB1_2_5I2R7P_sound) (by decide +kernel) +def CB1_2_5I2R7MassTerm : Ball := .exact 0 +lemma CB1_2_5I2R7MassTerm_sound : CB1_2_5I2R7MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_2_5I2R7Value a))) := + entropyTerm_zero_ball (CB1_2_5I2R7Mass_sound) +def CB1_2_5I2R7H : Ball := ⟨0, 0⟩ +lemma CB1_2_5I2R7H_sound : CB1_2_5I2R7H.Encloses (homogeneousEntropy CB1_2_5I2R7Value) := by + exact contains_sound (homogeneous_enclosed CB1_2_5I2R7Value CB1_2_5I2R7MassTerm_sound CB1_2_5I2R7Entropy_sound) (by decide +kernel) +def CB1_2_5I2R8Value (a : Fin 6) : ℝ := residualLaw (below (shape 1 2 5)) (fun u => (stageBLaw (shape 1 2 5) u : ℝ)) (stageBPriority (shape 1 2 5)) 2 (fun u a => (littleLaw (shape 1 2 5) u ((stageBPriority (shape 1 2 5)) 2) a : ℝ)) 8 a +def CB1_2_5I2R8Raw (a : Fin 6) : Ball := residualBall (below (shape 1 2 5)) B1_2_5Law (stageBPriority (shape 1 2 5)) 2 (fun u => B1_2_5Little u ((stageBPriority (shape 1 2 5)) 2)) 8 a +lemma CB1_2_5I2R8Raw_sound (a : Fin 6) : + (CB1_2_5I2R8Raw a).Encloses (CB1_2_5I2R8Value a) := by + exact residualBall_sound_on (below (shape 1 2 5)) B1_2_5Law (fun u => (stageBLaw (shape 1 2 5) u : ℝ)) (stageBPriority (shape 1 2 5)) 2 (fun u => B1_2_5Little u ((stageBPriority (shape 1 2 5)) 2)) (fun u a => (littleLaw (shape 1 2 5) u ((stageBPriority (shape 1 2 5)) 2) a : ℝ)) (fun u _ => B1_2_5Law_sound u) (fun u _ a => B1_2_5Little_sound u ((stageBPriority (shape 1 2 5)) 2) a) 8 a +def CB1_2_5I2R8Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB1_2_5I2R8Certificates_valid : + CB1_2_5I2R8Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_2_5I2R8CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB1_2_5I2R8P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_2_5I2R8Certificates (CB1_2_5I2R8CertificateIndex a)).input +lemma CB1_2_5I2R8P_check : ∀ a : Fin 6, contains (CB1_2_5I2R8Raw a) (CB1_2_5I2R8P a) = true := by + decide +kernel +lemma CB1_2_5I2R8P_sound (a : Fin 6) : + (CB1_2_5I2R8P a).Encloses (CB1_2_5I2R8Value a) := + contains_sound (CB1_2_5I2R8Raw_sound a) (CB1_2_5I2R8P_check a) +def CB1_2_5I2R8Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_2_5I2R8Certificates (CB1_2_5I2R8CertificateIndex a)).output +lemma CB1_2_5I2R8Terms_sound (a : Fin 6) : + (CB1_2_5I2R8Terms a).Encloses (Foundation.entropyTerm (CB1_2_5I2R8Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_2_5I2R8Certificates_valid + (CB1_2_5I2R8CertificateIndex a) (CB1_2_5I2R8P_sound a) +def CB1_2_5I2R8Entropy : Ball := ⟨0, 0⟩ +lemma CB1_2_5I2R8Entropy_sound : CB1_2_5I2R8Entropy.Encloses (Foundation.finiteEntropy CB1_2_5I2R8Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_2_5I2R8Value CB1_2_5I2R8Terms CB1_2_5I2R8Terms_sound) (by decide +kernel) +def CB1_2_5I2R8Mass : Ball := ⟨0, 0⟩ +lemma CB1_2_5I2R8Mass_sound : CB1_2_5I2R8Mass.Encloses (∑ a, CB1_2_5I2R8Value a) := by + exact contains_sound (finSumBall_sound 6 CB1_2_5I2R8P CB1_2_5I2R8Value CB1_2_5I2R8P_sound) (by decide +kernel) +def CB1_2_5I2R8MassTerm : Ball := .exact 0 +lemma CB1_2_5I2R8MassTerm_sound : CB1_2_5I2R8MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_2_5I2R8Value a))) := + entropyTerm_zero_ball (CB1_2_5I2R8Mass_sound) +def CB1_2_5I2R8H : Ball := ⟨0, 0⟩ +lemma CB1_2_5I2R8H_sound : CB1_2_5I2R8H.Encloses (homogeneousEntropy CB1_2_5I2R8Value) := by + exact contains_sound (homogeneous_enclosed CB1_2_5I2R8Value CB1_2_5I2R8MassTerm_sound CB1_2_5I2R8Entropy_sound) (by decide +kernel) +def CB1_2_5I2R9Value (a : Fin 6) : ℝ := residualLaw (below (shape 1 2 5)) (fun u => (stageBLaw (shape 1 2 5) u : ℝ)) (stageBPriority (shape 1 2 5)) 2 (fun u a => (littleLaw (shape 1 2 5) u ((stageBPriority (shape 1 2 5)) 2) a : ℝ)) 9 a +def CB1_2_5I2R9Raw (a : Fin 6) : Ball := residualBall (below (shape 1 2 5)) B1_2_5Law (stageBPriority (shape 1 2 5)) 2 (fun u => B1_2_5Little u ((stageBPriority (shape 1 2 5)) 2)) 9 a +lemma CB1_2_5I2R9Raw_sound (a : Fin 6) : + (CB1_2_5I2R9Raw a).Encloses (CB1_2_5I2R9Value a) := by + exact residualBall_sound_on (below (shape 1 2 5)) B1_2_5Law (fun u => (stageBLaw (shape 1 2 5) u : ℝ)) (stageBPriority (shape 1 2 5)) 2 (fun u => B1_2_5Little u ((stageBPriority (shape 1 2 5)) 2)) (fun u a => (littleLaw (shape 1 2 5) u ((stageBPriority (shape 1 2 5)) 2) a : ℝ)) (fun u _ => B1_2_5Law_sound u) (fun u _ a => B1_2_5Little_sound u ((stageBPriority (shape 1 2 5)) 2) a) 9 a +def CB1_2_5I2R9Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB1_2_5I2R9Certificates_valid : + CB1_2_5I2R9Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_2_5I2R9CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB1_2_5I2R9P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_2_5I2R9Certificates (CB1_2_5I2R9CertificateIndex a)).input +lemma CB1_2_5I2R9P_check : ∀ a : Fin 6, contains (CB1_2_5I2R9Raw a) (CB1_2_5I2R9P a) = true := by + decide +kernel +lemma CB1_2_5I2R9P_sound (a : Fin 6) : + (CB1_2_5I2R9P a).Encloses (CB1_2_5I2R9Value a) := + contains_sound (CB1_2_5I2R9Raw_sound a) (CB1_2_5I2R9P_check a) +def CB1_2_5I2R9Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_2_5I2R9Certificates (CB1_2_5I2R9CertificateIndex a)).output +lemma CB1_2_5I2R9Terms_sound (a : Fin 6) : + (CB1_2_5I2R9Terms a).Encloses (Foundation.entropyTerm (CB1_2_5I2R9Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_2_5I2R9Certificates_valid + (CB1_2_5I2R9CertificateIndex a) (CB1_2_5I2R9P_sound a) +def CB1_2_5I2R9Entropy : Ball := ⟨0, 0⟩ +lemma CB1_2_5I2R9Entropy_sound : CB1_2_5I2R9Entropy.Encloses (Foundation.finiteEntropy CB1_2_5I2R9Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_2_5I2R9Value CB1_2_5I2R9Terms CB1_2_5I2R9Terms_sound) (by decide +kernel) +def CB1_2_5I2R9Mass : Ball := ⟨0, 0⟩ +lemma CB1_2_5I2R9Mass_sound : CB1_2_5I2R9Mass.Encloses (∑ a, CB1_2_5I2R9Value a) := by + exact contains_sound (finSumBall_sound 6 CB1_2_5I2R9P CB1_2_5I2R9Value CB1_2_5I2R9P_sound) (by decide +kernel) +def CB1_2_5I2R9MassTerm : Ball := .exact 0 +lemma CB1_2_5I2R9MassTerm_sound : CB1_2_5I2R9MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_2_5I2R9Value a))) := + entropyTerm_zero_ball (CB1_2_5I2R9Mass_sound) +def CB1_2_5I2R9H : Ball := ⟨0, 0⟩ +lemma CB1_2_5I2R9H_sound : CB1_2_5I2R9H.Encloses (homogeneousEntropy CB1_2_5I2R9Value) := by + exact contains_sound (homogeneous_enclosed CB1_2_5I2R9Value CB1_2_5I2R9MassTerm_sound CB1_2_5I2R9Entropy_sound) (by decide +kernel) +def CB1_2_5I2R10Value (a : Fin 6) : ℝ := residualLaw (below (shape 1 2 5)) (fun u => (stageBLaw (shape 1 2 5) u : ℝ)) (stageBPriority (shape 1 2 5)) 2 (fun u a => (littleLaw (shape 1 2 5) u ((stageBPriority (shape 1 2 5)) 2) a : ℝ)) 10 a +def CB1_2_5I2R10Raw (a : Fin 6) : Ball := residualBall (below (shape 1 2 5)) B1_2_5Law (stageBPriority (shape 1 2 5)) 2 (fun u => B1_2_5Little u ((stageBPriority (shape 1 2 5)) 2)) 10 a +lemma CB1_2_5I2R10Raw_sound (a : Fin 6) : + (CB1_2_5I2R10Raw a).Encloses (CB1_2_5I2R10Value a) := by + exact residualBall_sound_on (below (shape 1 2 5)) B1_2_5Law (fun u => (stageBLaw (shape 1 2 5) u : ℝ)) (stageBPriority (shape 1 2 5)) 2 (fun u => B1_2_5Little u ((stageBPriority (shape 1 2 5)) 2)) (fun u a => (littleLaw (shape 1 2 5) u ((stageBPriority (shape 1 2 5)) 2) a : ℝ)) (fun u _ => B1_2_5Law_sound u) (fun u _ a => B1_2_5Little_sound u ((stageBPriority (shape 1 2 5)) 2) a) 10 a +def CB1_2_5I2R10Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB1_2_5I2R10Certificates_valid : + CB1_2_5I2R10Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_2_5I2R10CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB1_2_5I2R10P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_2_5I2R10Certificates (CB1_2_5I2R10CertificateIndex a)).input +lemma CB1_2_5I2R10P_check : ∀ a : Fin 6, contains (CB1_2_5I2R10Raw a) (CB1_2_5I2R10P a) = true := by + decide +kernel +lemma CB1_2_5I2R10P_sound (a : Fin 6) : + (CB1_2_5I2R10P a).Encloses (CB1_2_5I2R10Value a) := + contains_sound (CB1_2_5I2R10Raw_sound a) (CB1_2_5I2R10P_check a) +def CB1_2_5I2R10Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_2_5I2R10Certificates (CB1_2_5I2R10CertificateIndex a)).output +lemma CB1_2_5I2R10Terms_sound (a : Fin 6) : + (CB1_2_5I2R10Terms a).Encloses (Foundation.entropyTerm (CB1_2_5I2R10Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_2_5I2R10Certificates_valid + (CB1_2_5I2R10CertificateIndex a) (CB1_2_5I2R10P_sound a) +def CB1_2_5I2R10Entropy : Ball := ⟨0, 0⟩ +lemma CB1_2_5I2R10Entropy_sound : CB1_2_5I2R10Entropy.Encloses (Foundation.finiteEntropy CB1_2_5I2R10Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_2_5I2R10Value CB1_2_5I2R10Terms CB1_2_5I2R10Terms_sound) (by decide +kernel) +def CB1_2_5I2R10Mass : Ball := ⟨0, 0⟩ +lemma CB1_2_5I2R10Mass_sound : CB1_2_5I2R10Mass.Encloses (∑ a, CB1_2_5I2R10Value a) := by + exact contains_sound (finSumBall_sound 6 CB1_2_5I2R10P CB1_2_5I2R10Value CB1_2_5I2R10P_sound) (by decide +kernel) +def CB1_2_5I2R10MassTerm : Ball := .exact 0 +lemma CB1_2_5I2R10MassTerm_sound : CB1_2_5I2R10MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_2_5I2R10Value a))) := + entropyTerm_zero_ball (CB1_2_5I2R10Mass_sound) +def CB1_2_5I2R10H : Ball := ⟨0, 0⟩ +lemma CB1_2_5I2R10H_sound : CB1_2_5I2R10H.Encloses (homogeneousEntropy CB1_2_5I2R10Value) := by + exact contains_sound (homogeneous_enclosed CB1_2_5I2R10Value CB1_2_5I2R10MassTerm_sound CB1_2_5I2R10Entropy_sound) (by decide +kernel) +def CB1_2_5I2R11Value (a : Fin 6) : ℝ := residualLaw (below (shape 1 2 5)) (fun u => (stageBLaw (shape 1 2 5) u : ℝ)) (stageBPriority (shape 1 2 5)) 2 (fun u a => (littleLaw (shape 1 2 5) u ((stageBPriority (shape 1 2 5)) 2) a : ℝ)) 11 a +def CB1_2_5I2R11Raw (a : Fin 6) : Ball := residualBall (below (shape 1 2 5)) B1_2_5Law (stageBPriority (shape 1 2 5)) 2 (fun u => B1_2_5Little u ((stageBPriority (shape 1 2 5)) 2)) 11 a +lemma CB1_2_5I2R11Raw_sound (a : Fin 6) : + (CB1_2_5I2R11Raw a).Encloses (CB1_2_5I2R11Value a) := by + exact residualBall_sound_on (below (shape 1 2 5)) B1_2_5Law (fun u => (stageBLaw (shape 1 2 5) u : ℝ)) (stageBPriority (shape 1 2 5)) 2 (fun u => B1_2_5Little u ((stageBPriority (shape 1 2 5)) 2)) (fun u a => (littleLaw (shape 1 2 5) u ((stageBPriority (shape 1 2 5)) 2) a : ℝ)) (fun u _ => B1_2_5Law_sound u) (fun u _ a => B1_2_5Little_sound u ((stageBPriority (shape 1 2 5)) 2) a) 11 a +def CB1_2_5I2R11Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB1_2_5I2R11Certificates_valid : + CB1_2_5I2R11Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_2_5I2R11CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB1_2_5I2R11P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_2_5I2R11Certificates (CB1_2_5I2R11CertificateIndex a)).input +lemma CB1_2_5I2R11P_check : ∀ a : Fin 6, contains (CB1_2_5I2R11Raw a) (CB1_2_5I2R11P a) = true := by + decide +kernel +lemma CB1_2_5I2R11P_sound (a : Fin 6) : + (CB1_2_5I2R11P a).Encloses (CB1_2_5I2R11Value a) := + contains_sound (CB1_2_5I2R11Raw_sound a) (CB1_2_5I2R11P_check a) +def CB1_2_5I2R11Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_2_5I2R11Certificates (CB1_2_5I2R11CertificateIndex a)).output +lemma CB1_2_5I2R11Terms_sound (a : Fin 6) : + (CB1_2_5I2R11Terms a).Encloses (Foundation.entropyTerm (CB1_2_5I2R11Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_2_5I2R11Certificates_valid + (CB1_2_5I2R11CertificateIndex a) (CB1_2_5I2R11P_sound a) +def CB1_2_5I2R11Entropy : Ball := ⟨0, 0⟩ +lemma CB1_2_5I2R11Entropy_sound : CB1_2_5I2R11Entropy.Encloses (Foundation.finiteEntropy CB1_2_5I2R11Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_2_5I2R11Value CB1_2_5I2R11Terms CB1_2_5I2R11Terms_sound) (by decide +kernel) +def CB1_2_5I2R11Mass : Ball := ⟨0, 0⟩ +lemma CB1_2_5I2R11Mass_sound : CB1_2_5I2R11Mass.Encloses (∑ a, CB1_2_5I2R11Value a) := by + exact contains_sound (finSumBall_sound 6 CB1_2_5I2R11P CB1_2_5I2R11Value CB1_2_5I2R11P_sound) (by decide +kernel) +def CB1_2_5I2R11MassTerm : Ball := .exact 0 +lemma CB1_2_5I2R11MassTerm_sound : CB1_2_5I2R11MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_2_5I2R11Value a))) := + entropyTerm_zero_ball (CB1_2_5I2R11Mass_sound) +def CB1_2_5I2R11H : Ball := ⟨0, 0⟩ +lemma CB1_2_5I2R11H_sound : CB1_2_5I2R11H.Encloses (homogeneousEntropy CB1_2_5I2R11Value) := by + exact contains_sound (homogeneous_enclosed CB1_2_5I2R11Value CB1_2_5I2R11MassTerm_sound CB1_2_5I2R11Entropy_sound) (by decide +kernel) +def CB1_2_5I2R12Value (a : Fin 6) : ℝ := residualLaw (below (shape 1 2 5)) (fun u => (stageBLaw (shape 1 2 5) u : ℝ)) (stageBPriority (shape 1 2 5)) 2 (fun u a => (littleLaw (shape 1 2 5) u ((stageBPriority (shape 1 2 5)) 2) a : ℝ)) 12 a +def CB1_2_5I2R12Raw (a : Fin 6) : Ball := residualBall (below (shape 1 2 5)) B1_2_5Law (stageBPriority (shape 1 2 5)) 2 (fun u => B1_2_5Little u ((stageBPriority (shape 1 2 5)) 2)) 12 a +lemma CB1_2_5I2R12Raw_sound (a : Fin 6) : + (CB1_2_5I2R12Raw a).Encloses (CB1_2_5I2R12Value a) := by + exact residualBall_sound_on (below (shape 1 2 5)) B1_2_5Law (fun u => (stageBLaw (shape 1 2 5) u : ℝ)) (stageBPriority (shape 1 2 5)) 2 (fun u => B1_2_5Little u ((stageBPriority (shape 1 2 5)) 2)) (fun u a => (littleLaw (shape 1 2 5) u ((stageBPriority (shape 1 2 5)) 2) a : ℝ)) (fun u _ => B1_2_5Law_sound u) (fun u _ a => B1_2_5Little_sound u ((stageBPriority (shape 1 2 5)) 2) a) 12 a +def CB1_2_5I2R12Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB1_2_5I2R12Certificates_valid : + CB1_2_5I2R12Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_2_5I2R12CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB1_2_5I2R12P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_2_5I2R12Certificates (CB1_2_5I2R12CertificateIndex a)).input +lemma CB1_2_5I2R12P_check : ∀ a : Fin 6, contains (CB1_2_5I2R12Raw a) (CB1_2_5I2R12P a) = true := by + decide +kernel +lemma CB1_2_5I2R12P_sound (a : Fin 6) : + (CB1_2_5I2R12P a).Encloses (CB1_2_5I2R12Value a) := + contains_sound (CB1_2_5I2R12Raw_sound a) (CB1_2_5I2R12P_check a) +def CB1_2_5I2R12Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_2_5I2R12Certificates (CB1_2_5I2R12CertificateIndex a)).output +lemma CB1_2_5I2R12Terms_sound (a : Fin 6) : + (CB1_2_5I2R12Terms a).Encloses (Foundation.entropyTerm (CB1_2_5I2R12Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_2_5I2R12Certificates_valid + (CB1_2_5I2R12CertificateIndex a) (CB1_2_5I2R12P_sound a) +def CB1_2_5I2R12Entropy : Ball := ⟨0, 0⟩ +lemma CB1_2_5I2R12Entropy_sound : CB1_2_5I2R12Entropy.Encloses (Foundation.finiteEntropy CB1_2_5I2R12Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_2_5I2R12Value CB1_2_5I2R12Terms CB1_2_5I2R12Terms_sound) (by decide +kernel) +def CB1_2_5I2R12Mass : Ball := ⟨0, 0⟩ +lemma CB1_2_5I2R12Mass_sound : CB1_2_5I2R12Mass.Encloses (∑ a, CB1_2_5I2R12Value a) := by + exact contains_sound (finSumBall_sound 6 CB1_2_5I2R12P CB1_2_5I2R12Value CB1_2_5I2R12P_sound) (by decide +kernel) +def CB1_2_5I2R12MassTerm : Ball := .exact 0 +lemma CB1_2_5I2R12MassTerm_sound : CB1_2_5I2R12MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_2_5I2R12Value a))) := + entropyTerm_zero_ball (CB1_2_5I2R12Mass_sound) +def CB1_2_5I2R12H : Ball := ⟨0, 0⟩ +lemma CB1_2_5I2R12H_sound : CB1_2_5I2R12H.Encloses (homogeneousEntropy CB1_2_5I2R12Value) := by + exact contains_sound (homogeneous_enclosed CB1_2_5I2R12Value CB1_2_5I2R12MassTerm_sound CB1_2_5I2R12Entropy_sound) (by decide +kernel) +def CB1_2_5I2R13Value (a : Fin 6) : ℝ := residualLaw (below (shape 1 2 5)) (fun u => (stageBLaw (shape 1 2 5) u : ℝ)) (stageBPriority (shape 1 2 5)) 2 (fun u a => (littleLaw (shape 1 2 5) u ((stageBPriority (shape 1 2 5)) 2) a : ℝ)) 13 a +def CB1_2_5I2R13Raw (a : Fin 6) : Ball := residualBall (below (shape 1 2 5)) B1_2_5Law (stageBPriority (shape 1 2 5)) 2 (fun u => B1_2_5Little u ((stageBPriority (shape 1 2 5)) 2)) 13 a +lemma CB1_2_5I2R13Raw_sound (a : Fin 6) : + (CB1_2_5I2R13Raw a).Encloses (CB1_2_5I2R13Value a) := by + exact residualBall_sound_on (below (shape 1 2 5)) B1_2_5Law (fun u => (stageBLaw (shape 1 2 5) u : ℝ)) (stageBPriority (shape 1 2 5)) 2 (fun u => B1_2_5Little u ((stageBPriority (shape 1 2 5)) 2)) (fun u a => (littleLaw (shape 1 2 5) u ((stageBPriority (shape 1 2 5)) 2) a : ℝ)) (fun u _ => B1_2_5Law_sound u) (fun u _ a => B1_2_5Little_sound u ((stageBPriority (shape 1 2 5)) 2) a) 13 a +def CB1_2_5I2R13Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB1_2_5I2R13Certificates_valid : + CB1_2_5I2R13Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_2_5I2R13CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB1_2_5I2R13P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_2_5I2R13Certificates (CB1_2_5I2R13CertificateIndex a)).input +lemma CB1_2_5I2R13P_check : ∀ a : Fin 6, contains (CB1_2_5I2R13Raw a) (CB1_2_5I2R13P a) = true := by + decide +kernel +lemma CB1_2_5I2R13P_sound (a : Fin 6) : + (CB1_2_5I2R13P a).Encloses (CB1_2_5I2R13Value a) := + contains_sound (CB1_2_5I2R13Raw_sound a) (CB1_2_5I2R13P_check a) +def CB1_2_5I2R13Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_2_5I2R13Certificates (CB1_2_5I2R13CertificateIndex a)).output +lemma CB1_2_5I2R13Terms_sound (a : Fin 6) : + (CB1_2_5I2R13Terms a).Encloses (Foundation.entropyTerm (CB1_2_5I2R13Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_2_5I2R13Certificates_valid + (CB1_2_5I2R13CertificateIndex a) (CB1_2_5I2R13P_sound a) +def CB1_2_5I2R13Entropy : Ball := ⟨0, 0⟩ +lemma CB1_2_5I2R13Entropy_sound : CB1_2_5I2R13Entropy.Encloses (Foundation.finiteEntropy CB1_2_5I2R13Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_2_5I2R13Value CB1_2_5I2R13Terms CB1_2_5I2R13Terms_sound) (by decide +kernel) +def CB1_2_5I2R13Mass : Ball := ⟨0, 0⟩ +lemma CB1_2_5I2R13Mass_sound : CB1_2_5I2R13Mass.Encloses (∑ a, CB1_2_5I2R13Value a) := by + exact contains_sound (finSumBall_sound 6 CB1_2_5I2R13P CB1_2_5I2R13Value CB1_2_5I2R13P_sound) (by decide +kernel) +def CB1_2_5I2R13MassTerm : Ball := .exact 0 +lemma CB1_2_5I2R13MassTerm_sound : CB1_2_5I2R13MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_2_5I2R13Value a))) := + entropyTerm_zero_ball (CB1_2_5I2R13Mass_sound) +def CB1_2_5I2R13H : Ball := ⟨0, 0⟩ +lemma CB1_2_5I2R13H_sound : CB1_2_5I2R13H.Encloses (homogeneousEntropy CB1_2_5I2R13Value) := by + exact contains_sound (homogeneous_enclosed CB1_2_5I2R13Value CB1_2_5I2R13MassTerm_sound CB1_2_5I2R13Entropy_sound) (by decide +kernel) +def CB1_2_5I2R14Value (a : Fin 6) : ℝ := residualLaw (below (shape 1 2 5)) (fun u => (stageBLaw (shape 1 2 5) u : ℝ)) (stageBPriority (shape 1 2 5)) 2 (fun u a => (littleLaw (shape 1 2 5) u ((stageBPriority (shape 1 2 5)) 2) a : ℝ)) 14 a +def CB1_2_5I2R14Raw (a : Fin 6) : Ball := residualBall (below (shape 1 2 5)) B1_2_5Law (stageBPriority (shape 1 2 5)) 2 (fun u => B1_2_5Little u ((stageBPriority (shape 1 2 5)) 2)) 14 a +lemma CB1_2_5I2R14Raw_sound (a : Fin 6) : + (CB1_2_5I2R14Raw a).Encloses (CB1_2_5I2R14Value a) := by + exact residualBall_sound_on (below (shape 1 2 5)) B1_2_5Law (fun u => (stageBLaw (shape 1 2 5) u : ℝ)) (stageBPriority (shape 1 2 5)) 2 (fun u => B1_2_5Little u ((stageBPriority (shape 1 2 5)) 2)) (fun u a => (littleLaw (shape 1 2 5) u ((stageBPriority (shape 1 2 5)) 2) a : ℝ)) (fun u _ => B1_2_5Law_sound u) (fun u _ a => B1_2_5Little_sound u ((stageBPriority (shape 1 2 5)) 2) a) 14 a +def CB1_2_5I2R14Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB1_2_5I2R14Certificates_valid : + CB1_2_5I2R14Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_2_5I2R14CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB1_2_5I2R14P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_2_5I2R14Certificates (CB1_2_5I2R14CertificateIndex a)).input +lemma CB1_2_5I2R14P_check : ∀ a : Fin 6, contains (CB1_2_5I2R14Raw a) (CB1_2_5I2R14P a) = true := by + decide +kernel +lemma CB1_2_5I2R14P_sound (a : Fin 6) : + (CB1_2_5I2R14P a).Encloses (CB1_2_5I2R14Value a) := + contains_sound (CB1_2_5I2R14Raw_sound a) (CB1_2_5I2R14P_check a) +def CB1_2_5I2R14Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_2_5I2R14Certificates (CB1_2_5I2R14CertificateIndex a)).output +lemma CB1_2_5I2R14Terms_sound (a : Fin 6) : + (CB1_2_5I2R14Terms a).Encloses (Foundation.entropyTerm (CB1_2_5I2R14Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_2_5I2R14Certificates_valid + (CB1_2_5I2R14CertificateIndex a) (CB1_2_5I2R14P_sound a) +def CB1_2_5I2R14Entropy : Ball := ⟨0, 0⟩ +lemma CB1_2_5I2R14Entropy_sound : CB1_2_5I2R14Entropy.Encloses (Foundation.finiteEntropy CB1_2_5I2R14Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_2_5I2R14Value CB1_2_5I2R14Terms CB1_2_5I2R14Terms_sound) (by decide +kernel) +def CB1_2_5I2R14Mass : Ball := ⟨0, 0⟩ +lemma CB1_2_5I2R14Mass_sound : CB1_2_5I2R14Mass.Encloses (∑ a, CB1_2_5I2R14Value a) := by + exact contains_sound (finSumBall_sound 6 CB1_2_5I2R14P CB1_2_5I2R14Value CB1_2_5I2R14P_sound) (by decide +kernel) +def CB1_2_5I2R14MassTerm : Ball := .exact 0 +lemma CB1_2_5I2R14MassTerm_sound : CB1_2_5I2R14MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_2_5I2R14Value a))) := + entropyTerm_zero_ball (CB1_2_5I2R14Mass_sound) +def CB1_2_5I2R14H : Ball := ⟨0, 0⟩ +lemma CB1_2_5I2R14H_sound : CB1_2_5I2R14H.Encloses (homogeneousEntropy CB1_2_5I2R14Value) := by + exact contains_sound (homogeneous_enclosed CB1_2_5I2R14Value CB1_2_5I2R14MassTerm_sound CB1_2_5I2R14Entropy_sound) (by decide +kernel) +def CB1_2_5I2R15Value (a : Fin 6) : ℝ := residualLaw (below (shape 1 2 5)) (fun u => (stageBLaw (shape 1 2 5) u : ℝ)) (stageBPriority (shape 1 2 5)) 2 (fun u a => (littleLaw (shape 1 2 5) u ((stageBPriority (shape 1 2 5)) 2) a : ℝ)) 15 a +def CB1_2_5I2R15Raw (a : Fin 6) : Ball := residualBall (below (shape 1 2 5)) B1_2_5Law (stageBPriority (shape 1 2 5)) 2 (fun u => B1_2_5Little u ((stageBPriority (shape 1 2 5)) 2)) 15 a +lemma CB1_2_5I2R15Raw_sound (a : Fin 6) : + (CB1_2_5I2R15Raw a).Encloses (CB1_2_5I2R15Value a) := by + exact residualBall_sound_on (below (shape 1 2 5)) B1_2_5Law (fun u => (stageBLaw (shape 1 2 5) u : ℝ)) (stageBPriority (shape 1 2 5)) 2 (fun u => B1_2_5Little u ((stageBPriority (shape 1 2 5)) 2)) (fun u a => (littleLaw (shape 1 2 5) u ((stageBPriority (shape 1 2 5)) 2) a : ℝ)) (fun u _ => B1_2_5Law_sound u) (fun u _ a => B1_2_5Little_sound u ((stageBPriority (shape 1 2 5)) 2) a) 15 a +def CB1_2_5I2R15Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB1_2_5I2R15Certificates_valid : + CB1_2_5I2R15Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_2_5I2R15CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB1_2_5I2R15P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_2_5I2R15Certificates (CB1_2_5I2R15CertificateIndex a)).input +lemma CB1_2_5I2R15P_check : ∀ a : Fin 6, contains (CB1_2_5I2R15Raw a) (CB1_2_5I2R15P a) = true := by + decide +kernel +lemma CB1_2_5I2R15P_sound (a : Fin 6) : + (CB1_2_5I2R15P a).Encloses (CB1_2_5I2R15Value a) := + contains_sound (CB1_2_5I2R15Raw_sound a) (CB1_2_5I2R15P_check a) +def CB1_2_5I2R15Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_2_5I2R15Certificates (CB1_2_5I2R15CertificateIndex a)).output +lemma CB1_2_5I2R15Terms_sound (a : Fin 6) : + (CB1_2_5I2R15Terms a).Encloses (Foundation.entropyTerm (CB1_2_5I2R15Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_2_5I2R15Certificates_valid + (CB1_2_5I2R15CertificateIndex a) (CB1_2_5I2R15P_sound a) +def CB1_2_5I2R15Entropy : Ball := ⟨0, 0⟩ +lemma CB1_2_5I2R15Entropy_sound : CB1_2_5I2R15Entropy.Encloses (Foundation.finiteEntropy CB1_2_5I2R15Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_2_5I2R15Value CB1_2_5I2R15Terms CB1_2_5I2R15Terms_sound) (by decide +kernel) +def CB1_2_5I2R15Mass : Ball := ⟨0, 0⟩ +lemma CB1_2_5I2R15Mass_sound : CB1_2_5I2R15Mass.Encloses (∑ a, CB1_2_5I2R15Value a) := by + exact contains_sound (finSumBall_sound 6 CB1_2_5I2R15P CB1_2_5I2R15Value CB1_2_5I2R15P_sound) (by decide +kernel) +def CB1_2_5I2R15MassTerm : Ball := .exact 0 +lemma CB1_2_5I2R15MassTerm_sound : CB1_2_5I2R15MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_2_5I2R15Value a))) := + entropyTerm_zero_ball (CB1_2_5I2R15Mass_sound) +def CB1_2_5I2R15H : Ball := ⟨0, 0⟩ +lemma CB1_2_5I2R15H_sound : CB1_2_5I2R15H.Encloses (homogeneousEntropy CB1_2_5I2R15Value) := by + exact contains_sound (homogeneous_enclosed CB1_2_5I2R15Value CB1_2_5I2R15MassTerm_sound CB1_2_5I2R15Entropy_sound) (by decide +kernel) +def CB1_2_5I2R16Value (a : Fin 6) : ℝ := residualLaw (below (shape 1 2 5)) (fun u => (stageBLaw (shape 1 2 5) u : ℝ)) (stageBPriority (shape 1 2 5)) 2 (fun u a => (littleLaw (shape 1 2 5) u ((stageBPriority (shape 1 2 5)) 2) a : ℝ)) 16 a +def CB1_2_5I2R16Raw (a : Fin 6) : Ball := residualBall (below (shape 1 2 5)) B1_2_5Law (stageBPriority (shape 1 2 5)) 2 (fun u => B1_2_5Little u ((stageBPriority (shape 1 2 5)) 2)) 16 a +lemma CB1_2_5I2R16Raw_sound (a : Fin 6) : + (CB1_2_5I2R16Raw a).Encloses (CB1_2_5I2R16Value a) := by + exact residualBall_sound_on (below (shape 1 2 5)) B1_2_5Law (fun u => (stageBLaw (shape 1 2 5) u : ℝ)) (stageBPriority (shape 1 2 5)) 2 (fun u => B1_2_5Little u ((stageBPriority (shape 1 2 5)) 2)) (fun u a => (littleLaw (shape 1 2 5) u ((stageBPriority (shape 1 2 5)) 2) a : ℝ)) (fun u _ => B1_2_5Law_sound u) (fun u _ a => B1_2_5Little_sound u ((stageBPriority (shape 1 2 5)) 2) a) 16 a +def CB1_2_5I2R16Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB1_2_5I2R16Certificates_valid : + CB1_2_5I2R16Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_2_5I2R16CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB1_2_5I2R16P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_2_5I2R16Certificates (CB1_2_5I2R16CertificateIndex a)).input +lemma CB1_2_5I2R16P_check : ∀ a : Fin 6, contains (CB1_2_5I2R16Raw a) (CB1_2_5I2R16P a) = true := by + decide +kernel +lemma CB1_2_5I2R16P_sound (a : Fin 6) : + (CB1_2_5I2R16P a).Encloses (CB1_2_5I2R16Value a) := + contains_sound (CB1_2_5I2R16Raw_sound a) (CB1_2_5I2R16P_check a) +def CB1_2_5I2R16Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_2_5I2R16Certificates (CB1_2_5I2R16CertificateIndex a)).output +lemma CB1_2_5I2R16Terms_sound (a : Fin 6) : + (CB1_2_5I2R16Terms a).Encloses (Foundation.entropyTerm (CB1_2_5I2R16Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_2_5I2R16Certificates_valid + (CB1_2_5I2R16CertificateIndex a) (CB1_2_5I2R16P_sound a) +def CB1_2_5I2R16Entropy : Ball := ⟨0, 0⟩ +lemma CB1_2_5I2R16Entropy_sound : CB1_2_5I2R16Entropy.Encloses (Foundation.finiteEntropy CB1_2_5I2R16Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_2_5I2R16Value CB1_2_5I2R16Terms CB1_2_5I2R16Terms_sound) (by decide +kernel) +def CB1_2_5I2R16Mass : Ball := ⟨0, 0⟩ +lemma CB1_2_5I2R16Mass_sound : CB1_2_5I2R16Mass.Encloses (∑ a, CB1_2_5I2R16Value a) := by + exact contains_sound (finSumBall_sound 6 CB1_2_5I2R16P CB1_2_5I2R16Value CB1_2_5I2R16P_sound) (by decide +kernel) +def CB1_2_5I2R16MassTerm : Ball := .exact 0 +lemma CB1_2_5I2R16MassTerm_sound : CB1_2_5I2R16MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_2_5I2R16Value a))) := + entropyTerm_zero_ball (CB1_2_5I2R16Mass_sound) +def CB1_2_5I2R16H : Ball := ⟨0, 0⟩ +lemma CB1_2_5I2R16H_sound : CB1_2_5I2R16H.Encloses (homogeneousEntropy CB1_2_5I2R16Value) := by + exact contains_sound (homogeneous_enclosed CB1_2_5I2R16Value CB1_2_5I2R16MassTerm_sound CB1_2_5I2R16Entropy_sound) (by decide +kernel) +def CB1_2_5I2ResidualEntropies (a : Fin 17) : Ball := + match a.val with + | 0 => CB1_2_5I2R0H + | 1 => CB1_2_5I2R1H + | 2 => CB1_2_5I2R2H + | 3 => CB1_2_5I2R3H + | 4 => CB1_2_5I2R4H + | 5 => CB1_2_5I2R5H + | 6 => CB1_2_5I2R6H + | 7 => CB1_2_5I2R7H + | 8 => CB1_2_5I2R8H + | 9 => CB1_2_5I2R9H + | 10 => CB1_2_5I2R10H + | 11 => CB1_2_5I2R11H + | 12 => CB1_2_5I2R12H + | 13 => CB1_2_5I2R13H + | 14 => CB1_2_5I2R14H + | 15 => CB1_2_5I2R15H + | 16 => CB1_2_5I2R16H + | _ => (.exact 0) +lemma CB1_2_5I2ResidualEntropies_sound (k : Fin 17) : + (CB1_2_5I2ResidualEntropies k).Encloses (homogeneousEntropy + (residualLaw (below (shape 1 2 5)) (fun u => (stageBLaw (shape 1 2 5) u : ℝ)) (stageBPriority (shape 1 2 5)) 2 (fun u a => (littleLaw (shape 1 2 5) u ((stageBPriority (shape 1 2 5)) 2) a : ℝ)) k)) := by + fin_cases k + · exact CB1_2_5I2R0H_sound + · exact CB1_2_5I2R1H_sound + · exact CB1_2_5I2R2H_sound + · exact CB1_2_5I2R3H_sound + · exact CB1_2_5I2R4H_sound + · exact CB1_2_5I2R5H_sound + · exact CB1_2_5I2R6H_sound + · exact CB1_2_5I2R7H_sound + · exact CB1_2_5I2R8H_sound + · exact CB1_2_5I2R9H_sound + · exact CB1_2_5I2R10H_sound + · exact CB1_2_5I2R11H_sound + · exact CB1_2_5I2R12H_sound + · exact CB1_2_5I2R13H_sound + · exact CB1_2_5I2R14H_sound + · exact CB1_2_5I2R15H_sound + · exact CB1_2_5I2R16H_sound +def CB1_2_5I2S0_0_4Value (a : Fin 6) : ℝ := (littleLaw (shape 1 2 5) (shape 0 0 4) ((stageBPriority (shape 1 2 5)) 2) a : ℝ) +def CB1_2_5I2S0_0_4E_5Log : Ball := .exact 0 +lemma CB1_2_5I2S0_0_4E_5Log_sound : CB1_2_5I2S0_0_4E_5Log.Encloses (Real.log (CB1_2_5I2S0_0_4Value (5 : Fin 6))) := by + exact log_exact_one_ball ((B1_2_5Little_sound (shape 0 0 4) ((stageBPriority (shape 1 2 5)) 2)) (5 : Fin 6)) +def CB1_2_5I2S0_0_4E_5 : Ball := ⟨0, 0⟩ +lemma CB1_2_5I2S0_0_4E_5_sound : CB1_2_5I2S0_0_4E_5.Encloses (Foundation.entropyTerm (CB1_2_5I2S0_0_4Value (5 : Fin 6))) := by + exact contains_sound (entropyTerm_ball ((B1_2_5Little_sound (shape 0 0 4) ((stageBPriority (shape 1 2 5)) 2)) (5 : Fin 6)) CB1_2_5I2S0_0_4E_5Log_sound) (by decide +kernel) +def CB1_2_5I2S0_0_4Terms (a : Fin 6) : Ball := + match a.val with + | 5 => ⟨0, 0⟩ + | _ => (.exact 0) +lemma CB1_2_5I2S0_0_4Terms_sound (a : Fin 6) : + (CB1_2_5I2S0_0_4Terms a).Encloses (Foundation.entropyTerm (CB1_2_5I2S0_0_4Value a)) := by + fin_cases a + · exact (entropyTerm_zero_ball ((B1_2_5Little_sound (shape 0 0 4) ((stageBPriority (shape 1 2 5)) 2)) (0 : Fin 6))) + · exact (entropyTerm_zero_ball ((B1_2_5Little_sound (shape 0 0 4) ((stageBPriority (shape 1 2 5)) 2)) (1 : Fin 6))) + · exact (entropyTerm_zero_ball ((B1_2_5Little_sound (shape 0 0 4) ((stageBPriority (shape 1 2 5)) 2)) (2 : Fin 6))) + · exact (entropyTerm_zero_ball ((B1_2_5Little_sound (shape 0 0 4) ((stageBPriority (shape 1 2 5)) 2)) (3 : Fin 6))) + · exact (entropyTerm_zero_ball ((B1_2_5Little_sound (shape 0 0 4) ((stageBPriority (shape 1 2 5)) 2)) (4 : Fin 6))) + · exact CB1_2_5I2S0_0_4E_5_sound +def CB1_2_5I2S0_0_4Entropy : Ball := ⟨0, 0⟩ +lemma CB1_2_5I2S0_0_4Entropy_sound : CB1_2_5I2S0_0_4Entropy.Encloses (Foundation.finiteEntropy CB1_2_5I2S0_0_4Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_2_5I2S0_0_4Value CB1_2_5I2S0_0_4Terms CB1_2_5I2S0_0_4Terms_sound) (by decide +kernel) +def CB1_2_5I2S0_0_4Mass : Ball := ⟨1, 0⟩ +lemma CB1_2_5I2S0_0_4Mass_sound : CB1_2_5I2S0_0_4Mass.Encloses (∑ a, CB1_2_5I2S0_0_4Value a) := by + exact contains_sound (finSumBall_sound 6 (B1_2_5Little (shape 0 0 4) ((stageBPriority (shape 1 2 5)) 2)) CB1_2_5I2S0_0_4Value (B1_2_5Little_sound (shape 0 0 4) ((stageBPriority (shape 1 2 5)) 2))) (by decide +kernel) +def CB1_2_5I2S0_0_4MassTermLog : Ball := .exact 0 +lemma CB1_2_5I2S0_0_4MassTermLog_sound : CB1_2_5I2S0_0_4MassTermLog.Encloses (Real.log ((∑ a, CB1_2_5I2S0_0_4Value a))) := by + exact log_exact_one_ball (CB1_2_5I2S0_0_4Mass_sound) +def CB1_2_5I2S0_0_4MassTerm : Ball := ⟨0, 0⟩ +lemma CB1_2_5I2S0_0_4MassTerm_sound : CB1_2_5I2S0_0_4MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_2_5I2S0_0_4Value a))) := by + exact contains_sound (entropyTerm_ball (CB1_2_5I2S0_0_4Mass_sound) CB1_2_5I2S0_0_4MassTermLog_sound) (by decide +kernel) +def CB1_2_5I2S0_0_4H : Ball := ⟨0, 0⟩ +lemma CB1_2_5I2S0_0_4H_sound : CB1_2_5I2S0_0_4H.Encloses (homogeneousEntropy CB1_2_5I2S0_0_4Value) := by + exact contains_sound (homogeneous_enclosed CB1_2_5I2S0_0_4Value CB1_2_5I2S0_0_4MassTerm_sound CB1_2_5I2S0_0_4Entropy_sound) (by decide +kernel) +def CB1_2_5I2S0_1_3Value (a : Fin 6) : ℝ := (littleLaw (shape 1 2 5) (shape 0 1 3) ((stageBPriority (shape 1 2 5)) 2) a : ℝ) +def CB1_2_5I2S0_1_3E_4Log : Ball := .exact 0 +lemma CB1_2_5I2S0_1_3E_4Log_sound : CB1_2_5I2S0_1_3E_4Log.Encloses (Real.log (CB1_2_5I2S0_1_3Value (4 : Fin 6))) := by + exact log_exact_one_ball ((B1_2_5Little_sound (shape 0 1 3) ((stageBPriority (shape 1 2 5)) 2)) (4 : Fin 6)) +def CB1_2_5I2S0_1_3E_4 : Ball := ⟨0, 0⟩ +lemma CB1_2_5I2S0_1_3E_4_sound : CB1_2_5I2S0_1_3E_4.Encloses (Foundation.entropyTerm (CB1_2_5I2S0_1_3Value (4 : Fin 6))) := by + exact contains_sound (entropyTerm_ball ((B1_2_5Little_sound (shape 0 1 3) ((stageBPriority (shape 1 2 5)) 2)) (4 : Fin 6)) CB1_2_5I2S0_1_3E_4Log_sound) (by decide +kernel) +def CB1_2_5I2S0_1_3Terms (a : Fin 6) : Ball := + match a.val with + | 4 => ⟨0, 0⟩ + | _ => (.exact 0) +lemma CB1_2_5I2S0_1_3Terms_sound (a : Fin 6) : + (CB1_2_5I2S0_1_3Terms a).Encloses (Foundation.entropyTerm (CB1_2_5I2S0_1_3Value a)) := by + fin_cases a + · exact (entropyTerm_zero_ball ((B1_2_5Little_sound (shape 0 1 3) ((stageBPriority (shape 1 2 5)) 2)) (0 : Fin 6))) + · exact (entropyTerm_zero_ball ((B1_2_5Little_sound (shape 0 1 3) ((stageBPriority (shape 1 2 5)) 2)) (1 : Fin 6))) + · exact (entropyTerm_zero_ball ((B1_2_5Little_sound (shape 0 1 3) ((stageBPriority (shape 1 2 5)) 2)) (2 : Fin 6))) + · exact (entropyTerm_zero_ball ((B1_2_5Little_sound (shape 0 1 3) ((stageBPriority (shape 1 2 5)) 2)) (3 : Fin 6))) + · exact CB1_2_5I2S0_1_3E_4_sound + · exact (entropyTerm_zero_ball ((B1_2_5Little_sound (shape 0 1 3) ((stageBPriority (shape 1 2 5)) 2)) (5 : Fin 6))) +def CB1_2_5I2S0_1_3Entropy : Ball := ⟨0, 0⟩ +lemma CB1_2_5I2S0_1_3Entropy_sound : CB1_2_5I2S0_1_3Entropy.Encloses (Foundation.finiteEntropy CB1_2_5I2S0_1_3Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_2_5I2S0_1_3Value CB1_2_5I2S0_1_3Terms CB1_2_5I2S0_1_3Terms_sound) (by decide +kernel) +def CB1_2_5I2S0_1_3Mass : Ball := ⟨1, 0⟩ +lemma CB1_2_5I2S0_1_3Mass_sound : CB1_2_5I2S0_1_3Mass.Encloses (∑ a, CB1_2_5I2S0_1_3Value a) := by + exact contains_sound (finSumBall_sound 6 (B1_2_5Little (shape 0 1 3) ((stageBPriority (shape 1 2 5)) 2)) CB1_2_5I2S0_1_3Value (B1_2_5Little_sound (shape 0 1 3) ((stageBPriority (shape 1 2 5)) 2))) (by decide +kernel) +def CB1_2_5I2S0_1_3MassTermLog : Ball := .exact 0 +lemma CB1_2_5I2S0_1_3MassTermLog_sound : CB1_2_5I2S0_1_3MassTermLog.Encloses (Real.log ((∑ a, CB1_2_5I2S0_1_3Value a))) := by + exact log_exact_one_ball (CB1_2_5I2S0_1_3Mass_sound) +def CB1_2_5I2S0_1_3MassTerm : Ball := ⟨0, 0⟩ +lemma CB1_2_5I2S0_1_3MassTerm_sound : CB1_2_5I2S0_1_3MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_2_5I2S0_1_3Value a))) := by + exact contains_sound (entropyTerm_ball (CB1_2_5I2S0_1_3Mass_sound) CB1_2_5I2S0_1_3MassTermLog_sound) (by decide +kernel) +def CB1_2_5I2S0_1_3H : Ball := ⟨0, 0⟩ +lemma CB1_2_5I2S0_1_3H_sound : CB1_2_5I2S0_1_3H.Encloses (homogeneousEntropy CB1_2_5I2S0_1_3Value) := by + exact contains_sound (homogeneous_enclosed CB1_2_5I2S0_1_3Value CB1_2_5I2S0_1_3MassTerm_sound CB1_2_5I2S0_1_3Entropy_sound) (by decide +kernel) +def CB1_2_5I2S0_2_2Value (a : Fin 6) : ℝ := (littleLaw (shape 1 2 5) (shape 0 2 2) ((stageBPriority (shape 1 2 5)) 2) a : ℝ) +def CB1_2_5I2S0_2_2E_2LogWitness : LogWitness := ⟨-1, 180469, 100000⟩ +def CB1_2_5I2S0_2_2E_2Log : Ball := ⟨(-2568958716933578869052947578733 / 25000000000000000000000000000000), (21175823683 / 50000000000000000000000000000000)⟩ +lemma CB1_2_5I2S0_2_2E_2Log_sound : CB1_2_5I2S0_2_2E_2Log.Encloses (Real.log (CB1_2_5I2S0_2_2Value (2 : Fin 6))) := by + exact checkLog_sound logTwoBall_sound ((B1_2_5Little_sound (shape 0 2 2) ((stageBPriority (shape 1 2 5)) 2)) (2 : Fin 6)) (w := CB1_2_5I2S0_2_2E_2LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB1_2_5I2S0_2_2E_2 : Ball := ⟨(9272348213725720898382327931727 / 100000000000000000000000000000000), (38215797243 / 100000000000000000000000000000000)⟩ +lemma CB1_2_5I2S0_2_2E_2_sound : CB1_2_5I2S0_2_2E_2.Encloses (Foundation.entropyTerm (CB1_2_5I2S0_2_2Value (2 : Fin 6))) := by + exact contains_sound (entropyTerm_ball ((B1_2_5Little_sound (shape 0 2 2) ((stageBPriority (shape 1 2 5)) 2)) (2 : Fin 6)) CB1_2_5I2S0_2_2E_2Log_sound) (by decide +kernel) +def CB1_2_5I2S0_2_2E_3LogWitness : LogWitness := ⟨-4, 19531, 12500⟩ +def CB1_2_5I2S0_2_2E_3Log : Ball := ⟨(-232631441969328242519371516318041 / 100000000000000000000000000000000), (21175823683 / 20000000000000000000000000000000)⟩ +lemma CB1_2_5I2S0_2_2E_3Log_sound : CB1_2_5I2S0_2_2E_3Log.Encloses (Real.log (CB1_2_5I2S0_2_2Value (3 : Fin 6))) := by + exact checkLog_sound logTwoBall_sound ((B1_2_5Little_sound (shape 0 2 2) ((stageBPriority (shape 1 2 5)) 2)) (3 : Fin 6)) (w := CB1_2_5I2S0_2_2E_3LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB1_2_5I2S0_2_2E_3 : Ball := ⟨(11358811732757374761614612713019 / 50000000000000000000000000000000), (1033962531 / 10000000000000000000000000000000)⟩ +lemma CB1_2_5I2S0_2_2E_3_sound : CB1_2_5I2S0_2_2E_3.Encloses (Foundation.entropyTerm (CB1_2_5I2S0_2_2Value (3 : Fin 6))) := by + exact contains_sound (entropyTerm_ball ((B1_2_5Little_sound (shape 0 2 2) ((stageBPriority (shape 1 2 5)) 2)) (3 : Fin 6)) CB1_2_5I2S0_2_2E_3Log_sound) (by decide +kernel) +def CB1_2_5I2S0_2_2Terms (a : Fin 6) : Ball := + match a.val with + | 2 => ⟨(9272348213725720898382327931727 / 100000000000000000000000000000000), (38215797243 / 100000000000000000000000000000000)⟩ + | 3 => ⟨(11358811732757374761614612713019 / 50000000000000000000000000000000), (1033962531 / 10000000000000000000000000000000)⟩ + | _ => (.exact 0) +lemma CB1_2_5I2S0_2_2Terms_sound (a : Fin 6) : + (CB1_2_5I2S0_2_2Terms a).Encloses (Foundation.entropyTerm (CB1_2_5I2S0_2_2Value a)) := by + fin_cases a + · exact (entropyTerm_zero_ball ((B1_2_5Little_sound (shape 0 2 2) ((stageBPriority (shape 1 2 5)) 2)) (0 : Fin 6))) + · exact (entropyTerm_zero_ball ((B1_2_5Little_sound (shape 0 2 2) ((stageBPriority (shape 1 2 5)) 2)) (1 : Fin 6))) + · exact CB1_2_5I2S0_2_2E_2_sound + · exact CB1_2_5I2S0_2_2E_3_sound + · exact (entropyTerm_zero_ball ((B1_2_5Little_sound (shape 0 2 2) ((stageBPriority (shape 1 2 5)) 2)) (4 : Fin 6))) + · exact (entropyTerm_zero_ball ((B1_2_5Little_sound (shape 0 2 2) ((stageBPriority (shape 1 2 5)) 2)) (5 : Fin 6))) +def CB1_2_5I2S0_2_2Entropy : Ball := ⟨(6397994335848094084322310671553 / 20000000000000000000000000000000), (48555422553 / 100000000000000000000000000000000)⟩ +lemma CB1_2_5I2S0_2_2Entropy_sound : CB1_2_5I2S0_2_2Entropy.Encloses (Foundation.finiteEntropy CB1_2_5I2S0_2_2Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_2_5I2S0_2_2Value CB1_2_5I2S0_2_2Terms CB1_2_5I2S0_2_2Terms_sound) (by decide +kernel) +def CB1_2_5I2S0_2_2Mass : Ball := ⟨1, 0⟩ +lemma CB1_2_5I2S0_2_2Mass_sound : CB1_2_5I2S0_2_2Mass.Encloses (∑ a, CB1_2_5I2S0_2_2Value a) := by + exact contains_sound (finSumBall_sound 6 (B1_2_5Little (shape 0 2 2) ((stageBPriority (shape 1 2 5)) 2)) CB1_2_5I2S0_2_2Value (B1_2_5Little_sound (shape 0 2 2) ((stageBPriority (shape 1 2 5)) 2))) (by decide +kernel) +def CB1_2_5I2S0_2_2MassTermLog : Ball := .exact 0 +lemma CB1_2_5I2S0_2_2MassTermLog_sound : CB1_2_5I2S0_2_2MassTermLog.Encloses (Real.log ((∑ a, CB1_2_5I2S0_2_2Value a))) := by + exact log_exact_one_ball (CB1_2_5I2S0_2_2Mass_sound) +def CB1_2_5I2S0_2_2MassTerm : Ball := ⟨0, 0⟩ +lemma CB1_2_5I2S0_2_2MassTerm_sound : CB1_2_5I2S0_2_2MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_2_5I2S0_2_2Value a))) := by + exact contains_sound (entropyTerm_ball (CB1_2_5I2S0_2_2Mass_sound) CB1_2_5I2S0_2_2MassTermLog_sound) (by decide +kernel) +def CB1_2_5I2S0_2_2H : Ball := ⟨(6397994335848094084322310671553 / 20000000000000000000000000000000), (48555422553 / 100000000000000000000000000000000)⟩ +lemma CB1_2_5I2S0_2_2H_sound : CB1_2_5I2S0_2_2H.Encloses (homogeneousEntropy CB1_2_5I2S0_2_2Value) := by + exact contains_sound (homogeneous_enclosed CB1_2_5I2S0_2_2Value CB1_2_5I2S0_2_2MassTerm_sound CB1_2_5I2S0_2_2Entropy_sound) (by decide +kernel) +def CB1_2_5I2S1_0_3Value (a : Fin 6) : ℝ := (littleLaw (shape 1 2 5) (shape 1 0 3) ((stageBPriority (shape 1 2 5)) 2) a : ℝ) +def CB1_2_5I2S1_0_3E_4Log : Ball := .exact 0 +lemma CB1_2_5I2S1_0_3E_4Log_sound : CB1_2_5I2S1_0_3E_4Log.Encloses (Real.log (CB1_2_5I2S1_0_3Value (4 : Fin 6))) := by + exact log_exact_one_ball ((B1_2_5Little_sound (shape 1 0 3) ((stageBPriority (shape 1 2 5)) 2)) (4 : Fin 6)) +def CB1_2_5I2S1_0_3E_4 : Ball := ⟨0, 0⟩ +lemma CB1_2_5I2S1_0_3E_4_sound : CB1_2_5I2S1_0_3E_4.Encloses (Foundation.entropyTerm (CB1_2_5I2S1_0_3Value (4 : Fin 6))) := by + exact contains_sound (entropyTerm_ball ((B1_2_5Little_sound (shape 1 0 3) ((stageBPriority (shape 1 2 5)) 2)) (4 : Fin 6)) CB1_2_5I2S1_0_3E_4Log_sound) (by decide +kernel) +def CB1_2_5I2S1_0_3Terms (a : Fin 6) : Ball := + match a.val with + | 4 => ⟨0, 0⟩ + | _ => (.exact 0) +lemma CB1_2_5I2S1_0_3Terms_sound (a : Fin 6) : + (CB1_2_5I2S1_0_3Terms a).Encloses (Foundation.entropyTerm (CB1_2_5I2S1_0_3Value a)) := by + fin_cases a + · exact (entropyTerm_zero_ball ((B1_2_5Little_sound (shape 1 0 3) ((stageBPriority (shape 1 2 5)) 2)) (0 : Fin 6))) + · exact (entropyTerm_zero_ball ((B1_2_5Little_sound (shape 1 0 3) ((stageBPriority (shape 1 2 5)) 2)) (1 : Fin 6))) + · exact (entropyTerm_zero_ball ((B1_2_5Little_sound (shape 1 0 3) ((stageBPriority (shape 1 2 5)) 2)) (2 : Fin 6))) + · exact (entropyTerm_zero_ball ((B1_2_5Little_sound (shape 1 0 3) ((stageBPriority (shape 1 2 5)) 2)) (3 : Fin 6))) + · exact CB1_2_5I2S1_0_3E_4_sound + · exact (entropyTerm_zero_ball ((B1_2_5Little_sound (shape 1 0 3) ((stageBPriority (shape 1 2 5)) 2)) (5 : Fin 6))) +def CB1_2_5I2S1_0_3Entropy : Ball := ⟨0, 0⟩ +lemma CB1_2_5I2S1_0_3Entropy_sound : CB1_2_5I2S1_0_3Entropy.Encloses (Foundation.finiteEntropy CB1_2_5I2S1_0_3Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_2_5I2S1_0_3Value CB1_2_5I2S1_0_3Terms CB1_2_5I2S1_0_3Terms_sound) (by decide +kernel) +def CB1_2_5I2S1_0_3Mass : Ball := ⟨1, 0⟩ +lemma CB1_2_5I2S1_0_3Mass_sound : CB1_2_5I2S1_0_3Mass.Encloses (∑ a, CB1_2_5I2S1_0_3Value a) := by + exact contains_sound (finSumBall_sound 6 (B1_2_5Little (shape 1 0 3) ((stageBPriority (shape 1 2 5)) 2)) CB1_2_5I2S1_0_3Value (B1_2_5Little_sound (shape 1 0 3) ((stageBPriority (shape 1 2 5)) 2))) (by decide +kernel) +def CB1_2_5I2S1_0_3MassTermLog : Ball := .exact 0 +lemma CB1_2_5I2S1_0_3MassTermLog_sound : CB1_2_5I2S1_0_3MassTermLog.Encloses (Real.log ((∑ a, CB1_2_5I2S1_0_3Value a))) := by + exact log_exact_one_ball (CB1_2_5I2S1_0_3Mass_sound) +def CB1_2_5I2S1_0_3MassTerm : Ball := ⟨0, 0⟩ +lemma CB1_2_5I2S1_0_3MassTerm_sound : CB1_2_5I2S1_0_3MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_2_5I2S1_0_3Value a))) := by + exact contains_sound (entropyTerm_ball (CB1_2_5I2S1_0_3Mass_sound) CB1_2_5I2S1_0_3MassTermLog_sound) (by decide +kernel) +def CB1_2_5I2S1_0_3H : Ball := ⟨0, 0⟩ +lemma CB1_2_5I2S1_0_3H_sound : CB1_2_5I2S1_0_3H.Encloses (homogeneousEntropy CB1_2_5I2S1_0_3Value) := by + exact contains_sound (homogeneous_enclosed CB1_2_5I2S1_0_3Value CB1_2_5I2S1_0_3MassTerm_sound CB1_2_5I2S1_0_3Entropy_sound) (by decide +kernel) +def CB1_2_5I2Singles (s : Shape) : Ball := + match s 0, s 1, s 2 with + | 0, 0, 4 => CB1_2_5I2S0_0_4H + | 0, 1, 3 => CB1_2_5I2S0_1_3H + | 0, 2, 2 => CB1_2_5I2S0_2_2H + | 1, 0, 3 => CB1_2_5I2S1_0_3H + | _, _, _ => (.exact 0) +lemma CB1_2_5I2Singles_sound (u : Shape) (hu : u ∈ below (shape 1 2 5)) + (hd : designated (stageBPriority (shape 1 2 5)) 2 u) : + (CB1_2_5I2Singles u).Encloses (homogeneousEntropy ((fun u a => (littleLaw (shape 1 2 5) u ((stageBPriority (shape 1 2 5)) 2) a : ℝ)) u)) := by + rw [B1_2_5_below] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl | rfl | rfl + · exact CB1_2_5I2S0_0_4H_sound + · exact CB1_2_5I2S0_1_3H_sound + · exact CB1_2_5I2S0_2_2H_sound + · exact CB1_2_5I2S1_0_3H_sound + · exact (show ¬ designated (stageBPriority (shape 1 2 5)) 2 (shape 1 1 2) by decide +kernel) hd |>.elim + · exact (show ¬ designated (stageBPriority (shape 1 2 5)) 2 (shape 1 2 1) by decide +kernel) hd |>.elim +def CB1_2_5I2Singleton : Ball := ⟨(1455231344023407159119860932703 / 25000000000000000000000000000000), (883519043 / 10000000000000000000000000000000)⟩ +lemma CB1_2_5I2Singleton_sound : CB1_2_5I2Singleton.Encloses + (singletonEntropy (below (shape 1 2 5)) (fun u => (stageBLaw (shape 1 2 5) u : ℝ)) (stageBPriority (shape 1 2 5)) 2 (fun u a => (littleLaw (shape 1 2 5) u ((stageBPriority (shape 1 2 5)) 2) a : ℝ))) := by + exact contains_sound (singletonBall_sound (below (shape 1 2 5)) B1_2_5Law (fun u => (stageBLaw (shape 1 2 5) u : ℝ)) (stageBPriority (shape 1 2 5)) 2 + CB1_2_5I2Singles (fun u a => (littleLaw (shape 1 2 5) u ((stageBPriority (shape 1 2 5)) 2) a : ℝ)) (fun u _ => B1_2_5Law_sound u) CB1_2_5I2Singles_sound) (by decide +kernel) +def CB1_2_5I2Group : Ball := ⟨(1455231344023407159119860932703 / 25000000000000000000000000000000), (3094997651 / 6250000000000000000000000000000)⟩ +lemma CB1_2_5I2Group_sound : CB1_2_5I2Group.Encloses + (groupedEntropy (below (shape 1 2 5)) (fun u => (stageBLaw (shape 1 2 5) u : ℝ)) (stageBPriority (shape 1 2 5)) 2 (fun u a => (littleLaw (shape 1 2 5) u ((stageBPriority (shape 1 2 5)) 2) a : ℝ))) := by + exact contains_sound (Ball.add_sound CB1_2_5I2Singleton_sound + (finSumBall_sound 17 CB1_2_5I2ResidualEntropies _ CB1_2_5I2ResidualEntropies_sound)) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CB1_2_5I2H : Ball := ⟨(37054980891788625436069480215921 / 50000000000000000000000000000000), (37405962081 / 20000000000000000000000000000000)⟩ +lemma CB1_2_5I2_sound : CB1_2_5I2H.Encloses (stageBCapacity (shape 1 2 5) 2) := by + have hb := contains_sound (Ball.add_sound CB1_2_5I2PairH_sound + (Ball.neg_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) CB1_2_5I2Group_sound))) + (show contains (.add CB1_2_5I2PairH (.neg (.mul (.exact 2) CB1_2_5I2Group))) CB1_2_5I2H = true by decide +kernel) + unfold CB1_2_5I2PairValue at hb + simpa only [stageBCapacity, nativeCapacity, + show (2 : Fin 3) ≠ 0 by decide, ite_false, sub_eq_add_neg] using hb + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/CapacityB/CapB1_3_4I0.lean b/lean/OAI/LinearAlgebra/MatrixFields/CapacityB/CapB1_3_4I0.lean new file mode 100644 index 0000000000000000000000000000000000000000..f9ad60b65441108da46678f6aebf77d7f3eb9ae2 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/CapacityB/CapB1_3_4I0.lean @@ -0,0 +1,72 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Certificates.SplitB1_3_4 + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CB1_3_4I0Value (a : Fin 17) : ℝ := marginal (below (shape 1 3 4)) (fun u => (stageBLaw (shape 1 3 4) u : ℝ)) ((stageBPriority (shape 1 3 4)) 0) a +def CB1_3_4I0Raw (a : Fin 17) : Ball := marginalBall (below (shape 1 3 4)) B1_3_4Law ((stageBPriority (shape 1 3 4)) 0) a +lemma CB1_3_4I0Raw_sound (a : Fin 17) : + (CB1_3_4I0Raw a).Encloses (CB1_3_4I0Value a) := by + exact marginalBall_sound (below (shape 1 3 4)) B1_3_4Law (fun u => (stageBLaw (shape 1 3 4) u : ℝ)) (fun u _ => B1_3_4Law_sound u) ((stageBPriority (shape 1 3 4)) 0) a +def CB1_3_4I0Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(1 / 2), (27 / 100000000000000000000000000000000)⟩ ⟨(6931471805599453094172319305033 / 20000000000000000000000000000000), (21175823729 / 100000000000000000000000000000000)⟩ ⟨(-6931471805599453094172319305033 / 10000000000000000000000000000000), (42351647419 / 100000000000000000000000000000000)⟩ ⟨-1, 1, 1⟩] +lemma CB1_3_4I0Certificates_valid : + CB1_3_4I0Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_3_4I0CertificateIndex (a : Fin 17) : ℕ := + match a.val with + | 0 => 1 + | 1 => 1 + | _ => 0 +def CB1_3_4I0P (a : Fin 17) : Ball := + (CompactCertificate.entropyLookup CB1_3_4I0Certificates (CB1_3_4I0CertificateIndex a)).input +lemma CB1_3_4I0P_check : ∀ a : Fin 17, contains (CB1_3_4I0Raw a) (CB1_3_4I0P a) = true := by + decide +kernel +lemma CB1_3_4I0P_sound (a : Fin 17) : + (CB1_3_4I0P a).Encloses (CB1_3_4I0Value a) := + contains_sound (CB1_3_4I0Raw_sound a) (CB1_3_4I0P_check a) +def CB1_3_4I0Terms (a : Fin 17) : Ball := + (CompactCertificate.entropyLookup CB1_3_4I0Certificates (CB1_3_4I0CertificateIndex a)).output +lemma CB1_3_4I0Terms_sound (a : Fin 17) : + (CB1_3_4I0Terms a).Encloses (Foundation.entropyTerm (CB1_3_4I0Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_3_4I0Certificates_valid + (CB1_3_4I0CertificateIndex a) (CB1_3_4I0P_sound a) +def CB1_3_4I0Entropy : Ball := ⟨(6931471805599453094172319305033 / 10000000000000000000000000000000), (21175823729 / 50000000000000000000000000000000)⟩ +lemma CB1_3_4I0Entropy_sound : CB1_3_4I0Entropy.Encloses (Foundation.finiteEntropy CB1_3_4I0Value) := by + exact contains_sound (entropyFin_enclosed 17 CB1_3_4I0Value CB1_3_4I0Terms CB1_3_4I0Terms_sound) (by decide +kernel) +def CB1_3_4I0Mass : Ball := ⟨1, (27 / 50000000000000000000000000000000)⟩ +lemma CB1_3_4I0Mass_sound : CB1_3_4I0Mass.Encloses (∑ a, CB1_3_4I0Value a) := by + exact contains_sound (finSumBall_sound 17 CB1_3_4I0P CB1_3_4I0Value CB1_3_4I0P_sound) (by decide +kernel) +def CB1_3_4I0MassTermLogWitness : LogWitness := ⟨0, 1, 1⟩ +def CB1_3_4I0MassTermLog : Ball := ⟨0, (2646977967 / 12500000000000000000000000000000)⟩ +lemma CB1_3_4I0MassTermLog_sound : CB1_3_4I0MassTermLog.Encloses (Real.log ((∑ a, CB1_3_4I0Value a))) := by + exact checkLog_sound logTwoBall_sound (CB1_3_4I0Mass_sound) (w := CB1_3_4I0MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB1_3_4I0MassTerm : Ball := ⟨0, (21175823737 / 100000000000000000000000000000000)⟩ +lemma CB1_3_4I0MassTerm_sound : CB1_3_4I0MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_3_4I0Value a))) := by + exact contains_sound (entropyTerm_ball (CB1_3_4I0Mass_sound) CB1_3_4I0MassTermLog_sound) (by decide +kernel) +def CB1_3_4I0H : Ball := ⟨(6931471805599453094172319305033 / 10000000000000000000000000000000), (12705494239 / 20000000000000000000000000000000)⟩ +lemma CB1_3_4I0H_sound : CB1_3_4I0H.Encloses (homogeneousEntropy CB1_3_4I0Value) := by + exact contains_sound (homogeneous_enclosed CB1_3_4I0Value CB1_3_4I0MassTerm_sound CB1_3_4I0Entropy_sound) (by decide +kernel) +lemma CB1_3_4I0_sound : CB1_3_4I0H.Encloses (stageBCapacity (shape 1 3 4) 0) := by + exact CB1_3_4I0H_sound + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/CapacityB/CapB1_3_4I1.lean b/lean/OAI/LinearAlgebra/MatrixFields/CapacityB/CapB1_3_4I1.lean new file mode 100644 index 0000000000000000000000000000000000000000..802547d37801195e1c0bf14d426ff16d69e60269 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/CapacityB/CapB1_3_4I1.lean @@ -0,0 +1,888 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Certificates.LittleB1_3_4 + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CB1_3_4I1PairValue (a : PairSlot) : ℝ := pairLaw (below (shape 1 3 4)) (shape 1 3 4) (fun u => (stageBLaw (shape 1 3 4) u : ℝ)) (fun u a => (littleLaw (shape 1 3 4) u ((stageBPriority (shape 1 3 4)) 1) a : ℝ)) a +def CB1_3_4I1PairRaw (a : PairSlot) : Ball := pairLawBall (below (shape 1 3 4)) (shape 1 3 4) B1_3_4Law (fun u => B1_3_4Little u ((stageBPriority (shape 1 3 4)) 1)) a +lemma CB1_3_4I1PairRaw_sound (a : PairSlot) : + (CB1_3_4I1PairRaw a).Encloses (CB1_3_4I1PairValue a) := by + exact pairLawBall_sound_on (below (shape 1 3 4)) (shape 1 3 4) B1_3_4Law (fun u => (stageBLaw (shape 1 3 4) u : ℝ)) (fun u => B1_3_4Little u ((stageBPriority (shape 1 3 4)) 1)) (fun u a => (littleLaw (shape 1 3 4) u ((stageBPriority (shape 1 3 4)) 1) a : ℝ)) (fun u _ => B1_3_4Law_sound u) (fun u _ a => B1_3_4Little_sound u ((stageBPriority (shape 1 3 4)) 1) a) (fun u _ a => B1_3_4Little_sound (complement (shape 1 3 4) u) ((stageBPriority (shape 1 3 4)) 1) a) a +def CB1_3_4I1PairCertificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(132732360120937838226056869067 / 10000000000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ ⟨(717087504867112438922694885631 / 12500000000000000000000000000000), (2248573677 / 100000000000000000000000000000000)⟩ ⟨(-216100280056421786268538236371047 / 50000000000000000000000000000000), (42351647479 / 25000000000000000000000000000000)⟩ ⟨-7, 132732360120937838226056869067, 78125000000000000000000000000⟩, + .log ⟨(22225619795436123996567854910187 / 50000000000000000000000000000000), (21 / 100000000000000000000000000000000)⟩ ⟨(17597684407544367577188920373 / 48828125000000000000000000000), (28238748401 / 100000000000000000000000000000000)⟩ ⟨(-40538866855415477844169464524159 / 50000000000000000000000000000000), (7940933887 / 12500000000000000000000000000000)⟩ ⟨-2, 22225619795436123996567854910187, 12500000000000000000000000000000⟩, + .log ⟨(1055359201979593406150930372239 / 25000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ ⟨(6680412435246643572518288858429 / 50000000000000000000000000000000), (5363544101 / 100000000000000000000000000000000)⟩ ⟨(-39562433000985816798867928749851 / 12500000000000000000000000000000), (25410988429 / 20000000000000000000000000000000)⟩ ⟨-5, 1055359201979593406150930372239, 781250000000000000000000000000⟩] +lemma CB1_3_4I1PairCertificates_valid : + CB1_3_4I1PairCertificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_3_4I1PairCertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 0, 4 => 1 + | 1, 2 => 2 + | 1, 3 => 3 + | 2, 1 => 2 + | 3, 1 => 3 + | 4, 0 => 1 + | _, _ => 0 +def CB1_3_4I1PairP (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CB1_3_4I1PairCertificates (CB1_3_4I1PairCertificateIndex a)).input +lemma CB1_3_4I1PairP_check : ∀ a : PairSlot, contains (CB1_3_4I1PairRaw a) (CB1_3_4I1PairP a) = true := by + decide +kernel +lemma CB1_3_4I1PairP_sound (a : PairSlot) : + (CB1_3_4I1PairP a).Encloses (CB1_3_4I1PairValue a) := + contains_sound (CB1_3_4I1PairRaw_sound a) (CB1_3_4I1PairP_check a) +def CB1_3_4I1PairTerms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CB1_3_4I1PairCertificates (CB1_3_4I1PairCertificateIndex a)).output +lemma CB1_3_4I1PairTerms_sound (a : PairSlot) : + (CB1_3_4I1PairTerms a).Encloses (Foundation.entropyTerm (CB1_3_4I1PairValue a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_3_4I1PairCertificates_valid + (CB1_3_4I1PairCertificateIndex a) (CB1_3_4I1PairP_sound a) +def CB1_3_4I1PairEntropy : Ball := ⟨(5513758257608105145450104572581 / 5000000000000000000000000000000), (35850866179 / 50000000000000000000000000000000)⟩ +lemma CB1_3_4I1PairEntropy_sound : CB1_3_4I1PairEntropy.Encloses (Foundation.finiteEntropy CB1_3_4I1PairValue) := by + exact contains_sound (entropyPair_enclosed CB1_3_4I1PairValue CB1_3_4I1PairTerms CB1_3_4I1PairTerms_sound) (by decide +kernel) +def CB1_3_4I1PairMass : Ball := ⟨1, (29 / 50000000000000000000000000000000)⟩ +lemma CB1_3_4I1PairMass_sound : CB1_3_4I1PairMass.Encloses (∑ a, CB1_3_4I1PairValue a) := by + exact contains_sound (pairSumBall_sound CB1_3_4I1PairP CB1_3_4I1PairValue CB1_3_4I1PairP_sound) (by decide +kernel) +def CB1_3_4I1PairMassTermLogWitness : LogWitness := ⟨0, 1, 1⟩ +def CB1_3_4I1PairMassTermLog : Ball := ⟨0, (1058791187 / 5000000000000000000000000000000)⟩ +lemma CB1_3_4I1PairMassTermLog_sound : CB1_3_4I1PairMassTermLog.Encloses (Real.log ((∑ a, CB1_3_4I1PairValue a))) := by + exact checkLog_sound logTwoBall_sound (CB1_3_4I1PairMass_sound) (w := CB1_3_4I1PairMassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB1_3_4I1PairMassTerm : Ball := ⟨0, (21175823741 / 100000000000000000000000000000000)⟩ +lemma CB1_3_4I1PairMassTerm_sound : CB1_3_4I1PairMassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_3_4I1PairValue a))) := by + exact contains_sound (entropyTerm_ball (CB1_3_4I1PairMass_sound) CB1_3_4I1PairMassTermLog_sound) (by decide +kernel) +def CB1_3_4I1PairH : Ball := ⟨(5513758257608105145450104572581 / 5000000000000000000000000000000), (92877556099 / 100000000000000000000000000000000)⟩ +lemma CB1_3_4I1PairH_sound : CB1_3_4I1PairH.Encloses (homogeneousEntropy CB1_3_4I1PairValue) := by + exact contains_sound (homogeneous_enclosed CB1_3_4I1PairValue CB1_3_4I1PairMassTerm_sound CB1_3_4I1PairEntropy_sound) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CB1_3_4I1R0Value (a : Fin 6) : ℝ := residualLaw (below (shape 1 3 4)) (fun u => (stageBLaw (shape 1 3 4) u : ℝ)) (stageBPriority (shape 1 3 4)) 1 (fun u a => (littleLaw (shape 1 3 4) u ((stageBPriority (shape 1 3 4)) 1) a : ℝ)) 0 a +def CB1_3_4I1R0Raw (a : Fin 6) : Ball := residualBall (below (shape 1 3 4)) B1_3_4Law (stageBPriority (shape 1 3 4)) 1 (fun u => B1_3_4Little u ((stageBPriority (shape 1 3 4)) 1)) 0 a +lemma CB1_3_4I1R0Raw_sound (a : Fin 6) : + (CB1_3_4I1R0Raw a).Encloses (CB1_3_4I1R0Value a) := by + exact residualBall_sound_on (below (shape 1 3 4)) B1_3_4Law (fun u => (stageBLaw (shape 1 3 4) u : ℝ)) (stageBPriority (shape 1 3 4)) 1 (fun u => B1_3_4Little u ((stageBPriority (shape 1 3 4)) 1)) (fun u a => (littleLaw (shape 1 3 4) u ((stageBPriority (shape 1 3 4)) 1) a : ℝ)) (fun u _ => B1_3_4Law_sound u) (fun u _ a => B1_3_4Little_sound u ((stageBPriority (shape 1 3 4)) 1) a) 0 a +def CB1_3_4I1R0Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(132732360120937838226056869067 / 10000000000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ ⟨(717087504867112438922694885631 / 12500000000000000000000000000000), (2248573677 / 100000000000000000000000000000000)⟩ ⟨(-216100280056421786268538236371047 / 50000000000000000000000000000000), (42351647479 / 25000000000000000000000000000000)⟩ ⟨-7, 132732360120937838226056869067, 78125000000000000000000000000⟩] +lemma CB1_3_4I1R0Certificates_valid : + CB1_3_4I1R0Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_3_4I1R0CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | 0 => 1 + | _ => 0 +def CB1_3_4I1R0P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_3_4I1R0Certificates (CB1_3_4I1R0CertificateIndex a)).input +lemma CB1_3_4I1R0P_check : ∀ a : Fin 6, contains (CB1_3_4I1R0Raw a) (CB1_3_4I1R0P a) = true := by + decide +kernel +lemma CB1_3_4I1R0P_sound (a : Fin 6) : + (CB1_3_4I1R0P a).Encloses (CB1_3_4I1R0Value a) := + contains_sound (CB1_3_4I1R0Raw_sound a) (CB1_3_4I1R0P_check a) +def CB1_3_4I1R0Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_3_4I1R0Certificates (CB1_3_4I1R0CertificateIndex a)).output +lemma CB1_3_4I1R0Terms_sound (a : Fin 6) : + (CB1_3_4I1R0Terms a).Encloses (Foundation.entropyTerm (CB1_3_4I1R0Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_3_4I1R0Certificates_valid + (CB1_3_4I1R0CertificateIndex a) (CB1_3_4I1R0P_sound a) +def CB1_3_4I1R0Entropy : Ball := ⟨(717087504867112438922694885631 / 12500000000000000000000000000000), (2248573677 / 100000000000000000000000000000000)⟩ +lemma CB1_3_4I1R0Entropy_sound : CB1_3_4I1R0Entropy.Encloses (Foundation.finiteEntropy CB1_3_4I1R0Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_3_4I1R0Value CB1_3_4I1R0Terms CB1_3_4I1R0Terms_sound) (by decide +kernel) +def CB1_3_4I1R0Mass : Ball := ⟨(132732360120937838226056869067 / 10000000000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ +lemma CB1_3_4I1R0Mass_sound : CB1_3_4I1R0Mass.Encloses (∑ a, CB1_3_4I1R0Value a) := by + exact contains_sound (finSumBall_sound 6 CB1_3_4I1R0P CB1_3_4I1R0Value CB1_3_4I1R0P_sound) (by decide +kernel) +def CB1_3_4I1R0MassTermLogWitness : LogWitness := ⟨-7, 132732360120937838226056869067, 78125000000000000000000000000⟩ +def CB1_3_4I1R0MassTermLog : Ball := ⟨(-216100280056421786268538236371047 / 50000000000000000000000000000000), (42351647479 / 25000000000000000000000000000000)⟩ +lemma CB1_3_4I1R0MassTermLog_sound : CB1_3_4I1R0MassTermLog.Encloses (Real.log ((∑ a, CB1_3_4I1R0Value a))) := by + exact checkLog_sound logTwoBall_sound (CB1_3_4I1R0Mass_sound) (w := CB1_3_4I1R0MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB1_3_4I1R0MassTerm : Ball := ⟨(717087504867112438922694885631 / 12500000000000000000000000000000), (2248573677 / 100000000000000000000000000000000)⟩ +lemma CB1_3_4I1R0MassTerm_sound : CB1_3_4I1R0MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_3_4I1R0Value a))) := by + exact contains_sound (entropyTerm_ball (CB1_3_4I1R0Mass_sound) CB1_3_4I1R0MassTermLog_sound) (by decide +kernel) +def CB1_3_4I1R0H : Ball := ⟨0, (2248573677 / 50000000000000000000000000000000)⟩ +lemma CB1_3_4I1R0H_sound : CB1_3_4I1R0H.Encloses (homogeneousEntropy CB1_3_4I1R0Value) := by + exact contains_sound (homogeneous_enclosed CB1_3_4I1R0Value CB1_3_4I1R0MassTerm_sound CB1_3_4I1R0Entropy_sound) (by decide +kernel) +def CB1_3_4I1R1Value (a : Fin 6) : ℝ := residualLaw (below (shape 1 3 4)) (fun u => (stageBLaw (shape 1 3 4) u : ℝ)) (stageBPriority (shape 1 3 4)) 1 (fun u a => (littleLaw (shape 1 3 4) u ((stageBPriority (shape 1 3 4)) 1) a : ℝ)) 1 a +def CB1_3_4I1R1Raw (a : Fin 6) : Ball := residualBall (below (shape 1 3 4)) B1_3_4Law (stageBPriority (shape 1 3 4)) 1 (fun u => B1_3_4Little u ((stageBPriority (shape 1 3 4)) 1)) 1 a +lemma CB1_3_4I1R1Raw_sound (a : Fin 6) : + (CB1_3_4I1R1Raw a).Encloses (CB1_3_4I1R1Value a) := by + exact residualBall_sound_on (below (shape 1 3 4)) B1_3_4Law (fun u => (stageBLaw (shape 1 3 4) u : ℝ)) (stageBPriority (shape 1 3 4)) 1 (fun u => B1_3_4Little u ((stageBPriority (shape 1 3 4)) 1)) (fun u a => (littleLaw (shape 1 3 4) u ((stageBPriority (shape 1 3 4)) 1) a : ℝ)) (fun u _ => B1_3_4Law_sound u) (fun u _ a => B1_3_4Little_sound u ((stageBPriority (shape 1 3 4)) 1) a) 1 a +def CB1_3_4I1R1Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(4867267639879062161773943130933 / 10000000000000000000000000000000), (21 / 100000000000000000000000000000000)⟩ ⟨(700937522751638320155014264963 / 2000000000000000000000000000000), (6184104089 / 20000000000000000000000000000000)⟩ ⟨(-14401047458509075034822692518743 / 20000000000000000000000000000000), (15881867773 / 25000000000000000000000000000000)⟩ ⟨-2, 4867267639879062161773943130933, 2500000000000000000000000000000⟩] +lemma CB1_3_4I1R1Certificates_valid : + CB1_3_4I1R1Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_3_4I1R1CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | 1 => 1 + | _ => 0 +def CB1_3_4I1R1P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_3_4I1R1Certificates (CB1_3_4I1R1CertificateIndex a)).input +lemma CB1_3_4I1R1P_check : ∀ a : Fin 6, contains (CB1_3_4I1R1Raw a) (CB1_3_4I1R1P a) = true := by + decide +kernel +lemma CB1_3_4I1R1P_sound (a : Fin 6) : + (CB1_3_4I1R1P a).Encloses (CB1_3_4I1R1Value a) := + contains_sound (CB1_3_4I1R1Raw_sound a) (CB1_3_4I1R1P_check a) +def CB1_3_4I1R1Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_3_4I1R1Certificates (CB1_3_4I1R1CertificateIndex a)).output +lemma CB1_3_4I1R1Terms_sound (a : Fin 6) : + (CB1_3_4I1R1Terms a).Encloses (Foundation.entropyTerm (CB1_3_4I1R1Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_3_4I1R1Certificates_valid + (CB1_3_4I1R1CertificateIndex a) (CB1_3_4I1R1P_sound a) +def CB1_3_4I1R1Entropy : Ball := ⟨(700937522751638320155014264963 / 2000000000000000000000000000000), (6184104089 / 20000000000000000000000000000000)⟩ +lemma CB1_3_4I1R1Entropy_sound : CB1_3_4I1R1Entropy.Encloses (Foundation.finiteEntropy CB1_3_4I1R1Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_3_4I1R1Value CB1_3_4I1R1Terms CB1_3_4I1R1Terms_sound) (by decide +kernel) +def CB1_3_4I1R1Mass : Ball := ⟨(4867267639879062161773943130933 / 10000000000000000000000000000000), (21 / 100000000000000000000000000000000)⟩ +lemma CB1_3_4I1R1Mass_sound : CB1_3_4I1R1Mass.Encloses (∑ a, CB1_3_4I1R1Value a) := by + exact contains_sound (finSumBall_sound 6 CB1_3_4I1R1P CB1_3_4I1R1Value CB1_3_4I1R1P_sound) (by decide +kernel) +def CB1_3_4I1R1MassTermLogWitness : LogWitness := ⟨-2, 4867267639879062161773943130933, 2500000000000000000000000000000⟩ +def CB1_3_4I1R1MassTermLog : Ball := ⟨(-14401047458509075034822692518743 / 20000000000000000000000000000000), (15881867773 / 25000000000000000000000000000000)⟩ +lemma CB1_3_4I1R1MassTermLog_sound : CB1_3_4I1R1MassTermLog.Encloses (Real.log ((∑ a, CB1_3_4I1R1Value a))) := by + exact checkLog_sound logTwoBall_sound (CB1_3_4I1R1Mass_sound) (w := CB1_3_4I1R1MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB1_3_4I1R1MassTerm : Ball := ⟨(700937522751638320155014264963 / 2000000000000000000000000000000), (6184104089 / 20000000000000000000000000000000)⟩ +lemma CB1_3_4I1R1MassTerm_sound : CB1_3_4I1R1MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_3_4I1R1Value a))) := by + exact contains_sound (entropyTerm_ball (CB1_3_4I1R1Mass_sound) CB1_3_4I1R1MassTermLog_sound) (by decide +kernel) +def CB1_3_4I1R1H : Ball := ⟨0, (6184104089 / 10000000000000000000000000000000)⟩ +lemma CB1_3_4I1R1H_sound : CB1_3_4I1R1H.Encloses (homogeneousEntropy CB1_3_4I1R1Value) := by + exact contains_sound (homogeneous_enclosed CB1_3_4I1R1Value CB1_3_4I1R1MassTerm_sound CB1_3_4I1R1Entropy_sound) (by decide +kernel) +def CB1_3_4I1R2Value (a : Fin 6) : ℝ := residualLaw (below (shape 1 3 4)) (fun u => (stageBLaw (shape 1 3 4) u : ℝ)) (stageBPriority (shape 1 3 4)) 1 (fun u a => (littleLaw (shape 1 3 4) u ((stageBPriority (shape 1 3 4)) 1) a : ℝ)) 2 a +def CB1_3_4I1R2Raw (a : Fin 6) : Ball := residualBall (below (shape 1 3 4)) B1_3_4Law (stageBPriority (shape 1 3 4)) 1 (fun u => B1_3_4Little u ((stageBPriority (shape 1 3 4)) 1)) 2 a +lemma CB1_3_4I1R2Raw_sound (a : Fin 6) : + (CB1_3_4I1R2Raw a).Encloses (CB1_3_4I1R2Value a) := by + exact residualBall_sound_on (below (shape 1 3 4)) B1_3_4Law (fun u => (stageBLaw (shape 1 3 4) u : ℝ)) (stageBPriority (shape 1 3 4)) 1 (fun u => B1_3_4Little u ((stageBPriority (shape 1 3 4)) 1)) (fun u a => (littleLaw (shape 1 3 4) u ((stageBPriority (shape 1 3 4)) 1) a : ℝ)) (fun u _ => B1_3_4Law_sound u) (fun u _ a => B1_3_4Little_sound u ((stageBPriority (shape 1 3 4)) 1) a) 2 a +def CB1_3_4I1R2Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(22225619795436123996567854910187 / 50000000000000000000000000000000), (21 / 100000000000000000000000000000000)⟩ ⟨(17597684407544367577188920373 / 48828125000000000000000000000), (28238748401 / 100000000000000000000000000000000)⟩ ⟨(-40538866855415477844169464524159 / 50000000000000000000000000000000), (7940933887 / 12500000000000000000000000000000)⟩ ⟨-2, 22225619795436123996567854910187, 12500000000000000000000000000000⟩, + .log ⟨(1055359201979593406150930372239 / 25000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ ⟨(6680412435246643572518288858429 / 50000000000000000000000000000000), (5363544101 / 100000000000000000000000000000000)⟩ ⟨(-39562433000985816798867928749851 / 12500000000000000000000000000000), (25410988429 / 20000000000000000000000000000000)⟩ ⟨-5, 1055359201979593406150930372239, 781250000000000000000000000000⟩] +lemma CB1_3_4I1R2Certificates_valid : + CB1_3_4I1R2Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_3_4I1R2CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | 2 => 1 + | 3 => 2 + | _ => 0 +def CB1_3_4I1R2P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_3_4I1R2Certificates (CB1_3_4I1R2CertificateIndex a)).input +lemma CB1_3_4I1R2P_check : ∀ a : Fin 6, contains (CB1_3_4I1R2Raw a) (CB1_3_4I1R2P a) = true := by + decide +kernel +lemma CB1_3_4I1R2P_sound (a : Fin 6) : + (CB1_3_4I1R2P a).Encloses (CB1_3_4I1R2Value a) := + contains_sound (CB1_3_4I1R2Raw_sound a) (CB1_3_4I1R2P_check a) +def CB1_3_4I1R2Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_3_4I1R2Certificates (CB1_3_4I1R2CertificateIndex a)).output +lemma CB1_3_4I1R2Terms_sound (a : Fin 6) : + (CB1_3_4I1R2Terms a).Encloses (Foundation.entropyTerm (CB1_3_4I1R2Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_3_4I1R2Certificates_valid + (CB1_3_4I1R2CertificateIndex a) (CB1_3_4I1R2P_sound a) +def CB1_3_4I1R2Entropy : Ball := ⟨(24700441268572075971559743320381 / 50000000000000000000000000000000), (16801146251 / 50000000000000000000000000000000)⟩ +lemma CB1_3_4I1R2Entropy_sound : CB1_3_4I1R2Entropy.Encloses (Foundation.finiteEntropy CB1_3_4I1R2Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_3_4I1R2Value CB1_3_4I1R2Terms CB1_3_4I1R2Terms_sound) (by decide +kernel) +def CB1_3_4I1R2Mass : Ball := ⟨(4867267639879062161773943130933 / 10000000000000000000000000000000), (23 / 100000000000000000000000000000000)⟩ +lemma CB1_3_4I1R2Mass_sound : CB1_3_4I1R2Mass.Encloses (∑ a, CB1_3_4I1R2Value a) := by + exact contains_sound (finSumBall_sound 6 CB1_3_4I1R2P CB1_3_4I1R2Value CB1_3_4I1R2P_sound) (by decide +kernel) +def CB1_3_4I1R2MassTermLogWitness : LogWitness := ⟨-2, 4867267639879062161773943130933, 2500000000000000000000000000000⟩ +def CB1_3_4I1R2MassTermLog : Ball := ⟨(-14401047458509075034822692518743 / 20000000000000000000000000000000), (7940933887 / 12500000000000000000000000000000)⟩ +lemma CB1_3_4I1R2MassTermLog_sound : CB1_3_4I1R2MassTermLog.Encloses (Real.log ((∑ a, CB1_3_4I1R2Value a))) := by + exact checkLog_sound logTwoBall_sound (CB1_3_4I1R2Mass_sound) (w := CB1_3_4I1R2MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB1_3_4I1R2MassTerm : Ball := ⟨(700937522751638320155014264963 / 2000000000000000000000000000000), (120783283 / 390625000000000000000000000000)⟩ +lemma CB1_3_4I1R2MassTerm_sound : CB1_3_4I1R2MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_3_4I1R2Value a))) := by + exact contains_sound (entropyTerm_ball (CB1_3_4I1R2Mass_sound) CB1_3_4I1R2MassTermLog_sound) (by decide +kernel) +def CB1_3_4I1R2H : Ball := ⟨(3588501599890558983842193348153 / 25000000000000000000000000000000), (1290456259 / 2000000000000000000000000000000)⟩ +lemma CB1_3_4I1R2H_sound : CB1_3_4I1R2H.Encloses (homogeneousEntropy CB1_3_4I1R2Value) := by + exact contains_sound (homogeneous_enclosed CB1_3_4I1R2Value CB1_3_4I1R2MassTerm_sound CB1_3_4I1R2Entropy_sound) (by decide +kernel) +def CB1_3_4I1R3Value (a : Fin 6) : ℝ := residualLaw (below (shape 1 3 4)) (fun u => (stageBLaw (shape 1 3 4) u : ℝ)) (stageBPriority (shape 1 3 4)) 1 (fun u a => (littleLaw (shape 1 3 4) u ((stageBPriority (shape 1 3 4)) 1) a : ℝ)) 3 a +def CB1_3_4I1R3Raw (a : Fin 6) : Ball := residualBall (below (shape 1 3 4)) B1_3_4Law (stageBPriority (shape 1 3 4)) 1 (fun u => B1_3_4Little u ((stageBPriority (shape 1 3 4)) 1)) 3 a +lemma CB1_3_4I1R3Raw_sound (a : Fin 6) : + (CB1_3_4I1R3Raw a).Encloses (CB1_3_4I1R3Value a) := by + exact residualBall_sound_on (below (shape 1 3 4)) B1_3_4Law (fun u => (stageBLaw (shape 1 3 4) u : ℝ)) (stageBPriority (shape 1 3 4)) 1 (fun u => B1_3_4Little u ((stageBPriority (shape 1 3 4)) 1)) (fun u a => (littleLaw (shape 1 3 4) u ((stageBPriority (shape 1 3 4)) 1) a : ℝ)) (fun u _ => B1_3_4Law_sound u) (fun u _ a => B1_3_4Little_sound u ((stageBPriority (shape 1 3 4)) 1) a) 3 a +def CB1_3_4I1R3Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(1308946998292554555787053318931 / 100000000000000000000000000000000), (1 / 20000000000000000000000000000000)⟩ ⟨(2837762529623000514779049028849 / 50000000000000000000000000000000), (443488499 / 20000000000000000000000000000000)⟩ ⟨(-433594719010731091912411543100809 / 100000000000000000000000000000000), (33881317969 / 20000000000000000000000000000000)⟩ ⟨-7, 1308946998292554555787053318931, 781250000000000000000000000000⟩] +lemma CB1_3_4I1R3Certificates_valid : + CB1_3_4I1R3Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_3_4I1R3CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | 4 => 1 + | _ => 0 +def CB1_3_4I1R3P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_3_4I1R3Certificates (CB1_3_4I1R3CertificateIndex a)).input +lemma CB1_3_4I1R3P_check : ∀ a : Fin 6, contains (CB1_3_4I1R3Raw a) (CB1_3_4I1R3P a) = true := by + decide +kernel +lemma CB1_3_4I1R3P_sound (a : Fin 6) : + (CB1_3_4I1R3P a).Encloses (CB1_3_4I1R3Value a) := + contains_sound (CB1_3_4I1R3Raw_sound a) (CB1_3_4I1R3P_check a) +def CB1_3_4I1R3Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_3_4I1R3Certificates (CB1_3_4I1R3CertificateIndex a)).output +lemma CB1_3_4I1R3Terms_sound (a : Fin 6) : + (CB1_3_4I1R3Terms a).Encloses (Foundation.entropyTerm (CB1_3_4I1R3Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_3_4I1R3Certificates_valid + (CB1_3_4I1R3CertificateIndex a) (CB1_3_4I1R3P_sound a) +def CB1_3_4I1R3Entropy : Ball := ⟨(2837762529623000514779049028849 / 50000000000000000000000000000000), (443488499 / 20000000000000000000000000000000)⟩ +lemma CB1_3_4I1R3Entropy_sound : CB1_3_4I1R3Entropy.Encloses (Foundation.finiteEntropy CB1_3_4I1R3Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_3_4I1R3Value CB1_3_4I1R3Terms CB1_3_4I1R3Terms_sound) (by decide +kernel) +def CB1_3_4I1R3Mass : Ball := ⟨(1308946998292554555787053318931 / 100000000000000000000000000000000), (1 / 20000000000000000000000000000000)⟩ +lemma CB1_3_4I1R3Mass_sound : CB1_3_4I1R3Mass.Encloses (∑ a, CB1_3_4I1R3Value a) := by + exact contains_sound (finSumBall_sound 6 CB1_3_4I1R3P CB1_3_4I1R3Value CB1_3_4I1R3P_sound) (by decide +kernel) +def CB1_3_4I1R3MassTermLogWitness : LogWitness := ⟨-7, 1308946998292554555787053318931, 781250000000000000000000000000⟩ +def CB1_3_4I1R3MassTermLog : Ball := ⟨(-433594719010731091912411543100809 / 100000000000000000000000000000000), (33881317969 / 20000000000000000000000000000000)⟩ +lemma CB1_3_4I1R3MassTermLog_sound : CB1_3_4I1R3MassTermLog.Encloses (Real.log ((∑ a, CB1_3_4I1R3Value a))) := by + exact checkLog_sound logTwoBall_sound (CB1_3_4I1R3Mass_sound) (w := CB1_3_4I1R3MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB1_3_4I1R3MassTerm : Ball := ⟨(2837762529623000514779049028849 / 50000000000000000000000000000000), (443488499 / 20000000000000000000000000000000)⟩ +lemma CB1_3_4I1R3MassTerm_sound : CB1_3_4I1R3MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_3_4I1R3Value a))) := by + exact contains_sound (entropyTerm_ball (CB1_3_4I1R3Mass_sound) CB1_3_4I1R3MassTermLog_sound) (by decide +kernel) +def CB1_3_4I1R3H : Ball := ⟨0, (443488499 / 10000000000000000000000000000000)⟩ +lemma CB1_3_4I1R3H_sound : CB1_3_4I1R3H.Encloses (homogeneousEntropy CB1_3_4I1R3Value) := by + exact contains_sound (homogeneous_enclosed CB1_3_4I1R3Value CB1_3_4I1R3MassTerm_sound CB1_3_4I1R3Entropy_sound) (by decide +kernel) +def CB1_3_4I1R4Value (a : Fin 6) : ℝ := residualLaw (below (shape 1 3 4)) (fun u => (stageBLaw (shape 1 3 4) u : ℝ)) (stageBPriority (shape 1 3 4)) 1 (fun u a => (littleLaw (shape 1 3 4) u ((stageBPriority (shape 1 3 4)) 1) a : ℝ)) 4 a +def CB1_3_4I1R4Raw (a : Fin 6) : Ball := residualBall (below (shape 1 3 4)) B1_3_4Law (stageBPriority (shape 1 3 4)) 1 (fun u => B1_3_4Little u ((stageBPriority (shape 1 3 4)) 1)) 4 a +lemma CB1_3_4I1R4Raw_sound (a : Fin 6) : + (CB1_3_4I1R4Raw a).Encloses (CB1_3_4I1R4Value a) := by + exact residualBall_sound_on (below (shape 1 3 4)) B1_3_4Law (fun u => (stageBLaw (shape 1 3 4) u : ℝ)) (stageBPriority (shape 1 3 4)) 1 (fun u => B1_3_4Little u ((stageBPriority (shape 1 3 4)) 1)) (fun u a => (littleLaw (shape 1 3 4) u ((stageBPriority (shape 1 3 4)) 1) a : ℝ)) (fun u _ => B1_3_4Law_sound u) (fun u _ a => B1_3_4Little_sound u ((stageBPriority (shape 1 3 4)) 1) a) 4 a +def CB1_3_4I1R4Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB1_3_4I1R4Certificates_valid : + CB1_3_4I1R4Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_3_4I1R4CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB1_3_4I1R4P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_3_4I1R4Certificates (CB1_3_4I1R4CertificateIndex a)).input +lemma CB1_3_4I1R4P_check : ∀ a : Fin 6, contains (CB1_3_4I1R4Raw a) (CB1_3_4I1R4P a) = true := by + decide +kernel +lemma CB1_3_4I1R4P_sound (a : Fin 6) : + (CB1_3_4I1R4P a).Encloses (CB1_3_4I1R4Value a) := + contains_sound (CB1_3_4I1R4Raw_sound a) (CB1_3_4I1R4P_check a) +def CB1_3_4I1R4Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_3_4I1R4Certificates (CB1_3_4I1R4CertificateIndex a)).output +lemma CB1_3_4I1R4Terms_sound (a : Fin 6) : + (CB1_3_4I1R4Terms a).Encloses (Foundation.entropyTerm (CB1_3_4I1R4Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_3_4I1R4Certificates_valid + (CB1_3_4I1R4CertificateIndex a) (CB1_3_4I1R4P_sound a) +def CB1_3_4I1R4Entropy : Ball := ⟨0, 0⟩ +lemma CB1_3_4I1R4Entropy_sound : CB1_3_4I1R4Entropy.Encloses (Foundation.finiteEntropy CB1_3_4I1R4Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_3_4I1R4Value CB1_3_4I1R4Terms CB1_3_4I1R4Terms_sound) (by decide +kernel) +def CB1_3_4I1R4Mass : Ball := ⟨0, 0⟩ +lemma CB1_3_4I1R4Mass_sound : CB1_3_4I1R4Mass.Encloses (∑ a, CB1_3_4I1R4Value a) := by + exact contains_sound (finSumBall_sound 6 CB1_3_4I1R4P CB1_3_4I1R4Value CB1_3_4I1R4P_sound) (by decide +kernel) +def CB1_3_4I1R4MassTerm : Ball := .exact 0 +lemma CB1_3_4I1R4MassTerm_sound : CB1_3_4I1R4MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_3_4I1R4Value a))) := + entropyTerm_zero_ball (CB1_3_4I1R4Mass_sound) +def CB1_3_4I1R4H : Ball := ⟨0, 0⟩ +lemma CB1_3_4I1R4H_sound : CB1_3_4I1R4H.Encloses (homogeneousEntropy CB1_3_4I1R4Value) := by + exact contains_sound (homogeneous_enclosed CB1_3_4I1R4Value CB1_3_4I1R4MassTerm_sound CB1_3_4I1R4Entropy_sound) (by decide +kernel) +def CB1_3_4I1R5Value (a : Fin 6) : ℝ := residualLaw (below (shape 1 3 4)) (fun u => (stageBLaw (shape 1 3 4) u : ℝ)) (stageBPriority (shape 1 3 4)) 1 (fun u a => (littleLaw (shape 1 3 4) u ((stageBPriority (shape 1 3 4)) 1) a : ℝ)) 5 a +def CB1_3_4I1R5Raw (a : Fin 6) : Ball := residualBall (below (shape 1 3 4)) B1_3_4Law (stageBPriority (shape 1 3 4)) 1 (fun u => B1_3_4Little u ((stageBPriority (shape 1 3 4)) 1)) 5 a +lemma CB1_3_4I1R5Raw_sound (a : Fin 6) : + (CB1_3_4I1R5Raw a).Encloses (CB1_3_4I1R5Value a) := by + exact residualBall_sound_on (below (shape 1 3 4)) B1_3_4Law (fun u => (stageBLaw (shape 1 3 4) u : ℝ)) (stageBPriority (shape 1 3 4)) 1 (fun u => B1_3_4Little u ((stageBPriority (shape 1 3 4)) 1)) (fun u a => (littleLaw (shape 1 3 4) u ((stageBPriority (shape 1 3 4)) 1) a : ℝ)) (fun u _ => B1_3_4Law_sound u) (fun u _ a => B1_3_4Little_sound u ((stageBPriority (shape 1 3 4)) 1) a) 5 a +def CB1_3_4I1R5Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB1_3_4I1R5Certificates_valid : + CB1_3_4I1R5Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_3_4I1R5CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB1_3_4I1R5P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_3_4I1R5Certificates (CB1_3_4I1R5CertificateIndex a)).input +lemma CB1_3_4I1R5P_check : ∀ a : Fin 6, contains (CB1_3_4I1R5Raw a) (CB1_3_4I1R5P a) = true := by + decide +kernel +lemma CB1_3_4I1R5P_sound (a : Fin 6) : + (CB1_3_4I1R5P a).Encloses (CB1_3_4I1R5Value a) := + contains_sound (CB1_3_4I1R5Raw_sound a) (CB1_3_4I1R5P_check a) +def CB1_3_4I1R5Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_3_4I1R5Certificates (CB1_3_4I1R5CertificateIndex a)).output +lemma CB1_3_4I1R5Terms_sound (a : Fin 6) : + (CB1_3_4I1R5Terms a).Encloses (Foundation.entropyTerm (CB1_3_4I1R5Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_3_4I1R5Certificates_valid + (CB1_3_4I1R5CertificateIndex a) (CB1_3_4I1R5P_sound a) +def CB1_3_4I1R5Entropy : Ball := ⟨0, 0⟩ +lemma CB1_3_4I1R5Entropy_sound : CB1_3_4I1R5Entropy.Encloses (Foundation.finiteEntropy CB1_3_4I1R5Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_3_4I1R5Value CB1_3_4I1R5Terms CB1_3_4I1R5Terms_sound) (by decide +kernel) +def CB1_3_4I1R5Mass : Ball := ⟨0, 0⟩ +lemma CB1_3_4I1R5Mass_sound : CB1_3_4I1R5Mass.Encloses (∑ a, CB1_3_4I1R5Value a) := by + exact contains_sound (finSumBall_sound 6 CB1_3_4I1R5P CB1_3_4I1R5Value CB1_3_4I1R5P_sound) (by decide +kernel) +def CB1_3_4I1R5MassTerm : Ball := .exact 0 +lemma CB1_3_4I1R5MassTerm_sound : CB1_3_4I1R5MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_3_4I1R5Value a))) := + entropyTerm_zero_ball (CB1_3_4I1R5Mass_sound) +def CB1_3_4I1R5H : Ball := ⟨0, 0⟩ +lemma CB1_3_4I1R5H_sound : CB1_3_4I1R5H.Encloses (homogeneousEntropy CB1_3_4I1R5Value) := by + exact contains_sound (homogeneous_enclosed CB1_3_4I1R5Value CB1_3_4I1R5MassTerm_sound CB1_3_4I1R5Entropy_sound) (by decide +kernel) +def CB1_3_4I1R6Value (a : Fin 6) : ℝ := residualLaw (below (shape 1 3 4)) (fun u => (stageBLaw (shape 1 3 4) u : ℝ)) (stageBPriority (shape 1 3 4)) 1 (fun u a => (littleLaw (shape 1 3 4) u ((stageBPriority (shape 1 3 4)) 1) a : ℝ)) 6 a +def CB1_3_4I1R6Raw (a : Fin 6) : Ball := residualBall (below (shape 1 3 4)) B1_3_4Law (stageBPriority (shape 1 3 4)) 1 (fun u => B1_3_4Little u ((stageBPriority (shape 1 3 4)) 1)) 6 a +lemma CB1_3_4I1R6Raw_sound (a : Fin 6) : + (CB1_3_4I1R6Raw a).Encloses (CB1_3_4I1R6Value a) := by + exact residualBall_sound_on (below (shape 1 3 4)) B1_3_4Law (fun u => (stageBLaw (shape 1 3 4) u : ℝ)) (stageBPriority (shape 1 3 4)) 1 (fun u => B1_3_4Little u ((stageBPriority (shape 1 3 4)) 1)) (fun u a => (littleLaw (shape 1 3 4) u ((stageBPriority (shape 1 3 4)) 1) a : ℝ)) (fun u _ => B1_3_4Law_sound u) (fun u _ a => B1_3_4Little_sound u ((stageBPriority (shape 1 3 4)) 1) a) 6 a +def CB1_3_4I1R6Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB1_3_4I1R6Certificates_valid : + CB1_3_4I1R6Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_3_4I1R6CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB1_3_4I1R6P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_3_4I1R6Certificates (CB1_3_4I1R6CertificateIndex a)).input +lemma CB1_3_4I1R6P_check : ∀ a : Fin 6, contains (CB1_3_4I1R6Raw a) (CB1_3_4I1R6P a) = true := by + decide +kernel +lemma CB1_3_4I1R6P_sound (a : Fin 6) : + (CB1_3_4I1R6P a).Encloses (CB1_3_4I1R6Value a) := + contains_sound (CB1_3_4I1R6Raw_sound a) (CB1_3_4I1R6P_check a) +def CB1_3_4I1R6Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_3_4I1R6Certificates (CB1_3_4I1R6CertificateIndex a)).output +lemma CB1_3_4I1R6Terms_sound (a : Fin 6) : + (CB1_3_4I1R6Terms a).Encloses (Foundation.entropyTerm (CB1_3_4I1R6Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_3_4I1R6Certificates_valid + (CB1_3_4I1R6CertificateIndex a) (CB1_3_4I1R6P_sound a) +def CB1_3_4I1R6Entropy : Ball := ⟨0, 0⟩ +lemma CB1_3_4I1R6Entropy_sound : CB1_3_4I1R6Entropy.Encloses (Foundation.finiteEntropy CB1_3_4I1R6Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_3_4I1R6Value CB1_3_4I1R6Terms CB1_3_4I1R6Terms_sound) (by decide +kernel) +def CB1_3_4I1R6Mass : Ball := ⟨0, 0⟩ +lemma CB1_3_4I1R6Mass_sound : CB1_3_4I1R6Mass.Encloses (∑ a, CB1_3_4I1R6Value a) := by + exact contains_sound (finSumBall_sound 6 CB1_3_4I1R6P CB1_3_4I1R6Value CB1_3_4I1R6P_sound) (by decide +kernel) +def CB1_3_4I1R6MassTerm : Ball := .exact 0 +lemma CB1_3_4I1R6MassTerm_sound : CB1_3_4I1R6MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_3_4I1R6Value a))) := + entropyTerm_zero_ball (CB1_3_4I1R6Mass_sound) +def CB1_3_4I1R6H : Ball := ⟨0, 0⟩ +lemma CB1_3_4I1R6H_sound : CB1_3_4I1R6H.Encloses (homogeneousEntropy CB1_3_4I1R6Value) := by + exact contains_sound (homogeneous_enclosed CB1_3_4I1R6Value CB1_3_4I1R6MassTerm_sound CB1_3_4I1R6Entropy_sound) (by decide +kernel) +def CB1_3_4I1R7Value (a : Fin 6) : ℝ := residualLaw (below (shape 1 3 4)) (fun u => (stageBLaw (shape 1 3 4) u : ℝ)) (stageBPriority (shape 1 3 4)) 1 (fun u a => (littleLaw (shape 1 3 4) u ((stageBPriority (shape 1 3 4)) 1) a : ℝ)) 7 a +def CB1_3_4I1R7Raw (a : Fin 6) : Ball := residualBall (below (shape 1 3 4)) B1_3_4Law (stageBPriority (shape 1 3 4)) 1 (fun u => B1_3_4Little u ((stageBPriority (shape 1 3 4)) 1)) 7 a +lemma CB1_3_4I1R7Raw_sound (a : Fin 6) : + (CB1_3_4I1R7Raw a).Encloses (CB1_3_4I1R7Value a) := by + exact residualBall_sound_on (below (shape 1 3 4)) B1_3_4Law (fun u => (stageBLaw (shape 1 3 4) u : ℝ)) (stageBPriority (shape 1 3 4)) 1 (fun u => B1_3_4Little u ((stageBPriority (shape 1 3 4)) 1)) (fun u a => (littleLaw (shape 1 3 4) u ((stageBPriority (shape 1 3 4)) 1) a : ℝ)) (fun u _ => B1_3_4Law_sound u) (fun u _ a => B1_3_4Little_sound u ((stageBPriority (shape 1 3 4)) 1) a) 7 a +def CB1_3_4I1R7Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB1_3_4I1R7Certificates_valid : + CB1_3_4I1R7Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_3_4I1R7CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB1_3_4I1R7P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_3_4I1R7Certificates (CB1_3_4I1R7CertificateIndex a)).input +lemma CB1_3_4I1R7P_check : ∀ a : Fin 6, contains (CB1_3_4I1R7Raw a) (CB1_3_4I1R7P a) = true := by + decide +kernel +lemma CB1_3_4I1R7P_sound (a : Fin 6) : + (CB1_3_4I1R7P a).Encloses (CB1_3_4I1R7Value a) := + contains_sound (CB1_3_4I1R7Raw_sound a) (CB1_3_4I1R7P_check a) +def CB1_3_4I1R7Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_3_4I1R7Certificates (CB1_3_4I1R7CertificateIndex a)).output +lemma CB1_3_4I1R7Terms_sound (a : Fin 6) : + (CB1_3_4I1R7Terms a).Encloses (Foundation.entropyTerm (CB1_3_4I1R7Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_3_4I1R7Certificates_valid + (CB1_3_4I1R7CertificateIndex a) (CB1_3_4I1R7P_sound a) +def CB1_3_4I1R7Entropy : Ball := ⟨0, 0⟩ +lemma CB1_3_4I1R7Entropy_sound : CB1_3_4I1R7Entropy.Encloses (Foundation.finiteEntropy CB1_3_4I1R7Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_3_4I1R7Value CB1_3_4I1R7Terms CB1_3_4I1R7Terms_sound) (by decide +kernel) +def CB1_3_4I1R7Mass : Ball := ⟨0, 0⟩ +lemma CB1_3_4I1R7Mass_sound : CB1_3_4I1R7Mass.Encloses (∑ a, CB1_3_4I1R7Value a) := by + exact contains_sound (finSumBall_sound 6 CB1_3_4I1R7P CB1_3_4I1R7Value CB1_3_4I1R7P_sound) (by decide +kernel) +def CB1_3_4I1R7MassTerm : Ball := .exact 0 +lemma CB1_3_4I1R7MassTerm_sound : CB1_3_4I1R7MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_3_4I1R7Value a))) := + entropyTerm_zero_ball (CB1_3_4I1R7Mass_sound) +def CB1_3_4I1R7H : Ball := ⟨0, 0⟩ +lemma CB1_3_4I1R7H_sound : CB1_3_4I1R7H.Encloses (homogeneousEntropy CB1_3_4I1R7Value) := by + exact contains_sound (homogeneous_enclosed CB1_3_4I1R7Value CB1_3_4I1R7MassTerm_sound CB1_3_4I1R7Entropy_sound) (by decide +kernel) +def CB1_3_4I1R8Value (a : Fin 6) : ℝ := residualLaw (below (shape 1 3 4)) (fun u => (stageBLaw (shape 1 3 4) u : ℝ)) (stageBPriority (shape 1 3 4)) 1 (fun u a => (littleLaw (shape 1 3 4) u ((stageBPriority (shape 1 3 4)) 1) a : ℝ)) 8 a +def CB1_3_4I1R8Raw (a : Fin 6) : Ball := residualBall (below (shape 1 3 4)) B1_3_4Law (stageBPriority (shape 1 3 4)) 1 (fun u => B1_3_4Little u ((stageBPriority (shape 1 3 4)) 1)) 8 a +lemma CB1_3_4I1R8Raw_sound (a : Fin 6) : + (CB1_3_4I1R8Raw a).Encloses (CB1_3_4I1R8Value a) := by + exact residualBall_sound_on (below (shape 1 3 4)) B1_3_4Law (fun u => (stageBLaw (shape 1 3 4) u : ℝ)) (stageBPriority (shape 1 3 4)) 1 (fun u => B1_3_4Little u ((stageBPriority (shape 1 3 4)) 1)) (fun u a => (littleLaw (shape 1 3 4) u ((stageBPriority (shape 1 3 4)) 1) a : ℝ)) (fun u _ => B1_3_4Law_sound u) (fun u _ a => B1_3_4Little_sound u ((stageBPriority (shape 1 3 4)) 1) a) 8 a +def CB1_3_4I1R8Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB1_3_4I1R8Certificates_valid : + CB1_3_4I1R8Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_3_4I1R8CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB1_3_4I1R8P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_3_4I1R8Certificates (CB1_3_4I1R8CertificateIndex a)).input +lemma CB1_3_4I1R8P_check : ∀ a : Fin 6, contains (CB1_3_4I1R8Raw a) (CB1_3_4I1R8P a) = true := by + decide +kernel +lemma CB1_3_4I1R8P_sound (a : Fin 6) : + (CB1_3_4I1R8P a).Encloses (CB1_3_4I1R8Value a) := + contains_sound (CB1_3_4I1R8Raw_sound a) (CB1_3_4I1R8P_check a) +def CB1_3_4I1R8Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_3_4I1R8Certificates (CB1_3_4I1R8CertificateIndex a)).output +lemma CB1_3_4I1R8Terms_sound (a : Fin 6) : + (CB1_3_4I1R8Terms a).Encloses (Foundation.entropyTerm (CB1_3_4I1R8Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_3_4I1R8Certificates_valid + (CB1_3_4I1R8CertificateIndex a) (CB1_3_4I1R8P_sound a) +def CB1_3_4I1R8Entropy : Ball := ⟨0, 0⟩ +lemma CB1_3_4I1R8Entropy_sound : CB1_3_4I1R8Entropy.Encloses (Foundation.finiteEntropy CB1_3_4I1R8Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_3_4I1R8Value CB1_3_4I1R8Terms CB1_3_4I1R8Terms_sound) (by decide +kernel) +def CB1_3_4I1R8Mass : Ball := ⟨0, 0⟩ +lemma CB1_3_4I1R8Mass_sound : CB1_3_4I1R8Mass.Encloses (∑ a, CB1_3_4I1R8Value a) := by + exact contains_sound (finSumBall_sound 6 CB1_3_4I1R8P CB1_3_4I1R8Value CB1_3_4I1R8P_sound) (by decide +kernel) +def CB1_3_4I1R8MassTerm : Ball := .exact 0 +lemma CB1_3_4I1R8MassTerm_sound : CB1_3_4I1R8MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_3_4I1R8Value a))) := + entropyTerm_zero_ball (CB1_3_4I1R8Mass_sound) +def CB1_3_4I1R8H : Ball := ⟨0, 0⟩ +lemma CB1_3_4I1R8H_sound : CB1_3_4I1R8H.Encloses (homogeneousEntropy CB1_3_4I1R8Value) := by + exact contains_sound (homogeneous_enclosed CB1_3_4I1R8Value CB1_3_4I1R8MassTerm_sound CB1_3_4I1R8Entropy_sound) (by decide +kernel) +def CB1_3_4I1R9Value (a : Fin 6) : ℝ := residualLaw (below (shape 1 3 4)) (fun u => (stageBLaw (shape 1 3 4) u : ℝ)) (stageBPriority (shape 1 3 4)) 1 (fun u a => (littleLaw (shape 1 3 4) u ((stageBPriority (shape 1 3 4)) 1) a : ℝ)) 9 a +def CB1_3_4I1R9Raw (a : Fin 6) : Ball := residualBall (below (shape 1 3 4)) B1_3_4Law (stageBPriority (shape 1 3 4)) 1 (fun u => B1_3_4Little u ((stageBPriority (shape 1 3 4)) 1)) 9 a +lemma CB1_3_4I1R9Raw_sound (a : Fin 6) : + (CB1_3_4I1R9Raw a).Encloses (CB1_3_4I1R9Value a) := by + exact residualBall_sound_on (below (shape 1 3 4)) B1_3_4Law (fun u => (stageBLaw (shape 1 3 4) u : ℝ)) (stageBPriority (shape 1 3 4)) 1 (fun u => B1_3_4Little u ((stageBPriority (shape 1 3 4)) 1)) (fun u a => (littleLaw (shape 1 3 4) u ((stageBPriority (shape 1 3 4)) 1) a : ℝ)) (fun u _ => B1_3_4Law_sound u) (fun u _ a => B1_3_4Little_sound u ((stageBPriority (shape 1 3 4)) 1) a) 9 a +def CB1_3_4I1R9Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB1_3_4I1R9Certificates_valid : + CB1_3_4I1R9Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_3_4I1R9CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB1_3_4I1R9P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_3_4I1R9Certificates (CB1_3_4I1R9CertificateIndex a)).input +lemma CB1_3_4I1R9P_check : ∀ a : Fin 6, contains (CB1_3_4I1R9Raw a) (CB1_3_4I1R9P a) = true := by + decide +kernel +lemma CB1_3_4I1R9P_sound (a : Fin 6) : + (CB1_3_4I1R9P a).Encloses (CB1_3_4I1R9Value a) := + contains_sound (CB1_3_4I1R9Raw_sound a) (CB1_3_4I1R9P_check a) +def CB1_3_4I1R9Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_3_4I1R9Certificates (CB1_3_4I1R9CertificateIndex a)).output +lemma CB1_3_4I1R9Terms_sound (a : Fin 6) : + (CB1_3_4I1R9Terms a).Encloses (Foundation.entropyTerm (CB1_3_4I1R9Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_3_4I1R9Certificates_valid + (CB1_3_4I1R9CertificateIndex a) (CB1_3_4I1R9P_sound a) +def CB1_3_4I1R9Entropy : Ball := ⟨0, 0⟩ +lemma CB1_3_4I1R9Entropy_sound : CB1_3_4I1R9Entropy.Encloses (Foundation.finiteEntropy CB1_3_4I1R9Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_3_4I1R9Value CB1_3_4I1R9Terms CB1_3_4I1R9Terms_sound) (by decide +kernel) +def CB1_3_4I1R9Mass : Ball := ⟨0, 0⟩ +lemma CB1_3_4I1R9Mass_sound : CB1_3_4I1R9Mass.Encloses (∑ a, CB1_3_4I1R9Value a) := by + exact contains_sound (finSumBall_sound 6 CB1_3_4I1R9P CB1_3_4I1R9Value CB1_3_4I1R9P_sound) (by decide +kernel) +def CB1_3_4I1R9MassTerm : Ball := .exact 0 +lemma CB1_3_4I1R9MassTerm_sound : CB1_3_4I1R9MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_3_4I1R9Value a))) := + entropyTerm_zero_ball (CB1_3_4I1R9Mass_sound) +def CB1_3_4I1R9H : Ball := ⟨0, 0⟩ +lemma CB1_3_4I1R9H_sound : CB1_3_4I1R9H.Encloses (homogeneousEntropy CB1_3_4I1R9Value) := by + exact contains_sound (homogeneous_enclosed CB1_3_4I1R9Value CB1_3_4I1R9MassTerm_sound CB1_3_4I1R9Entropy_sound) (by decide +kernel) +def CB1_3_4I1R10Value (a : Fin 6) : ℝ := residualLaw (below (shape 1 3 4)) (fun u => (stageBLaw (shape 1 3 4) u : ℝ)) (stageBPriority (shape 1 3 4)) 1 (fun u a => (littleLaw (shape 1 3 4) u ((stageBPriority (shape 1 3 4)) 1) a : ℝ)) 10 a +def CB1_3_4I1R10Raw (a : Fin 6) : Ball := residualBall (below (shape 1 3 4)) B1_3_4Law (stageBPriority (shape 1 3 4)) 1 (fun u => B1_3_4Little u ((stageBPriority (shape 1 3 4)) 1)) 10 a +lemma CB1_3_4I1R10Raw_sound (a : Fin 6) : + (CB1_3_4I1R10Raw a).Encloses (CB1_3_4I1R10Value a) := by + exact residualBall_sound_on (below (shape 1 3 4)) B1_3_4Law (fun u => (stageBLaw (shape 1 3 4) u : ℝ)) (stageBPriority (shape 1 3 4)) 1 (fun u => B1_3_4Little u ((stageBPriority (shape 1 3 4)) 1)) (fun u a => (littleLaw (shape 1 3 4) u ((stageBPriority (shape 1 3 4)) 1) a : ℝ)) (fun u _ => B1_3_4Law_sound u) (fun u _ a => B1_3_4Little_sound u ((stageBPriority (shape 1 3 4)) 1) a) 10 a +def CB1_3_4I1R10Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB1_3_4I1R10Certificates_valid : + CB1_3_4I1R10Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_3_4I1R10CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB1_3_4I1R10P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_3_4I1R10Certificates (CB1_3_4I1R10CertificateIndex a)).input +lemma CB1_3_4I1R10P_check : ∀ a : Fin 6, contains (CB1_3_4I1R10Raw a) (CB1_3_4I1R10P a) = true := by + decide +kernel +lemma CB1_3_4I1R10P_sound (a : Fin 6) : + (CB1_3_4I1R10P a).Encloses (CB1_3_4I1R10Value a) := + contains_sound (CB1_3_4I1R10Raw_sound a) (CB1_3_4I1R10P_check a) +def CB1_3_4I1R10Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_3_4I1R10Certificates (CB1_3_4I1R10CertificateIndex a)).output +lemma CB1_3_4I1R10Terms_sound (a : Fin 6) : + (CB1_3_4I1R10Terms a).Encloses (Foundation.entropyTerm (CB1_3_4I1R10Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_3_4I1R10Certificates_valid + (CB1_3_4I1R10CertificateIndex a) (CB1_3_4I1R10P_sound a) +def CB1_3_4I1R10Entropy : Ball := ⟨0, 0⟩ +lemma CB1_3_4I1R10Entropy_sound : CB1_3_4I1R10Entropy.Encloses (Foundation.finiteEntropy CB1_3_4I1R10Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_3_4I1R10Value CB1_3_4I1R10Terms CB1_3_4I1R10Terms_sound) (by decide +kernel) +def CB1_3_4I1R10Mass : Ball := ⟨0, 0⟩ +lemma CB1_3_4I1R10Mass_sound : CB1_3_4I1R10Mass.Encloses (∑ a, CB1_3_4I1R10Value a) := by + exact contains_sound (finSumBall_sound 6 CB1_3_4I1R10P CB1_3_4I1R10Value CB1_3_4I1R10P_sound) (by decide +kernel) +def CB1_3_4I1R10MassTerm : Ball := .exact 0 +lemma CB1_3_4I1R10MassTerm_sound : CB1_3_4I1R10MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_3_4I1R10Value a))) := + entropyTerm_zero_ball (CB1_3_4I1R10Mass_sound) +def CB1_3_4I1R10H : Ball := ⟨0, 0⟩ +lemma CB1_3_4I1R10H_sound : CB1_3_4I1R10H.Encloses (homogeneousEntropy CB1_3_4I1R10Value) := by + exact contains_sound (homogeneous_enclosed CB1_3_4I1R10Value CB1_3_4I1R10MassTerm_sound CB1_3_4I1R10Entropy_sound) (by decide +kernel) +def CB1_3_4I1R11Value (a : Fin 6) : ℝ := residualLaw (below (shape 1 3 4)) (fun u => (stageBLaw (shape 1 3 4) u : ℝ)) (stageBPriority (shape 1 3 4)) 1 (fun u a => (littleLaw (shape 1 3 4) u ((stageBPriority (shape 1 3 4)) 1) a : ℝ)) 11 a +def CB1_3_4I1R11Raw (a : Fin 6) : Ball := residualBall (below (shape 1 3 4)) B1_3_4Law (stageBPriority (shape 1 3 4)) 1 (fun u => B1_3_4Little u ((stageBPriority (shape 1 3 4)) 1)) 11 a +lemma CB1_3_4I1R11Raw_sound (a : Fin 6) : + (CB1_3_4I1R11Raw a).Encloses (CB1_3_4I1R11Value a) := by + exact residualBall_sound_on (below (shape 1 3 4)) B1_3_4Law (fun u => (stageBLaw (shape 1 3 4) u : ℝ)) (stageBPriority (shape 1 3 4)) 1 (fun u => B1_3_4Little u ((stageBPriority (shape 1 3 4)) 1)) (fun u a => (littleLaw (shape 1 3 4) u ((stageBPriority (shape 1 3 4)) 1) a : ℝ)) (fun u _ => B1_3_4Law_sound u) (fun u _ a => B1_3_4Little_sound u ((stageBPriority (shape 1 3 4)) 1) a) 11 a +def CB1_3_4I1R11Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB1_3_4I1R11Certificates_valid : + CB1_3_4I1R11Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_3_4I1R11CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB1_3_4I1R11P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_3_4I1R11Certificates (CB1_3_4I1R11CertificateIndex a)).input +lemma CB1_3_4I1R11P_check : ∀ a : Fin 6, contains (CB1_3_4I1R11Raw a) (CB1_3_4I1R11P a) = true := by + decide +kernel +lemma CB1_3_4I1R11P_sound (a : Fin 6) : + (CB1_3_4I1R11P a).Encloses (CB1_3_4I1R11Value a) := + contains_sound (CB1_3_4I1R11Raw_sound a) (CB1_3_4I1R11P_check a) +def CB1_3_4I1R11Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_3_4I1R11Certificates (CB1_3_4I1R11CertificateIndex a)).output +lemma CB1_3_4I1R11Terms_sound (a : Fin 6) : + (CB1_3_4I1R11Terms a).Encloses (Foundation.entropyTerm (CB1_3_4I1R11Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_3_4I1R11Certificates_valid + (CB1_3_4I1R11CertificateIndex a) (CB1_3_4I1R11P_sound a) +def CB1_3_4I1R11Entropy : Ball := ⟨0, 0⟩ +lemma CB1_3_4I1R11Entropy_sound : CB1_3_4I1R11Entropy.Encloses (Foundation.finiteEntropy CB1_3_4I1R11Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_3_4I1R11Value CB1_3_4I1R11Terms CB1_3_4I1R11Terms_sound) (by decide +kernel) +def CB1_3_4I1R11Mass : Ball := ⟨0, 0⟩ +lemma CB1_3_4I1R11Mass_sound : CB1_3_4I1R11Mass.Encloses (∑ a, CB1_3_4I1R11Value a) := by + exact contains_sound (finSumBall_sound 6 CB1_3_4I1R11P CB1_3_4I1R11Value CB1_3_4I1R11P_sound) (by decide +kernel) +def CB1_3_4I1R11MassTerm : Ball := .exact 0 +lemma CB1_3_4I1R11MassTerm_sound : CB1_3_4I1R11MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_3_4I1R11Value a))) := + entropyTerm_zero_ball (CB1_3_4I1R11Mass_sound) +def CB1_3_4I1R11H : Ball := ⟨0, 0⟩ +lemma CB1_3_4I1R11H_sound : CB1_3_4I1R11H.Encloses (homogeneousEntropy CB1_3_4I1R11Value) := by + exact contains_sound (homogeneous_enclosed CB1_3_4I1R11Value CB1_3_4I1R11MassTerm_sound CB1_3_4I1R11Entropy_sound) (by decide +kernel) +def CB1_3_4I1R12Value (a : Fin 6) : ℝ := residualLaw (below (shape 1 3 4)) (fun u => (stageBLaw (shape 1 3 4) u : ℝ)) (stageBPriority (shape 1 3 4)) 1 (fun u a => (littleLaw (shape 1 3 4) u ((stageBPriority (shape 1 3 4)) 1) a : ℝ)) 12 a +def CB1_3_4I1R12Raw (a : Fin 6) : Ball := residualBall (below (shape 1 3 4)) B1_3_4Law (stageBPriority (shape 1 3 4)) 1 (fun u => B1_3_4Little u ((stageBPriority (shape 1 3 4)) 1)) 12 a +lemma CB1_3_4I1R12Raw_sound (a : Fin 6) : + (CB1_3_4I1R12Raw a).Encloses (CB1_3_4I1R12Value a) := by + exact residualBall_sound_on (below (shape 1 3 4)) B1_3_4Law (fun u => (stageBLaw (shape 1 3 4) u : ℝ)) (stageBPriority (shape 1 3 4)) 1 (fun u => B1_3_4Little u ((stageBPriority (shape 1 3 4)) 1)) (fun u a => (littleLaw (shape 1 3 4) u ((stageBPriority (shape 1 3 4)) 1) a : ℝ)) (fun u _ => B1_3_4Law_sound u) (fun u _ a => B1_3_4Little_sound u ((stageBPriority (shape 1 3 4)) 1) a) 12 a +def CB1_3_4I1R12Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB1_3_4I1R12Certificates_valid : + CB1_3_4I1R12Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_3_4I1R12CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB1_3_4I1R12P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_3_4I1R12Certificates (CB1_3_4I1R12CertificateIndex a)).input +lemma CB1_3_4I1R12P_check : ∀ a : Fin 6, contains (CB1_3_4I1R12Raw a) (CB1_3_4I1R12P a) = true := by + decide +kernel +lemma CB1_3_4I1R12P_sound (a : Fin 6) : + (CB1_3_4I1R12P a).Encloses (CB1_3_4I1R12Value a) := + contains_sound (CB1_3_4I1R12Raw_sound a) (CB1_3_4I1R12P_check a) +def CB1_3_4I1R12Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_3_4I1R12Certificates (CB1_3_4I1R12CertificateIndex a)).output +lemma CB1_3_4I1R12Terms_sound (a : Fin 6) : + (CB1_3_4I1R12Terms a).Encloses (Foundation.entropyTerm (CB1_3_4I1R12Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_3_4I1R12Certificates_valid + (CB1_3_4I1R12CertificateIndex a) (CB1_3_4I1R12P_sound a) +def CB1_3_4I1R12Entropy : Ball := ⟨0, 0⟩ +lemma CB1_3_4I1R12Entropy_sound : CB1_3_4I1R12Entropy.Encloses (Foundation.finiteEntropy CB1_3_4I1R12Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_3_4I1R12Value CB1_3_4I1R12Terms CB1_3_4I1R12Terms_sound) (by decide +kernel) +def CB1_3_4I1R12Mass : Ball := ⟨0, 0⟩ +lemma CB1_3_4I1R12Mass_sound : CB1_3_4I1R12Mass.Encloses (∑ a, CB1_3_4I1R12Value a) := by + exact contains_sound (finSumBall_sound 6 CB1_3_4I1R12P CB1_3_4I1R12Value CB1_3_4I1R12P_sound) (by decide +kernel) +def CB1_3_4I1R12MassTerm : Ball := .exact 0 +lemma CB1_3_4I1R12MassTerm_sound : CB1_3_4I1R12MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_3_4I1R12Value a))) := + entropyTerm_zero_ball (CB1_3_4I1R12Mass_sound) +def CB1_3_4I1R12H : Ball := ⟨0, 0⟩ +lemma CB1_3_4I1R12H_sound : CB1_3_4I1R12H.Encloses (homogeneousEntropy CB1_3_4I1R12Value) := by + exact contains_sound (homogeneous_enclosed CB1_3_4I1R12Value CB1_3_4I1R12MassTerm_sound CB1_3_4I1R12Entropy_sound) (by decide +kernel) +def CB1_3_4I1R13Value (a : Fin 6) : ℝ := residualLaw (below (shape 1 3 4)) (fun u => (stageBLaw (shape 1 3 4) u : ℝ)) (stageBPriority (shape 1 3 4)) 1 (fun u a => (littleLaw (shape 1 3 4) u ((stageBPriority (shape 1 3 4)) 1) a : ℝ)) 13 a +def CB1_3_4I1R13Raw (a : Fin 6) : Ball := residualBall (below (shape 1 3 4)) B1_3_4Law (stageBPriority (shape 1 3 4)) 1 (fun u => B1_3_4Little u ((stageBPriority (shape 1 3 4)) 1)) 13 a +lemma CB1_3_4I1R13Raw_sound (a : Fin 6) : + (CB1_3_4I1R13Raw a).Encloses (CB1_3_4I1R13Value a) := by + exact residualBall_sound_on (below (shape 1 3 4)) B1_3_4Law (fun u => (stageBLaw (shape 1 3 4) u : ℝ)) (stageBPriority (shape 1 3 4)) 1 (fun u => B1_3_4Little u ((stageBPriority (shape 1 3 4)) 1)) (fun u a => (littleLaw (shape 1 3 4) u ((stageBPriority (shape 1 3 4)) 1) a : ℝ)) (fun u _ => B1_3_4Law_sound u) (fun u _ a => B1_3_4Little_sound u ((stageBPriority (shape 1 3 4)) 1) a) 13 a +def CB1_3_4I1R13Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB1_3_4I1R13Certificates_valid : + CB1_3_4I1R13Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_3_4I1R13CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB1_3_4I1R13P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_3_4I1R13Certificates (CB1_3_4I1R13CertificateIndex a)).input +lemma CB1_3_4I1R13P_check : ∀ a : Fin 6, contains (CB1_3_4I1R13Raw a) (CB1_3_4I1R13P a) = true := by + decide +kernel +lemma CB1_3_4I1R13P_sound (a : Fin 6) : + (CB1_3_4I1R13P a).Encloses (CB1_3_4I1R13Value a) := + contains_sound (CB1_3_4I1R13Raw_sound a) (CB1_3_4I1R13P_check a) +def CB1_3_4I1R13Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_3_4I1R13Certificates (CB1_3_4I1R13CertificateIndex a)).output +lemma CB1_3_4I1R13Terms_sound (a : Fin 6) : + (CB1_3_4I1R13Terms a).Encloses (Foundation.entropyTerm (CB1_3_4I1R13Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_3_4I1R13Certificates_valid + (CB1_3_4I1R13CertificateIndex a) (CB1_3_4I1R13P_sound a) +def CB1_3_4I1R13Entropy : Ball := ⟨0, 0⟩ +lemma CB1_3_4I1R13Entropy_sound : CB1_3_4I1R13Entropy.Encloses (Foundation.finiteEntropy CB1_3_4I1R13Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_3_4I1R13Value CB1_3_4I1R13Terms CB1_3_4I1R13Terms_sound) (by decide +kernel) +def CB1_3_4I1R13Mass : Ball := ⟨0, 0⟩ +lemma CB1_3_4I1R13Mass_sound : CB1_3_4I1R13Mass.Encloses (∑ a, CB1_3_4I1R13Value a) := by + exact contains_sound (finSumBall_sound 6 CB1_3_4I1R13P CB1_3_4I1R13Value CB1_3_4I1R13P_sound) (by decide +kernel) +def CB1_3_4I1R13MassTerm : Ball := .exact 0 +lemma CB1_3_4I1R13MassTerm_sound : CB1_3_4I1R13MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_3_4I1R13Value a))) := + entropyTerm_zero_ball (CB1_3_4I1R13Mass_sound) +def CB1_3_4I1R13H : Ball := ⟨0, 0⟩ +lemma CB1_3_4I1R13H_sound : CB1_3_4I1R13H.Encloses (homogeneousEntropy CB1_3_4I1R13Value) := by + exact contains_sound (homogeneous_enclosed CB1_3_4I1R13Value CB1_3_4I1R13MassTerm_sound CB1_3_4I1R13Entropy_sound) (by decide +kernel) +def CB1_3_4I1R14Value (a : Fin 6) : ℝ := residualLaw (below (shape 1 3 4)) (fun u => (stageBLaw (shape 1 3 4) u : ℝ)) (stageBPriority (shape 1 3 4)) 1 (fun u a => (littleLaw (shape 1 3 4) u ((stageBPriority (shape 1 3 4)) 1) a : ℝ)) 14 a +def CB1_3_4I1R14Raw (a : Fin 6) : Ball := residualBall (below (shape 1 3 4)) B1_3_4Law (stageBPriority (shape 1 3 4)) 1 (fun u => B1_3_4Little u ((stageBPriority (shape 1 3 4)) 1)) 14 a +lemma CB1_3_4I1R14Raw_sound (a : Fin 6) : + (CB1_3_4I1R14Raw a).Encloses (CB1_3_4I1R14Value a) := by + exact residualBall_sound_on (below (shape 1 3 4)) B1_3_4Law (fun u => (stageBLaw (shape 1 3 4) u : ℝ)) (stageBPriority (shape 1 3 4)) 1 (fun u => B1_3_4Little u ((stageBPriority (shape 1 3 4)) 1)) (fun u a => (littleLaw (shape 1 3 4) u ((stageBPriority (shape 1 3 4)) 1) a : ℝ)) (fun u _ => B1_3_4Law_sound u) (fun u _ a => B1_3_4Little_sound u ((stageBPriority (shape 1 3 4)) 1) a) 14 a +def CB1_3_4I1R14Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB1_3_4I1R14Certificates_valid : + CB1_3_4I1R14Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_3_4I1R14CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB1_3_4I1R14P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_3_4I1R14Certificates (CB1_3_4I1R14CertificateIndex a)).input +lemma CB1_3_4I1R14P_check : ∀ a : Fin 6, contains (CB1_3_4I1R14Raw a) (CB1_3_4I1R14P a) = true := by + decide +kernel +lemma CB1_3_4I1R14P_sound (a : Fin 6) : + (CB1_3_4I1R14P a).Encloses (CB1_3_4I1R14Value a) := + contains_sound (CB1_3_4I1R14Raw_sound a) (CB1_3_4I1R14P_check a) +def CB1_3_4I1R14Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_3_4I1R14Certificates (CB1_3_4I1R14CertificateIndex a)).output +lemma CB1_3_4I1R14Terms_sound (a : Fin 6) : + (CB1_3_4I1R14Terms a).Encloses (Foundation.entropyTerm (CB1_3_4I1R14Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_3_4I1R14Certificates_valid + (CB1_3_4I1R14CertificateIndex a) (CB1_3_4I1R14P_sound a) +def CB1_3_4I1R14Entropy : Ball := ⟨0, 0⟩ +lemma CB1_3_4I1R14Entropy_sound : CB1_3_4I1R14Entropy.Encloses (Foundation.finiteEntropy CB1_3_4I1R14Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_3_4I1R14Value CB1_3_4I1R14Terms CB1_3_4I1R14Terms_sound) (by decide +kernel) +def CB1_3_4I1R14Mass : Ball := ⟨0, 0⟩ +lemma CB1_3_4I1R14Mass_sound : CB1_3_4I1R14Mass.Encloses (∑ a, CB1_3_4I1R14Value a) := by + exact contains_sound (finSumBall_sound 6 CB1_3_4I1R14P CB1_3_4I1R14Value CB1_3_4I1R14P_sound) (by decide +kernel) +def CB1_3_4I1R14MassTerm : Ball := .exact 0 +lemma CB1_3_4I1R14MassTerm_sound : CB1_3_4I1R14MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_3_4I1R14Value a))) := + entropyTerm_zero_ball (CB1_3_4I1R14Mass_sound) +def CB1_3_4I1R14H : Ball := ⟨0, 0⟩ +lemma CB1_3_4I1R14H_sound : CB1_3_4I1R14H.Encloses (homogeneousEntropy CB1_3_4I1R14Value) := by + exact contains_sound (homogeneous_enclosed CB1_3_4I1R14Value CB1_3_4I1R14MassTerm_sound CB1_3_4I1R14Entropy_sound) (by decide +kernel) +def CB1_3_4I1R15Value (a : Fin 6) : ℝ := residualLaw (below (shape 1 3 4)) (fun u => (stageBLaw (shape 1 3 4) u : ℝ)) (stageBPriority (shape 1 3 4)) 1 (fun u a => (littleLaw (shape 1 3 4) u ((stageBPriority (shape 1 3 4)) 1) a : ℝ)) 15 a +def CB1_3_4I1R15Raw (a : Fin 6) : Ball := residualBall (below (shape 1 3 4)) B1_3_4Law (stageBPriority (shape 1 3 4)) 1 (fun u => B1_3_4Little u ((stageBPriority (shape 1 3 4)) 1)) 15 a +lemma CB1_3_4I1R15Raw_sound (a : Fin 6) : + (CB1_3_4I1R15Raw a).Encloses (CB1_3_4I1R15Value a) := by + exact residualBall_sound_on (below (shape 1 3 4)) B1_3_4Law (fun u => (stageBLaw (shape 1 3 4) u : ℝ)) (stageBPriority (shape 1 3 4)) 1 (fun u => B1_3_4Little u ((stageBPriority (shape 1 3 4)) 1)) (fun u a => (littleLaw (shape 1 3 4) u ((stageBPriority (shape 1 3 4)) 1) a : ℝ)) (fun u _ => B1_3_4Law_sound u) (fun u _ a => B1_3_4Little_sound u ((stageBPriority (shape 1 3 4)) 1) a) 15 a +def CB1_3_4I1R15Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB1_3_4I1R15Certificates_valid : + CB1_3_4I1R15Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_3_4I1R15CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB1_3_4I1R15P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_3_4I1R15Certificates (CB1_3_4I1R15CertificateIndex a)).input +lemma CB1_3_4I1R15P_check : ∀ a : Fin 6, contains (CB1_3_4I1R15Raw a) (CB1_3_4I1R15P a) = true := by + decide +kernel +lemma CB1_3_4I1R15P_sound (a : Fin 6) : + (CB1_3_4I1R15P a).Encloses (CB1_3_4I1R15Value a) := + contains_sound (CB1_3_4I1R15Raw_sound a) (CB1_3_4I1R15P_check a) +def CB1_3_4I1R15Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_3_4I1R15Certificates (CB1_3_4I1R15CertificateIndex a)).output +lemma CB1_3_4I1R15Terms_sound (a : Fin 6) : + (CB1_3_4I1R15Terms a).Encloses (Foundation.entropyTerm (CB1_3_4I1R15Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_3_4I1R15Certificates_valid + (CB1_3_4I1R15CertificateIndex a) (CB1_3_4I1R15P_sound a) +def CB1_3_4I1R15Entropy : Ball := ⟨0, 0⟩ +lemma CB1_3_4I1R15Entropy_sound : CB1_3_4I1R15Entropy.Encloses (Foundation.finiteEntropy CB1_3_4I1R15Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_3_4I1R15Value CB1_3_4I1R15Terms CB1_3_4I1R15Terms_sound) (by decide +kernel) +def CB1_3_4I1R15Mass : Ball := ⟨0, 0⟩ +lemma CB1_3_4I1R15Mass_sound : CB1_3_4I1R15Mass.Encloses (∑ a, CB1_3_4I1R15Value a) := by + exact contains_sound (finSumBall_sound 6 CB1_3_4I1R15P CB1_3_4I1R15Value CB1_3_4I1R15P_sound) (by decide +kernel) +def CB1_3_4I1R15MassTerm : Ball := .exact 0 +lemma CB1_3_4I1R15MassTerm_sound : CB1_3_4I1R15MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_3_4I1R15Value a))) := + entropyTerm_zero_ball (CB1_3_4I1R15Mass_sound) +def CB1_3_4I1R15H : Ball := ⟨0, 0⟩ +lemma CB1_3_4I1R15H_sound : CB1_3_4I1R15H.Encloses (homogeneousEntropy CB1_3_4I1R15Value) := by + exact contains_sound (homogeneous_enclosed CB1_3_4I1R15Value CB1_3_4I1R15MassTerm_sound CB1_3_4I1R15Entropy_sound) (by decide +kernel) +def CB1_3_4I1R16Value (a : Fin 6) : ℝ := residualLaw (below (shape 1 3 4)) (fun u => (stageBLaw (shape 1 3 4) u : ℝ)) (stageBPriority (shape 1 3 4)) 1 (fun u a => (littleLaw (shape 1 3 4) u ((stageBPriority (shape 1 3 4)) 1) a : ℝ)) 16 a +def CB1_3_4I1R16Raw (a : Fin 6) : Ball := residualBall (below (shape 1 3 4)) B1_3_4Law (stageBPriority (shape 1 3 4)) 1 (fun u => B1_3_4Little u ((stageBPriority (shape 1 3 4)) 1)) 16 a +lemma CB1_3_4I1R16Raw_sound (a : Fin 6) : + (CB1_3_4I1R16Raw a).Encloses (CB1_3_4I1R16Value a) := by + exact residualBall_sound_on (below (shape 1 3 4)) B1_3_4Law (fun u => (stageBLaw (shape 1 3 4) u : ℝ)) (stageBPriority (shape 1 3 4)) 1 (fun u => B1_3_4Little u ((stageBPriority (shape 1 3 4)) 1)) (fun u a => (littleLaw (shape 1 3 4) u ((stageBPriority (shape 1 3 4)) 1) a : ℝ)) (fun u _ => B1_3_4Law_sound u) (fun u _ a => B1_3_4Little_sound u ((stageBPriority (shape 1 3 4)) 1) a) 16 a +def CB1_3_4I1R16Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB1_3_4I1R16Certificates_valid : + CB1_3_4I1R16Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_3_4I1R16CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB1_3_4I1R16P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_3_4I1R16Certificates (CB1_3_4I1R16CertificateIndex a)).input +lemma CB1_3_4I1R16P_check : ∀ a : Fin 6, contains (CB1_3_4I1R16Raw a) (CB1_3_4I1R16P a) = true := by + decide +kernel +lemma CB1_3_4I1R16P_sound (a : Fin 6) : + (CB1_3_4I1R16P a).Encloses (CB1_3_4I1R16Value a) := + contains_sound (CB1_3_4I1R16Raw_sound a) (CB1_3_4I1R16P_check a) +def CB1_3_4I1R16Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_3_4I1R16Certificates (CB1_3_4I1R16CertificateIndex a)).output +lemma CB1_3_4I1R16Terms_sound (a : Fin 6) : + (CB1_3_4I1R16Terms a).Encloses (Foundation.entropyTerm (CB1_3_4I1R16Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_3_4I1R16Certificates_valid + (CB1_3_4I1R16CertificateIndex a) (CB1_3_4I1R16P_sound a) +def CB1_3_4I1R16Entropy : Ball := ⟨0, 0⟩ +lemma CB1_3_4I1R16Entropy_sound : CB1_3_4I1R16Entropy.Encloses (Foundation.finiteEntropy CB1_3_4I1R16Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_3_4I1R16Value CB1_3_4I1R16Terms CB1_3_4I1R16Terms_sound) (by decide +kernel) +def CB1_3_4I1R16Mass : Ball := ⟨0, 0⟩ +lemma CB1_3_4I1R16Mass_sound : CB1_3_4I1R16Mass.Encloses (∑ a, CB1_3_4I1R16Value a) := by + exact contains_sound (finSumBall_sound 6 CB1_3_4I1R16P CB1_3_4I1R16Value CB1_3_4I1R16P_sound) (by decide +kernel) +def CB1_3_4I1R16MassTerm : Ball := .exact 0 +lemma CB1_3_4I1R16MassTerm_sound : CB1_3_4I1R16MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_3_4I1R16Value a))) := + entropyTerm_zero_ball (CB1_3_4I1R16Mass_sound) +def CB1_3_4I1R16H : Ball := ⟨0, 0⟩ +lemma CB1_3_4I1R16H_sound : CB1_3_4I1R16H.Encloses (homogeneousEntropy CB1_3_4I1R16Value) := by + exact contains_sound (homogeneous_enclosed CB1_3_4I1R16Value CB1_3_4I1R16MassTerm_sound CB1_3_4I1R16Entropy_sound) (by decide +kernel) +def CB1_3_4I1ResidualEntropies (a : Fin 17) : Ball := + match a.val with + | 0 => CB1_3_4I1R0H + | 1 => CB1_3_4I1R1H + | 2 => CB1_3_4I1R2H + | 3 => CB1_3_4I1R3H + | 4 => CB1_3_4I1R4H + | 5 => CB1_3_4I1R5H + | 6 => CB1_3_4I1R6H + | 7 => CB1_3_4I1R7H + | 8 => CB1_3_4I1R8H + | 9 => CB1_3_4I1R9H + | 10 => CB1_3_4I1R10H + | 11 => CB1_3_4I1R11H + | 12 => CB1_3_4I1R12H + | 13 => CB1_3_4I1R13H + | 14 => CB1_3_4I1R14H + | 15 => CB1_3_4I1R15H + | 16 => CB1_3_4I1R16H + | _ => (.exact 0) +lemma CB1_3_4I1ResidualEntropies_sound (k : Fin 17) : + (CB1_3_4I1ResidualEntropies k).Encloses (homogeneousEntropy + (residualLaw (below (shape 1 3 4)) (fun u => (stageBLaw (shape 1 3 4) u : ℝ)) (stageBPriority (shape 1 3 4)) 1 (fun u a => (littleLaw (shape 1 3 4) u ((stageBPriority (shape 1 3 4)) 1) a : ℝ)) k)) := by + fin_cases k + · exact CB1_3_4I1R0H_sound + · exact CB1_3_4I1R1H_sound + · exact CB1_3_4I1R2H_sound + · exact CB1_3_4I1R3H_sound + · exact CB1_3_4I1R4H_sound + · exact CB1_3_4I1R5H_sound + · exact CB1_3_4I1R6H_sound + · exact CB1_3_4I1R7H_sound + · exact CB1_3_4I1R8H_sound + · exact CB1_3_4I1R9H_sound + · exact CB1_3_4I1R10H_sound + · exact CB1_3_4I1R11H_sound + · exact CB1_3_4I1R12H_sound + · exact CB1_3_4I1R13H_sound + · exact CB1_3_4I1R14H_sound + · exact CB1_3_4I1R15H_sound + · exact CB1_3_4I1R16H_sound +def CB1_3_4I1S1_3_0Value (a : Fin 6) : ℝ := (littleLaw (shape 1 3 4) (shape 1 3 0) ((stageBPriority (shape 1 3 4)) 1) a : ℝ) +def CB1_3_4I1S1_3_0E_4Log : Ball := .exact 0 +lemma CB1_3_4I1S1_3_0E_4Log_sound : CB1_3_4I1S1_3_0E_4Log.Encloses (Real.log (CB1_3_4I1S1_3_0Value (4 : Fin 6))) := by + exact log_exact_one_ball ((B1_3_4Little_sound (shape 1 3 0) ((stageBPriority (shape 1 3 4)) 1)) (4 : Fin 6)) +def CB1_3_4I1S1_3_0E_4 : Ball := ⟨0, 0⟩ +lemma CB1_3_4I1S1_3_0E_4_sound : CB1_3_4I1S1_3_0E_4.Encloses (Foundation.entropyTerm (CB1_3_4I1S1_3_0Value (4 : Fin 6))) := by + exact contains_sound (entropyTerm_ball ((B1_3_4Little_sound (shape 1 3 0) ((stageBPriority (shape 1 3 4)) 1)) (4 : Fin 6)) CB1_3_4I1S1_3_0E_4Log_sound) (by decide +kernel) +def CB1_3_4I1S1_3_0Terms (a : Fin 6) : Ball := + match a.val with + | 4 => ⟨0, 0⟩ + | _ => (.exact 0) +lemma CB1_3_4I1S1_3_0Terms_sound (a : Fin 6) : + (CB1_3_4I1S1_3_0Terms a).Encloses (Foundation.entropyTerm (CB1_3_4I1S1_3_0Value a)) := by + fin_cases a + · exact (entropyTerm_zero_ball ((B1_3_4Little_sound (shape 1 3 0) ((stageBPriority (shape 1 3 4)) 1)) (0 : Fin 6))) + · exact (entropyTerm_zero_ball ((B1_3_4Little_sound (shape 1 3 0) ((stageBPriority (shape 1 3 4)) 1)) (1 : Fin 6))) + · exact (entropyTerm_zero_ball ((B1_3_4Little_sound (shape 1 3 0) ((stageBPriority (shape 1 3 4)) 1)) (2 : Fin 6))) + · exact (entropyTerm_zero_ball ((B1_3_4Little_sound (shape 1 3 0) ((stageBPriority (shape 1 3 4)) 1)) (3 : Fin 6))) + · exact CB1_3_4I1S1_3_0E_4_sound + · exact (entropyTerm_zero_ball ((B1_3_4Little_sound (shape 1 3 0) ((stageBPriority (shape 1 3 4)) 1)) (5 : Fin 6))) +def CB1_3_4I1S1_3_0Entropy : Ball := ⟨0, 0⟩ +lemma CB1_3_4I1S1_3_0Entropy_sound : CB1_3_4I1S1_3_0Entropy.Encloses (Foundation.finiteEntropy CB1_3_4I1S1_3_0Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_3_4I1S1_3_0Value CB1_3_4I1S1_3_0Terms CB1_3_4I1S1_3_0Terms_sound) (by decide +kernel) +def CB1_3_4I1S1_3_0Mass : Ball := ⟨1, 0⟩ +lemma CB1_3_4I1S1_3_0Mass_sound : CB1_3_4I1S1_3_0Mass.Encloses (∑ a, CB1_3_4I1S1_3_0Value a) := by + exact contains_sound (finSumBall_sound 6 (B1_3_4Little (shape 1 3 0) ((stageBPriority (shape 1 3 4)) 1)) CB1_3_4I1S1_3_0Value (B1_3_4Little_sound (shape 1 3 0) ((stageBPriority (shape 1 3 4)) 1))) (by decide +kernel) +def CB1_3_4I1S1_3_0MassTermLog : Ball := .exact 0 +lemma CB1_3_4I1S1_3_0MassTermLog_sound : CB1_3_4I1S1_3_0MassTermLog.Encloses (Real.log ((∑ a, CB1_3_4I1S1_3_0Value a))) := by + exact log_exact_one_ball (CB1_3_4I1S1_3_0Mass_sound) +def CB1_3_4I1S1_3_0MassTerm : Ball := ⟨0, 0⟩ +lemma CB1_3_4I1S1_3_0MassTerm_sound : CB1_3_4I1S1_3_0MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_3_4I1S1_3_0Value a))) := by + exact contains_sound (entropyTerm_ball (CB1_3_4I1S1_3_0Mass_sound) CB1_3_4I1S1_3_0MassTermLog_sound) (by decide +kernel) +def CB1_3_4I1S1_3_0H : Ball := ⟨0, 0⟩ +lemma CB1_3_4I1S1_3_0H_sound : CB1_3_4I1S1_3_0H.Encloses (homogeneousEntropy CB1_3_4I1S1_3_0Value) := by + exact contains_sound (homogeneous_enclosed CB1_3_4I1S1_3_0Value CB1_3_4I1S1_3_0MassTerm_sound CB1_3_4I1S1_3_0Entropy_sound) (by decide +kernel) +def CB1_3_4I1Singles (s : Shape) : Ball := + match s 0, s 1, s 2 with + | 1, 3, 0 => CB1_3_4I1S1_3_0H + | _, _, _ => (.exact 0) +lemma CB1_3_4I1Singles_sound (u : Shape) (hu : u ∈ below (shape 1 3 4)) + (hd : designated (stageBPriority (shape 1 3 4)) 1 u) : + (CB1_3_4I1Singles u).Encloses (homogeneousEntropy ((fun u a => (littleLaw (shape 1 3 4) u ((stageBPriority (shape 1 3 4)) 1) a : ℝ)) u)) := by + rw [B1_3_4_below] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl + · exact (show ¬ designated (stageBPriority (shape 1 3 4)) 1 (shape 0 0 4) by decide +kernel) hd |>.elim + · exact (show ¬ designated (stageBPriority (shape 1 3 4)) 1 (shape 0 1 3) by decide +kernel) hd |>.elim + · exact (show ¬ designated (stageBPriority (shape 1 3 4)) 1 (shape 0 2 2) by decide +kernel) hd |>.elim + · exact (show ¬ designated (stageBPriority (shape 1 3 4)) 1 (shape 0 3 1) by decide +kernel) hd |>.elim + · exact (show ¬ designated (stageBPriority (shape 1 3 4)) 1 (shape 1 0 3) by decide +kernel) hd |>.elim + · exact (show ¬ designated (stageBPriority (shape 1 3 4)) 1 (shape 1 1 2) by decide +kernel) hd |>.elim + · exact (show ¬ designated (stageBPriority (shape 1 3 4)) 1 (shape 1 2 1) by decide +kernel) hd |>.elim + · exact CB1_3_4I1S1_3_0H_sound +def CB1_3_4I1Singleton : Ball := ⟨0, 0⟩ +lemma CB1_3_4I1Singleton_sound : CB1_3_4I1Singleton.Encloses + (singletonEntropy (below (shape 1 3 4)) (fun u => (stageBLaw (shape 1 3 4) u : ℝ)) (stageBPriority (shape 1 3 4)) 1 (fun u a => (littleLaw (shape 1 3 4) u ((stageBPriority (shape 1 3 4)) 1) a : ℝ))) := by + exact contains_sound (singletonBall_sound (below (shape 1 3 4)) B1_3_4Law (fun u => (stageBLaw (shape 1 3 4) u : ℝ)) (stageBPriority (shape 1 3 4)) 1 + CB1_3_4I1Singles (fun u a => (littleLaw (shape 1 3 4) u ((stageBPriority (shape 1 3 4)) 1) a : ℝ)) (fun u _ => B1_3_4Law_sound u) CB1_3_4I1Singles_sound) (by decide +kernel) +def CB1_3_4I1Group : Ball := ⟨(3588501599890558983842193348153 / 25000000000000000000000000000000), (16911985773 / 12500000000000000000000000000000)⟩ +lemma CB1_3_4I1Group_sound : CB1_3_4I1Group.Encloses + (groupedEntropy (below (shape 1 3 4)) (fun u => (stageBLaw (shape 1 3 4) u : ℝ)) (stageBPriority (shape 1 3 4)) 1 (fun u a => (littleLaw (shape 1 3 4) u ((stageBPriority (shape 1 3 4)) 1) a : ℝ))) := by + exact contains_sound (Ball.add_sound CB1_3_4I1Singleton_sound + (finSumBall_sound 17 CB1_3_4I1ResidualEntropies _ CB1_3_4I1ResidualEntropies_sound)) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CB1_3_4I1H : Ball := ⟨(20391788088259407759566136166599 / 25000000000000000000000000000000), (363469328467 / 100000000000000000000000000000000)⟩ +lemma CB1_3_4I1_sound : CB1_3_4I1H.Encloses (stageBCapacity (shape 1 3 4) 1) := by + have hb := contains_sound (Ball.add_sound CB1_3_4I1PairH_sound + (Ball.neg_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) CB1_3_4I1Group_sound))) + (show contains (.add CB1_3_4I1PairH (.neg (.mul (.exact 2) CB1_3_4I1Group))) CB1_3_4I1H = true by decide +kernel) + unfold CB1_3_4I1PairValue at hb + simpa only [stageBCapacity, nativeCapacity, + show (1 : Fin 3) ≠ 0 by decide, ite_false, sub_eq_add_neg] using hb + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/CapacityB/CapB1_3_4I2.lean b/lean/OAI/LinearAlgebra/MatrixFields/CapacityB/CapB1_3_4I2.lean new file mode 100644 index 0000000000000000000000000000000000000000..f8fead865365ae38a0c913e5267c7d8b23950729 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/CapacityB/CapB1_3_4I2.lean @@ -0,0 +1,1042 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Certificates.LittleB1_3_4 + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CB1_3_4I2PairValue (a : PairSlot) : ℝ := pairLaw (below (shape 1 3 4)) (shape 1 3 4) (fun u => (stageBLaw (shape 1 3 4) u : ℝ)) (fun u a => (littleLaw (shape 1 3 4) u ((stageBPriority (shape 1 3 4)) 2) a : ℝ)) a +def CB1_3_4I2PairRaw (a : PairSlot) : Ball := pairLawBall (below (shape 1 3 4)) (shape 1 3 4) B1_3_4Law (fun u => B1_3_4Little u ((stageBPriority (shape 1 3 4)) 2)) a +lemma CB1_3_4I2PairRaw_sound (a : PairSlot) : + (CB1_3_4I2PairRaw a).Encloses (CB1_3_4I2PairValue a) := by + exact pairLawBall_sound_on (below (shape 1 3 4)) (shape 1 3 4) B1_3_4Law (fun u => (stageBLaw (shape 1 3 4) u : ℝ)) (fun u => B1_3_4Little u ((stageBPriority (shape 1 3 4)) 2)) (fun u a => (littleLaw (shape 1 3 4) u ((stageBPriority (shape 1 3 4)) 2) a : ℝ)) (fun u _ => B1_3_4Law_sound u) (fun u _ a => B1_3_4Little_sound u ((stageBPriority (shape 1 3 4)) 2) a) (fun u _ a => B1_3_4Little_sound (complement (shape 1 3 4) u) ((stageBPriority (shape 1 3 4)) 2) a) a +def CB1_3_4I2PairCertificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(18376602916823826473515371739 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(39518182540949711406409763533 / 25000000000000000000000000000000), (54479569 / 100000000000000000000000000000000)⟩ ⟨(-860184719010731091912411428528721 / 100000000000000000000000000000000), (296461537003 / 100000000000000000000000000000000)⟩ ⟨-13, 18376602916823826473515371739, 12207031250000000000000000000⟩, + .log ⟨(1456119070923005006600137580027 / 20000000000000000000000000000000), (3 / 20000000000000000000000000000000)⟩ ⟨(19074850750659438759889291329071 / 100000000000000000000000000000000), (963578779 / 12500000000000000000000000000000)⟩ ⟨(-130997877382158514633813346100449 / 50000000000000000000000000000000), (5293955931 / 5000000000000000000000000000000)⟩ ⟨-4, 1456119070923005006600137580027, 1250000000000000000000000000000⟩, + .log ⟨(77369303606423225289931508632371 / 100000000000000000000000000000000), (21 / 100000000000000000000000000000000)⟩ ⟨(19851421976498367966321231454091 / 100000000000000000000000000000000), (1638358733 / 5000000000000000000000000000000)⟩ ⟨(-12829003914447988076865007937373 / 50000000000000000000000000000000), (42351647393 / 100000000000000000000000000000000)⟩ ⟨-1, 77369303606423225289931508632371, 50000000000000000000000000000000⟩, + .log ⟨(4011596667753851198216770545993 / 100000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ ⟨(6450609035542397540010662179793 / 50000000000000000000000000000000), (637116479 / 12500000000000000000000000000000)⟩ ⟨(-80399521310229117688306751909523 / 25000000000000000000000000000000), (127054942147 / 100000000000000000000000000000000)⟩ ⟨-5, 4011596667753851198216770545993, 3125000000000000000000000000000⟩, + .log ⟨(4779571502687297343271865947 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(17694790791180915667743540161 / 20000000000000000000000000000000), (1518171 / 5000000000000000000000000000000)⟩ ⟨(-462771369285721572999617089651721 / 50000000000000000000000000000000), (158818682853 / 50000000000000000000000000000000)⟩ ⟨-14, 4779571502687297343271865947, 3051757812500000000000000000⟩] +lemma CB1_3_4I2PairCertificates_valid : + CB1_3_4I2PairCertificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_3_4I2PairCertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 5, 0 => 1 + | 4, 1 => 2 + | 2, 2 => 3 + | 2, 3 => 4 + | 3, 2 => 4 + | 3, 3 => 5 + | 1, 4 => 2 + | 0, 5 => 1 + | _, _ => 0 +def CB1_3_4I2PairP (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CB1_3_4I2PairCertificates (CB1_3_4I2PairCertificateIndex a)).input +lemma CB1_3_4I2PairP_check : ∀ a : PairSlot, contains (CB1_3_4I2PairRaw a) (CB1_3_4I2PairP a) = true := by + decide +kernel +lemma CB1_3_4I2PairP_sound (a : PairSlot) : + (CB1_3_4I2PairP a).Encloses (CB1_3_4I2PairValue a) := + contains_sound (CB1_3_4I2PairRaw_sound a) (CB1_3_4I2PairP_check a) +def CB1_3_4I2PairTerms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CB1_3_4I2PairCertificates (CB1_3_4I2PairCertificateIndex a)).output +lemma CB1_3_4I2PairTerms_sound (a : PairSlot) : + (CB1_3_4I2PairTerms a).Encloses (Foundation.entropyTerm (CB1_3_4I2PairValue a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_3_4I2PairCertificates_valid + (CB1_3_4I2PairCertificateIndex a) (CB1_3_4I2PairP_sound a) +def CB1_3_4I2PairEntropy : Ball := ⟨(42104089517135168957866229320237 / 50000000000000000000000000000000), (29258810673 / 50000000000000000000000000000000)⟩ +lemma CB1_3_4I2PairEntropy_sound : CB1_3_4I2PairEntropy.Encloses (Foundation.finiteEntropy CB1_3_4I2PairValue) := by + exact contains_sound (entropyPair_enclosed CB1_3_4I2PairValue CB1_3_4I2PairTerms CB1_3_4I2PairTerms_sound) (by decide +kernel) +def CB1_3_4I2PairMass : Ball := ⟨(99999999999999999999999999999999 / 100000000000000000000000000000000), (29 / 50000000000000000000000000000000)⟩ +lemma CB1_3_4I2PairMass_sound : CB1_3_4I2PairMass.Encloses (∑ a, CB1_3_4I2PairValue a) := by + exact contains_sound (pairSumBall_sound CB1_3_4I2PairP CB1_3_4I2PairValue CB1_3_4I2PairP_sound) (by decide +kernel) +def CB1_3_4I2PairMassTermLogWitness : LogWitness := ⟨-1, 99999999999999999999999999999999, 50000000000000000000000000000000⟩ +def CB1_3_4I2PairMassTermLog : Ball := ⟨0, (661744491 / 1562500000000000000000000000000)⟩ +lemma CB1_3_4I2PairMassTermLog_sound : CB1_3_4I2PairMassTermLog.Encloses (Real.log ((∑ a, CB1_3_4I2PairValue a))) := by + exact checkLog_sound logTwoBall_sound (CB1_3_4I2PairMass_sound) (w := CB1_3_4I2PairMassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB1_3_4I2PairMassTerm : Ball := ⟨0, (1694065897 / 4000000000000000000000000000000)⟩ +lemma CB1_3_4I2PairMassTerm_sound : CB1_3_4I2PairMassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_3_4I2PairValue a))) := by + exact contains_sound (entropyTerm_ball (CB1_3_4I2PairMass_sound) CB1_3_4I2PairMassTermLog_sound) (by decide +kernel) +def CB1_3_4I2PairH : Ball := ⟨(42104089517135168957866229320237 / 50000000000000000000000000000000), (100869268771 / 100000000000000000000000000000000)⟩ +lemma CB1_3_4I2PairH_sound : CB1_3_4I2PairH.Encloses (homogeneousEntropy CB1_3_4I2PairValue) := by + exact contains_sound (homogeneous_enclosed CB1_3_4I2PairValue CB1_3_4I2PairMassTerm_sound CB1_3_4I2PairEntropy_sound) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CB1_3_4I2R0Value (a : Fin 6) : ℝ := residualLaw (below (shape 1 3 4)) (fun u => (stageBLaw (shape 1 3 4) u : ℝ)) (stageBPriority (shape 1 3 4)) 2 (fun u a => (littleLaw (shape 1 3 4) u ((stageBPriority (shape 1 3 4)) 2) a : ℝ)) 0 a +def CB1_3_4I2R0Raw (a : Fin 6) : Ball := residualBall (below (shape 1 3 4)) B1_3_4Law (stageBPriority (shape 1 3 4)) 2 (fun u => B1_3_4Little u ((stageBPriority (shape 1 3 4)) 2)) 0 a +lemma CB1_3_4I2R0Raw_sound (a : Fin 6) : + (CB1_3_4I2R0Raw a).Encloses (CB1_3_4I2R0Value a) := by + exact residualBall_sound_on (below (shape 1 3 4)) B1_3_4Law (fun u => (stageBLaw (shape 1 3 4) u : ℝ)) (stageBPriority (shape 1 3 4)) 2 (fun u => B1_3_4Little u ((stageBPriority (shape 1 3 4)) 2)) (fun u a => (littleLaw (shape 1 3 4) u ((stageBPriority (shape 1 3 4)) 2) a : ℝ)) (fun u _ => B1_3_4Law_sound u) (fun u _ a => B1_3_4Little_sound u ((stageBPriority (shape 1 3 4)) 2) a) 0 a +def CB1_3_4I2R0Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(18376602916823826473515371739 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(39518182540949711406409763533 / 25000000000000000000000000000000), (54479569 / 100000000000000000000000000000000)⟩ ⟨(-860184719010731091912411428528721 / 100000000000000000000000000000000), (296461537003 / 100000000000000000000000000000000)⟩ ⟨-13, 18376602916823826473515371739, 12207031250000000000000000000⟩] +lemma CB1_3_4I2R0Certificates_valid : + CB1_3_4I2R0Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_3_4I2R0CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | 0 => 1 + | _ => 0 +def CB1_3_4I2R0P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_3_4I2R0Certificates (CB1_3_4I2R0CertificateIndex a)).input +lemma CB1_3_4I2R0P_check : ∀ a : Fin 6, contains (CB1_3_4I2R0Raw a) (CB1_3_4I2R0P a) = true := by + decide +kernel +lemma CB1_3_4I2R0P_sound (a : Fin 6) : + (CB1_3_4I2R0P a).Encloses (CB1_3_4I2R0Value a) := + contains_sound (CB1_3_4I2R0Raw_sound a) (CB1_3_4I2R0P_check a) +def CB1_3_4I2R0Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_3_4I2R0Certificates (CB1_3_4I2R0CertificateIndex a)).output +lemma CB1_3_4I2R0Terms_sound (a : Fin 6) : + (CB1_3_4I2R0Terms a).Encloses (Foundation.entropyTerm (CB1_3_4I2R0Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_3_4I2R0Certificates_valid + (CB1_3_4I2R0CertificateIndex a) (CB1_3_4I2R0P_sound a) +def CB1_3_4I2R0Entropy : Ball := ⟨(39518182540949711406409763533 / 25000000000000000000000000000000), (54479569 / 100000000000000000000000000000000)⟩ +lemma CB1_3_4I2R0Entropy_sound : CB1_3_4I2R0Entropy.Encloses (Foundation.finiteEntropy CB1_3_4I2R0Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_3_4I2R0Value CB1_3_4I2R0Terms CB1_3_4I2R0Terms_sound) (by decide +kernel) +def CB1_3_4I2R0Mass : Ball := ⟨(18376602916823826473515371739 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ +lemma CB1_3_4I2R0Mass_sound : CB1_3_4I2R0Mass.Encloses (∑ a, CB1_3_4I2R0Value a) := by + exact contains_sound (finSumBall_sound 6 CB1_3_4I2R0P CB1_3_4I2R0Value CB1_3_4I2R0P_sound) (by decide +kernel) +def CB1_3_4I2R0MassTermLogWitness : LogWitness := ⟨-13, 18376602916823826473515371739, 12207031250000000000000000000⟩ +def CB1_3_4I2R0MassTermLog : Ball := ⟨(-860184719010731091912411428528721 / 100000000000000000000000000000000), (296461537003 / 100000000000000000000000000000000)⟩ +lemma CB1_3_4I2R0MassTermLog_sound : CB1_3_4I2R0MassTermLog.Encloses (Real.log ((∑ a, CB1_3_4I2R0Value a))) := by + exact checkLog_sound logTwoBall_sound (CB1_3_4I2R0Mass_sound) (w := CB1_3_4I2R0MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB1_3_4I2R0MassTerm : Ball := ⟨(39518182540949711406409763533 / 25000000000000000000000000000000), (54479569 / 100000000000000000000000000000000)⟩ +lemma CB1_3_4I2R0MassTerm_sound : CB1_3_4I2R0MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_3_4I2R0Value a))) := by + exact contains_sound (entropyTerm_ball (CB1_3_4I2R0Mass_sound) CB1_3_4I2R0MassTermLog_sound) (by decide +kernel) +def CB1_3_4I2R0H : Ball := ⟨0, (54479569 / 50000000000000000000000000000000)⟩ +lemma CB1_3_4I2R0H_sound : CB1_3_4I2R0H.Encloses (homogeneousEntropy CB1_3_4I2R0Value) := by + exact contains_sound (homogeneous_enclosed CB1_3_4I2R0Value CB1_3_4I2R0MassTerm_sound CB1_3_4I2R0Entropy_sound) (by decide +kernel) +def CB1_3_4I2R1Value (a : Fin 6) : ℝ := residualLaw (below (shape 1 3 4)) (fun u => (stageBLaw (shape 1 3 4) u : ℝ)) (stageBPriority (shape 1 3 4)) 2 (fun u a => (littleLaw (shape 1 3 4) u ((stageBPriority (shape 1 3 4)) 2) a : ℝ)) 1 a +def CB1_3_4I2R1Raw (a : Fin 6) : Ball := residualBall (below (shape 1 3 4)) B1_3_4Law (stageBPriority (shape 1 3 4)) 2 (fun u => B1_3_4Little u ((stageBPriority (shape 1 3 4)) 2)) 1 a +lemma CB1_3_4I2R1Raw_sound (a : Fin 6) : + (CB1_3_4I2R1Raw a).Encloses (CB1_3_4I2R1Value a) := by + exact residualBall_sound_on (below (shape 1 3 4)) B1_3_4Law (fun u => (stageBLaw (shape 1 3 4) u : ℝ)) (stageBPriority (shape 1 3 4)) 2 (fun u => B1_3_4Little u ((stageBPriority (shape 1 3 4)) 2)) (fun u a => (littleLaw (shape 1 3 4) u ((stageBPriority (shape 1 3 4)) 2) a : ℝ)) (fun u _ => B1_3_4Law_sound u) (fun u _ a => B1_3_4Little_sound u ((stageBPriority (shape 1 3 4)) 2) a) 1 a +def CB1_3_4I2R1Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(1492912089080617619303408645301 / 25000000000000000000000000000000), (1 / 10000000000000000000000000000000)⟩ ⟨(4207246008919777995755135783277 / 25000000000000000000000000000000), (9484093 / 125000000000000000000000000000)⟩ ⟨(-281814719010731091912411582144759 / 100000000000000000000000000000000), (25410988453 / 20000000000000000000000000000000)⟩ ⟨-5, 1492912089080617619303408645301, 781250000000000000000000000000⟩] +lemma CB1_3_4I2R1Certificates_valid : + CB1_3_4I2R1Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_3_4I2R1CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | 1 => 1 + | _ => 0 +def CB1_3_4I2R1P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_3_4I2R1Certificates (CB1_3_4I2R1CertificateIndex a)).input +lemma CB1_3_4I2R1P_check : ∀ a : Fin 6, contains (CB1_3_4I2R1Raw a) (CB1_3_4I2R1P a) = true := by + decide +kernel +lemma CB1_3_4I2R1P_sound (a : Fin 6) : + (CB1_3_4I2R1P a).Encloses (CB1_3_4I2R1Value a) := + contains_sound (CB1_3_4I2R1Raw_sound a) (CB1_3_4I2R1P_check a) +def CB1_3_4I2R1Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_3_4I2R1Certificates (CB1_3_4I2R1CertificateIndex a)).output +lemma CB1_3_4I2R1Terms_sound (a : Fin 6) : + (CB1_3_4I2R1Terms a).Encloses (Foundation.entropyTerm (CB1_3_4I2R1Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_3_4I2R1Certificates_valid + (CB1_3_4I2R1CertificateIndex a) (CB1_3_4I2R1P_sound a) +def CB1_3_4I2R1Entropy : Ball := ⟨(4207246008919777995755135783277 / 25000000000000000000000000000000), (9484093 / 125000000000000000000000000000)⟩ +lemma CB1_3_4I2R1Entropy_sound : CB1_3_4I2R1Entropy.Encloses (Foundation.finiteEntropy CB1_3_4I2R1Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_3_4I2R1Value CB1_3_4I2R1Terms CB1_3_4I2R1Terms_sound) (by decide +kernel) +def CB1_3_4I2R1Mass : Ball := ⟨(1492912089080617619303408645301 / 25000000000000000000000000000000), (1 / 10000000000000000000000000000000)⟩ +lemma CB1_3_4I2R1Mass_sound : CB1_3_4I2R1Mass.Encloses (∑ a, CB1_3_4I2R1Value a) := by + exact contains_sound (finSumBall_sound 6 CB1_3_4I2R1P CB1_3_4I2R1Value CB1_3_4I2R1P_sound) (by decide +kernel) +def CB1_3_4I2R1MassTermLogWitness : LogWitness := ⟨-5, 1492912089080617619303408645301, 781250000000000000000000000000⟩ +def CB1_3_4I2R1MassTermLog : Ball := ⟨(-281814719010731091912411582144759 / 100000000000000000000000000000000), (25410988453 / 20000000000000000000000000000000)⟩ +lemma CB1_3_4I2R1MassTermLog_sound : CB1_3_4I2R1MassTermLog.Encloses (Real.log ((∑ a, CB1_3_4I2R1Value a))) := by + exact checkLog_sound logTwoBall_sound (CB1_3_4I2R1Mass_sound) (w := CB1_3_4I2R1MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB1_3_4I2R1MassTerm : Ball := ⟨(4207246008919777995755135783277 / 25000000000000000000000000000000), (9484093 / 125000000000000000000000000000)⟩ +lemma CB1_3_4I2R1MassTerm_sound : CB1_3_4I2R1MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_3_4I2R1Value a))) := by + exact contains_sound (entropyTerm_ball (CB1_3_4I2R1Mass_sound) CB1_3_4I2R1MassTermLog_sound) (by decide +kernel) +def CB1_3_4I2R1H : Ball := ⟨0, (9484093 / 62500000000000000000000000000)⟩ +lemma CB1_3_4I2R1H_sound : CB1_3_4I2R1H.Encloses (homogeneousEntropy CB1_3_4I2R1Value) := by + exact contains_sound (homogeneous_enclosed CB1_3_4I2R1Value CB1_3_4I2R1MassTerm_sound CB1_3_4I2R1Entropy_sound) (by decide +kernel) +def CB1_3_4I2R2Value (a : Fin 6) : ℝ := residualLaw (below (shape 1 3 4)) (fun u => (stageBLaw (shape 1 3 4) u : ℝ)) (stageBPriority (shape 1 3 4)) 2 (fun u a => (littleLaw (shape 1 3 4) u ((stageBPriority (shape 1 3 4)) 2) a : ℝ)) 2 a +def CB1_3_4I2R2Raw (a : Fin 6) : Ball := residualBall (below (shape 1 3 4)) B1_3_4Law (stageBPriority (shape 1 3 4)) 2 (fun u => B1_3_4Little u ((stageBPriority (shape 1 3 4)) 2)) 2 a +lemma CB1_3_4I2R2Raw_sound (a : Fin 6) : + (CB1_3_4I2R2Raw a).Encloses (CB1_3_4I2R2Value a) := by + exact residualBall_sound_on (below (shape 1 3 4)) B1_3_4Law (fun u => (stageBLaw (shape 1 3 4) u : ℝ)) (stageBPriority (shape 1 3 4)) 2 (fun u => B1_3_4Little u ((stageBPriority (shape 1 3 4)) 2)) (fun u a => (littleLaw (shape 1 3 4) u ((stageBPriority (shape 1 3 4)) 2) a : ℝ)) (fun u _ => B1_3_4Law_sound u) (fun u _ a => B1_3_4Little_sound u ((stageBPriority (shape 1 3 4)) 2) a) 2 a +def CB1_3_4I2R2Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(8529923200941003897310520733773 / 20000000000000000000000000000000), (3 / 25000000000000000000000000000000)⟩ ⟨(36343951973647162411118151308189 / 100000000000000000000000000000000), (27094222483 / 100000000000000000000000000000000)⟩ ⟨(-42607595774880799680820971983363 / 50000000000000000000000000000000), (63527471077 / 100000000000000000000000000000000)⟩ ⟨-2, 8529923200941003897310520733773, 5000000000000000000000000000000⟩, + .log ⟨(51412037763131653973193059261 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(194673046550446695019504475839 / 50000000000000000000000000000000), (130643079 / 100000000000000000000000000000000)⟩ ⟨(-757305312220281867581940389558343 / 100000000000000000000000000000000), (12705494307 / 5000000000000000000000000000000)⟩ ⟨-11, 51412037763131653973193059261, 48828125000000000000000000000⟩] +lemma CB1_3_4I2R2Certificates_valid : + CB1_3_4I2R2Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_3_4I2R2CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | 2 => 1 + | 3 => 2 + | _ => 0 +def CB1_3_4I2R2P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_3_4I2R2Certificates (CB1_3_4I2R2CertificateIndex a)).input +lemma CB1_3_4I2R2P_check : ∀ a : Fin 6, contains (CB1_3_4I2R2Raw a) (CB1_3_4I2R2P a) = true := by + decide +kernel +lemma CB1_3_4I2R2P_sound (a : Fin 6) : + (CB1_3_4I2R2P a).Encloses (CB1_3_4I2R2Value a) := + contains_sound (CB1_3_4I2R2Raw_sound a) (CB1_3_4I2R2P_check a) +def CB1_3_4I2R2Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_3_4I2R2Certificates (CB1_3_4I2R2CertificateIndex a)).output +lemma CB1_3_4I2R2Terms_sound (a : Fin 6) : + (CB1_3_4I2R2Terms a).Encloses (Foundation.entropyTerm (CB1_3_4I2R2Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_3_4I2R2Certificates_valid + (CB1_3_4I2R2CertificateIndex a) (CB1_3_4I2R2P_sound a) +def CB1_3_4I2R2Entropy : Ball := ⟨(36733298066748055801157160259867 / 100000000000000000000000000000000), (13612432781 / 50000000000000000000000000000000)⟩ +lemma CB1_3_4I2R2Entropy_sound : CB1_3_4I2R2Entropy.Encloses (Foundation.finiteEntropy CB1_3_4I2R2Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_3_4I2R2Value CB1_3_4I2R2Terms CB1_3_4I2R2Terms_sound) (by decide +kernel) +def CB1_3_4I2R2Mass : Ball := ⟨(21350514021234075570262898364063 / 50000000000000000000000000000000), (13 / 100000000000000000000000000000000)⟩ +lemma CB1_3_4I2R2Mass_sound : CB1_3_4I2R2Mass.Encloses (∑ a, CB1_3_4I2R2Value a) := by + exact contains_sound (finSumBall_sound 6 CB1_3_4I2R2P CB1_3_4I2R2Value CB1_3_4I2R2P_sound) (by decide +kernel) +def CB1_3_4I2R2MassTermLogWitness : LogWitness := ⟨-2, 21350514021234075570262898364063, 12500000000000000000000000000000⟩ +def CB1_3_4I2R2MassTermLog : Ball := ⟨(-85094719010731091912411638578429 / 100000000000000000000000000000000), (63527471079 / 100000000000000000000000000000000)⟩ +lemma CB1_3_4I2R2MassTermLog_sound : CB1_3_4I2R2MassTermLog.Encloses (Real.log ((∑ a, CB1_3_4I2R2Value a))) := by + exact checkLog_sound logTwoBall_sound (CB1_3_4I2R2Mass_sound) (w := CB1_3_4I2R2MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB1_3_4I2R2MassTerm : Ball := ⟨(7267263965486352088861529489067 / 20000000000000000000000000000000), (6781720813 / 25000000000000000000000000000000)⟩ +lemma CB1_3_4I2R2MassTerm_sound : CB1_3_4I2R2MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_3_4I2R2Value a))) := by + exact contains_sound (entropyTerm_ball (CB1_3_4I2R2Mass_sound) CB1_3_4I2R2MassTermLog_sound) (by decide +kernel) +def CB1_3_4I2R2H : Ball := ⟨(99244559829073839212378203633 / 25000000000000000000000000000000), (27175874407 / 50000000000000000000000000000000)⟩ +lemma CB1_3_4I2R2H_sound : CB1_3_4I2R2H.Encloses (homogeneousEntropy CB1_3_4I2R2Value) := by + exact contains_sound (homogeneous_enclosed CB1_3_4I2R2Value CB1_3_4I2R2MassTerm_sound CB1_3_4I2R2Entropy_sound) (by decide +kernel) +def CB1_3_4I2R3Value (a : Fin 6) : ℝ := residualLaw (below (shape 1 3 4)) (fun u => (stageBLaw (shape 1 3 4) u : ℝ)) (stageBPriority (shape 1 3 4)) 2 (fun u a => (littleLaw (shape 1 3 4) u ((stageBPriority (shape 1 3 4)) 2) a : ℝ)) 3 a +def CB1_3_4I2R3Raw (a : Fin 6) : Ball := residualBall (below (shape 1 3 4)) B1_3_4Law (stageBPriority (shape 1 3 4)) 2 (fun u => B1_3_4Little u ((stageBPriority (shape 1 3 4)) 2)) 3 a +lemma CB1_3_4I2R3Raw_sound (a : Fin 6) : + (CB1_3_4I2R3Raw a).Encloses (CB1_3_4I2R3Value a) := by + exact residualBall_sound_on (below (shape 1 3 4)) B1_3_4Law (fun u => (stageBLaw (shape 1 3 4) u : ℝ)) (stageBPriority (shape 1 3 4)) 2 (fun u => B1_3_4Little u ((stageBPriority (shape 1 3 4)) 2)) (fun u a => (littleLaw (shape 1 3 4) u ((stageBPriority (shape 1 3 4)) 2) a : ℝ)) (fun u _ => B1_3_4Law_sound u) (fun u _ a => B1_3_4Little_sound u ((stageBPriority (shape 1 3 4)) 2) a) 3 a +def CB1_3_4I2R3Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB1_3_4I2R3Certificates_valid : + CB1_3_4I2R3Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_3_4I2R3CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB1_3_4I2R3P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_3_4I2R3Certificates (CB1_3_4I2R3CertificateIndex a)).input +lemma CB1_3_4I2R3P_check : ∀ a : Fin 6, contains (CB1_3_4I2R3Raw a) (CB1_3_4I2R3P a) = true := by + decide +kernel +lemma CB1_3_4I2R3P_sound (a : Fin 6) : + (CB1_3_4I2R3P a).Encloses (CB1_3_4I2R3Value a) := + contains_sound (CB1_3_4I2R3Raw_sound a) (CB1_3_4I2R3P_check a) +def CB1_3_4I2R3Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_3_4I2R3Certificates (CB1_3_4I2R3CertificateIndex a)).output +lemma CB1_3_4I2R3Terms_sound (a : Fin 6) : + (CB1_3_4I2R3Terms a).Encloses (Foundation.entropyTerm (CB1_3_4I2R3Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_3_4I2R3Certificates_valid + (CB1_3_4I2R3CertificateIndex a) (CB1_3_4I2R3P_sound a) +def CB1_3_4I2R3Entropy : Ball := ⟨0, 0⟩ +lemma CB1_3_4I2R3Entropy_sound : CB1_3_4I2R3Entropy.Encloses (Foundation.finiteEntropy CB1_3_4I2R3Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_3_4I2R3Value CB1_3_4I2R3Terms CB1_3_4I2R3Terms_sound) (by decide +kernel) +def CB1_3_4I2R3Mass : Ball := ⟨0, 0⟩ +lemma CB1_3_4I2R3Mass_sound : CB1_3_4I2R3Mass.Encloses (∑ a, CB1_3_4I2R3Value a) := by + exact contains_sound (finSumBall_sound 6 CB1_3_4I2R3P CB1_3_4I2R3Value CB1_3_4I2R3P_sound) (by decide +kernel) +def CB1_3_4I2R3MassTerm : Ball := .exact 0 +lemma CB1_3_4I2R3MassTerm_sound : CB1_3_4I2R3MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_3_4I2R3Value a))) := + entropyTerm_zero_ball (CB1_3_4I2R3Mass_sound) +def CB1_3_4I2R3H : Ball := ⟨0, 0⟩ +lemma CB1_3_4I2R3H_sound : CB1_3_4I2R3H.Encloses (homogeneousEntropy CB1_3_4I2R3Value) := by + exact contains_sound (homogeneous_enclosed CB1_3_4I2R3Value CB1_3_4I2R3MassTerm_sound CB1_3_4I2R3Entropy_sound) (by decide +kernel) +def CB1_3_4I2R4Value (a : Fin 6) : ℝ := residualLaw (below (shape 1 3 4)) (fun u => (stageBLaw (shape 1 3 4) u : ℝ)) (stageBPriority (shape 1 3 4)) 2 (fun u a => (littleLaw (shape 1 3 4) u ((stageBPriority (shape 1 3 4)) 2) a : ℝ)) 4 a +def CB1_3_4I2R4Raw (a : Fin 6) : Ball := residualBall (below (shape 1 3 4)) B1_3_4Law (stageBPriority (shape 1 3 4)) 2 (fun u => B1_3_4Little u ((stageBPriority (shape 1 3 4)) 2)) 4 a +lemma CB1_3_4I2R4Raw_sound (a : Fin 6) : + (CB1_3_4I2R4Raw a).Encloses (CB1_3_4I2R4Value a) := by + exact residualBall_sound_on (below (shape 1 3 4)) B1_3_4Law (fun u => (stageBLaw (shape 1 3 4) u : ℝ)) (stageBPriority (shape 1 3 4)) 2 (fun u => B1_3_4Little u ((stageBPriority (shape 1 3 4)) 2)) (fun u a => (littleLaw (shape 1 3 4) u ((stageBPriority (shape 1 3 4)) 2) a : ℝ)) (fun u _ => B1_3_4Law_sound u) (fun u _ a => B1_3_4Little_sound u ((stageBPriority (shape 1 3 4)) 2) a) 4 a +def CB1_3_4I2R4Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB1_3_4I2R4Certificates_valid : + CB1_3_4I2R4Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_3_4I2R4CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB1_3_4I2R4P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_3_4I2R4Certificates (CB1_3_4I2R4CertificateIndex a)).input +lemma CB1_3_4I2R4P_check : ∀ a : Fin 6, contains (CB1_3_4I2R4Raw a) (CB1_3_4I2R4P a) = true := by + decide +kernel +lemma CB1_3_4I2R4P_sound (a : Fin 6) : + (CB1_3_4I2R4P a).Encloses (CB1_3_4I2R4Value a) := + contains_sound (CB1_3_4I2R4Raw_sound a) (CB1_3_4I2R4P_check a) +def CB1_3_4I2R4Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_3_4I2R4Certificates (CB1_3_4I2R4CertificateIndex a)).output +lemma CB1_3_4I2R4Terms_sound (a : Fin 6) : + (CB1_3_4I2R4Terms a).Encloses (Foundation.entropyTerm (CB1_3_4I2R4Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_3_4I2R4Certificates_valid + (CB1_3_4I2R4CertificateIndex a) (CB1_3_4I2R4P_sound a) +def CB1_3_4I2R4Entropy : Ball := ⟨0, 0⟩ +lemma CB1_3_4I2R4Entropy_sound : CB1_3_4I2R4Entropy.Encloses (Foundation.finiteEntropy CB1_3_4I2R4Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_3_4I2R4Value CB1_3_4I2R4Terms CB1_3_4I2R4Terms_sound) (by decide +kernel) +def CB1_3_4I2R4Mass : Ball := ⟨0, 0⟩ +lemma CB1_3_4I2R4Mass_sound : CB1_3_4I2R4Mass.Encloses (∑ a, CB1_3_4I2R4Value a) := by + exact contains_sound (finSumBall_sound 6 CB1_3_4I2R4P CB1_3_4I2R4Value CB1_3_4I2R4P_sound) (by decide +kernel) +def CB1_3_4I2R4MassTerm : Ball := .exact 0 +lemma CB1_3_4I2R4MassTerm_sound : CB1_3_4I2R4MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_3_4I2R4Value a))) := + entropyTerm_zero_ball (CB1_3_4I2R4Mass_sound) +def CB1_3_4I2R4H : Ball := ⟨0, 0⟩ +lemma CB1_3_4I2R4H_sound : CB1_3_4I2R4H.Encloses (homogeneousEntropy CB1_3_4I2R4Value) := by + exact contains_sound (homogeneous_enclosed CB1_3_4I2R4Value CB1_3_4I2R4MassTerm_sound CB1_3_4I2R4Entropy_sound) (by decide +kernel) +def CB1_3_4I2R5Value (a : Fin 6) : ℝ := residualLaw (below (shape 1 3 4)) (fun u => (stageBLaw (shape 1 3 4) u : ℝ)) (stageBPriority (shape 1 3 4)) 2 (fun u a => (littleLaw (shape 1 3 4) u ((stageBPriority (shape 1 3 4)) 2) a : ℝ)) 5 a +def CB1_3_4I2R5Raw (a : Fin 6) : Ball := residualBall (below (shape 1 3 4)) B1_3_4Law (stageBPriority (shape 1 3 4)) 2 (fun u => B1_3_4Little u ((stageBPriority (shape 1 3 4)) 2)) 5 a +lemma CB1_3_4I2R5Raw_sound (a : Fin 6) : + (CB1_3_4I2R5Raw a).Encloses (CB1_3_4I2R5Value a) := by + exact residualBall_sound_on (below (shape 1 3 4)) B1_3_4Law (fun u => (stageBLaw (shape 1 3 4) u : ℝ)) (stageBPriority (shape 1 3 4)) 2 (fun u => B1_3_4Little u ((stageBPriority (shape 1 3 4)) 2)) (fun u a => (littleLaw (shape 1 3 4) u ((stageBPriority (shape 1 3 4)) 2) a : ℝ)) (fun u _ => B1_3_4Law_sound u) (fun u _ a => B1_3_4Little_sound u ((stageBPriority (shape 1 3 4)) 2) a) 5 a +def CB1_3_4I2R5Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB1_3_4I2R5Certificates_valid : + CB1_3_4I2R5Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_3_4I2R5CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB1_3_4I2R5P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_3_4I2R5Certificates (CB1_3_4I2R5CertificateIndex a)).input +lemma CB1_3_4I2R5P_check : ∀ a : Fin 6, contains (CB1_3_4I2R5Raw a) (CB1_3_4I2R5P a) = true := by + decide +kernel +lemma CB1_3_4I2R5P_sound (a : Fin 6) : + (CB1_3_4I2R5P a).Encloses (CB1_3_4I2R5Value a) := + contains_sound (CB1_3_4I2R5Raw_sound a) (CB1_3_4I2R5P_check a) +def CB1_3_4I2R5Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_3_4I2R5Certificates (CB1_3_4I2R5CertificateIndex a)).output +lemma CB1_3_4I2R5Terms_sound (a : Fin 6) : + (CB1_3_4I2R5Terms a).Encloses (Foundation.entropyTerm (CB1_3_4I2R5Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_3_4I2R5Certificates_valid + (CB1_3_4I2R5CertificateIndex a) (CB1_3_4I2R5P_sound a) +def CB1_3_4I2R5Entropy : Ball := ⟨0, 0⟩ +lemma CB1_3_4I2R5Entropy_sound : CB1_3_4I2R5Entropy.Encloses (Foundation.finiteEntropy CB1_3_4I2R5Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_3_4I2R5Value CB1_3_4I2R5Terms CB1_3_4I2R5Terms_sound) (by decide +kernel) +def CB1_3_4I2R5Mass : Ball := ⟨0, 0⟩ +lemma CB1_3_4I2R5Mass_sound : CB1_3_4I2R5Mass.Encloses (∑ a, CB1_3_4I2R5Value a) := by + exact contains_sound (finSumBall_sound 6 CB1_3_4I2R5P CB1_3_4I2R5Value CB1_3_4I2R5P_sound) (by decide +kernel) +def CB1_3_4I2R5MassTerm : Ball := .exact 0 +lemma CB1_3_4I2R5MassTerm_sound : CB1_3_4I2R5MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_3_4I2R5Value a))) := + entropyTerm_zero_ball (CB1_3_4I2R5Mass_sound) +def CB1_3_4I2R5H : Ball := ⟨0, 0⟩ +lemma CB1_3_4I2R5H_sound : CB1_3_4I2R5H.Encloses (homogeneousEntropy CB1_3_4I2R5Value) := by + exact contains_sound (homogeneous_enclosed CB1_3_4I2R5Value CB1_3_4I2R5MassTerm_sound CB1_3_4I2R5Entropy_sound) (by decide +kernel) +def CB1_3_4I2R6Value (a : Fin 6) : ℝ := residualLaw (below (shape 1 3 4)) (fun u => (stageBLaw (shape 1 3 4) u : ℝ)) (stageBPriority (shape 1 3 4)) 2 (fun u a => (littleLaw (shape 1 3 4) u ((stageBPriority (shape 1 3 4)) 2) a : ℝ)) 6 a +def CB1_3_4I2R6Raw (a : Fin 6) : Ball := residualBall (below (shape 1 3 4)) B1_3_4Law (stageBPriority (shape 1 3 4)) 2 (fun u => B1_3_4Little u ((stageBPriority (shape 1 3 4)) 2)) 6 a +lemma CB1_3_4I2R6Raw_sound (a : Fin 6) : + (CB1_3_4I2R6Raw a).Encloses (CB1_3_4I2R6Value a) := by + exact residualBall_sound_on (below (shape 1 3 4)) B1_3_4Law (fun u => (stageBLaw (shape 1 3 4) u : ℝ)) (stageBPriority (shape 1 3 4)) 2 (fun u => B1_3_4Little u ((stageBPriority (shape 1 3 4)) 2)) (fun u a => (littleLaw (shape 1 3 4) u ((stageBPriority (shape 1 3 4)) 2) a : ℝ)) (fun u _ => B1_3_4Law_sound u) (fun u _ a => B1_3_4Little_sound u ((stageBPriority (shape 1 3 4)) 2) a) 6 a +def CB1_3_4I2R6Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB1_3_4I2R6Certificates_valid : + CB1_3_4I2R6Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_3_4I2R6CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB1_3_4I2R6P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_3_4I2R6Certificates (CB1_3_4I2R6CertificateIndex a)).input +lemma CB1_3_4I2R6P_check : ∀ a : Fin 6, contains (CB1_3_4I2R6Raw a) (CB1_3_4I2R6P a) = true := by + decide +kernel +lemma CB1_3_4I2R6P_sound (a : Fin 6) : + (CB1_3_4I2R6P a).Encloses (CB1_3_4I2R6Value a) := + contains_sound (CB1_3_4I2R6Raw_sound a) (CB1_3_4I2R6P_check a) +def CB1_3_4I2R6Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_3_4I2R6Certificates (CB1_3_4I2R6CertificateIndex a)).output +lemma CB1_3_4I2R6Terms_sound (a : Fin 6) : + (CB1_3_4I2R6Terms a).Encloses (Foundation.entropyTerm (CB1_3_4I2R6Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_3_4I2R6Certificates_valid + (CB1_3_4I2R6CertificateIndex a) (CB1_3_4I2R6P_sound a) +def CB1_3_4I2R6Entropy : Ball := ⟨0, 0⟩ +lemma CB1_3_4I2R6Entropy_sound : CB1_3_4I2R6Entropy.Encloses (Foundation.finiteEntropy CB1_3_4I2R6Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_3_4I2R6Value CB1_3_4I2R6Terms CB1_3_4I2R6Terms_sound) (by decide +kernel) +def CB1_3_4I2R6Mass : Ball := ⟨0, 0⟩ +lemma CB1_3_4I2R6Mass_sound : CB1_3_4I2R6Mass.Encloses (∑ a, CB1_3_4I2R6Value a) := by + exact contains_sound (finSumBall_sound 6 CB1_3_4I2R6P CB1_3_4I2R6Value CB1_3_4I2R6P_sound) (by decide +kernel) +def CB1_3_4I2R6MassTerm : Ball := .exact 0 +lemma CB1_3_4I2R6MassTerm_sound : CB1_3_4I2R6MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_3_4I2R6Value a))) := + entropyTerm_zero_ball (CB1_3_4I2R6Mass_sound) +def CB1_3_4I2R6H : Ball := ⟨0, 0⟩ +lemma CB1_3_4I2R6H_sound : CB1_3_4I2R6H.Encloses (homogeneousEntropy CB1_3_4I2R6Value) := by + exact contains_sound (homogeneous_enclosed CB1_3_4I2R6Value CB1_3_4I2R6MassTerm_sound CB1_3_4I2R6Entropy_sound) (by decide +kernel) +def CB1_3_4I2R7Value (a : Fin 6) : ℝ := residualLaw (below (shape 1 3 4)) (fun u => (stageBLaw (shape 1 3 4) u : ℝ)) (stageBPriority (shape 1 3 4)) 2 (fun u a => (littleLaw (shape 1 3 4) u ((stageBPriority (shape 1 3 4)) 2) a : ℝ)) 7 a +def CB1_3_4I2R7Raw (a : Fin 6) : Ball := residualBall (below (shape 1 3 4)) B1_3_4Law (stageBPriority (shape 1 3 4)) 2 (fun u => B1_3_4Little u ((stageBPriority (shape 1 3 4)) 2)) 7 a +lemma CB1_3_4I2R7Raw_sound (a : Fin 6) : + (CB1_3_4I2R7Raw a).Encloses (CB1_3_4I2R7Value a) := by + exact residualBall_sound_on (below (shape 1 3 4)) B1_3_4Law (fun u => (stageBLaw (shape 1 3 4) u : ℝ)) (stageBPriority (shape 1 3 4)) 2 (fun u => B1_3_4Little u ((stageBPriority (shape 1 3 4)) 2)) (fun u a => (littleLaw (shape 1 3 4) u ((stageBPriority (shape 1 3 4)) 2) a : ℝ)) (fun u _ => B1_3_4Law_sound u) (fun u _ a => B1_3_4Little_sound u ((stageBPriority (shape 1 3 4)) 2) a) 7 a +def CB1_3_4I2R7Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB1_3_4I2R7Certificates_valid : + CB1_3_4I2R7Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_3_4I2R7CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB1_3_4I2R7P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_3_4I2R7Certificates (CB1_3_4I2R7CertificateIndex a)).input +lemma CB1_3_4I2R7P_check : ∀ a : Fin 6, contains (CB1_3_4I2R7Raw a) (CB1_3_4I2R7P a) = true := by + decide +kernel +lemma CB1_3_4I2R7P_sound (a : Fin 6) : + (CB1_3_4I2R7P a).Encloses (CB1_3_4I2R7Value a) := + contains_sound (CB1_3_4I2R7Raw_sound a) (CB1_3_4I2R7P_check a) +def CB1_3_4I2R7Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_3_4I2R7Certificates (CB1_3_4I2R7CertificateIndex a)).output +lemma CB1_3_4I2R7Terms_sound (a : Fin 6) : + (CB1_3_4I2R7Terms a).Encloses (Foundation.entropyTerm (CB1_3_4I2R7Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_3_4I2R7Certificates_valid + (CB1_3_4I2R7CertificateIndex a) (CB1_3_4I2R7P_sound a) +def CB1_3_4I2R7Entropy : Ball := ⟨0, 0⟩ +lemma CB1_3_4I2R7Entropy_sound : CB1_3_4I2R7Entropy.Encloses (Foundation.finiteEntropy CB1_3_4I2R7Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_3_4I2R7Value CB1_3_4I2R7Terms CB1_3_4I2R7Terms_sound) (by decide +kernel) +def CB1_3_4I2R7Mass : Ball := ⟨0, 0⟩ +lemma CB1_3_4I2R7Mass_sound : CB1_3_4I2R7Mass.Encloses (∑ a, CB1_3_4I2R7Value a) := by + exact contains_sound (finSumBall_sound 6 CB1_3_4I2R7P CB1_3_4I2R7Value CB1_3_4I2R7P_sound) (by decide +kernel) +def CB1_3_4I2R7MassTerm : Ball := .exact 0 +lemma CB1_3_4I2R7MassTerm_sound : CB1_3_4I2R7MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_3_4I2R7Value a))) := + entropyTerm_zero_ball (CB1_3_4I2R7Mass_sound) +def CB1_3_4I2R7H : Ball := ⟨0, 0⟩ +lemma CB1_3_4I2R7H_sound : CB1_3_4I2R7H.Encloses (homogeneousEntropy CB1_3_4I2R7Value) := by + exact contains_sound (homogeneous_enclosed CB1_3_4I2R7Value CB1_3_4I2R7MassTerm_sound CB1_3_4I2R7Entropy_sound) (by decide +kernel) +def CB1_3_4I2R8Value (a : Fin 6) : ℝ := residualLaw (below (shape 1 3 4)) (fun u => (stageBLaw (shape 1 3 4) u : ℝ)) (stageBPriority (shape 1 3 4)) 2 (fun u a => (littleLaw (shape 1 3 4) u ((stageBPriority (shape 1 3 4)) 2) a : ℝ)) 8 a +def CB1_3_4I2R8Raw (a : Fin 6) : Ball := residualBall (below (shape 1 3 4)) B1_3_4Law (stageBPriority (shape 1 3 4)) 2 (fun u => B1_3_4Little u ((stageBPriority (shape 1 3 4)) 2)) 8 a +lemma CB1_3_4I2R8Raw_sound (a : Fin 6) : + (CB1_3_4I2R8Raw a).Encloses (CB1_3_4I2R8Value a) := by + exact residualBall_sound_on (below (shape 1 3 4)) B1_3_4Law (fun u => (stageBLaw (shape 1 3 4) u : ℝ)) (stageBPriority (shape 1 3 4)) 2 (fun u => B1_3_4Little u ((stageBPriority (shape 1 3 4)) 2)) (fun u a => (littleLaw (shape 1 3 4) u ((stageBPriority (shape 1 3 4)) 2) a : ℝ)) (fun u _ => B1_3_4Law_sound u) (fun u _ a => B1_3_4Little_sound u ((stageBPriority (shape 1 3 4)) 2) a) 8 a +def CB1_3_4I2R8Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB1_3_4I2R8Certificates_valid : + CB1_3_4I2R8Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_3_4I2R8CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB1_3_4I2R8P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_3_4I2R8Certificates (CB1_3_4I2R8CertificateIndex a)).input +lemma CB1_3_4I2R8P_check : ∀ a : Fin 6, contains (CB1_3_4I2R8Raw a) (CB1_3_4I2R8P a) = true := by + decide +kernel +lemma CB1_3_4I2R8P_sound (a : Fin 6) : + (CB1_3_4I2R8P a).Encloses (CB1_3_4I2R8Value a) := + contains_sound (CB1_3_4I2R8Raw_sound a) (CB1_3_4I2R8P_check a) +def CB1_3_4I2R8Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_3_4I2R8Certificates (CB1_3_4I2R8CertificateIndex a)).output +lemma CB1_3_4I2R8Terms_sound (a : Fin 6) : + (CB1_3_4I2R8Terms a).Encloses (Foundation.entropyTerm (CB1_3_4I2R8Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_3_4I2R8Certificates_valid + (CB1_3_4I2R8CertificateIndex a) (CB1_3_4I2R8P_sound a) +def CB1_3_4I2R8Entropy : Ball := ⟨0, 0⟩ +lemma CB1_3_4I2R8Entropy_sound : CB1_3_4I2R8Entropy.Encloses (Foundation.finiteEntropy CB1_3_4I2R8Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_3_4I2R8Value CB1_3_4I2R8Terms CB1_3_4I2R8Terms_sound) (by decide +kernel) +def CB1_3_4I2R8Mass : Ball := ⟨0, 0⟩ +lemma CB1_3_4I2R8Mass_sound : CB1_3_4I2R8Mass.Encloses (∑ a, CB1_3_4I2R8Value a) := by + exact contains_sound (finSumBall_sound 6 CB1_3_4I2R8P CB1_3_4I2R8Value CB1_3_4I2R8P_sound) (by decide +kernel) +def CB1_3_4I2R8MassTerm : Ball := .exact 0 +lemma CB1_3_4I2R8MassTerm_sound : CB1_3_4I2R8MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_3_4I2R8Value a))) := + entropyTerm_zero_ball (CB1_3_4I2R8Mass_sound) +def CB1_3_4I2R8H : Ball := ⟨0, 0⟩ +lemma CB1_3_4I2R8H_sound : CB1_3_4I2R8H.Encloses (homogeneousEntropy CB1_3_4I2R8Value) := by + exact contains_sound (homogeneous_enclosed CB1_3_4I2R8Value CB1_3_4I2R8MassTerm_sound CB1_3_4I2R8Entropy_sound) (by decide +kernel) +def CB1_3_4I2R9Value (a : Fin 6) : ℝ := residualLaw (below (shape 1 3 4)) (fun u => (stageBLaw (shape 1 3 4) u : ℝ)) (stageBPriority (shape 1 3 4)) 2 (fun u a => (littleLaw (shape 1 3 4) u ((stageBPriority (shape 1 3 4)) 2) a : ℝ)) 9 a +def CB1_3_4I2R9Raw (a : Fin 6) : Ball := residualBall (below (shape 1 3 4)) B1_3_4Law (stageBPriority (shape 1 3 4)) 2 (fun u => B1_3_4Little u ((stageBPriority (shape 1 3 4)) 2)) 9 a +lemma CB1_3_4I2R9Raw_sound (a : Fin 6) : + (CB1_3_4I2R9Raw a).Encloses (CB1_3_4I2R9Value a) := by + exact residualBall_sound_on (below (shape 1 3 4)) B1_3_4Law (fun u => (stageBLaw (shape 1 3 4) u : ℝ)) (stageBPriority (shape 1 3 4)) 2 (fun u => B1_3_4Little u ((stageBPriority (shape 1 3 4)) 2)) (fun u a => (littleLaw (shape 1 3 4) u ((stageBPriority (shape 1 3 4)) 2) a : ℝ)) (fun u _ => B1_3_4Law_sound u) (fun u _ a => B1_3_4Little_sound u ((stageBPriority (shape 1 3 4)) 2) a) 9 a +def CB1_3_4I2R9Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB1_3_4I2R9Certificates_valid : + CB1_3_4I2R9Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_3_4I2R9CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB1_3_4I2R9P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_3_4I2R9Certificates (CB1_3_4I2R9CertificateIndex a)).input +lemma CB1_3_4I2R9P_check : ∀ a : Fin 6, contains (CB1_3_4I2R9Raw a) (CB1_3_4I2R9P a) = true := by + decide +kernel +lemma CB1_3_4I2R9P_sound (a : Fin 6) : + (CB1_3_4I2R9P a).Encloses (CB1_3_4I2R9Value a) := + contains_sound (CB1_3_4I2R9Raw_sound a) (CB1_3_4I2R9P_check a) +def CB1_3_4I2R9Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_3_4I2R9Certificates (CB1_3_4I2R9CertificateIndex a)).output +lemma CB1_3_4I2R9Terms_sound (a : Fin 6) : + (CB1_3_4I2R9Terms a).Encloses (Foundation.entropyTerm (CB1_3_4I2R9Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_3_4I2R9Certificates_valid + (CB1_3_4I2R9CertificateIndex a) (CB1_3_4I2R9P_sound a) +def CB1_3_4I2R9Entropy : Ball := ⟨0, 0⟩ +lemma CB1_3_4I2R9Entropy_sound : CB1_3_4I2R9Entropy.Encloses (Foundation.finiteEntropy CB1_3_4I2R9Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_3_4I2R9Value CB1_3_4I2R9Terms CB1_3_4I2R9Terms_sound) (by decide +kernel) +def CB1_3_4I2R9Mass : Ball := ⟨0, 0⟩ +lemma CB1_3_4I2R9Mass_sound : CB1_3_4I2R9Mass.Encloses (∑ a, CB1_3_4I2R9Value a) := by + exact contains_sound (finSumBall_sound 6 CB1_3_4I2R9P CB1_3_4I2R9Value CB1_3_4I2R9P_sound) (by decide +kernel) +def CB1_3_4I2R9MassTerm : Ball := .exact 0 +lemma CB1_3_4I2R9MassTerm_sound : CB1_3_4I2R9MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_3_4I2R9Value a))) := + entropyTerm_zero_ball (CB1_3_4I2R9Mass_sound) +def CB1_3_4I2R9H : Ball := ⟨0, 0⟩ +lemma CB1_3_4I2R9H_sound : CB1_3_4I2R9H.Encloses (homogeneousEntropy CB1_3_4I2R9Value) := by + exact contains_sound (homogeneous_enclosed CB1_3_4I2R9Value CB1_3_4I2R9MassTerm_sound CB1_3_4I2R9Entropy_sound) (by decide +kernel) +def CB1_3_4I2R10Value (a : Fin 6) : ℝ := residualLaw (below (shape 1 3 4)) (fun u => (stageBLaw (shape 1 3 4) u : ℝ)) (stageBPriority (shape 1 3 4)) 2 (fun u a => (littleLaw (shape 1 3 4) u ((stageBPriority (shape 1 3 4)) 2) a : ℝ)) 10 a +def CB1_3_4I2R10Raw (a : Fin 6) : Ball := residualBall (below (shape 1 3 4)) B1_3_4Law (stageBPriority (shape 1 3 4)) 2 (fun u => B1_3_4Little u ((stageBPriority (shape 1 3 4)) 2)) 10 a +lemma CB1_3_4I2R10Raw_sound (a : Fin 6) : + (CB1_3_4I2R10Raw a).Encloses (CB1_3_4I2R10Value a) := by + exact residualBall_sound_on (below (shape 1 3 4)) B1_3_4Law (fun u => (stageBLaw (shape 1 3 4) u : ℝ)) (stageBPriority (shape 1 3 4)) 2 (fun u => B1_3_4Little u ((stageBPriority (shape 1 3 4)) 2)) (fun u a => (littleLaw (shape 1 3 4) u ((stageBPriority (shape 1 3 4)) 2) a : ℝ)) (fun u _ => B1_3_4Law_sound u) (fun u _ a => B1_3_4Little_sound u ((stageBPriority (shape 1 3 4)) 2) a) 10 a +def CB1_3_4I2R10Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB1_3_4I2R10Certificates_valid : + CB1_3_4I2R10Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_3_4I2R10CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB1_3_4I2R10P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_3_4I2R10Certificates (CB1_3_4I2R10CertificateIndex a)).input +lemma CB1_3_4I2R10P_check : ∀ a : Fin 6, contains (CB1_3_4I2R10Raw a) (CB1_3_4I2R10P a) = true := by + decide +kernel +lemma CB1_3_4I2R10P_sound (a : Fin 6) : + (CB1_3_4I2R10P a).Encloses (CB1_3_4I2R10Value a) := + contains_sound (CB1_3_4I2R10Raw_sound a) (CB1_3_4I2R10P_check a) +def CB1_3_4I2R10Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_3_4I2R10Certificates (CB1_3_4I2R10CertificateIndex a)).output +lemma CB1_3_4I2R10Terms_sound (a : Fin 6) : + (CB1_3_4I2R10Terms a).Encloses (Foundation.entropyTerm (CB1_3_4I2R10Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_3_4I2R10Certificates_valid + (CB1_3_4I2R10CertificateIndex a) (CB1_3_4I2R10P_sound a) +def CB1_3_4I2R10Entropy : Ball := ⟨0, 0⟩ +lemma CB1_3_4I2R10Entropy_sound : CB1_3_4I2R10Entropy.Encloses (Foundation.finiteEntropy CB1_3_4I2R10Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_3_4I2R10Value CB1_3_4I2R10Terms CB1_3_4I2R10Terms_sound) (by decide +kernel) +def CB1_3_4I2R10Mass : Ball := ⟨0, 0⟩ +lemma CB1_3_4I2R10Mass_sound : CB1_3_4I2R10Mass.Encloses (∑ a, CB1_3_4I2R10Value a) := by + exact contains_sound (finSumBall_sound 6 CB1_3_4I2R10P CB1_3_4I2R10Value CB1_3_4I2R10P_sound) (by decide +kernel) +def CB1_3_4I2R10MassTerm : Ball := .exact 0 +lemma CB1_3_4I2R10MassTerm_sound : CB1_3_4I2R10MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_3_4I2R10Value a))) := + entropyTerm_zero_ball (CB1_3_4I2R10Mass_sound) +def CB1_3_4I2R10H : Ball := ⟨0, 0⟩ +lemma CB1_3_4I2R10H_sound : CB1_3_4I2R10H.Encloses (homogeneousEntropy CB1_3_4I2R10Value) := by + exact contains_sound (homogeneous_enclosed CB1_3_4I2R10Value CB1_3_4I2R10MassTerm_sound CB1_3_4I2R10Entropy_sound) (by decide +kernel) +def CB1_3_4I2R11Value (a : Fin 6) : ℝ := residualLaw (below (shape 1 3 4)) (fun u => (stageBLaw (shape 1 3 4) u : ℝ)) (stageBPriority (shape 1 3 4)) 2 (fun u a => (littleLaw (shape 1 3 4) u ((stageBPriority (shape 1 3 4)) 2) a : ℝ)) 11 a +def CB1_3_4I2R11Raw (a : Fin 6) : Ball := residualBall (below (shape 1 3 4)) B1_3_4Law (stageBPriority (shape 1 3 4)) 2 (fun u => B1_3_4Little u ((stageBPriority (shape 1 3 4)) 2)) 11 a +lemma CB1_3_4I2R11Raw_sound (a : Fin 6) : + (CB1_3_4I2R11Raw a).Encloses (CB1_3_4I2R11Value a) := by + exact residualBall_sound_on (below (shape 1 3 4)) B1_3_4Law (fun u => (stageBLaw (shape 1 3 4) u : ℝ)) (stageBPriority (shape 1 3 4)) 2 (fun u => B1_3_4Little u ((stageBPriority (shape 1 3 4)) 2)) (fun u a => (littleLaw (shape 1 3 4) u ((stageBPriority (shape 1 3 4)) 2) a : ℝ)) (fun u _ => B1_3_4Law_sound u) (fun u _ a => B1_3_4Little_sound u ((stageBPriority (shape 1 3 4)) 2) a) 11 a +def CB1_3_4I2R11Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB1_3_4I2R11Certificates_valid : + CB1_3_4I2R11Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_3_4I2R11CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB1_3_4I2R11P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_3_4I2R11Certificates (CB1_3_4I2R11CertificateIndex a)).input +lemma CB1_3_4I2R11P_check : ∀ a : Fin 6, contains (CB1_3_4I2R11Raw a) (CB1_3_4I2R11P a) = true := by + decide +kernel +lemma CB1_3_4I2R11P_sound (a : Fin 6) : + (CB1_3_4I2R11P a).Encloses (CB1_3_4I2R11Value a) := + contains_sound (CB1_3_4I2R11Raw_sound a) (CB1_3_4I2R11P_check a) +def CB1_3_4I2R11Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_3_4I2R11Certificates (CB1_3_4I2R11CertificateIndex a)).output +lemma CB1_3_4I2R11Terms_sound (a : Fin 6) : + (CB1_3_4I2R11Terms a).Encloses (Foundation.entropyTerm (CB1_3_4I2R11Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_3_4I2R11Certificates_valid + (CB1_3_4I2R11CertificateIndex a) (CB1_3_4I2R11P_sound a) +def CB1_3_4I2R11Entropy : Ball := ⟨0, 0⟩ +lemma CB1_3_4I2R11Entropy_sound : CB1_3_4I2R11Entropy.Encloses (Foundation.finiteEntropy CB1_3_4I2R11Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_3_4I2R11Value CB1_3_4I2R11Terms CB1_3_4I2R11Terms_sound) (by decide +kernel) +def CB1_3_4I2R11Mass : Ball := ⟨0, 0⟩ +lemma CB1_3_4I2R11Mass_sound : CB1_3_4I2R11Mass.Encloses (∑ a, CB1_3_4I2R11Value a) := by + exact contains_sound (finSumBall_sound 6 CB1_3_4I2R11P CB1_3_4I2R11Value CB1_3_4I2R11P_sound) (by decide +kernel) +def CB1_3_4I2R11MassTerm : Ball := .exact 0 +lemma CB1_3_4I2R11MassTerm_sound : CB1_3_4I2R11MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_3_4I2R11Value a))) := + entropyTerm_zero_ball (CB1_3_4I2R11Mass_sound) +def CB1_3_4I2R11H : Ball := ⟨0, 0⟩ +lemma CB1_3_4I2R11H_sound : CB1_3_4I2R11H.Encloses (homogeneousEntropy CB1_3_4I2R11Value) := by + exact contains_sound (homogeneous_enclosed CB1_3_4I2R11Value CB1_3_4I2R11MassTerm_sound CB1_3_4I2R11Entropy_sound) (by decide +kernel) +def CB1_3_4I2R12Value (a : Fin 6) : ℝ := residualLaw (below (shape 1 3 4)) (fun u => (stageBLaw (shape 1 3 4) u : ℝ)) (stageBPriority (shape 1 3 4)) 2 (fun u a => (littleLaw (shape 1 3 4) u ((stageBPriority (shape 1 3 4)) 2) a : ℝ)) 12 a +def CB1_3_4I2R12Raw (a : Fin 6) : Ball := residualBall (below (shape 1 3 4)) B1_3_4Law (stageBPriority (shape 1 3 4)) 2 (fun u => B1_3_4Little u ((stageBPriority (shape 1 3 4)) 2)) 12 a +lemma CB1_3_4I2R12Raw_sound (a : Fin 6) : + (CB1_3_4I2R12Raw a).Encloses (CB1_3_4I2R12Value a) := by + exact residualBall_sound_on (below (shape 1 3 4)) B1_3_4Law (fun u => (stageBLaw (shape 1 3 4) u : ℝ)) (stageBPriority (shape 1 3 4)) 2 (fun u => B1_3_4Little u ((stageBPriority (shape 1 3 4)) 2)) (fun u a => (littleLaw (shape 1 3 4) u ((stageBPriority (shape 1 3 4)) 2) a : ℝ)) (fun u _ => B1_3_4Law_sound u) (fun u _ a => B1_3_4Little_sound u ((stageBPriority (shape 1 3 4)) 2) a) 12 a +def CB1_3_4I2R12Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB1_3_4I2R12Certificates_valid : + CB1_3_4I2R12Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_3_4I2R12CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB1_3_4I2R12P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_3_4I2R12Certificates (CB1_3_4I2R12CertificateIndex a)).input +lemma CB1_3_4I2R12P_check : ∀ a : Fin 6, contains (CB1_3_4I2R12Raw a) (CB1_3_4I2R12P a) = true := by + decide +kernel +lemma CB1_3_4I2R12P_sound (a : Fin 6) : + (CB1_3_4I2R12P a).Encloses (CB1_3_4I2R12Value a) := + contains_sound (CB1_3_4I2R12Raw_sound a) (CB1_3_4I2R12P_check a) +def CB1_3_4I2R12Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_3_4I2R12Certificates (CB1_3_4I2R12CertificateIndex a)).output +lemma CB1_3_4I2R12Terms_sound (a : Fin 6) : + (CB1_3_4I2R12Terms a).Encloses (Foundation.entropyTerm (CB1_3_4I2R12Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_3_4I2R12Certificates_valid + (CB1_3_4I2R12CertificateIndex a) (CB1_3_4I2R12P_sound a) +def CB1_3_4I2R12Entropy : Ball := ⟨0, 0⟩ +lemma CB1_3_4I2R12Entropy_sound : CB1_3_4I2R12Entropy.Encloses (Foundation.finiteEntropy CB1_3_4I2R12Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_3_4I2R12Value CB1_3_4I2R12Terms CB1_3_4I2R12Terms_sound) (by decide +kernel) +def CB1_3_4I2R12Mass : Ball := ⟨0, 0⟩ +lemma CB1_3_4I2R12Mass_sound : CB1_3_4I2R12Mass.Encloses (∑ a, CB1_3_4I2R12Value a) := by + exact contains_sound (finSumBall_sound 6 CB1_3_4I2R12P CB1_3_4I2R12Value CB1_3_4I2R12P_sound) (by decide +kernel) +def CB1_3_4I2R12MassTerm : Ball := .exact 0 +lemma CB1_3_4I2R12MassTerm_sound : CB1_3_4I2R12MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_3_4I2R12Value a))) := + entropyTerm_zero_ball (CB1_3_4I2R12Mass_sound) +def CB1_3_4I2R12H : Ball := ⟨0, 0⟩ +lemma CB1_3_4I2R12H_sound : CB1_3_4I2R12H.Encloses (homogeneousEntropy CB1_3_4I2R12Value) := by + exact contains_sound (homogeneous_enclosed CB1_3_4I2R12Value CB1_3_4I2R12MassTerm_sound CB1_3_4I2R12Entropy_sound) (by decide +kernel) +def CB1_3_4I2R13Value (a : Fin 6) : ℝ := residualLaw (below (shape 1 3 4)) (fun u => (stageBLaw (shape 1 3 4) u : ℝ)) (stageBPriority (shape 1 3 4)) 2 (fun u a => (littleLaw (shape 1 3 4) u ((stageBPriority (shape 1 3 4)) 2) a : ℝ)) 13 a +def CB1_3_4I2R13Raw (a : Fin 6) : Ball := residualBall (below (shape 1 3 4)) B1_3_4Law (stageBPriority (shape 1 3 4)) 2 (fun u => B1_3_4Little u ((stageBPriority (shape 1 3 4)) 2)) 13 a +lemma CB1_3_4I2R13Raw_sound (a : Fin 6) : + (CB1_3_4I2R13Raw a).Encloses (CB1_3_4I2R13Value a) := by + exact residualBall_sound_on (below (shape 1 3 4)) B1_3_4Law (fun u => (stageBLaw (shape 1 3 4) u : ℝ)) (stageBPriority (shape 1 3 4)) 2 (fun u => B1_3_4Little u ((stageBPriority (shape 1 3 4)) 2)) (fun u a => (littleLaw (shape 1 3 4) u ((stageBPriority (shape 1 3 4)) 2) a : ℝ)) (fun u _ => B1_3_4Law_sound u) (fun u _ a => B1_3_4Little_sound u ((stageBPriority (shape 1 3 4)) 2) a) 13 a +def CB1_3_4I2R13Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB1_3_4I2R13Certificates_valid : + CB1_3_4I2R13Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_3_4I2R13CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB1_3_4I2R13P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_3_4I2R13Certificates (CB1_3_4I2R13CertificateIndex a)).input +lemma CB1_3_4I2R13P_check : ∀ a : Fin 6, contains (CB1_3_4I2R13Raw a) (CB1_3_4I2R13P a) = true := by + decide +kernel +lemma CB1_3_4I2R13P_sound (a : Fin 6) : + (CB1_3_4I2R13P a).Encloses (CB1_3_4I2R13Value a) := + contains_sound (CB1_3_4I2R13Raw_sound a) (CB1_3_4I2R13P_check a) +def CB1_3_4I2R13Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_3_4I2R13Certificates (CB1_3_4I2R13CertificateIndex a)).output +lemma CB1_3_4I2R13Terms_sound (a : Fin 6) : + (CB1_3_4I2R13Terms a).Encloses (Foundation.entropyTerm (CB1_3_4I2R13Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_3_4I2R13Certificates_valid + (CB1_3_4I2R13CertificateIndex a) (CB1_3_4I2R13P_sound a) +def CB1_3_4I2R13Entropy : Ball := ⟨0, 0⟩ +lemma CB1_3_4I2R13Entropy_sound : CB1_3_4I2R13Entropy.Encloses (Foundation.finiteEntropy CB1_3_4I2R13Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_3_4I2R13Value CB1_3_4I2R13Terms CB1_3_4I2R13Terms_sound) (by decide +kernel) +def CB1_3_4I2R13Mass : Ball := ⟨0, 0⟩ +lemma CB1_3_4I2R13Mass_sound : CB1_3_4I2R13Mass.Encloses (∑ a, CB1_3_4I2R13Value a) := by + exact contains_sound (finSumBall_sound 6 CB1_3_4I2R13P CB1_3_4I2R13Value CB1_3_4I2R13P_sound) (by decide +kernel) +def CB1_3_4I2R13MassTerm : Ball := .exact 0 +lemma CB1_3_4I2R13MassTerm_sound : CB1_3_4I2R13MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_3_4I2R13Value a))) := + entropyTerm_zero_ball (CB1_3_4I2R13Mass_sound) +def CB1_3_4I2R13H : Ball := ⟨0, 0⟩ +lemma CB1_3_4I2R13H_sound : CB1_3_4I2R13H.Encloses (homogeneousEntropy CB1_3_4I2R13Value) := by + exact contains_sound (homogeneous_enclosed CB1_3_4I2R13Value CB1_3_4I2R13MassTerm_sound CB1_3_4I2R13Entropy_sound) (by decide +kernel) +def CB1_3_4I2R14Value (a : Fin 6) : ℝ := residualLaw (below (shape 1 3 4)) (fun u => (stageBLaw (shape 1 3 4) u : ℝ)) (stageBPriority (shape 1 3 4)) 2 (fun u a => (littleLaw (shape 1 3 4) u ((stageBPriority (shape 1 3 4)) 2) a : ℝ)) 14 a +def CB1_3_4I2R14Raw (a : Fin 6) : Ball := residualBall (below (shape 1 3 4)) B1_3_4Law (stageBPriority (shape 1 3 4)) 2 (fun u => B1_3_4Little u ((stageBPriority (shape 1 3 4)) 2)) 14 a +lemma CB1_3_4I2R14Raw_sound (a : Fin 6) : + (CB1_3_4I2R14Raw a).Encloses (CB1_3_4I2R14Value a) := by + exact residualBall_sound_on (below (shape 1 3 4)) B1_3_4Law (fun u => (stageBLaw (shape 1 3 4) u : ℝ)) (stageBPriority (shape 1 3 4)) 2 (fun u => B1_3_4Little u ((stageBPriority (shape 1 3 4)) 2)) (fun u a => (littleLaw (shape 1 3 4) u ((stageBPriority (shape 1 3 4)) 2) a : ℝ)) (fun u _ => B1_3_4Law_sound u) (fun u _ a => B1_3_4Little_sound u ((stageBPriority (shape 1 3 4)) 2) a) 14 a +def CB1_3_4I2R14Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB1_3_4I2R14Certificates_valid : + CB1_3_4I2R14Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_3_4I2R14CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB1_3_4I2R14P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_3_4I2R14Certificates (CB1_3_4I2R14CertificateIndex a)).input +lemma CB1_3_4I2R14P_check : ∀ a : Fin 6, contains (CB1_3_4I2R14Raw a) (CB1_3_4I2R14P a) = true := by + decide +kernel +lemma CB1_3_4I2R14P_sound (a : Fin 6) : + (CB1_3_4I2R14P a).Encloses (CB1_3_4I2R14Value a) := + contains_sound (CB1_3_4I2R14Raw_sound a) (CB1_3_4I2R14P_check a) +def CB1_3_4I2R14Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_3_4I2R14Certificates (CB1_3_4I2R14CertificateIndex a)).output +lemma CB1_3_4I2R14Terms_sound (a : Fin 6) : + (CB1_3_4I2R14Terms a).Encloses (Foundation.entropyTerm (CB1_3_4I2R14Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_3_4I2R14Certificates_valid + (CB1_3_4I2R14CertificateIndex a) (CB1_3_4I2R14P_sound a) +def CB1_3_4I2R14Entropy : Ball := ⟨0, 0⟩ +lemma CB1_3_4I2R14Entropy_sound : CB1_3_4I2R14Entropy.Encloses (Foundation.finiteEntropy CB1_3_4I2R14Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_3_4I2R14Value CB1_3_4I2R14Terms CB1_3_4I2R14Terms_sound) (by decide +kernel) +def CB1_3_4I2R14Mass : Ball := ⟨0, 0⟩ +lemma CB1_3_4I2R14Mass_sound : CB1_3_4I2R14Mass.Encloses (∑ a, CB1_3_4I2R14Value a) := by + exact contains_sound (finSumBall_sound 6 CB1_3_4I2R14P CB1_3_4I2R14Value CB1_3_4I2R14P_sound) (by decide +kernel) +def CB1_3_4I2R14MassTerm : Ball := .exact 0 +lemma CB1_3_4I2R14MassTerm_sound : CB1_3_4I2R14MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_3_4I2R14Value a))) := + entropyTerm_zero_ball (CB1_3_4I2R14Mass_sound) +def CB1_3_4I2R14H : Ball := ⟨0, 0⟩ +lemma CB1_3_4I2R14H_sound : CB1_3_4I2R14H.Encloses (homogeneousEntropy CB1_3_4I2R14Value) := by + exact contains_sound (homogeneous_enclosed CB1_3_4I2R14Value CB1_3_4I2R14MassTerm_sound CB1_3_4I2R14Entropy_sound) (by decide +kernel) +def CB1_3_4I2R15Value (a : Fin 6) : ℝ := residualLaw (below (shape 1 3 4)) (fun u => (stageBLaw (shape 1 3 4) u : ℝ)) (stageBPriority (shape 1 3 4)) 2 (fun u a => (littleLaw (shape 1 3 4) u ((stageBPriority (shape 1 3 4)) 2) a : ℝ)) 15 a +def CB1_3_4I2R15Raw (a : Fin 6) : Ball := residualBall (below (shape 1 3 4)) B1_3_4Law (stageBPriority (shape 1 3 4)) 2 (fun u => B1_3_4Little u ((stageBPriority (shape 1 3 4)) 2)) 15 a +lemma CB1_3_4I2R15Raw_sound (a : Fin 6) : + (CB1_3_4I2R15Raw a).Encloses (CB1_3_4I2R15Value a) := by + exact residualBall_sound_on (below (shape 1 3 4)) B1_3_4Law (fun u => (stageBLaw (shape 1 3 4) u : ℝ)) (stageBPriority (shape 1 3 4)) 2 (fun u => B1_3_4Little u ((stageBPriority (shape 1 3 4)) 2)) (fun u a => (littleLaw (shape 1 3 4) u ((stageBPriority (shape 1 3 4)) 2) a : ℝ)) (fun u _ => B1_3_4Law_sound u) (fun u _ a => B1_3_4Little_sound u ((stageBPriority (shape 1 3 4)) 2) a) 15 a +def CB1_3_4I2R15Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB1_3_4I2R15Certificates_valid : + CB1_3_4I2R15Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_3_4I2R15CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB1_3_4I2R15P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_3_4I2R15Certificates (CB1_3_4I2R15CertificateIndex a)).input +lemma CB1_3_4I2R15P_check : ∀ a : Fin 6, contains (CB1_3_4I2R15Raw a) (CB1_3_4I2R15P a) = true := by + decide +kernel +lemma CB1_3_4I2R15P_sound (a : Fin 6) : + (CB1_3_4I2R15P a).Encloses (CB1_3_4I2R15Value a) := + contains_sound (CB1_3_4I2R15Raw_sound a) (CB1_3_4I2R15P_check a) +def CB1_3_4I2R15Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_3_4I2R15Certificates (CB1_3_4I2R15CertificateIndex a)).output +lemma CB1_3_4I2R15Terms_sound (a : Fin 6) : + (CB1_3_4I2R15Terms a).Encloses (Foundation.entropyTerm (CB1_3_4I2R15Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_3_4I2R15Certificates_valid + (CB1_3_4I2R15CertificateIndex a) (CB1_3_4I2R15P_sound a) +def CB1_3_4I2R15Entropy : Ball := ⟨0, 0⟩ +lemma CB1_3_4I2R15Entropy_sound : CB1_3_4I2R15Entropy.Encloses (Foundation.finiteEntropy CB1_3_4I2R15Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_3_4I2R15Value CB1_3_4I2R15Terms CB1_3_4I2R15Terms_sound) (by decide +kernel) +def CB1_3_4I2R15Mass : Ball := ⟨0, 0⟩ +lemma CB1_3_4I2R15Mass_sound : CB1_3_4I2R15Mass.Encloses (∑ a, CB1_3_4I2R15Value a) := by + exact contains_sound (finSumBall_sound 6 CB1_3_4I2R15P CB1_3_4I2R15Value CB1_3_4I2R15P_sound) (by decide +kernel) +def CB1_3_4I2R15MassTerm : Ball := .exact 0 +lemma CB1_3_4I2R15MassTerm_sound : CB1_3_4I2R15MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_3_4I2R15Value a))) := + entropyTerm_zero_ball (CB1_3_4I2R15Mass_sound) +def CB1_3_4I2R15H : Ball := ⟨0, 0⟩ +lemma CB1_3_4I2R15H_sound : CB1_3_4I2R15H.Encloses (homogeneousEntropy CB1_3_4I2R15Value) := by + exact contains_sound (homogeneous_enclosed CB1_3_4I2R15Value CB1_3_4I2R15MassTerm_sound CB1_3_4I2R15Entropy_sound) (by decide +kernel) +def CB1_3_4I2R16Value (a : Fin 6) : ℝ := residualLaw (below (shape 1 3 4)) (fun u => (stageBLaw (shape 1 3 4) u : ℝ)) (stageBPriority (shape 1 3 4)) 2 (fun u a => (littleLaw (shape 1 3 4) u ((stageBPriority (shape 1 3 4)) 2) a : ℝ)) 16 a +def CB1_3_4I2R16Raw (a : Fin 6) : Ball := residualBall (below (shape 1 3 4)) B1_3_4Law (stageBPriority (shape 1 3 4)) 2 (fun u => B1_3_4Little u ((stageBPriority (shape 1 3 4)) 2)) 16 a +lemma CB1_3_4I2R16Raw_sound (a : Fin 6) : + (CB1_3_4I2R16Raw a).Encloses (CB1_3_4I2R16Value a) := by + exact residualBall_sound_on (below (shape 1 3 4)) B1_3_4Law (fun u => (stageBLaw (shape 1 3 4) u : ℝ)) (stageBPriority (shape 1 3 4)) 2 (fun u => B1_3_4Little u ((stageBPriority (shape 1 3 4)) 2)) (fun u a => (littleLaw (shape 1 3 4) u ((stageBPriority (shape 1 3 4)) 2) a : ℝ)) (fun u _ => B1_3_4Law_sound u) (fun u _ a => B1_3_4Little_sound u ((stageBPriority (shape 1 3 4)) 2) a) 16 a +def CB1_3_4I2R16Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB1_3_4I2R16Certificates_valid : + CB1_3_4I2R16Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_3_4I2R16CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB1_3_4I2R16P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_3_4I2R16Certificates (CB1_3_4I2R16CertificateIndex a)).input +lemma CB1_3_4I2R16P_check : ∀ a : Fin 6, contains (CB1_3_4I2R16Raw a) (CB1_3_4I2R16P a) = true := by + decide +kernel +lemma CB1_3_4I2R16P_sound (a : Fin 6) : + (CB1_3_4I2R16P a).Encloses (CB1_3_4I2R16Value a) := + contains_sound (CB1_3_4I2R16Raw_sound a) (CB1_3_4I2R16P_check a) +def CB1_3_4I2R16Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_3_4I2R16Certificates (CB1_3_4I2R16CertificateIndex a)).output +lemma CB1_3_4I2R16Terms_sound (a : Fin 6) : + (CB1_3_4I2R16Terms a).Encloses (Foundation.entropyTerm (CB1_3_4I2R16Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_3_4I2R16Certificates_valid + (CB1_3_4I2R16CertificateIndex a) (CB1_3_4I2R16P_sound a) +def CB1_3_4I2R16Entropy : Ball := ⟨0, 0⟩ +lemma CB1_3_4I2R16Entropy_sound : CB1_3_4I2R16Entropy.Encloses (Foundation.finiteEntropy CB1_3_4I2R16Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_3_4I2R16Value CB1_3_4I2R16Terms CB1_3_4I2R16Terms_sound) (by decide +kernel) +def CB1_3_4I2R16Mass : Ball := ⟨0, 0⟩ +lemma CB1_3_4I2R16Mass_sound : CB1_3_4I2R16Mass.Encloses (∑ a, CB1_3_4I2R16Value a) := by + exact contains_sound (finSumBall_sound 6 CB1_3_4I2R16P CB1_3_4I2R16Value CB1_3_4I2R16P_sound) (by decide +kernel) +def CB1_3_4I2R16MassTerm : Ball := .exact 0 +lemma CB1_3_4I2R16MassTerm_sound : CB1_3_4I2R16MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_3_4I2R16Value a))) := + entropyTerm_zero_ball (CB1_3_4I2R16Mass_sound) +def CB1_3_4I2R16H : Ball := ⟨0, 0⟩ +lemma CB1_3_4I2R16H_sound : CB1_3_4I2R16H.Encloses (homogeneousEntropy CB1_3_4I2R16Value) := by + exact contains_sound (homogeneous_enclosed CB1_3_4I2R16Value CB1_3_4I2R16MassTerm_sound CB1_3_4I2R16Entropy_sound) (by decide +kernel) +def CB1_3_4I2ResidualEntropies (a : Fin 17) : Ball := + match a.val with + | 0 => CB1_3_4I2R0H + | 1 => CB1_3_4I2R1H + | 2 => CB1_3_4I2R2H + | 3 => CB1_3_4I2R3H + | 4 => CB1_3_4I2R4H + | 5 => CB1_3_4I2R5H + | 6 => CB1_3_4I2R6H + | 7 => CB1_3_4I2R7H + | 8 => CB1_3_4I2R8H + | 9 => CB1_3_4I2R9H + | 10 => CB1_3_4I2R10H + | 11 => CB1_3_4I2R11H + | 12 => CB1_3_4I2R12H + | 13 => CB1_3_4I2R13H + | 14 => CB1_3_4I2R14H + | 15 => CB1_3_4I2R15H + | 16 => CB1_3_4I2R16H + | _ => (.exact 0) +lemma CB1_3_4I2ResidualEntropies_sound (k : Fin 17) : + (CB1_3_4I2ResidualEntropies k).Encloses (homogeneousEntropy + (residualLaw (below (shape 1 3 4)) (fun u => (stageBLaw (shape 1 3 4) u : ℝ)) (stageBPriority (shape 1 3 4)) 2 (fun u a => (littleLaw (shape 1 3 4) u ((stageBPriority (shape 1 3 4)) 2) a : ℝ)) k)) := by + fin_cases k + · exact CB1_3_4I2R0H_sound + · exact CB1_3_4I2R1H_sound + · exact CB1_3_4I2R2H_sound + · exact CB1_3_4I2R3H_sound + · exact CB1_3_4I2R4H_sound + · exact CB1_3_4I2R5H_sound + · exact CB1_3_4I2R6H_sound + · exact CB1_3_4I2R7H_sound + · exact CB1_3_4I2R8H_sound + · exact CB1_3_4I2R9H_sound + · exact CB1_3_4I2R10H_sound + · exact CB1_3_4I2R11H_sound + · exact CB1_3_4I2R12H_sound + · exact CB1_3_4I2R13H_sound + · exact CB1_3_4I2R14H_sound + · exact CB1_3_4I2R15H_sound + · exact CB1_3_4I2R16H_sound +def CB1_3_4I2S0_0_4Value (a : Fin 6) : ℝ := (littleLaw (shape 1 3 4) (shape 0 0 4) ((stageBPriority (shape 1 3 4)) 2) a : ℝ) +def CB1_3_4I2S0_0_4E_5Log : Ball := .exact 0 +lemma CB1_3_4I2S0_0_4E_5Log_sound : CB1_3_4I2S0_0_4E_5Log.Encloses (Real.log (CB1_3_4I2S0_0_4Value (5 : Fin 6))) := by + exact log_exact_one_ball ((B1_3_4Little_sound (shape 0 0 4) ((stageBPriority (shape 1 3 4)) 2)) (5 : Fin 6)) +def CB1_3_4I2S0_0_4E_5 : Ball := ⟨0, 0⟩ +lemma CB1_3_4I2S0_0_4E_5_sound : CB1_3_4I2S0_0_4E_5.Encloses (Foundation.entropyTerm (CB1_3_4I2S0_0_4Value (5 : Fin 6))) := by + exact contains_sound (entropyTerm_ball ((B1_3_4Little_sound (shape 0 0 4) ((stageBPriority (shape 1 3 4)) 2)) (5 : Fin 6)) CB1_3_4I2S0_0_4E_5Log_sound) (by decide +kernel) +def CB1_3_4I2S0_0_4Terms (a : Fin 6) : Ball := + match a.val with + | 5 => ⟨0, 0⟩ + | _ => (.exact 0) +lemma CB1_3_4I2S0_0_4Terms_sound (a : Fin 6) : + (CB1_3_4I2S0_0_4Terms a).Encloses (Foundation.entropyTerm (CB1_3_4I2S0_0_4Value a)) := by + fin_cases a + · exact (entropyTerm_zero_ball ((B1_3_4Little_sound (shape 0 0 4) ((stageBPriority (shape 1 3 4)) 2)) (0 : Fin 6))) + · exact (entropyTerm_zero_ball ((B1_3_4Little_sound (shape 0 0 4) ((stageBPriority (shape 1 3 4)) 2)) (1 : Fin 6))) + · exact (entropyTerm_zero_ball ((B1_3_4Little_sound (shape 0 0 4) ((stageBPriority (shape 1 3 4)) 2)) (2 : Fin 6))) + · exact (entropyTerm_zero_ball ((B1_3_4Little_sound (shape 0 0 4) ((stageBPriority (shape 1 3 4)) 2)) (3 : Fin 6))) + · exact (entropyTerm_zero_ball ((B1_3_4Little_sound (shape 0 0 4) ((stageBPriority (shape 1 3 4)) 2)) (4 : Fin 6))) + · exact CB1_3_4I2S0_0_4E_5_sound +def CB1_3_4I2S0_0_4Entropy : Ball := ⟨0, 0⟩ +lemma CB1_3_4I2S0_0_4Entropy_sound : CB1_3_4I2S0_0_4Entropy.Encloses (Foundation.finiteEntropy CB1_3_4I2S0_0_4Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_3_4I2S0_0_4Value CB1_3_4I2S0_0_4Terms CB1_3_4I2S0_0_4Terms_sound) (by decide +kernel) +def CB1_3_4I2S0_0_4Mass : Ball := ⟨1, 0⟩ +lemma CB1_3_4I2S0_0_4Mass_sound : CB1_3_4I2S0_0_4Mass.Encloses (∑ a, CB1_3_4I2S0_0_4Value a) := by + exact contains_sound (finSumBall_sound 6 (B1_3_4Little (shape 0 0 4) ((stageBPriority (shape 1 3 4)) 2)) CB1_3_4I2S0_0_4Value (B1_3_4Little_sound (shape 0 0 4) ((stageBPriority (shape 1 3 4)) 2))) (by decide +kernel) +def CB1_3_4I2S0_0_4MassTermLog : Ball := .exact 0 +lemma CB1_3_4I2S0_0_4MassTermLog_sound : CB1_3_4I2S0_0_4MassTermLog.Encloses (Real.log ((∑ a, CB1_3_4I2S0_0_4Value a))) := by + exact log_exact_one_ball (CB1_3_4I2S0_0_4Mass_sound) +def CB1_3_4I2S0_0_4MassTerm : Ball := ⟨0, 0⟩ +lemma CB1_3_4I2S0_0_4MassTerm_sound : CB1_3_4I2S0_0_4MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_3_4I2S0_0_4Value a))) := by + exact contains_sound (entropyTerm_ball (CB1_3_4I2S0_0_4Mass_sound) CB1_3_4I2S0_0_4MassTermLog_sound) (by decide +kernel) +def CB1_3_4I2S0_0_4H : Ball := ⟨0, 0⟩ +lemma CB1_3_4I2S0_0_4H_sound : CB1_3_4I2S0_0_4H.Encloses (homogeneousEntropy CB1_3_4I2S0_0_4Value) := by + exact contains_sound (homogeneous_enclosed CB1_3_4I2S0_0_4Value CB1_3_4I2S0_0_4MassTerm_sound CB1_3_4I2S0_0_4Entropy_sound) (by decide +kernel) +def CB1_3_4I2S0_1_3Value (a : Fin 6) : ℝ := (littleLaw (shape 1 3 4) (shape 0 1 3) ((stageBPriority (shape 1 3 4)) 2) a : ℝ) +def CB1_3_4I2S0_1_3E_4Log : Ball := .exact 0 +lemma CB1_3_4I2S0_1_3E_4Log_sound : CB1_3_4I2S0_1_3E_4Log.Encloses (Real.log (CB1_3_4I2S0_1_3Value (4 : Fin 6))) := by + exact log_exact_one_ball ((B1_3_4Little_sound (shape 0 1 3) ((stageBPriority (shape 1 3 4)) 2)) (4 : Fin 6)) +def CB1_3_4I2S0_1_3E_4 : Ball := ⟨0, 0⟩ +lemma CB1_3_4I2S0_1_3E_4_sound : CB1_3_4I2S0_1_3E_4.Encloses (Foundation.entropyTerm (CB1_3_4I2S0_1_3Value (4 : Fin 6))) := by + exact contains_sound (entropyTerm_ball ((B1_3_4Little_sound (shape 0 1 3) ((stageBPriority (shape 1 3 4)) 2)) (4 : Fin 6)) CB1_3_4I2S0_1_3E_4Log_sound) (by decide +kernel) +def CB1_3_4I2S0_1_3Terms (a : Fin 6) : Ball := + match a.val with + | 4 => ⟨0, 0⟩ + | _ => (.exact 0) +lemma CB1_3_4I2S0_1_3Terms_sound (a : Fin 6) : + (CB1_3_4I2S0_1_3Terms a).Encloses (Foundation.entropyTerm (CB1_3_4I2S0_1_3Value a)) := by + fin_cases a + · exact (entropyTerm_zero_ball ((B1_3_4Little_sound (shape 0 1 3) ((stageBPriority (shape 1 3 4)) 2)) (0 : Fin 6))) + · exact (entropyTerm_zero_ball ((B1_3_4Little_sound (shape 0 1 3) ((stageBPriority (shape 1 3 4)) 2)) (1 : Fin 6))) + · exact (entropyTerm_zero_ball ((B1_3_4Little_sound (shape 0 1 3) ((stageBPriority (shape 1 3 4)) 2)) (2 : Fin 6))) + · exact (entropyTerm_zero_ball ((B1_3_4Little_sound (shape 0 1 3) ((stageBPriority (shape 1 3 4)) 2)) (3 : Fin 6))) + · exact CB1_3_4I2S0_1_3E_4_sound + · exact (entropyTerm_zero_ball ((B1_3_4Little_sound (shape 0 1 3) ((stageBPriority (shape 1 3 4)) 2)) (5 : Fin 6))) +def CB1_3_4I2S0_1_3Entropy : Ball := ⟨0, 0⟩ +lemma CB1_3_4I2S0_1_3Entropy_sound : CB1_3_4I2S0_1_3Entropy.Encloses (Foundation.finiteEntropy CB1_3_4I2S0_1_3Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_3_4I2S0_1_3Value CB1_3_4I2S0_1_3Terms CB1_3_4I2S0_1_3Terms_sound) (by decide +kernel) +def CB1_3_4I2S0_1_3Mass : Ball := ⟨1, 0⟩ +lemma CB1_3_4I2S0_1_3Mass_sound : CB1_3_4I2S0_1_3Mass.Encloses (∑ a, CB1_3_4I2S0_1_3Value a) := by + exact contains_sound (finSumBall_sound 6 (B1_3_4Little (shape 0 1 3) ((stageBPriority (shape 1 3 4)) 2)) CB1_3_4I2S0_1_3Value (B1_3_4Little_sound (shape 0 1 3) ((stageBPriority (shape 1 3 4)) 2))) (by decide +kernel) +def CB1_3_4I2S0_1_3MassTermLog : Ball := .exact 0 +lemma CB1_3_4I2S0_1_3MassTermLog_sound : CB1_3_4I2S0_1_3MassTermLog.Encloses (Real.log ((∑ a, CB1_3_4I2S0_1_3Value a))) := by + exact log_exact_one_ball (CB1_3_4I2S0_1_3Mass_sound) +def CB1_3_4I2S0_1_3MassTerm : Ball := ⟨0, 0⟩ +lemma CB1_3_4I2S0_1_3MassTerm_sound : CB1_3_4I2S0_1_3MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_3_4I2S0_1_3Value a))) := by + exact contains_sound (entropyTerm_ball (CB1_3_4I2S0_1_3Mass_sound) CB1_3_4I2S0_1_3MassTermLog_sound) (by decide +kernel) +def CB1_3_4I2S0_1_3H : Ball := ⟨0, 0⟩ +lemma CB1_3_4I2S0_1_3H_sound : CB1_3_4I2S0_1_3H.Encloses (homogeneousEntropy CB1_3_4I2S0_1_3Value) := by + exact contains_sound (homogeneous_enclosed CB1_3_4I2S0_1_3Value CB1_3_4I2S0_1_3MassTerm_sound CB1_3_4I2S0_1_3Entropy_sound) (by decide +kernel) +def CB1_3_4I2S0_2_2Value (a : Fin 6) : ℝ := (littleLaw (shape 1 3 4) (shape 0 2 2) ((stageBPriority (shape 1 3 4)) 2) a : ℝ) +def CB1_3_4I2S0_2_2E_2LogWitness : LogWitness := ⟨-1, 453517, 250000⟩ +def CB1_3_4I2S0_2_2E_2Log : Ball := ⟨(-609845895945556733363202867553 / 6250000000000000000000000000000), (21175823683 / 50000000000000000000000000000000)⟩ +lemma CB1_3_4I2S0_2_2E_2Log_sound : CB1_3_4I2S0_2_2E_2Log.Encloses (Real.log (CB1_3_4I2S0_2_2Value (2 : Fin 6))) := by + exact checkLog_sound logTwoBall_sound ((B1_3_4Little_sound (shape 0 2 2) ((stageBPriority (shape 1 3 4)) 2)) (2 : Fin 6)) (w := CB1_3_4I2S0_2_2E_2LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB1_3_4I2S0_2_2E_2 : Ball := ⟨(8850415398129313697429749596289 / 100000000000000000000000000000000), (19207192059 / 50000000000000000000000000000000)⟩ +lemma CB1_3_4I2S0_2_2E_2_sound : CB1_3_4I2S0_2_2E_2.Encloses (Foundation.entropyTerm (CB1_3_4I2S0_2_2Value (2 : Fin 6))) := by + exact contains_sound (entropyTerm_ball ((B1_3_4Little_sound (shape 0 2 2) ((stageBPriority (shape 1 3 4)) 2)) (2 : Fin 6)) CB1_3_4I2S0_2_2E_2Log_sound) (by decide +kernel) +def CB1_3_4I2S0_2_2E_3LogWitness : LogWitness := ⟨-4, 46483, 31250⟩ +def CB1_3_4I2S0_2_2E_3Log : Ball := ⟨(-59388036101788952339754245697507 / 25000000000000000000000000000000), (21175823683 / 20000000000000000000000000000000)⟩ +lemma CB1_3_4I2S0_2_2E_3Log_sound : CB1_3_4I2S0_2_2E_3Log.Encloses (Real.log (CB1_3_4I2S0_2_2Value (3 : Fin 6))) := by + exact checkLog_sound logTwoBall_sound ((B1_3_4Little_sound (shape 0 2 2) ((stageBPriority (shape 1 3 4)) 2)) (3 : Fin 6)) (w := CB1_3_4I2S0_2_2E_3LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB1_3_4I2S0_2_2E_3 : Ball := ⟨(11042136328477823486435186411029 / 50000000000000000000000000000000), (9843158123 / 100000000000000000000000000000000)⟩ +lemma CB1_3_4I2S0_2_2E_3_sound : CB1_3_4I2S0_2_2E_3.Encloses (Foundation.entropyTerm (CB1_3_4I2S0_2_2Value (3 : Fin 6))) := by + exact contains_sound (entropyTerm_ball ((B1_3_4Little_sound (shape 0 2 2) ((stageBPriority (shape 1 3 4)) 2)) (3 : Fin 6)) CB1_3_4I2S0_2_2E_3Log_sound) (by decide +kernel) +def CB1_3_4I2S0_2_2Terms (a : Fin 6) : Ball := + match a.val with + | 2 => ⟨(8850415398129313697429749596289 / 100000000000000000000000000000000), (19207192059 / 50000000000000000000000000000000)⟩ + | 3 => ⟨(11042136328477823486435186411029 / 50000000000000000000000000000000), (9843158123 / 100000000000000000000000000000000)⟩ + | _ => (.exact 0) +lemma CB1_3_4I2S0_2_2Terms_sound (a : Fin 6) : + (CB1_3_4I2S0_2_2Terms a).Encloses (Foundation.entropyTerm (CB1_3_4I2S0_2_2Value a)) := by + fin_cases a + · exact (entropyTerm_zero_ball ((B1_3_4Little_sound (shape 0 2 2) ((stageBPriority (shape 1 3 4)) 2)) (0 : Fin 6))) + · exact (entropyTerm_zero_ball ((B1_3_4Little_sound (shape 0 2 2) ((stageBPriority (shape 1 3 4)) 2)) (1 : Fin 6))) + · exact CB1_3_4I2S0_2_2E_2_sound + · exact CB1_3_4I2S0_2_2E_3_sound + · exact (entropyTerm_zero_ball ((B1_3_4Little_sound (shape 0 2 2) ((stageBPriority (shape 1 3 4)) 2)) (4 : Fin 6))) + · exact (entropyTerm_zero_ball ((B1_3_4Little_sound (shape 0 2 2) ((stageBPriority (shape 1 3 4)) 2)) (5 : Fin 6))) +def CB1_3_4I2S0_2_2Entropy : Ball := ⟨(30934688055084960670300122418347 / 100000000000000000000000000000000), (48257542241 / 100000000000000000000000000000000)⟩ +lemma CB1_3_4I2S0_2_2Entropy_sound : CB1_3_4I2S0_2_2Entropy.Encloses (Foundation.finiteEntropy CB1_3_4I2S0_2_2Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_3_4I2S0_2_2Value CB1_3_4I2S0_2_2Terms CB1_3_4I2S0_2_2Terms_sound) (by decide +kernel) +def CB1_3_4I2S0_2_2Mass : Ball := ⟨1, 0⟩ +lemma CB1_3_4I2S0_2_2Mass_sound : CB1_3_4I2S0_2_2Mass.Encloses (∑ a, CB1_3_4I2S0_2_2Value a) := by + exact contains_sound (finSumBall_sound 6 (B1_3_4Little (shape 0 2 2) ((stageBPriority (shape 1 3 4)) 2)) CB1_3_4I2S0_2_2Value (B1_3_4Little_sound (shape 0 2 2) ((stageBPriority (shape 1 3 4)) 2))) (by decide +kernel) +def CB1_3_4I2S0_2_2MassTermLog : Ball := .exact 0 +lemma CB1_3_4I2S0_2_2MassTermLog_sound : CB1_3_4I2S0_2_2MassTermLog.Encloses (Real.log ((∑ a, CB1_3_4I2S0_2_2Value a))) := by + exact log_exact_one_ball (CB1_3_4I2S0_2_2Mass_sound) +def CB1_3_4I2S0_2_2MassTerm : Ball := ⟨0, 0⟩ +lemma CB1_3_4I2S0_2_2MassTerm_sound : CB1_3_4I2S0_2_2MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_3_4I2S0_2_2Value a))) := by + exact contains_sound (entropyTerm_ball (CB1_3_4I2S0_2_2Mass_sound) CB1_3_4I2S0_2_2MassTermLog_sound) (by decide +kernel) +def CB1_3_4I2S0_2_2H : Ball := ⟨(30934688055084960670300122418347 / 100000000000000000000000000000000), (48257542241 / 100000000000000000000000000000000)⟩ +lemma CB1_3_4I2S0_2_2H_sound : CB1_3_4I2S0_2_2H.Encloses (homogeneousEntropy CB1_3_4I2S0_2_2Value) := by + exact contains_sound (homogeneous_enclosed CB1_3_4I2S0_2_2Value CB1_3_4I2S0_2_2MassTerm_sound CB1_3_4I2S0_2_2Entropy_sound) (by decide +kernel) +def CB1_3_4I2S0_3_1Value (a : Fin 6) : ℝ := (littleLaw (shape 1 3 4) (shape 0 3 1) ((stageBPriority (shape 1 3 4)) 2) a : ℝ) +def CB1_3_4I2S0_3_1E_1Log : Ball := .exact 0 +lemma CB1_3_4I2S0_3_1E_1Log_sound : CB1_3_4I2S0_3_1E_1Log.Encloses (Real.log (CB1_3_4I2S0_3_1Value (1 : Fin 6))) := by + exact log_exact_one_ball ((B1_3_4Little_sound (shape 0 3 1) ((stageBPriority (shape 1 3 4)) 2)) (1 : Fin 6)) +def CB1_3_4I2S0_3_1E_1 : Ball := ⟨0, 0⟩ +lemma CB1_3_4I2S0_3_1E_1_sound : CB1_3_4I2S0_3_1E_1.Encloses (Foundation.entropyTerm (CB1_3_4I2S0_3_1Value (1 : Fin 6))) := by + exact contains_sound (entropyTerm_ball ((B1_3_4Little_sound (shape 0 3 1) ((stageBPriority (shape 1 3 4)) 2)) (1 : Fin 6)) CB1_3_4I2S0_3_1E_1Log_sound) (by decide +kernel) +def CB1_3_4I2S0_3_1Terms (a : Fin 6) : Ball := + match a.val with + | 1 => ⟨0, 0⟩ + | _ => (.exact 0) +lemma CB1_3_4I2S0_3_1Terms_sound (a : Fin 6) : + (CB1_3_4I2S0_3_1Terms a).Encloses (Foundation.entropyTerm (CB1_3_4I2S0_3_1Value a)) := by + fin_cases a + · exact (entropyTerm_zero_ball ((B1_3_4Little_sound (shape 0 3 1) ((stageBPriority (shape 1 3 4)) 2)) (0 : Fin 6))) + · exact CB1_3_4I2S0_3_1E_1_sound + · exact (entropyTerm_zero_ball ((B1_3_4Little_sound (shape 0 3 1) ((stageBPriority (shape 1 3 4)) 2)) (2 : Fin 6))) + · exact (entropyTerm_zero_ball ((B1_3_4Little_sound (shape 0 3 1) ((stageBPriority (shape 1 3 4)) 2)) (3 : Fin 6))) + · exact (entropyTerm_zero_ball ((B1_3_4Little_sound (shape 0 3 1) ((stageBPriority (shape 1 3 4)) 2)) (4 : Fin 6))) + · exact (entropyTerm_zero_ball ((B1_3_4Little_sound (shape 0 3 1) ((stageBPriority (shape 1 3 4)) 2)) (5 : Fin 6))) +def CB1_3_4I2S0_3_1Entropy : Ball := ⟨0, 0⟩ +lemma CB1_3_4I2S0_3_1Entropy_sound : CB1_3_4I2S0_3_1Entropy.Encloses (Foundation.finiteEntropy CB1_3_4I2S0_3_1Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_3_4I2S0_3_1Value CB1_3_4I2S0_3_1Terms CB1_3_4I2S0_3_1Terms_sound) (by decide +kernel) +def CB1_3_4I2S0_3_1Mass : Ball := ⟨1, 0⟩ +lemma CB1_3_4I2S0_3_1Mass_sound : CB1_3_4I2S0_3_1Mass.Encloses (∑ a, CB1_3_4I2S0_3_1Value a) := by + exact contains_sound (finSumBall_sound 6 (B1_3_4Little (shape 0 3 1) ((stageBPriority (shape 1 3 4)) 2)) CB1_3_4I2S0_3_1Value (B1_3_4Little_sound (shape 0 3 1) ((stageBPriority (shape 1 3 4)) 2))) (by decide +kernel) +def CB1_3_4I2S0_3_1MassTermLog : Ball := .exact 0 +lemma CB1_3_4I2S0_3_1MassTermLog_sound : CB1_3_4I2S0_3_1MassTermLog.Encloses (Real.log ((∑ a, CB1_3_4I2S0_3_1Value a))) := by + exact log_exact_one_ball (CB1_3_4I2S0_3_1Mass_sound) +def CB1_3_4I2S0_3_1MassTerm : Ball := ⟨0, 0⟩ +lemma CB1_3_4I2S0_3_1MassTerm_sound : CB1_3_4I2S0_3_1MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_3_4I2S0_3_1Value a))) := by + exact contains_sound (entropyTerm_ball (CB1_3_4I2S0_3_1Mass_sound) CB1_3_4I2S0_3_1MassTermLog_sound) (by decide +kernel) +def CB1_3_4I2S0_3_1H : Ball := ⟨0, 0⟩ +lemma CB1_3_4I2S0_3_1H_sound : CB1_3_4I2S0_3_1H.Encloses (homogeneousEntropy CB1_3_4I2S0_3_1Value) := by + exact contains_sound (homogeneous_enclosed CB1_3_4I2S0_3_1Value CB1_3_4I2S0_3_1MassTerm_sound CB1_3_4I2S0_3_1Entropy_sound) (by decide +kernel) +def CB1_3_4I2S1_0_3Value (a : Fin 6) : ℝ := (littleLaw (shape 1 3 4) (shape 1 0 3) ((stageBPriority (shape 1 3 4)) 2) a : ℝ) +def CB1_3_4I2S1_0_3E_4Log : Ball := .exact 0 +lemma CB1_3_4I2S1_0_3E_4Log_sound : CB1_3_4I2S1_0_3E_4Log.Encloses (Real.log (CB1_3_4I2S1_0_3Value (4 : Fin 6))) := by + exact log_exact_one_ball ((B1_3_4Little_sound (shape 1 0 3) ((stageBPriority (shape 1 3 4)) 2)) (4 : Fin 6)) +def CB1_3_4I2S1_0_3E_4 : Ball := ⟨0, 0⟩ +lemma CB1_3_4I2S1_0_3E_4_sound : CB1_3_4I2S1_0_3E_4.Encloses (Foundation.entropyTerm (CB1_3_4I2S1_0_3Value (4 : Fin 6))) := by + exact contains_sound (entropyTerm_ball ((B1_3_4Little_sound (shape 1 0 3) ((stageBPriority (shape 1 3 4)) 2)) (4 : Fin 6)) CB1_3_4I2S1_0_3E_4Log_sound) (by decide +kernel) +def CB1_3_4I2S1_0_3Terms (a : Fin 6) : Ball := + match a.val with + | 4 => ⟨0, 0⟩ + | _ => (.exact 0) +lemma CB1_3_4I2S1_0_3Terms_sound (a : Fin 6) : + (CB1_3_4I2S1_0_3Terms a).Encloses (Foundation.entropyTerm (CB1_3_4I2S1_0_3Value a)) := by + fin_cases a + · exact (entropyTerm_zero_ball ((B1_3_4Little_sound (shape 1 0 3) ((stageBPriority (shape 1 3 4)) 2)) (0 : Fin 6))) + · exact (entropyTerm_zero_ball ((B1_3_4Little_sound (shape 1 0 3) ((stageBPriority (shape 1 3 4)) 2)) (1 : Fin 6))) + · exact (entropyTerm_zero_ball ((B1_3_4Little_sound (shape 1 0 3) ((stageBPriority (shape 1 3 4)) 2)) (2 : Fin 6))) + · exact (entropyTerm_zero_ball ((B1_3_4Little_sound (shape 1 0 3) ((stageBPriority (shape 1 3 4)) 2)) (3 : Fin 6))) + · exact CB1_3_4I2S1_0_3E_4_sound + · exact (entropyTerm_zero_ball ((B1_3_4Little_sound (shape 1 0 3) ((stageBPriority (shape 1 3 4)) 2)) (5 : Fin 6))) +def CB1_3_4I2S1_0_3Entropy : Ball := ⟨0, 0⟩ +lemma CB1_3_4I2S1_0_3Entropy_sound : CB1_3_4I2S1_0_3Entropy.Encloses (Foundation.finiteEntropy CB1_3_4I2S1_0_3Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_3_4I2S1_0_3Value CB1_3_4I2S1_0_3Terms CB1_3_4I2S1_0_3Terms_sound) (by decide +kernel) +def CB1_3_4I2S1_0_3Mass : Ball := ⟨1, 0⟩ +lemma CB1_3_4I2S1_0_3Mass_sound : CB1_3_4I2S1_0_3Mass.Encloses (∑ a, CB1_3_4I2S1_0_3Value a) := by + exact contains_sound (finSumBall_sound 6 (B1_3_4Little (shape 1 0 3) ((stageBPriority (shape 1 3 4)) 2)) CB1_3_4I2S1_0_3Value (B1_3_4Little_sound (shape 1 0 3) ((stageBPriority (shape 1 3 4)) 2))) (by decide +kernel) +def CB1_3_4I2S1_0_3MassTermLog : Ball := .exact 0 +lemma CB1_3_4I2S1_0_3MassTermLog_sound : CB1_3_4I2S1_0_3MassTermLog.Encloses (Real.log ((∑ a, CB1_3_4I2S1_0_3Value a))) := by + exact log_exact_one_ball (CB1_3_4I2S1_0_3Mass_sound) +def CB1_3_4I2S1_0_3MassTerm : Ball := ⟨0, 0⟩ +lemma CB1_3_4I2S1_0_3MassTerm_sound : CB1_3_4I2S1_0_3MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_3_4I2S1_0_3Value a))) := by + exact contains_sound (entropyTerm_ball (CB1_3_4I2S1_0_3Mass_sound) CB1_3_4I2S1_0_3MassTermLog_sound) (by decide +kernel) +def CB1_3_4I2S1_0_3H : Ball := ⟨0, 0⟩ +lemma CB1_3_4I2S1_0_3H_sound : CB1_3_4I2S1_0_3H.Encloses (homogeneousEntropy CB1_3_4I2S1_0_3Value) := by + exact contains_sound (homogeneous_enclosed CB1_3_4I2S1_0_3Value CB1_3_4I2S1_0_3MassTerm_sound CB1_3_4I2S1_0_3Entropy_sound) (by decide +kernel) +def CB1_3_4I2Singles (s : Shape) : Ball := + match s 0, s 1, s 2 with + | 0, 0, 4 => CB1_3_4I2S0_0_4H + | 0, 1, 3 => CB1_3_4I2S0_1_3H + | 0, 2, 2 => CB1_3_4I2S0_2_2H + | 0, 3, 1 => CB1_3_4I2S0_3_1H + | 1, 0, 3 => CB1_3_4I2S1_0_3H + | _, _, _ => (.exact 0) +lemma CB1_3_4I2Singles_sound (u : Shape) (hu : u ∈ below (shape 1 3 4)) + (hd : designated (stageBPriority (shape 1 3 4)) 2 u) : + (CB1_3_4I2Singles u).Encloses (homogeneousEntropy ((fun u a => (littleLaw (shape 1 3 4) u ((stageBPriority (shape 1 3 4)) 2) a : ℝ)) u)) := by + rw [B1_3_4_below] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl + · exact CB1_3_4I2S0_0_4H_sound + · exact CB1_3_4I2S0_1_3H_sound + · exact CB1_3_4I2S0_2_2H_sound + · exact CB1_3_4I2S0_3_1H_sound + · exact CB1_3_4I2S1_0_3H_sound + · exact (show ¬ designated (stageBPriority (shape 1 3 4)) 2 (shape 1 1 2) by decide +kernel) hd |>.elim + · exact (show ¬ designated (stageBPriority (shape 1 3 4)) 2 (shape 1 2 1) by decide +kernel) hd |>.elim + · exact (show ¬ designated (stageBPriority (shape 1 3 4)) 2 (shape 1 3 0) by decide +kernel) hd |>.elim +def CB1_3_4I2Singleton : Ball := ⟨(2641885964250374911539500817683 / 20000000000000000000000000000000), (20606466649 / 100000000000000000000000000000000)⟩ +lemma CB1_3_4I2Singleton_sound : CB1_3_4I2Singleton.Encloses + (singletonEntropy (below (shape 1 3 4)) (fun u => (stageBLaw (shape 1 3 4) u : ℝ)) (stageBPriority (shape 1 3 4)) 2 (fun u a => (littleLaw (shape 1 3 4) u ((stageBPriority (shape 1 3 4)) 2) a : ℝ))) := by + exact contains_sound (singletonBall_sound (below (shape 1 3 4)) B1_3_4Law (fun u => (stageBLaw (shape 1 3 4) u : ℝ)) (stageBPriority (shape 1 3 4)) 2 + CB1_3_4I2Singles (fun u a => (littleLaw (shape 1 3 4) u ((stageBPriority (shape 1 3 4)) 2) a : ℝ)) (fun u _ => B1_3_4Law_sound u) CB1_3_4I2Singles_sound) (by decide +kernel) +def CB1_3_4I2Group : Ball := ⟨(13606408060568169914547016902947 / 100000000000000000000000000000000), (90241723401 / 100000000000000000000000000000000)⟩ +lemma CB1_3_4I2Group_sound : CB1_3_4I2Group.Encloses + (groupedEntropy (below (shape 1 3 4)) (fun u => (stageBLaw (shape 1 3 4) u : ℝ)) (stageBPriority (shape 1 3 4)) 2 (fun u a => (littleLaw (shape 1 3 4) u ((stageBPriority (shape 1 3 4)) 2) a : ℝ))) := by + exact contains_sound (Ball.add_sound CB1_3_4I2Singleton_sound + (finSumBall_sound 17 CB1_3_4I2ResidualEntropies _ CB1_3_4I2ResidualEntropies_sound)) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CB1_3_4I2H : Ball := ⟨(2849768145656699904331921241729 / 5000000000000000000000000000000), (281352715573 / 100000000000000000000000000000000)⟩ +lemma CB1_3_4I2_sound : CB1_3_4I2H.Encloses (stageBCapacity (shape 1 3 4) 2) := by + have hb := contains_sound (Ball.add_sound CB1_3_4I2PairH_sound + (Ball.neg_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) CB1_3_4I2Group_sound))) + (show contains (.add CB1_3_4I2PairH (.neg (.mul (.exact 2) CB1_3_4I2Group))) CB1_3_4I2H = true by decide +kernel) + simp only [stageBCapacity, nativeCapacity, + show (2 : Fin 3) ≠ 0 by decide, ite_false] + change CB1_3_4I2H.Encloses (homogeneousEntropy CB1_3_4I2PairValue - _) + simpa only [sub_eq_add_neg] using hb + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/CapacityB/CapB1_4_3I0.lean b/lean/OAI/LinearAlgebra/MatrixFields/CapacityB/CapB1_4_3I0.lean new file mode 100644 index 0000000000000000000000000000000000000000..1f7e6875e01ba1f33a17baf0e11baa01eaf74f63 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/CapacityB/CapB1_4_3I0.lean @@ -0,0 +1,72 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Certificates.SplitB2_3_3 + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CB1_4_3I0Value (a : Fin 17) : ℝ := marginal (below (shape 1 4 3)) (fun u => (stageBLaw (shape 1 4 3) u : ℝ)) ((stageBPriority (shape 1 4 3)) 0) a +def CB1_4_3I0Raw (a : Fin 17) : Ball := marginalBall (below (shape 1 4 3)) B1_4_3Law ((stageBPriority (shape 1 4 3)) 0) a +lemma CB1_4_3I0Raw_sound (a : Fin 17) : + (CB1_4_3I0Raw a).Encloses (CB1_4_3I0Value a) := by + exact marginalBall_sound (below (shape 1 4 3)) B1_4_3Law (fun u => (stageBLaw (shape 1 4 3) u : ℝ)) (fun u _ => B1_4_3Law_sound u) ((stageBPriority (shape 1 4 3)) 0) a +def CB1_4_3I0Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(1 / 2), (27 / 100000000000000000000000000000000)⟩ ⟨(6931471805599453094172319305033 / 20000000000000000000000000000000), (21175823729 / 100000000000000000000000000000000)⟩ ⟨(-6931471805599453094172319305033 / 10000000000000000000000000000000), (42351647419 / 100000000000000000000000000000000)⟩ ⟨-1, 1, 1⟩] +lemma CB1_4_3I0Certificates_valid : + CB1_4_3I0Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_4_3I0CertificateIndex (a : Fin 17) : ℕ := + match a.val with + | 0 => 1 + | 1 => 1 + | _ => 0 +def CB1_4_3I0P (a : Fin 17) : Ball := + (CompactCertificate.entropyLookup CB1_4_3I0Certificates (CB1_4_3I0CertificateIndex a)).input +lemma CB1_4_3I0P_check : ∀ a : Fin 17, contains (CB1_4_3I0Raw a) (CB1_4_3I0P a) = true := by + decide +kernel +lemma CB1_4_3I0P_sound (a : Fin 17) : + (CB1_4_3I0P a).Encloses (CB1_4_3I0Value a) := + contains_sound (CB1_4_3I0Raw_sound a) (CB1_4_3I0P_check a) +def CB1_4_3I0Terms (a : Fin 17) : Ball := + (CompactCertificate.entropyLookup CB1_4_3I0Certificates (CB1_4_3I0CertificateIndex a)).output +lemma CB1_4_3I0Terms_sound (a : Fin 17) : + (CB1_4_3I0Terms a).Encloses (Foundation.entropyTerm (CB1_4_3I0Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_4_3I0Certificates_valid + (CB1_4_3I0CertificateIndex a) (CB1_4_3I0P_sound a) +def CB1_4_3I0Entropy : Ball := ⟨(6931471805599453094172319305033 / 10000000000000000000000000000000), (21175823729 / 50000000000000000000000000000000)⟩ +lemma CB1_4_3I0Entropy_sound : CB1_4_3I0Entropy.Encloses (Foundation.finiteEntropy CB1_4_3I0Value) := by + exact contains_sound (entropyFin_enclosed 17 CB1_4_3I0Value CB1_4_3I0Terms CB1_4_3I0Terms_sound) (by decide +kernel) +def CB1_4_3I0Mass : Ball := ⟨1, (27 / 50000000000000000000000000000000)⟩ +lemma CB1_4_3I0Mass_sound : CB1_4_3I0Mass.Encloses (∑ a, CB1_4_3I0Value a) := by + exact contains_sound (finSumBall_sound 17 CB1_4_3I0P CB1_4_3I0Value CB1_4_3I0P_sound) (by decide +kernel) +def CB1_4_3I0MassTermLogWitness : LogWitness := ⟨0, 1, 1⟩ +def CB1_4_3I0MassTermLog : Ball := ⟨0, (2646977967 / 12500000000000000000000000000000)⟩ +lemma CB1_4_3I0MassTermLog_sound : CB1_4_3I0MassTermLog.Encloses (Real.log ((∑ a, CB1_4_3I0Value a))) := by + exact checkLog_sound logTwoBall_sound (CB1_4_3I0Mass_sound) (w := CB1_4_3I0MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB1_4_3I0MassTerm : Ball := ⟨0, (21175823737 / 100000000000000000000000000000000)⟩ +lemma CB1_4_3I0MassTerm_sound : CB1_4_3I0MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_4_3I0Value a))) := by + exact contains_sound (entropyTerm_ball (CB1_4_3I0Mass_sound) CB1_4_3I0MassTermLog_sound) (by decide +kernel) +def CB1_4_3I0H : Ball := ⟨(6931471805599453094172319305033 / 10000000000000000000000000000000), (12705494239 / 20000000000000000000000000000000)⟩ +lemma CB1_4_3I0H_sound : CB1_4_3I0H.Encloses (homogeneousEntropy CB1_4_3I0Value) := by + exact contains_sound (homogeneous_enclosed CB1_4_3I0Value CB1_4_3I0MassTerm_sound CB1_4_3I0Entropy_sound) (by decide +kernel) +lemma CB1_4_3I0_sound : CB1_4_3I0H.Encloses (stageBCapacity (shape 1 4 3) 0) := by + exact CB1_4_3I0H_sound + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/CapacityB/CapB1_4_3I1.lean b/lean/OAI/LinearAlgebra/MatrixFields/CapacityB/CapB1_4_3I1.lean new file mode 100644 index 0000000000000000000000000000000000000000..9293d8f08a295097ae607e5b4c596bec055c73a6 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/CapacityB/CapB1_4_3I1.lean @@ -0,0 +1,888 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Certificates.LittleB1_4_3 + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CB1_4_3I1PairValue (a : PairSlot) : ℝ := pairLaw (below (shape 1 4 3)) (shape 1 4 3) (fun u => (stageBLaw (shape 1 4 3) u : ℝ)) (fun u a => (littleLaw (shape 1 4 3) u ((stageBPriority (shape 1 4 3)) 1) a : ℝ)) a +def CB1_4_3I1PairRaw (a : PairSlot) : Ball := pairLawBall (below (shape 1 4 3)) (shape 1 4 3) B1_4_3Law (fun u => B1_4_3Little u ((stageBPriority (shape 1 4 3)) 1)) a +lemma CB1_4_3I1PairRaw_sound (a : PairSlot) : + (CB1_4_3I1PairRaw a).Encloses (CB1_4_3I1PairValue a) := by + exact pairLawBall_sound_on (below (shape 1 4 3)) (shape 1 4 3) B1_4_3Law (fun u => (stageBLaw (shape 1 4 3) u : ℝ)) (fun u => B1_4_3Little u ((stageBPriority (shape 1 4 3)) 1)) (fun u a => (littleLaw (shape 1 4 3) u ((stageBPriority (shape 1 4 3)) 1) a : ℝ)) (fun u _ => B1_4_3Law_sound u) (fun u _ a => B1_4_3Little_sound u ((stageBPriority (shape 1 4 3)) 1) a) (fun u _ a => B1_4_3Little_sound (complement (shape 1 4 3) u) ((stageBPriority (shape 1 4 3)) 1) a) a +def CB1_4_3I1PairCertificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(1305555413502823769500199931759 / 100000000000000000000000000000000), (1 / 20000000000000000000000000000000)⟩ ⟨(2832103256882534265290777128763 / 50000000000000000000000000000000), (2211696927 / 100000000000000000000000000000000)⟩ ⟨(-216927081577024822663609695696999 / 50000000000000000000000000000000), (84703294923 / 50000000000000000000000000000000)⟩ ⟨-7, 1305555413502823769500199931759, 781250000000000000000000000000⟩, + .log ⟨(44394219774093180020469714786281 / 100000000000000000000000000000000), (21 / 100000000000000000000000000000000)⟩ ⟨(36050810521494122917160623164697 / 100000000000000000000000000000000), (28202525153 / 100000000000000000000000000000000)⟩ ⟨(-40603045514646074186140818376149 / 50000000000000000000000000000000), (7940933887 / 12500000000000000000000000000000)⟩ ⟨-2, 44394219774093180020469714786281, 25000000000000000000000000000000⟩, + .log ⟨(107505620310099905250752132049 / 2500000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ ⟨(6765334884245363384928340557533 / 50000000000000000000000000000000), (2731824077 / 50000000000000000000000000000000)⟩ ⟨(-157325144135040532508754982064573 / 50000000000000000000000000000000), (1985233471 / 1562500000000000000000000000000)⟩ ⟨-5, 107505620310099905250752132049, 78125000000000000000000000000⟩] +lemma CB1_4_3I1PairCertificates_valid : + CB1_4_3I1PairCertificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_4_3I1PairCertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 4, 0 => 1 + | 2, 1 => 2 + | 3, 1 => 3 + | 1, 2 => 2 + | 1, 3 => 3 + | 0, 4 => 1 + | _, _ => 0 +def CB1_4_3I1PairP (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CB1_4_3I1PairCertificates (CB1_4_3I1PairCertificateIndex a)).input +lemma CB1_4_3I1PairP_check : ∀ a : PairSlot, contains (CB1_4_3I1PairRaw a) (CB1_4_3I1PairP a) = true := by + decide +kernel +lemma CB1_4_3I1PairP_sound (a : PairSlot) : + (CB1_4_3I1PairP a).Encloses (CB1_4_3I1PairValue a) := + contains_sound (CB1_4_3I1PairRaw_sound a) (CB1_4_3I1PairP_check a) +def CB1_4_3I1PairTerms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CB1_4_3I1PairCertificates (CB1_4_3I1PairCertificateIndex a)).output +lemma CB1_4_3I1PairTerms_sound (a : PairSlot) : + (CB1_4_3I1PairTerms a).Encloses (Foundation.entropyTerm (CB1_4_3I1PairValue a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_4_3I1PairCertificates_valid + (CB1_4_3I1PairCertificateIndex a) (CB1_4_3I1PairP_sound a) +def CB1_4_3I1PairEntropy : Ball := ⟨(55245686803749918217598858537289 / 50000000000000000000000000000000), (17938935117 / 25000000000000000000000000000000)⟩ +lemma CB1_4_3I1PairEntropy_sound : CB1_4_3I1PairEntropy.Encloses (Foundation.finiteEntropy CB1_4_3I1PairValue) := by + exact contains_sound (entropyPair_enclosed CB1_4_3I1PairValue CB1_4_3I1PairTerms CB1_4_3I1PairTerms_sound) (by decide +kernel) +def CB1_4_3I1PairMass : Ball := ⟨1, (7 / 12500000000000000000000000000000)⟩ +lemma CB1_4_3I1PairMass_sound : CB1_4_3I1PairMass.Encloses (∑ a, CB1_4_3I1PairValue a) := by + exact contains_sound (pairSumBall_sound CB1_4_3I1PairP CB1_4_3I1PairValue CB1_4_3I1PairP_sound) (by decide +kernel) +def CB1_4_3I1PairMassTermLogWitness : LogWitness := ⟨0, 1, 1⟩ +def CB1_4_3I1PairMassTermLog : Ball := ⟨0, (10587911869 / 50000000000000000000000000000000)⟩ +lemma CB1_4_3I1PairMassTermLog_sound : CB1_4_3I1PairMassTermLog.Encloses (Real.log ((∑ a, CB1_4_3I1PairValue a))) := by + exact checkLog_sound logTwoBall_sound (CB1_4_3I1PairMass_sound) (w := CB1_4_3I1PairMassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB1_4_3I1PairMassTerm : Ball := ⟨0, (21175823739 / 100000000000000000000000000000000)⟩ +lemma CB1_4_3I1PairMassTerm_sound : CB1_4_3I1PairMassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_4_3I1PairValue a))) := by + exact contains_sound (entropyTerm_ball (CB1_4_3I1PairMass_sound) CB1_4_3I1PairMassTermLog_sound) (by decide +kernel) +def CB1_4_3I1PairH : Ball := ⟨(55245686803749918217598858537289 / 50000000000000000000000000000000), (92931564207 / 100000000000000000000000000000000)⟩ +lemma CB1_4_3I1PairH_sound : CB1_4_3I1PairH.Encloses (homogeneousEntropy CB1_4_3I1PairValue) := by + exact contains_sound (homogeneous_enclosed CB1_4_3I1PairValue CB1_4_3I1PairMassTerm_sound CB1_4_3I1PairEntropy_sound) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CB1_4_3I1R0Value (a : Fin 6) : ℝ := residualLaw (below (shape 1 4 3)) (fun u => (stageBLaw (shape 1 4 3) u : ℝ)) (stageBPriority (shape 1 4 3)) 1 (fun u a => (littleLaw (shape 1 4 3) u ((stageBPriority (shape 1 4 3)) 1) a : ℝ)) 0 a +def CB1_4_3I1R0Raw (a : Fin 6) : Ball := residualBall (below (shape 1 4 3)) B1_4_3Law (stageBPriority (shape 1 4 3)) 1 (fun u => B1_4_3Little u ((stageBPriority (shape 1 4 3)) 1)) 0 a +lemma CB1_4_3I1R0Raw_sound (a : Fin 6) : + (CB1_4_3I1R0Raw a).Encloses (CB1_4_3I1R0Value a) := by + exact residualBall_sound_on (below (shape 1 4 3)) B1_4_3Law (fun u => (stageBLaw (shape 1 4 3) u : ℝ)) (stageBPriority (shape 1 4 3)) 1 (fun u => B1_4_3Little u ((stageBPriority (shape 1 4 3)) 1)) (fun u a => (littleLaw (shape 1 4 3) u ((stageBPriority (shape 1 4 3)) 1) a : ℝ)) (fun u _ => B1_4_3Law_sound u) (fun u _ a => B1_4_3Little_sound u ((stageBPriority (shape 1 4 3)) 1) a) 0 a +def CB1_4_3I1R0Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(1305555413502823769500199931759 / 100000000000000000000000000000000), (1 / 20000000000000000000000000000000)⟩ ⟨(2832103256882534265290777128763 / 50000000000000000000000000000000), (2211696927 / 100000000000000000000000000000000)⟩ ⟨(-216927081577024822663609695696999 / 50000000000000000000000000000000), (84703294923 / 50000000000000000000000000000000)⟩ ⟨-7, 1305555413502823769500199931759, 781250000000000000000000000000⟩] +lemma CB1_4_3I1R0Certificates_valid : + CB1_4_3I1R0Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_4_3I1R0CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | 0 => 1 + | _ => 0 +def CB1_4_3I1R0P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_4_3I1R0Certificates (CB1_4_3I1R0CertificateIndex a)).input +lemma CB1_4_3I1R0P_check : ∀ a : Fin 6, contains (CB1_4_3I1R0Raw a) (CB1_4_3I1R0P a) = true := by + decide +kernel +lemma CB1_4_3I1R0P_sound (a : Fin 6) : + (CB1_4_3I1R0P a).Encloses (CB1_4_3I1R0Value a) := + contains_sound (CB1_4_3I1R0Raw_sound a) (CB1_4_3I1R0P_check a) +def CB1_4_3I1R0Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_4_3I1R0Certificates (CB1_4_3I1R0CertificateIndex a)).output +lemma CB1_4_3I1R0Terms_sound (a : Fin 6) : + (CB1_4_3I1R0Terms a).Encloses (Foundation.entropyTerm (CB1_4_3I1R0Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_4_3I1R0Certificates_valid + (CB1_4_3I1R0CertificateIndex a) (CB1_4_3I1R0P_sound a) +def CB1_4_3I1R0Entropy : Ball := ⟨(2832103256882534265290777128763 / 50000000000000000000000000000000), (2211696927 / 100000000000000000000000000000000)⟩ +lemma CB1_4_3I1R0Entropy_sound : CB1_4_3I1R0Entropy.Encloses (Foundation.finiteEntropy CB1_4_3I1R0Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_4_3I1R0Value CB1_4_3I1R0Terms CB1_4_3I1R0Terms_sound) (by decide +kernel) +def CB1_4_3I1R0Mass : Ball := ⟨(1305555413502823769500199931759 / 100000000000000000000000000000000), (1 / 20000000000000000000000000000000)⟩ +lemma CB1_4_3I1R0Mass_sound : CB1_4_3I1R0Mass.Encloses (∑ a, CB1_4_3I1R0Value a) := by + exact contains_sound (finSumBall_sound 6 CB1_4_3I1R0P CB1_4_3I1R0Value CB1_4_3I1R0P_sound) (by decide +kernel) +def CB1_4_3I1R0MassTermLogWitness : LogWitness := ⟨-7, 1305555413502823769500199931759, 781250000000000000000000000000⟩ +def CB1_4_3I1R0MassTermLog : Ball := ⟨(-216927081577024822663609695696999 / 50000000000000000000000000000000), (84703294923 / 50000000000000000000000000000000)⟩ +lemma CB1_4_3I1R0MassTermLog_sound : CB1_4_3I1R0MassTermLog.Encloses (Real.log ((∑ a, CB1_4_3I1R0Value a))) := by + exact checkLog_sound logTwoBall_sound (CB1_4_3I1R0Mass_sound) (w := CB1_4_3I1R0MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB1_4_3I1R0MassTerm : Ball := ⟨(2832103256882534265290777128763 / 50000000000000000000000000000000), (2211696927 / 100000000000000000000000000000000)⟩ +lemma CB1_4_3I1R0MassTerm_sound : CB1_4_3I1R0MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_4_3I1R0Value a))) := by + exact contains_sound (entropyTerm_ball (CB1_4_3I1R0Mass_sound) CB1_4_3I1R0MassTermLog_sound) (by decide +kernel) +def CB1_4_3I1R0H : Ball := ⟨0, (2211696927 / 50000000000000000000000000000000)⟩ +lemma CB1_4_3I1R0H_sound : CB1_4_3I1R0H.Encloses (homogeneousEntropy CB1_4_3I1R0Value) := by + exact contains_sound (homogeneous_enclosed CB1_4_3I1R0Value CB1_4_3I1R0MassTerm_sound CB1_4_3I1R0Entropy_sound) (by decide +kernel) +def CB1_4_3I1R1Value (a : Fin 6) : ℝ := residualLaw (below (shape 1 4 3)) (fun u => (stageBLaw (shape 1 4 3) u : ℝ)) (stageBPriority (shape 1 4 3)) 1 (fun u a => (littleLaw (shape 1 4 3) u ((stageBPriority (shape 1 4 3)) 1) a : ℝ)) 1 a +def CB1_4_3I1R1Raw (a : Fin 6) : Ball := residualBall (below (shape 1 4 3)) B1_4_3Law (stageBPriority (shape 1 4 3)) 1 (fun u => B1_4_3Little u ((stageBPriority (shape 1 4 3)) 1)) 1 a +lemma CB1_4_3I1R1Raw_sound (a : Fin 6) : + (CB1_4_3I1R1Raw a).Encloses (CB1_4_3I1R1Value a) := by + exact residualBall_sound_on (below (shape 1 4 3)) B1_4_3Law (fun u => (stageBLaw (shape 1 4 3) u : ℝ)) (stageBPriority (shape 1 4 3)) 1 (fun u => B1_4_3Little u ((stageBPriority (shape 1 4 3)) 1)) (fun u a => (littleLaw (shape 1 4 3) u ((stageBPriority (shape 1 4 3)) 1) a : ℝ)) (fun u _ => B1_4_3Law_sound u) (fun u _ a => B1_4_3Little_sound u ((stageBPriority (shape 1 4 3)) 1) a) 1 a +def CB1_4_3I1R1Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(48694444586497176230499800068241 / 100000000000000000000000000000000), (11 / 50000000000000000000000000000000)⟩ ⟨(35040777318051406005918583475043 / 100000000000000000000000000000000), (15467174613 / 50000000000000000000000000000000)⟩ ⟨(-71960523660574021003240660753221 / 100000000000000000000000000000000), (31763735547 / 50000000000000000000000000000000)⟩ ⟨-2, 48694444586497176230499800068241, 25000000000000000000000000000000⟩] +lemma CB1_4_3I1R1Certificates_valid : + CB1_4_3I1R1Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_4_3I1R1CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | 1 => 1 + | _ => 0 +def CB1_4_3I1R1P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_4_3I1R1Certificates (CB1_4_3I1R1CertificateIndex a)).input +lemma CB1_4_3I1R1P_check : ∀ a : Fin 6, contains (CB1_4_3I1R1Raw a) (CB1_4_3I1R1P a) = true := by + decide +kernel +lemma CB1_4_3I1R1P_sound (a : Fin 6) : + (CB1_4_3I1R1P a).Encloses (CB1_4_3I1R1Value a) := + contains_sound (CB1_4_3I1R1Raw_sound a) (CB1_4_3I1R1P_check a) +def CB1_4_3I1R1Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_4_3I1R1Certificates (CB1_4_3I1R1CertificateIndex a)).output +lemma CB1_4_3I1R1Terms_sound (a : Fin 6) : + (CB1_4_3I1R1Terms a).Encloses (Foundation.entropyTerm (CB1_4_3I1R1Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_4_3I1R1Certificates_valid + (CB1_4_3I1R1CertificateIndex a) (CB1_4_3I1R1P_sound a) +def CB1_4_3I1R1Entropy : Ball := ⟨(35040777318051406005918583475043 / 100000000000000000000000000000000), (15467174613 / 50000000000000000000000000000000)⟩ +lemma CB1_4_3I1R1Entropy_sound : CB1_4_3I1R1Entropy.Encloses (Foundation.finiteEntropy CB1_4_3I1R1Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_4_3I1R1Value CB1_4_3I1R1Terms CB1_4_3I1R1Terms_sound) (by decide +kernel) +def CB1_4_3I1R1Mass : Ball := ⟨(48694444586497176230499800068241 / 100000000000000000000000000000000), (11 / 50000000000000000000000000000000)⟩ +lemma CB1_4_3I1R1Mass_sound : CB1_4_3I1R1Mass.Encloses (∑ a, CB1_4_3I1R1Value a) := by + exact contains_sound (finSumBall_sound 6 CB1_4_3I1R1P CB1_4_3I1R1Value CB1_4_3I1R1P_sound) (by decide +kernel) +def CB1_4_3I1R1MassTermLogWitness : LogWitness := ⟨-2, 48694444586497176230499800068241, 25000000000000000000000000000000⟩ +def CB1_4_3I1R1MassTermLog : Ball := ⟨(-71960523660574021003240660753221 / 100000000000000000000000000000000), (31763735547 / 50000000000000000000000000000000)⟩ +lemma CB1_4_3I1R1MassTermLog_sound : CB1_4_3I1R1MassTermLog.Encloses (Real.log ((∑ a, CB1_4_3I1R1Value a))) := by + exact checkLog_sound logTwoBall_sound (CB1_4_3I1R1Mass_sound) (w := CB1_4_3I1R1MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB1_4_3I1R1MassTerm : Ball := ⟨(35040777318051406005918583475043 / 100000000000000000000000000000000), (15467174613 / 50000000000000000000000000000000)⟩ +lemma CB1_4_3I1R1MassTerm_sound : CB1_4_3I1R1MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_4_3I1R1Value a))) := by + exact contains_sound (entropyTerm_ball (CB1_4_3I1R1Mass_sound) CB1_4_3I1R1MassTermLog_sound) (by decide +kernel) +def CB1_4_3I1R1H : Ball := ⟨0, (15467174613 / 25000000000000000000000000000000)⟩ +lemma CB1_4_3I1R1H_sound : CB1_4_3I1R1H.Encloses (homogeneousEntropy CB1_4_3I1R1Value) := by + exact contains_sound (homogeneous_enclosed CB1_4_3I1R1Value CB1_4_3I1R1MassTerm_sound CB1_4_3I1R1Entropy_sound) (by decide +kernel) +def CB1_4_3I1R2Value (a : Fin 6) : ℝ := residualLaw (below (shape 1 4 3)) (fun u => (stageBLaw (shape 1 4 3) u : ℝ)) (stageBPriority (shape 1 4 3)) 1 (fun u a => (littleLaw (shape 1 4 3) u ((stageBPriority (shape 1 4 3)) 1) a : ℝ)) 2 a +def CB1_4_3I1R2Raw (a : Fin 6) : Ball := residualBall (below (shape 1 4 3)) B1_4_3Law (stageBPriority (shape 1 4 3)) 1 (fun u => B1_4_3Little u ((stageBPriority (shape 1 4 3)) 1)) 2 a +lemma CB1_4_3I1R2Raw_sound (a : Fin 6) : + (CB1_4_3I1R2Raw a).Encloses (CB1_4_3I1R2Value a) := by + exact residualBall_sound_on (below (shape 1 4 3)) B1_4_3Law (fun u => (stageBLaw (shape 1 4 3) u : ℝ)) (stageBPriority (shape 1 4 3)) 1 (fun u => B1_4_3Little u ((stageBPriority (shape 1 4 3)) 1)) (fun u a => (littleLaw (shape 1 4 3) u ((stageBPriority (shape 1 4 3)) 1) a : ℝ)) (fun u _ => B1_4_3Law_sound u) (fun u _ a => B1_4_3Little_sound u ((stageBPriority (shape 1 4 3)) 1) a) 2 a +def CB1_4_3I1R2Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(44394219774093180020469714786281 / 100000000000000000000000000000000), (21 / 100000000000000000000000000000000)⟩ ⟨(36050810521494122917160623164697 / 100000000000000000000000000000000), (28202525153 / 100000000000000000000000000000000)⟩ ⟨(-40603045514646074186140818376149 / 50000000000000000000000000000000), (7940933887 / 12500000000000000000000000000000)⟩ ⟨-2, 44394219774093180020469714786281, 25000000000000000000000000000000⟩, + .log ⟨(107505620310099905250752132049 / 2500000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ ⟨(6765334884245363384928340557533 / 50000000000000000000000000000000), (2731824077 / 50000000000000000000000000000000)⟩ ⟨(-157325144135040532508754982064573 / 50000000000000000000000000000000), (1985233471 / 1562500000000000000000000000000)⟩ ⟨-5, 107505620310099905250752132049, 78125000000000000000000000000⟩] +lemma CB1_4_3I1R2Certificates_valid : + CB1_4_3I1R2Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_4_3I1R2CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | 2 => 1 + | 3 => 2 + | _ => 0 +def CB1_4_3I1R2P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_4_3I1R2Certificates (CB1_4_3I1R2CertificateIndex a)).input +lemma CB1_4_3I1R2P_check : ∀ a : Fin 6, contains (CB1_4_3I1R2Raw a) (CB1_4_3I1R2P a) = true := by + decide +kernel +lemma CB1_4_3I1R2P_sound (a : Fin 6) : + (CB1_4_3I1R2P a).Encloses (CB1_4_3I1R2Value a) := + contains_sound (CB1_4_3I1R2Raw_sound a) (CB1_4_3I1R2P_check a) +def CB1_4_3I1R2Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_4_3I1R2Certificates (CB1_4_3I1R2CertificateIndex a)).output +lemma CB1_4_3I1R2Terms_sound (a : Fin 6) : + (CB1_4_3I1R2Terms a).Encloses (Foundation.entropyTerm (CB1_4_3I1R2Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_4_3I1R2Certificates_valid + (CB1_4_3I1R2CertificateIndex a) (CB1_4_3I1R2P_sound a) +def CB1_4_3I1R2Entropy : Ball := ⟨(49581480289984849687017304279763 / 100000000000000000000000000000000), (33666173307 / 100000000000000000000000000000000)⟩ +lemma CB1_4_3I1R2Entropy_sound : CB1_4_3I1R2Entropy.Encloses (Foundation.finiteEntropy CB1_4_3I1R2Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_4_3I1R2Value CB1_4_3I1R2Terms CB1_4_3I1R2Terms_sound) (by decide +kernel) +def CB1_4_3I1R2Mass : Ball := ⟨(48694444586497176230499800068241 / 100000000000000000000000000000000), (23 / 100000000000000000000000000000000)⟩ +lemma CB1_4_3I1R2Mass_sound : CB1_4_3I1R2Mass.Encloses (∑ a, CB1_4_3I1R2Value a) := by + exact contains_sound (finSumBall_sound 6 CB1_4_3I1R2P CB1_4_3I1R2Value CB1_4_3I1R2P_sound) (by decide +kernel) +def CB1_4_3I1R2MassTermLogWitness : LogWitness := ⟨-2, 48694444586497176230499800068241, 25000000000000000000000000000000⟩ +def CB1_4_3I1R2MassTermLog : Ball := ⟨(-71960523660574021003240660753221 / 100000000000000000000000000000000), (7940933887 / 12500000000000000000000000000000)⟩ +lemma CB1_4_3I1R2MassTermLog_sound : CB1_4_3I1R2MassTermLog.Encloses (Real.log ((∑ a, CB1_4_3I1R2Value a))) := by + exact checkLog_sound logTwoBall_sound (CB1_4_3I1R2Mass_sound) (w := CB1_4_3I1R2MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB1_4_3I1R2MassTerm : Ball := ⟨(35040777318051406005918583475043 / 100000000000000000000000000000000), (30934349227 / 100000000000000000000000000000000)⟩ +lemma CB1_4_3I1R2MassTerm_sound : CB1_4_3I1R2MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_4_3I1R2Value a))) := by + exact contains_sound (entropyTerm_ball (CB1_4_3I1R2Mass_sound) CB1_4_3I1R2MassTermLog_sound) (by decide +kernel) +def CB1_4_3I1R2H : Ball := ⟨(181758787149168046013734010059 / 1250000000000000000000000000000), (32300261267 / 50000000000000000000000000000000)⟩ +lemma CB1_4_3I1R2H_sound : CB1_4_3I1R2H.Encloses (homogeneousEntropy CB1_4_3I1R2Value) := by + exact contains_sound (homogeneous_enclosed CB1_4_3I1R2Value CB1_4_3I1R2MassTerm_sound CB1_4_3I1R2Entropy_sound) (by decide +kernel) +def CB1_4_3I1R3Value (a : Fin 6) : ℝ := residualLaw (below (shape 1 4 3)) (fun u => (stageBLaw (shape 1 4 3) u : ℝ)) (stageBPriority (shape 1 4 3)) 1 (fun u a => (littleLaw (shape 1 4 3) u ((stageBPriority (shape 1 4 3)) 1) a : ℝ)) 3 a +def CB1_4_3I1R3Raw (a : Fin 6) : Ball := residualBall (below (shape 1 4 3)) B1_4_3Law (stageBPriority (shape 1 4 3)) 1 (fun u => B1_4_3Little u ((stageBPriority (shape 1 4 3)) 1)) 3 a +lemma CB1_4_3I1R3Raw_sound (a : Fin 6) : + (CB1_4_3I1R3Raw a).Encloses (CB1_4_3I1R3Value a) := by + exact residualBall_sound_on (below (shape 1 4 3)) B1_4_3Law (fun u => (stageBLaw (shape 1 4 3) u : ℝ)) (stageBPriority (shape 1 4 3)) 1 (fun u => B1_4_3Little u ((stageBPriority (shape 1 4 3)) 1)) (fun u a => (littleLaw (shape 1 4 3) u ((stageBPriority (shape 1 4 3)) 1) a : ℝ)) (fun u _ => B1_4_3Law_sound u) (fun u _ a => B1_4_3Little_sound u ((stageBPriority (shape 1 4 3)) 1) a) 3 a +def CB1_4_3I1R3Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(636043303940678115759208606101 / 50000000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ ⟨(2776018400687065419939160153901 / 50000000000000000000000000000000), (13468741 / 625000000000000000000000000000)⟩ ⟨(-218225581771549981913164283923513 / 50000000000000000000000000000000), (84703294889 / 50000000000000000000000000000000)⟩ ⟨-7, 636043303940678115759208606101, 390625000000000000000000000000⟩] +lemma CB1_4_3I1R3Certificates_valid : + CB1_4_3I1R3Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_4_3I1R3CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | 4 => 1 + | _ => 0 +def CB1_4_3I1R3P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_4_3I1R3Certificates (CB1_4_3I1R3CertificateIndex a)).input +lemma CB1_4_3I1R3P_check : ∀ a : Fin 6, contains (CB1_4_3I1R3Raw a) (CB1_4_3I1R3P a) = true := by + decide +kernel +lemma CB1_4_3I1R3P_sound (a : Fin 6) : + (CB1_4_3I1R3P a).Encloses (CB1_4_3I1R3Value a) := + contains_sound (CB1_4_3I1R3Raw_sound a) (CB1_4_3I1R3P_check a) +def CB1_4_3I1R3Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_4_3I1R3Certificates (CB1_4_3I1R3CertificateIndex a)).output +lemma CB1_4_3I1R3Terms_sound (a : Fin 6) : + (CB1_4_3I1R3Terms a).Encloses (Foundation.entropyTerm (CB1_4_3I1R3Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_4_3I1R3Certificates_valid + (CB1_4_3I1R3CertificateIndex a) (CB1_4_3I1R3P_sound a) +def CB1_4_3I1R3Entropy : Ball := ⟨(2776018400687065419939160153901 / 50000000000000000000000000000000), (13468741 / 625000000000000000000000000000)⟩ +lemma CB1_4_3I1R3Entropy_sound : CB1_4_3I1R3Entropy.Encloses (Foundation.finiteEntropy CB1_4_3I1R3Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_4_3I1R3Value CB1_4_3I1R3Terms CB1_4_3I1R3Terms_sound) (by decide +kernel) +def CB1_4_3I1R3Mass : Ball := ⟨(636043303940678115759208606101 / 50000000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ +lemma CB1_4_3I1R3Mass_sound : CB1_4_3I1R3Mass.Encloses (∑ a, CB1_4_3I1R3Value a) := by + exact contains_sound (finSumBall_sound 6 CB1_4_3I1R3P CB1_4_3I1R3Value CB1_4_3I1R3P_sound) (by decide +kernel) +def CB1_4_3I1R3MassTermLogWitness : LogWitness := ⟨-7, 636043303940678115759208606101, 390625000000000000000000000000⟩ +def CB1_4_3I1R3MassTermLog : Ball := ⟨(-218225581771549981913164283923513 / 50000000000000000000000000000000), (84703294889 / 50000000000000000000000000000000)⟩ +lemma CB1_4_3I1R3MassTermLog_sound : CB1_4_3I1R3MassTermLog.Encloses (Real.log ((∑ a, CB1_4_3I1R3Value a))) := by + exact checkLog_sound logTwoBall_sound (CB1_4_3I1R3Mass_sound) (w := CB1_4_3I1R3MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB1_4_3I1R3MassTerm : Ball := ⟨(2776018400687065419939160153901 / 50000000000000000000000000000000), (13468741 / 625000000000000000000000000000)⟩ +lemma CB1_4_3I1R3MassTerm_sound : CB1_4_3I1R3MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_4_3I1R3Value a))) := by + exact contains_sound (entropyTerm_ball (CB1_4_3I1R3Mass_sound) CB1_4_3I1R3MassTermLog_sound) (by decide +kernel) +def CB1_4_3I1R3H : Ball := ⟨0, (13468741 / 312500000000000000000000000000)⟩ +lemma CB1_4_3I1R3H_sound : CB1_4_3I1R3H.Encloses (homogeneousEntropy CB1_4_3I1R3Value) := by + exact contains_sound (homogeneous_enclosed CB1_4_3I1R3Value CB1_4_3I1R3MassTerm_sound CB1_4_3I1R3Entropy_sound) (by decide +kernel) +def CB1_4_3I1R4Value (a : Fin 6) : ℝ := residualLaw (below (shape 1 4 3)) (fun u => (stageBLaw (shape 1 4 3) u : ℝ)) (stageBPriority (shape 1 4 3)) 1 (fun u a => (littleLaw (shape 1 4 3) u ((stageBPriority (shape 1 4 3)) 1) a : ℝ)) 4 a +def CB1_4_3I1R4Raw (a : Fin 6) : Ball := residualBall (below (shape 1 4 3)) B1_4_3Law (stageBPriority (shape 1 4 3)) 1 (fun u => B1_4_3Little u ((stageBPriority (shape 1 4 3)) 1)) 4 a +lemma CB1_4_3I1R4Raw_sound (a : Fin 6) : + (CB1_4_3I1R4Raw a).Encloses (CB1_4_3I1R4Value a) := by + exact residualBall_sound_on (below (shape 1 4 3)) B1_4_3Law (fun u => (stageBLaw (shape 1 4 3) u : ℝ)) (stageBPriority (shape 1 4 3)) 1 (fun u => B1_4_3Little u ((stageBPriority (shape 1 4 3)) 1)) (fun u a => (littleLaw (shape 1 4 3) u ((stageBPriority (shape 1 4 3)) 1) a : ℝ)) (fun u _ => B1_4_3Law_sound u) (fun u _ a => B1_4_3Little_sound u ((stageBPriority (shape 1 4 3)) 1) a) 4 a +def CB1_4_3I1R4Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB1_4_3I1R4Certificates_valid : + CB1_4_3I1R4Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_4_3I1R4CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB1_4_3I1R4P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_4_3I1R4Certificates (CB1_4_3I1R4CertificateIndex a)).input +lemma CB1_4_3I1R4P_check : ∀ a : Fin 6, contains (CB1_4_3I1R4Raw a) (CB1_4_3I1R4P a) = true := by + decide +kernel +lemma CB1_4_3I1R4P_sound (a : Fin 6) : + (CB1_4_3I1R4P a).Encloses (CB1_4_3I1R4Value a) := + contains_sound (CB1_4_3I1R4Raw_sound a) (CB1_4_3I1R4P_check a) +def CB1_4_3I1R4Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_4_3I1R4Certificates (CB1_4_3I1R4CertificateIndex a)).output +lemma CB1_4_3I1R4Terms_sound (a : Fin 6) : + (CB1_4_3I1R4Terms a).Encloses (Foundation.entropyTerm (CB1_4_3I1R4Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_4_3I1R4Certificates_valid + (CB1_4_3I1R4CertificateIndex a) (CB1_4_3I1R4P_sound a) +def CB1_4_3I1R4Entropy : Ball := ⟨0, 0⟩ +lemma CB1_4_3I1R4Entropy_sound : CB1_4_3I1R4Entropy.Encloses (Foundation.finiteEntropy CB1_4_3I1R4Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_4_3I1R4Value CB1_4_3I1R4Terms CB1_4_3I1R4Terms_sound) (by decide +kernel) +def CB1_4_3I1R4Mass : Ball := ⟨0, 0⟩ +lemma CB1_4_3I1R4Mass_sound : CB1_4_3I1R4Mass.Encloses (∑ a, CB1_4_3I1R4Value a) := by + exact contains_sound (finSumBall_sound 6 CB1_4_3I1R4P CB1_4_3I1R4Value CB1_4_3I1R4P_sound) (by decide +kernel) +def CB1_4_3I1R4MassTerm : Ball := .exact 0 +lemma CB1_4_3I1R4MassTerm_sound : CB1_4_3I1R4MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_4_3I1R4Value a))) := + entropyTerm_zero_ball (CB1_4_3I1R4Mass_sound) +def CB1_4_3I1R4H : Ball := ⟨0, 0⟩ +lemma CB1_4_3I1R4H_sound : CB1_4_3I1R4H.Encloses (homogeneousEntropy CB1_4_3I1R4Value) := by + exact contains_sound (homogeneous_enclosed CB1_4_3I1R4Value CB1_4_3I1R4MassTerm_sound CB1_4_3I1R4Entropy_sound) (by decide +kernel) +def CB1_4_3I1R5Value (a : Fin 6) : ℝ := residualLaw (below (shape 1 4 3)) (fun u => (stageBLaw (shape 1 4 3) u : ℝ)) (stageBPriority (shape 1 4 3)) 1 (fun u a => (littleLaw (shape 1 4 3) u ((stageBPriority (shape 1 4 3)) 1) a : ℝ)) 5 a +def CB1_4_3I1R5Raw (a : Fin 6) : Ball := residualBall (below (shape 1 4 3)) B1_4_3Law (stageBPriority (shape 1 4 3)) 1 (fun u => B1_4_3Little u ((stageBPriority (shape 1 4 3)) 1)) 5 a +lemma CB1_4_3I1R5Raw_sound (a : Fin 6) : + (CB1_4_3I1R5Raw a).Encloses (CB1_4_3I1R5Value a) := by + exact residualBall_sound_on (below (shape 1 4 3)) B1_4_3Law (fun u => (stageBLaw (shape 1 4 3) u : ℝ)) (stageBPriority (shape 1 4 3)) 1 (fun u => B1_4_3Little u ((stageBPriority (shape 1 4 3)) 1)) (fun u a => (littleLaw (shape 1 4 3) u ((stageBPriority (shape 1 4 3)) 1) a : ℝ)) (fun u _ => B1_4_3Law_sound u) (fun u _ a => B1_4_3Little_sound u ((stageBPriority (shape 1 4 3)) 1) a) 5 a +def CB1_4_3I1R5Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB1_4_3I1R5Certificates_valid : + CB1_4_3I1R5Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_4_3I1R5CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB1_4_3I1R5P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_4_3I1R5Certificates (CB1_4_3I1R5CertificateIndex a)).input +lemma CB1_4_3I1R5P_check : ∀ a : Fin 6, contains (CB1_4_3I1R5Raw a) (CB1_4_3I1R5P a) = true := by + decide +kernel +lemma CB1_4_3I1R5P_sound (a : Fin 6) : + (CB1_4_3I1R5P a).Encloses (CB1_4_3I1R5Value a) := + contains_sound (CB1_4_3I1R5Raw_sound a) (CB1_4_3I1R5P_check a) +def CB1_4_3I1R5Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_4_3I1R5Certificates (CB1_4_3I1R5CertificateIndex a)).output +lemma CB1_4_3I1R5Terms_sound (a : Fin 6) : + (CB1_4_3I1R5Terms a).Encloses (Foundation.entropyTerm (CB1_4_3I1R5Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_4_3I1R5Certificates_valid + (CB1_4_3I1R5CertificateIndex a) (CB1_4_3I1R5P_sound a) +def CB1_4_3I1R5Entropy : Ball := ⟨0, 0⟩ +lemma CB1_4_3I1R5Entropy_sound : CB1_4_3I1R5Entropy.Encloses (Foundation.finiteEntropy CB1_4_3I1R5Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_4_3I1R5Value CB1_4_3I1R5Terms CB1_4_3I1R5Terms_sound) (by decide +kernel) +def CB1_4_3I1R5Mass : Ball := ⟨0, 0⟩ +lemma CB1_4_3I1R5Mass_sound : CB1_4_3I1R5Mass.Encloses (∑ a, CB1_4_3I1R5Value a) := by + exact contains_sound (finSumBall_sound 6 CB1_4_3I1R5P CB1_4_3I1R5Value CB1_4_3I1R5P_sound) (by decide +kernel) +def CB1_4_3I1R5MassTerm : Ball := .exact 0 +lemma CB1_4_3I1R5MassTerm_sound : CB1_4_3I1R5MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_4_3I1R5Value a))) := + entropyTerm_zero_ball (CB1_4_3I1R5Mass_sound) +def CB1_4_3I1R5H : Ball := ⟨0, 0⟩ +lemma CB1_4_3I1R5H_sound : CB1_4_3I1R5H.Encloses (homogeneousEntropy CB1_4_3I1R5Value) := by + exact contains_sound (homogeneous_enclosed CB1_4_3I1R5Value CB1_4_3I1R5MassTerm_sound CB1_4_3I1R5Entropy_sound) (by decide +kernel) +def CB1_4_3I1R6Value (a : Fin 6) : ℝ := residualLaw (below (shape 1 4 3)) (fun u => (stageBLaw (shape 1 4 3) u : ℝ)) (stageBPriority (shape 1 4 3)) 1 (fun u a => (littleLaw (shape 1 4 3) u ((stageBPriority (shape 1 4 3)) 1) a : ℝ)) 6 a +def CB1_4_3I1R6Raw (a : Fin 6) : Ball := residualBall (below (shape 1 4 3)) B1_4_3Law (stageBPriority (shape 1 4 3)) 1 (fun u => B1_4_3Little u ((stageBPriority (shape 1 4 3)) 1)) 6 a +lemma CB1_4_3I1R6Raw_sound (a : Fin 6) : + (CB1_4_3I1R6Raw a).Encloses (CB1_4_3I1R6Value a) := by + exact residualBall_sound_on (below (shape 1 4 3)) B1_4_3Law (fun u => (stageBLaw (shape 1 4 3) u : ℝ)) (stageBPriority (shape 1 4 3)) 1 (fun u => B1_4_3Little u ((stageBPriority (shape 1 4 3)) 1)) (fun u a => (littleLaw (shape 1 4 3) u ((stageBPriority (shape 1 4 3)) 1) a : ℝ)) (fun u _ => B1_4_3Law_sound u) (fun u _ a => B1_4_3Little_sound u ((stageBPriority (shape 1 4 3)) 1) a) 6 a +def CB1_4_3I1R6Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB1_4_3I1R6Certificates_valid : + CB1_4_3I1R6Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_4_3I1R6CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB1_4_3I1R6P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_4_3I1R6Certificates (CB1_4_3I1R6CertificateIndex a)).input +lemma CB1_4_3I1R6P_check : ∀ a : Fin 6, contains (CB1_4_3I1R6Raw a) (CB1_4_3I1R6P a) = true := by + decide +kernel +lemma CB1_4_3I1R6P_sound (a : Fin 6) : + (CB1_4_3I1R6P a).Encloses (CB1_4_3I1R6Value a) := + contains_sound (CB1_4_3I1R6Raw_sound a) (CB1_4_3I1R6P_check a) +def CB1_4_3I1R6Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_4_3I1R6Certificates (CB1_4_3I1R6CertificateIndex a)).output +lemma CB1_4_3I1R6Terms_sound (a : Fin 6) : + (CB1_4_3I1R6Terms a).Encloses (Foundation.entropyTerm (CB1_4_3I1R6Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_4_3I1R6Certificates_valid + (CB1_4_3I1R6CertificateIndex a) (CB1_4_3I1R6P_sound a) +def CB1_4_3I1R6Entropy : Ball := ⟨0, 0⟩ +lemma CB1_4_3I1R6Entropy_sound : CB1_4_3I1R6Entropy.Encloses (Foundation.finiteEntropy CB1_4_3I1R6Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_4_3I1R6Value CB1_4_3I1R6Terms CB1_4_3I1R6Terms_sound) (by decide +kernel) +def CB1_4_3I1R6Mass : Ball := ⟨0, 0⟩ +lemma CB1_4_3I1R6Mass_sound : CB1_4_3I1R6Mass.Encloses (∑ a, CB1_4_3I1R6Value a) := by + exact contains_sound (finSumBall_sound 6 CB1_4_3I1R6P CB1_4_3I1R6Value CB1_4_3I1R6P_sound) (by decide +kernel) +def CB1_4_3I1R6MassTerm : Ball := .exact 0 +lemma CB1_4_3I1R6MassTerm_sound : CB1_4_3I1R6MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_4_3I1R6Value a))) := + entropyTerm_zero_ball (CB1_4_3I1R6Mass_sound) +def CB1_4_3I1R6H : Ball := ⟨0, 0⟩ +lemma CB1_4_3I1R6H_sound : CB1_4_3I1R6H.Encloses (homogeneousEntropy CB1_4_3I1R6Value) := by + exact contains_sound (homogeneous_enclosed CB1_4_3I1R6Value CB1_4_3I1R6MassTerm_sound CB1_4_3I1R6Entropy_sound) (by decide +kernel) +def CB1_4_3I1R7Value (a : Fin 6) : ℝ := residualLaw (below (shape 1 4 3)) (fun u => (stageBLaw (shape 1 4 3) u : ℝ)) (stageBPriority (shape 1 4 3)) 1 (fun u a => (littleLaw (shape 1 4 3) u ((stageBPriority (shape 1 4 3)) 1) a : ℝ)) 7 a +def CB1_4_3I1R7Raw (a : Fin 6) : Ball := residualBall (below (shape 1 4 3)) B1_4_3Law (stageBPriority (shape 1 4 3)) 1 (fun u => B1_4_3Little u ((stageBPriority (shape 1 4 3)) 1)) 7 a +lemma CB1_4_3I1R7Raw_sound (a : Fin 6) : + (CB1_4_3I1R7Raw a).Encloses (CB1_4_3I1R7Value a) := by + exact residualBall_sound_on (below (shape 1 4 3)) B1_4_3Law (fun u => (stageBLaw (shape 1 4 3) u : ℝ)) (stageBPriority (shape 1 4 3)) 1 (fun u => B1_4_3Little u ((stageBPriority (shape 1 4 3)) 1)) (fun u a => (littleLaw (shape 1 4 3) u ((stageBPriority (shape 1 4 3)) 1) a : ℝ)) (fun u _ => B1_4_3Law_sound u) (fun u _ a => B1_4_3Little_sound u ((stageBPriority (shape 1 4 3)) 1) a) 7 a +def CB1_4_3I1R7Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB1_4_3I1R7Certificates_valid : + CB1_4_3I1R7Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_4_3I1R7CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB1_4_3I1R7P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_4_3I1R7Certificates (CB1_4_3I1R7CertificateIndex a)).input +lemma CB1_4_3I1R7P_check : ∀ a : Fin 6, contains (CB1_4_3I1R7Raw a) (CB1_4_3I1R7P a) = true := by + decide +kernel +lemma CB1_4_3I1R7P_sound (a : Fin 6) : + (CB1_4_3I1R7P a).Encloses (CB1_4_3I1R7Value a) := + contains_sound (CB1_4_3I1R7Raw_sound a) (CB1_4_3I1R7P_check a) +def CB1_4_3I1R7Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_4_3I1R7Certificates (CB1_4_3I1R7CertificateIndex a)).output +lemma CB1_4_3I1R7Terms_sound (a : Fin 6) : + (CB1_4_3I1R7Terms a).Encloses (Foundation.entropyTerm (CB1_4_3I1R7Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_4_3I1R7Certificates_valid + (CB1_4_3I1R7CertificateIndex a) (CB1_4_3I1R7P_sound a) +def CB1_4_3I1R7Entropy : Ball := ⟨0, 0⟩ +lemma CB1_4_3I1R7Entropy_sound : CB1_4_3I1R7Entropy.Encloses (Foundation.finiteEntropy CB1_4_3I1R7Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_4_3I1R7Value CB1_4_3I1R7Terms CB1_4_3I1R7Terms_sound) (by decide +kernel) +def CB1_4_3I1R7Mass : Ball := ⟨0, 0⟩ +lemma CB1_4_3I1R7Mass_sound : CB1_4_3I1R7Mass.Encloses (∑ a, CB1_4_3I1R7Value a) := by + exact contains_sound (finSumBall_sound 6 CB1_4_3I1R7P CB1_4_3I1R7Value CB1_4_3I1R7P_sound) (by decide +kernel) +def CB1_4_3I1R7MassTerm : Ball := .exact 0 +lemma CB1_4_3I1R7MassTerm_sound : CB1_4_3I1R7MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_4_3I1R7Value a))) := + entropyTerm_zero_ball (CB1_4_3I1R7Mass_sound) +def CB1_4_3I1R7H : Ball := ⟨0, 0⟩ +lemma CB1_4_3I1R7H_sound : CB1_4_3I1R7H.Encloses (homogeneousEntropy CB1_4_3I1R7Value) := by + exact contains_sound (homogeneous_enclosed CB1_4_3I1R7Value CB1_4_3I1R7MassTerm_sound CB1_4_3I1R7Entropy_sound) (by decide +kernel) +def CB1_4_3I1R8Value (a : Fin 6) : ℝ := residualLaw (below (shape 1 4 3)) (fun u => (stageBLaw (shape 1 4 3) u : ℝ)) (stageBPriority (shape 1 4 3)) 1 (fun u a => (littleLaw (shape 1 4 3) u ((stageBPriority (shape 1 4 3)) 1) a : ℝ)) 8 a +def CB1_4_3I1R8Raw (a : Fin 6) : Ball := residualBall (below (shape 1 4 3)) B1_4_3Law (stageBPriority (shape 1 4 3)) 1 (fun u => B1_4_3Little u ((stageBPriority (shape 1 4 3)) 1)) 8 a +lemma CB1_4_3I1R8Raw_sound (a : Fin 6) : + (CB1_4_3I1R8Raw a).Encloses (CB1_4_3I1R8Value a) := by + exact residualBall_sound_on (below (shape 1 4 3)) B1_4_3Law (fun u => (stageBLaw (shape 1 4 3) u : ℝ)) (stageBPriority (shape 1 4 3)) 1 (fun u => B1_4_3Little u ((stageBPriority (shape 1 4 3)) 1)) (fun u a => (littleLaw (shape 1 4 3) u ((stageBPriority (shape 1 4 3)) 1) a : ℝ)) (fun u _ => B1_4_3Law_sound u) (fun u _ a => B1_4_3Little_sound u ((stageBPriority (shape 1 4 3)) 1) a) 8 a +def CB1_4_3I1R8Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB1_4_3I1R8Certificates_valid : + CB1_4_3I1R8Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_4_3I1R8CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB1_4_3I1R8P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_4_3I1R8Certificates (CB1_4_3I1R8CertificateIndex a)).input +lemma CB1_4_3I1R8P_check : ∀ a : Fin 6, contains (CB1_4_3I1R8Raw a) (CB1_4_3I1R8P a) = true := by + decide +kernel +lemma CB1_4_3I1R8P_sound (a : Fin 6) : + (CB1_4_3I1R8P a).Encloses (CB1_4_3I1R8Value a) := + contains_sound (CB1_4_3I1R8Raw_sound a) (CB1_4_3I1R8P_check a) +def CB1_4_3I1R8Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_4_3I1R8Certificates (CB1_4_3I1R8CertificateIndex a)).output +lemma CB1_4_3I1R8Terms_sound (a : Fin 6) : + (CB1_4_3I1R8Terms a).Encloses (Foundation.entropyTerm (CB1_4_3I1R8Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_4_3I1R8Certificates_valid + (CB1_4_3I1R8CertificateIndex a) (CB1_4_3I1R8P_sound a) +def CB1_4_3I1R8Entropy : Ball := ⟨0, 0⟩ +lemma CB1_4_3I1R8Entropy_sound : CB1_4_3I1R8Entropy.Encloses (Foundation.finiteEntropy CB1_4_3I1R8Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_4_3I1R8Value CB1_4_3I1R8Terms CB1_4_3I1R8Terms_sound) (by decide +kernel) +def CB1_4_3I1R8Mass : Ball := ⟨0, 0⟩ +lemma CB1_4_3I1R8Mass_sound : CB1_4_3I1R8Mass.Encloses (∑ a, CB1_4_3I1R8Value a) := by + exact contains_sound (finSumBall_sound 6 CB1_4_3I1R8P CB1_4_3I1R8Value CB1_4_3I1R8P_sound) (by decide +kernel) +def CB1_4_3I1R8MassTerm : Ball := .exact 0 +lemma CB1_4_3I1R8MassTerm_sound : CB1_4_3I1R8MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_4_3I1R8Value a))) := + entropyTerm_zero_ball (CB1_4_3I1R8Mass_sound) +def CB1_4_3I1R8H : Ball := ⟨0, 0⟩ +lemma CB1_4_3I1R8H_sound : CB1_4_3I1R8H.Encloses (homogeneousEntropy CB1_4_3I1R8Value) := by + exact contains_sound (homogeneous_enclosed CB1_4_3I1R8Value CB1_4_3I1R8MassTerm_sound CB1_4_3I1R8Entropy_sound) (by decide +kernel) +def CB1_4_3I1R9Value (a : Fin 6) : ℝ := residualLaw (below (shape 1 4 3)) (fun u => (stageBLaw (shape 1 4 3) u : ℝ)) (stageBPriority (shape 1 4 3)) 1 (fun u a => (littleLaw (shape 1 4 3) u ((stageBPriority (shape 1 4 3)) 1) a : ℝ)) 9 a +def CB1_4_3I1R9Raw (a : Fin 6) : Ball := residualBall (below (shape 1 4 3)) B1_4_3Law (stageBPriority (shape 1 4 3)) 1 (fun u => B1_4_3Little u ((stageBPriority (shape 1 4 3)) 1)) 9 a +lemma CB1_4_3I1R9Raw_sound (a : Fin 6) : + (CB1_4_3I1R9Raw a).Encloses (CB1_4_3I1R9Value a) := by + exact residualBall_sound_on (below (shape 1 4 3)) B1_4_3Law (fun u => (stageBLaw (shape 1 4 3) u : ℝ)) (stageBPriority (shape 1 4 3)) 1 (fun u => B1_4_3Little u ((stageBPriority (shape 1 4 3)) 1)) (fun u a => (littleLaw (shape 1 4 3) u ((stageBPriority (shape 1 4 3)) 1) a : ℝ)) (fun u _ => B1_4_3Law_sound u) (fun u _ a => B1_4_3Little_sound u ((stageBPriority (shape 1 4 3)) 1) a) 9 a +def CB1_4_3I1R9Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB1_4_3I1R9Certificates_valid : + CB1_4_3I1R9Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_4_3I1R9CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB1_4_3I1R9P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_4_3I1R9Certificates (CB1_4_3I1R9CertificateIndex a)).input +lemma CB1_4_3I1R9P_check : ∀ a : Fin 6, contains (CB1_4_3I1R9Raw a) (CB1_4_3I1R9P a) = true := by + decide +kernel +lemma CB1_4_3I1R9P_sound (a : Fin 6) : + (CB1_4_3I1R9P a).Encloses (CB1_4_3I1R9Value a) := + contains_sound (CB1_4_3I1R9Raw_sound a) (CB1_4_3I1R9P_check a) +def CB1_4_3I1R9Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_4_3I1R9Certificates (CB1_4_3I1R9CertificateIndex a)).output +lemma CB1_4_3I1R9Terms_sound (a : Fin 6) : + (CB1_4_3I1R9Terms a).Encloses (Foundation.entropyTerm (CB1_4_3I1R9Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_4_3I1R9Certificates_valid + (CB1_4_3I1R9CertificateIndex a) (CB1_4_3I1R9P_sound a) +def CB1_4_3I1R9Entropy : Ball := ⟨0, 0⟩ +lemma CB1_4_3I1R9Entropy_sound : CB1_4_3I1R9Entropy.Encloses (Foundation.finiteEntropy CB1_4_3I1R9Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_4_3I1R9Value CB1_4_3I1R9Terms CB1_4_3I1R9Terms_sound) (by decide +kernel) +def CB1_4_3I1R9Mass : Ball := ⟨0, 0⟩ +lemma CB1_4_3I1R9Mass_sound : CB1_4_3I1R9Mass.Encloses (∑ a, CB1_4_3I1R9Value a) := by + exact contains_sound (finSumBall_sound 6 CB1_4_3I1R9P CB1_4_3I1R9Value CB1_4_3I1R9P_sound) (by decide +kernel) +def CB1_4_3I1R9MassTerm : Ball := .exact 0 +lemma CB1_4_3I1R9MassTerm_sound : CB1_4_3I1R9MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_4_3I1R9Value a))) := + entropyTerm_zero_ball (CB1_4_3I1R9Mass_sound) +def CB1_4_3I1R9H : Ball := ⟨0, 0⟩ +lemma CB1_4_3I1R9H_sound : CB1_4_3I1R9H.Encloses (homogeneousEntropy CB1_4_3I1R9Value) := by + exact contains_sound (homogeneous_enclosed CB1_4_3I1R9Value CB1_4_3I1R9MassTerm_sound CB1_4_3I1R9Entropy_sound) (by decide +kernel) +def CB1_4_3I1R10Value (a : Fin 6) : ℝ := residualLaw (below (shape 1 4 3)) (fun u => (stageBLaw (shape 1 4 3) u : ℝ)) (stageBPriority (shape 1 4 3)) 1 (fun u a => (littleLaw (shape 1 4 3) u ((stageBPriority (shape 1 4 3)) 1) a : ℝ)) 10 a +def CB1_4_3I1R10Raw (a : Fin 6) : Ball := residualBall (below (shape 1 4 3)) B1_4_3Law (stageBPriority (shape 1 4 3)) 1 (fun u => B1_4_3Little u ((stageBPriority (shape 1 4 3)) 1)) 10 a +lemma CB1_4_3I1R10Raw_sound (a : Fin 6) : + (CB1_4_3I1R10Raw a).Encloses (CB1_4_3I1R10Value a) := by + exact residualBall_sound_on (below (shape 1 4 3)) B1_4_3Law (fun u => (stageBLaw (shape 1 4 3) u : ℝ)) (stageBPriority (shape 1 4 3)) 1 (fun u => B1_4_3Little u ((stageBPriority (shape 1 4 3)) 1)) (fun u a => (littleLaw (shape 1 4 3) u ((stageBPriority (shape 1 4 3)) 1) a : ℝ)) (fun u _ => B1_4_3Law_sound u) (fun u _ a => B1_4_3Little_sound u ((stageBPriority (shape 1 4 3)) 1) a) 10 a +def CB1_4_3I1R10Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB1_4_3I1R10Certificates_valid : + CB1_4_3I1R10Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_4_3I1R10CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB1_4_3I1R10P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_4_3I1R10Certificates (CB1_4_3I1R10CertificateIndex a)).input +lemma CB1_4_3I1R10P_check : ∀ a : Fin 6, contains (CB1_4_3I1R10Raw a) (CB1_4_3I1R10P a) = true := by + decide +kernel +lemma CB1_4_3I1R10P_sound (a : Fin 6) : + (CB1_4_3I1R10P a).Encloses (CB1_4_3I1R10Value a) := + contains_sound (CB1_4_3I1R10Raw_sound a) (CB1_4_3I1R10P_check a) +def CB1_4_3I1R10Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_4_3I1R10Certificates (CB1_4_3I1R10CertificateIndex a)).output +lemma CB1_4_3I1R10Terms_sound (a : Fin 6) : + (CB1_4_3I1R10Terms a).Encloses (Foundation.entropyTerm (CB1_4_3I1R10Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_4_3I1R10Certificates_valid + (CB1_4_3I1R10CertificateIndex a) (CB1_4_3I1R10P_sound a) +def CB1_4_3I1R10Entropy : Ball := ⟨0, 0⟩ +lemma CB1_4_3I1R10Entropy_sound : CB1_4_3I1R10Entropy.Encloses (Foundation.finiteEntropy CB1_4_3I1R10Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_4_3I1R10Value CB1_4_3I1R10Terms CB1_4_3I1R10Terms_sound) (by decide +kernel) +def CB1_4_3I1R10Mass : Ball := ⟨0, 0⟩ +lemma CB1_4_3I1R10Mass_sound : CB1_4_3I1R10Mass.Encloses (∑ a, CB1_4_3I1R10Value a) := by + exact contains_sound (finSumBall_sound 6 CB1_4_3I1R10P CB1_4_3I1R10Value CB1_4_3I1R10P_sound) (by decide +kernel) +def CB1_4_3I1R10MassTerm : Ball := .exact 0 +lemma CB1_4_3I1R10MassTerm_sound : CB1_4_3I1R10MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_4_3I1R10Value a))) := + entropyTerm_zero_ball (CB1_4_3I1R10Mass_sound) +def CB1_4_3I1R10H : Ball := ⟨0, 0⟩ +lemma CB1_4_3I1R10H_sound : CB1_4_3I1R10H.Encloses (homogeneousEntropy CB1_4_3I1R10Value) := by + exact contains_sound (homogeneous_enclosed CB1_4_3I1R10Value CB1_4_3I1R10MassTerm_sound CB1_4_3I1R10Entropy_sound) (by decide +kernel) +def CB1_4_3I1R11Value (a : Fin 6) : ℝ := residualLaw (below (shape 1 4 3)) (fun u => (stageBLaw (shape 1 4 3) u : ℝ)) (stageBPriority (shape 1 4 3)) 1 (fun u a => (littleLaw (shape 1 4 3) u ((stageBPriority (shape 1 4 3)) 1) a : ℝ)) 11 a +def CB1_4_3I1R11Raw (a : Fin 6) : Ball := residualBall (below (shape 1 4 3)) B1_4_3Law (stageBPriority (shape 1 4 3)) 1 (fun u => B1_4_3Little u ((stageBPriority (shape 1 4 3)) 1)) 11 a +lemma CB1_4_3I1R11Raw_sound (a : Fin 6) : + (CB1_4_3I1R11Raw a).Encloses (CB1_4_3I1R11Value a) := by + exact residualBall_sound_on (below (shape 1 4 3)) B1_4_3Law (fun u => (stageBLaw (shape 1 4 3) u : ℝ)) (stageBPriority (shape 1 4 3)) 1 (fun u => B1_4_3Little u ((stageBPriority (shape 1 4 3)) 1)) (fun u a => (littleLaw (shape 1 4 3) u ((stageBPriority (shape 1 4 3)) 1) a : ℝ)) (fun u _ => B1_4_3Law_sound u) (fun u _ a => B1_4_3Little_sound u ((stageBPriority (shape 1 4 3)) 1) a) 11 a +def CB1_4_3I1R11Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB1_4_3I1R11Certificates_valid : + CB1_4_3I1R11Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_4_3I1R11CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB1_4_3I1R11P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_4_3I1R11Certificates (CB1_4_3I1R11CertificateIndex a)).input +lemma CB1_4_3I1R11P_check : ∀ a : Fin 6, contains (CB1_4_3I1R11Raw a) (CB1_4_3I1R11P a) = true := by + decide +kernel +lemma CB1_4_3I1R11P_sound (a : Fin 6) : + (CB1_4_3I1R11P a).Encloses (CB1_4_3I1R11Value a) := + contains_sound (CB1_4_3I1R11Raw_sound a) (CB1_4_3I1R11P_check a) +def CB1_4_3I1R11Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_4_3I1R11Certificates (CB1_4_3I1R11CertificateIndex a)).output +lemma CB1_4_3I1R11Terms_sound (a : Fin 6) : + (CB1_4_3I1R11Terms a).Encloses (Foundation.entropyTerm (CB1_4_3I1R11Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_4_3I1R11Certificates_valid + (CB1_4_3I1R11CertificateIndex a) (CB1_4_3I1R11P_sound a) +def CB1_4_3I1R11Entropy : Ball := ⟨0, 0⟩ +lemma CB1_4_3I1R11Entropy_sound : CB1_4_3I1R11Entropy.Encloses (Foundation.finiteEntropy CB1_4_3I1R11Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_4_3I1R11Value CB1_4_3I1R11Terms CB1_4_3I1R11Terms_sound) (by decide +kernel) +def CB1_4_3I1R11Mass : Ball := ⟨0, 0⟩ +lemma CB1_4_3I1R11Mass_sound : CB1_4_3I1R11Mass.Encloses (∑ a, CB1_4_3I1R11Value a) := by + exact contains_sound (finSumBall_sound 6 CB1_4_3I1R11P CB1_4_3I1R11Value CB1_4_3I1R11P_sound) (by decide +kernel) +def CB1_4_3I1R11MassTerm : Ball := .exact 0 +lemma CB1_4_3I1R11MassTerm_sound : CB1_4_3I1R11MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_4_3I1R11Value a))) := + entropyTerm_zero_ball (CB1_4_3I1R11Mass_sound) +def CB1_4_3I1R11H : Ball := ⟨0, 0⟩ +lemma CB1_4_3I1R11H_sound : CB1_4_3I1R11H.Encloses (homogeneousEntropy CB1_4_3I1R11Value) := by + exact contains_sound (homogeneous_enclosed CB1_4_3I1R11Value CB1_4_3I1R11MassTerm_sound CB1_4_3I1R11Entropy_sound) (by decide +kernel) +def CB1_4_3I1R12Value (a : Fin 6) : ℝ := residualLaw (below (shape 1 4 3)) (fun u => (stageBLaw (shape 1 4 3) u : ℝ)) (stageBPriority (shape 1 4 3)) 1 (fun u a => (littleLaw (shape 1 4 3) u ((stageBPriority (shape 1 4 3)) 1) a : ℝ)) 12 a +def CB1_4_3I1R12Raw (a : Fin 6) : Ball := residualBall (below (shape 1 4 3)) B1_4_3Law (stageBPriority (shape 1 4 3)) 1 (fun u => B1_4_3Little u ((stageBPriority (shape 1 4 3)) 1)) 12 a +lemma CB1_4_3I1R12Raw_sound (a : Fin 6) : + (CB1_4_3I1R12Raw a).Encloses (CB1_4_3I1R12Value a) := by + exact residualBall_sound_on (below (shape 1 4 3)) B1_4_3Law (fun u => (stageBLaw (shape 1 4 3) u : ℝ)) (stageBPriority (shape 1 4 3)) 1 (fun u => B1_4_3Little u ((stageBPriority (shape 1 4 3)) 1)) (fun u a => (littleLaw (shape 1 4 3) u ((stageBPriority (shape 1 4 3)) 1) a : ℝ)) (fun u _ => B1_4_3Law_sound u) (fun u _ a => B1_4_3Little_sound u ((stageBPriority (shape 1 4 3)) 1) a) 12 a +def CB1_4_3I1R12Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB1_4_3I1R12Certificates_valid : + CB1_4_3I1R12Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_4_3I1R12CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB1_4_3I1R12P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_4_3I1R12Certificates (CB1_4_3I1R12CertificateIndex a)).input +lemma CB1_4_3I1R12P_check : ∀ a : Fin 6, contains (CB1_4_3I1R12Raw a) (CB1_4_3I1R12P a) = true := by + decide +kernel +lemma CB1_4_3I1R12P_sound (a : Fin 6) : + (CB1_4_3I1R12P a).Encloses (CB1_4_3I1R12Value a) := + contains_sound (CB1_4_3I1R12Raw_sound a) (CB1_4_3I1R12P_check a) +def CB1_4_3I1R12Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_4_3I1R12Certificates (CB1_4_3I1R12CertificateIndex a)).output +lemma CB1_4_3I1R12Terms_sound (a : Fin 6) : + (CB1_4_3I1R12Terms a).Encloses (Foundation.entropyTerm (CB1_4_3I1R12Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_4_3I1R12Certificates_valid + (CB1_4_3I1R12CertificateIndex a) (CB1_4_3I1R12P_sound a) +def CB1_4_3I1R12Entropy : Ball := ⟨0, 0⟩ +lemma CB1_4_3I1R12Entropy_sound : CB1_4_3I1R12Entropy.Encloses (Foundation.finiteEntropy CB1_4_3I1R12Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_4_3I1R12Value CB1_4_3I1R12Terms CB1_4_3I1R12Terms_sound) (by decide +kernel) +def CB1_4_3I1R12Mass : Ball := ⟨0, 0⟩ +lemma CB1_4_3I1R12Mass_sound : CB1_4_3I1R12Mass.Encloses (∑ a, CB1_4_3I1R12Value a) := by + exact contains_sound (finSumBall_sound 6 CB1_4_3I1R12P CB1_4_3I1R12Value CB1_4_3I1R12P_sound) (by decide +kernel) +def CB1_4_3I1R12MassTerm : Ball := .exact 0 +lemma CB1_4_3I1R12MassTerm_sound : CB1_4_3I1R12MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_4_3I1R12Value a))) := + entropyTerm_zero_ball (CB1_4_3I1R12Mass_sound) +def CB1_4_3I1R12H : Ball := ⟨0, 0⟩ +lemma CB1_4_3I1R12H_sound : CB1_4_3I1R12H.Encloses (homogeneousEntropy CB1_4_3I1R12Value) := by + exact contains_sound (homogeneous_enclosed CB1_4_3I1R12Value CB1_4_3I1R12MassTerm_sound CB1_4_3I1R12Entropy_sound) (by decide +kernel) +def CB1_4_3I1R13Value (a : Fin 6) : ℝ := residualLaw (below (shape 1 4 3)) (fun u => (stageBLaw (shape 1 4 3) u : ℝ)) (stageBPriority (shape 1 4 3)) 1 (fun u a => (littleLaw (shape 1 4 3) u ((stageBPriority (shape 1 4 3)) 1) a : ℝ)) 13 a +def CB1_4_3I1R13Raw (a : Fin 6) : Ball := residualBall (below (shape 1 4 3)) B1_4_3Law (stageBPriority (shape 1 4 3)) 1 (fun u => B1_4_3Little u ((stageBPriority (shape 1 4 3)) 1)) 13 a +lemma CB1_4_3I1R13Raw_sound (a : Fin 6) : + (CB1_4_3I1R13Raw a).Encloses (CB1_4_3I1R13Value a) := by + exact residualBall_sound_on (below (shape 1 4 3)) B1_4_3Law (fun u => (stageBLaw (shape 1 4 3) u : ℝ)) (stageBPriority (shape 1 4 3)) 1 (fun u => B1_4_3Little u ((stageBPriority (shape 1 4 3)) 1)) (fun u a => (littleLaw (shape 1 4 3) u ((stageBPriority (shape 1 4 3)) 1) a : ℝ)) (fun u _ => B1_4_3Law_sound u) (fun u _ a => B1_4_3Little_sound u ((stageBPriority (shape 1 4 3)) 1) a) 13 a +def CB1_4_3I1R13Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB1_4_3I1R13Certificates_valid : + CB1_4_3I1R13Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_4_3I1R13CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB1_4_3I1R13P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_4_3I1R13Certificates (CB1_4_3I1R13CertificateIndex a)).input +lemma CB1_4_3I1R13P_check : ∀ a : Fin 6, contains (CB1_4_3I1R13Raw a) (CB1_4_3I1R13P a) = true := by + decide +kernel +lemma CB1_4_3I1R13P_sound (a : Fin 6) : + (CB1_4_3I1R13P a).Encloses (CB1_4_3I1R13Value a) := + contains_sound (CB1_4_3I1R13Raw_sound a) (CB1_4_3I1R13P_check a) +def CB1_4_3I1R13Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_4_3I1R13Certificates (CB1_4_3I1R13CertificateIndex a)).output +lemma CB1_4_3I1R13Terms_sound (a : Fin 6) : + (CB1_4_3I1R13Terms a).Encloses (Foundation.entropyTerm (CB1_4_3I1R13Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_4_3I1R13Certificates_valid + (CB1_4_3I1R13CertificateIndex a) (CB1_4_3I1R13P_sound a) +def CB1_4_3I1R13Entropy : Ball := ⟨0, 0⟩ +lemma CB1_4_3I1R13Entropy_sound : CB1_4_3I1R13Entropy.Encloses (Foundation.finiteEntropy CB1_4_3I1R13Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_4_3I1R13Value CB1_4_3I1R13Terms CB1_4_3I1R13Terms_sound) (by decide +kernel) +def CB1_4_3I1R13Mass : Ball := ⟨0, 0⟩ +lemma CB1_4_3I1R13Mass_sound : CB1_4_3I1R13Mass.Encloses (∑ a, CB1_4_3I1R13Value a) := by + exact contains_sound (finSumBall_sound 6 CB1_4_3I1R13P CB1_4_3I1R13Value CB1_4_3I1R13P_sound) (by decide +kernel) +def CB1_4_3I1R13MassTerm : Ball := .exact 0 +lemma CB1_4_3I1R13MassTerm_sound : CB1_4_3I1R13MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_4_3I1R13Value a))) := + entropyTerm_zero_ball (CB1_4_3I1R13Mass_sound) +def CB1_4_3I1R13H : Ball := ⟨0, 0⟩ +lemma CB1_4_3I1R13H_sound : CB1_4_3I1R13H.Encloses (homogeneousEntropy CB1_4_3I1R13Value) := by + exact contains_sound (homogeneous_enclosed CB1_4_3I1R13Value CB1_4_3I1R13MassTerm_sound CB1_4_3I1R13Entropy_sound) (by decide +kernel) +def CB1_4_3I1R14Value (a : Fin 6) : ℝ := residualLaw (below (shape 1 4 3)) (fun u => (stageBLaw (shape 1 4 3) u : ℝ)) (stageBPriority (shape 1 4 3)) 1 (fun u a => (littleLaw (shape 1 4 3) u ((stageBPriority (shape 1 4 3)) 1) a : ℝ)) 14 a +def CB1_4_3I1R14Raw (a : Fin 6) : Ball := residualBall (below (shape 1 4 3)) B1_4_3Law (stageBPriority (shape 1 4 3)) 1 (fun u => B1_4_3Little u ((stageBPriority (shape 1 4 3)) 1)) 14 a +lemma CB1_4_3I1R14Raw_sound (a : Fin 6) : + (CB1_4_3I1R14Raw a).Encloses (CB1_4_3I1R14Value a) := by + exact residualBall_sound_on (below (shape 1 4 3)) B1_4_3Law (fun u => (stageBLaw (shape 1 4 3) u : ℝ)) (stageBPriority (shape 1 4 3)) 1 (fun u => B1_4_3Little u ((stageBPriority (shape 1 4 3)) 1)) (fun u a => (littleLaw (shape 1 4 3) u ((stageBPriority (shape 1 4 3)) 1) a : ℝ)) (fun u _ => B1_4_3Law_sound u) (fun u _ a => B1_4_3Little_sound u ((stageBPriority (shape 1 4 3)) 1) a) 14 a +def CB1_4_3I1R14Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB1_4_3I1R14Certificates_valid : + CB1_4_3I1R14Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_4_3I1R14CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB1_4_3I1R14P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_4_3I1R14Certificates (CB1_4_3I1R14CertificateIndex a)).input +lemma CB1_4_3I1R14P_check : ∀ a : Fin 6, contains (CB1_4_3I1R14Raw a) (CB1_4_3I1R14P a) = true := by + decide +kernel +lemma CB1_4_3I1R14P_sound (a : Fin 6) : + (CB1_4_3I1R14P a).Encloses (CB1_4_3I1R14Value a) := + contains_sound (CB1_4_3I1R14Raw_sound a) (CB1_4_3I1R14P_check a) +def CB1_4_3I1R14Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_4_3I1R14Certificates (CB1_4_3I1R14CertificateIndex a)).output +lemma CB1_4_3I1R14Terms_sound (a : Fin 6) : + (CB1_4_3I1R14Terms a).Encloses (Foundation.entropyTerm (CB1_4_3I1R14Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_4_3I1R14Certificates_valid + (CB1_4_3I1R14CertificateIndex a) (CB1_4_3I1R14P_sound a) +def CB1_4_3I1R14Entropy : Ball := ⟨0, 0⟩ +lemma CB1_4_3I1R14Entropy_sound : CB1_4_3I1R14Entropy.Encloses (Foundation.finiteEntropy CB1_4_3I1R14Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_4_3I1R14Value CB1_4_3I1R14Terms CB1_4_3I1R14Terms_sound) (by decide +kernel) +def CB1_4_3I1R14Mass : Ball := ⟨0, 0⟩ +lemma CB1_4_3I1R14Mass_sound : CB1_4_3I1R14Mass.Encloses (∑ a, CB1_4_3I1R14Value a) := by + exact contains_sound (finSumBall_sound 6 CB1_4_3I1R14P CB1_4_3I1R14Value CB1_4_3I1R14P_sound) (by decide +kernel) +def CB1_4_3I1R14MassTerm : Ball := .exact 0 +lemma CB1_4_3I1R14MassTerm_sound : CB1_4_3I1R14MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_4_3I1R14Value a))) := + entropyTerm_zero_ball (CB1_4_3I1R14Mass_sound) +def CB1_4_3I1R14H : Ball := ⟨0, 0⟩ +lemma CB1_4_3I1R14H_sound : CB1_4_3I1R14H.Encloses (homogeneousEntropy CB1_4_3I1R14Value) := by + exact contains_sound (homogeneous_enclosed CB1_4_3I1R14Value CB1_4_3I1R14MassTerm_sound CB1_4_3I1R14Entropy_sound) (by decide +kernel) +def CB1_4_3I1R15Value (a : Fin 6) : ℝ := residualLaw (below (shape 1 4 3)) (fun u => (stageBLaw (shape 1 4 3) u : ℝ)) (stageBPriority (shape 1 4 3)) 1 (fun u a => (littleLaw (shape 1 4 3) u ((stageBPriority (shape 1 4 3)) 1) a : ℝ)) 15 a +def CB1_4_3I1R15Raw (a : Fin 6) : Ball := residualBall (below (shape 1 4 3)) B1_4_3Law (stageBPriority (shape 1 4 3)) 1 (fun u => B1_4_3Little u ((stageBPriority (shape 1 4 3)) 1)) 15 a +lemma CB1_4_3I1R15Raw_sound (a : Fin 6) : + (CB1_4_3I1R15Raw a).Encloses (CB1_4_3I1R15Value a) := by + exact residualBall_sound_on (below (shape 1 4 3)) B1_4_3Law (fun u => (stageBLaw (shape 1 4 3) u : ℝ)) (stageBPriority (shape 1 4 3)) 1 (fun u => B1_4_3Little u ((stageBPriority (shape 1 4 3)) 1)) (fun u a => (littleLaw (shape 1 4 3) u ((stageBPriority (shape 1 4 3)) 1) a : ℝ)) (fun u _ => B1_4_3Law_sound u) (fun u _ a => B1_4_3Little_sound u ((stageBPriority (shape 1 4 3)) 1) a) 15 a +def CB1_4_3I1R15Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB1_4_3I1R15Certificates_valid : + CB1_4_3I1R15Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_4_3I1R15CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB1_4_3I1R15P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_4_3I1R15Certificates (CB1_4_3I1R15CertificateIndex a)).input +lemma CB1_4_3I1R15P_check : ∀ a : Fin 6, contains (CB1_4_3I1R15Raw a) (CB1_4_3I1R15P a) = true := by + decide +kernel +lemma CB1_4_3I1R15P_sound (a : Fin 6) : + (CB1_4_3I1R15P a).Encloses (CB1_4_3I1R15Value a) := + contains_sound (CB1_4_3I1R15Raw_sound a) (CB1_4_3I1R15P_check a) +def CB1_4_3I1R15Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_4_3I1R15Certificates (CB1_4_3I1R15CertificateIndex a)).output +lemma CB1_4_3I1R15Terms_sound (a : Fin 6) : + (CB1_4_3I1R15Terms a).Encloses (Foundation.entropyTerm (CB1_4_3I1R15Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_4_3I1R15Certificates_valid + (CB1_4_3I1R15CertificateIndex a) (CB1_4_3I1R15P_sound a) +def CB1_4_3I1R15Entropy : Ball := ⟨0, 0⟩ +lemma CB1_4_3I1R15Entropy_sound : CB1_4_3I1R15Entropy.Encloses (Foundation.finiteEntropy CB1_4_3I1R15Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_4_3I1R15Value CB1_4_3I1R15Terms CB1_4_3I1R15Terms_sound) (by decide +kernel) +def CB1_4_3I1R15Mass : Ball := ⟨0, 0⟩ +lemma CB1_4_3I1R15Mass_sound : CB1_4_3I1R15Mass.Encloses (∑ a, CB1_4_3I1R15Value a) := by + exact contains_sound (finSumBall_sound 6 CB1_4_3I1R15P CB1_4_3I1R15Value CB1_4_3I1R15P_sound) (by decide +kernel) +def CB1_4_3I1R15MassTerm : Ball := .exact 0 +lemma CB1_4_3I1R15MassTerm_sound : CB1_4_3I1R15MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_4_3I1R15Value a))) := + entropyTerm_zero_ball (CB1_4_3I1R15Mass_sound) +def CB1_4_3I1R15H : Ball := ⟨0, 0⟩ +lemma CB1_4_3I1R15H_sound : CB1_4_3I1R15H.Encloses (homogeneousEntropy CB1_4_3I1R15Value) := by + exact contains_sound (homogeneous_enclosed CB1_4_3I1R15Value CB1_4_3I1R15MassTerm_sound CB1_4_3I1R15Entropy_sound) (by decide +kernel) +def CB1_4_3I1R16Value (a : Fin 6) : ℝ := residualLaw (below (shape 1 4 3)) (fun u => (stageBLaw (shape 1 4 3) u : ℝ)) (stageBPriority (shape 1 4 3)) 1 (fun u a => (littleLaw (shape 1 4 3) u ((stageBPriority (shape 1 4 3)) 1) a : ℝ)) 16 a +def CB1_4_3I1R16Raw (a : Fin 6) : Ball := residualBall (below (shape 1 4 3)) B1_4_3Law (stageBPriority (shape 1 4 3)) 1 (fun u => B1_4_3Little u ((stageBPriority (shape 1 4 3)) 1)) 16 a +lemma CB1_4_3I1R16Raw_sound (a : Fin 6) : + (CB1_4_3I1R16Raw a).Encloses (CB1_4_3I1R16Value a) := by + exact residualBall_sound_on (below (shape 1 4 3)) B1_4_3Law (fun u => (stageBLaw (shape 1 4 3) u : ℝ)) (stageBPriority (shape 1 4 3)) 1 (fun u => B1_4_3Little u ((stageBPriority (shape 1 4 3)) 1)) (fun u a => (littleLaw (shape 1 4 3) u ((stageBPriority (shape 1 4 3)) 1) a : ℝ)) (fun u _ => B1_4_3Law_sound u) (fun u _ a => B1_4_3Little_sound u ((stageBPriority (shape 1 4 3)) 1) a) 16 a +def CB1_4_3I1R16Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB1_4_3I1R16Certificates_valid : + CB1_4_3I1R16Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_4_3I1R16CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB1_4_3I1R16P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_4_3I1R16Certificates (CB1_4_3I1R16CertificateIndex a)).input +lemma CB1_4_3I1R16P_check : ∀ a : Fin 6, contains (CB1_4_3I1R16Raw a) (CB1_4_3I1R16P a) = true := by + decide +kernel +lemma CB1_4_3I1R16P_sound (a : Fin 6) : + (CB1_4_3I1R16P a).Encloses (CB1_4_3I1R16Value a) := + contains_sound (CB1_4_3I1R16Raw_sound a) (CB1_4_3I1R16P_check a) +def CB1_4_3I1R16Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_4_3I1R16Certificates (CB1_4_3I1R16CertificateIndex a)).output +lemma CB1_4_3I1R16Terms_sound (a : Fin 6) : + (CB1_4_3I1R16Terms a).Encloses (Foundation.entropyTerm (CB1_4_3I1R16Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_4_3I1R16Certificates_valid + (CB1_4_3I1R16CertificateIndex a) (CB1_4_3I1R16P_sound a) +def CB1_4_3I1R16Entropy : Ball := ⟨0, 0⟩ +lemma CB1_4_3I1R16Entropy_sound : CB1_4_3I1R16Entropy.Encloses (Foundation.finiteEntropy CB1_4_3I1R16Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_4_3I1R16Value CB1_4_3I1R16Terms CB1_4_3I1R16Terms_sound) (by decide +kernel) +def CB1_4_3I1R16Mass : Ball := ⟨0, 0⟩ +lemma CB1_4_3I1R16Mass_sound : CB1_4_3I1R16Mass.Encloses (∑ a, CB1_4_3I1R16Value a) := by + exact contains_sound (finSumBall_sound 6 CB1_4_3I1R16P CB1_4_3I1R16Value CB1_4_3I1R16P_sound) (by decide +kernel) +def CB1_4_3I1R16MassTerm : Ball := .exact 0 +lemma CB1_4_3I1R16MassTerm_sound : CB1_4_3I1R16MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_4_3I1R16Value a))) := + entropyTerm_zero_ball (CB1_4_3I1R16Mass_sound) +def CB1_4_3I1R16H : Ball := ⟨0, 0⟩ +lemma CB1_4_3I1R16H_sound : CB1_4_3I1R16H.Encloses (homogeneousEntropy CB1_4_3I1R16Value) := by + exact contains_sound (homogeneous_enclosed CB1_4_3I1R16Value CB1_4_3I1R16MassTerm_sound CB1_4_3I1R16Entropy_sound) (by decide +kernel) +def CB1_4_3I1ResidualEntropies (a : Fin 17) : Ball := + match a.val with + | 0 => CB1_4_3I1R0H + | 1 => CB1_4_3I1R1H + | 2 => CB1_4_3I1R2H + | 3 => CB1_4_3I1R3H + | 4 => CB1_4_3I1R4H + | 5 => CB1_4_3I1R5H + | 6 => CB1_4_3I1R6H + | 7 => CB1_4_3I1R7H + | 8 => CB1_4_3I1R8H + | 9 => CB1_4_3I1R9H + | 10 => CB1_4_3I1R10H + | 11 => CB1_4_3I1R11H + | 12 => CB1_4_3I1R12H + | 13 => CB1_4_3I1R13H + | 14 => CB1_4_3I1R14H + | 15 => CB1_4_3I1R15H + | 16 => CB1_4_3I1R16H + | _ => (.exact 0) +lemma CB1_4_3I1ResidualEntropies_sound (k : Fin 17) : + (CB1_4_3I1ResidualEntropies k).Encloses (homogeneousEntropy + (residualLaw (below (shape 1 4 3)) (fun u => (stageBLaw (shape 1 4 3) u : ℝ)) (stageBPriority (shape 1 4 3)) 1 (fun u a => (littleLaw (shape 1 4 3) u ((stageBPriority (shape 1 4 3)) 1) a : ℝ)) k)) := by + fin_cases k + · exact CB1_4_3I1R0H_sound + · exact CB1_4_3I1R1H_sound + · exact CB1_4_3I1R2H_sound + · exact CB1_4_3I1R3H_sound + · exact CB1_4_3I1R4H_sound + · exact CB1_4_3I1R5H_sound + · exact CB1_4_3I1R6H_sound + · exact CB1_4_3I1R7H_sound + · exact CB1_4_3I1R8H_sound + · exact CB1_4_3I1R9H_sound + · exact CB1_4_3I1R10H_sound + · exact CB1_4_3I1R11H_sound + · exact CB1_4_3I1R12H_sound + · exact CB1_4_3I1R13H_sound + · exact CB1_4_3I1R14H_sound + · exact CB1_4_3I1R15H_sound + · exact CB1_4_3I1R16H_sound +def CB1_4_3I1S1_0_3Value (a : Fin 6) : ℝ := (littleLaw (shape 1 4 3) (shape 1 0 3) ((stageBPriority (shape 1 4 3)) 1) a : ℝ) +def CB1_4_3I1S1_0_3E_4Log : Ball := .exact 0 +lemma CB1_4_3I1S1_0_3E_4Log_sound : CB1_4_3I1S1_0_3E_4Log.Encloses (Real.log (CB1_4_3I1S1_0_3Value (4 : Fin 6))) := by + exact log_exact_one_ball ((B1_4_3Little_sound (shape 1 0 3) ((stageBPriority (shape 1 4 3)) 1)) (4 : Fin 6)) +def CB1_4_3I1S1_0_3E_4 : Ball := ⟨0, 0⟩ +lemma CB1_4_3I1S1_0_3E_4_sound : CB1_4_3I1S1_0_3E_4.Encloses (Foundation.entropyTerm (CB1_4_3I1S1_0_3Value (4 : Fin 6))) := by + exact contains_sound (entropyTerm_ball ((B1_4_3Little_sound (shape 1 0 3) ((stageBPriority (shape 1 4 3)) 1)) (4 : Fin 6)) CB1_4_3I1S1_0_3E_4Log_sound) (by decide +kernel) +def CB1_4_3I1S1_0_3Terms (a : Fin 6) : Ball := + match a.val with + | 4 => ⟨0, 0⟩ + | _ => (.exact 0) +lemma CB1_4_3I1S1_0_3Terms_sound (a : Fin 6) : + (CB1_4_3I1S1_0_3Terms a).Encloses (Foundation.entropyTerm (CB1_4_3I1S1_0_3Value a)) := by + fin_cases a + · exact (entropyTerm_zero_ball ((B1_4_3Little_sound (shape 1 0 3) ((stageBPriority (shape 1 4 3)) 1)) (0 : Fin 6))) + · exact (entropyTerm_zero_ball ((B1_4_3Little_sound (shape 1 0 3) ((stageBPriority (shape 1 4 3)) 1)) (1 : Fin 6))) + · exact (entropyTerm_zero_ball ((B1_4_3Little_sound (shape 1 0 3) ((stageBPriority (shape 1 4 3)) 1)) (2 : Fin 6))) + · exact (entropyTerm_zero_ball ((B1_4_3Little_sound (shape 1 0 3) ((stageBPriority (shape 1 4 3)) 1)) (3 : Fin 6))) + · exact CB1_4_3I1S1_0_3E_4_sound + · exact (entropyTerm_zero_ball ((B1_4_3Little_sound (shape 1 0 3) ((stageBPriority (shape 1 4 3)) 1)) (5 : Fin 6))) +def CB1_4_3I1S1_0_3Entropy : Ball := ⟨0, 0⟩ +lemma CB1_4_3I1S1_0_3Entropy_sound : CB1_4_3I1S1_0_3Entropy.Encloses (Foundation.finiteEntropy CB1_4_3I1S1_0_3Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_4_3I1S1_0_3Value CB1_4_3I1S1_0_3Terms CB1_4_3I1S1_0_3Terms_sound) (by decide +kernel) +def CB1_4_3I1S1_0_3Mass : Ball := ⟨1, 0⟩ +lemma CB1_4_3I1S1_0_3Mass_sound : CB1_4_3I1S1_0_3Mass.Encloses (∑ a, CB1_4_3I1S1_0_3Value a) := by + exact contains_sound (finSumBall_sound 6 (B1_4_3Little (shape 1 0 3) ((stageBPriority (shape 1 4 3)) 1)) CB1_4_3I1S1_0_3Value (B1_4_3Little_sound (shape 1 0 3) ((stageBPriority (shape 1 4 3)) 1))) (by decide +kernel) +def CB1_4_3I1S1_0_3MassTermLog : Ball := .exact 0 +lemma CB1_4_3I1S1_0_3MassTermLog_sound : CB1_4_3I1S1_0_3MassTermLog.Encloses (Real.log ((∑ a, CB1_4_3I1S1_0_3Value a))) := by + exact log_exact_one_ball (CB1_4_3I1S1_0_3Mass_sound) +def CB1_4_3I1S1_0_3MassTerm : Ball := ⟨0, 0⟩ +lemma CB1_4_3I1S1_0_3MassTerm_sound : CB1_4_3I1S1_0_3MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_4_3I1S1_0_3Value a))) := by + exact contains_sound (entropyTerm_ball (CB1_4_3I1S1_0_3Mass_sound) CB1_4_3I1S1_0_3MassTermLog_sound) (by decide +kernel) +def CB1_4_3I1S1_0_3H : Ball := ⟨0, 0⟩ +lemma CB1_4_3I1S1_0_3H_sound : CB1_4_3I1S1_0_3H.Encloses (homogeneousEntropy CB1_4_3I1S1_0_3Value) := by + exact contains_sound (homogeneous_enclosed CB1_4_3I1S1_0_3Value CB1_4_3I1S1_0_3MassTerm_sound CB1_4_3I1S1_0_3Entropy_sound) (by decide +kernel) +def CB1_4_3I1Singles (s : Shape) : Ball := + match s 0, s 1, s 2 with + | 1, 0, 3 => CB1_4_3I1S1_0_3H + | _, _, _ => (.exact 0) +lemma CB1_4_3I1Singles_sound (u : Shape) (hu : u ∈ below (shape 1 4 3)) + (hd : designated (stageBPriority (shape 1 4 3)) 1 u) : + (CB1_4_3I1Singles u).Encloses (homogeneousEntropy ((fun u a => (littleLaw (shape 1 4 3) u ((stageBPriority (shape 1 4 3)) 1) a : ℝ)) u)) := by + rw [B1_4_3_below] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl + · exact (show ¬ designated (stageBPriority (shape 1 4 3)) 1 (shape 0 1 3) by decide +kernel) hd |>.elim + · exact (show ¬ designated (stageBPriority (shape 1 4 3)) 1 (shape 0 2 2) by decide +kernel) hd |>.elim + · exact (show ¬ designated (stageBPriority (shape 1 4 3)) 1 (shape 0 3 1) by decide +kernel) hd |>.elim + · exact (show ¬ designated (stageBPriority (shape 1 4 3)) 1 (shape 0 4 0) by decide +kernel) hd |>.elim + · exact CB1_4_3I1S1_0_3H_sound + · exact (show ¬ designated (stageBPriority (shape 1 4 3)) 1 (shape 1 1 2) by decide +kernel) hd |>.elim + · exact (show ¬ designated (stageBPriority (shape 1 4 3)) 1 (shape 1 2 1) by decide +kernel) hd |>.elim + · exact (show ¬ designated (stageBPriority (shape 1 4 3)) 1 (shape 1 3 0) by decide +kernel) hd |>.elim +def CB1_4_3I1Singleton : Ball := ⟨0, 0⟩ +lemma CB1_4_3I1Singleton_sound : CB1_4_3I1Singleton.Encloses + (singletonEntropy (below (shape 1 4 3)) (fun u => (stageBLaw (shape 1 4 3) u : ℝ)) (stageBPriority (shape 1 4 3)) 1 (fun u a => (littleLaw (shape 1 4 3) u ((stageBPriority (shape 1 4 3)) 1) a : ℝ))) := by + exact contains_sound (singletonBall_sound (below (shape 1 4 3)) B1_4_3Law (fun u => (stageBLaw (shape 1 4 3) u : ℝ)) (stageBPriority (shape 1 4 3)) 1 + CB1_4_3I1Singles (fun u a => (littleLaw (shape 1 4 3) u ((stageBPriority (shape 1 4 3)) 1) a : ℝ)) (fun u _ => B1_4_3Law_sound u) CB1_4_3I1Singles_sound) (by decide +kernel) +def CB1_4_3I1Group : Ball := ⟨(181758787149168046013734010059 / 1250000000000000000000000000000), (3380065299 / 2500000000000000000000000000000)⟩ +lemma CB1_4_3I1Group_sound : CB1_4_3I1Group.Encloses + (groupedEntropy (below (shape 1 4 3)) (fun u => (stageBLaw (shape 1 4 3) u : ℝ)) (stageBPriority (shape 1 4 3)) 1 (fun u a => (littleLaw (shape 1 4 3) u ((stageBPriority (shape 1 4 3)) 1) a : ℝ))) := by + exact contains_sound (Ball.add_sound CB1_4_3I1Singleton_sound + (finSumBall_sound 17 CB1_4_3I1ResidualEntropies _ CB1_4_3I1ResidualEntropies_sound)) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CB1_4_3I1H : Ball := ⟨(40704983831816474536500137732569 / 50000000000000000000000000000000), (363336788127 / 100000000000000000000000000000000)⟩ +lemma CB1_4_3I1_sound : CB1_4_3I1H.Encloses (stageBCapacity (shape 1 4 3) 1) := by + have hb := contains_sound (Ball.add_sound CB1_4_3I1PairH_sound + (Ball.neg_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) CB1_4_3I1Group_sound))) + (show contains (.add CB1_4_3I1PairH (.neg (.mul (.exact 2) CB1_4_3I1Group))) CB1_4_3I1H = true by decide +kernel) + unfold CB1_4_3I1PairValue at hb + simpa only [stageBCapacity, nativeCapacity, + show (1 : Fin 3) ≠ 0 by decide, ite_false, sub_eq_add_neg] using hb + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/CapacityB/CapB1_4_3I2.lean b/lean/OAI/LinearAlgebra/MatrixFields/CapacityB/CapB1_4_3I2.lean new file mode 100644 index 0000000000000000000000000000000000000000..d00c730161ccd7103bc32ff7e1e12c48e3bcfff1 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/CapacityB/CapB1_4_3I2.lean @@ -0,0 +1,1041 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Certificates.LittleB1_4_3 + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CB1_4_3I2PairValue (a : PairSlot) : ℝ := pairLaw (below (shape 1 4 3)) (shape 1 4 3) (fun u => (stageBLaw (shape 1 4 3) u : ℝ)) (fun u a => (littleLaw (shape 1 4 3) u ((stageBPriority (shape 1 4 3)) 2) a : ℝ)) a +def CB1_4_3I2PairRaw (a : PairSlot) : Ball := pairLawBall (below (shape 1 4 3)) (shape 1 4 3) B1_4_3Law (fun u => B1_4_3Little u ((stageBPriority (shape 1 4 3)) 2)) a +lemma CB1_4_3I2PairRaw_sound (a : PairSlot) : + (CB1_4_3I2PairRaw a).Encloses (CB1_4_3I2PairValue a) := by + exact pairLawBall_sound_on (below (shape 1 4 3)) (shape 1 4 3) B1_4_3Law (fun u => (stageBLaw (shape 1 4 3) u : ℝ)) (fun u => B1_4_3Little u ((stageBPriority (shape 1 4 3)) 2)) (fun u a => (littleLaw (shape 1 4 3) u ((stageBPriority (shape 1 4 3)) 2) a : ℝ)) (fun u _ => B1_4_3Law_sound u) (fun u _ a => B1_4_3Little_sound u ((stageBPriority (shape 1 4 3)) 2) a) (fun u _ a => B1_4_3Little_sound (complement (shape 1 4 3) u) ((stageBPriority (shape 1 4 3)) 2) a) a +def CB1_4_3I2PairCertificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(1966519024111033745643559687113 / 25000000000000000000000000000000), (3 / 20000000000000000000000000000000)⟩ ⟨(2500046291848775426899270047709 / 12500000000000000000000000000000), (4164266039 / 50000000000000000000000000000000)⟩ ⟨(-31782635474107897879846636975989 / 12500000000000000000000000000000), (21175823721 / 20000000000000000000000000000000)⟩ ⟨-4, 1966519024111033745643559687113, 1562500000000000000000000000000⟩, + .log ⟨(18979543218321732038291109031929 / 25000000000000000000000000000000), (1 / 5000000000000000000000000000000)⟩ ⟨(20916526955163493478275969474021 / 100000000000000000000000000000000), (4019074611 / 12500000000000000000000000000000)⟩ ⟨(-27551409845011327169321236621291 / 100000000000000000000000000000000), (1323488981 / 3125000000000000000000000000000)⟩ ⟨-1, 18979543218321732038291109031929, 12500000000000000000000000000000⟩, + .log ⟨(4129064322164561216004098570321 / 100000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ ⟨(6579910422115434244921685085979 / 50000000000000000000000000000000), (5246180293 / 100000000000000000000000000000000)⟩ ⟨(-159355968052977115286473929248967 / 50000000000000000000000000000000), (63527471073 / 50000000000000000000000000000000)⟩ ⟨-5, 4129064322164561216004098570321, 3125000000000000000000000000000⟩, + .log ⟨(3076084781593046714415474453 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(204493841992591654814814542237 / 100000000000000000000000000000000), (8468023 / 12500000000000000000000000000000)⟩ ⟨(-103872828871755020970832134190087 / 12500000000000000000000000000000), (137642855971 / 50000000000000000000000000000000)⟩ ⟨-12, 3076084781593046714415474453, 3051757812500000000000000000⟩, + .log ⟨(33468805621467537981782719557 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(66956953162162032020595243473 / 25000000000000000000000000000000), (1439607 / 1562500000000000000000000000000)⟩ ⟨(-800231163543099963826328472368741 / 100000000000000000000000000000000), (137642855433 / 50000000000000000000000000000000)⟩ ⟨-12, 33468805621467537981782719557, 24414062500000000000000000000⟩] +lemma CB1_4_3I2PairCertificates_valid : + CB1_4_3I2PairCertificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_4_3I2PairCertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 1, 4 => 1 + | 2, 2 => 2 + | 2, 3 => 3 + | 3, 2 => 3 + | 3, 3 => 4 + | 4, 1 => 1 + | 5, 0 => 5 + | 0, 5 => 5 + | _, _ => 0 +def CB1_4_3I2PairP (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CB1_4_3I2PairCertificates (CB1_4_3I2PairCertificateIndex a)).input +lemma CB1_4_3I2PairP_check : ∀ a : PairSlot, contains (CB1_4_3I2PairRaw a) (CB1_4_3I2PairP a) = true := by + decide +kernel +lemma CB1_4_3I2PairP_sound (a : PairSlot) : + (CB1_4_3I2PairP a).Encloses (CB1_4_3I2PairValue a) := + contains_sound (CB1_4_3I2PairRaw_sound a) (CB1_4_3I2PairP_check a) +def CB1_4_3I2PairTerms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CB1_4_3I2PairCertificates (CB1_4_3I2PairCertificateIndex a)).output +lemma CB1_4_3I2PairTerms_sound (a : PairSlot) : + (CB1_4_3I2PairTerms a).Encloses (Foundation.entropyTerm (CB1_4_3I2PairValue a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_4_3I2PairCertificates_valid + (CB1_4_3I2PairCertificateIndex a) (CB1_4_3I2PairP_sound a) +def CB1_4_3I2PairEntropy : Ball := ⟨(43988529390247762599665303535651 / 50000000000000000000000000000000), (5955403551 / 10000000000000000000000000000000)⟩ +lemma CB1_4_3I2PairEntropy_sound : CB1_4_3I2PairEntropy.Encloses (Foundation.finiteEntropy CB1_4_3I2PairValue) := by + exact contains_sound (entropyPair_enclosed CB1_4_3I2PairValue CB1_4_3I2PairTerms CB1_4_3I2PairTerms_sound) (by decide +kernel) +def CB1_4_3I2PairMass : Ball := ⟨1, (57 / 100000000000000000000000000000000)⟩ +lemma CB1_4_3I2PairMass_sound : CB1_4_3I2PairMass.Encloses (∑ a, CB1_4_3I2PairValue a) := by + exact contains_sound (pairSumBall_sound CB1_4_3I2PairP CB1_4_3I2PairValue CB1_4_3I2PairP_sound) (by decide +kernel) +def CB1_4_3I2PairMassTermLogWitness : LogWitness := ⟨0, 1, 1⟩ +def CB1_4_3I2PairMassTermLog : Ball := ⟨0, (21175823739 / 100000000000000000000000000000000)⟩ +lemma CB1_4_3I2PairMassTermLog_sound : CB1_4_3I2PairMassTermLog.Encloses (Real.log ((∑ a, CB1_4_3I2PairValue a))) := by + exact checkLog_sound logTwoBall_sound (CB1_4_3I2PairMass_sound) (w := CB1_4_3I2PairMassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB1_4_3I2PairMassTerm : Ball := ⟨0, (1058791187 / 5000000000000000000000000000000)⟩ +lemma CB1_4_3I2PairMassTerm_sound : CB1_4_3I2PairMassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_4_3I2PairValue a))) := by + exact contains_sound (entropyTerm_ball (CB1_4_3I2PairMass_sound) CB1_4_3I2PairMassTermLog_sound) (by decide +kernel) +def CB1_4_3I2PairH : Ball := ⟨(43988529390247762599665303535651 / 50000000000000000000000000000000), (322919437 / 400000000000000000000000000000)⟩ +lemma CB1_4_3I2PairH_sound : CB1_4_3I2PairH.Encloses (homogeneousEntropy CB1_4_3I2PairValue) := by + exact contains_sound (homogeneous_enclosed CB1_4_3I2PairValue CB1_4_3I2PairMassTerm_sound CB1_4_3I2PairEntropy_sound) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CB1_4_3I2R0Value (a : Fin 6) : ℝ := residualLaw (below (shape 1 4 3)) (fun u => (stageBLaw (shape 1 4 3) u : ℝ)) (stageBPriority (shape 1 4 3)) 2 (fun u a => (littleLaw (shape 1 4 3) u ((stageBPriority (shape 1 4 3)) 2) a : ℝ)) 0 a +def CB1_4_3I2R0Raw (a : Fin 6) : Ball := residualBall (below (shape 1 4 3)) B1_4_3Law (stageBPriority (shape 1 4 3)) 2 (fun u => B1_4_3Little u ((stageBPriority (shape 1 4 3)) 2)) 0 a +lemma CB1_4_3I2R0Raw_sound (a : Fin 6) : + (CB1_4_3I2R0Raw a).Encloses (CB1_4_3I2R0Value a) := by + exact residualBall_sound_on (below (shape 1 4 3)) B1_4_3Law (fun u => (stageBLaw (shape 1 4 3) u : ℝ)) (stageBPriority (shape 1 4 3)) 2 (fun u => B1_4_3Little u ((stageBPriority (shape 1 4 3)) 2)) (fun u a => (littleLaw (shape 1 4 3) u ((stageBPriority (shape 1 4 3)) 2) a : ℝ)) (fun u _ => B1_4_3Law_sound u) (fun u _ a => B1_4_3Little_sound u ((stageBPriority (shape 1 4 3)) 2) a) 0 a +def CB1_4_3I2R0Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(33468805621467537981782719557 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(66956953162162032020595243473 / 25000000000000000000000000000000), (1439607 / 1562500000000000000000000000000)⟩ ⟨(-800231163543099963826328472368741 / 100000000000000000000000000000000), (137642855433 / 50000000000000000000000000000000)⟩ ⟨-12, 33468805621467537981782719557, 24414062500000000000000000000⟩] +lemma CB1_4_3I2R0Certificates_valid : + CB1_4_3I2R0Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_4_3I2R0CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | 0 => 1 + | _ => 0 +def CB1_4_3I2R0P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_4_3I2R0Certificates (CB1_4_3I2R0CertificateIndex a)).input +lemma CB1_4_3I2R0P_check : ∀ a : Fin 6, contains (CB1_4_3I2R0Raw a) (CB1_4_3I2R0P a) = true := by + decide +kernel +lemma CB1_4_3I2R0P_sound (a : Fin 6) : + (CB1_4_3I2R0P a).Encloses (CB1_4_3I2R0Value a) := + contains_sound (CB1_4_3I2R0Raw_sound a) (CB1_4_3I2R0P_check a) +def CB1_4_3I2R0Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_4_3I2R0Certificates (CB1_4_3I2R0CertificateIndex a)).output +lemma CB1_4_3I2R0Terms_sound (a : Fin 6) : + (CB1_4_3I2R0Terms a).Encloses (Foundation.entropyTerm (CB1_4_3I2R0Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_4_3I2R0Certificates_valid + (CB1_4_3I2R0CertificateIndex a) (CB1_4_3I2R0P_sound a) +def CB1_4_3I2R0Entropy : Ball := ⟨(66956953162162032020595243473 / 25000000000000000000000000000000), (1439607 / 1562500000000000000000000000000)⟩ +lemma CB1_4_3I2R0Entropy_sound : CB1_4_3I2R0Entropy.Encloses (Foundation.finiteEntropy CB1_4_3I2R0Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_4_3I2R0Value CB1_4_3I2R0Terms CB1_4_3I2R0Terms_sound) (by decide +kernel) +def CB1_4_3I2R0Mass : Ball := ⟨(33468805621467537981782719557 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ +lemma CB1_4_3I2R0Mass_sound : CB1_4_3I2R0Mass.Encloses (∑ a, CB1_4_3I2R0Value a) := by + exact contains_sound (finSumBall_sound 6 CB1_4_3I2R0P CB1_4_3I2R0Value CB1_4_3I2R0P_sound) (by decide +kernel) +def CB1_4_3I2R0MassTermLogWitness : LogWitness := ⟨-12, 33468805621467537981782719557, 24414062500000000000000000000⟩ +def CB1_4_3I2R0MassTermLog : Ball := ⟨(-800231163543099963826328472368741 / 100000000000000000000000000000000), (137642855433 / 50000000000000000000000000000000)⟩ +lemma CB1_4_3I2R0MassTermLog_sound : CB1_4_3I2R0MassTermLog.Encloses (Real.log ((∑ a, CB1_4_3I2R0Value a))) := by + exact checkLog_sound logTwoBall_sound (CB1_4_3I2R0Mass_sound) (w := CB1_4_3I2R0MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB1_4_3I2R0MassTerm : Ball := ⟨(66956953162162032020595243473 / 25000000000000000000000000000000), (1439607 / 1562500000000000000000000000000)⟩ +lemma CB1_4_3I2R0MassTerm_sound : CB1_4_3I2R0MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_4_3I2R0Value a))) := by + exact contains_sound (entropyTerm_ball (CB1_4_3I2R0Mass_sound) CB1_4_3I2R0MassTermLog_sound) (by decide +kernel) +def CB1_4_3I2R0H : Ball := ⟨0, (1439607 / 781250000000000000000000000000)⟩ +lemma CB1_4_3I2R0H_sound : CB1_4_3I2R0H.Encloses (homogeneousEntropy CB1_4_3I2R0Value) := by + exact contains_sound (homogeneous_enclosed CB1_4_3I2R0Value CB1_4_3I2R0MassTerm_sound CB1_4_3I2R0Entropy_sound) (by decide +kernel) +def CB1_4_3I2R1Value (a : Fin 6) : ℝ := residualLaw (below (shape 1 4 3)) (fun u => (stageBLaw (shape 1 4 3) u : ℝ)) (stageBPriority (shape 1 4 3)) 2 (fun u a => (littleLaw (shape 1 4 3) u ((stageBPriority (shape 1 4 3)) 2) a : ℝ)) 1 a +def CB1_4_3I2R1Raw (a : Fin 6) : Ball := residualBall (below (shape 1 4 3)) B1_4_3Law (stageBPriority (shape 1 4 3)) 2 (fun u => B1_4_3Little u ((stageBPriority (shape 1 4 3)) 2)) 1 a +lemma CB1_4_3I2R1Raw_sound (a : Fin 6) : + (CB1_4_3I2R1Raw a).Encloses (CB1_4_3I2R1Value a) := by + exact residualBall_sound_on (below (shape 1 4 3)) B1_4_3Law (fun u => (stageBLaw (shape 1 4 3) u : ℝ)) (stageBPriority (shape 1 4 3)) 2 (fun u => B1_4_3Little u ((stageBPriority (shape 1 4 3)) 2)) (fun u a => (littleLaw (shape 1 4 3) u ((stageBPriority (shape 1 4 3)) 2) a : ℝ)) (fun u _ => B1_4_3Law_sound u) (fun u _ a => B1_4_3Little_sound u ((stageBPriority (shape 1 4 3)) 2) a) 1 a +def CB1_4_3I2R1Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(5275191590850223000844657229 / 80000000000000000000000000000), (11 / 100000000000000000000000000000000)⟩ ⟨(17929134143311901936334016847311 / 100000000000000000000000000000000), (6981657981 / 100000000000000000000000000000000)⟩ ⟨(-271901163543099963826328625133483 / 100000000000000000000000000000000), (105879118581 / 100000000000000000000000000000000)⟩ ⟨-4, 5275191590850223000844657229, 5000000000000000000000000000⟩] +lemma CB1_4_3I2R1Certificates_valid : + CB1_4_3I2R1Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_4_3I2R1CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | 1 => 1 + | _ => 0 +def CB1_4_3I2R1P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_4_3I2R1Certificates (CB1_4_3I2R1CertificateIndex a)).input +lemma CB1_4_3I2R1P_check : ∀ a : Fin 6, contains (CB1_4_3I2R1Raw a) (CB1_4_3I2R1P a) = true := by + decide +kernel +lemma CB1_4_3I2R1P_sound (a : Fin 6) : + (CB1_4_3I2R1P a).Encloses (CB1_4_3I2R1Value a) := + contains_sound (CB1_4_3I2R1Raw_sound a) (CB1_4_3I2R1P_check a) +def CB1_4_3I2R1Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_4_3I2R1Certificates (CB1_4_3I2R1CertificateIndex a)).output +lemma CB1_4_3I2R1Terms_sound (a : Fin 6) : + (CB1_4_3I2R1Terms a).Encloses (Foundation.entropyTerm (CB1_4_3I2R1Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_4_3I2R1Certificates_valid + (CB1_4_3I2R1CertificateIndex a) (CB1_4_3I2R1P_sound a) +def CB1_4_3I2R1Entropy : Ball := ⟨(17929134143311901936334016847311 / 100000000000000000000000000000000), (6981657981 / 100000000000000000000000000000000)⟩ +lemma CB1_4_3I2R1Entropy_sound : CB1_4_3I2R1Entropy.Encloses (Foundation.finiteEntropy CB1_4_3I2R1Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_4_3I2R1Value CB1_4_3I2R1Terms CB1_4_3I2R1Terms_sound) (by decide +kernel) +def CB1_4_3I2R1Mass : Ball := ⟨(5275191590850223000844657229 / 80000000000000000000000000000), (11 / 100000000000000000000000000000000)⟩ +lemma CB1_4_3I2R1Mass_sound : CB1_4_3I2R1Mass.Encloses (∑ a, CB1_4_3I2R1Value a) := by + exact contains_sound (finSumBall_sound 6 CB1_4_3I2R1P CB1_4_3I2R1Value CB1_4_3I2R1P_sound) (by decide +kernel) +def CB1_4_3I2R1MassTermLogWitness : LogWitness := ⟨-4, 5275191590850223000844657229, 5000000000000000000000000000⟩ +def CB1_4_3I2R1MassTermLog : Ball := ⟨(-271901163543099963826328625133483 / 100000000000000000000000000000000), (105879118581 / 100000000000000000000000000000000)⟩ +lemma CB1_4_3I2R1MassTermLog_sound : CB1_4_3I2R1MassTermLog.Encloses (Real.log ((∑ a, CB1_4_3I2R1Value a))) := by + exact checkLog_sound logTwoBall_sound (CB1_4_3I2R1Mass_sound) (w := CB1_4_3I2R1MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB1_4_3I2R1MassTerm : Ball := ⟨(17929134143311901936334016847311 / 100000000000000000000000000000000), (6981657981 / 100000000000000000000000000000000)⟩ +lemma CB1_4_3I2R1MassTerm_sound : CB1_4_3I2R1MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_4_3I2R1Value a))) := by + exact contains_sound (entropyTerm_ball (CB1_4_3I2R1Mass_sound) CB1_4_3I2R1MassTermLog_sound) (by decide +kernel) +def CB1_4_3I2R1H : Ball := ⟨0, (6981657981 / 50000000000000000000000000000000)⟩ +lemma CB1_4_3I2R1H_sound : CB1_4_3I2R1H.Encloses (homogeneousEntropy CB1_4_3I2R1Value) := by + exact contains_sound (homogeneous_enclosed CB1_4_3I2R1Value CB1_4_3I2R1MassTerm_sound CB1_4_3I2R1Entropy_sound) (by decide +kernel) +def CB1_4_3I2R2Value (a : Fin 6) : ℝ := residualLaw (below (shape 1 4 3)) (fun u => (stageBLaw (shape 1 4 3) u : ℝ)) (stageBPriority (shape 1 4 3)) 2 (fun u a => (littleLaw (shape 1 4 3) u ((stageBPriority (shape 1 4 3)) 2) a : ℝ)) 2 a +def CB1_4_3I2R2Raw (a : Fin 6) : Ball := residualBall (below (shape 1 4 3)) B1_4_3Law (stageBPriority (shape 1 4 3)) 2 (fun u => B1_4_3Little u ((stageBPriority (shape 1 4 3)) 2)) 2 a +lemma CB1_4_3I2R2Raw_sound (a : Fin 6) : + (CB1_4_3I2R2Raw a).Encloses (CB1_4_3I2R2Value a) := by + exact residualBall_sound_on (below (shape 1 4 3)) B1_4_3Law (fun u => (stageBLaw (shape 1 4 3) u : ℝ)) (stageBPriority (shape 1 4 3)) 2 (fun u => B1_4_3Little u ((stageBPriority (shape 1 4 3)) 2)) (fun u a => (littleLaw (shape 1 4 3) u ((stageBPriority (shape 1 4 3)) 2) a : ℝ)) (fun u _ => B1_4_3Law_sound u) (fun u _ a => B1_4_3Little_sound u ((stageBPriority (shape 1 4 3)) 2) a) 2 a +def CB1_4_3I2R2Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(41971754006700012026349318289619 / 100000000000000000000000000000000), (3 / 25000000000000000000000000000000)⟩ ⟨(7287751384299208008243384830007 / 20000000000000000000000000000000), (13331796949 / 50000000000000000000000000000000)⟩ ⟨(-86817331760019532117576094675033 / 100000000000000000000000000000000), (63527471077 / 100000000000000000000000000000000)⟩ ⟨-2, 41971754006700012026349318289619, 25000000000000000000000000000000⟩, + .log ⟨(32175272808596363273665060593 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(428280736599910395168193615563 / 50000000000000000000000000000000), (149894343 / 50000000000000000000000000000000)⟩ ⟨(-166385821787610980937163065740823 / 25000000000000000000000000000000), (232934061289 / 100000000000000000000000000000000)⟩ ⟨-10, 32175272808596363273665060593, 24414062500000000000000000000⟩] +lemma CB1_4_3I2R2Certificates_valid : + CB1_4_3I2R2Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_4_3I2R2CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | 2 => 1 + | 3 => 2 + | _ => 0 +def CB1_4_3I2R2P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_4_3I2R2Certificates (CB1_4_3I2R2CertificateIndex a)).input +lemma CB1_4_3I2R2P_check : ∀ a : Fin 6, contains (CB1_4_3I2R2Raw a) (CB1_4_3I2R2P a) = true := by + decide +kernel +lemma CB1_4_3I2R2P_sound (a : Fin 6) : + (CB1_4_3I2R2P a).Encloses (CB1_4_3I2R2Value a) := + contains_sound (CB1_4_3I2R2Raw_sound a) (CB1_4_3I2R2P_check a) +def CB1_4_3I2R2Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_4_3I2R2Certificates (CB1_4_3I2R2CertificateIndex a)).output +lemma CB1_4_3I2R2Terms_sound (a : Fin 6) : + (CB1_4_3I2R2Terms a).Encloses (Foundation.entropyTerm (CB1_4_3I2R2Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_4_3I2R2Certificates_valid + (CB1_4_3I2R2CertificateIndex a) (CB1_4_3I2R2P_sound a) +def CB1_4_3I2R2Entropy : Ball := ⟨(37295318394695860831553311381161 / 100000000000000000000000000000000), (3370422823 / 12500000000000000000000000000000)⟩ +lemma CB1_4_3I2R2Entropy_sound : CB1_4_3I2R2Entropy.Encloses (Foundation.finiteEntropy CB1_4_3I2R2Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_4_3I2R2Value CB1_4_3I2R2Terms CB1_4_3I2R2Terms_sound) (by decide +kernel) +def CB1_4_3I2R2Mass : Ball := ⟨(42100455097934397479443978531991 / 100000000000000000000000000000000), (13 / 100000000000000000000000000000000)⟩ +lemma CB1_4_3I2R2Mass_sound : CB1_4_3I2R2Mass.Encloses (∑ a, CB1_4_3I2R2Value a) := by + exact contains_sound (finSumBall_sound 6 CB1_4_3I2R2P CB1_4_3I2R2Value CB1_4_3I2R2P_sound) (by decide +kernel) +def CB1_4_3I2R2MassTermLogWitness : LogWitness := ⟨-2, 42100455097934397479443978531991, 25000000000000000000000000000000⟩ +def CB1_4_3I2R2MassTermLog : Ball := ⟨(-86511163543099963826328663324499 / 100000000000000000000000000000000), (1588186777 / 2500000000000000000000000000000)⟩ +lemma CB1_4_3I2R2MassTermLog_sound : CB1_4_3I2R2MassTermLog.Encloses (Real.log ((∑ a, CB1_4_3I2R2Value a))) := by + exact checkLog_sound logTwoBall_sound (CB1_4_3I2R2Mass_sound) (w := CB1_4_3I2R2MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB1_4_3I2R2MassTerm : Ball := ⟨(36421593562163392644111126100921 / 100000000000000000000000000000000), (26745354449 / 100000000000000000000000000000000)⟩ +lemma CB1_4_3I2R2MassTerm_sound : CB1_4_3I2R2MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_4_3I2R2Value a))) := by + exact contains_sound (entropyTerm_ball (CB1_4_3I2R2Mass_sound) CB1_4_3I2R2MassTermLog_sound) (by decide +kernel) +def CB1_4_3I2R2H : Ball := ⟨(10921560406655852343027316003 / 1250000000000000000000000000000), (53708737033 / 100000000000000000000000000000000)⟩ +lemma CB1_4_3I2R2H_sound : CB1_4_3I2R2H.Encloses (homogeneousEntropy CB1_4_3I2R2Value) := by + exact contains_sound (homogeneous_enclosed CB1_4_3I2R2Value CB1_4_3I2R2MassTerm_sound CB1_4_3I2R2Entropy_sound) (by decide +kernel) +def CB1_4_3I2R3Value (a : Fin 6) : ℝ := residualLaw (below (shape 1 4 3)) (fun u => (stageBLaw (shape 1 4 3) u : ℝ)) (stageBPriority (shape 1 4 3)) 2 (fun u a => (littleLaw (shape 1 4 3) u ((stageBPriority (shape 1 4 3)) 2) a : ℝ)) 3 a +def CB1_4_3I2R3Raw (a : Fin 6) : Ball := residualBall (below (shape 1 4 3)) B1_4_3Law (stageBPriority (shape 1 4 3)) 2 (fun u => B1_4_3Little u ((stageBPriority (shape 1 4 3)) 2)) 3 a +lemma CB1_4_3I2R3Raw_sound (a : Fin 6) : + (CB1_4_3I2R3Raw a).Encloses (CB1_4_3I2R3Value a) := by + exact residualBall_sound_on (below (shape 1 4 3)) B1_4_3Law (fun u => (stageBLaw (shape 1 4 3) u : ℝ)) (stageBPriority (shape 1 4 3)) 2 (fun u => B1_4_3Little u ((stageBPriority (shape 1 4 3)) 2)) (fun u a => (littleLaw (shape 1 4 3) u ((stageBPriority (shape 1 4 3)) 2) a : ℝ)) (fun u _ => B1_4_3Law_sound u) (fun u _ a => B1_4_3Little_sound u ((stageBPriority (shape 1 4 3)) 2) a) 3 a +def CB1_4_3I2R3Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB1_4_3I2R3Certificates_valid : + CB1_4_3I2R3Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_4_3I2R3CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB1_4_3I2R3P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_4_3I2R3Certificates (CB1_4_3I2R3CertificateIndex a)).input +lemma CB1_4_3I2R3P_check : ∀ a : Fin 6, contains (CB1_4_3I2R3Raw a) (CB1_4_3I2R3P a) = true := by + decide +kernel +lemma CB1_4_3I2R3P_sound (a : Fin 6) : + (CB1_4_3I2R3P a).Encloses (CB1_4_3I2R3Value a) := + contains_sound (CB1_4_3I2R3Raw_sound a) (CB1_4_3I2R3P_check a) +def CB1_4_3I2R3Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_4_3I2R3Certificates (CB1_4_3I2R3CertificateIndex a)).output +lemma CB1_4_3I2R3Terms_sound (a : Fin 6) : + (CB1_4_3I2R3Terms a).Encloses (Foundation.entropyTerm (CB1_4_3I2R3Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_4_3I2R3Certificates_valid + (CB1_4_3I2R3CertificateIndex a) (CB1_4_3I2R3P_sound a) +def CB1_4_3I2R3Entropy : Ball := ⟨0, 0⟩ +lemma CB1_4_3I2R3Entropy_sound : CB1_4_3I2R3Entropy.Encloses (Foundation.finiteEntropy CB1_4_3I2R3Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_4_3I2R3Value CB1_4_3I2R3Terms CB1_4_3I2R3Terms_sound) (by decide +kernel) +def CB1_4_3I2R3Mass : Ball := ⟨0, 0⟩ +lemma CB1_4_3I2R3Mass_sound : CB1_4_3I2R3Mass.Encloses (∑ a, CB1_4_3I2R3Value a) := by + exact contains_sound (finSumBall_sound 6 CB1_4_3I2R3P CB1_4_3I2R3Value CB1_4_3I2R3P_sound) (by decide +kernel) +def CB1_4_3I2R3MassTerm : Ball := .exact 0 +lemma CB1_4_3I2R3MassTerm_sound : CB1_4_3I2R3MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_4_3I2R3Value a))) := + entropyTerm_zero_ball (CB1_4_3I2R3Mass_sound) +def CB1_4_3I2R3H : Ball := ⟨0, 0⟩ +lemma CB1_4_3I2R3H_sound : CB1_4_3I2R3H.Encloses (homogeneousEntropy CB1_4_3I2R3Value) := by + exact contains_sound (homogeneous_enclosed CB1_4_3I2R3Value CB1_4_3I2R3MassTerm_sound CB1_4_3I2R3Entropy_sound) (by decide +kernel) +def CB1_4_3I2R4Value (a : Fin 6) : ℝ := residualLaw (below (shape 1 4 3)) (fun u => (stageBLaw (shape 1 4 3) u : ℝ)) (stageBPriority (shape 1 4 3)) 2 (fun u a => (littleLaw (shape 1 4 3) u ((stageBPriority (shape 1 4 3)) 2) a : ℝ)) 4 a +def CB1_4_3I2R4Raw (a : Fin 6) : Ball := residualBall (below (shape 1 4 3)) B1_4_3Law (stageBPriority (shape 1 4 3)) 2 (fun u => B1_4_3Little u ((stageBPriority (shape 1 4 3)) 2)) 4 a +lemma CB1_4_3I2R4Raw_sound (a : Fin 6) : + (CB1_4_3I2R4Raw a).Encloses (CB1_4_3I2R4Value a) := by + exact residualBall_sound_on (below (shape 1 4 3)) B1_4_3Law (fun u => (stageBLaw (shape 1 4 3) u : ℝ)) (stageBPriority (shape 1 4 3)) 2 (fun u => B1_4_3Little u ((stageBPriority (shape 1 4 3)) 2)) (fun u a => (littleLaw (shape 1 4 3) u ((stageBPriority (shape 1 4 3)) 2) a : ℝ)) (fun u _ => B1_4_3Law_sound u) (fun u _ a => B1_4_3Little_sound u ((stageBPriority (shape 1 4 3)) 2) a) 4 a +def CB1_4_3I2R4Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB1_4_3I2R4Certificates_valid : + CB1_4_3I2R4Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_4_3I2R4CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB1_4_3I2R4P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_4_3I2R4Certificates (CB1_4_3I2R4CertificateIndex a)).input +lemma CB1_4_3I2R4P_check : ∀ a : Fin 6, contains (CB1_4_3I2R4Raw a) (CB1_4_3I2R4P a) = true := by + decide +kernel +lemma CB1_4_3I2R4P_sound (a : Fin 6) : + (CB1_4_3I2R4P a).Encloses (CB1_4_3I2R4Value a) := + contains_sound (CB1_4_3I2R4Raw_sound a) (CB1_4_3I2R4P_check a) +def CB1_4_3I2R4Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_4_3I2R4Certificates (CB1_4_3I2R4CertificateIndex a)).output +lemma CB1_4_3I2R4Terms_sound (a : Fin 6) : + (CB1_4_3I2R4Terms a).Encloses (Foundation.entropyTerm (CB1_4_3I2R4Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_4_3I2R4Certificates_valid + (CB1_4_3I2R4CertificateIndex a) (CB1_4_3I2R4P_sound a) +def CB1_4_3I2R4Entropy : Ball := ⟨0, 0⟩ +lemma CB1_4_3I2R4Entropy_sound : CB1_4_3I2R4Entropy.Encloses (Foundation.finiteEntropy CB1_4_3I2R4Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_4_3I2R4Value CB1_4_3I2R4Terms CB1_4_3I2R4Terms_sound) (by decide +kernel) +def CB1_4_3I2R4Mass : Ball := ⟨0, 0⟩ +lemma CB1_4_3I2R4Mass_sound : CB1_4_3I2R4Mass.Encloses (∑ a, CB1_4_3I2R4Value a) := by + exact contains_sound (finSumBall_sound 6 CB1_4_3I2R4P CB1_4_3I2R4Value CB1_4_3I2R4P_sound) (by decide +kernel) +def CB1_4_3I2R4MassTerm : Ball := .exact 0 +lemma CB1_4_3I2R4MassTerm_sound : CB1_4_3I2R4MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_4_3I2R4Value a))) := + entropyTerm_zero_ball (CB1_4_3I2R4Mass_sound) +def CB1_4_3I2R4H : Ball := ⟨0, 0⟩ +lemma CB1_4_3I2R4H_sound : CB1_4_3I2R4H.Encloses (homogeneousEntropy CB1_4_3I2R4Value) := by + exact contains_sound (homogeneous_enclosed CB1_4_3I2R4Value CB1_4_3I2R4MassTerm_sound CB1_4_3I2R4Entropy_sound) (by decide +kernel) +def CB1_4_3I2R5Value (a : Fin 6) : ℝ := residualLaw (below (shape 1 4 3)) (fun u => (stageBLaw (shape 1 4 3) u : ℝ)) (stageBPriority (shape 1 4 3)) 2 (fun u a => (littleLaw (shape 1 4 3) u ((stageBPriority (shape 1 4 3)) 2) a : ℝ)) 5 a +def CB1_4_3I2R5Raw (a : Fin 6) : Ball := residualBall (below (shape 1 4 3)) B1_4_3Law (stageBPriority (shape 1 4 3)) 2 (fun u => B1_4_3Little u ((stageBPriority (shape 1 4 3)) 2)) 5 a +lemma CB1_4_3I2R5Raw_sound (a : Fin 6) : + (CB1_4_3I2R5Raw a).Encloses (CB1_4_3I2R5Value a) := by + exact residualBall_sound_on (below (shape 1 4 3)) B1_4_3Law (fun u => (stageBLaw (shape 1 4 3) u : ℝ)) (stageBPriority (shape 1 4 3)) 2 (fun u => B1_4_3Little u ((stageBPriority (shape 1 4 3)) 2)) (fun u a => (littleLaw (shape 1 4 3) u ((stageBPriority (shape 1 4 3)) 2) a : ℝ)) (fun u _ => B1_4_3Law_sound u) (fun u _ a => B1_4_3Little_sound u ((stageBPriority (shape 1 4 3)) 2) a) 5 a +def CB1_4_3I2R5Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB1_4_3I2R5Certificates_valid : + CB1_4_3I2R5Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_4_3I2R5CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB1_4_3I2R5P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_4_3I2R5Certificates (CB1_4_3I2R5CertificateIndex a)).input +lemma CB1_4_3I2R5P_check : ∀ a : Fin 6, contains (CB1_4_3I2R5Raw a) (CB1_4_3I2R5P a) = true := by + decide +kernel +lemma CB1_4_3I2R5P_sound (a : Fin 6) : + (CB1_4_3I2R5P a).Encloses (CB1_4_3I2R5Value a) := + contains_sound (CB1_4_3I2R5Raw_sound a) (CB1_4_3I2R5P_check a) +def CB1_4_3I2R5Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_4_3I2R5Certificates (CB1_4_3I2R5CertificateIndex a)).output +lemma CB1_4_3I2R5Terms_sound (a : Fin 6) : + (CB1_4_3I2R5Terms a).Encloses (Foundation.entropyTerm (CB1_4_3I2R5Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_4_3I2R5Certificates_valid + (CB1_4_3I2R5CertificateIndex a) (CB1_4_3I2R5P_sound a) +def CB1_4_3I2R5Entropy : Ball := ⟨0, 0⟩ +lemma CB1_4_3I2R5Entropy_sound : CB1_4_3I2R5Entropy.Encloses (Foundation.finiteEntropy CB1_4_3I2R5Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_4_3I2R5Value CB1_4_3I2R5Terms CB1_4_3I2R5Terms_sound) (by decide +kernel) +def CB1_4_3I2R5Mass : Ball := ⟨0, 0⟩ +lemma CB1_4_3I2R5Mass_sound : CB1_4_3I2R5Mass.Encloses (∑ a, CB1_4_3I2R5Value a) := by + exact contains_sound (finSumBall_sound 6 CB1_4_3I2R5P CB1_4_3I2R5Value CB1_4_3I2R5P_sound) (by decide +kernel) +def CB1_4_3I2R5MassTerm : Ball := .exact 0 +lemma CB1_4_3I2R5MassTerm_sound : CB1_4_3I2R5MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_4_3I2R5Value a))) := + entropyTerm_zero_ball (CB1_4_3I2R5Mass_sound) +def CB1_4_3I2R5H : Ball := ⟨0, 0⟩ +lemma CB1_4_3I2R5H_sound : CB1_4_3I2R5H.Encloses (homogeneousEntropy CB1_4_3I2R5Value) := by + exact contains_sound (homogeneous_enclosed CB1_4_3I2R5Value CB1_4_3I2R5MassTerm_sound CB1_4_3I2R5Entropy_sound) (by decide +kernel) +def CB1_4_3I2R6Value (a : Fin 6) : ℝ := residualLaw (below (shape 1 4 3)) (fun u => (stageBLaw (shape 1 4 3) u : ℝ)) (stageBPriority (shape 1 4 3)) 2 (fun u a => (littleLaw (shape 1 4 3) u ((stageBPriority (shape 1 4 3)) 2) a : ℝ)) 6 a +def CB1_4_3I2R6Raw (a : Fin 6) : Ball := residualBall (below (shape 1 4 3)) B1_4_3Law (stageBPriority (shape 1 4 3)) 2 (fun u => B1_4_3Little u ((stageBPriority (shape 1 4 3)) 2)) 6 a +lemma CB1_4_3I2R6Raw_sound (a : Fin 6) : + (CB1_4_3I2R6Raw a).Encloses (CB1_4_3I2R6Value a) := by + exact residualBall_sound_on (below (shape 1 4 3)) B1_4_3Law (fun u => (stageBLaw (shape 1 4 3) u : ℝ)) (stageBPriority (shape 1 4 3)) 2 (fun u => B1_4_3Little u ((stageBPriority (shape 1 4 3)) 2)) (fun u a => (littleLaw (shape 1 4 3) u ((stageBPriority (shape 1 4 3)) 2) a : ℝ)) (fun u _ => B1_4_3Law_sound u) (fun u _ a => B1_4_3Little_sound u ((stageBPriority (shape 1 4 3)) 2) a) 6 a +def CB1_4_3I2R6Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB1_4_3I2R6Certificates_valid : + CB1_4_3I2R6Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_4_3I2R6CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB1_4_3I2R6P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_4_3I2R6Certificates (CB1_4_3I2R6CertificateIndex a)).input +lemma CB1_4_3I2R6P_check : ∀ a : Fin 6, contains (CB1_4_3I2R6Raw a) (CB1_4_3I2R6P a) = true := by + decide +kernel +lemma CB1_4_3I2R6P_sound (a : Fin 6) : + (CB1_4_3I2R6P a).Encloses (CB1_4_3I2R6Value a) := + contains_sound (CB1_4_3I2R6Raw_sound a) (CB1_4_3I2R6P_check a) +def CB1_4_3I2R6Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_4_3I2R6Certificates (CB1_4_3I2R6CertificateIndex a)).output +lemma CB1_4_3I2R6Terms_sound (a : Fin 6) : + (CB1_4_3I2R6Terms a).Encloses (Foundation.entropyTerm (CB1_4_3I2R6Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_4_3I2R6Certificates_valid + (CB1_4_3I2R6CertificateIndex a) (CB1_4_3I2R6P_sound a) +def CB1_4_3I2R6Entropy : Ball := ⟨0, 0⟩ +lemma CB1_4_3I2R6Entropy_sound : CB1_4_3I2R6Entropy.Encloses (Foundation.finiteEntropy CB1_4_3I2R6Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_4_3I2R6Value CB1_4_3I2R6Terms CB1_4_3I2R6Terms_sound) (by decide +kernel) +def CB1_4_3I2R6Mass : Ball := ⟨0, 0⟩ +lemma CB1_4_3I2R6Mass_sound : CB1_4_3I2R6Mass.Encloses (∑ a, CB1_4_3I2R6Value a) := by + exact contains_sound (finSumBall_sound 6 CB1_4_3I2R6P CB1_4_3I2R6Value CB1_4_3I2R6P_sound) (by decide +kernel) +def CB1_4_3I2R6MassTerm : Ball := .exact 0 +lemma CB1_4_3I2R6MassTerm_sound : CB1_4_3I2R6MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_4_3I2R6Value a))) := + entropyTerm_zero_ball (CB1_4_3I2R6Mass_sound) +def CB1_4_3I2R6H : Ball := ⟨0, 0⟩ +lemma CB1_4_3I2R6H_sound : CB1_4_3I2R6H.Encloses (homogeneousEntropy CB1_4_3I2R6Value) := by + exact contains_sound (homogeneous_enclosed CB1_4_3I2R6Value CB1_4_3I2R6MassTerm_sound CB1_4_3I2R6Entropy_sound) (by decide +kernel) +def CB1_4_3I2R7Value (a : Fin 6) : ℝ := residualLaw (below (shape 1 4 3)) (fun u => (stageBLaw (shape 1 4 3) u : ℝ)) (stageBPriority (shape 1 4 3)) 2 (fun u a => (littleLaw (shape 1 4 3) u ((stageBPriority (shape 1 4 3)) 2) a : ℝ)) 7 a +def CB1_4_3I2R7Raw (a : Fin 6) : Ball := residualBall (below (shape 1 4 3)) B1_4_3Law (stageBPriority (shape 1 4 3)) 2 (fun u => B1_4_3Little u ((stageBPriority (shape 1 4 3)) 2)) 7 a +lemma CB1_4_3I2R7Raw_sound (a : Fin 6) : + (CB1_4_3I2R7Raw a).Encloses (CB1_4_3I2R7Value a) := by + exact residualBall_sound_on (below (shape 1 4 3)) B1_4_3Law (fun u => (stageBLaw (shape 1 4 3) u : ℝ)) (stageBPriority (shape 1 4 3)) 2 (fun u => B1_4_3Little u ((stageBPriority (shape 1 4 3)) 2)) (fun u a => (littleLaw (shape 1 4 3) u ((stageBPriority (shape 1 4 3)) 2) a : ℝ)) (fun u _ => B1_4_3Law_sound u) (fun u _ a => B1_4_3Little_sound u ((stageBPriority (shape 1 4 3)) 2) a) 7 a +def CB1_4_3I2R7Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB1_4_3I2R7Certificates_valid : + CB1_4_3I2R7Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_4_3I2R7CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB1_4_3I2R7P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_4_3I2R7Certificates (CB1_4_3I2R7CertificateIndex a)).input +lemma CB1_4_3I2R7P_check : ∀ a : Fin 6, contains (CB1_4_3I2R7Raw a) (CB1_4_3I2R7P a) = true := by + decide +kernel +lemma CB1_4_3I2R7P_sound (a : Fin 6) : + (CB1_4_3I2R7P a).Encloses (CB1_4_3I2R7Value a) := + contains_sound (CB1_4_3I2R7Raw_sound a) (CB1_4_3I2R7P_check a) +def CB1_4_3I2R7Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_4_3I2R7Certificates (CB1_4_3I2R7CertificateIndex a)).output +lemma CB1_4_3I2R7Terms_sound (a : Fin 6) : + (CB1_4_3I2R7Terms a).Encloses (Foundation.entropyTerm (CB1_4_3I2R7Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_4_3I2R7Certificates_valid + (CB1_4_3I2R7CertificateIndex a) (CB1_4_3I2R7P_sound a) +def CB1_4_3I2R7Entropy : Ball := ⟨0, 0⟩ +lemma CB1_4_3I2R7Entropy_sound : CB1_4_3I2R7Entropy.Encloses (Foundation.finiteEntropy CB1_4_3I2R7Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_4_3I2R7Value CB1_4_3I2R7Terms CB1_4_3I2R7Terms_sound) (by decide +kernel) +def CB1_4_3I2R7Mass : Ball := ⟨0, 0⟩ +lemma CB1_4_3I2R7Mass_sound : CB1_4_3I2R7Mass.Encloses (∑ a, CB1_4_3I2R7Value a) := by + exact contains_sound (finSumBall_sound 6 CB1_4_3I2R7P CB1_4_3I2R7Value CB1_4_3I2R7P_sound) (by decide +kernel) +def CB1_4_3I2R7MassTerm : Ball := .exact 0 +lemma CB1_4_3I2R7MassTerm_sound : CB1_4_3I2R7MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_4_3I2R7Value a))) := + entropyTerm_zero_ball (CB1_4_3I2R7Mass_sound) +def CB1_4_3I2R7H : Ball := ⟨0, 0⟩ +lemma CB1_4_3I2R7H_sound : CB1_4_3I2R7H.Encloses (homogeneousEntropy CB1_4_3I2R7Value) := by + exact contains_sound (homogeneous_enclosed CB1_4_3I2R7Value CB1_4_3I2R7MassTerm_sound CB1_4_3I2R7Entropy_sound) (by decide +kernel) +def CB1_4_3I2R8Value (a : Fin 6) : ℝ := residualLaw (below (shape 1 4 3)) (fun u => (stageBLaw (shape 1 4 3) u : ℝ)) (stageBPriority (shape 1 4 3)) 2 (fun u a => (littleLaw (shape 1 4 3) u ((stageBPriority (shape 1 4 3)) 2) a : ℝ)) 8 a +def CB1_4_3I2R8Raw (a : Fin 6) : Ball := residualBall (below (shape 1 4 3)) B1_4_3Law (stageBPriority (shape 1 4 3)) 2 (fun u => B1_4_3Little u ((stageBPriority (shape 1 4 3)) 2)) 8 a +lemma CB1_4_3I2R8Raw_sound (a : Fin 6) : + (CB1_4_3I2R8Raw a).Encloses (CB1_4_3I2R8Value a) := by + exact residualBall_sound_on (below (shape 1 4 3)) B1_4_3Law (fun u => (stageBLaw (shape 1 4 3) u : ℝ)) (stageBPriority (shape 1 4 3)) 2 (fun u => B1_4_3Little u ((stageBPriority (shape 1 4 3)) 2)) (fun u a => (littleLaw (shape 1 4 3) u ((stageBPriority (shape 1 4 3)) 2) a : ℝ)) (fun u _ => B1_4_3Law_sound u) (fun u _ a => B1_4_3Little_sound u ((stageBPriority (shape 1 4 3)) 2) a) 8 a +def CB1_4_3I2R8Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB1_4_3I2R8Certificates_valid : + CB1_4_3I2R8Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_4_3I2R8CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB1_4_3I2R8P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_4_3I2R8Certificates (CB1_4_3I2R8CertificateIndex a)).input +lemma CB1_4_3I2R8P_check : ∀ a : Fin 6, contains (CB1_4_3I2R8Raw a) (CB1_4_3I2R8P a) = true := by + decide +kernel +lemma CB1_4_3I2R8P_sound (a : Fin 6) : + (CB1_4_3I2R8P a).Encloses (CB1_4_3I2R8Value a) := + contains_sound (CB1_4_3I2R8Raw_sound a) (CB1_4_3I2R8P_check a) +def CB1_4_3I2R8Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_4_3I2R8Certificates (CB1_4_3I2R8CertificateIndex a)).output +lemma CB1_4_3I2R8Terms_sound (a : Fin 6) : + (CB1_4_3I2R8Terms a).Encloses (Foundation.entropyTerm (CB1_4_3I2R8Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_4_3I2R8Certificates_valid + (CB1_4_3I2R8CertificateIndex a) (CB1_4_3I2R8P_sound a) +def CB1_4_3I2R8Entropy : Ball := ⟨0, 0⟩ +lemma CB1_4_3I2R8Entropy_sound : CB1_4_3I2R8Entropy.Encloses (Foundation.finiteEntropy CB1_4_3I2R8Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_4_3I2R8Value CB1_4_3I2R8Terms CB1_4_3I2R8Terms_sound) (by decide +kernel) +def CB1_4_3I2R8Mass : Ball := ⟨0, 0⟩ +lemma CB1_4_3I2R8Mass_sound : CB1_4_3I2R8Mass.Encloses (∑ a, CB1_4_3I2R8Value a) := by + exact contains_sound (finSumBall_sound 6 CB1_4_3I2R8P CB1_4_3I2R8Value CB1_4_3I2R8P_sound) (by decide +kernel) +def CB1_4_3I2R8MassTerm : Ball := .exact 0 +lemma CB1_4_3I2R8MassTerm_sound : CB1_4_3I2R8MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_4_3I2R8Value a))) := + entropyTerm_zero_ball (CB1_4_3I2R8Mass_sound) +def CB1_4_3I2R8H : Ball := ⟨0, 0⟩ +lemma CB1_4_3I2R8H_sound : CB1_4_3I2R8H.Encloses (homogeneousEntropy CB1_4_3I2R8Value) := by + exact contains_sound (homogeneous_enclosed CB1_4_3I2R8Value CB1_4_3I2R8MassTerm_sound CB1_4_3I2R8Entropy_sound) (by decide +kernel) +def CB1_4_3I2R9Value (a : Fin 6) : ℝ := residualLaw (below (shape 1 4 3)) (fun u => (stageBLaw (shape 1 4 3) u : ℝ)) (stageBPriority (shape 1 4 3)) 2 (fun u a => (littleLaw (shape 1 4 3) u ((stageBPriority (shape 1 4 3)) 2) a : ℝ)) 9 a +def CB1_4_3I2R9Raw (a : Fin 6) : Ball := residualBall (below (shape 1 4 3)) B1_4_3Law (stageBPriority (shape 1 4 3)) 2 (fun u => B1_4_3Little u ((stageBPriority (shape 1 4 3)) 2)) 9 a +lemma CB1_4_3I2R9Raw_sound (a : Fin 6) : + (CB1_4_3I2R9Raw a).Encloses (CB1_4_3I2R9Value a) := by + exact residualBall_sound_on (below (shape 1 4 3)) B1_4_3Law (fun u => (stageBLaw (shape 1 4 3) u : ℝ)) (stageBPriority (shape 1 4 3)) 2 (fun u => B1_4_3Little u ((stageBPriority (shape 1 4 3)) 2)) (fun u a => (littleLaw (shape 1 4 3) u ((stageBPriority (shape 1 4 3)) 2) a : ℝ)) (fun u _ => B1_4_3Law_sound u) (fun u _ a => B1_4_3Little_sound u ((stageBPriority (shape 1 4 3)) 2) a) 9 a +def CB1_4_3I2R9Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB1_4_3I2R9Certificates_valid : + CB1_4_3I2R9Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_4_3I2R9CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB1_4_3I2R9P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_4_3I2R9Certificates (CB1_4_3I2R9CertificateIndex a)).input +lemma CB1_4_3I2R9P_check : ∀ a : Fin 6, contains (CB1_4_3I2R9Raw a) (CB1_4_3I2R9P a) = true := by + decide +kernel +lemma CB1_4_3I2R9P_sound (a : Fin 6) : + (CB1_4_3I2R9P a).Encloses (CB1_4_3I2R9Value a) := + contains_sound (CB1_4_3I2R9Raw_sound a) (CB1_4_3I2R9P_check a) +def CB1_4_3I2R9Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_4_3I2R9Certificates (CB1_4_3I2R9CertificateIndex a)).output +lemma CB1_4_3I2R9Terms_sound (a : Fin 6) : + (CB1_4_3I2R9Terms a).Encloses (Foundation.entropyTerm (CB1_4_3I2R9Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_4_3I2R9Certificates_valid + (CB1_4_3I2R9CertificateIndex a) (CB1_4_3I2R9P_sound a) +def CB1_4_3I2R9Entropy : Ball := ⟨0, 0⟩ +lemma CB1_4_3I2R9Entropy_sound : CB1_4_3I2R9Entropy.Encloses (Foundation.finiteEntropy CB1_4_3I2R9Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_4_3I2R9Value CB1_4_3I2R9Terms CB1_4_3I2R9Terms_sound) (by decide +kernel) +def CB1_4_3I2R9Mass : Ball := ⟨0, 0⟩ +lemma CB1_4_3I2R9Mass_sound : CB1_4_3I2R9Mass.Encloses (∑ a, CB1_4_3I2R9Value a) := by + exact contains_sound (finSumBall_sound 6 CB1_4_3I2R9P CB1_4_3I2R9Value CB1_4_3I2R9P_sound) (by decide +kernel) +def CB1_4_3I2R9MassTerm : Ball := .exact 0 +lemma CB1_4_3I2R9MassTerm_sound : CB1_4_3I2R9MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_4_3I2R9Value a))) := + entropyTerm_zero_ball (CB1_4_3I2R9Mass_sound) +def CB1_4_3I2R9H : Ball := ⟨0, 0⟩ +lemma CB1_4_3I2R9H_sound : CB1_4_3I2R9H.Encloses (homogeneousEntropy CB1_4_3I2R9Value) := by + exact contains_sound (homogeneous_enclosed CB1_4_3I2R9Value CB1_4_3I2R9MassTerm_sound CB1_4_3I2R9Entropy_sound) (by decide +kernel) +def CB1_4_3I2R10Value (a : Fin 6) : ℝ := residualLaw (below (shape 1 4 3)) (fun u => (stageBLaw (shape 1 4 3) u : ℝ)) (stageBPriority (shape 1 4 3)) 2 (fun u a => (littleLaw (shape 1 4 3) u ((stageBPriority (shape 1 4 3)) 2) a : ℝ)) 10 a +def CB1_4_3I2R10Raw (a : Fin 6) : Ball := residualBall (below (shape 1 4 3)) B1_4_3Law (stageBPriority (shape 1 4 3)) 2 (fun u => B1_4_3Little u ((stageBPriority (shape 1 4 3)) 2)) 10 a +lemma CB1_4_3I2R10Raw_sound (a : Fin 6) : + (CB1_4_3I2R10Raw a).Encloses (CB1_4_3I2R10Value a) := by + exact residualBall_sound_on (below (shape 1 4 3)) B1_4_3Law (fun u => (stageBLaw (shape 1 4 3) u : ℝ)) (stageBPriority (shape 1 4 3)) 2 (fun u => B1_4_3Little u ((stageBPriority (shape 1 4 3)) 2)) (fun u a => (littleLaw (shape 1 4 3) u ((stageBPriority (shape 1 4 3)) 2) a : ℝ)) (fun u _ => B1_4_3Law_sound u) (fun u _ a => B1_4_3Little_sound u ((stageBPriority (shape 1 4 3)) 2) a) 10 a +def CB1_4_3I2R10Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB1_4_3I2R10Certificates_valid : + CB1_4_3I2R10Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_4_3I2R10CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB1_4_3I2R10P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_4_3I2R10Certificates (CB1_4_3I2R10CertificateIndex a)).input +lemma CB1_4_3I2R10P_check : ∀ a : Fin 6, contains (CB1_4_3I2R10Raw a) (CB1_4_3I2R10P a) = true := by + decide +kernel +lemma CB1_4_3I2R10P_sound (a : Fin 6) : + (CB1_4_3I2R10P a).Encloses (CB1_4_3I2R10Value a) := + contains_sound (CB1_4_3I2R10Raw_sound a) (CB1_4_3I2R10P_check a) +def CB1_4_3I2R10Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_4_3I2R10Certificates (CB1_4_3I2R10CertificateIndex a)).output +lemma CB1_4_3I2R10Terms_sound (a : Fin 6) : + (CB1_4_3I2R10Terms a).Encloses (Foundation.entropyTerm (CB1_4_3I2R10Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_4_3I2R10Certificates_valid + (CB1_4_3I2R10CertificateIndex a) (CB1_4_3I2R10P_sound a) +def CB1_4_3I2R10Entropy : Ball := ⟨0, 0⟩ +lemma CB1_4_3I2R10Entropy_sound : CB1_4_3I2R10Entropy.Encloses (Foundation.finiteEntropy CB1_4_3I2R10Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_4_3I2R10Value CB1_4_3I2R10Terms CB1_4_3I2R10Terms_sound) (by decide +kernel) +def CB1_4_3I2R10Mass : Ball := ⟨0, 0⟩ +lemma CB1_4_3I2R10Mass_sound : CB1_4_3I2R10Mass.Encloses (∑ a, CB1_4_3I2R10Value a) := by + exact contains_sound (finSumBall_sound 6 CB1_4_3I2R10P CB1_4_3I2R10Value CB1_4_3I2R10P_sound) (by decide +kernel) +def CB1_4_3I2R10MassTerm : Ball := .exact 0 +lemma CB1_4_3I2R10MassTerm_sound : CB1_4_3I2R10MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_4_3I2R10Value a))) := + entropyTerm_zero_ball (CB1_4_3I2R10Mass_sound) +def CB1_4_3I2R10H : Ball := ⟨0, 0⟩ +lemma CB1_4_3I2R10H_sound : CB1_4_3I2R10H.Encloses (homogeneousEntropy CB1_4_3I2R10Value) := by + exact contains_sound (homogeneous_enclosed CB1_4_3I2R10Value CB1_4_3I2R10MassTerm_sound CB1_4_3I2R10Entropy_sound) (by decide +kernel) +def CB1_4_3I2R11Value (a : Fin 6) : ℝ := residualLaw (below (shape 1 4 3)) (fun u => (stageBLaw (shape 1 4 3) u : ℝ)) (stageBPriority (shape 1 4 3)) 2 (fun u a => (littleLaw (shape 1 4 3) u ((stageBPriority (shape 1 4 3)) 2) a : ℝ)) 11 a +def CB1_4_3I2R11Raw (a : Fin 6) : Ball := residualBall (below (shape 1 4 3)) B1_4_3Law (stageBPriority (shape 1 4 3)) 2 (fun u => B1_4_3Little u ((stageBPriority (shape 1 4 3)) 2)) 11 a +lemma CB1_4_3I2R11Raw_sound (a : Fin 6) : + (CB1_4_3I2R11Raw a).Encloses (CB1_4_3I2R11Value a) := by + exact residualBall_sound_on (below (shape 1 4 3)) B1_4_3Law (fun u => (stageBLaw (shape 1 4 3) u : ℝ)) (stageBPriority (shape 1 4 3)) 2 (fun u => B1_4_3Little u ((stageBPriority (shape 1 4 3)) 2)) (fun u a => (littleLaw (shape 1 4 3) u ((stageBPriority (shape 1 4 3)) 2) a : ℝ)) (fun u _ => B1_4_3Law_sound u) (fun u _ a => B1_4_3Little_sound u ((stageBPriority (shape 1 4 3)) 2) a) 11 a +def CB1_4_3I2R11Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB1_4_3I2R11Certificates_valid : + CB1_4_3I2R11Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_4_3I2R11CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB1_4_3I2R11P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_4_3I2R11Certificates (CB1_4_3I2R11CertificateIndex a)).input +lemma CB1_4_3I2R11P_check : ∀ a : Fin 6, contains (CB1_4_3I2R11Raw a) (CB1_4_3I2R11P a) = true := by + decide +kernel +lemma CB1_4_3I2R11P_sound (a : Fin 6) : + (CB1_4_3I2R11P a).Encloses (CB1_4_3I2R11Value a) := + contains_sound (CB1_4_3I2R11Raw_sound a) (CB1_4_3I2R11P_check a) +def CB1_4_3I2R11Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_4_3I2R11Certificates (CB1_4_3I2R11CertificateIndex a)).output +lemma CB1_4_3I2R11Terms_sound (a : Fin 6) : + (CB1_4_3I2R11Terms a).Encloses (Foundation.entropyTerm (CB1_4_3I2R11Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_4_3I2R11Certificates_valid + (CB1_4_3I2R11CertificateIndex a) (CB1_4_3I2R11P_sound a) +def CB1_4_3I2R11Entropy : Ball := ⟨0, 0⟩ +lemma CB1_4_3I2R11Entropy_sound : CB1_4_3I2R11Entropy.Encloses (Foundation.finiteEntropy CB1_4_3I2R11Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_4_3I2R11Value CB1_4_3I2R11Terms CB1_4_3I2R11Terms_sound) (by decide +kernel) +def CB1_4_3I2R11Mass : Ball := ⟨0, 0⟩ +lemma CB1_4_3I2R11Mass_sound : CB1_4_3I2R11Mass.Encloses (∑ a, CB1_4_3I2R11Value a) := by + exact contains_sound (finSumBall_sound 6 CB1_4_3I2R11P CB1_4_3I2R11Value CB1_4_3I2R11P_sound) (by decide +kernel) +def CB1_4_3I2R11MassTerm : Ball := .exact 0 +lemma CB1_4_3I2R11MassTerm_sound : CB1_4_3I2R11MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_4_3I2R11Value a))) := + entropyTerm_zero_ball (CB1_4_3I2R11Mass_sound) +def CB1_4_3I2R11H : Ball := ⟨0, 0⟩ +lemma CB1_4_3I2R11H_sound : CB1_4_3I2R11H.Encloses (homogeneousEntropy CB1_4_3I2R11Value) := by + exact contains_sound (homogeneous_enclosed CB1_4_3I2R11Value CB1_4_3I2R11MassTerm_sound CB1_4_3I2R11Entropy_sound) (by decide +kernel) +def CB1_4_3I2R12Value (a : Fin 6) : ℝ := residualLaw (below (shape 1 4 3)) (fun u => (stageBLaw (shape 1 4 3) u : ℝ)) (stageBPriority (shape 1 4 3)) 2 (fun u a => (littleLaw (shape 1 4 3) u ((stageBPriority (shape 1 4 3)) 2) a : ℝ)) 12 a +def CB1_4_3I2R12Raw (a : Fin 6) : Ball := residualBall (below (shape 1 4 3)) B1_4_3Law (stageBPriority (shape 1 4 3)) 2 (fun u => B1_4_3Little u ((stageBPriority (shape 1 4 3)) 2)) 12 a +lemma CB1_4_3I2R12Raw_sound (a : Fin 6) : + (CB1_4_3I2R12Raw a).Encloses (CB1_4_3I2R12Value a) := by + exact residualBall_sound_on (below (shape 1 4 3)) B1_4_3Law (fun u => (stageBLaw (shape 1 4 3) u : ℝ)) (stageBPriority (shape 1 4 3)) 2 (fun u => B1_4_3Little u ((stageBPriority (shape 1 4 3)) 2)) (fun u a => (littleLaw (shape 1 4 3) u ((stageBPriority (shape 1 4 3)) 2) a : ℝ)) (fun u _ => B1_4_3Law_sound u) (fun u _ a => B1_4_3Little_sound u ((stageBPriority (shape 1 4 3)) 2) a) 12 a +def CB1_4_3I2R12Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB1_4_3I2R12Certificates_valid : + CB1_4_3I2R12Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_4_3I2R12CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB1_4_3I2R12P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_4_3I2R12Certificates (CB1_4_3I2R12CertificateIndex a)).input +lemma CB1_4_3I2R12P_check : ∀ a : Fin 6, contains (CB1_4_3I2R12Raw a) (CB1_4_3I2R12P a) = true := by + decide +kernel +lemma CB1_4_3I2R12P_sound (a : Fin 6) : + (CB1_4_3I2R12P a).Encloses (CB1_4_3I2R12Value a) := + contains_sound (CB1_4_3I2R12Raw_sound a) (CB1_4_3I2R12P_check a) +def CB1_4_3I2R12Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_4_3I2R12Certificates (CB1_4_3I2R12CertificateIndex a)).output +lemma CB1_4_3I2R12Terms_sound (a : Fin 6) : + (CB1_4_3I2R12Terms a).Encloses (Foundation.entropyTerm (CB1_4_3I2R12Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_4_3I2R12Certificates_valid + (CB1_4_3I2R12CertificateIndex a) (CB1_4_3I2R12P_sound a) +def CB1_4_3I2R12Entropy : Ball := ⟨0, 0⟩ +lemma CB1_4_3I2R12Entropy_sound : CB1_4_3I2R12Entropy.Encloses (Foundation.finiteEntropy CB1_4_3I2R12Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_4_3I2R12Value CB1_4_3I2R12Terms CB1_4_3I2R12Terms_sound) (by decide +kernel) +def CB1_4_3I2R12Mass : Ball := ⟨0, 0⟩ +lemma CB1_4_3I2R12Mass_sound : CB1_4_3I2R12Mass.Encloses (∑ a, CB1_4_3I2R12Value a) := by + exact contains_sound (finSumBall_sound 6 CB1_4_3I2R12P CB1_4_3I2R12Value CB1_4_3I2R12P_sound) (by decide +kernel) +def CB1_4_3I2R12MassTerm : Ball := .exact 0 +lemma CB1_4_3I2R12MassTerm_sound : CB1_4_3I2R12MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_4_3I2R12Value a))) := + entropyTerm_zero_ball (CB1_4_3I2R12Mass_sound) +def CB1_4_3I2R12H : Ball := ⟨0, 0⟩ +lemma CB1_4_3I2R12H_sound : CB1_4_3I2R12H.Encloses (homogeneousEntropy CB1_4_3I2R12Value) := by + exact contains_sound (homogeneous_enclosed CB1_4_3I2R12Value CB1_4_3I2R12MassTerm_sound CB1_4_3I2R12Entropy_sound) (by decide +kernel) +def CB1_4_3I2R13Value (a : Fin 6) : ℝ := residualLaw (below (shape 1 4 3)) (fun u => (stageBLaw (shape 1 4 3) u : ℝ)) (stageBPriority (shape 1 4 3)) 2 (fun u a => (littleLaw (shape 1 4 3) u ((stageBPriority (shape 1 4 3)) 2) a : ℝ)) 13 a +def CB1_4_3I2R13Raw (a : Fin 6) : Ball := residualBall (below (shape 1 4 3)) B1_4_3Law (stageBPriority (shape 1 4 3)) 2 (fun u => B1_4_3Little u ((stageBPriority (shape 1 4 3)) 2)) 13 a +lemma CB1_4_3I2R13Raw_sound (a : Fin 6) : + (CB1_4_3I2R13Raw a).Encloses (CB1_4_3I2R13Value a) := by + exact residualBall_sound_on (below (shape 1 4 3)) B1_4_3Law (fun u => (stageBLaw (shape 1 4 3) u : ℝ)) (stageBPriority (shape 1 4 3)) 2 (fun u => B1_4_3Little u ((stageBPriority (shape 1 4 3)) 2)) (fun u a => (littleLaw (shape 1 4 3) u ((stageBPriority (shape 1 4 3)) 2) a : ℝ)) (fun u _ => B1_4_3Law_sound u) (fun u _ a => B1_4_3Little_sound u ((stageBPriority (shape 1 4 3)) 2) a) 13 a +def CB1_4_3I2R13Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB1_4_3I2R13Certificates_valid : + CB1_4_3I2R13Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_4_3I2R13CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB1_4_3I2R13P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_4_3I2R13Certificates (CB1_4_3I2R13CertificateIndex a)).input +lemma CB1_4_3I2R13P_check : ∀ a : Fin 6, contains (CB1_4_3I2R13Raw a) (CB1_4_3I2R13P a) = true := by + decide +kernel +lemma CB1_4_3I2R13P_sound (a : Fin 6) : + (CB1_4_3I2R13P a).Encloses (CB1_4_3I2R13Value a) := + contains_sound (CB1_4_3I2R13Raw_sound a) (CB1_4_3I2R13P_check a) +def CB1_4_3I2R13Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_4_3I2R13Certificates (CB1_4_3I2R13CertificateIndex a)).output +lemma CB1_4_3I2R13Terms_sound (a : Fin 6) : + (CB1_4_3I2R13Terms a).Encloses (Foundation.entropyTerm (CB1_4_3I2R13Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_4_3I2R13Certificates_valid + (CB1_4_3I2R13CertificateIndex a) (CB1_4_3I2R13P_sound a) +def CB1_4_3I2R13Entropy : Ball := ⟨0, 0⟩ +lemma CB1_4_3I2R13Entropy_sound : CB1_4_3I2R13Entropy.Encloses (Foundation.finiteEntropy CB1_4_3I2R13Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_4_3I2R13Value CB1_4_3I2R13Terms CB1_4_3I2R13Terms_sound) (by decide +kernel) +def CB1_4_3I2R13Mass : Ball := ⟨0, 0⟩ +lemma CB1_4_3I2R13Mass_sound : CB1_4_3I2R13Mass.Encloses (∑ a, CB1_4_3I2R13Value a) := by + exact contains_sound (finSumBall_sound 6 CB1_4_3I2R13P CB1_4_3I2R13Value CB1_4_3I2R13P_sound) (by decide +kernel) +def CB1_4_3I2R13MassTerm : Ball := .exact 0 +lemma CB1_4_3I2R13MassTerm_sound : CB1_4_3I2R13MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_4_3I2R13Value a))) := + entropyTerm_zero_ball (CB1_4_3I2R13Mass_sound) +def CB1_4_3I2R13H : Ball := ⟨0, 0⟩ +lemma CB1_4_3I2R13H_sound : CB1_4_3I2R13H.Encloses (homogeneousEntropy CB1_4_3I2R13Value) := by + exact contains_sound (homogeneous_enclosed CB1_4_3I2R13Value CB1_4_3I2R13MassTerm_sound CB1_4_3I2R13Entropy_sound) (by decide +kernel) +def CB1_4_3I2R14Value (a : Fin 6) : ℝ := residualLaw (below (shape 1 4 3)) (fun u => (stageBLaw (shape 1 4 3) u : ℝ)) (stageBPriority (shape 1 4 3)) 2 (fun u a => (littleLaw (shape 1 4 3) u ((stageBPriority (shape 1 4 3)) 2) a : ℝ)) 14 a +def CB1_4_3I2R14Raw (a : Fin 6) : Ball := residualBall (below (shape 1 4 3)) B1_4_3Law (stageBPriority (shape 1 4 3)) 2 (fun u => B1_4_3Little u ((stageBPriority (shape 1 4 3)) 2)) 14 a +lemma CB1_4_3I2R14Raw_sound (a : Fin 6) : + (CB1_4_3I2R14Raw a).Encloses (CB1_4_3I2R14Value a) := by + exact residualBall_sound_on (below (shape 1 4 3)) B1_4_3Law (fun u => (stageBLaw (shape 1 4 3) u : ℝ)) (stageBPriority (shape 1 4 3)) 2 (fun u => B1_4_3Little u ((stageBPriority (shape 1 4 3)) 2)) (fun u a => (littleLaw (shape 1 4 3) u ((stageBPriority (shape 1 4 3)) 2) a : ℝ)) (fun u _ => B1_4_3Law_sound u) (fun u _ a => B1_4_3Little_sound u ((stageBPriority (shape 1 4 3)) 2) a) 14 a +def CB1_4_3I2R14Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB1_4_3I2R14Certificates_valid : + CB1_4_3I2R14Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_4_3I2R14CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB1_4_3I2R14P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_4_3I2R14Certificates (CB1_4_3I2R14CertificateIndex a)).input +lemma CB1_4_3I2R14P_check : ∀ a : Fin 6, contains (CB1_4_3I2R14Raw a) (CB1_4_3I2R14P a) = true := by + decide +kernel +lemma CB1_4_3I2R14P_sound (a : Fin 6) : + (CB1_4_3I2R14P a).Encloses (CB1_4_3I2R14Value a) := + contains_sound (CB1_4_3I2R14Raw_sound a) (CB1_4_3I2R14P_check a) +def CB1_4_3I2R14Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_4_3I2R14Certificates (CB1_4_3I2R14CertificateIndex a)).output +lemma CB1_4_3I2R14Terms_sound (a : Fin 6) : + (CB1_4_3I2R14Terms a).Encloses (Foundation.entropyTerm (CB1_4_3I2R14Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_4_3I2R14Certificates_valid + (CB1_4_3I2R14CertificateIndex a) (CB1_4_3I2R14P_sound a) +def CB1_4_3I2R14Entropy : Ball := ⟨0, 0⟩ +lemma CB1_4_3I2R14Entropy_sound : CB1_4_3I2R14Entropy.Encloses (Foundation.finiteEntropy CB1_4_3I2R14Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_4_3I2R14Value CB1_4_3I2R14Terms CB1_4_3I2R14Terms_sound) (by decide +kernel) +def CB1_4_3I2R14Mass : Ball := ⟨0, 0⟩ +lemma CB1_4_3I2R14Mass_sound : CB1_4_3I2R14Mass.Encloses (∑ a, CB1_4_3I2R14Value a) := by + exact contains_sound (finSumBall_sound 6 CB1_4_3I2R14P CB1_4_3I2R14Value CB1_4_3I2R14P_sound) (by decide +kernel) +def CB1_4_3I2R14MassTerm : Ball := .exact 0 +lemma CB1_4_3I2R14MassTerm_sound : CB1_4_3I2R14MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_4_3I2R14Value a))) := + entropyTerm_zero_ball (CB1_4_3I2R14Mass_sound) +def CB1_4_3I2R14H : Ball := ⟨0, 0⟩ +lemma CB1_4_3I2R14H_sound : CB1_4_3I2R14H.Encloses (homogeneousEntropy CB1_4_3I2R14Value) := by + exact contains_sound (homogeneous_enclosed CB1_4_3I2R14Value CB1_4_3I2R14MassTerm_sound CB1_4_3I2R14Entropy_sound) (by decide +kernel) +def CB1_4_3I2R15Value (a : Fin 6) : ℝ := residualLaw (below (shape 1 4 3)) (fun u => (stageBLaw (shape 1 4 3) u : ℝ)) (stageBPriority (shape 1 4 3)) 2 (fun u a => (littleLaw (shape 1 4 3) u ((stageBPriority (shape 1 4 3)) 2) a : ℝ)) 15 a +def CB1_4_3I2R15Raw (a : Fin 6) : Ball := residualBall (below (shape 1 4 3)) B1_4_3Law (stageBPriority (shape 1 4 3)) 2 (fun u => B1_4_3Little u ((stageBPriority (shape 1 4 3)) 2)) 15 a +lemma CB1_4_3I2R15Raw_sound (a : Fin 6) : + (CB1_4_3I2R15Raw a).Encloses (CB1_4_3I2R15Value a) := by + exact residualBall_sound_on (below (shape 1 4 3)) B1_4_3Law (fun u => (stageBLaw (shape 1 4 3) u : ℝ)) (stageBPriority (shape 1 4 3)) 2 (fun u => B1_4_3Little u ((stageBPriority (shape 1 4 3)) 2)) (fun u a => (littleLaw (shape 1 4 3) u ((stageBPriority (shape 1 4 3)) 2) a : ℝ)) (fun u _ => B1_4_3Law_sound u) (fun u _ a => B1_4_3Little_sound u ((stageBPriority (shape 1 4 3)) 2) a) 15 a +def CB1_4_3I2R15Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB1_4_3I2R15Certificates_valid : + CB1_4_3I2R15Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_4_3I2R15CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB1_4_3I2R15P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_4_3I2R15Certificates (CB1_4_3I2R15CertificateIndex a)).input +lemma CB1_4_3I2R15P_check : ∀ a : Fin 6, contains (CB1_4_3I2R15Raw a) (CB1_4_3I2R15P a) = true := by + decide +kernel +lemma CB1_4_3I2R15P_sound (a : Fin 6) : + (CB1_4_3I2R15P a).Encloses (CB1_4_3I2R15Value a) := + contains_sound (CB1_4_3I2R15Raw_sound a) (CB1_4_3I2R15P_check a) +def CB1_4_3I2R15Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_4_3I2R15Certificates (CB1_4_3I2R15CertificateIndex a)).output +lemma CB1_4_3I2R15Terms_sound (a : Fin 6) : + (CB1_4_3I2R15Terms a).Encloses (Foundation.entropyTerm (CB1_4_3I2R15Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_4_3I2R15Certificates_valid + (CB1_4_3I2R15CertificateIndex a) (CB1_4_3I2R15P_sound a) +def CB1_4_3I2R15Entropy : Ball := ⟨0, 0⟩ +lemma CB1_4_3I2R15Entropy_sound : CB1_4_3I2R15Entropy.Encloses (Foundation.finiteEntropy CB1_4_3I2R15Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_4_3I2R15Value CB1_4_3I2R15Terms CB1_4_3I2R15Terms_sound) (by decide +kernel) +def CB1_4_3I2R15Mass : Ball := ⟨0, 0⟩ +lemma CB1_4_3I2R15Mass_sound : CB1_4_3I2R15Mass.Encloses (∑ a, CB1_4_3I2R15Value a) := by + exact contains_sound (finSumBall_sound 6 CB1_4_3I2R15P CB1_4_3I2R15Value CB1_4_3I2R15P_sound) (by decide +kernel) +def CB1_4_3I2R15MassTerm : Ball := .exact 0 +lemma CB1_4_3I2R15MassTerm_sound : CB1_4_3I2R15MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_4_3I2R15Value a))) := + entropyTerm_zero_ball (CB1_4_3I2R15Mass_sound) +def CB1_4_3I2R15H : Ball := ⟨0, 0⟩ +lemma CB1_4_3I2R15H_sound : CB1_4_3I2R15H.Encloses (homogeneousEntropy CB1_4_3I2R15Value) := by + exact contains_sound (homogeneous_enclosed CB1_4_3I2R15Value CB1_4_3I2R15MassTerm_sound CB1_4_3I2R15Entropy_sound) (by decide +kernel) +def CB1_4_3I2R16Value (a : Fin 6) : ℝ := residualLaw (below (shape 1 4 3)) (fun u => (stageBLaw (shape 1 4 3) u : ℝ)) (stageBPriority (shape 1 4 3)) 2 (fun u a => (littleLaw (shape 1 4 3) u ((stageBPriority (shape 1 4 3)) 2) a : ℝ)) 16 a +def CB1_4_3I2R16Raw (a : Fin 6) : Ball := residualBall (below (shape 1 4 3)) B1_4_3Law (stageBPriority (shape 1 4 3)) 2 (fun u => B1_4_3Little u ((stageBPriority (shape 1 4 3)) 2)) 16 a +lemma CB1_4_3I2R16Raw_sound (a : Fin 6) : + (CB1_4_3I2R16Raw a).Encloses (CB1_4_3I2R16Value a) := by + exact residualBall_sound_on (below (shape 1 4 3)) B1_4_3Law (fun u => (stageBLaw (shape 1 4 3) u : ℝ)) (stageBPriority (shape 1 4 3)) 2 (fun u => B1_4_3Little u ((stageBPriority (shape 1 4 3)) 2)) (fun u a => (littleLaw (shape 1 4 3) u ((stageBPriority (shape 1 4 3)) 2) a : ℝ)) (fun u _ => B1_4_3Law_sound u) (fun u _ a => B1_4_3Little_sound u ((stageBPriority (shape 1 4 3)) 2) a) 16 a +def CB1_4_3I2R16Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB1_4_3I2R16Certificates_valid : + CB1_4_3I2R16Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_4_3I2R16CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB1_4_3I2R16P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_4_3I2R16Certificates (CB1_4_3I2R16CertificateIndex a)).input +lemma CB1_4_3I2R16P_check : ∀ a : Fin 6, contains (CB1_4_3I2R16Raw a) (CB1_4_3I2R16P a) = true := by + decide +kernel +lemma CB1_4_3I2R16P_sound (a : Fin 6) : + (CB1_4_3I2R16P a).Encloses (CB1_4_3I2R16Value a) := + contains_sound (CB1_4_3I2R16Raw_sound a) (CB1_4_3I2R16P_check a) +def CB1_4_3I2R16Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_4_3I2R16Certificates (CB1_4_3I2R16CertificateIndex a)).output +lemma CB1_4_3I2R16Terms_sound (a : Fin 6) : + (CB1_4_3I2R16Terms a).Encloses (Foundation.entropyTerm (CB1_4_3I2R16Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_4_3I2R16Certificates_valid + (CB1_4_3I2R16CertificateIndex a) (CB1_4_3I2R16P_sound a) +def CB1_4_3I2R16Entropy : Ball := ⟨0, 0⟩ +lemma CB1_4_3I2R16Entropy_sound : CB1_4_3I2R16Entropy.Encloses (Foundation.finiteEntropy CB1_4_3I2R16Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_4_3I2R16Value CB1_4_3I2R16Terms CB1_4_3I2R16Terms_sound) (by decide +kernel) +def CB1_4_3I2R16Mass : Ball := ⟨0, 0⟩ +lemma CB1_4_3I2R16Mass_sound : CB1_4_3I2R16Mass.Encloses (∑ a, CB1_4_3I2R16Value a) := by + exact contains_sound (finSumBall_sound 6 CB1_4_3I2R16P CB1_4_3I2R16Value CB1_4_3I2R16P_sound) (by decide +kernel) +def CB1_4_3I2R16MassTerm : Ball := .exact 0 +lemma CB1_4_3I2R16MassTerm_sound : CB1_4_3I2R16MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_4_3I2R16Value a))) := + entropyTerm_zero_ball (CB1_4_3I2R16Mass_sound) +def CB1_4_3I2R16H : Ball := ⟨0, 0⟩ +lemma CB1_4_3I2R16H_sound : CB1_4_3I2R16H.Encloses (homogeneousEntropy CB1_4_3I2R16Value) := by + exact contains_sound (homogeneous_enclosed CB1_4_3I2R16Value CB1_4_3I2R16MassTerm_sound CB1_4_3I2R16Entropy_sound) (by decide +kernel) +def CB1_4_3I2ResidualEntropies (a : Fin 17) : Ball := + match a.val with + | 0 => CB1_4_3I2R0H + | 1 => CB1_4_3I2R1H + | 2 => CB1_4_3I2R2H + | 3 => CB1_4_3I2R3H + | 4 => CB1_4_3I2R4H + | 5 => CB1_4_3I2R5H + | 6 => CB1_4_3I2R6H + | 7 => CB1_4_3I2R7H + | 8 => CB1_4_3I2R8H + | 9 => CB1_4_3I2R9H + | 10 => CB1_4_3I2R10H + | 11 => CB1_4_3I2R11H + | 12 => CB1_4_3I2R12H + | 13 => CB1_4_3I2R13H + | 14 => CB1_4_3I2R14H + | 15 => CB1_4_3I2R15H + | 16 => CB1_4_3I2R16H + | _ => (.exact 0) +lemma CB1_4_3I2ResidualEntropies_sound (k : Fin 17) : + (CB1_4_3I2ResidualEntropies k).Encloses (homogeneousEntropy + (residualLaw (below (shape 1 4 3)) (fun u => (stageBLaw (shape 1 4 3) u : ℝ)) (stageBPriority (shape 1 4 3)) 2 (fun u a => (littleLaw (shape 1 4 3) u ((stageBPriority (shape 1 4 3)) 2) a : ℝ)) k)) := by + fin_cases k + · exact CB1_4_3I2R0H_sound + · exact CB1_4_3I2R1H_sound + · exact CB1_4_3I2R2H_sound + · exact CB1_4_3I2R3H_sound + · exact CB1_4_3I2R4H_sound + · exact CB1_4_3I2R5H_sound + · exact CB1_4_3I2R6H_sound + · exact CB1_4_3I2R7H_sound + · exact CB1_4_3I2R8H_sound + · exact CB1_4_3I2R9H_sound + · exact CB1_4_3I2R10H_sound + · exact CB1_4_3I2R11H_sound + · exact CB1_4_3I2R12H_sound + · exact CB1_4_3I2R13H_sound + · exact CB1_4_3I2R14H_sound + · exact CB1_4_3I2R15H_sound + · exact CB1_4_3I2R16H_sound +def CB1_4_3I2S0_1_3Value (a : Fin 6) : ℝ := (littleLaw (shape 1 4 3) (shape 0 1 3) ((stageBPriority (shape 1 4 3)) 2) a : ℝ) +def CB1_4_3I2S0_1_3E_1Log : Ball := .exact 0 +lemma CB1_4_3I2S0_1_3E_1Log_sound : CB1_4_3I2S0_1_3E_1Log.Encloses (Real.log (CB1_4_3I2S0_1_3Value (1 : Fin 6))) := by + exact log_exact_one_ball ((B1_4_3Little_sound (shape 0 1 3) ((stageBPriority (shape 1 4 3)) 2)) (1 : Fin 6)) +def CB1_4_3I2S0_1_3E_1 : Ball := ⟨0, 0⟩ +lemma CB1_4_3I2S0_1_3E_1_sound : CB1_4_3I2S0_1_3E_1.Encloses (Foundation.entropyTerm (CB1_4_3I2S0_1_3Value (1 : Fin 6))) := by + exact contains_sound (entropyTerm_ball ((B1_4_3Little_sound (shape 0 1 3) ((stageBPriority (shape 1 4 3)) 2)) (1 : Fin 6)) CB1_4_3I2S0_1_3E_1Log_sound) (by decide +kernel) +def CB1_4_3I2S0_1_3Terms (a : Fin 6) : Ball := + match a.val with + | 1 => ⟨0, 0⟩ + | _ => (.exact 0) +lemma CB1_4_3I2S0_1_3Terms_sound (a : Fin 6) : + (CB1_4_3I2S0_1_3Terms a).Encloses (Foundation.entropyTerm (CB1_4_3I2S0_1_3Value a)) := by + fin_cases a + · exact (entropyTerm_zero_ball ((B1_4_3Little_sound (shape 0 1 3) ((stageBPriority (shape 1 4 3)) 2)) (0 : Fin 6))) + · exact CB1_4_3I2S0_1_3E_1_sound + · exact (entropyTerm_zero_ball ((B1_4_3Little_sound (shape 0 1 3) ((stageBPriority (shape 1 4 3)) 2)) (2 : Fin 6))) + · exact (entropyTerm_zero_ball ((B1_4_3Little_sound (shape 0 1 3) ((stageBPriority (shape 1 4 3)) 2)) (3 : Fin 6))) + · exact (entropyTerm_zero_ball ((B1_4_3Little_sound (shape 0 1 3) ((stageBPriority (shape 1 4 3)) 2)) (4 : Fin 6))) + · exact (entropyTerm_zero_ball ((B1_4_3Little_sound (shape 0 1 3) ((stageBPriority (shape 1 4 3)) 2)) (5 : Fin 6))) +def CB1_4_3I2S0_1_3Entropy : Ball := ⟨0, 0⟩ +lemma CB1_4_3I2S0_1_3Entropy_sound : CB1_4_3I2S0_1_3Entropy.Encloses (Foundation.finiteEntropy CB1_4_3I2S0_1_3Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_4_3I2S0_1_3Value CB1_4_3I2S0_1_3Terms CB1_4_3I2S0_1_3Terms_sound) (by decide +kernel) +def CB1_4_3I2S0_1_3Mass : Ball := ⟨1, 0⟩ +lemma CB1_4_3I2S0_1_3Mass_sound : CB1_4_3I2S0_1_3Mass.Encloses (∑ a, CB1_4_3I2S0_1_3Value a) := by + exact contains_sound (finSumBall_sound 6 (B1_4_3Little (shape 0 1 3) ((stageBPriority (shape 1 4 3)) 2)) CB1_4_3I2S0_1_3Value (B1_4_3Little_sound (shape 0 1 3) ((stageBPriority (shape 1 4 3)) 2))) (by decide +kernel) +def CB1_4_3I2S0_1_3MassTermLog : Ball := .exact 0 +lemma CB1_4_3I2S0_1_3MassTermLog_sound : CB1_4_3I2S0_1_3MassTermLog.Encloses (Real.log ((∑ a, CB1_4_3I2S0_1_3Value a))) := by + exact log_exact_one_ball (CB1_4_3I2S0_1_3Mass_sound) +def CB1_4_3I2S0_1_3MassTerm : Ball := ⟨0, 0⟩ +lemma CB1_4_3I2S0_1_3MassTerm_sound : CB1_4_3I2S0_1_3MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_4_3I2S0_1_3Value a))) := by + exact contains_sound (entropyTerm_ball (CB1_4_3I2S0_1_3Mass_sound) CB1_4_3I2S0_1_3MassTermLog_sound) (by decide +kernel) +def CB1_4_3I2S0_1_3H : Ball := ⟨0, 0⟩ +lemma CB1_4_3I2S0_1_3H_sound : CB1_4_3I2S0_1_3H.Encloses (homogeneousEntropy CB1_4_3I2S0_1_3Value) := by + exact contains_sound (homogeneous_enclosed CB1_4_3I2S0_1_3Value CB1_4_3I2S0_1_3MassTerm_sound CB1_4_3I2S0_1_3Entropy_sound) (by decide +kernel) +def CB1_4_3I2S0_2_2Value (a : Fin 6) : ℝ := (littleLaw (shape 1 4 3) (shape 0 2 2) ((stageBPriority (shape 1 4 3)) 2) a : ℝ) +def CB1_4_3I2S0_2_2E_2LogWitness : LogWitness := ⟨-1, 226099, 125000⟩ +def CB1_4_3I2S0_2_2E_2Log : Ball := ⟨(-2512199035246581498367078978841 / 25000000000000000000000000000000), (21175823683 / 50000000000000000000000000000000)⟩ +lemma CB1_4_3I2S0_2_2E_2Log_sound : CB1_4_3I2S0_2_2E_2Log.Encloses (Real.log (CB1_4_3I2S0_2_2Value (2 : Fin 6))) := by + exact checkLog_sound logTwoBall_sound ((B1_4_3Little_sound (shape 0 2 2) ((stageBPriority (shape 1 4 3)) 2)) (2 : Fin 6)) (w := CB1_4_3I2S0_2_2E_2LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB1_4_3I2S0_2_2E_2 : Ball := ⟨(568005689670216830199298190037 / 6250000000000000000000000000000), (4787832559 / 12500000000000000000000000000000)⟩ +lemma CB1_4_3I2S0_2_2E_2_sound : CB1_4_3I2S0_2_2E_2.Encloses (Foundation.entropyTerm (CB1_4_3I2S0_2_2Value (2 : Fin 6))) := by + exact contains_sound (entropyTerm_ball ((B1_4_3Little_sound (shape 0 2 2) ((stageBPriority (shape 1 4 3)) 2)) (2 : Fin 6)) CB1_4_3I2S0_2_2E_2Log_sound) (by decide +kernel) +def CB1_4_3I2S0_2_2E_3LogWitness : LogWitness := ⟨-4, 23901, 15625⟩ +def CB1_4_3I2S0_2_2E_3Log : Ball := ⟨(-234754061879590774959727984514419 / 100000000000000000000000000000000), (52939559207 / 50000000000000000000000000000000)⟩ +lemma CB1_4_3I2S0_2_2E_3Log_sound : CB1_4_3I2S0_2_2E_3Log.Encloses (Real.log (CB1_4_3I2S0_2_2Value (3 : Fin 6))) := by + exact checkLog_sound logTwoBall_sound ((B1_4_3Little_sound (shape 0 2 2) ((stageBPriority (shape 1 4 3)) 2)) (3 : Fin 6)) (w := CB1_4_3I2S0_2_2E_3LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB1_4_3I2S0_2_2E_3 : Ball := ⟨(22443427331936396449249834231517 / 100000000000000000000000000000000), (5061233619 / 50000000000000000000000000000000)⟩ +lemma CB1_4_3I2S0_2_2E_3_sound : CB1_4_3I2S0_2_2E_3.Encloses (Foundation.entropyTerm (CB1_4_3I2S0_2_2Value (3 : Fin 6))) := by + exact contains_sound (entropyTerm_ball ((B1_4_3Little_sound (shape 0 2 2) ((stageBPriority (shape 1 4 3)) 2)) (3 : Fin 6)) CB1_4_3I2S0_2_2E_3Log_sound) (by decide +kernel) +def CB1_4_3I2S0_2_2Terms (a : Fin 6) : Ball := + match a.val with + | 2 => ⟨(568005689670216830199298190037 / 6250000000000000000000000000000), (4787832559 / 12500000000000000000000000000000)⟩ + | 3 => ⟨(22443427331936396449249834231517 / 100000000000000000000000000000000), (5061233619 / 50000000000000000000000000000000)⟩ + | _ => (.exact 0) +lemma CB1_4_3I2S0_2_2Terms_sound (a : Fin 6) : + (CB1_4_3I2S0_2_2Terms a).Encloses (Foundation.entropyTerm (CB1_4_3I2S0_2_2Value a)) := by + fin_cases a + · exact (entropyTerm_zero_ball ((B1_4_3Little_sound (shape 0 2 2) ((stageBPriority (shape 1 4 3)) 2)) (0 : Fin 6))) + · exact (entropyTerm_zero_ball ((B1_4_3Little_sound (shape 0 2 2) ((stageBPriority (shape 1 4 3)) 2)) (1 : Fin 6))) + · exact CB1_4_3I2S0_2_2E_2_sound + · exact CB1_4_3I2S0_2_2E_3_sound + · exact (entropyTerm_zero_ball ((B1_4_3Little_sound (shape 0 2 2) ((stageBPriority (shape 1 4 3)) 2)) (4 : Fin 6))) + · exact (entropyTerm_zero_ball ((B1_4_3Little_sound (shape 0 2 2) ((stageBPriority (shape 1 4 3)) 2)) (5 : Fin 6))) +def CB1_4_3I2S0_2_2Entropy : Ball := ⟨(31531518366659865732438605272109 / 100000000000000000000000000000000), (4842512771 / 10000000000000000000000000000000)⟩ +lemma CB1_4_3I2S0_2_2Entropy_sound : CB1_4_3I2S0_2_2Entropy.Encloses (Foundation.finiteEntropy CB1_4_3I2S0_2_2Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_4_3I2S0_2_2Value CB1_4_3I2S0_2_2Terms CB1_4_3I2S0_2_2Terms_sound) (by decide +kernel) +def CB1_4_3I2S0_2_2Mass : Ball := ⟨1, 0⟩ +lemma CB1_4_3I2S0_2_2Mass_sound : CB1_4_3I2S0_2_2Mass.Encloses (∑ a, CB1_4_3I2S0_2_2Value a) := by + exact contains_sound (finSumBall_sound 6 (B1_4_3Little (shape 0 2 2) ((stageBPriority (shape 1 4 3)) 2)) CB1_4_3I2S0_2_2Value (B1_4_3Little_sound (shape 0 2 2) ((stageBPriority (shape 1 4 3)) 2))) (by decide +kernel) +def CB1_4_3I2S0_2_2MassTermLog : Ball := .exact 0 +lemma CB1_4_3I2S0_2_2MassTermLog_sound : CB1_4_3I2S0_2_2MassTermLog.Encloses (Real.log ((∑ a, CB1_4_3I2S0_2_2Value a))) := by + exact log_exact_one_ball (CB1_4_3I2S0_2_2Mass_sound) +def CB1_4_3I2S0_2_2MassTerm : Ball := ⟨0, 0⟩ +lemma CB1_4_3I2S0_2_2MassTerm_sound : CB1_4_3I2S0_2_2MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_4_3I2S0_2_2Value a))) := by + exact contains_sound (entropyTerm_ball (CB1_4_3I2S0_2_2Mass_sound) CB1_4_3I2S0_2_2MassTermLog_sound) (by decide +kernel) +def CB1_4_3I2S0_2_2H : Ball := ⟨(31531518366659865732438605272109 / 100000000000000000000000000000000), (4842512771 / 10000000000000000000000000000000)⟩ +lemma CB1_4_3I2S0_2_2H_sound : CB1_4_3I2S0_2_2H.Encloses (homogeneousEntropy CB1_4_3I2S0_2_2Value) := by + exact contains_sound (homogeneous_enclosed CB1_4_3I2S0_2_2Value CB1_4_3I2S0_2_2MassTerm_sound CB1_4_3I2S0_2_2Entropy_sound) (by decide +kernel) +def CB1_4_3I2S0_3_1Value (a : Fin 6) : ℝ := (littleLaw (shape 1 4 3) (shape 0 3 1) ((stageBPriority (shape 1 4 3)) 2) a : ℝ) +def CB1_4_3I2S0_3_1E_4Log : Ball := .exact 0 +lemma CB1_4_3I2S0_3_1E_4Log_sound : CB1_4_3I2S0_3_1E_4Log.Encloses (Real.log (CB1_4_3I2S0_3_1Value (4 : Fin 6))) := by + exact log_exact_one_ball ((B1_4_3Little_sound (shape 0 3 1) ((stageBPriority (shape 1 4 3)) 2)) (4 : Fin 6)) +def CB1_4_3I2S0_3_1E_4 : Ball := ⟨0, 0⟩ +lemma CB1_4_3I2S0_3_1E_4_sound : CB1_4_3I2S0_3_1E_4.Encloses (Foundation.entropyTerm (CB1_4_3I2S0_3_1Value (4 : Fin 6))) := by + exact contains_sound (entropyTerm_ball ((B1_4_3Little_sound (shape 0 3 1) ((stageBPriority (shape 1 4 3)) 2)) (4 : Fin 6)) CB1_4_3I2S0_3_1E_4Log_sound) (by decide +kernel) +def CB1_4_3I2S0_3_1Terms (a : Fin 6) : Ball := + match a.val with + | 4 => ⟨0, 0⟩ + | _ => (.exact 0) +lemma CB1_4_3I2S0_3_1Terms_sound (a : Fin 6) : + (CB1_4_3I2S0_3_1Terms a).Encloses (Foundation.entropyTerm (CB1_4_3I2S0_3_1Value a)) := by + fin_cases a + · exact (entropyTerm_zero_ball ((B1_4_3Little_sound (shape 0 3 1) ((stageBPriority (shape 1 4 3)) 2)) (0 : Fin 6))) + · exact (entropyTerm_zero_ball ((B1_4_3Little_sound (shape 0 3 1) ((stageBPriority (shape 1 4 3)) 2)) (1 : Fin 6))) + · exact (entropyTerm_zero_ball ((B1_4_3Little_sound (shape 0 3 1) ((stageBPriority (shape 1 4 3)) 2)) (2 : Fin 6))) + · exact (entropyTerm_zero_ball ((B1_4_3Little_sound (shape 0 3 1) ((stageBPriority (shape 1 4 3)) 2)) (3 : Fin 6))) + · exact CB1_4_3I2S0_3_1E_4_sound + · exact (entropyTerm_zero_ball ((B1_4_3Little_sound (shape 0 3 1) ((stageBPriority (shape 1 4 3)) 2)) (5 : Fin 6))) +def CB1_4_3I2S0_3_1Entropy : Ball := ⟨0, 0⟩ +lemma CB1_4_3I2S0_3_1Entropy_sound : CB1_4_3I2S0_3_1Entropy.Encloses (Foundation.finiteEntropy CB1_4_3I2S0_3_1Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_4_3I2S0_3_1Value CB1_4_3I2S0_3_1Terms CB1_4_3I2S0_3_1Terms_sound) (by decide +kernel) +def CB1_4_3I2S0_3_1Mass : Ball := ⟨1, 0⟩ +lemma CB1_4_3I2S0_3_1Mass_sound : CB1_4_3I2S0_3_1Mass.Encloses (∑ a, CB1_4_3I2S0_3_1Value a) := by + exact contains_sound (finSumBall_sound 6 (B1_4_3Little (shape 0 3 1) ((stageBPriority (shape 1 4 3)) 2)) CB1_4_3I2S0_3_1Value (B1_4_3Little_sound (shape 0 3 1) ((stageBPriority (shape 1 4 3)) 2))) (by decide +kernel) +def CB1_4_3I2S0_3_1MassTermLog : Ball := .exact 0 +lemma CB1_4_3I2S0_3_1MassTermLog_sound : CB1_4_3I2S0_3_1MassTermLog.Encloses (Real.log ((∑ a, CB1_4_3I2S0_3_1Value a))) := by + exact log_exact_one_ball (CB1_4_3I2S0_3_1Mass_sound) +def CB1_4_3I2S0_3_1MassTerm : Ball := ⟨0, 0⟩ +lemma CB1_4_3I2S0_3_1MassTerm_sound : CB1_4_3I2S0_3_1MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_4_3I2S0_3_1Value a))) := by + exact contains_sound (entropyTerm_ball (CB1_4_3I2S0_3_1Mass_sound) CB1_4_3I2S0_3_1MassTermLog_sound) (by decide +kernel) +def CB1_4_3I2S0_3_1H : Ball := ⟨0, 0⟩ +lemma CB1_4_3I2S0_3_1H_sound : CB1_4_3I2S0_3_1H.Encloses (homogeneousEntropy CB1_4_3I2S0_3_1Value) := by + exact contains_sound (homogeneous_enclosed CB1_4_3I2S0_3_1Value CB1_4_3I2S0_3_1MassTerm_sound CB1_4_3I2S0_3_1Entropy_sound) (by decide +kernel) +def CB1_4_3I2S0_4_0Value (a : Fin 6) : ℝ := (littleLaw (shape 1 4 3) (shape 0 4 0) ((stageBPriority (shape 1 4 3)) 2) a : ℝ) +def CB1_4_3I2S0_4_0E_5Log : Ball := .exact 0 +lemma CB1_4_3I2S0_4_0E_5Log_sound : CB1_4_3I2S0_4_0E_5Log.Encloses (Real.log (CB1_4_3I2S0_4_0Value (5 : Fin 6))) := by + exact log_exact_one_ball ((B1_4_3Little_sound (shape 0 4 0) ((stageBPriority (shape 1 4 3)) 2)) (5 : Fin 6)) +def CB1_4_3I2S0_4_0E_5 : Ball := ⟨0, 0⟩ +lemma CB1_4_3I2S0_4_0E_5_sound : CB1_4_3I2S0_4_0E_5.Encloses (Foundation.entropyTerm (CB1_4_3I2S0_4_0Value (5 : Fin 6))) := by + exact contains_sound (entropyTerm_ball ((B1_4_3Little_sound (shape 0 4 0) ((stageBPriority (shape 1 4 3)) 2)) (5 : Fin 6)) CB1_4_3I2S0_4_0E_5Log_sound) (by decide +kernel) +def CB1_4_3I2S0_4_0Terms (a : Fin 6) : Ball := + match a.val with + | 5 => ⟨0, 0⟩ + | _ => (.exact 0) +lemma CB1_4_3I2S0_4_0Terms_sound (a : Fin 6) : + (CB1_4_3I2S0_4_0Terms a).Encloses (Foundation.entropyTerm (CB1_4_3I2S0_4_0Value a)) := by + fin_cases a + · exact (entropyTerm_zero_ball ((B1_4_3Little_sound (shape 0 4 0) ((stageBPriority (shape 1 4 3)) 2)) (0 : Fin 6))) + · exact (entropyTerm_zero_ball ((B1_4_3Little_sound (shape 0 4 0) ((stageBPriority (shape 1 4 3)) 2)) (1 : Fin 6))) + · exact (entropyTerm_zero_ball ((B1_4_3Little_sound (shape 0 4 0) ((stageBPriority (shape 1 4 3)) 2)) (2 : Fin 6))) + · exact (entropyTerm_zero_ball ((B1_4_3Little_sound (shape 0 4 0) ((stageBPriority (shape 1 4 3)) 2)) (3 : Fin 6))) + · exact (entropyTerm_zero_ball ((B1_4_3Little_sound (shape 0 4 0) ((stageBPriority (shape 1 4 3)) 2)) (4 : Fin 6))) + · exact CB1_4_3I2S0_4_0E_5_sound +def CB1_4_3I2S0_4_0Entropy : Ball := ⟨0, 0⟩ +lemma CB1_4_3I2S0_4_0Entropy_sound : CB1_4_3I2S0_4_0Entropy.Encloses (Foundation.finiteEntropy CB1_4_3I2S0_4_0Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_4_3I2S0_4_0Value CB1_4_3I2S0_4_0Terms CB1_4_3I2S0_4_0Terms_sound) (by decide +kernel) +def CB1_4_3I2S0_4_0Mass : Ball := ⟨1, 0⟩ +lemma CB1_4_3I2S0_4_0Mass_sound : CB1_4_3I2S0_4_0Mass.Encloses (∑ a, CB1_4_3I2S0_4_0Value a) := by + exact contains_sound (finSumBall_sound 6 (B1_4_3Little (shape 0 4 0) ((stageBPriority (shape 1 4 3)) 2)) CB1_4_3I2S0_4_0Value (B1_4_3Little_sound (shape 0 4 0) ((stageBPriority (shape 1 4 3)) 2))) (by decide +kernel) +def CB1_4_3I2S0_4_0MassTermLog : Ball := .exact 0 +lemma CB1_4_3I2S0_4_0MassTermLog_sound : CB1_4_3I2S0_4_0MassTermLog.Encloses (Real.log ((∑ a, CB1_4_3I2S0_4_0Value a))) := by + exact log_exact_one_ball (CB1_4_3I2S0_4_0Mass_sound) +def CB1_4_3I2S0_4_0MassTerm : Ball := ⟨0, 0⟩ +lemma CB1_4_3I2S0_4_0MassTerm_sound : CB1_4_3I2S0_4_0MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_4_3I2S0_4_0Value a))) := by + exact contains_sound (entropyTerm_ball (CB1_4_3I2S0_4_0Mass_sound) CB1_4_3I2S0_4_0MassTermLog_sound) (by decide +kernel) +def CB1_4_3I2S0_4_0H : Ball := ⟨0, 0⟩ +lemma CB1_4_3I2S0_4_0H_sound : CB1_4_3I2S0_4_0H.Encloses (homogeneousEntropy CB1_4_3I2S0_4_0Value) := by + exact contains_sound (homogeneous_enclosed CB1_4_3I2S0_4_0Value CB1_4_3I2S0_4_0MassTerm_sound CB1_4_3I2S0_4_0Entropy_sound) (by decide +kernel) +def CB1_4_3I2S1_3_0Value (a : Fin 6) : ℝ := (littleLaw (shape 1 4 3) (shape 1 3 0) ((stageBPriority (shape 1 4 3)) 2) a : ℝ) +def CB1_4_3I2S1_3_0E_4Log : Ball := .exact 0 +lemma CB1_4_3I2S1_3_0E_4Log_sound : CB1_4_3I2S1_3_0E_4Log.Encloses (Real.log (CB1_4_3I2S1_3_0Value (4 : Fin 6))) := by + exact log_exact_one_ball ((B1_4_3Little_sound (shape 1 3 0) ((stageBPriority (shape 1 4 3)) 2)) (4 : Fin 6)) +def CB1_4_3I2S1_3_0E_4 : Ball := ⟨0, 0⟩ +lemma CB1_4_3I2S1_3_0E_4_sound : CB1_4_3I2S1_3_0E_4.Encloses (Foundation.entropyTerm (CB1_4_3I2S1_3_0Value (4 : Fin 6))) := by + exact contains_sound (entropyTerm_ball ((B1_4_3Little_sound (shape 1 3 0) ((stageBPriority (shape 1 4 3)) 2)) (4 : Fin 6)) CB1_4_3I2S1_3_0E_4Log_sound) (by decide +kernel) +def CB1_4_3I2S1_3_0Terms (a : Fin 6) : Ball := + match a.val with + | 4 => ⟨0, 0⟩ + | _ => (.exact 0) +lemma CB1_4_3I2S1_3_0Terms_sound (a : Fin 6) : + (CB1_4_3I2S1_3_0Terms a).Encloses (Foundation.entropyTerm (CB1_4_3I2S1_3_0Value a)) := by + fin_cases a + · exact (entropyTerm_zero_ball ((B1_4_3Little_sound (shape 1 3 0) ((stageBPriority (shape 1 4 3)) 2)) (0 : Fin 6))) + · exact (entropyTerm_zero_ball ((B1_4_3Little_sound (shape 1 3 0) ((stageBPriority (shape 1 4 3)) 2)) (1 : Fin 6))) + · exact (entropyTerm_zero_ball ((B1_4_3Little_sound (shape 1 3 0) ((stageBPriority (shape 1 4 3)) 2)) (2 : Fin 6))) + · exact (entropyTerm_zero_ball ((B1_4_3Little_sound (shape 1 3 0) ((stageBPriority (shape 1 4 3)) 2)) (3 : Fin 6))) + · exact CB1_4_3I2S1_3_0E_4_sound + · exact (entropyTerm_zero_ball ((B1_4_3Little_sound (shape 1 3 0) ((stageBPriority (shape 1 4 3)) 2)) (5 : Fin 6))) +def CB1_4_3I2S1_3_0Entropy : Ball := ⟨0, 0⟩ +lemma CB1_4_3I2S1_3_0Entropy_sound : CB1_4_3I2S1_3_0Entropy.Encloses (Foundation.finiteEntropy CB1_4_3I2S1_3_0Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_4_3I2S1_3_0Value CB1_4_3I2S1_3_0Terms CB1_4_3I2S1_3_0Terms_sound) (by decide +kernel) +def CB1_4_3I2S1_3_0Mass : Ball := ⟨1, 0⟩ +lemma CB1_4_3I2S1_3_0Mass_sound : CB1_4_3I2S1_3_0Mass.Encloses (∑ a, CB1_4_3I2S1_3_0Value a) := by + exact contains_sound (finSumBall_sound 6 (B1_4_3Little (shape 1 3 0) ((stageBPriority (shape 1 4 3)) 2)) CB1_4_3I2S1_3_0Value (B1_4_3Little_sound (shape 1 3 0) ((stageBPriority (shape 1 4 3)) 2))) (by decide +kernel) +def CB1_4_3I2S1_3_0MassTermLog : Ball := .exact 0 +lemma CB1_4_3I2S1_3_0MassTermLog_sound : CB1_4_3I2S1_3_0MassTermLog.Encloses (Real.log ((∑ a, CB1_4_3I2S1_3_0Value a))) := by + exact log_exact_one_ball (CB1_4_3I2S1_3_0Mass_sound) +def CB1_4_3I2S1_3_0MassTerm : Ball := ⟨0, 0⟩ +lemma CB1_4_3I2S1_3_0MassTerm_sound : CB1_4_3I2S1_3_0MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_4_3I2S1_3_0Value a))) := by + exact contains_sound (entropyTerm_ball (CB1_4_3I2S1_3_0Mass_sound) CB1_4_3I2S1_3_0MassTermLog_sound) (by decide +kernel) +def CB1_4_3I2S1_3_0H : Ball := ⟨0, 0⟩ +lemma CB1_4_3I2S1_3_0H_sound : CB1_4_3I2S1_3_0H.Encloses (homogeneousEntropy CB1_4_3I2S1_3_0Value) := by + exact contains_sound (homogeneous_enclosed CB1_4_3I2S1_3_0Value CB1_4_3I2S1_3_0MassTerm_sound CB1_4_3I2S1_3_0Entropy_sound) (by decide +kernel) +def CB1_4_3I2Singles (s : Shape) : Ball := + match s 0, s 1, s 2 with + | 0, 1, 3 => CB1_4_3I2S0_1_3H + | 0, 2, 2 => CB1_4_3I2S0_2_2H + | 0, 3, 1 => CB1_4_3I2S0_3_1H + | 0, 4, 0 => CB1_4_3I2S0_4_0H + | 1, 3, 0 => CB1_4_3I2S1_3_0H + | _, _, _ => (.exact 0) +lemma CB1_4_3I2Singles_sound (u : Shape) (hu : u ∈ below (shape 1 4 3)) + (hd : designated (stageBPriority (shape 1 4 3)) 2 u) : + (CB1_4_3I2Singles u).Encloses (homogeneousEntropy ((fun u a => (littleLaw (shape 1 4 3) u ((stageBPriority (shape 1 4 3)) 2) a : ℝ)) u)) := by + rw [B1_4_3_below] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl + · exact CB1_4_3I2S0_1_3H_sound + · exact CB1_4_3I2S0_2_2H_sound + · exact CB1_4_3I2S0_3_1H_sound + · exact CB1_4_3I2S0_4_0H_sound + · exact (show ¬ designated (stageBPriority (shape 1 4 3)) 2 (shape 1 0 3) by decide +kernel) hd |>.elim + · exact (show ¬ designated (stageBPriority (shape 1 4 3)) 2 (shape 1 1 2) by decide +kernel) hd |>.elim + · exact (show ¬ designated (stageBPriority (shape 1 4 3)) 2 (shape 1 2 1) by decide +kernel) hd |>.elim + · exact CB1_4_3I2S1_3_0H_sound +def CB1_4_3I2Singleton : Ball := ⟨(2654982546330514860850858021989 / 20000000000000000000000000000000), (1274199947 / 6250000000000000000000000000000)⟩ +lemma CB1_4_3I2Singleton_sound : CB1_4_3I2Singleton.Encloses + (singletonEntropy (below (shape 1 4 3)) (fun u => (stageBLaw (shape 1 4 3) u : ℝ)) (stageBPriority (shape 1 4 3)) 2 (fun u a => (littleLaw (shape 1 4 3) u ((stageBPriority (shape 1 4 3)) 2) a : ℝ))) := by + exact contains_sound (singletonBall_sound (below (shape 1 4 3)) B1_4_3Law (fun u => (stageBLaw (shape 1 4 3) u : ℝ)) (stageBPriority (shape 1 4 3)) 2 + CB1_4_3I2Singles (fun u a => (littleLaw (shape 1 4 3) u ((stageBPriority (shape 1 4 3)) 2) a : ℝ)) (fun u _ => B1_4_3Law_sound u) CB1_4_3I2Singles_sound) (by decide +kernel) +def CB1_4_3I2Group : Ball := ⟨(2829727512837008498339295078037 / 20000000000000000000000000000000), (88243521843 / 100000000000000000000000000000000)⟩ +lemma CB1_4_3I2Group_sound : CB1_4_3I2Group.Encloses + (groupedEntropy (below (shape 1 4 3)) (fun u => (stageBLaw (shape 1 4 3) u : ℝ)) (stageBPriority (shape 1 4 3)) 2 (fun u a => (littleLaw (shape 1 4 3) u ((stageBPriority (shape 1 4 3)) 2) a : ℝ))) := by + exact contains_sound (Ball.add_sound CB1_4_3I2Singleton_sound + (finSumBall_sound 17 CB1_4_3I2ResidualEntropies _ CB1_4_3I2ResidualEntropies_sound)) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CB1_4_3I2H : Ball := ⟨(14919945913031360053984414072733 / 25000000000000000000000000000000), (32152112867 / 12500000000000000000000000000000)⟩ +lemma CB1_4_3I2_sound : CB1_4_3I2H.Encloses (stageBCapacity (shape 1 4 3) 2) := by + have hb := contains_sound (Ball.add_sound CB1_4_3I2PairH_sound + (Ball.neg_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) CB1_4_3I2Group_sound))) + (show contains (.add CB1_4_3I2PairH (.neg (.mul (.exact 2) CB1_4_3I2Group))) CB1_4_3I2H = true by decide +kernel) + unfold CB1_4_3I2PairValue at hb + simpa only [stageBCapacity, nativeCapacity, + show (2 : Fin 3) ≠ 0 by decide, ite_false, sub_eq_add_neg] using hb + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/CapacityB/CapB1_5_2I0.lean b/lean/OAI/LinearAlgebra/MatrixFields/CapacityB/CapB1_5_2I0.lean new file mode 100644 index 0000000000000000000000000000000000000000..a5b36e511e17b8189fe6f6d758ebd44bbd7d6f88 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/CapacityB/CapB1_5_2I0.lean @@ -0,0 +1,72 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Certificates.SplitB5_1_2 + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CB1_5_2I0Value (a : Fin 17) : ℝ := marginal (below (shape 1 5 2)) (fun u => (stageBLaw (shape 1 5 2) u : ℝ)) ((stageBPriority (shape 1 5 2)) 0) a +def CB1_5_2I0Raw (a : Fin 17) : Ball := marginalBall (below (shape 1 5 2)) B1_5_2Law ((stageBPriority (shape 1 5 2)) 0) a +lemma CB1_5_2I0Raw_sound (a : Fin 17) : + (CB1_5_2I0Raw a).Encloses (CB1_5_2I0Value a) := by + exact marginalBall_sound (below (shape 1 5 2)) B1_5_2Law (fun u => (stageBLaw (shape 1 5 2) u : ℝ)) (fun u _ => B1_5_2Law_sound u) ((stageBPriority (shape 1 5 2)) 0) a +def CB1_5_2I0Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(1 / 2), (51 / 100000000000000000000000000000000)⟩ ⟨(6931471805599453094172319305033 / 20000000000000000000000000000000), (21175823769 / 100000000000000000000000000000000)⟩ ⟨(-6931471805599453094172319305033 / 10000000000000000000000000000000), (42351647467 / 100000000000000000000000000000000)⟩ ⟨-1, 1, 1⟩] +lemma CB1_5_2I0Certificates_valid : + CB1_5_2I0Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_5_2I0CertificateIndex (a : Fin 17) : ℕ := + match a.val with + | 0 => 1 + | 1 => 1 + | _ => 0 +def CB1_5_2I0P (a : Fin 17) : Ball := + (CompactCertificate.entropyLookup CB1_5_2I0Certificates (CB1_5_2I0CertificateIndex a)).input +lemma CB1_5_2I0P_check : ∀ a : Fin 17, contains (CB1_5_2I0Raw a) (CB1_5_2I0P a) = true := by + decide +kernel +lemma CB1_5_2I0P_sound (a : Fin 17) : + (CB1_5_2I0P a).Encloses (CB1_5_2I0Value a) := + contains_sound (CB1_5_2I0Raw_sound a) (CB1_5_2I0P_check a) +def CB1_5_2I0Terms (a : Fin 17) : Ball := + (CompactCertificate.entropyLookup CB1_5_2I0Certificates (CB1_5_2I0CertificateIndex a)).output +lemma CB1_5_2I0Terms_sound (a : Fin 17) : + (CB1_5_2I0Terms a).Encloses (Foundation.entropyTerm (CB1_5_2I0Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_5_2I0Certificates_valid + (CB1_5_2I0CertificateIndex a) (CB1_5_2I0P_sound a) +def CB1_5_2I0Entropy : Ball := ⟨(6931471805599453094172319305033 / 10000000000000000000000000000000), (21175823769 / 50000000000000000000000000000000)⟩ +lemma CB1_5_2I0Entropy_sound : CB1_5_2I0Entropy.Encloses (Foundation.finiteEntropy CB1_5_2I0Value) := by + exact contains_sound (entropyFin_enclosed 17 CB1_5_2I0Value CB1_5_2I0Terms CB1_5_2I0Terms_sound) (by decide +kernel) +def CB1_5_2I0Mass : Ball := ⟨1, (51 / 50000000000000000000000000000000)⟩ +lemma CB1_5_2I0Mass_sound : CB1_5_2I0Mass.Encloses (∑ a, CB1_5_2I0Value a) := by + exact contains_sound (finSumBall_sound 17 CB1_5_2I0P CB1_5_2I0Value CB1_5_2I0P_sound) (by decide +kernel) +def CB1_5_2I0MassTermLogWitness : LogWitness := ⟨0, 1, 1⟩ +def CB1_5_2I0MassTermLog : Ball := ⟨0, (2646977973 / 12500000000000000000000000000000)⟩ +lemma CB1_5_2I0MassTermLog_sound : CB1_5_2I0MassTermLog.Encloses (Real.log ((∑ a, CB1_5_2I0Value a))) := by + exact checkLog_sound logTwoBall_sound (CB1_5_2I0Mass_sound) (w := CB1_5_2I0MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB1_5_2I0MassTerm : Ball := ⟨0, (4235164757 / 20000000000000000000000000000000)⟩ +lemma CB1_5_2I0MassTerm_sound : CB1_5_2I0MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_5_2I0Value a))) := by + exact contains_sound (entropyTerm_ball (CB1_5_2I0Mass_sound) CB1_5_2I0MassTermLog_sound) (by decide +kernel) +def CB1_5_2I0H : Ball := ⟨(6931471805599453094172319305033 / 10000000000000000000000000000000), (63527471323 / 100000000000000000000000000000000)⟩ +lemma CB1_5_2I0H_sound : CB1_5_2I0H.Encloses (homogeneousEntropy CB1_5_2I0Value) := by + exact contains_sound (homogeneous_enclosed CB1_5_2I0Value CB1_5_2I0MassTerm_sound CB1_5_2I0Entropy_sound) (by decide +kernel) +lemma CB1_5_2I0_sound : CB1_5_2I0H.Encloses (stageBCapacity (shape 1 5 2) 0) := by + exact CB1_5_2I0H_sound + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/CapacityB/CapB1_5_2I1.lean b/lean/OAI/LinearAlgebra/MatrixFields/CapacityB/CapB1_5_2I1.lean new file mode 100644 index 0000000000000000000000000000000000000000..f701d4065e5e490274da94f8d3ca5c446a57132b --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/CapacityB/CapB1_5_2I1.lean @@ -0,0 +1,841 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Certificates.LittleB1_5_2 + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CB1_5_2I1PairValue (a : PairSlot) : ℝ := pairLaw (below (shape 1 5 2)) (shape 1 5 2) (fun u => (stageBLaw (shape 1 5 2) u : ℝ)) (fun u a => (littleLaw (shape 1 5 2) u ((stageBPriority (shape 1 5 2)) 1) a : ℝ)) a +def CB1_5_2I1PairRaw (a : PairSlot) : Ball := pairLawBall (below (shape 1 5 2)) (shape 1 5 2) B1_5_2Law (fun u => B1_5_2Little u ((stageBPriority (shape 1 5 2)) 1)) a +lemma CB1_5_2I1PairRaw_sound (a : PairSlot) : + (CB1_5_2I1PairRaw a).Encloses (CB1_5_2I1PairValue a) := by + exact pairLawBall_sound_on (below (shape 1 5 2)) (shape 1 5 2) B1_5_2Law (fun u => (stageBLaw (shape 1 5 2) u : ℝ)) (fun u => B1_5_2Little u ((stageBPriority (shape 1 5 2)) 1)) (fun u a => (littleLaw (shape 1 5 2) u ((stageBPriority (shape 1 5 2)) 1) a : ℝ)) (fun u _ => B1_5_2Law_sound u) (fun u _ a => B1_5_2Little_sound u ((stageBPriority (shape 1 5 2)) 1) a) (fun u _ a => B1_5_2Little_sound (complement (shape 1 5 2) u) ((stageBPriority (shape 1 5 2)) 1) a) a +def CB1_5_2I1PairCertificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(2064129144151554264168571077709 / 12500000000000000000000000000000), (1 / 3125000000000000000000000000000)⟩ ⟨(2974030674787114601029918237033 / 10000000000000000000000000000000), (13987083231 / 100000000000000000000000000000000)⟩ ⟨(-90051011440274033448705369701257 / 50000000000000000000000000000000), (3388131797 / 4000000000000000000000000000000)⟩ ⟨-3, 2064129144151554264168571077709, 1562500000000000000000000000000⟩, + .log ⟨(1985286600756920686097122080759 / 100000000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ ⟨(7781145999535342779622853406189 / 100000000000000000000000000000000), (183925347 / 6250000000000000000000000000000)⟩ ⟨(-391940689901833952867263505943723 / 100000000000000000000000000000000), (74115382991 / 50000000000000000000000000000000)⟩ ⟨-6, 1985286600756920686097122080759, 1562500000000000000000000000000⟩, + .log ⟨(31501680246030645200554309297569 / 50000000000000000000000000000000), (1 / 3125000000000000000000000000000)⟩ ⟨(29106426039391263700905778712527 / 100000000000000000000000000000000), (26682961111 / 100000000000000000000000000000000)⟩ ⟨(-46198211987531689822285187163589 / 100000000000000000000000000000000), (5293955927 / 12500000000000000000000000000000)⟩ ⟨-1, 31501680246030645200554309297569, 25000000000000000000000000000000⟩] +lemma CB1_5_2I1PairCertificates_valid : + CB1_5_2I1PairCertificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_5_2I1PairCertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 2, 0 => 1 + | 3, 0 => 2 + | 1, 1 => 3 + | 0, 2 => 1 + | 0, 3 => 2 + | _, _ => 0 +def CB1_5_2I1PairP (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CB1_5_2I1PairCertificates (CB1_5_2I1PairCertificateIndex a)).input +lemma CB1_5_2I1PairP_check : ∀ a : PairSlot, contains (CB1_5_2I1PairRaw a) (CB1_5_2I1PairP a) = true := by + decide +kernel +lemma CB1_5_2I1PairP_sound (a : PairSlot) : + (CB1_5_2I1PairP a).Encloses (CB1_5_2I1PairValue a) := + contains_sound (CB1_5_2I1PairRaw_sound a) (CB1_5_2I1PairP_check a) +def CB1_5_2I1PairTerms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CB1_5_2I1PairCertificates (CB1_5_2I1PairCertificateIndex a)).output +lemma CB1_5_2I1PairTerms_sound (a : PairSlot) : + (CB1_5_2I1PairTerms a).Encloses (Foundation.entropyTerm (CB1_5_2I1PairValue a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_5_2I1PairCertificates_valid + (CB1_5_2I1PairCertificateIndex a) (CB1_5_2I1PairP_sound a) +def CB1_5_2I1PairEntropy : Ball := ⟨(20829866306840848256149970053113 / 20000000000000000000000000000000), (60542738677 / 100000000000000000000000000000000)⟩ +lemma CB1_5_2I1PairEntropy_sound : CB1_5_2I1PairEntropy.Encloses (Foundation.finiteEntropy CB1_5_2I1PairValue) := by + exact contains_sound (entropyPair_enclosed CB1_5_2I1PairValue CB1_5_2I1PairTerms CB1_5_2I1PairTerms_sound) (by decide +kernel) +def CB1_5_2I1PairMass : Ball := ⟨1, (13 / 12500000000000000000000000000000)⟩ +lemma CB1_5_2I1PairMass_sound : CB1_5_2I1PairMass.Encloses (∑ a, CB1_5_2I1PairValue a) := by + exact contains_sound (pairSumBall_sound CB1_5_2I1PairP CB1_5_2I1PairValue CB1_5_2I1PairP_sound) (by decide +kernel) +def CB1_5_2I1PairMassTermLogWitness : LogWitness := ⟨0, 1, 1⟩ +def CB1_5_2I1PairMassTermLog : Ball := ⟨0, (10587911893 / 50000000000000000000000000000000)⟩ +lemma CB1_5_2I1PairMassTermLog_sound : CB1_5_2I1PairMassTermLog.Encloses (Real.log ((∑ a, CB1_5_2I1PairValue a))) := by + exact checkLog_sound logTwoBall_sound (CB1_5_2I1PairMass_sound) (w := CB1_5_2I1PairMassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB1_5_2I1PairMassTerm : Ball := ⟨0, (21175823787 / 100000000000000000000000000000000)⟩ +lemma CB1_5_2I1PairMassTerm_sound : CB1_5_2I1PairMassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_5_2I1PairValue a))) := by + exact contains_sound (entropyTerm_ball (CB1_5_2I1PairMass_sound) CB1_5_2I1PairMassTermLog_sound) (by decide +kernel) +def CB1_5_2I1PairH : Ball := ⟨(20829866306840848256149970053113 / 20000000000000000000000000000000), (2553705077 / 3125000000000000000000000000000)⟩ +lemma CB1_5_2I1PairH_sound : CB1_5_2I1PairH.Encloses (homogeneousEntropy CB1_5_2I1PairValue) := by + exact contains_sound (homogeneous_enclosed CB1_5_2I1PairValue CB1_5_2I1PairMassTerm_sound CB1_5_2I1PairEntropy_sound) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CB1_5_2I1R0Value (a : Fin 6) : ℝ := residualLaw (below (shape 1 5 2)) (fun u => (stageBLaw (shape 1 5 2) u : ℝ)) (stageBPriority (shape 1 5 2)) 1 (fun u a => (littleLaw (shape 1 5 2) u ((stageBPriority (shape 1 5 2)) 1) a : ℝ)) 0 a +def CB1_5_2I1R0Raw (a : Fin 6) : Ball := residualBall (below (shape 1 5 2)) B1_5_2Law (stageBPriority (shape 1 5 2)) 1 (fun u => B1_5_2Little u ((stageBPriority (shape 1 5 2)) 1)) 0 a +lemma CB1_5_2I1R0Raw_sound (a : Fin 6) : + (CB1_5_2I1R0Raw a).Encloses (CB1_5_2I1R0Value a) := by + exact residualBall_sound_on (below (shape 1 5 2)) B1_5_2Law (fun u => (stageBLaw (shape 1 5 2) u : ℝ)) (stageBPriority (shape 1 5 2)) 1 (fun u => B1_5_2Little u ((stageBPriority (shape 1 5 2)) 1)) (fun u a => (littleLaw (shape 1 5 2) u ((stageBPriority (shape 1 5 2)) 1) a : ℝ)) (fun u _ => B1_5_2Law_sound u) (fun u _ a => B1_5_2Little_sound u ((stageBPriority (shape 1 5 2)) 1) a) 0 a +def CB1_5_2I1R0Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(18498319753969354799445690702431 / 100000000000000000000000000000000), (7 / 20000000000000000000000000000000)⟩ ⟨(31215734820710901625169931976881 / 100000000000000000000000000000000), (3917171599 / 25000000000000000000000000000000)⟩ ⟨(-5273407131682300154373846080691 / 3125000000000000000000000000000), (84703294921 / 100000000000000000000000000000000)⟩ ⟨-3, 18498319753969354799445690702431, 12500000000000000000000000000000⟩] +lemma CB1_5_2I1R0Certificates_valid : + CB1_5_2I1R0Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_5_2I1R0CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | 0 => 1 + | _ => 0 +def CB1_5_2I1R0P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_5_2I1R0Certificates (CB1_5_2I1R0CertificateIndex a)).input +lemma CB1_5_2I1R0P_check : ∀ a : Fin 6, contains (CB1_5_2I1R0Raw a) (CB1_5_2I1R0P a) = true := by + decide +kernel +lemma CB1_5_2I1R0P_sound (a : Fin 6) : + (CB1_5_2I1R0P a).Encloses (CB1_5_2I1R0Value a) := + contains_sound (CB1_5_2I1R0Raw_sound a) (CB1_5_2I1R0P_check a) +def CB1_5_2I1R0Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_5_2I1R0Certificates (CB1_5_2I1R0CertificateIndex a)).output +lemma CB1_5_2I1R0Terms_sound (a : Fin 6) : + (CB1_5_2I1R0Terms a).Encloses (Foundation.entropyTerm (CB1_5_2I1R0Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_5_2I1R0Certificates_valid + (CB1_5_2I1R0CertificateIndex a) (CB1_5_2I1R0P_sound a) +def CB1_5_2I1R0Entropy : Ball := ⟨(31215734820710901625169931976881 / 100000000000000000000000000000000), (3917171599 / 25000000000000000000000000000000)⟩ +lemma CB1_5_2I1R0Entropy_sound : CB1_5_2I1R0Entropy.Encloses (Foundation.finiteEntropy CB1_5_2I1R0Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_5_2I1R0Value CB1_5_2I1R0Terms CB1_5_2I1R0Terms_sound) (by decide +kernel) +def CB1_5_2I1R0Mass : Ball := ⟨(18498319753969354799445690702431 / 100000000000000000000000000000000), (7 / 20000000000000000000000000000000)⟩ +lemma CB1_5_2I1R0Mass_sound : CB1_5_2I1R0Mass.Encloses (∑ a, CB1_5_2I1R0Value a) := by + exact contains_sound (finSumBall_sound 6 CB1_5_2I1R0P CB1_5_2I1R0Value CB1_5_2I1R0P_sound) (by decide +kernel) +def CB1_5_2I1R0MassTermLogWitness : LogWitness := ⟨-3, 18498319753969354799445690702431, 12500000000000000000000000000000⟩ +def CB1_5_2I1R0MassTermLog : Ball := ⟨(-5273407131682300154373846080691 / 3125000000000000000000000000000), (84703294921 / 100000000000000000000000000000000)⟩ +lemma CB1_5_2I1R0MassTermLog_sound : CB1_5_2I1R0MassTermLog.Encloses (Real.log ((∑ a, CB1_5_2I1R0Value a))) := by + exact checkLog_sound logTwoBall_sound (CB1_5_2I1R0Mass_sound) (w := CB1_5_2I1R0MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB1_5_2I1R0MassTerm : Ball := ⟨(31215734820710901625169931976881 / 100000000000000000000000000000000), (3917171599 / 25000000000000000000000000000000)⟩ +lemma CB1_5_2I1R0MassTerm_sound : CB1_5_2I1R0MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_5_2I1R0Value a))) := by + exact contains_sound (entropyTerm_ball (CB1_5_2I1R0Mass_sound) CB1_5_2I1R0MassTermLog_sound) (by decide +kernel) +def CB1_5_2I1R0H : Ball := ⟨0, (3917171599 / 12500000000000000000000000000000)⟩ +lemma CB1_5_2I1R0H_sound : CB1_5_2I1R0H.Encloses (homogeneousEntropy CB1_5_2I1R0Value) := by + exact contains_sound (homogeneous_enclosed CB1_5_2I1R0Value CB1_5_2I1R0MassTerm_sound CB1_5_2I1R0Entropy_sound) (by decide +kernel) +def CB1_5_2I1R1Value (a : Fin 6) : ℝ := residualLaw (below (shape 1 5 2)) (fun u => (stageBLaw (shape 1 5 2) u : ℝ)) (stageBPriority (shape 1 5 2)) 1 (fun u a => (littleLaw (shape 1 5 2) u ((stageBPriority (shape 1 5 2)) 1) a : ℝ)) 1 a +def CB1_5_2I1R1Raw (a : Fin 6) : Ball := residualBall (below (shape 1 5 2)) B1_5_2Law (stageBPriority (shape 1 5 2)) 1 (fun u => B1_5_2Little u ((stageBPriority (shape 1 5 2)) 1)) 1 a +lemma CB1_5_2I1R1Raw_sound (a : Fin 6) : + (CB1_5_2I1R1Raw a).Encloses (CB1_5_2I1R1Value a) := by + exact residualBall_sound_on (below (shape 1 5 2)) B1_5_2Law (fun u => (stageBLaw (shape 1 5 2) u : ℝ)) (stageBPriority (shape 1 5 2)) 1 (fun u => B1_5_2Little u ((stageBPriority (shape 1 5 2)) 1)) (fun u a => (littleLaw (shape 1 5 2) u ((stageBPriority (shape 1 5 2)) 1) a : ℝ)) (fun u _ => B1_5_2Law_sound u) (fun u _ a => B1_5_2Little_sound u ((stageBPriority (shape 1 5 2)) 1) a) 1 a +def CB1_5_2I1R1Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(31501680246030645200554309297569 / 50000000000000000000000000000000), (1 / 3125000000000000000000000000000)⟩ ⟨(29106426039391263700905778712527 / 100000000000000000000000000000000), (26682961111 / 100000000000000000000000000000000)⟩ ⟨(-46198211987531689822285187163589 / 100000000000000000000000000000000), (5293955927 / 12500000000000000000000000000000)⟩ ⟨-1, 31501680246030645200554309297569, 25000000000000000000000000000000⟩] +lemma CB1_5_2I1R1Certificates_valid : + CB1_5_2I1R1Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_5_2I1R1CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | 1 => 1 + | _ => 0 +def CB1_5_2I1R1P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_5_2I1R1Certificates (CB1_5_2I1R1CertificateIndex a)).input +lemma CB1_5_2I1R1P_check : ∀ a : Fin 6, contains (CB1_5_2I1R1Raw a) (CB1_5_2I1R1P a) = true := by + decide +kernel +lemma CB1_5_2I1R1P_sound (a : Fin 6) : + (CB1_5_2I1R1P a).Encloses (CB1_5_2I1R1Value a) := + contains_sound (CB1_5_2I1R1Raw_sound a) (CB1_5_2I1R1P_check a) +def CB1_5_2I1R1Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_5_2I1R1Certificates (CB1_5_2I1R1CertificateIndex a)).output +lemma CB1_5_2I1R1Terms_sound (a : Fin 6) : + (CB1_5_2I1R1Terms a).Encloses (Foundation.entropyTerm (CB1_5_2I1R1Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_5_2I1R1Certificates_valid + (CB1_5_2I1R1CertificateIndex a) (CB1_5_2I1R1P_sound a) +def CB1_5_2I1R1Entropy : Ball := ⟨(29106426039391263700905778712527 / 100000000000000000000000000000000), (26682961111 / 100000000000000000000000000000000)⟩ +lemma CB1_5_2I1R1Entropy_sound : CB1_5_2I1R1Entropy.Encloses (Foundation.finiteEntropy CB1_5_2I1R1Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_5_2I1R1Value CB1_5_2I1R1Terms CB1_5_2I1R1Terms_sound) (by decide +kernel) +def CB1_5_2I1R1Mass : Ball := ⟨(31501680246030645200554309297569 / 50000000000000000000000000000000), (1 / 3125000000000000000000000000000)⟩ +lemma CB1_5_2I1R1Mass_sound : CB1_5_2I1R1Mass.Encloses (∑ a, CB1_5_2I1R1Value a) := by + exact contains_sound (finSumBall_sound 6 CB1_5_2I1R1P CB1_5_2I1R1Value CB1_5_2I1R1P_sound) (by decide +kernel) +def CB1_5_2I1R1MassTermLogWitness : LogWitness := ⟨-1, 31501680246030645200554309297569, 25000000000000000000000000000000⟩ +def CB1_5_2I1R1MassTermLog : Ball := ⟨(-46198211987531689822285187163589 / 100000000000000000000000000000000), (5293955927 / 12500000000000000000000000000000)⟩ +lemma CB1_5_2I1R1MassTermLog_sound : CB1_5_2I1R1MassTermLog.Encloses (Real.log ((∑ a, CB1_5_2I1R1Value a))) := by + exact checkLog_sound logTwoBall_sound (CB1_5_2I1R1Mass_sound) (w := CB1_5_2I1R1MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB1_5_2I1R1MassTerm : Ball := ⟨(29106426039391263700905778712527 / 100000000000000000000000000000000), (26682961111 / 100000000000000000000000000000000)⟩ +lemma CB1_5_2I1R1MassTerm_sound : CB1_5_2I1R1MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_5_2I1R1Value a))) := by + exact contains_sound (entropyTerm_ball (CB1_5_2I1R1Mass_sound) CB1_5_2I1R1MassTermLog_sound) (by decide +kernel) +def CB1_5_2I1R1H : Ball := ⟨0, (26682961111 / 50000000000000000000000000000000)⟩ +lemma CB1_5_2I1R1H_sound : CB1_5_2I1R1H.Encloses (homogeneousEntropy CB1_5_2I1R1Value) := by + exact contains_sound (homogeneous_enclosed CB1_5_2I1R1Value CB1_5_2I1R1MassTerm_sound CB1_5_2I1R1Entropy_sound) (by decide +kernel) +def CB1_5_2I1R2Value (a : Fin 6) : ℝ := residualLaw (below (shape 1 5 2)) (fun u => (stageBLaw (shape 1 5 2) u : ℝ)) (stageBPriority (shape 1 5 2)) 1 (fun u a => (littleLaw (shape 1 5 2) u ((stageBPriority (shape 1 5 2)) 1) a : ℝ)) 2 a +def CB1_5_2I1R2Raw (a : Fin 6) : Ball := residualBall (below (shape 1 5 2)) B1_5_2Law (stageBPriority (shape 1 5 2)) 1 (fun u => B1_5_2Little u ((stageBPriority (shape 1 5 2)) 1)) 2 a +lemma CB1_5_2I1R2Raw_sound (a : Fin 6) : + (CB1_5_2I1R2Raw a).Encloses (CB1_5_2I1R2Value a) := by + exact residualBall_sound_on (below (shape 1 5 2)) B1_5_2Law (fun u => (stageBLaw (shape 1 5 2) u : ℝ)) (stageBPriority (shape 1 5 2)) 1 (fun u => B1_5_2Little u ((stageBPriority (shape 1 5 2)) 1)) (fun u a => (littleLaw (shape 1 5 2) u ((stageBPriority (shape 1 5 2)) 1) a : ℝ)) (fun u _ => B1_5_2Law_sound u) (fun u _ a => B1_5_2Little_sound u ((stageBPriority (shape 1 5 2)) 1) a) 2 a +def CB1_5_2I1R2Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(2064129144151554264168571077709 / 12500000000000000000000000000000), (1 / 3125000000000000000000000000000)⟩ ⟨(2974030674787114601029918237033 / 10000000000000000000000000000000), (13987083231 / 100000000000000000000000000000000)⟩ ⟨(-90051011440274033448705369701257 / 50000000000000000000000000000000), (3388131797 / 4000000000000000000000000000000)⟩ ⟨-3, 2064129144151554264168571077709, 1562500000000000000000000000000⟩, + .log ⟨(1985286600756920686097122080759 / 100000000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ ⟨(7781145999535342779622853406189 / 100000000000000000000000000000000), (183925347 / 6250000000000000000000000000000)⟩ ⟨(-391940689901833952867263505943723 / 100000000000000000000000000000000), (74115382991 / 50000000000000000000000000000000)⟩ ⟨-6, 1985286600756920686097122080759, 1562500000000000000000000000000⟩] +lemma CB1_5_2I1R2Certificates_valid : + CB1_5_2I1R2Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_5_2I1R2CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | 2 => 1 + | 3 => 2 + | _ => 0 +def CB1_5_2I1R2P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_5_2I1R2Certificates (CB1_5_2I1R2CertificateIndex a)).input +lemma CB1_5_2I1R2P_check : ∀ a : Fin 6, contains (CB1_5_2I1R2Raw a) (CB1_5_2I1R2P a) = true := by + decide +kernel +lemma CB1_5_2I1R2P_sound (a : Fin 6) : + (CB1_5_2I1R2P a).Encloses (CB1_5_2I1R2Value a) := + contains_sound (CB1_5_2I1R2Raw_sound a) (CB1_5_2I1R2P_check a) +def CB1_5_2I1R2Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_5_2I1R2Certificates (CB1_5_2I1R2CertificateIndex a)).output +lemma CB1_5_2I1R2Terms_sound (a : Fin 6) : + (CB1_5_2I1R2Terms a).Encloses (Foundation.entropyTerm (CB1_5_2I1R2Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_5_2I1R2Certificates_valid + (CB1_5_2I1R2CertificateIndex a) (CB1_5_2I1R2P_sound a) +def CB1_5_2I1R2Entropy : Ball := ⟨(37521452747406488789922035776519 / 100000000000000000000000000000000), (16929888783 / 100000000000000000000000000000000)⟩ +lemma CB1_5_2I1R2Entropy_sound : CB1_5_2I1R2Entropy.Encloses (Foundation.finiteEntropy CB1_5_2I1R2Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_5_2I1R2Value CB1_5_2I1R2Terms CB1_5_2I1R2Terms_sound) (by decide +kernel) +def CB1_5_2I1R2Mass : Ball := ⟨(18498319753969354799445690702431 / 100000000000000000000000000000000), (9 / 25000000000000000000000000000000)⟩ +lemma CB1_5_2I1R2Mass_sound : CB1_5_2I1R2Mass.Encloses (∑ a, CB1_5_2I1R2Value a) := by + exact contains_sound (finSumBall_sound 6 CB1_5_2I1R2P CB1_5_2I1R2Value CB1_5_2I1R2P_sound) (by decide +kernel) +def CB1_5_2I1R2MassTermLogWitness : LogWitness := ⟨-3, 18498319753969354799445690702431, 12500000000000000000000000000000⟩ +def CB1_5_2I1R2MassTermLog : Ball := ⟨(-5273407131682300154373846080691 / 3125000000000000000000000000000), (42351647463 / 50000000000000000000000000000000)⟩ +lemma CB1_5_2I1R2MassTermLog_sound : CB1_5_2I1R2MassTermLog.Encloses (Real.log ((∑ a, CB1_5_2I1R2Value a))) := by + exact checkLog_sound logTwoBall_sound (CB1_5_2I1R2Mass_sound) (w := CB1_5_2I1R2MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB1_5_2I1R2MassTerm : Ball := ⟨(31215734820710901625169931976881 / 100000000000000000000000000000000), (15668686399 / 100000000000000000000000000000000)⟩ +lemma CB1_5_2I1R2MassTerm_sound : CB1_5_2I1R2MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_5_2I1R2Value a))) := by + exact contains_sound (entropyTerm_ball (CB1_5_2I1R2Mass_sound) CB1_5_2I1R2MassTermLog_sound) (by decide +kernel) +def CB1_5_2I1R2H : Ball := ⟨(3152858963347793582376051899819 / 50000000000000000000000000000000), (16299287591 / 50000000000000000000000000000000)⟩ +lemma CB1_5_2I1R2H_sound : CB1_5_2I1R2H.Encloses (homogeneousEntropy CB1_5_2I1R2Value) := by + exact contains_sound (homogeneous_enclosed CB1_5_2I1R2Value CB1_5_2I1R2MassTerm_sound CB1_5_2I1R2Entropy_sound) (by decide +kernel) +def CB1_5_2I1R3Value (a : Fin 6) : ℝ := residualLaw (below (shape 1 5 2)) (fun u => (stageBLaw (shape 1 5 2) u : ℝ)) (stageBPriority (shape 1 5 2)) 1 (fun u a => (littleLaw (shape 1 5 2) u ((stageBPriority (shape 1 5 2)) 1) a : ℝ)) 3 a +def CB1_5_2I1R3Raw (a : Fin 6) : Ball := residualBall (below (shape 1 5 2)) B1_5_2Law (stageBPriority (shape 1 5 2)) 1 (fun u => B1_5_2Little u ((stageBPriority (shape 1 5 2)) 1)) 3 a +lemma CB1_5_2I1R3Raw_sound (a : Fin 6) : + (CB1_5_2I1R3Raw a).Encloses (CB1_5_2I1R3Value a) := by + exact residualBall_sound_on (below (shape 1 5 2)) B1_5_2Law (fun u => (stageBLaw (shape 1 5 2) u : ℝ)) (stageBPriority (shape 1 5 2)) 1 (fun u => B1_5_2Little u ((stageBPriority (shape 1 5 2)) 1)) (fun u a => (littleLaw (shape 1 5 2) u ((stageBPriority (shape 1 5 2)) 1) a : ℝ)) (fun u _ => B1_5_2Law_sound u) (fun u _ a => B1_5_2Little_sound u ((stageBPriority (shape 1 5 2)) 1) a) 3 a +def CB1_5_2I1R3Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB1_5_2I1R3Certificates_valid : + CB1_5_2I1R3Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_5_2I1R3CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB1_5_2I1R3P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_5_2I1R3Certificates (CB1_5_2I1R3CertificateIndex a)).input +lemma CB1_5_2I1R3P_check : ∀ a : Fin 6, contains (CB1_5_2I1R3Raw a) (CB1_5_2I1R3P a) = true := by + decide +kernel +lemma CB1_5_2I1R3P_sound (a : Fin 6) : + (CB1_5_2I1R3P a).Encloses (CB1_5_2I1R3Value a) := + contains_sound (CB1_5_2I1R3Raw_sound a) (CB1_5_2I1R3P_check a) +def CB1_5_2I1R3Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_5_2I1R3Certificates (CB1_5_2I1R3CertificateIndex a)).output +lemma CB1_5_2I1R3Terms_sound (a : Fin 6) : + (CB1_5_2I1R3Terms a).Encloses (Foundation.entropyTerm (CB1_5_2I1R3Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_5_2I1R3Certificates_valid + (CB1_5_2I1R3CertificateIndex a) (CB1_5_2I1R3P_sound a) +def CB1_5_2I1R3Entropy : Ball := ⟨0, 0⟩ +lemma CB1_5_2I1R3Entropy_sound : CB1_5_2I1R3Entropy.Encloses (Foundation.finiteEntropy CB1_5_2I1R3Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_5_2I1R3Value CB1_5_2I1R3Terms CB1_5_2I1R3Terms_sound) (by decide +kernel) +def CB1_5_2I1R3Mass : Ball := ⟨0, 0⟩ +lemma CB1_5_2I1R3Mass_sound : CB1_5_2I1R3Mass.Encloses (∑ a, CB1_5_2I1R3Value a) := by + exact contains_sound (finSumBall_sound 6 CB1_5_2I1R3P CB1_5_2I1R3Value CB1_5_2I1R3P_sound) (by decide +kernel) +def CB1_5_2I1R3MassTerm : Ball := .exact 0 +lemma CB1_5_2I1R3MassTerm_sound : CB1_5_2I1R3MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_5_2I1R3Value a))) := + entropyTerm_zero_ball (CB1_5_2I1R3Mass_sound) +def CB1_5_2I1R3H : Ball := ⟨0, 0⟩ +lemma CB1_5_2I1R3H_sound : CB1_5_2I1R3H.Encloses (homogeneousEntropy CB1_5_2I1R3Value) := by + exact contains_sound (homogeneous_enclosed CB1_5_2I1R3Value CB1_5_2I1R3MassTerm_sound CB1_5_2I1R3Entropy_sound) (by decide +kernel) +def CB1_5_2I1R4Value (a : Fin 6) : ℝ := residualLaw (below (shape 1 5 2)) (fun u => (stageBLaw (shape 1 5 2) u : ℝ)) (stageBPriority (shape 1 5 2)) 1 (fun u a => (littleLaw (shape 1 5 2) u ((stageBPriority (shape 1 5 2)) 1) a : ℝ)) 4 a +def CB1_5_2I1R4Raw (a : Fin 6) : Ball := residualBall (below (shape 1 5 2)) B1_5_2Law (stageBPriority (shape 1 5 2)) 1 (fun u => B1_5_2Little u ((stageBPriority (shape 1 5 2)) 1)) 4 a +lemma CB1_5_2I1R4Raw_sound (a : Fin 6) : + (CB1_5_2I1R4Raw a).Encloses (CB1_5_2I1R4Value a) := by + exact residualBall_sound_on (below (shape 1 5 2)) B1_5_2Law (fun u => (stageBLaw (shape 1 5 2) u : ℝ)) (stageBPriority (shape 1 5 2)) 1 (fun u => B1_5_2Little u ((stageBPriority (shape 1 5 2)) 1)) (fun u a => (littleLaw (shape 1 5 2) u ((stageBPriority (shape 1 5 2)) 1) a : ℝ)) (fun u _ => B1_5_2Law_sound u) (fun u _ a => B1_5_2Little_sound u ((stageBPriority (shape 1 5 2)) 1) a) 4 a +def CB1_5_2I1R4Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB1_5_2I1R4Certificates_valid : + CB1_5_2I1R4Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_5_2I1R4CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB1_5_2I1R4P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_5_2I1R4Certificates (CB1_5_2I1R4CertificateIndex a)).input +lemma CB1_5_2I1R4P_check : ∀ a : Fin 6, contains (CB1_5_2I1R4Raw a) (CB1_5_2I1R4P a) = true := by + decide +kernel +lemma CB1_5_2I1R4P_sound (a : Fin 6) : + (CB1_5_2I1R4P a).Encloses (CB1_5_2I1R4Value a) := + contains_sound (CB1_5_2I1R4Raw_sound a) (CB1_5_2I1R4P_check a) +def CB1_5_2I1R4Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_5_2I1R4Certificates (CB1_5_2I1R4CertificateIndex a)).output +lemma CB1_5_2I1R4Terms_sound (a : Fin 6) : + (CB1_5_2I1R4Terms a).Encloses (Foundation.entropyTerm (CB1_5_2I1R4Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_5_2I1R4Certificates_valid + (CB1_5_2I1R4CertificateIndex a) (CB1_5_2I1R4P_sound a) +def CB1_5_2I1R4Entropy : Ball := ⟨0, 0⟩ +lemma CB1_5_2I1R4Entropy_sound : CB1_5_2I1R4Entropy.Encloses (Foundation.finiteEntropy CB1_5_2I1R4Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_5_2I1R4Value CB1_5_2I1R4Terms CB1_5_2I1R4Terms_sound) (by decide +kernel) +def CB1_5_2I1R4Mass : Ball := ⟨0, 0⟩ +lemma CB1_5_2I1R4Mass_sound : CB1_5_2I1R4Mass.Encloses (∑ a, CB1_5_2I1R4Value a) := by + exact contains_sound (finSumBall_sound 6 CB1_5_2I1R4P CB1_5_2I1R4Value CB1_5_2I1R4P_sound) (by decide +kernel) +def CB1_5_2I1R4MassTerm : Ball := .exact 0 +lemma CB1_5_2I1R4MassTerm_sound : CB1_5_2I1R4MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_5_2I1R4Value a))) := + entropyTerm_zero_ball (CB1_5_2I1R4Mass_sound) +def CB1_5_2I1R4H : Ball := ⟨0, 0⟩ +lemma CB1_5_2I1R4H_sound : CB1_5_2I1R4H.Encloses (homogeneousEntropy CB1_5_2I1R4Value) := by + exact contains_sound (homogeneous_enclosed CB1_5_2I1R4Value CB1_5_2I1R4MassTerm_sound CB1_5_2I1R4Entropy_sound) (by decide +kernel) +def CB1_5_2I1R5Value (a : Fin 6) : ℝ := residualLaw (below (shape 1 5 2)) (fun u => (stageBLaw (shape 1 5 2) u : ℝ)) (stageBPriority (shape 1 5 2)) 1 (fun u a => (littleLaw (shape 1 5 2) u ((stageBPriority (shape 1 5 2)) 1) a : ℝ)) 5 a +def CB1_5_2I1R5Raw (a : Fin 6) : Ball := residualBall (below (shape 1 5 2)) B1_5_2Law (stageBPriority (shape 1 5 2)) 1 (fun u => B1_5_2Little u ((stageBPriority (shape 1 5 2)) 1)) 5 a +lemma CB1_5_2I1R5Raw_sound (a : Fin 6) : + (CB1_5_2I1R5Raw a).Encloses (CB1_5_2I1R5Value a) := by + exact residualBall_sound_on (below (shape 1 5 2)) B1_5_2Law (fun u => (stageBLaw (shape 1 5 2) u : ℝ)) (stageBPriority (shape 1 5 2)) 1 (fun u => B1_5_2Little u ((stageBPriority (shape 1 5 2)) 1)) (fun u a => (littleLaw (shape 1 5 2) u ((stageBPriority (shape 1 5 2)) 1) a : ℝ)) (fun u _ => B1_5_2Law_sound u) (fun u _ a => B1_5_2Little_sound u ((stageBPriority (shape 1 5 2)) 1) a) 5 a +def CB1_5_2I1R5Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB1_5_2I1R5Certificates_valid : + CB1_5_2I1R5Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_5_2I1R5CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB1_5_2I1R5P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_5_2I1R5Certificates (CB1_5_2I1R5CertificateIndex a)).input +lemma CB1_5_2I1R5P_check : ∀ a : Fin 6, contains (CB1_5_2I1R5Raw a) (CB1_5_2I1R5P a) = true := by + decide +kernel +lemma CB1_5_2I1R5P_sound (a : Fin 6) : + (CB1_5_2I1R5P a).Encloses (CB1_5_2I1R5Value a) := + contains_sound (CB1_5_2I1R5Raw_sound a) (CB1_5_2I1R5P_check a) +def CB1_5_2I1R5Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_5_2I1R5Certificates (CB1_5_2I1R5CertificateIndex a)).output +lemma CB1_5_2I1R5Terms_sound (a : Fin 6) : + (CB1_5_2I1R5Terms a).Encloses (Foundation.entropyTerm (CB1_5_2I1R5Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_5_2I1R5Certificates_valid + (CB1_5_2I1R5CertificateIndex a) (CB1_5_2I1R5P_sound a) +def CB1_5_2I1R5Entropy : Ball := ⟨0, 0⟩ +lemma CB1_5_2I1R5Entropy_sound : CB1_5_2I1R5Entropy.Encloses (Foundation.finiteEntropy CB1_5_2I1R5Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_5_2I1R5Value CB1_5_2I1R5Terms CB1_5_2I1R5Terms_sound) (by decide +kernel) +def CB1_5_2I1R5Mass : Ball := ⟨0, 0⟩ +lemma CB1_5_2I1R5Mass_sound : CB1_5_2I1R5Mass.Encloses (∑ a, CB1_5_2I1R5Value a) := by + exact contains_sound (finSumBall_sound 6 CB1_5_2I1R5P CB1_5_2I1R5Value CB1_5_2I1R5P_sound) (by decide +kernel) +def CB1_5_2I1R5MassTerm : Ball := .exact 0 +lemma CB1_5_2I1R5MassTerm_sound : CB1_5_2I1R5MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_5_2I1R5Value a))) := + entropyTerm_zero_ball (CB1_5_2I1R5Mass_sound) +def CB1_5_2I1R5H : Ball := ⟨0, 0⟩ +lemma CB1_5_2I1R5H_sound : CB1_5_2I1R5H.Encloses (homogeneousEntropy CB1_5_2I1R5Value) := by + exact contains_sound (homogeneous_enclosed CB1_5_2I1R5Value CB1_5_2I1R5MassTerm_sound CB1_5_2I1R5Entropy_sound) (by decide +kernel) +def CB1_5_2I1R6Value (a : Fin 6) : ℝ := residualLaw (below (shape 1 5 2)) (fun u => (stageBLaw (shape 1 5 2) u : ℝ)) (stageBPriority (shape 1 5 2)) 1 (fun u a => (littleLaw (shape 1 5 2) u ((stageBPriority (shape 1 5 2)) 1) a : ℝ)) 6 a +def CB1_5_2I1R6Raw (a : Fin 6) : Ball := residualBall (below (shape 1 5 2)) B1_5_2Law (stageBPriority (shape 1 5 2)) 1 (fun u => B1_5_2Little u ((stageBPriority (shape 1 5 2)) 1)) 6 a +lemma CB1_5_2I1R6Raw_sound (a : Fin 6) : + (CB1_5_2I1R6Raw a).Encloses (CB1_5_2I1R6Value a) := by + exact residualBall_sound_on (below (shape 1 5 2)) B1_5_2Law (fun u => (stageBLaw (shape 1 5 2) u : ℝ)) (stageBPriority (shape 1 5 2)) 1 (fun u => B1_5_2Little u ((stageBPriority (shape 1 5 2)) 1)) (fun u a => (littleLaw (shape 1 5 2) u ((stageBPriority (shape 1 5 2)) 1) a : ℝ)) (fun u _ => B1_5_2Law_sound u) (fun u _ a => B1_5_2Little_sound u ((stageBPriority (shape 1 5 2)) 1) a) 6 a +def CB1_5_2I1R6Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB1_5_2I1R6Certificates_valid : + CB1_5_2I1R6Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_5_2I1R6CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB1_5_2I1R6P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_5_2I1R6Certificates (CB1_5_2I1R6CertificateIndex a)).input +lemma CB1_5_2I1R6P_check : ∀ a : Fin 6, contains (CB1_5_2I1R6Raw a) (CB1_5_2I1R6P a) = true := by + decide +kernel +lemma CB1_5_2I1R6P_sound (a : Fin 6) : + (CB1_5_2I1R6P a).Encloses (CB1_5_2I1R6Value a) := + contains_sound (CB1_5_2I1R6Raw_sound a) (CB1_5_2I1R6P_check a) +def CB1_5_2I1R6Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_5_2I1R6Certificates (CB1_5_2I1R6CertificateIndex a)).output +lemma CB1_5_2I1R6Terms_sound (a : Fin 6) : + (CB1_5_2I1R6Terms a).Encloses (Foundation.entropyTerm (CB1_5_2I1R6Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_5_2I1R6Certificates_valid + (CB1_5_2I1R6CertificateIndex a) (CB1_5_2I1R6P_sound a) +def CB1_5_2I1R6Entropy : Ball := ⟨0, 0⟩ +lemma CB1_5_2I1R6Entropy_sound : CB1_5_2I1R6Entropy.Encloses (Foundation.finiteEntropy CB1_5_2I1R6Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_5_2I1R6Value CB1_5_2I1R6Terms CB1_5_2I1R6Terms_sound) (by decide +kernel) +def CB1_5_2I1R6Mass : Ball := ⟨0, 0⟩ +lemma CB1_5_2I1R6Mass_sound : CB1_5_2I1R6Mass.Encloses (∑ a, CB1_5_2I1R6Value a) := by + exact contains_sound (finSumBall_sound 6 CB1_5_2I1R6P CB1_5_2I1R6Value CB1_5_2I1R6P_sound) (by decide +kernel) +def CB1_5_2I1R6MassTerm : Ball := .exact 0 +lemma CB1_5_2I1R6MassTerm_sound : CB1_5_2I1R6MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_5_2I1R6Value a))) := + entropyTerm_zero_ball (CB1_5_2I1R6Mass_sound) +def CB1_5_2I1R6H : Ball := ⟨0, 0⟩ +lemma CB1_5_2I1R6H_sound : CB1_5_2I1R6H.Encloses (homogeneousEntropy CB1_5_2I1R6Value) := by + exact contains_sound (homogeneous_enclosed CB1_5_2I1R6Value CB1_5_2I1R6MassTerm_sound CB1_5_2I1R6Entropy_sound) (by decide +kernel) +def CB1_5_2I1R7Value (a : Fin 6) : ℝ := residualLaw (below (shape 1 5 2)) (fun u => (stageBLaw (shape 1 5 2) u : ℝ)) (stageBPriority (shape 1 5 2)) 1 (fun u a => (littleLaw (shape 1 5 2) u ((stageBPriority (shape 1 5 2)) 1) a : ℝ)) 7 a +def CB1_5_2I1R7Raw (a : Fin 6) : Ball := residualBall (below (shape 1 5 2)) B1_5_2Law (stageBPriority (shape 1 5 2)) 1 (fun u => B1_5_2Little u ((stageBPriority (shape 1 5 2)) 1)) 7 a +lemma CB1_5_2I1R7Raw_sound (a : Fin 6) : + (CB1_5_2I1R7Raw a).Encloses (CB1_5_2I1R7Value a) := by + exact residualBall_sound_on (below (shape 1 5 2)) B1_5_2Law (fun u => (stageBLaw (shape 1 5 2) u : ℝ)) (stageBPriority (shape 1 5 2)) 1 (fun u => B1_5_2Little u ((stageBPriority (shape 1 5 2)) 1)) (fun u a => (littleLaw (shape 1 5 2) u ((stageBPriority (shape 1 5 2)) 1) a : ℝ)) (fun u _ => B1_5_2Law_sound u) (fun u _ a => B1_5_2Little_sound u ((stageBPriority (shape 1 5 2)) 1) a) 7 a +def CB1_5_2I1R7Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB1_5_2I1R7Certificates_valid : + CB1_5_2I1R7Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_5_2I1R7CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB1_5_2I1R7P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_5_2I1R7Certificates (CB1_5_2I1R7CertificateIndex a)).input +lemma CB1_5_2I1R7P_check : ∀ a : Fin 6, contains (CB1_5_2I1R7Raw a) (CB1_5_2I1R7P a) = true := by + decide +kernel +lemma CB1_5_2I1R7P_sound (a : Fin 6) : + (CB1_5_2I1R7P a).Encloses (CB1_5_2I1R7Value a) := + contains_sound (CB1_5_2I1R7Raw_sound a) (CB1_5_2I1R7P_check a) +def CB1_5_2I1R7Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_5_2I1R7Certificates (CB1_5_2I1R7CertificateIndex a)).output +lemma CB1_5_2I1R7Terms_sound (a : Fin 6) : + (CB1_5_2I1R7Terms a).Encloses (Foundation.entropyTerm (CB1_5_2I1R7Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_5_2I1R7Certificates_valid + (CB1_5_2I1R7CertificateIndex a) (CB1_5_2I1R7P_sound a) +def CB1_5_2I1R7Entropy : Ball := ⟨0, 0⟩ +lemma CB1_5_2I1R7Entropy_sound : CB1_5_2I1R7Entropy.Encloses (Foundation.finiteEntropy CB1_5_2I1R7Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_5_2I1R7Value CB1_5_2I1R7Terms CB1_5_2I1R7Terms_sound) (by decide +kernel) +def CB1_5_2I1R7Mass : Ball := ⟨0, 0⟩ +lemma CB1_5_2I1R7Mass_sound : CB1_5_2I1R7Mass.Encloses (∑ a, CB1_5_2I1R7Value a) := by + exact contains_sound (finSumBall_sound 6 CB1_5_2I1R7P CB1_5_2I1R7Value CB1_5_2I1R7P_sound) (by decide +kernel) +def CB1_5_2I1R7MassTerm : Ball := .exact 0 +lemma CB1_5_2I1R7MassTerm_sound : CB1_5_2I1R7MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_5_2I1R7Value a))) := + entropyTerm_zero_ball (CB1_5_2I1R7Mass_sound) +def CB1_5_2I1R7H : Ball := ⟨0, 0⟩ +lemma CB1_5_2I1R7H_sound : CB1_5_2I1R7H.Encloses (homogeneousEntropy CB1_5_2I1R7Value) := by + exact contains_sound (homogeneous_enclosed CB1_5_2I1R7Value CB1_5_2I1R7MassTerm_sound CB1_5_2I1R7Entropy_sound) (by decide +kernel) +def CB1_5_2I1R8Value (a : Fin 6) : ℝ := residualLaw (below (shape 1 5 2)) (fun u => (stageBLaw (shape 1 5 2) u : ℝ)) (stageBPriority (shape 1 5 2)) 1 (fun u a => (littleLaw (shape 1 5 2) u ((stageBPriority (shape 1 5 2)) 1) a : ℝ)) 8 a +def CB1_5_2I1R8Raw (a : Fin 6) : Ball := residualBall (below (shape 1 5 2)) B1_5_2Law (stageBPriority (shape 1 5 2)) 1 (fun u => B1_5_2Little u ((stageBPriority (shape 1 5 2)) 1)) 8 a +lemma CB1_5_2I1R8Raw_sound (a : Fin 6) : + (CB1_5_2I1R8Raw a).Encloses (CB1_5_2I1R8Value a) := by + exact residualBall_sound_on (below (shape 1 5 2)) B1_5_2Law (fun u => (stageBLaw (shape 1 5 2) u : ℝ)) (stageBPriority (shape 1 5 2)) 1 (fun u => B1_5_2Little u ((stageBPriority (shape 1 5 2)) 1)) (fun u a => (littleLaw (shape 1 5 2) u ((stageBPriority (shape 1 5 2)) 1) a : ℝ)) (fun u _ => B1_5_2Law_sound u) (fun u _ a => B1_5_2Little_sound u ((stageBPriority (shape 1 5 2)) 1) a) 8 a +def CB1_5_2I1R8Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB1_5_2I1R8Certificates_valid : + CB1_5_2I1R8Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_5_2I1R8CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB1_5_2I1R8P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_5_2I1R8Certificates (CB1_5_2I1R8CertificateIndex a)).input +lemma CB1_5_2I1R8P_check : ∀ a : Fin 6, contains (CB1_5_2I1R8Raw a) (CB1_5_2I1R8P a) = true := by + decide +kernel +lemma CB1_5_2I1R8P_sound (a : Fin 6) : + (CB1_5_2I1R8P a).Encloses (CB1_5_2I1R8Value a) := + contains_sound (CB1_5_2I1R8Raw_sound a) (CB1_5_2I1R8P_check a) +def CB1_5_2I1R8Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_5_2I1R8Certificates (CB1_5_2I1R8CertificateIndex a)).output +lemma CB1_5_2I1R8Terms_sound (a : Fin 6) : + (CB1_5_2I1R8Terms a).Encloses (Foundation.entropyTerm (CB1_5_2I1R8Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_5_2I1R8Certificates_valid + (CB1_5_2I1R8CertificateIndex a) (CB1_5_2I1R8P_sound a) +def CB1_5_2I1R8Entropy : Ball := ⟨0, 0⟩ +lemma CB1_5_2I1R8Entropy_sound : CB1_5_2I1R8Entropy.Encloses (Foundation.finiteEntropy CB1_5_2I1R8Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_5_2I1R8Value CB1_5_2I1R8Terms CB1_5_2I1R8Terms_sound) (by decide +kernel) +def CB1_5_2I1R8Mass : Ball := ⟨0, 0⟩ +lemma CB1_5_2I1R8Mass_sound : CB1_5_2I1R8Mass.Encloses (∑ a, CB1_5_2I1R8Value a) := by + exact contains_sound (finSumBall_sound 6 CB1_5_2I1R8P CB1_5_2I1R8Value CB1_5_2I1R8P_sound) (by decide +kernel) +def CB1_5_2I1R8MassTerm : Ball := .exact 0 +lemma CB1_5_2I1R8MassTerm_sound : CB1_5_2I1R8MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_5_2I1R8Value a))) := + entropyTerm_zero_ball (CB1_5_2I1R8Mass_sound) +def CB1_5_2I1R8H : Ball := ⟨0, 0⟩ +lemma CB1_5_2I1R8H_sound : CB1_5_2I1R8H.Encloses (homogeneousEntropy CB1_5_2I1R8Value) := by + exact contains_sound (homogeneous_enclosed CB1_5_2I1R8Value CB1_5_2I1R8MassTerm_sound CB1_5_2I1R8Entropy_sound) (by decide +kernel) +def CB1_5_2I1R9Value (a : Fin 6) : ℝ := residualLaw (below (shape 1 5 2)) (fun u => (stageBLaw (shape 1 5 2) u : ℝ)) (stageBPriority (shape 1 5 2)) 1 (fun u a => (littleLaw (shape 1 5 2) u ((stageBPriority (shape 1 5 2)) 1) a : ℝ)) 9 a +def CB1_5_2I1R9Raw (a : Fin 6) : Ball := residualBall (below (shape 1 5 2)) B1_5_2Law (stageBPriority (shape 1 5 2)) 1 (fun u => B1_5_2Little u ((stageBPriority (shape 1 5 2)) 1)) 9 a +lemma CB1_5_2I1R9Raw_sound (a : Fin 6) : + (CB1_5_2I1R9Raw a).Encloses (CB1_5_2I1R9Value a) := by + exact residualBall_sound_on (below (shape 1 5 2)) B1_5_2Law (fun u => (stageBLaw (shape 1 5 2) u : ℝ)) (stageBPriority (shape 1 5 2)) 1 (fun u => B1_5_2Little u ((stageBPriority (shape 1 5 2)) 1)) (fun u a => (littleLaw (shape 1 5 2) u ((stageBPriority (shape 1 5 2)) 1) a : ℝ)) (fun u _ => B1_5_2Law_sound u) (fun u _ a => B1_5_2Little_sound u ((stageBPriority (shape 1 5 2)) 1) a) 9 a +def CB1_5_2I1R9Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB1_5_2I1R9Certificates_valid : + CB1_5_2I1R9Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_5_2I1R9CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB1_5_2I1R9P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_5_2I1R9Certificates (CB1_5_2I1R9CertificateIndex a)).input +lemma CB1_5_2I1R9P_check : ∀ a : Fin 6, contains (CB1_5_2I1R9Raw a) (CB1_5_2I1R9P a) = true := by + decide +kernel +lemma CB1_5_2I1R9P_sound (a : Fin 6) : + (CB1_5_2I1R9P a).Encloses (CB1_5_2I1R9Value a) := + contains_sound (CB1_5_2I1R9Raw_sound a) (CB1_5_2I1R9P_check a) +def CB1_5_2I1R9Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_5_2I1R9Certificates (CB1_5_2I1R9CertificateIndex a)).output +lemma CB1_5_2I1R9Terms_sound (a : Fin 6) : + (CB1_5_2I1R9Terms a).Encloses (Foundation.entropyTerm (CB1_5_2I1R9Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_5_2I1R9Certificates_valid + (CB1_5_2I1R9CertificateIndex a) (CB1_5_2I1R9P_sound a) +def CB1_5_2I1R9Entropy : Ball := ⟨0, 0⟩ +lemma CB1_5_2I1R9Entropy_sound : CB1_5_2I1R9Entropy.Encloses (Foundation.finiteEntropy CB1_5_2I1R9Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_5_2I1R9Value CB1_5_2I1R9Terms CB1_5_2I1R9Terms_sound) (by decide +kernel) +def CB1_5_2I1R9Mass : Ball := ⟨0, 0⟩ +lemma CB1_5_2I1R9Mass_sound : CB1_5_2I1R9Mass.Encloses (∑ a, CB1_5_2I1R9Value a) := by + exact contains_sound (finSumBall_sound 6 CB1_5_2I1R9P CB1_5_2I1R9Value CB1_5_2I1R9P_sound) (by decide +kernel) +def CB1_5_2I1R9MassTerm : Ball := .exact 0 +lemma CB1_5_2I1R9MassTerm_sound : CB1_5_2I1R9MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_5_2I1R9Value a))) := + entropyTerm_zero_ball (CB1_5_2I1R9Mass_sound) +def CB1_5_2I1R9H : Ball := ⟨0, 0⟩ +lemma CB1_5_2I1R9H_sound : CB1_5_2I1R9H.Encloses (homogeneousEntropy CB1_5_2I1R9Value) := by + exact contains_sound (homogeneous_enclosed CB1_5_2I1R9Value CB1_5_2I1R9MassTerm_sound CB1_5_2I1R9Entropy_sound) (by decide +kernel) +def CB1_5_2I1R10Value (a : Fin 6) : ℝ := residualLaw (below (shape 1 5 2)) (fun u => (stageBLaw (shape 1 5 2) u : ℝ)) (stageBPriority (shape 1 5 2)) 1 (fun u a => (littleLaw (shape 1 5 2) u ((stageBPriority (shape 1 5 2)) 1) a : ℝ)) 10 a +def CB1_5_2I1R10Raw (a : Fin 6) : Ball := residualBall (below (shape 1 5 2)) B1_5_2Law (stageBPriority (shape 1 5 2)) 1 (fun u => B1_5_2Little u ((stageBPriority (shape 1 5 2)) 1)) 10 a +lemma CB1_5_2I1R10Raw_sound (a : Fin 6) : + (CB1_5_2I1R10Raw a).Encloses (CB1_5_2I1R10Value a) := by + exact residualBall_sound_on (below (shape 1 5 2)) B1_5_2Law (fun u => (stageBLaw (shape 1 5 2) u : ℝ)) (stageBPriority (shape 1 5 2)) 1 (fun u => B1_5_2Little u ((stageBPriority (shape 1 5 2)) 1)) (fun u a => (littleLaw (shape 1 5 2) u ((stageBPriority (shape 1 5 2)) 1) a : ℝ)) (fun u _ => B1_5_2Law_sound u) (fun u _ a => B1_5_2Little_sound u ((stageBPriority (shape 1 5 2)) 1) a) 10 a +def CB1_5_2I1R10Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB1_5_2I1R10Certificates_valid : + CB1_5_2I1R10Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_5_2I1R10CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB1_5_2I1R10P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_5_2I1R10Certificates (CB1_5_2I1R10CertificateIndex a)).input +lemma CB1_5_2I1R10P_check : ∀ a : Fin 6, contains (CB1_5_2I1R10Raw a) (CB1_5_2I1R10P a) = true := by + decide +kernel +lemma CB1_5_2I1R10P_sound (a : Fin 6) : + (CB1_5_2I1R10P a).Encloses (CB1_5_2I1R10Value a) := + contains_sound (CB1_5_2I1R10Raw_sound a) (CB1_5_2I1R10P_check a) +def CB1_5_2I1R10Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_5_2I1R10Certificates (CB1_5_2I1R10CertificateIndex a)).output +lemma CB1_5_2I1R10Terms_sound (a : Fin 6) : + (CB1_5_2I1R10Terms a).Encloses (Foundation.entropyTerm (CB1_5_2I1R10Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_5_2I1R10Certificates_valid + (CB1_5_2I1R10CertificateIndex a) (CB1_5_2I1R10P_sound a) +def CB1_5_2I1R10Entropy : Ball := ⟨0, 0⟩ +lemma CB1_5_2I1R10Entropy_sound : CB1_5_2I1R10Entropy.Encloses (Foundation.finiteEntropy CB1_5_2I1R10Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_5_2I1R10Value CB1_5_2I1R10Terms CB1_5_2I1R10Terms_sound) (by decide +kernel) +def CB1_5_2I1R10Mass : Ball := ⟨0, 0⟩ +lemma CB1_5_2I1R10Mass_sound : CB1_5_2I1R10Mass.Encloses (∑ a, CB1_5_2I1R10Value a) := by + exact contains_sound (finSumBall_sound 6 CB1_5_2I1R10P CB1_5_2I1R10Value CB1_5_2I1R10P_sound) (by decide +kernel) +def CB1_5_2I1R10MassTerm : Ball := .exact 0 +lemma CB1_5_2I1R10MassTerm_sound : CB1_5_2I1R10MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_5_2I1R10Value a))) := + entropyTerm_zero_ball (CB1_5_2I1R10Mass_sound) +def CB1_5_2I1R10H : Ball := ⟨0, 0⟩ +lemma CB1_5_2I1R10H_sound : CB1_5_2I1R10H.Encloses (homogeneousEntropy CB1_5_2I1R10Value) := by + exact contains_sound (homogeneous_enclosed CB1_5_2I1R10Value CB1_5_2I1R10MassTerm_sound CB1_5_2I1R10Entropy_sound) (by decide +kernel) +def CB1_5_2I1R11Value (a : Fin 6) : ℝ := residualLaw (below (shape 1 5 2)) (fun u => (stageBLaw (shape 1 5 2) u : ℝ)) (stageBPriority (shape 1 5 2)) 1 (fun u a => (littleLaw (shape 1 5 2) u ((stageBPriority (shape 1 5 2)) 1) a : ℝ)) 11 a +def CB1_5_2I1R11Raw (a : Fin 6) : Ball := residualBall (below (shape 1 5 2)) B1_5_2Law (stageBPriority (shape 1 5 2)) 1 (fun u => B1_5_2Little u ((stageBPriority (shape 1 5 2)) 1)) 11 a +lemma CB1_5_2I1R11Raw_sound (a : Fin 6) : + (CB1_5_2I1R11Raw a).Encloses (CB1_5_2I1R11Value a) := by + exact residualBall_sound_on (below (shape 1 5 2)) B1_5_2Law (fun u => (stageBLaw (shape 1 5 2) u : ℝ)) (stageBPriority (shape 1 5 2)) 1 (fun u => B1_5_2Little u ((stageBPriority (shape 1 5 2)) 1)) (fun u a => (littleLaw (shape 1 5 2) u ((stageBPriority (shape 1 5 2)) 1) a : ℝ)) (fun u _ => B1_5_2Law_sound u) (fun u _ a => B1_5_2Little_sound u ((stageBPriority (shape 1 5 2)) 1) a) 11 a +def CB1_5_2I1R11Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB1_5_2I1R11Certificates_valid : + CB1_5_2I1R11Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_5_2I1R11CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB1_5_2I1R11P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_5_2I1R11Certificates (CB1_5_2I1R11CertificateIndex a)).input +lemma CB1_5_2I1R11P_check : ∀ a : Fin 6, contains (CB1_5_2I1R11Raw a) (CB1_5_2I1R11P a) = true := by + decide +kernel +lemma CB1_5_2I1R11P_sound (a : Fin 6) : + (CB1_5_2I1R11P a).Encloses (CB1_5_2I1R11Value a) := + contains_sound (CB1_5_2I1R11Raw_sound a) (CB1_5_2I1R11P_check a) +def CB1_5_2I1R11Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_5_2I1R11Certificates (CB1_5_2I1R11CertificateIndex a)).output +lemma CB1_5_2I1R11Terms_sound (a : Fin 6) : + (CB1_5_2I1R11Terms a).Encloses (Foundation.entropyTerm (CB1_5_2I1R11Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_5_2I1R11Certificates_valid + (CB1_5_2I1R11CertificateIndex a) (CB1_5_2I1R11P_sound a) +def CB1_5_2I1R11Entropy : Ball := ⟨0, 0⟩ +lemma CB1_5_2I1R11Entropy_sound : CB1_5_2I1R11Entropy.Encloses (Foundation.finiteEntropy CB1_5_2I1R11Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_5_2I1R11Value CB1_5_2I1R11Terms CB1_5_2I1R11Terms_sound) (by decide +kernel) +def CB1_5_2I1R11Mass : Ball := ⟨0, 0⟩ +lemma CB1_5_2I1R11Mass_sound : CB1_5_2I1R11Mass.Encloses (∑ a, CB1_5_2I1R11Value a) := by + exact contains_sound (finSumBall_sound 6 CB1_5_2I1R11P CB1_5_2I1R11Value CB1_5_2I1R11P_sound) (by decide +kernel) +def CB1_5_2I1R11MassTerm : Ball := .exact 0 +lemma CB1_5_2I1R11MassTerm_sound : CB1_5_2I1R11MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_5_2I1R11Value a))) := + entropyTerm_zero_ball (CB1_5_2I1R11Mass_sound) +def CB1_5_2I1R11H : Ball := ⟨0, 0⟩ +lemma CB1_5_2I1R11H_sound : CB1_5_2I1R11H.Encloses (homogeneousEntropy CB1_5_2I1R11Value) := by + exact contains_sound (homogeneous_enclosed CB1_5_2I1R11Value CB1_5_2I1R11MassTerm_sound CB1_5_2I1R11Entropy_sound) (by decide +kernel) +def CB1_5_2I1R12Value (a : Fin 6) : ℝ := residualLaw (below (shape 1 5 2)) (fun u => (stageBLaw (shape 1 5 2) u : ℝ)) (stageBPriority (shape 1 5 2)) 1 (fun u a => (littleLaw (shape 1 5 2) u ((stageBPriority (shape 1 5 2)) 1) a : ℝ)) 12 a +def CB1_5_2I1R12Raw (a : Fin 6) : Ball := residualBall (below (shape 1 5 2)) B1_5_2Law (stageBPriority (shape 1 5 2)) 1 (fun u => B1_5_2Little u ((stageBPriority (shape 1 5 2)) 1)) 12 a +lemma CB1_5_2I1R12Raw_sound (a : Fin 6) : + (CB1_5_2I1R12Raw a).Encloses (CB1_5_2I1R12Value a) := by + exact residualBall_sound_on (below (shape 1 5 2)) B1_5_2Law (fun u => (stageBLaw (shape 1 5 2) u : ℝ)) (stageBPriority (shape 1 5 2)) 1 (fun u => B1_5_2Little u ((stageBPriority (shape 1 5 2)) 1)) (fun u a => (littleLaw (shape 1 5 2) u ((stageBPriority (shape 1 5 2)) 1) a : ℝ)) (fun u _ => B1_5_2Law_sound u) (fun u _ a => B1_5_2Little_sound u ((stageBPriority (shape 1 5 2)) 1) a) 12 a +def CB1_5_2I1R12Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB1_5_2I1R12Certificates_valid : + CB1_5_2I1R12Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_5_2I1R12CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB1_5_2I1R12P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_5_2I1R12Certificates (CB1_5_2I1R12CertificateIndex a)).input +lemma CB1_5_2I1R12P_check : ∀ a : Fin 6, contains (CB1_5_2I1R12Raw a) (CB1_5_2I1R12P a) = true := by + decide +kernel +lemma CB1_5_2I1R12P_sound (a : Fin 6) : + (CB1_5_2I1R12P a).Encloses (CB1_5_2I1R12Value a) := + contains_sound (CB1_5_2I1R12Raw_sound a) (CB1_5_2I1R12P_check a) +def CB1_5_2I1R12Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_5_2I1R12Certificates (CB1_5_2I1R12CertificateIndex a)).output +lemma CB1_5_2I1R12Terms_sound (a : Fin 6) : + (CB1_5_2I1R12Terms a).Encloses (Foundation.entropyTerm (CB1_5_2I1R12Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_5_2I1R12Certificates_valid + (CB1_5_2I1R12CertificateIndex a) (CB1_5_2I1R12P_sound a) +def CB1_5_2I1R12Entropy : Ball := ⟨0, 0⟩ +lemma CB1_5_2I1R12Entropy_sound : CB1_5_2I1R12Entropy.Encloses (Foundation.finiteEntropy CB1_5_2I1R12Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_5_2I1R12Value CB1_5_2I1R12Terms CB1_5_2I1R12Terms_sound) (by decide +kernel) +def CB1_5_2I1R12Mass : Ball := ⟨0, 0⟩ +lemma CB1_5_2I1R12Mass_sound : CB1_5_2I1R12Mass.Encloses (∑ a, CB1_5_2I1R12Value a) := by + exact contains_sound (finSumBall_sound 6 CB1_5_2I1R12P CB1_5_2I1R12Value CB1_5_2I1R12P_sound) (by decide +kernel) +def CB1_5_2I1R12MassTerm : Ball := .exact 0 +lemma CB1_5_2I1R12MassTerm_sound : CB1_5_2I1R12MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_5_2I1R12Value a))) := + entropyTerm_zero_ball (CB1_5_2I1R12Mass_sound) +def CB1_5_2I1R12H : Ball := ⟨0, 0⟩ +lemma CB1_5_2I1R12H_sound : CB1_5_2I1R12H.Encloses (homogeneousEntropy CB1_5_2I1R12Value) := by + exact contains_sound (homogeneous_enclosed CB1_5_2I1R12Value CB1_5_2I1R12MassTerm_sound CB1_5_2I1R12Entropy_sound) (by decide +kernel) +def CB1_5_2I1R13Value (a : Fin 6) : ℝ := residualLaw (below (shape 1 5 2)) (fun u => (stageBLaw (shape 1 5 2) u : ℝ)) (stageBPriority (shape 1 5 2)) 1 (fun u a => (littleLaw (shape 1 5 2) u ((stageBPriority (shape 1 5 2)) 1) a : ℝ)) 13 a +def CB1_5_2I1R13Raw (a : Fin 6) : Ball := residualBall (below (shape 1 5 2)) B1_5_2Law (stageBPriority (shape 1 5 2)) 1 (fun u => B1_5_2Little u ((stageBPriority (shape 1 5 2)) 1)) 13 a +lemma CB1_5_2I1R13Raw_sound (a : Fin 6) : + (CB1_5_2I1R13Raw a).Encloses (CB1_5_2I1R13Value a) := by + exact residualBall_sound_on (below (shape 1 5 2)) B1_5_2Law (fun u => (stageBLaw (shape 1 5 2) u : ℝ)) (stageBPriority (shape 1 5 2)) 1 (fun u => B1_5_2Little u ((stageBPriority (shape 1 5 2)) 1)) (fun u a => (littleLaw (shape 1 5 2) u ((stageBPriority (shape 1 5 2)) 1) a : ℝ)) (fun u _ => B1_5_2Law_sound u) (fun u _ a => B1_5_2Little_sound u ((stageBPriority (shape 1 5 2)) 1) a) 13 a +def CB1_5_2I1R13Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB1_5_2I1R13Certificates_valid : + CB1_5_2I1R13Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_5_2I1R13CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB1_5_2I1R13P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_5_2I1R13Certificates (CB1_5_2I1R13CertificateIndex a)).input +lemma CB1_5_2I1R13P_check : ∀ a : Fin 6, contains (CB1_5_2I1R13Raw a) (CB1_5_2I1R13P a) = true := by + decide +kernel +lemma CB1_5_2I1R13P_sound (a : Fin 6) : + (CB1_5_2I1R13P a).Encloses (CB1_5_2I1R13Value a) := + contains_sound (CB1_5_2I1R13Raw_sound a) (CB1_5_2I1R13P_check a) +def CB1_5_2I1R13Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_5_2I1R13Certificates (CB1_5_2I1R13CertificateIndex a)).output +lemma CB1_5_2I1R13Terms_sound (a : Fin 6) : + (CB1_5_2I1R13Terms a).Encloses (Foundation.entropyTerm (CB1_5_2I1R13Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_5_2I1R13Certificates_valid + (CB1_5_2I1R13CertificateIndex a) (CB1_5_2I1R13P_sound a) +def CB1_5_2I1R13Entropy : Ball := ⟨0, 0⟩ +lemma CB1_5_2I1R13Entropy_sound : CB1_5_2I1R13Entropy.Encloses (Foundation.finiteEntropy CB1_5_2I1R13Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_5_2I1R13Value CB1_5_2I1R13Terms CB1_5_2I1R13Terms_sound) (by decide +kernel) +def CB1_5_2I1R13Mass : Ball := ⟨0, 0⟩ +lemma CB1_5_2I1R13Mass_sound : CB1_5_2I1R13Mass.Encloses (∑ a, CB1_5_2I1R13Value a) := by + exact contains_sound (finSumBall_sound 6 CB1_5_2I1R13P CB1_5_2I1R13Value CB1_5_2I1R13P_sound) (by decide +kernel) +def CB1_5_2I1R13MassTerm : Ball := .exact 0 +lemma CB1_5_2I1R13MassTerm_sound : CB1_5_2I1R13MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_5_2I1R13Value a))) := + entropyTerm_zero_ball (CB1_5_2I1R13Mass_sound) +def CB1_5_2I1R13H : Ball := ⟨0, 0⟩ +lemma CB1_5_2I1R13H_sound : CB1_5_2I1R13H.Encloses (homogeneousEntropy CB1_5_2I1R13Value) := by + exact contains_sound (homogeneous_enclosed CB1_5_2I1R13Value CB1_5_2I1R13MassTerm_sound CB1_5_2I1R13Entropy_sound) (by decide +kernel) +def CB1_5_2I1R14Value (a : Fin 6) : ℝ := residualLaw (below (shape 1 5 2)) (fun u => (stageBLaw (shape 1 5 2) u : ℝ)) (stageBPriority (shape 1 5 2)) 1 (fun u a => (littleLaw (shape 1 5 2) u ((stageBPriority (shape 1 5 2)) 1) a : ℝ)) 14 a +def CB1_5_2I1R14Raw (a : Fin 6) : Ball := residualBall (below (shape 1 5 2)) B1_5_2Law (stageBPriority (shape 1 5 2)) 1 (fun u => B1_5_2Little u ((stageBPriority (shape 1 5 2)) 1)) 14 a +lemma CB1_5_2I1R14Raw_sound (a : Fin 6) : + (CB1_5_2I1R14Raw a).Encloses (CB1_5_2I1R14Value a) := by + exact residualBall_sound_on (below (shape 1 5 2)) B1_5_2Law (fun u => (stageBLaw (shape 1 5 2) u : ℝ)) (stageBPriority (shape 1 5 2)) 1 (fun u => B1_5_2Little u ((stageBPriority (shape 1 5 2)) 1)) (fun u a => (littleLaw (shape 1 5 2) u ((stageBPriority (shape 1 5 2)) 1) a : ℝ)) (fun u _ => B1_5_2Law_sound u) (fun u _ a => B1_5_2Little_sound u ((stageBPriority (shape 1 5 2)) 1) a) 14 a +def CB1_5_2I1R14Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB1_5_2I1R14Certificates_valid : + CB1_5_2I1R14Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_5_2I1R14CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB1_5_2I1R14P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_5_2I1R14Certificates (CB1_5_2I1R14CertificateIndex a)).input +lemma CB1_5_2I1R14P_check : ∀ a : Fin 6, contains (CB1_5_2I1R14Raw a) (CB1_5_2I1R14P a) = true := by + decide +kernel +lemma CB1_5_2I1R14P_sound (a : Fin 6) : + (CB1_5_2I1R14P a).Encloses (CB1_5_2I1R14Value a) := + contains_sound (CB1_5_2I1R14Raw_sound a) (CB1_5_2I1R14P_check a) +def CB1_5_2I1R14Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_5_2I1R14Certificates (CB1_5_2I1R14CertificateIndex a)).output +lemma CB1_5_2I1R14Terms_sound (a : Fin 6) : + (CB1_5_2I1R14Terms a).Encloses (Foundation.entropyTerm (CB1_5_2I1R14Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_5_2I1R14Certificates_valid + (CB1_5_2I1R14CertificateIndex a) (CB1_5_2I1R14P_sound a) +def CB1_5_2I1R14Entropy : Ball := ⟨0, 0⟩ +lemma CB1_5_2I1R14Entropy_sound : CB1_5_2I1R14Entropy.Encloses (Foundation.finiteEntropy CB1_5_2I1R14Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_5_2I1R14Value CB1_5_2I1R14Terms CB1_5_2I1R14Terms_sound) (by decide +kernel) +def CB1_5_2I1R14Mass : Ball := ⟨0, 0⟩ +lemma CB1_5_2I1R14Mass_sound : CB1_5_2I1R14Mass.Encloses (∑ a, CB1_5_2I1R14Value a) := by + exact contains_sound (finSumBall_sound 6 CB1_5_2I1R14P CB1_5_2I1R14Value CB1_5_2I1R14P_sound) (by decide +kernel) +def CB1_5_2I1R14MassTerm : Ball := .exact 0 +lemma CB1_5_2I1R14MassTerm_sound : CB1_5_2I1R14MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_5_2I1R14Value a))) := + entropyTerm_zero_ball (CB1_5_2I1R14Mass_sound) +def CB1_5_2I1R14H : Ball := ⟨0, 0⟩ +lemma CB1_5_2I1R14H_sound : CB1_5_2I1R14H.Encloses (homogeneousEntropy CB1_5_2I1R14Value) := by + exact contains_sound (homogeneous_enclosed CB1_5_2I1R14Value CB1_5_2I1R14MassTerm_sound CB1_5_2I1R14Entropy_sound) (by decide +kernel) +def CB1_5_2I1R15Value (a : Fin 6) : ℝ := residualLaw (below (shape 1 5 2)) (fun u => (stageBLaw (shape 1 5 2) u : ℝ)) (stageBPriority (shape 1 5 2)) 1 (fun u a => (littleLaw (shape 1 5 2) u ((stageBPriority (shape 1 5 2)) 1) a : ℝ)) 15 a +def CB1_5_2I1R15Raw (a : Fin 6) : Ball := residualBall (below (shape 1 5 2)) B1_5_2Law (stageBPriority (shape 1 5 2)) 1 (fun u => B1_5_2Little u ((stageBPriority (shape 1 5 2)) 1)) 15 a +lemma CB1_5_2I1R15Raw_sound (a : Fin 6) : + (CB1_5_2I1R15Raw a).Encloses (CB1_5_2I1R15Value a) := by + exact residualBall_sound_on (below (shape 1 5 2)) B1_5_2Law (fun u => (stageBLaw (shape 1 5 2) u : ℝ)) (stageBPriority (shape 1 5 2)) 1 (fun u => B1_5_2Little u ((stageBPriority (shape 1 5 2)) 1)) (fun u a => (littleLaw (shape 1 5 2) u ((stageBPriority (shape 1 5 2)) 1) a : ℝ)) (fun u _ => B1_5_2Law_sound u) (fun u _ a => B1_5_2Little_sound u ((stageBPriority (shape 1 5 2)) 1) a) 15 a +def CB1_5_2I1R15Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB1_5_2I1R15Certificates_valid : + CB1_5_2I1R15Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_5_2I1R15CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB1_5_2I1R15P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_5_2I1R15Certificates (CB1_5_2I1R15CertificateIndex a)).input +lemma CB1_5_2I1R15P_check : ∀ a : Fin 6, contains (CB1_5_2I1R15Raw a) (CB1_5_2I1R15P a) = true := by + decide +kernel +lemma CB1_5_2I1R15P_sound (a : Fin 6) : + (CB1_5_2I1R15P a).Encloses (CB1_5_2I1R15Value a) := + contains_sound (CB1_5_2I1R15Raw_sound a) (CB1_5_2I1R15P_check a) +def CB1_5_2I1R15Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_5_2I1R15Certificates (CB1_5_2I1R15CertificateIndex a)).output +lemma CB1_5_2I1R15Terms_sound (a : Fin 6) : + (CB1_5_2I1R15Terms a).Encloses (Foundation.entropyTerm (CB1_5_2I1R15Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_5_2I1R15Certificates_valid + (CB1_5_2I1R15CertificateIndex a) (CB1_5_2I1R15P_sound a) +def CB1_5_2I1R15Entropy : Ball := ⟨0, 0⟩ +lemma CB1_5_2I1R15Entropy_sound : CB1_5_2I1R15Entropy.Encloses (Foundation.finiteEntropy CB1_5_2I1R15Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_5_2I1R15Value CB1_5_2I1R15Terms CB1_5_2I1R15Terms_sound) (by decide +kernel) +def CB1_5_2I1R15Mass : Ball := ⟨0, 0⟩ +lemma CB1_5_2I1R15Mass_sound : CB1_5_2I1R15Mass.Encloses (∑ a, CB1_5_2I1R15Value a) := by + exact contains_sound (finSumBall_sound 6 CB1_5_2I1R15P CB1_5_2I1R15Value CB1_5_2I1R15P_sound) (by decide +kernel) +def CB1_5_2I1R15MassTerm : Ball := .exact 0 +lemma CB1_5_2I1R15MassTerm_sound : CB1_5_2I1R15MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_5_2I1R15Value a))) := + entropyTerm_zero_ball (CB1_5_2I1R15Mass_sound) +def CB1_5_2I1R15H : Ball := ⟨0, 0⟩ +lemma CB1_5_2I1R15H_sound : CB1_5_2I1R15H.Encloses (homogeneousEntropy CB1_5_2I1R15Value) := by + exact contains_sound (homogeneous_enclosed CB1_5_2I1R15Value CB1_5_2I1R15MassTerm_sound CB1_5_2I1R15Entropy_sound) (by decide +kernel) +def CB1_5_2I1R16Value (a : Fin 6) : ℝ := residualLaw (below (shape 1 5 2)) (fun u => (stageBLaw (shape 1 5 2) u : ℝ)) (stageBPriority (shape 1 5 2)) 1 (fun u a => (littleLaw (shape 1 5 2) u ((stageBPriority (shape 1 5 2)) 1) a : ℝ)) 16 a +def CB1_5_2I1R16Raw (a : Fin 6) : Ball := residualBall (below (shape 1 5 2)) B1_5_2Law (stageBPriority (shape 1 5 2)) 1 (fun u => B1_5_2Little u ((stageBPriority (shape 1 5 2)) 1)) 16 a +lemma CB1_5_2I1R16Raw_sound (a : Fin 6) : + (CB1_5_2I1R16Raw a).Encloses (CB1_5_2I1R16Value a) := by + exact residualBall_sound_on (below (shape 1 5 2)) B1_5_2Law (fun u => (stageBLaw (shape 1 5 2) u : ℝ)) (stageBPriority (shape 1 5 2)) 1 (fun u => B1_5_2Little u ((stageBPriority (shape 1 5 2)) 1)) (fun u a => (littleLaw (shape 1 5 2) u ((stageBPriority (shape 1 5 2)) 1) a : ℝ)) (fun u _ => B1_5_2Law_sound u) (fun u _ a => B1_5_2Little_sound u ((stageBPriority (shape 1 5 2)) 1) a) 16 a +def CB1_5_2I1R16Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB1_5_2I1R16Certificates_valid : + CB1_5_2I1R16Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_5_2I1R16CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB1_5_2I1R16P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_5_2I1R16Certificates (CB1_5_2I1R16CertificateIndex a)).input +lemma CB1_5_2I1R16P_check : ∀ a : Fin 6, contains (CB1_5_2I1R16Raw a) (CB1_5_2I1R16P a) = true := by + decide +kernel +lemma CB1_5_2I1R16P_sound (a : Fin 6) : + (CB1_5_2I1R16P a).Encloses (CB1_5_2I1R16Value a) := + contains_sound (CB1_5_2I1R16Raw_sound a) (CB1_5_2I1R16P_check a) +def CB1_5_2I1R16Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_5_2I1R16Certificates (CB1_5_2I1R16CertificateIndex a)).output +lemma CB1_5_2I1R16Terms_sound (a : Fin 6) : + (CB1_5_2I1R16Terms a).Encloses (Foundation.entropyTerm (CB1_5_2I1R16Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_5_2I1R16Certificates_valid + (CB1_5_2I1R16CertificateIndex a) (CB1_5_2I1R16P_sound a) +def CB1_5_2I1R16Entropy : Ball := ⟨0, 0⟩ +lemma CB1_5_2I1R16Entropy_sound : CB1_5_2I1R16Entropy.Encloses (Foundation.finiteEntropy CB1_5_2I1R16Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_5_2I1R16Value CB1_5_2I1R16Terms CB1_5_2I1R16Terms_sound) (by decide +kernel) +def CB1_5_2I1R16Mass : Ball := ⟨0, 0⟩ +lemma CB1_5_2I1R16Mass_sound : CB1_5_2I1R16Mass.Encloses (∑ a, CB1_5_2I1R16Value a) := by + exact contains_sound (finSumBall_sound 6 CB1_5_2I1R16P CB1_5_2I1R16Value CB1_5_2I1R16P_sound) (by decide +kernel) +def CB1_5_2I1R16MassTerm : Ball := .exact 0 +lemma CB1_5_2I1R16MassTerm_sound : CB1_5_2I1R16MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_5_2I1R16Value a))) := + entropyTerm_zero_ball (CB1_5_2I1R16Mass_sound) +def CB1_5_2I1R16H : Ball := ⟨0, 0⟩ +lemma CB1_5_2I1R16H_sound : CB1_5_2I1R16H.Encloses (homogeneousEntropy CB1_5_2I1R16Value) := by + exact contains_sound (homogeneous_enclosed CB1_5_2I1R16Value CB1_5_2I1R16MassTerm_sound CB1_5_2I1R16Entropy_sound) (by decide +kernel) +def CB1_5_2I1ResidualEntropies (a : Fin 17) : Ball := + match a.val with + | 0 => CB1_5_2I1R0H + | 1 => CB1_5_2I1R1H + | 2 => CB1_5_2I1R2H + | 3 => CB1_5_2I1R3H + | 4 => CB1_5_2I1R4H + | 5 => CB1_5_2I1R5H + | 6 => CB1_5_2I1R6H + | 7 => CB1_5_2I1R7H + | 8 => CB1_5_2I1R8H + | 9 => CB1_5_2I1R9H + | 10 => CB1_5_2I1R10H + | 11 => CB1_5_2I1R11H + | 12 => CB1_5_2I1R12H + | 13 => CB1_5_2I1R13H + | 14 => CB1_5_2I1R14H + | 15 => CB1_5_2I1R15H + | 16 => CB1_5_2I1R16H + | _ => (.exact 0) +lemma CB1_5_2I1ResidualEntropies_sound (k : Fin 17) : + (CB1_5_2I1ResidualEntropies k).Encloses (homogeneousEntropy + (residualLaw (below (shape 1 5 2)) (fun u => (stageBLaw (shape 1 5 2) u : ℝ)) (stageBPriority (shape 1 5 2)) 1 (fun u a => (littleLaw (shape 1 5 2) u ((stageBPriority (shape 1 5 2)) 1) a : ℝ)) k)) := by + fin_cases k + · exact CB1_5_2I1R0H_sound + · exact CB1_5_2I1R1H_sound + · exact CB1_5_2I1R2H_sound + · exact CB1_5_2I1R3H_sound + · exact CB1_5_2I1R4H_sound + · exact CB1_5_2I1R5H_sound + · exact CB1_5_2I1R6H_sound + · exact CB1_5_2I1R7H_sound + · exact CB1_5_2I1R8H_sound + · exact CB1_5_2I1R9H_sound + · exact CB1_5_2I1R10H_sound + · exact CB1_5_2I1R11H_sound + · exact CB1_5_2I1R12H_sound + · exact CB1_5_2I1R13H_sound + · exact CB1_5_2I1R14H_sound + · exact CB1_5_2I1R15H_sound + · exact CB1_5_2I1R16H_sound +def CB1_5_2I1Singles (s : Shape) : Ball := + match s 0, s 1, s 2 with + | _, _, _ => (.exact 0) +lemma CB1_5_2I1Singles_sound (u : Shape) (hu : u ∈ below (shape 1 5 2)) + (hd : designated (stageBPriority (shape 1 5 2)) 1 u) : + (CB1_5_2I1Singles u).Encloses (homogeneousEntropy ((fun u a => (littleLaw (shape 1 5 2) u ((stageBPriority (shape 1 5 2)) 1) a : ℝ)) u)) := by + rw [B1_5_2_below] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl | rfl | rfl + · exact (show ¬ designated (stageBPriority (shape 1 5 2)) 1 (shape 0 2 2) by decide +kernel) hd |>.elim + · exact (show ¬ designated (stageBPriority (shape 1 5 2)) 1 (shape 0 3 1) by decide +kernel) hd |>.elim + · exact (show ¬ designated (stageBPriority (shape 1 5 2)) 1 (shape 0 4 0) by decide +kernel) hd |>.elim + · exact (show ¬ designated (stageBPriority (shape 1 5 2)) 1 (shape 1 1 2) by decide +kernel) hd |>.elim + · exact (show ¬ designated (stageBPriority (shape 1 5 2)) 1 (shape 1 2 1) by decide +kernel) hd |>.elim + · exact (show ¬ designated (stageBPriority (shape 1 5 2)) 1 (shape 1 3 0) by decide +kernel) hd |>.elim +def CB1_5_2I1Singleton : Ball := ⟨0, 0⟩ +lemma CB1_5_2I1Singleton_sound : CB1_5_2I1Singleton.Encloses + (singletonEntropy (below (shape 1 5 2)) (fun u => (stageBLaw (shape 1 5 2) u : ℝ)) (stageBPriority (shape 1 5 2)) 1 (fun u a => (littleLaw (shape 1 5 2) u ((stageBPriority (shape 1 5 2)) 1) a : ℝ))) := by + exact contains_sound (singletonBall_sound (below (shape 1 5 2)) B1_5_2Law (fun u => (stageBLaw (shape 1 5 2) u : ℝ)) (stageBPriority (shape 1 5 2)) 1 + CB1_5_2I1Singles (fun u a => (littleLaw (shape 1 5 2) u ((stageBPriority (shape 1 5 2)) 1) a : ℝ)) (fun u _ => B1_5_2Law_sound u) CB1_5_2I1Singles_sound) (by decide +kernel) +def CB1_5_2I1Group : Ball := ⟨(3152858963347793582376051899819 / 50000000000000000000000000000000), (29325467549 / 25000000000000000000000000000000)⟩ +lemma CB1_5_2I1Group_sound : CB1_5_2I1Group.Encloses + (groupedEntropy (below (shape 1 5 2)) (fun u => (stageBLaw (shape 1 5 2) u : ℝ)) (stageBPriority (shape 1 5 2)) 1 (fun u a => (littleLaw (shape 1 5 2) u ((stageBPriority (shape 1 5 2)) 1) a : ℝ))) := by + exact contains_sound (Ball.add_sound CB1_5_2I1Singleton_sound + (finSumBall_sound 17 CB1_5_2I1ResidualEntropies _ CB1_5_2I1ResidualEntropies_sound)) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CB1_5_2I1H : Ball := ⟨(91537895680813066951245642666289 / 100000000000000000000000000000000), (39540287857 / 12500000000000000000000000000000)⟩ +lemma CB1_5_2I1_sound : CB1_5_2I1H.Encloses (stageBCapacity (shape 1 5 2) 1) := by + have hb := contains_sound (Ball.add_sound CB1_5_2I1PairH_sound + (Ball.neg_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) CB1_5_2I1Group_sound))) + (show contains (.add CB1_5_2I1PairH (.neg (.mul (.exact 2) CB1_5_2I1Group))) CB1_5_2I1H = true by decide +kernel) + unfold CB1_5_2I1PairValue at hb + simpa only [stageBCapacity, nativeCapacity, + show (1 : Fin 3) ≠ 0 by decide, ite_false, sub_eq_add_neg] using hb + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/CapacityB/CapB1_5_2I2.lean b/lean/OAI/LinearAlgebra/MatrixFields/CapacityB/CapB1_5_2I2.lean new file mode 100644 index 0000000000000000000000000000000000000000..5f453f663265cfe71490aebac76ea9ef81a92db7 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/CapacityB/CapB1_5_2I2.lean @@ -0,0 +1,992 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Certificates.LittleB1_5_2 + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CB1_5_2I2PairValue (a : PairSlot) : ℝ := pairLaw (below (shape 1 5 2)) (shape 1 5 2) (fun u => (stageBLaw (shape 1 5 2) u : ℝ)) (fun u a => (littleLaw (shape 1 5 2) u ((stageBPriority (shape 1 5 2)) 2) a : ℝ)) a +def CB1_5_2I2PairRaw (a : PairSlot) : Ball := pairLawBall (below (shape 1 5 2)) (shape 1 5 2) B1_5_2Law (fun u => B1_5_2Little u ((stageBPriority (shape 1 5 2)) 2)) a +lemma CB1_5_2I2PairRaw_sound (a : PairSlot) : + (CB1_5_2I2PairRaw a).Encloses (CB1_5_2I2PairValue a) := by + exact pairLawBall_sound_on (below (shape 1 5 2)) (shape 1 5 2) B1_5_2Law (fun u => (stageBLaw (shape 1 5 2) u : ℝ)) (fun u => B1_5_2Little u ((stageBPriority (shape 1 5 2)) 2)) (fun u a => (littleLaw (shape 1 5 2) u ((stageBPriority (shape 1 5 2)) 2) a : ℝ)) (fun u _ => B1_5_2Law_sound u) (fun u _ a => B1_5_2Little_sound u ((stageBPriority (shape 1 5 2)) 2) a) (fun u _ a => B1_5_2Little_sound (complement (shape 1 5 2) u) ((stageBPriority (shape 1 5 2)) 2) a) a +def CB1_5_2I2PairCertificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(944296764805115665482085327337 / 2000000000000000000000000000000), (9 / 20000000000000000000000000000000)⟩ ⟨(35432940674981941874545014495217 / 100000000000000000000000000000000), (29994392773 / 100000000000000000000000000000000)⟩ ⟨(-75046197330337366954670157606283 / 100000000000000000000000000000000), (7940933893 / 12500000000000000000000000000000)⟩ ⟨-2, 944296764805115665482085327337, 500000000000000000000000000000⟩, + .log ⟨(518340583815889402541057141607 / 25000000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ ⟨(803634946716957988891523690789 / 10000000000000000000000000000000), (3073360887 / 100000000000000000000000000000000)⟩ ⟨(-387599857993370510716254809420077 / 100000000000000000000000000000000), (148230765973 / 100000000000000000000000000000000)⟩ ⟨-6, 518340583815889402541057141607, 390625000000000000000000000000⟩, + .log ⟨(355899712240329557865752533361 / 50000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ ⟨(1759970095016132032706174310353 / 50000000000000000000000000000000), (678282269 / 50000000000000000000000000000000)⟩ ⟨(-494512930043526220764008265666271 / 100000000000000000000000000000000), (744462553 / 390625000000000000000000000000)⟩ ⟨-8, 355899712240329557865752533361, 195312500000000000000000000000⟩] +lemma CB1_5_2I2PairCertificates_valid : + CB1_5_2I2PairCertificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_5_2I2PairCertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 2, 4 => 1 + | 3, 4 => 2 + | 4, 2 => 1 + | 4, 3 => 2 + | 5, 1 => 3 + | 1, 5 => 3 + | _, _ => 0 +def CB1_5_2I2PairP (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CB1_5_2I2PairCertificates (CB1_5_2I2PairCertificateIndex a)).input +lemma CB1_5_2I2PairP_check : ∀ a : PairSlot, contains (CB1_5_2I2PairRaw a) (CB1_5_2I2PairP a) = true := by + decide +kernel +lemma CB1_5_2I2PairP_sound (a : PairSlot) : + (CB1_5_2I2PairP a).Encloses (CB1_5_2I2PairValue a) := + contains_sound (CB1_5_2I2PairRaw_sound a) (CB1_5_2I2PairP_check a) +def CB1_5_2I2PairTerms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CB1_5_2I2PairCertificates (CB1_5_2I2PairCertificateIndex a)).output +lemma CB1_5_2I2PairTerms_sound (a : PairSlot) : + (CB1_5_2I2PairTerms a).Encloses (Foundation.entropyTerm (CB1_5_2I2PairValue a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_5_2I2PairCertificates_valid + (CB1_5_2I2PairCertificateIndex a) (CB1_5_2I2PairP_sound a) +def CB1_5_2I2PairEntropy : Ball := ⟨(46989230332183785828872600023813 / 50000000000000000000000000000000), (17212159099 / 25000000000000000000000000000000)⟩ +lemma CB1_5_2I2PairEntropy_sound : CB1_5_2I2PairEntropy.Encloses (Foundation.finiteEntropy CB1_5_2I2PairValue) := by + exact contains_sound (entropyPair_enclosed CB1_5_2I2PairValue CB1_5_2I2PairTerms CB1_5_2I2PairTerms_sound) (by decide +kernel) +def CB1_5_2I2PairMass : Ball := ⟨1, (13 / 12500000000000000000000000000000)⟩ +lemma CB1_5_2I2PairMass_sound : CB1_5_2I2PairMass.Encloses (∑ a, CB1_5_2I2PairValue a) := by + exact contains_sound (pairSumBall_sound CB1_5_2I2PairP CB1_5_2I2PairValue CB1_5_2I2PairP_sound) (by decide +kernel) +def CB1_5_2I2PairMassTermLogWitness : LogWitness := ⟨0, 1, 1⟩ +def CB1_5_2I2PairMassTermLog : Ball := ⟨0, (10587911893 / 50000000000000000000000000000000)⟩ +lemma CB1_5_2I2PairMassTermLog_sound : CB1_5_2I2PairMassTermLog.Encloses (Real.log ((∑ a, CB1_5_2I2PairValue a))) := by + exact checkLog_sound logTwoBall_sound (CB1_5_2I2PairMass_sound) (w := CB1_5_2I2PairMassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB1_5_2I2PairMassTerm : Ball := ⟨0, (21175823787 / 100000000000000000000000000000000)⟩ +lemma CB1_5_2I2PairMassTerm_sound : CB1_5_2I2PairMassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_5_2I2PairValue a))) := by + exact contains_sound (entropyTerm_ball (CB1_5_2I2PairMass_sound) CB1_5_2I2PairMassTermLog_sound) (by decide +kernel) +def CB1_5_2I2PairH : Ball := ⟨(46989230332183785828872600023813 / 50000000000000000000000000000000), (90024460183 / 100000000000000000000000000000000)⟩ +lemma CB1_5_2I2PairH_sound : CB1_5_2I2PairH.Encloses (homogeneousEntropy CB1_5_2I2PairValue) := by + exact contains_sound (homogeneous_enclosed CB1_5_2I2PairValue CB1_5_2I2PairMassTerm_sound CB1_5_2I2PairEntropy_sound) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CB1_5_2I2R0Value (a : Fin 6) : ℝ := residualLaw (below (shape 1 5 2)) (fun u => (stageBLaw (shape 1 5 2) u : ℝ)) (stageBPriority (shape 1 5 2)) 2 (fun u a => (littleLaw (shape 1 5 2) u ((stageBPriority (shape 1 5 2)) 2) a : ℝ)) 0 a +def CB1_5_2I2R0Raw (a : Fin 6) : Ball := residualBall (below (shape 1 5 2)) B1_5_2Law (stageBPriority (shape 1 5 2)) 2 (fun u => B1_5_2Little u ((stageBPriority (shape 1 5 2)) 2)) 0 a +lemma CB1_5_2I2R0Raw_sound (a : Fin 6) : + (CB1_5_2I2R0Raw a).Encloses (CB1_5_2I2R0Value a) := by + exact residualBall_sound_on (below (shape 1 5 2)) B1_5_2Law (fun u => (stageBLaw (shape 1 5 2) u : ℝ)) (stageBPriority (shape 1 5 2)) 2 (fun u => B1_5_2Little u ((stageBPriority (shape 1 5 2)) 2)) (fun u a => (littleLaw (shape 1 5 2) u ((stageBPriority (shape 1 5 2)) 2) a : ℝ)) (fun u _ => B1_5_2Law_sound u) (fun u _ a => B1_5_2Little_sound u ((stageBPriority (shape 1 5 2)) 2) a) 0 a +def CB1_5_2I2R0Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB1_5_2I2R0Certificates_valid : + CB1_5_2I2R0Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_5_2I2R0CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB1_5_2I2R0P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_5_2I2R0Certificates (CB1_5_2I2R0CertificateIndex a)).input +lemma CB1_5_2I2R0P_check : ∀ a : Fin 6, contains (CB1_5_2I2R0Raw a) (CB1_5_2I2R0P a) = true := by + decide +kernel +lemma CB1_5_2I2R0P_sound (a : Fin 6) : + (CB1_5_2I2R0P a).Encloses (CB1_5_2I2R0Value a) := + contains_sound (CB1_5_2I2R0Raw_sound a) (CB1_5_2I2R0P_check a) +def CB1_5_2I2R0Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_5_2I2R0Certificates (CB1_5_2I2R0CertificateIndex a)).output +lemma CB1_5_2I2R0Terms_sound (a : Fin 6) : + (CB1_5_2I2R0Terms a).Encloses (Foundation.entropyTerm (CB1_5_2I2R0Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_5_2I2R0Certificates_valid + (CB1_5_2I2R0CertificateIndex a) (CB1_5_2I2R0P_sound a) +def CB1_5_2I2R0Entropy : Ball := ⟨0, 0⟩ +lemma CB1_5_2I2R0Entropy_sound : CB1_5_2I2R0Entropy.Encloses (Foundation.finiteEntropy CB1_5_2I2R0Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_5_2I2R0Value CB1_5_2I2R0Terms CB1_5_2I2R0Terms_sound) (by decide +kernel) +def CB1_5_2I2R0Mass : Ball := ⟨0, 0⟩ +lemma CB1_5_2I2R0Mass_sound : CB1_5_2I2R0Mass.Encloses (∑ a, CB1_5_2I2R0Value a) := by + exact contains_sound (finSumBall_sound 6 CB1_5_2I2R0P CB1_5_2I2R0Value CB1_5_2I2R0P_sound) (by decide +kernel) +def CB1_5_2I2R0MassTerm : Ball := .exact 0 +lemma CB1_5_2I2R0MassTerm_sound : CB1_5_2I2R0MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_5_2I2R0Value a))) := + entropyTerm_zero_ball (CB1_5_2I2R0Mass_sound) +def CB1_5_2I2R0H : Ball := ⟨0, 0⟩ +lemma CB1_5_2I2R0H_sound : CB1_5_2I2R0H.Encloses (homogeneousEntropy CB1_5_2I2R0Value) := by + exact contains_sound (homogeneous_enclosed CB1_5_2I2R0Value CB1_5_2I2R0MassTerm_sound CB1_5_2I2R0Entropy_sound) (by decide +kernel) +def CB1_5_2I2R1Value (a : Fin 6) : ℝ := residualLaw (below (shape 1 5 2)) (fun u => (stageBLaw (shape 1 5 2) u : ℝ)) (stageBPriority (shape 1 5 2)) 2 (fun u a => (littleLaw (shape 1 5 2) u ((stageBPriority (shape 1 5 2)) 2) a : ℝ)) 1 a +def CB1_5_2I2R1Raw (a : Fin 6) : Ball := residualBall (below (shape 1 5 2)) B1_5_2Law (stageBPriority (shape 1 5 2)) 2 (fun u => B1_5_2Little u ((stageBPriority (shape 1 5 2)) 2)) 1 a +lemma CB1_5_2I2R1Raw_sound (a : Fin 6) : + (CB1_5_2I2R1Raw a).Encloses (CB1_5_2I2R1Value a) := by + exact residualBall_sound_on (below (shape 1 5 2)) B1_5_2Law (fun u => (stageBLaw (shape 1 5 2) u : ℝ)) (stageBPriority (shape 1 5 2)) 2 (fun u => B1_5_2Little u ((stageBPriority (shape 1 5 2)) 2)) (fun u a => (littleLaw (shape 1 5 2) u ((stageBPriority (shape 1 5 2)) 2) a : ℝ)) (fun u _ => B1_5_2Law_sound u) (fun u _ a => B1_5_2Little_sound u ((stageBPriority (shape 1 5 2)) 2) a) 1 a +def CB1_5_2I2R1Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(355899712240329557865752533361 / 50000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ ⟨(1759970095016132032706174310353 / 50000000000000000000000000000000), (678282269 / 50000000000000000000000000000000)⟩ ⟨(-494512930043526220764008265666271 / 100000000000000000000000000000000), (744462553 / 390625000000000000000000000000)⟩ ⟨-8, 355899712240329557865752533361, 195312500000000000000000000000⟩] +lemma CB1_5_2I2R1Certificates_valid : + CB1_5_2I2R1Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_5_2I2R1CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | 1 => 1 + | _ => 0 +def CB1_5_2I2R1P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_5_2I2R1Certificates (CB1_5_2I2R1CertificateIndex a)).input +lemma CB1_5_2I2R1P_check : ∀ a : Fin 6, contains (CB1_5_2I2R1Raw a) (CB1_5_2I2R1P a) = true := by + decide +kernel +lemma CB1_5_2I2R1P_sound (a : Fin 6) : + (CB1_5_2I2R1P a).Encloses (CB1_5_2I2R1Value a) := + contains_sound (CB1_5_2I2R1Raw_sound a) (CB1_5_2I2R1P_check a) +def CB1_5_2I2R1Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_5_2I2R1Certificates (CB1_5_2I2R1CertificateIndex a)).output +lemma CB1_5_2I2R1Terms_sound (a : Fin 6) : + (CB1_5_2I2R1Terms a).Encloses (Foundation.entropyTerm (CB1_5_2I2R1Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_5_2I2R1Certificates_valid + (CB1_5_2I2R1CertificateIndex a) (CB1_5_2I2R1P_sound a) +def CB1_5_2I2R1Entropy : Ball := ⟨(1759970095016132032706174310353 / 50000000000000000000000000000000), (678282269 / 50000000000000000000000000000000)⟩ +lemma CB1_5_2I2R1Entropy_sound : CB1_5_2I2R1Entropy.Encloses (Foundation.finiteEntropy CB1_5_2I2R1Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_5_2I2R1Value CB1_5_2I2R1Terms CB1_5_2I2R1Terms_sound) (by decide +kernel) +def CB1_5_2I2R1Mass : Ball := ⟨(355899712240329557865752533361 / 50000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +lemma CB1_5_2I2R1Mass_sound : CB1_5_2I2R1Mass.Encloses (∑ a, CB1_5_2I2R1Value a) := by + exact contains_sound (finSumBall_sound 6 CB1_5_2I2R1P CB1_5_2I2R1Value CB1_5_2I2R1P_sound) (by decide +kernel) +def CB1_5_2I2R1MassTermLogWitness : LogWitness := ⟨-8, 355899712240329557865752533361, 195312500000000000000000000000⟩ +def CB1_5_2I2R1MassTermLog : Ball := ⟨(-494512930043526220764008265666271 / 100000000000000000000000000000000), (744462553 / 390625000000000000000000000000)⟩ +lemma CB1_5_2I2R1MassTermLog_sound : CB1_5_2I2R1MassTermLog.Encloses (Real.log ((∑ a, CB1_5_2I2R1Value a))) := by + exact checkLog_sound logTwoBall_sound (CB1_5_2I2R1Mass_sound) (w := CB1_5_2I2R1MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB1_5_2I2R1MassTerm : Ball := ⟨(1759970095016132032706174310353 / 50000000000000000000000000000000), (678282269 / 50000000000000000000000000000000)⟩ +lemma CB1_5_2I2R1MassTerm_sound : CB1_5_2I2R1MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_5_2I2R1Value a))) := by + exact contains_sound (entropyTerm_ball (CB1_5_2I2R1Mass_sound) CB1_5_2I2R1MassTermLog_sound) (by decide +kernel) +def CB1_5_2I2R1H : Ball := ⟨0, (678282269 / 25000000000000000000000000000000)⟩ +lemma CB1_5_2I2R1H_sound : CB1_5_2I2R1H.Encloses (homogeneousEntropy CB1_5_2I2R1Value) := by + exact contains_sound (homogeneous_enclosed CB1_5_2I2R1Value CB1_5_2I2R1MassTerm_sound CB1_5_2I2R1Entropy_sound) (by decide +kernel) +def CB1_5_2I2R2Value (a : Fin 6) : ℝ := residualLaw (below (shape 1 5 2)) (fun u => (stageBLaw (shape 1 5 2) u : ℝ)) (stageBPriority (shape 1 5 2)) 2 (fun u a => (littleLaw (shape 1 5 2) u ((stageBPriority (shape 1 5 2)) 2) a : ℝ)) 2 a +def CB1_5_2I2R2Raw (a : Fin 6) : Ball := residualBall (below (shape 1 5 2)) B1_5_2Law (stageBPriority (shape 1 5 2)) 2 (fun u => B1_5_2Little u ((stageBPriority (shape 1 5 2)) 2)) 2 a +lemma CB1_5_2I2R2Raw_sound (a : Fin 6) : + (CB1_5_2I2R2Raw a).Encloses (CB1_5_2I2R2Value a) := by + exact residualBall_sound_on (below (shape 1 5 2)) B1_5_2Law (fun u => (stageBLaw (shape 1 5 2) u : ℝ)) (stageBPriority (shape 1 5 2)) 2 (fun u => B1_5_2Little u ((stageBPriority (shape 1 5 2)) 2)) (fun u a => (littleLaw (shape 1 5 2) u ((stageBPriority (shape 1 5 2)) 2) a : ℝ)) (fun u _ => B1_5_2Law_sound u) (fun u _ a => B1_5_2Little_sound u ((stageBPriority (shape 1 5 2)) 2) a) 2 a +def CB1_5_2I2R2Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(31383643450148768372987832300631 / 100000000000000000000000000000000), (1 / 6250000000000000000000000000000)⟩ ⟨(7273996296179983918196812697711 / 20000000000000000000000000000000), (9968617521 / 50000000000000000000000000000000)⟩ ⟨(-1448604172531452622110362079163 / 1250000000000000000000000000000), (63527471099 / 100000000000000000000000000000000)⟩ ⟨-2, 31383643450148768372987832300631, 25000000000000000000000000000000⟩, + .log ⟨(59018397940938413783238498469 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(795795704258789383459281432821 / 100000000000000000000000000000000), (27494791 / 10000000000000000000000000000000)⟩ ⟨(-67419290596058489447789036249549 / 10000000000000000000000000000000), (2911675767 / 1250000000000000000000000000000)⟩ ⟨-10, 59018397940938413783238498469, 48828125000000000000000000000⟩] +lemma CB1_5_2I2R2Certificates_valid : + CB1_5_2I2R2Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_5_2I2R2CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | 2 => 1 + | 3 => 2 + | _ => 0 +def CB1_5_2I2R2P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_5_2I2R2Certificates (CB1_5_2I2R2CertificateIndex a)).input +lemma CB1_5_2I2R2P_check : ∀ a : Fin 6, contains (CB1_5_2I2R2Raw a) (CB1_5_2I2R2P a) = true := by + decide +kernel +lemma CB1_5_2I2R2P_sound (a : Fin 6) : + (CB1_5_2I2R2P a).Encloses (CB1_5_2I2R2Value a) := + contains_sound (CB1_5_2I2R2Raw_sound a) (CB1_5_2I2R2P_check a) +def CB1_5_2I2R2Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_5_2I2R2Certificates (CB1_5_2I2R2CertificateIndex a)).output +lemma CB1_5_2I2R2Terms_sound (a : Fin 6) : + (CB1_5_2I2R2Terms a).Encloses (Foundation.entropyTerm (CB1_5_2I2R2Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_5_2I2R2Certificates_valid + (CB1_5_2I2R2CertificateIndex a) (CB1_5_2I2R2P_sound a) +def CB1_5_2I2R2Entropy : Ball := ⟨(1161430537036209655451354528793 / 3125000000000000000000000000000), (2526522869 / 12500000000000000000000000000000)⟩ +lemma CB1_5_2I2R2Entropy_sound : CB1_5_2I2R2Entropy.Encloses (Foundation.finiteEntropy CB1_5_2I2R2Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_5_2I2R2Value CB1_5_2I2R2Terms CB1_5_2I2R2Terms_sound) (by decide +kernel) +def CB1_5_2I2R2Mass : Ball := ⟨(31501680246030645200554309297569 / 100000000000000000000000000000000), (17 / 100000000000000000000000000000000)⟩ +lemma CB1_5_2I2R2Mass_sound : CB1_5_2I2R2Mass.Encloses (∑ a, CB1_5_2I2R2Value a) := by + exact contains_sound (finSumBall_sound 6 CB1_5_2I2R2P CB1_5_2I2R2Value CB1_5_2I2R2P_sound) (by decide +kernel) +def CB1_5_2I2R2MassTermLogWitness : LogWitness := ⟨-2, 31501680246030645200554309297569, 25000000000000000000000000000000⟩ +def CB1_5_2I2R2MassTermLog : Ball := ⟨(-115512930043526220764008380213919 / 100000000000000000000000000000000), (31763735551 / 50000000000000000000000000000000)⟩ +lemma CB1_5_2I2R2MassTermLog_sound : CB1_5_2I2R2MassTermLog.Encloses (Real.log ((∑ a, CB1_5_2I2R2Value a))) := by + exact checkLog_sound logTwoBall_sound (CB1_5_2I2R2Mass_sound) (w := CB1_5_2I2R2MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB1_5_2I2R2MassTerm : Ball := ⟨(9097128466283174464330993949041 / 25000000000000000000000000000000), (4002444167 / 20000000000000000000000000000000)⟩ +lemma CB1_5_2I2R2MassTerm_sound : CB1_5_2I2R2MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_5_2I2R2Value a))) := by + exact contains_sound (entropyTerm_ball (CB1_5_2I2R2Mass_sound) CB1_5_2I2R2MassTermLog_sound) (by decide +kernel) +def CB1_5_2I2R2H : Ball := ⟨(194315830006502779279842281303 / 25000000000000000000000000000000), (40224403787 / 100000000000000000000000000000000)⟩ +lemma CB1_5_2I2R2H_sound : CB1_5_2I2R2H.Encloses (homogeneousEntropy CB1_5_2I2R2Value) := by + exact contains_sound (homogeneous_enclosed CB1_5_2I2R2Value CB1_5_2I2R2MassTerm_sound CB1_5_2I2R2Entropy_sound) (by decide +kernel) +def CB1_5_2I2R3Value (a : Fin 6) : ℝ := residualLaw (below (shape 1 5 2)) (fun u => (stageBLaw (shape 1 5 2) u : ℝ)) (stageBPriority (shape 1 5 2)) 2 (fun u a => (littleLaw (shape 1 5 2) u ((stageBPriority (shape 1 5 2)) 2) a : ℝ)) 3 a +def CB1_5_2I2R3Raw (a : Fin 6) : Ball := residualBall (below (shape 1 5 2)) B1_5_2Law (stageBPriority (shape 1 5 2)) 2 (fun u => B1_5_2Little u ((stageBPriority (shape 1 5 2)) 2)) 3 a +lemma CB1_5_2I2R3Raw_sound (a : Fin 6) : + (CB1_5_2I2R3Raw a).Encloses (CB1_5_2I2R3Value a) := by + exact residualBall_sound_on (below (shape 1 5 2)) B1_5_2Law (fun u => (stageBLaw (shape 1 5 2) u : ℝ)) (stageBPriority (shape 1 5 2)) 2 (fun u => B1_5_2Little u ((stageBPriority (shape 1 5 2)) 2)) (fun u a => (littleLaw (shape 1 5 2) u ((stageBPriority (shape 1 5 2)) 2) a : ℝ)) (fun u _ => B1_5_2Law_sound u) (fun u _ a => B1_5_2Little_sound u ((stageBPriority (shape 1 5 2)) 2) a) 3 a +def CB1_5_2I2R3Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB1_5_2I2R3Certificates_valid : + CB1_5_2I2R3Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_5_2I2R3CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB1_5_2I2R3P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_5_2I2R3Certificates (CB1_5_2I2R3CertificateIndex a)).input +lemma CB1_5_2I2R3P_check : ∀ a : Fin 6, contains (CB1_5_2I2R3Raw a) (CB1_5_2I2R3P a) = true := by + decide +kernel +lemma CB1_5_2I2R3P_sound (a : Fin 6) : + (CB1_5_2I2R3P a).Encloses (CB1_5_2I2R3Value a) := + contains_sound (CB1_5_2I2R3Raw_sound a) (CB1_5_2I2R3P_check a) +def CB1_5_2I2R3Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_5_2I2R3Certificates (CB1_5_2I2R3CertificateIndex a)).output +lemma CB1_5_2I2R3Terms_sound (a : Fin 6) : + (CB1_5_2I2R3Terms a).Encloses (Foundation.entropyTerm (CB1_5_2I2R3Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_5_2I2R3Certificates_valid + (CB1_5_2I2R3CertificateIndex a) (CB1_5_2I2R3P_sound a) +def CB1_5_2I2R3Entropy : Ball := ⟨0, 0⟩ +lemma CB1_5_2I2R3Entropy_sound : CB1_5_2I2R3Entropy.Encloses (Foundation.finiteEntropy CB1_5_2I2R3Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_5_2I2R3Value CB1_5_2I2R3Terms CB1_5_2I2R3Terms_sound) (by decide +kernel) +def CB1_5_2I2R3Mass : Ball := ⟨0, 0⟩ +lemma CB1_5_2I2R3Mass_sound : CB1_5_2I2R3Mass.Encloses (∑ a, CB1_5_2I2R3Value a) := by + exact contains_sound (finSumBall_sound 6 CB1_5_2I2R3P CB1_5_2I2R3Value CB1_5_2I2R3P_sound) (by decide +kernel) +def CB1_5_2I2R3MassTerm : Ball := .exact 0 +lemma CB1_5_2I2R3MassTerm_sound : CB1_5_2I2R3MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_5_2I2R3Value a))) := + entropyTerm_zero_ball (CB1_5_2I2R3Mass_sound) +def CB1_5_2I2R3H : Ball := ⟨0, 0⟩ +lemma CB1_5_2I2R3H_sound : CB1_5_2I2R3H.Encloses (homogeneousEntropy CB1_5_2I2R3Value) := by + exact contains_sound (homogeneous_enclosed CB1_5_2I2R3Value CB1_5_2I2R3MassTerm_sound CB1_5_2I2R3Entropy_sound) (by decide +kernel) +def CB1_5_2I2R4Value (a : Fin 6) : ℝ := residualLaw (below (shape 1 5 2)) (fun u => (stageBLaw (shape 1 5 2) u : ℝ)) (stageBPriority (shape 1 5 2)) 2 (fun u a => (littleLaw (shape 1 5 2) u ((stageBPriority (shape 1 5 2)) 2) a : ℝ)) 4 a +def CB1_5_2I2R4Raw (a : Fin 6) : Ball := residualBall (below (shape 1 5 2)) B1_5_2Law (stageBPriority (shape 1 5 2)) 2 (fun u => B1_5_2Little u ((stageBPriority (shape 1 5 2)) 2)) 4 a +lemma CB1_5_2I2R4Raw_sound (a : Fin 6) : + (CB1_5_2I2R4Raw a).Encloses (CB1_5_2I2R4Value a) := by + exact residualBall_sound_on (below (shape 1 5 2)) B1_5_2Law (fun u => (stageBLaw (shape 1 5 2) u : ℝ)) (stageBPriority (shape 1 5 2)) 2 (fun u => B1_5_2Little u ((stageBPriority (shape 1 5 2)) 2)) (fun u a => (littleLaw (shape 1 5 2) u ((stageBPriority (shape 1 5 2)) 2) a : ℝ)) (fun u _ => B1_5_2Law_sound u) (fun u _ a => B1_5_2Little_sound u ((stageBPriority (shape 1 5 2)) 2) a) 4 a +def CB1_5_2I2R4Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB1_5_2I2R4Certificates_valid : + CB1_5_2I2R4Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_5_2I2R4CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB1_5_2I2R4P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_5_2I2R4Certificates (CB1_5_2I2R4CertificateIndex a)).input +lemma CB1_5_2I2R4P_check : ∀ a : Fin 6, contains (CB1_5_2I2R4Raw a) (CB1_5_2I2R4P a) = true := by + decide +kernel +lemma CB1_5_2I2R4P_sound (a : Fin 6) : + (CB1_5_2I2R4P a).Encloses (CB1_5_2I2R4Value a) := + contains_sound (CB1_5_2I2R4Raw_sound a) (CB1_5_2I2R4P_check a) +def CB1_5_2I2R4Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_5_2I2R4Certificates (CB1_5_2I2R4CertificateIndex a)).output +lemma CB1_5_2I2R4Terms_sound (a : Fin 6) : + (CB1_5_2I2R4Terms a).Encloses (Foundation.entropyTerm (CB1_5_2I2R4Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_5_2I2R4Certificates_valid + (CB1_5_2I2R4CertificateIndex a) (CB1_5_2I2R4P_sound a) +def CB1_5_2I2R4Entropy : Ball := ⟨0, 0⟩ +lemma CB1_5_2I2R4Entropy_sound : CB1_5_2I2R4Entropy.Encloses (Foundation.finiteEntropy CB1_5_2I2R4Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_5_2I2R4Value CB1_5_2I2R4Terms CB1_5_2I2R4Terms_sound) (by decide +kernel) +def CB1_5_2I2R4Mass : Ball := ⟨0, 0⟩ +lemma CB1_5_2I2R4Mass_sound : CB1_5_2I2R4Mass.Encloses (∑ a, CB1_5_2I2R4Value a) := by + exact contains_sound (finSumBall_sound 6 CB1_5_2I2R4P CB1_5_2I2R4Value CB1_5_2I2R4P_sound) (by decide +kernel) +def CB1_5_2I2R4MassTerm : Ball := .exact 0 +lemma CB1_5_2I2R4MassTerm_sound : CB1_5_2I2R4MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_5_2I2R4Value a))) := + entropyTerm_zero_ball (CB1_5_2I2R4Mass_sound) +def CB1_5_2I2R4H : Ball := ⟨0, 0⟩ +lemma CB1_5_2I2R4H_sound : CB1_5_2I2R4H.Encloses (homogeneousEntropy CB1_5_2I2R4Value) := by + exact contains_sound (homogeneous_enclosed CB1_5_2I2R4Value CB1_5_2I2R4MassTerm_sound CB1_5_2I2R4Entropy_sound) (by decide +kernel) +def CB1_5_2I2R5Value (a : Fin 6) : ℝ := residualLaw (below (shape 1 5 2)) (fun u => (stageBLaw (shape 1 5 2) u : ℝ)) (stageBPriority (shape 1 5 2)) 2 (fun u a => (littleLaw (shape 1 5 2) u ((stageBPriority (shape 1 5 2)) 2) a : ℝ)) 5 a +def CB1_5_2I2R5Raw (a : Fin 6) : Ball := residualBall (below (shape 1 5 2)) B1_5_2Law (stageBPriority (shape 1 5 2)) 2 (fun u => B1_5_2Little u ((stageBPriority (shape 1 5 2)) 2)) 5 a +lemma CB1_5_2I2R5Raw_sound (a : Fin 6) : + (CB1_5_2I2R5Raw a).Encloses (CB1_5_2I2R5Value a) := by + exact residualBall_sound_on (below (shape 1 5 2)) B1_5_2Law (fun u => (stageBLaw (shape 1 5 2) u : ℝ)) (stageBPriority (shape 1 5 2)) 2 (fun u => B1_5_2Little u ((stageBPriority (shape 1 5 2)) 2)) (fun u a => (littleLaw (shape 1 5 2) u ((stageBPriority (shape 1 5 2)) 2) a : ℝ)) (fun u _ => B1_5_2Law_sound u) (fun u _ a => B1_5_2Little_sound u ((stageBPriority (shape 1 5 2)) 2) a) 5 a +def CB1_5_2I2R5Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB1_5_2I2R5Certificates_valid : + CB1_5_2I2R5Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_5_2I2R5CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB1_5_2I2R5P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_5_2I2R5Certificates (CB1_5_2I2R5CertificateIndex a)).input +lemma CB1_5_2I2R5P_check : ∀ a : Fin 6, contains (CB1_5_2I2R5Raw a) (CB1_5_2I2R5P a) = true := by + decide +kernel +lemma CB1_5_2I2R5P_sound (a : Fin 6) : + (CB1_5_2I2R5P a).Encloses (CB1_5_2I2R5Value a) := + contains_sound (CB1_5_2I2R5Raw_sound a) (CB1_5_2I2R5P_check a) +def CB1_5_2I2R5Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_5_2I2R5Certificates (CB1_5_2I2R5CertificateIndex a)).output +lemma CB1_5_2I2R5Terms_sound (a : Fin 6) : + (CB1_5_2I2R5Terms a).Encloses (Foundation.entropyTerm (CB1_5_2I2R5Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_5_2I2R5Certificates_valid + (CB1_5_2I2R5CertificateIndex a) (CB1_5_2I2R5P_sound a) +def CB1_5_2I2R5Entropy : Ball := ⟨0, 0⟩ +lemma CB1_5_2I2R5Entropy_sound : CB1_5_2I2R5Entropy.Encloses (Foundation.finiteEntropy CB1_5_2I2R5Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_5_2I2R5Value CB1_5_2I2R5Terms CB1_5_2I2R5Terms_sound) (by decide +kernel) +def CB1_5_2I2R5Mass : Ball := ⟨0, 0⟩ +lemma CB1_5_2I2R5Mass_sound : CB1_5_2I2R5Mass.Encloses (∑ a, CB1_5_2I2R5Value a) := by + exact contains_sound (finSumBall_sound 6 CB1_5_2I2R5P CB1_5_2I2R5Value CB1_5_2I2R5P_sound) (by decide +kernel) +def CB1_5_2I2R5MassTerm : Ball := .exact 0 +lemma CB1_5_2I2R5MassTerm_sound : CB1_5_2I2R5MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_5_2I2R5Value a))) := + entropyTerm_zero_ball (CB1_5_2I2R5Mass_sound) +def CB1_5_2I2R5H : Ball := ⟨0, 0⟩ +lemma CB1_5_2I2R5H_sound : CB1_5_2I2R5H.Encloses (homogeneousEntropy CB1_5_2I2R5Value) := by + exact contains_sound (homogeneous_enclosed CB1_5_2I2R5Value CB1_5_2I2R5MassTerm_sound CB1_5_2I2R5Entropy_sound) (by decide +kernel) +def CB1_5_2I2R6Value (a : Fin 6) : ℝ := residualLaw (below (shape 1 5 2)) (fun u => (stageBLaw (shape 1 5 2) u : ℝ)) (stageBPriority (shape 1 5 2)) 2 (fun u a => (littleLaw (shape 1 5 2) u ((stageBPriority (shape 1 5 2)) 2) a : ℝ)) 6 a +def CB1_5_2I2R6Raw (a : Fin 6) : Ball := residualBall (below (shape 1 5 2)) B1_5_2Law (stageBPriority (shape 1 5 2)) 2 (fun u => B1_5_2Little u ((stageBPriority (shape 1 5 2)) 2)) 6 a +lemma CB1_5_2I2R6Raw_sound (a : Fin 6) : + (CB1_5_2I2R6Raw a).Encloses (CB1_5_2I2R6Value a) := by + exact residualBall_sound_on (below (shape 1 5 2)) B1_5_2Law (fun u => (stageBLaw (shape 1 5 2) u : ℝ)) (stageBPriority (shape 1 5 2)) 2 (fun u => B1_5_2Little u ((stageBPriority (shape 1 5 2)) 2)) (fun u a => (littleLaw (shape 1 5 2) u ((stageBPriority (shape 1 5 2)) 2) a : ℝ)) (fun u _ => B1_5_2Law_sound u) (fun u _ a => B1_5_2Little_sound u ((stageBPriority (shape 1 5 2)) 2) a) 6 a +def CB1_5_2I2R6Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB1_5_2I2R6Certificates_valid : + CB1_5_2I2R6Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_5_2I2R6CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB1_5_2I2R6P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_5_2I2R6Certificates (CB1_5_2I2R6CertificateIndex a)).input +lemma CB1_5_2I2R6P_check : ∀ a : Fin 6, contains (CB1_5_2I2R6Raw a) (CB1_5_2I2R6P a) = true := by + decide +kernel +lemma CB1_5_2I2R6P_sound (a : Fin 6) : + (CB1_5_2I2R6P a).Encloses (CB1_5_2I2R6Value a) := + contains_sound (CB1_5_2I2R6Raw_sound a) (CB1_5_2I2R6P_check a) +def CB1_5_2I2R6Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_5_2I2R6Certificates (CB1_5_2I2R6CertificateIndex a)).output +lemma CB1_5_2I2R6Terms_sound (a : Fin 6) : + (CB1_5_2I2R6Terms a).Encloses (Foundation.entropyTerm (CB1_5_2I2R6Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_5_2I2R6Certificates_valid + (CB1_5_2I2R6CertificateIndex a) (CB1_5_2I2R6P_sound a) +def CB1_5_2I2R6Entropy : Ball := ⟨0, 0⟩ +lemma CB1_5_2I2R6Entropy_sound : CB1_5_2I2R6Entropy.Encloses (Foundation.finiteEntropy CB1_5_2I2R6Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_5_2I2R6Value CB1_5_2I2R6Terms CB1_5_2I2R6Terms_sound) (by decide +kernel) +def CB1_5_2I2R6Mass : Ball := ⟨0, 0⟩ +lemma CB1_5_2I2R6Mass_sound : CB1_5_2I2R6Mass.Encloses (∑ a, CB1_5_2I2R6Value a) := by + exact contains_sound (finSumBall_sound 6 CB1_5_2I2R6P CB1_5_2I2R6Value CB1_5_2I2R6P_sound) (by decide +kernel) +def CB1_5_2I2R6MassTerm : Ball := .exact 0 +lemma CB1_5_2I2R6MassTerm_sound : CB1_5_2I2R6MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_5_2I2R6Value a))) := + entropyTerm_zero_ball (CB1_5_2I2R6Mass_sound) +def CB1_5_2I2R6H : Ball := ⟨0, 0⟩ +lemma CB1_5_2I2R6H_sound : CB1_5_2I2R6H.Encloses (homogeneousEntropy CB1_5_2I2R6Value) := by + exact contains_sound (homogeneous_enclosed CB1_5_2I2R6Value CB1_5_2I2R6MassTerm_sound CB1_5_2I2R6Entropy_sound) (by decide +kernel) +def CB1_5_2I2R7Value (a : Fin 6) : ℝ := residualLaw (below (shape 1 5 2)) (fun u => (stageBLaw (shape 1 5 2) u : ℝ)) (stageBPriority (shape 1 5 2)) 2 (fun u a => (littleLaw (shape 1 5 2) u ((stageBPriority (shape 1 5 2)) 2) a : ℝ)) 7 a +def CB1_5_2I2R7Raw (a : Fin 6) : Ball := residualBall (below (shape 1 5 2)) B1_5_2Law (stageBPriority (shape 1 5 2)) 2 (fun u => B1_5_2Little u ((stageBPriority (shape 1 5 2)) 2)) 7 a +lemma CB1_5_2I2R7Raw_sound (a : Fin 6) : + (CB1_5_2I2R7Raw a).Encloses (CB1_5_2I2R7Value a) := by + exact residualBall_sound_on (below (shape 1 5 2)) B1_5_2Law (fun u => (stageBLaw (shape 1 5 2) u : ℝ)) (stageBPriority (shape 1 5 2)) 2 (fun u => B1_5_2Little u ((stageBPriority (shape 1 5 2)) 2)) (fun u a => (littleLaw (shape 1 5 2) u ((stageBPriority (shape 1 5 2)) 2) a : ℝ)) (fun u _ => B1_5_2Law_sound u) (fun u _ a => B1_5_2Little_sound u ((stageBPriority (shape 1 5 2)) 2) a) 7 a +def CB1_5_2I2R7Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB1_5_2I2R7Certificates_valid : + CB1_5_2I2R7Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_5_2I2R7CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB1_5_2I2R7P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_5_2I2R7Certificates (CB1_5_2I2R7CertificateIndex a)).input +lemma CB1_5_2I2R7P_check : ∀ a : Fin 6, contains (CB1_5_2I2R7Raw a) (CB1_5_2I2R7P a) = true := by + decide +kernel +lemma CB1_5_2I2R7P_sound (a : Fin 6) : + (CB1_5_2I2R7P a).Encloses (CB1_5_2I2R7Value a) := + contains_sound (CB1_5_2I2R7Raw_sound a) (CB1_5_2I2R7P_check a) +def CB1_5_2I2R7Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_5_2I2R7Certificates (CB1_5_2I2R7CertificateIndex a)).output +lemma CB1_5_2I2R7Terms_sound (a : Fin 6) : + (CB1_5_2I2R7Terms a).Encloses (Foundation.entropyTerm (CB1_5_2I2R7Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_5_2I2R7Certificates_valid + (CB1_5_2I2R7CertificateIndex a) (CB1_5_2I2R7P_sound a) +def CB1_5_2I2R7Entropy : Ball := ⟨0, 0⟩ +lemma CB1_5_2I2R7Entropy_sound : CB1_5_2I2R7Entropy.Encloses (Foundation.finiteEntropy CB1_5_2I2R7Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_5_2I2R7Value CB1_5_2I2R7Terms CB1_5_2I2R7Terms_sound) (by decide +kernel) +def CB1_5_2I2R7Mass : Ball := ⟨0, 0⟩ +lemma CB1_5_2I2R7Mass_sound : CB1_5_2I2R7Mass.Encloses (∑ a, CB1_5_2I2R7Value a) := by + exact contains_sound (finSumBall_sound 6 CB1_5_2I2R7P CB1_5_2I2R7Value CB1_5_2I2R7P_sound) (by decide +kernel) +def CB1_5_2I2R7MassTerm : Ball := .exact 0 +lemma CB1_5_2I2R7MassTerm_sound : CB1_5_2I2R7MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_5_2I2R7Value a))) := + entropyTerm_zero_ball (CB1_5_2I2R7Mass_sound) +def CB1_5_2I2R7H : Ball := ⟨0, 0⟩ +lemma CB1_5_2I2R7H_sound : CB1_5_2I2R7H.Encloses (homogeneousEntropy CB1_5_2I2R7Value) := by + exact contains_sound (homogeneous_enclosed CB1_5_2I2R7Value CB1_5_2I2R7MassTerm_sound CB1_5_2I2R7Entropy_sound) (by decide +kernel) +def CB1_5_2I2R8Value (a : Fin 6) : ℝ := residualLaw (below (shape 1 5 2)) (fun u => (stageBLaw (shape 1 5 2) u : ℝ)) (stageBPriority (shape 1 5 2)) 2 (fun u a => (littleLaw (shape 1 5 2) u ((stageBPriority (shape 1 5 2)) 2) a : ℝ)) 8 a +def CB1_5_2I2R8Raw (a : Fin 6) : Ball := residualBall (below (shape 1 5 2)) B1_5_2Law (stageBPriority (shape 1 5 2)) 2 (fun u => B1_5_2Little u ((stageBPriority (shape 1 5 2)) 2)) 8 a +lemma CB1_5_2I2R8Raw_sound (a : Fin 6) : + (CB1_5_2I2R8Raw a).Encloses (CB1_5_2I2R8Value a) := by + exact residualBall_sound_on (below (shape 1 5 2)) B1_5_2Law (fun u => (stageBLaw (shape 1 5 2) u : ℝ)) (stageBPriority (shape 1 5 2)) 2 (fun u => B1_5_2Little u ((stageBPriority (shape 1 5 2)) 2)) (fun u a => (littleLaw (shape 1 5 2) u ((stageBPriority (shape 1 5 2)) 2) a : ℝ)) (fun u _ => B1_5_2Law_sound u) (fun u _ a => B1_5_2Little_sound u ((stageBPriority (shape 1 5 2)) 2) a) 8 a +def CB1_5_2I2R8Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB1_5_2I2R8Certificates_valid : + CB1_5_2I2R8Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_5_2I2R8CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB1_5_2I2R8P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_5_2I2R8Certificates (CB1_5_2I2R8CertificateIndex a)).input +lemma CB1_5_2I2R8P_check : ∀ a : Fin 6, contains (CB1_5_2I2R8Raw a) (CB1_5_2I2R8P a) = true := by + decide +kernel +lemma CB1_5_2I2R8P_sound (a : Fin 6) : + (CB1_5_2I2R8P a).Encloses (CB1_5_2I2R8Value a) := + contains_sound (CB1_5_2I2R8Raw_sound a) (CB1_5_2I2R8P_check a) +def CB1_5_2I2R8Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_5_2I2R8Certificates (CB1_5_2I2R8CertificateIndex a)).output +lemma CB1_5_2I2R8Terms_sound (a : Fin 6) : + (CB1_5_2I2R8Terms a).Encloses (Foundation.entropyTerm (CB1_5_2I2R8Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_5_2I2R8Certificates_valid + (CB1_5_2I2R8CertificateIndex a) (CB1_5_2I2R8P_sound a) +def CB1_5_2I2R8Entropy : Ball := ⟨0, 0⟩ +lemma CB1_5_2I2R8Entropy_sound : CB1_5_2I2R8Entropy.Encloses (Foundation.finiteEntropy CB1_5_2I2R8Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_5_2I2R8Value CB1_5_2I2R8Terms CB1_5_2I2R8Terms_sound) (by decide +kernel) +def CB1_5_2I2R8Mass : Ball := ⟨0, 0⟩ +lemma CB1_5_2I2R8Mass_sound : CB1_5_2I2R8Mass.Encloses (∑ a, CB1_5_2I2R8Value a) := by + exact contains_sound (finSumBall_sound 6 CB1_5_2I2R8P CB1_5_2I2R8Value CB1_5_2I2R8P_sound) (by decide +kernel) +def CB1_5_2I2R8MassTerm : Ball := .exact 0 +lemma CB1_5_2I2R8MassTerm_sound : CB1_5_2I2R8MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_5_2I2R8Value a))) := + entropyTerm_zero_ball (CB1_5_2I2R8Mass_sound) +def CB1_5_2I2R8H : Ball := ⟨0, 0⟩ +lemma CB1_5_2I2R8H_sound : CB1_5_2I2R8H.Encloses (homogeneousEntropy CB1_5_2I2R8Value) := by + exact contains_sound (homogeneous_enclosed CB1_5_2I2R8Value CB1_5_2I2R8MassTerm_sound CB1_5_2I2R8Entropy_sound) (by decide +kernel) +def CB1_5_2I2R9Value (a : Fin 6) : ℝ := residualLaw (below (shape 1 5 2)) (fun u => (stageBLaw (shape 1 5 2) u : ℝ)) (stageBPriority (shape 1 5 2)) 2 (fun u a => (littleLaw (shape 1 5 2) u ((stageBPriority (shape 1 5 2)) 2) a : ℝ)) 9 a +def CB1_5_2I2R9Raw (a : Fin 6) : Ball := residualBall (below (shape 1 5 2)) B1_5_2Law (stageBPriority (shape 1 5 2)) 2 (fun u => B1_5_2Little u ((stageBPriority (shape 1 5 2)) 2)) 9 a +lemma CB1_5_2I2R9Raw_sound (a : Fin 6) : + (CB1_5_2I2R9Raw a).Encloses (CB1_5_2I2R9Value a) := by + exact residualBall_sound_on (below (shape 1 5 2)) B1_5_2Law (fun u => (stageBLaw (shape 1 5 2) u : ℝ)) (stageBPriority (shape 1 5 2)) 2 (fun u => B1_5_2Little u ((stageBPriority (shape 1 5 2)) 2)) (fun u a => (littleLaw (shape 1 5 2) u ((stageBPriority (shape 1 5 2)) 2) a : ℝ)) (fun u _ => B1_5_2Law_sound u) (fun u _ a => B1_5_2Little_sound u ((stageBPriority (shape 1 5 2)) 2) a) 9 a +def CB1_5_2I2R9Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB1_5_2I2R9Certificates_valid : + CB1_5_2I2R9Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_5_2I2R9CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB1_5_2I2R9P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_5_2I2R9Certificates (CB1_5_2I2R9CertificateIndex a)).input +lemma CB1_5_2I2R9P_check : ∀ a : Fin 6, contains (CB1_5_2I2R9Raw a) (CB1_5_2I2R9P a) = true := by + decide +kernel +lemma CB1_5_2I2R9P_sound (a : Fin 6) : + (CB1_5_2I2R9P a).Encloses (CB1_5_2I2R9Value a) := + contains_sound (CB1_5_2I2R9Raw_sound a) (CB1_5_2I2R9P_check a) +def CB1_5_2I2R9Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_5_2I2R9Certificates (CB1_5_2I2R9CertificateIndex a)).output +lemma CB1_5_2I2R9Terms_sound (a : Fin 6) : + (CB1_5_2I2R9Terms a).Encloses (Foundation.entropyTerm (CB1_5_2I2R9Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_5_2I2R9Certificates_valid + (CB1_5_2I2R9CertificateIndex a) (CB1_5_2I2R9P_sound a) +def CB1_5_2I2R9Entropy : Ball := ⟨0, 0⟩ +lemma CB1_5_2I2R9Entropy_sound : CB1_5_2I2R9Entropy.Encloses (Foundation.finiteEntropy CB1_5_2I2R9Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_5_2I2R9Value CB1_5_2I2R9Terms CB1_5_2I2R9Terms_sound) (by decide +kernel) +def CB1_5_2I2R9Mass : Ball := ⟨0, 0⟩ +lemma CB1_5_2I2R9Mass_sound : CB1_5_2I2R9Mass.Encloses (∑ a, CB1_5_2I2R9Value a) := by + exact contains_sound (finSumBall_sound 6 CB1_5_2I2R9P CB1_5_2I2R9Value CB1_5_2I2R9P_sound) (by decide +kernel) +def CB1_5_2I2R9MassTerm : Ball := .exact 0 +lemma CB1_5_2I2R9MassTerm_sound : CB1_5_2I2R9MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_5_2I2R9Value a))) := + entropyTerm_zero_ball (CB1_5_2I2R9Mass_sound) +def CB1_5_2I2R9H : Ball := ⟨0, 0⟩ +lemma CB1_5_2I2R9H_sound : CB1_5_2I2R9H.Encloses (homogeneousEntropy CB1_5_2I2R9Value) := by + exact contains_sound (homogeneous_enclosed CB1_5_2I2R9Value CB1_5_2I2R9MassTerm_sound CB1_5_2I2R9Entropy_sound) (by decide +kernel) +def CB1_5_2I2R10Value (a : Fin 6) : ℝ := residualLaw (below (shape 1 5 2)) (fun u => (stageBLaw (shape 1 5 2) u : ℝ)) (stageBPriority (shape 1 5 2)) 2 (fun u a => (littleLaw (shape 1 5 2) u ((stageBPriority (shape 1 5 2)) 2) a : ℝ)) 10 a +def CB1_5_2I2R10Raw (a : Fin 6) : Ball := residualBall (below (shape 1 5 2)) B1_5_2Law (stageBPriority (shape 1 5 2)) 2 (fun u => B1_5_2Little u ((stageBPriority (shape 1 5 2)) 2)) 10 a +lemma CB1_5_2I2R10Raw_sound (a : Fin 6) : + (CB1_5_2I2R10Raw a).Encloses (CB1_5_2I2R10Value a) := by + exact residualBall_sound_on (below (shape 1 5 2)) B1_5_2Law (fun u => (stageBLaw (shape 1 5 2) u : ℝ)) (stageBPriority (shape 1 5 2)) 2 (fun u => B1_5_2Little u ((stageBPriority (shape 1 5 2)) 2)) (fun u a => (littleLaw (shape 1 5 2) u ((stageBPriority (shape 1 5 2)) 2) a : ℝ)) (fun u _ => B1_5_2Law_sound u) (fun u _ a => B1_5_2Little_sound u ((stageBPriority (shape 1 5 2)) 2) a) 10 a +def CB1_5_2I2R10Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB1_5_2I2R10Certificates_valid : + CB1_5_2I2R10Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_5_2I2R10CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB1_5_2I2R10P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_5_2I2R10Certificates (CB1_5_2I2R10CertificateIndex a)).input +lemma CB1_5_2I2R10P_check : ∀ a : Fin 6, contains (CB1_5_2I2R10Raw a) (CB1_5_2I2R10P a) = true := by + decide +kernel +lemma CB1_5_2I2R10P_sound (a : Fin 6) : + (CB1_5_2I2R10P a).Encloses (CB1_5_2I2R10Value a) := + contains_sound (CB1_5_2I2R10Raw_sound a) (CB1_5_2I2R10P_check a) +def CB1_5_2I2R10Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_5_2I2R10Certificates (CB1_5_2I2R10CertificateIndex a)).output +lemma CB1_5_2I2R10Terms_sound (a : Fin 6) : + (CB1_5_2I2R10Terms a).Encloses (Foundation.entropyTerm (CB1_5_2I2R10Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_5_2I2R10Certificates_valid + (CB1_5_2I2R10CertificateIndex a) (CB1_5_2I2R10P_sound a) +def CB1_5_2I2R10Entropy : Ball := ⟨0, 0⟩ +lemma CB1_5_2I2R10Entropy_sound : CB1_5_2I2R10Entropy.Encloses (Foundation.finiteEntropy CB1_5_2I2R10Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_5_2I2R10Value CB1_5_2I2R10Terms CB1_5_2I2R10Terms_sound) (by decide +kernel) +def CB1_5_2I2R10Mass : Ball := ⟨0, 0⟩ +lemma CB1_5_2I2R10Mass_sound : CB1_5_2I2R10Mass.Encloses (∑ a, CB1_5_2I2R10Value a) := by + exact contains_sound (finSumBall_sound 6 CB1_5_2I2R10P CB1_5_2I2R10Value CB1_5_2I2R10P_sound) (by decide +kernel) +def CB1_5_2I2R10MassTerm : Ball := .exact 0 +lemma CB1_5_2I2R10MassTerm_sound : CB1_5_2I2R10MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_5_2I2R10Value a))) := + entropyTerm_zero_ball (CB1_5_2I2R10Mass_sound) +def CB1_5_2I2R10H : Ball := ⟨0, 0⟩ +lemma CB1_5_2I2R10H_sound : CB1_5_2I2R10H.Encloses (homogeneousEntropy CB1_5_2I2R10Value) := by + exact contains_sound (homogeneous_enclosed CB1_5_2I2R10Value CB1_5_2I2R10MassTerm_sound CB1_5_2I2R10Entropy_sound) (by decide +kernel) +def CB1_5_2I2R11Value (a : Fin 6) : ℝ := residualLaw (below (shape 1 5 2)) (fun u => (stageBLaw (shape 1 5 2) u : ℝ)) (stageBPriority (shape 1 5 2)) 2 (fun u a => (littleLaw (shape 1 5 2) u ((stageBPriority (shape 1 5 2)) 2) a : ℝ)) 11 a +def CB1_5_2I2R11Raw (a : Fin 6) : Ball := residualBall (below (shape 1 5 2)) B1_5_2Law (stageBPriority (shape 1 5 2)) 2 (fun u => B1_5_2Little u ((stageBPriority (shape 1 5 2)) 2)) 11 a +lemma CB1_5_2I2R11Raw_sound (a : Fin 6) : + (CB1_5_2I2R11Raw a).Encloses (CB1_5_2I2R11Value a) := by + exact residualBall_sound_on (below (shape 1 5 2)) B1_5_2Law (fun u => (stageBLaw (shape 1 5 2) u : ℝ)) (stageBPriority (shape 1 5 2)) 2 (fun u => B1_5_2Little u ((stageBPriority (shape 1 5 2)) 2)) (fun u a => (littleLaw (shape 1 5 2) u ((stageBPriority (shape 1 5 2)) 2) a : ℝ)) (fun u _ => B1_5_2Law_sound u) (fun u _ a => B1_5_2Little_sound u ((stageBPriority (shape 1 5 2)) 2) a) 11 a +def CB1_5_2I2R11Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB1_5_2I2R11Certificates_valid : + CB1_5_2I2R11Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_5_2I2R11CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB1_5_2I2R11P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_5_2I2R11Certificates (CB1_5_2I2R11CertificateIndex a)).input +lemma CB1_5_2I2R11P_check : ∀ a : Fin 6, contains (CB1_5_2I2R11Raw a) (CB1_5_2I2R11P a) = true := by + decide +kernel +lemma CB1_5_2I2R11P_sound (a : Fin 6) : + (CB1_5_2I2R11P a).Encloses (CB1_5_2I2R11Value a) := + contains_sound (CB1_5_2I2R11Raw_sound a) (CB1_5_2I2R11P_check a) +def CB1_5_2I2R11Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_5_2I2R11Certificates (CB1_5_2I2R11CertificateIndex a)).output +lemma CB1_5_2I2R11Terms_sound (a : Fin 6) : + (CB1_5_2I2R11Terms a).Encloses (Foundation.entropyTerm (CB1_5_2I2R11Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_5_2I2R11Certificates_valid + (CB1_5_2I2R11CertificateIndex a) (CB1_5_2I2R11P_sound a) +def CB1_5_2I2R11Entropy : Ball := ⟨0, 0⟩ +lemma CB1_5_2I2R11Entropy_sound : CB1_5_2I2R11Entropy.Encloses (Foundation.finiteEntropy CB1_5_2I2R11Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_5_2I2R11Value CB1_5_2I2R11Terms CB1_5_2I2R11Terms_sound) (by decide +kernel) +def CB1_5_2I2R11Mass : Ball := ⟨0, 0⟩ +lemma CB1_5_2I2R11Mass_sound : CB1_5_2I2R11Mass.Encloses (∑ a, CB1_5_2I2R11Value a) := by + exact contains_sound (finSumBall_sound 6 CB1_5_2I2R11P CB1_5_2I2R11Value CB1_5_2I2R11P_sound) (by decide +kernel) +def CB1_5_2I2R11MassTerm : Ball := .exact 0 +lemma CB1_5_2I2R11MassTerm_sound : CB1_5_2I2R11MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_5_2I2R11Value a))) := + entropyTerm_zero_ball (CB1_5_2I2R11Mass_sound) +def CB1_5_2I2R11H : Ball := ⟨0, 0⟩ +lemma CB1_5_2I2R11H_sound : CB1_5_2I2R11H.Encloses (homogeneousEntropy CB1_5_2I2R11Value) := by + exact contains_sound (homogeneous_enclosed CB1_5_2I2R11Value CB1_5_2I2R11MassTerm_sound CB1_5_2I2R11Entropy_sound) (by decide +kernel) +def CB1_5_2I2R12Value (a : Fin 6) : ℝ := residualLaw (below (shape 1 5 2)) (fun u => (stageBLaw (shape 1 5 2) u : ℝ)) (stageBPriority (shape 1 5 2)) 2 (fun u a => (littleLaw (shape 1 5 2) u ((stageBPriority (shape 1 5 2)) 2) a : ℝ)) 12 a +def CB1_5_2I2R12Raw (a : Fin 6) : Ball := residualBall (below (shape 1 5 2)) B1_5_2Law (stageBPriority (shape 1 5 2)) 2 (fun u => B1_5_2Little u ((stageBPriority (shape 1 5 2)) 2)) 12 a +lemma CB1_5_2I2R12Raw_sound (a : Fin 6) : + (CB1_5_2I2R12Raw a).Encloses (CB1_5_2I2R12Value a) := by + exact residualBall_sound_on (below (shape 1 5 2)) B1_5_2Law (fun u => (stageBLaw (shape 1 5 2) u : ℝ)) (stageBPriority (shape 1 5 2)) 2 (fun u => B1_5_2Little u ((stageBPriority (shape 1 5 2)) 2)) (fun u a => (littleLaw (shape 1 5 2) u ((stageBPriority (shape 1 5 2)) 2) a : ℝ)) (fun u _ => B1_5_2Law_sound u) (fun u _ a => B1_5_2Little_sound u ((stageBPriority (shape 1 5 2)) 2) a) 12 a +def CB1_5_2I2R12Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB1_5_2I2R12Certificates_valid : + CB1_5_2I2R12Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_5_2I2R12CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB1_5_2I2R12P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_5_2I2R12Certificates (CB1_5_2I2R12CertificateIndex a)).input +lemma CB1_5_2I2R12P_check : ∀ a : Fin 6, contains (CB1_5_2I2R12Raw a) (CB1_5_2I2R12P a) = true := by + decide +kernel +lemma CB1_5_2I2R12P_sound (a : Fin 6) : + (CB1_5_2I2R12P a).Encloses (CB1_5_2I2R12Value a) := + contains_sound (CB1_5_2I2R12Raw_sound a) (CB1_5_2I2R12P_check a) +def CB1_5_2I2R12Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_5_2I2R12Certificates (CB1_5_2I2R12CertificateIndex a)).output +lemma CB1_5_2I2R12Terms_sound (a : Fin 6) : + (CB1_5_2I2R12Terms a).Encloses (Foundation.entropyTerm (CB1_5_2I2R12Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_5_2I2R12Certificates_valid + (CB1_5_2I2R12CertificateIndex a) (CB1_5_2I2R12P_sound a) +def CB1_5_2I2R12Entropy : Ball := ⟨0, 0⟩ +lemma CB1_5_2I2R12Entropy_sound : CB1_5_2I2R12Entropy.Encloses (Foundation.finiteEntropy CB1_5_2I2R12Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_5_2I2R12Value CB1_5_2I2R12Terms CB1_5_2I2R12Terms_sound) (by decide +kernel) +def CB1_5_2I2R12Mass : Ball := ⟨0, 0⟩ +lemma CB1_5_2I2R12Mass_sound : CB1_5_2I2R12Mass.Encloses (∑ a, CB1_5_2I2R12Value a) := by + exact contains_sound (finSumBall_sound 6 CB1_5_2I2R12P CB1_5_2I2R12Value CB1_5_2I2R12P_sound) (by decide +kernel) +def CB1_5_2I2R12MassTerm : Ball := .exact 0 +lemma CB1_5_2I2R12MassTerm_sound : CB1_5_2I2R12MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_5_2I2R12Value a))) := + entropyTerm_zero_ball (CB1_5_2I2R12Mass_sound) +def CB1_5_2I2R12H : Ball := ⟨0, 0⟩ +lemma CB1_5_2I2R12H_sound : CB1_5_2I2R12H.Encloses (homogeneousEntropy CB1_5_2I2R12Value) := by + exact contains_sound (homogeneous_enclosed CB1_5_2I2R12Value CB1_5_2I2R12MassTerm_sound CB1_5_2I2R12Entropy_sound) (by decide +kernel) +def CB1_5_2I2R13Value (a : Fin 6) : ℝ := residualLaw (below (shape 1 5 2)) (fun u => (stageBLaw (shape 1 5 2) u : ℝ)) (stageBPriority (shape 1 5 2)) 2 (fun u a => (littleLaw (shape 1 5 2) u ((stageBPriority (shape 1 5 2)) 2) a : ℝ)) 13 a +def CB1_5_2I2R13Raw (a : Fin 6) : Ball := residualBall (below (shape 1 5 2)) B1_5_2Law (stageBPriority (shape 1 5 2)) 2 (fun u => B1_5_2Little u ((stageBPriority (shape 1 5 2)) 2)) 13 a +lemma CB1_5_2I2R13Raw_sound (a : Fin 6) : + (CB1_5_2I2R13Raw a).Encloses (CB1_5_2I2R13Value a) := by + exact residualBall_sound_on (below (shape 1 5 2)) B1_5_2Law (fun u => (stageBLaw (shape 1 5 2) u : ℝ)) (stageBPriority (shape 1 5 2)) 2 (fun u => B1_5_2Little u ((stageBPriority (shape 1 5 2)) 2)) (fun u a => (littleLaw (shape 1 5 2) u ((stageBPriority (shape 1 5 2)) 2) a : ℝ)) (fun u _ => B1_5_2Law_sound u) (fun u _ a => B1_5_2Little_sound u ((stageBPriority (shape 1 5 2)) 2) a) 13 a +def CB1_5_2I2R13Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB1_5_2I2R13Certificates_valid : + CB1_5_2I2R13Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_5_2I2R13CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB1_5_2I2R13P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_5_2I2R13Certificates (CB1_5_2I2R13CertificateIndex a)).input +lemma CB1_5_2I2R13P_check : ∀ a : Fin 6, contains (CB1_5_2I2R13Raw a) (CB1_5_2I2R13P a) = true := by + decide +kernel +lemma CB1_5_2I2R13P_sound (a : Fin 6) : + (CB1_5_2I2R13P a).Encloses (CB1_5_2I2R13Value a) := + contains_sound (CB1_5_2I2R13Raw_sound a) (CB1_5_2I2R13P_check a) +def CB1_5_2I2R13Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_5_2I2R13Certificates (CB1_5_2I2R13CertificateIndex a)).output +lemma CB1_5_2I2R13Terms_sound (a : Fin 6) : + (CB1_5_2I2R13Terms a).Encloses (Foundation.entropyTerm (CB1_5_2I2R13Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_5_2I2R13Certificates_valid + (CB1_5_2I2R13CertificateIndex a) (CB1_5_2I2R13P_sound a) +def CB1_5_2I2R13Entropy : Ball := ⟨0, 0⟩ +lemma CB1_5_2I2R13Entropy_sound : CB1_5_2I2R13Entropy.Encloses (Foundation.finiteEntropy CB1_5_2I2R13Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_5_2I2R13Value CB1_5_2I2R13Terms CB1_5_2I2R13Terms_sound) (by decide +kernel) +def CB1_5_2I2R13Mass : Ball := ⟨0, 0⟩ +lemma CB1_5_2I2R13Mass_sound : CB1_5_2I2R13Mass.Encloses (∑ a, CB1_5_2I2R13Value a) := by + exact contains_sound (finSumBall_sound 6 CB1_5_2I2R13P CB1_5_2I2R13Value CB1_5_2I2R13P_sound) (by decide +kernel) +def CB1_5_2I2R13MassTerm : Ball := .exact 0 +lemma CB1_5_2I2R13MassTerm_sound : CB1_5_2I2R13MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_5_2I2R13Value a))) := + entropyTerm_zero_ball (CB1_5_2I2R13Mass_sound) +def CB1_5_2I2R13H : Ball := ⟨0, 0⟩ +lemma CB1_5_2I2R13H_sound : CB1_5_2I2R13H.Encloses (homogeneousEntropy CB1_5_2I2R13Value) := by + exact contains_sound (homogeneous_enclosed CB1_5_2I2R13Value CB1_5_2I2R13MassTerm_sound CB1_5_2I2R13Entropy_sound) (by decide +kernel) +def CB1_5_2I2R14Value (a : Fin 6) : ℝ := residualLaw (below (shape 1 5 2)) (fun u => (stageBLaw (shape 1 5 2) u : ℝ)) (stageBPriority (shape 1 5 2)) 2 (fun u a => (littleLaw (shape 1 5 2) u ((stageBPriority (shape 1 5 2)) 2) a : ℝ)) 14 a +def CB1_5_2I2R14Raw (a : Fin 6) : Ball := residualBall (below (shape 1 5 2)) B1_5_2Law (stageBPriority (shape 1 5 2)) 2 (fun u => B1_5_2Little u ((stageBPriority (shape 1 5 2)) 2)) 14 a +lemma CB1_5_2I2R14Raw_sound (a : Fin 6) : + (CB1_5_2I2R14Raw a).Encloses (CB1_5_2I2R14Value a) := by + exact residualBall_sound_on (below (shape 1 5 2)) B1_5_2Law (fun u => (stageBLaw (shape 1 5 2) u : ℝ)) (stageBPriority (shape 1 5 2)) 2 (fun u => B1_5_2Little u ((stageBPriority (shape 1 5 2)) 2)) (fun u a => (littleLaw (shape 1 5 2) u ((stageBPriority (shape 1 5 2)) 2) a : ℝ)) (fun u _ => B1_5_2Law_sound u) (fun u _ a => B1_5_2Little_sound u ((stageBPriority (shape 1 5 2)) 2) a) 14 a +def CB1_5_2I2R14Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB1_5_2I2R14Certificates_valid : + CB1_5_2I2R14Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_5_2I2R14CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB1_5_2I2R14P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_5_2I2R14Certificates (CB1_5_2I2R14CertificateIndex a)).input +lemma CB1_5_2I2R14P_check : ∀ a : Fin 6, contains (CB1_5_2I2R14Raw a) (CB1_5_2I2R14P a) = true := by + decide +kernel +lemma CB1_5_2I2R14P_sound (a : Fin 6) : + (CB1_5_2I2R14P a).Encloses (CB1_5_2I2R14Value a) := + contains_sound (CB1_5_2I2R14Raw_sound a) (CB1_5_2I2R14P_check a) +def CB1_5_2I2R14Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_5_2I2R14Certificates (CB1_5_2I2R14CertificateIndex a)).output +lemma CB1_5_2I2R14Terms_sound (a : Fin 6) : + (CB1_5_2I2R14Terms a).Encloses (Foundation.entropyTerm (CB1_5_2I2R14Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_5_2I2R14Certificates_valid + (CB1_5_2I2R14CertificateIndex a) (CB1_5_2I2R14P_sound a) +def CB1_5_2I2R14Entropy : Ball := ⟨0, 0⟩ +lemma CB1_5_2I2R14Entropy_sound : CB1_5_2I2R14Entropy.Encloses (Foundation.finiteEntropy CB1_5_2I2R14Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_5_2I2R14Value CB1_5_2I2R14Terms CB1_5_2I2R14Terms_sound) (by decide +kernel) +def CB1_5_2I2R14Mass : Ball := ⟨0, 0⟩ +lemma CB1_5_2I2R14Mass_sound : CB1_5_2I2R14Mass.Encloses (∑ a, CB1_5_2I2R14Value a) := by + exact contains_sound (finSumBall_sound 6 CB1_5_2I2R14P CB1_5_2I2R14Value CB1_5_2I2R14P_sound) (by decide +kernel) +def CB1_5_2I2R14MassTerm : Ball := .exact 0 +lemma CB1_5_2I2R14MassTerm_sound : CB1_5_2I2R14MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_5_2I2R14Value a))) := + entropyTerm_zero_ball (CB1_5_2I2R14Mass_sound) +def CB1_5_2I2R14H : Ball := ⟨0, 0⟩ +lemma CB1_5_2I2R14H_sound : CB1_5_2I2R14H.Encloses (homogeneousEntropy CB1_5_2I2R14Value) := by + exact contains_sound (homogeneous_enclosed CB1_5_2I2R14Value CB1_5_2I2R14MassTerm_sound CB1_5_2I2R14Entropy_sound) (by decide +kernel) +def CB1_5_2I2R15Value (a : Fin 6) : ℝ := residualLaw (below (shape 1 5 2)) (fun u => (stageBLaw (shape 1 5 2) u : ℝ)) (stageBPriority (shape 1 5 2)) 2 (fun u a => (littleLaw (shape 1 5 2) u ((stageBPriority (shape 1 5 2)) 2) a : ℝ)) 15 a +def CB1_5_2I2R15Raw (a : Fin 6) : Ball := residualBall (below (shape 1 5 2)) B1_5_2Law (stageBPriority (shape 1 5 2)) 2 (fun u => B1_5_2Little u ((stageBPriority (shape 1 5 2)) 2)) 15 a +lemma CB1_5_2I2R15Raw_sound (a : Fin 6) : + (CB1_5_2I2R15Raw a).Encloses (CB1_5_2I2R15Value a) := by + exact residualBall_sound_on (below (shape 1 5 2)) B1_5_2Law (fun u => (stageBLaw (shape 1 5 2) u : ℝ)) (stageBPriority (shape 1 5 2)) 2 (fun u => B1_5_2Little u ((stageBPriority (shape 1 5 2)) 2)) (fun u a => (littleLaw (shape 1 5 2) u ((stageBPriority (shape 1 5 2)) 2) a : ℝ)) (fun u _ => B1_5_2Law_sound u) (fun u _ a => B1_5_2Little_sound u ((stageBPriority (shape 1 5 2)) 2) a) 15 a +def CB1_5_2I2R15Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB1_5_2I2R15Certificates_valid : + CB1_5_2I2R15Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_5_2I2R15CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB1_5_2I2R15P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_5_2I2R15Certificates (CB1_5_2I2R15CertificateIndex a)).input +lemma CB1_5_2I2R15P_check : ∀ a : Fin 6, contains (CB1_5_2I2R15Raw a) (CB1_5_2I2R15P a) = true := by + decide +kernel +lemma CB1_5_2I2R15P_sound (a : Fin 6) : + (CB1_5_2I2R15P a).Encloses (CB1_5_2I2R15Value a) := + contains_sound (CB1_5_2I2R15Raw_sound a) (CB1_5_2I2R15P_check a) +def CB1_5_2I2R15Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_5_2I2R15Certificates (CB1_5_2I2R15CertificateIndex a)).output +lemma CB1_5_2I2R15Terms_sound (a : Fin 6) : + (CB1_5_2I2R15Terms a).Encloses (Foundation.entropyTerm (CB1_5_2I2R15Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_5_2I2R15Certificates_valid + (CB1_5_2I2R15CertificateIndex a) (CB1_5_2I2R15P_sound a) +def CB1_5_2I2R15Entropy : Ball := ⟨0, 0⟩ +lemma CB1_5_2I2R15Entropy_sound : CB1_5_2I2R15Entropy.Encloses (Foundation.finiteEntropy CB1_5_2I2R15Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_5_2I2R15Value CB1_5_2I2R15Terms CB1_5_2I2R15Terms_sound) (by decide +kernel) +def CB1_5_2I2R15Mass : Ball := ⟨0, 0⟩ +lemma CB1_5_2I2R15Mass_sound : CB1_5_2I2R15Mass.Encloses (∑ a, CB1_5_2I2R15Value a) := by + exact contains_sound (finSumBall_sound 6 CB1_5_2I2R15P CB1_5_2I2R15Value CB1_5_2I2R15P_sound) (by decide +kernel) +def CB1_5_2I2R15MassTerm : Ball := .exact 0 +lemma CB1_5_2I2R15MassTerm_sound : CB1_5_2I2R15MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_5_2I2R15Value a))) := + entropyTerm_zero_ball (CB1_5_2I2R15Mass_sound) +def CB1_5_2I2R15H : Ball := ⟨0, 0⟩ +lemma CB1_5_2I2R15H_sound : CB1_5_2I2R15H.Encloses (homogeneousEntropy CB1_5_2I2R15Value) := by + exact contains_sound (homogeneous_enclosed CB1_5_2I2R15Value CB1_5_2I2R15MassTerm_sound CB1_5_2I2R15Entropy_sound) (by decide +kernel) +def CB1_5_2I2R16Value (a : Fin 6) : ℝ := residualLaw (below (shape 1 5 2)) (fun u => (stageBLaw (shape 1 5 2) u : ℝ)) (stageBPriority (shape 1 5 2)) 2 (fun u a => (littleLaw (shape 1 5 2) u ((stageBPriority (shape 1 5 2)) 2) a : ℝ)) 16 a +def CB1_5_2I2R16Raw (a : Fin 6) : Ball := residualBall (below (shape 1 5 2)) B1_5_2Law (stageBPriority (shape 1 5 2)) 2 (fun u => B1_5_2Little u ((stageBPriority (shape 1 5 2)) 2)) 16 a +lemma CB1_5_2I2R16Raw_sound (a : Fin 6) : + (CB1_5_2I2R16Raw a).Encloses (CB1_5_2I2R16Value a) := by + exact residualBall_sound_on (below (shape 1 5 2)) B1_5_2Law (fun u => (stageBLaw (shape 1 5 2) u : ℝ)) (stageBPriority (shape 1 5 2)) 2 (fun u => B1_5_2Little u ((stageBPriority (shape 1 5 2)) 2)) (fun u a => (littleLaw (shape 1 5 2) u ((stageBPriority (shape 1 5 2)) 2) a : ℝ)) (fun u _ => B1_5_2Law_sound u) (fun u _ a => B1_5_2Little_sound u ((stageBPriority (shape 1 5 2)) 2) a) 16 a +def CB1_5_2I2R16Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB1_5_2I2R16Certificates_valid : + CB1_5_2I2R16Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_5_2I2R16CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB1_5_2I2R16P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_5_2I2R16Certificates (CB1_5_2I2R16CertificateIndex a)).input +lemma CB1_5_2I2R16P_check : ∀ a : Fin 6, contains (CB1_5_2I2R16Raw a) (CB1_5_2I2R16P a) = true := by + decide +kernel +lemma CB1_5_2I2R16P_sound (a : Fin 6) : + (CB1_5_2I2R16P a).Encloses (CB1_5_2I2R16Value a) := + contains_sound (CB1_5_2I2R16Raw_sound a) (CB1_5_2I2R16P_check a) +def CB1_5_2I2R16Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_5_2I2R16Certificates (CB1_5_2I2R16CertificateIndex a)).output +lemma CB1_5_2I2R16Terms_sound (a : Fin 6) : + (CB1_5_2I2R16Terms a).Encloses (Foundation.entropyTerm (CB1_5_2I2R16Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_5_2I2R16Certificates_valid + (CB1_5_2I2R16CertificateIndex a) (CB1_5_2I2R16P_sound a) +def CB1_5_2I2R16Entropy : Ball := ⟨0, 0⟩ +lemma CB1_5_2I2R16Entropy_sound : CB1_5_2I2R16Entropy.Encloses (Foundation.finiteEntropy CB1_5_2I2R16Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_5_2I2R16Value CB1_5_2I2R16Terms CB1_5_2I2R16Terms_sound) (by decide +kernel) +def CB1_5_2I2R16Mass : Ball := ⟨0, 0⟩ +lemma CB1_5_2I2R16Mass_sound : CB1_5_2I2R16Mass.Encloses (∑ a, CB1_5_2I2R16Value a) := by + exact contains_sound (finSumBall_sound 6 CB1_5_2I2R16P CB1_5_2I2R16Value CB1_5_2I2R16P_sound) (by decide +kernel) +def CB1_5_2I2R16MassTerm : Ball := .exact 0 +lemma CB1_5_2I2R16MassTerm_sound : CB1_5_2I2R16MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_5_2I2R16Value a))) := + entropyTerm_zero_ball (CB1_5_2I2R16Mass_sound) +def CB1_5_2I2R16H : Ball := ⟨0, 0⟩ +lemma CB1_5_2I2R16H_sound : CB1_5_2I2R16H.Encloses (homogeneousEntropy CB1_5_2I2R16Value) := by + exact contains_sound (homogeneous_enclosed CB1_5_2I2R16Value CB1_5_2I2R16MassTerm_sound CB1_5_2I2R16Entropy_sound) (by decide +kernel) +def CB1_5_2I2ResidualEntropies (a : Fin 17) : Ball := + match a.val with + | 0 => CB1_5_2I2R0H + | 1 => CB1_5_2I2R1H + | 2 => CB1_5_2I2R2H + | 3 => CB1_5_2I2R3H + | 4 => CB1_5_2I2R4H + | 5 => CB1_5_2I2R5H + | 6 => CB1_5_2I2R6H + | 7 => CB1_5_2I2R7H + | 8 => CB1_5_2I2R8H + | 9 => CB1_5_2I2R9H + | 10 => CB1_5_2I2R10H + | 11 => CB1_5_2I2R11H + | 12 => CB1_5_2I2R12H + | 13 => CB1_5_2I2R13H + | 14 => CB1_5_2I2R14H + | 15 => CB1_5_2I2R15H + | 16 => CB1_5_2I2R16H + | _ => (.exact 0) +lemma CB1_5_2I2ResidualEntropies_sound (k : Fin 17) : + (CB1_5_2I2ResidualEntropies k).Encloses (homogeneousEntropy + (residualLaw (below (shape 1 5 2)) (fun u => (stageBLaw (shape 1 5 2) u : ℝ)) (stageBPriority (shape 1 5 2)) 2 (fun u a => (littleLaw (shape 1 5 2) u ((stageBPriority (shape 1 5 2)) 2) a : ℝ)) k)) := by + fin_cases k + · exact CB1_5_2I2R0H_sound + · exact CB1_5_2I2R1H_sound + · exact CB1_5_2I2R2H_sound + · exact CB1_5_2I2R3H_sound + · exact CB1_5_2I2R4H_sound + · exact CB1_5_2I2R5H_sound + · exact CB1_5_2I2R6H_sound + · exact CB1_5_2I2R7H_sound + · exact CB1_5_2I2R8H_sound + · exact CB1_5_2I2R9H_sound + · exact CB1_5_2I2R10H_sound + · exact CB1_5_2I2R11H_sound + · exact CB1_5_2I2R12H_sound + · exact CB1_5_2I2R13H_sound + · exact CB1_5_2I2R14H_sound + · exact CB1_5_2I2R15H_sound + · exact CB1_5_2I2R16H_sound +def CB1_5_2I2S0_2_2Value (a : Fin 6) : ℝ := (littleLaw (shape 1 5 2) (shape 0 2 2) ((stageBPriority (shape 1 5 2)) 2) a : ℝ) +def CB1_5_2I2S0_2_2E_2LogWitness : LogWitness := ⟨-1, 890067, 500000⟩ +def CB1_5_2I2S0_2_2E_2Log : Ball := ⟨(-11645853819053979009096802094341 / 100000000000000000000000000000000), (8470329473 / 20000000000000000000000000000000)⟩ +lemma CB1_5_2I2S0_2_2E_2Log_sound : CB1_5_2I2S0_2_2E_2Log.Encloses (Real.log (CB1_5_2I2S0_2_2Value (2 : Fin 6))) := by + exact checkLog_sound logTwoBall_sound ((B1_5_2Little_sound (shape 0 2 2) ((stageBPriority (shape 1 5 2)) 2)) (2 : Fin 6)) (w := CB1_5_2I2S0_2_2E_2LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB1_5_2I2S0_2_2E_2 : Ball := ⟨(1295698771395489741836220418713 / 12500000000000000000000000000000), (9423950929 / 25000000000000000000000000000000)⟩ +lemma CB1_5_2I2S0_2_2E_2_sound : CB1_5_2I2S0_2_2E_2.Encloses (Foundation.entropyTerm (CB1_5_2I2S0_2_2Value (2 : Fin 6))) := by + exact contains_sound (entropyTerm_ball ((B1_5_2Little_sound (shape 0 2 2) ((stageBPriority (shape 1 5 2)) 2)) (2 : Fin 6)) CB1_5_2I2S0_2_2E_2Log_sound) (by decide +kernel) +def CB1_5_2I2S0_2_2E_3LogWitness : LogWitness := ⟨-4, 109933, 62500⟩ +def CB1_5_2I2S0_2_2E_3Log : Ball := ⟨(-220788418967003649163974598210309 / 100000000000000000000000000000000), (21175823683 / 20000000000000000000000000000000)⟩ +lemma CB1_5_2I2S0_2_2E_3Log_sound : CB1_5_2I2S0_2_2E_3Log.Encloses (Real.log (CB1_5_2I2S0_2_2Value (3 : Fin 6))) := by + exact checkLog_sound logTwoBall_sound ((B1_5_2Little_sound (shape 0 2 2) ((stageBPriority (shape 1 5 2)) 2)) (3 : Fin 6)) (w := CB1_5_2I2S0_2_2E_3LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB1_5_2I2S0_2_2E_3 : Ball := ⟨(12135966631149806081771609752527 / 50000000000000000000000000000000), (93116873 / 800000000000000000000000000000)⟩ +lemma CB1_5_2I2S0_2_2E_3_sound : CB1_5_2I2S0_2_2E_3.Encloses (Foundation.entropyTerm (CB1_5_2I2S0_2_2Value (3 : Fin 6))) := by + exact contains_sound (entropyTerm_ball ((B1_5_2Little_sound (shape 0 2 2) ((stageBPriority (shape 1 5 2)) 2)) (3 : Fin 6)) CB1_5_2I2S0_2_2E_3Log_sound) (by decide +kernel) +def CB1_5_2I2S0_2_2Terms (a : Fin 6) : Ball := + match a.val with + | 2 => ⟨(1295698771395489741836220418713 / 12500000000000000000000000000000), (9423950929 / 25000000000000000000000000000000)⟩ + | 3 => ⟨(12135966631149806081771609752527 / 50000000000000000000000000000000), (93116873 / 800000000000000000000000000000)⟩ + | _ => (.exact 0) +lemma CB1_5_2I2S0_2_2Terms_sound (a : Fin 6) : + (CB1_5_2I2S0_2_2Terms a).Encloses (Foundation.entropyTerm (CB1_5_2I2S0_2_2Value a)) := by + fin_cases a + · exact (entropyTerm_zero_ball ((B1_5_2Little_sound (shape 0 2 2) ((stageBPriority (shape 1 5 2)) 2)) (0 : Fin 6))) + · exact (entropyTerm_zero_ball ((B1_5_2Little_sound (shape 0 2 2) ((stageBPriority (shape 1 5 2)) 2)) (1 : Fin 6))) + · exact CB1_5_2I2S0_2_2E_2_sound + · exact CB1_5_2I2S0_2_2E_3_sound + · exact (entropyTerm_zero_ball ((B1_5_2Little_sound (shape 0 2 2) ((stageBPriority (shape 1 5 2)) 2)) (4 : Fin 6))) + · exact (entropyTerm_zero_ball ((B1_5_2Little_sound (shape 0 2 2) ((stageBPriority (shape 1 5 2)) 2)) (5 : Fin 6))) +def CB1_5_2I2S0_2_2Entropy : Ball := ⟨(17318761716731765049116491427379 / 50000000000000000000000000000000), (49335412841 / 100000000000000000000000000000000)⟩ +lemma CB1_5_2I2S0_2_2Entropy_sound : CB1_5_2I2S0_2_2Entropy.Encloses (Foundation.finiteEntropy CB1_5_2I2S0_2_2Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_5_2I2S0_2_2Value CB1_5_2I2S0_2_2Terms CB1_5_2I2S0_2_2Terms_sound) (by decide +kernel) +def CB1_5_2I2S0_2_2Mass : Ball := ⟨1, 0⟩ +lemma CB1_5_2I2S0_2_2Mass_sound : CB1_5_2I2S0_2_2Mass.Encloses (∑ a, CB1_5_2I2S0_2_2Value a) := by + exact contains_sound (finSumBall_sound 6 (B1_5_2Little (shape 0 2 2) ((stageBPriority (shape 1 5 2)) 2)) CB1_5_2I2S0_2_2Value (B1_5_2Little_sound (shape 0 2 2) ((stageBPriority (shape 1 5 2)) 2))) (by decide +kernel) +def CB1_5_2I2S0_2_2MassTermLog : Ball := .exact 0 +lemma CB1_5_2I2S0_2_2MassTermLog_sound : CB1_5_2I2S0_2_2MassTermLog.Encloses (Real.log ((∑ a, CB1_5_2I2S0_2_2Value a))) := by + exact log_exact_one_ball (CB1_5_2I2S0_2_2Mass_sound) +def CB1_5_2I2S0_2_2MassTerm : Ball := ⟨0, 0⟩ +lemma CB1_5_2I2S0_2_2MassTerm_sound : CB1_5_2I2S0_2_2MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_5_2I2S0_2_2Value a))) := by + exact contains_sound (entropyTerm_ball (CB1_5_2I2S0_2_2Mass_sound) CB1_5_2I2S0_2_2MassTermLog_sound) (by decide +kernel) +def CB1_5_2I2S0_2_2H : Ball := ⟨(17318761716731765049116491427379 / 50000000000000000000000000000000), (49335412841 / 100000000000000000000000000000000)⟩ +lemma CB1_5_2I2S0_2_2H_sound : CB1_5_2I2S0_2_2H.Encloses (homogeneousEntropy CB1_5_2I2S0_2_2Value) := by + exact contains_sound (homogeneous_enclosed CB1_5_2I2S0_2_2Value CB1_5_2I2S0_2_2MassTerm_sound CB1_5_2I2S0_2_2Entropy_sound) (by decide +kernel) +def CB1_5_2I2S0_3_1Value (a : Fin 6) : ℝ := (littleLaw (shape 1 5 2) (shape 0 3 1) ((stageBPriority (shape 1 5 2)) 2) a : ℝ) +def CB1_5_2I2S0_3_1E_4Log : Ball := .exact 0 +lemma CB1_5_2I2S0_3_1E_4Log_sound : CB1_5_2I2S0_3_1E_4Log.Encloses (Real.log (CB1_5_2I2S0_3_1Value (4 : Fin 6))) := by + exact log_exact_one_ball ((B1_5_2Little_sound (shape 0 3 1) ((stageBPriority (shape 1 5 2)) 2)) (4 : Fin 6)) +def CB1_5_2I2S0_3_1E_4 : Ball := ⟨0, 0⟩ +lemma CB1_5_2I2S0_3_1E_4_sound : CB1_5_2I2S0_3_1E_4.Encloses (Foundation.entropyTerm (CB1_5_2I2S0_3_1Value (4 : Fin 6))) := by + exact contains_sound (entropyTerm_ball ((B1_5_2Little_sound (shape 0 3 1) ((stageBPriority (shape 1 5 2)) 2)) (4 : Fin 6)) CB1_5_2I2S0_3_1E_4Log_sound) (by decide +kernel) +def CB1_5_2I2S0_3_1Terms (a : Fin 6) : Ball := + match a.val with + | 4 => ⟨0, 0⟩ + | _ => (.exact 0) +lemma CB1_5_2I2S0_3_1Terms_sound (a : Fin 6) : + (CB1_5_2I2S0_3_1Terms a).Encloses (Foundation.entropyTerm (CB1_5_2I2S0_3_1Value a)) := by + fin_cases a + · exact (entropyTerm_zero_ball ((B1_5_2Little_sound (shape 0 3 1) ((stageBPriority (shape 1 5 2)) 2)) (0 : Fin 6))) + · exact (entropyTerm_zero_ball ((B1_5_2Little_sound (shape 0 3 1) ((stageBPriority (shape 1 5 2)) 2)) (1 : Fin 6))) + · exact (entropyTerm_zero_ball ((B1_5_2Little_sound (shape 0 3 1) ((stageBPriority (shape 1 5 2)) 2)) (2 : Fin 6))) + · exact (entropyTerm_zero_ball ((B1_5_2Little_sound (shape 0 3 1) ((stageBPriority (shape 1 5 2)) 2)) (3 : Fin 6))) + · exact CB1_5_2I2S0_3_1E_4_sound + · exact (entropyTerm_zero_ball ((B1_5_2Little_sound (shape 0 3 1) ((stageBPriority (shape 1 5 2)) 2)) (5 : Fin 6))) +def CB1_5_2I2S0_3_1Entropy : Ball := ⟨0, 0⟩ +lemma CB1_5_2I2S0_3_1Entropy_sound : CB1_5_2I2S0_3_1Entropy.Encloses (Foundation.finiteEntropy CB1_5_2I2S0_3_1Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_5_2I2S0_3_1Value CB1_5_2I2S0_3_1Terms CB1_5_2I2S0_3_1Terms_sound) (by decide +kernel) +def CB1_5_2I2S0_3_1Mass : Ball := ⟨1, 0⟩ +lemma CB1_5_2I2S0_3_1Mass_sound : CB1_5_2I2S0_3_1Mass.Encloses (∑ a, CB1_5_2I2S0_3_1Value a) := by + exact contains_sound (finSumBall_sound 6 (B1_5_2Little (shape 0 3 1) ((stageBPriority (shape 1 5 2)) 2)) CB1_5_2I2S0_3_1Value (B1_5_2Little_sound (shape 0 3 1) ((stageBPriority (shape 1 5 2)) 2))) (by decide +kernel) +def CB1_5_2I2S0_3_1MassTermLog : Ball := .exact 0 +lemma CB1_5_2I2S0_3_1MassTermLog_sound : CB1_5_2I2S0_3_1MassTermLog.Encloses (Real.log ((∑ a, CB1_5_2I2S0_3_1Value a))) := by + exact log_exact_one_ball (CB1_5_2I2S0_3_1Mass_sound) +def CB1_5_2I2S0_3_1MassTerm : Ball := ⟨0, 0⟩ +lemma CB1_5_2I2S0_3_1MassTerm_sound : CB1_5_2I2S0_3_1MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_5_2I2S0_3_1Value a))) := by + exact contains_sound (entropyTerm_ball (CB1_5_2I2S0_3_1Mass_sound) CB1_5_2I2S0_3_1MassTermLog_sound) (by decide +kernel) +def CB1_5_2I2S0_3_1H : Ball := ⟨0, 0⟩ +lemma CB1_5_2I2S0_3_1H_sound : CB1_5_2I2S0_3_1H.Encloses (homogeneousEntropy CB1_5_2I2S0_3_1Value) := by + exact contains_sound (homogeneous_enclosed CB1_5_2I2S0_3_1Value CB1_5_2I2S0_3_1MassTerm_sound CB1_5_2I2S0_3_1Entropy_sound) (by decide +kernel) +def CB1_5_2I2S0_4_0Value (a : Fin 6) : ℝ := (littleLaw (shape 1 5 2) (shape 0 4 0) ((stageBPriority (shape 1 5 2)) 2) a : ℝ) +def CB1_5_2I2S0_4_0E_5Log : Ball := .exact 0 +lemma CB1_5_2I2S0_4_0E_5Log_sound : CB1_5_2I2S0_4_0E_5Log.Encloses (Real.log (CB1_5_2I2S0_4_0Value (5 : Fin 6))) := by + exact log_exact_one_ball ((B1_5_2Little_sound (shape 0 4 0) ((stageBPriority (shape 1 5 2)) 2)) (5 : Fin 6)) +def CB1_5_2I2S0_4_0E_5 : Ball := ⟨0, 0⟩ +lemma CB1_5_2I2S0_4_0E_5_sound : CB1_5_2I2S0_4_0E_5.Encloses (Foundation.entropyTerm (CB1_5_2I2S0_4_0Value (5 : Fin 6))) := by + exact contains_sound (entropyTerm_ball ((B1_5_2Little_sound (shape 0 4 0) ((stageBPriority (shape 1 5 2)) 2)) (5 : Fin 6)) CB1_5_2I2S0_4_0E_5Log_sound) (by decide +kernel) +def CB1_5_2I2S0_4_0Terms (a : Fin 6) : Ball := + match a.val with + | 5 => ⟨0, 0⟩ + | _ => (.exact 0) +lemma CB1_5_2I2S0_4_0Terms_sound (a : Fin 6) : + (CB1_5_2I2S0_4_0Terms a).Encloses (Foundation.entropyTerm (CB1_5_2I2S0_4_0Value a)) := by + fin_cases a + · exact (entropyTerm_zero_ball ((B1_5_2Little_sound (shape 0 4 0) ((stageBPriority (shape 1 5 2)) 2)) (0 : Fin 6))) + · exact (entropyTerm_zero_ball ((B1_5_2Little_sound (shape 0 4 0) ((stageBPriority (shape 1 5 2)) 2)) (1 : Fin 6))) + · exact (entropyTerm_zero_ball ((B1_5_2Little_sound (shape 0 4 0) ((stageBPriority (shape 1 5 2)) 2)) (2 : Fin 6))) + · exact (entropyTerm_zero_ball ((B1_5_2Little_sound (shape 0 4 0) ((stageBPriority (shape 1 5 2)) 2)) (3 : Fin 6))) + · exact (entropyTerm_zero_ball ((B1_5_2Little_sound (shape 0 4 0) ((stageBPriority (shape 1 5 2)) 2)) (4 : Fin 6))) + · exact CB1_5_2I2S0_4_0E_5_sound +def CB1_5_2I2S0_4_0Entropy : Ball := ⟨0, 0⟩ +lemma CB1_5_2I2S0_4_0Entropy_sound : CB1_5_2I2S0_4_0Entropy.Encloses (Foundation.finiteEntropy CB1_5_2I2S0_4_0Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_5_2I2S0_4_0Value CB1_5_2I2S0_4_0Terms CB1_5_2I2S0_4_0Terms_sound) (by decide +kernel) +def CB1_5_2I2S0_4_0Mass : Ball := ⟨1, 0⟩ +lemma CB1_5_2I2S0_4_0Mass_sound : CB1_5_2I2S0_4_0Mass.Encloses (∑ a, CB1_5_2I2S0_4_0Value a) := by + exact contains_sound (finSumBall_sound 6 (B1_5_2Little (shape 0 4 0) ((stageBPriority (shape 1 5 2)) 2)) CB1_5_2I2S0_4_0Value (B1_5_2Little_sound (shape 0 4 0) ((stageBPriority (shape 1 5 2)) 2))) (by decide +kernel) +def CB1_5_2I2S0_4_0MassTermLog : Ball := .exact 0 +lemma CB1_5_2I2S0_4_0MassTermLog_sound : CB1_5_2I2S0_4_0MassTermLog.Encloses (Real.log ((∑ a, CB1_5_2I2S0_4_0Value a))) := by + exact log_exact_one_ball (CB1_5_2I2S0_4_0Mass_sound) +def CB1_5_2I2S0_4_0MassTerm : Ball := ⟨0, 0⟩ +lemma CB1_5_2I2S0_4_0MassTerm_sound : CB1_5_2I2S0_4_0MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_5_2I2S0_4_0Value a))) := by + exact contains_sound (entropyTerm_ball (CB1_5_2I2S0_4_0Mass_sound) CB1_5_2I2S0_4_0MassTermLog_sound) (by decide +kernel) +def CB1_5_2I2S0_4_0H : Ball := ⟨0, 0⟩ +lemma CB1_5_2I2S0_4_0H_sound : CB1_5_2I2S0_4_0H.Encloses (homogeneousEntropy CB1_5_2I2S0_4_0Value) := by + exact contains_sound (homogeneous_enclosed CB1_5_2I2S0_4_0Value CB1_5_2I2S0_4_0MassTerm_sound CB1_5_2I2S0_4_0Entropy_sound) (by decide +kernel) +def CB1_5_2I2S1_3_0Value (a : Fin 6) : ℝ := (littleLaw (shape 1 5 2) (shape 1 3 0) ((stageBPriority (shape 1 5 2)) 2) a : ℝ) +def CB1_5_2I2S1_3_0E_4Log : Ball := .exact 0 +lemma CB1_5_2I2S1_3_0E_4Log_sound : CB1_5_2I2S1_3_0E_4Log.Encloses (Real.log (CB1_5_2I2S1_3_0Value (4 : Fin 6))) := by + exact log_exact_one_ball ((B1_5_2Little_sound (shape 1 3 0) ((stageBPriority (shape 1 5 2)) 2)) (4 : Fin 6)) +def CB1_5_2I2S1_3_0E_4 : Ball := ⟨0, 0⟩ +lemma CB1_5_2I2S1_3_0E_4_sound : CB1_5_2I2S1_3_0E_4.Encloses (Foundation.entropyTerm (CB1_5_2I2S1_3_0Value (4 : Fin 6))) := by + exact contains_sound (entropyTerm_ball ((B1_5_2Little_sound (shape 1 3 0) ((stageBPriority (shape 1 5 2)) 2)) (4 : Fin 6)) CB1_5_2I2S1_3_0E_4Log_sound) (by decide +kernel) +def CB1_5_2I2S1_3_0Terms (a : Fin 6) : Ball := + match a.val with + | 4 => ⟨0, 0⟩ + | _ => (.exact 0) +lemma CB1_5_2I2S1_3_0Terms_sound (a : Fin 6) : + (CB1_5_2I2S1_3_0Terms a).Encloses (Foundation.entropyTerm (CB1_5_2I2S1_3_0Value a)) := by + fin_cases a + · exact (entropyTerm_zero_ball ((B1_5_2Little_sound (shape 1 3 0) ((stageBPriority (shape 1 5 2)) 2)) (0 : Fin 6))) + · exact (entropyTerm_zero_ball ((B1_5_2Little_sound (shape 1 3 0) ((stageBPriority (shape 1 5 2)) 2)) (1 : Fin 6))) + · exact (entropyTerm_zero_ball ((B1_5_2Little_sound (shape 1 3 0) ((stageBPriority (shape 1 5 2)) 2)) (2 : Fin 6))) + · exact (entropyTerm_zero_ball ((B1_5_2Little_sound (shape 1 3 0) ((stageBPriority (shape 1 5 2)) 2)) (3 : Fin 6))) + · exact CB1_5_2I2S1_3_0E_4_sound + · exact (entropyTerm_zero_ball ((B1_5_2Little_sound (shape 1 3 0) ((stageBPriority (shape 1 5 2)) 2)) (5 : Fin 6))) +def CB1_5_2I2S1_3_0Entropy : Ball := ⟨0, 0⟩ +lemma CB1_5_2I2S1_3_0Entropy_sound : CB1_5_2I2S1_3_0Entropy.Encloses (Foundation.finiteEntropy CB1_5_2I2S1_3_0Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_5_2I2S1_3_0Value CB1_5_2I2S1_3_0Terms CB1_5_2I2S1_3_0Terms_sound) (by decide +kernel) +def CB1_5_2I2S1_3_0Mass : Ball := ⟨1, 0⟩ +lemma CB1_5_2I2S1_3_0Mass_sound : CB1_5_2I2S1_3_0Mass.Encloses (∑ a, CB1_5_2I2S1_3_0Value a) := by + exact contains_sound (finSumBall_sound 6 (B1_5_2Little (shape 1 3 0) ((stageBPriority (shape 1 5 2)) 2)) CB1_5_2I2S1_3_0Value (B1_5_2Little_sound (shape 1 3 0) ((stageBPriority (shape 1 5 2)) 2))) (by decide +kernel) +def CB1_5_2I2S1_3_0MassTermLog : Ball := .exact 0 +lemma CB1_5_2I2S1_3_0MassTermLog_sound : CB1_5_2I2S1_3_0MassTermLog.Encloses (Real.log ((∑ a, CB1_5_2I2S1_3_0Value a))) := by + exact log_exact_one_ball (CB1_5_2I2S1_3_0Mass_sound) +def CB1_5_2I2S1_3_0MassTerm : Ball := ⟨0, 0⟩ +lemma CB1_5_2I2S1_3_0MassTerm_sound : CB1_5_2I2S1_3_0MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_5_2I2S1_3_0Value a))) := by + exact contains_sound (entropyTerm_ball (CB1_5_2I2S1_3_0Mass_sound) CB1_5_2I2S1_3_0MassTermLog_sound) (by decide +kernel) +def CB1_5_2I2S1_3_0H : Ball := ⟨0, 0⟩ +lemma CB1_5_2I2S1_3_0H_sound : CB1_5_2I2S1_3_0H.Encloses (homogeneousEntropy CB1_5_2I2S1_3_0Value) := by + exact contains_sound (homogeneous_enclosed CB1_5_2I2S1_3_0Value CB1_5_2I2S1_3_0MassTerm_sound CB1_5_2I2S1_3_0Entropy_sound) (by decide +kernel) +def CB1_5_2I2Singles (s : Shape) : Ball := + match s 0, s 1, s 2 with + | 0, 2, 2 => CB1_5_2I2S0_2_2H + | 0, 3, 1 => CB1_5_2I2S0_3_1H + | 0, 4, 0 => CB1_5_2I2S0_4_0H + | 1, 3, 0 => CB1_5_2I2S1_3_0H + | _, _, _ => (.exact 0) +lemma CB1_5_2I2Singles_sound (u : Shape) (hu : u ∈ below (shape 1 5 2)) + (hd : designated (stageBPriority (shape 1 5 2)) 2 u) : + (CB1_5_2I2Singles u).Encloses (homogeneousEntropy ((fun u a => (littleLaw (shape 1 5 2) u ((stageBPriority (shape 1 5 2)) 2) a : ℝ)) u)) := by + rw [B1_5_2_below] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl | rfl | rfl + · exact CB1_5_2I2S0_2_2H_sound + · exact CB1_5_2I2S0_3_1H_sound + · exact CB1_5_2I2S0_4_0H_sound + · exact (show ¬ designated (stageBPriority (shape 1 5 2)) 2 (shape 1 1 2) by decide +kernel) hd |>.elim + · exact (show ¬ designated (stageBPriority (shape 1 5 2)) 2 (shape 1 2 1) by decide +kernel) hd |>.elim + · exact CB1_5_2I2S1_3_0H_sound +def CB1_5_2I2Singleton : Ball := ⟨(6160810147124401651688069031141 / 100000000000000000000000000000000), (4387526623 / 50000000000000000000000000000000)⟩ +lemma CB1_5_2I2Singleton_sound : CB1_5_2I2Singleton.Encloses + (singletonEntropy (below (shape 1 5 2)) (fun u => (stageBLaw (shape 1 5 2) u : ℝ)) (stageBPriority (shape 1 5 2)) 2 (fun u a => (littleLaw (shape 1 5 2) u ((stageBPriority (shape 1 5 2)) 2) a : ℝ))) := by + exact contains_sound (singletonBall_sound (below (shape 1 5 2)) B1_5_2Law (fun u => (stageBLaw (shape 1 5 2) u : ℝ)) (stageBPriority (shape 1 5 2)) 2 + CB1_5_2I2Singles (fun u a => (littleLaw (shape 1 5 2) u ((stageBPriority (shape 1 5 2)) 2) a : ℝ)) (fun u _ => B1_5_2Law_sound u) CB1_5_2I2Singles_sound) (by decide +kernel) +def CB1_5_2I2Group : Ball := ⟨(6938073467150412768807438156353 / 100000000000000000000000000000000), (51712586109 / 100000000000000000000000000000000)⟩ +lemma CB1_5_2I2Group_sound : CB1_5_2I2Group.Encloses + (groupedEntropy (below (shape 1 5 2)) (fun u => (stageBLaw (shape 1 5 2) u : ℝ)) (stageBPriority (shape 1 5 2)) 2 (fun u a => (littleLaw (shape 1 5 2) u ((stageBPriority (shape 1 5 2)) 2) a : ℝ))) := by + exact contains_sound (Ball.add_sound CB1_5_2I2Singleton_sound + (finSumBall_sound 17 CB1_5_2I2ResidualEntropies _ CB1_5_2I2ResidualEntropies_sound)) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CB1_5_2I2H : Ball := ⟨(2002557843251668653003258093373 / 2500000000000000000000000000000), (193449632401 / 100000000000000000000000000000000)⟩ +lemma CB1_5_2I2_sound : CB1_5_2I2H.Encloses (stageBCapacity (shape 1 5 2) 2) := by + have hb := contains_sound (Ball.add_sound CB1_5_2I2PairH_sound + (Ball.neg_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) CB1_5_2I2Group_sound))) + (show contains (.add CB1_5_2I2PairH (.neg (.mul (.exact 2) CB1_5_2I2Group))) CB1_5_2I2H = true by decide +kernel) + simp only [stageBCapacity, nativeCapacity, + show (2 : Fin 3) ≠ 0 by decide, ite_false] + change CB1_5_2I2H.Encloses (homogeneousEntropy CB1_5_2I2PairValue - _) + simpa only [sub_eq_add_neg] using hb + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/CapacityB/CapB1_6_1I0.lean b/lean/OAI/LinearAlgebra/MatrixFields/CapacityB/CapB1_6_1I0.lean new file mode 100644 index 0000000000000000000000000000000000000000..8c388a4314497fe01accfec0d0beab74f3803006 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/CapacityB/CapB1_6_1I0.lean @@ -0,0 +1,72 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Certificates.Terminal1_6_1 + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CB1_6_1I0Value (a : Fin 17) : ℝ := marginal (below (shape 1 6 1)) (fun u => (stageBLaw (shape 1 6 1) u : ℝ)) ((stageBPriority (shape 1 6 1)) 0) a +def CB1_6_1I0Raw (a : Fin 17) : Ball := marginalBall (below (shape 1 6 1)) B1_6_1Law ((stageBPriority (shape 1 6 1)) 0) a +lemma CB1_6_1I0Raw_sound (a : Fin 17) : + (CB1_6_1I0Raw a).Encloses (CB1_6_1I0Value a) := by + exact marginalBall_sound (below (shape 1 6 1)) B1_6_1Law (fun u => (stageBLaw (shape 1 6 1) u : ℝ)) (fun u _ => B1_6_1Law_sound u) ((stageBPriority (shape 1 6 1)) 0) a +def CB1_6_1I0Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(1 / 2), (17 / 50000000000000000000000000000000)⟩ ⟨(6931471805599453094172319305033 / 20000000000000000000000000000000), (21175823741 / 100000000000000000000000000000000)⟩ ⟨(-6931471805599453094172319305033 / 10000000000000000000000000000000), (42351647433 / 100000000000000000000000000000000)⟩ ⟨-1, 1, 1⟩] +lemma CB1_6_1I0Certificates_valid : + CB1_6_1I0Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_6_1I0CertificateIndex (a : Fin 17) : ℕ := + match a.val with + | 0 => 1 + | 1 => 1 + | _ => 0 +def CB1_6_1I0P (a : Fin 17) : Ball := + (CompactCertificate.entropyLookup CB1_6_1I0Certificates (CB1_6_1I0CertificateIndex a)).input +lemma CB1_6_1I0P_check : ∀ a : Fin 17, contains (CB1_6_1I0Raw a) (CB1_6_1I0P a) = true := by + decide +kernel +lemma CB1_6_1I0P_sound (a : Fin 17) : + (CB1_6_1I0P a).Encloses (CB1_6_1I0Value a) := + contains_sound (CB1_6_1I0Raw_sound a) (CB1_6_1I0P_check a) +def CB1_6_1I0Terms (a : Fin 17) : Ball := + (CompactCertificate.entropyLookup CB1_6_1I0Certificates (CB1_6_1I0CertificateIndex a)).output +lemma CB1_6_1I0Terms_sound (a : Fin 17) : + (CB1_6_1I0Terms a).Encloses (Foundation.entropyTerm (CB1_6_1I0Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_6_1I0Certificates_valid + (CB1_6_1I0CertificateIndex a) (CB1_6_1I0P_sound a) +def CB1_6_1I0Entropy : Ball := ⟨(6931471805599453094172319305033 / 10000000000000000000000000000000), (21175823741 / 50000000000000000000000000000000)⟩ +lemma CB1_6_1I0Entropy_sound : CB1_6_1I0Entropy.Encloses (Foundation.finiteEntropy CB1_6_1I0Value) := by + exact contains_sound (entropyFin_enclosed 17 CB1_6_1I0Value CB1_6_1I0Terms CB1_6_1I0Terms_sound) (by decide +kernel) +def CB1_6_1I0Mass : Ball := ⟨1, (17 / 25000000000000000000000000000000)⟩ +lemma CB1_6_1I0Mass_sound : CB1_6_1I0Mass.Encloses (∑ a, CB1_6_1I0Value a) := by + exact contains_sound (finSumBall_sound 17 CB1_6_1I0P CB1_6_1I0Value CB1_6_1I0P_sound) (by decide +kernel) +def CB1_6_1I0MassTermLogWitness : LogWitness := ⟨0, 1, 1⟩ +def CB1_6_1I0MassTermLog : Ball := ⟨0, (16940659 / 80000000000000000000000000000)⟩ +lemma CB1_6_1I0MassTermLog_sound : CB1_6_1I0MassTermLog.Encloses (Real.log ((∑ a, CB1_6_1I0Value a))) := by + exact checkLog_sound logTwoBall_sound (CB1_6_1I0Mass_sound) (w := CB1_6_1I0MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB1_6_1I0MassTerm : Ball := ⟨0, (21175823751 / 100000000000000000000000000000000)⟩ +lemma CB1_6_1I0MassTerm_sound : CB1_6_1I0MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_6_1I0Value a))) := by + exact contains_sound (entropyTerm_ball (CB1_6_1I0Mass_sound) CB1_6_1I0MassTermLog_sound) (by decide +kernel) +def CB1_6_1I0H : Ball := ⟨(6931471805599453094172319305033 / 10000000000000000000000000000000), (63527471233 / 100000000000000000000000000000000)⟩ +lemma CB1_6_1I0H_sound : CB1_6_1I0H.Encloses (homogeneousEntropy CB1_6_1I0Value) := by + exact contains_sound (homogeneous_enclosed CB1_6_1I0Value CB1_6_1I0MassTerm_sound CB1_6_1I0Entropy_sound) (by decide +kernel) +lemma CB1_6_1I0_sound : CB1_6_1I0H.Encloses (stageBCapacity (shape 1 6 1) 0) := by + exact CB1_6_1I0H_sound + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/CapacityB/CapB1_6_1I1.lean b/lean/OAI/LinearAlgebra/MatrixFields/CapacityB/CapB1_6_1I1.lean new file mode 100644 index 0000000000000000000000000000000000000000..1e0662f6a6d24d8dc57f6a984bc65c021f719631 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/CapacityB/CapB1_6_1I1.lean @@ -0,0 +1,824 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Certificates.Terminal1_6_1 + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CB1_6_1I1PairValue (a : PairSlot) : ℝ := pairLaw (below (shape 1 6 1)) (shape 1 6 1) (fun u => (stageBLaw (shape 1 6 1) u : ℝ)) (fun u a => (littleLaw (shape 1 6 1) u ((stageBPriority (shape 1 6 1)) 1) a : ℝ)) a +def CB1_6_1I1PairRaw (a : PairSlot) : Ball := pairLawBall (below (shape 1 6 1)) (shape 1 6 1) B1_6_1Law (fun u => B1_6_1Little u ((stageBPriority (shape 1 6 1)) 1)) a +lemma CB1_6_1I1PairRaw_sound (a : PairSlot) : + (CB1_6_1I1PairRaw a).Encloses (CB1_6_1I1PairValue a) := by + exact pairLawBall_sound_on (below (shape 1 6 1)) (shape 1 6 1) B1_6_1Law (fun u => (stageBLaw (shape 1 6 1) u : ℝ)) (fun u => B1_6_1Little u ((stageBPriority (shape 1 6 1)) 1)) (fun u a => (littleLaw (shape 1 6 1) u ((stageBPriority (shape 1 6 1)) 1) a : ℝ)) (fun u _ => B1_6_1Law_sound u) (fun u _ a => B1_6_1Little_sound u ((stageBPriority (shape 1 6 1)) 1) a) (fun u _ a => B1_6_1Little_sound (complement (shape 1 6 1) u) ((stageBPriority (shape 1 6 1)) 1) a) a +def CB1_6_1I1PairCertificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(1 / 2), (17 / 50000000000000000000000000000000)⟩ ⟨(6931471805599453094172319305033 / 20000000000000000000000000000000), (21175823741 / 100000000000000000000000000000000)⟩ ⟨(-6931471805599453094172319305033 / 10000000000000000000000000000000), (42351647433 / 100000000000000000000000000000000)⟩ ⟨-1, 1, 1⟩] +lemma CB1_6_1I1PairCertificates_valid : + CB1_6_1I1PairCertificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_6_1I1PairCertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 1, 0 => 1 + | 0, 1 => 1 + | _, _ => 0 +def CB1_6_1I1PairP (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CB1_6_1I1PairCertificates (CB1_6_1I1PairCertificateIndex a)).input +lemma CB1_6_1I1PairP_check : ∀ a : PairSlot, contains (CB1_6_1I1PairRaw a) (CB1_6_1I1PairP a) = true := by + decide +kernel +lemma CB1_6_1I1PairP_sound (a : PairSlot) : + (CB1_6_1I1PairP a).Encloses (CB1_6_1I1PairValue a) := + contains_sound (CB1_6_1I1PairRaw_sound a) (CB1_6_1I1PairP_check a) +def CB1_6_1I1PairTerms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CB1_6_1I1PairCertificates (CB1_6_1I1PairCertificateIndex a)).output +lemma CB1_6_1I1PairTerms_sound (a : PairSlot) : + (CB1_6_1I1PairTerms a).Encloses (Foundation.entropyTerm (CB1_6_1I1PairValue a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_6_1I1PairCertificates_valid + (CB1_6_1I1PairCertificateIndex a) (CB1_6_1I1PairP_sound a) +def CB1_6_1I1PairEntropy : Ball := ⟨(6931471805599453094172319305033 / 10000000000000000000000000000000), (21175823741 / 50000000000000000000000000000000)⟩ +lemma CB1_6_1I1PairEntropy_sound : CB1_6_1I1PairEntropy.Encloses (Foundation.finiteEntropy CB1_6_1I1PairValue) := by + exact contains_sound (entropyPair_enclosed CB1_6_1I1PairValue CB1_6_1I1PairTerms CB1_6_1I1PairTerms_sound) (by decide +kernel) +def CB1_6_1I1PairMass : Ball := ⟨1, (17 / 25000000000000000000000000000000)⟩ +lemma CB1_6_1I1PairMass_sound : CB1_6_1I1PairMass.Encloses (∑ a, CB1_6_1I1PairValue a) := by + exact contains_sound (pairSumBall_sound CB1_6_1I1PairP CB1_6_1I1PairValue CB1_6_1I1PairP_sound) (by decide +kernel) +def CB1_6_1I1PairMassTermLogWitness : LogWitness := ⟨0, 1, 1⟩ +def CB1_6_1I1PairMassTermLog : Ball := ⟨0, (16940659 / 80000000000000000000000000000)⟩ +lemma CB1_6_1I1PairMassTermLog_sound : CB1_6_1I1PairMassTermLog.Encloses (Real.log ((∑ a, CB1_6_1I1PairValue a))) := by + exact checkLog_sound logTwoBall_sound (CB1_6_1I1PairMass_sound) (w := CB1_6_1I1PairMassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB1_6_1I1PairMassTerm : Ball := ⟨0, (21175823751 / 100000000000000000000000000000000)⟩ +lemma CB1_6_1I1PairMassTerm_sound : CB1_6_1I1PairMassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_6_1I1PairValue a))) := by + exact contains_sound (entropyTerm_ball (CB1_6_1I1PairMass_sound) CB1_6_1I1PairMassTermLog_sound) (by decide +kernel) +def CB1_6_1I1PairH : Ball := ⟨(6931471805599453094172319305033 / 10000000000000000000000000000000), (63527471233 / 100000000000000000000000000000000)⟩ +lemma CB1_6_1I1PairH_sound : CB1_6_1I1PairH.Encloses (homogeneousEntropy CB1_6_1I1PairValue) := by + exact contains_sound (homogeneous_enclosed CB1_6_1I1PairValue CB1_6_1I1PairMassTerm_sound CB1_6_1I1PairEntropy_sound) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CB1_6_1I1R0Value (a : Fin 6) : ℝ := residualLaw (below (shape 1 6 1)) (fun u => (stageBLaw (shape 1 6 1) u : ℝ)) (stageBPriority (shape 1 6 1)) 1 (fun u a => (littleLaw (shape 1 6 1) u ((stageBPriority (shape 1 6 1)) 1) a : ℝ)) 0 a +def CB1_6_1I1R0Raw (a : Fin 6) : Ball := residualBall (below (shape 1 6 1)) B1_6_1Law (stageBPriority (shape 1 6 1)) 1 (fun u => B1_6_1Little u ((stageBPriority (shape 1 6 1)) 1)) 0 a +lemma CB1_6_1I1R0Raw_sound (a : Fin 6) : + (CB1_6_1I1R0Raw a).Encloses (CB1_6_1I1R0Value a) := by + exact residualBall_sound_on (below (shape 1 6 1)) B1_6_1Law (fun u => (stageBLaw (shape 1 6 1) u : ℝ)) (stageBPriority (shape 1 6 1)) 1 (fun u => B1_6_1Little u ((stageBPriority (shape 1 6 1)) 1)) (fun u a => (littleLaw (shape 1 6 1) u ((stageBPriority (shape 1 6 1)) 1) a : ℝ)) (fun u _ => B1_6_1Law_sound u) (fun u _ a => B1_6_1Little_sound u ((stageBPriority (shape 1 6 1)) 1) a) 0 a +def CB1_6_1I1R0Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(1 / 2), (17 / 50000000000000000000000000000000)⟩ ⟨(6931471805599453094172319305033 / 20000000000000000000000000000000), (21175823741 / 100000000000000000000000000000000)⟩ ⟨(-6931471805599453094172319305033 / 10000000000000000000000000000000), (42351647433 / 100000000000000000000000000000000)⟩ ⟨-1, 1, 1⟩] +lemma CB1_6_1I1R0Certificates_valid : + CB1_6_1I1R0Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_6_1I1R0CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | 0 => 1 + | _ => 0 +def CB1_6_1I1R0P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_6_1I1R0Certificates (CB1_6_1I1R0CertificateIndex a)).input +lemma CB1_6_1I1R0P_check : ∀ a : Fin 6, contains (CB1_6_1I1R0Raw a) (CB1_6_1I1R0P a) = true := by + decide +kernel +lemma CB1_6_1I1R0P_sound (a : Fin 6) : + (CB1_6_1I1R0P a).Encloses (CB1_6_1I1R0Value a) := + contains_sound (CB1_6_1I1R0Raw_sound a) (CB1_6_1I1R0P_check a) +def CB1_6_1I1R0Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_6_1I1R0Certificates (CB1_6_1I1R0CertificateIndex a)).output +lemma CB1_6_1I1R0Terms_sound (a : Fin 6) : + (CB1_6_1I1R0Terms a).Encloses (Foundation.entropyTerm (CB1_6_1I1R0Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_6_1I1R0Certificates_valid + (CB1_6_1I1R0CertificateIndex a) (CB1_6_1I1R0P_sound a) +def CB1_6_1I1R0Entropy : Ball := ⟨(6931471805599453094172319305033 / 20000000000000000000000000000000), (21175823741 / 100000000000000000000000000000000)⟩ +lemma CB1_6_1I1R0Entropy_sound : CB1_6_1I1R0Entropy.Encloses (Foundation.finiteEntropy CB1_6_1I1R0Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_6_1I1R0Value CB1_6_1I1R0Terms CB1_6_1I1R0Terms_sound) (by decide +kernel) +def CB1_6_1I1R0Mass : Ball := ⟨(1 / 2), (17 / 50000000000000000000000000000000)⟩ +lemma CB1_6_1I1R0Mass_sound : CB1_6_1I1R0Mass.Encloses (∑ a, CB1_6_1I1R0Value a) := by + exact contains_sound (finSumBall_sound 6 CB1_6_1I1R0P CB1_6_1I1R0Value CB1_6_1I1R0P_sound) (by decide +kernel) +def CB1_6_1I1R0MassTermLogWitness : LogWitness := ⟨-1, 1, 1⟩ +def CB1_6_1I1R0MassTermLog : Ball := ⟨(-6931471805599453094172319305033 / 10000000000000000000000000000000), (42351647433 / 100000000000000000000000000000000)⟩ +lemma CB1_6_1I1R0MassTermLog_sound : CB1_6_1I1R0MassTermLog.Encloses (Real.log ((∑ a, CB1_6_1I1R0Value a))) := by + exact checkLog_sound logTwoBall_sound (CB1_6_1I1R0Mass_sound) (w := CB1_6_1I1R0MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB1_6_1I1R0MassTerm : Ball := ⟨(6931471805599453094172319305033 / 20000000000000000000000000000000), (21175823741 / 100000000000000000000000000000000)⟩ +lemma CB1_6_1I1R0MassTerm_sound : CB1_6_1I1R0MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_6_1I1R0Value a))) := by + exact contains_sound (entropyTerm_ball (CB1_6_1I1R0Mass_sound) CB1_6_1I1R0MassTermLog_sound) (by decide +kernel) +def CB1_6_1I1R0H : Ball := ⟨0, (21175823741 / 50000000000000000000000000000000)⟩ +lemma CB1_6_1I1R0H_sound : CB1_6_1I1R0H.Encloses (homogeneousEntropy CB1_6_1I1R0Value) := by + exact contains_sound (homogeneous_enclosed CB1_6_1I1R0Value CB1_6_1I1R0MassTerm_sound CB1_6_1I1R0Entropy_sound) (by decide +kernel) +def CB1_6_1I1R1Value (a : Fin 6) : ℝ := residualLaw (below (shape 1 6 1)) (fun u => (stageBLaw (shape 1 6 1) u : ℝ)) (stageBPriority (shape 1 6 1)) 1 (fun u a => (littleLaw (shape 1 6 1) u ((stageBPriority (shape 1 6 1)) 1) a : ℝ)) 1 a +def CB1_6_1I1R1Raw (a : Fin 6) : Ball := residualBall (below (shape 1 6 1)) B1_6_1Law (stageBPriority (shape 1 6 1)) 1 (fun u => B1_6_1Little u ((stageBPriority (shape 1 6 1)) 1)) 1 a +lemma CB1_6_1I1R1Raw_sound (a : Fin 6) : + (CB1_6_1I1R1Raw a).Encloses (CB1_6_1I1R1Value a) := by + exact residualBall_sound_on (below (shape 1 6 1)) B1_6_1Law (fun u => (stageBLaw (shape 1 6 1) u : ℝ)) (stageBPriority (shape 1 6 1)) 1 (fun u => B1_6_1Little u ((stageBPriority (shape 1 6 1)) 1)) (fun u a => (littleLaw (shape 1 6 1) u ((stageBPriority (shape 1 6 1)) 1) a : ℝ)) (fun u _ => B1_6_1Law_sound u) (fun u _ a => B1_6_1Little_sound u ((stageBPriority (shape 1 6 1)) 1) a) 1 a +def CB1_6_1I1R1Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(1 / 2), (17 / 50000000000000000000000000000000)⟩ ⟨(6931471805599453094172319305033 / 20000000000000000000000000000000), (21175823741 / 100000000000000000000000000000000)⟩ ⟨(-6931471805599453094172319305033 / 10000000000000000000000000000000), (42351647433 / 100000000000000000000000000000000)⟩ ⟨-1, 1, 1⟩] +lemma CB1_6_1I1R1Certificates_valid : + CB1_6_1I1R1Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_6_1I1R1CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | 1 => 1 + | _ => 0 +def CB1_6_1I1R1P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_6_1I1R1Certificates (CB1_6_1I1R1CertificateIndex a)).input +lemma CB1_6_1I1R1P_check : ∀ a : Fin 6, contains (CB1_6_1I1R1Raw a) (CB1_6_1I1R1P a) = true := by + decide +kernel +lemma CB1_6_1I1R1P_sound (a : Fin 6) : + (CB1_6_1I1R1P a).Encloses (CB1_6_1I1R1Value a) := + contains_sound (CB1_6_1I1R1Raw_sound a) (CB1_6_1I1R1P_check a) +def CB1_6_1I1R1Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_6_1I1R1Certificates (CB1_6_1I1R1CertificateIndex a)).output +lemma CB1_6_1I1R1Terms_sound (a : Fin 6) : + (CB1_6_1I1R1Terms a).Encloses (Foundation.entropyTerm (CB1_6_1I1R1Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_6_1I1R1Certificates_valid + (CB1_6_1I1R1CertificateIndex a) (CB1_6_1I1R1P_sound a) +def CB1_6_1I1R1Entropy : Ball := ⟨(6931471805599453094172319305033 / 20000000000000000000000000000000), (21175823741 / 100000000000000000000000000000000)⟩ +lemma CB1_6_1I1R1Entropy_sound : CB1_6_1I1R1Entropy.Encloses (Foundation.finiteEntropy CB1_6_1I1R1Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_6_1I1R1Value CB1_6_1I1R1Terms CB1_6_1I1R1Terms_sound) (by decide +kernel) +def CB1_6_1I1R1Mass : Ball := ⟨(1 / 2), (17 / 50000000000000000000000000000000)⟩ +lemma CB1_6_1I1R1Mass_sound : CB1_6_1I1R1Mass.Encloses (∑ a, CB1_6_1I1R1Value a) := by + exact contains_sound (finSumBall_sound 6 CB1_6_1I1R1P CB1_6_1I1R1Value CB1_6_1I1R1P_sound) (by decide +kernel) +def CB1_6_1I1R1MassTermLogWitness : LogWitness := ⟨-1, 1, 1⟩ +def CB1_6_1I1R1MassTermLog : Ball := ⟨(-6931471805599453094172319305033 / 10000000000000000000000000000000), (42351647433 / 100000000000000000000000000000000)⟩ +lemma CB1_6_1I1R1MassTermLog_sound : CB1_6_1I1R1MassTermLog.Encloses (Real.log ((∑ a, CB1_6_1I1R1Value a))) := by + exact checkLog_sound logTwoBall_sound (CB1_6_1I1R1Mass_sound) (w := CB1_6_1I1R1MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB1_6_1I1R1MassTerm : Ball := ⟨(6931471805599453094172319305033 / 20000000000000000000000000000000), (21175823741 / 100000000000000000000000000000000)⟩ +lemma CB1_6_1I1R1MassTerm_sound : CB1_6_1I1R1MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_6_1I1R1Value a))) := by + exact contains_sound (entropyTerm_ball (CB1_6_1I1R1Mass_sound) CB1_6_1I1R1MassTermLog_sound) (by decide +kernel) +def CB1_6_1I1R1H : Ball := ⟨0, (21175823741 / 50000000000000000000000000000000)⟩ +lemma CB1_6_1I1R1H_sound : CB1_6_1I1R1H.Encloses (homogeneousEntropy CB1_6_1I1R1Value) := by + exact contains_sound (homogeneous_enclosed CB1_6_1I1R1Value CB1_6_1I1R1MassTerm_sound CB1_6_1I1R1Entropy_sound) (by decide +kernel) +def CB1_6_1I1R2Value (a : Fin 6) : ℝ := residualLaw (below (shape 1 6 1)) (fun u => (stageBLaw (shape 1 6 1) u : ℝ)) (stageBPriority (shape 1 6 1)) 1 (fun u a => (littleLaw (shape 1 6 1) u ((stageBPriority (shape 1 6 1)) 1) a : ℝ)) 2 a +def CB1_6_1I1R2Raw (a : Fin 6) : Ball := residualBall (below (shape 1 6 1)) B1_6_1Law (stageBPriority (shape 1 6 1)) 1 (fun u => B1_6_1Little u ((stageBPriority (shape 1 6 1)) 1)) 2 a +lemma CB1_6_1I1R2Raw_sound (a : Fin 6) : + (CB1_6_1I1R2Raw a).Encloses (CB1_6_1I1R2Value a) := by + exact residualBall_sound_on (below (shape 1 6 1)) B1_6_1Law (fun u => (stageBLaw (shape 1 6 1) u : ℝ)) (stageBPriority (shape 1 6 1)) 1 (fun u => B1_6_1Little u ((stageBPriority (shape 1 6 1)) 1)) (fun u a => (littleLaw (shape 1 6 1) u ((stageBPriority (shape 1 6 1)) 1) a : ℝ)) (fun u _ => B1_6_1Law_sound u) (fun u _ a => B1_6_1Little_sound u ((stageBPriority (shape 1 6 1)) 1) a) 2 a +def CB1_6_1I1R2Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB1_6_1I1R2Certificates_valid : + CB1_6_1I1R2Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_6_1I1R2CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB1_6_1I1R2P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_6_1I1R2Certificates (CB1_6_1I1R2CertificateIndex a)).input +lemma CB1_6_1I1R2P_check : ∀ a : Fin 6, contains (CB1_6_1I1R2Raw a) (CB1_6_1I1R2P a) = true := by + decide +kernel +lemma CB1_6_1I1R2P_sound (a : Fin 6) : + (CB1_6_1I1R2P a).Encloses (CB1_6_1I1R2Value a) := + contains_sound (CB1_6_1I1R2Raw_sound a) (CB1_6_1I1R2P_check a) +def CB1_6_1I1R2Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_6_1I1R2Certificates (CB1_6_1I1R2CertificateIndex a)).output +lemma CB1_6_1I1R2Terms_sound (a : Fin 6) : + (CB1_6_1I1R2Terms a).Encloses (Foundation.entropyTerm (CB1_6_1I1R2Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_6_1I1R2Certificates_valid + (CB1_6_1I1R2CertificateIndex a) (CB1_6_1I1R2P_sound a) +def CB1_6_1I1R2Entropy : Ball := ⟨0, 0⟩ +lemma CB1_6_1I1R2Entropy_sound : CB1_6_1I1R2Entropy.Encloses (Foundation.finiteEntropy CB1_6_1I1R2Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_6_1I1R2Value CB1_6_1I1R2Terms CB1_6_1I1R2Terms_sound) (by decide +kernel) +def CB1_6_1I1R2Mass : Ball := ⟨0, 0⟩ +lemma CB1_6_1I1R2Mass_sound : CB1_6_1I1R2Mass.Encloses (∑ a, CB1_6_1I1R2Value a) := by + exact contains_sound (finSumBall_sound 6 CB1_6_1I1R2P CB1_6_1I1R2Value CB1_6_1I1R2P_sound) (by decide +kernel) +def CB1_6_1I1R2MassTerm : Ball := .exact 0 +lemma CB1_6_1I1R2MassTerm_sound : CB1_6_1I1R2MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_6_1I1R2Value a))) := + entropyTerm_zero_ball (CB1_6_1I1R2Mass_sound) +def CB1_6_1I1R2H : Ball := ⟨0, 0⟩ +lemma CB1_6_1I1R2H_sound : CB1_6_1I1R2H.Encloses (homogeneousEntropy CB1_6_1I1R2Value) := by + exact contains_sound (homogeneous_enclosed CB1_6_1I1R2Value CB1_6_1I1R2MassTerm_sound CB1_6_1I1R2Entropy_sound) (by decide +kernel) +def CB1_6_1I1R3Value (a : Fin 6) : ℝ := residualLaw (below (shape 1 6 1)) (fun u => (stageBLaw (shape 1 6 1) u : ℝ)) (stageBPriority (shape 1 6 1)) 1 (fun u a => (littleLaw (shape 1 6 1) u ((stageBPriority (shape 1 6 1)) 1) a : ℝ)) 3 a +def CB1_6_1I1R3Raw (a : Fin 6) : Ball := residualBall (below (shape 1 6 1)) B1_6_1Law (stageBPriority (shape 1 6 1)) 1 (fun u => B1_6_1Little u ((stageBPriority (shape 1 6 1)) 1)) 3 a +lemma CB1_6_1I1R3Raw_sound (a : Fin 6) : + (CB1_6_1I1R3Raw a).Encloses (CB1_6_1I1R3Value a) := by + exact residualBall_sound_on (below (shape 1 6 1)) B1_6_1Law (fun u => (stageBLaw (shape 1 6 1) u : ℝ)) (stageBPriority (shape 1 6 1)) 1 (fun u => B1_6_1Little u ((stageBPriority (shape 1 6 1)) 1)) (fun u a => (littleLaw (shape 1 6 1) u ((stageBPriority (shape 1 6 1)) 1) a : ℝ)) (fun u _ => B1_6_1Law_sound u) (fun u _ a => B1_6_1Little_sound u ((stageBPriority (shape 1 6 1)) 1) a) 3 a +def CB1_6_1I1R3Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB1_6_1I1R3Certificates_valid : + CB1_6_1I1R3Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_6_1I1R3CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB1_6_1I1R3P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_6_1I1R3Certificates (CB1_6_1I1R3CertificateIndex a)).input +lemma CB1_6_1I1R3P_check : ∀ a : Fin 6, contains (CB1_6_1I1R3Raw a) (CB1_6_1I1R3P a) = true := by + decide +kernel +lemma CB1_6_1I1R3P_sound (a : Fin 6) : + (CB1_6_1I1R3P a).Encloses (CB1_6_1I1R3Value a) := + contains_sound (CB1_6_1I1R3Raw_sound a) (CB1_6_1I1R3P_check a) +def CB1_6_1I1R3Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_6_1I1R3Certificates (CB1_6_1I1R3CertificateIndex a)).output +lemma CB1_6_1I1R3Terms_sound (a : Fin 6) : + (CB1_6_1I1R3Terms a).Encloses (Foundation.entropyTerm (CB1_6_1I1R3Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_6_1I1R3Certificates_valid + (CB1_6_1I1R3CertificateIndex a) (CB1_6_1I1R3P_sound a) +def CB1_6_1I1R3Entropy : Ball := ⟨0, 0⟩ +lemma CB1_6_1I1R3Entropy_sound : CB1_6_1I1R3Entropy.Encloses (Foundation.finiteEntropy CB1_6_1I1R3Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_6_1I1R3Value CB1_6_1I1R3Terms CB1_6_1I1R3Terms_sound) (by decide +kernel) +def CB1_6_1I1R3Mass : Ball := ⟨0, 0⟩ +lemma CB1_6_1I1R3Mass_sound : CB1_6_1I1R3Mass.Encloses (∑ a, CB1_6_1I1R3Value a) := by + exact contains_sound (finSumBall_sound 6 CB1_6_1I1R3P CB1_6_1I1R3Value CB1_6_1I1R3P_sound) (by decide +kernel) +def CB1_6_1I1R3MassTerm : Ball := .exact 0 +lemma CB1_6_1I1R3MassTerm_sound : CB1_6_1I1R3MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_6_1I1R3Value a))) := + entropyTerm_zero_ball (CB1_6_1I1R3Mass_sound) +def CB1_6_1I1R3H : Ball := ⟨0, 0⟩ +lemma CB1_6_1I1R3H_sound : CB1_6_1I1R3H.Encloses (homogeneousEntropy CB1_6_1I1R3Value) := by + exact contains_sound (homogeneous_enclosed CB1_6_1I1R3Value CB1_6_1I1R3MassTerm_sound CB1_6_1I1R3Entropy_sound) (by decide +kernel) +def CB1_6_1I1R4Value (a : Fin 6) : ℝ := residualLaw (below (shape 1 6 1)) (fun u => (stageBLaw (shape 1 6 1) u : ℝ)) (stageBPriority (shape 1 6 1)) 1 (fun u a => (littleLaw (shape 1 6 1) u ((stageBPriority (shape 1 6 1)) 1) a : ℝ)) 4 a +def CB1_6_1I1R4Raw (a : Fin 6) : Ball := residualBall (below (shape 1 6 1)) B1_6_1Law (stageBPriority (shape 1 6 1)) 1 (fun u => B1_6_1Little u ((stageBPriority (shape 1 6 1)) 1)) 4 a +lemma CB1_6_1I1R4Raw_sound (a : Fin 6) : + (CB1_6_1I1R4Raw a).Encloses (CB1_6_1I1R4Value a) := by + exact residualBall_sound_on (below (shape 1 6 1)) B1_6_1Law (fun u => (stageBLaw (shape 1 6 1) u : ℝ)) (stageBPriority (shape 1 6 1)) 1 (fun u => B1_6_1Little u ((stageBPriority (shape 1 6 1)) 1)) (fun u a => (littleLaw (shape 1 6 1) u ((stageBPriority (shape 1 6 1)) 1) a : ℝ)) (fun u _ => B1_6_1Law_sound u) (fun u _ a => B1_6_1Little_sound u ((stageBPriority (shape 1 6 1)) 1) a) 4 a +def CB1_6_1I1R4Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB1_6_1I1R4Certificates_valid : + CB1_6_1I1R4Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_6_1I1R4CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB1_6_1I1R4P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_6_1I1R4Certificates (CB1_6_1I1R4CertificateIndex a)).input +lemma CB1_6_1I1R4P_check : ∀ a : Fin 6, contains (CB1_6_1I1R4Raw a) (CB1_6_1I1R4P a) = true := by + decide +kernel +lemma CB1_6_1I1R4P_sound (a : Fin 6) : + (CB1_6_1I1R4P a).Encloses (CB1_6_1I1R4Value a) := + contains_sound (CB1_6_1I1R4Raw_sound a) (CB1_6_1I1R4P_check a) +def CB1_6_1I1R4Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_6_1I1R4Certificates (CB1_6_1I1R4CertificateIndex a)).output +lemma CB1_6_1I1R4Terms_sound (a : Fin 6) : + (CB1_6_1I1R4Terms a).Encloses (Foundation.entropyTerm (CB1_6_1I1R4Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_6_1I1R4Certificates_valid + (CB1_6_1I1R4CertificateIndex a) (CB1_6_1I1R4P_sound a) +def CB1_6_1I1R4Entropy : Ball := ⟨0, 0⟩ +lemma CB1_6_1I1R4Entropy_sound : CB1_6_1I1R4Entropy.Encloses (Foundation.finiteEntropy CB1_6_1I1R4Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_6_1I1R4Value CB1_6_1I1R4Terms CB1_6_1I1R4Terms_sound) (by decide +kernel) +def CB1_6_1I1R4Mass : Ball := ⟨0, 0⟩ +lemma CB1_6_1I1R4Mass_sound : CB1_6_1I1R4Mass.Encloses (∑ a, CB1_6_1I1R4Value a) := by + exact contains_sound (finSumBall_sound 6 CB1_6_1I1R4P CB1_6_1I1R4Value CB1_6_1I1R4P_sound) (by decide +kernel) +def CB1_6_1I1R4MassTerm : Ball := .exact 0 +lemma CB1_6_1I1R4MassTerm_sound : CB1_6_1I1R4MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_6_1I1R4Value a))) := + entropyTerm_zero_ball (CB1_6_1I1R4Mass_sound) +def CB1_6_1I1R4H : Ball := ⟨0, 0⟩ +lemma CB1_6_1I1R4H_sound : CB1_6_1I1R4H.Encloses (homogeneousEntropy CB1_6_1I1R4Value) := by + exact contains_sound (homogeneous_enclosed CB1_6_1I1R4Value CB1_6_1I1R4MassTerm_sound CB1_6_1I1R4Entropy_sound) (by decide +kernel) +def CB1_6_1I1R5Value (a : Fin 6) : ℝ := residualLaw (below (shape 1 6 1)) (fun u => (stageBLaw (shape 1 6 1) u : ℝ)) (stageBPriority (shape 1 6 1)) 1 (fun u a => (littleLaw (shape 1 6 1) u ((stageBPriority (shape 1 6 1)) 1) a : ℝ)) 5 a +def CB1_6_1I1R5Raw (a : Fin 6) : Ball := residualBall (below (shape 1 6 1)) B1_6_1Law (stageBPriority (shape 1 6 1)) 1 (fun u => B1_6_1Little u ((stageBPriority (shape 1 6 1)) 1)) 5 a +lemma CB1_6_1I1R5Raw_sound (a : Fin 6) : + (CB1_6_1I1R5Raw a).Encloses (CB1_6_1I1R5Value a) := by + exact residualBall_sound_on (below (shape 1 6 1)) B1_6_1Law (fun u => (stageBLaw (shape 1 6 1) u : ℝ)) (stageBPriority (shape 1 6 1)) 1 (fun u => B1_6_1Little u ((stageBPriority (shape 1 6 1)) 1)) (fun u a => (littleLaw (shape 1 6 1) u ((stageBPriority (shape 1 6 1)) 1) a : ℝ)) (fun u _ => B1_6_1Law_sound u) (fun u _ a => B1_6_1Little_sound u ((stageBPriority (shape 1 6 1)) 1) a) 5 a +def CB1_6_1I1R5Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB1_6_1I1R5Certificates_valid : + CB1_6_1I1R5Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_6_1I1R5CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB1_6_1I1R5P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_6_1I1R5Certificates (CB1_6_1I1R5CertificateIndex a)).input +lemma CB1_6_1I1R5P_check : ∀ a : Fin 6, contains (CB1_6_1I1R5Raw a) (CB1_6_1I1R5P a) = true := by + decide +kernel +lemma CB1_6_1I1R5P_sound (a : Fin 6) : + (CB1_6_1I1R5P a).Encloses (CB1_6_1I1R5Value a) := + contains_sound (CB1_6_1I1R5Raw_sound a) (CB1_6_1I1R5P_check a) +def CB1_6_1I1R5Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_6_1I1R5Certificates (CB1_6_1I1R5CertificateIndex a)).output +lemma CB1_6_1I1R5Terms_sound (a : Fin 6) : + (CB1_6_1I1R5Terms a).Encloses (Foundation.entropyTerm (CB1_6_1I1R5Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_6_1I1R5Certificates_valid + (CB1_6_1I1R5CertificateIndex a) (CB1_6_1I1R5P_sound a) +def CB1_6_1I1R5Entropy : Ball := ⟨0, 0⟩ +lemma CB1_6_1I1R5Entropy_sound : CB1_6_1I1R5Entropy.Encloses (Foundation.finiteEntropy CB1_6_1I1R5Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_6_1I1R5Value CB1_6_1I1R5Terms CB1_6_1I1R5Terms_sound) (by decide +kernel) +def CB1_6_1I1R5Mass : Ball := ⟨0, 0⟩ +lemma CB1_6_1I1R5Mass_sound : CB1_6_1I1R5Mass.Encloses (∑ a, CB1_6_1I1R5Value a) := by + exact contains_sound (finSumBall_sound 6 CB1_6_1I1R5P CB1_6_1I1R5Value CB1_6_1I1R5P_sound) (by decide +kernel) +def CB1_6_1I1R5MassTerm : Ball := .exact 0 +lemma CB1_6_1I1R5MassTerm_sound : CB1_6_1I1R5MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_6_1I1R5Value a))) := + entropyTerm_zero_ball (CB1_6_1I1R5Mass_sound) +def CB1_6_1I1R5H : Ball := ⟨0, 0⟩ +lemma CB1_6_1I1R5H_sound : CB1_6_1I1R5H.Encloses (homogeneousEntropy CB1_6_1I1R5Value) := by + exact contains_sound (homogeneous_enclosed CB1_6_1I1R5Value CB1_6_1I1R5MassTerm_sound CB1_6_1I1R5Entropy_sound) (by decide +kernel) +def CB1_6_1I1R6Value (a : Fin 6) : ℝ := residualLaw (below (shape 1 6 1)) (fun u => (stageBLaw (shape 1 6 1) u : ℝ)) (stageBPriority (shape 1 6 1)) 1 (fun u a => (littleLaw (shape 1 6 1) u ((stageBPriority (shape 1 6 1)) 1) a : ℝ)) 6 a +def CB1_6_1I1R6Raw (a : Fin 6) : Ball := residualBall (below (shape 1 6 1)) B1_6_1Law (stageBPriority (shape 1 6 1)) 1 (fun u => B1_6_1Little u ((stageBPriority (shape 1 6 1)) 1)) 6 a +lemma CB1_6_1I1R6Raw_sound (a : Fin 6) : + (CB1_6_1I1R6Raw a).Encloses (CB1_6_1I1R6Value a) := by + exact residualBall_sound_on (below (shape 1 6 1)) B1_6_1Law (fun u => (stageBLaw (shape 1 6 1) u : ℝ)) (stageBPriority (shape 1 6 1)) 1 (fun u => B1_6_1Little u ((stageBPriority (shape 1 6 1)) 1)) (fun u a => (littleLaw (shape 1 6 1) u ((stageBPriority (shape 1 6 1)) 1) a : ℝ)) (fun u _ => B1_6_1Law_sound u) (fun u _ a => B1_6_1Little_sound u ((stageBPriority (shape 1 6 1)) 1) a) 6 a +def CB1_6_1I1R6Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB1_6_1I1R6Certificates_valid : + CB1_6_1I1R6Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_6_1I1R6CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB1_6_1I1R6P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_6_1I1R6Certificates (CB1_6_1I1R6CertificateIndex a)).input +lemma CB1_6_1I1R6P_check : ∀ a : Fin 6, contains (CB1_6_1I1R6Raw a) (CB1_6_1I1R6P a) = true := by + decide +kernel +lemma CB1_6_1I1R6P_sound (a : Fin 6) : + (CB1_6_1I1R6P a).Encloses (CB1_6_1I1R6Value a) := + contains_sound (CB1_6_1I1R6Raw_sound a) (CB1_6_1I1R6P_check a) +def CB1_6_1I1R6Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_6_1I1R6Certificates (CB1_6_1I1R6CertificateIndex a)).output +lemma CB1_6_1I1R6Terms_sound (a : Fin 6) : + (CB1_6_1I1R6Terms a).Encloses (Foundation.entropyTerm (CB1_6_1I1R6Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_6_1I1R6Certificates_valid + (CB1_6_1I1R6CertificateIndex a) (CB1_6_1I1R6P_sound a) +def CB1_6_1I1R6Entropy : Ball := ⟨0, 0⟩ +lemma CB1_6_1I1R6Entropy_sound : CB1_6_1I1R6Entropy.Encloses (Foundation.finiteEntropy CB1_6_1I1R6Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_6_1I1R6Value CB1_6_1I1R6Terms CB1_6_1I1R6Terms_sound) (by decide +kernel) +def CB1_6_1I1R6Mass : Ball := ⟨0, 0⟩ +lemma CB1_6_1I1R6Mass_sound : CB1_6_1I1R6Mass.Encloses (∑ a, CB1_6_1I1R6Value a) := by + exact contains_sound (finSumBall_sound 6 CB1_6_1I1R6P CB1_6_1I1R6Value CB1_6_1I1R6P_sound) (by decide +kernel) +def CB1_6_1I1R6MassTerm : Ball := .exact 0 +lemma CB1_6_1I1R6MassTerm_sound : CB1_6_1I1R6MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_6_1I1R6Value a))) := + entropyTerm_zero_ball (CB1_6_1I1R6Mass_sound) +def CB1_6_1I1R6H : Ball := ⟨0, 0⟩ +lemma CB1_6_1I1R6H_sound : CB1_6_1I1R6H.Encloses (homogeneousEntropy CB1_6_1I1R6Value) := by + exact contains_sound (homogeneous_enclosed CB1_6_1I1R6Value CB1_6_1I1R6MassTerm_sound CB1_6_1I1R6Entropy_sound) (by decide +kernel) +def CB1_6_1I1R7Value (a : Fin 6) : ℝ := residualLaw (below (shape 1 6 1)) (fun u => (stageBLaw (shape 1 6 1) u : ℝ)) (stageBPriority (shape 1 6 1)) 1 (fun u a => (littleLaw (shape 1 6 1) u ((stageBPriority (shape 1 6 1)) 1) a : ℝ)) 7 a +def CB1_6_1I1R7Raw (a : Fin 6) : Ball := residualBall (below (shape 1 6 1)) B1_6_1Law (stageBPriority (shape 1 6 1)) 1 (fun u => B1_6_1Little u ((stageBPriority (shape 1 6 1)) 1)) 7 a +lemma CB1_6_1I1R7Raw_sound (a : Fin 6) : + (CB1_6_1I1R7Raw a).Encloses (CB1_6_1I1R7Value a) := by + exact residualBall_sound_on (below (shape 1 6 1)) B1_6_1Law (fun u => (stageBLaw (shape 1 6 1) u : ℝ)) (stageBPriority (shape 1 6 1)) 1 (fun u => B1_6_1Little u ((stageBPriority (shape 1 6 1)) 1)) (fun u a => (littleLaw (shape 1 6 1) u ((stageBPriority (shape 1 6 1)) 1) a : ℝ)) (fun u _ => B1_6_1Law_sound u) (fun u _ a => B1_6_1Little_sound u ((stageBPriority (shape 1 6 1)) 1) a) 7 a +def CB1_6_1I1R7Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB1_6_1I1R7Certificates_valid : + CB1_6_1I1R7Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_6_1I1R7CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB1_6_1I1R7P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_6_1I1R7Certificates (CB1_6_1I1R7CertificateIndex a)).input +lemma CB1_6_1I1R7P_check : ∀ a : Fin 6, contains (CB1_6_1I1R7Raw a) (CB1_6_1I1R7P a) = true := by + decide +kernel +lemma CB1_6_1I1R7P_sound (a : Fin 6) : + (CB1_6_1I1R7P a).Encloses (CB1_6_1I1R7Value a) := + contains_sound (CB1_6_1I1R7Raw_sound a) (CB1_6_1I1R7P_check a) +def CB1_6_1I1R7Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_6_1I1R7Certificates (CB1_6_1I1R7CertificateIndex a)).output +lemma CB1_6_1I1R7Terms_sound (a : Fin 6) : + (CB1_6_1I1R7Terms a).Encloses (Foundation.entropyTerm (CB1_6_1I1R7Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_6_1I1R7Certificates_valid + (CB1_6_1I1R7CertificateIndex a) (CB1_6_1I1R7P_sound a) +def CB1_6_1I1R7Entropy : Ball := ⟨0, 0⟩ +lemma CB1_6_1I1R7Entropy_sound : CB1_6_1I1R7Entropy.Encloses (Foundation.finiteEntropy CB1_6_1I1R7Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_6_1I1R7Value CB1_6_1I1R7Terms CB1_6_1I1R7Terms_sound) (by decide +kernel) +def CB1_6_1I1R7Mass : Ball := ⟨0, 0⟩ +lemma CB1_6_1I1R7Mass_sound : CB1_6_1I1R7Mass.Encloses (∑ a, CB1_6_1I1R7Value a) := by + exact contains_sound (finSumBall_sound 6 CB1_6_1I1R7P CB1_6_1I1R7Value CB1_6_1I1R7P_sound) (by decide +kernel) +def CB1_6_1I1R7MassTerm : Ball := .exact 0 +lemma CB1_6_1I1R7MassTerm_sound : CB1_6_1I1R7MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_6_1I1R7Value a))) := + entropyTerm_zero_ball (CB1_6_1I1R7Mass_sound) +def CB1_6_1I1R7H : Ball := ⟨0, 0⟩ +lemma CB1_6_1I1R7H_sound : CB1_6_1I1R7H.Encloses (homogeneousEntropy CB1_6_1I1R7Value) := by + exact contains_sound (homogeneous_enclosed CB1_6_1I1R7Value CB1_6_1I1R7MassTerm_sound CB1_6_1I1R7Entropy_sound) (by decide +kernel) +def CB1_6_1I1R8Value (a : Fin 6) : ℝ := residualLaw (below (shape 1 6 1)) (fun u => (stageBLaw (shape 1 6 1) u : ℝ)) (stageBPriority (shape 1 6 1)) 1 (fun u a => (littleLaw (shape 1 6 1) u ((stageBPriority (shape 1 6 1)) 1) a : ℝ)) 8 a +def CB1_6_1I1R8Raw (a : Fin 6) : Ball := residualBall (below (shape 1 6 1)) B1_6_1Law (stageBPriority (shape 1 6 1)) 1 (fun u => B1_6_1Little u ((stageBPriority (shape 1 6 1)) 1)) 8 a +lemma CB1_6_1I1R8Raw_sound (a : Fin 6) : + (CB1_6_1I1R8Raw a).Encloses (CB1_6_1I1R8Value a) := by + exact residualBall_sound_on (below (shape 1 6 1)) B1_6_1Law (fun u => (stageBLaw (shape 1 6 1) u : ℝ)) (stageBPriority (shape 1 6 1)) 1 (fun u => B1_6_1Little u ((stageBPriority (shape 1 6 1)) 1)) (fun u a => (littleLaw (shape 1 6 1) u ((stageBPriority (shape 1 6 1)) 1) a : ℝ)) (fun u _ => B1_6_1Law_sound u) (fun u _ a => B1_6_1Little_sound u ((stageBPriority (shape 1 6 1)) 1) a) 8 a +def CB1_6_1I1R8Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB1_6_1I1R8Certificates_valid : + CB1_6_1I1R8Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_6_1I1R8CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB1_6_1I1R8P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_6_1I1R8Certificates (CB1_6_1I1R8CertificateIndex a)).input +lemma CB1_6_1I1R8P_check : ∀ a : Fin 6, contains (CB1_6_1I1R8Raw a) (CB1_6_1I1R8P a) = true := by + decide +kernel +lemma CB1_6_1I1R8P_sound (a : Fin 6) : + (CB1_6_1I1R8P a).Encloses (CB1_6_1I1R8Value a) := + contains_sound (CB1_6_1I1R8Raw_sound a) (CB1_6_1I1R8P_check a) +def CB1_6_1I1R8Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_6_1I1R8Certificates (CB1_6_1I1R8CertificateIndex a)).output +lemma CB1_6_1I1R8Terms_sound (a : Fin 6) : + (CB1_6_1I1R8Terms a).Encloses (Foundation.entropyTerm (CB1_6_1I1R8Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_6_1I1R8Certificates_valid + (CB1_6_1I1R8CertificateIndex a) (CB1_6_1I1R8P_sound a) +def CB1_6_1I1R8Entropy : Ball := ⟨0, 0⟩ +lemma CB1_6_1I1R8Entropy_sound : CB1_6_1I1R8Entropy.Encloses (Foundation.finiteEntropy CB1_6_1I1R8Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_6_1I1R8Value CB1_6_1I1R8Terms CB1_6_1I1R8Terms_sound) (by decide +kernel) +def CB1_6_1I1R8Mass : Ball := ⟨0, 0⟩ +lemma CB1_6_1I1R8Mass_sound : CB1_6_1I1R8Mass.Encloses (∑ a, CB1_6_1I1R8Value a) := by + exact contains_sound (finSumBall_sound 6 CB1_6_1I1R8P CB1_6_1I1R8Value CB1_6_1I1R8P_sound) (by decide +kernel) +def CB1_6_1I1R8MassTerm : Ball := .exact 0 +lemma CB1_6_1I1R8MassTerm_sound : CB1_6_1I1R8MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_6_1I1R8Value a))) := + entropyTerm_zero_ball (CB1_6_1I1R8Mass_sound) +def CB1_6_1I1R8H : Ball := ⟨0, 0⟩ +lemma CB1_6_1I1R8H_sound : CB1_6_1I1R8H.Encloses (homogeneousEntropy CB1_6_1I1R8Value) := by + exact contains_sound (homogeneous_enclosed CB1_6_1I1R8Value CB1_6_1I1R8MassTerm_sound CB1_6_1I1R8Entropy_sound) (by decide +kernel) +def CB1_6_1I1R9Value (a : Fin 6) : ℝ := residualLaw (below (shape 1 6 1)) (fun u => (stageBLaw (shape 1 6 1) u : ℝ)) (stageBPriority (shape 1 6 1)) 1 (fun u a => (littleLaw (shape 1 6 1) u ((stageBPriority (shape 1 6 1)) 1) a : ℝ)) 9 a +def CB1_6_1I1R9Raw (a : Fin 6) : Ball := residualBall (below (shape 1 6 1)) B1_6_1Law (stageBPriority (shape 1 6 1)) 1 (fun u => B1_6_1Little u ((stageBPriority (shape 1 6 1)) 1)) 9 a +lemma CB1_6_1I1R9Raw_sound (a : Fin 6) : + (CB1_6_1I1R9Raw a).Encloses (CB1_6_1I1R9Value a) := by + exact residualBall_sound_on (below (shape 1 6 1)) B1_6_1Law (fun u => (stageBLaw (shape 1 6 1) u : ℝ)) (stageBPriority (shape 1 6 1)) 1 (fun u => B1_6_1Little u ((stageBPriority (shape 1 6 1)) 1)) (fun u a => (littleLaw (shape 1 6 1) u ((stageBPriority (shape 1 6 1)) 1) a : ℝ)) (fun u _ => B1_6_1Law_sound u) (fun u _ a => B1_6_1Little_sound u ((stageBPriority (shape 1 6 1)) 1) a) 9 a +def CB1_6_1I1R9Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB1_6_1I1R9Certificates_valid : + CB1_6_1I1R9Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_6_1I1R9CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB1_6_1I1R9P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_6_1I1R9Certificates (CB1_6_1I1R9CertificateIndex a)).input +lemma CB1_6_1I1R9P_check : ∀ a : Fin 6, contains (CB1_6_1I1R9Raw a) (CB1_6_1I1R9P a) = true := by + decide +kernel +lemma CB1_6_1I1R9P_sound (a : Fin 6) : + (CB1_6_1I1R9P a).Encloses (CB1_6_1I1R9Value a) := + contains_sound (CB1_6_1I1R9Raw_sound a) (CB1_6_1I1R9P_check a) +def CB1_6_1I1R9Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_6_1I1R9Certificates (CB1_6_1I1R9CertificateIndex a)).output +lemma CB1_6_1I1R9Terms_sound (a : Fin 6) : + (CB1_6_1I1R9Terms a).Encloses (Foundation.entropyTerm (CB1_6_1I1R9Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_6_1I1R9Certificates_valid + (CB1_6_1I1R9CertificateIndex a) (CB1_6_1I1R9P_sound a) +def CB1_6_1I1R9Entropy : Ball := ⟨0, 0⟩ +lemma CB1_6_1I1R9Entropy_sound : CB1_6_1I1R9Entropy.Encloses (Foundation.finiteEntropy CB1_6_1I1R9Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_6_1I1R9Value CB1_6_1I1R9Terms CB1_6_1I1R9Terms_sound) (by decide +kernel) +def CB1_6_1I1R9Mass : Ball := ⟨0, 0⟩ +lemma CB1_6_1I1R9Mass_sound : CB1_6_1I1R9Mass.Encloses (∑ a, CB1_6_1I1R9Value a) := by + exact contains_sound (finSumBall_sound 6 CB1_6_1I1R9P CB1_6_1I1R9Value CB1_6_1I1R9P_sound) (by decide +kernel) +def CB1_6_1I1R9MassTerm : Ball := .exact 0 +lemma CB1_6_1I1R9MassTerm_sound : CB1_6_1I1R9MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_6_1I1R9Value a))) := + entropyTerm_zero_ball (CB1_6_1I1R9Mass_sound) +def CB1_6_1I1R9H : Ball := ⟨0, 0⟩ +lemma CB1_6_1I1R9H_sound : CB1_6_1I1R9H.Encloses (homogeneousEntropy CB1_6_1I1R9Value) := by + exact contains_sound (homogeneous_enclosed CB1_6_1I1R9Value CB1_6_1I1R9MassTerm_sound CB1_6_1I1R9Entropy_sound) (by decide +kernel) +def CB1_6_1I1R10Value (a : Fin 6) : ℝ := residualLaw (below (shape 1 6 1)) (fun u => (stageBLaw (shape 1 6 1) u : ℝ)) (stageBPriority (shape 1 6 1)) 1 (fun u a => (littleLaw (shape 1 6 1) u ((stageBPriority (shape 1 6 1)) 1) a : ℝ)) 10 a +def CB1_6_1I1R10Raw (a : Fin 6) : Ball := residualBall (below (shape 1 6 1)) B1_6_1Law (stageBPriority (shape 1 6 1)) 1 (fun u => B1_6_1Little u ((stageBPriority (shape 1 6 1)) 1)) 10 a +lemma CB1_6_1I1R10Raw_sound (a : Fin 6) : + (CB1_6_1I1R10Raw a).Encloses (CB1_6_1I1R10Value a) := by + exact residualBall_sound_on (below (shape 1 6 1)) B1_6_1Law (fun u => (stageBLaw (shape 1 6 1) u : ℝ)) (stageBPriority (shape 1 6 1)) 1 (fun u => B1_6_1Little u ((stageBPriority (shape 1 6 1)) 1)) (fun u a => (littleLaw (shape 1 6 1) u ((stageBPriority (shape 1 6 1)) 1) a : ℝ)) (fun u _ => B1_6_1Law_sound u) (fun u _ a => B1_6_1Little_sound u ((stageBPriority (shape 1 6 1)) 1) a) 10 a +def CB1_6_1I1R10Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB1_6_1I1R10Certificates_valid : + CB1_6_1I1R10Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_6_1I1R10CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB1_6_1I1R10P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_6_1I1R10Certificates (CB1_6_1I1R10CertificateIndex a)).input +lemma CB1_6_1I1R10P_check : ∀ a : Fin 6, contains (CB1_6_1I1R10Raw a) (CB1_6_1I1R10P a) = true := by + decide +kernel +lemma CB1_6_1I1R10P_sound (a : Fin 6) : + (CB1_6_1I1R10P a).Encloses (CB1_6_1I1R10Value a) := + contains_sound (CB1_6_1I1R10Raw_sound a) (CB1_6_1I1R10P_check a) +def CB1_6_1I1R10Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_6_1I1R10Certificates (CB1_6_1I1R10CertificateIndex a)).output +lemma CB1_6_1I1R10Terms_sound (a : Fin 6) : + (CB1_6_1I1R10Terms a).Encloses (Foundation.entropyTerm (CB1_6_1I1R10Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_6_1I1R10Certificates_valid + (CB1_6_1I1R10CertificateIndex a) (CB1_6_1I1R10P_sound a) +def CB1_6_1I1R10Entropy : Ball := ⟨0, 0⟩ +lemma CB1_6_1I1R10Entropy_sound : CB1_6_1I1R10Entropy.Encloses (Foundation.finiteEntropy CB1_6_1I1R10Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_6_1I1R10Value CB1_6_1I1R10Terms CB1_6_1I1R10Terms_sound) (by decide +kernel) +def CB1_6_1I1R10Mass : Ball := ⟨0, 0⟩ +lemma CB1_6_1I1R10Mass_sound : CB1_6_1I1R10Mass.Encloses (∑ a, CB1_6_1I1R10Value a) := by + exact contains_sound (finSumBall_sound 6 CB1_6_1I1R10P CB1_6_1I1R10Value CB1_6_1I1R10P_sound) (by decide +kernel) +def CB1_6_1I1R10MassTerm : Ball := .exact 0 +lemma CB1_6_1I1R10MassTerm_sound : CB1_6_1I1R10MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_6_1I1R10Value a))) := + entropyTerm_zero_ball (CB1_6_1I1R10Mass_sound) +def CB1_6_1I1R10H : Ball := ⟨0, 0⟩ +lemma CB1_6_1I1R10H_sound : CB1_6_1I1R10H.Encloses (homogeneousEntropy CB1_6_1I1R10Value) := by + exact contains_sound (homogeneous_enclosed CB1_6_1I1R10Value CB1_6_1I1R10MassTerm_sound CB1_6_1I1R10Entropy_sound) (by decide +kernel) +def CB1_6_1I1R11Value (a : Fin 6) : ℝ := residualLaw (below (shape 1 6 1)) (fun u => (stageBLaw (shape 1 6 1) u : ℝ)) (stageBPriority (shape 1 6 1)) 1 (fun u a => (littleLaw (shape 1 6 1) u ((stageBPriority (shape 1 6 1)) 1) a : ℝ)) 11 a +def CB1_6_1I1R11Raw (a : Fin 6) : Ball := residualBall (below (shape 1 6 1)) B1_6_1Law (stageBPriority (shape 1 6 1)) 1 (fun u => B1_6_1Little u ((stageBPriority (shape 1 6 1)) 1)) 11 a +lemma CB1_6_1I1R11Raw_sound (a : Fin 6) : + (CB1_6_1I1R11Raw a).Encloses (CB1_6_1I1R11Value a) := by + exact residualBall_sound_on (below (shape 1 6 1)) B1_6_1Law (fun u => (stageBLaw (shape 1 6 1) u : ℝ)) (stageBPriority (shape 1 6 1)) 1 (fun u => B1_6_1Little u ((stageBPriority (shape 1 6 1)) 1)) (fun u a => (littleLaw (shape 1 6 1) u ((stageBPriority (shape 1 6 1)) 1) a : ℝ)) (fun u _ => B1_6_1Law_sound u) (fun u _ a => B1_6_1Little_sound u ((stageBPriority (shape 1 6 1)) 1) a) 11 a +def CB1_6_1I1R11Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB1_6_1I1R11Certificates_valid : + CB1_6_1I1R11Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_6_1I1R11CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB1_6_1I1R11P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_6_1I1R11Certificates (CB1_6_1I1R11CertificateIndex a)).input +lemma CB1_6_1I1R11P_check : ∀ a : Fin 6, contains (CB1_6_1I1R11Raw a) (CB1_6_1I1R11P a) = true := by + decide +kernel +lemma CB1_6_1I1R11P_sound (a : Fin 6) : + (CB1_6_1I1R11P a).Encloses (CB1_6_1I1R11Value a) := + contains_sound (CB1_6_1I1R11Raw_sound a) (CB1_6_1I1R11P_check a) +def CB1_6_1I1R11Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_6_1I1R11Certificates (CB1_6_1I1R11CertificateIndex a)).output +lemma CB1_6_1I1R11Terms_sound (a : Fin 6) : + (CB1_6_1I1R11Terms a).Encloses (Foundation.entropyTerm (CB1_6_1I1R11Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_6_1I1R11Certificates_valid + (CB1_6_1I1R11CertificateIndex a) (CB1_6_1I1R11P_sound a) +def CB1_6_1I1R11Entropy : Ball := ⟨0, 0⟩ +lemma CB1_6_1I1R11Entropy_sound : CB1_6_1I1R11Entropy.Encloses (Foundation.finiteEntropy CB1_6_1I1R11Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_6_1I1R11Value CB1_6_1I1R11Terms CB1_6_1I1R11Terms_sound) (by decide +kernel) +def CB1_6_1I1R11Mass : Ball := ⟨0, 0⟩ +lemma CB1_6_1I1R11Mass_sound : CB1_6_1I1R11Mass.Encloses (∑ a, CB1_6_1I1R11Value a) := by + exact contains_sound (finSumBall_sound 6 CB1_6_1I1R11P CB1_6_1I1R11Value CB1_6_1I1R11P_sound) (by decide +kernel) +def CB1_6_1I1R11MassTerm : Ball := .exact 0 +lemma CB1_6_1I1R11MassTerm_sound : CB1_6_1I1R11MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_6_1I1R11Value a))) := + entropyTerm_zero_ball (CB1_6_1I1R11Mass_sound) +def CB1_6_1I1R11H : Ball := ⟨0, 0⟩ +lemma CB1_6_1I1R11H_sound : CB1_6_1I1R11H.Encloses (homogeneousEntropy CB1_6_1I1R11Value) := by + exact contains_sound (homogeneous_enclosed CB1_6_1I1R11Value CB1_6_1I1R11MassTerm_sound CB1_6_1I1R11Entropy_sound) (by decide +kernel) +def CB1_6_1I1R12Value (a : Fin 6) : ℝ := residualLaw (below (shape 1 6 1)) (fun u => (stageBLaw (shape 1 6 1) u : ℝ)) (stageBPriority (shape 1 6 1)) 1 (fun u a => (littleLaw (shape 1 6 1) u ((stageBPriority (shape 1 6 1)) 1) a : ℝ)) 12 a +def CB1_6_1I1R12Raw (a : Fin 6) : Ball := residualBall (below (shape 1 6 1)) B1_6_1Law (stageBPriority (shape 1 6 1)) 1 (fun u => B1_6_1Little u ((stageBPriority (shape 1 6 1)) 1)) 12 a +lemma CB1_6_1I1R12Raw_sound (a : Fin 6) : + (CB1_6_1I1R12Raw a).Encloses (CB1_6_1I1R12Value a) := by + exact residualBall_sound_on (below (shape 1 6 1)) B1_6_1Law (fun u => (stageBLaw (shape 1 6 1) u : ℝ)) (stageBPriority (shape 1 6 1)) 1 (fun u => B1_6_1Little u ((stageBPriority (shape 1 6 1)) 1)) (fun u a => (littleLaw (shape 1 6 1) u ((stageBPriority (shape 1 6 1)) 1) a : ℝ)) (fun u _ => B1_6_1Law_sound u) (fun u _ a => B1_6_1Little_sound u ((stageBPriority (shape 1 6 1)) 1) a) 12 a +def CB1_6_1I1R12Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB1_6_1I1R12Certificates_valid : + CB1_6_1I1R12Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_6_1I1R12CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB1_6_1I1R12P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_6_1I1R12Certificates (CB1_6_1I1R12CertificateIndex a)).input +lemma CB1_6_1I1R12P_check : ∀ a : Fin 6, contains (CB1_6_1I1R12Raw a) (CB1_6_1I1R12P a) = true := by + decide +kernel +lemma CB1_6_1I1R12P_sound (a : Fin 6) : + (CB1_6_1I1R12P a).Encloses (CB1_6_1I1R12Value a) := + contains_sound (CB1_6_1I1R12Raw_sound a) (CB1_6_1I1R12P_check a) +def CB1_6_1I1R12Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_6_1I1R12Certificates (CB1_6_1I1R12CertificateIndex a)).output +lemma CB1_6_1I1R12Terms_sound (a : Fin 6) : + (CB1_6_1I1R12Terms a).Encloses (Foundation.entropyTerm (CB1_6_1I1R12Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_6_1I1R12Certificates_valid + (CB1_6_1I1R12CertificateIndex a) (CB1_6_1I1R12P_sound a) +def CB1_6_1I1R12Entropy : Ball := ⟨0, 0⟩ +lemma CB1_6_1I1R12Entropy_sound : CB1_6_1I1R12Entropy.Encloses (Foundation.finiteEntropy CB1_6_1I1R12Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_6_1I1R12Value CB1_6_1I1R12Terms CB1_6_1I1R12Terms_sound) (by decide +kernel) +def CB1_6_1I1R12Mass : Ball := ⟨0, 0⟩ +lemma CB1_6_1I1R12Mass_sound : CB1_6_1I1R12Mass.Encloses (∑ a, CB1_6_1I1R12Value a) := by + exact contains_sound (finSumBall_sound 6 CB1_6_1I1R12P CB1_6_1I1R12Value CB1_6_1I1R12P_sound) (by decide +kernel) +def CB1_6_1I1R12MassTerm : Ball := .exact 0 +lemma CB1_6_1I1R12MassTerm_sound : CB1_6_1I1R12MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_6_1I1R12Value a))) := + entropyTerm_zero_ball (CB1_6_1I1R12Mass_sound) +def CB1_6_1I1R12H : Ball := ⟨0, 0⟩ +lemma CB1_6_1I1R12H_sound : CB1_6_1I1R12H.Encloses (homogeneousEntropy CB1_6_1I1R12Value) := by + exact contains_sound (homogeneous_enclosed CB1_6_1I1R12Value CB1_6_1I1R12MassTerm_sound CB1_6_1I1R12Entropy_sound) (by decide +kernel) +def CB1_6_1I1R13Value (a : Fin 6) : ℝ := residualLaw (below (shape 1 6 1)) (fun u => (stageBLaw (shape 1 6 1) u : ℝ)) (stageBPriority (shape 1 6 1)) 1 (fun u a => (littleLaw (shape 1 6 1) u ((stageBPriority (shape 1 6 1)) 1) a : ℝ)) 13 a +def CB1_6_1I1R13Raw (a : Fin 6) : Ball := residualBall (below (shape 1 6 1)) B1_6_1Law (stageBPriority (shape 1 6 1)) 1 (fun u => B1_6_1Little u ((stageBPriority (shape 1 6 1)) 1)) 13 a +lemma CB1_6_1I1R13Raw_sound (a : Fin 6) : + (CB1_6_1I1R13Raw a).Encloses (CB1_6_1I1R13Value a) := by + exact residualBall_sound_on (below (shape 1 6 1)) B1_6_1Law (fun u => (stageBLaw (shape 1 6 1) u : ℝ)) (stageBPriority (shape 1 6 1)) 1 (fun u => B1_6_1Little u ((stageBPriority (shape 1 6 1)) 1)) (fun u a => (littleLaw (shape 1 6 1) u ((stageBPriority (shape 1 6 1)) 1) a : ℝ)) (fun u _ => B1_6_1Law_sound u) (fun u _ a => B1_6_1Little_sound u ((stageBPriority (shape 1 6 1)) 1) a) 13 a +def CB1_6_1I1R13Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB1_6_1I1R13Certificates_valid : + CB1_6_1I1R13Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_6_1I1R13CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB1_6_1I1R13P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_6_1I1R13Certificates (CB1_6_1I1R13CertificateIndex a)).input +lemma CB1_6_1I1R13P_check : ∀ a : Fin 6, contains (CB1_6_1I1R13Raw a) (CB1_6_1I1R13P a) = true := by + decide +kernel +lemma CB1_6_1I1R13P_sound (a : Fin 6) : + (CB1_6_1I1R13P a).Encloses (CB1_6_1I1R13Value a) := + contains_sound (CB1_6_1I1R13Raw_sound a) (CB1_6_1I1R13P_check a) +def CB1_6_1I1R13Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_6_1I1R13Certificates (CB1_6_1I1R13CertificateIndex a)).output +lemma CB1_6_1I1R13Terms_sound (a : Fin 6) : + (CB1_6_1I1R13Terms a).Encloses (Foundation.entropyTerm (CB1_6_1I1R13Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_6_1I1R13Certificates_valid + (CB1_6_1I1R13CertificateIndex a) (CB1_6_1I1R13P_sound a) +def CB1_6_1I1R13Entropy : Ball := ⟨0, 0⟩ +lemma CB1_6_1I1R13Entropy_sound : CB1_6_1I1R13Entropy.Encloses (Foundation.finiteEntropy CB1_6_1I1R13Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_6_1I1R13Value CB1_6_1I1R13Terms CB1_6_1I1R13Terms_sound) (by decide +kernel) +def CB1_6_1I1R13Mass : Ball := ⟨0, 0⟩ +lemma CB1_6_1I1R13Mass_sound : CB1_6_1I1R13Mass.Encloses (∑ a, CB1_6_1I1R13Value a) := by + exact contains_sound (finSumBall_sound 6 CB1_6_1I1R13P CB1_6_1I1R13Value CB1_6_1I1R13P_sound) (by decide +kernel) +def CB1_6_1I1R13MassTerm : Ball := .exact 0 +lemma CB1_6_1I1R13MassTerm_sound : CB1_6_1I1R13MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_6_1I1R13Value a))) := + entropyTerm_zero_ball (CB1_6_1I1R13Mass_sound) +def CB1_6_1I1R13H : Ball := ⟨0, 0⟩ +lemma CB1_6_1I1R13H_sound : CB1_6_1I1R13H.Encloses (homogeneousEntropy CB1_6_1I1R13Value) := by + exact contains_sound (homogeneous_enclosed CB1_6_1I1R13Value CB1_6_1I1R13MassTerm_sound CB1_6_1I1R13Entropy_sound) (by decide +kernel) +def CB1_6_1I1R14Value (a : Fin 6) : ℝ := residualLaw (below (shape 1 6 1)) (fun u => (stageBLaw (shape 1 6 1) u : ℝ)) (stageBPriority (shape 1 6 1)) 1 (fun u a => (littleLaw (shape 1 6 1) u ((stageBPriority (shape 1 6 1)) 1) a : ℝ)) 14 a +def CB1_6_1I1R14Raw (a : Fin 6) : Ball := residualBall (below (shape 1 6 1)) B1_6_1Law (stageBPriority (shape 1 6 1)) 1 (fun u => B1_6_1Little u ((stageBPriority (shape 1 6 1)) 1)) 14 a +lemma CB1_6_1I1R14Raw_sound (a : Fin 6) : + (CB1_6_1I1R14Raw a).Encloses (CB1_6_1I1R14Value a) := by + exact residualBall_sound_on (below (shape 1 6 1)) B1_6_1Law (fun u => (stageBLaw (shape 1 6 1) u : ℝ)) (stageBPriority (shape 1 6 1)) 1 (fun u => B1_6_1Little u ((stageBPriority (shape 1 6 1)) 1)) (fun u a => (littleLaw (shape 1 6 1) u ((stageBPriority (shape 1 6 1)) 1) a : ℝ)) (fun u _ => B1_6_1Law_sound u) (fun u _ a => B1_6_1Little_sound u ((stageBPriority (shape 1 6 1)) 1) a) 14 a +def CB1_6_1I1R14Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB1_6_1I1R14Certificates_valid : + CB1_6_1I1R14Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_6_1I1R14CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB1_6_1I1R14P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_6_1I1R14Certificates (CB1_6_1I1R14CertificateIndex a)).input +lemma CB1_6_1I1R14P_check : ∀ a : Fin 6, contains (CB1_6_1I1R14Raw a) (CB1_6_1I1R14P a) = true := by + decide +kernel +lemma CB1_6_1I1R14P_sound (a : Fin 6) : + (CB1_6_1I1R14P a).Encloses (CB1_6_1I1R14Value a) := + contains_sound (CB1_6_1I1R14Raw_sound a) (CB1_6_1I1R14P_check a) +def CB1_6_1I1R14Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_6_1I1R14Certificates (CB1_6_1I1R14CertificateIndex a)).output +lemma CB1_6_1I1R14Terms_sound (a : Fin 6) : + (CB1_6_1I1R14Terms a).Encloses (Foundation.entropyTerm (CB1_6_1I1R14Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_6_1I1R14Certificates_valid + (CB1_6_1I1R14CertificateIndex a) (CB1_6_1I1R14P_sound a) +def CB1_6_1I1R14Entropy : Ball := ⟨0, 0⟩ +lemma CB1_6_1I1R14Entropy_sound : CB1_6_1I1R14Entropy.Encloses (Foundation.finiteEntropy CB1_6_1I1R14Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_6_1I1R14Value CB1_6_1I1R14Terms CB1_6_1I1R14Terms_sound) (by decide +kernel) +def CB1_6_1I1R14Mass : Ball := ⟨0, 0⟩ +lemma CB1_6_1I1R14Mass_sound : CB1_6_1I1R14Mass.Encloses (∑ a, CB1_6_1I1R14Value a) := by + exact contains_sound (finSumBall_sound 6 CB1_6_1I1R14P CB1_6_1I1R14Value CB1_6_1I1R14P_sound) (by decide +kernel) +def CB1_6_1I1R14MassTerm : Ball := .exact 0 +lemma CB1_6_1I1R14MassTerm_sound : CB1_6_1I1R14MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_6_1I1R14Value a))) := + entropyTerm_zero_ball (CB1_6_1I1R14Mass_sound) +def CB1_6_1I1R14H : Ball := ⟨0, 0⟩ +lemma CB1_6_1I1R14H_sound : CB1_6_1I1R14H.Encloses (homogeneousEntropy CB1_6_1I1R14Value) := by + exact contains_sound (homogeneous_enclosed CB1_6_1I1R14Value CB1_6_1I1R14MassTerm_sound CB1_6_1I1R14Entropy_sound) (by decide +kernel) +def CB1_6_1I1R15Value (a : Fin 6) : ℝ := residualLaw (below (shape 1 6 1)) (fun u => (stageBLaw (shape 1 6 1) u : ℝ)) (stageBPriority (shape 1 6 1)) 1 (fun u a => (littleLaw (shape 1 6 1) u ((stageBPriority (shape 1 6 1)) 1) a : ℝ)) 15 a +def CB1_6_1I1R15Raw (a : Fin 6) : Ball := residualBall (below (shape 1 6 1)) B1_6_1Law (stageBPriority (shape 1 6 1)) 1 (fun u => B1_6_1Little u ((stageBPriority (shape 1 6 1)) 1)) 15 a +lemma CB1_6_1I1R15Raw_sound (a : Fin 6) : + (CB1_6_1I1R15Raw a).Encloses (CB1_6_1I1R15Value a) := by + exact residualBall_sound_on (below (shape 1 6 1)) B1_6_1Law (fun u => (stageBLaw (shape 1 6 1) u : ℝ)) (stageBPriority (shape 1 6 1)) 1 (fun u => B1_6_1Little u ((stageBPriority (shape 1 6 1)) 1)) (fun u a => (littleLaw (shape 1 6 1) u ((stageBPriority (shape 1 6 1)) 1) a : ℝ)) (fun u _ => B1_6_1Law_sound u) (fun u _ a => B1_6_1Little_sound u ((stageBPriority (shape 1 6 1)) 1) a) 15 a +def CB1_6_1I1R15Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB1_6_1I1R15Certificates_valid : + CB1_6_1I1R15Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_6_1I1R15CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB1_6_1I1R15P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_6_1I1R15Certificates (CB1_6_1I1R15CertificateIndex a)).input +lemma CB1_6_1I1R15P_check : ∀ a : Fin 6, contains (CB1_6_1I1R15Raw a) (CB1_6_1I1R15P a) = true := by + decide +kernel +lemma CB1_6_1I1R15P_sound (a : Fin 6) : + (CB1_6_1I1R15P a).Encloses (CB1_6_1I1R15Value a) := + contains_sound (CB1_6_1I1R15Raw_sound a) (CB1_6_1I1R15P_check a) +def CB1_6_1I1R15Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_6_1I1R15Certificates (CB1_6_1I1R15CertificateIndex a)).output +lemma CB1_6_1I1R15Terms_sound (a : Fin 6) : + (CB1_6_1I1R15Terms a).Encloses (Foundation.entropyTerm (CB1_6_1I1R15Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_6_1I1R15Certificates_valid + (CB1_6_1I1R15CertificateIndex a) (CB1_6_1I1R15P_sound a) +def CB1_6_1I1R15Entropy : Ball := ⟨0, 0⟩ +lemma CB1_6_1I1R15Entropy_sound : CB1_6_1I1R15Entropy.Encloses (Foundation.finiteEntropy CB1_6_1I1R15Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_6_1I1R15Value CB1_6_1I1R15Terms CB1_6_1I1R15Terms_sound) (by decide +kernel) +def CB1_6_1I1R15Mass : Ball := ⟨0, 0⟩ +lemma CB1_6_1I1R15Mass_sound : CB1_6_1I1R15Mass.Encloses (∑ a, CB1_6_1I1R15Value a) := by + exact contains_sound (finSumBall_sound 6 CB1_6_1I1R15P CB1_6_1I1R15Value CB1_6_1I1R15P_sound) (by decide +kernel) +def CB1_6_1I1R15MassTerm : Ball := .exact 0 +lemma CB1_6_1I1R15MassTerm_sound : CB1_6_1I1R15MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_6_1I1R15Value a))) := + entropyTerm_zero_ball (CB1_6_1I1R15Mass_sound) +def CB1_6_1I1R15H : Ball := ⟨0, 0⟩ +lemma CB1_6_1I1R15H_sound : CB1_6_1I1R15H.Encloses (homogeneousEntropy CB1_6_1I1R15Value) := by + exact contains_sound (homogeneous_enclosed CB1_6_1I1R15Value CB1_6_1I1R15MassTerm_sound CB1_6_1I1R15Entropy_sound) (by decide +kernel) +def CB1_6_1I1R16Value (a : Fin 6) : ℝ := residualLaw (below (shape 1 6 1)) (fun u => (stageBLaw (shape 1 6 1) u : ℝ)) (stageBPriority (shape 1 6 1)) 1 (fun u a => (littleLaw (shape 1 6 1) u ((stageBPriority (shape 1 6 1)) 1) a : ℝ)) 16 a +def CB1_6_1I1R16Raw (a : Fin 6) : Ball := residualBall (below (shape 1 6 1)) B1_6_1Law (stageBPriority (shape 1 6 1)) 1 (fun u => B1_6_1Little u ((stageBPriority (shape 1 6 1)) 1)) 16 a +lemma CB1_6_1I1R16Raw_sound (a : Fin 6) : + (CB1_6_1I1R16Raw a).Encloses (CB1_6_1I1R16Value a) := by + exact residualBall_sound_on (below (shape 1 6 1)) B1_6_1Law (fun u => (stageBLaw (shape 1 6 1) u : ℝ)) (stageBPriority (shape 1 6 1)) 1 (fun u => B1_6_1Little u ((stageBPriority (shape 1 6 1)) 1)) (fun u a => (littleLaw (shape 1 6 1) u ((stageBPriority (shape 1 6 1)) 1) a : ℝ)) (fun u _ => B1_6_1Law_sound u) (fun u _ a => B1_6_1Little_sound u ((stageBPriority (shape 1 6 1)) 1) a) 16 a +def CB1_6_1I1R16Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB1_6_1I1R16Certificates_valid : + CB1_6_1I1R16Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_6_1I1R16CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB1_6_1I1R16P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_6_1I1R16Certificates (CB1_6_1I1R16CertificateIndex a)).input +lemma CB1_6_1I1R16P_check : ∀ a : Fin 6, contains (CB1_6_1I1R16Raw a) (CB1_6_1I1R16P a) = true := by + decide +kernel +lemma CB1_6_1I1R16P_sound (a : Fin 6) : + (CB1_6_1I1R16P a).Encloses (CB1_6_1I1R16Value a) := + contains_sound (CB1_6_1I1R16Raw_sound a) (CB1_6_1I1R16P_check a) +def CB1_6_1I1R16Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_6_1I1R16Certificates (CB1_6_1I1R16CertificateIndex a)).output +lemma CB1_6_1I1R16Terms_sound (a : Fin 6) : + (CB1_6_1I1R16Terms a).Encloses (Foundation.entropyTerm (CB1_6_1I1R16Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_6_1I1R16Certificates_valid + (CB1_6_1I1R16CertificateIndex a) (CB1_6_1I1R16P_sound a) +def CB1_6_1I1R16Entropy : Ball := ⟨0, 0⟩ +lemma CB1_6_1I1R16Entropy_sound : CB1_6_1I1R16Entropy.Encloses (Foundation.finiteEntropy CB1_6_1I1R16Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_6_1I1R16Value CB1_6_1I1R16Terms CB1_6_1I1R16Terms_sound) (by decide +kernel) +def CB1_6_1I1R16Mass : Ball := ⟨0, 0⟩ +lemma CB1_6_1I1R16Mass_sound : CB1_6_1I1R16Mass.Encloses (∑ a, CB1_6_1I1R16Value a) := by + exact contains_sound (finSumBall_sound 6 CB1_6_1I1R16P CB1_6_1I1R16Value CB1_6_1I1R16P_sound) (by decide +kernel) +def CB1_6_1I1R16MassTerm : Ball := .exact 0 +lemma CB1_6_1I1R16MassTerm_sound : CB1_6_1I1R16MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_6_1I1R16Value a))) := + entropyTerm_zero_ball (CB1_6_1I1R16Mass_sound) +def CB1_6_1I1R16H : Ball := ⟨0, 0⟩ +lemma CB1_6_1I1R16H_sound : CB1_6_1I1R16H.Encloses (homogeneousEntropy CB1_6_1I1R16Value) := by + exact contains_sound (homogeneous_enclosed CB1_6_1I1R16Value CB1_6_1I1R16MassTerm_sound CB1_6_1I1R16Entropy_sound) (by decide +kernel) +def CB1_6_1I1ResidualEntropies (a : Fin 17) : Ball := + match a.val with + | 0 => CB1_6_1I1R0H + | 1 => CB1_6_1I1R1H + | 2 => CB1_6_1I1R2H + | 3 => CB1_6_1I1R3H + | 4 => CB1_6_1I1R4H + | 5 => CB1_6_1I1R5H + | 6 => CB1_6_1I1R6H + | 7 => CB1_6_1I1R7H + | 8 => CB1_6_1I1R8H + | 9 => CB1_6_1I1R9H + | 10 => CB1_6_1I1R10H + | 11 => CB1_6_1I1R11H + | 12 => CB1_6_1I1R12H + | 13 => CB1_6_1I1R13H + | 14 => CB1_6_1I1R14H + | 15 => CB1_6_1I1R15H + | 16 => CB1_6_1I1R16H + | _ => (.exact 0) +lemma CB1_6_1I1ResidualEntropies_sound (k : Fin 17) : + (CB1_6_1I1ResidualEntropies k).Encloses (homogeneousEntropy + (residualLaw (below (shape 1 6 1)) (fun u => (stageBLaw (shape 1 6 1) u : ℝ)) (stageBPriority (shape 1 6 1)) 1 (fun u a => (littleLaw (shape 1 6 1) u ((stageBPriority (shape 1 6 1)) 1) a : ℝ)) k)) := by + fin_cases k + · exact CB1_6_1I1R0H_sound + · exact CB1_6_1I1R1H_sound + · exact CB1_6_1I1R2H_sound + · exact CB1_6_1I1R3H_sound + · exact CB1_6_1I1R4H_sound + · exact CB1_6_1I1R5H_sound + · exact CB1_6_1I1R6H_sound + · exact CB1_6_1I1R7H_sound + · exact CB1_6_1I1R8H_sound + · exact CB1_6_1I1R9H_sound + · exact CB1_6_1I1R10H_sound + · exact CB1_6_1I1R11H_sound + · exact CB1_6_1I1R12H_sound + · exact CB1_6_1I1R13H_sound + · exact CB1_6_1I1R14H_sound + · exact CB1_6_1I1R15H_sound + · exact CB1_6_1I1R16H_sound +def CB1_6_1I1Singles (s : Shape) : Ball := + match s 0, s 1, s 2 with + | _, _, _ => (.exact 0) +lemma CB1_6_1I1Singles_sound (u : Shape) (hu : u ∈ below (shape 1 6 1)) + (hd : designated (stageBPriority (shape 1 6 1)) 1 u) : + (CB1_6_1I1Singles u).Encloses (homogeneousEntropy ((fun u a => (littleLaw (shape 1 6 1) u ((stageBPriority (shape 1 6 1)) 1) a : ℝ)) u)) := by + rw [B1_6_1_below] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl + · exact (show ¬ designated (stageBPriority (shape 1 6 1)) 1 (shape 0 3 1) by decide +kernel) hd |>.elim + · exact (show ¬ designated (stageBPriority (shape 1 6 1)) 1 (shape 0 4 0) by decide +kernel) hd |>.elim + · exact (show ¬ designated (stageBPriority (shape 1 6 1)) 1 (shape 1 2 1) by decide +kernel) hd |>.elim + · exact (show ¬ designated (stageBPriority (shape 1 6 1)) 1 (shape 1 3 0) by decide +kernel) hd |>.elim +def CB1_6_1I1Singleton : Ball := ⟨0, 0⟩ +lemma CB1_6_1I1Singleton_sound : CB1_6_1I1Singleton.Encloses + (singletonEntropy (below (shape 1 6 1)) (fun u => (stageBLaw (shape 1 6 1) u : ℝ)) (stageBPriority (shape 1 6 1)) 1 (fun u a => (littleLaw (shape 1 6 1) u ((stageBPriority (shape 1 6 1)) 1) a : ℝ))) := by + exact contains_sound (singletonBall_sound (below (shape 1 6 1)) B1_6_1Law (fun u => (stageBLaw (shape 1 6 1) u : ℝ)) (stageBPriority (shape 1 6 1)) 1 + CB1_6_1I1Singles (fun u a => (littleLaw (shape 1 6 1) u ((stageBPriority (shape 1 6 1)) 1) a : ℝ)) (fun u _ => B1_6_1Law_sound u) CB1_6_1I1Singles_sound) (by decide +kernel) +def CB1_6_1I1Group : Ball := ⟨0, (21175823741 / 25000000000000000000000000000000)⟩ +lemma CB1_6_1I1Group_sound : CB1_6_1I1Group.Encloses + (groupedEntropy (below (shape 1 6 1)) (fun u => (stageBLaw (shape 1 6 1) u : ℝ)) (stageBPriority (shape 1 6 1)) 1 (fun u a => (littleLaw (shape 1 6 1) u ((stageBPriority (shape 1 6 1)) 1) a : ℝ))) := by + exact contains_sound (Ball.add_sound CB1_6_1I1Singleton_sound + (finSumBall_sound 17 CB1_6_1I1ResidualEntropies _ CB1_6_1I1ResidualEntropies_sound)) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CB1_6_1I1H : Ball := ⟨(6931471805599453094172319305033 / 10000000000000000000000000000000), (232934061161 / 100000000000000000000000000000000)⟩ +lemma CB1_6_1I1_sound : CB1_6_1I1H.Encloses (stageBCapacity (shape 1 6 1) 1) := by + have hb := contains_sound (Ball.add_sound CB1_6_1I1PairH_sound + (Ball.neg_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) CB1_6_1I1Group_sound))) + (show contains (.add CB1_6_1I1PairH (.neg (.mul (.exact 2) CB1_6_1I1Group))) CB1_6_1I1H = true by decide +kernel) + simp only [stageBCapacity, nativeCapacity, + show (1 : Fin 3) ≠ 0 by decide, ite_false, sub_eq_add_neg] + exact hb + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/CapacityB/CapB1_6_1I2.lean b/lean/OAI/LinearAlgebra/MatrixFields/CapacityB/CapB1_6_1I2.lean new file mode 100644 index 0000000000000000000000000000000000000000..30ceb54b0c9488e4b074c3391172df23b75c8df8 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/CapacityB/CapB1_6_1I2.lean @@ -0,0 +1,931 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Certificates.Terminal1_6_1 + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CB1_6_1I2PairValue (a : PairSlot) : ℝ := pairLaw (below (shape 1 6 1)) (shape 1 6 1) (fun u => (stageBLaw (shape 1 6 1) u : ℝ)) (fun u a => (littleLaw (shape 1 6 1) u ((stageBPriority (shape 1 6 1)) 2) a : ℝ)) a +def CB1_6_1I2PairRaw (a : PairSlot) : Ball := pairLawBall (below (shape 1 6 1)) (shape 1 6 1) B1_6_1Law (fun u => B1_6_1Little u ((stageBPriority (shape 1 6 1)) 2)) a +lemma CB1_6_1I2PairRaw_sound (a : PairSlot) : + (CB1_6_1I2PairRaw a).Encloses (CB1_6_1I2PairValue a) := by + exact pairLawBall_sound_on (below (shape 1 6 1)) (shape 1 6 1) B1_6_1Law (fun u => (stageBLaw (shape 1 6 1) u : ℝ)) (fun u => B1_6_1Little u ((stageBPriority (shape 1 6 1)) 2)) (fun u a => (littleLaw (shape 1 6 1) u ((stageBPriority (shape 1 6 1)) 2) a : ℝ)) (fun u _ => B1_6_1Law_sound u) (fun u _ a => B1_6_1Little_sound u ((stageBPriority (shape 1 6 1)) 2) a) (fun u _ a => B1_6_1Little_sound (complement (shape 1 6 1) u) ((stageBPriority (shape 1 6 1)) 2) a) a +def CB1_6_1I2PairCertificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(476830025998288559780831570863 / 625000000000000000000000000000), (13 / 50000000000000000000000000000000)⟩ ⟨(2064418904528795917417975615293 / 10000000000000000000000000000000), (4038907427 / 12500000000000000000000000000000)⟩ ⟨(-27059156197834078116708366657861 / 100000000000000000000000000000000), (42351647399 / 100000000000000000000000000000000)⟩ ⟨-1, 476830025998288559780831570863, 312500000000000000000000000000⟩, + .log ⟨(11355853489872446010634026210329 / 100000000000000000000000000000000), (21 / 100000000000000000000000000000000)⟩ ⟨(771998191686243945321358008653 / 3125000000000000000000000000000), (12023477631 / 100000000000000000000000000000000)⟩ ⟨(-108771842451083313064960621571817 / 50000000000000000000000000000000), (105879118599 / 100000000000000000000000000000000)⟩ ⟨-4, 11355853489872446010634026210329, 6250000000000000000000000000000⟩, + .log ⟨(497744430264469206899448120631 / 100000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ ⟨(2639458433445908445670795748467 / 100000000000000000000000000000000), (11857667 / 1250000000000000000000000000000)⟩ ⟨(-33142741949461278969199876113513 / 6250000000000000000000000000000), (47645603387 / 25000000000000000000000000000000)⟩ ⟨-8, 497744430264469206899448120631, 390625000000000000000000000000⟩] +lemma CB1_6_1I2PairCertificates_valid : + CB1_6_1I2PairCertificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_6_1I2PairCertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 4, 4 => 1 + | 5, 2 => 2 + | 5, 3 => 3 + | 2, 5 => 2 + | 3, 5 => 3 + | _, _ => 0 +def CB1_6_1I2PairP (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CB1_6_1I2PairCertificates (CB1_6_1I2PairCertificateIndex a)).input +lemma CB1_6_1I2PairP_check : ∀ a : PairSlot, contains (CB1_6_1I2PairRaw a) (CB1_6_1I2PairP a) = true := by + decide +kernel +lemma CB1_6_1I2PairP_sound (a : PairSlot) : + (CB1_6_1I2PairP a).Encloses (CB1_6_1I2PairValue a) := + contains_sound (CB1_6_1I2PairRaw_sound a) (CB1_6_1I2PairP_check a) +def CB1_6_1I2PairTerms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CB1_6_1I2PairCertificates (CB1_6_1I2PairCertificateIndex a)).output +lemma CB1_6_1I2PairTerms_sound (a : PairSlot) : + (CB1_6_1I2PairTerms a).Encloses (Foundation.entropyTerm (CB1_6_1I2PairValue a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_6_1I2PairCertificates_valid + (CB1_6_1I2PairCertificateIndex a) (CB1_6_1I2PairP_sound a) +def CB1_6_1I2PairEntropy : Ball := ⟨(9416373772512423570761032525457 / 12500000000000000000000000000000), (29127720699 / 50000000000000000000000000000000)⟩ +lemma CB1_6_1I2PairEntropy_sound : CB1_6_1I2PairEntropy.Encloses (Foundation.finiteEntropy CB1_6_1I2PairValue) := by + exact contains_sound (entropyPair_enclosed CB1_6_1I2PairValue CB1_6_1I2PairTerms CB1_6_1I2PairTerms_sound) (by decide +kernel) +def CB1_6_1I2PairMass : Ball := ⟨1, (9 / 12500000000000000000000000000000)⟩ +lemma CB1_6_1I2PairMass_sound : CB1_6_1I2PairMass.Encloses (∑ a, CB1_6_1I2PairValue a) := by + exact contains_sound (pairSumBall_sound CB1_6_1I2PairP CB1_6_1I2PairValue CB1_6_1I2PairP_sound) (by decide +kernel) +def CB1_6_1I2PairMassTermLogWitness : LogWitness := ⟨0, 1, 1⟩ +def CB1_6_1I2PairMassTermLog : Ball := ⟨0, (10587911877 / 50000000000000000000000000000000)⟩ +lemma CB1_6_1I2PairMassTermLog_sound : CB1_6_1I2PairMassTermLog.Encloses (Real.log ((∑ a, CB1_6_1I2PairValue a))) := by + exact checkLog_sound logTwoBall_sound (CB1_6_1I2PairMass_sound) (w := CB1_6_1I2PairMassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB1_6_1I2PairMassTerm : Ball := ⟨0, (4235164751 / 20000000000000000000000000000000)⟩ +lemma CB1_6_1I2PairMassTerm_sound : CB1_6_1I2PairMassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_6_1I2PairValue a))) := by + exact contains_sound (entropyTerm_ball (CB1_6_1I2PairMass_sound) CB1_6_1I2PairMassTermLog_sound) (by decide +kernel) +def CB1_6_1I2PairH : Ball := ⟨(9416373772512423570761032525457 / 12500000000000000000000000000000), (79431265153 / 100000000000000000000000000000000)⟩ +lemma CB1_6_1I2PairH_sound : CB1_6_1I2PairH.Encloses (homogeneousEntropy CB1_6_1I2PairValue) := by + exact contains_sound (homogeneous_enclosed CB1_6_1I2PairValue CB1_6_1I2PairMassTerm_sound CB1_6_1I2PairEntropy_sound) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CB1_6_1I2R0Value (a : Fin 6) : ℝ := residualLaw (below (shape 1 6 1)) (fun u => (stageBLaw (shape 1 6 1) u : ℝ)) (stageBPriority (shape 1 6 1)) 2 (fun u a => (littleLaw (shape 1 6 1) u ((stageBPriority (shape 1 6 1)) 2) a : ℝ)) 0 a +def CB1_6_1I2R0Raw (a : Fin 6) : Ball := residualBall (below (shape 1 6 1)) B1_6_1Law (stageBPriority (shape 1 6 1)) 2 (fun u => B1_6_1Little u ((stageBPriority (shape 1 6 1)) 2)) 0 a +lemma CB1_6_1I2R0Raw_sound (a : Fin 6) : + (CB1_6_1I2R0Raw a).Encloses (CB1_6_1I2R0Value a) := by + exact residualBall_sound_on (below (shape 1 6 1)) B1_6_1Law (fun u => (stageBLaw (shape 1 6 1) u : ℝ)) (stageBPriority (shape 1 6 1)) 2 (fun u => B1_6_1Little u ((stageBPriority (shape 1 6 1)) 2)) (fun u a => (littleLaw (shape 1 6 1) u ((stageBPriority (shape 1 6 1)) 2) a : ℝ)) (fun u _ => B1_6_1Law_sound u) (fun u _ a => B1_6_1Little_sound u ((stageBPriority (shape 1 6 1)) 2) a) 0 a +def CB1_6_1I2R0Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB1_6_1I2R0Certificates_valid : + CB1_6_1I2R0Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_6_1I2R0CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB1_6_1I2R0P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_6_1I2R0Certificates (CB1_6_1I2R0CertificateIndex a)).input +lemma CB1_6_1I2R0P_check : ∀ a : Fin 6, contains (CB1_6_1I2R0Raw a) (CB1_6_1I2R0P a) = true := by + decide +kernel +lemma CB1_6_1I2R0P_sound (a : Fin 6) : + (CB1_6_1I2R0P a).Encloses (CB1_6_1I2R0Value a) := + contains_sound (CB1_6_1I2R0Raw_sound a) (CB1_6_1I2R0P_check a) +def CB1_6_1I2R0Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_6_1I2R0Certificates (CB1_6_1I2R0CertificateIndex a)).output +lemma CB1_6_1I2R0Terms_sound (a : Fin 6) : + (CB1_6_1I2R0Terms a).Encloses (Foundation.entropyTerm (CB1_6_1I2R0Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_6_1I2R0Certificates_valid + (CB1_6_1I2R0CertificateIndex a) (CB1_6_1I2R0P_sound a) +def CB1_6_1I2R0Entropy : Ball := ⟨0, 0⟩ +lemma CB1_6_1I2R0Entropy_sound : CB1_6_1I2R0Entropy.Encloses (Foundation.finiteEntropy CB1_6_1I2R0Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_6_1I2R0Value CB1_6_1I2R0Terms CB1_6_1I2R0Terms_sound) (by decide +kernel) +def CB1_6_1I2R0Mass : Ball := ⟨0, 0⟩ +lemma CB1_6_1I2R0Mass_sound : CB1_6_1I2R0Mass.Encloses (∑ a, CB1_6_1I2R0Value a) := by + exact contains_sound (finSumBall_sound 6 CB1_6_1I2R0P CB1_6_1I2R0Value CB1_6_1I2R0P_sound) (by decide +kernel) +def CB1_6_1I2R0MassTerm : Ball := .exact 0 +lemma CB1_6_1I2R0MassTerm_sound : CB1_6_1I2R0MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_6_1I2R0Value a))) := + entropyTerm_zero_ball (CB1_6_1I2R0Mass_sound) +def CB1_6_1I2R0H : Ball := ⟨0, 0⟩ +lemma CB1_6_1I2R0H_sound : CB1_6_1I2R0H.Encloses (homogeneousEntropy CB1_6_1I2R0Value) := by + exact contains_sound (homogeneous_enclosed CB1_6_1I2R0Value CB1_6_1I2R0MassTerm_sound CB1_6_1I2R0Entropy_sound) (by decide +kernel) +def CB1_6_1I2R1Value (a : Fin 6) : ℝ := residualLaw (below (shape 1 6 1)) (fun u => (stageBLaw (shape 1 6 1) u : ℝ)) (stageBPriority (shape 1 6 1)) 2 (fun u a => (littleLaw (shape 1 6 1) u ((stageBPriority (shape 1 6 1)) 2) a : ℝ)) 1 a +def CB1_6_1I2R1Raw (a : Fin 6) : Ball := residualBall (below (shape 1 6 1)) B1_6_1Law (stageBPriority (shape 1 6 1)) 2 (fun u => B1_6_1Little u ((stageBPriority (shape 1 6 1)) 2)) 1 a +lemma CB1_6_1I2R1Raw_sound (a : Fin 6) : + (CB1_6_1I2R1Raw a).Encloses (CB1_6_1I2R1Value a) := by + exact residualBall_sound_on (below (shape 1 6 1)) B1_6_1Law (fun u => (stageBLaw (shape 1 6 1) u : ℝ)) (stageBPriority (shape 1 6 1)) 2 (fun u => B1_6_1Little u ((stageBPriority (shape 1 6 1)) 2)) (fun u a => (littleLaw (shape 1 6 1) u ((stageBPriority (shape 1 6 1)) 2) a : ℝ)) (fun u _ => B1_6_1Law_sound u) (fun u _ a => B1_6_1Little_sound u ((stageBPriority (shape 1 6 1)) 2) a) 1 a +def CB1_6_1I2R1Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB1_6_1I2R1Certificates_valid : + CB1_6_1I2R1Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_6_1I2R1CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB1_6_1I2R1P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_6_1I2R1Certificates (CB1_6_1I2R1CertificateIndex a)).input +lemma CB1_6_1I2R1P_check : ∀ a : Fin 6, contains (CB1_6_1I2R1Raw a) (CB1_6_1I2R1P a) = true := by + decide +kernel +lemma CB1_6_1I2R1P_sound (a : Fin 6) : + (CB1_6_1I2R1P a).Encloses (CB1_6_1I2R1Value a) := + contains_sound (CB1_6_1I2R1Raw_sound a) (CB1_6_1I2R1P_check a) +def CB1_6_1I2R1Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_6_1I2R1Certificates (CB1_6_1I2R1CertificateIndex a)).output +lemma CB1_6_1I2R1Terms_sound (a : Fin 6) : + (CB1_6_1I2R1Terms a).Encloses (Foundation.entropyTerm (CB1_6_1I2R1Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_6_1I2R1Certificates_valid + (CB1_6_1I2R1CertificateIndex a) (CB1_6_1I2R1P_sound a) +def CB1_6_1I2R1Entropy : Ball := ⟨0, 0⟩ +lemma CB1_6_1I2R1Entropy_sound : CB1_6_1I2R1Entropy.Encloses (Foundation.finiteEntropy CB1_6_1I2R1Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_6_1I2R1Value CB1_6_1I2R1Terms CB1_6_1I2R1Terms_sound) (by decide +kernel) +def CB1_6_1I2R1Mass : Ball := ⟨0, 0⟩ +lemma CB1_6_1I2R1Mass_sound : CB1_6_1I2R1Mass.Encloses (∑ a, CB1_6_1I2R1Value a) := by + exact contains_sound (finSumBall_sound 6 CB1_6_1I2R1P CB1_6_1I2R1Value CB1_6_1I2R1P_sound) (by decide +kernel) +def CB1_6_1I2R1MassTerm : Ball := .exact 0 +lemma CB1_6_1I2R1MassTerm_sound : CB1_6_1I2R1MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_6_1I2R1Value a))) := + entropyTerm_zero_ball (CB1_6_1I2R1Mass_sound) +def CB1_6_1I2R1H : Ball := ⟨0, 0⟩ +lemma CB1_6_1I2R1H_sound : CB1_6_1I2R1H.Encloses (homogeneousEntropy CB1_6_1I2R1Value) := by + exact contains_sound (homogeneous_enclosed CB1_6_1I2R1Value CB1_6_1I2R1MassTerm_sound CB1_6_1I2R1Entropy_sound) (by decide +kernel) +def CB1_6_1I2R2Value (a : Fin 6) : ℝ := residualLaw (below (shape 1 6 1)) (fun u => (stageBLaw (shape 1 6 1) u : ℝ)) (stageBPriority (shape 1 6 1)) 2 (fun u a => (littleLaw (shape 1 6 1) u ((stageBPriority (shape 1 6 1)) 2) a : ℝ)) 2 a +def CB1_6_1I2R2Raw (a : Fin 6) : Ball := residualBall (below (shape 1 6 1)) B1_6_1Law (stageBPriority (shape 1 6 1)) 2 (fun u => B1_6_1Little u ((stageBPriority (shape 1 6 1)) 2)) 2 a +lemma CB1_6_1I2R2Raw_sound (a : Fin 6) : + (CB1_6_1I2R2Raw a).Encloses (CB1_6_1I2R2Value a) := by + exact residualBall_sound_on (below (shape 1 6 1)) B1_6_1Law (fun u => (stageBLaw (shape 1 6 1) u : ℝ)) (stageBPriority (shape 1 6 1)) 2 (fun u => B1_6_1Little u ((stageBPriority (shape 1 6 1)) 2)) (fun u a => (littleLaw (shape 1 6 1) u ((stageBPriority (shape 1 6 1)) 2) a : ℝ)) (fun u _ => B1_6_1Law_sound u) (fun u _ a => B1_6_1Little_sound u ((stageBPriority (shape 1 6 1)) 2) a) 2 a +def CB1_6_1I2R2Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(11355853489872446010634026210329 / 100000000000000000000000000000000), (21 / 100000000000000000000000000000000)⟩ ⟨(771998191686243945321358008653 / 3125000000000000000000000000000), (12023477631 / 100000000000000000000000000000000)⟩ ⟨(-108771842451083313064960621571817 / 50000000000000000000000000000000), (105879118599 / 100000000000000000000000000000000)⟩ ⟨-4, 11355853489872446010634026210329, 6250000000000000000000000000000⟩, + .log ⟨(497744430264469206899448120631 / 100000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ ⟨(2639458433445908445670795748467 / 100000000000000000000000000000000), (11857667 / 1250000000000000000000000000000)⟩ ⟨(-33142741949461278969199876113513 / 6250000000000000000000000000000), (47645603387 / 25000000000000000000000000000000)⟩ ⟨-8, 497744430264469206899448120631, 390625000000000000000000000000⟩] +lemma CB1_6_1I2R2Certificates_valid : + CB1_6_1I2R2Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_6_1I2R2CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | 2 => 1 + | 3 => 2 + | _ => 0 +def CB1_6_1I2R2P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_6_1I2R2Certificates (CB1_6_1I2R2CertificateIndex a)).input +lemma CB1_6_1I2R2P_check : ∀ a : Fin 6, contains (CB1_6_1I2R2Raw a) (CB1_6_1I2R2P a) = true := by + decide +kernel +lemma CB1_6_1I2R2P_sound (a : Fin 6) : + (CB1_6_1I2R2P a).Encloses (CB1_6_1I2R2Value a) := + contains_sound (CB1_6_1I2R2Raw_sound a) (CB1_6_1I2R2P_check a) +def CB1_6_1I2R2Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_6_1I2R2Certificates (CB1_6_1I2R2CertificateIndex a)).output +lemma CB1_6_1I2R2Terms_sound (a : Fin 6) : + (CB1_6_1I2R2Terms a).Encloses (Foundation.entropyTerm (CB1_6_1I2R2Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_6_1I2R2Certificates_valid + (CB1_6_1I2R2CertificateIndex a) (CB1_6_1I2R2P_sound a) +def CB1_6_1I2R2Entropy : Ball := ⟨(27343400567405714695954252025363 / 100000000000000000000000000000000), (12972090991 / 100000000000000000000000000000000)⟩ +lemma CB1_6_1I2R2Entropy_sound : CB1_6_1I2R2Entropy.Encloses (Foundation.finiteEntropy CB1_6_1I2R2Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_6_1I2R2Value CB1_6_1I2R2Terms CB1_6_1I2R2Terms_sound) (by decide +kernel) +def CB1_6_1I2R2Mass : Ball := ⟨(148169974001711440219168429137 / 1250000000000000000000000000000), (23 / 100000000000000000000000000000000)⟩ +lemma CB1_6_1I2R2Mass_sound : CB1_6_1I2R2Mass.Encloses (∑ a, CB1_6_1I2R2Value a) := by + exact contains_sound (finSumBall_sound 6 CB1_6_1I2R2P CB1_6_1I2R2Value CB1_6_1I2R2P_sound) (by decide +kernel) +def CB1_6_1I2R2MassTermLogWitness : LogWitness := ⟨-4, 148169974001711440219168429137, 78125000000000000000000000000⟩ +def CB1_6_1I2R2MassTermLog : Ball := ⟨(-21325387425382860905843152201521 / 10000000000000000000000000000000), (105879118609 / 100000000000000000000000000000000)⟩ +lemma CB1_6_1I2R2MassTermLog_sound : CB1_6_1I2R2MassTermLog.Encloses (Real.log ((∑ a, CB1_6_1I2R2Value a))) := by + exact checkLog_sound logTwoBall_sound (CB1_6_1I2R2Mass_sound) (w := CB1_6_1I2R2MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB1_6_1I2R2MassTerm : Ball := ⟨(12639128401581610264774180864021 / 50000000000000000000000000000000), (12550485051 / 100000000000000000000000000000000)⟩ +lemma CB1_6_1I2R2MassTerm_sound : CB1_6_1I2R2MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_6_1I2R2Value a))) := by + exact contains_sound (entropyTerm_ball (CB1_6_1I2R2Mass_sound) CB1_6_1I2R2MassTermLog_sound) (by decide +kernel) +def CB1_6_1I2R2H : Ball := ⟨(2065143764242494166405890297321 / 100000000000000000000000000000000), (12761288021 / 50000000000000000000000000000000)⟩ +lemma CB1_6_1I2R2H_sound : CB1_6_1I2R2H.Encloses (homogeneousEntropy CB1_6_1I2R2Value) := by + exact contains_sound (homogeneous_enclosed CB1_6_1I2R2Value CB1_6_1I2R2MassTerm_sound CB1_6_1I2R2Entropy_sound) (by decide +kernel) +def CB1_6_1I2R3Value (a : Fin 6) : ℝ := residualLaw (below (shape 1 6 1)) (fun u => (stageBLaw (shape 1 6 1) u : ℝ)) (stageBPriority (shape 1 6 1)) 2 (fun u a => (littleLaw (shape 1 6 1) u ((stageBPriority (shape 1 6 1)) 2) a : ℝ)) 3 a +def CB1_6_1I2R3Raw (a : Fin 6) : Ball := residualBall (below (shape 1 6 1)) B1_6_1Law (stageBPriority (shape 1 6 1)) 2 (fun u => B1_6_1Little u ((stageBPriority (shape 1 6 1)) 2)) 3 a +lemma CB1_6_1I2R3Raw_sound (a : Fin 6) : + (CB1_6_1I2R3Raw a).Encloses (CB1_6_1I2R3Value a) := by + exact residualBall_sound_on (below (shape 1 6 1)) B1_6_1Law (fun u => (stageBLaw (shape 1 6 1) u : ℝ)) (stageBPriority (shape 1 6 1)) 2 (fun u => B1_6_1Little u ((stageBPriority (shape 1 6 1)) 2)) (fun u a => (littleLaw (shape 1 6 1) u ((stageBPriority (shape 1 6 1)) 2) a : ℝ)) (fun u _ => B1_6_1Law_sound u) (fun u _ a => B1_6_1Little_sound u ((stageBPriority (shape 1 6 1)) 2) a) 3 a +def CB1_6_1I2R3Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB1_6_1I2R3Certificates_valid : + CB1_6_1I2R3Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_6_1I2R3CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB1_6_1I2R3P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_6_1I2R3Certificates (CB1_6_1I2R3CertificateIndex a)).input +lemma CB1_6_1I2R3P_check : ∀ a : Fin 6, contains (CB1_6_1I2R3Raw a) (CB1_6_1I2R3P a) = true := by + decide +kernel +lemma CB1_6_1I2R3P_sound (a : Fin 6) : + (CB1_6_1I2R3P a).Encloses (CB1_6_1I2R3Value a) := + contains_sound (CB1_6_1I2R3Raw_sound a) (CB1_6_1I2R3P_check a) +def CB1_6_1I2R3Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_6_1I2R3Certificates (CB1_6_1I2R3CertificateIndex a)).output +lemma CB1_6_1I2R3Terms_sound (a : Fin 6) : + (CB1_6_1I2R3Terms a).Encloses (Foundation.entropyTerm (CB1_6_1I2R3Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_6_1I2R3Certificates_valid + (CB1_6_1I2R3CertificateIndex a) (CB1_6_1I2R3P_sound a) +def CB1_6_1I2R3Entropy : Ball := ⟨0, 0⟩ +lemma CB1_6_1I2R3Entropy_sound : CB1_6_1I2R3Entropy.Encloses (Foundation.finiteEntropy CB1_6_1I2R3Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_6_1I2R3Value CB1_6_1I2R3Terms CB1_6_1I2R3Terms_sound) (by decide +kernel) +def CB1_6_1I2R3Mass : Ball := ⟨0, 0⟩ +lemma CB1_6_1I2R3Mass_sound : CB1_6_1I2R3Mass.Encloses (∑ a, CB1_6_1I2R3Value a) := by + exact contains_sound (finSumBall_sound 6 CB1_6_1I2R3P CB1_6_1I2R3Value CB1_6_1I2R3P_sound) (by decide +kernel) +def CB1_6_1I2R3MassTerm : Ball := .exact 0 +lemma CB1_6_1I2R3MassTerm_sound : CB1_6_1I2R3MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_6_1I2R3Value a))) := + entropyTerm_zero_ball (CB1_6_1I2R3Mass_sound) +def CB1_6_1I2R3H : Ball := ⟨0, 0⟩ +lemma CB1_6_1I2R3H_sound : CB1_6_1I2R3H.Encloses (homogeneousEntropy CB1_6_1I2R3Value) := by + exact contains_sound (homogeneous_enclosed CB1_6_1I2R3Value CB1_6_1I2R3MassTerm_sound CB1_6_1I2R3Entropy_sound) (by decide +kernel) +def CB1_6_1I2R4Value (a : Fin 6) : ℝ := residualLaw (below (shape 1 6 1)) (fun u => (stageBLaw (shape 1 6 1) u : ℝ)) (stageBPriority (shape 1 6 1)) 2 (fun u a => (littleLaw (shape 1 6 1) u ((stageBPriority (shape 1 6 1)) 2) a : ℝ)) 4 a +def CB1_6_1I2R4Raw (a : Fin 6) : Ball := residualBall (below (shape 1 6 1)) B1_6_1Law (stageBPriority (shape 1 6 1)) 2 (fun u => B1_6_1Little u ((stageBPriority (shape 1 6 1)) 2)) 4 a +lemma CB1_6_1I2R4Raw_sound (a : Fin 6) : + (CB1_6_1I2R4Raw a).Encloses (CB1_6_1I2R4Value a) := by + exact residualBall_sound_on (below (shape 1 6 1)) B1_6_1Law (fun u => (stageBLaw (shape 1 6 1) u : ℝ)) (stageBPriority (shape 1 6 1)) 2 (fun u => B1_6_1Little u ((stageBPriority (shape 1 6 1)) 2)) (fun u a => (littleLaw (shape 1 6 1) u ((stageBPriority (shape 1 6 1)) 2) a : ℝ)) (fun u _ => B1_6_1Law_sound u) (fun u _ a => B1_6_1Little_sound u ((stageBPriority (shape 1 6 1)) 2) a) 4 a +def CB1_6_1I2R4Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB1_6_1I2R4Certificates_valid : + CB1_6_1I2R4Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_6_1I2R4CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB1_6_1I2R4P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_6_1I2R4Certificates (CB1_6_1I2R4CertificateIndex a)).input +lemma CB1_6_1I2R4P_check : ∀ a : Fin 6, contains (CB1_6_1I2R4Raw a) (CB1_6_1I2R4P a) = true := by + decide +kernel +lemma CB1_6_1I2R4P_sound (a : Fin 6) : + (CB1_6_1I2R4P a).Encloses (CB1_6_1I2R4Value a) := + contains_sound (CB1_6_1I2R4Raw_sound a) (CB1_6_1I2R4P_check a) +def CB1_6_1I2R4Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_6_1I2R4Certificates (CB1_6_1I2R4CertificateIndex a)).output +lemma CB1_6_1I2R4Terms_sound (a : Fin 6) : + (CB1_6_1I2R4Terms a).Encloses (Foundation.entropyTerm (CB1_6_1I2R4Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_6_1I2R4Certificates_valid + (CB1_6_1I2R4CertificateIndex a) (CB1_6_1I2R4P_sound a) +def CB1_6_1I2R4Entropy : Ball := ⟨0, 0⟩ +lemma CB1_6_1I2R4Entropy_sound : CB1_6_1I2R4Entropy.Encloses (Foundation.finiteEntropy CB1_6_1I2R4Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_6_1I2R4Value CB1_6_1I2R4Terms CB1_6_1I2R4Terms_sound) (by decide +kernel) +def CB1_6_1I2R4Mass : Ball := ⟨0, 0⟩ +lemma CB1_6_1I2R4Mass_sound : CB1_6_1I2R4Mass.Encloses (∑ a, CB1_6_1I2R4Value a) := by + exact contains_sound (finSumBall_sound 6 CB1_6_1I2R4P CB1_6_1I2R4Value CB1_6_1I2R4P_sound) (by decide +kernel) +def CB1_6_1I2R4MassTerm : Ball := .exact 0 +lemma CB1_6_1I2R4MassTerm_sound : CB1_6_1I2R4MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_6_1I2R4Value a))) := + entropyTerm_zero_ball (CB1_6_1I2R4Mass_sound) +def CB1_6_1I2R4H : Ball := ⟨0, 0⟩ +lemma CB1_6_1I2R4H_sound : CB1_6_1I2R4H.Encloses (homogeneousEntropy CB1_6_1I2R4Value) := by + exact contains_sound (homogeneous_enclosed CB1_6_1I2R4Value CB1_6_1I2R4MassTerm_sound CB1_6_1I2R4Entropy_sound) (by decide +kernel) +def CB1_6_1I2R5Value (a : Fin 6) : ℝ := residualLaw (below (shape 1 6 1)) (fun u => (stageBLaw (shape 1 6 1) u : ℝ)) (stageBPriority (shape 1 6 1)) 2 (fun u a => (littleLaw (shape 1 6 1) u ((stageBPriority (shape 1 6 1)) 2) a : ℝ)) 5 a +def CB1_6_1I2R5Raw (a : Fin 6) : Ball := residualBall (below (shape 1 6 1)) B1_6_1Law (stageBPriority (shape 1 6 1)) 2 (fun u => B1_6_1Little u ((stageBPriority (shape 1 6 1)) 2)) 5 a +lemma CB1_6_1I2R5Raw_sound (a : Fin 6) : + (CB1_6_1I2R5Raw a).Encloses (CB1_6_1I2R5Value a) := by + exact residualBall_sound_on (below (shape 1 6 1)) B1_6_1Law (fun u => (stageBLaw (shape 1 6 1) u : ℝ)) (stageBPriority (shape 1 6 1)) 2 (fun u => B1_6_1Little u ((stageBPriority (shape 1 6 1)) 2)) (fun u a => (littleLaw (shape 1 6 1) u ((stageBPriority (shape 1 6 1)) 2) a : ℝ)) (fun u _ => B1_6_1Law_sound u) (fun u _ a => B1_6_1Little_sound u ((stageBPriority (shape 1 6 1)) 2) a) 5 a +def CB1_6_1I2R5Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB1_6_1I2R5Certificates_valid : + CB1_6_1I2R5Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_6_1I2R5CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB1_6_1I2R5P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_6_1I2R5Certificates (CB1_6_1I2R5CertificateIndex a)).input +lemma CB1_6_1I2R5P_check : ∀ a : Fin 6, contains (CB1_6_1I2R5Raw a) (CB1_6_1I2R5P a) = true := by + decide +kernel +lemma CB1_6_1I2R5P_sound (a : Fin 6) : + (CB1_6_1I2R5P a).Encloses (CB1_6_1I2R5Value a) := + contains_sound (CB1_6_1I2R5Raw_sound a) (CB1_6_1I2R5P_check a) +def CB1_6_1I2R5Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_6_1I2R5Certificates (CB1_6_1I2R5CertificateIndex a)).output +lemma CB1_6_1I2R5Terms_sound (a : Fin 6) : + (CB1_6_1I2R5Terms a).Encloses (Foundation.entropyTerm (CB1_6_1I2R5Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_6_1I2R5Certificates_valid + (CB1_6_1I2R5CertificateIndex a) (CB1_6_1I2R5P_sound a) +def CB1_6_1I2R5Entropy : Ball := ⟨0, 0⟩ +lemma CB1_6_1I2R5Entropy_sound : CB1_6_1I2R5Entropy.Encloses (Foundation.finiteEntropy CB1_6_1I2R5Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_6_1I2R5Value CB1_6_1I2R5Terms CB1_6_1I2R5Terms_sound) (by decide +kernel) +def CB1_6_1I2R5Mass : Ball := ⟨0, 0⟩ +lemma CB1_6_1I2R5Mass_sound : CB1_6_1I2R5Mass.Encloses (∑ a, CB1_6_1I2R5Value a) := by + exact contains_sound (finSumBall_sound 6 CB1_6_1I2R5P CB1_6_1I2R5Value CB1_6_1I2R5P_sound) (by decide +kernel) +def CB1_6_1I2R5MassTerm : Ball := .exact 0 +lemma CB1_6_1I2R5MassTerm_sound : CB1_6_1I2R5MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_6_1I2R5Value a))) := + entropyTerm_zero_ball (CB1_6_1I2R5Mass_sound) +def CB1_6_1I2R5H : Ball := ⟨0, 0⟩ +lemma CB1_6_1I2R5H_sound : CB1_6_1I2R5H.Encloses (homogeneousEntropy CB1_6_1I2R5Value) := by + exact contains_sound (homogeneous_enclosed CB1_6_1I2R5Value CB1_6_1I2R5MassTerm_sound CB1_6_1I2R5Entropy_sound) (by decide +kernel) +def CB1_6_1I2R6Value (a : Fin 6) : ℝ := residualLaw (below (shape 1 6 1)) (fun u => (stageBLaw (shape 1 6 1) u : ℝ)) (stageBPriority (shape 1 6 1)) 2 (fun u a => (littleLaw (shape 1 6 1) u ((stageBPriority (shape 1 6 1)) 2) a : ℝ)) 6 a +def CB1_6_1I2R6Raw (a : Fin 6) : Ball := residualBall (below (shape 1 6 1)) B1_6_1Law (stageBPriority (shape 1 6 1)) 2 (fun u => B1_6_1Little u ((stageBPriority (shape 1 6 1)) 2)) 6 a +lemma CB1_6_1I2R6Raw_sound (a : Fin 6) : + (CB1_6_1I2R6Raw a).Encloses (CB1_6_1I2R6Value a) := by + exact residualBall_sound_on (below (shape 1 6 1)) B1_6_1Law (fun u => (stageBLaw (shape 1 6 1) u : ℝ)) (stageBPriority (shape 1 6 1)) 2 (fun u => B1_6_1Little u ((stageBPriority (shape 1 6 1)) 2)) (fun u a => (littleLaw (shape 1 6 1) u ((stageBPriority (shape 1 6 1)) 2) a : ℝ)) (fun u _ => B1_6_1Law_sound u) (fun u _ a => B1_6_1Little_sound u ((stageBPriority (shape 1 6 1)) 2) a) 6 a +def CB1_6_1I2R6Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB1_6_1I2R6Certificates_valid : + CB1_6_1I2R6Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_6_1I2R6CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB1_6_1I2R6P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_6_1I2R6Certificates (CB1_6_1I2R6CertificateIndex a)).input +lemma CB1_6_1I2R6P_check : ∀ a : Fin 6, contains (CB1_6_1I2R6Raw a) (CB1_6_1I2R6P a) = true := by + decide +kernel +lemma CB1_6_1I2R6P_sound (a : Fin 6) : + (CB1_6_1I2R6P a).Encloses (CB1_6_1I2R6Value a) := + contains_sound (CB1_6_1I2R6Raw_sound a) (CB1_6_1I2R6P_check a) +def CB1_6_1I2R6Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_6_1I2R6Certificates (CB1_6_1I2R6CertificateIndex a)).output +lemma CB1_6_1I2R6Terms_sound (a : Fin 6) : + (CB1_6_1I2R6Terms a).Encloses (Foundation.entropyTerm (CB1_6_1I2R6Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_6_1I2R6Certificates_valid + (CB1_6_1I2R6CertificateIndex a) (CB1_6_1I2R6P_sound a) +def CB1_6_1I2R6Entropy : Ball := ⟨0, 0⟩ +lemma CB1_6_1I2R6Entropy_sound : CB1_6_1I2R6Entropy.Encloses (Foundation.finiteEntropy CB1_6_1I2R6Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_6_1I2R6Value CB1_6_1I2R6Terms CB1_6_1I2R6Terms_sound) (by decide +kernel) +def CB1_6_1I2R6Mass : Ball := ⟨0, 0⟩ +lemma CB1_6_1I2R6Mass_sound : CB1_6_1I2R6Mass.Encloses (∑ a, CB1_6_1I2R6Value a) := by + exact contains_sound (finSumBall_sound 6 CB1_6_1I2R6P CB1_6_1I2R6Value CB1_6_1I2R6P_sound) (by decide +kernel) +def CB1_6_1I2R6MassTerm : Ball := .exact 0 +lemma CB1_6_1I2R6MassTerm_sound : CB1_6_1I2R6MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_6_1I2R6Value a))) := + entropyTerm_zero_ball (CB1_6_1I2R6Mass_sound) +def CB1_6_1I2R6H : Ball := ⟨0, 0⟩ +lemma CB1_6_1I2R6H_sound : CB1_6_1I2R6H.Encloses (homogeneousEntropy CB1_6_1I2R6Value) := by + exact contains_sound (homogeneous_enclosed CB1_6_1I2R6Value CB1_6_1I2R6MassTerm_sound CB1_6_1I2R6Entropy_sound) (by decide +kernel) +def CB1_6_1I2R7Value (a : Fin 6) : ℝ := residualLaw (below (shape 1 6 1)) (fun u => (stageBLaw (shape 1 6 1) u : ℝ)) (stageBPriority (shape 1 6 1)) 2 (fun u a => (littleLaw (shape 1 6 1) u ((stageBPriority (shape 1 6 1)) 2) a : ℝ)) 7 a +def CB1_6_1I2R7Raw (a : Fin 6) : Ball := residualBall (below (shape 1 6 1)) B1_6_1Law (stageBPriority (shape 1 6 1)) 2 (fun u => B1_6_1Little u ((stageBPriority (shape 1 6 1)) 2)) 7 a +lemma CB1_6_1I2R7Raw_sound (a : Fin 6) : + (CB1_6_1I2R7Raw a).Encloses (CB1_6_1I2R7Value a) := by + exact residualBall_sound_on (below (shape 1 6 1)) B1_6_1Law (fun u => (stageBLaw (shape 1 6 1) u : ℝ)) (stageBPriority (shape 1 6 1)) 2 (fun u => B1_6_1Little u ((stageBPriority (shape 1 6 1)) 2)) (fun u a => (littleLaw (shape 1 6 1) u ((stageBPriority (shape 1 6 1)) 2) a : ℝ)) (fun u _ => B1_6_1Law_sound u) (fun u _ a => B1_6_1Little_sound u ((stageBPriority (shape 1 6 1)) 2) a) 7 a +def CB1_6_1I2R7Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB1_6_1I2R7Certificates_valid : + CB1_6_1I2R7Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_6_1I2R7CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB1_6_1I2R7P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_6_1I2R7Certificates (CB1_6_1I2R7CertificateIndex a)).input +lemma CB1_6_1I2R7P_check : ∀ a : Fin 6, contains (CB1_6_1I2R7Raw a) (CB1_6_1I2R7P a) = true := by + decide +kernel +lemma CB1_6_1I2R7P_sound (a : Fin 6) : + (CB1_6_1I2R7P a).Encloses (CB1_6_1I2R7Value a) := + contains_sound (CB1_6_1I2R7Raw_sound a) (CB1_6_1I2R7P_check a) +def CB1_6_1I2R7Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_6_1I2R7Certificates (CB1_6_1I2R7CertificateIndex a)).output +lemma CB1_6_1I2R7Terms_sound (a : Fin 6) : + (CB1_6_1I2R7Terms a).Encloses (Foundation.entropyTerm (CB1_6_1I2R7Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_6_1I2R7Certificates_valid + (CB1_6_1I2R7CertificateIndex a) (CB1_6_1I2R7P_sound a) +def CB1_6_1I2R7Entropy : Ball := ⟨0, 0⟩ +lemma CB1_6_1I2R7Entropy_sound : CB1_6_1I2R7Entropy.Encloses (Foundation.finiteEntropy CB1_6_1I2R7Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_6_1I2R7Value CB1_6_1I2R7Terms CB1_6_1I2R7Terms_sound) (by decide +kernel) +def CB1_6_1I2R7Mass : Ball := ⟨0, 0⟩ +lemma CB1_6_1I2R7Mass_sound : CB1_6_1I2R7Mass.Encloses (∑ a, CB1_6_1I2R7Value a) := by + exact contains_sound (finSumBall_sound 6 CB1_6_1I2R7P CB1_6_1I2R7Value CB1_6_1I2R7P_sound) (by decide +kernel) +def CB1_6_1I2R7MassTerm : Ball := .exact 0 +lemma CB1_6_1I2R7MassTerm_sound : CB1_6_1I2R7MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_6_1I2R7Value a))) := + entropyTerm_zero_ball (CB1_6_1I2R7Mass_sound) +def CB1_6_1I2R7H : Ball := ⟨0, 0⟩ +lemma CB1_6_1I2R7H_sound : CB1_6_1I2R7H.Encloses (homogeneousEntropy CB1_6_1I2R7Value) := by + exact contains_sound (homogeneous_enclosed CB1_6_1I2R7Value CB1_6_1I2R7MassTerm_sound CB1_6_1I2R7Entropy_sound) (by decide +kernel) +def CB1_6_1I2R8Value (a : Fin 6) : ℝ := residualLaw (below (shape 1 6 1)) (fun u => (stageBLaw (shape 1 6 1) u : ℝ)) (stageBPriority (shape 1 6 1)) 2 (fun u a => (littleLaw (shape 1 6 1) u ((stageBPriority (shape 1 6 1)) 2) a : ℝ)) 8 a +def CB1_6_1I2R8Raw (a : Fin 6) : Ball := residualBall (below (shape 1 6 1)) B1_6_1Law (stageBPriority (shape 1 6 1)) 2 (fun u => B1_6_1Little u ((stageBPriority (shape 1 6 1)) 2)) 8 a +lemma CB1_6_1I2R8Raw_sound (a : Fin 6) : + (CB1_6_1I2R8Raw a).Encloses (CB1_6_1I2R8Value a) := by + exact residualBall_sound_on (below (shape 1 6 1)) B1_6_1Law (fun u => (stageBLaw (shape 1 6 1) u : ℝ)) (stageBPriority (shape 1 6 1)) 2 (fun u => B1_6_1Little u ((stageBPriority (shape 1 6 1)) 2)) (fun u a => (littleLaw (shape 1 6 1) u ((stageBPriority (shape 1 6 1)) 2) a : ℝ)) (fun u _ => B1_6_1Law_sound u) (fun u _ a => B1_6_1Little_sound u ((stageBPriority (shape 1 6 1)) 2) a) 8 a +def CB1_6_1I2R8Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB1_6_1I2R8Certificates_valid : + CB1_6_1I2R8Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_6_1I2R8CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB1_6_1I2R8P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_6_1I2R8Certificates (CB1_6_1I2R8CertificateIndex a)).input +lemma CB1_6_1I2R8P_check : ∀ a : Fin 6, contains (CB1_6_1I2R8Raw a) (CB1_6_1I2R8P a) = true := by + decide +kernel +lemma CB1_6_1I2R8P_sound (a : Fin 6) : + (CB1_6_1I2R8P a).Encloses (CB1_6_1I2R8Value a) := + contains_sound (CB1_6_1I2R8Raw_sound a) (CB1_6_1I2R8P_check a) +def CB1_6_1I2R8Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_6_1I2R8Certificates (CB1_6_1I2R8CertificateIndex a)).output +lemma CB1_6_1I2R8Terms_sound (a : Fin 6) : + (CB1_6_1I2R8Terms a).Encloses (Foundation.entropyTerm (CB1_6_1I2R8Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_6_1I2R8Certificates_valid + (CB1_6_1I2R8CertificateIndex a) (CB1_6_1I2R8P_sound a) +def CB1_6_1I2R8Entropy : Ball := ⟨0, 0⟩ +lemma CB1_6_1I2R8Entropy_sound : CB1_6_1I2R8Entropy.Encloses (Foundation.finiteEntropy CB1_6_1I2R8Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_6_1I2R8Value CB1_6_1I2R8Terms CB1_6_1I2R8Terms_sound) (by decide +kernel) +def CB1_6_1I2R8Mass : Ball := ⟨0, 0⟩ +lemma CB1_6_1I2R8Mass_sound : CB1_6_1I2R8Mass.Encloses (∑ a, CB1_6_1I2R8Value a) := by + exact contains_sound (finSumBall_sound 6 CB1_6_1I2R8P CB1_6_1I2R8Value CB1_6_1I2R8P_sound) (by decide +kernel) +def CB1_6_1I2R8MassTerm : Ball := .exact 0 +lemma CB1_6_1I2R8MassTerm_sound : CB1_6_1I2R8MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_6_1I2R8Value a))) := + entropyTerm_zero_ball (CB1_6_1I2R8Mass_sound) +def CB1_6_1I2R8H : Ball := ⟨0, 0⟩ +lemma CB1_6_1I2R8H_sound : CB1_6_1I2R8H.Encloses (homogeneousEntropy CB1_6_1I2R8Value) := by + exact contains_sound (homogeneous_enclosed CB1_6_1I2R8Value CB1_6_1I2R8MassTerm_sound CB1_6_1I2R8Entropy_sound) (by decide +kernel) +def CB1_6_1I2R9Value (a : Fin 6) : ℝ := residualLaw (below (shape 1 6 1)) (fun u => (stageBLaw (shape 1 6 1) u : ℝ)) (stageBPriority (shape 1 6 1)) 2 (fun u a => (littleLaw (shape 1 6 1) u ((stageBPriority (shape 1 6 1)) 2) a : ℝ)) 9 a +def CB1_6_1I2R9Raw (a : Fin 6) : Ball := residualBall (below (shape 1 6 1)) B1_6_1Law (stageBPriority (shape 1 6 1)) 2 (fun u => B1_6_1Little u ((stageBPriority (shape 1 6 1)) 2)) 9 a +lemma CB1_6_1I2R9Raw_sound (a : Fin 6) : + (CB1_6_1I2R9Raw a).Encloses (CB1_6_1I2R9Value a) := by + exact residualBall_sound_on (below (shape 1 6 1)) B1_6_1Law (fun u => (stageBLaw (shape 1 6 1) u : ℝ)) (stageBPriority (shape 1 6 1)) 2 (fun u => B1_6_1Little u ((stageBPriority (shape 1 6 1)) 2)) (fun u a => (littleLaw (shape 1 6 1) u ((stageBPriority (shape 1 6 1)) 2) a : ℝ)) (fun u _ => B1_6_1Law_sound u) (fun u _ a => B1_6_1Little_sound u ((stageBPriority (shape 1 6 1)) 2) a) 9 a +def CB1_6_1I2R9Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB1_6_1I2R9Certificates_valid : + CB1_6_1I2R9Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_6_1I2R9CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB1_6_1I2R9P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_6_1I2R9Certificates (CB1_6_1I2R9CertificateIndex a)).input +lemma CB1_6_1I2R9P_check : ∀ a : Fin 6, contains (CB1_6_1I2R9Raw a) (CB1_6_1I2R9P a) = true := by + decide +kernel +lemma CB1_6_1I2R9P_sound (a : Fin 6) : + (CB1_6_1I2R9P a).Encloses (CB1_6_1I2R9Value a) := + contains_sound (CB1_6_1I2R9Raw_sound a) (CB1_6_1I2R9P_check a) +def CB1_6_1I2R9Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_6_1I2R9Certificates (CB1_6_1I2R9CertificateIndex a)).output +lemma CB1_6_1I2R9Terms_sound (a : Fin 6) : + (CB1_6_1I2R9Terms a).Encloses (Foundation.entropyTerm (CB1_6_1I2R9Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_6_1I2R9Certificates_valid + (CB1_6_1I2R9CertificateIndex a) (CB1_6_1I2R9P_sound a) +def CB1_6_1I2R9Entropy : Ball := ⟨0, 0⟩ +lemma CB1_6_1I2R9Entropy_sound : CB1_6_1I2R9Entropy.Encloses (Foundation.finiteEntropy CB1_6_1I2R9Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_6_1I2R9Value CB1_6_1I2R9Terms CB1_6_1I2R9Terms_sound) (by decide +kernel) +def CB1_6_1I2R9Mass : Ball := ⟨0, 0⟩ +lemma CB1_6_1I2R9Mass_sound : CB1_6_1I2R9Mass.Encloses (∑ a, CB1_6_1I2R9Value a) := by + exact contains_sound (finSumBall_sound 6 CB1_6_1I2R9P CB1_6_1I2R9Value CB1_6_1I2R9P_sound) (by decide +kernel) +def CB1_6_1I2R9MassTerm : Ball := .exact 0 +lemma CB1_6_1I2R9MassTerm_sound : CB1_6_1I2R9MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_6_1I2R9Value a))) := + entropyTerm_zero_ball (CB1_6_1I2R9Mass_sound) +def CB1_6_1I2R9H : Ball := ⟨0, 0⟩ +lemma CB1_6_1I2R9H_sound : CB1_6_1I2R9H.Encloses (homogeneousEntropy CB1_6_1I2R9Value) := by + exact contains_sound (homogeneous_enclosed CB1_6_1I2R9Value CB1_6_1I2R9MassTerm_sound CB1_6_1I2R9Entropy_sound) (by decide +kernel) +def CB1_6_1I2R10Value (a : Fin 6) : ℝ := residualLaw (below (shape 1 6 1)) (fun u => (stageBLaw (shape 1 6 1) u : ℝ)) (stageBPriority (shape 1 6 1)) 2 (fun u a => (littleLaw (shape 1 6 1) u ((stageBPriority (shape 1 6 1)) 2) a : ℝ)) 10 a +def CB1_6_1I2R10Raw (a : Fin 6) : Ball := residualBall (below (shape 1 6 1)) B1_6_1Law (stageBPriority (shape 1 6 1)) 2 (fun u => B1_6_1Little u ((stageBPriority (shape 1 6 1)) 2)) 10 a +lemma CB1_6_1I2R10Raw_sound (a : Fin 6) : + (CB1_6_1I2R10Raw a).Encloses (CB1_6_1I2R10Value a) := by + exact residualBall_sound_on (below (shape 1 6 1)) B1_6_1Law (fun u => (stageBLaw (shape 1 6 1) u : ℝ)) (stageBPriority (shape 1 6 1)) 2 (fun u => B1_6_1Little u ((stageBPriority (shape 1 6 1)) 2)) (fun u a => (littleLaw (shape 1 6 1) u ((stageBPriority (shape 1 6 1)) 2) a : ℝ)) (fun u _ => B1_6_1Law_sound u) (fun u _ a => B1_6_1Little_sound u ((stageBPriority (shape 1 6 1)) 2) a) 10 a +def CB1_6_1I2R10Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB1_6_1I2R10Certificates_valid : + CB1_6_1I2R10Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_6_1I2R10CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB1_6_1I2R10P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_6_1I2R10Certificates (CB1_6_1I2R10CertificateIndex a)).input +lemma CB1_6_1I2R10P_check : ∀ a : Fin 6, contains (CB1_6_1I2R10Raw a) (CB1_6_1I2R10P a) = true := by + decide +kernel +lemma CB1_6_1I2R10P_sound (a : Fin 6) : + (CB1_6_1I2R10P a).Encloses (CB1_6_1I2R10Value a) := + contains_sound (CB1_6_1I2R10Raw_sound a) (CB1_6_1I2R10P_check a) +def CB1_6_1I2R10Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_6_1I2R10Certificates (CB1_6_1I2R10CertificateIndex a)).output +lemma CB1_6_1I2R10Terms_sound (a : Fin 6) : + (CB1_6_1I2R10Terms a).Encloses (Foundation.entropyTerm (CB1_6_1I2R10Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_6_1I2R10Certificates_valid + (CB1_6_1I2R10CertificateIndex a) (CB1_6_1I2R10P_sound a) +def CB1_6_1I2R10Entropy : Ball := ⟨0, 0⟩ +lemma CB1_6_1I2R10Entropy_sound : CB1_6_1I2R10Entropy.Encloses (Foundation.finiteEntropy CB1_6_1I2R10Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_6_1I2R10Value CB1_6_1I2R10Terms CB1_6_1I2R10Terms_sound) (by decide +kernel) +def CB1_6_1I2R10Mass : Ball := ⟨0, 0⟩ +lemma CB1_6_1I2R10Mass_sound : CB1_6_1I2R10Mass.Encloses (∑ a, CB1_6_1I2R10Value a) := by + exact contains_sound (finSumBall_sound 6 CB1_6_1I2R10P CB1_6_1I2R10Value CB1_6_1I2R10P_sound) (by decide +kernel) +def CB1_6_1I2R10MassTerm : Ball := .exact 0 +lemma CB1_6_1I2R10MassTerm_sound : CB1_6_1I2R10MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_6_1I2R10Value a))) := + entropyTerm_zero_ball (CB1_6_1I2R10Mass_sound) +def CB1_6_1I2R10H : Ball := ⟨0, 0⟩ +lemma CB1_6_1I2R10H_sound : CB1_6_1I2R10H.Encloses (homogeneousEntropy CB1_6_1I2R10Value) := by + exact contains_sound (homogeneous_enclosed CB1_6_1I2R10Value CB1_6_1I2R10MassTerm_sound CB1_6_1I2R10Entropy_sound) (by decide +kernel) +def CB1_6_1I2R11Value (a : Fin 6) : ℝ := residualLaw (below (shape 1 6 1)) (fun u => (stageBLaw (shape 1 6 1) u : ℝ)) (stageBPriority (shape 1 6 1)) 2 (fun u a => (littleLaw (shape 1 6 1) u ((stageBPriority (shape 1 6 1)) 2) a : ℝ)) 11 a +def CB1_6_1I2R11Raw (a : Fin 6) : Ball := residualBall (below (shape 1 6 1)) B1_6_1Law (stageBPriority (shape 1 6 1)) 2 (fun u => B1_6_1Little u ((stageBPriority (shape 1 6 1)) 2)) 11 a +lemma CB1_6_1I2R11Raw_sound (a : Fin 6) : + (CB1_6_1I2R11Raw a).Encloses (CB1_6_1I2R11Value a) := by + exact residualBall_sound_on (below (shape 1 6 1)) B1_6_1Law (fun u => (stageBLaw (shape 1 6 1) u : ℝ)) (stageBPriority (shape 1 6 1)) 2 (fun u => B1_6_1Little u ((stageBPriority (shape 1 6 1)) 2)) (fun u a => (littleLaw (shape 1 6 1) u ((stageBPriority (shape 1 6 1)) 2) a : ℝ)) (fun u _ => B1_6_1Law_sound u) (fun u _ a => B1_6_1Little_sound u ((stageBPriority (shape 1 6 1)) 2) a) 11 a +def CB1_6_1I2R11Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB1_6_1I2R11Certificates_valid : + CB1_6_1I2R11Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_6_1I2R11CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB1_6_1I2R11P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_6_1I2R11Certificates (CB1_6_1I2R11CertificateIndex a)).input +lemma CB1_6_1I2R11P_check : ∀ a : Fin 6, contains (CB1_6_1I2R11Raw a) (CB1_6_1I2R11P a) = true := by + decide +kernel +lemma CB1_6_1I2R11P_sound (a : Fin 6) : + (CB1_6_1I2R11P a).Encloses (CB1_6_1I2R11Value a) := + contains_sound (CB1_6_1I2R11Raw_sound a) (CB1_6_1I2R11P_check a) +def CB1_6_1I2R11Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_6_1I2R11Certificates (CB1_6_1I2R11CertificateIndex a)).output +lemma CB1_6_1I2R11Terms_sound (a : Fin 6) : + (CB1_6_1I2R11Terms a).Encloses (Foundation.entropyTerm (CB1_6_1I2R11Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_6_1I2R11Certificates_valid + (CB1_6_1I2R11CertificateIndex a) (CB1_6_1I2R11P_sound a) +def CB1_6_1I2R11Entropy : Ball := ⟨0, 0⟩ +lemma CB1_6_1I2R11Entropy_sound : CB1_6_1I2R11Entropy.Encloses (Foundation.finiteEntropy CB1_6_1I2R11Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_6_1I2R11Value CB1_6_1I2R11Terms CB1_6_1I2R11Terms_sound) (by decide +kernel) +def CB1_6_1I2R11Mass : Ball := ⟨0, 0⟩ +lemma CB1_6_1I2R11Mass_sound : CB1_6_1I2R11Mass.Encloses (∑ a, CB1_6_1I2R11Value a) := by + exact contains_sound (finSumBall_sound 6 CB1_6_1I2R11P CB1_6_1I2R11Value CB1_6_1I2R11P_sound) (by decide +kernel) +def CB1_6_1I2R11MassTerm : Ball := .exact 0 +lemma CB1_6_1I2R11MassTerm_sound : CB1_6_1I2R11MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_6_1I2R11Value a))) := + entropyTerm_zero_ball (CB1_6_1I2R11Mass_sound) +def CB1_6_1I2R11H : Ball := ⟨0, 0⟩ +lemma CB1_6_1I2R11H_sound : CB1_6_1I2R11H.Encloses (homogeneousEntropy CB1_6_1I2R11Value) := by + exact contains_sound (homogeneous_enclosed CB1_6_1I2R11Value CB1_6_1I2R11MassTerm_sound CB1_6_1I2R11Entropy_sound) (by decide +kernel) +def CB1_6_1I2R12Value (a : Fin 6) : ℝ := residualLaw (below (shape 1 6 1)) (fun u => (stageBLaw (shape 1 6 1) u : ℝ)) (stageBPriority (shape 1 6 1)) 2 (fun u a => (littleLaw (shape 1 6 1) u ((stageBPriority (shape 1 6 1)) 2) a : ℝ)) 12 a +def CB1_6_1I2R12Raw (a : Fin 6) : Ball := residualBall (below (shape 1 6 1)) B1_6_1Law (stageBPriority (shape 1 6 1)) 2 (fun u => B1_6_1Little u ((stageBPriority (shape 1 6 1)) 2)) 12 a +lemma CB1_6_1I2R12Raw_sound (a : Fin 6) : + (CB1_6_1I2R12Raw a).Encloses (CB1_6_1I2R12Value a) := by + exact residualBall_sound_on (below (shape 1 6 1)) B1_6_1Law (fun u => (stageBLaw (shape 1 6 1) u : ℝ)) (stageBPriority (shape 1 6 1)) 2 (fun u => B1_6_1Little u ((stageBPriority (shape 1 6 1)) 2)) (fun u a => (littleLaw (shape 1 6 1) u ((stageBPriority (shape 1 6 1)) 2) a : ℝ)) (fun u _ => B1_6_1Law_sound u) (fun u _ a => B1_6_1Little_sound u ((stageBPriority (shape 1 6 1)) 2) a) 12 a +def CB1_6_1I2R12Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB1_6_1I2R12Certificates_valid : + CB1_6_1I2R12Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_6_1I2R12CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB1_6_1I2R12P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_6_1I2R12Certificates (CB1_6_1I2R12CertificateIndex a)).input +lemma CB1_6_1I2R12P_check : ∀ a : Fin 6, contains (CB1_6_1I2R12Raw a) (CB1_6_1I2R12P a) = true := by + decide +kernel +lemma CB1_6_1I2R12P_sound (a : Fin 6) : + (CB1_6_1I2R12P a).Encloses (CB1_6_1I2R12Value a) := + contains_sound (CB1_6_1I2R12Raw_sound a) (CB1_6_1I2R12P_check a) +def CB1_6_1I2R12Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_6_1I2R12Certificates (CB1_6_1I2R12CertificateIndex a)).output +lemma CB1_6_1I2R12Terms_sound (a : Fin 6) : + (CB1_6_1I2R12Terms a).Encloses (Foundation.entropyTerm (CB1_6_1I2R12Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_6_1I2R12Certificates_valid + (CB1_6_1I2R12CertificateIndex a) (CB1_6_1I2R12P_sound a) +def CB1_6_1I2R12Entropy : Ball := ⟨0, 0⟩ +lemma CB1_6_1I2R12Entropy_sound : CB1_6_1I2R12Entropy.Encloses (Foundation.finiteEntropy CB1_6_1I2R12Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_6_1I2R12Value CB1_6_1I2R12Terms CB1_6_1I2R12Terms_sound) (by decide +kernel) +def CB1_6_1I2R12Mass : Ball := ⟨0, 0⟩ +lemma CB1_6_1I2R12Mass_sound : CB1_6_1I2R12Mass.Encloses (∑ a, CB1_6_1I2R12Value a) := by + exact contains_sound (finSumBall_sound 6 CB1_6_1I2R12P CB1_6_1I2R12Value CB1_6_1I2R12P_sound) (by decide +kernel) +def CB1_6_1I2R12MassTerm : Ball := .exact 0 +lemma CB1_6_1I2R12MassTerm_sound : CB1_6_1I2R12MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_6_1I2R12Value a))) := + entropyTerm_zero_ball (CB1_6_1I2R12Mass_sound) +def CB1_6_1I2R12H : Ball := ⟨0, 0⟩ +lemma CB1_6_1I2R12H_sound : CB1_6_1I2R12H.Encloses (homogeneousEntropy CB1_6_1I2R12Value) := by + exact contains_sound (homogeneous_enclosed CB1_6_1I2R12Value CB1_6_1I2R12MassTerm_sound CB1_6_1I2R12Entropy_sound) (by decide +kernel) +def CB1_6_1I2R13Value (a : Fin 6) : ℝ := residualLaw (below (shape 1 6 1)) (fun u => (stageBLaw (shape 1 6 1) u : ℝ)) (stageBPriority (shape 1 6 1)) 2 (fun u a => (littleLaw (shape 1 6 1) u ((stageBPriority (shape 1 6 1)) 2) a : ℝ)) 13 a +def CB1_6_1I2R13Raw (a : Fin 6) : Ball := residualBall (below (shape 1 6 1)) B1_6_1Law (stageBPriority (shape 1 6 1)) 2 (fun u => B1_6_1Little u ((stageBPriority (shape 1 6 1)) 2)) 13 a +lemma CB1_6_1I2R13Raw_sound (a : Fin 6) : + (CB1_6_1I2R13Raw a).Encloses (CB1_6_1I2R13Value a) := by + exact residualBall_sound_on (below (shape 1 6 1)) B1_6_1Law (fun u => (stageBLaw (shape 1 6 1) u : ℝ)) (stageBPriority (shape 1 6 1)) 2 (fun u => B1_6_1Little u ((stageBPriority (shape 1 6 1)) 2)) (fun u a => (littleLaw (shape 1 6 1) u ((stageBPriority (shape 1 6 1)) 2) a : ℝ)) (fun u _ => B1_6_1Law_sound u) (fun u _ a => B1_6_1Little_sound u ((stageBPriority (shape 1 6 1)) 2) a) 13 a +def CB1_6_1I2R13Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB1_6_1I2R13Certificates_valid : + CB1_6_1I2R13Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_6_1I2R13CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB1_6_1I2R13P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_6_1I2R13Certificates (CB1_6_1I2R13CertificateIndex a)).input +lemma CB1_6_1I2R13P_check : ∀ a : Fin 6, contains (CB1_6_1I2R13Raw a) (CB1_6_1I2R13P a) = true := by + decide +kernel +lemma CB1_6_1I2R13P_sound (a : Fin 6) : + (CB1_6_1I2R13P a).Encloses (CB1_6_1I2R13Value a) := + contains_sound (CB1_6_1I2R13Raw_sound a) (CB1_6_1I2R13P_check a) +def CB1_6_1I2R13Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_6_1I2R13Certificates (CB1_6_1I2R13CertificateIndex a)).output +lemma CB1_6_1I2R13Terms_sound (a : Fin 6) : + (CB1_6_1I2R13Terms a).Encloses (Foundation.entropyTerm (CB1_6_1I2R13Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_6_1I2R13Certificates_valid + (CB1_6_1I2R13CertificateIndex a) (CB1_6_1I2R13P_sound a) +def CB1_6_1I2R13Entropy : Ball := ⟨0, 0⟩ +lemma CB1_6_1I2R13Entropy_sound : CB1_6_1I2R13Entropy.Encloses (Foundation.finiteEntropy CB1_6_1I2R13Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_6_1I2R13Value CB1_6_1I2R13Terms CB1_6_1I2R13Terms_sound) (by decide +kernel) +def CB1_6_1I2R13Mass : Ball := ⟨0, 0⟩ +lemma CB1_6_1I2R13Mass_sound : CB1_6_1I2R13Mass.Encloses (∑ a, CB1_6_1I2R13Value a) := by + exact contains_sound (finSumBall_sound 6 CB1_6_1I2R13P CB1_6_1I2R13Value CB1_6_1I2R13P_sound) (by decide +kernel) +def CB1_6_1I2R13MassTerm : Ball := .exact 0 +lemma CB1_6_1I2R13MassTerm_sound : CB1_6_1I2R13MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_6_1I2R13Value a))) := + entropyTerm_zero_ball (CB1_6_1I2R13Mass_sound) +def CB1_6_1I2R13H : Ball := ⟨0, 0⟩ +lemma CB1_6_1I2R13H_sound : CB1_6_1I2R13H.Encloses (homogeneousEntropy CB1_6_1I2R13Value) := by + exact contains_sound (homogeneous_enclosed CB1_6_1I2R13Value CB1_6_1I2R13MassTerm_sound CB1_6_1I2R13Entropy_sound) (by decide +kernel) +def CB1_6_1I2R14Value (a : Fin 6) : ℝ := residualLaw (below (shape 1 6 1)) (fun u => (stageBLaw (shape 1 6 1) u : ℝ)) (stageBPriority (shape 1 6 1)) 2 (fun u a => (littleLaw (shape 1 6 1) u ((stageBPriority (shape 1 6 1)) 2) a : ℝ)) 14 a +def CB1_6_1I2R14Raw (a : Fin 6) : Ball := residualBall (below (shape 1 6 1)) B1_6_1Law (stageBPriority (shape 1 6 1)) 2 (fun u => B1_6_1Little u ((stageBPriority (shape 1 6 1)) 2)) 14 a +lemma CB1_6_1I2R14Raw_sound (a : Fin 6) : + (CB1_6_1I2R14Raw a).Encloses (CB1_6_1I2R14Value a) := by + exact residualBall_sound_on (below (shape 1 6 1)) B1_6_1Law (fun u => (stageBLaw (shape 1 6 1) u : ℝ)) (stageBPriority (shape 1 6 1)) 2 (fun u => B1_6_1Little u ((stageBPriority (shape 1 6 1)) 2)) (fun u a => (littleLaw (shape 1 6 1) u ((stageBPriority (shape 1 6 1)) 2) a : ℝ)) (fun u _ => B1_6_1Law_sound u) (fun u _ a => B1_6_1Little_sound u ((stageBPriority (shape 1 6 1)) 2) a) 14 a +def CB1_6_1I2R14Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB1_6_1I2R14Certificates_valid : + CB1_6_1I2R14Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_6_1I2R14CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB1_6_1I2R14P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_6_1I2R14Certificates (CB1_6_1I2R14CertificateIndex a)).input +lemma CB1_6_1I2R14P_check : ∀ a : Fin 6, contains (CB1_6_1I2R14Raw a) (CB1_6_1I2R14P a) = true := by + decide +kernel +lemma CB1_6_1I2R14P_sound (a : Fin 6) : + (CB1_6_1I2R14P a).Encloses (CB1_6_1I2R14Value a) := + contains_sound (CB1_6_1I2R14Raw_sound a) (CB1_6_1I2R14P_check a) +def CB1_6_1I2R14Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_6_1I2R14Certificates (CB1_6_1I2R14CertificateIndex a)).output +lemma CB1_6_1I2R14Terms_sound (a : Fin 6) : + (CB1_6_1I2R14Terms a).Encloses (Foundation.entropyTerm (CB1_6_1I2R14Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_6_1I2R14Certificates_valid + (CB1_6_1I2R14CertificateIndex a) (CB1_6_1I2R14P_sound a) +def CB1_6_1I2R14Entropy : Ball := ⟨0, 0⟩ +lemma CB1_6_1I2R14Entropy_sound : CB1_6_1I2R14Entropy.Encloses (Foundation.finiteEntropy CB1_6_1I2R14Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_6_1I2R14Value CB1_6_1I2R14Terms CB1_6_1I2R14Terms_sound) (by decide +kernel) +def CB1_6_1I2R14Mass : Ball := ⟨0, 0⟩ +lemma CB1_6_1I2R14Mass_sound : CB1_6_1I2R14Mass.Encloses (∑ a, CB1_6_1I2R14Value a) := by + exact contains_sound (finSumBall_sound 6 CB1_6_1I2R14P CB1_6_1I2R14Value CB1_6_1I2R14P_sound) (by decide +kernel) +def CB1_6_1I2R14MassTerm : Ball := .exact 0 +lemma CB1_6_1I2R14MassTerm_sound : CB1_6_1I2R14MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_6_1I2R14Value a))) := + entropyTerm_zero_ball (CB1_6_1I2R14Mass_sound) +def CB1_6_1I2R14H : Ball := ⟨0, 0⟩ +lemma CB1_6_1I2R14H_sound : CB1_6_1I2R14H.Encloses (homogeneousEntropy CB1_6_1I2R14Value) := by + exact contains_sound (homogeneous_enclosed CB1_6_1I2R14Value CB1_6_1I2R14MassTerm_sound CB1_6_1I2R14Entropy_sound) (by decide +kernel) +def CB1_6_1I2R15Value (a : Fin 6) : ℝ := residualLaw (below (shape 1 6 1)) (fun u => (stageBLaw (shape 1 6 1) u : ℝ)) (stageBPriority (shape 1 6 1)) 2 (fun u a => (littleLaw (shape 1 6 1) u ((stageBPriority (shape 1 6 1)) 2) a : ℝ)) 15 a +def CB1_6_1I2R15Raw (a : Fin 6) : Ball := residualBall (below (shape 1 6 1)) B1_6_1Law (stageBPriority (shape 1 6 1)) 2 (fun u => B1_6_1Little u ((stageBPriority (shape 1 6 1)) 2)) 15 a +lemma CB1_6_1I2R15Raw_sound (a : Fin 6) : + (CB1_6_1I2R15Raw a).Encloses (CB1_6_1I2R15Value a) := by + exact residualBall_sound_on (below (shape 1 6 1)) B1_6_1Law (fun u => (stageBLaw (shape 1 6 1) u : ℝ)) (stageBPriority (shape 1 6 1)) 2 (fun u => B1_6_1Little u ((stageBPriority (shape 1 6 1)) 2)) (fun u a => (littleLaw (shape 1 6 1) u ((stageBPriority (shape 1 6 1)) 2) a : ℝ)) (fun u _ => B1_6_1Law_sound u) (fun u _ a => B1_6_1Little_sound u ((stageBPriority (shape 1 6 1)) 2) a) 15 a +def CB1_6_1I2R15Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB1_6_1I2R15Certificates_valid : + CB1_6_1I2R15Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_6_1I2R15CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB1_6_1I2R15P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_6_1I2R15Certificates (CB1_6_1I2R15CertificateIndex a)).input +lemma CB1_6_1I2R15P_check : ∀ a : Fin 6, contains (CB1_6_1I2R15Raw a) (CB1_6_1I2R15P a) = true := by + decide +kernel +lemma CB1_6_1I2R15P_sound (a : Fin 6) : + (CB1_6_1I2R15P a).Encloses (CB1_6_1I2R15Value a) := + contains_sound (CB1_6_1I2R15Raw_sound a) (CB1_6_1I2R15P_check a) +def CB1_6_1I2R15Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_6_1I2R15Certificates (CB1_6_1I2R15CertificateIndex a)).output +lemma CB1_6_1I2R15Terms_sound (a : Fin 6) : + (CB1_6_1I2R15Terms a).Encloses (Foundation.entropyTerm (CB1_6_1I2R15Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_6_1I2R15Certificates_valid + (CB1_6_1I2R15CertificateIndex a) (CB1_6_1I2R15P_sound a) +def CB1_6_1I2R15Entropy : Ball := ⟨0, 0⟩ +lemma CB1_6_1I2R15Entropy_sound : CB1_6_1I2R15Entropy.Encloses (Foundation.finiteEntropy CB1_6_1I2R15Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_6_1I2R15Value CB1_6_1I2R15Terms CB1_6_1I2R15Terms_sound) (by decide +kernel) +def CB1_6_1I2R15Mass : Ball := ⟨0, 0⟩ +lemma CB1_6_1I2R15Mass_sound : CB1_6_1I2R15Mass.Encloses (∑ a, CB1_6_1I2R15Value a) := by + exact contains_sound (finSumBall_sound 6 CB1_6_1I2R15P CB1_6_1I2R15Value CB1_6_1I2R15P_sound) (by decide +kernel) +def CB1_6_1I2R15MassTerm : Ball := .exact 0 +lemma CB1_6_1I2R15MassTerm_sound : CB1_6_1I2R15MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_6_1I2R15Value a))) := + entropyTerm_zero_ball (CB1_6_1I2R15Mass_sound) +def CB1_6_1I2R15H : Ball := ⟨0, 0⟩ +lemma CB1_6_1I2R15H_sound : CB1_6_1I2R15H.Encloses (homogeneousEntropy CB1_6_1I2R15Value) := by + exact contains_sound (homogeneous_enclosed CB1_6_1I2R15Value CB1_6_1I2R15MassTerm_sound CB1_6_1I2R15Entropy_sound) (by decide +kernel) +def CB1_6_1I2R16Value (a : Fin 6) : ℝ := residualLaw (below (shape 1 6 1)) (fun u => (stageBLaw (shape 1 6 1) u : ℝ)) (stageBPriority (shape 1 6 1)) 2 (fun u a => (littleLaw (shape 1 6 1) u ((stageBPriority (shape 1 6 1)) 2) a : ℝ)) 16 a +def CB1_6_1I2R16Raw (a : Fin 6) : Ball := residualBall (below (shape 1 6 1)) B1_6_1Law (stageBPriority (shape 1 6 1)) 2 (fun u => B1_6_1Little u ((stageBPriority (shape 1 6 1)) 2)) 16 a +lemma CB1_6_1I2R16Raw_sound (a : Fin 6) : + (CB1_6_1I2R16Raw a).Encloses (CB1_6_1I2R16Value a) := by + exact residualBall_sound_on (below (shape 1 6 1)) B1_6_1Law (fun u => (stageBLaw (shape 1 6 1) u : ℝ)) (stageBPriority (shape 1 6 1)) 2 (fun u => B1_6_1Little u ((stageBPriority (shape 1 6 1)) 2)) (fun u a => (littleLaw (shape 1 6 1) u ((stageBPriority (shape 1 6 1)) 2) a : ℝ)) (fun u _ => B1_6_1Law_sound u) (fun u _ a => B1_6_1Little_sound u ((stageBPriority (shape 1 6 1)) 2) a) 16 a +def CB1_6_1I2R16Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB1_6_1I2R16Certificates_valid : + CB1_6_1I2R16Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB1_6_1I2R16CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB1_6_1I2R16P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_6_1I2R16Certificates (CB1_6_1I2R16CertificateIndex a)).input +lemma CB1_6_1I2R16P_check : ∀ a : Fin 6, contains (CB1_6_1I2R16Raw a) (CB1_6_1I2R16P a) = true := by + decide +kernel +lemma CB1_6_1I2R16P_sound (a : Fin 6) : + (CB1_6_1I2R16P a).Encloses (CB1_6_1I2R16Value a) := + contains_sound (CB1_6_1I2R16Raw_sound a) (CB1_6_1I2R16P_check a) +def CB1_6_1I2R16Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB1_6_1I2R16Certificates (CB1_6_1I2R16CertificateIndex a)).output +lemma CB1_6_1I2R16Terms_sound (a : Fin 6) : + (CB1_6_1I2R16Terms a).Encloses (Foundation.entropyTerm (CB1_6_1I2R16Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB1_6_1I2R16Certificates_valid + (CB1_6_1I2R16CertificateIndex a) (CB1_6_1I2R16P_sound a) +def CB1_6_1I2R16Entropy : Ball := ⟨0, 0⟩ +lemma CB1_6_1I2R16Entropy_sound : CB1_6_1I2R16Entropy.Encloses (Foundation.finiteEntropy CB1_6_1I2R16Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_6_1I2R16Value CB1_6_1I2R16Terms CB1_6_1I2R16Terms_sound) (by decide +kernel) +def CB1_6_1I2R16Mass : Ball := ⟨0, 0⟩ +lemma CB1_6_1I2R16Mass_sound : CB1_6_1I2R16Mass.Encloses (∑ a, CB1_6_1I2R16Value a) := by + exact contains_sound (finSumBall_sound 6 CB1_6_1I2R16P CB1_6_1I2R16Value CB1_6_1I2R16P_sound) (by decide +kernel) +def CB1_6_1I2R16MassTerm : Ball := .exact 0 +lemma CB1_6_1I2R16MassTerm_sound : CB1_6_1I2R16MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_6_1I2R16Value a))) := + entropyTerm_zero_ball (CB1_6_1I2R16Mass_sound) +def CB1_6_1I2R16H : Ball := ⟨0, 0⟩ +lemma CB1_6_1I2R16H_sound : CB1_6_1I2R16H.Encloses (homogeneousEntropy CB1_6_1I2R16Value) := by + exact contains_sound (homogeneous_enclosed CB1_6_1I2R16Value CB1_6_1I2R16MassTerm_sound CB1_6_1I2R16Entropy_sound) (by decide +kernel) +def CB1_6_1I2ResidualEntropies (a : Fin 17) : Ball := + match a.val with + | 0 => CB1_6_1I2R0H + | 1 => CB1_6_1I2R1H + | 2 => CB1_6_1I2R2H + | 3 => CB1_6_1I2R3H + | 4 => CB1_6_1I2R4H + | 5 => CB1_6_1I2R5H + | 6 => CB1_6_1I2R6H + | 7 => CB1_6_1I2R7H + | 8 => CB1_6_1I2R8H + | 9 => CB1_6_1I2R9H + | 10 => CB1_6_1I2R10H + | 11 => CB1_6_1I2R11H + | 12 => CB1_6_1I2R12H + | 13 => CB1_6_1I2R13H + | 14 => CB1_6_1I2R14H + | 15 => CB1_6_1I2R15H + | 16 => CB1_6_1I2R16H + | _ => (.exact 0) +lemma CB1_6_1I2ResidualEntropies_sound (k : Fin 17) : + (CB1_6_1I2ResidualEntropies k).Encloses (homogeneousEntropy + (residualLaw (below (shape 1 6 1)) (fun u => (stageBLaw (shape 1 6 1) u : ℝ)) (stageBPriority (shape 1 6 1)) 2 (fun u a => (littleLaw (shape 1 6 1) u ((stageBPriority (shape 1 6 1)) 2) a : ℝ)) k)) := by + fin_cases k + · exact CB1_6_1I2R0H_sound + · exact CB1_6_1I2R1H_sound + · exact CB1_6_1I2R2H_sound + · exact CB1_6_1I2R3H_sound + · exact CB1_6_1I2R4H_sound + · exact CB1_6_1I2R5H_sound + · exact CB1_6_1I2R6H_sound + · exact CB1_6_1I2R7H_sound + · exact CB1_6_1I2R8H_sound + · exact CB1_6_1I2R9H_sound + · exact CB1_6_1I2R10H_sound + · exact CB1_6_1I2R11H_sound + · exact CB1_6_1I2R12H_sound + · exact CB1_6_1I2R13H_sound + · exact CB1_6_1I2R14H_sound + · exact CB1_6_1I2R15H_sound + · exact CB1_6_1I2R16H_sound +def CB1_6_1I2S0_3_1Value (a : Fin 6) : ℝ := (littleLaw (shape 1 6 1) (shape 0 3 1) ((stageBPriority (shape 1 6 1)) 2) a : ℝ) +def CB1_6_1I2S0_3_1E_4Log : Ball := .exact 0 +lemma CB1_6_1I2S0_3_1E_4Log_sound : CB1_6_1I2S0_3_1E_4Log.Encloses (Real.log (CB1_6_1I2S0_3_1Value (4 : Fin 6))) := by + exact log_exact_one_ball ((B1_6_1Little_sound (shape 0 3 1) ((stageBPriority (shape 1 6 1)) 2)) (4 : Fin 6)) +def CB1_6_1I2S0_3_1E_4 : Ball := ⟨0, 0⟩ +lemma CB1_6_1I2S0_3_1E_4_sound : CB1_6_1I2S0_3_1E_4.Encloses (Foundation.entropyTerm (CB1_6_1I2S0_3_1Value (4 : Fin 6))) := by + exact contains_sound (entropyTerm_ball ((B1_6_1Little_sound (shape 0 3 1) ((stageBPriority (shape 1 6 1)) 2)) (4 : Fin 6)) CB1_6_1I2S0_3_1E_4Log_sound) (by decide +kernel) +def CB1_6_1I2S0_3_1Terms (a : Fin 6) : Ball := + match a.val with + | 4 => ⟨0, 0⟩ + | _ => (.exact 0) +lemma CB1_6_1I2S0_3_1Terms_sound (a : Fin 6) : + (CB1_6_1I2S0_3_1Terms a).Encloses (Foundation.entropyTerm (CB1_6_1I2S0_3_1Value a)) := by + fin_cases a + · exact (entropyTerm_zero_ball ((B1_6_1Little_sound (shape 0 3 1) ((stageBPriority (shape 1 6 1)) 2)) (0 : Fin 6))) + · exact (entropyTerm_zero_ball ((B1_6_1Little_sound (shape 0 3 1) ((stageBPriority (shape 1 6 1)) 2)) (1 : Fin 6))) + · exact (entropyTerm_zero_ball ((B1_6_1Little_sound (shape 0 3 1) ((stageBPriority (shape 1 6 1)) 2)) (2 : Fin 6))) + · exact (entropyTerm_zero_ball ((B1_6_1Little_sound (shape 0 3 1) ((stageBPriority (shape 1 6 1)) 2)) (3 : Fin 6))) + · exact CB1_6_1I2S0_3_1E_4_sound + · exact (entropyTerm_zero_ball ((B1_6_1Little_sound (shape 0 3 1) ((stageBPriority (shape 1 6 1)) 2)) (5 : Fin 6))) +def CB1_6_1I2S0_3_1Entropy : Ball := ⟨0, 0⟩ +lemma CB1_6_1I2S0_3_1Entropy_sound : CB1_6_1I2S0_3_1Entropy.Encloses (Foundation.finiteEntropy CB1_6_1I2S0_3_1Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_6_1I2S0_3_1Value CB1_6_1I2S0_3_1Terms CB1_6_1I2S0_3_1Terms_sound) (by decide +kernel) +def CB1_6_1I2S0_3_1Mass : Ball := ⟨1, 0⟩ +lemma CB1_6_1I2S0_3_1Mass_sound : CB1_6_1I2S0_3_1Mass.Encloses (∑ a, CB1_6_1I2S0_3_1Value a) := by + exact contains_sound (finSumBall_sound 6 (B1_6_1Little (shape 0 3 1) ((stageBPriority (shape 1 6 1)) 2)) CB1_6_1I2S0_3_1Value (B1_6_1Little_sound (shape 0 3 1) ((stageBPriority (shape 1 6 1)) 2))) (by decide +kernel) +def CB1_6_1I2S0_3_1MassTermLog : Ball := .exact 0 +lemma CB1_6_1I2S0_3_1MassTermLog_sound : CB1_6_1I2S0_3_1MassTermLog.Encloses (Real.log ((∑ a, CB1_6_1I2S0_3_1Value a))) := by + exact log_exact_one_ball (CB1_6_1I2S0_3_1Mass_sound) +def CB1_6_1I2S0_3_1MassTerm : Ball := ⟨0, 0⟩ +lemma CB1_6_1I2S0_3_1MassTerm_sound : CB1_6_1I2S0_3_1MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_6_1I2S0_3_1Value a))) := by + exact contains_sound (entropyTerm_ball (CB1_6_1I2S0_3_1Mass_sound) CB1_6_1I2S0_3_1MassTermLog_sound) (by decide +kernel) +def CB1_6_1I2S0_3_1H : Ball := ⟨0, 0⟩ +lemma CB1_6_1I2S0_3_1H_sound : CB1_6_1I2S0_3_1H.Encloses (homogeneousEntropy CB1_6_1I2S0_3_1Value) := by + exact contains_sound (homogeneous_enclosed CB1_6_1I2S0_3_1Value CB1_6_1I2S0_3_1MassTerm_sound CB1_6_1I2S0_3_1Entropy_sound) (by decide +kernel) +def CB1_6_1I2S0_4_0Value (a : Fin 6) : ℝ := (littleLaw (shape 1 6 1) (shape 0 4 0) ((stageBPriority (shape 1 6 1)) 2) a : ℝ) +def CB1_6_1I2S0_4_0E_5Log : Ball := .exact 0 +lemma CB1_6_1I2S0_4_0E_5Log_sound : CB1_6_1I2S0_4_0E_5Log.Encloses (Real.log (CB1_6_1I2S0_4_0Value (5 : Fin 6))) := by + exact log_exact_one_ball ((B1_6_1Little_sound (shape 0 4 0) ((stageBPriority (shape 1 6 1)) 2)) (5 : Fin 6)) +def CB1_6_1I2S0_4_0E_5 : Ball := ⟨0, 0⟩ +lemma CB1_6_1I2S0_4_0E_5_sound : CB1_6_1I2S0_4_0E_5.Encloses (Foundation.entropyTerm (CB1_6_1I2S0_4_0Value (5 : Fin 6))) := by + exact contains_sound (entropyTerm_ball ((B1_6_1Little_sound (shape 0 4 0) ((stageBPriority (shape 1 6 1)) 2)) (5 : Fin 6)) CB1_6_1I2S0_4_0E_5Log_sound) (by decide +kernel) +def CB1_6_1I2S0_4_0Terms (a : Fin 6) : Ball := + match a.val with + | 5 => ⟨0, 0⟩ + | _ => (.exact 0) +lemma CB1_6_1I2S0_4_0Terms_sound (a : Fin 6) : + (CB1_6_1I2S0_4_0Terms a).Encloses (Foundation.entropyTerm (CB1_6_1I2S0_4_0Value a)) := by + fin_cases a + · exact (entropyTerm_zero_ball ((B1_6_1Little_sound (shape 0 4 0) ((stageBPriority (shape 1 6 1)) 2)) (0 : Fin 6))) + · exact (entropyTerm_zero_ball ((B1_6_1Little_sound (shape 0 4 0) ((stageBPriority (shape 1 6 1)) 2)) (1 : Fin 6))) + · exact (entropyTerm_zero_ball ((B1_6_1Little_sound (shape 0 4 0) ((stageBPriority (shape 1 6 1)) 2)) (2 : Fin 6))) + · exact (entropyTerm_zero_ball ((B1_6_1Little_sound (shape 0 4 0) ((stageBPriority (shape 1 6 1)) 2)) (3 : Fin 6))) + · exact (entropyTerm_zero_ball ((B1_6_1Little_sound (shape 0 4 0) ((stageBPriority (shape 1 6 1)) 2)) (4 : Fin 6))) + · exact CB1_6_1I2S0_4_0E_5_sound +def CB1_6_1I2S0_4_0Entropy : Ball := ⟨0, 0⟩ +lemma CB1_6_1I2S0_4_0Entropy_sound : CB1_6_1I2S0_4_0Entropy.Encloses (Foundation.finiteEntropy CB1_6_1I2S0_4_0Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_6_1I2S0_4_0Value CB1_6_1I2S0_4_0Terms CB1_6_1I2S0_4_0Terms_sound) (by decide +kernel) +def CB1_6_1I2S0_4_0Mass : Ball := ⟨1, 0⟩ +lemma CB1_6_1I2S0_4_0Mass_sound : CB1_6_1I2S0_4_0Mass.Encloses (∑ a, CB1_6_1I2S0_4_0Value a) := by + exact contains_sound (finSumBall_sound 6 (B1_6_1Little (shape 0 4 0) ((stageBPriority (shape 1 6 1)) 2)) CB1_6_1I2S0_4_0Value (B1_6_1Little_sound (shape 0 4 0) ((stageBPriority (shape 1 6 1)) 2))) (by decide +kernel) +def CB1_6_1I2S0_4_0MassTermLog : Ball := .exact 0 +lemma CB1_6_1I2S0_4_0MassTermLog_sound : CB1_6_1I2S0_4_0MassTermLog.Encloses (Real.log ((∑ a, CB1_6_1I2S0_4_0Value a))) := by + exact log_exact_one_ball (CB1_6_1I2S0_4_0Mass_sound) +def CB1_6_1I2S0_4_0MassTerm : Ball := ⟨0, 0⟩ +lemma CB1_6_1I2S0_4_0MassTerm_sound : CB1_6_1I2S0_4_0MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_6_1I2S0_4_0Value a))) := by + exact contains_sound (entropyTerm_ball (CB1_6_1I2S0_4_0Mass_sound) CB1_6_1I2S0_4_0MassTermLog_sound) (by decide +kernel) +def CB1_6_1I2S0_4_0H : Ball := ⟨0, 0⟩ +lemma CB1_6_1I2S0_4_0H_sound : CB1_6_1I2S0_4_0H.Encloses (homogeneousEntropy CB1_6_1I2S0_4_0Value) := by + exact contains_sound (homogeneous_enclosed CB1_6_1I2S0_4_0Value CB1_6_1I2S0_4_0MassTerm_sound CB1_6_1I2S0_4_0Entropy_sound) (by decide +kernel) +def CB1_6_1I2S1_3_0Value (a : Fin 6) : ℝ := (littleLaw (shape 1 6 1) (shape 1 3 0) ((stageBPriority (shape 1 6 1)) 2) a : ℝ) +def CB1_6_1I2S1_3_0E_4Log : Ball := .exact 0 +lemma CB1_6_1I2S1_3_0E_4Log_sound : CB1_6_1I2S1_3_0E_4Log.Encloses (Real.log (CB1_6_1I2S1_3_0Value (4 : Fin 6))) := by + exact log_exact_one_ball ((B1_6_1Little_sound (shape 1 3 0) ((stageBPriority (shape 1 6 1)) 2)) (4 : Fin 6)) +def CB1_6_1I2S1_3_0E_4 : Ball := ⟨0, 0⟩ +lemma CB1_6_1I2S1_3_0E_4_sound : CB1_6_1I2S1_3_0E_4.Encloses (Foundation.entropyTerm (CB1_6_1I2S1_3_0Value (4 : Fin 6))) := by + exact contains_sound (entropyTerm_ball ((B1_6_1Little_sound (shape 1 3 0) ((stageBPriority (shape 1 6 1)) 2)) (4 : Fin 6)) CB1_6_1I2S1_3_0E_4Log_sound) (by decide +kernel) +def CB1_6_1I2S1_3_0Terms (a : Fin 6) : Ball := + match a.val with + | 4 => ⟨0, 0⟩ + | _ => (.exact 0) +lemma CB1_6_1I2S1_3_0Terms_sound (a : Fin 6) : + (CB1_6_1I2S1_3_0Terms a).Encloses (Foundation.entropyTerm (CB1_6_1I2S1_3_0Value a)) := by + fin_cases a + · exact (entropyTerm_zero_ball ((B1_6_1Little_sound (shape 1 3 0) ((stageBPriority (shape 1 6 1)) 2)) (0 : Fin 6))) + · exact (entropyTerm_zero_ball ((B1_6_1Little_sound (shape 1 3 0) ((stageBPriority (shape 1 6 1)) 2)) (1 : Fin 6))) + · exact (entropyTerm_zero_ball ((B1_6_1Little_sound (shape 1 3 0) ((stageBPriority (shape 1 6 1)) 2)) (2 : Fin 6))) + · exact (entropyTerm_zero_ball ((B1_6_1Little_sound (shape 1 3 0) ((stageBPriority (shape 1 6 1)) 2)) (3 : Fin 6))) + · exact CB1_6_1I2S1_3_0E_4_sound + · exact (entropyTerm_zero_ball ((B1_6_1Little_sound (shape 1 3 0) ((stageBPriority (shape 1 6 1)) 2)) (5 : Fin 6))) +def CB1_6_1I2S1_3_0Entropy : Ball := ⟨0, 0⟩ +lemma CB1_6_1I2S1_3_0Entropy_sound : CB1_6_1I2S1_3_0Entropy.Encloses (Foundation.finiteEntropy CB1_6_1I2S1_3_0Value) := by + exact contains_sound (entropyFin_enclosed 6 CB1_6_1I2S1_3_0Value CB1_6_1I2S1_3_0Terms CB1_6_1I2S1_3_0Terms_sound) (by decide +kernel) +def CB1_6_1I2S1_3_0Mass : Ball := ⟨1, 0⟩ +lemma CB1_6_1I2S1_3_0Mass_sound : CB1_6_1I2S1_3_0Mass.Encloses (∑ a, CB1_6_1I2S1_3_0Value a) := by + exact contains_sound (finSumBall_sound 6 (B1_6_1Little (shape 1 3 0) ((stageBPriority (shape 1 6 1)) 2)) CB1_6_1I2S1_3_0Value (B1_6_1Little_sound (shape 1 3 0) ((stageBPriority (shape 1 6 1)) 2))) (by decide +kernel) +def CB1_6_1I2S1_3_0MassTermLog : Ball := .exact 0 +lemma CB1_6_1I2S1_3_0MassTermLog_sound : CB1_6_1I2S1_3_0MassTermLog.Encloses (Real.log ((∑ a, CB1_6_1I2S1_3_0Value a))) := by + exact log_exact_one_ball (CB1_6_1I2S1_3_0Mass_sound) +def CB1_6_1I2S1_3_0MassTerm : Ball := ⟨0, 0⟩ +lemma CB1_6_1I2S1_3_0MassTerm_sound : CB1_6_1I2S1_3_0MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB1_6_1I2S1_3_0Value a))) := by + exact contains_sound (entropyTerm_ball (CB1_6_1I2S1_3_0Mass_sound) CB1_6_1I2S1_3_0MassTermLog_sound) (by decide +kernel) +def CB1_6_1I2S1_3_0H : Ball := ⟨0, 0⟩ +lemma CB1_6_1I2S1_3_0H_sound : CB1_6_1I2S1_3_0H.Encloses (homogeneousEntropy CB1_6_1I2S1_3_0Value) := by + exact contains_sound (homogeneous_enclosed CB1_6_1I2S1_3_0Value CB1_6_1I2S1_3_0MassTerm_sound CB1_6_1I2S1_3_0Entropy_sound) (by decide +kernel) +def CB1_6_1I2Singles (s : Shape) : Ball := + match s 0, s 1, s 2 with + | 0, 3, 1 => CB1_6_1I2S0_3_1H + | 0, 4, 0 => CB1_6_1I2S0_4_0H + | 1, 3, 0 => CB1_6_1I2S1_3_0H + | _, _, _ => (.exact 0) +lemma CB1_6_1I2Singles_sound (u : Shape) (hu : u ∈ below (shape 1 6 1)) + (hd : designated (stageBPriority (shape 1 6 1)) 2 u) : + (CB1_6_1I2Singles u).Encloses (homogeneousEntropy ((fun u a => (littleLaw (shape 1 6 1) u ((stageBPriority (shape 1 6 1)) 2) a : ℝ)) u)) := by + rw [B1_6_1_below] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl + · exact CB1_6_1I2S0_3_1H_sound + · exact CB1_6_1I2S0_4_0H_sound + · exact (show ¬ designated (stageBPriority (shape 1 6 1)) 2 (shape 1 2 1) by decide +kernel) hd |>.elim + · exact CB1_6_1I2S1_3_0H_sound +def CB1_6_1I2Singleton : Ball := ⟨0, 0⟩ +lemma CB1_6_1I2Singleton_sound : CB1_6_1I2Singleton.Encloses + (singletonEntropy (below (shape 1 6 1)) (fun u => (stageBLaw (shape 1 6 1) u : ℝ)) (stageBPriority (shape 1 6 1)) 2 (fun u a => (littleLaw (shape 1 6 1) u ((stageBPriority (shape 1 6 1)) 2) a : ℝ))) := by + exact contains_sound (singletonBall_sound (below (shape 1 6 1)) B1_6_1Law (fun u => (stageBLaw (shape 1 6 1) u : ℝ)) (stageBPriority (shape 1 6 1)) 2 + CB1_6_1I2Singles (fun u a => (littleLaw (shape 1 6 1) u ((stageBPriority (shape 1 6 1)) 2) a : ℝ)) (fun u _ => B1_6_1Law_sound u) CB1_6_1I2Singles_sound) (by decide +kernel) +def CB1_6_1I2Group : Ball := ⟨(2065143764242494166405890297321 / 100000000000000000000000000000000), (12761288021 / 50000000000000000000000000000000)⟩ +lemma CB1_6_1I2Group_sound : CB1_6_1I2Group.Encloses + (groupedEntropy (below (shape 1 6 1)) (fun u => (stageBLaw (shape 1 6 1) u : ℝ)) (stageBPriority (shape 1 6 1)) 2 (fun u a => (littleLaw (shape 1 6 1) u ((stageBPriority (shape 1 6 1)) 2) a : ℝ))) := by + exact contains_sound (Ball.add_sound CB1_6_1I2Singleton_sound + (finSumBall_sound 17 CB1_6_1I2ResidualEntropies _ CB1_6_1I2ResidualEntropies_sound)) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CB1_6_1I2H : Ball := ⟨(35600351325807200116638239804507 / 50000000000000000000000000000000), (130476417237 / 100000000000000000000000000000000)⟩ +lemma CB1_6_1I2_sound : CB1_6_1I2H.Encloses (stageBCapacity (shape 1 6 1) 2) := by + have hb := contains_sound (Ball.add_sound CB1_6_1I2PairH_sound + (Ball.neg_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) CB1_6_1I2Group_sound))) + (show contains (.add CB1_6_1I2PairH (.neg (.mul (.exact 2) CB1_6_1I2Group))) CB1_6_1I2H = true by decide +kernel) + unfold CB1_6_1I2PairValue at hb + simpa only [stageBCapacity, nativeCapacity, + show (2 : Fin 3) ≠ 0 by decide, ite_false, sub_eq_add_neg] using hb + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/CapacityB/CapB2_1_5I0.lean b/lean/OAI/LinearAlgebra/MatrixFields/CapacityB/CapB2_1_5I0.lean new file mode 100644 index 0000000000000000000000000000000000000000..39c1a773855f57368547bfce1828d95d7236878d --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/CapacityB/CapB2_1_5I0.lean @@ -0,0 +1,72 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Certificates.Terminal2_1_5 + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CB2_1_5I0Value (a : Fin 17) : ℝ := marginal (below (shape 2 1 5)) (fun u => (stageBLaw (shape 2 1 5) u : ℝ)) ((stageBPriority (shape 2 1 5)) 0) a +def CB2_1_5I0Raw (a : Fin 17) : Ball := marginalBall (below (shape 2 1 5)) B2_1_5Law ((stageBPriority (shape 2 1 5)) 0) a +lemma CB2_1_5I0Raw_sound (a : Fin 17) : + (CB2_1_5I0Raw a).Encloses (CB2_1_5I0Value a) := by + exact marginalBall_sound (below (shape 2 1 5)) B2_1_5Law (fun u => (stageBLaw (shape 2 1 5) u : ℝ)) (fun u _ => B2_1_5Law_sound u) ((stageBPriority (shape 2 1 5)) 0) a +def CB2_1_5I0Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(1 / 2), (49 / 100000000000000000000000000000000)⟩ ⟨(6931471805599453094172319305033 / 20000000000000000000000000000000), (10587911883 / 50000000000000000000000000000000)⟩ ⟨(-6931471805599453094172319305033 / 10000000000000000000000000000000), (42351647463 / 100000000000000000000000000000000)⟩ ⟨-1, 1, 1⟩] +lemma CB2_1_5I0Certificates_valid : + CB2_1_5I0Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB2_1_5I0CertificateIndex (a : Fin 17) : ℕ := + match a.val with + | 0 => 1 + | 1 => 1 + | _ => 0 +def CB2_1_5I0P (a : Fin 17) : Ball := + (CompactCertificate.entropyLookup CB2_1_5I0Certificates (CB2_1_5I0CertificateIndex a)).input +lemma CB2_1_5I0P_check : ∀ a : Fin 17, contains (CB2_1_5I0Raw a) (CB2_1_5I0P a) = true := by + decide +kernel +lemma CB2_1_5I0P_sound (a : Fin 17) : + (CB2_1_5I0P a).Encloses (CB2_1_5I0Value a) := + contains_sound (CB2_1_5I0Raw_sound a) (CB2_1_5I0P_check a) +def CB2_1_5I0Terms (a : Fin 17) : Ball := + (CompactCertificate.entropyLookup CB2_1_5I0Certificates (CB2_1_5I0CertificateIndex a)).output +lemma CB2_1_5I0Terms_sound (a : Fin 17) : + (CB2_1_5I0Terms a).Encloses (Foundation.entropyTerm (CB2_1_5I0Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB2_1_5I0Certificates_valid + (CB2_1_5I0CertificateIndex a) (CB2_1_5I0P_sound a) +def CB2_1_5I0Entropy : Ball := ⟨(6931471805599453094172319305033 / 10000000000000000000000000000000), (10587911883 / 25000000000000000000000000000000)⟩ +lemma CB2_1_5I0Entropy_sound : CB2_1_5I0Entropy.Encloses (Foundation.finiteEntropy CB2_1_5I0Value) := by + exact contains_sound (entropyFin_enclosed 17 CB2_1_5I0Value CB2_1_5I0Terms CB2_1_5I0Terms_sound) (by decide +kernel) +def CB2_1_5I0Mass : Ball := ⟨1, (49 / 50000000000000000000000000000000)⟩ +lemma CB2_1_5I0Mass_sound : CB2_1_5I0Mass.Encloses (∑ a, CB2_1_5I0Value a) := by + exact contains_sound (finSumBall_sound 17 CB2_1_5I0P CB2_1_5I0Value CB2_1_5I0P_sound) (by decide +kernel) +def CB2_1_5I0MassTermLogWitness : LogWitness := ⟨0, 1, 1⟩ +def CB2_1_5I0MassTermLog : Ball := ⟨0, (1058791189 / 5000000000000000000000000000000)⟩ +lemma CB2_1_5I0MassTermLog_sound : CB2_1_5I0MassTermLog.Encloses (Real.log ((∑ a, CB2_1_5I0Value a))) := by + exact checkLog_sound logTwoBall_sound (CB2_1_5I0Mass_sound) (w := CB2_1_5I0MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB2_1_5I0MassTerm : Ball := ⟨0, (21175823781 / 100000000000000000000000000000000)⟩ +lemma CB2_1_5I0MassTerm_sound : CB2_1_5I0MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB2_1_5I0Value a))) := by + exact contains_sound (entropyTerm_ball (CB2_1_5I0Mass_sound) CB2_1_5I0MassTermLog_sound) (by decide +kernel) +def CB2_1_5I0H : Ball := ⟨(6931471805599453094172319305033 / 10000000000000000000000000000000), (63527471313 / 100000000000000000000000000000000)⟩ +lemma CB2_1_5I0H_sound : CB2_1_5I0H.Encloses (homogeneousEntropy CB2_1_5I0Value) := by + exact contains_sound (homogeneous_enclosed CB2_1_5I0Value CB2_1_5I0MassTerm_sound CB2_1_5I0Entropy_sound) (by decide +kernel) +lemma CB2_1_5I0_sound : CB2_1_5I0H.Encloses (stageBCapacity (shape 2 1 5) 0) := by + exact CB2_1_5I0H_sound + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/CapacityB/CapB2_1_5I1.lean b/lean/OAI/LinearAlgebra/MatrixFields/CapacityB/CapB2_1_5I1.lean new file mode 100644 index 0000000000000000000000000000000000000000..9b5ca9c3dc4b247f15d8030e0f97c2e256f349da --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/CapacityB/CapB2_1_5I1.lean @@ -0,0 +1,841 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Certificates.Terminal2_1_5 + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CB2_1_5I1PairValue (a : PairSlot) : ℝ := pairLaw (below (shape 2 1 5)) (shape 2 1 5) (fun u => (stageBLaw (shape 2 1 5) u : ℝ)) (fun u a => (littleLaw (shape 2 1 5) u ((stageBPriority (shape 2 1 5)) 1) a : ℝ)) a +def CB2_1_5I1PairRaw (a : PairSlot) : Ball := pairLawBall (below (shape 2 1 5)) (shape 2 1 5) B2_1_5Law (fun u => B2_1_5Little u ((stageBPriority (shape 2 1 5)) 1)) a +lemma CB2_1_5I1PairRaw_sound (a : PairSlot) : + (CB2_1_5I1PairRaw a).Encloses (CB2_1_5I1PairValue a) := by + exact pairLawBall_sound_on (below (shape 2 1 5)) (shape 2 1 5) B2_1_5Law (fun u => (stageBLaw (shape 2 1 5) u : ℝ)) (fun u => B2_1_5Little u ((stageBPriority (shape 2 1 5)) 1)) (fun u a => (littleLaw (shape 2 1 5) u ((stageBPriority (shape 2 1 5)) 1) a : ℝ)) (fun u _ => B2_1_5Law_sound u) (fun u _ a => B2_1_5Little_sound u ((stageBPriority (shape 2 1 5)) 1) a) (fun u _ a => B2_1_5Little_sound (complement (shape 2 1 5) u) ((stageBPriority (shape 2 1 5)) 1) a) a +def CB2_1_5I1PairCertificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(8240786865581452095028265002887 / 50000000000000000000000000000000), (31 / 100000000000000000000000000000000)⟩ ⟨(1857192320517522245424112020319 / 6250000000000000000000000000000), (6980218031 / 50000000000000000000000000000000)⟩ ⟨(-90146358633508125450472038667133 / 50000000000000000000000000000000), (2117582373 / 2500000000000000000000000000000)⟩ ⟨-3, 8240786865581452095028265002887, 6250000000000000000000000000000⟩, + .log ⟨(919021127692499707011485447387 / 50000000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ ⟨(918209901412572959589478764257 / 12500000000000000000000000000000), (2724544131 / 100000000000000000000000000000000)⟩ ⟨(-79929383448934316117373233182213 / 20000000000000000000000000000000), (74115382999 / 50000000000000000000000000000000)⟩ ⟨-6, 919021127692499707011485447387, 781250000000000000000000000000⟩, + .log ⟨(7920096003363024098980124774863 / 12500000000000000000000000000000), (1 / 3125000000000000000000000000000)⟩ ⟨(7228280637521402636754794374159 / 25000000000000000000000000000000), (2683432909 / 10000000000000000000000000000000)⟩ ⟨(-9126506338372838613585647245343 / 20000000000000000000000000000000), (5293955927 / 12500000000000000000000000000000)⟩ ⟨-1, 7920096003363024098980124774863, 6250000000000000000000000000000⟩] +lemma CB2_1_5I1PairCertificates_valid : + CB2_1_5I1PairCertificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB2_1_5I1PairCertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 0, 2 => 1 + | 0, 3 => 2 + | 1, 1 => 3 + | 2, 0 => 1 + | 3, 0 => 2 + | _, _ => 0 +def CB2_1_5I1PairP (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CB2_1_5I1PairCertificates (CB2_1_5I1PairCertificateIndex a)).input +lemma CB2_1_5I1PairP_check : ∀ a : PairSlot, contains (CB2_1_5I1PairRaw a) (CB2_1_5I1PairP a) = true := by + decide +kernel +lemma CB2_1_5I1PairP_sound (a : PairSlot) : + (CB2_1_5I1PairP a).Encloses (CB2_1_5I1PairValue a) := + contains_sound (CB2_1_5I1PairRaw_sound a) (CB2_1_5I1PairP_check a) +def CB2_1_5I1PairTerms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CB2_1_5I1PairCertificates (CB2_1_5I1PairCertificateIndex a)).output +lemma CB2_1_5I1PairTerms_sound (a : PairSlot) : + (CB2_1_5I1PairTerms a).Encloses (Foundation.entropyTerm (CB2_1_5I1PairValue a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB2_1_5I1PairCertificates_valid + (CB2_1_5I1PairCertificateIndex a) (CB2_1_5I1PairP_sound a) +def CB2_1_5I1PairEntropy : Ball := ⟨(25758658807311872438505605593739 / 25000000000000000000000000000000), (15051072369 / 25000000000000000000000000000000)⟩ +lemma CB2_1_5I1PairEntropy_sound : CB2_1_5I1PairEntropy.Encloses (Foundation.finiteEntropy CB2_1_5I1PairValue) := by + exact contains_sound (entropyPair_enclosed CB2_1_5I1PairValue CB2_1_5I1PairTerms CB2_1_5I1PairTerms_sound) (by decide +kernel) +def CB2_1_5I1PairMass : Ball := ⟨1, (51 / 50000000000000000000000000000000)⟩ +lemma CB2_1_5I1PairMass_sound : CB2_1_5I1PairMass.Encloses (∑ a, CB2_1_5I1PairValue a) := by + exact contains_sound (pairSumBall_sound CB2_1_5I1PairP CB2_1_5I1PairValue CB2_1_5I1PairP_sound) (by decide +kernel) +def CB2_1_5I1PairMassTermLogWitness : LogWitness := ⟨0, 1, 1⟩ +def CB2_1_5I1PairMassTermLog : Ball := ⟨0, (2646977973 / 12500000000000000000000000000000)⟩ +lemma CB2_1_5I1PairMassTermLog_sound : CB2_1_5I1PairMassTermLog.Encloses (Real.log ((∑ a, CB2_1_5I1PairValue a))) := by + exact checkLog_sound logTwoBall_sound (CB2_1_5I1PairMass_sound) (w := CB2_1_5I1PairMassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB2_1_5I1PairMassTerm : Ball := ⟨0, (4235164757 / 20000000000000000000000000000000)⟩ +lemma CB2_1_5I1PairMassTerm_sound : CB2_1_5I1PairMassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB2_1_5I1PairValue a))) := by + exact contains_sound (entropyTerm_ball (CB2_1_5I1PairMass_sound) CB2_1_5I1PairMassTermLog_sound) (by decide +kernel) +def CB2_1_5I1PairH : Ball := ⟨(25758658807311872438505605593739 / 25000000000000000000000000000000), (81380113261 / 100000000000000000000000000000000)⟩ +lemma CB2_1_5I1PairH_sound : CB2_1_5I1PairH.Encloses (homogeneousEntropy CB2_1_5I1PairValue) := by + exact contains_sound (homogeneous_enclosed CB2_1_5I1PairValue CB2_1_5I1PairMassTerm_sound CB2_1_5I1PairEntropy_sound) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CB2_1_5I1R0Value (a : Fin 6) : ℝ := residualLaw (below (shape 2 1 5)) (fun u => (stageBLaw (shape 2 1 5) u : ℝ)) (stageBPriority (shape 2 1 5)) 1 (fun u a => (littleLaw (shape 2 1 5) u ((stageBPriority (shape 2 1 5)) 1) a : ℝ)) 0 a +def CB2_1_5I1R0Raw (a : Fin 6) : Ball := residualBall (below (shape 2 1 5)) B2_1_5Law (stageBPriority (shape 2 1 5)) 1 (fun u => B2_1_5Little u ((stageBPriority (shape 2 1 5)) 1)) 0 a +lemma CB2_1_5I1R0Raw_sound (a : Fin 6) : + (CB2_1_5I1R0Raw a).Encloses (CB2_1_5I1R0Value a) := by + exact residualBall_sound_on (below (shape 2 1 5)) B2_1_5Law (fun u => (stageBLaw (shape 2 1 5) u : ℝ)) (stageBPriority (shape 2 1 5)) 1 (fun u => B2_1_5Little u ((stageBPriority (shape 2 1 5)) 1)) (fun u a => (littleLaw (shape 2 1 5) u ((stageBPriority (shape 2 1 5)) 1) a : ℝ)) (fun u _ => B2_1_5Law_sound u) (fun u _ a => B2_1_5Little_sound u ((stageBPriority (shape 2 1 5)) 1) a) 0 a +def CB2_1_5I1R0Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(4579903996636975901019875225137 / 25000000000000000000000000000000), (33 / 100000000000000000000000000000000)⟩ ⟨(31092011736610680071881277157671 / 100000000000000000000000000000000), (3879329603 / 25000000000000000000000000000000)⟩ ⟨(-169719778839477575972721710038793 / 100000000000000000000000000000000), (1323488983 / 1562500000000000000000000000000)⟩ ⟨-3, 4579903996636975901019875225137, 3125000000000000000000000000000⟩] +lemma CB2_1_5I1R0Certificates_valid : + CB2_1_5I1R0Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB2_1_5I1R0CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | 0 => 1 + | _ => 0 +def CB2_1_5I1R0P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_1_5I1R0Certificates (CB2_1_5I1R0CertificateIndex a)).input +lemma CB2_1_5I1R0P_check : ∀ a : Fin 6, contains (CB2_1_5I1R0Raw a) (CB2_1_5I1R0P a) = true := by + decide +kernel +lemma CB2_1_5I1R0P_sound (a : Fin 6) : + (CB2_1_5I1R0P a).Encloses (CB2_1_5I1R0Value a) := + contains_sound (CB2_1_5I1R0Raw_sound a) (CB2_1_5I1R0P_check a) +def CB2_1_5I1R0Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_1_5I1R0Certificates (CB2_1_5I1R0CertificateIndex a)).output +lemma CB2_1_5I1R0Terms_sound (a : Fin 6) : + (CB2_1_5I1R0Terms a).Encloses (Foundation.entropyTerm (CB2_1_5I1R0Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB2_1_5I1R0Certificates_valid + (CB2_1_5I1R0CertificateIndex a) (CB2_1_5I1R0P_sound a) +def CB2_1_5I1R0Entropy : Ball := ⟨(31092011736610680071881277157671 / 100000000000000000000000000000000), (3879329603 / 25000000000000000000000000000000)⟩ +lemma CB2_1_5I1R0Entropy_sound : CB2_1_5I1R0Entropy.Encloses (Foundation.finiteEntropy CB2_1_5I1R0Value) := by + exact contains_sound (entropyFin_enclosed 6 CB2_1_5I1R0Value CB2_1_5I1R0Terms CB2_1_5I1R0Terms_sound) (by decide +kernel) +def CB2_1_5I1R0Mass : Ball := ⟨(4579903996636975901019875225137 / 25000000000000000000000000000000), (33 / 100000000000000000000000000000000)⟩ +lemma CB2_1_5I1R0Mass_sound : CB2_1_5I1R0Mass.Encloses (∑ a, CB2_1_5I1R0Value a) := by + exact contains_sound (finSumBall_sound 6 CB2_1_5I1R0P CB2_1_5I1R0Value CB2_1_5I1R0P_sound) (by decide +kernel) +def CB2_1_5I1R0MassTermLogWitness : LogWitness := ⟨-3, 4579903996636975901019875225137, 3125000000000000000000000000000⟩ +def CB2_1_5I1R0MassTermLog : Ball := ⟨(-169719778839477575972721710038793 / 100000000000000000000000000000000), (1323488983 / 1562500000000000000000000000000)⟩ +lemma CB2_1_5I1R0MassTermLog_sound : CB2_1_5I1R0MassTermLog.Encloses (Real.log ((∑ a, CB2_1_5I1R0Value a))) := by + exact checkLog_sound logTwoBall_sound (CB2_1_5I1R0Mass_sound) (w := CB2_1_5I1R0MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB2_1_5I1R0MassTerm : Ball := ⟨(31092011736610680071881277157671 / 100000000000000000000000000000000), (3879329603 / 25000000000000000000000000000000)⟩ +lemma CB2_1_5I1R0MassTerm_sound : CB2_1_5I1R0MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB2_1_5I1R0Value a))) := by + exact contains_sound (entropyTerm_ball (CB2_1_5I1R0Mass_sound) CB2_1_5I1R0MassTermLog_sound) (by decide +kernel) +def CB2_1_5I1R0H : Ball := ⟨0, (3879329603 / 12500000000000000000000000000000)⟩ +lemma CB2_1_5I1R0H_sound : CB2_1_5I1R0H.Encloses (homogeneousEntropy CB2_1_5I1R0Value) := by + exact contains_sound (homogeneous_enclosed CB2_1_5I1R0Value CB2_1_5I1R0MassTerm_sound CB2_1_5I1R0Entropy_sound) (by decide +kernel) +def CB2_1_5I1R1Value (a : Fin 6) : ℝ := residualLaw (below (shape 2 1 5)) (fun u => (stageBLaw (shape 2 1 5) u : ℝ)) (stageBPriority (shape 2 1 5)) 1 (fun u a => (littleLaw (shape 2 1 5) u ((stageBPriority (shape 2 1 5)) 1) a : ℝ)) 1 a +def CB2_1_5I1R1Raw (a : Fin 6) : Ball := residualBall (below (shape 2 1 5)) B2_1_5Law (stageBPriority (shape 2 1 5)) 1 (fun u => B2_1_5Little u ((stageBPriority (shape 2 1 5)) 1)) 1 a +lemma CB2_1_5I1R1Raw_sound (a : Fin 6) : + (CB2_1_5I1R1Raw a).Encloses (CB2_1_5I1R1Value a) := by + exact residualBall_sound_on (below (shape 2 1 5)) B2_1_5Law (fun u => (stageBLaw (shape 2 1 5) u : ℝ)) (stageBPriority (shape 2 1 5)) 1 (fun u => B2_1_5Little u ((stageBPriority (shape 2 1 5)) 1)) (fun u a => (littleLaw (shape 2 1 5) u ((stageBPriority (shape 2 1 5)) 1) a : ℝ)) (fun u _ => B2_1_5Law_sound u) (fun u _ a => B2_1_5Little_sound u ((stageBPriority (shape 2 1 5)) 1) a) 1 a +def CB2_1_5I1R1Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(7920096003363024098980124774863 / 12500000000000000000000000000000), (1 / 3125000000000000000000000000000)⟩ ⟨(7228280637521402636754794374159 / 25000000000000000000000000000000), (2683432909 / 10000000000000000000000000000000)⟩ ⟨(-9126506338372838613585647245343 / 20000000000000000000000000000000), (5293955927 / 12500000000000000000000000000000)⟩ ⟨-1, 7920096003363024098980124774863, 6250000000000000000000000000000⟩] +lemma CB2_1_5I1R1Certificates_valid : + CB2_1_5I1R1Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB2_1_5I1R1CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | 1 => 1 + | _ => 0 +def CB2_1_5I1R1P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_1_5I1R1Certificates (CB2_1_5I1R1CertificateIndex a)).input +lemma CB2_1_5I1R1P_check : ∀ a : Fin 6, contains (CB2_1_5I1R1Raw a) (CB2_1_5I1R1P a) = true := by + decide +kernel +lemma CB2_1_5I1R1P_sound (a : Fin 6) : + (CB2_1_5I1R1P a).Encloses (CB2_1_5I1R1Value a) := + contains_sound (CB2_1_5I1R1Raw_sound a) (CB2_1_5I1R1P_check a) +def CB2_1_5I1R1Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_1_5I1R1Certificates (CB2_1_5I1R1CertificateIndex a)).output +lemma CB2_1_5I1R1Terms_sound (a : Fin 6) : + (CB2_1_5I1R1Terms a).Encloses (Foundation.entropyTerm (CB2_1_5I1R1Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB2_1_5I1R1Certificates_valid + (CB2_1_5I1R1CertificateIndex a) (CB2_1_5I1R1P_sound a) +def CB2_1_5I1R1Entropy : Ball := ⟨(7228280637521402636754794374159 / 25000000000000000000000000000000), (2683432909 / 10000000000000000000000000000000)⟩ +lemma CB2_1_5I1R1Entropy_sound : CB2_1_5I1R1Entropy.Encloses (Foundation.finiteEntropy CB2_1_5I1R1Value) := by + exact contains_sound (entropyFin_enclosed 6 CB2_1_5I1R1Value CB2_1_5I1R1Terms CB2_1_5I1R1Terms_sound) (by decide +kernel) +def CB2_1_5I1R1Mass : Ball := ⟨(7920096003363024098980124774863 / 12500000000000000000000000000000), (1 / 3125000000000000000000000000000)⟩ +lemma CB2_1_5I1R1Mass_sound : CB2_1_5I1R1Mass.Encloses (∑ a, CB2_1_5I1R1Value a) := by + exact contains_sound (finSumBall_sound 6 CB2_1_5I1R1P CB2_1_5I1R1Value CB2_1_5I1R1P_sound) (by decide +kernel) +def CB2_1_5I1R1MassTermLogWitness : LogWitness := ⟨-1, 7920096003363024098980124774863, 6250000000000000000000000000000⟩ +def CB2_1_5I1R1MassTermLog : Ball := ⟨(-9126506338372838613585647245343 / 20000000000000000000000000000000), (5293955927 / 12500000000000000000000000000000)⟩ +lemma CB2_1_5I1R1MassTermLog_sound : CB2_1_5I1R1MassTermLog.Encloses (Real.log ((∑ a, CB2_1_5I1R1Value a))) := by + exact checkLog_sound logTwoBall_sound (CB2_1_5I1R1Mass_sound) (w := CB2_1_5I1R1MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB2_1_5I1R1MassTerm : Ball := ⟨(7228280637521402636754794374159 / 25000000000000000000000000000000), (2683432909 / 10000000000000000000000000000000)⟩ +lemma CB2_1_5I1R1MassTerm_sound : CB2_1_5I1R1MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB2_1_5I1R1Value a))) := by + exact contains_sound (entropyTerm_ball (CB2_1_5I1R1Mass_sound) CB2_1_5I1R1MassTermLog_sound) (by decide +kernel) +def CB2_1_5I1R1H : Ball := ⟨0, (2683432909 / 5000000000000000000000000000000)⟩ +lemma CB2_1_5I1R1H_sound : CB2_1_5I1R1H.Encloses (homogeneousEntropy CB2_1_5I1R1Value) := by + exact contains_sound (homogeneous_enclosed CB2_1_5I1R1Value CB2_1_5I1R1MassTerm_sound CB2_1_5I1R1Entropy_sound) (by decide +kernel) +def CB2_1_5I1R2Value (a : Fin 6) : ℝ := residualLaw (below (shape 2 1 5)) (fun u => (stageBLaw (shape 2 1 5) u : ℝ)) (stageBPriority (shape 2 1 5)) 1 (fun u a => (littleLaw (shape 2 1 5) u ((stageBPriority (shape 2 1 5)) 1) a : ℝ)) 2 a +def CB2_1_5I1R2Raw (a : Fin 6) : Ball := residualBall (below (shape 2 1 5)) B2_1_5Law (stageBPriority (shape 2 1 5)) 1 (fun u => B2_1_5Little u ((stageBPriority (shape 2 1 5)) 1)) 2 a +lemma CB2_1_5I1R2Raw_sound (a : Fin 6) : + (CB2_1_5I1R2Raw a).Encloses (CB2_1_5I1R2Value a) := by + exact residualBall_sound_on (below (shape 2 1 5)) B2_1_5Law (fun u => (stageBLaw (shape 2 1 5) u : ℝ)) (stageBPriority (shape 2 1 5)) 1 (fun u => B2_1_5Little u ((stageBPriority (shape 2 1 5)) 1)) (fun u a => (littleLaw (shape 2 1 5) u ((stageBPriority (shape 2 1 5)) 1) a : ℝ)) (fun u _ => B2_1_5Law_sound u) (fun u _ a => B2_1_5Little_sound u ((stageBPriority (shape 2 1 5)) 1) a) 2 a +def CB2_1_5I1R2Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(8240786865581452095028265002887 / 50000000000000000000000000000000), (31 / 100000000000000000000000000000000)⟩ ⟨(1857192320517522245424112020319 / 6250000000000000000000000000000), (6980218031 / 50000000000000000000000000000000)⟩ ⟨(-90146358633508125450472038667133 / 50000000000000000000000000000000), (2117582373 / 2500000000000000000000000000000)⟩ ⟨-3, 8240786865581452095028265002887, 6250000000000000000000000000000⟩, + .log ⟨(919021127692499707011485447387 / 50000000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ ⟨(918209901412572959589478764257 / 12500000000000000000000000000000), (2724544131 / 100000000000000000000000000000000)⟩ ⟨(-79929383448934316117373233182213 / 20000000000000000000000000000000), (74115382999 / 50000000000000000000000000000000)⟩ ⟨-6, 919021127692499707011485447387, 781250000000000000000000000000⟩] +lemma CB2_1_5I1R2Certificates_valid : + CB2_1_5I1R2Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB2_1_5I1R2CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | 2 => 1 + | 3 => 2 + | _ => 0 +def CB2_1_5I1R2P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_1_5I1R2Certificates (CB2_1_5I1R2CertificateIndex a)).input +lemma CB2_1_5I1R2P_check : ∀ a : Fin 6, contains (CB2_1_5I1R2Raw a) (CB2_1_5I1R2P a) = true := by + decide +kernel +lemma CB2_1_5I1R2P_sound (a : Fin 6) : + (CB2_1_5I1R2P a).Encloses (CB2_1_5I1R2Value a) := + contains_sound (CB2_1_5I1R2Raw_sound a) (CB2_1_5I1R2P_check a) +def CB2_1_5I1R2Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_1_5I1R2Certificates (CB2_1_5I1R2CertificateIndex a)).output +lemma CB2_1_5I1R2Terms_sound (a : Fin 6) : + (CB2_1_5I1R2Terms a).Encloses (Foundation.entropyTerm (CB2_1_5I1R2Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB2_1_5I1R2Certificates_valid + (CB2_1_5I1R2CertificateIndex a) (CB2_1_5I1R2P_sound a) +def CB2_1_5I1R2Entropy : Ball := ⟨(926518908489523490087540560979 / 2500000000000000000000000000000), (16684980193 / 100000000000000000000000000000000)⟩ +lemma CB2_1_5I1R2Entropy_sound : CB2_1_5I1R2Entropy.Encloses (Foundation.finiteEntropy CB2_1_5I1R2Value) := by + exact contains_sound (entropyFin_enclosed 6 CB2_1_5I1R2Value CB2_1_5I1R2Terms CB2_1_5I1R2Terms_sound) (by decide +kernel) +def CB2_1_5I1R2Mass : Ball := ⟨(4579903996636975901019875225137 / 25000000000000000000000000000000), (7 / 20000000000000000000000000000000)⟩ +lemma CB2_1_5I1R2Mass_sound : CB2_1_5I1R2Mass.Encloses (∑ a, CB2_1_5I1R2Value a) := by + exact contains_sound (finSumBall_sound 6 CB2_1_5I1R2P CB2_1_5I1R2Value CB2_1_5I1R2P_sound) (by decide +kernel) +def CB2_1_5I1R2MassTermLogWitness : LogWitness := ⟨-3, 4579903996636975901019875225137, 3125000000000000000000000000000⟩ +def CB2_1_5I1R2MassTermLog : Ball := ⟨(-169719778839477575972721710038793 / 100000000000000000000000000000000), (42351647461 / 50000000000000000000000000000000)⟩ +lemma CB2_1_5I1R2MassTermLog_sound : CB2_1_5I1R2MassTermLog.Encloses (Real.log ((∑ a, CB2_1_5I1R2Value a))) := by + exact checkLog_sound logTwoBall_sound (CB2_1_5I1R2Mass_sound) (w := CB2_1_5I1R2MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB2_1_5I1R2MassTerm : Ball := ⟨(31092011736610680071881277157671 / 100000000000000000000000000000000), (7758659209 / 50000000000000000000000000000000)⟩ +lemma CB2_1_5I1R2MassTerm_sound : CB2_1_5I1R2MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB2_1_5I1R2Value a))) := by + exact contains_sound (entropyTerm_ball (CB2_1_5I1R2Mass_sound) CB2_1_5I1R2MassTermLog_sound) (by decide +kernel) +def CB2_1_5I1R2H : Ball := ⟨(5968744602970259531620345281489 / 100000000000000000000000000000000), (32202298611 / 100000000000000000000000000000000)⟩ +lemma CB2_1_5I1R2H_sound : CB2_1_5I1R2H.Encloses (homogeneousEntropy CB2_1_5I1R2Value) := by + exact contains_sound (homogeneous_enclosed CB2_1_5I1R2Value CB2_1_5I1R2MassTerm_sound CB2_1_5I1R2Entropy_sound) (by decide +kernel) +def CB2_1_5I1R3Value (a : Fin 6) : ℝ := residualLaw (below (shape 2 1 5)) (fun u => (stageBLaw (shape 2 1 5) u : ℝ)) (stageBPriority (shape 2 1 5)) 1 (fun u a => (littleLaw (shape 2 1 5) u ((stageBPriority (shape 2 1 5)) 1) a : ℝ)) 3 a +def CB2_1_5I1R3Raw (a : Fin 6) : Ball := residualBall (below (shape 2 1 5)) B2_1_5Law (stageBPriority (shape 2 1 5)) 1 (fun u => B2_1_5Little u ((stageBPriority (shape 2 1 5)) 1)) 3 a +lemma CB2_1_5I1R3Raw_sound (a : Fin 6) : + (CB2_1_5I1R3Raw a).Encloses (CB2_1_5I1R3Value a) := by + exact residualBall_sound_on (below (shape 2 1 5)) B2_1_5Law (fun u => (stageBLaw (shape 2 1 5) u : ℝ)) (stageBPriority (shape 2 1 5)) 1 (fun u => B2_1_5Little u ((stageBPriority (shape 2 1 5)) 1)) (fun u a => (littleLaw (shape 2 1 5) u ((stageBPriority (shape 2 1 5)) 1) a : ℝ)) (fun u _ => B2_1_5Law_sound u) (fun u _ a => B2_1_5Little_sound u ((stageBPriority (shape 2 1 5)) 1) a) 3 a +def CB2_1_5I1R3Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB2_1_5I1R3Certificates_valid : + CB2_1_5I1R3Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB2_1_5I1R3CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB2_1_5I1R3P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_1_5I1R3Certificates (CB2_1_5I1R3CertificateIndex a)).input +lemma CB2_1_5I1R3P_check : ∀ a : Fin 6, contains (CB2_1_5I1R3Raw a) (CB2_1_5I1R3P a) = true := by + decide +kernel +lemma CB2_1_5I1R3P_sound (a : Fin 6) : + (CB2_1_5I1R3P a).Encloses (CB2_1_5I1R3Value a) := + contains_sound (CB2_1_5I1R3Raw_sound a) (CB2_1_5I1R3P_check a) +def CB2_1_5I1R3Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_1_5I1R3Certificates (CB2_1_5I1R3CertificateIndex a)).output +lemma CB2_1_5I1R3Terms_sound (a : Fin 6) : + (CB2_1_5I1R3Terms a).Encloses (Foundation.entropyTerm (CB2_1_5I1R3Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB2_1_5I1R3Certificates_valid + (CB2_1_5I1R3CertificateIndex a) (CB2_1_5I1R3P_sound a) +def CB2_1_5I1R3Entropy : Ball := ⟨0, 0⟩ +lemma CB2_1_5I1R3Entropy_sound : CB2_1_5I1R3Entropy.Encloses (Foundation.finiteEntropy CB2_1_5I1R3Value) := by + exact contains_sound (entropyFin_enclosed 6 CB2_1_5I1R3Value CB2_1_5I1R3Terms CB2_1_5I1R3Terms_sound) (by decide +kernel) +def CB2_1_5I1R3Mass : Ball := ⟨0, 0⟩ +lemma CB2_1_5I1R3Mass_sound : CB2_1_5I1R3Mass.Encloses (∑ a, CB2_1_5I1R3Value a) := by + exact contains_sound (finSumBall_sound 6 CB2_1_5I1R3P CB2_1_5I1R3Value CB2_1_5I1R3P_sound) (by decide +kernel) +def CB2_1_5I1R3MassTerm : Ball := .exact 0 +lemma CB2_1_5I1R3MassTerm_sound : CB2_1_5I1R3MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB2_1_5I1R3Value a))) := + entropyTerm_zero_ball (CB2_1_5I1R3Mass_sound) +def CB2_1_5I1R3H : Ball := ⟨0, 0⟩ +lemma CB2_1_5I1R3H_sound : CB2_1_5I1R3H.Encloses (homogeneousEntropy CB2_1_5I1R3Value) := by + exact contains_sound (homogeneous_enclosed CB2_1_5I1R3Value CB2_1_5I1R3MassTerm_sound CB2_1_5I1R3Entropy_sound) (by decide +kernel) +def CB2_1_5I1R4Value (a : Fin 6) : ℝ := residualLaw (below (shape 2 1 5)) (fun u => (stageBLaw (shape 2 1 5) u : ℝ)) (stageBPriority (shape 2 1 5)) 1 (fun u a => (littleLaw (shape 2 1 5) u ((stageBPriority (shape 2 1 5)) 1) a : ℝ)) 4 a +def CB2_1_5I1R4Raw (a : Fin 6) : Ball := residualBall (below (shape 2 1 5)) B2_1_5Law (stageBPriority (shape 2 1 5)) 1 (fun u => B2_1_5Little u ((stageBPriority (shape 2 1 5)) 1)) 4 a +lemma CB2_1_5I1R4Raw_sound (a : Fin 6) : + (CB2_1_5I1R4Raw a).Encloses (CB2_1_5I1R4Value a) := by + exact residualBall_sound_on (below (shape 2 1 5)) B2_1_5Law (fun u => (stageBLaw (shape 2 1 5) u : ℝ)) (stageBPriority (shape 2 1 5)) 1 (fun u => B2_1_5Little u ((stageBPriority (shape 2 1 5)) 1)) (fun u a => (littleLaw (shape 2 1 5) u ((stageBPriority (shape 2 1 5)) 1) a : ℝ)) (fun u _ => B2_1_5Law_sound u) (fun u _ a => B2_1_5Little_sound u ((stageBPriority (shape 2 1 5)) 1) a) 4 a +def CB2_1_5I1R4Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB2_1_5I1R4Certificates_valid : + CB2_1_5I1R4Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB2_1_5I1R4CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB2_1_5I1R4P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_1_5I1R4Certificates (CB2_1_5I1R4CertificateIndex a)).input +lemma CB2_1_5I1R4P_check : ∀ a : Fin 6, contains (CB2_1_5I1R4Raw a) (CB2_1_5I1R4P a) = true := by + decide +kernel +lemma CB2_1_5I1R4P_sound (a : Fin 6) : + (CB2_1_5I1R4P a).Encloses (CB2_1_5I1R4Value a) := + contains_sound (CB2_1_5I1R4Raw_sound a) (CB2_1_5I1R4P_check a) +def CB2_1_5I1R4Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_1_5I1R4Certificates (CB2_1_5I1R4CertificateIndex a)).output +lemma CB2_1_5I1R4Terms_sound (a : Fin 6) : + (CB2_1_5I1R4Terms a).Encloses (Foundation.entropyTerm (CB2_1_5I1R4Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB2_1_5I1R4Certificates_valid + (CB2_1_5I1R4CertificateIndex a) (CB2_1_5I1R4P_sound a) +def CB2_1_5I1R4Entropy : Ball := ⟨0, 0⟩ +lemma CB2_1_5I1R4Entropy_sound : CB2_1_5I1R4Entropy.Encloses (Foundation.finiteEntropy CB2_1_5I1R4Value) := by + exact contains_sound (entropyFin_enclosed 6 CB2_1_5I1R4Value CB2_1_5I1R4Terms CB2_1_5I1R4Terms_sound) (by decide +kernel) +def CB2_1_5I1R4Mass : Ball := ⟨0, 0⟩ +lemma CB2_1_5I1R4Mass_sound : CB2_1_5I1R4Mass.Encloses (∑ a, CB2_1_5I1R4Value a) := by + exact contains_sound (finSumBall_sound 6 CB2_1_5I1R4P CB2_1_5I1R4Value CB2_1_5I1R4P_sound) (by decide +kernel) +def CB2_1_5I1R4MassTerm : Ball := .exact 0 +lemma CB2_1_5I1R4MassTerm_sound : CB2_1_5I1R4MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB2_1_5I1R4Value a))) := + entropyTerm_zero_ball (CB2_1_5I1R4Mass_sound) +def CB2_1_5I1R4H : Ball := ⟨0, 0⟩ +lemma CB2_1_5I1R4H_sound : CB2_1_5I1R4H.Encloses (homogeneousEntropy CB2_1_5I1R4Value) := by + exact contains_sound (homogeneous_enclosed CB2_1_5I1R4Value CB2_1_5I1R4MassTerm_sound CB2_1_5I1R4Entropy_sound) (by decide +kernel) +def CB2_1_5I1R5Value (a : Fin 6) : ℝ := residualLaw (below (shape 2 1 5)) (fun u => (stageBLaw (shape 2 1 5) u : ℝ)) (stageBPriority (shape 2 1 5)) 1 (fun u a => (littleLaw (shape 2 1 5) u ((stageBPriority (shape 2 1 5)) 1) a : ℝ)) 5 a +def CB2_1_5I1R5Raw (a : Fin 6) : Ball := residualBall (below (shape 2 1 5)) B2_1_5Law (stageBPriority (shape 2 1 5)) 1 (fun u => B2_1_5Little u ((stageBPriority (shape 2 1 5)) 1)) 5 a +lemma CB2_1_5I1R5Raw_sound (a : Fin 6) : + (CB2_1_5I1R5Raw a).Encloses (CB2_1_5I1R5Value a) := by + exact residualBall_sound_on (below (shape 2 1 5)) B2_1_5Law (fun u => (stageBLaw (shape 2 1 5) u : ℝ)) (stageBPriority (shape 2 1 5)) 1 (fun u => B2_1_5Little u ((stageBPriority (shape 2 1 5)) 1)) (fun u a => (littleLaw (shape 2 1 5) u ((stageBPriority (shape 2 1 5)) 1) a : ℝ)) (fun u _ => B2_1_5Law_sound u) (fun u _ a => B2_1_5Little_sound u ((stageBPriority (shape 2 1 5)) 1) a) 5 a +def CB2_1_5I1R5Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB2_1_5I1R5Certificates_valid : + CB2_1_5I1R5Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB2_1_5I1R5CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB2_1_5I1R5P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_1_5I1R5Certificates (CB2_1_5I1R5CertificateIndex a)).input +lemma CB2_1_5I1R5P_check : ∀ a : Fin 6, contains (CB2_1_5I1R5Raw a) (CB2_1_5I1R5P a) = true := by + decide +kernel +lemma CB2_1_5I1R5P_sound (a : Fin 6) : + (CB2_1_5I1R5P a).Encloses (CB2_1_5I1R5Value a) := + contains_sound (CB2_1_5I1R5Raw_sound a) (CB2_1_5I1R5P_check a) +def CB2_1_5I1R5Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_1_5I1R5Certificates (CB2_1_5I1R5CertificateIndex a)).output +lemma CB2_1_5I1R5Terms_sound (a : Fin 6) : + (CB2_1_5I1R5Terms a).Encloses (Foundation.entropyTerm (CB2_1_5I1R5Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB2_1_5I1R5Certificates_valid + (CB2_1_5I1R5CertificateIndex a) (CB2_1_5I1R5P_sound a) +def CB2_1_5I1R5Entropy : Ball := ⟨0, 0⟩ +lemma CB2_1_5I1R5Entropy_sound : CB2_1_5I1R5Entropy.Encloses (Foundation.finiteEntropy CB2_1_5I1R5Value) := by + exact contains_sound (entropyFin_enclosed 6 CB2_1_5I1R5Value CB2_1_5I1R5Terms CB2_1_5I1R5Terms_sound) (by decide +kernel) +def CB2_1_5I1R5Mass : Ball := ⟨0, 0⟩ +lemma CB2_1_5I1R5Mass_sound : CB2_1_5I1R5Mass.Encloses (∑ a, CB2_1_5I1R5Value a) := by + exact contains_sound (finSumBall_sound 6 CB2_1_5I1R5P CB2_1_5I1R5Value CB2_1_5I1R5P_sound) (by decide +kernel) +def CB2_1_5I1R5MassTerm : Ball := .exact 0 +lemma CB2_1_5I1R5MassTerm_sound : CB2_1_5I1R5MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB2_1_5I1R5Value a))) := + entropyTerm_zero_ball (CB2_1_5I1R5Mass_sound) +def CB2_1_5I1R5H : Ball := ⟨0, 0⟩ +lemma CB2_1_5I1R5H_sound : CB2_1_5I1R5H.Encloses (homogeneousEntropy CB2_1_5I1R5Value) := by + exact contains_sound (homogeneous_enclosed CB2_1_5I1R5Value CB2_1_5I1R5MassTerm_sound CB2_1_5I1R5Entropy_sound) (by decide +kernel) +def CB2_1_5I1R6Value (a : Fin 6) : ℝ := residualLaw (below (shape 2 1 5)) (fun u => (stageBLaw (shape 2 1 5) u : ℝ)) (stageBPriority (shape 2 1 5)) 1 (fun u a => (littleLaw (shape 2 1 5) u ((stageBPriority (shape 2 1 5)) 1) a : ℝ)) 6 a +def CB2_1_5I1R6Raw (a : Fin 6) : Ball := residualBall (below (shape 2 1 5)) B2_1_5Law (stageBPriority (shape 2 1 5)) 1 (fun u => B2_1_5Little u ((stageBPriority (shape 2 1 5)) 1)) 6 a +lemma CB2_1_5I1R6Raw_sound (a : Fin 6) : + (CB2_1_5I1R6Raw a).Encloses (CB2_1_5I1R6Value a) := by + exact residualBall_sound_on (below (shape 2 1 5)) B2_1_5Law (fun u => (stageBLaw (shape 2 1 5) u : ℝ)) (stageBPriority (shape 2 1 5)) 1 (fun u => B2_1_5Little u ((stageBPriority (shape 2 1 5)) 1)) (fun u a => (littleLaw (shape 2 1 5) u ((stageBPriority (shape 2 1 5)) 1) a : ℝ)) (fun u _ => B2_1_5Law_sound u) (fun u _ a => B2_1_5Little_sound u ((stageBPriority (shape 2 1 5)) 1) a) 6 a +def CB2_1_5I1R6Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB2_1_5I1R6Certificates_valid : + CB2_1_5I1R6Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB2_1_5I1R6CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB2_1_5I1R6P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_1_5I1R6Certificates (CB2_1_5I1R6CertificateIndex a)).input +lemma CB2_1_5I1R6P_check : ∀ a : Fin 6, contains (CB2_1_5I1R6Raw a) (CB2_1_5I1R6P a) = true := by + decide +kernel +lemma CB2_1_5I1R6P_sound (a : Fin 6) : + (CB2_1_5I1R6P a).Encloses (CB2_1_5I1R6Value a) := + contains_sound (CB2_1_5I1R6Raw_sound a) (CB2_1_5I1R6P_check a) +def CB2_1_5I1R6Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_1_5I1R6Certificates (CB2_1_5I1R6CertificateIndex a)).output +lemma CB2_1_5I1R6Terms_sound (a : Fin 6) : + (CB2_1_5I1R6Terms a).Encloses (Foundation.entropyTerm (CB2_1_5I1R6Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB2_1_5I1R6Certificates_valid + (CB2_1_5I1R6CertificateIndex a) (CB2_1_5I1R6P_sound a) +def CB2_1_5I1R6Entropy : Ball := ⟨0, 0⟩ +lemma CB2_1_5I1R6Entropy_sound : CB2_1_5I1R6Entropy.Encloses (Foundation.finiteEntropy CB2_1_5I1R6Value) := by + exact contains_sound (entropyFin_enclosed 6 CB2_1_5I1R6Value CB2_1_5I1R6Terms CB2_1_5I1R6Terms_sound) (by decide +kernel) +def CB2_1_5I1R6Mass : Ball := ⟨0, 0⟩ +lemma CB2_1_5I1R6Mass_sound : CB2_1_5I1R6Mass.Encloses (∑ a, CB2_1_5I1R6Value a) := by + exact contains_sound (finSumBall_sound 6 CB2_1_5I1R6P CB2_1_5I1R6Value CB2_1_5I1R6P_sound) (by decide +kernel) +def CB2_1_5I1R6MassTerm : Ball := .exact 0 +lemma CB2_1_5I1R6MassTerm_sound : CB2_1_5I1R6MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB2_1_5I1R6Value a))) := + entropyTerm_zero_ball (CB2_1_5I1R6Mass_sound) +def CB2_1_5I1R6H : Ball := ⟨0, 0⟩ +lemma CB2_1_5I1R6H_sound : CB2_1_5I1R6H.Encloses (homogeneousEntropy CB2_1_5I1R6Value) := by + exact contains_sound (homogeneous_enclosed CB2_1_5I1R6Value CB2_1_5I1R6MassTerm_sound CB2_1_5I1R6Entropy_sound) (by decide +kernel) +def CB2_1_5I1R7Value (a : Fin 6) : ℝ := residualLaw (below (shape 2 1 5)) (fun u => (stageBLaw (shape 2 1 5) u : ℝ)) (stageBPriority (shape 2 1 5)) 1 (fun u a => (littleLaw (shape 2 1 5) u ((stageBPriority (shape 2 1 5)) 1) a : ℝ)) 7 a +def CB2_1_5I1R7Raw (a : Fin 6) : Ball := residualBall (below (shape 2 1 5)) B2_1_5Law (stageBPriority (shape 2 1 5)) 1 (fun u => B2_1_5Little u ((stageBPriority (shape 2 1 5)) 1)) 7 a +lemma CB2_1_5I1R7Raw_sound (a : Fin 6) : + (CB2_1_5I1R7Raw a).Encloses (CB2_1_5I1R7Value a) := by + exact residualBall_sound_on (below (shape 2 1 5)) B2_1_5Law (fun u => (stageBLaw (shape 2 1 5) u : ℝ)) (stageBPriority (shape 2 1 5)) 1 (fun u => B2_1_5Little u ((stageBPriority (shape 2 1 5)) 1)) (fun u a => (littleLaw (shape 2 1 5) u ((stageBPriority (shape 2 1 5)) 1) a : ℝ)) (fun u _ => B2_1_5Law_sound u) (fun u _ a => B2_1_5Little_sound u ((stageBPriority (shape 2 1 5)) 1) a) 7 a +def CB2_1_5I1R7Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB2_1_5I1R7Certificates_valid : + CB2_1_5I1R7Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB2_1_5I1R7CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB2_1_5I1R7P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_1_5I1R7Certificates (CB2_1_5I1R7CertificateIndex a)).input +lemma CB2_1_5I1R7P_check : ∀ a : Fin 6, contains (CB2_1_5I1R7Raw a) (CB2_1_5I1R7P a) = true := by + decide +kernel +lemma CB2_1_5I1R7P_sound (a : Fin 6) : + (CB2_1_5I1R7P a).Encloses (CB2_1_5I1R7Value a) := + contains_sound (CB2_1_5I1R7Raw_sound a) (CB2_1_5I1R7P_check a) +def CB2_1_5I1R7Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_1_5I1R7Certificates (CB2_1_5I1R7CertificateIndex a)).output +lemma CB2_1_5I1R7Terms_sound (a : Fin 6) : + (CB2_1_5I1R7Terms a).Encloses (Foundation.entropyTerm (CB2_1_5I1R7Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB2_1_5I1R7Certificates_valid + (CB2_1_5I1R7CertificateIndex a) (CB2_1_5I1R7P_sound a) +def CB2_1_5I1R7Entropy : Ball := ⟨0, 0⟩ +lemma CB2_1_5I1R7Entropy_sound : CB2_1_5I1R7Entropy.Encloses (Foundation.finiteEntropy CB2_1_5I1R7Value) := by + exact contains_sound (entropyFin_enclosed 6 CB2_1_5I1R7Value CB2_1_5I1R7Terms CB2_1_5I1R7Terms_sound) (by decide +kernel) +def CB2_1_5I1R7Mass : Ball := ⟨0, 0⟩ +lemma CB2_1_5I1R7Mass_sound : CB2_1_5I1R7Mass.Encloses (∑ a, CB2_1_5I1R7Value a) := by + exact contains_sound (finSumBall_sound 6 CB2_1_5I1R7P CB2_1_5I1R7Value CB2_1_5I1R7P_sound) (by decide +kernel) +def CB2_1_5I1R7MassTerm : Ball := .exact 0 +lemma CB2_1_5I1R7MassTerm_sound : CB2_1_5I1R7MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB2_1_5I1R7Value a))) := + entropyTerm_zero_ball (CB2_1_5I1R7Mass_sound) +def CB2_1_5I1R7H : Ball := ⟨0, 0⟩ +lemma CB2_1_5I1R7H_sound : CB2_1_5I1R7H.Encloses (homogeneousEntropy CB2_1_5I1R7Value) := by + exact contains_sound (homogeneous_enclosed CB2_1_5I1R7Value CB2_1_5I1R7MassTerm_sound CB2_1_5I1R7Entropy_sound) (by decide +kernel) +def CB2_1_5I1R8Value (a : Fin 6) : ℝ := residualLaw (below (shape 2 1 5)) (fun u => (stageBLaw (shape 2 1 5) u : ℝ)) (stageBPriority (shape 2 1 5)) 1 (fun u a => (littleLaw (shape 2 1 5) u ((stageBPriority (shape 2 1 5)) 1) a : ℝ)) 8 a +def CB2_1_5I1R8Raw (a : Fin 6) : Ball := residualBall (below (shape 2 1 5)) B2_1_5Law (stageBPriority (shape 2 1 5)) 1 (fun u => B2_1_5Little u ((stageBPriority (shape 2 1 5)) 1)) 8 a +lemma CB2_1_5I1R8Raw_sound (a : Fin 6) : + (CB2_1_5I1R8Raw a).Encloses (CB2_1_5I1R8Value a) := by + exact residualBall_sound_on (below (shape 2 1 5)) B2_1_5Law (fun u => (stageBLaw (shape 2 1 5) u : ℝ)) (stageBPriority (shape 2 1 5)) 1 (fun u => B2_1_5Little u ((stageBPriority (shape 2 1 5)) 1)) (fun u a => (littleLaw (shape 2 1 5) u ((stageBPriority (shape 2 1 5)) 1) a : ℝ)) (fun u _ => B2_1_5Law_sound u) (fun u _ a => B2_1_5Little_sound u ((stageBPriority (shape 2 1 5)) 1) a) 8 a +def CB2_1_5I1R8Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB2_1_5I1R8Certificates_valid : + CB2_1_5I1R8Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB2_1_5I1R8CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB2_1_5I1R8P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_1_5I1R8Certificates (CB2_1_5I1R8CertificateIndex a)).input +lemma CB2_1_5I1R8P_check : ∀ a : Fin 6, contains (CB2_1_5I1R8Raw a) (CB2_1_5I1R8P a) = true := by + decide +kernel +lemma CB2_1_5I1R8P_sound (a : Fin 6) : + (CB2_1_5I1R8P a).Encloses (CB2_1_5I1R8Value a) := + contains_sound (CB2_1_5I1R8Raw_sound a) (CB2_1_5I1R8P_check a) +def CB2_1_5I1R8Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_1_5I1R8Certificates (CB2_1_5I1R8CertificateIndex a)).output +lemma CB2_1_5I1R8Terms_sound (a : Fin 6) : + (CB2_1_5I1R8Terms a).Encloses (Foundation.entropyTerm (CB2_1_5I1R8Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB2_1_5I1R8Certificates_valid + (CB2_1_5I1R8CertificateIndex a) (CB2_1_5I1R8P_sound a) +def CB2_1_5I1R8Entropy : Ball := ⟨0, 0⟩ +lemma CB2_1_5I1R8Entropy_sound : CB2_1_5I1R8Entropy.Encloses (Foundation.finiteEntropy CB2_1_5I1R8Value) := by + exact contains_sound (entropyFin_enclosed 6 CB2_1_5I1R8Value CB2_1_5I1R8Terms CB2_1_5I1R8Terms_sound) (by decide +kernel) +def CB2_1_5I1R8Mass : Ball := ⟨0, 0⟩ +lemma CB2_1_5I1R8Mass_sound : CB2_1_5I1R8Mass.Encloses (∑ a, CB2_1_5I1R8Value a) := by + exact contains_sound (finSumBall_sound 6 CB2_1_5I1R8P CB2_1_5I1R8Value CB2_1_5I1R8P_sound) (by decide +kernel) +def CB2_1_5I1R8MassTerm : Ball := .exact 0 +lemma CB2_1_5I1R8MassTerm_sound : CB2_1_5I1R8MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB2_1_5I1R8Value a))) := + entropyTerm_zero_ball (CB2_1_5I1R8Mass_sound) +def CB2_1_5I1R8H : Ball := ⟨0, 0⟩ +lemma CB2_1_5I1R8H_sound : CB2_1_5I1R8H.Encloses (homogeneousEntropy CB2_1_5I1R8Value) := by + exact contains_sound (homogeneous_enclosed CB2_1_5I1R8Value CB2_1_5I1R8MassTerm_sound CB2_1_5I1R8Entropy_sound) (by decide +kernel) +def CB2_1_5I1R9Value (a : Fin 6) : ℝ := residualLaw (below (shape 2 1 5)) (fun u => (stageBLaw (shape 2 1 5) u : ℝ)) (stageBPriority (shape 2 1 5)) 1 (fun u a => (littleLaw (shape 2 1 5) u ((stageBPriority (shape 2 1 5)) 1) a : ℝ)) 9 a +def CB2_1_5I1R9Raw (a : Fin 6) : Ball := residualBall (below (shape 2 1 5)) B2_1_5Law (stageBPriority (shape 2 1 5)) 1 (fun u => B2_1_5Little u ((stageBPriority (shape 2 1 5)) 1)) 9 a +lemma CB2_1_5I1R9Raw_sound (a : Fin 6) : + (CB2_1_5I1R9Raw a).Encloses (CB2_1_5I1R9Value a) := by + exact residualBall_sound_on (below (shape 2 1 5)) B2_1_5Law (fun u => (stageBLaw (shape 2 1 5) u : ℝ)) (stageBPriority (shape 2 1 5)) 1 (fun u => B2_1_5Little u ((stageBPriority (shape 2 1 5)) 1)) (fun u a => (littleLaw (shape 2 1 5) u ((stageBPriority (shape 2 1 5)) 1) a : ℝ)) (fun u _ => B2_1_5Law_sound u) (fun u _ a => B2_1_5Little_sound u ((stageBPriority (shape 2 1 5)) 1) a) 9 a +def CB2_1_5I1R9Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB2_1_5I1R9Certificates_valid : + CB2_1_5I1R9Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB2_1_5I1R9CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB2_1_5I1R9P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_1_5I1R9Certificates (CB2_1_5I1R9CertificateIndex a)).input +lemma CB2_1_5I1R9P_check : ∀ a : Fin 6, contains (CB2_1_5I1R9Raw a) (CB2_1_5I1R9P a) = true := by + decide +kernel +lemma CB2_1_5I1R9P_sound (a : Fin 6) : + (CB2_1_5I1R9P a).Encloses (CB2_1_5I1R9Value a) := + contains_sound (CB2_1_5I1R9Raw_sound a) (CB2_1_5I1R9P_check a) +def CB2_1_5I1R9Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_1_5I1R9Certificates (CB2_1_5I1R9CertificateIndex a)).output +lemma CB2_1_5I1R9Terms_sound (a : Fin 6) : + (CB2_1_5I1R9Terms a).Encloses (Foundation.entropyTerm (CB2_1_5I1R9Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB2_1_5I1R9Certificates_valid + (CB2_1_5I1R9CertificateIndex a) (CB2_1_5I1R9P_sound a) +def CB2_1_5I1R9Entropy : Ball := ⟨0, 0⟩ +lemma CB2_1_5I1R9Entropy_sound : CB2_1_5I1R9Entropy.Encloses (Foundation.finiteEntropy CB2_1_5I1R9Value) := by + exact contains_sound (entropyFin_enclosed 6 CB2_1_5I1R9Value CB2_1_5I1R9Terms CB2_1_5I1R9Terms_sound) (by decide +kernel) +def CB2_1_5I1R9Mass : Ball := ⟨0, 0⟩ +lemma CB2_1_5I1R9Mass_sound : CB2_1_5I1R9Mass.Encloses (∑ a, CB2_1_5I1R9Value a) := by + exact contains_sound (finSumBall_sound 6 CB2_1_5I1R9P CB2_1_5I1R9Value CB2_1_5I1R9P_sound) (by decide +kernel) +def CB2_1_5I1R9MassTerm : Ball := .exact 0 +lemma CB2_1_5I1R9MassTerm_sound : CB2_1_5I1R9MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB2_1_5I1R9Value a))) := + entropyTerm_zero_ball (CB2_1_5I1R9Mass_sound) +def CB2_1_5I1R9H : Ball := ⟨0, 0⟩ +lemma CB2_1_5I1R9H_sound : CB2_1_5I1R9H.Encloses (homogeneousEntropy CB2_1_5I1R9Value) := by + exact contains_sound (homogeneous_enclosed CB2_1_5I1R9Value CB2_1_5I1R9MassTerm_sound CB2_1_5I1R9Entropy_sound) (by decide +kernel) +def CB2_1_5I1R10Value (a : Fin 6) : ℝ := residualLaw (below (shape 2 1 5)) (fun u => (stageBLaw (shape 2 1 5) u : ℝ)) (stageBPriority (shape 2 1 5)) 1 (fun u a => (littleLaw (shape 2 1 5) u ((stageBPriority (shape 2 1 5)) 1) a : ℝ)) 10 a +def CB2_1_5I1R10Raw (a : Fin 6) : Ball := residualBall (below (shape 2 1 5)) B2_1_5Law (stageBPriority (shape 2 1 5)) 1 (fun u => B2_1_5Little u ((stageBPriority (shape 2 1 5)) 1)) 10 a +lemma CB2_1_5I1R10Raw_sound (a : Fin 6) : + (CB2_1_5I1R10Raw a).Encloses (CB2_1_5I1R10Value a) := by + exact residualBall_sound_on (below (shape 2 1 5)) B2_1_5Law (fun u => (stageBLaw (shape 2 1 5) u : ℝ)) (stageBPriority (shape 2 1 5)) 1 (fun u => B2_1_5Little u ((stageBPriority (shape 2 1 5)) 1)) (fun u a => (littleLaw (shape 2 1 5) u ((stageBPriority (shape 2 1 5)) 1) a : ℝ)) (fun u _ => B2_1_5Law_sound u) (fun u _ a => B2_1_5Little_sound u ((stageBPriority (shape 2 1 5)) 1) a) 10 a +def CB2_1_5I1R10Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB2_1_5I1R10Certificates_valid : + CB2_1_5I1R10Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB2_1_5I1R10CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB2_1_5I1R10P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_1_5I1R10Certificates (CB2_1_5I1R10CertificateIndex a)).input +lemma CB2_1_5I1R10P_check : ∀ a : Fin 6, contains (CB2_1_5I1R10Raw a) (CB2_1_5I1R10P a) = true := by + decide +kernel +lemma CB2_1_5I1R10P_sound (a : Fin 6) : + (CB2_1_5I1R10P a).Encloses (CB2_1_5I1R10Value a) := + contains_sound (CB2_1_5I1R10Raw_sound a) (CB2_1_5I1R10P_check a) +def CB2_1_5I1R10Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_1_5I1R10Certificates (CB2_1_5I1R10CertificateIndex a)).output +lemma CB2_1_5I1R10Terms_sound (a : Fin 6) : + (CB2_1_5I1R10Terms a).Encloses (Foundation.entropyTerm (CB2_1_5I1R10Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB2_1_5I1R10Certificates_valid + (CB2_1_5I1R10CertificateIndex a) (CB2_1_5I1R10P_sound a) +def CB2_1_5I1R10Entropy : Ball := ⟨0, 0⟩ +lemma CB2_1_5I1R10Entropy_sound : CB2_1_5I1R10Entropy.Encloses (Foundation.finiteEntropy CB2_1_5I1R10Value) := by + exact contains_sound (entropyFin_enclosed 6 CB2_1_5I1R10Value CB2_1_5I1R10Terms CB2_1_5I1R10Terms_sound) (by decide +kernel) +def CB2_1_5I1R10Mass : Ball := ⟨0, 0⟩ +lemma CB2_1_5I1R10Mass_sound : CB2_1_5I1R10Mass.Encloses (∑ a, CB2_1_5I1R10Value a) := by + exact contains_sound (finSumBall_sound 6 CB2_1_5I1R10P CB2_1_5I1R10Value CB2_1_5I1R10P_sound) (by decide +kernel) +def CB2_1_5I1R10MassTerm : Ball := .exact 0 +lemma CB2_1_5I1R10MassTerm_sound : CB2_1_5I1R10MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB2_1_5I1R10Value a))) := + entropyTerm_zero_ball (CB2_1_5I1R10Mass_sound) +def CB2_1_5I1R10H : Ball := ⟨0, 0⟩ +lemma CB2_1_5I1R10H_sound : CB2_1_5I1R10H.Encloses (homogeneousEntropy CB2_1_5I1R10Value) := by + exact contains_sound (homogeneous_enclosed CB2_1_5I1R10Value CB2_1_5I1R10MassTerm_sound CB2_1_5I1R10Entropy_sound) (by decide +kernel) +def CB2_1_5I1R11Value (a : Fin 6) : ℝ := residualLaw (below (shape 2 1 5)) (fun u => (stageBLaw (shape 2 1 5) u : ℝ)) (stageBPriority (shape 2 1 5)) 1 (fun u a => (littleLaw (shape 2 1 5) u ((stageBPriority (shape 2 1 5)) 1) a : ℝ)) 11 a +def CB2_1_5I1R11Raw (a : Fin 6) : Ball := residualBall (below (shape 2 1 5)) B2_1_5Law (stageBPriority (shape 2 1 5)) 1 (fun u => B2_1_5Little u ((stageBPriority (shape 2 1 5)) 1)) 11 a +lemma CB2_1_5I1R11Raw_sound (a : Fin 6) : + (CB2_1_5I1R11Raw a).Encloses (CB2_1_5I1R11Value a) := by + exact residualBall_sound_on (below (shape 2 1 5)) B2_1_5Law (fun u => (stageBLaw (shape 2 1 5) u : ℝ)) (stageBPriority (shape 2 1 5)) 1 (fun u => B2_1_5Little u ((stageBPriority (shape 2 1 5)) 1)) (fun u a => (littleLaw (shape 2 1 5) u ((stageBPriority (shape 2 1 5)) 1) a : ℝ)) (fun u _ => B2_1_5Law_sound u) (fun u _ a => B2_1_5Little_sound u ((stageBPriority (shape 2 1 5)) 1) a) 11 a +def CB2_1_5I1R11Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB2_1_5I1R11Certificates_valid : + CB2_1_5I1R11Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB2_1_5I1R11CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB2_1_5I1R11P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_1_5I1R11Certificates (CB2_1_5I1R11CertificateIndex a)).input +lemma CB2_1_5I1R11P_check : ∀ a : Fin 6, contains (CB2_1_5I1R11Raw a) (CB2_1_5I1R11P a) = true := by + decide +kernel +lemma CB2_1_5I1R11P_sound (a : Fin 6) : + (CB2_1_5I1R11P a).Encloses (CB2_1_5I1R11Value a) := + contains_sound (CB2_1_5I1R11Raw_sound a) (CB2_1_5I1R11P_check a) +def CB2_1_5I1R11Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_1_5I1R11Certificates (CB2_1_5I1R11CertificateIndex a)).output +lemma CB2_1_5I1R11Terms_sound (a : Fin 6) : + (CB2_1_5I1R11Terms a).Encloses (Foundation.entropyTerm (CB2_1_5I1R11Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB2_1_5I1R11Certificates_valid + (CB2_1_5I1R11CertificateIndex a) (CB2_1_5I1R11P_sound a) +def CB2_1_5I1R11Entropy : Ball := ⟨0, 0⟩ +lemma CB2_1_5I1R11Entropy_sound : CB2_1_5I1R11Entropy.Encloses (Foundation.finiteEntropy CB2_1_5I1R11Value) := by + exact contains_sound (entropyFin_enclosed 6 CB2_1_5I1R11Value CB2_1_5I1R11Terms CB2_1_5I1R11Terms_sound) (by decide +kernel) +def CB2_1_5I1R11Mass : Ball := ⟨0, 0⟩ +lemma CB2_1_5I1R11Mass_sound : CB2_1_5I1R11Mass.Encloses (∑ a, CB2_1_5I1R11Value a) := by + exact contains_sound (finSumBall_sound 6 CB2_1_5I1R11P CB2_1_5I1R11Value CB2_1_5I1R11P_sound) (by decide +kernel) +def CB2_1_5I1R11MassTerm : Ball := .exact 0 +lemma CB2_1_5I1R11MassTerm_sound : CB2_1_5I1R11MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB2_1_5I1R11Value a))) := + entropyTerm_zero_ball (CB2_1_5I1R11Mass_sound) +def CB2_1_5I1R11H : Ball := ⟨0, 0⟩ +lemma CB2_1_5I1R11H_sound : CB2_1_5I1R11H.Encloses (homogeneousEntropy CB2_1_5I1R11Value) := by + exact contains_sound (homogeneous_enclosed CB2_1_5I1R11Value CB2_1_5I1R11MassTerm_sound CB2_1_5I1R11Entropy_sound) (by decide +kernel) +def CB2_1_5I1R12Value (a : Fin 6) : ℝ := residualLaw (below (shape 2 1 5)) (fun u => (stageBLaw (shape 2 1 5) u : ℝ)) (stageBPriority (shape 2 1 5)) 1 (fun u a => (littleLaw (shape 2 1 5) u ((stageBPriority (shape 2 1 5)) 1) a : ℝ)) 12 a +def CB2_1_5I1R12Raw (a : Fin 6) : Ball := residualBall (below (shape 2 1 5)) B2_1_5Law (stageBPriority (shape 2 1 5)) 1 (fun u => B2_1_5Little u ((stageBPriority (shape 2 1 5)) 1)) 12 a +lemma CB2_1_5I1R12Raw_sound (a : Fin 6) : + (CB2_1_5I1R12Raw a).Encloses (CB2_1_5I1R12Value a) := by + exact residualBall_sound_on (below (shape 2 1 5)) B2_1_5Law (fun u => (stageBLaw (shape 2 1 5) u : ℝ)) (stageBPriority (shape 2 1 5)) 1 (fun u => B2_1_5Little u ((stageBPriority (shape 2 1 5)) 1)) (fun u a => (littleLaw (shape 2 1 5) u ((stageBPriority (shape 2 1 5)) 1) a : ℝ)) (fun u _ => B2_1_5Law_sound u) (fun u _ a => B2_1_5Little_sound u ((stageBPriority (shape 2 1 5)) 1) a) 12 a +def CB2_1_5I1R12Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB2_1_5I1R12Certificates_valid : + CB2_1_5I1R12Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB2_1_5I1R12CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB2_1_5I1R12P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_1_5I1R12Certificates (CB2_1_5I1R12CertificateIndex a)).input +lemma CB2_1_5I1R12P_check : ∀ a : Fin 6, contains (CB2_1_5I1R12Raw a) (CB2_1_5I1R12P a) = true := by + decide +kernel +lemma CB2_1_5I1R12P_sound (a : Fin 6) : + (CB2_1_5I1R12P a).Encloses (CB2_1_5I1R12Value a) := + contains_sound (CB2_1_5I1R12Raw_sound a) (CB2_1_5I1R12P_check a) +def CB2_1_5I1R12Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_1_5I1R12Certificates (CB2_1_5I1R12CertificateIndex a)).output +lemma CB2_1_5I1R12Terms_sound (a : Fin 6) : + (CB2_1_5I1R12Terms a).Encloses (Foundation.entropyTerm (CB2_1_5I1R12Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB2_1_5I1R12Certificates_valid + (CB2_1_5I1R12CertificateIndex a) (CB2_1_5I1R12P_sound a) +def CB2_1_5I1R12Entropy : Ball := ⟨0, 0⟩ +lemma CB2_1_5I1R12Entropy_sound : CB2_1_5I1R12Entropy.Encloses (Foundation.finiteEntropy CB2_1_5I1R12Value) := by + exact contains_sound (entropyFin_enclosed 6 CB2_1_5I1R12Value CB2_1_5I1R12Terms CB2_1_5I1R12Terms_sound) (by decide +kernel) +def CB2_1_5I1R12Mass : Ball := ⟨0, 0⟩ +lemma CB2_1_5I1R12Mass_sound : CB2_1_5I1R12Mass.Encloses (∑ a, CB2_1_5I1R12Value a) := by + exact contains_sound (finSumBall_sound 6 CB2_1_5I1R12P CB2_1_5I1R12Value CB2_1_5I1R12P_sound) (by decide +kernel) +def CB2_1_5I1R12MassTerm : Ball := .exact 0 +lemma CB2_1_5I1R12MassTerm_sound : CB2_1_5I1R12MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB2_1_5I1R12Value a))) := + entropyTerm_zero_ball (CB2_1_5I1R12Mass_sound) +def CB2_1_5I1R12H : Ball := ⟨0, 0⟩ +lemma CB2_1_5I1R12H_sound : CB2_1_5I1R12H.Encloses (homogeneousEntropy CB2_1_5I1R12Value) := by + exact contains_sound (homogeneous_enclosed CB2_1_5I1R12Value CB2_1_5I1R12MassTerm_sound CB2_1_5I1R12Entropy_sound) (by decide +kernel) +def CB2_1_5I1R13Value (a : Fin 6) : ℝ := residualLaw (below (shape 2 1 5)) (fun u => (stageBLaw (shape 2 1 5) u : ℝ)) (stageBPriority (shape 2 1 5)) 1 (fun u a => (littleLaw (shape 2 1 5) u ((stageBPriority (shape 2 1 5)) 1) a : ℝ)) 13 a +def CB2_1_5I1R13Raw (a : Fin 6) : Ball := residualBall (below (shape 2 1 5)) B2_1_5Law (stageBPriority (shape 2 1 5)) 1 (fun u => B2_1_5Little u ((stageBPriority (shape 2 1 5)) 1)) 13 a +lemma CB2_1_5I1R13Raw_sound (a : Fin 6) : + (CB2_1_5I1R13Raw a).Encloses (CB2_1_5I1R13Value a) := by + exact residualBall_sound_on (below (shape 2 1 5)) B2_1_5Law (fun u => (stageBLaw (shape 2 1 5) u : ℝ)) (stageBPriority (shape 2 1 5)) 1 (fun u => B2_1_5Little u ((stageBPriority (shape 2 1 5)) 1)) (fun u a => (littleLaw (shape 2 1 5) u ((stageBPriority (shape 2 1 5)) 1) a : ℝ)) (fun u _ => B2_1_5Law_sound u) (fun u _ a => B2_1_5Little_sound u ((stageBPriority (shape 2 1 5)) 1) a) 13 a +def CB2_1_5I1R13Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB2_1_5I1R13Certificates_valid : + CB2_1_5I1R13Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB2_1_5I1R13CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB2_1_5I1R13P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_1_5I1R13Certificates (CB2_1_5I1R13CertificateIndex a)).input +lemma CB2_1_5I1R13P_check : ∀ a : Fin 6, contains (CB2_1_5I1R13Raw a) (CB2_1_5I1R13P a) = true := by + decide +kernel +lemma CB2_1_5I1R13P_sound (a : Fin 6) : + (CB2_1_5I1R13P a).Encloses (CB2_1_5I1R13Value a) := + contains_sound (CB2_1_5I1R13Raw_sound a) (CB2_1_5I1R13P_check a) +def CB2_1_5I1R13Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_1_5I1R13Certificates (CB2_1_5I1R13CertificateIndex a)).output +lemma CB2_1_5I1R13Terms_sound (a : Fin 6) : + (CB2_1_5I1R13Terms a).Encloses (Foundation.entropyTerm (CB2_1_5I1R13Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB2_1_5I1R13Certificates_valid + (CB2_1_5I1R13CertificateIndex a) (CB2_1_5I1R13P_sound a) +def CB2_1_5I1R13Entropy : Ball := ⟨0, 0⟩ +lemma CB2_1_5I1R13Entropy_sound : CB2_1_5I1R13Entropy.Encloses (Foundation.finiteEntropy CB2_1_5I1R13Value) := by + exact contains_sound (entropyFin_enclosed 6 CB2_1_5I1R13Value CB2_1_5I1R13Terms CB2_1_5I1R13Terms_sound) (by decide +kernel) +def CB2_1_5I1R13Mass : Ball := ⟨0, 0⟩ +lemma CB2_1_5I1R13Mass_sound : CB2_1_5I1R13Mass.Encloses (∑ a, CB2_1_5I1R13Value a) := by + exact contains_sound (finSumBall_sound 6 CB2_1_5I1R13P CB2_1_5I1R13Value CB2_1_5I1R13P_sound) (by decide +kernel) +def CB2_1_5I1R13MassTerm : Ball := .exact 0 +lemma CB2_1_5I1R13MassTerm_sound : CB2_1_5I1R13MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB2_1_5I1R13Value a))) := + entropyTerm_zero_ball (CB2_1_5I1R13Mass_sound) +def CB2_1_5I1R13H : Ball := ⟨0, 0⟩ +lemma CB2_1_5I1R13H_sound : CB2_1_5I1R13H.Encloses (homogeneousEntropy CB2_1_5I1R13Value) := by + exact contains_sound (homogeneous_enclosed CB2_1_5I1R13Value CB2_1_5I1R13MassTerm_sound CB2_1_5I1R13Entropy_sound) (by decide +kernel) +def CB2_1_5I1R14Value (a : Fin 6) : ℝ := residualLaw (below (shape 2 1 5)) (fun u => (stageBLaw (shape 2 1 5) u : ℝ)) (stageBPriority (shape 2 1 5)) 1 (fun u a => (littleLaw (shape 2 1 5) u ((stageBPriority (shape 2 1 5)) 1) a : ℝ)) 14 a +def CB2_1_5I1R14Raw (a : Fin 6) : Ball := residualBall (below (shape 2 1 5)) B2_1_5Law (stageBPriority (shape 2 1 5)) 1 (fun u => B2_1_5Little u ((stageBPriority (shape 2 1 5)) 1)) 14 a +lemma CB2_1_5I1R14Raw_sound (a : Fin 6) : + (CB2_1_5I1R14Raw a).Encloses (CB2_1_5I1R14Value a) := by + exact residualBall_sound_on (below (shape 2 1 5)) B2_1_5Law (fun u => (stageBLaw (shape 2 1 5) u : ℝ)) (stageBPriority (shape 2 1 5)) 1 (fun u => B2_1_5Little u ((stageBPriority (shape 2 1 5)) 1)) (fun u a => (littleLaw (shape 2 1 5) u ((stageBPriority (shape 2 1 5)) 1) a : ℝ)) (fun u _ => B2_1_5Law_sound u) (fun u _ a => B2_1_5Little_sound u ((stageBPriority (shape 2 1 5)) 1) a) 14 a +def CB2_1_5I1R14Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB2_1_5I1R14Certificates_valid : + CB2_1_5I1R14Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB2_1_5I1R14CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB2_1_5I1R14P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_1_5I1R14Certificates (CB2_1_5I1R14CertificateIndex a)).input +lemma CB2_1_5I1R14P_check : ∀ a : Fin 6, contains (CB2_1_5I1R14Raw a) (CB2_1_5I1R14P a) = true := by + decide +kernel +lemma CB2_1_5I1R14P_sound (a : Fin 6) : + (CB2_1_5I1R14P a).Encloses (CB2_1_5I1R14Value a) := + contains_sound (CB2_1_5I1R14Raw_sound a) (CB2_1_5I1R14P_check a) +def CB2_1_5I1R14Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_1_5I1R14Certificates (CB2_1_5I1R14CertificateIndex a)).output +lemma CB2_1_5I1R14Terms_sound (a : Fin 6) : + (CB2_1_5I1R14Terms a).Encloses (Foundation.entropyTerm (CB2_1_5I1R14Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB2_1_5I1R14Certificates_valid + (CB2_1_5I1R14CertificateIndex a) (CB2_1_5I1R14P_sound a) +def CB2_1_5I1R14Entropy : Ball := ⟨0, 0⟩ +lemma CB2_1_5I1R14Entropy_sound : CB2_1_5I1R14Entropy.Encloses (Foundation.finiteEntropy CB2_1_5I1R14Value) := by + exact contains_sound (entropyFin_enclosed 6 CB2_1_5I1R14Value CB2_1_5I1R14Terms CB2_1_5I1R14Terms_sound) (by decide +kernel) +def CB2_1_5I1R14Mass : Ball := ⟨0, 0⟩ +lemma CB2_1_5I1R14Mass_sound : CB2_1_5I1R14Mass.Encloses (∑ a, CB2_1_5I1R14Value a) := by + exact contains_sound (finSumBall_sound 6 CB2_1_5I1R14P CB2_1_5I1R14Value CB2_1_5I1R14P_sound) (by decide +kernel) +def CB2_1_5I1R14MassTerm : Ball := .exact 0 +lemma CB2_1_5I1R14MassTerm_sound : CB2_1_5I1R14MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB2_1_5I1R14Value a))) := + entropyTerm_zero_ball (CB2_1_5I1R14Mass_sound) +def CB2_1_5I1R14H : Ball := ⟨0, 0⟩ +lemma CB2_1_5I1R14H_sound : CB2_1_5I1R14H.Encloses (homogeneousEntropy CB2_1_5I1R14Value) := by + exact contains_sound (homogeneous_enclosed CB2_1_5I1R14Value CB2_1_5I1R14MassTerm_sound CB2_1_5I1R14Entropy_sound) (by decide +kernel) +def CB2_1_5I1R15Value (a : Fin 6) : ℝ := residualLaw (below (shape 2 1 5)) (fun u => (stageBLaw (shape 2 1 5) u : ℝ)) (stageBPriority (shape 2 1 5)) 1 (fun u a => (littleLaw (shape 2 1 5) u ((stageBPriority (shape 2 1 5)) 1) a : ℝ)) 15 a +def CB2_1_5I1R15Raw (a : Fin 6) : Ball := residualBall (below (shape 2 1 5)) B2_1_5Law (stageBPriority (shape 2 1 5)) 1 (fun u => B2_1_5Little u ((stageBPriority (shape 2 1 5)) 1)) 15 a +lemma CB2_1_5I1R15Raw_sound (a : Fin 6) : + (CB2_1_5I1R15Raw a).Encloses (CB2_1_5I1R15Value a) := by + exact residualBall_sound_on (below (shape 2 1 5)) B2_1_5Law (fun u => (stageBLaw (shape 2 1 5) u : ℝ)) (stageBPriority (shape 2 1 5)) 1 (fun u => B2_1_5Little u ((stageBPriority (shape 2 1 5)) 1)) (fun u a => (littleLaw (shape 2 1 5) u ((stageBPriority (shape 2 1 5)) 1) a : ℝ)) (fun u _ => B2_1_5Law_sound u) (fun u _ a => B2_1_5Little_sound u ((stageBPriority (shape 2 1 5)) 1) a) 15 a +def CB2_1_5I1R15Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB2_1_5I1R15Certificates_valid : + CB2_1_5I1R15Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB2_1_5I1R15CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB2_1_5I1R15P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_1_5I1R15Certificates (CB2_1_5I1R15CertificateIndex a)).input +lemma CB2_1_5I1R15P_check : ∀ a : Fin 6, contains (CB2_1_5I1R15Raw a) (CB2_1_5I1R15P a) = true := by + decide +kernel +lemma CB2_1_5I1R15P_sound (a : Fin 6) : + (CB2_1_5I1R15P a).Encloses (CB2_1_5I1R15Value a) := + contains_sound (CB2_1_5I1R15Raw_sound a) (CB2_1_5I1R15P_check a) +def CB2_1_5I1R15Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_1_5I1R15Certificates (CB2_1_5I1R15CertificateIndex a)).output +lemma CB2_1_5I1R15Terms_sound (a : Fin 6) : + (CB2_1_5I1R15Terms a).Encloses (Foundation.entropyTerm (CB2_1_5I1R15Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB2_1_5I1R15Certificates_valid + (CB2_1_5I1R15CertificateIndex a) (CB2_1_5I1R15P_sound a) +def CB2_1_5I1R15Entropy : Ball := ⟨0, 0⟩ +lemma CB2_1_5I1R15Entropy_sound : CB2_1_5I1R15Entropy.Encloses (Foundation.finiteEntropy CB2_1_5I1R15Value) := by + exact contains_sound (entropyFin_enclosed 6 CB2_1_5I1R15Value CB2_1_5I1R15Terms CB2_1_5I1R15Terms_sound) (by decide +kernel) +def CB2_1_5I1R15Mass : Ball := ⟨0, 0⟩ +lemma CB2_1_5I1R15Mass_sound : CB2_1_5I1R15Mass.Encloses (∑ a, CB2_1_5I1R15Value a) := by + exact contains_sound (finSumBall_sound 6 CB2_1_5I1R15P CB2_1_5I1R15Value CB2_1_5I1R15P_sound) (by decide +kernel) +def CB2_1_5I1R15MassTerm : Ball := .exact 0 +lemma CB2_1_5I1R15MassTerm_sound : CB2_1_5I1R15MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB2_1_5I1R15Value a))) := + entropyTerm_zero_ball (CB2_1_5I1R15Mass_sound) +def CB2_1_5I1R15H : Ball := ⟨0, 0⟩ +lemma CB2_1_5I1R15H_sound : CB2_1_5I1R15H.Encloses (homogeneousEntropy CB2_1_5I1R15Value) := by + exact contains_sound (homogeneous_enclosed CB2_1_5I1R15Value CB2_1_5I1R15MassTerm_sound CB2_1_5I1R15Entropy_sound) (by decide +kernel) +def CB2_1_5I1R16Value (a : Fin 6) : ℝ := residualLaw (below (shape 2 1 5)) (fun u => (stageBLaw (shape 2 1 5) u : ℝ)) (stageBPriority (shape 2 1 5)) 1 (fun u a => (littleLaw (shape 2 1 5) u ((stageBPriority (shape 2 1 5)) 1) a : ℝ)) 16 a +def CB2_1_5I1R16Raw (a : Fin 6) : Ball := residualBall (below (shape 2 1 5)) B2_1_5Law (stageBPriority (shape 2 1 5)) 1 (fun u => B2_1_5Little u ((stageBPriority (shape 2 1 5)) 1)) 16 a +lemma CB2_1_5I1R16Raw_sound (a : Fin 6) : + (CB2_1_5I1R16Raw a).Encloses (CB2_1_5I1R16Value a) := by + exact residualBall_sound_on (below (shape 2 1 5)) B2_1_5Law (fun u => (stageBLaw (shape 2 1 5) u : ℝ)) (stageBPriority (shape 2 1 5)) 1 (fun u => B2_1_5Little u ((stageBPriority (shape 2 1 5)) 1)) (fun u a => (littleLaw (shape 2 1 5) u ((stageBPriority (shape 2 1 5)) 1) a : ℝ)) (fun u _ => B2_1_5Law_sound u) (fun u _ a => B2_1_5Little_sound u ((stageBPriority (shape 2 1 5)) 1) a) 16 a +def CB2_1_5I1R16Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB2_1_5I1R16Certificates_valid : + CB2_1_5I1R16Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB2_1_5I1R16CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB2_1_5I1R16P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_1_5I1R16Certificates (CB2_1_5I1R16CertificateIndex a)).input +lemma CB2_1_5I1R16P_check : ∀ a : Fin 6, contains (CB2_1_5I1R16Raw a) (CB2_1_5I1R16P a) = true := by + decide +kernel +lemma CB2_1_5I1R16P_sound (a : Fin 6) : + (CB2_1_5I1R16P a).Encloses (CB2_1_5I1R16Value a) := + contains_sound (CB2_1_5I1R16Raw_sound a) (CB2_1_5I1R16P_check a) +def CB2_1_5I1R16Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_1_5I1R16Certificates (CB2_1_5I1R16CertificateIndex a)).output +lemma CB2_1_5I1R16Terms_sound (a : Fin 6) : + (CB2_1_5I1R16Terms a).Encloses (Foundation.entropyTerm (CB2_1_5I1R16Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB2_1_5I1R16Certificates_valid + (CB2_1_5I1R16CertificateIndex a) (CB2_1_5I1R16P_sound a) +def CB2_1_5I1R16Entropy : Ball := ⟨0, 0⟩ +lemma CB2_1_5I1R16Entropy_sound : CB2_1_5I1R16Entropy.Encloses (Foundation.finiteEntropy CB2_1_5I1R16Value) := by + exact contains_sound (entropyFin_enclosed 6 CB2_1_5I1R16Value CB2_1_5I1R16Terms CB2_1_5I1R16Terms_sound) (by decide +kernel) +def CB2_1_5I1R16Mass : Ball := ⟨0, 0⟩ +lemma CB2_1_5I1R16Mass_sound : CB2_1_5I1R16Mass.Encloses (∑ a, CB2_1_5I1R16Value a) := by + exact contains_sound (finSumBall_sound 6 CB2_1_5I1R16P CB2_1_5I1R16Value CB2_1_5I1R16P_sound) (by decide +kernel) +def CB2_1_5I1R16MassTerm : Ball := .exact 0 +lemma CB2_1_5I1R16MassTerm_sound : CB2_1_5I1R16MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB2_1_5I1R16Value a))) := + entropyTerm_zero_ball (CB2_1_5I1R16Mass_sound) +def CB2_1_5I1R16H : Ball := ⟨0, 0⟩ +lemma CB2_1_5I1R16H_sound : CB2_1_5I1R16H.Encloses (homogeneousEntropy CB2_1_5I1R16Value) := by + exact contains_sound (homogeneous_enclosed CB2_1_5I1R16Value CB2_1_5I1R16MassTerm_sound CB2_1_5I1R16Entropy_sound) (by decide +kernel) +def CB2_1_5I1ResidualEntropies (a : Fin 17) : Ball := + match a.val with + | 0 => CB2_1_5I1R0H + | 1 => CB2_1_5I1R1H + | 2 => CB2_1_5I1R2H + | 3 => CB2_1_5I1R3H + | 4 => CB2_1_5I1R4H + | 5 => CB2_1_5I1R5H + | 6 => CB2_1_5I1R6H + | 7 => CB2_1_5I1R7H + | 8 => CB2_1_5I1R8H + | 9 => CB2_1_5I1R9H + | 10 => CB2_1_5I1R10H + | 11 => CB2_1_5I1R11H + | 12 => CB2_1_5I1R12H + | 13 => CB2_1_5I1R13H + | 14 => CB2_1_5I1R14H + | 15 => CB2_1_5I1R15H + | 16 => CB2_1_5I1R16H + | _ => (.exact 0) +lemma CB2_1_5I1ResidualEntropies_sound (k : Fin 17) : + (CB2_1_5I1ResidualEntropies k).Encloses (homogeneousEntropy + (residualLaw (below (shape 2 1 5)) (fun u => (stageBLaw (shape 2 1 5) u : ℝ)) (stageBPriority (shape 2 1 5)) 1 (fun u a => (littleLaw (shape 2 1 5) u ((stageBPriority (shape 2 1 5)) 1) a : ℝ)) k)) := by + fin_cases k + · exact CB2_1_5I1R0H_sound + · exact CB2_1_5I1R1H_sound + · exact CB2_1_5I1R2H_sound + · exact CB2_1_5I1R3H_sound + · exact CB2_1_5I1R4H_sound + · exact CB2_1_5I1R5H_sound + · exact CB2_1_5I1R6H_sound + · exact CB2_1_5I1R7H_sound + · exact CB2_1_5I1R8H_sound + · exact CB2_1_5I1R9H_sound + · exact CB2_1_5I1R10H_sound + · exact CB2_1_5I1R11H_sound + · exact CB2_1_5I1R12H_sound + · exact CB2_1_5I1R13H_sound + · exact CB2_1_5I1R14H_sound + · exact CB2_1_5I1R15H_sound + · exact CB2_1_5I1R16H_sound +def CB2_1_5I1Singles (s : Shape) : Ball := + match s 0, s 1, s 2 with + | _, _, _ => (.exact 0) +lemma CB2_1_5I1Singles_sound (u : Shape) (hu : u ∈ below (shape 2 1 5)) + (hd : designated (stageBPriority (shape 2 1 5)) 1 u) : + (CB2_1_5I1Singles u).Encloses (homogeneousEntropy ((fun u a => (littleLaw (shape 2 1 5) u ((stageBPriority (shape 2 1 5)) 1) a : ℝ)) u)) := by + rw [B2_1_5_below] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl | rfl | rfl + · exact (show ¬ designated (stageBPriority (shape 2 1 5)) 1 (shape 0 0 4) by decide +kernel) hd |>.elim + · exact (show ¬ designated (stageBPriority (shape 2 1 5)) 1 (shape 0 1 3) by decide +kernel) hd |>.elim + · exact (show ¬ designated (stageBPriority (shape 2 1 5)) 1 (shape 1 0 3) by decide +kernel) hd |>.elim + · exact (show ¬ designated (stageBPriority (shape 2 1 5)) 1 (shape 1 1 2) by decide +kernel) hd |>.elim + · exact (show ¬ designated (stageBPriority (shape 2 1 5)) 1 (shape 2 0 2) by decide +kernel) hd |>.elim + · exact (show ¬ designated (stageBPriority (shape 2 1 5)) 1 (shape 2 1 1) by decide +kernel) hd |>.elim +def CB2_1_5I1Singleton : Ball := ⟨0, 0⟩ +lemma CB2_1_5I1Singleton_sound : CB2_1_5I1Singleton.Encloses + (singletonEntropy (below (shape 2 1 5)) (fun u => (stageBLaw (shape 2 1 5) u : ℝ)) (stageBPriority (shape 2 1 5)) 1 (fun u a => (littleLaw (shape 2 1 5) u ((stageBPriority (shape 2 1 5)) 1) a : ℝ))) := by + exact contains_sound (singletonBall_sound (below (shape 2 1 5)) B2_1_5Law (fun u => (stageBLaw (shape 2 1 5) u : ℝ)) (stageBPriority (shape 2 1 5)) 1 + CB2_1_5I1Singles (fun u a => (littleLaw (shape 2 1 5) u ((stageBPriority (shape 2 1 5)) 1) a : ℝ)) (fun u _ => B2_1_5Law_sound u) CB2_1_5I1Singles_sound) (by decide +kernel) +def CB2_1_5I1Group : Ball := ⟨(5968744602970259531620345281489 / 100000000000000000000000000000000), (23381118723 / 20000000000000000000000000000000)⟩ +lemma CB2_1_5I1Group_sound : CB2_1_5I1Group.Encloses + (groupedEntropy (below (shape 2 1 5)) (fun u => (stageBLaw (shape 2 1 5) u : ℝ)) (stageBPriority (shape 2 1 5)) 1 (fun u a => (littleLaw (shape 2 1 5) u ((stageBPriority (shape 2 1 5)) 1) a : ℝ))) := by + exact contains_sound (Ball.add_sound CB2_1_5I1Singleton_sound + (finSumBall_sound 17 CB2_1_5I1ResidualEntropies _ CB2_1_5I1ResidualEntropies_sound)) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CB2_1_5I1H : Ball := ⟨(45548573011653485345390865905989 / 50000000000000000000000000000000), (315191300491 / 100000000000000000000000000000000)⟩ +lemma CB2_1_5I1_sound : CB2_1_5I1H.Encloses (stageBCapacity (shape 2 1 5) 1) := by + have hb := contains_sound (Ball.add_sound CB2_1_5I1PairH_sound + (Ball.neg_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) CB2_1_5I1Group_sound))) + (show contains (.add CB2_1_5I1PairH (.neg (.mul (.exact 2) CB2_1_5I1Group))) CB2_1_5I1H = true by decide +kernel) + unfold CB2_1_5I1PairValue at hb + simpa only [stageBCapacity, nativeCapacity, + show (1 : Fin 3) ≠ 0 by decide, ite_false, sub_eq_add_neg] using hb + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/CapacityB/CapB2_1_5I2.lean b/lean/OAI/LinearAlgebra/MatrixFields/CapacityB/CapB2_1_5I2.lean new file mode 100644 index 0000000000000000000000000000000000000000..31f8fa4acc0e73846e9ead11e3bc8e473cd98e99 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/CapacityB/CapB2_1_5I2.lean @@ -0,0 +1,991 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Certificates.Terminal2_1_5 + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CB2_1_5I2PairValue (a : PairSlot) : ℝ := pairLaw (below (shape 2 1 5)) (shape 2 1 5) (fun u => (stageBLaw (shape 2 1 5) u : ℝ)) (fun u a => (littleLaw (shape 2 1 5) u ((stageBPriority (shape 2 1 5)) 2) a : ℝ)) a +def CB2_1_5I2PairRaw (a : PairSlot) : Ball := pairLawBall (below (shape 2 1 5)) (shape 2 1 5) B2_1_5Law (fun u => B2_1_5Little u ((stageBPriority (shape 2 1 5)) 2)) a +lemma CB2_1_5I2PairRaw_sound (a : PairSlot) : + (CB2_1_5I2PairRaw a).Encloses (CB2_1_5I2PairValue a) := by + exact pairLawBall_sound_on (below (shape 2 1 5)) (shape 2 1 5) B2_1_5Law (fun u => (stageBLaw (shape 2 1 5) u : ℝ)) (fun u => B2_1_5Little u ((stageBPriority (shape 2 1 5)) 2)) (fun u a => (littleLaw (shape 2 1 5) u ((stageBPriority (shape 2 1 5)) 2) a : ℝ)) (fun u _ => B2_1_5Law_sound u) (fun u _ a => B2_1_5Little_sound u ((stageBPriority (shape 2 1 5)) 2) a) (fun u _ a => B2_1_5Little_sound (complement (shape 2 1 5) u) ((stageBPriority (shape 2 1 5)) 2) a) a +def CB2_1_5I2PairCertificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(45454225515120282149964459091 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(15915961829956415895565101573 / 2500000000000000000000000000000), (28875921 / 12500000000000000000000000000000)⟩ ⟨(-350153624873929362004825628773133 / 50000000000000000000000000000000), (15881867831 / 6250000000000000000000000000000)⟩ ⟨-11, 45454225515120282149964459091, 24414062500000000000000000000⟩, + .log ⟨(48074850858946887693214975069309 / 100000000000000000000000000000000), (23 / 50000000000000000000000000000000)⟩ ⟨(35210549437461474281406045798339 / 100000000000000000000000000000000), (15270368521 / 50000000000000000000000000000000)⟩ ⟨(-73241099677605500772916171133169 / 100000000000000000000000000000000), (7940933893 / 12500000000000000000000000000000)⟩ ⟨-2, 48074850858946887693214975069309, 25000000000000000000000000000000⟩, + .log ⟨(1834240690022871742485096012509 / 100000000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ ⟨(7334284003843347862654352972569 / 100000000000000000000000000000000), (1359454521 / 50000000000000000000000000000000)⟩ ⟨(-79970791660410655212267089756719 / 20000000000000000000000000000000), (74115382999 / 50000000000000000000000000000000)⟩ ⟨-6, 1834240690022871742485096012509, 1562500000000000000000000000000⟩] +lemma CB2_1_5I2PairCertificates_valid : + CB2_1_5I2PairCertificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB2_1_5I2PairCertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 5, 1 => 1 + | 4, 2 => 2 + | 4, 3 => 3 + | 2, 4 => 2 + | 3, 4 => 3 + | 1, 5 => 1 + | _, _ => 0 +def CB2_1_5I2PairP (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CB2_1_5I2PairCertificates (CB2_1_5I2PairCertificateIndex a)).input +lemma CB2_1_5I2PairP_check : ∀ a : PairSlot, contains (CB2_1_5I2PairRaw a) (CB2_1_5I2PairP a) = true := by + decide +kernel +lemma CB2_1_5I2PairP_sound (a : PairSlot) : + (CB2_1_5I2PairP a).Encloses (CB2_1_5I2PairValue a) := + contains_sound (CB2_1_5I2PairRaw_sound a) (CB2_1_5I2PairP_check a) +def CB2_1_5I2PairTerms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CB2_1_5I2PairCertificates (CB2_1_5I2PairCertificateIndex a)).output +lemma CB2_1_5I2PairTerms_sound (a : PairSlot) : + (CB2_1_5I2PairTerms a).Encloses (Foundation.entropyTerm (CB2_1_5I2PairValue a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB2_1_5I2PairCertificates_valid + (CB2_1_5I2PairCertificateIndex a) (CB2_1_5I2PairP_sound a) +def CB2_1_5I2PairEntropy : Ball := ⟨(10795367978625769694970750708457 / 12500000000000000000000000000000), (8372663363 / 12500000000000000000000000000000)⟩ +lemma CB2_1_5I2PairEntropy_sound : CB2_1_5I2PairEntropy.Encloses (Foundation.finiteEntropy CB2_1_5I2PairValue) := by + exact contains_sound (entropyPair_enclosed CB2_1_5I2PairValue CB2_1_5I2PairTerms CB2_1_5I2PairTerms_sound) (by decide +kernel) +def CB2_1_5I2PairMass : Ball := ⟨1, (51 / 50000000000000000000000000000000)⟩ +lemma CB2_1_5I2PairMass_sound : CB2_1_5I2PairMass.Encloses (∑ a, CB2_1_5I2PairValue a) := by + exact contains_sound (pairSumBall_sound CB2_1_5I2PairP CB2_1_5I2PairValue CB2_1_5I2PairP_sound) (by decide +kernel) +def CB2_1_5I2PairMassTermLogWitness : LogWitness := ⟨0, 1, 1⟩ +def CB2_1_5I2PairMassTermLog : Ball := ⟨0, (2646977973 / 12500000000000000000000000000000)⟩ +lemma CB2_1_5I2PairMassTermLog_sound : CB2_1_5I2PairMassTermLog.Encloses (Real.log ((∑ a, CB2_1_5I2PairValue a))) := by + exact checkLog_sound logTwoBall_sound (CB2_1_5I2PairMass_sound) (w := CB2_1_5I2PairMassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB2_1_5I2PairMassTerm : Ball := ⟨0, (4235164757 / 20000000000000000000000000000000)⟩ +lemma CB2_1_5I2PairMassTerm_sound : CB2_1_5I2PairMassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB2_1_5I2PairValue a))) := by + exact contains_sound (entropyTerm_ball (CB2_1_5I2PairMass_sound) CB2_1_5I2PairMassTermLog_sound) (by decide +kernel) +def CB2_1_5I2PairH : Ball := ⟨(10795367978625769694970750708457 / 12500000000000000000000000000000), (88157130689 / 100000000000000000000000000000000)⟩ +lemma CB2_1_5I2PairH_sound : CB2_1_5I2PairH.Encloses (homogeneousEntropy CB2_1_5I2PairValue) := by + exact contains_sound (homogeneous_enclosed CB2_1_5I2PairValue CB2_1_5I2PairMassTerm_sound CB2_1_5I2PairEntropy_sound) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CB2_1_5I2R0Value (a : Fin 6) : ℝ := residualLaw (below (shape 2 1 5)) (fun u => (stageBLaw (shape 2 1 5) u : ℝ)) (stageBPriority (shape 2 1 5)) 2 (fun u a => (littleLaw (shape 2 1 5) u ((stageBPriority (shape 2 1 5)) 2) a : ℝ)) 0 a +def CB2_1_5I2R0Raw (a : Fin 6) : Ball := residualBall (below (shape 2 1 5)) B2_1_5Law (stageBPriority (shape 2 1 5)) 2 (fun u => B2_1_5Little u ((stageBPriority (shape 2 1 5)) 2)) 0 a +lemma CB2_1_5I2R0Raw_sound (a : Fin 6) : + (CB2_1_5I2R0Raw a).Encloses (CB2_1_5I2R0Value a) := by + exact residualBall_sound_on (below (shape 2 1 5)) B2_1_5Law (fun u => (stageBLaw (shape 2 1 5) u : ℝ)) (stageBPriority (shape 2 1 5)) 2 (fun u => B2_1_5Little u ((stageBPriority (shape 2 1 5)) 2)) (fun u a => (littleLaw (shape 2 1 5) u ((stageBPriority (shape 2 1 5)) 2) a : ℝ)) (fun u _ => B2_1_5Law_sound u) (fun u _ a => B2_1_5Little_sound u ((stageBPriority (shape 2 1 5)) 2) a) 0 a +def CB2_1_5I2R0Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB2_1_5I2R0Certificates_valid : + CB2_1_5I2R0Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB2_1_5I2R0CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB2_1_5I2R0P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_1_5I2R0Certificates (CB2_1_5I2R0CertificateIndex a)).input +lemma CB2_1_5I2R0P_check : ∀ a : Fin 6, contains (CB2_1_5I2R0Raw a) (CB2_1_5I2R0P a) = true := by + decide +kernel +lemma CB2_1_5I2R0P_sound (a : Fin 6) : + (CB2_1_5I2R0P a).Encloses (CB2_1_5I2R0Value a) := + contains_sound (CB2_1_5I2R0Raw_sound a) (CB2_1_5I2R0P_check a) +def CB2_1_5I2R0Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_1_5I2R0Certificates (CB2_1_5I2R0CertificateIndex a)).output +lemma CB2_1_5I2R0Terms_sound (a : Fin 6) : + (CB2_1_5I2R0Terms a).Encloses (Foundation.entropyTerm (CB2_1_5I2R0Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB2_1_5I2R0Certificates_valid + (CB2_1_5I2R0CertificateIndex a) (CB2_1_5I2R0P_sound a) +def CB2_1_5I2R0Entropy : Ball := ⟨0, 0⟩ +lemma CB2_1_5I2R0Entropy_sound : CB2_1_5I2R0Entropy.Encloses (Foundation.finiteEntropy CB2_1_5I2R0Value) := by + exact contains_sound (entropyFin_enclosed 6 CB2_1_5I2R0Value CB2_1_5I2R0Terms CB2_1_5I2R0Terms_sound) (by decide +kernel) +def CB2_1_5I2R0Mass : Ball := ⟨0, 0⟩ +lemma CB2_1_5I2R0Mass_sound : CB2_1_5I2R0Mass.Encloses (∑ a, CB2_1_5I2R0Value a) := by + exact contains_sound (finSumBall_sound 6 CB2_1_5I2R0P CB2_1_5I2R0Value CB2_1_5I2R0P_sound) (by decide +kernel) +def CB2_1_5I2R0MassTerm : Ball := .exact 0 +lemma CB2_1_5I2R0MassTerm_sound : CB2_1_5I2R0MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB2_1_5I2R0Value a))) := + entropyTerm_zero_ball (CB2_1_5I2R0Mass_sound) +def CB2_1_5I2R0H : Ball := ⟨0, 0⟩ +lemma CB2_1_5I2R0H_sound : CB2_1_5I2R0H.Encloses (homogeneousEntropy CB2_1_5I2R0Value) := by + exact contains_sound (homogeneous_enclosed CB2_1_5I2R0Value CB2_1_5I2R0MassTerm_sound CB2_1_5I2R0Entropy_sound) (by decide +kernel) +def CB2_1_5I2R1Value (a : Fin 6) : ℝ := residualLaw (below (shape 2 1 5)) (fun u => (stageBLaw (shape 2 1 5) u : ℝ)) (stageBPriority (shape 2 1 5)) 2 (fun u a => (littleLaw (shape 2 1 5) u ((stageBPriority (shape 2 1 5)) 2) a : ℝ)) 1 a +def CB2_1_5I2R1Raw (a : Fin 6) : Ball := residualBall (below (shape 2 1 5)) B2_1_5Law (stageBPriority (shape 2 1 5)) 2 (fun u => B2_1_5Little u ((stageBPriority (shape 2 1 5)) 2)) 1 a +lemma CB2_1_5I2R1Raw_sound (a : Fin 6) : + (CB2_1_5I2R1Raw a).Encloses (CB2_1_5I2R1Value a) := by + exact residualBall_sound_on (below (shape 2 1 5)) B2_1_5Law (fun u => (stageBLaw (shape 2 1 5) u : ℝ)) (stageBPriority (shape 2 1 5)) 2 (fun u => B2_1_5Little u ((stageBPriority (shape 2 1 5)) 2)) (fun u a => (littleLaw (shape 2 1 5) u ((stageBPriority (shape 2 1 5)) 2) a : ℝ)) (fun u _ => B2_1_5Law_sound u) (fun u _ a => B2_1_5Little_sound u ((stageBPriority (shape 2 1 5)) 2) a) 1 a +def CB2_1_5I2R1Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(45454225515120282149964459091 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(15915961829956415895565101573 / 2500000000000000000000000000000), (28875921 / 12500000000000000000000000000000)⟩ ⟨(-350153624873929362004825628773133 / 50000000000000000000000000000000), (15881867831 / 6250000000000000000000000000000)⟩ ⟨-11, 45454225515120282149964459091, 24414062500000000000000000000⟩] +lemma CB2_1_5I2R1Certificates_valid : + CB2_1_5I2R1Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB2_1_5I2R1CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | 1 => 1 + | _ => 0 +def CB2_1_5I2R1P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_1_5I2R1Certificates (CB2_1_5I2R1CertificateIndex a)).input +lemma CB2_1_5I2R1P_check : ∀ a : Fin 6, contains (CB2_1_5I2R1Raw a) (CB2_1_5I2R1P a) = true := by + decide +kernel +lemma CB2_1_5I2R1P_sound (a : Fin 6) : + (CB2_1_5I2R1P a).Encloses (CB2_1_5I2R1Value a) := + contains_sound (CB2_1_5I2R1Raw_sound a) (CB2_1_5I2R1P_check a) +def CB2_1_5I2R1Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_1_5I2R1Certificates (CB2_1_5I2R1CertificateIndex a)).output +lemma CB2_1_5I2R1Terms_sound (a : Fin 6) : + (CB2_1_5I2R1Terms a).Encloses (Foundation.entropyTerm (CB2_1_5I2R1Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB2_1_5I2R1Certificates_valid + (CB2_1_5I2R1CertificateIndex a) (CB2_1_5I2R1P_sound a) +def CB2_1_5I2R1Entropy : Ball := ⟨(15915961829956415895565101573 / 2500000000000000000000000000000), (28875921 / 12500000000000000000000000000000)⟩ +lemma CB2_1_5I2R1Entropy_sound : CB2_1_5I2R1Entropy.Encloses (Foundation.finiteEntropy CB2_1_5I2R1Value) := by + exact contains_sound (entropyFin_enclosed 6 CB2_1_5I2R1Value CB2_1_5I2R1Terms CB2_1_5I2R1Terms_sound) (by decide +kernel) +def CB2_1_5I2R1Mass : Ball := ⟨(45454225515120282149964459091 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ +lemma CB2_1_5I2R1Mass_sound : CB2_1_5I2R1Mass.Encloses (∑ a, CB2_1_5I2R1Value a) := by + exact contains_sound (finSumBall_sound 6 CB2_1_5I2R1P CB2_1_5I2R1Value CB2_1_5I2R1P_sound) (by decide +kernel) +def CB2_1_5I2R1MassTermLogWitness : LogWitness := ⟨-11, 45454225515120282149964459091, 24414062500000000000000000000⟩ +def CB2_1_5I2R1MassTermLog : Ball := ⟨(-350153624873929362004825628773133 / 50000000000000000000000000000000), (15881867831 / 6250000000000000000000000000000)⟩ +lemma CB2_1_5I2R1MassTermLog_sound : CB2_1_5I2R1MassTermLog.Encloses (Real.log ((∑ a, CB2_1_5I2R1Value a))) := by + exact checkLog_sound logTwoBall_sound (CB2_1_5I2R1Mass_sound) (w := CB2_1_5I2R1MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB2_1_5I2R1MassTerm : Ball := ⟨(15915961829956415895565101573 / 2500000000000000000000000000000), (28875921 / 12500000000000000000000000000000)⟩ +lemma CB2_1_5I2R1MassTerm_sound : CB2_1_5I2R1MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB2_1_5I2R1Value a))) := by + exact contains_sound (entropyTerm_ball (CB2_1_5I2R1Mass_sound) CB2_1_5I2R1MassTermLog_sound) (by decide +kernel) +def CB2_1_5I2R1H : Ball := ⟨0, (28875921 / 6250000000000000000000000000000)⟩ +lemma CB2_1_5I2R1H_sound : CB2_1_5I2R1H.Encloses (homogeneousEntropy CB2_1_5I2R1Value) := by + exact contains_sound (homogeneous_enclosed CB2_1_5I2R1Value CB2_1_5I2R1MassTerm_sound CB2_1_5I2R1Entropy_sound) (by decide +kernel) +def CB2_1_5I2R2Value (a : Fin 6) : ℝ := residualLaw (below (shape 2 1 5)) (fun u => (stageBLaw (shape 2 1 5) u : ℝ)) (stageBPriority (shape 2 1 5)) 2 (fun u a => (littleLaw (shape 2 1 5) u ((stageBPriority (shape 2 1 5)) 2) a : ℝ)) 2 a +def CB2_1_5I2R2Raw (a : Fin 6) : Ball := residualBall (below (shape 2 1 5)) B2_1_5Law (stageBPriority (shape 2 1 5)) 2 (fun u => B2_1_5Little u ((stageBPriority (shape 2 1 5)) 2)) 2 a +lemma CB2_1_5I2R2Raw_sound (a : Fin 6) : + (CB2_1_5I2R2Raw a).Encloses (CB2_1_5I2R2Value a) := by + exact residualBall_sound_on (below (shape 2 1 5)) B2_1_5Law (fun u => (stageBLaw (shape 2 1 5) u : ℝ)) (stageBPriority (shape 2 1 5)) 2 (fun u => B2_1_5Little u ((stageBPriority (shape 2 1 5)) 2)) (fun u a => (littleLaw (shape 2 1 5) u ((stageBPriority (shape 2 1 5)) 2) a : ℝ)) (fun u _ => B2_1_5Law_sound u) (fun u _ a => B2_1_5Little_sound u ((stageBPriority (shape 2 1 5)) 2) a) 2 a +def CB2_1_5I2R2Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(31680352333068082943824103178953 / 100000000000000000000000000000000), (17 / 100000000000000000000000000000000)⟩ ⟨(36415725397661530615618427188243 / 100000000000000000000000000000000), (10062863347 / 50000000000000000000000000000000)⟩ ⟨(-114947349747908724042984787610399 / 100000000000000000000000000000000), (31763735551 / 50000000000000000000000000000000)⟩ ⟨-2, 31680352333068082943824103178953, 25000000000000000000000000000000⟩, + .log ⟨(31680384013452096395920499 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(237048204975616766034143847 / 50000000000000000000000000000000), (77157 / 50000000000000000000000000000000)⟩ ⟨(-748249152772143067210222960245917 / 50000000000000000000000000000000), (121761775309 / 25000000000000000000000000000000)⟩ ⟨-22, 31680384013452096395920499, 23841857910156250000000000⟩] +lemma CB2_1_5I2R2Certificates_valid : + CB2_1_5I2R2Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB2_1_5I2R2CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | 2 => 1 + | 3 => 2 + | _ => 0 +def CB2_1_5I2R2P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_1_5I2R2Certificates (CB2_1_5I2R2CertificateIndex a)).input +lemma CB2_1_5I2R2P_check : ∀ a : Fin 6, contains (CB2_1_5I2R2Raw a) (CB2_1_5I2R2P a) = true := by + decide +kernel +lemma CB2_1_5I2R2P_sound (a : Fin 6) : + (CB2_1_5I2R2P a).Encloses (CB2_1_5I2R2Value a) := + contains_sound (CB2_1_5I2R2Raw_sound a) (CB2_1_5I2R2P_check a) +def CB2_1_5I2R2Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_1_5I2R2Certificates (CB2_1_5I2R2CertificateIndex a)).output +lemma CB2_1_5I2R2Terms_sound (a : Fin 6) : + (CB2_1_5I2R2Terms a).Encloses (Foundation.entropyTerm (CB2_1_5I2R2Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB2_1_5I2R2Certificates_valid + (CB2_1_5I2R2CertificateIndex a) (CB2_1_5I2R2P_sound a) +def CB2_1_5I2R2Entropy : Ball := ⟨(36416199494071481849150495475937 / 100000000000000000000000000000000), (1257867563 / 6250000000000000000000000000000)⟩ +lemma CB2_1_5I2R2Entropy_sound : CB2_1_5I2R2Entropy.Encloses (Foundation.finiteEntropy CB2_1_5I2R2Value) := by + exact contains_sound (entropyFin_enclosed 6 CB2_1_5I2R2Value CB2_1_5I2R2Terms CB2_1_5I2R2Terms_sound) (by decide +kernel) +def CB2_1_5I2R2Mass : Ball := ⟨(7920096003363024098980124774863 / 25000000000000000000000000000000), (9 / 50000000000000000000000000000000)⟩ +lemma CB2_1_5I2R2Mass_sound : CB2_1_5I2R2Mass.Encloses (∑ a, CB2_1_5I2R2Value a) := by + exact contains_sound (finSumBall_sound 6 CB2_1_5I2R2P CB2_1_5I2R2Value CB2_1_5I2R2P_sound) (by decide +kernel) +def CB2_1_5I2R2MassTermLogWitness : LogWitness := ⟨-2, 7920096003363024098980124774863, 6250000000000000000000000000000⟩ +def CB2_1_5I2R2MassTermLog : Ball := ⟨(-22989449949571744801930285855409 / 20000000000000000000000000000000), (12705494221 / 20000000000000000000000000000000)⟩ +lemma CB2_1_5I2R2MassTermLog_sound : CB2_1_5I2R2MassTermLog.Encloses (Real.log ((∑ a, CB2_1_5I2R2Value a))) := by + exact checkLog_sound logTwoBall_sound (CB2_1_5I2R2Mass_sound) (w := CB2_1_5I2R2MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB2_1_5I2R2MassTerm : Ball := ⟨(1456629205320939615371968330297 / 4000000000000000000000000000000), (10062873411 / 50000000000000000000000000000000)⟩ +lemma CB2_1_5I2R2MassTerm_sound : CB2_1_5I2R2MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB2_1_5I2R2Value a))) := by + exact contains_sound (entropyTerm_ball (CB2_1_5I2R2Mass_sound) CB2_1_5I2R2MassTermLog_sound) (by decide +kernel) +def CB2_1_5I2R2H : Ball := ⟨(29335065499466553205451157 / 6250000000000000000000000000000), (4025162783 / 10000000000000000000000000000000)⟩ +lemma CB2_1_5I2R2H_sound : CB2_1_5I2R2H.Encloses (homogeneousEntropy CB2_1_5I2R2Value) := by + exact contains_sound (homogeneous_enclosed CB2_1_5I2R2Value CB2_1_5I2R2MassTerm_sound CB2_1_5I2R2Entropy_sound) (by decide +kernel) +def CB2_1_5I2R3Value (a : Fin 6) : ℝ := residualLaw (below (shape 2 1 5)) (fun u => (stageBLaw (shape 2 1 5) u : ℝ)) (stageBPriority (shape 2 1 5)) 2 (fun u a => (littleLaw (shape 2 1 5) u ((stageBPriority (shape 2 1 5)) 2) a : ℝ)) 3 a +def CB2_1_5I2R3Raw (a : Fin 6) : Ball := residualBall (below (shape 2 1 5)) B2_1_5Law (stageBPriority (shape 2 1 5)) 2 (fun u => B2_1_5Little u ((stageBPriority (shape 2 1 5)) 2)) 3 a +lemma CB2_1_5I2R3Raw_sound (a : Fin 6) : + (CB2_1_5I2R3Raw a).Encloses (CB2_1_5I2R3Value a) := by + exact residualBall_sound_on (below (shape 2 1 5)) B2_1_5Law (fun u => (stageBLaw (shape 2 1 5) u : ℝ)) (stageBPriority (shape 2 1 5)) 2 (fun u => B2_1_5Little u ((stageBPriority (shape 2 1 5)) 2)) (fun u a => (littleLaw (shape 2 1 5) u ((stageBPriority (shape 2 1 5)) 2) a : ℝ)) (fun u _ => B2_1_5Law_sound u) (fun u _ a => B2_1_5Little_sound u ((stageBPriority (shape 2 1 5)) 2) a) 3 a +def CB2_1_5I2R3Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB2_1_5I2R3Certificates_valid : + CB2_1_5I2R3Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB2_1_5I2R3CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB2_1_5I2R3P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_1_5I2R3Certificates (CB2_1_5I2R3CertificateIndex a)).input +lemma CB2_1_5I2R3P_check : ∀ a : Fin 6, contains (CB2_1_5I2R3Raw a) (CB2_1_5I2R3P a) = true := by + decide +kernel +lemma CB2_1_5I2R3P_sound (a : Fin 6) : + (CB2_1_5I2R3P a).Encloses (CB2_1_5I2R3Value a) := + contains_sound (CB2_1_5I2R3Raw_sound a) (CB2_1_5I2R3P_check a) +def CB2_1_5I2R3Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_1_5I2R3Certificates (CB2_1_5I2R3CertificateIndex a)).output +lemma CB2_1_5I2R3Terms_sound (a : Fin 6) : + (CB2_1_5I2R3Terms a).Encloses (Foundation.entropyTerm (CB2_1_5I2R3Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB2_1_5I2R3Certificates_valid + (CB2_1_5I2R3CertificateIndex a) (CB2_1_5I2R3P_sound a) +def CB2_1_5I2R3Entropy : Ball := ⟨0, 0⟩ +lemma CB2_1_5I2R3Entropy_sound : CB2_1_5I2R3Entropy.Encloses (Foundation.finiteEntropy CB2_1_5I2R3Value) := by + exact contains_sound (entropyFin_enclosed 6 CB2_1_5I2R3Value CB2_1_5I2R3Terms CB2_1_5I2R3Terms_sound) (by decide +kernel) +def CB2_1_5I2R3Mass : Ball := ⟨0, 0⟩ +lemma CB2_1_5I2R3Mass_sound : CB2_1_5I2R3Mass.Encloses (∑ a, CB2_1_5I2R3Value a) := by + exact contains_sound (finSumBall_sound 6 CB2_1_5I2R3P CB2_1_5I2R3Value CB2_1_5I2R3P_sound) (by decide +kernel) +def CB2_1_5I2R3MassTerm : Ball := .exact 0 +lemma CB2_1_5I2R3MassTerm_sound : CB2_1_5I2R3MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB2_1_5I2R3Value a))) := + entropyTerm_zero_ball (CB2_1_5I2R3Mass_sound) +def CB2_1_5I2R3H : Ball := ⟨0, 0⟩ +lemma CB2_1_5I2R3H_sound : CB2_1_5I2R3H.Encloses (homogeneousEntropy CB2_1_5I2R3Value) := by + exact contains_sound (homogeneous_enclosed CB2_1_5I2R3Value CB2_1_5I2R3MassTerm_sound CB2_1_5I2R3Entropy_sound) (by decide +kernel) +def CB2_1_5I2R4Value (a : Fin 6) : ℝ := residualLaw (below (shape 2 1 5)) (fun u => (stageBLaw (shape 2 1 5) u : ℝ)) (stageBPriority (shape 2 1 5)) 2 (fun u a => (littleLaw (shape 2 1 5) u ((stageBPriority (shape 2 1 5)) 2) a : ℝ)) 4 a +def CB2_1_5I2R4Raw (a : Fin 6) : Ball := residualBall (below (shape 2 1 5)) B2_1_5Law (stageBPriority (shape 2 1 5)) 2 (fun u => B2_1_5Little u ((stageBPriority (shape 2 1 5)) 2)) 4 a +lemma CB2_1_5I2R4Raw_sound (a : Fin 6) : + (CB2_1_5I2R4Raw a).Encloses (CB2_1_5I2R4Value a) := by + exact residualBall_sound_on (below (shape 2 1 5)) B2_1_5Law (fun u => (stageBLaw (shape 2 1 5) u : ℝ)) (stageBPriority (shape 2 1 5)) 2 (fun u => B2_1_5Little u ((stageBPriority (shape 2 1 5)) 2)) (fun u a => (littleLaw (shape 2 1 5) u ((stageBPriority (shape 2 1 5)) 2) a : ℝ)) (fun u _ => B2_1_5Law_sound u) (fun u _ a => B2_1_5Little_sound u ((stageBPriority (shape 2 1 5)) 2) a) 4 a +def CB2_1_5I2R4Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB2_1_5I2R4Certificates_valid : + CB2_1_5I2R4Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB2_1_5I2R4CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB2_1_5I2R4P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_1_5I2R4Certificates (CB2_1_5I2R4CertificateIndex a)).input +lemma CB2_1_5I2R4P_check : ∀ a : Fin 6, contains (CB2_1_5I2R4Raw a) (CB2_1_5I2R4P a) = true := by + decide +kernel +lemma CB2_1_5I2R4P_sound (a : Fin 6) : + (CB2_1_5I2R4P a).Encloses (CB2_1_5I2R4Value a) := + contains_sound (CB2_1_5I2R4Raw_sound a) (CB2_1_5I2R4P_check a) +def CB2_1_5I2R4Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_1_5I2R4Certificates (CB2_1_5I2R4CertificateIndex a)).output +lemma CB2_1_5I2R4Terms_sound (a : Fin 6) : + (CB2_1_5I2R4Terms a).Encloses (Foundation.entropyTerm (CB2_1_5I2R4Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB2_1_5I2R4Certificates_valid + (CB2_1_5I2R4CertificateIndex a) (CB2_1_5I2R4P_sound a) +def CB2_1_5I2R4Entropy : Ball := ⟨0, 0⟩ +lemma CB2_1_5I2R4Entropy_sound : CB2_1_5I2R4Entropy.Encloses (Foundation.finiteEntropy CB2_1_5I2R4Value) := by + exact contains_sound (entropyFin_enclosed 6 CB2_1_5I2R4Value CB2_1_5I2R4Terms CB2_1_5I2R4Terms_sound) (by decide +kernel) +def CB2_1_5I2R4Mass : Ball := ⟨0, 0⟩ +lemma CB2_1_5I2R4Mass_sound : CB2_1_5I2R4Mass.Encloses (∑ a, CB2_1_5I2R4Value a) := by + exact contains_sound (finSumBall_sound 6 CB2_1_5I2R4P CB2_1_5I2R4Value CB2_1_5I2R4P_sound) (by decide +kernel) +def CB2_1_5I2R4MassTerm : Ball := .exact 0 +lemma CB2_1_5I2R4MassTerm_sound : CB2_1_5I2R4MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB2_1_5I2R4Value a))) := + entropyTerm_zero_ball (CB2_1_5I2R4Mass_sound) +def CB2_1_5I2R4H : Ball := ⟨0, 0⟩ +lemma CB2_1_5I2R4H_sound : CB2_1_5I2R4H.Encloses (homogeneousEntropy CB2_1_5I2R4Value) := by + exact contains_sound (homogeneous_enclosed CB2_1_5I2R4Value CB2_1_5I2R4MassTerm_sound CB2_1_5I2R4Entropy_sound) (by decide +kernel) +def CB2_1_5I2R5Value (a : Fin 6) : ℝ := residualLaw (below (shape 2 1 5)) (fun u => (stageBLaw (shape 2 1 5) u : ℝ)) (stageBPriority (shape 2 1 5)) 2 (fun u a => (littleLaw (shape 2 1 5) u ((stageBPriority (shape 2 1 5)) 2) a : ℝ)) 5 a +def CB2_1_5I2R5Raw (a : Fin 6) : Ball := residualBall (below (shape 2 1 5)) B2_1_5Law (stageBPriority (shape 2 1 5)) 2 (fun u => B2_1_5Little u ((stageBPriority (shape 2 1 5)) 2)) 5 a +lemma CB2_1_5I2R5Raw_sound (a : Fin 6) : + (CB2_1_5I2R5Raw a).Encloses (CB2_1_5I2R5Value a) := by + exact residualBall_sound_on (below (shape 2 1 5)) B2_1_5Law (fun u => (stageBLaw (shape 2 1 5) u : ℝ)) (stageBPriority (shape 2 1 5)) 2 (fun u => B2_1_5Little u ((stageBPriority (shape 2 1 5)) 2)) (fun u a => (littleLaw (shape 2 1 5) u ((stageBPriority (shape 2 1 5)) 2) a : ℝ)) (fun u _ => B2_1_5Law_sound u) (fun u _ a => B2_1_5Little_sound u ((stageBPriority (shape 2 1 5)) 2) a) 5 a +def CB2_1_5I2R5Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB2_1_5I2R5Certificates_valid : + CB2_1_5I2R5Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB2_1_5I2R5CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB2_1_5I2R5P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_1_5I2R5Certificates (CB2_1_5I2R5CertificateIndex a)).input +lemma CB2_1_5I2R5P_check : ∀ a : Fin 6, contains (CB2_1_5I2R5Raw a) (CB2_1_5I2R5P a) = true := by + decide +kernel +lemma CB2_1_5I2R5P_sound (a : Fin 6) : + (CB2_1_5I2R5P a).Encloses (CB2_1_5I2R5Value a) := + contains_sound (CB2_1_5I2R5Raw_sound a) (CB2_1_5I2R5P_check a) +def CB2_1_5I2R5Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_1_5I2R5Certificates (CB2_1_5I2R5CertificateIndex a)).output +lemma CB2_1_5I2R5Terms_sound (a : Fin 6) : + (CB2_1_5I2R5Terms a).Encloses (Foundation.entropyTerm (CB2_1_5I2R5Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB2_1_5I2R5Certificates_valid + (CB2_1_5I2R5CertificateIndex a) (CB2_1_5I2R5P_sound a) +def CB2_1_5I2R5Entropy : Ball := ⟨0, 0⟩ +lemma CB2_1_5I2R5Entropy_sound : CB2_1_5I2R5Entropy.Encloses (Foundation.finiteEntropy CB2_1_5I2R5Value) := by + exact contains_sound (entropyFin_enclosed 6 CB2_1_5I2R5Value CB2_1_5I2R5Terms CB2_1_5I2R5Terms_sound) (by decide +kernel) +def CB2_1_5I2R5Mass : Ball := ⟨0, 0⟩ +lemma CB2_1_5I2R5Mass_sound : CB2_1_5I2R5Mass.Encloses (∑ a, CB2_1_5I2R5Value a) := by + exact contains_sound (finSumBall_sound 6 CB2_1_5I2R5P CB2_1_5I2R5Value CB2_1_5I2R5P_sound) (by decide +kernel) +def CB2_1_5I2R5MassTerm : Ball := .exact 0 +lemma CB2_1_5I2R5MassTerm_sound : CB2_1_5I2R5MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB2_1_5I2R5Value a))) := + entropyTerm_zero_ball (CB2_1_5I2R5Mass_sound) +def CB2_1_5I2R5H : Ball := ⟨0, 0⟩ +lemma CB2_1_5I2R5H_sound : CB2_1_5I2R5H.Encloses (homogeneousEntropy CB2_1_5I2R5Value) := by + exact contains_sound (homogeneous_enclosed CB2_1_5I2R5Value CB2_1_5I2R5MassTerm_sound CB2_1_5I2R5Entropy_sound) (by decide +kernel) +def CB2_1_5I2R6Value (a : Fin 6) : ℝ := residualLaw (below (shape 2 1 5)) (fun u => (stageBLaw (shape 2 1 5) u : ℝ)) (stageBPriority (shape 2 1 5)) 2 (fun u a => (littleLaw (shape 2 1 5) u ((stageBPriority (shape 2 1 5)) 2) a : ℝ)) 6 a +def CB2_1_5I2R6Raw (a : Fin 6) : Ball := residualBall (below (shape 2 1 5)) B2_1_5Law (stageBPriority (shape 2 1 5)) 2 (fun u => B2_1_5Little u ((stageBPriority (shape 2 1 5)) 2)) 6 a +lemma CB2_1_5I2R6Raw_sound (a : Fin 6) : + (CB2_1_5I2R6Raw a).Encloses (CB2_1_5I2R6Value a) := by + exact residualBall_sound_on (below (shape 2 1 5)) B2_1_5Law (fun u => (stageBLaw (shape 2 1 5) u : ℝ)) (stageBPriority (shape 2 1 5)) 2 (fun u => B2_1_5Little u ((stageBPriority (shape 2 1 5)) 2)) (fun u a => (littleLaw (shape 2 1 5) u ((stageBPriority (shape 2 1 5)) 2) a : ℝ)) (fun u _ => B2_1_5Law_sound u) (fun u _ a => B2_1_5Little_sound u ((stageBPriority (shape 2 1 5)) 2) a) 6 a +def CB2_1_5I2R6Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB2_1_5I2R6Certificates_valid : + CB2_1_5I2R6Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB2_1_5I2R6CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB2_1_5I2R6P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_1_5I2R6Certificates (CB2_1_5I2R6CertificateIndex a)).input +lemma CB2_1_5I2R6P_check : ∀ a : Fin 6, contains (CB2_1_5I2R6Raw a) (CB2_1_5I2R6P a) = true := by + decide +kernel +lemma CB2_1_5I2R6P_sound (a : Fin 6) : + (CB2_1_5I2R6P a).Encloses (CB2_1_5I2R6Value a) := + contains_sound (CB2_1_5I2R6Raw_sound a) (CB2_1_5I2R6P_check a) +def CB2_1_5I2R6Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_1_5I2R6Certificates (CB2_1_5I2R6CertificateIndex a)).output +lemma CB2_1_5I2R6Terms_sound (a : Fin 6) : + (CB2_1_5I2R6Terms a).Encloses (Foundation.entropyTerm (CB2_1_5I2R6Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB2_1_5I2R6Certificates_valid + (CB2_1_5I2R6CertificateIndex a) (CB2_1_5I2R6P_sound a) +def CB2_1_5I2R6Entropy : Ball := ⟨0, 0⟩ +lemma CB2_1_5I2R6Entropy_sound : CB2_1_5I2R6Entropy.Encloses (Foundation.finiteEntropy CB2_1_5I2R6Value) := by + exact contains_sound (entropyFin_enclosed 6 CB2_1_5I2R6Value CB2_1_5I2R6Terms CB2_1_5I2R6Terms_sound) (by decide +kernel) +def CB2_1_5I2R6Mass : Ball := ⟨0, 0⟩ +lemma CB2_1_5I2R6Mass_sound : CB2_1_5I2R6Mass.Encloses (∑ a, CB2_1_5I2R6Value a) := by + exact contains_sound (finSumBall_sound 6 CB2_1_5I2R6P CB2_1_5I2R6Value CB2_1_5I2R6P_sound) (by decide +kernel) +def CB2_1_5I2R6MassTerm : Ball := .exact 0 +lemma CB2_1_5I2R6MassTerm_sound : CB2_1_5I2R6MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB2_1_5I2R6Value a))) := + entropyTerm_zero_ball (CB2_1_5I2R6Mass_sound) +def CB2_1_5I2R6H : Ball := ⟨0, 0⟩ +lemma CB2_1_5I2R6H_sound : CB2_1_5I2R6H.Encloses (homogeneousEntropy CB2_1_5I2R6Value) := by + exact contains_sound (homogeneous_enclosed CB2_1_5I2R6Value CB2_1_5I2R6MassTerm_sound CB2_1_5I2R6Entropy_sound) (by decide +kernel) +def CB2_1_5I2R7Value (a : Fin 6) : ℝ := residualLaw (below (shape 2 1 5)) (fun u => (stageBLaw (shape 2 1 5) u : ℝ)) (stageBPriority (shape 2 1 5)) 2 (fun u a => (littleLaw (shape 2 1 5) u ((stageBPriority (shape 2 1 5)) 2) a : ℝ)) 7 a +def CB2_1_5I2R7Raw (a : Fin 6) : Ball := residualBall (below (shape 2 1 5)) B2_1_5Law (stageBPriority (shape 2 1 5)) 2 (fun u => B2_1_5Little u ((stageBPriority (shape 2 1 5)) 2)) 7 a +lemma CB2_1_5I2R7Raw_sound (a : Fin 6) : + (CB2_1_5I2R7Raw a).Encloses (CB2_1_5I2R7Value a) := by + exact residualBall_sound_on (below (shape 2 1 5)) B2_1_5Law (fun u => (stageBLaw (shape 2 1 5) u : ℝ)) (stageBPriority (shape 2 1 5)) 2 (fun u => B2_1_5Little u ((stageBPriority (shape 2 1 5)) 2)) (fun u a => (littleLaw (shape 2 1 5) u ((stageBPriority (shape 2 1 5)) 2) a : ℝ)) (fun u _ => B2_1_5Law_sound u) (fun u _ a => B2_1_5Little_sound u ((stageBPriority (shape 2 1 5)) 2) a) 7 a +def CB2_1_5I2R7Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB2_1_5I2R7Certificates_valid : + CB2_1_5I2R7Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB2_1_5I2R7CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB2_1_5I2R7P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_1_5I2R7Certificates (CB2_1_5I2R7CertificateIndex a)).input +lemma CB2_1_5I2R7P_check : ∀ a : Fin 6, contains (CB2_1_5I2R7Raw a) (CB2_1_5I2R7P a) = true := by + decide +kernel +lemma CB2_1_5I2R7P_sound (a : Fin 6) : + (CB2_1_5I2R7P a).Encloses (CB2_1_5I2R7Value a) := + contains_sound (CB2_1_5I2R7Raw_sound a) (CB2_1_5I2R7P_check a) +def CB2_1_5I2R7Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_1_5I2R7Certificates (CB2_1_5I2R7CertificateIndex a)).output +lemma CB2_1_5I2R7Terms_sound (a : Fin 6) : + (CB2_1_5I2R7Terms a).Encloses (Foundation.entropyTerm (CB2_1_5I2R7Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB2_1_5I2R7Certificates_valid + (CB2_1_5I2R7CertificateIndex a) (CB2_1_5I2R7P_sound a) +def CB2_1_5I2R7Entropy : Ball := ⟨0, 0⟩ +lemma CB2_1_5I2R7Entropy_sound : CB2_1_5I2R7Entropy.Encloses (Foundation.finiteEntropy CB2_1_5I2R7Value) := by + exact contains_sound (entropyFin_enclosed 6 CB2_1_5I2R7Value CB2_1_5I2R7Terms CB2_1_5I2R7Terms_sound) (by decide +kernel) +def CB2_1_5I2R7Mass : Ball := ⟨0, 0⟩ +lemma CB2_1_5I2R7Mass_sound : CB2_1_5I2R7Mass.Encloses (∑ a, CB2_1_5I2R7Value a) := by + exact contains_sound (finSumBall_sound 6 CB2_1_5I2R7P CB2_1_5I2R7Value CB2_1_5I2R7P_sound) (by decide +kernel) +def CB2_1_5I2R7MassTerm : Ball := .exact 0 +lemma CB2_1_5I2R7MassTerm_sound : CB2_1_5I2R7MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB2_1_5I2R7Value a))) := + entropyTerm_zero_ball (CB2_1_5I2R7Mass_sound) +def CB2_1_5I2R7H : Ball := ⟨0, 0⟩ +lemma CB2_1_5I2R7H_sound : CB2_1_5I2R7H.Encloses (homogeneousEntropy CB2_1_5I2R7Value) := by + exact contains_sound (homogeneous_enclosed CB2_1_5I2R7Value CB2_1_5I2R7MassTerm_sound CB2_1_5I2R7Entropy_sound) (by decide +kernel) +def CB2_1_5I2R8Value (a : Fin 6) : ℝ := residualLaw (below (shape 2 1 5)) (fun u => (stageBLaw (shape 2 1 5) u : ℝ)) (stageBPriority (shape 2 1 5)) 2 (fun u a => (littleLaw (shape 2 1 5) u ((stageBPriority (shape 2 1 5)) 2) a : ℝ)) 8 a +def CB2_1_5I2R8Raw (a : Fin 6) : Ball := residualBall (below (shape 2 1 5)) B2_1_5Law (stageBPriority (shape 2 1 5)) 2 (fun u => B2_1_5Little u ((stageBPriority (shape 2 1 5)) 2)) 8 a +lemma CB2_1_5I2R8Raw_sound (a : Fin 6) : + (CB2_1_5I2R8Raw a).Encloses (CB2_1_5I2R8Value a) := by + exact residualBall_sound_on (below (shape 2 1 5)) B2_1_5Law (fun u => (stageBLaw (shape 2 1 5) u : ℝ)) (stageBPriority (shape 2 1 5)) 2 (fun u => B2_1_5Little u ((stageBPriority (shape 2 1 5)) 2)) (fun u a => (littleLaw (shape 2 1 5) u ((stageBPriority (shape 2 1 5)) 2) a : ℝ)) (fun u _ => B2_1_5Law_sound u) (fun u _ a => B2_1_5Little_sound u ((stageBPriority (shape 2 1 5)) 2) a) 8 a +def CB2_1_5I2R8Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB2_1_5I2R8Certificates_valid : + CB2_1_5I2R8Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB2_1_5I2R8CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB2_1_5I2R8P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_1_5I2R8Certificates (CB2_1_5I2R8CertificateIndex a)).input +lemma CB2_1_5I2R8P_check : ∀ a : Fin 6, contains (CB2_1_5I2R8Raw a) (CB2_1_5I2R8P a) = true := by + decide +kernel +lemma CB2_1_5I2R8P_sound (a : Fin 6) : + (CB2_1_5I2R8P a).Encloses (CB2_1_5I2R8Value a) := + contains_sound (CB2_1_5I2R8Raw_sound a) (CB2_1_5I2R8P_check a) +def CB2_1_5I2R8Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_1_5I2R8Certificates (CB2_1_5I2R8CertificateIndex a)).output +lemma CB2_1_5I2R8Terms_sound (a : Fin 6) : + (CB2_1_5I2R8Terms a).Encloses (Foundation.entropyTerm (CB2_1_5I2R8Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB2_1_5I2R8Certificates_valid + (CB2_1_5I2R8CertificateIndex a) (CB2_1_5I2R8P_sound a) +def CB2_1_5I2R8Entropy : Ball := ⟨0, 0⟩ +lemma CB2_1_5I2R8Entropy_sound : CB2_1_5I2R8Entropy.Encloses (Foundation.finiteEntropy CB2_1_5I2R8Value) := by + exact contains_sound (entropyFin_enclosed 6 CB2_1_5I2R8Value CB2_1_5I2R8Terms CB2_1_5I2R8Terms_sound) (by decide +kernel) +def CB2_1_5I2R8Mass : Ball := ⟨0, 0⟩ +lemma CB2_1_5I2R8Mass_sound : CB2_1_5I2R8Mass.Encloses (∑ a, CB2_1_5I2R8Value a) := by + exact contains_sound (finSumBall_sound 6 CB2_1_5I2R8P CB2_1_5I2R8Value CB2_1_5I2R8P_sound) (by decide +kernel) +def CB2_1_5I2R8MassTerm : Ball := .exact 0 +lemma CB2_1_5I2R8MassTerm_sound : CB2_1_5I2R8MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB2_1_5I2R8Value a))) := + entropyTerm_zero_ball (CB2_1_5I2R8Mass_sound) +def CB2_1_5I2R8H : Ball := ⟨0, 0⟩ +lemma CB2_1_5I2R8H_sound : CB2_1_5I2R8H.Encloses (homogeneousEntropy CB2_1_5I2R8Value) := by + exact contains_sound (homogeneous_enclosed CB2_1_5I2R8Value CB2_1_5I2R8MassTerm_sound CB2_1_5I2R8Entropy_sound) (by decide +kernel) +def CB2_1_5I2R9Value (a : Fin 6) : ℝ := residualLaw (below (shape 2 1 5)) (fun u => (stageBLaw (shape 2 1 5) u : ℝ)) (stageBPriority (shape 2 1 5)) 2 (fun u a => (littleLaw (shape 2 1 5) u ((stageBPriority (shape 2 1 5)) 2) a : ℝ)) 9 a +def CB2_1_5I2R9Raw (a : Fin 6) : Ball := residualBall (below (shape 2 1 5)) B2_1_5Law (stageBPriority (shape 2 1 5)) 2 (fun u => B2_1_5Little u ((stageBPriority (shape 2 1 5)) 2)) 9 a +lemma CB2_1_5I2R9Raw_sound (a : Fin 6) : + (CB2_1_5I2R9Raw a).Encloses (CB2_1_5I2R9Value a) := by + exact residualBall_sound_on (below (shape 2 1 5)) B2_1_5Law (fun u => (stageBLaw (shape 2 1 5) u : ℝ)) (stageBPriority (shape 2 1 5)) 2 (fun u => B2_1_5Little u ((stageBPriority (shape 2 1 5)) 2)) (fun u a => (littleLaw (shape 2 1 5) u ((stageBPriority (shape 2 1 5)) 2) a : ℝ)) (fun u _ => B2_1_5Law_sound u) (fun u _ a => B2_1_5Little_sound u ((stageBPriority (shape 2 1 5)) 2) a) 9 a +def CB2_1_5I2R9Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB2_1_5I2R9Certificates_valid : + CB2_1_5I2R9Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB2_1_5I2R9CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB2_1_5I2R9P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_1_5I2R9Certificates (CB2_1_5I2R9CertificateIndex a)).input +lemma CB2_1_5I2R9P_check : ∀ a : Fin 6, contains (CB2_1_5I2R9Raw a) (CB2_1_5I2R9P a) = true := by + decide +kernel +lemma CB2_1_5I2R9P_sound (a : Fin 6) : + (CB2_1_5I2R9P a).Encloses (CB2_1_5I2R9Value a) := + contains_sound (CB2_1_5I2R9Raw_sound a) (CB2_1_5I2R9P_check a) +def CB2_1_5I2R9Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_1_5I2R9Certificates (CB2_1_5I2R9CertificateIndex a)).output +lemma CB2_1_5I2R9Terms_sound (a : Fin 6) : + (CB2_1_5I2R9Terms a).Encloses (Foundation.entropyTerm (CB2_1_5I2R9Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB2_1_5I2R9Certificates_valid + (CB2_1_5I2R9CertificateIndex a) (CB2_1_5I2R9P_sound a) +def CB2_1_5I2R9Entropy : Ball := ⟨0, 0⟩ +lemma CB2_1_5I2R9Entropy_sound : CB2_1_5I2R9Entropy.Encloses (Foundation.finiteEntropy CB2_1_5I2R9Value) := by + exact contains_sound (entropyFin_enclosed 6 CB2_1_5I2R9Value CB2_1_5I2R9Terms CB2_1_5I2R9Terms_sound) (by decide +kernel) +def CB2_1_5I2R9Mass : Ball := ⟨0, 0⟩ +lemma CB2_1_5I2R9Mass_sound : CB2_1_5I2R9Mass.Encloses (∑ a, CB2_1_5I2R9Value a) := by + exact contains_sound (finSumBall_sound 6 CB2_1_5I2R9P CB2_1_5I2R9Value CB2_1_5I2R9P_sound) (by decide +kernel) +def CB2_1_5I2R9MassTerm : Ball := .exact 0 +lemma CB2_1_5I2R9MassTerm_sound : CB2_1_5I2R9MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB2_1_5I2R9Value a))) := + entropyTerm_zero_ball (CB2_1_5I2R9Mass_sound) +def CB2_1_5I2R9H : Ball := ⟨0, 0⟩ +lemma CB2_1_5I2R9H_sound : CB2_1_5I2R9H.Encloses (homogeneousEntropy CB2_1_5I2R9Value) := by + exact contains_sound (homogeneous_enclosed CB2_1_5I2R9Value CB2_1_5I2R9MassTerm_sound CB2_1_5I2R9Entropy_sound) (by decide +kernel) +def CB2_1_5I2R10Value (a : Fin 6) : ℝ := residualLaw (below (shape 2 1 5)) (fun u => (stageBLaw (shape 2 1 5) u : ℝ)) (stageBPriority (shape 2 1 5)) 2 (fun u a => (littleLaw (shape 2 1 5) u ((stageBPriority (shape 2 1 5)) 2) a : ℝ)) 10 a +def CB2_1_5I2R10Raw (a : Fin 6) : Ball := residualBall (below (shape 2 1 5)) B2_1_5Law (stageBPriority (shape 2 1 5)) 2 (fun u => B2_1_5Little u ((stageBPriority (shape 2 1 5)) 2)) 10 a +lemma CB2_1_5I2R10Raw_sound (a : Fin 6) : + (CB2_1_5I2R10Raw a).Encloses (CB2_1_5I2R10Value a) := by + exact residualBall_sound_on (below (shape 2 1 5)) B2_1_5Law (fun u => (stageBLaw (shape 2 1 5) u : ℝ)) (stageBPriority (shape 2 1 5)) 2 (fun u => B2_1_5Little u ((stageBPriority (shape 2 1 5)) 2)) (fun u a => (littleLaw (shape 2 1 5) u ((stageBPriority (shape 2 1 5)) 2) a : ℝ)) (fun u _ => B2_1_5Law_sound u) (fun u _ a => B2_1_5Little_sound u ((stageBPriority (shape 2 1 5)) 2) a) 10 a +def CB2_1_5I2R10Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB2_1_5I2R10Certificates_valid : + CB2_1_5I2R10Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB2_1_5I2R10CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB2_1_5I2R10P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_1_5I2R10Certificates (CB2_1_5I2R10CertificateIndex a)).input +lemma CB2_1_5I2R10P_check : ∀ a : Fin 6, contains (CB2_1_5I2R10Raw a) (CB2_1_5I2R10P a) = true := by + decide +kernel +lemma CB2_1_5I2R10P_sound (a : Fin 6) : + (CB2_1_5I2R10P a).Encloses (CB2_1_5I2R10Value a) := + contains_sound (CB2_1_5I2R10Raw_sound a) (CB2_1_5I2R10P_check a) +def CB2_1_5I2R10Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_1_5I2R10Certificates (CB2_1_5I2R10CertificateIndex a)).output +lemma CB2_1_5I2R10Terms_sound (a : Fin 6) : + (CB2_1_5I2R10Terms a).Encloses (Foundation.entropyTerm (CB2_1_5I2R10Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB2_1_5I2R10Certificates_valid + (CB2_1_5I2R10CertificateIndex a) (CB2_1_5I2R10P_sound a) +def CB2_1_5I2R10Entropy : Ball := ⟨0, 0⟩ +lemma CB2_1_5I2R10Entropy_sound : CB2_1_5I2R10Entropy.Encloses (Foundation.finiteEntropy CB2_1_5I2R10Value) := by + exact contains_sound (entropyFin_enclosed 6 CB2_1_5I2R10Value CB2_1_5I2R10Terms CB2_1_5I2R10Terms_sound) (by decide +kernel) +def CB2_1_5I2R10Mass : Ball := ⟨0, 0⟩ +lemma CB2_1_5I2R10Mass_sound : CB2_1_5I2R10Mass.Encloses (∑ a, CB2_1_5I2R10Value a) := by + exact contains_sound (finSumBall_sound 6 CB2_1_5I2R10P CB2_1_5I2R10Value CB2_1_5I2R10P_sound) (by decide +kernel) +def CB2_1_5I2R10MassTerm : Ball := .exact 0 +lemma CB2_1_5I2R10MassTerm_sound : CB2_1_5I2R10MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB2_1_5I2R10Value a))) := + entropyTerm_zero_ball (CB2_1_5I2R10Mass_sound) +def CB2_1_5I2R10H : Ball := ⟨0, 0⟩ +lemma CB2_1_5I2R10H_sound : CB2_1_5I2R10H.Encloses (homogeneousEntropy CB2_1_5I2R10Value) := by + exact contains_sound (homogeneous_enclosed CB2_1_5I2R10Value CB2_1_5I2R10MassTerm_sound CB2_1_5I2R10Entropy_sound) (by decide +kernel) +def CB2_1_5I2R11Value (a : Fin 6) : ℝ := residualLaw (below (shape 2 1 5)) (fun u => (stageBLaw (shape 2 1 5) u : ℝ)) (stageBPriority (shape 2 1 5)) 2 (fun u a => (littleLaw (shape 2 1 5) u ((stageBPriority (shape 2 1 5)) 2) a : ℝ)) 11 a +def CB2_1_5I2R11Raw (a : Fin 6) : Ball := residualBall (below (shape 2 1 5)) B2_1_5Law (stageBPriority (shape 2 1 5)) 2 (fun u => B2_1_5Little u ((stageBPriority (shape 2 1 5)) 2)) 11 a +lemma CB2_1_5I2R11Raw_sound (a : Fin 6) : + (CB2_1_5I2R11Raw a).Encloses (CB2_1_5I2R11Value a) := by + exact residualBall_sound_on (below (shape 2 1 5)) B2_1_5Law (fun u => (stageBLaw (shape 2 1 5) u : ℝ)) (stageBPriority (shape 2 1 5)) 2 (fun u => B2_1_5Little u ((stageBPriority (shape 2 1 5)) 2)) (fun u a => (littleLaw (shape 2 1 5) u ((stageBPriority (shape 2 1 5)) 2) a : ℝ)) (fun u _ => B2_1_5Law_sound u) (fun u _ a => B2_1_5Little_sound u ((stageBPriority (shape 2 1 5)) 2) a) 11 a +def CB2_1_5I2R11Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB2_1_5I2R11Certificates_valid : + CB2_1_5I2R11Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB2_1_5I2R11CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB2_1_5I2R11P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_1_5I2R11Certificates (CB2_1_5I2R11CertificateIndex a)).input +lemma CB2_1_5I2R11P_check : ∀ a : Fin 6, contains (CB2_1_5I2R11Raw a) (CB2_1_5I2R11P a) = true := by + decide +kernel +lemma CB2_1_5I2R11P_sound (a : Fin 6) : + (CB2_1_5I2R11P a).Encloses (CB2_1_5I2R11Value a) := + contains_sound (CB2_1_5I2R11Raw_sound a) (CB2_1_5I2R11P_check a) +def CB2_1_5I2R11Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_1_5I2R11Certificates (CB2_1_5I2R11CertificateIndex a)).output +lemma CB2_1_5I2R11Terms_sound (a : Fin 6) : + (CB2_1_5I2R11Terms a).Encloses (Foundation.entropyTerm (CB2_1_5I2R11Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB2_1_5I2R11Certificates_valid + (CB2_1_5I2R11CertificateIndex a) (CB2_1_5I2R11P_sound a) +def CB2_1_5I2R11Entropy : Ball := ⟨0, 0⟩ +lemma CB2_1_5I2R11Entropy_sound : CB2_1_5I2R11Entropy.Encloses (Foundation.finiteEntropy CB2_1_5I2R11Value) := by + exact contains_sound (entropyFin_enclosed 6 CB2_1_5I2R11Value CB2_1_5I2R11Terms CB2_1_5I2R11Terms_sound) (by decide +kernel) +def CB2_1_5I2R11Mass : Ball := ⟨0, 0⟩ +lemma CB2_1_5I2R11Mass_sound : CB2_1_5I2R11Mass.Encloses (∑ a, CB2_1_5I2R11Value a) := by + exact contains_sound (finSumBall_sound 6 CB2_1_5I2R11P CB2_1_5I2R11Value CB2_1_5I2R11P_sound) (by decide +kernel) +def CB2_1_5I2R11MassTerm : Ball := .exact 0 +lemma CB2_1_5I2R11MassTerm_sound : CB2_1_5I2R11MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB2_1_5I2R11Value a))) := + entropyTerm_zero_ball (CB2_1_5I2R11Mass_sound) +def CB2_1_5I2R11H : Ball := ⟨0, 0⟩ +lemma CB2_1_5I2R11H_sound : CB2_1_5I2R11H.Encloses (homogeneousEntropy CB2_1_5I2R11Value) := by + exact contains_sound (homogeneous_enclosed CB2_1_5I2R11Value CB2_1_5I2R11MassTerm_sound CB2_1_5I2R11Entropy_sound) (by decide +kernel) +def CB2_1_5I2R12Value (a : Fin 6) : ℝ := residualLaw (below (shape 2 1 5)) (fun u => (stageBLaw (shape 2 1 5) u : ℝ)) (stageBPriority (shape 2 1 5)) 2 (fun u a => (littleLaw (shape 2 1 5) u ((stageBPriority (shape 2 1 5)) 2) a : ℝ)) 12 a +def CB2_1_5I2R12Raw (a : Fin 6) : Ball := residualBall (below (shape 2 1 5)) B2_1_5Law (stageBPriority (shape 2 1 5)) 2 (fun u => B2_1_5Little u ((stageBPriority (shape 2 1 5)) 2)) 12 a +lemma CB2_1_5I2R12Raw_sound (a : Fin 6) : + (CB2_1_5I2R12Raw a).Encloses (CB2_1_5I2R12Value a) := by + exact residualBall_sound_on (below (shape 2 1 5)) B2_1_5Law (fun u => (stageBLaw (shape 2 1 5) u : ℝ)) (stageBPriority (shape 2 1 5)) 2 (fun u => B2_1_5Little u ((stageBPriority (shape 2 1 5)) 2)) (fun u a => (littleLaw (shape 2 1 5) u ((stageBPriority (shape 2 1 5)) 2) a : ℝ)) (fun u _ => B2_1_5Law_sound u) (fun u _ a => B2_1_5Little_sound u ((stageBPriority (shape 2 1 5)) 2) a) 12 a +def CB2_1_5I2R12Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB2_1_5I2R12Certificates_valid : + CB2_1_5I2R12Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB2_1_5I2R12CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB2_1_5I2R12P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_1_5I2R12Certificates (CB2_1_5I2R12CertificateIndex a)).input +lemma CB2_1_5I2R12P_check : ∀ a : Fin 6, contains (CB2_1_5I2R12Raw a) (CB2_1_5I2R12P a) = true := by + decide +kernel +lemma CB2_1_5I2R12P_sound (a : Fin 6) : + (CB2_1_5I2R12P a).Encloses (CB2_1_5I2R12Value a) := + contains_sound (CB2_1_5I2R12Raw_sound a) (CB2_1_5I2R12P_check a) +def CB2_1_5I2R12Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_1_5I2R12Certificates (CB2_1_5I2R12CertificateIndex a)).output +lemma CB2_1_5I2R12Terms_sound (a : Fin 6) : + (CB2_1_5I2R12Terms a).Encloses (Foundation.entropyTerm (CB2_1_5I2R12Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB2_1_5I2R12Certificates_valid + (CB2_1_5I2R12CertificateIndex a) (CB2_1_5I2R12P_sound a) +def CB2_1_5I2R12Entropy : Ball := ⟨0, 0⟩ +lemma CB2_1_5I2R12Entropy_sound : CB2_1_5I2R12Entropy.Encloses (Foundation.finiteEntropy CB2_1_5I2R12Value) := by + exact contains_sound (entropyFin_enclosed 6 CB2_1_5I2R12Value CB2_1_5I2R12Terms CB2_1_5I2R12Terms_sound) (by decide +kernel) +def CB2_1_5I2R12Mass : Ball := ⟨0, 0⟩ +lemma CB2_1_5I2R12Mass_sound : CB2_1_5I2R12Mass.Encloses (∑ a, CB2_1_5I2R12Value a) := by + exact contains_sound (finSumBall_sound 6 CB2_1_5I2R12P CB2_1_5I2R12Value CB2_1_5I2R12P_sound) (by decide +kernel) +def CB2_1_5I2R12MassTerm : Ball := .exact 0 +lemma CB2_1_5I2R12MassTerm_sound : CB2_1_5I2R12MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB2_1_5I2R12Value a))) := + entropyTerm_zero_ball (CB2_1_5I2R12Mass_sound) +def CB2_1_5I2R12H : Ball := ⟨0, 0⟩ +lemma CB2_1_5I2R12H_sound : CB2_1_5I2R12H.Encloses (homogeneousEntropy CB2_1_5I2R12Value) := by + exact contains_sound (homogeneous_enclosed CB2_1_5I2R12Value CB2_1_5I2R12MassTerm_sound CB2_1_5I2R12Entropy_sound) (by decide +kernel) +def CB2_1_5I2R13Value (a : Fin 6) : ℝ := residualLaw (below (shape 2 1 5)) (fun u => (stageBLaw (shape 2 1 5) u : ℝ)) (stageBPriority (shape 2 1 5)) 2 (fun u a => (littleLaw (shape 2 1 5) u ((stageBPriority (shape 2 1 5)) 2) a : ℝ)) 13 a +def CB2_1_5I2R13Raw (a : Fin 6) : Ball := residualBall (below (shape 2 1 5)) B2_1_5Law (stageBPriority (shape 2 1 5)) 2 (fun u => B2_1_5Little u ((stageBPriority (shape 2 1 5)) 2)) 13 a +lemma CB2_1_5I2R13Raw_sound (a : Fin 6) : + (CB2_1_5I2R13Raw a).Encloses (CB2_1_5I2R13Value a) := by + exact residualBall_sound_on (below (shape 2 1 5)) B2_1_5Law (fun u => (stageBLaw (shape 2 1 5) u : ℝ)) (stageBPriority (shape 2 1 5)) 2 (fun u => B2_1_5Little u ((stageBPriority (shape 2 1 5)) 2)) (fun u a => (littleLaw (shape 2 1 5) u ((stageBPriority (shape 2 1 5)) 2) a : ℝ)) (fun u _ => B2_1_5Law_sound u) (fun u _ a => B2_1_5Little_sound u ((stageBPriority (shape 2 1 5)) 2) a) 13 a +def CB2_1_5I2R13Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB2_1_5I2R13Certificates_valid : + CB2_1_5I2R13Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB2_1_5I2R13CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB2_1_5I2R13P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_1_5I2R13Certificates (CB2_1_5I2R13CertificateIndex a)).input +lemma CB2_1_5I2R13P_check : ∀ a : Fin 6, contains (CB2_1_5I2R13Raw a) (CB2_1_5I2R13P a) = true := by + decide +kernel +lemma CB2_1_5I2R13P_sound (a : Fin 6) : + (CB2_1_5I2R13P a).Encloses (CB2_1_5I2R13Value a) := + contains_sound (CB2_1_5I2R13Raw_sound a) (CB2_1_5I2R13P_check a) +def CB2_1_5I2R13Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_1_5I2R13Certificates (CB2_1_5I2R13CertificateIndex a)).output +lemma CB2_1_5I2R13Terms_sound (a : Fin 6) : + (CB2_1_5I2R13Terms a).Encloses (Foundation.entropyTerm (CB2_1_5I2R13Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB2_1_5I2R13Certificates_valid + (CB2_1_5I2R13CertificateIndex a) (CB2_1_5I2R13P_sound a) +def CB2_1_5I2R13Entropy : Ball := ⟨0, 0⟩ +lemma CB2_1_5I2R13Entropy_sound : CB2_1_5I2R13Entropy.Encloses (Foundation.finiteEntropy CB2_1_5I2R13Value) := by + exact contains_sound (entropyFin_enclosed 6 CB2_1_5I2R13Value CB2_1_5I2R13Terms CB2_1_5I2R13Terms_sound) (by decide +kernel) +def CB2_1_5I2R13Mass : Ball := ⟨0, 0⟩ +lemma CB2_1_5I2R13Mass_sound : CB2_1_5I2R13Mass.Encloses (∑ a, CB2_1_5I2R13Value a) := by + exact contains_sound (finSumBall_sound 6 CB2_1_5I2R13P CB2_1_5I2R13Value CB2_1_5I2R13P_sound) (by decide +kernel) +def CB2_1_5I2R13MassTerm : Ball := .exact 0 +lemma CB2_1_5I2R13MassTerm_sound : CB2_1_5I2R13MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB2_1_5I2R13Value a))) := + entropyTerm_zero_ball (CB2_1_5I2R13Mass_sound) +def CB2_1_5I2R13H : Ball := ⟨0, 0⟩ +lemma CB2_1_5I2R13H_sound : CB2_1_5I2R13H.Encloses (homogeneousEntropy CB2_1_5I2R13Value) := by + exact contains_sound (homogeneous_enclosed CB2_1_5I2R13Value CB2_1_5I2R13MassTerm_sound CB2_1_5I2R13Entropy_sound) (by decide +kernel) +def CB2_1_5I2R14Value (a : Fin 6) : ℝ := residualLaw (below (shape 2 1 5)) (fun u => (stageBLaw (shape 2 1 5) u : ℝ)) (stageBPriority (shape 2 1 5)) 2 (fun u a => (littleLaw (shape 2 1 5) u ((stageBPriority (shape 2 1 5)) 2) a : ℝ)) 14 a +def CB2_1_5I2R14Raw (a : Fin 6) : Ball := residualBall (below (shape 2 1 5)) B2_1_5Law (stageBPriority (shape 2 1 5)) 2 (fun u => B2_1_5Little u ((stageBPriority (shape 2 1 5)) 2)) 14 a +lemma CB2_1_5I2R14Raw_sound (a : Fin 6) : + (CB2_1_5I2R14Raw a).Encloses (CB2_1_5I2R14Value a) := by + exact residualBall_sound_on (below (shape 2 1 5)) B2_1_5Law (fun u => (stageBLaw (shape 2 1 5) u : ℝ)) (stageBPriority (shape 2 1 5)) 2 (fun u => B2_1_5Little u ((stageBPriority (shape 2 1 5)) 2)) (fun u a => (littleLaw (shape 2 1 5) u ((stageBPriority (shape 2 1 5)) 2) a : ℝ)) (fun u _ => B2_1_5Law_sound u) (fun u _ a => B2_1_5Little_sound u ((stageBPriority (shape 2 1 5)) 2) a) 14 a +def CB2_1_5I2R14Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB2_1_5I2R14Certificates_valid : + CB2_1_5I2R14Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB2_1_5I2R14CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB2_1_5I2R14P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_1_5I2R14Certificates (CB2_1_5I2R14CertificateIndex a)).input +lemma CB2_1_5I2R14P_check : ∀ a : Fin 6, contains (CB2_1_5I2R14Raw a) (CB2_1_5I2R14P a) = true := by + decide +kernel +lemma CB2_1_5I2R14P_sound (a : Fin 6) : + (CB2_1_5I2R14P a).Encloses (CB2_1_5I2R14Value a) := + contains_sound (CB2_1_5I2R14Raw_sound a) (CB2_1_5I2R14P_check a) +def CB2_1_5I2R14Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_1_5I2R14Certificates (CB2_1_5I2R14CertificateIndex a)).output +lemma CB2_1_5I2R14Terms_sound (a : Fin 6) : + (CB2_1_5I2R14Terms a).Encloses (Foundation.entropyTerm (CB2_1_5I2R14Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB2_1_5I2R14Certificates_valid + (CB2_1_5I2R14CertificateIndex a) (CB2_1_5I2R14P_sound a) +def CB2_1_5I2R14Entropy : Ball := ⟨0, 0⟩ +lemma CB2_1_5I2R14Entropy_sound : CB2_1_5I2R14Entropy.Encloses (Foundation.finiteEntropy CB2_1_5I2R14Value) := by + exact contains_sound (entropyFin_enclosed 6 CB2_1_5I2R14Value CB2_1_5I2R14Terms CB2_1_5I2R14Terms_sound) (by decide +kernel) +def CB2_1_5I2R14Mass : Ball := ⟨0, 0⟩ +lemma CB2_1_5I2R14Mass_sound : CB2_1_5I2R14Mass.Encloses (∑ a, CB2_1_5I2R14Value a) := by + exact contains_sound (finSumBall_sound 6 CB2_1_5I2R14P CB2_1_5I2R14Value CB2_1_5I2R14P_sound) (by decide +kernel) +def CB2_1_5I2R14MassTerm : Ball := .exact 0 +lemma CB2_1_5I2R14MassTerm_sound : CB2_1_5I2R14MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB2_1_5I2R14Value a))) := + entropyTerm_zero_ball (CB2_1_5I2R14Mass_sound) +def CB2_1_5I2R14H : Ball := ⟨0, 0⟩ +lemma CB2_1_5I2R14H_sound : CB2_1_5I2R14H.Encloses (homogeneousEntropy CB2_1_5I2R14Value) := by + exact contains_sound (homogeneous_enclosed CB2_1_5I2R14Value CB2_1_5I2R14MassTerm_sound CB2_1_5I2R14Entropy_sound) (by decide +kernel) +def CB2_1_5I2R15Value (a : Fin 6) : ℝ := residualLaw (below (shape 2 1 5)) (fun u => (stageBLaw (shape 2 1 5) u : ℝ)) (stageBPriority (shape 2 1 5)) 2 (fun u a => (littleLaw (shape 2 1 5) u ((stageBPriority (shape 2 1 5)) 2) a : ℝ)) 15 a +def CB2_1_5I2R15Raw (a : Fin 6) : Ball := residualBall (below (shape 2 1 5)) B2_1_5Law (stageBPriority (shape 2 1 5)) 2 (fun u => B2_1_5Little u ((stageBPriority (shape 2 1 5)) 2)) 15 a +lemma CB2_1_5I2R15Raw_sound (a : Fin 6) : + (CB2_1_5I2R15Raw a).Encloses (CB2_1_5I2R15Value a) := by + exact residualBall_sound_on (below (shape 2 1 5)) B2_1_5Law (fun u => (stageBLaw (shape 2 1 5) u : ℝ)) (stageBPriority (shape 2 1 5)) 2 (fun u => B2_1_5Little u ((stageBPriority (shape 2 1 5)) 2)) (fun u a => (littleLaw (shape 2 1 5) u ((stageBPriority (shape 2 1 5)) 2) a : ℝ)) (fun u _ => B2_1_5Law_sound u) (fun u _ a => B2_1_5Little_sound u ((stageBPriority (shape 2 1 5)) 2) a) 15 a +def CB2_1_5I2R15Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB2_1_5I2R15Certificates_valid : + CB2_1_5I2R15Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB2_1_5I2R15CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB2_1_5I2R15P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_1_5I2R15Certificates (CB2_1_5I2R15CertificateIndex a)).input +lemma CB2_1_5I2R15P_check : ∀ a : Fin 6, contains (CB2_1_5I2R15Raw a) (CB2_1_5I2R15P a) = true := by + decide +kernel +lemma CB2_1_5I2R15P_sound (a : Fin 6) : + (CB2_1_5I2R15P a).Encloses (CB2_1_5I2R15Value a) := + contains_sound (CB2_1_5I2R15Raw_sound a) (CB2_1_5I2R15P_check a) +def CB2_1_5I2R15Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_1_5I2R15Certificates (CB2_1_5I2R15CertificateIndex a)).output +lemma CB2_1_5I2R15Terms_sound (a : Fin 6) : + (CB2_1_5I2R15Terms a).Encloses (Foundation.entropyTerm (CB2_1_5I2R15Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB2_1_5I2R15Certificates_valid + (CB2_1_5I2R15CertificateIndex a) (CB2_1_5I2R15P_sound a) +def CB2_1_5I2R15Entropy : Ball := ⟨0, 0⟩ +lemma CB2_1_5I2R15Entropy_sound : CB2_1_5I2R15Entropy.Encloses (Foundation.finiteEntropy CB2_1_5I2R15Value) := by + exact contains_sound (entropyFin_enclosed 6 CB2_1_5I2R15Value CB2_1_5I2R15Terms CB2_1_5I2R15Terms_sound) (by decide +kernel) +def CB2_1_5I2R15Mass : Ball := ⟨0, 0⟩ +lemma CB2_1_5I2R15Mass_sound : CB2_1_5I2R15Mass.Encloses (∑ a, CB2_1_5I2R15Value a) := by + exact contains_sound (finSumBall_sound 6 CB2_1_5I2R15P CB2_1_5I2R15Value CB2_1_5I2R15P_sound) (by decide +kernel) +def CB2_1_5I2R15MassTerm : Ball := .exact 0 +lemma CB2_1_5I2R15MassTerm_sound : CB2_1_5I2R15MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB2_1_5I2R15Value a))) := + entropyTerm_zero_ball (CB2_1_5I2R15Mass_sound) +def CB2_1_5I2R15H : Ball := ⟨0, 0⟩ +lemma CB2_1_5I2R15H_sound : CB2_1_5I2R15H.Encloses (homogeneousEntropy CB2_1_5I2R15Value) := by + exact contains_sound (homogeneous_enclosed CB2_1_5I2R15Value CB2_1_5I2R15MassTerm_sound CB2_1_5I2R15Entropy_sound) (by decide +kernel) +def CB2_1_5I2R16Value (a : Fin 6) : ℝ := residualLaw (below (shape 2 1 5)) (fun u => (stageBLaw (shape 2 1 5) u : ℝ)) (stageBPriority (shape 2 1 5)) 2 (fun u a => (littleLaw (shape 2 1 5) u ((stageBPriority (shape 2 1 5)) 2) a : ℝ)) 16 a +def CB2_1_5I2R16Raw (a : Fin 6) : Ball := residualBall (below (shape 2 1 5)) B2_1_5Law (stageBPriority (shape 2 1 5)) 2 (fun u => B2_1_5Little u ((stageBPriority (shape 2 1 5)) 2)) 16 a +lemma CB2_1_5I2R16Raw_sound (a : Fin 6) : + (CB2_1_5I2R16Raw a).Encloses (CB2_1_5I2R16Value a) := by + exact residualBall_sound_on (below (shape 2 1 5)) B2_1_5Law (fun u => (stageBLaw (shape 2 1 5) u : ℝ)) (stageBPriority (shape 2 1 5)) 2 (fun u => B2_1_5Little u ((stageBPriority (shape 2 1 5)) 2)) (fun u a => (littleLaw (shape 2 1 5) u ((stageBPriority (shape 2 1 5)) 2) a : ℝ)) (fun u _ => B2_1_5Law_sound u) (fun u _ a => B2_1_5Little_sound u ((stageBPriority (shape 2 1 5)) 2) a) 16 a +def CB2_1_5I2R16Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB2_1_5I2R16Certificates_valid : + CB2_1_5I2R16Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB2_1_5I2R16CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB2_1_5I2R16P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_1_5I2R16Certificates (CB2_1_5I2R16CertificateIndex a)).input +lemma CB2_1_5I2R16P_check : ∀ a : Fin 6, contains (CB2_1_5I2R16Raw a) (CB2_1_5I2R16P a) = true := by + decide +kernel +lemma CB2_1_5I2R16P_sound (a : Fin 6) : + (CB2_1_5I2R16P a).Encloses (CB2_1_5I2R16Value a) := + contains_sound (CB2_1_5I2R16Raw_sound a) (CB2_1_5I2R16P_check a) +def CB2_1_5I2R16Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_1_5I2R16Certificates (CB2_1_5I2R16CertificateIndex a)).output +lemma CB2_1_5I2R16Terms_sound (a : Fin 6) : + (CB2_1_5I2R16Terms a).Encloses (Foundation.entropyTerm (CB2_1_5I2R16Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB2_1_5I2R16Certificates_valid + (CB2_1_5I2R16CertificateIndex a) (CB2_1_5I2R16P_sound a) +def CB2_1_5I2R16Entropy : Ball := ⟨0, 0⟩ +lemma CB2_1_5I2R16Entropy_sound : CB2_1_5I2R16Entropy.Encloses (Foundation.finiteEntropy CB2_1_5I2R16Value) := by + exact contains_sound (entropyFin_enclosed 6 CB2_1_5I2R16Value CB2_1_5I2R16Terms CB2_1_5I2R16Terms_sound) (by decide +kernel) +def CB2_1_5I2R16Mass : Ball := ⟨0, 0⟩ +lemma CB2_1_5I2R16Mass_sound : CB2_1_5I2R16Mass.Encloses (∑ a, CB2_1_5I2R16Value a) := by + exact contains_sound (finSumBall_sound 6 CB2_1_5I2R16P CB2_1_5I2R16Value CB2_1_5I2R16P_sound) (by decide +kernel) +def CB2_1_5I2R16MassTerm : Ball := .exact 0 +lemma CB2_1_5I2R16MassTerm_sound : CB2_1_5I2R16MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB2_1_5I2R16Value a))) := + entropyTerm_zero_ball (CB2_1_5I2R16Mass_sound) +def CB2_1_5I2R16H : Ball := ⟨0, 0⟩ +lemma CB2_1_5I2R16H_sound : CB2_1_5I2R16H.Encloses (homogeneousEntropy CB2_1_5I2R16Value) := by + exact contains_sound (homogeneous_enclosed CB2_1_5I2R16Value CB2_1_5I2R16MassTerm_sound CB2_1_5I2R16Entropy_sound) (by decide +kernel) +def CB2_1_5I2ResidualEntropies (a : Fin 17) : Ball := + match a.val with + | 0 => CB2_1_5I2R0H + | 1 => CB2_1_5I2R1H + | 2 => CB2_1_5I2R2H + | 3 => CB2_1_5I2R3H + | 4 => CB2_1_5I2R4H + | 5 => CB2_1_5I2R5H + | 6 => CB2_1_5I2R6H + | 7 => CB2_1_5I2R7H + | 8 => CB2_1_5I2R8H + | 9 => CB2_1_5I2R9H + | 10 => CB2_1_5I2R10H + | 11 => CB2_1_5I2R11H + | 12 => CB2_1_5I2R12H + | 13 => CB2_1_5I2R13H + | 14 => CB2_1_5I2R14H + | 15 => CB2_1_5I2R15H + | 16 => CB2_1_5I2R16H + | _ => (.exact 0) +lemma CB2_1_5I2ResidualEntropies_sound (k : Fin 17) : + (CB2_1_5I2ResidualEntropies k).Encloses (homogeneousEntropy + (residualLaw (below (shape 2 1 5)) (fun u => (stageBLaw (shape 2 1 5) u : ℝ)) (stageBPriority (shape 2 1 5)) 2 (fun u a => (littleLaw (shape 2 1 5) u ((stageBPriority (shape 2 1 5)) 2) a : ℝ)) k)) := by + fin_cases k + · exact CB2_1_5I2R0H_sound + · exact CB2_1_5I2R1H_sound + · exact CB2_1_5I2R2H_sound + · exact CB2_1_5I2R3H_sound + · exact CB2_1_5I2R4H_sound + · exact CB2_1_5I2R5H_sound + · exact CB2_1_5I2R6H_sound + · exact CB2_1_5I2R7H_sound + · exact CB2_1_5I2R8H_sound + · exact CB2_1_5I2R9H_sound + · exact CB2_1_5I2R10H_sound + · exact CB2_1_5I2R11H_sound + · exact CB2_1_5I2R12H_sound + · exact CB2_1_5I2R13H_sound + · exact CB2_1_5I2R14H_sound + · exact CB2_1_5I2R15H_sound + · exact CB2_1_5I2R16H_sound +def CB2_1_5I2S0_0_4Value (a : Fin 6) : ℝ := (littleLaw (shape 2 1 5) (shape 0 0 4) ((stageBPriority (shape 2 1 5)) 2) a : ℝ) +def CB2_1_5I2S0_0_4E_5Log : Ball := .exact 0 +lemma CB2_1_5I2S0_0_4E_5Log_sound : CB2_1_5I2S0_0_4E_5Log.Encloses (Real.log (CB2_1_5I2S0_0_4Value (5 : Fin 6))) := by + exact log_exact_one_ball ((B2_1_5Little_sound (shape 0 0 4) ((stageBPriority (shape 2 1 5)) 2)) (5 : Fin 6)) +def CB2_1_5I2S0_0_4E_5 : Ball := ⟨0, 0⟩ +lemma CB2_1_5I2S0_0_4E_5_sound : CB2_1_5I2S0_0_4E_5.Encloses (Foundation.entropyTerm (CB2_1_5I2S0_0_4Value (5 : Fin 6))) := by + exact contains_sound (entropyTerm_ball ((B2_1_5Little_sound (shape 0 0 4) ((stageBPriority (shape 2 1 5)) 2)) (5 : Fin 6)) CB2_1_5I2S0_0_4E_5Log_sound) (by decide +kernel) +def CB2_1_5I2S0_0_4Terms (a : Fin 6) : Ball := + match a.val with + | 5 => ⟨0, 0⟩ + | _ => (.exact 0) +lemma CB2_1_5I2S0_0_4Terms_sound (a : Fin 6) : + (CB2_1_5I2S0_0_4Terms a).Encloses (Foundation.entropyTerm (CB2_1_5I2S0_0_4Value a)) := by + fin_cases a + · exact (entropyTerm_zero_ball ((B2_1_5Little_sound (shape 0 0 4) ((stageBPriority (shape 2 1 5)) 2)) (0 : Fin 6))) + · exact (entropyTerm_zero_ball ((B2_1_5Little_sound (shape 0 0 4) ((stageBPriority (shape 2 1 5)) 2)) (1 : Fin 6))) + · exact (entropyTerm_zero_ball ((B2_1_5Little_sound (shape 0 0 4) ((stageBPriority (shape 2 1 5)) 2)) (2 : Fin 6))) + · exact (entropyTerm_zero_ball ((B2_1_5Little_sound (shape 0 0 4) ((stageBPriority (shape 2 1 5)) 2)) (3 : Fin 6))) + · exact (entropyTerm_zero_ball ((B2_1_5Little_sound (shape 0 0 4) ((stageBPriority (shape 2 1 5)) 2)) (4 : Fin 6))) + · exact CB2_1_5I2S0_0_4E_5_sound +def CB2_1_5I2S0_0_4Entropy : Ball := ⟨0, 0⟩ +lemma CB2_1_5I2S0_0_4Entropy_sound : CB2_1_5I2S0_0_4Entropy.Encloses (Foundation.finiteEntropy CB2_1_5I2S0_0_4Value) := by + exact contains_sound (entropyFin_enclosed 6 CB2_1_5I2S0_0_4Value CB2_1_5I2S0_0_4Terms CB2_1_5I2S0_0_4Terms_sound) (by decide +kernel) +def CB2_1_5I2S0_0_4Mass : Ball := ⟨1, 0⟩ +lemma CB2_1_5I2S0_0_4Mass_sound : CB2_1_5I2S0_0_4Mass.Encloses (∑ a, CB2_1_5I2S0_0_4Value a) := by + exact contains_sound (finSumBall_sound 6 (B2_1_5Little (shape 0 0 4) ((stageBPriority (shape 2 1 5)) 2)) CB2_1_5I2S0_0_4Value (B2_1_5Little_sound (shape 0 0 4) ((stageBPriority (shape 2 1 5)) 2))) (by decide +kernel) +def CB2_1_5I2S0_0_4MassTermLog : Ball := .exact 0 +lemma CB2_1_5I2S0_0_4MassTermLog_sound : CB2_1_5I2S0_0_4MassTermLog.Encloses (Real.log ((∑ a, CB2_1_5I2S0_0_4Value a))) := by + exact log_exact_one_ball (CB2_1_5I2S0_0_4Mass_sound) +def CB2_1_5I2S0_0_4MassTerm : Ball := ⟨0, 0⟩ +lemma CB2_1_5I2S0_0_4MassTerm_sound : CB2_1_5I2S0_0_4MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB2_1_5I2S0_0_4Value a))) := by + exact contains_sound (entropyTerm_ball (CB2_1_5I2S0_0_4Mass_sound) CB2_1_5I2S0_0_4MassTermLog_sound) (by decide +kernel) +def CB2_1_5I2S0_0_4H : Ball := ⟨0, 0⟩ +lemma CB2_1_5I2S0_0_4H_sound : CB2_1_5I2S0_0_4H.Encloses (homogeneousEntropy CB2_1_5I2S0_0_4Value) := by + exact contains_sound (homogeneous_enclosed CB2_1_5I2S0_0_4Value CB2_1_5I2S0_0_4MassTerm_sound CB2_1_5I2S0_0_4Entropy_sound) (by decide +kernel) +def CB2_1_5I2S0_1_3Value (a : Fin 6) : ℝ := (littleLaw (shape 2 1 5) (shape 0 1 3) ((stageBPriority (shape 2 1 5)) 2) a : ℝ) +def CB2_1_5I2S0_1_3E_4Log : Ball := .exact 0 +lemma CB2_1_5I2S0_1_3E_4Log_sound : CB2_1_5I2S0_1_3E_4Log.Encloses (Real.log (CB2_1_5I2S0_1_3Value (4 : Fin 6))) := by + exact log_exact_one_ball ((B2_1_5Little_sound (shape 0 1 3) ((stageBPriority (shape 2 1 5)) 2)) (4 : Fin 6)) +def CB2_1_5I2S0_1_3E_4 : Ball := ⟨0, 0⟩ +lemma CB2_1_5I2S0_1_3E_4_sound : CB2_1_5I2S0_1_3E_4.Encloses (Foundation.entropyTerm (CB2_1_5I2S0_1_3Value (4 : Fin 6))) := by + exact contains_sound (entropyTerm_ball ((B2_1_5Little_sound (shape 0 1 3) ((stageBPriority (shape 2 1 5)) 2)) (4 : Fin 6)) CB2_1_5I2S0_1_3E_4Log_sound) (by decide +kernel) +def CB2_1_5I2S0_1_3Terms (a : Fin 6) : Ball := + match a.val with + | 4 => ⟨0, 0⟩ + | _ => (.exact 0) +lemma CB2_1_5I2S0_1_3Terms_sound (a : Fin 6) : + (CB2_1_5I2S0_1_3Terms a).Encloses (Foundation.entropyTerm (CB2_1_5I2S0_1_3Value a)) := by + fin_cases a + · exact (entropyTerm_zero_ball ((B2_1_5Little_sound (shape 0 1 3) ((stageBPriority (shape 2 1 5)) 2)) (0 : Fin 6))) + · exact (entropyTerm_zero_ball ((B2_1_5Little_sound (shape 0 1 3) ((stageBPriority (shape 2 1 5)) 2)) (1 : Fin 6))) + · exact (entropyTerm_zero_ball ((B2_1_5Little_sound (shape 0 1 3) ((stageBPriority (shape 2 1 5)) 2)) (2 : Fin 6))) + · exact (entropyTerm_zero_ball ((B2_1_5Little_sound (shape 0 1 3) ((stageBPriority (shape 2 1 5)) 2)) (3 : Fin 6))) + · exact CB2_1_5I2S0_1_3E_4_sound + · exact (entropyTerm_zero_ball ((B2_1_5Little_sound (shape 0 1 3) ((stageBPriority (shape 2 1 5)) 2)) (5 : Fin 6))) +def CB2_1_5I2S0_1_3Entropy : Ball := ⟨0, 0⟩ +lemma CB2_1_5I2S0_1_3Entropy_sound : CB2_1_5I2S0_1_3Entropy.Encloses (Foundation.finiteEntropy CB2_1_5I2S0_1_3Value) := by + exact contains_sound (entropyFin_enclosed 6 CB2_1_5I2S0_1_3Value CB2_1_5I2S0_1_3Terms CB2_1_5I2S0_1_3Terms_sound) (by decide +kernel) +def CB2_1_5I2S0_1_3Mass : Ball := ⟨1, 0⟩ +lemma CB2_1_5I2S0_1_3Mass_sound : CB2_1_5I2S0_1_3Mass.Encloses (∑ a, CB2_1_5I2S0_1_3Value a) := by + exact contains_sound (finSumBall_sound 6 (B2_1_5Little (shape 0 1 3) ((stageBPriority (shape 2 1 5)) 2)) CB2_1_5I2S0_1_3Value (B2_1_5Little_sound (shape 0 1 3) ((stageBPriority (shape 2 1 5)) 2))) (by decide +kernel) +def CB2_1_5I2S0_1_3MassTermLog : Ball := .exact 0 +lemma CB2_1_5I2S0_1_3MassTermLog_sound : CB2_1_5I2S0_1_3MassTermLog.Encloses (Real.log ((∑ a, CB2_1_5I2S0_1_3Value a))) := by + exact log_exact_one_ball (CB2_1_5I2S0_1_3Mass_sound) +def CB2_1_5I2S0_1_3MassTerm : Ball := ⟨0, 0⟩ +lemma CB2_1_5I2S0_1_3MassTerm_sound : CB2_1_5I2S0_1_3MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB2_1_5I2S0_1_3Value a))) := by + exact contains_sound (entropyTerm_ball (CB2_1_5I2S0_1_3Mass_sound) CB2_1_5I2S0_1_3MassTermLog_sound) (by decide +kernel) +def CB2_1_5I2S0_1_3H : Ball := ⟨0, 0⟩ +lemma CB2_1_5I2S0_1_3H_sound : CB2_1_5I2S0_1_3H.Encloses (homogeneousEntropy CB2_1_5I2S0_1_3Value) := by + exact contains_sound (homogeneous_enclosed CB2_1_5I2S0_1_3Value CB2_1_5I2S0_1_3MassTerm_sound CB2_1_5I2S0_1_3Entropy_sound) (by decide +kernel) +def CB2_1_5I2S1_0_3Value (a : Fin 6) : ℝ := (littleLaw (shape 2 1 5) (shape 1 0 3) ((stageBPriority (shape 2 1 5)) 2) a : ℝ) +def CB2_1_5I2S1_0_3E_4Log : Ball := .exact 0 +lemma CB2_1_5I2S1_0_3E_4Log_sound : CB2_1_5I2S1_0_3E_4Log.Encloses (Real.log (CB2_1_5I2S1_0_3Value (4 : Fin 6))) := by + exact log_exact_one_ball ((B2_1_5Little_sound (shape 1 0 3) ((stageBPriority (shape 2 1 5)) 2)) (4 : Fin 6)) +def CB2_1_5I2S1_0_3E_4 : Ball := ⟨0, 0⟩ +lemma CB2_1_5I2S1_0_3E_4_sound : CB2_1_5I2S1_0_3E_4.Encloses (Foundation.entropyTerm (CB2_1_5I2S1_0_3Value (4 : Fin 6))) := by + exact contains_sound (entropyTerm_ball ((B2_1_5Little_sound (shape 1 0 3) ((stageBPriority (shape 2 1 5)) 2)) (4 : Fin 6)) CB2_1_5I2S1_0_3E_4Log_sound) (by decide +kernel) +def CB2_1_5I2S1_0_3Terms (a : Fin 6) : Ball := + match a.val with + | 4 => ⟨0, 0⟩ + | _ => (.exact 0) +lemma CB2_1_5I2S1_0_3Terms_sound (a : Fin 6) : + (CB2_1_5I2S1_0_3Terms a).Encloses (Foundation.entropyTerm (CB2_1_5I2S1_0_3Value a)) := by + fin_cases a + · exact (entropyTerm_zero_ball ((B2_1_5Little_sound (shape 1 0 3) ((stageBPriority (shape 2 1 5)) 2)) (0 : Fin 6))) + · exact (entropyTerm_zero_ball ((B2_1_5Little_sound (shape 1 0 3) ((stageBPriority (shape 2 1 5)) 2)) (1 : Fin 6))) + · exact (entropyTerm_zero_ball ((B2_1_5Little_sound (shape 1 0 3) ((stageBPriority (shape 2 1 5)) 2)) (2 : Fin 6))) + · exact (entropyTerm_zero_ball ((B2_1_5Little_sound (shape 1 0 3) ((stageBPriority (shape 2 1 5)) 2)) (3 : Fin 6))) + · exact CB2_1_5I2S1_0_3E_4_sound + · exact (entropyTerm_zero_ball ((B2_1_5Little_sound (shape 1 0 3) ((stageBPriority (shape 2 1 5)) 2)) (5 : Fin 6))) +def CB2_1_5I2S1_0_3Entropy : Ball := ⟨0, 0⟩ +lemma CB2_1_5I2S1_0_3Entropy_sound : CB2_1_5I2S1_0_3Entropy.Encloses (Foundation.finiteEntropy CB2_1_5I2S1_0_3Value) := by + exact contains_sound (entropyFin_enclosed 6 CB2_1_5I2S1_0_3Value CB2_1_5I2S1_0_3Terms CB2_1_5I2S1_0_3Terms_sound) (by decide +kernel) +def CB2_1_5I2S1_0_3Mass : Ball := ⟨1, 0⟩ +lemma CB2_1_5I2S1_0_3Mass_sound : CB2_1_5I2S1_0_3Mass.Encloses (∑ a, CB2_1_5I2S1_0_3Value a) := by + exact contains_sound (finSumBall_sound 6 (B2_1_5Little (shape 1 0 3) ((stageBPriority (shape 2 1 5)) 2)) CB2_1_5I2S1_0_3Value (B2_1_5Little_sound (shape 1 0 3) ((stageBPriority (shape 2 1 5)) 2))) (by decide +kernel) +def CB2_1_5I2S1_0_3MassTermLog : Ball := .exact 0 +lemma CB2_1_5I2S1_0_3MassTermLog_sound : CB2_1_5I2S1_0_3MassTermLog.Encloses (Real.log ((∑ a, CB2_1_5I2S1_0_3Value a))) := by + exact log_exact_one_ball (CB2_1_5I2S1_0_3Mass_sound) +def CB2_1_5I2S1_0_3MassTerm : Ball := ⟨0, 0⟩ +lemma CB2_1_5I2S1_0_3MassTerm_sound : CB2_1_5I2S1_0_3MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB2_1_5I2S1_0_3Value a))) := by + exact contains_sound (entropyTerm_ball (CB2_1_5I2S1_0_3Mass_sound) CB2_1_5I2S1_0_3MassTermLog_sound) (by decide +kernel) +def CB2_1_5I2S1_0_3H : Ball := ⟨0, 0⟩ +lemma CB2_1_5I2S1_0_3H_sound : CB2_1_5I2S1_0_3H.Encloses (homogeneousEntropy CB2_1_5I2S1_0_3Value) := by + exact contains_sound (homogeneous_enclosed CB2_1_5I2S1_0_3Value CB2_1_5I2S1_0_3MassTerm_sound CB2_1_5I2S1_0_3Entropy_sound) (by decide +kernel) +def CB2_1_5I2S2_0_2Value (a : Fin 6) : ℝ := (littleLaw (shape 2 1 5) (shape 2 0 2) ((stageBPriority (shape 2 1 5)) 2) a : ℝ) +def CB2_1_5I2S2_0_2E_2LogWitness : LogWitness := ⟨-1, 449689, 250000⟩ +def CB2_1_5I2S2_0_2E_2Log : Ball := ⟨(-2651296642407782012789413805853 / 25000000000000000000000000000000), (21175823683 / 50000000000000000000000000000000)⟩ +lemma CB2_1_5I2S2_0_2E_2Log_sound : CB2_1_5I2S2_0_2E_2Log.Encloses (Real.log (CB2_1_5I2S2_0_2Value (2 : Fin 6))) := by + exact checkLog_sound logTwoBall_sound ((B2_1_5Little_sound (shape 2 0 2) ((stageBPriority (shape 2 1 5)) 2)) (2 : Fin 6)) (w := CB2_1_5I2S2_0_2E_2LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB2_1_5I2S2_0_2E_2 : Ball := ⟨(4769035743310852342197034819761 / 50000000000000000000000000000000), (7618027981 / 20000000000000000000000000000000)⟩ +lemma CB2_1_5I2S2_0_2E_2_sound : CB2_1_5I2S2_0_2E_2.Encloses (Foundation.entropyTerm (CB2_1_5I2S2_0_2Value (2 : Fin 6))) := by + exact contains_sound (entropyTerm_ball ((B2_1_5Little_sound (shape 2 0 2) ((stageBPriority (shape 2 1 5)) 2)) (2 : Fin 6)) CB2_1_5I2S2_0_2E_2Log_sound) (by decide +kernel) +def CB2_1_5I2S2_0_2E_3LogWitness : LogWitness := ⟨-4, 50311, 31250⟩ +def CB2_1_5I2S2_0_2E_3Log : Ball := ⟨(-229638435735244201494939716178541 / 100000000000000000000000000000000), (21175823683 / 20000000000000000000000000000000)⟩ +lemma CB2_1_5I2S2_0_2E_3Log_sound : CB2_1_5I2S2_0_2E_3Log.Encloses (Real.log (CB2_1_5I2S2_0_2Value (3 : Fin 6))) := by + exact checkLog_sound logTwoBall_sound ((B2_1_5Little_sound (shape 2 0 2) ((stageBPriority (shape 2 1 5)) 2)) (3 : Fin 6)) (w := CB2_1_5I2S2_0_2E_3LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB2_1_5I2S2_0_2E_3 : Ball := ⟨(23106678680551742042823824121317 / 100000000000000000000000000000000), (5326884327 / 50000000000000000000000000000000)⟩ +lemma CB2_1_5I2S2_0_2E_3_sound : CB2_1_5I2S2_0_2E_3.Encloses (Foundation.entropyTerm (CB2_1_5I2S2_0_2Value (3 : Fin 6))) := by + exact contains_sound (entropyTerm_ball ((B2_1_5Little_sound (shape 2 0 2) ((stageBPriority (shape 2 1 5)) 2)) (3 : Fin 6)) CB2_1_5I2S2_0_2E_3Log_sound) (by decide +kernel) +def CB2_1_5I2S2_0_2Terms (a : Fin 6) : Ball := + match a.val with + | 2 => ⟨(4769035743310852342197034819761 / 50000000000000000000000000000000), (7618027981 / 20000000000000000000000000000000)⟩ + | 3 => ⟨(23106678680551742042823824121317 / 100000000000000000000000000000000), (5326884327 / 50000000000000000000000000000000)⟩ + | _ => (.exact 0) +lemma CB2_1_5I2S2_0_2Terms_sound (a : Fin 6) : + (CB2_1_5I2S2_0_2Terms a).Encloses (Foundation.entropyTerm (CB2_1_5I2S2_0_2Value a)) := by + fin_cases a + · exact (entropyTerm_zero_ball ((B2_1_5Little_sound (shape 2 0 2) ((stageBPriority (shape 2 1 5)) 2)) (0 : Fin 6))) + · exact (entropyTerm_zero_ball ((B2_1_5Little_sound (shape 2 0 2) ((stageBPriority (shape 2 1 5)) 2)) (1 : Fin 6))) + · exact CB2_1_5I2S2_0_2E_2_sound + · exact CB2_1_5I2S2_0_2E_3_sound + · exact (entropyTerm_zero_ball ((B2_1_5Little_sound (shape 2 0 2) ((stageBPriority (shape 2 1 5)) 2)) (4 : Fin 6))) + · exact (entropyTerm_zero_ball ((B2_1_5Little_sound (shape 2 0 2) ((stageBPriority (shape 2 1 5)) 2)) (5 : Fin 6))) +def CB2_1_5I2S2_0_2Entropy : Ball := ⟨(32644750167173446727217893760839 / 100000000000000000000000000000000), (48743908559 / 100000000000000000000000000000000)⟩ +lemma CB2_1_5I2S2_0_2Entropy_sound : CB2_1_5I2S2_0_2Entropy.Encloses (Foundation.finiteEntropy CB2_1_5I2S2_0_2Value) := by + exact contains_sound (entropyFin_enclosed 6 CB2_1_5I2S2_0_2Value CB2_1_5I2S2_0_2Terms CB2_1_5I2S2_0_2Terms_sound) (by decide +kernel) +def CB2_1_5I2S2_0_2Mass : Ball := ⟨1, 0⟩ +lemma CB2_1_5I2S2_0_2Mass_sound : CB2_1_5I2S2_0_2Mass.Encloses (∑ a, CB2_1_5I2S2_0_2Value a) := by + exact contains_sound (finSumBall_sound 6 (B2_1_5Little (shape 2 0 2) ((stageBPriority (shape 2 1 5)) 2)) CB2_1_5I2S2_0_2Value (B2_1_5Little_sound (shape 2 0 2) ((stageBPriority (shape 2 1 5)) 2))) (by decide +kernel) +def CB2_1_5I2S2_0_2MassTermLog : Ball := .exact 0 +lemma CB2_1_5I2S2_0_2MassTermLog_sound : CB2_1_5I2S2_0_2MassTermLog.Encloses (Real.log ((∑ a, CB2_1_5I2S2_0_2Value a))) := by + exact log_exact_one_ball (CB2_1_5I2S2_0_2Mass_sound) +def CB2_1_5I2S2_0_2MassTerm : Ball := ⟨0, 0⟩ +lemma CB2_1_5I2S2_0_2MassTerm_sound : CB2_1_5I2S2_0_2MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB2_1_5I2S2_0_2Value a))) := by + exact contains_sound (entropyTerm_ball (CB2_1_5I2S2_0_2Mass_sound) CB2_1_5I2S2_0_2MassTermLog_sound) (by decide +kernel) +def CB2_1_5I2S2_0_2H : Ball := ⟨(32644750167173446727217893760839 / 100000000000000000000000000000000), (48743908559 / 100000000000000000000000000000000)⟩ +lemma CB2_1_5I2S2_0_2H_sound : CB2_1_5I2S2_0_2H.Encloses (homogeneousEntropy CB2_1_5I2S2_0_2Value) := by + exact contains_sound (homogeneous_enclosed CB2_1_5I2S2_0_2Value CB2_1_5I2S2_0_2MassTerm_sound CB2_1_5I2S2_0_2Entropy_sound) (by decide +kernel) +def CB2_1_5I2Singles (s : Shape) : Ball := + match s 0, s 1, s 2 with + | 0, 0, 4 => CB2_1_5I2S0_0_4H + | 0, 1, 3 => CB2_1_5I2S0_1_3H + | 1, 0, 3 => CB2_1_5I2S1_0_3H + | 2, 0, 2 => CB2_1_5I2S2_0_2H + | _, _, _ => (.exact 0) +lemma CB2_1_5I2Singles_sound (u : Shape) (hu : u ∈ below (shape 2 1 5)) + (hd : designated (stageBPriority (shape 2 1 5)) 2 u) : + (CB2_1_5I2Singles u).Encloses (homogeneousEntropy ((fun u a => (littleLaw (shape 2 1 5) u ((stageBPriority (shape 2 1 5)) 2) a : ℝ)) u)) := by + rw [B2_1_5_below] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl | rfl | rfl + · exact CB2_1_5I2S0_0_4H_sound + · exact CB2_1_5I2S0_1_3H_sound + · exact CB2_1_5I2S1_0_3H_sound + · exact (show ¬ designated (stageBPriority (shape 2 1 5)) 2 (shape 1 1 2) by decide +kernel) hd |>.elim + · exact CB2_1_5I2S2_0_2H_sound + · exact (show ¬ designated (stageBPriority (shape 2 1 5)) 2 (shape 2 1 1) by decide +kernel) hd |>.elim +def CB2_1_5I2Singleton : Ball := ⟨(1487679008418615246531854016649 / 25000000000000000000000000000000), (277668267 / 3125000000000000000000000000000)⟩ +lemma CB2_1_5I2Singleton_sound : CB2_1_5I2Singleton.Encloses + (singletonEntropy (below (shape 2 1 5)) (fun u => (stageBLaw (shape 2 1 5) u : ℝ)) (stageBPriority (shape 2 1 5)) 2 (fun u a => (littleLaw (shape 2 1 5) u ((stageBPriority (shape 2 1 5)) 2) a : ℝ))) := by + exact contains_sound (singletonBall_sound (below (shape 2 1 5)) B2_1_5Law (fun u => (stageBLaw (shape 2 1 5) u : ℝ)) (stageBPriority (shape 2 1 5)) 2 + CB2_1_5I2Singles (fun u a => (littleLaw (shape 2 1 5) u ((stageBPriority (shape 2 1 5)) 2) a : ℝ)) (fun u _ => B2_1_5Law_sound u) CB2_1_5I2Singles_sound) (by decide +kernel) +def CB2_1_5I2Group : Ball := ⟨(1487796348680613112744675821277 / 25000000000000000000000000000000), (4959902711 / 10000000000000000000000000000000)⟩ +lemma CB2_1_5I2Group_sound : CB2_1_5I2Group.Encloses + (groupedEntropy (below (shape 2 1 5)) (fun u => (stageBLaw (shape 2 1 5) u : ℝ)) (stageBPriority (shape 2 1 5)) 2 (fun u a => (littleLaw (shape 2 1 5) u ((stageBPriority (shape 2 1 5)) 2) a : ℝ))) := by + exact contains_sound (Ball.add_sound CB2_1_5I2Singleton_sound + (finSumBall_sound 17 CB2_1_5I2ResidualEntropies _ CB2_1_5I2ResidualEntropies_sound)) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CB2_1_5I2H : Ball := ⟨(465378581497257829111303744359 / 625000000000000000000000000000), (187355184909 / 100000000000000000000000000000000)⟩ +lemma CB2_1_5I2_sound : CB2_1_5I2H.Encloses (stageBCapacity (shape 2 1 5) 2) := by + have hb := contains_sound (Ball.add_sound CB2_1_5I2PairH_sound + (Ball.neg_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) CB2_1_5I2Group_sound))) + (show contains (.add CB2_1_5I2PairH (.neg (.mul (.exact 2) CB2_1_5I2Group))) CB2_1_5I2H = true by decide +kernel) + unfold CB2_1_5I2PairValue at hb + simpa only [stageBCapacity, nativeCapacity, + show (2 : Fin 3) ≠ 0 by decide, ite_false, sub_eq_add_neg] using hb + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/CapacityB/CapB2_2_4I0.lean b/lean/OAI/LinearAlgebra/MatrixFields/CapacityB/CapB2_2_4I0.lean new file mode 100644 index 0000000000000000000000000000000000000000..447226e809279bf7c833e35d17169d9ce5b49d2d --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/CapacityB/CapB2_2_4I0.lean @@ -0,0 +1,74 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Certificates.Terminal2_2_4 + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CB2_2_4I0Value (a : Fin 17) : ℝ := marginal (below (shape 2 2 4)) (fun u => (stageBLaw (shape 2 2 4) u : ℝ)) ((stageBPriority (shape 2 2 4)) 0) a +def CB2_2_4I0Raw (a : Fin 17) : Ball := marginalBall (below (shape 2 2 4)) B2_2_4Law ((stageBPriority (shape 2 2 4)) 0) a +lemma CB2_2_4I0Raw_sound (a : Fin 17) : + (CB2_2_4I0Raw a).Encloses (CB2_2_4I0Value a) := by + exact marginalBall_sound (below (shape 2 2 4)) B2_2_4Law (fun u => (stageBLaw (shape 2 2 4) u : ℝ)) (fun u _ => B2_2_4Law_sound u) ((stageBPriority (shape 2 2 4)) 0) a +def CB2_2_4I0Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(18432809600162602238233930394191 / 100000000000000000000000000000000), (17 / 25000000000000000000000000000000)⟩ ⟨(31170581090219803908545577364083 / 100000000000000000000000000000000), (15613197227 / 100000000000000000000000000000000)⟩ ⟨(-42275949470482293361630256775271 / 25000000000000000000000000000000), (847032951 / 1000000000000000000000000000000)⟩ ⟨-3, 18432809600162602238233930394191, 12500000000000000000000000000000⟩, + .log ⟨(3156719039983739776176606960581 / 5000000000000000000000000000000), (11 / 12500000000000000000000000000000)⟩ ⟨(29035798632197530040660383517107 / 100000000000000000000000000000000), (6684612613 / 25000000000000000000000000000000)⟩ ⟨(-9198094054118637402943840466023 / 20000000000000000000000000000000), (8470329501 / 20000000000000000000000000000000)⟩ ⟨-1, 3156719039983739776176606960581, 2500000000000000000000000000000⟩] +lemma CB2_2_4I0Certificates_valid : + CB2_2_4I0Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB2_2_4I0CertificateIndex (a : Fin 17) : ℕ := + match a.val with + | 0 => 1 + | 1 => 2 + | 2 => 1 + | _ => 0 +def CB2_2_4I0P (a : Fin 17) : Ball := + (CompactCertificate.entropyLookup CB2_2_4I0Certificates (CB2_2_4I0CertificateIndex a)).input +lemma CB2_2_4I0P_check : ∀ a : Fin 17, contains (CB2_2_4I0Raw a) (CB2_2_4I0P a) = true := by + decide +kernel +lemma CB2_2_4I0P_sound (a : Fin 17) : + (CB2_2_4I0P a).Encloses (CB2_2_4I0Value a) := + contains_sound (CB2_2_4I0Raw_sound a) (CB2_2_4I0P_check a) +def CB2_2_4I0Terms (a : Fin 17) : Ball := + (CompactCertificate.entropyLookup CB2_2_4I0Certificates (CB2_2_4I0CertificateIndex a)).output +lemma CB2_2_4I0Terms_sound (a : Fin 17) : + (CB2_2_4I0Terms a).Encloses (Foundation.entropyTerm (CB2_2_4I0Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB2_2_4I0Certificates_valid + (CB2_2_4I0CertificateIndex a) (CB2_2_4I0P_sound a) +def CB2_2_4I0Entropy : Ball := ⟨(91376960812637137857751538245273 / 100000000000000000000000000000000), (28982422453 / 50000000000000000000000000000000)⟩ +lemma CB2_2_4I0Entropy_sound : CB2_2_4I0Entropy.Encloses (Foundation.finiteEntropy CB2_2_4I0Value) := by + exact contains_sound (entropyFin_enclosed 17 CB2_2_4I0Value CB2_2_4I0Terms CB2_2_4I0Terms_sound) (by decide +kernel) +def CB2_2_4I0Mass : Ball := ⟨(50000000000000000000000000000001 / 50000000000000000000000000000000), (7 / 3125000000000000000000000000000)⟩ +lemma CB2_2_4I0Mass_sound : CB2_2_4I0Mass.Encloses (∑ a, CB2_2_4I0Value a) := by + exact contains_sound (finSumBall_sound 17 CB2_2_4I0P CB2_2_4I0Value CB2_2_4I0P_sound) (by decide +kernel) +def CB2_2_4I0MassTermLogWitness : LogWitness := ⟨0, 50000000000000000000000000000001, 50000000000000000000000000000000⟩ +def CB2_2_4I0MassTermLog : Ball := ⟨(1 / 50000000000000000000000000000000), (10587911953 / 50000000000000000000000000000000)⟩ +lemma CB2_2_4I0MassTermLog_sound : CB2_2_4I0MassTermLog.Encloses (Real.log ((∑ a, CB2_2_4I0Value a))) := by + exact checkLog_sound logTwoBall_sound (CB2_2_4I0Mass_sound) (w := CB2_2_4I0MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB2_2_4I0MassTerm : Ball := ⟨(-1 / 50000000000000000000000000000000), (21175823907 / 100000000000000000000000000000000)⟩ +lemma CB2_2_4I0MassTerm_sound : CB2_2_4I0MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB2_2_4I0Value a))) := by + exact contains_sound (entropyTerm_ball (CB2_2_4I0Mass_sound) CB2_2_4I0MassTermLog_sound) (by decide +kernel) +def CB2_2_4I0H : Ball := ⟨(3655078432505485514310061529811 / 4000000000000000000000000000000), (79140668813 / 100000000000000000000000000000000)⟩ +lemma CB2_2_4I0H_sound : CB2_2_4I0H.Encloses (homogeneousEntropy CB2_2_4I0Value) := by + exact contains_sound (homogeneous_enclosed CB2_2_4I0Value CB2_2_4I0MassTerm_sound CB2_2_4I0Entropy_sound) (by decide +kernel) +lemma CB2_2_4I0_sound : CB2_2_4I0H.Encloses (stageBCapacity (shape 2 2 4) 0) := by + exact CB2_2_4I0H_sound + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/CapacityB/CapB2_2_4I1.lean b/lean/OAI/LinearAlgebra/MatrixFields/CapacityB/CapB2_2_4I1.lean new file mode 100644 index 0000000000000000000000000000000000000000..c8aff50908f2cae533f07f68666150bc867e3b86 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/CapacityB/CapB2_2_4I1.lean @@ -0,0 +1,893 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Certificates.Terminal2_2_4 + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CB2_2_4I1PairValue (a : PairSlot) : ℝ := pairLaw (below (shape 2 2 4)) (shape 2 2 4) (fun u => (stageBLaw (shape 2 2 4) u : ℝ)) (fun u a => (littleLaw (shape 2 2 4) u ((stageBPriority (shape 2 2 4)) 1) a : ℝ)) a +def CB2_2_4I1PairRaw (a : PairSlot) : Ball := pairLawBall (below (shape 2 2 4)) (shape 2 2 4) B2_2_4Law (fun u => B2_2_4Little u ((stageBPriority (shape 2 2 4)) 1)) a +lemma CB2_2_4I1PairRaw_sound (a : PairSlot) : + (CB2_2_4I1PairRaw a).Encloses (CB2_2_4I1PairValue a) := by + exact pairLawBall_sound_on (below (shape 2 2 4)) (shape 2 2 4) B2_2_4Law (fun u => (stageBLaw (shape 2 2 4) u : ℝ)) (fun u => B2_2_4Little u ((stageBPriority (shape 2 2 4)) 1)) (fun u a => (littleLaw (shape 2 2 4) u ((stageBPriority (shape 2 2 4)) 1) a : ℝ)) (fun u _ => B2_2_4Law_sound u) (fun u _ a => B2_2_4Little_sound u ((stageBPriority (shape 2 2 4)) 1) a) (fun u _ a => B2_2_4Little_sound (complement (shape 2 2 4) u) ((stageBPriority (shape 2 2 4)) 1) a) a +def CB2_2_4I1PairCertificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(16755339902810166110201422814999 / 100000000000000000000000000000000), (63 / 100000000000000000000000000000000)⟩ ⟨(29932630223797274595672665798407 / 100000000000000000000000000000000), (14192325117 / 100000000000000000000000000000000)⟩ ⟨(-178645317835522061933206182491937 / 100000000000000000000000000000000), (84703295107 / 100000000000000000000000000000000)⟩ ⟨-3, 16755339902810166110201422814999, 12500000000000000000000000000000⟩, + .log ⟨(209683712169054516004063447399 / 12500000000000000000000000000000), (7 / 100000000000000000000000000000000)⟩ ⟨(342865048336104256220603384961 / 5000000000000000000000000000000), (497305243 / 20000000000000000000000000000000)⟩ ⟨(-204394183022948736917557347021513 / 50000000000000000000000000000000), (74115383099 / 50000000000000000000000000000000)⟩ ⟨-6, 209683712169054516004063447399, 195312500000000000000000000000⟩, + .log ⟨(3156719039983739776176606960581 / 5000000000000000000000000000000), (11 / 12500000000000000000000000000000)⟩ ⟨(29035798632197530040660383517107 / 100000000000000000000000000000000), (6684612613 / 25000000000000000000000000000000)⟩ ⟨(-9198094054118637402943840466023 / 20000000000000000000000000000000), (8470329501 / 20000000000000000000000000000000)⟩ ⟨-1, 3156719039983739776176606960581, 2500000000000000000000000000000⟩] +lemma CB2_2_4I1PairCertificates_valid : + CB2_2_4I1PairCertificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB2_2_4I1PairCertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 0, 2 => 1 + | 0, 3 => 2 + | 1, 1 => 3 + | 2, 0 => 1 + | 3, 0 => 2 + | _, _ => 0 +def CB2_2_4I1PairP (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CB2_2_4I1PairCertificates (CB2_2_4I1PairCertificateIndex a)).input +lemma CB2_2_4I1PairP_check : ∀ a : PairSlot, contains (CB2_2_4I1PairRaw a) (CB2_2_4I1PairP a) = true := by + decide +kernel +lemma CB2_2_4I1PairP_sound (a : PairSlot) : + (CB2_2_4I1PairP a).Encloses (CB2_2_4I1PairValue a) := + contains_sound (CB2_2_4I1PairRaw_sound a) (CB2_2_4I1PairP_check a) +def CB2_2_4I1PairTerms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CB2_2_4I1PairCertificates (CB2_2_4I1PairCertificateIndex a)).output +lemma CB2_2_4I1PairTerms_sound (a : PairSlot) : + (CB2_2_4I1PairTerms a).Encloses (Foundation.entropyTerm (CB2_2_4I1PairValue a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB2_2_4I1PairCertificates_valid + (CB2_2_4I1PairCertificateIndex a) (CB2_2_4I1PairP_sound a) +def CB2_2_4I1PairEntropy : Ball := ⟨(102615661013236249480829850512361 / 100000000000000000000000000000000), (15024038279 / 25000000000000000000000000000000)⟩ +lemma CB2_2_4I1PairEntropy_sound : CB2_2_4I1PairEntropy.Encloses (Foundation.finiteEntropy CB2_2_4I1PairValue) := by + exact contains_sound (entropyPair_enclosed CB2_2_4I1PairValue CB2_2_4I1PairTerms CB2_2_4I1PairTerms_sound) (by decide +kernel) +def CB2_2_4I1PairMass : Ball := ⟨(50000000000000000000000000000001 / 50000000000000000000000000000000), (57 / 25000000000000000000000000000000)⟩ +lemma CB2_2_4I1PairMass_sound : CB2_2_4I1PairMass.Encloses (∑ a, CB2_2_4I1PairValue a) := by + exact contains_sound (pairSumBall_sound CB2_2_4I1PairP CB2_2_4I1PairValue CB2_2_4I1PairP_sound) (by decide +kernel) +def CB2_2_4I1PairMassTermLogWitness : LogWitness := ⟨0, 50000000000000000000000000000001, 50000000000000000000000000000000⟩ +def CB2_2_4I1PairMassTermLog : Ball := ⟨(1 / 50000000000000000000000000000000), (2117582391 / 10000000000000000000000000000000)⟩ +lemma CB2_2_4I1PairMassTermLog_sound : CB2_2_4I1PairMassTermLog.Encloses (Real.log ((∑ a, CB2_2_4I1PairValue a))) := by + exact checkLog_sound logTwoBall_sound (CB2_2_4I1PairMass_sound) (w := CB2_2_4I1PairMassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB2_2_4I1PairMassTerm : Ball := ⟨(-1 / 50000000000000000000000000000000), (21175823911 / 100000000000000000000000000000000)⟩ +lemma CB2_2_4I1PairMassTerm_sound : CB2_2_4I1PairMassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB2_2_4I1PairValue a))) := by + exact contains_sound (entropyTerm_ball (CB2_2_4I1PairMass_sound) CB2_2_4I1PairMassTermLog_sound) (by decide +kernel) +def CB2_2_4I1PairH : Ball := ⟨(102615661013236249480829850512363 / 100000000000000000000000000000000), (81271977027 / 100000000000000000000000000000000)⟩ +lemma CB2_2_4I1PairH_sound : CB2_2_4I1PairH.Encloses (homogeneousEntropy CB2_2_4I1PairValue) := by + exact contains_sound (homogeneous_enclosed CB2_2_4I1PairValue CB2_2_4I1PairMassTerm_sound CB2_2_4I1PairEntropy_sound) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CB2_2_4I1R0Value (a : Fin 6) : ℝ := residualLaw (below (shape 2 2 4)) (fun u => (stageBLaw (shape 2 2 4) u : ℝ)) (stageBPriority (shape 2 2 4)) 1 (fun u a => (littleLaw (shape 2 2 4) u ((stageBPriority (shape 2 2 4)) 1) a : ℝ)) 0 a +def CB2_2_4I1R0Raw (a : Fin 6) : Ball := residualBall (below (shape 2 2 4)) B2_2_4Law (stageBPriority (shape 2 2 4)) 1 (fun u => B2_2_4Little u ((stageBPriority (shape 2 2 4)) 1)) 0 a +lemma CB2_2_4I1R0Raw_sound (a : Fin 6) : + (CB2_2_4I1R0Raw a).Encloses (CB2_2_4I1R0Value a) := by + exact residualBall_sound_on (below (shape 2 2 4)) B2_2_4Law (fun u => (stageBLaw (shape 2 2 4) u : ℝ)) (stageBPriority (shape 2 2 4)) 1 (fun u => B2_2_4Little u ((stageBPriority (shape 2 2 4)) 1)) (fun u a => (littleLaw (shape 2 2 4) u ((stageBPriority (shape 2 2 4)) 1) a : ℝ)) (fun u _ => B2_2_4Law_sound u) (fun u _ a => B2_2_4Little_sound u ((stageBPriority (shape 2 2 4)) 1) a) 0 a +def CB2_2_4I1R0Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(18432809600162602238233930394191 / 100000000000000000000000000000000), (17 / 25000000000000000000000000000000)⟩ ⟨(31170581090219803908545577364083 / 100000000000000000000000000000000), (15613197227 / 100000000000000000000000000000000)⟩ ⟨(-42275949470482293361630256775271 / 25000000000000000000000000000000), (847032951 / 1000000000000000000000000000000)⟩ ⟨-3, 18432809600162602238233930394191, 12500000000000000000000000000000⟩] +lemma CB2_2_4I1R0Certificates_valid : + CB2_2_4I1R0Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB2_2_4I1R0CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | 0 => 1 + | _ => 0 +def CB2_2_4I1R0P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_2_4I1R0Certificates (CB2_2_4I1R0CertificateIndex a)).input +lemma CB2_2_4I1R0P_check : ∀ a : Fin 6, contains (CB2_2_4I1R0Raw a) (CB2_2_4I1R0P a) = true := by + decide +kernel +lemma CB2_2_4I1R0P_sound (a : Fin 6) : + (CB2_2_4I1R0P a).Encloses (CB2_2_4I1R0Value a) := + contains_sound (CB2_2_4I1R0Raw_sound a) (CB2_2_4I1R0P_check a) +def CB2_2_4I1R0Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_2_4I1R0Certificates (CB2_2_4I1R0CertificateIndex a)).output +lemma CB2_2_4I1R0Terms_sound (a : Fin 6) : + (CB2_2_4I1R0Terms a).Encloses (Foundation.entropyTerm (CB2_2_4I1R0Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB2_2_4I1R0Certificates_valid + (CB2_2_4I1R0CertificateIndex a) (CB2_2_4I1R0P_sound a) +def CB2_2_4I1R0Entropy : Ball := ⟨(31170581090219803908545577364083 / 100000000000000000000000000000000), (15613197227 / 100000000000000000000000000000000)⟩ +lemma CB2_2_4I1R0Entropy_sound : CB2_2_4I1R0Entropy.Encloses (Foundation.finiteEntropy CB2_2_4I1R0Value) := by + exact contains_sound (entropyFin_enclosed 6 CB2_2_4I1R0Value CB2_2_4I1R0Terms CB2_2_4I1R0Terms_sound) (by decide +kernel) +def CB2_2_4I1R0Mass : Ball := ⟨(18432809600162602238233930394191 / 100000000000000000000000000000000), (17 / 25000000000000000000000000000000)⟩ +lemma CB2_2_4I1R0Mass_sound : CB2_2_4I1R0Mass.Encloses (∑ a, CB2_2_4I1R0Value a) := by + exact contains_sound (finSumBall_sound 6 CB2_2_4I1R0P CB2_2_4I1R0Value CB2_2_4I1R0P_sound) (by decide +kernel) +def CB2_2_4I1R0MassTermLogWitness : LogWitness := ⟨-3, 18432809600162602238233930394191, 12500000000000000000000000000000⟩ +def CB2_2_4I1R0MassTermLog : Ball := ⟨(-42275949470482293361630256775271 / 25000000000000000000000000000000), (847032951 / 1000000000000000000000000000000)⟩ +lemma CB2_2_4I1R0MassTermLog_sound : CB2_2_4I1R0MassTermLog.Encloses (Real.log ((∑ a, CB2_2_4I1R0Value a))) := by + exact checkLog_sound logTwoBall_sound (CB2_2_4I1R0Mass_sound) (w := CB2_2_4I1R0MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB2_2_4I1R0MassTerm : Ball := ⟨(31170581090219803908545577364083 / 100000000000000000000000000000000), (15613197227 / 100000000000000000000000000000000)⟩ +lemma CB2_2_4I1R0MassTerm_sound : CB2_2_4I1R0MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB2_2_4I1R0Value a))) := by + exact contains_sound (entropyTerm_ball (CB2_2_4I1R0Mass_sound) CB2_2_4I1R0MassTermLog_sound) (by decide +kernel) +def CB2_2_4I1R0H : Ball := ⟨0, (15613197227 / 50000000000000000000000000000000)⟩ +lemma CB2_2_4I1R0H_sound : CB2_2_4I1R0H.Encloses (homogeneousEntropy CB2_2_4I1R0Value) := by + exact contains_sound (homogeneous_enclosed CB2_2_4I1R0Value CB2_2_4I1R0MassTerm_sound CB2_2_4I1R0Entropy_sound) (by decide +kernel) +def CB2_2_4I1R1Value (a : Fin 6) : ℝ := residualLaw (below (shape 2 2 4)) (fun u => (stageBLaw (shape 2 2 4) u : ℝ)) (stageBPriority (shape 2 2 4)) 1 (fun u a => (littleLaw (shape 2 2 4) u ((stageBPriority (shape 2 2 4)) 1) a : ℝ)) 1 a +def CB2_2_4I1R1Raw (a : Fin 6) : Ball := residualBall (below (shape 2 2 4)) B2_2_4Law (stageBPriority (shape 2 2 4)) 1 (fun u => B2_2_4Little u ((stageBPriority (shape 2 2 4)) 1)) 1 a +lemma CB2_2_4I1R1Raw_sound (a : Fin 6) : + (CB2_2_4I1R1Raw a).Encloses (CB2_2_4I1R1Value a) := by + exact residualBall_sound_on (below (shape 2 2 4)) B2_2_4Law (fun u => (stageBLaw (shape 2 2 4) u : ℝ)) (stageBPriority (shape 2 2 4)) 1 (fun u => B2_2_4Little u ((stageBPriority (shape 2 2 4)) 1)) (fun u a => (littleLaw (shape 2 2 4) u ((stageBPriority (shape 2 2 4)) 1) a : ℝ)) (fun u _ => B2_2_4Law_sound u) (fun u _ a => B2_2_4Little_sound u ((stageBPriority (shape 2 2 4)) 1) a) 1 a +def CB2_2_4I1R1Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(3156719039983739776176606960581 / 5000000000000000000000000000000), (11 / 12500000000000000000000000000000)⟩ ⟨(29035798632197530040660383517107 / 100000000000000000000000000000000), (6684612613 / 25000000000000000000000000000000)⟩ ⟨(-9198094054118637402943840466023 / 20000000000000000000000000000000), (8470329501 / 20000000000000000000000000000000)⟩ ⟨-1, 3156719039983739776176606960581, 2500000000000000000000000000000⟩] +lemma CB2_2_4I1R1Certificates_valid : + CB2_2_4I1R1Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB2_2_4I1R1CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | 1 => 1 + | _ => 0 +def CB2_2_4I1R1P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_2_4I1R1Certificates (CB2_2_4I1R1CertificateIndex a)).input +lemma CB2_2_4I1R1P_check : ∀ a : Fin 6, contains (CB2_2_4I1R1Raw a) (CB2_2_4I1R1P a) = true := by + decide +kernel +lemma CB2_2_4I1R1P_sound (a : Fin 6) : + (CB2_2_4I1R1P a).Encloses (CB2_2_4I1R1Value a) := + contains_sound (CB2_2_4I1R1Raw_sound a) (CB2_2_4I1R1P_check a) +def CB2_2_4I1R1Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_2_4I1R1Certificates (CB2_2_4I1R1CertificateIndex a)).output +lemma CB2_2_4I1R1Terms_sound (a : Fin 6) : + (CB2_2_4I1R1Terms a).Encloses (Foundation.entropyTerm (CB2_2_4I1R1Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB2_2_4I1R1Certificates_valid + (CB2_2_4I1R1CertificateIndex a) (CB2_2_4I1R1P_sound a) +def CB2_2_4I1R1Entropy : Ball := ⟨(29035798632197530040660383517107 / 100000000000000000000000000000000), (6684612613 / 25000000000000000000000000000000)⟩ +lemma CB2_2_4I1R1Entropy_sound : CB2_2_4I1R1Entropy.Encloses (Foundation.finiteEntropy CB2_2_4I1R1Value) := by + exact contains_sound (entropyFin_enclosed 6 CB2_2_4I1R1Value CB2_2_4I1R1Terms CB2_2_4I1R1Terms_sound) (by decide +kernel) +def CB2_2_4I1R1Mass : Ball := ⟨(3156719039983739776176606960581 / 5000000000000000000000000000000), (11 / 12500000000000000000000000000000)⟩ +lemma CB2_2_4I1R1Mass_sound : CB2_2_4I1R1Mass.Encloses (∑ a, CB2_2_4I1R1Value a) := by + exact contains_sound (finSumBall_sound 6 CB2_2_4I1R1P CB2_2_4I1R1Value CB2_2_4I1R1P_sound) (by decide +kernel) +def CB2_2_4I1R1MassTermLogWitness : LogWitness := ⟨-1, 3156719039983739776176606960581, 2500000000000000000000000000000⟩ +def CB2_2_4I1R1MassTermLog : Ball := ⟨(-9198094054118637402943840466023 / 20000000000000000000000000000000), (8470329501 / 20000000000000000000000000000000)⟩ +lemma CB2_2_4I1R1MassTermLog_sound : CB2_2_4I1R1MassTermLog.Encloses (Real.log ((∑ a, CB2_2_4I1R1Value a))) := by + exact checkLog_sound logTwoBall_sound (CB2_2_4I1R1Mass_sound) (w := CB2_2_4I1R1MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB2_2_4I1R1MassTerm : Ball := ⟨(29035798632197530040660383517107 / 100000000000000000000000000000000), (6684612613 / 25000000000000000000000000000000)⟩ +lemma CB2_2_4I1R1MassTerm_sound : CB2_2_4I1R1MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB2_2_4I1R1Value a))) := by + exact contains_sound (entropyTerm_ball (CB2_2_4I1R1Mass_sound) CB2_2_4I1R1MassTermLog_sound) (by decide +kernel) +def CB2_2_4I1R1H : Ball := ⟨0, (6684612613 / 12500000000000000000000000000000)⟩ +lemma CB2_2_4I1R1H_sound : CB2_2_4I1R1H.Encloses (homogeneousEntropy CB2_2_4I1R1Value) := by + exact contains_sound (homogeneous_enclosed CB2_2_4I1R1Value CB2_2_4I1R1MassTerm_sound CB2_2_4I1R1Entropy_sound) (by decide +kernel) +def CB2_2_4I1R2Value (a : Fin 6) : ℝ := residualLaw (below (shape 2 2 4)) (fun u => (stageBLaw (shape 2 2 4) u : ℝ)) (stageBPriority (shape 2 2 4)) 1 (fun u a => (littleLaw (shape 2 2 4) u ((stageBPriority (shape 2 2 4)) 1) a : ℝ)) 2 a +def CB2_2_4I1R2Raw (a : Fin 6) : Ball := residualBall (below (shape 2 2 4)) B2_2_4Law (stageBPriority (shape 2 2 4)) 1 (fun u => B2_2_4Little u ((stageBPriority (shape 2 2 4)) 1)) 2 a +lemma CB2_2_4I1R2Raw_sound (a : Fin 6) : + (CB2_2_4I1R2Raw a).Encloses (CB2_2_4I1R2Value a) := by + exact residualBall_sound_on (below (shape 2 2 4)) B2_2_4Law (fun u => (stageBLaw (shape 2 2 4) u : ℝ)) (stageBPriority (shape 2 2 4)) 1 (fun u => B2_2_4Little u ((stageBPriority (shape 2 2 4)) 1)) (fun u a => (littleLaw (shape 2 2 4) u ((stageBPriority (shape 2 2 4)) 1) a : ℝ)) (fun u _ => B2_2_4Law_sound u) (fun u _ a => B2_2_4Little_sound u ((stageBPriority (shape 2 2 4)) 1) a) 2 a +def CB2_2_4I1R2Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(16734578832719927516175160443997 / 100000000000000000000000000000000), (61 / 100000000000000000000000000000000)⟩ ⟨(934884054584194909694671240271 / 3125000000000000000000000000000), (7087369901 / 50000000000000000000000000000000)⟩ ⟨(-178769301849420023191302953685561 / 100000000000000000000000000000000), (10587911887 / 12500000000000000000000000000000)⟩ ⟨-3, 16734578832719927516175160443997, 12500000000000000000000000000000⟩, + .log ⟨(1676060038035253469983027737847 / 100000000000000000000000000000000), (7 / 100000000000000000000000000000000)⟩ ⟨(1370589502056228119583469905787 / 20000000000000000000000000000000), (1242218333 / 50000000000000000000000000000000)⟩ ⟨(-204436218117653100334233421709421 / 50000000000000000000000000000000), (74115383099 / 50000000000000000000000000000000)⟩ ⟨-6, 1676060038035253469983027737847, 1562500000000000000000000000000⟩] +lemma CB2_2_4I1R2Certificates_valid : + CB2_2_4I1R2Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB2_2_4I1R2CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | 2 => 1 + | 3 => 2 + | _ => 0 +def CB2_2_4I1R2P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_2_4I1R2Certificates (CB2_2_4I1R2CertificateIndex a)).input +lemma CB2_2_4I1R2P_check : ∀ a : Fin 6, contains (CB2_2_4I1R2Raw a) (CB2_2_4I1R2P a) = true := by + decide +kernel +lemma CB2_2_4I1R2P_sound (a : Fin 6) : + (CB2_2_4I1R2P a).Encloses (CB2_2_4I1R2Value a) := + contains_sound (CB2_2_4I1R2Raw_sound a) (CB2_2_4I1R2P_check a) +def CB2_2_4I1R2Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_2_4I1R2Certificates (CB2_2_4I1R2CertificateIndex a)).output +lemma CB2_2_4I1R2Terms_sound (a : Fin 6) : + (CB2_2_4I1R2Terms a).Encloses (Foundation.entropyTerm (CB2_2_4I1R2Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB2_2_4I1R2Certificates_valid + (CB2_2_4I1R2CertificateIndex a) (CB2_2_4I1R2P_sound a) +def CB2_2_4I1R2Entropy : Ball := ⟨(36769237256975377708146829217607 / 100000000000000000000000000000000), (4164794117 / 25000000000000000000000000000000)⟩ +lemma CB2_2_4I1R2Entropy_sound : CB2_2_4I1R2Entropy.Encloses (Foundation.finiteEntropy CB2_2_4I1R2Value) := by + exact contains_sound (entropyFin_enclosed 6 CB2_2_4I1R2Value CB2_2_4I1R2Terms CB2_2_4I1R2Terms_sound) (by decide +kernel) +def CB2_2_4I1R2Mass : Ball := ⟨(4602659717688795246539547045461 / 25000000000000000000000000000000), (17 / 25000000000000000000000000000000)⟩ +lemma CB2_2_4I1R2Mass_sound : CB2_2_4I1R2Mass.Encloses (∑ a, CB2_2_4I1R2Value a) := by + exact contains_sound (finSumBall_sound 6 CB2_2_4I1R2P CB2_2_4I1R2Value CB2_2_4I1R2P_sound) (by decide +kernel) +def CB2_2_4I1R2MassTermLogWitness : LogWitness := ⟨-3, 4602659717688795246539547045461, 3125000000000000000000000000000⟩ +def CB2_2_4I1R2MassTermLog : Ball := ⟨(-169224148896851114673947115933983 / 100000000000000000000000000000000), (84703295101 / 100000000000000000000000000000000)⟩ +lemma CB2_2_4I1R2MassTermLog_sound : CB2_2_4I1R2MassTermLog.Encloses (Real.log ((∑ a, CB2_2_4I1R2Value a))) := by + exact checkLog_sound logTwoBall_sound (CB2_2_4I1R2Mass_sound) (w := CB2_2_4I1R2MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB2_2_4I1R2MassTerm : Ball := ⟨(31155246935508296120647022464513 / 100000000000000000000000000000000), (15594417889 / 100000000000000000000000000000000)⟩ +lemma CB2_2_4I1R2MassTerm_sound : CB2_2_4I1R2MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB2_2_4I1R2Value a))) := by + exact contains_sound (entropyTerm_ball (CB2_2_4I1R2Mass_sound) CB2_2_4I1R2MassTermLog_sound) (by decide +kernel) +def CB2_2_4I1R2H : Ball := ⟨(2806995160733540793749903376547 / 50000000000000000000000000000000), (32253594357 / 100000000000000000000000000000000)⟩ +lemma CB2_2_4I1R2H_sound : CB2_2_4I1R2H.Encloses (homogeneousEntropy CB2_2_4I1R2Value) := by + exact contains_sound (homogeneous_enclosed CB2_2_4I1R2Value CB2_2_4I1R2MassTerm_sound CB2_2_4I1R2Entropy_sound) (by decide +kernel) +def CB2_2_4I1R3Value (a : Fin 6) : ℝ := residualLaw (below (shape 2 2 4)) (fun u => (stageBLaw (shape 2 2 4) u : ℝ)) (stageBPriority (shape 2 2 4)) 1 (fun u a => (littleLaw (shape 2 2 4) u ((stageBPriority (shape 2 2 4)) 1) a : ℝ)) 3 a +def CB2_2_4I1R3Raw (a : Fin 6) : Ball := residualBall (below (shape 2 2 4)) B2_2_4Law (stageBPriority (shape 2 2 4)) 1 (fun u => B2_2_4Little u ((stageBPriority (shape 2 2 4)) 1)) 3 a +lemma CB2_2_4I1R3Raw_sound (a : Fin 6) : + (CB2_2_4I1R3Raw a).Encloses (CB2_2_4I1R3Value a) := by + exact residualBall_sound_on (below (shape 2 2 4)) B2_2_4Law (fun u => (stageBLaw (shape 2 2 4) u : ℝ)) (stageBPriority (shape 2 2 4)) 1 (fun u => B2_2_4Little u ((stageBPriority (shape 2 2 4)) 1)) (fun u a => (littleLaw (shape 2 2 4) u ((stageBPriority (shape 2 2 4)) 1) a : ℝ)) (fun u _ => B2_2_4Law_sound u) (fun u _ a => B2_2_4Little_sound u ((stageBPriority (shape 2 2 4)) 1) a) 3 a +def CB2_2_4I1R3Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB2_2_4I1R3Certificates_valid : + CB2_2_4I1R3Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB2_2_4I1R3CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB2_2_4I1R3P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_2_4I1R3Certificates (CB2_2_4I1R3CertificateIndex a)).input +lemma CB2_2_4I1R3P_check : ∀ a : Fin 6, contains (CB2_2_4I1R3Raw a) (CB2_2_4I1R3P a) = true := by + decide +kernel +lemma CB2_2_4I1R3P_sound (a : Fin 6) : + (CB2_2_4I1R3P a).Encloses (CB2_2_4I1R3Value a) := + contains_sound (CB2_2_4I1R3Raw_sound a) (CB2_2_4I1R3P_check a) +def CB2_2_4I1R3Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_2_4I1R3Certificates (CB2_2_4I1R3CertificateIndex a)).output +lemma CB2_2_4I1R3Terms_sound (a : Fin 6) : + (CB2_2_4I1R3Terms a).Encloses (Foundation.entropyTerm (CB2_2_4I1R3Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB2_2_4I1R3Certificates_valid + (CB2_2_4I1R3CertificateIndex a) (CB2_2_4I1R3P_sound a) +def CB2_2_4I1R3Entropy : Ball := ⟨0, 0⟩ +lemma CB2_2_4I1R3Entropy_sound : CB2_2_4I1R3Entropy.Encloses (Foundation.finiteEntropy CB2_2_4I1R3Value) := by + exact contains_sound (entropyFin_enclosed 6 CB2_2_4I1R3Value CB2_2_4I1R3Terms CB2_2_4I1R3Terms_sound) (by decide +kernel) +def CB2_2_4I1R3Mass : Ball := ⟨0, 0⟩ +lemma CB2_2_4I1R3Mass_sound : CB2_2_4I1R3Mass.Encloses (∑ a, CB2_2_4I1R3Value a) := by + exact contains_sound (finSumBall_sound 6 CB2_2_4I1R3P CB2_2_4I1R3Value CB2_2_4I1R3P_sound) (by decide +kernel) +def CB2_2_4I1R3MassTerm : Ball := .exact 0 +lemma CB2_2_4I1R3MassTerm_sound : CB2_2_4I1R3MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB2_2_4I1R3Value a))) := + entropyTerm_zero_ball (CB2_2_4I1R3Mass_sound) +def CB2_2_4I1R3H : Ball := ⟨0, 0⟩ +lemma CB2_2_4I1R3H_sound : CB2_2_4I1R3H.Encloses (homogeneousEntropy CB2_2_4I1R3Value) := by + exact contains_sound (homogeneous_enclosed CB2_2_4I1R3Value CB2_2_4I1R3MassTerm_sound CB2_2_4I1R3Entropy_sound) (by decide +kernel) +def CB2_2_4I1R4Value (a : Fin 6) : ℝ := residualLaw (below (shape 2 2 4)) (fun u => (stageBLaw (shape 2 2 4) u : ℝ)) (stageBPriority (shape 2 2 4)) 1 (fun u a => (littleLaw (shape 2 2 4) u ((stageBPriority (shape 2 2 4)) 1) a : ℝ)) 4 a +def CB2_2_4I1R4Raw (a : Fin 6) : Ball := residualBall (below (shape 2 2 4)) B2_2_4Law (stageBPriority (shape 2 2 4)) 1 (fun u => B2_2_4Little u ((stageBPriority (shape 2 2 4)) 1)) 4 a +lemma CB2_2_4I1R4Raw_sound (a : Fin 6) : + (CB2_2_4I1R4Raw a).Encloses (CB2_2_4I1R4Value a) := by + exact residualBall_sound_on (below (shape 2 2 4)) B2_2_4Law (fun u => (stageBLaw (shape 2 2 4) u : ℝ)) (stageBPriority (shape 2 2 4)) 1 (fun u => B2_2_4Little u ((stageBPriority (shape 2 2 4)) 1)) (fun u a => (littleLaw (shape 2 2 4) u ((stageBPriority (shape 2 2 4)) 1) a : ℝ)) (fun u _ => B2_2_4Law_sound u) (fun u _ a => B2_2_4Little_sound u ((stageBPriority (shape 2 2 4)) 1) a) 4 a +def CB2_2_4I1R4Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB2_2_4I1R4Certificates_valid : + CB2_2_4I1R4Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB2_2_4I1R4CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB2_2_4I1R4P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_2_4I1R4Certificates (CB2_2_4I1R4CertificateIndex a)).input +lemma CB2_2_4I1R4P_check : ∀ a : Fin 6, contains (CB2_2_4I1R4Raw a) (CB2_2_4I1R4P a) = true := by + decide +kernel +lemma CB2_2_4I1R4P_sound (a : Fin 6) : + (CB2_2_4I1R4P a).Encloses (CB2_2_4I1R4Value a) := + contains_sound (CB2_2_4I1R4Raw_sound a) (CB2_2_4I1R4P_check a) +def CB2_2_4I1R4Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_2_4I1R4Certificates (CB2_2_4I1R4CertificateIndex a)).output +lemma CB2_2_4I1R4Terms_sound (a : Fin 6) : + (CB2_2_4I1R4Terms a).Encloses (Foundation.entropyTerm (CB2_2_4I1R4Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB2_2_4I1R4Certificates_valid + (CB2_2_4I1R4CertificateIndex a) (CB2_2_4I1R4P_sound a) +def CB2_2_4I1R4Entropy : Ball := ⟨0, 0⟩ +lemma CB2_2_4I1R4Entropy_sound : CB2_2_4I1R4Entropy.Encloses (Foundation.finiteEntropy CB2_2_4I1R4Value) := by + exact contains_sound (entropyFin_enclosed 6 CB2_2_4I1R4Value CB2_2_4I1R4Terms CB2_2_4I1R4Terms_sound) (by decide +kernel) +def CB2_2_4I1R4Mass : Ball := ⟨0, 0⟩ +lemma CB2_2_4I1R4Mass_sound : CB2_2_4I1R4Mass.Encloses (∑ a, CB2_2_4I1R4Value a) := by + exact contains_sound (finSumBall_sound 6 CB2_2_4I1R4P CB2_2_4I1R4Value CB2_2_4I1R4P_sound) (by decide +kernel) +def CB2_2_4I1R4MassTerm : Ball := .exact 0 +lemma CB2_2_4I1R4MassTerm_sound : CB2_2_4I1R4MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB2_2_4I1R4Value a))) := + entropyTerm_zero_ball (CB2_2_4I1R4Mass_sound) +def CB2_2_4I1R4H : Ball := ⟨0, 0⟩ +lemma CB2_2_4I1R4H_sound : CB2_2_4I1R4H.Encloses (homogeneousEntropy CB2_2_4I1R4Value) := by + exact contains_sound (homogeneous_enclosed CB2_2_4I1R4Value CB2_2_4I1R4MassTerm_sound CB2_2_4I1R4Entropy_sound) (by decide +kernel) +def CB2_2_4I1R5Value (a : Fin 6) : ℝ := residualLaw (below (shape 2 2 4)) (fun u => (stageBLaw (shape 2 2 4) u : ℝ)) (stageBPriority (shape 2 2 4)) 1 (fun u a => (littleLaw (shape 2 2 4) u ((stageBPriority (shape 2 2 4)) 1) a : ℝ)) 5 a +def CB2_2_4I1R5Raw (a : Fin 6) : Ball := residualBall (below (shape 2 2 4)) B2_2_4Law (stageBPriority (shape 2 2 4)) 1 (fun u => B2_2_4Little u ((stageBPriority (shape 2 2 4)) 1)) 5 a +lemma CB2_2_4I1R5Raw_sound (a : Fin 6) : + (CB2_2_4I1R5Raw a).Encloses (CB2_2_4I1R5Value a) := by + exact residualBall_sound_on (below (shape 2 2 4)) B2_2_4Law (fun u => (stageBLaw (shape 2 2 4) u : ℝ)) (stageBPriority (shape 2 2 4)) 1 (fun u => B2_2_4Little u ((stageBPriority (shape 2 2 4)) 1)) (fun u a => (littleLaw (shape 2 2 4) u ((stageBPriority (shape 2 2 4)) 1) a : ℝ)) (fun u _ => B2_2_4Law_sound u) (fun u _ a => B2_2_4Little_sound u ((stageBPriority (shape 2 2 4)) 1) a) 5 a +def CB2_2_4I1R5Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB2_2_4I1R5Certificates_valid : + CB2_2_4I1R5Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB2_2_4I1R5CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB2_2_4I1R5P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_2_4I1R5Certificates (CB2_2_4I1R5CertificateIndex a)).input +lemma CB2_2_4I1R5P_check : ∀ a : Fin 6, contains (CB2_2_4I1R5Raw a) (CB2_2_4I1R5P a) = true := by + decide +kernel +lemma CB2_2_4I1R5P_sound (a : Fin 6) : + (CB2_2_4I1R5P a).Encloses (CB2_2_4I1R5Value a) := + contains_sound (CB2_2_4I1R5Raw_sound a) (CB2_2_4I1R5P_check a) +def CB2_2_4I1R5Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_2_4I1R5Certificates (CB2_2_4I1R5CertificateIndex a)).output +lemma CB2_2_4I1R5Terms_sound (a : Fin 6) : + (CB2_2_4I1R5Terms a).Encloses (Foundation.entropyTerm (CB2_2_4I1R5Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB2_2_4I1R5Certificates_valid + (CB2_2_4I1R5CertificateIndex a) (CB2_2_4I1R5P_sound a) +def CB2_2_4I1R5Entropy : Ball := ⟨0, 0⟩ +lemma CB2_2_4I1R5Entropy_sound : CB2_2_4I1R5Entropy.Encloses (Foundation.finiteEntropy CB2_2_4I1R5Value) := by + exact contains_sound (entropyFin_enclosed 6 CB2_2_4I1R5Value CB2_2_4I1R5Terms CB2_2_4I1R5Terms_sound) (by decide +kernel) +def CB2_2_4I1R5Mass : Ball := ⟨0, 0⟩ +lemma CB2_2_4I1R5Mass_sound : CB2_2_4I1R5Mass.Encloses (∑ a, CB2_2_4I1R5Value a) := by + exact contains_sound (finSumBall_sound 6 CB2_2_4I1R5P CB2_2_4I1R5Value CB2_2_4I1R5P_sound) (by decide +kernel) +def CB2_2_4I1R5MassTerm : Ball := .exact 0 +lemma CB2_2_4I1R5MassTerm_sound : CB2_2_4I1R5MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB2_2_4I1R5Value a))) := + entropyTerm_zero_ball (CB2_2_4I1R5Mass_sound) +def CB2_2_4I1R5H : Ball := ⟨0, 0⟩ +lemma CB2_2_4I1R5H_sound : CB2_2_4I1R5H.Encloses (homogeneousEntropy CB2_2_4I1R5Value) := by + exact contains_sound (homogeneous_enclosed CB2_2_4I1R5Value CB2_2_4I1R5MassTerm_sound CB2_2_4I1R5Entropy_sound) (by decide +kernel) +def CB2_2_4I1R6Value (a : Fin 6) : ℝ := residualLaw (below (shape 2 2 4)) (fun u => (stageBLaw (shape 2 2 4) u : ℝ)) (stageBPriority (shape 2 2 4)) 1 (fun u a => (littleLaw (shape 2 2 4) u ((stageBPriority (shape 2 2 4)) 1) a : ℝ)) 6 a +def CB2_2_4I1R6Raw (a : Fin 6) : Ball := residualBall (below (shape 2 2 4)) B2_2_4Law (stageBPriority (shape 2 2 4)) 1 (fun u => B2_2_4Little u ((stageBPriority (shape 2 2 4)) 1)) 6 a +lemma CB2_2_4I1R6Raw_sound (a : Fin 6) : + (CB2_2_4I1R6Raw a).Encloses (CB2_2_4I1R6Value a) := by + exact residualBall_sound_on (below (shape 2 2 4)) B2_2_4Law (fun u => (stageBLaw (shape 2 2 4) u : ℝ)) (stageBPriority (shape 2 2 4)) 1 (fun u => B2_2_4Little u ((stageBPriority (shape 2 2 4)) 1)) (fun u a => (littleLaw (shape 2 2 4) u ((stageBPriority (shape 2 2 4)) 1) a : ℝ)) (fun u _ => B2_2_4Law_sound u) (fun u _ a => B2_2_4Little_sound u ((stageBPriority (shape 2 2 4)) 1) a) 6 a +def CB2_2_4I1R6Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB2_2_4I1R6Certificates_valid : + CB2_2_4I1R6Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB2_2_4I1R6CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB2_2_4I1R6P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_2_4I1R6Certificates (CB2_2_4I1R6CertificateIndex a)).input +lemma CB2_2_4I1R6P_check : ∀ a : Fin 6, contains (CB2_2_4I1R6Raw a) (CB2_2_4I1R6P a) = true := by + decide +kernel +lemma CB2_2_4I1R6P_sound (a : Fin 6) : + (CB2_2_4I1R6P a).Encloses (CB2_2_4I1R6Value a) := + contains_sound (CB2_2_4I1R6Raw_sound a) (CB2_2_4I1R6P_check a) +def CB2_2_4I1R6Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_2_4I1R6Certificates (CB2_2_4I1R6CertificateIndex a)).output +lemma CB2_2_4I1R6Terms_sound (a : Fin 6) : + (CB2_2_4I1R6Terms a).Encloses (Foundation.entropyTerm (CB2_2_4I1R6Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB2_2_4I1R6Certificates_valid + (CB2_2_4I1R6CertificateIndex a) (CB2_2_4I1R6P_sound a) +def CB2_2_4I1R6Entropy : Ball := ⟨0, 0⟩ +lemma CB2_2_4I1R6Entropy_sound : CB2_2_4I1R6Entropy.Encloses (Foundation.finiteEntropy CB2_2_4I1R6Value) := by + exact contains_sound (entropyFin_enclosed 6 CB2_2_4I1R6Value CB2_2_4I1R6Terms CB2_2_4I1R6Terms_sound) (by decide +kernel) +def CB2_2_4I1R6Mass : Ball := ⟨0, 0⟩ +lemma CB2_2_4I1R6Mass_sound : CB2_2_4I1R6Mass.Encloses (∑ a, CB2_2_4I1R6Value a) := by + exact contains_sound (finSumBall_sound 6 CB2_2_4I1R6P CB2_2_4I1R6Value CB2_2_4I1R6P_sound) (by decide +kernel) +def CB2_2_4I1R6MassTerm : Ball := .exact 0 +lemma CB2_2_4I1R6MassTerm_sound : CB2_2_4I1R6MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB2_2_4I1R6Value a))) := + entropyTerm_zero_ball (CB2_2_4I1R6Mass_sound) +def CB2_2_4I1R6H : Ball := ⟨0, 0⟩ +lemma CB2_2_4I1R6H_sound : CB2_2_4I1R6H.Encloses (homogeneousEntropy CB2_2_4I1R6Value) := by + exact contains_sound (homogeneous_enclosed CB2_2_4I1R6Value CB2_2_4I1R6MassTerm_sound CB2_2_4I1R6Entropy_sound) (by decide +kernel) +def CB2_2_4I1R7Value (a : Fin 6) : ℝ := residualLaw (below (shape 2 2 4)) (fun u => (stageBLaw (shape 2 2 4) u : ℝ)) (stageBPriority (shape 2 2 4)) 1 (fun u a => (littleLaw (shape 2 2 4) u ((stageBPriority (shape 2 2 4)) 1) a : ℝ)) 7 a +def CB2_2_4I1R7Raw (a : Fin 6) : Ball := residualBall (below (shape 2 2 4)) B2_2_4Law (stageBPriority (shape 2 2 4)) 1 (fun u => B2_2_4Little u ((stageBPriority (shape 2 2 4)) 1)) 7 a +lemma CB2_2_4I1R7Raw_sound (a : Fin 6) : + (CB2_2_4I1R7Raw a).Encloses (CB2_2_4I1R7Value a) := by + exact residualBall_sound_on (below (shape 2 2 4)) B2_2_4Law (fun u => (stageBLaw (shape 2 2 4) u : ℝ)) (stageBPriority (shape 2 2 4)) 1 (fun u => B2_2_4Little u ((stageBPriority (shape 2 2 4)) 1)) (fun u a => (littleLaw (shape 2 2 4) u ((stageBPriority (shape 2 2 4)) 1) a : ℝ)) (fun u _ => B2_2_4Law_sound u) (fun u _ a => B2_2_4Little_sound u ((stageBPriority (shape 2 2 4)) 1) a) 7 a +def CB2_2_4I1R7Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB2_2_4I1R7Certificates_valid : + CB2_2_4I1R7Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB2_2_4I1R7CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB2_2_4I1R7P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_2_4I1R7Certificates (CB2_2_4I1R7CertificateIndex a)).input +lemma CB2_2_4I1R7P_check : ∀ a : Fin 6, contains (CB2_2_4I1R7Raw a) (CB2_2_4I1R7P a) = true := by + decide +kernel +lemma CB2_2_4I1R7P_sound (a : Fin 6) : + (CB2_2_4I1R7P a).Encloses (CB2_2_4I1R7Value a) := + contains_sound (CB2_2_4I1R7Raw_sound a) (CB2_2_4I1R7P_check a) +def CB2_2_4I1R7Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_2_4I1R7Certificates (CB2_2_4I1R7CertificateIndex a)).output +lemma CB2_2_4I1R7Terms_sound (a : Fin 6) : + (CB2_2_4I1R7Terms a).Encloses (Foundation.entropyTerm (CB2_2_4I1R7Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB2_2_4I1R7Certificates_valid + (CB2_2_4I1R7CertificateIndex a) (CB2_2_4I1R7P_sound a) +def CB2_2_4I1R7Entropy : Ball := ⟨0, 0⟩ +lemma CB2_2_4I1R7Entropy_sound : CB2_2_4I1R7Entropy.Encloses (Foundation.finiteEntropy CB2_2_4I1R7Value) := by + exact contains_sound (entropyFin_enclosed 6 CB2_2_4I1R7Value CB2_2_4I1R7Terms CB2_2_4I1R7Terms_sound) (by decide +kernel) +def CB2_2_4I1R7Mass : Ball := ⟨0, 0⟩ +lemma CB2_2_4I1R7Mass_sound : CB2_2_4I1R7Mass.Encloses (∑ a, CB2_2_4I1R7Value a) := by + exact contains_sound (finSumBall_sound 6 CB2_2_4I1R7P CB2_2_4I1R7Value CB2_2_4I1R7P_sound) (by decide +kernel) +def CB2_2_4I1R7MassTerm : Ball := .exact 0 +lemma CB2_2_4I1R7MassTerm_sound : CB2_2_4I1R7MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB2_2_4I1R7Value a))) := + entropyTerm_zero_ball (CB2_2_4I1R7Mass_sound) +def CB2_2_4I1R7H : Ball := ⟨0, 0⟩ +lemma CB2_2_4I1R7H_sound : CB2_2_4I1R7H.Encloses (homogeneousEntropy CB2_2_4I1R7Value) := by + exact contains_sound (homogeneous_enclosed CB2_2_4I1R7Value CB2_2_4I1R7MassTerm_sound CB2_2_4I1R7Entropy_sound) (by decide +kernel) +def CB2_2_4I1R8Value (a : Fin 6) : ℝ := residualLaw (below (shape 2 2 4)) (fun u => (stageBLaw (shape 2 2 4) u : ℝ)) (stageBPriority (shape 2 2 4)) 1 (fun u a => (littleLaw (shape 2 2 4) u ((stageBPriority (shape 2 2 4)) 1) a : ℝ)) 8 a +def CB2_2_4I1R8Raw (a : Fin 6) : Ball := residualBall (below (shape 2 2 4)) B2_2_4Law (stageBPriority (shape 2 2 4)) 1 (fun u => B2_2_4Little u ((stageBPriority (shape 2 2 4)) 1)) 8 a +lemma CB2_2_4I1R8Raw_sound (a : Fin 6) : + (CB2_2_4I1R8Raw a).Encloses (CB2_2_4I1R8Value a) := by + exact residualBall_sound_on (below (shape 2 2 4)) B2_2_4Law (fun u => (stageBLaw (shape 2 2 4) u : ℝ)) (stageBPriority (shape 2 2 4)) 1 (fun u => B2_2_4Little u ((stageBPriority (shape 2 2 4)) 1)) (fun u a => (littleLaw (shape 2 2 4) u ((stageBPriority (shape 2 2 4)) 1) a : ℝ)) (fun u _ => B2_2_4Law_sound u) (fun u _ a => B2_2_4Little_sound u ((stageBPriority (shape 2 2 4)) 1) a) 8 a +def CB2_2_4I1R8Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB2_2_4I1R8Certificates_valid : + CB2_2_4I1R8Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB2_2_4I1R8CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB2_2_4I1R8P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_2_4I1R8Certificates (CB2_2_4I1R8CertificateIndex a)).input +lemma CB2_2_4I1R8P_check : ∀ a : Fin 6, contains (CB2_2_4I1R8Raw a) (CB2_2_4I1R8P a) = true := by + decide +kernel +lemma CB2_2_4I1R8P_sound (a : Fin 6) : + (CB2_2_4I1R8P a).Encloses (CB2_2_4I1R8Value a) := + contains_sound (CB2_2_4I1R8Raw_sound a) (CB2_2_4I1R8P_check a) +def CB2_2_4I1R8Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_2_4I1R8Certificates (CB2_2_4I1R8CertificateIndex a)).output +lemma CB2_2_4I1R8Terms_sound (a : Fin 6) : + (CB2_2_4I1R8Terms a).Encloses (Foundation.entropyTerm (CB2_2_4I1R8Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB2_2_4I1R8Certificates_valid + (CB2_2_4I1R8CertificateIndex a) (CB2_2_4I1R8P_sound a) +def CB2_2_4I1R8Entropy : Ball := ⟨0, 0⟩ +lemma CB2_2_4I1R8Entropy_sound : CB2_2_4I1R8Entropy.Encloses (Foundation.finiteEntropy CB2_2_4I1R8Value) := by + exact contains_sound (entropyFin_enclosed 6 CB2_2_4I1R8Value CB2_2_4I1R8Terms CB2_2_4I1R8Terms_sound) (by decide +kernel) +def CB2_2_4I1R8Mass : Ball := ⟨0, 0⟩ +lemma CB2_2_4I1R8Mass_sound : CB2_2_4I1R8Mass.Encloses (∑ a, CB2_2_4I1R8Value a) := by + exact contains_sound (finSumBall_sound 6 CB2_2_4I1R8P CB2_2_4I1R8Value CB2_2_4I1R8P_sound) (by decide +kernel) +def CB2_2_4I1R8MassTerm : Ball := .exact 0 +lemma CB2_2_4I1R8MassTerm_sound : CB2_2_4I1R8MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB2_2_4I1R8Value a))) := + entropyTerm_zero_ball (CB2_2_4I1R8Mass_sound) +def CB2_2_4I1R8H : Ball := ⟨0, 0⟩ +lemma CB2_2_4I1R8H_sound : CB2_2_4I1R8H.Encloses (homogeneousEntropy CB2_2_4I1R8Value) := by + exact contains_sound (homogeneous_enclosed CB2_2_4I1R8Value CB2_2_4I1R8MassTerm_sound CB2_2_4I1R8Entropy_sound) (by decide +kernel) +def CB2_2_4I1R9Value (a : Fin 6) : ℝ := residualLaw (below (shape 2 2 4)) (fun u => (stageBLaw (shape 2 2 4) u : ℝ)) (stageBPriority (shape 2 2 4)) 1 (fun u a => (littleLaw (shape 2 2 4) u ((stageBPriority (shape 2 2 4)) 1) a : ℝ)) 9 a +def CB2_2_4I1R9Raw (a : Fin 6) : Ball := residualBall (below (shape 2 2 4)) B2_2_4Law (stageBPriority (shape 2 2 4)) 1 (fun u => B2_2_4Little u ((stageBPriority (shape 2 2 4)) 1)) 9 a +lemma CB2_2_4I1R9Raw_sound (a : Fin 6) : + (CB2_2_4I1R9Raw a).Encloses (CB2_2_4I1R9Value a) := by + exact residualBall_sound_on (below (shape 2 2 4)) B2_2_4Law (fun u => (stageBLaw (shape 2 2 4) u : ℝ)) (stageBPriority (shape 2 2 4)) 1 (fun u => B2_2_4Little u ((stageBPriority (shape 2 2 4)) 1)) (fun u a => (littleLaw (shape 2 2 4) u ((stageBPriority (shape 2 2 4)) 1) a : ℝ)) (fun u _ => B2_2_4Law_sound u) (fun u _ a => B2_2_4Little_sound u ((stageBPriority (shape 2 2 4)) 1) a) 9 a +def CB2_2_4I1R9Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB2_2_4I1R9Certificates_valid : + CB2_2_4I1R9Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB2_2_4I1R9CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB2_2_4I1R9P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_2_4I1R9Certificates (CB2_2_4I1R9CertificateIndex a)).input +lemma CB2_2_4I1R9P_check : ∀ a : Fin 6, contains (CB2_2_4I1R9Raw a) (CB2_2_4I1R9P a) = true := by + decide +kernel +lemma CB2_2_4I1R9P_sound (a : Fin 6) : + (CB2_2_4I1R9P a).Encloses (CB2_2_4I1R9Value a) := + contains_sound (CB2_2_4I1R9Raw_sound a) (CB2_2_4I1R9P_check a) +def CB2_2_4I1R9Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_2_4I1R9Certificates (CB2_2_4I1R9CertificateIndex a)).output +lemma CB2_2_4I1R9Terms_sound (a : Fin 6) : + (CB2_2_4I1R9Terms a).Encloses (Foundation.entropyTerm (CB2_2_4I1R9Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB2_2_4I1R9Certificates_valid + (CB2_2_4I1R9CertificateIndex a) (CB2_2_4I1R9P_sound a) +def CB2_2_4I1R9Entropy : Ball := ⟨0, 0⟩ +lemma CB2_2_4I1R9Entropy_sound : CB2_2_4I1R9Entropy.Encloses (Foundation.finiteEntropy CB2_2_4I1R9Value) := by + exact contains_sound (entropyFin_enclosed 6 CB2_2_4I1R9Value CB2_2_4I1R9Terms CB2_2_4I1R9Terms_sound) (by decide +kernel) +def CB2_2_4I1R9Mass : Ball := ⟨0, 0⟩ +lemma CB2_2_4I1R9Mass_sound : CB2_2_4I1R9Mass.Encloses (∑ a, CB2_2_4I1R9Value a) := by + exact contains_sound (finSumBall_sound 6 CB2_2_4I1R9P CB2_2_4I1R9Value CB2_2_4I1R9P_sound) (by decide +kernel) +def CB2_2_4I1R9MassTerm : Ball := .exact 0 +lemma CB2_2_4I1R9MassTerm_sound : CB2_2_4I1R9MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB2_2_4I1R9Value a))) := + entropyTerm_zero_ball (CB2_2_4I1R9Mass_sound) +def CB2_2_4I1R9H : Ball := ⟨0, 0⟩ +lemma CB2_2_4I1R9H_sound : CB2_2_4I1R9H.Encloses (homogeneousEntropy CB2_2_4I1R9Value) := by + exact contains_sound (homogeneous_enclosed CB2_2_4I1R9Value CB2_2_4I1R9MassTerm_sound CB2_2_4I1R9Entropy_sound) (by decide +kernel) +def CB2_2_4I1R10Value (a : Fin 6) : ℝ := residualLaw (below (shape 2 2 4)) (fun u => (stageBLaw (shape 2 2 4) u : ℝ)) (stageBPriority (shape 2 2 4)) 1 (fun u a => (littleLaw (shape 2 2 4) u ((stageBPriority (shape 2 2 4)) 1) a : ℝ)) 10 a +def CB2_2_4I1R10Raw (a : Fin 6) : Ball := residualBall (below (shape 2 2 4)) B2_2_4Law (stageBPriority (shape 2 2 4)) 1 (fun u => B2_2_4Little u ((stageBPriority (shape 2 2 4)) 1)) 10 a +lemma CB2_2_4I1R10Raw_sound (a : Fin 6) : + (CB2_2_4I1R10Raw a).Encloses (CB2_2_4I1R10Value a) := by + exact residualBall_sound_on (below (shape 2 2 4)) B2_2_4Law (fun u => (stageBLaw (shape 2 2 4) u : ℝ)) (stageBPriority (shape 2 2 4)) 1 (fun u => B2_2_4Little u ((stageBPriority (shape 2 2 4)) 1)) (fun u a => (littleLaw (shape 2 2 4) u ((stageBPriority (shape 2 2 4)) 1) a : ℝ)) (fun u _ => B2_2_4Law_sound u) (fun u _ a => B2_2_4Little_sound u ((stageBPriority (shape 2 2 4)) 1) a) 10 a +def CB2_2_4I1R10Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB2_2_4I1R10Certificates_valid : + CB2_2_4I1R10Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB2_2_4I1R10CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB2_2_4I1R10P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_2_4I1R10Certificates (CB2_2_4I1R10CertificateIndex a)).input +lemma CB2_2_4I1R10P_check : ∀ a : Fin 6, contains (CB2_2_4I1R10Raw a) (CB2_2_4I1R10P a) = true := by + decide +kernel +lemma CB2_2_4I1R10P_sound (a : Fin 6) : + (CB2_2_4I1R10P a).Encloses (CB2_2_4I1R10Value a) := + contains_sound (CB2_2_4I1R10Raw_sound a) (CB2_2_4I1R10P_check a) +def CB2_2_4I1R10Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_2_4I1R10Certificates (CB2_2_4I1R10CertificateIndex a)).output +lemma CB2_2_4I1R10Terms_sound (a : Fin 6) : + (CB2_2_4I1R10Terms a).Encloses (Foundation.entropyTerm (CB2_2_4I1R10Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB2_2_4I1R10Certificates_valid + (CB2_2_4I1R10CertificateIndex a) (CB2_2_4I1R10P_sound a) +def CB2_2_4I1R10Entropy : Ball := ⟨0, 0⟩ +lemma CB2_2_4I1R10Entropy_sound : CB2_2_4I1R10Entropy.Encloses (Foundation.finiteEntropy CB2_2_4I1R10Value) := by + exact contains_sound (entropyFin_enclosed 6 CB2_2_4I1R10Value CB2_2_4I1R10Terms CB2_2_4I1R10Terms_sound) (by decide +kernel) +def CB2_2_4I1R10Mass : Ball := ⟨0, 0⟩ +lemma CB2_2_4I1R10Mass_sound : CB2_2_4I1R10Mass.Encloses (∑ a, CB2_2_4I1R10Value a) := by + exact contains_sound (finSumBall_sound 6 CB2_2_4I1R10P CB2_2_4I1R10Value CB2_2_4I1R10P_sound) (by decide +kernel) +def CB2_2_4I1R10MassTerm : Ball := .exact 0 +lemma CB2_2_4I1R10MassTerm_sound : CB2_2_4I1R10MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB2_2_4I1R10Value a))) := + entropyTerm_zero_ball (CB2_2_4I1R10Mass_sound) +def CB2_2_4I1R10H : Ball := ⟨0, 0⟩ +lemma CB2_2_4I1R10H_sound : CB2_2_4I1R10H.Encloses (homogeneousEntropy CB2_2_4I1R10Value) := by + exact contains_sound (homogeneous_enclosed CB2_2_4I1R10Value CB2_2_4I1R10MassTerm_sound CB2_2_4I1R10Entropy_sound) (by decide +kernel) +def CB2_2_4I1R11Value (a : Fin 6) : ℝ := residualLaw (below (shape 2 2 4)) (fun u => (stageBLaw (shape 2 2 4) u : ℝ)) (stageBPriority (shape 2 2 4)) 1 (fun u a => (littleLaw (shape 2 2 4) u ((stageBPriority (shape 2 2 4)) 1) a : ℝ)) 11 a +def CB2_2_4I1R11Raw (a : Fin 6) : Ball := residualBall (below (shape 2 2 4)) B2_2_4Law (stageBPriority (shape 2 2 4)) 1 (fun u => B2_2_4Little u ((stageBPriority (shape 2 2 4)) 1)) 11 a +lemma CB2_2_4I1R11Raw_sound (a : Fin 6) : + (CB2_2_4I1R11Raw a).Encloses (CB2_2_4I1R11Value a) := by + exact residualBall_sound_on (below (shape 2 2 4)) B2_2_4Law (fun u => (stageBLaw (shape 2 2 4) u : ℝ)) (stageBPriority (shape 2 2 4)) 1 (fun u => B2_2_4Little u ((stageBPriority (shape 2 2 4)) 1)) (fun u a => (littleLaw (shape 2 2 4) u ((stageBPriority (shape 2 2 4)) 1) a : ℝ)) (fun u _ => B2_2_4Law_sound u) (fun u _ a => B2_2_4Little_sound u ((stageBPriority (shape 2 2 4)) 1) a) 11 a +def CB2_2_4I1R11Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB2_2_4I1R11Certificates_valid : + CB2_2_4I1R11Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB2_2_4I1R11CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB2_2_4I1R11P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_2_4I1R11Certificates (CB2_2_4I1R11CertificateIndex a)).input +lemma CB2_2_4I1R11P_check : ∀ a : Fin 6, contains (CB2_2_4I1R11Raw a) (CB2_2_4I1R11P a) = true := by + decide +kernel +lemma CB2_2_4I1R11P_sound (a : Fin 6) : + (CB2_2_4I1R11P a).Encloses (CB2_2_4I1R11Value a) := + contains_sound (CB2_2_4I1R11Raw_sound a) (CB2_2_4I1R11P_check a) +def CB2_2_4I1R11Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_2_4I1R11Certificates (CB2_2_4I1R11CertificateIndex a)).output +lemma CB2_2_4I1R11Terms_sound (a : Fin 6) : + (CB2_2_4I1R11Terms a).Encloses (Foundation.entropyTerm (CB2_2_4I1R11Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB2_2_4I1R11Certificates_valid + (CB2_2_4I1R11CertificateIndex a) (CB2_2_4I1R11P_sound a) +def CB2_2_4I1R11Entropy : Ball := ⟨0, 0⟩ +lemma CB2_2_4I1R11Entropy_sound : CB2_2_4I1R11Entropy.Encloses (Foundation.finiteEntropy CB2_2_4I1R11Value) := by + exact contains_sound (entropyFin_enclosed 6 CB2_2_4I1R11Value CB2_2_4I1R11Terms CB2_2_4I1R11Terms_sound) (by decide +kernel) +def CB2_2_4I1R11Mass : Ball := ⟨0, 0⟩ +lemma CB2_2_4I1R11Mass_sound : CB2_2_4I1R11Mass.Encloses (∑ a, CB2_2_4I1R11Value a) := by + exact contains_sound (finSumBall_sound 6 CB2_2_4I1R11P CB2_2_4I1R11Value CB2_2_4I1R11P_sound) (by decide +kernel) +def CB2_2_4I1R11MassTerm : Ball := .exact 0 +lemma CB2_2_4I1R11MassTerm_sound : CB2_2_4I1R11MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB2_2_4I1R11Value a))) := + entropyTerm_zero_ball (CB2_2_4I1R11Mass_sound) +def CB2_2_4I1R11H : Ball := ⟨0, 0⟩ +lemma CB2_2_4I1R11H_sound : CB2_2_4I1R11H.Encloses (homogeneousEntropy CB2_2_4I1R11Value) := by + exact contains_sound (homogeneous_enclosed CB2_2_4I1R11Value CB2_2_4I1R11MassTerm_sound CB2_2_4I1R11Entropy_sound) (by decide +kernel) +def CB2_2_4I1R12Value (a : Fin 6) : ℝ := residualLaw (below (shape 2 2 4)) (fun u => (stageBLaw (shape 2 2 4) u : ℝ)) (stageBPriority (shape 2 2 4)) 1 (fun u a => (littleLaw (shape 2 2 4) u ((stageBPriority (shape 2 2 4)) 1) a : ℝ)) 12 a +def CB2_2_4I1R12Raw (a : Fin 6) : Ball := residualBall (below (shape 2 2 4)) B2_2_4Law (stageBPriority (shape 2 2 4)) 1 (fun u => B2_2_4Little u ((stageBPriority (shape 2 2 4)) 1)) 12 a +lemma CB2_2_4I1R12Raw_sound (a : Fin 6) : + (CB2_2_4I1R12Raw a).Encloses (CB2_2_4I1R12Value a) := by + exact residualBall_sound_on (below (shape 2 2 4)) B2_2_4Law (fun u => (stageBLaw (shape 2 2 4) u : ℝ)) (stageBPriority (shape 2 2 4)) 1 (fun u => B2_2_4Little u ((stageBPriority (shape 2 2 4)) 1)) (fun u a => (littleLaw (shape 2 2 4) u ((stageBPriority (shape 2 2 4)) 1) a : ℝ)) (fun u _ => B2_2_4Law_sound u) (fun u _ a => B2_2_4Little_sound u ((stageBPriority (shape 2 2 4)) 1) a) 12 a +def CB2_2_4I1R12Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB2_2_4I1R12Certificates_valid : + CB2_2_4I1R12Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB2_2_4I1R12CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB2_2_4I1R12P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_2_4I1R12Certificates (CB2_2_4I1R12CertificateIndex a)).input +lemma CB2_2_4I1R12P_check : ∀ a : Fin 6, contains (CB2_2_4I1R12Raw a) (CB2_2_4I1R12P a) = true := by + decide +kernel +lemma CB2_2_4I1R12P_sound (a : Fin 6) : + (CB2_2_4I1R12P a).Encloses (CB2_2_4I1R12Value a) := + contains_sound (CB2_2_4I1R12Raw_sound a) (CB2_2_4I1R12P_check a) +def CB2_2_4I1R12Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_2_4I1R12Certificates (CB2_2_4I1R12CertificateIndex a)).output +lemma CB2_2_4I1R12Terms_sound (a : Fin 6) : + (CB2_2_4I1R12Terms a).Encloses (Foundation.entropyTerm (CB2_2_4I1R12Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB2_2_4I1R12Certificates_valid + (CB2_2_4I1R12CertificateIndex a) (CB2_2_4I1R12P_sound a) +def CB2_2_4I1R12Entropy : Ball := ⟨0, 0⟩ +lemma CB2_2_4I1R12Entropy_sound : CB2_2_4I1R12Entropy.Encloses (Foundation.finiteEntropy CB2_2_4I1R12Value) := by + exact contains_sound (entropyFin_enclosed 6 CB2_2_4I1R12Value CB2_2_4I1R12Terms CB2_2_4I1R12Terms_sound) (by decide +kernel) +def CB2_2_4I1R12Mass : Ball := ⟨0, 0⟩ +lemma CB2_2_4I1R12Mass_sound : CB2_2_4I1R12Mass.Encloses (∑ a, CB2_2_4I1R12Value a) := by + exact contains_sound (finSumBall_sound 6 CB2_2_4I1R12P CB2_2_4I1R12Value CB2_2_4I1R12P_sound) (by decide +kernel) +def CB2_2_4I1R12MassTerm : Ball := .exact 0 +lemma CB2_2_4I1R12MassTerm_sound : CB2_2_4I1R12MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB2_2_4I1R12Value a))) := + entropyTerm_zero_ball (CB2_2_4I1R12Mass_sound) +def CB2_2_4I1R12H : Ball := ⟨0, 0⟩ +lemma CB2_2_4I1R12H_sound : CB2_2_4I1R12H.Encloses (homogeneousEntropy CB2_2_4I1R12Value) := by + exact contains_sound (homogeneous_enclosed CB2_2_4I1R12Value CB2_2_4I1R12MassTerm_sound CB2_2_4I1R12Entropy_sound) (by decide +kernel) +def CB2_2_4I1R13Value (a : Fin 6) : ℝ := residualLaw (below (shape 2 2 4)) (fun u => (stageBLaw (shape 2 2 4) u : ℝ)) (stageBPriority (shape 2 2 4)) 1 (fun u a => (littleLaw (shape 2 2 4) u ((stageBPriority (shape 2 2 4)) 1) a : ℝ)) 13 a +def CB2_2_4I1R13Raw (a : Fin 6) : Ball := residualBall (below (shape 2 2 4)) B2_2_4Law (stageBPriority (shape 2 2 4)) 1 (fun u => B2_2_4Little u ((stageBPriority (shape 2 2 4)) 1)) 13 a +lemma CB2_2_4I1R13Raw_sound (a : Fin 6) : + (CB2_2_4I1R13Raw a).Encloses (CB2_2_4I1R13Value a) := by + exact residualBall_sound_on (below (shape 2 2 4)) B2_2_4Law (fun u => (stageBLaw (shape 2 2 4) u : ℝ)) (stageBPriority (shape 2 2 4)) 1 (fun u => B2_2_4Little u ((stageBPriority (shape 2 2 4)) 1)) (fun u a => (littleLaw (shape 2 2 4) u ((stageBPriority (shape 2 2 4)) 1) a : ℝ)) (fun u _ => B2_2_4Law_sound u) (fun u _ a => B2_2_4Little_sound u ((stageBPriority (shape 2 2 4)) 1) a) 13 a +def CB2_2_4I1R13Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB2_2_4I1R13Certificates_valid : + CB2_2_4I1R13Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB2_2_4I1R13CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB2_2_4I1R13P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_2_4I1R13Certificates (CB2_2_4I1R13CertificateIndex a)).input +lemma CB2_2_4I1R13P_check : ∀ a : Fin 6, contains (CB2_2_4I1R13Raw a) (CB2_2_4I1R13P a) = true := by + decide +kernel +lemma CB2_2_4I1R13P_sound (a : Fin 6) : + (CB2_2_4I1R13P a).Encloses (CB2_2_4I1R13Value a) := + contains_sound (CB2_2_4I1R13Raw_sound a) (CB2_2_4I1R13P_check a) +def CB2_2_4I1R13Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_2_4I1R13Certificates (CB2_2_4I1R13CertificateIndex a)).output +lemma CB2_2_4I1R13Terms_sound (a : Fin 6) : + (CB2_2_4I1R13Terms a).Encloses (Foundation.entropyTerm (CB2_2_4I1R13Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB2_2_4I1R13Certificates_valid + (CB2_2_4I1R13CertificateIndex a) (CB2_2_4I1R13P_sound a) +def CB2_2_4I1R13Entropy : Ball := ⟨0, 0⟩ +lemma CB2_2_4I1R13Entropy_sound : CB2_2_4I1R13Entropy.Encloses (Foundation.finiteEntropy CB2_2_4I1R13Value) := by + exact contains_sound (entropyFin_enclosed 6 CB2_2_4I1R13Value CB2_2_4I1R13Terms CB2_2_4I1R13Terms_sound) (by decide +kernel) +def CB2_2_4I1R13Mass : Ball := ⟨0, 0⟩ +lemma CB2_2_4I1R13Mass_sound : CB2_2_4I1R13Mass.Encloses (∑ a, CB2_2_4I1R13Value a) := by + exact contains_sound (finSumBall_sound 6 CB2_2_4I1R13P CB2_2_4I1R13Value CB2_2_4I1R13P_sound) (by decide +kernel) +def CB2_2_4I1R13MassTerm : Ball := .exact 0 +lemma CB2_2_4I1R13MassTerm_sound : CB2_2_4I1R13MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB2_2_4I1R13Value a))) := + entropyTerm_zero_ball (CB2_2_4I1R13Mass_sound) +def CB2_2_4I1R13H : Ball := ⟨0, 0⟩ +lemma CB2_2_4I1R13H_sound : CB2_2_4I1R13H.Encloses (homogeneousEntropy CB2_2_4I1R13Value) := by + exact contains_sound (homogeneous_enclosed CB2_2_4I1R13Value CB2_2_4I1R13MassTerm_sound CB2_2_4I1R13Entropy_sound) (by decide +kernel) +def CB2_2_4I1R14Value (a : Fin 6) : ℝ := residualLaw (below (shape 2 2 4)) (fun u => (stageBLaw (shape 2 2 4) u : ℝ)) (stageBPriority (shape 2 2 4)) 1 (fun u a => (littleLaw (shape 2 2 4) u ((stageBPriority (shape 2 2 4)) 1) a : ℝ)) 14 a +def CB2_2_4I1R14Raw (a : Fin 6) : Ball := residualBall (below (shape 2 2 4)) B2_2_4Law (stageBPriority (shape 2 2 4)) 1 (fun u => B2_2_4Little u ((stageBPriority (shape 2 2 4)) 1)) 14 a +lemma CB2_2_4I1R14Raw_sound (a : Fin 6) : + (CB2_2_4I1R14Raw a).Encloses (CB2_2_4I1R14Value a) := by + exact residualBall_sound_on (below (shape 2 2 4)) B2_2_4Law (fun u => (stageBLaw (shape 2 2 4) u : ℝ)) (stageBPriority (shape 2 2 4)) 1 (fun u => B2_2_4Little u ((stageBPriority (shape 2 2 4)) 1)) (fun u a => (littleLaw (shape 2 2 4) u ((stageBPriority (shape 2 2 4)) 1) a : ℝ)) (fun u _ => B2_2_4Law_sound u) (fun u _ a => B2_2_4Little_sound u ((stageBPriority (shape 2 2 4)) 1) a) 14 a +def CB2_2_4I1R14Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB2_2_4I1R14Certificates_valid : + CB2_2_4I1R14Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB2_2_4I1R14CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB2_2_4I1R14P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_2_4I1R14Certificates (CB2_2_4I1R14CertificateIndex a)).input +lemma CB2_2_4I1R14P_check : ∀ a : Fin 6, contains (CB2_2_4I1R14Raw a) (CB2_2_4I1R14P a) = true := by + decide +kernel +lemma CB2_2_4I1R14P_sound (a : Fin 6) : + (CB2_2_4I1R14P a).Encloses (CB2_2_4I1R14Value a) := + contains_sound (CB2_2_4I1R14Raw_sound a) (CB2_2_4I1R14P_check a) +def CB2_2_4I1R14Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_2_4I1R14Certificates (CB2_2_4I1R14CertificateIndex a)).output +lemma CB2_2_4I1R14Terms_sound (a : Fin 6) : + (CB2_2_4I1R14Terms a).Encloses (Foundation.entropyTerm (CB2_2_4I1R14Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB2_2_4I1R14Certificates_valid + (CB2_2_4I1R14CertificateIndex a) (CB2_2_4I1R14P_sound a) +def CB2_2_4I1R14Entropy : Ball := ⟨0, 0⟩ +lemma CB2_2_4I1R14Entropy_sound : CB2_2_4I1R14Entropy.Encloses (Foundation.finiteEntropy CB2_2_4I1R14Value) := by + exact contains_sound (entropyFin_enclosed 6 CB2_2_4I1R14Value CB2_2_4I1R14Terms CB2_2_4I1R14Terms_sound) (by decide +kernel) +def CB2_2_4I1R14Mass : Ball := ⟨0, 0⟩ +lemma CB2_2_4I1R14Mass_sound : CB2_2_4I1R14Mass.Encloses (∑ a, CB2_2_4I1R14Value a) := by + exact contains_sound (finSumBall_sound 6 CB2_2_4I1R14P CB2_2_4I1R14Value CB2_2_4I1R14P_sound) (by decide +kernel) +def CB2_2_4I1R14MassTerm : Ball := .exact 0 +lemma CB2_2_4I1R14MassTerm_sound : CB2_2_4I1R14MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB2_2_4I1R14Value a))) := + entropyTerm_zero_ball (CB2_2_4I1R14Mass_sound) +def CB2_2_4I1R14H : Ball := ⟨0, 0⟩ +lemma CB2_2_4I1R14H_sound : CB2_2_4I1R14H.Encloses (homogeneousEntropy CB2_2_4I1R14Value) := by + exact contains_sound (homogeneous_enclosed CB2_2_4I1R14Value CB2_2_4I1R14MassTerm_sound CB2_2_4I1R14Entropy_sound) (by decide +kernel) +def CB2_2_4I1R15Value (a : Fin 6) : ℝ := residualLaw (below (shape 2 2 4)) (fun u => (stageBLaw (shape 2 2 4) u : ℝ)) (stageBPriority (shape 2 2 4)) 1 (fun u a => (littleLaw (shape 2 2 4) u ((stageBPriority (shape 2 2 4)) 1) a : ℝ)) 15 a +def CB2_2_4I1R15Raw (a : Fin 6) : Ball := residualBall (below (shape 2 2 4)) B2_2_4Law (stageBPriority (shape 2 2 4)) 1 (fun u => B2_2_4Little u ((stageBPriority (shape 2 2 4)) 1)) 15 a +lemma CB2_2_4I1R15Raw_sound (a : Fin 6) : + (CB2_2_4I1R15Raw a).Encloses (CB2_2_4I1R15Value a) := by + exact residualBall_sound_on (below (shape 2 2 4)) B2_2_4Law (fun u => (stageBLaw (shape 2 2 4) u : ℝ)) (stageBPriority (shape 2 2 4)) 1 (fun u => B2_2_4Little u ((stageBPriority (shape 2 2 4)) 1)) (fun u a => (littleLaw (shape 2 2 4) u ((stageBPriority (shape 2 2 4)) 1) a : ℝ)) (fun u _ => B2_2_4Law_sound u) (fun u _ a => B2_2_4Little_sound u ((stageBPriority (shape 2 2 4)) 1) a) 15 a +def CB2_2_4I1R15Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB2_2_4I1R15Certificates_valid : + CB2_2_4I1R15Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB2_2_4I1R15CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB2_2_4I1R15P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_2_4I1R15Certificates (CB2_2_4I1R15CertificateIndex a)).input +lemma CB2_2_4I1R15P_check : ∀ a : Fin 6, contains (CB2_2_4I1R15Raw a) (CB2_2_4I1R15P a) = true := by + decide +kernel +lemma CB2_2_4I1R15P_sound (a : Fin 6) : + (CB2_2_4I1R15P a).Encloses (CB2_2_4I1R15Value a) := + contains_sound (CB2_2_4I1R15Raw_sound a) (CB2_2_4I1R15P_check a) +def CB2_2_4I1R15Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_2_4I1R15Certificates (CB2_2_4I1R15CertificateIndex a)).output +lemma CB2_2_4I1R15Terms_sound (a : Fin 6) : + (CB2_2_4I1R15Terms a).Encloses (Foundation.entropyTerm (CB2_2_4I1R15Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB2_2_4I1R15Certificates_valid + (CB2_2_4I1R15CertificateIndex a) (CB2_2_4I1R15P_sound a) +def CB2_2_4I1R15Entropy : Ball := ⟨0, 0⟩ +lemma CB2_2_4I1R15Entropy_sound : CB2_2_4I1R15Entropy.Encloses (Foundation.finiteEntropy CB2_2_4I1R15Value) := by + exact contains_sound (entropyFin_enclosed 6 CB2_2_4I1R15Value CB2_2_4I1R15Terms CB2_2_4I1R15Terms_sound) (by decide +kernel) +def CB2_2_4I1R15Mass : Ball := ⟨0, 0⟩ +lemma CB2_2_4I1R15Mass_sound : CB2_2_4I1R15Mass.Encloses (∑ a, CB2_2_4I1R15Value a) := by + exact contains_sound (finSumBall_sound 6 CB2_2_4I1R15P CB2_2_4I1R15Value CB2_2_4I1R15P_sound) (by decide +kernel) +def CB2_2_4I1R15MassTerm : Ball := .exact 0 +lemma CB2_2_4I1R15MassTerm_sound : CB2_2_4I1R15MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB2_2_4I1R15Value a))) := + entropyTerm_zero_ball (CB2_2_4I1R15Mass_sound) +def CB2_2_4I1R15H : Ball := ⟨0, 0⟩ +lemma CB2_2_4I1R15H_sound : CB2_2_4I1R15H.Encloses (homogeneousEntropy CB2_2_4I1R15Value) := by + exact contains_sound (homogeneous_enclosed CB2_2_4I1R15Value CB2_2_4I1R15MassTerm_sound CB2_2_4I1R15Entropy_sound) (by decide +kernel) +def CB2_2_4I1R16Value (a : Fin 6) : ℝ := residualLaw (below (shape 2 2 4)) (fun u => (stageBLaw (shape 2 2 4) u : ℝ)) (stageBPriority (shape 2 2 4)) 1 (fun u a => (littleLaw (shape 2 2 4) u ((stageBPriority (shape 2 2 4)) 1) a : ℝ)) 16 a +def CB2_2_4I1R16Raw (a : Fin 6) : Ball := residualBall (below (shape 2 2 4)) B2_2_4Law (stageBPriority (shape 2 2 4)) 1 (fun u => B2_2_4Little u ((stageBPriority (shape 2 2 4)) 1)) 16 a +lemma CB2_2_4I1R16Raw_sound (a : Fin 6) : + (CB2_2_4I1R16Raw a).Encloses (CB2_2_4I1R16Value a) := by + exact residualBall_sound_on (below (shape 2 2 4)) B2_2_4Law (fun u => (stageBLaw (shape 2 2 4) u : ℝ)) (stageBPriority (shape 2 2 4)) 1 (fun u => B2_2_4Little u ((stageBPriority (shape 2 2 4)) 1)) (fun u a => (littleLaw (shape 2 2 4) u ((stageBPriority (shape 2 2 4)) 1) a : ℝ)) (fun u _ => B2_2_4Law_sound u) (fun u _ a => B2_2_4Little_sound u ((stageBPriority (shape 2 2 4)) 1) a) 16 a +def CB2_2_4I1R16Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB2_2_4I1R16Certificates_valid : + CB2_2_4I1R16Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB2_2_4I1R16CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB2_2_4I1R16P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_2_4I1R16Certificates (CB2_2_4I1R16CertificateIndex a)).input +lemma CB2_2_4I1R16P_check : ∀ a : Fin 6, contains (CB2_2_4I1R16Raw a) (CB2_2_4I1R16P a) = true := by + decide +kernel +lemma CB2_2_4I1R16P_sound (a : Fin 6) : + (CB2_2_4I1R16P a).Encloses (CB2_2_4I1R16Value a) := + contains_sound (CB2_2_4I1R16Raw_sound a) (CB2_2_4I1R16P_check a) +def CB2_2_4I1R16Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_2_4I1R16Certificates (CB2_2_4I1R16CertificateIndex a)).output +lemma CB2_2_4I1R16Terms_sound (a : Fin 6) : + (CB2_2_4I1R16Terms a).Encloses (Foundation.entropyTerm (CB2_2_4I1R16Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB2_2_4I1R16Certificates_valid + (CB2_2_4I1R16CertificateIndex a) (CB2_2_4I1R16P_sound a) +def CB2_2_4I1R16Entropy : Ball := ⟨0, 0⟩ +lemma CB2_2_4I1R16Entropy_sound : CB2_2_4I1R16Entropy.Encloses (Foundation.finiteEntropy CB2_2_4I1R16Value) := by + exact contains_sound (entropyFin_enclosed 6 CB2_2_4I1R16Value CB2_2_4I1R16Terms CB2_2_4I1R16Terms_sound) (by decide +kernel) +def CB2_2_4I1R16Mass : Ball := ⟨0, 0⟩ +lemma CB2_2_4I1R16Mass_sound : CB2_2_4I1R16Mass.Encloses (∑ a, CB2_2_4I1R16Value a) := by + exact contains_sound (finSumBall_sound 6 CB2_2_4I1R16P CB2_2_4I1R16Value CB2_2_4I1R16P_sound) (by decide +kernel) +def CB2_2_4I1R16MassTerm : Ball := .exact 0 +lemma CB2_2_4I1R16MassTerm_sound : CB2_2_4I1R16MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB2_2_4I1R16Value a))) := + entropyTerm_zero_ball (CB2_2_4I1R16Mass_sound) +def CB2_2_4I1R16H : Ball := ⟨0, 0⟩ +lemma CB2_2_4I1R16H_sound : CB2_2_4I1R16H.Encloses (homogeneousEntropy CB2_2_4I1R16Value) := by + exact contains_sound (homogeneous_enclosed CB2_2_4I1R16Value CB2_2_4I1R16MassTerm_sound CB2_2_4I1R16Entropy_sound) (by decide +kernel) +def CB2_2_4I1ResidualEntropies (a : Fin 17) : Ball := + match a.val with + | 0 => CB2_2_4I1R0H + | 1 => CB2_2_4I1R1H + | 2 => CB2_2_4I1R2H + | 3 => CB2_2_4I1R3H + | 4 => CB2_2_4I1R4H + | 5 => CB2_2_4I1R5H + | 6 => CB2_2_4I1R6H + | 7 => CB2_2_4I1R7H + | 8 => CB2_2_4I1R8H + | 9 => CB2_2_4I1R9H + | 10 => CB2_2_4I1R10H + | 11 => CB2_2_4I1R11H + | 12 => CB2_2_4I1R12H + | 13 => CB2_2_4I1R13H + | 14 => CB2_2_4I1R14H + | 15 => CB2_2_4I1R15H + | 16 => CB2_2_4I1R16H + | _ => (.exact 0) +lemma CB2_2_4I1ResidualEntropies_sound (k : Fin 17) : + (CB2_2_4I1ResidualEntropies k).Encloses (homogeneousEntropy + (residualLaw (below (shape 2 2 4)) (fun u => (stageBLaw (shape 2 2 4) u : ℝ)) (stageBPriority (shape 2 2 4)) 1 (fun u a => (littleLaw (shape 2 2 4) u ((stageBPriority (shape 2 2 4)) 1) a : ℝ)) k)) := by + fin_cases k + · exact CB2_2_4I1R0H_sound + · exact CB2_2_4I1R1H_sound + · exact CB2_2_4I1R2H_sound + · exact CB2_2_4I1R3H_sound + · exact CB2_2_4I1R4H_sound + · exact CB2_2_4I1R5H_sound + · exact CB2_2_4I1R6H_sound + · exact CB2_2_4I1R7H_sound + · exact CB2_2_4I1R8H_sound + · exact CB2_2_4I1R9H_sound + · exact CB2_2_4I1R10H_sound + · exact CB2_2_4I1R11H_sound + · exact CB2_2_4I1R12H_sound + · exact CB2_2_4I1R13H_sound + · exact CB2_2_4I1R14H_sound + · exact CB2_2_4I1R15H_sound + · exact CB2_2_4I1R16H_sound +def CB2_2_4I1S2_2_0Value (a : Fin 6) : ℝ := (littleLaw (shape 2 2 4) (shape 2 2 0) ((stageBPriority (shape 2 2 4)) 1) a : ℝ) +def CB2_2_4I1S2_2_0E_2LogWitness : LogWitness := ⟨-1, 468209, 250000⟩ +def CB2_2_4I1S2_2_0E_2Log : Ball := ⟨(-1642333024891709491091130987267 / 25000000000000000000000000000000), (21175823683 / 50000000000000000000000000000000)⟩ +lemma CB2_2_4I1S2_2_0E_2Log_sound : CB2_2_4I1S2_2_0E_2Log.Encloses (Real.log (CB2_2_4I1S2_2_0Value (2 : Fin 6))) := by + exact checkLog_sound logTwoBall_sound ((B2_2_4Little_sound (shape 2 2 0) ((stageBPriority (shape 2 2 4)) 1)) (2 : Fin 6)) (w := CB2_2_4I1S2_2_0E_2LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB2_2_4I1S2_2_0E_2 : Ball := ⟨(3075820413006089636457149393669 / 50000000000000000000000000000000), (9914711231 / 25000000000000000000000000000000)⟩ +lemma CB2_2_4I1S2_2_0E_2_sound : CB2_2_4I1S2_2_0E_2.Encloses (Foundation.entropyTerm (CB2_2_4I1S2_2_0Value (2 : Fin 6))) := by + exact contains_sound (entropyTerm_ball ((B2_2_4Little_sound (shape 2 2 0) ((stageBPriority (shape 2 2 4)) 1)) (2 : Fin 6)) CB2_2_4I1S2_2_0E_2Log_sound) (by decide +kernel) +def CB2_2_4I1S2_2_0E_3LogWitness : LogWitness := ⟨-4, 31791, 31250⟩ +def CB2_2_4I1S2_2_0E_3Log : Ball := ⟨(-8610702711129322182939633075951 / 3125000000000000000000000000000), (52939559207 / 50000000000000000000000000000000)⟩ +lemma CB2_2_4I1S2_2_0E_3Log_sound : CB2_2_4I1S2_2_0E_3Log.Encloses (Real.log (CB2_2_4I1S2_2_0Value (3 : Fin 6))) := by + exact checkLog_sound logTwoBall_sound ((B2_2_4Little_sound (shape 2 2 0) ((stageBPriority (shape 2 2 4)) 1)) (3 : Fin 6)) (w := CB2_2_4I1S2_2_0E_3LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB2_2_4I1S2_2_0E_3 : Ball := ⟨(4379885598232196504285342001881 / 25000000000000000000000000000000), (1683001527 / 25000000000000000000000000000000)⟩ +lemma CB2_2_4I1S2_2_0E_3_sound : CB2_2_4I1S2_2_0E_3.Encloses (Foundation.entropyTerm (CB2_2_4I1S2_2_0Value (3 : Fin 6))) := by + exact contains_sound (entropyTerm_ball ((B2_2_4Little_sound (shape 2 2 0) ((stageBPriority (shape 2 2 4)) 1)) (3 : Fin 6)) CB2_2_4I1S2_2_0E_3Log_sound) (by decide +kernel) +def CB2_2_4I1S2_2_0Terms (a : Fin 6) : Ball := + match a.val with + | 2 => ⟨(3075820413006089636457149393669 / 50000000000000000000000000000000), (9914711231 / 25000000000000000000000000000000)⟩ + | 3 => ⟨(4379885598232196504285342001881 / 25000000000000000000000000000000), (1683001527 / 25000000000000000000000000000000)⟩ + | _ => (.exact 0) +lemma CB2_2_4I1S2_2_0Terms_sound (a : Fin 6) : + (CB2_2_4I1S2_2_0Terms a).Encloses (Foundation.entropyTerm (CB2_2_4I1S2_2_0Value a)) := by + fin_cases a + · exact (entropyTerm_zero_ball ((B2_2_4Little_sound (shape 2 2 0) ((stageBPriority (shape 2 2 4)) 1)) (0 : Fin 6))) + · exact (entropyTerm_zero_ball ((B2_2_4Little_sound (shape 2 2 0) ((stageBPriority (shape 2 2 4)) 1)) (1 : Fin 6))) + · exact CB2_2_4I1S2_2_0E_2_sound + · exact CB2_2_4I1S2_2_0E_3_sound + · exact (entropyTerm_zero_ball ((B2_2_4Little_sound (shape 2 2 0) ((stageBPriority (shape 2 2 4)) 1)) (4 : Fin 6))) + · exact (entropyTerm_zero_ball ((B2_2_4Little_sound (shape 2 2 0) ((stageBPriority (shape 2 2 4)) 1)) (5 : Fin 6))) +def CB2_2_4I1S2_2_0Entropy : Ball := ⟨(11835591609470482645027833397431 / 50000000000000000000000000000000), (5798856379 / 12500000000000000000000000000000)⟩ +lemma CB2_2_4I1S2_2_0Entropy_sound : CB2_2_4I1S2_2_0Entropy.Encloses (Foundation.finiteEntropy CB2_2_4I1S2_2_0Value) := by + exact contains_sound (entropyFin_enclosed 6 CB2_2_4I1S2_2_0Value CB2_2_4I1S2_2_0Terms CB2_2_4I1S2_2_0Terms_sound) (by decide +kernel) +def CB2_2_4I1S2_2_0Mass : Ball := ⟨1, 0⟩ +lemma CB2_2_4I1S2_2_0Mass_sound : CB2_2_4I1S2_2_0Mass.Encloses (∑ a, CB2_2_4I1S2_2_0Value a) := by + exact contains_sound (finSumBall_sound 6 (B2_2_4Little (shape 2 2 0) ((stageBPriority (shape 2 2 4)) 1)) CB2_2_4I1S2_2_0Value (B2_2_4Little_sound (shape 2 2 0) ((stageBPriority (shape 2 2 4)) 1))) (by decide +kernel) +def CB2_2_4I1S2_2_0MassTermLog : Ball := .exact 0 +lemma CB2_2_4I1S2_2_0MassTermLog_sound : CB2_2_4I1S2_2_0MassTermLog.Encloses (Real.log ((∑ a, CB2_2_4I1S2_2_0Value a))) := by + exact log_exact_one_ball (CB2_2_4I1S2_2_0Mass_sound) +def CB2_2_4I1S2_2_0MassTerm : Ball := ⟨0, 0⟩ +lemma CB2_2_4I1S2_2_0MassTerm_sound : CB2_2_4I1S2_2_0MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB2_2_4I1S2_2_0Value a))) := by + exact contains_sound (entropyTerm_ball (CB2_2_4I1S2_2_0Mass_sound) CB2_2_4I1S2_2_0MassTermLog_sound) (by decide +kernel) +def CB2_2_4I1S2_2_0H : Ball := ⟨(11835591609470482645027833397431 / 50000000000000000000000000000000), (5798856379 / 12500000000000000000000000000000)⟩ +lemma CB2_2_4I1S2_2_0H_sound : CB2_2_4I1S2_2_0H.Encloses (homogeneousEntropy CB2_2_4I1S2_2_0Value) := by + exact contains_sound (homogeneous_enclosed CB2_2_4I1S2_2_0Value CB2_2_4I1S2_2_0MassTerm_sound CB2_2_4I1S2_2_0Entropy_sound) (by decide +kernel) +def CB2_2_4I1Singles (s : Shape) : Ball := + match s 0, s 1, s 2 with + | 2, 2, 0 => CB2_2_4I1S2_2_0H + | _, _, _ => (.exact 0) +lemma CB2_2_4I1Singles_sound (u : Shape) (hu : u ∈ below (shape 2 2 4)) + (hd : designated (stageBPriority (shape 2 2 4)) 1 u) : + (CB2_2_4I1Singles u).Encloses (homogeneousEntropy ((fun u a => (littleLaw (shape 2 2 4) u ((stageBPriority (shape 2 2 4)) 1) a : ℝ)) u)) := by + rw [B2_2_4_below] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl + · exact (show ¬ designated (stageBPriority (shape 2 2 4)) 1 (shape 0 0 4) by decide +kernel) hd |>.elim + · exact (show ¬ designated (stageBPriority (shape 2 2 4)) 1 (shape 0 1 3) by decide +kernel) hd |>.elim + · exact (show ¬ designated (stageBPriority (shape 2 2 4)) 1 (shape 0 2 2) by decide +kernel) hd |>.elim + · exact (show ¬ designated (stageBPriority (shape 2 2 4)) 1 (shape 1 0 3) by decide +kernel) hd |>.elim + · exact (show ¬ designated (stageBPriority (shape 2 2 4)) 1 (shape 1 1 2) by decide +kernel) hd |>.elim + · exact (show ¬ designated (stageBPriority (shape 2 2 4)) 1 (shape 1 2 1) by decide +kernel) hd |>.elim + · exact (show ¬ designated (stageBPriority (shape 2 2 4)) 1 (shape 2 0 2) by decide +kernel) hd |>.elim + · exact (show ¬ designated (stageBPriority (shape 2 2 4)) 1 (shape 2 1 1) by decide +kernel) hd |>.elim + · exact CB2_2_4I1S2_2_0H_sound +def CB2_2_4I1Singleton : Ball := ⟨(5248073979006309136194565619 / 100000000000000000000000000000000), (10285191 / 100000000000000000000000000000000)⟩ +lemma CB2_2_4I1Singleton_sound : CB2_2_4I1Singleton.Encloses + (singletonEntropy (below (shape 2 2 4)) (fun u => (stageBLaw (shape 2 2 4) u : ℝ)) (stageBPriority (shape 2 2 4)) 1 (fun u a => (littleLaw (shape 2 2 4) u ((stageBPriority (shape 2 2 4)) 1) a : ℝ))) := by + exact contains_sound (singletonBall_sound (below (shape 2 2 4)) B2_2_4Law (fun u => (stageBLaw (shape 2 2 4) u : ℝ)) (stageBPriority (shape 2 2 4)) 1 + CB2_2_4I1Singles (fun u a => (littleLaw (shape 2 2 4) u ((stageBPriority (shape 2 2 4)) 1) a : ℝ)) (fun u _ => B2_2_4Law_sound u) CB2_2_4I1Singles_sound) (by decide +kernel) +def CB2_2_4I1Group : Ball := ⟨(5619238395446087896636001318713 / 100000000000000000000000000000000), (58483587453 / 50000000000000000000000000000000)⟩ +lemma CB2_2_4I1Group_sound : CB2_2_4I1Group.Encloses + (groupedEntropy (below (shape 2 2 4)) (fun u => (stageBLaw (shape 2 2 4) u : ℝ)) (stageBPriority (shape 2 2 4)) 1 (fun u a => (littleLaw (shape 2 2 4) u ((stageBPriority (shape 2 2 4)) 1) a : ℝ))) := by + exact contains_sound (Ball.add_sound CB2_2_4I1Singleton_sound + (finSumBall_sound 17 CB2_2_4I1ResidualEntropies _ CB2_2_4I1ResidualEntropies_sound)) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CB2_2_4I1H : Ball := ⟨(91377184222344073687557847874937 / 100000000000000000000000000000000), (315206326839 / 100000000000000000000000000000000)⟩ +lemma CB2_2_4I1_sound : CB2_2_4I1H.Encloses (stageBCapacity (shape 2 2 4) 1) := by + have hb := contains_sound (Ball.add_sound CB2_2_4I1PairH_sound + (Ball.neg_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) CB2_2_4I1Group_sound))) + (show contains (.add CB2_2_4I1PairH (.neg (.mul (.exact 2) CB2_2_4I1Group))) CB2_2_4I1H = true by decide +kernel) + unfold CB2_2_4I1PairValue at hb + simpa only [stageBCapacity, nativeCapacity, + show (1 : Fin 3) ≠ 0 by decide, ite_false, sub_eq_add_neg] using hb + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/CapacityB/CapB2_2_4I2.lean b/lean/OAI/LinearAlgebra/MatrixFields/CapacityB/CapB2_2_4I2.lean new file mode 100644 index 0000000000000000000000000000000000000000..7a3c6eb27d2113235d5c55f8ba389fa551e98724 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/CapacityB/CapB2_2_4I2.lean @@ -0,0 +1,1055 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Certificates.Terminal2_2_4 + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CB2_2_4I2PairValue (a : PairSlot) : ℝ := pairLaw (below (shape 2 2 4)) (shape 2 2 4) (fun u => (stageBLaw (shape 2 2 4) u : ℝ)) (fun u a => (littleLaw (shape 2 2 4) u ((stageBPriority (shape 2 2 4)) 2) a : ℝ)) a +def CB2_2_4I2PairRaw (a : PairSlot) : Ball := pairLawBall (below (shape 2 2 4)) (shape 2 2 4) B2_2_4Law (fun u => B2_2_4Little u ((stageBPriority (shape 2 2 4)) 2)) a +lemma CB2_2_4I2PairRaw_sound (a : PairSlot) : + (CB2_2_4I2PairRaw a).Encloses (CB2_2_4I2PairValue a) := by + exact pairLawBall_sound_on (below (shape 2 2 4)) (shape 2 2 4) B2_2_4Law (fun u => (stageBLaw (shape 2 2 4) u : ℝ)) (fun u => B2_2_4Little u ((stageBPriority (shape 2 2 4)) 2)) (fun u a => (littleLaw (shape 2 2 4) u ((stageBPriority (shape 2 2 4)) 2) a : ℝ)) (fun u _ => B2_2_4Law_sound u) (fun u _ a => B2_2_4Little_sound u ((stageBPriority (shape 2 2 4)) 2) a) (fun u _ a => B2_2_4Little_sound (complement (shape 2 2 4) u) ((stageBPriority (shape 2 2 4)) 2) a) a +def CB2_2_4I2PairCertificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(22170729407421252075742212347 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(186547899184436920742962037689 / 100000000000000000000000000000000), (32863847 / 50000000000000000000000000000000)⟩ ⟨(-841415254123273786972146125285279 / 100000000000000000000000000000000), (37057692009 / 12500000000000000000000000000000)⟩ ⟨-13, 22170729407421252075742212347, 12207031250000000000000000000⟩, + .log ⟨(1877555123344146106224953559491 / 25000000000000000000000000000000), (13 / 50000000000000000000000000000000)⟩ ⟨(4860812523784326097575945646473 / 25000000000000000000000000000000), (7951755343 / 100000000000000000000000000000000)⟩ ⟨(-64722634016819814007605771245177 / 25000000000000000000000000000000), (2646977969 / 2500000000000000000000000000000)⟩ ⟨-4, 1877555123344146106224953559491, 1562500000000000000000000000000⟩, + .log ⟨(1563542695666112973568998103859 / 2000000000000000000000000000000), (149 / 100000000000000000000000000000000)⟩ ⟨(19246661410204724567784176178127 / 100000000000000000000000000000000), (3310930463 / 10000000000000000000000000000000)⟩ ⟨(-24619297526768346836114256638117 / 100000000000000000000000000000000), (10587911889 / 25000000000000000000000000000000)⟩ ⟨-1, 1563542695666112973568998103859, 1000000000000000000000000000000⟩, + .log ⟨(3219564442457119163781284689913 / 100000000000000000000000000000000), (11 / 100000000000000000000000000000000)⟩ ⟨(11062179065454635648473424295103 / 100000000000000000000000000000000), (1022653947 / 25000000000000000000000000000000)⟩ ⟨(-171796205094937635297027933365763 / 50000000000000000000000000000000), (127054942439 / 100000000000000000000000000000000)⟩ ⟨-5, 3219564442457119163781284689913, 3125000000000000000000000000000⟩, + .log ⟨(79738471553025410009103131651 / 25000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ ⟨(916654161094279129134379324297 / 50000000000000000000000000000000), (33770557 / 5000000000000000000000000000000)⟩ ⟨(-574787892996363653174845283243279 / 100000000000000000000000000000000), (211758237457 / 100000000000000000000000000000000)⟩ ⟨-9, 79738471553025410009103131651, 48828125000000000000000000000⟩] +lemma CB2_2_4I2PairCertificates_valid : + CB2_2_4I2PairCertificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB2_2_4I2PairCertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 5, 0 => 1 + | 4, 1 => 2 + | 2, 2 => 3 + | 2, 3 => 4 + | 3, 2 => 4 + | 3, 3 => 5 + | 1, 4 => 2 + | 0, 5 => 1 + | _, _ => 0 +def CB2_2_4I2PairP (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CB2_2_4I2PairCertificates (CB2_2_4I2PairCertificateIndex a)).input +lemma CB2_2_4I2PairP_check : ∀ a : PairSlot, contains (CB2_2_4I2PairRaw a) (CB2_2_4I2PairP a) = true := by + decide +kernel +lemma CB2_2_4I2PairP_sound (a : PairSlot) : + (CB2_2_4I2PairP a).Encloses (CB2_2_4I2PairValue a) := + contains_sound (CB2_2_4I2PairRaw_sound a) (CB2_2_4I2PairP_check a) +def CB2_2_4I2PairTerms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CB2_2_4I2PairCertificates (CB2_2_4I2PairCertificateIndex a)).output +lemma CB2_2_4I2PairTerms_sound (a : PairSlot) : + (CB2_2_4I2PairTerms a).Encloses (Foundation.entropyTerm (CB2_2_4I2PairValue a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB2_2_4I2PairCertificates_valid + (CB2_2_4I2PairCertificateIndex a) (CB2_2_4I2PairP_sound a) +def CB2_2_4I2PairEntropy : Ball := ⟨(82463923851946036745093272664089 / 100000000000000000000000000000000), (2900045671 / 5000000000000000000000000000000)⟩ +lemma CB2_2_4I2PairEntropy_sound : CB2_2_4I2PairEntropy.Encloses (Foundation.finiteEntropy CB2_2_4I2PairValue) := by + exact contains_sound (entropyPair_enclosed CB2_2_4I2PairValue CB2_2_4I2PairTerms CB2_2_4I2PairTerms_sound) (by decide +kernel) +def CB2_2_4I2PairMass : Ball := ⟨(50000000000000000000000000000001 / 50000000000000000000000000000000), (227 / 100000000000000000000000000000000)⟩ +lemma CB2_2_4I2PairMass_sound : CB2_2_4I2PairMass.Encloses (∑ a, CB2_2_4I2PairValue a) := by + exact contains_sound (pairSumBall_sound CB2_2_4I2PairP CB2_2_4I2PairValue CB2_2_4I2PairP_sound) (by decide +kernel) +def CB2_2_4I2PairMassTermLogWitness : LogWitness := ⟨0, 50000000000000000000000000000001, 50000000000000000000000000000000⟩ +def CB2_2_4I2PairMassTermLog : Ball := ⟨(1 / 50000000000000000000000000000000), (21175823909 / 100000000000000000000000000000000)⟩ +lemma CB2_2_4I2PairMassTermLog_sound : CB2_2_4I2PairMassTermLog.Encloses (Real.log ((∑ a, CB2_2_4I2PairValue a))) := by + exact checkLog_sound logTwoBall_sound (CB2_2_4I2PairMass_sound) (w := CB2_2_4I2PairMassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB2_2_4I2PairMassTerm : Ball := ⟨(-1 / 50000000000000000000000000000000), (2117582391 / 10000000000000000000000000000000)⟩ +lemma CB2_2_4I2PairMassTerm_sound : CB2_2_4I2PairMassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB2_2_4I2PairValue a))) := by + exact contains_sound (entropyTerm_ball (CB2_2_4I2PairMass_sound) CB2_2_4I2PairMassTermLog_sound) (by decide +kernel) +def CB2_2_4I2PairH : Ball := ⟨(82463923851946036745093272664091 / 100000000000000000000000000000000), (7917673733 / 10000000000000000000000000000000)⟩ +lemma CB2_2_4I2PairH_sound : CB2_2_4I2PairH.Encloses (homogeneousEntropy CB2_2_4I2PairValue) := by + exact contains_sound (homogeneous_enclosed CB2_2_4I2PairValue CB2_2_4I2PairMassTerm_sound CB2_2_4I2PairEntropy_sound) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CB2_2_4I2R0Value (a : Fin 6) : ℝ := residualLaw (below (shape 2 2 4)) (fun u => (stageBLaw (shape 2 2 4) u : ℝ)) (stageBPriority (shape 2 2 4)) 2 (fun u a => (littleLaw (shape 2 2 4) u ((stageBPriority (shape 2 2 4)) 2) a : ℝ)) 0 a +def CB2_2_4I2R0Raw (a : Fin 6) : Ball := residualBall (below (shape 2 2 4)) B2_2_4Law (stageBPriority (shape 2 2 4)) 2 (fun u => B2_2_4Little u ((stageBPriority (shape 2 2 4)) 2)) 0 a +lemma CB2_2_4I2R0Raw_sound (a : Fin 6) : + (CB2_2_4I2R0Raw a).Encloses (CB2_2_4I2R0Value a) := by + exact residualBall_sound_on (below (shape 2 2 4)) B2_2_4Law (fun u => (stageBLaw (shape 2 2 4) u : ℝ)) (stageBPriority (shape 2 2 4)) 2 (fun u => B2_2_4Little u ((stageBPriority (shape 2 2 4)) 2)) (fun u a => (littleLaw (shape 2 2 4) u ((stageBPriority (shape 2 2 4)) 2) a : ℝ)) (fun u _ => B2_2_4Law_sound u) (fun u _ a => B2_2_4Little_sound u ((stageBPriority (shape 2 2 4)) 2) a) 0 a +def CB2_2_4I2R0Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(22170729407421252075742212347 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(186547899184436920742962037689 / 100000000000000000000000000000000), (32863847 / 50000000000000000000000000000000)⟩ ⟨(-841415254123273786972146125285279 / 100000000000000000000000000000000), (37057692009 / 12500000000000000000000000000000)⟩ ⟨-13, 22170729407421252075742212347, 12207031250000000000000000000⟩] +lemma CB2_2_4I2R0Certificates_valid : + CB2_2_4I2R0Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB2_2_4I2R0CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | 0 => 1 + | _ => 0 +def CB2_2_4I2R0P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_2_4I2R0Certificates (CB2_2_4I2R0CertificateIndex a)).input +lemma CB2_2_4I2R0P_check : ∀ a : Fin 6, contains (CB2_2_4I2R0Raw a) (CB2_2_4I2R0P a) = true := by + decide +kernel +lemma CB2_2_4I2R0P_sound (a : Fin 6) : + (CB2_2_4I2R0P a).Encloses (CB2_2_4I2R0Value a) := + contains_sound (CB2_2_4I2R0Raw_sound a) (CB2_2_4I2R0P_check a) +def CB2_2_4I2R0Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_2_4I2R0Certificates (CB2_2_4I2R0CertificateIndex a)).output +lemma CB2_2_4I2R0Terms_sound (a : Fin 6) : + (CB2_2_4I2R0Terms a).Encloses (Foundation.entropyTerm (CB2_2_4I2R0Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB2_2_4I2R0Certificates_valid + (CB2_2_4I2R0CertificateIndex a) (CB2_2_4I2R0P_sound a) +def CB2_2_4I2R0Entropy : Ball := ⟨(186547899184436920742962037689 / 100000000000000000000000000000000), (32863847 / 50000000000000000000000000000000)⟩ +lemma CB2_2_4I2R0Entropy_sound : CB2_2_4I2R0Entropy.Encloses (Foundation.finiteEntropy CB2_2_4I2R0Value) := by + exact contains_sound (entropyFin_enclosed 6 CB2_2_4I2R0Value CB2_2_4I2R0Terms CB2_2_4I2R0Terms_sound) (by decide +kernel) +def CB2_2_4I2R0Mass : Ball := ⟨(22170729407421252075742212347 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ +lemma CB2_2_4I2R0Mass_sound : CB2_2_4I2R0Mass.Encloses (∑ a, CB2_2_4I2R0Value a) := by + exact contains_sound (finSumBall_sound 6 CB2_2_4I2R0P CB2_2_4I2R0Value CB2_2_4I2R0P_sound) (by decide +kernel) +def CB2_2_4I2R0MassTermLogWitness : LogWitness := ⟨-13, 22170729407421252075742212347, 12207031250000000000000000000⟩ +def CB2_2_4I2R0MassTermLog : Ball := ⟨(-841415254123273786972146125285279 / 100000000000000000000000000000000), (37057692009 / 12500000000000000000000000000000)⟩ +lemma CB2_2_4I2R0MassTermLog_sound : CB2_2_4I2R0MassTermLog.Encloses (Real.log ((∑ a, CB2_2_4I2R0Value a))) := by + exact checkLog_sound logTwoBall_sound (CB2_2_4I2R0Mass_sound) (w := CB2_2_4I2R0MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB2_2_4I2R0MassTerm : Ball := ⟨(186547899184436920742962037689 / 100000000000000000000000000000000), (32863847 / 50000000000000000000000000000000)⟩ +lemma CB2_2_4I2R0MassTerm_sound : CB2_2_4I2R0MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB2_2_4I2R0Value a))) := by + exact contains_sound (entropyTerm_ball (CB2_2_4I2R0Mass_sound) CB2_2_4I2R0MassTermLog_sound) (by decide +kernel) +def CB2_2_4I2R0H : Ball := ⟨0, (32863847 / 25000000000000000000000000000000)⟩ +lemma CB2_2_4I2R0H_sound : CB2_2_4I2R0H.Encloses (homogeneousEntropy CB2_2_4I2R0Value) := by + exact contains_sound (homogeneous_enclosed CB2_2_4I2R0Value CB2_2_4I2R0MassTerm_sound CB2_2_4I2R0Entropy_sound) (by decide +kernel) +def CB2_2_4I2R1Value (a : Fin 6) : ℝ := residualLaw (below (shape 2 2 4)) (fun u => (stageBLaw (shape 2 2 4) u : ℝ)) (stageBPriority (shape 2 2 4)) 2 (fun u a => (littleLaw (shape 2 2 4) u ((stageBPriority (shape 2 2 4)) 2) a : ℝ)) 1 a +def CB2_2_4I2R1Raw (a : Fin 6) : Ball := residualBall (below (shape 2 2 4)) B2_2_4Law (stageBPriority (shape 2 2 4)) 2 (fun u => B2_2_4Little u ((stageBPriority (shape 2 2 4)) 2)) 1 a +lemma CB2_2_4I2R1Raw_sound (a : Fin 6) : + (CB2_2_4I2R1Raw a).Encloses (CB2_2_4I2R1Value a) := by + exact residualBall_sound_on (below (shape 2 2 4)) B2_2_4Law (fun u => (stageBLaw (shape 2 2 4) u : ℝ)) (stageBPriority (shape 2 2 4)) 2 (fun u => B2_2_4Little u ((stageBPriority (shape 2 2 4)) 2)) (fun u a => (littleLaw (shape 2 2 4) u ((stageBPriority (shape 2 2 4)) 2) a : ℝ)) (fun u _ => B2_2_4Law_sound u) (fun u _ a => B2_2_4Little_sound u ((stageBPriority (shape 2 2 4)) 2) a) 1 a +def CB2_2_4I2R1Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(1877555123344146106224953559491 / 25000000000000000000000000000000), (13 / 50000000000000000000000000000000)⟩ ⟨(4860812523784326097575945646473 / 25000000000000000000000000000000), (7951755343 / 100000000000000000000000000000000)⟩ ⟨(-64722634016819814007605771245177 / 25000000000000000000000000000000), (2646977969 / 2500000000000000000000000000000)⟩ ⟨-4, 1877555123344146106224953559491, 1562500000000000000000000000000⟩] +lemma CB2_2_4I2R1Certificates_valid : + CB2_2_4I2R1Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB2_2_4I2R1CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | 1 => 1 + | _ => 0 +def CB2_2_4I2R1P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_2_4I2R1Certificates (CB2_2_4I2R1CertificateIndex a)).input +lemma CB2_2_4I2R1P_check : ∀ a : Fin 6, contains (CB2_2_4I2R1Raw a) (CB2_2_4I2R1P a) = true := by + decide +kernel +lemma CB2_2_4I2R1P_sound (a : Fin 6) : + (CB2_2_4I2R1P a).Encloses (CB2_2_4I2R1Value a) := + contains_sound (CB2_2_4I2R1Raw_sound a) (CB2_2_4I2R1P_check a) +def CB2_2_4I2R1Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_2_4I2R1Certificates (CB2_2_4I2R1CertificateIndex a)).output +lemma CB2_2_4I2R1Terms_sound (a : Fin 6) : + (CB2_2_4I2R1Terms a).Encloses (Foundation.entropyTerm (CB2_2_4I2R1Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB2_2_4I2R1Certificates_valid + (CB2_2_4I2R1CertificateIndex a) (CB2_2_4I2R1P_sound a) +def CB2_2_4I2R1Entropy : Ball := ⟨(4860812523784326097575945646473 / 25000000000000000000000000000000), (7951755343 / 100000000000000000000000000000000)⟩ +lemma CB2_2_4I2R1Entropy_sound : CB2_2_4I2R1Entropy.Encloses (Foundation.finiteEntropy CB2_2_4I2R1Value) := by + exact contains_sound (entropyFin_enclosed 6 CB2_2_4I2R1Value CB2_2_4I2R1Terms CB2_2_4I2R1Terms_sound) (by decide +kernel) +def CB2_2_4I2R1Mass : Ball := ⟨(1877555123344146106224953559491 / 25000000000000000000000000000000), (13 / 50000000000000000000000000000000)⟩ +lemma CB2_2_4I2R1Mass_sound : CB2_2_4I2R1Mass.Encloses (∑ a, CB2_2_4I2R1Value a) := by + exact contains_sound (finSumBall_sound 6 CB2_2_4I2R1P CB2_2_4I2R1Value CB2_2_4I2R1P_sound) (by decide +kernel) +def CB2_2_4I2R1MassTermLogWitness : LogWitness := ⟨-4, 1877555123344146106224953559491, 1562500000000000000000000000000⟩ +def CB2_2_4I2R1MassTermLog : Ball := ⟨(-64722634016819814007605771245177 / 25000000000000000000000000000000), (2646977969 / 2500000000000000000000000000000)⟩ +lemma CB2_2_4I2R1MassTermLog_sound : CB2_2_4I2R1MassTermLog.Encloses (Real.log ((∑ a, CB2_2_4I2R1Value a))) := by + exact checkLog_sound logTwoBall_sound (CB2_2_4I2R1Mass_sound) (w := CB2_2_4I2R1MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB2_2_4I2R1MassTerm : Ball := ⟨(4860812523784326097575945646473 / 25000000000000000000000000000000), (7951755343 / 100000000000000000000000000000000)⟩ +lemma CB2_2_4I2R1MassTerm_sound : CB2_2_4I2R1MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB2_2_4I2R1Value a))) := by + exact contains_sound (entropyTerm_ball (CB2_2_4I2R1Mass_sound) CB2_2_4I2R1MassTermLog_sound) (by decide +kernel) +def CB2_2_4I2R1H : Ball := ⟨0, (7951755343 / 50000000000000000000000000000000)⟩ +lemma CB2_2_4I2R1H_sound : CB2_2_4I2R1H.Encloses (homogeneousEntropy CB2_2_4I2R1Value) := by + exact contains_sound (homogeneous_enclosed CB2_2_4I2R1Value CB2_2_4I2R1MassTerm_sound CB2_2_4I2R1Entropy_sound) (by decide +kernel) +def CB2_2_4I2R2Value (a : Fin 6) : ℝ := residualLaw (below (shape 2 2 4)) (fun u => (stageBLaw (shape 2 2 4) u : ℝ)) (stageBPriority (shape 2 2 4)) 2 (fun u a => (littleLaw (shape 2 2 4) u ((stageBPriority (shape 2 2 4)) 2) a : ℝ)) 2 a +def CB2_2_4I2R2Raw (a : Fin 6) : Ball := residualBall (below (shape 2 2 4)) B2_2_4Law (stageBPriority (shape 2 2 4)) 2 (fun u => B2_2_4Little u ((stageBPriority (shape 2 2 4)) 2)) 2 a +lemma CB2_2_4I2R2Raw_sound (a : Fin 6) : + (CB2_2_4I2R2Raw a).Encloses (CB2_2_4I2R2Value a) := by + exact residualBall_sound_on (below (shape 2 2 4)) B2_2_4Law (fun u => (stageBLaw (shape 2 2 4) u : ℝ)) (stageBPriority (shape 2 2 4)) 2 (fun u => B2_2_4Little u ((stageBPriority (shape 2 2 4)) 2)) (fun u a => (littleLaw (shape 2 2 4) u ((stageBPriority (shape 2 2 4)) 2) a : ℝ)) (fun u _ => B2_2_4Law_sound u) (fun u _ a => B2_2_4Little_sound u ((stageBPriority (shape 2 2 4)) 2) a) 2 a +def CB2_2_4I2R2Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(55121373521289581568511787388219 / 100000000000000000000000000000000), (31 / 50000000000000000000000000000000)⟩ ⟨(4104011159699762125739736531073 / 12500000000000000000000000000000), (5836202459 / 25000000000000000000000000000000)⟩ ⟨(-29781632042348624815869460699111 / 50000000000000000000000000000000), (42351647477 / 100000000000000000000000000000000)⟩ ⟨-1, 55121373521289581568511787388219, 50000000000000000000000000000000⟩, + .log ⟨(502786785008629530120537585437 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(2661129417891119099712379167569 / 100000000000000000000000000000000), (191644639 / 20000000000000000000000000000000)⟩ ⟨(-33079745446241256546737430347809 / 6250000000000000000000000000000), (38116482669 / 20000000000000000000000000000000)⟩ ⟨-8, 502786785008629530120537585437, 390625000000000000000000000000⟩] +lemma CB2_2_4I2R2Certificates_valid : + CB2_2_4I2R2Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB2_2_4I2R2CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | 2 => 1 + | 3 => 2 + | _ => 0 +def CB2_2_4I2R2P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_2_4I2R2Certificates (CB2_2_4I2R2CertificateIndex a)).input +lemma CB2_2_4I2R2P_check : ∀ a : Fin 6, contains (CB2_2_4I2R2Raw a) (CB2_2_4I2R2P a) = true := by + decide +kernel +lemma CB2_2_4I2R2P_sound (a : Fin 6) : + (CB2_2_4I2R2P a).Encloses (CB2_2_4I2R2Value a) := + contains_sound (CB2_2_4I2R2Raw_sound a) (CB2_2_4I2R2P_check a) +def CB2_2_4I2R2Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_2_4I2R2Certificates (CB2_2_4I2R2CertificateIndex a)).output +lemma CB2_2_4I2R2Terms_sound (a : Fin 6) : + (CB2_2_4I2R2Terms a).Encloses (Foundation.entropyTerm (CB2_2_4I2R2Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB2_2_4I2R2Certificates_valid + (CB2_2_4I2R2CertificateIndex a) (CB2_2_4I2R2P_sound a) +def CB2_2_4I2R2Entropy : Ball := ⟨(35493218695489216105630271416153 / 100000000000000000000000000000000), (24303033031 / 100000000000000000000000000000000)⟩ +lemma CB2_2_4I2R2Entropy_sound : CB2_2_4I2R2Entropy.Encloses (Foundation.finiteEntropy CB2_2_4I2R2Value) := by + exact contains_sound (entropyFin_enclosed 6 CB2_2_4I2R2Value CB2_2_4I2R2Terms CB2_2_4I2R2Terms_sound) (by decide +kernel) +def CB2_2_4I2R2Mass : Ball := ⟨(6953020038287276387329040621707 / 12500000000000000000000000000000), (63 / 100000000000000000000000000000000)⟩ +lemma CB2_2_4I2R2Mass_sound : CB2_2_4I2R2Mass.Encloses (∑ a, CB2_2_4I2R2Value a) := by + exact contains_sound (finSumBall_sound 6 CB2_2_4I2R2P CB2_2_4I2R2Value CB2_2_4I2R2P_sound) (by decide +kernel) +def CB2_2_4I2R2MassTermLogWitness : LogWitness := ⟨-1, 6953020038287276387329040621707, 6250000000000000000000000000000⟩ +def CB2_2_4I2R2MassTermLog : Ball := ⟨(-14663813530818446743036588603247 / 25000000000000000000000000000000), (42351647479 / 100000000000000000000000000000000)⟩ +lemma CB2_2_4I2R2MassTermLog_sound : CB2_2_4I2R2MassTermLog.Encloses (Real.log ((∑ a, CB2_2_4I2R2Value a))) := by + exact checkLog_sound logTwoBall_sound (CB2_2_4I2R2Mass_sound) (w := CB2_2_4I2R2MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB2_2_4I2R2MassTerm : Ball := ⟨(16313246290798201299195114300737 / 50000000000000000000000000000000), (5889437081 / 25000000000000000000000000000000)⟩ +lemma CB2_2_4I2R2MassTerm_sound : CB2_2_4I2R2MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB2_2_4I2R2Value a))) := by + exact contains_sound (entropyTerm_ball (CB2_2_4I2R2Mass_sound) CB2_2_4I2R2MassTermLog_sound) (by decide +kernel) +def CB2_2_4I2R2H : Ball := ⟨(2866726113892813507240042814679 / 100000000000000000000000000000000), (9572156271 / 20000000000000000000000000000000)⟩ +lemma CB2_2_4I2R2H_sound : CB2_2_4I2R2H.Encloses (homogeneousEntropy CB2_2_4I2R2Value) := by + exact contains_sound (homogeneous_enclosed CB2_2_4I2R2Value CB2_2_4I2R2MassTerm_sound CB2_2_4I2R2Entropy_sound) (by decide +kernel) +def CB2_2_4I2R3Value (a : Fin 6) : ℝ := residualLaw (below (shape 2 2 4)) (fun u => (stageBLaw (shape 2 2 4) u : ℝ)) (stageBPriority (shape 2 2 4)) 2 (fun u a => (littleLaw (shape 2 2 4) u ((stageBPriority (shape 2 2 4)) 2) a : ℝ)) 3 a +def CB2_2_4I2R3Raw (a : Fin 6) : Ball := residualBall (below (shape 2 2 4)) B2_2_4Law (stageBPriority (shape 2 2 4)) 2 (fun u => B2_2_4Little u ((stageBPriority (shape 2 2 4)) 2)) 3 a +lemma CB2_2_4I2R3Raw_sound (a : Fin 6) : + (CB2_2_4I2R3Raw a).Encloses (CB2_2_4I2R3Value a) := by + exact residualBall_sound_on (below (shape 2 2 4)) B2_2_4Law (fun u => (stageBLaw (shape 2 2 4) u : ℝ)) (stageBPriority (shape 2 2 4)) 2 (fun u => B2_2_4Little u ((stageBPriority (shape 2 2 4)) 2)) (fun u a => (littleLaw (shape 2 2 4) u ((stageBPriority (shape 2 2 4)) 2) a : ℝ)) (fun u _ => B2_2_4Law_sound u) (fun u _ a => B2_2_4Little_sound u ((stageBPriority (shape 2 2 4)) 2) a) 3 a +def CB2_2_4I2R3Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB2_2_4I2R3Certificates_valid : + CB2_2_4I2R3Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB2_2_4I2R3CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB2_2_4I2R3P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_2_4I2R3Certificates (CB2_2_4I2R3CertificateIndex a)).input +lemma CB2_2_4I2R3P_check : ∀ a : Fin 6, contains (CB2_2_4I2R3Raw a) (CB2_2_4I2R3P a) = true := by + decide +kernel +lemma CB2_2_4I2R3P_sound (a : Fin 6) : + (CB2_2_4I2R3P a).Encloses (CB2_2_4I2R3Value a) := + contains_sound (CB2_2_4I2R3Raw_sound a) (CB2_2_4I2R3P_check a) +def CB2_2_4I2R3Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_2_4I2R3Certificates (CB2_2_4I2R3CertificateIndex a)).output +lemma CB2_2_4I2R3Terms_sound (a : Fin 6) : + (CB2_2_4I2R3Terms a).Encloses (Foundation.entropyTerm (CB2_2_4I2R3Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB2_2_4I2R3Certificates_valid + (CB2_2_4I2R3CertificateIndex a) (CB2_2_4I2R3P_sound a) +def CB2_2_4I2R3Entropy : Ball := ⟨0, 0⟩ +lemma CB2_2_4I2R3Entropy_sound : CB2_2_4I2R3Entropy.Encloses (Foundation.finiteEntropy CB2_2_4I2R3Value) := by + exact contains_sound (entropyFin_enclosed 6 CB2_2_4I2R3Value CB2_2_4I2R3Terms CB2_2_4I2R3Terms_sound) (by decide +kernel) +def CB2_2_4I2R3Mass : Ball := ⟨0, 0⟩ +lemma CB2_2_4I2R3Mass_sound : CB2_2_4I2R3Mass.Encloses (∑ a, CB2_2_4I2R3Value a) := by + exact contains_sound (finSumBall_sound 6 CB2_2_4I2R3P CB2_2_4I2R3Value CB2_2_4I2R3P_sound) (by decide +kernel) +def CB2_2_4I2R3MassTerm : Ball := .exact 0 +lemma CB2_2_4I2R3MassTerm_sound : CB2_2_4I2R3MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB2_2_4I2R3Value a))) := + entropyTerm_zero_ball (CB2_2_4I2R3Mass_sound) +def CB2_2_4I2R3H : Ball := ⟨0, 0⟩ +lemma CB2_2_4I2R3H_sound : CB2_2_4I2R3H.Encloses (homogeneousEntropy CB2_2_4I2R3Value) := by + exact contains_sound (homogeneous_enclosed CB2_2_4I2R3Value CB2_2_4I2R3MassTerm_sound CB2_2_4I2R3Entropy_sound) (by decide +kernel) +def CB2_2_4I2R4Value (a : Fin 6) : ℝ := residualLaw (below (shape 2 2 4)) (fun u => (stageBLaw (shape 2 2 4) u : ℝ)) (stageBPriority (shape 2 2 4)) 2 (fun u a => (littleLaw (shape 2 2 4) u ((stageBPriority (shape 2 2 4)) 2) a : ℝ)) 4 a +def CB2_2_4I2R4Raw (a : Fin 6) : Ball := residualBall (below (shape 2 2 4)) B2_2_4Law (stageBPriority (shape 2 2 4)) 2 (fun u => B2_2_4Little u ((stageBPriority (shape 2 2 4)) 2)) 4 a +lemma CB2_2_4I2R4Raw_sound (a : Fin 6) : + (CB2_2_4I2R4Raw a).Encloses (CB2_2_4I2R4Value a) := by + exact residualBall_sound_on (below (shape 2 2 4)) B2_2_4Law (fun u => (stageBLaw (shape 2 2 4) u : ℝ)) (stageBPriority (shape 2 2 4)) 2 (fun u => B2_2_4Little u ((stageBPriority (shape 2 2 4)) 2)) (fun u a => (littleLaw (shape 2 2 4) u ((stageBPriority (shape 2 2 4)) 2) a : ℝ)) (fun u _ => B2_2_4Law_sound u) (fun u _ a => B2_2_4Little_sound u ((stageBPriority (shape 2 2 4)) 2) a) 4 a +def CB2_2_4I2R4Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB2_2_4I2R4Certificates_valid : + CB2_2_4I2R4Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB2_2_4I2R4CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB2_2_4I2R4P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_2_4I2R4Certificates (CB2_2_4I2R4CertificateIndex a)).input +lemma CB2_2_4I2R4P_check : ∀ a : Fin 6, contains (CB2_2_4I2R4Raw a) (CB2_2_4I2R4P a) = true := by + decide +kernel +lemma CB2_2_4I2R4P_sound (a : Fin 6) : + (CB2_2_4I2R4P a).Encloses (CB2_2_4I2R4Value a) := + contains_sound (CB2_2_4I2R4Raw_sound a) (CB2_2_4I2R4P_check a) +def CB2_2_4I2R4Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_2_4I2R4Certificates (CB2_2_4I2R4CertificateIndex a)).output +lemma CB2_2_4I2R4Terms_sound (a : Fin 6) : + (CB2_2_4I2R4Terms a).Encloses (Foundation.entropyTerm (CB2_2_4I2R4Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB2_2_4I2R4Certificates_valid + (CB2_2_4I2R4CertificateIndex a) (CB2_2_4I2R4P_sound a) +def CB2_2_4I2R4Entropy : Ball := ⟨0, 0⟩ +lemma CB2_2_4I2R4Entropy_sound : CB2_2_4I2R4Entropy.Encloses (Foundation.finiteEntropy CB2_2_4I2R4Value) := by + exact contains_sound (entropyFin_enclosed 6 CB2_2_4I2R4Value CB2_2_4I2R4Terms CB2_2_4I2R4Terms_sound) (by decide +kernel) +def CB2_2_4I2R4Mass : Ball := ⟨0, 0⟩ +lemma CB2_2_4I2R4Mass_sound : CB2_2_4I2R4Mass.Encloses (∑ a, CB2_2_4I2R4Value a) := by + exact contains_sound (finSumBall_sound 6 CB2_2_4I2R4P CB2_2_4I2R4Value CB2_2_4I2R4P_sound) (by decide +kernel) +def CB2_2_4I2R4MassTerm : Ball := .exact 0 +lemma CB2_2_4I2R4MassTerm_sound : CB2_2_4I2R4MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB2_2_4I2R4Value a))) := + entropyTerm_zero_ball (CB2_2_4I2R4Mass_sound) +def CB2_2_4I2R4H : Ball := ⟨0, 0⟩ +lemma CB2_2_4I2R4H_sound : CB2_2_4I2R4H.Encloses (homogeneousEntropy CB2_2_4I2R4Value) := by + exact contains_sound (homogeneous_enclosed CB2_2_4I2R4Value CB2_2_4I2R4MassTerm_sound CB2_2_4I2R4Entropy_sound) (by decide +kernel) +def CB2_2_4I2R5Value (a : Fin 6) : ℝ := residualLaw (below (shape 2 2 4)) (fun u => (stageBLaw (shape 2 2 4) u : ℝ)) (stageBPriority (shape 2 2 4)) 2 (fun u a => (littleLaw (shape 2 2 4) u ((stageBPriority (shape 2 2 4)) 2) a : ℝ)) 5 a +def CB2_2_4I2R5Raw (a : Fin 6) : Ball := residualBall (below (shape 2 2 4)) B2_2_4Law (stageBPriority (shape 2 2 4)) 2 (fun u => B2_2_4Little u ((stageBPriority (shape 2 2 4)) 2)) 5 a +lemma CB2_2_4I2R5Raw_sound (a : Fin 6) : + (CB2_2_4I2R5Raw a).Encloses (CB2_2_4I2R5Value a) := by + exact residualBall_sound_on (below (shape 2 2 4)) B2_2_4Law (fun u => (stageBLaw (shape 2 2 4) u : ℝ)) (stageBPriority (shape 2 2 4)) 2 (fun u => B2_2_4Little u ((stageBPriority (shape 2 2 4)) 2)) (fun u a => (littleLaw (shape 2 2 4) u ((stageBPriority (shape 2 2 4)) 2) a : ℝ)) (fun u _ => B2_2_4Law_sound u) (fun u _ a => B2_2_4Little_sound u ((stageBPriority (shape 2 2 4)) 2) a) 5 a +def CB2_2_4I2R5Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB2_2_4I2R5Certificates_valid : + CB2_2_4I2R5Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB2_2_4I2R5CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB2_2_4I2R5P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_2_4I2R5Certificates (CB2_2_4I2R5CertificateIndex a)).input +lemma CB2_2_4I2R5P_check : ∀ a : Fin 6, contains (CB2_2_4I2R5Raw a) (CB2_2_4I2R5P a) = true := by + decide +kernel +lemma CB2_2_4I2R5P_sound (a : Fin 6) : + (CB2_2_4I2R5P a).Encloses (CB2_2_4I2R5Value a) := + contains_sound (CB2_2_4I2R5Raw_sound a) (CB2_2_4I2R5P_check a) +def CB2_2_4I2R5Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_2_4I2R5Certificates (CB2_2_4I2R5CertificateIndex a)).output +lemma CB2_2_4I2R5Terms_sound (a : Fin 6) : + (CB2_2_4I2R5Terms a).Encloses (Foundation.entropyTerm (CB2_2_4I2R5Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB2_2_4I2R5Certificates_valid + (CB2_2_4I2R5CertificateIndex a) (CB2_2_4I2R5P_sound a) +def CB2_2_4I2R5Entropy : Ball := ⟨0, 0⟩ +lemma CB2_2_4I2R5Entropy_sound : CB2_2_4I2R5Entropy.Encloses (Foundation.finiteEntropy CB2_2_4I2R5Value) := by + exact contains_sound (entropyFin_enclosed 6 CB2_2_4I2R5Value CB2_2_4I2R5Terms CB2_2_4I2R5Terms_sound) (by decide +kernel) +def CB2_2_4I2R5Mass : Ball := ⟨0, 0⟩ +lemma CB2_2_4I2R5Mass_sound : CB2_2_4I2R5Mass.Encloses (∑ a, CB2_2_4I2R5Value a) := by + exact contains_sound (finSumBall_sound 6 CB2_2_4I2R5P CB2_2_4I2R5Value CB2_2_4I2R5P_sound) (by decide +kernel) +def CB2_2_4I2R5MassTerm : Ball := .exact 0 +lemma CB2_2_4I2R5MassTerm_sound : CB2_2_4I2R5MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB2_2_4I2R5Value a))) := + entropyTerm_zero_ball (CB2_2_4I2R5Mass_sound) +def CB2_2_4I2R5H : Ball := ⟨0, 0⟩ +lemma CB2_2_4I2R5H_sound : CB2_2_4I2R5H.Encloses (homogeneousEntropy CB2_2_4I2R5Value) := by + exact contains_sound (homogeneous_enclosed CB2_2_4I2R5Value CB2_2_4I2R5MassTerm_sound CB2_2_4I2R5Entropy_sound) (by decide +kernel) +def CB2_2_4I2R6Value (a : Fin 6) : ℝ := residualLaw (below (shape 2 2 4)) (fun u => (stageBLaw (shape 2 2 4) u : ℝ)) (stageBPriority (shape 2 2 4)) 2 (fun u a => (littleLaw (shape 2 2 4) u ((stageBPriority (shape 2 2 4)) 2) a : ℝ)) 6 a +def CB2_2_4I2R6Raw (a : Fin 6) : Ball := residualBall (below (shape 2 2 4)) B2_2_4Law (stageBPriority (shape 2 2 4)) 2 (fun u => B2_2_4Little u ((stageBPriority (shape 2 2 4)) 2)) 6 a +lemma CB2_2_4I2R6Raw_sound (a : Fin 6) : + (CB2_2_4I2R6Raw a).Encloses (CB2_2_4I2R6Value a) := by + exact residualBall_sound_on (below (shape 2 2 4)) B2_2_4Law (fun u => (stageBLaw (shape 2 2 4) u : ℝ)) (stageBPriority (shape 2 2 4)) 2 (fun u => B2_2_4Little u ((stageBPriority (shape 2 2 4)) 2)) (fun u a => (littleLaw (shape 2 2 4) u ((stageBPriority (shape 2 2 4)) 2) a : ℝ)) (fun u _ => B2_2_4Law_sound u) (fun u _ a => B2_2_4Little_sound u ((stageBPriority (shape 2 2 4)) 2) a) 6 a +def CB2_2_4I2R6Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB2_2_4I2R6Certificates_valid : + CB2_2_4I2R6Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB2_2_4I2R6CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB2_2_4I2R6P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_2_4I2R6Certificates (CB2_2_4I2R6CertificateIndex a)).input +lemma CB2_2_4I2R6P_check : ∀ a : Fin 6, contains (CB2_2_4I2R6Raw a) (CB2_2_4I2R6P a) = true := by + decide +kernel +lemma CB2_2_4I2R6P_sound (a : Fin 6) : + (CB2_2_4I2R6P a).Encloses (CB2_2_4I2R6Value a) := + contains_sound (CB2_2_4I2R6Raw_sound a) (CB2_2_4I2R6P_check a) +def CB2_2_4I2R6Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_2_4I2R6Certificates (CB2_2_4I2R6CertificateIndex a)).output +lemma CB2_2_4I2R6Terms_sound (a : Fin 6) : + (CB2_2_4I2R6Terms a).Encloses (Foundation.entropyTerm (CB2_2_4I2R6Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB2_2_4I2R6Certificates_valid + (CB2_2_4I2R6CertificateIndex a) (CB2_2_4I2R6P_sound a) +def CB2_2_4I2R6Entropy : Ball := ⟨0, 0⟩ +lemma CB2_2_4I2R6Entropy_sound : CB2_2_4I2R6Entropy.Encloses (Foundation.finiteEntropy CB2_2_4I2R6Value) := by + exact contains_sound (entropyFin_enclosed 6 CB2_2_4I2R6Value CB2_2_4I2R6Terms CB2_2_4I2R6Terms_sound) (by decide +kernel) +def CB2_2_4I2R6Mass : Ball := ⟨0, 0⟩ +lemma CB2_2_4I2R6Mass_sound : CB2_2_4I2R6Mass.Encloses (∑ a, CB2_2_4I2R6Value a) := by + exact contains_sound (finSumBall_sound 6 CB2_2_4I2R6P CB2_2_4I2R6Value CB2_2_4I2R6P_sound) (by decide +kernel) +def CB2_2_4I2R6MassTerm : Ball := .exact 0 +lemma CB2_2_4I2R6MassTerm_sound : CB2_2_4I2R6MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB2_2_4I2R6Value a))) := + entropyTerm_zero_ball (CB2_2_4I2R6Mass_sound) +def CB2_2_4I2R6H : Ball := ⟨0, 0⟩ +lemma CB2_2_4I2R6H_sound : CB2_2_4I2R6H.Encloses (homogeneousEntropy CB2_2_4I2R6Value) := by + exact contains_sound (homogeneous_enclosed CB2_2_4I2R6Value CB2_2_4I2R6MassTerm_sound CB2_2_4I2R6Entropy_sound) (by decide +kernel) +def CB2_2_4I2R7Value (a : Fin 6) : ℝ := residualLaw (below (shape 2 2 4)) (fun u => (stageBLaw (shape 2 2 4) u : ℝ)) (stageBPriority (shape 2 2 4)) 2 (fun u a => (littleLaw (shape 2 2 4) u ((stageBPriority (shape 2 2 4)) 2) a : ℝ)) 7 a +def CB2_2_4I2R7Raw (a : Fin 6) : Ball := residualBall (below (shape 2 2 4)) B2_2_4Law (stageBPriority (shape 2 2 4)) 2 (fun u => B2_2_4Little u ((stageBPriority (shape 2 2 4)) 2)) 7 a +lemma CB2_2_4I2R7Raw_sound (a : Fin 6) : + (CB2_2_4I2R7Raw a).Encloses (CB2_2_4I2R7Value a) := by + exact residualBall_sound_on (below (shape 2 2 4)) B2_2_4Law (fun u => (stageBLaw (shape 2 2 4) u : ℝ)) (stageBPriority (shape 2 2 4)) 2 (fun u => B2_2_4Little u ((stageBPriority (shape 2 2 4)) 2)) (fun u a => (littleLaw (shape 2 2 4) u ((stageBPriority (shape 2 2 4)) 2) a : ℝ)) (fun u _ => B2_2_4Law_sound u) (fun u _ a => B2_2_4Little_sound u ((stageBPriority (shape 2 2 4)) 2) a) 7 a +def CB2_2_4I2R7Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB2_2_4I2R7Certificates_valid : + CB2_2_4I2R7Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB2_2_4I2R7CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB2_2_4I2R7P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_2_4I2R7Certificates (CB2_2_4I2R7CertificateIndex a)).input +lemma CB2_2_4I2R7P_check : ∀ a : Fin 6, contains (CB2_2_4I2R7Raw a) (CB2_2_4I2R7P a) = true := by + decide +kernel +lemma CB2_2_4I2R7P_sound (a : Fin 6) : + (CB2_2_4I2R7P a).Encloses (CB2_2_4I2R7Value a) := + contains_sound (CB2_2_4I2R7Raw_sound a) (CB2_2_4I2R7P_check a) +def CB2_2_4I2R7Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_2_4I2R7Certificates (CB2_2_4I2R7CertificateIndex a)).output +lemma CB2_2_4I2R7Terms_sound (a : Fin 6) : + (CB2_2_4I2R7Terms a).Encloses (Foundation.entropyTerm (CB2_2_4I2R7Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB2_2_4I2R7Certificates_valid + (CB2_2_4I2R7CertificateIndex a) (CB2_2_4I2R7P_sound a) +def CB2_2_4I2R7Entropy : Ball := ⟨0, 0⟩ +lemma CB2_2_4I2R7Entropy_sound : CB2_2_4I2R7Entropy.Encloses (Foundation.finiteEntropy CB2_2_4I2R7Value) := by + exact contains_sound (entropyFin_enclosed 6 CB2_2_4I2R7Value CB2_2_4I2R7Terms CB2_2_4I2R7Terms_sound) (by decide +kernel) +def CB2_2_4I2R7Mass : Ball := ⟨0, 0⟩ +lemma CB2_2_4I2R7Mass_sound : CB2_2_4I2R7Mass.Encloses (∑ a, CB2_2_4I2R7Value a) := by + exact contains_sound (finSumBall_sound 6 CB2_2_4I2R7P CB2_2_4I2R7Value CB2_2_4I2R7P_sound) (by decide +kernel) +def CB2_2_4I2R7MassTerm : Ball := .exact 0 +lemma CB2_2_4I2R7MassTerm_sound : CB2_2_4I2R7MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB2_2_4I2R7Value a))) := + entropyTerm_zero_ball (CB2_2_4I2R7Mass_sound) +def CB2_2_4I2R7H : Ball := ⟨0, 0⟩ +lemma CB2_2_4I2R7H_sound : CB2_2_4I2R7H.Encloses (homogeneousEntropy CB2_2_4I2R7Value) := by + exact contains_sound (homogeneous_enclosed CB2_2_4I2R7Value CB2_2_4I2R7MassTerm_sound CB2_2_4I2R7Entropy_sound) (by decide +kernel) +def CB2_2_4I2R8Value (a : Fin 6) : ℝ := residualLaw (below (shape 2 2 4)) (fun u => (stageBLaw (shape 2 2 4) u : ℝ)) (stageBPriority (shape 2 2 4)) 2 (fun u a => (littleLaw (shape 2 2 4) u ((stageBPriority (shape 2 2 4)) 2) a : ℝ)) 8 a +def CB2_2_4I2R8Raw (a : Fin 6) : Ball := residualBall (below (shape 2 2 4)) B2_2_4Law (stageBPriority (shape 2 2 4)) 2 (fun u => B2_2_4Little u ((stageBPriority (shape 2 2 4)) 2)) 8 a +lemma CB2_2_4I2R8Raw_sound (a : Fin 6) : + (CB2_2_4I2R8Raw a).Encloses (CB2_2_4I2R8Value a) := by + exact residualBall_sound_on (below (shape 2 2 4)) B2_2_4Law (fun u => (stageBLaw (shape 2 2 4) u : ℝ)) (stageBPriority (shape 2 2 4)) 2 (fun u => B2_2_4Little u ((stageBPriority (shape 2 2 4)) 2)) (fun u a => (littleLaw (shape 2 2 4) u ((stageBPriority (shape 2 2 4)) 2) a : ℝ)) (fun u _ => B2_2_4Law_sound u) (fun u _ a => B2_2_4Little_sound u ((stageBPriority (shape 2 2 4)) 2) a) 8 a +def CB2_2_4I2R8Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB2_2_4I2R8Certificates_valid : + CB2_2_4I2R8Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB2_2_4I2R8CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB2_2_4I2R8P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_2_4I2R8Certificates (CB2_2_4I2R8CertificateIndex a)).input +lemma CB2_2_4I2R8P_check : ∀ a : Fin 6, contains (CB2_2_4I2R8Raw a) (CB2_2_4I2R8P a) = true := by + decide +kernel +lemma CB2_2_4I2R8P_sound (a : Fin 6) : + (CB2_2_4I2R8P a).Encloses (CB2_2_4I2R8Value a) := + contains_sound (CB2_2_4I2R8Raw_sound a) (CB2_2_4I2R8P_check a) +def CB2_2_4I2R8Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_2_4I2R8Certificates (CB2_2_4I2R8CertificateIndex a)).output +lemma CB2_2_4I2R8Terms_sound (a : Fin 6) : + (CB2_2_4I2R8Terms a).Encloses (Foundation.entropyTerm (CB2_2_4I2R8Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB2_2_4I2R8Certificates_valid + (CB2_2_4I2R8CertificateIndex a) (CB2_2_4I2R8P_sound a) +def CB2_2_4I2R8Entropy : Ball := ⟨0, 0⟩ +lemma CB2_2_4I2R8Entropy_sound : CB2_2_4I2R8Entropy.Encloses (Foundation.finiteEntropy CB2_2_4I2R8Value) := by + exact contains_sound (entropyFin_enclosed 6 CB2_2_4I2R8Value CB2_2_4I2R8Terms CB2_2_4I2R8Terms_sound) (by decide +kernel) +def CB2_2_4I2R8Mass : Ball := ⟨0, 0⟩ +lemma CB2_2_4I2R8Mass_sound : CB2_2_4I2R8Mass.Encloses (∑ a, CB2_2_4I2R8Value a) := by + exact contains_sound (finSumBall_sound 6 CB2_2_4I2R8P CB2_2_4I2R8Value CB2_2_4I2R8P_sound) (by decide +kernel) +def CB2_2_4I2R8MassTerm : Ball := .exact 0 +lemma CB2_2_4I2R8MassTerm_sound : CB2_2_4I2R8MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB2_2_4I2R8Value a))) := + entropyTerm_zero_ball (CB2_2_4I2R8Mass_sound) +def CB2_2_4I2R8H : Ball := ⟨0, 0⟩ +lemma CB2_2_4I2R8H_sound : CB2_2_4I2R8H.Encloses (homogeneousEntropy CB2_2_4I2R8Value) := by + exact contains_sound (homogeneous_enclosed CB2_2_4I2R8Value CB2_2_4I2R8MassTerm_sound CB2_2_4I2R8Entropy_sound) (by decide +kernel) +def CB2_2_4I2R9Value (a : Fin 6) : ℝ := residualLaw (below (shape 2 2 4)) (fun u => (stageBLaw (shape 2 2 4) u : ℝ)) (stageBPriority (shape 2 2 4)) 2 (fun u a => (littleLaw (shape 2 2 4) u ((stageBPriority (shape 2 2 4)) 2) a : ℝ)) 9 a +def CB2_2_4I2R9Raw (a : Fin 6) : Ball := residualBall (below (shape 2 2 4)) B2_2_4Law (stageBPriority (shape 2 2 4)) 2 (fun u => B2_2_4Little u ((stageBPriority (shape 2 2 4)) 2)) 9 a +lemma CB2_2_4I2R9Raw_sound (a : Fin 6) : + (CB2_2_4I2R9Raw a).Encloses (CB2_2_4I2R9Value a) := by + exact residualBall_sound_on (below (shape 2 2 4)) B2_2_4Law (fun u => (stageBLaw (shape 2 2 4) u : ℝ)) (stageBPriority (shape 2 2 4)) 2 (fun u => B2_2_4Little u ((stageBPriority (shape 2 2 4)) 2)) (fun u a => (littleLaw (shape 2 2 4) u ((stageBPriority (shape 2 2 4)) 2) a : ℝ)) (fun u _ => B2_2_4Law_sound u) (fun u _ a => B2_2_4Little_sound u ((stageBPriority (shape 2 2 4)) 2) a) 9 a +def CB2_2_4I2R9Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB2_2_4I2R9Certificates_valid : + CB2_2_4I2R9Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB2_2_4I2R9CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB2_2_4I2R9P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_2_4I2R9Certificates (CB2_2_4I2R9CertificateIndex a)).input +lemma CB2_2_4I2R9P_check : ∀ a : Fin 6, contains (CB2_2_4I2R9Raw a) (CB2_2_4I2R9P a) = true := by + decide +kernel +lemma CB2_2_4I2R9P_sound (a : Fin 6) : + (CB2_2_4I2R9P a).Encloses (CB2_2_4I2R9Value a) := + contains_sound (CB2_2_4I2R9Raw_sound a) (CB2_2_4I2R9P_check a) +def CB2_2_4I2R9Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_2_4I2R9Certificates (CB2_2_4I2R9CertificateIndex a)).output +lemma CB2_2_4I2R9Terms_sound (a : Fin 6) : + (CB2_2_4I2R9Terms a).Encloses (Foundation.entropyTerm (CB2_2_4I2R9Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB2_2_4I2R9Certificates_valid + (CB2_2_4I2R9CertificateIndex a) (CB2_2_4I2R9P_sound a) +def CB2_2_4I2R9Entropy : Ball := ⟨0, 0⟩ +lemma CB2_2_4I2R9Entropy_sound : CB2_2_4I2R9Entropy.Encloses (Foundation.finiteEntropy CB2_2_4I2R9Value) := by + exact contains_sound (entropyFin_enclosed 6 CB2_2_4I2R9Value CB2_2_4I2R9Terms CB2_2_4I2R9Terms_sound) (by decide +kernel) +def CB2_2_4I2R9Mass : Ball := ⟨0, 0⟩ +lemma CB2_2_4I2R9Mass_sound : CB2_2_4I2R9Mass.Encloses (∑ a, CB2_2_4I2R9Value a) := by + exact contains_sound (finSumBall_sound 6 CB2_2_4I2R9P CB2_2_4I2R9Value CB2_2_4I2R9P_sound) (by decide +kernel) +def CB2_2_4I2R9MassTerm : Ball := .exact 0 +lemma CB2_2_4I2R9MassTerm_sound : CB2_2_4I2R9MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB2_2_4I2R9Value a))) := + entropyTerm_zero_ball (CB2_2_4I2R9Mass_sound) +def CB2_2_4I2R9H : Ball := ⟨0, 0⟩ +lemma CB2_2_4I2R9H_sound : CB2_2_4I2R9H.Encloses (homogeneousEntropy CB2_2_4I2R9Value) := by + exact contains_sound (homogeneous_enclosed CB2_2_4I2R9Value CB2_2_4I2R9MassTerm_sound CB2_2_4I2R9Entropy_sound) (by decide +kernel) +def CB2_2_4I2R10Value (a : Fin 6) : ℝ := residualLaw (below (shape 2 2 4)) (fun u => (stageBLaw (shape 2 2 4) u : ℝ)) (stageBPriority (shape 2 2 4)) 2 (fun u a => (littleLaw (shape 2 2 4) u ((stageBPriority (shape 2 2 4)) 2) a : ℝ)) 10 a +def CB2_2_4I2R10Raw (a : Fin 6) : Ball := residualBall (below (shape 2 2 4)) B2_2_4Law (stageBPriority (shape 2 2 4)) 2 (fun u => B2_2_4Little u ((stageBPriority (shape 2 2 4)) 2)) 10 a +lemma CB2_2_4I2R10Raw_sound (a : Fin 6) : + (CB2_2_4I2R10Raw a).Encloses (CB2_2_4I2R10Value a) := by + exact residualBall_sound_on (below (shape 2 2 4)) B2_2_4Law (fun u => (stageBLaw (shape 2 2 4) u : ℝ)) (stageBPriority (shape 2 2 4)) 2 (fun u => B2_2_4Little u ((stageBPriority (shape 2 2 4)) 2)) (fun u a => (littleLaw (shape 2 2 4) u ((stageBPriority (shape 2 2 4)) 2) a : ℝ)) (fun u _ => B2_2_4Law_sound u) (fun u _ a => B2_2_4Little_sound u ((stageBPriority (shape 2 2 4)) 2) a) 10 a +def CB2_2_4I2R10Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB2_2_4I2R10Certificates_valid : + CB2_2_4I2R10Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB2_2_4I2R10CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB2_2_4I2R10P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_2_4I2R10Certificates (CB2_2_4I2R10CertificateIndex a)).input +lemma CB2_2_4I2R10P_check : ∀ a : Fin 6, contains (CB2_2_4I2R10Raw a) (CB2_2_4I2R10P a) = true := by + decide +kernel +lemma CB2_2_4I2R10P_sound (a : Fin 6) : + (CB2_2_4I2R10P a).Encloses (CB2_2_4I2R10Value a) := + contains_sound (CB2_2_4I2R10Raw_sound a) (CB2_2_4I2R10P_check a) +def CB2_2_4I2R10Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_2_4I2R10Certificates (CB2_2_4I2R10CertificateIndex a)).output +lemma CB2_2_4I2R10Terms_sound (a : Fin 6) : + (CB2_2_4I2R10Terms a).Encloses (Foundation.entropyTerm (CB2_2_4I2R10Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB2_2_4I2R10Certificates_valid + (CB2_2_4I2R10CertificateIndex a) (CB2_2_4I2R10P_sound a) +def CB2_2_4I2R10Entropy : Ball := ⟨0, 0⟩ +lemma CB2_2_4I2R10Entropy_sound : CB2_2_4I2R10Entropy.Encloses (Foundation.finiteEntropy CB2_2_4I2R10Value) := by + exact contains_sound (entropyFin_enclosed 6 CB2_2_4I2R10Value CB2_2_4I2R10Terms CB2_2_4I2R10Terms_sound) (by decide +kernel) +def CB2_2_4I2R10Mass : Ball := ⟨0, 0⟩ +lemma CB2_2_4I2R10Mass_sound : CB2_2_4I2R10Mass.Encloses (∑ a, CB2_2_4I2R10Value a) := by + exact contains_sound (finSumBall_sound 6 CB2_2_4I2R10P CB2_2_4I2R10Value CB2_2_4I2R10P_sound) (by decide +kernel) +def CB2_2_4I2R10MassTerm : Ball := .exact 0 +lemma CB2_2_4I2R10MassTerm_sound : CB2_2_4I2R10MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB2_2_4I2R10Value a))) := + entropyTerm_zero_ball (CB2_2_4I2R10Mass_sound) +def CB2_2_4I2R10H : Ball := ⟨0, 0⟩ +lemma CB2_2_4I2R10H_sound : CB2_2_4I2R10H.Encloses (homogeneousEntropy CB2_2_4I2R10Value) := by + exact contains_sound (homogeneous_enclosed CB2_2_4I2R10Value CB2_2_4I2R10MassTerm_sound CB2_2_4I2R10Entropy_sound) (by decide +kernel) +def CB2_2_4I2R11Value (a : Fin 6) : ℝ := residualLaw (below (shape 2 2 4)) (fun u => (stageBLaw (shape 2 2 4) u : ℝ)) (stageBPriority (shape 2 2 4)) 2 (fun u a => (littleLaw (shape 2 2 4) u ((stageBPriority (shape 2 2 4)) 2) a : ℝ)) 11 a +def CB2_2_4I2R11Raw (a : Fin 6) : Ball := residualBall (below (shape 2 2 4)) B2_2_4Law (stageBPriority (shape 2 2 4)) 2 (fun u => B2_2_4Little u ((stageBPriority (shape 2 2 4)) 2)) 11 a +lemma CB2_2_4I2R11Raw_sound (a : Fin 6) : + (CB2_2_4I2R11Raw a).Encloses (CB2_2_4I2R11Value a) := by + exact residualBall_sound_on (below (shape 2 2 4)) B2_2_4Law (fun u => (stageBLaw (shape 2 2 4) u : ℝ)) (stageBPriority (shape 2 2 4)) 2 (fun u => B2_2_4Little u ((stageBPriority (shape 2 2 4)) 2)) (fun u a => (littleLaw (shape 2 2 4) u ((stageBPriority (shape 2 2 4)) 2) a : ℝ)) (fun u _ => B2_2_4Law_sound u) (fun u _ a => B2_2_4Little_sound u ((stageBPriority (shape 2 2 4)) 2) a) 11 a +def CB2_2_4I2R11Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB2_2_4I2R11Certificates_valid : + CB2_2_4I2R11Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB2_2_4I2R11CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB2_2_4I2R11P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_2_4I2R11Certificates (CB2_2_4I2R11CertificateIndex a)).input +lemma CB2_2_4I2R11P_check : ∀ a : Fin 6, contains (CB2_2_4I2R11Raw a) (CB2_2_4I2R11P a) = true := by + decide +kernel +lemma CB2_2_4I2R11P_sound (a : Fin 6) : + (CB2_2_4I2R11P a).Encloses (CB2_2_4I2R11Value a) := + contains_sound (CB2_2_4I2R11Raw_sound a) (CB2_2_4I2R11P_check a) +def CB2_2_4I2R11Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_2_4I2R11Certificates (CB2_2_4I2R11CertificateIndex a)).output +lemma CB2_2_4I2R11Terms_sound (a : Fin 6) : + (CB2_2_4I2R11Terms a).Encloses (Foundation.entropyTerm (CB2_2_4I2R11Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB2_2_4I2R11Certificates_valid + (CB2_2_4I2R11CertificateIndex a) (CB2_2_4I2R11P_sound a) +def CB2_2_4I2R11Entropy : Ball := ⟨0, 0⟩ +lemma CB2_2_4I2R11Entropy_sound : CB2_2_4I2R11Entropy.Encloses (Foundation.finiteEntropy CB2_2_4I2R11Value) := by + exact contains_sound (entropyFin_enclosed 6 CB2_2_4I2R11Value CB2_2_4I2R11Terms CB2_2_4I2R11Terms_sound) (by decide +kernel) +def CB2_2_4I2R11Mass : Ball := ⟨0, 0⟩ +lemma CB2_2_4I2R11Mass_sound : CB2_2_4I2R11Mass.Encloses (∑ a, CB2_2_4I2R11Value a) := by + exact contains_sound (finSumBall_sound 6 CB2_2_4I2R11P CB2_2_4I2R11Value CB2_2_4I2R11P_sound) (by decide +kernel) +def CB2_2_4I2R11MassTerm : Ball := .exact 0 +lemma CB2_2_4I2R11MassTerm_sound : CB2_2_4I2R11MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB2_2_4I2R11Value a))) := + entropyTerm_zero_ball (CB2_2_4I2R11Mass_sound) +def CB2_2_4I2R11H : Ball := ⟨0, 0⟩ +lemma CB2_2_4I2R11H_sound : CB2_2_4I2R11H.Encloses (homogeneousEntropy CB2_2_4I2R11Value) := by + exact contains_sound (homogeneous_enclosed CB2_2_4I2R11Value CB2_2_4I2R11MassTerm_sound CB2_2_4I2R11Entropy_sound) (by decide +kernel) +def CB2_2_4I2R12Value (a : Fin 6) : ℝ := residualLaw (below (shape 2 2 4)) (fun u => (stageBLaw (shape 2 2 4) u : ℝ)) (stageBPriority (shape 2 2 4)) 2 (fun u a => (littleLaw (shape 2 2 4) u ((stageBPriority (shape 2 2 4)) 2) a : ℝ)) 12 a +def CB2_2_4I2R12Raw (a : Fin 6) : Ball := residualBall (below (shape 2 2 4)) B2_2_4Law (stageBPriority (shape 2 2 4)) 2 (fun u => B2_2_4Little u ((stageBPriority (shape 2 2 4)) 2)) 12 a +lemma CB2_2_4I2R12Raw_sound (a : Fin 6) : + (CB2_2_4I2R12Raw a).Encloses (CB2_2_4I2R12Value a) := by + exact residualBall_sound_on (below (shape 2 2 4)) B2_2_4Law (fun u => (stageBLaw (shape 2 2 4) u : ℝ)) (stageBPriority (shape 2 2 4)) 2 (fun u => B2_2_4Little u ((stageBPriority (shape 2 2 4)) 2)) (fun u a => (littleLaw (shape 2 2 4) u ((stageBPriority (shape 2 2 4)) 2) a : ℝ)) (fun u _ => B2_2_4Law_sound u) (fun u _ a => B2_2_4Little_sound u ((stageBPriority (shape 2 2 4)) 2) a) 12 a +def CB2_2_4I2R12Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB2_2_4I2R12Certificates_valid : + CB2_2_4I2R12Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB2_2_4I2R12CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB2_2_4I2R12P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_2_4I2R12Certificates (CB2_2_4I2R12CertificateIndex a)).input +lemma CB2_2_4I2R12P_check : ∀ a : Fin 6, contains (CB2_2_4I2R12Raw a) (CB2_2_4I2R12P a) = true := by + decide +kernel +lemma CB2_2_4I2R12P_sound (a : Fin 6) : + (CB2_2_4I2R12P a).Encloses (CB2_2_4I2R12Value a) := + contains_sound (CB2_2_4I2R12Raw_sound a) (CB2_2_4I2R12P_check a) +def CB2_2_4I2R12Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_2_4I2R12Certificates (CB2_2_4I2R12CertificateIndex a)).output +lemma CB2_2_4I2R12Terms_sound (a : Fin 6) : + (CB2_2_4I2R12Terms a).Encloses (Foundation.entropyTerm (CB2_2_4I2R12Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB2_2_4I2R12Certificates_valid + (CB2_2_4I2R12CertificateIndex a) (CB2_2_4I2R12P_sound a) +def CB2_2_4I2R12Entropy : Ball := ⟨0, 0⟩ +lemma CB2_2_4I2R12Entropy_sound : CB2_2_4I2R12Entropy.Encloses (Foundation.finiteEntropy CB2_2_4I2R12Value) := by + exact contains_sound (entropyFin_enclosed 6 CB2_2_4I2R12Value CB2_2_4I2R12Terms CB2_2_4I2R12Terms_sound) (by decide +kernel) +def CB2_2_4I2R12Mass : Ball := ⟨0, 0⟩ +lemma CB2_2_4I2R12Mass_sound : CB2_2_4I2R12Mass.Encloses (∑ a, CB2_2_4I2R12Value a) := by + exact contains_sound (finSumBall_sound 6 CB2_2_4I2R12P CB2_2_4I2R12Value CB2_2_4I2R12P_sound) (by decide +kernel) +def CB2_2_4I2R12MassTerm : Ball := .exact 0 +lemma CB2_2_4I2R12MassTerm_sound : CB2_2_4I2R12MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB2_2_4I2R12Value a))) := + entropyTerm_zero_ball (CB2_2_4I2R12Mass_sound) +def CB2_2_4I2R12H : Ball := ⟨0, 0⟩ +lemma CB2_2_4I2R12H_sound : CB2_2_4I2R12H.Encloses (homogeneousEntropy CB2_2_4I2R12Value) := by + exact contains_sound (homogeneous_enclosed CB2_2_4I2R12Value CB2_2_4I2R12MassTerm_sound CB2_2_4I2R12Entropy_sound) (by decide +kernel) +def CB2_2_4I2R13Value (a : Fin 6) : ℝ := residualLaw (below (shape 2 2 4)) (fun u => (stageBLaw (shape 2 2 4) u : ℝ)) (stageBPriority (shape 2 2 4)) 2 (fun u a => (littleLaw (shape 2 2 4) u ((stageBPriority (shape 2 2 4)) 2) a : ℝ)) 13 a +def CB2_2_4I2R13Raw (a : Fin 6) : Ball := residualBall (below (shape 2 2 4)) B2_2_4Law (stageBPriority (shape 2 2 4)) 2 (fun u => B2_2_4Little u ((stageBPriority (shape 2 2 4)) 2)) 13 a +lemma CB2_2_4I2R13Raw_sound (a : Fin 6) : + (CB2_2_4I2R13Raw a).Encloses (CB2_2_4I2R13Value a) := by + exact residualBall_sound_on (below (shape 2 2 4)) B2_2_4Law (fun u => (stageBLaw (shape 2 2 4) u : ℝ)) (stageBPriority (shape 2 2 4)) 2 (fun u => B2_2_4Little u ((stageBPriority (shape 2 2 4)) 2)) (fun u a => (littleLaw (shape 2 2 4) u ((stageBPriority (shape 2 2 4)) 2) a : ℝ)) (fun u _ => B2_2_4Law_sound u) (fun u _ a => B2_2_4Little_sound u ((stageBPriority (shape 2 2 4)) 2) a) 13 a +def CB2_2_4I2R13Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB2_2_4I2R13Certificates_valid : + CB2_2_4I2R13Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB2_2_4I2R13CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB2_2_4I2R13P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_2_4I2R13Certificates (CB2_2_4I2R13CertificateIndex a)).input +lemma CB2_2_4I2R13P_check : ∀ a : Fin 6, contains (CB2_2_4I2R13Raw a) (CB2_2_4I2R13P a) = true := by + decide +kernel +lemma CB2_2_4I2R13P_sound (a : Fin 6) : + (CB2_2_4I2R13P a).Encloses (CB2_2_4I2R13Value a) := + contains_sound (CB2_2_4I2R13Raw_sound a) (CB2_2_4I2R13P_check a) +def CB2_2_4I2R13Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_2_4I2R13Certificates (CB2_2_4I2R13CertificateIndex a)).output +lemma CB2_2_4I2R13Terms_sound (a : Fin 6) : + (CB2_2_4I2R13Terms a).Encloses (Foundation.entropyTerm (CB2_2_4I2R13Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB2_2_4I2R13Certificates_valid + (CB2_2_4I2R13CertificateIndex a) (CB2_2_4I2R13P_sound a) +def CB2_2_4I2R13Entropy : Ball := ⟨0, 0⟩ +lemma CB2_2_4I2R13Entropy_sound : CB2_2_4I2R13Entropy.Encloses (Foundation.finiteEntropy CB2_2_4I2R13Value) := by + exact contains_sound (entropyFin_enclosed 6 CB2_2_4I2R13Value CB2_2_4I2R13Terms CB2_2_4I2R13Terms_sound) (by decide +kernel) +def CB2_2_4I2R13Mass : Ball := ⟨0, 0⟩ +lemma CB2_2_4I2R13Mass_sound : CB2_2_4I2R13Mass.Encloses (∑ a, CB2_2_4I2R13Value a) := by + exact contains_sound (finSumBall_sound 6 CB2_2_4I2R13P CB2_2_4I2R13Value CB2_2_4I2R13P_sound) (by decide +kernel) +def CB2_2_4I2R13MassTerm : Ball := .exact 0 +lemma CB2_2_4I2R13MassTerm_sound : CB2_2_4I2R13MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB2_2_4I2R13Value a))) := + entropyTerm_zero_ball (CB2_2_4I2R13Mass_sound) +def CB2_2_4I2R13H : Ball := ⟨0, 0⟩ +lemma CB2_2_4I2R13H_sound : CB2_2_4I2R13H.Encloses (homogeneousEntropy CB2_2_4I2R13Value) := by + exact contains_sound (homogeneous_enclosed CB2_2_4I2R13Value CB2_2_4I2R13MassTerm_sound CB2_2_4I2R13Entropy_sound) (by decide +kernel) +def CB2_2_4I2R14Value (a : Fin 6) : ℝ := residualLaw (below (shape 2 2 4)) (fun u => (stageBLaw (shape 2 2 4) u : ℝ)) (stageBPriority (shape 2 2 4)) 2 (fun u a => (littleLaw (shape 2 2 4) u ((stageBPriority (shape 2 2 4)) 2) a : ℝ)) 14 a +def CB2_2_4I2R14Raw (a : Fin 6) : Ball := residualBall (below (shape 2 2 4)) B2_2_4Law (stageBPriority (shape 2 2 4)) 2 (fun u => B2_2_4Little u ((stageBPriority (shape 2 2 4)) 2)) 14 a +lemma CB2_2_4I2R14Raw_sound (a : Fin 6) : + (CB2_2_4I2R14Raw a).Encloses (CB2_2_4I2R14Value a) := by + exact residualBall_sound_on (below (shape 2 2 4)) B2_2_4Law (fun u => (stageBLaw (shape 2 2 4) u : ℝ)) (stageBPriority (shape 2 2 4)) 2 (fun u => B2_2_4Little u ((stageBPriority (shape 2 2 4)) 2)) (fun u a => (littleLaw (shape 2 2 4) u ((stageBPriority (shape 2 2 4)) 2) a : ℝ)) (fun u _ => B2_2_4Law_sound u) (fun u _ a => B2_2_4Little_sound u ((stageBPriority (shape 2 2 4)) 2) a) 14 a +def CB2_2_4I2R14Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB2_2_4I2R14Certificates_valid : + CB2_2_4I2R14Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB2_2_4I2R14CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB2_2_4I2R14P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_2_4I2R14Certificates (CB2_2_4I2R14CertificateIndex a)).input +lemma CB2_2_4I2R14P_check : ∀ a : Fin 6, contains (CB2_2_4I2R14Raw a) (CB2_2_4I2R14P a) = true := by + decide +kernel +lemma CB2_2_4I2R14P_sound (a : Fin 6) : + (CB2_2_4I2R14P a).Encloses (CB2_2_4I2R14Value a) := + contains_sound (CB2_2_4I2R14Raw_sound a) (CB2_2_4I2R14P_check a) +def CB2_2_4I2R14Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_2_4I2R14Certificates (CB2_2_4I2R14CertificateIndex a)).output +lemma CB2_2_4I2R14Terms_sound (a : Fin 6) : + (CB2_2_4I2R14Terms a).Encloses (Foundation.entropyTerm (CB2_2_4I2R14Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB2_2_4I2R14Certificates_valid + (CB2_2_4I2R14CertificateIndex a) (CB2_2_4I2R14P_sound a) +def CB2_2_4I2R14Entropy : Ball := ⟨0, 0⟩ +lemma CB2_2_4I2R14Entropy_sound : CB2_2_4I2R14Entropy.Encloses (Foundation.finiteEntropy CB2_2_4I2R14Value) := by + exact contains_sound (entropyFin_enclosed 6 CB2_2_4I2R14Value CB2_2_4I2R14Terms CB2_2_4I2R14Terms_sound) (by decide +kernel) +def CB2_2_4I2R14Mass : Ball := ⟨0, 0⟩ +lemma CB2_2_4I2R14Mass_sound : CB2_2_4I2R14Mass.Encloses (∑ a, CB2_2_4I2R14Value a) := by + exact contains_sound (finSumBall_sound 6 CB2_2_4I2R14P CB2_2_4I2R14Value CB2_2_4I2R14P_sound) (by decide +kernel) +def CB2_2_4I2R14MassTerm : Ball := .exact 0 +lemma CB2_2_4I2R14MassTerm_sound : CB2_2_4I2R14MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB2_2_4I2R14Value a))) := + entropyTerm_zero_ball (CB2_2_4I2R14Mass_sound) +def CB2_2_4I2R14H : Ball := ⟨0, 0⟩ +lemma CB2_2_4I2R14H_sound : CB2_2_4I2R14H.Encloses (homogeneousEntropy CB2_2_4I2R14Value) := by + exact contains_sound (homogeneous_enclosed CB2_2_4I2R14Value CB2_2_4I2R14MassTerm_sound CB2_2_4I2R14Entropy_sound) (by decide +kernel) +def CB2_2_4I2R15Value (a : Fin 6) : ℝ := residualLaw (below (shape 2 2 4)) (fun u => (stageBLaw (shape 2 2 4) u : ℝ)) (stageBPriority (shape 2 2 4)) 2 (fun u a => (littleLaw (shape 2 2 4) u ((stageBPriority (shape 2 2 4)) 2) a : ℝ)) 15 a +def CB2_2_4I2R15Raw (a : Fin 6) : Ball := residualBall (below (shape 2 2 4)) B2_2_4Law (stageBPriority (shape 2 2 4)) 2 (fun u => B2_2_4Little u ((stageBPriority (shape 2 2 4)) 2)) 15 a +lemma CB2_2_4I2R15Raw_sound (a : Fin 6) : + (CB2_2_4I2R15Raw a).Encloses (CB2_2_4I2R15Value a) := by + exact residualBall_sound_on (below (shape 2 2 4)) B2_2_4Law (fun u => (stageBLaw (shape 2 2 4) u : ℝ)) (stageBPriority (shape 2 2 4)) 2 (fun u => B2_2_4Little u ((stageBPriority (shape 2 2 4)) 2)) (fun u a => (littleLaw (shape 2 2 4) u ((stageBPriority (shape 2 2 4)) 2) a : ℝ)) (fun u _ => B2_2_4Law_sound u) (fun u _ a => B2_2_4Little_sound u ((stageBPriority (shape 2 2 4)) 2) a) 15 a +def CB2_2_4I2R15Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB2_2_4I2R15Certificates_valid : + CB2_2_4I2R15Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB2_2_4I2R15CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB2_2_4I2R15P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_2_4I2R15Certificates (CB2_2_4I2R15CertificateIndex a)).input +lemma CB2_2_4I2R15P_check : ∀ a : Fin 6, contains (CB2_2_4I2R15Raw a) (CB2_2_4I2R15P a) = true := by + decide +kernel +lemma CB2_2_4I2R15P_sound (a : Fin 6) : + (CB2_2_4I2R15P a).Encloses (CB2_2_4I2R15Value a) := + contains_sound (CB2_2_4I2R15Raw_sound a) (CB2_2_4I2R15P_check a) +def CB2_2_4I2R15Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_2_4I2R15Certificates (CB2_2_4I2R15CertificateIndex a)).output +lemma CB2_2_4I2R15Terms_sound (a : Fin 6) : + (CB2_2_4I2R15Terms a).Encloses (Foundation.entropyTerm (CB2_2_4I2R15Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB2_2_4I2R15Certificates_valid + (CB2_2_4I2R15CertificateIndex a) (CB2_2_4I2R15P_sound a) +def CB2_2_4I2R15Entropy : Ball := ⟨0, 0⟩ +lemma CB2_2_4I2R15Entropy_sound : CB2_2_4I2R15Entropy.Encloses (Foundation.finiteEntropy CB2_2_4I2R15Value) := by + exact contains_sound (entropyFin_enclosed 6 CB2_2_4I2R15Value CB2_2_4I2R15Terms CB2_2_4I2R15Terms_sound) (by decide +kernel) +def CB2_2_4I2R15Mass : Ball := ⟨0, 0⟩ +lemma CB2_2_4I2R15Mass_sound : CB2_2_4I2R15Mass.Encloses (∑ a, CB2_2_4I2R15Value a) := by + exact contains_sound (finSumBall_sound 6 CB2_2_4I2R15P CB2_2_4I2R15Value CB2_2_4I2R15P_sound) (by decide +kernel) +def CB2_2_4I2R15MassTerm : Ball := .exact 0 +lemma CB2_2_4I2R15MassTerm_sound : CB2_2_4I2R15MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB2_2_4I2R15Value a))) := + entropyTerm_zero_ball (CB2_2_4I2R15Mass_sound) +def CB2_2_4I2R15H : Ball := ⟨0, 0⟩ +lemma CB2_2_4I2R15H_sound : CB2_2_4I2R15H.Encloses (homogeneousEntropy CB2_2_4I2R15Value) := by + exact contains_sound (homogeneous_enclosed CB2_2_4I2R15Value CB2_2_4I2R15MassTerm_sound CB2_2_4I2R15Entropy_sound) (by decide +kernel) +def CB2_2_4I2R16Value (a : Fin 6) : ℝ := residualLaw (below (shape 2 2 4)) (fun u => (stageBLaw (shape 2 2 4) u : ℝ)) (stageBPriority (shape 2 2 4)) 2 (fun u a => (littleLaw (shape 2 2 4) u ((stageBPriority (shape 2 2 4)) 2) a : ℝ)) 16 a +def CB2_2_4I2R16Raw (a : Fin 6) : Ball := residualBall (below (shape 2 2 4)) B2_2_4Law (stageBPriority (shape 2 2 4)) 2 (fun u => B2_2_4Little u ((stageBPriority (shape 2 2 4)) 2)) 16 a +lemma CB2_2_4I2R16Raw_sound (a : Fin 6) : + (CB2_2_4I2R16Raw a).Encloses (CB2_2_4I2R16Value a) := by + exact residualBall_sound_on (below (shape 2 2 4)) B2_2_4Law (fun u => (stageBLaw (shape 2 2 4) u : ℝ)) (stageBPriority (shape 2 2 4)) 2 (fun u => B2_2_4Little u ((stageBPriority (shape 2 2 4)) 2)) (fun u a => (littleLaw (shape 2 2 4) u ((stageBPriority (shape 2 2 4)) 2) a : ℝ)) (fun u _ => B2_2_4Law_sound u) (fun u _ a => B2_2_4Little_sound u ((stageBPriority (shape 2 2 4)) 2) a) 16 a +def CB2_2_4I2R16Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB2_2_4I2R16Certificates_valid : + CB2_2_4I2R16Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB2_2_4I2R16CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB2_2_4I2R16P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_2_4I2R16Certificates (CB2_2_4I2R16CertificateIndex a)).input +lemma CB2_2_4I2R16P_check : ∀ a : Fin 6, contains (CB2_2_4I2R16Raw a) (CB2_2_4I2R16P a) = true := by + decide +kernel +lemma CB2_2_4I2R16P_sound (a : Fin 6) : + (CB2_2_4I2R16P a).Encloses (CB2_2_4I2R16Value a) := + contains_sound (CB2_2_4I2R16Raw_sound a) (CB2_2_4I2R16P_check a) +def CB2_2_4I2R16Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_2_4I2R16Certificates (CB2_2_4I2R16CertificateIndex a)).output +lemma CB2_2_4I2R16Terms_sound (a : Fin 6) : + (CB2_2_4I2R16Terms a).Encloses (Foundation.entropyTerm (CB2_2_4I2R16Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB2_2_4I2R16Certificates_valid + (CB2_2_4I2R16CertificateIndex a) (CB2_2_4I2R16P_sound a) +def CB2_2_4I2R16Entropy : Ball := ⟨0, 0⟩ +lemma CB2_2_4I2R16Entropy_sound : CB2_2_4I2R16Entropy.Encloses (Foundation.finiteEntropy CB2_2_4I2R16Value) := by + exact contains_sound (entropyFin_enclosed 6 CB2_2_4I2R16Value CB2_2_4I2R16Terms CB2_2_4I2R16Terms_sound) (by decide +kernel) +def CB2_2_4I2R16Mass : Ball := ⟨0, 0⟩ +lemma CB2_2_4I2R16Mass_sound : CB2_2_4I2R16Mass.Encloses (∑ a, CB2_2_4I2R16Value a) := by + exact contains_sound (finSumBall_sound 6 CB2_2_4I2R16P CB2_2_4I2R16Value CB2_2_4I2R16P_sound) (by decide +kernel) +def CB2_2_4I2R16MassTerm : Ball := .exact 0 +lemma CB2_2_4I2R16MassTerm_sound : CB2_2_4I2R16MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB2_2_4I2R16Value a))) := + entropyTerm_zero_ball (CB2_2_4I2R16Mass_sound) +def CB2_2_4I2R16H : Ball := ⟨0, 0⟩ +lemma CB2_2_4I2R16H_sound : CB2_2_4I2R16H.Encloses (homogeneousEntropy CB2_2_4I2R16Value) := by + exact contains_sound (homogeneous_enclosed CB2_2_4I2R16Value CB2_2_4I2R16MassTerm_sound CB2_2_4I2R16Entropy_sound) (by decide +kernel) +def CB2_2_4I2ResidualEntropies (a : Fin 17) : Ball := + match a.val with + | 0 => CB2_2_4I2R0H + | 1 => CB2_2_4I2R1H + | 2 => CB2_2_4I2R2H + | 3 => CB2_2_4I2R3H + | 4 => CB2_2_4I2R4H + | 5 => CB2_2_4I2R5H + | 6 => CB2_2_4I2R6H + | 7 => CB2_2_4I2R7H + | 8 => CB2_2_4I2R8H + | 9 => CB2_2_4I2R9H + | 10 => CB2_2_4I2R10H + | 11 => CB2_2_4I2R11H + | 12 => CB2_2_4I2R12H + | 13 => CB2_2_4I2R13H + | 14 => CB2_2_4I2R14H + | 15 => CB2_2_4I2R15H + | 16 => CB2_2_4I2R16H + | _ => (.exact 0) +lemma CB2_2_4I2ResidualEntropies_sound (k : Fin 17) : + (CB2_2_4I2ResidualEntropies k).Encloses (homogeneousEntropy + (residualLaw (below (shape 2 2 4)) (fun u => (stageBLaw (shape 2 2 4) u : ℝ)) (stageBPriority (shape 2 2 4)) 2 (fun u a => (littleLaw (shape 2 2 4) u ((stageBPriority (shape 2 2 4)) 2) a : ℝ)) k)) := by + fin_cases k + · exact CB2_2_4I2R0H_sound + · exact CB2_2_4I2R1H_sound + · exact CB2_2_4I2R2H_sound + · exact CB2_2_4I2R3H_sound + · exact CB2_2_4I2R4H_sound + · exact CB2_2_4I2R5H_sound + · exact CB2_2_4I2R6H_sound + · exact CB2_2_4I2R7H_sound + · exact CB2_2_4I2R8H_sound + · exact CB2_2_4I2R9H_sound + · exact CB2_2_4I2R10H_sound + · exact CB2_2_4I2R11H_sound + · exact CB2_2_4I2R12H_sound + · exact CB2_2_4I2R13H_sound + · exact CB2_2_4I2R14H_sound + · exact CB2_2_4I2R15H_sound + · exact CB2_2_4I2R16H_sound +def CB2_2_4I2S0_0_4Value (a : Fin 6) : ℝ := (littleLaw (shape 2 2 4) (shape 0 0 4) ((stageBPriority (shape 2 2 4)) 2) a : ℝ) +def CB2_2_4I2S0_0_4E_5Log : Ball := .exact 0 +lemma CB2_2_4I2S0_0_4E_5Log_sound : CB2_2_4I2S0_0_4E_5Log.Encloses (Real.log (CB2_2_4I2S0_0_4Value (5 : Fin 6))) := by + exact log_exact_one_ball ((B2_2_4Little_sound (shape 0 0 4) ((stageBPriority (shape 2 2 4)) 2)) (5 : Fin 6)) +def CB2_2_4I2S0_0_4E_5 : Ball := ⟨0, 0⟩ +lemma CB2_2_4I2S0_0_4E_5_sound : CB2_2_4I2S0_0_4E_5.Encloses (Foundation.entropyTerm (CB2_2_4I2S0_0_4Value (5 : Fin 6))) := by + exact contains_sound (entropyTerm_ball ((B2_2_4Little_sound (shape 0 0 4) ((stageBPriority (shape 2 2 4)) 2)) (5 : Fin 6)) CB2_2_4I2S0_0_4E_5Log_sound) (by decide +kernel) +def CB2_2_4I2S0_0_4Terms (a : Fin 6) : Ball := + match a.val with + | 5 => ⟨0, 0⟩ + | _ => (.exact 0) +lemma CB2_2_4I2S0_0_4Terms_sound (a : Fin 6) : + (CB2_2_4I2S0_0_4Terms a).Encloses (Foundation.entropyTerm (CB2_2_4I2S0_0_4Value a)) := by + fin_cases a + · exact (entropyTerm_zero_ball ((B2_2_4Little_sound (shape 0 0 4) ((stageBPriority (shape 2 2 4)) 2)) (0 : Fin 6))) + · exact (entropyTerm_zero_ball ((B2_2_4Little_sound (shape 0 0 4) ((stageBPriority (shape 2 2 4)) 2)) (1 : Fin 6))) + · exact (entropyTerm_zero_ball ((B2_2_4Little_sound (shape 0 0 4) ((stageBPriority (shape 2 2 4)) 2)) (2 : Fin 6))) + · exact (entropyTerm_zero_ball ((B2_2_4Little_sound (shape 0 0 4) ((stageBPriority (shape 2 2 4)) 2)) (3 : Fin 6))) + · exact (entropyTerm_zero_ball ((B2_2_4Little_sound (shape 0 0 4) ((stageBPriority (shape 2 2 4)) 2)) (4 : Fin 6))) + · exact CB2_2_4I2S0_0_4E_5_sound +def CB2_2_4I2S0_0_4Entropy : Ball := ⟨0, 0⟩ +lemma CB2_2_4I2S0_0_4Entropy_sound : CB2_2_4I2S0_0_4Entropy.Encloses (Foundation.finiteEntropy CB2_2_4I2S0_0_4Value) := by + exact contains_sound (entropyFin_enclosed 6 CB2_2_4I2S0_0_4Value CB2_2_4I2S0_0_4Terms CB2_2_4I2S0_0_4Terms_sound) (by decide +kernel) +def CB2_2_4I2S0_0_4Mass : Ball := ⟨1, 0⟩ +lemma CB2_2_4I2S0_0_4Mass_sound : CB2_2_4I2S0_0_4Mass.Encloses (∑ a, CB2_2_4I2S0_0_4Value a) := by + exact contains_sound (finSumBall_sound 6 (B2_2_4Little (shape 0 0 4) ((stageBPriority (shape 2 2 4)) 2)) CB2_2_4I2S0_0_4Value (B2_2_4Little_sound (shape 0 0 4) ((stageBPriority (shape 2 2 4)) 2))) (by decide +kernel) +def CB2_2_4I2S0_0_4MassTermLog : Ball := .exact 0 +lemma CB2_2_4I2S0_0_4MassTermLog_sound : CB2_2_4I2S0_0_4MassTermLog.Encloses (Real.log ((∑ a, CB2_2_4I2S0_0_4Value a))) := by + exact log_exact_one_ball (CB2_2_4I2S0_0_4Mass_sound) +def CB2_2_4I2S0_0_4MassTerm : Ball := ⟨0, 0⟩ +lemma CB2_2_4I2S0_0_4MassTerm_sound : CB2_2_4I2S0_0_4MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB2_2_4I2S0_0_4Value a))) := by + exact contains_sound (entropyTerm_ball (CB2_2_4I2S0_0_4Mass_sound) CB2_2_4I2S0_0_4MassTermLog_sound) (by decide +kernel) +def CB2_2_4I2S0_0_4H : Ball := ⟨0, 0⟩ +lemma CB2_2_4I2S0_0_4H_sound : CB2_2_4I2S0_0_4H.Encloses (homogeneousEntropy CB2_2_4I2S0_0_4Value) := by + exact contains_sound (homogeneous_enclosed CB2_2_4I2S0_0_4Value CB2_2_4I2S0_0_4MassTerm_sound CB2_2_4I2S0_0_4Entropy_sound) (by decide +kernel) +def CB2_2_4I2S0_1_3Value (a : Fin 6) : ℝ := (littleLaw (shape 2 2 4) (shape 0 1 3) ((stageBPriority (shape 2 2 4)) 2) a : ℝ) +def CB2_2_4I2S0_1_3E_4Log : Ball := .exact 0 +lemma CB2_2_4I2S0_1_3E_4Log_sound : CB2_2_4I2S0_1_3E_4Log.Encloses (Real.log (CB2_2_4I2S0_1_3Value (4 : Fin 6))) := by + exact log_exact_one_ball ((B2_2_4Little_sound (shape 0 1 3) ((stageBPriority (shape 2 2 4)) 2)) (4 : Fin 6)) +def CB2_2_4I2S0_1_3E_4 : Ball := ⟨0, 0⟩ +lemma CB2_2_4I2S0_1_3E_4_sound : CB2_2_4I2S0_1_3E_4.Encloses (Foundation.entropyTerm (CB2_2_4I2S0_1_3Value (4 : Fin 6))) := by + exact contains_sound (entropyTerm_ball ((B2_2_4Little_sound (shape 0 1 3) ((stageBPriority (shape 2 2 4)) 2)) (4 : Fin 6)) CB2_2_4I2S0_1_3E_4Log_sound) (by decide +kernel) +def CB2_2_4I2S0_1_3Terms (a : Fin 6) : Ball := + match a.val with + | 4 => ⟨0, 0⟩ + | _ => (.exact 0) +lemma CB2_2_4I2S0_1_3Terms_sound (a : Fin 6) : + (CB2_2_4I2S0_1_3Terms a).Encloses (Foundation.entropyTerm (CB2_2_4I2S0_1_3Value a)) := by + fin_cases a + · exact (entropyTerm_zero_ball ((B2_2_4Little_sound (shape 0 1 3) ((stageBPriority (shape 2 2 4)) 2)) (0 : Fin 6))) + · exact (entropyTerm_zero_ball ((B2_2_4Little_sound (shape 0 1 3) ((stageBPriority (shape 2 2 4)) 2)) (1 : Fin 6))) + · exact (entropyTerm_zero_ball ((B2_2_4Little_sound (shape 0 1 3) ((stageBPriority (shape 2 2 4)) 2)) (2 : Fin 6))) + · exact (entropyTerm_zero_ball ((B2_2_4Little_sound (shape 0 1 3) ((stageBPriority (shape 2 2 4)) 2)) (3 : Fin 6))) + · exact CB2_2_4I2S0_1_3E_4_sound + · exact (entropyTerm_zero_ball ((B2_2_4Little_sound (shape 0 1 3) ((stageBPriority (shape 2 2 4)) 2)) (5 : Fin 6))) +def CB2_2_4I2S0_1_3Entropy : Ball := ⟨0, 0⟩ +lemma CB2_2_4I2S0_1_3Entropy_sound : CB2_2_4I2S0_1_3Entropy.Encloses (Foundation.finiteEntropy CB2_2_4I2S0_1_3Value) := by + exact contains_sound (entropyFin_enclosed 6 CB2_2_4I2S0_1_3Value CB2_2_4I2S0_1_3Terms CB2_2_4I2S0_1_3Terms_sound) (by decide +kernel) +def CB2_2_4I2S0_1_3Mass : Ball := ⟨1, 0⟩ +lemma CB2_2_4I2S0_1_3Mass_sound : CB2_2_4I2S0_1_3Mass.Encloses (∑ a, CB2_2_4I2S0_1_3Value a) := by + exact contains_sound (finSumBall_sound 6 (B2_2_4Little (shape 0 1 3) ((stageBPriority (shape 2 2 4)) 2)) CB2_2_4I2S0_1_3Value (B2_2_4Little_sound (shape 0 1 3) ((stageBPriority (shape 2 2 4)) 2))) (by decide +kernel) +def CB2_2_4I2S0_1_3MassTermLog : Ball := .exact 0 +lemma CB2_2_4I2S0_1_3MassTermLog_sound : CB2_2_4I2S0_1_3MassTermLog.Encloses (Real.log ((∑ a, CB2_2_4I2S0_1_3Value a))) := by + exact log_exact_one_ball (CB2_2_4I2S0_1_3Mass_sound) +def CB2_2_4I2S0_1_3MassTerm : Ball := ⟨0, 0⟩ +lemma CB2_2_4I2S0_1_3MassTerm_sound : CB2_2_4I2S0_1_3MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB2_2_4I2S0_1_3Value a))) := by + exact contains_sound (entropyTerm_ball (CB2_2_4I2S0_1_3Mass_sound) CB2_2_4I2S0_1_3MassTermLog_sound) (by decide +kernel) +def CB2_2_4I2S0_1_3H : Ball := ⟨0, 0⟩ +lemma CB2_2_4I2S0_1_3H_sound : CB2_2_4I2S0_1_3H.Encloses (homogeneousEntropy CB2_2_4I2S0_1_3Value) := by + exact contains_sound (homogeneous_enclosed CB2_2_4I2S0_1_3Value CB2_2_4I2S0_1_3MassTerm_sound CB2_2_4I2S0_1_3Entropy_sound) (by decide +kernel) +def CB2_2_4I2S0_2_2Value (a : Fin 6) : ℝ := (littleLaw (shape 2 2 4) (shape 0 2 2) ((stageBPriority (shape 2 2 4)) 2) a : ℝ) +def CB2_2_4I2S0_2_2E_2LogWitness : LogWitness := ⟨-1, 448219, 250000⟩ +def CB2_2_4I2S0_2_2E_2Log : Ball := ⟨(-2186522923289837780427151140763 / 20000000000000000000000000000000), (21175823683 / 50000000000000000000000000000000)⟩ +lemma CB2_2_4I2S0_2_2E_2Log_sound : CB2_2_4I2S0_2_2E_2Log.Encloses (Real.log (CB2_2_4I2S0_2_2Value (2 : Fin 6))) := by + exact checkLog_sound logTwoBall_sound ((B2_2_4Little_sound (shape 0 2 2) ((stageBPriority (shape 2 2 4)) 2)) (2 : Fin 6)) (w := CB2_2_4I2S0_2_2E_2LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB2_2_4I2S0_2_2E_2 : Ball := ⟨(9800411181540478001052772571617 / 100000000000000000000000000000000), (18982813031 / 50000000000000000000000000000000)⟩ +lemma CB2_2_4I2S0_2_2E_2_sound : CB2_2_4I2S0_2_2E_2.Encloses (Foundation.entropyTerm (CB2_2_4I2S0_2_2Value (2 : Fin 6))) := by + exact contains_sound (entropyTerm_ball ((B2_2_4Little_sound (shape 0 2 2) ((stageBPriority (shape 2 2 4)) 2)) (2 : Fin 6)) CB2_2_4I2S0_2_2E_2Log_sound) (by decide +kernel) +def CB2_2_4I2S0_2_2E_3LogWitness : LogWitness := ⟨-4, 51781, 31250⟩ +def CB2_2_4I2S0_2_2E_3Log : Ball := ⟨(-226758481180942422019326103547823 / 100000000000000000000000000000000), (21175823683 / 20000000000000000000000000000000)⟩ +lemma CB2_2_4I2S0_2_2E_3Log_sound : CB2_2_4I2S0_2_2E_3Log.Encloses (Real.log (CB2_2_4I2S0_2_2Value (3 : Fin 6))) := by + exact checkLog_sound logTwoBall_sound ((B2_2_4Little_sound (shape 0 2 2) ((stageBPriority (shape 2 2 4)) 2)) (3 : Fin 6)) (w := CB2_2_4I2S0_2_2E_3LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB2_2_4I2S0_2_2E_3 : Ball := ⟨(1174178091403037955458272496781 / 5000000000000000000000000000000), (5482526631 / 50000000000000000000000000000000)⟩ +lemma CB2_2_4I2S0_2_2E_3_sound : CB2_2_4I2S0_2_2E_3.Encloses (Foundation.entropyTerm (CB2_2_4I2S0_2_2Value (3 : Fin 6))) := by + exact contains_sound (entropyTerm_ball ((B2_2_4Little_sound (shape 0 2 2) ((stageBPriority (shape 2 2 4)) 2)) (3 : Fin 6)) CB2_2_4I2S0_2_2E_3Log_sound) (by decide +kernel) +def CB2_2_4I2S0_2_2Terms (a : Fin 6) : Ball := + match a.val with + | 2 => ⟨(9800411181540478001052772571617 / 100000000000000000000000000000000), (18982813031 / 50000000000000000000000000000000)⟩ + | 3 => ⟨(1174178091403037955458272496781 / 5000000000000000000000000000000), (5482526631 / 50000000000000000000000000000000)⟩ + | _ => (.exact 0) +lemma CB2_2_4I2S0_2_2Terms_sound (a : Fin 6) : + (CB2_2_4I2S0_2_2Terms a).Encloses (Foundation.entropyTerm (CB2_2_4I2S0_2_2Value a)) := by + fin_cases a + · exact (entropyTerm_zero_ball ((B2_2_4Little_sound (shape 0 2 2) ((stageBPriority (shape 2 2 4)) 2)) (0 : Fin 6))) + · exact (entropyTerm_zero_ball ((B2_2_4Little_sound (shape 0 2 2) ((stageBPriority (shape 2 2 4)) 2)) (1 : Fin 6))) + · exact CB2_2_4I2S0_2_2E_2_sound + · exact CB2_2_4I2S0_2_2E_3_sound + · exact (entropyTerm_zero_ball ((B2_2_4Little_sound (shape 0 2 2) ((stageBPriority (shape 2 2 4)) 2)) (4 : Fin 6))) + · exact (entropyTerm_zero_ball ((B2_2_4Little_sound (shape 0 2 2) ((stageBPriority (shape 2 2 4)) 2)) (5 : Fin 6))) +def CB2_2_4I2S0_2_2Entropy : Ball := ⟨(33283973009601237110218222507237 / 100000000000000000000000000000000), (12232669831 / 25000000000000000000000000000000)⟩ +lemma CB2_2_4I2S0_2_2Entropy_sound : CB2_2_4I2S0_2_2Entropy.Encloses (Foundation.finiteEntropy CB2_2_4I2S0_2_2Value) := by + exact contains_sound (entropyFin_enclosed 6 CB2_2_4I2S0_2_2Value CB2_2_4I2S0_2_2Terms CB2_2_4I2S0_2_2Terms_sound) (by decide +kernel) +def CB2_2_4I2S0_2_2Mass : Ball := ⟨1, 0⟩ +lemma CB2_2_4I2S0_2_2Mass_sound : CB2_2_4I2S0_2_2Mass.Encloses (∑ a, CB2_2_4I2S0_2_2Value a) := by + exact contains_sound (finSumBall_sound 6 (B2_2_4Little (shape 0 2 2) ((stageBPriority (shape 2 2 4)) 2)) CB2_2_4I2S0_2_2Value (B2_2_4Little_sound (shape 0 2 2) ((stageBPriority (shape 2 2 4)) 2))) (by decide +kernel) +def CB2_2_4I2S0_2_2MassTermLog : Ball := .exact 0 +lemma CB2_2_4I2S0_2_2MassTermLog_sound : CB2_2_4I2S0_2_2MassTermLog.Encloses (Real.log ((∑ a, CB2_2_4I2S0_2_2Value a))) := by + exact log_exact_one_ball (CB2_2_4I2S0_2_2Mass_sound) +def CB2_2_4I2S0_2_2MassTerm : Ball := ⟨0, 0⟩ +lemma CB2_2_4I2S0_2_2MassTerm_sound : CB2_2_4I2S0_2_2MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB2_2_4I2S0_2_2Value a))) := by + exact contains_sound (entropyTerm_ball (CB2_2_4I2S0_2_2Mass_sound) CB2_2_4I2S0_2_2MassTermLog_sound) (by decide +kernel) +def CB2_2_4I2S0_2_2H : Ball := ⟨(33283973009601237110218222507237 / 100000000000000000000000000000000), (12232669831 / 25000000000000000000000000000000)⟩ +lemma CB2_2_4I2S0_2_2H_sound : CB2_2_4I2S0_2_2H.Encloses (homogeneousEntropy CB2_2_4I2S0_2_2Value) := by + exact contains_sound (homogeneous_enclosed CB2_2_4I2S0_2_2Value CB2_2_4I2S0_2_2MassTerm_sound CB2_2_4I2S0_2_2Entropy_sound) (by decide +kernel) +def CB2_2_4I2S1_0_3Value (a : Fin 6) : ℝ := (littleLaw (shape 2 2 4) (shape 1 0 3) ((stageBPriority (shape 2 2 4)) 2) a : ℝ) +def CB2_2_4I2S1_0_3E_4Log : Ball := .exact 0 +lemma CB2_2_4I2S1_0_3E_4Log_sound : CB2_2_4I2S1_0_3E_4Log.Encloses (Real.log (CB2_2_4I2S1_0_3Value (4 : Fin 6))) := by + exact log_exact_one_ball ((B2_2_4Little_sound (shape 1 0 3) ((stageBPriority (shape 2 2 4)) 2)) (4 : Fin 6)) +def CB2_2_4I2S1_0_3E_4 : Ball := ⟨0, 0⟩ +lemma CB2_2_4I2S1_0_3E_4_sound : CB2_2_4I2S1_0_3E_4.Encloses (Foundation.entropyTerm (CB2_2_4I2S1_0_3Value (4 : Fin 6))) := by + exact contains_sound (entropyTerm_ball ((B2_2_4Little_sound (shape 1 0 3) ((stageBPriority (shape 2 2 4)) 2)) (4 : Fin 6)) CB2_2_4I2S1_0_3E_4Log_sound) (by decide +kernel) +def CB2_2_4I2S1_0_3Terms (a : Fin 6) : Ball := + match a.val with + | 4 => ⟨0, 0⟩ + | _ => (.exact 0) +lemma CB2_2_4I2S1_0_3Terms_sound (a : Fin 6) : + (CB2_2_4I2S1_0_3Terms a).Encloses (Foundation.entropyTerm (CB2_2_4I2S1_0_3Value a)) := by + fin_cases a + · exact (entropyTerm_zero_ball ((B2_2_4Little_sound (shape 1 0 3) ((stageBPriority (shape 2 2 4)) 2)) (0 : Fin 6))) + · exact (entropyTerm_zero_ball ((B2_2_4Little_sound (shape 1 0 3) ((stageBPriority (shape 2 2 4)) 2)) (1 : Fin 6))) + · exact (entropyTerm_zero_ball ((B2_2_4Little_sound (shape 1 0 3) ((stageBPriority (shape 2 2 4)) 2)) (2 : Fin 6))) + · exact (entropyTerm_zero_ball ((B2_2_4Little_sound (shape 1 0 3) ((stageBPriority (shape 2 2 4)) 2)) (3 : Fin 6))) + · exact CB2_2_4I2S1_0_3E_4_sound + · exact (entropyTerm_zero_ball ((B2_2_4Little_sound (shape 1 0 3) ((stageBPriority (shape 2 2 4)) 2)) (5 : Fin 6))) +def CB2_2_4I2S1_0_3Entropy : Ball := ⟨0, 0⟩ +lemma CB2_2_4I2S1_0_3Entropy_sound : CB2_2_4I2S1_0_3Entropy.Encloses (Foundation.finiteEntropy CB2_2_4I2S1_0_3Value) := by + exact contains_sound (entropyFin_enclosed 6 CB2_2_4I2S1_0_3Value CB2_2_4I2S1_0_3Terms CB2_2_4I2S1_0_3Terms_sound) (by decide +kernel) +def CB2_2_4I2S1_0_3Mass : Ball := ⟨1, 0⟩ +lemma CB2_2_4I2S1_0_3Mass_sound : CB2_2_4I2S1_0_3Mass.Encloses (∑ a, CB2_2_4I2S1_0_3Value a) := by + exact contains_sound (finSumBall_sound 6 (B2_2_4Little (shape 1 0 3) ((stageBPriority (shape 2 2 4)) 2)) CB2_2_4I2S1_0_3Value (B2_2_4Little_sound (shape 1 0 3) ((stageBPriority (shape 2 2 4)) 2))) (by decide +kernel) +def CB2_2_4I2S1_0_3MassTermLog : Ball := .exact 0 +lemma CB2_2_4I2S1_0_3MassTermLog_sound : CB2_2_4I2S1_0_3MassTermLog.Encloses (Real.log ((∑ a, CB2_2_4I2S1_0_3Value a))) := by + exact log_exact_one_ball (CB2_2_4I2S1_0_3Mass_sound) +def CB2_2_4I2S1_0_3MassTerm : Ball := ⟨0, 0⟩ +lemma CB2_2_4I2S1_0_3MassTerm_sound : CB2_2_4I2S1_0_3MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB2_2_4I2S1_0_3Value a))) := by + exact contains_sound (entropyTerm_ball (CB2_2_4I2S1_0_3Mass_sound) CB2_2_4I2S1_0_3MassTermLog_sound) (by decide +kernel) +def CB2_2_4I2S1_0_3H : Ball := ⟨0, 0⟩ +lemma CB2_2_4I2S1_0_3H_sound : CB2_2_4I2S1_0_3H.Encloses (homogeneousEntropy CB2_2_4I2S1_0_3Value) := by + exact contains_sound (homogeneous_enclosed CB2_2_4I2S1_0_3Value CB2_2_4I2S1_0_3MassTerm_sound CB2_2_4I2S1_0_3Entropy_sound) (by decide +kernel) +def CB2_2_4I2S2_0_2Value (a : Fin 6) : ℝ := (littleLaw (shape 2 2 4) (shape 2 0 2) ((stageBPriority (shape 2 2 4)) 2) a : ℝ) +def CB2_2_4I2S2_0_2E_2LogWitness : LogWitness := ⟨-1, 896423, 500000⟩ +def CB2_2_4I2S2_0_2E_2Log : Ball := ⟨(-2733571979905550299613262420469 / 25000000000000000000000000000000), (8470329473 / 20000000000000000000000000000000)⟩ +lemma CB2_2_4I2S2_0_2E_2Log_sound : CB2_2_4I2S2_0_2E_2Log.Encloses (Real.log (CB2_2_4I2S2_0_2Value (2 : Fin 6))) := by + exact checkLog_sound logTwoBall_sound ((B2_2_4Little_sound (shape 2 0 2) ((stageBPriority (shape 2 2 4)) 2)) (2 : Fin 6)) (w := CB2_2_4I2S2_0_2E_2LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB2_2_4I2S2_0_2E_2 : Ball := ⟨(306304599367859139528777442343 / 3125000000000000000000000000000), (37964990787 / 100000000000000000000000000000000)⟩ +lemma CB2_2_4I2S2_0_2E_2_sound : CB2_2_4I2S2_0_2E_2.Encloses (Foundation.entropyTerm (CB2_2_4I2S2_0_2Value (2 : Fin 6))) := by + exact contains_sound (entropyTerm_ball ((B2_2_4Little_sound (shape 2 0 2) ((stageBPriority (shape 2 2 4)) 2)) (2 : Fin 6)) CB2_2_4I2S2_0_2E_2Log_sound) (by decide +kernel) +def CB2_2_4I2S2_0_2E_3LogWitness : LogWitness := ⟨-4, 103577, 62500⟩ +def CB2_2_4I2S2_0_2E_3Log : Ball := ⟨(-2834299976907655511632457381399 / 1250000000000000000000000000000), (52939559207 / 50000000000000000000000000000000)⟩ +lemma CB2_2_4I2S2_0_2E_3Log_sound : CB2_2_4I2S2_0_2E_3Log.Encloses (Real.log (CB2_2_4I2S2_0_2Value (3 : Fin 6))) := by + exact checkLog_sound logTwoBall_sound ((B2_2_4Little_sound (shape 2 0 2) ((stageBPriority (shape 2 2 4)) 2)) (3 : Fin 6)) (w := CB2_2_4I2S2_0_2E_3LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB2_2_4I2S2_0_2E_3 : Ball := ⟨(23485463096653138794268403055453 / 100000000000000000000000000000000), (10966641449 / 100000000000000000000000000000000)⟩ +lemma CB2_2_4I2S2_0_2E_3_sound : CB2_2_4I2S2_0_2E_3.Encloses (Foundation.entropyTerm (CB2_2_4I2S2_0_2Value (3 : Fin 6))) := by + exact contains_sound (entropyTerm_ball ((B2_2_4Little_sound (shape 2 0 2) ((stageBPriority (shape 2 2 4)) 2)) (3 : Fin 6)) CB2_2_4I2S2_0_2E_3Log_sound) (by decide +kernel) +def CB2_2_4I2S2_0_2Terms (a : Fin 6) : Ball := + match a.val with + | 2 => ⟨(306304599367859139528777442343 / 3125000000000000000000000000000), (37964990787 / 100000000000000000000000000000000)⟩ + | 3 => ⟨(23485463096653138794268403055453 / 100000000000000000000000000000000), (10966641449 / 100000000000000000000000000000000)⟩ + | _ => (.exact 0) +lemma CB2_2_4I2S2_0_2Terms_sound (a : Fin 6) : + (CB2_2_4I2S2_0_2Terms a).Encloses (Foundation.entropyTerm (CB2_2_4I2S2_0_2Value a)) := by + fin_cases a + · exact (entropyTerm_zero_ball ((B2_2_4Little_sound (shape 2 0 2) ((stageBPriority (shape 2 2 4)) 2)) (0 : Fin 6))) + · exact (entropyTerm_zero_ball ((B2_2_4Little_sound (shape 2 0 2) ((stageBPriority (shape 2 2 4)) 2)) (1 : Fin 6))) + · exact CB2_2_4I2S2_0_2E_2_sound + · exact CB2_2_4I2S2_0_2E_3_sound + · exact (entropyTerm_zero_ball ((B2_2_4Little_sound (shape 2 0 2) ((stageBPriority (shape 2 2 4)) 2)) (4 : Fin 6))) + · exact (entropyTerm_zero_ball ((B2_2_4Little_sound (shape 2 0 2) ((stageBPriority (shape 2 2 4)) 2)) (5 : Fin 6))) +def CB2_2_4I2S2_0_2Entropy : Ball := ⟨(33287210276424631259189281210429 / 100000000000000000000000000000000), (12232908059 / 25000000000000000000000000000000)⟩ +lemma CB2_2_4I2S2_0_2Entropy_sound : CB2_2_4I2S2_0_2Entropy.Encloses (Foundation.finiteEntropy CB2_2_4I2S2_0_2Value) := by + exact contains_sound (entropyFin_enclosed 6 CB2_2_4I2S2_0_2Value CB2_2_4I2S2_0_2Terms CB2_2_4I2S2_0_2Terms_sound) (by decide +kernel) +def CB2_2_4I2S2_0_2Mass : Ball := ⟨1, 0⟩ +lemma CB2_2_4I2S2_0_2Mass_sound : CB2_2_4I2S2_0_2Mass.Encloses (∑ a, CB2_2_4I2S2_0_2Value a) := by + exact contains_sound (finSumBall_sound 6 (B2_2_4Little (shape 2 0 2) ((stageBPriority (shape 2 2 4)) 2)) CB2_2_4I2S2_0_2Value (B2_2_4Little_sound (shape 2 0 2) ((stageBPriority (shape 2 2 4)) 2))) (by decide +kernel) +def CB2_2_4I2S2_0_2MassTermLog : Ball := .exact 0 +lemma CB2_2_4I2S2_0_2MassTermLog_sound : CB2_2_4I2S2_0_2MassTermLog.Encloses (Real.log ((∑ a, CB2_2_4I2S2_0_2Value a))) := by + exact log_exact_one_ball (CB2_2_4I2S2_0_2Mass_sound) +def CB2_2_4I2S2_0_2MassTerm : Ball := ⟨0, 0⟩ +lemma CB2_2_4I2S2_0_2MassTerm_sound : CB2_2_4I2S2_0_2MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB2_2_4I2S2_0_2Value a))) := by + exact contains_sound (entropyTerm_ball (CB2_2_4I2S2_0_2Mass_sound) CB2_2_4I2S2_0_2MassTermLog_sound) (by decide +kernel) +def CB2_2_4I2S2_0_2H : Ball := ⟨(33287210276424631259189281210429 / 100000000000000000000000000000000), (12232908059 / 25000000000000000000000000000000)⟩ +lemma CB2_2_4I2S2_0_2H_sound : CB2_2_4I2S2_0_2H.Encloses (homogeneousEntropy CB2_2_4I2S2_0_2Value) := by + exact contains_sound (homogeneous_enclosed CB2_2_4I2S2_0_2Value CB2_2_4I2S2_0_2MassTerm_sound CB2_2_4I2S2_0_2Entropy_sound) (by decide +kernel) +def CB2_2_4I2Singles (s : Shape) : Ball := + match s 0, s 1, s 2 with + | 0, 0, 4 => CB2_2_4I2S0_0_4H + | 0, 1, 3 => CB2_2_4I2S0_1_3H + | 0, 2, 2 => CB2_2_4I2S0_2_2H + | 1, 0, 3 => CB2_2_4I2S1_0_3H + | 2, 0, 2 => CB2_2_4I2S2_0_2H + | _, _, _ => (.exact 0) +lemma CB2_2_4I2Singles_sound (u : Shape) (hu : u ∈ below (shape 2 2 4)) + (hd : designated (stageBPriority (shape 2 2 4)) 2 u) : + (CB2_2_4I2Singles u).Encloses (homogeneousEntropy ((fun u a => (littleLaw (shape 2 2 4) u ((stageBPriority (shape 2 2 4)) 2) a : ℝ)) u)) := by + rw [B2_2_4_below] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl + · exact CB2_2_4I2S0_0_4H_sound + · exact CB2_2_4I2S0_1_3H_sound + · exact CB2_2_4I2S0_2_2H_sound + · exact CB2_2_4I2S1_0_3H_sound + · exact (show ¬ designated (stageBPriority (shape 2 2 4)) 2 (shape 1 1 2) by decide +kernel) hd |>.elim + · exact (show ¬ designated (stageBPriority (shape 2 2 4)) 2 (shape 1 2 1) by decide +kernel) hd |>.elim + · exact CB2_2_4I2S2_0_2H_sound + · exact (show ¬ designated (stageBPriority (shape 2 2 4)) 2 (shape 2 1 1) by decide +kernel) hd |>.elim + · exact (show ¬ designated (stageBPriority (shape 2 2 4)) 2 (shape 2 2 0) by decide +kernel) hd |>.elim +def CB2_2_4I2Singleton : Ball := ⟨(9756358821863553579066193634899 / 100000000000000000000000000000000), (179277989 / 1250000000000000000000000000000)⟩ +lemma CB2_2_4I2Singleton_sound : CB2_2_4I2Singleton.Encloses + (singletonEntropy (below (shape 2 2 4)) (fun u => (stageBLaw (shape 2 2 4) u : ℝ)) (stageBPriority (shape 2 2 4)) 2 (fun u a => (littleLaw (shape 2 2 4) u ((stageBPriority (shape 2 2 4)) 2) a : ℝ))) := by + exact contains_sound (singletonBall_sound (below (shape 2 2 4)) B2_2_4Law (fun u => (stageBLaw (shape 2 2 4) u : ℝ)) (stageBPriority (shape 2 2 4)) 2 + CB2_2_4I2Singles (fun u a => (littleLaw (shape 2 2 4) u ((stageBPriority (shape 2 2 4)) 2) a : ℝ)) (fun u _ => B2_2_4Law_sound u) CB2_2_4I2Singles_sound) (by decide +kernel) +def CB2_2_4I2Group : Ball := ⟨(6311542467878183543153118224789 / 50000000000000000000000000000000), (78237986549 / 100000000000000000000000000000000)⟩ +lemma CB2_2_4I2Group_sound : CB2_2_4I2Group.Encloses + (groupedEntropy (below (shape 2 2 4)) (fun u => (stageBLaw (shape 2 2 4) u : ℝ)) (stageBPriority (shape 2 2 4)) 2 (fun u a => (littleLaw (shape 2 2 4) u ((stageBPriority (shape 2 2 4)) 2) a : ℝ))) := by + exact contains_sound (Ball.add_sound CB2_2_4I2Singleton_sound + (finSumBall_sound 17 CB2_2_4I2ResidualEntropies _ CB2_2_4I2ResidualEntropies_sound)) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CB2_2_4I2H : Ball := ⟨(11443550796086660514496159952987 / 20000000000000000000000000000000), (58913177607 / 25000000000000000000000000000000)⟩ +lemma CB2_2_4I2_sound : CB2_2_4I2H.Encloses (stageBCapacity (shape 2 2 4) 2) := by + have hb := contains_sound (Ball.add_sound CB2_2_4I2PairH_sound + (Ball.neg_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) CB2_2_4I2Group_sound))) + (show contains (.add CB2_2_4I2PairH (.neg (.mul (.exact 2) CB2_2_4I2Group))) CB2_2_4I2H = true by decide +kernel) + unfold CB2_2_4I2PairValue at hb + simpa only [stageBCapacity, nativeCapacity, + show (2 : Fin 3) ≠ 0 by decide, ite_false, sub_eq_add_neg] using hb + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/CapacityB/CapB2_3_3I0.lean b/lean/OAI/LinearAlgebra/MatrixFields/CapacityB/CapB2_3_3I0.lean new file mode 100644 index 0000000000000000000000000000000000000000..5de75a886813d593f01e8cd9a7ce72d10414cd66 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/CapacityB/CapB2_3_3I0.lean @@ -0,0 +1,75 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Certificates.SplitB2_3_3 + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CB2_3_3I0Value (a : Fin 17) : ℝ := marginal (below (shape 2 3 3)) (fun u => (stageBLaw (shape 2 3 3) u : ℝ)) ((stageBPriority (shape 2 3 3)) 0) a +def CB2_3_3I0Raw (a : Fin 17) : Ball := marginalBall (below (shape 2 3 3)) B2_3_3Law ((stageBPriority (shape 2 3 3)) 0) a +lemma CB2_3_3I0Raw_sound (a : Fin 17) : + (CB2_3_3I0Raw a).Encloses (CB2_3_3I0Value a) := by + exact marginalBall_sound (below (shape 2 3 3)) B2_3_3Law (fun u => (stageBLaw (shape 2 3 3) u : ℝ)) (fun u _ => B2_3_3Law_sound u) ((stageBPriority (shape 2 3 3)) 0) a +def CB2_3_3I0Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(760593062115024579018426140229 / 1562500000000000000000000000000), (37 / 100000000000000000000000000000000)⟩ ⟨(17522698923159325737403422183301 / 50000000000000000000000000000000), (15461937227 / 50000000000000000000000000000000)⟩ ⟨(-35997195387638027415224768226347 / 50000000000000000000000000000000), (508219769 / 800000000000000000000000000000)⟩ ⟨-2, 760593062115024579018426140229, 390625000000000000000000000000⟩, + .log ⟨(20656937884975420981573859771 / 1562500000000000000000000000000), (1 / 20000000000000000000000000000000)⟩ ⟨(1143830148399399966764789719769 / 20000000000000000000000000000000), (2239629721 / 100000000000000000000000000000000)⟩ ⟨(-432599114357115427902291684210243 / 100000000000000000000000000000000), (84703294921 / 50000000000000000000000000000000)⟩ ⟨-7, 20656937884975420981573859771, 12207031250000000000000000000⟩] +lemma CB2_3_3I0Certificates_valid : + CB2_3_3I0Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB2_3_3I0CertificateIndex (a : Fin 17) : ℕ := + match a.val with + | 1 => 1 + | 2 => 1 + | 3 => 2 + | 0 => 2 + | _ => 0 +def CB2_3_3I0P (a : Fin 17) : Ball := + (CompactCertificate.entropyLookup CB2_3_3I0Certificates (CB2_3_3I0CertificateIndex a)).input +lemma CB2_3_3I0P_check : ∀ a : Fin 17, contains (CB2_3_3I0Raw a) (CB2_3_3I0P a) = true := by + decide +kernel +lemma CB2_3_3I0P_sound (a : Fin 17) : + (CB2_3_3I0P a).Encloses (CB2_3_3I0Value a) := + contains_sound (CB2_3_3I0Raw_sound a) (CB2_3_3I0P_check a) +def CB2_3_3I0Terms (a : Fin 17) : Ball := + (CompactCertificate.entropyLookup CB2_3_3I0Certificates (CB2_3_3I0CertificateIndex a)).output +lemma CB2_3_3I0Terms_sound (a : Fin 17) : + (CB2_3_3I0Terms a).Encloses (Foundation.entropyTerm (CB2_3_3I0Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB2_3_3I0Certificates_valid + (CB2_3_3I0CertificateIndex a) (CB2_3_3I0P_sound a) +def CB2_3_3I0Entropy : Ball := ⟨(40764548588315651308630792965447 / 50000000000000000000000000000000), (1326540167 / 2000000000000000000000000000000)⟩ +lemma CB2_3_3I0Entropy_sound : CB2_3_3I0Entropy.Encloses (Foundation.finiteEntropy CB2_3_3I0Value) := by + exact contains_sound (entropyFin_enclosed 17 CB2_3_3I0Value CB2_3_3I0Terms CB2_3_3I0Terms_sound) (by decide +kernel) +def CB2_3_3I0Mass : Ball := ⟨1, (21 / 25000000000000000000000000000000)⟩ +lemma CB2_3_3I0Mass_sound : CB2_3_3I0Mass.Encloses (∑ a, CB2_3_3I0Value a) := by + exact contains_sound (finSumBall_sound 17 CB2_3_3I0P CB2_3_3I0Value CB2_3_3I0P_sound) (by decide +kernel) +def CB2_3_3I0MassTermLogWitness : LogWitness := ⟨0, 1, 1⟩ +def CB2_3_3I0MassTermLog : Ball := ⟨0, (10587911883 / 50000000000000000000000000000000)⟩ +lemma CB2_3_3I0MassTermLog_sound : CB2_3_3I0MassTermLog.Encloses (Real.log ((∑ a, CB2_3_3I0Value a))) := by + exact checkLog_sound logTwoBall_sound (CB2_3_3I0Mass_sound) (w := CB2_3_3I0MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB2_3_3I0MassTerm : Ball := ⟨0, (21175823767 / 100000000000000000000000000000000)⟩ +lemma CB2_3_3I0MassTerm_sound : CB2_3_3I0MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB2_3_3I0Value a))) := by + exact contains_sound (entropyTerm_ball (CB2_3_3I0Mass_sound) CB2_3_3I0MassTermLog_sound) (by decide +kernel) +def CB2_3_3I0H : Ball := ⟨(40764548588315651308630792965447 / 50000000000000000000000000000000), (87502832117 / 100000000000000000000000000000000)⟩ +lemma CB2_3_3I0H_sound : CB2_3_3I0H.Encloses (homogeneousEntropy CB2_3_3I0Value) := by + exact contains_sound (homogeneous_enclosed CB2_3_3I0Value CB2_3_3I0MassTerm_sound CB2_3_3I0Entropy_sound) (by decide +kernel) +lemma CB2_3_3I0_sound : CB2_3_3I0H.Encloses (stageBCapacity (shape 2 3 3) 0) := by + exact CB2_3_3I0H_sound + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/CapacityB/CapB2_3_3I1.lean b/lean/OAI/LinearAlgebra/MatrixFields/CapacityB/CapB2_3_3I1.lean new file mode 100644 index 0000000000000000000000000000000000000000..066cf6401b1d7a8f3e5b76b624d33560782f089c --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/CapacityB/CapB2_3_3I1.lean @@ -0,0 +1,930 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Certificates.LittleB2_3_3 + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CB2_3_3I1PairValue (a : PairSlot) : ℝ := pairLaw (below (shape 2 3 3)) (shape 2 3 3) (fun u => (stageBLaw (shape 2 3 3) u : ℝ)) (fun u a => (littleLaw (shape 2 3 3) u ((stageBPriority (shape 2 3 3)) 1) a : ℝ)) a +def CB2_3_3I1PairRaw (a : PairSlot) : Ball := pairLawBall (below (shape 2 3 3)) (shape 2 3 3) B2_3_3Law (fun u => B2_3_3Little u ((stageBPriority (shape 2 3 3)) 1)) a +lemma CB2_3_3I1PairRaw_sound (a : PairSlot) : + (CB2_3_3I1PairRaw a).Encloses (CB2_3_3I1PairValue a) := by + exact pairLawBall_sound_on (below (shape 2 3 3)) (shape 2 3 3) B2_3_3Law (fun u => (stageBLaw (shape 2 3 3) u : ℝ)) (fun u => B2_3_3Little u ((stageBPriority (shape 2 3 3)) 1)) (fun u a => (littleLaw (shape 2 3 3) u ((stageBPriority (shape 2 3 3)) 1) a : ℝ)) (fun u _ => B2_3_3Law_sound u) (fun u _ a => B2_3_3Little_sound u ((stageBPriority (shape 2 3 3)) 1) a) (fun u _ a => B2_3_3Little_sound (complement (shape 2 3 3) u) ((stageBPriority (shape 2 3 3)) 1) a) a +def CB2_3_3I1PairCertificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(8811526653339407816212002016803 / 50000000000000000000000000000000), (27 / 100000000000000000000000000000000)⟩ ⟨(30592956046864205890612492831741 / 100000000000000000000000000000000), (14927306857 / 100000000000000000000000000000000)⟩ ⟨(-86798114703738749356353730303813 / 50000000000000000000000000000000), (16940658977 / 20000000000000000000000000000000)⟩ ⟨-3, 8811526653339407816212002016803, 6250000000000000000000000000000⟩, + .log ⟨(173415754401812546184280998437 / 20000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ ⟨(2058356405115266027202079697761 / 50000000000000000000000000000000), (367222147 / 25000000000000000000000000000000)⟩ ⟨(-474779563648169218480291092627497 / 100000000000000000000000000000000), (84703294847 / 50000000000000000000000000000000)⟩ ⟨-7, 173415754401812546184280998437, 156250000000000000000000000000⟩, + .log ⟨(31509867921312121636654590974209 / 50000000000000000000000000000000), (7 / 25000000000000000000000000000000)⟩ ⟨(3637201710012703587369819919699 / 12500000000000000000000000000000), (1668118521 / 6250000000000000000000000000000)⟩ ⟨(-23086112065564282769183517332301 / 50000000000000000000000000000000), (4235164741 / 10000000000000000000000000000000)⟩ ⟨-1, 31509867921312121636654590974209, 25000000000000000000000000000000⟩] +lemma CB2_3_3I1PairCertificates_valid : + CB2_3_3I1PairCertificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB2_3_3I1PairCertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 0, 2 => 1 + | 0, 3 => 2 + | 1, 1 => 3 + | 2, 0 => 1 + | 3, 0 => 2 + | _, _ => 0 +def CB2_3_3I1PairP (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CB2_3_3I1PairCertificates (CB2_3_3I1PairCertificateIndex a)).input +lemma CB2_3_3I1PairP_check : ∀ a : PairSlot, contains (CB2_3_3I1PairRaw a) (CB2_3_3I1PairP a) = true := by + decide +kernel +lemma CB2_3_3I1PairP_sound (a : PairSlot) : + (CB2_3_3I1PairP a).Encloses (CB2_3_3I1PairValue a) := + contains_sound (CB2_3_3I1PairRaw_sound a) (CB2_3_3I1PairP_check a) +def CB2_3_3I1PairTerms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CB2_3_3I1PairCertificates (CB2_3_3I1PairCertificateIndex a)).output +lemma CB2_3_3I1PairTerms_sound (a : PairSlot) : + (CB2_3_3I1PairTerms a).Encloses (Foundation.entropyTerm (CB2_3_3I1PairValue a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB2_3_3I1PairCertificates_valid + (CB2_3_3I1PairCertificateIndex a) (CB2_3_3I1PairP_sound a) +def CB2_3_3I1PairEntropy : Ball := ⟨(49258475697145552294495931906059 / 50000000000000000000000000000000), (29741143613 / 50000000000000000000000000000000)⟩ +lemma CB2_3_3I1PairEntropy_sound : CB2_3_3I1PairEntropy.Encloses (Foundation.finiteEntropy CB2_3_3I1PairValue) := by + exact contains_sound (entropyPair_enclosed CB2_3_3I1PairValue CB2_3_3I1PairTerms CB2_3_3I1PairTerms_sound) (by decide +kernel) +def CB2_3_3I1PairMass : Ball := ⟨1, (43 / 50000000000000000000000000000000)⟩ +lemma CB2_3_3I1PairMass_sound : CB2_3_3I1PairMass.Encloses (∑ a, CB2_3_3I1PairValue a) := by + exact contains_sound (pairSumBall_sound CB2_3_3I1PairP CB2_3_3I1PairValue CB2_3_3I1PairP_sound) (by decide +kernel) +def CB2_3_3I1PairMassTermLogWitness : LogWitness := ⟨0, 1, 1⟩ +def CB2_3_3I1PairMassTermLog : Ball := ⟨0, (2646977971 / 12500000000000000000000000000000)⟩ +lemma CB2_3_3I1PairMassTermLog_sound : CB2_3_3I1PairMassTermLog.Encloses (Real.log ((∑ a, CB2_3_3I1PairValue a))) := by + exact checkLog_sound logTwoBall_sound (CB2_3_3I1PairMass_sound) (w := CB2_3_3I1PairMassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB2_3_3I1PairMassTerm : Ball := ⟨0, (21175823769 / 100000000000000000000000000000000)⟩ +lemma CB2_3_3I1PairMassTerm_sound : CB2_3_3I1PairMassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB2_3_3I1PairValue a))) := by + exact contains_sound (entropyTerm_ball (CB2_3_3I1PairMass_sound) CB2_3_3I1PairMassTermLog_sound) (by decide +kernel) +def CB2_3_3I1PairH : Ball := ⟨(49258475697145552294495931906059 / 50000000000000000000000000000000), (16131622199 / 20000000000000000000000000000000)⟩ +lemma CB2_3_3I1PairH_sound : CB2_3_3I1PairH.Encloses (homogeneousEntropy CB2_3_3I1PairValue) := by + exact contains_sound (homogeneous_enclosed CB2_3_3I1PairValue CB2_3_3I1PairMassTerm_sound CB2_3_3I1PairEntropy_sound) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CB2_3_3I1R0Value (a : Fin 6) : ℝ := residualLaw (below (shape 2 3 3)) (fun u => (stageBLaw (shape 2 3 3) u : ℝ)) (stageBPriority (shape 2 3 3)) 1 (fun u a => (littleLaw (shape 2 3 3) u ((stageBPriority (shape 2 3 3)) 1) a : ℝ)) 0 a +def CB2_3_3I1R0Raw (a : Fin 6) : Ball := residualBall (below (shape 2 3 3)) B2_3_3Law (stageBPriority (shape 2 3 3)) 1 (fun u => B2_3_3Little u ((stageBPriority (shape 2 3 3)) 1)) 0 a +lemma CB2_3_3I1R0Raw_sound (a : Fin 6) : + (CB2_3_3I1R0Raw a).Encloses (CB2_3_3I1R0Value a) := by + exact residualBall_sound_on (below (shape 2 3 3)) B2_3_3Law (fun u => (stageBLaw (shape 2 3 3) u : ℝ)) (stageBPriority (shape 2 3 3)) 1 (fun u => B2_3_3Little u ((stageBPriority (shape 2 3 3)) 1)) (fun u a => (littleLaw (shape 2 3 3) u ((stageBPriority (shape 2 3 3)) 1) a : ℝ)) (fun u _ => B2_3_3Law_sound u) (fun u _ a => B2_3_3Little_sound u ((stageBPriority (shape 2 3 3)) 1) a) 0 a +def CB2_3_3I1R0Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(18490132078687878363345409025791 / 100000000000000000000000000000000), (7 / 25000000000000000000000000000000)⟩ ⟨(31210104061251053825671556162407 / 100000000000000000000000000000000), (15661751147 / 100000000000000000000000000000000)⟩ ⟨(-8439664986824103647164745978359 / 5000000000000000000000000000000), (84703294883 / 100000000000000000000000000000000)⟩ ⟨-3, 18490132078687878363345409025791, 12500000000000000000000000000000⟩] +lemma CB2_3_3I1R0Certificates_valid : + CB2_3_3I1R0Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB2_3_3I1R0CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | 0 => 1 + | _ => 0 +def CB2_3_3I1R0P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_3_3I1R0Certificates (CB2_3_3I1R0CertificateIndex a)).input +lemma CB2_3_3I1R0P_check : ∀ a : Fin 6, contains (CB2_3_3I1R0Raw a) (CB2_3_3I1R0P a) = true := by + decide +kernel +lemma CB2_3_3I1R0P_sound (a : Fin 6) : + (CB2_3_3I1R0P a).Encloses (CB2_3_3I1R0Value a) := + contains_sound (CB2_3_3I1R0Raw_sound a) (CB2_3_3I1R0P_check a) +def CB2_3_3I1R0Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_3_3I1R0Certificates (CB2_3_3I1R0CertificateIndex a)).output +lemma CB2_3_3I1R0Terms_sound (a : Fin 6) : + (CB2_3_3I1R0Terms a).Encloses (Foundation.entropyTerm (CB2_3_3I1R0Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB2_3_3I1R0Certificates_valid + (CB2_3_3I1R0CertificateIndex a) (CB2_3_3I1R0P_sound a) +def CB2_3_3I1R0Entropy : Ball := ⟨(31210104061251053825671556162407 / 100000000000000000000000000000000), (15661751147 / 100000000000000000000000000000000)⟩ +lemma CB2_3_3I1R0Entropy_sound : CB2_3_3I1R0Entropy.Encloses (Foundation.finiteEntropy CB2_3_3I1R0Value) := by + exact contains_sound (entropyFin_enclosed 6 CB2_3_3I1R0Value CB2_3_3I1R0Terms CB2_3_3I1R0Terms_sound) (by decide +kernel) +def CB2_3_3I1R0Mass : Ball := ⟨(18490132078687878363345409025791 / 100000000000000000000000000000000), (7 / 25000000000000000000000000000000)⟩ +lemma CB2_3_3I1R0Mass_sound : CB2_3_3I1R0Mass.Encloses (∑ a, CB2_3_3I1R0Value a) := by + exact contains_sound (finSumBall_sound 6 CB2_3_3I1R0P CB2_3_3I1R0Value CB2_3_3I1R0P_sound) (by decide +kernel) +def CB2_3_3I1R0MassTermLogWitness : LogWitness := ⟨-3, 18490132078687878363345409025791, 12500000000000000000000000000000⟩ +def CB2_3_3I1R0MassTermLog : Ball := ⟨(-8439664986824103647164745978359 / 5000000000000000000000000000000), (84703294883 / 100000000000000000000000000000000)⟩ +lemma CB2_3_3I1R0MassTermLog_sound : CB2_3_3I1R0MassTermLog.Encloses (Real.log ((∑ a, CB2_3_3I1R0Value a))) := by + exact checkLog_sound logTwoBall_sound (CB2_3_3I1R0Mass_sound) (w := CB2_3_3I1R0MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB2_3_3I1R0MassTerm : Ball := ⟨(31210104061251053825671556162407 / 100000000000000000000000000000000), (15661751147 / 100000000000000000000000000000000)⟩ +lemma CB2_3_3I1R0MassTerm_sound : CB2_3_3I1R0MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB2_3_3I1R0Value a))) := by + exact contains_sound (entropyTerm_ball (CB2_3_3I1R0Mass_sound) CB2_3_3I1R0MassTermLog_sound) (by decide +kernel) +def CB2_3_3I1R0H : Ball := ⟨0, (15661751147 / 50000000000000000000000000000000)⟩ +lemma CB2_3_3I1R0H_sound : CB2_3_3I1R0H.Encloses (homogeneousEntropy CB2_3_3I1R0Value) := by + exact contains_sound (homogeneous_enclosed CB2_3_3I1R0Value CB2_3_3I1R0MassTerm_sound CB2_3_3I1R0Entropy_sound) (by decide +kernel) +def CB2_3_3I1R1Value (a : Fin 6) : ℝ := residualLaw (below (shape 2 3 3)) (fun u => (stageBLaw (shape 2 3 3) u : ℝ)) (stageBPriority (shape 2 3 3)) 1 (fun u a => (littleLaw (shape 2 3 3) u ((stageBPriority (shape 2 3 3)) 1) a : ℝ)) 1 a +def CB2_3_3I1R1Raw (a : Fin 6) : Ball := residualBall (below (shape 2 3 3)) B2_3_3Law (stageBPriority (shape 2 3 3)) 1 (fun u => B2_3_3Little u ((stageBPriority (shape 2 3 3)) 1)) 1 a +lemma CB2_3_3I1R1Raw_sound (a : Fin 6) : + (CB2_3_3I1R1Raw a).Encloses (CB2_3_3I1R1Value a) := by + exact residualBall_sound_on (below (shape 2 3 3)) B2_3_3Law (fun u => (stageBLaw (shape 2 3 3) u : ℝ)) (stageBPriority (shape 2 3 3)) 1 (fun u => B2_3_3Little u ((stageBPriority (shape 2 3 3)) 1)) (fun u a => (littleLaw (shape 2 3 3) u ((stageBPriority (shape 2 3 3)) 1) a : ℝ)) (fun u _ => B2_3_3Law_sound u) (fun u _ a => B2_3_3Little_sound u ((stageBPriority (shape 2 3 3)) 1) a) 1 a +def CB2_3_3I1R1Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(7857441264699229683296977815819 / 12500000000000000000000000000000), (27 / 100000000000000000000000000000000)⟩ ⟨(5836729010460201172294134918613 / 20000000000000000000000000000000), (6655511643 / 25000000000000000000000000000000)⟩ ⟨(-23213381485437445740208763534969 / 50000000000000000000000000000000), (42351647409 / 100000000000000000000000000000000)⟩ ⟨-1, 7857441264699229683296977815819, 6250000000000000000000000000000⟩] +lemma CB2_3_3I1R1Certificates_valid : + CB2_3_3I1R1Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB2_3_3I1R1CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | 1 => 1 + | _ => 0 +def CB2_3_3I1R1P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_3_3I1R1Certificates (CB2_3_3I1R1CertificateIndex a)).input +lemma CB2_3_3I1R1P_check : ∀ a : Fin 6, contains (CB2_3_3I1R1Raw a) (CB2_3_3I1R1P a) = true := by + decide +kernel +lemma CB2_3_3I1R1P_sound (a : Fin 6) : + (CB2_3_3I1R1P a).Encloses (CB2_3_3I1R1Value a) := + contains_sound (CB2_3_3I1R1Raw_sound a) (CB2_3_3I1R1P_check a) +def CB2_3_3I1R1Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_3_3I1R1Certificates (CB2_3_3I1R1CertificateIndex a)).output +lemma CB2_3_3I1R1Terms_sound (a : Fin 6) : + (CB2_3_3I1R1Terms a).Encloses (Foundation.entropyTerm (CB2_3_3I1R1Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB2_3_3I1R1Certificates_valid + (CB2_3_3I1R1CertificateIndex a) (CB2_3_3I1R1P_sound a) +def CB2_3_3I1R1Entropy : Ball := ⟨(5836729010460201172294134918613 / 20000000000000000000000000000000), (6655511643 / 25000000000000000000000000000000)⟩ +lemma CB2_3_3I1R1Entropy_sound : CB2_3_3I1R1Entropy.Encloses (Foundation.finiteEntropy CB2_3_3I1R1Value) := by + exact contains_sound (entropyFin_enclosed 6 CB2_3_3I1R1Value CB2_3_3I1R1Terms CB2_3_3I1R1Terms_sound) (by decide +kernel) +def CB2_3_3I1R1Mass : Ball := ⟨(7857441264699229683296977815819 / 12500000000000000000000000000000), (27 / 100000000000000000000000000000000)⟩ +lemma CB2_3_3I1R1Mass_sound : CB2_3_3I1R1Mass.Encloses (∑ a, CB2_3_3I1R1Value a) := by + exact contains_sound (finSumBall_sound 6 CB2_3_3I1R1P CB2_3_3I1R1Value CB2_3_3I1R1P_sound) (by decide +kernel) +def CB2_3_3I1R1MassTermLogWitness : LogWitness := ⟨-1, 7857441264699229683296977815819, 6250000000000000000000000000000⟩ +def CB2_3_3I1R1MassTermLog : Ball := ⟨(-23213381485437445740208763534969 / 50000000000000000000000000000000), (42351647409 / 100000000000000000000000000000000)⟩ +lemma CB2_3_3I1R1MassTermLog_sound : CB2_3_3I1R1MassTermLog.Encloses (Real.log ((∑ a, CB2_3_3I1R1Value a))) := by + exact checkLog_sound logTwoBall_sound (CB2_3_3I1R1Mass_sound) (w := CB2_3_3I1R1MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB2_3_3I1R1MassTerm : Ball := ⟨(5836729010460201172294134918613 / 20000000000000000000000000000000), (6655511643 / 25000000000000000000000000000000)⟩ +lemma CB2_3_3I1R1MassTerm_sound : CB2_3_3I1R1MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB2_3_3I1R1Value a))) := by + exact contains_sound (entropyTerm_ball (CB2_3_3I1R1Mass_sound) CB2_3_3I1R1MassTermLog_sound) (by decide +kernel) +def CB2_3_3I1R1H : Ball := ⟨0, (6655511643 / 12500000000000000000000000000000)⟩ +lemma CB2_3_3I1R1H_sound : CB2_3_3I1R1H.Encloses (homogeneousEntropy CB2_3_3I1R1Value) := by + exact contains_sound (homogeneous_enclosed CB2_3_3I1R1Value CB2_3_3I1R1MassTerm_sound CB2_3_3I1R1Entropy_sound) (by decide +kernel) +def CB2_3_3I1R2Value (a : Fin 6) : ℝ := residualLaw (below (shape 2 3 3)) (fun u => (stageBLaw (shape 2 3 3) u : ℝ)) (stageBPriority (shape 2 3 3)) 1 (fun u a => (littleLaw (shape 2 3 3) u ((stageBPriority (shape 2 3 3)) 1) a : ℝ)) 2 a +def CB2_3_3I1R2Raw (a : Fin 6) : Ball := residualBall (below (shape 2 3 3)) B2_3_3Law (stageBPriority (shape 2 3 3)) 1 (fun u => B2_3_3Little u ((stageBPriority (shape 2 3 3)) 1)) 2 a +lemma CB2_3_3I1R2Raw_sound (a : Fin 6) : + (CB2_3_3I1R2Raw a).Encloses (CB2_3_3I1R2Value a) := by + exact residualBall_sound_on (below (shape 2 3 3)) B2_3_3Law (fun u => (stageBLaw (shape 2 3 3) u : ℝ)) (stageBPriority (shape 2 3 3)) 1 (fun u => B2_3_3Little u ((stageBPriority (shape 2 3 3)) 1)) (fun u a => (littleLaw (shape 2 3 3) u ((stageBPriority (shape 2 3 3)) 1) a : ℝ)) (fun u _ => B2_3_3Law_sound u) (fun u _ a => B2_3_3Little_sound u ((stageBPriority (shape 2 3 3)) 1) a) 2 a +def CB2_3_3I1R2Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(8294910687805279351247647734847 / 50000000000000000000000000000000), (3 / 12500000000000000000000000000000)⟩ ⟨(29801637404744142102363737095051 / 100000000000000000000000000000000), (14052125363 / 100000000000000000000000000000000)⟩ ⟨(-179638084883523021911449009946461 / 100000000000000000000000000000000), (21175823719 / 25000000000000000000000000000000)⟩ ⟨-3, 8294910687805279351247647734847, 6250000000000000000000000000000⟩, + .log ⟨(149845482270477834551838437991 / 20000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ ⟨(3666631222302686804405742320763 / 100000000000000000000000000000000), (1427895693 / 100000000000000000000000000000000)⟩ ⟨(-244694145378654295860093162216891 / 50000000000000000000000000000000), (95291206707 / 50000000000000000000000000000000)⟩ ⟨-8, 149845482270477834551838437991, 78125000000000000000000000000⟩] +lemma CB2_3_3I1R2Certificates_valid : + CB2_3_3I1R2Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB2_3_3I1R2CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | 2 => 1 + | 3 => 2 + | _ => 0 +def CB2_3_3I1R2P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_3_3I1R2Certificates (CB2_3_3I1R2CertificateIndex a)).input +lemma CB2_3_3I1R2P_check : ∀ a : Fin 6, contains (CB2_3_3I1R2Raw a) (CB2_3_3I1R2P a) = true := by + decide +kernel +lemma CB2_3_3I1R2P_sound (a : Fin 6) : + (CB2_3_3I1R2P a).Encloses (CB2_3_3I1R2Value a) := + contains_sound (CB2_3_3I1R2Raw_sound a) (CB2_3_3I1R2P_check a) +def CB2_3_3I1R2Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_3_3I1R2Certificates (CB2_3_3I1R2CertificateIndex a)).output +lemma CB2_3_3I1R2Terms_sound (a : Fin 6) : + (CB2_3_3I1R2Terms a).Encloses (Foundation.entropyTerm (CB2_3_3I1R2Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB2_3_3I1R2Certificates_valid + (CB2_3_3I1R2CertificateIndex a) (CB2_3_3I1R2P_sound a) +def CB2_3_3I1R2Entropy : Ball := ⟨(16734134313523414453384739707907 / 50000000000000000000000000000000), (241875329 / 1562500000000000000000000000000)⟩ +lemma CB2_3_3I1R2Entropy_sound : CB2_3_3I1R2Entropy.Encloses (Foundation.finiteEntropy CB2_3_3I1R2Value) := by + exact contains_sound (entropyFin_enclosed 6 CB2_3_3I1R2Value CB2_3_3I1R2Terms CB2_3_3I1R2Terms_sound) (by decide +kernel) +def CB2_3_3I1R2Mass : Ball := ⟨(17339048786962947875254487659649 / 100000000000000000000000000000000), (13 / 50000000000000000000000000000000)⟩ +lemma CB2_3_3I1R2Mass_sound : CB2_3_3I1R2Mass.Encloses (∑ a, CB2_3_3I1R2Value a) := by + exact contains_sound (finSumBall_sound 6 CB2_3_3I1R2P CB2_3_3I1R2Value CB2_3_3I1R2P_sound) (by decide +kernel) +def CB2_3_3I1R2MassTermLogWitness : LogWitness := ⟨-3, 17339048786962947875254487659649, 12500000000000000000000000000000⟩ +def CB2_3_3I1R2MassTermLog : Ball := ⟨(-87610453635845193070010899116863 / 50000000000000000000000000000000), (84703294881 / 100000000000000000000000000000000)⟩ +lemma CB2_3_3I1R2MassTermLog_sound : CB2_3_3I1R2MassTermLog.Encloses (Real.log ((∑ a, CB2_3_3I1R2Value a))) := by + exact checkLog_sound logTwoBall_sound (CB2_3_3I1R2Mass_sound) (w := CB2_3_3I1R2MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB2_3_3I1R2MassTerm : Ball := ⟨(15190819298398751811632270251413 / 50000000000000000000000000000000), (1468674567 / 10000000000000000000000000000000)⟩ +lemma CB2_3_3I1R2MassTerm_sound : CB2_3_3I1R2MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB2_3_3I1R2Value a))) := by + exact contains_sound (entropyTerm_ball (CB2_3_3I1R2Mass_sound) CB2_3_3I1R2MassTermLog_sound) (by decide +kernel) +def CB2_3_3I1R2H : Ball := ⟨(771657507562331320876234728247 / 25000000000000000000000000000000), (15083383363 / 50000000000000000000000000000000)⟩ +lemma CB2_3_3I1R2H_sound : CB2_3_3I1R2H.Encloses (homogeneousEntropy CB2_3_3I1R2Value) := by + exact contains_sound (homogeneous_enclosed CB2_3_3I1R2Value CB2_3_3I1R2MassTerm_sound CB2_3_3I1R2Entropy_sound) (by decide +kernel) +def CB2_3_3I1R3Value (a : Fin 6) : ℝ := residualLaw (below (shape 2 3 3)) (fun u => (stageBLaw (shape 2 3 3) u : ℝ)) (stageBPriority (shape 2 3 3)) 1 (fun u a => (littleLaw (shape 2 3 3) u ((stageBPriority (shape 2 3 3)) 1) a : ℝ)) 3 a +def CB2_3_3I1R3Raw (a : Fin 6) : Ball := residualBall (below (shape 2 3 3)) B2_3_3Law (stageBPriority (shape 2 3 3)) 1 (fun u => B2_3_3Little u ((stageBPriority (shape 2 3 3)) 1)) 3 a +lemma CB2_3_3I1R3Raw_sound (a : Fin 6) : + (CB2_3_3I1R3Raw a).Encloses (CB2_3_3I1R3Value a) := by + exact residualBall_sound_on (below (shape 2 3 3)) B2_3_3Law (fun u => (stageBLaw (shape 2 3 3) u : ℝ)) (stageBPriority (shape 2 3 3)) 1 (fun u => B2_3_3Little u ((stageBPriority (shape 2 3 3)) 1)) (fun u a => (littleLaw (shape 2 3 3) u ((stageBPriority (shape 2 3 3)) 1) a : ℝ)) (fun u _ => B2_3_3Law_sound u) (fun u _ a => B2_3_3Little_sound u ((stageBPriority (shape 2 3 3)) 1) a) 3 a +def CB2_3_3I1R3Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB2_3_3I1R3Certificates_valid : + CB2_3_3I1R3Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB2_3_3I1R3CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB2_3_3I1R3P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_3_3I1R3Certificates (CB2_3_3I1R3CertificateIndex a)).input +lemma CB2_3_3I1R3P_check : ∀ a : Fin 6, contains (CB2_3_3I1R3Raw a) (CB2_3_3I1R3P a) = true := by + decide +kernel +lemma CB2_3_3I1R3P_sound (a : Fin 6) : + (CB2_3_3I1R3P a).Encloses (CB2_3_3I1R3Value a) := + contains_sound (CB2_3_3I1R3Raw_sound a) (CB2_3_3I1R3P_check a) +def CB2_3_3I1R3Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_3_3I1R3Certificates (CB2_3_3I1R3CertificateIndex a)).output +lemma CB2_3_3I1R3Terms_sound (a : Fin 6) : + (CB2_3_3I1R3Terms a).Encloses (Foundation.entropyTerm (CB2_3_3I1R3Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB2_3_3I1R3Certificates_valid + (CB2_3_3I1R3CertificateIndex a) (CB2_3_3I1R3P_sound a) +def CB2_3_3I1R3Entropy : Ball := ⟨0, 0⟩ +lemma CB2_3_3I1R3Entropy_sound : CB2_3_3I1R3Entropy.Encloses (Foundation.finiteEntropy CB2_3_3I1R3Value) := by + exact contains_sound (entropyFin_enclosed 6 CB2_3_3I1R3Value CB2_3_3I1R3Terms CB2_3_3I1R3Terms_sound) (by decide +kernel) +def CB2_3_3I1R3Mass : Ball := ⟨0, 0⟩ +lemma CB2_3_3I1R3Mass_sound : CB2_3_3I1R3Mass.Encloses (∑ a, CB2_3_3I1R3Value a) := by + exact contains_sound (finSumBall_sound 6 CB2_3_3I1R3P CB2_3_3I1R3Value CB2_3_3I1R3P_sound) (by decide +kernel) +def CB2_3_3I1R3MassTerm : Ball := .exact 0 +lemma CB2_3_3I1R3MassTerm_sound : CB2_3_3I1R3MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB2_3_3I1R3Value a))) := + entropyTerm_zero_ball (CB2_3_3I1R3Mass_sound) +def CB2_3_3I1R3H : Ball := ⟨0, 0⟩ +lemma CB2_3_3I1R3H_sound : CB2_3_3I1R3H.Encloses (homogeneousEntropy CB2_3_3I1R3Value) := by + exact contains_sound (homogeneous_enclosed CB2_3_3I1R3Value CB2_3_3I1R3MassTerm_sound CB2_3_3I1R3Entropy_sound) (by decide +kernel) +def CB2_3_3I1R4Value (a : Fin 6) : ℝ := residualLaw (below (shape 2 3 3)) (fun u => (stageBLaw (shape 2 3 3) u : ℝ)) (stageBPriority (shape 2 3 3)) 1 (fun u a => (littleLaw (shape 2 3 3) u ((stageBPriority (shape 2 3 3)) 1) a : ℝ)) 4 a +def CB2_3_3I1R4Raw (a : Fin 6) : Ball := residualBall (below (shape 2 3 3)) B2_3_3Law (stageBPriority (shape 2 3 3)) 1 (fun u => B2_3_3Little u ((stageBPriority (shape 2 3 3)) 1)) 4 a +lemma CB2_3_3I1R4Raw_sound (a : Fin 6) : + (CB2_3_3I1R4Raw a).Encloses (CB2_3_3I1R4Value a) := by + exact residualBall_sound_on (below (shape 2 3 3)) B2_3_3Law (fun u => (stageBLaw (shape 2 3 3) u : ℝ)) (stageBPriority (shape 2 3 3)) 1 (fun u => B2_3_3Little u ((stageBPriority (shape 2 3 3)) 1)) (fun u a => (littleLaw (shape 2 3 3) u ((stageBPriority (shape 2 3 3)) 1) a : ℝ)) (fun u _ => B2_3_3Law_sound u) (fun u _ a => B2_3_3Little_sound u ((stageBPriority (shape 2 3 3)) 1) a) 4 a +def CB2_3_3I1R4Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB2_3_3I1R4Certificates_valid : + CB2_3_3I1R4Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB2_3_3I1R4CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB2_3_3I1R4P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_3_3I1R4Certificates (CB2_3_3I1R4CertificateIndex a)).input +lemma CB2_3_3I1R4P_check : ∀ a : Fin 6, contains (CB2_3_3I1R4Raw a) (CB2_3_3I1R4P a) = true := by + decide +kernel +lemma CB2_3_3I1R4P_sound (a : Fin 6) : + (CB2_3_3I1R4P a).Encloses (CB2_3_3I1R4Value a) := + contains_sound (CB2_3_3I1R4Raw_sound a) (CB2_3_3I1R4P_check a) +def CB2_3_3I1R4Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_3_3I1R4Certificates (CB2_3_3I1R4CertificateIndex a)).output +lemma CB2_3_3I1R4Terms_sound (a : Fin 6) : + (CB2_3_3I1R4Terms a).Encloses (Foundation.entropyTerm (CB2_3_3I1R4Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB2_3_3I1R4Certificates_valid + (CB2_3_3I1R4CertificateIndex a) (CB2_3_3I1R4P_sound a) +def CB2_3_3I1R4Entropy : Ball := ⟨0, 0⟩ +lemma CB2_3_3I1R4Entropy_sound : CB2_3_3I1R4Entropy.Encloses (Foundation.finiteEntropy CB2_3_3I1R4Value) := by + exact contains_sound (entropyFin_enclosed 6 CB2_3_3I1R4Value CB2_3_3I1R4Terms CB2_3_3I1R4Terms_sound) (by decide +kernel) +def CB2_3_3I1R4Mass : Ball := ⟨0, 0⟩ +lemma CB2_3_3I1R4Mass_sound : CB2_3_3I1R4Mass.Encloses (∑ a, CB2_3_3I1R4Value a) := by + exact contains_sound (finSumBall_sound 6 CB2_3_3I1R4P CB2_3_3I1R4Value CB2_3_3I1R4P_sound) (by decide +kernel) +def CB2_3_3I1R4MassTerm : Ball := .exact 0 +lemma CB2_3_3I1R4MassTerm_sound : CB2_3_3I1R4MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB2_3_3I1R4Value a))) := + entropyTerm_zero_ball (CB2_3_3I1R4Mass_sound) +def CB2_3_3I1R4H : Ball := ⟨0, 0⟩ +lemma CB2_3_3I1R4H_sound : CB2_3_3I1R4H.Encloses (homogeneousEntropy CB2_3_3I1R4Value) := by + exact contains_sound (homogeneous_enclosed CB2_3_3I1R4Value CB2_3_3I1R4MassTerm_sound CB2_3_3I1R4Entropy_sound) (by decide +kernel) +def CB2_3_3I1R5Value (a : Fin 6) : ℝ := residualLaw (below (shape 2 3 3)) (fun u => (stageBLaw (shape 2 3 3) u : ℝ)) (stageBPriority (shape 2 3 3)) 1 (fun u a => (littleLaw (shape 2 3 3) u ((stageBPriority (shape 2 3 3)) 1) a : ℝ)) 5 a +def CB2_3_3I1R5Raw (a : Fin 6) : Ball := residualBall (below (shape 2 3 3)) B2_3_3Law (stageBPriority (shape 2 3 3)) 1 (fun u => B2_3_3Little u ((stageBPriority (shape 2 3 3)) 1)) 5 a +lemma CB2_3_3I1R5Raw_sound (a : Fin 6) : + (CB2_3_3I1R5Raw a).Encloses (CB2_3_3I1R5Value a) := by + exact residualBall_sound_on (below (shape 2 3 3)) B2_3_3Law (fun u => (stageBLaw (shape 2 3 3) u : ℝ)) (stageBPriority (shape 2 3 3)) 1 (fun u => B2_3_3Little u ((stageBPriority (shape 2 3 3)) 1)) (fun u a => (littleLaw (shape 2 3 3) u ((stageBPriority (shape 2 3 3)) 1) a : ℝ)) (fun u _ => B2_3_3Law_sound u) (fun u _ a => B2_3_3Little_sound u ((stageBPriority (shape 2 3 3)) 1) a) 5 a +def CB2_3_3I1R5Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB2_3_3I1R5Certificates_valid : + CB2_3_3I1R5Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB2_3_3I1R5CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB2_3_3I1R5P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_3_3I1R5Certificates (CB2_3_3I1R5CertificateIndex a)).input +lemma CB2_3_3I1R5P_check : ∀ a : Fin 6, contains (CB2_3_3I1R5Raw a) (CB2_3_3I1R5P a) = true := by + decide +kernel +lemma CB2_3_3I1R5P_sound (a : Fin 6) : + (CB2_3_3I1R5P a).Encloses (CB2_3_3I1R5Value a) := + contains_sound (CB2_3_3I1R5Raw_sound a) (CB2_3_3I1R5P_check a) +def CB2_3_3I1R5Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_3_3I1R5Certificates (CB2_3_3I1R5CertificateIndex a)).output +lemma CB2_3_3I1R5Terms_sound (a : Fin 6) : + (CB2_3_3I1R5Terms a).Encloses (Foundation.entropyTerm (CB2_3_3I1R5Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB2_3_3I1R5Certificates_valid + (CB2_3_3I1R5CertificateIndex a) (CB2_3_3I1R5P_sound a) +def CB2_3_3I1R5Entropy : Ball := ⟨0, 0⟩ +lemma CB2_3_3I1R5Entropy_sound : CB2_3_3I1R5Entropy.Encloses (Foundation.finiteEntropy CB2_3_3I1R5Value) := by + exact contains_sound (entropyFin_enclosed 6 CB2_3_3I1R5Value CB2_3_3I1R5Terms CB2_3_3I1R5Terms_sound) (by decide +kernel) +def CB2_3_3I1R5Mass : Ball := ⟨0, 0⟩ +lemma CB2_3_3I1R5Mass_sound : CB2_3_3I1R5Mass.Encloses (∑ a, CB2_3_3I1R5Value a) := by + exact contains_sound (finSumBall_sound 6 CB2_3_3I1R5P CB2_3_3I1R5Value CB2_3_3I1R5P_sound) (by decide +kernel) +def CB2_3_3I1R5MassTerm : Ball := .exact 0 +lemma CB2_3_3I1R5MassTerm_sound : CB2_3_3I1R5MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB2_3_3I1R5Value a))) := + entropyTerm_zero_ball (CB2_3_3I1R5Mass_sound) +def CB2_3_3I1R5H : Ball := ⟨0, 0⟩ +lemma CB2_3_3I1R5H_sound : CB2_3_3I1R5H.Encloses (homogeneousEntropy CB2_3_3I1R5Value) := by + exact contains_sound (homogeneous_enclosed CB2_3_3I1R5Value CB2_3_3I1R5MassTerm_sound CB2_3_3I1R5Entropy_sound) (by decide +kernel) +def CB2_3_3I1R6Value (a : Fin 6) : ℝ := residualLaw (below (shape 2 3 3)) (fun u => (stageBLaw (shape 2 3 3) u : ℝ)) (stageBPriority (shape 2 3 3)) 1 (fun u a => (littleLaw (shape 2 3 3) u ((stageBPriority (shape 2 3 3)) 1) a : ℝ)) 6 a +def CB2_3_3I1R6Raw (a : Fin 6) : Ball := residualBall (below (shape 2 3 3)) B2_3_3Law (stageBPriority (shape 2 3 3)) 1 (fun u => B2_3_3Little u ((stageBPriority (shape 2 3 3)) 1)) 6 a +lemma CB2_3_3I1R6Raw_sound (a : Fin 6) : + (CB2_3_3I1R6Raw a).Encloses (CB2_3_3I1R6Value a) := by + exact residualBall_sound_on (below (shape 2 3 3)) B2_3_3Law (fun u => (stageBLaw (shape 2 3 3) u : ℝ)) (stageBPriority (shape 2 3 3)) 1 (fun u => B2_3_3Little u ((stageBPriority (shape 2 3 3)) 1)) (fun u a => (littleLaw (shape 2 3 3) u ((stageBPriority (shape 2 3 3)) 1) a : ℝ)) (fun u _ => B2_3_3Law_sound u) (fun u _ a => B2_3_3Little_sound u ((stageBPriority (shape 2 3 3)) 1) a) 6 a +def CB2_3_3I1R6Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB2_3_3I1R6Certificates_valid : + CB2_3_3I1R6Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB2_3_3I1R6CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB2_3_3I1R6P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_3_3I1R6Certificates (CB2_3_3I1R6CertificateIndex a)).input +lemma CB2_3_3I1R6P_check : ∀ a : Fin 6, contains (CB2_3_3I1R6Raw a) (CB2_3_3I1R6P a) = true := by + decide +kernel +lemma CB2_3_3I1R6P_sound (a : Fin 6) : + (CB2_3_3I1R6P a).Encloses (CB2_3_3I1R6Value a) := + contains_sound (CB2_3_3I1R6Raw_sound a) (CB2_3_3I1R6P_check a) +def CB2_3_3I1R6Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_3_3I1R6Certificates (CB2_3_3I1R6CertificateIndex a)).output +lemma CB2_3_3I1R6Terms_sound (a : Fin 6) : + (CB2_3_3I1R6Terms a).Encloses (Foundation.entropyTerm (CB2_3_3I1R6Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB2_3_3I1R6Certificates_valid + (CB2_3_3I1R6CertificateIndex a) (CB2_3_3I1R6P_sound a) +def CB2_3_3I1R6Entropy : Ball := ⟨0, 0⟩ +lemma CB2_3_3I1R6Entropy_sound : CB2_3_3I1R6Entropy.Encloses (Foundation.finiteEntropy CB2_3_3I1R6Value) := by + exact contains_sound (entropyFin_enclosed 6 CB2_3_3I1R6Value CB2_3_3I1R6Terms CB2_3_3I1R6Terms_sound) (by decide +kernel) +def CB2_3_3I1R6Mass : Ball := ⟨0, 0⟩ +lemma CB2_3_3I1R6Mass_sound : CB2_3_3I1R6Mass.Encloses (∑ a, CB2_3_3I1R6Value a) := by + exact contains_sound (finSumBall_sound 6 CB2_3_3I1R6P CB2_3_3I1R6Value CB2_3_3I1R6P_sound) (by decide +kernel) +def CB2_3_3I1R6MassTerm : Ball := .exact 0 +lemma CB2_3_3I1R6MassTerm_sound : CB2_3_3I1R6MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB2_3_3I1R6Value a))) := + entropyTerm_zero_ball (CB2_3_3I1R6Mass_sound) +def CB2_3_3I1R6H : Ball := ⟨0, 0⟩ +lemma CB2_3_3I1R6H_sound : CB2_3_3I1R6H.Encloses (homogeneousEntropy CB2_3_3I1R6Value) := by + exact contains_sound (homogeneous_enclosed CB2_3_3I1R6Value CB2_3_3I1R6MassTerm_sound CB2_3_3I1R6Entropy_sound) (by decide +kernel) +def CB2_3_3I1R7Value (a : Fin 6) : ℝ := residualLaw (below (shape 2 3 3)) (fun u => (stageBLaw (shape 2 3 3) u : ℝ)) (stageBPriority (shape 2 3 3)) 1 (fun u a => (littleLaw (shape 2 3 3) u ((stageBPriority (shape 2 3 3)) 1) a : ℝ)) 7 a +def CB2_3_3I1R7Raw (a : Fin 6) : Ball := residualBall (below (shape 2 3 3)) B2_3_3Law (stageBPriority (shape 2 3 3)) 1 (fun u => B2_3_3Little u ((stageBPriority (shape 2 3 3)) 1)) 7 a +lemma CB2_3_3I1R7Raw_sound (a : Fin 6) : + (CB2_3_3I1R7Raw a).Encloses (CB2_3_3I1R7Value a) := by + exact residualBall_sound_on (below (shape 2 3 3)) B2_3_3Law (fun u => (stageBLaw (shape 2 3 3) u : ℝ)) (stageBPriority (shape 2 3 3)) 1 (fun u => B2_3_3Little u ((stageBPriority (shape 2 3 3)) 1)) (fun u a => (littleLaw (shape 2 3 3) u ((stageBPriority (shape 2 3 3)) 1) a : ℝ)) (fun u _ => B2_3_3Law_sound u) (fun u _ a => B2_3_3Little_sound u ((stageBPriority (shape 2 3 3)) 1) a) 7 a +def CB2_3_3I1R7Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB2_3_3I1R7Certificates_valid : + CB2_3_3I1R7Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB2_3_3I1R7CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB2_3_3I1R7P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_3_3I1R7Certificates (CB2_3_3I1R7CertificateIndex a)).input +lemma CB2_3_3I1R7P_check : ∀ a : Fin 6, contains (CB2_3_3I1R7Raw a) (CB2_3_3I1R7P a) = true := by + decide +kernel +lemma CB2_3_3I1R7P_sound (a : Fin 6) : + (CB2_3_3I1R7P a).Encloses (CB2_3_3I1R7Value a) := + contains_sound (CB2_3_3I1R7Raw_sound a) (CB2_3_3I1R7P_check a) +def CB2_3_3I1R7Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_3_3I1R7Certificates (CB2_3_3I1R7CertificateIndex a)).output +lemma CB2_3_3I1R7Terms_sound (a : Fin 6) : + (CB2_3_3I1R7Terms a).Encloses (Foundation.entropyTerm (CB2_3_3I1R7Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB2_3_3I1R7Certificates_valid + (CB2_3_3I1R7CertificateIndex a) (CB2_3_3I1R7P_sound a) +def CB2_3_3I1R7Entropy : Ball := ⟨0, 0⟩ +lemma CB2_3_3I1R7Entropy_sound : CB2_3_3I1R7Entropy.Encloses (Foundation.finiteEntropy CB2_3_3I1R7Value) := by + exact contains_sound (entropyFin_enclosed 6 CB2_3_3I1R7Value CB2_3_3I1R7Terms CB2_3_3I1R7Terms_sound) (by decide +kernel) +def CB2_3_3I1R7Mass : Ball := ⟨0, 0⟩ +lemma CB2_3_3I1R7Mass_sound : CB2_3_3I1R7Mass.Encloses (∑ a, CB2_3_3I1R7Value a) := by + exact contains_sound (finSumBall_sound 6 CB2_3_3I1R7P CB2_3_3I1R7Value CB2_3_3I1R7P_sound) (by decide +kernel) +def CB2_3_3I1R7MassTerm : Ball := .exact 0 +lemma CB2_3_3I1R7MassTerm_sound : CB2_3_3I1R7MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB2_3_3I1R7Value a))) := + entropyTerm_zero_ball (CB2_3_3I1R7Mass_sound) +def CB2_3_3I1R7H : Ball := ⟨0, 0⟩ +lemma CB2_3_3I1R7H_sound : CB2_3_3I1R7H.Encloses (homogeneousEntropy CB2_3_3I1R7Value) := by + exact contains_sound (homogeneous_enclosed CB2_3_3I1R7Value CB2_3_3I1R7MassTerm_sound CB2_3_3I1R7Entropy_sound) (by decide +kernel) +def CB2_3_3I1R8Value (a : Fin 6) : ℝ := residualLaw (below (shape 2 3 3)) (fun u => (stageBLaw (shape 2 3 3) u : ℝ)) (stageBPriority (shape 2 3 3)) 1 (fun u a => (littleLaw (shape 2 3 3) u ((stageBPriority (shape 2 3 3)) 1) a : ℝ)) 8 a +def CB2_3_3I1R8Raw (a : Fin 6) : Ball := residualBall (below (shape 2 3 3)) B2_3_3Law (stageBPriority (shape 2 3 3)) 1 (fun u => B2_3_3Little u ((stageBPriority (shape 2 3 3)) 1)) 8 a +lemma CB2_3_3I1R8Raw_sound (a : Fin 6) : + (CB2_3_3I1R8Raw a).Encloses (CB2_3_3I1R8Value a) := by + exact residualBall_sound_on (below (shape 2 3 3)) B2_3_3Law (fun u => (stageBLaw (shape 2 3 3) u : ℝ)) (stageBPriority (shape 2 3 3)) 1 (fun u => B2_3_3Little u ((stageBPriority (shape 2 3 3)) 1)) (fun u a => (littleLaw (shape 2 3 3) u ((stageBPriority (shape 2 3 3)) 1) a : ℝ)) (fun u _ => B2_3_3Law_sound u) (fun u _ a => B2_3_3Little_sound u ((stageBPriority (shape 2 3 3)) 1) a) 8 a +def CB2_3_3I1R8Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB2_3_3I1R8Certificates_valid : + CB2_3_3I1R8Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB2_3_3I1R8CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB2_3_3I1R8P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_3_3I1R8Certificates (CB2_3_3I1R8CertificateIndex a)).input +lemma CB2_3_3I1R8P_check : ∀ a : Fin 6, contains (CB2_3_3I1R8Raw a) (CB2_3_3I1R8P a) = true := by + decide +kernel +lemma CB2_3_3I1R8P_sound (a : Fin 6) : + (CB2_3_3I1R8P a).Encloses (CB2_3_3I1R8Value a) := + contains_sound (CB2_3_3I1R8Raw_sound a) (CB2_3_3I1R8P_check a) +def CB2_3_3I1R8Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_3_3I1R8Certificates (CB2_3_3I1R8CertificateIndex a)).output +lemma CB2_3_3I1R8Terms_sound (a : Fin 6) : + (CB2_3_3I1R8Terms a).Encloses (Foundation.entropyTerm (CB2_3_3I1R8Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB2_3_3I1R8Certificates_valid + (CB2_3_3I1R8CertificateIndex a) (CB2_3_3I1R8P_sound a) +def CB2_3_3I1R8Entropy : Ball := ⟨0, 0⟩ +lemma CB2_3_3I1R8Entropy_sound : CB2_3_3I1R8Entropy.Encloses (Foundation.finiteEntropy CB2_3_3I1R8Value) := by + exact contains_sound (entropyFin_enclosed 6 CB2_3_3I1R8Value CB2_3_3I1R8Terms CB2_3_3I1R8Terms_sound) (by decide +kernel) +def CB2_3_3I1R8Mass : Ball := ⟨0, 0⟩ +lemma CB2_3_3I1R8Mass_sound : CB2_3_3I1R8Mass.Encloses (∑ a, CB2_3_3I1R8Value a) := by + exact contains_sound (finSumBall_sound 6 CB2_3_3I1R8P CB2_3_3I1R8Value CB2_3_3I1R8P_sound) (by decide +kernel) +def CB2_3_3I1R8MassTerm : Ball := .exact 0 +lemma CB2_3_3I1R8MassTerm_sound : CB2_3_3I1R8MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB2_3_3I1R8Value a))) := + entropyTerm_zero_ball (CB2_3_3I1R8Mass_sound) +def CB2_3_3I1R8H : Ball := ⟨0, 0⟩ +lemma CB2_3_3I1R8H_sound : CB2_3_3I1R8H.Encloses (homogeneousEntropy CB2_3_3I1R8Value) := by + exact contains_sound (homogeneous_enclosed CB2_3_3I1R8Value CB2_3_3I1R8MassTerm_sound CB2_3_3I1R8Entropy_sound) (by decide +kernel) +def CB2_3_3I1R9Value (a : Fin 6) : ℝ := residualLaw (below (shape 2 3 3)) (fun u => (stageBLaw (shape 2 3 3) u : ℝ)) (stageBPriority (shape 2 3 3)) 1 (fun u a => (littleLaw (shape 2 3 3) u ((stageBPriority (shape 2 3 3)) 1) a : ℝ)) 9 a +def CB2_3_3I1R9Raw (a : Fin 6) : Ball := residualBall (below (shape 2 3 3)) B2_3_3Law (stageBPriority (shape 2 3 3)) 1 (fun u => B2_3_3Little u ((stageBPriority (shape 2 3 3)) 1)) 9 a +lemma CB2_3_3I1R9Raw_sound (a : Fin 6) : + (CB2_3_3I1R9Raw a).Encloses (CB2_3_3I1R9Value a) := by + exact residualBall_sound_on (below (shape 2 3 3)) B2_3_3Law (fun u => (stageBLaw (shape 2 3 3) u : ℝ)) (stageBPriority (shape 2 3 3)) 1 (fun u => B2_3_3Little u ((stageBPriority (shape 2 3 3)) 1)) (fun u a => (littleLaw (shape 2 3 3) u ((stageBPriority (shape 2 3 3)) 1) a : ℝ)) (fun u _ => B2_3_3Law_sound u) (fun u _ a => B2_3_3Little_sound u ((stageBPriority (shape 2 3 3)) 1) a) 9 a +def CB2_3_3I1R9Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB2_3_3I1R9Certificates_valid : + CB2_3_3I1R9Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB2_3_3I1R9CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB2_3_3I1R9P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_3_3I1R9Certificates (CB2_3_3I1R9CertificateIndex a)).input +lemma CB2_3_3I1R9P_check : ∀ a : Fin 6, contains (CB2_3_3I1R9Raw a) (CB2_3_3I1R9P a) = true := by + decide +kernel +lemma CB2_3_3I1R9P_sound (a : Fin 6) : + (CB2_3_3I1R9P a).Encloses (CB2_3_3I1R9Value a) := + contains_sound (CB2_3_3I1R9Raw_sound a) (CB2_3_3I1R9P_check a) +def CB2_3_3I1R9Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_3_3I1R9Certificates (CB2_3_3I1R9CertificateIndex a)).output +lemma CB2_3_3I1R9Terms_sound (a : Fin 6) : + (CB2_3_3I1R9Terms a).Encloses (Foundation.entropyTerm (CB2_3_3I1R9Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB2_3_3I1R9Certificates_valid + (CB2_3_3I1R9CertificateIndex a) (CB2_3_3I1R9P_sound a) +def CB2_3_3I1R9Entropy : Ball := ⟨0, 0⟩ +lemma CB2_3_3I1R9Entropy_sound : CB2_3_3I1R9Entropy.Encloses (Foundation.finiteEntropy CB2_3_3I1R9Value) := by + exact contains_sound (entropyFin_enclosed 6 CB2_3_3I1R9Value CB2_3_3I1R9Terms CB2_3_3I1R9Terms_sound) (by decide +kernel) +def CB2_3_3I1R9Mass : Ball := ⟨0, 0⟩ +lemma CB2_3_3I1R9Mass_sound : CB2_3_3I1R9Mass.Encloses (∑ a, CB2_3_3I1R9Value a) := by + exact contains_sound (finSumBall_sound 6 CB2_3_3I1R9P CB2_3_3I1R9Value CB2_3_3I1R9P_sound) (by decide +kernel) +def CB2_3_3I1R9MassTerm : Ball := .exact 0 +lemma CB2_3_3I1R9MassTerm_sound : CB2_3_3I1R9MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB2_3_3I1R9Value a))) := + entropyTerm_zero_ball (CB2_3_3I1R9Mass_sound) +def CB2_3_3I1R9H : Ball := ⟨0, 0⟩ +lemma CB2_3_3I1R9H_sound : CB2_3_3I1R9H.Encloses (homogeneousEntropy CB2_3_3I1R9Value) := by + exact contains_sound (homogeneous_enclosed CB2_3_3I1R9Value CB2_3_3I1R9MassTerm_sound CB2_3_3I1R9Entropy_sound) (by decide +kernel) +def CB2_3_3I1R10Value (a : Fin 6) : ℝ := residualLaw (below (shape 2 3 3)) (fun u => (stageBLaw (shape 2 3 3) u : ℝ)) (stageBPriority (shape 2 3 3)) 1 (fun u a => (littleLaw (shape 2 3 3) u ((stageBPriority (shape 2 3 3)) 1) a : ℝ)) 10 a +def CB2_3_3I1R10Raw (a : Fin 6) : Ball := residualBall (below (shape 2 3 3)) B2_3_3Law (stageBPriority (shape 2 3 3)) 1 (fun u => B2_3_3Little u ((stageBPriority (shape 2 3 3)) 1)) 10 a +lemma CB2_3_3I1R10Raw_sound (a : Fin 6) : + (CB2_3_3I1R10Raw a).Encloses (CB2_3_3I1R10Value a) := by + exact residualBall_sound_on (below (shape 2 3 3)) B2_3_3Law (fun u => (stageBLaw (shape 2 3 3) u : ℝ)) (stageBPriority (shape 2 3 3)) 1 (fun u => B2_3_3Little u ((stageBPriority (shape 2 3 3)) 1)) (fun u a => (littleLaw (shape 2 3 3) u ((stageBPriority (shape 2 3 3)) 1) a : ℝ)) (fun u _ => B2_3_3Law_sound u) (fun u _ a => B2_3_3Little_sound u ((stageBPriority (shape 2 3 3)) 1) a) 10 a +def CB2_3_3I1R10Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB2_3_3I1R10Certificates_valid : + CB2_3_3I1R10Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB2_3_3I1R10CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB2_3_3I1R10P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_3_3I1R10Certificates (CB2_3_3I1R10CertificateIndex a)).input +lemma CB2_3_3I1R10P_check : ∀ a : Fin 6, contains (CB2_3_3I1R10Raw a) (CB2_3_3I1R10P a) = true := by + decide +kernel +lemma CB2_3_3I1R10P_sound (a : Fin 6) : + (CB2_3_3I1R10P a).Encloses (CB2_3_3I1R10Value a) := + contains_sound (CB2_3_3I1R10Raw_sound a) (CB2_3_3I1R10P_check a) +def CB2_3_3I1R10Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_3_3I1R10Certificates (CB2_3_3I1R10CertificateIndex a)).output +lemma CB2_3_3I1R10Terms_sound (a : Fin 6) : + (CB2_3_3I1R10Terms a).Encloses (Foundation.entropyTerm (CB2_3_3I1R10Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB2_3_3I1R10Certificates_valid + (CB2_3_3I1R10CertificateIndex a) (CB2_3_3I1R10P_sound a) +def CB2_3_3I1R10Entropy : Ball := ⟨0, 0⟩ +lemma CB2_3_3I1R10Entropy_sound : CB2_3_3I1R10Entropy.Encloses (Foundation.finiteEntropy CB2_3_3I1R10Value) := by + exact contains_sound (entropyFin_enclosed 6 CB2_3_3I1R10Value CB2_3_3I1R10Terms CB2_3_3I1R10Terms_sound) (by decide +kernel) +def CB2_3_3I1R10Mass : Ball := ⟨0, 0⟩ +lemma CB2_3_3I1R10Mass_sound : CB2_3_3I1R10Mass.Encloses (∑ a, CB2_3_3I1R10Value a) := by + exact contains_sound (finSumBall_sound 6 CB2_3_3I1R10P CB2_3_3I1R10Value CB2_3_3I1R10P_sound) (by decide +kernel) +def CB2_3_3I1R10MassTerm : Ball := .exact 0 +lemma CB2_3_3I1R10MassTerm_sound : CB2_3_3I1R10MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB2_3_3I1R10Value a))) := + entropyTerm_zero_ball (CB2_3_3I1R10Mass_sound) +def CB2_3_3I1R10H : Ball := ⟨0, 0⟩ +lemma CB2_3_3I1R10H_sound : CB2_3_3I1R10H.Encloses (homogeneousEntropy CB2_3_3I1R10Value) := by + exact contains_sound (homogeneous_enclosed CB2_3_3I1R10Value CB2_3_3I1R10MassTerm_sound CB2_3_3I1R10Entropy_sound) (by decide +kernel) +def CB2_3_3I1R11Value (a : Fin 6) : ℝ := residualLaw (below (shape 2 3 3)) (fun u => (stageBLaw (shape 2 3 3) u : ℝ)) (stageBPriority (shape 2 3 3)) 1 (fun u a => (littleLaw (shape 2 3 3) u ((stageBPriority (shape 2 3 3)) 1) a : ℝ)) 11 a +def CB2_3_3I1R11Raw (a : Fin 6) : Ball := residualBall (below (shape 2 3 3)) B2_3_3Law (stageBPriority (shape 2 3 3)) 1 (fun u => B2_3_3Little u ((stageBPriority (shape 2 3 3)) 1)) 11 a +lemma CB2_3_3I1R11Raw_sound (a : Fin 6) : + (CB2_3_3I1R11Raw a).Encloses (CB2_3_3I1R11Value a) := by + exact residualBall_sound_on (below (shape 2 3 3)) B2_3_3Law (fun u => (stageBLaw (shape 2 3 3) u : ℝ)) (stageBPriority (shape 2 3 3)) 1 (fun u => B2_3_3Little u ((stageBPriority (shape 2 3 3)) 1)) (fun u a => (littleLaw (shape 2 3 3) u ((stageBPriority (shape 2 3 3)) 1) a : ℝ)) (fun u _ => B2_3_3Law_sound u) (fun u _ a => B2_3_3Little_sound u ((stageBPriority (shape 2 3 3)) 1) a) 11 a +def CB2_3_3I1R11Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB2_3_3I1R11Certificates_valid : + CB2_3_3I1R11Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB2_3_3I1R11CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB2_3_3I1R11P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_3_3I1R11Certificates (CB2_3_3I1R11CertificateIndex a)).input +lemma CB2_3_3I1R11P_check : ∀ a : Fin 6, contains (CB2_3_3I1R11Raw a) (CB2_3_3I1R11P a) = true := by + decide +kernel +lemma CB2_3_3I1R11P_sound (a : Fin 6) : + (CB2_3_3I1R11P a).Encloses (CB2_3_3I1R11Value a) := + contains_sound (CB2_3_3I1R11Raw_sound a) (CB2_3_3I1R11P_check a) +def CB2_3_3I1R11Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_3_3I1R11Certificates (CB2_3_3I1R11CertificateIndex a)).output +lemma CB2_3_3I1R11Terms_sound (a : Fin 6) : + (CB2_3_3I1R11Terms a).Encloses (Foundation.entropyTerm (CB2_3_3I1R11Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB2_3_3I1R11Certificates_valid + (CB2_3_3I1R11CertificateIndex a) (CB2_3_3I1R11P_sound a) +def CB2_3_3I1R11Entropy : Ball := ⟨0, 0⟩ +lemma CB2_3_3I1R11Entropy_sound : CB2_3_3I1R11Entropy.Encloses (Foundation.finiteEntropy CB2_3_3I1R11Value) := by + exact contains_sound (entropyFin_enclosed 6 CB2_3_3I1R11Value CB2_3_3I1R11Terms CB2_3_3I1R11Terms_sound) (by decide +kernel) +def CB2_3_3I1R11Mass : Ball := ⟨0, 0⟩ +lemma CB2_3_3I1R11Mass_sound : CB2_3_3I1R11Mass.Encloses (∑ a, CB2_3_3I1R11Value a) := by + exact contains_sound (finSumBall_sound 6 CB2_3_3I1R11P CB2_3_3I1R11Value CB2_3_3I1R11P_sound) (by decide +kernel) +def CB2_3_3I1R11MassTerm : Ball := .exact 0 +lemma CB2_3_3I1R11MassTerm_sound : CB2_3_3I1R11MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB2_3_3I1R11Value a))) := + entropyTerm_zero_ball (CB2_3_3I1R11Mass_sound) +def CB2_3_3I1R11H : Ball := ⟨0, 0⟩ +lemma CB2_3_3I1R11H_sound : CB2_3_3I1R11H.Encloses (homogeneousEntropy CB2_3_3I1R11Value) := by + exact contains_sound (homogeneous_enclosed CB2_3_3I1R11Value CB2_3_3I1R11MassTerm_sound CB2_3_3I1R11Entropy_sound) (by decide +kernel) +def CB2_3_3I1R12Value (a : Fin 6) : ℝ := residualLaw (below (shape 2 3 3)) (fun u => (stageBLaw (shape 2 3 3) u : ℝ)) (stageBPriority (shape 2 3 3)) 1 (fun u a => (littleLaw (shape 2 3 3) u ((stageBPriority (shape 2 3 3)) 1) a : ℝ)) 12 a +def CB2_3_3I1R12Raw (a : Fin 6) : Ball := residualBall (below (shape 2 3 3)) B2_3_3Law (stageBPriority (shape 2 3 3)) 1 (fun u => B2_3_3Little u ((stageBPriority (shape 2 3 3)) 1)) 12 a +lemma CB2_3_3I1R12Raw_sound (a : Fin 6) : + (CB2_3_3I1R12Raw a).Encloses (CB2_3_3I1R12Value a) := by + exact residualBall_sound_on (below (shape 2 3 3)) B2_3_3Law (fun u => (stageBLaw (shape 2 3 3) u : ℝ)) (stageBPriority (shape 2 3 3)) 1 (fun u => B2_3_3Little u ((stageBPriority (shape 2 3 3)) 1)) (fun u a => (littleLaw (shape 2 3 3) u ((stageBPriority (shape 2 3 3)) 1) a : ℝ)) (fun u _ => B2_3_3Law_sound u) (fun u _ a => B2_3_3Little_sound u ((stageBPriority (shape 2 3 3)) 1) a) 12 a +def CB2_3_3I1R12Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB2_3_3I1R12Certificates_valid : + CB2_3_3I1R12Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB2_3_3I1R12CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB2_3_3I1R12P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_3_3I1R12Certificates (CB2_3_3I1R12CertificateIndex a)).input +lemma CB2_3_3I1R12P_check : ∀ a : Fin 6, contains (CB2_3_3I1R12Raw a) (CB2_3_3I1R12P a) = true := by + decide +kernel +lemma CB2_3_3I1R12P_sound (a : Fin 6) : + (CB2_3_3I1R12P a).Encloses (CB2_3_3I1R12Value a) := + contains_sound (CB2_3_3I1R12Raw_sound a) (CB2_3_3I1R12P_check a) +def CB2_3_3I1R12Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_3_3I1R12Certificates (CB2_3_3I1R12CertificateIndex a)).output +lemma CB2_3_3I1R12Terms_sound (a : Fin 6) : + (CB2_3_3I1R12Terms a).Encloses (Foundation.entropyTerm (CB2_3_3I1R12Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB2_3_3I1R12Certificates_valid + (CB2_3_3I1R12CertificateIndex a) (CB2_3_3I1R12P_sound a) +def CB2_3_3I1R12Entropy : Ball := ⟨0, 0⟩ +lemma CB2_3_3I1R12Entropy_sound : CB2_3_3I1R12Entropy.Encloses (Foundation.finiteEntropy CB2_3_3I1R12Value) := by + exact contains_sound (entropyFin_enclosed 6 CB2_3_3I1R12Value CB2_3_3I1R12Terms CB2_3_3I1R12Terms_sound) (by decide +kernel) +def CB2_3_3I1R12Mass : Ball := ⟨0, 0⟩ +lemma CB2_3_3I1R12Mass_sound : CB2_3_3I1R12Mass.Encloses (∑ a, CB2_3_3I1R12Value a) := by + exact contains_sound (finSumBall_sound 6 CB2_3_3I1R12P CB2_3_3I1R12Value CB2_3_3I1R12P_sound) (by decide +kernel) +def CB2_3_3I1R12MassTerm : Ball := .exact 0 +lemma CB2_3_3I1R12MassTerm_sound : CB2_3_3I1R12MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB2_3_3I1R12Value a))) := + entropyTerm_zero_ball (CB2_3_3I1R12Mass_sound) +def CB2_3_3I1R12H : Ball := ⟨0, 0⟩ +lemma CB2_3_3I1R12H_sound : CB2_3_3I1R12H.Encloses (homogeneousEntropy CB2_3_3I1R12Value) := by + exact contains_sound (homogeneous_enclosed CB2_3_3I1R12Value CB2_3_3I1R12MassTerm_sound CB2_3_3I1R12Entropy_sound) (by decide +kernel) +def CB2_3_3I1R13Value (a : Fin 6) : ℝ := residualLaw (below (shape 2 3 3)) (fun u => (stageBLaw (shape 2 3 3) u : ℝ)) (stageBPriority (shape 2 3 3)) 1 (fun u a => (littleLaw (shape 2 3 3) u ((stageBPriority (shape 2 3 3)) 1) a : ℝ)) 13 a +def CB2_3_3I1R13Raw (a : Fin 6) : Ball := residualBall (below (shape 2 3 3)) B2_3_3Law (stageBPriority (shape 2 3 3)) 1 (fun u => B2_3_3Little u ((stageBPriority (shape 2 3 3)) 1)) 13 a +lemma CB2_3_3I1R13Raw_sound (a : Fin 6) : + (CB2_3_3I1R13Raw a).Encloses (CB2_3_3I1R13Value a) := by + exact residualBall_sound_on (below (shape 2 3 3)) B2_3_3Law (fun u => (stageBLaw (shape 2 3 3) u : ℝ)) (stageBPriority (shape 2 3 3)) 1 (fun u => B2_3_3Little u ((stageBPriority (shape 2 3 3)) 1)) (fun u a => (littleLaw (shape 2 3 3) u ((stageBPriority (shape 2 3 3)) 1) a : ℝ)) (fun u _ => B2_3_3Law_sound u) (fun u _ a => B2_3_3Little_sound u ((stageBPriority (shape 2 3 3)) 1) a) 13 a +def CB2_3_3I1R13Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB2_3_3I1R13Certificates_valid : + CB2_3_3I1R13Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB2_3_3I1R13CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB2_3_3I1R13P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_3_3I1R13Certificates (CB2_3_3I1R13CertificateIndex a)).input +lemma CB2_3_3I1R13P_check : ∀ a : Fin 6, contains (CB2_3_3I1R13Raw a) (CB2_3_3I1R13P a) = true := by + decide +kernel +lemma CB2_3_3I1R13P_sound (a : Fin 6) : + (CB2_3_3I1R13P a).Encloses (CB2_3_3I1R13Value a) := + contains_sound (CB2_3_3I1R13Raw_sound a) (CB2_3_3I1R13P_check a) +def CB2_3_3I1R13Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_3_3I1R13Certificates (CB2_3_3I1R13CertificateIndex a)).output +lemma CB2_3_3I1R13Terms_sound (a : Fin 6) : + (CB2_3_3I1R13Terms a).Encloses (Foundation.entropyTerm (CB2_3_3I1R13Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB2_3_3I1R13Certificates_valid + (CB2_3_3I1R13CertificateIndex a) (CB2_3_3I1R13P_sound a) +def CB2_3_3I1R13Entropy : Ball := ⟨0, 0⟩ +lemma CB2_3_3I1R13Entropy_sound : CB2_3_3I1R13Entropy.Encloses (Foundation.finiteEntropy CB2_3_3I1R13Value) := by + exact contains_sound (entropyFin_enclosed 6 CB2_3_3I1R13Value CB2_3_3I1R13Terms CB2_3_3I1R13Terms_sound) (by decide +kernel) +def CB2_3_3I1R13Mass : Ball := ⟨0, 0⟩ +lemma CB2_3_3I1R13Mass_sound : CB2_3_3I1R13Mass.Encloses (∑ a, CB2_3_3I1R13Value a) := by + exact contains_sound (finSumBall_sound 6 CB2_3_3I1R13P CB2_3_3I1R13Value CB2_3_3I1R13P_sound) (by decide +kernel) +def CB2_3_3I1R13MassTerm : Ball := .exact 0 +lemma CB2_3_3I1R13MassTerm_sound : CB2_3_3I1R13MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB2_3_3I1R13Value a))) := + entropyTerm_zero_ball (CB2_3_3I1R13Mass_sound) +def CB2_3_3I1R13H : Ball := ⟨0, 0⟩ +lemma CB2_3_3I1R13H_sound : CB2_3_3I1R13H.Encloses (homogeneousEntropy CB2_3_3I1R13Value) := by + exact contains_sound (homogeneous_enclosed CB2_3_3I1R13Value CB2_3_3I1R13MassTerm_sound CB2_3_3I1R13Entropy_sound) (by decide +kernel) +def CB2_3_3I1R14Value (a : Fin 6) : ℝ := residualLaw (below (shape 2 3 3)) (fun u => (stageBLaw (shape 2 3 3) u : ℝ)) (stageBPriority (shape 2 3 3)) 1 (fun u a => (littleLaw (shape 2 3 3) u ((stageBPriority (shape 2 3 3)) 1) a : ℝ)) 14 a +def CB2_3_3I1R14Raw (a : Fin 6) : Ball := residualBall (below (shape 2 3 3)) B2_3_3Law (stageBPriority (shape 2 3 3)) 1 (fun u => B2_3_3Little u ((stageBPriority (shape 2 3 3)) 1)) 14 a +lemma CB2_3_3I1R14Raw_sound (a : Fin 6) : + (CB2_3_3I1R14Raw a).Encloses (CB2_3_3I1R14Value a) := by + exact residualBall_sound_on (below (shape 2 3 3)) B2_3_3Law (fun u => (stageBLaw (shape 2 3 3) u : ℝ)) (stageBPriority (shape 2 3 3)) 1 (fun u => B2_3_3Little u ((stageBPriority (shape 2 3 3)) 1)) (fun u a => (littleLaw (shape 2 3 3) u ((stageBPriority (shape 2 3 3)) 1) a : ℝ)) (fun u _ => B2_3_3Law_sound u) (fun u _ a => B2_3_3Little_sound u ((stageBPriority (shape 2 3 3)) 1) a) 14 a +def CB2_3_3I1R14Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB2_3_3I1R14Certificates_valid : + CB2_3_3I1R14Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB2_3_3I1R14CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB2_3_3I1R14P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_3_3I1R14Certificates (CB2_3_3I1R14CertificateIndex a)).input +lemma CB2_3_3I1R14P_check : ∀ a : Fin 6, contains (CB2_3_3I1R14Raw a) (CB2_3_3I1R14P a) = true := by + decide +kernel +lemma CB2_3_3I1R14P_sound (a : Fin 6) : + (CB2_3_3I1R14P a).Encloses (CB2_3_3I1R14Value a) := + contains_sound (CB2_3_3I1R14Raw_sound a) (CB2_3_3I1R14P_check a) +def CB2_3_3I1R14Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_3_3I1R14Certificates (CB2_3_3I1R14CertificateIndex a)).output +lemma CB2_3_3I1R14Terms_sound (a : Fin 6) : + (CB2_3_3I1R14Terms a).Encloses (Foundation.entropyTerm (CB2_3_3I1R14Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB2_3_3I1R14Certificates_valid + (CB2_3_3I1R14CertificateIndex a) (CB2_3_3I1R14P_sound a) +def CB2_3_3I1R14Entropy : Ball := ⟨0, 0⟩ +lemma CB2_3_3I1R14Entropy_sound : CB2_3_3I1R14Entropy.Encloses (Foundation.finiteEntropy CB2_3_3I1R14Value) := by + exact contains_sound (entropyFin_enclosed 6 CB2_3_3I1R14Value CB2_3_3I1R14Terms CB2_3_3I1R14Terms_sound) (by decide +kernel) +def CB2_3_3I1R14Mass : Ball := ⟨0, 0⟩ +lemma CB2_3_3I1R14Mass_sound : CB2_3_3I1R14Mass.Encloses (∑ a, CB2_3_3I1R14Value a) := by + exact contains_sound (finSumBall_sound 6 CB2_3_3I1R14P CB2_3_3I1R14Value CB2_3_3I1R14P_sound) (by decide +kernel) +def CB2_3_3I1R14MassTerm : Ball := .exact 0 +lemma CB2_3_3I1R14MassTerm_sound : CB2_3_3I1R14MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB2_3_3I1R14Value a))) := + entropyTerm_zero_ball (CB2_3_3I1R14Mass_sound) +def CB2_3_3I1R14H : Ball := ⟨0, 0⟩ +lemma CB2_3_3I1R14H_sound : CB2_3_3I1R14H.Encloses (homogeneousEntropy CB2_3_3I1R14Value) := by + exact contains_sound (homogeneous_enclosed CB2_3_3I1R14Value CB2_3_3I1R14MassTerm_sound CB2_3_3I1R14Entropy_sound) (by decide +kernel) +def CB2_3_3I1R15Value (a : Fin 6) : ℝ := residualLaw (below (shape 2 3 3)) (fun u => (stageBLaw (shape 2 3 3) u : ℝ)) (stageBPriority (shape 2 3 3)) 1 (fun u a => (littleLaw (shape 2 3 3) u ((stageBPriority (shape 2 3 3)) 1) a : ℝ)) 15 a +def CB2_3_3I1R15Raw (a : Fin 6) : Ball := residualBall (below (shape 2 3 3)) B2_3_3Law (stageBPriority (shape 2 3 3)) 1 (fun u => B2_3_3Little u ((stageBPriority (shape 2 3 3)) 1)) 15 a +lemma CB2_3_3I1R15Raw_sound (a : Fin 6) : + (CB2_3_3I1R15Raw a).Encloses (CB2_3_3I1R15Value a) := by + exact residualBall_sound_on (below (shape 2 3 3)) B2_3_3Law (fun u => (stageBLaw (shape 2 3 3) u : ℝ)) (stageBPriority (shape 2 3 3)) 1 (fun u => B2_3_3Little u ((stageBPriority (shape 2 3 3)) 1)) (fun u a => (littleLaw (shape 2 3 3) u ((stageBPriority (shape 2 3 3)) 1) a : ℝ)) (fun u _ => B2_3_3Law_sound u) (fun u _ a => B2_3_3Little_sound u ((stageBPriority (shape 2 3 3)) 1) a) 15 a +def CB2_3_3I1R15Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB2_3_3I1R15Certificates_valid : + CB2_3_3I1R15Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB2_3_3I1R15CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB2_3_3I1R15P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_3_3I1R15Certificates (CB2_3_3I1R15CertificateIndex a)).input +lemma CB2_3_3I1R15P_check : ∀ a : Fin 6, contains (CB2_3_3I1R15Raw a) (CB2_3_3I1R15P a) = true := by + decide +kernel +lemma CB2_3_3I1R15P_sound (a : Fin 6) : + (CB2_3_3I1R15P a).Encloses (CB2_3_3I1R15Value a) := + contains_sound (CB2_3_3I1R15Raw_sound a) (CB2_3_3I1R15P_check a) +def CB2_3_3I1R15Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_3_3I1R15Certificates (CB2_3_3I1R15CertificateIndex a)).output +lemma CB2_3_3I1R15Terms_sound (a : Fin 6) : + (CB2_3_3I1R15Terms a).Encloses (Foundation.entropyTerm (CB2_3_3I1R15Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB2_3_3I1R15Certificates_valid + (CB2_3_3I1R15CertificateIndex a) (CB2_3_3I1R15P_sound a) +def CB2_3_3I1R15Entropy : Ball := ⟨0, 0⟩ +lemma CB2_3_3I1R15Entropy_sound : CB2_3_3I1R15Entropy.Encloses (Foundation.finiteEntropy CB2_3_3I1R15Value) := by + exact contains_sound (entropyFin_enclosed 6 CB2_3_3I1R15Value CB2_3_3I1R15Terms CB2_3_3I1R15Terms_sound) (by decide +kernel) +def CB2_3_3I1R15Mass : Ball := ⟨0, 0⟩ +lemma CB2_3_3I1R15Mass_sound : CB2_3_3I1R15Mass.Encloses (∑ a, CB2_3_3I1R15Value a) := by + exact contains_sound (finSumBall_sound 6 CB2_3_3I1R15P CB2_3_3I1R15Value CB2_3_3I1R15P_sound) (by decide +kernel) +def CB2_3_3I1R15MassTerm : Ball := .exact 0 +lemma CB2_3_3I1R15MassTerm_sound : CB2_3_3I1R15MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB2_3_3I1R15Value a))) := + entropyTerm_zero_ball (CB2_3_3I1R15Mass_sound) +def CB2_3_3I1R15H : Ball := ⟨0, 0⟩ +lemma CB2_3_3I1R15H_sound : CB2_3_3I1R15H.Encloses (homogeneousEntropy CB2_3_3I1R15Value) := by + exact contains_sound (homogeneous_enclosed CB2_3_3I1R15Value CB2_3_3I1R15MassTerm_sound CB2_3_3I1R15Entropy_sound) (by decide +kernel) +def CB2_3_3I1R16Value (a : Fin 6) : ℝ := residualLaw (below (shape 2 3 3)) (fun u => (stageBLaw (shape 2 3 3) u : ℝ)) (stageBPriority (shape 2 3 3)) 1 (fun u a => (littleLaw (shape 2 3 3) u ((stageBPriority (shape 2 3 3)) 1) a : ℝ)) 16 a +def CB2_3_3I1R16Raw (a : Fin 6) : Ball := residualBall (below (shape 2 3 3)) B2_3_3Law (stageBPriority (shape 2 3 3)) 1 (fun u => B2_3_3Little u ((stageBPriority (shape 2 3 3)) 1)) 16 a +lemma CB2_3_3I1R16Raw_sound (a : Fin 6) : + (CB2_3_3I1R16Raw a).Encloses (CB2_3_3I1R16Value a) := by + exact residualBall_sound_on (below (shape 2 3 3)) B2_3_3Law (fun u => (stageBLaw (shape 2 3 3) u : ℝ)) (stageBPriority (shape 2 3 3)) 1 (fun u => B2_3_3Little u ((stageBPriority (shape 2 3 3)) 1)) (fun u a => (littleLaw (shape 2 3 3) u ((stageBPriority (shape 2 3 3)) 1) a : ℝ)) (fun u _ => B2_3_3Law_sound u) (fun u _ a => B2_3_3Little_sound u ((stageBPriority (shape 2 3 3)) 1) a) 16 a +def CB2_3_3I1R16Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB2_3_3I1R16Certificates_valid : + CB2_3_3I1R16Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB2_3_3I1R16CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB2_3_3I1R16P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_3_3I1R16Certificates (CB2_3_3I1R16CertificateIndex a)).input +lemma CB2_3_3I1R16P_check : ∀ a : Fin 6, contains (CB2_3_3I1R16Raw a) (CB2_3_3I1R16P a) = true := by + decide +kernel +lemma CB2_3_3I1R16P_sound (a : Fin 6) : + (CB2_3_3I1R16P a).Encloses (CB2_3_3I1R16Value a) := + contains_sound (CB2_3_3I1R16Raw_sound a) (CB2_3_3I1R16P_check a) +def CB2_3_3I1R16Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_3_3I1R16Certificates (CB2_3_3I1R16CertificateIndex a)).output +lemma CB2_3_3I1R16Terms_sound (a : Fin 6) : + (CB2_3_3I1R16Terms a).Encloses (Foundation.entropyTerm (CB2_3_3I1R16Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB2_3_3I1R16Certificates_valid + (CB2_3_3I1R16CertificateIndex a) (CB2_3_3I1R16P_sound a) +def CB2_3_3I1R16Entropy : Ball := ⟨0, 0⟩ +lemma CB2_3_3I1R16Entropy_sound : CB2_3_3I1R16Entropy.Encloses (Foundation.finiteEntropy CB2_3_3I1R16Value) := by + exact contains_sound (entropyFin_enclosed 6 CB2_3_3I1R16Value CB2_3_3I1R16Terms CB2_3_3I1R16Terms_sound) (by decide +kernel) +def CB2_3_3I1R16Mass : Ball := ⟨0, 0⟩ +lemma CB2_3_3I1R16Mass_sound : CB2_3_3I1R16Mass.Encloses (∑ a, CB2_3_3I1R16Value a) := by + exact contains_sound (finSumBall_sound 6 CB2_3_3I1R16P CB2_3_3I1R16Value CB2_3_3I1R16P_sound) (by decide +kernel) +def CB2_3_3I1R16MassTerm : Ball := .exact 0 +lemma CB2_3_3I1R16MassTerm_sound : CB2_3_3I1R16MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB2_3_3I1R16Value a))) := + entropyTerm_zero_ball (CB2_3_3I1R16Mass_sound) +def CB2_3_3I1R16H : Ball := ⟨0, 0⟩ +lemma CB2_3_3I1R16H_sound : CB2_3_3I1R16H.Encloses (homogeneousEntropy CB2_3_3I1R16Value) := by + exact contains_sound (homogeneous_enclosed CB2_3_3I1R16Value CB2_3_3I1R16MassTerm_sound CB2_3_3I1R16Entropy_sound) (by decide +kernel) +def CB2_3_3I1ResidualEntropies (a : Fin 17) : Ball := + match a.val with + | 0 => CB2_3_3I1R0H + | 1 => CB2_3_3I1R1H + | 2 => CB2_3_3I1R2H + | 3 => CB2_3_3I1R3H + | 4 => CB2_3_3I1R4H + | 5 => CB2_3_3I1R5H + | 6 => CB2_3_3I1R6H + | 7 => CB2_3_3I1R7H + | 8 => CB2_3_3I1R8H + | 9 => CB2_3_3I1R9H + | 10 => CB2_3_3I1R10H + | 11 => CB2_3_3I1R11H + | 12 => CB2_3_3I1R12H + | 13 => CB2_3_3I1R13H + | 14 => CB2_3_3I1R14H + | 15 => CB2_3_3I1R15H + | 16 => CB2_3_3I1R16H + | _ => (.exact 0) +lemma CB2_3_3I1ResidualEntropies_sound (k : Fin 17) : + (CB2_3_3I1ResidualEntropies k).Encloses (homogeneousEntropy + (residualLaw (below (shape 2 3 3)) (fun u => (stageBLaw (shape 2 3 3) u : ℝ)) (stageBPriority (shape 2 3 3)) 1 (fun u a => (littleLaw (shape 2 3 3) u ((stageBPriority (shape 2 3 3)) 1) a : ℝ)) k)) := by + fin_cases k + · exact CB2_3_3I1R0H_sound + · exact CB2_3_3I1R1H_sound + · exact CB2_3_3I1R2H_sound + · exact CB2_3_3I1R3H_sound + · exact CB2_3_3I1R4H_sound + · exact CB2_3_3I1R5H_sound + · exact CB2_3_3I1R6H_sound + · exact CB2_3_3I1R7H_sound + · exact CB2_3_3I1R8H_sound + · exact CB2_3_3I1R9H_sound + · exact CB2_3_3I1R10H_sound + · exact CB2_3_3I1R11H_sound + · exact CB2_3_3I1R12H_sound + · exact CB2_3_3I1R13H_sound + · exact CB2_3_3I1R14H_sound + · exact CB2_3_3I1R15H_sound + · exact CB2_3_3I1R16H_sound +def CB2_3_3I1S1_3_0Value (a : Fin 6) : ℝ := (littleLaw (shape 2 3 3) (shape 1 3 0) ((stageBPriority (shape 2 3 3)) 1) a : ℝ) +def CB2_3_3I1S1_3_0E_1Log : Ball := .exact 0 +lemma CB2_3_3I1S1_3_0E_1Log_sound : CB2_3_3I1S1_3_0E_1Log.Encloses (Real.log (CB2_3_3I1S1_3_0Value (1 : Fin 6))) := by + exact log_exact_one_ball ((B2_3_3Little_sound (shape 1 3 0) ((stageBPriority (shape 2 3 3)) 1)) (1 : Fin 6)) +def CB2_3_3I1S1_3_0E_1 : Ball := ⟨0, 0⟩ +lemma CB2_3_3I1S1_3_0E_1_sound : CB2_3_3I1S1_3_0E_1.Encloses (Foundation.entropyTerm (CB2_3_3I1S1_3_0Value (1 : Fin 6))) := by + exact contains_sound (entropyTerm_ball ((B2_3_3Little_sound (shape 1 3 0) ((stageBPriority (shape 2 3 3)) 1)) (1 : Fin 6)) CB2_3_3I1S1_3_0E_1Log_sound) (by decide +kernel) +def CB2_3_3I1S1_3_0Terms (a : Fin 6) : Ball := + match a.val with + | 1 => ⟨0, 0⟩ + | _ => (.exact 0) +lemma CB2_3_3I1S1_3_0Terms_sound (a : Fin 6) : + (CB2_3_3I1S1_3_0Terms a).Encloses (Foundation.entropyTerm (CB2_3_3I1S1_3_0Value a)) := by + fin_cases a + · exact (entropyTerm_zero_ball ((B2_3_3Little_sound (shape 1 3 0) ((stageBPriority (shape 2 3 3)) 1)) (0 : Fin 6))) + · exact CB2_3_3I1S1_3_0E_1_sound + · exact (entropyTerm_zero_ball ((B2_3_3Little_sound (shape 1 3 0) ((stageBPriority (shape 2 3 3)) 1)) (2 : Fin 6))) + · exact (entropyTerm_zero_ball ((B2_3_3Little_sound (shape 1 3 0) ((stageBPriority (shape 2 3 3)) 1)) (3 : Fin 6))) + · exact (entropyTerm_zero_ball ((B2_3_3Little_sound (shape 1 3 0) ((stageBPriority (shape 2 3 3)) 1)) (4 : Fin 6))) + · exact (entropyTerm_zero_ball ((B2_3_3Little_sound (shape 1 3 0) ((stageBPriority (shape 2 3 3)) 1)) (5 : Fin 6))) +def CB2_3_3I1S1_3_0Entropy : Ball := ⟨0, 0⟩ +lemma CB2_3_3I1S1_3_0Entropy_sound : CB2_3_3I1S1_3_0Entropy.Encloses (Foundation.finiteEntropy CB2_3_3I1S1_3_0Value) := by + exact contains_sound (entropyFin_enclosed 6 CB2_3_3I1S1_3_0Value CB2_3_3I1S1_3_0Terms CB2_3_3I1S1_3_0Terms_sound) (by decide +kernel) +def CB2_3_3I1S1_3_0Mass : Ball := ⟨1, 0⟩ +lemma CB2_3_3I1S1_3_0Mass_sound : CB2_3_3I1S1_3_0Mass.Encloses (∑ a, CB2_3_3I1S1_3_0Value a) := by + exact contains_sound (finSumBall_sound 6 (B2_3_3Little (shape 1 3 0) ((stageBPriority (shape 2 3 3)) 1)) CB2_3_3I1S1_3_0Value (B2_3_3Little_sound (shape 1 3 0) ((stageBPriority (shape 2 3 3)) 1))) (by decide +kernel) +def CB2_3_3I1S1_3_0MassTermLog : Ball := .exact 0 +lemma CB2_3_3I1S1_3_0MassTermLog_sound : CB2_3_3I1S1_3_0MassTermLog.Encloses (Real.log ((∑ a, CB2_3_3I1S1_3_0Value a))) := by + exact log_exact_one_ball (CB2_3_3I1S1_3_0Mass_sound) +def CB2_3_3I1S1_3_0MassTerm : Ball := ⟨0, 0⟩ +lemma CB2_3_3I1S1_3_0MassTerm_sound : CB2_3_3I1S1_3_0MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB2_3_3I1S1_3_0Value a))) := by + exact contains_sound (entropyTerm_ball (CB2_3_3I1S1_3_0Mass_sound) CB2_3_3I1S1_3_0MassTermLog_sound) (by decide +kernel) +def CB2_3_3I1S1_3_0H : Ball := ⟨0, 0⟩ +lemma CB2_3_3I1S1_3_0H_sound : CB2_3_3I1S1_3_0H.Encloses (homogeneousEntropy CB2_3_3I1S1_3_0Value) := by + exact contains_sound (homogeneous_enclosed CB2_3_3I1S1_3_0Value CB2_3_3I1S1_3_0MassTerm_sound CB2_3_3I1S1_3_0Entropy_sound) (by decide +kernel) +def CB2_3_3I1S2_2_0Value (a : Fin 6) : ℝ := (littleLaw (shape 2 3 3) (shape 2 2 0) ((stageBPriority (shape 2 3 3)) 1) a : ℝ) +def CB2_3_3I1S2_2_0E_2LogWitness : LogWitness := ⟨-1, 897617, 500000⟩ +def CB2_3_3I1S2_2_0E_2Log : Ball := ⟨(-2160236099982276913212034276979 / 20000000000000000000000000000000), (21175823683 / 50000000000000000000000000000000)⟩ +lemma CB2_3_3I1S2_2_0E_2Log_sound : CB2_3_3I1S2_2_0E_2Log.Encloses (Real.log (CB2_3_3I1S2_2_0Value (2 : Fin 6))) := by + exact checkLog_sound logTwoBall_sound ((B2_3_3Little_sound (shape 2 2 0) ((stageBPriority (shape 2 3 3)) 1)) (2 : Fin 6)) (w := CB2_3_3I1S2_2_0E_2LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB2_3_3I1S2_2_0E_2 : Ball := ⟨(1939064647357791456006646571599 / 20000000000000000000000000000000), (7603111731 / 20000000000000000000000000000000)⟩ +lemma CB2_3_3I1S2_2_0E_2_sound : CB2_3_3I1S2_2_0E_2.Encloses (Foundation.entropyTerm (CB2_3_3I1S2_2_0Value (2 : Fin 6))) := by + exact contains_sound (entropyTerm_ball ((B2_3_3Little_sound (shape 2 2 0) ((stageBPriority (shape 2 3 3)) 1)) (2 : Fin 6)) CB2_3_3I1S2_2_0E_2Log_sound) (by decide +kernel) +def CB2_3_3I1S2_2_0E_3LogWitness : LogWitness := ⟨-4, 102383, 62500⟩ +def CB2_3_3I1S2_2_0E_3Log : Ball := ⟨(-56975864894596222495907774317173 / 25000000000000000000000000000000), (52939559207 / 50000000000000000000000000000000)⟩ +lemma CB2_3_3I1S2_2_0E_3Log_sound : CB2_3_3I1S2_2_0E_3Log.Encloses (Real.log (CB2_3_3I1S2_2_0Value (3 : Fin 6))) := by + exact checkLog_sound logTwoBall_sound ((B2_3_3Little_sound (shape 2 2 0) ((stageBPriority (shape 2 3 3)) 1)) (3 : Fin 6)) (w := CB2_3_3I1S2_2_0E_3LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB2_3_3I1S2_2_0E_3 : Ball := ⟨(1166671995100689009559705131583 / 5000000000000000000000000000000), (5420110891 / 50000000000000000000000000000000)⟩ +lemma CB2_3_3I1S2_2_0E_3_sound : CB2_3_3I1S2_2_0E_3.Encloses (Foundation.entropyTerm (CB2_3_3I1S2_2_0Value (3 : Fin 6))) := by + exact contains_sound (entropyTerm_ball ((B2_3_3Little_sound (shape 2 2 0) ((stageBPriority (shape 2 3 3)) 1)) (3 : Fin 6)) CB2_3_3I1S2_2_0E_3Log_sound) (by decide +kernel) +def CB2_3_3I1S2_2_0Terms (a : Fin 6) : Ball := + match a.val with + | 2 => ⟨(1939064647357791456006646571599 / 20000000000000000000000000000000), (7603111731 / 20000000000000000000000000000000)⟩ + | 3 => ⟨(1166671995100689009559705131583 / 5000000000000000000000000000000), (5420110891 / 50000000000000000000000000000000)⟩ + | _ => (.exact 0) +lemma CB2_3_3I1S2_2_0Terms_sound (a : Fin 6) : + (CB2_3_3I1S2_2_0Terms a).Encloses (Foundation.entropyTerm (CB2_3_3I1S2_2_0Value a)) := by + fin_cases a + · exact (entropyTerm_zero_ball ((B2_3_3Little_sound (shape 2 2 0) ((stageBPriority (shape 2 3 3)) 1)) (0 : Fin 6))) + · exact (entropyTerm_zero_ball ((B2_3_3Little_sound (shape 2 2 0) ((stageBPriority (shape 2 3 3)) 1)) (1 : Fin 6))) + · exact CB2_3_3I1S2_2_0E_2_sound + · exact CB2_3_3I1S2_2_0E_3_sound + · exact (entropyTerm_zero_ball ((B2_3_3Little_sound (shape 2 2 0) ((stageBPriority (shape 2 3 3)) 1)) (4 : Fin 6))) + · exact (entropyTerm_zero_ball ((B2_3_3Little_sound (shape 2 2 0) ((stageBPriority (shape 2 3 3)) 1)) (5 : Fin 6))) +def CB2_3_3I1S2_2_0Entropy : Ball := ⟨(6605752627760547494245467097931 / 20000000000000000000000000000000), (48855780437 / 100000000000000000000000000000000)⟩ +lemma CB2_3_3I1S2_2_0Entropy_sound : CB2_3_3I1S2_2_0Entropy.Encloses (Foundation.finiteEntropy CB2_3_3I1S2_2_0Value) := by + exact contains_sound (entropyFin_enclosed 6 CB2_3_3I1S2_2_0Value CB2_3_3I1S2_2_0Terms CB2_3_3I1S2_2_0Terms_sound) (by decide +kernel) +def CB2_3_3I1S2_2_0Mass : Ball := ⟨1, 0⟩ +lemma CB2_3_3I1S2_2_0Mass_sound : CB2_3_3I1S2_2_0Mass.Encloses (∑ a, CB2_3_3I1S2_2_0Value a) := by + exact contains_sound (finSumBall_sound 6 (B2_3_3Little (shape 2 2 0) ((stageBPriority (shape 2 3 3)) 1)) CB2_3_3I1S2_2_0Value (B2_3_3Little_sound (shape 2 2 0) ((stageBPriority (shape 2 3 3)) 1))) (by decide +kernel) +def CB2_3_3I1S2_2_0MassTermLog : Ball := .exact 0 +lemma CB2_3_3I1S2_2_0MassTermLog_sound : CB2_3_3I1S2_2_0MassTermLog.Encloses (Real.log ((∑ a, CB2_3_3I1S2_2_0Value a))) := by + exact log_exact_one_ball (CB2_3_3I1S2_2_0Mass_sound) +def CB2_3_3I1S2_2_0MassTerm : Ball := ⟨0, 0⟩ +lemma CB2_3_3I1S2_2_0MassTerm_sound : CB2_3_3I1S2_2_0MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB2_3_3I1S2_2_0Value a))) := by + exact contains_sound (entropyTerm_ball (CB2_3_3I1S2_2_0Mass_sound) CB2_3_3I1S2_2_0MassTermLog_sound) (by decide +kernel) +def CB2_3_3I1S2_2_0H : Ball := ⟨(6605752627760547494245467097931 / 20000000000000000000000000000000), (48855780437 / 100000000000000000000000000000000)⟩ +lemma CB2_3_3I1S2_2_0H_sound : CB2_3_3I1S2_2_0H.Encloses (homogeneousEntropy CB2_3_3I1S2_2_0Value) := by + exact contains_sound (homogeneous_enclosed CB2_3_3I1S2_2_0Value CB2_3_3I1S2_2_0MassTerm_sound CB2_3_3I1S2_2_0Entropy_sound) (by decide +kernel) +def CB2_3_3I1Singles (s : Shape) : Ball := + match s 0, s 1, s 2 with + | 1, 3, 0 => CB2_3_3I1S1_3_0H + | 2, 2, 0 => CB2_3_3I1S2_2_0H + | _, _, _ => (.exact 0) +lemma CB2_3_3I1Singles_sound (u : Shape) (hu : u ∈ below (shape 2 3 3)) + (hd : designated (stageBPriority (shape 2 3 3)) 1 u) : + (CB2_3_3I1Singles u).Encloses (homogeneousEntropy ((fun u a => (littleLaw (shape 2 3 3) u ((stageBPriority (shape 2 3 3)) 1) a : ℝ)) u)) := by + rw [B2_3_3_below] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl + · exact (show ¬ designated (stageBPriority (shape 2 3 3)) 1 (shape 0 1 3) by decide +kernel) hd |>.elim + · exact (show ¬ designated (stageBPriority (shape 2 3 3)) 1 (shape 0 2 2) by decide +kernel) hd |>.elim + · exact (show ¬ designated (stageBPriority (shape 2 3 3)) 1 (shape 0 3 1) by decide +kernel) hd |>.elim + · exact (show ¬ designated (stageBPriority (shape 2 3 3)) 1 (shape 1 0 3) by decide +kernel) hd |>.elim + · exact (show ¬ designated (stageBPriority (shape 2 3 3)) 1 (shape 1 1 2) by decide +kernel) hd |>.elim + · exact (show ¬ designated (stageBPriority (shape 2 3 3)) 1 (shape 1 2 1) by decide +kernel) hd |>.elim + · exact CB2_3_3I1S1_3_0H_sound + · exact (show ¬ designated (stageBPriority (shape 2 3 3)) 1 (shape 2 0 2) by decide +kernel) hd |>.elim + · exact (show ¬ designated (stageBPriority (shape 2 3 3)) 1 (shape 2 1 1) by decide +kernel) hd |>.elim + · exact CB2_3_3I1S2_2_0H_sound +def CB2_3_3I1Singleton : Ball := ⟨(380188573954161022314410796219 / 100000000000000000000000000000000), (70296341 / 12500000000000000000000000000000)⟩ +lemma CB2_3_3I1Singleton_sound : CB2_3_3I1Singleton.Encloses + (singletonEntropy (below (shape 2 3 3)) (fun u => (stageBLaw (shape 2 3 3) u : ℝ)) (stageBPriority (shape 2 3 3)) 1 (fun u a => (littleLaw (shape 2 3 3) u ((stageBPriority (shape 2 3 3)) 1) a : ℝ))) := by + exact contains_sound (singletonBall_sound (below (shape 2 3 3)) B2_3_3Law (fun u => (stageBLaw (shape 2 3 3) u : ℝ)) (stageBPriority (shape 2 3 3)) 1 + CB2_3_3I1Singles (fun u a => (littleLaw (shape 2 3 3) u ((stageBPriority (shape 2 3 3)) 1) a : ℝ)) (fun u _ => B2_3_3Law_sound u) CB2_3_3I1Singles_sound) (by decide +kernel) +def CB2_3_3I1Group : Ball := ⟨(3466818604203486305819349709207 / 100000000000000000000000000000000), (28824183223 / 25000000000000000000000000000000)⟩ +lemma CB2_3_3I1Group_sound : CB2_3_3I1Group.Encloses + (groupedEntropy (below (shape 2 3 3)) (fun u => (stageBLaw (shape 2 3 3) u : ℝ)) (stageBPriority (shape 2 3 3)) 1 (fun u a => (littleLaw (shape 2 3 3) u ((stageBPriority (shape 2 3 3)) 1) a : ℝ))) := by + exact contains_sound (Ball.add_sound CB2_3_3I1Singleton_sound + (finSumBall_sound 17 CB2_3_3I1ResidualEntropies _ CB2_3_3I1ResidualEntropies_sound)) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CB2_3_3I1H : Ball := ⟨(11447914273235516497169145549213 / 12500000000000000000000000000000), (311251576779 / 100000000000000000000000000000000)⟩ +lemma CB2_3_3I1_sound : CB2_3_3I1H.Encloses (stageBCapacity (shape 2 3 3) 1) := by + have hb := contains_sound (Ball.add_sound CB2_3_3I1PairH_sound + (Ball.neg_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) CB2_3_3I1Group_sound))) + (show contains (.add CB2_3_3I1PairH (.neg (.mul (.exact 2) CB2_3_3I1Group))) CB2_3_3I1H = true by decide +kernel) + unfold CB2_3_3I1PairValue at hb + simpa only [stageBCapacity, nativeCapacity, + show (1 : Fin 3) ≠ 0 by decide, ite_false, sub_eq_add_neg] using hb + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/CapacityB/CapB2_3_3I2.lean b/lean/OAI/LinearAlgebra/MatrixFields/CapacityB/CapB2_3_3I2.lean new file mode 100644 index 0000000000000000000000000000000000000000..5d6c3fc8f7bd48c3000e6e03383cb5c4fe06214d --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/CapacityB/CapB2_3_3I2.lean @@ -0,0 +1,1052 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Certificates.LittleB2_3_3 + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CB2_3_3I2PairValue (a : PairSlot) : ℝ := pairLaw (below (shape 2 3 3)) (shape 2 3 3) (fun u => (stageBLaw (shape 2 3 3) u : ℝ)) (fun u a => (littleLaw (shape 2 3 3) u ((stageBPriority (shape 2 3 3)) 2) a : ℝ)) a +def CB2_3_3I2PairRaw (a : PairSlot) : Ball := pairLawBall (below (shape 2 3 3)) (shape 2 3 3) B2_3_3Law (fun u => B2_3_3Little u ((stageBPriority (shape 2 3 3)) 2)) a +lemma CB2_3_3I2PairRaw_sound (a : PairSlot) : + (CB2_3_3I2PairRaw a).Encloses (CB2_3_3I2PairValue a) := by + exact pairLawBall_sound_on (below (shape 2 3 3)) (shape 2 3 3) B2_3_3Law (fun u => (stageBLaw (shape 2 3 3) u : ℝ)) (fun u => B2_3_3Little u ((stageBPriority (shape 2 3 3)) 2)) (fun u a => (littleLaw (shape 2 3 3) u ((stageBPriority (shape 2 3 3)) 2) a : ℝ)) (fun u _ => B2_3_3Law_sound u) (fun u _ a => B2_3_3Little_sound u ((stageBPriority (shape 2 3 3)) 2) a) (fun u _ a => B2_3_3Little_sound (complement (shape 2 3 3) u) ((stageBPriority (shape 2 3 3)) 2) a) a +def CB2_3_3I2PairCertificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(163911127094417036878035098501 / 12500000000000000000000000000000), (1 / 20000000000000000000000000000000)⟩ ⟨(710416976898713047679469856213 / 12500000000000000000000000000000), (2221410029 / 100000000000000000000000000000000)⟩ ⟨(-108353988757806318051603335024857 / 25000000000000000000000000000000), (33881317969 / 20000000000000000000000000000000)⟩ ⟨-7, 163911127094417036878035098501, 97656250000000000000000000000⟩, + .log ⟨(46643247536423404746233613795319 / 100000000000000000000000000000000), (7 / 20000000000000000000000000000000)⟩ ⟨(4446512544749424295078479601311 / 12500000000000000000000000000000), (29631275637 / 100000000000000000000000000000000)⟩ ⟨(-38132100825759801047955625284901 / 50000000000000000000000000000000), (15881867781 / 25000000000000000000000000000000)⟩ ⟨-2, 46643247536423404746233613795319, 25000000000000000000000000000000⟩, + .log ⟨(2045463446821258958742105416673 / 100000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ ⟨(1591184750829993068331186632661 / 20000000000000000000000000000000), (1516003073 / 50000000000000000000000000000000)⟩ ⟨(-388954579780627427050574663024177 / 100000000000000000000000000000000), (148230765927 / 100000000000000000000000000000000)⟩ ⟨-6, 2045463446821258958742105416673, 1562500000000000000000000000000⟩] +lemma CB2_3_3I2PairCertificates_valid : + CB2_3_3I2PairCertificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB2_3_3I2PairCertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 4, 0 => 1 + | 2, 1 => 2 + | 3, 1 => 3 + | 1, 2 => 2 + | 1, 3 => 3 + | 0, 4 => 1 + | _, _ => 0 +def CB2_3_3I2PairP (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CB2_3_3I2PairCertificates (CB2_3_3I2PairCertificateIndex a)).input +lemma CB2_3_3I2PairP_check : ∀ a : PairSlot, contains (CB2_3_3I2PairRaw a) (CB2_3_3I2PairP a) = true := by + decide +kernel +lemma CB2_3_3I2PairP_sound (a : PairSlot) : + (CB2_3_3I2PairP a).Encloses (CB2_3_3I2PairValue a) := + contains_sound (CB2_3_3I2PairRaw_sound a) (CB2_3_3I2PairP_check a) +def CB2_3_3I2PairTerms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CB2_3_3I2PairCertificates (CB2_3_3I2PairCertificateIndex a)).output +lemma CB2_3_3I2PairTerms_sound (a : PairSlot) : + (CB2_3_3I2PairTerms a).Encloses (Foundation.entropyTerm (CB2_3_3I2PairValue a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB2_3_3I2PairCertificates_valid + (CB2_3_3I2PairCertificateIndex a) (CB2_3_3I2PairP_sound a) +def CB2_3_3I2PairEntropy : Ball := ⟨(49211359927335064083719528823497 / 50000000000000000000000000000000), (8721172953 / 12500000000000000000000000000000)⟩ +lemma CB2_3_3I2PairEntropy_sound : CB2_3_3I2PairEntropy.Encloses (Foundation.finiteEntropy CB2_3_3I2PairValue) := by + exact contains_sound (entropyPair_enclosed CB2_3_3I2PairValue CB2_3_3I2PairTerms CB2_3_3I2PairTerms_sound) (by decide +kernel) +def CB2_3_3I2PairMass : Ball := ⟨1, (43 / 50000000000000000000000000000000)⟩ +lemma CB2_3_3I2PairMass_sound : CB2_3_3I2PairMass.Encloses (∑ a, CB2_3_3I2PairValue a) := by + exact contains_sound (pairSumBall_sound CB2_3_3I2PairP CB2_3_3I2PairValue CB2_3_3I2PairP_sound) (by decide +kernel) +def CB2_3_3I2PairMassTermLogWitness : LogWitness := ⟨0, 1, 1⟩ +def CB2_3_3I2PairMassTermLog : Ball := ⟨0, (2646977971 / 12500000000000000000000000000000)⟩ +lemma CB2_3_3I2PairMassTermLog_sound : CB2_3_3I2PairMassTermLog.Encloses (Real.log ((∑ a, CB2_3_3I2PairValue a))) := by + exact checkLog_sound logTwoBall_sound (CB2_3_3I2PairMass_sound) (w := CB2_3_3I2PairMassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB2_3_3I2PairMassTerm : Ball := ⟨0, (21175823769 / 100000000000000000000000000000000)⟩ +lemma CB2_3_3I2PairMassTerm_sound : CB2_3_3I2PairMassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB2_3_3I2PairValue a))) := by + exact contains_sound (entropyTerm_ball (CB2_3_3I2PairMass_sound) CB2_3_3I2PairMassTermLog_sound) (by decide +kernel) +def CB2_3_3I2PairH : Ball := ⟨(49211359927335064083719528823497 / 50000000000000000000000000000000), (90945207393 / 100000000000000000000000000000000)⟩ +lemma CB2_3_3I2PairH_sound : CB2_3_3I2PairH.Encloses (homogeneousEntropy CB2_3_3I2PairValue) := by + exact contains_sound (homogeneous_enclosed CB2_3_3I2PairValue CB2_3_3I2PairMassTerm_sound CB2_3_3I2PairEntropy_sound) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CB2_3_3I2R0Value (a : Fin 6) : ℝ := residualLaw (below (shape 2 3 3)) (fun u => (stageBLaw (shape 2 3 3) u : ℝ)) (stageBPriority (shape 2 3 3)) 2 (fun u a => (littleLaw (shape 2 3 3) u ((stageBPriority (shape 2 3 3)) 2) a : ℝ)) 0 a +def CB2_3_3I2R0Raw (a : Fin 6) : Ball := residualBall (below (shape 2 3 3)) B2_3_3Law (stageBPriority (shape 2 3 3)) 2 (fun u => B2_3_3Little u ((stageBPriority (shape 2 3 3)) 2)) 0 a +lemma CB2_3_3I2R0Raw_sound (a : Fin 6) : + (CB2_3_3I2R0Raw a).Encloses (CB2_3_3I2R0Value a) := by + exact residualBall_sound_on (below (shape 2 3 3)) B2_3_3Law (fun u => (stageBLaw (shape 2 3 3) u : ℝ)) (stageBPriority (shape 2 3 3)) 2 (fun u => B2_3_3Little u ((stageBPriority (shape 2 3 3)) 2)) (fun u a => (littleLaw (shape 2 3 3) u ((stageBPriority (shape 2 3 3)) 2) a : ℝ)) (fun u _ => B2_3_3Law_sound u) (fun u _ a => B2_3_3Little_sound u ((stageBPriority (shape 2 3 3)) 2) a) 0 a +def CB2_3_3I2R0Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(163911127094417036878035098501 / 12500000000000000000000000000000), (1 / 20000000000000000000000000000000)⟩ ⟨(710416976898713047679469856213 / 12500000000000000000000000000000), (2221410029 / 100000000000000000000000000000000)⟩ ⟨(-108353988757806318051603335024857 / 25000000000000000000000000000000), (33881317969 / 20000000000000000000000000000000)⟩ ⟨-7, 163911127094417036878035098501, 97656250000000000000000000000⟩] +lemma CB2_3_3I2R0Certificates_valid : + CB2_3_3I2R0Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB2_3_3I2R0CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | 0 => 1 + | _ => 0 +def CB2_3_3I2R0P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_3_3I2R0Certificates (CB2_3_3I2R0CertificateIndex a)).input +lemma CB2_3_3I2R0P_check : ∀ a : Fin 6, contains (CB2_3_3I2R0Raw a) (CB2_3_3I2R0P a) = true := by + decide +kernel +lemma CB2_3_3I2R0P_sound (a : Fin 6) : + (CB2_3_3I2R0P a).Encloses (CB2_3_3I2R0Value a) := + contains_sound (CB2_3_3I2R0Raw_sound a) (CB2_3_3I2R0P_check a) +def CB2_3_3I2R0Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_3_3I2R0Certificates (CB2_3_3I2R0CertificateIndex a)).output +lemma CB2_3_3I2R0Terms_sound (a : Fin 6) : + (CB2_3_3I2R0Terms a).Encloses (Foundation.entropyTerm (CB2_3_3I2R0Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB2_3_3I2R0Certificates_valid + (CB2_3_3I2R0CertificateIndex a) (CB2_3_3I2R0P_sound a) +def CB2_3_3I2R0Entropy : Ball := ⟨(710416976898713047679469856213 / 12500000000000000000000000000000), (2221410029 / 100000000000000000000000000000000)⟩ +lemma CB2_3_3I2R0Entropy_sound : CB2_3_3I2R0Entropy.Encloses (Foundation.finiteEntropy CB2_3_3I2R0Value) := by + exact contains_sound (entropyFin_enclosed 6 CB2_3_3I2R0Value CB2_3_3I2R0Terms CB2_3_3I2R0Terms_sound) (by decide +kernel) +def CB2_3_3I2R0Mass : Ball := ⟨(163911127094417036878035098501 / 12500000000000000000000000000000), (1 / 20000000000000000000000000000000)⟩ +lemma CB2_3_3I2R0Mass_sound : CB2_3_3I2R0Mass.Encloses (∑ a, CB2_3_3I2R0Value a) := by + exact contains_sound (finSumBall_sound 6 CB2_3_3I2R0P CB2_3_3I2R0Value CB2_3_3I2R0P_sound) (by decide +kernel) +def CB2_3_3I2R0MassTermLogWitness : LogWitness := ⟨-7, 163911127094417036878035098501, 97656250000000000000000000000⟩ +def CB2_3_3I2R0MassTermLog : Ball := ⟨(-108353988757806318051603335024857 / 25000000000000000000000000000000), (33881317969 / 20000000000000000000000000000000)⟩ +lemma CB2_3_3I2R0MassTermLog_sound : CB2_3_3I2R0MassTermLog.Encloses (Real.log ((∑ a, CB2_3_3I2R0Value a))) := by + exact checkLog_sound logTwoBall_sound (CB2_3_3I2R0Mass_sound) (w := CB2_3_3I2R0MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB2_3_3I2R0MassTerm : Ball := ⟨(710416976898713047679469856213 / 12500000000000000000000000000000), (2221410029 / 100000000000000000000000000000000)⟩ +lemma CB2_3_3I2R0MassTerm_sound : CB2_3_3I2R0MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB2_3_3I2R0Value a))) := by + exact contains_sound (entropyTerm_ball (CB2_3_3I2R0Mass_sound) CB2_3_3I2R0MassTermLog_sound) (by decide +kernel) +def CB2_3_3I2R0H : Ball := ⟨0, (2221410029 / 50000000000000000000000000000000)⟩ +lemma CB2_3_3I2R0H_sound : CB2_3_3I2R0H.Encloses (homogeneousEntropy CB2_3_3I2R0Value) := by + exact contains_sound (homogeneous_enclosed CB2_3_3I2R0Value CB2_3_3I2R0MassTerm_sound CB2_3_3I2R0Entropy_sound) (by decide +kernel) +def CB2_3_3I2R1Value (a : Fin 6) : ℝ := residualLaw (below (shape 2 3 3)) (fun u => (stageBLaw (shape 2 3 3) u : ℝ)) (stageBPriority (shape 2 3 3)) 2 (fun u a => (littleLaw (shape 2 3 3) u ((stageBPriority (shape 2 3 3)) 2) a : ℝ)) 1 a +def CB2_3_3I2R1Raw (a : Fin 6) : Ball := residualBall (below (shape 2 3 3)) B2_3_3Law (stageBPriority (shape 2 3 3)) 2 (fun u => B2_3_3Little u ((stageBPriority (shape 2 3 3)) 2)) 1 a +lemma CB2_3_3I2R1Raw_sound (a : Fin 6) : + (CB2_3_3I2R1Raw a).Encloses (CB2_3_3I2R1Value a) := by + exact residualBall_sound_on (below (shape 2 3 3)) B2_3_3Law (fun u => (stageBLaw (shape 2 3 3) u : ℝ)) (stageBPriority (shape 2 3 3)) 2 (fun u => B2_3_3Little u ((stageBPriority (shape 2 3 3)) 2)) (fun u a => (littleLaw (shape 2 3 3) u ((stageBPriority (shape 2 3 3)) 2) a : ℝ)) (fun u _ => B2_3_3Law_sound u) (fun u _ a => B2_3_3Little_sound u ((stageBPriority (shape 2 3 3)) 2) a) 1 a +def CB2_3_3I2R1Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(23763436341818321284544175804257 / 50000000000000000000000000000000), (33 / 100000000000000000000000000000000)⟩ ⟨(35354047389686535436129562195663 / 100000000000000000000000000000000), (30192620343 / 100000000000000000000000000000000)⟩ ⟨(-74387489421029854998168788216519 / 100000000000000000000000000000000), (31763735559 / 50000000000000000000000000000000)⟩ ⟨-2, 23763436341818321284544175804257, 12500000000000000000000000000000⟩] +lemma CB2_3_3I2R1Certificates_valid : + CB2_3_3I2R1Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB2_3_3I2R1CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | 1 => 1 + | _ => 0 +def CB2_3_3I2R1P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_3_3I2R1Certificates (CB2_3_3I2R1CertificateIndex a)).input +lemma CB2_3_3I2R1P_check : ∀ a : Fin 6, contains (CB2_3_3I2R1Raw a) (CB2_3_3I2R1P a) = true := by + decide +kernel +lemma CB2_3_3I2R1P_sound (a : Fin 6) : + (CB2_3_3I2R1P a).Encloses (CB2_3_3I2R1Value a) := + contains_sound (CB2_3_3I2R1Raw_sound a) (CB2_3_3I2R1P_check a) +def CB2_3_3I2R1Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_3_3I2R1Certificates (CB2_3_3I2R1CertificateIndex a)).output +lemma CB2_3_3I2R1Terms_sound (a : Fin 6) : + (CB2_3_3I2R1Terms a).Encloses (Foundation.entropyTerm (CB2_3_3I2R1Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB2_3_3I2R1Certificates_valid + (CB2_3_3I2R1CertificateIndex a) (CB2_3_3I2R1P_sound a) +def CB2_3_3I2R1Entropy : Ball := ⟨(35354047389686535436129562195663 / 100000000000000000000000000000000), (30192620343 / 100000000000000000000000000000000)⟩ +lemma CB2_3_3I2R1Entropy_sound : CB2_3_3I2R1Entropy.Encloses (Foundation.finiteEntropy CB2_3_3I2R1Value) := by + exact contains_sound (entropyFin_enclosed 6 CB2_3_3I2R1Value CB2_3_3I2R1Terms CB2_3_3I2R1Terms_sound) (by decide +kernel) +def CB2_3_3I2R1Mass : Ball := ⟨(23763436341818321284544175804257 / 50000000000000000000000000000000), (33 / 100000000000000000000000000000000)⟩ +lemma CB2_3_3I2R1Mass_sound : CB2_3_3I2R1Mass.Encloses (∑ a, CB2_3_3I2R1Value a) := by + exact contains_sound (finSumBall_sound 6 CB2_3_3I2R1P CB2_3_3I2R1Value CB2_3_3I2R1P_sound) (by decide +kernel) +def CB2_3_3I2R1MassTermLogWitness : LogWitness := ⟨-2, 23763436341818321284544175804257, 12500000000000000000000000000000⟩ +def CB2_3_3I2R1MassTermLog : Ball := ⟨(-74387489421029854998168788216519 / 100000000000000000000000000000000), (31763735559 / 50000000000000000000000000000000)⟩ +lemma CB2_3_3I2R1MassTermLog_sound : CB2_3_3I2R1MassTermLog.Encloses (Real.log ((∑ a, CB2_3_3I2R1Value a))) := by + exact checkLog_sound logTwoBall_sound (CB2_3_3I2R1Mass_sound) (w := CB2_3_3I2R1MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB2_3_3I2R1MassTerm : Ball := ⟨(35354047389686535436129562195663 / 100000000000000000000000000000000), (30192620343 / 100000000000000000000000000000000)⟩ +lemma CB2_3_3I2R1MassTerm_sound : CB2_3_3I2R1MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB2_3_3I2R1Value a))) := by + exact contains_sound (entropyTerm_ball (CB2_3_3I2R1Mass_sound) CB2_3_3I2R1MassTermLog_sound) (by decide +kernel) +def CB2_3_3I2R1H : Ball := ⟨0, (30192620343 / 50000000000000000000000000000000)⟩ +lemma CB2_3_3I2R1H_sound : CB2_3_3I2R1H.Encloses (homogeneousEntropy CB2_3_3I2R1Value) := by + exact contains_sound (homogeneous_enclosed CB2_3_3I2R1Value CB2_3_3I2R1MassTerm_sound CB2_3_3I2R1Entropy_sound) (by decide +kernel) +def CB2_3_3I2R2Value (a : Fin 6) : ℝ := residualLaw (below (shape 2 3 3)) (fun u => (stageBLaw (shape 2 3 3) u : ℝ)) (stageBPriority (shape 2 3 3)) 2 (fun u a => (littleLaw (shape 2 3 3) u ((stageBPriority (shape 2 3 3)) 2) a : ℝ)) 2 a +def CB2_3_3I2R2Raw (a : Fin 6) : Ball := residualBall (below (shape 2 3 3)) B2_3_3Law (stageBPriority (shape 2 3 3)) 2 (fun u => B2_3_3Little u ((stageBPriority (shape 2 3 3)) 2)) 2 a +lemma CB2_3_3I2R2Raw_sound (a : Fin 6) : + (CB2_3_3I2R2Raw a).Encloses (CB2_3_3I2R2Value a) := by + exact residualBall_sound_on (below (shape 2 3 3)) B2_3_3Law (fun u => (stageBLaw (shape 2 3 3) u : ℝ)) (stageBPriority (shape 2 3 3)) 2 (fun u => B2_3_3Little u ((stageBPriority (shape 2 3 3)) 2)) (fun u a => (littleLaw (shape 2 3 3) u ((stageBPriority (shape 2 3 3)) 2) a : ℝ)) (fun u _ => B2_3_3Law_sound u) (fun u _ a => B2_3_3Little_sound u ((stageBPriority (shape 2 3 3)) 2) a) 2 a +def CB2_3_3I2R2Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(31205955344773960444357789426907 / 100000000000000000000000000000000), (7 / 50000000000000000000000000000000)⟩ ⟨(1453649833270426393629439063227 / 4000000000000000000000000000000), (9912177139 / 50000000000000000000000000000000)⟩ ⟨(-116456123295218080574198913066799 / 100000000000000000000000000000000), (63527471093 / 100000000000000000000000000000000)⟩ ⟨-2, 31205955344773960444357789426907, 25000000000000000000000000000000⟩, + .log ⟨(35926712876938846340860531359 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(940582898251429604961959637733 / 100000000000000000000000000000000), (334742213 / 100000000000000000000000000000000)⟩ ⟨(-654514999377513635457181126009841 / 100000000000000000000000000000000), (232934061209 / 100000000000000000000000000000000)⟩ ⟨-10, 35926712876938846340860531359, 24414062500000000000000000000⟩] +lemma CB2_3_3I2R2Certificates_valid : + CB2_3_3I2R2Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB2_3_3I2R2CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | 2 => 1 + | 3 => 2 + | _ => 0 +def CB2_3_3I2R2P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_3_3I2R2Certificates (CB2_3_3I2R2CertificateIndex a)).input +lemma CB2_3_3I2R2P_check : ∀ a : Fin 6, contains (CB2_3_3I2R2Raw a) (CB2_3_3I2R2P a) = true := by + decide +kernel +lemma CB2_3_3I2R2P_sound (a : Fin 6) : + (CB2_3_3I2R2P a).Encloses (CB2_3_3I2R2Value a) := + contains_sound (CB2_3_3I2R2Raw_sound a) (CB2_3_3I2R2P_check a) +def CB2_3_3I2R2Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_3_3I2R2Certificates (CB2_3_3I2R2CertificateIndex a)).output +lemma CB2_3_3I2R2Terms_sound (a : Fin 6) : + (CB2_3_3I2R2Terms a).Encloses (Foundation.entropyTerm (CB2_3_3I2R2Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB2_3_3I2R2Certificates_valid + (CB2_3_3I2R2CertificateIndex a) (CB2_3_3I2R2P_sound a) +def CB2_3_3I2R2Entropy : Ball := ⟨(4660228591251511180712242027301 / 12500000000000000000000000000000), (20159096491 / 100000000000000000000000000000000)⟩ +lemma CB2_3_3I2R2Entropy_sound : CB2_3_3I2R2Entropy.Encloses (Foundation.finiteEntropy CB2_3_3I2R2Value) := by + exact contains_sound (entropyFin_enclosed 6 CB2_3_3I2R2Value CB2_3_3I2R2Terms CB2_3_3I2R2Terms_sound) (by decide +kernel) +def CB2_3_3I2R2Mass : Ball := ⟨(31349662196281715829721231552343 / 100000000000000000000000000000000), (3 / 20000000000000000000000000000000)⟩ +lemma CB2_3_3I2R2Mass_sound : CB2_3_3I2R2Mass.Encloses (∑ a, CB2_3_3I2R2Value a) := by + exact contains_sound (finSumBall_sound 6 CB2_3_3I2R2P CB2_3_3I2R2Value CB2_3_3I2R2P_sound) (by decide +kernel) +def CB2_3_3I2R2MassTermLogWitness : LogWitness := ⟨-2, 31349662196281715829721231552343, 25000000000000000000000000000000⟩ +def CB2_3_3I2R2MassTermLog : Ball := ⟨(-115996669420543774296075561313107 / 100000000000000000000000000000000), (7940933887 / 12500000000000000000000000000000)⟩ +lemma CB2_3_3I2R2MassTermLog_sound : CB2_3_3I2R2MassTermLog.Encloses (Real.log ((∑ a, CB2_3_3I2R2Value a))) := by + exact checkLog_sound logTwoBall_sound (CB2_3_3I2R2Mass_sound) (w := CB2_3_3I2R2MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB2_3_3I2R2MassTerm : Ball := ⟨(9091141005569521211958861081541 / 25000000000000000000000000000000), (2489455951 / 12500000000000000000000000000000)⟩ +lemma CB2_3_3I2R2MassTerm_sound : CB2_3_3I2R2MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB2_3_3I2R2Value a))) := by + exact contains_sound (entropyTerm_ball (CB2_3_3I2R2Mass_sound) CB2_3_3I2R2MassTermLog_sound) (by decide +kernel) +def CB2_3_3I2R2H : Ball := ⟨(229316176933501149465622973061 / 25000000000000000000000000000000), (40074744099 / 100000000000000000000000000000000)⟩ +lemma CB2_3_3I2R2H_sound : CB2_3_3I2R2H.Encloses (homogeneousEntropy CB2_3_3I2R2Value) := by + exact contains_sound (homogeneous_enclosed CB2_3_3I2R2Value CB2_3_3I2R2MassTerm_sound CB2_3_3I2R2Entropy_sound) (by decide +kernel) +def CB2_3_3I2R3Value (a : Fin 6) : ℝ := residualLaw (below (shape 2 3 3)) (fun u => (stageBLaw (shape 2 3 3) u : ℝ)) (stageBPriority (shape 2 3 3)) 2 (fun u a => (littleLaw (shape 2 3 3) u ((stageBPriority (shape 2 3 3)) 2) a : ℝ)) 3 a +def CB2_3_3I2R3Raw (a : Fin 6) : Ball := residualBall (below (shape 2 3 3)) B2_3_3Law (stageBPriority (shape 2 3 3)) 2 (fun u => B2_3_3Little u ((stageBPriority (shape 2 3 3)) 2)) 3 a +lemma CB2_3_3I2R3Raw_sound (a : Fin 6) : + (CB2_3_3I2R3Raw a).Encloses (CB2_3_3I2R3Value a) := by + exact residualBall_sound_on (below (shape 2 3 3)) B2_3_3Law (fun u => (stageBLaw (shape 2 3 3) u : ℝ)) (stageBPriority (shape 2 3 3)) 2 (fun u => B2_3_3Little u ((stageBPriority (shape 2 3 3)) 2)) (fun u a => (littleLaw (shape 2 3 3) u ((stageBPriority (shape 2 3 3)) 2) a : ℝ)) (fun u _ => B2_3_3Law_sound u) (fun u _ a => B2_3_3Little_sound u ((stageBPriority (shape 2 3 3)) 2) a) 3 a +def CB2_3_3I2R3Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB2_3_3I2R3Certificates_valid : + CB2_3_3I2R3Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB2_3_3I2R3CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB2_3_3I2R3P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_3_3I2R3Certificates (CB2_3_3I2R3CertificateIndex a)).input +lemma CB2_3_3I2R3P_check : ∀ a : Fin 6, contains (CB2_3_3I2R3Raw a) (CB2_3_3I2R3P a) = true := by + decide +kernel +lemma CB2_3_3I2R3P_sound (a : Fin 6) : + (CB2_3_3I2R3P a).Encloses (CB2_3_3I2R3Value a) := + contains_sound (CB2_3_3I2R3Raw_sound a) (CB2_3_3I2R3P_check a) +def CB2_3_3I2R3Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_3_3I2R3Certificates (CB2_3_3I2R3CertificateIndex a)).output +lemma CB2_3_3I2R3Terms_sound (a : Fin 6) : + (CB2_3_3I2R3Terms a).Encloses (Foundation.entropyTerm (CB2_3_3I2R3Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB2_3_3I2R3Certificates_valid + (CB2_3_3I2R3CertificateIndex a) (CB2_3_3I2R3P_sound a) +def CB2_3_3I2R3Entropy : Ball := ⟨0, 0⟩ +lemma CB2_3_3I2R3Entropy_sound : CB2_3_3I2R3Entropy.Encloses (Foundation.finiteEntropy CB2_3_3I2R3Value) := by + exact contains_sound (entropyFin_enclosed 6 CB2_3_3I2R3Value CB2_3_3I2R3Terms CB2_3_3I2R3Terms_sound) (by decide +kernel) +def CB2_3_3I2R3Mass : Ball := ⟨0, 0⟩ +lemma CB2_3_3I2R3Mass_sound : CB2_3_3I2R3Mass.Encloses (∑ a, CB2_3_3I2R3Value a) := by + exact contains_sound (finSumBall_sound 6 CB2_3_3I2R3P CB2_3_3I2R3Value CB2_3_3I2R3P_sound) (by decide +kernel) +def CB2_3_3I2R3MassTerm : Ball := .exact 0 +lemma CB2_3_3I2R3MassTerm_sound : CB2_3_3I2R3MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB2_3_3I2R3Value a))) := + entropyTerm_zero_ball (CB2_3_3I2R3Mass_sound) +def CB2_3_3I2R3H : Ball := ⟨0, 0⟩ +lemma CB2_3_3I2R3H_sound : CB2_3_3I2R3H.Encloses (homogeneousEntropy CB2_3_3I2R3Value) := by + exact contains_sound (homogeneous_enclosed CB2_3_3I2R3Value CB2_3_3I2R3MassTerm_sound CB2_3_3I2R3Entropy_sound) (by decide +kernel) +def CB2_3_3I2R4Value (a : Fin 6) : ℝ := residualLaw (below (shape 2 3 3)) (fun u => (stageBLaw (shape 2 3 3) u : ℝ)) (stageBPriority (shape 2 3 3)) 2 (fun u a => (littleLaw (shape 2 3 3) u ((stageBPriority (shape 2 3 3)) 2) a : ℝ)) 4 a +def CB2_3_3I2R4Raw (a : Fin 6) : Ball := residualBall (below (shape 2 3 3)) B2_3_3Law (stageBPriority (shape 2 3 3)) 2 (fun u => B2_3_3Little u ((stageBPriority (shape 2 3 3)) 2)) 4 a +lemma CB2_3_3I2R4Raw_sound (a : Fin 6) : + (CB2_3_3I2R4Raw a).Encloses (CB2_3_3I2R4Value a) := by + exact residualBall_sound_on (below (shape 2 3 3)) B2_3_3Law (fun u => (stageBLaw (shape 2 3 3) u : ℝ)) (stageBPriority (shape 2 3 3)) 2 (fun u => B2_3_3Little u ((stageBPriority (shape 2 3 3)) 2)) (fun u a => (littleLaw (shape 2 3 3) u ((stageBPriority (shape 2 3 3)) 2) a : ℝ)) (fun u _ => B2_3_3Law_sound u) (fun u _ a => B2_3_3Little_sound u ((stageBPriority (shape 2 3 3)) 2) a) 4 a +def CB2_3_3I2R4Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB2_3_3I2R4Certificates_valid : + CB2_3_3I2R4Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB2_3_3I2R4CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB2_3_3I2R4P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_3_3I2R4Certificates (CB2_3_3I2R4CertificateIndex a)).input +lemma CB2_3_3I2R4P_check : ∀ a : Fin 6, contains (CB2_3_3I2R4Raw a) (CB2_3_3I2R4P a) = true := by + decide +kernel +lemma CB2_3_3I2R4P_sound (a : Fin 6) : + (CB2_3_3I2R4P a).Encloses (CB2_3_3I2R4Value a) := + contains_sound (CB2_3_3I2R4Raw_sound a) (CB2_3_3I2R4P_check a) +def CB2_3_3I2R4Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_3_3I2R4Certificates (CB2_3_3I2R4CertificateIndex a)).output +lemma CB2_3_3I2R4Terms_sound (a : Fin 6) : + (CB2_3_3I2R4Terms a).Encloses (Foundation.entropyTerm (CB2_3_3I2R4Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB2_3_3I2R4Certificates_valid + (CB2_3_3I2R4CertificateIndex a) (CB2_3_3I2R4P_sound a) +def CB2_3_3I2R4Entropy : Ball := ⟨0, 0⟩ +lemma CB2_3_3I2R4Entropy_sound : CB2_3_3I2R4Entropy.Encloses (Foundation.finiteEntropy CB2_3_3I2R4Value) := by + exact contains_sound (entropyFin_enclosed 6 CB2_3_3I2R4Value CB2_3_3I2R4Terms CB2_3_3I2R4Terms_sound) (by decide +kernel) +def CB2_3_3I2R4Mass : Ball := ⟨0, 0⟩ +lemma CB2_3_3I2R4Mass_sound : CB2_3_3I2R4Mass.Encloses (∑ a, CB2_3_3I2R4Value a) := by + exact contains_sound (finSumBall_sound 6 CB2_3_3I2R4P CB2_3_3I2R4Value CB2_3_3I2R4P_sound) (by decide +kernel) +def CB2_3_3I2R4MassTerm : Ball := .exact 0 +lemma CB2_3_3I2R4MassTerm_sound : CB2_3_3I2R4MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB2_3_3I2R4Value a))) := + entropyTerm_zero_ball (CB2_3_3I2R4Mass_sound) +def CB2_3_3I2R4H : Ball := ⟨0, 0⟩ +lemma CB2_3_3I2R4H_sound : CB2_3_3I2R4H.Encloses (homogeneousEntropy CB2_3_3I2R4Value) := by + exact contains_sound (homogeneous_enclosed CB2_3_3I2R4Value CB2_3_3I2R4MassTerm_sound CB2_3_3I2R4Entropy_sound) (by decide +kernel) +def CB2_3_3I2R5Value (a : Fin 6) : ℝ := residualLaw (below (shape 2 3 3)) (fun u => (stageBLaw (shape 2 3 3) u : ℝ)) (stageBPriority (shape 2 3 3)) 2 (fun u a => (littleLaw (shape 2 3 3) u ((stageBPriority (shape 2 3 3)) 2) a : ℝ)) 5 a +def CB2_3_3I2R5Raw (a : Fin 6) : Ball := residualBall (below (shape 2 3 3)) B2_3_3Law (stageBPriority (shape 2 3 3)) 2 (fun u => B2_3_3Little u ((stageBPriority (shape 2 3 3)) 2)) 5 a +lemma CB2_3_3I2R5Raw_sound (a : Fin 6) : + (CB2_3_3I2R5Raw a).Encloses (CB2_3_3I2R5Value a) := by + exact residualBall_sound_on (below (shape 2 3 3)) B2_3_3Law (fun u => (stageBLaw (shape 2 3 3) u : ℝ)) (stageBPriority (shape 2 3 3)) 2 (fun u => B2_3_3Little u ((stageBPriority (shape 2 3 3)) 2)) (fun u a => (littleLaw (shape 2 3 3) u ((stageBPriority (shape 2 3 3)) 2) a : ℝ)) (fun u _ => B2_3_3Law_sound u) (fun u _ a => B2_3_3Little_sound u ((stageBPriority (shape 2 3 3)) 2) a) 5 a +def CB2_3_3I2R5Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB2_3_3I2R5Certificates_valid : + CB2_3_3I2R5Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB2_3_3I2R5CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB2_3_3I2R5P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_3_3I2R5Certificates (CB2_3_3I2R5CertificateIndex a)).input +lemma CB2_3_3I2R5P_check : ∀ a : Fin 6, contains (CB2_3_3I2R5Raw a) (CB2_3_3I2R5P a) = true := by + decide +kernel +lemma CB2_3_3I2R5P_sound (a : Fin 6) : + (CB2_3_3I2R5P a).Encloses (CB2_3_3I2R5Value a) := + contains_sound (CB2_3_3I2R5Raw_sound a) (CB2_3_3I2R5P_check a) +def CB2_3_3I2R5Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_3_3I2R5Certificates (CB2_3_3I2R5CertificateIndex a)).output +lemma CB2_3_3I2R5Terms_sound (a : Fin 6) : + (CB2_3_3I2R5Terms a).Encloses (Foundation.entropyTerm (CB2_3_3I2R5Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB2_3_3I2R5Certificates_valid + (CB2_3_3I2R5CertificateIndex a) (CB2_3_3I2R5P_sound a) +def CB2_3_3I2R5Entropy : Ball := ⟨0, 0⟩ +lemma CB2_3_3I2R5Entropy_sound : CB2_3_3I2R5Entropy.Encloses (Foundation.finiteEntropy CB2_3_3I2R5Value) := by + exact contains_sound (entropyFin_enclosed 6 CB2_3_3I2R5Value CB2_3_3I2R5Terms CB2_3_3I2R5Terms_sound) (by decide +kernel) +def CB2_3_3I2R5Mass : Ball := ⟨0, 0⟩ +lemma CB2_3_3I2R5Mass_sound : CB2_3_3I2R5Mass.Encloses (∑ a, CB2_3_3I2R5Value a) := by + exact contains_sound (finSumBall_sound 6 CB2_3_3I2R5P CB2_3_3I2R5Value CB2_3_3I2R5P_sound) (by decide +kernel) +def CB2_3_3I2R5MassTerm : Ball := .exact 0 +lemma CB2_3_3I2R5MassTerm_sound : CB2_3_3I2R5MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB2_3_3I2R5Value a))) := + entropyTerm_zero_ball (CB2_3_3I2R5Mass_sound) +def CB2_3_3I2R5H : Ball := ⟨0, 0⟩ +lemma CB2_3_3I2R5H_sound : CB2_3_3I2R5H.Encloses (homogeneousEntropy CB2_3_3I2R5Value) := by + exact contains_sound (homogeneous_enclosed CB2_3_3I2R5Value CB2_3_3I2R5MassTerm_sound CB2_3_3I2R5Entropy_sound) (by decide +kernel) +def CB2_3_3I2R6Value (a : Fin 6) : ℝ := residualLaw (below (shape 2 3 3)) (fun u => (stageBLaw (shape 2 3 3) u : ℝ)) (stageBPriority (shape 2 3 3)) 2 (fun u a => (littleLaw (shape 2 3 3) u ((stageBPriority (shape 2 3 3)) 2) a : ℝ)) 6 a +def CB2_3_3I2R6Raw (a : Fin 6) : Ball := residualBall (below (shape 2 3 3)) B2_3_3Law (stageBPriority (shape 2 3 3)) 2 (fun u => B2_3_3Little u ((stageBPriority (shape 2 3 3)) 2)) 6 a +lemma CB2_3_3I2R6Raw_sound (a : Fin 6) : + (CB2_3_3I2R6Raw a).Encloses (CB2_3_3I2R6Value a) := by + exact residualBall_sound_on (below (shape 2 3 3)) B2_3_3Law (fun u => (stageBLaw (shape 2 3 3) u : ℝ)) (stageBPriority (shape 2 3 3)) 2 (fun u => B2_3_3Little u ((stageBPriority (shape 2 3 3)) 2)) (fun u a => (littleLaw (shape 2 3 3) u ((stageBPriority (shape 2 3 3)) 2) a : ℝ)) (fun u _ => B2_3_3Law_sound u) (fun u _ a => B2_3_3Little_sound u ((stageBPriority (shape 2 3 3)) 2) a) 6 a +def CB2_3_3I2R6Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB2_3_3I2R6Certificates_valid : + CB2_3_3I2R6Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB2_3_3I2R6CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB2_3_3I2R6P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_3_3I2R6Certificates (CB2_3_3I2R6CertificateIndex a)).input +lemma CB2_3_3I2R6P_check : ∀ a : Fin 6, contains (CB2_3_3I2R6Raw a) (CB2_3_3I2R6P a) = true := by + decide +kernel +lemma CB2_3_3I2R6P_sound (a : Fin 6) : + (CB2_3_3I2R6P a).Encloses (CB2_3_3I2R6Value a) := + contains_sound (CB2_3_3I2R6Raw_sound a) (CB2_3_3I2R6P_check a) +def CB2_3_3I2R6Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_3_3I2R6Certificates (CB2_3_3I2R6CertificateIndex a)).output +lemma CB2_3_3I2R6Terms_sound (a : Fin 6) : + (CB2_3_3I2R6Terms a).Encloses (Foundation.entropyTerm (CB2_3_3I2R6Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB2_3_3I2R6Certificates_valid + (CB2_3_3I2R6CertificateIndex a) (CB2_3_3I2R6P_sound a) +def CB2_3_3I2R6Entropy : Ball := ⟨0, 0⟩ +lemma CB2_3_3I2R6Entropy_sound : CB2_3_3I2R6Entropy.Encloses (Foundation.finiteEntropy CB2_3_3I2R6Value) := by + exact contains_sound (entropyFin_enclosed 6 CB2_3_3I2R6Value CB2_3_3I2R6Terms CB2_3_3I2R6Terms_sound) (by decide +kernel) +def CB2_3_3I2R6Mass : Ball := ⟨0, 0⟩ +lemma CB2_3_3I2R6Mass_sound : CB2_3_3I2R6Mass.Encloses (∑ a, CB2_3_3I2R6Value a) := by + exact contains_sound (finSumBall_sound 6 CB2_3_3I2R6P CB2_3_3I2R6Value CB2_3_3I2R6P_sound) (by decide +kernel) +def CB2_3_3I2R6MassTerm : Ball := .exact 0 +lemma CB2_3_3I2R6MassTerm_sound : CB2_3_3I2R6MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB2_3_3I2R6Value a))) := + entropyTerm_zero_ball (CB2_3_3I2R6Mass_sound) +def CB2_3_3I2R6H : Ball := ⟨0, 0⟩ +lemma CB2_3_3I2R6H_sound : CB2_3_3I2R6H.Encloses (homogeneousEntropy CB2_3_3I2R6Value) := by + exact contains_sound (homogeneous_enclosed CB2_3_3I2R6Value CB2_3_3I2R6MassTerm_sound CB2_3_3I2R6Entropy_sound) (by decide +kernel) +def CB2_3_3I2R7Value (a : Fin 6) : ℝ := residualLaw (below (shape 2 3 3)) (fun u => (stageBLaw (shape 2 3 3) u : ℝ)) (stageBPriority (shape 2 3 3)) 2 (fun u a => (littleLaw (shape 2 3 3) u ((stageBPriority (shape 2 3 3)) 2) a : ℝ)) 7 a +def CB2_3_3I2R7Raw (a : Fin 6) : Ball := residualBall (below (shape 2 3 3)) B2_3_3Law (stageBPriority (shape 2 3 3)) 2 (fun u => B2_3_3Little u ((stageBPriority (shape 2 3 3)) 2)) 7 a +lemma CB2_3_3I2R7Raw_sound (a : Fin 6) : + (CB2_3_3I2R7Raw a).Encloses (CB2_3_3I2R7Value a) := by + exact residualBall_sound_on (below (shape 2 3 3)) B2_3_3Law (fun u => (stageBLaw (shape 2 3 3) u : ℝ)) (stageBPriority (shape 2 3 3)) 2 (fun u => B2_3_3Little u ((stageBPriority (shape 2 3 3)) 2)) (fun u a => (littleLaw (shape 2 3 3) u ((stageBPriority (shape 2 3 3)) 2) a : ℝ)) (fun u _ => B2_3_3Law_sound u) (fun u _ a => B2_3_3Little_sound u ((stageBPriority (shape 2 3 3)) 2) a) 7 a +def CB2_3_3I2R7Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB2_3_3I2R7Certificates_valid : + CB2_3_3I2R7Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB2_3_3I2R7CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB2_3_3I2R7P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_3_3I2R7Certificates (CB2_3_3I2R7CertificateIndex a)).input +lemma CB2_3_3I2R7P_check : ∀ a : Fin 6, contains (CB2_3_3I2R7Raw a) (CB2_3_3I2R7P a) = true := by + decide +kernel +lemma CB2_3_3I2R7P_sound (a : Fin 6) : + (CB2_3_3I2R7P a).Encloses (CB2_3_3I2R7Value a) := + contains_sound (CB2_3_3I2R7Raw_sound a) (CB2_3_3I2R7P_check a) +def CB2_3_3I2R7Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_3_3I2R7Certificates (CB2_3_3I2R7CertificateIndex a)).output +lemma CB2_3_3I2R7Terms_sound (a : Fin 6) : + (CB2_3_3I2R7Terms a).Encloses (Foundation.entropyTerm (CB2_3_3I2R7Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB2_3_3I2R7Certificates_valid + (CB2_3_3I2R7CertificateIndex a) (CB2_3_3I2R7P_sound a) +def CB2_3_3I2R7Entropy : Ball := ⟨0, 0⟩ +lemma CB2_3_3I2R7Entropy_sound : CB2_3_3I2R7Entropy.Encloses (Foundation.finiteEntropy CB2_3_3I2R7Value) := by + exact contains_sound (entropyFin_enclosed 6 CB2_3_3I2R7Value CB2_3_3I2R7Terms CB2_3_3I2R7Terms_sound) (by decide +kernel) +def CB2_3_3I2R7Mass : Ball := ⟨0, 0⟩ +lemma CB2_3_3I2R7Mass_sound : CB2_3_3I2R7Mass.Encloses (∑ a, CB2_3_3I2R7Value a) := by + exact contains_sound (finSumBall_sound 6 CB2_3_3I2R7P CB2_3_3I2R7Value CB2_3_3I2R7P_sound) (by decide +kernel) +def CB2_3_3I2R7MassTerm : Ball := .exact 0 +lemma CB2_3_3I2R7MassTerm_sound : CB2_3_3I2R7MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB2_3_3I2R7Value a))) := + entropyTerm_zero_ball (CB2_3_3I2R7Mass_sound) +def CB2_3_3I2R7H : Ball := ⟨0, 0⟩ +lemma CB2_3_3I2R7H_sound : CB2_3_3I2R7H.Encloses (homogeneousEntropy CB2_3_3I2R7Value) := by + exact contains_sound (homogeneous_enclosed CB2_3_3I2R7Value CB2_3_3I2R7MassTerm_sound CB2_3_3I2R7Entropy_sound) (by decide +kernel) +def CB2_3_3I2R8Value (a : Fin 6) : ℝ := residualLaw (below (shape 2 3 3)) (fun u => (stageBLaw (shape 2 3 3) u : ℝ)) (stageBPriority (shape 2 3 3)) 2 (fun u a => (littleLaw (shape 2 3 3) u ((stageBPriority (shape 2 3 3)) 2) a : ℝ)) 8 a +def CB2_3_3I2R8Raw (a : Fin 6) : Ball := residualBall (below (shape 2 3 3)) B2_3_3Law (stageBPriority (shape 2 3 3)) 2 (fun u => B2_3_3Little u ((stageBPriority (shape 2 3 3)) 2)) 8 a +lemma CB2_3_3I2R8Raw_sound (a : Fin 6) : + (CB2_3_3I2R8Raw a).Encloses (CB2_3_3I2R8Value a) := by + exact residualBall_sound_on (below (shape 2 3 3)) B2_3_3Law (fun u => (stageBLaw (shape 2 3 3) u : ℝ)) (stageBPriority (shape 2 3 3)) 2 (fun u => B2_3_3Little u ((stageBPriority (shape 2 3 3)) 2)) (fun u a => (littleLaw (shape 2 3 3) u ((stageBPriority (shape 2 3 3)) 2) a : ℝ)) (fun u _ => B2_3_3Law_sound u) (fun u _ a => B2_3_3Little_sound u ((stageBPriority (shape 2 3 3)) 2) a) 8 a +def CB2_3_3I2R8Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB2_3_3I2R8Certificates_valid : + CB2_3_3I2R8Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB2_3_3I2R8CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB2_3_3I2R8P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_3_3I2R8Certificates (CB2_3_3I2R8CertificateIndex a)).input +lemma CB2_3_3I2R8P_check : ∀ a : Fin 6, contains (CB2_3_3I2R8Raw a) (CB2_3_3I2R8P a) = true := by + decide +kernel +lemma CB2_3_3I2R8P_sound (a : Fin 6) : + (CB2_3_3I2R8P a).Encloses (CB2_3_3I2R8Value a) := + contains_sound (CB2_3_3I2R8Raw_sound a) (CB2_3_3I2R8P_check a) +def CB2_3_3I2R8Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_3_3I2R8Certificates (CB2_3_3I2R8CertificateIndex a)).output +lemma CB2_3_3I2R8Terms_sound (a : Fin 6) : + (CB2_3_3I2R8Terms a).Encloses (Foundation.entropyTerm (CB2_3_3I2R8Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB2_3_3I2R8Certificates_valid + (CB2_3_3I2R8CertificateIndex a) (CB2_3_3I2R8P_sound a) +def CB2_3_3I2R8Entropy : Ball := ⟨0, 0⟩ +lemma CB2_3_3I2R8Entropy_sound : CB2_3_3I2R8Entropy.Encloses (Foundation.finiteEntropy CB2_3_3I2R8Value) := by + exact contains_sound (entropyFin_enclosed 6 CB2_3_3I2R8Value CB2_3_3I2R8Terms CB2_3_3I2R8Terms_sound) (by decide +kernel) +def CB2_3_3I2R8Mass : Ball := ⟨0, 0⟩ +lemma CB2_3_3I2R8Mass_sound : CB2_3_3I2R8Mass.Encloses (∑ a, CB2_3_3I2R8Value a) := by + exact contains_sound (finSumBall_sound 6 CB2_3_3I2R8P CB2_3_3I2R8Value CB2_3_3I2R8P_sound) (by decide +kernel) +def CB2_3_3I2R8MassTerm : Ball := .exact 0 +lemma CB2_3_3I2R8MassTerm_sound : CB2_3_3I2R8MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB2_3_3I2R8Value a))) := + entropyTerm_zero_ball (CB2_3_3I2R8Mass_sound) +def CB2_3_3I2R8H : Ball := ⟨0, 0⟩ +lemma CB2_3_3I2R8H_sound : CB2_3_3I2R8H.Encloses (homogeneousEntropy CB2_3_3I2R8Value) := by + exact contains_sound (homogeneous_enclosed CB2_3_3I2R8Value CB2_3_3I2R8MassTerm_sound CB2_3_3I2R8Entropy_sound) (by decide +kernel) +def CB2_3_3I2R9Value (a : Fin 6) : ℝ := residualLaw (below (shape 2 3 3)) (fun u => (stageBLaw (shape 2 3 3) u : ℝ)) (stageBPriority (shape 2 3 3)) 2 (fun u a => (littleLaw (shape 2 3 3) u ((stageBPriority (shape 2 3 3)) 2) a : ℝ)) 9 a +def CB2_3_3I2R9Raw (a : Fin 6) : Ball := residualBall (below (shape 2 3 3)) B2_3_3Law (stageBPriority (shape 2 3 3)) 2 (fun u => B2_3_3Little u ((stageBPriority (shape 2 3 3)) 2)) 9 a +lemma CB2_3_3I2R9Raw_sound (a : Fin 6) : + (CB2_3_3I2R9Raw a).Encloses (CB2_3_3I2R9Value a) := by + exact residualBall_sound_on (below (shape 2 3 3)) B2_3_3Law (fun u => (stageBLaw (shape 2 3 3) u : ℝ)) (stageBPriority (shape 2 3 3)) 2 (fun u => B2_3_3Little u ((stageBPriority (shape 2 3 3)) 2)) (fun u a => (littleLaw (shape 2 3 3) u ((stageBPriority (shape 2 3 3)) 2) a : ℝ)) (fun u _ => B2_3_3Law_sound u) (fun u _ a => B2_3_3Little_sound u ((stageBPriority (shape 2 3 3)) 2) a) 9 a +def CB2_3_3I2R9Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB2_3_3I2R9Certificates_valid : + CB2_3_3I2R9Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB2_3_3I2R9CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB2_3_3I2R9P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_3_3I2R9Certificates (CB2_3_3I2R9CertificateIndex a)).input +lemma CB2_3_3I2R9P_check : ∀ a : Fin 6, contains (CB2_3_3I2R9Raw a) (CB2_3_3I2R9P a) = true := by + decide +kernel +lemma CB2_3_3I2R9P_sound (a : Fin 6) : + (CB2_3_3I2R9P a).Encloses (CB2_3_3I2R9Value a) := + contains_sound (CB2_3_3I2R9Raw_sound a) (CB2_3_3I2R9P_check a) +def CB2_3_3I2R9Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_3_3I2R9Certificates (CB2_3_3I2R9CertificateIndex a)).output +lemma CB2_3_3I2R9Terms_sound (a : Fin 6) : + (CB2_3_3I2R9Terms a).Encloses (Foundation.entropyTerm (CB2_3_3I2R9Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB2_3_3I2R9Certificates_valid + (CB2_3_3I2R9CertificateIndex a) (CB2_3_3I2R9P_sound a) +def CB2_3_3I2R9Entropy : Ball := ⟨0, 0⟩ +lemma CB2_3_3I2R9Entropy_sound : CB2_3_3I2R9Entropy.Encloses (Foundation.finiteEntropy CB2_3_3I2R9Value) := by + exact contains_sound (entropyFin_enclosed 6 CB2_3_3I2R9Value CB2_3_3I2R9Terms CB2_3_3I2R9Terms_sound) (by decide +kernel) +def CB2_3_3I2R9Mass : Ball := ⟨0, 0⟩ +lemma CB2_3_3I2R9Mass_sound : CB2_3_3I2R9Mass.Encloses (∑ a, CB2_3_3I2R9Value a) := by + exact contains_sound (finSumBall_sound 6 CB2_3_3I2R9P CB2_3_3I2R9Value CB2_3_3I2R9P_sound) (by decide +kernel) +def CB2_3_3I2R9MassTerm : Ball := .exact 0 +lemma CB2_3_3I2R9MassTerm_sound : CB2_3_3I2R9MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB2_3_3I2R9Value a))) := + entropyTerm_zero_ball (CB2_3_3I2R9Mass_sound) +def CB2_3_3I2R9H : Ball := ⟨0, 0⟩ +lemma CB2_3_3I2R9H_sound : CB2_3_3I2R9H.Encloses (homogeneousEntropy CB2_3_3I2R9Value) := by + exact contains_sound (homogeneous_enclosed CB2_3_3I2R9Value CB2_3_3I2R9MassTerm_sound CB2_3_3I2R9Entropy_sound) (by decide +kernel) +def CB2_3_3I2R10Value (a : Fin 6) : ℝ := residualLaw (below (shape 2 3 3)) (fun u => (stageBLaw (shape 2 3 3) u : ℝ)) (stageBPriority (shape 2 3 3)) 2 (fun u a => (littleLaw (shape 2 3 3) u ((stageBPriority (shape 2 3 3)) 2) a : ℝ)) 10 a +def CB2_3_3I2R10Raw (a : Fin 6) : Ball := residualBall (below (shape 2 3 3)) B2_3_3Law (stageBPriority (shape 2 3 3)) 2 (fun u => B2_3_3Little u ((stageBPriority (shape 2 3 3)) 2)) 10 a +lemma CB2_3_3I2R10Raw_sound (a : Fin 6) : + (CB2_3_3I2R10Raw a).Encloses (CB2_3_3I2R10Value a) := by + exact residualBall_sound_on (below (shape 2 3 3)) B2_3_3Law (fun u => (stageBLaw (shape 2 3 3) u : ℝ)) (stageBPriority (shape 2 3 3)) 2 (fun u => B2_3_3Little u ((stageBPriority (shape 2 3 3)) 2)) (fun u a => (littleLaw (shape 2 3 3) u ((stageBPriority (shape 2 3 3)) 2) a : ℝ)) (fun u _ => B2_3_3Law_sound u) (fun u _ a => B2_3_3Little_sound u ((stageBPriority (shape 2 3 3)) 2) a) 10 a +def CB2_3_3I2R10Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB2_3_3I2R10Certificates_valid : + CB2_3_3I2R10Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB2_3_3I2R10CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB2_3_3I2R10P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_3_3I2R10Certificates (CB2_3_3I2R10CertificateIndex a)).input +lemma CB2_3_3I2R10P_check : ∀ a : Fin 6, contains (CB2_3_3I2R10Raw a) (CB2_3_3I2R10P a) = true := by + decide +kernel +lemma CB2_3_3I2R10P_sound (a : Fin 6) : + (CB2_3_3I2R10P a).Encloses (CB2_3_3I2R10Value a) := + contains_sound (CB2_3_3I2R10Raw_sound a) (CB2_3_3I2R10P_check a) +def CB2_3_3I2R10Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_3_3I2R10Certificates (CB2_3_3I2R10CertificateIndex a)).output +lemma CB2_3_3I2R10Terms_sound (a : Fin 6) : + (CB2_3_3I2R10Terms a).Encloses (Foundation.entropyTerm (CB2_3_3I2R10Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB2_3_3I2R10Certificates_valid + (CB2_3_3I2R10CertificateIndex a) (CB2_3_3I2R10P_sound a) +def CB2_3_3I2R10Entropy : Ball := ⟨0, 0⟩ +lemma CB2_3_3I2R10Entropy_sound : CB2_3_3I2R10Entropy.Encloses (Foundation.finiteEntropy CB2_3_3I2R10Value) := by + exact contains_sound (entropyFin_enclosed 6 CB2_3_3I2R10Value CB2_3_3I2R10Terms CB2_3_3I2R10Terms_sound) (by decide +kernel) +def CB2_3_3I2R10Mass : Ball := ⟨0, 0⟩ +lemma CB2_3_3I2R10Mass_sound : CB2_3_3I2R10Mass.Encloses (∑ a, CB2_3_3I2R10Value a) := by + exact contains_sound (finSumBall_sound 6 CB2_3_3I2R10P CB2_3_3I2R10Value CB2_3_3I2R10P_sound) (by decide +kernel) +def CB2_3_3I2R10MassTerm : Ball := .exact 0 +lemma CB2_3_3I2R10MassTerm_sound : CB2_3_3I2R10MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB2_3_3I2R10Value a))) := + entropyTerm_zero_ball (CB2_3_3I2R10Mass_sound) +def CB2_3_3I2R10H : Ball := ⟨0, 0⟩ +lemma CB2_3_3I2R10H_sound : CB2_3_3I2R10H.Encloses (homogeneousEntropy CB2_3_3I2R10Value) := by + exact contains_sound (homogeneous_enclosed CB2_3_3I2R10Value CB2_3_3I2R10MassTerm_sound CB2_3_3I2R10Entropy_sound) (by decide +kernel) +def CB2_3_3I2R11Value (a : Fin 6) : ℝ := residualLaw (below (shape 2 3 3)) (fun u => (stageBLaw (shape 2 3 3) u : ℝ)) (stageBPriority (shape 2 3 3)) 2 (fun u a => (littleLaw (shape 2 3 3) u ((stageBPriority (shape 2 3 3)) 2) a : ℝ)) 11 a +def CB2_3_3I2R11Raw (a : Fin 6) : Ball := residualBall (below (shape 2 3 3)) B2_3_3Law (stageBPriority (shape 2 3 3)) 2 (fun u => B2_3_3Little u ((stageBPriority (shape 2 3 3)) 2)) 11 a +lemma CB2_3_3I2R11Raw_sound (a : Fin 6) : + (CB2_3_3I2R11Raw a).Encloses (CB2_3_3I2R11Value a) := by + exact residualBall_sound_on (below (shape 2 3 3)) B2_3_3Law (fun u => (stageBLaw (shape 2 3 3) u : ℝ)) (stageBPriority (shape 2 3 3)) 2 (fun u => B2_3_3Little u ((stageBPriority (shape 2 3 3)) 2)) (fun u a => (littleLaw (shape 2 3 3) u ((stageBPriority (shape 2 3 3)) 2) a : ℝ)) (fun u _ => B2_3_3Law_sound u) (fun u _ a => B2_3_3Little_sound u ((stageBPriority (shape 2 3 3)) 2) a) 11 a +def CB2_3_3I2R11Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB2_3_3I2R11Certificates_valid : + CB2_3_3I2R11Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB2_3_3I2R11CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB2_3_3I2R11P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_3_3I2R11Certificates (CB2_3_3I2R11CertificateIndex a)).input +lemma CB2_3_3I2R11P_check : ∀ a : Fin 6, contains (CB2_3_3I2R11Raw a) (CB2_3_3I2R11P a) = true := by + decide +kernel +lemma CB2_3_3I2R11P_sound (a : Fin 6) : + (CB2_3_3I2R11P a).Encloses (CB2_3_3I2R11Value a) := + contains_sound (CB2_3_3I2R11Raw_sound a) (CB2_3_3I2R11P_check a) +def CB2_3_3I2R11Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_3_3I2R11Certificates (CB2_3_3I2R11CertificateIndex a)).output +lemma CB2_3_3I2R11Terms_sound (a : Fin 6) : + (CB2_3_3I2R11Terms a).Encloses (Foundation.entropyTerm (CB2_3_3I2R11Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB2_3_3I2R11Certificates_valid + (CB2_3_3I2R11CertificateIndex a) (CB2_3_3I2R11P_sound a) +def CB2_3_3I2R11Entropy : Ball := ⟨0, 0⟩ +lemma CB2_3_3I2R11Entropy_sound : CB2_3_3I2R11Entropy.Encloses (Foundation.finiteEntropy CB2_3_3I2R11Value) := by + exact contains_sound (entropyFin_enclosed 6 CB2_3_3I2R11Value CB2_3_3I2R11Terms CB2_3_3I2R11Terms_sound) (by decide +kernel) +def CB2_3_3I2R11Mass : Ball := ⟨0, 0⟩ +lemma CB2_3_3I2R11Mass_sound : CB2_3_3I2R11Mass.Encloses (∑ a, CB2_3_3I2R11Value a) := by + exact contains_sound (finSumBall_sound 6 CB2_3_3I2R11P CB2_3_3I2R11Value CB2_3_3I2R11P_sound) (by decide +kernel) +def CB2_3_3I2R11MassTerm : Ball := .exact 0 +lemma CB2_3_3I2R11MassTerm_sound : CB2_3_3I2R11MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB2_3_3I2R11Value a))) := + entropyTerm_zero_ball (CB2_3_3I2R11Mass_sound) +def CB2_3_3I2R11H : Ball := ⟨0, 0⟩ +lemma CB2_3_3I2R11H_sound : CB2_3_3I2R11H.Encloses (homogeneousEntropy CB2_3_3I2R11Value) := by + exact contains_sound (homogeneous_enclosed CB2_3_3I2R11Value CB2_3_3I2R11MassTerm_sound CB2_3_3I2R11Entropy_sound) (by decide +kernel) +def CB2_3_3I2R12Value (a : Fin 6) : ℝ := residualLaw (below (shape 2 3 3)) (fun u => (stageBLaw (shape 2 3 3) u : ℝ)) (stageBPriority (shape 2 3 3)) 2 (fun u a => (littleLaw (shape 2 3 3) u ((stageBPriority (shape 2 3 3)) 2) a : ℝ)) 12 a +def CB2_3_3I2R12Raw (a : Fin 6) : Ball := residualBall (below (shape 2 3 3)) B2_3_3Law (stageBPriority (shape 2 3 3)) 2 (fun u => B2_3_3Little u ((stageBPriority (shape 2 3 3)) 2)) 12 a +lemma CB2_3_3I2R12Raw_sound (a : Fin 6) : + (CB2_3_3I2R12Raw a).Encloses (CB2_3_3I2R12Value a) := by + exact residualBall_sound_on (below (shape 2 3 3)) B2_3_3Law (fun u => (stageBLaw (shape 2 3 3) u : ℝ)) (stageBPriority (shape 2 3 3)) 2 (fun u => B2_3_3Little u ((stageBPriority (shape 2 3 3)) 2)) (fun u a => (littleLaw (shape 2 3 3) u ((stageBPriority (shape 2 3 3)) 2) a : ℝ)) (fun u _ => B2_3_3Law_sound u) (fun u _ a => B2_3_3Little_sound u ((stageBPriority (shape 2 3 3)) 2) a) 12 a +def CB2_3_3I2R12Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB2_3_3I2R12Certificates_valid : + CB2_3_3I2R12Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB2_3_3I2R12CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB2_3_3I2R12P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_3_3I2R12Certificates (CB2_3_3I2R12CertificateIndex a)).input +lemma CB2_3_3I2R12P_check : ∀ a : Fin 6, contains (CB2_3_3I2R12Raw a) (CB2_3_3I2R12P a) = true := by + decide +kernel +lemma CB2_3_3I2R12P_sound (a : Fin 6) : + (CB2_3_3I2R12P a).Encloses (CB2_3_3I2R12Value a) := + contains_sound (CB2_3_3I2R12Raw_sound a) (CB2_3_3I2R12P_check a) +def CB2_3_3I2R12Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_3_3I2R12Certificates (CB2_3_3I2R12CertificateIndex a)).output +lemma CB2_3_3I2R12Terms_sound (a : Fin 6) : + (CB2_3_3I2R12Terms a).Encloses (Foundation.entropyTerm (CB2_3_3I2R12Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB2_3_3I2R12Certificates_valid + (CB2_3_3I2R12CertificateIndex a) (CB2_3_3I2R12P_sound a) +def CB2_3_3I2R12Entropy : Ball := ⟨0, 0⟩ +lemma CB2_3_3I2R12Entropy_sound : CB2_3_3I2R12Entropy.Encloses (Foundation.finiteEntropy CB2_3_3I2R12Value) := by + exact contains_sound (entropyFin_enclosed 6 CB2_3_3I2R12Value CB2_3_3I2R12Terms CB2_3_3I2R12Terms_sound) (by decide +kernel) +def CB2_3_3I2R12Mass : Ball := ⟨0, 0⟩ +lemma CB2_3_3I2R12Mass_sound : CB2_3_3I2R12Mass.Encloses (∑ a, CB2_3_3I2R12Value a) := by + exact contains_sound (finSumBall_sound 6 CB2_3_3I2R12P CB2_3_3I2R12Value CB2_3_3I2R12P_sound) (by decide +kernel) +def CB2_3_3I2R12MassTerm : Ball := .exact 0 +lemma CB2_3_3I2R12MassTerm_sound : CB2_3_3I2R12MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB2_3_3I2R12Value a))) := + entropyTerm_zero_ball (CB2_3_3I2R12Mass_sound) +def CB2_3_3I2R12H : Ball := ⟨0, 0⟩ +lemma CB2_3_3I2R12H_sound : CB2_3_3I2R12H.Encloses (homogeneousEntropy CB2_3_3I2R12Value) := by + exact contains_sound (homogeneous_enclosed CB2_3_3I2R12Value CB2_3_3I2R12MassTerm_sound CB2_3_3I2R12Entropy_sound) (by decide +kernel) +def CB2_3_3I2R13Value (a : Fin 6) : ℝ := residualLaw (below (shape 2 3 3)) (fun u => (stageBLaw (shape 2 3 3) u : ℝ)) (stageBPriority (shape 2 3 3)) 2 (fun u a => (littleLaw (shape 2 3 3) u ((stageBPriority (shape 2 3 3)) 2) a : ℝ)) 13 a +def CB2_3_3I2R13Raw (a : Fin 6) : Ball := residualBall (below (shape 2 3 3)) B2_3_3Law (stageBPriority (shape 2 3 3)) 2 (fun u => B2_3_3Little u ((stageBPriority (shape 2 3 3)) 2)) 13 a +lemma CB2_3_3I2R13Raw_sound (a : Fin 6) : + (CB2_3_3I2R13Raw a).Encloses (CB2_3_3I2R13Value a) := by + exact residualBall_sound_on (below (shape 2 3 3)) B2_3_3Law (fun u => (stageBLaw (shape 2 3 3) u : ℝ)) (stageBPriority (shape 2 3 3)) 2 (fun u => B2_3_3Little u ((stageBPriority (shape 2 3 3)) 2)) (fun u a => (littleLaw (shape 2 3 3) u ((stageBPriority (shape 2 3 3)) 2) a : ℝ)) (fun u _ => B2_3_3Law_sound u) (fun u _ a => B2_3_3Little_sound u ((stageBPriority (shape 2 3 3)) 2) a) 13 a +def CB2_3_3I2R13Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB2_3_3I2R13Certificates_valid : + CB2_3_3I2R13Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB2_3_3I2R13CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB2_3_3I2R13P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_3_3I2R13Certificates (CB2_3_3I2R13CertificateIndex a)).input +lemma CB2_3_3I2R13P_check : ∀ a : Fin 6, contains (CB2_3_3I2R13Raw a) (CB2_3_3I2R13P a) = true := by + decide +kernel +lemma CB2_3_3I2R13P_sound (a : Fin 6) : + (CB2_3_3I2R13P a).Encloses (CB2_3_3I2R13Value a) := + contains_sound (CB2_3_3I2R13Raw_sound a) (CB2_3_3I2R13P_check a) +def CB2_3_3I2R13Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_3_3I2R13Certificates (CB2_3_3I2R13CertificateIndex a)).output +lemma CB2_3_3I2R13Terms_sound (a : Fin 6) : + (CB2_3_3I2R13Terms a).Encloses (Foundation.entropyTerm (CB2_3_3I2R13Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB2_3_3I2R13Certificates_valid + (CB2_3_3I2R13CertificateIndex a) (CB2_3_3I2R13P_sound a) +def CB2_3_3I2R13Entropy : Ball := ⟨0, 0⟩ +lemma CB2_3_3I2R13Entropy_sound : CB2_3_3I2R13Entropy.Encloses (Foundation.finiteEntropy CB2_3_3I2R13Value) := by + exact contains_sound (entropyFin_enclosed 6 CB2_3_3I2R13Value CB2_3_3I2R13Terms CB2_3_3I2R13Terms_sound) (by decide +kernel) +def CB2_3_3I2R13Mass : Ball := ⟨0, 0⟩ +lemma CB2_3_3I2R13Mass_sound : CB2_3_3I2R13Mass.Encloses (∑ a, CB2_3_3I2R13Value a) := by + exact contains_sound (finSumBall_sound 6 CB2_3_3I2R13P CB2_3_3I2R13Value CB2_3_3I2R13P_sound) (by decide +kernel) +def CB2_3_3I2R13MassTerm : Ball := .exact 0 +lemma CB2_3_3I2R13MassTerm_sound : CB2_3_3I2R13MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB2_3_3I2R13Value a))) := + entropyTerm_zero_ball (CB2_3_3I2R13Mass_sound) +def CB2_3_3I2R13H : Ball := ⟨0, 0⟩ +lemma CB2_3_3I2R13H_sound : CB2_3_3I2R13H.Encloses (homogeneousEntropy CB2_3_3I2R13Value) := by + exact contains_sound (homogeneous_enclosed CB2_3_3I2R13Value CB2_3_3I2R13MassTerm_sound CB2_3_3I2R13Entropy_sound) (by decide +kernel) +def CB2_3_3I2R14Value (a : Fin 6) : ℝ := residualLaw (below (shape 2 3 3)) (fun u => (stageBLaw (shape 2 3 3) u : ℝ)) (stageBPriority (shape 2 3 3)) 2 (fun u a => (littleLaw (shape 2 3 3) u ((stageBPriority (shape 2 3 3)) 2) a : ℝ)) 14 a +def CB2_3_3I2R14Raw (a : Fin 6) : Ball := residualBall (below (shape 2 3 3)) B2_3_3Law (stageBPriority (shape 2 3 3)) 2 (fun u => B2_3_3Little u ((stageBPriority (shape 2 3 3)) 2)) 14 a +lemma CB2_3_3I2R14Raw_sound (a : Fin 6) : + (CB2_3_3I2R14Raw a).Encloses (CB2_3_3I2R14Value a) := by + exact residualBall_sound_on (below (shape 2 3 3)) B2_3_3Law (fun u => (stageBLaw (shape 2 3 3) u : ℝ)) (stageBPriority (shape 2 3 3)) 2 (fun u => B2_3_3Little u ((stageBPriority (shape 2 3 3)) 2)) (fun u a => (littleLaw (shape 2 3 3) u ((stageBPriority (shape 2 3 3)) 2) a : ℝ)) (fun u _ => B2_3_3Law_sound u) (fun u _ a => B2_3_3Little_sound u ((stageBPriority (shape 2 3 3)) 2) a) 14 a +def CB2_3_3I2R14Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB2_3_3I2R14Certificates_valid : + CB2_3_3I2R14Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB2_3_3I2R14CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB2_3_3I2R14P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_3_3I2R14Certificates (CB2_3_3I2R14CertificateIndex a)).input +lemma CB2_3_3I2R14P_check : ∀ a : Fin 6, contains (CB2_3_3I2R14Raw a) (CB2_3_3I2R14P a) = true := by + decide +kernel +lemma CB2_3_3I2R14P_sound (a : Fin 6) : + (CB2_3_3I2R14P a).Encloses (CB2_3_3I2R14Value a) := + contains_sound (CB2_3_3I2R14Raw_sound a) (CB2_3_3I2R14P_check a) +def CB2_3_3I2R14Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_3_3I2R14Certificates (CB2_3_3I2R14CertificateIndex a)).output +lemma CB2_3_3I2R14Terms_sound (a : Fin 6) : + (CB2_3_3I2R14Terms a).Encloses (Foundation.entropyTerm (CB2_3_3I2R14Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB2_3_3I2R14Certificates_valid + (CB2_3_3I2R14CertificateIndex a) (CB2_3_3I2R14P_sound a) +def CB2_3_3I2R14Entropy : Ball := ⟨0, 0⟩ +lemma CB2_3_3I2R14Entropy_sound : CB2_3_3I2R14Entropy.Encloses (Foundation.finiteEntropy CB2_3_3I2R14Value) := by + exact contains_sound (entropyFin_enclosed 6 CB2_3_3I2R14Value CB2_3_3I2R14Terms CB2_3_3I2R14Terms_sound) (by decide +kernel) +def CB2_3_3I2R14Mass : Ball := ⟨0, 0⟩ +lemma CB2_3_3I2R14Mass_sound : CB2_3_3I2R14Mass.Encloses (∑ a, CB2_3_3I2R14Value a) := by + exact contains_sound (finSumBall_sound 6 CB2_3_3I2R14P CB2_3_3I2R14Value CB2_3_3I2R14P_sound) (by decide +kernel) +def CB2_3_3I2R14MassTerm : Ball := .exact 0 +lemma CB2_3_3I2R14MassTerm_sound : CB2_3_3I2R14MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB2_3_3I2R14Value a))) := + entropyTerm_zero_ball (CB2_3_3I2R14Mass_sound) +def CB2_3_3I2R14H : Ball := ⟨0, 0⟩ +lemma CB2_3_3I2R14H_sound : CB2_3_3I2R14H.Encloses (homogeneousEntropy CB2_3_3I2R14Value) := by + exact contains_sound (homogeneous_enclosed CB2_3_3I2R14Value CB2_3_3I2R14MassTerm_sound CB2_3_3I2R14Entropy_sound) (by decide +kernel) +def CB2_3_3I2R15Value (a : Fin 6) : ℝ := residualLaw (below (shape 2 3 3)) (fun u => (stageBLaw (shape 2 3 3) u : ℝ)) (stageBPriority (shape 2 3 3)) 2 (fun u a => (littleLaw (shape 2 3 3) u ((stageBPriority (shape 2 3 3)) 2) a : ℝ)) 15 a +def CB2_3_3I2R15Raw (a : Fin 6) : Ball := residualBall (below (shape 2 3 3)) B2_3_3Law (stageBPriority (shape 2 3 3)) 2 (fun u => B2_3_3Little u ((stageBPriority (shape 2 3 3)) 2)) 15 a +lemma CB2_3_3I2R15Raw_sound (a : Fin 6) : + (CB2_3_3I2R15Raw a).Encloses (CB2_3_3I2R15Value a) := by + exact residualBall_sound_on (below (shape 2 3 3)) B2_3_3Law (fun u => (stageBLaw (shape 2 3 3) u : ℝ)) (stageBPriority (shape 2 3 3)) 2 (fun u => B2_3_3Little u ((stageBPriority (shape 2 3 3)) 2)) (fun u a => (littleLaw (shape 2 3 3) u ((stageBPriority (shape 2 3 3)) 2) a : ℝ)) (fun u _ => B2_3_3Law_sound u) (fun u _ a => B2_3_3Little_sound u ((stageBPriority (shape 2 3 3)) 2) a) 15 a +def CB2_3_3I2R15Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB2_3_3I2R15Certificates_valid : + CB2_3_3I2R15Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB2_3_3I2R15CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB2_3_3I2R15P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_3_3I2R15Certificates (CB2_3_3I2R15CertificateIndex a)).input +lemma CB2_3_3I2R15P_check : ∀ a : Fin 6, contains (CB2_3_3I2R15Raw a) (CB2_3_3I2R15P a) = true := by + decide +kernel +lemma CB2_3_3I2R15P_sound (a : Fin 6) : + (CB2_3_3I2R15P a).Encloses (CB2_3_3I2R15Value a) := + contains_sound (CB2_3_3I2R15Raw_sound a) (CB2_3_3I2R15P_check a) +def CB2_3_3I2R15Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_3_3I2R15Certificates (CB2_3_3I2R15CertificateIndex a)).output +lemma CB2_3_3I2R15Terms_sound (a : Fin 6) : + (CB2_3_3I2R15Terms a).Encloses (Foundation.entropyTerm (CB2_3_3I2R15Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB2_3_3I2R15Certificates_valid + (CB2_3_3I2R15CertificateIndex a) (CB2_3_3I2R15P_sound a) +def CB2_3_3I2R15Entropy : Ball := ⟨0, 0⟩ +lemma CB2_3_3I2R15Entropy_sound : CB2_3_3I2R15Entropy.Encloses (Foundation.finiteEntropy CB2_3_3I2R15Value) := by + exact contains_sound (entropyFin_enclosed 6 CB2_3_3I2R15Value CB2_3_3I2R15Terms CB2_3_3I2R15Terms_sound) (by decide +kernel) +def CB2_3_3I2R15Mass : Ball := ⟨0, 0⟩ +lemma CB2_3_3I2R15Mass_sound : CB2_3_3I2R15Mass.Encloses (∑ a, CB2_3_3I2R15Value a) := by + exact contains_sound (finSumBall_sound 6 CB2_3_3I2R15P CB2_3_3I2R15Value CB2_3_3I2R15P_sound) (by decide +kernel) +def CB2_3_3I2R15MassTerm : Ball := .exact 0 +lemma CB2_3_3I2R15MassTerm_sound : CB2_3_3I2R15MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB2_3_3I2R15Value a))) := + entropyTerm_zero_ball (CB2_3_3I2R15Mass_sound) +def CB2_3_3I2R15H : Ball := ⟨0, 0⟩ +lemma CB2_3_3I2R15H_sound : CB2_3_3I2R15H.Encloses (homogeneousEntropy CB2_3_3I2R15Value) := by + exact contains_sound (homogeneous_enclosed CB2_3_3I2R15Value CB2_3_3I2R15MassTerm_sound CB2_3_3I2R15Entropy_sound) (by decide +kernel) +def CB2_3_3I2R16Value (a : Fin 6) : ℝ := residualLaw (below (shape 2 3 3)) (fun u => (stageBLaw (shape 2 3 3) u : ℝ)) (stageBPriority (shape 2 3 3)) 2 (fun u a => (littleLaw (shape 2 3 3) u ((stageBPriority (shape 2 3 3)) 2) a : ℝ)) 16 a +def CB2_3_3I2R16Raw (a : Fin 6) : Ball := residualBall (below (shape 2 3 3)) B2_3_3Law (stageBPriority (shape 2 3 3)) 2 (fun u => B2_3_3Little u ((stageBPriority (shape 2 3 3)) 2)) 16 a +lemma CB2_3_3I2R16Raw_sound (a : Fin 6) : + (CB2_3_3I2R16Raw a).Encloses (CB2_3_3I2R16Value a) := by + exact residualBall_sound_on (below (shape 2 3 3)) B2_3_3Law (fun u => (stageBLaw (shape 2 3 3) u : ℝ)) (stageBPriority (shape 2 3 3)) 2 (fun u => B2_3_3Little u ((stageBPriority (shape 2 3 3)) 2)) (fun u a => (littleLaw (shape 2 3 3) u ((stageBPriority (shape 2 3 3)) 2) a : ℝ)) (fun u _ => B2_3_3Law_sound u) (fun u _ a => B2_3_3Little_sound u ((stageBPriority (shape 2 3 3)) 2) a) 16 a +def CB2_3_3I2R16Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB2_3_3I2R16Certificates_valid : + CB2_3_3I2R16Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB2_3_3I2R16CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB2_3_3I2R16P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_3_3I2R16Certificates (CB2_3_3I2R16CertificateIndex a)).input +lemma CB2_3_3I2R16P_check : ∀ a : Fin 6, contains (CB2_3_3I2R16Raw a) (CB2_3_3I2R16P a) = true := by + decide +kernel +lemma CB2_3_3I2R16P_sound (a : Fin 6) : + (CB2_3_3I2R16P a).Encloses (CB2_3_3I2R16Value a) := + contains_sound (CB2_3_3I2R16Raw_sound a) (CB2_3_3I2R16P_check a) +def CB2_3_3I2R16Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_3_3I2R16Certificates (CB2_3_3I2R16CertificateIndex a)).output +lemma CB2_3_3I2R16Terms_sound (a : Fin 6) : + (CB2_3_3I2R16Terms a).Encloses (Foundation.entropyTerm (CB2_3_3I2R16Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB2_3_3I2R16Certificates_valid + (CB2_3_3I2R16CertificateIndex a) (CB2_3_3I2R16P_sound a) +def CB2_3_3I2R16Entropy : Ball := ⟨0, 0⟩ +lemma CB2_3_3I2R16Entropy_sound : CB2_3_3I2R16Entropy.Encloses (Foundation.finiteEntropy CB2_3_3I2R16Value) := by + exact contains_sound (entropyFin_enclosed 6 CB2_3_3I2R16Value CB2_3_3I2R16Terms CB2_3_3I2R16Terms_sound) (by decide +kernel) +def CB2_3_3I2R16Mass : Ball := ⟨0, 0⟩ +lemma CB2_3_3I2R16Mass_sound : CB2_3_3I2R16Mass.Encloses (∑ a, CB2_3_3I2R16Value a) := by + exact contains_sound (finSumBall_sound 6 CB2_3_3I2R16P CB2_3_3I2R16Value CB2_3_3I2R16P_sound) (by decide +kernel) +def CB2_3_3I2R16MassTerm : Ball := .exact 0 +lemma CB2_3_3I2R16MassTerm_sound : CB2_3_3I2R16MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB2_3_3I2R16Value a))) := + entropyTerm_zero_ball (CB2_3_3I2R16Mass_sound) +def CB2_3_3I2R16H : Ball := ⟨0, 0⟩ +lemma CB2_3_3I2R16H_sound : CB2_3_3I2R16H.Encloses (homogeneousEntropy CB2_3_3I2R16Value) := by + exact contains_sound (homogeneous_enclosed CB2_3_3I2R16Value CB2_3_3I2R16MassTerm_sound CB2_3_3I2R16Entropy_sound) (by decide +kernel) +def CB2_3_3I2ResidualEntropies (a : Fin 17) : Ball := + match a.val with + | 0 => CB2_3_3I2R0H + | 1 => CB2_3_3I2R1H + | 2 => CB2_3_3I2R2H + | 3 => CB2_3_3I2R3H + | 4 => CB2_3_3I2R4H + | 5 => CB2_3_3I2R5H + | 6 => CB2_3_3I2R6H + | 7 => CB2_3_3I2R7H + | 8 => CB2_3_3I2R8H + | 9 => CB2_3_3I2R9H + | 10 => CB2_3_3I2R10H + | 11 => CB2_3_3I2R11H + | 12 => CB2_3_3I2R12H + | 13 => CB2_3_3I2R13H + | 14 => CB2_3_3I2R14H + | 15 => CB2_3_3I2R15H + | 16 => CB2_3_3I2R16H + | _ => (.exact 0) +lemma CB2_3_3I2ResidualEntropies_sound (k : Fin 17) : + (CB2_3_3I2ResidualEntropies k).Encloses (homogeneousEntropy + (residualLaw (below (shape 2 3 3)) (fun u => (stageBLaw (shape 2 3 3) u : ℝ)) (stageBPriority (shape 2 3 3)) 2 (fun u a => (littleLaw (shape 2 3 3) u ((stageBPriority (shape 2 3 3)) 2) a : ℝ)) k)) := by + fin_cases k + · exact CB2_3_3I2R0H_sound + · exact CB2_3_3I2R1H_sound + · exact CB2_3_3I2R2H_sound + · exact CB2_3_3I2R3H_sound + · exact CB2_3_3I2R4H_sound + · exact CB2_3_3I2R5H_sound + · exact CB2_3_3I2R6H_sound + · exact CB2_3_3I2R7H_sound + · exact CB2_3_3I2R8H_sound + · exact CB2_3_3I2R9H_sound + · exact CB2_3_3I2R10H_sound + · exact CB2_3_3I2R11H_sound + · exact CB2_3_3I2R12H_sound + · exact CB2_3_3I2R13H_sound + · exact CB2_3_3I2R14H_sound + · exact CB2_3_3I2R15H_sound + · exact CB2_3_3I2R16H_sound +def CB2_3_3I2S0_1_3Value (a : Fin 6) : ℝ := (littleLaw (shape 2 3 3) (shape 0 1 3) ((stageBPriority (shape 2 3 3)) 2) a : ℝ) +def CB2_3_3I2S0_1_3E_4Log : Ball := .exact 0 +lemma CB2_3_3I2S0_1_3E_4Log_sound : CB2_3_3I2S0_1_3E_4Log.Encloses (Real.log (CB2_3_3I2S0_1_3Value (4 : Fin 6))) := by + exact log_exact_one_ball ((B2_3_3Little_sound (shape 0 1 3) ((stageBPriority (shape 2 3 3)) 2)) (4 : Fin 6)) +def CB2_3_3I2S0_1_3E_4 : Ball := ⟨0, 0⟩ +lemma CB2_3_3I2S0_1_3E_4_sound : CB2_3_3I2S0_1_3E_4.Encloses (Foundation.entropyTerm (CB2_3_3I2S0_1_3Value (4 : Fin 6))) := by + exact contains_sound (entropyTerm_ball ((B2_3_3Little_sound (shape 0 1 3) ((stageBPriority (shape 2 3 3)) 2)) (4 : Fin 6)) CB2_3_3I2S0_1_3E_4Log_sound) (by decide +kernel) +def CB2_3_3I2S0_1_3Terms (a : Fin 6) : Ball := + match a.val with + | 4 => ⟨0, 0⟩ + | _ => (.exact 0) +lemma CB2_3_3I2S0_1_3Terms_sound (a : Fin 6) : + (CB2_3_3I2S0_1_3Terms a).Encloses (Foundation.entropyTerm (CB2_3_3I2S0_1_3Value a)) := by + fin_cases a + · exact (entropyTerm_zero_ball ((B2_3_3Little_sound (shape 0 1 3) ((stageBPriority (shape 2 3 3)) 2)) (0 : Fin 6))) + · exact (entropyTerm_zero_ball ((B2_3_3Little_sound (shape 0 1 3) ((stageBPriority (shape 2 3 3)) 2)) (1 : Fin 6))) + · exact (entropyTerm_zero_ball ((B2_3_3Little_sound (shape 0 1 3) ((stageBPriority (shape 2 3 3)) 2)) (2 : Fin 6))) + · exact (entropyTerm_zero_ball ((B2_3_3Little_sound (shape 0 1 3) ((stageBPriority (shape 2 3 3)) 2)) (3 : Fin 6))) + · exact CB2_3_3I2S0_1_3E_4_sound + · exact (entropyTerm_zero_ball ((B2_3_3Little_sound (shape 0 1 3) ((stageBPriority (shape 2 3 3)) 2)) (5 : Fin 6))) +def CB2_3_3I2S0_1_3Entropy : Ball := ⟨0, 0⟩ +lemma CB2_3_3I2S0_1_3Entropy_sound : CB2_3_3I2S0_1_3Entropy.Encloses (Foundation.finiteEntropy CB2_3_3I2S0_1_3Value) := by + exact contains_sound (entropyFin_enclosed 6 CB2_3_3I2S0_1_3Value CB2_3_3I2S0_1_3Terms CB2_3_3I2S0_1_3Terms_sound) (by decide +kernel) +def CB2_3_3I2S0_1_3Mass : Ball := ⟨1, 0⟩ +lemma CB2_3_3I2S0_1_3Mass_sound : CB2_3_3I2S0_1_3Mass.Encloses (∑ a, CB2_3_3I2S0_1_3Value a) := by + exact contains_sound (finSumBall_sound 6 (B2_3_3Little (shape 0 1 3) ((stageBPriority (shape 2 3 3)) 2)) CB2_3_3I2S0_1_3Value (B2_3_3Little_sound (shape 0 1 3) ((stageBPriority (shape 2 3 3)) 2))) (by decide +kernel) +def CB2_3_3I2S0_1_3MassTermLog : Ball := .exact 0 +lemma CB2_3_3I2S0_1_3MassTermLog_sound : CB2_3_3I2S0_1_3MassTermLog.Encloses (Real.log ((∑ a, CB2_3_3I2S0_1_3Value a))) := by + exact log_exact_one_ball (CB2_3_3I2S0_1_3Mass_sound) +def CB2_3_3I2S0_1_3MassTerm : Ball := ⟨0, 0⟩ +lemma CB2_3_3I2S0_1_3MassTerm_sound : CB2_3_3I2S0_1_3MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB2_3_3I2S0_1_3Value a))) := by + exact contains_sound (entropyTerm_ball (CB2_3_3I2S0_1_3Mass_sound) CB2_3_3I2S0_1_3MassTermLog_sound) (by decide +kernel) +def CB2_3_3I2S0_1_3H : Ball := ⟨0, 0⟩ +lemma CB2_3_3I2S0_1_3H_sound : CB2_3_3I2S0_1_3H.Encloses (homogeneousEntropy CB2_3_3I2S0_1_3Value) := by + exact contains_sound (homogeneous_enclosed CB2_3_3I2S0_1_3Value CB2_3_3I2S0_1_3MassTerm_sound CB2_3_3I2S0_1_3Entropy_sound) (by decide +kernel) +def CB2_3_3I2S0_2_2Value (a : Fin 6) : ℝ := (littleLaw (shape 2 3 3) (shape 0 2 2) ((stageBPriority (shape 2 3 3)) 2) a : ℝ) +def CB2_3_3I2S0_2_2E_2LogWitness : LogWitness := ⟨-1, 444959, 250000⟩ +def CB2_3_3I2S0_2_2E_2Log : Ball := ⟨(-5831297766604325579437218806789 / 50000000000000000000000000000000), (21175823683 / 50000000000000000000000000000000)⟩ +lemma CB2_3_3I2S0_2_2E_2Log_sound : CB2_3_3I2S0_2_2E_2Log.Encloses (Real.log (CB2_3_3I2S0_2_2Value (2 : Fin 6))) := by + exact checkLog_sound logTwoBall_sound ((B2_3_3Little_sound (shape 0 2 2) ((stageBPriority (shape 2 3 3)) 2)) (2 : Fin 6)) (w := CB2_3_3I2S0_2_2E_2LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB2_3_3I2S0_2_2E_2 : Ball := ⟨(51893768458609882110016108861 / 500000000000000000000000000000), (37689493321 / 100000000000000000000000000000000)⟩ +lemma CB2_3_3I2S0_2_2E_2_sound : CB2_3_3I2S0_2_2E_2.Encloses (Foundation.entropyTerm (CB2_3_3I2S0_2_2Value (2 : Fin 6))) := by + exact contains_sound (entropyTerm_ball ((B2_3_3Little_sound (shape 0 2 2) ((stageBPriority (shape 2 3 3)) 2)) (2 : Fin 6)) CB2_3_3I2S0_2_2E_2Log_sound) (by decide +kernel) +def CB2_3_3I2S0_2_2E_3LogWitness : LogWitness := ⟨-4, 55041, 31250⟩ +def CB2_3_3I2S0_2_2E_3Log : Ball := ⟨(-55163243408937486421493177388873 / 25000000000000000000000000000000), (21175823683 / 20000000000000000000000000000000)⟩ +lemma CB2_3_3I2S0_2_2E_3Log_sound : CB2_3_3I2S0_2_2E_3Log.Encloses (Real.log (CB2_3_3I2S0_2_2Value (3 : Fin 6))) := by + exact checkLog_sound logTwoBall_sound ((B2_3_3Little_sound (shape 0 2 2) ((stageBPriority (shape 2 3 3)) 2)) (3 : Fin 6)) (w := CB2_3_3I2S0_2_2E_3LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB2_3_3I2S0_2_2E_3 : Ball := ⟨(3036240080471328190125405976661 / 12500000000000000000000000000000), (5827692557 / 50000000000000000000000000000000)⟩ +lemma CB2_3_3I2S0_2_2E_3_sound : CB2_3_3I2S0_2_2E_3.Encloses (Foundation.entropyTerm (CB2_3_3I2S0_2_2Value (3 : Fin 6))) := by + exact contains_sound (entropyTerm_ball ((B2_3_3Little_sound (shape 0 2 2) ((stageBPriority (shape 2 3 3)) 2)) (3 : Fin 6)) CB2_3_3I2S0_2_2E_3Log_sound) (by decide +kernel) +def CB2_3_3I2S0_2_2Terms (a : Fin 6) : Ball := + match a.val with + | 2 => ⟨(51893768458609882110016108861 / 500000000000000000000000000000), (37689493321 / 100000000000000000000000000000000)⟩ + | 3 => ⟨(3036240080471328190125405976661 / 12500000000000000000000000000000), (5827692557 / 50000000000000000000000000000000)⟩ + | _ => (.exact 0) +lemma CB2_3_3I2S0_2_2Terms_sound (a : Fin 6) : + (CB2_3_3I2S0_2_2Terms a).Encloses (Foundation.entropyTerm (CB2_3_3I2S0_2_2Value a)) := by + fin_cases a + · exact (entropyTerm_zero_ball ((B2_3_3Little_sound (shape 0 2 2) ((stageBPriority (shape 2 3 3)) 2)) (0 : Fin 6))) + · exact (entropyTerm_zero_ball ((B2_3_3Little_sound (shape 0 2 2) ((stageBPriority (shape 2 3 3)) 2)) (1 : Fin 6))) + · exact CB2_3_3I2S0_2_2E_2_sound + · exact CB2_3_3I2S0_2_2E_3_sound + · exact (entropyTerm_zero_ball ((B2_3_3Little_sound (shape 0 2 2) ((stageBPriority (shape 2 3 3)) 2)) (4 : Fin 6))) + · exact (entropyTerm_zero_ball ((B2_3_3Little_sound (shape 0 2 2) ((stageBPriority (shape 2 3 3)) 2)) (5 : Fin 6))) +def CB2_3_3I2S0_2_2Entropy : Ball := ⟨(2166792145968287621437904349093 / 6250000000000000000000000000000), (9868975687 / 20000000000000000000000000000000)⟩ +lemma CB2_3_3I2S0_2_2Entropy_sound : CB2_3_3I2S0_2_2Entropy.Encloses (Foundation.finiteEntropy CB2_3_3I2S0_2_2Value) := by + exact contains_sound (entropyFin_enclosed 6 CB2_3_3I2S0_2_2Value CB2_3_3I2S0_2_2Terms CB2_3_3I2S0_2_2Terms_sound) (by decide +kernel) +def CB2_3_3I2S0_2_2Mass : Ball := ⟨1, 0⟩ +lemma CB2_3_3I2S0_2_2Mass_sound : CB2_3_3I2S0_2_2Mass.Encloses (∑ a, CB2_3_3I2S0_2_2Value a) := by + exact contains_sound (finSumBall_sound 6 (B2_3_3Little (shape 0 2 2) ((stageBPriority (shape 2 3 3)) 2)) CB2_3_3I2S0_2_2Value (B2_3_3Little_sound (shape 0 2 2) ((stageBPriority (shape 2 3 3)) 2))) (by decide +kernel) +def CB2_3_3I2S0_2_2MassTermLog : Ball := .exact 0 +lemma CB2_3_3I2S0_2_2MassTermLog_sound : CB2_3_3I2S0_2_2MassTermLog.Encloses (Real.log ((∑ a, CB2_3_3I2S0_2_2Value a))) := by + exact log_exact_one_ball (CB2_3_3I2S0_2_2Mass_sound) +def CB2_3_3I2S0_2_2MassTerm : Ball := ⟨0, 0⟩ +lemma CB2_3_3I2S0_2_2MassTerm_sound : CB2_3_3I2S0_2_2MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB2_3_3I2S0_2_2Value a))) := by + exact contains_sound (entropyTerm_ball (CB2_3_3I2S0_2_2Mass_sound) CB2_3_3I2S0_2_2MassTermLog_sound) (by decide +kernel) +def CB2_3_3I2S0_2_2H : Ball := ⟨(2166792145968287621437904349093 / 6250000000000000000000000000000), (9868975687 / 20000000000000000000000000000000)⟩ +lemma CB2_3_3I2S0_2_2H_sound : CB2_3_3I2S0_2_2H.Encloses (homogeneousEntropy CB2_3_3I2S0_2_2Value) := by + exact contains_sound (homogeneous_enclosed CB2_3_3I2S0_2_2Value CB2_3_3I2S0_2_2MassTerm_sound CB2_3_3I2S0_2_2Entropy_sound) (by decide +kernel) +def CB2_3_3I2S0_3_1Value (a : Fin 6) : ℝ := (littleLaw (shape 2 3 3) (shape 0 3 1) ((stageBPriority (shape 2 3 3)) 2) a : ℝ) +def CB2_3_3I2S0_3_1E_1Log : Ball := .exact 0 +lemma CB2_3_3I2S0_3_1E_1Log_sound : CB2_3_3I2S0_3_1E_1Log.Encloses (Real.log (CB2_3_3I2S0_3_1Value (1 : Fin 6))) := by + exact log_exact_one_ball ((B2_3_3Little_sound (shape 0 3 1) ((stageBPriority (shape 2 3 3)) 2)) (1 : Fin 6)) +def CB2_3_3I2S0_3_1E_1 : Ball := ⟨0, 0⟩ +lemma CB2_3_3I2S0_3_1E_1_sound : CB2_3_3I2S0_3_1E_1.Encloses (Foundation.entropyTerm (CB2_3_3I2S0_3_1Value (1 : Fin 6))) := by + exact contains_sound (entropyTerm_ball ((B2_3_3Little_sound (shape 0 3 1) ((stageBPriority (shape 2 3 3)) 2)) (1 : Fin 6)) CB2_3_3I2S0_3_1E_1Log_sound) (by decide +kernel) +def CB2_3_3I2S0_3_1Terms (a : Fin 6) : Ball := + match a.val with + | 1 => ⟨0, 0⟩ + | _ => (.exact 0) +lemma CB2_3_3I2S0_3_1Terms_sound (a : Fin 6) : + (CB2_3_3I2S0_3_1Terms a).Encloses (Foundation.entropyTerm (CB2_3_3I2S0_3_1Value a)) := by + fin_cases a + · exact (entropyTerm_zero_ball ((B2_3_3Little_sound (shape 0 3 1) ((stageBPriority (shape 2 3 3)) 2)) (0 : Fin 6))) + · exact CB2_3_3I2S0_3_1E_1_sound + · exact (entropyTerm_zero_ball ((B2_3_3Little_sound (shape 0 3 1) ((stageBPriority (shape 2 3 3)) 2)) (2 : Fin 6))) + · exact (entropyTerm_zero_ball ((B2_3_3Little_sound (shape 0 3 1) ((stageBPriority (shape 2 3 3)) 2)) (3 : Fin 6))) + · exact (entropyTerm_zero_ball ((B2_3_3Little_sound (shape 0 3 1) ((stageBPriority (shape 2 3 3)) 2)) (4 : Fin 6))) + · exact (entropyTerm_zero_ball ((B2_3_3Little_sound (shape 0 3 1) ((stageBPriority (shape 2 3 3)) 2)) (5 : Fin 6))) +def CB2_3_3I2S0_3_1Entropy : Ball := ⟨0, 0⟩ +lemma CB2_3_3I2S0_3_1Entropy_sound : CB2_3_3I2S0_3_1Entropy.Encloses (Foundation.finiteEntropy CB2_3_3I2S0_3_1Value) := by + exact contains_sound (entropyFin_enclosed 6 CB2_3_3I2S0_3_1Value CB2_3_3I2S0_3_1Terms CB2_3_3I2S0_3_1Terms_sound) (by decide +kernel) +def CB2_3_3I2S0_3_1Mass : Ball := ⟨1, 0⟩ +lemma CB2_3_3I2S0_3_1Mass_sound : CB2_3_3I2S0_3_1Mass.Encloses (∑ a, CB2_3_3I2S0_3_1Value a) := by + exact contains_sound (finSumBall_sound 6 (B2_3_3Little (shape 0 3 1) ((stageBPriority (shape 2 3 3)) 2)) CB2_3_3I2S0_3_1Value (B2_3_3Little_sound (shape 0 3 1) ((stageBPriority (shape 2 3 3)) 2))) (by decide +kernel) +def CB2_3_3I2S0_3_1MassTermLog : Ball := .exact 0 +lemma CB2_3_3I2S0_3_1MassTermLog_sound : CB2_3_3I2S0_3_1MassTermLog.Encloses (Real.log ((∑ a, CB2_3_3I2S0_3_1Value a))) := by + exact log_exact_one_ball (CB2_3_3I2S0_3_1Mass_sound) +def CB2_3_3I2S0_3_1MassTerm : Ball := ⟨0, 0⟩ +lemma CB2_3_3I2S0_3_1MassTerm_sound : CB2_3_3I2S0_3_1MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB2_3_3I2S0_3_1Value a))) := by + exact contains_sound (entropyTerm_ball (CB2_3_3I2S0_3_1Mass_sound) CB2_3_3I2S0_3_1MassTermLog_sound) (by decide +kernel) +def CB2_3_3I2S0_3_1H : Ball := ⟨0, 0⟩ +lemma CB2_3_3I2S0_3_1H_sound : CB2_3_3I2S0_3_1H.Encloses (homogeneousEntropy CB2_3_3I2S0_3_1Value) := by + exact contains_sound (homogeneous_enclosed CB2_3_3I2S0_3_1Value CB2_3_3I2S0_3_1MassTerm_sound CB2_3_3I2S0_3_1Entropy_sound) (by decide +kernel) +def CB2_3_3I2S1_0_3Value (a : Fin 6) : ℝ := (littleLaw (shape 2 3 3) (shape 1 0 3) ((stageBPriority (shape 2 3 3)) 2) a : ℝ) +def CB2_3_3I2S1_0_3E_4Log : Ball := .exact 0 +lemma CB2_3_3I2S1_0_3E_4Log_sound : CB2_3_3I2S1_0_3E_4Log.Encloses (Real.log (CB2_3_3I2S1_0_3Value (4 : Fin 6))) := by + exact log_exact_one_ball ((B2_3_3Little_sound (shape 1 0 3) ((stageBPriority (shape 2 3 3)) 2)) (4 : Fin 6)) +def CB2_3_3I2S1_0_3E_4 : Ball := ⟨0, 0⟩ +lemma CB2_3_3I2S1_0_3E_4_sound : CB2_3_3I2S1_0_3E_4.Encloses (Foundation.entropyTerm (CB2_3_3I2S1_0_3Value (4 : Fin 6))) := by + exact contains_sound (entropyTerm_ball ((B2_3_3Little_sound (shape 1 0 3) ((stageBPriority (shape 2 3 3)) 2)) (4 : Fin 6)) CB2_3_3I2S1_0_3E_4Log_sound) (by decide +kernel) +def CB2_3_3I2S1_0_3Terms (a : Fin 6) : Ball := + match a.val with + | 4 => ⟨0, 0⟩ + | _ => (.exact 0) +lemma CB2_3_3I2S1_0_3Terms_sound (a : Fin 6) : + (CB2_3_3I2S1_0_3Terms a).Encloses (Foundation.entropyTerm (CB2_3_3I2S1_0_3Value a)) := by + fin_cases a + · exact (entropyTerm_zero_ball ((B2_3_3Little_sound (shape 1 0 3) ((stageBPriority (shape 2 3 3)) 2)) (0 : Fin 6))) + · exact (entropyTerm_zero_ball ((B2_3_3Little_sound (shape 1 0 3) ((stageBPriority (shape 2 3 3)) 2)) (1 : Fin 6))) + · exact (entropyTerm_zero_ball ((B2_3_3Little_sound (shape 1 0 3) ((stageBPriority (shape 2 3 3)) 2)) (2 : Fin 6))) + · exact (entropyTerm_zero_ball ((B2_3_3Little_sound (shape 1 0 3) ((stageBPriority (shape 2 3 3)) 2)) (3 : Fin 6))) + · exact CB2_3_3I2S1_0_3E_4_sound + · exact (entropyTerm_zero_ball ((B2_3_3Little_sound (shape 1 0 3) ((stageBPriority (shape 2 3 3)) 2)) (5 : Fin 6))) +def CB2_3_3I2S1_0_3Entropy : Ball := ⟨0, 0⟩ +lemma CB2_3_3I2S1_0_3Entropy_sound : CB2_3_3I2S1_0_3Entropy.Encloses (Foundation.finiteEntropy CB2_3_3I2S1_0_3Value) := by + exact contains_sound (entropyFin_enclosed 6 CB2_3_3I2S1_0_3Value CB2_3_3I2S1_0_3Terms CB2_3_3I2S1_0_3Terms_sound) (by decide +kernel) +def CB2_3_3I2S1_0_3Mass : Ball := ⟨1, 0⟩ +lemma CB2_3_3I2S1_0_3Mass_sound : CB2_3_3I2S1_0_3Mass.Encloses (∑ a, CB2_3_3I2S1_0_3Value a) := by + exact contains_sound (finSumBall_sound 6 (B2_3_3Little (shape 1 0 3) ((stageBPriority (shape 2 3 3)) 2)) CB2_3_3I2S1_0_3Value (B2_3_3Little_sound (shape 1 0 3) ((stageBPriority (shape 2 3 3)) 2))) (by decide +kernel) +def CB2_3_3I2S1_0_3MassTermLog : Ball := .exact 0 +lemma CB2_3_3I2S1_0_3MassTermLog_sound : CB2_3_3I2S1_0_3MassTermLog.Encloses (Real.log ((∑ a, CB2_3_3I2S1_0_3Value a))) := by + exact log_exact_one_ball (CB2_3_3I2S1_0_3Mass_sound) +def CB2_3_3I2S1_0_3MassTerm : Ball := ⟨0, 0⟩ +lemma CB2_3_3I2S1_0_3MassTerm_sound : CB2_3_3I2S1_0_3MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB2_3_3I2S1_0_3Value a))) := by + exact contains_sound (entropyTerm_ball (CB2_3_3I2S1_0_3Mass_sound) CB2_3_3I2S1_0_3MassTermLog_sound) (by decide +kernel) +def CB2_3_3I2S1_0_3H : Ball := ⟨0, 0⟩ +lemma CB2_3_3I2S1_0_3H_sound : CB2_3_3I2S1_0_3H.Encloses (homogeneousEntropy CB2_3_3I2S1_0_3Value) := by + exact contains_sound (homogeneous_enclosed CB2_3_3I2S1_0_3Value CB2_3_3I2S1_0_3MassTerm_sound CB2_3_3I2S1_0_3Entropy_sound) (by decide +kernel) +def CB2_3_3I2S2_0_2Value (a : Fin 6) : ℝ := (littleLaw (shape 2 3 3) (shape 2 0 2) ((stageBPriority (shape 2 3 3)) 2) a : ℝ) +def CB2_3_3I2S2_0_2E_2LogWitness : LogWitness := ⟨-1, 895909, 500000⟩ +def CB2_3_3I2S2_0_2E_2Log : Ball := ⟨(-10991643366502651450018611428491 / 100000000000000000000000000000000), (21175823683 / 50000000000000000000000000000000)⟩ +lemma CB2_3_3I2S2_0_2E_2Log_sound : CB2_3_3I2S2_0_2E_2Log.Encloses (Real.log (CB2_3_3I2S2_0_2Value (2 : Fin 6))) := by + exact checkLog_sound logTwoBall_sound ((B2_3_3Little_sound (shape 2 0 2) ((stageBPriority (shape 2 3 3)) 2)) (2 : Fin 6)) (w := CB2_3_3I2S2_0_2E_2LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB2_3_3I2S2_0_2E_2 : Ball := ⟨(615469513552501497370920259143 / 6250000000000000000000000000000), (37943222041 / 100000000000000000000000000000000)⟩ +lemma CB2_3_3I2S2_0_2E_2_sound : CB2_3_3I2S2_0_2E_2.Encloses (Foundation.entropyTerm (CB2_3_3I2S2_0_2Value (2 : Fin 6))) := by + exact contains_sound (entropyTerm_ball ((B2_3_3Little_sound (shape 2 0 2) ((stageBPriority (shape 2 3 3)) 2)) (2 : Fin 6)) CB2_3_3I2S2_0_2E_2Log_sound) (by decide +kernel) +def CB2_3_3I2S2_0_2E_3LogWitness : LogWitness := ⟨-4, 104091, 62500⟩ +def CB2_3_3I2S2_0_2E_3Log : Ball := ⟨(-56562244060752588474630885788059 / 25000000000000000000000000000000), (52939559207 / 50000000000000000000000000000000)⟩ +lemma CB2_3_3I2S2_0_2E_3Log_sound : CB2_3_3I2S2_0_2E_3Log.Encloses (Real.log (CB2_3_3I2S2_0_2Value (3 : Fin 6))) := by + exact checkLog_sound logTwoBall_sound ((B2_3_3Little_sound (shape 2 0 2) ((stageBPriority (shape 2 3 3)) 2)) (3 : Fin 6)) (w := CB2_3_3I2S2_0_2E_3LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB2_3_3I2S2_0_2E_3 : Ball := ⟨(23550482186111190747651214130259 / 100000000000000000000000000000000), (2755265829 / 25000000000000000000000000000000)⟩ +lemma CB2_3_3I2S2_0_2E_3_sound : CB2_3_3I2S2_0_2E_3.Encloses (Foundation.entropyTerm (CB2_3_3I2S2_0_2Value (3 : Fin 6))) := by + exact contains_sound (entropyTerm_ball ((B2_3_3Little_sound (shape 2 0 2) ((stageBPriority (shape 2 3 3)) 2)) (3 : Fin 6)) CB2_3_3I2S2_0_2E_3Log_sound) (by decide +kernel) +def CB2_3_3I2S2_0_2Terms (a : Fin 6) : Ball := + match a.val with + | 2 => ⟨(615469513552501497370920259143 / 6250000000000000000000000000000), (37943222041 / 100000000000000000000000000000000)⟩ + | 3 => ⟨(23550482186111190747651214130259 / 100000000000000000000000000000000), (2755265829 / 25000000000000000000000000000000)⟩ + | _ => (.exact 0) +lemma CB2_3_3I2S2_0_2Terms_sound (a : Fin 6) : + (CB2_3_3I2S2_0_2Terms a).Encloses (Foundation.entropyTerm (CB2_3_3I2S2_0_2Value a)) := by + fin_cases a + · exact (entropyTerm_zero_ball ((B2_3_3Little_sound (shape 2 0 2) ((stageBPriority (shape 2 3 3)) 2)) (0 : Fin 6))) + · exact (entropyTerm_zero_ball ((B2_3_3Little_sound (shape 2 0 2) ((stageBPriority (shape 2 3 3)) 2)) (1 : Fin 6))) + · exact CB2_3_3I2S2_0_2E_2_sound + · exact CB2_3_3I2S2_0_2E_3_sound + · exact (entropyTerm_zero_ball ((B2_3_3Little_sound (shape 2 0 2) ((stageBPriority (shape 2 3 3)) 2)) (4 : Fin 6))) + · exact (entropyTerm_zero_ball ((B2_3_3Little_sound (shape 2 0 2) ((stageBPriority (shape 2 3 3)) 2)) (5 : Fin 6))) +def CB2_3_3I2S2_0_2Entropy : Ball := ⟨(33397994402951214705585938276547 / 100000000000000000000000000000000), (48964285357 / 100000000000000000000000000000000)⟩ +lemma CB2_3_3I2S2_0_2Entropy_sound : CB2_3_3I2S2_0_2Entropy.Encloses (Foundation.finiteEntropy CB2_3_3I2S2_0_2Value) := by + exact contains_sound (entropyFin_enclosed 6 CB2_3_3I2S2_0_2Value CB2_3_3I2S2_0_2Terms CB2_3_3I2S2_0_2Terms_sound) (by decide +kernel) +def CB2_3_3I2S2_0_2Mass : Ball := ⟨1, 0⟩ +lemma CB2_3_3I2S2_0_2Mass_sound : CB2_3_3I2S2_0_2Mass.Encloses (∑ a, CB2_3_3I2S2_0_2Value a) := by + exact contains_sound (finSumBall_sound 6 (B2_3_3Little (shape 2 0 2) ((stageBPriority (shape 2 3 3)) 2)) CB2_3_3I2S2_0_2Value (B2_3_3Little_sound (shape 2 0 2) ((stageBPriority (shape 2 3 3)) 2))) (by decide +kernel) +def CB2_3_3I2S2_0_2MassTermLog : Ball := .exact 0 +lemma CB2_3_3I2S2_0_2MassTermLog_sound : CB2_3_3I2S2_0_2MassTermLog.Encloses (Real.log ((∑ a, CB2_3_3I2S2_0_2Value a))) := by + exact log_exact_one_ball (CB2_3_3I2S2_0_2Mass_sound) +def CB2_3_3I2S2_0_2MassTerm : Ball := ⟨0, 0⟩ +lemma CB2_3_3I2S2_0_2MassTerm_sound : CB2_3_3I2S2_0_2MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB2_3_3I2S2_0_2Value a))) := by + exact contains_sound (entropyTerm_ball (CB2_3_3I2S2_0_2Mass_sound) CB2_3_3I2S2_0_2MassTermLog_sound) (by decide +kernel) +def CB2_3_3I2S2_0_2H : Ball := ⟨(33397994402951214705585938276547 / 100000000000000000000000000000000), (48964285357 / 100000000000000000000000000000000)⟩ +lemma CB2_3_3I2S2_0_2H_sound : CB2_3_3I2S2_0_2H.Encloses (homogeneousEntropy CB2_3_3I2S2_0_2Value) := by + exact contains_sound (homogeneous_enclosed CB2_3_3I2S2_0_2Value CB2_3_3I2S2_0_2MassTerm_sound CB2_3_3I2S2_0_2Entropy_sound) (by decide +kernel) +def CB2_3_3I2Singles (s : Shape) : Ball := + match s 0, s 1, s 2 with + | 0, 1, 3 => CB2_3_3I2S0_1_3H + | 0, 2, 2 => CB2_3_3I2S0_2_2H + | 0, 3, 1 => CB2_3_3I2S0_3_1H + | 1, 0, 3 => CB2_3_3I2S1_0_3H + | 2, 0, 2 => CB2_3_3I2S2_0_2H + | _, _, _ => (.exact 0) +lemma CB2_3_3I2Singles_sound (u : Shape) (hu : u ∈ below (shape 2 3 3)) + (hd : designated (stageBPriority (shape 2 3 3)) 2 u) : + (CB2_3_3I2Singles u).Encloses (homogeneousEntropy ((fun u a => (littleLaw (shape 2 3 3) u ((stageBPriority (shape 2 3 3)) 2) a : ℝ)) u)) := by + rw [B2_3_3_below] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl + · exact CB2_3_3I2S0_1_3H_sound + · exact CB2_3_3I2S0_2_2H_sound + · exact CB2_3_3I2S0_3_1H_sound + · exact CB2_3_3I2S1_0_3H_sound + · exact (show ¬ designated (stageBPriority (shape 2 3 3)) 2 (shape 1 1 2) by decide +kernel) hd |>.elim + · exact (show ¬ designated (stageBPriority (shape 2 3 3)) 2 (shape 1 2 1) by decide +kernel) hd |>.elim + · exact (show ¬ designated (stageBPriority (shape 2 3 3)) 2 (shape 1 3 0) by decide +kernel) hd |>.elim + · exact CB2_3_3I2S2_0_2H_sound + · exact (show ¬ designated (stageBPriority (shape 2 3 3)) 2 (shape 2 1 1) by decide +kernel) hd |>.elim + · exact (show ¬ designated (stageBPriority (shape 2 3 3)) 2 (shape 2 2 0) by decide +kernel) hd |>.elim +def CB2_3_3I2Singleton : Ball := ⟨(5996455110702665623701618784177 / 100000000000000000000000000000000), (8551510679 / 100000000000000000000000000000000)⟩ +lemma CB2_3_3I2Singleton_sound : CB2_3_3I2Singleton.Encloses + (singletonEntropy (below (shape 2 3 3)) (fun u => (stageBLaw (shape 2 3 3) u : ℝ)) (stageBPriority (shape 2 3 3)) 2 (fun u a => (littleLaw (shape 2 3 3) u ((stageBPriority (shape 2 3 3)) 2) a : ℝ))) := by + exact contains_sound (singletonBall_sound (below (shape 2 3 3)) B2_3_3Law (fun u => (stageBLaw (shape 2 3 3) u : ℝ)) (stageBPriority (shape 2 3 3)) 2 + CB2_3_3I2Singles (fun u a => (littleLaw (shape 2 3 3) u ((stageBPriority (shape 2 3 3)) 2) a : ℝ)) (fun u _ => B2_3_3Law_sound u) CB2_3_3I2Singles_sound) (by decide +kernel) +def CB2_3_3I2Group : Ball := ⟨(6913719818436670221564110676421 / 100000000000000000000000000000000), (56727157761 / 50000000000000000000000000000000)⟩ +lemma CB2_3_3I2Group_sound : CB2_3_3I2Group.Encloses + (groupedEntropy (below (shape 2 3 3)) (fun u => (stageBLaw (shape 2 3 3) u : ℝ)) (stageBPriority (shape 2 3 3)) 2 (fun u a => (littleLaw (shape 2 3 3) u ((stageBPriority (shape 2 3 3)) 2) a : ℝ))) := by + exact contains_sound (Ball.add_sound CB2_3_3I2Singleton_sound + (finSumBall_sound 17 CB2_3_3I2ResidualEntropies _ CB2_3_3I2ResidualEntropies_sound)) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CB2_3_3I2H : Ball := ⟨(10574410027224598465538854536769 / 12500000000000000000000000000000), (317853838437 / 100000000000000000000000000000000)⟩ +lemma CB2_3_3I2_sound : CB2_3_3I2H.Encloses (stageBCapacity (shape 2 3 3) 2) := by + have hb := contains_sound (Ball.add_sound CB2_3_3I2PairH_sound + (Ball.neg_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) CB2_3_3I2Group_sound))) + (show contains (.add CB2_3_3I2PairH (.neg (.mul (.exact 2) CB2_3_3I2Group))) CB2_3_3I2H = true by decide +kernel) + unfold CB2_3_3I2PairValue at hb + simpa only [stageBCapacity, nativeCapacity, + show (2 : Fin 3) ≠ 0 by decide, ite_false, sub_eq_add_neg] using hb + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/CapacityB/CapB2_4_2I0.lean b/lean/OAI/LinearAlgebra/MatrixFields/CapacityB/CapB2_4_2I0.lean new file mode 100644 index 0000000000000000000000000000000000000000..30099a3df12f27917809acd2a6f2b384a23fe877 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/CapacityB/CapB2_4_2I0.lean @@ -0,0 +1,74 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Certificates.Terminal2_4_2 + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CB2_4_2I0Value (a : Fin 17) : ℝ := marginal (below (shape 2 4 2)) (fun u => (stageBLaw (shape 2 4 2) u : ℝ)) ((stageBPriority (shape 2 4 2)) 0) a +def CB2_4_2I0Raw (a : Fin 17) : Ball := marginalBall (below (shape 2 4 2)) B2_4_2Law ((stageBPriority (shape 2 4 2)) 0) a +lemma CB2_4_2I0Raw_sound (a : Fin 17) : + (CB2_4_2I0Raw a).Encloses (CB2_4_2I0Value a) := by + exact marginalBall_sound (below (shape 2 4 2)) B2_4_2Law (fun u => (stageBLaw (shape 2 4 2) u : ℝ)) (fun u _ => B2_4_2Law_sound u) ((stageBPriority (shape 2 4 2)) 0) a +def CB2_4_2I0Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(18444910185167131143404389881443 / 100000000000000000000000000000000), (17 / 25000000000000000000000000000000)⟩ ⟨(15589469541528843690691167499179 / 50000000000000000000000000000000), (15623446821 / 100000000000000000000000000000000)⟩ ⟨(-169038172428353149777145115754231 / 100000000000000000000000000000000), (847032951 / 1000000000000000000000000000000)⟩ ⟨-3, 18444910185167131143404389881443, 12500000000000000000000000000000⟩, + .log ⟨(31555089814832868856595610118557 / 50000000000000000000000000000000), (19 / 20000000000000000000000000000000)⟩ ⟨(29048864931223719890654738023041 / 100000000000000000000000000000000), (6682050217 / 25000000000000000000000000000000)⟩ ⟨(-46028810410117948265016649511163 / 100000000000000000000000000000000), (10587911879 / 25000000000000000000000000000000)⟩ ⟨-1, 31555089814832868856595610118557, 25000000000000000000000000000000⟩] +lemma CB2_4_2I0Certificates_valid : + CB2_4_2I0Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB2_4_2I0CertificateIndex (a : Fin 17) : ℕ := + match a.val with + | 0 => 1 + | 1 => 2 + | 2 => 1 + | _ => 0 +def CB2_4_2I0P (a : Fin 17) : Ball := + (CompactCertificate.entropyLookup CB2_4_2I0Certificates (CB2_4_2I0CertificateIndex a)).input +lemma CB2_4_2I0P_check : ∀ a : Fin 17, contains (CB2_4_2I0Raw a) (CB2_4_2I0P a) = true := by + decide +kernel +lemma CB2_4_2I0P_sound (a : Fin 17) : + (CB2_4_2I0P a).Encloses (CB2_4_2I0Value a) := + contains_sound (CB2_4_2I0Raw_sound a) (CB2_4_2I0P_check a) +def CB2_4_2I0Terms (a : Fin 17) : Ball := + (CompactCertificate.entropyLookup CB2_4_2I0Certificates (CB2_4_2I0CertificateIndex a)).output +lemma CB2_4_2I0Terms_sound (a : Fin 17) : + (CB2_4_2I0Terms a).Encloses (Foundation.entropyTerm (CB2_4_2I0Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB2_4_2I0Certificates_valid + (CB2_4_2I0CertificateIndex a) (CB2_4_2I0P_sound a) +def CB2_4_2I0Entropy : Ball := ⟨(91406743097339094653419408019757 / 100000000000000000000000000000000), (5797509451 / 10000000000000000000000000000000)⟩ +lemma CB2_4_2I0Entropy_sound : CB2_4_2I0Entropy.Encloses (Foundation.finiteEntropy CB2_4_2I0Value) := by + exact contains_sound (entropyFin_enclosed 17 CB2_4_2I0Value CB2_4_2I0Terms CB2_4_2I0Terms_sound) (by decide +kernel) +def CB2_4_2I0Mass : Ball := ⟨1, (231 / 100000000000000000000000000000000)⟩ +lemma CB2_4_2I0Mass_sound : CB2_4_2I0Mass.Encloses (∑ a, CB2_4_2I0Value a) := by + exact contains_sound (finSumBall_sound 17 CB2_4_2I0P CB2_4_2I0Value CB2_4_2I0P_sound) (by decide +kernel) +def CB2_4_2I0MassTermLogWitness : LogWitness := ⟨0, 1, 1⟩ +def CB2_4_2I0MassTermLog : Ball := ⟨0, (21175823913 / 100000000000000000000000000000000)⟩ +lemma CB2_4_2I0MassTermLog_sound : CB2_4_2I0MassTermLog.Encloses (Real.log ((∑ a, CB2_4_2I0Value a))) := by + exact checkLog_sound logTwoBall_sound (CB2_4_2I0Mass_sound) (w := CB2_4_2I0MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB2_4_2I0MassTerm : Ball := ⟨0, (10587911957 / 50000000000000000000000000000000)⟩ +lemma CB2_4_2I0MassTerm_sound : CB2_4_2I0MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB2_4_2I0Value a))) := by + exact contains_sound (entropyTerm_ball (CB2_4_2I0Mass_sound) CB2_4_2I0MassTermLog_sound) (by decide +kernel) +def CB2_4_2I0H : Ball := ⟨(91406743097339094653419408019757 / 100000000000000000000000000000000), (9893864803 / 12500000000000000000000000000000)⟩ +lemma CB2_4_2I0H_sound : CB2_4_2I0H.Encloses (homogeneousEntropy CB2_4_2I0Value) := by + exact contains_sound (homogeneous_enclosed CB2_4_2I0Value CB2_4_2I0MassTerm_sound CB2_4_2I0Entropy_sound) (by decide +kernel) +lemma CB2_4_2I0_sound : CB2_4_2I0H.Encloses (stageBCapacity (shape 2 4 2) 0) := by + exact CB2_4_2I0H_sound + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/CapacityB/CapB2_4_2I1.lean b/lean/OAI/LinearAlgebra/MatrixFields/CapacityB/CapB2_4_2I1.lean new file mode 100644 index 0000000000000000000000000000000000000000..1e969d5d5c56f0fb880e8499c69dcb1bbfc577c5 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/CapacityB/CapB2_4_2I1.lean @@ -0,0 +1,894 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Certificates.Terminal2_4_2 + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CB2_4_2I1PairValue (a : PairSlot) : ℝ := pairLaw (below (shape 2 4 2)) (shape 2 4 2) (fun u => (stageBLaw (shape 2 4 2) u : ℝ)) (fun u a => (littleLaw (shape 2 4 2) u ((stageBPriority (shape 2 4 2)) 1) a : ℝ)) a +def CB2_4_2I1PairRaw (a : PairSlot) : Ball := pairLawBall (below (shape 2 4 2)) (shape 2 4 2) B2_4_2Law (fun u => B2_4_2Little u ((stageBPriority (shape 2 4 2)) 1)) a +lemma CB2_4_2I1PairRaw_sound (a : PairSlot) : + (CB2_4_2I1PairRaw a).Encloses (CB2_4_2I1PairValue a) := by + exact pairLawBall_sound_on (below (shape 2 4 2)) (shape 2 4 2) B2_4_2Law (fun u => (stageBLaw (shape 2 4 2) u : ℝ)) (fun u => B2_4_2Little u ((stageBPriority (shape 2 4 2)) 1)) (fun u a => (littleLaw (shape 2 4 2) u ((stageBPriority (shape 2 4 2)) 1) a : ℝ)) (fun u _ => B2_4_2Law_sound u) (fun u _ a => B2_4_2Little_sound u ((stageBPriority (shape 2 4 2)) 1) a) (fun u _ a => B2_4_2Little_sound (complement (shape 2 4 2) u) ((stageBPriority (shape 2 4 2)) 1) a) a +def CB2_4_2I1PairCertificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(16761382587425625619496074982197 / 100000000000000000000000000000000), (1 / 1562500000000000000000000000000)⟩ ⟨(29937381422825973212986694540663 / 100000000000000000000000000000000), (14197443473 / 100000000000000000000000000000000)⟩ ⟨(-178609260105338626760300863140241 / 100000000000000000000000000000000), (84703295113 / 100000000000000000000000000000000)⟩ ⟨-3, 16761382587425625619496074982197, 12500000000000000000000000000000⟩, + .log ⟨(842940622306945887952632457291 / 50000000000000000000000000000000), (7 / 100000000000000000000000000000000)⟩ ⟨(6883253791692806981227318824433 / 100000000000000000000000000000000), (499798943 / 20000000000000000000000000000000)⟩ ⟨(-408288176506124024692136111886919 / 100000000000000000000000000000000), (37057691549 / 25000000000000000000000000000000)⟩ ⟨-6, 842940622306945887952632457291, 781250000000000000000000000000⟩, + .log ⟨(31552736167960482604598660103221 / 50000000000000000000000000000000), (93 / 100000000000000000000000000000000)⟩ ⟨(14525702669047952430944640508619 / 50000000000000000000000000000000), (1670387953 / 6250000000000000000000000000000)⟩ ⟨(-46036269538480631096329422118643 / 100000000000000000000000000000000), (42351647513 / 100000000000000000000000000000000)⟩ ⟨-1, 31552736167960482604598660103221, 25000000000000000000000000000000⟩] +lemma CB2_4_2I1PairCertificates_valid : + CB2_4_2I1PairCertificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB2_4_2I1PairCertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 2, 0 => 1 + | 3, 0 => 2 + | 1, 1 => 3 + | 0, 2 => 1 + | 0, 3 => 2 + | _, _ => 0 +def CB2_4_2I1PairP (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CB2_4_2I1PairCertificates (CB2_4_2I1PairCertificateIndex a)).input +lemma CB2_4_2I1PairP_check : ∀ a : PairSlot, contains (CB2_4_2I1PairRaw a) (CB2_4_2I1PairP a) = true := by + decide +kernel +lemma CB2_4_2I1PairP_sound (a : PairSlot) : + (CB2_4_2I1PairP a).Encloses (CB2_4_2I1PairValue a) := + contains_sound (CB2_4_2I1PairRaw_sound a) (CB2_4_2I1PairP_check a) +def CB2_4_2I1PairTerms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CB2_4_2I1PairCertificates (CB2_4_2I1PairCertificateIndex a)).output +lemma CB2_4_2I1PairTerms_sound (a : PairSlot) : + (CB2_4_2I1PairTerms a).Encloses (Foundation.entropyTerm (CB2_4_2I1PairValue a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB2_4_2I1PairCertificates_valid + (CB2_4_2I1PairCertificateIndex a) (CB2_4_2I1PairP_sound a) +def CB2_4_2I1PairEntropy : Ball := ⟨(10269267576713346525031730774743 / 10000000000000000000000000000000), (7514885453 / 12500000000000000000000000000000)⟩ +lemma CB2_4_2I1PairEntropy_sound : CB2_4_2I1PairEntropy.Encloses (Foundation.finiteEntropy CB2_4_2I1PairValue) := by + exact contains_sound (entropyPair_enclosed CB2_4_2I1PairValue CB2_4_2I1PairTerms CB2_4_2I1PairTerms_sound) (by decide +kernel) +def CB2_4_2I1PairMass : Ball := ⟨1, (47 / 20000000000000000000000000000000)⟩ +lemma CB2_4_2I1PairMass_sound : CB2_4_2I1PairMass.Encloses (∑ a, CB2_4_2I1PairValue a) := by + exact contains_sound (pairSumBall_sound CB2_4_2I1PairP CB2_4_2I1PairValue CB2_4_2I1PairP_sound) (by decide +kernel) +def CB2_4_2I1PairMassTermLogWitness : LogWitness := ⟨0, 1, 1⟩ +def CB2_4_2I1PairMassTermLog : Ball := ⟨0, (21175823917 / 100000000000000000000000000000000)⟩ +lemma CB2_4_2I1PairMassTermLog_sound : CB2_4_2I1PairMassTermLog.Encloses (Real.log ((∑ a, CB2_4_2I1PairValue a))) := by + exact checkLog_sound logTwoBall_sound (CB2_4_2I1PairMass_sound) (w := CB2_4_2I1PairMassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB2_4_2I1PairMassTerm : Ball := ⟨0, (10587911959 / 50000000000000000000000000000000)⟩ +lemma CB2_4_2I1PairMassTerm_sound : CB2_4_2I1PairMassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB2_4_2I1PairValue a))) := by + exact contains_sound (entropyTerm_ball (CB2_4_2I1PairMass_sound) CB2_4_2I1PairMassTermLog_sound) (by decide +kernel) +def CB2_4_2I1PairH : Ball := ⟨(10269267576713346525031730774743 / 10000000000000000000000000000000), (40647453771 / 50000000000000000000000000000000)⟩ +lemma CB2_4_2I1PairH_sound : CB2_4_2I1PairH.Encloses (homogeneousEntropy CB2_4_2I1PairValue) := by + exact contains_sound (homogeneous_enclosed CB2_4_2I1PairValue CB2_4_2I1PairMassTerm_sound CB2_4_2I1PairEntropy_sound) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CB2_4_2I1R0Value (a : Fin 6) : ℝ := residualLaw (below (shape 2 4 2)) (fun u => (stageBLaw (shape 2 4 2) u : ℝ)) (stageBPriority (shape 2 4 2)) 1 (fun u a => (littleLaw (shape 2 4 2) u ((stageBPriority (shape 2 4 2)) 1) a : ℝ)) 0 a +def CB2_4_2I1R0Raw (a : Fin 6) : Ball := residualBall (below (shape 2 4 2)) B2_4_2Law (stageBPriority (shape 2 4 2)) 1 (fun u => B2_4_2Little u ((stageBPriority (shape 2 4 2)) 1)) 0 a +lemma CB2_4_2I1R0Raw_sound (a : Fin 6) : + (CB2_4_2I1R0Raw a).Encloses (CB2_4_2I1R0Value a) := by + exact residualBall_sound_on (below (shape 2 4 2)) B2_4_2Law (fun u => (stageBLaw (shape 2 4 2) u : ℝ)) (stageBPriority (shape 2 4 2)) 1 (fun u => B2_4_2Little u ((stageBPriority (shape 2 4 2)) 1)) (fun u a => (littleLaw (shape 2 4 2) u ((stageBPriority (shape 2 4 2)) 1) a : ℝ)) (fun u _ => B2_4_2Law_sound u) (fun u _ a => B2_4_2Little_sound u ((stageBPriority (shape 2 4 2)) 1) a) 0 a +def CB2_4_2I1R0Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(18447263832039517395401339896779 / 100000000000000000000000000000000), (69 / 100000000000000000000000000000000)⟩ ⟨(31180563847682646222562347994213 / 100000000000000000000000000000000), (390636011 / 2500000000000000000000000000000)⟩ ⟨(-42256353207145711870694366372109 / 25000000000000000000000000000000), (16940659021 / 20000000000000000000000000000000)⟩ ⟨-3, 18447263832039517395401339896779, 12500000000000000000000000000000⟩] +lemma CB2_4_2I1R0Certificates_valid : + CB2_4_2I1R0Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB2_4_2I1R0CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | 0 => 1 + | _ => 0 +def CB2_4_2I1R0P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_4_2I1R0Certificates (CB2_4_2I1R0CertificateIndex a)).input +lemma CB2_4_2I1R0P_check : ∀ a : Fin 6, contains (CB2_4_2I1R0Raw a) (CB2_4_2I1R0P a) = true := by + decide +kernel +lemma CB2_4_2I1R0P_sound (a : Fin 6) : + (CB2_4_2I1R0P a).Encloses (CB2_4_2I1R0Value a) := + contains_sound (CB2_4_2I1R0Raw_sound a) (CB2_4_2I1R0P_check a) +def CB2_4_2I1R0Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_4_2I1R0Certificates (CB2_4_2I1R0CertificateIndex a)).output +lemma CB2_4_2I1R0Terms_sound (a : Fin 6) : + (CB2_4_2I1R0Terms a).Encloses (Foundation.entropyTerm (CB2_4_2I1R0Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB2_4_2I1R0Certificates_valid + (CB2_4_2I1R0CertificateIndex a) (CB2_4_2I1R0P_sound a) +def CB2_4_2I1R0Entropy : Ball := ⟨(31180563847682646222562347994213 / 100000000000000000000000000000000), (390636011 / 2500000000000000000000000000000)⟩ +lemma CB2_4_2I1R0Entropy_sound : CB2_4_2I1R0Entropy.Encloses (Foundation.finiteEntropy CB2_4_2I1R0Value) := by + exact contains_sound (entropyFin_enclosed 6 CB2_4_2I1R0Value CB2_4_2I1R0Terms CB2_4_2I1R0Terms_sound) (by decide +kernel) +def CB2_4_2I1R0Mass : Ball := ⟨(18447263832039517395401339896779 / 100000000000000000000000000000000), (69 / 100000000000000000000000000000000)⟩ +lemma CB2_4_2I1R0Mass_sound : CB2_4_2I1R0Mass.Encloses (∑ a, CB2_4_2I1R0Value a) := by + exact contains_sound (finSumBall_sound 6 CB2_4_2I1R0P CB2_4_2I1R0Value CB2_4_2I1R0P_sound) (by decide +kernel) +def CB2_4_2I1R0MassTermLogWitness : LogWitness := ⟨-3, 18447263832039517395401339896779, 12500000000000000000000000000000⟩ +def CB2_4_2I1R0MassTermLog : Ball := ⟨(-42256353207145711870694366372109 / 25000000000000000000000000000000), (16940659021 / 20000000000000000000000000000000)⟩ +lemma CB2_4_2I1R0MassTermLog_sound : CB2_4_2I1R0MassTermLog.Encloses (Real.log ((∑ a, CB2_4_2I1R0Value a))) := by + exact checkLog_sound logTwoBall_sound (CB2_4_2I1R0Mass_sound) (w := CB2_4_2I1R0MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB2_4_2I1R0MassTerm : Ball := ⟨(31180563847682646222562347994213 / 100000000000000000000000000000000), (390636011 / 2500000000000000000000000000000)⟩ +lemma CB2_4_2I1R0MassTerm_sound : CB2_4_2I1R0MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB2_4_2I1R0Value a))) := by + exact contains_sound (entropyTerm_ball (CB2_4_2I1R0Mass_sound) CB2_4_2I1R0MassTermLog_sound) (by decide +kernel) +def CB2_4_2I1R0H : Ball := ⟨0, (390636011 / 1250000000000000000000000000000)⟩ +lemma CB2_4_2I1R0H_sound : CB2_4_2I1R0H.Encloses (homogeneousEntropy CB2_4_2I1R0Value) := by + exact contains_sound (homogeneous_enclosed CB2_4_2I1R0Value CB2_4_2I1R0MassTerm_sound CB2_4_2I1R0Entropy_sound) (by decide +kernel) +def CB2_4_2I1R1Value (a : Fin 6) : ℝ := residualLaw (below (shape 2 4 2)) (fun u => (stageBLaw (shape 2 4 2) u : ℝ)) (stageBPriority (shape 2 4 2)) 1 (fun u a => (littleLaw (shape 2 4 2) u ((stageBPriority (shape 2 4 2)) 1) a : ℝ)) 1 a +def CB2_4_2I1R1Raw (a : Fin 6) : Ball := residualBall (below (shape 2 4 2)) B2_4_2Law (stageBPriority (shape 2 4 2)) 1 (fun u => B2_4_2Little u ((stageBPriority (shape 2 4 2)) 1)) 1 a +lemma CB2_4_2I1R1Raw_sound (a : Fin 6) : + (CB2_4_2I1R1Raw a).Encloses (CB2_4_2I1R1Value a) := by + exact residualBall_sound_on (below (shape 2 4 2)) B2_4_2Law (fun u => (stageBLaw (shape 2 4 2) u : ℝ)) (stageBPriority (shape 2 4 2)) 1 (fun u => B2_4_2Little u ((stageBPriority (shape 2 4 2)) 1)) (fun u a => (littleLaw (shape 2 4 2) u ((stageBPriority (shape 2 4 2)) 1) a : ℝ)) (fun u _ => B2_4_2Law_sound u) (fun u _ a => B2_4_2Little_sound u ((stageBPriority (shape 2 4 2)) 1) a) 1 a +def CB2_4_2I1R1Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(31552736167960482604598660103221 / 50000000000000000000000000000000), (93 / 100000000000000000000000000000000)⟩ ⟨(14525702669047952430944640508619 / 50000000000000000000000000000000), (1670387953 / 6250000000000000000000000000000)⟩ ⟨(-46036269538480631096329422118643 / 100000000000000000000000000000000), (42351647513 / 100000000000000000000000000000000)⟩ ⟨-1, 31552736167960482604598660103221, 25000000000000000000000000000000⟩] +lemma CB2_4_2I1R1Certificates_valid : + CB2_4_2I1R1Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB2_4_2I1R1CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | 1 => 1 + | _ => 0 +def CB2_4_2I1R1P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_4_2I1R1Certificates (CB2_4_2I1R1CertificateIndex a)).input +lemma CB2_4_2I1R1P_check : ∀ a : Fin 6, contains (CB2_4_2I1R1Raw a) (CB2_4_2I1R1P a) = true := by + decide +kernel +lemma CB2_4_2I1R1P_sound (a : Fin 6) : + (CB2_4_2I1R1P a).Encloses (CB2_4_2I1R1Value a) := + contains_sound (CB2_4_2I1R1Raw_sound a) (CB2_4_2I1R1P_check a) +def CB2_4_2I1R1Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_4_2I1R1Certificates (CB2_4_2I1R1CertificateIndex a)).output +lemma CB2_4_2I1R1Terms_sound (a : Fin 6) : + (CB2_4_2I1R1Terms a).Encloses (Foundation.entropyTerm (CB2_4_2I1R1Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB2_4_2I1R1Certificates_valid + (CB2_4_2I1R1CertificateIndex a) (CB2_4_2I1R1P_sound a) +def CB2_4_2I1R1Entropy : Ball := ⟨(14525702669047952430944640508619 / 50000000000000000000000000000000), (1670387953 / 6250000000000000000000000000000)⟩ +lemma CB2_4_2I1R1Entropy_sound : CB2_4_2I1R1Entropy.Encloses (Foundation.finiteEntropy CB2_4_2I1R1Value) := by + exact contains_sound (entropyFin_enclosed 6 CB2_4_2I1R1Value CB2_4_2I1R1Terms CB2_4_2I1R1Terms_sound) (by decide +kernel) +def CB2_4_2I1R1Mass : Ball := ⟨(31552736167960482604598660103221 / 50000000000000000000000000000000), (93 / 100000000000000000000000000000000)⟩ +lemma CB2_4_2I1R1Mass_sound : CB2_4_2I1R1Mass.Encloses (∑ a, CB2_4_2I1R1Value a) := by + exact contains_sound (finSumBall_sound 6 CB2_4_2I1R1P CB2_4_2I1R1Value CB2_4_2I1R1P_sound) (by decide +kernel) +def CB2_4_2I1R1MassTermLogWitness : LogWitness := ⟨-1, 31552736167960482604598660103221, 25000000000000000000000000000000⟩ +def CB2_4_2I1R1MassTermLog : Ball := ⟨(-46036269538480631096329422118643 / 100000000000000000000000000000000), (42351647513 / 100000000000000000000000000000000)⟩ +lemma CB2_4_2I1R1MassTermLog_sound : CB2_4_2I1R1MassTermLog.Encloses (Real.log ((∑ a, CB2_4_2I1R1Value a))) := by + exact checkLog_sound logTwoBall_sound (CB2_4_2I1R1Mass_sound) (w := CB2_4_2I1R1MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB2_4_2I1R1MassTerm : Ball := ⟨(14525702669047952430944640508619 / 50000000000000000000000000000000), (1670387953 / 6250000000000000000000000000000)⟩ +lemma CB2_4_2I1R1MassTerm_sound : CB2_4_2I1R1MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB2_4_2I1R1Value a))) := by + exact contains_sound (entropyTerm_ball (CB2_4_2I1R1Mass_sound) CB2_4_2I1R1MassTermLog_sound) (by decide +kernel) +def CB2_4_2I1R1H : Ball := ⟨0, (1670387953 / 3125000000000000000000000000000)⟩ +lemma CB2_4_2I1R1H_sound : CB2_4_2I1R1H.Encloses (homogeneousEntropy CB2_4_2I1R1Value) := by + exact contains_sound (homogeneous_enclosed CB2_4_2I1R1Value CB2_4_2I1R1MassTerm_sound CB2_4_2I1R1Entropy_sound) (by decide +kernel) +def CB2_4_2I1R2Value (a : Fin 6) : ℝ := residualLaw (below (shape 2 4 2)) (fun u => (stageBLaw (shape 2 4 2) u : ℝ)) (stageBPriority (shape 2 4 2)) 1 (fun u a => (littleLaw (shape 2 4 2) u ((stageBPriority (shape 2 4 2)) 1) a : ℝ)) 2 a +def CB2_4_2I1R2Raw (a : Fin 6) : Ball := residualBall (below (shape 2 4 2)) B2_4_2Law (stageBPriority (shape 2 4 2)) 1 (fun u => B2_4_2Little u ((stageBPriority (shape 2 4 2)) 1)) 2 a +lemma CB2_4_2I1R2Raw_sound (a : Fin 6) : + (CB2_4_2I1R2Raw a).Encloses (CB2_4_2I1R2Value a) := by + exact residualBall_sound_on (below (shape 2 4 2)) B2_4_2Law (fun u => (stageBLaw (shape 2 4 2) u : ℝ)) (stageBPriority (shape 2 4 2)) 1 (fun u => B2_4_2Little u ((stageBPriority (shape 2 4 2)) 1)) (fun u a => (littleLaw (shape 2 4 2) u ((stageBPriority (shape 2 4 2)) 1) a : ℝ)) (fun u _ => B2_4_2Law_sound u) (fun u _ a => B2_4_2Little_sound u ((stageBPriority (shape 2 4 2)) 1) a) 2 a +def CB2_4_2I1R2Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(16730598002167639132209790609423 / 100000000000000000000000000000000), (63 / 100000000000000000000000000000000)⟩ ⟨(29913153600741793534828819423529 / 100000000000000000000000000000000), (1771420989 / 12500000000000000000000000000000)⟩ ⟨(-44698273183161481273813176153821 / 25000000000000000000000000000000), (21175823777 / 25000000000000000000000000000000)⟩ ⟨-3, 16730598002167639132209790609423, 12500000000000000000000000000000⟩, + .log ⟨(336759912173541096034906629247 / 20000000000000000000000000000000), (7 / 100000000000000000000000000000000)⟩ ⟨(6876834921096399687778079794513 / 100000000000000000000000000000000), (124795451 / 5000000000000000000000000000000)⟩ ⟨(-102102932571626707195576569964971 / 25000000000000000000000000000000), (37057691549 / 25000000000000000000000000000000)⟩ ⟨-6, 336759912173541096034906629247, 312500000000000000000000000000⟩] +lemma CB2_4_2I1R2Certificates_valid : + CB2_4_2I1R2Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB2_4_2I1R2CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | 2 => 1 + | 3 => 2 + | _ => 0 +def CB2_4_2I1R2P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_4_2I1R2Certificates (CB2_4_2I1R2CertificateIndex a)).input +lemma CB2_4_2I1R2P_check : ∀ a : Fin 6, contains (CB2_4_2I1R2Raw a) (CB2_4_2I1R2P a) = true := by + decide +kernel +lemma CB2_4_2I1R2P_sound (a : Fin 6) : + (CB2_4_2I1R2P a).Encloses (CB2_4_2I1R2Value a) := + contains_sound (CB2_4_2I1R2Raw_sound a) (CB2_4_2I1R2P_check a) +def CB2_4_2I1R2Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_4_2I1R2Certificates (CB2_4_2I1R2CertificateIndex a)).output +lemma CB2_4_2I1R2Terms_sound (a : Fin 6) : + (CB2_4_2I1R2Terms a).Encloses (Foundation.entropyTerm (CB2_4_2I1R2Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB2_4_2I1R2Certificates_valid + (CB2_4_2I1R2CertificateIndex a) (CB2_4_2I1R2P_sound a) +def CB2_4_2I1R2Entropy : Ball := ⟨(18394994260919096611303449609021 / 50000000000000000000000000000000), (4166819233 / 25000000000000000000000000000000)⟩ +lemma CB2_4_2I1R2Entropy_sound : CB2_4_2I1R2Entropy.Encloses (Foundation.finiteEntropy CB2_4_2I1R2Value) := by + exact contains_sound (entropyFin_enclosed 6 CB2_4_2I1R2Value CB2_4_2I1R2Terms CB2_4_2I1R2Terms_sound) (by decide +kernel) +def CB2_4_2I1R2Mass : Ball := ⟨(9207198781517672306192161877829 / 50000000000000000000000000000000), (7 / 10000000000000000000000000000000)⟩ +lemma CB2_4_2I1R2Mass_sound : CB2_4_2I1R2Mass.Encloses (∑ a, CB2_4_2I1R2Value a) := by + exact contains_sound (finSumBall_sound 6 CB2_4_2I1R2P CB2_4_2I1R2Value CB2_4_2I1R2P_sound) (by decide +kernel) +def CB2_4_2I1R2MassTermLogWitness : LogWitness := ⟨-3, 9207198781517672306192161877829, 6250000000000000000000000000000⟩ +def CB2_4_2I1R2MassTermLog : Ball := ⟨(-84601867554808563020932609949299 / 50000000000000000000000000000000), (84703295111 / 100000000000000000000000000000000)⟩ +lemma CB2_4_2I1R2MassTermLog_sound : CB2_4_2I1R2MassTermLog.Encloses (Real.log ((∑ a, CB2_4_2I1R2Value a))) := by + exact checkLog_sound logTwoBall_sound (CB2_4_2I1R2Mass_sound) (w := CB2_4_2I1R2MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB2_4_2I1R2MassTerm : Ball := ⟨(7789462118647528960199539877531 / 25000000000000000000000000000000), (1559760163 / 10000000000000000000000000000000)⟩ +lemma CB2_4_2I1R2MassTerm_sound : CB2_4_2I1R2MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB2_4_2I1R2Value a))) := by + exact contains_sound (entropyTerm_ball (CB2_4_2I1R2Mass_sound) CB2_4_2I1R2MassTermLog_sound) (by decide +kernel) +def CB2_4_2I1R2H : Ball := ⟨(2816070023624038690904369853959 / 50000000000000000000000000000000), (16132439281 / 50000000000000000000000000000000)⟩ +lemma CB2_4_2I1R2H_sound : CB2_4_2I1R2H.Encloses (homogeneousEntropy CB2_4_2I1R2Value) := by + exact contains_sound (homogeneous_enclosed CB2_4_2I1R2Value CB2_4_2I1R2MassTerm_sound CB2_4_2I1R2Entropy_sound) (by decide +kernel) +def CB2_4_2I1R3Value (a : Fin 6) : ℝ := residualLaw (below (shape 2 4 2)) (fun u => (stageBLaw (shape 2 4 2) u : ℝ)) (stageBPriority (shape 2 4 2)) 1 (fun u a => (littleLaw (shape 2 4 2) u ((stageBPriority (shape 2 4 2)) 1) a : ℝ)) 3 a +def CB2_4_2I1R3Raw (a : Fin 6) : Ball := residualBall (below (shape 2 4 2)) B2_4_2Law (stageBPriority (shape 2 4 2)) 1 (fun u => B2_4_2Little u ((stageBPriority (shape 2 4 2)) 1)) 3 a +lemma CB2_4_2I1R3Raw_sound (a : Fin 6) : + (CB2_4_2I1R3Raw a).Encloses (CB2_4_2I1R3Value a) := by + exact residualBall_sound_on (below (shape 2 4 2)) B2_4_2Law (fun u => (stageBLaw (shape 2 4 2) u : ℝ)) (stageBPriority (shape 2 4 2)) 1 (fun u => B2_4_2Little u ((stageBPriority (shape 2 4 2)) 1)) (fun u a => (littleLaw (shape 2 4 2) u ((stageBPriority (shape 2 4 2)) 1) a : ℝ)) (fun u _ => B2_4_2Law_sound u) (fun u _ a => B2_4_2Little_sound u ((stageBPriority (shape 2 4 2)) 1) a) 3 a +def CB2_4_2I1R3Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB2_4_2I1R3Certificates_valid : + CB2_4_2I1R3Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB2_4_2I1R3CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB2_4_2I1R3P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_4_2I1R3Certificates (CB2_4_2I1R3CertificateIndex a)).input +lemma CB2_4_2I1R3P_check : ∀ a : Fin 6, contains (CB2_4_2I1R3Raw a) (CB2_4_2I1R3P a) = true := by + decide +kernel +lemma CB2_4_2I1R3P_sound (a : Fin 6) : + (CB2_4_2I1R3P a).Encloses (CB2_4_2I1R3Value a) := + contains_sound (CB2_4_2I1R3Raw_sound a) (CB2_4_2I1R3P_check a) +def CB2_4_2I1R3Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_4_2I1R3Certificates (CB2_4_2I1R3CertificateIndex a)).output +lemma CB2_4_2I1R3Terms_sound (a : Fin 6) : + (CB2_4_2I1R3Terms a).Encloses (Foundation.entropyTerm (CB2_4_2I1R3Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB2_4_2I1R3Certificates_valid + (CB2_4_2I1R3CertificateIndex a) (CB2_4_2I1R3P_sound a) +def CB2_4_2I1R3Entropy : Ball := ⟨0, 0⟩ +lemma CB2_4_2I1R3Entropy_sound : CB2_4_2I1R3Entropy.Encloses (Foundation.finiteEntropy CB2_4_2I1R3Value) := by + exact contains_sound (entropyFin_enclosed 6 CB2_4_2I1R3Value CB2_4_2I1R3Terms CB2_4_2I1R3Terms_sound) (by decide +kernel) +def CB2_4_2I1R3Mass : Ball := ⟨0, 0⟩ +lemma CB2_4_2I1R3Mass_sound : CB2_4_2I1R3Mass.Encloses (∑ a, CB2_4_2I1R3Value a) := by + exact contains_sound (finSumBall_sound 6 CB2_4_2I1R3P CB2_4_2I1R3Value CB2_4_2I1R3P_sound) (by decide +kernel) +def CB2_4_2I1R3MassTerm : Ball := .exact 0 +lemma CB2_4_2I1R3MassTerm_sound : CB2_4_2I1R3MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB2_4_2I1R3Value a))) := + entropyTerm_zero_ball (CB2_4_2I1R3Mass_sound) +def CB2_4_2I1R3H : Ball := ⟨0, 0⟩ +lemma CB2_4_2I1R3H_sound : CB2_4_2I1R3H.Encloses (homogeneousEntropy CB2_4_2I1R3Value) := by + exact contains_sound (homogeneous_enclosed CB2_4_2I1R3Value CB2_4_2I1R3MassTerm_sound CB2_4_2I1R3Entropy_sound) (by decide +kernel) +def CB2_4_2I1R4Value (a : Fin 6) : ℝ := residualLaw (below (shape 2 4 2)) (fun u => (stageBLaw (shape 2 4 2) u : ℝ)) (stageBPriority (shape 2 4 2)) 1 (fun u a => (littleLaw (shape 2 4 2) u ((stageBPriority (shape 2 4 2)) 1) a : ℝ)) 4 a +def CB2_4_2I1R4Raw (a : Fin 6) : Ball := residualBall (below (shape 2 4 2)) B2_4_2Law (stageBPriority (shape 2 4 2)) 1 (fun u => B2_4_2Little u ((stageBPriority (shape 2 4 2)) 1)) 4 a +lemma CB2_4_2I1R4Raw_sound (a : Fin 6) : + (CB2_4_2I1R4Raw a).Encloses (CB2_4_2I1R4Value a) := by + exact residualBall_sound_on (below (shape 2 4 2)) B2_4_2Law (fun u => (stageBLaw (shape 2 4 2) u : ℝ)) (stageBPriority (shape 2 4 2)) 1 (fun u => B2_4_2Little u ((stageBPriority (shape 2 4 2)) 1)) (fun u a => (littleLaw (shape 2 4 2) u ((stageBPriority (shape 2 4 2)) 1) a : ℝ)) (fun u _ => B2_4_2Law_sound u) (fun u _ a => B2_4_2Little_sound u ((stageBPriority (shape 2 4 2)) 1) a) 4 a +def CB2_4_2I1R4Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB2_4_2I1R4Certificates_valid : + CB2_4_2I1R4Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB2_4_2I1R4CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB2_4_2I1R4P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_4_2I1R4Certificates (CB2_4_2I1R4CertificateIndex a)).input +lemma CB2_4_2I1R4P_check : ∀ a : Fin 6, contains (CB2_4_2I1R4Raw a) (CB2_4_2I1R4P a) = true := by + decide +kernel +lemma CB2_4_2I1R4P_sound (a : Fin 6) : + (CB2_4_2I1R4P a).Encloses (CB2_4_2I1R4Value a) := + contains_sound (CB2_4_2I1R4Raw_sound a) (CB2_4_2I1R4P_check a) +def CB2_4_2I1R4Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_4_2I1R4Certificates (CB2_4_2I1R4CertificateIndex a)).output +lemma CB2_4_2I1R4Terms_sound (a : Fin 6) : + (CB2_4_2I1R4Terms a).Encloses (Foundation.entropyTerm (CB2_4_2I1R4Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB2_4_2I1R4Certificates_valid + (CB2_4_2I1R4CertificateIndex a) (CB2_4_2I1R4P_sound a) +def CB2_4_2I1R4Entropy : Ball := ⟨0, 0⟩ +lemma CB2_4_2I1R4Entropy_sound : CB2_4_2I1R4Entropy.Encloses (Foundation.finiteEntropy CB2_4_2I1R4Value) := by + exact contains_sound (entropyFin_enclosed 6 CB2_4_2I1R4Value CB2_4_2I1R4Terms CB2_4_2I1R4Terms_sound) (by decide +kernel) +def CB2_4_2I1R4Mass : Ball := ⟨0, 0⟩ +lemma CB2_4_2I1R4Mass_sound : CB2_4_2I1R4Mass.Encloses (∑ a, CB2_4_2I1R4Value a) := by + exact contains_sound (finSumBall_sound 6 CB2_4_2I1R4P CB2_4_2I1R4Value CB2_4_2I1R4P_sound) (by decide +kernel) +def CB2_4_2I1R4MassTerm : Ball := .exact 0 +lemma CB2_4_2I1R4MassTerm_sound : CB2_4_2I1R4MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB2_4_2I1R4Value a))) := + entropyTerm_zero_ball (CB2_4_2I1R4Mass_sound) +def CB2_4_2I1R4H : Ball := ⟨0, 0⟩ +lemma CB2_4_2I1R4H_sound : CB2_4_2I1R4H.Encloses (homogeneousEntropy CB2_4_2I1R4Value) := by + exact contains_sound (homogeneous_enclosed CB2_4_2I1R4Value CB2_4_2I1R4MassTerm_sound CB2_4_2I1R4Entropy_sound) (by decide +kernel) +def CB2_4_2I1R5Value (a : Fin 6) : ℝ := residualLaw (below (shape 2 4 2)) (fun u => (stageBLaw (shape 2 4 2) u : ℝ)) (stageBPriority (shape 2 4 2)) 1 (fun u a => (littleLaw (shape 2 4 2) u ((stageBPriority (shape 2 4 2)) 1) a : ℝ)) 5 a +def CB2_4_2I1R5Raw (a : Fin 6) : Ball := residualBall (below (shape 2 4 2)) B2_4_2Law (stageBPriority (shape 2 4 2)) 1 (fun u => B2_4_2Little u ((stageBPriority (shape 2 4 2)) 1)) 5 a +lemma CB2_4_2I1R5Raw_sound (a : Fin 6) : + (CB2_4_2I1R5Raw a).Encloses (CB2_4_2I1R5Value a) := by + exact residualBall_sound_on (below (shape 2 4 2)) B2_4_2Law (fun u => (stageBLaw (shape 2 4 2) u : ℝ)) (stageBPriority (shape 2 4 2)) 1 (fun u => B2_4_2Little u ((stageBPriority (shape 2 4 2)) 1)) (fun u a => (littleLaw (shape 2 4 2) u ((stageBPriority (shape 2 4 2)) 1) a : ℝ)) (fun u _ => B2_4_2Law_sound u) (fun u _ a => B2_4_2Little_sound u ((stageBPriority (shape 2 4 2)) 1) a) 5 a +def CB2_4_2I1R5Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB2_4_2I1R5Certificates_valid : + CB2_4_2I1R5Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB2_4_2I1R5CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB2_4_2I1R5P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_4_2I1R5Certificates (CB2_4_2I1R5CertificateIndex a)).input +lemma CB2_4_2I1R5P_check : ∀ a : Fin 6, contains (CB2_4_2I1R5Raw a) (CB2_4_2I1R5P a) = true := by + decide +kernel +lemma CB2_4_2I1R5P_sound (a : Fin 6) : + (CB2_4_2I1R5P a).Encloses (CB2_4_2I1R5Value a) := + contains_sound (CB2_4_2I1R5Raw_sound a) (CB2_4_2I1R5P_check a) +def CB2_4_2I1R5Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_4_2I1R5Certificates (CB2_4_2I1R5CertificateIndex a)).output +lemma CB2_4_2I1R5Terms_sound (a : Fin 6) : + (CB2_4_2I1R5Terms a).Encloses (Foundation.entropyTerm (CB2_4_2I1R5Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB2_4_2I1R5Certificates_valid + (CB2_4_2I1R5CertificateIndex a) (CB2_4_2I1R5P_sound a) +def CB2_4_2I1R5Entropy : Ball := ⟨0, 0⟩ +lemma CB2_4_2I1R5Entropy_sound : CB2_4_2I1R5Entropy.Encloses (Foundation.finiteEntropy CB2_4_2I1R5Value) := by + exact contains_sound (entropyFin_enclosed 6 CB2_4_2I1R5Value CB2_4_2I1R5Terms CB2_4_2I1R5Terms_sound) (by decide +kernel) +def CB2_4_2I1R5Mass : Ball := ⟨0, 0⟩ +lemma CB2_4_2I1R5Mass_sound : CB2_4_2I1R5Mass.Encloses (∑ a, CB2_4_2I1R5Value a) := by + exact contains_sound (finSumBall_sound 6 CB2_4_2I1R5P CB2_4_2I1R5Value CB2_4_2I1R5P_sound) (by decide +kernel) +def CB2_4_2I1R5MassTerm : Ball := .exact 0 +lemma CB2_4_2I1R5MassTerm_sound : CB2_4_2I1R5MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB2_4_2I1R5Value a))) := + entropyTerm_zero_ball (CB2_4_2I1R5Mass_sound) +def CB2_4_2I1R5H : Ball := ⟨0, 0⟩ +lemma CB2_4_2I1R5H_sound : CB2_4_2I1R5H.Encloses (homogeneousEntropy CB2_4_2I1R5Value) := by + exact contains_sound (homogeneous_enclosed CB2_4_2I1R5Value CB2_4_2I1R5MassTerm_sound CB2_4_2I1R5Entropy_sound) (by decide +kernel) +def CB2_4_2I1R6Value (a : Fin 6) : ℝ := residualLaw (below (shape 2 4 2)) (fun u => (stageBLaw (shape 2 4 2) u : ℝ)) (stageBPriority (shape 2 4 2)) 1 (fun u a => (littleLaw (shape 2 4 2) u ((stageBPriority (shape 2 4 2)) 1) a : ℝ)) 6 a +def CB2_4_2I1R6Raw (a : Fin 6) : Ball := residualBall (below (shape 2 4 2)) B2_4_2Law (stageBPriority (shape 2 4 2)) 1 (fun u => B2_4_2Little u ((stageBPriority (shape 2 4 2)) 1)) 6 a +lemma CB2_4_2I1R6Raw_sound (a : Fin 6) : + (CB2_4_2I1R6Raw a).Encloses (CB2_4_2I1R6Value a) := by + exact residualBall_sound_on (below (shape 2 4 2)) B2_4_2Law (fun u => (stageBLaw (shape 2 4 2) u : ℝ)) (stageBPriority (shape 2 4 2)) 1 (fun u => B2_4_2Little u ((stageBPriority (shape 2 4 2)) 1)) (fun u a => (littleLaw (shape 2 4 2) u ((stageBPriority (shape 2 4 2)) 1) a : ℝ)) (fun u _ => B2_4_2Law_sound u) (fun u _ a => B2_4_2Little_sound u ((stageBPriority (shape 2 4 2)) 1) a) 6 a +def CB2_4_2I1R6Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB2_4_2I1R6Certificates_valid : + CB2_4_2I1R6Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB2_4_2I1R6CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB2_4_2I1R6P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_4_2I1R6Certificates (CB2_4_2I1R6CertificateIndex a)).input +lemma CB2_4_2I1R6P_check : ∀ a : Fin 6, contains (CB2_4_2I1R6Raw a) (CB2_4_2I1R6P a) = true := by + decide +kernel +lemma CB2_4_2I1R6P_sound (a : Fin 6) : + (CB2_4_2I1R6P a).Encloses (CB2_4_2I1R6Value a) := + contains_sound (CB2_4_2I1R6Raw_sound a) (CB2_4_2I1R6P_check a) +def CB2_4_2I1R6Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_4_2I1R6Certificates (CB2_4_2I1R6CertificateIndex a)).output +lemma CB2_4_2I1R6Terms_sound (a : Fin 6) : + (CB2_4_2I1R6Terms a).Encloses (Foundation.entropyTerm (CB2_4_2I1R6Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB2_4_2I1R6Certificates_valid + (CB2_4_2I1R6CertificateIndex a) (CB2_4_2I1R6P_sound a) +def CB2_4_2I1R6Entropy : Ball := ⟨0, 0⟩ +lemma CB2_4_2I1R6Entropy_sound : CB2_4_2I1R6Entropy.Encloses (Foundation.finiteEntropy CB2_4_2I1R6Value) := by + exact contains_sound (entropyFin_enclosed 6 CB2_4_2I1R6Value CB2_4_2I1R6Terms CB2_4_2I1R6Terms_sound) (by decide +kernel) +def CB2_4_2I1R6Mass : Ball := ⟨0, 0⟩ +lemma CB2_4_2I1R6Mass_sound : CB2_4_2I1R6Mass.Encloses (∑ a, CB2_4_2I1R6Value a) := by + exact contains_sound (finSumBall_sound 6 CB2_4_2I1R6P CB2_4_2I1R6Value CB2_4_2I1R6P_sound) (by decide +kernel) +def CB2_4_2I1R6MassTerm : Ball := .exact 0 +lemma CB2_4_2I1R6MassTerm_sound : CB2_4_2I1R6MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB2_4_2I1R6Value a))) := + entropyTerm_zero_ball (CB2_4_2I1R6Mass_sound) +def CB2_4_2I1R6H : Ball := ⟨0, 0⟩ +lemma CB2_4_2I1R6H_sound : CB2_4_2I1R6H.Encloses (homogeneousEntropy CB2_4_2I1R6Value) := by + exact contains_sound (homogeneous_enclosed CB2_4_2I1R6Value CB2_4_2I1R6MassTerm_sound CB2_4_2I1R6Entropy_sound) (by decide +kernel) +def CB2_4_2I1R7Value (a : Fin 6) : ℝ := residualLaw (below (shape 2 4 2)) (fun u => (stageBLaw (shape 2 4 2) u : ℝ)) (stageBPriority (shape 2 4 2)) 1 (fun u a => (littleLaw (shape 2 4 2) u ((stageBPriority (shape 2 4 2)) 1) a : ℝ)) 7 a +def CB2_4_2I1R7Raw (a : Fin 6) : Ball := residualBall (below (shape 2 4 2)) B2_4_2Law (stageBPriority (shape 2 4 2)) 1 (fun u => B2_4_2Little u ((stageBPriority (shape 2 4 2)) 1)) 7 a +lemma CB2_4_2I1R7Raw_sound (a : Fin 6) : + (CB2_4_2I1R7Raw a).Encloses (CB2_4_2I1R7Value a) := by + exact residualBall_sound_on (below (shape 2 4 2)) B2_4_2Law (fun u => (stageBLaw (shape 2 4 2) u : ℝ)) (stageBPriority (shape 2 4 2)) 1 (fun u => B2_4_2Little u ((stageBPriority (shape 2 4 2)) 1)) (fun u a => (littleLaw (shape 2 4 2) u ((stageBPriority (shape 2 4 2)) 1) a : ℝ)) (fun u _ => B2_4_2Law_sound u) (fun u _ a => B2_4_2Little_sound u ((stageBPriority (shape 2 4 2)) 1) a) 7 a +def CB2_4_2I1R7Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB2_4_2I1R7Certificates_valid : + CB2_4_2I1R7Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB2_4_2I1R7CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB2_4_2I1R7P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_4_2I1R7Certificates (CB2_4_2I1R7CertificateIndex a)).input +lemma CB2_4_2I1R7P_check : ∀ a : Fin 6, contains (CB2_4_2I1R7Raw a) (CB2_4_2I1R7P a) = true := by + decide +kernel +lemma CB2_4_2I1R7P_sound (a : Fin 6) : + (CB2_4_2I1R7P a).Encloses (CB2_4_2I1R7Value a) := + contains_sound (CB2_4_2I1R7Raw_sound a) (CB2_4_2I1R7P_check a) +def CB2_4_2I1R7Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_4_2I1R7Certificates (CB2_4_2I1R7CertificateIndex a)).output +lemma CB2_4_2I1R7Terms_sound (a : Fin 6) : + (CB2_4_2I1R7Terms a).Encloses (Foundation.entropyTerm (CB2_4_2I1R7Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB2_4_2I1R7Certificates_valid + (CB2_4_2I1R7CertificateIndex a) (CB2_4_2I1R7P_sound a) +def CB2_4_2I1R7Entropy : Ball := ⟨0, 0⟩ +lemma CB2_4_2I1R7Entropy_sound : CB2_4_2I1R7Entropy.Encloses (Foundation.finiteEntropy CB2_4_2I1R7Value) := by + exact contains_sound (entropyFin_enclosed 6 CB2_4_2I1R7Value CB2_4_2I1R7Terms CB2_4_2I1R7Terms_sound) (by decide +kernel) +def CB2_4_2I1R7Mass : Ball := ⟨0, 0⟩ +lemma CB2_4_2I1R7Mass_sound : CB2_4_2I1R7Mass.Encloses (∑ a, CB2_4_2I1R7Value a) := by + exact contains_sound (finSumBall_sound 6 CB2_4_2I1R7P CB2_4_2I1R7Value CB2_4_2I1R7P_sound) (by decide +kernel) +def CB2_4_2I1R7MassTerm : Ball := .exact 0 +lemma CB2_4_2I1R7MassTerm_sound : CB2_4_2I1R7MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB2_4_2I1R7Value a))) := + entropyTerm_zero_ball (CB2_4_2I1R7Mass_sound) +def CB2_4_2I1R7H : Ball := ⟨0, 0⟩ +lemma CB2_4_2I1R7H_sound : CB2_4_2I1R7H.Encloses (homogeneousEntropy CB2_4_2I1R7Value) := by + exact contains_sound (homogeneous_enclosed CB2_4_2I1R7Value CB2_4_2I1R7MassTerm_sound CB2_4_2I1R7Entropy_sound) (by decide +kernel) +def CB2_4_2I1R8Value (a : Fin 6) : ℝ := residualLaw (below (shape 2 4 2)) (fun u => (stageBLaw (shape 2 4 2) u : ℝ)) (stageBPriority (shape 2 4 2)) 1 (fun u a => (littleLaw (shape 2 4 2) u ((stageBPriority (shape 2 4 2)) 1) a : ℝ)) 8 a +def CB2_4_2I1R8Raw (a : Fin 6) : Ball := residualBall (below (shape 2 4 2)) B2_4_2Law (stageBPriority (shape 2 4 2)) 1 (fun u => B2_4_2Little u ((stageBPriority (shape 2 4 2)) 1)) 8 a +lemma CB2_4_2I1R8Raw_sound (a : Fin 6) : + (CB2_4_2I1R8Raw a).Encloses (CB2_4_2I1R8Value a) := by + exact residualBall_sound_on (below (shape 2 4 2)) B2_4_2Law (fun u => (stageBLaw (shape 2 4 2) u : ℝ)) (stageBPriority (shape 2 4 2)) 1 (fun u => B2_4_2Little u ((stageBPriority (shape 2 4 2)) 1)) (fun u a => (littleLaw (shape 2 4 2) u ((stageBPriority (shape 2 4 2)) 1) a : ℝ)) (fun u _ => B2_4_2Law_sound u) (fun u _ a => B2_4_2Little_sound u ((stageBPriority (shape 2 4 2)) 1) a) 8 a +def CB2_4_2I1R8Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB2_4_2I1R8Certificates_valid : + CB2_4_2I1R8Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB2_4_2I1R8CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB2_4_2I1R8P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_4_2I1R8Certificates (CB2_4_2I1R8CertificateIndex a)).input +lemma CB2_4_2I1R8P_check : ∀ a : Fin 6, contains (CB2_4_2I1R8Raw a) (CB2_4_2I1R8P a) = true := by + decide +kernel +lemma CB2_4_2I1R8P_sound (a : Fin 6) : + (CB2_4_2I1R8P a).Encloses (CB2_4_2I1R8Value a) := + contains_sound (CB2_4_2I1R8Raw_sound a) (CB2_4_2I1R8P_check a) +def CB2_4_2I1R8Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_4_2I1R8Certificates (CB2_4_2I1R8CertificateIndex a)).output +lemma CB2_4_2I1R8Terms_sound (a : Fin 6) : + (CB2_4_2I1R8Terms a).Encloses (Foundation.entropyTerm (CB2_4_2I1R8Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB2_4_2I1R8Certificates_valid + (CB2_4_2I1R8CertificateIndex a) (CB2_4_2I1R8P_sound a) +def CB2_4_2I1R8Entropy : Ball := ⟨0, 0⟩ +lemma CB2_4_2I1R8Entropy_sound : CB2_4_2I1R8Entropy.Encloses (Foundation.finiteEntropy CB2_4_2I1R8Value) := by + exact contains_sound (entropyFin_enclosed 6 CB2_4_2I1R8Value CB2_4_2I1R8Terms CB2_4_2I1R8Terms_sound) (by decide +kernel) +def CB2_4_2I1R8Mass : Ball := ⟨0, 0⟩ +lemma CB2_4_2I1R8Mass_sound : CB2_4_2I1R8Mass.Encloses (∑ a, CB2_4_2I1R8Value a) := by + exact contains_sound (finSumBall_sound 6 CB2_4_2I1R8P CB2_4_2I1R8Value CB2_4_2I1R8P_sound) (by decide +kernel) +def CB2_4_2I1R8MassTerm : Ball := .exact 0 +lemma CB2_4_2I1R8MassTerm_sound : CB2_4_2I1R8MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB2_4_2I1R8Value a))) := + entropyTerm_zero_ball (CB2_4_2I1R8Mass_sound) +def CB2_4_2I1R8H : Ball := ⟨0, 0⟩ +lemma CB2_4_2I1R8H_sound : CB2_4_2I1R8H.Encloses (homogeneousEntropy CB2_4_2I1R8Value) := by + exact contains_sound (homogeneous_enclosed CB2_4_2I1R8Value CB2_4_2I1R8MassTerm_sound CB2_4_2I1R8Entropy_sound) (by decide +kernel) +def CB2_4_2I1R9Value (a : Fin 6) : ℝ := residualLaw (below (shape 2 4 2)) (fun u => (stageBLaw (shape 2 4 2) u : ℝ)) (stageBPriority (shape 2 4 2)) 1 (fun u a => (littleLaw (shape 2 4 2) u ((stageBPriority (shape 2 4 2)) 1) a : ℝ)) 9 a +def CB2_4_2I1R9Raw (a : Fin 6) : Ball := residualBall (below (shape 2 4 2)) B2_4_2Law (stageBPriority (shape 2 4 2)) 1 (fun u => B2_4_2Little u ((stageBPriority (shape 2 4 2)) 1)) 9 a +lemma CB2_4_2I1R9Raw_sound (a : Fin 6) : + (CB2_4_2I1R9Raw a).Encloses (CB2_4_2I1R9Value a) := by + exact residualBall_sound_on (below (shape 2 4 2)) B2_4_2Law (fun u => (stageBLaw (shape 2 4 2) u : ℝ)) (stageBPriority (shape 2 4 2)) 1 (fun u => B2_4_2Little u ((stageBPriority (shape 2 4 2)) 1)) (fun u a => (littleLaw (shape 2 4 2) u ((stageBPriority (shape 2 4 2)) 1) a : ℝ)) (fun u _ => B2_4_2Law_sound u) (fun u _ a => B2_4_2Little_sound u ((stageBPriority (shape 2 4 2)) 1) a) 9 a +def CB2_4_2I1R9Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB2_4_2I1R9Certificates_valid : + CB2_4_2I1R9Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB2_4_2I1R9CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB2_4_2I1R9P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_4_2I1R9Certificates (CB2_4_2I1R9CertificateIndex a)).input +lemma CB2_4_2I1R9P_check : ∀ a : Fin 6, contains (CB2_4_2I1R9Raw a) (CB2_4_2I1R9P a) = true := by + decide +kernel +lemma CB2_4_2I1R9P_sound (a : Fin 6) : + (CB2_4_2I1R9P a).Encloses (CB2_4_2I1R9Value a) := + contains_sound (CB2_4_2I1R9Raw_sound a) (CB2_4_2I1R9P_check a) +def CB2_4_2I1R9Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_4_2I1R9Certificates (CB2_4_2I1R9CertificateIndex a)).output +lemma CB2_4_2I1R9Terms_sound (a : Fin 6) : + (CB2_4_2I1R9Terms a).Encloses (Foundation.entropyTerm (CB2_4_2I1R9Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB2_4_2I1R9Certificates_valid + (CB2_4_2I1R9CertificateIndex a) (CB2_4_2I1R9P_sound a) +def CB2_4_2I1R9Entropy : Ball := ⟨0, 0⟩ +lemma CB2_4_2I1R9Entropy_sound : CB2_4_2I1R9Entropy.Encloses (Foundation.finiteEntropy CB2_4_2I1R9Value) := by + exact contains_sound (entropyFin_enclosed 6 CB2_4_2I1R9Value CB2_4_2I1R9Terms CB2_4_2I1R9Terms_sound) (by decide +kernel) +def CB2_4_2I1R9Mass : Ball := ⟨0, 0⟩ +lemma CB2_4_2I1R9Mass_sound : CB2_4_2I1R9Mass.Encloses (∑ a, CB2_4_2I1R9Value a) := by + exact contains_sound (finSumBall_sound 6 CB2_4_2I1R9P CB2_4_2I1R9Value CB2_4_2I1R9P_sound) (by decide +kernel) +def CB2_4_2I1R9MassTerm : Ball := .exact 0 +lemma CB2_4_2I1R9MassTerm_sound : CB2_4_2I1R9MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB2_4_2I1R9Value a))) := + entropyTerm_zero_ball (CB2_4_2I1R9Mass_sound) +def CB2_4_2I1R9H : Ball := ⟨0, 0⟩ +lemma CB2_4_2I1R9H_sound : CB2_4_2I1R9H.Encloses (homogeneousEntropy CB2_4_2I1R9Value) := by + exact contains_sound (homogeneous_enclosed CB2_4_2I1R9Value CB2_4_2I1R9MassTerm_sound CB2_4_2I1R9Entropy_sound) (by decide +kernel) +def CB2_4_2I1R10Value (a : Fin 6) : ℝ := residualLaw (below (shape 2 4 2)) (fun u => (stageBLaw (shape 2 4 2) u : ℝ)) (stageBPriority (shape 2 4 2)) 1 (fun u a => (littleLaw (shape 2 4 2) u ((stageBPriority (shape 2 4 2)) 1) a : ℝ)) 10 a +def CB2_4_2I1R10Raw (a : Fin 6) : Ball := residualBall (below (shape 2 4 2)) B2_4_2Law (stageBPriority (shape 2 4 2)) 1 (fun u => B2_4_2Little u ((stageBPriority (shape 2 4 2)) 1)) 10 a +lemma CB2_4_2I1R10Raw_sound (a : Fin 6) : + (CB2_4_2I1R10Raw a).Encloses (CB2_4_2I1R10Value a) := by + exact residualBall_sound_on (below (shape 2 4 2)) B2_4_2Law (fun u => (stageBLaw (shape 2 4 2) u : ℝ)) (stageBPriority (shape 2 4 2)) 1 (fun u => B2_4_2Little u ((stageBPriority (shape 2 4 2)) 1)) (fun u a => (littleLaw (shape 2 4 2) u ((stageBPriority (shape 2 4 2)) 1) a : ℝ)) (fun u _ => B2_4_2Law_sound u) (fun u _ a => B2_4_2Little_sound u ((stageBPriority (shape 2 4 2)) 1) a) 10 a +def CB2_4_2I1R10Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB2_4_2I1R10Certificates_valid : + CB2_4_2I1R10Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB2_4_2I1R10CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB2_4_2I1R10P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_4_2I1R10Certificates (CB2_4_2I1R10CertificateIndex a)).input +lemma CB2_4_2I1R10P_check : ∀ a : Fin 6, contains (CB2_4_2I1R10Raw a) (CB2_4_2I1R10P a) = true := by + decide +kernel +lemma CB2_4_2I1R10P_sound (a : Fin 6) : + (CB2_4_2I1R10P a).Encloses (CB2_4_2I1R10Value a) := + contains_sound (CB2_4_2I1R10Raw_sound a) (CB2_4_2I1R10P_check a) +def CB2_4_2I1R10Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_4_2I1R10Certificates (CB2_4_2I1R10CertificateIndex a)).output +lemma CB2_4_2I1R10Terms_sound (a : Fin 6) : + (CB2_4_2I1R10Terms a).Encloses (Foundation.entropyTerm (CB2_4_2I1R10Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB2_4_2I1R10Certificates_valid + (CB2_4_2I1R10CertificateIndex a) (CB2_4_2I1R10P_sound a) +def CB2_4_2I1R10Entropy : Ball := ⟨0, 0⟩ +lemma CB2_4_2I1R10Entropy_sound : CB2_4_2I1R10Entropy.Encloses (Foundation.finiteEntropy CB2_4_2I1R10Value) := by + exact contains_sound (entropyFin_enclosed 6 CB2_4_2I1R10Value CB2_4_2I1R10Terms CB2_4_2I1R10Terms_sound) (by decide +kernel) +def CB2_4_2I1R10Mass : Ball := ⟨0, 0⟩ +lemma CB2_4_2I1R10Mass_sound : CB2_4_2I1R10Mass.Encloses (∑ a, CB2_4_2I1R10Value a) := by + exact contains_sound (finSumBall_sound 6 CB2_4_2I1R10P CB2_4_2I1R10Value CB2_4_2I1R10P_sound) (by decide +kernel) +def CB2_4_2I1R10MassTerm : Ball := .exact 0 +lemma CB2_4_2I1R10MassTerm_sound : CB2_4_2I1R10MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB2_4_2I1R10Value a))) := + entropyTerm_zero_ball (CB2_4_2I1R10Mass_sound) +def CB2_4_2I1R10H : Ball := ⟨0, 0⟩ +lemma CB2_4_2I1R10H_sound : CB2_4_2I1R10H.Encloses (homogeneousEntropy CB2_4_2I1R10Value) := by + exact contains_sound (homogeneous_enclosed CB2_4_2I1R10Value CB2_4_2I1R10MassTerm_sound CB2_4_2I1R10Entropy_sound) (by decide +kernel) +def CB2_4_2I1R11Value (a : Fin 6) : ℝ := residualLaw (below (shape 2 4 2)) (fun u => (stageBLaw (shape 2 4 2) u : ℝ)) (stageBPriority (shape 2 4 2)) 1 (fun u a => (littleLaw (shape 2 4 2) u ((stageBPriority (shape 2 4 2)) 1) a : ℝ)) 11 a +def CB2_4_2I1R11Raw (a : Fin 6) : Ball := residualBall (below (shape 2 4 2)) B2_4_2Law (stageBPriority (shape 2 4 2)) 1 (fun u => B2_4_2Little u ((stageBPriority (shape 2 4 2)) 1)) 11 a +lemma CB2_4_2I1R11Raw_sound (a : Fin 6) : + (CB2_4_2I1R11Raw a).Encloses (CB2_4_2I1R11Value a) := by + exact residualBall_sound_on (below (shape 2 4 2)) B2_4_2Law (fun u => (stageBLaw (shape 2 4 2) u : ℝ)) (stageBPriority (shape 2 4 2)) 1 (fun u => B2_4_2Little u ((stageBPriority (shape 2 4 2)) 1)) (fun u a => (littleLaw (shape 2 4 2) u ((stageBPriority (shape 2 4 2)) 1) a : ℝ)) (fun u _ => B2_4_2Law_sound u) (fun u _ a => B2_4_2Little_sound u ((stageBPriority (shape 2 4 2)) 1) a) 11 a +def CB2_4_2I1R11Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB2_4_2I1R11Certificates_valid : + CB2_4_2I1R11Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB2_4_2I1R11CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB2_4_2I1R11P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_4_2I1R11Certificates (CB2_4_2I1R11CertificateIndex a)).input +lemma CB2_4_2I1R11P_check : ∀ a : Fin 6, contains (CB2_4_2I1R11Raw a) (CB2_4_2I1R11P a) = true := by + decide +kernel +lemma CB2_4_2I1R11P_sound (a : Fin 6) : + (CB2_4_2I1R11P a).Encloses (CB2_4_2I1R11Value a) := + contains_sound (CB2_4_2I1R11Raw_sound a) (CB2_4_2I1R11P_check a) +def CB2_4_2I1R11Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_4_2I1R11Certificates (CB2_4_2I1R11CertificateIndex a)).output +lemma CB2_4_2I1R11Terms_sound (a : Fin 6) : + (CB2_4_2I1R11Terms a).Encloses (Foundation.entropyTerm (CB2_4_2I1R11Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB2_4_2I1R11Certificates_valid + (CB2_4_2I1R11CertificateIndex a) (CB2_4_2I1R11P_sound a) +def CB2_4_2I1R11Entropy : Ball := ⟨0, 0⟩ +lemma CB2_4_2I1R11Entropy_sound : CB2_4_2I1R11Entropy.Encloses (Foundation.finiteEntropy CB2_4_2I1R11Value) := by + exact contains_sound (entropyFin_enclosed 6 CB2_4_2I1R11Value CB2_4_2I1R11Terms CB2_4_2I1R11Terms_sound) (by decide +kernel) +def CB2_4_2I1R11Mass : Ball := ⟨0, 0⟩ +lemma CB2_4_2I1R11Mass_sound : CB2_4_2I1R11Mass.Encloses (∑ a, CB2_4_2I1R11Value a) := by + exact contains_sound (finSumBall_sound 6 CB2_4_2I1R11P CB2_4_2I1R11Value CB2_4_2I1R11P_sound) (by decide +kernel) +def CB2_4_2I1R11MassTerm : Ball := .exact 0 +lemma CB2_4_2I1R11MassTerm_sound : CB2_4_2I1R11MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB2_4_2I1R11Value a))) := + entropyTerm_zero_ball (CB2_4_2I1R11Mass_sound) +def CB2_4_2I1R11H : Ball := ⟨0, 0⟩ +lemma CB2_4_2I1R11H_sound : CB2_4_2I1R11H.Encloses (homogeneousEntropy CB2_4_2I1R11Value) := by + exact contains_sound (homogeneous_enclosed CB2_4_2I1R11Value CB2_4_2I1R11MassTerm_sound CB2_4_2I1R11Entropy_sound) (by decide +kernel) +def CB2_4_2I1R12Value (a : Fin 6) : ℝ := residualLaw (below (shape 2 4 2)) (fun u => (stageBLaw (shape 2 4 2) u : ℝ)) (stageBPriority (shape 2 4 2)) 1 (fun u a => (littleLaw (shape 2 4 2) u ((stageBPriority (shape 2 4 2)) 1) a : ℝ)) 12 a +def CB2_4_2I1R12Raw (a : Fin 6) : Ball := residualBall (below (shape 2 4 2)) B2_4_2Law (stageBPriority (shape 2 4 2)) 1 (fun u => B2_4_2Little u ((stageBPriority (shape 2 4 2)) 1)) 12 a +lemma CB2_4_2I1R12Raw_sound (a : Fin 6) : + (CB2_4_2I1R12Raw a).Encloses (CB2_4_2I1R12Value a) := by + exact residualBall_sound_on (below (shape 2 4 2)) B2_4_2Law (fun u => (stageBLaw (shape 2 4 2) u : ℝ)) (stageBPriority (shape 2 4 2)) 1 (fun u => B2_4_2Little u ((stageBPriority (shape 2 4 2)) 1)) (fun u a => (littleLaw (shape 2 4 2) u ((stageBPriority (shape 2 4 2)) 1) a : ℝ)) (fun u _ => B2_4_2Law_sound u) (fun u _ a => B2_4_2Little_sound u ((stageBPriority (shape 2 4 2)) 1) a) 12 a +def CB2_4_2I1R12Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB2_4_2I1R12Certificates_valid : + CB2_4_2I1R12Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB2_4_2I1R12CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB2_4_2I1R12P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_4_2I1R12Certificates (CB2_4_2I1R12CertificateIndex a)).input +lemma CB2_4_2I1R12P_check : ∀ a : Fin 6, contains (CB2_4_2I1R12Raw a) (CB2_4_2I1R12P a) = true := by + decide +kernel +lemma CB2_4_2I1R12P_sound (a : Fin 6) : + (CB2_4_2I1R12P a).Encloses (CB2_4_2I1R12Value a) := + contains_sound (CB2_4_2I1R12Raw_sound a) (CB2_4_2I1R12P_check a) +def CB2_4_2I1R12Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_4_2I1R12Certificates (CB2_4_2I1R12CertificateIndex a)).output +lemma CB2_4_2I1R12Terms_sound (a : Fin 6) : + (CB2_4_2I1R12Terms a).Encloses (Foundation.entropyTerm (CB2_4_2I1R12Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB2_4_2I1R12Certificates_valid + (CB2_4_2I1R12CertificateIndex a) (CB2_4_2I1R12P_sound a) +def CB2_4_2I1R12Entropy : Ball := ⟨0, 0⟩ +lemma CB2_4_2I1R12Entropy_sound : CB2_4_2I1R12Entropy.Encloses (Foundation.finiteEntropy CB2_4_2I1R12Value) := by + exact contains_sound (entropyFin_enclosed 6 CB2_4_2I1R12Value CB2_4_2I1R12Terms CB2_4_2I1R12Terms_sound) (by decide +kernel) +def CB2_4_2I1R12Mass : Ball := ⟨0, 0⟩ +lemma CB2_4_2I1R12Mass_sound : CB2_4_2I1R12Mass.Encloses (∑ a, CB2_4_2I1R12Value a) := by + exact contains_sound (finSumBall_sound 6 CB2_4_2I1R12P CB2_4_2I1R12Value CB2_4_2I1R12P_sound) (by decide +kernel) +def CB2_4_2I1R12MassTerm : Ball := .exact 0 +lemma CB2_4_2I1R12MassTerm_sound : CB2_4_2I1R12MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB2_4_2I1R12Value a))) := + entropyTerm_zero_ball (CB2_4_2I1R12Mass_sound) +def CB2_4_2I1R12H : Ball := ⟨0, 0⟩ +lemma CB2_4_2I1R12H_sound : CB2_4_2I1R12H.Encloses (homogeneousEntropy CB2_4_2I1R12Value) := by + exact contains_sound (homogeneous_enclosed CB2_4_2I1R12Value CB2_4_2I1R12MassTerm_sound CB2_4_2I1R12Entropy_sound) (by decide +kernel) +def CB2_4_2I1R13Value (a : Fin 6) : ℝ := residualLaw (below (shape 2 4 2)) (fun u => (stageBLaw (shape 2 4 2) u : ℝ)) (stageBPriority (shape 2 4 2)) 1 (fun u a => (littleLaw (shape 2 4 2) u ((stageBPriority (shape 2 4 2)) 1) a : ℝ)) 13 a +def CB2_4_2I1R13Raw (a : Fin 6) : Ball := residualBall (below (shape 2 4 2)) B2_4_2Law (stageBPriority (shape 2 4 2)) 1 (fun u => B2_4_2Little u ((stageBPriority (shape 2 4 2)) 1)) 13 a +lemma CB2_4_2I1R13Raw_sound (a : Fin 6) : + (CB2_4_2I1R13Raw a).Encloses (CB2_4_2I1R13Value a) := by + exact residualBall_sound_on (below (shape 2 4 2)) B2_4_2Law (fun u => (stageBLaw (shape 2 4 2) u : ℝ)) (stageBPriority (shape 2 4 2)) 1 (fun u => B2_4_2Little u ((stageBPriority (shape 2 4 2)) 1)) (fun u a => (littleLaw (shape 2 4 2) u ((stageBPriority (shape 2 4 2)) 1) a : ℝ)) (fun u _ => B2_4_2Law_sound u) (fun u _ a => B2_4_2Little_sound u ((stageBPriority (shape 2 4 2)) 1) a) 13 a +def CB2_4_2I1R13Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB2_4_2I1R13Certificates_valid : + CB2_4_2I1R13Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB2_4_2I1R13CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB2_4_2I1R13P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_4_2I1R13Certificates (CB2_4_2I1R13CertificateIndex a)).input +lemma CB2_4_2I1R13P_check : ∀ a : Fin 6, contains (CB2_4_2I1R13Raw a) (CB2_4_2I1R13P a) = true := by + decide +kernel +lemma CB2_4_2I1R13P_sound (a : Fin 6) : + (CB2_4_2I1R13P a).Encloses (CB2_4_2I1R13Value a) := + contains_sound (CB2_4_2I1R13Raw_sound a) (CB2_4_2I1R13P_check a) +def CB2_4_2I1R13Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_4_2I1R13Certificates (CB2_4_2I1R13CertificateIndex a)).output +lemma CB2_4_2I1R13Terms_sound (a : Fin 6) : + (CB2_4_2I1R13Terms a).Encloses (Foundation.entropyTerm (CB2_4_2I1R13Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB2_4_2I1R13Certificates_valid + (CB2_4_2I1R13CertificateIndex a) (CB2_4_2I1R13P_sound a) +def CB2_4_2I1R13Entropy : Ball := ⟨0, 0⟩ +lemma CB2_4_2I1R13Entropy_sound : CB2_4_2I1R13Entropy.Encloses (Foundation.finiteEntropy CB2_4_2I1R13Value) := by + exact contains_sound (entropyFin_enclosed 6 CB2_4_2I1R13Value CB2_4_2I1R13Terms CB2_4_2I1R13Terms_sound) (by decide +kernel) +def CB2_4_2I1R13Mass : Ball := ⟨0, 0⟩ +lemma CB2_4_2I1R13Mass_sound : CB2_4_2I1R13Mass.Encloses (∑ a, CB2_4_2I1R13Value a) := by + exact contains_sound (finSumBall_sound 6 CB2_4_2I1R13P CB2_4_2I1R13Value CB2_4_2I1R13P_sound) (by decide +kernel) +def CB2_4_2I1R13MassTerm : Ball := .exact 0 +lemma CB2_4_2I1R13MassTerm_sound : CB2_4_2I1R13MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB2_4_2I1R13Value a))) := + entropyTerm_zero_ball (CB2_4_2I1R13Mass_sound) +def CB2_4_2I1R13H : Ball := ⟨0, 0⟩ +lemma CB2_4_2I1R13H_sound : CB2_4_2I1R13H.Encloses (homogeneousEntropy CB2_4_2I1R13Value) := by + exact contains_sound (homogeneous_enclosed CB2_4_2I1R13Value CB2_4_2I1R13MassTerm_sound CB2_4_2I1R13Entropy_sound) (by decide +kernel) +def CB2_4_2I1R14Value (a : Fin 6) : ℝ := residualLaw (below (shape 2 4 2)) (fun u => (stageBLaw (shape 2 4 2) u : ℝ)) (stageBPriority (shape 2 4 2)) 1 (fun u a => (littleLaw (shape 2 4 2) u ((stageBPriority (shape 2 4 2)) 1) a : ℝ)) 14 a +def CB2_4_2I1R14Raw (a : Fin 6) : Ball := residualBall (below (shape 2 4 2)) B2_4_2Law (stageBPriority (shape 2 4 2)) 1 (fun u => B2_4_2Little u ((stageBPriority (shape 2 4 2)) 1)) 14 a +lemma CB2_4_2I1R14Raw_sound (a : Fin 6) : + (CB2_4_2I1R14Raw a).Encloses (CB2_4_2I1R14Value a) := by + exact residualBall_sound_on (below (shape 2 4 2)) B2_4_2Law (fun u => (stageBLaw (shape 2 4 2) u : ℝ)) (stageBPriority (shape 2 4 2)) 1 (fun u => B2_4_2Little u ((stageBPriority (shape 2 4 2)) 1)) (fun u a => (littleLaw (shape 2 4 2) u ((stageBPriority (shape 2 4 2)) 1) a : ℝ)) (fun u _ => B2_4_2Law_sound u) (fun u _ a => B2_4_2Little_sound u ((stageBPriority (shape 2 4 2)) 1) a) 14 a +def CB2_4_2I1R14Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB2_4_2I1R14Certificates_valid : + CB2_4_2I1R14Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB2_4_2I1R14CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB2_4_2I1R14P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_4_2I1R14Certificates (CB2_4_2I1R14CertificateIndex a)).input +lemma CB2_4_2I1R14P_check : ∀ a : Fin 6, contains (CB2_4_2I1R14Raw a) (CB2_4_2I1R14P a) = true := by + decide +kernel +lemma CB2_4_2I1R14P_sound (a : Fin 6) : + (CB2_4_2I1R14P a).Encloses (CB2_4_2I1R14Value a) := + contains_sound (CB2_4_2I1R14Raw_sound a) (CB2_4_2I1R14P_check a) +def CB2_4_2I1R14Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_4_2I1R14Certificates (CB2_4_2I1R14CertificateIndex a)).output +lemma CB2_4_2I1R14Terms_sound (a : Fin 6) : + (CB2_4_2I1R14Terms a).Encloses (Foundation.entropyTerm (CB2_4_2I1R14Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB2_4_2I1R14Certificates_valid + (CB2_4_2I1R14CertificateIndex a) (CB2_4_2I1R14P_sound a) +def CB2_4_2I1R14Entropy : Ball := ⟨0, 0⟩ +lemma CB2_4_2I1R14Entropy_sound : CB2_4_2I1R14Entropy.Encloses (Foundation.finiteEntropy CB2_4_2I1R14Value) := by + exact contains_sound (entropyFin_enclosed 6 CB2_4_2I1R14Value CB2_4_2I1R14Terms CB2_4_2I1R14Terms_sound) (by decide +kernel) +def CB2_4_2I1R14Mass : Ball := ⟨0, 0⟩ +lemma CB2_4_2I1R14Mass_sound : CB2_4_2I1R14Mass.Encloses (∑ a, CB2_4_2I1R14Value a) := by + exact contains_sound (finSumBall_sound 6 CB2_4_2I1R14P CB2_4_2I1R14Value CB2_4_2I1R14P_sound) (by decide +kernel) +def CB2_4_2I1R14MassTerm : Ball := .exact 0 +lemma CB2_4_2I1R14MassTerm_sound : CB2_4_2I1R14MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB2_4_2I1R14Value a))) := + entropyTerm_zero_ball (CB2_4_2I1R14Mass_sound) +def CB2_4_2I1R14H : Ball := ⟨0, 0⟩ +lemma CB2_4_2I1R14H_sound : CB2_4_2I1R14H.Encloses (homogeneousEntropy CB2_4_2I1R14Value) := by + exact contains_sound (homogeneous_enclosed CB2_4_2I1R14Value CB2_4_2I1R14MassTerm_sound CB2_4_2I1R14Entropy_sound) (by decide +kernel) +def CB2_4_2I1R15Value (a : Fin 6) : ℝ := residualLaw (below (shape 2 4 2)) (fun u => (stageBLaw (shape 2 4 2) u : ℝ)) (stageBPriority (shape 2 4 2)) 1 (fun u a => (littleLaw (shape 2 4 2) u ((stageBPriority (shape 2 4 2)) 1) a : ℝ)) 15 a +def CB2_4_2I1R15Raw (a : Fin 6) : Ball := residualBall (below (shape 2 4 2)) B2_4_2Law (stageBPriority (shape 2 4 2)) 1 (fun u => B2_4_2Little u ((stageBPriority (shape 2 4 2)) 1)) 15 a +lemma CB2_4_2I1R15Raw_sound (a : Fin 6) : + (CB2_4_2I1R15Raw a).Encloses (CB2_4_2I1R15Value a) := by + exact residualBall_sound_on (below (shape 2 4 2)) B2_4_2Law (fun u => (stageBLaw (shape 2 4 2) u : ℝ)) (stageBPriority (shape 2 4 2)) 1 (fun u => B2_4_2Little u ((stageBPriority (shape 2 4 2)) 1)) (fun u a => (littleLaw (shape 2 4 2) u ((stageBPriority (shape 2 4 2)) 1) a : ℝ)) (fun u _ => B2_4_2Law_sound u) (fun u _ a => B2_4_2Little_sound u ((stageBPriority (shape 2 4 2)) 1) a) 15 a +def CB2_4_2I1R15Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB2_4_2I1R15Certificates_valid : + CB2_4_2I1R15Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB2_4_2I1R15CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB2_4_2I1R15P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_4_2I1R15Certificates (CB2_4_2I1R15CertificateIndex a)).input +lemma CB2_4_2I1R15P_check : ∀ a : Fin 6, contains (CB2_4_2I1R15Raw a) (CB2_4_2I1R15P a) = true := by + decide +kernel +lemma CB2_4_2I1R15P_sound (a : Fin 6) : + (CB2_4_2I1R15P a).Encloses (CB2_4_2I1R15Value a) := + contains_sound (CB2_4_2I1R15Raw_sound a) (CB2_4_2I1R15P_check a) +def CB2_4_2I1R15Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_4_2I1R15Certificates (CB2_4_2I1R15CertificateIndex a)).output +lemma CB2_4_2I1R15Terms_sound (a : Fin 6) : + (CB2_4_2I1R15Terms a).Encloses (Foundation.entropyTerm (CB2_4_2I1R15Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB2_4_2I1R15Certificates_valid + (CB2_4_2I1R15CertificateIndex a) (CB2_4_2I1R15P_sound a) +def CB2_4_2I1R15Entropy : Ball := ⟨0, 0⟩ +lemma CB2_4_2I1R15Entropy_sound : CB2_4_2I1R15Entropy.Encloses (Foundation.finiteEntropy CB2_4_2I1R15Value) := by + exact contains_sound (entropyFin_enclosed 6 CB2_4_2I1R15Value CB2_4_2I1R15Terms CB2_4_2I1R15Terms_sound) (by decide +kernel) +def CB2_4_2I1R15Mass : Ball := ⟨0, 0⟩ +lemma CB2_4_2I1R15Mass_sound : CB2_4_2I1R15Mass.Encloses (∑ a, CB2_4_2I1R15Value a) := by + exact contains_sound (finSumBall_sound 6 CB2_4_2I1R15P CB2_4_2I1R15Value CB2_4_2I1R15P_sound) (by decide +kernel) +def CB2_4_2I1R15MassTerm : Ball := .exact 0 +lemma CB2_4_2I1R15MassTerm_sound : CB2_4_2I1R15MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB2_4_2I1R15Value a))) := + entropyTerm_zero_ball (CB2_4_2I1R15Mass_sound) +def CB2_4_2I1R15H : Ball := ⟨0, 0⟩ +lemma CB2_4_2I1R15H_sound : CB2_4_2I1R15H.Encloses (homogeneousEntropy CB2_4_2I1R15Value) := by + exact contains_sound (homogeneous_enclosed CB2_4_2I1R15Value CB2_4_2I1R15MassTerm_sound CB2_4_2I1R15Entropy_sound) (by decide +kernel) +def CB2_4_2I1R16Value (a : Fin 6) : ℝ := residualLaw (below (shape 2 4 2)) (fun u => (stageBLaw (shape 2 4 2) u : ℝ)) (stageBPriority (shape 2 4 2)) 1 (fun u a => (littleLaw (shape 2 4 2) u ((stageBPriority (shape 2 4 2)) 1) a : ℝ)) 16 a +def CB2_4_2I1R16Raw (a : Fin 6) : Ball := residualBall (below (shape 2 4 2)) B2_4_2Law (stageBPriority (shape 2 4 2)) 1 (fun u => B2_4_2Little u ((stageBPriority (shape 2 4 2)) 1)) 16 a +lemma CB2_4_2I1R16Raw_sound (a : Fin 6) : + (CB2_4_2I1R16Raw a).Encloses (CB2_4_2I1R16Value a) := by + exact residualBall_sound_on (below (shape 2 4 2)) B2_4_2Law (fun u => (stageBLaw (shape 2 4 2) u : ℝ)) (stageBPriority (shape 2 4 2)) 1 (fun u => B2_4_2Little u ((stageBPriority (shape 2 4 2)) 1)) (fun u a => (littleLaw (shape 2 4 2) u ((stageBPriority (shape 2 4 2)) 1) a : ℝ)) (fun u _ => B2_4_2Law_sound u) (fun u _ a => B2_4_2Little_sound u ((stageBPriority (shape 2 4 2)) 1) a) 16 a +def CB2_4_2I1R16Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB2_4_2I1R16Certificates_valid : + CB2_4_2I1R16Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB2_4_2I1R16CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB2_4_2I1R16P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_4_2I1R16Certificates (CB2_4_2I1R16CertificateIndex a)).input +lemma CB2_4_2I1R16P_check : ∀ a : Fin 6, contains (CB2_4_2I1R16Raw a) (CB2_4_2I1R16P a) = true := by + decide +kernel +lemma CB2_4_2I1R16P_sound (a : Fin 6) : + (CB2_4_2I1R16P a).Encloses (CB2_4_2I1R16Value a) := + contains_sound (CB2_4_2I1R16Raw_sound a) (CB2_4_2I1R16P_check a) +def CB2_4_2I1R16Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_4_2I1R16Certificates (CB2_4_2I1R16CertificateIndex a)).output +lemma CB2_4_2I1R16Terms_sound (a : Fin 6) : + (CB2_4_2I1R16Terms a).Encloses (Foundation.entropyTerm (CB2_4_2I1R16Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB2_4_2I1R16Certificates_valid + (CB2_4_2I1R16CertificateIndex a) (CB2_4_2I1R16P_sound a) +def CB2_4_2I1R16Entropy : Ball := ⟨0, 0⟩ +lemma CB2_4_2I1R16Entropy_sound : CB2_4_2I1R16Entropy.Encloses (Foundation.finiteEntropy CB2_4_2I1R16Value) := by + exact contains_sound (entropyFin_enclosed 6 CB2_4_2I1R16Value CB2_4_2I1R16Terms CB2_4_2I1R16Terms_sound) (by decide +kernel) +def CB2_4_2I1R16Mass : Ball := ⟨0, 0⟩ +lemma CB2_4_2I1R16Mass_sound : CB2_4_2I1R16Mass.Encloses (∑ a, CB2_4_2I1R16Value a) := by + exact contains_sound (finSumBall_sound 6 CB2_4_2I1R16P CB2_4_2I1R16Value CB2_4_2I1R16P_sound) (by decide +kernel) +def CB2_4_2I1R16MassTerm : Ball := .exact 0 +lemma CB2_4_2I1R16MassTerm_sound : CB2_4_2I1R16MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB2_4_2I1R16Value a))) := + entropyTerm_zero_ball (CB2_4_2I1R16Mass_sound) +def CB2_4_2I1R16H : Ball := ⟨0, 0⟩ +lemma CB2_4_2I1R16H_sound : CB2_4_2I1R16H.Encloses (homogeneousEntropy CB2_4_2I1R16Value) := by + exact contains_sound (homogeneous_enclosed CB2_4_2I1R16Value CB2_4_2I1R16MassTerm_sound CB2_4_2I1R16Entropy_sound) (by decide +kernel) +def CB2_4_2I1ResidualEntropies (a : Fin 17) : Ball := + match a.val with + | 0 => CB2_4_2I1R0H + | 1 => CB2_4_2I1R1H + | 2 => CB2_4_2I1R2H + | 3 => CB2_4_2I1R3H + | 4 => CB2_4_2I1R4H + | 5 => CB2_4_2I1R5H + | 6 => CB2_4_2I1R6H + | 7 => CB2_4_2I1R7H + | 8 => CB2_4_2I1R8H + | 9 => CB2_4_2I1R9H + | 10 => CB2_4_2I1R10H + | 11 => CB2_4_2I1R11H + | 12 => CB2_4_2I1R12H + | 13 => CB2_4_2I1R13H + | 14 => CB2_4_2I1R14H + | 15 => CB2_4_2I1R15H + | 16 => CB2_4_2I1R16H + | _ => (.exact 0) +lemma CB2_4_2I1ResidualEntropies_sound (k : Fin 17) : + (CB2_4_2I1ResidualEntropies k).Encloses (homogeneousEntropy + (residualLaw (below (shape 2 4 2)) (fun u => (stageBLaw (shape 2 4 2) u : ℝ)) (stageBPriority (shape 2 4 2)) 1 (fun u a => (littleLaw (shape 2 4 2) u ((stageBPriority (shape 2 4 2)) 1) a : ℝ)) k)) := by + fin_cases k + · exact CB2_4_2I1R0H_sound + · exact CB2_4_2I1R1H_sound + · exact CB2_4_2I1R2H_sound + · exact CB2_4_2I1R3H_sound + · exact CB2_4_2I1R4H_sound + · exact CB2_4_2I1R5H_sound + · exact CB2_4_2I1R6H_sound + · exact CB2_4_2I1R7H_sound + · exact CB2_4_2I1R8H_sound + · exact CB2_4_2I1R9H_sound + · exact CB2_4_2I1R10H_sound + · exact CB2_4_2I1R11H_sound + · exact CB2_4_2I1R12H_sound + · exact CB2_4_2I1R13H_sound + · exact CB2_4_2I1R14H_sound + · exact CB2_4_2I1R15H_sound + · exact CB2_4_2I1R16H_sound +def CB2_4_2I1S2_0_2Value (a : Fin 6) : ℝ := (littleLaw (shape 2 4 2) (shape 2 0 2) ((stageBPriority (shape 2 4 2)) 1) a : ℝ) +def CB2_4_2I1S2_0_2E_2LogWitness : LogWitness := ⟨-1, 468331, 250000⟩ +def CB2_4_2I1S2_0_2E_2Log : Ball := ⟨(-817909844265902747909981412881 / 12500000000000000000000000000000), (21175823683 / 50000000000000000000000000000000)⟩ +lemma CB2_4_2I1S2_0_2E_2Log_sound : CB2_4_2I1S2_0_2E_2Log.Encloses (Real.log (CB2_4_2I1S2_0_2Value (2 : Fin 6))) := by + exact checkLog_sound logTwoBall_sound ((B2_4_2Little_sound (shape 2 0 2) ((stageBPriority (shape 2 4 2)) 1)) (2 : Fin 6)) (w := CB2_4_2I1S2_0_2E_2LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB2_4_2I1S2_0_2E_2 : Ball := ⟨(95763133818723624957857376269 / 1562500000000000000000000000000), (19834589363 / 50000000000000000000000000000000)⟩ +lemma CB2_4_2I1S2_0_2E_2_sound : CB2_4_2I1S2_0_2E_2.Encloses (Foundation.entropyTerm (CB2_4_2I1S2_0_2Value (2 : Fin 6))) := by + exact contains_sound (entropyTerm_ball ((B2_4_2Little_sound (shape 2 0 2) ((stageBPriority (shape 2 4 2)) 1)) (2 : Fin 6)) CB2_4_2I1S2_0_2E_2Log_sound) (by decide +kernel) +def CB2_4_2I1S2_0_2E_3LogWitness : LogWitness := ⟨-4, 31669, 31250⟩ +def CB2_4_2I1S2_0_2E_3Log : Ball := ⟨(-275926981399378237867248750022457 / 100000000000000000000000000000000), (52939559207 / 50000000000000000000000000000000)⟩ +lemma CB2_4_2I1S2_0_2E_3Log_sound : CB2_4_2I1S2_0_2E_3Log.Encloses (Real.log (CB2_4_2I1S2_0_2Value (3 : Fin 6))) := by + exact checkLog_sound logTwoBall_sound ((B2_4_2Little_sound (shape 2 0 2) ((stageBPriority (shape 2 4 2)) 1)) (3 : Fin 6)) (w := CB2_4_2I1S2_0_2E_3LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB2_4_2I1S2_0_2E_3 : Ball := ⟨(8738331573936909415017900664461 / 50000000000000000000000000000000), (6706171603 / 100000000000000000000000000000000)⟩ +lemma CB2_4_2I1S2_0_2E_3_sound : CB2_4_2I1S2_0_2E_3.Encloses (Foundation.entropyTerm (CB2_4_2I1S2_0_2Value (3 : Fin 6))) := by + exact contains_sound (entropyTerm_ball ((B2_4_2Little_sound (shape 2 0 2) ((stageBPriority (shape 2 4 2)) 1)) (3 : Fin 6)) CB2_4_2I1S2_0_2E_3Log_sound) (by decide +kernel) +def CB2_4_2I1S2_0_2Terms (a : Fin 6) : Ball := + match a.val with + | 2 => ⟨(95763133818723624957857376269 / 1562500000000000000000000000000), (19834589363 / 50000000000000000000000000000000)⟩ + | 3 => ⟨(8738331573936909415017900664461 / 50000000000000000000000000000000), (6706171603 / 100000000000000000000000000000000)⟩ + | _ => (.exact 0) +lemma CB2_4_2I1S2_0_2Terms_sound (a : Fin 6) : + (CB2_4_2I1S2_0_2Terms a).Encloses (Foundation.entropyTerm (CB2_4_2I1S2_0_2Value a)) := by + fin_cases a + · exact (entropyTerm_zero_ball ((B2_4_2Little_sound (shape 2 0 2) ((stageBPriority (shape 2 4 2)) 1)) (0 : Fin 6))) + · exact (entropyTerm_zero_ball ((B2_4_2Little_sound (shape 2 0 2) ((stageBPriority (shape 2 4 2)) 1)) (1 : Fin 6))) + · exact CB2_4_2I1S2_0_2E_2_sound + · exact CB2_4_2I1S2_0_2E_3_sound + · exact (entropyTerm_zero_ball ((B2_4_2Little_sound (shape 2 0 2) ((stageBPriority (shape 2 4 2)) 1)) (4 : Fin 6))) + · exact (entropyTerm_zero_ball ((B2_4_2Little_sound (shape 2 0 2) ((stageBPriority (shape 2 4 2)) 1)) (5 : Fin 6))) +def CB2_4_2I1S2_0_2Entropy : Ball := ⟨(11802751856136065413669336705069 / 50000000000000000000000000000000), (46375350329 / 100000000000000000000000000000000)⟩ +lemma CB2_4_2I1S2_0_2Entropy_sound : CB2_4_2I1S2_0_2Entropy.Encloses (Foundation.finiteEntropy CB2_4_2I1S2_0_2Value) := by + exact contains_sound (entropyFin_enclosed 6 CB2_4_2I1S2_0_2Value CB2_4_2I1S2_0_2Terms CB2_4_2I1S2_0_2Terms_sound) (by decide +kernel) +def CB2_4_2I1S2_0_2Mass : Ball := ⟨1, 0⟩ +lemma CB2_4_2I1S2_0_2Mass_sound : CB2_4_2I1S2_0_2Mass.Encloses (∑ a, CB2_4_2I1S2_0_2Value a) := by + exact contains_sound (finSumBall_sound 6 (B2_4_2Little (shape 2 0 2) ((stageBPriority (shape 2 4 2)) 1)) CB2_4_2I1S2_0_2Value (B2_4_2Little_sound (shape 2 0 2) ((stageBPriority (shape 2 4 2)) 1))) (by decide +kernel) +def CB2_4_2I1S2_0_2MassTermLog : Ball := .exact 0 +lemma CB2_4_2I1S2_0_2MassTermLog_sound : CB2_4_2I1S2_0_2MassTermLog.Encloses (Real.log ((∑ a, CB2_4_2I1S2_0_2Value a))) := by + exact log_exact_one_ball (CB2_4_2I1S2_0_2Mass_sound) +def CB2_4_2I1S2_0_2MassTerm : Ball := ⟨0, 0⟩ +lemma CB2_4_2I1S2_0_2MassTerm_sound : CB2_4_2I1S2_0_2MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB2_4_2I1S2_0_2Value a))) := by + exact contains_sound (entropyTerm_ball (CB2_4_2I1S2_0_2Mass_sound) CB2_4_2I1S2_0_2MassTermLog_sound) (by decide +kernel) +def CB2_4_2I1S2_0_2H : Ball := ⟨(11802751856136065413669336705069 / 50000000000000000000000000000000), (46375350329 / 100000000000000000000000000000000)⟩ +lemma CB2_4_2I1S2_0_2H_sound : CB2_4_2I1S2_0_2H.Encloses (homogeneousEntropy CB2_4_2I1S2_0_2Value) := by + exact contains_sound (homogeneous_enclosed CB2_4_2I1S2_0_2Value CB2_4_2I1S2_0_2MassTerm_sound CB2_4_2I1S2_0_2Entropy_sound) (by decide +kernel) +def CB2_4_2I1Singles (s : Shape) : Ball := + match s 0, s 1, s 2 with + | 2, 0, 2 => CB2_4_2I1S2_0_2H + | _, _, _ => (.exact 0) +lemma CB2_4_2I1Singles_sound (u : Shape) (hu : u ∈ below (shape 2 4 2)) + (hd : designated (stageBPriority (shape 2 4 2)) 1 u) : + (CB2_4_2I1Singles u).Encloses (homogeneousEntropy ((fun u a => (littleLaw (shape 2 4 2) u ((stageBPriority (shape 2 4 2)) 1) a : ℝ)) u)) := by + rw [B2_4_2_below] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl + · exact (show ¬ designated (stageBPriority (shape 2 4 2)) 1 (shape 0 2 2) by decide +kernel) hd |>.elim + · exact (show ¬ designated (stageBPriority (shape 2 4 2)) 1 (shape 0 3 1) by decide +kernel) hd |>.elim + · exact (show ¬ designated (stageBPriority (shape 2 4 2)) 1 (shape 0 4 0) by decide +kernel) hd |>.elim + · exact (show ¬ designated (stageBPriority (shape 2 4 2)) 1 (shape 1 1 2) by decide +kernel) hd |>.elim + · exact (show ¬ designated (stageBPriority (shape 2 4 2)) 1 (shape 1 2 1) by decide +kernel) hd |>.elim + · exact (show ¬ designated (stageBPriority (shape 2 4 2)) 1 (shape 1 3 0) by decide +kernel) hd |>.elim + · exact CB2_4_2I1S2_0_2H_sound + · exact (show ¬ designated (stageBPriority (shape 2 4 2)) 1 (shape 2 1 1) by decide +kernel) hd |>.elim + · exact (show ¬ designated (stageBPriority (shape 2 4 2)) 1 (shape 2 2 0) by decide +kernel) hd |>.elim +def CB2_4_2I1Singleton : Ball := ⟨(7758248349865350979731860157 / 100000000000000000000000000000000), (1905231 / 12500000000000000000000000000000)⟩ +lemma CB2_4_2I1Singleton_sound : CB2_4_2I1Singleton.Encloses + (singletonEntropy (below (shape 2 4 2)) (fun u => (stageBLaw (shape 2 4 2) u : ℝ)) (stageBPriority (shape 2 4 2)) 1 (fun u a => (littleLaw (shape 2 4 2) u ((stageBPriority (shape 2 4 2)) 1) a : ℝ))) := by + exact contains_sound (singletonBall_sound (below (shape 2 4 2)) B2_4_2Law (fun u => (stageBLaw (shape 2 4 2) u : ℝ)) (stageBPriority (shape 2 4 2)) 1 + CB2_4_2I1Singles (fun u a => (littleLaw (shape 2 4 2) u ((stageBPriority (shape 2 4 2)) 1) a : ℝ)) (fun u _ => B2_4_2Law_sound u) CB2_4_2I1Singles_sound) (by decide +kernel) +def CB2_4_2I1Group : Ball := ⟨(225595931823917709311538862723 / 4000000000000000000000000000000), (58491707893 / 50000000000000000000000000000000)⟩ +lemma CB2_4_2I1Group_sound : CB2_4_2I1Group.Encloses + (groupedEntropy (below (shape 2 4 2)) (fun u => (stageBLaw (shape 2 4 2) u : ℝ)) (stageBPriority (shape 2 4 2)) 1 (fun u a => (littleLaw (shape 2 4 2) u ((stageBPriority (shape 2 4 2)) 1) a : ℝ))) := by + exact contains_sound (Ball.add_sound CB2_4_2I1Singleton_sound + (finSumBall_sound 17 CB2_4_2I1ResidualEntropies _ CB2_4_2I1ResidualEntropies_sound)) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CB2_4_2I1H : Ball := ⟨(1142660989699219747309254557641 / 1250000000000000000000000000000), (157630869557 / 50000000000000000000000000000000)⟩ +lemma CB2_4_2I1_sound : CB2_4_2I1H.Encloses (stageBCapacity (shape 2 4 2) 1) := by + have hb := contains_sound (Ball.add_sound CB2_4_2I1PairH_sound + (Ball.neg_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) CB2_4_2I1Group_sound))) + (show contains (.add CB2_4_2I1PairH (.neg (.mul (.exact 2) CB2_4_2I1Group))) CB2_4_2I1H = true by decide +kernel) + simp only [stageBCapacity, nativeCapacity, + show (1 : Fin 3) ≠ 0 by decide, ite_false] + change CB2_4_2I1H.Encloses (homogeneousEntropy CB2_4_2I1PairValue - _) + simpa only [sub_eq_add_neg] using hb + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/CapacityB/CapB2_4_2I2.lean b/lean/OAI/LinearAlgebra/MatrixFields/CapacityB/CapB2_4_2I2.lean new file mode 100644 index 0000000000000000000000000000000000000000..66222e024ae869ca2c224ae5042ce58e98aa5aa3 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/CapacityB/CapB2_4_2I2.lean @@ -0,0 +1,1055 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Certificates.Terminal2_4_2 + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CB2_4_2I2PairValue (a : PairSlot) : ℝ := pairLaw (below (shape 2 4 2)) (shape 2 4 2) (fun u => (stageBLaw (shape 2 4 2) u : ℝ)) (fun u a => (littleLaw (shape 2 4 2) u ((stageBPriority (shape 2 4 2)) 2) a : ℝ)) a +def CB2_4_2I2PairRaw (a : PairSlot) : Ball := pairLawBall (below (shape 2 4 2)) (shape 2 4 2) B2_4_2Law (fun u => B2_4_2Little u ((stageBPriority (shape 2 4 2)) 2)) a +lemma CB2_4_2I2PairRaw_sound (a : PairSlot) : + (CB2_4_2I2PairRaw a).Encloses (CB2_4_2I2PairValue a) := by + exact pairLawBall_sound_on (below (shape 2 4 2)) (shape 2 4 2) B2_4_2Law (fun u => (stageBLaw (shape 2 4 2) u : ℝ)) (fun u => B2_4_2Little u ((stageBPriority (shape 2 4 2)) 2)) (fun u a => (littleLaw (shape 2 4 2) u ((stageBPriority (shape 2 4 2)) 2) a : ℝ)) (fun u _ => B2_4_2Law_sound u) (fun u _ a => B2_4_2Little_sound u ((stageBPriority (shape 2 4 2)) 2) a) (fun u _ a => B2_4_2Little_sound (complement (shape 2 4 2) u) ((stageBPriority (shape 2 4 2)) 2) a) a +def CB2_4_2I2PairCertificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(38593837517531901492832074284017 / 50000000000000000000000000000000), (73 / 50000000000000000000000000000000)⟩ ⟨(19986234916392059121653039614781 / 100000000000000000000000000000000), (261522017 / 800000000000000000000000000000)⟩ ⟨(-25893039150762054805807983389569 / 100000000000000000000000000000000), (8470329511 / 20000000000000000000000000000000)⟩ ⟨-1, 38593837517531901492832074284017, 25000000000000000000000000000000⟩, + .log ⟨(84117846883879413836036378887 / 2500000000000000000000000000000), (11 / 100000000000000000000000000000000)⟩ ⟨(5706264115735324593176557642817 / 50000000000000000000000000000000), (855007063 / 20000000000000000000000000000000)⟩ ⟨(-339182725611875442801390305454341 / 100000000000000000000000000000000), (15881867803 / 12500000000000000000000000000000)⟩ ⟨-5, 84117846883879413836036378887, 78125000000000000000000000000⟩, + .log ⟨(8154626406161167721949080479 / 2500000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ ⟨(1867559683758181807763108124533 / 100000000000000000000000000000000), (345361869 / 50000000000000000000000000000000)⟩ ⟨(-22901842349848926116008837404669 / 4000000000000000000000000000000), (211758237443 / 100000000000000000000000000000000)⟩ ⟨-9, 8154626406161167721949080479, 4882812500000000000000000000⟩, + .log ⟨(3922744904992762908135236404901 / 50000000000000000000000000000000), (31 / 100000000000000000000000000000000)⟩ ⟨(19968586744498442177544038541237 / 100000000000000000000000000000000), (8306735557 / 100000000000000000000000000000000)⟩ ⟨(-63630784145188005552858184192867 / 25000000000000000000000000000000), (10587911881 / 10000000000000000000000000000000)⟩ ⟨-4, 3922744904992762908135236404901, 3125000000000000000000000000000⟩, + .log ⟨(32866269004172783017016141121 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(263603206926091894677212823061 / 100000000000000000000000000000000), (90476151 / 100000000000000000000000000000000)⟩ ⟨(-802047859136746485653157416152017 / 100000000000000000000000000000000), (275285710921 / 100000000000000000000000000000000)⟩ ⟨-12, 32866269004172783017016141121, 24414062500000000000000000000⟩] +lemma CB2_4_2I2PairCertificates_valid : + CB2_4_2I2PairCertificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB2_4_2I2PairCertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 2, 2 => 1 + | 2, 3 => 2 + | 3, 2 => 2 + | 3, 3 => 3 + | 4, 1 => 4 + | 5, 0 => 5 + | 1, 4 => 4 + | 0, 5 => 5 + | _, _ => 0 +def CB2_4_2I2PairP (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CB2_4_2I2PairCertificates (CB2_4_2I2PairCertificateIndex a)).input +lemma CB2_4_2I2PairP_check : ∀ a : PairSlot, contains (CB2_4_2I2PairRaw a) (CB2_4_2I2PairP a) = true := by + decide +kernel +lemma CB2_4_2I2PairP_sound (a : PairSlot) : + (CB2_4_2I2PairP a).Encloses (CB2_4_2I2PairValue a) := + contains_sound (CB2_4_2I2PairRaw_sound a) (CB2_4_2I2PairP_check a) +def CB2_4_2I2PairTerms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CB2_4_2I2PairCertificates (CB2_4_2I2PairCertificateIndex a)).output +lemma CB2_4_2I2PairTerms_sound (a : PairSlot) : + (CB2_4_2I2PairTerms a).Encloses (Foundation.entropyTerm (CB2_4_2I2PairValue a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB2_4_2I2PairCertificates_valid + (CB2_4_2I2PairCertificateIndex a) (CB2_4_2I2PairP_sound a) +def CB2_4_2I2PairEntropy : Ball := ⟨(42571615482970303723282440519589 / 50000000000000000000000000000000), (58725469909 / 100000000000000000000000000000000)⟩ +lemma CB2_4_2I2PairEntropy_sound : CB2_4_2I2PairEntropy.Encloses (Foundation.finiteEntropy CB2_4_2I2PairValue) := by + exact contains_sound (entropyPair_enclosed CB2_4_2I2PairValue CB2_4_2I2PairTerms CB2_4_2I2PairTerms_sound) (by decide +kernel) +def CB2_4_2I2PairMass : Ball := ⟨1, (117 / 50000000000000000000000000000000)⟩ +lemma CB2_4_2I2PairMass_sound : CB2_4_2I2PairMass.Encloses (∑ a, CB2_4_2I2PairValue a) := by + exact contains_sound (pairSumBall_sound CB2_4_2I2PairP CB2_4_2I2PairValue CB2_4_2I2PairP_sound) (by decide +kernel) +def CB2_4_2I2PairMassTermLogWitness : LogWitness := ⟨0, 1, 1⟩ +def CB2_4_2I2PairMassTermLog : Ball := ⟨0, (5293955979 / 25000000000000000000000000000000)⟩ +lemma CB2_4_2I2PairMassTermLog_sound : CB2_4_2I2PairMassTermLog.Encloses (Real.log ((∑ a, CB2_4_2I2PairValue a))) := by + exact checkLog_sound logTwoBall_sound (CB2_4_2I2PairMass_sound) (w := CB2_4_2I2PairMassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB2_4_2I2PairMassTerm : Ball := ⟨0, (21175823917 / 100000000000000000000000000000000)⟩ +lemma CB2_4_2I2PairMassTerm_sound : CB2_4_2I2PairMassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB2_4_2I2PairValue a))) := by + exact contains_sound (entropyTerm_ball (CB2_4_2I2PairMass_sound) CB2_4_2I2PairMassTermLog_sound) (by decide +kernel) +def CB2_4_2I2PairH : Ball := ⟨(42571615482970303723282440519589 / 50000000000000000000000000000000), (39950646913 / 50000000000000000000000000000000)⟩ +lemma CB2_4_2I2PairH_sound : CB2_4_2I2PairH.Encloses (homogeneousEntropy CB2_4_2I2PairValue) := by + exact contains_sound (homogeneous_enclosed CB2_4_2I2PairValue CB2_4_2I2PairMassTerm_sound CB2_4_2I2PairEntropy_sound) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CB2_4_2I2R0Value (a : Fin 6) : ℝ := residualLaw (below (shape 2 4 2)) (fun u => (stageBLaw (shape 2 4 2) u : ℝ)) (stageBPriority (shape 2 4 2)) 2 (fun u a => (littleLaw (shape 2 4 2) u ((stageBPriority (shape 2 4 2)) 2) a : ℝ)) 0 a +def CB2_4_2I2R0Raw (a : Fin 6) : Ball := residualBall (below (shape 2 4 2)) B2_4_2Law (stageBPriority (shape 2 4 2)) 2 (fun u => B2_4_2Little u ((stageBPriority (shape 2 4 2)) 2)) 0 a +lemma CB2_4_2I2R0Raw_sound (a : Fin 6) : + (CB2_4_2I2R0Raw a).Encloses (CB2_4_2I2R0Value a) := by + exact residualBall_sound_on (below (shape 2 4 2)) B2_4_2Law (fun u => (stageBLaw (shape 2 4 2) u : ℝ)) (stageBPriority (shape 2 4 2)) 2 (fun u => B2_4_2Little u ((stageBPriority (shape 2 4 2)) 2)) (fun u a => (littleLaw (shape 2 4 2) u ((stageBPriority (shape 2 4 2)) 2) a : ℝ)) (fun u _ => B2_4_2Law_sound u) (fun u _ a => B2_4_2Little_sound u ((stageBPriority (shape 2 4 2)) 2) a) 0 a +def CB2_4_2I2R0Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(32866269004172783017016141121 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(263603206926091894677212823061 / 100000000000000000000000000000000), (90476151 / 100000000000000000000000000000000)⟩ ⟨(-802047859136746485653157416152017 / 100000000000000000000000000000000), (275285710921 / 100000000000000000000000000000000)⟩ ⟨-12, 32866269004172783017016141121, 24414062500000000000000000000⟩] +lemma CB2_4_2I2R0Certificates_valid : + CB2_4_2I2R0Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB2_4_2I2R0CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | 0 => 1 + | _ => 0 +def CB2_4_2I2R0P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_4_2I2R0Certificates (CB2_4_2I2R0CertificateIndex a)).input +lemma CB2_4_2I2R0P_check : ∀ a : Fin 6, contains (CB2_4_2I2R0Raw a) (CB2_4_2I2R0P a) = true := by + decide +kernel +lemma CB2_4_2I2R0P_sound (a : Fin 6) : + (CB2_4_2I2R0P a).Encloses (CB2_4_2I2R0Value a) := + contains_sound (CB2_4_2I2R0Raw_sound a) (CB2_4_2I2R0P_check a) +def CB2_4_2I2R0Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_4_2I2R0Certificates (CB2_4_2I2R0CertificateIndex a)).output +lemma CB2_4_2I2R0Terms_sound (a : Fin 6) : + (CB2_4_2I2R0Terms a).Encloses (Foundation.entropyTerm (CB2_4_2I2R0Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB2_4_2I2R0Certificates_valid + (CB2_4_2I2R0CertificateIndex a) (CB2_4_2I2R0P_sound a) +def CB2_4_2I2R0Entropy : Ball := ⟨(263603206926091894677212823061 / 100000000000000000000000000000000), (90476151 / 100000000000000000000000000000000)⟩ +lemma CB2_4_2I2R0Entropy_sound : CB2_4_2I2R0Entropy.Encloses (Foundation.finiteEntropy CB2_4_2I2R0Value) := by + exact contains_sound (entropyFin_enclosed 6 CB2_4_2I2R0Value CB2_4_2I2R0Terms CB2_4_2I2R0Terms_sound) (by decide +kernel) +def CB2_4_2I2R0Mass : Ball := ⟨(32866269004172783017016141121 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ +lemma CB2_4_2I2R0Mass_sound : CB2_4_2I2R0Mass.Encloses (∑ a, CB2_4_2I2R0Value a) := by + exact contains_sound (finSumBall_sound 6 CB2_4_2I2R0P CB2_4_2I2R0Value CB2_4_2I2R0P_sound) (by decide +kernel) +def CB2_4_2I2R0MassTermLogWitness : LogWitness := ⟨-12, 32866269004172783017016141121, 24414062500000000000000000000⟩ +def CB2_4_2I2R0MassTermLog : Ball := ⟨(-802047859136746485653157416152017 / 100000000000000000000000000000000), (275285710921 / 100000000000000000000000000000000)⟩ +lemma CB2_4_2I2R0MassTermLog_sound : CB2_4_2I2R0MassTermLog.Encloses (Real.log ((∑ a, CB2_4_2I2R0Value a))) := by + exact checkLog_sound logTwoBall_sound (CB2_4_2I2R0Mass_sound) (w := CB2_4_2I2R0MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB2_4_2I2R0MassTerm : Ball := ⟨(263603206926091894677212823061 / 100000000000000000000000000000000), (90476151 / 100000000000000000000000000000000)⟩ +lemma CB2_4_2I2R0MassTerm_sound : CB2_4_2I2R0MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB2_4_2I2R0Value a))) := by + exact contains_sound (entropyTerm_ball (CB2_4_2I2R0Mass_sound) CB2_4_2I2R0MassTermLog_sound) (by decide +kernel) +def CB2_4_2I2R0H : Ball := ⟨0, (90476151 / 50000000000000000000000000000000)⟩ +lemma CB2_4_2I2R0H_sound : CB2_4_2I2R0H.Encloses (homogeneousEntropy CB2_4_2I2R0Value) := by + exact contains_sound (homogeneous_enclosed CB2_4_2I2R0Value CB2_4_2I2R0MassTerm_sound CB2_4_2I2R0Entropy_sound) (by decide +kernel) +def CB2_4_2I2R1Value (a : Fin 6) : ℝ := residualLaw (below (shape 2 4 2)) (fun u => (stageBLaw (shape 2 4 2) u : ℝ)) (stageBPriority (shape 2 4 2)) 2 (fun u a => (littleLaw (shape 2 4 2) u ((stageBPriority (shape 2 4 2)) 2) a : ℝ)) 1 a +def CB2_4_2I2R1Raw (a : Fin 6) : Ball := residualBall (below (shape 2 4 2)) B2_4_2Law (stageBPriority (shape 2 4 2)) 2 (fun u => B2_4_2Little u ((stageBPriority (shape 2 4 2)) 2)) 1 a +lemma CB2_4_2I2R1Raw_sound (a : Fin 6) : + (CB2_4_2I2R1Raw a).Encloses (CB2_4_2I2R1Value a) := by + exact residualBall_sound_on (below (shape 2 4 2)) B2_4_2Law (fun u => (stageBLaw (shape 2 4 2) u : ℝ)) (stageBPriority (shape 2 4 2)) 2 (fun u => B2_4_2Little u ((stageBPriority (shape 2 4 2)) 2)) (fun u a => (littleLaw (shape 2 4 2) u ((stageBPriority (shape 2 4 2)) 2) a : ℝ)) (fun u _ => B2_4_2Law_sound u) (fun u _ a => B2_4_2Little_sound u ((stageBPriority (shape 2 4 2)) 2) a) 1 a +def CB2_4_2I2R1Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(3922744904992762908135236404901 / 50000000000000000000000000000000), (31 / 100000000000000000000000000000000)⟩ ⟨(19968586744498442177544038541237 / 100000000000000000000000000000000), (8306735557 / 100000000000000000000000000000000)⟩ ⟨(-63630784145188005552858184192867 / 25000000000000000000000000000000), (10587911881 / 10000000000000000000000000000000)⟩ ⟨-4, 3922744904992762908135236404901, 3125000000000000000000000000000⟩] +lemma CB2_4_2I2R1Certificates_valid : + CB2_4_2I2R1Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB2_4_2I2R1CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | 1 => 1 + | _ => 0 +def CB2_4_2I2R1P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_4_2I2R1Certificates (CB2_4_2I2R1CertificateIndex a)).input +lemma CB2_4_2I2R1P_check : ∀ a : Fin 6, contains (CB2_4_2I2R1Raw a) (CB2_4_2I2R1P a) = true := by + decide +kernel +lemma CB2_4_2I2R1P_sound (a : Fin 6) : + (CB2_4_2I2R1P a).Encloses (CB2_4_2I2R1Value a) := + contains_sound (CB2_4_2I2R1Raw_sound a) (CB2_4_2I2R1P_check a) +def CB2_4_2I2R1Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_4_2I2R1Certificates (CB2_4_2I2R1CertificateIndex a)).output +lemma CB2_4_2I2R1Terms_sound (a : Fin 6) : + (CB2_4_2I2R1Terms a).Encloses (Foundation.entropyTerm (CB2_4_2I2R1Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB2_4_2I2R1Certificates_valid + (CB2_4_2I2R1CertificateIndex a) (CB2_4_2I2R1P_sound a) +def CB2_4_2I2R1Entropy : Ball := ⟨(19968586744498442177544038541237 / 100000000000000000000000000000000), (8306735557 / 100000000000000000000000000000000)⟩ +lemma CB2_4_2I2R1Entropy_sound : CB2_4_2I2R1Entropy.Encloses (Foundation.finiteEntropy CB2_4_2I2R1Value) := by + exact contains_sound (entropyFin_enclosed 6 CB2_4_2I2R1Value CB2_4_2I2R1Terms CB2_4_2I2R1Terms_sound) (by decide +kernel) +def CB2_4_2I2R1Mass : Ball := ⟨(3922744904992762908135236404901 / 50000000000000000000000000000000), (31 / 100000000000000000000000000000000)⟩ +lemma CB2_4_2I2R1Mass_sound : CB2_4_2I2R1Mass.Encloses (∑ a, CB2_4_2I2R1Value a) := by + exact contains_sound (finSumBall_sound 6 CB2_4_2I2R1P CB2_4_2I2R1Value CB2_4_2I2R1P_sound) (by decide +kernel) +def CB2_4_2I2R1MassTermLogWitness : LogWitness := ⟨-4, 3922744904992762908135236404901, 3125000000000000000000000000000⟩ +def CB2_4_2I2R1MassTermLog : Ball := ⟨(-63630784145188005552858184192867 / 25000000000000000000000000000000), (10587911881 / 10000000000000000000000000000000)⟩ +lemma CB2_4_2I2R1MassTermLog_sound : CB2_4_2I2R1MassTermLog.Encloses (Real.log ((∑ a, CB2_4_2I2R1Value a))) := by + exact checkLog_sound logTwoBall_sound (CB2_4_2I2R1Mass_sound) (w := CB2_4_2I2R1MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB2_4_2I2R1MassTerm : Ball := ⟨(19968586744498442177544038541237 / 100000000000000000000000000000000), (8306735557 / 100000000000000000000000000000000)⟩ +lemma CB2_4_2I2R1MassTerm_sound : CB2_4_2I2R1MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB2_4_2I2R1Value a))) := by + exact contains_sound (entropyTerm_ball (CB2_4_2I2R1Mass_sound) CB2_4_2I2R1MassTermLog_sound) (by decide +kernel) +def CB2_4_2I2R1H : Ball := ⟨0, (8306735557 / 50000000000000000000000000000000)⟩ +lemma CB2_4_2I2R1H_sound : CB2_4_2I2R1H.Encloses (homogeneousEntropy CB2_4_2I2R1Value) := by + exact contains_sound (homogeneous_enclosed CB2_4_2I2R1Value CB2_4_2I2R1MassTerm_sound CB2_4_2I2R1Entropy_sound) (by decide +kernel) +def CB2_4_2I2R2Value (a : Fin 6) : ℝ := residualLaw (below (shape 2 4 2)) (fun u => (stageBLaw (shape 2 4 2) u : ℝ)) (stageBPriority (shape 2 4 2)) 2 (fun u a => (littleLaw (shape 2 4 2) u ((stageBPriority (shape 2 4 2)) 2) a : ℝ)) 2 a +def CB2_4_2I2R2Raw (a : Fin 6) : Ball := residualBall (below (shape 2 4 2)) B2_4_2Law (stageBPriority (shape 2 4 2)) 2 (fun u => B2_4_2Little u ((stageBPriority (shape 2 4 2)) 2)) 2 a +lemma CB2_4_2I2R2Raw_sound (a : Fin 6) : + (CB2_4_2I2R2Raw a).Encloses (CB2_4_2I2R2Value a) := by + exact residualBall_sound_on (below (shape 2 4 2)) B2_4_2Law (fun u => (stageBLaw (shape 2 4 2) u : ℝ)) (stageBPriority (shape 2 4 2)) 2 (fun u => B2_4_2Little u ((stageBPriority (shape 2 4 2)) 2)) (fun u a => (littleLaw (shape 2 4 2) u ((stageBPriority (shape 2 4 2)) 2) a : ℝ)) (fun u _ => B2_4_2Law_sound u) (fun u _ a => B2_4_2Little_sound u ((stageBPriority (shape 2 4 2)) 2) a) 2 a +def CB2_4_2I2R2Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(54609466933262273992754667669351 / 100000000000000000000000000000000), (63 / 100000000000000000000000000000000)⟩ ⟨(2064793949238344103006168403983 / 6250000000000000000000000000000), (4625601793 / 20000000000000000000000000000000)⟩ ⟨(-60496293121094472494658717695789 / 100000000000000000000000000000000), (1058791187 / 2500000000000000000000000000000)⟩ ⟨-1, 54609466933262273992754667669351, 50000000000000000000000000000000⟩, + .log ⟨(5222953916364413217353037941 / 800000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(3284943309174650193365266111987 / 100000000000000000000000000000000), (622126979 / 50000000000000000000000000000000)⟩ ⟨(-503154860146455841958729828709211 / 100000000000000000000000000000000), (1905824133 / 1000000000000000000000000000000)⟩ ⟨-8, 5222953916364413217353037941, 3125000000000000000000000000⟩] +lemma CB2_4_2I2R2Certificates_valid : + CB2_4_2I2R2Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB2_4_2I2R2CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | 2 => 1 + | 3 => 2 + | _ => 0 +def CB2_4_2I2R2P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_4_2I2R2Certificates (CB2_4_2I2R2CertificateIndex a)).input +lemma CB2_4_2I2R2P_check : ∀ a : Fin 6, contains (CB2_4_2I2R2Raw a) (CB2_4_2I2R2P a) = true := by + decide +kernel +lemma CB2_4_2I2R2P_sound (a : Fin 6) : + (CB2_4_2I2R2P a).Encloses (CB2_4_2I2R2Value a) := + contains_sound (CB2_4_2I2R2Raw_sound a) (CB2_4_2I2R2P_check a) +def CB2_4_2I2R2Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_4_2I2R2Certificates (CB2_4_2I2R2CertificateIndex a)).output +lemma CB2_4_2I2R2Terms_sound (a : Fin 6) : + (CB2_4_2I2R2Terms a).Encloses (Foundation.entropyTerm (CB2_4_2I2R2Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB2_4_2I2R2Certificates_valid + (CB2_4_2I2R2CertificateIndex a) (CB2_4_2I2R2P_sound a) +def CB2_4_2I2R2Entropy : Ball := ⟨(7264329299397631168292792115143 / 20000000000000000000000000000000), (24372262923 / 100000000000000000000000000000000)⟩ +lemma CB2_4_2I2R2Entropy_sound : CB2_4_2I2R2Entropy.Encloses (Foundation.finiteEntropy CB2_4_2I2R2Value) := by + exact contains_sound (entropyFin_enclosed 6 CB2_4_2I2R2Value CB2_4_2I2R2Terms CB2_4_2I2R2Terms_sound) (by decide +kernel) +def CB2_4_2I2R2Mass : Ball := ⟨(6907792021600978205615474676497 / 12500000000000000000000000000000), (1 / 1562500000000000000000000000000)⟩ +lemma CB2_4_2I2R2Mass_sound : CB2_4_2I2R2Mass.Encloses (∑ a, CB2_4_2I2R2Value a) := by + exact contains_sound (finSumBall_sound 6 CB2_4_2I2R2P CB2_4_2I2R2Value CB2_4_2I2R2P_sound) (by decide +kernel) +def CB2_4_2I2R2MassTermLogWitness : LogWitness := ⟨-1, 6907792021600978205615474676497, 6250000000000000000000000000000⟩ +def CB2_4_2I2R2MassTermLog : Ball := ⟨(-59307859136746485653157626203699 / 100000000000000000000000000000000), (42351647481 / 100000000000000000000000000000000)⟩ +lemma CB2_4_2I2R2MassTermLog_sound : CB2_4_2I2R2MassTermLog.Encloses (Real.log ((∑ a, CB2_4_2I2R2Value a))) := by + exact checkLog_sound logTwoBall_sound (CB2_4_2I2R2Mass_sound) (w := CB2_4_2I2R2MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB2_4_2I2R2MassTerm : Ball := ⟨(16387454246522082090302818465961 / 50000000000000000000000000000000), (5851127461 / 25000000000000000000000000000000)⟩ +lemma CB2_4_2I2R2MassTerm_sound : CB2_4_2I2R2MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB2_4_2I2R2Value a))) := by + exact contains_sound (entropyTerm_ball (CB2_4_2I2R2Mass_sound) CB2_4_2I2R2MassTermLog_sound) (by decide +kernel) +def CB2_4_2I2R2H : Ball := ⟨(3546738003943991660858323643793 / 100000000000000000000000000000000), (47776772767 / 100000000000000000000000000000000)⟩ +lemma CB2_4_2I2R2H_sound : CB2_4_2I2R2H.Encloses (homogeneousEntropy CB2_4_2I2R2Value) := by + exact contains_sound (homogeneous_enclosed CB2_4_2I2R2Value CB2_4_2I2R2MassTerm_sound CB2_4_2I2R2Entropy_sound) (by decide +kernel) +def CB2_4_2I2R3Value (a : Fin 6) : ℝ := residualLaw (below (shape 2 4 2)) (fun u => (stageBLaw (shape 2 4 2) u : ℝ)) (stageBPriority (shape 2 4 2)) 2 (fun u a => (littleLaw (shape 2 4 2) u ((stageBPriority (shape 2 4 2)) 2) a : ℝ)) 3 a +def CB2_4_2I2R3Raw (a : Fin 6) : Ball := residualBall (below (shape 2 4 2)) B2_4_2Law (stageBPriority (shape 2 4 2)) 2 (fun u => B2_4_2Little u ((stageBPriority (shape 2 4 2)) 2)) 3 a +lemma CB2_4_2I2R3Raw_sound (a : Fin 6) : + (CB2_4_2I2R3Raw a).Encloses (CB2_4_2I2R3Value a) := by + exact residualBall_sound_on (below (shape 2 4 2)) B2_4_2Law (fun u => (stageBLaw (shape 2 4 2) u : ℝ)) (stageBPriority (shape 2 4 2)) 2 (fun u => B2_4_2Little u ((stageBPriority (shape 2 4 2)) 2)) (fun u a => (littleLaw (shape 2 4 2) u ((stageBPriority (shape 2 4 2)) 2) a : ℝ)) (fun u _ => B2_4_2Law_sound u) (fun u _ a => B2_4_2Little_sound u ((stageBPriority (shape 2 4 2)) 2) a) 3 a +def CB2_4_2I2R3Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB2_4_2I2R3Certificates_valid : + CB2_4_2I2R3Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB2_4_2I2R3CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB2_4_2I2R3P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_4_2I2R3Certificates (CB2_4_2I2R3CertificateIndex a)).input +lemma CB2_4_2I2R3P_check : ∀ a : Fin 6, contains (CB2_4_2I2R3Raw a) (CB2_4_2I2R3P a) = true := by + decide +kernel +lemma CB2_4_2I2R3P_sound (a : Fin 6) : + (CB2_4_2I2R3P a).Encloses (CB2_4_2I2R3Value a) := + contains_sound (CB2_4_2I2R3Raw_sound a) (CB2_4_2I2R3P_check a) +def CB2_4_2I2R3Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_4_2I2R3Certificates (CB2_4_2I2R3CertificateIndex a)).output +lemma CB2_4_2I2R3Terms_sound (a : Fin 6) : + (CB2_4_2I2R3Terms a).Encloses (Foundation.entropyTerm (CB2_4_2I2R3Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB2_4_2I2R3Certificates_valid + (CB2_4_2I2R3CertificateIndex a) (CB2_4_2I2R3P_sound a) +def CB2_4_2I2R3Entropy : Ball := ⟨0, 0⟩ +lemma CB2_4_2I2R3Entropy_sound : CB2_4_2I2R3Entropy.Encloses (Foundation.finiteEntropy CB2_4_2I2R3Value) := by + exact contains_sound (entropyFin_enclosed 6 CB2_4_2I2R3Value CB2_4_2I2R3Terms CB2_4_2I2R3Terms_sound) (by decide +kernel) +def CB2_4_2I2R3Mass : Ball := ⟨0, 0⟩ +lemma CB2_4_2I2R3Mass_sound : CB2_4_2I2R3Mass.Encloses (∑ a, CB2_4_2I2R3Value a) := by + exact contains_sound (finSumBall_sound 6 CB2_4_2I2R3P CB2_4_2I2R3Value CB2_4_2I2R3P_sound) (by decide +kernel) +def CB2_4_2I2R3MassTerm : Ball := .exact 0 +lemma CB2_4_2I2R3MassTerm_sound : CB2_4_2I2R3MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB2_4_2I2R3Value a))) := + entropyTerm_zero_ball (CB2_4_2I2R3Mass_sound) +def CB2_4_2I2R3H : Ball := ⟨0, 0⟩ +lemma CB2_4_2I2R3H_sound : CB2_4_2I2R3H.Encloses (homogeneousEntropy CB2_4_2I2R3Value) := by + exact contains_sound (homogeneous_enclosed CB2_4_2I2R3Value CB2_4_2I2R3MassTerm_sound CB2_4_2I2R3Entropy_sound) (by decide +kernel) +def CB2_4_2I2R4Value (a : Fin 6) : ℝ := residualLaw (below (shape 2 4 2)) (fun u => (stageBLaw (shape 2 4 2) u : ℝ)) (stageBPriority (shape 2 4 2)) 2 (fun u a => (littleLaw (shape 2 4 2) u ((stageBPriority (shape 2 4 2)) 2) a : ℝ)) 4 a +def CB2_4_2I2R4Raw (a : Fin 6) : Ball := residualBall (below (shape 2 4 2)) B2_4_2Law (stageBPriority (shape 2 4 2)) 2 (fun u => B2_4_2Little u ((stageBPriority (shape 2 4 2)) 2)) 4 a +lemma CB2_4_2I2R4Raw_sound (a : Fin 6) : + (CB2_4_2I2R4Raw a).Encloses (CB2_4_2I2R4Value a) := by + exact residualBall_sound_on (below (shape 2 4 2)) B2_4_2Law (fun u => (stageBLaw (shape 2 4 2) u : ℝ)) (stageBPriority (shape 2 4 2)) 2 (fun u => B2_4_2Little u ((stageBPriority (shape 2 4 2)) 2)) (fun u a => (littleLaw (shape 2 4 2) u ((stageBPriority (shape 2 4 2)) 2) a : ℝ)) (fun u _ => B2_4_2Law_sound u) (fun u _ a => B2_4_2Little_sound u ((stageBPriority (shape 2 4 2)) 2) a) 4 a +def CB2_4_2I2R4Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB2_4_2I2R4Certificates_valid : + CB2_4_2I2R4Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB2_4_2I2R4CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB2_4_2I2R4P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_4_2I2R4Certificates (CB2_4_2I2R4CertificateIndex a)).input +lemma CB2_4_2I2R4P_check : ∀ a : Fin 6, contains (CB2_4_2I2R4Raw a) (CB2_4_2I2R4P a) = true := by + decide +kernel +lemma CB2_4_2I2R4P_sound (a : Fin 6) : + (CB2_4_2I2R4P a).Encloses (CB2_4_2I2R4Value a) := + contains_sound (CB2_4_2I2R4Raw_sound a) (CB2_4_2I2R4P_check a) +def CB2_4_2I2R4Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_4_2I2R4Certificates (CB2_4_2I2R4CertificateIndex a)).output +lemma CB2_4_2I2R4Terms_sound (a : Fin 6) : + (CB2_4_2I2R4Terms a).Encloses (Foundation.entropyTerm (CB2_4_2I2R4Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB2_4_2I2R4Certificates_valid + (CB2_4_2I2R4CertificateIndex a) (CB2_4_2I2R4P_sound a) +def CB2_4_2I2R4Entropy : Ball := ⟨0, 0⟩ +lemma CB2_4_2I2R4Entropy_sound : CB2_4_2I2R4Entropy.Encloses (Foundation.finiteEntropy CB2_4_2I2R4Value) := by + exact contains_sound (entropyFin_enclosed 6 CB2_4_2I2R4Value CB2_4_2I2R4Terms CB2_4_2I2R4Terms_sound) (by decide +kernel) +def CB2_4_2I2R4Mass : Ball := ⟨0, 0⟩ +lemma CB2_4_2I2R4Mass_sound : CB2_4_2I2R4Mass.Encloses (∑ a, CB2_4_2I2R4Value a) := by + exact contains_sound (finSumBall_sound 6 CB2_4_2I2R4P CB2_4_2I2R4Value CB2_4_2I2R4P_sound) (by decide +kernel) +def CB2_4_2I2R4MassTerm : Ball := .exact 0 +lemma CB2_4_2I2R4MassTerm_sound : CB2_4_2I2R4MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB2_4_2I2R4Value a))) := + entropyTerm_zero_ball (CB2_4_2I2R4Mass_sound) +def CB2_4_2I2R4H : Ball := ⟨0, 0⟩ +lemma CB2_4_2I2R4H_sound : CB2_4_2I2R4H.Encloses (homogeneousEntropy CB2_4_2I2R4Value) := by + exact contains_sound (homogeneous_enclosed CB2_4_2I2R4Value CB2_4_2I2R4MassTerm_sound CB2_4_2I2R4Entropy_sound) (by decide +kernel) +def CB2_4_2I2R5Value (a : Fin 6) : ℝ := residualLaw (below (shape 2 4 2)) (fun u => (stageBLaw (shape 2 4 2) u : ℝ)) (stageBPriority (shape 2 4 2)) 2 (fun u a => (littleLaw (shape 2 4 2) u ((stageBPriority (shape 2 4 2)) 2) a : ℝ)) 5 a +def CB2_4_2I2R5Raw (a : Fin 6) : Ball := residualBall (below (shape 2 4 2)) B2_4_2Law (stageBPriority (shape 2 4 2)) 2 (fun u => B2_4_2Little u ((stageBPriority (shape 2 4 2)) 2)) 5 a +lemma CB2_4_2I2R5Raw_sound (a : Fin 6) : + (CB2_4_2I2R5Raw a).Encloses (CB2_4_2I2R5Value a) := by + exact residualBall_sound_on (below (shape 2 4 2)) B2_4_2Law (fun u => (stageBLaw (shape 2 4 2) u : ℝ)) (stageBPriority (shape 2 4 2)) 2 (fun u => B2_4_2Little u ((stageBPriority (shape 2 4 2)) 2)) (fun u a => (littleLaw (shape 2 4 2) u ((stageBPriority (shape 2 4 2)) 2) a : ℝ)) (fun u _ => B2_4_2Law_sound u) (fun u _ a => B2_4_2Little_sound u ((stageBPriority (shape 2 4 2)) 2) a) 5 a +def CB2_4_2I2R5Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB2_4_2I2R5Certificates_valid : + CB2_4_2I2R5Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB2_4_2I2R5CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB2_4_2I2R5P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_4_2I2R5Certificates (CB2_4_2I2R5CertificateIndex a)).input +lemma CB2_4_2I2R5P_check : ∀ a : Fin 6, contains (CB2_4_2I2R5Raw a) (CB2_4_2I2R5P a) = true := by + decide +kernel +lemma CB2_4_2I2R5P_sound (a : Fin 6) : + (CB2_4_2I2R5P a).Encloses (CB2_4_2I2R5Value a) := + contains_sound (CB2_4_2I2R5Raw_sound a) (CB2_4_2I2R5P_check a) +def CB2_4_2I2R5Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_4_2I2R5Certificates (CB2_4_2I2R5CertificateIndex a)).output +lemma CB2_4_2I2R5Terms_sound (a : Fin 6) : + (CB2_4_2I2R5Terms a).Encloses (Foundation.entropyTerm (CB2_4_2I2R5Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB2_4_2I2R5Certificates_valid + (CB2_4_2I2R5CertificateIndex a) (CB2_4_2I2R5P_sound a) +def CB2_4_2I2R5Entropy : Ball := ⟨0, 0⟩ +lemma CB2_4_2I2R5Entropy_sound : CB2_4_2I2R5Entropy.Encloses (Foundation.finiteEntropy CB2_4_2I2R5Value) := by + exact contains_sound (entropyFin_enclosed 6 CB2_4_2I2R5Value CB2_4_2I2R5Terms CB2_4_2I2R5Terms_sound) (by decide +kernel) +def CB2_4_2I2R5Mass : Ball := ⟨0, 0⟩ +lemma CB2_4_2I2R5Mass_sound : CB2_4_2I2R5Mass.Encloses (∑ a, CB2_4_2I2R5Value a) := by + exact contains_sound (finSumBall_sound 6 CB2_4_2I2R5P CB2_4_2I2R5Value CB2_4_2I2R5P_sound) (by decide +kernel) +def CB2_4_2I2R5MassTerm : Ball := .exact 0 +lemma CB2_4_2I2R5MassTerm_sound : CB2_4_2I2R5MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB2_4_2I2R5Value a))) := + entropyTerm_zero_ball (CB2_4_2I2R5Mass_sound) +def CB2_4_2I2R5H : Ball := ⟨0, 0⟩ +lemma CB2_4_2I2R5H_sound : CB2_4_2I2R5H.Encloses (homogeneousEntropy CB2_4_2I2R5Value) := by + exact contains_sound (homogeneous_enclosed CB2_4_2I2R5Value CB2_4_2I2R5MassTerm_sound CB2_4_2I2R5Entropy_sound) (by decide +kernel) +def CB2_4_2I2R6Value (a : Fin 6) : ℝ := residualLaw (below (shape 2 4 2)) (fun u => (stageBLaw (shape 2 4 2) u : ℝ)) (stageBPriority (shape 2 4 2)) 2 (fun u a => (littleLaw (shape 2 4 2) u ((stageBPriority (shape 2 4 2)) 2) a : ℝ)) 6 a +def CB2_4_2I2R6Raw (a : Fin 6) : Ball := residualBall (below (shape 2 4 2)) B2_4_2Law (stageBPriority (shape 2 4 2)) 2 (fun u => B2_4_2Little u ((stageBPriority (shape 2 4 2)) 2)) 6 a +lemma CB2_4_2I2R6Raw_sound (a : Fin 6) : + (CB2_4_2I2R6Raw a).Encloses (CB2_4_2I2R6Value a) := by + exact residualBall_sound_on (below (shape 2 4 2)) B2_4_2Law (fun u => (stageBLaw (shape 2 4 2) u : ℝ)) (stageBPriority (shape 2 4 2)) 2 (fun u => B2_4_2Little u ((stageBPriority (shape 2 4 2)) 2)) (fun u a => (littleLaw (shape 2 4 2) u ((stageBPriority (shape 2 4 2)) 2) a : ℝ)) (fun u _ => B2_4_2Law_sound u) (fun u _ a => B2_4_2Little_sound u ((stageBPriority (shape 2 4 2)) 2) a) 6 a +def CB2_4_2I2R6Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB2_4_2I2R6Certificates_valid : + CB2_4_2I2R6Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB2_4_2I2R6CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB2_4_2I2R6P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_4_2I2R6Certificates (CB2_4_2I2R6CertificateIndex a)).input +lemma CB2_4_2I2R6P_check : ∀ a : Fin 6, contains (CB2_4_2I2R6Raw a) (CB2_4_2I2R6P a) = true := by + decide +kernel +lemma CB2_4_2I2R6P_sound (a : Fin 6) : + (CB2_4_2I2R6P a).Encloses (CB2_4_2I2R6Value a) := + contains_sound (CB2_4_2I2R6Raw_sound a) (CB2_4_2I2R6P_check a) +def CB2_4_2I2R6Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_4_2I2R6Certificates (CB2_4_2I2R6CertificateIndex a)).output +lemma CB2_4_2I2R6Terms_sound (a : Fin 6) : + (CB2_4_2I2R6Terms a).Encloses (Foundation.entropyTerm (CB2_4_2I2R6Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB2_4_2I2R6Certificates_valid + (CB2_4_2I2R6CertificateIndex a) (CB2_4_2I2R6P_sound a) +def CB2_4_2I2R6Entropy : Ball := ⟨0, 0⟩ +lemma CB2_4_2I2R6Entropy_sound : CB2_4_2I2R6Entropy.Encloses (Foundation.finiteEntropy CB2_4_2I2R6Value) := by + exact contains_sound (entropyFin_enclosed 6 CB2_4_2I2R6Value CB2_4_2I2R6Terms CB2_4_2I2R6Terms_sound) (by decide +kernel) +def CB2_4_2I2R6Mass : Ball := ⟨0, 0⟩ +lemma CB2_4_2I2R6Mass_sound : CB2_4_2I2R6Mass.Encloses (∑ a, CB2_4_2I2R6Value a) := by + exact contains_sound (finSumBall_sound 6 CB2_4_2I2R6P CB2_4_2I2R6Value CB2_4_2I2R6P_sound) (by decide +kernel) +def CB2_4_2I2R6MassTerm : Ball := .exact 0 +lemma CB2_4_2I2R6MassTerm_sound : CB2_4_2I2R6MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB2_4_2I2R6Value a))) := + entropyTerm_zero_ball (CB2_4_2I2R6Mass_sound) +def CB2_4_2I2R6H : Ball := ⟨0, 0⟩ +lemma CB2_4_2I2R6H_sound : CB2_4_2I2R6H.Encloses (homogeneousEntropy CB2_4_2I2R6Value) := by + exact contains_sound (homogeneous_enclosed CB2_4_2I2R6Value CB2_4_2I2R6MassTerm_sound CB2_4_2I2R6Entropy_sound) (by decide +kernel) +def CB2_4_2I2R7Value (a : Fin 6) : ℝ := residualLaw (below (shape 2 4 2)) (fun u => (stageBLaw (shape 2 4 2) u : ℝ)) (stageBPriority (shape 2 4 2)) 2 (fun u a => (littleLaw (shape 2 4 2) u ((stageBPriority (shape 2 4 2)) 2) a : ℝ)) 7 a +def CB2_4_2I2R7Raw (a : Fin 6) : Ball := residualBall (below (shape 2 4 2)) B2_4_2Law (stageBPriority (shape 2 4 2)) 2 (fun u => B2_4_2Little u ((stageBPriority (shape 2 4 2)) 2)) 7 a +lemma CB2_4_2I2R7Raw_sound (a : Fin 6) : + (CB2_4_2I2R7Raw a).Encloses (CB2_4_2I2R7Value a) := by + exact residualBall_sound_on (below (shape 2 4 2)) B2_4_2Law (fun u => (stageBLaw (shape 2 4 2) u : ℝ)) (stageBPriority (shape 2 4 2)) 2 (fun u => B2_4_2Little u ((stageBPriority (shape 2 4 2)) 2)) (fun u a => (littleLaw (shape 2 4 2) u ((stageBPriority (shape 2 4 2)) 2) a : ℝ)) (fun u _ => B2_4_2Law_sound u) (fun u _ a => B2_4_2Little_sound u ((stageBPriority (shape 2 4 2)) 2) a) 7 a +def CB2_4_2I2R7Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB2_4_2I2R7Certificates_valid : + CB2_4_2I2R7Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB2_4_2I2R7CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB2_4_2I2R7P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_4_2I2R7Certificates (CB2_4_2I2R7CertificateIndex a)).input +lemma CB2_4_2I2R7P_check : ∀ a : Fin 6, contains (CB2_4_2I2R7Raw a) (CB2_4_2I2R7P a) = true := by + decide +kernel +lemma CB2_4_2I2R7P_sound (a : Fin 6) : + (CB2_4_2I2R7P a).Encloses (CB2_4_2I2R7Value a) := + contains_sound (CB2_4_2I2R7Raw_sound a) (CB2_4_2I2R7P_check a) +def CB2_4_2I2R7Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_4_2I2R7Certificates (CB2_4_2I2R7CertificateIndex a)).output +lemma CB2_4_2I2R7Terms_sound (a : Fin 6) : + (CB2_4_2I2R7Terms a).Encloses (Foundation.entropyTerm (CB2_4_2I2R7Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB2_4_2I2R7Certificates_valid + (CB2_4_2I2R7CertificateIndex a) (CB2_4_2I2R7P_sound a) +def CB2_4_2I2R7Entropy : Ball := ⟨0, 0⟩ +lemma CB2_4_2I2R7Entropy_sound : CB2_4_2I2R7Entropy.Encloses (Foundation.finiteEntropy CB2_4_2I2R7Value) := by + exact contains_sound (entropyFin_enclosed 6 CB2_4_2I2R7Value CB2_4_2I2R7Terms CB2_4_2I2R7Terms_sound) (by decide +kernel) +def CB2_4_2I2R7Mass : Ball := ⟨0, 0⟩ +lemma CB2_4_2I2R7Mass_sound : CB2_4_2I2R7Mass.Encloses (∑ a, CB2_4_2I2R7Value a) := by + exact contains_sound (finSumBall_sound 6 CB2_4_2I2R7P CB2_4_2I2R7Value CB2_4_2I2R7P_sound) (by decide +kernel) +def CB2_4_2I2R7MassTerm : Ball := .exact 0 +lemma CB2_4_2I2R7MassTerm_sound : CB2_4_2I2R7MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB2_4_2I2R7Value a))) := + entropyTerm_zero_ball (CB2_4_2I2R7Mass_sound) +def CB2_4_2I2R7H : Ball := ⟨0, 0⟩ +lemma CB2_4_2I2R7H_sound : CB2_4_2I2R7H.Encloses (homogeneousEntropy CB2_4_2I2R7Value) := by + exact contains_sound (homogeneous_enclosed CB2_4_2I2R7Value CB2_4_2I2R7MassTerm_sound CB2_4_2I2R7Entropy_sound) (by decide +kernel) +def CB2_4_2I2R8Value (a : Fin 6) : ℝ := residualLaw (below (shape 2 4 2)) (fun u => (stageBLaw (shape 2 4 2) u : ℝ)) (stageBPriority (shape 2 4 2)) 2 (fun u a => (littleLaw (shape 2 4 2) u ((stageBPriority (shape 2 4 2)) 2) a : ℝ)) 8 a +def CB2_4_2I2R8Raw (a : Fin 6) : Ball := residualBall (below (shape 2 4 2)) B2_4_2Law (stageBPriority (shape 2 4 2)) 2 (fun u => B2_4_2Little u ((stageBPriority (shape 2 4 2)) 2)) 8 a +lemma CB2_4_2I2R8Raw_sound (a : Fin 6) : + (CB2_4_2I2R8Raw a).Encloses (CB2_4_2I2R8Value a) := by + exact residualBall_sound_on (below (shape 2 4 2)) B2_4_2Law (fun u => (stageBLaw (shape 2 4 2) u : ℝ)) (stageBPriority (shape 2 4 2)) 2 (fun u => B2_4_2Little u ((stageBPriority (shape 2 4 2)) 2)) (fun u a => (littleLaw (shape 2 4 2) u ((stageBPriority (shape 2 4 2)) 2) a : ℝ)) (fun u _ => B2_4_2Law_sound u) (fun u _ a => B2_4_2Little_sound u ((stageBPriority (shape 2 4 2)) 2) a) 8 a +def CB2_4_2I2R8Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB2_4_2I2R8Certificates_valid : + CB2_4_2I2R8Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB2_4_2I2R8CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB2_4_2I2R8P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_4_2I2R8Certificates (CB2_4_2I2R8CertificateIndex a)).input +lemma CB2_4_2I2R8P_check : ∀ a : Fin 6, contains (CB2_4_2I2R8Raw a) (CB2_4_2I2R8P a) = true := by + decide +kernel +lemma CB2_4_2I2R8P_sound (a : Fin 6) : + (CB2_4_2I2R8P a).Encloses (CB2_4_2I2R8Value a) := + contains_sound (CB2_4_2I2R8Raw_sound a) (CB2_4_2I2R8P_check a) +def CB2_4_2I2R8Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_4_2I2R8Certificates (CB2_4_2I2R8CertificateIndex a)).output +lemma CB2_4_2I2R8Terms_sound (a : Fin 6) : + (CB2_4_2I2R8Terms a).Encloses (Foundation.entropyTerm (CB2_4_2I2R8Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB2_4_2I2R8Certificates_valid + (CB2_4_2I2R8CertificateIndex a) (CB2_4_2I2R8P_sound a) +def CB2_4_2I2R8Entropy : Ball := ⟨0, 0⟩ +lemma CB2_4_2I2R8Entropy_sound : CB2_4_2I2R8Entropy.Encloses (Foundation.finiteEntropy CB2_4_2I2R8Value) := by + exact contains_sound (entropyFin_enclosed 6 CB2_4_2I2R8Value CB2_4_2I2R8Terms CB2_4_2I2R8Terms_sound) (by decide +kernel) +def CB2_4_2I2R8Mass : Ball := ⟨0, 0⟩ +lemma CB2_4_2I2R8Mass_sound : CB2_4_2I2R8Mass.Encloses (∑ a, CB2_4_2I2R8Value a) := by + exact contains_sound (finSumBall_sound 6 CB2_4_2I2R8P CB2_4_2I2R8Value CB2_4_2I2R8P_sound) (by decide +kernel) +def CB2_4_2I2R8MassTerm : Ball := .exact 0 +lemma CB2_4_2I2R8MassTerm_sound : CB2_4_2I2R8MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB2_4_2I2R8Value a))) := + entropyTerm_zero_ball (CB2_4_2I2R8Mass_sound) +def CB2_4_2I2R8H : Ball := ⟨0, 0⟩ +lemma CB2_4_2I2R8H_sound : CB2_4_2I2R8H.Encloses (homogeneousEntropy CB2_4_2I2R8Value) := by + exact contains_sound (homogeneous_enclosed CB2_4_2I2R8Value CB2_4_2I2R8MassTerm_sound CB2_4_2I2R8Entropy_sound) (by decide +kernel) +def CB2_4_2I2R9Value (a : Fin 6) : ℝ := residualLaw (below (shape 2 4 2)) (fun u => (stageBLaw (shape 2 4 2) u : ℝ)) (stageBPriority (shape 2 4 2)) 2 (fun u a => (littleLaw (shape 2 4 2) u ((stageBPriority (shape 2 4 2)) 2) a : ℝ)) 9 a +def CB2_4_2I2R9Raw (a : Fin 6) : Ball := residualBall (below (shape 2 4 2)) B2_4_2Law (stageBPriority (shape 2 4 2)) 2 (fun u => B2_4_2Little u ((stageBPriority (shape 2 4 2)) 2)) 9 a +lemma CB2_4_2I2R9Raw_sound (a : Fin 6) : + (CB2_4_2I2R9Raw a).Encloses (CB2_4_2I2R9Value a) := by + exact residualBall_sound_on (below (shape 2 4 2)) B2_4_2Law (fun u => (stageBLaw (shape 2 4 2) u : ℝ)) (stageBPriority (shape 2 4 2)) 2 (fun u => B2_4_2Little u ((stageBPriority (shape 2 4 2)) 2)) (fun u a => (littleLaw (shape 2 4 2) u ((stageBPriority (shape 2 4 2)) 2) a : ℝ)) (fun u _ => B2_4_2Law_sound u) (fun u _ a => B2_4_2Little_sound u ((stageBPriority (shape 2 4 2)) 2) a) 9 a +def CB2_4_2I2R9Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB2_4_2I2R9Certificates_valid : + CB2_4_2I2R9Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB2_4_2I2R9CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB2_4_2I2R9P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_4_2I2R9Certificates (CB2_4_2I2R9CertificateIndex a)).input +lemma CB2_4_2I2R9P_check : ∀ a : Fin 6, contains (CB2_4_2I2R9Raw a) (CB2_4_2I2R9P a) = true := by + decide +kernel +lemma CB2_4_2I2R9P_sound (a : Fin 6) : + (CB2_4_2I2R9P a).Encloses (CB2_4_2I2R9Value a) := + contains_sound (CB2_4_2I2R9Raw_sound a) (CB2_4_2I2R9P_check a) +def CB2_4_2I2R9Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_4_2I2R9Certificates (CB2_4_2I2R9CertificateIndex a)).output +lemma CB2_4_2I2R9Terms_sound (a : Fin 6) : + (CB2_4_2I2R9Terms a).Encloses (Foundation.entropyTerm (CB2_4_2I2R9Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB2_4_2I2R9Certificates_valid + (CB2_4_2I2R9CertificateIndex a) (CB2_4_2I2R9P_sound a) +def CB2_4_2I2R9Entropy : Ball := ⟨0, 0⟩ +lemma CB2_4_2I2R9Entropy_sound : CB2_4_2I2R9Entropy.Encloses (Foundation.finiteEntropy CB2_4_2I2R9Value) := by + exact contains_sound (entropyFin_enclosed 6 CB2_4_2I2R9Value CB2_4_2I2R9Terms CB2_4_2I2R9Terms_sound) (by decide +kernel) +def CB2_4_2I2R9Mass : Ball := ⟨0, 0⟩ +lemma CB2_4_2I2R9Mass_sound : CB2_4_2I2R9Mass.Encloses (∑ a, CB2_4_2I2R9Value a) := by + exact contains_sound (finSumBall_sound 6 CB2_4_2I2R9P CB2_4_2I2R9Value CB2_4_2I2R9P_sound) (by decide +kernel) +def CB2_4_2I2R9MassTerm : Ball := .exact 0 +lemma CB2_4_2I2R9MassTerm_sound : CB2_4_2I2R9MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB2_4_2I2R9Value a))) := + entropyTerm_zero_ball (CB2_4_2I2R9Mass_sound) +def CB2_4_2I2R9H : Ball := ⟨0, 0⟩ +lemma CB2_4_2I2R9H_sound : CB2_4_2I2R9H.Encloses (homogeneousEntropy CB2_4_2I2R9Value) := by + exact contains_sound (homogeneous_enclosed CB2_4_2I2R9Value CB2_4_2I2R9MassTerm_sound CB2_4_2I2R9Entropy_sound) (by decide +kernel) +def CB2_4_2I2R10Value (a : Fin 6) : ℝ := residualLaw (below (shape 2 4 2)) (fun u => (stageBLaw (shape 2 4 2) u : ℝ)) (stageBPriority (shape 2 4 2)) 2 (fun u a => (littleLaw (shape 2 4 2) u ((stageBPriority (shape 2 4 2)) 2) a : ℝ)) 10 a +def CB2_4_2I2R10Raw (a : Fin 6) : Ball := residualBall (below (shape 2 4 2)) B2_4_2Law (stageBPriority (shape 2 4 2)) 2 (fun u => B2_4_2Little u ((stageBPriority (shape 2 4 2)) 2)) 10 a +lemma CB2_4_2I2R10Raw_sound (a : Fin 6) : + (CB2_4_2I2R10Raw a).Encloses (CB2_4_2I2R10Value a) := by + exact residualBall_sound_on (below (shape 2 4 2)) B2_4_2Law (fun u => (stageBLaw (shape 2 4 2) u : ℝ)) (stageBPriority (shape 2 4 2)) 2 (fun u => B2_4_2Little u ((stageBPriority (shape 2 4 2)) 2)) (fun u a => (littleLaw (shape 2 4 2) u ((stageBPriority (shape 2 4 2)) 2) a : ℝ)) (fun u _ => B2_4_2Law_sound u) (fun u _ a => B2_4_2Little_sound u ((stageBPriority (shape 2 4 2)) 2) a) 10 a +def CB2_4_2I2R10Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB2_4_2I2R10Certificates_valid : + CB2_4_2I2R10Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB2_4_2I2R10CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB2_4_2I2R10P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_4_2I2R10Certificates (CB2_4_2I2R10CertificateIndex a)).input +lemma CB2_4_2I2R10P_check : ∀ a : Fin 6, contains (CB2_4_2I2R10Raw a) (CB2_4_2I2R10P a) = true := by + decide +kernel +lemma CB2_4_2I2R10P_sound (a : Fin 6) : + (CB2_4_2I2R10P a).Encloses (CB2_4_2I2R10Value a) := + contains_sound (CB2_4_2I2R10Raw_sound a) (CB2_4_2I2R10P_check a) +def CB2_4_2I2R10Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_4_2I2R10Certificates (CB2_4_2I2R10CertificateIndex a)).output +lemma CB2_4_2I2R10Terms_sound (a : Fin 6) : + (CB2_4_2I2R10Terms a).Encloses (Foundation.entropyTerm (CB2_4_2I2R10Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB2_4_2I2R10Certificates_valid + (CB2_4_2I2R10CertificateIndex a) (CB2_4_2I2R10P_sound a) +def CB2_4_2I2R10Entropy : Ball := ⟨0, 0⟩ +lemma CB2_4_2I2R10Entropy_sound : CB2_4_2I2R10Entropy.Encloses (Foundation.finiteEntropy CB2_4_2I2R10Value) := by + exact contains_sound (entropyFin_enclosed 6 CB2_4_2I2R10Value CB2_4_2I2R10Terms CB2_4_2I2R10Terms_sound) (by decide +kernel) +def CB2_4_2I2R10Mass : Ball := ⟨0, 0⟩ +lemma CB2_4_2I2R10Mass_sound : CB2_4_2I2R10Mass.Encloses (∑ a, CB2_4_2I2R10Value a) := by + exact contains_sound (finSumBall_sound 6 CB2_4_2I2R10P CB2_4_2I2R10Value CB2_4_2I2R10P_sound) (by decide +kernel) +def CB2_4_2I2R10MassTerm : Ball := .exact 0 +lemma CB2_4_2I2R10MassTerm_sound : CB2_4_2I2R10MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB2_4_2I2R10Value a))) := + entropyTerm_zero_ball (CB2_4_2I2R10Mass_sound) +def CB2_4_2I2R10H : Ball := ⟨0, 0⟩ +lemma CB2_4_2I2R10H_sound : CB2_4_2I2R10H.Encloses (homogeneousEntropy CB2_4_2I2R10Value) := by + exact contains_sound (homogeneous_enclosed CB2_4_2I2R10Value CB2_4_2I2R10MassTerm_sound CB2_4_2I2R10Entropy_sound) (by decide +kernel) +def CB2_4_2I2R11Value (a : Fin 6) : ℝ := residualLaw (below (shape 2 4 2)) (fun u => (stageBLaw (shape 2 4 2) u : ℝ)) (stageBPriority (shape 2 4 2)) 2 (fun u a => (littleLaw (shape 2 4 2) u ((stageBPriority (shape 2 4 2)) 2) a : ℝ)) 11 a +def CB2_4_2I2R11Raw (a : Fin 6) : Ball := residualBall (below (shape 2 4 2)) B2_4_2Law (stageBPriority (shape 2 4 2)) 2 (fun u => B2_4_2Little u ((stageBPriority (shape 2 4 2)) 2)) 11 a +lemma CB2_4_2I2R11Raw_sound (a : Fin 6) : + (CB2_4_2I2R11Raw a).Encloses (CB2_4_2I2R11Value a) := by + exact residualBall_sound_on (below (shape 2 4 2)) B2_4_2Law (fun u => (stageBLaw (shape 2 4 2) u : ℝ)) (stageBPriority (shape 2 4 2)) 2 (fun u => B2_4_2Little u ((stageBPriority (shape 2 4 2)) 2)) (fun u a => (littleLaw (shape 2 4 2) u ((stageBPriority (shape 2 4 2)) 2) a : ℝ)) (fun u _ => B2_4_2Law_sound u) (fun u _ a => B2_4_2Little_sound u ((stageBPriority (shape 2 4 2)) 2) a) 11 a +def CB2_4_2I2R11Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB2_4_2I2R11Certificates_valid : + CB2_4_2I2R11Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB2_4_2I2R11CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB2_4_2I2R11P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_4_2I2R11Certificates (CB2_4_2I2R11CertificateIndex a)).input +lemma CB2_4_2I2R11P_check : ∀ a : Fin 6, contains (CB2_4_2I2R11Raw a) (CB2_4_2I2R11P a) = true := by + decide +kernel +lemma CB2_4_2I2R11P_sound (a : Fin 6) : + (CB2_4_2I2R11P a).Encloses (CB2_4_2I2R11Value a) := + contains_sound (CB2_4_2I2R11Raw_sound a) (CB2_4_2I2R11P_check a) +def CB2_4_2I2R11Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_4_2I2R11Certificates (CB2_4_2I2R11CertificateIndex a)).output +lemma CB2_4_2I2R11Terms_sound (a : Fin 6) : + (CB2_4_2I2R11Terms a).Encloses (Foundation.entropyTerm (CB2_4_2I2R11Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB2_4_2I2R11Certificates_valid + (CB2_4_2I2R11CertificateIndex a) (CB2_4_2I2R11P_sound a) +def CB2_4_2I2R11Entropy : Ball := ⟨0, 0⟩ +lemma CB2_4_2I2R11Entropy_sound : CB2_4_2I2R11Entropy.Encloses (Foundation.finiteEntropy CB2_4_2I2R11Value) := by + exact contains_sound (entropyFin_enclosed 6 CB2_4_2I2R11Value CB2_4_2I2R11Terms CB2_4_2I2R11Terms_sound) (by decide +kernel) +def CB2_4_2I2R11Mass : Ball := ⟨0, 0⟩ +lemma CB2_4_2I2R11Mass_sound : CB2_4_2I2R11Mass.Encloses (∑ a, CB2_4_2I2R11Value a) := by + exact contains_sound (finSumBall_sound 6 CB2_4_2I2R11P CB2_4_2I2R11Value CB2_4_2I2R11P_sound) (by decide +kernel) +def CB2_4_2I2R11MassTerm : Ball := .exact 0 +lemma CB2_4_2I2R11MassTerm_sound : CB2_4_2I2R11MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB2_4_2I2R11Value a))) := + entropyTerm_zero_ball (CB2_4_2I2R11Mass_sound) +def CB2_4_2I2R11H : Ball := ⟨0, 0⟩ +lemma CB2_4_2I2R11H_sound : CB2_4_2I2R11H.Encloses (homogeneousEntropy CB2_4_2I2R11Value) := by + exact contains_sound (homogeneous_enclosed CB2_4_2I2R11Value CB2_4_2I2R11MassTerm_sound CB2_4_2I2R11Entropy_sound) (by decide +kernel) +def CB2_4_2I2R12Value (a : Fin 6) : ℝ := residualLaw (below (shape 2 4 2)) (fun u => (stageBLaw (shape 2 4 2) u : ℝ)) (stageBPriority (shape 2 4 2)) 2 (fun u a => (littleLaw (shape 2 4 2) u ((stageBPriority (shape 2 4 2)) 2) a : ℝ)) 12 a +def CB2_4_2I2R12Raw (a : Fin 6) : Ball := residualBall (below (shape 2 4 2)) B2_4_2Law (stageBPriority (shape 2 4 2)) 2 (fun u => B2_4_2Little u ((stageBPriority (shape 2 4 2)) 2)) 12 a +lemma CB2_4_2I2R12Raw_sound (a : Fin 6) : + (CB2_4_2I2R12Raw a).Encloses (CB2_4_2I2R12Value a) := by + exact residualBall_sound_on (below (shape 2 4 2)) B2_4_2Law (fun u => (stageBLaw (shape 2 4 2) u : ℝ)) (stageBPriority (shape 2 4 2)) 2 (fun u => B2_4_2Little u ((stageBPriority (shape 2 4 2)) 2)) (fun u a => (littleLaw (shape 2 4 2) u ((stageBPriority (shape 2 4 2)) 2) a : ℝ)) (fun u _ => B2_4_2Law_sound u) (fun u _ a => B2_4_2Little_sound u ((stageBPriority (shape 2 4 2)) 2) a) 12 a +def CB2_4_2I2R12Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB2_4_2I2R12Certificates_valid : + CB2_4_2I2R12Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB2_4_2I2R12CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB2_4_2I2R12P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_4_2I2R12Certificates (CB2_4_2I2R12CertificateIndex a)).input +lemma CB2_4_2I2R12P_check : ∀ a : Fin 6, contains (CB2_4_2I2R12Raw a) (CB2_4_2I2R12P a) = true := by + decide +kernel +lemma CB2_4_2I2R12P_sound (a : Fin 6) : + (CB2_4_2I2R12P a).Encloses (CB2_4_2I2R12Value a) := + contains_sound (CB2_4_2I2R12Raw_sound a) (CB2_4_2I2R12P_check a) +def CB2_4_2I2R12Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_4_2I2R12Certificates (CB2_4_2I2R12CertificateIndex a)).output +lemma CB2_4_2I2R12Terms_sound (a : Fin 6) : + (CB2_4_2I2R12Terms a).Encloses (Foundation.entropyTerm (CB2_4_2I2R12Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB2_4_2I2R12Certificates_valid + (CB2_4_2I2R12CertificateIndex a) (CB2_4_2I2R12P_sound a) +def CB2_4_2I2R12Entropy : Ball := ⟨0, 0⟩ +lemma CB2_4_2I2R12Entropy_sound : CB2_4_2I2R12Entropy.Encloses (Foundation.finiteEntropy CB2_4_2I2R12Value) := by + exact contains_sound (entropyFin_enclosed 6 CB2_4_2I2R12Value CB2_4_2I2R12Terms CB2_4_2I2R12Terms_sound) (by decide +kernel) +def CB2_4_2I2R12Mass : Ball := ⟨0, 0⟩ +lemma CB2_4_2I2R12Mass_sound : CB2_4_2I2R12Mass.Encloses (∑ a, CB2_4_2I2R12Value a) := by + exact contains_sound (finSumBall_sound 6 CB2_4_2I2R12P CB2_4_2I2R12Value CB2_4_2I2R12P_sound) (by decide +kernel) +def CB2_4_2I2R12MassTerm : Ball := .exact 0 +lemma CB2_4_2I2R12MassTerm_sound : CB2_4_2I2R12MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB2_4_2I2R12Value a))) := + entropyTerm_zero_ball (CB2_4_2I2R12Mass_sound) +def CB2_4_2I2R12H : Ball := ⟨0, 0⟩ +lemma CB2_4_2I2R12H_sound : CB2_4_2I2R12H.Encloses (homogeneousEntropy CB2_4_2I2R12Value) := by + exact contains_sound (homogeneous_enclosed CB2_4_2I2R12Value CB2_4_2I2R12MassTerm_sound CB2_4_2I2R12Entropy_sound) (by decide +kernel) +def CB2_4_2I2R13Value (a : Fin 6) : ℝ := residualLaw (below (shape 2 4 2)) (fun u => (stageBLaw (shape 2 4 2) u : ℝ)) (stageBPriority (shape 2 4 2)) 2 (fun u a => (littleLaw (shape 2 4 2) u ((stageBPriority (shape 2 4 2)) 2) a : ℝ)) 13 a +def CB2_4_2I2R13Raw (a : Fin 6) : Ball := residualBall (below (shape 2 4 2)) B2_4_2Law (stageBPriority (shape 2 4 2)) 2 (fun u => B2_4_2Little u ((stageBPriority (shape 2 4 2)) 2)) 13 a +lemma CB2_4_2I2R13Raw_sound (a : Fin 6) : + (CB2_4_2I2R13Raw a).Encloses (CB2_4_2I2R13Value a) := by + exact residualBall_sound_on (below (shape 2 4 2)) B2_4_2Law (fun u => (stageBLaw (shape 2 4 2) u : ℝ)) (stageBPriority (shape 2 4 2)) 2 (fun u => B2_4_2Little u ((stageBPriority (shape 2 4 2)) 2)) (fun u a => (littleLaw (shape 2 4 2) u ((stageBPriority (shape 2 4 2)) 2) a : ℝ)) (fun u _ => B2_4_2Law_sound u) (fun u _ a => B2_4_2Little_sound u ((stageBPriority (shape 2 4 2)) 2) a) 13 a +def CB2_4_2I2R13Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB2_4_2I2R13Certificates_valid : + CB2_4_2I2R13Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB2_4_2I2R13CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB2_4_2I2R13P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_4_2I2R13Certificates (CB2_4_2I2R13CertificateIndex a)).input +lemma CB2_4_2I2R13P_check : ∀ a : Fin 6, contains (CB2_4_2I2R13Raw a) (CB2_4_2I2R13P a) = true := by + decide +kernel +lemma CB2_4_2I2R13P_sound (a : Fin 6) : + (CB2_4_2I2R13P a).Encloses (CB2_4_2I2R13Value a) := + contains_sound (CB2_4_2I2R13Raw_sound a) (CB2_4_2I2R13P_check a) +def CB2_4_2I2R13Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_4_2I2R13Certificates (CB2_4_2I2R13CertificateIndex a)).output +lemma CB2_4_2I2R13Terms_sound (a : Fin 6) : + (CB2_4_2I2R13Terms a).Encloses (Foundation.entropyTerm (CB2_4_2I2R13Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB2_4_2I2R13Certificates_valid + (CB2_4_2I2R13CertificateIndex a) (CB2_4_2I2R13P_sound a) +def CB2_4_2I2R13Entropy : Ball := ⟨0, 0⟩ +lemma CB2_4_2I2R13Entropy_sound : CB2_4_2I2R13Entropy.Encloses (Foundation.finiteEntropy CB2_4_2I2R13Value) := by + exact contains_sound (entropyFin_enclosed 6 CB2_4_2I2R13Value CB2_4_2I2R13Terms CB2_4_2I2R13Terms_sound) (by decide +kernel) +def CB2_4_2I2R13Mass : Ball := ⟨0, 0⟩ +lemma CB2_4_2I2R13Mass_sound : CB2_4_2I2R13Mass.Encloses (∑ a, CB2_4_2I2R13Value a) := by + exact contains_sound (finSumBall_sound 6 CB2_4_2I2R13P CB2_4_2I2R13Value CB2_4_2I2R13P_sound) (by decide +kernel) +def CB2_4_2I2R13MassTerm : Ball := .exact 0 +lemma CB2_4_2I2R13MassTerm_sound : CB2_4_2I2R13MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB2_4_2I2R13Value a))) := + entropyTerm_zero_ball (CB2_4_2I2R13Mass_sound) +def CB2_4_2I2R13H : Ball := ⟨0, 0⟩ +lemma CB2_4_2I2R13H_sound : CB2_4_2I2R13H.Encloses (homogeneousEntropy CB2_4_2I2R13Value) := by + exact contains_sound (homogeneous_enclosed CB2_4_2I2R13Value CB2_4_2I2R13MassTerm_sound CB2_4_2I2R13Entropy_sound) (by decide +kernel) +def CB2_4_2I2R14Value (a : Fin 6) : ℝ := residualLaw (below (shape 2 4 2)) (fun u => (stageBLaw (shape 2 4 2) u : ℝ)) (stageBPriority (shape 2 4 2)) 2 (fun u a => (littleLaw (shape 2 4 2) u ((stageBPriority (shape 2 4 2)) 2) a : ℝ)) 14 a +def CB2_4_2I2R14Raw (a : Fin 6) : Ball := residualBall (below (shape 2 4 2)) B2_4_2Law (stageBPriority (shape 2 4 2)) 2 (fun u => B2_4_2Little u ((stageBPriority (shape 2 4 2)) 2)) 14 a +lemma CB2_4_2I2R14Raw_sound (a : Fin 6) : + (CB2_4_2I2R14Raw a).Encloses (CB2_4_2I2R14Value a) := by + exact residualBall_sound_on (below (shape 2 4 2)) B2_4_2Law (fun u => (stageBLaw (shape 2 4 2) u : ℝ)) (stageBPriority (shape 2 4 2)) 2 (fun u => B2_4_2Little u ((stageBPriority (shape 2 4 2)) 2)) (fun u a => (littleLaw (shape 2 4 2) u ((stageBPriority (shape 2 4 2)) 2) a : ℝ)) (fun u _ => B2_4_2Law_sound u) (fun u _ a => B2_4_2Little_sound u ((stageBPriority (shape 2 4 2)) 2) a) 14 a +def CB2_4_2I2R14Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB2_4_2I2R14Certificates_valid : + CB2_4_2I2R14Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB2_4_2I2R14CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB2_4_2I2R14P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_4_2I2R14Certificates (CB2_4_2I2R14CertificateIndex a)).input +lemma CB2_4_2I2R14P_check : ∀ a : Fin 6, contains (CB2_4_2I2R14Raw a) (CB2_4_2I2R14P a) = true := by + decide +kernel +lemma CB2_4_2I2R14P_sound (a : Fin 6) : + (CB2_4_2I2R14P a).Encloses (CB2_4_2I2R14Value a) := + contains_sound (CB2_4_2I2R14Raw_sound a) (CB2_4_2I2R14P_check a) +def CB2_4_2I2R14Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_4_2I2R14Certificates (CB2_4_2I2R14CertificateIndex a)).output +lemma CB2_4_2I2R14Terms_sound (a : Fin 6) : + (CB2_4_2I2R14Terms a).Encloses (Foundation.entropyTerm (CB2_4_2I2R14Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB2_4_2I2R14Certificates_valid + (CB2_4_2I2R14CertificateIndex a) (CB2_4_2I2R14P_sound a) +def CB2_4_2I2R14Entropy : Ball := ⟨0, 0⟩ +lemma CB2_4_2I2R14Entropy_sound : CB2_4_2I2R14Entropy.Encloses (Foundation.finiteEntropy CB2_4_2I2R14Value) := by + exact contains_sound (entropyFin_enclosed 6 CB2_4_2I2R14Value CB2_4_2I2R14Terms CB2_4_2I2R14Terms_sound) (by decide +kernel) +def CB2_4_2I2R14Mass : Ball := ⟨0, 0⟩ +lemma CB2_4_2I2R14Mass_sound : CB2_4_2I2R14Mass.Encloses (∑ a, CB2_4_2I2R14Value a) := by + exact contains_sound (finSumBall_sound 6 CB2_4_2I2R14P CB2_4_2I2R14Value CB2_4_2I2R14P_sound) (by decide +kernel) +def CB2_4_2I2R14MassTerm : Ball := .exact 0 +lemma CB2_4_2I2R14MassTerm_sound : CB2_4_2I2R14MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB2_4_2I2R14Value a))) := + entropyTerm_zero_ball (CB2_4_2I2R14Mass_sound) +def CB2_4_2I2R14H : Ball := ⟨0, 0⟩ +lemma CB2_4_2I2R14H_sound : CB2_4_2I2R14H.Encloses (homogeneousEntropy CB2_4_2I2R14Value) := by + exact contains_sound (homogeneous_enclosed CB2_4_2I2R14Value CB2_4_2I2R14MassTerm_sound CB2_4_2I2R14Entropy_sound) (by decide +kernel) +def CB2_4_2I2R15Value (a : Fin 6) : ℝ := residualLaw (below (shape 2 4 2)) (fun u => (stageBLaw (shape 2 4 2) u : ℝ)) (stageBPriority (shape 2 4 2)) 2 (fun u a => (littleLaw (shape 2 4 2) u ((stageBPriority (shape 2 4 2)) 2) a : ℝ)) 15 a +def CB2_4_2I2R15Raw (a : Fin 6) : Ball := residualBall (below (shape 2 4 2)) B2_4_2Law (stageBPriority (shape 2 4 2)) 2 (fun u => B2_4_2Little u ((stageBPriority (shape 2 4 2)) 2)) 15 a +lemma CB2_4_2I2R15Raw_sound (a : Fin 6) : + (CB2_4_2I2R15Raw a).Encloses (CB2_4_2I2R15Value a) := by + exact residualBall_sound_on (below (shape 2 4 2)) B2_4_2Law (fun u => (stageBLaw (shape 2 4 2) u : ℝ)) (stageBPriority (shape 2 4 2)) 2 (fun u => B2_4_2Little u ((stageBPriority (shape 2 4 2)) 2)) (fun u a => (littleLaw (shape 2 4 2) u ((stageBPriority (shape 2 4 2)) 2) a : ℝ)) (fun u _ => B2_4_2Law_sound u) (fun u _ a => B2_4_2Little_sound u ((stageBPriority (shape 2 4 2)) 2) a) 15 a +def CB2_4_2I2R15Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB2_4_2I2R15Certificates_valid : + CB2_4_2I2R15Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB2_4_2I2R15CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB2_4_2I2R15P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_4_2I2R15Certificates (CB2_4_2I2R15CertificateIndex a)).input +lemma CB2_4_2I2R15P_check : ∀ a : Fin 6, contains (CB2_4_2I2R15Raw a) (CB2_4_2I2R15P a) = true := by + decide +kernel +lemma CB2_4_2I2R15P_sound (a : Fin 6) : + (CB2_4_2I2R15P a).Encloses (CB2_4_2I2R15Value a) := + contains_sound (CB2_4_2I2R15Raw_sound a) (CB2_4_2I2R15P_check a) +def CB2_4_2I2R15Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_4_2I2R15Certificates (CB2_4_2I2R15CertificateIndex a)).output +lemma CB2_4_2I2R15Terms_sound (a : Fin 6) : + (CB2_4_2I2R15Terms a).Encloses (Foundation.entropyTerm (CB2_4_2I2R15Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB2_4_2I2R15Certificates_valid + (CB2_4_2I2R15CertificateIndex a) (CB2_4_2I2R15P_sound a) +def CB2_4_2I2R15Entropy : Ball := ⟨0, 0⟩ +lemma CB2_4_2I2R15Entropy_sound : CB2_4_2I2R15Entropy.Encloses (Foundation.finiteEntropy CB2_4_2I2R15Value) := by + exact contains_sound (entropyFin_enclosed 6 CB2_4_2I2R15Value CB2_4_2I2R15Terms CB2_4_2I2R15Terms_sound) (by decide +kernel) +def CB2_4_2I2R15Mass : Ball := ⟨0, 0⟩ +lemma CB2_4_2I2R15Mass_sound : CB2_4_2I2R15Mass.Encloses (∑ a, CB2_4_2I2R15Value a) := by + exact contains_sound (finSumBall_sound 6 CB2_4_2I2R15P CB2_4_2I2R15Value CB2_4_2I2R15P_sound) (by decide +kernel) +def CB2_4_2I2R15MassTerm : Ball := .exact 0 +lemma CB2_4_2I2R15MassTerm_sound : CB2_4_2I2R15MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB2_4_2I2R15Value a))) := + entropyTerm_zero_ball (CB2_4_2I2R15Mass_sound) +def CB2_4_2I2R15H : Ball := ⟨0, 0⟩ +lemma CB2_4_2I2R15H_sound : CB2_4_2I2R15H.Encloses (homogeneousEntropy CB2_4_2I2R15Value) := by + exact contains_sound (homogeneous_enclosed CB2_4_2I2R15Value CB2_4_2I2R15MassTerm_sound CB2_4_2I2R15Entropy_sound) (by decide +kernel) +def CB2_4_2I2R16Value (a : Fin 6) : ℝ := residualLaw (below (shape 2 4 2)) (fun u => (stageBLaw (shape 2 4 2) u : ℝ)) (stageBPriority (shape 2 4 2)) 2 (fun u a => (littleLaw (shape 2 4 2) u ((stageBPriority (shape 2 4 2)) 2) a : ℝ)) 16 a +def CB2_4_2I2R16Raw (a : Fin 6) : Ball := residualBall (below (shape 2 4 2)) B2_4_2Law (stageBPriority (shape 2 4 2)) 2 (fun u => B2_4_2Little u ((stageBPriority (shape 2 4 2)) 2)) 16 a +lemma CB2_4_2I2R16Raw_sound (a : Fin 6) : + (CB2_4_2I2R16Raw a).Encloses (CB2_4_2I2R16Value a) := by + exact residualBall_sound_on (below (shape 2 4 2)) B2_4_2Law (fun u => (stageBLaw (shape 2 4 2) u : ℝ)) (stageBPriority (shape 2 4 2)) 2 (fun u => B2_4_2Little u ((stageBPriority (shape 2 4 2)) 2)) (fun u a => (littleLaw (shape 2 4 2) u ((stageBPriority (shape 2 4 2)) 2) a : ℝ)) (fun u _ => B2_4_2Law_sound u) (fun u _ a => B2_4_2Little_sound u ((stageBPriority (shape 2 4 2)) 2) a) 16 a +def CB2_4_2I2R16Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB2_4_2I2R16Certificates_valid : + CB2_4_2I2R16Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB2_4_2I2R16CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB2_4_2I2R16P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_4_2I2R16Certificates (CB2_4_2I2R16CertificateIndex a)).input +lemma CB2_4_2I2R16P_check : ∀ a : Fin 6, contains (CB2_4_2I2R16Raw a) (CB2_4_2I2R16P a) = true := by + decide +kernel +lemma CB2_4_2I2R16P_sound (a : Fin 6) : + (CB2_4_2I2R16P a).Encloses (CB2_4_2I2R16Value a) := + contains_sound (CB2_4_2I2R16Raw_sound a) (CB2_4_2I2R16P_check a) +def CB2_4_2I2R16Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_4_2I2R16Certificates (CB2_4_2I2R16CertificateIndex a)).output +lemma CB2_4_2I2R16Terms_sound (a : Fin 6) : + (CB2_4_2I2R16Terms a).Encloses (Foundation.entropyTerm (CB2_4_2I2R16Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB2_4_2I2R16Certificates_valid + (CB2_4_2I2R16CertificateIndex a) (CB2_4_2I2R16P_sound a) +def CB2_4_2I2R16Entropy : Ball := ⟨0, 0⟩ +lemma CB2_4_2I2R16Entropy_sound : CB2_4_2I2R16Entropy.Encloses (Foundation.finiteEntropy CB2_4_2I2R16Value) := by + exact contains_sound (entropyFin_enclosed 6 CB2_4_2I2R16Value CB2_4_2I2R16Terms CB2_4_2I2R16Terms_sound) (by decide +kernel) +def CB2_4_2I2R16Mass : Ball := ⟨0, 0⟩ +lemma CB2_4_2I2R16Mass_sound : CB2_4_2I2R16Mass.Encloses (∑ a, CB2_4_2I2R16Value a) := by + exact contains_sound (finSumBall_sound 6 CB2_4_2I2R16P CB2_4_2I2R16Value CB2_4_2I2R16P_sound) (by decide +kernel) +def CB2_4_2I2R16MassTerm : Ball := .exact 0 +lemma CB2_4_2I2R16MassTerm_sound : CB2_4_2I2R16MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB2_4_2I2R16Value a))) := + entropyTerm_zero_ball (CB2_4_2I2R16Mass_sound) +def CB2_4_2I2R16H : Ball := ⟨0, 0⟩ +lemma CB2_4_2I2R16H_sound : CB2_4_2I2R16H.Encloses (homogeneousEntropy CB2_4_2I2R16Value) := by + exact contains_sound (homogeneous_enclosed CB2_4_2I2R16Value CB2_4_2I2R16MassTerm_sound CB2_4_2I2R16Entropy_sound) (by decide +kernel) +def CB2_4_2I2ResidualEntropies (a : Fin 17) : Ball := + match a.val with + | 0 => CB2_4_2I2R0H + | 1 => CB2_4_2I2R1H + | 2 => CB2_4_2I2R2H + | 3 => CB2_4_2I2R3H + | 4 => CB2_4_2I2R4H + | 5 => CB2_4_2I2R5H + | 6 => CB2_4_2I2R6H + | 7 => CB2_4_2I2R7H + | 8 => CB2_4_2I2R8H + | 9 => CB2_4_2I2R9H + | 10 => CB2_4_2I2R10H + | 11 => CB2_4_2I2R11H + | 12 => CB2_4_2I2R12H + | 13 => CB2_4_2I2R13H + | 14 => CB2_4_2I2R14H + | 15 => CB2_4_2I2R15H + | 16 => CB2_4_2I2R16H + | _ => (.exact 0) +lemma CB2_4_2I2ResidualEntropies_sound (k : Fin 17) : + (CB2_4_2I2ResidualEntropies k).Encloses (homogeneousEntropy + (residualLaw (below (shape 2 4 2)) (fun u => (stageBLaw (shape 2 4 2) u : ℝ)) (stageBPriority (shape 2 4 2)) 2 (fun u a => (littleLaw (shape 2 4 2) u ((stageBPriority (shape 2 4 2)) 2) a : ℝ)) k)) := by + fin_cases k + · exact CB2_4_2I2R0H_sound + · exact CB2_4_2I2R1H_sound + · exact CB2_4_2I2R2H_sound + · exact CB2_4_2I2R3H_sound + · exact CB2_4_2I2R4H_sound + · exact CB2_4_2I2R5H_sound + · exact CB2_4_2I2R6H_sound + · exact CB2_4_2I2R7H_sound + · exact CB2_4_2I2R8H_sound + · exact CB2_4_2I2R9H_sound + · exact CB2_4_2I2R10H_sound + · exact CB2_4_2I2R11H_sound + · exact CB2_4_2I2R12H_sound + · exact CB2_4_2I2R13H_sound + · exact CB2_4_2I2R14H_sound + · exact CB2_4_2I2R15H_sound + · exact CB2_4_2I2R16H_sound +def CB2_4_2I2S0_2_2Value (a : Fin 6) : ℝ := (littleLaw (shape 2 4 2) (shape 0 2 2) ((stageBPriority (shape 2 4 2)) 2) a : ℝ) +def CB2_4_2I2S0_2_2E_2LogWitness : LogWitness := ⟨-1, 895207, 500000⟩ +def CB2_4_2I2S0_2_2E_2Log : Ball := ⟨(-22140060506662698219615744903 / 200000000000000000000000000000), (21175823683 / 50000000000000000000000000000000)⟩ +lemma CB2_4_2I2S0_2_2E_2Log_sound : CB2_4_2I2S0_2_2E_2Log.Encloses (Real.log (CB2_4_2I2S0_2_2Value (2 : Fin 6))) := by + exact checkLog_sound logTwoBall_sound ((B2_4_2Little_sound (shape 0 2 2) ((stageBPriority (shape 2 4 2)) 2)) (2 : Fin 6)) (w := CB2_4_2I2S0_2_2E_2LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB2_4_2I2S0_2_2E_2 : Ball := ⟨(990996857299399704254377607369 / 10000000000000000000000000000000), (2369593199 / 6250000000000000000000000000000)⟩ +lemma CB2_4_2I2S0_2_2E_2_sound : CB2_4_2I2S0_2_2E_2.Encloses (Foundation.entropyTerm (CB2_4_2I2S0_2_2Value (2 : Fin 6))) := by + exact contains_sound (entropyTerm_ball ((B2_4_2Little_sound (shape 0 2 2) ((stageBPriority (shape 2 4 2)) 2)) (2 : Fin 6)) CB2_4_2I2S0_2_2E_2Log_sound) (by decide +kernel) +def CB2_4_2I2S0_2_2E_3LogWitness : LogWitness := ⟨-4, 104793, 62500⟩ +def CB2_4_2I2S0_2_2E_3Log : Ball := ⟨(-22557683032191364513180248834139 / 10000000000000000000000000000000), (21175823683 / 20000000000000000000000000000000)⟩ +lemma CB2_4_2I2S0_2_2E_3Log_sound : CB2_4_2I2S0_2_2E_3Log.Encloses (Real.log (CB2_4_2I2S0_2_2Value (3 : Fin 6))) := by + exact checkLog_sound logTwoBall_sound ((B2_4_2Little_sound (shape 0 2 2) ((stageBPriority (shape 2 4 2)) 2)) (3 : Fin 6)) (w := CB2_4_2I2S0_2_2E_3LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB2_4_2I2S0_2_2E_3 : Ball := ⟨(23638872779924296614296978160759 / 100000000000000000000000000000000), (11095390457 / 100000000000000000000000000000000)⟩ +lemma CB2_4_2I2S0_2_2E_3_sound : CB2_4_2I2S0_2_2E_3.Encloses (Foundation.entropyTerm (CB2_4_2I2S0_2_2Value (3 : Fin 6))) := by + exact contains_sound (entropyTerm_ball ((B2_4_2Little_sound (shape 0 2 2) ((stageBPriority (shape 2 4 2)) 2)) (3 : Fin 6)) CB2_4_2I2S0_2_2E_3Log_sound) (by decide +kernel) +def CB2_4_2I2S0_2_2Terms (a : Fin 6) : Ball := + match a.val with + | 2 => ⟨(990996857299399704254377607369 / 10000000000000000000000000000000), (2369593199 / 6250000000000000000000000000000)⟩ + | 3 => ⟨(23638872779924296614296978160759 / 100000000000000000000000000000000), (11095390457 / 100000000000000000000000000000000)⟩ + | _ => (.exact 0) +lemma CB2_4_2I2S0_2_2Terms_sound (a : Fin 6) : + (CB2_4_2I2S0_2_2Terms a).Encloses (Foundation.entropyTerm (CB2_4_2I2S0_2_2Value a)) := by + fin_cases a + · exact (entropyTerm_zero_ball ((B2_4_2Little_sound (shape 0 2 2) ((stageBPriority (shape 2 4 2)) 2)) (0 : Fin 6))) + · exact (entropyTerm_zero_ball ((B2_4_2Little_sound (shape 0 2 2) ((stageBPriority (shape 2 4 2)) 2)) (1 : Fin 6))) + · exact CB2_4_2I2S0_2_2E_2_sound + · exact CB2_4_2I2S0_2_2E_3_sound + · exact (entropyTerm_zero_ball ((B2_4_2Little_sound (shape 0 2 2) ((stageBPriority (shape 2 4 2)) 2)) (4 : Fin 6))) + · exact (entropyTerm_zero_ball ((B2_4_2Little_sound (shape 0 2 2) ((stageBPriority (shape 2 4 2)) 2)) (5 : Fin 6))) +def CB2_4_2I2S0_2_2Entropy : Ball := ⟨(33548841352918293656840754234449 / 100000000000000000000000000000000), (49008881641 / 100000000000000000000000000000000)⟩ +lemma CB2_4_2I2S0_2_2Entropy_sound : CB2_4_2I2S0_2_2Entropy.Encloses (Foundation.finiteEntropy CB2_4_2I2S0_2_2Value) := by + exact contains_sound (entropyFin_enclosed 6 CB2_4_2I2S0_2_2Value CB2_4_2I2S0_2_2Terms CB2_4_2I2S0_2_2Terms_sound) (by decide +kernel) +def CB2_4_2I2S0_2_2Mass : Ball := ⟨1, 0⟩ +lemma CB2_4_2I2S0_2_2Mass_sound : CB2_4_2I2S0_2_2Mass.Encloses (∑ a, CB2_4_2I2S0_2_2Value a) := by + exact contains_sound (finSumBall_sound 6 (B2_4_2Little (shape 0 2 2) ((stageBPriority (shape 2 4 2)) 2)) CB2_4_2I2S0_2_2Value (B2_4_2Little_sound (shape 0 2 2) ((stageBPriority (shape 2 4 2)) 2))) (by decide +kernel) +def CB2_4_2I2S0_2_2MassTermLog : Ball := .exact 0 +lemma CB2_4_2I2S0_2_2MassTermLog_sound : CB2_4_2I2S0_2_2MassTermLog.Encloses (Real.log ((∑ a, CB2_4_2I2S0_2_2Value a))) := by + exact log_exact_one_ball (CB2_4_2I2S0_2_2Mass_sound) +def CB2_4_2I2S0_2_2MassTerm : Ball := ⟨0, 0⟩ +lemma CB2_4_2I2S0_2_2MassTerm_sound : CB2_4_2I2S0_2_2MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB2_4_2I2S0_2_2Value a))) := by + exact contains_sound (entropyTerm_ball (CB2_4_2I2S0_2_2Mass_sound) CB2_4_2I2S0_2_2MassTermLog_sound) (by decide +kernel) +def CB2_4_2I2S0_2_2H : Ball := ⟨(33548841352918293656840754234449 / 100000000000000000000000000000000), (49008881641 / 100000000000000000000000000000000)⟩ +lemma CB2_4_2I2S0_2_2H_sound : CB2_4_2I2S0_2_2H.Encloses (homogeneousEntropy CB2_4_2I2S0_2_2Value) := by + exact contains_sound (homogeneous_enclosed CB2_4_2I2S0_2_2Value CB2_4_2I2S0_2_2MassTerm_sound CB2_4_2I2S0_2_2Entropy_sound) (by decide +kernel) +def CB2_4_2I2S0_3_1Value (a : Fin 6) : ℝ := (littleLaw (shape 2 4 2) (shape 0 3 1) ((stageBPriority (shape 2 4 2)) 2) a : ℝ) +def CB2_4_2I2S0_3_1E_4Log : Ball := .exact 0 +lemma CB2_4_2I2S0_3_1E_4Log_sound : CB2_4_2I2S0_3_1E_4Log.Encloses (Real.log (CB2_4_2I2S0_3_1Value (4 : Fin 6))) := by + exact log_exact_one_ball ((B2_4_2Little_sound (shape 0 3 1) ((stageBPriority (shape 2 4 2)) 2)) (4 : Fin 6)) +def CB2_4_2I2S0_3_1E_4 : Ball := ⟨0, 0⟩ +lemma CB2_4_2I2S0_3_1E_4_sound : CB2_4_2I2S0_3_1E_4.Encloses (Foundation.entropyTerm (CB2_4_2I2S0_3_1Value (4 : Fin 6))) := by + exact contains_sound (entropyTerm_ball ((B2_4_2Little_sound (shape 0 3 1) ((stageBPriority (shape 2 4 2)) 2)) (4 : Fin 6)) CB2_4_2I2S0_3_1E_4Log_sound) (by decide +kernel) +def CB2_4_2I2S0_3_1Terms (a : Fin 6) : Ball := + match a.val with + | 4 => ⟨0, 0⟩ + | _ => (.exact 0) +lemma CB2_4_2I2S0_3_1Terms_sound (a : Fin 6) : + (CB2_4_2I2S0_3_1Terms a).Encloses (Foundation.entropyTerm (CB2_4_2I2S0_3_1Value a)) := by + fin_cases a + · exact (entropyTerm_zero_ball ((B2_4_2Little_sound (shape 0 3 1) ((stageBPriority (shape 2 4 2)) 2)) (0 : Fin 6))) + · exact (entropyTerm_zero_ball ((B2_4_2Little_sound (shape 0 3 1) ((stageBPriority (shape 2 4 2)) 2)) (1 : Fin 6))) + · exact (entropyTerm_zero_ball ((B2_4_2Little_sound (shape 0 3 1) ((stageBPriority (shape 2 4 2)) 2)) (2 : Fin 6))) + · exact (entropyTerm_zero_ball ((B2_4_2Little_sound (shape 0 3 1) ((stageBPriority (shape 2 4 2)) 2)) (3 : Fin 6))) + · exact CB2_4_2I2S0_3_1E_4_sound + · exact (entropyTerm_zero_ball ((B2_4_2Little_sound (shape 0 3 1) ((stageBPriority (shape 2 4 2)) 2)) (5 : Fin 6))) +def CB2_4_2I2S0_3_1Entropy : Ball := ⟨0, 0⟩ +lemma CB2_4_2I2S0_3_1Entropy_sound : CB2_4_2I2S0_3_1Entropy.Encloses (Foundation.finiteEntropy CB2_4_2I2S0_3_1Value) := by + exact contains_sound (entropyFin_enclosed 6 CB2_4_2I2S0_3_1Value CB2_4_2I2S0_3_1Terms CB2_4_2I2S0_3_1Terms_sound) (by decide +kernel) +def CB2_4_2I2S0_3_1Mass : Ball := ⟨1, 0⟩ +lemma CB2_4_2I2S0_3_1Mass_sound : CB2_4_2I2S0_3_1Mass.Encloses (∑ a, CB2_4_2I2S0_3_1Value a) := by + exact contains_sound (finSumBall_sound 6 (B2_4_2Little (shape 0 3 1) ((stageBPriority (shape 2 4 2)) 2)) CB2_4_2I2S0_3_1Value (B2_4_2Little_sound (shape 0 3 1) ((stageBPriority (shape 2 4 2)) 2))) (by decide +kernel) +def CB2_4_2I2S0_3_1MassTermLog : Ball := .exact 0 +lemma CB2_4_2I2S0_3_1MassTermLog_sound : CB2_4_2I2S0_3_1MassTermLog.Encloses (Real.log ((∑ a, CB2_4_2I2S0_3_1Value a))) := by + exact log_exact_one_ball (CB2_4_2I2S0_3_1Mass_sound) +def CB2_4_2I2S0_3_1MassTerm : Ball := ⟨0, 0⟩ +lemma CB2_4_2I2S0_3_1MassTerm_sound : CB2_4_2I2S0_3_1MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB2_4_2I2S0_3_1Value a))) := by + exact contains_sound (entropyTerm_ball (CB2_4_2I2S0_3_1Mass_sound) CB2_4_2I2S0_3_1MassTermLog_sound) (by decide +kernel) +def CB2_4_2I2S0_3_1H : Ball := ⟨0, 0⟩ +lemma CB2_4_2I2S0_3_1H_sound : CB2_4_2I2S0_3_1H.Encloses (homogeneousEntropy CB2_4_2I2S0_3_1Value) := by + exact contains_sound (homogeneous_enclosed CB2_4_2I2S0_3_1Value CB2_4_2I2S0_3_1MassTerm_sound CB2_4_2I2S0_3_1Entropy_sound) (by decide +kernel) +def CB2_4_2I2S0_4_0Value (a : Fin 6) : ℝ := (littleLaw (shape 2 4 2) (shape 0 4 0) ((stageBPriority (shape 2 4 2)) 2) a : ℝ) +def CB2_4_2I2S0_4_0E_5Log : Ball := .exact 0 +lemma CB2_4_2I2S0_4_0E_5Log_sound : CB2_4_2I2S0_4_0E_5Log.Encloses (Real.log (CB2_4_2I2S0_4_0Value (5 : Fin 6))) := by + exact log_exact_one_ball ((B2_4_2Little_sound (shape 0 4 0) ((stageBPriority (shape 2 4 2)) 2)) (5 : Fin 6)) +def CB2_4_2I2S0_4_0E_5 : Ball := ⟨0, 0⟩ +lemma CB2_4_2I2S0_4_0E_5_sound : CB2_4_2I2S0_4_0E_5.Encloses (Foundation.entropyTerm (CB2_4_2I2S0_4_0Value (5 : Fin 6))) := by + exact contains_sound (entropyTerm_ball ((B2_4_2Little_sound (shape 0 4 0) ((stageBPriority (shape 2 4 2)) 2)) (5 : Fin 6)) CB2_4_2I2S0_4_0E_5Log_sound) (by decide +kernel) +def CB2_4_2I2S0_4_0Terms (a : Fin 6) : Ball := + match a.val with + | 5 => ⟨0, 0⟩ + | _ => (.exact 0) +lemma CB2_4_2I2S0_4_0Terms_sound (a : Fin 6) : + (CB2_4_2I2S0_4_0Terms a).Encloses (Foundation.entropyTerm (CB2_4_2I2S0_4_0Value a)) := by + fin_cases a + · exact (entropyTerm_zero_ball ((B2_4_2Little_sound (shape 0 4 0) ((stageBPriority (shape 2 4 2)) 2)) (0 : Fin 6))) + · exact (entropyTerm_zero_ball ((B2_4_2Little_sound (shape 0 4 0) ((stageBPriority (shape 2 4 2)) 2)) (1 : Fin 6))) + · exact (entropyTerm_zero_ball ((B2_4_2Little_sound (shape 0 4 0) ((stageBPriority (shape 2 4 2)) 2)) (2 : Fin 6))) + · exact (entropyTerm_zero_ball ((B2_4_2Little_sound (shape 0 4 0) ((stageBPriority (shape 2 4 2)) 2)) (3 : Fin 6))) + · exact (entropyTerm_zero_ball ((B2_4_2Little_sound (shape 0 4 0) ((stageBPriority (shape 2 4 2)) 2)) (4 : Fin 6))) + · exact CB2_4_2I2S0_4_0E_5_sound +def CB2_4_2I2S0_4_0Entropy : Ball := ⟨0, 0⟩ +lemma CB2_4_2I2S0_4_0Entropy_sound : CB2_4_2I2S0_4_0Entropy.Encloses (Foundation.finiteEntropy CB2_4_2I2S0_4_0Value) := by + exact contains_sound (entropyFin_enclosed 6 CB2_4_2I2S0_4_0Value CB2_4_2I2S0_4_0Terms CB2_4_2I2S0_4_0Terms_sound) (by decide +kernel) +def CB2_4_2I2S0_4_0Mass : Ball := ⟨1, 0⟩ +lemma CB2_4_2I2S0_4_0Mass_sound : CB2_4_2I2S0_4_0Mass.Encloses (∑ a, CB2_4_2I2S0_4_0Value a) := by + exact contains_sound (finSumBall_sound 6 (B2_4_2Little (shape 0 4 0) ((stageBPriority (shape 2 4 2)) 2)) CB2_4_2I2S0_4_0Value (B2_4_2Little_sound (shape 0 4 0) ((stageBPriority (shape 2 4 2)) 2))) (by decide +kernel) +def CB2_4_2I2S0_4_0MassTermLog : Ball := .exact 0 +lemma CB2_4_2I2S0_4_0MassTermLog_sound : CB2_4_2I2S0_4_0MassTermLog.Encloses (Real.log ((∑ a, CB2_4_2I2S0_4_0Value a))) := by + exact log_exact_one_ball (CB2_4_2I2S0_4_0Mass_sound) +def CB2_4_2I2S0_4_0MassTerm : Ball := ⟨0, 0⟩ +lemma CB2_4_2I2S0_4_0MassTerm_sound : CB2_4_2I2S0_4_0MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB2_4_2I2S0_4_0Value a))) := by + exact contains_sound (entropyTerm_ball (CB2_4_2I2S0_4_0Mass_sound) CB2_4_2I2S0_4_0MassTermLog_sound) (by decide +kernel) +def CB2_4_2I2S0_4_0H : Ball := ⟨0, 0⟩ +lemma CB2_4_2I2S0_4_0H_sound : CB2_4_2I2S0_4_0H.Encloses (homogeneousEntropy CB2_4_2I2S0_4_0Value) := by + exact contains_sound (homogeneous_enclosed CB2_4_2I2S0_4_0Value CB2_4_2I2S0_4_0MassTerm_sound CB2_4_2I2S0_4_0Entropy_sound) (by decide +kernel) +def CB2_4_2I2S1_3_0Value (a : Fin 6) : ℝ := (littleLaw (shape 2 4 2) (shape 1 3 0) ((stageBPriority (shape 2 4 2)) 2) a : ℝ) +def CB2_4_2I2S1_3_0E_4Log : Ball := .exact 0 +lemma CB2_4_2I2S1_3_0E_4Log_sound : CB2_4_2I2S1_3_0E_4Log.Encloses (Real.log (CB2_4_2I2S1_3_0Value (4 : Fin 6))) := by + exact log_exact_one_ball ((B2_4_2Little_sound (shape 1 3 0) ((stageBPriority (shape 2 4 2)) 2)) (4 : Fin 6)) +def CB2_4_2I2S1_3_0E_4 : Ball := ⟨0, 0⟩ +lemma CB2_4_2I2S1_3_0E_4_sound : CB2_4_2I2S1_3_0E_4.Encloses (Foundation.entropyTerm (CB2_4_2I2S1_3_0Value (4 : Fin 6))) := by + exact contains_sound (entropyTerm_ball ((B2_4_2Little_sound (shape 1 3 0) ((stageBPriority (shape 2 4 2)) 2)) (4 : Fin 6)) CB2_4_2I2S1_3_0E_4Log_sound) (by decide +kernel) +def CB2_4_2I2S1_3_0Terms (a : Fin 6) : Ball := + match a.val with + | 4 => ⟨0, 0⟩ + | _ => (.exact 0) +lemma CB2_4_2I2S1_3_0Terms_sound (a : Fin 6) : + (CB2_4_2I2S1_3_0Terms a).Encloses (Foundation.entropyTerm (CB2_4_2I2S1_3_0Value a)) := by + fin_cases a + · exact (entropyTerm_zero_ball ((B2_4_2Little_sound (shape 1 3 0) ((stageBPriority (shape 2 4 2)) 2)) (0 : Fin 6))) + · exact (entropyTerm_zero_ball ((B2_4_2Little_sound (shape 1 3 0) ((stageBPriority (shape 2 4 2)) 2)) (1 : Fin 6))) + · exact (entropyTerm_zero_ball ((B2_4_2Little_sound (shape 1 3 0) ((stageBPriority (shape 2 4 2)) 2)) (2 : Fin 6))) + · exact (entropyTerm_zero_ball ((B2_4_2Little_sound (shape 1 3 0) ((stageBPriority (shape 2 4 2)) 2)) (3 : Fin 6))) + · exact CB2_4_2I2S1_3_0E_4_sound + · exact (entropyTerm_zero_ball ((B2_4_2Little_sound (shape 1 3 0) ((stageBPriority (shape 2 4 2)) 2)) (5 : Fin 6))) +def CB2_4_2I2S1_3_0Entropy : Ball := ⟨0, 0⟩ +lemma CB2_4_2I2S1_3_0Entropy_sound : CB2_4_2I2S1_3_0Entropy.Encloses (Foundation.finiteEntropy CB2_4_2I2S1_3_0Value) := by + exact contains_sound (entropyFin_enclosed 6 CB2_4_2I2S1_3_0Value CB2_4_2I2S1_3_0Terms CB2_4_2I2S1_3_0Terms_sound) (by decide +kernel) +def CB2_4_2I2S1_3_0Mass : Ball := ⟨1, 0⟩ +lemma CB2_4_2I2S1_3_0Mass_sound : CB2_4_2I2S1_3_0Mass.Encloses (∑ a, CB2_4_2I2S1_3_0Value a) := by + exact contains_sound (finSumBall_sound 6 (B2_4_2Little (shape 1 3 0) ((stageBPriority (shape 2 4 2)) 2)) CB2_4_2I2S1_3_0Value (B2_4_2Little_sound (shape 1 3 0) ((stageBPriority (shape 2 4 2)) 2))) (by decide +kernel) +def CB2_4_2I2S1_3_0MassTermLog : Ball := .exact 0 +lemma CB2_4_2I2S1_3_0MassTermLog_sound : CB2_4_2I2S1_3_0MassTermLog.Encloses (Real.log ((∑ a, CB2_4_2I2S1_3_0Value a))) := by + exact log_exact_one_ball (CB2_4_2I2S1_3_0Mass_sound) +def CB2_4_2I2S1_3_0MassTerm : Ball := ⟨0, 0⟩ +lemma CB2_4_2I2S1_3_0MassTerm_sound : CB2_4_2I2S1_3_0MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB2_4_2I2S1_3_0Value a))) := by + exact contains_sound (entropyTerm_ball (CB2_4_2I2S1_3_0Mass_sound) CB2_4_2I2S1_3_0MassTermLog_sound) (by decide +kernel) +def CB2_4_2I2S1_3_0H : Ball := ⟨0, 0⟩ +lemma CB2_4_2I2S1_3_0H_sound : CB2_4_2I2S1_3_0H.Encloses (homogeneousEntropy CB2_4_2I2S1_3_0Value) := by + exact contains_sound (homogeneous_enclosed CB2_4_2I2S1_3_0Value CB2_4_2I2S1_3_0MassTerm_sound CB2_4_2I2S1_3_0Entropy_sound) (by decide +kernel) +def CB2_4_2I2S2_2_0Value (a : Fin 6) : ℝ := (littleLaw (shape 2 4 2) (shape 2 2 0) ((stageBPriority (shape 2 4 2)) 2) a : ℝ) +def CB2_4_2I2S2_2_0E_2LogWitness : LogWitness := ⟨-1, 27973, 15625⟩ +def CB2_4_2I2S2_2_0E_2Log : Ball := ⟨(-2769490423601434424009732717579 / 25000000000000000000000000000000), (21175823683 / 50000000000000000000000000000000)⟩ +lemma CB2_4_2I2S2_2_0E_2Log_sound : CB2_4_2I2S2_2_0E_2Log.Encloses (Real.log (CB2_4_2I2S2_2_0Value (2 : Fin 6))) := by + exact checkLog_sound logTwoBall_sound ((B2_4_2Little_sound (shape 2 2 0) ((stageBPriority (shape 2 4 2)) 2)) (2 : Fin 6)) (w := CB2_4_2I2S2_2_0E_2LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB2_4_2I2S2_2_0E_2 : Ball := ⟨(9916282319283574418281504423531 / 100000000000000000000000000000000), (37910484217 / 100000000000000000000000000000000)⟩ +lemma CB2_4_2I2S2_2_0E_2_sound : CB2_4_2I2S2_2_0E_2.Encloses (Foundation.entropyTerm (CB2_4_2I2S2_2_0Value (2 : Fin 6))) := by + exact contains_sound (entropyTerm_ball ((B2_4_2Little_sound (shape 2 2 0) ((stageBPriority (shape 2 4 2)) 2)) (2 : Fin 6)) CB2_4_2I2S2_2_0E_2Log_sound) (by decide +kernel) +def CB2_4_2I2S2_2_0E_3LogWitness : LogWitness := ⟨-4, 26216, 15625⟩ +def CB2_4_2I2S2_2_0E_3Log : Ball := ⟨(-56377275161643324031409595775453 / 25000000000000000000000000000000), (21175823683 / 20000000000000000000000000000000)⟩ +lemma CB2_4_2I2S2_2_0E_3Log_sound : CB2_4_2I2S2_2_0E_3Log.Encloses (Real.log (CB2_4_2I2S2_2_0Value (3 : Fin 6))) := by + exact checkLog_sound logTwoBall_sound ((B2_4_2Little_sound (shape 2 2 0) ((stageBPriority (shape 2 4 2)) 2)) (3 : Fin 6)) (w := CB2_4_2I2S2_2_0E_3LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB2_4_2I2S2_2_0E_3 : Ball := ⟨(5911946582550565531229735851397 / 25000000000000000000000000000000), (5551453937 / 50000000000000000000000000000000)⟩ +lemma CB2_4_2I2S2_2_0E_3_sound : CB2_4_2I2S2_2_0E_3.Encloses (Foundation.entropyTerm (CB2_4_2I2S2_2_0Value (3 : Fin 6))) := by + exact contains_sound (entropyTerm_ball ((B2_4_2Little_sound (shape 2 2 0) ((stageBPriority (shape 2 4 2)) 2)) (3 : Fin 6)) CB2_4_2I2S2_2_0E_3Log_sound) (by decide +kernel) +def CB2_4_2I2S2_2_0Terms (a : Fin 6) : Ball := + match a.val with + | 2 => ⟨(9916282319283574418281504423531 / 100000000000000000000000000000000), (37910484217 / 100000000000000000000000000000000)⟩ + | 3 => ⟨(5911946582550565531229735851397 / 25000000000000000000000000000000), (5551453937 / 50000000000000000000000000000000)⟩ + | _ => (.exact 0) +lemma CB2_4_2I2S2_2_0Terms_sound (a : Fin 6) : + (CB2_4_2I2S2_2_0Terms a).Encloses (Foundation.entropyTerm (CB2_4_2I2S2_2_0Value a)) := by + fin_cases a + · exact (entropyTerm_zero_ball ((B2_4_2Little_sound (shape 2 2 0) ((stageBPriority (shape 2 4 2)) 2)) (0 : Fin 6))) + · exact (entropyTerm_zero_ball ((B2_4_2Little_sound (shape 2 2 0) ((stageBPriority (shape 2 4 2)) 2)) (1 : Fin 6))) + · exact CB2_4_2I2S2_2_0E_2_sound + · exact CB2_4_2I2S2_2_0E_3_sound + · exact (entropyTerm_zero_ball ((B2_4_2Little_sound (shape 2 2 0) ((stageBPriority (shape 2 4 2)) 2)) (4 : Fin 6))) + · exact (entropyTerm_zero_ball ((B2_4_2Little_sound (shape 2 2 0) ((stageBPriority (shape 2 4 2)) 2)) (5 : Fin 6))) +def CB2_4_2I2S2_2_0Entropy : Ball := ⟨(33564068649485836543200447829119 / 100000000000000000000000000000000), (49013392091 / 100000000000000000000000000000000)⟩ +lemma CB2_4_2I2S2_2_0Entropy_sound : CB2_4_2I2S2_2_0Entropy.Encloses (Foundation.finiteEntropy CB2_4_2I2S2_2_0Value) := by + exact contains_sound (entropyFin_enclosed 6 CB2_4_2I2S2_2_0Value CB2_4_2I2S2_2_0Terms CB2_4_2I2S2_2_0Terms_sound) (by decide +kernel) +def CB2_4_2I2S2_2_0Mass : Ball := ⟨1, 0⟩ +lemma CB2_4_2I2S2_2_0Mass_sound : CB2_4_2I2S2_2_0Mass.Encloses (∑ a, CB2_4_2I2S2_2_0Value a) := by + exact contains_sound (finSumBall_sound 6 (B2_4_2Little (shape 2 2 0) ((stageBPriority (shape 2 4 2)) 2)) CB2_4_2I2S2_2_0Value (B2_4_2Little_sound (shape 2 2 0) ((stageBPriority (shape 2 4 2)) 2))) (by decide +kernel) +def CB2_4_2I2S2_2_0MassTermLog : Ball := .exact 0 +lemma CB2_4_2I2S2_2_0MassTermLog_sound : CB2_4_2I2S2_2_0MassTermLog.Encloses (Real.log ((∑ a, CB2_4_2I2S2_2_0Value a))) := by + exact log_exact_one_ball (CB2_4_2I2S2_2_0Mass_sound) +def CB2_4_2I2S2_2_0MassTerm : Ball := ⟨0, 0⟩ +lemma CB2_4_2I2S2_2_0MassTerm_sound : CB2_4_2I2S2_2_0MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB2_4_2I2S2_2_0Value a))) := by + exact contains_sound (entropyTerm_ball (CB2_4_2I2S2_2_0Mass_sound) CB2_4_2I2S2_2_0MassTermLog_sound) (by decide +kernel) +def CB2_4_2I2S2_2_0H : Ball := ⟨(33564068649485836543200447829119 / 100000000000000000000000000000000), (49013392091 / 100000000000000000000000000000000)⟩ +lemma CB2_4_2I2S2_2_0H_sound : CB2_4_2I2S2_2_0H.Encloses (homogeneousEntropy CB2_4_2I2S2_2_0Value) := by + exact contains_sound (homogeneous_enclosed CB2_4_2I2S2_2_0Value CB2_4_2I2S2_2_0MassTerm_sound CB2_4_2I2S2_2_0Entropy_sound) (by decide +kernel) +def CB2_4_2I2Singles (s : Shape) : Ball := + match s 0, s 1, s 2 with + | 0, 2, 2 => CB2_4_2I2S0_2_2H + | 0, 3, 1 => CB2_4_2I2S0_3_1H + | 0, 4, 0 => CB2_4_2I2S0_4_0H + | 1, 3, 0 => CB2_4_2I2S1_3_0H + | 2, 2, 0 => CB2_4_2I2S2_2_0H + | _, _, _ => (.exact 0) +lemma CB2_4_2I2Singles_sound (u : Shape) (hu : u ∈ below (shape 2 4 2)) + (hd : designated (stageBPriority (shape 2 4 2)) 2 u) : + (CB2_4_2I2Singles u).Encloses (homogeneousEntropy ((fun u a => (littleLaw (shape 2 4 2) u ((stageBPriority (shape 2 4 2)) 2) a : ℝ)) u)) := by + rw [B2_4_2_below] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl + · exact CB2_4_2I2S0_2_2H_sound + · exact CB2_4_2I2S0_3_1H_sound + · exact CB2_4_2I2S0_4_0H_sound + · exact (show ¬ designated (stageBPriority (shape 2 4 2)) 2 (shape 1 1 2) by decide +kernel) hd |>.elim + · exact (show ¬ designated (stageBPriority (shape 2 4 2)) 2 (shape 1 2 1) by decide +kernel) hd |>.elim + · exact CB2_4_2I2S1_3_0H_sound + · exact (show ¬ designated (stageBPriority (shape 2 4 2)) 2 (shape 2 0 2) by decide +kernel) hd |>.elim + · exact (show ¬ designated (stageBPriority (shape 2 4 2)) 2 (shape 2 1 1) by decide +kernel) hd |>.elim + · exact CB2_4_2I2S2_2_0H_sound +def CB2_4_2I2Singleton : Ball := ⟨(972498000579950432644105765027 / 10000000000000000000000000000000), (14203893923 / 100000000000000000000000000000000)⟩ +lemma CB2_4_2I2Singleton_sound : CB2_4_2I2Singleton.Encloses + (singletonEntropy (below (shape 2 4 2)) (fun u => (stageBLaw (shape 2 4 2) u : ℝ)) (stageBPriority (shape 2 4 2)) 2 (fun u a => (littleLaw (shape 2 4 2) u ((stageBPriority (shape 2 4 2)) 2) a : ℝ))) := by + exact contains_sound (singletonBall_sound (below (shape 2 4 2)) B2_4_2Law (fun u => (stageBLaw (shape 2 4 2) u : ℝ)) (stageBPriority (shape 2 4 2)) 2 + CB2_4_2I2Singles (fun u a => (littleLaw (shape 2 4 2) u ((stageBPriority (shape 2 4 2)) 2) a : ℝ)) (fun u _ => B2_4_2Law_sound u) CB2_4_2I2Singles_sound) (by decide +kernel) +def CB2_4_2I2Group : Ball := ⟨(13271718009743495987299381294063 / 100000000000000000000000000000000), (39387545053 / 50000000000000000000000000000000)⟩ +lemma CB2_4_2I2Group_sound : CB2_4_2I2Group.Encloses + (groupedEntropy (below (shape 2 4 2)) (fun u => (stageBLaw (shape 2 4 2) u : ℝ)) (stageBPriority (shape 2 4 2)) 2 (fun u a => (littleLaw (shape 2 4 2) u ((stageBPriority (shape 2 4 2)) 2) a : ℝ))) := by + exact contains_sound (Ball.add_sound CB2_4_2I2Singleton_sound + (finSumBall_sound 17 CB2_4_2I2ResidualEntropies _ CB2_4_2I2ResidualEntropies_sound)) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CB2_4_2I2H : Ball := ⟨(14649948736613403867991529612763 / 25000000000000000000000000000000), (118725737019 / 50000000000000000000000000000000)⟩ +lemma CB2_4_2I2_sound : CB2_4_2I2H.Encloses (stageBCapacity (shape 2 4 2) 2) := by + have hb := contains_sound (Ball.add_sound CB2_4_2I2PairH_sound + (Ball.neg_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) CB2_4_2I2Group_sound))) + (show contains (.add CB2_4_2I2PairH (.neg (.mul (.exact 2) CB2_4_2I2Group))) CB2_4_2I2H = true by decide +kernel) + unfold CB2_4_2I2PairValue at hb + simpa only [stageBCapacity, nativeCapacity, + show (2 : Fin 3) ≠ 0 by decide, ite_false, sub_eq_add_neg] using hb + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/CapacityB/CapB2_5_1I0.lean b/lean/OAI/LinearAlgebra/MatrixFields/CapacityB/CapB2_5_1I0.lean new file mode 100644 index 0000000000000000000000000000000000000000..a13c0bdbb1c9cc5afa9f9c96660b67522e3ed11f --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/CapacityB/CapB2_5_1I0.lean @@ -0,0 +1,72 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Certificates.SplitB5_1_2 + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CB2_5_1I0Value (a : Fin 17) : ℝ := marginal (below (shape 2 5 1)) (fun u => (stageBLaw (shape 2 5 1) u : ℝ)) ((stageBPriority (shape 2 5 1)) 0) a +def CB2_5_1I0Raw (a : Fin 17) : Ball := marginalBall (below (shape 2 5 1)) B2_5_1Law ((stageBPriority (shape 2 5 1)) 0) a +lemma CB2_5_1I0Raw_sound (a : Fin 17) : + (CB2_5_1I0Raw a).Encloses (CB2_5_1I0Value a) := by + exact marginalBall_sound (below (shape 2 5 1)) B2_5_1Law (fun u => (stageBLaw (shape 2 5 1) u : ℝ)) (fun u _ => B2_5_1Law_sound u) ((stageBPriority (shape 2 5 1)) 0) a +def CB2_5_1I0Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(1 / 2), (9 / 20000000000000000000000000000000)⟩ ⟨(6931471805599453094172319305033 / 20000000000000000000000000000000), (21175823759 / 100000000000000000000000000000000)⟩ ⟨(-6931471805599453094172319305033 / 10000000000000000000000000000000), (8470329491 / 20000000000000000000000000000000)⟩ ⟨-1, 1, 1⟩] +lemma CB2_5_1I0Certificates_valid : + CB2_5_1I0Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB2_5_1I0CertificateIndex (a : Fin 17) : ℕ := + match a.val with + | 1 => 1 + | 0 => 1 + | _ => 0 +def CB2_5_1I0P (a : Fin 17) : Ball := + (CompactCertificate.entropyLookup CB2_5_1I0Certificates (CB2_5_1I0CertificateIndex a)).input +lemma CB2_5_1I0P_check : ∀ a : Fin 17, contains (CB2_5_1I0Raw a) (CB2_5_1I0P a) = true := by + decide +kernel +lemma CB2_5_1I0P_sound (a : Fin 17) : + (CB2_5_1I0P a).Encloses (CB2_5_1I0Value a) := + contains_sound (CB2_5_1I0Raw_sound a) (CB2_5_1I0P_check a) +def CB2_5_1I0Terms (a : Fin 17) : Ball := + (CompactCertificate.entropyLookup CB2_5_1I0Certificates (CB2_5_1I0CertificateIndex a)).output +lemma CB2_5_1I0Terms_sound (a : Fin 17) : + (CB2_5_1I0Terms a).Encloses (Foundation.entropyTerm (CB2_5_1I0Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB2_5_1I0Certificates_valid + (CB2_5_1I0CertificateIndex a) (CB2_5_1I0P_sound a) +def CB2_5_1I0Entropy : Ball := ⟨(6931471805599453094172319305033 / 10000000000000000000000000000000), (21175823759 / 50000000000000000000000000000000)⟩ +lemma CB2_5_1I0Entropy_sound : CB2_5_1I0Entropy.Encloses (Foundation.finiteEntropy CB2_5_1I0Value) := by + exact contains_sound (entropyFin_enclosed 17 CB2_5_1I0Value CB2_5_1I0Terms CB2_5_1I0Terms_sound) (by decide +kernel) +def CB2_5_1I0Mass : Ball := ⟨1, (9 / 10000000000000000000000000000000)⟩ +lemma CB2_5_1I0Mass_sound : CB2_5_1I0Mass.Encloses (∑ a, CB2_5_1I0Value a) := by + exact contains_sound (finSumBall_sound 17 CB2_5_1I0P CB2_5_1I0Value CB2_5_1I0P_sound) (by decide +kernel) +def CB2_5_1I0MassTermLogWitness : LogWitness := ⟨0, 1, 1⟩ +def CB2_5_1I0MassTermLog : Ball := ⟨0, (5293955943 / 25000000000000000000000000000000)⟩ +lemma CB2_5_1I0MassTermLog_sound : CB2_5_1I0MassTermLog.Encloses (Real.log ((∑ a, CB2_5_1I0Value a))) := by + exact checkLog_sound logTwoBall_sound (CB2_5_1I0Mass_sound) (w := CB2_5_1I0MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB2_5_1I0MassTerm : Ball := ⟨0, (21175823773 / 100000000000000000000000000000000)⟩ +lemma CB2_5_1I0MassTerm_sound : CB2_5_1I0MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB2_5_1I0Value a))) := by + exact contains_sound (entropyTerm_ball (CB2_5_1I0Mass_sound) CB2_5_1I0MassTermLog_sound) (by decide +kernel) +def CB2_5_1I0H : Ball := ⟨(6931471805599453094172319305033 / 10000000000000000000000000000000), (63527471291 / 100000000000000000000000000000000)⟩ +lemma CB2_5_1I0H_sound : CB2_5_1I0H.Encloses (homogeneousEntropy CB2_5_1I0Value) := by + exact contains_sound (homogeneous_enclosed CB2_5_1I0Value CB2_5_1I0MassTerm_sound CB2_5_1I0Entropy_sound) (by decide +kernel) +lemma CB2_5_1I0_sound : CB2_5_1I0H.Encloses (stageBCapacity (shape 2 5 1) 0) := by + exact CB2_5_1I0H_sound + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/CapacityB/CapB2_5_1I1.lean b/lean/OAI/LinearAlgebra/MatrixFields/CapacityB/CapB2_5_1I1.lean new file mode 100644 index 0000000000000000000000000000000000000000..ca0cf2493f122ca02ae559fbf0ecb0deae499c94 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/CapacityB/CapB2_5_1I1.lean @@ -0,0 +1,842 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Certificates.LittleB2_5_1 + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CB2_5_1I1PairValue (a : PairSlot) : ℝ := pairLaw (below (shape 2 5 1)) (shape 2 5 1) (fun u => (stageBLaw (shape 2 5 1) u : ℝ)) (fun u a => (littleLaw (shape 2 5 1) u ((stageBPriority (shape 2 5 1)) 1) a : ℝ)) a +def CB2_5_1I1PairRaw (a : PairSlot) : Ball := pairLawBall (below (shape 2 5 1)) (shape 2 5 1) B2_5_1Law (fun u => B2_5_1Little u ((stageBPriority (shape 2 5 1)) 1)) a +lemma CB2_5_1I1PairRaw_sound (a : PairSlot) : + (CB2_5_1I1PairRaw a).Encloses (CB2_5_1I1PairValue a) := by + exact pairLawBall_sound_on (below (shape 2 5 1)) (shape 2 5 1) B2_5_1Law (fun u => (stageBLaw (shape 2 5 1) u : ℝ)) (fun u => B2_5_1Little u ((stageBPriority (shape 2 5 1)) 1)) (fun u a => (littleLaw (shape 2 5 1) u ((stageBPriority (shape 2 5 1)) 1) a : ℝ)) (fun u _ => B2_5_1Law_sound u) (fun u _ a => B2_5_1Little_sound u ((stageBPriority (shape 2 5 1)) 1) a) (fun u _ a => B2_5_1Little_sound (complement (shape 2 5 1) u) ((stageBPriority (shape 2 5 1)) 1) a) a +def CB2_5_1I1PairCertificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(16500511368438802565759232435939 / 100000000000000000000000000000000), (7 / 25000000000000000000000000000000)⟩ ⟨(14865135898074916085708694355297 / 50000000000000000000000000000000), (1747059607 / 12500000000000000000000000000000)⟩ ⟨(-180177881353520528086384546757553 / 100000000000000000000000000000000), (84703294901 / 100000000000000000000000000000000)⟩ ⟨-3, 16500511368438802565759232435939, 12500000000000000000000000000000⟩, + .log ⟨(993526583999480062128659640117 / 50000000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ ⟨(7786302542390240065562878786429 / 100000000000000000000000000000000), (736356037 / 25000000000000000000000000000000)⟩ ⟨(-391851746485039943169847152612707 / 100000000000000000000000000000000), (74115382991 / 50000000000000000000000000000000)⟩ ⟨-6, 993526583999480062128659640117, 781250000000000000000000000000⟩, + .log ⟨(31512435463562237309983448283827 / 50000000000000000000000000000000), (7 / 25000000000000000000000000000000)⟩ ⟨(5818969873823774875978045709193 / 20000000000000000000000000000000), (26692071129 / 100000000000000000000000000000000)⟩ ⟨(-23082038043966156920661634460399 / 50000000000000000000000000000000), (4235164741 / 10000000000000000000000000000000)⟩ ⟨-1, 31512435463562237309983448283827, 25000000000000000000000000000000⟩] +lemma CB2_5_1I1PairCertificates_valid : + CB2_5_1I1PairCertificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB2_5_1I1PairCertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 0, 2 => 1 + | 0, 3 => 2 + | 1, 1 => 3 + | 2, 0 => 1 + | 3, 0 => 2 + | _, _ => 0 +def CB2_5_1I1PairP (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CB2_5_1I1PairCertificates (CB2_5_1I1PairCertificateIndex a)).input +lemma CB2_5_1I1PairP_check : ∀ a : PairSlot, contains (CB2_5_1I1PairRaw a) (CB2_5_1I1PairP a) = true := by + decide +kernel +lemma CB2_5_1I1PairP_sound (a : PairSlot) : + (CB2_5_1I1PairP a).Encloses (CB2_5_1I1PairValue a) := + contains_sound (CB2_5_1I1PairRaw_sound a) (CB2_5_1I1PairP_check a) +def CB2_5_1I1PairTerms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CB2_5_1I1PairCertificates (CB2_5_1I1PairCertificateIndex a)).output +lemma CB2_5_1I1PairTerms_sound (a : PairSlot) : + (CB2_5_1I1PairTerms a).Encloses (Foundation.entropyTerm (CB2_5_1I1PairValue a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB2_5_1I1PairCertificates_valid + (CB2_5_1I1PairCertificateIndex a) (CB2_5_1I1PairP_sound a) +def CB2_5_1I1PairEntropy : Ball := ⟨(104127998046199018853850763540011 / 100000000000000000000000000000000), (60535873137 / 100000000000000000000000000000000)⟩ +lemma CB2_5_1I1PairEntropy_sound : CB2_5_1I1PairEntropy.Encloses (Foundation.finiteEntropy CB2_5_1I1PairValue) := by + exact contains_sound (entropyPair_enclosed CB2_5_1I1PairValue CB2_5_1I1PairTerms CB2_5_1I1PairTerms_sound) (by decide +kernel) +def CB2_5_1I1PairMass : Ball := ⟨1, (23 / 25000000000000000000000000000000)⟩ +lemma CB2_5_1I1PairMass_sound : CB2_5_1I1PairMass.Encloses (∑ a, CB2_5_1I1PairValue a) := by + exact contains_sound (pairSumBall_sound CB2_5_1I1PairP CB2_5_1I1PairValue CB2_5_1I1PairP_sound) (by decide +kernel) +def CB2_5_1I1PairMassTermLogWitness : LogWitness := ⟨0, 1, 1⟩ +def CB2_5_1I1PairMassTermLog : Ball := ⟨0, (10587911887 / 50000000000000000000000000000000)⟩ +lemma CB2_5_1I1PairMassTermLog_sound : CB2_5_1I1PairMassTermLog.Encloses (Real.log ((∑ a, CB2_5_1I1PairValue a))) := by + exact checkLog_sound logTwoBall_sound (CB2_5_1I1PairMass_sound) (w := CB2_5_1I1PairMassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB2_5_1I1PairMassTerm : Ball := ⟨0, (847032951 / 4000000000000000000000000000000)⟩ +lemma CB2_5_1I1PairMassTerm_sound : CB2_5_1I1PairMassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB2_5_1I1PairValue a))) := by + exact contains_sound (entropyTerm_ball (CB2_5_1I1PairMass_sound) CB2_5_1I1PairMassTermLog_sound) (by decide +kernel) +def CB2_5_1I1PairH : Ball := ⟨(104127998046199018853850763540011 / 100000000000000000000000000000000), (5106981057 / 6250000000000000000000000000000)⟩ +lemma CB2_5_1I1PairH_sound : CB2_5_1I1PairH.Encloses (homogeneousEntropy CB2_5_1I1PairValue) := by + exact contains_sound (homogeneous_enclosed CB2_5_1I1PairValue CB2_5_1I1PairMassTerm_sound CB2_5_1I1PairEntropy_sound) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CB2_5_1I1R0Value (a : Fin 6) : ℝ := residualLaw (below (shape 2 5 1)) (fun u => (stageBLaw (shape 2 5 1) u : ℝ)) (stageBPriority (shape 2 5 1)) 1 (fun u a => (littleLaw (shape 2 5 1) u ((stageBPriority (shape 2 5 1)) 1) a : ℝ)) 0 a +def CB2_5_1I1R0Raw (a : Fin 6) : Ball := residualBall (below (shape 2 5 1)) B2_5_1Law (stageBPriority (shape 2 5 1)) 1 (fun u => B2_5_1Little u ((stageBPriority (shape 2 5 1)) 1)) 0 a +lemma CB2_5_1I1R0Raw_sound (a : Fin 6) : + (CB2_5_1I1R0Raw a).Encloses (CB2_5_1I1R0Value a) := by + exact residualBall_sound_on (below (shape 2 5 1)) B2_5_1Law (fun u => (stageBLaw (shape 2 5 1) u : ℝ)) (stageBPriority (shape 2 5 1)) 1 (fun u => B2_5_1Little u ((stageBPriority (shape 2 5 1)) 1)) (fun u a => (littleLaw (shape 2 5 1) u ((stageBPriority (shape 2 5 1)) 1) a : ℝ)) (fun u _ => B2_5_1Law_sound u) (fun u _ a => B2_5_1Little_sound u ((stageBPriority (shape 2 5 1)) 1) a) 0 a +def CB2_5_1I1R0Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(18487564536437762690016551716173 / 100000000000000000000000000000000), (31 / 100000000000000000000000000000000)⟩ ⟨(15604168792971093202814348314073 / 50000000000000000000000000000000), (7829788181 / 50000000000000000000000000000000)⟩ ⟨(-21100898339281402038513976200687 / 12500000000000000000000000000000), (84703294899 / 100000000000000000000000000000000)⟩ ⟨-3, 18487564536437762690016551716173, 12500000000000000000000000000000⟩] +lemma CB2_5_1I1R0Certificates_valid : + CB2_5_1I1R0Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB2_5_1I1R0CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | 0 => 1 + | _ => 0 +def CB2_5_1I1R0P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_5_1I1R0Certificates (CB2_5_1I1R0CertificateIndex a)).input +lemma CB2_5_1I1R0P_check : ∀ a : Fin 6, contains (CB2_5_1I1R0Raw a) (CB2_5_1I1R0P a) = true := by + decide +kernel +lemma CB2_5_1I1R0P_sound (a : Fin 6) : + (CB2_5_1I1R0P a).Encloses (CB2_5_1I1R0Value a) := + contains_sound (CB2_5_1I1R0Raw_sound a) (CB2_5_1I1R0P_check a) +def CB2_5_1I1R0Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_5_1I1R0Certificates (CB2_5_1I1R0CertificateIndex a)).output +lemma CB2_5_1I1R0Terms_sound (a : Fin 6) : + (CB2_5_1I1R0Terms a).Encloses (Foundation.entropyTerm (CB2_5_1I1R0Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB2_5_1I1R0Certificates_valid + (CB2_5_1I1R0CertificateIndex a) (CB2_5_1I1R0P_sound a) +def CB2_5_1I1R0Entropy : Ball := ⟨(15604168792971093202814348314073 / 50000000000000000000000000000000), (7829788181 / 50000000000000000000000000000000)⟩ +lemma CB2_5_1I1R0Entropy_sound : CB2_5_1I1R0Entropy.Encloses (Foundation.finiteEntropy CB2_5_1I1R0Value) := by + exact contains_sound (entropyFin_enclosed 6 CB2_5_1I1R0Value CB2_5_1I1R0Terms CB2_5_1I1R0Terms_sound) (by decide +kernel) +def CB2_5_1I1R0Mass : Ball := ⟨(18487564536437762690016551716173 / 100000000000000000000000000000000), (31 / 100000000000000000000000000000000)⟩ +lemma CB2_5_1I1R0Mass_sound : CB2_5_1I1R0Mass.Encloses (∑ a, CB2_5_1I1R0Value a) := by + exact contains_sound (finSumBall_sound 6 CB2_5_1I1R0P CB2_5_1I1R0Value CB2_5_1I1R0P_sound) (by decide +kernel) +def CB2_5_1I1R0MassTermLogWitness : LogWitness := ⟨-3, 18487564536437762690016551716173, 12500000000000000000000000000000⟩ +def CB2_5_1I1R0MassTermLog : Ball := ⟨(-21100898339281402038513976200687 / 12500000000000000000000000000000), (84703294899 / 100000000000000000000000000000000)⟩ +lemma CB2_5_1I1R0MassTermLog_sound : CB2_5_1I1R0MassTermLog.Encloses (Real.log ((∑ a, CB2_5_1I1R0Value a))) := by + exact checkLog_sound logTwoBall_sound (CB2_5_1I1R0Mass_sound) (w := CB2_5_1I1R0MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB2_5_1I1R0MassTerm : Ball := ⟨(15604168792971093202814348314073 / 50000000000000000000000000000000), (7829788181 / 50000000000000000000000000000000)⟩ +lemma CB2_5_1I1R0MassTerm_sound : CB2_5_1I1R0MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB2_5_1I1R0Value a))) := by + exact contains_sound (entropyTerm_ball (CB2_5_1I1R0Mass_sound) CB2_5_1I1R0MassTermLog_sound) (by decide +kernel) +def CB2_5_1I1R0H : Ball := ⟨0, (7829788181 / 25000000000000000000000000000000)⟩ +lemma CB2_5_1I1R0H_sound : CB2_5_1I1R0H.Encloses (homogeneousEntropy CB2_5_1I1R0Value) := by + exact contains_sound (homogeneous_enclosed CB2_5_1I1R0Value CB2_5_1I1R0MassTerm_sound CB2_5_1I1R0Entropy_sound) (by decide +kernel) +def CB2_5_1I1R1Value (a : Fin 6) : ℝ := residualLaw (below (shape 2 5 1)) (fun u => (stageBLaw (shape 2 5 1) u : ℝ)) (stageBPriority (shape 2 5 1)) 1 (fun u a => (littleLaw (shape 2 5 1) u ((stageBPriority (shape 2 5 1)) 1) a : ℝ)) 1 a +def CB2_5_1I1R1Raw (a : Fin 6) : Ball := residualBall (below (shape 2 5 1)) B2_5_1Law (stageBPriority (shape 2 5 1)) 1 (fun u => B2_5_1Little u ((stageBPriority (shape 2 5 1)) 1)) 1 a +lemma CB2_5_1I1R1Raw_sound (a : Fin 6) : + (CB2_5_1I1R1Raw a).Encloses (CB2_5_1I1R1Value a) := by + exact residualBall_sound_on (below (shape 2 5 1)) B2_5_1Law (fun u => (stageBLaw (shape 2 5 1) u : ℝ)) (stageBPriority (shape 2 5 1)) 1 (fun u => B2_5_1Little u ((stageBPriority (shape 2 5 1)) 1)) (fun u a => (littleLaw (shape 2 5 1) u ((stageBPriority (shape 2 5 1)) 1) a : ℝ)) (fun u _ => B2_5_1Law_sound u) (fun u _ a => B2_5_1Little_sound u ((stageBPriority (shape 2 5 1)) 1) a) 1 a +def CB2_5_1I1R1Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(31512435463562237309983448283827 / 50000000000000000000000000000000), (7 / 25000000000000000000000000000000)⟩ ⟨(5818969873823774875978045709193 / 20000000000000000000000000000000), (26692071129 / 100000000000000000000000000000000)⟩ ⟨(-23082038043966156920661634460399 / 50000000000000000000000000000000), (4235164741 / 10000000000000000000000000000000)⟩ ⟨-1, 31512435463562237309983448283827, 25000000000000000000000000000000⟩] +lemma CB2_5_1I1R1Certificates_valid : + CB2_5_1I1R1Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB2_5_1I1R1CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | 1 => 1 + | _ => 0 +def CB2_5_1I1R1P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_5_1I1R1Certificates (CB2_5_1I1R1CertificateIndex a)).input +lemma CB2_5_1I1R1P_check : ∀ a : Fin 6, contains (CB2_5_1I1R1Raw a) (CB2_5_1I1R1P a) = true := by + decide +kernel +lemma CB2_5_1I1R1P_sound (a : Fin 6) : + (CB2_5_1I1R1P a).Encloses (CB2_5_1I1R1Value a) := + contains_sound (CB2_5_1I1R1Raw_sound a) (CB2_5_1I1R1P_check a) +def CB2_5_1I1R1Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_5_1I1R1Certificates (CB2_5_1I1R1CertificateIndex a)).output +lemma CB2_5_1I1R1Terms_sound (a : Fin 6) : + (CB2_5_1I1R1Terms a).Encloses (Foundation.entropyTerm (CB2_5_1I1R1Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB2_5_1I1R1Certificates_valid + (CB2_5_1I1R1CertificateIndex a) (CB2_5_1I1R1P_sound a) +def CB2_5_1I1R1Entropy : Ball := ⟨(5818969873823774875978045709193 / 20000000000000000000000000000000), (26692071129 / 100000000000000000000000000000000)⟩ +lemma CB2_5_1I1R1Entropy_sound : CB2_5_1I1R1Entropy.Encloses (Foundation.finiteEntropy CB2_5_1I1R1Value) := by + exact contains_sound (entropyFin_enclosed 6 CB2_5_1I1R1Value CB2_5_1I1R1Terms CB2_5_1I1R1Terms_sound) (by decide +kernel) +def CB2_5_1I1R1Mass : Ball := ⟨(31512435463562237309983448283827 / 50000000000000000000000000000000), (7 / 25000000000000000000000000000000)⟩ +lemma CB2_5_1I1R1Mass_sound : CB2_5_1I1R1Mass.Encloses (∑ a, CB2_5_1I1R1Value a) := by + exact contains_sound (finSumBall_sound 6 CB2_5_1I1R1P CB2_5_1I1R1Value CB2_5_1I1R1P_sound) (by decide +kernel) +def CB2_5_1I1R1MassTermLogWitness : LogWitness := ⟨-1, 31512435463562237309983448283827, 25000000000000000000000000000000⟩ +def CB2_5_1I1R1MassTermLog : Ball := ⟨(-23082038043966156920661634460399 / 50000000000000000000000000000000), (4235164741 / 10000000000000000000000000000000)⟩ +lemma CB2_5_1I1R1MassTermLog_sound : CB2_5_1I1R1MassTermLog.Encloses (Real.log ((∑ a, CB2_5_1I1R1Value a))) := by + exact checkLog_sound logTwoBall_sound (CB2_5_1I1R1Mass_sound) (w := CB2_5_1I1R1MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB2_5_1I1R1MassTerm : Ball := ⟨(5818969873823774875978045709193 / 20000000000000000000000000000000), (26692071129 / 100000000000000000000000000000000)⟩ +lemma CB2_5_1I1R1MassTerm_sound : CB2_5_1I1R1MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB2_5_1I1R1Value a))) := by + exact contains_sound (entropyTerm_ball (CB2_5_1I1R1Mass_sound) CB2_5_1I1R1MassTermLog_sound) (by decide +kernel) +def CB2_5_1I1R1H : Ball := ⟨0, (26692071129 / 50000000000000000000000000000000)⟩ +lemma CB2_5_1I1R1H_sound : CB2_5_1I1R1H.Encloses (homogeneousEntropy CB2_5_1I1R1Value) := by + exact contains_sound (homogeneous_enclosed CB2_5_1I1R1Value CB2_5_1I1R1MassTerm_sound CB2_5_1I1R1Entropy_sound) (by decide +kernel) +def CB2_5_1I1R2Value (a : Fin 6) : ℝ := residualLaw (below (shape 2 5 1)) (fun u => (stageBLaw (shape 2 5 1) u : ℝ)) (stageBPriority (shape 2 5 1)) 1 (fun u a => (littleLaw (shape 2 5 1) u ((stageBPriority (shape 2 5 1)) 1) a : ℝ)) 2 a +def CB2_5_1I1R2Raw (a : Fin 6) : Ball := residualBall (below (shape 2 5 1)) B2_5_1Law (stageBPriority (shape 2 5 1)) 1 (fun u => B2_5_1Little u ((stageBPriority (shape 2 5 1)) 1)) 2 a +lemma CB2_5_1I1R2Raw_sound (a : Fin 6) : + (CB2_5_1I1R2Raw a).Encloses (CB2_5_1I1R2Value a) := by + exact residualBall_sound_on (below (shape 2 5 1)) B2_5_1Law (fun u => (stageBLaw (shape 2 5 1) u : ℝ)) (stageBPriority (shape 2 5 1)) 1 (fun u => B2_5_1Little u ((stageBPriority (shape 2 5 1)) 1)) (fun u a => (littleLaw (shape 2 5 1) u ((stageBPriority (shape 2 5 1)) 1) a : ℝ)) (fun u _ => B2_5_1Law_sound u) (fun u _ a => B2_5_1Little_sound u ((stageBPriority (shape 2 5 1)) 1) a) 2 a +def CB2_5_1I1R2Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(16500511368438802565759232435939 / 100000000000000000000000000000000), (7 / 25000000000000000000000000000000)⟩ ⟨(14865135898074916085708694355297 / 50000000000000000000000000000000), (1747059607 / 12500000000000000000000000000000)⟩ ⟨(-180177881353520528086384546757553 / 100000000000000000000000000000000), (84703294901 / 100000000000000000000000000000000)⟩ ⟨-3, 16500511368438802565759232435939, 12500000000000000000000000000000⟩, + .log ⟨(993526583999480062128659640117 / 50000000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ ⟨(7786302542390240065562878786429 / 100000000000000000000000000000000), (736356037 / 25000000000000000000000000000000)⟩ ⟨(-391851746485039943169847152612707 / 100000000000000000000000000000000), (74115382991 / 50000000000000000000000000000000)⟩ ⟨-6, 993526583999480062128659640117, 781250000000000000000000000000⟩] +lemma CB2_5_1I1R2Certificates_valid : + CB2_5_1I1R2Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB2_5_1I1R2CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | 2 => 1 + | 3 => 2 + | _ => 0 +def CB2_5_1I1R2P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_5_1I1R2Certificates (CB2_5_1I1R2CertificateIndex a)).input +lemma CB2_5_1I1R2P_check : ∀ a : Fin 6, contains (CB2_5_1I1R2Raw a) (CB2_5_1I1R2P a) = true := by + decide +kernel +lemma CB2_5_1I1R2P_sound (a : Fin 6) : + (CB2_5_1I1R2P a).Encloses (CB2_5_1I1R2Value a) := + contains_sound (CB2_5_1I1R2Raw_sound a) (CB2_5_1I1R2P_check a) +def CB2_5_1I1R2Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_5_1I1R2Certificates (CB2_5_1I1R2CertificateIndex a)).output +lemma CB2_5_1I1R2Terms_sound (a : Fin 6) : + (CB2_5_1I1R2Terms a).Encloses (Foundation.entropyTerm (CB2_5_1I1R2Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB2_5_1I1R2Certificates_valid + (CB2_5_1I1R2CertificateIndex a) (CB2_5_1I1R2P_sound a) +def CB2_5_1I1R2Entropy : Ball := ⟨(37516574338540072236980267497023 / 100000000000000000000000000000000), (4230475251 / 25000000000000000000000000000000)⟩ +lemma CB2_5_1I1R2Entropy_sound : CB2_5_1I1R2Entropy.Encloses (Foundation.finiteEntropy CB2_5_1I1R2Value) := by + exact contains_sound (entropyFin_enclosed 6 CB2_5_1I1R2Value CB2_5_1I1R2Terms CB2_5_1I1R2Terms_sound) (by decide +kernel) +def CB2_5_1I1R2Mass : Ball := ⟨(18487564536437762690016551716173 / 100000000000000000000000000000000), (1 / 3125000000000000000000000000000)⟩ +lemma CB2_5_1I1R2Mass_sound : CB2_5_1I1R2Mass.Encloses (∑ a, CB2_5_1I1R2Value a) := by + exact contains_sound (finSumBall_sound 6 CB2_5_1I1R2P CB2_5_1I1R2Value CB2_5_1I1R2P_sound) (by decide +kernel) +def CB2_5_1I1R2MassTermLogWitness : LogWitness := ⟨-3, 18487564536437762690016551716173, 12500000000000000000000000000000⟩ +def CB2_5_1I1R2MassTermLog : Ball := ⟨(-21100898339281402038513976200687 / 12500000000000000000000000000000), (16940658981 / 20000000000000000000000000000000)⟩ +lemma CB2_5_1I1R2MassTermLog_sound : CB2_5_1I1R2MassTermLog.Encloses (Real.log ((∑ a, CB2_5_1I1R2Value a))) := by + exact checkLog_sound logTwoBall_sound (CB2_5_1I1R2Mass_sound) (w := CB2_5_1I1R2MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB2_5_1I1R2MassTerm : Ball := ⟨(15604168792971093202814348314073 / 50000000000000000000000000000000), (3131915273 / 20000000000000000000000000000000)⟩ +lemma CB2_5_1I1R2MassTerm_sound : CB2_5_1I1R2MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB2_5_1I1R2Value a))) := by + exact contains_sound (entropyTerm_ball (CB2_5_1I1R2Mass_sound) CB2_5_1I1R2MassTermLog_sound) (by decide +kernel) +def CB2_5_1I1R2H : Ball := ⟨(6308236752597885831351570868877 / 100000000000000000000000000000000), (32581477369 / 100000000000000000000000000000000)⟩ +lemma CB2_5_1I1R2H_sound : CB2_5_1I1R2H.Encloses (homogeneousEntropy CB2_5_1I1R2Value) := by + exact contains_sound (homogeneous_enclosed CB2_5_1I1R2Value CB2_5_1I1R2MassTerm_sound CB2_5_1I1R2Entropy_sound) (by decide +kernel) +def CB2_5_1I1R3Value (a : Fin 6) : ℝ := residualLaw (below (shape 2 5 1)) (fun u => (stageBLaw (shape 2 5 1) u : ℝ)) (stageBPriority (shape 2 5 1)) 1 (fun u a => (littleLaw (shape 2 5 1) u ((stageBPriority (shape 2 5 1)) 1) a : ℝ)) 3 a +def CB2_5_1I1R3Raw (a : Fin 6) : Ball := residualBall (below (shape 2 5 1)) B2_5_1Law (stageBPriority (shape 2 5 1)) 1 (fun u => B2_5_1Little u ((stageBPriority (shape 2 5 1)) 1)) 3 a +lemma CB2_5_1I1R3Raw_sound (a : Fin 6) : + (CB2_5_1I1R3Raw a).Encloses (CB2_5_1I1R3Value a) := by + exact residualBall_sound_on (below (shape 2 5 1)) B2_5_1Law (fun u => (stageBLaw (shape 2 5 1) u : ℝ)) (stageBPriority (shape 2 5 1)) 1 (fun u => B2_5_1Little u ((stageBPriority (shape 2 5 1)) 1)) (fun u a => (littleLaw (shape 2 5 1) u ((stageBPriority (shape 2 5 1)) 1) a : ℝ)) (fun u _ => B2_5_1Law_sound u) (fun u _ a => B2_5_1Little_sound u ((stageBPriority (shape 2 5 1)) 1) a) 3 a +def CB2_5_1I1R3Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB2_5_1I1R3Certificates_valid : + CB2_5_1I1R3Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB2_5_1I1R3CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB2_5_1I1R3P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_5_1I1R3Certificates (CB2_5_1I1R3CertificateIndex a)).input +lemma CB2_5_1I1R3P_check : ∀ a : Fin 6, contains (CB2_5_1I1R3Raw a) (CB2_5_1I1R3P a) = true := by + decide +kernel +lemma CB2_5_1I1R3P_sound (a : Fin 6) : + (CB2_5_1I1R3P a).Encloses (CB2_5_1I1R3Value a) := + contains_sound (CB2_5_1I1R3Raw_sound a) (CB2_5_1I1R3P_check a) +def CB2_5_1I1R3Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_5_1I1R3Certificates (CB2_5_1I1R3CertificateIndex a)).output +lemma CB2_5_1I1R3Terms_sound (a : Fin 6) : + (CB2_5_1I1R3Terms a).Encloses (Foundation.entropyTerm (CB2_5_1I1R3Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB2_5_1I1R3Certificates_valid + (CB2_5_1I1R3CertificateIndex a) (CB2_5_1I1R3P_sound a) +def CB2_5_1I1R3Entropy : Ball := ⟨0, 0⟩ +lemma CB2_5_1I1R3Entropy_sound : CB2_5_1I1R3Entropy.Encloses (Foundation.finiteEntropy CB2_5_1I1R3Value) := by + exact contains_sound (entropyFin_enclosed 6 CB2_5_1I1R3Value CB2_5_1I1R3Terms CB2_5_1I1R3Terms_sound) (by decide +kernel) +def CB2_5_1I1R3Mass : Ball := ⟨0, 0⟩ +lemma CB2_5_1I1R3Mass_sound : CB2_5_1I1R3Mass.Encloses (∑ a, CB2_5_1I1R3Value a) := by + exact contains_sound (finSumBall_sound 6 CB2_5_1I1R3P CB2_5_1I1R3Value CB2_5_1I1R3P_sound) (by decide +kernel) +def CB2_5_1I1R3MassTerm : Ball := .exact 0 +lemma CB2_5_1I1R3MassTerm_sound : CB2_5_1I1R3MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB2_5_1I1R3Value a))) := + entropyTerm_zero_ball (CB2_5_1I1R3Mass_sound) +def CB2_5_1I1R3H : Ball := ⟨0, 0⟩ +lemma CB2_5_1I1R3H_sound : CB2_5_1I1R3H.Encloses (homogeneousEntropy CB2_5_1I1R3Value) := by + exact contains_sound (homogeneous_enclosed CB2_5_1I1R3Value CB2_5_1I1R3MassTerm_sound CB2_5_1I1R3Entropy_sound) (by decide +kernel) +def CB2_5_1I1R4Value (a : Fin 6) : ℝ := residualLaw (below (shape 2 5 1)) (fun u => (stageBLaw (shape 2 5 1) u : ℝ)) (stageBPriority (shape 2 5 1)) 1 (fun u a => (littleLaw (shape 2 5 1) u ((stageBPriority (shape 2 5 1)) 1) a : ℝ)) 4 a +def CB2_5_1I1R4Raw (a : Fin 6) : Ball := residualBall (below (shape 2 5 1)) B2_5_1Law (stageBPriority (shape 2 5 1)) 1 (fun u => B2_5_1Little u ((stageBPriority (shape 2 5 1)) 1)) 4 a +lemma CB2_5_1I1R4Raw_sound (a : Fin 6) : + (CB2_5_1I1R4Raw a).Encloses (CB2_5_1I1R4Value a) := by + exact residualBall_sound_on (below (shape 2 5 1)) B2_5_1Law (fun u => (stageBLaw (shape 2 5 1) u : ℝ)) (stageBPriority (shape 2 5 1)) 1 (fun u => B2_5_1Little u ((stageBPriority (shape 2 5 1)) 1)) (fun u a => (littleLaw (shape 2 5 1) u ((stageBPriority (shape 2 5 1)) 1) a : ℝ)) (fun u _ => B2_5_1Law_sound u) (fun u _ a => B2_5_1Little_sound u ((stageBPriority (shape 2 5 1)) 1) a) 4 a +def CB2_5_1I1R4Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB2_5_1I1R4Certificates_valid : + CB2_5_1I1R4Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB2_5_1I1R4CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB2_5_1I1R4P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_5_1I1R4Certificates (CB2_5_1I1R4CertificateIndex a)).input +lemma CB2_5_1I1R4P_check : ∀ a : Fin 6, contains (CB2_5_1I1R4Raw a) (CB2_5_1I1R4P a) = true := by + decide +kernel +lemma CB2_5_1I1R4P_sound (a : Fin 6) : + (CB2_5_1I1R4P a).Encloses (CB2_5_1I1R4Value a) := + contains_sound (CB2_5_1I1R4Raw_sound a) (CB2_5_1I1R4P_check a) +def CB2_5_1I1R4Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_5_1I1R4Certificates (CB2_5_1I1R4CertificateIndex a)).output +lemma CB2_5_1I1R4Terms_sound (a : Fin 6) : + (CB2_5_1I1R4Terms a).Encloses (Foundation.entropyTerm (CB2_5_1I1R4Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB2_5_1I1R4Certificates_valid + (CB2_5_1I1R4CertificateIndex a) (CB2_5_1I1R4P_sound a) +def CB2_5_1I1R4Entropy : Ball := ⟨0, 0⟩ +lemma CB2_5_1I1R4Entropy_sound : CB2_5_1I1R4Entropy.Encloses (Foundation.finiteEntropy CB2_5_1I1R4Value) := by + exact contains_sound (entropyFin_enclosed 6 CB2_5_1I1R4Value CB2_5_1I1R4Terms CB2_5_1I1R4Terms_sound) (by decide +kernel) +def CB2_5_1I1R4Mass : Ball := ⟨0, 0⟩ +lemma CB2_5_1I1R4Mass_sound : CB2_5_1I1R4Mass.Encloses (∑ a, CB2_5_1I1R4Value a) := by + exact contains_sound (finSumBall_sound 6 CB2_5_1I1R4P CB2_5_1I1R4Value CB2_5_1I1R4P_sound) (by decide +kernel) +def CB2_5_1I1R4MassTerm : Ball := .exact 0 +lemma CB2_5_1I1R4MassTerm_sound : CB2_5_1I1R4MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB2_5_1I1R4Value a))) := + entropyTerm_zero_ball (CB2_5_1I1R4Mass_sound) +def CB2_5_1I1R4H : Ball := ⟨0, 0⟩ +lemma CB2_5_1I1R4H_sound : CB2_5_1I1R4H.Encloses (homogeneousEntropy CB2_5_1I1R4Value) := by + exact contains_sound (homogeneous_enclosed CB2_5_1I1R4Value CB2_5_1I1R4MassTerm_sound CB2_5_1I1R4Entropy_sound) (by decide +kernel) +def CB2_5_1I1R5Value (a : Fin 6) : ℝ := residualLaw (below (shape 2 5 1)) (fun u => (stageBLaw (shape 2 5 1) u : ℝ)) (stageBPriority (shape 2 5 1)) 1 (fun u a => (littleLaw (shape 2 5 1) u ((stageBPriority (shape 2 5 1)) 1) a : ℝ)) 5 a +def CB2_5_1I1R5Raw (a : Fin 6) : Ball := residualBall (below (shape 2 5 1)) B2_5_1Law (stageBPriority (shape 2 5 1)) 1 (fun u => B2_5_1Little u ((stageBPriority (shape 2 5 1)) 1)) 5 a +lemma CB2_5_1I1R5Raw_sound (a : Fin 6) : + (CB2_5_1I1R5Raw a).Encloses (CB2_5_1I1R5Value a) := by + exact residualBall_sound_on (below (shape 2 5 1)) B2_5_1Law (fun u => (stageBLaw (shape 2 5 1) u : ℝ)) (stageBPriority (shape 2 5 1)) 1 (fun u => B2_5_1Little u ((stageBPriority (shape 2 5 1)) 1)) (fun u a => (littleLaw (shape 2 5 1) u ((stageBPriority (shape 2 5 1)) 1) a : ℝ)) (fun u _ => B2_5_1Law_sound u) (fun u _ a => B2_5_1Little_sound u ((stageBPriority (shape 2 5 1)) 1) a) 5 a +def CB2_5_1I1R5Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB2_5_1I1R5Certificates_valid : + CB2_5_1I1R5Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB2_5_1I1R5CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB2_5_1I1R5P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_5_1I1R5Certificates (CB2_5_1I1R5CertificateIndex a)).input +lemma CB2_5_1I1R5P_check : ∀ a : Fin 6, contains (CB2_5_1I1R5Raw a) (CB2_5_1I1R5P a) = true := by + decide +kernel +lemma CB2_5_1I1R5P_sound (a : Fin 6) : + (CB2_5_1I1R5P a).Encloses (CB2_5_1I1R5Value a) := + contains_sound (CB2_5_1I1R5Raw_sound a) (CB2_5_1I1R5P_check a) +def CB2_5_1I1R5Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_5_1I1R5Certificates (CB2_5_1I1R5CertificateIndex a)).output +lemma CB2_5_1I1R5Terms_sound (a : Fin 6) : + (CB2_5_1I1R5Terms a).Encloses (Foundation.entropyTerm (CB2_5_1I1R5Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB2_5_1I1R5Certificates_valid + (CB2_5_1I1R5CertificateIndex a) (CB2_5_1I1R5P_sound a) +def CB2_5_1I1R5Entropy : Ball := ⟨0, 0⟩ +lemma CB2_5_1I1R5Entropy_sound : CB2_5_1I1R5Entropy.Encloses (Foundation.finiteEntropy CB2_5_1I1R5Value) := by + exact contains_sound (entropyFin_enclosed 6 CB2_5_1I1R5Value CB2_5_1I1R5Terms CB2_5_1I1R5Terms_sound) (by decide +kernel) +def CB2_5_1I1R5Mass : Ball := ⟨0, 0⟩ +lemma CB2_5_1I1R5Mass_sound : CB2_5_1I1R5Mass.Encloses (∑ a, CB2_5_1I1R5Value a) := by + exact contains_sound (finSumBall_sound 6 CB2_5_1I1R5P CB2_5_1I1R5Value CB2_5_1I1R5P_sound) (by decide +kernel) +def CB2_5_1I1R5MassTerm : Ball := .exact 0 +lemma CB2_5_1I1R5MassTerm_sound : CB2_5_1I1R5MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB2_5_1I1R5Value a))) := + entropyTerm_zero_ball (CB2_5_1I1R5Mass_sound) +def CB2_5_1I1R5H : Ball := ⟨0, 0⟩ +lemma CB2_5_1I1R5H_sound : CB2_5_1I1R5H.Encloses (homogeneousEntropy CB2_5_1I1R5Value) := by + exact contains_sound (homogeneous_enclosed CB2_5_1I1R5Value CB2_5_1I1R5MassTerm_sound CB2_5_1I1R5Entropy_sound) (by decide +kernel) +def CB2_5_1I1R6Value (a : Fin 6) : ℝ := residualLaw (below (shape 2 5 1)) (fun u => (stageBLaw (shape 2 5 1) u : ℝ)) (stageBPriority (shape 2 5 1)) 1 (fun u a => (littleLaw (shape 2 5 1) u ((stageBPriority (shape 2 5 1)) 1) a : ℝ)) 6 a +def CB2_5_1I1R6Raw (a : Fin 6) : Ball := residualBall (below (shape 2 5 1)) B2_5_1Law (stageBPriority (shape 2 5 1)) 1 (fun u => B2_5_1Little u ((stageBPriority (shape 2 5 1)) 1)) 6 a +lemma CB2_5_1I1R6Raw_sound (a : Fin 6) : + (CB2_5_1I1R6Raw a).Encloses (CB2_5_1I1R6Value a) := by + exact residualBall_sound_on (below (shape 2 5 1)) B2_5_1Law (fun u => (stageBLaw (shape 2 5 1) u : ℝ)) (stageBPriority (shape 2 5 1)) 1 (fun u => B2_5_1Little u ((stageBPriority (shape 2 5 1)) 1)) (fun u a => (littleLaw (shape 2 5 1) u ((stageBPriority (shape 2 5 1)) 1) a : ℝ)) (fun u _ => B2_5_1Law_sound u) (fun u _ a => B2_5_1Little_sound u ((stageBPriority (shape 2 5 1)) 1) a) 6 a +def CB2_5_1I1R6Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB2_5_1I1R6Certificates_valid : + CB2_5_1I1R6Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB2_5_1I1R6CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB2_5_1I1R6P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_5_1I1R6Certificates (CB2_5_1I1R6CertificateIndex a)).input +lemma CB2_5_1I1R6P_check : ∀ a : Fin 6, contains (CB2_5_1I1R6Raw a) (CB2_5_1I1R6P a) = true := by + decide +kernel +lemma CB2_5_1I1R6P_sound (a : Fin 6) : + (CB2_5_1I1R6P a).Encloses (CB2_5_1I1R6Value a) := + contains_sound (CB2_5_1I1R6Raw_sound a) (CB2_5_1I1R6P_check a) +def CB2_5_1I1R6Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_5_1I1R6Certificates (CB2_5_1I1R6CertificateIndex a)).output +lemma CB2_5_1I1R6Terms_sound (a : Fin 6) : + (CB2_5_1I1R6Terms a).Encloses (Foundation.entropyTerm (CB2_5_1I1R6Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB2_5_1I1R6Certificates_valid + (CB2_5_1I1R6CertificateIndex a) (CB2_5_1I1R6P_sound a) +def CB2_5_1I1R6Entropy : Ball := ⟨0, 0⟩ +lemma CB2_5_1I1R6Entropy_sound : CB2_5_1I1R6Entropy.Encloses (Foundation.finiteEntropy CB2_5_1I1R6Value) := by + exact contains_sound (entropyFin_enclosed 6 CB2_5_1I1R6Value CB2_5_1I1R6Terms CB2_5_1I1R6Terms_sound) (by decide +kernel) +def CB2_5_1I1R6Mass : Ball := ⟨0, 0⟩ +lemma CB2_5_1I1R6Mass_sound : CB2_5_1I1R6Mass.Encloses (∑ a, CB2_5_1I1R6Value a) := by + exact contains_sound (finSumBall_sound 6 CB2_5_1I1R6P CB2_5_1I1R6Value CB2_5_1I1R6P_sound) (by decide +kernel) +def CB2_5_1I1R6MassTerm : Ball := .exact 0 +lemma CB2_5_1I1R6MassTerm_sound : CB2_5_1I1R6MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB2_5_1I1R6Value a))) := + entropyTerm_zero_ball (CB2_5_1I1R6Mass_sound) +def CB2_5_1I1R6H : Ball := ⟨0, 0⟩ +lemma CB2_5_1I1R6H_sound : CB2_5_1I1R6H.Encloses (homogeneousEntropy CB2_5_1I1R6Value) := by + exact contains_sound (homogeneous_enclosed CB2_5_1I1R6Value CB2_5_1I1R6MassTerm_sound CB2_5_1I1R6Entropy_sound) (by decide +kernel) +def CB2_5_1I1R7Value (a : Fin 6) : ℝ := residualLaw (below (shape 2 5 1)) (fun u => (stageBLaw (shape 2 5 1) u : ℝ)) (stageBPriority (shape 2 5 1)) 1 (fun u a => (littleLaw (shape 2 5 1) u ((stageBPriority (shape 2 5 1)) 1) a : ℝ)) 7 a +def CB2_5_1I1R7Raw (a : Fin 6) : Ball := residualBall (below (shape 2 5 1)) B2_5_1Law (stageBPriority (shape 2 5 1)) 1 (fun u => B2_5_1Little u ((stageBPriority (shape 2 5 1)) 1)) 7 a +lemma CB2_5_1I1R7Raw_sound (a : Fin 6) : + (CB2_5_1I1R7Raw a).Encloses (CB2_5_1I1R7Value a) := by + exact residualBall_sound_on (below (shape 2 5 1)) B2_5_1Law (fun u => (stageBLaw (shape 2 5 1) u : ℝ)) (stageBPriority (shape 2 5 1)) 1 (fun u => B2_5_1Little u ((stageBPriority (shape 2 5 1)) 1)) (fun u a => (littleLaw (shape 2 5 1) u ((stageBPriority (shape 2 5 1)) 1) a : ℝ)) (fun u _ => B2_5_1Law_sound u) (fun u _ a => B2_5_1Little_sound u ((stageBPriority (shape 2 5 1)) 1) a) 7 a +def CB2_5_1I1R7Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB2_5_1I1R7Certificates_valid : + CB2_5_1I1R7Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB2_5_1I1R7CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB2_5_1I1R7P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_5_1I1R7Certificates (CB2_5_1I1R7CertificateIndex a)).input +lemma CB2_5_1I1R7P_check : ∀ a : Fin 6, contains (CB2_5_1I1R7Raw a) (CB2_5_1I1R7P a) = true := by + decide +kernel +lemma CB2_5_1I1R7P_sound (a : Fin 6) : + (CB2_5_1I1R7P a).Encloses (CB2_5_1I1R7Value a) := + contains_sound (CB2_5_1I1R7Raw_sound a) (CB2_5_1I1R7P_check a) +def CB2_5_1I1R7Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_5_1I1R7Certificates (CB2_5_1I1R7CertificateIndex a)).output +lemma CB2_5_1I1R7Terms_sound (a : Fin 6) : + (CB2_5_1I1R7Terms a).Encloses (Foundation.entropyTerm (CB2_5_1I1R7Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB2_5_1I1R7Certificates_valid + (CB2_5_1I1R7CertificateIndex a) (CB2_5_1I1R7P_sound a) +def CB2_5_1I1R7Entropy : Ball := ⟨0, 0⟩ +lemma CB2_5_1I1R7Entropy_sound : CB2_5_1I1R7Entropy.Encloses (Foundation.finiteEntropy CB2_5_1I1R7Value) := by + exact contains_sound (entropyFin_enclosed 6 CB2_5_1I1R7Value CB2_5_1I1R7Terms CB2_5_1I1R7Terms_sound) (by decide +kernel) +def CB2_5_1I1R7Mass : Ball := ⟨0, 0⟩ +lemma CB2_5_1I1R7Mass_sound : CB2_5_1I1R7Mass.Encloses (∑ a, CB2_5_1I1R7Value a) := by + exact contains_sound (finSumBall_sound 6 CB2_5_1I1R7P CB2_5_1I1R7Value CB2_5_1I1R7P_sound) (by decide +kernel) +def CB2_5_1I1R7MassTerm : Ball := .exact 0 +lemma CB2_5_1I1R7MassTerm_sound : CB2_5_1I1R7MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB2_5_1I1R7Value a))) := + entropyTerm_zero_ball (CB2_5_1I1R7Mass_sound) +def CB2_5_1I1R7H : Ball := ⟨0, 0⟩ +lemma CB2_5_1I1R7H_sound : CB2_5_1I1R7H.Encloses (homogeneousEntropy CB2_5_1I1R7Value) := by + exact contains_sound (homogeneous_enclosed CB2_5_1I1R7Value CB2_5_1I1R7MassTerm_sound CB2_5_1I1R7Entropy_sound) (by decide +kernel) +def CB2_5_1I1R8Value (a : Fin 6) : ℝ := residualLaw (below (shape 2 5 1)) (fun u => (stageBLaw (shape 2 5 1) u : ℝ)) (stageBPriority (shape 2 5 1)) 1 (fun u a => (littleLaw (shape 2 5 1) u ((stageBPriority (shape 2 5 1)) 1) a : ℝ)) 8 a +def CB2_5_1I1R8Raw (a : Fin 6) : Ball := residualBall (below (shape 2 5 1)) B2_5_1Law (stageBPriority (shape 2 5 1)) 1 (fun u => B2_5_1Little u ((stageBPriority (shape 2 5 1)) 1)) 8 a +lemma CB2_5_1I1R8Raw_sound (a : Fin 6) : + (CB2_5_1I1R8Raw a).Encloses (CB2_5_1I1R8Value a) := by + exact residualBall_sound_on (below (shape 2 5 1)) B2_5_1Law (fun u => (stageBLaw (shape 2 5 1) u : ℝ)) (stageBPriority (shape 2 5 1)) 1 (fun u => B2_5_1Little u ((stageBPriority (shape 2 5 1)) 1)) (fun u a => (littleLaw (shape 2 5 1) u ((stageBPriority (shape 2 5 1)) 1) a : ℝ)) (fun u _ => B2_5_1Law_sound u) (fun u _ a => B2_5_1Little_sound u ((stageBPriority (shape 2 5 1)) 1) a) 8 a +def CB2_5_1I1R8Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB2_5_1I1R8Certificates_valid : + CB2_5_1I1R8Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB2_5_1I1R8CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB2_5_1I1R8P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_5_1I1R8Certificates (CB2_5_1I1R8CertificateIndex a)).input +lemma CB2_5_1I1R8P_check : ∀ a : Fin 6, contains (CB2_5_1I1R8Raw a) (CB2_5_1I1R8P a) = true := by + decide +kernel +lemma CB2_5_1I1R8P_sound (a : Fin 6) : + (CB2_5_1I1R8P a).Encloses (CB2_5_1I1R8Value a) := + contains_sound (CB2_5_1I1R8Raw_sound a) (CB2_5_1I1R8P_check a) +def CB2_5_1I1R8Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_5_1I1R8Certificates (CB2_5_1I1R8CertificateIndex a)).output +lemma CB2_5_1I1R8Terms_sound (a : Fin 6) : + (CB2_5_1I1R8Terms a).Encloses (Foundation.entropyTerm (CB2_5_1I1R8Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB2_5_1I1R8Certificates_valid + (CB2_5_1I1R8CertificateIndex a) (CB2_5_1I1R8P_sound a) +def CB2_5_1I1R8Entropy : Ball := ⟨0, 0⟩ +lemma CB2_5_1I1R8Entropy_sound : CB2_5_1I1R8Entropy.Encloses (Foundation.finiteEntropy CB2_5_1I1R8Value) := by + exact contains_sound (entropyFin_enclosed 6 CB2_5_1I1R8Value CB2_5_1I1R8Terms CB2_5_1I1R8Terms_sound) (by decide +kernel) +def CB2_5_1I1R8Mass : Ball := ⟨0, 0⟩ +lemma CB2_5_1I1R8Mass_sound : CB2_5_1I1R8Mass.Encloses (∑ a, CB2_5_1I1R8Value a) := by + exact contains_sound (finSumBall_sound 6 CB2_5_1I1R8P CB2_5_1I1R8Value CB2_5_1I1R8P_sound) (by decide +kernel) +def CB2_5_1I1R8MassTerm : Ball := .exact 0 +lemma CB2_5_1I1R8MassTerm_sound : CB2_5_1I1R8MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB2_5_1I1R8Value a))) := + entropyTerm_zero_ball (CB2_5_1I1R8Mass_sound) +def CB2_5_1I1R8H : Ball := ⟨0, 0⟩ +lemma CB2_5_1I1R8H_sound : CB2_5_1I1R8H.Encloses (homogeneousEntropy CB2_5_1I1R8Value) := by + exact contains_sound (homogeneous_enclosed CB2_5_1I1R8Value CB2_5_1I1R8MassTerm_sound CB2_5_1I1R8Entropy_sound) (by decide +kernel) +def CB2_5_1I1R9Value (a : Fin 6) : ℝ := residualLaw (below (shape 2 5 1)) (fun u => (stageBLaw (shape 2 5 1) u : ℝ)) (stageBPriority (shape 2 5 1)) 1 (fun u a => (littleLaw (shape 2 5 1) u ((stageBPriority (shape 2 5 1)) 1) a : ℝ)) 9 a +def CB2_5_1I1R9Raw (a : Fin 6) : Ball := residualBall (below (shape 2 5 1)) B2_5_1Law (stageBPriority (shape 2 5 1)) 1 (fun u => B2_5_1Little u ((stageBPriority (shape 2 5 1)) 1)) 9 a +lemma CB2_5_1I1R9Raw_sound (a : Fin 6) : + (CB2_5_1I1R9Raw a).Encloses (CB2_5_1I1R9Value a) := by + exact residualBall_sound_on (below (shape 2 5 1)) B2_5_1Law (fun u => (stageBLaw (shape 2 5 1) u : ℝ)) (stageBPriority (shape 2 5 1)) 1 (fun u => B2_5_1Little u ((stageBPriority (shape 2 5 1)) 1)) (fun u a => (littleLaw (shape 2 5 1) u ((stageBPriority (shape 2 5 1)) 1) a : ℝ)) (fun u _ => B2_5_1Law_sound u) (fun u _ a => B2_5_1Little_sound u ((stageBPriority (shape 2 5 1)) 1) a) 9 a +def CB2_5_1I1R9Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB2_5_1I1R9Certificates_valid : + CB2_5_1I1R9Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB2_5_1I1R9CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB2_5_1I1R9P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_5_1I1R9Certificates (CB2_5_1I1R9CertificateIndex a)).input +lemma CB2_5_1I1R9P_check : ∀ a : Fin 6, contains (CB2_5_1I1R9Raw a) (CB2_5_1I1R9P a) = true := by + decide +kernel +lemma CB2_5_1I1R9P_sound (a : Fin 6) : + (CB2_5_1I1R9P a).Encloses (CB2_5_1I1R9Value a) := + contains_sound (CB2_5_1I1R9Raw_sound a) (CB2_5_1I1R9P_check a) +def CB2_5_1I1R9Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_5_1I1R9Certificates (CB2_5_1I1R9CertificateIndex a)).output +lemma CB2_5_1I1R9Terms_sound (a : Fin 6) : + (CB2_5_1I1R9Terms a).Encloses (Foundation.entropyTerm (CB2_5_1I1R9Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB2_5_1I1R9Certificates_valid + (CB2_5_1I1R9CertificateIndex a) (CB2_5_1I1R9P_sound a) +def CB2_5_1I1R9Entropy : Ball := ⟨0, 0⟩ +lemma CB2_5_1I1R9Entropy_sound : CB2_5_1I1R9Entropy.Encloses (Foundation.finiteEntropy CB2_5_1I1R9Value) := by + exact contains_sound (entropyFin_enclosed 6 CB2_5_1I1R9Value CB2_5_1I1R9Terms CB2_5_1I1R9Terms_sound) (by decide +kernel) +def CB2_5_1I1R9Mass : Ball := ⟨0, 0⟩ +lemma CB2_5_1I1R9Mass_sound : CB2_5_1I1R9Mass.Encloses (∑ a, CB2_5_1I1R9Value a) := by + exact contains_sound (finSumBall_sound 6 CB2_5_1I1R9P CB2_5_1I1R9Value CB2_5_1I1R9P_sound) (by decide +kernel) +def CB2_5_1I1R9MassTerm : Ball := .exact 0 +lemma CB2_5_1I1R9MassTerm_sound : CB2_5_1I1R9MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB2_5_1I1R9Value a))) := + entropyTerm_zero_ball (CB2_5_1I1R9Mass_sound) +def CB2_5_1I1R9H : Ball := ⟨0, 0⟩ +lemma CB2_5_1I1R9H_sound : CB2_5_1I1R9H.Encloses (homogeneousEntropy CB2_5_1I1R9Value) := by + exact contains_sound (homogeneous_enclosed CB2_5_1I1R9Value CB2_5_1I1R9MassTerm_sound CB2_5_1I1R9Entropy_sound) (by decide +kernel) +def CB2_5_1I1R10Value (a : Fin 6) : ℝ := residualLaw (below (shape 2 5 1)) (fun u => (stageBLaw (shape 2 5 1) u : ℝ)) (stageBPriority (shape 2 5 1)) 1 (fun u a => (littleLaw (shape 2 5 1) u ((stageBPriority (shape 2 5 1)) 1) a : ℝ)) 10 a +def CB2_5_1I1R10Raw (a : Fin 6) : Ball := residualBall (below (shape 2 5 1)) B2_5_1Law (stageBPriority (shape 2 5 1)) 1 (fun u => B2_5_1Little u ((stageBPriority (shape 2 5 1)) 1)) 10 a +lemma CB2_5_1I1R10Raw_sound (a : Fin 6) : + (CB2_5_1I1R10Raw a).Encloses (CB2_5_1I1R10Value a) := by + exact residualBall_sound_on (below (shape 2 5 1)) B2_5_1Law (fun u => (stageBLaw (shape 2 5 1) u : ℝ)) (stageBPriority (shape 2 5 1)) 1 (fun u => B2_5_1Little u ((stageBPriority (shape 2 5 1)) 1)) (fun u a => (littleLaw (shape 2 5 1) u ((stageBPriority (shape 2 5 1)) 1) a : ℝ)) (fun u _ => B2_5_1Law_sound u) (fun u _ a => B2_5_1Little_sound u ((stageBPriority (shape 2 5 1)) 1) a) 10 a +def CB2_5_1I1R10Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB2_5_1I1R10Certificates_valid : + CB2_5_1I1R10Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB2_5_1I1R10CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB2_5_1I1R10P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_5_1I1R10Certificates (CB2_5_1I1R10CertificateIndex a)).input +lemma CB2_5_1I1R10P_check : ∀ a : Fin 6, contains (CB2_5_1I1R10Raw a) (CB2_5_1I1R10P a) = true := by + decide +kernel +lemma CB2_5_1I1R10P_sound (a : Fin 6) : + (CB2_5_1I1R10P a).Encloses (CB2_5_1I1R10Value a) := + contains_sound (CB2_5_1I1R10Raw_sound a) (CB2_5_1I1R10P_check a) +def CB2_5_1I1R10Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_5_1I1R10Certificates (CB2_5_1I1R10CertificateIndex a)).output +lemma CB2_5_1I1R10Terms_sound (a : Fin 6) : + (CB2_5_1I1R10Terms a).Encloses (Foundation.entropyTerm (CB2_5_1I1R10Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB2_5_1I1R10Certificates_valid + (CB2_5_1I1R10CertificateIndex a) (CB2_5_1I1R10P_sound a) +def CB2_5_1I1R10Entropy : Ball := ⟨0, 0⟩ +lemma CB2_5_1I1R10Entropy_sound : CB2_5_1I1R10Entropy.Encloses (Foundation.finiteEntropy CB2_5_1I1R10Value) := by + exact contains_sound (entropyFin_enclosed 6 CB2_5_1I1R10Value CB2_5_1I1R10Terms CB2_5_1I1R10Terms_sound) (by decide +kernel) +def CB2_5_1I1R10Mass : Ball := ⟨0, 0⟩ +lemma CB2_5_1I1R10Mass_sound : CB2_5_1I1R10Mass.Encloses (∑ a, CB2_5_1I1R10Value a) := by + exact contains_sound (finSumBall_sound 6 CB2_5_1I1R10P CB2_5_1I1R10Value CB2_5_1I1R10P_sound) (by decide +kernel) +def CB2_5_1I1R10MassTerm : Ball := .exact 0 +lemma CB2_5_1I1R10MassTerm_sound : CB2_5_1I1R10MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB2_5_1I1R10Value a))) := + entropyTerm_zero_ball (CB2_5_1I1R10Mass_sound) +def CB2_5_1I1R10H : Ball := ⟨0, 0⟩ +lemma CB2_5_1I1R10H_sound : CB2_5_1I1R10H.Encloses (homogeneousEntropy CB2_5_1I1R10Value) := by + exact contains_sound (homogeneous_enclosed CB2_5_1I1R10Value CB2_5_1I1R10MassTerm_sound CB2_5_1I1R10Entropy_sound) (by decide +kernel) +def CB2_5_1I1R11Value (a : Fin 6) : ℝ := residualLaw (below (shape 2 5 1)) (fun u => (stageBLaw (shape 2 5 1) u : ℝ)) (stageBPriority (shape 2 5 1)) 1 (fun u a => (littleLaw (shape 2 5 1) u ((stageBPriority (shape 2 5 1)) 1) a : ℝ)) 11 a +def CB2_5_1I1R11Raw (a : Fin 6) : Ball := residualBall (below (shape 2 5 1)) B2_5_1Law (stageBPriority (shape 2 5 1)) 1 (fun u => B2_5_1Little u ((stageBPriority (shape 2 5 1)) 1)) 11 a +lemma CB2_5_1I1R11Raw_sound (a : Fin 6) : + (CB2_5_1I1R11Raw a).Encloses (CB2_5_1I1R11Value a) := by + exact residualBall_sound_on (below (shape 2 5 1)) B2_5_1Law (fun u => (stageBLaw (shape 2 5 1) u : ℝ)) (stageBPriority (shape 2 5 1)) 1 (fun u => B2_5_1Little u ((stageBPriority (shape 2 5 1)) 1)) (fun u a => (littleLaw (shape 2 5 1) u ((stageBPriority (shape 2 5 1)) 1) a : ℝ)) (fun u _ => B2_5_1Law_sound u) (fun u _ a => B2_5_1Little_sound u ((stageBPriority (shape 2 5 1)) 1) a) 11 a +def CB2_5_1I1R11Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB2_5_1I1R11Certificates_valid : + CB2_5_1I1R11Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB2_5_1I1R11CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB2_5_1I1R11P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_5_1I1R11Certificates (CB2_5_1I1R11CertificateIndex a)).input +lemma CB2_5_1I1R11P_check : ∀ a : Fin 6, contains (CB2_5_1I1R11Raw a) (CB2_5_1I1R11P a) = true := by + decide +kernel +lemma CB2_5_1I1R11P_sound (a : Fin 6) : + (CB2_5_1I1R11P a).Encloses (CB2_5_1I1R11Value a) := + contains_sound (CB2_5_1I1R11Raw_sound a) (CB2_5_1I1R11P_check a) +def CB2_5_1I1R11Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_5_1I1R11Certificates (CB2_5_1I1R11CertificateIndex a)).output +lemma CB2_5_1I1R11Terms_sound (a : Fin 6) : + (CB2_5_1I1R11Terms a).Encloses (Foundation.entropyTerm (CB2_5_1I1R11Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB2_5_1I1R11Certificates_valid + (CB2_5_1I1R11CertificateIndex a) (CB2_5_1I1R11P_sound a) +def CB2_5_1I1R11Entropy : Ball := ⟨0, 0⟩ +lemma CB2_5_1I1R11Entropy_sound : CB2_5_1I1R11Entropy.Encloses (Foundation.finiteEntropy CB2_5_1I1R11Value) := by + exact contains_sound (entropyFin_enclosed 6 CB2_5_1I1R11Value CB2_5_1I1R11Terms CB2_5_1I1R11Terms_sound) (by decide +kernel) +def CB2_5_1I1R11Mass : Ball := ⟨0, 0⟩ +lemma CB2_5_1I1R11Mass_sound : CB2_5_1I1R11Mass.Encloses (∑ a, CB2_5_1I1R11Value a) := by + exact contains_sound (finSumBall_sound 6 CB2_5_1I1R11P CB2_5_1I1R11Value CB2_5_1I1R11P_sound) (by decide +kernel) +def CB2_5_1I1R11MassTerm : Ball := .exact 0 +lemma CB2_5_1I1R11MassTerm_sound : CB2_5_1I1R11MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB2_5_1I1R11Value a))) := + entropyTerm_zero_ball (CB2_5_1I1R11Mass_sound) +def CB2_5_1I1R11H : Ball := ⟨0, 0⟩ +lemma CB2_5_1I1R11H_sound : CB2_5_1I1R11H.Encloses (homogeneousEntropy CB2_5_1I1R11Value) := by + exact contains_sound (homogeneous_enclosed CB2_5_1I1R11Value CB2_5_1I1R11MassTerm_sound CB2_5_1I1R11Entropy_sound) (by decide +kernel) +def CB2_5_1I1R12Value (a : Fin 6) : ℝ := residualLaw (below (shape 2 5 1)) (fun u => (stageBLaw (shape 2 5 1) u : ℝ)) (stageBPriority (shape 2 5 1)) 1 (fun u a => (littleLaw (shape 2 5 1) u ((stageBPriority (shape 2 5 1)) 1) a : ℝ)) 12 a +def CB2_5_1I1R12Raw (a : Fin 6) : Ball := residualBall (below (shape 2 5 1)) B2_5_1Law (stageBPriority (shape 2 5 1)) 1 (fun u => B2_5_1Little u ((stageBPriority (shape 2 5 1)) 1)) 12 a +lemma CB2_5_1I1R12Raw_sound (a : Fin 6) : + (CB2_5_1I1R12Raw a).Encloses (CB2_5_1I1R12Value a) := by + exact residualBall_sound_on (below (shape 2 5 1)) B2_5_1Law (fun u => (stageBLaw (shape 2 5 1) u : ℝ)) (stageBPriority (shape 2 5 1)) 1 (fun u => B2_5_1Little u ((stageBPriority (shape 2 5 1)) 1)) (fun u a => (littleLaw (shape 2 5 1) u ((stageBPriority (shape 2 5 1)) 1) a : ℝ)) (fun u _ => B2_5_1Law_sound u) (fun u _ a => B2_5_1Little_sound u ((stageBPriority (shape 2 5 1)) 1) a) 12 a +def CB2_5_1I1R12Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB2_5_1I1R12Certificates_valid : + CB2_5_1I1R12Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB2_5_1I1R12CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB2_5_1I1R12P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_5_1I1R12Certificates (CB2_5_1I1R12CertificateIndex a)).input +lemma CB2_5_1I1R12P_check : ∀ a : Fin 6, contains (CB2_5_1I1R12Raw a) (CB2_5_1I1R12P a) = true := by + decide +kernel +lemma CB2_5_1I1R12P_sound (a : Fin 6) : + (CB2_5_1I1R12P a).Encloses (CB2_5_1I1R12Value a) := + contains_sound (CB2_5_1I1R12Raw_sound a) (CB2_5_1I1R12P_check a) +def CB2_5_1I1R12Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_5_1I1R12Certificates (CB2_5_1I1R12CertificateIndex a)).output +lemma CB2_5_1I1R12Terms_sound (a : Fin 6) : + (CB2_5_1I1R12Terms a).Encloses (Foundation.entropyTerm (CB2_5_1I1R12Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB2_5_1I1R12Certificates_valid + (CB2_5_1I1R12CertificateIndex a) (CB2_5_1I1R12P_sound a) +def CB2_5_1I1R12Entropy : Ball := ⟨0, 0⟩ +lemma CB2_5_1I1R12Entropy_sound : CB2_5_1I1R12Entropy.Encloses (Foundation.finiteEntropy CB2_5_1I1R12Value) := by + exact contains_sound (entropyFin_enclosed 6 CB2_5_1I1R12Value CB2_5_1I1R12Terms CB2_5_1I1R12Terms_sound) (by decide +kernel) +def CB2_5_1I1R12Mass : Ball := ⟨0, 0⟩ +lemma CB2_5_1I1R12Mass_sound : CB2_5_1I1R12Mass.Encloses (∑ a, CB2_5_1I1R12Value a) := by + exact contains_sound (finSumBall_sound 6 CB2_5_1I1R12P CB2_5_1I1R12Value CB2_5_1I1R12P_sound) (by decide +kernel) +def CB2_5_1I1R12MassTerm : Ball := .exact 0 +lemma CB2_5_1I1R12MassTerm_sound : CB2_5_1I1R12MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB2_5_1I1R12Value a))) := + entropyTerm_zero_ball (CB2_5_1I1R12Mass_sound) +def CB2_5_1I1R12H : Ball := ⟨0, 0⟩ +lemma CB2_5_1I1R12H_sound : CB2_5_1I1R12H.Encloses (homogeneousEntropy CB2_5_1I1R12Value) := by + exact contains_sound (homogeneous_enclosed CB2_5_1I1R12Value CB2_5_1I1R12MassTerm_sound CB2_5_1I1R12Entropy_sound) (by decide +kernel) +def CB2_5_1I1R13Value (a : Fin 6) : ℝ := residualLaw (below (shape 2 5 1)) (fun u => (stageBLaw (shape 2 5 1) u : ℝ)) (stageBPriority (shape 2 5 1)) 1 (fun u a => (littleLaw (shape 2 5 1) u ((stageBPriority (shape 2 5 1)) 1) a : ℝ)) 13 a +def CB2_5_1I1R13Raw (a : Fin 6) : Ball := residualBall (below (shape 2 5 1)) B2_5_1Law (stageBPriority (shape 2 5 1)) 1 (fun u => B2_5_1Little u ((stageBPriority (shape 2 5 1)) 1)) 13 a +lemma CB2_5_1I1R13Raw_sound (a : Fin 6) : + (CB2_5_1I1R13Raw a).Encloses (CB2_5_1I1R13Value a) := by + exact residualBall_sound_on (below (shape 2 5 1)) B2_5_1Law (fun u => (stageBLaw (shape 2 5 1) u : ℝ)) (stageBPriority (shape 2 5 1)) 1 (fun u => B2_5_1Little u ((stageBPriority (shape 2 5 1)) 1)) (fun u a => (littleLaw (shape 2 5 1) u ((stageBPriority (shape 2 5 1)) 1) a : ℝ)) (fun u _ => B2_5_1Law_sound u) (fun u _ a => B2_5_1Little_sound u ((stageBPriority (shape 2 5 1)) 1) a) 13 a +def CB2_5_1I1R13Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB2_5_1I1R13Certificates_valid : + CB2_5_1I1R13Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB2_5_1I1R13CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB2_5_1I1R13P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_5_1I1R13Certificates (CB2_5_1I1R13CertificateIndex a)).input +lemma CB2_5_1I1R13P_check : ∀ a : Fin 6, contains (CB2_5_1I1R13Raw a) (CB2_5_1I1R13P a) = true := by + decide +kernel +lemma CB2_5_1I1R13P_sound (a : Fin 6) : + (CB2_5_1I1R13P a).Encloses (CB2_5_1I1R13Value a) := + contains_sound (CB2_5_1I1R13Raw_sound a) (CB2_5_1I1R13P_check a) +def CB2_5_1I1R13Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_5_1I1R13Certificates (CB2_5_1I1R13CertificateIndex a)).output +lemma CB2_5_1I1R13Terms_sound (a : Fin 6) : + (CB2_5_1I1R13Terms a).Encloses (Foundation.entropyTerm (CB2_5_1I1R13Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB2_5_1I1R13Certificates_valid + (CB2_5_1I1R13CertificateIndex a) (CB2_5_1I1R13P_sound a) +def CB2_5_1I1R13Entropy : Ball := ⟨0, 0⟩ +lemma CB2_5_1I1R13Entropy_sound : CB2_5_1I1R13Entropy.Encloses (Foundation.finiteEntropy CB2_5_1I1R13Value) := by + exact contains_sound (entropyFin_enclosed 6 CB2_5_1I1R13Value CB2_5_1I1R13Terms CB2_5_1I1R13Terms_sound) (by decide +kernel) +def CB2_5_1I1R13Mass : Ball := ⟨0, 0⟩ +lemma CB2_5_1I1R13Mass_sound : CB2_5_1I1R13Mass.Encloses (∑ a, CB2_5_1I1R13Value a) := by + exact contains_sound (finSumBall_sound 6 CB2_5_1I1R13P CB2_5_1I1R13Value CB2_5_1I1R13P_sound) (by decide +kernel) +def CB2_5_1I1R13MassTerm : Ball := .exact 0 +lemma CB2_5_1I1R13MassTerm_sound : CB2_5_1I1R13MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB2_5_1I1R13Value a))) := + entropyTerm_zero_ball (CB2_5_1I1R13Mass_sound) +def CB2_5_1I1R13H : Ball := ⟨0, 0⟩ +lemma CB2_5_1I1R13H_sound : CB2_5_1I1R13H.Encloses (homogeneousEntropy CB2_5_1I1R13Value) := by + exact contains_sound (homogeneous_enclosed CB2_5_1I1R13Value CB2_5_1I1R13MassTerm_sound CB2_5_1I1R13Entropy_sound) (by decide +kernel) +def CB2_5_1I1R14Value (a : Fin 6) : ℝ := residualLaw (below (shape 2 5 1)) (fun u => (stageBLaw (shape 2 5 1) u : ℝ)) (stageBPriority (shape 2 5 1)) 1 (fun u a => (littleLaw (shape 2 5 1) u ((stageBPriority (shape 2 5 1)) 1) a : ℝ)) 14 a +def CB2_5_1I1R14Raw (a : Fin 6) : Ball := residualBall (below (shape 2 5 1)) B2_5_1Law (stageBPriority (shape 2 5 1)) 1 (fun u => B2_5_1Little u ((stageBPriority (shape 2 5 1)) 1)) 14 a +lemma CB2_5_1I1R14Raw_sound (a : Fin 6) : + (CB2_5_1I1R14Raw a).Encloses (CB2_5_1I1R14Value a) := by + exact residualBall_sound_on (below (shape 2 5 1)) B2_5_1Law (fun u => (stageBLaw (shape 2 5 1) u : ℝ)) (stageBPriority (shape 2 5 1)) 1 (fun u => B2_5_1Little u ((stageBPriority (shape 2 5 1)) 1)) (fun u a => (littleLaw (shape 2 5 1) u ((stageBPriority (shape 2 5 1)) 1) a : ℝ)) (fun u _ => B2_5_1Law_sound u) (fun u _ a => B2_5_1Little_sound u ((stageBPriority (shape 2 5 1)) 1) a) 14 a +def CB2_5_1I1R14Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB2_5_1I1R14Certificates_valid : + CB2_5_1I1R14Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB2_5_1I1R14CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB2_5_1I1R14P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_5_1I1R14Certificates (CB2_5_1I1R14CertificateIndex a)).input +lemma CB2_5_1I1R14P_check : ∀ a : Fin 6, contains (CB2_5_1I1R14Raw a) (CB2_5_1I1R14P a) = true := by + decide +kernel +lemma CB2_5_1I1R14P_sound (a : Fin 6) : + (CB2_5_1I1R14P a).Encloses (CB2_5_1I1R14Value a) := + contains_sound (CB2_5_1I1R14Raw_sound a) (CB2_5_1I1R14P_check a) +def CB2_5_1I1R14Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_5_1I1R14Certificates (CB2_5_1I1R14CertificateIndex a)).output +lemma CB2_5_1I1R14Terms_sound (a : Fin 6) : + (CB2_5_1I1R14Terms a).Encloses (Foundation.entropyTerm (CB2_5_1I1R14Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB2_5_1I1R14Certificates_valid + (CB2_5_1I1R14CertificateIndex a) (CB2_5_1I1R14P_sound a) +def CB2_5_1I1R14Entropy : Ball := ⟨0, 0⟩ +lemma CB2_5_1I1R14Entropy_sound : CB2_5_1I1R14Entropy.Encloses (Foundation.finiteEntropy CB2_5_1I1R14Value) := by + exact contains_sound (entropyFin_enclosed 6 CB2_5_1I1R14Value CB2_5_1I1R14Terms CB2_5_1I1R14Terms_sound) (by decide +kernel) +def CB2_5_1I1R14Mass : Ball := ⟨0, 0⟩ +lemma CB2_5_1I1R14Mass_sound : CB2_5_1I1R14Mass.Encloses (∑ a, CB2_5_1I1R14Value a) := by + exact contains_sound (finSumBall_sound 6 CB2_5_1I1R14P CB2_5_1I1R14Value CB2_5_1I1R14P_sound) (by decide +kernel) +def CB2_5_1I1R14MassTerm : Ball := .exact 0 +lemma CB2_5_1I1R14MassTerm_sound : CB2_5_1I1R14MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB2_5_1I1R14Value a))) := + entropyTerm_zero_ball (CB2_5_1I1R14Mass_sound) +def CB2_5_1I1R14H : Ball := ⟨0, 0⟩ +lemma CB2_5_1I1R14H_sound : CB2_5_1I1R14H.Encloses (homogeneousEntropy CB2_5_1I1R14Value) := by + exact contains_sound (homogeneous_enclosed CB2_5_1I1R14Value CB2_5_1I1R14MassTerm_sound CB2_5_1I1R14Entropy_sound) (by decide +kernel) +def CB2_5_1I1R15Value (a : Fin 6) : ℝ := residualLaw (below (shape 2 5 1)) (fun u => (stageBLaw (shape 2 5 1) u : ℝ)) (stageBPriority (shape 2 5 1)) 1 (fun u a => (littleLaw (shape 2 5 1) u ((stageBPriority (shape 2 5 1)) 1) a : ℝ)) 15 a +def CB2_5_1I1R15Raw (a : Fin 6) : Ball := residualBall (below (shape 2 5 1)) B2_5_1Law (stageBPriority (shape 2 5 1)) 1 (fun u => B2_5_1Little u ((stageBPriority (shape 2 5 1)) 1)) 15 a +lemma CB2_5_1I1R15Raw_sound (a : Fin 6) : + (CB2_5_1I1R15Raw a).Encloses (CB2_5_1I1R15Value a) := by + exact residualBall_sound_on (below (shape 2 5 1)) B2_5_1Law (fun u => (stageBLaw (shape 2 5 1) u : ℝ)) (stageBPriority (shape 2 5 1)) 1 (fun u => B2_5_1Little u ((stageBPriority (shape 2 5 1)) 1)) (fun u a => (littleLaw (shape 2 5 1) u ((stageBPriority (shape 2 5 1)) 1) a : ℝ)) (fun u _ => B2_5_1Law_sound u) (fun u _ a => B2_5_1Little_sound u ((stageBPriority (shape 2 5 1)) 1) a) 15 a +def CB2_5_1I1R15Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB2_5_1I1R15Certificates_valid : + CB2_5_1I1R15Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB2_5_1I1R15CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB2_5_1I1R15P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_5_1I1R15Certificates (CB2_5_1I1R15CertificateIndex a)).input +lemma CB2_5_1I1R15P_check : ∀ a : Fin 6, contains (CB2_5_1I1R15Raw a) (CB2_5_1I1R15P a) = true := by + decide +kernel +lemma CB2_5_1I1R15P_sound (a : Fin 6) : + (CB2_5_1I1R15P a).Encloses (CB2_5_1I1R15Value a) := + contains_sound (CB2_5_1I1R15Raw_sound a) (CB2_5_1I1R15P_check a) +def CB2_5_1I1R15Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_5_1I1R15Certificates (CB2_5_1I1R15CertificateIndex a)).output +lemma CB2_5_1I1R15Terms_sound (a : Fin 6) : + (CB2_5_1I1R15Terms a).Encloses (Foundation.entropyTerm (CB2_5_1I1R15Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB2_5_1I1R15Certificates_valid + (CB2_5_1I1R15CertificateIndex a) (CB2_5_1I1R15P_sound a) +def CB2_5_1I1R15Entropy : Ball := ⟨0, 0⟩ +lemma CB2_5_1I1R15Entropy_sound : CB2_5_1I1R15Entropy.Encloses (Foundation.finiteEntropy CB2_5_1I1R15Value) := by + exact contains_sound (entropyFin_enclosed 6 CB2_5_1I1R15Value CB2_5_1I1R15Terms CB2_5_1I1R15Terms_sound) (by decide +kernel) +def CB2_5_1I1R15Mass : Ball := ⟨0, 0⟩ +lemma CB2_5_1I1R15Mass_sound : CB2_5_1I1R15Mass.Encloses (∑ a, CB2_5_1I1R15Value a) := by + exact contains_sound (finSumBall_sound 6 CB2_5_1I1R15P CB2_5_1I1R15Value CB2_5_1I1R15P_sound) (by decide +kernel) +def CB2_5_1I1R15MassTerm : Ball := .exact 0 +lemma CB2_5_1I1R15MassTerm_sound : CB2_5_1I1R15MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB2_5_1I1R15Value a))) := + entropyTerm_zero_ball (CB2_5_1I1R15Mass_sound) +def CB2_5_1I1R15H : Ball := ⟨0, 0⟩ +lemma CB2_5_1I1R15H_sound : CB2_5_1I1R15H.Encloses (homogeneousEntropy CB2_5_1I1R15Value) := by + exact contains_sound (homogeneous_enclosed CB2_5_1I1R15Value CB2_5_1I1R15MassTerm_sound CB2_5_1I1R15Entropy_sound) (by decide +kernel) +def CB2_5_1I1R16Value (a : Fin 6) : ℝ := residualLaw (below (shape 2 5 1)) (fun u => (stageBLaw (shape 2 5 1) u : ℝ)) (stageBPriority (shape 2 5 1)) 1 (fun u a => (littleLaw (shape 2 5 1) u ((stageBPriority (shape 2 5 1)) 1) a : ℝ)) 16 a +def CB2_5_1I1R16Raw (a : Fin 6) : Ball := residualBall (below (shape 2 5 1)) B2_5_1Law (stageBPriority (shape 2 5 1)) 1 (fun u => B2_5_1Little u ((stageBPriority (shape 2 5 1)) 1)) 16 a +lemma CB2_5_1I1R16Raw_sound (a : Fin 6) : + (CB2_5_1I1R16Raw a).Encloses (CB2_5_1I1R16Value a) := by + exact residualBall_sound_on (below (shape 2 5 1)) B2_5_1Law (fun u => (stageBLaw (shape 2 5 1) u : ℝ)) (stageBPriority (shape 2 5 1)) 1 (fun u => B2_5_1Little u ((stageBPriority (shape 2 5 1)) 1)) (fun u a => (littleLaw (shape 2 5 1) u ((stageBPriority (shape 2 5 1)) 1) a : ℝ)) (fun u _ => B2_5_1Law_sound u) (fun u _ a => B2_5_1Little_sound u ((stageBPriority (shape 2 5 1)) 1) a) 16 a +def CB2_5_1I1R16Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB2_5_1I1R16Certificates_valid : + CB2_5_1I1R16Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB2_5_1I1R16CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB2_5_1I1R16P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_5_1I1R16Certificates (CB2_5_1I1R16CertificateIndex a)).input +lemma CB2_5_1I1R16P_check : ∀ a : Fin 6, contains (CB2_5_1I1R16Raw a) (CB2_5_1I1R16P a) = true := by + decide +kernel +lemma CB2_5_1I1R16P_sound (a : Fin 6) : + (CB2_5_1I1R16P a).Encloses (CB2_5_1I1R16Value a) := + contains_sound (CB2_5_1I1R16Raw_sound a) (CB2_5_1I1R16P_check a) +def CB2_5_1I1R16Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_5_1I1R16Certificates (CB2_5_1I1R16CertificateIndex a)).output +lemma CB2_5_1I1R16Terms_sound (a : Fin 6) : + (CB2_5_1I1R16Terms a).Encloses (Foundation.entropyTerm (CB2_5_1I1R16Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB2_5_1I1R16Certificates_valid + (CB2_5_1I1R16CertificateIndex a) (CB2_5_1I1R16P_sound a) +def CB2_5_1I1R16Entropy : Ball := ⟨0, 0⟩ +lemma CB2_5_1I1R16Entropy_sound : CB2_5_1I1R16Entropy.Encloses (Foundation.finiteEntropy CB2_5_1I1R16Value) := by + exact contains_sound (entropyFin_enclosed 6 CB2_5_1I1R16Value CB2_5_1I1R16Terms CB2_5_1I1R16Terms_sound) (by decide +kernel) +def CB2_5_1I1R16Mass : Ball := ⟨0, 0⟩ +lemma CB2_5_1I1R16Mass_sound : CB2_5_1I1R16Mass.Encloses (∑ a, CB2_5_1I1R16Value a) := by + exact contains_sound (finSumBall_sound 6 CB2_5_1I1R16P CB2_5_1I1R16Value CB2_5_1I1R16P_sound) (by decide +kernel) +def CB2_5_1I1R16MassTerm : Ball := .exact 0 +lemma CB2_5_1I1R16MassTerm_sound : CB2_5_1I1R16MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB2_5_1I1R16Value a))) := + entropyTerm_zero_ball (CB2_5_1I1R16Mass_sound) +def CB2_5_1I1R16H : Ball := ⟨0, 0⟩ +lemma CB2_5_1I1R16H_sound : CB2_5_1I1R16H.Encloses (homogeneousEntropy CB2_5_1I1R16Value) := by + exact contains_sound (homogeneous_enclosed CB2_5_1I1R16Value CB2_5_1I1R16MassTerm_sound CB2_5_1I1R16Entropy_sound) (by decide +kernel) +def CB2_5_1I1ResidualEntropies (a : Fin 17) : Ball := + match a.val with + | 0 => CB2_5_1I1R0H + | 1 => CB2_5_1I1R1H + | 2 => CB2_5_1I1R2H + | 3 => CB2_5_1I1R3H + | 4 => CB2_5_1I1R4H + | 5 => CB2_5_1I1R5H + | 6 => CB2_5_1I1R6H + | 7 => CB2_5_1I1R7H + | 8 => CB2_5_1I1R8H + | 9 => CB2_5_1I1R9H + | 10 => CB2_5_1I1R10H + | 11 => CB2_5_1I1R11H + | 12 => CB2_5_1I1R12H + | 13 => CB2_5_1I1R13H + | 14 => CB2_5_1I1R14H + | 15 => CB2_5_1I1R15H + | 16 => CB2_5_1I1R16H + | _ => (.exact 0) +lemma CB2_5_1I1ResidualEntropies_sound (k : Fin 17) : + (CB2_5_1I1ResidualEntropies k).Encloses (homogeneousEntropy + (residualLaw (below (shape 2 5 1)) (fun u => (stageBLaw (shape 2 5 1) u : ℝ)) (stageBPriority (shape 2 5 1)) 1 (fun u a => (littleLaw (shape 2 5 1) u ((stageBPriority (shape 2 5 1)) 1) a : ℝ)) k)) := by + fin_cases k + · exact CB2_5_1I1R0H_sound + · exact CB2_5_1I1R1H_sound + · exact CB2_5_1I1R2H_sound + · exact CB2_5_1I1R3H_sound + · exact CB2_5_1I1R4H_sound + · exact CB2_5_1I1R5H_sound + · exact CB2_5_1I1R6H_sound + · exact CB2_5_1I1R7H_sound + · exact CB2_5_1I1R8H_sound + · exact CB2_5_1I1R9H_sound + · exact CB2_5_1I1R10H_sound + · exact CB2_5_1I1R11H_sound + · exact CB2_5_1I1R12H_sound + · exact CB2_5_1I1R13H_sound + · exact CB2_5_1I1R14H_sound + · exact CB2_5_1I1R15H_sound + · exact CB2_5_1I1R16H_sound +def CB2_5_1I1Singles (s : Shape) : Ball := + match s 0, s 1, s 2 with + | _, _, _ => (.exact 0) +lemma CB2_5_1I1Singles_sound (u : Shape) (hu : u ∈ below (shape 2 5 1)) + (hd : designated (stageBPriority (shape 2 5 1)) 1 u) : + (CB2_5_1I1Singles u).Encloses (homogeneousEntropy ((fun u a => (littleLaw (shape 2 5 1) u ((stageBPriority (shape 2 5 1)) 1) a : ℝ)) u)) := by + rw [B2_5_1_below] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl | rfl | rfl + · exact (show ¬ designated (stageBPriority (shape 2 5 1)) 1 (shape 0 3 1) by decide +kernel) hd |>.elim + · exact (show ¬ designated (stageBPriority (shape 2 5 1)) 1 (shape 0 4 0) by decide +kernel) hd |>.elim + · exact (show ¬ designated (stageBPriority (shape 2 5 1)) 1 (shape 1 2 1) by decide +kernel) hd |>.elim + · exact (show ¬ designated (stageBPriority (shape 2 5 1)) 1 (shape 1 3 0) by decide +kernel) hd |>.elim + · exact (show ¬ designated (stageBPriority (shape 2 5 1)) 1 (shape 2 1 1) by decide +kernel) hd |>.elim + · exact (show ¬ designated (stageBPriority (shape 2 5 1)) 1 (shape 2 2 0) by decide +kernel) hd |>.elim +def CB2_5_1I1Singleton : Ball := ⟨0, 0⟩ +lemma CB2_5_1I1Singleton_sound : CB2_5_1I1Singleton.Encloses + (singletonEntropy (below (shape 2 5 1)) (fun u => (stageBLaw (shape 2 5 1) u : ℝ)) (stageBPriority (shape 2 5 1)) 1 (fun u a => (littleLaw (shape 2 5 1) u ((stageBPriority (shape 2 5 1)) 1) a : ℝ))) := by + exact contains_sound (singletonBall_sound (below (shape 2 5 1)) B2_5_1Law (fun u => (stageBLaw (shape 2 5 1) u : ℝ)) (stageBPriority (shape 2 5 1)) 1 + CB2_5_1I1Singles (fun u a => (littleLaw (shape 2 5 1) u ((stageBPriority (shape 2 5 1)) 1) a : ℝ)) (fun u _ => B2_5_1Law_sound u) CB2_5_1I1Singles_sound) (by decide +kernel) +def CB2_5_1I1Group : Ball := ⟨(6308236752597885831351570868877 / 100000000000000000000000000000000), (117284772351 / 100000000000000000000000000000000)⟩ +lemma CB2_5_1I1Group_sound : CB2_5_1I1Group.Encloses + (groupedEntropy (below (shape 2 5 1)) (fun u => (stageBLaw (shape 2 5 1) u : ℝ)) (stageBPriority (shape 2 5 1)) 1 (fun u a => (littleLaw (shape 2 5 1) u ((stageBPriority (shape 2 5 1)) 1) a : ℝ))) := by + exact contains_sound (Ball.add_sound CB2_5_1I1Singleton_sound + (finSumBall_sound 17 CB2_5_1I1ResidualEntropies _ CB2_5_1I1ResidualEntropies_sound)) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CB2_5_1I1H : Ball := ⟨(91511524541003247191147621802257 / 100000000000000000000000000000000), (158140620807 / 50000000000000000000000000000000)⟩ +lemma CB2_5_1I1_sound : CB2_5_1I1H.Encloses (stageBCapacity (shape 2 5 1) 1) := by + have hb := contains_sound (Ball.add_sound CB2_5_1I1PairH_sound + (Ball.neg_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) CB2_5_1I1Group_sound))) + (show contains (.add CB2_5_1I1PairH (.neg (.mul (.exact 2) CB2_5_1I1Group))) CB2_5_1I1H = true by decide +kernel) + simp only [stageBCapacity, nativeCapacity, + show (1 : Fin 3) ≠ 0 by decide, ite_false] + change CB2_5_1I1H.Encloses (homogeneousEntropy CB2_5_1I1PairValue - _) + simpa only [sub_eq_add_neg] using hb + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/CapacityB/CapB2_5_1I2.lean b/lean/OAI/LinearAlgebra/MatrixFields/CapacityB/CapB2_5_1I2.lean new file mode 100644 index 0000000000000000000000000000000000000000..bfda197cf8524fb944bab5bb4f7f532efbb32b3f --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/CapacityB/CapB2_5_1I2.lean @@ -0,0 +1,991 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Certificates.LittleB2_5_1 + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CB2_5_1I2PairValue (a : PairSlot) : ℝ := pairLaw (below (shape 2 5 1)) (shape 2 5 1) (fun u => (stageBLaw (shape 2 5 1) u : ℝ)) (fun u a => (littleLaw (shape 2 5 1) u ((stageBPriority (shape 2 5 1)) 2) a : ℝ)) a +def CB2_5_1I2PairRaw (a : PairSlot) : Ball := pairLawBall (below (shape 2 5 1)) (shape 2 5 1) B2_5_1Law (fun u => B2_5_1Little u ((stageBPriority (shape 2 5 1)) 2)) a +lemma CB2_5_1I2PairRaw_sound (a : PairSlot) : + (CB2_5_1I2PairRaw a).Encloses (CB2_5_1I2PairValue a) := by + exact pairLawBall_sound_on (below (shape 2 5 1)) (shape 2 5 1) B2_5_1Law (fun u => (stageBLaw (shape 2 5 1) u : ℝ)) (fun u => B2_5_1Little u ((stageBPriority (shape 2 5 1)) 2)) (fun u a => (littleLaw (shape 2 5 1) u ((stageBPriority (shape 2 5 1)) 2) a : ℝ)) (fun u _ => B2_5_1Law_sound u) (fun u _ a => B2_5_1Little_sound u ((stageBPriority (shape 2 5 1)) 2) a) (fun u _ a => B2_5_1Little_sound (complement (shape 2 5 1) u) ((stageBPriority (shape 2 5 1)) 2) a) a +def CB2_5_1I2PairCertificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(9444123177522509382296864374047 / 20000000000000000000000000000000), (39 / 100000000000000000000000000000000)⟩ ⟨(35431498578772633316469708350821 / 100000000000000000000000000000000), (7499515789 / 25000000000000000000000000000000)⟩ ⟨(-9379245143451059385188151570411 / 12500000000000000000000000000000), (63527471131 / 100000000000000000000000000000000)⟩ ⟨-2, 9444123177522509382296864374047, 5000000000000000000000000000000⟩, + .log ⟨(2070184148321972828859570473807 / 100000000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ ⟨(8027206568925652293474225385487 / 100000000000000000000000000000000), (767162459 / 25000000000000000000000000000000)⟩ ⟨(-387753262212555215939813748030947 / 100000000000000000000000000000000), (74115382987 / 50000000000000000000000000000000)⟩ ⟨-6, 2070184148321972828859570473807, 1562500000000000000000000000000⟩, + .log ⟨(354599982032740129828053827979 / 50000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ ⟨(877420057559102802694039590203 / 25000000000000000000000000000000), (168951303 / 12500000000000000000000000000000)⟩ ⟨(-494878794143926844783046347417239 / 100000000000000000000000000000000), (19058241357 / 10000000000000000000000000000000)⟩ ⟨-8, 354599982032740129828053827979, 195312500000000000000000000000⟩] +lemma CB2_5_1I2PairCertificates_valid : + CB2_5_1I2PairCertificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB2_5_1I2PairCertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 4, 2 => 1 + | 4, 3 => 2 + | 5, 1 => 3 + | 2, 4 => 1 + | 3, 4 => 2 + | 1, 5 => 3 + | _, _ => 0 +def CB2_5_1I2PairP (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CB2_5_1I2PairCertificates (CB2_5_1I2PairCertificateIndex a)).input +lemma CB2_5_1I2PairP_check : ∀ a : PairSlot, contains (CB2_5_1I2PairRaw a) (CB2_5_1I2PairP a) = true := by + decide +kernel +lemma CB2_5_1I2PairP_sound (a : PairSlot) : + (CB2_5_1I2PairP a).Encloses (CB2_5_1I2PairValue a) := + contains_sound (CB2_5_1I2PairRaw_sound a) (CB2_5_1I2PairP_check a) +def CB2_5_1I2PairTerms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CB2_5_1I2PairCertificates (CB2_5_1I2PairCertificateIndex a)).output +lemma CB2_5_1I2PairTerms_sound (a : PairSlot) : + (CB2_5_1I2PairTerms a).Encloses (Foundation.entropyTerm (CB2_5_1I2PairValue a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB2_5_1I2PairCertificates_valid + (CB2_5_1I2PairCertificateIndex a) (CB2_5_1I2PairP_sound a) +def CB2_5_1I2PairEntropy : Ball := ⟨(293552408612091855129500575607 / 312500000000000000000000000000), (4302290427 / 6250000000000000000000000000000)⟩ +lemma CB2_5_1I2PairEntropy_sound : CB2_5_1I2PairEntropy.Encloses (Foundation.finiteEntropy CB2_5_1I2PairValue) := by + exact contains_sound (entropyPair_enclosed CB2_5_1I2PairValue CB2_5_1I2PairTerms CB2_5_1I2PairTerms_sound) (by decide +kernel) +def CB2_5_1I2PairMass : Ball := ⟨1, (23 / 25000000000000000000000000000000)⟩ +lemma CB2_5_1I2PairMass_sound : CB2_5_1I2PairMass.Encloses (∑ a, CB2_5_1I2PairValue a) := by + exact contains_sound (pairSumBall_sound CB2_5_1I2PairP CB2_5_1I2PairValue CB2_5_1I2PairP_sound) (by decide +kernel) +def CB2_5_1I2PairMassTermLogWitness : LogWitness := ⟨0, 1, 1⟩ +def CB2_5_1I2PairMassTermLog : Ball := ⟨0, (10587911887 / 50000000000000000000000000000000)⟩ +lemma CB2_5_1I2PairMassTermLog_sound : CB2_5_1I2PairMassTermLog.Encloses (Real.log ((∑ a, CB2_5_1I2PairValue a))) := by + exact checkLog_sound logTwoBall_sound (CB2_5_1I2PairMass_sound) (w := CB2_5_1I2PairMassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB2_5_1I2PairMassTerm : Ball := ⟨0, (847032951 / 4000000000000000000000000000000)⟩ +lemma CB2_5_1I2PairMassTerm_sound : CB2_5_1I2PairMassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB2_5_1I2PairValue a))) := by + exact contains_sound (entropyTerm_ball (CB2_5_1I2PairMass_sound) CB2_5_1I2PairMassTermLog_sound) (by decide +kernel) +def CB2_5_1I2PairH : Ball := ⟨(293552408612091855129500575607 / 312500000000000000000000000000), (90012470607 / 100000000000000000000000000000000)⟩ +lemma CB2_5_1I2PairH_sound : CB2_5_1I2PairH.Encloses (homogeneousEntropy CB2_5_1I2PairValue) := by + exact contains_sound (homogeneous_enclosed CB2_5_1I2PairValue CB2_5_1I2PairMassTerm_sound CB2_5_1I2PairEntropy_sound) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CB2_5_1I2R0Value (a : Fin 6) : ℝ := residualLaw (below (shape 2 5 1)) (fun u => (stageBLaw (shape 2 5 1) u : ℝ)) (stageBPriority (shape 2 5 1)) 2 (fun u a => (littleLaw (shape 2 5 1) u ((stageBPriority (shape 2 5 1)) 2) a : ℝ)) 0 a +def CB2_5_1I2R0Raw (a : Fin 6) : Ball := residualBall (below (shape 2 5 1)) B2_5_1Law (stageBPriority (shape 2 5 1)) 2 (fun u => B2_5_1Little u ((stageBPriority (shape 2 5 1)) 2)) 0 a +lemma CB2_5_1I2R0Raw_sound (a : Fin 6) : + (CB2_5_1I2R0Raw a).Encloses (CB2_5_1I2R0Value a) := by + exact residualBall_sound_on (below (shape 2 5 1)) B2_5_1Law (fun u => (stageBLaw (shape 2 5 1) u : ℝ)) (stageBPriority (shape 2 5 1)) 2 (fun u => B2_5_1Little u ((stageBPriority (shape 2 5 1)) 2)) (fun u a => (littleLaw (shape 2 5 1) u ((stageBPriority (shape 2 5 1)) 2) a : ℝ)) (fun u _ => B2_5_1Law_sound u) (fun u _ a => B2_5_1Little_sound u ((stageBPriority (shape 2 5 1)) 2) a) 0 a +def CB2_5_1I2R0Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB2_5_1I2R0Certificates_valid : + CB2_5_1I2R0Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB2_5_1I2R0CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB2_5_1I2R0P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_5_1I2R0Certificates (CB2_5_1I2R0CertificateIndex a)).input +lemma CB2_5_1I2R0P_check : ∀ a : Fin 6, contains (CB2_5_1I2R0Raw a) (CB2_5_1I2R0P a) = true := by + decide +kernel +lemma CB2_5_1I2R0P_sound (a : Fin 6) : + (CB2_5_1I2R0P a).Encloses (CB2_5_1I2R0Value a) := + contains_sound (CB2_5_1I2R0Raw_sound a) (CB2_5_1I2R0P_check a) +def CB2_5_1I2R0Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_5_1I2R0Certificates (CB2_5_1I2R0CertificateIndex a)).output +lemma CB2_5_1I2R0Terms_sound (a : Fin 6) : + (CB2_5_1I2R0Terms a).Encloses (Foundation.entropyTerm (CB2_5_1I2R0Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB2_5_1I2R0Certificates_valid + (CB2_5_1I2R0CertificateIndex a) (CB2_5_1I2R0P_sound a) +def CB2_5_1I2R0Entropy : Ball := ⟨0, 0⟩ +lemma CB2_5_1I2R0Entropy_sound : CB2_5_1I2R0Entropy.Encloses (Foundation.finiteEntropy CB2_5_1I2R0Value) := by + exact contains_sound (entropyFin_enclosed 6 CB2_5_1I2R0Value CB2_5_1I2R0Terms CB2_5_1I2R0Terms_sound) (by decide +kernel) +def CB2_5_1I2R0Mass : Ball := ⟨0, 0⟩ +lemma CB2_5_1I2R0Mass_sound : CB2_5_1I2R0Mass.Encloses (∑ a, CB2_5_1I2R0Value a) := by + exact contains_sound (finSumBall_sound 6 CB2_5_1I2R0P CB2_5_1I2R0Value CB2_5_1I2R0P_sound) (by decide +kernel) +def CB2_5_1I2R0MassTerm : Ball := .exact 0 +lemma CB2_5_1I2R0MassTerm_sound : CB2_5_1I2R0MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB2_5_1I2R0Value a))) := + entropyTerm_zero_ball (CB2_5_1I2R0Mass_sound) +def CB2_5_1I2R0H : Ball := ⟨0, 0⟩ +lemma CB2_5_1I2R0H_sound : CB2_5_1I2R0H.Encloses (homogeneousEntropy CB2_5_1I2R0Value) := by + exact contains_sound (homogeneous_enclosed CB2_5_1I2R0Value CB2_5_1I2R0MassTerm_sound CB2_5_1I2R0Entropy_sound) (by decide +kernel) +def CB2_5_1I2R1Value (a : Fin 6) : ℝ := residualLaw (below (shape 2 5 1)) (fun u => (stageBLaw (shape 2 5 1) u : ℝ)) (stageBPriority (shape 2 5 1)) 2 (fun u a => (littleLaw (shape 2 5 1) u ((stageBPriority (shape 2 5 1)) 2) a : ℝ)) 1 a +def CB2_5_1I2R1Raw (a : Fin 6) : Ball := residualBall (below (shape 2 5 1)) B2_5_1Law (stageBPriority (shape 2 5 1)) 2 (fun u => B2_5_1Little u ((stageBPriority (shape 2 5 1)) 2)) 1 a +lemma CB2_5_1I2R1Raw_sound (a : Fin 6) : + (CB2_5_1I2R1Raw a).Encloses (CB2_5_1I2R1Value a) := by + exact residualBall_sound_on (below (shape 2 5 1)) B2_5_1Law (fun u => (stageBLaw (shape 2 5 1) u : ℝ)) (stageBPriority (shape 2 5 1)) 2 (fun u => B2_5_1Little u ((stageBPriority (shape 2 5 1)) 2)) (fun u a => (littleLaw (shape 2 5 1) u ((stageBPriority (shape 2 5 1)) 2) a : ℝ)) (fun u _ => B2_5_1Law_sound u) (fun u _ a => B2_5_1Little_sound u ((stageBPriority (shape 2 5 1)) 2) a) 1 a +def CB2_5_1I2R1Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(354599982032740129828053827979 / 50000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ ⟨(877420057559102802694039590203 / 25000000000000000000000000000000), (168951303 / 12500000000000000000000000000000)⟩ ⟨(-494878794143926844783046347417239 / 100000000000000000000000000000000), (19058241357 / 10000000000000000000000000000000)⟩ ⟨-8, 354599982032740129828053827979, 195312500000000000000000000000⟩] +lemma CB2_5_1I2R1Certificates_valid : + CB2_5_1I2R1Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB2_5_1I2R1CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | 1 => 1 + | _ => 0 +def CB2_5_1I2R1P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_5_1I2R1Certificates (CB2_5_1I2R1CertificateIndex a)).input +lemma CB2_5_1I2R1P_check : ∀ a : Fin 6, contains (CB2_5_1I2R1Raw a) (CB2_5_1I2R1P a) = true := by + decide +kernel +lemma CB2_5_1I2R1P_sound (a : Fin 6) : + (CB2_5_1I2R1P a).Encloses (CB2_5_1I2R1Value a) := + contains_sound (CB2_5_1I2R1Raw_sound a) (CB2_5_1I2R1P_check a) +def CB2_5_1I2R1Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_5_1I2R1Certificates (CB2_5_1I2R1CertificateIndex a)).output +lemma CB2_5_1I2R1Terms_sound (a : Fin 6) : + (CB2_5_1I2R1Terms a).Encloses (Foundation.entropyTerm (CB2_5_1I2R1Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB2_5_1I2R1Certificates_valid + (CB2_5_1I2R1CertificateIndex a) (CB2_5_1I2R1P_sound a) +def CB2_5_1I2R1Entropy : Ball := ⟨(877420057559102802694039590203 / 25000000000000000000000000000000), (168951303 / 12500000000000000000000000000000)⟩ +lemma CB2_5_1I2R1Entropy_sound : CB2_5_1I2R1Entropy.Encloses (Foundation.finiteEntropy CB2_5_1I2R1Value) := by + exact contains_sound (entropyFin_enclosed 6 CB2_5_1I2R1Value CB2_5_1I2R1Terms CB2_5_1I2R1Terms_sound) (by decide +kernel) +def CB2_5_1I2R1Mass : Ball := ⟨(354599982032740129828053827979 / 50000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +lemma CB2_5_1I2R1Mass_sound : CB2_5_1I2R1Mass.Encloses (∑ a, CB2_5_1I2R1Value a) := by + exact contains_sound (finSumBall_sound 6 CB2_5_1I2R1P CB2_5_1I2R1Value CB2_5_1I2R1P_sound) (by decide +kernel) +def CB2_5_1I2R1MassTermLogWitness : LogWitness := ⟨-8, 354599982032740129828053827979, 195312500000000000000000000000⟩ +def CB2_5_1I2R1MassTermLog : Ball := ⟨(-494878794143926844783046347417239 / 100000000000000000000000000000000), (19058241357 / 10000000000000000000000000000000)⟩ +lemma CB2_5_1I2R1MassTermLog_sound : CB2_5_1I2R1MassTermLog.Encloses (Real.log ((∑ a, CB2_5_1I2R1Value a))) := by + exact checkLog_sound logTwoBall_sound (CB2_5_1I2R1Mass_sound) (w := CB2_5_1I2R1MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB2_5_1I2R1MassTerm : Ball := ⟨(877420057559102802694039590203 / 25000000000000000000000000000000), (168951303 / 12500000000000000000000000000000)⟩ +lemma CB2_5_1I2R1MassTerm_sound : CB2_5_1I2R1MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB2_5_1I2R1Value a))) := by + exact contains_sound (entropyTerm_ball (CB2_5_1I2R1Mass_sound) CB2_5_1I2R1MassTermLog_sound) (by decide +kernel) +def CB2_5_1I2R1H : Ball := ⟨0, (168951303 / 6250000000000000000000000000000)⟩ +lemma CB2_5_1I2R1H_sound : CB2_5_1I2R1H.Encloses (homogeneousEntropy CB2_5_1I2R1Value) := by + exact contains_sound (homogeneous_enclosed CB2_5_1I2R1Value CB2_5_1I2R1MassTerm_sound CB2_5_1I2R1Entropy_sound) (by decide +kernel) +def CB2_5_1I2R2Value (a : Fin 6) : ℝ := residualLaw (below (shape 2 5 1)) (fun u => (stageBLaw (shape 2 5 1) u : ℝ)) (stageBPriority (shape 2 5 1)) 2 (fun u a => (littleLaw (shape 2 5 1) u ((stageBPriority (shape 2 5 1)) 2) a : ℝ)) 2 a +def CB2_5_1I2R2Raw (a : Fin 6) : Ball := residualBall (below (shape 2 5 1)) B2_5_1Law (stageBPriority (shape 2 5 1)) 2 (fun u => B2_5_1Little u ((stageBPriority (shape 2 5 1)) 2)) 2 a +lemma CB2_5_1I2R2Raw_sound (a : Fin 6) : + (CB2_5_1I2R2Raw a).Encloses (CB2_5_1I2R2Value a) := by + exact residualBall_sound_on (below (shape 2 5 1)) B2_5_1Law (fun u => (stageBLaw (shape 2 5 1) u : ℝ)) (stageBPriority (shape 2 5 1)) 2 (fun u => B2_5_1Little u ((stageBPriority (shape 2 5 1)) 2)) (fun u a => (littleLaw (shape 2 5 1) u ((stageBPriority (shape 2 5 1)) 2) a : ℝ)) (fun u _ => B2_5_1Law_sound u) (fun u _ a => B2_5_1Little_sound u ((stageBPriority (shape 2 5 1)) 2) a) 2 a +def CB2_5_1I2R2Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(31399400357554439564752537654833 / 100000000000000000000000000000000), (3 / 20000000000000000000000000000000)⟩ ⟨(4546560129505194253022711068703 / 12500000000000000000000000000000), (4986811251 / 25000000000000000000000000000000)⟩ ⟨(-115838139014940238562116354817541 / 100000000000000000000000000000000), (7940933887 / 12500000000000000000000000000000)⟩ ⟨-2, 31399400357554439564752537654833, 25000000000000000000000000000000⟩, + .log ⟨(56517553003898872615455314497 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(766968855704191661385160206079 / 100000000000000000000000000000000), (263297271 / 100000000000000000000000000000000)⟩ ⟨(-339261351093562998797346046842591 / 50000000000000000000000000000000), (232934061397 / 100000000000000000000000000000000)⟩ ⟨-10, 56517553003898872615455314497, 48828125000000000000000000000⟩] +lemma CB2_5_1I2R2Certificates_valid : + CB2_5_1I2R2Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB2_5_1I2R2CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | 2 => 1 + | 3 => 2 + | _ => 0 +def CB2_5_1I2R2P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_5_1I2R2Certificates (CB2_5_1I2R2CertificateIndex a)).input +lemma CB2_5_1I2R2P_check : ∀ a : Fin 6, contains (CB2_5_1I2R2Raw a) (CB2_5_1I2R2P a) = true := by + decide +kernel +lemma CB2_5_1I2R2P_sound (a : Fin 6) : + (CB2_5_1I2R2P a).Encloses (CB2_5_1I2R2Value a) := + contains_sound (CB2_5_1I2R2Raw_sound a) (CB2_5_1I2R2P_check a) +def CB2_5_1I2R2Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_5_1I2R2Certificates (CB2_5_1I2R2CertificateIndex a)).output +lemma CB2_5_1I2R2Terms_sound (a : Fin 6) : + (CB2_5_1I2R2Terms a).Encloses (Foundation.entropyTerm (CB2_5_1I2R2Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB2_5_1I2R2Certificates_valid + (CB2_5_1I2R2CertificateIndex a) (CB2_5_1I2R2P_sound a) +def CB2_5_1I2R2Entropy : Ball := ⟨(37139449891745745685566848755703 / 100000000000000000000000000000000), (808421691 / 4000000000000000000000000000000)⟩ +lemma CB2_5_1I2R2Entropy_sound : CB2_5_1I2R2Entropy.Encloses (Foundation.finiteEntropy CB2_5_1I2R2Value) := by + exact contains_sound (entropyFin_enclosed 6 CB2_5_1I2R2Value CB2_5_1I2R2Terms CB2_5_1I2R2Terms_sound) (by decide +kernel) +def CB2_5_1I2R2Mass : Ball := ⟨(31512435463562237309983448283827 / 100000000000000000000000000000000), (1 / 6250000000000000000000000000000)⟩ +lemma CB2_5_1I2R2Mass_sound : CB2_5_1I2R2Mass.Encloses (∑ a, CB2_5_1I2R2Value a) := by + exact contains_sound (finSumBall_sound 6 CB2_5_1I2R2P CB2_5_1I2R2Value CB2_5_1I2R2P_sound) (by decide +kernel) +def CB2_5_1I2R2MassTermLogWitness : LogWitness := ⟨-2, 31512435463562237309983448283827, 25000000000000000000000000000000⟩ +def CB2_5_1I2R2MassTermLog : Ball := ⟨(-14434849267990855597880807746391 / 12500000000000000000000000000000), (63527471099 / 100000000000000000000000000000000)⟩ +lemma CB2_5_1I2R2MassTermLog_sound : CB2_5_1I2R2MassTermLog.Encloses (Real.log ((∑ a, CB2_5_1I2R2Value a))) := by + exact checkLog_sound logTwoBall_sound (CB2_5_1I2R2Mass_sound) (w := CB2_5_1I2R2MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB2_5_1I2R2MassTerm : Ball := ⟨(18195090239352417580992918396093 / 50000000000000000000000000000000), (20019053351 / 100000000000000000000000000000000)⟩ +lemma CB2_5_1I2R2MassTerm_sound : CB2_5_1I2R2MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB2_5_1I2R2Value a))) := by + exact contains_sound (entropyTerm_ball (CB2_5_1I2R2Mass_sound) CB2_5_1I2R2MassTermLog_sound) (by decide +kernel) +def CB2_5_1I2R2H : Ball := ⟨(749269413040910523581011963517 / 100000000000000000000000000000000), (20114797813 / 50000000000000000000000000000000)⟩ +lemma CB2_5_1I2R2H_sound : CB2_5_1I2R2H.Encloses (homogeneousEntropy CB2_5_1I2R2Value) := by + exact contains_sound (homogeneous_enclosed CB2_5_1I2R2Value CB2_5_1I2R2MassTerm_sound CB2_5_1I2R2Entropy_sound) (by decide +kernel) +def CB2_5_1I2R3Value (a : Fin 6) : ℝ := residualLaw (below (shape 2 5 1)) (fun u => (stageBLaw (shape 2 5 1) u : ℝ)) (stageBPriority (shape 2 5 1)) 2 (fun u a => (littleLaw (shape 2 5 1) u ((stageBPriority (shape 2 5 1)) 2) a : ℝ)) 3 a +def CB2_5_1I2R3Raw (a : Fin 6) : Ball := residualBall (below (shape 2 5 1)) B2_5_1Law (stageBPriority (shape 2 5 1)) 2 (fun u => B2_5_1Little u ((stageBPriority (shape 2 5 1)) 2)) 3 a +lemma CB2_5_1I2R3Raw_sound (a : Fin 6) : + (CB2_5_1I2R3Raw a).Encloses (CB2_5_1I2R3Value a) := by + exact residualBall_sound_on (below (shape 2 5 1)) B2_5_1Law (fun u => (stageBLaw (shape 2 5 1) u : ℝ)) (stageBPriority (shape 2 5 1)) 2 (fun u => B2_5_1Little u ((stageBPriority (shape 2 5 1)) 2)) (fun u a => (littleLaw (shape 2 5 1) u ((stageBPriority (shape 2 5 1)) 2) a : ℝ)) (fun u _ => B2_5_1Law_sound u) (fun u _ a => B2_5_1Little_sound u ((stageBPriority (shape 2 5 1)) 2) a) 3 a +def CB2_5_1I2R3Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB2_5_1I2R3Certificates_valid : + CB2_5_1I2R3Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB2_5_1I2R3CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB2_5_1I2R3P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_5_1I2R3Certificates (CB2_5_1I2R3CertificateIndex a)).input +lemma CB2_5_1I2R3P_check : ∀ a : Fin 6, contains (CB2_5_1I2R3Raw a) (CB2_5_1I2R3P a) = true := by + decide +kernel +lemma CB2_5_1I2R3P_sound (a : Fin 6) : + (CB2_5_1I2R3P a).Encloses (CB2_5_1I2R3Value a) := + contains_sound (CB2_5_1I2R3Raw_sound a) (CB2_5_1I2R3P_check a) +def CB2_5_1I2R3Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_5_1I2R3Certificates (CB2_5_1I2R3CertificateIndex a)).output +lemma CB2_5_1I2R3Terms_sound (a : Fin 6) : + (CB2_5_1I2R3Terms a).Encloses (Foundation.entropyTerm (CB2_5_1I2R3Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB2_5_1I2R3Certificates_valid + (CB2_5_1I2R3CertificateIndex a) (CB2_5_1I2R3P_sound a) +def CB2_5_1I2R3Entropy : Ball := ⟨0, 0⟩ +lemma CB2_5_1I2R3Entropy_sound : CB2_5_1I2R3Entropy.Encloses (Foundation.finiteEntropy CB2_5_1I2R3Value) := by + exact contains_sound (entropyFin_enclosed 6 CB2_5_1I2R3Value CB2_5_1I2R3Terms CB2_5_1I2R3Terms_sound) (by decide +kernel) +def CB2_5_1I2R3Mass : Ball := ⟨0, 0⟩ +lemma CB2_5_1I2R3Mass_sound : CB2_5_1I2R3Mass.Encloses (∑ a, CB2_5_1I2R3Value a) := by + exact contains_sound (finSumBall_sound 6 CB2_5_1I2R3P CB2_5_1I2R3Value CB2_5_1I2R3P_sound) (by decide +kernel) +def CB2_5_1I2R3MassTerm : Ball := .exact 0 +lemma CB2_5_1I2R3MassTerm_sound : CB2_5_1I2R3MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB2_5_1I2R3Value a))) := + entropyTerm_zero_ball (CB2_5_1I2R3Mass_sound) +def CB2_5_1I2R3H : Ball := ⟨0, 0⟩ +lemma CB2_5_1I2R3H_sound : CB2_5_1I2R3H.Encloses (homogeneousEntropy CB2_5_1I2R3Value) := by + exact contains_sound (homogeneous_enclosed CB2_5_1I2R3Value CB2_5_1I2R3MassTerm_sound CB2_5_1I2R3Entropy_sound) (by decide +kernel) +def CB2_5_1I2R4Value (a : Fin 6) : ℝ := residualLaw (below (shape 2 5 1)) (fun u => (stageBLaw (shape 2 5 1) u : ℝ)) (stageBPriority (shape 2 5 1)) 2 (fun u a => (littleLaw (shape 2 5 1) u ((stageBPriority (shape 2 5 1)) 2) a : ℝ)) 4 a +def CB2_5_1I2R4Raw (a : Fin 6) : Ball := residualBall (below (shape 2 5 1)) B2_5_1Law (stageBPriority (shape 2 5 1)) 2 (fun u => B2_5_1Little u ((stageBPriority (shape 2 5 1)) 2)) 4 a +lemma CB2_5_1I2R4Raw_sound (a : Fin 6) : + (CB2_5_1I2R4Raw a).Encloses (CB2_5_1I2R4Value a) := by + exact residualBall_sound_on (below (shape 2 5 1)) B2_5_1Law (fun u => (stageBLaw (shape 2 5 1) u : ℝ)) (stageBPriority (shape 2 5 1)) 2 (fun u => B2_5_1Little u ((stageBPriority (shape 2 5 1)) 2)) (fun u a => (littleLaw (shape 2 5 1) u ((stageBPriority (shape 2 5 1)) 2) a : ℝ)) (fun u _ => B2_5_1Law_sound u) (fun u _ a => B2_5_1Little_sound u ((stageBPriority (shape 2 5 1)) 2) a) 4 a +def CB2_5_1I2R4Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB2_5_1I2R4Certificates_valid : + CB2_5_1I2R4Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB2_5_1I2R4CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB2_5_1I2R4P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_5_1I2R4Certificates (CB2_5_1I2R4CertificateIndex a)).input +lemma CB2_5_1I2R4P_check : ∀ a : Fin 6, contains (CB2_5_1I2R4Raw a) (CB2_5_1I2R4P a) = true := by + decide +kernel +lemma CB2_5_1I2R4P_sound (a : Fin 6) : + (CB2_5_1I2R4P a).Encloses (CB2_5_1I2R4Value a) := + contains_sound (CB2_5_1I2R4Raw_sound a) (CB2_5_1I2R4P_check a) +def CB2_5_1I2R4Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_5_1I2R4Certificates (CB2_5_1I2R4CertificateIndex a)).output +lemma CB2_5_1I2R4Terms_sound (a : Fin 6) : + (CB2_5_1I2R4Terms a).Encloses (Foundation.entropyTerm (CB2_5_1I2R4Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB2_5_1I2R4Certificates_valid + (CB2_5_1I2R4CertificateIndex a) (CB2_5_1I2R4P_sound a) +def CB2_5_1I2R4Entropy : Ball := ⟨0, 0⟩ +lemma CB2_5_1I2R4Entropy_sound : CB2_5_1I2R4Entropy.Encloses (Foundation.finiteEntropy CB2_5_1I2R4Value) := by + exact contains_sound (entropyFin_enclosed 6 CB2_5_1I2R4Value CB2_5_1I2R4Terms CB2_5_1I2R4Terms_sound) (by decide +kernel) +def CB2_5_1I2R4Mass : Ball := ⟨0, 0⟩ +lemma CB2_5_1I2R4Mass_sound : CB2_5_1I2R4Mass.Encloses (∑ a, CB2_5_1I2R4Value a) := by + exact contains_sound (finSumBall_sound 6 CB2_5_1I2R4P CB2_5_1I2R4Value CB2_5_1I2R4P_sound) (by decide +kernel) +def CB2_5_1I2R4MassTerm : Ball := .exact 0 +lemma CB2_5_1I2R4MassTerm_sound : CB2_5_1I2R4MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB2_5_1I2R4Value a))) := + entropyTerm_zero_ball (CB2_5_1I2R4Mass_sound) +def CB2_5_1I2R4H : Ball := ⟨0, 0⟩ +lemma CB2_5_1I2R4H_sound : CB2_5_1I2R4H.Encloses (homogeneousEntropy CB2_5_1I2R4Value) := by + exact contains_sound (homogeneous_enclosed CB2_5_1I2R4Value CB2_5_1I2R4MassTerm_sound CB2_5_1I2R4Entropy_sound) (by decide +kernel) +def CB2_5_1I2R5Value (a : Fin 6) : ℝ := residualLaw (below (shape 2 5 1)) (fun u => (stageBLaw (shape 2 5 1) u : ℝ)) (stageBPriority (shape 2 5 1)) 2 (fun u a => (littleLaw (shape 2 5 1) u ((stageBPriority (shape 2 5 1)) 2) a : ℝ)) 5 a +def CB2_5_1I2R5Raw (a : Fin 6) : Ball := residualBall (below (shape 2 5 1)) B2_5_1Law (stageBPriority (shape 2 5 1)) 2 (fun u => B2_5_1Little u ((stageBPriority (shape 2 5 1)) 2)) 5 a +lemma CB2_5_1I2R5Raw_sound (a : Fin 6) : + (CB2_5_1I2R5Raw a).Encloses (CB2_5_1I2R5Value a) := by + exact residualBall_sound_on (below (shape 2 5 1)) B2_5_1Law (fun u => (stageBLaw (shape 2 5 1) u : ℝ)) (stageBPriority (shape 2 5 1)) 2 (fun u => B2_5_1Little u ((stageBPriority (shape 2 5 1)) 2)) (fun u a => (littleLaw (shape 2 5 1) u ((stageBPriority (shape 2 5 1)) 2) a : ℝ)) (fun u _ => B2_5_1Law_sound u) (fun u _ a => B2_5_1Little_sound u ((stageBPriority (shape 2 5 1)) 2) a) 5 a +def CB2_5_1I2R5Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB2_5_1I2R5Certificates_valid : + CB2_5_1I2R5Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB2_5_1I2R5CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB2_5_1I2R5P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_5_1I2R5Certificates (CB2_5_1I2R5CertificateIndex a)).input +lemma CB2_5_1I2R5P_check : ∀ a : Fin 6, contains (CB2_5_1I2R5Raw a) (CB2_5_1I2R5P a) = true := by + decide +kernel +lemma CB2_5_1I2R5P_sound (a : Fin 6) : + (CB2_5_1I2R5P a).Encloses (CB2_5_1I2R5Value a) := + contains_sound (CB2_5_1I2R5Raw_sound a) (CB2_5_1I2R5P_check a) +def CB2_5_1I2R5Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_5_1I2R5Certificates (CB2_5_1I2R5CertificateIndex a)).output +lemma CB2_5_1I2R5Terms_sound (a : Fin 6) : + (CB2_5_1I2R5Terms a).Encloses (Foundation.entropyTerm (CB2_5_1I2R5Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB2_5_1I2R5Certificates_valid + (CB2_5_1I2R5CertificateIndex a) (CB2_5_1I2R5P_sound a) +def CB2_5_1I2R5Entropy : Ball := ⟨0, 0⟩ +lemma CB2_5_1I2R5Entropy_sound : CB2_5_1I2R5Entropy.Encloses (Foundation.finiteEntropy CB2_5_1I2R5Value) := by + exact contains_sound (entropyFin_enclosed 6 CB2_5_1I2R5Value CB2_5_1I2R5Terms CB2_5_1I2R5Terms_sound) (by decide +kernel) +def CB2_5_1I2R5Mass : Ball := ⟨0, 0⟩ +lemma CB2_5_1I2R5Mass_sound : CB2_5_1I2R5Mass.Encloses (∑ a, CB2_5_1I2R5Value a) := by + exact contains_sound (finSumBall_sound 6 CB2_5_1I2R5P CB2_5_1I2R5Value CB2_5_1I2R5P_sound) (by decide +kernel) +def CB2_5_1I2R5MassTerm : Ball := .exact 0 +lemma CB2_5_1I2R5MassTerm_sound : CB2_5_1I2R5MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB2_5_1I2R5Value a))) := + entropyTerm_zero_ball (CB2_5_1I2R5Mass_sound) +def CB2_5_1I2R5H : Ball := ⟨0, 0⟩ +lemma CB2_5_1I2R5H_sound : CB2_5_1I2R5H.Encloses (homogeneousEntropy CB2_5_1I2R5Value) := by + exact contains_sound (homogeneous_enclosed CB2_5_1I2R5Value CB2_5_1I2R5MassTerm_sound CB2_5_1I2R5Entropy_sound) (by decide +kernel) +def CB2_5_1I2R6Value (a : Fin 6) : ℝ := residualLaw (below (shape 2 5 1)) (fun u => (stageBLaw (shape 2 5 1) u : ℝ)) (stageBPriority (shape 2 5 1)) 2 (fun u a => (littleLaw (shape 2 5 1) u ((stageBPriority (shape 2 5 1)) 2) a : ℝ)) 6 a +def CB2_5_1I2R6Raw (a : Fin 6) : Ball := residualBall (below (shape 2 5 1)) B2_5_1Law (stageBPriority (shape 2 5 1)) 2 (fun u => B2_5_1Little u ((stageBPriority (shape 2 5 1)) 2)) 6 a +lemma CB2_5_1I2R6Raw_sound (a : Fin 6) : + (CB2_5_1I2R6Raw a).Encloses (CB2_5_1I2R6Value a) := by + exact residualBall_sound_on (below (shape 2 5 1)) B2_5_1Law (fun u => (stageBLaw (shape 2 5 1) u : ℝ)) (stageBPriority (shape 2 5 1)) 2 (fun u => B2_5_1Little u ((stageBPriority (shape 2 5 1)) 2)) (fun u a => (littleLaw (shape 2 5 1) u ((stageBPriority (shape 2 5 1)) 2) a : ℝ)) (fun u _ => B2_5_1Law_sound u) (fun u _ a => B2_5_1Little_sound u ((stageBPriority (shape 2 5 1)) 2) a) 6 a +def CB2_5_1I2R6Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB2_5_1I2R6Certificates_valid : + CB2_5_1I2R6Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB2_5_1I2R6CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB2_5_1I2R6P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_5_1I2R6Certificates (CB2_5_1I2R6CertificateIndex a)).input +lemma CB2_5_1I2R6P_check : ∀ a : Fin 6, contains (CB2_5_1I2R6Raw a) (CB2_5_1I2R6P a) = true := by + decide +kernel +lemma CB2_5_1I2R6P_sound (a : Fin 6) : + (CB2_5_1I2R6P a).Encloses (CB2_5_1I2R6Value a) := + contains_sound (CB2_5_1I2R6Raw_sound a) (CB2_5_1I2R6P_check a) +def CB2_5_1I2R6Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_5_1I2R6Certificates (CB2_5_1I2R6CertificateIndex a)).output +lemma CB2_5_1I2R6Terms_sound (a : Fin 6) : + (CB2_5_1I2R6Terms a).Encloses (Foundation.entropyTerm (CB2_5_1I2R6Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB2_5_1I2R6Certificates_valid + (CB2_5_1I2R6CertificateIndex a) (CB2_5_1I2R6P_sound a) +def CB2_5_1I2R6Entropy : Ball := ⟨0, 0⟩ +lemma CB2_5_1I2R6Entropy_sound : CB2_5_1I2R6Entropy.Encloses (Foundation.finiteEntropy CB2_5_1I2R6Value) := by + exact contains_sound (entropyFin_enclosed 6 CB2_5_1I2R6Value CB2_5_1I2R6Terms CB2_5_1I2R6Terms_sound) (by decide +kernel) +def CB2_5_1I2R6Mass : Ball := ⟨0, 0⟩ +lemma CB2_5_1I2R6Mass_sound : CB2_5_1I2R6Mass.Encloses (∑ a, CB2_5_1I2R6Value a) := by + exact contains_sound (finSumBall_sound 6 CB2_5_1I2R6P CB2_5_1I2R6Value CB2_5_1I2R6P_sound) (by decide +kernel) +def CB2_5_1I2R6MassTerm : Ball := .exact 0 +lemma CB2_5_1I2R6MassTerm_sound : CB2_5_1I2R6MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB2_5_1I2R6Value a))) := + entropyTerm_zero_ball (CB2_5_1I2R6Mass_sound) +def CB2_5_1I2R6H : Ball := ⟨0, 0⟩ +lemma CB2_5_1I2R6H_sound : CB2_5_1I2R6H.Encloses (homogeneousEntropy CB2_5_1I2R6Value) := by + exact contains_sound (homogeneous_enclosed CB2_5_1I2R6Value CB2_5_1I2R6MassTerm_sound CB2_5_1I2R6Entropy_sound) (by decide +kernel) +def CB2_5_1I2R7Value (a : Fin 6) : ℝ := residualLaw (below (shape 2 5 1)) (fun u => (stageBLaw (shape 2 5 1) u : ℝ)) (stageBPriority (shape 2 5 1)) 2 (fun u a => (littleLaw (shape 2 5 1) u ((stageBPriority (shape 2 5 1)) 2) a : ℝ)) 7 a +def CB2_5_1I2R7Raw (a : Fin 6) : Ball := residualBall (below (shape 2 5 1)) B2_5_1Law (stageBPriority (shape 2 5 1)) 2 (fun u => B2_5_1Little u ((stageBPriority (shape 2 5 1)) 2)) 7 a +lemma CB2_5_1I2R7Raw_sound (a : Fin 6) : + (CB2_5_1I2R7Raw a).Encloses (CB2_5_1I2R7Value a) := by + exact residualBall_sound_on (below (shape 2 5 1)) B2_5_1Law (fun u => (stageBLaw (shape 2 5 1) u : ℝ)) (stageBPriority (shape 2 5 1)) 2 (fun u => B2_5_1Little u ((stageBPriority (shape 2 5 1)) 2)) (fun u a => (littleLaw (shape 2 5 1) u ((stageBPriority (shape 2 5 1)) 2) a : ℝ)) (fun u _ => B2_5_1Law_sound u) (fun u _ a => B2_5_1Little_sound u ((stageBPriority (shape 2 5 1)) 2) a) 7 a +def CB2_5_1I2R7Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB2_5_1I2R7Certificates_valid : + CB2_5_1I2R7Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB2_5_1I2R7CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB2_5_1I2R7P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_5_1I2R7Certificates (CB2_5_1I2R7CertificateIndex a)).input +lemma CB2_5_1I2R7P_check : ∀ a : Fin 6, contains (CB2_5_1I2R7Raw a) (CB2_5_1I2R7P a) = true := by + decide +kernel +lemma CB2_5_1I2R7P_sound (a : Fin 6) : + (CB2_5_1I2R7P a).Encloses (CB2_5_1I2R7Value a) := + contains_sound (CB2_5_1I2R7Raw_sound a) (CB2_5_1I2R7P_check a) +def CB2_5_1I2R7Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_5_1I2R7Certificates (CB2_5_1I2R7CertificateIndex a)).output +lemma CB2_5_1I2R7Terms_sound (a : Fin 6) : + (CB2_5_1I2R7Terms a).Encloses (Foundation.entropyTerm (CB2_5_1I2R7Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB2_5_1I2R7Certificates_valid + (CB2_5_1I2R7CertificateIndex a) (CB2_5_1I2R7P_sound a) +def CB2_5_1I2R7Entropy : Ball := ⟨0, 0⟩ +lemma CB2_5_1I2R7Entropy_sound : CB2_5_1I2R7Entropy.Encloses (Foundation.finiteEntropy CB2_5_1I2R7Value) := by + exact contains_sound (entropyFin_enclosed 6 CB2_5_1I2R7Value CB2_5_1I2R7Terms CB2_5_1I2R7Terms_sound) (by decide +kernel) +def CB2_5_1I2R7Mass : Ball := ⟨0, 0⟩ +lemma CB2_5_1I2R7Mass_sound : CB2_5_1I2R7Mass.Encloses (∑ a, CB2_5_1I2R7Value a) := by + exact contains_sound (finSumBall_sound 6 CB2_5_1I2R7P CB2_5_1I2R7Value CB2_5_1I2R7P_sound) (by decide +kernel) +def CB2_5_1I2R7MassTerm : Ball := .exact 0 +lemma CB2_5_1I2R7MassTerm_sound : CB2_5_1I2R7MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB2_5_1I2R7Value a))) := + entropyTerm_zero_ball (CB2_5_1I2R7Mass_sound) +def CB2_5_1I2R7H : Ball := ⟨0, 0⟩ +lemma CB2_5_1I2R7H_sound : CB2_5_1I2R7H.Encloses (homogeneousEntropy CB2_5_1I2R7Value) := by + exact contains_sound (homogeneous_enclosed CB2_5_1I2R7Value CB2_5_1I2R7MassTerm_sound CB2_5_1I2R7Entropy_sound) (by decide +kernel) +def CB2_5_1I2R8Value (a : Fin 6) : ℝ := residualLaw (below (shape 2 5 1)) (fun u => (stageBLaw (shape 2 5 1) u : ℝ)) (stageBPriority (shape 2 5 1)) 2 (fun u a => (littleLaw (shape 2 5 1) u ((stageBPriority (shape 2 5 1)) 2) a : ℝ)) 8 a +def CB2_5_1I2R8Raw (a : Fin 6) : Ball := residualBall (below (shape 2 5 1)) B2_5_1Law (stageBPriority (shape 2 5 1)) 2 (fun u => B2_5_1Little u ((stageBPriority (shape 2 5 1)) 2)) 8 a +lemma CB2_5_1I2R8Raw_sound (a : Fin 6) : + (CB2_5_1I2R8Raw a).Encloses (CB2_5_1I2R8Value a) := by + exact residualBall_sound_on (below (shape 2 5 1)) B2_5_1Law (fun u => (stageBLaw (shape 2 5 1) u : ℝ)) (stageBPriority (shape 2 5 1)) 2 (fun u => B2_5_1Little u ((stageBPriority (shape 2 5 1)) 2)) (fun u a => (littleLaw (shape 2 5 1) u ((stageBPriority (shape 2 5 1)) 2) a : ℝ)) (fun u _ => B2_5_1Law_sound u) (fun u _ a => B2_5_1Little_sound u ((stageBPriority (shape 2 5 1)) 2) a) 8 a +def CB2_5_1I2R8Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB2_5_1I2R8Certificates_valid : + CB2_5_1I2R8Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB2_5_1I2R8CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB2_5_1I2R8P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_5_1I2R8Certificates (CB2_5_1I2R8CertificateIndex a)).input +lemma CB2_5_1I2R8P_check : ∀ a : Fin 6, contains (CB2_5_1I2R8Raw a) (CB2_5_1I2R8P a) = true := by + decide +kernel +lemma CB2_5_1I2R8P_sound (a : Fin 6) : + (CB2_5_1I2R8P a).Encloses (CB2_5_1I2R8Value a) := + contains_sound (CB2_5_1I2R8Raw_sound a) (CB2_5_1I2R8P_check a) +def CB2_5_1I2R8Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_5_1I2R8Certificates (CB2_5_1I2R8CertificateIndex a)).output +lemma CB2_5_1I2R8Terms_sound (a : Fin 6) : + (CB2_5_1I2R8Terms a).Encloses (Foundation.entropyTerm (CB2_5_1I2R8Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB2_5_1I2R8Certificates_valid + (CB2_5_1I2R8CertificateIndex a) (CB2_5_1I2R8P_sound a) +def CB2_5_1I2R8Entropy : Ball := ⟨0, 0⟩ +lemma CB2_5_1I2R8Entropy_sound : CB2_5_1I2R8Entropy.Encloses (Foundation.finiteEntropy CB2_5_1I2R8Value) := by + exact contains_sound (entropyFin_enclosed 6 CB2_5_1I2R8Value CB2_5_1I2R8Terms CB2_5_1I2R8Terms_sound) (by decide +kernel) +def CB2_5_1I2R8Mass : Ball := ⟨0, 0⟩ +lemma CB2_5_1I2R8Mass_sound : CB2_5_1I2R8Mass.Encloses (∑ a, CB2_5_1I2R8Value a) := by + exact contains_sound (finSumBall_sound 6 CB2_5_1I2R8P CB2_5_1I2R8Value CB2_5_1I2R8P_sound) (by decide +kernel) +def CB2_5_1I2R8MassTerm : Ball := .exact 0 +lemma CB2_5_1I2R8MassTerm_sound : CB2_5_1I2R8MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB2_5_1I2R8Value a))) := + entropyTerm_zero_ball (CB2_5_1I2R8Mass_sound) +def CB2_5_1I2R8H : Ball := ⟨0, 0⟩ +lemma CB2_5_1I2R8H_sound : CB2_5_1I2R8H.Encloses (homogeneousEntropy CB2_5_1I2R8Value) := by + exact contains_sound (homogeneous_enclosed CB2_5_1I2R8Value CB2_5_1I2R8MassTerm_sound CB2_5_1I2R8Entropy_sound) (by decide +kernel) +def CB2_5_1I2R9Value (a : Fin 6) : ℝ := residualLaw (below (shape 2 5 1)) (fun u => (stageBLaw (shape 2 5 1) u : ℝ)) (stageBPriority (shape 2 5 1)) 2 (fun u a => (littleLaw (shape 2 5 1) u ((stageBPriority (shape 2 5 1)) 2) a : ℝ)) 9 a +def CB2_5_1I2R9Raw (a : Fin 6) : Ball := residualBall (below (shape 2 5 1)) B2_5_1Law (stageBPriority (shape 2 5 1)) 2 (fun u => B2_5_1Little u ((stageBPriority (shape 2 5 1)) 2)) 9 a +lemma CB2_5_1I2R9Raw_sound (a : Fin 6) : + (CB2_5_1I2R9Raw a).Encloses (CB2_5_1I2R9Value a) := by + exact residualBall_sound_on (below (shape 2 5 1)) B2_5_1Law (fun u => (stageBLaw (shape 2 5 1) u : ℝ)) (stageBPriority (shape 2 5 1)) 2 (fun u => B2_5_1Little u ((stageBPriority (shape 2 5 1)) 2)) (fun u a => (littleLaw (shape 2 5 1) u ((stageBPriority (shape 2 5 1)) 2) a : ℝ)) (fun u _ => B2_5_1Law_sound u) (fun u _ a => B2_5_1Little_sound u ((stageBPriority (shape 2 5 1)) 2) a) 9 a +def CB2_5_1I2R9Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB2_5_1I2R9Certificates_valid : + CB2_5_1I2R9Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB2_5_1I2R9CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB2_5_1I2R9P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_5_1I2R9Certificates (CB2_5_1I2R9CertificateIndex a)).input +lemma CB2_5_1I2R9P_check : ∀ a : Fin 6, contains (CB2_5_1I2R9Raw a) (CB2_5_1I2R9P a) = true := by + decide +kernel +lemma CB2_5_1I2R9P_sound (a : Fin 6) : + (CB2_5_1I2R9P a).Encloses (CB2_5_1I2R9Value a) := + contains_sound (CB2_5_1I2R9Raw_sound a) (CB2_5_1I2R9P_check a) +def CB2_5_1I2R9Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_5_1I2R9Certificates (CB2_5_1I2R9CertificateIndex a)).output +lemma CB2_5_1I2R9Terms_sound (a : Fin 6) : + (CB2_5_1I2R9Terms a).Encloses (Foundation.entropyTerm (CB2_5_1I2R9Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB2_5_1I2R9Certificates_valid + (CB2_5_1I2R9CertificateIndex a) (CB2_5_1I2R9P_sound a) +def CB2_5_1I2R9Entropy : Ball := ⟨0, 0⟩ +lemma CB2_5_1I2R9Entropy_sound : CB2_5_1I2R9Entropy.Encloses (Foundation.finiteEntropy CB2_5_1I2R9Value) := by + exact contains_sound (entropyFin_enclosed 6 CB2_5_1I2R9Value CB2_5_1I2R9Terms CB2_5_1I2R9Terms_sound) (by decide +kernel) +def CB2_5_1I2R9Mass : Ball := ⟨0, 0⟩ +lemma CB2_5_1I2R9Mass_sound : CB2_5_1I2R9Mass.Encloses (∑ a, CB2_5_1I2R9Value a) := by + exact contains_sound (finSumBall_sound 6 CB2_5_1I2R9P CB2_5_1I2R9Value CB2_5_1I2R9P_sound) (by decide +kernel) +def CB2_5_1I2R9MassTerm : Ball := .exact 0 +lemma CB2_5_1I2R9MassTerm_sound : CB2_5_1I2R9MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB2_5_1I2R9Value a))) := + entropyTerm_zero_ball (CB2_5_1I2R9Mass_sound) +def CB2_5_1I2R9H : Ball := ⟨0, 0⟩ +lemma CB2_5_1I2R9H_sound : CB2_5_1I2R9H.Encloses (homogeneousEntropy CB2_5_1I2R9Value) := by + exact contains_sound (homogeneous_enclosed CB2_5_1I2R9Value CB2_5_1I2R9MassTerm_sound CB2_5_1I2R9Entropy_sound) (by decide +kernel) +def CB2_5_1I2R10Value (a : Fin 6) : ℝ := residualLaw (below (shape 2 5 1)) (fun u => (stageBLaw (shape 2 5 1) u : ℝ)) (stageBPriority (shape 2 5 1)) 2 (fun u a => (littleLaw (shape 2 5 1) u ((stageBPriority (shape 2 5 1)) 2) a : ℝ)) 10 a +def CB2_5_1I2R10Raw (a : Fin 6) : Ball := residualBall (below (shape 2 5 1)) B2_5_1Law (stageBPriority (shape 2 5 1)) 2 (fun u => B2_5_1Little u ((stageBPriority (shape 2 5 1)) 2)) 10 a +lemma CB2_5_1I2R10Raw_sound (a : Fin 6) : + (CB2_5_1I2R10Raw a).Encloses (CB2_5_1I2R10Value a) := by + exact residualBall_sound_on (below (shape 2 5 1)) B2_5_1Law (fun u => (stageBLaw (shape 2 5 1) u : ℝ)) (stageBPriority (shape 2 5 1)) 2 (fun u => B2_5_1Little u ((stageBPriority (shape 2 5 1)) 2)) (fun u a => (littleLaw (shape 2 5 1) u ((stageBPriority (shape 2 5 1)) 2) a : ℝ)) (fun u _ => B2_5_1Law_sound u) (fun u _ a => B2_5_1Little_sound u ((stageBPriority (shape 2 5 1)) 2) a) 10 a +def CB2_5_1I2R10Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB2_5_1I2R10Certificates_valid : + CB2_5_1I2R10Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB2_5_1I2R10CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB2_5_1I2R10P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_5_1I2R10Certificates (CB2_5_1I2R10CertificateIndex a)).input +lemma CB2_5_1I2R10P_check : ∀ a : Fin 6, contains (CB2_5_1I2R10Raw a) (CB2_5_1I2R10P a) = true := by + decide +kernel +lemma CB2_5_1I2R10P_sound (a : Fin 6) : + (CB2_5_1I2R10P a).Encloses (CB2_5_1I2R10Value a) := + contains_sound (CB2_5_1I2R10Raw_sound a) (CB2_5_1I2R10P_check a) +def CB2_5_1I2R10Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_5_1I2R10Certificates (CB2_5_1I2R10CertificateIndex a)).output +lemma CB2_5_1I2R10Terms_sound (a : Fin 6) : + (CB2_5_1I2R10Terms a).Encloses (Foundation.entropyTerm (CB2_5_1I2R10Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB2_5_1I2R10Certificates_valid + (CB2_5_1I2R10CertificateIndex a) (CB2_5_1I2R10P_sound a) +def CB2_5_1I2R10Entropy : Ball := ⟨0, 0⟩ +lemma CB2_5_1I2R10Entropy_sound : CB2_5_1I2R10Entropy.Encloses (Foundation.finiteEntropy CB2_5_1I2R10Value) := by + exact contains_sound (entropyFin_enclosed 6 CB2_5_1I2R10Value CB2_5_1I2R10Terms CB2_5_1I2R10Terms_sound) (by decide +kernel) +def CB2_5_1I2R10Mass : Ball := ⟨0, 0⟩ +lemma CB2_5_1I2R10Mass_sound : CB2_5_1I2R10Mass.Encloses (∑ a, CB2_5_1I2R10Value a) := by + exact contains_sound (finSumBall_sound 6 CB2_5_1I2R10P CB2_5_1I2R10Value CB2_5_1I2R10P_sound) (by decide +kernel) +def CB2_5_1I2R10MassTerm : Ball := .exact 0 +lemma CB2_5_1I2R10MassTerm_sound : CB2_5_1I2R10MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB2_5_1I2R10Value a))) := + entropyTerm_zero_ball (CB2_5_1I2R10Mass_sound) +def CB2_5_1I2R10H : Ball := ⟨0, 0⟩ +lemma CB2_5_1I2R10H_sound : CB2_5_1I2R10H.Encloses (homogeneousEntropy CB2_5_1I2R10Value) := by + exact contains_sound (homogeneous_enclosed CB2_5_1I2R10Value CB2_5_1I2R10MassTerm_sound CB2_5_1I2R10Entropy_sound) (by decide +kernel) +def CB2_5_1I2R11Value (a : Fin 6) : ℝ := residualLaw (below (shape 2 5 1)) (fun u => (stageBLaw (shape 2 5 1) u : ℝ)) (stageBPriority (shape 2 5 1)) 2 (fun u a => (littleLaw (shape 2 5 1) u ((stageBPriority (shape 2 5 1)) 2) a : ℝ)) 11 a +def CB2_5_1I2R11Raw (a : Fin 6) : Ball := residualBall (below (shape 2 5 1)) B2_5_1Law (stageBPriority (shape 2 5 1)) 2 (fun u => B2_5_1Little u ((stageBPriority (shape 2 5 1)) 2)) 11 a +lemma CB2_5_1I2R11Raw_sound (a : Fin 6) : + (CB2_5_1I2R11Raw a).Encloses (CB2_5_1I2R11Value a) := by + exact residualBall_sound_on (below (shape 2 5 1)) B2_5_1Law (fun u => (stageBLaw (shape 2 5 1) u : ℝ)) (stageBPriority (shape 2 5 1)) 2 (fun u => B2_5_1Little u ((stageBPriority (shape 2 5 1)) 2)) (fun u a => (littleLaw (shape 2 5 1) u ((stageBPriority (shape 2 5 1)) 2) a : ℝ)) (fun u _ => B2_5_1Law_sound u) (fun u _ a => B2_5_1Little_sound u ((stageBPriority (shape 2 5 1)) 2) a) 11 a +def CB2_5_1I2R11Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB2_5_1I2R11Certificates_valid : + CB2_5_1I2R11Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB2_5_1I2R11CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB2_5_1I2R11P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_5_1I2R11Certificates (CB2_5_1I2R11CertificateIndex a)).input +lemma CB2_5_1I2R11P_check : ∀ a : Fin 6, contains (CB2_5_1I2R11Raw a) (CB2_5_1I2R11P a) = true := by + decide +kernel +lemma CB2_5_1I2R11P_sound (a : Fin 6) : + (CB2_5_1I2R11P a).Encloses (CB2_5_1I2R11Value a) := + contains_sound (CB2_5_1I2R11Raw_sound a) (CB2_5_1I2R11P_check a) +def CB2_5_1I2R11Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_5_1I2R11Certificates (CB2_5_1I2R11CertificateIndex a)).output +lemma CB2_5_1I2R11Terms_sound (a : Fin 6) : + (CB2_5_1I2R11Terms a).Encloses (Foundation.entropyTerm (CB2_5_1I2R11Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB2_5_1I2R11Certificates_valid + (CB2_5_1I2R11CertificateIndex a) (CB2_5_1I2R11P_sound a) +def CB2_5_1I2R11Entropy : Ball := ⟨0, 0⟩ +lemma CB2_5_1I2R11Entropy_sound : CB2_5_1I2R11Entropy.Encloses (Foundation.finiteEntropy CB2_5_1I2R11Value) := by + exact contains_sound (entropyFin_enclosed 6 CB2_5_1I2R11Value CB2_5_1I2R11Terms CB2_5_1I2R11Terms_sound) (by decide +kernel) +def CB2_5_1I2R11Mass : Ball := ⟨0, 0⟩ +lemma CB2_5_1I2R11Mass_sound : CB2_5_1I2R11Mass.Encloses (∑ a, CB2_5_1I2R11Value a) := by + exact contains_sound (finSumBall_sound 6 CB2_5_1I2R11P CB2_5_1I2R11Value CB2_5_1I2R11P_sound) (by decide +kernel) +def CB2_5_1I2R11MassTerm : Ball := .exact 0 +lemma CB2_5_1I2R11MassTerm_sound : CB2_5_1I2R11MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB2_5_1I2R11Value a))) := + entropyTerm_zero_ball (CB2_5_1I2R11Mass_sound) +def CB2_5_1I2R11H : Ball := ⟨0, 0⟩ +lemma CB2_5_1I2R11H_sound : CB2_5_1I2R11H.Encloses (homogeneousEntropy CB2_5_1I2R11Value) := by + exact contains_sound (homogeneous_enclosed CB2_5_1I2R11Value CB2_5_1I2R11MassTerm_sound CB2_5_1I2R11Entropy_sound) (by decide +kernel) +def CB2_5_1I2R12Value (a : Fin 6) : ℝ := residualLaw (below (shape 2 5 1)) (fun u => (stageBLaw (shape 2 5 1) u : ℝ)) (stageBPriority (shape 2 5 1)) 2 (fun u a => (littleLaw (shape 2 5 1) u ((stageBPriority (shape 2 5 1)) 2) a : ℝ)) 12 a +def CB2_5_1I2R12Raw (a : Fin 6) : Ball := residualBall (below (shape 2 5 1)) B2_5_1Law (stageBPriority (shape 2 5 1)) 2 (fun u => B2_5_1Little u ((stageBPriority (shape 2 5 1)) 2)) 12 a +lemma CB2_5_1I2R12Raw_sound (a : Fin 6) : + (CB2_5_1I2R12Raw a).Encloses (CB2_5_1I2R12Value a) := by + exact residualBall_sound_on (below (shape 2 5 1)) B2_5_1Law (fun u => (stageBLaw (shape 2 5 1) u : ℝ)) (stageBPriority (shape 2 5 1)) 2 (fun u => B2_5_1Little u ((stageBPriority (shape 2 5 1)) 2)) (fun u a => (littleLaw (shape 2 5 1) u ((stageBPriority (shape 2 5 1)) 2) a : ℝ)) (fun u _ => B2_5_1Law_sound u) (fun u _ a => B2_5_1Little_sound u ((stageBPriority (shape 2 5 1)) 2) a) 12 a +def CB2_5_1I2R12Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB2_5_1I2R12Certificates_valid : + CB2_5_1I2R12Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB2_5_1I2R12CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB2_5_1I2R12P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_5_1I2R12Certificates (CB2_5_1I2R12CertificateIndex a)).input +lemma CB2_5_1I2R12P_check : ∀ a : Fin 6, contains (CB2_5_1I2R12Raw a) (CB2_5_1I2R12P a) = true := by + decide +kernel +lemma CB2_5_1I2R12P_sound (a : Fin 6) : + (CB2_5_1I2R12P a).Encloses (CB2_5_1I2R12Value a) := + contains_sound (CB2_5_1I2R12Raw_sound a) (CB2_5_1I2R12P_check a) +def CB2_5_1I2R12Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_5_1I2R12Certificates (CB2_5_1I2R12CertificateIndex a)).output +lemma CB2_5_1I2R12Terms_sound (a : Fin 6) : + (CB2_5_1I2R12Terms a).Encloses (Foundation.entropyTerm (CB2_5_1I2R12Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB2_5_1I2R12Certificates_valid + (CB2_5_1I2R12CertificateIndex a) (CB2_5_1I2R12P_sound a) +def CB2_5_1I2R12Entropy : Ball := ⟨0, 0⟩ +lemma CB2_5_1I2R12Entropy_sound : CB2_5_1I2R12Entropy.Encloses (Foundation.finiteEntropy CB2_5_1I2R12Value) := by + exact contains_sound (entropyFin_enclosed 6 CB2_5_1I2R12Value CB2_5_1I2R12Terms CB2_5_1I2R12Terms_sound) (by decide +kernel) +def CB2_5_1I2R12Mass : Ball := ⟨0, 0⟩ +lemma CB2_5_1I2R12Mass_sound : CB2_5_1I2R12Mass.Encloses (∑ a, CB2_5_1I2R12Value a) := by + exact contains_sound (finSumBall_sound 6 CB2_5_1I2R12P CB2_5_1I2R12Value CB2_5_1I2R12P_sound) (by decide +kernel) +def CB2_5_1I2R12MassTerm : Ball := .exact 0 +lemma CB2_5_1I2R12MassTerm_sound : CB2_5_1I2R12MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB2_5_1I2R12Value a))) := + entropyTerm_zero_ball (CB2_5_1I2R12Mass_sound) +def CB2_5_1I2R12H : Ball := ⟨0, 0⟩ +lemma CB2_5_1I2R12H_sound : CB2_5_1I2R12H.Encloses (homogeneousEntropy CB2_5_1I2R12Value) := by + exact contains_sound (homogeneous_enclosed CB2_5_1I2R12Value CB2_5_1I2R12MassTerm_sound CB2_5_1I2R12Entropy_sound) (by decide +kernel) +def CB2_5_1I2R13Value (a : Fin 6) : ℝ := residualLaw (below (shape 2 5 1)) (fun u => (stageBLaw (shape 2 5 1) u : ℝ)) (stageBPriority (shape 2 5 1)) 2 (fun u a => (littleLaw (shape 2 5 1) u ((stageBPriority (shape 2 5 1)) 2) a : ℝ)) 13 a +def CB2_5_1I2R13Raw (a : Fin 6) : Ball := residualBall (below (shape 2 5 1)) B2_5_1Law (stageBPriority (shape 2 5 1)) 2 (fun u => B2_5_1Little u ((stageBPriority (shape 2 5 1)) 2)) 13 a +lemma CB2_5_1I2R13Raw_sound (a : Fin 6) : + (CB2_5_1I2R13Raw a).Encloses (CB2_5_1I2R13Value a) := by + exact residualBall_sound_on (below (shape 2 5 1)) B2_5_1Law (fun u => (stageBLaw (shape 2 5 1) u : ℝ)) (stageBPriority (shape 2 5 1)) 2 (fun u => B2_5_1Little u ((stageBPriority (shape 2 5 1)) 2)) (fun u a => (littleLaw (shape 2 5 1) u ((stageBPriority (shape 2 5 1)) 2) a : ℝ)) (fun u _ => B2_5_1Law_sound u) (fun u _ a => B2_5_1Little_sound u ((stageBPriority (shape 2 5 1)) 2) a) 13 a +def CB2_5_1I2R13Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB2_5_1I2R13Certificates_valid : + CB2_5_1I2R13Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB2_5_1I2R13CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB2_5_1I2R13P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_5_1I2R13Certificates (CB2_5_1I2R13CertificateIndex a)).input +lemma CB2_5_1I2R13P_check : ∀ a : Fin 6, contains (CB2_5_1I2R13Raw a) (CB2_5_1I2R13P a) = true := by + decide +kernel +lemma CB2_5_1I2R13P_sound (a : Fin 6) : + (CB2_5_1I2R13P a).Encloses (CB2_5_1I2R13Value a) := + contains_sound (CB2_5_1I2R13Raw_sound a) (CB2_5_1I2R13P_check a) +def CB2_5_1I2R13Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_5_1I2R13Certificates (CB2_5_1I2R13CertificateIndex a)).output +lemma CB2_5_1I2R13Terms_sound (a : Fin 6) : + (CB2_5_1I2R13Terms a).Encloses (Foundation.entropyTerm (CB2_5_1I2R13Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB2_5_1I2R13Certificates_valid + (CB2_5_1I2R13CertificateIndex a) (CB2_5_1I2R13P_sound a) +def CB2_5_1I2R13Entropy : Ball := ⟨0, 0⟩ +lemma CB2_5_1I2R13Entropy_sound : CB2_5_1I2R13Entropy.Encloses (Foundation.finiteEntropy CB2_5_1I2R13Value) := by + exact contains_sound (entropyFin_enclosed 6 CB2_5_1I2R13Value CB2_5_1I2R13Terms CB2_5_1I2R13Terms_sound) (by decide +kernel) +def CB2_5_1I2R13Mass : Ball := ⟨0, 0⟩ +lemma CB2_5_1I2R13Mass_sound : CB2_5_1I2R13Mass.Encloses (∑ a, CB2_5_1I2R13Value a) := by + exact contains_sound (finSumBall_sound 6 CB2_5_1I2R13P CB2_5_1I2R13Value CB2_5_1I2R13P_sound) (by decide +kernel) +def CB2_5_1I2R13MassTerm : Ball := .exact 0 +lemma CB2_5_1I2R13MassTerm_sound : CB2_5_1I2R13MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB2_5_1I2R13Value a))) := + entropyTerm_zero_ball (CB2_5_1I2R13Mass_sound) +def CB2_5_1I2R13H : Ball := ⟨0, 0⟩ +lemma CB2_5_1I2R13H_sound : CB2_5_1I2R13H.Encloses (homogeneousEntropy CB2_5_1I2R13Value) := by + exact contains_sound (homogeneous_enclosed CB2_5_1I2R13Value CB2_5_1I2R13MassTerm_sound CB2_5_1I2R13Entropy_sound) (by decide +kernel) +def CB2_5_1I2R14Value (a : Fin 6) : ℝ := residualLaw (below (shape 2 5 1)) (fun u => (stageBLaw (shape 2 5 1) u : ℝ)) (stageBPriority (shape 2 5 1)) 2 (fun u a => (littleLaw (shape 2 5 1) u ((stageBPriority (shape 2 5 1)) 2) a : ℝ)) 14 a +def CB2_5_1I2R14Raw (a : Fin 6) : Ball := residualBall (below (shape 2 5 1)) B2_5_1Law (stageBPriority (shape 2 5 1)) 2 (fun u => B2_5_1Little u ((stageBPriority (shape 2 5 1)) 2)) 14 a +lemma CB2_5_1I2R14Raw_sound (a : Fin 6) : + (CB2_5_1I2R14Raw a).Encloses (CB2_5_1I2R14Value a) := by + exact residualBall_sound_on (below (shape 2 5 1)) B2_5_1Law (fun u => (stageBLaw (shape 2 5 1) u : ℝ)) (stageBPriority (shape 2 5 1)) 2 (fun u => B2_5_1Little u ((stageBPriority (shape 2 5 1)) 2)) (fun u a => (littleLaw (shape 2 5 1) u ((stageBPriority (shape 2 5 1)) 2) a : ℝ)) (fun u _ => B2_5_1Law_sound u) (fun u _ a => B2_5_1Little_sound u ((stageBPriority (shape 2 5 1)) 2) a) 14 a +def CB2_5_1I2R14Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB2_5_1I2R14Certificates_valid : + CB2_5_1I2R14Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB2_5_1I2R14CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB2_5_1I2R14P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_5_1I2R14Certificates (CB2_5_1I2R14CertificateIndex a)).input +lemma CB2_5_1I2R14P_check : ∀ a : Fin 6, contains (CB2_5_1I2R14Raw a) (CB2_5_1I2R14P a) = true := by + decide +kernel +lemma CB2_5_1I2R14P_sound (a : Fin 6) : + (CB2_5_1I2R14P a).Encloses (CB2_5_1I2R14Value a) := + contains_sound (CB2_5_1I2R14Raw_sound a) (CB2_5_1I2R14P_check a) +def CB2_5_1I2R14Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_5_1I2R14Certificates (CB2_5_1I2R14CertificateIndex a)).output +lemma CB2_5_1I2R14Terms_sound (a : Fin 6) : + (CB2_5_1I2R14Terms a).Encloses (Foundation.entropyTerm (CB2_5_1I2R14Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB2_5_1I2R14Certificates_valid + (CB2_5_1I2R14CertificateIndex a) (CB2_5_1I2R14P_sound a) +def CB2_5_1I2R14Entropy : Ball := ⟨0, 0⟩ +lemma CB2_5_1I2R14Entropy_sound : CB2_5_1I2R14Entropy.Encloses (Foundation.finiteEntropy CB2_5_1I2R14Value) := by + exact contains_sound (entropyFin_enclosed 6 CB2_5_1I2R14Value CB2_5_1I2R14Terms CB2_5_1I2R14Terms_sound) (by decide +kernel) +def CB2_5_1I2R14Mass : Ball := ⟨0, 0⟩ +lemma CB2_5_1I2R14Mass_sound : CB2_5_1I2R14Mass.Encloses (∑ a, CB2_5_1I2R14Value a) := by + exact contains_sound (finSumBall_sound 6 CB2_5_1I2R14P CB2_5_1I2R14Value CB2_5_1I2R14P_sound) (by decide +kernel) +def CB2_5_1I2R14MassTerm : Ball := .exact 0 +lemma CB2_5_1I2R14MassTerm_sound : CB2_5_1I2R14MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB2_5_1I2R14Value a))) := + entropyTerm_zero_ball (CB2_5_1I2R14Mass_sound) +def CB2_5_1I2R14H : Ball := ⟨0, 0⟩ +lemma CB2_5_1I2R14H_sound : CB2_5_1I2R14H.Encloses (homogeneousEntropy CB2_5_1I2R14Value) := by + exact contains_sound (homogeneous_enclosed CB2_5_1I2R14Value CB2_5_1I2R14MassTerm_sound CB2_5_1I2R14Entropy_sound) (by decide +kernel) +def CB2_5_1I2R15Value (a : Fin 6) : ℝ := residualLaw (below (shape 2 5 1)) (fun u => (stageBLaw (shape 2 5 1) u : ℝ)) (stageBPriority (shape 2 5 1)) 2 (fun u a => (littleLaw (shape 2 5 1) u ((stageBPriority (shape 2 5 1)) 2) a : ℝ)) 15 a +def CB2_5_1I2R15Raw (a : Fin 6) : Ball := residualBall (below (shape 2 5 1)) B2_5_1Law (stageBPriority (shape 2 5 1)) 2 (fun u => B2_5_1Little u ((stageBPriority (shape 2 5 1)) 2)) 15 a +lemma CB2_5_1I2R15Raw_sound (a : Fin 6) : + (CB2_5_1I2R15Raw a).Encloses (CB2_5_1I2R15Value a) := by + exact residualBall_sound_on (below (shape 2 5 1)) B2_5_1Law (fun u => (stageBLaw (shape 2 5 1) u : ℝ)) (stageBPriority (shape 2 5 1)) 2 (fun u => B2_5_1Little u ((stageBPriority (shape 2 5 1)) 2)) (fun u a => (littleLaw (shape 2 5 1) u ((stageBPriority (shape 2 5 1)) 2) a : ℝ)) (fun u _ => B2_5_1Law_sound u) (fun u _ a => B2_5_1Little_sound u ((stageBPriority (shape 2 5 1)) 2) a) 15 a +def CB2_5_1I2R15Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB2_5_1I2R15Certificates_valid : + CB2_5_1I2R15Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB2_5_1I2R15CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB2_5_1I2R15P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_5_1I2R15Certificates (CB2_5_1I2R15CertificateIndex a)).input +lemma CB2_5_1I2R15P_check : ∀ a : Fin 6, contains (CB2_5_1I2R15Raw a) (CB2_5_1I2R15P a) = true := by + decide +kernel +lemma CB2_5_1I2R15P_sound (a : Fin 6) : + (CB2_5_1I2R15P a).Encloses (CB2_5_1I2R15Value a) := + contains_sound (CB2_5_1I2R15Raw_sound a) (CB2_5_1I2R15P_check a) +def CB2_5_1I2R15Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_5_1I2R15Certificates (CB2_5_1I2R15CertificateIndex a)).output +lemma CB2_5_1I2R15Terms_sound (a : Fin 6) : + (CB2_5_1I2R15Terms a).Encloses (Foundation.entropyTerm (CB2_5_1I2R15Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB2_5_1I2R15Certificates_valid + (CB2_5_1I2R15CertificateIndex a) (CB2_5_1I2R15P_sound a) +def CB2_5_1I2R15Entropy : Ball := ⟨0, 0⟩ +lemma CB2_5_1I2R15Entropy_sound : CB2_5_1I2R15Entropy.Encloses (Foundation.finiteEntropy CB2_5_1I2R15Value) := by + exact contains_sound (entropyFin_enclosed 6 CB2_5_1I2R15Value CB2_5_1I2R15Terms CB2_5_1I2R15Terms_sound) (by decide +kernel) +def CB2_5_1I2R15Mass : Ball := ⟨0, 0⟩ +lemma CB2_5_1I2R15Mass_sound : CB2_5_1I2R15Mass.Encloses (∑ a, CB2_5_1I2R15Value a) := by + exact contains_sound (finSumBall_sound 6 CB2_5_1I2R15P CB2_5_1I2R15Value CB2_5_1I2R15P_sound) (by decide +kernel) +def CB2_5_1I2R15MassTerm : Ball := .exact 0 +lemma CB2_5_1I2R15MassTerm_sound : CB2_5_1I2R15MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB2_5_1I2R15Value a))) := + entropyTerm_zero_ball (CB2_5_1I2R15Mass_sound) +def CB2_5_1I2R15H : Ball := ⟨0, 0⟩ +lemma CB2_5_1I2R15H_sound : CB2_5_1I2R15H.Encloses (homogeneousEntropy CB2_5_1I2R15Value) := by + exact contains_sound (homogeneous_enclosed CB2_5_1I2R15Value CB2_5_1I2R15MassTerm_sound CB2_5_1I2R15Entropy_sound) (by decide +kernel) +def CB2_5_1I2R16Value (a : Fin 6) : ℝ := residualLaw (below (shape 2 5 1)) (fun u => (stageBLaw (shape 2 5 1) u : ℝ)) (stageBPriority (shape 2 5 1)) 2 (fun u a => (littleLaw (shape 2 5 1) u ((stageBPriority (shape 2 5 1)) 2) a : ℝ)) 16 a +def CB2_5_1I2R16Raw (a : Fin 6) : Ball := residualBall (below (shape 2 5 1)) B2_5_1Law (stageBPriority (shape 2 5 1)) 2 (fun u => B2_5_1Little u ((stageBPriority (shape 2 5 1)) 2)) 16 a +lemma CB2_5_1I2R16Raw_sound (a : Fin 6) : + (CB2_5_1I2R16Raw a).Encloses (CB2_5_1I2R16Value a) := by + exact residualBall_sound_on (below (shape 2 5 1)) B2_5_1Law (fun u => (stageBLaw (shape 2 5 1) u : ℝ)) (stageBPriority (shape 2 5 1)) 2 (fun u => B2_5_1Little u ((stageBPriority (shape 2 5 1)) 2)) (fun u a => (littleLaw (shape 2 5 1) u ((stageBPriority (shape 2 5 1)) 2) a : ℝ)) (fun u _ => B2_5_1Law_sound u) (fun u _ a => B2_5_1Little_sound u ((stageBPriority (shape 2 5 1)) 2) a) 16 a +def CB2_5_1I2R16Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB2_5_1I2R16Certificates_valid : + CB2_5_1I2R16Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB2_5_1I2R16CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB2_5_1I2R16P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_5_1I2R16Certificates (CB2_5_1I2R16CertificateIndex a)).input +lemma CB2_5_1I2R16P_check : ∀ a : Fin 6, contains (CB2_5_1I2R16Raw a) (CB2_5_1I2R16P a) = true := by + decide +kernel +lemma CB2_5_1I2R16P_sound (a : Fin 6) : + (CB2_5_1I2R16P a).Encloses (CB2_5_1I2R16Value a) := + contains_sound (CB2_5_1I2R16Raw_sound a) (CB2_5_1I2R16P_check a) +def CB2_5_1I2R16Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB2_5_1I2R16Certificates (CB2_5_1I2R16CertificateIndex a)).output +lemma CB2_5_1I2R16Terms_sound (a : Fin 6) : + (CB2_5_1I2R16Terms a).Encloses (Foundation.entropyTerm (CB2_5_1I2R16Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB2_5_1I2R16Certificates_valid + (CB2_5_1I2R16CertificateIndex a) (CB2_5_1I2R16P_sound a) +def CB2_5_1I2R16Entropy : Ball := ⟨0, 0⟩ +lemma CB2_5_1I2R16Entropy_sound : CB2_5_1I2R16Entropy.Encloses (Foundation.finiteEntropy CB2_5_1I2R16Value) := by + exact contains_sound (entropyFin_enclosed 6 CB2_5_1I2R16Value CB2_5_1I2R16Terms CB2_5_1I2R16Terms_sound) (by decide +kernel) +def CB2_5_1I2R16Mass : Ball := ⟨0, 0⟩ +lemma CB2_5_1I2R16Mass_sound : CB2_5_1I2R16Mass.Encloses (∑ a, CB2_5_1I2R16Value a) := by + exact contains_sound (finSumBall_sound 6 CB2_5_1I2R16P CB2_5_1I2R16Value CB2_5_1I2R16P_sound) (by decide +kernel) +def CB2_5_1I2R16MassTerm : Ball := .exact 0 +lemma CB2_5_1I2R16MassTerm_sound : CB2_5_1I2R16MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB2_5_1I2R16Value a))) := + entropyTerm_zero_ball (CB2_5_1I2R16Mass_sound) +def CB2_5_1I2R16H : Ball := ⟨0, 0⟩ +lemma CB2_5_1I2R16H_sound : CB2_5_1I2R16H.Encloses (homogeneousEntropy CB2_5_1I2R16Value) := by + exact contains_sound (homogeneous_enclosed CB2_5_1I2R16Value CB2_5_1I2R16MassTerm_sound CB2_5_1I2R16Entropy_sound) (by decide +kernel) +def CB2_5_1I2ResidualEntropies (a : Fin 17) : Ball := + match a.val with + | 0 => CB2_5_1I2R0H + | 1 => CB2_5_1I2R1H + | 2 => CB2_5_1I2R2H + | 3 => CB2_5_1I2R3H + | 4 => CB2_5_1I2R4H + | 5 => CB2_5_1I2R5H + | 6 => CB2_5_1I2R6H + | 7 => CB2_5_1I2R7H + | 8 => CB2_5_1I2R8H + | 9 => CB2_5_1I2R9H + | 10 => CB2_5_1I2R10H + | 11 => CB2_5_1I2R11H + | 12 => CB2_5_1I2R12H + | 13 => CB2_5_1I2R13H + | 14 => CB2_5_1I2R14H + | 15 => CB2_5_1I2R15H + | 16 => CB2_5_1I2R16H + | _ => (.exact 0) +lemma CB2_5_1I2ResidualEntropies_sound (k : Fin 17) : + (CB2_5_1I2ResidualEntropies k).Encloses (homogeneousEntropy + (residualLaw (below (shape 2 5 1)) (fun u => (stageBLaw (shape 2 5 1) u : ℝ)) (stageBPriority (shape 2 5 1)) 2 (fun u a => (littleLaw (shape 2 5 1) u ((stageBPriority (shape 2 5 1)) 2) a : ℝ)) k)) := by + fin_cases k + · exact CB2_5_1I2R0H_sound + · exact CB2_5_1I2R1H_sound + · exact CB2_5_1I2R2H_sound + · exact CB2_5_1I2R3H_sound + · exact CB2_5_1I2R4H_sound + · exact CB2_5_1I2R5H_sound + · exact CB2_5_1I2R6H_sound + · exact CB2_5_1I2R7H_sound + · exact CB2_5_1I2R8H_sound + · exact CB2_5_1I2R9H_sound + · exact CB2_5_1I2R10H_sound + · exact CB2_5_1I2R11H_sound + · exact CB2_5_1I2R12H_sound + · exact CB2_5_1I2R13H_sound + · exact CB2_5_1I2R14H_sound + · exact CB2_5_1I2R15H_sound + · exact CB2_5_1I2R16H_sound +def CB2_5_1I2S0_3_1Value (a : Fin 6) : ℝ := (littleLaw (shape 2 5 1) (shape 0 3 1) ((stageBPriority (shape 2 5 1)) 2) a : ℝ) +def CB2_5_1I2S0_3_1E_4Log : Ball := .exact 0 +lemma CB2_5_1I2S0_3_1E_4Log_sound : CB2_5_1I2S0_3_1E_4Log.Encloses (Real.log (CB2_5_1I2S0_3_1Value (4 : Fin 6))) := by + exact log_exact_one_ball ((B2_5_1Little_sound (shape 0 3 1) ((stageBPriority (shape 2 5 1)) 2)) (4 : Fin 6)) +def CB2_5_1I2S0_3_1E_4 : Ball := ⟨0, 0⟩ +lemma CB2_5_1I2S0_3_1E_4_sound : CB2_5_1I2S0_3_1E_4.Encloses (Foundation.entropyTerm (CB2_5_1I2S0_3_1Value (4 : Fin 6))) := by + exact contains_sound (entropyTerm_ball ((B2_5_1Little_sound (shape 0 3 1) ((stageBPriority (shape 2 5 1)) 2)) (4 : Fin 6)) CB2_5_1I2S0_3_1E_4Log_sound) (by decide +kernel) +def CB2_5_1I2S0_3_1Terms (a : Fin 6) : Ball := + match a.val with + | 4 => ⟨0, 0⟩ + | _ => (.exact 0) +lemma CB2_5_1I2S0_3_1Terms_sound (a : Fin 6) : + (CB2_5_1I2S0_3_1Terms a).Encloses (Foundation.entropyTerm (CB2_5_1I2S0_3_1Value a)) := by + fin_cases a + · exact (entropyTerm_zero_ball ((B2_5_1Little_sound (shape 0 3 1) ((stageBPriority (shape 2 5 1)) 2)) (0 : Fin 6))) + · exact (entropyTerm_zero_ball ((B2_5_1Little_sound (shape 0 3 1) ((stageBPriority (shape 2 5 1)) 2)) (1 : Fin 6))) + · exact (entropyTerm_zero_ball ((B2_5_1Little_sound (shape 0 3 1) ((stageBPriority (shape 2 5 1)) 2)) (2 : Fin 6))) + · exact (entropyTerm_zero_ball ((B2_5_1Little_sound (shape 0 3 1) ((stageBPriority (shape 2 5 1)) 2)) (3 : Fin 6))) + · exact CB2_5_1I2S0_3_1E_4_sound + · exact (entropyTerm_zero_ball ((B2_5_1Little_sound (shape 0 3 1) ((stageBPriority (shape 2 5 1)) 2)) (5 : Fin 6))) +def CB2_5_1I2S0_3_1Entropy : Ball := ⟨0, 0⟩ +lemma CB2_5_1I2S0_3_1Entropy_sound : CB2_5_1I2S0_3_1Entropy.Encloses (Foundation.finiteEntropy CB2_5_1I2S0_3_1Value) := by + exact contains_sound (entropyFin_enclosed 6 CB2_5_1I2S0_3_1Value CB2_5_1I2S0_3_1Terms CB2_5_1I2S0_3_1Terms_sound) (by decide +kernel) +def CB2_5_1I2S0_3_1Mass : Ball := ⟨1, 0⟩ +lemma CB2_5_1I2S0_3_1Mass_sound : CB2_5_1I2S0_3_1Mass.Encloses (∑ a, CB2_5_1I2S0_3_1Value a) := by + exact contains_sound (finSumBall_sound 6 (B2_5_1Little (shape 0 3 1) ((stageBPriority (shape 2 5 1)) 2)) CB2_5_1I2S0_3_1Value (B2_5_1Little_sound (shape 0 3 1) ((stageBPriority (shape 2 5 1)) 2))) (by decide +kernel) +def CB2_5_1I2S0_3_1MassTermLog : Ball := .exact 0 +lemma CB2_5_1I2S0_3_1MassTermLog_sound : CB2_5_1I2S0_3_1MassTermLog.Encloses (Real.log ((∑ a, CB2_5_1I2S0_3_1Value a))) := by + exact log_exact_one_ball (CB2_5_1I2S0_3_1Mass_sound) +def CB2_5_1I2S0_3_1MassTerm : Ball := ⟨0, 0⟩ +lemma CB2_5_1I2S0_3_1MassTerm_sound : CB2_5_1I2S0_3_1MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB2_5_1I2S0_3_1Value a))) := by + exact contains_sound (entropyTerm_ball (CB2_5_1I2S0_3_1Mass_sound) CB2_5_1I2S0_3_1MassTermLog_sound) (by decide +kernel) +def CB2_5_1I2S0_3_1H : Ball := ⟨0, 0⟩ +lemma CB2_5_1I2S0_3_1H_sound : CB2_5_1I2S0_3_1H.Encloses (homogeneousEntropy CB2_5_1I2S0_3_1Value) := by + exact contains_sound (homogeneous_enclosed CB2_5_1I2S0_3_1Value CB2_5_1I2S0_3_1MassTerm_sound CB2_5_1I2S0_3_1Entropy_sound) (by decide +kernel) +def CB2_5_1I2S0_4_0Value (a : Fin 6) : ℝ := (littleLaw (shape 2 5 1) (shape 0 4 0) ((stageBPriority (shape 2 5 1)) 2) a : ℝ) +def CB2_5_1I2S0_4_0E_5Log : Ball := .exact 0 +lemma CB2_5_1I2S0_4_0E_5Log_sound : CB2_5_1I2S0_4_0E_5Log.Encloses (Real.log (CB2_5_1I2S0_4_0Value (5 : Fin 6))) := by + exact log_exact_one_ball ((B2_5_1Little_sound (shape 0 4 0) ((stageBPriority (shape 2 5 1)) 2)) (5 : Fin 6)) +def CB2_5_1I2S0_4_0E_5 : Ball := ⟨0, 0⟩ +lemma CB2_5_1I2S0_4_0E_5_sound : CB2_5_1I2S0_4_0E_5.Encloses (Foundation.entropyTerm (CB2_5_1I2S0_4_0Value (5 : Fin 6))) := by + exact contains_sound (entropyTerm_ball ((B2_5_1Little_sound (shape 0 4 0) ((stageBPriority (shape 2 5 1)) 2)) (5 : Fin 6)) CB2_5_1I2S0_4_0E_5Log_sound) (by decide +kernel) +def CB2_5_1I2S0_4_0Terms (a : Fin 6) : Ball := + match a.val with + | 5 => ⟨0, 0⟩ + | _ => (.exact 0) +lemma CB2_5_1I2S0_4_0Terms_sound (a : Fin 6) : + (CB2_5_1I2S0_4_0Terms a).Encloses (Foundation.entropyTerm (CB2_5_1I2S0_4_0Value a)) := by + fin_cases a + · exact (entropyTerm_zero_ball ((B2_5_1Little_sound (shape 0 4 0) ((stageBPriority (shape 2 5 1)) 2)) (0 : Fin 6))) + · exact (entropyTerm_zero_ball ((B2_5_1Little_sound (shape 0 4 0) ((stageBPriority (shape 2 5 1)) 2)) (1 : Fin 6))) + · exact (entropyTerm_zero_ball ((B2_5_1Little_sound (shape 0 4 0) ((stageBPriority (shape 2 5 1)) 2)) (2 : Fin 6))) + · exact (entropyTerm_zero_ball ((B2_5_1Little_sound (shape 0 4 0) ((stageBPriority (shape 2 5 1)) 2)) (3 : Fin 6))) + · exact (entropyTerm_zero_ball ((B2_5_1Little_sound (shape 0 4 0) ((stageBPriority (shape 2 5 1)) 2)) (4 : Fin 6))) + · exact CB2_5_1I2S0_4_0E_5_sound +def CB2_5_1I2S0_4_0Entropy : Ball := ⟨0, 0⟩ +lemma CB2_5_1I2S0_4_0Entropy_sound : CB2_5_1I2S0_4_0Entropy.Encloses (Foundation.finiteEntropy CB2_5_1I2S0_4_0Value) := by + exact contains_sound (entropyFin_enclosed 6 CB2_5_1I2S0_4_0Value CB2_5_1I2S0_4_0Terms CB2_5_1I2S0_4_0Terms_sound) (by decide +kernel) +def CB2_5_1I2S0_4_0Mass : Ball := ⟨1, 0⟩ +lemma CB2_5_1I2S0_4_0Mass_sound : CB2_5_1I2S0_4_0Mass.Encloses (∑ a, CB2_5_1I2S0_4_0Value a) := by + exact contains_sound (finSumBall_sound 6 (B2_5_1Little (shape 0 4 0) ((stageBPriority (shape 2 5 1)) 2)) CB2_5_1I2S0_4_0Value (B2_5_1Little_sound (shape 0 4 0) ((stageBPriority (shape 2 5 1)) 2))) (by decide +kernel) +def CB2_5_1I2S0_4_0MassTermLog : Ball := .exact 0 +lemma CB2_5_1I2S0_4_0MassTermLog_sound : CB2_5_1I2S0_4_0MassTermLog.Encloses (Real.log ((∑ a, CB2_5_1I2S0_4_0Value a))) := by + exact log_exact_one_ball (CB2_5_1I2S0_4_0Mass_sound) +def CB2_5_1I2S0_4_0MassTerm : Ball := ⟨0, 0⟩ +lemma CB2_5_1I2S0_4_0MassTerm_sound : CB2_5_1I2S0_4_0MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB2_5_1I2S0_4_0Value a))) := by + exact contains_sound (entropyTerm_ball (CB2_5_1I2S0_4_0Mass_sound) CB2_5_1I2S0_4_0MassTermLog_sound) (by decide +kernel) +def CB2_5_1I2S0_4_0H : Ball := ⟨0, 0⟩ +lemma CB2_5_1I2S0_4_0H_sound : CB2_5_1I2S0_4_0H.Encloses (homogeneousEntropy CB2_5_1I2S0_4_0Value) := by + exact contains_sound (homogeneous_enclosed CB2_5_1I2S0_4_0Value CB2_5_1I2S0_4_0MassTerm_sound CB2_5_1I2S0_4_0Entropy_sound) (by decide +kernel) +def CB2_5_1I2S1_3_0Value (a : Fin 6) : ℝ := (littleLaw (shape 2 5 1) (shape 1 3 0) ((stageBPriority (shape 2 5 1)) 2) a : ℝ) +def CB2_5_1I2S1_3_0E_4Log : Ball := .exact 0 +lemma CB2_5_1I2S1_3_0E_4Log_sound : CB2_5_1I2S1_3_0E_4Log.Encloses (Real.log (CB2_5_1I2S1_3_0Value (4 : Fin 6))) := by + exact log_exact_one_ball ((B2_5_1Little_sound (shape 1 3 0) ((stageBPriority (shape 2 5 1)) 2)) (4 : Fin 6)) +def CB2_5_1I2S1_3_0E_4 : Ball := ⟨0, 0⟩ +lemma CB2_5_1I2S1_3_0E_4_sound : CB2_5_1I2S1_3_0E_4.Encloses (Foundation.entropyTerm (CB2_5_1I2S1_3_0Value (4 : Fin 6))) := by + exact contains_sound (entropyTerm_ball ((B2_5_1Little_sound (shape 1 3 0) ((stageBPriority (shape 2 5 1)) 2)) (4 : Fin 6)) CB2_5_1I2S1_3_0E_4Log_sound) (by decide +kernel) +def CB2_5_1I2S1_3_0Terms (a : Fin 6) : Ball := + match a.val with + | 4 => ⟨0, 0⟩ + | _ => (.exact 0) +lemma CB2_5_1I2S1_3_0Terms_sound (a : Fin 6) : + (CB2_5_1I2S1_3_0Terms a).Encloses (Foundation.entropyTerm (CB2_5_1I2S1_3_0Value a)) := by + fin_cases a + · exact (entropyTerm_zero_ball ((B2_5_1Little_sound (shape 1 3 0) ((stageBPriority (shape 2 5 1)) 2)) (0 : Fin 6))) + · exact (entropyTerm_zero_ball ((B2_5_1Little_sound (shape 1 3 0) ((stageBPriority (shape 2 5 1)) 2)) (1 : Fin 6))) + · exact (entropyTerm_zero_ball ((B2_5_1Little_sound (shape 1 3 0) ((stageBPriority (shape 2 5 1)) 2)) (2 : Fin 6))) + · exact (entropyTerm_zero_ball ((B2_5_1Little_sound (shape 1 3 0) ((stageBPriority (shape 2 5 1)) 2)) (3 : Fin 6))) + · exact CB2_5_1I2S1_3_0E_4_sound + · exact (entropyTerm_zero_ball ((B2_5_1Little_sound (shape 1 3 0) ((stageBPriority (shape 2 5 1)) 2)) (5 : Fin 6))) +def CB2_5_1I2S1_3_0Entropy : Ball := ⟨0, 0⟩ +lemma CB2_5_1I2S1_3_0Entropy_sound : CB2_5_1I2S1_3_0Entropy.Encloses (Foundation.finiteEntropy CB2_5_1I2S1_3_0Value) := by + exact contains_sound (entropyFin_enclosed 6 CB2_5_1I2S1_3_0Value CB2_5_1I2S1_3_0Terms CB2_5_1I2S1_3_0Terms_sound) (by decide +kernel) +def CB2_5_1I2S1_3_0Mass : Ball := ⟨1, 0⟩ +lemma CB2_5_1I2S1_3_0Mass_sound : CB2_5_1I2S1_3_0Mass.Encloses (∑ a, CB2_5_1I2S1_3_0Value a) := by + exact contains_sound (finSumBall_sound 6 (B2_5_1Little (shape 1 3 0) ((stageBPriority (shape 2 5 1)) 2)) CB2_5_1I2S1_3_0Value (B2_5_1Little_sound (shape 1 3 0) ((stageBPriority (shape 2 5 1)) 2))) (by decide +kernel) +def CB2_5_1I2S1_3_0MassTermLog : Ball := .exact 0 +lemma CB2_5_1I2S1_3_0MassTermLog_sound : CB2_5_1I2S1_3_0MassTermLog.Encloses (Real.log ((∑ a, CB2_5_1I2S1_3_0Value a))) := by + exact log_exact_one_ball (CB2_5_1I2S1_3_0Mass_sound) +def CB2_5_1I2S1_3_0MassTerm : Ball := ⟨0, 0⟩ +lemma CB2_5_1I2S1_3_0MassTerm_sound : CB2_5_1I2S1_3_0MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB2_5_1I2S1_3_0Value a))) := by + exact contains_sound (entropyTerm_ball (CB2_5_1I2S1_3_0Mass_sound) CB2_5_1I2S1_3_0MassTermLog_sound) (by decide +kernel) +def CB2_5_1I2S1_3_0H : Ball := ⟨0, 0⟩ +lemma CB2_5_1I2S1_3_0H_sound : CB2_5_1I2S1_3_0H.Encloses (homogeneousEntropy CB2_5_1I2S1_3_0Value) := by + exact contains_sound (homogeneous_enclosed CB2_5_1I2S1_3_0Value CB2_5_1I2S1_3_0MassTerm_sound CB2_5_1I2S1_3_0Entropy_sound) (by decide +kernel) +def CB2_5_1I2S2_2_0Value (a : Fin 6) : ℝ := (littleLaw (shape 2 5 1) (shape 2 2 0) ((stageBPriority (shape 2 5 1)) 2) a : ℝ) +def CB2_5_1I2S2_2_0E_2LogWitness : LogWitness := ⟨-1, 444957, 250000⟩ +def CB2_5_1I2S2_2_0E_2Log : Ball := ⟨(-583152250691689478453229215219 / 5000000000000000000000000000000), (21175823683 / 50000000000000000000000000000000)⟩ +lemma CB2_5_1I2S2_2_0E_2Log_sound : CB2_5_1I2S2_2_0E_2Log.Encloses (Real.log (CB2_5_1I2S2_2_0Value (2 : Fin 6))) := by + exact checkLog_sound logTwoBall_sound ((B2_5_1Little_sound (shape 2 2 0) ((stageBPriority (shape 2 5 1)) 2)) (2 : Fin 6)) (w := CB2_5_1I2S2_2_0E_2LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB2_5_1I2S2_2_0E_2 : Ball := ⟨(1297388380055110376320567559581 / 12500000000000000000000000000000), (7537864783 / 20000000000000000000000000000000)⟩ +lemma CB2_5_1I2S2_2_0E_2_sound : CB2_5_1I2S2_2_0E_2.Encloses (Foundation.entropyTerm (CB2_5_1I2S2_2_0Value (2 : Fin 6))) := by + exact contains_sound (entropyTerm_ball ((B2_5_1Little_sound (shape 2 2 0) ((stageBPriority (shape 2 5 1)) 2)) (2 : Fin 6)) CB2_5_1I2S2_2_0E_2Log_sound) (by decide +kernel) +def CB2_5_1I2S2_2_0E_3LogWitness : LogWitness := ⟨-4, 55043, 31250⟩ +def CB2_5_1I2S2_2_0E_3Log : Ball := ⟨(-22064934004685379356673449299827 / 10000000000000000000000000000000), (21175823683 / 20000000000000000000000000000000)⟩ +lemma CB2_5_1I2S2_2_0E_3Log_sound : CB2_5_1I2S2_2_0E_3Log.Encloses (Real.log (CB2_5_1I2S2_2_0Value (3 : Fin 6))) := by + exact checkLog_sound logTwoBall_sound ((B2_5_1Little_sound (shape 2 2 0) ((stageBPriority (shape 2 5 1)) 2)) (3 : Fin 6)) (w := CB2_5_1I2S2_2_0E_3LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB2_5_1I2S2_2_0E_3 : Ball := ⟨(1518150203024871669911720837263 / 6250000000000000000000000000000), (11655808631 / 100000000000000000000000000000000)⟩ +lemma CB2_5_1I2S2_2_0E_3_sound : CB2_5_1I2S2_2_0E_3.Encloses (Foundation.entropyTerm (CB2_5_1I2S2_2_0Value (3 : Fin 6))) := by + exact contains_sound (entropyTerm_ball ((B2_5_1Little_sound (shape 2 2 0) ((stageBPriority (shape 2 5 1)) 2)) (3 : Fin 6)) CB2_5_1I2S2_2_0E_3Log_sound) (by decide +kernel) +def CB2_5_1I2S2_2_0Terms (a : Fin 6) : Ball := + match a.val with + | 2 => ⟨(1297388380055110376320567559581 / 12500000000000000000000000000000), (7537864783 / 20000000000000000000000000000000)⟩ + | 3 => ⟨(1518150203024871669911720837263 / 6250000000000000000000000000000), (11655808631 / 100000000000000000000000000000000)⟩ + | _ => (.exact 0) +lemma CB2_5_1I2S2_2_0Terms_sound (a : Fin 6) : + (CB2_5_1I2S2_2_0Terms a).Encloses (Foundation.entropyTerm (CB2_5_1I2S2_2_0Value a)) := by + fin_cases a + · exact (entropyTerm_zero_ball ((B2_5_1Little_sound (shape 2 2 0) ((stageBPriority (shape 2 5 1)) 2)) (0 : Fin 6))) + · exact (entropyTerm_zero_ball ((B2_5_1Little_sound (shape 2 2 0) ((stageBPriority (shape 2 5 1)) 2)) (1 : Fin 6))) + · exact CB2_5_1I2S2_2_0E_2_sound + · exact CB2_5_1I2S2_2_0E_3_sound + · exact (entropyTerm_zero_ball ((B2_5_1Little_sound (shape 2 2 0) ((stageBPriority (shape 2 5 1)) 2)) (4 : Fin 6))) + · exact (entropyTerm_zero_ball ((B2_5_1Little_sound (shape 2 2 0) ((stageBPriority (shape 2 5 1)) 2)) (5 : Fin 6))) +def CB2_5_1I2S2_2_0Entropy : Ball := ⟨(4333688786104853716144009234107 / 12500000000000000000000000000000), (24672566273 / 50000000000000000000000000000000)⟩ +lemma CB2_5_1I2S2_2_0Entropy_sound : CB2_5_1I2S2_2_0Entropy.Encloses (Foundation.finiteEntropy CB2_5_1I2S2_2_0Value) := by + exact contains_sound (entropyFin_enclosed 6 CB2_5_1I2S2_2_0Value CB2_5_1I2S2_2_0Terms CB2_5_1I2S2_2_0Terms_sound) (by decide +kernel) +def CB2_5_1I2S2_2_0Mass : Ball := ⟨1, 0⟩ +lemma CB2_5_1I2S2_2_0Mass_sound : CB2_5_1I2S2_2_0Mass.Encloses (∑ a, CB2_5_1I2S2_2_0Value a) := by + exact contains_sound (finSumBall_sound 6 (B2_5_1Little (shape 2 2 0) ((stageBPriority (shape 2 5 1)) 2)) CB2_5_1I2S2_2_0Value (B2_5_1Little_sound (shape 2 2 0) ((stageBPriority (shape 2 5 1)) 2))) (by decide +kernel) +def CB2_5_1I2S2_2_0MassTermLog : Ball := .exact 0 +lemma CB2_5_1I2S2_2_0MassTermLog_sound : CB2_5_1I2S2_2_0MassTermLog.Encloses (Real.log ((∑ a, CB2_5_1I2S2_2_0Value a))) := by + exact log_exact_one_ball (CB2_5_1I2S2_2_0Mass_sound) +def CB2_5_1I2S2_2_0MassTerm : Ball := ⟨0, 0⟩ +lemma CB2_5_1I2S2_2_0MassTerm_sound : CB2_5_1I2S2_2_0MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB2_5_1I2S2_2_0Value a))) := by + exact contains_sound (entropyTerm_ball (CB2_5_1I2S2_2_0Mass_sound) CB2_5_1I2S2_2_0MassTermLog_sound) (by decide +kernel) +def CB2_5_1I2S2_2_0H : Ball := ⟨(4333688786104853716144009234107 / 12500000000000000000000000000000), (24672566273 / 50000000000000000000000000000000)⟩ +lemma CB2_5_1I2S2_2_0H_sound : CB2_5_1I2S2_2_0H.Encloses (homogeneousEntropy CB2_5_1I2S2_2_0Value) := by + exact contains_sound (homogeneous_enclosed CB2_5_1I2S2_2_0Value CB2_5_1I2S2_2_0MassTerm_sound CB2_5_1I2S2_2_0Entropy_sound) (by decide +kernel) +def CB2_5_1I2Singles (s : Shape) : Ball := + match s 0, s 1, s 2 with + | 0, 3, 1 => CB2_5_1I2S0_3_1H + | 0, 4, 0 => CB2_5_1I2S0_4_0H + | 1, 3, 0 => CB2_5_1I2S1_3_0H + | 2, 2, 0 => CB2_5_1I2S2_2_0H + | _, _, _ => (.exact 0) +lemma CB2_5_1I2Singles_sound (u : Shape) (hu : u ∈ below (shape 2 5 1)) + (hd : designated (stageBPriority (shape 2 5 1)) 2 u) : + (CB2_5_1I2Singles u).Encloses (homogeneousEntropy ((fun u a => (littleLaw (shape 2 5 1) u ((stageBPriority (shape 2 5 1)) 2) a : ℝ)) u)) := by + rw [B2_5_1_below] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl | rfl | rfl + · exact CB2_5_1I2S0_3_1H_sound + · exact CB2_5_1I2S0_4_0H_sound + · exact (show ¬ designated (stageBPriority (shape 2 5 1)) 2 (shape 1 2 1) by decide +kernel) hd |>.elim + · exact CB2_5_1I2S1_3_0H_sound + · exact (show ¬ designated (stageBPriority (shape 2 5 1)) 2 (shape 2 1 1) by decide +kernel) hd |>.elim + · exact CB2_5_1I2S2_2_0H_sound +def CB2_5_1I2Singleton : Ball := ⟨(770458991825735733780541157757 / 12500000000000000000000000000000), (8772757573 / 100000000000000000000000000000000)⟩ +lemma CB2_5_1I2Singleton_sound : CB2_5_1I2Singleton.Encloses + (singletonEntropy (below (shape 2 5 1)) (fun u => (stageBLaw (shape 2 5 1) u : ℝ)) (stageBPriority (shape 2 5 1)) 2 (fun u a => (littleLaw (shape 2 5 1) u ((stageBPriority (shape 2 5 1)) 2) a : ℝ))) := by + exact contains_sound (singletonBall_sound (below (shape 2 5 1)) B2_5_1Law (fun u => (stageBLaw (shape 2 5 1) u : ℝ)) (stageBPriority (shape 2 5 1)) 2 + CB2_5_1I2Singles (fun u a => (littleLaw (shape 2 5 1) u ((stageBPriority (shape 2 5 1)) 2) a : ℝ)) (fun u _ => B2_5_1Law_sound u) CB2_5_1I2Singles_sound) (by decide +kernel) +def CB2_5_1I2Group : Ball := ⟨(6912941347646796393825341225573 / 100000000000000000000000000000000), (51705574047 / 100000000000000000000000000000000)⟩ +lemma CB2_5_1I2Group_sound : CB2_5_1I2Group.Encloses + (groupedEntropy (below (shape 2 5 1)) (fun u => (stageBLaw (shape 2 5 1) u : ℝ)) (stageBPriority (shape 2 5 1)) 2 (fun u a => (littleLaw (shape 2 5 1) u ((stageBPriority (shape 2 5 1)) 2) a : ℝ))) := by + exact contains_sound (Ball.add_sound CB2_5_1I2Singleton_sound + (finSumBall_sound 17 CB2_5_1I2ResidualEntropies _ CB2_5_1I2ResidualEntropies_sound)) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CB2_5_1I2H : Ball := ⟨(40055444030287900426894750871547 / 50000000000000000000000000000000), (193423618701 / 100000000000000000000000000000000)⟩ +lemma CB2_5_1I2_sound : CB2_5_1I2H.Encloses (stageBCapacity (shape 2 5 1) 2) := by + have hb := contains_sound (Ball.add_sound CB2_5_1I2PairH_sound + (Ball.neg_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) CB2_5_1I2Group_sound))) + (show contains (.add CB2_5_1I2PairH (.neg (.mul (.exact 2) CB2_5_1I2Group))) CB2_5_1I2H = true by decide +kernel) + simp only [stageBCapacity, nativeCapacity, + show (2 : Fin 3) ≠ 0 by decide, ite_false, sub_eq_add_neg] + exact hb + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/CapacityB/CapB3_1_4I0.lean b/lean/OAI/LinearAlgebra/MatrixFields/CapacityB/CapB3_1_4I0.lean new file mode 100644 index 0000000000000000000000000000000000000000..89252d6fd8574a9b5c035f22c256adf0070b9795 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/CapacityB/CapB3_1_4I0.lean @@ -0,0 +1,72 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Certificates.Terminal3_1_4 + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CB3_1_4I0Value (a : Fin 17) : ℝ := marginal (below (shape 3 1 4)) (fun u => (stageBLaw (shape 3 1 4) u : ℝ)) ((stageBPriority (shape 3 1 4)) 0) a +def CB3_1_4I0Raw (a : Fin 17) : Ball := marginalBall (below (shape 3 1 4)) B3_1_4Law ((stageBPriority (shape 3 1 4)) 0) a +lemma CB3_1_4I0Raw_sound (a : Fin 17) : + (CB3_1_4I0Raw a).Encloses (CB3_1_4I0Value a) := by + exact marginalBall_sound (below (shape 3 1 4)) B3_1_4Law (fun u => (stageBLaw (shape 3 1 4) u : ℝ)) (fun u _ => B3_1_4Law_sound u) ((stageBPriority (shape 3 1 4)) 0) a +def CB3_1_4I0Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(1 / 2), (27 / 100000000000000000000000000000000)⟩ ⟨(6931471805599453094172319305033 / 20000000000000000000000000000000), (21175823729 / 100000000000000000000000000000000)⟩ ⟨(-6931471805599453094172319305033 / 10000000000000000000000000000000), (42351647419 / 100000000000000000000000000000000)⟩ ⟨-1, 1, 1⟩] +lemma CB3_1_4I0Certificates_valid : + CB3_1_4I0Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB3_1_4I0CertificateIndex (a : Fin 17) : ℕ := + match a.val with + | 0 => 1 + | 1 => 1 + | _ => 0 +def CB3_1_4I0P (a : Fin 17) : Ball := + (CompactCertificate.entropyLookup CB3_1_4I0Certificates (CB3_1_4I0CertificateIndex a)).input +lemma CB3_1_4I0P_check : ∀ a : Fin 17, contains (CB3_1_4I0Raw a) (CB3_1_4I0P a) = true := by + decide +kernel +lemma CB3_1_4I0P_sound (a : Fin 17) : + (CB3_1_4I0P a).Encloses (CB3_1_4I0Value a) := + contains_sound (CB3_1_4I0Raw_sound a) (CB3_1_4I0P_check a) +def CB3_1_4I0Terms (a : Fin 17) : Ball := + (CompactCertificate.entropyLookup CB3_1_4I0Certificates (CB3_1_4I0CertificateIndex a)).output +lemma CB3_1_4I0Terms_sound (a : Fin 17) : + (CB3_1_4I0Terms a).Encloses (Foundation.entropyTerm (CB3_1_4I0Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB3_1_4I0Certificates_valid + (CB3_1_4I0CertificateIndex a) (CB3_1_4I0P_sound a) +def CB3_1_4I0Entropy : Ball := ⟨(6931471805599453094172319305033 / 10000000000000000000000000000000), (21175823729 / 50000000000000000000000000000000)⟩ +lemma CB3_1_4I0Entropy_sound : CB3_1_4I0Entropy.Encloses (Foundation.finiteEntropy CB3_1_4I0Value) := by + exact contains_sound (entropyFin_enclosed 17 CB3_1_4I0Value CB3_1_4I0Terms CB3_1_4I0Terms_sound) (by decide +kernel) +def CB3_1_4I0Mass : Ball := ⟨1, (27 / 50000000000000000000000000000000)⟩ +lemma CB3_1_4I0Mass_sound : CB3_1_4I0Mass.Encloses (∑ a, CB3_1_4I0Value a) := by + exact contains_sound (finSumBall_sound 17 CB3_1_4I0P CB3_1_4I0Value CB3_1_4I0P_sound) (by decide +kernel) +def CB3_1_4I0MassTermLogWitness : LogWitness := ⟨0, 1, 1⟩ +def CB3_1_4I0MassTermLog : Ball := ⟨0, (2646977967 / 12500000000000000000000000000000)⟩ +lemma CB3_1_4I0MassTermLog_sound : CB3_1_4I0MassTermLog.Encloses (Real.log ((∑ a, CB3_1_4I0Value a))) := by + exact checkLog_sound logTwoBall_sound (CB3_1_4I0Mass_sound) (w := CB3_1_4I0MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB3_1_4I0MassTerm : Ball := ⟨0, (21175823737 / 100000000000000000000000000000000)⟩ +lemma CB3_1_4I0MassTerm_sound : CB3_1_4I0MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB3_1_4I0Value a))) := by + exact contains_sound (entropyTerm_ball (CB3_1_4I0Mass_sound) CB3_1_4I0MassTermLog_sound) (by decide +kernel) +def CB3_1_4I0H : Ball := ⟨(6931471805599453094172319305033 / 10000000000000000000000000000000), (12705494239 / 20000000000000000000000000000000)⟩ +lemma CB3_1_4I0H_sound : CB3_1_4I0H.Encloses (homogeneousEntropy CB3_1_4I0Value) := by + exact contains_sound (homogeneous_enclosed CB3_1_4I0Value CB3_1_4I0MassTerm_sound CB3_1_4I0Entropy_sound) (by decide +kernel) +lemma CB3_1_4I0_sound : CB3_1_4I0H.Encloses (stageBCapacity (shape 3 1 4) 0) := by + exact CB3_1_4I0H_sound + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/CapacityB/CapB3_1_4I1.lean b/lean/OAI/LinearAlgebra/MatrixFields/CapacityB/CapB3_1_4I1.lean new file mode 100644 index 0000000000000000000000000000000000000000..e7d3893b5bebe52e77e457b0b070a3205ba56112 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/CapacityB/CapB3_1_4I1.lean @@ -0,0 +1,888 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Certificates.Terminal3_1_4 + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CB3_1_4I1PairValue (a : PairSlot) : ℝ := pairLaw (below (shape 3 1 4)) (shape 3 1 4) (fun u => (stageBLaw (shape 3 1 4) u : ℝ)) (fun u a => (littleLaw (shape 3 1 4) u ((stageBPriority (shape 3 1 4)) 1) a : ℝ)) a +def CB3_1_4I1PairRaw (a : PairSlot) : Ball := pairLawBall (below (shape 3 1 4)) (shape 3 1 4) B3_1_4Law (fun u => B3_1_4Little u ((stageBPriority (shape 3 1 4)) 1)) a +lemma CB3_1_4I1PairRaw_sound (a : PairSlot) : + (CB3_1_4I1PairRaw a).Encloses (CB3_1_4I1PairValue a) := by + exact pairLawBall_sound_on (below (shape 3 1 4)) (shape 3 1 4) B3_1_4Law (fun u => (stageBLaw (shape 3 1 4) u : ℝ)) (fun u => B3_1_4Little u ((stageBPriority (shape 3 1 4)) 1)) (fun u a => (littleLaw (shape 3 1 4) u ((stageBPriority (shape 3 1 4)) 1) a : ℝ)) (fun u _ => B3_1_4Law_sound u) (fun u _ a => B3_1_4Little_sound u ((stageBPriority (shape 3 1 4)) 1) a) (fun u _ a => B3_1_4Little_sound (complement (shape 3 1 4) u) ((stageBPriority (shape 3 1 4)) 1) a) a +def CB3_1_4I1PairCertificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(331794662118768313410096879501 / 25000000000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ ⟨(5736218497226440293141624761203 / 100000000000000000000000000000000), (2248328117 / 100000000000000000000000000000000)⟩ ⟨(-432211481387027192883904562168077 / 100000000000000000000000000000000), (42351647479 / 25000000000000000000000000000000)⟩ ⟨-7, 331794662118768313410096879501, 195312500000000000000000000000⟩, + .log ⟨(8878737487603738207391907834341 / 20000000000000000000000000000000), (1 / 5000000000000000000000000000000)⟩ ⟨(36050910565059717035527181848099 / 100000000000000000000000000000000), (7050546743 / 25000000000000000000000000000000)⟩ ⟨(-16241458029542176888321152122387 / 20000000000000000000000000000000), (31763735547 / 50000000000000000000000000000000)⟩ ⟨-2, 8878737487603738207391907834341, 5000000000000000000000000000000⟩, + .log ⟨(4279133913506235709400073310291 / 100000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ ⟨(13485346287191247569773382541719 / 100000000000000000000000000000000), (43494809 / 800000000000000000000000000000)⟩ ⟨(-315141955352867837592151786892571 / 100000000000000000000000000000000), (1985233471 / 1562500000000000000000000000000)⟩ ⟨-5, 4279133913506235709400073310291, 3125000000000000000000000000000⟩] +lemma CB3_1_4I1PairCertificates_valid : + CB3_1_4I1PairCertificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB3_1_4I1PairCertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 0, 4 => 1 + | 1, 2 => 2 + | 1, 3 => 3 + | 2, 1 => 2 + | 3, 1 => 3 + | 4, 0 => 1 + | _, _ => 0 +def CB3_1_4I1PairP (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CB3_1_4I1PairCertificates (CB3_1_4I1PairCertificateIndex a)).input +lemma CB3_1_4I1PairP_check : ∀ a : PairSlot, contains (CB3_1_4I1PairRaw a) (CB3_1_4I1PairP a) = true := by + decide +kernel +lemma CB3_1_4I1PairP_sound (a : PairSlot) : + (CB3_1_4I1PairP a).Encloses (CB3_1_4I1PairValue a) := + contains_sound (CB3_1_4I1PairRaw_sound a) (CB3_1_4I1PairP_check a) +def CB3_1_4I1PairTerms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CB3_1_4I1PairCertificates (CB3_1_4I1PairCertificateIndex a)).output +lemma CB3_1_4I1PairTerms_sound (a : PairSlot) : + (CB3_1_4I1PairTerms a).Encloses (Foundation.entropyTerm (CB3_1_4I1PairValue a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB3_1_4I1PairCertificates_valid + (CB3_1_4I1PairCertificateIndex a) (CB3_1_4I1PairP_sound a) +def CB3_1_4I1PairEntropy : Ball := ⟨(55272475349477404898442189151021 / 50000000000000000000000000000000), (17943683107 / 25000000000000000000000000000000)⟩ +lemma CB3_1_4I1PairEntropy_sound : CB3_1_4I1PairEntropy.Encloses (Foundation.finiteEntropy CB3_1_4I1PairValue) := by + exact contains_sound (entropyPair_enclosed CB3_1_4I1PairValue CB3_1_4I1PairTerms CB3_1_4I1PairTerms_sound) (by decide +kernel) +def CB3_1_4I1PairMass : Ball := ⟨1, (7 / 12500000000000000000000000000000)⟩ +lemma CB3_1_4I1PairMass_sound : CB3_1_4I1PairMass.Encloses (∑ a, CB3_1_4I1PairValue a) := by + exact contains_sound (pairSumBall_sound CB3_1_4I1PairP CB3_1_4I1PairValue CB3_1_4I1PairP_sound) (by decide +kernel) +def CB3_1_4I1PairMassTermLogWitness : LogWitness := ⟨0, 1, 1⟩ +def CB3_1_4I1PairMassTermLog : Ball := ⟨0, (10587911869 / 50000000000000000000000000000000)⟩ +lemma CB3_1_4I1PairMassTermLog_sound : CB3_1_4I1PairMassTermLog.Encloses (Real.log ((∑ a, CB3_1_4I1PairValue a))) := by + exact checkLog_sound logTwoBall_sound (CB3_1_4I1PairMass_sound) (w := CB3_1_4I1PairMassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB3_1_4I1PairMassTerm : Ball := ⟨0, (21175823739 / 100000000000000000000000000000000)⟩ +lemma CB3_1_4I1PairMassTerm_sound : CB3_1_4I1PairMassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB3_1_4I1PairValue a))) := by + exact contains_sound (entropyTerm_ball (CB3_1_4I1PairMass_sound) CB3_1_4I1PairMassTermLog_sound) (by decide +kernel) +def CB3_1_4I1PairH : Ball := ⟨(55272475349477404898442189151021 / 50000000000000000000000000000000), (92950556167 / 100000000000000000000000000000000)⟩ +lemma CB3_1_4I1PairH_sound : CB3_1_4I1PairH.Encloses (homogeneousEntropy CB3_1_4I1PairValue) := by + exact contains_sound (homogeneous_enclosed CB3_1_4I1PairValue CB3_1_4I1PairMassTerm_sound CB3_1_4I1PairEntropy_sound) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CB3_1_4I1R0Value (a : Fin 6) : ℝ := residualLaw (below (shape 3 1 4)) (fun u => (stageBLaw (shape 3 1 4) u : ℝ)) (stageBPriority (shape 3 1 4)) 1 (fun u a => (littleLaw (shape 3 1 4) u ((stageBPriority (shape 3 1 4)) 1) a : ℝ)) 0 a +def CB3_1_4I1R0Raw (a : Fin 6) : Ball := residualBall (below (shape 3 1 4)) B3_1_4Law (stageBPriority (shape 3 1 4)) 1 (fun u => B3_1_4Little u ((stageBPriority (shape 3 1 4)) 1)) 0 a +lemma CB3_1_4I1R0Raw_sound (a : Fin 6) : + (CB3_1_4I1R0Raw a).Encloses (CB3_1_4I1R0Value a) := by + exact residualBall_sound_on (below (shape 3 1 4)) B3_1_4Law (fun u => (stageBLaw (shape 3 1 4) u : ℝ)) (stageBPriority (shape 3 1 4)) 1 (fun u => B3_1_4Little u ((stageBPriority (shape 3 1 4)) 1)) (fun u a => (littleLaw (shape 3 1 4) u ((stageBPriority (shape 3 1 4)) 1) a : ℝ)) (fun u _ => B3_1_4Law_sound u) (fun u _ a => B3_1_4Little_sound u ((stageBPriority (shape 3 1 4)) 1) a) 0 a +def CB3_1_4I1R0Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(331794662118768313410096879501 / 25000000000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ ⟨(5736218497226440293141624761203 / 100000000000000000000000000000000), (2248328117 / 100000000000000000000000000000000)⟩ ⟨(-432211481387027192883904562168077 / 100000000000000000000000000000000), (42351647479 / 25000000000000000000000000000000)⟩ ⟨-7, 331794662118768313410096879501, 195312500000000000000000000000⟩] +lemma CB3_1_4I1R0Certificates_valid : + CB3_1_4I1R0Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB3_1_4I1R0CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | 0 => 1 + | _ => 0 +def CB3_1_4I1R0P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_1_4I1R0Certificates (CB3_1_4I1R0CertificateIndex a)).input +lemma CB3_1_4I1R0P_check : ∀ a : Fin 6, contains (CB3_1_4I1R0Raw a) (CB3_1_4I1R0P a) = true := by + decide +kernel +lemma CB3_1_4I1R0P_sound (a : Fin 6) : + (CB3_1_4I1R0P a).Encloses (CB3_1_4I1R0Value a) := + contains_sound (CB3_1_4I1R0Raw_sound a) (CB3_1_4I1R0P_check a) +def CB3_1_4I1R0Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_1_4I1R0Certificates (CB3_1_4I1R0CertificateIndex a)).output +lemma CB3_1_4I1R0Terms_sound (a : Fin 6) : + (CB3_1_4I1R0Terms a).Encloses (Foundation.entropyTerm (CB3_1_4I1R0Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB3_1_4I1R0Certificates_valid + (CB3_1_4I1R0CertificateIndex a) (CB3_1_4I1R0P_sound a) +def CB3_1_4I1R0Entropy : Ball := ⟨(5736218497226440293141624761203 / 100000000000000000000000000000000), (2248328117 / 100000000000000000000000000000000)⟩ +lemma CB3_1_4I1R0Entropy_sound : CB3_1_4I1R0Entropy.Encloses (Foundation.finiteEntropy CB3_1_4I1R0Value) := by + exact contains_sound (entropyFin_enclosed 6 CB3_1_4I1R0Value CB3_1_4I1R0Terms CB3_1_4I1R0Terms_sound) (by decide +kernel) +def CB3_1_4I1R0Mass : Ball := ⟨(331794662118768313410096879501 / 25000000000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ +lemma CB3_1_4I1R0Mass_sound : CB3_1_4I1R0Mass.Encloses (∑ a, CB3_1_4I1R0Value a) := by + exact contains_sound (finSumBall_sound 6 CB3_1_4I1R0P CB3_1_4I1R0Value CB3_1_4I1R0P_sound) (by decide +kernel) +def CB3_1_4I1R0MassTermLogWitness : LogWitness := ⟨-7, 331794662118768313410096879501, 195312500000000000000000000000⟩ +def CB3_1_4I1R0MassTermLog : Ball := ⟨(-432211481387027192883904562168077 / 100000000000000000000000000000000), (42351647479 / 25000000000000000000000000000000)⟩ +lemma CB3_1_4I1R0MassTermLog_sound : CB3_1_4I1R0MassTermLog.Encloses (Real.log ((∑ a, CB3_1_4I1R0Value a))) := by + exact checkLog_sound logTwoBall_sound (CB3_1_4I1R0Mass_sound) (w := CB3_1_4I1R0MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB3_1_4I1R0MassTerm : Ball := ⟨(5736218497226440293141624761203 / 100000000000000000000000000000000), (2248328117 / 100000000000000000000000000000000)⟩ +lemma CB3_1_4I1R0MassTerm_sound : CB3_1_4I1R0MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB3_1_4I1R0Value a))) := by + exact contains_sound (entropyTerm_ball (CB3_1_4I1R0Mass_sound) CB3_1_4I1R0MassTermLog_sound) (by decide +kernel) +def CB3_1_4I1R0H : Ball := ⟨0, (2248328117 / 50000000000000000000000000000000)⟩ +lemma CB3_1_4I1R0H_sound : CB3_1_4I1R0H.Encloses (homogeneousEntropy CB3_1_4I1R0Value) := by + exact contains_sound (homogeneous_enclosed CB3_1_4I1R0Value CB3_1_4I1R0MassTerm_sound CB3_1_4I1R0Entropy_sound) (by decide +kernel) +def CB3_1_4I1R1Value (a : Fin 6) : ℝ := residualLaw (below (shape 3 1 4)) (fun u => (stageBLaw (shape 3 1 4) u : ℝ)) (stageBPriority (shape 3 1 4)) 1 (fun u a => (littleLaw (shape 3 1 4) u ((stageBPriority (shape 3 1 4)) 1) a : ℝ)) 1 a +def CB3_1_4I1R1Raw (a : Fin 6) : Ball := residualBall (below (shape 3 1 4)) B3_1_4Law (stageBPriority (shape 3 1 4)) 1 (fun u => B3_1_4Little u ((stageBPriority (shape 3 1 4)) 1)) 1 a +lemma CB3_1_4I1R1Raw_sound (a : Fin 6) : + (CB3_1_4I1R1Raw a).Encloses (CB3_1_4I1R1Value a) := by + exact residualBall_sound_on (below (shape 3 1 4)) B3_1_4Law (fun u => (stageBLaw (shape 3 1 4) u : ℝ)) (stageBPriority (shape 3 1 4)) 1 (fun u => B3_1_4Little u ((stageBPriority (shape 3 1 4)) 1)) (fun u a => (littleLaw (shape 3 1 4) u ((stageBPriority (shape 3 1 4)) 1) a : ℝ)) (fun u _ => B3_1_4Law_sound u) (fun u _ a => B3_1_4Little_sound u ((stageBPriority (shape 3 1 4)) 1) a) 1 a +def CB3_1_4I1R1Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(12168205337881231686589903120499 / 25000000000000000000000000000000), (21 / 100000000000000000000000000000000)⟩ ⟨(17523417779096033358476442978537 / 50000000000000000000000000000000), (30920612529 / 100000000000000000000000000000000)⟩ ⟨(-14400987896336132212354969653389 / 20000000000000000000000000000000), (15881867773 / 25000000000000000000000000000000)⟩ ⟨-2, 12168205337881231686589903120499, 6250000000000000000000000000000⟩] +lemma CB3_1_4I1R1Certificates_valid : + CB3_1_4I1R1Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB3_1_4I1R1CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | 1 => 1 + | _ => 0 +def CB3_1_4I1R1P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_1_4I1R1Certificates (CB3_1_4I1R1CertificateIndex a)).input +lemma CB3_1_4I1R1P_check : ∀ a : Fin 6, contains (CB3_1_4I1R1Raw a) (CB3_1_4I1R1P a) = true := by + decide +kernel +lemma CB3_1_4I1R1P_sound (a : Fin 6) : + (CB3_1_4I1R1P a).Encloses (CB3_1_4I1R1Value a) := + contains_sound (CB3_1_4I1R1Raw_sound a) (CB3_1_4I1R1P_check a) +def CB3_1_4I1R1Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_1_4I1R1Certificates (CB3_1_4I1R1CertificateIndex a)).output +lemma CB3_1_4I1R1Terms_sound (a : Fin 6) : + (CB3_1_4I1R1Terms a).Encloses (Foundation.entropyTerm (CB3_1_4I1R1Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB3_1_4I1R1Certificates_valid + (CB3_1_4I1R1CertificateIndex a) (CB3_1_4I1R1P_sound a) +def CB3_1_4I1R1Entropy : Ball := ⟨(17523417779096033358476442978537 / 50000000000000000000000000000000), (30920612529 / 100000000000000000000000000000000)⟩ +lemma CB3_1_4I1R1Entropy_sound : CB3_1_4I1R1Entropy.Encloses (Foundation.finiteEntropy CB3_1_4I1R1Value) := by + exact contains_sound (entropyFin_enclosed 6 CB3_1_4I1R1Value CB3_1_4I1R1Terms CB3_1_4I1R1Terms_sound) (by decide +kernel) +def CB3_1_4I1R1Mass : Ball := ⟨(12168205337881231686589903120499 / 25000000000000000000000000000000), (21 / 100000000000000000000000000000000)⟩ +lemma CB3_1_4I1R1Mass_sound : CB3_1_4I1R1Mass.Encloses (∑ a, CB3_1_4I1R1Value a) := by + exact contains_sound (finSumBall_sound 6 CB3_1_4I1R1P CB3_1_4I1R1Value CB3_1_4I1R1P_sound) (by decide +kernel) +def CB3_1_4I1R1MassTermLogWitness : LogWitness := ⟨-2, 12168205337881231686589903120499, 6250000000000000000000000000000⟩ +def CB3_1_4I1R1MassTermLog : Ball := ⟨(-14400987896336132212354969653389 / 20000000000000000000000000000000), (15881867773 / 25000000000000000000000000000000)⟩ +lemma CB3_1_4I1R1MassTermLog_sound : CB3_1_4I1R1MassTermLog.Encloses (Real.log ((∑ a, CB3_1_4I1R1Value a))) := by + exact checkLog_sound logTwoBall_sound (CB3_1_4I1R1Mass_sound) (w := CB3_1_4I1R1MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB3_1_4I1R1MassTerm : Ball := ⟨(17523417779096033358476442978537 / 50000000000000000000000000000000), (30920612529 / 100000000000000000000000000000000)⟩ +lemma CB3_1_4I1R1MassTerm_sound : CB3_1_4I1R1MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB3_1_4I1R1Value a))) := by + exact contains_sound (entropyTerm_ball (CB3_1_4I1R1Mass_sound) CB3_1_4I1R1MassTermLog_sound) (by decide +kernel) +def CB3_1_4I1R1H : Ball := ⟨0, (30920612529 / 50000000000000000000000000000000)⟩ +lemma CB3_1_4I1R1H_sound : CB3_1_4I1R1H.Encloses (homogeneousEntropy CB3_1_4I1R1Value) := by + exact contains_sound (homogeneous_enclosed CB3_1_4I1R1Value CB3_1_4I1R1MassTerm_sound CB3_1_4I1R1Entropy_sound) (by decide +kernel) +def CB3_1_4I1R2Value (a : Fin 6) : ℝ := residualLaw (below (shape 3 1 4)) (fun u => (stageBLaw (shape 3 1 4) u : ℝ)) (stageBPriority (shape 3 1 4)) 1 (fun u a => (littleLaw (shape 3 1 4) u ((stageBPriority (shape 3 1 4)) 1) a : ℝ)) 2 a +def CB3_1_4I1R2Raw (a : Fin 6) : Ball := residualBall (below (shape 3 1 4)) B3_1_4Law (stageBPriority (shape 3 1 4)) 1 (fun u => B3_1_4Little u ((stageBPriority (shape 3 1 4)) 1)) 2 a +lemma CB3_1_4I1R2Raw_sound (a : Fin 6) : + (CB3_1_4I1R2Raw a).Encloses (CB3_1_4I1R2Value a) := by + exact residualBall_sound_on (below (shape 3 1 4)) B3_1_4Law (fun u => (stageBLaw (shape 3 1 4) u : ℝ)) (stageBPriority (shape 3 1 4)) 1 (fun u => B3_1_4Little u ((stageBPriority (shape 3 1 4)) 1)) (fun u a => (littleLaw (shape 3 1 4) u ((stageBPriority (shape 3 1 4)) 1) a : ℝ)) (fun u _ => B3_1_4Law_sound u) (fun u _ a => B3_1_4Little_sound u ((stageBPriority (shape 3 1 4)) 1) a) 2 a +def CB3_1_4I1R2Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(8878737487603738207391907834341 / 20000000000000000000000000000000), (1 / 5000000000000000000000000000000)⟩ ⟨(36050910565059717035527181848099 / 100000000000000000000000000000000), (7050546743 / 25000000000000000000000000000000)⟩ ⟨(-16241458029542176888321152122387 / 20000000000000000000000000000000), (31763735547 / 50000000000000000000000000000000)⟩ ⟨-2, 8878737487603738207391907834341, 5000000000000000000000000000000⟩, + .log ⟨(4279133913506235709400073310291 / 100000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ ⟨(13485346287191247569773382541719 / 100000000000000000000000000000000), (43494809 / 800000000000000000000000000000)⟩ ⟨(-315141955352867837592151786892571 / 100000000000000000000000000000000), (1985233471 / 1562500000000000000000000000000)⟩ ⟨-5, 4279133913506235709400073310291, 3125000000000000000000000000000⟩] +lemma CB3_1_4I1R2Certificates_valid : + CB3_1_4I1R2Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB3_1_4I1R2CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | 2 => 1 + | 3 => 2 + | _ => 0 +def CB3_1_4I1R2P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_1_4I1R2Certificates (CB3_1_4I1R2CertificateIndex a)).input +lemma CB3_1_4I1R2P_check : ∀ a : Fin 6, contains (CB3_1_4I1R2Raw a) (CB3_1_4I1R2P a) = true := by + decide +kernel +lemma CB3_1_4I1R2P_sound (a : Fin 6) : + (CB3_1_4I1R2P a).Encloses (CB3_1_4I1R2Value a) := + contains_sound (CB3_1_4I1R2Raw_sound a) (CB3_1_4I1R2P_check a) +def CB3_1_4I1R2Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_1_4I1R2Certificates (CB3_1_4I1R2CertificateIndex a)).output +lemma CB3_1_4I1R2Terms_sound (a : Fin 6) : + (CB3_1_4I1R2Terms a).Encloses (Foundation.entropyTerm (CB3_1_4I1R2Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB3_1_4I1R2Certificates_valid + (CB3_1_4I1R2CertificateIndex a) (CB3_1_4I1R2P_sound a) +def CB3_1_4I1R2Entropy : Ball := ⟨(24768128426125482302650282194909 / 50000000000000000000000000000000), (33639038097 / 100000000000000000000000000000000)⟩ +lemma CB3_1_4I1R2Entropy_sound : CB3_1_4I1R2Entropy.Encloses (Foundation.finiteEntropy CB3_1_4I1R2Value) := by + exact contains_sound (entropyFin_enclosed 6 CB3_1_4I1R2Value CB3_1_4I1R2Terms CB3_1_4I1R2Terms_sound) (by decide +kernel) +def CB3_1_4I1R2Mass : Ball := ⟨(12168205337881231686589903120499 / 25000000000000000000000000000000), (11 / 50000000000000000000000000000000)⟩ +lemma CB3_1_4I1R2Mass_sound : CB3_1_4I1R2Mass.Encloses (∑ a, CB3_1_4I1R2Value a) := by + exact contains_sound (finSumBall_sound 6 CB3_1_4I1R2P CB3_1_4I1R2Value CB3_1_4I1R2P_sound) (by decide +kernel) +def CB3_1_4I1R2MassTermLogWitness : LogWitness := ⟨-2, 12168205337881231686589903120499, 6250000000000000000000000000000⟩ +def CB3_1_4I1R2MassTermLog : Ball := ⟨(-14400987896336132212354969653389 / 20000000000000000000000000000000), (31763735547 / 50000000000000000000000000000000)⟩ +lemma CB3_1_4I1R2MassTermLog_sound : CB3_1_4I1R2MassTermLog.Encloses (Real.log ((∑ a, CB3_1_4I1R2Value a))) := by + exact checkLog_sound logTwoBall_sound (CB3_1_4I1R2Mass_sound) (w := CB3_1_4I1R2MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB3_1_4I1R2MassTerm : Ball := ⟨(17523417779096033358476442978537 / 50000000000000000000000000000000), (30920612531 / 100000000000000000000000000000000)⟩ +lemma CB3_1_4I1R2MassTerm_sound : CB3_1_4I1R2MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB3_1_4I1R2Value a))) := by + exact contains_sound (entropyTerm_ball (CB3_1_4I1R2Mass_sound) CB3_1_4I1R2MassTermLog_sound) (by decide +kernel) +def CB3_1_4I1R2H : Ball := ⟨(1811177661757362236043459804093 / 12500000000000000000000000000000), (16139912657 / 25000000000000000000000000000000)⟩ +lemma CB3_1_4I1R2H_sound : CB3_1_4I1R2H.Encloses (homogeneousEntropy CB3_1_4I1R2Value) := by + exact contains_sound (homogeneous_enclosed CB3_1_4I1R2Value CB3_1_4I1R2MassTerm_sound CB3_1_4I1R2Entropy_sound) (by decide +kernel) +def CB3_1_4I1R3Value (a : Fin 6) : ℝ := residualLaw (below (shape 3 1 4)) (fun u => (stageBLaw (shape 3 1 4) u : ℝ)) (stageBPriority (shape 3 1 4)) 1 (fun u a => (littleLaw (shape 3 1 4) u ((stageBPriority (shape 3 1 4)) 1) a : ℝ)) 3 a +def CB3_1_4I1R3Raw (a : Fin 6) : Ball := residualBall (below (shape 3 1 4)) B3_1_4Law (stageBPriority (shape 3 1 4)) 1 (fun u => B3_1_4Little u ((stageBPriority (shape 3 1 4)) 1)) 3 a +lemma CB3_1_4I1R3Raw_sound (a : Fin 6) : + (CB3_1_4I1R3Raw a).Encloses (CB3_1_4I1R3Value a) := by + exact residualBall_sound_on (below (shape 3 1 4)) B3_1_4Law (fun u => (stageBLaw (shape 3 1 4) u : ℝ)) (stageBPriority (shape 3 1 4)) 1 (fun u => B3_1_4Little u ((stageBPriority (shape 3 1 4)) 1)) (fun u a => (littleLaw (shape 3 1 4) u ((stageBPriority (shape 3 1 4)) 1) a : ℝ)) (fun u _ => B3_1_4Law_sound u) (fun u _ a => B3_1_4Little_sound u ((stageBPriority (shape 3 1 4)) 1) a) 3 a +def CB3_1_4I1R3Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(8138014732824595179881072909 / 625000000000000000000000000000), (1 / 20000000000000000000000000000000)⟩ ⟨(5652606947245305451174414549533 / 100000000000000000000000000000000), (2205813341 / 100000000000000000000000000000000)⟩ ⟨(-17364821559137684800421235168797 / 4000000000000000000000000000000), (21175823731 / 12500000000000000000000000000000)⟩ ⟨-7, 8138014732824595179881072909, 4882812500000000000000000000⟩] +lemma CB3_1_4I1R3Certificates_valid : + CB3_1_4I1R3Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB3_1_4I1R3CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | 4 => 1 + | _ => 0 +def CB3_1_4I1R3P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_1_4I1R3Certificates (CB3_1_4I1R3CertificateIndex a)).input +lemma CB3_1_4I1R3P_check : ∀ a : Fin 6, contains (CB3_1_4I1R3Raw a) (CB3_1_4I1R3P a) = true := by + decide +kernel +lemma CB3_1_4I1R3P_sound (a : Fin 6) : + (CB3_1_4I1R3P a).Encloses (CB3_1_4I1R3Value a) := + contains_sound (CB3_1_4I1R3Raw_sound a) (CB3_1_4I1R3P_check a) +def CB3_1_4I1R3Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_1_4I1R3Certificates (CB3_1_4I1R3CertificateIndex a)).output +lemma CB3_1_4I1R3Terms_sound (a : Fin 6) : + (CB3_1_4I1R3Terms a).Encloses (Foundation.entropyTerm (CB3_1_4I1R3Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB3_1_4I1R3Certificates_valid + (CB3_1_4I1R3CertificateIndex a) (CB3_1_4I1R3P_sound a) +def CB3_1_4I1R3Entropy : Ball := ⟨(5652606947245305451174414549533 / 100000000000000000000000000000000), (2205813341 / 100000000000000000000000000000000)⟩ +lemma CB3_1_4I1R3Entropy_sound : CB3_1_4I1R3Entropy.Encloses (Foundation.finiteEntropy CB3_1_4I1R3Value) := by + exact contains_sound (entropyFin_enclosed 6 CB3_1_4I1R3Value CB3_1_4I1R3Terms CB3_1_4I1R3Terms_sound) (by decide +kernel) +def CB3_1_4I1R3Mass : Ball := ⟨(8138014732824595179881072909 / 625000000000000000000000000000), (1 / 20000000000000000000000000000000)⟩ +lemma CB3_1_4I1R3Mass_sound : CB3_1_4I1R3Mass.Encloses (∑ a, CB3_1_4I1R3Value a) := by + exact contains_sound (finSumBall_sound 6 CB3_1_4I1R3P CB3_1_4I1R3Value CB3_1_4I1R3P_sound) (by decide +kernel) +def CB3_1_4I1R3MassTermLogWitness : LogWitness := ⟨-7, 8138014732824595179881072909, 4882812500000000000000000000⟩ +def CB3_1_4I1R3MassTermLog : Ball := ⟨(-17364821559137684800421235168797 / 4000000000000000000000000000000), (21175823731 / 12500000000000000000000000000000)⟩ +lemma CB3_1_4I1R3MassTermLog_sound : CB3_1_4I1R3MassTermLog.Encloses (Real.log ((∑ a, CB3_1_4I1R3Value a))) := by + exact checkLog_sound logTwoBall_sound (CB3_1_4I1R3Mass_sound) (w := CB3_1_4I1R3MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB3_1_4I1R3MassTerm : Ball := ⟨(5652606947245305451174414549533 / 100000000000000000000000000000000), (2205813341 / 100000000000000000000000000000000)⟩ +lemma CB3_1_4I1R3MassTerm_sound : CB3_1_4I1R3MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB3_1_4I1R3Value a))) := by + exact contains_sound (entropyTerm_ball (CB3_1_4I1R3Mass_sound) CB3_1_4I1R3MassTermLog_sound) (by decide +kernel) +def CB3_1_4I1R3H : Ball := ⟨0, (2205813341 / 50000000000000000000000000000000)⟩ +lemma CB3_1_4I1R3H_sound : CB3_1_4I1R3H.Encloses (homogeneousEntropy CB3_1_4I1R3Value) := by + exact contains_sound (homogeneous_enclosed CB3_1_4I1R3Value CB3_1_4I1R3MassTerm_sound CB3_1_4I1R3Entropy_sound) (by decide +kernel) +def CB3_1_4I1R4Value (a : Fin 6) : ℝ := residualLaw (below (shape 3 1 4)) (fun u => (stageBLaw (shape 3 1 4) u : ℝ)) (stageBPriority (shape 3 1 4)) 1 (fun u a => (littleLaw (shape 3 1 4) u ((stageBPriority (shape 3 1 4)) 1) a : ℝ)) 4 a +def CB3_1_4I1R4Raw (a : Fin 6) : Ball := residualBall (below (shape 3 1 4)) B3_1_4Law (stageBPriority (shape 3 1 4)) 1 (fun u => B3_1_4Little u ((stageBPriority (shape 3 1 4)) 1)) 4 a +lemma CB3_1_4I1R4Raw_sound (a : Fin 6) : + (CB3_1_4I1R4Raw a).Encloses (CB3_1_4I1R4Value a) := by + exact residualBall_sound_on (below (shape 3 1 4)) B3_1_4Law (fun u => (stageBLaw (shape 3 1 4) u : ℝ)) (stageBPriority (shape 3 1 4)) 1 (fun u => B3_1_4Little u ((stageBPriority (shape 3 1 4)) 1)) (fun u a => (littleLaw (shape 3 1 4) u ((stageBPriority (shape 3 1 4)) 1) a : ℝ)) (fun u _ => B3_1_4Law_sound u) (fun u _ a => B3_1_4Little_sound u ((stageBPriority (shape 3 1 4)) 1) a) 4 a +def CB3_1_4I1R4Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB3_1_4I1R4Certificates_valid : + CB3_1_4I1R4Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB3_1_4I1R4CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB3_1_4I1R4P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_1_4I1R4Certificates (CB3_1_4I1R4CertificateIndex a)).input +lemma CB3_1_4I1R4P_check : ∀ a : Fin 6, contains (CB3_1_4I1R4Raw a) (CB3_1_4I1R4P a) = true := by + decide +kernel +lemma CB3_1_4I1R4P_sound (a : Fin 6) : + (CB3_1_4I1R4P a).Encloses (CB3_1_4I1R4Value a) := + contains_sound (CB3_1_4I1R4Raw_sound a) (CB3_1_4I1R4P_check a) +def CB3_1_4I1R4Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_1_4I1R4Certificates (CB3_1_4I1R4CertificateIndex a)).output +lemma CB3_1_4I1R4Terms_sound (a : Fin 6) : + (CB3_1_4I1R4Terms a).Encloses (Foundation.entropyTerm (CB3_1_4I1R4Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB3_1_4I1R4Certificates_valid + (CB3_1_4I1R4CertificateIndex a) (CB3_1_4I1R4P_sound a) +def CB3_1_4I1R4Entropy : Ball := ⟨0, 0⟩ +lemma CB3_1_4I1R4Entropy_sound : CB3_1_4I1R4Entropy.Encloses (Foundation.finiteEntropy CB3_1_4I1R4Value) := by + exact contains_sound (entropyFin_enclosed 6 CB3_1_4I1R4Value CB3_1_4I1R4Terms CB3_1_4I1R4Terms_sound) (by decide +kernel) +def CB3_1_4I1R4Mass : Ball := ⟨0, 0⟩ +lemma CB3_1_4I1R4Mass_sound : CB3_1_4I1R4Mass.Encloses (∑ a, CB3_1_4I1R4Value a) := by + exact contains_sound (finSumBall_sound 6 CB3_1_4I1R4P CB3_1_4I1R4Value CB3_1_4I1R4P_sound) (by decide +kernel) +def CB3_1_4I1R4MassTerm : Ball := .exact 0 +lemma CB3_1_4I1R4MassTerm_sound : CB3_1_4I1R4MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB3_1_4I1R4Value a))) := + entropyTerm_zero_ball (CB3_1_4I1R4Mass_sound) +def CB3_1_4I1R4H : Ball := ⟨0, 0⟩ +lemma CB3_1_4I1R4H_sound : CB3_1_4I1R4H.Encloses (homogeneousEntropy CB3_1_4I1R4Value) := by + exact contains_sound (homogeneous_enclosed CB3_1_4I1R4Value CB3_1_4I1R4MassTerm_sound CB3_1_4I1R4Entropy_sound) (by decide +kernel) +def CB3_1_4I1R5Value (a : Fin 6) : ℝ := residualLaw (below (shape 3 1 4)) (fun u => (stageBLaw (shape 3 1 4) u : ℝ)) (stageBPriority (shape 3 1 4)) 1 (fun u a => (littleLaw (shape 3 1 4) u ((stageBPriority (shape 3 1 4)) 1) a : ℝ)) 5 a +def CB3_1_4I1R5Raw (a : Fin 6) : Ball := residualBall (below (shape 3 1 4)) B3_1_4Law (stageBPriority (shape 3 1 4)) 1 (fun u => B3_1_4Little u ((stageBPriority (shape 3 1 4)) 1)) 5 a +lemma CB3_1_4I1R5Raw_sound (a : Fin 6) : + (CB3_1_4I1R5Raw a).Encloses (CB3_1_4I1R5Value a) := by + exact residualBall_sound_on (below (shape 3 1 4)) B3_1_4Law (fun u => (stageBLaw (shape 3 1 4) u : ℝ)) (stageBPriority (shape 3 1 4)) 1 (fun u => B3_1_4Little u ((stageBPriority (shape 3 1 4)) 1)) (fun u a => (littleLaw (shape 3 1 4) u ((stageBPriority (shape 3 1 4)) 1) a : ℝ)) (fun u _ => B3_1_4Law_sound u) (fun u _ a => B3_1_4Little_sound u ((stageBPriority (shape 3 1 4)) 1) a) 5 a +def CB3_1_4I1R5Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB3_1_4I1R5Certificates_valid : + CB3_1_4I1R5Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB3_1_4I1R5CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB3_1_4I1R5P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_1_4I1R5Certificates (CB3_1_4I1R5CertificateIndex a)).input +lemma CB3_1_4I1R5P_check : ∀ a : Fin 6, contains (CB3_1_4I1R5Raw a) (CB3_1_4I1R5P a) = true := by + decide +kernel +lemma CB3_1_4I1R5P_sound (a : Fin 6) : + (CB3_1_4I1R5P a).Encloses (CB3_1_4I1R5Value a) := + contains_sound (CB3_1_4I1R5Raw_sound a) (CB3_1_4I1R5P_check a) +def CB3_1_4I1R5Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_1_4I1R5Certificates (CB3_1_4I1R5CertificateIndex a)).output +lemma CB3_1_4I1R5Terms_sound (a : Fin 6) : + (CB3_1_4I1R5Terms a).Encloses (Foundation.entropyTerm (CB3_1_4I1R5Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB3_1_4I1R5Certificates_valid + (CB3_1_4I1R5CertificateIndex a) (CB3_1_4I1R5P_sound a) +def CB3_1_4I1R5Entropy : Ball := ⟨0, 0⟩ +lemma CB3_1_4I1R5Entropy_sound : CB3_1_4I1R5Entropy.Encloses (Foundation.finiteEntropy CB3_1_4I1R5Value) := by + exact contains_sound (entropyFin_enclosed 6 CB3_1_4I1R5Value CB3_1_4I1R5Terms CB3_1_4I1R5Terms_sound) (by decide +kernel) +def CB3_1_4I1R5Mass : Ball := ⟨0, 0⟩ +lemma CB3_1_4I1R5Mass_sound : CB3_1_4I1R5Mass.Encloses (∑ a, CB3_1_4I1R5Value a) := by + exact contains_sound (finSumBall_sound 6 CB3_1_4I1R5P CB3_1_4I1R5Value CB3_1_4I1R5P_sound) (by decide +kernel) +def CB3_1_4I1R5MassTerm : Ball := .exact 0 +lemma CB3_1_4I1R5MassTerm_sound : CB3_1_4I1R5MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB3_1_4I1R5Value a))) := + entropyTerm_zero_ball (CB3_1_4I1R5Mass_sound) +def CB3_1_4I1R5H : Ball := ⟨0, 0⟩ +lemma CB3_1_4I1R5H_sound : CB3_1_4I1R5H.Encloses (homogeneousEntropy CB3_1_4I1R5Value) := by + exact contains_sound (homogeneous_enclosed CB3_1_4I1R5Value CB3_1_4I1R5MassTerm_sound CB3_1_4I1R5Entropy_sound) (by decide +kernel) +def CB3_1_4I1R6Value (a : Fin 6) : ℝ := residualLaw (below (shape 3 1 4)) (fun u => (stageBLaw (shape 3 1 4) u : ℝ)) (stageBPriority (shape 3 1 4)) 1 (fun u a => (littleLaw (shape 3 1 4) u ((stageBPriority (shape 3 1 4)) 1) a : ℝ)) 6 a +def CB3_1_4I1R6Raw (a : Fin 6) : Ball := residualBall (below (shape 3 1 4)) B3_1_4Law (stageBPriority (shape 3 1 4)) 1 (fun u => B3_1_4Little u ((stageBPriority (shape 3 1 4)) 1)) 6 a +lemma CB3_1_4I1R6Raw_sound (a : Fin 6) : + (CB3_1_4I1R6Raw a).Encloses (CB3_1_4I1R6Value a) := by + exact residualBall_sound_on (below (shape 3 1 4)) B3_1_4Law (fun u => (stageBLaw (shape 3 1 4) u : ℝ)) (stageBPriority (shape 3 1 4)) 1 (fun u => B3_1_4Little u ((stageBPriority (shape 3 1 4)) 1)) (fun u a => (littleLaw (shape 3 1 4) u ((stageBPriority (shape 3 1 4)) 1) a : ℝ)) (fun u _ => B3_1_4Law_sound u) (fun u _ a => B3_1_4Little_sound u ((stageBPriority (shape 3 1 4)) 1) a) 6 a +def CB3_1_4I1R6Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB3_1_4I1R6Certificates_valid : + CB3_1_4I1R6Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB3_1_4I1R6CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB3_1_4I1R6P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_1_4I1R6Certificates (CB3_1_4I1R6CertificateIndex a)).input +lemma CB3_1_4I1R6P_check : ∀ a : Fin 6, contains (CB3_1_4I1R6Raw a) (CB3_1_4I1R6P a) = true := by + decide +kernel +lemma CB3_1_4I1R6P_sound (a : Fin 6) : + (CB3_1_4I1R6P a).Encloses (CB3_1_4I1R6Value a) := + contains_sound (CB3_1_4I1R6Raw_sound a) (CB3_1_4I1R6P_check a) +def CB3_1_4I1R6Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_1_4I1R6Certificates (CB3_1_4I1R6CertificateIndex a)).output +lemma CB3_1_4I1R6Terms_sound (a : Fin 6) : + (CB3_1_4I1R6Terms a).Encloses (Foundation.entropyTerm (CB3_1_4I1R6Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB3_1_4I1R6Certificates_valid + (CB3_1_4I1R6CertificateIndex a) (CB3_1_4I1R6P_sound a) +def CB3_1_4I1R6Entropy : Ball := ⟨0, 0⟩ +lemma CB3_1_4I1R6Entropy_sound : CB3_1_4I1R6Entropy.Encloses (Foundation.finiteEntropy CB3_1_4I1R6Value) := by + exact contains_sound (entropyFin_enclosed 6 CB3_1_4I1R6Value CB3_1_4I1R6Terms CB3_1_4I1R6Terms_sound) (by decide +kernel) +def CB3_1_4I1R6Mass : Ball := ⟨0, 0⟩ +lemma CB3_1_4I1R6Mass_sound : CB3_1_4I1R6Mass.Encloses (∑ a, CB3_1_4I1R6Value a) := by + exact contains_sound (finSumBall_sound 6 CB3_1_4I1R6P CB3_1_4I1R6Value CB3_1_4I1R6P_sound) (by decide +kernel) +def CB3_1_4I1R6MassTerm : Ball := .exact 0 +lemma CB3_1_4I1R6MassTerm_sound : CB3_1_4I1R6MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB3_1_4I1R6Value a))) := + entropyTerm_zero_ball (CB3_1_4I1R6Mass_sound) +def CB3_1_4I1R6H : Ball := ⟨0, 0⟩ +lemma CB3_1_4I1R6H_sound : CB3_1_4I1R6H.Encloses (homogeneousEntropy CB3_1_4I1R6Value) := by + exact contains_sound (homogeneous_enclosed CB3_1_4I1R6Value CB3_1_4I1R6MassTerm_sound CB3_1_4I1R6Entropy_sound) (by decide +kernel) +def CB3_1_4I1R7Value (a : Fin 6) : ℝ := residualLaw (below (shape 3 1 4)) (fun u => (stageBLaw (shape 3 1 4) u : ℝ)) (stageBPriority (shape 3 1 4)) 1 (fun u a => (littleLaw (shape 3 1 4) u ((stageBPriority (shape 3 1 4)) 1) a : ℝ)) 7 a +def CB3_1_4I1R7Raw (a : Fin 6) : Ball := residualBall (below (shape 3 1 4)) B3_1_4Law (stageBPriority (shape 3 1 4)) 1 (fun u => B3_1_4Little u ((stageBPriority (shape 3 1 4)) 1)) 7 a +lemma CB3_1_4I1R7Raw_sound (a : Fin 6) : + (CB3_1_4I1R7Raw a).Encloses (CB3_1_4I1R7Value a) := by + exact residualBall_sound_on (below (shape 3 1 4)) B3_1_4Law (fun u => (stageBLaw (shape 3 1 4) u : ℝ)) (stageBPriority (shape 3 1 4)) 1 (fun u => B3_1_4Little u ((stageBPriority (shape 3 1 4)) 1)) (fun u a => (littleLaw (shape 3 1 4) u ((stageBPriority (shape 3 1 4)) 1) a : ℝ)) (fun u _ => B3_1_4Law_sound u) (fun u _ a => B3_1_4Little_sound u ((stageBPriority (shape 3 1 4)) 1) a) 7 a +def CB3_1_4I1R7Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB3_1_4I1R7Certificates_valid : + CB3_1_4I1R7Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB3_1_4I1R7CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB3_1_4I1R7P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_1_4I1R7Certificates (CB3_1_4I1R7CertificateIndex a)).input +lemma CB3_1_4I1R7P_check : ∀ a : Fin 6, contains (CB3_1_4I1R7Raw a) (CB3_1_4I1R7P a) = true := by + decide +kernel +lemma CB3_1_4I1R7P_sound (a : Fin 6) : + (CB3_1_4I1R7P a).Encloses (CB3_1_4I1R7Value a) := + contains_sound (CB3_1_4I1R7Raw_sound a) (CB3_1_4I1R7P_check a) +def CB3_1_4I1R7Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_1_4I1R7Certificates (CB3_1_4I1R7CertificateIndex a)).output +lemma CB3_1_4I1R7Terms_sound (a : Fin 6) : + (CB3_1_4I1R7Terms a).Encloses (Foundation.entropyTerm (CB3_1_4I1R7Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB3_1_4I1R7Certificates_valid + (CB3_1_4I1R7CertificateIndex a) (CB3_1_4I1R7P_sound a) +def CB3_1_4I1R7Entropy : Ball := ⟨0, 0⟩ +lemma CB3_1_4I1R7Entropy_sound : CB3_1_4I1R7Entropy.Encloses (Foundation.finiteEntropy CB3_1_4I1R7Value) := by + exact contains_sound (entropyFin_enclosed 6 CB3_1_4I1R7Value CB3_1_4I1R7Terms CB3_1_4I1R7Terms_sound) (by decide +kernel) +def CB3_1_4I1R7Mass : Ball := ⟨0, 0⟩ +lemma CB3_1_4I1R7Mass_sound : CB3_1_4I1R7Mass.Encloses (∑ a, CB3_1_4I1R7Value a) := by + exact contains_sound (finSumBall_sound 6 CB3_1_4I1R7P CB3_1_4I1R7Value CB3_1_4I1R7P_sound) (by decide +kernel) +def CB3_1_4I1R7MassTerm : Ball := .exact 0 +lemma CB3_1_4I1R7MassTerm_sound : CB3_1_4I1R7MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB3_1_4I1R7Value a))) := + entropyTerm_zero_ball (CB3_1_4I1R7Mass_sound) +def CB3_1_4I1R7H : Ball := ⟨0, 0⟩ +lemma CB3_1_4I1R7H_sound : CB3_1_4I1R7H.Encloses (homogeneousEntropy CB3_1_4I1R7Value) := by + exact contains_sound (homogeneous_enclosed CB3_1_4I1R7Value CB3_1_4I1R7MassTerm_sound CB3_1_4I1R7Entropy_sound) (by decide +kernel) +def CB3_1_4I1R8Value (a : Fin 6) : ℝ := residualLaw (below (shape 3 1 4)) (fun u => (stageBLaw (shape 3 1 4) u : ℝ)) (stageBPriority (shape 3 1 4)) 1 (fun u a => (littleLaw (shape 3 1 4) u ((stageBPriority (shape 3 1 4)) 1) a : ℝ)) 8 a +def CB3_1_4I1R8Raw (a : Fin 6) : Ball := residualBall (below (shape 3 1 4)) B3_1_4Law (stageBPriority (shape 3 1 4)) 1 (fun u => B3_1_4Little u ((stageBPriority (shape 3 1 4)) 1)) 8 a +lemma CB3_1_4I1R8Raw_sound (a : Fin 6) : + (CB3_1_4I1R8Raw a).Encloses (CB3_1_4I1R8Value a) := by + exact residualBall_sound_on (below (shape 3 1 4)) B3_1_4Law (fun u => (stageBLaw (shape 3 1 4) u : ℝ)) (stageBPriority (shape 3 1 4)) 1 (fun u => B3_1_4Little u ((stageBPriority (shape 3 1 4)) 1)) (fun u a => (littleLaw (shape 3 1 4) u ((stageBPriority (shape 3 1 4)) 1) a : ℝ)) (fun u _ => B3_1_4Law_sound u) (fun u _ a => B3_1_4Little_sound u ((stageBPriority (shape 3 1 4)) 1) a) 8 a +def CB3_1_4I1R8Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB3_1_4I1R8Certificates_valid : + CB3_1_4I1R8Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB3_1_4I1R8CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB3_1_4I1R8P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_1_4I1R8Certificates (CB3_1_4I1R8CertificateIndex a)).input +lemma CB3_1_4I1R8P_check : ∀ a : Fin 6, contains (CB3_1_4I1R8Raw a) (CB3_1_4I1R8P a) = true := by + decide +kernel +lemma CB3_1_4I1R8P_sound (a : Fin 6) : + (CB3_1_4I1R8P a).Encloses (CB3_1_4I1R8Value a) := + contains_sound (CB3_1_4I1R8Raw_sound a) (CB3_1_4I1R8P_check a) +def CB3_1_4I1R8Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_1_4I1R8Certificates (CB3_1_4I1R8CertificateIndex a)).output +lemma CB3_1_4I1R8Terms_sound (a : Fin 6) : + (CB3_1_4I1R8Terms a).Encloses (Foundation.entropyTerm (CB3_1_4I1R8Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB3_1_4I1R8Certificates_valid + (CB3_1_4I1R8CertificateIndex a) (CB3_1_4I1R8P_sound a) +def CB3_1_4I1R8Entropy : Ball := ⟨0, 0⟩ +lemma CB3_1_4I1R8Entropy_sound : CB3_1_4I1R8Entropy.Encloses (Foundation.finiteEntropy CB3_1_4I1R8Value) := by + exact contains_sound (entropyFin_enclosed 6 CB3_1_4I1R8Value CB3_1_4I1R8Terms CB3_1_4I1R8Terms_sound) (by decide +kernel) +def CB3_1_4I1R8Mass : Ball := ⟨0, 0⟩ +lemma CB3_1_4I1R8Mass_sound : CB3_1_4I1R8Mass.Encloses (∑ a, CB3_1_4I1R8Value a) := by + exact contains_sound (finSumBall_sound 6 CB3_1_4I1R8P CB3_1_4I1R8Value CB3_1_4I1R8P_sound) (by decide +kernel) +def CB3_1_4I1R8MassTerm : Ball := .exact 0 +lemma CB3_1_4I1R8MassTerm_sound : CB3_1_4I1R8MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB3_1_4I1R8Value a))) := + entropyTerm_zero_ball (CB3_1_4I1R8Mass_sound) +def CB3_1_4I1R8H : Ball := ⟨0, 0⟩ +lemma CB3_1_4I1R8H_sound : CB3_1_4I1R8H.Encloses (homogeneousEntropy CB3_1_4I1R8Value) := by + exact contains_sound (homogeneous_enclosed CB3_1_4I1R8Value CB3_1_4I1R8MassTerm_sound CB3_1_4I1R8Entropy_sound) (by decide +kernel) +def CB3_1_4I1R9Value (a : Fin 6) : ℝ := residualLaw (below (shape 3 1 4)) (fun u => (stageBLaw (shape 3 1 4) u : ℝ)) (stageBPriority (shape 3 1 4)) 1 (fun u a => (littleLaw (shape 3 1 4) u ((stageBPriority (shape 3 1 4)) 1) a : ℝ)) 9 a +def CB3_1_4I1R9Raw (a : Fin 6) : Ball := residualBall (below (shape 3 1 4)) B3_1_4Law (stageBPriority (shape 3 1 4)) 1 (fun u => B3_1_4Little u ((stageBPriority (shape 3 1 4)) 1)) 9 a +lemma CB3_1_4I1R9Raw_sound (a : Fin 6) : + (CB3_1_4I1R9Raw a).Encloses (CB3_1_4I1R9Value a) := by + exact residualBall_sound_on (below (shape 3 1 4)) B3_1_4Law (fun u => (stageBLaw (shape 3 1 4) u : ℝ)) (stageBPriority (shape 3 1 4)) 1 (fun u => B3_1_4Little u ((stageBPriority (shape 3 1 4)) 1)) (fun u a => (littleLaw (shape 3 1 4) u ((stageBPriority (shape 3 1 4)) 1) a : ℝ)) (fun u _ => B3_1_4Law_sound u) (fun u _ a => B3_1_4Little_sound u ((stageBPriority (shape 3 1 4)) 1) a) 9 a +def CB3_1_4I1R9Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB3_1_4I1R9Certificates_valid : + CB3_1_4I1R9Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB3_1_4I1R9CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB3_1_4I1R9P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_1_4I1R9Certificates (CB3_1_4I1R9CertificateIndex a)).input +lemma CB3_1_4I1R9P_check : ∀ a : Fin 6, contains (CB3_1_4I1R9Raw a) (CB3_1_4I1R9P a) = true := by + decide +kernel +lemma CB3_1_4I1R9P_sound (a : Fin 6) : + (CB3_1_4I1R9P a).Encloses (CB3_1_4I1R9Value a) := + contains_sound (CB3_1_4I1R9Raw_sound a) (CB3_1_4I1R9P_check a) +def CB3_1_4I1R9Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_1_4I1R9Certificates (CB3_1_4I1R9CertificateIndex a)).output +lemma CB3_1_4I1R9Terms_sound (a : Fin 6) : + (CB3_1_4I1R9Terms a).Encloses (Foundation.entropyTerm (CB3_1_4I1R9Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB3_1_4I1R9Certificates_valid + (CB3_1_4I1R9CertificateIndex a) (CB3_1_4I1R9P_sound a) +def CB3_1_4I1R9Entropy : Ball := ⟨0, 0⟩ +lemma CB3_1_4I1R9Entropy_sound : CB3_1_4I1R9Entropy.Encloses (Foundation.finiteEntropy CB3_1_4I1R9Value) := by + exact contains_sound (entropyFin_enclosed 6 CB3_1_4I1R9Value CB3_1_4I1R9Terms CB3_1_4I1R9Terms_sound) (by decide +kernel) +def CB3_1_4I1R9Mass : Ball := ⟨0, 0⟩ +lemma CB3_1_4I1R9Mass_sound : CB3_1_4I1R9Mass.Encloses (∑ a, CB3_1_4I1R9Value a) := by + exact contains_sound (finSumBall_sound 6 CB3_1_4I1R9P CB3_1_4I1R9Value CB3_1_4I1R9P_sound) (by decide +kernel) +def CB3_1_4I1R9MassTerm : Ball := .exact 0 +lemma CB3_1_4I1R9MassTerm_sound : CB3_1_4I1R9MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB3_1_4I1R9Value a))) := + entropyTerm_zero_ball (CB3_1_4I1R9Mass_sound) +def CB3_1_4I1R9H : Ball := ⟨0, 0⟩ +lemma CB3_1_4I1R9H_sound : CB3_1_4I1R9H.Encloses (homogeneousEntropy CB3_1_4I1R9Value) := by + exact contains_sound (homogeneous_enclosed CB3_1_4I1R9Value CB3_1_4I1R9MassTerm_sound CB3_1_4I1R9Entropy_sound) (by decide +kernel) +def CB3_1_4I1R10Value (a : Fin 6) : ℝ := residualLaw (below (shape 3 1 4)) (fun u => (stageBLaw (shape 3 1 4) u : ℝ)) (stageBPriority (shape 3 1 4)) 1 (fun u a => (littleLaw (shape 3 1 4) u ((stageBPriority (shape 3 1 4)) 1) a : ℝ)) 10 a +def CB3_1_4I1R10Raw (a : Fin 6) : Ball := residualBall (below (shape 3 1 4)) B3_1_4Law (stageBPriority (shape 3 1 4)) 1 (fun u => B3_1_4Little u ((stageBPriority (shape 3 1 4)) 1)) 10 a +lemma CB3_1_4I1R10Raw_sound (a : Fin 6) : + (CB3_1_4I1R10Raw a).Encloses (CB3_1_4I1R10Value a) := by + exact residualBall_sound_on (below (shape 3 1 4)) B3_1_4Law (fun u => (stageBLaw (shape 3 1 4) u : ℝ)) (stageBPriority (shape 3 1 4)) 1 (fun u => B3_1_4Little u ((stageBPriority (shape 3 1 4)) 1)) (fun u a => (littleLaw (shape 3 1 4) u ((stageBPriority (shape 3 1 4)) 1) a : ℝ)) (fun u _ => B3_1_4Law_sound u) (fun u _ a => B3_1_4Little_sound u ((stageBPriority (shape 3 1 4)) 1) a) 10 a +def CB3_1_4I1R10Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB3_1_4I1R10Certificates_valid : + CB3_1_4I1R10Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB3_1_4I1R10CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB3_1_4I1R10P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_1_4I1R10Certificates (CB3_1_4I1R10CertificateIndex a)).input +lemma CB3_1_4I1R10P_check : ∀ a : Fin 6, contains (CB3_1_4I1R10Raw a) (CB3_1_4I1R10P a) = true := by + decide +kernel +lemma CB3_1_4I1R10P_sound (a : Fin 6) : + (CB3_1_4I1R10P a).Encloses (CB3_1_4I1R10Value a) := + contains_sound (CB3_1_4I1R10Raw_sound a) (CB3_1_4I1R10P_check a) +def CB3_1_4I1R10Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_1_4I1R10Certificates (CB3_1_4I1R10CertificateIndex a)).output +lemma CB3_1_4I1R10Terms_sound (a : Fin 6) : + (CB3_1_4I1R10Terms a).Encloses (Foundation.entropyTerm (CB3_1_4I1R10Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB3_1_4I1R10Certificates_valid + (CB3_1_4I1R10CertificateIndex a) (CB3_1_4I1R10P_sound a) +def CB3_1_4I1R10Entropy : Ball := ⟨0, 0⟩ +lemma CB3_1_4I1R10Entropy_sound : CB3_1_4I1R10Entropy.Encloses (Foundation.finiteEntropy CB3_1_4I1R10Value) := by + exact contains_sound (entropyFin_enclosed 6 CB3_1_4I1R10Value CB3_1_4I1R10Terms CB3_1_4I1R10Terms_sound) (by decide +kernel) +def CB3_1_4I1R10Mass : Ball := ⟨0, 0⟩ +lemma CB3_1_4I1R10Mass_sound : CB3_1_4I1R10Mass.Encloses (∑ a, CB3_1_4I1R10Value a) := by + exact contains_sound (finSumBall_sound 6 CB3_1_4I1R10P CB3_1_4I1R10Value CB3_1_4I1R10P_sound) (by decide +kernel) +def CB3_1_4I1R10MassTerm : Ball := .exact 0 +lemma CB3_1_4I1R10MassTerm_sound : CB3_1_4I1R10MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB3_1_4I1R10Value a))) := + entropyTerm_zero_ball (CB3_1_4I1R10Mass_sound) +def CB3_1_4I1R10H : Ball := ⟨0, 0⟩ +lemma CB3_1_4I1R10H_sound : CB3_1_4I1R10H.Encloses (homogeneousEntropy CB3_1_4I1R10Value) := by + exact contains_sound (homogeneous_enclosed CB3_1_4I1R10Value CB3_1_4I1R10MassTerm_sound CB3_1_4I1R10Entropy_sound) (by decide +kernel) +def CB3_1_4I1R11Value (a : Fin 6) : ℝ := residualLaw (below (shape 3 1 4)) (fun u => (stageBLaw (shape 3 1 4) u : ℝ)) (stageBPriority (shape 3 1 4)) 1 (fun u a => (littleLaw (shape 3 1 4) u ((stageBPriority (shape 3 1 4)) 1) a : ℝ)) 11 a +def CB3_1_4I1R11Raw (a : Fin 6) : Ball := residualBall (below (shape 3 1 4)) B3_1_4Law (stageBPriority (shape 3 1 4)) 1 (fun u => B3_1_4Little u ((stageBPriority (shape 3 1 4)) 1)) 11 a +lemma CB3_1_4I1R11Raw_sound (a : Fin 6) : + (CB3_1_4I1R11Raw a).Encloses (CB3_1_4I1R11Value a) := by + exact residualBall_sound_on (below (shape 3 1 4)) B3_1_4Law (fun u => (stageBLaw (shape 3 1 4) u : ℝ)) (stageBPriority (shape 3 1 4)) 1 (fun u => B3_1_4Little u ((stageBPriority (shape 3 1 4)) 1)) (fun u a => (littleLaw (shape 3 1 4) u ((stageBPriority (shape 3 1 4)) 1) a : ℝ)) (fun u _ => B3_1_4Law_sound u) (fun u _ a => B3_1_4Little_sound u ((stageBPriority (shape 3 1 4)) 1) a) 11 a +def CB3_1_4I1R11Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB3_1_4I1R11Certificates_valid : + CB3_1_4I1R11Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB3_1_4I1R11CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB3_1_4I1R11P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_1_4I1R11Certificates (CB3_1_4I1R11CertificateIndex a)).input +lemma CB3_1_4I1R11P_check : ∀ a : Fin 6, contains (CB3_1_4I1R11Raw a) (CB3_1_4I1R11P a) = true := by + decide +kernel +lemma CB3_1_4I1R11P_sound (a : Fin 6) : + (CB3_1_4I1R11P a).Encloses (CB3_1_4I1R11Value a) := + contains_sound (CB3_1_4I1R11Raw_sound a) (CB3_1_4I1R11P_check a) +def CB3_1_4I1R11Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_1_4I1R11Certificates (CB3_1_4I1R11CertificateIndex a)).output +lemma CB3_1_4I1R11Terms_sound (a : Fin 6) : + (CB3_1_4I1R11Terms a).Encloses (Foundation.entropyTerm (CB3_1_4I1R11Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB3_1_4I1R11Certificates_valid + (CB3_1_4I1R11CertificateIndex a) (CB3_1_4I1R11P_sound a) +def CB3_1_4I1R11Entropy : Ball := ⟨0, 0⟩ +lemma CB3_1_4I1R11Entropy_sound : CB3_1_4I1R11Entropy.Encloses (Foundation.finiteEntropy CB3_1_4I1R11Value) := by + exact contains_sound (entropyFin_enclosed 6 CB3_1_4I1R11Value CB3_1_4I1R11Terms CB3_1_4I1R11Terms_sound) (by decide +kernel) +def CB3_1_4I1R11Mass : Ball := ⟨0, 0⟩ +lemma CB3_1_4I1R11Mass_sound : CB3_1_4I1R11Mass.Encloses (∑ a, CB3_1_4I1R11Value a) := by + exact contains_sound (finSumBall_sound 6 CB3_1_4I1R11P CB3_1_4I1R11Value CB3_1_4I1R11P_sound) (by decide +kernel) +def CB3_1_4I1R11MassTerm : Ball := .exact 0 +lemma CB3_1_4I1R11MassTerm_sound : CB3_1_4I1R11MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB3_1_4I1R11Value a))) := + entropyTerm_zero_ball (CB3_1_4I1R11Mass_sound) +def CB3_1_4I1R11H : Ball := ⟨0, 0⟩ +lemma CB3_1_4I1R11H_sound : CB3_1_4I1R11H.Encloses (homogeneousEntropy CB3_1_4I1R11Value) := by + exact contains_sound (homogeneous_enclosed CB3_1_4I1R11Value CB3_1_4I1R11MassTerm_sound CB3_1_4I1R11Entropy_sound) (by decide +kernel) +def CB3_1_4I1R12Value (a : Fin 6) : ℝ := residualLaw (below (shape 3 1 4)) (fun u => (stageBLaw (shape 3 1 4) u : ℝ)) (stageBPriority (shape 3 1 4)) 1 (fun u a => (littleLaw (shape 3 1 4) u ((stageBPriority (shape 3 1 4)) 1) a : ℝ)) 12 a +def CB3_1_4I1R12Raw (a : Fin 6) : Ball := residualBall (below (shape 3 1 4)) B3_1_4Law (stageBPriority (shape 3 1 4)) 1 (fun u => B3_1_4Little u ((stageBPriority (shape 3 1 4)) 1)) 12 a +lemma CB3_1_4I1R12Raw_sound (a : Fin 6) : + (CB3_1_4I1R12Raw a).Encloses (CB3_1_4I1R12Value a) := by + exact residualBall_sound_on (below (shape 3 1 4)) B3_1_4Law (fun u => (stageBLaw (shape 3 1 4) u : ℝ)) (stageBPriority (shape 3 1 4)) 1 (fun u => B3_1_4Little u ((stageBPriority (shape 3 1 4)) 1)) (fun u a => (littleLaw (shape 3 1 4) u ((stageBPriority (shape 3 1 4)) 1) a : ℝ)) (fun u _ => B3_1_4Law_sound u) (fun u _ a => B3_1_4Little_sound u ((stageBPriority (shape 3 1 4)) 1) a) 12 a +def CB3_1_4I1R12Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB3_1_4I1R12Certificates_valid : + CB3_1_4I1R12Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB3_1_4I1R12CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB3_1_4I1R12P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_1_4I1R12Certificates (CB3_1_4I1R12CertificateIndex a)).input +lemma CB3_1_4I1R12P_check : ∀ a : Fin 6, contains (CB3_1_4I1R12Raw a) (CB3_1_4I1R12P a) = true := by + decide +kernel +lemma CB3_1_4I1R12P_sound (a : Fin 6) : + (CB3_1_4I1R12P a).Encloses (CB3_1_4I1R12Value a) := + contains_sound (CB3_1_4I1R12Raw_sound a) (CB3_1_4I1R12P_check a) +def CB3_1_4I1R12Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_1_4I1R12Certificates (CB3_1_4I1R12CertificateIndex a)).output +lemma CB3_1_4I1R12Terms_sound (a : Fin 6) : + (CB3_1_4I1R12Terms a).Encloses (Foundation.entropyTerm (CB3_1_4I1R12Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB3_1_4I1R12Certificates_valid + (CB3_1_4I1R12CertificateIndex a) (CB3_1_4I1R12P_sound a) +def CB3_1_4I1R12Entropy : Ball := ⟨0, 0⟩ +lemma CB3_1_4I1R12Entropy_sound : CB3_1_4I1R12Entropy.Encloses (Foundation.finiteEntropy CB3_1_4I1R12Value) := by + exact contains_sound (entropyFin_enclosed 6 CB3_1_4I1R12Value CB3_1_4I1R12Terms CB3_1_4I1R12Terms_sound) (by decide +kernel) +def CB3_1_4I1R12Mass : Ball := ⟨0, 0⟩ +lemma CB3_1_4I1R12Mass_sound : CB3_1_4I1R12Mass.Encloses (∑ a, CB3_1_4I1R12Value a) := by + exact contains_sound (finSumBall_sound 6 CB3_1_4I1R12P CB3_1_4I1R12Value CB3_1_4I1R12P_sound) (by decide +kernel) +def CB3_1_4I1R12MassTerm : Ball := .exact 0 +lemma CB3_1_4I1R12MassTerm_sound : CB3_1_4I1R12MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB3_1_4I1R12Value a))) := + entropyTerm_zero_ball (CB3_1_4I1R12Mass_sound) +def CB3_1_4I1R12H : Ball := ⟨0, 0⟩ +lemma CB3_1_4I1R12H_sound : CB3_1_4I1R12H.Encloses (homogeneousEntropy CB3_1_4I1R12Value) := by + exact contains_sound (homogeneous_enclosed CB3_1_4I1R12Value CB3_1_4I1R12MassTerm_sound CB3_1_4I1R12Entropy_sound) (by decide +kernel) +def CB3_1_4I1R13Value (a : Fin 6) : ℝ := residualLaw (below (shape 3 1 4)) (fun u => (stageBLaw (shape 3 1 4) u : ℝ)) (stageBPriority (shape 3 1 4)) 1 (fun u a => (littleLaw (shape 3 1 4) u ((stageBPriority (shape 3 1 4)) 1) a : ℝ)) 13 a +def CB3_1_4I1R13Raw (a : Fin 6) : Ball := residualBall (below (shape 3 1 4)) B3_1_4Law (stageBPriority (shape 3 1 4)) 1 (fun u => B3_1_4Little u ((stageBPriority (shape 3 1 4)) 1)) 13 a +lemma CB3_1_4I1R13Raw_sound (a : Fin 6) : + (CB3_1_4I1R13Raw a).Encloses (CB3_1_4I1R13Value a) := by + exact residualBall_sound_on (below (shape 3 1 4)) B3_1_4Law (fun u => (stageBLaw (shape 3 1 4) u : ℝ)) (stageBPriority (shape 3 1 4)) 1 (fun u => B3_1_4Little u ((stageBPriority (shape 3 1 4)) 1)) (fun u a => (littleLaw (shape 3 1 4) u ((stageBPriority (shape 3 1 4)) 1) a : ℝ)) (fun u _ => B3_1_4Law_sound u) (fun u _ a => B3_1_4Little_sound u ((stageBPriority (shape 3 1 4)) 1) a) 13 a +def CB3_1_4I1R13Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB3_1_4I1R13Certificates_valid : + CB3_1_4I1R13Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB3_1_4I1R13CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB3_1_4I1R13P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_1_4I1R13Certificates (CB3_1_4I1R13CertificateIndex a)).input +lemma CB3_1_4I1R13P_check : ∀ a : Fin 6, contains (CB3_1_4I1R13Raw a) (CB3_1_4I1R13P a) = true := by + decide +kernel +lemma CB3_1_4I1R13P_sound (a : Fin 6) : + (CB3_1_4I1R13P a).Encloses (CB3_1_4I1R13Value a) := + contains_sound (CB3_1_4I1R13Raw_sound a) (CB3_1_4I1R13P_check a) +def CB3_1_4I1R13Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_1_4I1R13Certificates (CB3_1_4I1R13CertificateIndex a)).output +lemma CB3_1_4I1R13Terms_sound (a : Fin 6) : + (CB3_1_4I1R13Terms a).Encloses (Foundation.entropyTerm (CB3_1_4I1R13Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB3_1_4I1R13Certificates_valid + (CB3_1_4I1R13CertificateIndex a) (CB3_1_4I1R13P_sound a) +def CB3_1_4I1R13Entropy : Ball := ⟨0, 0⟩ +lemma CB3_1_4I1R13Entropy_sound : CB3_1_4I1R13Entropy.Encloses (Foundation.finiteEntropy CB3_1_4I1R13Value) := by + exact contains_sound (entropyFin_enclosed 6 CB3_1_4I1R13Value CB3_1_4I1R13Terms CB3_1_4I1R13Terms_sound) (by decide +kernel) +def CB3_1_4I1R13Mass : Ball := ⟨0, 0⟩ +lemma CB3_1_4I1R13Mass_sound : CB3_1_4I1R13Mass.Encloses (∑ a, CB3_1_4I1R13Value a) := by + exact contains_sound (finSumBall_sound 6 CB3_1_4I1R13P CB3_1_4I1R13Value CB3_1_4I1R13P_sound) (by decide +kernel) +def CB3_1_4I1R13MassTerm : Ball := .exact 0 +lemma CB3_1_4I1R13MassTerm_sound : CB3_1_4I1R13MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB3_1_4I1R13Value a))) := + entropyTerm_zero_ball (CB3_1_4I1R13Mass_sound) +def CB3_1_4I1R13H : Ball := ⟨0, 0⟩ +lemma CB3_1_4I1R13H_sound : CB3_1_4I1R13H.Encloses (homogeneousEntropy CB3_1_4I1R13Value) := by + exact contains_sound (homogeneous_enclosed CB3_1_4I1R13Value CB3_1_4I1R13MassTerm_sound CB3_1_4I1R13Entropy_sound) (by decide +kernel) +def CB3_1_4I1R14Value (a : Fin 6) : ℝ := residualLaw (below (shape 3 1 4)) (fun u => (stageBLaw (shape 3 1 4) u : ℝ)) (stageBPriority (shape 3 1 4)) 1 (fun u a => (littleLaw (shape 3 1 4) u ((stageBPriority (shape 3 1 4)) 1) a : ℝ)) 14 a +def CB3_1_4I1R14Raw (a : Fin 6) : Ball := residualBall (below (shape 3 1 4)) B3_1_4Law (stageBPriority (shape 3 1 4)) 1 (fun u => B3_1_4Little u ((stageBPriority (shape 3 1 4)) 1)) 14 a +lemma CB3_1_4I1R14Raw_sound (a : Fin 6) : + (CB3_1_4I1R14Raw a).Encloses (CB3_1_4I1R14Value a) := by + exact residualBall_sound_on (below (shape 3 1 4)) B3_1_4Law (fun u => (stageBLaw (shape 3 1 4) u : ℝ)) (stageBPriority (shape 3 1 4)) 1 (fun u => B3_1_4Little u ((stageBPriority (shape 3 1 4)) 1)) (fun u a => (littleLaw (shape 3 1 4) u ((stageBPriority (shape 3 1 4)) 1) a : ℝ)) (fun u _ => B3_1_4Law_sound u) (fun u _ a => B3_1_4Little_sound u ((stageBPriority (shape 3 1 4)) 1) a) 14 a +def CB3_1_4I1R14Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB3_1_4I1R14Certificates_valid : + CB3_1_4I1R14Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB3_1_4I1R14CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB3_1_4I1R14P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_1_4I1R14Certificates (CB3_1_4I1R14CertificateIndex a)).input +lemma CB3_1_4I1R14P_check : ∀ a : Fin 6, contains (CB3_1_4I1R14Raw a) (CB3_1_4I1R14P a) = true := by + decide +kernel +lemma CB3_1_4I1R14P_sound (a : Fin 6) : + (CB3_1_4I1R14P a).Encloses (CB3_1_4I1R14Value a) := + contains_sound (CB3_1_4I1R14Raw_sound a) (CB3_1_4I1R14P_check a) +def CB3_1_4I1R14Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_1_4I1R14Certificates (CB3_1_4I1R14CertificateIndex a)).output +lemma CB3_1_4I1R14Terms_sound (a : Fin 6) : + (CB3_1_4I1R14Terms a).Encloses (Foundation.entropyTerm (CB3_1_4I1R14Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB3_1_4I1R14Certificates_valid + (CB3_1_4I1R14CertificateIndex a) (CB3_1_4I1R14P_sound a) +def CB3_1_4I1R14Entropy : Ball := ⟨0, 0⟩ +lemma CB3_1_4I1R14Entropy_sound : CB3_1_4I1R14Entropy.Encloses (Foundation.finiteEntropy CB3_1_4I1R14Value) := by + exact contains_sound (entropyFin_enclosed 6 CB3_1_4I1R14Value CB3_1_4I1R14Terms CB3_1_4I1R14Terms_sound) (by decide +kernel) +def CB3_1_4I1R14Mass : Ball := ⟨0, 0⟩ +lemma CB3_1_4I1R14Mass_sound : CB3_1_4I1R14Mass.Encloses (∑ a, CB3_1_4I1R14Value a) := by + exact contains_sound (finSumBall_sound 6 CB3_1_4I1R14P CB3_1_4I1R14Value CB3_1_4I1R14P_sound) (by decide +kernel) +def CB3_1_4I1R14MassTerm : Ball := .exact 0 +lemma CB3_1_4I1R14MassTerm_sound : CB3_1_4I1R14MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB3_1_4I1R14Value a))) := + entropyTerm_zero_ball (CB3_1_4I1R14Mass_sound) +def CB3_1_4I1R14H : Ball := ⟨0, 0⟩ +lemma CB3_1_4I1R14H_sound : CB3_1_4I1R14H.Encloses (homogeneousEntropy CB3_1_4I1R14Value) := by + exact contains_sound (homogeneous_enclosed CB3_1_4I1R14Value CB3_1_4I1R14MassTerm_sound CB3_1_4I1R14Entropy_sound) (by decide +kernel) +def CB3_1_4I1R15Value (a : Fin 6) : ℝ := residualLaw (below (shape 3 1 4)) (fun u => (stageBLaw (shape 3 1 4) u : ℝ)) (stageBPriority (shape 3 1 4)) 1 (fun u a => (littleLaw (shape 3 1 4) u ((stageBPriority (shape 3 1 4)) 1) a : ℝ)) 15 a +def CB3_1_4I1R15Raw (a : Fin 6) : Ball := residualBall (below (shape 3 1 4)) B3_1_4Law (stageBPriority (shape 3 1 4)) 1 (fun u => B3_1_4Little u ((stageBPriority (shape 3 1 4)) 1)) 15 a +lemma CB3_1_4I1R15Raw_sound (a : Fin 6) : + (CB3_1_4I1R15Raw a).Encloses (CB3_1_4I1R15Value a) := by + exact residualBall_sound_on (below (shape 3 1 4)) B3_1_4Law (fun u => (stageBLaw (shape 3 1 4) u : ℝ)) (stageBPriority (shape 3 1 4)) 1 (fun u => B3_1_4Little u ((stageBPriority (shape 3 1 4)) 1)) (fun u a => (littleLaw (shape 3 1 4) u ((stageBPriority (shape 3 1 4)) 1) a : ℝ)) (fun u _ => B3_1_4Law_sound u) (fun u _ a => B3_1_4Little_sound u ((stageBPriority (shape 3 1 4)) 1) a) 15 a +def CB3_1_4I1R15Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB3_1_4I1R15Certificates_valid : + CB3_1_4I1R15Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB3_1_4I1R15CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB3_1_4I1R15P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_1_4I1R15Certificates (CB3_1_4I1R15CertificateIndex a)).input +lemma CB3_1_4I1R15P_check : ∀ a : Fin 6, contains (CB3_1_4I1R15Raw a) (CB3_1_4I1R15P a) = true := by + decide +kernel +lemma CB3_1_4I1R15P_sound (a : Fin 6) : + (CB3_1_4I1R15P a).Encloses (CB3_1_4I1R15Value a) := + contains_sound (CB3_1_4I1R15Raw_sound a) (CB3_1_4I1R15P_check a) +def CB3_1_4I1R15Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_1_4I1R15Certificates (CB3_1_4I1R15CertificateIndex a)).output +lemma CB3_1_4I1R15Terms_sound (a : Fin 6) : + (CB3_1_4I1R15Terms a).Encloses (Foundation.entropyTerm (CB3_1_4I1R15Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB3_1_4I1R15Certificates_valid + (CB3_1_4I1R15CertificateIndex a) (CB3_1_4I1R15P_sound a) +def CB3_1_4I1R15Entropy : Ball := ⟨0, 0⟩ +lemma CB3_1_4I1R15Entropy_sound : CB3_1_4I1R15Entropy.Encloses (Foundation.finiteEntropy CB3_1_4I1R15Value) := by + exact contains_sound (entropyFin_enclosed 6 CB3_1_4I1R15Value CB3_1_4I1R15Terms CB3_1_4I1R15Terms_sound) (by decide +kernel) +def CB3_1_4I1R15Mass : Ball := ⟨0, 0⟩ +lemma CB3_1_4I1R15Mass_sound : CB3_1_4I1R15Mass.Encloses (∑ a, CB3_1_4I1R15Value a) := by + exact contains_sound (finSumBall_sound 6 CB3_1_4I1R15P CB3_1_4I1R15Value CB3_1_4I1R15P_sound) (by decide +kernel) +def CB3_1_4I1R15MassTerm : Ball := .exact 0 +lemma CB3_1_4I1R15MassTerm_sound : CB3_1_4I1R15MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB3_1_4I1R15Value a))) := + entropyTerm_zero_ball (CB3_1_4I1R15Mass_sound) +def CB3_1_4I1R15H : Ball := ⟨0, 0⟩ +lemma CB3_1_4I1R15H_sound : CB3_1_4I1R15H.Encloses (homogeneousEntropy CB3_1_4I1R15Value) := by + exact contains_sound (homogeneous_enclosed CB3_1_4I1R15Value CB3_1_4I1R15MassTerm_sound CB3_1_4I1R15Entropy_sound) (by decide +kernel) +def CB3_1_4I1R16Value (a : Fin 6) : ℝ := residualLaw (below (shape 3 1 4)) (fun u => (stageBLaw (shape 3 1 4) u : ℝ)) (stageBPriority (shape 3 1 4)) 1 (fun u a => (littleLaw (shape 3 1 4) u ((stageBPriority (shape 3 1 4)) 1) a : ℝ)) 16 a +def CB3_1_4I1R16Raw (a : Fin 6) : Ball := residualBall (below (shape 3 1 4)) B3_1_4Law (stageBPriority (shape 3 1 4)) 1 (fun u => B3_1_4Little u ((stageBPriority (shape 3 1 4)) 1)) 16 a +lemma CB3_1_4I1R16Raw_sound (a : Fin 6) : + (CB3_1_4I1R16Raw a).Encloses (CB3_1_4I1R16Value a) := by + exact residualBall_sound_on (below (shape 3 1 4)) B3_1_4Law (fun u => (stageBLaw (shape 3 1 4) u : ℝ)) (stageBPriority (shape 3 1 4)) 1 (fun u => B3_1_4Little u ((stageBPriority (shape 3 1 4)) 1)) (fun u a => (littleLaw (shape 3 1 4) u ((stageBPriority (shape 3 1 4)) 1) a : ℝ)) (fun u _ => B3_1_4Law_sound u) (fun u _ a => B3_1_4Little_sound u ((stageBPriority (shape 3 1 4)) 1) a) 16 a +def CB3_1_4I1R16Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB3_1_4I1R16Certificates_valid : + CB3_1_4I1R16Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB3_1_4I1R16CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB3_1_4I1R16P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_1_4I1R16Certificates (CB3_1_4I1R16CertificateIndex a)).input +lemma CB3_1_4I1R16P_check : ∀ a : Fin 6, contains (CB3_1_4I1R16Raw a) (CB3_1_4I1R16P a) = true := by + decide +kernel +lemma CB3_1_4I1R16P_sound (a : Fin 6) : + (CB3_1_4I1R16P a).Encloses (CB3_1_4I1R16Value a) := + contains_sound (CB3_1_4I1R16Raw_sound a) (CB3_1_4I1R16P_check a) +def CB3_1_4I1R16Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_1_4I1R16Certificates (CB3_1_4I1R16CertificateIndex a)).output +lemma CB3_1_4I1R16Terms_sound (a : Fin 6) : + (CB3_1_4I1R16Terms a).Encloses (Foundation.entropyTerm (CB3_1_4I1R16Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB3_1_4I1R16Certificates_valid + (CB3_1_4I1R16CertificateIndex a) (CB3_1_4I1R16P_sound a) +def CB3_1_4I1R16Entropy : Ball := ⟨0, 0⟩ +lemma CB3_1_4I1R16Entropy_sound : CB3_1_4I1R16Entropy.Encloses (Foundation.finiteEntropy CB3_1_4I1R16Value) := by + exact contains_sound (entropyFin_enclosed 6 CB3_1_4I1R16Value CB3_1_4I1R16Terms CB3_1_4I1R16Terms_sound) (by decide +kernel) +def CB3_1_4I1R16Mass : Ball := ⟨0, 0⟩ +lemma CB3_1_4I1R16Mass_sound : CB3_1_4I1R16Mass.Encloses (∑ a, CB3_1_4I1R16Value a) := by + exact contains_sound (finSumBall_sound 6 CB3_1_4I1R16P CB3_1_4I1R16Value CB3_1_4I1R16P_sound) (by decide +kernel) +def CB3_1_4I1R16MassTerm : Ball := .exact 0 +lemma CB3_1_4I1R16MassTerm_sound : CB3_1_4I1R16MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB3_1_4I1R16Value a))) := + entropyTerm_zero_ball (CB3_1_4I1R16Mass_sound) +def CB3_1_4I1R16H : Ball := ⟨0, 0⟩ +lemma CB3_1_4I1R16H_sound : CB3_1_4I1R16H.Encloses (homogeneousEntropy CB3_1_4I1R16Value) := by + exact contains_sound (homogeneous_enclosed CB3_1_4I1R16Value CB3_1_4I1R16MassTerm_sound CB3_1_4I1R16Entropy_sound) (by decide +kernel) +def CB3_1_4I1ResidualEntropies (a : Fin 17) : Ball := + match a.val with + | 0 => CB3_1_4I1R0H + | 1 => CB3_1_4I1R1H + | 2 => CB3_1_4I1R2H + | 3 => CB3_1_4I1R3H + | 4 => CB3_1_4I1R4H + | 5 => CB3_1_4I1R5H + | 6 => CB3_1_4I1R6H + | 7 => CB3_1_4I1R7H + | 8 => CB3_1_4I1R8H + | 9 => CB3_1_4I1R9H + | 10 => CB3_1_4I1R10H + | 11 => CB3_1_4I1R11H + | 12 => CB3_1_4I1R12H + | 13 => CB3_1_4I1R13H + | 14 => CB3_1_4I1R14H + | 15 => CB3_1_4I1R15H + | 16 => CB3_1_4I1R16H + | _ => (.exact 0) +lemma CB3_1_4I1ResidualEntropies_sound (k : Fin 17) : + (CB3_1_4I1ResidualEntropies k).Encloses (homogeneousEntropy + (residualLaw (below (shape 3 1 4)) (fun u => (stageBLaw (shape 3 1 4) u : ℝ)) (stageBPriority (shape 3 1 4)) 1 (fun u a => (littleLaw (shape 3 1 4) u ((stageBPriority (shape 3 1 4)) 1) a : ℝ)) k)) := by + fin_cases k + · exact CB3_1_4I1R0H_sound + · exact CB3_1_4I1R1H_sound + · exact CB3_1_4I1R2H_sound + · exact CB3_1_4I1R3H_sound + · exact CB3_1_4I1R4H_sound + · exact CB3_1_4I1R5H_sound + · exact CB3_1_4I1R6H_sound + · exact CB3_1_4I1R7H_sound + · exact CB3_1_4I1R8H_sound + · exact CB3_1_4I1R9H_sound + · exact CB3_1_4I1R10H_sound + · exact CB3_1_4I1R11H_sound + · exact CB3_1_4I1R12H_sound + · exact CB3_1_4I1R13H_sound + · exact CB3_1_4I1R14H_sound + · exact CB3_1_4I1R15H_sound + · exact CB3_1_4I1R16H_sound +def CB3_1_4I1S3_1_0Value (a : Fin 6) : ℝ := (littleLaw (shape 3 1 4) (shape 3 1 0) ((stageBPriority (shape 3 1 4)) 1) a : ℝ) +def CB3_1_4I1S3_1_0E_4Log : Ball := .exact 0 +lemma CB3_1_4I1S3_1_0E_4Log_sound : CB3_1_4I1S3_1_0E_4Log.Encloses (Real.log (CB3_1_4I1S3_1_0Value (4 : Fin 6))) := by + exact log_exact_one_ball ((B3_1_4Little_sound (shape 3 1 0) ((stageBPriority (shape 3 1 4)) 1)) (4 : Fin 6)) +def CB3_1_4I1S3_1_0E_4 : Ball := ⟨0, 0⟩ +lemma CB3_1_4I1S3_1_0E_4_sound : CB3_1_4I1S3_1_0E_4.Encloses (Foundation.entropyTerm (CB3_1_4I1S3_1_0Value (4 : Fin 6))) := by + exact contains_sound (entropyTerm_ball ((B3_1_4Little_sound (shape 3 1 0) ((stageBPriority (shape 3 1 4)) 1)) (4 : Fin 6)) CB3_1_4I1S3_1_0E_4Log_sound) (by decide +kernel) +def CB3_1_4I1S3_1_0Terms (a : Fin 6) : Ball := + match a.val with + | 4 => ⟨0, 0⟩ + | _ => (.exact 0) +lemma CB3_1_4I1S3_1_0Terms_sound (a : Fin 6) : + (CB3_1_4I1S3_1_0Terms a).Encloses (Foundation.entropyTerm (CB3_1_4I1S3_1_0Value a)) := by + fin_cases a + · exact (entropyTerm_zero_ball ((B3_1_4Little_sound (shape 3 1 0) ((stageBPriority (shape 3 1 4)) 1)) (0 : Fin 6))) + · exact (entropyTerm_zero_ball ((B3_1_4Little_sound (shape 3 1 0) ((stageBPriority (shape 3 1 4)) 1)) (1 : Fin 6))) + · exact (entropyTerm_zero_ball ((B3_1_4Little_sound (shape 3 1 0) ((stageBPriority (shape 3 1 4)) 1)) (2 : Fin 6))) + · exact (entropyTerm_zero_ball ((B3_1_4Little_sound (shape 3 1 0) ((stageBPriority (shape 3 1 4)) 1)) (3 : Fin 6))) + · exact CB3_1_4I1S3_1_0E_4_sound + · exact (entropyTerm_zero_ball ((B3_1_4Little_sound (shape 3 1 0) ((stageBPriority (shape 3 1 4)) 1)) (5 : Fin 6))) +def CB3_1_4I1S3_1_0Entropy : Ball := ⟨0, 0⟩ +lemma CB3_1_4I1S3_1_0Entropy_sound : CB3_1_4I1S3_1_0Entropy.Encloses (Foundation.finiteEntropy CB3_1_4I1S3_1_0Value) := by + exact contains_sound (entropyFin_enclosed 6 CB3_1_4I1S3_1_0Value CB3_1_4I1S3_1_0Terms CB3_1_4I1S3_1_0Terms_sound) (by decide +kernel) +def CB3_1_4I1S3_1_0Mass : Ball := ⟨1, 0⟩ +lemma CB3_1_4I1S3_1_0Mass_sound : CB3_1_4I1S3_1_0Mass.Encloses (∑ a, CB3_1_4I1S3_1_0Value a) := by + exact contains_sound (finSumBall_sound 6 (B3_1_4Little (shape 3 1 0) ((stageBPriority (shape 3 1 4)) 1)) CB3_1_4I1S3_1_0Value (B3_1_4Little_sound (shape 3 1 0) ((stageBPriority (shape 3 1 4)) 1))) (by decide +kernel) +def CB3_1_4I1S3_1_0MassTermLog : Ball := .exact 0 +lemma CB3_1_4I1S3_1_0MassTermLog_sound : CB3_1_4I1S3_1_0MassTermLog.Encloses (Real.log ((∑ a, CB3_1_4I1S3_1_0Value a))) := by + exact log_exact_one_ball (CB3_1_4I1S3_1_0Mass_sound) +def CB3_1_4I1S3_1_0MassTerm : Ball := ⟨0, 0⟩ +lemma CB3_1_4I1S3_1_0MassTerm_sound : CB3_1_4I1S3_1_0MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB3_1_4I1S3_1_0Value a))) := by + exact contains_sound (entropyTerm_ball (CB3_1_4I1S3_1_0Mass_sound) CB3_1_4I1S3_1_0MassTermLog_sound) (by decide +kernel) +def CB3_1_4I1S3_1_0H : Ball := ⟨0, 0⟩ +lemma CB3_1_4I1S3_1_0H_sound : CB3_1_4I1S3_1_0H.Encloses (homogeneousEntropy CB3_1_4I1S3_1_0Value) := by + exact contains_sound (homogeneous_enclosed CB3_1_4I1S3_1_0Value CB3_1_4I1S3_1_0MassTerm_sound CB3_1_4I1S3_1_0Entropy_sound) (by decide +kernel) +def CB3_1_4I1Singles (s : Shape) : Ball := + match s 0, s 1, s 2 with + | 3, 1, 0 => CB3_1_4I1S3_1_0H + | _, _, _ => (.exact 0) +lemma CB3_1_4I1Singles_sound (u : Shape) (hu : u ∈ below (shape 3 1 4)) + (hd : designated (stageBPriority (shape 3 1 4)) 1 u) : + (CB3_1_4I1Singles u).Encloses (homogeneousEntropy ((fun u a => (littleLaw (shape 3 1 4) u ((stageBPriority (shape 3 1 4)) 1) a : ℝ)) u)) := by + rw [B3_1_4_below] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl + · exact (show ¬ designated (stageBPriority (shape 3 1 4)) 1 (shape 0 0 4) by decide +kernel) hd |>.elim + · exact (show ¬ designated (stageBPriority (shape 3 1 4)) 1 (shape 0 1 3) by decide +kernel) hd |>.elim + · exact (show ¬ designated (stageBPriority (shape 3 1 4)) 1 (shape 1 0 3) by decide +kernel) hd |>.elim + · exact (show ¬ designated (stageBPriority (shape 3 1 4)) 1 (shape 1 1 2) by decide +kernel) hd |>.elim + · exact (show ¬ designated (stageBPriority (shape 3 1 4)) 1 (shape 2 0 2) by decide +kernel) hd |>.elim + · exact (show ¬ designated (stageBPriority (shape 3 1 4)) 1 (shape 2 1 1) by decide +kernel) hd |>.elim + · exact (show ¬ designated (stageBPriority (shape 3 1 4)) 1 (shape 3 0 1) by decide +kernel) hd |>.elim + · exact CB3_1_4I1S3_1_0H_sound +def CB3_1_4I1Singleton : Ball := ⟨0, 0⟩ +lemma CB3_1_4I1Singleton_sound : CB3_1_4I1Singleton.Encloses + (singletonEntropy (below (shape 3 1 4)) (fun u => (stageBLaw (shape 3 1 4) u : ℝ)) (stageBPriority (shape 3 1 4)) 1 (fun u a => (littleLaw (shape 3 1 4) u ((stageBPriority (shape 3 1 4)) 1) a : ℝ))) := by + exact contains_sound (singletonBall_sound (below (shape 3 1 4)) B3_1_4Law (fun u => (stageBLaw (shape 3 1 4) u : ℝ)) (stageBPriority (shape 3 1 4)) 1 + CB3_1_4I1Singles (fun u a => (littleLaw (shape 3 1 4) u ((stageBPriority (shape 3 1 4)) 1) a : ℝ)) (fun u _ => B3_1_4Law_sound u) CB3_1_4I1Singles_sound) (by decide +kernel) +def CB3_1_4I1Group : Ball := ⟨(1811177661757362236043459804093 / 12500000000000000000000000000000), (67654579301 / 50000000000000000000000000000000)⟩ +lemma CB3_1_4I1Group_sound : CB3_1_4I1Group.Encloses + (groupedEntropy (below (shape 3 1 4)) (fun u => (stageBLaw (shape 3 1 4) u : ℝ)) (stageBPriority (shape 3 1 4)) 1 (fun u a => (littleLaw (shape 3 1 4) u ((stageBPriority (shape 3 1 4)) 1) a : ℝ))) := by + exact contains_sound (Ball.add_sound CB3_1_4I1Singleton_sound + (finSumBall_sound 17 CB3_1_4I1ResidualEntropies _ CB3_1_4I1ResidualEntropies_sound)) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CB3_1_4I1H : Ball := ⟨(40783054055418507010094510718277 / 50000000000000000000000000000000), (363568873371 / 100000000000000000000000000000000)⟩ +lemma CB3_1_4I1_sound : CB3_1_4I1H.Encloses (stageBCapacity (shape 3 1 4) 1) := by + have hb := contains_sound (Ball.add_sound CB3_1_4I1PairH_sound + (Ball.neg_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) CB3_1_4I1Group_sound))) + (show contains (.add CB3_1_4I1PairH (.neg (.mul (.exact 2) CB3_1_4I1Group))) CB3_1_4I1H = true by decide +kernel) + simp only [stageBCapacity, nativeCapacity, + show (1 : Fin 3) ≠ 0 by decide, ite_false, sub_eq_add_neg] + exact hb + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/CapacityB/CapB3_1_4I2.lean b/lean/OAI/LinearAlgebra/MatrixFields/CapacityB/CapB3_1_4I2.lean new file mode 100644 index 0000000000000000000000000000000000000000..ec3b869183232de1a931a0f9210b661d1e650de2 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/CapacityB/CapB3_1_4I2.lean @@ -0,0 +1,1041 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Certificates.Terminal3_1_4 + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CB3_1_4I2PairValue (a : PairSlot) : ℝ := pairLaw (below (shape 3 1 4)) (shape 3 1 4) (fun u => (stageBLaw (shape 3 1 4) u : ℝ)) (fun u a => (littleLaw (shape 3 1 4) u ((stageBPriority (shape 3 1 4)) 2) a : ℝ)) a +def CB3_1_4I2PairRaw (a : PairSlot) : Ball := pairLawBall (below (shape 3 1 4)) (shape 3 1 4) B3_1_4Law (fun u => B3_1_4Little u ((stageBPriority (shape 3 1 4)) 2)) a +lemma CB3_1_4I2PairRaw_sound (a : PairSlot) : + (CB3_1_4I2PairRaw a).Encloses (CB3_1_4I2PairValue a) := by + exact pairLawBall_sound_on (below (shape 3 1 4)) (shape 3 1 4) B3_1_4Law (fun u => (stageBLaw (shape 3 1 4) u : ℝ)) (fun u => B3_1_4Little u ((stageBPriority (shape 3 1 4)) 2)) (fun u a => (littleLaw (shape 3 1 4) u ((stageBPriority (shape 3 1 4)) 2) a : ℝ)) (fun u _ => B3_1_4Law_sound u) (fun u _ a => B3_1_4Little_sound u ((stageBPriority (shape 3 1 4)) 2) a) (fun u _ a => B3_1_4Little_sound (complement (shape 3 1 4) u) ((stageBPriority (shape 3 1 4)) 2) a) a +def CB3_1_4I2PairCertificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(6274072805784506214853963141 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(2080534087616583180597915017 / 1000000000000000000000000000000), (69086513 / 100000000000000000000000000000000)⟩ ⟨(-414510269489221060005265391870793 / 50000000000000000000000000000000), (275285711863 / 100000000000000000000000000000000)⟩ ⟨-12, 6274072805784506214853963141, 6103515625000000000000000000⟩, + .log ⟨(3820996886917273539060027346381 / 50000000000000000000000000000000), (3 / 20000000000000000000000000000000)⟩ ⟨(3930295206317031159069190502873 / 20000000000000000000000000000000), (8091275691 / 100000000000000000000000000000000)⟩ ⟨(-128575582584677854984647202512921 / 50000000000000000000000000000000), (105879118611 / 100000000000000000000000000000000)⟩ ⟨-4, 3820996886917273539060027346381, 3125000000000000000000000000000⟩, + .log ⟨(76473060096193834122862009176151 / 100000000000000000000000000000000), (1 / 5000000000000000000000000000000)⟩ ⟨(4102499213529906974063073891181 / 20000000000000000000000000000000), (253028131 / 781250000000000000000000000000)⟩ ⟨(-1341158313911284757935636752047 / 5000000000000000000000000000000), (1323488981 / 3125000000000000000000000000000)⟩ ⟨-1, 76473060096193834122862009176151, 50000000000000000000000000000000⟩, + .log ⟨(408752583274976468404048388933 / 10000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ ⟨(2613752313299241591256901234041 / 20000000000000000000000000000000), (5193403589 / 100000000000000000000000000000000)⟩ ⟨(-319723032984590996664872830008137 / 100000000000000000000000000000000), (63527471073 / 50000000000000000000000000000000)⟩ ⟨-5, 408752583274976468404048388933, 312500000000000000000000000000⟩, + .log ⟨(17708108191266303098081954537 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(76489313075639343649791328593 / 50000000000000000000000000000000), (52497739 / 100000000000000000000000000000000)⟩ ⟨(-863890284037954129242199119797421 / 100000000000000000000000000000000), (37057692151 / 12500000000000000000000000000000)⟩ ⟨-13, 17708108191266303098081954537, 12207031250000000000000000000⟩] +lemma CB3_1_4I2PairCertificates_valid : + CB3_1_4I2PairCertificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB3_1_4I2PairCertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 5, 0 => 1 + | 4, 1 => 2 + | 2, 2 => 3 + | 2, 3 => 4 + | 3, 2 => 4 + | 3, 3 => 5 + | 1, 4 => 2 + | 0, 5 => 1 + | _, _ => 0 +def CB3_1_4I2PairP (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CB3_1_4I2PairCertificates (CB3_1_4I2PairCertificateIndex a)).input +lemma CB3_1_4I2PairP_check : ∀ a : PairSlot, contains (CB3_1_4I2PairRaw a) (CB3_1_4I2PairP a) = true := by + decide +kernel +lemma CB3_1_4I2PairP_sound (a : PairSlot) : + (CB3_1_4I2PairP a).Encloses (CB3_1_4I2PairValue a) := + contains_sound (CB3_1_4I2PairRaw_sound a) (CB3_1_4I2PairP_check a) +def CB3_1_4I2PairTerms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CB3_1_4I2PairCertificates (CB3_1_4I2PairCertificateIndex a)).output +lemma CB3_1_4I2PairTerms_sound (a : PairSlot) : + (CB3_1_4I2PairTerms a).Encloses (Foundation.entropyTerm (CB3_1_4I2PairValue a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB3_1_4I2PairCertificates_valid + (CB3_1_4I2PairCertificateIndex a) (CB3_1_4I2PairP_sound a) +def CB3_1_4I2PairEntropy : Ball := ⟨(86522056707486857696995452485631 / 100000000000000000000000000000000), (59147630093 / 100000000000000000000000000000000)⟩ +lemma CB3_1_4I2PairEntropy_sound : CB3_1_4I2PairEntropy.Encloses (Foundation.finiteEntropy CB3_1_4I2PairValue) := by + exact contains_sound (entropyPair_enclosed CB3_1_4I2PairValue CB3_1_4I2PairTerms CB3_1_4I2PairTerms_sound) (by decide +kernel) +def CB3_1_4I2PairMass : Ball := ⟨1, (57 / 100000000000000000000000000000000)⟩ +lemma CB3_1_4I2PairMass_sound : CB3_1_4I2PairMass.Encloses (∑ a, CB3_1_4I2PairValue a) := by + exact contains_sound (pairSumBall_sound CB3_1_4I2PairP CB3_1_4I2PairValue CB3_1_4I2PairP_sound) (by decide +kernel) +def CB3_1_4I2PairMassTermLogWitness : LogWitness := ⟨0, 1, 1⟩ +def CB3_1_4I2PairMassTermLog : Ball := ⟨0, (21175823739 / 100000000000000000000000000000000)⟩ +lemma CB3_1_4I2PairMassTermLog_sound : CB3_1_4I2PairMassTermLog.Encloses (Real.log ((∑ a, CB3_1_4I2PairValue a))) := by + exact checkLog_sound logTwoBall_sound (CB3_1_4I2PairMass_sound) (w := CB3_1_4I2PairMassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB3_1_4I2PairMassTerm : Ball := ⟨0, (1058791187 / 5000000000000000000000000000000)⟩ +lemma CB3_1_4I2PairMassTerm_sound : CB3_1_4I2PairMassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB3_1_4I2PairValue a))) := by + exact contains_sound (entropyTerm_ball (CB3_1_4I2PairMass_sound) CB3_1_4I2PairMassTermLog_sound) (by decide +kernel) +def CB3_1_4I2PairH : Ball := ⟨(86522056707486857696995452485631 / 100000000000000000000000000000000), (80323453833 / 100000000000000000000000000000000)⟩ +lemma CB3_1_4I2PairH_sound : CB3_1_4I2PairH.Encloses (homogeneousEntropy CB3_1_4I2PairValue) := by + exact contains_sound (homogeneous_enclosed CB3_1_4I2PairValue CB3_1_4I2PairMassTerm_sound CB3_1_4I2PairEntropy_sound) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CB3_1_4I2R0Value (a : Fin 6) : ℝ := residualLaw (below (shape 3 1 4)) (fun u => (stageBLaw (shape 3 1 4) u : ℝ)) (stageBPriority (shape 3 1 4)) 2 (fun u a => (littleLaw (shape 3 1 4) u ((stageBPriority (shape 3 1 4)) 2) a : ℝ)) 0 a +def CB3_1_4I2R0Raw (a : Fin 6) : Ball := residualBall (below (shape 3 1 4)) B3_1_4Law (stageBPriority (shape 3 1 4)) 2 (fun u => B3_1_4Little u ((stageBPriority (shape 3 1 4)) 2)) 0 a +lemma CB3_1_4I2R0Raw_sound (a : Fin 6) : + (CB3_1_4I2R0Raw a).Encloses (CB3_1_4I2R0Value a) := by + exact residualBall_sound_on (below (shape 3 1 4)) B3_1_4Law (fun u => (stageBLaw (shape 3 1 4) u : ℝ)) (stageBPriority (shape 3 1 4)) 2 (fun u => B3_1_4Little u ((stageBPriority (shape 3 1 4)) 2)) (fun u a => (littleLaw (shape 3 1 4) u ((stageBPriority (shape 3 1 4)) 2) a : ℝ)) (fun u _ => B3_1_4Law_sound u) (fun u _ a => B3_1_4Little_sound u ((stageBPriority (shape 3 1 4)) 2) a) 0 a +def CB3_1_4I2R0Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(6274072805784506214853963141 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(2080534087616583180597915017 / 1000000000000000000000000000000), (69086513 / 100000000000000000000000000000000)⟩ ⟨(-414510269489221060005265391870793 / 50000000000000000000000000000000), (275285711863 / 100000000000000000000000000000000)⟩ ⟨-12, 6274072805784506214853963141, 6103515625000000000000000000⟩] +lemma CB3_1_4I2R0Certificates_valid : + CB3_1_4I2R0Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB3_1_4I2R0CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | 0 => 1 + | _ => 0 +def CB3_1_4I2R0P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_1_4I2R0Certificates (CB3_1_4I2R0CertificateIndex a)).input +lemma CB3_1_4I2R0P_check : ∀ a : Fin 6, contains (CB3_1_4I2R0Raw a) (CB3_1_4I2R0P a) = true := by + decide +kernel +lemma CB3_1_4I2R0P_sound (a : Fin 6) : + (CB3_1_4I2R0P a).Encloses (CB3_1_4I2R0Value a) := + contains_sound (CB3_1_4I2R0Raw_sound a) (CB3_1_4I2R0P_check a) +def CB3_1_4I2R0Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_1_4I2R0Certificates (CB3_1_4I2R0CertificateIndex a)).output +lemma CB3_1_4I2R0Terms_sound (a : Fin 6) : + (CB3_1_4I2R0Terms a).Encloses (Foundation.entropyTerm (CB3_1_4I2R0Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB3_1_4I2R0Certificates_valid + (CB3_1_4I2R0CertificateIndex a) (CB3_1_4I2R0P_sound a) +def CB3_1_4I2R0Entropy : Ball := ⟨(2080534087616583180597915017 / 1000000000000000000000000000000), (69086513 / 100000000000000000000000000000000)⟩ +lemma CB3_1_4I2R0Entropy_sound : CB3_1_4I2R0Entropy.Encloses (Foundation.finiteEntropy CB3_1_4I2R0Value) := by + exact contains_sound (entropyFin_enclosed 6 CB3_1_4I2R0Value CB3_1_4I2R0Terms CB3_1_4I2R0Terms_sound) (by decide +kernel) +def CB3_1_4I2R0Mass : Ball := ⟨(6274072805784506214853963141 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ +lemma CB3_1_4I2R0Mass_sound : CB3_1_4I2R0Mass.Encloses (∑ a, CB3_1_4I2R0Value a) := by + exact contains_sound (finSumBall_sound 6 CB3_1_4I2R0P CB3_1_4I2R0Value CB3_1_4I2R0P_sound) (by decide +kernel) +def CB3_1_4I2R0MassTermLogWitness : LogWitness := ⟨-12, 6274072805784506214853963141, 6103515625000000000000000000⟩ +def CB3_1_4I2R0MassTermLog : Ball := ⟨(-414510269489221060005265391870793 / 50000000000000000000000000000000), (275285711863 / 100000000000000000000000000000000)⟩ +lemma CB3_1_4I2R0MassTermLog_sound : CB3_1_4I2R0MassTermLog.Encloses (Real.log ((∑ a, CB3_1_4I2R0Value a))) := by + exact checkLog_sound logTwoBall_sound (CB3_1_4I2R0Mass_sound) (w := CB3_1_4I2R0MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB3_1_4I2R0MassTerm : Ball := ⟨(2080534087616583180597915017 / 1000000000000000000000000000000), (69086513 / 100000000000000000000000000000000)⟩ +lemma CB3_1_4I2R0MassTerm_sound : CB3_1_4I2R0MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB3_1_4I2R0Value a))) := by + exact contains_sound (entropyTerm_ball (CB3_1_4I2R0Mass_sound) CB3_1_4I2R0MassTermLog_sound) (by decide +kernel) +def CB3_1_4I2R0H : Ball := ⟨0, (69086513 / 50000000000000000000000000000000)⟩ +lemma CB3_1_4I2R0H_sound : CB3_1_4I2R0H.Encloses (homogeneousEntropy CB3_1_4I2R0Value) := by + exact contains_sound (homogeneous_enclosed CB3_1_4I2R0Value CB3_1_4I2R0MassTerm_sound CB3_1_4I2R0Entropy_sound) (by decide +kernel) +def CB3_1_4I2R1Value (a : Fin 6) : ℝ := residualLaw (below (shape 3 1 4)) (fun u => (stageBLaw (shape 3 1 4) u : ℝ)) (stageBPriority (shape 3 1 4)) 2 (fun u a => (littleLaw (shape 3 1 4) u ((stageBPriority (shape 3 1 4)) 2) a : ℝ)) 1 a +def CB3_1_4I2R1Raw (a : Fin 6) : Ball := residualBall (below (shape 3 1 4)) B3_1_4Law (stageBPriority (shape 3 1 4)) 2 (fun u => B3_1_4Little u ((stageBPriority (shape 3 1 4)) 2)) 1 a +lemma CB3_1_4I2R1Raw_sound (a : Fin 6) : + (CB3_1_4I2R1Raw a).Encloses (CB3_1_4I2R1Value a) := by + exact residualBall_sound_on (below (shape 3 1 4)) B3_1_4Law (fun u => (stageBLaw (shape 3 1 4) u : ℝ)) (stageBPriority (shape 3 1 4)) 2 (fun u => B3_1_4Little u ((stageBPriority (shape 3 1 4)) 2)) (fun u a => (littleLaw (shape 3 1 4) u ((stageBPriority (shape 3 1 4)) 2) a : ℝ)) (fun u _ => B3_1_4Law_sound u) (fun u _ a => B3_1_4Little_sound u ((stageBPriority (shape 3 1 4)) 2) a) 1 a +def CB3_1_4I2R1Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(3169955708291305924669541513661 / 50000000000000000000000000000000), (1 / 10000000000000000000000000000000)⟩ ⟨(4371852957778900787421083283603 / 25000000000000000000000000000000), (3356321177 / 50000000000000000000000000000000)⟩ ⟨(-275830538978442120010530936506341 / 100000000000000000000000000000000), (26469779643 / 25000000000000000000000000000000)⟩ ⟨-4, 3169955708291305924669541513661, 3125000000000000000000000000000⟩] +lemma CB3_1_4I2R1Certificates_valid : + CB3_1_4I2R1Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB3_1_4I2R1CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | 1 => 1 + | _ => 0 +def CB3_1_4I2R1P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_1_4I2R1Certificates (CB3_1_4I2R1CertificateIndex a)).input +lemma CB3_1_4I2R1P_check : ∀ a : Fin 6, contains (CB3_1_4I2R1Raw a) (CB3_1_4I2R1P a) = true := by + decide +kernel +lemma CB3_1_4I2R1P_sound (a : Fin 6) : + (CB3_1_4I2R1P a).Encloses (CB3_1_4I2R1Value a) := + contains_sound (CB3_1_4I2R1Raw_sound a) (CB3_1_4I2R1P_check a) +def CB3_1_4I2R1Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_1_4I2R1Certificates (CB3_1_4I2R1CertificateIndex a)).output +lemma CB3_1_4I2R1Terms_sound (a : Fin 6) : + (CB3_1_4I2R1Terms a).Encloses (Foundation.entropyTerm (CB3_1_4I2R1Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB3_1_4I2R1Certificates_valid + (CB3_1_4I2R1CertificateIndex a) (CB3_1_4I2R1P_sound a) +def CB3_1_4I2R1Entropy : Ball := ⟨(4371852957778900787421083283603 / 25000000000000000000000000000000), (3356321177 / 50000000000000000000000000000000)⟩ +lemma CB3_1_4I2R1Entropy_sound : CB3_1_4I2R1Entropy.Encloses (Foundation.finiteEntropy CB3_1_4I2R1Value) := by + exact contains_sound (entropyFin_enclosed 6 CB3_1_4I2R1Value CB3_1_4I2R1Terms CB3_1_4I2R1Terms_sound) (by decide +kernel) +def CB3_1_4I2R1Mass : Ball := ⟨(3169955708291305924669541513661 / 50000000000000000000000000000000), (1 / 10000000000000000000000000000000)⟩ +lemma CB3_1_4I2R1Mass_sound : CB3_1_4I2R1Mass.Encloses (∑ a, CB3_1_4I2R1Value a) := by + exact contains_sound (finSumBall_sound 6 CB3_1_4I2R1P CB3_1_4I2R1Value CB3_1_4I2R1P_sound) (by decide +kernel) +def CB3_1_4I2R1MassTermLogWitness : LogWitness := ⟨-4, 3169955708291305924669541513661, 3125000000000000000000000000000⟩ +def CB3_1_4I2R1MassTermLog : Ball := ⟨(-275830538978442120010530936506341 / 100000000000000000000000000000000), (26469779643 / 25000000000000000000000000000000)⟩ +lemma CB3_1_4I2R1MassTermLog_sound : CB3_1_4I2R1MassTermLog.Encloses (Real.log ((∑ a, CB3_1_4I2R1Value a))) := by + exact checkLog_sound logTwoBall_sound (CB3_1_4I2R1Mass_sound) (w := CB3_1_4I2R1MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB3_1_4I2R1MassTerm : Ball := ⟨(4371852957778900787421083283603 / 25000000000000000000000000000000), (3356321177 / 50000000000000000000000000000000)⟩ +lemma CB3_1_4I2R1MassTerm_sound : CB3_1_4I2R1MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB3_1_4I2R1Value a))) := by + exact contains_sound (entropyTerm_ball (CB3_1_4I2R1Mass_sound) CB3_1_4I2R1MassTermLog_sound) (by decide +kernel) +def CB3_1_4I2R1H : Ball := ⟨0, (3356321177 / 25000000000000000000000000000000)⟩ +lemma CB3_1_4I2R1H_sound : CB3_1_4I2R1H.Encloses (homogeneousEntropy CB3_1_4I2R1Value) := by + exact contains_sound (homogeneous_enclosed CB3_1_4I2R1Value CB3_1_4I2R1MassTerm_sound CB3_1_4I2R1Entropy_sound) (by decide +kernel) +def CB3_1_4I2R2Value (a : Fin 6) : ℝ := residualLaw (below (shape 3 1 4)) (fun u => (stageBLaw (shape 3 1 4) u : ℝ)) (stageBPriority (shape 3 1 4)) 2 (fun u a => (littleLaw (shape 3 1 4) u ((stageBPriority (shape 3 1 4)) 2) a : ℝ)) 2 a +def CB3_1_4I2R2Raw (a : Fin 6) : Ball := residualBall (below (shape 3 1 4)) B3_1_4Law (stageBPriority (shape 3 1 4)) 2 (fun u => B3_1_4Little u ((stageBPriority (shape 3 1 4)) 2)) 2 a +lemma CB3_1_4I2R2Raw_sound (a : Fin 6) : + (CB3_1_4I2R2Raw a).Encloses (CB3_1_4I2R2Value a) := by + exact residualBall_sound_on (below (shape 3 1 4)) B3_1_4Law (fun u => (stageBLaw (shape 3 1 4) u : ℝ)) (stageBPriority (shape 3 1 4)) 2 (fun u => B3_1_4Little u ((stageBPriority (shape 3 1 4)) 2)) (fun u a => (littleLaw (shape 3 1 4) u ((stageBPriority (shape 3 1 4)) 2) a : ℝ)) (fun u _ => B3_1_4Law_sound u) (fun u _ a => B3_1_4Little_sound u ((stageBPriority (shape 3 1 4)) 2) a) 2 a +def CB3_1_4I2R2Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(5279935150339487151005350643271 / 12500000000000000000000000000000), (3 / 25000000000000000000000000000000)⟩ ⟨(36402611261242721942916282948503 / 100000000000000000000000000000000), (5366734843 / 20000000000000000000000000000000)⟩ ⟨(-21545370719954605796349959838063 / 25000000000000000000000000000000), (63527471077 / 100000000000000000000000000000000)⟩ ⟨-2, 5279935150339487151005350643271, 3125000000000000000000000000000⟩, + .log ⟨(46714366113208844488862154253 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(651733287129766991087305557601 / 100000000000000000000000000000000), (59352913 / 25000000000000000000000000000000)⟩ ⟨(-174393163537298972606767996914933 / 25000000000000000000000000000000), (127054942633 / 50000000000000000000000000000000)⟩ ⟨-11, 46714366113208844488862154253, 24414062500000000000000000000⟩] +lemma CB3_1_4I2R2Certificates_valid : + CB3_1_4I2R2Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB3_1_4I2R2CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | 2 => 1 + | 3 => 2 + | _ => 0 +def CB3_1_4I2R2P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_1_4I2R2Certificates (CB3_1_4I2R2CertificateIndex a)).input +lemma CB3_1_4I2R2P_check : ∀ a : Fin 6, contains (CB3_1_4I2R2Raw a) (CB3_1_4I2R2P a) = true := by + decide +kernel +lemma CB3_1_4I2R2P_sound (a : Fin 6) : + (CB3_1_4I2R2P a).Encloses (CB3_1_4I2R2Value a) := + contains_sound (CB3_1_4I2R2Raw_sound a) (CB3_1_4I2R2P_check a) +def CB3_1_4I2R2Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_1_4I2R2Certificates (CB3_1_4I2R2CertificateIndex a)).output +lemma CB3_1_4I2R2Terms_sound (a : Fin 6) : + (CB3_1_4I2R2Terms a).Encloses (Foundation.entropyTerm (CB3_1_4I2R2Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB3_1_4I2R2Certificates_valid + (CB3_1_4I2R2CertificateIndex a) (CB3_1_4I2R2P_sound a) +def CB3_1_4I2R2Entropy : Ball := ⟨(4631793068546561116750448563263 / 12500000000000000000000000000000), (27071085867 / 100000000000000000000000000000000)⟩ +lemma CB3_1_4I2R2Entropy_sound : CB3_1_4I2R2Entropy.Encloses (Foundation.finiteEntropy CB3_1_4I2R2Value) := by + exact contains_sound (entropyFin_enclosed 6 CB3_1_4I2R2Value CB3_1_4I2R2Terms CB3_1_4I2R2Terms_sound) (by decide +kernel) +def CB3_1_4I2R2Mass : Ball := ⟨(21166454967471157448510264727337 / 50000000000000000000000000000000), (13 / 100000000000000000000000000000000)⟩ +lemma CB3_1_4I2R2Mass_sound : CB3_1_4I2R2Mass.Encloses (∑ a, CB3_1_4I2R2Value a) := by + exact contains_sound (finSumBall_sound 6 CB3_1_4I2R2P CB3_1_4I2R2Value CB3_1_4I2R2P_sound) (by decide +kernel) +def CB3_1_4I2R2MassTermLogWitness : LogWitness := ⟨-2, 21166454967471157448510264727337, 12500000000000000000000000000000⟩ +def CB3_1_4I2R2MassTermLog : Ball := ⟨(-85960538978442120010530974697353 / 100000000000000000000000000000000), (63527471079 / 100000000000000000000000000000000)⟩ +lemma CB3_1_4I2R2MassTermLog_sound : CB3_1_4I2R2MassTermLog.Encloses (Real.log ((∑ a, CB3_1_4I2R2Value a))) := by + exact checkLog_sound logTwoBall_sound (CB3_1_4I2R2Mass_sound) (w := CB3_1_4I2R2MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB3_1_4I2R2MassTerm : Ball := ⟨(71073432705732197860803257381 / 195312500000000000000000000000), (3361628391 / 12500000000000000000000000000000)⟩ +lemma CB3_1_4I2R2MassTerm_sound : CB3_1_4I2R2MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB3_1_4I2R2Value a))) := by + exact contains_sound (entropyTerm_ball (CB3_1_4I2R2Mass_sound) CB3_1_4I2R2MassTermLog_sound) (by decide +kernel) +def CB3_1_4I2R2H : Ball := ⟨(83093375379700453659040090879 / 12500000000000000000000000000000), (10792822599 / 20000000000000000000000000000000)⟩ +lemma CB3_1_4I2R2H_sound : CB3_1_4I2R2H.Encloses (homogeneousEntropy CB3_1_4I2R2Value) := by + exact contains_sound (homogeneous_enclosed CB3_1_4I2R2Value CB3_1_4I2R2MassTerm_sound CB3_1_4I2R2Entropy_sound) (by decide +kernel) +def CB3_1_4I2R3Value (a : Fin 6) : ℝ := residualLaw (below (shape 3 1 4)) (fun u => (stageBLaw (shape 3 1 4) u : ℝ)) (stageBPriority (shape 3 1 4)) 2 (fun u a => (littleLaw (shape 3 1 4) u ((stageBPriority (shape 3 1 4)) 2) a : ℝ)) 3 a +def CB3_1_4I2R3Raw (a : Fin 6) : Ball := residualBall (below (shape 3 1 4)) B3_1_4Law (stageBPriority (shape 3 1 4)) 2 (fun u => B3_1_4Little u ((stageBPriority (shape 3 1 4)) 2)) 3 a +lemma CB3_1_4I2R3Raw_sound (a : Fin 6) : + (CB3_1_4I2R3Raw a).Encloses (CB3_1_4I2R3Value a) := by + exact residualBall_sound_on (below (shape 3 1 4)) B3_1_4Law (fun u => (stageBLaw (shape 3 1 4) u : ℝ)) (stageBPriority (shape 3 1 4)) 2 (fun u => B3_1_4Little u ((stageBPriority (shape 3 1 4)) 2)) (fun u a => (littleLaw (shape 3 1 4) u ((stageBPriority (shape 3 1 4)) 2) a : ℝ)) (fun u _ => B3_1_4Law_sound u) (fun u _ a => B3_1_4Little_sound u ((stageBPriority (shape 3 1 4)) 2) a) 3 a +def CB3_1_4I2R3Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB3_1_4I2R3Certificates_valid : + CB3_1_4I2R3Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB3_1_4I2R3CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB3_1_4I2R3P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_1_4I2R3Certificates (CB3_1_4I2R3CertificateIndex a)).input +lemma CB3_1_4I2R3P_check : ∀ a : Fin 6, contains (CB3_1_4I2R3Raw a) (CB3_1_4I2R3P a) = true := by + decide +kernel +lemma CB3_1_4I2R3P_sound (a : Fin 6) : + (CB3_1_4I2R3P a).Encloses (CB3_1_4I2R3Value a) := + contains_sound (CB3_1_4I2R3Raw_sound a) (CB3_1_4I2R3P_check a) +def CB3_1_4I2R3Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_1_4I2R3Certificates (CB3_1_4I2R3CertificateIndex a)).output +lemma CB3_1_4I2R3Terms_sound (a : Fin 6) : + (CB3_1_4I2R3Terms a).Encloses (Foundation.entropyTerm (CB3_1_4I2R3Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB3_1_4I2R3Certificates_valid + (CB3_1_4I2R3CertificateIndex a) (CB3_1_4I2R3P_sound a) +def CB3_1_4I2R3Entropy : Ball := ⟨0, 0⟩ +lemma CB3_1_4I2R3Entropy_sound : CB3_1_4I2R3Entropy.Encloses (Foundation.finiteEntropy CB3_1_4I2R3Value) := by + exact contains_sound (entropyFin_enclosed 6 CB3_1_4I2R3Value CB3_1_4I2R3Terms CB3_1_4I2R3Terms_sound) (by decide +kernel) +def CB3_1_4I2R3Mass : Ball := ⟨0, 0⟩ +lemma CB3_1_4I2R3Mass_sound : CB3_1_4I2R3Mass.Encloses (∑ a, CB3_1_4I2R3Value a) := by + exact contains_sound (finSumBall_sound 6 CB3_1_4I2R3P CB3_1_4I2R3Value CB3_1_4I2R3P_sound) (by decide +kernel) +def CB3_1_4I2R3MassTerm : Ball := .exact 0 +lemma CB3_1_4I2R3MassTerm_sound : CB3_1_4I2R3MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB3_1_4I2R3Value a))) := + entropyTerm_zero_ball (CB3_1_4I2R3Mass_sound) +def CB3_1_4I2R3H : Ball := ⟨0, 0⟩ +lemma CB3_1_4I2R3H_sound : CB3_1_4I2R3H.Encloses (homogeneousEntropy CB3_1_4I2R3Value) := by + exact contains_sound (homogeneous_enclosed CB3_1_4I2R3Value CB3_1_4I2R3MassTerm_sound CB3_1_4I2R3Entropy_sound) (by decide +kernel) +def CB3_1_4I2R4Value (a : Fin 6) : ℝ := residualLaw (below (shape 3 1 4)) (fun u => (stageBLaw (shape 3 1 4) u : ℝ)) (stageBPriority (shape 3 1 4)) 2 (fun u a => (littleLaw (shape 3 1 4) u ((stageBPriority (shape 3 1 4)) 2) a : ℝ)) 4 a +def CB3_1_4I2R4Raw (a : Fin 6) : Ball := residualBall (below (shape 3 1 4)) B3_1_4Law (stageBPriority (shape 3 1 4)) 2 (fun u => B3_1_4Little u ((stageBPriority (shape 3 1 4)) 2)) 4 a +lemma CB3_1_4I2R4Raw_sound (a : Fin 6) : + (CB3_1_4I2R4Raw a).Encloses (CB3_1_4I2R4Value a) := by + exact residualBall_sound_on (below (shape 3 1 4)) B3_1_4Law (fun u => (stageBLaw (shape 3 1 4) u : ℝ)) (stageBPriority (shape 3 1 4)) 2 (fun u => B3_1_4Little u ((stageBPriority (shape 3 1 4)) 2)) (fun u a => (littleLaw (shape 3 1 4) u ((stageBPriority (shape 3 1 4)) 2) a : ℝ)) (fun u _ => B3_1_4Law_sound u) (fun u _ a => B3_1_4Little_sound u ((stageBPriority (shape 3 1 4)) 2) a) 4 a +def CB3_1_4I2R4Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB3_1_4I2R4Certificates_valid : + CB3_1_4I2R4Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB3_1_4I2R4CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB3_1_4I2R4P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_1_4I2R4Certificates (CB3_1_4I2R4CertificateIndex a)).input +lemma CB3_1_4I2R4P_check : ∀ a : Fin 6, contains (CB3_1_4I2R4Raw a) (CB3_1_4I2R4P a) = true := by + decide +kernel +lemma CB3_1_4I2R4P_sound (a : Fin 6) : + (CB3_1_4I2R4P a).Encloses (CB3_1_4I2R4Value a) := + contains_sound (CB3_1_4I2R4Raw_sound a) (CB3_1_4I2R4P_check a) +def CB3_1_4I2R4Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_1_4I2R4Certificates (CB3_1_4I2R4CertificateIndex a)).output +lemma CB3_1_4I2R4Terms_sound (a : Fin 6) : + (CB3_1_4I2R4Terms a).Encloses (Foundation.entropyTerm (CB3_1_4I2R4Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB3_1_4I2R4Certificates_valid + (CB3_1_4I2R4CertificateIndex a) (CB3_1_4I2R4P_sound a) +def CB3_1_4I2R4Entropy : Ball := ⟨0, 0⟩ +lemma CB3_1_4I2R4Entropy_sound : CB3_1_4I2R4Entropy.Encloses (Foundation.finiteEntropy CB3_1_4I2R4Value) := by + exact contains_sound (entropyFin_enclosed 6 CB3_1_4I2R4Value CB3_1_4I2R4Terms CB3_1_4I2R4Terms_sound) (by decide +kernel) +def CB3_1_4I2R4Mass : Ball := ⟨0, 0⟩ +lemma CB3_1_4I2R4Mass_sound : CB3_1_4I2R4Mass.Encloses (∑ a, CB3_1_4I2R4Value a) := by + exact contains_sound (finSumBall_sound 6 CB3_1_4I2R4P CB3_1_4I2R4Value CB3_1_4I2R4P_sound) (by decide +kernel) +def CB3_1_4I2R4MassTerm : Ball := .exact 0 +lemma CB3_1_4I2R4MassTerm_sound : CB3_1_4I2R4MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB3_1_4I2R4Value a))) := + entropyTerm_zero_ball (CB3_1_4I2R4Mass_sound) +def CB3_1_4I2R4H : Ball := ⟨0, 0⟩ +lemma CB3_1_4I2R4H_sound : CB3_1_4I2R4H.Encloses (homogeneousEntropy CB3_1_4I2R4Value) := by + exact contains_sound (homogeneous_enclosed CB3_1_4I2R4Value CB3_1_4I2R4MassTerm_sound CB3_1_4I2R4Entropy_sound) (by decide +kernel) +def CB3_1_4I2R5Value (a : Fin 6) : ℝ := residualLaw (below (shape 3 1 4)) (fun u => (stageBLaw (shape 3 1 4) u : ℝ)) (stageBPriority (shape 3 1 4)) 2 (fun u a => (littleLaw (shape 3 1 4) u ((stageBPriority (shape 3 1 4)) 2) a : ℝ)) 5 a +def CB3_1_4I2R5Raw (a : Fin 6) : Ball := residualBall (below (shape 3 1 4)) B3_1_4Law (stageBPriority (shape 3 1 4)) 2 (fun u => B3_1_4Little u ((stageBPriority (shape 3 1 4)) 2)) 5 a +lemma CB3_1_4I2R5Raw_sound (a : Fin 6) : + (CB3_1_4I2R5Raw a).Encloses (CB3_1_4I2R5Value a) := by + exact residualBall_sound_on (below (shape 3 1 4)) B3_1_4Law (fun u => (stageBLaw (shape 3 1 4) u : ℝ)) (stageBPriority (shape 3 1 4)) 2 (fun u => B3_1_4Little u ((stageBPriority (shape 3 1 4)) 2)) (fun u a => (littleLaw (shape 3 1 4) u ((stageBPriority (shape 3 1 4)) 2) a : ℝ)) (fun u _ => B3_1_4Law_sound u) (fun u _ a => B3_1_4Little_sound u ((stageBPriority (shape 3 1 4)) 2) a) 5 a +def CB3_1_4I2R5Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB3_1_4I2R5Certificates_valid : + CB3_1_4I2R5Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB3_1_4I2R5CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB3_1_4I2R5P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_1_4I2R5Certificates (CB3_1_4I2R5CertificateIndex a)).input +lemma CB3_1_4I2R5P_check : ∀ a : Fin 6, contains (CB3_1_4I2R5Raw a) (CB3_1_4I2R5P a) = true := by + decide +kernel +lemma CB3_1_4I2R5P_sound (a : Fin 6) : + (CB3_1_4I2R5P a).Encloses (CB3_1_4I2R5Value a) := + contains_sound (CB3_1_4I2R5Raw_sound a) (CB3_1_4I2R5P_check a) +def CB3_1_4I2R5Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_1_4I2R5Certificates (CB3_1_4I2R5CertificateIndex a)).output +lemma CB3_1_4I2R5Terms_sound (a : Fin 6) : + (CB3_1_4I2R5Terms a).Encloses (Foundation.entropyTerm (CB3_1_4I2R5Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB3_1_4I2R5Certificates_valid + (CB3_1_4I2R5CertificateIndex a) (CB3_1_4I2R5P_sound a) +def CB3_1_4I2R5Entropy : Ball := ⟨0, 0⟩ +lemma CB3_1_4I2R5Entropy_sound : CB3_1_4I2R5Entropy.Encloses (Foundation.finiteEntropy CB3_1_4I2R5Value) := by + exact contains_sound (entropyFin_enclosed 6 CB3_1_4I2R5Value CB3_1_4I2R5Terms CB3_1_4I2R5Terms_sound) (by decide +kernel) +def CB3_1_4I2R5Mass : Ball := ⟨0, 0⟩ +lemma CB3_1_4I2R5Mass_sound : CB3_1_4I2R5Mass.Encloses (∑ a, CB3_1_4I2R5Value a) := by + exact contains_sound (finSumBall_sound 6 CB3_1_4I2R5P CB3_1_4I2R5Value CB3_1_4I2R5P_sound) (by decide +kernel) +def CB3_1_4I2R5MassTerm : Ball := .exact 0 +lemma CB3_1_4I2R5MassTerm_sound : CB3_1_4I2R5MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB3_1_4I2R5Value a))) := + entropyTerm_zero_ball (CB3_1_4I2R5Mass_sound) +def CB3_1_4I2R5H : Ball := ⟨0, 0⟩ +lemma CB3_1_4I2R5H_sound : CB3_1_4I2R5H.Encloses (homogeneousEntropy CB3_1_4I2R5Value) := by + exact contains_sound (homogeneous_enclosed CB3_1_4I2R5Value CB3_1_4I2R5MassTerm_sound CB3_1_4I2R5Entropy_sound) (by decide +kernel) +def CB3_1_4I2R6Value (a : Fin 6) : ℝ := residualLaw (below (shape 3 1 4)) (fun u => (stageBLaw (shape 3 1 4) u : ℝ)) (stageBPriority (shape 3 1 4)) 2 (fun u a => (littleLaw (shape 3 1 4) u ((stageBPriority (shape 3 1 4)) 2) a : ℝ)) 6 a +def CB3_1_4I2R6Raw (a : Fin 6) : Ball := residualBall (below (shape 3 1 4)) B3_1_4Law (stageBPriority (shape 3 1 4)) 2 (fun u => B3_1_4Little u ((stageBPriority (shape 3 1 4)) 2)) 6 a +lemma CB3_1_4I2R6Raw_sound (a : Fin 6) : + (CB3_1_4I2R6Raw a).Encloses (CB3_1_4I2R6Value a) := by + exact residualBall_sound_on (below (shape 3 1 4)) B3_1_4Law (fun u => (stageBLaw (shape 3 1 4) u : ℝ)) (stageBPriority (shape 3 1 4)) 2 (fun u => B3_1_4Little u ((stageBPriority (shape 3 1 4)) 2)) (fun u a => (littleLaw (shape 3 1 4) u ((stageBPriority (shape 3 1 4)) 2) a : ℝ)) (fun u _ => B3_1_4Law_sound u) (fun u _ a => B3_1_4Little_sound u ((stageBPriority (shape 3 1 4)) 2) a) 6 a +def CB3_1_4I2R6Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB3_1_4I2R6Certificates_valid : + CB3_1_4I2R6Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB3_1_4I2R6CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB3_1_4I2R6P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_1_4I2R6Certificates (CB3_1_4I2R6CertificateIndex a)).input +lemma CB3_1_4I2R6P_check : ∀ a : Fin 6, contains (CB3_1_4I2R6Raw a) (CB3_1_4I2R6P a) = true := by + decide +kernel +lemma CB3_1_4I2R6P_sound (a : Fin 6) : + (CB3_1_4I2R6P a).Encloses (CB3_1_4I2R6Value a) := + contains_sound (CB3_1_4I2R6Raw_sound a) (CB3_1_4I2R6P_check a) +def CB3_1_4I2R6Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_1_4I2R6Certificates (CB3_1_4I2R6CertificateIndex a)).output +lemma CB3_1_4I2R6Terms_sound (a : Fin 6) : + (CB3_1_4I2R6Terms a).Encloses (Foundation.entropyTerm (CB3_1_4I2R6Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB3_1_4I2R6Certificates_valid + (CB3_1_4I2R6CertificateIndex a) (CB3_1_4I2R6P_sound a) +def CB3_1_4I2R6Entropy : Ball := ⟨0, 0⟩ +lemma CB3_1_4I2R6Entropy_sound : CB3_1_4I2R6Entropy.Encloses (Foundation.finiteEntropy CB3_1_4I2R6Value) := by + exact contains_sound (entropyFin_enclosed 6 CB3_1_4I2R6Value CB3_1_4I2R6Terms CB3_1_4I2R6Terms_sound) (by decide +kernel) +def CB3_1_4I2R6Mass : Ball := ⟨0, 0⟩ +lemma CB3_1_4I2R6Mass_sound : CB3_1_4I2R6Mass.Encloses (∑ a, CB3_1_4I2R6Value a) := by + exact contains_sound (finSumBall_sound 6 CB3_1_4I2R6P CB3_1_4I2R6Value CB3_1_4I2R6P_sound) (by decide +kernel) +def CB3_1_4I2R6MassTerm : Ball := .exact 0 +lemma CB3_1_4I2R6MassTerm_sound : CB3_1_4I2R6MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB3_1_4I2R6Value a))) := + entropyTerm_zero_ball (CB3_1_4I2R6Mass_sound) +def CB3_1_4I2R6H : Ball := ⟨0, 0⟩ +lemma CB3_1_4I2R6H_sound : CB3_1_4I2R6H.Encloses (homogeneousEntropy CB3_1_4I2R6Value) := by + exact contains_sound (homogeneous_enclosed CB3_1_4I2R6Value CB3_1_4I2R6MassTerm_sound CB3_1_4I2R6Entropy_sound) (by decide +kernel) +def CB3_1_4I2R7Value (a : Fin 6) : ℝ := residualLaw (below (shape 3 1 4)) (fun u => (stageBLaw (shape 3 1 4) u : ℝ)) (stageBPriority (shape 3 1 4)) 2 (fun u a => (littleLaw (shape 3 1 4) u ((stageBPriority (shape 3 1 4)) 2) a : ℝ)) 7 a +def CB3_1_4I2R7Raw (a : Fin 6) : Ball := residualBall (below (shape 3 1 4)) B3_1_4Law (stageBPriority (shape 3 1 4)) 2 (fun u => B3_1_4Little u ((stageBPriority (shape 3 1 4)) 2)) 7 a +lemma CB3_1_4I2R7Raw_sound (a : Fin 6) : + (CB3_1_4I2R7Raw a).Encloses (CB3_1_4I2R7Value a) := by + exact residualBall_sound_on (below (shape 3 1 4)) B3_1_4Law (fun u => (stageBLaw (shape 3 1 4) u : ℝ)) (stageBPriority (shape 3 1 4)) 2 (fun u => B3_1_4Little u ((stageBPriority (shape 3 1 4)) 2)) (fun u a => (littleLaw (shape 3 1 4) u ((stageBPriority (shape 3 1 4)) 2) a : ℝ)) (fun u _ => B3_1_4Law_sound u) (fun u _ a => B3_1_4Little_sound u ((stageBPriority (shape 3 1 4)) 2) a) 7 a +def CB3_1_4I2R7Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB3_1_4I2R7Certificates_valid : + CB3_1_4I2R7Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB3_1_4I2R7CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB3_1_4I2R7P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_1_4I2R7Certificates (CB3_1_4I2R7CertificateIndex a)).input +lemma CB3_1_4I2R7P_check : ∀ a : Fin 6, contains (CB3_1_4I2R7Raw a) (CB3_1_4I2R7P a) = true := by + decide +kernel +lemma CB3_1_4I2R7P_sound (a : Fin 6) : + (CB3_1_4I2R7P a).Encloses (CB3_1_4I2R7Value a) := + contains_sound (CB3_1_4I2R7Raw_sound a) (CB3_1_4I2R7P_check a) +def CB3_1_4I2R7Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_1_4I2R7Certificates (CB3_1_4I2R7CertificateIndex a)).output +lemma CB3_1_4I2R7Terms_sound (a : Fin 6) : + (CB3_1_4I2R7Terms a).Encloses (Foundation.entropyTerm (CB3_1_4I2R7Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB3_1_4I2R7Certificates_valid + (CB3_1_4I2R7CertificateIndex a) (CB3_1_4I2R7P_sound a) +def CB3_1_4I2R7Entropy : Ball := ⟨0, 0⟩ +lemma CB3_1_4I2R7Entropy_sound : CB3_1_4I2R7Entropy.Encloses (Foundation.finiteEntropy CB3_1_4I2R7Value) := by + exact contains_sound (entropyFin_enclosed 6 CB3_1_4I2R7Value CB3_1_4I2R7Terms CB3_1_4I2R7Terms_sound) (by decide +kernel) +def CB3_1_4I2R7Mass : Ball := ⟨0, 0⟩ +lemma CB3_1_4I2R7Mass_sound : CB3_1_4I2R7Mass.Encloses (∑ a, CB3_1_4I2R7Value a) := by + exact contains_sound (finSumBall_sound 6 CB3_1_4I2R7P CB3_1_4I2R7Value CB3_1_4I2R7P_sound) (by decide +kernel) +def CB3_1_4I2R7MassTerm : Ball := .exact 0 +lemma CB3_1_4I2R7MassTerm_sound : CB3_1_4I2R7MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB3_1_4I2R7Value a))) := + entropyTerm_zero_ball (CB3_1_4I2R7Mass_sound) +def CB3_1_4I2R7H : Ball := ⟨0, 0⟩ +lemma CB3_1_4I2R7H_sound : CB3_1_4I2R7H.Encloses (homogeneousEntropy CB3_1_4I2R7Value) := by + exact contains_sound (homogeneous_enclosed CB3_1_4I2R7Value CB3_1_4I2R7MassTerm_sound CB3_1_4I2R7Entropy_sound) (by decide +kernel) +def CB3_1_4I2R8Value (a : Fin 6) : ℝ := residualLaw (below (shape 3 1 4)) (fun u => (stageBLaw (shape 3 1 4) u : ℝ)) (stageBPriority (shape 3 1 4)) 2 (fun u a => (littleLaw (shape 3 1 4) u ((stageBPriority (shape 3 1 4)) 2) a : ℝ)) 8 a +def CB3_1_4I2R8Raw (a : Fin 6) : Ball := residualBall (below (shape 3 1 4)) B3_1_4Law (stageBPriority (shape 3 1 4)) 2 (fun u => B3_1_4Little u ((stageBPriority (shape 3 1 4)) 2)) 8 a +lemma CB3_1_4I2R8Raw_sound (a : Fin 6) : + (CB3_1_4I2R8Raw a).Encloses (CB3_1_4I2R8Value a) := by + exact residualBall_sound_on (below (shape 3 1 4)) B3_1_4Law (fun u => (stageBLaw (shape 3 1 4) u : ℝ)) (stageBPriority (shape 3 1 4)) 2 (fun u => B3_1_4Little u ((stageBPriority (shape 3 1 4)) 2)) (fun u a => (littleLaw (shape 3 1 4) u ((stageBPriority (shape 3 1 4)) 2) a : ℝ)) (fun u _ => B3_1_4Law_sound u) (fun u _ a => B3_1_4Little_sound u ((stageBPriority (shape 3 1 4)) 2) a) 8 a +def CB3_1_4I2R8Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB3_1_4I2R8Certificates_valid : + CB3_1_4I2R8Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB3_1_4I2R8CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB3_1_4I2R8P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_1_4I2R8Certificates (CB3_1_4I2R8CertificateIndex a)).input +lemma CB3_1_4I2R8P_check : ∀ a : Fin 6, contains (CB3_1_4I2R8Raw a) (CB3_1_4I2R8P a) = true := by + decide +kernel +lemma CB3_1_4I2R8P_sound (a : Fin 6) : + (CB3_1_4I2R8P a).Encloses (CB3_1_4I2R8Value a) := + contains_sound (CB3_1_4I2R8Raw_sound a) (CB3_1_4I2R8P_check a) +def CB3_1_4I2R8Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_1_4I2R8Certificates (CB3_1_4I2R8CertificateIndex a)).output +lemma CB3_1_4I2R8Terms_sound (a : Fin 6) : + (CB3_1_4I2R8Terms a).Encloses (Foundation.entropyTerm (CB3_1_4I2R8Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB3_1_4I2R8Certificates_valid + (CB3_1_4I2R8CertificateIndex a) (CB3_1_4I2R8P_sound a) +def CB3_1_4I2R8Entropy : Ball := ⟨0, 0⟩ +lemma CB3_1_4I2R8Entropy_sound : CB3_1_4I2R8Entropy.Encloses (Foundation.finiteEntropy CB3_1_4I2R8Value) := by + exact contains_sound (entropyFin_enclosed 6 CB3_1_4I2R8Value CB3_1_4I2R8Terms CB3_1_4I2R8Terms_sound) (by decide +kernel) +def CB3_1_4I2R8Mass : Ball := ⟨0, 0⟩ +lemma CB3_1_4I2R8Mass_sound : CB3_1_4I2R8Mass.Encloses (∑ a, CB3_1_4I2R8Value a) := by + exact contains_sound (finSumBall_sound 6 CB3_1_4I2R8P CB3_1_4I2R8Value CB3_1_4I2R8P_sound) (by decide +kernel) +def CB3_1_4I2R8MassTerm : Ball := .exact 0 +lemma CB3_1_4I2R8MassTerm_sound : CB3_1_4I2R8MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB3_1_4I2R8Value a))) := + entropyTerm_zero_ball (CB3_1_4I2R8Mass_sound) +def CB3_1_4I2R8H : Ball := ⟨0, 0⟩ +lemma CB3_1_4I2R8H_sound : CB3_1_4I2R8H.Encloses (homogeneousEntropy CB3_1_4I2R8Value) := by + exact contains_sound (homogeneous_enclosed CB3_1_4I2R8Value CB3_1_4I2R8MassTerm_sound CB3_1_4I2R8Entropy_sound) (by decide +kernel) +def CB3_1_4I2R9Value (a : Fin 6) : ℝ := residualLaw (below (shape 3 1 4)) (fun u => (stageBLaw (shape 3 1 4) u : ℝ)) (stageBPriority (shape 3 1 4)) 2 (fun u a => (littleLaw (shape 3 1 4) u ((stageBPriority (shape 3 1 4)) 2) a : ℝ)) 9 a +def CB3_1_4I2R9Raw (a : Fin 6) : Ball := residualBall (below (shape 3 1 4)) B3_1_4Law (stageBPriority (shape 3 1 4)) 2 (fun u => B3_1_4Little u ((stageBPriority (shape 3 1 4)) 2)) 9 a +lemma CB3_1_4I2R9Raw_sound (a : Fin 6) : + (CB3_1_4I2R9Raw a).Encloses (CB3_1_4I2R9Value a) := by + exact residualBall_sound_on (below (shape 3 1 4)) B3_1_4Law (fun u => (stageBLaw (shape 3 1 4) u : ℝ)) (stageBPriority (shape 3 1 4)) 2 (fun u => B3_1_4Little u ((stageBPriority (shape 3 1 4)) 2)) (fun u a => (littleLaw (shape 3 1 4) u ((stageBPriority (shape 3 1 4)) 2) a : ℝ)) (fun u _ => B3_1_4Law_sound u) (fun u _ a => B3_1_4Little_sound u ((stageBPriority (shape 3 1 4)) 2) a) 9 a +def CB3_1_4I2R9Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB3_1_4I2R9Certificates_valid : + CB3_1_4I2R9Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB3_1_4I2R9CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB3_1_4I2R9P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_1_4I2R9Certificates (CB3_1_4I2R9CertificateIndex a)).input +lemma CB3_1_4I2R9P_check : ∀ a : Fin 6, contains (CB3_1_4I2R9Raw a) (CB3_1_4I2R9P a) = true := by + decide +kernel +lemma CB3_1_4I2R9P_sound (a : Fin 6) : + (CB3_1_4I2R9P a).Encloses (CB3_1_4I2R9Value a) := + contains_sound (CB3_1_4I2R9Raw_sound a) (CB3_1_4I2R9P_check a) +def CB3_1_4I2R9Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_1_4I2R9Certificates (CB3_1_4I2R9CertificateIndex a)).output +lemma CB3_1_4I2R9Terms_sound (a : Fin 6) : + (CB3_1_4I2R9Terms a).Encloses (Foundation.entropyTerm (CB3_1_4I2R9Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB3_1_4I2R9Certificates_valid + (CB3_1_4I2R9CertificateIndex a) (CB3_1_4I2R9P_sound a) +def CB3_1_4I2R9Entropy : Ball := ⟨0, 0⟩ +lemma CB3_1_4I2R9Entropy_sound : CB3_1_4I2R9Entropy.Encloses (Foundation.finiteEntropy CB3_1_4I2R9Value) := by + exact contains_sound (entropyFin_enclosed 6 CB3_1_4I2R9Value CB3_1_4I2R9Terms CB3_1_4I2R9Terms_sound) (by decide +kernel) +def CB3_1_4I2R9Mass : Ball := ⟨0, 0⟩ +lemma CB3_1_4I2R9Mass_sound : CB3_1_4I2R9Mass.Encloses (∑ a, CB3_1_4I2R9Value a) := by + exact contains_sound (finSumBall_sound 6 CB3_1_4I2R9P CB3_1_4I2R9Value CB3_1_4I2R9P_sound) (by decide +kernel) +def CB3_1_4I2R9MassTerm : Ball := .exact 0 +lemma CB3_1_4I2R9MassTerm_sound : CB3_1_4I2R9MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB3_1_4I2R9Value a))) := + entropyTerm_zero_ball (CB3_1_4I2R9Mass_sound) +def CB3_1_4I2R9H : Ball := ⟨0, 0⟩ +lemma CB3_1_4I2R9H_sound : CB3_1_4I2R9H.Encloses (homogeneousEntropy CB3_1_4I2R9Value) := by + exact contains_sound (homogeneous_enclosed CB3_1_4I2R9Value CB3_1_4I2R9MassTerm_sound CB3_1_4I2R9Entropy_sound) (by decide +kernel) +def CB3_1_4I2R10Value (a : Fin 6) : ℝ := residualLaw (below (shape 3 1 4)) (fun u => (stageBLaw (shape 3 1 4) u : ℝ)) (stageBPriority (shape 3 1 4)) 2 (fun u a => (littleLaw (shape 3 1 4) u ((stageBPriority (shape 3 1 4)) 2) a : ℝ)) 10 a +def CB3_1_4I2R10Raw (a : Fin 6) : Ball := residualBall (below (shape 3 1 4)) B3_1_4Law (stageBPriority (shape 3 1 4)) 2 (fun u => B3_1_4Little u ((stageBPriority (shape 3 1 4)) 2)) 10 a +lemma CB3_1_4I2R10Raw_sound (a : Fin 6) : + (CB3_1_4I2R10Raw a).Encloses (CB3_1_4I2R10Value a) := by + exact residualBall_sound_on (below (shape 3 1 4)) B3_1_4Law (fun u => (stageBLaw (shape 3 1 4) u : ℝ)) (stageBPriority (shape 3 1 4)) 2 (fun u => B3_1_4Little u ((stageBPriority (shape 3 1 4)) 2)) (fun u a => (littleLaw (shape 3 1 4) u ((stageBPriority (shape 3 1 4)) 2) a : ℝ)) (fun u _ => B3_1_4Law_sound u) (fun u _ a => B3_1_4Little_sound u ((stageBPriority (shape 3 1 4)) 2) a) 10 a +def CB3_1_4I2R10Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB3_1_4I2R10Certificates_valid : + CB3_1_4I2R10Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB3_1_4I2R10CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB3_1_4I2R10P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_1_4I2R10Certificates (CB3_1_4I2R10CertificateIndex a)).input +lemma CB3_1_4I2R10P_check : ∀ a : Fin 6, contains (CB3_1_4I2R10Raw a) (CB3_1_4I2R10P a) = true := by + decide +kernel +lemma CB3_1_4I2R10P_sound (a : Fin 6) : + (CB3_1_4I2R10P a).Encloses (CB3_1_4I2R10Value a) := + contains_sound (CB3_1_4I2R10Raw_sound a) (CB3_1_4I2R10P_check a) +def CB3_1_4I2R10Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_1_4I2R10Certificates (CB3_1_4I2R10CertificateIndex a)).output +lemma CB3_1_4I2R10Terms_sound (a : Fin 6) : + (CB3_1_4I2R10Terms a).Encloses (Foundation.entropyTerm (CB3_1_4I2R10Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB3_1_4I2R10Certificates_valid + (CB3_1_4I2R10CertificateIndex a) (CB3_1_4I2R10P_sound a) +def CB3_1_4I2R10Entropy : Ball := ⟨0, 0⟩ +lemma CB3_1_4I2R10Entropy_sound : CB3_1_4I2R10Entropy.Encloses (Foundation.finiteEntropy CB3_1_4I2R10Value) := by + exact contains_sound (entropyFin_enclosed 6 CB3_1_4I2R10Value CB3_1_4I2R10Terms CB3_1_4I2R10Terms_sound) (by decide +kernel) +def CB3_1_4I2R10Mass : Ball := ⟨0, 0⟩ +lemma CB3_1_4I2R10Mass_sound : CB3_1_4I2R10Mass.Encloses (∑ a, CB3_1_4I2R10Value a) := by + exact contains_sound (finSumBall_sound 6 CB3_1_4I2R10P CB3_1_4I2R10Value CB3_1_4I2R10P_sound) (by decide +kernel) +def CB3_1_4I2R10MassTerm : Ball := .exact 0 +lemma CB3_1_4I2R10MassTerm_sound : CB3_1_4I2R10MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB3_1_4I2R10Value a))) := + entropyTerm_zero_ball (CB3_1_4I2R10Mass_sound) +def CB3_1_4I2R10H : Ball := ⟨0, 0⟩ +lemma CB3_1_4I2R10H_sound : CB3_1_4I2R10H.Encloses (homogeneousEntropy CB3_1_4I2R10Value) := by + exact contains_sound (homogeneous_enclosed CB3_1_4I2R10Value CB3_1_4I2R10MassTerm_sound CB3_1_4I2R10Entropy_sound) (by decide +kernel) +def CB3_1_4I2R11Value (a : Fin 6) : ℝ := residualLaw (below (shape 3 1 4)) (fun u => (stageBLaw (shape 3 1 4) u : ℝ)) (stageBPriority (shape 3 1 4)) 2 (fun u a => (littleLaw (shape 3 1 4) u ((stageBPriority (shape 3 1 4)) 2) a : ℝ)) 11 a +def CB3_1_4I2R11Raw (a : Fin 6) : Ball := residualBall (below (shape 3 1 4)) B3_1_4Law (stageBPriority (shape 3 1 4)) 2 (fun u => B3_1_4Little u ((stageBPriority (shape 3 1 4)) 2)) 11 a +lemma CB3_1_4I2R11Raw_sound (a : Fin 6) : + (CB3_1_4I2R11Raw a).Encloses (CB3_1_4I2R11Value a) := by + exact residualBall_sound_on (below (shape 3 1 4)) B3_1_4Law (fun u => (stageBLaw (shape 3 1 4) u : ℝ)) (stageBPriority (shape 3 1 4)) 2 (fun u => B3_1_4Little u ((stageBPriority (shape 3 1 4)) 2)) (fun u a => (littleLaw (shape 3 1 4) u ((stageBPriority (shape 3 1 4)) 2) a : ℝ)) (fun u _ => B3_1_4Law_sound u) (fun u _ a => B3_1_4Little_sound u ((stageBPriority (shape 3 1 4)) 2) a) 11 a +def CB3_1_4I2R11Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB3_1_4I2R11Certificates_valid : + CB3_1_4I2R11Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB3_1_4I2R11CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB3_1_4I2R11P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_1_4I2R11Certificates (CB3_1_4I2R11CertificateIndex a)).input +lemma CB3_1_4I2R11P_check : ∀ a : Fin 6, contains (CB3_1_4I2R11Raw a) (CB3_1_4I2R11P a) = true := by + decide +kernel +lemma CB3_1_4I2R11P_sound (a : Fin 6) : + (CB3_1_4I2R11P a).Encloses (CB3_1_4I2R11Value a) := + contains_sound (CB3_1_4I2R11Raw_sound a) (CB3_1_4I2R11P_check a) +def CB3_1_4I2R11Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_1_4I2R11Certificates (CB3_1_4I2R11CertificateIndex a)).output +lemma CB3_1_4I2R11Terms_sound (a : Fin 6) : + (CB3_1_4I2R11Terms a).Encloses (Foundation.entropyTerm (CB3_1_4I2R11Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB3_1_4I2R11Certificates_valid + (CB3_1_4I2R11CertificateIndex a) (CB3_1_4I2R11P_sound a) +def CB3_1_4I2R11Entropy : Ball := ⟨0, 0⟩ +lemma CB3_1_4I2R11Entropy_sound : CB3_1_4I2R11Entropy.Encloses (Foundation.finiteEntropy CB3_1_4I2R11Value) := by + exact contains_sound (entropyFin_enclosed 6 CB3_1_4I2R11Value CB3_1_4I2R11Terms CB3_1_4I2R11Terms_sound) (by decide +kernel) +def CB3_1_4I2R11Mass : Ball := ⟨0, 0⟩ +lemma CB3_1_4I2R11Mass_sound : CB3_1_4I2R11Mass.Encloses (∑ a, CB3_1_4I2R11Value a) := by + exact contains_sound (finSumBall_sound 6 CB3_1_4I2R11P CB3_1_4I2R11Value CB3_1_4I2R11P_sound) (by decide +kernel) +def CB3_1_4I2R11MassTerm : Ball := .exact 0 +lemma CB3_1_4I2R11MassTerm_sound : CB3_1_4I2R11MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB3_1_4I2R11Value a))) := + entropyTerm_zero_ball (CB3_1_4I2R11Mass_sound) +def CB3_1_4I2R11H : Ball := ⟨0, 0⟩ +lemma CB3_1_4I2R11H_sound : CB3_1_4I2R11H.Encloses (homogeneousEntropy CB3_1_4I2R11Value) := by + exact contains_sound (homogeneous_enclosed CB3_1_4I2R11Value CB3_1_4I2R11MassTerm_sound CB3_1_4I2R11Entropy_sound) (by decide +kernel) +def CB3_1_4I2R12Value (a : Fin 6) : ℝ := residualLaw (below (shape 3 1 4)) (fun u => (stageBLaw (shape 3 1 4) u : ℝ)) (stageBPriority (shape 3 1 4)) 2 (fun u a => (littleLaw (shape 3 1 4) u ((stageBPriority (shape 3 1 4)) 2) a : ℝ)) 12 a +def CB3_1_4I2R12Raw (a : Fin 6) : Ball := residualBall (below (shape 3 1 4)) B3_1_4Law (stageBPriority (shape 3 1 4)) 2 (fun u => B3_1_4Little u ((stageBPriority (shape 3 1 4)) 2)) 12 a +lemma CB3_1_4I2R12Raw_sound (a : Fin 6) : + (CB3_1_4I2R12Raw a).Encloses (CB3_1_4I2R12Value a) := by + exact residualBall_sound_on (below (shape 3 1 4)) B3_1_4Law (fun u => (stageBLaw (shape 3 1 4) u : ℝ)) (stageBPriority (shape 3 1 4)) 2 (fun u => B3_1_4Little u ((stageBPriority (shape 3 1 4)) 2)) (fun u a => (littleLaw (shape 3 1 4) u ((stageBPriority (shape 3 1 4)) 2) a : ℝ)) (fun u _ => B3_1_4Law_sound u) (fun u _ a => B3_1_4Little_sound u ((stageBPriority (shape 3 1 4)) 2) a) 12 a +def CB3_1_4I2R12Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB3_1_4I2R12Certificates_valid : + CB3_1_4I2R12Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB3_1_4I2R12CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB3_1_4I2R12P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_1_4I2R12Certificates (CB3_1_4I2R12CertificateIndex a)).input +lemma CB3_1_4I2R12P_check : ∀ a : Fin 6, contains (CB3_1_4I2R12Raw a) (CB3_1_4I2R12P a) = true := by + decide +kernel +lemma CB3_1_4I2R12P_sound (a : Fin 6) : + (CB3_1_4I2R12P a).Encloses (CB3_1_4I2R12Value a) := + contains_sound (CB3_1_4I2R12Raw_sound a) (CB3_1_4I2R12P_check a) +def CB3_1_4I2R12Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_1_4I2R12Certificates (CB3_1_4I2R12CertificateIndex a)).output +lemma CB3_1_4I2R12Terms_sound (a : Fin 6) : + (CB3_1_4I2R12Terms a).Encloses (Foundation.entropyTerm (CB3_1_4I2R12Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB3_1_4I2R12Certificates_valid + (CB3_1_4I2R12CertificateIndex a) (CB3_1_4I2R12P_sound a) +def CB3_1_4I2R12Entropy : Ball := ⟨0, 0⟩ +lemma CB3_1_4I2R12Entropy_sound : CB3_1_4I2R12Entropy.Encloses (Foundation.finiteEntropy CB3_1_4I2R12Value) := by + exact contains_sound (entropyFin_enclosed 6 CB3_1_4I2R12Value CB3_1_4I2R12Terms CB3_1_4I2R12Terms_sound) (by decide +kernel) +def CB3_1_4I2R12Mass : Ball := ⟨0, 0⟩ +lemma CB3_1_4I2R12Mass_sound : CB3_1_4I2R12Mass.Encloses (∑ a, CB3_1_4I2R12Value a) := by + exact contains_sound (finSumBall_sound 6 CB3_1_4I2R12P CB3_1_4I2R12Value CB3_1_4I2R12P_sound) (by decide +kernel) +def CB3_1_4I2R12MassTerm : Ball := .exact 0 +lemma CB3_1_4I2R12MassTerm_sound : CB3_1_4I2R12MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB3_1_4I2R12Value a))) := + entropyTerm_zero_ball (CB3_1_4I2R12Mass_sound) +def CB3_1_4I2R12H : Ball := ⟨0, 0⟩ +lemma CB3_1_4I2R12H_sound : CB3_1_4I2R12H.Encloses (homogeneousEntropy CB3_1_4I2R12Value) := by + exact contains_sound (homogeneous_enclosed CB3_1_4I2R12Value CB3_1_4I2R12MassTerm_sound CB3_1_4I2R12Entropy_sound) (by decide +kernel) +def CB3_1_4I2R13Value (a : Fin 6) : ℝ := residualLaw (below (shape 3 1 4)) (fun u => (stageBLaw (shape 3 1 4) u : ℝ)) (stageBPriority (shape 3 1 4)) 2 (fun u a => (littleLaw (shape 3 1 4) u ((stageBPriority (shape 3 1 4)) 2) a : ℝ)) 13 a +def CB3_1_4I2R13Raw (a : Fin 6) : Ball := residualBall (below (shape 3 1 4)) B3_1_4Law (stageBPriority (shape 3 1 4)) 2 (fun u => B3_1_4Little u ((stageBPriority (shape 3 1 4)) 2)) 13 a +lemma CB3_1_4I2R13Raw_sound (a : Fin 6) : + (CB3_1_4I2R13Raw a).Encloses (CB3_1_4I2R13Value a) := by + exact residualBall_sound_on (below (shape 3 1 4)) B3_1_4Law (fun u => (stageBLaw (shape 3 1 4) u : ℝ)) (stageBPriority (shape 3 1 4)) 2 (fun u => B3_1_4Little u ((stageBPriority (shape 3 1 4)) 2)) (fun u a => (littleLaw (shape 3 1 4) u ((stageBPriority (shape 3 1 4)) 2) a : ℝ)) (fun u _ => B3_1_4Law_sound u) (fun u _ a => B3_1_4Little_sound u ((stageBPriority (shape 3 1 4)) 2) a) 13 a +def CB3_1_4I2R13Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB3_1_4I2R13Certificates_valid : + CB3_1_4I2R13Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB3_1_4I2R13CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB3_1_4I2R13P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_1_4I2R13Certificates (CB3_1_4I2R13CertificateIndex a)).input +lemma CB3_1_4I2R13P_check : ∀ a : Fin 6, contains (CB3_1_4I2R13Raw a) (CB3_1_4I2R13P a) = true := by + decide +kernel +lemma CB3_1_4I2R13P_sound (a : Fin 6) : + (CB3_1_4I2R13P a).Encloses (CB3_1_4I2R13Value a) := + contains_sound (CB3_1_4I2R13Raw_sound a) (CB3_1_4I2R13P_check a) +def CB3_1_4I2R13Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_1_4I2R13Certificates (CB3_1_4I2R13CertificateIndex a)).output +lemma CB3_1_4I2R13Terms_sound (a : Fin 6) : + (CB3_1_4I2R13Terms a).Encloses (Foundation.entropyTerm (CB3_1_4I2R13Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB3_1_4I2R13Certificates_valid + (CB3_1_4I2R13CertificateIndex a) (CB3_1_4I2R13P_sound a) +def CB3_1_4I2R13Entropy : Ball := ⟨0, 0⟩ +lemma CB3_1_4I2R13Entropy_sound : CB3_1_4I2R13Entropy.Encloses (Foundation.finiteEntropy CB3_1_4I2R13Value) := by + exact contains_sound (entropyFin_enclosed 6 CB3_1_4I2R13Value CB3_1_4I2R13Terms CB3_1_4I2R13Terms_sound) (by decide +kernel) +def CB3_1_4I2R13Mass : Ball := ⟨0, 0⟩ +lemma CB3_1_4I2R13Mass_sound : CB3_1_4I2R13Mass.Encloses (∑ a, CB3_1_4I2R13Value a) := by + exact contains_sound (finSumBall_sound 6 CB3_1_4I2R13P CB3_1_4I2R13Value CB3_1_4I2R13P_sound) (by decide +kernel) +def CB3_1_4I2R13MassTerm : Ball := .exact 0 +lemma CB3_1_4I2R13MassTerm_sound : CB3_1_4I2R13MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB3_1_4I2R13Value a))) := + entropyTerm_zero_ball (CB3_1_4I2R13Mass_sound) +def CB3_1_4I2R13H : Ball := ⟨0, 0⟩ +lemma CB3_1_4I2R13H_sound : CB3_1_4I2R13H.Encloses (homogeneousEntropy CB3_1_4I2R13Value) := by + exact contains_sound (homogeneous_enclosed CB3_1_4I2R13Value CB3_1_4I2R13MassTerm_sound CB3_1_4I2R13Entropy_sound) (by decide +kernel) +def CB3_1_4I2R14Value (a : Fin 6) : ℝ := residualLaw (below (shape 3 1 4)) (fun u => (stageBLaw (shape 3 1 4) u : ℝ)) (stageBPriority (shape 3 1 4)) 2 (fun u a => (littleLaw (shape 3 1 4) u ((stageBPriority (shape 3 1 4)) 2) a : ℝ)) 14 a +def CB3_1_4I2R14Raw (a : Fin 6) : Ball := residualBall (below (shape 3 1 4)) B3_1_4Law (stageBPriority (shape 3 1 4)) 2 (fun u => B3_1_4Little u ((stageBPriority (shape 3 1 4)) 2)) 14 a +lemma CB3_1_4I2R14Raw_sound (a : Fin 6) : + (CB3_1_4I2R14Raw a).Encloses (CB3_1_4I2R14Value a) := by + exact residualBall_sound_on (below (shape 3 1 4)) B3_1_4Law (fun u => (stageBLaw (shape 3 1 4) u : ℝ)) (stageBPriority (shape 3 1 4)) 2 (fun u => B3_1_4Little u ((stageBPriority (shape 3 1 4)) 2)) (fun u a => (littleLaw (shape 3 1 4) u ((stageBPriority (shape 3 1 4)) 2) a : ℝ)) (fun u _ => B3_1_4Law_sound u) (fun u _ a => B3_1_4Little_sound u ((stageBPriority (shape 3 1 4)) 2) a) 14 a +def CB3_1_4I2R14Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB3_1_4I2R14Certificates_valid : + CB3_1_4I2R14Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB3_1_4I2R14CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB3_1_4I2R14P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_1_4I2R14Certificates (CB3_1_4I2R14CertificateIndex a)).input +lemma CB3_1_4I2R14P_check : ∀ a : Fin 6, contains (CB3_1_4I2R14Raw a) (CB3_1_4I2R14P a) = true := by + decide +kernel +lemma CB3_1_4I2R14P_sound (a : Fin 6) : + (CB3_1_4I2R14P a).Encloses (CB3_1_4I2R14Value a) := + contains_sound (CB3_1_4I2R14Raw_sound a) (CB3_1_4I2R14P_check a) +def CB3_1_4I2R14Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_1_4I2R14Certificates (CB3_1_4I2R14CertificateIndex a)).output +lemma CB3_1_4I2R14Terms_sound (a : Fin 6) : + (CB3_1_4I2R14Terms a).Encloses (Foundation.entropyTerm (CB3_1_4I2R14Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB3_1_4I2R14Certificates_valid + (CB3_1_4I2R14CertificateIndex a) (CB3_1_4I2R14P_sound a) +def CB3_1_4I2R14Entropy : Ball := ⟨0, 0⟩ +lemma CB3_1_4I2R14Entropy_sound : CB3_1_4I2R14Entropy.Encloses (Foundation.finiteEntropy CB3_1_4I2R14Value) := by + exact contains_sound (entropyFin_enclosed 6 CB3_1_4I2R14Value CB3_1_4I2R14Terms CB3_1_4I2R14Terms_sound) (by decide +kernel) +def CB3_1_4I2R14Mass : Ball := ⟨0, 0⟩ +lemma CB3_1_4I2R14Mass_sound : CB3_1_4I2R14Mass.Encloses (∑ a, CB3_1_4I2R14Value a) := by + exact contains_sound (finSumBall_sound 6 CB3_1_4I2R14P CB3_1_4I2R14Value CB3_1_4I2R14P_sound) (by decide +kernel) +def CB3_1_4I2R14MassTerm : Ball := .exact 0 +lemma CB3_1_4I2R14MassTerm_sound : CB3_1_4I2R14MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB3_1_4I2R14Value a))) := + entropyTerm_zero_ball (CB3_1_4I2R14Mass_sound) +def CB3_1_4I2R14H : Ball := ⟨0, 0⟩ +lemma CB3_1_4I2R14H_sound : CB3_1_4I2R14H.Encloses (homogeneousEntropy CB3_1_4I2R14Value) := by + exact contains_sound (homogeneous_enclosed CB3_1_4I2R14Value CB3_1_4I2R14MassTerm_sound CB3_1_4I2R14Entropy_sound) (by decide +kernel) +def CB3_1_4I2R15Value (a : Fin 6) : ℝ := residualLaw (below (shape 3 1 4)) (fun u => (stageBLaw (shape 3 1 4) u : ℝ)) (stageBPriority (shape 3 1 4)) 2 (fun u a => (littleLaw (shape 3 1 4) u ((stageBPriority (shape 3 1 4)) 2) a : ℝ)) 15 a +def CB3_1_4I2R15Raw (a : Fin 6) : Ball := residualBall (below (shape 3 1 4)) B3_1_4Law (stageBPriority (shape 3 1 4)) 2 (fun u => B3_1_4Little u ((stageBPriority (shape 3 1 4)) 2)) 15 a +lemma CB3_1_4I2R15Raw_sound (a : Fin 6) : + (CB3_1_4I2R15Raw a).Encloses (CB3_1_4I2R15Value a) := by + exact residualBall_sound_on (below (shape 3 1 4)) B3_1_4Law (fun u => (stageBLaw (shape 3 1 4) u : ℝ)) (stageBPriority (shape 3 1 4)) 2 (fun u => B3_1_4Little u ((stageBPriority (shape 3 1 4)) 2)) (fun u a => (littleLaw (shape 3 1 4) u ((stageBPriority (shape 3 1 4)) 2) a : ℝ)) (fun u _ => B3_1_4Law_sound u) (fun u _ a => B3_1_4Little_sound u ((stageBPriority (shape 3 1 4)) 2) a) 15 a +def CB3_1_4I2R15Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB3_1_4I2R15Certificates_valid : + CB3_1_4I2R15Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB3_1_4I2R15CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB3_1_4I2R15P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_1_4I2R15Certificates (CB3_1_4I2R15CertificateIndex a)).input +lemma CB3_1_4I2R15P_check : ∀ a : Fin 6, contains (CB3_1_4I2R15Raw a) (CB3_1_4I2R15P a) = true := by + decide +kernel +lemma CB3_1_4I2R15P_sound (a : Fin 6) : + (CB3_1_4I2R15P a).Encloses (CB3_1_4I2R15Value a) := + contains_sound (CB3_1_4I2R15Raw_sound a) (CB3_1_4I2R15P_check a) +def CB3_1_4I2R15Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_1_4I2R15Certificates (CB3_1_4I2R15CertificateIndex a)).output +lemma CB3_1_4I2R15Terms_sound (a : Fin 6) : + (CB3_1_4I2R15Terms a).Encloses (Foundation.entropyTerm (CB3_1_4I2R15Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB3_1_4I2R15Certificates_valid + (CB3_1_4I2R15CertificateIndex a) (CB3_1_4I2R15P_sound a) +def CB3_1_4I2R15Entropy : Ball := ⟨0, 0⟩ +lemma CB3_1_4I2R15Entropy_sound : CB3_1_4I2R15Entropy.Encloses (Foundation.finiteEntropy CB3_1_4I2R15Value) := by + exact contains_sound (entropyFin_enclosed 6 CB3_1_4I2R15Value CB3_1_4I2R15Terms CB3_1_4I2R15Terms_sound) (by decide +kernel) +def CB3_1_4I2R15Mass : Ball := ⟨0, 0⟩ +lemma CB3_1_4I2R15Mass_sound : CB3_1_4I2R15Mass.Encloses (∑ a, CB3_1_4I2R15Value a) := by + exact contains_sound (finSumBall_sound 6 CB3_1_4I2R15P CB3_1_4I2R15Value CB3_1_4I2R15P_sound) (by decide +kernel) +def CB3_1_4I2R15MassTerm : Ball := .exact 0 +lemma CB3_1_4I2R15MassTerm_sound : CB3_1_4I2R15MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB3_1_4I2R15Value a))) := + entropyTerm_zero_ball (CB3_1_4I2R15Mass_sound) +def CB3_1_4I2R15H : Ball := ⟨0, 0⟩ +lemma CB3_1_4I2R15H_sound : CB3_1_4I2R15H.Encloses (homogeneousEntropy CB3_1_4I2R15Value) := by + exact contains_sound (homogeneous_enclosed CB3_1_4I2R15Value CB3_1_4I2R15MassTerm_sound CB3_1_4I2R15Entropy_sound) (by decide +kernel) +def CB3_1_4I2R16Value (a : Fin 6) : ℝ := residualLaw (below (shape 3 1 4)) (fun u => (stageBLaw (shape 3 1 4) u : ℝ)) (stageBPriority (shape 3 1 4)) 2 (fun u a => (littleLaw (shape 3 1 4) u ((stageBPriority (shape 3 1 4)) 2) a : ℝ)) 16 a +def CB3_1_4I2R16Raw (a : Fin 6) : Ball := residualBall (below (shape 3 1 4)) B3_1_4Law (stageBPriority (shape 3 1 4)) 2 (fun u => B3_1_4Little u ((stageBPriority (shape 3 1 4)) 2)) 16 a +lemma CB3_1_4I2R16Raw_sound (a : Fin 6) : + (CB3_1_4I2R16Raw a).Encloses (CB3_1_4I2R16Value a) := by + exact residualBall_sound_on (below (shape 3 1 4)) B3_1_4Law (fun u => (stageBLaw (shape 3 1 4) u : ℝ)) (stageBPriority (shape 3 1 4)) 2 (fun u => B3_1_4Little u ((stageBPriority (shape 3 1 4)) 2)) (fun u a => (littleLaw (shape 3 1 4) u ((stageBPriority (shape 3 1 4)) 2) a : ℝ)) (fun u _ => B3_1_4Law_sound u) (fun u _ a => B3_1_4Little_sound u ((stageBPriority (shape 3 1 4)) 2) a) 16 a +def CB3_1_4I2R16Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB3_1_4I2R16Certificates_valid : + CB3_1_4I2R16Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB3_1_4I2R16CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB3_1_4I2R16P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_1_4I2R16Certificates (CB3_1_4I2R16CertificateIndex a)).input +lemma CB3_1_4I2R16P_check : ∀ a : Fin 6, contains (CB3_1_4I2R16Raw a) (CB3_1_4I2R16P a) = true := by + decide +kernel +lemma CB3_1_4I2R16P_sound (a : Fin 6) : + (CB3_1_4I2R16P a).Encloses (CB3_1_4I2R16Value a) := + contains_sound (CB3_1_4I2R16Raw_sound a) (CB3_1_4I2R16P_check a) +def CB3_1_4I2R16Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_1_4I2R16Certificates (CB3_1_4I2R16CertificateIndex a)).output +lemma CB3_1_4I2R16Terms_sound (a : Fin 6) : + (CB3_1_4I2R16Terms a).Encloses (Foundation.entropyTerm (CB3_1_4I2R16Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB3_1_4I2R16Certificates_valid + (CB3_1_4I2R16CertificateIndex a) (CB3_1_4I2R16P_sound a) +def CB3_1_4I2R16Entropy : Ball := ⟨0, 0⟩ +lemma CB3_1_4I2R16Entropy_sound : CB3_1_4I2R16Entropy.Encloses (Foundation.finiteEntropy CB3_1_4I2R16Value) := by + exact contains_sound (entropyFin_enclosed 6 CB3_1_4I2R16Value CB3_1_4I2R16Terms CB3_1_4I2R16Terms_sound) (by decide +kernel) +def CB3_1_4I2R16Mass : Ball := ⟨0, 0⟩ +lemma CB3_1_4I2R16Mass_sound : CB3_1_4I2R16Mass.Encloses (∑ a, CB3_1_4I2R16Value a) := by + exact contains_sound (finSumBall_sound 6 CB3_1_4I2R16P CB3_1_4I2R16Value CB3_1_4I2R16P_sound) (by decide +kernel) +def CB3_1_4I2R16MassTerm : Ball := .exact 0 +lemma CB3_1_4I2R16MassTerm_sound : CB3_1_4I2R16MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB3_1_4I2R16Value a))) := + entropyTerm_zero_ball (CB3_1_4I2R16Mass_sound) +def CB3_1_4I2R16H : Ball := ⟨0, 0⟩ +lemma CB3_1_4I2R16H_sound : CB3_1_4I2R16H.Encloses (homogeneousEntropy CB3_1_4I2R16Value) := by + exact contains_sound (homogeneous_enclosed CB3_1_4I2R16Value CB3_1_4I2R16MassTerm_sound CB3_1_4I2R16Entropy_sound) (by decide +kernel) +def CB3_1_4I2ResidualEntropies (a : Fin 17) : Ball := + match a.val with + | 0 => CB3_1_4I2R0H + | 1 => CB3_1_4I2R1H + | 2 => CB3_1_4I2R2H + | 3 => CB3_1_4I2R3H + | 4 => CB3_1_4I2R4H + | 5 => CB3_1_4I2R5H + | 6 => CB3_1_4I2R6H + | 7 => CB3_1_4I2R7H + | 8 => CB3_1_4I2R8H + | 9 => CB3_1_4I2R9H + | 10 => CB3_1_4I2R10H + | 11 => CB3_1_4I2R11H + | 12 => CB3_1_4I2R12H + | 13 => CB3_1_4I2R13H + | 14 => CB3_1_4I2R14H + | 15 => CB3_1_4I2R15H + | 16 => CB3_1_4I2R16H + | _ => (.exact 0) +lemma CB3_1_4I2ResidualEntropies_sound (k : Fin 17) : + (CB3_1_4I2ResidualEntropies k).Encloses (homogeneousEntropy + (residualLaw (below (shape 3 1 4)) (fun u => (stageBLaw (shape 3 1 4) u : ℝ)) (stageBPriority (shape 3 1 4)) 2 (fun u a => (littleLaw (shape 3 1 4) u ((stageBPriority (shape 3 1 4)) 2) a : ℝ)) k)) := by + fin_cases k + · exact CB3_1_4I2R0H_sound + · exact CB3_1_4I2R1H_sound + · exact CB3_1_4I2R2H_sound + · exact CB3_1_4I2R3H_sound + · exact CB3_1_4I2R4H_sound + · exact CB3_1_4I2R5H_sound + · exact CB3_1_4I2R6H_sound + · exact CB3_1_4I2R7H_sound + · exact CB3_1_4I2R8H_sound + · exact CB3_1_4I2R9H_sound + · exact CB3_1_4I2R10H_sound + · exact CB3_1_4I2R11H_sound + · exact CB3_1_4I2R12H_sound + · exact CB3_1_4I2R13H_sound + · exact CB3_1_4I2R14H_sound + · exact CB3_1_4I2R15H_sound + · exact CB3_1_4I2R16H_sound +def CB3_1_4I2S0_0_4Value (a : Fin 6) : ℝ := (littleLaw (shape 3 1 4) (shape 0 0 4) ((stageBPriority (shape 3 1 4)) 2) a : ℝ) +def CB3_1_4I2S0_0_4E_5Log : Ball := .exact 0 +lemma CB3_1_4I2S0_0_4E_5Log_sound : CB3_1_4I2S0_0_4E_5Log.Encloses (Real.log (CB3_1_4I2S0_0_4Value (5 : Fin 6))) := by + exact log_exact_one_ball ((B3_1_4Little_sound (shape 0 0 4) ((stageBPriority (shape 3 1 4)) 2)) (5 : Fin 6)) +def CB3_1_4I2S0_0_4E_5 : Ball := ⟨0, 0⟩ +lemma CB3_1_4I2S0_0_4E_5_sound : CB3_1_4I2S0_0_4E_5.Encloses (Foundation.entropyTerm (CB3_1_4I2S0_0_4Value (5 : Fin 6))) := by + exact contains_sound (entropyTerm_ball ((B3_1_4Little_sound (shape 0 0 4) ((stageBPriority (shape 3 1 4)) 2)) (5 : Fin 6)) CB3_1_4I2S0_0_4E_5Log_sound) (by decide +kernel) +def CB3_1_4I2S0_0_4Terms (a : Fin 6) : Ball := + match a.val with + | 5 => ⟨0, 0⟩ + | _ => (.exact 0) +lemma CB3_1_4I2S0_0_4Terms_sound (a : Fin 6) : + (CB3_1_4I2S0_0_4Terms a).Encloses (Foundation.entropyTerm (CB3_1_4I2S0_0_4Value a)) := by + fin_cases a + · exact (entropyTerm_zero_ball ((B3_1_4Little_sound (shape 0 0 4) ((stageBPriority (shape 3 1 4)) 2)) (0 : Fin 6))) + · exact (entropyTerm_zero_ball ((B3_1_4Little_sound (shape 0 0 4) ((stageBPriority (shape 3 1 4)) 2)) (1 : Fin 6))) + · exact (entropyTerm_zero_ball ((B3_1_4Little_sound (shape 0 0 4) ((stageBPriority (shape 3 1 4)) 2)) (2 : Fin 6))) + · exact (entropyTerm_zero_ball ((B3_1_4Little_sound (shape 0 0 4) ((stageBPriority (shape 3 1 4)) 2)) (3 : Fin 6))) + · exact (entropyTerm_zero_ball ((B3_1_4Little_sound (shape 0 0 4) ((stageBPriority (shape 3 1 4)) 2)) (4 : Fin 6))) + · exact CB3_1_4I2S0_0_4E_5_sound +def CB3_1_4I2S0_0_4Entropy : Ball := ⟨0, 0⟩ +lemma CB3_1_4I2S0_0_4Entropy_sound : CB3_1_4I2S0_0_4Entropy.Encloses (Foundation.finiteEntropy CB3_1_4I2S0_0_4Value) := by + exact contains_sound (entropyFin_enclosed 6 CB3_1_4I2S0_0_4Value CB3_1_4I2S0_0_4Terms CB3_1_4I2S0_0_4Terms_sound) (by decide +kernel) +def CB3_1_4I2S0_0_4Mass : Ball := ⟨1, 0⟩ +lemma CB3_1_4I2S0_0_4Mass_sound : CB3_1_4I2S0_0_4Mass.Encloses (∑ a, CB3_1_4I2S0_0_4Value a) := by + exact contains_sound (finSumBall_sound 6 (B3_1_4Little (shape 0 0 4) ((stageBPriority (shape 3 1 4)) 2)) CB3_1_4I2S0_0_4Value (B3_1_4Little_sound (shape 0 0 4) ((stageBPriority (shape 3 1 4)) 2))) (by decide +kernel) +def CB3_1_4I2S0_0_4MassTermLog : Ball := .exact 0 +lemma CB3_1_4I2S0_0_4MassTermLog_sound : CB3_1_4I2S0_0_4MassTermLog.Encloses (Real.log ((∑ a, CB3_1_4I2S0_0_4Value a))) := by + exact log_exact_one_ball (CB3_1_4I2S0_0_4Mass_sound) +def CB3_1_4I2S0_0_4MassTerm : Ball := ⟨0, 0⟩ +lemma CB3_1_4I2S0_0_4MassTerm_sound : CB3_1_4I2S0_0_4MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB3_1_4I2S0_0_4Value a))) := by + exact contains_sound (entropyTerm_ball (CB3_1_4I2S0_0_4Mass_sound) CB3_1_4I2S0_0_4MassTermLog_sound) (by decide +kernel) +def CB3_1_4I2S0_0_4H : Ball := ⟨0, 0⟩ +lemma CB3_1_4I2S0_0_4H_sound : CB3_1_4I2S0_0_4H.Encloses (homogeneousEntropy CB3_1_4I2S0_0_4Value) := by + exact contains_sound (homogeneous_enclosed CB3_1_4I2S0_0_4Value CB3_1_4I2S0_0_4MassTerm_sound CB3_1_4I2S0_0_4Entropy_sound) (by decide +kernel) +def CB3_1_4I2S0_1_3Value (a : Fin 6) : ℝ := (littleLaw (shape 3 1 4) (shape 0 1 3) ((stageBPriority (shape 3 1 4)) 2) a : ℝ) +def CB3_1_4I2S0_1_3E_4Log : Ball := .exact 0 +lemma CB3_1_4I2S0_1_3E_4Log_sound : CB3_1_4I2S0_1_3E_4Log.Encloses (Real.log (CB3_1_4I2S0_1_3Value (4 : Fin 6))) := by + exact log_exact_one_ball ((B3_1_4Little_sound (shape 0 1 3) ((stageBPriority (shape 3 1 4)) 2)) (4 : Fin 6)) +def CB3_1_4I2S0_1_3E_4 : Ball := ⟨0, 0⟩ +lemma CB3_1_4I2S0_1_3E_4_sound : CB3_1_4I2S0_1_3E_4.Encloses (Foundation.entropyTerm (CB3_1_4I2S0_1_3Value (4 : Fin 6))) := by + exact contains_sound (entropyTerm_ball ((B3_1_4Little_sound (shape 0 1 3) ((stageBPriority (shape 3 1 4)) 2)) (4 : Fin 6)) CB3_1_4I2S0_1_3E_4Log_sound) (by decide +kernel) +def CB3_1_4I2S0_1_3Terms (a : Fin 6) : Ball := + match a.val with + | 4 => ⟨0, 0⟩ + | _ => (.exact 0) +lemma CB3_1_4I2S0_1_3Terms_sound (a : Fin 6) : + (CB3_1_4I2S0_1_3Terms a).Encloses (Foundation.entropyTerm (CB3_1_4I2S0_1_3Value a)) := by + fin_cases a + · exact (entropyTerm_zero_ball ((B3_1_4Little_sound (shape 0 1 3) ((stageBPriority (shape 3 1 4)) 2)) (0 : Fin 6))) + · exact (entropyTerm_zero_ball ((B3_1_4Little_sound (shape 0 1 3) ((stageBPriority (shape 3 1 4)) 2)) (1 : Fin 6))) + · exact (entropyTerm_zero_ball ((B3_1_4Little_sound (shape 0 1 3) ((stageBPriority (shape 3 1 4)) 2)) (2 : Fin 6))) + · exact (entropyTerm_zero_ball ((B3_1_4Little_sound (shape 0 1 3) ((stageBPriority (shape 3 1 4)) 2)) (3 : Fin 6))) + · exact CB3_1_4I2S0_1_3E_4_sound + · exact (entropyTerm_zero_ball ((B3_1_4Little_sound (shape 0 1 3) ((stageBPriority (shape 3 1 4)) 2)) (5 : Fin 6))) +def CB3_1_4I2S0_1_3Entropy : Ball := ⟨0, 0⟩ +lemma CB3_1_4I2S0_1_3Entropy_sound : CB3_1_4I2S0_1_3Entropy.Encloses (Foundation.finiteEntropy CB3_1_4I2S0_1_3Value) := by + exact contains_sound (entropyFin_enclosed 6 CB3_1_4I2S0_1_3Value CB3_1_4I2S0_1_3Terms CB3_1_4I2S0_1_3Terms_sound) (by decide +kernel) +def CB3_1_4I2S0_1_3Mass : Ball := ⟨1, 0⟩ +lemma CB3_1_4I2S0_1_3Mass_sound : CB3_1_4I2S0_1_3Mass.Encloses (∑ a, CB3_1_4I2S0_1_3Value a) := by + exact contains_sound (finSumBall_sound 6 (B3_1_4Little (shape 0 1 3) ((stageBPriority (shape 3 1 4)) 2)) CB3_1_4I2S0_1_3Value (B3_1_4Little_sound (shape 0 1 3) ((stageBPriority (shape 3 1 4)) 2))) (by decide +kernel) +def CB3_1_4I2S0_1_3MassTermLog : Ball := .exact 0 +lemma CB3_1_4I2S0_1_3MassTermLog_sound : CB3_1_4I2S0_1_3MassTermLog.Encloses (Real.log ((∑ a, CB3_1_4I2S0_1_3Value a))) := by + exact log_exact_one_ball (CB3_1_4I2S0_1_3Mass_sound) +def CB3_1_4I2S0_1_3MassTerm : Ball := ⟨0, 0⟩ +lemma CB3_1_4I2S0_1_3MassTerm_sound : CB3_1_4I2S0_1_3MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB3_1_4I2S0_1_3Value a))) := by + exact contains_sound (entropyTerm_ball (CB3_1_4I2S0_1_3Mass_sound) CB3_1_4I2S0_1_3MassTermLog_sound) (by decide +kernel) +def CB3_1_4I2S0_1_3H : Ball := ⟨0, 0⟩ +lemma CB3_1_4I2S0_1_3H_sound : CB3_1_4I2S0_1_3H.Encloses (homogeneousEntropy CB3_1_4I2S0_1_3Value) := by + exact contains_sound (homogeneous_enclosed CB3_1_4I2S0_1_3Value CB3_1_4I2S0_1_3MassTerm_sound CB3_1_4I2S0_1_3Entropy_sound) (by decide +kernel) +def CB3_1_4I2S1_0_3Value (a : Fin 6) : ℝ := (littleLaw (shape 3 1 4) (shape 1 0 3) ((stageBPriority (shape 3 1 4)) 2) a : ℝ) +def CB3_1_4I2S1_0_3E_4Log : Ball := .exact 0 +lemma CB3_1_4I2S1_0_3E_4Log_sound : CB3_1_4I2S1_0_3E_4Log.Encloses (Real.log (CB3_1_4I2S1_0_3Value (4 : Fin 6))) := by + exact log_exact_one_ball ((B3_1_4Little_sound (shape 1 0 3) ((stageBPriority (shape 3 1 4)) 2)) (4 : Fin 6)) +def CB3_1_4I2S1_0_3E_4 : Ball := ⟨0, 0⟩ +lemma CB3_1_4I2S1_0_3E_4_sound : CB3_1_4I2S1_0_3E_4.Encloses (Foundation.entropyTerm (CB3_1_4I2S1_0_3Value (4 : Fin 6))) := by + exact contains_sound (entropyTerm_ball ((B3_1_4Little_sound (shape 1 0 3) ((stageBPriority (shape 3 1 4)) 2)) (4 : Fin 6)) CB3_1_4I2S1_0_3E_4Log_sound) (by decide +kernel) +def CB3_1_4I2S1_0_3Terms (a : Fin 6) : Ball := + match a.val with + | 4 => ⟨0, 0⟩ + | _ => (.exact 0) +lemma CB3_1_4I2S1_0_3Terms_sound (a : Fin 6) : + (CB3_1_4I2S1_0_3Terms a).Encloses (Foundation.entropyTerm (CB3_1_4I2S1_0_3Value a)) := by + fin_cases a + · exact (entropyTerm_zero_ball ((B3_1_4Little_sound (shape 1 0 3) ((stageBPriority (shape 3 1 4)) 2)) (0 : Fin 6))) + · exact (entropyTerm_zero_ball ((B3_1_4Little_sound (shape 1 0 3) ((stageBPriority (shape 3 1 4)) 2)) (1 : Fin 6))) + · exact (entropyTerm_zero_ball ((B3_1_4Little_sound (shape 1 0 3) ((stageBPriority (shape 3 1 4)) 2)) (2 : Fin 6))) + · exact (entropyTerm_zero_ball ((B3_1_4Little_sound (shape 1 0 3) ((stageBPriority (shape 3 1 4)) 2)) (3 : Fin 6))) + · exact CB3_1_4I2S1_0_3E_4_sound + · exact (entropyTerm_zero_ball ((B3_1_4Little_sound (shape 1 0 3) ((stageBPriority (shape 3 1 4)) 2)) (5 : Fin 6))) +def CB3_1_4I2S1_0_3Entropy : Ball := ⟨0, 0⟩ +lemma CB3_1_4I2S1_0_3Entropy_sound : CB3_1_4I2S1_0_3Entropy.Encloses (Foundation.finiteEntropy CB3_1_4I2S1_0_3Value) := by + exact contains_sound (entropyFin_enclosed 6 CB3_1_4I2S1_0_3Value CB3_1_4I2S1_0_3Terms CB3_1_4I2S1_0_3Terms_sound) (by decide +kernel) +def CB3_1_4I2S1_0_3Mass : Ball := ⟨1, 0⟩ +lemma CB3_1_4I2S1_0_3Mass_sound : CB3_1_4I2S1_0_3Mass.Encloses (∑ a, CB3_1_4I2S1_0_3Value a) := by + exact contains_sound (finSumBall_sound 6 (B3_1_4Little (shape 1 0 3) ((stageBPriority (shape 3 1 4)) 2)) CB3_1_4I2S1_0_3Value (B3_1_4Little_sound (shape 1 0 3) ((stageBPriority (shape 3 1 4)) 2))) (by decide +kernel) +def CB3_1_4I2S1_0_3MassTermLog : Ball := .exact 0 +lemma CB3_1_4I2S1_0_3MassTermLog_sound : CB3_1_4I2S1_0_3MassTermLog.Encloses (Real.log ((∑ a, CB3_1_4I2S1_0_3Value a))) := by + exact log_exact_one_ball (CB3_1_4I2S1_0_3Mass_sound) +def CB3_1_4I2S1_0_3MassTerm : Ball := ⟨0, 0⟩ +lemma CB3_1_4I2S1_0_3MassTerm_sound : CB3_1_4I2S1_0_3MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB3_1_4I2S1_0_3Value a))) := by + exact contains_sound (entropyTerm_ball (CB3_1_4I2S1_0_3Mass_sound) CB3_1_4I2S1_0_3MassTermLog_sound) (by decide +kernel) +def CB3_1_4I2S1_0_3H : Ball := ⟨0, 0⟩ +lemma CB3_1_4I2S1_0_3H_sound : CB3_1_4I2S1_0_3H.Encloses (homogeneousEntropy CB3_1_4I2S1_0_3Value) := by + exact contains_sound (homogeneous_enclosed CB3_1_4I2S1_0_3Value CB3_1_4I2S1_0_3MassTerm_sound CB3_1_4I2S1_0_3Entropy_sound) (by decide +kernel) +def CB3_1_4I2S2_0_2Value (a : Fin 6) : ℝ := (littleLaw (shape 3 1 4) (shape 2 0 2) ((stageBPriority (shape 3 1 4)) 2) a : ℝ) +def CB3_1_4I2S2_0_2E_2LogWitness : LogWitness := ⟨-1, 56577, 31250⟩ +def CB3_1_4I2S2_0_2E_2Log : Ball := ⟨(-9956401454401802915036069658881 / 100000000000000000000000000000000), (21175823683 / 50000000000000000000000000000000)⟩ +lemma CB3_1_4I2S2_0_2E_2Log_sound : CB3_1_4I2S2_0_2E_2Log.Encloses (Real.log (CB3_1_4I2S2_0_2Value (2 : Fin 6))) := by + exact checkLog_sound logTwoBall_sound ((B3_1_4Little_sound (shape 2 0 2) ((stageBPriority (shape 3 1 4)) 2)) (2 : Fin 6)) (w := CB3_1_4I2S2_0_2E_2LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB3_1_4I2S2_0_2E_2 : Ball := ⟨(1126606650171381607047991426181 / 12500000000000000000000000000000), (38338066449 / 100000000000000000000000000000000)⟩ +lemma CB3_1_4I2S2_0_2E_2_sound : CB3_1_4I2S2_0_2E_2.Encloses (Foundation.entropyTerm (CB3_1_4I2S2_0_2Value (2 : Fin 6))) := by + exact contains_sound (entropyTerm_ball ((B3_1_4Little_sound (shape 2 0 2) ((stageBPriority (shape 3 1 4)) 2)) (2 : Fin 6)) CB3_1_4I2S2_0_2E_2Log_sound) (by decide +kernel) +def CB3_1_4I2S2_0_2E_3LogWitness : LogWitness := ⟨-4, 23692, 15625⟩ +def CB3_1_4I2S2_0_2E_3Log : Ball := ⟨(-235632347944752769756850307028051 / 100000000000000000000000000000000), (21175823683 / 20000000000000000000000000000000)⟩ +lemma CB3_1_4I2S2_0_2E_3Log_sound : CB3_1_4I2S2_0_2E_3Log.Encloses (Real.log (CB3_1_4I2S2_0_2Value (3 : Fin 6))) := by + exact checkLog_sound logTwoBall_sound ((B3_1_4Little_sound (shape 2 0 2) ((stageBPriority (shape 3 1 4)) 2)) (3 : Fin 6)) (w := CB3_1_4I2S2_0_2E_3LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB3_1_4I2S2_0_2E_3 : Ball := ⟨(11165203175014165242158594948217 / 50000000000000000000000000000000), (2006790459 / 20000000000000000000000000000000)⟩ +lemma CB3_1_4I2S2_0_2E_3_sound : CB3_1_4I2S2_0_2E_3.Encloses (Foundation.entropyTerm (CB3_1_4I2S2_0_2Value (3 : Fin 6))) := by + exact contains_sound (entropyTerm_ball ((B3_1_4Little_sound (shape 2 0 2) ((stageBPriority (shape 3 1 4)) 2)) (3 : Fin 6)) CB3_1_4I2S2_0_2E_3Log_sound) (by decide +kernel) +def CB3_1_4I2S2_0_2Terms (a : Fin 6) : Ball := + match a.val with + | 2 => ⟨(1126606650171381607047991426181 / 12500000000000000000000000000000), (38338066449 / 100000000000000000000000000000000)⟩ + | 3 => ⟨(11165203175014165242158594948217 / 50000000000000000000000000000000), (2006790459 / 20000000000000000000000000000000)⟩ + | _ => (.exact 0) +lemma CB3_1_4I2S2_0_2Terms_sound (a : Fin 6) : + (CB3_1_4I2S2_0_2Terms a).Encloses (Foundation.entropyTerm (CB3_1_4I2S2_0_2Value a)) := by + fin_cases a + · exact (entropyTerm_zero_ball ((B3_1_4Little_sound (shape 2 0 2) ((stageBPriority (shape 3 1 4)) 2)) (0 : Fin 6))) + · exact (entropyTerm_zero_ball ((B3_1_4Little_sound (shape 2 0 2) ((stageBPriority (shape 3 1 4)) 2)) (1 : Fin 6))) + · exact CB3_1_4I2S2_0_2E_2_sound + · exact CB3_1_4I2S2_0_2E_3_sound + · exact (entropyTerm_zero_ball ((B3_1_4Little_sound (shape 2 0 2) ((stageBPriority (shape 3 1 4)) 2)) (4 : Fin 6))) + · exact (entropyTerm_zero_ball ((B3_1_4Little_sound (shape 2 0 2) ((stageBPriority (shape 3 1 4)) 2)) (5 : Fin 6))) +def CB3_1_4I2S2_0_2Entropy : Ball := ⟨(15671629775699691670350560652941 / 50000000000000000000000000000000), (6046502343 / 12500000000000000000000000000000)⟩ +lemma CB3_1_4I2S2_0_2Entropy_sound : CB3_1_4I2S2_0_2Entropy.Encloses (Foundation.finiteEntropy CB3_1_4I2S2_0_2Value) := by + exact contains_sound (entropyFin_enclosed 6 CB3_1_4I2S2_0_2Value CB3_1_4I2S2_0_2Terms CB3_1_4I2S2_0_2Terms_sound) (by decide +kernel) +def CB3_1_4I2S2_0_2Mass : Ball := ⟨1, 0⟩ +lemma CB3_1_4I2S2_0_2Mass_sound : CB3_1_4I2S2_0_2Mass.Encloses (∑ a, CB3_1_4I2S2_0_2Value a) := by + exact contains_sound (finSumBall_sound 6 (B3_1_4Little (shape 2 0 2) ((stageBPriority (shape 3 1 4)) 2)) CB3_1_4I2S2_0_2Value (B3_1_4Little_sound (shape 2 0 2) ((stageBPriority (shape 3 1 4)) 2))) (by decide +kernel) +def CB3_1_4I2S2_0_2MassTermLog : Ball := .exact 0 +lemma CB3_1_4I2S2_0_2MassTermLog_sound : CB3_1_4I2S2_0_2MassTermLog.Encloses (Real.log ((∑ a, CB3_1_4I2S2_0_2Value a))) := by + exact log_exact_one_ball (CB3_1_4I2S2_0_2Mass_sound) +def CB3_1_4I2S2_0_2MassTerm : Ball := ⟨0, 0⟩ +lemma CB3_1_4I2S2_0_2MassTerm_sound : CB3_1_4I2S2_0_2MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB3_1_4I2S2_0_2Value a))) := by + exact contains_sound (entropyTerm_ball (CB3_1_4I2S2_0_2Mass_sound) CB3_1_4I2S2_0_2MassTermLog_sound) (by decide +kernel) +def CB3_1_4I2S2_0_2H : Ball := ⟨(15671629775699691670350560652941 / 50000000000000000000000000000000), (6046502343 / 12500000000000000000000000000000)⟩ +lemma CB3_1_4I2S2_0_2H_sound : CB3_1_4I2S2_0_2H.Encloses (homogeneousEntropy CB3_1_4I2S2_0_2Value) := by + exact contains_sound (homogeneous_enclosed CB3_1_4I2S2_0_2Value CB3_1_4I2S2_0_2MassTerm_sound CB3_1_4I2S2_0_2Entropy_sound) (by decide +kernel) +def CB3_1_4I2S3_0_1Value (a : Fin 6) : ℝ := (littleLaw (shape 3 1 4) (shape 3 0 1) ((stageBPriority (shape 3 1 4)) 2) a : ℝ) +def CB3_1_4I2S3_0_1E_1Log : Ball := .exact 0 +lemma CB3_1_4I2S3_0_1E_1Log_sound : CB3_1_4I2S3_0_1E_1Log.Encloses (Real.log (CB3_1_4I2S3_0_1Value (1 : Fin 6))) := by + exact log_exact_one_ball ((B3_1_4Little_sound (shape 3 0 1) ((stageBPriority (shape 3 1 4)) 2)) (1 : Fin 6)) +def CB3_1_4I2S3_0_1E_1 : Ball := ⟨0, 0⟩ +lemma CB3_1_4I2S3_0_1E_1_sound : CB3_1_4I2S3_0_1E_1.Encloses (Foundation.entropyTerm (CB3_1_4I2S3_0_1Value (1 : Fin 6))) := by + exact contains_sound (entropyTerm_ball ((B3_1_4Little_sound (shape 3 0 1) ((stageBPriority (shape 3 1 4)) 2)) (1 : Fin 6)) CB3_1_4I2S3_0_1E_1Log_sound) (by decide +kernel) +def CB3_1_4I2S3_0_1Terms (a : Fin 6) : Ball := + match a.val with + | 1 => ⟨0, 0⟩ + | _ => (.exact 0) +lemma CB3_1_4I2S3_0_1Terms_sound (a : Fin 6) : + (CB3_1_4I2S3_0_1Terms a).Encloses (Foundation.entropyTerm (CB3_1_4I2S3_0_1Value a)) := by + fin_cases a + · exact (entropyTerm_zero_ball ((B3_1_4Little_sound (shape 3 0 1) ((stageBPriority (shape 3 1 4)) 2)) (0 : Fin 6))) + · exact CB3_1_4I2S3_0_1E_1_sound + · exact (entropyTerm_zero_ball ((B3_1_4Little_sound (shape 3 0 1) ((stageBPriority (shape 3 1 4)) 2)) (2 : Fin 6))) + · exact (entropyTerm_zero_ball ((B3_1_4Little_sound (shape 3 0 1) ((stageBPriority (shape 3 1 4)) 2)) (3 : Fin 6))) + · exact (entropyTerm_zero_ball ((B3_1_4Little_sound (shape 3 0 1) ((stageBPriority (shape 3 1 4)) 2)) (4 : Fin 6))) + · exact (entropyTerm_zero_ball ((B3_1_4Little_sound (shape 3 0 1) ((stageBPriority (shape 3 1 4)) 2)) (5 : Fin 6))) +def CB3_1_4I2S3_0_1Entropy : Ball := ⟨0, 0⟩ +lemma CB3_1_4I2S3_0_1Entropy_sound : CB3_1_4I2S3_0_1Entropy.Encloses (Foundation.finiteEntropy CB3_1_4I2S3_0_1Value) := by + exact contains_sound (entropyFin_enclosed 6 CB3_1_4I2S3_0_1Value CB3_1_4I2S3_0_1Terms CB3_1_4I2S3_0_1Terms_sound) (by decide +kernel) +def CB3_1_4I2S3_0_1Mass : Ball := ⟨1, 0⟩ +lemma CB3_1_4I2S3_0_1Mass_sound : CB3_1_4I2S3_0_1Mass.Encloses (∑ a, CB3_1_4I2S3_0_1Value a) := by + exact contains_sound (finSumBall_sound 6 (B3_1_4Little (shape 3 0 1) ((stageBPriority (shape 3 1 4)) 2)) CB3_1_4I2S3_0_1Value (B3_1_4Little_sound (shape 3 0 1) ((stageBPriority (shape 3 1 4)) 2))) (by decide +kernel) +def CB3_1_4I2S3_0_1MassTermLog : Ball := .exact 0 +lemma CB3_1_4I2S3_0_1MassTermLog_sound : CB3_1_4I2S3_0_1MassTermLog.Encloses (Real.log ((∑ a, CB3_1_4I2S3_0_1Value a))) := by + exact log_exact_one_ball (CB3_1_4I2S3_0_1Mass_sound) +def CB3_1_4I2S3_0_1MassTerm : Ball := ⟨0, 0⟩ +lemma CB3_1_4I2S3_0_1MassTerm_sound : CB3_1_4I2S3_0_1MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB3_1_4I2S3_0_1Value a))) := by + exact contains_sound (entropyTerm_ball (CB3_1_4I2S3_0_1Mass_sound) CB3_1_4I2S3_0_1MassTermLog_sound) (by decide +kernel) +def CB3_1_4I2S3_0_1H : Ball := ⟨0, 0⟩ +lemma CB3_1_4I2S3_0_1H_sound : CB3_1_4I2S3_0_1H.Encloses (homogeneousEntropy CB3_1_4I2S3_0_1Value) := by + exact contains_sound (homogeneous_enclosed CB3_1_4I2S3_0_1Value CB3_1_4I2S3_0_1MassTerm_sound CB3_1_4I2S3_0_1Entropy_sound) (by decide +kernel) +def CB3_1_4I2Singles (s : Shape) : Ball := + match s 0, s 1, s 2 with + | 0, 0, 4 => CB3_1_4I2S0_0_4H + | 0, 1, 3 => CB3_1_4I2S0_1_3H + | 1, 0, 3 => CB3_1_4I2S1_0_3H + | 2, 0, 2 => CB3_1_4I2S2_0_2H + | 3, 0, 1 => CB3_1_4I2S3_0_1H + | _, _, _ => (.exact 0) +lemma CB3_1_4I2Singles_sound (u : Shape) (hu : u ∈ below (shape 3 1 4)) + (hd : designated (stageBPriority (shape 3 1 4)) 2 u) : + (CB3_1_4I2Singles u).Encloses (homogeneousEntropy ((fun u a => (littleLaw (shape 3 1 4) u ((stageBPriority (shape 3 1 4)) 2) a : ℝ)) u)) := by + rw [B3_1_4_below] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl + · exact CB3_1_4I2S0_0_4H_sound + · exact CB3_1_4I2S0_1_3H_sound + · exact CB3_1_4I2S1_0_3H_sound + · exact (show ¬ designated (stageBPriority (shape 3 1 4)) 2 (shape 1 1 2) by decide +kernel) hd |>.elim + · exact CB3_1_4I2S2_0_2H_sound + · exact (show ¬ designated (stageBPriority (shape 3 1 4)) 2 (shape 2 1 1) by decide +kernel) hd |>.elim + · exact CB3_1_4I2S3_0_1H_sound + · exact (show ¬ designated (stageBPriority (shape 3 1 4)) 2 (shape 3 1 0) by decide +kernel) hd |>.elim +def CB3_1_4I2Singleton : Ball := ⟨(3317128459142276397553763101999 / 25000000000000000000000000000000), (20477283133 / 100000000000000000000000000000000)⟩ +lemma CB3_1_4I2Singleton_sound : CB3_1_4I2Singleton.Encloses + (singletonEntropy (below (shape 3 1 4)) (fun u => (stageBLaw (shape 3 1 4) u : ℝ)) (stageBPriority (shape 3 1 4)) 2 (fun u a => (littleLaw (shape 3 1 4) u ((stageBPriority (shape 3 1 4)) 2) a : ℝ))) := by + exact contains_sound (singletonBall_sound (below (shape 3 1 4)) B3_1_4Law (fun u => (stageBLaw (shape 3 1 4) u : ℝ)) (stageBPriority (shape 3 1 4)) 2 + CB3_1_4I2Singles (fun u a => (littleLaw (shape 3 1 4) u ((stageBPriority (shape 3 1 4)) 2) a : ℝ)) (fun u _ => B3_1_4Law_sound u) CB3_1_4I2Singles_sound) (by decide +kernel) +def CB3_1_4I2Group : Ball := ⟨(3483315209901677304871843283757 / 25000000000000000000000000000000), (44002426931 / 50000000000000000000000000000000)⟩ +lemma CB3_1_4I2Group_sound : CB3_1_4I2Group.Encloses + (groupedEntropy (below (shape 3 1 4)) (fun u => (stageBLaw (shape 3 1 4) u : ℝ)) (stageBPriority (shape 3 1 4)) 2 (fun u a => (littleLaw (shape 3 1 4) u ((stageBPriority (shape 3 1 4)) 2) a : ℝ))) := by + exact contains_sound (Ball.add_sound CB3_1_4I2Singleton_sound + (finSumBall_sound 17 CB3_1_4I2ResidualEntropies _ CB3_1_4I2ResidualEntropies_sound)) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CB3_1_4I2H : Ball := ⟨(2346221401130937570320828248623 / 4000000000000000000000000000000), (256333161557 / 100000000000000000000000000000000)⟩ +lemma CB3_1_4I2_sound : CB3_1_4I2H.Encloses (stageBCapacity (shape 3 1 4) 2) := by + have hb := contains_sound (Ball.add_sound CB3_1_4I2PairH_sound + (Ball.neg_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) CB3_1_4I2Group_sound))) + (show contains (.add CB3_1_4I2PairH (.neg (.mul (.exact 2) CB3_1_4I2Group))) CB3_1_4I2H = true by decide +kernel) + simp only [stageBCapacity, nativeCapacity, + show (2 : Fin 3) ≠ 0 by decide, ite_false, sub_eq_add_neg] + exact hb + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/CapacityB/CapB3_2_3I0.lean b/lean/OAI/LinearAlgebra/MatrixFields/CapacityB/CapB3_2_3I0.lean new file mode 100644 index 0000000000000000000000000000000000000000..e6dab842582e4d6e3cf7cbbfd923762b58387401 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/CapacityB/CapB3_2_3I0.lean @@ -0,0 +1,75 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Certificates.SplitB5_1_2 + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CB3_2_3I0Value (a : Fin 17) : ℝ := marginal (below (shape 3 2 3)) (fun u => (stageBLaw (shape 3 2 3) u : ℝ)) ((stageBPriority (shape 3 2 3)) 0) a +def CB3_2_3I0Raw (a : Fin 17) : Ball := marginalBall (below (shape 3 2 3)) B3_2_3Law ((stageBPriority (shape 3 2 3)) 0) a +lemma CB3_2_3I0Raw_sound (a : Fin 17) : + (CB3_2_3I0Raw a).Encloses (CB3_2_3I0Value a) := by + exact marginalBall_sound (below (shape 3 2 3)) B3_2_3Law (fun u => (stageBLaw (shape 3 2 3) u : ℝ)) (fun u _ => B3_2_3Law_sound u) ((stageBPriority (shape 3 2 3)) 0) a +def CB3_2_3I0Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(660954401694675365284077503627 / 50000000000000000000000000000000), (1 / 20000000000000000000000000000000)⟩ ⟨(5718700990404566998542725209219 / 100000000000000000000000000000000), (2239400647 / 100000000000000000000000000000000)⟩ ⟨(-86521868615171017372683118901063 / 20000000000000000000000000000000), (84703294921 / 50000000000000000000000000000000)⟩ ⟨-7, 660954401694675365284077503627, 390625000000000000000000000000⟩, + .log ⟨(24339045598305324634715922496373 / 50000000000000000000000000000000), (53 / 100000000000000000000000000000000)⟩ ⟨(8761339994149058187289105091327 / 25000000000000000000000000000000), (483186881 / 1562500000000000000000000000000)⟩ ⟨(-71994112988219155445620039600637 / 100000000000000000000000000000000), (31763735579 / 50000000000000000000000000000000)⟩ ⟨-2, 24339045598305324634715922496373, 12500000000000000000000000000000⟩] +lemma CB3_2_3I0Certificates_valid : + CB3_2_3I0Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB3_2_3I0CertificateIndex (a : Fin 17) : ℕ := + match a.val with + | 0 => 1 + | 1 => 2 + | 2 => 2 + | 3 => 1 + | _ => 0 +def CB3_2_3I0P (a : Fin 17) : Ball := + (CompactCertificate.entropyLookup CB3_2_3I0Certificates (CB3_2_3I0CertificateIndex a)).input +lemma CB3_2_3I0P_check : ∀ a : Fin 17, contains (CB3_2_3I0Raw a) (CB3_2_3I0P a) = true := by + decide +kernel +lemma CB3_2_3I0P_sound (a : Fin 17) : + (CB3_2_3I0P a).Encloses (CB3_2_3I0Value a) := + contains_sound (CB3_2_3I0Raw_sound a) (CB3_2_3I0P_check a) +def CB3_2_3I0Terms (a : Fin 17) : Ball := + (CompactCertificate.entropyLookup CB3_2_3I0Certificates (CB3_2_3I0CertificateIndex a)).output +lemma CB3_2_3I0Terms_sound (a : Fin 17) : + (CB3_2_3I0Terms a).Encloses (Foundation.entropyTerm (CB3_2_3I0Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB3_2_3I0Certificates_valid + (CB3_2_3I0CertificateIndex a) (CB3_2_3I0P_sound a) +def CB3_2_3I0Entropy : Ball := ⟨(40764060967000799747699145574527 / 50000000000000000000000000000000), (33163361031 / 50000000000000000000000000000000)⟩ +lemma CB3_2_3I0Entropy_sound : CB3_2_3I0Entropy.Encloses (Foundation.finiteEntropy CB3_2_3I0Value) := by + exact contains_sound (entropyFin_enclosed 17 CB3_2_3I0Value CB3_2_3I0Terms CB3_2_3I0Terms_sound) (by decide +kernel) +def CB3_2_3I0Mass : Ball := ⟨1, (29 / 25000000000000000000000000000000)⟩ +lemma CB3_2_3I0Mass_sound : CB3_2_3I0Mass.Encloses (∑ a, CB3_2_3I0Value a) := by + exact contains_sound (finSumBall_sound 17 CB3_2_3I0P CB3_2_3I0Value CB3_2_3I0P_sound) (by decide +kernel) +def CB3_2_3I0MassTermLogWitness : LogWitness := ⟨0, 1, 1⟩ +def CB3_2_3I0MassTermLog : Ball := ⟨0, (10587911899 / 50000000000000000000000000000000)⟩ +lemma CB3_2_3I0MassTermLog_sound : CB3_2_3I0MassTermLog.Encloses (Real.log ((∑ a, CB3_2_3I0Value a))) := by + exact checkLog_sound logTwoBall_sound (CB3_2_3I0Mass_sound) (w := CB3_2_3I0MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB3_2_3I0MassTerm : Ball := ⟨0, (21175823799 / 100000000000000000000000000000000)⟩ +lemma CB3_2_3I0MassTerm_sound : CB3_2_3I0MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB3_2_3I0Value a))) := by + exact contains_sound (entropyTerm_ball (CB3_2_3I0Mass_sound) CB3_2_3I0MassTermLog_sound) (by decide +kernel) +def CB3_2_3I0H : Ball := ⟨(40764060967000799747699145574527 / 50000000000000000000000000000000), (87502545861 / 100000000000000000000000000000000)⟩ +lemma CB3_2_3I0H_sound : CB3_2_3I0H.Encloses (homogeneousEntropy CB3_2_3I0Value) := by + exact contains_sound (homogeneous_enclosed CB3_2_3I0Value CB3_2_3I0MassTerm_sound CB3_2_3I0Entropy_sound) (by decide +kernel) +lemma CB3_2_3I0_sound : CB3_2_3I0H.Encloses (stageBCapacity (shape 3 2 3) 0) := by + exact CB3_2_3I0H_sound + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/CapacityB/CapB3_2_3I1.lean b/lean/OAI/LinearAlgebra/MatrixFields/CapacityB/CapB3_2_3I1.lean new file mode 100644 index 0000000000000000000000000000000000000000..91d144bdf07d3d4de1279f7e5719c8dac61f8cf8 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/CapacityB/CapB3_2_3I1.lean @@ -0,0 +1,930 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Certificates.SupportedContraction + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CB3_2_3I1PairValue (a : PairSlot) : ℝ := pairLaw (below (shape 3 2 3)) (shape 3 2 3) (fun u => (stageBLaw (shape 3 2 3) u : ℝ)) (fun u a => (littleLaw (shape 3 2 3) u ((stageBPriority (shape 3 2 3)) 1) a : ℝ)) a +def CB3_2_3I1PairRaw (a : PairSlot) : Ball := pairLawBall (below (shape 3 2 3)) (shape 3 2 3) B3_2_3Law (fun u => B3_2_3Little u ((stageBPriority (shape 3 2 3)) 1)) a +lemma CB3_2_3I1PairRaw_sound (a : PairSlot) : + (CB3_2_3I1PairRaw a).Encloses (CB3_2_3I1PairValue a) := by + exact pairLawBall_sound_on (below (shape 3 2 3)) (shape 3 2 3) B3_2_3Law (fun u => (stageBLaw (shape 3 2 3) u : ℝ)) (fun u => B3_2_3Little u ((stageBPriority (shape 3 2 3)) 1)) (fun u a => (littleLaw (shape 3 2 3) u ((stageBPriority (shape 3 2 3)) 1) a : ℝ)) (fun u _ => B3_2_3Law_sound u) (fun u _ a => B3_2_3Little_sound u ((stageBPriority (shape 3 2 3)) 1) a) (fun u _ a => B3_2_3Little_sound (complement (shape 3 2 3) u) ((stageBPriority (shape 3 2 3)) 1) a) a +def CB3_2_3I1PairCertificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(7877790787272644406002286888011 / 12500000000000000000000000000000), (19 / 50000000000000000000000000000000)⟩ ⟨(29096219242250260539924793114627 / 100000000000000000000000000000000), (6672748363 / 25000000000000000000000000000000)⟩ ⟨(-23084056834545939993716178416747 / 50000000000000000000000000000000), (21175823713 / 50000000000000000000000000000000)⟩ ⟨-1, 7877790787272644406002286888011, 6250000000000000000000000000000⟩, + .log ⟨(8810343598851601529271500513163 / 50000000000000000000000000000000), (19 / 50000000000000000000000000000000)⟩ ⟨(30591214521027938277171173564403 / 100000000000000000000000000000000), (2985060543 / 20000000000000000000000000000000)⟩ ⟨(-86804828261792762424949258480639 / 50000000000000000000000000000000), (84703294947 / 100000000000000000000000000000000)⟩ ⟨-3, 8810343598851601529271500513163, 6250000000000000000000000000000⟩, + .log ⟨(86814965320621931744785142163 / 10000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ ⟨(4120725593087330713512283586423 / 100000000000000000000000000000000), (1470702737 / 100000000000000000000000000000000)⟩ ⟨(-474656135364313515533899147094047 / 100000000000000000000000000000000), (169406589809 / 100000000000000000000000000000000)⟩ ⟨-7, 86814965320621931744785142163, 78125000000000000000000000000⟩] +lemma CB3_2_3I1PairCertificates_valid : + CB3_2_3I1PairCertificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB3_2_3I1PairCertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 1, 1 => 1 + | 2, 0 => 2 + | 3, 0 => 3 + | 0, 2 => 2 + | 0, 3 => 3 + | _, _ => 0 +def CB3_2_3I1PairP (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CB3_2_3I1PairCertificates (CB3_2_3I1PairCertificateIndex a)).input +lemma CB3_2_3I1PairP_check : ∀ a : PairSlot, contains (CB3_2_3I1PairRaw a) (CB3_2_3I1PairP a) = true := by + decide +kernel +lemma CB3_2_3I1PairP_sound (a : PairSlot) : + (CB3_2_3I1PairP a).Encloses (CB3_2_3I1PairValue a) := + contains_sound (CB3_2_3I1PairRaw_sound a) (CB3_2_3I1PairP_check a) +def CB3_2_3I1PairTerms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CB3_2_3I1PairCertificates (CB3_2_3I1PairCertificateIndex a)).output +lemma CB3_2_3I1PairTerms_sound (a : PairSlot) : + (CB3_2_3I1PairTerms a).Encloses (Foundation.entropyTerm (CB3_2_3I1PairValue a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB3_2_3I1PairCertificates_valid + (CB3_2_3I1PairCertificateIndex a) (CB3_2_3I1PairP_sound a) +def CB3_2_3I1PairEntropy : Ball := ⟨(98520099470480798521291707416279 / 100000000000000000000000000000000), (14870751089 / 25000000000000000000000000000000)⟩ +lemma CB3_2_3I1PairEntropy_sound : CB3_2_3I1PairEntropy.Encloses (Foundation.finiteEntropy CB3_2_3I1PairValue) := by + exact contains_sound (entropyPair_enclosed CB3_2_3I1PairValue CB3_2_3I1PairTerms CB3_2_3I1PairTerms_sound) (by decide +kernel) +def CB3_2_3I1PairMass : Ball := ⟨1, (3 / 2500000000000000000000000000000)⟩ +lemma CB3_2_3I1PairMass_sound : CB3_2_3I1PairMass.Encloses (∑ a, CB3_2_3I1PairValue a) := by + exact contains_sound (pairSumBall_sound CB3_2_3I1PairP CB3_2_3I1PairValue CB3_2_3I1PairP_sound) (by decide +kernel) +def CB3_2_3I1PairMassTermLogWitness : LogWitness := ⟨0, 1, 1⟩ +def CB3_2_3I1PairMassTermLog : Ball := ⟨0, (10587911901 / 50000000000000000000000000000000)⟩ +lemma CB3_2_3I1PairMassTermLog_sound : CB3_2_3I1PairMassTermLog.Encloses (Real.log ((∑ a, CB3_2_3I1PairValue a))) := by + exact checkLog_sound logTwoBall_sound (CB3_2_3I1PairMass_sound) (w := CB3_2_3I1PairMassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB3_2_3I1PairMassTerm : Ball := ⟨0, (21175823803 / 100000000000000000000000000000000)⟩ +lemma CB3_2_3I1PairMassTerm_sound : CB3_2_3I1PairMassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB3_2_3I1PairValue a))) := by + exact contains_sound (entropyTerm_ball (CB3_2_3I1PairMass_sound) CB3_2_3I1PairMassTermLog_sound) (by decide +kernel) +def CB3_2_3I1PairH : Ball := ⟨(98520099470480798521291707416279 / 100000000000000000000000000000000), (80658828159 / 100000000000000000000000000000000)⟩ +lemma CB3_2_3I1PairH_sound : CB3_2_3I1PairH.Encloses (homogeneousEntropy CB3_2_3I1PairValue) := by + exact contains_sound (homogeneous_enclosed CB3_2_3I1PairValue CB3_2_3I1PairMassTerm_sound CB3_2_3I1PairEntropy_sound) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CB3_2_3I1R0Value (a : Fin 6) : ℝ := residualLaw (below (shape 3 2 3)) (fun u => (stageBLaw (shape 3 2 3) u : ℝ)) (stageBPriority (shape 3 2 3)) 1 (fun u a => (littleLaw (shape 3 2 3) u ((stageBPriority (shape 3 2 3)) 1) a : ℝ)) 0 a +def CB3_2_3I1R0Raw (a : Fin 6) : Ball := residualBall (below (shape 3 2 3)) B3_2_3Law (stageBPriority (shape 3 2 3)) 1 (fun u => B3_2_3Little u ((stageBPriority (shape 3 2 3)) 1)) 0 a +lemma CB3_2_3I1R0Raw_sound (a : Fin 6) : + (CB3_2_3I1R0Raw a).Encloses (CB3_2_3I1R0Value a) := by + exact residualBall_sound_on (below (shape 3 2 3)) B3_2_3Law (fun u => (stageBLaw (shape 3 2 3) u : ℝ)) (stageBPriority (shape 3 2 3)) 1 (fun u => B3_2_3Little u ((stageBPriority (shape 3 2 3)) 1)) (fun u a => (littleLaw (shape 3 2 3) u ((stageBPriority (shape 3 2 3)) 1) a : ℝ)) (fun u _ => B3_2_3Law_sound u) (fun u _ a => B3_2_3Little_sound u ((stageBPriority (shape 3 2 3)) 1) a) 0 a +def CB3_2_3I1R0Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(4622209212727355593997713111989 / 25000000000000000000000000000000), (39 / 100000000000000000000000000000000)⟩ ⟨(31209212985956947397911481005053 / 100000000000000000000000000000000), (3915163519 / 25000000000000000000000000000000)⟩ ⟨(-84400152474767063710553601532469 / 50000000000000000000000000000000), (42351647471 / 50000000000000000000000000000000)⟩ ⟨-3, 4622209212727355593997713111989, 3125000000000000000000000000000⟩] +lemma CB3_2_3I1R0Certificates_valid : + CB3_2_3I1R0Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB3_2_3I1R0CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | 0 => 1 + | _ => 0 +def CB3_2_3I1R0P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_2_3I1R0Certificates (CB3_2_3I1R0CertificateIndex a)).input +lemma CB3_2_3I1R0P_check : ∀ a : Fin 6, contains (CB3_2_3I1R0Raw a) (CB3_2_3I1R0P a) = true := by + decide +kernel +lemma CB3_2_3I1R0P_sound (a : Fin 6) : + (CB3_2_3I1R0P a).Encloses (CB3_2_3I1R0Value a) := + contains_sound (CB3_2_3I1R0Raw_sound a) (CB3_2_3I1R0P_check a) +def CB3_2_3I1R0Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_2_3I1R0Certificates (CB3_2_3I1R0CertificateIndex a)).output +lemma CB3_2_3I1R0Terms_sound (a : Fin 6) : + (CB3_2_3I1R0Terms a).Encloses (Foundation.entropyTerm (CB3_2_3I1R0Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB3_2_3I1R0Certificates_valid + (CB3_2_3I1R0CertificateIndex a) (CB3_2_3I1R0P_sound a) +def CB3_2_3I1R0Entropy : Ball := ⟨(31209212985956947397911481005053 / 100000000000000000000000000000000), (3915163519 / 25000000000000000000000000000000)⟩ +lemma CB3_2_3I1R0Entropy_sound : CB3_2_3I1R0Entropy.Encloses (Foundation.finiteEntropy CB3_2_3I1R0Value) := by + exact contains_sound (entropyFin_enclosed 6 CB3_2_3I1R0Value CB3_2_3I1R0Terms CB3_2_3I1R0Terms_sound) (by decide +kernel) +def CB3_2_3I1R0Mass : Ball := ⟨(4622209212727355593997713111989 / 25000000000000000000000000000000), (39 / 100000000000000000000000000000000)⟩ +lemma CB3_2_3I1R0Mass_sound : CB3_2_3I1R0Mass.Encloses (∑ a, CB3_2_3I1R0Value a) := by + exact contains_sound (finSumBall_sound 6 CB3_2_3I1R0P CB3_2_3I1R0Value CB3_2_3I1R0P_sound) (by decide +kernel) +def CB3_2_3I1R0MassTermLogWitness : LogWitness := ⟨-3, 4622209212727355593997713111989, 3125000000000000000000000000000⟩ +def CB3_2_3I1R0MassTermLog : Ball := ⟨(-84400152474767063710553601532469 / 50000000000000000000000000000000), (42351647471 / 50000000000000000000000000000000)⟩ +lemma CB3_2_3I1R0MassTermLog_sound : CB3_2_3I1R0MassTermLog.Encloses (Real.log ((∑ a, CB3_2_3I1R0Value a))) := by + exact checkLog_sound logTwoBall_sound (CB3_2_3I1R0Mass_sound) (w := CB3_2_3I1R0MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB3_2_3I1R0MassTerm : Ball := ⟨(31209212985956947397911481005053 / 100000000000000000000000000000000), (3915163519 / 25000000000000000000000000000000)⟩ +lemma CB3_2_3I1R0MassTerm_sound : CB3_2_3I1R0MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB3_2_3I1R0Value a))) := by + exact contains_sound (entropyTerm_ball (CB3_2_3I1R0Mass_sound) CB3_2_3I1R0MassTermLog_sound) (by decide +kernel) +def CB3_2_3I1R0H : Ball := ⟨0, (3915163519 / 12500000000000000000000000000000)⟩ +lemma CB3_2_3I1R0H_sound : CB3_2_3I1R0H.Encloses (homogeneousEntropy CB3_2_3I1R0Value) := by + exact contains_sound (homogeneous_enclosed CB3_2_3I1R0Value CB3_2_3I1R0MassTerm_sound CB3_2_3I1R0Entropy_sound) (by decide +kernel) +def CB3_2_3I1R1Value (a : Fin 6) : ℝ := residualLaw (below (shape 3 2 3)) (fun u => (stageBLaw (shape 3 2 3) u : ℝ)) (stageBPriority (shape 3 2 3)) 1 (fun u a => (littleLaw (shape 3 2 3) u ((stageBPriority (shape 3 2 3)) 1) a : ℝ)) 1 a +def CB3_2_3I1R1Raw (a : Fin 6) : Ball := residualBall (below (shape 3 2 3)) B3_2_3Law (stageBPriority (shape 3 2 3)) 1 (fun u => B3_2_3Little u ((stageBPriority (shape 3 2 3)) 1)) 1 a +lemma CB3_2_3I1R1Raw_sound (a : Fin 6) : + (CB3_2_3I1R1Raw a).Encloses (CB3_2_3I1R1Value a) := by + exact residualBall_sound_on (below (shape 3 2 3)) B3_2_3Law (fun u => (stageBLaw (shape 3 2 3) u : ℝ)) (stageBPriority (shape 3 2 3)) 1 (fun u => B3_2_3Little u ((stageBPriority (shape 3 2 3)) 1)) (fun u a => (littleLaw (shape 3 2 3) u ((stageBPriority (shape 3 2 3)) 1) a : ℝ)) (fun u _ => B3_2_3Law_sound u) (fun u _ a => B3_2_3Little_sound u ((stageBPriority (shape 3 2 3)) 1) a) 1 a +def CB3_2_3I1R1Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(62861587115248395273289176036939 / 100000000000000000000000000000000), (37 / 100000000000000000000000000000000)⟩ ⟨(14591271509207952834805282866537 / 50000000000000000000000000000000), (13311458879 / 50000000000000000000000000000000)⟩ ⟨(-46423490652429086244419251190089 / 100000000000000000000000000000000), (661744491 / 1562500000000000000000000000000)⟩ ⟨-1, 62861587115248395273289176036939, 50000000000000000000000000000000⟩] +lemma CB3_2_3I1R1Certificates_valid : + CB3_2_3I1R1Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB3_2_3I1R1CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | 1 => 1 + | _ => 0 +def CB3_2_3I1R1P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_2_3I1R1Certificates (CB3_2_3I1R1CertificateIndex a)).input +lemma CB3_2_3I1R1P_check : ∀ a : Fin 6, contains (CB3_2_3I1R1Raw a) (CB3_2_3I1R1P a) = true := by + decide +kernel +lemma CB3_2_3I1R1P_sound (a : Fin 6) : + (CB3_2_3I1R1P a).Encloses (CB3_2_3I1R1Value a) := + contains_sound (CB3_2_3I1R1Raw_sound a) (CB3_2_3I1R1P_check a) +def CB3_2_3I1R1Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_2_3I1R1Certificates (CB3_2_3I1R1CertificateIndex a)).output +lemma CB3_2_3I1R1Terms_sound (a : Fin 6) : + (CB3_2_3I1R1Terms a).Encloses (Foundation.entropyTerm (CB3_2_3I1R1Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB3_2_3I1R1Certificates_valid + (CB3_2_3I1R1CertificateIndex a) (CB3_2_3I1R1P_sound a) +def CB3_2_3I1R1Entropy : Ball := ⟨(14591271509207952834805282866537 / 50000000000000000000000000000000), (13311458879 / 50000000000000000000000000000000)⟩ +lemma CB3_2_3I1R1Entropy_sound : CB3_2_3I1R1Entropy.Encloses (Foundation.finiteEntropy CB3_2_3I1R1Value) := by + exact contains_sound (entropyFin_enclosed 6 CB3_2_3I1R1Value CB3_2_3I1R1Terms CB3_2_3I1R1Terms_sound) (by decide +kernel) +def CB3_2_3I1R1Mass : Ball := ⟨(62861587115248395273289176036939 / 100000000000000000000000000000000), (37 / 100000000000000000000000000000000)⟩ +lemma CB3_2_3I1R1Mass_sound : CB3_2_3I1R1Mass.Encloses (∑ a, CB3_2_3I1R1Value a) := by + exact contains_sound (finSumBall_sound 6 CB3_2_3I1R1P CB3_2_3I1R1Value CB3_2_3I1R1P_sound) (by decide +kernel) +def CB3_2_3I1R1MassTermLogWitness : LogWitness := ⟨-1, 62861587115248395273289176036939, 50000000000000000000000000000000⟩ +def CB3_2_3I1R1MassTermLog : Ball := ⟨(-46423490652429086244419251190089 / 100000000000000000000000000000000), (661744491 / 1562500000000000000000000000000)⟩ +lemma CB3_2_3I1R1MassTermLog_sound : CB3_2_3I1R1MassTermLog.Encloses (Real.log ((∑ a, CB3_2_3I1R1Value a))) := by + exact checkLog_sound logTwoBall_sound (CB3_2_3I1R1Mass_sound) (w := CB3_2_3I1R1MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB3_2_3I1R1MassTerm : Ball := ⟨(14591271509207952834805282866537 / 50000000000000000000000000000000), (13311458879 / 50000000000000000000000000000000)⟩ +lemma CB3_2_3I1R1MassTerm_sound : CB3_2_3I1R1MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB3_2_3I1R1Value a))) := by + exact contains_sound (entropyTerm_ball (CB3_2_3I1R1Mass_sound) CB3_2_3I1R1MassTermLog_sound) (by decide +kernel) +def CB3_2_3I1R1H : Ball := ⟨0, (13311458879 / 25000000000000000000000000000000)⟩ +lemma CB3_2_3I1R1H_sound : CB3_2_3I1R1H.Encloses (homogeneousEntropy CB3_2_3I1R1Value) := by + exact contains_sound (homogeneous_enclosed CB3_2_3I1R1Value CB3_2_3I1R1MassTerm_sound CB3_2_3I1R1Entropy_sound) (by decide +kernel) +def CB3_2_3I1R2Value (a : Fin 6) : ℝ := residualLaw (below (shape 3 2 3)) (fun u => (stageBLaw (shape 3 2 3) u : ℝ)) (stageBPriority (shape 3 2 3)) 1 (fun u a => (littleLaw (shape 3 2 3) u ((stageBPriority (shape 3 2 3)) 1) a : ℝ)) 2 a +def CB3_2_3I1R2Raw (a : Fin 6) : Ball := residualBall (below (shape 3 2 3)) B3_2_3Law (stageBPriority (shape 3 2 3)) 1 (fun u => B3_2_3Little u ((stageBPriority (shape 3 2 3)) 1)) 2 a +lemma CB3_2_3I1R2Raw_sound (a : Fin 6) : + (CB3_2_3I1R2Raw a).Encloses (CB3_2_3I1R2Value a) := by + exact residualBall_sound_on (below (shape 3 2 3)) B3_2_3Law (fun u => (stageBLaw (shape 3 2 3) u : ℝ)) (stageBPriority (shape 3 2 3)) 1 (fun u => B3_2_3Little u ((stageBPriority (shape 3 2 3)) 1)) (fun u a => (littleLaw (shape 3 2 3) u ((stageBPriority (shape 3 2 3)) 1) a : ℝ)) (fun u _ => B3_2_3Law_sound u) (fun u _ a => B3_2_3Little_sound u ((stageBPriority (shape 3 2 3)) 1) a) 2 a +def CB3_2_3I1R2Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(8292001037702510443718443883251 / 50000000000000000000000000000000), (33 / 100000000000000000000000000000000)⟩ ⟨(7449250501188492770577657387111 / 25000000000000000000000000000000), (14047196249 / 100000000000000000000000000000000)⟩ ⟨(-89836584285480008963634165386603 / 50000000000000000000000000000000), (8470329493 / 10000000000000000000000000000000)⟩ ⟨-3, 8292001037702510443718443883251, 6250000000000000000000000000000⟩, + .log ⟨(749918571577850432764580593809 / 100000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ ⟨(3669322200592286143146381383681 / 100000000000000000000000000000000), (1429212923 / 100000000000000000000000000000000)⟩ ⟨(-489296083556368762978102141460269 / 100000000000000000000000000000000), (95291206707 / 50000000000000000000000000000000)⟩ ⟨-8, 749918571577850432764580593809, 390625000000000000000000000000⟩] +lemma CB3_2_3I1R2Certificates_valid : + CB3_2_3I1R2Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB3_2_3I1R2CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | 2 => 1 + | 3 => 2 + | _ => 0 +def CB3_2_3I1R2P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_2_3I1R2Certificates (CB3_2_3I1R2CertificateIndex a)).input +lemma CB3_2_3I1R2P_check : ∀ a : Fin 6, contains (CB3_2_3I1R2Raw a) (CB3_2_3I1R2P a) = true := by + decide +kernel +lemma CB3_2_3I1R2P_sound (a : Fin 6) : + (CB3_2_3I1R2P a).Encloses (CB3_2_3I1R2Value a) := + contains_sound (CB3_2_3I1R2Raw_sound a) (CB3_2_3I1R2P_check a) +def CB3_2_3I1R2Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_2_3I1R2Certificates (CB3_2_3I1R2CertificateIndex a)).output +lemma CB3_2_3I1R2Terms_sound (a : Fin 6) : + (CB3_2_3I1R2Terms a).Encloses (Foundation.entropyTerm (CB3_2_3I1R2Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB3_2_3I1R2Certificates_valid + (CB3_2_3I1R2CertificateIndex a) (CB3_2_3I1R2P_sound a) +def CB3_2_3I1R2Entropy : Ball := ⟨(267730593642770057803656087457 / 800000000000000000000000000000), (3869102293 / 25000000000000000000000000000000)⟩ +lemma CB3_2_3I1R2Entropy_sound : CB3_2_3I1R2Entropy.Encloses (Foundation.finiteEntropy CB3_2_3I1R2Value) := by + exact contains_sound (entropyFin_enclosed 6 CB3_2_3I1R2Value CB3_2_3I1R2Terms CB3_2_3I1R2Terms_sound) (by decide +kernel) +def CB3_2_3I1R2Mass : Ball := ⟨(17333920646982871320201468360311 / 100000000000000000000000000000000), (7 / 20000000000000000000000000000000)⟩ +lemma CB3_2_3I1R2Mass_sound : CB3_2_3I1R2Mass.Encloses (∑ a, CB3_2_3I1R2Value a) := by + exact contains_sound (finSumBall_sound 6 CB3_2_3I1R2P CB3_2_3I1R2Value CB3_2_3I1R2P_sound) (by decide +kernel) +def CB3_2_3I1R2MassTermLogWitness : LogWitness := ⟨-3, 17333920646982871320201468360311, 12500000000000000000000000000000⟩ +def CB3_2_3I1R2MassTermLog : Ball := ⟨(-175250487316902480110780974093599 / 100000000000000000000000000000000), (84703294933 / 100000000000000000000000000000000)⟩ +lemma CB3_2_3I1R2MassTermLog_sound : CB3_2_3I1R2MassTermLog.Encloses (Real.log ((∑ a, CB3_2_3I1R2Value a))) := by + exact checkLog_sound logTwoBall_sound (CB3_2_3I1R2Mass_sound) (w := CB3_2_3I1R2MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB3_2_3I1R2MassTerm : Ball := ⟨(15188890202481328612979926606431 / 50000000000000000000000000000000), (14682401991 / 100000000000000000000000000000000)⟩ +lemma CB3_2_3I1R2MassTerm_sound : CB3_2_3I1R2MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB3_2_3I1R2Value a))) := by + exact contains_sound (entropyTerm_ball (CB3_2_3I1R2Mass_sound) CB3_2_3I1R2MassTermLog_sound) (by decide +kernel) +def CB3_2_3I1R2H : Ball := ⟨(3088543800383599999497157719263 / 100000000000000000000000000000000), (30158811163 / 100000000000000000000000000000000)⟩ +lemma CB3_2_3I1R2H_sound : CB3_2_3I1R2H.Encloses (homogeneousEntropy CB3_2_3I1R2Value) := by + exact contains_sound (homogeneous_enclosed CB3_2_3I1R2Value CB3_2_3I1R2MassTerm_sound CB3_2_3I1R2Entropy_sound) (by decide +kernel) +def CB3_2_3I1R3Value (a : Fin 6) : ℝ := residualLaw (below (shape 3 2 3)) (fun u => (stageBLaw (shape 3 2 3) u : ℝ)) (stageBPriority (shape 3 2 3)) 1 (fun u a => (littleLaw (shape 3 2 3) u ((stageBPriority (shape 3 2 3)) 1) a : ℝ)) 3 a +def CB3_2_3I1R3Raw (a : Fin 6) : Ball := residualBall (below (shape 3 2 3)) B3_2_3Law (stageBPriority (shape 3 2 3)) 1 (fun u => B3_2_3Little u ((stageBPriority (shape 3 2 3)) 1)) 3 a +lemma CB3_2_3I1R3Raw_sound (a : Fin 6) : + (CB3_2_3I1R3Raw a).Encloses (CB3_2_3I1R3Value a) := by + exact residualBall_sound_on (below (shape 3 2 3)) B3_2_3Law (fun u => (stageBLaw (shape 3 2 3) u : ℝ)) (stageBPriority (shape 3 2 3)) 1 (fun u => B3_2_3Little u ((stageBPriority (shape 3 2 3)) 1)) (fun u a => (littleLaw (shape 3 2 3) u ((stageBPriority (shape 3 2 3)) 1) a : ℝ)) (fun u _ => B3_2_3Law_sound u) (fun u _ a => B3_2_3Little_sound u ((stageBPriority (shape 3 2 3)) 1) a) 3 a +def CB3_2_3I1R3Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB3_2_3I1R3Certificates_valid : + CB3_2_3I1R3Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB3_2_3I1R3CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB3_2_3I1R3P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_2_3I1R3Certificates (CB3_2_3I1R3CertificateIndex a)).input +lemma CB3_2_3I1R3P_check : ∀ a : Fin 6, contains (CB3_2_3I1R3Raw a) (CB3_2_3I1R3P a) = true := by + decide +kernel +lemma CB3_2_3I1R3P_sound (a : Fin 6) : + (CB3_2_3I1R3P a).Encloses (CB3_2_3I1R3Value a) := + contains_sound (CB3_2_3I1R3Raw_sound a) (CB3_2_3I1R3P_check a) +def CB3_2_3I1R3Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_2_3I1R3Certificates (CB3_2_3I1R3CertificateIndex a)).output +lemma CB3_2_3I1R3Terms_sound (a : Fin 6) : + (CB3_2_3I1R3Terms a).Encloses (Foundation.entropyTerm (CB3_2_3I1R3Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB3_2_3I1R3Certificates_valid + (CB3_2_3I1R3CertificateIndex a) (CB3_2_3I1R3P_sound a) +def CB3_2_3I1R3Entropy : Ball := ⟨0, 0⟩ +lemma CB3_2_3I1R3Entropy_sound : CB3_2_3I1R3Entropy.Encloses (Foundation.finiteEntropy CB3_2_3I1R3Value) := by + exact contains_sound (entropyFin_enclosed 6 CB3_2_3I1R3Value CB3_2_3I1R3Terms CB3_2_3I1R3Terms_sound) (by decide +kernel) +def CB3_2_3I1R3Mass : Ball := ⟨0, 0⟩ +lemma CB3_2_3I1R3Mass_sound : CB3_2_3I1R3Mass.Encloses (∑ a, CB3_2_3I1R3Value a) := by + exact contains_sound (finSumBall_sound 6 CB3_2_3I1R3P CB3_2_3I1R3Value CB3_2_3I1R3P_sound) (by decide +kernel) +def CB3_2_3I1R3MassTerm : Ball := .exact 0 +lemma CB3_2_3I1R3MassTerm_sound : CB3_2_3I1R3MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB3_2_3I1R3Value a))) := + entropyTerm_zero_ball (CB3_2_3I1R3Mass_sound) +def CB3_2_3I1R3H : Ball := ⟨0, 0⟩ +lemma CB3_2_3I1R3H_sound : CB3_2_3I1R3H.Encloses (homogeneousEntropy CB3_2_3I1R3Value) := by + exact contains_sound (homogeneous_enclosed CB3_2_3I1R3Value CB3_2_3I1R3MassTerm_sound CB3_2_3I1R3Entropy_sound) (by decide +kernel) +def CB3_2_3I1R4Value (a : Fin 6) : ℝ := residualLaw (below (shape 3 2 3)) (fun u => (stageBLaw (shape 3 2 3) u : ℝ)) (stageBPriority (shape 3 2 3)) 1 (fun u a => (littleLaw (shape 3 2 3) u ((stageBPriority (shape 3 2 3)) 1) a : ℝ)) 4 a +def CB3_2_3I1R4Raw (a : Fin 6) : Ball := residualBall (below (shape 3 2 3)) B3_2_3Law (stageBPriority (shape 3 2 3)) 1 (fun u => B3_2_3Little u ((stageBPriority (shape 3 2 3)) 1)) 4 a +lemma CB3_2_3I1R4Raw_sound (a : Fin 6) : + (CB3_2_3I1R4Raw a).Encloses (CB3_2_3I1R4Value a) := by + exact residualBall_sound_on (below (shape 3 2 3)) B3_2_3Law (fun u => (stageBLaw (shape 3 2 3) u : ℝ)) (stageBPriority (shape 3 2 3)) 1 (fun u => B3_2_3Little u ((stageBPriority (shape 3 2 3)) 1)) (fun u a => (littleLaw (shape 3 2 3) u ((stageBPriority (shape 3 2 3)) 1) a : ℝ)) (fun u _ => B3_2_3Law_sound u) (fun u _ a => B3_2_3Little_sound u ((stageBPriority (shape 3 2 3)) 1) a) 4 a +def CB3_2_3I1R4Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB3_2_3I1R4Certificates_valid : + CB3_2_3I1R4Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB3_2_3I1R4CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB3_2_3I1R4P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_2_3I1R4Certificates (CB3_2_3I1R4CertificateIndex a)).input +lemma CB3_2_3I1R4P_check : ∀ a : Fin 6, contains (CB3_2_3I1R4Raw a) (CB3_2_3I1R4P a) = true := by + decide +kernel +lemma CB3_2_3I1R4P_sound (a : Fin 6) : + (CB3_2_3I1R4P a).Encloses (CB3_2_3I1R4Value a) := + contains_sound (CB3_2_3I1R4Raw_sound a) (CB3_2_3I1R4P_check a) +def CB3_2_3I1R4Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_2_3I1R4Certificates (CB3_2_3I1R4CertificateIndex a)).output +lemma CB3_2_3I1R4Terms_sound (a : Fin 6) : + (CB3_2_3I1R4Terms a).Encloses (Foundation.entropyTerm (CB3_2_3I1R4Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB3_2_3I1R4Certificates_valid + (CB3_2_3I1R4CertificateIndex a) (CB3_2_3I1R4P_sound a) +def CB3_2_3I1R4Entropy : Ball := ⟨0, 0⟩ +lemma CB3_2_3I1R4Entropy_sound : CB3_2_3I1R4Entropy.Encloses (Foundation.finiteEntropy CB3_2_3I1R4Value) := by + exact contains_sound (entropyFin_enclosed 6 CB3_2_3I1R4Value CB3_2_3I1R4Terms CB3_2_3I1R4Terms_sound) (by decide +kernel) +def CB3_2_3I1R4Mass : Ball := ⟨0, 0⟩ +lemma CB3_2_3I1R4Mass_sound : CB3_2_3I1R4Mass.Encloses (∑ a, CB3_2_3I1R4Value a) := by + exact contains_sound (finSumBall_sound 6 CB3_2_3I1R4P CB3_2_3I1R4Value CB3_2_3I1R4P_sound) (by decide +kernel) +def CB3_2_3I1R4MassTerm : Ball := .exact 0 +lemma CB3_2_3I1R4MassTerm_sound : CB3_2_3I1R4MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB3_2_3I1R4Value a))) := + entropyTerm_zero_ball (CB3_2_3I1R4Mass_sound) +def CB3_2_3I1R4H : Ball := ⟨0, 0⟩ +lemma CB3_2_3I1R4H_sound : CB3_2_3I1R4H.Encloses (homogeneousEntropy CB3_2_3I1R4Value) := by + exact contains_sound (homogeneous_enclosed CB3_2_3I1R4Value CB3_2_3I1R4MassTerm_sound CB3_2_3I1R4Entropy_sound) (by decide +kernel) +def CB3_2_3I1R5Value (a : Fin 6) : ℝ := residualLaw (below (shape 3 2 3)) (fun u => (stageBLaw (shape 3 2 3) u : ℝ)) (stageBPriority (shape 3 2 3)) 1 (fun u a => (littleLaw (shape 3 2 3) u ((stageBPriority (shape 3 2 3)) 1) a : ℝ)) 5 a +def CB3_2_3I1R5Raw (a : Fin 6) : Ball := residualBall (below (shape 3 2 3)) B3_2_3Law (stageBPriority (shape 3 2 3)) 1 (fun u => B3_2_3Little u ((stageBPriority (shape 3 2 3)) 1)) 5 a +lemma CB3_2_3I1R5Raw_sound (a : Fin 6) : + (CB3_2_3I1R5Raw a).Encloses (CB3_2_3I1R5Value a) := by + exact residualBall_sound_on (below (shape 3 2 3)) B3_2_3Law (fun u => (stageBLaw (shape 3 2 3) u : ℝ)) (stageBPriority (shape 3 2 3)) 1 (fun u => B3_2_3Little u ((stageBPriority (shape 3 2 3)) 1)) (fun u a => (littleLaw (shape 3 2 3) u ((stageBPriority (shape 3 2 3)) 1) a : ℝ)) (fun u _ => B3_2_3Law_sound u) (fun u _ a => B3_2_3Little_sound u ((stageBPriority (shape 3 2 3)) 1) a) 5 a +def CB3_2_3I1R5Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB3_2_3I1R5Certificates_valid : + CB3_2_3I1R5Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB3_2_3I1R5CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB3_2_3I1R5P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_2_3I1R5Certificates (CB3_2_3I1R5CertificateIndex a)).input +lemma CB3_2_3I1R5P_check : ∀ a : Fin 6, contains (CB3_2_3I1R5Raw a) (CB3_2_3I1R5P a) = true := by + decide +kernel +lemma CB3_2_3I1R5P_sound (a : Fin 6) : + (CB3_2_3I1R5P a).Encloses (CB3_2_3I1R5Value a) := + contains_sound (CB3_2_3I1R5Raw_sound a) (CB3_2_3I1R5P_check a) +def CB3_2_3I1R5Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_2_3I1R5Certificates (CB3_2_3I1R5CertificateIndex a)).output +lemma CB3_2_3I1R5Terms_sound (a : Fin 6) : + (CB3_2_3I1R5Terms a).Encloses (Foundation.entropyTerm (CB3_2_3I1R5Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB3_2_3I1R5Certificates_valid + (CB3_2_3I1R5CertificateIndex a) (CB3_2_3I1R5P_sound a) +def CB3_2_3I1R5Entropy : Ball := ⟨0, 0⟩ +lemma CB3_2_3I1R5Entropy_sound : CB3_2_3I1R5Entropy.Encloses (Foundation.finiteEntropy CB3_2_3I1R5Value) := by + exact contains_sound (entropyFin_enclosed 6 CB3_2_3I1R5Value CB3_2_3I1R5Terms CB3_2_3I1R5Terms_sound) (by decide +kernel) +def CB3_2_3I1R5Mass : Ball := ⟨0, 0⟩ +lemma CB3_2_3I1R5Mass_sound : CB3_2_3I1R5Mass.Encloses (∑ a, CB3_2_3I1R5Value a) := by + exact contains_sound (finSumBall_sound 6 CB3_2_3I1R5P CB3_2_3I1R5Value CB3_2_3I1R5P_sound) (by decide +kernel) +def CB3_2_3I1R5MassTerm : Ball := .exact 0 +lemma CB3_2_3I1R5MassTerm_sound : CB3_2_3I1R5MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB3_2_3I1R5Value a))) := + entropyTerm_zero_ball (CB3_2_3I1R5Mass_sound) +def CB3_2_3I1R5H : Ball := ⟨0, 0⟩ +lemma CB3_2_3I1R5H_sound : CB3_2_3I1R5H.Encloses (homogeneousEntropy CB3_2_3I1R5Value) := by + exact contains_sound (homogeneous_enclosed CB3_2_3I1R5Value CB3_2_3I1R5MassTerm_sound CB3_2_3I1R5Entropy_sound) (by decide +kernel) +def CB3_2_3I1R6Value (a : Fin 6) : ℝ := residualLaw (below (shape 3 2 3)) (fun u => (stageBLaw (shape 3 2 3) u : ℝ)) (stageBPriority (shape 3 2 3)) 1 (fun u a => (littleLaw (shape 3 2 3) u ((stageBPriority (shape 3 2 3)) 1) a : ℝ)) 6 a +def CB3_2_3I1R6Raw (a : Fin 6) : Ball := residualBall (below (shape 3 2 3)) B3_2_3Law (stageBPriority (shape 3 2 3)) 1 (fun u => B3_2_3Little u ((stageBPriority (shape 3 2 3)) 1)) 6 a +lemma CB3_2_3I1R6Raw_sound (a : Fin 6) : + (CB3_2_3I1R6Raw a).Encloses (CB3_2_3I1R6Value a) := by + exact residualBall_sound_on (below (shape 3 2 3)) B3_2_3Law (fun u => (stageBLaw (shape 3 2 3) u : ℝ)) (stageBPriority (shape 3 2 3)) 1 (fun u => B3_2_3Little u ((stageBPriority (shape 3 2 3)) 1)) (fun u a => (littleLaw (shape 3 2 3) u ((stageBPriority (shape 3 2 3)) 1) a : ℝ)) (fun u _ => B3_2_3Law_sound u) (fun u _ a => B3_2_3Little_sound u ((stageBPriority (shape 3 2 3)) 1) a) 6 a +def CB3_2_3I1R6Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB3_2_3I1R6Certificates_valid : + CB3_2_3I1R6Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB3_2_3I1R6CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB3_2_3I1R6P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_2_3I1R6Certificates (CB3_2_3I1R6CertificateIndex a)).input +lemma CB3_2_3I1R6P_check : ∀ a : Fin 6, contains (CB3_2_3I1R6Raw a) (CB3_2_3I1R6P a) = true := by + decide +kernel +lemma CB3_2_3I1R6P_sound (a : Fin 6) : + (CB3_2_3I1R6P a).Encloses (CB3_2_3I1R6Value a) := + contains_sound (CB3_2_3I1R6Raw_sound a) (CB3_2_3I1R6P_check a) +def CB3_2_3I1R6Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_2_3I1R6Certificates (CB3_2_3I1R6CertificateIndex a)).output +lemma CB3_2_3I1R6Terms_sound (a : Fin 6) : + (CB3_2_3I1R6Terms a).Encloses (Foundation.entropyTerm (CB3_2_3I1R6Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB3_2_3I1R6Certificates_valid + (CB3_2_3I1R6CertificateIndex a) (CB3_2_3I1R6P_sound a) +def CB3_2_3I1R6Entropy : Ball := ⟨0, 0⟩ +lemma CB3_2_3I1R6Entropy_sound : CB3_2_3I1R6Entropy.Encloses (Foundation.finiteEntropy CB3_2_3I1R6Value) := by + exact contains_sound (entropyFin_enclosed 6 CB3_2_3I1R6Value CB3_2_3I1R6Terms CB3_2_3I1R6Terms_sound) (by decide +kernel) +def CB3_2_3I1R6Mass : Ball := ⟨0, 0⟩ +lemma CB3_2_3I1R6Mass_sound : CB3_2_3I1R6Mass.Encloses (∑ a, CB3_2_3I1R6Value a) := by + exact contains_sound (finSumBall_sound 6 CB3_2_3I1R6P CB3_2_3I1R6Value CB3_2_3I1R6P_sound) (by decide +kernel) +def CB3_2_3I1R6MassTerm : Ball := .exact 0 +lemma CB3_2_3I1R6MassTerm_sound : CB3_2_3I1R6MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB3_2_3I1R6Value a))) := + entropyTerm_zero_ball (CB3_2_3I1R6Mass_sound) +def CB3_2_3I1R6H : Ball := ⟨0, 0⟩ +lemma CB3_2_3I1R6H_sound : CB3_2_3I1R6H.Encloses (homogeneousEntropy CB3_2_3I1R6Value) := by + exact contains_sound (homogeneous_enclosed CB3_2_3I1R6Value CB3_2_3I1R6MassTerm_sound CB3_2_3I1R6Entropy_sound) (by decide +kernel) +def CB3_2_3I1R7Value (a : Fin 6) : ℝ := residualLaw (below (shape 3 2 3)) (fun u => (stageBLaw (shape 3 2 3) u : ℝ)) (stageBPriority (shape 3 2 3)) 1 (fun u a => (littleLaw (shape 3 2 3) u ((stageBPriority (shape 3 2 3)) 1) a : ℝ)) 7 a +def CB3_2_3I1R7Raw (a : Fin 6) : Ball := residualBall (below (shape 3 2 3)) B3_2_3Law (stageBPriority (shape 3 2 3)) 1 (fun u => B3_2_3Little u ((stageBPriority (shape 3 2 3)) 1)) 7 a +lemma CB3_2_3I1R7Raw_sound (a : Fin 6) : + (CB3_2_3I1R7Raw a).Encloses (CB3_2_3I1R7Value a) := by + exact residualBall_sound_on (below (shape 3 2 3)) B3_2_3Law (fun u => (stageBLaw (shape 3 2 3) u : ℝ)) (stageBPriority (shape 3 2 3)) 1 (fun u => B3_2_3Little u ((stageBPriority (shape 3 2 3)) 1)) (fun u a => (littleLaw (shape 3 2 3) u ((stageBPriority (shape 3 2 3)) 1) a : ℝ)) (fun u _ => B3_2_3Law_sound u) (fun u _ a => B3_2_3Little_sound u ((stageBPriority (shape 3 2 3)) 1) a) 7 a +def CB3_2_3I1R7Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB3_2_3I1R7Certificates_valid : + CB3_2_3I1R7Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB3_2_3I1R7CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB3_2_3I1R7P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_2_3I1R7Certificates (CB3_2_3I1R7CertificateIndex a)).input +lemma CB3_2_3I1R7P_check : ∀ a : Fin 6, contains (CB3_2_3I1R7Raw a) (CB3_2_3I1R7P a) = true := by + decide +kernel +lemma CB3_2_3I1R7P_sound (a : Fin 6) : + (CB3_2_3I1R7P a).Encloses (CB3_2_3I1R7Value a) := + contains_sound (CB3_2_3I1R7Raw_sound a) (CB3_2_3I1R7P_check a) +def CB3_2_3I1R7Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_2_3I1R7Certificates (CB3_2_3I1R7CertificateIndex a)).output +lemma CB3_2_3I1R7Terms_sound (a : Fin 6) : + (CB3_2_3I1R7Terms a).Encloses (Foundation.entropyTerm (CB3_2_3I1R7Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB3_2_3I1R7Certificates_valid + (CB3_2_3I1R7CertificateIndex a) (CB3_2_3I1R7P_sound a) +def CB3_2_3I1R7Entropy : Ball := ⟨0, 0⟩ +lemma CB3_2_3I1R7Entropy_sound : CB3_2_3I1R7Entropy.Encloses (Foundation.finiteEntropy CB3_2_3I1R7Value) := by + exact contains_sound (entropyFin_enclosed 6 CB3_2_3I1R7Value CB3_2_3I1R7Terms CB3_2_3I1R7Terms_sound) (by decide +kernel) +def CB3_2_3I1R7Mass : Ball := ⟨0, 0⟩ +lemma CB3_2_3I1R7Mass_sound : CB3_2_3I1R7Mass.Encloses (∑ a, CB3_2_3I1R7Value a) := by + exact contains_sound (finSumBall_sound 6 CB3_2_3I1R7P CB3_2_3I1R7Value CB3_2_3I1R7P_sound) (by decide +kernel) +def CB3_2_3I1R7MassTerm : Ball := .exact 0 +lemma CB3_2_3I1R7MassTerm_sound : CB3_2_3I1R7MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB3_2_3I1R7Value a))) := + entropyTerm_zero_ball (CB3_2_3I1R7Mass_sound) +def CB3_2_3I1R7H : Ball := ⟨0, 0⟩ +lemma CB3_2_3I1R7H_sound : CB3_2_3I1R7H.Encloses (homogeneousEntropy CB3_2_3I1R7Value) := by + exact contains_sound (homogeneous_enclosed CB3_2_3I1R7Value CB3_2_3I1R7MassTerm_sound CB3_2_3I1R7Entropy_sound) (by decide +kernel) +def CB3_2_3I1R8Value (a : Fin 6) : ℝ := residualLaw (below (shape 3 2 3)) (fun u => (stageBLaw (shape 3 2 3) u : ℝ)) (stageBPriority (shape 3 2 3)) 1 (fun u a => (littleLaw (shape 3 2 3) u ((stageBPriority (shape 3 2 3)) 1) a : ℝ)) 8 a +def CB3_2_3I1R8Raw (a : Fin 6) : Ball := residualBall (below (shape 3 2 3)) B3_2_3Law (stageBPriority (shape 3 2 3)) 1 (fun u => B3_2_3Little u ((stageBPriority (shape 3 2 3)) 1)) 8 a +lemma CB3_2_3I1R8Raw_sound (a : Fin 6) : + (CB3_2_3I1R8Raw a).Encloses (CB3_2_3I1R8Value a) := by + exact residualBall_sound_on (below (shape 3 2 3)) B3_2_3Law (fun u => (stageBLaw (shape 3 2 3) u : ℝ)) (stageBPriority (shape 3 2 3)) 1 (fun u => B3_2_3Little u ((stageBPriority (shape 3 2 3)) 1)) (fun u a => (littleLaw (shape 3 2 3) u ((stageBPriority (shape 3 2 3)) 1) a : ℝ)) (fun u _ => B3_2_3Law_sound u) (fun u _ a => B3_2_3Little_sound u ((stageBPriority (shape 3 2 3)) 1) a) 8 a +def CB3_2_3I1R8Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB3_2_3I1R8Certificates_valid : + CB3_2_3I1R8Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB3_2_3I1R8CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB3_2_3I1R8P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_2_3I1R8Certificates (CB3_2_3I1R8CertificateIndex a)).input +lemma CB3_2_3I1R8P_check : ∀ a : Fin 6, contains (CB3_2_3I1R8Raw a) (CB3_2_3I1R8P a) = true := by + decide +kernel +lemma CB3_2_3I1R8P_sound (a : Fin 6) : + (CB3_2_3I1R8P a).Encloses (CB3_2_3I1R8Value a) := + contains_sound (CB3_2_3I1R8Raw_sound a) (CB3_2_3I1R8P_check a) +def CB3_2_3I1R8Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_2_3I1R8Certificates (CB3_2_3I1R8CertificateIndex a)).output +lemma CB3_2_3I1R8Terms_sound (a : Fin 6) : + (CB3_2_3I1R8Terms a).Encloses (Foundation.entropyTerm (CB3_2_3I1R8Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB3_2_3I1R8Certificates_valid + (CB3_2_3I1R8CertificateIndex a) (CB3_2_3I1R8P_sound a) +def CB3_2_3I1R8Entropy : Ball := ⟨0, 0⟩ +lemma CB3_2_3I1R8Entropy_sound : CB3_2_3I1R8Entropy.Encloses (Foundation.finiteEntropy CB3_2_3I1R8Value) := by + exact contains_sound (entropyFin_enclosed 6 CB3_2_3I1R8Value CB3_2_3I1R8Terms CB3_2_3I1R8Terms_sound) (by decide +kernel) +def CB3_2_3I1R8Mass : Ball := ⟨0, 0⟩ +lemma CB3_2_3I1R8Mass_sound : CB3_2_3I1R8Mass.Encloses (∑ a, CB3_2_3I1R8Value a) := by + exact contains_sound (finSumBall_sound 6 CB3_2_3I1R8P CB3_2_3I1R8Value CB3_2_3I1R8P_sound) (by decide +kernel) +def CB3_2_3I1R8MassTerm : Ball := .exact 0 +lemma CB3_2_3I1R8MassTerm_sound : CB3_2_3I1R8MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB3_2_3I1R8Value a))) := + entropyTerm_zero_ball (CB3_2_3I1R8Mass_sound) +def CB3_2_3I1R8H : Ball := ⟨0, 0⟩ +lemma CB3_2_3I1R8H_sound : CB3_2_3I1R8H.Encloses (homogeneousEntropy CB3_2_3I1R8Value) := by + exact contains_sound (homogeneous_enclosed CB3_2_3I1R8Value CB3_2_3I1R8MassTerm_sound CB3_2_3I1R8Entropy_sound) (by decide +kernel) +def CB3_2_3I1R9Value (a : Fin 6) : ℝ := residualLaw (below (shape 3 2 3)) (fun u => (stageBLaw (shape 3 2 3) u : ℝ)) (stageBPriority (shape 3 2 3)) 1 (fun u a => (littleLaw (shape 3 2 3) u ((stageBPriority (shape 3 2 3)) 1) a : ℝ)) 9 a +def CB3_2_3I1R9Raw (a : Fin 6) : Ball := residualBall (below (shape 3 2 3)) B3_2_3Law (stageBPriority (shape 3 2 3)) 1 (fun u => B3_2_3Little u ((stageBPriority (shape 3 2 3)) 1)) 9 a +lemma CB3_2_3I1R9Raw_sound (a : Fin 6) : + (CB3_2_3I1R9Raw a).Encloses (CB3_2_3I1R9Value a) := by + exact residualBall_sound_on (below (shape 3 2 3)) B3_2_3Law (fun u => (stageBLaw (shape 3 2 3) u : ℝ)) (stageBPriority (shape 3 2 3)) 1 (fun u => B3_2_3Little u ((stageBPriority (shape 3 2 3)) 1)) (fun u a => (littleLaw (shape 3 2 3) u ((stageBPriority (shape 3 2 3)) 1) a : ℝ)) (fun u _ => B3_2_3Law_sound u) (fun u _ a => B3_2_3Little_sound u ((stageBPriority (shape 3 2 3)) 1) a) 9 a +def CB3_2_3I1R9Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB3_2_3I1R9Certificates_valid : + CB3_2_3I1R9Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB3_2_3I1R9CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB3_2_3I1R9P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_2_3I1R9Certificates (CB3_2_3I1R9CertificateIndex a)).input +lemma CB3_2_3I1R9P_check : ∀ a : Fin 6, contains (CB3_2_3I1R9Raw a) (CB3_2_3I1R9P a) = true := by + decide +kernel +lemma CB3_2_3I1R9P_sound (a : Fin 6) : + (CB3_2_3I1R9P a).Encloses (CB3_2_3I1R9Value a) := + contains_sound (CB3_2_3I1R9Raw_sound a) (CB3_2_3I1R9P_check a) +def CB3_2_3I1R9Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_2_3I1R9Certificates (CB3_2_3I1R9CertificateIndex a)).output +lemma CB3_2_3I1R9Terms_sound (a : Fin 6) : + (CB3_2_3I1R9Terms a).Encloses (Foundation.entropyTerm (CB3_2_3I1R9Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB3_2_3I1R9Certificates_valid + (CB3_2_3I1R9CertificateIndex a) (CB3_2_3I1R9P_sound a) +def CB3_2_3I1R9Entropy : Ball := ⟨0, 0⟩ +lemma CB3_2_3I1R9Entropy_sound : CB3_2_3I1R9Entropy.Encloses (Foundation.finiteEntropy CB3_2_3I1R9Value) := by + exact contains_sound (entropyFin_enclosed 6 CB3_2_3I1R9Value CB3_2_3I1R9Terms CB3_2_3I1R9Terms_sound) (by decide +kernel) +def CB3_2_3I1R9Mass : Ball := ⟨0, 0⟩ +lemma CB3_2_3I1R9Mass_sound : CB3_2_3I1R9Mass.Encloses (∑ a, CB3_2_3I1R9Value a) := by + exact contains_sound (finSumBall_sound 6 CB3_2_3I1R9P CB3_2_3I1R9Value CB3_2_3I1R9P_sound) (by decide +kernel) +def CB3_2_3I1R9MassTerm : Ball := .exact 0 +lemma CB3_2_3I1R9MassTerm_sound : CB3_2_3I1R9MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB3_2_3I1R9Value a))) := + entropyTerm_zero_ball (CB3_2_3I1R9Mass_sound) +def CB3_2_3I1R9H : Ball := ⟨0, 0⟩ +lemma CB3_2_3I1R9H_sound : CB3_2_3I1R9H.Encloses (homogeneousEntropy CB3_2_3I1R9Value) := by + exact contains_sound (homogeneous_enclosed CB3_2_3I1R9Value CB3_2_3I1R9MassTerm_sound CB3_2_3I1R9Entropy_sound) (by decide +kernel) +def CB3_2_3I1R10Value (a : Fin 6) : ℝ := residualLaw (below (shape 3 2 3)) (fun u => (stageBLaw (shape 3 2 3) u : ℝ)) (stageBPriority (shape 3 2 3)) 1 (fun u a => (littleLaw (shape 3 2 3) u ((stageBPriority (shape 3 2 3)) 1) a : ℝ)) 10 a +def CB3_2_3I1R10Raw (a : Fin 6) : Ball := residualBall (below (shape 3 2 3)) B3_2_3Law (stageBPriority (shape 3 2 3)) 1 (fun u => B3_2_3Little u ((stageBPriority (shape 3 2 3)) 1)) 10 a +lemma CB3_2_3I1R10Raw_sound (a : Fin 6) : + (CB3_2_3I1R10Raw a).Encloses (CB3_2_3I1R10Value a) := by + exact residualBall_sound_on (below (shape 3 2 3)) B3_2_3Law (fun u => (stageBLaw (shape 3 2 3) u : ℝ)) (stageBPriority (shape 3 2 3)) 1 (fun u => B3_2_3Little u ((stageBPriority (shape 3 2 3)) 1)) (fun u a => (littleLaw (shape 3 2 3) u ((stageBPriority (shape 3 2 3)) 1) a : ℝ)) (fun u _ => B3_2_3Law_sound u) (fun u _ a => B3_2_3Little_sound u ((stageBPriority (shape 3 2 3)) 1) a) 10 a +def CB3_2_3I1R10Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB3_2_3I1R10Certificates_valid : + CB3_2_3I1R10Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB3_2_3I1R10CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB3_2_3I1R10P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_2_3I1R10Certificates (CB3_2_3I1R10CertificateIndex a)).input +lemma CB3_2_3I1R10P_check : ∀ a : Fin 6, contains (CB3_2_3I1R10Raw a) (CB3_2_3I1R10P a) = true := by + decide +kernel +lemma CB3_2_3I1R10P_sound (a : Fin 6) : + (CB3_2_3I1R10P a).Encloses (CB3_2_3I1R10Value a) := + contains_sound (CB3_2_3I1R10Raw_sound a) (CB3_2_3I1R10P_check a) +def CB3_2_3I1R10Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_2_3I1R10Certificates (CB3_2_3I1R10CertificateIndex a)).output +lemma CB3_2_3I1R10Terms_sound (a : Fin 6) : + (CB3_2_3I1R10Terms a).Encloses (Foundation.entropyTerm (CB3_2_3I1R10Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB3_2_3I1R10Certificates_valid + (CB3_2_3I1R10CertificateIndex a) (CB3_2_3I1R10P_sound a) +def CB3_2_3I1R10Entropy : Ball := ⟨0, 0⟩ +lemma CB3_2_3I1R10Entropy_sound : CB3_2_3I1R10Entropy.Encloses (Foundation.finiteEntropy CB3_2_3I1R10Value) := by + exact contains_sound (entropyFin_enclosed 6 CB3_2_3I1R10Value CB3_2_3I1R10Terms CB3_2_3I1R10Terms_sound) (by decide +kernel) +def CB3_2_3I1R10Mass : Ball := ⟨0, 0⟩ +lemma CB3_2_3I1R10Mass_sound : CB3_2_3I1R10Mass.Encloses (∑ a, CB3_2_3I1R10Value a) := by + exact contains_sound (finSumBall_sound 6 CB3_2_3I1R10P CB3_2_3I1R10Value CB3_2_3I1R10P_sound) (by decide +kernel) +def CB3_2_3I1R10MassTerm : Ball := .exact 0 +lemma CB3_2_3I1R10MassTerm_sound : CB3_2_3I1R10MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB3_2_3I1R10Value a))) := + entropyTerm_zero_ball (CB3_2_3I1R10Mass_sound) +def CB3_2_3I1R10H : Ball := ⟨0, 0⟩ +lemma CB3_2_3I1R10H_sound : CB3_2_3I1R10H.Encloses (homogeneousEntropy CB3_2_3I1R10Value) := by + exact contains_sound (homogeneous_enclosed CB3_2_3I1R10Value CB3_2_3I1R10MassTerm_sound CB3_2_3I1R10Entropy_sound) (by decide +kernel) +def CB3_2_3I1R11Value (a : Fin 6) : ℝ := residualLaw (below (shape 3 2 3)) (fun u => (stageBLaw (shape 3 2 3) u : ℝ)) (stageBPriority (shape 3 2 3)) 1 (fun u a => (littleLaw (shape 3 2 3) u ((stageBPriority (shape 3 2 3)) 1) a : ℝ)) 11 a +def CB3_2_3I1R11Raw (a : Fin 6) : Ball := residualBall (below (shape 3 2 3)) B3_2_3Law (stageBPriority (shape 3 2 3)) 1 (fun u => B3_2_3Little u ((stageBPriority (shape 3 2 3)) 1)) 11 a +lemma CB3_2_3I1R11Raw_sound (a : Fin 6) : + (CB3_2_3I1R11Raw a).Encloses (CB3_2_3I1R11Value a) := by + exact residualBall_sound_on (below (shape 3 2 3)) B3_2_3Law (fun u => (stageBLaw (shape 3 2 3) u : ℝ)) (stageBPriority (shape 3 2 3)) 1 (fun u => B3_2_3Little u ((stageBPriority (shape 3 2 3)) 1)) (fun u a => (littleLaw (shape 3 2 3) u ((stageBPriority (shape 3 2 3)) 1) a : ℝ)) (fun u _ => B3_2_3Law_sound u) (fun u _ a => B3_2_3Little_sound u ((stageBPriority (shape 3 2 3)) 1) a) 11 a +def CB3_2_3I1R11Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB3_2_3I1R11Certificates_valid : + CB3_2_3I1R11Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB3_2_3I1R11CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB3_2_3I1R11P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_2_3I1R11Certificates (CB3_2_3I1R11CertificateIndex a)).input +lemma CB3_2_3I1R11P_check : ∀ a : Fin 6, contains (CB3_2_3I1R11Raw a) (CB3_2_3I1R11P a) = true := by + decide +kernel +lemma CB3_2_3I1R11P_sound (a : Fin 6) : + (CB3_2_3I1R11P a).Encloses (CB3_2_3I1R11Value a) := + contains_sound (CB3_2_3I1R11Raw_sound a) (CB3_2_3I1R11P_check a) +def CB3_2_3I1R11Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_2_3I1R11Certificates (CB3_2_3I1R11CertificateIndex a)).output +lemma CB3_2_3I1R11Terms_sound (a : Fin 6) : + (CB3_2_3I1R11Terms a).Encloses (Foundation.entropyTerm (CB3_2_3I1R11Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB3_2_3I1R11Certificates_valid + (CB3_2_3I1R11CertificateIndex a) (CB3_2_3I1R11P_sound a) +def CB3_2_3I1R11Entropy : Ball := ⟨0, 0⟩ +lemma CB3_2_3I1R11Entropy_sound : CB3_2_3I1R11Entropy.Encloses (Foundation.finiteEntropy CB3_2_3I1R11Value) := by + exact contains_sound (entropyFin_enclosed 6 CB3_2_3I1R11Value CB3_2_3I1R11Terms CB3_2_3I1R11Terms_sound) (by decide +kernel) +def CB3_2_3I1R11Mass : Ball := ⟨0, 0⟩ +lemma CB3_2_3I1R11Mass_sound : CB3_2_3I1R11Mass.Encloses (∑ a, CB3_2_3I1R11Value a) := by + exact contains_sound (finSumBall_sound 6 CB3_2_3I1R11P CB3_2_3I1R11Value CB3_2_3I1R11P_sound) (by decide +kernel) +def CB3_2_3I1R11MassTerm : Ball := .exact 0 +lemma CB3_2_3I1R11MassTerm_sound : CB3_2_3I1R11MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB3_2_3I1R11Value a))) := + entropyTerm_zero_ball (CB3_2_3I1R11Mass_sound) +def CB3_2_3I1R11H : Ball := ⟨0, 0⟩ +lemma CB3_2_3I1R11H_sound : CB3_2_3I1R11H.Encloses (homogeneousEntropy CB3_2_3I1R11Value) := by + exact contains_sound (homogeneous_enclosed CB3_2_3I1R11Value CB3_2_3I1R11MassTerm_sound CB3_2_3I1R11Entropy_sound) (by decide +kernel) +def CB3_2_3I1R12Value (a : Fin 6) : ℝ := residualLaw (below (shape 3 2 3)) (fun u => (stageBLaw (shape 3 2 3) u : ℝ)) (stageBPriority (shape 3 2 3)) 1 (fun u a => (littleLaw (shape 3 2 3) u ((stageBPriority (shape 3 2 3)) 1) a : ℝ)) 12 a +def CB3_2_3I1R12Raw (a : Fin 6) : Ball := residualBall (below (shape 3 2 3)) B3_2_3Law (stageBPriority (shape 3 2 3)) 1 (fun u => B3_2_3Little u ((stageBPriority (shape 3 2 3)) 1)) 12 a +lemma CB3_2_3I1R12Raw_sound (a : Fin 6) : + (CB3_2_3I1R12Raw a).Encloses (CB3_2_3I1R12Value a) := by + exact residualBall_sound_on (below (shape 3 2 3)) B3_2_3Law (fun u => (stageBLaw (shape 3 2 3) u : ℝ)) (stageBPriority (shape 3 2 3)) 1 (fun u => B3_2_3Little u ((stageBPriority (shape 3 2 3)) 1)) (fun u a => (littleLaw (shape 3 2 3) u ((stageBPriority (shape 3 2 3)) 1) a : ℝ)) (fun u _ => B3_2_3Law_sound u) (fun u _ a => B3_2_3Little_sound u ((stageBPriority (shape 3 2 3)) 1) a) 12 a +def CB3_2_3I1R12Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB3_2_3I1R12Certificates_valid : + CB3_2_3I1R12Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB3_2_3I1R12CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB3_2_3I1R12P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_2_3I1R12Certificates (CB3_2_3I1R12CertificateIndex a)).input +lemma CB3_2_3I1R12P_check : ∀ a : Fin 6, contains (CB3_2_3I1R12Raw a) (CB3_2_3I1R12P a) = true := by + decide +kernel +lemma CB3_2_3I1R12P_sound (a : Fin 6) : + (CB3_2_3I1R12P a).Encloses (CB3_2_3I1R12Value a) := + contains_sound (CB3_2_3I1R12Raw_sound a) (CB3_2_3I1R12P_check a) +def CB3_2_3I1R12Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_2_3I1R12Certificates (CB3_2_3I1R12CertificateIndex a)).output +lemma CB3_2_3I1R12Terms_sound (a : Fin 6) : + (CB3_2_3I1R12Terms a).Encloses (Foundation.entropyTerm (CB3_2_3I1R12Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB3_2_3I1R12Certificates_valid + (CB3_2_3I1R12CertificateIndex a) (CB3_2_3I1R12P_sound a) +def CB3_2_3I1R12Entropy : Ball := ⟨0, 0⟩ +lemma CB3_2_3I1R12Entropy_sound : CB3_2_3I1R12Entropy.Encloses (Foundation.finiteEntropy CB3_2_3I1R12Value) := by + exact contains_sound (entropyFin_enclosed 6 CB3_2_3I1R12Value CB3_2_3I1R12Terms CB3_2_3I1R12Terms_sound) (by decide +kernel) +def CB3_2_3I1R12Mass : Ball := ⟨0, 0⟩ +lemma CB3_2_3I1R12Mass_sound : CB3_2_3I1R12Mass.Encloses (∑ a, CB3_2_3I1R12Value a) := by + exact contains_sound (finSumBall_sound 6 CB3_2_3I1R12P CB3_2_3I1R12Value CB3_2_3I1R12P_sound) (by decide +kernel) +def CB3_2_3I1R12MassTerm : Ball := .exact 0 +lemma CB3_2_3I1R12MassTerm_sound : CB3_2_3I1R12MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB3_2_3I1R12Value a))) := + entropyTerm_zero_ball (CB3_2_3I1R12Mass_sound) +def CB3_2_3I1R12H : Ball := ⟨0, 0⟩ +lemma CB3_2_3I1R12H_sound : CB3_2_3I1R12H.Encloses (homogeneousEntropy CB3_2_3I1R12Value) := by + exact contains_sound (homogeneous_enclosed CB3_2_3I1R12Value CB3_2_3I1R12MassTerm_sound CB3_2_3I1R12Entropy_sound) (by decide +kernel) +def CB3_2_3I1R13Value (a : Fin 6) : ℝ := residualLaw (below (shape 3 2 3)) (fun u => (stageBLaw (shape 3 2 3) u : ℝ)) (stageBPriority (shape 3 2 3)) 1 (fun u a => (littleLaw (shape 3 2 3) u ((stageBPriority (shape 3 2 3)) 1) a : ℝ)) 13 a +def CB3_2_3I1R13Raw (a : Fin 6) : Ball := residualBall (below (shape 3 2 3)) B3_2_3Law (stageBPriority (shape 3 2 3)) 1 (fun u => B3_2_3Little u ((stageBPriority (shape 3 2 3)) 1)) 13 a +lemma CB3_2_3I1R13Raw_sound (a : Fin 6) : + (CB3_2_3I1R13Raw a).Encloses (CB3_2_3I1R13Value a) := by + exact residualBall_sound_on (below (shape 3 2 3)) B3_2_3Law (fun u => (stageBLaw (shape 3 2 3) u : ℝ)) (stageBPriority (shape 3 2 3)) 1 (fun u => B3_2_3Little u ((stageBPriority (shape 3 2 3)) 1)) (fun u a => (littleLaw (shape 3 2 3) u ((stageBPriority (shape 3 2 3)) 1) a : ℝ)) (fun u _ => B3_2_3Law_sound u) (fun u _ a => B3_2_3Little_sound u ((stageBPriority (shape 3 2 3)) 1) a) 13 a +def CB3_2_3I1R13Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB3_2_3I1R13Certificates_valid : + CB3_2_3I1R13Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB3_2_3I1R13CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB3_2_3I1R13P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_2_3I1R13Certificates (CB3_2_3I1R13CertificateIndex a)).input +lemma CB3_2_3I1R13P_check : ∀ a : Fin 6, contains (CB3_2_3I1R13Raw a) (CB3_2_3I1R13P a) = true := by + decide +kernel +lemma CB3_2_3I1R13P_sound (a : Fin 6) : + (CB3_2_3I1R13P a).Encloses (CB3_2_3I1R13Value a) := + contains_sound (CB3_2_3I1R13Raw_sound a) (CB3_2_3I1R13P_check a) +def CB3_2_3I1R13Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_2_3I1R13Certificates (CB3_2_3I1R13CertificateIndex a)).output +lemma CB3_2_3I1R13Terms_sound (a : Fin 6) : + (CB3_2_3I1R13Terms a).Encloses (Foundation.entropyTerm (CB3_2_3I1R13Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB3_2_3I1R13Certificates_valid + (CB3_2_3I1R13CertificateIndex a) (CB3_2_3I1R13P_sound a) +def CB3_2_3I1R13Entropy : Ball := ⟨0, 0⟩ +lemma CB3_2_3I1R13Entropy_sound : CB3_2_3I1R13Entropy.Encloses (Foundation.finiteEntropy CB3_2_3I1R13Value) := by + exact contains_sound (entropyFin_enclosed 6 CB3_2_3I1R13Value CB3_2_3I1R13Terms CB3_2_3I1R13Terms_sound) (by decide +kernel) +def CB3_2_3I1R13Mass : Ball := ⟨0, 0⟩ +lemma CB3_2_3I1R13Mass_sound : CB3_2_3I1R13Mass.Encloses (∑ a, CB3_2_3I1R13Value a) := by + exact contains_sound (finSumBall_sound 6 CB3_2_3I1R13P CB3_2_3I1R13Value CB3_2_3I1R13P_sound) (by decide +kernel) +def CB3_2_3I1R13MassTerm : Ball := .exact 0 +lemma CB3_2_3I1R13MassTerm_sound : CB3_2_3I1R13MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB3_2_3I1R13Value a))) := + entropyTerm_zero_ball (CB3_2_3I1R13Mass_sound) +def CB3_2_3I1R13H : Ball := ⟨0, 0⟩ +lemma CB3_2_3I1R13H_sound : CB3_2_3I1R13H.Encloses (homogeneousEntropy CB3_2_3I1R13Value) := by + exact contains_sound (homogeneous_enclosed CB3_2_3I1R13Value CB3_2_3I1R13MassTerm_sound CB3_2_3I1R13Entropy_sound) (by decide +kernel) +def CB3_2_3I1R14Value (a : Fin 6) : ℝ := residualLaw (below (shape 3 2 3)) (fun u => (stageBLaw (shape 3 2 3) u : ℝ)) (stageBPriority (shape 3 2 3)) 1 (fun u a => (littleLaw (shape 3 2 3) u ((stageBPriority (shape 3 2 3)) 1) a : ℝ)) 14 a +def CB3_2_3I1R14Raw (a : Fin 6) : Ball := residualBall (below (shape 3 2 3)) B3_2_3Law (stageBPriority (shape 3 2 3)) 1 (fun u => B3_2_3Little u ((stageBPriority (shape 3 2 3)) 1)) 14 a +lemma CB3_2_3I1R14Raw_sound (a : Fin 6) : + (CB3_2_3I1R14Raw a).Encloses (CB3_2_3I1R14Value a) := by + exact residualBall_sound_on (below (shape 3 2 3)) B3_2_3Law (fun u => (stageBLaw (shape 3 2 3) u : ℝ)) (stageBPriority (shape 3 2 3)) 1 (fun u => B3_2_3Little u ((stageBPriority (shape 3 2 3)) 1)) (fun u a => (littleLaw (shape 3 2 3) u ((stageBPriority (shape 3 2 3)) 1) a : ℝ)) (fun u _ => B3_2_3Law_sound u) (fun u _ a => B3_2_3Little_sound u ((stageBPriority (shape 3 2 3)) 1) a) 14 a +def CB3_2_3I1R14Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB3_2_3I1R14Certificates_valid : + CB3_2_3I1R14Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB3_2_3I1R14CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB3_2_3I1R14P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_2_3I1R14Certificates (CB3_2_3I1R14CertificateIndex a)).input +lemma CB3_2_3I1R14P_check : ∀ a : Fin 6, contains (CB3_2_3I1R14Raw a) (CB3_2_3I1R14P a) = true := by + decide +kernel +lemma CB3_2_3I1R14P_sound (a : Fin 6) : + (CB3_2_3I1R14P a).Encloses (CB3_2_3I1R14Value a) := + contains_sound (CB3_2_3I1R14Raw_sound a) (CB3_2_3I1R14P_check a) +def CB3_2_3I1R14Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_2_3I1R14Certificates (CB3_2_3I1R14CertificateIndex a)).output +lemma CB3_2_3I1R14Terms_sound (a : Fin 6) : + (CB3_2_3I1R14Terms a).Encloses (Foundation.entropyTerm (CB3_2_3I1R14Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB3_2_3I1R14Certificates_valid + (CB3_2_3I1R14CertificateIndex a) (CB3_2_3I1R14P_sound a) +def CB3_2_3I1R14Entropy : Ball := ⟨0, 0⟩ +lemma CB3_2_3I1R14Entropy_sound : CB3_2_3I1R14Entropy.Encloses (Foundation.finiteEntropy CB3_2_3I1R14Value) := by + exact contains_sound (entropyFin_enclosed 6 CB3_2_3I1R14Value CB3_2_3I1R14Terms CB3_2_3I1R14Terms_sound) (by decide +kernel) +def CB3_2_3I1R14Mass : Ball := ⟨0, 0⟩ +lemma CB3_2_3I1R14Mass_sound : CB3_2_3I1R14Mass.Encloses (∑ a, CB3_2_3I1R14Value a) := by + exact contains_sound (finSumBall_sound 6 CB3_2_3I1R14P CB3_2_3I1R14Value CB3_2_3I1R14P_sound) (by decide +kernel) +def CB3_2_3I1R14MassTerm : Ball := .exact 0 +lemma CB3_2_3I1R14MassTerm_sound : CB3_2_3I1R14MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB3_2_3I1R14Value a))) := + entropyTerm_zero_ball (CB3_2_3I1R14Mass_sound) +def CB3_2_3I1R14H : Ball := ⟨0, 0⟩ +lemma CB3_2_3I1R14H_sound : CB3_2_3I1R14H.Encloses (homogeneousEntropy CB3_2_3I1R14Value) := by + exact contains_sound (homogeneous_enclosed CB3_2_3I1R14Value CB3_2_3I1R14MassTerm_sound CB3_2_3I1R14Entropy_sound) (by decide +kernel) +def CB3_2_3I1R15Value (a : Fin 6) : ℝ := residualLaw (below (shape 3 2 3)) (fun u => (stageBLaw (shape 3 2 3) u : ℝ)) (stageBPriority (shape 3 2 3)) 1 (fun u a => (littleLaw (shape 3 2 3) u ((stageBPriority (shape 3 2 3)) 1) a : ℝ)) 15 a +def CB3_2_3I1R15Raw (a : Fin 6) : Ball := residualBall (below (shape 3 2 3)) B3_2_3Law (stageBPriority (shape 3 2 3)) 1 (fun u => B3_2_3Little u ((stageBPriority (shape 3 2 3)) 1)) 15 a +lemma CB3_2_3I1R15Raw_sound (a : Fin 6) : + (CB3_2_3I1R15Raw a).Encloses (CB3_2_3I1R15Value a) := by + exact residualBall_sound_on (below (shape 3 2 3)) B3_2_3Law (fun u => (stageBLaw (shape 3 2 3) u : ℝ)) (stageBPriority (shape 3 2 3)) 1 (fun u => B3_2_3Little u ((stageBPriority (shape 3 2 3)) 1)) (fun u a => (littleLaw (shape 3 2 3) u ((stageBPriority (shape 3 2 3)) 1) a : ℝ)) (fun u _ => B3_2_3Law_sound u) (fun u _ a => B3_2_3Little_sound u ((stageBPriority (shape 3 2 3)) 1) a) 15 a +def CB3_2_3I1R15Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB3_2_3I1R15Certificates_valid : + CB3_2_3I1R15Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB3_2_3I1R15CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB3_2_3I1R15P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_2_3I1R15Certificates (CB3_2_3I1R15CertificateIndex a)).input +lemma CB3_2_3I1R15P_check : ∀ a : Fin 6, contains (CB3_2_3I1R15Raw a) (CB3_2_3I1R15P a) = true := by + decide +kernel +lemma CB3_2_3I1R15P_sound (a : Fin 6) : + (CB3_2_3I1R15P a).Encloses (CB3_2_3I1R15Value a) := + contains_sound (CB3_2_3I1R15Raw_sound a) (CB3_2_3I1R15P_check a) +def CB3_2_3I1R15Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_2_3I1R15Certificates (CB3_2_3I1R15CertificateIndex a)).output +lemma CB3_2_3I1R15Terms_sound (a : Fin 6) : + (CB3_2_3I1R15Terms a).Encloses (Foundation.entropyTerm (CB3_2_3I1R15Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB3_2_3I1R15Certificates_valid + (CB3_2_3I1R15CertificateIndex a) (CB3_2_3I1R15P_sound a) +def CB3_2_3I1R15Entropy : Ball := ⟨0, 0⟩ +lemma CB3_2_3I1R15Entropy_sound : CB3_2_3I1R15Entropy.Encloses (Foundation.finiteEntropy CB3_2_3I1R15Value) := by + exact contains_sound (entropyFin_enclosed 6 CB3_2_3I1R15Value CB3_2_3I1R15Terms CB3_2_3I1R15Terms_sound) (by decide +kernel) +def CB3_2_3I1R15Mass : Ball := ⟨0, 0⟩ +lemma CB3_2_3I1R15Mass_sound : CB3_2_3I1R15Mass.Encloses (∑ a, CB3_2_3I1R15Value a) := by + exact contains_sound (finSumBall_sound 6 CB3_2_3I1R15P CB3_2_3I1R15Value CB3_2_3I1R15P_sound) (by decide +kernel) +def CB3_2_3I1R15MassTerm : Ball := .exact 0 +lemma CB3_2_3I1R15MassTerm_sound : CB3_2_3I1R15MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB3_2_3I1R15Value a))) := + entropyTerm_zero_ball (CB3_2_3I1R15Mass_sound) +def CB3_2_3I1R15H : Ball := ⟨0, 0⟩ +lemma CB3_2_3I1R15H_sound : CB3_2_3I1R15H.Encloses (homogeneousEntropy CB3_2_3I1R15Value) := by + exact contains_sound (homogeneous_enclosed CB3_2_3I1R15Value CB3_2_3I1R15MassTerm_sound CB3_2_3I1R15Entropy_sound) (by decide +kernel) +def CB3_2_3I1R16Value (a : Fin 6) : ℝ := residualLaw (below (shape 3 2 3)) (fun u => (stageBLaw (shape 3 2 3) u : ℝ)) (stageBPriority (shape 3 2 3)) 1 (fun u a => (littleLaw (shape 3 2 3) u ((stageBPriority (shape 3 2 3)) 1) a : ℝ)) 16 a +def CB3_2_3I1R16Raw (a : Fin 6) : Ball := residualBall (below (shape 3 2 3)) B3_2_3Law (stageBPriority (shape 3 2 3)) 1 (fun u => B3_2_3Little u ((stageBPriority (shape 3 2 3)) 1)) 16 a +lemma CB3_2_3I1R16Raw_sound (a : Fin 6) : + (CB3_2_3I1R16Raw a).Encloses (CB3_2_3I1R16Value a) := by + exact residualBall_sound_on (below (shape 3 2 3)) B3_2_3Law (fun u => (stageBLaw (shape 3 2 3) u : ℝ)) (stageBPriority (shape 3 2 3)) 1 (fun u => B3_2_3Little u ((stageBPriority (shape 3 2 3)) 1)) (fun u a => (littleLaw (shape 3 2 3) u ((stageBPriority (shape 3 2 3)) 1) a : ℝ)) (fun u _ => B3_2_3Law_sound u) (fun u _ a => B3_2_3Little_sound u ((stageBPriority (shape 3 2 3)) 1) a) 16 a +def CB3_2_3I1R16Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB3_2_3I1R16Certificates_valid : + CB3_2_3I1R16Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB3_2_3I1R16CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB3_2_3I1R16P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_2_3I1R16Certificates (CB3_2_3I1R16CertificateIndex a)).input +lemma CB3_2_3I1R16P_check : ∀ a : Fin 6, contains (CB3_2_3I1R16Raw a) (CB3_2_3I1R16P a) = true := by + decide +kernel +lemma CB3_2_3I1R16P_sound (a : Fin 6) : + (CB3_2_3I1R16P a).Encloses (CB3_2_3I1R16Value a) := + contains_sound (CB3_2_3I1R16Raw_sound a) (CB3_2_3I1R16P_check a) +def CB3_2_3I1R16Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_2_3I1R16Certificates (CB3_2_3I1R16CertificateIndex a)).output +lemma CB3_2_3I1R16Terms_sound (a : Fin 6) : + (CB3_2_3I1R16Terms a).Encloses (Foundation.entropyTerm (CB3_2_3I1R16Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB3_2_3I1R16Certificates_valid + (CB3_2_3I1R16CertificateIndex a) (CB3_2_3I1R16P_sound a) +def CB3_2_3I1R16Entropy : Ball := ⟨0, 0⟩ +lemma CB3_2_3I1R16Entropy_sound : CB3_2_3I1R16Entropy.Encloses (Foundation.finiteEntropy CB3_2_3I1R16Value) := by + exact contains_sound (entropyFin_enclosed 6 CB3_2_3I1R16Value CB3_2_3I1R16Terms CB3_2_3I1R16Terms_sound) (by decide +kernel) +def CB3_2_3I1R16Mass : Ball := ⟨0, 0⟩ +lemma CB3_2_3I1R16Mass_sound : CB3_2_3I1R16Mass.Encloses (∑ a, CB3_2_3I1R16Value a) := by + exact contains_sound (finSumBall_sound 6 CB3_2_3I1R16P CB3_2_3I1R16Value CB3_2_3I1R16P_sound) (by decide +kernel) +def CB3_2_3I1R16MassTerm : Ball := .exact 0 +lemma CB3_2_3I1R16MassTerm_sound : CB3_2_3I1R16MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB3_2_3I1R16Value a))) := + entropyTerm_zero_ball (CB3_2_3I1R16Mass_sound) +def CB3_2_3I1R16H : Ball := ⟨0, 0⟩ +lemma CB3_2_3I1R16H_sound : CB3_2_3I1R16H.Encloses (homogeneousEntropy CB3_2_3I1R16Value) := by + exact contains_sound (homogeneous_enclosed CB3_2_3I1R16Value CB3_2_3I1R16MassTerm_sound CB3_2_3I1R16Entropy_sound) (by decide +kernel) +def CB3_2_3I1ResidualEntropies (a : Fin 17) : Ball := + match a.val with + | 0 => CB3_2_3I1R0H + | 1 => CB3_2_3I1R1H + | 2 => CB3_2_3I1R2H + | 3 => CB3_2_3I1R3H + | 4 => CB3_2_3I1R4H + | 5 => CB3_2_3I1R5H + | 6 => CB3_2_3I1R6H + | 7 => CB3_2_3I1R7H + | 8 => CB3_2_3I1R8H + | 9 => CB3_2_3I1R9H + | 10 => CB3_2_3I1R10H + | 11 => CB3_2_3I1R11H + | 12 => CB3_2_3I1R12H + | 13 => CB3_2_3I1R13H + | 14 => CB3_2_3I1R14H + | 15 => CB3_2_3I1R15H + | 16 => CB3_2_3I1R16H + | _ => (.exact 0) +lemma CB3_2_3I1ResidualEntropies_sound (k : Fin 17) : + (CB3_2_3I1ResidualEntropies k).Encloses (homogeneousEntropy + (residualLaw (below (shape 3 2 3)) (fun u => (stageBLaw (shape 3 2 3) u : ℝ)) (stageBPriority (shape 3 2 3)) 1 (fun u a => (littleLaw (shape 3 2 3) u ((stageBPriority (shape 3 2 3)) 1) a : ℝ)) k)) := by + fin_cases k + · exact CB3_2_3I1R0H_sound + · exact CB3_2_3I1R1H_sound + · exact CB3_2_3I1R2H_sound + · exact CB3_2_3I1R3H_sound + · exact CB3_2_3I1R4H_sound + · exact CB3_2_3I1R5H_sound + · exact CB3_2_3I1R6H_sound + · exact CB3_2_3I1R7H_sound + · exact CB3_2_3I1R8H_sound + · exact CB3_2_3I1R9H_sound + · exact CB3_2_3I1R10H_sound + · exact CB3_2_3I1R11H_sound + · exact CB3_2_3I1R12H_sound + · exact CB3_2_3I1R13H_sound + · exact CB3_2_3I1R14H_sound + · exact CB3_2_3I1R15H_sound + · exact CB3_2_3I1R16H_sound +def CB3_2_3I1S2_2_0Value (a : Fin 6) : ℝ := (littleLaw (shape 3 2 3) (shape 2 2 0) ((stageBPriority (shape 3 2 3)) 1) a : ℝ) +def CB3_2_3I1S2_2_0E_2LogWitness : LogWitness := ⟨-1, 224407, 125000⟩ +def CB3_2_3I1S2_2_0E_2Log : Ball := ⟨(-5399977520216846740471713413351 / 50000000000000000000000000000000), (8470329473 / 20000000000000000000000000000000)⟩ +lemma CB3_2_3I1S2_2_0E_2Log_sound : CB3_2_3I1S2_2_0E_2Log.Encloses (Real.log (CB3_2_3I1S2_2_0Value (2 : Fin 6))) := by + exact checkLog_sound logTwoBall_sound ((B3_2_3Little_sound (shape 2 2 0) ((stageBPriority (shape 3 2 3)) 1)) (2 : Fin 6)) (w := CB3_2_3I1S2_2_0E_2LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB3_2_3I1S2_2_0E_2 : Ball := ⟨(9694342043034415411912286335599 / 100000000000000000000000000000000), (19008012261 / 50000000000000000000000000000000)⟩ +lemma CB3_2_3I1S2_2_0E_2_sound : CB3_2_3I1S2_2_0E_2.Encloses (Foundation.entropyTerm (CB3_2_3I1S2_2_0Value (2 : Fin 6))) := by + exact contains_sound (entropyTerm_ball ((B3_2_3Little_sound (shape 2 2 0) ((stageBPriority (shape 3 2 3)) 1)) (2 : Fin 6)) CB3_2_3I1S2_2_0E_2Log_sound) (by decide +kernel) +def CB3_2_3I1S2_2_0E_3LogWitness : LogWitness := ⟨-4, 25593, 15625⟩ +def CB3_2_3I1S2_2_0E_3Log : Ball := ⟨(-113957102063378952030784463086693 / 50000000000000000000000000000000), (21175823683 / 20000000000000000000000000000000)⟩ +lemma CB3_2_3I1S2_2_0E_3Log_sound : CB3_2_3I1S2_2_0E_3Log.Encloses (Real.log (CB3_2_3I1S2_2_0Value (3 : Fin 6))) := by + exact checkLog_sound logTwoBall_sound ((B3_2_3Little_sound (shape 2 2 0) ((stageBPriority (shape 3 2 3)) 1)) (3 : Fin 6)) (w := CB3_2_3I1S2_2_0E_3LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB3_2_3I1S2_2_0E_3 : Ball := ⟨(11666016452432230077295467055111 / 50000000000000000000000000000000), (10839057111 / 100000000000000000000000000000000)⟩ +lemma CB3_2_3I1S2_2_0E_3_sound : CB3_2_3I1S2_2_0E_3.Encloses (Foundation.entropyTerm (CB3_2_3I1S2_2_0Value (3 : Fin 6))) := by + exact contains_sound (entropyTerm_ball ((B3_2_3Little_sound (shape 2 2 0) ((stageBPriority (shape 3 2 3)) 1)) (3 : Fin 6)) CB3_2_3I1S2_2_0E_3Log_sound) (by decide +kernel) +def CB3_2_3I1S2_2_0Terms (a : Fin 6) : Ball := + match a.val with + | 2 => ⟨(9694342043034415411912286335599 / 100000000000000000000000000000000), (19008012261 / 50000000000000000000000000000000)⟩ + | 3 => ⟨(11666016452432230077295467055111 / 50000000000000000000000000000000), (10839057111 / 100000000000000000000000000000000)⟩ + | _ => (.exact 0) +lemma CB3_2_3I1S2_2_0Terms_sound (a : Fin 6) : + (CB3_2_3I1S2_2_0Terms a).Encloses (Foundation.entropyTerm (CB3_2_3I1S2_2_0Value a)) := by + fin_cases a + · exact (entropyTerm_zero_ball ((B3_2_3Little_sound (shape 2 2 0) ((stageBPriority (shape 3 2 3)) 1)) (0 : Fin 6))) + · exact (entropyTerm_zero_ball ((B3_2_3Little_sound (shape 2 2 0) ((stageBPriority (shape 3 2 3)) 1)) (1 : Fin 6))) + · exact CB3_2_3I1S2_2_0E_2_sound + · exact CB3_2_3I1S2_2_0E_3_sound + · exact (entropyTerm_zero_ball ((B3_2_3Little_sound (shape 2 2 0) ((stageBPriority (shape 3 2 3)) 1)) (4 : Fin 6))) + · exact (entropyTerm_zero_ball ((B3_2_3Little_sound (shape 2 2 0) ((stageBPriority (shape 3 2 3)) 1)) (5 : Fin 6))) +def CB3_2_3I1S2_2_0Entropy : Ball := ⟨(33026374947898875566503220445821 / 100000000000000000000000000000000), (48855081633 / 100000000000000000000000000000000)⟩ +lemma CB3_2_3I1S2_2_0Entropy_sound : CB3_2_3I1S2_2_0Entropy.Encloses (Foundation.finiteEntropy CB3_2_3I1S2_2_0Value) := by + exact contains_sound (entropyFin_enclosed 6 CB3_2_3I1S2_2_0Value CB3_2_3I1S2_2_0Terms CB3_2_3I1S2_2_0Terms_sound) (by decide +kernel) +def CB3_2_3I1S2_2_0Mass : Ball := ⟨1, 0⟩ +lemma CB3_2_3I1S2_2_0Mass_sound : CB3_2_3I1S2_2_0Mass.Encloses (∑ a, CB3_2_3I1S2_2_0Value a) := by + exact contains_sound (finSumBall_sound 6 (B3_2_3Little (shape 2 2 0) ((stageBPriority (shape 3 2 3)) 1)) CB3_2_3I1S2_2_0Value (B3_2_3Little_sound (shape 2 2 0) ((stageBPriority (shape 3 2 3)) 1))) (by decide +kernel) +def CB3_2_3I1S2_2_0MassTermLog : Ball := .exact 0 +lemma CB3_2_3I1S2_2_0MassTermLog_sound : CB3_2_3I1S2_2_0MassTermLog.Encloses (Real.log ((∑ a, CB3_2_3I1S2_2_0Value a))) := by + exact log_exact_one_ball (CB3_2_3I1S2_2_0Mass_sound) +def CB3_2_3I1S2_2_0MassTerm : Ball := ⟨0, 0⟩ +lemma CB3_2_3I1S2_2_0MassTerm_sound : CB3_2_3I1S2_2_0MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB3_2_3I1S2_2_0Value a))) := by + exact contains_sound (entropyTerm_ball (CB3_2_3I1S2_2_0Mass_sound) CB3_2_3I1S2_2_0MassTermLog_sound) (by decide +kernel) +def CB3_2_3I1S2_2_0H : Ball := ⟨(33026374947898875566503220445821 / 100000000000000000000000000000000), (48855081633 / 100000000000000000000000000000000)⟩ +lemma CB3_2_3I1S2_2_0H_sound : CB3_2_3I1S2_2_0H.Encloses (homogeneousEntropy CB3_2_3I1S2_2_0Value) := by + exact contains_sound (homogeneous_enclosed CB3_2_3I1S2_2_0Value CB3_2_3I1S2_2_0MassTerm_sound CB3_2_3I1S2_2_0Entropy_sound) (by decide +kernel) +def CB3_2_3I1S3_1_0Value (a : Fin 6) : ℝ := (littleLaw (shape 3 2 3) (shape 3 1 0) ((stageBPriority (shape 3 2 3)) 1) a : ℝ) +def CB3_2_3I1S3_1_0E_1Log : Ball := .exact 0 +lemma CB3_2_3I1S3_1_0E_1Log_sound : CB3_2_3I1S3_1_0E_1Log.Encloses (Real.log (CB3_2_3I1S3_1_0Value (1 : Fin 6))) := by + exact log_exact_one_ball ((B3_2_3Little_sound (shape 3 1 0) ((stageBPriority (shape 3 2 3)) 1)) (1 : Fin 6)) +def CB3_2_3I1S3_1_0E_1 : Ball := ⟨0, 0⟩ +lemma CB3_2_3I1S3_1_0E_1_sound : CB3_2_3I1S3_1_0E_1.Encloses (Foundation.entropyTerm (CB3_2_3I1S3_1_0Value (1 : Fin 6))) := by + exact contains_sound (entropyTerm_ball ((B3_2_3Little_sound (shape 3 1 0) ((stageBPriority (shape 3 2 3)) 1)) (1 : Fin 6)) CB3_2_3I1S3_1_0E_1Log_sound) (by decide +kernel) +def CB3_2_3I1S3_1_0Terms (a : Fin 6) : Ball := + match a.val with + | 1 => ⟨0, 0⟩ + | _ => (.exact 0) +lemma CB3_2_3I1S3_1_0Terms_sound (a : Fin 6) : + (CB3_2_3I1S3_1_0Terms a).Encloses (Foundation.entropyTerm (CB3_2_3I1S3_1_0Value a)) := by + fin_cases a + · exact (entropyTerm_zero_ball ((B3_2_3Little_sound (shape 3 1 0) ((stageBPriority (shape 3 2 3)) 1)) (0 : Fin 6))) + · exact CB3_2_3I1S3_1_0E_1_sound + · exact (entropyTerm_zero_ball ((B3_2_3Little_sound (shape 3 1 0) ((stageBPriority (shape 3 2 3)) 1)) (2 : Fin 6))) + · exact (entropyTerm_zero_ball ((B3_2_3Little_sound (shape 3 1 0) ((stageBPriority (shape 3 2 3)) 1)) (3 : Fin 6))) + · exact (entropyTerm_zero_ball ((B3_2_3Little_sound (shape 3 1 0) ((stageBPriority (shape 3 2 3)) 1)) (4 : Fin 6))) + · exact (entropyTerm_zero_ball ((B3_2_3Little_sound (shape 3 1 0) ((stageBPriority (shape 3 2 3)) 1)) (5 : Fin 6))) +def CB3_2_3I1S3_1_0Entropy : Ball := ⟨0, 0⟩ +lemma CB3_2_3I1S3_1_0Entropy_sound : CB3_2_3I1S3_1_0Entropy.Encloses (Foundation.finiteEntropy CB3_2_3I1S3_1_0Value) := by + exact contains_sound (entropyFin_enclosed 6 CB3_2_3I1S3_1_0Value CB3_2_3I1S3_1_0Terms CB3_2_3I1S3_1_0Terms_sound) (by decide +kernel) +def CB3_2_3I1S3_1_0Mass : Ball := ⟨1, 0⟩ +lemma CB3_2_3I1S3_1_0Mass_sound : CB3_2_3I1S3_1_0Mass.Encloses (∑ a, CB3_2_3I1S3_1_0Value a) := by + exact contains_sound (finSumBall_sound 6 (B3_2_3Little (shape 3 1 0) ((stageBPriority (shape 3 2 3)) 1)) CB3_2_3I1S3_1_0Value (B3_2_3Little_sound (shape 3 1 0) ((stageBPriority (shape 3 2 3)) 1))) (by decide +kernel) +def CB3_2_3I1S3_1_0MassTermLog : Ball := .exact 0 +lemma CB3_2_3I1S3_1_0MassTermLog_sound : CB3_2_3I1S3_1_0MassTermLog.Encloses (Real.log ((∑ a, CB3_2_3I1S3_1_0Value a))) := by + exact log_exact_one_ball (CB3_2_3I1S3_1_0Mass_sound) +def CB3_2_3I1S3_1_0MassTerm : Ball := ⟨0, 0⟩ +lemma CB3_2_3I1S3_1_0MassTerm_sound : CB3_2_3I1S3_1_0MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB3_2_3I1S3_1_0Value a))) := by + exact contains_sound (entropyTerm_ball (CB3_2_3I1S3_1_0Mass_sound) CB3_2_3I1S3_1_0MassTermLog_sound) (by decide +kernel) +def CB3_2_3I1S3_1_0H : Ball := ⟨0, 0⟩ +lemma CB3_2_3I1S3_1_0H_sound : CB3_2_3I1S3_1_0H.Encloses (homogeneousEntropy CB3_2_3I1S3_1_0Value) := by + exact contains_sound (homogeneous_enclosed CB3_2_3I1S3_1_0Value CB3_2_3I1S3_1_0MassTerm_sound CB3_2_3I1S3_1_0Entropy_sound) (by decide +kernel) +def CB3_2_3I1Singles (s : Shape) : Ball := + match s 0, s 1, s 2 with + | 2, 2, 0 => CB3_2_3I1S2_2_0H + | 3, 1, 0 => CB3_2_3I1S3_1_0H + | _, _, _ => (.exact 0) +lemma CB3_2_3I1Singles_sound (u : Shape) (hu : u ∈ below (shape 3 2 3)) + (hd : designated (stageBPriority (shape 3 2 3)) 1 u) : + (CB3_2_3I1Singles u).Encloses (homogeneousEntropy ((fun u a => (littleLaw (shape 3 2 3) u ((stageBPriority (shape 3 2 3)) 1) a : ℝ)) u)) := by + rw [B3_2_3_below] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl + · exact (show ¬ designated (stageBPriority (shape 3 2 3)) 1 (shape 0 1 3) by decide +kernel) hd |>.elim + · exact (show ¬ designated (stageBPriority (shape 3 2 3)) 1 (shape 0 2 2) by decide +kernel) hd |>.elim + · exact (show ¬ designated (stageBPriority (shape 3 2 3)) 1 (shape 1 0 3) by decide +kernel) hd |>.elim + · exact (show ¬ designated (stageBPriority (shape 3 2 3)) 1 (shape 1 1 2) by decide +kernel) hd |>.elim + · exact (show ¬ designated (stageBPriority (shape 3 2 3)) 1 (shape 1 2 1) by decide +kernel) hd |>.elim + · exact (show ¬ designated (stageBPriority (shape 3 2 3)) 1 (shape 2 0 2) by decide +kernel) hd |>.elim + · exact (show ¬ designated (stageBPriority (shape 3 2 3)) 1 (shape 2 1 1) by decide +kernel) hd |>.elim + · exact CB3_2_3I1S2_2_0H_sound + · exact (show ¬ designated (stageBPriority (shape 3 2 3)) 1 (shape 3 0 1) by decide +kernel) hd |>.elim + · exact CB3_2_3I1S3_1_0H_sound +def CB3_2_3I1Singleton : Ball := ⟨(76285391168564629548214282781 / 20000000000000000000000000000000), (564235257 / 100000000000000000000000000000000)⟩ +lemma CB3_2_3I1Singleton_sound : CB3_2_3I1Singleton.Encloses + (singletonEntropy (below (shape 3 2 3)) (fun u => (stageBLaw (shape 3 2 3) u : ℝ)) (stageBPriority (shape 3 2 3)) 1 (fun u a => (littleLaw (shape 3 2 3) u ((stageBPriority (shape 3 2 3)) 1) a : ℝ))) := by + exact contains_sound (singletonBall_sound (below (shape 3 2 3)) B3_2_3Law (fun u => (stageBLaw (shape 3 2 3) u : ℝ)) (stageBPriority (shape 3 2 3)) 1 + CB3_2_3I1Singles (fun u a => (littleLaw (shape 3 2 3) u ((stageBPriority (shape 3 2 3)) 1) a : ℝ)) (fun u _ => B3_2_3Law_sound u) CB3_2_3I1Singles_sound) (by decide +kernel) +def CB3_2_3I1Group : Ball := ⟨(216873172264151446702389320823 / 6250000000000000000000000000000), (14411273761 / 12500000000000000000000000000000)⟩ +lemma CB3_2_3I1Group_sound : CB3_2_3I1Group.Encloses + (groupedEntropy (below (shape 3 2 3)) (fun u => (stageBLaw (shape 3 2 3) u : ℝ)) (stageBPriority (shape 3 2 3)) 1 (fun u a => (littleLaw (shape 3 2 3) u ((stageBPriority (shape 3 2 3)) 1) a : ℝ))) := by + exact contains_sound (Ball.add_sound CB3_2_3I1Singleton_sound + (finSumBall_sound 17 CB3_2_3I1ResidualEntropies _ CB3_2_3I1ResidualEntropies_sound)) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CB3_2_3I1H : Ball := ⟨(91580157958027952226815249149943 / 100000000000000000000000000000000), (62247841667 / 20000000000000000000000000000000)⟩ +lemma CB3_2_3I1_sound : CB3_2_3I1H.Encloses (stageBCapacity (shape 3 2 3) 1) := by + have hb := contains_sound (Ball.add_sound CB3_2_3I1PairH_sound + (Ball.neg_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) CB3_2_3I1Group_sound))) + (show contains (.add CB3_2_3I1PairH (.neg (.mul (.exact 2) CB3_2_3I1Group))) CB3_2_3I1H = true by decide +kernel) + unfold CB3_2_3I1PairValue at hb + simpa only [stageBCapacity, nativeCapacity, + show (1 : Fin 3) ≠ 0 by decide, ite_false, sub_eq_add_neg] using hb + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/CapacityB/CapB3_2_3I2.lean b/lean/OAI/LinearAlgebra/MatrixFields/CapacityB/CapB3_2_3I2.lean new file mode 100644 index 0000000000000000000000000000000000000000..0476220fd958bb9baaed060d9ad21b8abe6b8c98 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/CapacityB/CapB3_2_3I2.lean @@ -0,0 +1,1052 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Certificates.SupportedContraction + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CB3_2_3I2PairValue (a : PairSlot) : ℝ := pairLaw (below (shape 3 2 3)) (shape 3 2 3) (fun u => (stageBLaw (shape 3 2 3) u : ℝ)) (fun u a => (littleLaw (shape 3 2 3) u ((stageBPriority (shape 3 2 3)) 2) a : ℝ)) a +def CB3_2_3I2PairRaw (a : PairSlot) : Ball := pairLawBall (below (shape 3 2 3)) (shape 3 2 3) B3_2_3Law (fun u => B3_2_3Little u ((stageBPriority (shape 3 2 3)) 2)) a +lemma CB3_2_3I2PairRaw_sound (a : PairSlot) : + (CB3_2_3I2PairRaw a).Encloses (CB3_2_3I2PairValue a) := by + exact pairLawBall_sound_on (below (shape 3 2 3)) (shape 3 2 3) B3_2_3Law (fun u => (stageBLaw (shape 3 2 3) u : ℝ)) (fun u => B3_2_3Little u ((stageBPriority (shape 3 2 3)) 2)) (fun u a => (littleLaw (shape 3 2 3) u ((stageBPriority (shape 3 2 3)) 2) a : ℝ)) (fun u _ => B3_2_3Law_sound u) (fun u _ a => B3_2_3Little_sound u ((stageBPriority (shape 3 2 3)) 2) a) (fun u _ a => B3_2_3Little_sound (complement (shape 3 2 3) u) ((stageBPriority (shape 3 2 3)) 2) a) a +def CB3_2_3I2PairCertificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(657827693429655515259251577397 / 50000000000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ ⟨(45583093825531771912031644789 / 800000000000000000000000000000), (2228806953 / 100000000000000000000000000000000)⟩ ⟨(-86616705029320451336803587500113 / 20000000000000000000000000000000), (1058791187 / 625000000000000000000000000000)⟩ ⟨-7, 657827693429655515259251577397, 390625000000000000000000000000⟩, + .log ⟨(2331743502850952336234925741329 / 5000000000000000000000000000000), (49 / 100000000000000000000000000000000)⟩ ⟨(17787044033619589124032271066687 / 50000000000000000000000000000000), (14812976831 / 50000000000000000000000000000000)⟩ ⟨(-9535270502454444362956674459109 / 12500000000000000000000000000000), (31763735577 / 50000000000000000000000000000000)⟩ ⟨-2, 2331743502850952336234925741329, 1250000000000000000000000000000⟩, + .log ⟨(1024737278060821122391491009313 / 50000000000000000000000000000000), (1 / 20000000000000000000000000000000)⟩ ⟨(3983755053946318443989142025409 / 50000000000000000000000000000000), (1518975927 / 50000000000000000000000000000000)⟩ ⟨(-97189668494471200819375168657627 / 25000000000000000000000000000000), (5929230641 / 4000000000000000000000000000000)⟩ ⟨-6, 1024737278060821122391491009313, 781250000000000000000000000000⟩] +lemma CB3_2_3I2PairCertificates_valid : + CB3_2_3I2PairCertificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB3_2_3I2PairCertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 4, 0 => 1 + | 2, 1 => 2 + | 3, 1 => 3 + | 1, 2 => 2 + | 1, 3 => 3 + | 0, 4 => 1 + | _, _ => 0 +def CB3_2_3I2PairP (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CB3_2_3I2PairCertificates (CB3_2_3I2PairCertificateIndex a)).input +lemma CB3_2_3I2PairP_check : ∀ a : PairSlot, contains (CB3_2_3I2PairRaw a) (CB3_2_3I2PairP a) = true := by + decide +kernel +lemma CB3_2_3I2PairP_sound (a : PairSlot) : + (CB3_2_3I2PairP a).Encloses (CB3_2_3I2PairValue a) := + contains_sound (CB3_2_3I2PairRaw_sound a) (CB3_2_3I2PairP_check a) +def CB3_2_3I2PairTerms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CB3_2_3I2PairCertificates (CB3_2_3I2PairCertificateIndex a)).output +lemma CB3_2_3I2PairTerms_sound (a : PairSlot) : + (CB3_2_3I2PairTerms a).Encloses (Foundation.entropyTerm (CB3_2_3I2PairValue a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB3_2_3I2PairCertificates_valid + (CB3_2_3I2PairCertificateIndex a) (CB3_2_3I2PairP_sound a) +def CB3_2_3I2PairEntropy : Ball := ⟨(49239484903323286625046781782817 / 50000000000000000000000000000000), (34892712469 / 50000000000000000000000000000000)⟩ +lemma CB3_2_3I2PairEntropy_sound : CB3_2_3I2PairEntropy.Encloses (Foundation.finiteEntropy CB3_2_3I2PairValue) := by + exact contains_sound (entropyPair_enclosed CB3_2_3I2PairValue CB3_2_3I2PairTerms CB3_2_3I2PairTerms_sound) (by decide +kernel) +def CB3_2_3I2PairMass : Ball := ⟨1, (3 / 2500000000000000000000000000000)⟩ +lemma CB3_2_3I2PairMass_sound : CB3_2_3I2PairMass.Encloses (∑ a, CB3_2_3I2PairValue a) := by + exact contains_sound (pairSumBall_sound CB3_2_3I2PairP CB3_2_3I2PairValue CB3_2_3I2PairP_sound) (by decide +kernel) +def CB3_2_3I2PairMassTermLogWitness : LogWitness := ⟨0, 1, 1⟩ +def CB3_2_3I2PairMassTermLog : Ball := ⟨0, (10587911901 / 50000000000000000000000000000000)⟩ +lemma CB3_2_3I2PairMassTermLog_sound : CB3_2_3I2PairMassTermLog.Encloses (Real.log ((∑ a, CB3_2_3I2PairValue a))) := by + exact checkLog_sound logTwoBall_sound (CB3_2_3I2PairMass_sound) (w := CB3_2_3I2PairMassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB3_2_3I2PairMassTerm : Ball := ⟨0, (21175823803 / 100000000000000000000000000000000)⟩ +lemma CB3_2_3I2PairMassTerm_sound : CB3_2_3I2PairMassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB3_2_3I2PairValue a))) := by + exact contains_sound (entropyTerm_ball (CB3_2_3I2PairMass_sound) CB3_2_3I2PairMassTermLog_sound) (by decide +kernel) +def CB3_2_3I2PairH : Ball := ⟨(49239484903323286625046781782817 / 50000000000000000000000000000000), (90961248741 / 100000000000000000000000000000000)⟩ +lemma CB3_2_3I2PairH_sound : CB3_2_3I2PairH.Encloses (homogeneousEntropy CB3_2_3I2PairValue) := by + exact contains_sound (homogeneous_enclosed CB3_2_3I2PairValue CB3_2_3I2PairMassTerm_sound CB3_2_3I2PairEntropy_sound) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CB3_2_3I2R0Value (a : Fin 6) : ℝ := residualLaw (below (shape 3 2 3)) (fun u => (stageBLaw (shape 3 2 3) u : ℝ)) (stageBPriority (shape 3 2 3)) 2 (fun u a => (littleLaw (shape 3 2 3) u ((stageBPriority (shape 3 2 3)) 2) a : ℝ)) 0 a +def CB3_2_3I2R0Raw (a : Fin 6) : Ball := residualBall (below (shape 3 2 3)) B3_2_3Law (stageBPriority (shape 3 2 3)) 2 (fun u => B3_2_3Little u ((stageBPriority (shape 3 2 3)) 2)) 0 a +lemma CB3_2_3I2R0Raw_sound (a : Fin 6) : + (CB3_2_3I2R0Raw a).Encloses (CB3_2_3I2R0Value a) := by + exact residualBall_sound_on (below (shape 3 2 3)) B3_2_3Law (fun u => (stageBLaw (shape 3 2 3) u : ℝ)) (stageBPriority (shape 3 2 3)) 2 (fun u => B3_2_3Little u ((stageBPriority (shape 3 2 3)) 2)) (fun u a => (littleLaw (shape 3 2 3) u ((stageBPriority (shape 3 2 3)) 2) a : ℝ)) (fun u _ => B3_2_3Law_sound u) (fun u _ a => B3_2_3Little_sound u ((stageBPriority (shape 3 2 3)) 2) a) 0 a +def CB3_2_3I2R0Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(657827693429655515259251577397 / 50000000000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ ⟨(45583093825531771912031644789 / 800000000000000000000000000000), (2228806953 / 100000000000000000000000000000000)⟩ ⟨(-86616705029320451336803587500113 / 20000000000000000000000000000000), (1058791187 / 625000000000000000000000000000)⟩ ⟨-7, 657827693429655515259251577397, 390625000000000000000000000000⟩] +lemma CB3_2_3I2R0Certificates_valid : + CB3_2_3I2R0Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB3_2_3I2R0CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | 0 => 1 + | _ => 0 +def CB3_2_3I2R0P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_2_3I2R0Certificates (CB3_2_3I2R0CertificateIndex a)).input +lemma CB3_2_3I2R0P_check : ∀ a : Fin 6, contains (CB3_2_3I2R0Raw a) (CB3_2_3I2R0P a) = true := by + decide +kernel +lemma CB3_2_3I2R0P_sound (a : Fin 6) : + (CB3_2_3I2R0P a).Encloses (CB3_2_3I2R0Value a) := + contains_sound (CB3_2_3I2R0Raw_sound a) (CB3_2_3I2R0P_check a) +def CB3_2_3I2R0Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_2_3I2R0Certificates (CB3_2_3I2R0CertificateIndex a)).output +lemma CB3_2_3I2R0Terms_sound (a : Fin 6) : + (CB3_2_3I2R0Terms a).Encloses (Foundation.entropyTerm (CB3_2_3I2R0Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB3_2_3I2R0Certificates_valid + (CB3_2_3I2R0CertificateIndex a) (CB3_2_3I2R0P_sound a) +def CB3_2_3I2R0Entropy : Ball := ⟨(45583093825531771912031644789 / 800000000000000000000000000000), (2228806953 / 100000000000000000000000000000000)⟩ +lemma CB3_2_3I2R0Entropy_sound : CB3_2_3I2R0Entropy.Encloses (Foundation.finiteEntropy CB3_2_3I2R0Value) := by + exact contains_sound (entropyFin_enclosed 6 CB3_2_3I2R0Value CB3_2_3I2R0Terms CB3_2_3I2R0Terms_sound) (by decide +kernel) +def CB3_2_3I2R0Mass : Ball := ⟨(657827693429655515259251577397 / 50000000000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ +lemma CB3_2_3I2R0Mass_sound : CB3_2_3I2R0Mass.Encloses (∑ a, CB3_2_3I2R0Value a) := by + exact contains_sound (finSumBall_sound 6 CB3_2_3I2R0P CB3_2_3I2R0Value CB3_2_3I2R0P_sound) (by decide +kernel) +def CB3_2_3I2R0MassTermLogWitness : LogWitness := ⟨-7, 657827693429655515259251577397, 390625000000000000000000000000⟩ +def CB3_2_3I2R0MassTermLog : Ball := ⟨(-86616705029320451336803587500113 / 20000000000000000000000000000000), (1058791187 / 625000000000000000000000000000)⟩ +lemma CB3_2_3I2R0MassTermLog_sound : CB3_2_3I2R0MassTermLog.Encloses (Real.log ((∑ a, CB3_2_3I2R0Value a))) := by + exact checkLog_sound logTwoBall_sound (CB3_2_3I2R0Mass_sound) (w := CB3_2_3I2R0MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB3_2_3I2R0MassTerm : Ball := ⟨(45583093825531771912031644789 / 800000000000000000000000000000), (2228806953 / 100000000000000000000000000000000)⟩ +lemma CB3_2_3I2R0MassTerm_sound : CB3_2_3I2R0MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB3_2_3I2R0Value a))) := by + exact contains_sound (entropyTerm_ball (CB3_2_3I2R0Mass_sound) CB3_2_3I2R0MassTermLog_sound) (by decide +kernel) +def CB3_2_3I2R0H : Ball := ⟨0, (2228806953 / 50000000000000000000000000000000)⟩ +lemma CB3_2_3I2R0H_sound : CB3_2_3I2R0H.Encloses (homogeneousEntropy CB3_2_3I2R0Value) := by + exact contains_sound (homogeneous_enclosed CB3_2_3I2R0Value CB3_2_3I2R0MassTerm_sound CB3_2_3I2R0Entropy_sound) (by decide +kernel) +def CB3_2_3I2R1Value (a : Fin 6) : ℝ := residualLaw (below (shape 3 2 3)) (fun u => (stageBLaw (shape 3 2 3) u : ℝ)) (stageBPriority (shape 3 2 3)) 2 (fun u a => (littleLaw (shape 3 2 3) u ((stageBPriority (shape 3 2 3)) 2) a : ℝ)) 1 a +def CB3_2_3I2R1Raw (a : Fin 6) : Ball := residualBall (below (shape 3 2 3)) B3_2_3Law (stageBPriority (shape 3 2 3)) 2 (fun u => B3_2_3Little u ((stageBPriority (shape 3 2 3)) 2)) 1 a +lemma CB3_2_3I2R1Raw_sound (a : Fin 6) : + (CB3_2_3I2R1Raw a).Encloses (CB3_2_3I2R1Value a) := by + exact residualBall_sound_on (below (shape 3 2 3)) B3_2_3Law (fun u => (stageBLaw (shape 3 2 3) u : ℝ)) (stageBPriority (shape 3 2 3)) 2 (fun u => B3_2_3Little u ((stageBPriority (shape 3 2 3)) 2)) (fun u a => (littleLaw (shape 3 2 3) u ((stageBPriority (shape 3 2 3)) 2) a : ℝ)) (fun u _ => B3_2_3Law_sound u) (fun u _ a => B3_2_3Little_sound u ((stageBPriority (shape 3 2 3)) 2) a) 1 a +def CB3_2_3I2R1Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(47523174992684098213642460905101 / 100000000000000000000000000000000), (3 / 6250000000000000000000000000000)⟩ ⟨(35354994317325124691906992926299 / 100000000000000000000000000000000), (30190271319 / 100000000000000000000000000000000)⟩ ⟨(-74395269934653586537561574687477 / 100000000000000000000000000000000), (1270549423 / 2000000000000000000000000000000)⟩ ⟨-2, 47523174992684098213642460905101, 25000000000000000000000000000000⟩] +lemma CB3_2_3I2R1Certificates_valid : + CB3_2_3I2R1Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB3_2_3I2R1CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | 1 => 1 + | _ => 0 +def CB3_2_3I2R1P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_2_3I2R1Certificates (CB3_2_3I2R1CertificateIndex a)).input +lemma CB3_2_3I2R1P_check : ∀ a : Fin 6, contains (CB3_2_3I2R1Raw a) (CB3_2_3I2R1P a) = true := by + decide +kernel +lemma CB3_2_3I2R1P_sound (a : Fin 6) : + (CB3_2_3I2R1P a).Encloses (CB3_2_3I2R1Value a) := + contains_sound (CB3_2_3I2R1Raw_sound a) (CB3_2_3I2R1P_check a) +def CB3_2_3I2R1Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_2_3I2R1Certificates (CB3_2_3I2R1CertificateIndex a)).output +lemma CB3_2_3I2R1Terms_sound (a : Fin 6) : + (CB3_2_3I2R1Terms a).Encloses (Foundation.entropyTerm (CB3_2_3I2R1Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB3_2_3I2R1Certificates_valid + (CB3_2_3I2R1CertificateIndex a) (CB3_2_3I2R1P_sound a) +def CB3_2_3I2R1Entropy : Ball := ⟨(35354994317325124691906992926299 / 100000000000000000000000000000000), (30190271319 / 100000000000000000000000000000000)⟩ +lemma CB3_2_3I2R1Entropy_sound : CB3_2_3I2R1Entropy.Encloses (Foundation.finiteEntropy CB3_2_3I2R1Value) := by + exact contains_sound (entropyFin_enclosed 6 CB3_2_3I2R1Value CB3_2_3I2R1Terms CB3_2_3I2R1Terms_sound) (by decide +kernel) +def CB3_2_3I2R1Mass : Ball := ⟨(47523174992684098213642460905101 / 100000000000000000000000000000000), (3 / 6250000000000000000000000000000)⟩ +lemma CB3_2_3I2R1Mass_sound : CB3_2_3I2R1Mass.Encloses (∑ a, CB3_2_3I2R1Value a) := by + exact contains_sound (finSumBall_sound 6 CB3_2_3I2R1P CB3_2_3I2R1Value CB3_2_3I2R1P_sound) (by decide +kernel) +def CB3_2_3I2R1MassTermLogWitness : LogWitness := ⟨-2, 47523174992684098213642460905101, 25000000000000000000000000000000⟩ +def CB3_2_3I2R1MassTermLog : Ball := ⟨(-74395269934653586537561574687477 / 100000000000000000000000000000000), (1270549423 / 2000000000000000000000000000000)⟩ +lemma CB3_2_3I2R1MassTermLog_sound : CB3_2_3I2R1MassTermLog.Encloses (Real.log ((∑ a, CB3_2_3I2R1Value a))) := by + exact checkLog_sound logTwoBall_sound (CB3_2_3I2R1Mass_sound) (w := CB3_2_3I2R1MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB3_2_3I2R1MassTerm : Ball := ⟨(35354994317325124691906992926299 / 100000000000000000000000000000000), (30190271319 / 100000000000000000000000000000000)⟩ +lemma CB3_2_3I2R1MassTerm_sound : CB3_2_3I2R1MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB3_2_3I2R1Value a))) := by + exact contains_sound (entropyTerm_ball (CB3_2_3I2R1Mass_sound) CB3_2_3I2R1MassTermLog_sound) (by decide +kernel) +def CB3_2_3I2R1H : Ball := ⟨0, (30190271319 / 50000000000000000000000000000000)⟩ +lemma CB3_2_3I2R1H_sound : CB3_2_3I2R1H.Encloses (homogeneousEntropy CB3_2_3I2R1Value) := by + exact contains_sound (homogeneous_enclosed CB3_2_3I2R1Value CB3_2_3I2R1MassTerm_sound CB3_2_3I2R1Entropy_sound) (by decide +kernel) +def CB3_2_3I2R2Value (a : Fin 6) : ℝ := residualLaw (below (shape 3 2 3)) (fun u => (stageBLaw (shape 3 2 3) u : ℝ)) (stageBPriority (shape 3 2 3)) 2 (fun u a => (littleLaw (shape 3 2 3) u ((stageBPriority (shape 3 2 3)) 2) a : ℝ)) 2 a +def CB3_2_3I2R2Raw (a : Fin 6) : Ball := residualBall (below (shape 3 2 3)) B3_2_3Law (stageBPriority (shape 3 2 3)) 2 (fun u => B3_2_3Little u ((stageBPriority (shape 3 2 3)) 2)) 2 a +lemma CB3_2_3I2R2Raw_sound (a : Fin 6) : + (CB3_2_3I2R2Raw a).Encloses (CB3_2_3I2R2Value a) := by + exact residualBall_sound_on (below (shape 3 2 3)) B3_2_3Law (fun u => (stageBLaw (shape 3 2 3) u : ℝ)) (stageBPriority (shape 3 2 3)) 2 (fun u => B3_2_3Little u ((stageBPriority (shape 3 2 3)) 2)) (fun u a => (littleLaw (shape 3 2 3) u ((stageBPriority (shape 3 2 3)) 2) a : ℝ)) (fun u _ => B3_2_3Law_sound u) (fun u _ a => B3_2_3Little_sound u ((stageBPriority (shape 3 2 3)) 2) a) 2 a +def CB3_2_3I2R2Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(31201979708678060382710687550019 / 100000000000000000000000000000000), (9 / 50000000000000000000000000000000)⟩ ⟨(36340591342924341329964561629037 / 100000000000000000000000000000000), (9910914333 / 50000000000000000000000000000000)⟩ ⟨(-116468864098444057946888340040549 / 100000000000000000000000000000000), (31763735553 / 50000000000000000000000000000000)⟩ ⟨-2, 31201979708678060382710687550019, 25000000000000000000000000000000⟩, + .log ⟨(37111064369939316642335233719 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(966775283033390482170794711793 / 100000000000000000000000000000000), (69155449 / 20000000000000000000000000000000)⟩ ⟨(-651271594770330307327486077108119 / 100000000000000000000000000000000), (116467030593 / 50000000000000000000000000000000)⟩ ⟨-10, 37111064369939316642335233719, 24414062500000000000000000000⟩] +lemma CB3_2_3I2R2Certificates_valid : + CB3_2_3I2R2Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB3_2_3I2R2CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | 2 => 1 + | 3 => 2 + | _ => 0 +def CB3_2_3I2R2P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_2_3I2R2Certificates (CB3_2_3I2R2CertificateIndex a)).input +lemma CB3_2_3I2R2P_check : ∀ a : Fin 6, contains (CB3_2_3I2R2Raw a) (CB3_2_3I2R2P a) = true := by + decide +kernel +lemma CB3_2_3I2R2P_sound (a : Fin 6) : + (CB3_2_3I2R2P a).Encloses (CB3_2_3I2R2Value a) := + contains_sound (CB3_2_3I2R2Raw_sound a) (CB3_2_3I2R2P_check a) +def CB3_2_3I2R2Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_2_3I2R2Certificates (CB3_2_3I2R2CertificateIndex a)).output +lemma CB3_2_3I2R2Terms_sound (a : Fin 6) : + (CB3_2_3I2R2Terms a).Encloses (Foundation.entropyTerm (CB3_2_3I2R2Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB3_2_3I2R2Certificates_valid + (CB3_2_3I2R2CertificateIndex a) (CB3_2_3I2R2P_sound a) +def CB3_2_3I2R2Entropy : Ball := ⟨(3730736662595773181213535634083 / 10000000000000000000000000000000), (20167605911 / 100000000000000000000000000000000)⟩ +lemma CB3_2_3I2R2Entropy_sound : CB3_2_3I2R2Entropy.Encloses (Foundation.finiteEntropy CB3_2_3I2R2Value) := by + exact contains_sound (entropyFin_enclosed 6 CB3_2_3I2R2Value CB3_2_3I2R2Terms CB3_2_3I2R2Terms_sound) (by decide +kernel) +def CB3_2_3I2R2Mass : Ball := ⟨(6270084793231563529856005696979 / 20000000000000000000000000000000), (19 / 100000000000000000000000000000000)⟩ +lemma CB3_2_3I2R2Mass_sound : CB3_2_3I2R2Mass.Encloses (∑ a, CB3_2_3I2R2Value a) := by + exact contains_sound (finSumBall_sound 6 CB3_2_3I2R2P CB3_2_3I2R2Value CB3_2_3I2R2P_sound) (by decide +kernel) +def CB3_2_3I2R2MassTermLogWitness : LogWitness := ⟨-2, 6270084793231563529856005696979, 5000000000000000000000000000000⟩ +def CB3_2_3I2R2MassTermLog : Ball := ⟨(-28998559883980189693420039678553 / 25000000000000000000000000000000), (63527471109 / 100000000000000000000000000000000)⟩ +lemma CB3_2_3I2R2MassTermLog_sound : CB3_2_3I2R2MassTermLog.Encloses (Real.log ((∑ a, CB3_2_3I2R2Value a))) := by + exact checkLog_sound logTwoBall_sound (CB3_2_3I2R2Mass_sound) (w := CB3_2_3I2R2MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB3_2_3I2R2MassTerm : Ball := ⟨(7272937174166361623897741548253 / 20000000000000000000000000000000), (19916131551 / 100000000000000000000000000000000)⟩ +lemma CB3_2_3I2R2MassTerm_sound : CB3_2_3I2R2MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB3_2_3I2R2Value a))) := by + exact contains_sound (entropyTerm_ball (CB3_2_3I2R2Mass_sound) CB3_2_3I2R2MassTermLog_sound) (by decide +kernel) +def CB3_2_3I2R2H : Ball := ⟨(188536151025184738529329719913 / 20000000000000000000000000000000), (20041868731 / 50000000000000000000000000000000)⟩ +lemma CB3_2_3I2R2H_sound : CB3_2_3I2R2H.Encloses (homogeneousEntropy CB3_2_3I2R2Value) := by + exact contains_sound (homogeneous_enclosed CB3_2_3I2R2Value CB3_2_3I2R2MassTerm_sound CB3_2_3I2R2Entropy_sound) (by decide +kernel) +def CB3_2_3I2R3Value (a : Fin 6) : ℝ := residualLaw (below (shape 3 2 3)) (fun u => (stageBLaw (shape 3 2 3) u : ℝ)) (stageBPriority (shape 3 2 3)) 2 (fun u a => (littleLaw (shape 3 2 3) u ((stageBPriority (shape 3 2 3)) 2) a : ℝ)) 3 a +def CB3_2_3I2R3Raw (a : Fin 6) : Ball := residualBall (below (shape 3 2 3)) B3_2_3Law (stageBPriority (shape 3 2 3)) 2 (fun u => B3_2_3Little u ((stageBPriority (shape 3 2 3)) 2)) 3 a +lemma CB3_2_3I2R3Raw_sound (a : Fin 6) : + (CB3_2_3I2R3Raw a).Encloses (CB3_2_3I2R3Value a) := by + exact residualBall_sound_on (below (shape 3 2 3)) B3_2_3Law (fun u => (stageBLaw (shape 3 2 3) u : ℝ)) (stageBPriority (shape 3 2 3)) 2 (fun u => B3_2_3Little u ((stageBPriority (shape 3 2 3)) 2)) (fun u a => (littleLaw (shape 3 2 3) u ((stageBPriority (shape 3 2 3)) 2) a : ℝ)) (fun u _ => B3_2_3Law_sound u) (fun u _ a => B3_2_3Little_sound u ((stageBPriority (shape 3 2 3)) 2) a) 3 a +def CB3_2_3I2R3Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB3_2_3I2R3Certificates_valid : + CB3_2_3I2R3Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB3_2_3I2R3CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB3_2_3I2R3P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_2_3I2R3Certificates (CB3_2_3I2R3CertificateIndex a)).input +lemma CB3_2_3I2R3P_check : ∀ a : Fin 6, contains (CB3_2_3I2R3Raw a) (CB3_2_3I2R3P a) = true := by + decide +kernel +lemma CB3_2_3I2R3P_sound (a : Fin 6) : + (CB3_2_3I2R3P a).Encloses (CB3_2_3I2R3Value a) := + contains_sound (CB3_2_3I2R3Raw_sound a) (CB3_2_3I2R3P_check a) +def CB3_2_3I2R3Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_2_3I2R3Certificates (CB3_2_3I2R3CertificateIndex a)).output +lemma CB3_2_3I2R3Terms_sound (a : Fin 6) : + (CB3_2_3I2R3Terms a).Encloses (Foundation.entropyTerm (CB3_2_3I2R3Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB3_2_3I2R3Certificates_valid + (CB3_2_3I2R3CertificateIndex a) (CB3_2_3I2R3P_sound a) +def CB3_2_3I2R3Entropy : Ball := ⟨0, 0⟩ +lemma CB3_2_3I2R3Entropy_sound : CB3_2_3I2R3Entropy.Encloses (Foundation.finiteEntropy CB3_2_3I2R3Value) := by + exact contains_sound (entropyFin_enclosed 6 CB3_2_3I2R3Value CB3_2_3I2R3Terms CB3_2_3I2R3Terms_sound) (by decide +kernel) +def CB3_2_3I2R3Mass : Ball := ⟨0, 0⟩ +lemma CB3_2_3I2R3Mass_sound : CB3_2_3I2R3Mass.Encloses (∑ a, CB3_2_3I2R3Value a) := by + exact contains_sound (finSumBall_sound 6 CB3_2_3I2R3P CB3_2_3I2R3Value CB3_2_3I2R3P_sound) (by decide +kernel) +def CB3_2_3I2R3MassTerm : Ball := .exact 0 +lemma CB3_2_3I2R3MassTerm_sound : CB3_2_3I2R3MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB3_2_3I2R3Value a))) := + entropyTerm_zero_ball (CB3_2_3I2R3Mass_sound) +def CB3_2_3I2R3H : Ball := ⟨0, 0⟩ +lemma CB3_2_3I2R3H_sound : CB3_2_3I2R3H.Encloses (homogeneousEntropy CB3_2_3I2R3Value) := by + exact contains_sound (homogeneous_enclosed CB3_2_3I2R3Value CB3_2_3I2R3MassTerm_sound CB3_2_3I2R3Entropy_sound) (by decide +kernel) +def CB3_2_3I2R4Value (a : Fin 6) : ℝ := residualLaw (below (shape 3 2 3)) (fun u => (stageBLaw (shape 3 2 3) u : ℝ)) (stageBPriority (shape 3 2 3)) 2 (fun u a => (littleLaw (shape 3 2 3) u ((stageBPriority (shape 3 2 3)) 2) a : ℝ)) 4 a +def CB3_2_3I2R4Raw (a : Fin 6) : Ball := residualBall (below (shape 3 2 3)) B3_2_3Law (stageBPriority (shape 3 2 3)) 2 (fun u => B3_2_3Little u ((stageBPriority (shape 3 2 3)) 2)) 4 a +lemma CB3_2_3I2R4Raw_sound (a : Fin 6) : + (CB3_2_3I2R4Raw a).Encloses (CB3_2_3I2R4Value a) := by + exact residualBall_sound_on (below (shape 3 2 3)) B3_2_3Law (fun u => (stageBLaw (shape 3 2 3) u : ℝ)) (stageBPriority (shape 3 2 3)) 2 (fun u => B3_2_3Little u ((stageBPriority (shape 3 2 3)) 2)) (fun u a => (littleLaw (shape 3 2 3) u ((stageBPriority (shape 3 2 3)) 2) a : ℝ)) (fun u _ => B3_2_3Law_sound u) (fun u _ a => B3_2_3Little_sound u ((stageBPriority (shape 3 2 3)) 2) a) 4 a +def CB3_2_3I2R4Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB3_2_3I2R4Certificates_valid : + CB3_2_3I2R4Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB3_2_3I2R4CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB3_2_3I2R4P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_2_3I2R4Certificates (CB3_2_3I2R4CertificateIndex a)).input +lemma CB3_2_3I2R4P_check : ∀ a : Fin 6, contains (CB3_2_3I2R4Raw a) (CB3_2_3I2R4P a) = true := by + decide +kernel +lemma CB3_2_3I2R4P_sound (a : Fin 6) : + (CB3_2_3I2R4P a).Encloses (CB3_2_3I2R4Value a) := + contains_sound (CB3_2_3I2R4Raw_sound a) (CB3_2_3I2R4P_check a) +def CB3_2_3I2R4Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_2_3I2R4Certificates (CB3_2_3I2R4CertificateIndex a)).output +lemma CB3_2_3I2R4Terms_sound (a : Fin 6) : + (CB3_2_3I2R4Terms a).Encloses (Foundation.entropyTerm (CB3_2_3I2R4Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB3_2_3I2R4Certificates_valid + (CB3_2_3I2R4CertificateIndex a) (CB3_2_3I2R4P_sound a) +def CB3_2_3I2R4Entropy : Ball := ⟨0, 0⟩ +lemma CB3_2_3I2R4Entropy_sound : CB3_2_3I2R4Entropy.Encloses (Foundation.finiteEntropy CB3_2_3I2R4Value) := by + exact contains_sound (entropyFin_enclosed 6 CB3_2_3I2R4Value CB3_2_3I2R4Terms CB3_2_3I2R4Terms_sound) (by decide +kernel) +def CB3_2_3I2R4Mass : Ball := ⟨0, 0⟩ +lemma CB3_2_3I2R4Mass_sound : CB3_2_3I2R4Mass.Encloses (∑ a, CB3_2_3I2R4Value a) := by + exact contains_sound (finSumBall_sound 6 CB3_2_3I2R4P CB3_2_3I2R4Value CB3_2_3I2R4P_sound) (by decide +kernel) +def CB3_2_3I2R4MassTerm : Ball := .exact 0 +lemma CB3_2_3I2R4MassTerm_sound : CB3_2_3I2R4MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB3_2_3I2R4Value a))) := + entropyTerm_zero_ball (CB3_2_3I2R4Mass_sound) +def CB3_2_3I2R4H : Ball := ⟨0, 0⟩ +lemma CB3_2_3I2R4H_sound : CB3_2_3I2R4H.Encloses (homogeneousEntropy CB3_2_3I2R4Value) := by + exact contains_sound (homogeneous_enclosed CB3_2_3I2R4Value CB3_2_3I2R4MassTerm_sound CB3_2_3I2R4Entropy_sound) (by decide +kernel) +def CB3_2_3I2R5Value (a : Fin 6) : ℝ := residualLaw (below (shape 3 2 3)) (fun u => (stageBLaw (shape 3 2 3) u : ℝ)) (stageBPriority (shape 3 2 3)) 2 (fun u a => (littleLaw (shape 3 2 3) u ((stageBPriority (shape 3 2 3)) 2) a : ℝ)) 5 a +def CB3_2_3I2R5Raw (a : Fin 6) : Ball := residualBall (below (shape 3 2 3)) B3_2_3Law (stageBPriority (shape 3 2 3)) 2 (fun u => B3_2_3Little u ((stageBPriority (shape 3 2 3)) 2)) 5 a +lemma CB3_2_3I2R5Raw_sound (a : Fin 6) : + (CB3_2_3I2R5Raw a).Encloses (CB3_2_3I2R5Value a) := by + exact residualBall_sound_on (below (shape 3 2 3)) B3_2_3Law (fun u => (stageBLaw (shape 3 2 3) u : ℝ)) (stageBPriority (shape 3 2 3)) 2 (fun u => B3_2_3Little u ((stageBPriority (shape 3 2 3)) 2)) (fun u a => (littleLaw (shape 3 2 3) u ((stageBPriority (shape 3 2 3)) 2) a : ℝ)) (fun u _ => B3_2_3Law_sound u) (fun u _ a => B3_2_3Little_sound u ((stageBPriority (shape 3 2 3)) 2) a) 5 a +def CB3_2_3I2R5Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB3_2_3I2R5Certificates_valid : + CB3_2_3I2R5Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB3_2_3I2R5CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB3_2_3I2R5P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_2_3I2R5Certificates (CB3_2_3I2R5CertificateIndex a)).input +lemma CB3_2_3I2R5P_check : ∀ a : Fin 6, contains (CB3_2_3I2R5Raw a) (CB3_2_3I2R5P a) = true := by + decide +kernel +lemma CB3_2_3I2R5P_sound (a : Fin 6) : + (CB3_2_3I2R5P a).Encloses (CB3_2_3I2R5Value a) := + contains_sound (CB3_2_3I2R5Raw_sound a) (CB3_2_3I2R5P_check a) +def CB3_2_3I2R5Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_2_3I2R5Certificates (CB3_2_3I2R5CertificateIndex a)).output +lemma CB3_2_3I2R5Terms_sound (a : Fin 6) : + (CB3_2_3I2R5Terms a).Encloses (Foundation.entropyTerm (CB3_2_3I2R5Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB3_2_3I2R5Certificates_valid + (CB3_2_3I2R5CertificateIndex a) (CB3_2_3I2R5P_sound a) +def CB3_2_3I2R5Entropy : Ball := ⟨0, 0⟩ +lemma CB3_2_3I2R5Entropy_sound : CB3_2_3I2R5Entropy.Encloses (Foundation.finiteEntropy CB3_2_3I2R5Value) := by + exact contains_sound (entropyFin_enclosed 6 CB3_2_3I2R5Value CB3_2_3I2R5Terms CB3_2_3I2R5Terms_sound) (by decide +kernel) +def CB3_2_3I2R5Mass : Ball := ⟨0, 0⟩ +lemma CB3_2_3I2R5Mass_sound : CB3_2_3I2R5Mass.Encloses (∑ a, CB3_2_3I2R5Value a) := by + exact contains_sound (finSumBall_sound 6 CB3_2_3I2R5P CB3_2_3I2R5Value CB3_2_3I2R5P_sound) (by decide +kernel) +def CB3_2_3I2R5MassTerm : Ball := .exact 0 +lemma CB3_2_3I2R5MassTerm_sound : CB3_2_3I2R5MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB3_2_3I2R5Value a))) := + entropyTerm_zero_ball (CB3_2_3I2R5Mass_sound) +def CB3_2_3I2R5H : Ball := ⟨0, 0⟩ +lemma CB3_2_3I2R5H_sound : CB3_2_3I2R5H.Encloses (homogeneousEntropy CB3_2_3I2R5Value) := by + exact contains_sound (homogeneous_enclosed CB3_2_3I2R5Value CB3_2_3I2R5MassTerm_sound CB3_2_3I2R5Entropy_sound) (by decide +kernel) +def CB3_2_3I2R6Value (a : Fin 6) : ℝ := residualLaw (below (shape 3 2 3)) (fun u => (stageBLaw (shape 3 2 3) u : ℝ)) (stageBPriority (shape 3 2 3)) 2 (fun u a => (littleLaw (shape 3 2 3) u ((stageBPriority (shape 3 2 3)) 2) a : ℝ)) 6 a +def CB3_2_3I2R6Raw (a : Fin 6) : Ball := residualBall (below (shape 3 2 3)) B3_2_3Law (stageBPriority (shape 3 2 3)) 2 (fun u => B3_2_3Little u ((stageBPriority (shape 3 2 3)) 2)) 6 a +lemma CB3_2_3I2R6Raw_sound (a : Fin 6) : + (CB3_2_3I2R6Raw a).Encloses (CB3_2_3I2R6Value a) := by + exact residualBall_sound_on (below (shape 3 2 3)) B3_2_3Law (fun u => (stageBLaw (shape 3 2 3) u : ℝ)) (stageBPriority (shape 3 2 3)) 2 (fun u => B3_2_3Little u ((stageBPriority (shape 3 2 3)) 2)) (fun u a => (littleLaw (shape 3 2 3) u ((stageBPriority (shape 3 2 3)) 2) a : ℝ)) (fun u _ => B3_2_3Law_sound u) (fun u _ a => B3_2_3Little_sound u ((stageBPriority (shape 3 2 3)) 2) a) 6 a +def CB3_2_3I2R6Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB3_2_3I2R6Certificates_valid : + CB3_2_3I2R6Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB3_2_3I2R6CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB3_2_3I2R6P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_2_3I2R6Certificates (CB3_2_3I2R6CertificateIndex a)).input +lemma CB3_2_3I2R6P_check : ∀ a : Fin 6, contains (CB3_2_3I2R6Raw a) (CB3_2_3I2R6P a) = true := by + decide +kernel +lemma CB3_2_3I2R6P_sound (a : Fin 6) : + (CB3_2_3I2R6P a).Encloses (CB3_2_3I2R6Value a) := + contains_sound (CB3_2_3I2R6Raw_sound a) (CB3_2_3I2R6P_check a) +def CB3_2_3I2R6Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_2_3I2R6Certificates (CB3_2_3I2R6CertificateIndex a)).output +lemma CB3_2_3I2R6Terms_sound (a : Fin 6) : + (CB3_2_3I2R6Terms a).Encloses (Foundation.entropyTerm (CB3_2_3I2R6Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB3_2_3I2R6Certificates_valid + (CB3_2_3I2R6CertificateIndex a) (CB3_2_3I2R6P_sound a) +def CB3_2_3I2R6Entropy : Ball := ⟨0, 0⟩ +lemma CB3_2_3I2R6Entropy_sound : CB3_2_3I2R6Entropy.Encloses (Foundation.finiteEntropy CB3_2_3I2R6Value) := by + exact contains_sound (entropyFin_enclosed 6 CB3_2_3I2R6Value CB3_2_3I2R6Terms CB3_2_3I2R6Terms_sound) (by decide +kernel) +def CB3_2_3I2R6Mass : Ball := ⟨0, 0⟩ +lemma CB3_2_3I2R6Mass_sound : CB3_2_3I2R6Mass.Encloses (∑ a, CB3_2_3I2R6Value a) := by + exact contains_sound (finSumBall_sound 6 CB3_2_3I2R6P CB3_2_3I2R6Value CB3_2_3I2R6P_sound) (by decide +kernel) +def CB3_2_3I2R6MassTerm : Ball := .exact 0 +lemma CB3_2_3I2R6MassTerm_sound : CB3_2_3I2R6MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB3_2_3I2R6Value a))) := + entropyTerm_zero_ball (CB3_2_3I2R6Mass_sound) +def CB3_2_3I2R6H : Ball := ⟨0, 0⟩ +lemma CB3_2_3I2R6H_sound : CB3_2_3I2R6H.Encloses (homogeneousEntropy CB3_2_3I2R6Value) := by + exact contains_sound (homogeneous_enclosed CB3_2_3I2R6Value CB3_2_3I2R6MassTerm_sound CB3_2_3I2R6Entropy_sound) (by decide +kernel) +def CB3_2_3I2R7Value (a : Fin 6) : ℝ := residualLaw (below (shape 3 2 3)) (fun u => (stageBLaw (shape 3 2 3) u : ℝ)) (stageBPriority (shape 3 2 3)) 2 (fun u a => (littleLaw (shape 3 2 3) u ((stageBPriority (shape 3 2 3)) 2) a : ℝ)) 7 a +def CB3_2_3I2R7Raw (a : Fin 6) : Ball := residualBall (below (shape 3 2 3)) B3_2_3Law (stageBPriority (shape 3 2 3)) 2 (fun u => B3_2_3Little u ((stageBPriority (shape 3 2 3)) 2)) 7 a +lemma CB3_2_3I2R7Raw_sound (a : Fin 6) : + (CB3_2_3I2R7Raw a).Encloses (CB3_2_3I2R7Value a) := by + exact residualBall_sound_on (below (shape 3 2 3)) B3_2_3Law (fun u => (stageBLaw (shape 3 2 3) u : ℝ)) (stageBPriority (shape 3 2 3)) 2 (fun u => B3_2_3Little u ((stageBPriority (shape 3 2 3)) 2)) (fun u a => (littleLaw (shape 3 2 3) u ((stageBPriority (shape 3 2 3)) 2) a : ℝ)) (fun u _ => B3_2_3Law_sound u) (fun u _ a => B3_2_3Little_sound u ((stageBPriority (shape 3 2 3)) 2) a) 7 a +def CB3_2_3I2R7Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB3_2_3I2R7Certificates_valid : + CB3_2_3I2R7Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB3_2_3I2R7CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB3_2_3I2R7P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_2_3I2R7Certificates (CB3_2_3I2R7CertificateIndex a)).input +lemma CB3_2_3I2R7P_check : ∀ a : Fin 6, contains (CB3_2_3I2R7Raw a) (CB3_2_3I2R7P a) = true := by + decide +kernel +lemma CB3_2_3I2R7P_sound (a : Fin 6) : + (CB3_2_3I2R7P a).Encloses (CB3_2_3I2R7Value a) := + contains_sound (CB3_2_3I2R7Raw_sound a) (CB3_2_3I2R7P_check a) +def CB3_2_3I2R7Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_2_3I2R7Certificates (CB3_2_3I2R7CertificateIndex a)).output +lemma CB3_2_3I2R7Terms_sound (a : Fin 6) : + (CB3_2_3I2R7Terms a).Encloses (Foundation.entropyTerm (CB3_2_3I2R7Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB3_2_3I2R7Certificates_valid + (CB3_2_3I2R7CertificateIndex a) (CB3_2_3I2R7P_sound a) +def CB3_2_3I2R7Entropy : Ball := ⟨0, 0⟩ +lemma CB3_2_3I2R7Entropy_sound : CB3_2_3I2R7Entropy.Encloses (Foundation.finiteEntropy CB3_2_3I2R7Value) := by + exact contains_sound (entropyFin_enclosed 6 CB3_2_3I2R7Value CB3_2_3I2R7Terms CB3_2_3I2R7Terms_sound) (by decide +kernel) +def CB3_2_3I2R7Mass : Ball := ⟨0, 0⟩ +lemma CB3_2_3I2R7Mass_sound : CB3_2_3I2R7Mass.Encloses (∑ a, CB3_2_3I2R7Value a) := by + exact contains_sound (finSumBall_sound 6 CB3_2_3I2R7P CB3_2_3I2R7Value CB3_2_3I2R7P_sound) (by decide +kernel) +def CB3_2_3I2R7MassTerm : Ball := .exact 0 +lemma CB3_2_3I2R7MassTerm_sound : CB3_2_3I2R7MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB3_2_3I2R7Value a))) := + entropyTerm_zero_ball (CB3_2_3I2R7Mass_sound) +def CB3_2_3I2R7H : Ball := ⟨0, 0⟩ +lemma CB3_2_3I2R7H_sound : CB3_2_3I2R7H.Encloses (homogeneousEntropy CB3_2_3I2R7Value) := by + exact contains_sound (homogeneous_enclosed CB3_2_3I2R7Value CB3_2_3I2R7MassTerm_sound CB3_2_3I2R7Entropy_sound) (by decide +kernel) +def CB3_2_3I2R8Value (a : Fin 6) : ℝ := residualLaw (below (shape 3 2 3)) (fun u => (stageBLaw (shape 3 2 3) u : ℝ)) (stageBPriority (shape 3 2 3)) 2 (fun u a => (littleLaw (shape 3 2 3) u ((stageBPriority (shape 3 2 3)) 2) a : ℝ)) 8 a +def CB3_2_3I2R8Raw (a : Fin 6) : Ball := residualBall (below (shape 3 2 3)) B3_2_3Law (stageBPriority (shape 3 2 3)) 2 (fun u => B3_2_3Little u ((stageBPriority (shape 3 2 3)) 2)) 8 a +lemma CB3_2_3I2R8Raw_sound (a : Fin 6) : + (CB3_2_3I2R8Raw a).Encloses (CB3_2_3I2R8Value a) := by + exact residualBall_sound_on (below (shape 3 2 3)) B3_2_3Law (fun u => (stageBLaw (shape 3 2 3) u : ℝ)) (stageBPriority (shape 3 2 3)) 2 (fun u => B3_2_3Little u ((stageBPriority (shape 3 2 3)) 2)) (fun u a => (littleLaw (shape 3 2 3) u ((stageBPriority (shape 3 2 3)) 2) a : ℝ)) (fun u _ => B3_2_3Law_sound u) (fun u _ a => B3_2_3Little_sound u ((stageBPriority (shape 3 2 3)) 2) a) 8 a +def CB3_2_3I2R8Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB3_2_3I2R8Certificates_valid : + CB3_2_3I2R8Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB3_2_3I2R8CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB3_2_3I2R8P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_2_3I2R8Certificates (CB3_2_3I2R8CertificateIndex a)).input +lemma CB3_2_3I2R8P_check : ∀ a : Fin 6, contains (CB3_2_3I2R8Raw a) (CB3_2_3I2R8P a) = true := by + decide +kernel +lemma CB3_2_3I2R8P_sound (a : Fin 6) : + (CB3_2_3I2R8P a).Encloses (CB3_2_3I2R8Value a) := + contains_sound (CB3_2_3I2R8Raw_sound a) (CB3_2_3I2R8P_check a) +def CB3_2_3I2R8Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_2_3I2R8Certificates (CB3_2_3I2R8CertificateIndex a)).output +lemma CB3_2_3I2R8Terms_sound (a : Fin 6) : + (CB3_2_3I2R8Terms a).Encloses (Foundation.entropyTerm (CB3_2_3I2R8Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB3_2_3I2R8Certificates_valid + (CB3_2_3I2R8CertificateIndex a) (CB3_2_3I2R8P_sound a) +def CB3_2_3I2R8Entropy : Ball := ⟨0, 0⟩ +lemma CB3_2_3I2R8Entropy_sound : CB3_2_3I2R8Entropy.Encloses (Foundation.finiteEntropy CB3_2_3I2R8Value) := by + exact contains_sound (entropyFin_enclosed 6 CB3_2_3I2R8Value CB3_2_3I2R8Terms CB3_2_3I2R8Terms_sound) (by decide +kernel) +def CB3_2_3I2R8Mass : Ball := ⟨0, 0⟩ +lemma CB3_2_3I2R8Mass_sound : CB3_2_3I2R8Mass.Encloses (∑ a, CB3_2_3I2R8Value a) := by + exact contains_sound (finSumBall_sound 6 CB3_2_3I2R8P CB3_2_3I2R8Value CB3_2_3I2R8P_sound) (by decide +kernel) +def CB3_2_3I2R8MassTerm : Ball := .exact 0 +lemma CB3_2_3I2R8MassTerm_sound : CB3_2_3I2R8MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB3_2_3I2R8Value a))) := + entropyTerm_zero_ball (CB3_2_3I2R8Mass_sound) +def CB3_2_3I2R8H : Ball := ⟨0, 0⟩ +lemma CB3_2_3I2R8H_sound : CB3_2_3I2R8H.Encloses (homogeneousEntropy CB3_2_3I2R8Value) := by + exact contains_sound (homogeneous_enclosed CB3_2_3I2R8Value CB3_2_3I2R8MassTerm_sound CB3_2_3I2R8Entropy_sound) (by decide +kernel) +def CB3_2_3I2R9Value (a : Fin 6) : ℝ := residualLaw (below (shape 3 2 3)) (fun u => (stageBLaw (shape 3 2 3) u : ℝ)) (stageBPriority (shape 3 2 3)) 2 (fun u a => (littleLaw (shape 3 2 3) u ((stageBPriority (shape 3 2 3)) 2) a : ℝ)) 9 a +def CB3_2_3I2R9Raw (a : Fin 6) : Ball := residualBall (below (shape 3 2 3)) B3_2_3Law (stageBPriority (shape 3 2 3)) 2 (fun u => B3_2_3Little u ((stageBPriority (shape 3 2 3)) 2)) 9 a +lemma CB3_2_3I2R9Raw_sound (a : Fin 6) : + (CB3_2_3I2R9Raw a).Encloses (CB3_2_3I2R9Value a) := by + exact residualBall_sound_on (below (shape 3 2 3)) B3_2_3Law (fun u => (stageBLaw (shape 3 2 3) u : ℝ)) (stageBPriority (shape 3 2 3)) 2 (fun u => B3_2_3Little u ((stageBPriority (shape 3 2 3)) 2)) (fun u a => (littleLaw (shape 3 2 3) u ((stageBPriority (shape 3 2 3)) 2) a : ℝ)) (fun u _ => B3_2_3Law_sound u) (fun u _ a => B3_2_3Little_sound u ((stageBPriority (shape 3 2 3)) 2) a) 9 a +def CB3_2_3I2R9Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB3_2_3I2R9Certificates_valid : + CB3_2_3I2R9Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB3_2_3I2R9CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB3_2_3I2R9P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_2_3I2R9Certificates (CB3_2_3I2R9CertificateIndex a)).input +lemma CB3_2_3I2R9P_check : ∀ a : Fin 6, contains (CB3_2_3I2R9Raw a) (CB3_2_3I2R9P a) = true := by + decide +kernel +lemma CB3_2_3I2R9P_sound (a : Fin 6) : + (CB3_2_3I2R9P a).Encloses (CB3_2_3I2R9Value a) := + contains_sound (CB3_2_3I2R9Raw_sound a) (CB3_2_3I2R9P_check a) +def CB3_2_3I2R9Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_2_3I2R9Certificates (CB3_2_3I2R9CertificateIndex a)).output +lemma CB3_2_3I2R9Terms_sound (a : Fin 6) : + (CB3_2_3I2R9Terms a).Encloses (Foundation.entropyTerm (CB3_2_3I2R9Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB3_2_3I2R9Certificates_valid + (CB3_2_3I2R9CertificateIndex a) (CB3_2_3I2R9P_sound a) +def CB3_2_3I2R9Entropy : Ball := ⟨0, 0⟩ +lemma CB3_2_3I2R9Entropy_sound : CB3_2_3I2R9Entropy.Encloses (Foundation.finiteEntropy CB3_2_3I2R9Value) := by + exact contains_sound (entropyFin_enclosed 6 CB3_2_3I2R9Value CB3_2_3I2R9Terms CB3_2_3I2R9Terms_sound) (by decide +kernel) +def CB3_2_3I2R9Mass : Ball := ⟨0, 0⟩ +lemma CB3_2_3I2R9Mass_sound : CB3_2_3I2R9Mass.Encloses (∑ a, CB3_2_3I2R9Value a) := by + exact contains_sound (finSumBall_sound 6 CB3_2_3I2R9P CB3_2_3I2R9Value CB3_2_3I2R9P_sound) (by decide +kernel) +def CB3_2_3I2R9MassTerm : Ball := .exact 0 +lemma CB3_2_3I2R9MassTerm_sound : CB3_2_3I2R9MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB3_2_3I2R9Value a))) := + entropyTerm_zero_ball (CB3_2_3I2R9Mass_sound) +def CB3_2_3I2R9H : Ball := ⟨0, 0⟩ +lemma CB3_2_3I2R9H_sound : CB3_2_3I2R9H.Encloses (homogeneousEntropy CB3_2_3I2R9Value) := by + exact contains_sound (homogeneous_enclosed CB3_2_3I2R9Value CB3_2_3I2R9MassTerm_sound CB3_2_3I2R9Entropy_sound) (by decide +kernel) +def CB3_2_3I2R10Value (a : Fin 6) : ℝ := residualLaw (below (shape 3 2 3)) (fun u => (stageBLaw (shape 3 2 3) u : ℝ)) (stageBPriority (shape 3 2 3)) 2 (fun u a => (littleLaw (shape 3 2 3) u ((stageBPriority (shape 3 2 3)) 2) a : ℝ)) 10 a +def CB3_2_3I2R10Raw (a : Fin 6) : Ball := residualBall (below (shape 3 2 3)) B3_2_3Law (stageBPriority (shape 3 2 3)) 2 (fun u => B3_2_3Little u ((stageBPriority (shape 3 2 3)) 2)) 10 a +lemma CB3_2_3I2R10Raw_sound (a : Fin 6) : + (CB3_2_3I2R10Raw a).Encloses (CB3_2_3I2R10Value a) := by + exact residualBall_sound_on (below (shape 3 2 3)) B3_2_3Law (fun u => (stageBLaw (shape 3 2 3) u : ℝ)) (stageBPriority (shape 3 2 3)) 2 (fun u => B3_2_3Little u ((stageBPriority (shape 3 2 3)) 2)) (fun u a => (littleLaw (shape 3 2 3) u ((stageBPriority (shape 3 2 3)) 2) a : ℝ)) (fun u _ => B3_2_3Law_sound u) (fun u _ a => B3_2_3Little_sound u ((stageBPriority (shape 3 2 3)) 2) a) 10 a +def CB3_2_3I2R10Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB3_2_3I2R10Certificates_valid : + CB3_2_3I2R10Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB3_2_3I2R10CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB3_2_3I2R10P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_2_3I2R10Certificates (CB3_2_3I2R10CertificateIndex a)).input +lemma CB3_2_3I2R10P_check : ∀ a : Fin 6, contains (CB3_2_3I2R10Raw a) (CB3_2_3I2R10P a) = true := by + decide +kernel +lemma CB3_2_3I2R10P_sound (a : Fin 6) : + (CB3_2_3I2R10P a).Encloses (CB3_2_3I2R10Value a) := + contains_sound (CB3_2_3I2R10Raw_sound a) (CB3_2_3I2R10P_check a) +def CB3_2_3I2R10Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_2_3I2R10Certificates (CB3_2_3I2R10CertificateIndex a)).output +lemma CB3_2_3I2R10Terms_sound (a : Fin 6) : + (CB3_2_3I2R10Terms a).Encloses (Foundation.entropyTerm (CB3_2_3I2R10Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB3_2_3I2R10Certificates_valid + (CB3_2_3I2R10CertificateIndex a) (CB3_2_3I2R10P_sound a) +def CB3_2_3I2R10Entropy : Ball := ⟨0, 0⟩ +lemma CB3_2_3I2R10Entropy_sound : CB3_2_3I2R10Entropy.Encloses (Foundation.finiteEntropy CB3_2_3I2R10Value) := by + exact contains_sound (entropyFin_enclosed 6 CB3_2_3I2R10Value CB3_2_3I2R10Terms CB3_2_3I2R10Terms_sound) (by decide +kernel) +def CB3_2_3I2R10Mass : Ball := ⟨0, 0⟩ +lemma CB3_2_3I2R10Mass_sound : CB3_2_3I2R10Mass.Encloses (∑ a, CB3_2_3I2R10Value a) := by + exact contains_sound (finSumBall_sound 6 CB3_2_3I2R10P CB3_2_3I2R10Value CB3_2_3I2R10P_sound) (by decide +kernel) +def CB3_2_3I2R10MassTerm : Ball := .exact 0 +lemma CB3_2_3I2R10MassTerm_sound : CB3_2_3I2R10MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB3_2_3I2R10Value a))) := + entropyTerm_zero_ball (CB3_2_3I2R10Mass_sound) +def CB3_2_3I2R10H : Ball := ⟨0, 0⟩ +lemma CB3_2_3I2R10H_sound : CB3_2_3I2R10H.Encloses (homogeneousEntropy CB3_2_3I2R10Value) := by + exact contains_sound (homogeneous_enclosed CB3_2_3I2R10Value CB3_2_3I2R10MassTerm_sound CB3_2_3I2R10Entropy_sound) (by decide +kernel) +def CB3_2_3I2R11Value (a : Fin 6) : ℝ := residualLaw (below (shape 3 2 3)) (fun u => (stageBLaw (shape 3 2 3) u : ℝ)) (stageBPriority (shape 3 2 3)) 2 (fun u a => (littleLaw (shape 3 2 3) u ((stageBPriority (shape 3 2 3)) 2) a : ℝ)) 11 a +def CB3_2_3I2R11Raw (a : Fin 6) : Ball := residualBall (below (shape 3 2 3)) B3_2_3Law (stageBPriority (shape 3 2 3)) 2 (fun u => B3_2_3Little u ((stageBPriority (shape 3 2 3)) 2)) 11 a +lemma CB3_2_3I2R11Raw_sound (a : Fin 6) : + (CB3_2_3I2R11Raw a).Encloses (CB3_2_3I2R11Value a) := by + exact residualBall_sound_on (below (shape 3 2 3)) B3_2_3Law (fun u => (stageBLaw (shape 3 2 3) u : ℝ)) (stageBPriority (shape 3 2 3)) 2 (fun u => B3_2_3Little u ((stageBPriority (shape 3 2 3)) 2)) (fun u a => (littleLaw (shape 3 2 3) u ((stageBPriority (shape 3 2 3)) 2) a : ℝ)) (fun u _ => B3_2_3Law_sound u) (fun u _ a => B3_2_3Little_sound u ((stageBPriority (shape 3 2 3)) 2) a) 11 a +def CB3_2_3I2R11Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB3_2_3I2R11Certificates_valid : + CB3_2_3I2R11Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB3_2_3I2R11CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB3_2_3I2R11P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_2_3I2R11Certificates (CB3_2_3I2R11CertificateIndex a)).input +lemma CB3_2_3I2R11P_check : ∀ a : Fin 6, contains (CB3_2_3I2R11Raw a) (CB3_2_3I2R11P a) = true := by + decide +kernel +lemma CB3_2_3I2R11P_sound (a : Fin 6) : + (CB3_2_3I2R11P a).Encloses (CB3_2_3I2R11Value a) := + contains_sound (CB3_2_3I2R11Raw_sound a) (CB3_2_3I2R11P_check a) +def CB3_2_3I2R11Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_2_3I2R11Certificates (CB3_2_3I2R11CertificateIndex a)).output +lemma CB3_2_3I2R11Terms_sound (a : Fin 6) : + (CB3_2_3I2R11Terms a).Encloses (Foundation.entropyTerm (CB3_2_3I2R11Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB3_2_3I2R11Certificates_valid + (CB3_2_3I2R11CertificateIndex a) (CB3_2_3I2R11P_sound a) +def CB3_2_3I2R11Entropy : Ball := ⟨0, 0⟩ +lemma CB3_2_3I2R11Entropy_sound : CB3_2_3I2R11Entropy.Encloses (Foundation.finiteEntropy CB3_2_3I2R11Value) := by + exact contains_sound (entropyFin_enclosed 6 CB3_2_3I2R11Value CB3_2_3I2R11Terms CB3_2_3I2R11Terms_sound) (by decide +kernel) +def CB3_2_3I2R11Mass : Ball := ⟨0, 0⟩ +lemma CB3_2_3I2R11Mass_sound : CB3_2_3I2R11Mass.Encloses (∑ a, CB3_2_3I2R11Value a) := by + exact contains_sound (finSumBall_sound 6 CB3_2_3I2R11P CB3_2_3I2R11Value CB3_2_3I2R11P_sound) (by decide +kernel) +def CB3_2_3I2R11MassTerm : Ball := .exact 0 +lemma CB3_2_3I2R11MassTerm_sound : CB3_2_3I2R11MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB3_2_3I2R11Value a))) := + entropyTerm_zero_ball (CB3_2_3I2R11Mass_sound) +def CB3_2_3I2R11H : Ball := ⟨0, 0⟩ +lemma CB3_2_3I2R11H_sound : CB3_2_3I2R11H.Encloses (homogeneousEntropy CB3_2_3I2R11Value) := by + exact contains_sound (homogeneous_enclosed CB3_2_3I2R11Value CB3_2_3I2R11MassTerm_sound CB3_2_3I2R11Entropy_sound) (by decide +kernel) +def CB3_2_3I2R12Value (a : Fin 6) : ℝ := residualLaw (below (shape 3 2 3)) (fun u => (stageBLaw (shape 3 2 3) u : ℝ)) (stageBPriority (shape 3 2 3)) 2 (fun u a => (littleLaw (shape 3 2 3) u ((stageBPriority (shape 3 2 3)) 2) a : ℝ)) 12 a +def CB3_2_3I2R12Raw (a : Fin 6) : Ball := residualBall (below (shape 3 2 3)) B3_2_3Law (stageBPriority (shape 3 2 3)) 2 (fun u => B3_2_3Little u ((stageBPriority (shape 3 2 3)) 2)) 12 a +lemma CB3_2_3I2R12Raw_sound (a : Fin 6) : + (CB3_2_3I2R12Raw a).Encloses (CB3_2_3I2R12Value a) := by + exact residualBall_sound_on (below (shape 3 2 3)) B3_2_3Law (fun u => (stageBLaw (shape 3 2 3) u : ℝ)) (stageBPriority (shape 3 2 3)) 2 (fun u => B3_2_3Little u ((stageBPriority (shape 3 2 3)) 2)) (fun u a => (littleLaw (shape 3 2 3) u ((stageBPriority (shape 3 2 3)) 2) a : ℝ)) (fun u _ => B3_2_3Law_sound u) (fun u _ a => B3_2_3Little_sound u ((stageBPriority (shape 3 2 3)) 2) a) 12 a +def CB3_2_3I2R12Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB3_2_3I2R12Certificates_valid : + CB3_2_3I2R12Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB3_2_3I2R12CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB3_2_3I2R12P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_2_3I2R12Certificates (CB3_2_3I2R12CertificateIndex a)).input +lemma CB3_2_3I2R12P_check : ∀ a : Fin 6, contains (CB3_2_3I2R12Raw a) (CB3_2_3I2R12P a) = true := by + decide +kernel +lemma CB3_2_3I2R12P_sound (a : Fin 6) : + (CB3_2_3I2R12P a).Encloses (CB3_2_3I2R12Value a) := + contains_sound (CB3_2_3I2R12Raw_sound a) (CB3_2_3I2R12P_check a) +def CB3_2_3I2R12Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_2_3I2R12Certificates (CB3_2_3I2R12CertificateIndex a)).output +lemma CB3_2_3I2R12Terms_sound (a : Fin 6) : + (CB3_2_3I2R12Terms a).Encloses (Foundation.entropyTerm (CB3_2_3I2R12Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB3_2_3I2R12Certificates_valid + (CB3_2_3I2R12CertificateIndex a) (CB3_2_3I2R12P_sound a) +def CB3_2_3I2R12Entropy : Ball := ⟨0, 0⟩ +lemma CB3_2_3I2R12Entropy_sound : CB3_2_3I2R12Entropy.Encloses (Foundation.finiteEntropy CB3_2_3I2R12Value) := by + exact contains_sound (entropyFin_enclosed 6 CB3_2_3I2R12Value CB3_2_3I2R12Terms CB3_2_3I2R12Terms_sound) (by decide +kernel) +def CB3_2_3I2R12Mass : Ball := ⟨0, 0⟩ +lemma CB3_2_3I2R12Mass_sound : CB3_2_3I2R12Mass.Encloses (∑ a, CB3_2_3I2R12Value a) := by + exact contains_sound (finSumBall_sound 6 CB3_2_3I2R12P CB3_2_3I2R12Value CB3_2_3I2R12P_sound) (by decide +kernel) +def CB3_2_3I2R12MassTerm : Ball := .exact 0 +lemma CB3_2_3I2R12MassTerm_sound : CB3_2_3I2R12MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB3_2_3I2R12Value a))) := + entropyTerm_zero_ball (CB3_2_3I2R12Mass_sound) +def CB3_2_3I2R12H : Ball := ⟨0, 0⟩ +lemma CB3_2_3I2R12H_sound : CB3_2_3I2R12H.Encloses (homogeneousEntropy CB3_2_3I2R12Value) := by + exact contains_sound (homogeneous_enclosed CB3_2_3I2R12Value CB3_2_3I2R12MassTerm_sound CB3_2_3I2R12Entropy_sound) (by decide +kernel) +def CB3_2_3I2R13Value (a : Fin 6) : ℝ := residualLaw (below (shape 3 2 3)) (fun u => (stageBLaw (shape 3 2 3) u : ℝ)) (stageBPriority (shape 3 2 3)) 2 (fun u a => (littleLaw (shape 3 2 3) u ((stageBPriority (shape 3 2 3)) 2) a : ℝ)) 13 a +def CB3_2_3I2R13Raw (a : Fin 6) : Ball := residualBall (below (shape 3 2 3)) B3_2_3Law (stageBPriority (shape 3 2 3)) 2 (fun u => B3_2_3Little u ((stageBPriority (shape 3 2 3)) 2)) 13 a +lemma CB3_2_3I2R13Raw_sound (a : Fin 6) : + (CB3_2_3I2R13Raw a).Encloses (CB3_2_3I2R13Value a) := by + exact residualBall_sound_on (below (shape 3 2 3)) B3_2_3Law (fun u => (stageBLaw (shape 3 2 3) u : ℝ)) (stageBPriority (shape 3 2 3)) 2 (fun u => B3_2_3Little u ((stageBPriority (shape 3 2 3)) 2)) (fun u a => (littleLaw (shape 3 2 3) u ((stageBPriority (shape 3 2 3)) 2) a : ℝ)) (fun u _ => B3_2_3Law_sound u) (fun u _ a => B3_2_3Little_sound u ((stageBPriority (shape 3 2 3)) 2) a) 13 a +def CB3_2_3I2R13Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB3_2_3I2R13Certificates_valid : + CB3_2_3I2R13Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB3_2_3I2R13CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB3_2_3I2R13P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_2_3I2R13Certificates (CB3_2_3I2R13CertificateIndex a)).input +lemma CB3_2_3I2R13P_check : ∀ a : Fin 6, contains (CB3_2_3I2R13Raw a) (CB3_2_3I2R13P a) = true := by + decide +kernel +lemma CB3_2_3I2R13P_sound (a : Fin 6) : + (CB3_2_3I2R13P a).Encloses (CB3_2_3I2R13Value a) := + contains_sound (CB3_2_3I2R13Raw_sound a) (CB3_2_3I2R13P_check a) +def CB3_2_3I2R13Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_2_3I2R13Certificates (CB3_2_3I2R13CertificateIndex a)).output +lemma CB3_2_3I2R13Terms_sound (a : Fin 6) : + (CB3_2_3I2R13Terms a).Encloses (Foundation.entropyTerm (CB3_2_3I2R13Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB3_2_3I2R13Certificates_valid + (CB3_2_3I2R13CertificateIndex a) (CB3_2_3I2R13P_sound a) +def CB3_2_3I2R13Entropy : Ball := ⟨0, 0⟩ +lemma CB3_2_3I2R13Entropy_sound : CB3_2_3I2R13Entropy.Encloses (Foundation.finiteEntropy CB3_2_3I2R13Value) := by + exact contains_sound (entropyFin_enclosed 6 CB3_2_3I2R13Value CB3_2_3I2R13Terms CB3_2_3I2R13Terms_sound) (by decide +kernel) +def CB3_2_3I2R13Mass : Ball := ⟨0, 0⟩ +lemma CB3_2_3I2R13Mass_sound : CB3_2_3I2R13Mass.Encloses (∑ a, CB3_2_3I2R13Value a) := by + exact contains_sound (finSumBall_sound 6 CB3_2_3I2R13P CB3_2_3I2R13Value CB3_2_3I2R13P_sound) (by decide +kernel) +def CB3_2_3I2R13MassTerm : Ball := .exact 0 +lemma CB3_2_3I2R13MassTerm_sound : CB3_2_3I2R13MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB3_2_3I2R13Value a))) := + entropyTerm_zero_ball (CB3_2_3I2R13Mass_sound) +def CB3_2_3I2R13H : Ball := ⟨0, 0⟩ +lemma CB3_2_3I2R13H_sound : CB3_2_3I2R13H.Encloses (homogeneousEntropy CB3_2_3I2R13Value) := by + exact contains_sound (homogeneous_enclosed CB3_2_3I2R13Value CB3_2_3I2R13MassTerm_sound CB3_2_3I2R13Entropy_sound) (by decide +kernel) +def CB3_2_3I2R14Value (a : Fin 6) : ℝ := residualLaw (below (shape 3 2 3)) (fun u => (stageBLaw (shape 3 2 3) u : ℝ)) (stageBPriority (shape 3 2 3)) 2 (fun u a => (littleLaw (shape 3 2 3) u ((stageBPriority (shape 3 2 3)) 2) a : ℝ)) 14 a +def CB3_2_3I2R14Raw (a : Fin 6) : Ball := residualBall (below (shape 3 2 3)) B3_2_3Law (stageBPriority (shape 3 2 3)) 2 (fun u => B3_2_3Little u ((stageBPriority (shape 3 2 3)) 2)) 14 a +lemma CB3_2_3I2R14Raw_sound (a : Fin 6) : + (CB3_2_3I2R14Raw a).Encloses (CB3_2_3I2R14Value a) := by + exact residualBall_sound_on (below (shape 3 2 3)) B3_2_3Law (fun u => (stageBLaw (shape 3 2 3) u : ℝ)) (stageBPriority (shape 3 2 3)) 2 (fun u => B3_2_3Little u ((stageBPriority (shape 3 2 3)) 2)) (fun u a => (littleLaw (shape 3 2 3) u ((stageBPriority (shape 3 2 3)) 2) a : ℝ)) (fun u _ => B3_2_3Law_sound u) (fun u _ a => B3_2_3Little_sound u ((stageBPriority (shape 3 2 3)) 2) a) 14 a +def CB3_2_3I2R14Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB3_2_3I2R14Certificates_valid : + CB3_2_3I2R14Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB3_2_3I2R14CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB3_2_3I2R14P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_2_3I2R14Certificates (CB3_2_3I2R14CertificateIndex a)).input +lemma CB3_2_3I2R14P_check : ∀ a : Fin 6, contains (CB3_2_3I2R14Raw a) (CB3_2_3I2R14P a) = true := by + decide +kernel +lemma CB3_2_3I2R14P_sound (a : Fin 6) : + (CB3_2_3I2R14P a).Encloses (CB3_2_3I2R14Value a) := + contains_sound (CB3_2_3I2R14Raw_sound a) (CB3_2_3I2R14P_check a) +def CB3_2_3I2R14Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_2_3I2R14Certificates (CB3_2_3I2R14CertificateIndex a)).output +lemma CB3_2_3I2R14Terms_sound (a : Fin 6) : + (CB3_2_3I2R14Terms a).Encloses (Foundation.entropyTerm (CB3_2_3I2R14Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB3_2_3I2R14Certificates_valid + (CB3_2_3I2R14CertificateIndex a) (CB3_2_3I2R14P_sound a) +def CB3_2_3I2R14Entropy : Ball := ⟨0, 0⟩ +lemma CB3_2_3I2R14Entropy_sound : CB3_2_3I2R14Entropy.Encloses (Foundation.finiteEntropy CB3_2_3I2R14Value) := by + exact contains_sound (entropyFin_enclosed 6 CB3_2_3I2R14Value CB3_2_3I2R14Terms CB3_2_3I2R14Terms_sound) (by decide +kernel) +def CB3_2_3I2R14Mass : Ball := ⟨0, 0⟩ +lemma CB3_2_3I2R14Mass_sound : CB3_2_3I2R14Mass.Encloses (∑ a, CB3_2_3I2R14Value a) := by + exact contains_sound (finSumBall_sound 6 CB3_2_3I2R14P CB3_2_3I2R14Value CB3_2_3I2R14P_sound) (by decide +kernel) +def CB3_2_3I2R14MassTerm : Ball := .exact 0 +lemma CB3_2_3I2R14MassTerm_sound : CB3_2_3I2R14MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB3_2_3I2R14Value a))) := + entropyTerm_zero_ball (CB3_2_3I2R14Mass_sound) +def CB3_2_3I2R14H : Ball := ⟨0, 0⟩ +lemma CB3_2_3I2R14H_sound : CB3_2_3I2R14H.Encloses (homogeneousEntropy CB3_2_3I2R14Value) := by + exact contains_sound (homogeneous_enclosed CB3_2_3I2R14Value CB3_2_3I2R14MassTerm_sound CB3_2_3I2R14Entropy_sound) (by decide +kernel) +def CB3_2_3I2R15Value (a : Fin 6) : ℝ := residualLaw (below (shape 3 2 3)) (fun u => (stageBLaw (shape 3 2 3) u : ℝ)) (stageBPriority (shape 3 2 3)) 2 (fun u a => (littleLaw (shape 3 2 3) u ((stageBPriority (shape 3 2 3)) 2) a : ℝ)) 15 a +def CB3_2_3I2R15Raw (a : Fin 6) : Ball := residualBall (below (shape 3 2 3)) B3_2_3Law (stageBPriority (shape 3 2 3)) 2 (fun u => B3_2_3Little u ((stageBPriority (shape 3 2 3)) 2)) 15 a +lemma CB3_2_3I2R15Raw_sound (a : Fin 6) : + (CB3_2_3I2R15Raw a).Encloses (CB3_2_3I2R15Value a) := by + exact residualBall_sound_on (below (shape 3 2 3)) B3_2_3Law (fun u => (stageBLaw (shape 3 2 3) u : ℝ)) (stageBPriority (shape 3 2 3)) 2 (fun u => B3_2_3Little u ((stageBPriority (shape 3 2 3)) 2)) (fun u a => (littleLaw (shape 3 2 3) u ((stageBPriority (shape 3 2 3)) 2) a : ℝ)) (fun u _ => B3_2_3Law_sound u) (fun u _ a => B3_2_3Little_sound u ((stageBPriority (shape 3 2 3)) 2) a) 15 a +def CB3_2_3I2R15Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB3_2_3I2R15Certificates_valid : + CB3_2_3I2R15Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB3_2_3I2R15CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB3_2_3I2R15P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_2_3I2R15Certificates (CB3_2_3I2R15CertificateIndex a)).input +lemma CB3_2_3I2R15P_check : ∀ a : Fin 6, contains (CB3_2_3I2R15Raw a) (CB3_2_3I2R15P a) = true := by + decide +kernel +lemma CB3_2_3I2R15P_sound (a : Fin 6) : + (CB3_2_3I2R15P a).Encloses (CB3_2_3I2R15Value a) := + contains_sound (CB3_2_3I2R15Raw_sound a) (CB3_2_3I2R15P_check a) +def CB3_2_3I2R15Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_2_3I2R15Certificates (CB3_2_3I2R15CertificateIndex a)).output +lemma CB3_2_3I2R15Terms_sound (a : Fin 6) : + (CB3_2_3I2R15Terms a).Encloses (Foundation.entropyTerm (CB3_2_3I2R15Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB3_2_3I2R15Certificates_valid + (CB3_2_3I2R15CertificateIndex a) (CB3_2_3I2R15P_sound a) +def CB3_2_3I2R15Entropy : Ball := ⟨0, 0⟩ +lemma CB3_2_3I2R15Entropy_sound : CB3_2_3I2R15Entropy.Encloses (Foundation.finiteEntropy CB3_2_3I2R15Value) := by + exact contains_sound (entropyFin_enclosed 6 CB3_2_3I2R15Value CB3_2_3I2R15Terms CB3_2_3I2R15Terms_sound) (by decide +kernel) +def CB3_2_3I2R15Mass : Ball := ⟨0, 0⟩ +lemma CB3_2_3I2R15Mass_sound : CB3_2_3I2R15Mass.Encloses (∑ a, CB3_2_3I2R15Value a) := by + exact contains_sound (finSumBall_sound 6 CB3_2_3I2R15P CB3_2_3I2R15Value CB3_2_3I2R15P_sound) (by decide +kernel) +def CB3_2_3I2R15MassTerm : Ball := .exact 0 +lemma CB3_2_3I2R15MassTerm_sound : CB3_2_3I2R15MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB3_2_3I2R15Value a))) := + entropyTerm_zero_ball (CB3_2_3I2R15Mass_sound) +def CB3_2_3I2R15H : Ball := ⟨0, 0⟩ +lemma CB3_2_3I2R15H_sound : CB3_2_3I2R15H.Encloses (homogeneousEntropy CB3_2_3I2R15Value) := by + exact contains_sound (homogeneous_enclosed CB3_2_3I2R15Value CB3_2_3I2R15MassTerm_sound CB3_2_3I2R15Entropy_sound) (by decide +kernel) +def CB3_2_3I2R16Value (a : Fin 6) : ℝ := residualLaw (below (shape 3 2 3)) (fun u => (stageBLaw (shape 3 2 3) u : ℝ)) (stageBPriority (shape 3 2 3)) 2 (fun u a => (littleLaw (shape 3 2 3) u ((stageBPriority (shape 3 2 3)) 2) a : ℝ)) 16 a +def CB3_2_3I2R16Raw (a : Fin 6) : Ball := residualBall (below (shape 3 2 3)) B3_2_3Law (stageBPriority (shape 3 2 3)) 2 (fun u => B3_2_3Little u ((stageBPriority (shape 3 2 3)) 2)) 16 a +lemma CB3_2_3I2R16Raw_sound (a : Fin 6) : + (CB3_2_3I2R16Raw a).Encloses (CB3_2_3I2R16Value a) := by + exact residualBall_sound_on (below (shape 3 2 3)) B3_2_3Law (fun u => (stageBLaw (shape 3 2 3) u : ℝ)) (stageBPriority (shape 3 2 3)) 2 (fun u => B3_2_3Little u ((stageBPriority (shape 3 2 3)) 2)) (fun u a => (littleLaw (shape 3 2 3) u ((stageBPriority (shape 3 2 3)) 2) a : ℝ)) (fun u _ => B3_2_3Law_sound u) (fun u _ a => B3_2_3Little_sound u ((stageBPriority (shape 3 2 3)) 2) a) 16 a +def CB3_2_3I2R16Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB3_2_3I2R16Certificates_valid : + CB3_2_3I2R16Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB3_2_3I2R16CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB3_2_3I2R16P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_2_3I2R16Certificates (CB3_2_3I2R16CertificateIndex a)).input +lemma CB3_2_3I2R16P_check : ∀ a : Fin 6, contains (CB3_2_3I2R16Raw a) (CB3_2_3I2R16P a) = true := by + decide +kernel +lemma CB3_2_3I2R16P_sound (a : Fin 6) : + (CB3_2_3I2R16P a).Encloses (CB3_2_3I2R16Value a) := + contains_sound (CB3_2_3I2R16Raw_sound a) (CB3_2_3I2R16P_check a) +def CB3_2_3I2R16Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_2_3I2R16Certificates (CB3_2_3I2R16CertificateIndex a)).output +lemma CB3_2_3I2R16Terms_sound (a : Fin 6) : + (CB3_2_3I2R16Terms a).Encloses (Foundation.entropyTerm (CB3_2_3I2R16Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB3_2_3I2R16Certificates_valid + (CB3_2_3I2R16CertificateIndex a) (CB3_2_3I2R16P_sound a) +def CB3_2_3I2R16Entropy : Ball := ⟨0, 0⟩ +lemma CB3_2_3I2R16Entropy_sound : CB3_2_3I2R16Entropy.Encloses (Foundation.finiteEntropy CB3_2_3I2R16Value) := by + exact contains_sound (entropyFin_enclosed 6 CB3_2_3I2R16Value CB3_2_3I2R16Terms CB3_2_3I2R16Terms_sound) (by decide +kernel) +def CB3_2_3I2R16Mass : Ball := ⟨0, 0⟩ +lemma CB3_2_3I2R16Mass_sound : CB3_2_3I2R16Mass.Encloses (∑ a, CB3_2_3I2R16Value a) := by + exact contains_sound (finSumBall_sound 6 CB3_2_3I2R16P CB3_2_3I2R16Value CB3_2_3I2R16P_sound) (by decide +kernel) +def CB3_2_3I2R16MassTerm : Ball := .exact 0 +lemma CB3_2_3I2R16MassTerm_sound : CB3_2_3I2R16MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB3_2_3I2R16Value a))) := + entropyTerm_zero_ball (CB3_2_3I2R16Mass_sound) +def CB3_2_3I2R16H : Ball := ⟨0, 0⟩ +lemma CB3_2_3I2R16H_sound : CB3_2_3I2R16H.Encloses (homogeneousEntropy CB3_2_3I2R16Value) := by + exact contains_sound (homogeneous_enclosed CB3_2_3I2R16Value CB3_2_3I2R16MassTerm_sound CB3_2_3I2R16Entropy_sound) (by decide +kernel) +def CB3_2_3I2ResidualEntropies (a : Fin 17) : Ball := + match a.val with + | 0 => CB3_2_3I2R0H + | 1 => CB3_2_3I2R1H + | 2 => CB3_2_3I2R2H + | 3 => CB3_2_3I2R3H + | 4 => CB3_2_3I2R4H + | 5 => CB3_2_3I2R5H + | 6 => CB3_2_3I2R6H + | 7 => CB3_2_3I2R7H + | 8 => CB3_2_3I2R8H + | 9 => CB3_2_3I2R9H + | 10 => CB3_2_3I2R10H + | 11 => CB3_2_3I2R11H + | 12 => CB3_2_3I2R12H + | 13 => CB3_2_3I2R13H + | 14 => CB3_2_3I2R14H + | 15 => CB3_2_3I2R15H + | 16 => CB3_2_3I2R16H + | _ => (.exact 0) +lemma CB3_2_3I2ResidualEntropies_sound (k : Fin 17) : + (CB3_2_3I2ResidualEntropies k).Encloses (homogeneousEntropy + (residualLaw (below (shape 3 2 3)) (fun u => (stageBLaw (shape 3 2 3) u : ℝ)) (stageBPriority (shape 3 2 3)) 2 (fun u a => (littleLaw (shape 3 2 3) u ((stageBPriority (shape 3 2 3)) 2) a : ℝ)) k)) := by + fin_cases k + · exact CB3_2_3I2R0H_sound + · exact CB3_2_3I2R1H_sound + · exact CB3_2_3I2R2H_sound + · exact CB3_2_3I2R3H_sound + · exact CB3_2_3I2R4H_sound + · exact CB3_2_3I2R5H_sound + · exact CB3_2_3I2R6H_sound + · exact CB3_2_3I2R7H_sound + · exact CB3_2_3I2R8H_sound + · exact CB3_2_3I2R9H_sound + · exact CB3_2_3I2R10H_sound + · exact CB3_2_3I2R11H_sound + · exact CB3_2_3I2R12H_sound + · exact CB3_2_3I2R13H_sound + · exact CB3_2_3I2R14H_sound + · exact CB3_2_3I2R15H_sound + · exact CB3_2_3I2R16H_sound +def CB3_2_3I2S0_1_3Value (a : Fin 6) : ℝ := (littleLaw (shape 3 2 3) (shape 0 1 3) ((stageBPriority (shape 3 2 3)) 2) a : ℝ) +def CB3_2_3I2S0_1_3E_4Log : Ball := .exact 0 +lemma CB3_2_3I2S0_1_3E_4Log_sound : CB3_2_3I2S0_1_3E_4Log.Encloses (Real.log (CB3_2_3I2S0_1_3Value (4 : Fin 6))) := by + exact log_exact_one_ball ((B3_2_3Little_sound (shape 0 1 3) ((stageBPriority (shape 3 2 3)) 2)) (4 : Fin 6)) +def CB3_2_3I2S0_1_3E_4 : Ball := ⟨0, 0⟩ +lemma CB3_2_3I2S0_1_3E_4_sound : CB3_2_3I2S0_1_3E_4.Encloses (Foundation.entropyTerm (CB3_2_3I2S0_1_3Value (4 : Fin 6))) := by + exact contains_sound (entropyTerm_ball ((B3_2_3Little_sound (shape 0 1 3) ((stageBPriority (shape 3 2 3)) 2)) (4 : Fin 6)) CB3_2_3I2S0_1_3E_4Log_sound) (by decide +kernel) +def CB3_2_3I2S0_1_3Terms (a : Fin 6) : Ball := + match a.val with + | 4 => ⟨0, 0⟩ + | _ => (.exact 0) +lemma CB3_2_3I2S0_1_3Terms_sound (a : Fin 6) : + (CB3_2_3I2S0_1_3Terms a).Encloses (Foundation.entropyTerm (CB3_2_3I2S0_1_3Value a)) := by + fin_cases a + · exact (entropyTerm_zero_ball ((B3_2_3Little_sound (shape 0 1 3) ((stageBPriority (shape 3 2 3)) 2)) (0 : Fin 6))) + · exact (entropyTerm_zero_ball ((B3_2_3Little_sound (shape 0 1 3) ((stageBPriority (shape 3 2 3)) 2)) (1 : Fin 6))) + · exact (entropyTerm_zero_ball ((B3_2_3Little_sound (shape 0 1 3) ((stageBPriority (shape 3 2 3)) 2)) (2 : Fin 6))) + · exact (entropyTerm_zero_ball ((B3_2_3Little_sound (shape 0 1 3) ((stageBPriority (shape 3 2 3)) 2)) (3 : Fin 6))) + · exact CB3_2_3I2S0_1_3E_4_sound + · exact (entropyTerm_zero_ball ((B3_2_3Little_sound (shape 0 1 3) ((stageBPriority (shape 3 2 3)) 2)) (5 : Fin 6))) +def CB3_2_3I2S0_1_3Entropy : Ball := ⟨0, 0⟩ +lemma CB3_2_3I2S0_1_3Entropy_sound : CB3_2_3I2S0_1_3Entropy.Encloses (Foundation.finiteEntropy CB3_2_3I2S0_1_3Value) := by + exact contains_sound (entropyFin_enclosed 6 CB3_2_3I2S0_1_3Value CB3_2_3I2S0_1_3Terms CB3_2_3I2S0_1_3Terms_sound) (by decide +kernel) +def CB3_2_3I2S0_1_3Mass : Ball := ⟨1, 0⟩ +lemma CB3_2_3I2S0_1_3Mass_sound : CB3_2_3I2S0_1_3Mass.Encloses (∑ a, CB3_2_3I2S0_1_3Value a) := by + exact contains_sound (finSumBall_sound 6 (B3_2_3Little (shape 0 1 3) ((stageBPriority (shape 3 2 3)) 2)) CB3_2_3I2S0_1_3Value (B3_2_3Little_sound (shape 0 1 3) ((stageBPriority (shape 3 2 3)) 2))) (by decide +kernel) +def CB3_2_3I2S0_1_3MassTermLog : Ball := .exact 0 +lemma CB3_2_3I2S0_1_3MassTermLog_sound : CB3_2_3I2S0_1_3MassTermLog.Encloses (Real.log ((∑ a, CB3_2_3I2S0_1_3Value a))) := by + exact log_exact_one_ball (CB3_2_3I2S0_1_3Mass_sound) +def CB3_2_3I2S0_1_3MassTerm : Ball := ⟨0, 0⟩ +lemma CB3_2_3I2S0_1_3MassTerm_sound : CB3_2_3I2S0_1_3MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB3_2_3I2S0_1_3Value a))) := by + exact contains_sound (entropyTerm_ball (CB3_2_3I2S0_1_3Mass_sound) CB3_2_3I2S0_1_3MassTermLog_sound) (by decide +kernel) +def CB3_2_3I2S0_1_3H : Ball := ⟨0, 0⟩ +lemma CB3_2_3I2S0_1_3H_sound : CB3_2_3I2S0_1_3H.Encloses (homogeneousEntropy CB3_2_3I2S0_1_3Value) := by + exact contains_sound (homogeneous_enclosed CB3_2_3I2S0_1_3Value CB3_2_3I2S0_1_3MassTerm_sound CB3_2_3I2S0_1_3Entropy_sound) (by decide +kernel) +def CB3_2_3I2S0_2_2Value (a : Fin 6) : ℝ := (littleLaw (shape 3 2 3) (shape 0 2 2) ((stageBPriority (shape 3 2 3)) 2) a : ℝ) +def CB3_2_3I2S0_2_2E_2LogWitness : LogWitness := ⟨-1, 179163, 100000⟩ +def CB3_2_3I2S0_2_2E_2Log : Ball := ⟨(-11002136054002092463393093233409 / 100000000000000000000000000000000), (21175823683 / 50000000000000000000000000000000)⟩ +lemma CB3_2_3I2S0_2_2E_2Log_sound : CB3_2_3I2S0_2_2E_2Log.Encloses (Real.log (CB3_2_3I2S0_2_2Value (2 : Fin 6))) := by + exact checkLog_sound logTwoBall_sound ((B3_2_3Little_sound (shape 0 2 2) ((stageBPriority (shape 3 2 3)) 2)) (2 : Fin 6)) (w := CB3_2_3I2S0_2_2E_2LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB3_2_3I2S0_2_2E_2 : Ball := ⟨(4927939254607942230047241907443 / 50000000000000000000000000000000), (18969620493 / 50000000000000000000000000000000)⟩ +lemma CB3_2_3I2S0_2_2E_2_sound : CB3_2_3I2S0_2_2E_2.Encloses (Foundation.entropyTerm (CB3_2_3I2S0_2_2Value (2 : Fin 6))) := by + exact contains_sound (entropyTerm_ball ((B3_2_3Little_sound (shape 0 2 2) ((stageBPriority (shape 3 2 3)) 2)) (2 : Fin 6)) CB3_2_3I2S0_2_2E_2Log_sound) (by decide +kernel) +def CB3_2_3I2S0_2_2E_3LogWitness : LogWitness := ⟨-4, 20837, 12500⟩ +def CB3_2_3I2S0_2_2E_3Log : Ball := ⟨(-226158711395997353564112106926423 / 100000000000000000000000000000000), (21175823683 / 20000000000000000000000000000000)⟩ +lemma CB3_2_3I2S0_2_2E_3Log_sound : CB3_2_3I2S0_2_2E_3Log.Encloses (Real.log (CB3_2_3I2S0_2_2Value (3 : Fin 6))) := by + exact checkLog_sound logTwoBall_sound ((B3_2_3Little_sound (shape 0 2 2) ((stageBPriority (shape 3 2 3)) 2)) (3 : Fin 6)) (w := CB3_2_3I2S0_2_2E_3LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB3_2_3I2S0_2_2E_3 : Ball := ⟨(23562345346791984281077019860129 / 100000000000000000000000000000000), (11031015953 / 100000000000000000000000000000000)⟩ +lemma CB3_2_3I2S0_2_2E_3_sound : CB3_2_3I2S0_2_2E_3.Encloses (Foundation.entropyTerm (CB3_2_3I2S0_2_2Value (3 : Fin 6))) := by + exact contains_sound (entropyTerm_ball ((B3_2_3Little_sound (shape 0 2 2) ((stageBPriority (shape 3 2 3)) 2)) (3 : Fin 6)) CB3_2_3I2S0_2_2E_3Log_sound) (by decide +kernel) +def CB3_2_3I2S0_2_2Terms (a : Fin 6) : Ball := + match a.val with + | 2 => ⟨(4927939254607942230047241907443 / 50000000000000000000000000000000), (18969620493 / 50000000000000000000000000000000)⟩ + | 3 => ⟨(23562345346791984281077019860129 / 100000000000000000000000000000000), (11031015953 / 100000000000000000000000000000000)⟩ + | _ => (.exact 0) +lemma CB3_2_3I2S0_2_2Terms_sound (a : Fin 6) : + (CB3_2_3I2S0_2_2Terms a).Encloses (Foundation.entropyTerm (CB3_2_3I2S0_2_2Value a)) := by + fin_cases a + · exact (entropyTerm_zero_ball ((B3_2_3Little_sound (shape 0 2 2) ((stageBPriority (shape 3 2 3)) 2)) (0 : Fin 6))) + · exact (entropyTerm_zero_ball ((B3_2_3Little_sound (shape 0 2 2) ((stageBPriority (shape 3 2 3)) 2)) (1 : Fin 6))) + · exact CB3_2_3I2S0_2_2E_2_sound + · exact CB3_2_3I2S0_2_2E_3_sound + · exact (entropyTerm_zero_ball ((B3_2_3Little_sound (shape 0 2 2) ((stageBPriority (shape 3 2 3)) 2)) (4 : Fin 6))) + · exact (entropyTerm_zero_ball ((B3_2_3Little_sound (shape 0 2 2) ((stageBPriority (shape 3 2 3)) 2)) (5 : Fin 6))) +def CB3_2_3I2S0_2_2Entropy : Ball := ⟨(6683644771201573748234300735003 / 20000000000000000000000000000000), (48970256939 / 100000000000000000000000000000000)⟩ +lemma CB3_2_3I2S0_2_2Entropy_sound : CB3_2_3I2S0_2_2Entropy.Encloses (Foundation.finiteEntropy CB3_2_3I2S0_2_2Value) := by + exact contains_sound (entropyFin_enclosed 6 CB3_2_3I2S0_2_2Value CB3_2_3I2S0_2_2Terms CB3_2_3I2S0_2_2Terms_sound) (by decide +kernel) +def CB3_2_3I2S0_2_2Mass : Ball := ⟨1, 0⟩ +lemma CB3_2_3I2S0_2_2Mass_sound : CB3_2_3I2S0_2_2Mass.Encloses (∑ a, CB3_2_3I2S0_2_2Value a) := by + exact contains_sound (finSumBall_sound 6 (B3_2_3Little (shape 0 2 2) ((stageBPriority (shape 3 2 3)) 2)) CB3_2_3I2S0_2_2Value (B3_2_3Little_sound (shape 0 2 2) ((stageBPriority (shape 3 2 3)) 2))) (by decide +kernel) +def CB3_2_3I2S0_2_2MassTermLog : Ball := .exact 0 +lemma CB3_2_3I2S0_2_2MassTermLog_sound : CB3_2_3I2S0_2_2MassTermLog.Encloses (Real.log ((∑ a, CB3_2_3I2S0_2_2Value a))) := by + exact log_exact_one_ball (CB3_2_3I2S0_2_2Mass_sound) +def CB3_2_3I2S0_2_2MassTerm : Ball := ⟨0, 0⟩ +lemma CB3_2_3I2S0_2_2MassTerm_sound : CB3_2_3I2S0_2_2MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB3_2_3I2S0_2_2Value a))) := by + exact contains_sound (entropyTerm_ball (CB3_2_3I2S0_2_2Mass_sound) CB3_2_3I2S0_2_2MassTermLog_sound) (by decide +kernel) +def CB3_2_3I2S0_2_2H : Ball := ⟨(6683644771201573748234300735003 / 20000000000000000000000000000000), (48970256939 / 100000000000000000000000000000000)⟩ +lemma CB3_2_3I2S0_2_2H_sound : CB3_2_3I2S0_2_2H.Encloses (homogeneousEntropy CB3_2_3I2S0_2_2Value) := by + exact contains_sound (homogeneous_enclosed CB3_2_3I2S0_2_2Value CB3_2_3I2S0_2_2MassTerm_sound CB3_2_3I2S0_2_2Entropy_sound) (by decide +kernel) +def CB3_2_3I2S1_0_3Value (a : Fin 6) : ℝ := (littleLaw (shape 3 2 3) (shape 1 0 3) ((stageBPriority (shape 3 2 3)) 2) a : ℝ) +def CB3_2_3I2S1_0_3E_4Log : Ball := .exact 0 +lemma CB3_2_3I2S1_0_3E_4Log_sound : CB3_2_3I2S1_0_3E_4Log.Encloses (Real.log (CB3_2_3I2S1_0_3Value (4 : Fin 6))) := by + exact log_exact_one_ball ((B3_2_3Little_sound (shape 1 0 3) ((stageBPriority (shape 3 2 3)) 2)) (4 : Fin 6)) +def CB3_2_3I2S1_0_3E_4 : Ball := ⟨0, 0⟩ +lemma CB3_2_3I2S1_0_3E_4_sound : CB3_2_3I2S1_0_3E_4.Encloses (Foundation.entropyTerm (CB3_2_3I2S1_0_3Value (4 : Fin 6))) := by + exact contains_sound (entropyTerm_ball ((B3_2_3Little_sound (shape 1 0 3) ((stageBPriority (shape 3 2 3)) 2)) (4 : Fin 6)) CB3_2_3I2S1_0_3E_4Log_sound) (by decide +kernel) +def CB3_2_3I2S1_0_3Terms (a : Fin 6) : Ball := + match a.val with + | 4 => ⟨0, 0⟩ + | _ => (.exact 0) +lemma CB3_2_3I2S1_0_3Terms_sound (a : Fin 6) : + (CB3_2_3I2S1_0_3Terms a).Encloses (Foundation.entropyTerm (CB3_2_3I2S1_0_3Value a)) := by + fin_cases a + · exact (entropyTerm_zero_ball ((B3_2_3Little_sound (shape 1 0 3) ((stageBPriority (shape 3 2 3)) 2)) (0 : Fin 6))) + · exact (entropyTerm_zero_ball ((B3_2_3Little_sound (shape 1 0 3) ((stageBPriority (shape 3 2 3)) 2)) (1 : Fin 6))) + · exact (entropyTerm_zero_ball ((B3_2_3Little_sound (shape 1 0 3) ((stageBPriority (shape 3 2 3)) 2)) (2 : Fin 6))) + · exact (entropyTerm_zero_ball ((B3_2_3Little_sound (shape 1 0 3) ((stageBPriority (shape 3 2 3)) 2)) (3 : Fin 6))) + · exact CB3_2_3I2S1_0_3E_4_sound + · exact (entropyTerm_zero_ball ((B3_2_3Little_sound (shape 1 0 3) ((stageBPriority (shape 3 2 3)) 2)) (5 : Fin 6))) +def CB3_2_3I2S1_0_3Entropy : Ball := ⟨0, 0⟩ +lemma CB3_2_3I2S1_0_3Entropy_sound : CB3_2_3I2S1_0_3Entropy.Encloses (Foundation.finiteEntropy CB3_2_3I2S1_0_3Value) := by + exact contains_sound (entropyFin_enclosed 6 CB3_2_3I2S1_0_3Value CB3_2_3I2S1_0_3Terms CB3_2_3I2S1_0_3Terms_sound) (by decide +kernel) +def CB3_2_3I2S1_0_3Mass : Ball := ⟨1, 0⟩ +lemma CB3_2_3I2S1_0_3Mass_sound : CB3_2_3I2S1_0_3Mass.Encloses (∑ a, CB3_2_3I2S1_0_3Value a) := by + exact contains_sound (finSumBall_sound 6 (B3_2_3Little (shape 1 0 3) ((stageBPriority (shape 3 2 3)) 2)) CB3_2_3I2S1_0_3Value (B3_2_3Little_sound (shape 1 0 3) ((stageBPriority (shape 3 2 3)) 2))) (by decide +kernel) +def CB3_2_3I2S1_0_3MassTermLog : Ball := .exact 0 +lemma CB3_2_3I2S1_0_3MassTermLog_sound : CB3_2_3I2S1_0_3MassTermLog.Encloses (Real.log ((∑ a, CB3_2_3I2S1_0_3Value a))) := by + exact log_exact_one_ball (CB3_2_3I2S1_0_3Mass_sound) +def CB3_2_3I2S1_0_3MassTerm : Ball := ⟨0, 0⟩ +lemma CB3_2_3I2S1_0_3MassTerm_sound : CB3_2_3I2S1_0_3MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB3_2_3I2S1_0_3Value a))) := by + exact contains_sound (entropyTerm_ball (CB3_2_3I2S1_0_3Mass_sound) CB3_2_3I2S1_0_3MassTermLog_sound) (by decide +kernel) +def CB3_2_3I2S1_0_3H : Ball := ⟨0, 0⟩ +lemma CB3_2_3I2S1_0_3H_sound : CB3_2_3I2S1_0_3H.Encloses (homogeneousEntropy CB3_2_3I2S1_0_3Value) := by + exact contains_sound (homogeneous_enclosed CB3_2_3I2S1_0_3Value CB3_2_3I2S1_0_3MassTerm_sound CB3_2_3I2S1_0_3Entropy_sound) (by decide +kernel) +def CB3_2_3I2S2_0_2Value (a : Fin 6) : ℝ := (littleLaw (shape 3 2 3) (shape 2 0 2) ((stageBPriority (shape 3 2 3)) 2) a : ℝ) +def CB3_2_3I2S2_0_2E_2LogWitness : LogWitness := ⟨-1, 177987, 100000⟩ +def CB3_2_3I2S2_0_2E_2Log : Ball := ⟨(-11660685263090779968348502269377 / 100000000000000000000000000000000), (21175823683 / 50000000000000000000000000000000)⟩ +lemma CB3_2_3I2S2_0_2E_2Log_sound : CB3_2_3I2S2_0_2E_2Log.Encloses (Real.log (CB3_2_3I2S2_0_2Value (2 : Fin 6))) := by + exact checkLog_sound logTwoBall_sound ((B3_2_3Little_sound (shape 2 0 2) ((stageBPriority (shape 3 2 3)) 2)) (2 : Fin 6)) (w := CB3_2_3I2S2_0_2E_2LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB3_2_3I2S2_0_2E_2 : Ball := ⟨(5188625969804346635566112183549 / 50000000000000000000000000000000), (37690213299 / 100000000000000000000000000000000)⟩ +lemma CB3_2_3I2S2_0_2E_2_sound : CB3_2_3I2S2_0_2E_2.Encloses (Foundation.entropyTerm (CB3_2_3I2S2_0_2Value (2 : Fin 6))) := by + exact contains_sound (entropyTerm_ball ((B3_2_3Little_sound (shape 2 0 2) ((stageBPriority (shape 3 2 3)) 2)) (2 : Fin 6)) CB3_2_3I2S2_0_2E_2Log_sound) (by decide +kernel) +def CB3_2_3I2S2_0_2E_3LogWitness : LogWitness := ⟨-4, 22013, 12500⟩ +def CB3_2_3I2S2_0_2E_3Log : Ball := ⟨(-27583552232710530620549709460953 / 12500000000000000000000000000000), (21175823683 / 20000000000000000000000000000000)⟩ +lemma CB3_2_3I2S2_0_2E_3Log_sound : CB3_2_3I2S2_0_2E_3Log.Encloses (Real.log (CB3_2_3I2S2_0_2Value (3 : Fin 6))) := by + exact checkLog_sound logTwoBall_sound ((B3_2_3Little_sound (shape 2 0 2) ((stageBPriority (shape 3 2 3)) 2)) (3 : Fin 6)) (w := CB3_2_3I2S2_0_2E_3LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB3_2_3I2S2_0_2E_3 : Ball := ⟨(12143934705973138211003215087279 / 50000000000000000000000000000000), (11653585169 / 100000000000000000000000000000000)⟩ +lemma CB3_2_3I2S2_0_2E_3_sound : CB3_2_3I2S2_0_2E_3.Encloses (Foundation.entropyTerm (CB3_2_3I2S2_0_2Value (3 : Fin 6))) := by + exact contains_sound (entropyTerm_ball ((B3_2_3Little_sound (shape 2 0 2) ((stageBPriority (shape 3 2 3)) 2)) (3 : Fin 6)) CB3_2_3I2S2_0_2E_3Log_sound) (by decide +kernel) +def CB3_2_3I2S2_0_2Terms (a : Fin 6) : Ball := + match a.val with + | 2 => ⟨(5188625969804346635566112183549 / 50000000000000000000000000000000), (37690213299 / 100000000000000000000000000000000)⟩ + | 3 => ⟨(12143934705973138211003215087279 / 50000000000000000000000000000000), (11653585169 / 100000000000000000000000000000000)⟩ + | _ => (.exact 0) +lemma CB3_2_3I2S2_0_2Terms_sound (a : Fin 6) : + (CB3_2_3I2S2_0_2Terms a).Encloses (Foundation.entropyTerm (CB3_2_3I2S2_0_2Value a)) := by + fin_cases a + · exact (entropyTerm_zero_ball ((B3_2_3Little_sound (shape 2 0 2) ((stageBPriority (shape 3 2 3)) 2)) (0 : Fin 6))) + · exact (entropyTerm_zero_ball ((B3_2_3Little_sound (shape 2 0 2) ((stageBPriority (shape 3 2 3)) 2)) (1 : Fin 6))) + · exact CB3_2_3I2S2_0_2E_2_sound + · exact CB3_2_3I2S2_0_2E_3_sound + · exact (entropyTerm_zero_ball ((B3_2_3Little_sound (shape 2 0 2) ((stageBPriority (shape 3 2 3)) 2)) (4 : Fin 6))) + · exact (entropyTerm_zero_ball ((B3_2_3Little_sound (shape 2 0 2) ((stageBPriority (shape 3 2 3)) 2)) (5 : Fin 6))) +def CB3_2_3I2S2_0_2Entropy : Ball := ⟨(4333140168944371211642331817707 / 12500000000000000000000000000000), (12335949617 / 25000000000000000000000000000000)⟩ +lemma CB3_2_3I2S2_0_2Entropy_sound : CB3_2_3I2S2_0_2Entropy.Encloses (Foundation.finiteEntropy CB3_2_3I2S2_0_2Value) := by + exact contains_sound (entropyFin_enclosed 6 CB3_2_3I2S2_0_2Value CB3_2_3I2S2_0_2Terms CB3_2_3I2S2_0_2Terms_sound) (by decide +kernel) +def CB3_2_3I2S2_0_2Mass : Ball := ⟨1, 0⟩ +lemma CB3_2_3I2S2_0_2Mass_sound : CB3_2_3I2S2_0_2Mass.Encloses (∑ a, CB3_2_3I2S2_0_2Value a) := by + exact contains_sound (finSumBall_sound 6 (B3_2_3Little (shape 2 0 2) ((stageBPriority (shape 3 2 3)) 2)) CB3_2_3I2S2_0_2Value (B3_2_3Little_sound (shape 2 0 2) ((stageBPriority (shape 3 2 3)) 2))) (by decide +kernel) +def CB3_2_3I2S2_0_2MassTermLog : Ball := .exact 0 +lemma CB3_2_3I2S2_0_2MassTermLog_sound : CB3_2_3I2S2_0_2MassTermLog.Encloses (Real.log ((∑ a, CB3_2_3I2S2_0_2Value a))) := by + exact log_exact_one_ball (CB3_2_3I2S2_0_2Mass_sound) +def CB3_2_3I2S2_0_2MassTerm : Ball := ⟨0, 0⟩ +lemma CB3_2_3I2S2_0_2MassTerm_sound : CB3_2_3I2S2_0_2MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB3_2_3I2S2_0_2Value a))) := by + exact contains_sound (entropyTerm_ball (CB3_2_3I2S2_0_2Mass_sound) CB3_2_3I2S2_0_2MassTermLog_sound) (by decide +kernel) +def CB3_2_3I2S2_0_2H : Ball := ⟨(4333140168944371211642331817707 / 12500000000000000000000000000000), (12335949617 / 25000000000000000000000000000000)⟩ +lemma CB3_2_3I2S2_0_2H_sound : CB3_2_3I2S2_0_2H.Encloses (homogeneousEntropy CB3_2_3I2S2_0_2Value) := by + exact contains_sound (homogeneous_enclosed CB3_2_3I2S2_0_2Value CB3_2_3I2S2_0_2MassTerm_sound CB3_2_3I2S2_0_2Entropy_sound) (by decide +kernel) +def CB3_2_3I2S3_0_1Value (a : Fin 6) : ℝ := (littleLaw (shape 3 2 3) (shape 3 0 1) ((stageBPriority (shape 3 2 3)) 2) a : ℝ) +def CB3_2_3I2S3_0_1E_1Log : Ball := .exact 0 +lemma CB3_2_3I2S3_0_1E_1Log_sound : CB3_2_3I2S3_0_1E_1Log.Encloses (Real.log (CB3_2_3I2S3_0_1Value (1 : Fin 6))) := by + exact log_exact_one_ball ((B3_2_3Little_sound (shape 3 0 1) ((stageBPriority (shape 3 2 3)) 2)) (1 : Fin 6)) +def CB3_2_3I2S3_0_1E_1 : Ball := ⟨0, 0⟩ +lemma CB3_2_3I2S3_0_1E_1_sound : CB3_2_3I2S3_0_1E_1.Encloses (Foundation.entropyTerm (CB3_2_3I2S3_0_1Value (1 : Fin 6))) := by + exact contains_sound (entropyTerm_ball ((B3_2_3Little_sound (shape 3 0 1) ((stageBPriority (shape 3 2 3)) 2)) (1 : Fin 6)) CB3_2_3I2S3_0_1E_1Log_sound) (by decide +kernel) +def CB3_2_3I2S3_0_1Terms (a : Fin 6) : Ball := + match a.val with + | 1 => ⟨0, 0⟩ + | _ => (.exact 0) +lemma CB3_2_3I2S3_0_1Terms_sound (a : Fin 6) : + (CB3_2_3I2S3_0_1Terms a).Encloses (Foundation.entropyTerm (CB3_2_3I2S3_0_1Value a)) := by + fin_cases a + · exact (entropyTerm_zero_ball ((B3_2_3Little_sound (shape 3 0 1) ((stageBPriority (shape 3 2 3)) 2)) (0 : Fin 6))) + · exact CB3_2_3I2S3_0_1E_1_sound + · exact (entropyTerm_zero_ball ((B3_2_3Little_sound (shape 3 0 1) ((stageBPriority (shape 3 2 3)) 2)) (2 : Fin 6))) + · exact (entropyTerm_zero_ball ((B3_2_3Little_sound (shape 3 0 1) ((stageBPriority (shape 3 2 3)) 2)) (3 : Fin 6))) + · exact (entropyTerm_zero_ball ((B3_2_3Little_sound (shape 3 0 1) ((stageBPriority (shape 3 2 3)) 2)) (4 : Fin 6))) + · exact (entropyTerm_zero_ball ((B3_2_3Little_sound (shape 3 0 1) ((stageBPriority (shape 3 2 3)) 2)) (5 : Fin 6))) +def CB3_2_3I2S3_0_1Entropy : Ball := ⟨0, 0⟩ +lemma CB3_2_3I2S3_0_1Entropy_sound : CB3_2_3I2S3_0_1Entropy.Encloses (Foundation.finiteEntropy CB3_2_3I2S3_0_1Value) := by + exact contains_sound (entropyFin_enclosed 6 CB3_2_3I2S3_0_1Value CB3_2_3I2S3_0_1Terms CB3_2_3I2S3_0_1Terms_sound) (by decide +kernel) +def CB3_2_3I2S3_0_1Mass : Ball := ⟨1, 0⟩ +lemma CB3_2_3I2S3_0_1Mass_sound : CB3_2_3I2S3_0_1Mass.Encloses (∑ a, CB3_2_3I2S3_0_1Value a) := by + exact contains_sound (finSumBall_sound 6 (B3_2_3Little (shape 3 0 1) ((stageBPriority (shape 3 2 3)) 2)) CB3_2_3I2S3_0_1Value (B3_2_3Little_sound (shape 3 0 1) ((stageBPriority (shape 3 2 3)) 2))) (by decide +kernel) +def CB3_2_3I2S3_0_1MassTermLog : Ball := .exact 0 +lemma CB3_2_3I2S3_0_1MassTermLog_sound : CB3_2_3I2S3_0_1MassTermLog.Encloses (Real.log ((∑ a, CB3_2_3I2S3_0_1Value a))) := by + exact log_exact_one_ball (CB3_2_3I2S3_0_1Mass_sound) +def CB3_2_3I2S3_0_1MassTerm : Ball := ⟨0, 0⟩ +lemma CB3_2_3I2S3_0_1MassTerm_sound : CB3_2_3I2S3_0_1MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB3_2_3I2S3_0_1Value a))) := by + exact contains_sound (entropyTerm_ball (CB3_2_3I2S3_0_1Mass_sound) CB3_2_3I2S3_0_1MassTermLog_sound) (by decide +kernel) +def CB3_2_3I2S3_0_1H : Ball := ⟨0, 0⟩ +lemma CB3_2_3I2S3_0_1H_sound : CB3_2_3I2S3_0_1H.Encloses (homogeneousEntropy CB3_2_3I2S3_0_1Value) := by + exact contains_sound (homogeneous_enclosed CB3_2_3I2S3_0_1Value CB3_2_3I2S3_0_1MassTerm_sound CB3_2_3I2S3_0_1Entropy_sound) (by decide +kernel) +def CB3_2_3I2Singles (s : Shape) : Ball := + match s 0, s 1, s 2 with + | 0, 1, 3 => CB3_2_3I2S0_1_3H + | 0, 2, 2 => CB3_2_3I2S0_2_2H + | 1, 0, 3 => CB3_2_3I2S1_0_3H + | 2, 0, 2 => CB3_2_3I2S2_0_2H + | 3, 0, 1 => CB3_2_3I2S3_0_1H + | _, _, _ => (.exact 0) +lemma CB3_2_3I2Singles_sound (u : Shape) (hu : u ∈ below (shape 3 2 3)) + (hd : designated (stageBPriority (shape 3 2 3)) 2 u) : + (CB3_2_3I2Singles u).Encloses (homogeneousEntropy ((fun u a => (littleLaw (shape 3 2 3) u ((stageBPriority (shape 3 2 3)) 2) a : ℝ)) u)) := by + rw [B3_2_3_below] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl + · exact CB3_2_3I2S0_1_3H_sound + · exact CB3_2_3I2S0_2_2H_sound + · exact CB3_2_3I2S1_0_3H_sound + · exact (show ¬ designated (stageBPriority (shape 3 2 3)) 2 (shape 1 1 2) by decide +kernel) hd |>.elim + · exact (show ¬ designated (stageBPriority (shape 3 2 3)) 2 (shape 1 2 1) by decide +kernel) hd |>.elim + · exact CB3_2_3I2S2_0_2H_sound + · exact (show ¬ designated (stageBPriority (shape 3 2 3)) 2 (shape 2 1 1) by decide +kernel) hd |>.elim + · exact (show ¬ designated (stageBPriority (shape 3 2 3)) 2 (shape 2 2 0) by decide +kernel) hd |>.elim + · exact CB3_2_3I2S3_0_1H_sound + · exact (show ¬ designated (stageBPriority (shape 3 2 3)) 2 (shape 3 1 0) by decide +kernel) hd |>.elim +def CB3_2_3I2Singleton : Ball := ⟨(2997173016171163830905521820877 / 50000000000000000000000000000000), (1068609679 / 12500000000000000000000000000000)⟩ +lemma CB3_2_3I2Singleton_sound : CB3_2_3I2Singleton.Encloses + (singletonEntropy (below (shape 3 2 3)) (fun u => (stageBLaw (shape 3 2 3) u : ℝ)) (stageBPriority (shape 3 2 3)) 2 (fun u a => (littleLaw (shape 3 2 3) u ((stageBPriority (shape 3 2 3)) 2) a : ℝ))) := by + exact contains_sound (singletonBall_sound (below (shape 3 2 3)) B3_2_3Law (fun u => (stageBLaw (shape 3 2 3) u : ℝ)) (stageBPriority (shape 3 2 3)) 2 + CB3_2_3I2Singles (fun u a => (littleLaw (shape 3 2 3) u ((stageBPriority (shape 3 2 3)) 2) a : ℝ)) (fun u _ => B3_2_3Law_sound u) CB3_2_3I2Singles_sound) (by decide +kernel) +def CB3_2_3I2Group : Ball := ⟨(6937026787468251354457692241319 / 100000000000000000000000000000000), (56735385719 / 50000000000000000000000000000000)⟩ +lemma CB3_2_3I2Group_sound : CB3_2_3I2Group.Encloses + (groupedEntropy (below (shape 3 2 3)) (fun u => (stageBLaw (shape 3 2 3) u : ℝ)) (stageBPriority (shape 3 2 3)) 2 (fun u a => (littleLaw (shape 3 2 3) u ((stageBPriority (shape 3 2 3)) 2) a : ℝ))) := by + exact contains_sound (Ball.add_sound CB3_2_3I2Singleton_sound + (finSumBall_sound 17 CB3_2_3I2ResidualEntropies _ CB3_2_3I2ResidualEntropies_sound)) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CB3_2_3I2H : Ball := ⟨(21151229057927517635294544770749 / 25000000000000000000000000000000), (317902791617 / 100000000000000000000000000000000)⟩ +lemma CB3_2_3I2_sound : CB3_2_3I2H.Encloses (stageBCapacity (shape 3 2 3) 2) := by + have hb := contains_sound (Ball.add_sound CB3_2_3I2PairH_sound + (Ball.neg_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) CB3_2_3I2Group_sound))) + (show contains (.add CB3_2_3I2PairH (.neg (.mul (.exact 2) CB3_2_3I2Group))) CB3_2_3I2H = true by decide +kernel) + unfold CB3_2_3I2PairValue at hb + simpa only [stageBCapacity, nativeCapacity, + show (2 : Fin 3) ≠ 0 by decide, ite_false, sub_eq_add_neg] using hb + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/CapacityB/CapB3_3_2I0.lean b/lean/OAI/LinearAlgebra/MatrixFields/CapacityB/CapB3_3_2I0.lean new file mode 100644 index 0000000000000000000000000000000000000000..a40e8d08ee42a4dbb7e1fc937a2740bf3c131868 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/CapacityB/CapB3_3_2I0.lean @@ -0,0 +1,75 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Certificates.Terminal3_3_2 + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CB3_3_2I0Value (a : Fin 17) : ℝ := marginal (below (shape 3 3 2)) (fun u => (stageBLaw (shape 3 3 2) u : ℝ)) ((stageBPriority (shape 3 3 2)) 0) a +def CB3_3_2I0Raw (a : Fin 17) : Ball := marginalBall (below (shape 3 3 2)) B3_3_2Law ((stageBPriority (shape 3 3 2)) 0) a +lemma CB3_3_2I0Raw_sound (a : Fin 17) : + (CB3_3_2I0Raw a).Encloses (CB3_3_2I0Value a) := by + exact marginalBall_sound (below (shape 3 3 2)) B3_3_2Law (fun u => (stageBLaw (shape 3 3 2) u : ℝ)) (fun u _ => B3_3_2Law_sound u) ((stageBPriority (shape 3 3 2)) 0) a +def CB3_3_2I0Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(330535454043745680088327227499 / 25000000000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ ⟨(2859737996082385988803712780319 / 50000000000000000000000000000000), (2239795391 / 100000000000000000000000000000000)⟩ ⟨(-17303668705408561775845756218399 / 4000000000000000000000000000000), (169406589917 / 100000000000000000000000000000000)⟩ ⟨-7, 330535454043745680088327227499, 195312500000000000000000000000⟩, + .log ⟨(9735571636765003455929338218001 / 20000000000000000000000000000000), (13 / 25000000000000000000000000000000)⟩ ⟨(35045425233336004962761276330757 / 100000000000000000000000000000000), (6184762471 / 20000000000000000000000000000000)⟩ ⟨(-71994591670389305922740185860467 / 100000000000000000000000000000000), (15881867789 / 25000000000000000000000000000000)⟩ ⟨-2, 9735571636765003455929338218001, 5000000000000000000000000000000⟩] +lemma CB3_3_2I0Certificates_valid : + CB3_3_2I0Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB3_3_2I0CertificateIndex (a : Fin 17) : ℕ := + match a.val with + | 0 => 1 + | 1 => 2 + | 2 => 2 + | 3 => 1 + | _ => 0 +def CB3_3_2I0P (a : Fin 17) : Ball := + (CompactCertificate.entropyLookup CB3_3_2I0Certificates (CB3_3_2I0CertificateIndex a)).input +lemma CB3_3_2I0P_check : ∀ a : Fin 17, contains (CB3_3_2I0Raw a) (CB3_3_2I0P a) = true := by + decide +kernel +lemma CB3_3_2I0P_sound (a : Fin 17) : + (CB3_3_2I0P a).Encloses (CB3_3_2I0Value a) := + contains_sound (CB3_3_2I0Raw_sound a) (CB3_3_2I0P_check a) +def CB3_3_2I0Terms (a : Fin 17) : Ball := + (CompactCertificate.entropyLookup CB3_3_2I0Certificates (CB3_3_2I0CertificateIndex a)).output +lemma CB3_3_2I0Terms_sound (a : Fin 17) : + (CB3_3_2I0Terms a).Encloses (Foundation.entropyTerm (CB3_3_2I0Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB3_3_2I0Certificates_valid + (CB3_3_2I0CertificateIndex a) (CB3_3_2I0P_sound a) +def CB3_3_2I0Entropy : Ball := ⟨(8152980245100155388073740378279 / 10000000000000000000000000000000), (16581803873 / 25000000000000000000000000000000)⟩ +lemma CB3_3_2I0Entropy_sound : CB3_3_2I0Entropy.Encloses (Foundation.finiteEntropy CB3_3_2I0Value) := by + exact contains_sound (entropyFin_enclosed 17 CB3_3_2I0Value CB3_3_2I0Terms CB3_3_2I0Terms_sound) (by decide +kernel) +def CB3_3_2I0Mass : Ball := ⟨(50000000000000000000000000000001 / 50000000000000000000000000000000), (29 / 25000000000000000000000000000000)⟩ +lemma CB3_3_2I0Mass_sound : CB3_3_2I0Mass.Encloses (∑ a, CB3_3_2I0Value a) := by + exact contains_sound (finSumBall_sound 17 CB3_3_2I0P CB3_3_2I0Value CB3_3_2I0P_sound) (by decide +kernel) +def CB3_3_2I0MassTermLogWitness : LogWitness := ⟨0, 50000000000000000000000000000001, 50000000000000000000000000000000⟩ +def CB3_3_2I0MassTermLog : Ball := ⟨(1 / 50000000000000000000000000000000), (10587911899 / 50000000000000000000000000000000)⟩ +lemma CB3_3_2I0MassTermLog_sound : CB3_3_2I0MassTermLog.Encloses (Real.log ((∑ a, CB3_3_2I0Value a))) := by + exact checkLog_sound logTwoBall_sound (CB3_3_2I0Mass_sound) (w := CB3_3_2I0MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB3_3_2I0MassTerm : Ball := ⟨(-1 / 50000000000000000000000000000000), (21175823799 / 100000000000000000000000000000000)⟩ +lemma CB3_3_2I0MassTerm_sound : CB3_3_2I0MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB3_3_2I0Value a))) := by + exact contains_sound (entropyTerm_ball (CB3_3_2I0Mass_sound) CB3_3_2I0MassTermLog_sound) (by decide +kernel) +def CB3_3_2I0H : Ball := ⟨(10191225306375194235092175472849 / 12500000000000000000000000000000), (87503039291 / 100000000000000000000000000000000)⟩ +lemma CB3_3_2I0H_sound : CB3_3_2I0H.Encloses (homogeneousEntropy CB3_3_2I0Value) := by + exact contains_sound (homogeneous_enclosed CB3_3_2I0Value CB3_3_2I0MassTerm_sound CB3_3_2I0Entropy_sound) (by decide +kernel) +lemma CB3_3_2I0_sound : CB3_3_2I0H.Encloses (stageBCapacity (shape 3 3 2) 0) := by + exact CB3_3_2I0H_sound + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/CapacityB/CapB3_3_2I1.lean b/lean/OAI/LinearAlgebra/MatrixFields/CapacityB/CapB3_3_2I1.lean new file mode 100644 index 0000000000000000000000000000000000000000..acbc84b74f48fd9dd30863551ad6906b8ae7cca9 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/CapacityB/CapB3_3_2I1.lean @@ -0,0 +1,930 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Certificates.Terminal3_3_2 + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CB3_3_2I1PairValue (a : PairSlot) : ℝ := pairLaw (below (shape 3 3 2)) (shape 3 3 2) (fun u => (stageBLaw (shape 3 3 2) u : ℝ)) (fun u a => (littleLaw (shape 3 3 2) u ((stageBPriority (shape 3 3 2)) 1) a : ℝ)) a +def CB3_3_2I1PairRaw (a : PairSlot) : Ball := pairLawBall (below (shape 3 3 2)) (shape 3 3 2) B3_3_2Law (fun u => B3_3_2Little u ((stageBPriority (shape 3 3 2)) 1)) a +lemma CB3_3_2I1PairRaw_sound (a : PairSlot) : + (CB3_3_2I1PairRaw a).Encloses (CB3_3_2I1PairValue a) := by + exact pairLawBall_sound_on (below (shape 3 3 2)) (shape 3 3 2) B3_3_2Law (fun u => (stageBLaw (shape 3 3 2) u : ℝ)) (fun u => B3_3_2Little u ((stageBPriority (shape 3 3 2)) 1)) (fun u a => (littleLaw (shape 3 3 2) u ((stageBPriority (shape 3 3 2)) 1) a : ℝ)) (fun u _ => B3_3_2Law_sound u) (fun u _ a => B3_3_2Little_sound u ((stageBPriority (shape 3 3 2)) 1) a) (fun u _ a => B3_3_2Little_sound (complement (shape 3 3 2) u) ((stageBPriority (shape 3 3 2)) 1) a) a +def CB3_3_2I1PairCertificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(352404218026259944720747217461 / 2000000000000000000000000000000), (19 / 50000000000000000000000000000000)⟩ ⟨(305908639144537452726962818817 / 1000000000000000000000000000000), (14924899277 / 100000000000000000000000000000000)⟩ ⟨(-173612359612416556203456163471167 / 100000000000000000000000000000000), (84703294947 / 100000000000000000000000000000000)⟩ ⟨-3, 352404218026259944720747217461, 250000000000000000000000000000⟩, + .log ⟨(869669780516483806804489600199 / 100000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ ⟨(4126419513227620457468057806713 / 100000000000000000000000000000000), (1473277933 / 100000000000000000000000000000000)⟩ ⟨(-118620297199961402332027038548361 / 25000000000000000000000000000000), (10587911863 / 6250000000000000000000000000000)⟩ ⟨-7, 869669780516483806804489600199, 781250000000000000000000000000⟩, + .log ⟨(984691228692828717411192172711 / 1562500000000000000000000000000), (19 / 50000000000000000000000000000000)⟩ ⟨(5819468607084188418648869952333 / 20000000000000000000000000000000), (6672527323 / 25000000000000000000000000000000)⟩ ⟨(-11542856574745563783199720241677 / 25000000000000000000000000000000), (1694065897 / 4000000000000000000000000000000)⟩ ⟨-1, 984691228692828717411192172711, 781250000000000000000000000000⟩] +lemma CB3_3_2I1PairCertificates_valid : + CB3_3_2I1PairCertificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB3_3_2I1PairCertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 2, 0 => 1 + | 3, 0 => 2 + | 1, 1 => 3 + | 0, 2 => 1 + | 0, 3 => 2 + | _, _ => 0 +def CB3_3_2I1PairP (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CB3_3_2I1PairCertificates (CB3_3_2I1PairCertificateIndex a)).input +lemma CB3_3_2I1PairP_check : ∀ a : PairSlot, contains (CB3_3_2I1PairRaw a) (CB3_3_2I1PairP a) = true := by + decide +kernel +lemma CB3_3_2I1PairP_sound (a : PairSlot) : + (CB3_3_2I1PairP a).Encloses (CB3_3_2I1PairValue a) := + contains_sound (CB3_3_2I1PairRaw_sound a) (CB3_3_2I1PairP_check a) +def CB3_3_2I1PairTerms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CB3_3_2I1PairCertificates (CB3_3_2I1PairCertificateIndex a)).output +lemma CB3_3_2I1PairTerms_sound (a : PairSlot) : + (CB3_3_2I1PairTerms a).Encloses (Foundation.entropyTerm (CB3_3_2I1PairValue a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB3_3_2I1PairCertificates_valid + (CB3_3_2I1PairCertificateIndex a) (CB3_3_2I1PairP_sound a) +def CB3_3_2I1PairEntropy : Ball := ⟨(98531909890783673553573029138491 / 100000000000000000000000000000000), (1858951991 / 3125000000000000000000000000000)⟩ +lemma CB3_3_2I1PairEntropy_sound : CB3_3_2I1PairEntropy.Encloses (Foundation.finiteEntropy CB3_3_2I1PairValue) := by + exact contains_sound (entropyPair_enclosed CB3_3_2I1PairValue CB3_3_2I1PairTerms CB3_3_2I1PairTerms_sound) (by decide +kernel) +def CB3_3_2I1PairMass : Ball := ⟨(50000000000000000000000000000001 / 50000000000000000000000000000000), (3 / 2500000000000000000000000000000)⟩ +lemma CB3_3_2I1PairMass_sound : CB3_3_2I1PairMass.Encloses (∑ a, CB3_3_2I1PairValue a) := by + exact contains_sound (pairSumBall_sound CB3_3_2I1PairP CB3_3_2I1PairValue CB3_3_2I1PairP_sound) (by decide +kernel) +def CB3_3_2I1PairMassTermLogWitness : LogWitness := ⟨0, 50000000000000000000000000000001, 50000000000000000000000000000000⟩ +def CB3_3_2I1PairMassTermLog : Ball := ⟨(1 / 50000000000000000000000000000000), (10587911901 / 50000000000000000000000000000000)⟩ +lemma CB3_3_2I1PairMassTermLog_sound : CB3_3_2I1PairMassTermLog.Encloses (Real.log ((∑ a, CB3_3_2I1PairValue a))) := by + exact checkLog_sound logTwoBall_sound (CB3_3_2I1PairMass_sound) (w := CB3_3_2I1PairMassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB3_3_2I1PairMassTerm : Ball := ⟨(-1 / 50000000000000000000000000000000), (21175823803 / 100000000000000000000000000000000)⟩ +lemma CB3_3_2I1PairMassTerm_sound : CB3_3_2I1PairMassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB3_3_2I1PairValue a))) := by + exact contains_sound (entropyTerm_ball (CB3_3_2I1PairMass_sound) CB3_3_2I1PairMassTermLog_sound) (by decide +kernel) +def CB3_3_2I1PairH : Ball := ⟨(98531909890783673553573029138493 / 100000000000000000000000000000000), (16132457503 / 20000000000000000000000000000000)⟩ +lemma CB3_3_2I1PairH_sound : CB3_3_2I1PairH.Encloses (homogeneousEntropy CB3_3_2I1PairValue) := by + exact contains_sound (homogeneous_enclosed CB3_3_2I1PairValue CB3_3_2I1PairMassTerm_sound CB3_3_2I1PairEntropy_sound) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CB3_3_2I1R0Value (a : Fin 6) : ℝ := residualLaw (below (shape 3 3 2)) (fun u => (stageBLaw (shape 3 3 2) u : ℝ)) (stageBPriority (shape 3 3 2)) 1 (fun u a => (littleLaw (shape 3 3 2) u ((stageBPriority (shape 3 3 2)) 1) a : ℝ)) 0 a +def CB3_3_2I1R0Raw (a : Fin 6) : Ball := residualBall (below (shape 3 3 2)) B3_3_2Law (stageBPriority (shape 3 3 2)) 1 (fun u => B3_3_2Little u ((stageBPriority (shape 3 3 2)) 1)) 0 a +lemma CB3_3_2I1R0Raw_sound (a : Fin 6) : + (CB3_3_2I1R0Raw a).Encloses (CB3_3_2I1R0Value a) := by + exact residualBall_sound_on (below (shape 3 3 2)) B3_3_2Law (fun u => (stageBLaw (shape 3 3 2) u : ℝ)) (stageBPriority (shape 3 3 2)) 1 (fun u => B3_3_2Little u ((stageBPriority (shape 3 3 2)) 1)) (fun u a => (littleLaw (shape 3 3 2) u ((stageBPriority (shape 3 3 2)) 1) a : ℝ)) (fun u _ => B3_3_2Law_sound u) (fun u _ a => B3_3_2Little_sound u ((stageBPriority (shape 3 3 2)) 1) a) 0 a +def CB3_3_2I1R0Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(18489880681829481042841850473249 / 100000000000000000000000000000000), (39 / 100000000000000000000000000000000)⟩ ⟨(7802482778836922680991273189919 / 25000000000000000000000000000000), (3132307647 / 20000000000000000000000000000000)⟩ ⟨(-42198664843222266306978424190797 / 25000000000000000000000000000000), (42351647471 / 50000000000000000000000000000000)⟩ ⟨-3, 18489880681829481042841850473249, 12500000000000000000000000000000⟩] +lemma CB3_3_2I1R0Certificates_valid : + CB3_3_2I1R0Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB3_3_2I1R0CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | 0 => 1 + | _ => 0 +def CB3_3_2I1R0P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_3_2I1R0Certificates (CB3_3_2I1R0CertificateIndex a)).input +lemma CB3_3_2I1R0P_check : ∀ a : Fin 6, contains (CB3_3_2I1R0Raw a) (CB3_3_2I1R0P a) = true := by + decide +kernel +lemma CB3_3_2I1R0P_sound (a : Fin 6) : + (CB3_3_2I1R0P a).Encloses (CB3_3_2I1R0Value a) := + contains_sound (CB3_3_2I1R0Raw_sound a) (CB3_3_2I1R0P_check a) +def CB3_3_2I1R0Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_3_2I1R0Certificates (CB3_3_2I1R0CertificateIndex a)).output +lemma CB3_3_2I1R0Terms_sound (a : Fin 6) : + (CB3_3_2I1R0Terms a).Encloses (Foundation.entropyTerm (CB3_3_2I1R0Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB3_3_2I1R0Certificates_valid + (CB3_3_2I1R0CertificateIndex a) (CB3_3_2I1R0P_sound a) +def CB3_3_2I1R0Entropy : Ball := ⟨(7802482778836922680991273189919 / 25000000000000000000000000000000), (3132307647 / 20000000000000000000000000000000)⟩ +lemma CB3_3_2I1R0Entropy_sound : CB3_3_2I1R0Entropy.Encloses (Foundation.finiteEntropy CB3_3_2I1R0Value) := by + exact contains_sound (entropyFin_enclosed 6 CB3_3_2I1R0Value CB3_3_2I1R0Terms CB3_3_2I1R0Terms_sound) (by decide +kernel) +def CB3_3_2I1R0Mass : Ball := ⟨(18489880681829481042841850473249 / 100000000000000000000000000000000), (39 / 100000000000000000000000000000000)⟩ +lemma CB3_3_2I1R0Mass_sound : CB3_3_2I1R0Mass.Encloses (∑ a, CB3_3_2I1R0Value a) := by + exact contains_sound (finSumBall_sound 6 CB3_3_2I1R0P CB3_3_2I1R0Value CB3_3_2I1R0P_sound) (by decide +kernel) +def CB3_3_2I1R0MassTermLogWitness : LogWitness := ⟨-3, 18489880681829481042841850473249, 12500000000000000000000000000000⟩ +def CB3_3_2I1R0MassTermLog : Ball := ⟨(-42198664843222266306978424190797 / 25000000000000000000000000000000), (42351647471 / 50000000000000000000000000000000)⟩ +lemma CB3_3_2I1R0MassTermLog_sound : CB3_3_2I1R0MassTermLog.Encloses (Real.log ((∑ a, CB3_3_2I1R0Value a))) := by + exact checkLog_sound logTwoBall_sound (CB3_3_2I1R0Mass_sound) (w := CB3_3_2I1R0MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB3_3_2I1R0MassTerm : Ball := ⟨(7802482778836922680991273189919 / 25000000000000000000000000000000), (3132307647 / 20000000000000000000000000000000)⟩ +lemma CB3_3_2I1R0MassTerm_sound : CB3_3_2I1R0MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB3_3_2I1R0Value a))) := by + exact contains_sound (entropyTerm_ball (CB3_3_2I1R0Mass_sound) CB3_3_2I1R0MassTermLog_sound) (by decide +kernel) +def CB3_3_2I1R0H : Ball := ⟨0, (3132307647 / 10000000000000000000000000000000)⟩ +lemma CB3_3_2I1R0H_sound : CB3_3_2I1R0H.Encloses (homogeneousEntropy CB3_3_2I1R0Value) := by + exact contains_sound (homogeneous_enclosed CB3_3_2I1R0Value CB3_3_2I1R0MassTerm_sound CB3_3_2I1R0Entropy_sound) (by decide +kernel) +def CB3_3_2I1R1Value (a : Fin 6) : ℝ := residualLaw (below (shape 3 3 2)) (fun u => (stageBLaw (shape 3 3 2) u : ℝ)) (stageBPriority (shape 3 3 2)) 1 (fun u a => (littleLaw (shape 3 3 2) u ((stageBPriority (shape 3 3 2)) 1) a : ℝ)) 1 a +def CB3_3_2I1R1Raw (a : Fin 6) : Ball := residualBall (below (shape 3 3 2)) B3_3_2Law (stageBPriority (shape 3 3 2)) 1 (fun u => B3_3_2Little u ((stageBPriority (shape 3 3 2)) 1)) 1 a +lemma CB3_3_2I1R1Raw_sound (a : Fin 6) : + (CB3_3_2I1R1Raw a).Encloses (CB3_3_2I1R1Value a) := by + exact residualBall_sound_on (below (shape 3 3 2)) B3_3_2Law (fun u => (stageBLaw (shape 3 3 2) u : ℝ)) (stageBPriority (shape 3 3 2)) 1 (fun u => B3_3_2Little u ((stageBPriority (shape 3 3 2)) 1)) (fun u a => (littleLaw (shape 3 3 2) u ((stageBPriority (shape 3 3 2)) 1) a : ℝ)) (fun u _ => B3_3_2Law_sound u) (fun u _ a => B3_3_2Little_sound u ((stageBPriority (shape 3 3 2)) 1) a) 1 a +def CB3_3_2I1R1Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(31429488099598970025128198206017 / 50000000000000000000000000000000), (37 / 100000000000000000000000000000000)⟩ ⟨(29183941801875615336802034527761 / 100000000000000000000000000000000), (3327726499 / 12500000000000000000000000000000)⟩ ⟨(-23213822087550952568918865056779 / 50000000000000000000000000000000), (661744491 / 1562500000000000000000000000000)⟩ ⟨-1, 31429488099598970025128198206017, 25000000000000000000000000000000⟩] +lemma CB3_3_2I1R1Certificates_valid : + CB3_3_2I1R1Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB3_3_2I1R1CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | 1 => 1 + | _ => 0 +def CB3_3_2I1R1P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_3_2I1R1Certificates (CB3_3_2I1R1CertificateIndex a)).input +lemma CB3_3_2I1R1P_check : ∀ a : Fin 6, contains (CB3_3_2I1R1Raw a) (CB3_3_2I1R1P a) = true := by + decide +kernel +lemma CB3_3_2I1R1P_sound (a : Fin 6) : + (CB3_3_2I1R1P a).Encloses (CB3_3_2I1R1Value a) := + contains_sound (CB3_3_2I1R1Raw_sound a) (CB3_3_2I1R1P_check a) +def CB3_3_2I1R1Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_3_2I1R1Certificates (CB3_3_2I1R1CertificateIndex a)).output +lemma CB3_3_2I1R1Terms_sound (a : Fin 6) : + (CB3_3_2I1R1Terms a).Encloses (Foundation.entropyTerm (CB3_3_2I1R1Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB3_3_2I1R1Certificates_valid + (CB3_3_2I1R1CertificateIndex a) (CB3_3_2I1R1P_sound a) +def CB3_3_2I1R1Entropy : Ball := ⟨(29183941801875615336802034527761 / 100000000000000000000000000000000), (3327726499 / 12500000000000000000000000000000)⟩ +lemma CB3_3_2I1R1Entropy_sound : CB3_3_2I1R1Entropy.Encloses (Foundation.finiteEntropy CB3_3_2I1R1Value) := by + exact contains_sound (entropyFin_enclosed 6 CB3_3_2I1R1Value CB3_3_2I1R1Terms CB3_3_2I1R1Terms_sound) (by decide +kernel) +def CB3_3_2I1R1Mass : Ball := ⟨(31429488099598970025128198206017 / 50000000000000000000000000000000), (37 / 100000000000000000000000000000000)⟩ +lemma CB3_3_2I1R1Mass_sound : CB3_3_2I1R1Mass.Encloses (∑ a, CB3_3_2I1R1Value a) := by + exact contains_sound (finSumBall_sound 6 CB3_3_2I1R1P CB3_3_2I1R1Value CB3_3_2I1R1P_sound) (by decide +kernel) +def CB3_3_2I1R1MassTermLogWitness : LogWitness := ⟨-1, 31429488099598970025128198206017, 25000000000000000000000000000000⟩ +def CB3_3_2I1R1MassTermLog : Ball := ⟨(-23213822087550952568918865056779 / 50000000000000000000000000000000), (661744491 / 1562500000000000000000000000000)⟩ +lemma CB3_3_2I1R1MassTermLog_sound : CB3_3_2I1R1MassTermLog.Encloses (Real.log ((∑ a, CB3_3_2I1R1Value a))) := by + exact checkLog_sound logTwoBall_sound (CB3_3_2I1R1Mass_sound) (w := CB3_3_2I1R1MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB3_3_2I1R1MassTerm : Ball := ⟨(29183941801875615336802034527761 / 100000000000000000000000000000000), (3327726499 / 12500000000000000000000000000000)⟩ +lemma CB3_3_2I1R1MassTerm_sound : CB3_3_2I1R1MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB3_3_2I1R1Value a))) := by + exact contains_sound (entropyTerm_ball (CB3_3_2I1R1Mass_sound) CB3_3_2I1R1MassTermLog_sound) (by decide +kernel) +def CB3_3_2I1R1H : Ball := ⟨0, (3327726499 / 6250000000000000000000000000000)⟩ +lemma CB3_3_2I1R1H_sound : CB3_3_2I1R1H.Encloses (homogeneousEntropy CB3_3_2I1R1Value) := by + exact contains_sound (homogeneous_enclosed CB3_3_2I1R1Value CB3_3_2I1R1MassTerm_sound CB3_3_2I1R1Entropy_sound) (by decide +kernel) +def CB3_3_2I1R2Value (a : Fin 6) : ℝ := residualLaw (below (shape 3 3 2)) (fun u => (stageBLaw (shape 3 3 2) u : ℝ)) (stageBPriority (shape 3 3 2)) 1 (fun u a => (littleLaw (shape 3 3 2) u ((stageBPriority (shape 3 3 2)) 1) a : ℝ)) 2 a +def CB3_3_2I1R2Raw (a : Fin 6) : Ball := residualBall (below (shape 3 3 2)) B3_3_2Law (stageBPriority (shape 3 3 2)) 1 (fun u => B3_3_2Little u ((stageBPriority (shape 3 3 2)) 1)) 2 a +lemma CB3_3_2I1R2Raw_sound (a : Fin 6) : + (CB3_3_2I1R2Raw a).Encloses (CB3_3_2I1R2Value a) := by + exact residualBall_sound_on (below (shape 3 3 2)) B3_3_2Law (fun u => (stageBLaw (shape 3 3 2) u : ℝ)) (stageBPriority (shape 3 3 2)) 1 (fun u => B3_3_2Little u ((stageBPriority (shape 3 3 2)) 1)) (fun u a => (littleLaw (shape 3 3 2) u ((stageBPriority (shape 3 3 2)) 1) a : ℝ)) (fun u _ => B3_3_2Law_sound u) (fun u _ a => B3_3_2Little_sound u ((stageBPriority (shape 3 3 2)) 1) a) 2 a +def CB3_3_2I1R2Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(663207108312565622351583225751 / 4000000000000000000000000000000), (17 / 50000000000000000000000000000000)⟩ ⟨(14896977284460940724964874481653 / 50000000000000000000000000000000), (14043956887 / 100000000000000000000000000000000)⟩ ⟨(-17969623181348753166364118144109 / 10000000000000000000000000000000), (10587911867 / 12500000000000000000000000000000)⟩ ⟨-3, 663207108312565622351583225751, 500000000000000000000000000000⟩, + .log ⟨(751027171742785543685649512881 / 100000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ ⟨(3673637118601644553619317872127 / 100000000000000000000000000000000), (35783143 / 2500000000000000000000000000000)⟩ ⟨(-489148363311121965222393323110417 / 100000000000000000000000000000000), (190582413413 / 100000000000000000000000000000000)⟩ ⟨-8, 751027171742785543685649512881, 390625000000000000000000000000⟩] +lemma CB3_3_2I1R2Certificates_valid : + CB3_3_2I1R2Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB3_3_2I1R2CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | 2 => 1 + | 3 => 2 + | _ => 0 +def CB3_3_2I1R2P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_3_2I1R2Certificates (CB3_3_2I1R2CertificateIndex a)).input +lemma CB3_3_2I1R2P_check : ∀ a : Fin 6, contains (CB3_3_2I1R2Raw a) (CB3_3_2I1R2P a) = true := by + decide +kernel +lemma CB3_3_2I1R2P_sound (a : Fin 6) : + (CB3_3_2I1R2P a).Encloses (CB3_3_2I1R2Value a) := + contains_sound (CB3_3_2I1R2Raw_sound a) (CB3_3_2I1R2P_check a) +def CB3_3_2I1R2Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_3_2I1R2Certificates (CB3_3_2I1R2CertificateIndex a)).output +lemma CB3_3_2I1R2Terms_sound (a : Fin 6) : + (CB3_3_2I1R2Terms a).Encloses (Foundation.entropyTerm (CB3_3_2I1R2Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB3_3_2I1R2Certificates_valid + (CB3_3_2I1R2CertificateIndex a) (CB3_3_2I1R2P_sound a) +def CB3_3_2I1R2Entropy : Ball := ⟨(33467591687523526003549066835433 / 100000000000000000000000000000000), (15475282607 / 100000000000000000000000000000000)⟩ +lemma CB3_3_2I1R2Entropy_sound : CB3_3_2I1R2Entropy.Encloses (Foundation.finiteEntropy CB3_3_2I1R2Value) := by + exact contains_sound (entropyFin_enclosed 6 CB3_3_2I1R2Value CB3_3_2I1R2Terms CB3_3_2I1R2Terms_sound) (by decide +kernel) +def CB3_3_2I1R2Mass : Ball := ⟨(1083200304972307881404701884791 / 6250000000000000000000000000000), (9 / 25000000000000000000000000000000)⟩ +lemma CB3_3_2I1R2Mass_sound : CB3_3_2I1R2Mass.Encloses (∑ a, CB3_3_2I1R2Value a) := by + exact contains_sound (finSumBall_sound 6 CB3_3_2I1R2P CB3_3_2I1R2Value CB3_3_2I1R2P_sound) (by decide +kernel) +def CB3_3_2I1R2MassTermLogWitness : LogWitness := ⟨-3, 1083200304972307881404701884791, 781250000000000000000000000000⟩ +def CB3_3_2I1R2MassTermLog : Ball := ⟨(-3505323118049849361698630637263 / 2000000000000000000000000000000), (84703294939 / 100000000000000000000000000000000)⟩ +lemma CB3_3_2I1R2MassTermLog_sound : CB3_3_2I1R2MassTermLog.Encloses (Real.log ((∑ a, CB3_3_2I1R2Value a))) := by + exact checkLog_sound logTwoBall_sound (CB3_3_2I1R2Mass_sound) (w := CB3_3_2I1R2MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB3_3_2I1R2MassTerm : Ball := ⟨(6075147312796924816473816672937 / 20000000000000000000000000000000), (14680101649 / 100000000000000000000000000000000)⟩ +lemma CB3_3_2I1R2MassTerm_sound : CB3_3_2I1R2MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB3_3_2I1R2Value a))) := by + exact contains_sound (entropyTerm_ball (CB3_3_2I1R2Mass_sound) CB3_3_2I1R2MassTermLog_sound) (by decide +kernel) +def CB3_3_2I1R2H : Ball := ⟨(772963780884725480294995867687 / 25000000000000000000000000000000), (471177879 / 1562500000000000000000000000000)⟩ +lemma CB3_3_2I1R2H_sound : CB3_3_2I1R2H.Encloses (homogeneousEntropy CB3_3_2I1R2Value) := by + exact contains_sound (homogeneous_enclosed CB3_3_2I1R2Value CB3_3_2I1R2MassTerm_sound CB3_3_2I1R2Entropy_sound) (by decide +kernel) +def CB3_3_2I1R3Value (a : Fin 6) : ℝ := residualLaw (below (shape 3 3 2)) (fun u => (stageBLaw (shape 3 3 2) u : ℝ)) (stageBPriority (shape 3 3 2)) 1 (fun u a => (littleLaw (shape 3 3 2) u ((stageBPriority (shape 3 3 2)) 1) a : ℝ)) 3 a +def CB3_3_2I1R3Raw (a : Fin 6) : Ball := residualBall (below (shape 3 3 2)) B3_3_2Law (stageBPriority (shape 3 3 2)) 1 (fun u => B3_3_2Little u ((stageBPriority (shape 3 3 2)) 1)) 3 a +lemma CB3_3_2I1R3Raw_sound (a : Fin 6) : + (CB3_3_2I1R3Raw a).Encloses (CB3_3_2I1R3Value a) := by + exact residualBall_sound_on (below (shape 3 3 2)) B3_3_2Law (fun u => (stageBLaw (shape 3 3 2) u : ℝ)) (stageBPriority (shape 3 3 2)) 1 (fun u => B3_3_2Little u ((stageBPriority (shape 3 3 2)) 1)) (fun u a => (littleLaw (shape 3 3 2) u ((stageBPriority (shape 3 3 2)) 1) a : ℝ)) (fun u _ => B3_3_2Law_sound u) (fun u _ a => B3_3_2Little_sound u ((stageBPriority (shape 3 3 2)) 1) a) 3 a +def CB3_3_2I1R3Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB3_3_2I1R3Certificates_valid : + CB3_3_2I1R3Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB3_3_2I1R3CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB3_3_2I1R3P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_3_2I1R3Certificates (CB3_3_2I1R3CertificateIndex a)).input +lemma CB3_3_2I1R3P_check : ∀ a : Fin 6, contains (CB3_3_2I1R3Raw a) (CB3_3_2I1R3P a) = true := by + decide +kernel +lemma CB3_3_2I1R3P_sound (a : Fin 6) : + (CB3_3_2I1R3P a).Encloses (CB3_3_2I1R3Value a) := + contains_sound (CB3_3_2I1R3Raw_sound a) (CB3_3_2I1R3P_check a) +def CB3_3_2I1R3Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_3_2I1R3Certificates (CB3_3_2I1R3CertificateIndex a)).output +lemma CB3_3_2I1R3Terms_sound (a : Fin 6) : + (CB3_3_2I1R3Terms a).Encloses (Foundation.entropyTerm (CB3_3_2I1R3Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB3_3_2I1R3Certificates_valid + (CB3_3_2I1R3CertificateIndex a) (CB3_3_2I1R3P_sound a) +def CB3_3_2I1R3Entropy : Ball := ⟨0, 0⟩ +lemma CB3_3_2I1R3Entropy_sound : CB3_3_2I1R3Entropy.Encloses (Foundation.finiteEntropy CB3_3_2I1R3Value) := by + exact contains_sound (entropyFin_enclosed 6 CB3_3_2I1R3Value CB3_3_2I1R3Terms CB3_3_2I1R3Terms_sound) (by decide +kernel) +def CB3_3_2I1R3Mass : Ball := ⟨0, 0⟩ +lemma CB3_3_2I1R3Mass_sound : CB3_3_2I1R3Mass.Encloses (∑ a, CB3_3_2I1R3Value a) := by + exact contains_sound (finSumBall_sound 6 CB3_3_2I1R3P CB3_3_2I1R3Value CB3_3_2I1R3P_sound) (by decide +kernel) +def CB3_3_2I1R3MassTerm : Ball := .exact 0 +lemma CB3_3_2I1R3MassTerm_sound : CB3_3_2I1R3MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB3_3_2I1R3Value a))) := + entropyTerm_zero_ball (CB3_3_2I1R3Mass_sound) +def CB3_3_2I1R3H : Ball := ⟨0, 0⟩ +lemma CB3_3_2I1R3H_sound : CB3_3_2I1R3H.Encloses (homogeneousEntropy CB3_3_2I1R3Value) := by + exact contains_sound (homogeneous_enclosed CB3_3_2I1R3Value CB3_3_2I1R3MassTerm_sound CB3_3_2I1R3Entropy_sound) (by decide +kernel) +def CB3_3_2I1R4Value (a : Fin 6) : ℝ := residualLaw (below (shape 3 3 2)) (fun u => (stageBLaw (shape 3 3 2) u : ℝ)) (stageBPriority (shape 3 3 2)) 1 (fun u a => (littleLaw (shape 3 3 2) u ((stageBPriority (shape 3 3 2)) 1) a : ℝ)) 4 a +def CB3_3_2I1R4Raw (a : Fin 6) : Ball := residualBall (below (shape 3 3 2)) B3_3_2Law (stageBPriority (shape 3 3 2)) 1 (fun u => B3_3_2Little u ((stageBPriority (shape 3 3 2)) 1)) 4 a +lemma CB3_3_2I1R4Raw_sound (a : Fin 6) : + (CB3_3_2I1R4Raw a).Encloses (CB3_3_2I1R4Value a) := by + exact residualBall_sound_on (below (shape 3 3 2)) B3_3_2Law (fun u => (stageBLaw (shape 3 3 2) u : ℝ)) (stageBPriority (shape 3 3 2)) 1 (fun u => B3_3_2Little u ((stageBPriority (shape 3 3 2)) 1)) (fun u a => (littleLaw (shape 3 3 2) u ((stageBPriority (shape 3 3 2)) 1) a : ℝ)) (fun u _ => B3_3_2Law_sound u) (fun u _ a => B3_3_2Little_sound u ((stageBPriority (shape 3 3 2)) 1) a) 4 a +def CB3_3_2I1R4Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB3_3_2I1R4Certificates_valid : + CB3_3_2I1R4Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB3_3_2I1R4CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB3_3_2I1R4P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_3_2I1R4Certificates (CB3_3_2I1R4CertificateIndex a)).input +lemma CB3_3_2I1R4P_check : ∀ a : Fin 6, contains (CB3_3_2I1R4Raw a) (CB3_3_2I1R4P a) = true := by + decide +kernel +lemma CB3_3_2I1R4P_sound (a : Fin 6) : + (CB3_3_2I1R4P a).Encloses (CB3_3_2I1R4Value a) := + contains_sound (CB3_3_2I1R4Raw_sound a) (CB3_3_2I1R4P_check a) +def CB3_3_2I1R4Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_3_2I1R4Certificates (CB3_3_2I1R4CertificateIndex a)).output +lemma CB3_3_2I1R4Terms_sound (a : Fin 6) : + (CB3_3_2I1R4Terms a).Encloses (Foundation.entropyTerm (CB3_3_2I1R4Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB3_3_2I1R4Certificates_valid + (CB3_3_2I1R4CertificateIndex a) (CB3_3_2I1R4P_sound a) +def CB3_3_2I1R4Entropy : Ball := ⟨0, 0⟩ +lemma CB3_3_2I1R4Entropy_sound : CB3_3_2I1R4Entropy.Encloses (Foundation.finiteEntropy CB3_3_2I1R4Value) := by + exact contains_sound (entropyFin_enclosed 6 CB3_3_2I1R4Value CB3_3_2I1R4Terms CB3_3_2I1R4Terms_sound) (by decide +kernel) +def CB3_3_2I1R4Mass : Ball := ⟨0, 0⟩ +lemma CB3_3_2I1R4Mass_sound : CB3_3_2I1R4Mass.Encloses (∑ a, CB3_3_2I1R4Value a) := by + exact contains_sound (finSumBall_sound 6 CB3_3_2I1R4P CB3_3_2I1R4Value CB3_3_2I1R4P_sound) (by decide +kernel) +def CB3_3_2I1R4MassTerm : Ball := .exact 0 +lemma CB3_3_2I1R4MassTerm_sound : CB3_3_2I1R4MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB3_3_2I1R4Value a))) := + entropyTerm_zero_ball (CB3_3_2I1R4Mass_sound) +def CB3_3_2I1R4H : Ball := ⟨0, 0⟩ +lemma CB3_3_2I1R4H_sound : CB3_3_2I1R4H.Encloses (homogeneousEntropy CB3_3_2I1R4Value) := by + exact contains_sound (homogeneous_enclosed CB3_3_2I1R4Value CB3_3_2I1R4MassTerm_sound CB3_3_2I1R4Entropy_sound) (by decide +kernel) +def CB3_3_2I1R5Value (a : Fin 6) : ℝ := residualLaw (below (shape 3 3 2)) (fun u => (stageBLaw (shape 3 3 2) u : ℝ)) (stageBPriority (shape 3 3 2)) 1 (fun u a => (littleLaw (shape 3 3 2) u ((stageBPriority (shape 3 3 2)) 1) a : ℝ)) 5 a +def CB3_3_2I1R5Raw (a : Fin 6) : Ball := residualBall (below (shape 3 3 2)) B3_3_2Law (stageBPriority (shape 3 3 2)) 1 (fun u => B3_3_2Little u ((stageBPriority (shape 3 3 2)) 1)) 5 a +lemma CB3_3_2I1R5Raw_sound (a : Fin 6) : + (CB3_3_2I1R5Raw a).Encloses (CB3_3_2I1R5Value a) := by + exact residualBall_sound_on (below (shape 3 3 2)) B3_3_2Law (fun u => (stageBLaw (shape 3 3 2) u : ℝ)) (stageBPriority (shape 3 3 2)) 1 (fun u => B3_3_2Little u ((stageBPriority (shape 3 3 2)) 1)) (fun u a => (littleLaw (shape 3 3 2) u ((stageBPriority (shape 3 3 2)) 1) a : ℝ)) (fun u _ => B3_3_2Law_sound u) (fun u _ a => B3_3_2Little_sound u ((stageBPriority (shape 3 3 2)) 1) a) 5 a +def CB3_3_2I1R5Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB3_3_2I1R5Certificates_valid : + CB3_3_2I1R5Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB3_3_2I1R5CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB3_3_2I1R5P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_3_2I1R5Certificates (CB3_3_2I1R5CertificateIndex a)).input +lemma CB3_3_2I1R5P_check : ∀ a : Fin 6, contains (CB3_3_2I1R5Raw a) (CB3_3_2I1R5P a) = true := by + decide +kernel +lemma CB3_3_2I1R5P_sound (a : Fin 6) : + (CB3_3_2I1R5P a).Encloses (CB3_3_2I1R5Value a) := + contains_sound (CB3_3_2I1R5Raw_sound a) (CB3_3_2I1R5P_check a) +def CB3_3_2I1R5Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_3_2I1R5Certificates (CB3_3_2I1R5CertificateIndex a)).output +lemma CB3_3_2I1R5Terms_sound (a : Fin 6) : + (CB3_3_2I1R5Terms a).Encloses (Foundation.entropyTerm (CB3_3_2I1R5Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB3_3_2I1R5Certificates_valid + (CB3_3_2I1R5CertificateIndex a) (CB3_3_2I1R5P_sound a) +def CB3_3_2I1R5Entropy : Ball := ⟨0, 0⟩ +lemma CB3_3_2I1R5Entropy_sound : CB3_3_2I1R5Entropy.Encloses (Foundation.finiteEntropy CB3_3_2I1R5Value) := by + exact contains_sound (entropyFin_enclosed 6 CB3_3_2I1R5Value CB3_3_2I1R5Terms CB3_3_2I1R5Terms_sound) (by decide +kernel) +def CB3_3_2I1R5Mass : Ball := ⟨0, 0⟩ +lemma CB3_3_2I1R5Mass_sound : CB3_3_2I1R5Mass.Encloses (∑ a, CB3_3_2I1R5Value a) := by + exact contains_sound (finSumBall_sound 6 CB3_3_2I1R5P CB3_3_2I1R5Value CB3_3_2I1R5P_sound) (by decide +kernel) +def CB3_3_2I1R5MassTerm : Ball := .exact 0 +lemma CB3_3_2I1R5MassTerm_sound : CB3_3_2I1R5MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB3_3_2I1R5Value a))) := + entropyTerm_zero_ball (CB3_3_2I1R5Mass_sound) +def CB3_3_2I1R5H : Ball := ⟨0, 0⟩ +lemma CB3_3_2I1R5H_sound : CB3_3_2I1R5H.Encloses (homogeneousEntropy CB3_3_2I1R5Value) := by + exact contains_sound (homogeneous_enclosed CB3_3_2I1R5Value CB3_3_2I1R5MassTerm_sound CB3_3_2I1R5Entropy_sound) (by decide +kernel) +def CB3_3_2I1R6Value (a : Fin 6) : ℝ := residualLaw (below (shape 3 3 2)) (fun u => (stageBLaw (shape 3 3 2) u : ℝ)) (stageBPriority (shape 3 3 2)) 1 (fun u a => (littleLaw (shape 3 3 2) u ((stageBPriority (shape 3 3 2)) 1) a : ℝ)) 6 a +def CB3_3_2I1R6Raw (a : Fin 6) : Ball := residualBall (below (shape 3 3 2)) B3_3_2Law (stageBPriority (shape 3 3 2)) 1 (fun u => B3_3_2Little u ((stageBPriority (shape 3 3 2)) 1)) 6 a +lemma CB3_3_2I1R6Raw_sound (a : Fin 6) : + (CB3_3_2I1R6Raw a).Encloses (CB3_3_2I1R6Value a) := by + exact residualBall_sound_on (below (shape 3 3 2)) B3_3_2Law (fun u => (stageBLaw (shape 3 3 2) u : ℝ)) (stageBPriority (shape 3 3 2)) 1 (fun u => B3_3_2Little u ((stageBPriority (shape 3 3 2)) 1)) (fun u a => (littleLaw (shape 3 3 2) u ((stageBPriority (shape 3 3 2)) 1) a : ℝ)) (fun u _ => B3_3_2Law_sound u) (fun u _ a => B3_3_2Little_sound u ((stageBPriority (shape 3 3 2)) 1) a) 6 a +def CB3_3_2I1R6Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB3_3_2I1R6Certificates_valid : + CB3_3_2I1R6Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB3_3_2I1R6CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB3_3_2I1R6P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_3_2I1R6Certificates (CB3_3_2I1R6CertificateIndex a)).input +lemma CB3_3_2I1R6P_check : ∀ a : Fin 6, contains (CB3_3_2I1R6Raw a) (CB3_3_2I1R6P a) = true := by + decide +kernel +lemma CB3_3_2I1R6P_sound (a : Fin 6) : + (CB3_3_2I1R6P a).Encloses (CB3_3_2I1R6Value a) := + contains_sound (CB3_3_2I1R6Raw_sound a) (CB3_3_2I1R6P_check a) +def CB3_3_2I1R6Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_3_2I1R6Certificates (CB3_3_2I1R6CertificateIndex a)).output +lemma CB3_3_2I1R6Terms_sound (a : Fin 6) : + (CB3_3_2I1R6Terms a).Encloses (Foundation.entropyTerm (CB3_3_2I1R6Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB3_3_2I1R6Certificates_valid + (CB3_3_2I1R6CertificateIndex a) (CB3_3_2I1R6P_sound a) +def CB3_3_2I1R6Entropy : Ball := ⟨0, 0⟩ +lemma CB3_3_2I1R6Entropy_sound : CB3_3_2I1R6Entropy.Encloses (Foundation.finiteEntropy CB3_3_2I1R6Value) := by + exact contains_sound (entropyFin_enclosed 6 CB3_3_2I1R6Value CB3_3_2I1R6Terms CB3_3_2I1R6Terms_sound) (by decide +kernel) +def CB3_3_2I1R6Mass : Ball := ⟨0, 0⟩ +lemma CB3_3_2I1R6Mass_sound : CB3_3_2I1R6Mass.Encloses (∑ a, CB3_3_2I1R6Value a) := by + exact contains_sound (finSumBall_sound 6 CB3_3_2I1R6P CB3_3_2I1R6Value CB3_3_2I1R6P_sound) (by decide +kernel) +def CB3_3_2I1R6MassTerm : Ball := .exact 0 +lemma CB3_3_2I1R6MassTerm_sound : CB3_3_2I1R6MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB3_3_2I1R6Value a))) := + entropyTerm_zero_ball (CB3_3_2I1R6Mass_sound) +def CB3_3_2I1R6H : Ball := ⟨0, 0⟩ +lemma CB3_3_2I1R6H_sound : CB3_3_2I1R6H.Encloses (homogeneousEntropy CB3_3_2I1R6Value) := by + exact contains_sound (homogeneous_enclosed CB3_3_2I1R6Value CB3_3_2I1R6MassTerm_sound CB3_3_2I1R6Entropy_sound) (by decide +kernel) +def CB3_3_2I1R7Value (a : Fin 6) : ℝ := residualLaw (below (shape 3 3 2)) (fun u => (stageBLaw (shape 3 3 2) u : ℝ)) (stageBPriority (shape 3 3 2)) 1 (fun u a => (littleLaw (shape 3 3 2) u ((stageBPriority (shape 3 3 2)) 1) a : ℝ)) 7 a +def CB3_3_2I1R7Raw (a : Fin 6) : Ball := residualBall (below (shape 3 3 2)) B3_3_2Law (stageBPriority (shape 3 3 2)) 1 (fun u => B3_3_2Little u ((stageBPriority (shape 3 3 2)) 1)) 7 a +lemma CB3_3_2I1R7Raw_sound (a : Fin 6) : + (CB3_3_2I1R7Raw a).Encloses (CB3_3_2I1R7Value a) := by + exact residualBall_sound_on (below (shape 3 3 2)) B3_3_2Law (fun u => (stageBLaw (shape 3 3 2) u : ℝ)) (stageBPriority (shape 3 3 2)) 1 (fun u => B3_3_2Little u ((stageBPriority (shape 3 3 2)) 1)) (fun u a => (littleLaw (shape 3 3 2) u ((stageBPriority (shape 3 3 2)) 1) a : ℝ)) (fun u _ => B3_3_2Law_sound u) (fun u _ a => B3_3_2Little_sound u ((stageBPriority (shape 3 3 2)) 1) a) 7 a +def CB3_3_2I1R7Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB3_3_2I1R7Certificates_valid : + CB3_3_2I1R7Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB3_3_2I1R7CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB3_3_2I1R7P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_3_2I1R7Certificates (CB3_3_2I1R7CertificateIndex a)).input +lemma CB3_3_2I1R7P_check : ∀ a : Fin 6, contains (CB3_3_2I1R7Raw a) (CB3_3_2I1R7P a) = true := by + decide +kernel +lemma CB3_3_2I1R7P_sound (a : Fin 6) : + (CB3_3_2I1R7P a).Encloses (CB3_3_2I1R7Value a) := + contains_sound (CB3_3_2I1R7Raw_sound a) (CB3_3_2I1R7P_check a) +def CB3_3_2I1R7Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_3_2I1R7Certificates (CB3_3_2I1R7CertificateIndex a)).output +lemma CB3_3_2I1R7Terms_sound (a : Fin 6) : + (CB3_3_2I1R7Terms a).Encloses (Foundation.entropyTerm (CB3_3_2I1R7Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB3_3_2I1R7Certificates_valid + (CB3_3_2I1R7CertificateIndex a) (CB3_3_2I1R7P_sound a) +def CB3_3_2I1R7Entropy : Ball := ⟨0, 0⟩ +lemma CB3_3_2I1R7Entropy_sound : CB3_3_2I1R7Entropy.Encloses (Foundation.finiteEntropy CB3_3_2I1R7Value) := by + exact contains_sound (entropyFin_enclosed 6 CB3_3_2I1R7Value CB3_3_2I1R7Terms CB3_3_2I1R7Terms_sound) (by decide +kernel) +def CB3_3_2I1R7Mass : Ball := ⟨0, 0⟩ +lemma CB3_3_2I1R7Mass_sound : CB3_3_2I1R7Mass.Encloses (∑ a, CB3_3_2I1R7Value a) := by + exact contains_sound (finSumBall_sound 6 CB3_3_2I1R7P CB3_3_2I1R7Value CB3_3_2I1R7P_sound) (by decide +kernel) +def CB3_3_2I1R7MassTerm : Ball := .exact 0 +lemma CB3_3_2I1R7MassTerm_sound : CB3_3_2I1R7MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB3_3_2I1R7Value a))) := + entropyTerm_zero_ball (CB3_3_2I1R7Mass_sound) +def CB3_3_2I1R7H : Ball := ⟨0, 0⟩ +lemma CB3_3_2I1R7H_sound : CB3_3_2I1R7H.Encloses (homogeneousEntropy CB3_3_2I1R7Value) := by + exact contains_sound (homogeneous_enclosed CB3_3_2I1R7Value CB3_3_2I1R7MassTerm_sound CB3_3_2I1R7Entropy_sound) (by decide +kernel) +def CB3_3_2I1R8Value (a : Fin 6) : ℝ := residualLaw (below (shape 3 3 2)) (fun u => (stageBLaw (shape 3 3 2) u : ℝ)) (stageBPriority (shape 3 3 2)) 1 (fun u a => (littleLaw (shape 3 3 2) u ((stageBPriority (shape 3 3 2)) 1) a : ℝ)) 8 a +def CB3_3_2I1R8Raw (a : Fin 6) : Ball := residualBall (below (shape 3 3 2)) B3_3_2Law (stageBPriority (shape 3 3 2)) 1 (fun u => B3_3_2Little u ((stageBPriority (shape 3 3 2)) 1)) 8 a +lemma CB3_3_2I1R8Raw_sound (a : Fin 6) : + (CB3_3_2I1R8Raw a).Encloses (CB3_3_2I1R8Value a) := by + exact residualBall_sound_on (below (shape 3 3 2)) B3_3_2Law (fun u => (stageBLaw (shape 3 3 2) u : ℝ)) (stageBPriority (shape 3 3 2)) 1 (fun u => B3_3_2Little u ((stageBPriority (shape 3 3 2)) 1)) (fun u a => (littleLaw (shape 3 3 2) u ((stageBPriority (shape 3 3 2)) 1) a : ℝ)) (fun u _ => B3_3_2Law_sound u) (fun u _ a => B3_3_2Little_sound u ((stageBPriority (shape 3 3 2)) 1) a) 8 a +def CB3_3_2I1R8Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB3_3_2I1R8Certificates_valid : + CB3_3_2I1R8Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB3_3_2I1R8CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB3_3_2I1R8P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_3_2I1R8Certificates (CB3_3_2I1R8CertificateIndex a)).input +lemma CB3_3_2I1R8P_check : ∀ a : Fin 6, contains (CB3_3_2I1R8Raw a) (CB3_3_2I1R8P a) = true := by + decide +kernel +lemma CB3_3_2I1R8P_sound (a : Fin 6) : + (CB3_3_2I1R8P a).Encloses (CB3_3_2I1R8Value a) := + contains_sound (CB3_3_2I1R8Raw_sound a) (CB3_3_2I1R8P_check a) +def CB3_3_2I1R8Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_3_2I1R8Certificates (CB3_3_2I1R8CertificateIndex a)).output +lemma CB3_3_2I1R8Terms_sound (a : Fin 6) : + (CB3_3_2I1R8Terms a).Encloses (Foundation.entropyTerm (CB3_3_2I1R8Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB3_3_2I1R8Certificates_valid + (CB3_3_2I1R8CertificateIndex a) (CB3_3_2I1R8P_sound a) +def CB3_3_2I1R8Entropy : Ball := ⟨0, 0⟩ +lemma CB3_3_2I1R8Entropy_sound : CB3_3_2I1R8Entropy.Encloses (Foundation.finiteEntropy CB3_3_2I1R8Value) := by + exact contains_sound (entropyFin_enclosed 6 CB3_3_2I1R8Value CB3_3_2I1R8Terms CB3_3_2I1R8Terms_sound) (by decide +kernel) +def CB3_3_2I1R8Mass : Ball := ⟨0, 0⟩ +lemma CB3_3_2I1R8Mass_sound : CB3_3_2I1R8Mass.Encloses (∑ a, CB3_3_2I1R8Value a) := by + exact contains_sound (finSumBall_sound 6 CB3_3_2I1R8P CB3_3_2I1R8Value CB3_3_2I1R8P_sound) (by decide +kernel) +def CB3_3_2I1R8MassTerm : Ball := .exact 0 +lemma CB3_3_2I1R8MassTerm_sound : CB3_3_2I1R8MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB3_3_2I1R8Value a))) := + entropyTerm_zero_ball (CB3_3_2I1R8Mass_sound) +def CB3_3_2I1R8H : Ball := ⟨0, 0⟩ +lemma CB3_3_2I1R8H_sound : CB3_3_2I1R8H.Encloses (homogeneousEntropy CB3_3_2I1R8Value) := by + exact contains_sound (homogeneous_enclosed CB3_3_2I1R8Value CB3_3_2I1R8MassTerm_sound CB3_3_2I1R8Entropy_sound) (by decide +kernel) +def CB3_3_2I1R9Value (a : Fin 6) : ℝ := residualLaw (below (shape 3 3 2)) (fun u => (stageBLaw (shape 3 3 2) u : ℝ)) (stageBPriority (shape 3 3 2)) 1 (fun u a => (littleLaw (shape 3 3 2) u ((stageBPriority (shape 3 3 2)) 1) a : ℝ)) 9 a +def CB3_3_2I1R9Raw (a : Fin 6) : Ball := residualBall (below (shape 3 3 2)) B3_3_2Law (stageBPriority (shape 3 3 2)) 1 (fun u => B3_3_2Little u ((stageBPriority (shape 3 3 2)) 1)) 9 a +lemma CB3_3_2I1R9Raw_sound (a : Fin 6) : + (CB3_3_2I1R9Raw a).Encloses (CB3_3_2I1R9Value a) := by + exact residualBall_sound_on (below (shape 3 3 2)) B3_3_2Law (fun u => (stageBLaw (shape 3 3 2) u : ℝ)) (stageBPriority (shape 3 3 2)) 1 (fun u => B3_3_2Little u ((stageBPriority (shape 3 3 2)) 1)) (fun u a => (littleLaw (shape 3 3 2) u ((stageBPriority (shape 3 3 2)) 1) a : ℝ)) (fun u _ => B3_3_2Law_sound u) (fun u _ a => B3_3_2Little_sound u ((stageBPriority (shape 3 3 2)) 1) a) 9 a +def CB3_3_2I1R9Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB3_3_2I1R9Certificates_valid : + CB3_3_2I1R9Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB3_3_2I1R9CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB3_3_2I1R9P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_3_2I1R9Certificates (CB3_3_2I1R9CertificateIndex a)).input +lemma CB3_3_2I1R9P_check : ∀ a : Fin 6, contains (CB3_3_2I1R9Raw a) (CB3_3_2I1R9P a) = true := by + decide +kernel +lemma CB3_3_2I1R9P_sound (a : Fin 6) : + (CB3_3_2I1R9P a).Encloses (CB3_3_2I1R9Value a) := + contains_sound (CB3_3_2I1R9Raw_sound a) (CB3_3_2I1R9P_check a) +def CB3_3_2I1R9Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_3_2I1R9Certificates (CB3_3_2I1R9CertificateIndex a)).output +lemma CB3_3_2I1R9Terms_sound (a : Fin 6) : + (CB3_3_2I1R9Terms a).Encloses (Foundation.entropyTerm (CB3_3_2I1R9Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB3_3_2I1R9Certificates_valid + (CB3_3_2I1R9CertificateIndex a) (CB3_3_2I1R9P_sound a) +def CB3_3_2I1R9Entropy : Ball := ⟨0, 0⟩ +lemma CB3_3_2I1R9Entropy_sound : CB3_3_2I1R9Entropy.Encloses (Foundation.finiteEntropy CB3_3_2I1R9Value) := by + exact contains_sound (entropyFin_enclosed 6 CB3_3_2I1R9Value CB3_3_2I1R9Terms CB3_3_2I1R9Terms_sound) (by decide +kernel) +def CB3_3_2I1R9Mass : Ball := ⟨0, 0⟩ +lemma CB3_3_2I1R9Mass_sound : CB3_3_2I1R9Mass.Encloses (∑ a, CB3_3_2I1R9Value a) := by + exact contains_sound (finSumBall_sound 6 CB3_3_2I1R9P CB3_3_2I1R9Value CB3_3_2I1R9P_sound) (by decide +kernel) +def CB3_3_2I1R9MassTerm : Ball := .exact 0 +lemma CB3_3_2I1R9MassTerm_sound : CB3_3_2I1R9MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB3_3_2I1R9Value a))) := + entropyTerm_zero_ball (CB3_3_2I1R9Mass_sound) +def CB3_3_2I1R9H : Ball := ⟨0, 0⟩ +lemma CB3_3_2I1R9H_sound : CB3_3_2I1R9H.Encloses (homogeneousEntropy CB3_3_2I1R9Value) := by + exact contains_sound (homogeneous_enclosed CB3_3_2I1R9Value CB3_3_2I1R9MassTerm_sound CB3_3_2I1R9Entropy_sound) (by decide +kernel) +def CB3_3_2I1R10Value (a : Fin 6) : ℝ := residualLaw (below (shape 3 3 2)) (fun u => (stageBLaw (shape 3 3 2) u : ℝ)) (stageBPriority (shape 3 3 2)) 1 (fun u a => (littleLaw (shape 3 3 2) u ((stageBPriority (shape 3 3 2)) 1) a : ℝ)) 10 a +def CB3_3_2I1R10Raw (a : Fin 6) : Ball := residualBall (below (shape 3 3 2)) B3_3_2Law (stageBPriority (shape 3 3 2)) 1 (fun u => B3_3_2Little u ((stageBPriority (shape 3 3 2)) 1)) 10 a +lemma CB3_3_2I1R10Raw_sound (a : Fin 6) : + (CB3_3_2I1R10Raw a).Encloses (CB3_3_2I1R10Value a) := by + exact residualBall_sound_on (below (shape 3 3 2)) B3_3_2Law (fun u => (stageBLaw (shape 3 3 2) u : ℝ)) (stageBPriority (shape 3 3 2)) 1 (fun u => B3_3_2Little u ((stageBPriority (shape 3 3 2)) 1)) (fun u a => (littleLaw (shape 3 3 2) u ((stageBPriority (shape 3 3 2)) 1) a : ℝ)) (fun u _ => B3_3_2Law_sound u) (fun u _ a => B3_3_2Little_sound u ((stageBPriority (shape 3 3 2)) 1) a) 10 a +def CB3_3_2I1R10Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB3_3_2I1R10Certificates_valid : + CB3_3_2I1R10Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB3_3_2I1R10CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB3_3_2I1R10P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_3_2I1R10Certificates (CB3_3_2I1R10CertificateIndex a)).input +lemma CB3_3_2I1R10P_check : ∀ a : Fin 6, contains (CB3_3_2I1R10Raw a) (CB3_3_2I1R10P a) = true := by + decide +kernel +lemma CB3_3_2I1R10P_sound (a : Fin 6) : + (CB3_3_2I1R10P a).Encloses (CB3_3_2I1R10Value a) := + contains_sound (CB3_3_2I1R10Raw_sound a) (CB3_3_2I1R10P_check a) +def CB3_3_2I1R10Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_3_2I1R10Certificates (CB3_3_2I1R10CertificateIndex a)).output +lemma CB3_3_2I1R10Terms_sound (a : Fin 6) : + (CB3_3_2I1R10Terms a).Encloses (Foundation.entropyTerm (CB3_3_2I1R10Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB3_3_2I1R10Certificates_valid + (CB3_3_2I1R10CertificateIndex a) (CB3_3_2I1R10P_sound a) +def CB3_3_2I1R10Entropy : Ball := ⟨0, 0⟩ +lemma CB3_3_2I1R10Entropy_sound : CB3_3_2I1R10Entropy.Encloses (Foundation.finiteEntropy CB3_3_2I1R10Value) := by + exact contains_sound (entropyFin_enclosed 6 CB3_3_2I1R10Value CB3_3_2I1R10Terms CB3_3_2I1R10Terms_sound) (by decide +kernel) +def CB3_3_2I1R10Mass : Ball := ⟨0, 0⟩ +lemma CB3_3_2I1R10Mass_sound : CB3_3_2I1R10Mass.Encloses (∑ a, CB3_3_2I1R10Value a) := by + exact contains_sound (finSumBall_sound 6 CB3_3_2I1R10P CB3_3_2I1R10Value CB3_3_2I1R10P_sound) (by decide +kernel) +def CB3_3_2I1R10MassTerm : Ball := .exact 0 +lemma CB3_3_2I1R10MassTerm_sound : CB3_3_2I1R10MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB3_3_2I1R10Value a))) := + entropyTerm_zero_ball (CB3_3_2I1R10Mass_sound) +def CB3_3_2I1R10H : Ball := ⟨0, 0⟩ +lemma CB3_3_2I1R10H_sound : CB3_3_2I1R10H.Encloses (homogeneousEntropy CB3_3_2I1R10Value) := by + exact contains_sound (homogeneous_enclosed CB3_3_2I1R10Value CB3_3_2I1R10MassTerm_sound CB3_3_2I1R10Entropy_sound) (by decide +kernel) +def CB3_3_2I1R11Value (a : Fin 6) : ℝ := residualLaw (below (shape 3 3 2)) (fun u => (stageBLaw (shape 3 3 2) u : ℝ)) (stageBPriority (shape 3 3 2)) 1 (fun u a => (littleLaw (shape 3 3 2) u ((stageBPriority (shape 3 3 2)) 1) a : ℝ)) 11 a +def CB3_3_2I1R11Raw (a : Fin 6) : Ball := residualBall (below (shape 3 3 2)) B3_3_2Law (stageBPriority (shape 3 3 2)) 1 (fun u => B3_3_2Little u ((stageBPriority (shape 3 3 2)) 1)) 11 a +lemma CB3_3_2I1R11Raw_sound (a : Fin 6) : + (CB3_3_2I1R11Raw a).Encloses (CB3_3_2I1R11Value a) := by + exact residualBall_sound_on (below (shape 3 3 2)) B3_3_2Law (fun u => (stageBLaw (shape 3 3 2) u : ℝ)) (stageBPriority (shape 3 3 2)) 1 (fun u => B3_3_2Little u ((stageBPriority (shape 3 3 2)) 1)) (fun u a => (littleLaw (shape 3 3 2) u ((stageBPriority (shape 3 3 2)) 1) a : ℝ)) (fun u _ => B3_3_2Law_sound u) (fun u _ a => B3_3_2Little_sound u ((stageBPriority (shape 3 3 2)) 1) a) 11 a +def CB3_3_2I1R11Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB3_3_2I1R11Certificates_valid : + CB3_3_2I1R11Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB3_3_2I1R11CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB3_3_2I1R11P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_3_2I1R11Certificates (CB3_3_2I1R11CertificateIndex a)).input +lemma CB3_3_2I1R11P_check : ∀ a : Fin 6, contains (CB3_3_2I1R11Raw a) (CB3_3_2I1R11P a) = true := by + decide +kernel +lemma CB3_3_2I1R11P_sound (a : Fin 6) : + (CB3_3_2I1R11P a).Encloses (CB3_3_2I1R11Value a) := + contains_sound (CB3_3_2I1R11Raw_sound a) (CB3_3_2I1R11P_check a) +def CB3_3_2I1R11Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_3_2I1R11Certificates (CB3_3_2I1R11CertificateIndex a)).output +lemma CB3_3_2I1R11Terms_sound (a : Fin 6) : + (CB3_3_2I1R11Terms a).Encloses (Foundation.entropyTerm (CB3_3_2I1R11Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB3_3_2I1R11Certificates_valid + (CB3_3_2I1R11CertificateIndex a) (CB3_3_2I1R11P_sound a) +def CB3_3_2I1R11Entropy : Ball := ⟨0, 0⟩ +lemma CB3_3_2I1R11Entropy_sound : CB3_3_2I1R11Entropy.Encloses (Foundation.finiteEntropy CB3_3_2I1R11Value) := by + exact contains_sound (entropyFin_enclosed 6 CB3_3_2I1R11Value CB3_3_2I1R11Terms CB3_3_2I1R11Terms_sound) (by decide +kernel) +def CB3_3_2I1R11Mass : Ball := ⟨0, 0⟩ +lemma CB3_3_2I1R11Mass_sound : CB3_3_2I1R11Mass.Encloses (∑ a, CB3_3_2I1R11Value a) := by + exact contains_sound (finSumBall_sound 6 CB3_3_2I1R11P CB3_3_2I1R11Value CB3_3_2I1R11P_sound) (by decide +kernel) +def CB3_3_2I1R11MassTerm : Ball := .exact 0 +lemma CB3_3_2I1R11MassTerm_sound : CB3_3_2I1R11MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB3_3_2I1R11Value a))) := + entropyTerm_zero_ball (CB3_3_2I1R11Mass_sound) +def CB3_3_2I1R11H : Ball := ⟨0, 0⟩ +lemma CB3_3_2I1R11H_sound : CB3_3_2I1R11H.Encloses (homogeneousEntropy CB3_3_2I1R11Value) := by + exact contains_sound (homogeneous_enclosed CB3_3_2I1R11Value CB3_3_2I1R11MassTerm_sound CB3_3_2I1R11Entropy_sound) (by decide +kernel) +def CB3_3_2I1R12Value (a : Fin 6) : ℝ := residualLaw (below (shape 3 3 2)) (fun u => (stageBLaw (shape 3 3 2) u : ℝ)) (stageBPriority (shape 3 3 2)) 1 (fun u a => (littleLaw (shape 3 3 2) u ((stageBPriority (shape 3 3 2)) 1) a : ℝ)) 12 a +def CB3_3_2I1R12Raw (a : Fin 6) : Ball := residualBall (below (shape 3 3 2)) B3_3_2Law (stageBPriority (shape 3 3 2)) 1 (fun u => B3_3_2Little u ((stageBPriority (shape 3 3 2)) 1)) 12 a +lemma CB3_3_2I1R12Raw_sound (a : Fin 6) : + (CB3_3_2I1R12Raw a).Encloses (CB3_3_2I1R12Value a) := by + exact residualBall_sound_on (below (shape 3 3 2)) B3_3_2Law (fun u => (stageBLaw (shape 3 3 2) u : ℝ)) (stageBPriority (shape 3 3 2)) 1 (fun u => B3_3_2Little u ((stageBPriority (shape 3 3 2)) 1)) (fun u a => (littleLaw (shape 3 3 2) u ((stageBPriority (shape 3 3 2)) 1) a : ℝ)) (fun u _ => B3_3_2Law_sound u) (fun u _ a => B3_3_2Little_sound u ((stageBPriority (shape 3 3 2)) 1) a) 12 a +def CB3_3_2I1R12Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB3_3_2I1R12Certificates_valid : + CB3_3_2I1R12Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB3_3_2I1R12CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB3_3_2I1R12P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_3_2I1R12Certificates (CB3_3_2I1R12CertificateIndex a)).input +lemma CB3_3_2I1R12P_check : ∀ a : Fin 6, contains (CB3_3_2I1R12Raw a) (CB3_3_2I1R12P a) = true := by + decide +kernel +lemma CB3_3_2I1R12P_sound (a : Fin 6) : + (CB3_3_2I1R12P a).Encloses (CB3_3_2I1R12Value a) := + contains_sound (CB3_3_2I1R12Raw_sound a) (CB3_3_2I1R12P_check a) +def CB3_3_2I1R12Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_3_2I1R12Certificates (CB3_3_2I1R12CertificateIndex a)).output +lemma CB3_3_2I1R12Terms_sound (a : Fin 6) : + (CB3_3_2I1R12Terms a).Encloses (Foundation.entropyTerm (CB3_3_2I1R12Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB3_3_2I1R12Certificates_valid + (CB3_3_2I1R12CertificateIndex a) (CB3_3_2I1R12P_sound a) +def CB3_3_2I1R12Entropy : Ball := ⟨0, 0⟩ +lemma CB3_3_2I1R12Entropy_sound : CB3_3_2I1R12Entropy.Encloses (Foundation.finiteEntropy CB3_3_2I1R12Value) := by + exact contains_sound (entropyFin_enclosed 6 CB3_3_2I1R12Value CB3_3_2I1R12Terms CB3_3_2I1R12Terms_sound) (by decide +kernel) +def CB3_3_2I1R12Mass : Ball := ⟨0, 0⟩ +lemma CB3_3_2I1R12Mass_sound : CB3_3_2I1R12Mass.Encloses (∑ a, CB3_3_2I1R12Value a) := by + exact contains_sound (finSumBall_sound 6 CB3_3_2I1R12P CB3_3_2I1R12Value CB3_3_2I1R12P_sound) (by decide +kernel) +def CB3_3_2I1R12MassTerm : Ball := .exact 0 +lemma CB3_3_2I1R12MassTerm_sound : CB3_3_2I1R12MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB3_3_2I1R12Value a))) := + entropyTerm_zero_ball (CB3_3_2I1R12Mass_sound) +def CB3_3_2I1R12H : Ball := ⟨0, 0⟩ +lemma CB3_3_2I1R12H_sound : CB3_3_2I1R12H.Encloses (homogeneousEntropy CB3_3_2I1R12Value) := by + exact contains_sound (homogeneous_enclosed CB3_3_2I1R12Value CB3_3_2I1R12MassTerm_sound CB3_3_2I1R12Entropy_sound) (by decide +kernel) +def CB3_3_2I1R13Value (a : Fin 6) : ℝ := residualLaw (below (shape 3 3 2)) (fun u => (stageBLaw (shape 3 3 2) u : ℝ)) (stageBPriority (shape 3 3 2)) 1 (fun u a => (littleLaw (shape 3 3 2) u ((stageBPriority (shape 3 3 2)) 1) a : ℝ)) 13 a +def CB3_3_2I1R13Raw (a : Fin 6) : Ball := residualBall (below (shape 3 3 2)) B3_3_2Law (stageBPriority (shape 3 3 2)) 1 (fun u => B3_3_2Little u ((stageBPriority (shape 3 3 2)) 1)) 13 a +lemma CB3_3_2I1R13Raw_sound (a : Fin 6) : + (CB3_3_2I1R13Raw a).Encloses (CB3_3_2I1R13Value a) := by + exact residualBall_sound_on (below (shape 3 3 2)) B3_3_2Law (fun u => (stageBLaw (shape 3 3 2) u : ℝ)) (stageBPriority (shape 3 3 2)) 1 (fun u => B3_3_2Little u ((stageBPriority (shape 3 3 2)) 1)) (fun u a => (littleLaw (shape 3 3 2) u ((stageBPriority (shape 3 3 2)) 1) a : ℝ)) (fun u _ => B3_3_2Law_sound u) (fun u _ a => B3_3_2Little_sound u ((stageBPriority (shape 3 3 2)) 1) a) 13 a +def CB3_3_2I1R13Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB3_3_2I1R13Certificates_valid : + CB3_3_2I1R13Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB3_3_2I1R13CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB3_3_2I1R13P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_3_2I1R13Certificates (CB3_3_2I1R13CertificateIndex a)).input +lemma CB3_3_2I1R13P_check : ∀ a : Fin 6, contains (CB3_3_2I1R13Raw a) (CB3_3_2I1R13P a) = true := by + decide +kernel +lemma CB3_3_2I1R13P_sound (a : Fin 6) : + (CB3_3_2I1R13P a).Encloses (CB3_3_2I1R13Value a) := + contains_sound (CB3_3_2I1R13Raw_sound a) (CB3_3_2I1R13P_check a) +def CB3_3_2I1R13Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_3_2I1R13Certificates (CB3_3_2I1R13CertificateIndex a)).output +lemma CB3_3_2I1R13Terms_sound (a : Fin 6) : + (CB3_3_2I1R13Terms a).Encloses (Foundation.entropyTerm (CB3_3_2I1R13Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB3_3_2I1R13Certificates_valid + (CB3_3_2I1R13CertificateIndex a) (CB3_3_2I1R13P_sound a) +def CB3_3_2I1R13Entropy : Ball := ⟨0, 0⟩ +lemma CB3_3_2I1R13Entropy_sound : CB3_3_2I1R13Entropy.Encloses (Foundation.finiteEntropy CB3_3_2I1R13Value) := by + exact contains_sound (entropyFin_enclosed 6 CB3_3_2I1R13Value CB3_3_2I1R13Terms CB3_3_2I1R13Terms_sound) (by decide +kernel) +def CB3_3_2I1R13Mass : Ball := ⟨0, 0⟩ +lemma CB3_3_2I1R13Mass_sound : CB3_3_2I1R13Mass.Encloses (∑ a, CB3_3_2I1R13Value a) := by + exact contains_sound (finSumBall_sound 6 CB3_3_2I1R13P CB3_3_2I1R13Value CB3_3_2I1R13P_sound) (by decide +kernel) +def CB3_3_2I1R13MassTerm : Ball := .exact 0 +lemma CB3_3_2I1R13MassTerm_sound : CB3_3_2I1R13MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB3_3_2I1R13Value a))) := + entropyTerm_zero_ball (CB3_3_2I1R13Mass_sound) +def CB3_3_2I1R13H : Ball := ⟨0, 0⟩ +lemma CB3_3_2I1R13H_sound : CB3_3_2I1R13H.Encloses (homogeneousEntropy CB3_3_2I1R13Value) := by + exact contains_sound (homogeneous_enclosed CB3_3_2I1R13Value CB3_3_2I1R13MassTerm_sound CB3_3_2I1R13Entropy_sound) (by decide +kernel) +def CB3_3_2I1R14Value (a : Fin 6) : ℝ := residualLaw (below (shape 3 3 2)) (fun u => (stageBLaw (shape 3 3 2) u : ℝ)) (stageBPriority (shape 3 3 2)) 1 (fun u a => (littleLaw (shape 3 3 2) u ((stageBPriority (shape 3 3 2)) 1) a : ℝ)) 14 a +def CB3_3_2I1R14Raw (a : Fin 6) : Ball := residualBall (below (shape 3 3 2)) B3_3_2Law (stageBPriority (shape 3 3 2)) 1 (fun u => B3_3_2Little u ((stageBPriority (shape 3 3 2)) 1)) 14 a +lemma CB3_3_2I1R14Raw_sound (a : Fin 6) : + (CB3_3_2I1R14Raw a).Encloses (CB3_3_2I1R14Value a) := by + exact residualBall_sound_on (below (shape 3 3 2)) B3_3_2Law (fun u => (stageBLaw (shape 3 3 2) u : ℝ)) (stageBPriority (shape 3 3 2)) 1 (fun u => B3_3_2Little u ((stageBPriority (shape 3 3 2)) 1)) (fun u a => (littleLaw (shape 3 3 2) u ((stageBPriority (shape 3 3 2)) 1) a : ℝ)) (fun u _ => B3_3_2Law_sound u) (fun u _ a => B3_3_2Little_sound u ((stageBPriority (shape 3 3 2)) 1) a) 14 a +def CB3_3_2I1R14Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB3_3_2I1R14Certificates_valid : + CB3_3_2I1R14Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB3_3_2I1R14CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB3_3_2I1R14P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_3_2I1R14Certificates (CB3_3_2I1R14CertificateIndex a)).input +lemma CB3_3_2I1R14P_check : ∀ a : Fin 6, contains (CB3_3_2I1R14Raw a) (CB3_3_2I1R14P a) = true := by + decide +kernel +lemma CB3_3_2I1R14P_sound (a : Fin 6) : + (CB3_3_2I1R14P a).Encloses (CB3_3_2I1R14Value a) := + contains_sound (CB3_3_2I1R14Raw_sound a) (CB3_3_2I1R14P_check a) +def CB3_3_2I1R14Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_3_2I1R14Certificates (CB3_3_2I1R14CertificateIndex a)).output +lemma CB3_3_2I1R14Terms_sound (a : Fin 6) : + (CB3_3_2I1R14Terms a).Encloses (Foundation.entropyTerm (CB3_3_2I1R14Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB3_3_2I1R14Certificates_valid + (CB3_3_2I1R14CertificateIndex a) (CB3_3_2I1R14P_sound a) +def CB3_3_2I1R14Entropy : Ball := ⟨0, 0⟩ +lemma CB3_3_2I1R14Entropy_sound : CB3_3_2I1R14Entropy.Encloses (Foundation.finiteEntropy CB3_3_2I1R14Value) := by + exact contains_sound (entropyFin_enclosed 6 CB3_3_2I1R14Value CB3_3_2I1R14Terms CB3_3_2I1R14Terms_sound) (by decide +kernel) +def CB3_3_2I1R14Mass : Ball := ⟨0, 0⟩ +lemma CB3_3_2I1R14Mass_sound : CB3_3_2I1R14Mass.Encloses (∑ a, CB3_3_2I1R14Value a) := by + exact contains_sound (finSumBall_sound 6 CB3_3_2I1R14P CB3_3_2I1R14Value CB3_3_2I1R14P_sound) (by decide +kernel) +def CB3_3_2I1R14MassTerm : Ball := .exact 0 +lemma CB3_3_2I1R14MassTerm_sound : CB3_3_2I1R14MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB3_3_2I1R14Value a))) := + entropyTerm_zero_ball (CB3_3_2I1R14Mass_sound) +def CB3_3_2I1R14H : Ball := ⟨0, 0⟩ +lemma CB3_3_2I1R14H_sound : CB3_3_2I1R14H.Encloses (homogeneousEntropy CB3_3_2I1R14Value) := by + exact contains_sound (homogeneous_enclosed CB3_3_2I1R14Value CB3_3_2I1R14MassTerm_sound CB3_3_2I1R14Entropy_sound) (by decide +kernel) +def CB3_3_2I1R15Value (a : Fin 6) : ℝ := residualLaw (below (shape 3 3 2)) (fun u => (stageBLaw (shape 3 3 2) u : ℝ)) (stageBPriority (shape 3 3 2)) 1 (fun u a => (littleLaw (shape 3 3 2) u ((stageBPriority (shape 3 3 2)) 1) a : ℝ)) 15 a +def CB3_3_2I1R15Raw (a : Fin 6) : Ball := residualBall (below (shape 3 3 2)) B3_3_2Law (stageBPriority (shape 3 3 2)) 1 (fun u => B3_3_2Little u ((stageBPriority (shape 3 3 2)) 1)) 15 a +lemma CB3_3_2I1R15Raw_sound (a : Fin 6) : + (CB3_3_2I1R15Raw a).Encloses (CB3_3_2I1R15Value a) := by + exact residualBall_sound_on (below (shape 3 3 2)) B3_3_2Law (fun u => (stageBLaw (shape 3 3 2) u : ℝ)) (stageBPriority (shape 3 3 2)) 1 (fun u => B3_3_2Little u ((stageBPriority (shape 3 3 2)) 1)) (fun u a => (littleLaw (shape 3 3 2) u ((stageBPriority (shape 3 3 2)) 1) a : ℝ)) (fun u _ => B3_3_2Law_sound u) (fun u _ a => B3_3_2Little_sound u ((stageBPriority (shape 3 3 2)) 1) a) 15 a +def CB3_3_2I1R15Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB3_3_2I1R15Certificates_valid : + CB3_3_2I1R15Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB3_3_2I1R15CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB3_3_2I1R15P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_3_2I1R15Certificates (CB3_3_2I1R15CertificateIndex a)).input +lemma CB3_3_2I1R15P_check : ∀ a : Fin 6, contains (CB3_3_2I1R15Raw a) (CB3_3_2I1R15P a) = true := by + decide +kernel +lemma CB3_3_2I1R15P_sound (a : Fin 6) : + (CB3_3_2I1R15P a).Encloses (CB3_3_2I1R15Value a) := + contains_sound (CB3_3_2I1R15Raw_sound a) (CB3_3_2I1R15P_check a) +def CB3_3_2I1R15Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_3_2I1R15Certificates (CB3_3_2I1R15CertificateIndex a)).output +lemma CB3_3_2I1R15Terms_sound (a : Fin 6) : + (CB3_3_2I1R15Terms a).Encloses (Foundation.entropyTerm (CB3_3_2I1R15Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB3_3_2I1R15Certificates_valid + (CB3_3_2I1R15CertificateIndex a) (CB3_3_2I1R15P_sound a) +def CB3_3_2I1R15Entropy : Ball := ⟨0, 0⟩ +lemma CB3_3_2I1R15Entropy_sound : CB3_3_2I1R15Entropy.Encloses (Foundation.finiteEntropy CB3_3_2I1R15Value) := by + exact contains_sound (entropyFin_enclosed 6 CB3_3_2I1R15Value CB3_3_2I1R15Terms CB3_3_2I1R15Terms_sound) (by decide +kernel) +def CB3_3_2I1R15Mass : Ball := ⟨0, 0⟩ +lemma CB3_3_2I1R15Mass_sound : CB3_3_2I1R15Mass.Encloses (∑ a, CB3_3_2I1R15Value a) := by + exact contains_sound (finSumBall_sound 6 CB3_3_2I1R15P CB3_3_2I1R15Value CB3_3_2I1R15P_sound) (by decide +kernel) +def CB3_3_2I1R15MassTerm : Ball := .exact 0 +lemma CB3_3_2I1R15MassTerm_sound : CB3_3_2I1R15MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB3_3_2I1R15Value a))) := + entropyTerm_zero_ball (CB3_3_2I1R15Mass_sound) +def CB3_3_2I1R15H : Ball := ⟨0, 0⟩ +lemma CB3_3_2I1R15H_sound : CB3_3_2I1R15H.Encloses (homogeneousEntropy CB3_3_2I1R15Value) := by + exact contains_sound (homogeneous_enclosed CB3_3_2I1R15Value CB3_3_2I1R15MassTerm_sound CB3_3_2I1R15Entropy_sound) (by decide +kernel) +def CB3_3_2I1R16Value (a : Fin 6) : ℝ := residualLaw (below (shape 3 3 2)) (fun u => (stageBLaw (shape 3 3 2) u : ℝ)) (stageBPriority (shape 3 3 2)) 1 (fun u a => (littleLaw (shape 3 3 2) u ((stageBPriority (shape 3 3 2)) 1) a : ℝ)) 16 a +def CB3_3_2I1R16Raw (a : Fin 6) : Ball := residualBall (below (shape 3 3 2)) B3_3_2Law (stageBPriority (shape 3 3 2)) 1 (fun u => B3_3_2Little u ((stageBPriority (shape 3 3 2)) 1)) 16 a +lemma CB3_3_2I1R16Raw_sound (a : Fin 6) : + (CB3_3_2I1R16Raw a).Encloses (CB3_3_2I1R16Value a) := by + exact residualBall_sound_on (below (shape 3 3 2)) B3_3_2Law (fun u => (stageBLaw (shape 3 3 2) u : ℝ)) (stageBPriority (shape 3 3 2)) 1 (fun u => B3_3_2Little u ((stageBPriority (shape 3 3 2)) 1)) (fun u a => (littleLaw (shape 3 3 2) u ((stageBPriority (shape 3 3 2)) 1) a : ℝ)) (fun u _ => B3_3_2Law_sound u) (fun u _ a => B3_3_2Little_sound u ((stageBPriority (shape 3 3 2)) 1) a) 16 a +def CB3_3_2I1R16Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB3_3_2I1R16Certificates_valid : + CB3_3_2I1R16Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB3_3_2I1R16CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB3_3_2I1R16P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_3_2I1R16Certificates (CB3_3_2I1R16CertificateIndex a)).input +lemma CB3_3_2I1R16P_check : ∀ a : Fin 6, contains (CB3_3_2I1R16Raw a) (CB3_3_2I1R16P a) = true := by + decide +kernel +lemma CB3_3_2I1R16P_sound (a : Fin 6) : + (CB3_3_2I1R16P a).Encloses (CB3_3_2I1R16Value a) := + contains_sound (CB3_3_2I1R16Raw_sound a) (CB3_3_2I1R16P_check a) +def CB3_3_2I1R16Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_3_2I1R16Certificates (CB3_3_2I1R16CertificateIndex a)).output +lemma CB3_3_2I1R16Terms_sound (a : Fin 6) : + (CB3_3_2I1R16Terms a).Encloses (Foundation.entropyTerm (CB3_3_2I1R16Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB3_3_2I1R16Certificates_valid + (CB3_3_2I1R16CertificateIndex a) (CB3_3_2I1R16P_sound a) +def CB3_3_2I1R16Entropy : Ball := ⟨0, 0⟩ +lemma CB3_3_2I1R16Entropy_sound : CB3_3_2I1R16Entropy.Encloses (Foundation.finiteEntropy CB3_3_2I1R16Value) := by + exact contains_sound (entropyFin_enclosed 6 CB3_3_2I1R16Value CB3_3_2I1R16Terms CB3_3_2I1R16Terms_sound) (by decide +kernel) +def CB3_3_2I1R16Mass : Ball := ⟨0, 0⟩ +lemma CB3_3_2I1R16Mass_sound : CB3_3_2I1R16Mass.Encloses (∑ a, CB3_3_2I1R16Value a) := by + exact contains_sound (finSumBall_sound 6 CB3_3_2I1R16P CB3_3_2I1R16Value CB3_3_2I1R16P_sound) (by decide +kernel) +def CB3_3_2I1R16MassTerm : Ball := .exact 0 +lemma CB3_3_2I1R16MassTerm_sound : CB3_3_2I1R16MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB3_3_2I1R16Value a))) := + entropyTerm_zero_ball (CB3_3_2I1R16Mass_sound) +def CB3_3_2I1R16H : Ball := ⟨0, 0⟩ +lemma CB3_3_2I1R16H_sound : CB3_3_2I1R16H.Encloses (homogeneousEntropy CB3_3_2I1R16Value) := by + exact contains_sound (homogeneous_enclosed CB3_3_2I1R16Value CB3_3_2I1R16MassTerm_sound CB3_3_2I1R16Entropy_sound) (by decide +kernel) +def CB3_3_2I1ResidualEntropies (a : Fin 17) : Ball := + match a.val with + | 0 => CB3_3_2I1R0H + | 1 => CB3_3_2I1R1H + | 2 => CB3_3_2I1R2H + | 3 => CB3_3_2I1R3H + | 4 => CB3_3_2I1R4H + | 5 => CB3_3_2I1R5H + | 6 => CB3_3_2I1R6H + | 7 => CB3_3_2I1R7H + | 8 => CB3_3_2I1R8H + | 9 => CB3_3_2I1R9H + | 10 => CB3_3_2I1R10H + | 11 => CB3_3_2I1R11H + | 12 => CB3_3_2I1R12H + | 13 => CB3_3_2I1R13H + | 14 => CB3_3_2I1R14H + | 15 => CB3_3_2I1R15H + | 16 => CB3_3_2I1R16H + | _ => (.exact 0) +lemma CB3_3_2I1ResidualEntropies_sound (k : Fin 17) : + (CB3_3_2I1ResidualEntropies k).Encloses (homogeneousEntropy + (residualLaw (below (shape 3 3 2)) (fun u => (stageBLaw (shape 3 3 2) u : ℝ)) (stageBPriority (shape 3 3 2)) 1 (fun u a => (littleLaw (shape 3 3 2) u ((stageBPriority (shape 3 3 2)) 1) a : ℝ)) k)) := by + fin_cases k + · exact CB3_3_2I1R0H_sound + · exact CB3_3_2I1R1H_sound + · exact CB3_3_2I1R2H_sound + · exact CB3_3_2I1R3H_sound + · exact CB3_3_2I1R4H_sound + · exact CB3_3_2I1R5H_sound + · exact CB3_3_2I1R6H_sound + · exact CB3_3_2I1R7H_sound + · exact CB3_3_2I1R8H_sound + · exact CB3_3_2I1R9H_sound + · exact CB3_3_2I1R10H_sound + · exact CB3_3_2I1R11H_sound + · exact CB3_3_2I1R12H_sound + · exact CB3_3_2I1R13H_sound + · exact CB3_3_2I1R14H_sound + · exact CB3_3_2I1R15H_sound + · exact CB3_3_2I1R16H_sound +def CB3_3_2I1S2_0_2Value (a : Fin 6) : ℝ := (littleLaw (shape 3 3 2) (shape 2 0 2) ((stageBPriority (shape 3 3 2)) 1) a : ℝ) +def CB3_3_2I1S2_0_2E_2LogWitness : LogWitness := ⟨-1, 179521, 100000⟩ +def CB3_3_2I1S2_0_2E_2Log : Ball := ⟨(-10802517381923768407763481952009 / 100000000000000000000000000000000), (21175823683 / 50000000000000000000000000000000)⟩ +lemma CB3_3_2I1S2_0_2E_2Log_sound : CB3_3_2I1S2_0_2E_2Log.Encloses (Real.log (CB3_3_2I1S2_0_2Value (2 : Fin 6))) := by + exact checkLog_sound logTwoBall_sound ((B3_3_2Little_sound (shape 2 0 2) ((stageBPriority (shape 3 3 2)) 1)) (2 : Fin 6)) (w := CB3_3_2I1S2_0_2E_2LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB3_3_2I1S2_0_2E_2 : Ball := ⟨(9696393614601684141650540217533 / 100000000000000000000000000000000), (19007525217 / 50000000000000000000000000000000)⟩ +lemma CB3_3_2I1S2_0_2E_2_sound : CB3_3_2I1S2_0_2E_2.Encloses (Foundation.entropyTerm (CB3_3_2I1S2_0_2Value (2 : Fin 6))) := by + exact contains_sound (entropyTerm_ball ((B3_3_2Little_sound (shape 2 0 2) ((stageBPriority (shape 3 3 2)) 1)) (2 : Fin 6)) CB3_3_2I1S2_0_2E_2Log_sound) (by decide +kernel) +def CB3_3_2I1S2_0_2E_3LogWitness : LogWitness := ⟨-4, 20479, 12500⟩ +def CB3_3_2I1S2_0_2E_3Log : Ball := ⟨(-45578347913877226878717459404093 / 20000000000000000000000000000000), (21175823683 / 20000000000000000000000000000000)⟩ +lemma CB3_3_2I1S2_0_2E_3Log_sound : CB3_3_2I1S2_0_2E_3Log.Encloses (Real.log (CB3_3_2I1S2_0_2Value (3 : Fin 6))) := by + exact checkLog_sound logTwoBall_sound ((B3_3_2Little_sound (shape 2 0 2) ((stageBPriority (shape 3 3 2)) 1)) (3 : Fin 6)) (w := CB3_3_2I1S2_0_2E_3LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB3_3_2I1S2_0_2E_3 : Ball := ⟨(23334974673207293231231371278411 / 100000000000000000000000000000000), (10841492331 / 100000000000000000000000000000000)⟩ +lemma CB3_3_2I1S2_0_2E_3_sound : CB3_3_2I1S2_0_2E_3.Encloses (Foundation.entropyTerm (CB3_3_2I1S2_0_2Value (3 : Fin 6))) := by + exact contains_sound (entropyTerm_ball ((B3_3_2Little_sound (shape 2 0 2) ((stageBPriority (shape 3 3 2)) 1)) (3 : Fin 6)) CB3_3_2I1S2_0_2E_3Log_sound) (by decide +kernel) +def CB3_3_2I1S2_0_2Terms (a : Fin 6) : Ball := + match a.val with + | 2 => ⟨(9696393614601684141650540217533 / 100000000000000000000000000000000), (19007525217 / 50000000000000000000000000000000)⟩ + | 3 => ⟨(23334974673207293231231371278411 / 100000000000000000000000000000000), (10841492331 / 100000000000000000000000000000000)⟩ + | _ => (.exact 0) +lemma CB3_3_2I1S2_0_2Terms_sound (a : Fin 6) : + (CB3_3_2I1S2_0_2Terms a).Encloses (Foundation.entropyTerm (CB3_3_2I1S2_0_2Value a)) := by + fin_cases a + · exact (entropyTerm_zero_ball ((B3_3_2Little_sound (shape 2 0 2) ((stageBPriority (shape 3 3 2)) 1)) (0 : Fin 6))) + · exact (entropyTerm_zero_ball ((B3_3_2Little_sound (shape 2 0 2) ((stageBPriority (shape 3 3 2)) 1)) (1 : Fin 6))) + · exact CB3_3_2I1S2_0_2E_2_sound + · exact CB3_3_2I1S2_0_2E_3_sound + · exact (entropyTerm_zero_ball ((B3_3_2Little_sound (shape 2 0 2) ((stageBPriority (shape 3 3 2)) 1)) (4 : Fin 6))) + · exact (entropyTerm_zero_ball ((B3_3_2Little_sound (shape 2 0 2) ((stageBPriority (shape 3 3 2)) 1)) (5 : Fin 6))) +def CB3_3_2I1S2_0_2Entropy : Ball := ⟨(4128921035976122171610238936993 / 12500000000000000000000000000000), (9771308553 / 20000000000000000000000000000000)⟩ +lemma CB3_3_2I1S2_0_2Entropy_sound : CB3_3_2I1S2_0_2Entropy.Encloses (Foundation.finiteEntropy CB3_3_2I1S2_0_2Value) := by + exact contains_sound (entropyFin_enclosed 6 CB3_3_2I1S2_0_2Value CB3_3_2I1S2_0_2Terms CB3_3_2I1S2_0_2Terms_sound) (by decide +kernel) +def CB3_3_2I1S2_0_2Mass : Ball := ⟨1, 0⟩ +lemma CB3_3_2I1S2_0_2Mass_sound : CB3_3_2I1S2_0_2Mass.Encloses (∑ a, CB3_3_2I1S2_0_2Value a) := by + exact contains_sound (finSumBall_sound 6 (B3_3_2Little (shape 2 0 2) ((stageBPriority (shape 3 3 2)) 1)) CB3_3_2I1S2_0_2Value (B3_3_2Little_sound (shape 2 0 2) ((stageBPriority (shape 3 3 2)) 1))) (by decide +kernel) +def CB3_3_2I1S2_0_2MassTermLog : Ball := .exact 0 +lemma CB3_3_2I1S2_0_2MassTermLog_sound : CB3_3_2I1S2_0_2MassTermLog.Encloses (Real.log ((∑ a, CB3_3_2I1S2_0_2Value a))) := by + exact log_exact_one_ball (CB3_3_2I1S2_0_2Mass_sound) +def CB3_3_2I1S2_0_2MassTerm : Ball := ⟨0, 0⟩ +lemma CB3_3_2I1S2_0_2MassTerm_sound : CB3_3_2I1S2_0_2MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB3_3_2I1S2_0_2Value a))) := by + exact contains_sound (entropyTerm_ball (CB3_3_2I1S2_0_2Mass_sound) CB3_3_2I1S2_0_2MassTermLog_sound) (by decide +kernel) +def CB3_3_2I1S2_0_2H : Ball := ⟨(4128921035976122171610238936993 / 12500000000000000000000000000000), (9771308553 / 20000000000000000000000000000000)⟩ +lemma CB3_3_2I1S2_0_2H_sound : CB3_3_2I1S2_0_2H.Encloses (homogeneousEntropy CB3_3_2I1S2_0_2Value) := by + exact contains_sound (homogeneous_enclosed CB3_3_2I1S2_0_2Value CB3_3_2I1S2_0_2MassTerm_sound CB3_3_2I1S2_0_2Entropy_sound) (by decide +kernel) +def CB3_3_2I1S3_0_1Value (a : Fin 6) : ℝ := (littleLaw (shape 3 3 2) (shape 3 0 1) ((stageBPriority (shape 3 3 2)) 1) a : ℝ) +def CB3_3_2I1S3_0_1E_1Log : Ball := .exact 0 +lemma CB3_3_2I1S3_0_1E_1Log_sound : CB3_3_2I1S3_0_1E_1Log.Encloses (Real.log (CB3_3_2I1S3_0_1Value (1 : Fin 6))) := by + exact log_exact_one_ball ((B3_3_2Little_sound (shape 3 0 1) ((stageBPriority (shape 3 3 2)) 1)) (1 : Fin 6)) +def CB3_3_2I1S3_0_1E_1 : Ball := ⟨0, 0⟩ +lemma CB3_3_2I1S3_0_1E_1_sound : CB3_3_2I1S3_0_1E_1.Encloses (Foundation.entropyTerm (CB3_3_2I1S3_0_1Value (1 : Fin 6))) := by + exact contains_sound (entropyTerm_ball ((B3_3_2Little_sound (shape 3 0 1) ((stageBPriority (shape 3 3 2)) 1)) (1 : Fin 6)) CB3_3_2I1S3_0_1E_1Log_sound) (by decide +kernel) +def CB3_3_2I1S3_0_1Terms (a : Fin 6) : Ball := + match a.val with + | 1 => ⟨0, 0⟩ + | _ => (.exact 0) +lemma CB3_3_2I1S3_0_1Terms_sound (a : Fin 6) : + (CB3_3_2I1S3_0_1Terms a).Encloses (Foundation.entropyTerm (CB3_3_2I1S3_0_1Value a)) := by + fin_cases a + · exact (entropyTerm_zero_ball ((B3_3_2Little_sound (shape 3 0 1) ((stageBPriority (shape 3 3 2)) 1)) (0 : Fin 6))) + · exact CB3_3_2I1S3_0_1E_1_sound + · exact (entropyTerm_zero_ball ((B3_3_2Little_sound (shape 3 0 1) ((stageBPriority (shape 3 3 2)) 1)) (2 : Fin 6))) + · exact (entropyTerm_zero_ball ((B3_3_2Little_sound (shape 3 0 1) ((stageBPriority (shape 3 3 2)) 1)) (3 : Fin 6))) + · exact (entropyTerm_zero_ball ((B3_3_2Little_sound (shape 3 0 1) ((stageBPriority (shape 3 3 2)) 1)) (4 : Fin 6))) + · exact (entropyTerm_zero_ball ((B3_3_2Little_sound (shape 3 0 1) ((stageBPriority (shape 3 3 2)) 1)) (5 : Fin 6))) +def CB3_3_2I1S3_0_1Entropy : Ball := ⟨0, 0⟩ +lemma CB3_3_2I1S3_0_1Entropy_sound : CB3_3_2I1S3_0_1Entropy.Encloses (Foundation.finiteEntropy CB3_3_2I1S3_0_1Value) := by + exact contains_sound (entropyFin_enclosed 6 CB3_3_2I1S3_0_1Value CB3_3_2I1S3_0_1Terms CB3_3_2I1S3_0_1Terms_sound) (by decide +kernel) +def CB3_3_2I1S3_0_1Mass : Ball := ⟨1, 0⟩ +lemma CB3_3_2I1S3_0_1Mass_sound : CB3_3_2I1S3_0_1Mass.Encloses (∑ a, CB3_3_2I1S3_0_1Value a) := by + exact contains_sound (finSumBall_sound 6 (B3_3_2Little (shape 3 0 1) ((stageBPriority (shape 3 3 2)) 1)) CB3_3_2I1S3_0_1Value (B3_3_2Little_sound (shape 3 0 1) ((stageBPriority (shape 3 3 2)) 1))) (by decide +kernel) +def CB3_3_2I1S3_0_1MassTermLog : Ball := .exact 0 +lemma CB3_3_2I1S3_0_1MassTermLog_sound : CB3_3_2I1S3_0_1MassTermLog.Encloses (Real.log ((∑ a, CB3_3_2I1S3_0_1Value a))) := by + exact log_exact_one_ball (CB3_3_2I1S3_0_1Mass_sound) +def CB3_3_2I1S3_0_1MassTerm : Ball := ⟨0, 0⟩ +lemma CB3_3_2I1S3_0_1MassTerm_sound : CB3_3_2I1S3_0_1MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB3_3_2I1S3_0_1Value a))) := by + exact contains_sound (entropyTerm_ball (CB3_3_2I1S3_0_1Mass_sound) CB3_3_2I1S3_0_1MassTermLog_sound) (by decide +kernel) +def CB3_3_2I1S3_0_1H : Ball := ⟨0, 0⟩ +lemma CB3_3_2I1S3_0_1H_sound : CB3_3_2I1S3_0_1H.Encloses (homogeneousEntropy CB3_3_2I1S3_0_1Value) := by + exact contains_sound (homogeneous_enclosed CB3_3_2I1S3_0_1Value CB3_3_2I1S3_0_1MassTerm_sound CB3_3_2I1S3_0_1Entropy_sound) (by decide +kernel) +def CB3_3_2I1Singles (s : Shape) : Ball := + match s 0, s 1, s 2 with + | 2, 0, 2 => CB3_3_2I1S2_0_2H + | 3, 0, 1 => CB3_3_2I1S3_0_1H + | _, _, _ => (.exact 0) +lemma CB3_3_2I1Singles_sound (u : Shape) (hu : u ∈ below (shape 3 3 2)) + (hd : designated (stageBPriority (shape 3 3 2)) 1 u) : + (CB3_3_2I1Singles u).Encloses (homogeneousEntropy ((fun u a => (littleLaw (shape 3 3 2) u ((stageBPriority (shape 3 3 2)) 1) a : ℝ)) u)) := by + rw [B3_3_2_below] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl + · exact (show ¬ designated (stageBPriority (shape 3 3 2)) 1 (shape 0 2 2) by decide +kernel) hd |>.elim + · exact (show ¬ designated (stageBPriority (shape 3 3 2)) 1 (shape 0 3 1) by decide +kernel) hd |>.elim + · exact (show ¬ designated (stageBPriority (shape 3 3 2)) 1 (shape 1 1 2) by decide +kernel) hd |>.elim + · exact (show ¬ designated (stageBPriority (shape 3 3 2)) 1 (shape 1 2 1) by decide +kernel) hd |>.elim + · exact (show ¬ designated (stageBPriority (shape 3 3 2)) 1 (shape 1 3 0) by decide +kernel) hd |>.elim + · exact CB3_3_2I1S2_0_2H_sound + · exact (show ¬ designated (stageBPriority (shape 3 3 2)) 1 (shape 2 1 1) by decide +kernel) hd |>.elim + · exact (show ¬ designated (stageBPriority (shape 3 3 2)) 1 (shape 2 2 0) by decide +kernel) hd |>.elim + · exact CB3_3_2I1S3_0_1H_sound + · exact (show ¬ designated (stageBPriority (shape 3 3 2)) 1 (shape 3 1 0) by decide +kernel) hd |>.elim +def CB3_3_2I1Singleton : Ball := ⟨(95681617877593240735588627781 / 25000000000000000000000000000000), (566088941 / 100000000000000000000000000000000)⟩ +lemma CB3_3_2I1Singleton_sound : CB3_3_2I1Singleton.Encloses + (singletonEntropy (below (shape 3 3 2)) (fun u => (stageBLaw (shape 3 3 2) u : ℝ)) (stageBPriority (shape 3 3 2)) 1 (fun u a => (littleLaw (shape 3 3 2) u ((stageBPriority (shape 3 3 2)) 1) a : ℝ))) := by + exact contains_sound (singletonBall_sound (below (shape 3 3 2)) B3_3_2Law (fun u => (stageBLaw (shape 3 3 2) u : ℝ)) (stageBPriority (shape 3 3 2)) 1 + CB3_3_2I1Singles (fun u a => (littleLaw (shape 3 3 2) u ((stageBPriority (shape 3 3 2)) 1) a : ℝ)) (fun u _ => B3_3_2Law_sound u) CB3_3_2I1Singles_sound) (by decide +kernel) +def CB3_3_2I1Group : Ball := ⟨(217161349690579680257646123867 / 6250000000000000000000000000000), (115288173651 / 100000000000000000000000000000000)⟩ +lemma CB3_3_2I1Group_sound : CB3_3_2I1Group.Encloses + (groupedEntropy (below (shape 3 3 2)) (fun u => (stageBLaw (shape 3 3 2) u : ℝ)) (stageBPriority (shape 3 3 2)) 1 (fun u a => (littleLaw (shape 3 3 2) u ((stageBPriority (shape 3 3 2)) 1) a : ℝ))) := by + exact contains_sound (Ball.add_sound CB3_3_2I1Singleton_sound + (finSumBall_sound 17 CB3_3_2I1ResidualEntropies _ CB3_3_2I1ResidualEntropies_sound)) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CB3_3_2I1H : Ball := ⟨(91582746700685123785328353174749 / 100000000000000000000000000000000), (311238634817 / 100000000000000000000000000000000)⟩ +lemma CB3_3_2I1_sound : CB3_3_2I1H.Encloses (stageBCapacity (shape 3 3 2) 1) := by + have hb := contains_sound (Ball.add_sound CB3_3_2I1PairH_sound + (Ball.neg_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) CB3_3_2I1Group_sound))) + (show contains (.add CB3_3_2I1PairH (.neg (.mul (.exact 2) CB3_3_2I1Group))) CB3_3_2I1H = true by decide +kernel) + unfold CB3_3_2I1PairValue at hb + simpa only [stageBCapacity, nativeCapacity, + show (1 : Fin 3) ≠ 0 by decide, ite_false, sub_eq_add_neg] using hb + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/CapacityB/CapB3_3_2I2.lean b/lean/OAI/LinearAlgebra/MatrixFields/CapacityB/CapB3_3_2I2.lean new file mode 100644 index 0000000000000000000000000000000000000000..e5edafa2c5704baded8a789f23773e8e4c10c00e --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/CapacityB/CapB3_3_2I2.lean @@ -0,0 +1,1052 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Certificates.Terminal3_3_2 + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CB3_3_2I2PairValue (a : PairSlot) : ℝ := pairLaw (below (shape 3 3 2)) (shape 3 3 2) (fun u => (stageBLaw (shape 3 3 2) u : ℝ)) (fun u a => (littleLaw (shape 3 3 2) u ((stageBPriority (shape 3 3 2)) 2) a : ℝ)) a +def CB3_3_2I2PairRaw (a : PairSlot) : Ball := pairLawBall (below (shape 3 3 2)) (shape 3 3 2) B3_3_2Law (fun u => B3_3_2Little u ((stageBPriority (shape 3 3 2)) 2)) a +lemma CB3_3_2I2PairRaw_sound (a : PairSlot) : + (CB3_3_2I2PairRaw a).Encloses (CB3_3_2I2PairValue a) := by + exact pairLawBall_sound_on (below (shape 3 3 2)) (shape 3 3 2) B3_3_2Law (fun u => (stageBLaw (shape 3 3 2) u : ℝ)) (fun u => B3_3_2Little u ((stageBPriority (shape 3 3 2)) 2)) (fun u a => (littleLaw (shape 3 3 2) u ((stageBPriority (shape 3 3 2)) 2) a : ℝ)) (fun u _ => B3_3_2Law_sound u) (fun u _ a => B3_3_2Little_sound u ((stageBPriority (shape 3 3 2)) 2) a) (fun u _ a => B3_3_2Little_sound (complement (shape 3 3 2) u) ((stageBPriority (shape 3 3 2)) 2) a) a +def CB3_3_2I2PairCertificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(2914142085981020950846212413557 / 6250000000000000000000000000000), (1 / 2000000000000000000000000000000)⟩ ⟨(284609009772875036914823648829 / 800000000000000000000000000000), (29620492409 / 100000000000000000000000000000000)⟩ ⟨(-76300599739015860540513201988961 / 100000000000000000000000000000000), (15881867789 / 25000000000000000000000000000000)⟩ ⟨-2, 2914142085981020950846212413557, 1562500000000000000000000000000⟩, + .log ⟨(1026894192444005991017039212513 / 50000000000000000000000000000000), (1 / 20000000000000000000000000000000)⟩ ⟨(7979962125844969747207108373883 / 100000000000000000000000000000000), (761086569 / 25000000000000000000000000000000)⟩ ⟨(-38854841056470856470622297945219 / 10000000000000000000000000000000), (18528845753 / 12500000000000000000000000000000)⟩ ⟨-6, 1026894192444005991017039212513, 781250000000000000000000000000⟩, + .log ⟨(1319938239415652804426522958063 / 100000000000000000000000000000000), (1 / 20000000000000000000000000000000)⟩ ⟨(2856072620515310018139553368893 / 50000000000000000000000000000000), (1118031191 / 50000000000000000000000000000000)⟩ ⟨(-432758523880589468654268795850129 / 100000000000000000000000000000000), (84703294921 / 50000000000000000000000000000000)⟩ ⟨-7, 1319938239415652804426522958063, 781250000000000000000000000000⟩] +lemma CB3_3_2I2PairCertificates_valid : + CB3_3_2I2PairCertificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB3_3_2I2PairCertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 2, 1 => 1 + | 3, 1 => 2 + | 4, 0 => 3 + | 1, 2 => 1 + | 1, 3 => 2 + | 0, 4 => 3 + | _, _ => 0 +def CB3_3_2I2PairP (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CB3_3_2I2PairCertificates (CB3_3_2I2PairCertificateIndex a)).input +lemma CB3_3_2I2PairP_check : ∀ a : PairSlot, contains (CB3_3_2I2PairRaw a) (CB3_3_2I2PairP a) = true := by + decide +kernel +lemma CB3_3_2I2PairP_sound (a : PairSlot) : + (CB3_3_2I2PairP a).Encloses (CB3_3_2I2PairValue a) := + contains_sound (CB3_3_2I2PairRaw_sound a) (CB3_3_2I2PairP_check a) +def CB3_3_2I2PairTerms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CB3_3_2I2PairCertificates (CB3_3_2I2PairCertificateIndex a)).output +lemma CB3_3_2I2PairTerms_sound (a : PairSlot) : + (CB3_3_2I2PairTerms a).Encloses (Foundation.entropyTerm (CB3_3_2I2PairValue a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB3_3_2I2PairCertificates_valid + (CB3_3_2I2PairCertificateIndex a) (CB3_3_2I2PairP_sound a) +def CB3_3_2I2PairEntropy : Ball := ⟨(24634116794242484698919585607647 / 25000000000000000000000000000000), (34900901067 / 50000000000000000000000000000000)⟩ +lemma CB3_3_2I2PairEntropy_sound : CB3_3_2I2PairEntropy.Encloses (Foundation.finiteEntropy CB3_3_2I2PairValue) := by + exact contains_sound (entropyPair_enclosed CB3_3_2I2PairValue CB3_3_2I2PairTerms CB3_3_2I2PairTerms_sound) (by decide +kernel) +def CB3_3_2I2PairMass : Ball := ⟨(50000000000000000000000000000001 / 50000000000000000000000000000000), (3 / 2500000000000000000000000000000)⟩ +lemma CB3_3_2I2PairMass_sound : CB3_3_2I2PairMass.Encloses (∑ a, CB3_3_2I2PairValue a) := by + exact contains_sound (pairSumBall_sound CB3_3_2I2PairP CB3_3_2I2PairValue CB3_3_2I2PairP_sound) (by decide +kernel) +def CB3_3_2I2PairMassTermLogWitness : LogWitness := ⟨0, 50000000000000000000000000000001, 50000000000000000000000000000000⟩ +def CB3_3_2I2PairMassTermLog : Ball := ⟨(1 / 50000000000000000000000000000000), (10587911901 / 50000000000000000000000000000000)⟩ +lemma CB3_3_2I2PairMassTermLog_sound : CB3_3_2I2PairMassTermLog.Encloses (Real.log ((∑ a, CB3_3_2I2PairValue a))) := by + exact checkLog_sound logTwoBall_sound (CB3_3_2I2PairMass_sound) (w := CB3_3_2I2PairMassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB3_3_2I2PairMassTerm : Ball := ⟨(-1 / 50000000000000000000000000000000), (21175823803 / 100000000000000000000000000000000)⟩ +lemma CB3_3_2I2PairMassTerm_sound : CB3_3_2I2PairMassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB3_3_2I2PairValue a))) := by + exact contains_sound (entropyTerm_ball (CB3_3_2I2PairMass_sound) CB3_3_2I2PairMassTermLog_sound) (by decide +kernel) +def CB3_3_2I2PairH : Ball := ⟨(9853646717696993879567834243059 / 10000000000000000000000000000000), (90977625937 / 100000000000000000000000000000000)⟩ +lemma CB3_3_2I2PairH_sound : CB3_3_2I2PairH.Encloses (homogeneousEntropy CB3_3_2I2PairValue) := by + exact contains_sound (homogeneous_enclosed CB3_3_2I2PairValue CB3_3_2I2PairMassTerm_sound CB3_3_2I2PairEntropy_sound) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CB3_3_2I2R0Value (a : Fin 6) : ℝ := residualLaw (below (shape 3 3 2)) (fun u => (stageBLaw (shape 3 3 2) u : ℝ)) (stageBPriority (shape 3 3 2)) 2 (fun u a => (littleLaw (shape 3 3 2) u ((stageBPriority (shape 3 3 2)) 2) a : ℝ)) 0 a +def CB3_3_2I2R0Raw (a : Fin 6) : Ball := residualBall (below (shape 3 3 2)) B3_3_2Law (stageBPriority (shape 3 3 2)) 2 (fun u => B3_3_2Little u ((stageBPriority (shape 3 3 2)) 2)) 0 a +lemma CB3_3_2I2R0Raw_sound (a : Fin 6) : + (CB3_3_2I2R0Raw a).Encloses (CB3_3_2I2R0Value a) := by + exact residualBall_sound_on (below (shape 3 3 2)) B3_3_2Law (fun u => (stageBLaw (shape 3 3 2) u : ℝ)) (stageBPriority (shape 3 3 2)) 2 (fun u => B3_3_2Little u ((stageBPriority (shape 3 3 2)) 2)) (fun u a => (littleLaw (shape 3 3 2) u ((stageBPriority (shape 3 3 2)) 2) a : ℝ)) (fun u _ => B3_3_2Law_sound u) (fun u _ a => B3_3_2Little_sound u ((stageBPriority (shape 3 3 2)) 2) a) 0 a +def CB3_3_2I2R0Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(1319938239415652804426522958063 / 100000000000000000000000000000000), (1 / 20000000000000000000000000000000)⟩ ⟨(2856072620515310018139553368893 / 50000000000000000000000000000000), (1118031191 / 50000000000000000000000000000000)⟩ ⟨(-432758523880589468654268795850129 / 100000000000000000000000000000000), (84703294921 / 50000000000000000000000000000000)⟩ ⟨-7, 1319938239415652804426522958063, 781250000000000000000000000000⟩] +lemma CB3_3_2I2R0Certificates_valid : + CB3_3_2I2R0Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB3_3_2I2R0CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | 0 => 1 + | _ => 0 +def CB3_3_2I2R0P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_3_2I2R0Certificates (CB3_3_2I2R0CertificateIndex a)).input +lemma CB3_3_2I2R0P_check : ∀ a : Fin 6, contains (CB3_3_2I2R0Raw a) (CB3_3_2I2R0P a) = true := by + decide +kernel +lemma CB3_3_2I2R0P_sound (a : Fin 6) : + (CB3_3_2I2R0P a).Encloses (CB3_3_2I2R0Value a) := + contains_sound (CB3_3_2I2R0Raw_sound a) (CB3_3_2I2R0P_check a) +def CB3_3_2I2R0Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_3_2I2R0Certificates (CB3_3_2I2R0CertificateIndex a)).output +lemma CB3_3_2I2R0Terms_sound (a : Fin 6) : + (CB3_3_2I2R0Terms a).Encloses (Foundation.entropyTerm (CB3_3_2I2R0Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB3_3_2I2R0Certificates_valid + (CB3_3_2I2R0CertificateIndex a) (CB3_3_2I2R0P_sound a) +def CB3_3_2I2R0Entropy : Ball := ⟨(2856072620515310018139553368893 / 50000000000000000000000000000000), (1118031191 / 50000000000000000000000000000000)⟩ +lemma CB3_3_2I2R0Entropy_sound : CB3_3_2I2R0Entropy.Encloses (Foundation.finiteEntropy CB3_3_2I2R0Value) := by + exact contains_sound (entropyFin_enclosed 6 CB3_3_2I2R0Value CB3_3_2I2R0Terms CB3_3_2I2R0Terms_sound) (by decide +kernel) +def CB3_3_2I2R0Mass : Ball := ⟨(1319938239415652804426522958063 / 100000000000000000000000000000000), (1 / 20000000000000000000000000000000)⟩ +lemma CB3_3_2I2R0Mass_sound : CB3_3_2I2R0Mass.Encloses (∑ a, CB3_3_2I2R0Value a) := by + exact contains_sound (finSumBall_sound 6 CB3_3_2I2R0P CB3_3_2I2R0Value CB3_3_2I2R0P_sound) (by decide +kernel) +def CB3_3_2I2R0MassTermLogWitness : LogWitness := ⟨-7, 1319938239415652804426522958063, 781250000000000000000000000000⟩ +def CB3_3_2I2R0MassTermLog : Ball := ⟨(-432758523880589468654268795850129 / 100000000000000000000000000000000), (84703294921 / 50000000000000000000000000000000)⟩ +lemma CB3_3_2I2R0MassTermLog_sound : CB3_3_2I2R0MassTermLog.Encloses (Real.log ((∑ a, CB3_3_2I2R0Value a))) := by + exact checkLog_sound logTwoBall_sound (CB3_3_2I2R0Mass_sound) (w := CB3_3_2I2R0MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB3_3_2I2R0MassTerm : Ball := ⟨(2856072620515310018139553368893 / 50000000000000000000000000000000), (1118031191 / 50000000000000000000000000000000)⟩ +lemma CB3_3_2I2R0MassTerm_sound : CB3_3_2I2R0MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB3_3_2I2R0Value a))) := by + exact contains_sound (entropyTerm_ball (CB3_3_2I2R0Mass_sound) CB3_3_2I2R0MassTermLog_sound) (by decide +kernel) +def CB3_3_2I2R0H : Ball := ⟨0, (1118031191 / 25000000000000000000000000000000)⟩ +lemma CB3_3_2I2R0H_sound : CB3_3_2I2R0H.Encloses (homogeneousEntropy CB3_3_2I2R0Value) := by + exact contains_sound (homogeneous_enclosed CB3_3_2I2R0Value CB3_3_2I2R0MassTerm_sound CB3_3_2I2R0Entropy_sound) (by decide +kernel) +def CB3_3_2I2R1Value (a : Fin 6) : ℝ := residualLaw (below (shape 3 3 2)) (fun u => (stageBLaw (shape 3 3 2) u : ℝ)) (stageBPriority (shape 3 3 2)) 2 (fun u a => (littleLaw (shape 3 3 2) u ((stageBPriority (shape 3 3 2)) 2) a : ℝ)) 1 a +def CB3_3_2I2R1Raw (a : Fin 6) : Ball := residualBall (below (shape 3 3 2)) B3_3_2Law (stageBPriority (shape 3 3 2)) 2 (fun u => B3_3_2Little u ((stageBPriority (shape 3 3 2)) 2)) 1 a +lemma CB3_3_2I2R1Raw_sound (a : Fin 6) : + (CB3_3_2I2R1Raw a).Encloses (CB3_3_2I2R1Value a) := by + exact residualBall_sound_on (below (shape 3 3 2)) B3_3_2Law (fun u => (stageBLaw (shape 3 3 2) u : ℝ)) (stageBPriority (shape 3 3 2)) 2 (fun u => B3_3_2Little u ((stageBPriority (shape 3 3 2)) 2)) (fun u a => (littleLaw (shape 3 3 2) u ((stageBPriority (shape 3 3 2)) 2) a : ℝ)) (fun u _ => B3_3_2Law_sound u) (fun u _ a => B3_3_2Little_sound u ((stageBPriority (shape 3 3 2)) 2) a) 1 a +def CB3_3_2I2R1Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(11879795595388115584820017693353 / 25000000000000000000000000000000), (3 / 6250000000000000000000000000000)⟩ ⟨(35356016446905663631148847220423 / 100000000000000000000000000000000), (15093867457 / 50000000000000000000000000000000)⟩ ⟨(-74403671685713407784409267822843 / 100000000000000000000000000000000), (1270549423 / 2000000000000000000000000000000)⟩ ⟨-2, 11879795595388115584820017693353, 6250000000000000000000000000000⟩] +lemma CB3_3_2I2R1Certificates_valid : + CB3_3_2I2R1Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB3_3_2I2R1CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | 1 => 1 + | _ => 0 +def CB3_3_2I2R1P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_3_2I2R1Certificates (CB3_3_2I2R1CertificateIndex a)).input +lemma CB3_3_2I2R1P_check : ∀ a : Fin 6, contains (CB3_3_2I2R1Raw a) (CB3_3_2I2R1P a) = true := by + decide +kernel +lemma CB3_3_2I2R1P_sound (a : Fin 6) : + (CB3_3_2I2R1P a).Encloses (CB3_3_2I2R1Value a) := + contains_sound (CB3_3_2I2R1Raw_sound a) (CB3_3_2I2R1P_check a) +def CB3_3_2I2R1Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_3_2I2R1Certificates (CB3_3_2I2R1CertificateIndex a)).output +lemma CB3_3_2I2R1Terms_sound (a : Fin 6) : + (CB3_3_2I2R1Terms a).Encloses (Foundation.entropyTerm (CB3_3_2I2R1Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB3_3_2I2R1Certificates_valid + (CB3_3_2I2R1CertificateIndex a) (CB3_3_2I2R1P_sound a) +def CB3_3_2I2R1Entropy : Ball := ⟨(35356016446905663631148847220423 / 100000000000000000000000000000000), (15093867457 / 50000000000000000000000000000000)⟩ +lemma CB3_3_2I2R1Entropy_sound : CB3_3_2I2R1Entropy.Encloses (Foundation.finiteEntropy CB3_3_2I2R1Value) := by + exact contains_sound (entropyFin_enclosed 6 CB3_3_2I2R1Value CB3_3_2I2R1Terms CB3_3_2I2R1Terms_sound) (by decide +kernel) +def CB3_3_2I2R1Mass : Ball := ⟨(11879795595388115584820017693353 / 25000000000000000000000000000000), (3 / 6250000000000000000000000000000)⟩ +lemma CB3_3_2I2R1Mass_sound : CB3_3_2I2R1Mass.Encloses (∑ a, CB3_3_2I2R1Value a) := by + exact contains_sound (finSumBall_sound 6 CB3_3_2I2R1P CB3_3_2I2R1Value CB3_3_2I2R1P_sound) (by decide +kernel) +def CB3_3_2I2R1MassTermLogWitness : LogWitness := ⟨-2, 11879795595388115584820017693353, 6250000000000000000000000000000⟩ +def CB3_3_2I2R1MassTermLog : Ball := ⟨(-74403671685713407784409267822843 / 100000000000000000000000000000000), (1270549423 / 2000000000000000000000000000000)⟩ +lemma CB3_3_2I2R1MassTermLog_sound : CB3_3_2I2R1MassTermLog.Encloses (Real.log ((∑ a, CB3_3_2I2R1Value a))) := by + exact checkLog_sound logTwoBall_sound (CB3_3_2I2R1Mass_sound) (w := CB3_3_2I2R1MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB3_3_2I2R1MassTerm : Ball := ⟨(35356016446905663631148847220423 / 100000000000000000000000000000000), (15093867457 / 50000000000000000000000000000000)⟩ +lemma CB3_3_2I2R1MassTerm_sound : CB3_3_2I2R1MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB3_3_2I2R1Value a))) := by + exact contains_sound (entropyTerm_ball (CB3_3_2I2R1Mass_sound) CB3_3_2I2R1MassTermLog_sound) (by decide +kernel) +def CB3_3_2I2R1H : Ball := ⟨0, (15093867457 / 25000000000000000000000000000000)⟩ +lemma CB3_3_2I2R1H_sound : CB3_3_2I2R1H.Encloses (homogeneousEntropy CB3_3_2I2R1Value) := by + exact contains_sound (homogeneous_enclosed CB3_3_2I2R1Value CB3_3_2I2R1MassTerm_sound CB3_3_2I2R1Entropy_sound) (by decide +kernel) +def CB3_3_2I2R2Value (a : Fin 6) : ℝ := residualLaw (below (shape 3 3 2)) (fun u => (stageBLaw (shape 3 3 2) u : ℝ)) (stageBPriority (shape 3 3 2)) 2 (fun u a => (littleLaw (shape 3 3 2) u ((stageBPriority (shape 3 3 2)) 2) a : ℝ)) 2 a +def CB3_3_2I2R2Raw (a : Fin 6) : Ball := residualBall (below (shape 3 3 2)) B3_3_2Law (stageBPriority (shape 3 3 2)) 2 (fun u => B3_3_2Little u ((stageBPriority (shape 3 3 2)) 2)) 2 a +lemma CB3_3_2I2R2Raw_sound (a : Fin 6) : + (CB3_3_2I2R2Raw a).Encloses (CB3_3_2I2R2Value a) := by + exact residualBall_sound_on (below (shape 3 3 2)) B3_3_2Law (fun u => (stageBLaw (shape 3 3 2) u : ℝ)) (stageBPriority (shape 3 3 2)) 2 (fun u => B3_3_2Little u ((stageBPriority (shape 3 3 2)) 2)) (fun u a => (littleLaw (shape 3 3 2) u ((stageBPriority (shape 3 3 2)) 2) a : ℝ)) (fun u _ => B3_3_2Law_sound u) (fun u _ a => B3_3_2Little_sound u ((stageBPriority (shape 3 3 2)) 2) a) 2 a +def CB3_3_2I2R2Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(31195999854875531387848299833469 / 100000000000000000000000000000000), (19 / 100000000000000000000000000000000)⟩ ⟨(1816980297793637708791994101803 / 5000000000000000000000000000000), (9909014909 / 50000000000000000000000000000000)⟩ ⟨(-58244015458593072895828404981369 / 50000000000000000000000000000000), (63527471109 / 100000000000000000000000000000000)⟩ ⟨-2, 31195999854875531387848299833469, 25000000000000000000000000000000⟩, + .log ⟨(152857026151889705249947051813 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(24775916875072631458171242383 / 2500000000000000000000000000000), (178028043 / 50000000000000000000000000000000)⟩ ⟨(-6483422450062191667761571157347 / 1000000000000000000000000000000), (232934061167 / 100000000000000000000000000000000)⟩ ⟨-10, 152857026151889705249947051813, 97656250000000000000000000000⟩] +lemma CB3_3_2I2R2Certificates_valid : + CB3_3_2I2R2Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB3_3_2I2R2CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | 2 => 1 + | 3 => 2 + | _ => 0 +def CB3_3_2I2R2P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_3_2I2R2Certificates (CB3_3_2I2R2CertificateIndex a)).input +lemma CB3_3_2I2R2P_check : ∀ a : Fin 6, contains (CB3_3_2I2R2Raw a) (CB3_3_2I2R2P a) = true := by + decide +kernel +lemma CB3_3_2I2R2P_sound (a : Fin 6) : + (CB3_3_2I2R2P a).Encloses (CB3_3_2I2R2Value a) := + contains_sound (CB3_3_2I2R2Raw_sound a) (CB3_3_2I2R2P_check a) +def CB3_3_2I2R2Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_3_2I2R2Certificates (CB3_3_2I2R2CertificateIndex a)).output +lemma CB3_3_2I2R2Terms_sound (a : Fin 6) : + (CB3_3_2I2R2Terms a).Encloses (Foundation.entropyTerm (CB3_3_2I2R2Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB3_3_2I2R2Certificates_valid + (CB3_3_2I2R2CertificateIndex a) (CB3_3_2I2R2P_sound a) +def CB3_3_2I2R2Entropy : Ball := ⟨(1866532131543782971708336586569 / 5000000000000000000000000000000), (1260880369 / 6250000000000000000000000000000)⟩ +lemma CB3_3_2I2R2Entropy_sound : CB3_3_2I2R2Entropy.Encloses (Foundation.finiteEntropy CB3_3_2I2R2Value) := by + exact contains_sound (entropyFin_enclosed 6 CB3_3_2I2R2Value CB3_3_2I2R2Terms CB3_3_2I2R2Terms_sound) (by decide +kernel) +def CB3_3_2I2R2Mass : Ball := ⟨(15674428440513710546549123442641 / 50000000000000000000000000000000), (1 / 5000000000000000000000000000000)⟩ +lemma CB3_3_2I2R2Mass_sound : CB3_3_2I2R2Mass.Encloses (∑ a, CB3_3_2I2R2Value a) := by + exact contains_sound (finSumBall_sound 6 CB3_3_2I2R2P CB3_3_2I2R2Value CB3_3_2I2R2P_sound) (by decide +kernel) +def CB3_3_2I2R2MassTermLogWitness : LogWitness := ⟨-2, 15674428440513710546549123442641, 12500000000000000000000000000000⟩ +def CB3_3_2I2R2MassTermLog : Ball := ⟨(-57999619134953985371965508531891 / 50000000000000000000000000000000), (7940933889 / 12500000000000000000000000000000)⟩ +lemma CB3_3_2I2R2MassTermLog_sound : CB3_3_2I2R2MassTermLog.Encloses (Real.log ((∑ a, CB3_3_2I2R2Value a))) := by + exact checkLog_sound logTwoBall_sound (CB3_3_2I2R2Mass_sound) (w := CB3_3_2I2R2MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB3_3_2I2R2MassTerm : Ball := ⟨(9091108797078859624511383556729 / 25000000000000000000000000000000), (19915136023 / 100000000000000000000000000000000)⟩ +lemma CB3_3_2I2R2MassTerm_sound : CB3_3_2I2R2MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB3_3_2I2R2Value a))) := by + exact contains_sound (entropyTerm_ball (CB3_3_2I2R2Mass_sound) CB3_3_2I2R2MassTermLog_sound) (by decide +kernel) +def CB3_3_2I2R2H : Ball := ⟨(60387965160013808507574844029 / 6250000000000000000000000000000), (40089221927 / 100000000000000000000000000000000)⟩ +lemma CB3_3_2I2R2H_sound : CB3_3_2I2R2H.Encloses (homogeneousEntropy CB3_3_2I2R2Value) := by + exact contains_sound (homogeneous_enclosed CB3_3_2I2R2Value CB3_3_2I2R2MassTerm_sound CB3_3_2I2R2Entropy_sound) (by decide +kernel) +def CB3_3_2I2R3Value (a : Fin 6) : ℝ := residualLaw (below (shape 3 3 2)) (fun u => (stageBLaw (shape 3 3 2) u : ℝ)) (stageBPriority (shape 3 3 2)) 2 (fun u a => (littleLaw (shape 3 3 2) u ((stageBPriority (shape 3 3 2)) 2) a : ℝ)) 3 a +def CB3_3_2I2R3Raw (a : Fin 6) : Ball := residualBall (below (shape 3 3 2)) B3_3_2Law (stageBPriority (shape 3 3 2)) 2 (fun u => B3_3_2Little u ((stageBPriority (shape 3 3 2)) 2)) 3 a +lemma CB3_3_2I2R3Raw_sound (a : Fin 6) : + (CB3_3_2I2R3Raw a).Encloses (CB3_3_2I2R3Value a) := by + exact residualBall_sound_on (below (shape 3 3 2)) B3_3_2Law (fun u => (stageBLaw (shape 3 3 2) u : ℝ)) (stageBPriority (shape 3 3 2)) 2 (fun u => B3_3_2Little u ((stageBPriority (shape 3 3 2)) 2)) (fun u a => (littleLaw (shape 3 3 2) u ((stageBPriority (shape 3 3 2)) 2) a : ℝ)) (fun u _ => B3_3_2Law_sound u) (fun u _ a => B3_3_2Little_sound u ((stageBPriority (shape 3 3 2)) 2) a) 3 a +def CB3_3_2I2R3Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB3_3_2I2R3Certificates_valid : + CB3_3_2I2R3Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB3_3_2I2R3CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB3_3_2I2R3P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_3_2I2R3Certificates (CB3_3_2I2R3CertificateIndex a)).input +lemma CB3_3_2I2R3P_check : ∀ a : Fin 6, contains (CB3_3_2I2R3Raw a) (CB3_3_2I2R3P a) = true := by + decide +kernel +lemma CB3_3_2I2R3P_sound (a : Fin 6) : + (CB3_3_2I2R3P a).Encloses (CB3_3_2I2R3Value a) := + contains_sound (CB3_3_2I2R3Raw_sound a) (CB3_3_2I2R3P_check a) +def CB3_3_2I2R3Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_3_2I2R3Certificates (CB3_3_2I2R3CertificateIndex a)).output +lemma CB3_3_2I2R3Terms_sound (a : Fin 6) : + (CB3_3_2I2R3Terms a).Encloses (Foundation.entropyTerm (CB3_3_2I2R3Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB3_3_2I2R3Certificates_valid + (CB3_3_2I2R3CertificateIndex a) (CB3_3_2I2R3P_sound a) +def CB3_3_2I2R3Entropy : Ball := ⟨0, 0⟩ +lemma CB3_3_2I2R3Entropy_sound : CB3_3_2I2R3Entropy.Encloses (Foundation.finiteEntropy CB3_3_2I2R3Value) := by + exact contains_sound (entropyFin_enclosed 6 CB3_3_2I2R3Value CB3_3_2I2R3Terms CB3_3_2I2R3Terms_sound) (by decide +kernel) +def CB3_3_2I2R3Mass : Ball := ⟨0, 0⟩ +lemma CB3_3_2I2R3Mass_sound : CB3_3_2I2R3Mass.Encloses (∑ a, CB3_3_2I2R3Value a) := by + exact contains_sound (finSumBall_sound 6 CB3_3_2I2R3P CB3_3_2I2R3Value CB3_3_2I2R3P_sound) (by decide +kernel) +def CB3_3_2I2R3MassTerm : Ball := .exact 0 +lemma CB3_3_2I2R3MassTerm_sound : CB3_3_2I2R3MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB3_3_2I2R3Value a))) := + entropyTerm_zero_ball (CB3_3_2I2R3Mass_sound) +def CB3_3_2I2R3H : Ball := ⟨0, 0⟩ +lemma CB3_3_2I2R3H_sound : CB3_3_2I2R3H.Encloses (homogeneousEntropy CB3_3_2I2R3Value) := by + exact contains_sound (homogeneous_enclosed CB3_3_2I2R3Value CB3_3_2I2R3MassTerm_sound CB3_3_2I2R3Entropy_sound) (by decide +kernel) +def CB3_3_2I2R4Value (a : Fin 6) : ℝ := residualLaw (below (shape 3 3 2)) (fun u => (stageBLaw (shape 3 3 2) u : ℝ)) (stageBPriority (shape 3 3 2)) 2 (fun u a => (littleLaw (shape 3 3 2) u ((stageBPriority (shape 3 3 2)) 2) a : ℝ)) 4 a +def CB3_3_2I2R4Raw (a : Fin 6) : Ball := residualBall (below (shape 3 3 2)) B3_3_2Law (stageBPriority (shape 3 3 2)) 2 (fun u => B3_3_2Little u ((stageBPriority (shape 3 3 2)) 2)) 4 a +lemma CB3_3_2I2R4Raw_sound (a : Fin 6) : + (CB3_3_2I2R4Raw a).Encloses (CB3_3_2I2R4Value a) := by + exact residualBall_sound_on (below (shape 3 3 2)) B3_3_2Law (fun u => (stageBLaw (shape 3 3 2) u : ℝ)) (stageBPriority (shape 3 3 2)) 2 (fun u => B3_3_2Little u ((stageBPriority (shape 3 3 2)) 2)) (fun u a => (littleLaw (shape 3 3 2) u ((stageBPriority (shape 3 3 2)) 2) a : ℝ)) (fun u _ => B3_3_2Law_sound u) (fun u _ a => B3_3_2Little_sound u ((stageBPriority (shape 3 3 2)) 2) a) 4 a +def CB3_3_2I2R4Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB3_3_2I2R4Certificates_valid : + CB3_3_2I2R4Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB3_3_2I2R4CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB3_3_2I2R4P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_3_2I2R4Certificates (CB3_3_2I2R4CertificateIndex a)).input +lemma CB3_3_2I2R4P_check : ∀ a : Fin 6, contains (CB3_3_2I2R4Raw a) (CB3_3_2I2R4P a) = true := by + decide +kernel +lemma CB3_3_2I2R4P_sound (a : Fin 6) : + (CB3_3_2I2R4P a).Encloses (CB3_3_2I2R4Value a) := + contains_sound (CB3_3_2I2R4Raw_sound a) (CB3_3_2I2R4P_check a) +def CB3_3_2I2R4Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_3_2I2R4Certificates (CB3_3_2I2R4CertificateIndex a)).output +lemma CB3_3_2I2R4Terms_sound (a : Fin 6) : + (CB3_3_2I2R4Terms a).Encloses (Foundation.entropyTerm (CB3_3_2I2R4Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB3_3_2I2R4Certificates_valid + (CB3_3_2I2R4CertificateIndex a) (CB3_3_2I2R4P_sound a) +def CB3_3_2I2R4Entropy : Ball := ⟨0, 0⟩ +lemma CB3_3_2I2R4Entropy_sound : CB3_3_2I2R4Entropy.Encloses (Foundation.finiteEntropy CB3_3_2I2R4Value) := by + exact contains_sound (entropyFin_enclosed 6 CB3_3_2I2R4Value CB3_3_2I2R4Terms CB3_3_2I2R4Terms_sound) (by decide +kernel) +def CB3_3_2I2R4Mass : Ball := ⟨0, 0⟩ +lemma CB3_3_2I2R4Mass_sound : CB3_3_2I2R4Mass.Encloses (∑ a, CB3_3_2I2R4Value a) := by + exact contains_sound (finSumBall_sound 6 CB3_3_2I2R4P CB3_3_2I2R4Value CB3_3_2I2R4P_sound) (by decide +kernel) +def CB3_3_2I2R4MassTerm : Ball := .exact 0 +lemma CB3_3_2I2R4MassTerm_sound : CB3_3_2I2R4MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB3_3_2I2R4Value a))) := + entropyTerm_zero_ball (CB3_3_2I2R4Mass_sound) +def CB3_3_2I2R4H : Ball := ⟨0, 0⟩ +lemma CB3_3_2I2R4H_sound : CB3_3_2I2R4H.Encloses (homogeneousEntropy CB3_3_2I2R4Value) := by + exact contains_sound (homogeneous_enclosed CB3_3_2I2R4Value CB3_3_2I2R4MassTerm_sound CB3_3_2I2R4Entropy_sound) (by decide +kernel) +def CB3_3_2I2R5Value (a : Fin 6) : ℝ := residualLaw (below (shape 3 3 2)) (fun u => (stageBLaw (shape 3 3 2) u : ℝ)) (stageBPriority (shape 3 3 2)) 2 (fun u a => (littleLaw (shape 3 3 2) u ((stageBPriority (shape 3 3 2)) 2) a : ℝ)) 5 a +def CB3_3_2I2R5Raw (a : Fin 6) : Ball := residualBall (below (shape 3 3 2)) B3_3_2Law (stageBPriority (shape 3 3 2)) 2 (fun u => B3_3_2Little u ((stageBPriority (shape 3 3 2)) 2)) 5 a +lemma CB3_3_2I2R5Raw_sound (a : Fin 6) : + (CB3_3_2I2R5Raw a).Encloses (CB3_3_2I2R5Value a) := by + exact residualBall_sound_on (below (shape 3 3 2)) B3_3_2Law (fun u => (stageBLaw (shape 3 3 2) u : ℝ)) (stageBPriority (shape 3 3 2)) 2 (fun u => B3_3_2Little u ((stageBPriority (shape 3 3 2)) 2)) (fun u a => (littleLaw (shape 3 3 2) u ((stageBPriority (shape 3 3 2)) 2) a : ℝ)) (fun u _ => B3_3_2Law_sound u) (fun u _ a => B3_3_2Little_sound u ((stageBPriority (shape 3 3 2)) 2) a) 5 a +def CB3_3_2I2R5Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB3_3_2I2R5Certificates_valid : + CB3_3_2I2R5Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB3_3_2I2R5CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB3_3_2I2R5P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_3_2I2R5Certificates (CB3_3_2I2R5CertificateIndex a)).input +lemma CB3_3_2I2R5P_check : ∀ a : Fin 6, contains (CB3_3_2I2R5Raw a) (CB3_3_2I2R5P a) = true := by + decide +kernel +lemma CB3_3_2I2R5P_sound (a : Fin 6) : + (CB3_3_2I2R5P a).Encloses (CB3_3_2I2R5Value a) := + contains_sound (CB3_3_2I2R5Raw_sound a) (CB3_3_2I2R5P_check a) +def CB3_3_2I2R5Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_3_2I2R5Certificates (CB3_3_2I2R5CertificateIndex a)).output +lemma CB3_3_2I2R5Terms_sound (a : Fin 6) : + (CB3_3_2I2R5Terms a).Encloses (Foundation.entropyTerm (CB3_3_2I2R5Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB3_3_2I2R5Certificates_valid + (CB3_3_2I2R5CertificateIndex a) (CB3_3_2I2R5P_sound a) +def CB3_3_2I2R5Entropy : Ball := ⟨0, 0⟩ +lemma CB3_3_2I2R5Entropy_sound : CB3_3_2I2R5Entropy.Encloses (Foundation.finiteEntropy CB3_3_2I2R5Value) := by + exact contains_sound (entropyFin_enclosed 6 CB3_3_2I2R5Value CB3_3_2I2R5Terms CB3_3_2I2R5Terms_sound) (by decide +kernel) +def CB3_3_2I2R5Mass : Ball := ⟨0, 0⟩ +lemma CB3_3_2I2R5Mass_sound : CB3_3_2I2R5Mass.Encloses (∑ a, CB3_3_2I2R5Value a) := by + exact contains_sound (finSumBall_sound 6 CB3_3_2I2R5P CB3_3_2I2R5Value CB3_3_2I2R5P_sound) (by decide +kernel) +def CB3_3_2I2R5MassTerm : Ball := .exact 0 +lemma CB3_3_2I2R5MassTerm_sound : CB3_3_2I2R5MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB3_3_2I2R5Value a))) := + entropyTerm_zero_ball (CB3_3_2I2R5Mass_sound) +def CB3_3_2I2R5H : Ball := ⟨0, 0⟩ +lemma CB3_3_2I2R5H_sound : CB3_3_2I2R5H.Encloses (homogeneousEntropy CB3_3_2I2R5Value) := by + exact contains_sound (homogeneous_enclosed CB3_3_2I2R5Value CB3_3_2I2R5MassTerm_sound CB3_3_2I2R5Entropy_sound) (by decide +kernel) +def CB3_3_2I2R6Value (a : Fin 6) : ℝ := residualLaw (below (shape 3 3 2)) (fun u => (stageBLaw (shape 3 3 2) u : ℝ)) (stageBPriority (shape 3 3 2)) 2 (fun u a => (littleLaw (shape 3 3 2) u ((stageBPriority (shape 3 3 2)) 2) a : ℝ)) 6 a +def CB3_3_2I2R6Raw (a : Fin 6) : Ball := residualBall (below (shape 3 3 2)) B3_3_2Law (stageBPriority (shape 3 3 2)) 2 (fun u => B3_3_2Little u ((stageBPriority (shape 3 3 2)) 2)) 6 a +lemma CB3_3_2I2R6Raw_sound (a : Fin 6) : + (CB3_3_2I2R6Raw a).Encloses (CB3_3_2I2R6Value a) := by + exact residualBall_sound_on (below (shape 3 3 2)) B3_3_2Law (fun u => (stageBLaw (shape 3 3 2) u : ℝ)) (stageBPriority (shape 3 3 2)) 2 (fun u => B3_3_2Little u ((stageBPriority (shape 3 3 2)) 2)) (fun u a => (littleLaw (shape 3 3 2) u ((stageBPriority (shape 3 3 2)) 2) a : ℝ)) (fun u _ => B3_3_2Law_sound u) (fun u _ a => B3_3_2Little_sound u ((stageBPriority (shape 3 3 2)) 2) a) 6 a +def CB3_3_2I2R6Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB3_3_2I2R6Certificates_valid : + CB3_3_2I2R6Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB3_3_2I2R6CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB3_3_2I2R6P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_3_2I2R6Certificates (CB3_3_2I2R6CertificateIndex a)).input +lemma CB3_3_2I2R6P_check : ∀ a : Fin 6, contains (CB3_3_2I2R6Raw a) (CB3_3_2I2R6P a) = true := by + decide +kernel +lemma CB3_3_2I2R6P_sound (a : Fin 6) : + (CB3_3_2I2R6P a).Encloses (CB3_3_2I2R6Value a) := + contains_sound (CB3_3_2I2R6Raw_sound a) (CB3_3_2I2R6P_check a) +def CB3_3_2I2R6Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_3_2I2R6Certificates (CB3_3_2I2R6CertificateIndex a)).output +lemma CB3_3_2I2R6Terms_sound (a : Fin 6) : + (CB3_3_2I2R6Terms a).Encloses (Foundation.entropyTerm (CB3_3_2I2R6Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB3_3_2I2R6Certificates_valid + (CB3_3_2I2R6CertificateIndex a) (CB3_3_2I2R6P_sound a) +def CB3_3_2I2R6Entropy : Ball := ⟨0, 0⟩ +lemma CB3_3_2I2R6Entropy_sound : CB3_3_2I2R6Entropy.Encloses (Foundation.finiteEntropy CB3_3_2I2R6Value) := by + exact contains_sound (entropyFin_enclosed 6 CB3_3_2I2R6Value CB3_3_2I2R6Terms CB3_3_2I2R6Terms_sound) (by decide +kernel) +def CB3_3_2I2R6Mass : Ball := ⟨0, 0⟩ +lemma CB3_3_2I2R6Mass_sound : CB3_3_2I2R6Mass.Encloses (∑ a, CB3_3_2I2R6Value a) := by + exact contains_sound (finSumBall_sound 6 CB3_3_2I2R6P CB3_3_2I2R6Value CB3_3_2I2R6P_sound) (by decide +kernel) +def CB3_3_2I2R6MassTerm : Ball := .exact 0 +lemma CB3_3_2I2R6MassTerm_sound : CB3_3_2I2R6MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB3_3_2I2R6Value a))) := + entropyTerm_zero_ball (CB3_3_2I2R6Mass_sound) +def CB3_3_2I2R6H : Ball := ⟨0, 0⟩ +lemma CB3_3_2I2R6H_sound : CB3_3_2I2R6H.Encloses (homogeneousEntropy CB3_3_2I2R6Value) := by + exact contains_sound (homogeneous_enclosed CB3_3_2I2R6Value CB3_3_2I2R6MassTerm_sound CB3_3_2I2R6Entropy_sound) (by decide +kernel) +def CB3_3_2I2R7Value (a : Fin 6) : ℝ := residualLaw (below (shape 3 3 2)) (fun u => (stageBLaw (shape 3 3 2) u : ℝ)) (stageBPriority (shape 3 3 2)) 2 (fun u a => (littleLaw (shape 3 3 2) u ((stageBPriority (shape 3 3 2)) 2) a : ℝ)) 7 a +def CB3_3_2I2R7Raw (a : Fin 6) : Ball := residualBall (below (shape 3 3 2)) B3_3_2Law (stageBPriority (shape 3 3 2)) 2 (fun u => B3_3_2Little u ((stageBPriority (shape 3 3 2)) 2)) 7 a +lemma CB3_3_2I2R7Raw_sound (a : Fin 6) : + (CB3_3_2I2R7Raw a).Encloses (CB3_3_2I2R7Value a) := by + exact residualBall_sound_on (below (shape 3 3 2)) B3_3_2Law (fun u => (stageBLaw (shape 3 3 2) u : ℝ)) (stageBPriority (shape 3 3 2)) 2 (fun u => B3_3_2Little u ((stageBPriority (shape 3 3 2)) 2)) (fun u a => (littleLaw (shape 3 3 2) u ((stageBPriority (shape 3 3 2)) 2) a : ℝ)) (fun u _ => B3_3_2Law_sound u) (fun u _ a => B3_3_2Little_sound u ((stageBPriority (shape 3 3 2)) 2) a) 7 a +def CB3_3_2I2R7Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB3_3_2I2R7Certificates_valid : + CB3_3_2I2R7Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB3_3_2I2R7CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB3_3_2I2R7P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_3_2I2R7Certificates (CB3_3_2I2R7CertificateIndex a)).input +lemma CB3_3_2I2R7P_check : ∀ a : Fin 6, contains (CB3_3_2I2R7Raw a) (CB3_3_2I2R7P a) = true := by + decide +kernel +lemma CB3_3_2I2R7P_sound (a : Fin 6) : + (CB3_3_2I2R7P a).Encloses (CB3_3_2I2R7Value a) := + contains_sound (CB3_3_2I2R7Raw_sound a) (CB3_3_2I2R7P_check a) +def CB3_3_2I2R7Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_3_2I2R7Certificates (CB3_3_2I2R7CertificateIndex a)).output +lemma CB3_3_2I2R7Terms_sound (a : Fin 6) : + (CB3_3_2I2R7Terms a).Encloses (Foundation.entropyTerm (CB3_3_2I2R7Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB3_3_2I2R7Certificates_valid + (CB3_3_2I2R7CertificateIndex a) (CB3_3_2I2R7P_sound a) +def CB3_3_2I2R7Entropy : Ball := ⟨0, 0⟩ +lemma CB3_3_2I2R7Entropy_sound : CB3_3_2I2R7Entropy.Encloses (Foundation.finiteEntropy CB3_3_2I2R7Value) := by + exact contains_sound (entropyFin_enclosed 6 CB3_3_2I2R7Value CB3_3_2I2R7Terms CB3_3_2I2R7Terms_sound) (by decide +kernel) +def CB3_3_2I2R7Mass : Ball := ⟨0, 0⟩ +lemma CB3_3_2I2R7Mass_sound : CB3_3_2I2R7Mass.Encloses (∑ a, CB3_3_2I2R7Value a) := by + exact contains_sound (finSumBall_sound 6 CB3_3_2I2R7P CB3_3_2I2R7Value CB3_3_2I2R7P_sound) (by decide +kernel) +def CB3_3_2I2R7MassTerm : Ball := .exact 0 +lemma CB3_3_2I2R7MassTerm_sound : CB3_3_2I2R7MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB3_3_2I2R7Value a))) := + entropyTerm_zero_ball (CB3_3_2I2R7Mass_sound) +def CB3_3_2I2R7H : Ball := ⟨0, 0⟩ +lemma CB3_3_2I2R7H_sound : CB3_3_2I2R7H.Encloses (homogeneousEntropy CB3_3_2I2R7Value) := by + exact contains_sound (homogeneous_enclosed CB3_3_2I2R7Value CB3_3_2I2R7MassTerm_sound CB3_3_2I2R7Entropy_sound) (by decide +kernel) +def CB3_3_2I2R8Value (a : Fin 6) : ℝ := residualLaw (below (shape 3 3 2)) (fun u => (stageBLaw (shape 3 3 2) u : ℝ)) (stageBPriority (shape 3 3 2)) 2 (fun u a => (littleLaw (shape 3 3 2) u ((stageBPriority (shape 3 3 2)) 2) a : ℝ)) 8 a +def CB3_3_2I2R8Raw (a : Fin 6) : Ball := residualBall (below (shape 3 3 2)) B3_3_2Law (stageBPriority (shape 3 3 2)) 2 (fun u => B3_3_2Little u ((stageBPriority (shape 3 3 2)) 2)) 8 a +lemma CB3_3_2I2R8Raw_sound (a : Fin 6) : + (CB3_3_2I2R8Raw a).Encloses (CB3_3_2I2R8Value a) := by + exact residualBall_sound_on (below (shape 3 3 2)) B3_3_2Law (fun u => (stageBLaw (shape 3 3 2) u : ℝ)) (stageBPriority (shape 3 3 2)) 2 (fun u => B3_3_2Little u ((stageBPriority (shape 3 3 2)) 2)) (fun u a => (littleLaw (shape 3 3 2) u ((stageBPriority (shape 3 3 2)) 2) a : ℝ)) (fun u _ => B3_3_2Law_sound u) (fun u _ a => B3_3_2Little_sound u ((stageBPriority (shape 3 3 2)) 2) a) 8 a +def CB3_3_2I2R8Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB3_3_2I2R8Certificates_valid : + CB3_3_2I2R8Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB3_3_2I2R8CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB3_3_2I2R8P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_3_2I2R8Certificates (CB3_3_2I2R8CertificateIndex a)).input +lemma CB3_3_2I2R8P_check : ∀ a : Fin 6, contains (CB3_3_2I2R8Raw a) (CB3_3_2I2R8P a) = true := by + decide +kernel +lemma CB3_3_2I2R8P_sound (a : Fin 6) : + (CB3_3_2I2R8P a).Encloses (CB3_3_2I2R8Value a) := + contains_sound (CB3_3_2I2R8Raw_sound a) (CB3_3_2I2R8P_check a) +def CB3_3_2I2R8Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_3_2I2R8Certificates (CB3_3_2I2R8CertificateIndex a)).output +lemma CB3_3_2I2R8Terms_sound (a : Fin 6) : + (CB3_3_2I2R8Terms a).Encloses (Foundation.entropyTerm (CB3_3_2I2R8Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB3_3_2I2R8Certificates_valid + (CB3_3_2I2R8CertificateIndex a) (CB3_3_2I2R8P_sound a) +def CB3_3_2I2R8Entropy : Ball := ⟨0, 0⟩ +lemma CB3_3_2I2R8Entropy_sound : CB3_3_2I2R8Entropy.Encloses (Foundation.finiteEntropy CB3_3_2I2R8Value) := by + exact contains_sound (entropyFin_enclosed 6 CB3_3_2I2R8Value CB3_3_2I2R8Terms CB3_3_2I2R8Terms_sound) (by decide +kernel) +def CB3_3_2I2R8Mass : Ball := ⟨0, 0⟩ +lemma CB3_3_2I2R8Mass_sound : CB3_3_2I2R8Mass.Encloses (∑ a, CB3_3_2I2R8Value a) := by + exact contains_sound (finSumBall_sound 6 CB3_3_2I2R8P CB3_3_2I2R8Value CB3_3_2I2R8P_sound) (by decide +kernel) +def CB3_3_2I2R8MassTerm : Ball := .exact 0 +lemma CB3_3_2I2R8MassTerm_sound : CB3_3_2I2R8MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB3_3_2I2R8Value a))) := + entropyTerm_zero_ball (CB3_3_2I2R8Mass_sound) +def CB3_3_2I2R8H : Ball := ⟨0, 0⟩ +lemma CB3_3_2I2R8H_sound : CB3_3_2I2R8H.Encloses (homogeneousEntropy CB3_3_2I2R8Value) := by + exact contains_sound (homogeneous_enclosed CB3_3_2I2R8Value CB3_3_2I2R8MassTerm_sound CB3_3_2I2R8Entropy_sound) (by decide +kernel) +def CB3_3_2I2R9Value (a : Fin 6) : ℝ := residualLaw (below (shape 3 3 2)) (fun u => (stageBLaw (shape 3 3 2) u : ℝ)) (stageBPriority (shape 3 3 2)) 2 (fun u a => (littleLaw (shape 3 3 2) u ((stageBPriority (shape 3 3 2)) 2) a : ℝ)) 9 a +def CB3_3_2I2R9Raw (a : Fin 6) : Ball := residualBall (below (shape 3 3 2)) B3_3_2Law (stageBPriority (shape 3 3 2)) 2 (fun u => B3_3_2Little u ((stageBPriority (shape 3 3 2)) 2)) 9 a +lemma CB3_3_2I2R9Raw_sound (a : Fin 6) : + (CB3_3_2I2R9Raw a).Encloses (CB3_3_2I2R9Value a) := by + exact residualBall_sound_on (below (shape 3 3 2)) B3_3_2Law (fun u => (stageBLaw (shape 3 3 2) u : ℝ)) (stageBPriority (shape 3 3 2)) 2 (fun u => B3_3_2Little u ((stageBPriority (shape 3 3 2)) 2)) (fun u a => (littleLaw (shape 3 3 2) u ((stageBPriority (shape 3 3 2)) 2) a : ℝ)) (fun u _ => B3_3_2Law_sound u) (fun u _ a => B3_3_2Little_sound u ((stageBPriority (shape 3 3 2)) 2) a) 9 a +def CB3_3_2I2R9Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB3_3_2I2R9Certificates_valid : + CB3_3_2I2R9Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB3_3_2I2R9CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB3_3_2I2R9P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_3_2I2R9Certificates (CB3_3_2I2R9CertificateIndex a)).input +lemma CB3_3_2I2R9P_check : ∀ a : Fin 6, contains (CB3_3_2I2R9Raw a) (CB3_3_2I2R9P a) = true := by + decide +kernel +lemma CB3_3_2I2R9P_sound (a : Fin 6) : + (CB3_3_2I2R9P a).Encloses (CB3_3_2I2R9Value a) := + contains_sound (CB3_3_2I2R9Raw_sound a) (CB3_3_2I2R9P_check a) +def CB3_3_2I2R9Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_3_2I2R9Certificates (CB3_3_2I2R9CertificateIndex a)).output +lemma CB3_3_2I2R9Terms_sound (a : Fin 6) : + (CB3_3_2I2R9Terms a).Encloses (Foundation.entropyTerm (CB3_3_2I2R9Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB3_3_2I2R9Certificates_valid + (CB3_3_2I2R9CertificateIndex a) (CB3_3_2I2R9P_sound a) +def CB3_3_2I2R9Entropy : Ball := ⟨0, 0⟩ +lemma CB3_3_2I2R9Entropy_sound : CB3_3_2I2R9Entropy.Encloses (Foundation.finiteEntropy CB3_3_2I2R9Value) := by + exact contains_sound (entropyFin_enclosed 6 CB3_3_2I2R9Value CB3_3_2I2R9Terms CB3_3_2I2R9Terms_sound) (by decide +kernel) +def CB3_3_2I2R9Mass : Ball := ⟨0, 0⟩ +lemma CB3_3_2I2R9Mass_sound : CB3_3_2I2R9Mass.Encloses (∑ a, CB3_3_2I2R9Value a) := by + exact contains_sound (finSumBall_sound 6 CB3_3_2I2R9P CB3_3_2I2R9Value CB3_3_2I2R9P_sound) (by decide +kernel) +def CB3_3_2I2R9MassTerm : Ball := .exact 0 +lemma CB3_3_2I2R9MassTerm_sound : CB3_3_2I2R9MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB3_3_2I2R9Value a))) := + entropyTerm_zero_ball (CB3_3_2I2R9Mass_sound) +def CB3_3_2I2R9H : Ball := ⟨0, 0⟩ +lemma CB3_3_2I2R9H_sound : CB3_3_2I2R9H.Encloses (homogeneousEntropy CB3_3_2I2R9Value) := by + exact contains_sound (homogeneous_enclosed CB3_3_2I2R9Value CB3_3_2I2R9MassTerm_sound CB3_3_2I2R9Entropy_sound) (by decide +kernel) +def CB3_3_2I2R10Value (a : Fin 6) : ℝ := residualLaw (below (shape 3 3 2)) (fun u => (stageBLaw (shape 3 3 2) u : ℝ)) (stageBPriority (shape 3 3 2)) 2 (fun u a => (littleLaw (shape 3 3 2) u ((stageBPriority (shape 3 3 2)) 2) a : ℝ)) 10 a +def CB3_3_2I2R10Raw (a : Fin 6) : Ball := residualBall (below (shape 3 3 2)) B3_3_2Law (stageBPriority (shape 3 3 2)) 2 (fun u => B3_3_2Little u ((stageBPriority (shape 3 3 2)) 2)) 10 a +lemma CB3_3_2I2R10Raw_sound (a : Fin 6) : + (CB3_3_2I2R10Raw a).Encloses (CB3_3_2I2R10Value a) := by + exact residualBall_sound_on (below (shape 3 3 2)) B3_3_2Law (fun u => (stageBLaw (shape 3 3 2) u : ℝ)) (stageBPriority (shape 3 3 2)) 2 (fun u => B3_3_2Little u ((stageBPriority (shape 3 3 2)) 2)) (fun u a => (littleLaw (shape 3 3 2) u ((stageBPriority (shape 3 3 2)) 2) a : ℝ)) (fun u _ => B3_3_2Law_sound u) (fun u _ a => B3_3_2Little_sound u ((stageBPriority (shape 3 3 2)) 2) a) 10 a +def CB3_3_2I2R10Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB3_3_2I2R10Certificates_valid : + CB3_3_2I2R10Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB3_3_2I2R10CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB3_3_2I2R10P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_3_2I2R10Certificates (CB3_3_2I2R10CertificateIndex a)).input +lemma CB3_3_2I2R10P_check : ∀ a : Fin 6, contains (CB3_3_2I2R10Raw a) (CB3_3_2I2R10P a) = true := by + decide +kernel +lemma CB3_3_2I2R10P_sound (a : Fin 6) : + (CB3_3_2I2R10P a).Encloses (CB3_3_2I2R10Value a) := + contains_sound (CB3_3_2I2R10Raw_sound a) (CB3_3_2I2R10P_check a) +def CB3_3_2I2R10Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_3_2I2R10Certificates (CB3_3_2I2R10CertificateIndex a)).output +lemma CB3_3_2I2R10Terms_sound (a : Fin 6) : + (CB3_3_2I2R10Terms a).Encloses (Foundation.entropyTerm (CB3_3_2I2R10Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB3_3_2I2R10Certificates_valid + (CB3_3_2I2R10CertificateIndex a) (CB3_3_2I2R10P_sound a) +def CB3_3_2I2R10Entropy : Ball := ⟨0, 0⟩ +lemma CB3_3_2I2R10Entropy_sound : CB3_3_2I2R10Entropy.Encloses (Foundation.finiteEntropy CB3_3_2I2R10Value) := by + exact contains_sound (entropyFin_enclosed 6 CB3_3_2I2R10Value CB3_3_2I2R10Terms CB3_3_2I2R10Terms_sound) (by decide +kernel) +def CB3_3_2I2R10Mass : Ball := ⟨0, 0⟩ +lemma CB3_3_2I2R10Mass_sound : CB3_3_2I2R10Mass.Encloses (∑ a, CB3_3_2I2R10Value a) := by + exact contains_sound (finSumBall_sound 6 CB3_3_2I2R10P CB3_3_2I2R10Value CB3_3_2I2R10P_sound) (by decide +kernel) +def CB3_3_2I2R10MassTerm : Ball := .exact 0 +lemma CB3_3_2I2R10MassTerm_sound : CB3_3_2I2R10MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB3_3_2I2R10Value a))) := + entropyTerm_zero_ball (CB3_3_2I2R10Mass_sound) +def CB3_3_2I2R10H : Ball := ⟨0, 0⟩ +lemma CB3_3_2I2R10H_sound : CB3_3_2I2R10H.Encloses (homogeneousEntropy CB3_3_2I2R10Value) := by + exact contains_sound (homogeneous_enclosed CB3_3_2I2R10Value CB3_3_2I2R10MassTerm_sound CB3_3_2I2R10Entropy_sound) (by decide +kernel) +def CB3_3_2I2R11Value (a : Fin 6) : ℝ := residualLaw (below (shape 3 3 2)) (fun u => (stageBLaw (shape 3 3 2) u : ℝ)) (stageBPriority (shape 3 3 2)) 2 (fun u a => (littleLaw (shape 3 3 2) u ((stageBPriority (shape 3 3 2)) 2) a : ℝ)) 11 a +def CB3_3_2I2R11Raw (a : Fin 6) : Ball := residualBall (below (shape 3 3 2)) B3_3_2Law (stageBPriority (shape 3 3 2)) 2 (fun u => B3_3_2Little u ((stageBPriority (shape 3 3 2)) 2)) 11 a +lemma CB3_3_2I2R11Raw_sound (a : Fin 6) : + (CB3_3_2I2R11Raw a).Encloses (CB3_3_2I2R11Value a) := by + exact residualBall_sound_on (below (shape 3 3 2)) B3_3_2Law (fun u => (stageBLaw (shape 3 3 2) u : ℝ)) (stageBPriority (shape 3 3 2)) 2 (fun u => B3_3_2Little u ((stageBPriority (shape 3 3 2)) 2)) (fun u a => (littleLaw (shape 3 3 2) u ((stageBPriority (shape 3 3 2)) 2) a : ℝ)) (fun u _ => B3_3_2Law_sound u) (fun u _ a => B3_3_2Little_sound u ((stageBPriority (shape 3 3 2)) 2) a) 11 a +def CB3_3_2I2R11Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB3_3_2I2R11Certificates_valid : + CB3_3_2I2R11Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB3_3_2I2R11CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB3_3_2I2R11P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_3_2I2R11Certificates (CB3_3_2I2R11CertificateIndex a)).input +lemma CB3_3_2I2R11P_check : ∀ a : Fin 6, contains (CB3_3_2I2R11Raw a) (CB3_3_2I2R11P a) = true := by + decide +kernel +lemma CB3_3_2I2R11P_sound (a : Fin 6) : + (CB3_3_2I2R11P a).Encloses (CB3_3_2I2R11Value a) := + contains_sound (CB3_3_2I2R11Raw_sound a) (CB3_3_2I2R11P_check a) +def CB3_3_2I2R11Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_3_2I2R11Certificates (CB3_3_2I2R11CertificateIndex a)).output +lemma CB3_3_2I2R11Terms_sound (a : Fin 6) : + (CB3_3_2I2R11Terms a).Encloses (Foundation.entropyTerm (CB3_3_2I2R11Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB3_3_2I2R11Certificates_valid + (CB3_3_2I2R11CertificateIndex a) (CB3_3_2I2R11P_sound a) +def CB3_3_2I2R11Entropy : Ball := ⟨0, 0⟩ +lemma CB3_3_2I2R11Entropy_sound : CB3_3_2I2R11Entropy.Encloses (Foundation.finiteEntropy CB3_3_2I2R11Value) := by + exact contains_sound (entropyFin_enclosed 6 CB3_3_2I2R11Value CB3_3_2I2R11Terms CB3_3_2I2R11Terms_sound) (by decide +kernel) +def CB3_3_2I2R11Mass : Ball := ⟨0, 0⟩ +lemma CB3_3_2I2R11Mass_sound : CB3_3_2I2R11Mass.Encloses (∑ a, CB3_3_2I2R11Value a) := by + exact contains_sound (finSumBall_sound 6 CB3_3_2I2R11P CB3_3_2I2R11Value CB3_3_2I2R11P_sound) (by decide +kernel) +def CB3_3_2I2R11MassTerm : Ball := .exact 0 +lemma CB3_3_2I2R11MassTerm_sound : CB3_3_2I2R11MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB3_3_2I2R11Value a))) := + entropyTerm_zero_ball (CB3_3_2I2R11Mass_sound) +def CB3_3_2I2R11H : Ball := ⟨0, 0⟩ +lemma CB3_3_2I2R11H_sound : CB3_3_2I2R11H.Encloses (homogeneousEntropy CB3_3_2I2R11Value) := by + exact contains_sound (homogeneous_enclosed CB3_3_2I2R11Value CB3_3_2I2R11MassTerm_sound CB3_3_2I2R11Entropy_sound) (by decide +kernel) +def CB3_3_2I2R12Value (a : Fin 6) : ℝ := residualLaw (below (shape 3 3 2)) (fun u => (stageBLaw (shape 3 3 2) u : ℝ)) (stageBPriority (shape 3 3 2)) 2 (fun u a => (littleLaw (shape 3 3 2) u ((stageBPriority (shape 3 3 2)) 2) a : ℝ)) 12 a +def CB3_3_2I2R12Raw (a : Fin 6) : Ball := residualBall (below (shape 3 3 2)) B3_3_2Law (stageBPriority (shape 3 3 2)) 2 (fun u => B3_3_2Little u ((stageBPriority (shape 3 3 2)) 2)) 12 a +lemma CB3_3_2I2R12Raw_sound (a : Fin 6) : + (CB3_3_2I2R12Raw a).Encloses (CB3_3_2I2R12Value a) := by + exact residualBall_sound_on (below (shape 3 3 2)) B3_3_2Law (fun u => (stageBLaw (shape 3 3 2) u : ℝ)) (stageBPriority (shape 3 3 2)) 2 (fun u => B3_3_2Little u ((stageBPriority (shape 3 3 2)) 2)) (fun u a => (littleLaw (shape 3 3 2) u ((stageBPriority (shape 3 3 2)) 2) a : ℝ)) (fun u _ => B3_3_2Law_sound u) (fun u _ a => B3_3_2Little_sound u ((stageBPriority (shape 3 3 2)) 2) a) 12 a +def CB3_3_2I2R12Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB3_3_2I2R12Certificates_valid : + CB3_3_2I2R12Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB3_3_2I2R12CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB3_3_2I2R12P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_3_2I2R12Certificates (CB3_3_2I2R12CertificateIndex a)).input +lemma CB3_3_2I2R12P_check : ∀ a : Fin 6, contains (CB3_3_2I2R12Raw a) (CB3_3_2I2R12P a) = true := by + decide +kernel +lemma CB3_3_2I2R12P_sound (a : Fin 6) : + (CB3_3_2I2R12P a).Encloses (CB3_3_2I2R12Value a) := + contains_sound (CB3_3_2I2R12Raw_sound a) (CB3_3_2I2R12P_check a) +def CB3_3_2I2R12Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_3_2I2R12Certificates (CB3_3_2I2R12CertificateIndex a)).output +lemma CB3_3_2I2R12Terms_sound (a : Fin 6) : + (CB3_3_2I2R12Terms a).Encloses (Foundation.entropyTerm (CB3_3_2I2R12Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB3_3_2I2R12Certificates_valid + (CB3_3_2I2R12CertificateIndex a) (CB3_3_2I2R12P_sound a) +def CB3_3_2I2R12Entropy : Ball := ⟨0, 0⟩ +lemma CB3_3_2I2R12Entropy_sound : CB3_3_2I2R12Entropy.Encloses (Foundation.finiteEntropy CB3_3_2I2R12Value) := by + exact contains_sound (entropyFin_enclosed 6 CB3_3_2I2R12Value CB3_3_2I2R12Terms CB3_3_2I2R12Terms_sound) (by decide +kernel) +def CB3_3_2I2R12Mass : Ball := ⟨0, 0⟩ +lemma CB3_3_2I2R12Mass_sound : CB3_3_2I2R12Mass.Encloses (∑ a, CB3_3_2I2R12Value a) := by + exact contains_sound (finSumBall_sound 6 CB3_3_2I2R12P CB3_3_2I2R12Value CB3_3_2I2R12P_sound) (by decide +kernel) +def CB3_3_2I2R12MassTerm : Ball := .exact 0 +lemma CB3_3_2I2R12MassTerm_sound : CB3_3_2I2R12MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB3_3_2I2R12Value a))) := + entropyTerm_zero_ball (CB3_3_2I2R12Mass_sound) +def CB3_3_2I2R12H : Ball := ⟨0, 0⟩ +lemma CB3_3_2I2R12H_sound : CB3_3_2I2R12H.Encloses (homogeneousEntropy CB3_3_2I2R12Value) := by + exact contains_sound (homogeneous_enclosed CB3_3_2I2R12Value CB3_3_2I2R12MassTerm_sound CB3_3_2I2R12Entropy_sound) (by decide +kernel) +def CB3_3_2I2R13Value (a : Fin 6) : ℝ := residualLaw (below (shape 3 3 2)) (fun u => (stageBLaw (shape 3 3 2) u : ℝ)) (stageBPriority (shape 3 3 2)) 2 (fun u a => (littleLaw (shape 3 3 2) u ((stageBPriority (shape 3 3 2)) 2) a : ℝ)) 13 a +def CB3_3_2I2R13Raw (a : Fin 6) : Ball := residualBall (below (shape 3 3 2)) B3_3_2Law (stageBPriority (shape 3 3 2)) 2 (fun u => B3_3_2Little u ((stageBPriority (shape 3 3 2)) 2)) 13 a +lemma CB3_3_2I2R13Raw_sound (a : Fin 6) : + (CB3_3_2I2R13Raw a).Encloses (CB3_3_2I2R13Value a) := by + exact residualBall_sound_on (below (shape 3 3 2)) B3_3_2Law (fun u => (stageBLaw (shape 3 3 2) u : ℝ)) (stageBPriority (shape 3 3 2)) 2 (fun u => B3_3_2Little u ((stageBPriority (shape 3 3 2)) 2)) (fun u a => (littleLaw (shape 3 3 2) u ((stageBPriority (shape 3 3 2)) 2) a : ℝ)) (fun u _ => B3_3_2Law_sound u) (fun u _ a => B3_3_2Little_sound u ((stageBPriority (shape 3 3 2)) 2) a) 13 a +def CB3_3_2I2R13Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB3_3_2I2R13Certificates_valid : + CB3_3_2I2R13Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB3_3_2I2R13CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB3_3_2I2R13P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_3_2I2R13Certificates (CB3_3_2I2R13CertificateIndex a)).input +lemma CB3_3_2I2R13P_check : ∀ a : Fin 6, contains (CB3_3_2I2R13Raw a) (CB3_3_2I2R13P a) = true := by + decide +kernel +lemma CB3_3_2I2R13P_sound (a : Fin 6) : + (CB3_3_2I2R13P a).Encloses (CB3_3_2I2R13Value a) := + contains_sound (CB3_3_2I2R13Raw_sound a) (CB3_3_2I2R13P_check a) +def CB3_3_2I2R13Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_3_2I2R13Certificates (CB3_3_2I2R13CertificateIndex a)).output +lemma CB3_3_2I2R13Terms_sound (a : Fin 6) : + (CB3_3_2I2R13Terms a).Encloses (Foundation.entropyTerm (CB3_3_2I2R13Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB3_3_2I2R13Certificates_valid + (CB3_3_2I2R13CertificateIndex a) (CB3_3_2I2R13P_sound a) +def CB3_3_2I2R13Entropy : Ball := ⟨0, 0⟩ +lemma CB3_3_2I2R13Entropy_sound : CB3_3_2I2R13Entropy.Encloses (Foundation.finiteEntropy CB3_3_2I2R13Value) := by + exact contains_sound (entropyFin_enclosed 6 CB3_3_2I2R13Value CB3_3_2I2R13Terms CB3_3_2I2R13Terms_sound) (by decide +kernel) +def CB3_3_2I2R13Mass : Ball := ⟨0, 0⟩ +lemma CB3_3_2I2R13Mass_sound : CB3_3_2I2R13Mass.Encloses (∑ a, CB3_3_2I2R13Value a) := by + exact contains_sound (finSumBall_sound 6 CB3_3_2I2R13P CB3_3_2I2R13Value CB3_3_2I2R13P_sound) (by decide +kernel) +def CB3_3_2I2R13MassTerm : Ball := .exact 0 +lemma CB3_3_2I2R13MassTerm_sound : CB3_3_2I2R13MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB3_3_2I2R13Value a))) := + entropyTerm_zero_ball (CB3_3_2I2R13Mass_sound) +def CB3_3_2I2R13H : Ball := ⟨0, 0⟩ +lemma CB3_3_2I2R13H_sound : CB3_3_2I2R13H.Encloses (homogeneousEntropy CB3_3_2I2R13Value) := by + exact contains_sound (homogeneous_enclosed CB3_3_2I2R13Value CB3_3_2I2R13MassTerm_sound CB3_3_2I2R13Entropy_sound) (by decide +kernel) +def CB3_3_2I2R14Value (a : Fin 6) : ℝ := residualLaw (below (shape 3 3 2)) (fun u => (stageBLaw (shape 3 3 2) u : ℝ)) (stageBPriority (shape 3 3 2)) 2 (fun u a => (littleLaw (shape 3 3 2) u ((stageBPriority (shape 3 3 2)) 2) a : ℝ)) 14 a +def CB3_3_2I2R14Raw (a : Fin 6) : Ball := residualBall (below (shape 3 3 2)) B3_3_2Law (stageBPriority (shape 3 3 2)) 2 (fun u => B3_3_2Little u ((stageBPriority (shape 3 3 2)) 2)) 14 a +lemma CB3_3_2I2R14Raw_sound (a : Fin 6) : + (CB3_3_2I2R14Raw a).Encloses (CB3_3_2I2R14Value a) := by + exact residualBall_sound_on (below (shape 3 3 2)) B3_3_2Law (fun u => (stageBLaw (shape 3 3 2) u : ℝ)) (stageBPriority (shape 3 3 2)) 2 (fun u => B3_3_2Little u ((stageBPriority (shape 3 3 2)) 2)) (fun u a => (littleLaw (shape 3 3 2) u ((stageBPriority (shape 3 3 2)) 2) a : ℝ)) (fun u _ => B3_3_2Law_sound u) (fun u _ a => B3_3_2Little_sound u ((stageBPriority (shape 3 3 2)) 2) a) 14 a +def CB3_3_2I2R14Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB3_3_2I2R14Certificates_valid : + CB3_3_2I2R14Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB3_3_2I2R14CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB3_3_2I2R14P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_3_2I2R14Certificates (CB3_3_2I2R14CertificateIndex a)).input +lemma CB3_3_2I2R14P_check : ∀ a : Fin 6, contains (CB3_3_2I2R14Raw a) (CB3_3_2I2R14P a) = true := by + decide +kernel +lemma CB3_3_2I2R14P_sound (a : Fin 6) : + (CB3_3_2I2R14P a).Encloses (CB3_3_2I2R14Value a) := + contains_sound (CB3_3_2I2R14Raw_sound a) (CB3_3_2I2R14P_check a) +def CB3_3_2I2R14Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_3_2I2R14Certificates (CB3_3_2I2R14CertificateIndex a)).output +lemma CB3_3_2I2R14Terms_sound (a : Fin 6) : + (CB3_3_2I2R14Terms a).Encloses (Foundation.entropyTerm (CB3_3_2I2R14Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB3_3_2I2R14Certificates_valid + (CB3_3_2I2R14CertificateIndex a) (CB3_3_2I2R14P_sound a) +def CB3_3_2I2R14Entropy : Ball := ⟨0, 0⟩ +lemma CB3_3_2I2R14Entropy_sound : CB3_3_2I2R14Entropy.Encloses (Foundation.finiteEntropy CB3_3_2I2R14Value) := by + exact contains_sound (entropyFin_enclosed 6 CB3_3_2I2R14Value CB3_3_2I2R14Terms CB3_3_2I2R14Terms_sound) (by decide +kernel) +def CB3_3_2I2R14Mass : Ball := ⟨0, 0⟩ +lemma CB3_3_2I2R14Mass_sound : CB3_3_2I2R14Mass.Encloses (∑ a, CB3_3_2I2R14Value a) := by + exact contains_sound (finSumBall_sound 6 CB3_3_2I2R14P CB3_3_2I2R14Value CB3_3_2I2R14P_sound) (by decide +kernel) +def CB3_3_2I2R14MassTerm : Ball := .exact 0 +lemma CB3_3_2I2R14MassTerm_sound : CB3_3_2I2R14MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB3_3_2I2R14Value a))) := + entropyTerm_zero_ball (CB3_3_2I2R14Mass_sound) +def CB3_3_2I2R14H : Ball := ⟨0, 0⟩ +lemma CB3_3_2I2R14H_sound : CB3_3_2I2R14H.Encloses (homogeneousEntropy CB3_3_2I2R14Value) := by + exact contains_sound (homogeneous_enclosed CB3_3_2I2R14Value CB3_3_2I2R14MassTerm_sound CB3_3_2I2R14Entropy_sound) (by decide +kernel) +def CB3_3_2I2R15Value (a : Fin 6) : ℝ := residualLaw (below (shape 3 3 2)) (fun u => (stageBLaw (shape 3 3 2) u : ℝ)) (stageBPriority (shape 3 3 2)) 2 (fun u a => (littleLaw (shape 3 3 2) u ((stageBPriority (shape 3 3 2)) 2) a : ℝ)) 15 a +def CB3_3_2I2R15Raw (a : Fin 6) : Ball := residualBall (below (shape 3 3 2)) B3_3_2Law (stageBPriority (shape 3 3 2)) 2 (fun u => B3_3_2Little u ((stageBPriority (shape 3 3 2)) 2)) 15 a +lemma CB3_3_2I2R15Raw_sound (a : Fin 6) : + (CB3_3_2I2R15Raw a).Encloses (CB3_3_2I2R15Value a) := by + exact residualBall_sound_on (below (shape 3 3 2)) B3_3_2Law (fun u => (stageBLaw (shape 3 3 2) u : ℝ)) (stageBPriority (shape 3 3 2)) 2 (fun u => B3_3_2Little u ((stageBPriority (shape 3 3 2)) 2)) (fun u a => (littleLaw (shape 3 3 2) u ((stageBPriority (shape 3 3 2)) 2) a : ℝ)) (fun u _ => B3_3_2Law_sound u) (fun u _ a => B3_3_2Little_sound u ((stageBPriority (shape 3 3 2)) 2) a) 15 a +def CB3_3_2I2R15Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB3_3_2I2R15Certificates_valid : + CB3_3_2I2R15Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB3_3_2I2R15CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB3_3_2I2R15P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_3_2I2R15Certificates (CB3_3_2I2R15CertificateIndex a)).input +lemma CB3_3_2I2R15P_check : ∀ a : Fin 6, contains (CB3_3_2I2R15Raw a) (CB3_3_2I2R15P a) = true := by + decide +kernel +lemma CB3_3_2I2R15P_sound (a : Fin 6) : + (CB3_3_2I2R15P a).Encloses (CB3_3_2I2R15Value a) := + contains_sound (CB3_3_2I2R15Raw_sound a) (CB3_3_2I2R15P_check a) +def CB3_3_2I2R15Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_3_2I2R15Certificates (CB3_3_2I2R15CertificateIndex a)).output +lemma CB3_3_2I2R15Terms_sound (a : Fin 6) : + (CB3_3_2I2R15Terms a).Encloses (Foundation.entropyTerm (CB3_3_2I2R15Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB3_3_2I2R15Certificates_valid + (CB3_3_2I2R15CertificateIndex a) (CB3_3_2I2R15P_sound a) +def CB3_3_2I2R15Entropy : Ball := ⟨0, 0⟩ +lemma CB3_3_2I2R15Entropy_sound : CB3_3_2I2R15Entropy.Encloses (Foundation.finiteEntropy CB3_3_2I2R15Value) := by + exact contains_sound (entropyFin_enclosed 6 CB3_3_2I2R15Value CB3_3_2I2R15Terms CB3_3_2I2R15Terms_sound) (by decide +kernel) +def CB3_3_2I2R15Mass : Ball := ⟨0, 0⟩ +lemma CB3_3_2I2R15Mass_sound : CB3_3_2I2R15Mass.Encloses (∑ a, CB3_3_2I2R15Value a) := by + exact contains_sound (finSumBall_sound 6 CB3_3_2I2R15P CB3_3_2I2R15Value CB3_3_2I2R15P_sound) (by decide +kernel) +def CB3_3_2I2R15MassTerm : Ball := .exact 0 +lemma CB3_3_2I2R15MassTerm_sound : CB3_3_2I2R15MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB3_3_2I2R15Value a))) := + entropyTerm_zero_ball (CB3_3_2I2R15Mass_sound) +def CB3_3_2I2R15H : Ball := ⟨0, 0⟩ +lemma CB3_3_2I2R15H_sound : CB3_3_2I2R15H.Encloses (homogeneousEntropy CB3_3_2I2R15Value) := by + exact contains_sound (homogeneous_enclosed CB3_3_2I2R15Value CB3_3_2I2R15MassTerm_sound CB3_3_2I2R15Entropy_sound) (by decide +kernel) +def CB3_3_2I2R16Value (a : Fin 6) : ℝ := residualLaw (below (shape 3 3 2)) (fun u => (stageBLaw (shape 3 3 2) u : ℝ)) (stageBPriority (shape 3 3 2)) 2 (fun u a => (littleLaw (shape 3 3 2) u ((stageBPriority (shape 3 3 2)) 2) a : ℝ)) 16 a +def CB3_3_2I2R16Raw (a : Fin 6) : Ball := residualBall (below (shape 3 3 2)) B3_3_2Law (stageBPriority (shape 3 3 2)) 2 (fun u => B3_3_2Little u ((stageBPriority (shape 3 3 2)) 2)) 16 a +lemma CB3_3_2I2R16Raw_sound (a : Fin 6) : + (CB3_3_2I2R16Raw a).Encloses (CB3_3_2I2R16Value a) := by + exact residualBall_sound_on (below (shape 3 3 2)) B3_3_2Law (fun u => (stageBLaw (shape 3 3 2) u : ℝ)) (stageBPriority (shape 3 3 2)) 2 (fun u => B3_3_2Little u ((stageBPriority (shape 3 3 2)) 2)) (fun u a => (littleLaw (shape 3 3 2) u ((stageBPriority (shape 3 3 2)) 2) a : ℝ)) (fun u _ => B3_3_2Law_sound u) (fun u _ a => B3_3_2Little_sound u ((stageBPriority (shape 3 3 2)) 2) a) 16 a +def CB3_3_2I2R16Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB3_3_2I2R16Certificates_valid : + CB3_3_2I2R16Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB3_3_2I2R16CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB3_3_2I2R16P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_3_2I2R16Certificates (CB3_3_2I2R16CertificateIndex a)).input +lemma CB3_3_2I2R16P_check : ∀ a : Fin 6, contains (CB3_3_2I2R16Raw a) (CB3_3_2I2R16P a) = true := by + decide +kernel +lemma CB3_3_2I2R16P_sound (a : Fin 6) : + (CB3_3_2I2R16P a).Encloses (CB3_3_2I2R16Value a) := + contains_sound (CB3_3_2I2R16Raw_sound a) (CB3_3_2I2R16P_check a) +def CB3_3_2I2R16Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_3_2I2R16Certificates (CB3_3_2I2R16CertificateIndex a)).output +lemma CB3_3_2I2R16Terms_sound (a : Fin 6) : + (CB3_3_2I2R16Terms a).Encloses (Foundation.entropyTerm (CB3_3_2I2R16Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB3_3_2I2R16Certificates_valid + (CB3_3_2I2R16CertificateIndex a) (CB3_3_2I2R16P_sound a) +def CB3_3_2I2R16Entropy : Ball := ⟨0, 0⟩ +lemma CB3_3_2I2R16Entropy_sound : CB3_3_2I2R16Entropy.Encloses (Foundation.finiteEntropy CB3_3_2I2R16Value) := by + exact contains_sound (entropyFin_enclosed 6 CB3_3_2I2R16Value CB3_3_2I2R16Terms CB3_3_2I2R16Terms_sound) (by decide +kernel) +def CB3_3_2I2R16Mass : Ball := ⟨0, 0⟩ +lemma CB3_3_2I2R16Mass_sound : CB3_3_2I2R16Mass.Encloses (∑ a, CB3_3_2I2R16Value a) := by + exact contains_sound (finSumBall_sound 6 CB3_3_2I2R16P CB3_3_2I2R16Value CB3_3_2I2R16P_sound) (by decide +kernel) +def CB3_3_2I2R16MassTerm : Ball := .exact 0 +lemma CB3_3_2I2R16MassTerm_sound : CB3_3_2I2R16MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB3_3_2I2R16Value a))) := + entropyTerm_zero_ball (CB3_3_2I2R16Mass_sound) +def CB3_3_2I2R16H : Ball := ⟨0, 0⟩ +lemma CB3_3_2I2R16H_sound : CB3_3_2I2R16H.Encloses (homogeneousEntropy CB3_3_2I2R16Value) := by + exact contains_sound (homogeneous_enclosed CB3_3_2I2R16Value CB3_3_2I2R16MassTerm_sound CB3_3_2I2R16Entropy_sound) (by decide +kernel) +def CB3_3_2I2ResidualEntropies (a : Fin 17) : Ball := + match a.val with + | 0 => CB3_3_2I2R0H + | 1 => CB3_3_2I2R1H + | 2 => CB3_3_2I2R2H + | 3 => CB3_3_2I2R3H + | 4 => CB3_3_2I2R4H + | 5 => CB3_3_2I2R5H + | 6 => CB3_3_2I2R6H + | 7 => CB3_3_2I2R7H + | 8 => CB3_3_2I2R8H + | 9 => CB3_3_2I2R9H + | 10 => CB3_3_2I2R10H + | 11 => CB3_3_2I2R11H + | 12 => CB3_3_2I2R12H + | 13 => CB3_3_2I2R13H + | 14 => CB3_3_2I2R14H + | 15 => CB3_3_2I2R15H + | 16 => CB3_3_2I2R16H + | _ => (.exact 0) +lemma CB3_3_2I2ResidualEntropies_sound (k : Fin 17) : + (CB3_3_2I2ResidualEntropies k).Encloses (homogeneousEntropy + (residualLaw (below (shape 3 3 2)) (fun u => (stageBLaw (shape 3 3 2) u : ℝ)) (stageBPriority (shape 3 3 2)) 2 (fun u a => (littleLaw (shape 3 3 2) u ((stageBPriority (shape 3 3 2)) 2) a : ℝ)) k)) := by + fin_cases k + · exact CB3_3_2I2R0H_sound + · exact CB3_3_2I2R1H_sound + · exact CB3_3_2I2R2H_sound + · exact CB3_3_2I2R3H_sound + · exact CB3_3_2I2R4H_sound + · exact CB3_3_2I2R5H_sound + · exact CB3_3_2I2R6H_sound + · exact CB3_3_2I2R7H_sound + · exact CB3_3_2I2R8H_sound + · exact CB3_3_2I2R9H_sound + · exact CB3_3_2I2R10H_sound + · exact CB3_3_2I2R11H_sound + · exact CB3_3_2I2R12H_sound + · exact CB3_3_2I2R13H_sound + · exact CB3_3_2I2R14H_sound + · exact CB3_3_2I2R15H_sound + · exact CB3_3_2I2R16H_sound +def CB3_3_2I2S0_2_2Value (a : Fin 6) : ℝ := (littleLaw (shape 3 3 2) (shape 0 2 2) ((stageBPriority (shape 3 3 2)) 2) a : ℝ) +def CB3_3_2I2S0_2_2E_2LogWitness : LogWitness := ⟨-1, 447843, 250000⟩ +def CB3_3_2I2S0_2_2E_2Log : Ball := ⟨(-1101653738564778545821473882577 / 10000000000000000000000000000000), (21175823683 / 50000000000000000000000000000000)⟩ +lemma CB3_3_2I2S0_2_2E_2Log_sound : CB3_3_2I2S0_2_2E_2Log.Encloses (Real.log (CB3_3_2I2S0_2_2Value (2 : Fin 6))) := by + exact checkLog_sound logTwoBall_sound ((B3_3_2Little_sound (shape 0 2 2) ((stageBPriority (shape 3 3 2)) 2)) (2 : Fin 6)) (w := CB3_3_2I2S0_2_2E_2LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB3_3_2I2S0_2_2E_2 : Ball := ⟨(9867358304801322365926526559899 / 100000000000000000000000000000000), (4741722203 / 12500000000000000000000000000000)⟩ +lemma CB3_3_2I2S0_2_2E_2_sound : CB3_3_2I2S0_2_2E_2.Encloses (Foundation.entropyTerm (CB3_3_2I2S0_2_2Value (2 : Fin 6))) := by + exact contains_sound (entropyTerm_ball ((B3_3_2Little_sound (shape 0 2 2) ((stageBPriority (shape 3 3 2)) 2)) (2 : Fin 6)) CB3_3_2I2S0_2_2E_2Log_sound) (by decide +kernel) +def CB3_3_2I2S0_2_2E_3LogWitness : LogWitness := ⟨-4, 52157, 31250⟩ +def CB3_3_2I2S0_2_2E_3Log : Ball := ⟨(-226034969779528798511424963779123 / 100000000000000000000000000000000), (52939559207 / 50000000000000000000000000000000)⟩ +lemma CB3_3_2I2S0_2_2E_3Log_sound : CB3_3_2I2S0_2_2E_3Log.Encloses (Real.log (CB3_3_2I2S0_2_2Value (3 : Fin 6))) := by + exact checkLog_sound logTwoBall_sound ((B3_3_2Little_sound (shape 0 2 2) ((stageBPriority (shape 3 3 2)) 2)) (3 : Fin 6)) (w := CB3_3_2I2S0_2_2E_3LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB3_3_2I2S0_2_2E_3 : Ball := ⟨(4715722367516353417584156734331 / 20000000000000000000000000000000), (11044674359 / 100000000000000000000000000000000)⟩ +lemma CB3_3_2I2S0_2_2E_3_sound : CB3_3_2I2S0_2_2E_3.Encloses (Foundation.entropyTerm (CB3_3_2I2S0_2_2Value (3 : Fin 6))) := by + exact contains_sound (entropyTerm_ball ((B3_3_2Little_sound (shape 0 2 2) ((stageBPriority (shape 3 3 2)) 2)) (3 : Fin 6)) CB3_3_2I2S0_2_2E_3Log_sound) (by decide +kernel) +def CB3_3_2I2S0_2_2Terms (a : Fin 6) : Ball := + match a.val with + | 2 => ⟨(9867358304801322365926526559899 / 100000000000000000000000000000000), (4741722203 / 12500000000000000000000000000000)⟩ + | 3 => ⟨(4715722367516353417584156734331 / 20000000000000000000000000000000), (11044674359 / 100000000000000000000000000000000)⟩ + | _ => (.exact 0) +lemma CB3_3_2I2S0_2_2Terms_sound (a : Fin 6) : + (CB3_3_2I2S0_2_2Terms a).Encloses (Foundation.entropyTerm (CB3_3_2I2S0_2_2Value a)) := by + fin_cases a + · exact (entropyTerm_zero_ball ((B3_3_2Little_sound (shape 0 2 2) ((stageBPriority (shape 3 3 2)) 2)) (0 : Fin 6))) + · exact (entropyTerm_zero_ball ((B3_3_2Little_sound (shape 0 2 2) ((stageBPriority (shape 3 3 2)) 2)) (1 : Fin 6))) + · exact CB3_3_2I2S0_2_2E_2_sound + · exact CB3_3_2I2S0_2_2E_3_sound + · exact (entropyTerm_zero_ball ((B3_3_2Little_sound (shape 0 2 2) ((stageBPriority (shape 3 3 2)) 2)) (4 : Fin 6))) + · exact (entropyTerm_zero_ball ((B3_3_2Little_sound (shape 0 2 2) ((stageBPriority (shape 3 3 2)) 2)) (5 : Fin 6))) +def CB3_3_2I2S0_2_2Entropy : Ball := ⟨(16722985071191544726923655115777 / 50000000000000000000000000000000), (48978451983 / 100000000000000000000000000000000)⟩ +lemma CB3_3_2I2S0_2_2Entropy_sound : CB3_3_2I2S0_2_2Entropy.Encloses (Foundation.finiteEntropy CB3_3_2I2S0_2_2Value) := by + exact contains_sound (entropyFin_enclosed 6 CB3_3_2I2S0_2_2Value CB3_3_2I2S0_2_2Terms CB3_3_2I2S0_2_2Terms_sound) (by decide +kernel) +def CB3_3_2I2S0_2_2Mass : Ball := ⟨1, 0⟩ +lemma CB3_3_2I2S0_2_2Mass_sound : CB3_3_2I2S0_2_2Mass.Encloses (∑ a, CB3_3_2I2S0_2_2Value a) := by + exact contains_sound (finSumBall_sound 6 (B3_3_2Little (shape 0 2 2) ((stageBPriority (shape 3 3 2)) 2)) CB3_3_2I2S0_2_2Value (B3_3_2Little_sound (shape 0 2 2) ((stageBPriority (shape 3 3 2)) 2))) (by decide +kernel) +def CB3_3_2I2S0_2_2MassTermLog : Ball := .exact 0 +lemma CB3_3_2I2S0_2_2MassTermLog_sound : CB3_3_2I2S0_2_2MassTermLog.Encloses (Real.log ((∑ a, CB3_3_2I2S0_2_2Value a))) := by + exact log_exact_one_ball (CB3_3_2I2S0_2_2Mass_sound) +def CB3_3_2I2S0_2_2MassTerm : Ball := ⟨0, 0⟩ +lemma CB3_3_2I2S0_2_2MassTerm_sound : CB3_3_2I2S0_2_2MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB3_3_2I2S0_2_2Value a))) := by + exact contains_sound (entropyTerm_ball (CB3_3_2I2S0_2_2Mass_sound) CB3_3_2I2S0_2_2MassTermLog_sound) (by decide +kernel) +def CB3_3_2I2S0_2_2H : Ball := ⟨(16722985071191544726923655115777 / 50000000000000000000000000000000), (48978451983 / 100000000000000000000000000000000)⟩ +lemma CB3_3_2I2S0_2_2H_sound : CB3_3_2I2S0_2_2H.Encloses (homogeneousEntropy CB3_3_2I2S0_2_2Value) := by + exact contains_sound (homogeneous_enclosed CB3_3_2I2S0_2_2Value CB3_3_2I2S0_2_2MassTerm_sound CB3_3_2I2S0_2_2Entropy_sound) (by decide +kernel) +def CB3_3_2I2S0_3_1Value (a : Fin 6) : ℝ := (littleLaw (shape 3 3 2) (shape 0 3 1) ((stageBPriority (shape 3 3 2)) 2) a : ℝ) +def CB3_3_2I2S0_3_1E_4Log : Ball := .exact 0 +lemma CB3_3_2I2S0_3_1E_4Log_sound : CB3_3_2I2S0_3_1E_4Log.Encloses (Real.log (CB3_3_2I2S0_3_1Value (4 : Fin 6))) := by + exact log_exact_one_ball ((B3_3_2Little_sound (shape 0 3 1) ((stageBPriority (shape 3 3 2)) 2)) (4 : Fin 6)) +def CB3_3_2I2S0_3_1E_4 : Ball := ⟨0, 0⟩ +lemma CB3_3_2I2S0_3_1E_4_sound : CB3_3_2I2S0_3_1E_4.Encloses (Foundation.entropyTerm (CB3_3_2I2S0_3_1Value (4 : Fin 6))) := by + exact contains_sound (entropyTerm_ball ((B3_3_2Little_sound (shape 0 3 1) ((stageBPriority (shape 3 3 2)) 2)) (4 : Fin 6)) CB3_3_2I2S0_3_1E_4Log_sound) (by decide +kernel) +def CB3_3_2I2S0_3_1Terms (a : Fin 6) : Ball := + match a.val with + | 4 => ⟨0, 0⟩ + | _ => (.exact 0) +lemma CB3_3_2I2S0_3_1Terms_sound (a : Fin 6) : + (CB3_3_2I2S0_3_1Terms a).Encloses (Foundation.entropyTerm (CB3_3_2I2S0_3_1Value a)) := by + fin_cases a + · exact (entropyTerm_zero_ball ((B3_3_2Little_sound (shape 0 3 1) ((stageBPriority (shape 3 3 2)) 2)) (0 : Fin 6))) + · exact (entropyTerm_zero_ball ((B3_3_2Little_sound (shape 0 3 1) ((stageBPriority (shape 3 3 2)) 2)) (1 : Fin 6))) + · exact (entropyTerm_zero_ball ((B3_3_2Little_sound (shape 0 3 1) ((stageBPriority (shape 3 3 2)) 2)) (2 : Fin 6))) + · exact (entropyTerm_zero_ball ((B3_3_2Little_sound (shape 0 3 1) ((stageBPriority (shape 3 3 2)) 2)) (3 : Fin 6))) + · exact CB3_3_2I2S0_3_1E_4_sound + · exact (entropyTerm_zero_ball ((B3_3_2Little_sound (shape 0 3 1) ((stageBPriority (shape 3 3 2)) 2)) (5 : Fin 6))) +def CB3_3_2I2S0_3_1Entropy : Ball := ⟨0, 0⟩ +lemma CB3_3_2I2S0_3_1Entropy_sound : CB3_3_2I2S0_3_1Entropy.Encloses (Foundation.finiteEntropy CB3_3_2I2S0_3_1Value) := by + exact contains_sound (entropyFin_enclosed 6 CB3_3_2I2S0_3_1Value CB3_3_2I2S0_3_1Terms CB3_3_2I2S0_3_1Terms_sound) (by decide +kernel) +def CB3_3_2I2S0_3_1Mass : Ball := ⟨1, 0⟩ +lemma CB3_3_2I2S0_3_1Mass_sound : CB3_3_2I2S0_3_1Mass.Encloses (∑ a, CB3_3_2I2S0_3_1Value a) := by + exact contains_sound (finSumBall_sound 6 (B3_3_2Little (shape 0 3 1) ((stageBPriority (shape 3 3 2)) 2)) CB3_3_2I2S0_3_1Value (B3_3_2Little_sound (shape 0 3 1) ((stageBPriority (shape 3 3 2)) 2))) (by decide +kernel) +def CB3_3_2I2S0_3_1MassTermLog : Ball := .exact 0 +lemma CB3_3_2I2S0_3_1MassTermLog_sound : CB3_3_2I2S0_3_1MassTermLog.Encloses (Real.log ((∑ a, CB3_3_2I2S0_3_1Value a))) := by + exact log_exact_one_ball (CB3_3_2I2S0_3_1Mass_sound) +def CB3_3_2I2S0_3_1MassTerm : Ball := ⟨0, 0⟩ +lemma CB3_3_2I2S0_3_1MassTerm_sound : CB3_3_2I2S0_3_1MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB3_3_2I2S0_3_1Value a))) := by + exact contains_sound (entropyTerm_ball (CB3_3_2I2S0_3_1Mass_sound) CB3_3_2I2S0_3_1MassTermLog_sound) (by decide +kernel) +def CB3_3_2I2S0_3_1H : Ball := ⟨0, 0⟩ +lemma CB3_3_2I2S0_3_1H_sound : CB3_3_2I2S0_3_1H.Encloses (homogeneousEntropy CB3_3_2I2S0_3_1Value) := by + exact contains_sound (homogeneous_enclosed CB3_3_2I2S0_3_1Value CB3_3_2I2S0_3_1MassTerm_sound CB3_3_2I2S0_3_1Entropy_sound) (by decide +kernel) +def CB3_3_2I2S1_3_0Value (a : Fin 6) : ℝ := (littleLaw (shape 3 3 2) (shape 1 3 0) ((stageBPriority (shape 3 3 2)) 2) a : ℝ) +def CB3_3_2I2S1_3_0E_4Log : Ball := .exact 0 +lemma CB3_3_2I2S1_3_0E_4Log_sound : CB3_3_2I2S1_3_0E_4Log.Encloses (Real.log (CB3_3_2I2S1_3_0Value (4 : Fin 6))) := by + exact log_exact_one_ball ((B3_3_2Little_sound (shape 1 3 0) ((stageBPriority (shape 3 3 2)) 2)) (4 : Fin 6)) +def CB3_3_2I2S1_3_0E_4 : Ball := ⟨0, 0⟩ +lemma CB3_3_2I2S1_3_0E_4_sound : CB3_3_2I2S1_3_0E_4.Encloses (Foundation.entropyTerm (CB3_3_2I2S1_3_0Value (4 : Fin 6))) := by + exact contains_sound (entropyTerm_ball ((B3_3_2Little_sound (shape 1 3 0) ((stageBPriority (shape 3 3 2)) 2)) (4 : Fin 6)) CB3_3_2I2S1_3_0E_4Log_sound) (by decide +kernel) +def CB3_3_2I2S1_3_0Terms (a : Fin 6) : Ball := + match a.val with + | 4 => ⟨0, 0⟩ + | _ => (.exact 0) +lemma CB3_3_2I2S1_3_0Terms_sound (a : Fin 6) : + (CB3_3_2I2S1_3_0Terms a).Encloses (Foundation.entropyTerm (CB3_3_2I2S1_3_0Value a)) := by + fin_cases a + · exact (entropyTerm_zero_ball ((B3_3_2Little_sound (shape 1 3 0) ((stageBPriority (shape 3 3 2)) 2)) (0 : Fin 6))) + · exact (entropyTerm_zero_ball ((B3_3_2Little_sound (shape 1 3 0) ((stageBPriority (shape 3 3 2)) 2)) (1 : Fin 6))) + · exact (entropyTerm_zero_ball ((B3_3_2Little_sound (shape 1 3 0) ((stageBPriority (shape 3 3 2)) 2)) (2 : Fin 6))) + · exact (entropyTerm_zero_ball ((B3_3_2Little_sound (shape 1 3 0) ((stageBPriority (shape 3 3 2)) 2)) (3 : Fin 6))) + · exact CB3_3_2I2S1_3_0E_4_sound + · exact (entropyTerm_zero_ball ((B3_3_2Little_sound (shape 1 3 0) ((stageBPriority (shape 3 3 2)) 2)) (5 : Fin 6))) +def CB3_3_2I2S1_3_0Entropy : Ball := ⟨0, 0⟩ +lemma CB3_3_2I2S1_3_0Entropy_sound : CB3_3_2I2S1_3_0Entropy.Encloses (Foundation.finiteEntropy CB3_3_2I2S1_3_0Value) := by + exact contains_sound (entropyFin_enclosed 6 CB3_3_2I2S1_3_0Value CB3_3_2I2S1_3_0Terms CB3_3_2I2S1_3_0Terms_sound) (by decide +kernel) +def CB3_3_2I2S1_3_0Mass : Ball := ⟨1, 0⟩ +lemma CB3_3_2I2S1_3_0Mass_sound : CB3_3_2I2S1_3_0Mass.Encloses (∑ a, CB3_3_2I2S1_3_0Value a) := by + exact contains_sound (finSumBall_sound 6 (B3_3_2Little (shape 1 3 0) ((stageBPriority (shape 3 3 2)) 2)) CB3_3_2I2S1_3_0Value (B3_3_2Little_sound (shape 1 3 0) ((stageBPriority (shape 3 3 2)) 2))) (by decide +kernel) +def CB3_3_2I2S1_3_0MassTermLog : Ball := .exact 0 +lemma CB3_3_2I2S1_3_0MassTermLog_sound : CB3_3_2I2S1_3_0MassTermLog.Encloses (Real.log ((∑ a, CB3_3_2I2S1_3_0Value a))) := by + exact log_exact_one_ball (CB3_3_2I2S1_3_0Mass_sound) +def CB3_3_2I2S1_3_0MassTerm : Ball := ⟨0, 0⟩ +lemma CB3_3_2I2S1_3_0MassTerm_sound : CB3_3_2I2S1_3_0MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB3_3_2I2S1_3_0Value a))) := by + exact contains_sound (entropyTerm_ball (CB3_3_2I2S1_3_0Mass_sound) CB3_3_2I2S1_3_0MassTermLog_sound) (by decide +kernel) +def CB3_3_2I2S1_3_0H : Ball := ⟨0, 0⟩ +lemma CB3_3_2I2S1_3_0H_sound : CB3_3_2I2S1_3_0H.Encloses (homogeneousEntropy CB3_3_2I2S1_3_0Value) := by + exact contains_sound (homogeneous_enclosed CB3_3_2I2S1_3_0Value CB3_3_2I2S1_3_0MassTerm_sound CB3_3_2I2S1_3_0Entropy_sound) (by decide +kernel) +def CB3_3_2I2S2_2_0Value (a : Fin 6) : ℝ := (littleLaw (shape 3 3 2) (shape 2 2 0) ((stageBPriority (shape 3 3 2)) 2) a : ℝ) +def CB3_3_2I2S2_2_0E_2LogWitness : LogWitness := ⟨-1, 222483, 125000⟩ +def CB3_3_2I2S2_2_0E_2Log : Ball := ⟨(-5830511183465280787305887930417 / 50000000000000000000000000000000), (8470329473 / 20000000000000000000000000000000)⟩ +lemma CB3_3_2I2S2_2_0E_2Log_sound : CB3_3_2I2S2_2_0E_2Log.Encloses (Real.log (CB3_3_2I2S2_2_0Value (2 : Fin 6))) := by + exact checkLog_sound logTwoBall_sound ((B3_3_2Little_sound (shape 2 2 0) ((stageBPriority (shape 3 3 2)) 2)) (2 : Fin 6)) (w := CB3_3_2I2S2_2_0E_2LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB3_3_2I2S2_2_0E_2 : Ball := ⟨(1297189619630906065402175864423 / 12500000000000000000000000000000), (9422521561 / 25000000000000000000000000000000)⟩ +lemma CB3_3_2I2S2_2_0E_2_sound : CB3_3_2I2S2_2_0E_2.Encloses (Foundation.entropyTerm (CB3_3_2I2S2_2_0Value (2 : Fin 6))) := by + exact contains_sound (entropyTerm_ball ((B3_3_2Little_sound (shape 2 2 0) ((stageBPriority (shape 3 3 2)) 2)) (2 : Fin 6)) CB3_3_2I2S2_2_0E_2Log_sound) (by decide +kernel) +def CB3_3_2I2S2_2_0E_3LogWitness : LogWitness := ⟨-4, 27517, 15625⟩ +def CB3_3_2I2S2_2_0E_3Log : Ball := ⟨(-220665692236720985729493316733689 / 100000000000000000000000000000000), (21175823683 / 20000000000000000000000000000000)⟩ +lemma CB3_3_2I2S2_2_0E_3Log_sound : CB3_3_2I2S2_2_0E_3Log.Encloses (Real.log (CB3_3_2I2S2_2_0Value (3 : Fin 6))) := by + exact checkLog_sound logTwoBall_sound ((B3_3_2Little_sound (shape 2 2 0) ((stageBPriority (shape 3 3 2)) 2)) (3 : Fin 6)) (w := CB3_3_2I2S2_2_0E_3LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB3_3_2I2S2_2_0E_3 : Ball := ⟨(6072057853277851364318467596561 / 25000000000000000000000000000000), (11653902807 / 100000000000000000000000000000000)⟩ +lemma CB3_3_2I2S2_2_0E_3_sound : CB3_3_2I2S2_2_0E_3.Encloses (Foundation.entropyTerm (CB3_3_2I2S2_2_0Value (3 : Fin 6))) := by + exact contains_sound (entropyTerm_ball ((B3_3_2Little_sound (shape 2 2 0) ((stageBPriority (shape 3 3 2)) 2)) (3 : Fin 6)) CB3_3_2I2S2_2_0E_3Log_sound) (by decide +kernel) +def CB3_3_2I2S2_2_0Terms (a : Fin 6) : Ball := + match a.val with + | 2 => ⟨(1297189619630906065402175864423 / 12500000000000000000000000000000), (9422521561 / 25000000000000000000000000000000)⟩ + | 3 => ⟨(6072057853277851364318467596561 / 25000000000000000000000000000000), (11653902807 / 100000000000000000000000000000000)⟩ + | _ => (.exact 0) +lemma CB3_3_2I2S2_2_0Terms_sound (a : Fin 6) : + (CB3_3_2I2S2_2_0Terms a).Encloses (Foundation.entropyTerm (CB3_3_2I2S2_2_0Value a)) := by + fin_cases a + · exact (entropyTerm_zero_ball ((B3_3_2Little_sound (shape 2 2 0) ((stageBPriority (shape 3 3 2)) 2)) (0 : Fin 6))) + · exact (entropyTerm_zero_ball ((B3_3_2Little_sound (shape 2 2 0) ((stageBPriority (shape 3 3 2)) 2)) (1 : Fin 6))) + · exact CB3_3_2I2S2_2_0E_2_sound + · exact CB3_3_2I2S2_2_0E_3_sound + · exact (entropyTerm_zero_ball ((B3_3_2Little_sound (shape 2 2 0) ((stageBPriority (shape 3 3 2)) 2)) (4 : Fin 6))) + · exact (entropyTerm_zero_ball ((B3_3_2Little_sound (shape 2 2 0) ((stageBPriority (shape 3 3 2)) 2)) (5 : Fin 6))) +def CB3_3_2I2S2_2_0Entropy : Ball := ⟨(8666437092539663495122819325407 / 25000000000000000000000000000000), (49343989051 / 100000000000000000000000000000000)⟩ +lemma CB3_3_2I2S2_2_0Entropy_sound : CB3_3_2I2S2_2_0Entropy.Encloses (Foundation.finiteEntropy CB3_3_2I2S2_2_0Value) := by + exact contains_sound (entropyFin_enclosed 6 CB3_3_2I2S2_2_0Value CB3_3_2I2S2_2_0Terms CB3_3_2I2S2_2_0Terms_sound) (by decide +kernel) +def CB3_3_2I2S2_2_0Mass : Ball := ⟨1, 0⟩ +lemma CB3_3_2I2S2_2_0Mass_sound : CB3_3_2I2S2_2_0Mass.Encloses (∑ a, CB3_3_2I2S2_2_0Value a) := by + exact contains_sound (finSumBall_sound 6 (B3_3_2Little (shape 2 2 0) ((stageBPriority (shape 3 3 2)) 2)) CB3_3_2I2S2_2_0Value (B3_3_2Little_sound (shape 2 2 0) ((stageBPriority (shape 3 3 2)) 2))) (by decide +kernel) +def CB3_3_2I2S2_2_0MassTermLog : Ball := .exact 0 +lemma CB3_3_2I2S2_2_0MassTermLog_sound : CB3_3_2I2S2_2_0MassTermLog.Encloses (Real.log ((∑ a, CB3_3_2I2S2_2_0Value a))) := by + exact log_exact_one_ball (CB3_3_2I2S2_2_0Mass_sound) +def CB3_3_2I2S2_2_0MassTerm : Ball := ⟨0, 0⟩ +lemma CB3_3_2I2S2_2_0MassTerm_sound : CB3_3_2I2S2_2_0MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB3_3_2I2S2_2_0Value a))) := by + exact contains_sound (entropyTerm_ball (CB3_3_2I2S2_2_0Mass_sound) CB3_3_2I2S2_2_0MassTermLog_sound) (by decide +kernel) +def CB3_3_2I2S2_2_0H : Ball := ⟨(8666437092539663495122819325407 / 25000000000000000000000000000000), (49343989051 / 100000000000000000000000000000000)⟩ +lemma CB3_3_2I2S2_2_0H_sound : CB3_3_2I2S2_2_0H.Encloses (homogeneousEntropy CB3_3_2I2S2_2_0Value) := by + exact contains_sound (homogeneous_enclosed CB3_3_2I2S2_2_0Value CB3_3_2I2S2_2_0MassTerm_sound CB3_3_2I2S2_2_0Entropy_sound) (by decide +kernel) +def CB3_3_2I2S3_1_0Value (a : Fin 6) : ℝ := (littleLaw (shape 3 3 2) (shape 3 1 0) ((stageBPriority (shape 3 3 2)) 2) a : ℝ) +def CB3_3_2I2S3_1_0E_1Log : Ball := .exact 0 +lemma CB3_3_2I2S3_1_0E_1Log_sound : CB3_3_2I2S3_1_0E_1Log.Encloses (Real.log (CB3_3_2I2S3_1_0Value (1 : Fin 6))) := by + exact log_exact_one_ball ((B3_3_2Little_sound (shape 3 1 0) ((stageBPriority (shape 3 3 2)) 2)) (1 : Fin 6)) +def CB3_3_2I2S3_1_0E_1 : Ball := ⟨0, 0⟩ +lemma CB3_3_2I2S3_1_0E_1_sound : CB3_3_2I2S3_1_0E_1.Encloses (Foundation.entropyTerm (CB3_3_2I2S3_1_0Value (1 : Fin 6))) := by + exact contains_sound (entropyTerm_ball ((B3_3_2Little_sound (shape 3 1 0) ((stageBPriority (shape 3 3 2)) 2)) (1 : Fin 6)) CB3_3_2I2S3_1_0E_1Log_sound) (by decide +kernel) +def CB3_3_2I2S3_1_0Terms (a : Fin 6) : Ball := + match a.val with + | 1 => ⟨0, 0⟩ + | _ => (.exact 0) +lemma CB3_3_2I2S3_1_0Terms_sound (a : Fin 6) : + (CB3_3_2I2S3_1_0Terms a).Encloses (Foundation.entropyTerm (CB3_3_2I2S3_1_0Value a)) := by + fin_cases a + · exact (entropyTerm_zero_ball ((B3_3_2Little_sound (shape 3 1 0) ((stageBPriority (shape 3 3 2)) 2)) (0 : Fin 6))) + · exact CB3_3_2I2S3_1_0E_1_sound + · exact (entropyTerm_zero_ball ((B3_3_2Little_sound (shape 3 1 0) ((stageBPriority (shape 3 3 2)) 2)) (2 : Fin 6))) + · exact (entropyTerm_zero_ball ((B3_3_2Little_sound (shape 3 1 0) ((stageBPriority (shape 3 3 2)) 2)) (3 : Fin 6))) + · exact (entropyTerm_zero_ball ((B3_3_2Little_sound (shape 3 1 0) ((stageBPriority (shape 3 3 2)) 2)) (4 : Fin 6))) + · exact (entropyTerm_zero_ball ((B3_3_2Little_sound (shape 3 1 0) ((stageBPriority (shape 3 3 2)) 2)) (5 : Fin 6))) +def CB3_3_2I2S3_1_0Entropy : Ball := ⟨0, 0⟩ +lemma CB3_3_2I2S3_1_0Entropy_sound : CB3_3_2I2S3_1_0Entropy.Encloses (Foundation.finiteEntropy CB3_3_2I2S3_1_0Value) := by + exact contains_sound (entropyFin_enclosed 6 CB3_3_2I2S3_1_0Value CB3_3_2I2S3_1_0Terms CB3_3_2I2S3_1_0Terms_sound) (by decide +kernel) +def CB3_3_2I2S3_1_0Mass : Ball := ⟨1, 0⟩ +lemma CB3_3_2I2S3_1_0Mass_sound : CB3_3_2I2S3_1_0Mass.Encloses (∑ a, CB3_3_2I2S3_1_0Value a) := by + exact contains_sound (finSumBall_sound 6 (B3_3_2Little (shape 3 1 0) ((stageBPriority (shape 3 3 2)) 2)) CB3_3_2I2S3_1_0Value (B3_3_2Little_sound (shape 3 1 0) ((stageBPriority (shape 3 3 2)) 2))) (by decide +kernel) +def CB3_3_2I2S3_1_0MassTermLog : Ball := .exact 0 +lemma CB3_3_2I2S3_1_0MassTermLog_sound : CB3_3_2I2S3_1_0MassTermLog.Encloses (Real.log ((∑ a, CB3_3_2I2S3_1_0Value a))) := by + exact log_exact_one_ball (CB3_3_2I2S3_1_0Mass_sound) +def CB3_3_2I2S3_1_0MassTerm : Ball := ⟨0, 0⟩ +lemma CB3_3_2I2S3_1_0MassTerm_sound : CB3_3_2I2S3_1_0MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB3_3_2I2S3_1_0Value a))) := by + exact contains_sound (entropyTerm_ball (CB3_3_2I2S3_1_0Mass_sound) CB3_3_2I2S3_1_0MassTermLog_sound) (by decide +kernel) +def CB3_3_2I2S3_1_0H : Ball := ⟨0, 0⟩ +lemma CB3_3_2I2S3_1_0H_sound : CB3_3_2I2S3_1_0H.Encloses (homogeneousEntropy CB3_3_2I2S3_1_0Value) := by + exact contains_sound (homogeneous_enclosed CB3_3_2I2S3_1_0Value CB3_3_2I2S3_1_0MassTerm_sound CB3_3_2I2S3_1_0Entropy_sound) (by decide +kernel) +def CB3_3_2I2Singles (s : Shape) : Ball := + match s 0, s 1, s 2 with + | 0, 2, 2 => CB3_3_2I2S0_2_2H + | 0, 3, 1 => CB3_3_2I2S0_3_1H + | 1, 3, 0 => CB3_3_2I2S1_3_0H + | 2, 2, 0 => CB3_3_2I2S2_2_0H + | 3, 1, 0 => CB3_3_2I2S3_1_0H + | _, _, _ => (.exact 0) +lemma CB3_3_2I2Singles_sound (u : Shape) (hu : u ∈ below (shape 3 3 2)) + (hd : designated (stageBPriority (shape 3 3 2)) 2 u) : + (CB3_3_2I2Singles u).Encloses (homogeneousEntropy ((fun u a => (littleLaw (shape 3 3 2) u ((stageBPriority (shape 3 3 2)) 2) a : ℝ)) u)) := by + rw [B3_3_2_below] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl + · exact CB3_3_2I2S0_2_2H_sound + · exact CB3_3_2I2S0_3_1H_sound + · exact (show ¬ designated (stageBPriority (shape 3 3 2)) 2 (shape 1 1 2) by decide +kernel) hd |>.elim + · exact (show ¬ designated (stageBPriority (shape 3 3 2)) 2 (shape 1 2 1) by decide +kernel) hd |>.elim + · exact CB3_3_2I2S1_3_0H_sound + · exact (show ¬ designated (stageBPriority (shape 3 3 2)) 2 (shape 2 0 2) by decide +kernel) hd |>.elim + · exact (show ¬ designated (stageBPriority (shape 3 3 2)) 2 (shape 2 1 1) by decide +kernel) hd |>.elim + · exact CB3_3_2I2S2_2_0H_sound + · exact (show ¬ designated (stageBPriority (shape 3 3 2)) 2 (shape 3 0 1) by decide +kernel) hd |>.elim + · exact CB3_3_2I2S3_1_0H_sound +def CB3_3_2I2Singleton : Ball := ⟨(1198766343829539023294750780397 / 20000000000000000000000000000000), (4273832203 / 50000000000000000000000000000000)⟩ +lemma CB3_3_2I2Singleton_sound : CB3_3_2I2Singleton.Encloses + (singletonEntropy (below (shape 3 3 2)) (fun u => (stageBLaw (shape 3 3 2) u : ℝ)) (stageBPriority (shape 3 3 2)) 2 (fun u a => (littleLaw (shape 3 3 2) u ((stageBPriority (shape 3 3 2)) 2) a : ℝ))) := by + exact contains_sound (singletonBall_sound (below (shape 3 3 2)) B3_3_2Law (fun u => (stageBLaw (shape 3 3 2) u : ℝ)) (stageBPriority (shape 3 3 2)) 2 + CB3_3_2I2Singles (fun u a => (littleLaw (shape 3 3 2) u ((stageBPriority (shape 3 3 2)) 2) a : ℝ)) (fun u _ => B3_3_2Law_sound u) CB3_3_2I2Singles_sound) (by decide +kernel) +def CB3_3_2I2Group : Ball := ⟨(6960039161707916052594951406449 / 100000000000000000000000000000000), (4539379237 / 4000000000000000000000000000000)⟩ +lemma CB3_3_2I2Group_sound : CB3_3_2I2Group.Encloses + (groupedEntropy (below (shape 3 3 2)) (fun u => (stageBLaw (shape 3 3 2) u : ℝ)) (stageBPriority (shape 3 3 2)) 2 (fun u a => (littleLaw (shape 3 3 2) u ((stageBPriority (shape 3 3 2)) 2) a : ℝ))) := by + exact contains_sound (Ball.add_sound CB3_3_2I2Singleton_sound + (finSumBall_sound 17 CB3_3_2I2ResidualEntropies _ CB3_3_2I2ResidualEntropies_sound)) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CB3_3_2I2H : Ball := ⟨(21154097213388526672622109904423 / 25000000000000000000000000000000), (317946587787 / 100000000000000000000000000000000)⟩ +lemma CB3_3_2I2_sound : CB3_3_2I2H.Encloses (stageBCapacity (shape 3 3 2) 2) := by + have hb := contains_sound (Ball.add_sound CB3_3_2I2PairH_sound + (Ball.neg_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) CB3_3_2I2Group_sound))) + (show contains (.add CB3_3_2I2PairH (.neg (.mul (.exact 2) CB3_3_2I2Group))) CB3_3_2I2H = true by decide +kernel) + unfold CB3_3_2I2PairValue at hb + simpa only [stageBCapacity, nativeCapacity, + show (2 : Fin 3) ≠ 0 by decide, ite_false, sub_eq_add_neg] using hb + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/CapacityB/CapB3_4_1I0.lean b/lean/OAI/LinearAlgebra/MatrixFields/CapacityB/CapB3_4_1I0.lean new file mode 100644 index 0000000000000000000000000000000000000000..0e6320718e693692b783e7592dd963d061836961 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/CapacityB/CapB3_4_1I0.lean @@ -0,0 +1,72 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Certificates.Terminal3_4_1 + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CB3_4_1I0Value (a : Fin 17) : ℝ := marginal (below (shape 3 4 1)) (fun u => (stageBLaw (shape 3 4 1) u : ℝ)) ((stageBPriority (shape 3 4 1)) 0) a +def CB3_4_1I0Raw (a : Fin 17) : Ball := marginalBall (below (shape 3 4 1)) B3_4_1Law ((stageBPriority (shape 3 4 1)) 0) a +lemma CB3_4_1I0Raw_sound (a : Fin 17) : + (CB3_4_1I0Raw a).Encloses (CB3_4_1I0Value a) := by + exact marginalBall_sound (below (shape 3 4 1)) B3_4_1Law (fun u => (stageBLaw (shape 3 4 1) u : ℝ)) (fun u _ => B3_4_1Law_sound u) ((stageBPriority (shape 3 4 1)) 0) a +def CB3_4_1I0Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(1 / 2), (27 / 100000000000000000000000000000000)⟩ ⟨(6931471805599453094172319305033 / 20000000000000000000000000000000), (21175823729 / 100000000000000000000000000000000)⟩ ⟨(-6931471805599453094172319305033 / 10000000000000000000000000000000), (42351647419 / 100000000000000000000000000000000)⟩ ⟨-1, 1, 1⟩] +lemma CB3_4_1I0Certificates_valid : + CB3_4_1I0Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB3_4_1I0CertificateIndex (a : Fin 17) : ℕ := + match a.val with + | 1 => 1 + | 0 => 1 + | _ => 0 +def CB3_4_1I0P (a : Fin 17) : Ball := + (CompactCertificate.entropyLookup CB3_4_1I0Certificates (CB3_4_1I0CertificateIndex a)).input +lemma CB3_4_1I0P_check : ∀ a : Fin 17, contains (CB3_4_1I0Raw a) (CB3_4_1I0P a) = true := by + decide +kernel +lemma CB3_4_1I0P_sound (a : Fin 17) : + (CB3_4_1I0P a).Encloses (CB3_4_1I0Value a) := + contains_sound (CB3_4_1I0Raw_sound a) (CB3_4_1I0P_check a) +def CB3_4_1I0Terms (a : Fin 17) : Ball := + (CompactCertificate.entropyLookup CB3_4_1I0Certificates (CB3_4_1I0CertificateIndex a)).output +lemma CB3_4_1I0Terms_sound (a : Fin 17) : + (CB3_4_1I0Terms a).Encloses (Foundation.entropyTerm (CB3_4_1I0Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB3_4_1I0Certificates_valid + (CB3_4_1I0CertificateIndex a) (CB3_4_1I0P_sound a) +def CB3_4_1I0Entropy : Ball := ⟨(6931471805599453094172319305033 / 10000000000000000000000000000000), (21175823729 / 50000000000000000000000000000000)⟩ +lemma CB3_4_1I0Entropy_sound : CB3_4_1I0Entropy.Encloses (Foundation.finiteEntropy CB3_4_1I0Value) := by + exact contains_sound (entropyFin_enclosed 17 CB3_4_1I0Value CB3_4_1I0Terms CB3_4_1I0Terms_sound) (by decide +kernel) +def CB3_4_1I0Mass : Ball := ⟨1, (27 / 50000000000000000000000000000000)⟩ +lemma CB3_4_1I0Mass_sound : CB3_4_1I0Mass.Encloses (∑ a, CB3_4_1I0Value a) := by + exact contains_sound (finSumBall_sound 17 CB3_4_1I0P CB3_4_1I0Value CB3_4_1I0P_sound) (by decide +kernel) +def CB3_4_1I0MassTermLogWitness : LogWitness := ⟨0, 1, 1⟩ +def CB3_4_1I0MassTermLog : Ball := ⟨0, (2646977967 / 12500000000000000000000000000000)⟩ +lemma CB3_4_1I0MassTermLog_sound : CB3_4_1I0MassTermLog.Encloses (Real.log ((∑ a, CB3_4_1I0Value a))) := by + exact checkLog_sound logTwoBall_sound (CB3_4_1I0Mass_sound) (w := CB3_4_1I0MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB3_4_1I0MassTerm : Ball := ⟨0, (21175823737 / 100000000000000000000000000000000)⟩ +lemma CB3_4_1I0MassTerm_sound : CB3_4_1I0MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB3_4_1I0Value a))) := by + exact contains_sound (entropyTerm_ball (CB3_4_1I0Mass_sound) CB3_4_1I0MassTermLog_sound) (by decide +kernel) +def CB3_4_1I0H : Ball := ⟨(6931471805599453094172319305033 / 10000000000000000000000000000000), (12705494239 / 20000000000000000000000000000000)⟩ +lemma CB3_4_1I0H_sound : CB3_4_1I0H.Encloses (homogeneousEntropy CB3_4_1I0Value) := by + exact contains_sound (homogeneous_enclosed CB3_4_1I0Value CB3_4_1I0MassTerm_sound CB3_4_1I0Entropy_sound) (by decide +kernel) +lemma CB3_4_1I0_sound : CB3_4_1I0H.Encloses (stageBCapacity (shape 3 4 1) 0) := by + exact CB3_4_1I0H_sound + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/CapacityB/CapB3_4_1I1.lean b/lean/OAI/LinearAlgebra/MatrixFields/CapacityB/CapB3_4_1I1.lean new file mode 100644 index 0000000000000000000000000000000000000000..52032fc3f96e367b73bd08bb9b761f05fcedf5ed --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/CapacityB/CapB3_4_1I1.lean @@ -0,0 +1,889 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Certificates.Terminal3_4_1 + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CB3_4_1I1PairValue (a : PairSlot) : ℝ := pairLaw (below (shape 3 4 1)) (shape 3 4 1) (fun u => (stageBLaw (shape 3 4 1) u : ℝ)) (fun u a => (littleLaw (shape 3 4 1) u ((stageBPriority (shape 3 4 1)) 1) a : ℝ)) a +def CB3_4_1I1PairRaw (a : PairSlot) : Ball := pairLawBall (below (shape 3 4 1)) (shape 3 4 1) B3_4_1Law (fun u => B3_4_1Little u ((stageBPriority (shape 3 4 1)) 1)) a +lemma CB3_4_1I1PairRaw_sound (a : PairSlot) : + (CB3_4_1I1PairRaw a).Encloses (CB3_4_1I1PairValue a) := by + exact pairLawBall_sound_on (below (shape 3 4 1)) (shape 3 4 1) B3_4_1Law (fun u => (stageBLaw (shape 3 4 1) u : ℝ)) (fun u => B3_4_1Little u ((stageBPriority (shape 3 4 1)) 1)) (fun u a => (littleLaw (shape 3 4 1) u ((stageBPriority (shape 3 4 1)) 1) a : ℝ)) (fun u _ => B3_4_1Law_sound u) (fun u _ a => B3_4_1Little_sound u ((stageBPriority (shape 3 4 1)) 1) a) (fun u _ a => B3_4_1Little_sound (complement (shape 3 4 1) u) ((stageBPriority (shape 3 4 1)) 1) a) a +def CB3_4_1I1PairCertificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(82952079780722940626225466023 / 6250000000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ ⟨(1147279995329005976604244689539 / 20000000000000000000000000000000), (2248420661 / 100000000000000000000000000000000)⟩ ⟨(-17288294614820796241404340152637 / 4000000000000000000000000000000), (42351647479 / 25000000000000000000000000000000)⟩ ⟨-7, 82952079780722940626225466023, 48828125000000000000000000000⟩, + .log ⟨(44353533976166490223624096589007 / 100000000000000000000000000000000), (1 / 5000000000000000000000000000000)⟩ ⟨(18029219162022483790732983590417 / 50000000000000000000000000000000), (28176678493 / 100000000000000000000000000000000)⟩ ⟨(-16259555932305679112321862864337 / 20000000000000000000000000000000), (31763735547 / 50000000000000000000000000000000)⟩ ⟨-2, 44353533976166490223624096589007, 25000000000000000000000000000000⟩, + .log ⟨(34553861978735541810850367637 / 800000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ ⟨(212053568871460902457636479641 / 1562500000000000000000000000000), (219511947 / 4000000000000000000000000000000)⟩ ⟨(-78552310107190677134533302510819 / 25000000000000000000000000000000), (1985233471 / 1562500000000000000000000000000)⟩ ⟨-5, 34553861978735541810850367637, 25000000000000000000000000000⟩] +lemma CB3_4_1I1PairCertificates_valid : + CB3_4_1I1PairCertificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB3_4_1I1PairCertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 0, 4 => 1 + | 1, 2 => 2 + | 1, 3 => 3 + | 2, 1 => 2 + | 3, 1 => 3 + | 4, 0 => 1 + | _, _ => 0 +def CB3_4_1I1PairP (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CB3_4_1I1PairCertificates (CB3_4_1I1PairCertificateIndex a)).input +lemma CB3_4_1I1PairP_check : ∀ a : PairSlot, contains (CB3_4_1I1PairRaw a) (CB3_4_1I1PairP a) = true := by + decide +kernel +lemma CB3_4_1I1PairP_sound (a : PairSlot) : + (CB3_4_1I1PairP a).Encloses (CB3_4_1I1PairValue a) := + contains_sound (CB3_4_1I1PairRaw_sound a) (CB3_4_1I1PairP_check a) +def CB3_4_1I1PairTerms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CB3_4_1I1PairCertificates (CB3_4_1I1PairCertificateIndex a)).output +lemma CB3_4_1I1PairTerms_sound (a : PairSlot) : + (CB3_4_1I1PairTerms a).Encloses (Foundation.entropyTerm (CB3_4_1I1PairValue a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB3_4_1I1PairCertificates_valid + (CB3_4_1I1PairCertificateIndex a) (CB3_4_1I1PairP_sound a) +def CB3_4_1I1PairEntropy : Ball := ⟨(55366266708463495221775925325553 / 50000000000000000000000000000000), (35912897829 / 50000000000000000000000000000000)⟩ +lemma CB3_4_1I1PairEntropy_sound : CB3_4_1I1PairEntropy.Encloses (Foundation.finiteEntropy CB3_4_1I1PairValue) := by + exact contains_sound (entropyPair_enclosed CB3_4_1I1PairValue CB3_4_1I1PairTerms CB3_4_1I1PairTerms_sound) (by decide +kernel) +def CB3_4_1I1PairMass : Ball := ⟨1, (7 / 12500000000000000000000000000000)⟩ +lemma CB3_4_1I1PairMass_sound : CB3_4_1I1PairMass.Encloses (∑ a, CB3_4_1I1PairValue a) := by + exact contains_sound (pairSumBall_sound CB3_4_1I1PairP CB3_4_1I1PairValue CB3_4_1I1PairP_sound) (by decide +kernel) +def CB3_4_1I1PairMassTermLogWitness : LogWitness := ⟨0, 1, 1⟩ +def CB3_4_1I1PairMassTermLog : Ball := ⟨0, (10587911869 / 50000000000000000000000000000000)⟩ +lemma CB3_4_1I1PairMassTermLog_sound : CB3_4_1I1PairMassTermLog.Encloses (Real.log ((∑ a, CB3_4_1I1PairValue a))) := by + exact checkLog_sound logTwoBall_sound (CB3_4_1I1PairMass_sound) (w := CB3_4_1I1PairMassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB3_4_1I1PairMassTerm : Ball := ⟨0, (21175823739 / 100000000000000000000000000000000)⟩ +lemma CB3_4_1I1PairMassTerm_sound : CB3_4_1I1PairMassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB3_4_1I1PairValue a))) := by + exact contains_sound (entropyTerm_ball (CB3_4_1I1PairMass_sound) CB3_4_1I1PairMassTermLog_sound) (by decide +kernel) +def CB3_4_1I1PairH : Ball := ⟨(55366266708463495221775925325553 / 50000000000000000000000000000000), (93001619397 / 100000000000000000000000000000000)⟩ +lemma CB3_4_1I1PairH_sound : CB3_4_1I1PairH.Encloses (homogeneousEntropy CB3_4_1I1PairValue) := by + exact contains_sound (homogeneous_enclosed CB3_4_1I1PairValue CB3_4_1I1PairMassTerm_sound CB3_4_1I1PairEntropy_sound) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CB3_4_1I1R0Value (a : Fin 6) : ℝ := residualLaw (below (shape 3 4 1)) (fun u => (stageBLaw (shape 3 4 1) u : ℝ)) (stageBPriority (shape 3 4 1)) 1 (fun u a => (littleLaw (shape 3 4 1) u ((stageBPriority (shape 3 4 1)) 1) a : ℝ)) 0 a +def CB3_4_1I1R0Raw (a : Fin 6) : Ball := residualBall (below (shape 3 4 1)) B3_4_1Law (stageBPriority (shape 3 4 1)) 1 (fun u => B3_4_1Little u ((stageBPriority (shape 3 4 1)) 1)) 0 a +lemma CB3_4_1I1R0Raw_sound (a : Fin 6) : + (CB3_4_1I1R0Raw a).Encloses (CB3_4_1I1R0Value a) := by + exact residualBall_sound_on (below (shape 3 4 1)) B3_4_1Law (fun u => (stageBLaw (shape 3 4 1) u : ℝ)) (stageBPriority (shape 3 4 1)) 1 (fun u => B3_4_1Little u ((stageBPriority (shape 3 4 1)) 1)) (fun u a => (littleLaw (shape 3 4 1) u ((stageBPriority (shape 3 4 1)) 1) a : ℝ)) (fun u _ => B3_4_1Law_sound u) (fun u _ a => B3_4_1Little_sound u ((stageBPriority (shape 3 4 1)) 1) a) 0 a +def CB3_4_1I1R0Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(82952079780722940626225466023 / 6250000000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ ⟨(1147279995329005976604244689539 / 20000000000000000000000000000000), (2248420661 / 100000000000000000000000000000000)⟩ ⟨(-17288294614820796241404340152637 / 4000000000000000000000000000000), (42351647479 / 25000000000000000000000000000000)⟩ ⟨-7, 82952079780722940626225466023, 48828125000000000000000000000⟩] +lemma CB3_4_1I1R0Certificates_valid : + CB3_4_1I1R0Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB3_4_1I1R0CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | 0 => 1 + | _ => 0 +def CB3_4_1I1R0P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_4_1I1R0Certificates (CB3_4_1I1R0CertificateIndex a)).input +lemma CB3_4_1I1R0P_check : ∀ a : Fin 6, contains (CB3_4_1I1R0Raw a) (CB3_4_1I1R0P a) = true := by + decide +kernel +lemma CB3_4_1I1R0P_sound (a : Fin 6) : + (CB3_4_1I1R0P a).Encloses (CB3_4_1I1R0Value a) := + contains_sound (CB3_4_1I1R0Raw_sound a) (CB3_4_1I1R0P_check a) +def CB3_4_1I1R0Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_4_1I1R0Certificates (CB3_4_1I1R0CertificateIndex a)).output +lemma CB3_4_1I1R0Terms_sound (a : Fin 6) : + (CB3_4_1I1R0Terms a).Encloses (Foundation.entropyTerm (CB3_4_1I1R0Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB3_4_1I1R0Certificates_valid + (CB3_4_1I1R0CertificateIndex a) (CB3_4_1I1R0P_sound a) +def CB3_4_1I1R0Entropy : Ball := ⟨(1147279995329005976604244689539 / 20000000000000000000000000000000), (2248420661 / 100000000000000000000000000000000)⟩ +lemma CB3_4_1I1R0Entropy_sound : CB3_4_1I1R0Entropy.Encloses (Foundation.finiteEntropy CB3_4_1I1R0Value) := by + exact contains_sound (entropyFin_enclosed 6 CB3_4_1I1R0Value CB3_4_1I1R0Terms CB3_4_1I1R0Terms_sound) (by decide +kernel) +def CB3_4_1I1R0Mass : Ball := ⟨(82952079780722940626225466023 / 6250000000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ +lemma CB3_4_1I1R0Mass_sound : CB3_4_1I1R0Mass.Encloses (∑ a, CB3_4_1I1R0Value a) := by + exact contains_sound (finSumBall_sound 6 CB3_4_1I1R0P CB3_4_1I1R0Value CB3_4_1I1R0P_sound) (by decide +kernel) +def CB3_4_1I1R0MassTermLogWitness : LogWitness := ⟨-7, 82952079780722940626225466023, 48828125000000000000000000000⟩ +def CB3_4_1I1R0MassTermLog : Ball := ⟨(-17288294614820796241404340152637 / 4000000000000000000000000000000), (42351647479 / 25000000000000000000000000000000)⟩ +lemma CB3_4_1I1R0MassTermLog_sound : CB3_4_1I1R0MassTermLog.Encloses (Real.log ((∑ a, CB3_4_1I1R0Value a))) := by + exact checkLog_sound logTwoBall_sound (CB3_4_1I1R0Mass_sound) (w := CB3_4_1I1R0MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB3_4_1I1R0MassTerm : Ball := ⟨(1147279995329005976604244689539 / 20000000000000000000000000000000), (2248420661 / 100000000000000000000000000000000)⟩ +lemma CB3_4_1I1R0MassTerm_sound : CB3_4_1I1R0MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB3_4_1I1R0Value a))) := by + exact contains_sound (entropyTerm_ball (CB3_4_1I1R0Mass_sound) CB3_4_1I1R0MassTermLog_sound) (by decide +kernel) +def CB3_4_1I1R0H : Ball := ⟨0, (2248420661 / 50000000000000000000000000000000)⟩ +lemma CB3_4_1I1R0H_sound : CB3_4_1I1R0H.Encloses (homogeneousEntropy CB3_4_1I1R0Value) := by + exact contains_sound (homogeneous_enclosed CB3_4_1I1R0Value CB3_4_1I1R0MassTerm_sound CB3_4_1I1R0Entropy_sound) (by decide +kernel) +def CB3_4_1I1R1Value (a : Fin 6) : ℝ := residualLaw (below (shape 3 4 1)) (fun u => (stageBLaw (shape 3 4 1) u : ℝ)) (stageBPriority (shape 3 4 1)) 1 (fun u a => (littleLaw (shape 3 4 1) u ((stageBPriority (shape 3 4 1)) 1) a : ℝ)) 1 a +def CB3_4_1I1R1Raw (a : Fin 6) : Ball := residualBall (below (shape 3 4 1)) B3_4_1Law (stageBPriority (shape 3 4 1)) 1 (fun u => B3_4_1Little u ((stageBPriority (shape 3 4 1)) 1)) 1 a +lemma CB3_4_1I1R1Raw_sound (a : Fin 6) : + (CB3_4_1I1R1Raw a).Encloses (CB3_4_1I1R1Value a) := by + exact residualBall_sound_on (below (shape 3 4 1)) B3_4_1Law (fun u => (stageBLaw (shape 3 4 1) u : ℝ)) (stageBPriority (shape 3 4 1)) 1 (fun u => B3_4_1Little u ((stageBPriority (shape 3 4 1)) 1)) (fun u a => (littleLaw (shape 3 4 1) u ((stageBPriority (shape 3 4 1)) 1) a : ℝ)) (fun u _ => B3_4_1Law_sound u) (fun u _ a => B3_4_1Little_sound u ((stageBPriority (shape 3 4 1)) 1) a) 1 a +def CB3_4_1I1R1Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(3042047920219277059373774533977 / 6250000000000000000000000000000), (21 / 100000000000000000000000000000000)⟩ ⟨(35046850851307688181754010183329 / 100000000000000000000000000000000), (15460288913 / 50000000000000000000000000000000)⟩ ⟨(-9000631464612332402682222967793 / 12500000000000000000000000000000), (15881867773 / 25000000000000000000000000000000)⟩ ⟨-2, 3042047920219277059373774533977, 1562500000000000000000000000000⟩] +lemma CB3_4_1I1R1Certificates_valid : + CB3_4_1I1R1Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB3_4_1I1R1CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | 1 => 1 + | _ => 0 +def CB3_4_1I1R1P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_4_1I1R1Certificates (CB3_4_1I1R1CertificateIndex a)).input +lemma CB3_4_1I1R1P_check : ∀ a : Fin 6, contains (CB3_4_1I1R1Raw a) (CB3_4_1I1R1P a) = true := by + decide +kernel +lemma CB3_4_1I1R1P_sound (a : Fin 6) : + (CB3_4_1I1R1P a).Encloses (CB3_4_1I1R1Value a) := + contains_sound (CB3_4_1I1R1Raw_sound a) (CB3_4_1I1R1P_check a) +def CB3_4_1I1R1Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_4_1I1R1Certificates (CB3_4_1I1R1CertificateIndex a)).output +lemma CB3_4_1I1R1Terms_sound (a : Fin 6) : + (CB3_4_1I1R1Terms a).Encloses (Foundation.entropyTerm (CB3_4_1I1R1Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB3_4_1I1R1Certificates_valid + (CB3_4_1I1R1CertificateIndex a) (CB3_4_1I1R1P_sound a) +def CB3_4_1I1R1Entropy : Ball := ⟨(35046850851307688181754010183329 / 100000000000000000000000000000000), (15460288913 / 50000000000000000000000000000000)⟩ +lemma CB3_4_1I1R1Entropy_sound : CB3_4_1I1R1Entropy.Encloses (Foundation.finiteEntropy CB3_4_1I1R1Value) := by + exact contains_sound (entropyFin_enclosed 6 CB3_4_1I1R1Value CB3_4_1I1R1Terms CB3_4_1I1R1Terms_sound) (by decide +kernel) +def CB3_4_1I1R1Mass : Ball := ⟨(3042047920219277059373774533977 / 6250000000000000000000000000000), (21 / 100000000000000000000000000000000)⟩ +lemma CB3_4_1I1R1Mass_sound : CB3_4_1I1R1Mass.Encloses (∑ a, CB3_4_1I1R1Value a) := by + exact contains_sound (finSumBall_sound 6 CB3_4_1I1R1P CB3_4_1I1R1Value CB3_4_1I1R1P_sound) (by decide +kernel) +def CB3_4_1I1R1MassTermLogWitness : LogWitness := ⟨-2, 3042047920219277059373774533977, 1562500000000000000000000000000⟩ +def CB3_4_1I1R1MassTermLog : Ball := ⟨(-9000631464612332402682222967793 / 12500000000000000000000000000000), (15881867773 / 25000000000000000000000000000000)⟩ +lemma CB3_4_1I1R1MassTermLog_sound : CB3_4_1I1R1MassTermLog.Encloses (Real.log ((∑ a, CB3_4_1I1R1Value a))) := by + exact checkLog_sound logTwoBall_sound (CB3_4_1I1R1Mass_sound) (w := CB3_4_1I1R1MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB3_4_1I1R1MassTerm : Ball := ⟨(35046850851307688181754010183329 / 100000000000000000000000000000000), (15460288913 / 50000000000000000000000000000000)⟩ +lemma CB3_4_1I1R1MassTerm_sound : CB3_4_1I1R1MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB3_4_1I1R1Value a))) := by + exact contains_sound (entropyTerm_ball (CB3_4_1I1R1Mass_sound) CB3_4_1I1R1MassTermLog_sound) (by decide +kernel) +def CB3_4_1I1R1H : Ball := ⟨0, (15460288913 / 25000000000000000000000000000000)⟩ +lemma CB3_4_1I1R1H_sound : CB3_4_1I1R1H.Encloses (homogeneousEntropy CB3_4_1I1R1Value) := by + exact contains_sound (homogeneous_enclosed CB3_4_1I1R1Value CB3_4_1I1R1MassTerm_sound CB3_4_1I1R1Entropy_sound) (by decide +kernel) +def CB3_4_1I1R2Value (a : Fin 6) : ℝ := residualLaw (below (shape 3 4 1)) (fun u => (stageBLaw (shape 3 4 1) u : ℝ)) (stageBPriority (shape 3 4 1)) 1 (fun u a => (littleLaw (shape 3 4 1) u ((stageBPriority (shape 3 4 1)) 1) a : ℝ)) 2 a +def CB3_4_1I1R2Raw (a : Fin 6) : Ball := residualBall (below (shape 3 4 1)) B3_4_1Law (stageBPriority (shape 3 4 1)) 1 (fun u => B3_4_1Little u ((stageBPriority (shape 3 4 1)) 1)) 2 a +lemma CB3_4_1I1R2Raw_sound (a : Fin 6) : + (CB3_4_1I1R2Raw a).Encloses (CB3_4_1I1R2Value a) := by + exact residualBall_sound_on (below (shape 3 4 1)) B3_4_1Law (fun u => (stageBLaw (shape 3 4 1) u : ℝ)) (stageBPriority (shape 3 4 1)) 1 (fun u => B3_4_1Little u ((stageBPriority (shape 3 4 1)) 1)) (fun u a => (littleLaw (shape 3 4 1) u ((stageBPriority (shape 3 4 1)) 1) a : ℝ)) (fun u _ => B3_4_1Law_sound u) (fun u _ a => B3_4_1Little_sound u ((stageBPriority (shape 3 4 1)) 1) a) 2 a +def CB3_4_1I1R2Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(44353533976166490223624096589007 / 100000000000000000000000000000000), (1 / 5000000000000000000000000000000)⟩ ⟨(18029219162022483790732983590417 / 50000000000000000000000000000000), (28176678493 / 100000000000000000000000000000000)⟩ ⟨(-16259555932305679112321862864337 / 20000000000000000000000000000000), (31763735547 / 50000000000000000000000000000000)⟩ ⟨-2, 44353533976166490223624096589007, 25000000000000000000000000000000⟩, + .log ⟨(34553861978735541810850367637 / 800000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ ⟨(212053568871460902457636479641 / 1562500000000000000000000000000), (219511947 / 4000000000000000000000000000000)⟩ ⟨(-78552310107190677134533302510819 / 25000000000000000000000000000000), (1985233471 / 1562500000000000000000000000000)⟩ ⟨-5, 34553861978735541810850367637, 25000000000000000000000000000⟩] +lemma CB3_4_1I1R2Certificates_valid : + CB3_4_1I1R2Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB3_4_1I1R2CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | 2 => 1 + | 3 => 2 + | _ => 0 +def CB3_4_1I1R2P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_4_1I1R2Certificates (CB3_4_1I1R2CertificateIndex a)).input +lemma CB3_4_1I1R2P_check : ∀ a : Fin 6, contains (CB3_4_1I1R2Raw a) (CB3_4_1I1R2P a) = true := by + decide +kernel +lemma CB3_4_1I1R2P_sound (a : Fin 6) : + (CB3_4_1I1R2P a).Encloses (CB3_4_1I1R2Value a) := + contains_sound (CB3_4_1I1R2Raw_sound a) (CB3_4_1I1R2P_check a) +def CB3_4_1I1R2Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_4_1I1R2Certificates (CB3_4_1I1R2CertificateIndex a)).output +lemma CB3_4_1I1R2Terms_sound (a : Fin 6) : + (CB3_4_1I1R2Terms a).Encloses (Foundation.entropyTerm (CB3_4_1I1R2Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB3_4_1I1R2Certificates_valid + (CB3_4_1I1R2CertificateIndex a) (CB3_4_1I1R2P_sound a) +def CB3_4_1I1R2Entropy : Ball := ⟨(24814933365909232669377350938929 / 50000000000000000000000000000000), (2104029823 / 6250000000000000000000000000000)⟩ +lemma CB3_4_1I1R2Entropy_sound : CB3_4_1I1R2Entropy.Encloses (Foundation.finiteEntropy CB3_4_1I1R2Value) := by + exact contains_sound (entropyFin_enclosed 6 CB3_4_1I1R2Value CB3_4_1I1R2Terms CB3_4_1I1R2Terms_sound) (by decide +kernel) +def CB3_4_1I1R2Mass : Ball := ⟨(3042047920219277059373774533977 / 6250000000000000000000000000000), (11 / 50000000000000000000000000000000)⟩ +lemma CB3_4_1I1R2Mass_sound : CB3_4_1I1R2Mass.Encloses (∑ a, CB3_4_1I1R2Value a) := by + exact contains_sound (finSumBall_sound 6 CB3_4_1I1R2P CB3_4_1I1R2Value CB3_4_1I1R2P_sound) (by decide +kernel) +def CB3_4_1I1R2MassTermLogWitness : LogWitness := ⟨-2, 3042047920219277059373774533977, 1562500000000000000000000000000⟩ +def CB3_4_1I1R2MassTermLog : Ball := ⟨(-9000631464612332402682222967793 / 12500000000000000000000000000000), (31763735547 / 50000000000000000000000000000000)⟩ +lemma CB3_4_1I1R2MassTermLog_sound : CB3_4_1I1R2MassTermLog.Encloses (Real.log ((∑ a, CB3_4_1I1R2Value a))) := by + exact checkLog_sound logTwoBall_sound (CB3_4_1I1R2Mass_sound) (w := CB3_4_1I1R2MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB3_4_1I1R2MassTerm : Ball := ⟨(35046850851307688181754010183329 / 100000000000000000000000000000000), (30920577827 / 100000000000000000000000000000000)⟩ +lemma CB3_4_1I1R2MassTerm_sound : CB3_4_1I1R2MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB3_4_1I1R2Value a))) := by + exact contains_sound (entropyTerm_ball (CB3_4_1I1R2Mass_sound) CB3_4_1I1R2MassTermLog_sound) (by decide +kernel) +def CB3_4_1I1R2H : Ball := ⟨(14583015880510777157000691694529 / 100000000000000000000000000000000), (12917010999 / 20000000000000000000000000000000)⟩ +lemma CB3_4_1I1R2H_sound : CB3_4_1I1R2H.Encloses (homogeneousEntropy CB3_4_1I1R2Value) := by + exact contains_sound (homogeneous_enclosed CB3_4_1I1R2Value CB3_4_1I1R2MassTerm_sound CB3_4_1I1R2Entropy_sound) (by decide +kernel) +def CB3_4_1I1R3Value (a : Fin 6) : ℝ := residualLaw (below (shape 3 4 1)) (fun u => (stageBLaw (shape 3 4 1) u : ℝ)) (stageBPriority (shape 3 4 1)) 1 (fun u a => (littleLaw (shape 3 4 1) u ((stageBPriority (shape 3 4 1)) 1) a : ℝ)) 3 a +def CB3_4_1I1R3Raw (a : Fin 6) : Ball := residualBall (below (shape 3 4 1)) B3_4_1Law (stageBPriority (shape 3 4 1)) 1 (fun u => B3_4_1Little u ((stageBPriority (shape 3 4 1)) 1)) 3 a +lemma CB3_4_1I1R3Raw_sound (a : Fin 6) : + (CB3_4_1I1R3Raw a).Encloses (CB3_4_1I1R3Value a) := by + exact residualBall_sound_on (below (shape 3 4 1)) B3_4_1Law (fun u => (stageBLaw (shape 3 4 1) u : ℝ)) (stageBPriority (shape 3 4 1)) 1 (fun u => B3_4_1Little u ((stageBPriority (shape 3 4 1)) 1)) (fun u a => (littleLaw (shape 3 4 1) u ((stageBPriority (shape 3 4 1)) 1) a : ℝ)) (fun u _ => B3_4_1Law_sound u) (fun u _ a => B3_4_1Little_sound u ((stageBPriority (shape 3 4 1)) 1) a) 3 a +def CB3_4_1I1R3Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(80868831238226048857523902691 / 6250000000000000000000000000000), (1 / 20000000000000000000000000000000)⟩ ⟨(5625246599010449899116012778669 / 100000000000000000000000000000000), (2191954091 / 100000000000000000000000000000000)⟩ ⟨(-434750826807998994834781262470351 / 100000000000000000000000000000000), (3388131797 / 2000000000000000000000000000000)⟩ ⟨-7, 80868831238226048857523902691, 48828125000000000000000000000⟩] +lemma CB3_4_1I1R3Certificates_valid : + CB3_4_1I1R3Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB3_4_1I1R3CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | 4 => 1 + | _ => 0 +def CB3_4_1I1R3P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_4_1I1R3Certificates (CB3_4_1I1R3CertificateIndex a)).input +lemma CB3_4_1I1R3P_check : ∀ a : Fin 6, contains (CB3_4_1I1R3Raw a) (CB3_4_1I1R3P a) = true := by + decide +kernel +lemma CB3_4_1I1R3P_sound (a : Fin 6) : + (CB3_4_1I1R3P a).Encloses (CB3_4_1I1R3Value a) := + contains_sound (CB3_4_1I1R3Raw_sound a) (CB3_4_1I1R3P_check a) +def CB3_4_1I1R3Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_4_1I1R3Certificates (CB3_4_1I1R3CertificateIndex a)).output +lemma CB3_4_1I1R3Terms_sound (a : Fin 6) : + (CB3_4_1I1R3Terms a).Encloses (Foundation.entropyTerm (CB3_4_1I1R3Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB3_4_1I1R3Certificates_valid + (CB3_4_1I1R3CertificateIndex a) (CB3_4_1I1R3P_sound a) +def CB3_4_1I1R3Entropy : Ball := ⟨(5625246599010449899116012778669 / 100000000000000000000000000000000), (2191954091 / 100000000000000000000000000000000)⟩ +lemma CB3_4_1I1R3Entropy_sound : CB3_4_1I1R3Entropy.Encloses (Foundation.finiteEntropy CB3_4_1I1R3Value) := by + exact contains_sound (entropyFin_enclosed 6 CB3_4_1I1R3Value CB3_4_1I1R3Terms CB3_4_1I1R3Terms_sound) (by decide +kernel) +def CB3_4_1I1R3Mass : Ball := ⟨(80868831238226048857523902691 / 6250000000000000000000000000000), (1 / 20000000000000000000000000000000)⟩ +lemma CB3_4_1I1R3Mass_sound : CB3_4_1I1R3Mass.Encloses (∑ a, CB3_4_1I1R3Value a) := by + exact contains_sound (finSumBall_sound 6 CB3_4_1I1R3P CB3_4_1I1R3Value CB3_4_1I1R3P_sound) (by decide +kernel) +def CB3_4_1I1R3MassTermLogWitness : LogWitness := ⟨-7, 80868831238226048857523902691, 48828125000000000000000000000⟩ +def CB3_4_1I1R3MassTermLog : Ball := ⟨(-434750826807998994834781262470351 / 100000000000000000000000000000000), (3388131797 / 2000000000000000000000000000000)⟩ +lemma CB3_4_1I1R3MassTermLog_sound : CB3_4_1I1R3MassTermLog.Encloses (Real.log ((∑ a, CB3_4_1I1R3Value a))) := by + exact checkLog_sound logTwoBall_sound (CB3_4_1I1R3Mass_sound) (w := CB3_4_1I1R3MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB3_4_1I1R3MassTerm : Ball := ⟨(5625246599010449899116012778669 / 100000000000000000000000000000000), (2191954091 / 100000000000000000000000000000000)⟩ +lemma CB3_4_1I1R3MassTerm_sound : CB3_4_1I1R3MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB3_4_1I1R3Value a))) := by + exact contains_sound (entropyTerm_ball (CB3_4_1I1R3Mass_sound) CB3_4_1I1R3MassTermLog_sound) (by decide +kernel) +def CB3_4_1I1R3H : Ball := ⟨0, (2191954091 / 50000000000000000000000000000000)⟩ +lemma CB3_4_1I1R3H_sound : CB3_4_1I1R3H.Encloses (homogeneousEntropy CB3_4_1I1R3Value) := by + exact contains_sound (homogeneous_enclosed CB3_4_1I1R3Value CB3_4_1I1R3MassTerm_sound CB3_4_1I1R3Entropy_sound) (by decide +kernel) +def CB3_4_1I1R4Value (a : Fin 6) : ℝ := residualLaw (below (shape 3 4 1)) (fun u => (stageBLaw (shape 3 4 1) u : ℝ)) (stageBPriority (shape 3 4 1)) 1 (fun u a => (littleLaw (shape 3 4 1) u ((stageBPriority (shape 3 4 1)) 1) a : ℝ)) 4 a +def CB3_4_1I1R4Raw (a : Fin 6) : Ball := residualBall (below (shape 3 4 1)) B3_4_1Law (stageBPriority (shape 3 4 1)) 1 (fun u => B3_4_1Little u ((stageBPriority (shape 3 4 1)) 1)) 4 a +lemma CB3_4_1I1R4Raw_sound (a : Fin 6) : + (CB3_4_1I1R4Raw a).Encloses (CB3_4_1I1R4Value a) := by + exact residualBall_sound_on (below (shape 3 4 1)) B3_4_1Law (fun u => (stageBLaw (shape 3 4 1) u : ℝ)) (stageBPriority (shape 3 4 1)) 1 (fun u => B3_4_1Little u ((stageBPriority (shape 3 4 1)) 1)) (fun u a => (littleLaw (shape 3 4 1) u ((stageBPriority (shape 3 4 1)) 1) a : ℝ)) (fun u _ => B3_4_1Law_sound u) (fun u _ a => B3_4_1Little_sound u ((stageBPriority (shape 3 4 1)) 1) a) 4 a +def CB3_4_1I1R4Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB3_4_1I1R4Certificates_valid : + CB3_4_1I1R4Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB3_4_1I1R4CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB3_4_1I1R4P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_4_1I1R4Certificates (CB3_4_1I1R4CertificateIndex a)).input +lemma CB3_4_1I1R4P_check : ∀ a : Fin 6, contains (CB3_4_1I1R4Raw a) (CB3_4_1I1R4P a) = true := by + decide +kernel +lemma CB3_4_1I1R4P_sound (a : Fin 6) : + (CB3_4_1I1R4P a).Encloses (CB3_4_1I1R4Value a) := + contains_sound (CB3_4_1I1R4Raw_sound a) (CB3_4_1I1R4P_check a) +def CB3_4_1I1R4Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_4_1I1R4Certificates (CB3_4_1I1R4CertificateIndex a)).output +lemma CB3_4_1I1R4Terms_sound (a : Fin 6) : + (CB3_4_1I1R4Terms a).Encloses (Foundation.entropyTerm (CB3_4_1I1R4Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB3_4_1I1R4Certificates_valid + (CB3_4_1I1R4CertificateIndex a) (CB3_4_1I1R4P_sound a) +def CB3_4_1I1R4Entropy : Ball := ⟨0, 0⟩ +lemma CB3_4_1I1R4Entropy_sound : CB3_4_1I1R4Entropy.Encloses (Foundation.finiteEntropy CB3_4_1I1R4Value) := by + exact contains_sound (entropyFin_enclosed 6 CB3_4_1I1R4Value CB3_4_1I1R4Terms CB3_4_1I1R4Terms_sound) (by decide +kernel) +def CB3_4_1I1R4Mass : Ball := ⟨0, 0⟩ +lemma CB3_4_1I1R4Mass_sound : CB3_4_1I1R4Mass.Encloses (∑ a, CB3_4_1I1R4Value a) := by + exact contains_sound (finSumBall_sound 6 CB3_4_1I1R4P CB3_4_1I1R4Value CB3_4_1I1R4P_sound) (by decide +kernel) +def CB3_4_1I1R4MassTerm : Ball := .exact 0 +lemma CB3_4_1I1R4MassTerm_sound : CB3_4_1I1R4MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB3_4_1I1R4Value a))) := + entropyTerm_zero_ball (CB3_4_1I1R4Mass_sound) +def CB3_4_1I1R4H : Ball := ⟨0, 0⟩ +lemma CB3_4_1I1R4H_sound : CB3_4_1I1R4H.Encloses (homogeneousEntropy CB3_4_1I1R4Value) := by + exact contains_sound (homogeneous_enclosed CB3_4_1I1R4Value CB3_4_1I1R4MassTerm_sound CB3_4_1I1R4Entropy_sound) (by decide +kernel) +def CB3_4_1I1R5Value (a : Fin 6) : ℝ := residualLaw (below (shape 3 4 1)) (fun u => (stageBLaw (shape 3 4 1) u : ℝ)) (stageBPriority (shape 3 4 1)) 1 (fun u a => (littleLaw (shape 3 4 1) u ((stageBPriority (shape 3 4 1)) 1) a : ℝ)) 5 a +def CB3_4_1I1R5Raw (a : Fin 6) : Ball := residualBall (below (shape 3 4 1)) B3_4_1Law (stageBPriority (shape 3 4 1)) 1 (fun u => B3_4_1Little u ((stageBPriority (shape 3 4 1)) 1)) 5 a +lemma CB3_4_1I1R5Raw_sound (a : Fin 6) : + (CB3_4_1I1R5Raw a).Encloses (CB3_4_1I1R5Value a) := by + exact residualBall_sound_on (below (shape 3 4 1)) B3_4_1Law (fun u => (stageBLaw (shape 3 4 1) u : ℝ)) (stageBPriority (shape 3 4 1)) 1 (fun u => B3_4_1Little u ((stageBPriority (shape 3 4 1)) 1)) (fun u a => (littleLaw (shape 3 4 1) u ((stageBPriority (shape 3 4 1)) 1) a : ℝ)) (fun u _ => B3_4_1Law_sound u) (fun u _ a => B3_4_1Little_sound u ((stageBPriority (shape 3 4 1)) 1) a) 5 a +def CB3_4_1I1R5Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB3_4_1I1R5Certificates_valid : + CB3_4_1I1R5Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB3_4_1I1R5CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB3_4_1I1R5P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_4_1I1R5Certificates (CB3_4_1I1R5CertificateIndex a)).input +lemma CB3_4_1I1R5P_check : ∀ a : Fin 6, contains (CB3_4_1I1R5Raw a) (CB3_4_1I1R5P a) = true := by + decide +kernel +lemma CB3_4_1I1R5P_sound (a : Fin 6) : + (CB3_4_1I1R5P a).Encloses (CB3_4_1I1R5Value a) := + contains_sound (CB3_4_1I1R5Raw_sound a) (CB3_4_1I1R5P_check a) +def CB3_4_1I1R5Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_4_1I1R5Certificates (CB3_4_1I1R5CertificateIndex a)).output +lemma CB3_4_1I1R5Terms_sound (a : Fin 6) : + (CB3_4_1I1R5Terms a).Encloses (Foundation.entropyTerm (CB3_4_1I1R5Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB3_4_1I1R5Certificates_valid + (CB3_4_1I1R5CertificateIndex a) (CB3_4_1I1R5P_sound a) +def CB3_4_1I1R5Entropy : Ball := ⟨0, 0⟩ +lemma CB3_4_1I1R5Entropy_sound : CB3_4_1I1R5Entropy.Encloses (Foundation.finiteEntropy CB3_4_1I1R5Value) := by + exact contains_sound (entropyFin_enclosed 6 CB3_4_1I1R5Value CB3_4_1I1R5Terms CB3_4_1I1R5Terms_sound) (by decide +kernel) +def CB3_4_1I1R5Mass : Ball := ⟨0, 0⟩ +lemma CB3_4_1I1R5Mass_sound : CB3_4_1I1R5Mass.Encloses (∑ a, CB3_4_1I1R5Value a) := by + exact contains_sound (finSumBall_sound 6 CB3_4_1I1R5P CB3_4_1I1R5Value CB3_4_1I1R5P_sound) (by decide +kernel) +def CB3_4_1I1R5MassTerm : Ball := .exact 0 +lemma CB3_4_1I1R5MassTerm_sound : CB3_4_1I1R5MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB3_4_1I1R5Value a))) := + entropyTerm_zero_ball (CB3_4_1I1R5Mass_sound) +def CB3_4_1I1R5H : Ball := ⟨0, 0⟩ +lemma CB3_4_1I1R5H_sound : CB3_4_1I1R5H.Encloses (homogeneousEntropy CB3_4_1I1R5Value) := by + exact contains_sound (homogeneous_enclosed CB3_4_1I1R5Value CB3_4_1I1R5MassTerm_sound CB3_4_1I1R5Entropy_sound) (by decide +kernel) +def CB3_4_1I1R6Value (a : Fin 6) : ℝ := residualLaw (below (shape 3 4 1)) (fun u => (stageBLaw (shape 3 4 1) u : ℝ)) (stageBPriority (shape 3 4 1)) 1 (fun u a => (littleLaw (shape 3 4 1) u ((stageBPriority (shape 3 4 1)) 1) a : ℝ)) 6 a +def CB3_4_1I1R6Raw (a : Fin 6) : Ball := residualBall (below (shape 3 4 1)) B3_4_1Law (stageBPriority (shape 3 4 1)) 1 (fun u => B3_4_1Little u ((stageBPriority (shape 3 4 1)) 1)) 6 a +lemma CB3_4_1I1R6Raw_sound (a : Fin 6) : + (CB3_4_1I1R6Raw a).Encloses (CB3_4_1I1R6Value a) := by + exact residualBall_sound_on (below (shape 3 4 1)) B3_4_1Law (fun u => (stageBLaw (shape 3 4 1) u : ℝ)) (stageBPriority (shape 3 4 1)) 1 (fun u => B3_4_1Little u ((stageBPriority (shape 3 4 1)) 1)) (fun u a => (littleLaw (shape 3 4 1) u ((stageBPriority (shape 3 4 1)) 1) a : ℝ)) (fun u _ => B3_4_1Law_sound u) (fun u _ a => B3_4_1Little_sound u ((stageBPriority (shape 3 4 1)) 1) a) 6 a +def CB3_4_1I1R6Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB3_4_1I1R6Certificates_valid : + CB3_4_1I1R6Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB3_4_1I1R6CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB3_4_1I1R6P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_4_1I1R6Certificates (CB3_4_1I1R6CertificateIndex a)).input +lemma CB3_4_1I1R6P_check : ∀ a : Fin 6, contains (CB3_4_1I1R6Raw a) (CB3_4_1I1R6P a) = true := by + decide +kernel +lemma CB3_4_1I1R6P_sound (a : Fin 6) : + (CB3_4_1I1R6P a).Encloses (CB3_4_1I1R6Value a) := + contains_sound (CB3_4_1I1R6Raw_sound a) (CB3_4_1I1R6P_check a) +def CB3_4_1I1R6Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_4_1I1R6Certificates (CB3_4_1I1R6CertificateIndex a)).output +lemma CB3_4_1I1R6Terms_sound (a : Fin 6) : + (CB3_4_1I1R6Terms a).Encloses (Foundation.entropyTerm (CB3_4_1I1R6Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB3_4_1I1R6Certificates_valid + (CB3_4_1I1R6CertificateIndex a) (CB3_4_1I1R6P_sound a) +def CB3_4_1I1R6Entropy : Ball := ⟨0, 0⟩ +lemma CB3_4_1I1R6Entropy_sound : CB3_4_1I1R6Entropy.Encloses (Foundation.finiteEntropy CB3_4_1I1R6Value) := by + exact contains_sound (entropyFin_enclosed 6 CB3_4_1I1R6Value CB3_4_1I1R6Terms CB3_4_1I1R6Terms_sound) (by decide +kernel) +def CB3_4_1I1R6Mass : Ball := ⟨0, 0⟩ +lemma CB3_4_1I1R6Mass_sound : CB3_4_1I1R6Mass.Encloses (∑ a, CB3_4_1I1R6Value a) := by + exact contains_sound (finSumBall_sound 6 CB3_4_1I1R6P CB3_4_1I1R6Value CB3_4_1I1R6P_sound) (by decide +kernel) +def CB3_4_1I1R6MassTerm : Ball := .exact 0 +lemma CB3_4_1I1R6MassTerm_sound : CB3_4_1I1R6MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB3_4_1I1R6Value a))) := + entropyTerm_zero_ball (CB3_4_1I1R6Mass_sound) +def CB3_4_1I1R6H : Ball := ⟨0, 0⟩ +lemma CB3_4_1I1R6H_sound : CB3_4_1I1R6H.Encloses (homogeneousEntropy CB3_4_1I1R6Value) := by + exact contains_sound (homogeneous_enclosed CB3_4_1I1R6Value CB3_4_1I1R6MassTerm_sound CB3_4_1I1R6Entropy_sound) (by decide +kernel) +def CB3_4_1I1R7Value (a : Fin 6) : ℝ := residualLaw (below (shape 3 4 1)) (fun u => (stageBLaw (shape 3 4 1) u : ℝ)) (stageBPriority (shape 3 4 1)) 1 (fun u a => (littleLaw (shape 3 4 1) u ((stageBPriority (shape 3 4 1)) 1) a : ℝ)) 7 a +def CB3_4_1I1R7Raw (a : Fin 6) : Ball := residualBall (below (shape 3 4 1)) B3_4_1Law (stageBPriority (shape 3 4 1)) 1 (fun u => B3_4_1Little u ((stageBPriority (shape 3 4 1)) 1)) 7 a +lemma CB3_4_1I1R7Raw_sound (a : Fin 6) : + (CB3_4_1I1R7Raw a).Encloses (CB3_4_1I1R7Value a) := by + exact residualBall_sound_on (below (shape 3 4 1)) B3_4_1Law (fun u => (stageBLaw (shape 3 4 1) u : ℝ)) (stageBPriority (shape 3 4 1)) 1 (fun u => B3_4_1Little u ((stageBPriority (shape 3 4 1)) 1)) (fun u a => (littleLaw (shape 3 4 1) u ((stageBPriority (shape 3 4 1)) 1) a : ℝ)) (fun u _ => B3_4_1Law_sound u) (fun u _ a => B3_4_1Little_sound u ((stageBPriority (shape 3 4 1)) 1) a) 7 a +def CB3_4_1I1R7Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB3_4_1I1R7Certificates_valid : + CB3_4_1I1R7Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB3_4_1I1R7CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB3_4_1I1R7P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_4_1I1R7Certificates (CB3_4_1I1R7CertificateIndex a)).input +lemma CB3_4_1I1R7P_check : ∀ a : Fin 6, contains (CB3_4_1I1R7Raw a) (CB3_4_1I1R7P a) = true := by + decide +kernel +lemma CB3_4_1I1R7P_sound (a : Fin 6) : + (CB3_4_1I1R7P a).Encloses (CB3_4_1I1R7Value a) := + contains_sound (CB3_4_1I1R7Raw_sound a) (CB3_4_1I1R7P_check a) +def CB3_4_1I1R7Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_4_1I1R7Certificates (CB3_4_1I1R7CertificateIndex a)).output +lemma CB3_4_1I1R7Terms_sound (a : Fin 6) : + (CB3_4_1I1R7Terms a).Encloses (Foundation.entropyTerm (CB3_4_1I1R7Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB3_4_1I1R7Certificates_valid + (CB3_4_1I1R7CertificateIndex a) (CB3_4_1I1R7P_sound a) +def CB3_4_1I1R7Entropy : Ball := ⟨0, 0⟩ +lemma CB3_4_1I1R7Entropy_sound : CB3_4_1I1R7Entropy.Encloses (Foundation.finiteEntropy CB3_4_1I1R7Value) := by + exact contains_sound (entropyFin_enclosed 6 CB3_4_1I1R7Value CB3_4_1I1R7Terms CB3_4_1I1R7Terms_sound) (by decide +kernel) +def CB3_4_1I1R7Mass : Ball := ⟨0, 0⟩ +lemma CB3_4_1I1R7Mass_sound : CB3_4_1I1R7Mass.Encloses (∑ a, CB3_4_1I1R7Value a) := by + exact contains_sound (finSumBall_sound 6 CB3_4_1I1R7P CB3_4_1I1R7Value CB3_4_1I1R7P_sound) (by decide +kernel) +def CB3_4_1I1R7MassTerm : Ball := .exact 0 +lemma CB3_4_1I1R7MassTerm_sound : CB3_4_1I1R7MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB3_4_1I1R7Value a))) := + entropyTerm_zero_ball (CB3_4_1I1R7Mass_sound) +def CB3_4_1I1R7H : Ball := ⟨0, 0⟩ +lemma CB3_4_1I1R7H_sound : CB3_4_1I1R7H.Encloses (homogeneousEntropy CB3_4_1I1R7Value) := by + exact contains_sound (homogeneous_enclosed CB3_4_1I1R7Value CB3_4_1I1R7MassTerm_sound CB3_4_1I1R7Entropy_sound) (by decide +kernel) +def CB3_4_1I1R8Value (a : Fin 6) : ℝ := residualLaw (below (shape 3 4 1)) (fun u => (stageBLaw (shape 3 4 1) u : ℝ)) (stageBPriority (shape 3 4 1)) 1 (fun u a => (littleLaw (shape 3 4 1) u ((stageBPriority (shape 3 4 1)) 1) a : ℝ)) 8 a +def CB3_4_1I1R8Raw (a : Fin 6) : Ball := residualBall (below (shape 3 4 1)) B3_4_1Law (stageBPriority (shape 3 4 1)) 1 (fun u => B3_4_1Little u ((stageBPriority (shape 3 4 1)) 1)) 8 a +lemma CB3_4_1I1R8Raw_sound (a : Fin 6) : + (CB3_4_1I1R8Raw a).Encloses (CB3_4_1I1R8Value a) := by + exact residualBall_sound_on (below (shape 3 4 1)) B3_4_1Law (fun u => (stageBLaw (shape 3 4 1) u : ℝ)) (stageBPriority (shape 3 4 1)) 1 (fun u => B3_4_1Little u ((stageBPriority (shape 3 4 1)) 1)) (fun u a => (littleLaw (shape 3 4 1) u ((stageBPriority (shape 3 4 1)) 1) a : ℝ)) (fun u _ => B3_4_1Law_sound u) (fun u _ a => B3_4_1Little_sound u ((stageBPriority (shape 3 4 1)) 1) a) 8 a +def CB3_4_1I1R8Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB3_4_1I1R8Certificates_valid : + CB3_4_1I1R8Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB3_4_1I1R8CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB3_4_1I1R8P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_4_1I1R8Certificates (CB3_4_1I1R8CertificateIndex a)).input +lemma CB3_4_1I1R8P_check : ∀ a : Fin 6, contains (CB3_4_1I1R8Raw a) (CB3_4_1I1R8P a) = true := by + decide +kernel +lemma CB3_4_1I1R8P_sound (a : Fin 6) : + (CB3_4_1I1R8P a).Encloses (CB3_4_1I1R8Value a) := + contains_sound (CB3_4_1I1R8Raw_sound a) (CB3_4_1I1R8P_check a) +def CB3_4_1I1R8Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_4_1I1R8Certificates (CB3_4_1I1R8CertificateIndex a)).output +lemma CB3_4_1I1R8Terms_sound (a : Fin 6) : + (CB3_4_1I1R8Terms a).Encloses (Foundation.entropyTerm (CB3_4_1I1R8Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB3_4_1I1R8Certificates_valid + (CB3_4_1I1R8CertificateIndex a) (CB3_4_1I1R8P_sound a) +def CB3_4_1I1R8Entropy : Ball := ⟨0, 0⟩ +lemma CB3_4_1I1R8Entropy_sound : CB3_4_1I1R8Entropy.Encloses (Foundation.finiteEntropy CB3_4_1I1R8Value) := by + exact contains_sound (entropyFin_enclosed 6 CB3_4_1I1R8Value CB3_4_1I1R8Terms CB3_4_1I1R8Terms_sound) (by decide +kernel) +def CB3_4_1I1R8Mass : Ball := ⟨0, 0⟩ +lemma CB3_4_1I1R8Mass_sound : CB3_4_1I1R8Mass.Encloses (∑ a, CB3_4_1I1R8Value a) := by + exact contains_sound (finSumBall_sound 6 CB3_4_1I1R8P CB3_4_1I1R8Value CB3_4_1I1R8P_sound) (by decide +kernel) +def CB3_4_1I1R8MassTerm : Ball := .exact 0 +lemma CB3_4_1I1R8MassTerm_sound : CB3_4_1I1R8MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB3_4_1I1R8Value a))) := + entropyTerm_zero_ball (CB3_4_1I1R8Mass_sound) +def CB3_4_1I1R8H : Ball := ⟨0, 0⟩ +lemma CB3_4_1I1R8H_sound : CB3_4_1I1R8H.Encloses (homogeneousEntropy CB3_4_1I1R8Value) := by + exact contains_sound (homogeneous_enclosed CB3_4_1I1R8Value CB3_4_1I1R8MassTerm_sound CB3_4_1I1R8Entropy_sound) (by decide +kernel) +def CB3_4_1I1R9Value (a : Fin 6) : ℝ := residualLaw (below (shape 3 4 1)) (fun u => (stageBLaw (shape 3 4 1) u : ℝ)) (stageBPriority (shape 3 4 1)) 1 (fun u a => (littleLaw (shape 3 4 1) u ((stageBPriority (shape 3 4 1)) 1) a : ℝ)) 9 a +def CB3_4_1I1R9Raw (a : Fin 6) : Ball := residualBall (below (shape 3 4 1)) B3_4_1Law (stageBPriority (shape 3 4 1)) 1 (fun u => B3_4_1Little u ((stageBPriority (shape 3 4 1)) 1)) 9 a +lemma CB3_4_1I1R9Raw_sound (a : Fin 6) : + (CB3_4_1I1R9Raw a).Encloses (CB3_4_1I1R9Value a) := by + exact residualBall_sound_on (below (shape 3 4 1)) B3_4_1Law (fun u => (stageBLaw (shape 3 4 1) u : ℝ)) (stageBPriority (shape 3 4 1)) 1 (fun u => B3_4_1Little u ((stageBPriority (shape 3 4 1)) 1)) (fun u a => (littleLaw (shape 3 4 1) u ((stageBPriority (shape 3 4 1)) 1) a : ℝ)) (fun u _ => B3_4_1Law_sound u) (fun u _ a => B3_4_1Little_sound u ((stageBPriority (shape 3 4 1)) 1) a) 9 a +def CB3_4_1I1R9Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB3_4_1I1R9Certificates_valid : + CB3_4_1I1R9Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB3_4_1I1R9CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB3_4_1I1R9P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_4_1I1R9Certificates (CB3_4_1I1R9CertificateIndex a)).input +lemma CB3_4_1I1R9P_check : ∀ a : Fin 6, contains (CB3_4_1I1R9Raw a) (CB3_4_1I1R9P a) = true := by + decide +kernel +lemma CB3_4_1I1R9P_sound (a : Fin 6) : + (CB3_4_1I1R9P a).Encloses (CB3_4_1I1R9Value a) := + contains_sound (CB3_4_1I1R9Raw_sound a) (CB3_4_1I1R9P_check a) +def CB3_4_1I1R9Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_4_1I1R9Certificates (CB3_4_1I1R9CertificateIndex a)).output +lemma CB3_4_1I1R9Terms_sound (a : Fin 6) : + (CB3_4_1I1R9Terms a).Encloses (Foundation.entropyTerm (CB3_4_1I1R9Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB3_4_1I1R9Certificates_valid + (CB3_4_1I1R9CertificateIndex a) (CB3_4_1I1R9P_sound a) +def CB3_4_1I1R9Entropy : Ball := ⟨0, 0⟩ +lemma CB3_4_1I1R9Entropy_sound : CB3_4_1I1R9Entropy.Encloses (Foundation.finiteEntropy CB3_4_1I1R9Value) := by + exact contains_sound (entropyFin_enclosed 6 CB3_4_1I1R9Value CB3_4_1I1R9Terms CB3_4_1I1R9Terms_sound) (by decide +kernel) +def CB3_4_1I1R9Mass : Ball := ⟨0, 0⟩ +lemma CB3_4_1I1R9Mass_sound : CB3_4_1I1R9Mass.Encloses (∑ a, CB3_4_1I1R9Value a) := by + exact contains_sound (finSumBall_sound 6 CB3_4_1I1R9P CB3_4_1I1R9Value CB3_4_1I1R9P_sound) (by decide +kernel) +def CB3_4_1I1R9MassTerm : Ball := .exact 0 +lemma CB3_4_1I1R9MassTerm_sound : CB3_4_1I1R9MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB3_4_1I1R9Value a))) := + entropyTerm_zero_ball (CB3_4_1I1R9Mass_sound) +def CB3_4_1I1R9H : Ball := ⟨0, 0⟩ +lemma CB3_4_1I1R9H_sound : CB3_4_1I1R9H.Encloses (homogeneousEntropy CB3_4_1I1R9Value) := by + exact contains_sound (homogeneous_enclosed CB3_4_1I1R9Value CB3_4_1I1R9MassTerm_sound CB3_4_1I1R9Entropy_sound) (by decide +kernel) +def CB3_4_1I1R10Value (a : Fin 6) : ℝ := residualLaw (below (shape 3 4 1)) (fun u => (stageBLaw (shape 3 4 1) u : ℝ)) (stageBPriority (shape 3 4 1)) 1 (fun u a => (littleLaw (shape 3 4 1) u ((stageBPriority (shape 3 4 1)) 1) a : ℝ)) 10 a +def CB3_4_1I1R10Raw (a : Fin 6) : Ball := residualBall (below (shape 3 4 1)) B3_4_1Law (stageBPriority (shape 3 4 1)) 1 (fun u => B3_4_1Little u ((stageBPriority (shape 3 4 1)) 1)) 10 a +lemma CB3_4_1I1R10Raw_sound (a : Fin 6) : + (CB3_4_1I1R10Raw a).Encloses (CB3_4_1I1R10Value a) := by + exact residualBall_sound_on (below (shape 3 4 1)) B3_4_1Law (fun u => (stageBLaw (shape 3 4 1) u : ℝ)) (stageBPriority (shape 3 4 1)) 1 (fun u => B3_4_1Little u ((stageBPriority (shape 3 4 1)) 1)) (fun u a => (littleLaw (shape 3 4 1) u ((stageBPriority (shape 3 4 1)) 1) a : ℝ)) (fun u _ => B3_4_1Law_sound u) (fun u _ a => B3_4_1Little_sound u ((stageBPriority (shape 3 4 1)) 1) a) 10 a +def CB3_4_1I1R10Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB3_4_1I1R10Certificates_valid : + CB3_4_1I1R10Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB3_4_1I1R10CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB3_4_1I1R10P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_4_1I1R10Certificates (CB3_4_1I1R10CertificateIndex a)).input +lemma CB3_4_1I1R10P_check : ∀ a : Fin 6, contains (CB3_4_1I1R10Raw a) (CB3_4_1I1R10P a) = true := by + decide +kernel +lemma CB3_4_1I1R10P_sound (a : Fin 6) : + (CB3_4_1I1R10P a).Encloses (CB3_4_1I1R10Value a) := + contains_sound (CB3_4_1I1R10Raw_sound a) (CB3_4_1I1R10P_check a) +def CB3_4_1I1R10Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_4_1I1R10Certificates (CB3_4_1I1R10CertificateIndex a)).output +lemma CB3_4_1I1R10Terms_sound (a : Fin 6) : + (CB3_4_1I1R10Terms a).Encloses (Foundation.entropyTerm (CB3_4_1I1R10Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB3_4_1I1R10Certificates_valid + (CB3_4_1I1R10CertificateIndex a) (CB3_4_1I1R10P_sound a) +def CB3_4_1I1R10Entropy : Ball := ⟨0, 0⟩ +lemma CB3_4_1I1R10Entropy_sound : CB3_4_1I1R10Entropy.Encloses (Foundation.finiteEntropy CB3_4_1I1R10Value) := by + exact contains_sound (entropyFin_enclosed 6 CB3_4_1I1R10Value CB3_4_1I1R10Terms CB3_4_1I1R10Terms_sound) (by decide +kernel) +def CB3_4_1I1R10Mass : Ball := ⟨0, 0⟩ +lemma CB3_4_1I1R10Mass_sound : CB3_4_1I1R10Mass.Encloses (∑ a, CB3_4_1I1R10Value a) := by + exact contains_sound (finSumBall_sound 6 CB3_4_1I1R10P CB3_4_1I1R10Value CB3_4_1I1R10P_sound) (by decide +kernel) +def CB3_4_1I1R10MassTerm : Ball := .exact 0 +lemma CB3_4_1I1R10MassTerm_sound : CB3_4_1I1R10MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB3_4_1I1R10Value a))) := + entropyTerm_zero_ball (CB3_4_1I1R10Mass_sound) +def CB3_4_1I1R10H : Ball := ⟨0, 0⟩ +lemma CB3_4_1I1R10H_sound : CB3_4_1I1R10H.Encloses (homogeneousEntropy CB3_4_1I1R10Value) := by + exact contains_sound (homogeneous_enclosed CB3_4_1I1R10Value CB3_4_1I1R10MassTerm_sound CB3_4_1I1R10Entropy_sound) (by decide +kernel) +def CB3_4_1I1R11Value (a : Fin 6) : ℝ := residualLaw (below (shape 3 4 1)) (fun u => (stageBLaw (shape 3 4 1) u : ℝ)) (stageBPriority (shape 3 4 1)) 1 (fun u a => (littleLaw (shape 3 4 1) u ((stageBPriority (shape 3 4 1)) 1) a : ℝ)) 11 a +def CB3_4_1I1R11Raw (a : Fin 6) : Ball := residualBall (below (shape 3 4 1)) B3_4_1Law (stageBPriority (shape 3 4 1)) 1 (fun u => B3_4_1Little u ((stageBPriority (shape 3 4 1)) 1)) 11 a +lemma CB3_4_1I1R11Raw_sound (a : Fin 6) : + (CB3_4_1I1R11Raw a).Encloses (CB3_4_1I1R11Value a) := by + exact residualBall_sound_on (below (shape 3 4 1)) B3_4_1Law (fun u => (stageBLaw (shape 3 4 1) u : ℝ)) (stageBPriority (shape 3 4 1)) 1 (fun u => B3_4_1Little u ((stageBPriority (shape 3 4 1)) 1)) (fun u a => (littleLaw (shape 3 4 1) u ((stageBPriority (shape 3 4 1)) 1) a : ℝ)) (fun u _ => B3_4_1Law_sound u) (fun u _ a => B3_4_1Little_sound u ((stageBPriority (shape 3 4 1)) 1) a) 11 a +def CB3_4_1I1R11Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB3_4_1I1R11Certificates_valid : + CB3_4_1I1R11Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB3_4_1I1R11CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB3_4_1I1R11P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_4_1I1R11Certificates (CB3_4_1I1R11CertificateIndex a)).input +lemma CB3_4_1I1R11P_check : ∀ a : Fin 6, contains (CB3_4_1I1R11Raw a) (CB3_4_1I1R11P a) = true := by + decide +kernel +lemma CB3_4_1I1R11P_sound (a : Fin 6) : + (CB3_4_1I1R11P a).Encloses (CB3_4_1I1R11Value a) := + contains_sound (CB3_4_1I1R11Raw_sound a) (CB3_4_1I1R11P_check a) +def CB3_4_1I1R11Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_4_1I1R11Certificates (CB3_4_1I1R11CertificateIndex a)).output +lemma CB3_4_1I1R11Terms_sound (a : Fin 6) : + (CB3_4_1I1R11Terms a).Encloses (Foundation.entropyTerm (CB3_4_1I1R11Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB3_4_1I1R11Certificates_valid + (CB3_4_1I1R11CertificateIndex a) (CB3_4_1I1R11P_sound a) +def CB3_4_1I1R11Entropy : Ball := ⟨0, 0⟩ +lemma CB3_4_1I1R11Entropy_sound : CB3_4_1I1R11Entropy.Encloses (Foundation.finiteEntropy CB3_4_1I1R11Value) := by + exact contains_sound (entropyFin_enclosed 6 CB3_4_1I1R11Value CB3_4_1I1R11Terms CB3_4_1I1R11Terms_sound) (by decide +kernel) +def CB3_4_1I1R11Mass : Ball := ⟨0, 0⟩ +lemma CB3_4_1I1R11Mass_sound : CB3_4_1I1R11Mass.Encloses (∑ a, CB3_4_1I1R11Value a) := by + exact contains_sound (finSumBall_sound 6 CB3_4_1I1R11P CB3_4_1I1R11Value CB3_4_1I1R11P_sound) (by decide +kernel) +def CB3_4_1I1R11MassTerm : Ball := .exact 0 +lemma CB3_4_1I1R11MassTerm_sound : CB3_4_1I1R11MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB3_4_1I1R11Value a))) := + entropyTerm_zero_ball (CB3_4_1I1R11Mass_sound) +def CB3_4_1I1R11H : Ball := ⟨0, 0⟩ +lemma CB3_4_1I1R11H_sound : CB3_4_1I1R11H.Encloses (homogeneousEntropy CB3_4_1I1R11Value) := by + exact contains_sound (homogeneous_enclosed CB3_4_1I1R11Value CB3_4_1I1R11MassTerm_sound CB3_4_1I1R11Entropy_sound) (by decide +kernel) +def CB3_4_1I1R12Value (a : Fin 6) : ℝ := residualLaw (below (shape 3 4 1)) (fun u => (stageBLaw (shape 3 4 1) u : ℝ)) (stageBPriority (shape 3 4 1)) 1 (fun u a => (littleLaw (shape 3 4 1) u ((stageBPriority (shape 3 4 1)) 1) a : ℝ)) 12 a +def CB3_4_1I1R12Raw (a : Fin 6) : Ball := residualBall (below (shape 3 4 1)) B3_4_1Law (stageBPriority (shape 3 4 1)) 1 (fun u => B3_4_1Little u ((stageBPriority (shape 3 4 1)) 1)) 12 a +lemma CB3_4_1I1R12Raw_sound (a : Fin 6) : + (CB3_4_1I1R12Raw a).Encloses (CB3_4_1I1R12Value a) := by + exact residualBall_sound_on (below (shape 3 4 1)) B3_4_1Law (fun u => (stageBLaw (shape 3 4 1) u : ℝ)) (stageBPriority (shape 3 4 1)) 1 (fun u => B3_4_1Little u ((stageBPriority (shape 3 4 1)) 1)) (fun u a => (littleLaw (shape 3 4 1) u ((stageBPriority (shape 3 4 1)) 1) a : ℝ)) (fun u _ => B3_4_1Law_sound u) (fun u _ a => B3_4_1Little_sound u ((stageBPriority (shape 3 4 1)) 1) a) 12 a +def CB3_4_1I1R12Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB3_4_1I1R12Certificates_valid : + CB3_4_1I1R12Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB3_4_1I1R12CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB3_4_1I1R12P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_4_1I1R12Certificates (CB3_4_1I1R12CertificateIndex a)).input +lemma CB3_4_1I1R12P_check : ∀ a : Fin 6, contains (CB3_4_1I1R12Raw a) (CB3_4_1I1R12P a) = true := by + decide +kernel +lemma CB3_4_1I1R12P_sound (a : Fin 6) : + (CB3_4_1I1R12P a).Encloses (CB3_4_1I1R12Value a) := + contains_sound (CB3_4_1I1R12Raw_sound a) (CB3_4_1I1R12P_check a) +def CB3_4_1I1R12Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_4_1I1R12Certificates (CB3_4_1I1R12CertificateIndex a)).output +lemma CB3_4_1I1R12Terms_sound (a : Fin 6) : + (CB3_4_1I1R12Terms a).Encloses (Foundation.entropyTerm (CB3_4_1I1R12Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB3_4_1I1R12Certificates_valid + (CB3_4_1I1R12CertificateIndex a) (CB3_4_1I1R12P_sound a) +def CB3_4_1I1R12Entropy : Ball := ⟨0, 0⟩ +lemma CB3_4_1I1R12Entropy_sound : CB3_4_1I1R12Entropy.Encloses (Foundation.finiteEntropy CB3_4_1I1R12Value) := by + exact contains_sound (entropyFin_enclosed 6 CB3_4_1I1R12Value CB3_4_1I1R12Terms CB3_4_1I1R12Terms_sound) (by decide +kernel) +def CB3_4_1I1R12Mass : Ball := ⟨0, 0⟩ +lemma CB3_4_1I1R12Mass_sound : CB3_4_1I1R12Mass.Encloses (∑ a, CB3_4_1I1R12Value a) := by + exact contains_sound (finSumBall_sound 6 CB3_4_1I1R12P CB3_4_1I1R12Value CB3_4_1I1R12P_sound) (by decide +kernel) +def CB3_4_1I1R12MassTerm : Ball := .exact 0 +lemma CB3_4_1I1R12MassTerm_sound : CB3_4_1I1R12MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB3_4_1I1R12Value a))) := + entropyTerm_zero_ball (CB3_4_1I1R12Mass_sound) +def CB3_4_1I1R12H : Ball := ⟨0, 0⟩ +lemma CB3_4_1I1R12H_sound : CB3_4_1I1R12H.Encloses (homogeneousEntropy CB3_4_1I1R12Value) := by + exact contains_sound (homogeneous_enclosed CB3_4_1I1R12Value CB3_4_1I1R12MassTerm_sound CB3_4_1I1R12Entropy_sound) (by decide +kernel) +def CB3_4_1I1R13Value (a : Fin 6) : ℝ := residualLaw (below (shape 3 4 1)) (fun u => (stageBLaw (shape 3 4 1) u : ℝ)) (stageBPriority (shape 3 4 1)) 1 (fun u a => (littleLaw (shape 3 4 1) u ((stageBPriority (shape 3 4 1)) 1) a : ℝ)) 13 a +def CB3_4_1I1R13Raw (a : Fin 6) : Ball := residualBall (below (shape 3 4 1)) B3_4_1Law (stageBPriority (shape 3 4 1)) 1 (fun u => B3_4_1Little u ((stageBPriority (shape 3 4 1)) 1)) 13 a +lemma CB3_4_1I1R13Raw_sound (a : Fin 6) : + (CB3_4_1I1R13Raw a).Encloses (CB3_4_1I1R13Value a) := by + exact residualBall_sound_on (below (shape 3 4 1)) B3_4_1Law (fun u => (stageBLaw (shape 3 4 1) u : ℝ)) (stageBPriority (shape 3 4 1)) 1 (fun u => B3_4_1Little u ((stageBPriority (shape 3 4 1)) 1)) (fun u a => (littleLaw (shape 3 4 1) u ((stageBPriority (shape 3 4 1)) 1) a : ℝ)) (fun u _ => B3_4_1Law_sound u) (fun u _ a => B3_4_1Little_sound u ((stageBPriority (shape 3 4 1)) 1) a) 13 a +def CB3_4_1I1R13Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB3_4_1I1R13Certificates_valid : + CB3_4_1I1R13Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB3_4_1I1R13CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB3_4_1I1R13P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_4_1I1R13Certificates (CB3_4_1I1R13CertificateIndex a)).input +lemma CB3_4_1I1R13P_check : ∀ a : Fin 6, contains (CB3_4_1I1R13Raw a) (CB3_4_1I1R13P a) = true := by + decide +kernel +lemma CB3_4_1I1R13P_sound (a : Fin 6) : + (CB3_4_1I1R13P a).Encloses (CB3_4_1I1R13Value a) := + contains_sound (CB3_4_1I1R13Raw_sound a) (CB3_4_1I1R13P_check a) +def CB3_4_1I1R13Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_4_1I1R13Certificates (CB3_4_1I1R13CertificateIndex a)).output +lemma CB3_4_1I1R13Terms_sound (a : Fin 6) : + (CB3_4_1I1R13Terms a).Encloses (Foundation.entropyTerm (CB3_4_1I1R13Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB3_4_1I1R13Certificates_valid + (CB3_4_1I1R13CertificateIndex a) (CB3_4_1I1R13P_sound a) +def CB3_4_1I1R13Entropy : Ball := ⟨0, 0⟩ +lemma CB3_4_1I1R13Entropy_sound : CB3_4_1I1R13Entropy.Encloses (Foundation.finiteEntropy CB3_4_1I1R13Value) := by + exact contains_sound (entropyFin_enclosed 6 CB3_4_1I1R13Value CB3_4_1I1R13Terms CB3_4_1I1R13Terms_sound) (by decide +kernel) +def CB3_4_1I1R13Mass : Ball := ⟨0, 0⟩ +lemma CB3_4_1I1R13Mass_sound : CB3_4_1I1R13Mass.Encloses (∑ a, CB3_4_1I1R13Value a) := by + exact contains_sound (finSumBall_sound 6 CB3_4_1I1R13P CB3_4_1I1R13Value CB3_4_1I1R13P_sound) (by decide +kernel) +def CB3_4_1I1R13MassTerm : Ball := .exact 0 +lemma CB3_4_1I1R13MassTerm_sound : CB3_4_1I1R13MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB3_4_1I1R13Value a))) := + entropyTerm_zero_ball (CB3_4_1I1R13Mass_sound) +def CB3_4_1I1R13H : Ball := ⟨0, 0⟩ +lemma CB3_4_1I1R13H_sound : CB3_4_1I1R13H.Encloses (homogeneousEntropy CB3_4_1I1R13Value) := by + exact contains_sound (homogeneous_enclosed CB3_4_1I1R13Value CB3_4_1I1R13MassTerm_sound CB3_4_1I1R13Entropy_sound) (by decide +kernel) +def CB3_4_1I1R14Value (a : Fin 6) : ℝ := residualLaw (below (shape 3 4 1)) (fun u => (stageBLaw (shape 3 4 1) u : ℝ)) (stageBPriority (shape 3 4 1)) 1 (fun u a => (littleLaw (shape 3 4 1) u ((stageBPriority (shape 3 4 1)) 1) a : ℝ)) 14 a +def CB3_4_1I1R14Raw (a : Fin 6) : Ball := residualBall (below (shape 3 4 1)) B3_4_1Law (stageBPriority (shape 3 4 1)) 1 (fun u => B3_4_1Little u ((stageBPriority (shape 3 4 1)) 1)) 14 a +lemma CB3_4_1I1R14Raw_sound (a : Fin 6) : + (CB3_4_1I1R14Raw a).Encloses (CB3_4_1I1R14Value a) := by + exact residualBall_sound_on (below (shape 3 4 1)) B3_4_1Law (fun u => (stageBLaw (shape 3 4 1) u : ℝ)) (stageBPriority (shape 3 4 1)) 1 (fun u => B3_4_1Little u ((stageBPriority (shape 3 4 1)) 1)) (fun u a => (littleLaw (shape 3 4 1) u ((stageBPriority (shape 3 4 1)) 1) a : ℝ)) (fun u _ => B3_4_1Law_sound u) (fun u _ a => B3_4_1Little_sound u ((stageBPriority (shape 3 4 1)) 1) a) 14 a +def CB3_4_1I1R14Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB3_4_1I1R14Certificates_valid : + CB3_4_1I1R14Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB3_4_1I1R14CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB3_4_1I1R14P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_4_1I1R14Certificates (CB3_4_1I1R14CertificateIndex a)).input +lemma CB3_4_1I1R14P_check : ∀ a : Fin 6, contains (CB3_4_1I1R14Raw a) (CB3_4_1I1R14P a) = true := by + decide +kernel +lemma CB3_4_1I1R14P_sound (a : Fin 6) : + (CB3_4_1I1R14P a).Encloses (CB3_4_1I1R14Value a) := + contains_sound (CB3_4_1I1R14Raw_sound a) (CB3_4_1I1R14P_check a) +def CB3_4_1I1R14Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_4_1I1R14Certificates (CB3_4_1I1R14CertificateIndex a)).output +lemma CB3_4_1I1R14Terms_sound (a : Fin 6) : + (CB3_4_1I1R14Terms a).Encloses (Foundation.entropyTerm (CB3_4_1I1R14Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB3_4_1I1R14Certificates_valid + (CB3_4_1I1R14CertificateIndex a) (CB3_4_1I1R14P_sound a) +def CB3_4_1I1R14Entropy : Ball := ⟨0, 0⟩ +lemma CB3_4_1I1R14Entropy_sound : CB3_4_1I1R14Entropy.Encloses (Foundation.finiteEntropy CB3_4_1I1R14Value) := by + exact contains_sound (entropyFin_enclosed 6 CB3_4_1I1R14Value CB3_4_1I1R14Terms CB3_4_1I1R14Terms_sound) (by decide +kernel) +def CB3_4_1I1R14Mass : Ball := ⟨0, 0⟩ +lemma CB3_4_1I1R14Mass_sound : CB3_4_1I1R14Mass.Encloses (∑ a, CB3_4_1I1R14Value a) := by + exact contains_sound (finSumBall_sound 6 CB3_4_1I1R14P CB3_4_1I1R14Value CB3_4_1I1R14P_sound) (by decide +kernel) +def CB3_4_1I1R14MassTerm : Ball := .exact 0 +lemma CB3_4_1I1R14MassTerm_sound : CB3_4_1I1R14MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB3_4_1I1R14Value a))) := + entropyTerm_zero_ball (CB3_4_1I1R14Mass_sound) +def CB3_4_1I1R14H : Ball := ⟨0, 0⟩ +lemma CB3_4_1I1R14H_sound : CB3_4_1I1R14H.Encloses (homogeneousEntropy CB3_4_1I1R14Value) := by + exact contains_sound (homogeneous_enclosed CB3_4_1I1R14Value CB3_4_1I1R14MassTerm_sound CB3_4_1I1R14Entropy_sound) (by decide +kernel) +def CB3_4_1I1R15Value (a : Fin 6) : ℝ := residualLaw (below (shape 3 4 1)) (fun u => (stageBLaw (shape 3 4 1) u : ℝ)) (stageBPriority (shape 3 4 1)) 1 (fun u a => (littleLaw (shape 3 4 1) u ((stageBPriority (shape 3 4 1)) 1) a : ℝ)) 15 a +def CB3_4_1I1R15Raw (a : Fin 6) : Ball := residualBall (below (shape 3 4 1)) B3_4_1Law (stageBPriority (shape 3 4 1)) 1 (fun u => B3_4_1Little u ((stageBPriority (shape 3 4 1)) 1)) 15 a +lemma CB3_4_1I1R15Raw_sound (a : Fin 6) : + (CB3_4_1I1R15Raw a).Encloses (CB3_4_1I1R15Value a) := by + exact residualBall_sound_on (below (shape 3 4 1)) B3_4_1Law (fun u => (stageBLaw (shape 3 4 1) u : ℝ)) (stageBPriority (shape 3 4 1)) 1 (fun u => B3_4_1Little u ((stageBPriority (shape 3 4 1)) 1)) (fun u a => (littleLaw (shape 3 4 1) u ((stageBPriority (shape 3 4 1)) 1) a : ℝ)) (fun u _ => B3_4_1Law_sound u) (fun u _ a => B3_4_1Little_sound u ((stageBPriority (shape 3 4 1)) 1) a) 15 a +def CB3_4_1I1R15Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB3_4_1I1R15Certificates_valid : + CB3_4_1I1R15Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB3_4_1I1R15CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB3_4_1I1R15P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_4_1I1R15Certificates (CB3_4_1I1R15CertificateIndex a)).input +lemma CB3_4_1I1R15P_check : ∀ a : Fin 6, contains (CB3_4_1I1R15Raw a) (CB3_4_1I1R15P a) = true := by + decide +kernel +lemma CB3_4_1I1R15P_sound (a : Fin 6) : + (CB3_4_1I1R15P a).Encloses (CB3_4_1I1R15Value a) := + contains_sound (CB3_4_1I1R15Raw_sound a) (CB3_4_1I1R15P_check a) +def CB3_4_1I1R15Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_4_1I1R15Certificates (CB3_4_1I1R15CertificateIndex a)).output +lemma CB3_4_1I1R15Terms_sound (a : Fin 6) : + (CB3_4_1I1R15Terms a).Encloses (Foundation.entropyTerm (CB3_4_1I1R15Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB3_4_1I1R15Certificates_valid + (CB3_4_1I1R15CertificateIndex a) (CB3_4_1I1R15P_sound a) +def CB3_4_1I1R15Entropy : Ball := ⟨0, 0⟩ +lemma CB3_4_1I1R15Entropy_sound : CB3_4_1I1R15Entropy.Encloses (Foundation.finiteEntropy CB3_4_1I1R15Value) := by + exact contains_sound (entropyFin_enclosed 6 CB3_4_1I1R15Value CB3_4_1I1R15Terms CB3_4_1I1R15Terms_sound) (by decide +kernel) +def CB3_4_1I1R15Mass : Ball := ⟨0, 0⟩ +lemma CB3_4_1I1R15Mass_sound : CB3_4_1I1R15Mass.Encloses (∑ a, CB3_4_1I1R15Value a) := by + exact contains_sound (finSumBall_sound 6 CB3_4_1I1R15P CB3_4_1I1R15Value CB3_4_1I1R15P_sound) (by decide +kernel) +def CB3_4_1I1R15MassTerm : Ball := .exact 0 +lemma CB3_4_1I1R15MassTerm_sound : CB3_4_1I1R15MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB3_4_1I1R15Value a))) := + entropyTerm_zero_ball (CB3_4_1I1R15Mass_sound) +def CB3_4_1I1R15H : Ball := ⟨0, 0⟩ +lemma CB3_4_1I1R15H_sound : CB3_4_1I1R15H.Encloses (homogeneousEntropy CB3_4_1I1R15Value) := by + exact contains_sound (homogeneous_enclosed CB3_4_1I1R15Value CB3_4_1I1R15MassTerm_sound CB3_4_1I1R15Entropy_sound) (by decide +kernel) +def CB3_4_1I1R16Value (a : Fin 6) : ℝ := residualLaw (below (shape 3 4 1)) (fun u => (stageBLaw (shape 3 4 1) u : ℝ)) (stageBPriority (shape 3 4 1)) 1 (fun u a => (littleLaw (shape 3 4 1) u ((stageBPriority (shape 3 4 1)) 1) a : ℝ)) 16 a +def CB3_4_1I1R16Raw (a : Fin 6) : Ball := residualBall (below (shape 3 4 1)) B3_4_1Law (stageBPriority (shape 3 4 1)) 1 (fun u => B3_4_1Little u ((stageBPriority (shape 3 4 1)) 1)) 16 a +lemma CB3_4_1I1R16Raw_sound (a : Fin 6) : + (CB3_4_1I1R16Raw a).Encloses (CB3_4_1I1R16Value a) := by + exact residualBall_sound_on (below (shape 3 4 1)) B3_4_1Law (fun u => (stageBLaw (shape 3 4 1) u : ℝ)) (stageBPriority (shape 3 4 1)) 1 (fun u => B3_4_1Little u ((stageBPriority (shape 3 4 1)) 1)) (fun u a => (littleLaw (shape 3 4 1) u ((stageBPriority (shape 3 4 1)) 1) a : ℝ)) (fun u _ => B3_4_1Law_sound u) (fun u _ a => B3_4_1Little_sound u ((stageBPriority (shape 3 4 1)) 1) a) 16 a +def CB3_4_1I1R16Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB3_4_1I1R16Certificates_valid : + CB3_4_1I1R16Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB3_4_1I1R16CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB3_4_1I1R16P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_4_1I1R16Certificates (CB3_4_1I1R16CertificateIndex a)).input +lemma CB3_4_1I1R16P_check : ∀ a : Fin 6, contains (CB3_4_1I1R16Raw a) (CB3_4_1I1R16P a) = true := by + decide +kernel +lemma CB3_4_1I1R16P_sound (a : Fin 6) : + (CB3_4_1I1R16P a).Encloses (CB3_4_1I1R16Value a) := + contains_sound (CB3_4_1I1R16Raw_sound a) (CB3_4_1I1R16P_check a) +def CB3_4_1I1R16Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_4_1I1R16Certificates (CB3_4_1I1R16CertificateIndex a)).output +lemma CB3_4_1I1R16Terms_sound (a : Fin 6) : + (CB3_4_1I1R16Terms a).Encloses (Foundation.entropyTerm (CB3_4_1I1R16Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB3_4_1I1R16Certificates_valid + (CB3_4_1I1R16CertificateIndex a) (CB3_4_1I1R16P_sound a) +def CB3_4_1I1R16Entropy : Ball := ⟨0, 0⟩ +lemma CB3_4_1I1R16Entropy_sound : CB3_4_1I1R16Entropy.Encloses (Foundation.finiteEntropy CB3_4_1I1R16Value) := by + exact contains_sound (entropyFin_enclosed 6 CB3_4_1I1R16Value CB3_4_1I1R16Terms CB3_4_1I1R16Terms_sound) (by decide +kernel) +def CB3_4_1I1R16Mass : Ball := ⟨0, 0⟩ +lemma CB3_4_1I1R16Mass_sound : CB3_4_1I1R16Mass.Encloses (∑ a, CB3_4_1I1R16Value a) := by + exact contains_sound (finSumBall_sound 6 CB3_4_1I1R16P CB3_4_1I1R16Value CB3_4_1I1R16P_sound) (by decide +kernel) +def CB3_4_1I1R16MassTerm : Ball := .exact 0 +lemma CB3_4_1I1R16MassTerm_sound : CB3_4_1I1R16MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB3_4_1I1R16Value a))) := + entropyTerm_zero_ball (CB3_4_1I1R16Mass_sound) +def CB3_4_1I1R16H : Ball := ⟨0, 0⟩ +lemma CB3_4_1I1R16H_sound : CB3_4_1I1R16H.Encloses (homogeneousEntropy CB3_4_1I1R16Value) := by + exact contains_sound (homogeneous_enclosed CB3_4_1I1R16Value CB3_4_1I1R16MassTerm_sound CB3_4_1I1R16Entropy_sound) (by decide +kernel) +def CB3_4_1I1ResidualEntropies (a : Fin 17) : Ball := + match a.val with + | 0 => CB3_4_1I1R0H + | 1 => CB3_4_1I1R1H + | 2 => CB3_4_1I1R2H + | 3 => CB3_4_1I1R3H + | 4 => CB3_4_1I1R4H + | 5 => CB3_4_1I1R5H + | 6 => CB3_4_1I1R6H + | 7 => CB3_4_1I1R7H + | 8 => CB3_4_1I1R8H + | 9 => CB3_4_1I1R9H + | 10 => CB3_4_1I1R10H + | 11 => CB3_4_1I1R11H + | 12 => CB3_4_1I1R12H + | 13 => CB3_4_1I1R13H + | 14 => CB3_4_1I1R14H + | 15 => CB3_4_1I1R15H + | 16 => CB3_4_1I1R16H + | _ => (.exact 0) +lemma CB3_4_1I1ResidualEntropies_sound (k : Fin 17) : + (CB3_4_1I1ResidualEntropies k).Encloses (homogeneousEntropy + (residualLaw (below (shape 3 4 1)) (fun u => (stageBLaw (shape 3 4 1) u : ℝ)) (stageBPriority (shape 3 4 1)) 1 (fun u a => (littleLaw (shape 3 4 1) u ((stageBPriority (shape 3 4 1)) 1) a : ℝ)) k)) := by + fin_cases k + · exact CB3_4_1I1R0H_sound + · exact CB3_4_1I1R1H_sound + · exact CB3_4_1I1R2H_sound + · exact CB3_4_1I1R3H_sound + · exact CB3_4_1I1R4H_sound + · exact CB3_4_1I1R5H_sound + · exact CB3_4_1I1R6H_sound + · exact CB3_4_1I1R7H_sound + · exact CB3_4_1I1R8H_sound + · exact CB3_4_1I1R9H_sound + · exact CB3_4_1I1R10H_sound + · exact CB3_4_1I1R11H_sound + · exact CB3_4_1I1R12H_sound + · exact CB3_4_1I1R13H_sound + · exact CB3_4_1I1R14H_sound + · exact CB3_4_1I1R15H_sound + · exact CB3_4_1I1R16H_sound +def CB3_4_1I1S3_0_1Value (a : Fin 6) : ℝ := (littleLaw (shape 3 4 1) (shape 3 0 1) ((stageBPriority (shape 3 4 1)) 1) a : ℝ) +def CB3_4_1I1S3_0_1E_4Log : Ball := .exact 0 +lemma CB3_4_1I1S3_0_1E_4Log_sound : CB3_4_1I1S3_0_1E_4Log.Encloses (Real.log (CB3_4_1I1S3_0_1Value (4 : Fin 6))) := by + exact log_exact_one_ball ((B3_4_1Little_sound (shape 3 0 1) ((stageBPriority (shape 3 4 1)) 1)) (4 : Fin 6)) +def CB3_4_1I1S3_0_1E_4 : Ball := ⟨0, 0⟩ +lemma CB3_4_1I1S3_0_1E_4_sound : CB3_4_1I1S3_0_1E_4.Encloses (Foundation.entropyTerm (CB3_4_1I1S3_0_1Value (4 : Fin 6))) := by + exact contains_sound (entropyTerm_ball ((B3_4_1Little_sound (shape 3 0 1) ((stageBPriority (shape 3 4 1)) 1)) (4 : Fin 6)) CB3_4_1I1S3_0_1E_4Log_sound) (by decide +kernel) +def CB3_4_1I1S3_0_1Terms (a : Fin 6) : Ball := + match a.val with + | 4 => ⟨0, 0⟩ + | _ => (.exact 0) +lemma CB3_4_1I1S3_0_1Terms_sound (a : Fin 6) : + (CB3_4_1I1S3_0_1Terms a).Encloses (Foundation.entropyTerm (CB3_4_1I1S3_0_1Value a)) := by + fin_cases a + · exact (entropyTerm_zero_ball ((B3_4_1Little_sound (shape 3 0 1) ((stageBPriority (shape 3 4 1)) 1)) (0 : Fin 6))) + · exact (entropyTerm_zero_ball ((B3_4_1Little_sound (shape 3 0 1) ((stageBPriority (shape 3 4 1)) 1)) (1 : Fin 6))) + · exact (entropyTerm_zero_ball ((B3_4_1Little_sound (shape 3 0 1) ((stageBPriority (shape 3 4 1)) 1)) (2 : Fin 6))) + · exact (entropyTerm_zero_ball ((B3_4_1Little_sound (shape 3 0 1) ((stageBPriority (shape 3 4 1)) 1)) (3 : Fin 6))) + · exact CB3_4_1I1S3_0_1E_4_sound + · exact (entropyTerm_zero_ball ((B3_4_1Little_sound (shape 3 0 1) ((stageBPriority (shape 3 4 1)) 1)) (5 : Fin 6))) +def CB3_4_1I1S3_0_1Entropy : Ball := ⟨0, 0⟩ +lemma CB3_4_1I1S3_0_1Entropy_sound : CB3_4_1I1S3_0_1Entropy.Encloses (Foundation.finiteEntropy CB3_4_1I1S3_0_1Value) := by + exact contains_sound (entropyFin_enclosed 6 CB3_4_1I1S3_0_1Value CB3_4_1I1S3_0_1Terms CB3_4_1I1S3_0_1Terms_sound) (by decide +kernel) +def CB3_4_1I1S3_0_1Mass : Ball := ⟨1, 0⟩ +lemma CB3_4_1I1S3_0_1Mass_sound : CB3_4_1I1S3_0_1Mass.Encloses (∑ a, CB3_4_1I1S3_0_1Value a) := by + exact contains_sound (finSumBall_sound 6 (B3_4_1Little (shape 3 0 1) ((stageBPriority (shape 3 4 1)) 1)) CB3_4_1I1S3_0_1Value (B3_4_1Little_sound (shape 3 0 1) ((stageBPriority (shape 3 4 1)) 1))) (by decide +kernel) +def CB3_4_1I1S3_0_1MassTermLog : Ball := .exact 0 +lemma CB3_4_1I1S3_0_1MassTermLog_sound : CB3_4_1I1S3_0_1MassTermLog.Encloses (Real.log ((∑ a, CB3_4_1I1S3_0_1Value a))) := by + exact log_exact_one_ball (CB3_4_1I1S3_0_1Mass_sound) +def CB3_4_1I1S3_0_1MassTerm : Ball := ⟨0, 0⟩ +lemma CB3_4_1I1S3_0_1MassTerm_sound : CB3_4_1I1S3_0_1MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB3_4_1I1S3_0_1Value a))) := by + exact contains_sound (entropyTerm_ball (CB3_4_1I1S3_0_1Mass_sound) CB3_4_1I1S3_0_1MassTermLog_sound) (by decide +kernel) +def CB3_4_1I1S3_0_1H : Ball := ⟨0, 0⟩ +lemma CB3_4_1I1S3_0_1H_sound : CB3_4_1I1S3_0_1H.Encloses (homogeneousEntropy CB3_4_1I1S3_0_1Value) := by + exact contains_sound (homogeneous_enclosed CB3_4_1I1S3_0_1Value CB3_4_1I1S3_0_1MassTerm_sound CB3_4_1I1S3_0_1Entropy_sound) (by decide +kernel) +def CB3_4_1I1Singles (s : Shape) : Ball := + match s 0, s 1, s 2 with + | 3, 0, 1 => CB3_4_1I1S3_0_1H + | _, _, _ => (.exact 0) +lemma CB3_4_1I1Singles_sound (u : Shape) (hu : u ∈ below (shape 3 4 1)) + (hd : designated (stageBPriority (shape 3 4 1)) 1 u) : + (CB3_4_1I1Singles u).Encloses (homogeneousEntropy ((fun u a => (littleLaw (shape 3 4 1) u ((stageBPriority (shape 3 4 1)) 1) a : ℝ)) u)) := by + rw [B3_4_1_below] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl + · exact (show ¬ designated (stageBPriority (shape 3 4 1)) 1 (shape 0 3 1) by decide +kernel) hd |>.elim + · exact (show ¬ designated (stageBPriority (shape 3 4 1)) 1 (shape 0 4 0) by decide +kernel) hd |>.elim + · exact (show ¬ designated (stageBPriority (shape 3 4 1)) 1 (shape 1 2 1) by decide +kernel) hd |>.elim + · exact (show ¬ designated (stageBPriority (shape 3 4 1)) 1 (shape 1 3 0) by decide +kernel) hd |>.elim + · exact (show ¬ designated (stageBPriority (shape 3 4 1)) 1 (shape 2 1 1) by decide +kernel) hd |>.elim + · exact (show ¬ designated (stageBPriority (shape 3 4 1)) 1 (shape 2 2 0) by decide +kernel) hd |>.elim + · exact CB3_4_1I1S3_0_1H_sound + · exact (show ¬ designated (stageBPriority (shape 3 4 1)) 1 (shape 3 1 0) by decide +kernel) hd |>.elim +def CB3_4_1I1Singleton : Ball := ⟨0, 0⟩ +lemma CB3_4_1I1Singleton_sound : CB3_4_1I1Singleton.Encloses + (singletonEntropy (below (shape 3 4 1)) (fun u => (stageBLaw (shape 3 4 1) u : ℝ)) (stageBPriority (shape 3 4 1)) 1 (fun u a => (littleLaw (shape 3 4 1) u ((stageBPriority (shape 3 4 1)) 1) a : ℝ))) := by + exact contains_sound (singletonBall_sound (below (shape 3 4 1)) B3_4_1Law (fun u => (stageBLaw (shape 3 4 1) u : ℝ)) (stageBPriority (shape 3 4 1)) 1 + CB3_4_1I1Singles (fun u a => (littleLaw (shape 3 4 1) u ((stageBPriority (shape 3 4 1)) 1) a : ℝ)) (fun u _ => B3_4_1Law_sound u) CB3_4_1I1Singles_sound) (by decide +kernel) +def CB3_4_1I1Group : Ball := ⟨(14583015880510777157000691694529 / 100000000000000000000000000000000), (135306960151 / 100000000000000000000000000000000)⟩ +lemma CB3_4_1I1Group_sound : CB3_4_1I1Group.Encloses + (groupedEntropy (below (shape 3 4 1)) (fun u => (stageBLaw (shape 3 4 1) u : ℝ)) (stageBPriority (shape 3 4 1)) 1 (fun u a => (littleLaw (shape 3 4 1) u ((stageBPriority (shape 3 4 1)) 1) a : ℝ))) := by + exact contains_sound (Ball.add_sound CB3_4_1I1Singleton_sound + (finSumBall_sound 17 CB3_4_1I1ResidualEntropies _ CB3_4_1I1ResidualEntropies_sound)) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CB3_4_1I1H : Ball := ⟨(2548953176747044879048452101939 / 3125000000000000000000000000000), (363615539699 / 100000000000000000000000000000000)⟩ +lemma CB3_4_1I1_sound : CB3_4_1I1H.Encloses (stageBCapacity (shape 3 4 1) 1) := by + have hb := contains_sound (Ball.add_sound CB3_4_1I1PairH_sound + (Ball.neg_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) CB3_4_1I1Group_sound))) + (show contains (.add CB3_4_1I1PairH (.neg (.mul (.exact 2) CB3_4_1I1Group))) CB3_4_1I1H = true by decide +kernel) + simp only [stageBCapacity, nativeCapacity, + show (1 : Fin 3) ≠ 0 by decide, ite_false] + change CB3_4_1I1H.Encloses (homogeneousEntropy CB3_4_1I1PairValue - _) + simpa only [sub_eq_add_neg] using hb + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/CapacityB/CapB3_4_1I2.lean b/lean/OAI/LinearAlgebra/MatrixFields/CapacityB/CapB3_4_1I2.lean new file mode 100644 index 0000000000000000000000000000000000000000..b3fb0d0ba3a17cee355a96d829520c66c9014c15 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/CapacityB/CapB3_4_1I2.lean @@ -0,0 +1,1041 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Certificates.Terminal3_4_1 + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CB3_4_1I2PairValue (a : PairSlot) : ℝ := pairLaw (below (shape 3 4 1)) (shape 3 4 1) (fun u => (stageBLaw (shape 3 4 1) u : ℝ)) (fun u a => (littleLaw (shape 3 4 1) u ((stageBPriority (shape 3 4 1)) 2) a : ℝ)) a +def CB3_4_1I2PairRaw (a : PairSlot) : Ball := pairLawBall (below (shape 3 4 1)) (shape 3 4 1) B3_4_1Law (fun u => B3_4_1Little u ((stageBPriority (shape 3 4 1)) 2)) a +lemma CB3_4_1I2PairRaw_sound (a : PairSlot) : + (CB3_4_1I2PairRaw a).Encloses (CB3_4_1I2PairValue a) := by + exact pairLawBall_sound_on (below (shape 3 4 1)) (shape 3 4 1) B3_4_1Law (fun u => (stageBLaw (shape 3 4 1) u : ℝ)) (fun u => B3_4_1Little u ((stageBPriority (shape 3 4 1)) 2)) (fun u a => (littleLaw (shape 3 4 1) u ((stageBPriority (shape 3 4 1)) 2) a : ℝ)) (fun u _ => B3_4_1Law_sound u) (fun u _ a => B3_4_1Little_sound u ((stageBPriority (shape 3 4 1)) 2) a) (fun u _ a => B3_4_1Little_sound (complement (shape 3 4 1) u) ((stageBPriority (shape 3 4 1)) 2) a) a +def CB3_4_1I2PairCertificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(3928825098347934527147869357681 / 50000000000000000000000000000000), (3 / 20000000000000000000000000000000)⟩ ⟨(19987367936124199122163599006087 / 100000000000000000000000000000000), (831961081 / 10000000000000000000000000000000)⟩ ⟨(-31796032267586910803561875860833 / 12500000000000000000000000000000), (21175823721 / 20000000000000000000000000000000)⟩ ⟨-4, 3928825098347934527147869357681, 3125000000000000000000000000000⟩, + .log ⟨(520812135624222942175390833 / 1562500000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(16679338355112702564543320603 / 6250000000000000000000000000000), (91758177 / 100000000000000000000000000000000)⟩ ⟨(-400320413403999497417390583495699 / 50000000000000000000000000000000), (137642855439 / 50000000000000000000000000000000)⟩ ⟨-12, 520812135624222942175390833, 381469726562500000000000000⟩, + .log ⟨(9488535396717968040641412979023 / 12500000000000000000000000000000), (1 / 5000000000000000000000000000000)⟩ ⟨(20923691258870017991567448097077 / 100000000000000000000000000000000), (32148408437 / 100000000000000000000000000000000)⟩ ⟨(-861388671303603496763461522071 / 3125000000000000000000000000000), (1323488981 / 3125000000000000000000000000000)⟩ ⟨-1, 9488535396717968040641412979023, 6250000000000000000000000000000⟩, + .log ⟨(517867354813334309888438519539 / 12500000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ ⟨(329753569574526925554405488917 / 2500000000000000000000000000000), (5263808551 / 100000000000000000000000000000000)⟩ ⟨(-2547011828489454452878027114059 / 800000000000000000000000000000), (63527471073 / 50000000000000000000000000000000)⟩ ⟨-5, 517867354813334309888438519539, 390625000000000000000000000000⟩, + .log ⟨(4774960498253614292750479569 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(509742808206758635628703 / 256000000000000000000000000), (14155923 / 20000000000000000000000000000000)⟩ ⟨(-834010185125469688776040981802161 / 100000000000000000000000000000000), (1185846143 / 400000000000000000000000000000)⟩ ⟨-13, 4774960498253614292750479569, 2441406250000000000000000000⟩] +lemma CB3_4_1I2PairCertificates_valid : + CB3_4_1I2PairCertificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB3_4_1I2PairCertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 4, 1 => 1 + | 5, 0 => 2 + | 2, 2 => 3 + | 2, 3 => 4 + | 3, 2 => 4 + | 3, 3 => 5 + | 1, 4 => 1 + | 0, 5 => 2 + | _, _ => 0 +def CB3_4_1I2PairP (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CB3_4_1I2PairCertificates (CB3_4_1I2PairCertificateIndex a)).input +lemma CB3_4_1I2PairP_check : ∀ a : PairSlot, contains (CB3_4_1I2PairRaw a) (CB3_4_1I2PairP a) = true := by + decide +kernel +lemma CB3_4_1I2PairP_sound (a : PairSlot) : + (CB3_4_1I2PairP a).Encloses (CB3_4_1I2PairValue a) := + contains_sound (CB3_4_1I2PairRaw_sound a) (CB3_4_1I2PairP_check a) +def CB3_4_1I2PairTerms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CB3_4_1I2PairCertificates (CB3_4_1I2PairCertificateIndex a)).output +lemma CB3_4_1I2PairTerms_sound (a : PairSlot) : + (CB3_4_1I2PairTerms a).Encloses (Foundation.entropyTerm (CB3_4_1I2PairValue a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB3_4_1I2PairCertificates_valid + (CB3_4_1I2PairCertificateIndex a) (CB3_4_1I2PairP_sound a) +def CB3_4_1I2PairEntropy : Ball := ⟨(44005784904449970927177466795641 / 50000000000000000000000000000000), (7446192891 / 12500000000000000000000000000000)⟩ +lemma CB3_4_1I2PairEntropy_sound : CB3_4_1I2PairEntropy.Encloses (Foundation.finiteEntropy CB3_4_1I2PairValue) := by + exact contains_sound (entropyPair_enclosed CB3_4_1I2PairValue CB3_4_1I2PairTerms CB3_4_1I2PairTerms_sound) (by decide +kernel) +def CB3_4_1I2PairMass : Ball := ⟨(100000000000000000000000000000001 / 100000000000000000000000000000000), (57 / 100000000000000000000000000000000)⟩ +lemma CB3_4_1I2PairMass_sound : CB3_4_1I2PairMass.Encloses (∑ a, CB3_4_1I2PairValue a) := by + exact contains_sound (pairSumBall_sound CB3_4_1I2PairP CB3_4_1I2PairValue CB3_4_1I2PairP_sound) (by decide +kernel) +def CB3_4_1I2PairMassTermLogWitness : LogWitness := ⟨0, 100000000000000000000000000000001, 100000000000000000000000000000000⟩ +def CB3_4_1I2PairMassTermLog : Ball := ⟨(1 / 100000000000000000000000000000000), (21175823739 / 100000000000000000000000000000000)⟩ +lemma CB3_4_1I2PairMassTermLog_sound : CB3_4_1I2PairMassTermLog.Encloses (Real.log ((∑ a, CB3_4_1I2PairValue a))) := by + exact checkLog_sound logTwoBall_sound (CB3_4_1I2PairMass_sound) (w := CB3_4_1I2PairMassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB3_4_1I2PairMassTerm : Ball := ⟨(-1 / 100000000000000000000000000000000), (1058791187 / 5000000000000000000000000000000)⟩ +lemma CB3_4_1I2PairMassTerm_sound : CB3_4_1I2PairMassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB3_4_1I2PairValue a))) := by + exact contains_sound (entropyTerm_ball (CB3_4_1I2PairMass_sound) CB3_4_1I2PairMassTermLog_sound) (by decide +kernel) +def CB3_4_1I2PairH : Ball := ⟨(88011569808899941854354933591283 / 100000000000000000000000000000000), (20186341717 / 25000000000000000000000000000000)⟩ +lemma CB3_4_1I2PairH_sound : CB3_4_1I2PairH.Encloses (homogeneousEntropy CB3_4_1I2PairValue) := by + exact contains_sound (homogeneous_enclosed CB3_4_1I2PairValue CB3_4_1I2PairMassTerm_sound CB3_4_1I2PairEntropy_sound) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CB3_4_1I2R0Value (a : Fin 6) : ℝ := residualLaw (below (shape 3 4 1)) (fun u => (stageBLaw (shape 3 4 1) u : ℝ)) (stageBPriority (shape 3 4 1)) 2 (fun u a => (littleLaw (shape 3 4 1) u ((stageBPriority (shape 3 4 1)) 2) a : ℝ)) 0 a +def CB3_4_1I2R0Raw (a : Fin 6) : Ball := residualBall (below (shape 3 4 1)) B3_4_1Law (stageBPriority (shape 3 4 1)) 2 (fun u => B3_4_1Little u ((stageBPriority (shape 3 4 1)) 2)) 0 a +lemma CB3_4_1I2R0Raw_sound (a : Fin 6) : + (CB3_4_1I2R0Raw a).Encloses (CB3_4_1I2R0Value a) := by + exact residualBall_sound_on (below (shape 3 4 1)) B3_4_1Law (fun u => (stageBLaw (shape 3 4 1) u : ℝ)) (stageBPriority (shape 3 4 1)) 2 (fun u => B3_4_1Little u ((stageBPriority (shape 3 4 1)) 2)) (fun u a => (littleLaw (shape 3 4 1) u ((stageBPriority (shape 3 4 1)) 2) a : ℝ)) (fun u _ => B3_4_1Law_sound u) (fun u _ a => B3_4_1Little_sound u ((stageBPriority (shape 3 4 1)) 2) a) 0 a +def CB3_4_1I2R0Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(520812135624222942175390833 / 1562500000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(16679338355112702564543320603 / 6250000000000000000000000000000), (91758177 / 100000000000000000000000000000000)⟩ ⟨(-400320413403999497417390583495699 / 50000000000000000000000000000000), (137642855439 / 50000000000000000000000000000000)⟩ ⟨-12, 520812135624222942175390833, 381469726562500000000000000⟩] +lemma CB3_4_1I2R0Certificates_valid : + CB3_4_1I2R0Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB3_4_1I2R0CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | 0 => 1 + | _ => 0 +def CB3_4_1I2R0P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_4_1I2R0Certificates (CB3_4_1I2R0CertificateIndex a)).input +lemma CB3_4_1I2R0P_check : ∀ a : Fin 6, contains (CB3_4_1I2R0Raw a) (CB3_4_1I2R0P a) = true := by + decide +kernel +lemma CB3_4_1I2R0P_sound (a : Fin 6) : + (CB3_4_1I2R0P a).Encloses (CB3_4_1I2R0Value a) := + contains_sound (CB3_4_1I2R0Raw_sound a) (CB3_4_1I2R0P_check a) +def CB3_4_1I2R0Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_4_1I2R0Certificates (CB3_4_1I2R0CertificateIndex a)).output +lemma CB3_4_1I2R0Terms_sound (a : Fin 6) : + (CB3_4_1I2R0Terms a).Encloses (Foundation.entropyTerm (CB3_4_1I2R0Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB3_4_1I2R0Certificates_valid + (CB3_4_1I2R0CertificateIndex a) (CB3_4_1I2R0P_sound a) +def CB3_4_1I2R0Entropy : Ball := ⟨(16679338355112702564543320603 / 6250000000000000000000000000000), (91758177 / 100000000000000000000000000000000)⟩ +lemma CB3_4_1I2R0Entropy_sound : CB3_4_1I2R0Entropy.Encloses (Foundation.finiteEntropy CB3_4_1I2R0Value) := by + exact contains_sound (entropyFin_enclosed 6 CB3_4_1I2R0Value CB3_4_1I2R0Terms CB3_4_1I2R0Terms_sound) (by decide +kernel) +def CB3_4_1I2R0Mass : Ball := ⟨(520812135624222942175390833 / 1562500000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ +lemma CB3_4_1I2R0Mass_sound : CB3_4_1I2R0Mass.Encloses (∑ a, CB3_4_1I2R0Value a) := by + exact contains_sound (finSumBall_sound 6 CB3_4_1I2R0P CB3_4_1I2R0Value CB3_4_1I2R0P_sound) (by decide +kernel) +def CB3_4_1I2R0MassTermLogWitness : LogWitness := ⟨-12, 520812135624222942175390833, 381469726562500000000000000⟩ +def CB3_4_1I2R0MassTermLog : Ball := ⟨(-400320413403999497417390583495699 / 50000000000000000000000000000000), (137642855439 / 50000000000000000000000000000000)⟩ +lemma CB3_4_1I2R0MassTermLog_sound : CB3_4_1I2R0MassTermLog.Encloses (Real.log ((∑ a, CB3_4_1I2R0Value a))) := by + exact checkLog_sound logTwoBall_sound (CB3_4_1I2R0Mass_sound) (w := CB3_4_1I2R0MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB3_4_1I2R0MassTerm : Ball := ⟨(16679338355112702564543320603 / 6250000000000000000000000000000), (91758177 / 100000000000000000000000000000000)⟩ +lemma CB3_4_1I2R0MassTerm_sound : CB3_4_1I2R0MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB3_4_1I2R0Value a))) := by + exact contains_sound (entropyTerm_ball (CB3_4_1I2R0Mass_sound) CB3_4_1I2R0MassTermLog_sound) (by decide +kernel) +def CB3_4_1I2R0H : Ball := ⟨0, (91758177 / 50000000000000000000000000000000)⟩ +lemma CB3_4_1I2R0H_sound : CB3_4_1I2R0H.Encloses (homogeneousEntropy CB3_4_1I2R0Value) := by + exact contains_sound (homogeneous_enclosed CB3_4_1I2R0Value CB3_4_1I2R0MassTerm_sound CB3_4_1I2R0Entropy_sound) (by decide +kernel) +def CB3_4_1I2R1Value (a : Fin 6) : ℝ := residualLaw (below (shape 3 4 1)) (fun u => (stageBLaw (shape 3 4 1) u : ℝ)) (stageBPriority (shape 3 4 1)) 2 (fun u a => (littleLaw (shape 3 4 1) u ((stageBPriority (shape 3 4 1)) 2) a : ℝ)) 1 a +def CB3_4_1I2R1Raw (a : Fin 6) : Ball := residualBall (below (shape 3 4 1)) B3_4_1Law (stageBPriority (shape 3 4 1)) 2 (fun u => B3_4_1Little u ((stageBPriority (shape 3 4 1)) 2)) 1 a +lemma CB3_4_1I2R1Raw_sound (a : Fin 6) : + (CB3_4_1I2R1Raw a).Encloses (CB3_4_1I2R1Value a) := by + exact residualBall_sound_on (below (shape 3 4 1)) B3_4_1Law (fun u => (stageBLaw (shape 3 4 1) u : ℝ)) (stageBPriority (shape 3 4 1)) 2 (fun u => B3_4_1Little u ((stageBPriority (shape 3 4 1)) 2)) (fun u a => (littleLaw (shape 3 4 1) u ((stageBPriority (shape 3 4 1)) 2) a : ℝ)) (fun u _ => B3_4_1Law_sound u) (fun u _ a => B3_4_1Little_sound u ((stageBPriority (shape 3 4 1)) 2) a) 1 a +def CB3_4_1I2R1Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(3281874448442126136287678136153 / 50000000000000000000000000000000), (1 / 10000000000000000000000000000000)⟩ ⟨(8938540382577431431906908594729 / 50000000000000000000000000000000), (1389927901 / 20000000000000000000000000000000)⟩ ⟨(-54472165361599798966956263951357 / 20000000000000000000000000000000), (52939559283 / 50000000000000000000000000000000)⟩ ⟨-4, 3281874448442126136287678136153, 3125000000000000000000000000000⟩] +lemma CB3_4_1I2R1Certificates_valid : + CB3_4_1I2R1Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB3_4_1I2R1CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | 1 => 1 + | _ => 0 +def CB3_4_1I2R1P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_4_1I2R1Certificates (CB3_4_1I2R1CertificateIndex a)).input +lemma CB3_4_1I2R1P_check : ∀ a : Fin 6, contains (CB3_4_1I2R1Raw a) (CB3_4_1I2R1P a) = true := by + decide +kernel +lemma CB3_4_1I2R1P_sound (a : Fin 6) : + (CB3_4_1I2R1P a).Encloses (CB3_4_1I2R1Value a) := + contains_sound (CB3_4_1I2R1Raw_sound a) (CB3_4_1I2R1P_check a) +def CB3_4_1I2R1Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_4_1I2R1Certificates (CB3_4_1I2R1CertificateIndex a)).output +lemma CB3_4_1I2R1Terms_sound (a : Fin 6) : + (CB3_4_1I2R1Terms a).Encloses (Foundation.entropyTerm (CB3_4_1I2R1Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB3_4_1I2R1Certificates_valid + (CB3_4_1I2R1CertificateIndex a) (CB3_4_1I2R1P_sound a) +def CB3_4_1I2R1Entropy : Ball := ⟨(8938540382577431431906908594729 / 50000000000000000000000000000000), (1389927901 / 20000000000000000000000000000000)⟩ +lemma CB3_4_1I2R1Entropy_sound : CB3_4_1I2R1Entropy.Encloses (Foundation.finiteEntropy CB3_4_1I2R1Value) := by + exact contains_sound (entropyFin_enclosed 6 CB3_4_1I2R1Value CB3_4_1I2R1Terms CB3_4_1I2R1Terms_sound) (by decide +kernel) +def CB3_4_1I2R1Mass : Ball := ⟨(3281874448442126136287678136153 / 50000000000000000000000000000000), (1 / 10000000000000000000000000000000)⟩ +lemma CB3_4_1I2R1Mass_sound : CB3_4_1I2R1Mass.Encloses (∑ a, CB3_4_1I2R1Value a) := by + exact contains_sound (finSumBall_sound 6 CB3_4_1I2R1P CB3_4_1I2R1Value CB3_4_1I2R1P_sound) (by decide +kernel) +def CB3_4_1I2R1MassTermLogWitness : LogWitness := ⟨-4, 3281874448442126136287678136153, 3125000000000000000000000000000⟩ +def CB3_4_1I2R1MassTermLog : Ball := ⟨(-54472165361599798966956263951357 / 20000000000000000000000000000000), (52939559283 / 50000000000000000000000000000000)⟩ +lemma CB3_4_1I2R1MassTermLog_sound : CB3_4_1I2R1MassTermLog.Encloses (Real.log ((∑ a, CB3_4_1I2R1Value a))) := by + exact checkLog_sound logTwoBall_sound (CB3_4_1I2R1Mass_sound) (w := CB3_4_1I2R1MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB3_4_1I2R1MassTerm : Ball := ⟨(8938540382577431431906908594729 / 50000000000000000000000000000000), (1389927901 / 20000000000000000000000000000000)⟩ +lemma CB3_4_1I2R1MassTerm_sound : CB3_4_1I2R1MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB3_4_1I2R1Value a))) := by + exact contains_sound (entropyTerm_ball (CB3_4_1I2R1Mass_sound) CB3_4_1I2R1MassTermLog_sound) (by decide +kernel) +def CB3_4_1I2R1H : Ball := ⟨0, (1389927901 / 10000000000000000000000000000000)⟩ +lemma CB3_4_1I2R1H_sound : CB3_4_1I2R1H.Encloses (homogeneousEntropy CB3_4_1I2R1Value) := by + exact contains_sound (homogeneous_enclosed CB3_4_1I2R1Value CB3_4_1I2R1MassTerm_sound CB3_4_1I2R1Entropy_sound) (by decide +kernel) +def CB3_4_1I2R2Value (a : Fin 6) : ℝ := residualLaw (below (shape 3 4 1)) (fun u => (stageBLaw (shape 3 4 1) u : ℝ)) (stageBPriority (shape 3 4 1)) 2 (fun u a => (littleLaw (shape 3 4 1) u ((stageBPriority (shape 3 4 1)) 2) a : ℝ)) 2 a +def CB3_4_1I2R2Raw (a : Fin 6) : Ball := residualBall (below (shape 3 4 1)) B3_4_1Law (stageBPriority (shape 3 4 1)) 2 (fun u => B3_4_1Little u ((stageBPriority (shape 3 4 1)) 2)) 2 a +lemma CB3_4_1I2R2Raw_sound (a : Fin 6) : + (CB3_4_1I2R2Raw a).Encloses (CB3_4_1I2R2Value a) := by + exact residualBall_sound_on (below (shape 3 4 1)) B3_4_1Law (fun u => (stageBLaw (shape 3 4 1) u : ℝ)) (stageBPriority (shape 3 4 1)) 2 (fun u => B3_4_1Little u ((stageBPriority (shape 3 4 1)) 2)) (fun u a => (littleLaw (shape 3 4 1) u ((stageBPriority (shape 3 4 1)) 2) a : ℝ)) (fun u _ => B3_4_1Law_sound u) (fun u _ a => B3_4_1Little_sound u ((stageBPriority (shape 3 4 1)) 2) a) 2 a +def CB3_4_1I2R2Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(41984669896982159471864659199217 / 100000000000000000000000000000000), (3 / 25000000000000000000000000000000)⟩ ⟨(36437052275442200078796949197613 / 100000000000000000000000000000000), (26671799037 / 100000000000000000000000000000000)⟩ ⟨(-43393281839356893658069655575187 / 50000000000000000000000000000000), (63527471077 / 100000000000000000000000000000000)⟩ ⟨-2, 41984669896982159471864659199217, 25000000000000000000000000000000⟩, + .log ⟨(124347929642021205540377072109 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(831867995406101194998570759277 / 100000000000000000000000000000000), (28964869 / 10000000000000000000000000000000)⟩ ⟨(-66898419443003413836050739496439 / 10000000000000000000000000000000), (58233515329 / 25000000000000000000000000000000)⟩ ⟨-10, 124347929642021205540377072109, 97656250000000000000000000000⟩] +lemma CB3_4_1I2R2Certificates_valid : + CB3_4_1I2R2Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB3_4_1I2R2CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | 2 => 1 + | 3 => 2 + | _ => 0 +def CB3_4_1I2R2P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_4_1I2R2Certificates (CB3_4_1I2R2CertificateIndex a)).input +lemma CB3_4_1I2R2P_check : ∀ a : Fin 6, contains (CB3_4_1I2R2Raw a) (CB3_4_1I2R2P a) = true := by + decide +kernel +lemma CB3_4_1I2R2P_sound (a : Fin 6) : + (CB3_4_1I2R2P a).Encloses (CB3_4_1I2R2Value a) := + contains_sound (CB3_4_1I2R2Raw_sound a) (CB3_4_1I2R2P_check a) +def CB3_4_1I2R2Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_4_1I2R2Certificates (CB3_4_1I2R2CertificateIndex a)).output +lemma CB3_4_1I2R2Terms_sound (a : Fin 6) : + (CB3_4_1I2R2Terms a).Encloses (Foundation.entropyTerm (CB3_4_1I2R2Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB3_4_1I2R2Certificates_valid + (CB3_4_1I2R2CertificateIndex a) (CB3_4_1I2R2P_sound a) +def CB3_4_1I2R2Entropy : Ball := ⟨(3726892027084830127379551995689 / 10000000000000000000000000000000), (26961447727 / 100000000000000000000000000000000)⟩ +lemma CB3_4_1I2R2Entropy_sound : CB3_4_1I2R2Entropy.Encloses (Foundation.finiteEntropy CB3_4_1I2R2Value) := by + exact contains_sound (entropyFin_enclosed 6 CB3_4_1I2R2Value CB3_4_1I2R2Terms CB3_4_1I2R2Terms_sound) (by decide +kernel) +def CB3_4_1I2R2Mass : Ball := ⟨(21054508913312090338702518135663 / 50000000000000000000000000000000), (13 / 100000000000000000000000000000000)⟩ +lemma CB3_4_1I2R2Mass_sound : CB3_4_1I2R2Mass.Encloses (∑ a, CB3_4_1I2R2Value a) := by + exact contains_sound (finSumBall_sound 6 CB3_4_1I2R2P CB3_4_1I2R2Value CB3_4_1I2R2P_sound) (by decide +kernel) +def CB3_4_1I2R2MassTermLogWitness : LogWitness := ⟨-2, 21054508913312090338702518135663, 12500000000000000000000000000000⟩ +def CB3_4_1I2R2MassTermLog : Ball := ⟨(-43245413403999497417390678973909 / 50000000000000000000000000000000), (63527471079 / 100000000000000000000000000000000)⟩ +lemma CB3_4_1I2R2MassTermLog_sound : CB3_4_1I2R2MassTermLog.Encloses (Real.log ((∑ a, CB3_4_1I2R2Value a))) := by + exact checkLog_sound logTwoBall_sound (CB3_4_1I2R2Mass_sound) (w := CB3_4_1I2R2MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB3_4_1I2R2MassTerm : Ball := ⟨(36420437678974942557542286102427 / 100000000000000000000000000000000), (13375397067 / 50000000000000000000000000000000)⟩ +lemma CB3_4_1I2R2MassTerm_sound : CB3_4_1I2R2MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB3_4_1I2R2Value a))) := by + exact contains_sound (entropyTerm_ball (CB3_4_1I2R2Mass_sound) CB3_4_1I2R2MassTermLog_sound) (by decide +kernel) +def CB3_4_1I2R2H : Ball := ⟨(848482591873358716253233854463 / 100000000000000000000000000000000), (53712241861 / 100000000000000000000000000000000)⟩ +lemma CB3_4_1I2R2H_sound : CB3_4_1I2R2H.Encloses (homogeneousEntropy CB3_4_1I2R2Value) := by + exact contains_sound (homogeneous_enclosed CB3_4_1I2R2Value CB3_4_1I2R2MassTerm_sound CB3_4_1I2R2Entropy_sound) (by decide +kernel) +def CB3_4_1I2R3Value (a : Fin 6) : ℝ := residualLaw (below (shape 3 4 1)) (fun u => (stageBLaw (shape 3 4 1) u : ℝ)) (stageBPriority (shape 3 4 1)) 2 (fun u a => (littleLaw (shape 3 4 1) u ((stageBPriority (shape 3 4 1)) 2) a : ℝ)) 3 a +def CB3_4_1I2R3Raw (a : Fin 6) : Ball := residualBall (below (shape 3 4 1)) B3_4_1Law (stageBPriority (shape 3 4 1)) 2 (fun u => B3_4_1Little u ((stageBPriority (shape 3 4 1)) 2)) 3 a +lemma CB3_4_1I2R3Raw_sound (a : Fin 6) : + (CB3_4_1I2R3Raw a).Encloses (CB3_4_1I2R3Value a) := by + exact residualBall_sound_on (below (shape 3 4 1)) B3_4_1Law (fun u => (stageBLaw (shape 3 4 1) u : ℝ)) (stageBPriority (shape 3 4 1)) 2 (fun u => B3_4_1Little u ((stageBPriority (shape 3 4 1)) 2)) (fun u a => (littleLaw (shape 3 4 1) u ((stageBPriority (shape 3 4 1)) 2) a : ℝ)) (fun u _ => B3_4_1Law_sound u) (fun u _ a => B3_4_1Little_sound u ((stageBPriority (shape 3 4 1)) 2) a) 3 a +def CB3_4_1I2R3Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB3_4_1I2R3Certificates_valid : + CB3_4_1I2R3Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB3_4_1I2R3CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB3_4_1I2R3P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_4_1I2R3Certificates (CB3_4_1I2R3CertificateIndex a)).input +lemma CB3_4_1I2R3P_check : ∀ a : Fin 6, contains (CB3_4_1I2R3Raw a) (CB3_4_1I2R3P a) = true := by + decide +kernel +lemma CB3_4_1I2R3P_sound (a : Fin 6) : + (CB3_4_1I2R3P a).Encloses (CB3_4_1I2R3Value a) := + contains_sound (CB3_4_1I2R3Raw_sound a) (CB3_4_1I2R3P_check a) +def CB3_4_1I2R3Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_4_1I2R3Certificates (CB3_4_1I2R3CertificateIndex a)).output +lemma CB3_4_1I2R3Terms_sound (a : Fin 6) : + (CB3_4_1I2R3Terms a).Encloses (Foundation.entropyTerm (CB3_4_1I2R3Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB3_4_1I2R3Certificates_valid + (CB3_4_1I2R3CertificateIndex a) (CB3_4_1I2R3P_sound a) +def CB3_4_1I2R3Entropy : Ball := ⟨0, 0⟩ +lemma CB3_4_1I2R3Entropy_sound : CB3_4_1I2R3Entropy.Encloses (Foundation.finiteEntropy CB3_4_1I2R3Value) := by + exact contains_sound (entropyFin_enclosed 6 CB3_4_1I2R3Value CB3_4_1I2R3Terms CB3_4_1I2R3Terms_sound) (by decide +kernel) +def CB3_4_1I2R3Mass : Ball := ⟨0, 0⟩ +lemma CB3_4_1I2R3Mass_sound : CB3_4_1I2R3Mass.Encloses (∑ a, CB3_4_1I2R3Value a) := by + exact contains_sound (finSumBall_sound 6 CB3_4_1I2R3P CB3_4_1I2R3Value CB3_4_1I2R3P_sound) (by decide +kernel) +def CB3_4_1I2R3MassTerm : Ball := .exact 0 +lemma CB3_4_1I2R3MassTerm_sound : CB3_4_1I2R3MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB3_4_1I2R3Value a))) := + entropyTerm_zero_ball (CB3_4_1I2R3Mass_sound) +def CB3_4_1I2R3H : Ball := ⟨0, 0⟩ +lemma CB3_4_1I2R3H_sound : CB3_4_1I2R3H.Encloses (homogeneousEntropy CB3_4_1I2R3Value) := by + exact contains_sound (homogeneous_enclosed CB3_4_1I2R3Value CB3_4_1I2R3MassTerm_sound CB3_4_1I2R3Entropy_sound) (by decide +kernel) +def CB3_4_1I2R4Value (a : Fin 6) : ℝ := residualLaw (below (shape 3 4 1)) (fun u => (stageBLaw (shape 3 4 1) u : ℝ)) (stageBPriority (shape 3 4 1)) 2 (fun u a => (littleLaw (shape 3 4 1) u ((stageBPriority (shape 3 4 1)) 2) a : ℝ)) 4 a +def CB3_4_1I2R4Raw (a : Fin 6) : Ball := residualBall (below (shape 3 4 1)) B3_4_1Law (stageBPriority (shape 3 4 1)) 2 (fun u => B3_4_1Little u ((stageBPriority (shape 3 4 1)) 2)) 4 a +lemma CB3_4_1I2R4Raw_sound (a : Fin 6) : + (CB3_4_1I2R4Raw a).Encloses (CB3_4_1I2R4Value a) := by + exact residualBall_sound_on (below (shape 3 4 1)) B3_4_1Law (fun u => (stageBLaw (shape 3 4 1) u : ℝ)) (stageBPriority (shape 3 4 1)) 2 (fun u => B3_4_1Little u ((stageBPriority (shape 3 4 1)) 2)) (fun u a => (littleLaw (shape 3 4 1) u ((stageBPriority (shape 3 4 1)) 2) a : ℝ)) (fun u _ => B3_4_1Law_sound u) (fun u _ a => B3_4_1Little_sound u ((stageBPriority (shape 3 4 1)) 2) a) 4 a +def CB3_4_1I2R4Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB3_4_1I2R4Certificates_valid : + CB3_4_1I2R4Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB3_4_1I2R4CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB3_4_1I2R4P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_4_1I2R4Certificates (CB3_4_1I2R4CertificateIndex a)).input +lemma CB3_4_1I2R4P_check : ∀ a : Fin 6, contains (CB3_4_1I2R4Raw a) (CB3_4_1I2R4P a) = true := by + decide +kernel +lemma CB3_4_1I2R4P_sound (a : Fin 6) : + (CB3_4_1I2R4P a).Encloses (CB3_4_1I2R4Value a) := + contains_sound (CB3_4_1I2R4Raw_sound a) (CB3_4_1I2R4P_check a) +def CB3_4_1I2R4Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_4_1I2R4Certificates (CB3_4_1I2R4CertificateIndex a)).output +lemma CB3_4_1I2R4Terms_sound (a : Fin 6) : + (CB3_4_1I2R4Terms a).Encloses (Foundation.entropyTerm (CB3_4_1I2R4Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB3_4_1I2R4Certificates_valid + (CB3_4_1I2R4CertificateIndex a) (CB3_4_1I2R4P_sound a) +def CB3_4_1I2R4Entropy : Ball := ⟨0, 0⟩ +lemma CB3_4_1I2R4Entropy_sound : CB3_4_1I2R4Entropy.Encloses (Foundation.finiteEntropy CB3_4_1I2R4Value) := by + exact contains_sound (entropyFin_enclosed 6 CB3_4_1I2R4Value CB3_4_1I2R4Terms CB3_4_1I2R4Terms_sound) (by decide +kernel) +def CB3_4_1I2R4Mass : Ball := ⟨0, 0⟩ +lemma CB3_4_1I2R4Mass_sound : CB3_4_1I2R4Mass.Encloses (∑ a, CB3_4_1I2R4Value a) := by + exact contains_sound (finSumBall_sound 6 CB3_4_1I2R4P CB3_4_1I2R4Value CB3_4_1I2R4P_sound) (by decide +kernel) +def CB3_4_1I2R4MassTerm : Ball := .exact 0 +lemma CB3_4_1I2R4MassTerm_sound : CB3_4_1I2R4MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB3_4_1I2R4Value a))) := + entropyTerm_zero_ball (CB3_4_1I2R4Mass_sound) +def CB3_4_1I2R4H : Ball := ⟨0, 0⟩ +lemma CB3_4_1I2R4H_sound : CB3_4_1I2R4H.Encloses (homogeneousEntropy CB3_4_1I2R4Value) := by + exact contains_sound (homogeneous_enclosed CB3_4_1I2R4Value CB3_4_1I2R4MassTerm_sound CB3_4_1I2R4Entropy_sound) (by decide +kernel) +def CB3_4_1I2R5Value (a : Fin 6) : ℝ := residualLaw (below (shape 3 4 1)) (fun u => (stageBLaw (shape 3 4 1) u : ℝ)) (stageBPriority (shape 3 4 1)) 2 (fun u a => (littleLaw (shape 3 4 1) u ((stageBPriority (shape 3 4 1)) 2) a : ℝ)) 5 a +def CB3_4_1I2R5Raw (a : Fin 6) : Ball := residualBall (below (shape 3 4 1)) B3_4_1Law (stageBPriority (shape 3 4 1)) 2 (fun u => B3_4_1Little u ((stageBPriority (shape 3 4 1)) 2)) 5 a +lemma CB3_4_1I2R5Raw_sound (a : Fin 6) : + (CB3_4_1I2R5Raw a).Encloses (CB3_4_1I2R5Value a) := by + exact residualBall_sound_on (below (shape 3 4 1)) B3_4_1Law (fun u => (stageBLaw (shape 3 4 1) u : ℝ)) (stageBPriority (shape 3 4 1)) 2 (fun u => B3_4_1Little u ((stageBPriority (shape 3 4 1)) 2)) (fun u a => (littleLaw (shape 3 4 1) u ((stageBPriority (shape 3 4 1)) 2) a : ℝ)) (fun u _ => B3_4_1Law_sound u) (fun u _ a => B3_4_1Little_sound u ((stageBPriority (shape 3 4 1)) 2) a) 5 a +def CB3_4_1I2R5Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB3_4_1I2R5Certificates_valid : + CB3_4_1I2R5Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB3_4_1I2R5CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB3_4_1I2R5P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_4_1I2R5Certificates (CB3_4_1I2R5CertificateIndex a)).input +lemma CB3_4_1I2R5P_check : ∀ a : Fin 6, contains (CB3_4_1I2R5Raw a) (CB3_4_1I2R5P a) = true := by + decide +kernel +lemma CB3_4_1I2R5P_sound (a : Fin 6) : + (CB3_4_1I2R5P a).Encloses (CB3_4_1I2R5Value a) := + contains_sound (CB3_4_1I2R5Raw_sound a) (CB3_4_1I2R5P_check a) +def CB3_4_1I2R5Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_4_1I2R5Certificates (CB3_4_1I2R5CertificateIndex a)).output +lemma CB3_4_1I2R5Terms_sound (a : Fin 6) : + (CB3_4_1I2R5Terms a).Encloses (Foundation.entropyTerm (CB3_4_1I2R5Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB3_4_1I2R5Certificates_valid + (CB3_4_1I2R5CertificateIndex a) (CB3_4_1I2R5P_sound a) +def CB3_4_1I2R5Entropy : Ball := ⟨0, 0⟩ +lemma CB3_4_1I2R5Entropy_sound : CB3_4_1I2R5Entropy.Encloses (Foundation.finiteEntropy CB3_4_1I2R5Value) := by + exact contains_sound (entropyFin_enclosed 6 CB3_4_1I2R5Value CB3_4_1I2R5Terms CB3_4_1I2R5Terms_sound) (by decide +kernel) +def CB3_4_1I2R5Mass : Ball := ⟨0, 0⟩ +lemma CB3_4_1I2R5Mass_sound : CB3_4_1I2R5Mass.Encloses (∑ a, CB3_4_1I2R5Value a) := by + exact contains_sound (finSumBall_sound 6 CB3_4_1I2R5P CB3_4_1I2R5Value CB3_4_1I2R5P_sound) (by decide +kernel) +def CB3_4_1I2R5MassTerm : Ball := .exact 0 +lemma CB3_4_1I2R5MassTerm_sound : CB3_4_1I2R5MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB3_4_1I2R5Value a))) := + entropyTerm_zero_ball (CB3_4_1I2R5Mass_sound) +def CB3_4_1I2R5H : Ball := ⟨0, 0⟩ +lemma CB3_4_1I2R5H_sound : CB3_4_1I2R5H.Encloses (homogeneousEntropy CB3_4_1I2R5Value) := by + exact contains_sound (homogeneous_enclosed CB3_4_1I2R5Value CB3_4_1I2R5MassTerm_sound CB3_4_1I2R5Entropy_sound) (by decide +kernel) +def CB3_4_1I2R6Value (a : Fin 6) : ℝ := residualLaw (below (shape 3 4 1)) (fun u => (stageBLaw (shape 3 4 1) u : ℝ)) (stageBPriority (shape 3 4 1)) 2 (fun u a => (littleLaw (shape 3 4 1) u ((stageBPriority (shape 3 4 1)) 2) a : ℝ)) 6 a +def CB3_4_1I2R6Raw (a : Fin 6) : Ball := residualBall (below (shape 3 4 1)) B3_4_1Law (stageBPriority (shape 3 4 1)) 2 (fun u => B3_4_1Little u ((stageBPriority (shape 3 4 1)) 2)) 6 a +lemma CB3_4_1I2R6Raw_sound (a : Fin 6) : + (CB3_4_1I2R6Raw a).Encloses (CB3_4_1I2R6Value a) := by + exact residualBall_sound_on (below (shape 3 4 1)) B3_4_1Law (fun u => (stageBLaw (shape 3 4 1) u : ℝ)) (stageBPriority (shape 3 4 1)) 2 (fun u => B3_4_1Little u ((stageBPriority (shape 3 4 1)) 2)) (fun u a => (littleLaw (shape 3 4 1) u ((stageBPriority (shape 3 4 1)) 2) a : ℝ)) (fun u _ => B3_4_1Law_sound u) (fun u _ a => B3_4_1Little_sound u ((stageBPriority (shape 3 4 1)) 2) a) 6 a +def CB3_4_1I2R6Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB3_4_1I2R6Certificates_valid : + CB3_4_1I2R6Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB3_4_1I2R6CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB3_4_1I2R6P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_4_1I2R6Certificates (CB3_4_1I2R6CertificateIndex a)).input +lemma CB3_4_1I2R6P_check : ∀ a : Fin 6, contains (CB3_4_1I2R6Raw a) (CB3_4_1I2R6P a) = true := by + decide +kernel +lemma CB3_4_1I2R6P_sound (a : Fin 6) : + (CB3_4_1I2R6P a).Encloses (CB3_4_1I2R6Value a) := + contains_sound (CB3_4_1I2R6Raw_sound a) (CB3_4_1I2R6P_check a) +def CB3_4_1I2R6Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_4_1I2R6Certificates (CB3_4_1I2R6CertificateIndex a)).output +lemma CB3_4_1I2R6Terms_sound (a : Fin 6) : + (CB3_4_1I2R6Terms a).Encloses (Foundation.entropyTerm (CB3_4_1I2R6Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB3_4_1I2R6Certificates_valid + (CB3_4_1I2R6CertificateIndex a) (CB3_4_1I2R6P_sound a) +def CB3_4_1I2R6Entropy : Ball := ⟨0, 0⟩ +lemma CB3_4_1I2R6Entropy_sound : CB3_4_1I2R6Entropy.Encloses (Foundation.finiteEntropy CB3_4_1I2R6Value) := by + exact contains_sound (entropyFin_enclosed 6 CB3_4_1I2R6Value CB3_4_1I2R6Terms CB3_4_1I2R6Terms_sound) (by decide +kernel) +def CB3_4_1I2R6Mass : Ball := ⟨0, 0⟩ +lemma CB3_4_1I2R6Mass_sound : CB3_4_1I2R6Mass.Encloses (∑ a, CB3_4_1I2R6Value a) := by + exact contains_sound (finSumBall_sound 6 CB3_4_1I2R6P CB3_4_1I2R6Value CB3_4_1I2R6P_sound) (by decide +kernel) +def CB3_4_1I2R6MassTerm : Ball := .exact 0 +lemma CB3_4_1I2R6MassTerm_sound : CB3_4_1I2R6MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB3_4_1I2R6Value a))) := + entropyTerm_zero_ball (CB3_4_1I2R6Mass_sound) +def CB3_4_1I2R6H : Ball := ⟨0, 0⟩ +lemma CB3_4_1I2R6H_sound : CB3_4_1I2R6H.Encloses (homogeneousEntropy CB3_4_1I2R6Value) := by + exact contains_sound (homogeneous_enclosed CB3_4_1I2R6Value CB3_4_1I2R6MassTerm_sound CB3_4_1I2R6Entropy_sound) (by decide +kernel) +def CB3_4_1I2R7Value (a : Fin 6) : ℝ := residualLaw (below (shape 3 4 1)) (fun u => (stageBLaw (shape 3 4 1) u : ℝ)) (stageBPriority (shape 3 4 1)) 2 (fun u a => (littleLaw (shape 3 4 1) u ((stageBPriority (shape 3 4 1)) 2) a : ℝ)) 7 a +def CB3_4_1I2R7Raw (a : Fin 6) : Ball := residualBall (below (shape 3 4 1)) B3_4_1Law (stageBPriority (shape 3 4 1)) 2 (fun u => B3_4_1Little u ((stageBPriority (shape 3 4 1)) 2)) 7 a +lemma CB3_4_1I2R7Raw_sound (a : Fin 6) : + (CB3_4_1I2R7Raw a).Encloses (CB3_4_1I2R7Value a) := by + exact residualBall_sound_on (below (shape 3 4 1)) B3_4_1Law (fun u => (stageBLaw (shape 3 4 1) u : ℝ)) (stageBPriority (shape 3 4 1)) 2 (fun u => B3_4_1Little u ((stageBPriority (shape 3 4 1)) 2)) (fun u a => (littleLaw (shape 3 4 1) u ((stageBPriority (shape 3 4 1)) 2) a : ℝ)) (fun u _ => B3_4_1Law_sound u) (fun u _ a => B3_4_1Little_sound u ((stageBPriority (shape 3 4 1)) 2) a) 7 a +def CB3_4_1I2R7Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB3_4_1I2R7Certificates_valid : + CB3_4_1I2R7Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB3_4_1I2R7CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB3_4_1I2R7P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_4_1I2R7Certificates (CB3_4_1I2R7CertificateIndex a)).input +lemma CB3_4_1I2R7P_check : ∀ a : Fin 6, contains (CB3_4_1I2R7Raw a) (CB3_4_1I2R7P a) = true := by + decide +kernel +lemma CB3_4_1I2R7P_sound (a : Fin 6) : + (CB3_4_1I2R7P a).Encloses (CB3_4_1I2R7Value a) := + contains_sound (CB3_4_1I2R7Raw_sound a) (CB3_4_1I2R7P_check a) +def CB3_4_1I2R7Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_4_1I2R7Certificates (CB3_4_1I2R7CertificateIndex a)).output +lemma CB3_4_1I2R7Terms_sound (a : Fin 6) : + (CB3_4_1I2R7Terms a).Encloses (Foundation.entropyTerm (CB3_4_1I2R7Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB3_4_1I2R7Certificates_valid + (CB3_4_1I2R7CertificateIndex a) (CB3_4_1I2R7P_sound a) +def CB3_4_1I2R7Entropy : Ball := ⟨0, 0⟩ +lemma CB3_4_1I2R7Entropy_sound : CB3_4_1I2R7Entropy.Encloses (Foundation.finiteEntropy CB3_4_1I2R7Value) := by + exact contains_sound (entropyFin_enclosed 6 CB3_4_1I2R7Value CB3_4_1I2R7Terms CB3_4_1I2R7Terms_sound) (by decide +kernel) +def CB3_4_1I2R7Mass : Ball := ⟨0, 0⟩ +lemma CB3_4_1I2R7Mass_sound : CB3_4_1I2R7Mass.Encloses (∑ a, CB3_4_1I2R7Value a) := by + exact contains_sound (finSumBall_sound 6 CB3_4_1I2R7P CB3_4_1I2R7Value CB3_4_1I2R7P_sound) (by decide +kernel) +def CB3_4_1I2R7MassTerm : Ball := .exact 0 +lemma CB3_4_1I2R7MassTerm_sound : CB3_4_1I2R7MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB3_4_1I2R7Value a))) := + entropyTerm_zero_ball (CB3_4_1I2R7Mass_sound) +def CB3_4_1I2R7H : Ball := ⟨0, 0⟩ +lemma CB3_4_1I2R7H_sound : CB3_4_1I2R7H.Encloses (homogeneousEntropy CB3_4_1I2R7Value) := by + exact contains_sound (homogeneous_enclosed CB3_4_1I2R7Value CB3_4_1I2R7MassTerm_sound CB3_4_1I2R7Entropy_sound) (by decide +kernel) +def CB3_4_1I2R8Value (a : Fin 6) : ℝ := residualLaw (below (shape 3 4 1)) (fun u => (stageBLaw (shape 3 4 1) u : ℝ)) (stageBPriority (shape 3 4 1)) 2 (fun u a => (littleLaw (shape 3 4 1) u ((stageBPriority (shape 3 4 1)) 2) a : ℝ)) 8 a +def CB3_4_1I2R8Raw (a : Fin 6) : Ball := residualBall (below (shape 3 4 1)) B3_4_1Law (stageBPriority (shape 3 4 1)) 2 (fun u => B3_4_1Little u ((stageBPriority (shape 3 4 1)) 2)) 8 a +lemma CB3_4_1I2R8Raw_sound (a : Fin 6) : + (CB3_4_1I2R8Raw a).Encloses (CB3_4_1I2R8Value a) := by + exact residualBall_sound_on (below (shape 3 4 1)) B3_4_1Law (fun u => (stageBLaw (shape 3 4 1) u : ℝ)) (stageBPriority (shape 3 4 1)) 2 (fun u => B3_4_1Little u ((stageBPriority (shape 3 4 1)) 2)) (fun u a => (littleLaw (shape 3 4 1) u ((stageBPriority (shape 3 4 1)) 2) a : ℝ)) (fun u _ => B3_4_1Law_sound u) (fun u _ a => B3_4_1Little_sound u ((stageBPriority (shape 3 4 1)) 2) a) 8 a +def CB3_4_1I2R8Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB3_4_1I2R8Certificates_valid : + CB3_4_1I2R8Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB3_4_1I2R8CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB3_4_1I2R8P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_4_1I2R8Certificates (CB3_4_1I2R8CertificateIndex a)).input +lemma CB3_4_1I2R8P_check : ∀ a : Fin 6, contains (CB3_4_1I2R8Raw a) (CB3_4_1I2R8P a) = true := by + decide +kernel +lemma CB3_4_1I2R8P_sound (a : Fin 6) : + (CB3_4_1I2R8P a).Encloses (CB3_4_1I2R8Value a) := + contains_sound (CB3_4_1I2R8Raw_sound a) (CB3_4_1I2R8P_check a) +def CB3_4_1I2R8Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_4_1I2R8Certificates (CB3_4_1I2R8CertificateIndex a)).output +lemma CB3_4_1I2R8Terms_sound (a : Fin 6) : + (CB3_4_1I2R8Terms a).Encloses (Foundation.entropyTerm (CB3_4_1I2R8Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB3_4_1I2R8Certificates_valid + (CB3_4_1I2R8CertificateIndex a) (CB3_4_1I2R8P_sound a) +def CB3_4_1I2R8Entropy : Ball := ⟨0, 0⟩ +lemma CB3_4_1I2R8Entropy_sound : CB3_4_1I2R8Entropy.Encloses (Foundation.finiteEntropy CB3_4_1I2R8Value) := by + exact contains_sound (entropyFin_enclosed 6 CB3_4_1I2R8Value CB3_4_1I2R8Terms CB3_4_1I2R8Terms_sound) (by decide +kernel) +def CB3_4_1I2R8Mass : Ball := ⟨0, 0⟩ +lemma CB3_4_1I2R8Mass_sound : CB3_4_1I2R8Mass.Encloses (∑ a, CB3_4_1I2R8Value a) := by + exact contains_sound (finSumBall_sound 6 CB3_4_1I2R8P CB3_4_1I2R8Value CB3_4_1I2R8P_sound) (by decide +kernel) +def CB3_4_1I2R8MassTerm : Ball := .exact 0 +lemma CB3_4_1I2R8MassTerm_sound : CB3_4_1I2R8MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB3_4_1I2R8Value a))) := + entropyTerm_zero_ball (CB3_4_1I2R8Mass_sound) +def CB3_4_1I2R8H : Ball := ⟨0, 0⟩ +lemma CB3_4_1I2R8H_sound : CB3_4_1I2R8H.Encloses (homogeneousEntropy CB3_4_1I2R8Value) := by + exact contains_sound (homogeneous_enclosed CB3_4_1I2R8Value CB3_4_1I2R8MassTerm_sound CB3_4_1I2R8Entropy_sound) (by decide +kernel) +def CB3_4_1I2R9Value (a : Fin 6) : ℝ := residualLaw (below (shape 3 4 1)) (fun u => (stageBLaw (shape 3 4 1) u : ℝ)) (stageBPriority (shape 3 4 1)) 2 (fun u a => (littleLaw (shape 3 4 1) u ((stageBPriority (shape 3 4 1)) 2) a : ℝ)) 9 a +def CB3_4_1I2R9Raw (a : Fin 6) : Ball := residualBall (below (shape 3 4 1)) B3_4_1Law (stageBPriority (shape 3 4 1)) 2 (fun u => B3_4_1Little u ((stageBPriority (shape 3 4 1)) 2)) 9 a +lemma CB3_4_1I2R9Raw_sound (a : Fin 6) : + (CB3_4_1I2R9Raw a).Encloses (CB3_4_1I2R9Value a) := by + exact residualBall_sound_on (below (shape 3 4 1)) B3_4_1Law (fun u => (stageBLaw (shape 3 4 1) u : ℝ)) (stageBPriority (shape 3 4 1)) 2 (fun u => B3_4_1Little u ((stageBPriority (shape 3 4 1)) 2)) (fun u a => (littleLaw (shape 3 4 1) u ((stageBPriority (shape 3 4 1)) 2) a : ℝ)) (fun u _ => B3_4_1Law_sound u) (fun u _ a => B3_4_1Little_sound u ((stageBPriority (shape 3 4 1)) 2) a) 9 a +def CB3_4_1I2R9Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB3_4_1I2R9Certificates_valid : + CB3_4_1I2R9Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB3_4_1I2R9CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB3_4_1I2R9P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_4_1I2R9Certificates (CB3_4_1I2R9CertificateIndex a)).input +lemma CB3_4_1I2R9P_check : ∀ a : Fin 6, contains (CB3_4_1I2R9Raw a) (CB3_4_1I2R9P a) = true := by + decide +kernel +lemma CB3_4_1I2R9P_sound (a : Fin 6) : + (CB3_4_1I2R9P a).Encloses (CB3_4_1I2R9Value a) := + contains_sound (CB3_4_1I2R9Raw_sound a) (CB3_4_1I2R9P_check a) +def CB3_4_1I2R9Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_4_1I2R9Certificates (CB3_4_1I2R9CertificateIndex a)).output +lemma CB3_4_1I2R9Terms_sound (a : Fin 6) : + (CB3_4_1I2R9Terms a).Encloses (Foundation.entropyTerm (CB3_4_1I2R9Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB3_4_1I2R9Certificates_valid + (CB3_4_1I2R9CertificateIndex a) (CB3_4_1I2R9P_sound a) +def CB3_4_1I2R9Entropy : Ball := ⟨0, 0⟩ +lemma CB3_4_1I2R9Entropy_sound : CB3_4_1I2R9Entropy.Encloses (Foundation.finiteEntropy CB3_4_1I2R9Value) := by + exact contains_sound (entropyFin_enclosed 6 CB3_4_1I2R9Value CB3_4_1I2R9Terms CB3_4_1I2R9Terms_sound) (by decide +kernel) +def CB3_4_1I2R9Mass : Ball := ⟨0, 0⟩ +lemma CB3_4_1I2R9Mass_sound : CB3_4_1I2R9Mass.Encloses (∑ a, CB3_4_1I2R9Value a) := by + exact contains_sound (finSumBall_sound 6 CB3_4_1I2R9P CB3_4_1I2R9Value CB3_4_1I2R9P_sound) (by decide +kernel) +def CB3_4_1I2R9MassTerm : Ball := .exact 0 +lemma CB3_4_1I2R9MassTerm_sound : CB3_4_1I2R9MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB3_4_1I2R9Value a))) := + entropyTerm_zero_ball (CB3_4_1I2R9Mass_sound) +def CB3_4_1I2R9H : Ball := ⟨0, 0⟩ +lemma CB3_4_1I2R9H_sound : CB3_4_1I2R9H.Encloses (homogeneousEntropy CB3_4_1I2R9Value) := by + exact contains_sound (homogeneous_enclosed CB3_4_1I2R9Value CB3_4_1I2R9MassTerm_sound CB3_4_1I2R9Entropy_sound) (by decide +kernel) +def CB3_4_1I2R10Value (a : Fin 6) : ℝ := residualLaw (below (shape 3 4 1)) (fun u => (stageBLaw (shape 3 4 1) u : ℝ)) (stageBPriority (shape 3 4 1)) 2 (fun u a => (littleLaw (shape 3 4 1) u ((stageBPriority (shape 3 4 1)) 2) a : ℝ)) 10 a +def CB3_4_1I2R10Raw (a : Fin 6) : Ball := residualBall (below (shape 3 4 1)) B3_4_1Law (stageBPriority (shape 3 4 1)) 2 (fun u => B3_4_1Little u ((stageBPriority (shape 3 4 1)) 2)) 10 a +lemma CB3_4_1I2R10Raw_sound (a : Fin 6) : + (CB3_4_1I2R10Raw a).Encloses (CB3_4_1I2R10Value a) := by + exact residualBall_sound_on (below (shape 3 4 1)) B3_4_1Law (fun u => (stageBLaw (shape 3 4 1) u : ℝ)) (stageBPriority (shape 3 4 1)) 2 (fun u => B3_4_1Little u ((stageBPriority (shape 3 4 1)) 2)) (fun u a => (littleLaw (shape 3 4 1) u ((stageBPriority (shape 3 4 1)) 2) a : ℝ)) (fun u _ => B3_4_1Law_sound u) (fun u _ a => B3_4_1Little_sound u ((stageBPriority (shape 3 4 1)) 2) a) 10 a +def CB3_4_1I2R10Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB3_4_1I2R10Certificates_valid : + CB3_4_1I2R10Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB3_4_1I2R10CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB3_4_1I2R10P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_4_1I2R10Certificates (CB3_4_1I2R10CertificateIndex a)).input +lemma CB3_4_1I2R10P_check : ∀ a : Fin 6, contains (CB3_4_1I2R10Raw a) (CB3_4_1I2R10P a) = true := by + decide +kernel +lemma CB3_4_1I2R10P_sound (a : Fin 6) : + (CB3_4_1I2R10P a).Encloses (CB3_4_1I2R10Value a) := + contains_sound (CB3_4_1I2R10Raw_sound a) (CB3_4_1I2R10P_check a) +def CB3_4_1I2R10Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_4_1I2R10Certificates (CB3_4_1I2R10CertificateIndex a)).output +lemma CB3_4_1I2R10Terms_sound (a : Fin 6) : + (CB3_4_1I2R10Terms a).Encloses (Foundation.entropyTerm (CB3_4_1I2R10Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB3_4_1I2R10Certificates_valid + (CB3_4_1I2R10CertificateIndex a) (CB3_4_1I2R10P_sound a) +def CB3_4_1I2R10Entropy : Ball := ⟨0, 0⟩ +lemma CB3_4_1I2R10Entropy_sound : CB3_4_1I2R10Entropy.Encloses (Foundation.finiteEntropy CB3_4_1I2R10Value) := by + exact contains_sound (entropyFin_enclosed 6 CB3_4_1I2R10Value CB3_4_1I2R10Terms CB3_4_1I2R10Terms_sound) (by decide +kernel) +def CB3_4_1I2R10Mass : Ball := ⟨0, 0⟩ +lemma CB3_4_1I2R10Mass_sound : CB3_4_1I2R10Mass.Encloses (∑ a, CB3_4_1I2R10Value a) := by + exact contains_sound (finSumBall_sound 6 CB3_4_1I2R10P CB3_4_1I2R10Value CB3_4_1I2R10P_sound) (by decide +kernel) +def CB3_4_1I2R10MassTerm : Ball := .exact 0 +lemma CB3_4_1I2R10MassTerm_sound : CB3_4_1I2R10MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB3_4_1I2R10Value a))) := + entropyTerm_zero_ball (CB3_4_1I2R10Mass_sound) +def CB3_4_1I2R10H : Ball := ⟨0, 0⟩ +lemma CB3_4_1I2R10H_sound : CB3_4_1I2R10H.Encloses (homogeneousEntropy CB3_4_1I2R10Value) := by + exact contains_sound (homogeneous_enclosed CB3_4_1I2R10Value CB3_4_1I2R10MassTerm_sound CB3_4_1I2R10Entropy_sound) (by decide +kernel) +def CB3_4_1I2R11Value (a : Fin 6) : ℝ := residualLaw (below (shape 3 4 1)) (fun u => (stageBLaw (shape 3 4 1) u : ℝ)) (stageBPriority (shape 3 4 1)) 2 (fun u a => (littleLaw (shape 3 4 1) u ((stageBPriority (shape 3 4 1)) 2) a : ℝ)) 11 a +def CB3_4_1I2R11Raw (a : Fin 6) : Ball := residualBall (below (shape 3 4 1)) B3_4_1Law (stageBPriority (shape 3 4 1)) 2 (fun u => B3_4_1Little u ((stageBPriority (shape 3 4 1)) 2)) 11 a +lemma CB3_4_1I2R11Raw_sound (a : Fin 6) : + (CB3_4_1I2R11Raw a).Encloses (CB3_4_1I2R11Value a) := by + exact residualBall_sound_on (below (shape 3 4 1)) B3_4_1Law (fun u => (stageBLaw (shape 3 4 1) u : ℝ)) (stageBPriority (shape 3 4 1)) 2 (fun u => B3_4_1Little u ((stageBPriority (shape 3 4 1)) 2)) (fun u a => (littleLaw (shape 3 4 1) u ((stageBPriority (shape 3 4 1)) 2) a : ℝ)) (fun u _ => B3_4_1Law_sound u) (fun u _ a => B3_4_1Little_sound u ((stageBPriority (shape 3 4 1)) 2) a) 11 a +def CB3_4_1I2R11Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB3_4_1I2R11Certificates_valid : + CB3_4_1I2R11Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB3_4_1I2R11CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB3_4_1I2R11P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_4_1I2R11Certificates (CB3_4_1I2R11CertificateIndex a)).input +lemma CB3_4_1I2R11P_check : ∀ a : Fin 6, contains (CB3_4_1I2R11Raw a) (CB3_4_1I2R11P a) = true := by + decide +kernel +lemma CB3_4_1I2R11P_sound (a : Fin 6) : + (CB3_4_1I2R11P a).Encloses (CB3_4_1I2R11Value a) := + contains_sound (CB3_4_1I2R11Raw_sound a) (CB3_4_1I2R11P_check a) +def CB3_4_1I2R11Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_4_1I2R11Certificates (CB3_4_1I2R11CertificateIndex a)).output +lemma CB3_4_1I2R11Terms_sound (a : Fin 6) : + (CB3_4_1I2R11Terms a).Encloses (Foundation.entropyTerm (CB3_4_1I2R11Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB3_4_1I2R11Certificates_valid + (CB3_4_1I2R11CertificateIndex a) (CB3_4_1I2R11P_sound a) +def CB3_4_1I2R11Entropy : Ball := ⟨0, 0⟩ +lemma CB3_4_1I2R11Entropy_sound : CB3_4_1I2R11Entropy.Encloses (Foundation.finiteEntropy CB3_4_1I2R11Value) := by + exact contains_sound (entropyFin_enclosed 6 CB3_4_1I2R11Value CB3_4_1I2R11Terms CB3_4_1I2R11Terms_sound) (by decide +kernel) +def CB3_4_1I2R11Mass : Ball := ⟨0, 0⟩ +lemma CB3_4_1I2R11Mass_sound : CB3_4_1I2R11Mass.Encloses (∑ a, CB3_4_1I2R11Value a) := by + exact contains_sound (finSumBall_sound 6 CB3_4_1I2R11P CB3_4_1I2R11Value CB3_4_1I2R11P_sound) (by decide +kernel) +def CB3_4_1I2R11MassTerm : Ball := .exact 0 +lemma CB3_4_1I2R11MassTerm_sound : CB3_4_1I2R11MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB3_4_1I2R11Value a))) := + entropyTerm_zero_ball (CB3_4_1I2R11Mass_sound) +def CB3_4_1I2R11H : Ball := ⟨0, 0⟩ +lemma CB3_4_1I2R11H_sound : CB3_4_1I2R11H.Encloses (homogeneousEntropy CB3_4_1I2R11Value) := by + exact contains_sound (homogeneous_enclosed CB3_4_1I2R11Value CB3_4_1I2R11MassTerm_sound CB3_4_1I2R11Entropy_sound) (by decide +kernel) +def CB3_4_1I2R12Value (a : Fin 6) : ℝ := residualLaw (below (shape 3 4 1)) (fun u => (stageBLaw (shape 3 4 1) u : ℝ)) (stageBPriority (shape 3 4 1)) 2 (fun u a => (littleLaw (shape 3 4 1) u ((stageBPriority (shape 3 4 1)) 2) a : ℝ)) 12 a +def CB3_4_1I2R12Raw (a : Fin 6) : Ball := residualBall (below (shape 3 4 1)) B3_4_1Law (stageBPriority (shape 3 4 1)) 2 (fun u => B3_4_1Little u ((stageBPriority (shape 3 4 1)) 2)) 12 a +lemma CB3_4_1I2R12Raw_sound (a : Fin 6) : + (CB3_4_1I2R12Raw a).Encloses (CB3_4_1I2R12Value a) := by + exact residualBall_sound_on (below (shape 3 4 1)) B3_4_1Law (fun u => (stageBLaw (shape 3 4 1) u : ℝ)) (stageBPriority (shape 3 4 1)) 2 (fun u => B3_4_1Little u ((stageBPriority (shape 3 4 1)) 2)) (fun u a => (littleLaw (shape 3 4 1) u ((stageBPriority (shape 3 4 1)) 2) a : ℝ)) (fun u _ => B3_4_1Law_sound u) (fun u _ a => B3_4_1Little_sound u ((stageBPriority (shape 3 4 1)) 2) a) 12 a +def CB3_4_1I2R12Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB3_4_1I2R12Certificates_valid : + CB3_4_1I2R12Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB3_4_1I2R12CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB3_4_1I2R12P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_4_1I2R12Certificates (CB3_4_1I2R12CertificateIndex a)).input +lemma CB3_4_1I2R12P_check : ∀ a : Fin 6, contains (CB3_4_1I2R12Raw a) (CB3_4_1I2R12P a) = true := by + decide +kernel +lemma CB3_4_1I2R12P_sound (a : Fin 6) : + (CB3_4_1I2R12P a).Encloses (CB3_4_1I2R12Value a) := + contains_sound (CB3_4_1I2R12Raw_sound a) (CB3_4_1I2R12P_check a) +def CB3_4_1I2R12Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_4_1I2R12Certificates (CB3_4_1I2R12CertificateIndex a)).output +lemma CB3_4_1I2R12Terms_sound (a : Fin 6) : + (CB3_4_1I2R12Terms a).Encloses (Foundation.entropyTerm (CB3_4_1I2R12Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB3_4_1I2R12Certificates_valid + (CB3_4_1I2R12CertificateIndex a) (CB3_4_1I2R12P_sound a) +def CB3_4_1I2R12Entropy : Ball := ⟨0, 0⟩ +lemma CB3_4_1I2R12Entropy_sound : CB3_4_1I2R12Entropy.Encloses (Foundation.finiteEntropy CB3_4_1I2R12Value) := by + exact contains_sound (entropyFin_enclosed 6 CB3_4_1I2R12Value CB3_4_1I2R12Terms CB3_4_1I2R12Terms_sound) (by decide +kernel) +def CB3_4_1I2R12Mass : Ball := ⟨0, 0⟩ +lemma CB3_4_1I2R12Mass_sound : CB3_4_1I2R12Mass.Encloses (∑ a, CB3_4_1I2R12Value a) := by + exact contains_sound (finSumBall_sound 6 CB3_4_1I2R12P CB3_4_1I2R12Value CB3_4_1I2R12P_sound) (by decide +kernel) +def CB3_4_1I2R12MassTerm : Ball := .exact 0 +lemma CB3_4_1I2R12MassTerm_sound : CB3_4_1I2R12MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB3_4_1I2R12Value a))) := + entropyTerm_zero_ball (CB3_4_1I2R12Mass_sound) +def CB3_4_1I2R12H : Ball := ⟨0, 0⟩ +lemma CB3_4_1I2R12H_sound : CB3_4_1I2R12H.Encloses (homogeneousEntropy CB3_4_1I2R12Value) := by + exact contains_sound (homogeneous_enclosed CB3_4_1I2R12Value CB3_4_1I2R12MassTerm_sound CB3_4_1I2R12Entropy_sound) (by decide +kernel) +def CB3_4_1I2R13Value (a : Fin 6) : ℝ := residualLaw (below (shape 3 4 1)) (fun u => (stageBLaw (shape 3 4 1) u : ℝ)) (stageBPriority (shape 3 4 1)) 2 (fun u a => (littleLaw (shape 3 4 1) u ((stageBPriority (shape 3 4 1)) 2) a : ℝ)) 13 a +def CB3_4_1I2R13Raw (a : Fin 6) : Ball := residualBall (below (shape 3 4 1)) B3_4_1Law (stageBPriority (shape 3 4 1)) 2 (fun u => B3_4_1Little u ((stageBPriority (shape 3 4 1)) 2)) 13 a +lemma CB3_4_1I2R13Raw_sound (a : Fin 6) : + (CB3_4_1I2R13Raw a).Encloses (CB3_4_1I2R13Value a) := by + exact residualBall_sound_on (below (shape 3 4 1)) B3_4_1Law (fun u => (stageBLaw (shape 3 4 1) u : ℝ)) (stageBPriority (shape 3 4 1)) 2 (fun u => B3_4_1Little u ((stageBPriority (shape 3 4 1)) 2)) (fun u a => (littleLaw (shape 3 4 1) u ((stageBPriority (shape 3 4 1)) 2) a : ℝ)) (fun u _ => B3_4_1Law_sound u) (fun u _ a => B3_4_1Little_sound u ((stageBPriority (shape 3 4 1)) 2) a) 13 a +def CB3_4_1I2R13Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB3_4_1I2R13Certificates_valid : + CB3_4_1I2R13Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB3_4_1I2R13CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB3_4_1I2R13P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_4_1I2R13Certificates (CB3_4_1I2R13CertificateIndex a)).input +lemma CB3_4_1I2R13P_check : ∀ a : Fin 6, contains (CB3_4_1I2R13Raw a) (CB3_4_1I2R13P a) = true := by + decide +kernel +lemma CB3_4_1I2R13P_sound (a : Fin 6) : + (CB3_4_1I2R13P a).Encloses (CB3_4_1I2R13Value a) := + contains_sound (CB3_4_1I2R13Raw_sound a) (CB3_4_1I2R13P_check a) +def CB3_4_1I2R13Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_4_1I2R13Certificates (CB3_4_1I2R13CertificateIndex a)).output +lemma CB3_4_1I2R13Terms_sound (a : Fin 6) : + (CB3_4_1I2R13Terms a).Encloses (Foundation.entropyTerm (CB3_4_1I2R13Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB3_4_1I2R13Certificates_valid + (CB3_4_1I2R13CertificateIndex a) (CB3_4_1I2R13P_sound a) +def CB3_4_1I2R13Entropy : Ball := ⟨0, 0⟩ +lemma CB3_4_1I2R13Entropy_sound : CB3_4_1I2R13Entropy.Encloses (Foundation.finiteEntropy CB3_4_1I2R13Value) := by + exact contains_sound (entropyFin_enclosed 6 CB3_4_1I2R13Value CB3_4_1I2R13Terms CB3_4_1I2R13Terms_sound) (by decide +kernel) +def CB3_4_1I2R13Mass : Ball := ⟨0, 0⟩ +lemma CB3_4_1I2R13Mass_sound : CB3_4_1I2R13Mass.Encloses (∑ a, CB3_4_1I2R13Value a) := by + exact contains_sound (finSumBall_sound 6 CB3_4_1I2R13P CB3_4_1I2R13Value CB3_4_1I2R13P_sound) (by decide +kernel) +def CB3_4_1I2R13MassTerm : Ball := .exact 0 +lemma CB3_4_1I2R13MassTerm_sound : CB3_4_1I2R13MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB3_4_1I2R13Value a))) := + entropyTerm_zero_ball (CB3_4_1I2R13Mass_sound) +def CB3_4_1I2R13H : Ball := ⟨0, 0⟩ +lemma CB3_4_1I2R13H_sound : CB3_4_1I2R13H.Encloses (homogeneousEntropy CB3_4_1I2R13Value) := by + exact contains_sound (homogeneous_enclosed CB3_4_1I2R13Value CB3_4_1I2R13MassTerm_sound CB3_4_1I2R13Entropy_sound) (by decide +kernel) +def CB3_4_1I2R14Value (a : Fin 6) : ℝ := residualLaw (below (shape 3 4 1)) (fun u => (stageBLaw (shape 3 4 1) u : ℝ)) (stageBPriority (shape 3 4 1)) 2 (fun u a => (littleLaw (shape 3 4 1) u ((stageBPriority (shape 3 4 1)) 2) a : ℝ)) 14 a +def CB3_4_1I2R14Raw (a : Fin 6) : Ball := residualBall (below (shape 3 4 1)) B3_4_1Law (stageBPriority (shape 3 4 1)) 2 (fun u => B3_4_1Little u ((stageBPriority (shape 3 4 1)) 2)) 14 a +lemma CB3_4_1I2R14Raw_sound (a : Fin 6) : + (CB3_4_1I2R14Raw a).Encloses (CB3_4_1I2R14Value a) := by + exact residualBall_sound_on (below (shape 3 4 1)) B3_4_1Law (fun u => (stageBLaw (shape 3 4 1) u : ℝ)) (stageBPriority (shape 3 4 1)) 2 (fun u => B3_4_1Little u ((stageBPriority (shape 3 4 1)) 2)) (fun u a => (littleLaw (shape 3 4 1) u ((stageBPriority (shape 3 4 1)) 2) a : ℝ)) (fun u _ => B3_4_1Law_sound u) (fun u _ a => B3_4_1Little_sound u ((stageBPriority (shape 3 4 1)) 2) a) 14 a +def CB3_4_1I2R14Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB3_4_1I2R14Certificates_valid : + CB3_4_1I2R14Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB3_4_1I2R14CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB3_4_1I2R14P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_4_1I2R14Certificates (CB3_4_1I2R14CertificateIndex a)).input +lemma CB3_4_1I2R14P_check : ∀ a : Fin 6, contains (CB3_4_1I2R14Raw a) (CB3_4_1I2R14P a) = true := by + decide +kernel +lemma CB3_4_1I2R14P_sound (a : Fin 6) : + (CB3_4_1I2R14P a).Encloses (CB3_4_1I2R14Value a) := + contains_sound (CB3_4_1I2R14Raw_sound a) (CB3_4_1I2R14P_check a) +def CB3_4_1I2R14Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_4_1I2R14Certificates (CB3_4_1I2R14CertificateIndex a)).output +lemma CB3_4_1I2R14Terms_sound (a : Fin 6) : + (CB3_4_1I2R14Terms a).Encloses (Foundation.entropyTerm (CB3_4_1I2R14Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB3_4_1I2R14Certificates_valid + (CB3_4_1I2R14CertificateIndex a) (CB3_4_1I2R14P_sound a) +def CB3_4_1I2R14Entropy : Ball := ⟨0, 0⟩ +lemma CB3_4_1I2R14Entropy_sound : CB3_4_1I2R14Entropy.Encloses (Foundation.finiteEntropy CB3_4_1I2R14Value) := by + exact contains_sound (entropyFin_enclosed 6 CB3_4_1I2R14Value CB3_4_1I2R14Terms CB3_4_1I2R14Terms_sound) (by decide +kernel) +def CB3_4_1I2R14Mass : Ball := ⟨0, 0⟩ +lemma CB3_4_1I2R14Mass_sound : CB3_4_1I2R14Mass.Encloses (∑ a, CB3_4_1I2R14Value a) := by + exact contains_sound (finSumBall_sound 6 CB3_4_1I2R14P CB3_4_1I2R14Value CB3_4_1I2R14P_sound) (by decide +kernel) +def CB3_4_1I2R14MassTerm : Ball := .exact 0 +lemma CB3_4_1I2R14MassTerm_sound : CB3_4_1I2R14MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB3_4_1I2R14Value a))) := + entropyTerm_zero_ball (CB3_4_1I2R14Mass_sound) +def CB3_4_1I2R14H : Ball := ⟨0, 0⟩ +lemma CB3_4_1I2R14H_sound : CB3_4_1I2R14H.Encloses (homogeneousEntropy CB3_4_1I2R14Value) := by + exact contains_sound (homogeneous_enclosed CB3_4_1I2R14Value CB3_4_1I2R14MassTerm_sound CB3_4_1I2R14Entropy_sound) (by decide +kernel) +def CB3_4_1I2R15Value (a : Fin 6) : ℝ := residualLaw (below (shape 3 4 1)) (fun u => (stageBLaw (shape 3 4 1) u : ℝ)) (stageBPriority (shape 3 4 1)) 2 (fun u a => (littleLaw (shape 3 4 1) u ((stageBPriority (shape 3 4 1)) 2) a : ℝ)) 15 a +def CB3_4_1I2R15Raw (a : Fin 6) : Ball := residualBall (below (shape 3 4 1)) B3_4_1Law (stageBPriority (shape 3 4 1)) 2 (fun u => B3_4_1Little u ((stageBPriority (shape 3 4 1)) 2)) 15 a +lemma CB3_4_1I2R15Raw_sound (a : Fin 6) : + (CB3_4_1I2R15Raw a).Encloses (CB3_4_1I2R15Value a) := by + exact residualBall_sound_on (below (shape 3 4 1)) B3_4_1Law (fun u => (stageBLaw (shape 3 4 1) u : ℝ)) (stageBPriority (shape 3 4 1)) 2 (fun u => B3_4_1Little u ((stageBPriority (shape 3 4 1)) 2)) (fun u a => (littleLaw (shape 3 4 1) u ((stageBPriority (shape 3 4 1)) 2) a : ℝ)) (fun u _ => B3_4_1Law_sound u) (fun u _ a => B3_4_1Little_sound u ((stageBPriority (shape 3 4 1)) 2) a) 15 a +def CB3_4_1I2R15Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB3_4_1I2R15Certificates_valid : + CB3_4_1I2R15Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB3_4_1I2R15CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB3_4_1I2R15P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_4_1I2R15Certificates (CB3_4_1I2R15CertificateIndex a)).input +lemma CB3_4_1I2R15P_check : ∀ a : Fin 6, contains (CB3_4_1I2R15Raw a) (CB3_4_1I2R15P a) = true := by + decide +kernel +lemma CB3_4_1I2R15P_sound (a : Fin 6) : + (CB3_4_1I2R15P a).Encloses (CB3_4_1I2R15Value a) := + contains_sound (CB3_4_1I2R15Raw_sound a) (CB3_4_1I2R15P_check a) +def CB3_4_1I2R15Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_4_1I2R15Certificates (CB3_4_1I2R15CertificateIndex a)).output +lemma CB3_4_1I2R15Terms_sound (a : Fin 6) : + (CB3_4_1I2R15Terms a).Encloses (Foundation.entropyTerm (CB3_4_1I2R15Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB3_4_1I2R15Certificates_valid + (CB3_4_1I2R15CertificateIndex a) (CB3_4_1I2R15P_sound a) +def CB3_4_1I2R15Entropy : Ball := ⟨0, 0⟩ +lemma CB3_4_1I2R15Entropy_sound : CB3_4_1I2R15Entropy.Encloses (Foundation.finiteEntropy CB3_4_1I2R15Value) := by + exact contains_sound (entropyFin_enclosed 6 CB3_4_1I2R15Value CB3_4_1I2R15Terms CB3_4_1I2R15Terms_sound) (by decide +kernel) +def CB3_4_1I2R15Mass : Ball := ⟨0, 0⟩ +lemma CB3_4_1I2R15Mass_sound : CB3_4_1I2R15Mass.Encloses (∑ a, CB3_4_1I2R15Value a) := by + exact contains_sound (finSumBall_sound 6 CB3_4_1I2R15P CB3_4_1I2R15Value CB3_4_1I2R15P_sound) (by decide +kernel) +def CB3_4_1I2R15MassTerm : Ball := .exact 0 +lemma CB3_4_1I2R15MassTerm_sound : CB3_4_1I2R15MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB3_4_1I2R15Value a))) := + entropyTerm_zero_ball (CB3_4_1I2R15Mass_sound) +def CB3_4_1I2R15H : Ball := ⟨0, 0⟩ +lemma CB3_4_1I2R15H_sound : CB3_4_1I2R15H.Encloses (homogeneousEntropy CB3_4_1I2R15Value) := by + exact contains_sound (homogeneous_enclosed CB3_4_1I2R15Value CB3_4_1I2R15MassTerm_sound CB3_4_1I2R15Entropy_sound) (by decide +kernel) +def CB3_4_1I2R16Value (a : Fin 6) : ℝ := residualLaw (below (shape 3 4 1)) (fun u => (stageBLaw (shape 3 4 1) u : ℝ)) (stageBPriority (shape 3 4 1)) 2 (fun u a => (littleLaw (shape 3 4 1) u ((stageBPriority (shape 3 4 1)) 2) a : ℝ)) 16 a +def CB3_4_1I2R16Raw (a : Fin 6) : Ball := residualBall (below (shape 3 4 1)) B3_4_1Law (stageBPriority (shape 3 4 1)) 2 (fun u => B3_4_1Little u ((stageBPriority (shape 3 4 1)) 2)) 16 a +lemma CB3_4_1I2R16Raw_sound (a : Fin 6) : + (CB3_4_1I2R16Raw a).Encloses (CB3_4_1I2R16Value a) := by + exact residualBall_sound_on (below (shape 3 4 1)) B3_4_1Law (fun u => (stageBLaw (shape 3 4 1) u : ℝ)) (stageBPriority (shape 3 4 1)) 2 (fun u => B3_4_1Little u ((stageBPriority (shape 3 4 1)) 2)) (fun u a => (littleLaw (shape 3 4 1) u ((stageBPriority (shape 3 4 1)) 2) a : ℝ)) (fun u _ => B3_4_1Law_sound u) (fun u _ a => B3_4_1Little_sound u ((stageBPriority (shape 3 4 1)) 2) a) 16 a +def CB3_4_1I2R16Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB3_4_1I2R16Certificates_valid : + CB3_4_1I2R16Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB3_4_1I2R16CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB3_4_1I2R16P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_4_1I2R16Certificates (CB3_4_1I2R16CertificateIndex a)).input +lemma CB3_4_1I2R16P_check : ∀ a : Fin 6, contains (CB3_4_1I2R16Raw a) (CB3_4_1I2R16P a) = true := by + decide +kernel +lemma CB3_4_1I2R16P_sound (a : Fin 6) : + (CB3_4_1I2R16P a).Encloses (CB3_4_1I2R16Value a) := + contains_sound (CB3_4_1I2R16Raw_sound a) (CB3_4_1I2R16P_check a) +def CB3_4_1I2R16Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB3_4_1I2R16Certificates (CB3_4_1I2R16CertificateIndex a)).output +lemma CB3_4_1I2R16Terms_sound (a : Fin 6) : + (CB3_4_1I2R16Terms a).Encloses (Foundation.entropyTerm (CB3_4_1I2R16Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB3_4_1I2R16Certificates_valid + (CB3_4_1I2R16CertificateIndex a) (CB3_4_1I2R16P_sound a) +def CB3_4_1I2R16Entropy : Ball := ⟨0, 0⟩ +lemma CB3_4_1I2R16Entropy_sound : CB3_4_1I2R16Entropy.Encloses (Foundation.finiteEntropy CB3_4_1I2R16Value) := by + exact contains_sound (entropyFin_enclosed 6 CB3_4_1I2R16Value CB3_4_1I2R16Terms CB3_4_1I2R16Terms_sound) (by decide +kernel) +def CB3_4_1I2R16Mass : Ball := ⟨0, 0⟩ +lemma CB3_4_1I2R16Mass_sound : CB3_4_1I2R16Mass.Encloses (∑ a, CB3_4_1I2R16Value a) := by + exact contains_sound (finSumBall_sound 6 CB3_4_1I2R16P CB3_4_1I2R16Value CB3_4_1I2R16P_sound) (by decide +kernel) +def CB3_4_1I2R16MassTerm : Ball := .exact 0 +lemma CB3_4_1I2R16MassTerm_sound : CB3_4_1I2R16MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB3_4_1I2R16Value a))) := + entropyTerm_zero_ball (CB3_4_1I2R16Mass_sound) +def CB3_4_1I2R16H : Ball := ⟨0, 0⟩ +lemma CB3_4_1I2R16H_sound : CB3_4_1I2R16H.Encloses (homogeneousEntropy CB3_4_1I2R16Value) := by + exact contains_sound (homogeneous_enclosed CB3_4_1I2R16Value CB3_4_1I2R16MassTerm_sound CB3_4_1I2R16Entropy_sound) (by decide +kernel) +def CB3_4_1I2ResidualEntropies (a : Fin 17) : Ball := + match a.val with + | 0 => CB3_4_1I2R0H + | 1 => CB3_4_1I2R1H + | 2 => CB3_4_1I2R2H + | 3 => CB3_4_1I2R3H + | 4 => CB3_4_1I2R4H + | 5 => CB3_4_1I2R5H + | 6 => CB3_4_1I2R6H + | 7 => CB3_4_1I2R7H + | 8 => CB3_4_1I2R8H + | 9 => CB3_4_1I2R9H + | 10 => CB3_4_1I2R10H + | 11 => CB3_4_1I2R11H + | 12 => CB3_4_1I2R12H + | 13 => CB3_4_1I2R13H + | 14 => CB3_4_1I2R14H + | 15 => CB3_4_1I2R15H + | 16 => CB3_4_1I2R16H + | _ => (.exact 0) +lemma CB3_4_1I2ResidualEntropies_sound (k : Fin 17) : + (CB3_4_1I2ResidualEntropies k).Encloses (homogeneousEntropy + (residualLaw (below (shape 3 4 1)) (fun u => (stageBLaw (shape 3 4 1) u : ℝ)) (stageBPriority (shape 3 4 1)) 2 (fun u a => (littleLaw (shape 3 4 1) u ((stageBPriority (shape 3 4 1)) 2) a : ℝ)) k)) := by + fin_cases k + · exact CB3_4_1I2R0H_sound + · exact CB3_4_1I2R1H_sound + · exact CB3_4_1I2R2H_sound + · exact CB3_4_1I2R3H_sound + · exact CB3_4_1I2R4H_sound + · exact CB3_4_1I2R5H_sound + · exact CB3_4_1I2R6H_sound + · exact CB3_4_1I2R7H_sound + · exact CB3_4_1I2R8H_sound + · exact CB3_4_1I2R9H_sound + · exact CB3_4_1I2R10H_sound + · exact CB3_4_1I2R11H_sound + · exact CB3_4_1I2R12H_sound + · exact CB3_4_1I2R13H_sound + · exact CB3_4_1I2R14H_sound + · exact CB3_4_1I2R15H_sound + · exact CB3_4_1I2R16H_sound +def CB3_4_1I2S0_3_1Value (a : Fin 6) : ℝ := (littleLaw (shape 3 4 1) (shape 0 3 1) ((stageBPriority (shape 3 4 1)) 2) a : ℝ) +def CB3_4_1I2S0_3_1E_4Log : Ball := .exact 0 +lemma CB3_4_1I2S0_3_1E_4Log_sound : CB3_4_1I2S0_3_1E_4Log.Encloses (Real.log (CB3_4_1I2S0_3_1Value (4 : Fin 6))) := by + exact log_exact_one_ball ((B3_4_1Little_sound (shape 0 3 1) ((stageBPriority (shape 3 4 1)) 2)) (4 : Fin 6)) +def CB3_4_1I2S0_3_1E_4 : Ball := ⟨0, 0⟩ +lemma CB3_4_1I2S0_3_1E_4_sound : CB3_4_1I2S0_3_1E_4.Encloses (Foundation.entropyTerm (CB3_4_1I2S0_3_1Value (4 : Fin 6))) := by + exact contains_sound (entropyTerm_ball ((B3_4_1Little_sound (shape 0 3 1) ((stageBPriority (shape 3 4 1)) 2)) (4 : Fin 6)) CB3_4_1I2S0_3_1E_4Log_sound) (by decide +kernel) +def CB3_4_1I2S0_3_1Terms (a : Fin 6) : Ball := + match a.val with + | 4 => ⟨0, 0⟩ + | _ => (.exact 0) +lemma CB3_4_1I2S0_3_1Terms_sound (a : Fin 6) : + (CB3_4_1I2S0_3_1Terms a).Encloses (Foundation.entropyTerm (CB3_4_1I2S0_3_1Value a)) := by + fin_cases a + · exact (entropyTerm_zero_ball ((B3_4_1Little_sound (shape 0 3 1) ((stageBPriority (shape 3 4 1)) 2)) (0 : Fin 6))) + · exact (entropyTerm_zero_ball ((B3_4_1Little_sound (shape 0 3 1) ((stageBPriority (shape 3 4 1)) 2)) (1 : Fin 6))) + · exact (entropyTerm_zero_ball ((B3_4_1Little_sound (shape 0 3 1) ((stageBPriority (shape 3 4 1)) 2)) (2 : Fin 6))) + · exact (entropyTerm_zero_ball ((B3_4_1Little_sound (shape 0 3 1) ((stageBPriority (shape 3 4 1)) 2)) (3 : Fin 6))) + · exact CB3_4_1I2S0_3_1E_4_sound + · exact (entropyTerm_zero_ball ((B3_4_1Little_sound (shape 0 3 1) ((stageBPriority (shape 3 4 1)) 2)) (5 : Fin 6))) +def CB3_4_1I2S0_3_1Entropy : Ball := ⟨0, 0⟩ +lemma CB3_4_1I2S0_3_1Entropy_sound : CB3_4_1I2S0_3_1Entropy.Encloses (Foundation.finiteEntropy CB3_4_1I2S0_3_1Value) := by + exact contains_sound (entropyFin_enclosed 6 CB3_4_1I2S0_3_1Value CB3_4_1I2S0_3_1Terms CB3_4_1I2S0_3_1Terms_sound) (by decide +kernel) +def CB3_4_1I2S0_3_1Mass : Ball := ⟨1, 0⟩ +lemma CB3_4_1I2S0_3_1Mass_sound : CB3_4_1I2S0_3_1Mass.Encloses (∑ a, CB3_4_1I2S0_3_1Value a) := by + exact contains_sound (finSumBall_sound 6 (B3_4_1Little (shape 0 3 1) ((stageBPriority (shape 3 4 1)) 2)) CB3_4_1I2S0_3_1Value (B3_4_1Little_sound (shape 0 3 1) ((stageBPriority (shape 3 4 1)) 2))) (by decide +kernel) +def CB3_4_1I2S0_3_1MassTermLog : Ball := .exact 0 +lemma CB3_4_1I2S0_3_1MassTermLog_sound : CB3_4_1I2S0_3_1MassTermLog.Encloses (Real.log ((∑ a, CB3_4_1I2S0_3_1Value a))) := by + exact log_exact_one_ball (CB3_4_1I2S0_3_1Mass_sound) +def CB3_4_1I2S0_3_1MassTerm : Ball := ⟨0, 0⟩ +lemma CB3_4_1I2S0_3_1MassTerm_sound : CB3_4_1I2S0_3_1MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB3_4_1I2S0_3_1Value a))) := by + exact contains_sound (entropyTerm_ball (CB3_4_1I2S0_3_1Mass_sound) CB3_4_1I2S0_3_1MassTermLog_sound) (by decide +kernel) +def CB3_4_1I2S0_3_1H : Ball := ⟨0, 0⟩ +lemma CB3_4_1I2S0_3_1H_sound : CB3_4_1I2S0_3_1H.Encloses (homogeneousEntropy CB3_4_1I2S0_3_1Value) := by + exact contains_sound (homogeneous_enclosed CB3_4_1I2S0_3_1Value CB3_4_1I2S0_3_1MassTerm_sound CB3_4_1I2S0_3_1Entropy_sound) (by decide +kernel) +def CB3_4_1I2S0_4_0Value (a : Fin 6) : ℝ := (littleLaw (shape 3 4 1) (shape 0 4 0) ((stageBPriority (shape 3 4 1)) 2) a : ℝ) +def CB3_4_1I2S0_4_0E_5Log : Ball := .exact 0 +lemma CB3_4_1I2S0_4_0E_5Log_sound : CB3_4_1I2S0_4_0E_5Log.Encloses (Real.log (CB3_4_1I2S0_4_0Value (5 : Fin 6))) := by + exact log_exact_one_ball ((B3_4_1Little_sound (shape 0 4 0) ((stageBPriority (shape 3 4 1)) 2)) (5 : Fin 6)) +def CB3_4_1I2S0_4_0E_5 : Ball := ⟨0, 0⟩ +lemma CB3_4_1I2S0_4_0E_5_sound : CB3_4_1I2S0_4_0E_5.Encloses (Foundation.entropyTerm (CB3_4_1I2S0_4_0Value (5 : Fin 6))) := by + exact contains_sound (entropyTerm_ball ((B3_4_1Little_sound (shape 0 4 0) ((stageBPriority (shape 3 4 1)) 2)) (5 : Fin 6)) CB3_4_1I2S0_4_0E_5Log_sound) (by decide +kernel) +def CB3_4_1I2S0_4_0Terms (a : Fin 6) : Ball := + match a.val with + | 5 => ⟨0, 0⟩ + | _ => (.exact 0) +lemma CB3_4_1I2S0_4_0Terms_sound (a : Fin 6) : + (CB3_4_1I2S0_4_0Terms a).Encloses (Foundation.entropyTerm (CB3_4_1I2S0_4_0Value a)) := by + fin_cases a + · exact (entropyTerm_zero_ball ((B3_4_1Little_sound (shape 0 4 0) ((stageBPriority (shape 3 4 1)) 2)) (0 : Fin 6))) + · exact (entropyTerm_zero_ball ((B3_4_1Little_sound (shape 0 4 0) ((stageBPriority (shape 3 4 1)) 2)) (1 : Fin 6))) + · exact (entropyTerm_zero_ball ((B3_4_1Little_sound (shape 0 4 0) ((stageBPriority (shape 3 4 1)) 2)) (2 : Fin 6))) + · exact (entropyTerm_zero_ball ((B3_4_1Little_sound (shape 0 4 0) ((stageBPriority (shape 3 4 1)) 2)) (3 : Fin 6))) + · exact (entropyTerm_zero_ball ((B3_4_1Little_sound (shape 0 4 0) ((stageBPriority (shape 3 4 1)) 2)) (4 : Fin 6))) + · exact CB3_4_1I2S0_4_0E_5_sound +def CB3_4_1I2S0_4_0Entropy : Ball := ⟨0, 0⟩ +lemma CB3_4_1I2S0_4_0Entropy_sound : CB3_4_1I2S0_4_0Entropy.Encloses (Foundation.finiteEntropy CB3_4_1I2S0_4_0Value) := by + exact contains_sound (entropyFin_enclosed 6 CB3_4_1I2S0_4_0Value CB3_4_1I2S0_4_0Terms CB3_4_1I2S0_4_0Terms_sound) (by decide +kernel) +def CB3_4_1I2S0_4_0Mass : Ball := ⟨1, 0⟩ +lemma CB3_4_1I2S0_4_0Mass_sound : CB3_4_1I2S0_4_0Mass.Encloses (∑ a, CB3_4_1I2S0_4_0Value a) := by + exact contains_sound (finSumBall_sound 6 (B3_4_1Little (shape 0 4 0) ((stageBPriority (shape 3 4 1)) 2)) CB3_4_1I2S0_4_0Value (B3_4_1Little_sound (shape 0 4 0) ((stageBPriority (shape 3 4 1)) 2))) (by decide +kernel) +def CB3_4_1I2S0_4_0MassTermLog : Ball := .exact 0 +lemma CB3_4_1I2S0_4_0MassTermLog_sound : CB3_4_1I2S0_4_0MassTermLog.Encloses (Real.log ((∑ a, CB3_4_1I2S0_4_0Value a))) := by + exact log_exact_one_ball (CB3_4_1I2S0_4_0Mass_sound) +def CB3_4_1I2S0_4_0MassTerm : Ball := ⟨0, 0⟩ +lemma CB3_4_1I2S0_4_0MassTerm_sound : CB3_4_1I2S0_4_0MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB3_4_1I2S0_4_0Value a))) := by + exact contains_sound (entropyTerm_ball (CB3_4_1I2S0_4_0Mass_sound) CB3_4_1I2S0_4_0MassTermLog_sound) (by decide +kernel) +def CB3_4_1I2S0_4_0H : Ball := ⟨0, 0⟩ +lemma CB3_4_1I2S0_4_0H_sound : CB3_4_1I2S0_4_0H.Encloses (homogeneousEntropy CB3_4_1I2S0_4_0Value) := by + exact contains_sound (homogeneous_enclosed CB3_4_1I2S0_4_0Value CB3_4_1I2S0_4_0MassTerm_sound CB3_4_1I2S0_4_0Entropy_sound) (by decide +kernel) +def CB3_4_1I2S1_3_0Value (a : Fin 6) : ℝ := (littleLaw (shape 3 4 1) (shape 1 3 0) ((stageBPriority (shape 3 4 1)) 2) a : ℝ) +def CB3_4_1I2S1_3_0E_4Log : Ball := .exact 0 +lemma CB3_4_1I2S1_3_0E_4Log_sound : CB3_4_1I2S1_3_0E_4Log.Encloses (Real.log (CB3_4_1I2S1_3_0Value (4 : Fin 6))) := by + exact log_exact_one_ball ((B3_4_1Little_sound (shape 1 3 0) ((stageBPriority (shape 3 4 1)) 2)) (4 : Fin 6)) +def CB3_4_1I2S1_3_0E_4 : Ball := ⟨0, 0⟩ +lemma CB3_4_1I2S1_3_0E_4_sound : CB3_4_1I2S1_3_0E_4.Encloses (Foundation.entropyTerm (CB3_4_1I2S1_3_0Value (4 : Fin 6))) := by + exact contains_sound (entropyTerm_ball ((B3_4_1Little_sound (shape 1 3 0) ((stageBPriority (shape 3 4 1)) 2)) (4 : Fin 6)) CB3_4_1I2S1_3_0E_4Log_sound) (by decide +kernel) +def CB3_4_1I2S1_3_0Terms (a : Fin 6) : Ball := + match a.val with + | 4 => ⟨0, 0⟩ + | _ => (.exact 0) +lemma CB3_4_1I2S1_3_0Terms_sound (a : Fin 6) : + (CB3_4_1I2S1_3_0Terms a).Encloses (Foundation.entropyTerm (CB3_4_1I2S1_3_0Value a)) := by + fin_cases a + · exact (entropyTerm_zero_ball ((B3_4_1Little_sound (shape 1 3 0) ((stageBPriority (shape 3 4 1)) 2)) (0 : Fin 6))) + · exact (entropyTerm_zero_ball ((B3_4_1Little_sound (shape 1 3 0) ((stageBPriority (shape 3 4 1)) 2)) (1 : Fin 6))) + · exact (entropyTerm_zero_ball ((B3_4_1Little_sound (shape 1 3 0) ((stageBPriority (shape 3 4 1)) 2)) (2 : Fin 6))) + · exact (entropyTerm_zero_ball ((B3_4_1Little_sound (shape 1 3 0) ((stageBPriority (shape 3 4 1)) 2)) (3 : Fin 6))) + · exact CB3_4_1I2S1_3_0E_4_sound + · exact (entropyTerm_zero_ball ((B3_4_1Little_sound (shape 1 3 0) ((stageBPriority (shape 3 4 1)) 2)) (5 : Fin 6))) +def CB3_4_1I2S1_3_0Entropy : Ball := ⟨0, 0⟩ +lemma CB3_4_1I2S1_3_0Entropy_sound : CB3_4_1I2S1_3_0Entropy.Encloses (Foundation.finiteEntropy CB3_4_1I2S1_3_0Value) := by + exact contains_sound (entropyFin_enclosed 6 CB3_4_1I2S1_3_0Value CB3_4_1I2S1_3_0Terms CB3_4_1I2S1_3_0Terms_sound) (by decide +kernel) +def CB3_4_1I2S1_3_0Mass : Ball := ⟨1, 0⟩ +lemma CB3_4_1I2S1_3_0Mass_sound : CB3_4_1I2S1_3_0Mass.Encloses (∑ a, CB3_4_1I2S1_3_0Value a) := by + exact contains_sound (finSumBall_sound 6 (B3_4_1Little (shape 1 3 0) ((stageBPriority (shape 3 4 1)) 2)) CB3_4_1I2S1_3_0Value (B3_4_1Little_sound (shape 1 3 0) ((stageBPriority (shape 3 4 1)) 2))) (by decide +kernel) +def CB3_4_1I2S1_3_0MassTermLog : Ball := .exact 0 +lemma CB3_4_1I2S1_3_0MassTermLog_sound : CB3_4_1I2S1_3_0MassTermLog.Encloses (Real.log ((∑ a, CB3_4_1I2S1_3_0Value a))) := by + exact log_exact_one_ball (CB3_4_1I2S1_3_0Mass_sound) +def CB3_4_1I2S1_3_0MassTerm : Ball := ⟨0, 0⟩ +lemma CB3_4_1I2S1_3_0MassTerm_sound : CB3_4_1I2S1_3_0MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB3_4_1I2S1_3_0Value a))) := by + exact contains_sound (entropyTerm_ball (CB3_4_1I2S1_3_0Mass_sound) CB3_4_1I2S1_3_0MassTermLog_sound) (by decide +kernel) +def CB3_4_1I2S1_3_0H : Ball := ⟨0, 0⟩ +lemma CB3_4_1I2S1_3_0H_sound : CB3_4_1I2S1_3_0H.Encloses (homogeneousEntropy CB3_4_1I2S1_3_0Value) := by + exact contains_sound (homogeneous_enclosed CB3_4_1I2S1_3_0Value CB3_4_1I2S1_3_0MassTerm_sound CB3_4_1I2S1_3_0Entropy_sound) (by decide +kernel) +def CB3_4_1I2S2_2_0Value (a : Fin 6) : ℝ := (littleLaw (shape 3 4 1) (shape 2 2 0) ((stageBPriority (shape 3 4 1)) 2) a : ℝ) +def CB3_4_1I2S2_2_0E_2LogWitness : LogWitness := ⟨-1, 226, 125⟩ +def CB3_4_1I2S2_2_0E_2Log : Ball := ⟨(-2523147964749013880503657881131 / 25000000000000000000000000000000), (8470329473 / 20000000000000000000000000000000)⟩ +lemma CB3_4_1I2S2_2_0E_2Log_sound : CB3_4_1I2S2_2_0E_2Log.Encloses (Real.log (CB3_4_1I2S2_2_0Value (2 : Fin 6))) := by + exact checkLog_sound logTwoBall_sound ((B3_4_1Little_sound (shape 2 2 0) ((stageBPriority (shape 3 4 1)) 2)) (2 : Fin 6)) (w := CB3_4_1I2S2_2_0E_2LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB3_4_1I2S2_2_0E_2 : Ball := ⟨(912370304053243419190122689817 / 10000000000000000000000000000000), (38285889219 / 100000000000000000000000000000000)⟩ +lemma CB3_4_1I2S2_2_0E_2_sound : CB3_4_1I2S2_2_0E_2.Encloses (Foundation.entropyTerm (CB3_4_1I2S2_2_0Value (2 : Fin 6))) := by + exact contains_sound (entropyTerm_ball ((B3_4_1Little_sound (shape 2 2 0) ((stageBPriority (shape 3 4 1)) 2)) (2 : Fin 6)) CB3_4_1I2S2_2_0E_2Log_sound) (by decide +kernel) +def CB3_4_1I2S2_2_0E_3LogWitness : LogWitness := ⟨-4, 192, 125⟩ +def CB3_4_1I2S2_2_0E_3Log : Ball := ⟨(-117170354375715040678628387801009 / 50000000000000000000000000000000), (21175823683 / 20000000000000000000000000000000)⟩ +lemma CB3_4_1I2S2_2_0E_3Log_sound : CB3_4_1I2S2_2_0E_3Log.Encloses (Real.log (CB3_4_1I2S2_2_0Value (3 : Fin 6))) := by + exact checkLog_sound logTwoBall_sound ((B3_4_1Little_sound (shape 2 2 0) ((stageBPriority (shape 3 4 1)) 2)) (3 : Fin 6)) (w := CB3_4_1I2S2_2_0E_3LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB3_4_1I2S2_2_0E_3 : Ball := ⟨(11248354020068643905148325228897 / 50000000000000000000000000000000), (10164395369 / 100000000000000000000000000000000)⟩ +lemma CB3_4_1I2S2_2_0E_3_sound : CB3_4_1I2S2_2_0E_3.Encloses (Foundation.entropyTerm (CB3_4_1I2S2_2_0Value (3 : Fin 6))) := by + exact contains_sound (entropyTerm_ball ((B3_4_1Little_sound (shape 2 2 0) ((stageBPriority (shape 3 4 1)) 2)) (3 : Fin 6)) CB3_4_1I2S2_2_0E_3Log_sound) (by decide +kernel) +def CB3_4_1I2S2_2_0Terms (a : Fin 6) : Ball := + match a.val with + | 2 => ⟨(912370304053243419190122689817 / 10000000000000000000000000000000), (38285889219 / 100000000000000000000000000000000)⟩ + | 3 => ⟨(11248354020068643905148325228897 / 50000000000000000000000000000000), (10164395369 / 100000000000000000000000000000000)⟩ + | _ => (.exact 0) +lemma CB3_4_1I2S2_2_0Terms_sound (a : Fin 6) : + (CB3_4_1I2S2_2_0Terms a).Encloses (Foundation.entropyTerm (CB3_4_1I2S2_2_0Value a)) := by + fin_cases a + · exact (entropyTerm_zero_ball ((B3_4_1Little_sound (shape 2 2 0) ((stageBPriority (shape 3 4 1)) 2)) (0 : Fin 6))) + · exact (entropyTerm_zero_ball ((B3_4_1Little_sound (shape 2 2 0) ((stageBPriority (shape 3 4 1)) 2)) (1 : Fin 6))) + · exact CB3_4_1I2S2_2_0E_2_sound + · exact CB3_4_1I2S2_2_0E_3_sound + · exact (entropyTerm_zero_ball ((B3_4_1Little_sound (shape 2 2 0) ((stageBPriority (shape 3 4 1)) 2)) (4 : Fin 6))) + · exact (entropyTerm_zero_ball ((B3_4_1Little_sound (shape 2 2 0) ((stageBPriority (shape 3 4 1)) 2)) (5 : Fin 6))) +def CB3_4_1I2S2_2_0Entropy : Ball := ⟨(7905102770167430500549469338991 / 25000000000000000000000000000000), (12112571147 / 25000000000000000000000000000000)⟩ +lemma CB3_4_1I2S2_2_0Entropy_sound : CB3_4_1I2S2_2_0Entropy.Encloses (Foundation.finiteEntropy CB3_4_1I2S2_2_0Value) := by + exact contains_sound (entropyFin_enclosed 6 CB3_4_1I2S2_2_0Value CB3_4_1I2S2_2_0Terms CB3_4_1I2S2_2_0Terms_sound) (by decide +kernel) +def CB3_4_1I2S2_2_0Mass : Ball := ⟨1, 0⟩ +lemma CB3_4_1I2S2_2_0Mass_sound : CB3_4_1I2S2_2_0Mass.Encloses (∑ a, CB3_4_1I2S2_2_0Value a) := by + exact contains_sound (finSumBall_sound 6 (B3_4_1Little (shape 2 2 0) ((stageBPriority (shape 3 4 1)) 2)) CB3_4_1I2S2_2_0Value (B3_4_1Little_sound (shape 2 2 0) ((stageBPriority (shape 3 4 1)) 2))) (by decide +kernel) +def CB3_4_1I2S2_2_0MassTermLog : Ball := .exact 0 +lemma CB3_4_1I2S2_2_0MassTermLog_sound : CB3_4_1I2S2_2_0MassTermLog.Encloses (Real.log ((∑ a, CB3_4_1I2S2_2_0Value a))) := by + exact log_exact_one_ball (CB3_4_1I2S2_2_0Mass_sound) +def CB3_4_1I2S2_2_0MassTerm : Ball := ⟨0, 0⟩ +lemma CB3_4_1I2S2_2_0MassTerm_sound : CB3_4_1I2S2_2_0MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB3_4_1I2S2_2_0Value a))) := by + exact contains_sound (entropyTerm_ball (CB3_4_1I2S2_2_0Mass_sound) CB3_4_1I2S2_2_0MassTermLog_sound) (by decide +kernel) +def CB3_4_1I2S2_2_0H : Ball := ⟨(7905102770167430500549469338991 / 25000000000000000000000000000000), (12112571147 / 25000000000000000000000000000000)⟩ +lemma CB3_4_1I2S2_2_0H_sound : CB3_4_1I2S2_2_0H.Encloses (homogeneousEntropy CB3_4_1I2S2_2_0Value) := by + exact contains_sound (homogeneous_enclosed CB3_4_1I2S2_2_0Value CB3_4_1I2S2_2_0MassTerm_sound CB3_4_1I2S2_2_0Entropy_sound) (by decide +kernel) +def CB3_4_1I2S3_1_0Value (a : Fin 6) : ℝ := (littleLaw (shape 3 4 1) (shape 3 1 0) ((stageBPriority (shape 3 4 1)) 2) a : ℝ) +def CB3_4_1I2S3_1_0E_1Log : Ball := .exact 0 +lemma CB3_4_1I2S3_1_0E_1Log_sound : CB3_4_1I2S3_1_0E_1Log.Encloses (Real.log (CB3_4_1I2S3_1_0Value (1 : Fin 6))) := by + exact log_exact_one_ball ((B3_4_1Little_sound (shape 3 1 0) ((stageBPriority (shape 3 4 1)) 2)) (1 : Fin 6)) +def CB3_4_1I2S3_1_0E_1 : Ball := ⟨0, 0⟩ +lemma CB3_4_1I2S3_1_0E_1_sound : CB3_4_1I2S3_1_0E_1.Encloses (Foundation.entropyTerm (CB3_4_1I2S3_1_0Value (1 : Fin 6))) := by + exact contains_sound (entropyTerm_ball ((B3_4_1Little_sound (shape 3 1 0) ((stageBPriority (shape 3 4 1)) 2)) (1 : Fin 6)) CB3_4_1I2S3_1_0E_1Log_sound) (by decide +kernel) +def CB3_4_1I2S3_1_0Terms (a : Fin 6) : Ball := + match a.val with + | 1 => ⟨0, 0⟩ + | _ => (.exact 0) +lemma CB3_4_1I2S3_1_0Terms_sound (a : Fin 6) : + (CB3_4_1I2S3_1_0Terms a).Encloses (Foundation.entropyTerm (CB3_4_1I2S3_1_0Value a)) := by + fin_cases a + · exact (entropyTerm_zero_ball ((B3_4_1Little_sound (shape 3 1 0) ((stageBPriority (shape 3 4 1)) 2)) (0 : Fin 6))) + · exact CB3_4_1I2S3_1_0E_1_sound + · exact (entropyTerm_zero_ball ((B3_4_1Little_sound (shape 3 1 0) ((stageBPriority (shape 3 4 1)) 2)) (2 : Fin 6))) + · exact (entropyTerm_zero_ball ((B3_4_1Little_sound (shape 3 1 0) ((stageBPriority (shape 3 4 1)) 2)) (3 : Fin 6))) + · exact (entropyTerm_zero_ball ((B3_4_1Little_sound (shape 3 1 0) ((stageBPriority (shape 3 4 1)) 2)) (4 : Fin 6))) + · exact (entropyTerm_zero_ball ((B3_4_1Little_sound (shape 3 1 0) ((stageBPriority (shape 3 4 1)) 2)) (5 : Fin 6))) +def CB3_4_1I2S3_1_0Entropy : Ball := ⟨0, 0⟩ +lemma CB3_4_1I2S3_1_0Entropy_sound : CB3_4_1I2S3_1_0Entropy.Encloses (Foundation.finiteEntropy CB3_4_1I2S3_1_0Value) := by + exact contains_sound (entropyFin_enclosed 6 CB3_4_1I2S3_1_0Value CB3_4_1I2S3_1_0Terms CB3_4_1I2S3_1_0Terms_sound) (by decide +kernel) +def CB3_4_1I2S3_1_0Mass : Ball := ⟨1, 0⟩ +lemma CB3_4_1I2S3_1_0Mass_sound : CB3_4_1I2S3_1_0Mass.Encloses (∑ a, CB3_4_1I2S3_1_0Value a) := by + exact contains_sound (finSumBall_sound 6 (B3_4_1Little (shape 3 1 0) ((stageBPriority (shape 3 4 1)) 2)) CB3_4_1I2S3_1_0Value (B3_4_1Little_sound (shape 3 1 0) ((stageBPriority (shape 3 4 1)) 2))) (by decide +kernel) +def CB3_4_1I2S3_1_0MassTermLog : Ball := .exact 0 +lemma CB3_4_1I2S3_1_0MassTermLog_sound : CB3_4_1I2S3_1_0MassTermLog.Encloses (Real.log ((∑ a, CB3_4_1I2S3_1_0Value a))) := by + exact log_exact_one_ball (CB3_4_1I2S3_1_0Mass_sound) +def CB3_4_1I2S3_1_0MassTerm : Ball := ⟨0, 0⟩ +lemma CB3_4_1I2S3_1_0MassTerm_sound : CB3_4_1I2S3_1_0MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB3_4_1I2S3_1_0Value a))) := by + exact contains_sound (entropyTerm_ball (CB3_4_1I2S3_1_0Mass_sound) CB3_4_1I2S3_1_0MassTermLog_sound) (by decide +kernel) +def CB3_4_1I2S3_1_0H : Ball := ⟨0, 0⟩ +lemma CB3_4_1I2S3_1_0H_sound : CB3_4_1I2S3_1_0H.Encloses (homogeneousEntropy CB3_4_1I2S3_1_0Value) := by + exact contains_sound (homogeneous_enclosed CB3_4_1I2S3_1_0Value CB3_4_1I2S3_1_0MassTerm_sound CB3_4_1I2S3_1_0Entropy_sound) (by decide +kernel) +def CB3_4_1I2Singles (s : Shape) : Ball := + match s 0, s 1, s 2 with + | 0, 3, 1 => CB3_4_1I2S0_3_1H + | 0, 4, 0 => CB3_4_1I2S0_4_0H + | 1, 3, 0 => CB3_4_1I2S1_3_0H + | 2, 2, 0 => CB3_4_1I2S2_2_0H + | 3, 1, 0 => CB3_4_1I2S3_1_0H + | _, _, _ => (.exact 0) +lemma CB3_4_1I2Singles_sound (u : Shape) (hu : u ∈ below (shape 3 4 1)) + (hd : designated (stageBPriority (shape 3 4 1)) 2 u) : + (CB3_4_1I2Singles u).Encloses (homogeneousEntropy ((fun u a => (littleLaw (shape 3 4 1) u ((stageBPriority (shape 3 4 1)) 2) a : ℝ)) u)) := by + rw [B3_4_1_below] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl + · exact CB3_4_1I2S0_3_1H_sound + · exact CB3_4_1I2S0_4_0H_sound + · exact (show ¬ designated (stageBPriority (shape 3 4 1)) 2 (shape 1 2 1) by decide +kernel) hd |>.elim + · exact CB3_4_1I2S1_3_0H_sound + · exact (show ¬ designated (stageBPriority (shape 3 4 1)) 2 (shape 2 1 1) by decide +kernel) hd |>.elim + · exact CB3_4_1I2S2_2_0H_sound + · exact (show ¬ designated (stageBPriority (shape 3 4 1)) 2 (shape 3 0 1) by decide +kernel) hd |>.elim + · exact CB3_4_1I2S3_1_0H_sound +def CB3_4_1I2Singleton : Ball := ⟨(13315044538811060974171729708563 / 100000000000000000000000000000000), (10200969489 / 50000000000000000000000000000000)⟩ +lemma CB3_4_1I2Singleton_sound : CB3_4_1I2Singleton.Encloses + (singletonEntropy (below (shape 3 4 1)) (fun u => (stageBLaw (shape 3 4 1) u : ℝ)) (stageBPriority (shape 3 4 1)) 2 (fun u a => (littleLaw (shape 3 4 1) u ((stageBPriority (shape 3 4 1)) 2) a : ℝ))) := by + exact contains_sound (singletonBall_sound (below (shape 3 4 1)) B3_4_1Law (fun u => (stageBLaw (shape 3 4 1) u : ℝ)) (stageBPriority (shape 3 4 1)) 2 + CB3_4_1I2Singles (fun u a => (littleLaw (shape 3 4 1) u ((stageBPriority (shape 3 4 1)) 2) a : ℝ)) (fun u _ => B3_4_1Law_sound u) CB3_4_1I2Singles_sound) (by decide +kernel) +def CB3_4_1I2Group : Ball := ⟨(7081763565342209845212481781513 / 50000000000000000000000000000000), (88196976203 / 100000000000000000000000000000000)⟩ +lemma CB3_4_1I2Group_sound : CB3_4_1I2Group.Encloses + (groupedEntropy (below (shape 3 4 1)) (fun u => (stageBLaw (shape 3 4 1) u : ℝ)) (stageBPriority (shape 3 4 1)) 2 (fun u a => (littleLaw (shape 3 4 1) u ((stageBPriority (shape 3 4 1)) 2) a : ℝ))) := by + exact contains_sound (Ball.add_sound CB3_4_1I2Singleton_sound + (finSumBall_sound 17 CB3_4_1I2ResidualEntropies _ CB3_4_1I2ResidualEntropies_sound)) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CB3_4_1I2H : Ball := ⟨(59684515547531102473505006465231 / 100000000000000000000000000000000), (128569659637 / 50000000000000000000000000000000)⟩ +lemma CB3_4_1I2_sound : CB3_4_1I2H.Encloses (stageBCapacity (shape 3 4 1) 2) := by + have hb := contains_sound (Ball.add_sound CB3_4_1I2PairH_sound + (Ball.neg_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) CB3_4_1I2Group_sound))) + (show contains (.add CB3_4_1I2PairH (.neg (.mul (.exact 2) CB3_4_1I2Group))) CB3_4_1I2H = true by decide +kernel) + unfold CB3_4_1I2PairValue at hb + simpa only [stageBCapacity, nativeCapacity, + show (2 : Fin 3) ≠ 0 by decide, ite_false, sub_eq_add_neg] using hb + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/CapacityB/CapB4_1_3I0.lean b/lean/OAI/LinearAlgebra/MatrixFields/CapacityB/CapB4_1_3I0.lean new file mode 100644 index 0000000000000000000000000000000000000000..268c7382332e27d63ee5a901ee1df61db931e44f --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/CapacityB/CapB4_1_3I0.lean @@ -0,0 +1,72 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Certificates.Terminal4_1_3 + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CB4_1_3I0Value (a : Fin 17) : ℝ := marginal (below (shape 4 1 3)) (fun u => (stageBLaw (shape 4 1 3) u : ℝ)) ((stageBPriority (shape 4 1 3)) 0) a +def CB4_1_3I0Raw (a : Fin 17) : Ball := marginalBall (below (shape 4 1 3)) B4_1_3Law ((stageBPriority (shape 4 1 3)) 0) a +lemma CB4_1_3I0Raw_sound (a : Fin 17) : + (CB4_1_3I0Raw a).Encloses (CB4_1_3I0Value a) := by + exact marginalBall_sound (below (shape 4 1 3)) B4_1_3Law (fun u => (stageBLaw (shape 4 1 3) u : ℝ)) (fun u _ => B4_1_3Law_sound u) ((stageBPriority (shape 4 1 3)) 0) a +def CB4_1_3I0Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(1 / 2), (13 / 50000000000000000000000000000000)⟩ ⟨(6931471805599453094172319305033 / 20000000000000000000000000000000), (21175823727 / 100000000000000000000000000000000)⟩ ⟨(-6931471805599453094172319305033 / 10000000000000000000000000000000), (42351647417 / 100000000000000000000000000000000)⟩ ⟨-1, 1, 1⟩] +lemma CB4_1_3I0Certificates_valid : + CB4_1_3I0Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB4_1_3I0CertificateIndex (a : Fin 17) : ℕ := + match a.val with + | 1 => 1 + | 0 => 1 + | _ => 0 +def CB4_1_3I0P (a : Fin 17) : Ball := + (CompactCertificate.entropyLookup CB4_1_3I0Certificates (CB4_1_3I0CertificateIndex a)).input +lemma CB4_1_3I0P_check : ∀ a : Fin 17, contains (CB4_1_3I0Raw a) (CB4_1_3I0P a) = true := by + decide +kernel +lemma CB4_1_3I0P_sound (a : Fin 17) : + (CB4_1_3I0P a).Encloses (CB4_1_3I0Value a) := + contains_sound (CB4_1_3I0Raw_sound a) (CB4_1_3I0P_check a) +def CB4_1_3I0Terms (a : Fin 17) : Ball := + (CompactCertificate.entropyLookup CB4_1_3I0Certificates (CB4_1_3I0CertificateIndex a)).output +lemma CB4_1_3I0Terms_sound (a : Fin 17) : + (CB4_1_3I0Terms a).Encloses (Foundation.entropyTerm (CB4_1_3I0Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB4_1_3I0Certificates_valid + (CB4_1_3I0CertificateIndex a) (CB4_1_3I0P_sound a) +def CB4_1_3I0Entropy : Ball := ⟨(6931471805599453094172319305033 / 10000000000000000000000000000000), (21175823727 / 50000000000000000000000000000000)⟩ +lemma CB4_1_3I0Entropy_sound : CB4_1_3I0Entropy.Encloses (Foundation.finiteEntropy CB4_1_3I0Value) := by + exact contains_sound (entropyFin_enclosed 17 CB4_1_3I0Value CB4_1_3I0Terms CB4_1_3I0Terms_sound) (by decide +kernel) +def CB4_1_3I0Mass : Ball := ⟨1, (13 / 25000000000000000000000000000000)⟩ +lemma CB4_1_3I0Mass_sound : CB4_1_3I0Mass.Encloses (∑ a, CB4_1_3I0Value a) := by + exact contains_sound (finSumBall_sound 17 CB4_1_3I0P CB4_1_3I0Value CB4_1_3I0P_sound) (by decide +kernel) +def CB4_1_3I0MassTermLogWitness : LogWitness := ⟨0, 1, 1⟩ +def CB4_1_3I0MassTermLog : Ball := ⟨0, (10587911867 / 50000000000000000000000000000000)⟩ +lemma CB4_1_3I0MassTermLog_sound : CB4_1_3I0MassTermLog.Encloses (Real.log ((∑ a, CB4_1_3I0Value a))) := by + exact checkLog_sound logTwoBall_sound (CB4_1_3I0Mass_sound) (w := CB4_1_3I0MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB4_1_3I0MassTerm : Ball := ⟨0, (4235164747 / 20000000000000000000000000000000)⟩ +lemma CB4_1_3I0MassTerm_sound : CB4_1_3I0MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB4_1_3I0Value a))) := by + exact contains_sound (entropyTerm_ball (CB4_1_3I0Mass_sound) CB4_1_3I0MassTermLog_sound) (by decide +kernel) +def CB4_1_3I0H : Ball := ⟨(6931471805599453094172319305033 / 10000000000000000000000000000000), (63527471189 / 100000000000000000000000000000000)⟩ +lemma CB4_1_3I0H_sound : CB4_1_3I0H.Encloses (homogeneousEntropy CB4_1_3I0Value) := by + exact contains_sound (homogeneous_enclosed CB4_1_3I0Value CB4_1_3I0MassTerm_sound CB4_1_3I0Entropy_sound) (by decide +kernel) +lemma CB4_1_3I0_sound : CB4_1_3I0H.Encloses (stageBCapacity (shape 4 1 3) 0) := by + exact CB4_1_3I0H_sound + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/CapacityB/CapB4_1_3I1.lean b/lean/OAI/LinearAlgebra/MatrixFields/CapacityB/CapB4_1_3I1.lean new file mode 100644 index 0000000000000000000000000000000000000000..c9efa428af00a4d6a8da0bc4bc01de8cea0a2c93 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/CapacityB/CapB4_1_3I1.lean @@ -0,0 +1,888 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Certificates.Terminal4_1_3 + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CB4_1_3I1PairValue (a : PairSlot) : ℝ := pairLaw (below (shape 4 1 3)) (shape 4 1 3) (fun u => (stageBLaw (shape 4 1 3) u : ℝ)) (fun u a => (littleLaw (shape 4 1 3) u ((stageBPriority (shape 4 1 3)) 1) a : ℝ)) a +def CB4_1_3I1PairRaw (a : PairSlot) : Ball := pairLawBall (below (shape 4 1 3)) (shape 4 1 3) B4_1_3Law (fun u => B4_1_3Little u ((stageBPriority (shape 4 1 3)) 1)) a +lemma CB4_1_3I1PairRaw_sound (a : PairSlot) : + (CB4_1_3I1PairRaw a).Encloses (CB4_1_3I1PairValue a) := by + exact pairLawBall_sound_on (below (shape 4 1 3)) (shape 4 1 3) B4_1_3Law (fun u => (stageBLaw (shape 4 1 3) u : ℝ)) (fun u => B4_1_3Little u ((stageBPriority (shape 4 1 3)) 1)) (fun u a => (littleLaw (shape 4 1 3) u ((stageBPriority (shape 4 1 3)) 1) a : ℝ)) (fun u _ => B4_1_3Law_sound u) (fun u _ a => B4_1_3Little_sound u ((stageBPriority (shape 4 1 3)) 1) a) (fun u _ a => B4_1_3Little_sound (complement (shape 4 1 3) u) ((stageBPriority (shape 4 1 3)) 1) a) a +def CB4_1_3I1PairCertificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(662466132560089079394730321331 / 50000000000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ ⟨(5728753851617104939935642134859 / 100000000000000000000000000000000), (561130649 / 25000000000000000000000000000000)⟩ ⟨(-13511902651626962495991387351859 / 3125000000000000000000000000000), (169406589917 / 100000000000000000000000000000000)⟩ ⟨-7, 662466132560089079394730321331, 390625000000000000000000000000⟩, + .log ⟨(44369774122421474207741998278713 / 100000000000000000000000000000000), (19 / 100000000000000000000000000000000)⟩ ⟨(7211079616657767701244038170479 / 20000000000000000000000000000000), (5637399089 / 20000000000000000000000000000000)⟩ ⟨(-16252234227655842844844158014481 / 20000000000000000000000000000000), (15881867773 / 25000000000000000000000000000000)⟩ ⟨-2, 44369774122421474207741998278713, 25000000000000000000000000000000⟩, + .log ⟨(34442348899666781067748328629 / 800000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ ⟨(13541546976221279215223435723669 / 100000000000000000000000000000000), (1094017663 / 20000000000000000000000000000000)⟩ ⟨(-314532484777245594620716690885861 / 100000000000000000000000000000000), (1985233471 / 1562500000000000000000000000000)⟩ ⟨-5, 34442348899666781067748328629, 25000000000000000000000000000⟩] +lemma CB4_1_3I1PairCertificates_valid : + CB4_1_3I1PairCertificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB4_1_3I1PairCertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 4, 0 => 1 + | 2, 1 => 2 + | 3, 1 => 3 + | 1, 2 => 2 + | 1, 3 => 3 + | 0, 4 => 1 + | _, _ => 0 +def CB4_1_3I1PairP (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CB4_1_3I1PairCertificates (CB4_1_3I1PairCertificateIndex a)).input +lemma CB4_1_3I1PairP_check : ∀ a : PairSlot, contains (CB4_1_3I1PairRaw a) (CB4_1_3I1PairP a) = true := by + decide +kernel +lemma CB4_1_3I1PairP_sound (a : PairSlot) : + (CB4_1_3I1PairP a).Encloses (CB4_1_3I1PairValue a) := + contains_sound (CB4_1_3I1PairRaw_sound a) (CB4_1_3I1PairP_check a) +def CB4_1_3I1PairTerms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CB4_1_3I1PairCertificates (CB4_1_3I1PairCertificateIndex a)).output +lemma CB4_1_3I1PairTerms_sound (a : PairSlot) : + (CB4_1_3I1PairTerms a).Encloses (Foundation.entropyTerm (CB4_1_3I1PairValue a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB4_1_3I1PairCertificates_valid + (CB4_1_3I1PairCertificateIndex a) (CB4_1_3I1PairP_sound a) +def CB4_1_3I1PairEntropy : Ball := ⟨(55325698911127222661379268710923 / 50000000000000000000000000000000), (8975401589 / 12500000000000000000000000000000)⟩ +lemma CB4_1_3I1PairEntropy_sound : CB4_1_3I1PairEntropy.Encloses (Foundation.finiteEntropy CB4_1_3I1PairValue) := by + exact contains_sound (entropyPair_enclosed CB4_1_3I1PairValue CB4_1_3I1PairTerms CB4_1_3I1PairTerms_sound) (by decide +kernel) +def CB4_1_3I1PairMass : Ball := ⟨1, (27 / 50000000000000000000000000000000)⟩ +lemma CB4_1_3I1PairMass_sound : CB4_1_3I1PairMass.Encloses (∑ a, CB4_1_3I1PairValue a) := by + exact contains_sound (pairSumBall_sound CB4_1_3I1PairP CB4_1_3I1PairValue CB4_1_3I1PairP_sound) (by decide +kernel) +def CB4_1_3I1PairMassTermLogWitness : LogWitness := ⟨0, 1, 1⟩ +def CB4_1_3I1PairMassTermLog : Ball := ⟨0, (2646977967 / 12500000000000000000000000000000)⟩ +lemma CB4_1_3I1PairMassTermLog_sound : CB4_1_3I1PairMassTermLog.Encloses (Real.log ((∑ a, CB4_1_3I1PairValue a))) := by + exact checkLog_sound logTwoBall_sound (CB4_1_3I1PairMass_sound) (w := CB4_1_3I1PairMassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB4_1_3I1PairMassTerm : Ball := ⟨0, (21175823737 / 100000000000000000000000000000000)⟩ +lemma CB4_1_3I1PairMassTerm_sound : CB4_1_3I1PairMassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB4_1_3I1PairValue a))) := by + exact contains_sound (entropyTerm_ball (CB4_1_3I1PairMass_sound) CB4_1_3I1PairMassTermLog_sound) (by decide +kernel) +def CB4_1_3I1PairH : Ball := ⟨(55325698911127222661379268710923 / 50000000000000000000000000000000), (92979036449 / 100000000000000000000000000000000)⟩ +lemma CB4_1_3I1PairH_sound : CB4_1_3I1PairH.Encloses (homogeneousEntropy CB4_1_3I1PairValue) := by + exact contains_sound (homogeneous_enclosed CB4_1_3I1PairValue CB4_1_3I1PairMassTerm_sound CB4_1_3I1PairEntropy_sound) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CB4_1_3I1R0Value (a : Fin 6) : ℝ := residualLaw (below (shape 4 1 3)) (fun u => (stageBLaw (shape 4 1 3) u : ℝ)) (stageBPriority (shape 4 1 3)) 1 (fun u a => (littleLaw (shape 4 1 3) u ((stageBPriority (shape 4 1 3)) 1) a : ℝ)) 0 a +def CB4_1_3I1R0Raw (a : Fin 6) : Ball := residualBall (below (shape 4 1 3)) B4_1_3Law (stageBPriority (shape 4 1 3)) 1 (fun u => B4_1_3Little u ((stageBPriority (shape 4 1 3)) 1)) 0 a +lemma CB4_1_3I1R0Raw_sound (a : Fin 6) : + (CB4_1_3I1R0Raw a).Encloses (CB4_1_3I1R0Value a) := by + exact residualBall_sound_on (below (shape 4 1 3)) B4_1_3Law (fun u => (stageBLaw (shape 4 1 3) u : ℝ)) (stageBPriority (shape 4 1 3)) 1 (fun u => B4_1_3Little u ((stageBPriority (shape 4 1 3)) 1)) (fun u a => (littleLaw (shape 4 1 3) u ((stageBPriority (shape 4 1 3)) 1) a : ℝ)) (fun u _ => B4_1_3Law_sound u) (fun u _ a => B4_1_3Little_sound u ((stageBPriority (shape 4 1 3)) 1) a) 0 a +def CB4_1_3I1R0Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(662466132560089079394730321331 / 50000000000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ ⟨(5728753851617104939935642134859 / 100000000000000000000000000000000), (561130649 / 25000000000000000000000000000000)⟩ ⟨(-13511902651626962495991387351859 / 3125000000000000000000000000000), (169406589917 / 100000000000000000000000000000000)⟩ ⟨-7, 662466132560089079394730321331, 390625000000000000000000000000⟩] +lemma CB4_1_3I1R0Certificates_valid : + CB4_1_3I1R0Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB4_1_3I1R0CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | 0 => 1 + | _ => 0 +def CB4_1_3I1R0P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB4_1_3I1R0Certificates (CB4_1_3I1R0CertificateIndex a)).input +lemma CB4_1_3I1R0P_check : ∀ a : Fin 6, contains (CB4_1_3I1R0Raw a) (CB4_1_3I1R0P a) = true := by + decide +kernel +lemma CB4_1_3I1R0P_sound (a : Fin 6) : + (CB4_1_3I1R0P a).Encloses (CB4_1_3I1R0Value a) := + contains_sound (CB4_1_3I1R0Raw_sound a) (CB4_1_3I1R0P_check a) +def CB4_1_3I1R0Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB4_1_3I1R0Certificates (CB4_1_3I1R0CertificateIndex a)).output +lemma CB4_1_3I1R0Terms_sound (a : Fin 6) : + (CB4_1_3I1R0Terms a).Encloses (Foundation.entropyTerm (CB4_1_3I1R0Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB4_1_3I1R0Certificates_valid + (CB4_1_3I1R0CertificateIndex a) (CB4_1_3I1R0P_sound a) +def CB4_1_3I1R0Entropy : Ball := ⟨(5728753851617104939935642134859 / 100000000000000000000000000000000), (561130649 / 25000000000000000000000000000000)⟩ +lemma CB4_1_3I1R0Entropy_sound : CB4_1_3I1R0Entropy.Encloses (Foundation.finiteEntropy CB4_1_3I1R0Value) := by + exact contains_sound (entropyFin_enclosed 6 CB4_1_3I1R0Value CB4_1_3I1R0Terms CB4_1_3I1R0Terms_sound) (by decide +kernel) +def CB4_1_3I1R0Mass : Ball := ⟨(662466132560089079394730321331 / 50000000000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ +lemma CB4_1_3I1R0Mass_sound : CB4_1_3I1R0Mass.Encloses (∑ a, CB4_1_3I1R0Value a) := by + exact contains_sound (finSumBall_sound 6 CB4_1_3I1R0P CB4_1_3I1R0Value CB4_1_3I1R0P_sound) (by decide +kernel) +def CB4_1_3I1R0MassTermLogWitness : LogWitness := ⟨-7, 662466132560089079394730321331, 390625000000000000000000000000⟩ +def CB4_1_3I1R0MassTermLog : Ball := ⟨(-13511902651626962495991387351859 / 3125000000000000000000000000000), (169406589917 / 100000000000000000000000000000000)⟩ +lemma CB4_1_3I1R0MassTermLog_sound : CB4_1_3I1R0MassTermLog.Encloses (Real.log ((∑ a, CB4_1_3I1R0Value a))) := by + exact checkLog_sound logTwoBall_sound (CB4_1_3I1R0Mass_sound) (w := CB4_1_3I1R0MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB4_1_3I1R0MassTerm : Ball := ⟨(5728753851617104939935642134859 / 100000000000000000000000000000000), (561130649 / 25000000000000000000000000000000)⟩ +lemma CB4_1_3I1R0MassTerm_sound : CB4_1_3I1R0MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB4_1_3I1R0Value a))) := by + exact contains_sound (entropyTerm_ball (CB4_1_3I1R0Mass_sound) CB4_1_3I1R0MassTermLog_sound) (by decide +kernel) +def CB4_1_3I1R0H : Ball := ⟨0, (561130649 / 12500000000000000000000000000000)⟩ +lemma CB4_1_3I1R0H_sound : CB4_1_3I1R0H.Encloses (homogeneousEntropy CB4_1_3I1R0Value) := by + exact contains_sound (homogeneous_enclosed CB4_1_3I1R0Value CB4_1_3I1R0MassTerm_sound CB4_1_3I1R0Entropy_sound) (by decide +kernel) +def CB4_1_3I1R1Value (a : Fin 6) : ℝ := residualLaw (below (shape 4 1 3)) (fun u => (stageBLaw (shape 4 1 3) u : ℝ)) (stageBPriority (shape 4 1 3)) 1 (fun u a => (littleLaw (shape 4 1 3) u ((stageBPriority (shape 4 1 3)) 1) a : ℝ)) 1 a +def CB4_1_3I1R1Raw (a : Fin 6) : Ball := residualBall (below (shape 4 1 3)) B4_1_3Law (stageBPriority (shape 4 1 3)) 1 (fun u => B4_1_3Little u ((stageBPriority (shape 4 1 3)) 1)) 1 a +lemma CB4_1_3I1R1Raw_sound (a : Fin 6) : + (CB4_1_3I1R1Raw a).Encloses (CB4_1_3I1R1Value a) := by + exact residualBall_sound_on (below (shape 4 1 3)) B4_1_3Law (fun u => (stageBLaw (shape 4 1 3) u : ℝ)) (stageBPriority (shape 4 1 3)) 1 (fun u => B4_1_3Little u ((stageBPriority (shape 4 1 3)) 1)) (fun u a => (littleLaw (shape 4 1 3) u ((stageBPriority (shape 4 1 3)) 1) a : ℝ)) (fun u _ => B4_1_3Law_sound u) (fun u _ a => B4_1_3Little_sound u ((stageBPriority (shape 4 1 3)) 1) a) 1 a +def CB4_1_3I1R1Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(24337533867439910920605269678669 / 50000000000000000000000000000000), (1 / 5000000000000000000000000000000)⟩ ⟨(3504620662997483087558516975869 / 10000000000000000000000000000000), (15461019799 / 50000000000000000000000000000000)⟩ ⟨(-18000081078912010444514153845647 / 25000000000000000000000000000000), (6352747109 / 10000000000000000000000000000000)⟩ ⟨-2, 24337533867439910920605269678669, 12500000000000000000000000000000⟩] +lemma CB4_1_3I1R1Certificates_valid : + CB4_1_3I1R1Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB4_1_3I1R1CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | 1 => 1 + | _ => 0 +def CB4_1_3I1R1P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB4_1_3I1R1Certificates (CB4_1_3I1R1CertificateIndex a)).input +lemma CB4_1_3I1R1P_check : ∀ a : Fin 6, contains (CB4_1_3I1R1Raw a) (CB4_1_3I1R1P a) = true := by + decide +kernel +lemma CB4_1_3I1R1P_sound (a : Fin 6) : + (CB4_1_3I1R1P a).Encloses (CB4_1_3I1R1Value a) := + contains_sound (CB4_1_3I1R1Raw_sound a) (CB4_1_3I1R1P_check a) +def CB4_1_3I1R1Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB4_1_3I1R1Certificates (CB4_1_3I1R1CertificateIndex a)).output +lemma CB4_1_3I1R1Terms_sound (a : Fin 6) : + (CB4_1_3I1R1Terms a).Encloses (Foundation.entropyTerm (CB4_1_3I1R1Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB4_1_3I1R1Certificates_valid + (CB4_1_3I1R1CertificateIndex a) (CB4_1_3I1R1P_sound a) +def CB4_1_3I1R1Entropy : Ball := ⟨(3504620662997483087558516975869 / 10000000000000000000000000000000), (15461019799 / 50000000000000000000000000000000)⟩ +lemma CB4_1_3I1R1Entropy_sound : CB4_1_3I1R1Entropy.Encloses (Foundation.finiteEntropy CB4_1_3I1R1Value) := by + exact contains_sound (entropyFin_enclosed 6 CB4_1_3I1R1Value CB4_1_3I1R1Terms CB4_1_3I1R1Terms_sound) (by decide +kernel) +def CB4_1_3I1R1Mass : Ball := ⟨(24337533867439910920605269678669 / 50000000000000000000000000000000), (1 / 5000000000000000000000000000000)⟩ +lemma CB4_1_3I1R1Mass_sound : CB4_1_3I1R1Mass.Encloses (∑ a, CB4_1_3I1R1Value a) := by + exact contains_sound (finSumBall_sound 6 CB4_1_3I1R1P CB4_1_3I1R1Value CB4_1_3I1R1P_sound) (by decide +kernel) +def CB4_1_3I1R1MassTermLogWitness : LogWitness := ⟨-2, 24337533867439910920605269678669, 12500000000000000000000000000000⟩ +def CB4_1_3I1R1MassTermLog : Ball := ⟨(-18000081078912010444514153845647 / 25000000000000000000000000000000), (6352747109 / 10000000000000000000000000000000)⟩ +lemma CB4_1_3I1R1MassTermLog_sound : CB4_1_3I1R1MassTermLog.Encloses (Real.log ((∑ a, CB4_1_3I1R1Value a))) := by + exact checkLog_sound logTwoBall_sound (CB4_1_3I1R1Mass_sound) (w := CB4_1_3I1R1MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB4_1_3I1R1MassTerm : Ball := ⟨(3504620662997483087558516975869 / 10000000000000000000000000000000), (15461019799 / 50000000000000000000000000000000)⟩ +lemma CB4_1_3I1R1MassTerm_sound : CB4_1_3I1R1MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB4_1_3I1R1Value a))) := by + exact contains_sound (entropyTerm_ball (CB4_1_3I1R1Mass_sound) CB4_1_3I1R1MassTermLog_sound) (by decide +kernel) +def CB4_1_3I1R1H : Ball := ⟨0, (15461019799 / 25000000000000000000000000000000)⟩ +lemma CB4_1_3I1R1H_sound : CB4_1_3I1R1H.Encloses (homogeneousEntropy CB4_1_3I1R1Value) := by + exact contains_sound (homogeneous_enclosed CB4_1_3I1R1Value CB4_1_3I1R1MassTerm_sound CB4_1_3I1R1Entropy_sound) (by decide +kernel) +def CB4_1_3I1R2Value (a : Fin 6) : ℝ := residualLaw (below (shape 4 1 3)) (fun u => (stageBLaw (shape 4 1 3) u : ℝ)) (stageBPriority (shape 4 1 3)) 1 (fun u a => (littleLaw (shape 4 1 3) u ((stageBPriority (shape 4 1 3)) 1) a : ℝ)) 2 a +def CB4_1_3I1R2Raw (a : Fin 6) : Ball := residualBall (below (shape 4 1 3)) B4_1_3Law (stageBPriority (shape 4 1 3)) 1 (fun u => B4_1_3Little u ((stageBPriority (shape 4 1 3)) 1)) 2 a +lemma CB4_1_3I1R2Raw_sound (a : Fin 6) : + (CB4_1_3I1R2Raw a).Encloses (CB4_1_3I1R2Value a) := by + exact residualBall_sound_on (below (shape 4 1 3)) B4_1_3Law (fun u => (stageBLaw (shape 4 1 3) u : ℝ)) (stageBPriority (shape 4 1 3)) 1 (fun u => B4_1_3Little u ((stageBPriority (shape 4 1 3)) 1)) (fun u a => (littleLaw (shape 4 1 3) u ((stageBPriority (shape 4 1 3)) 1) a : ℝ)) (fun u _ => B4_1_3Law_sound u) (fun u _ a => B4_1_3Little_sound u ((stageBPriority (shape 4 1 3)) 1) a) 2 a +def CB4_1_3I1R2Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(44369774122421474207741998278713 / 100000000000000000000000000000000), (19 / 100000000000000000000000000000000)⟩ ⟨(7211079616657767701244038170479 / 20000000000000000000000000000000), (5637399089 / 20000000000000000000000000000000)⟩ ⟨(-16252234227655842844844158014481 / 20000000000000000000000000000000), (15881867773 / 25000000000000000000000000000000)⟩ ⟨-2, 44369774122421474207741998278713, 25000000000000000000000000000000⟩, + .log ⟨(34442348899666781067748328629 / 800000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ ⟨(13541546976221279215223435723669 / 100000000000000000000000000000000), (1094017663 / 20000000000000000000000000000000)⟩ ⟨(-314532484777245594620716690885861 / 100000000000000000000000000000000), (1985233471 / 1562500000000000000000000000000)⟩ ⟨-5, 34442348899666781067748328629, 25000000000000000000000000000⟩] +lemma CB4_1_3I1R2Certificates_valid : + CB4_1_3I1R2Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB4_1_3I1R2CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | 2 => 1 + | 3 => 2 + | _ => 0 +def CB4_1_3I1R2P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB4_1_3I1R2Certificates (CB4_1_3I1R2CertificateIndex a)).input +lemma CB4_1_3I1R2P_check : ∀ a : Fin 6, contains (CB4_1_3I1R2Raw a) (CB4_1_3I1R2P a) = true := by + decide +kernel +lemma CB4_1_3I1R2P_sound (a : Fin 6) : + (CB4_1_3I1R2P a).Encloses (CB4_1_3I1R2Value a) := + contains_sound (CB4_1_3I1R2Raw_sound a) (CB4_1_3I1R2P_check a) +def CB4_1_3I1R2Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB4_1_3I1R2Certificates (CB4_1_3I1R2CertificateIndex a)).output +lemma CB4_1_3I1R2Terms_sound (a : Fin 6) : + (CB4_1_3I1R2Terms a).Encloses (Foundation.entropyTerm (CB4_1_3I1R2Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB4_1_3I1R2Certificates_valid + (CB4_1_3I1R2CertificateIndex a) (CB4_1_3I1R2P_sound a) +def CB4_1_3I1R2Entropy : Ball := ⟨(774952266554845589397556665251 / 1562500000000000000000000000000), (420713547 / 1250000000000000000000000000000)⟩ +lemma CB4_1_3I1R2Entropy_sound : CB4_1_3I1R2Entropy.Encloses (Foundation.finiteEntropy CB4_1_3I1R2Value) := by + exact contains_sound (entropyFin_enclosed 6 CB4_1_3I1R2Value CB4_1_3I1R2Terms CB4_1_3I1R2Terms_sound) (by decide +kernel) +def CB4_1_3I1R2Mass : Ball := ⟨(24337533867439910920605269678669 / 50000000000000000000000000000000), (21 / 100000000000000000000000000000000)⟩ +lemma CB4_1_3I1R2Mass_sound : CB4_1_3I1R2Mass.Encloses (∑ a, CB4_1_3I1R2Value a) := by + exact contains_sound (finSumBall_sound 6 CB4_1_3I1R2P CB4_1_3I1R2Value CB4_1_3I1R2P_sound) (by decide +kernel) +def CB4_1_3I1R2MassTermLogWitness : LogWitness := ⟨-2, 24337533867439910920605269678669, 12500000000000000000000000000000⟩ +def CB4_1_3I1R2MassTermLog : Ball := ⟨(-18000081078912010444514153845647 / 25000000000000000000000000000000), (15881867773 / 25000000000000000000000000000000)⟩ +lemma CB4_1_3I1R2MassTermLog_sound : CB4_1_3I1R2MassTermLog.Encloses (Real.log ((∑ a, CB4_1_3I1R2Value a))) := by + exact checkLog_sound logTwoBall_sound (CB4_1_3I1R2Mass_sound) (w := CB4_1_3I1R2MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB4_1_3I1R2MassTerm : Ball := ⟨(3504620662997483087558516975869 / 10000000000000000000000000000000), (77305099 / 250000000000000000000000000000)⟩ +lemma CB4_1_3I1R2MassTerm_sound : CB4_1_3I1R2MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB4_1_3I1R2Value a))) := by + exact contains_sound (entropyTerm_ball (CB4_1_3I1R2Mass_sound) CB4_1_3I1R2MassTermLog_sound) (by decide +kernel) +def CB4_1_3I1R2H : Ball := ⟨(7275369214767643422929228408687 / 50000000000000000000000000000000), (403619521 / 625000000000000000000000000000)⟩ +lemma CB4_1_3I1R2H_sound : CB4_1_3I1R2H.Encloses (homogeneousEntropy CB4_1_3I1R2Value) := by + exact contains_sound (homogeneous_enclosed CB4_1_3I1R2Value CB4_1_3I1R2MassTerm_sound CB4_1_3I1R2Entropy_sound) (by decide +kernel) +def CB4_1_3I1R3Value (a : Fin 6) : ℝ := residualLaw (below (shape 4 1 3)) (fun u => (stageBLaw (shape 4 1 3) u : ℝ)) (stageBPriority (shape 4 1 3)) 1 (fun u a => (littleLaw (shape 4 1 3) u ((stageBPriority (shape 4 1 3)) 1) a : ℝ)) 3 a +def CB4_1_3I1R3Raw (a : Fin 6) : Ball := residualBall (below (shape 4 1 3)) B4_1_3Law (stageBPriority (shape 4 1 3)) 1 (fun u => B4_1_3Little u ((stageBPriority (shape 4 1 3)) 1)) 3 a +lemma CB4_1_3I1R3Raw_sound (a : Fin 6) : + (CB4_1_3I1R3Raw a).Encloses (CB4_1_3I1R3Value a) := by + exact residualBall_sound_on (below (shape 4 1 3)) B4_1_3Law (fun u => (stageBLaw (shape 4 1 3) u : ℝ)) (stageBPriority (shape 4 1 3)) 1 (fun u => B4_1_3Little u ((stageBPriority (shape 4 1 3)) 1)) (fun u a => (littleLaw (shape 4 1 3) u ((stageBPriority (shape 4 1 3)) 1) a : ℝ)) (fun u _ => B4_1_3Law_sound u) (fun u _ a => B4_1_3Little_sound u ((stageBPriority (shape 4 1 3)) 1) a) 3 a +def CB4_1_3I1R3Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(2066377148910784129369940729 / 160000000000000000000000000000), (1 / 20000000000000000000000000000000)⟩ ⟨(2808579081464389644802916826581 / 50000000000000000000000000000000), (136741371 / 6250000000000000000000000000000)⟩ ⟨(-108734422772525543341333743967741 / 25000000000000000000000000000000), (169406589851 / 100000000000000000000000000000000)⟩ ⟨-7, 2066377148910784129369940729, 1250000000000000000000000000⟩] +lemma CB4_1_3I1R3Certificates_valid : + CB4_1_3I1R3Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB4_1_3I1R3CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | 4 => 1 + | _ => 0 +def CB4_1_3I1R3P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB4_1_3I1R3Certificates (CB4_1_3I1R3CertificateIndex a)).input +lemma CB4_1_3I1R3P_check : ∀ a : Fin 6, contains (CB4_1_3I1R3Raw a) (CB4_1_3I1R3P a) = true := by + decide +kernel +lemma CB4_1_3I1R3P_sound (a : Fin 6) : + (CB4_1_3I1R3P a).Encloses (CB4_1_3I1R3Value a) := + contains_sound (CB4_1_3I1R3Raw_sound a) (CB4_1_3I1R3P_check a) +def CB4_1_3I1R3Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB4_1_3I1R3Certificates (CB4_1_3I1R3CertificateIndex a)).output +lemma CB4_1_3I1R3Terms_sound (a : Fin 6) : + (CB4_1_3I1R3Terms a).Encloses (Foundation.entropyTerm (CB4_1_3I1R3Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB4_1_3I1R3Certificates_valid + (CB4_1_3I1R3CertificateIndex a) (CB4_1_3I1R3P_sound a) +def CB4_1_3I1R3Entropy : Ball := ⟨(2808579081464389644802916826581 / 50000000000000000000000000000000), (136741371 / 6250000000000000000000000000000)⟩ +lemma CB4_1_3I1R3Entropy_sound : CB4_1_3I1R3Entropy.Encloses (Foundation.finiteEntropy CB4_1_3I1R3Value) := by + exact contains_sound (entropyFin_enclosed 6 CB4_1_3I1R3Value CB4_1_3I1R3Terms CB4_1_3I1R3Terms_sound) (by decide +kernel) +def CB4_1_3I1R3Mass : Ball := ⟨(2066377148910784129369940729 / 160000000000000000000000000000), (1 / 20000000000000000000000000000000)⟩ +lemma CB4_1_3I1R3Mass_sound : CB4_1_3I1R3Mass.Encloses (∑ a, CB4_1_3I1R3Value a) := by + exact contains_sound (finSumBall_sound 6 CB4_1_3I1R3P CB4_1_3I1R3Value CB4_1_3I1R3P_sound) (by decide +kernel) +def CB4_1_3I1R3MassTermLogWitness : LogWitness := ⟨-7, 2066377148910784129369940729, 1250000000000000000000000000⟩ +def CB4_1_3I1R3MassTermLog : Ball := ⟨(-108734422772525543341333743967741 / 25000000000000000000000000000000), (169406589851 / 100000000000000000000000000000000)⟩ +lemma CB4_1_3I1R3MassTermLog_sound : CB4_1_3I1R3MassTermLog.Encloses (Real.log ((∑ a, CB4_1_3I1R3Value a))) := by + exact checkLog_sound logTwoBall_sound (CB4_1_3I1R3Mass_sound) (w := CB4_1_3I1R3MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB4_1_3I1R3MassTerm : Ball := ⟨(2808579081464389644802916826581 / 50000000000000000000000000000000), (136741371 / 6250000000000000000000000000000)⟩ +lemma CB4_1_3I1R3MassTerm_sound : CB4_1_3I1R3MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB4_1_3I1R3Value a))) := by + exact contains_sound (entropyTerm_ball (CB4_1_3I1R3Mass_sound) CB4_1_3I1R3MassTermLog_sound) (by decide +kernel) +def CB4_1_3I1R3H : Ball := ⟨0, (136741371 / 3125000000000000000000000000000)⟩ +lemma CB4_1_3I1R3H_sound : CB4_1_3I1R3H.Encloses (homogeneousEntropy CB4_1_3I1R3Value) := by + exact contains_sound (homogeneous_enclosed CB4_1_3I1R3Value CB4_1_3I1R3MassTerm_sound CB4_1_3I1R3Entropy_sound) (by decide +kernel) +def CB4_1_3I1R4Value (a : Fin 6) : ℝ := residualLaw (below (shape 4 1 3)) (fun u => (stageBLaw (shape 4 1 3) u : ℝ)) (stageBPriority (shape 4 1 3)) 1 (fun u a => (littleLaw (shape 4 1 3) u ((stageBPriority (shape 4 1 3)) 1) a : ℝ)) 4 a +def CB4_1_3I1R4Raw (a : Fin 6) : Ball := residualBall (below (shape 4 1 3)) B4_1_3Law (stageBPriority (shape 4 1 3)) 1 (fun u => B4_1_3Little u ((stageBPriority (shape 4 1 3)) 1)) 4 a +lemma CB4_1_3I1R4Raw_sound (a : Fin 6) : + (CB4_1_3I1R4Raw a).Encloses (CB4_1_3I1R4Value a) := by + exact residualBall_sound_on (below (shape 4 1 3)) B4_1_3Law (fun u => (stageBLaw (shape 4 1 3) u : ℝ)) (stageBPriority (shape 4 1 3)) 1 (fun u => B4_1_3Little u ((stageBPriority (shape 4 1 3)) 1)) (fun u a => (littleLaw (shape 4 1 3) u ((stageBPriority (shape 4 1 3)) 1) a : ℝ)) (fun u _ => B4_1_3Law_sound u) (fun u _ a => B4_1_3Little_sound u ((stageBPriority (shape 4 1 3)) 1) a) 4 a +def CB4_1_3I1R4Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB4_1_3I1R4Certificates_valid : + CB4_1_3I1R4Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB4_1_3I1R4CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB4_1_3I1R4P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB4_1_3I1R4Certificates (CB4_1_3I1R4CertificateIndex a)).input +lemma CB4_1_3I1R4P_check : ∀ a : Fin 6, contains (CB4_1_3I1R4Raw a) (CB4_1_3I1R4P a) = true := by + decide +kernel +lemma CB4_1_3I1R4P_sound (a : Fin 6) : + (CB4_1_3I1R4P a).Encloses (CB4_1_3I1R4Value a) := + contains_sound (CB4_1_3I1R4Raw_sound a) (CB4_1_3I1R4P_check a) +def CB4_1_3I1R4Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB4_1_3I1R4Certificates (CB4_1_3I1R4CertificateIndex a)).output +lemma CB4_1_3I1R4Terms_sound (a : Fin 6) : + (CB4_1_3I1R4Terms a).Encloses (Foundation.entropyTerm (CB4_1_3I1R4Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB4_1_3I1R4Certificates_valid + (CB4_1_3I1R4CertificateIndex a) (CB4_1_3I1R4P_sound a) +def CB4_1_3I1R4Entropy : Ball := ⟨0, 0⟩ +lemma CB4_1_3I1R4Entropy_sound : CB4_1_3I1R4Entropy.Encloses (Foundation.finiteEntropy CB4_1_3I1R4Value) := by + exact contains_sound (entropyFin_enclosed 6 CB4_1_3I1R4Value CB4_1_3I1R4Terms CB4_1_3I1R4Terms_sound) (by decide +kernel) +def CB4_1_3I1R4Mass : Ball := ⟨0, 0⟩ +lemma CB4_1_3I1R4Mass_sound : CB4_1_3I1R4Mass.Encloses (∑ a, CB4_1_3I1R4Value a) := by + exact contains_sound (finSumBall_sound 6 CB4_1_3I1R4P CB4_1_3I1R4Value CB4_1_3I1R4P_sound) (by decide +kernel) +def CB4_1_3I1R4MassTerm : Ball := .exact 0 +lemma CB4_1_3I1R4MassTerm_sound : CB4_1_3I1R4MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB4_1_3I1R4Value a))) := + entropyTerm_zero_ball (CB4_1_3I1R4Mass_sound) +def CB4_1_3I1R4H : Ball := ⟨0, 0⟩ +lemma CB4_1_3I1R4H_sound : CB4_1_3I1R4H.Encloses (homogeneousEntropy CB4_1_3I1R4Value) := by + exact contains_sound (homogeneous_enclosed CB4_1_3I1R4Value CB4_1_3I1R4MassTerm_sound CB4_1_3I1R4Entropy_sound) (by decide +kernel) +def CB4_1_3I1R5Value (a : Fin 6) : ℝ := residualLaw (below (shape 4 1 3)) (fun u => (stageBLaw (shape 4 1 3) u : ℝ)) (stageBPriority (shape 4 1 3)) 1 (fun u a => (littleLaw (shape 4 1 3) u ((stageBPriority (shape 4 1 3)) 1) a : ℝ)) 5 a +def CB4_1_3I1R5Raw (a : Fin 6) : Ball := residualBall (below (shape 4 1 3)) B4_1_3Law (stageBPriority (shape 4 1 3)) 1 (fun u => B4_1_3Little u ((stageBPriority (shape 4 1 3)) 1)) 5 a +lemma CB4_1_3I1R5Raw_sound (a : Fin 6) : + (CB4_1_3I1R5Raw a).Encloses (CB4_1_3I1R5Value a) := by + exact residualBall_sound_on (below (shape 4 1 3)) B4_1_3Law (fun u => (stageBLaw (shape 4 1 3) u : ℝ)) (stageBPriority (shape 4 1 3)) 1 (fun u => B4_1_3Little u ((stageBPriority (shape 4 1 3)) 1)) (fun u a => (littleLaw (shape 4 1 3) u ((stageBPriority (shape 4 1 3)) 1) a : ℝ)) (fun u _ => B4_1_3Law_sound u) (fun u _ a => B4_1_3Little_sound u ((stageBPriority (shape 4 1 3)) 1) a) 5 a +def CB4_1_3I1R5Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB4_1_3I1R5Certificates_valid : + CB4_1_3I1R5Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB4_1_3I1R5CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB4_1_3I1R5P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB4_1_3I1R5Certificates (CB4_1_3I1R5CertificateIndex a)).input +lemma CB4_1_3I1R5P_check : ∀ a : Fin 6, contains (CB4_1_3I1R5Raw a) (CB4_1_3I1R5P a) = true := by + decide +kernel +lemma CB4_1_3I1R5P_sound (a : Fin 6) : + (CB4_1_3I1R5P a).Encloses (CB4_1_3I1R5Value a) := + contains_sound (CB4_1_3I1R5Raw_sound a) (CB4_1_3I1R5P_check a) +def CB4_1_3I1R5Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB4_1_3I1R5Certificates (CB4_1_3I1R5CertificateIndex a)).output +lemma CB4_1_3I1R5Terms_sound (a : Fin 6) : + (CB4_1_3I1R5Terms a).Encloses (Foundation.entropyTerm (CB4_1_3I1R5Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB4_1_3I1R5Certificates_valid + (CB4_1_3I1R5CertificateIndex a) (CB4_1_3I1R5P_sound a) +def CB4_1_3I1R5Entropy : Ball := ⟨0, 0⟩ +lemma CB4_1_3I1R5Entropy_sound : CB4_1_3I1R5Entropy.Encloses (Foundation.finiteEntropy CB4_1_3I1R5Value) := by + exact contains_sound (entropyFin_enclosed 6 CB4_1_3I1R5Value CB4_1_3I1R5Terms CB4_1_3I1R5Terms_sound) (by decide +kernel) +def CB4_1_3I1R5Mass : Ball := ⟨0, 0⟩ +lemma CB4_1_3I1R5Mass_sound : CB4_1_3I1R5Mass.Encloses (∑ a, CB4_1_3I1R5Value a) := by + exact contains_sound (finSumBall_sound 6 CB4_1_3I1R5P CB4_1_3I1R5Value CB4_1_3I1R5P_sound) (by decide +kernel) +def CB4_1_3I1R5MassTerm : Ball := .exact 0 +lemma CB4_1_3I1R5MassTerm_sound : CB4_1_3I1R5MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB4_1_3I1R5Value a))) := + entropyTerm_zero_ball (CB4_1_3I1R5Mass_sound) +def CB4_1_3I1R5H : Ball := ⟨0, 0⟩ +lemma CB4_1_3I1R5H_sound : CB4_1_3I1R5H.Encloses (homogeneousEntropy CB4_1_3I1R5Value) := by + exact contains_sound (homogeneous_enclosed CB4_1_3I1R5Value CB4_1_3I1R5MassTerm_sound CB4_1_3I1R5Entropy_sound) (by decide +kernel) +def CB4_1_3I1R6Value (a : Fin 6) : ℝ := residualLaw (below (shape 4 1 3)) (fun u => (stageBLaw (shape 4 1 3) u : ℝ)) (stageBPriority (shape 4 1 3)) 1 (fun u a => (littleLaw (shape 4 1 3) u ((stageBPriority (shape 4 1 3)) 1) a : ℝ)) 6 a +def CB4_1_3I1R6Raw (a : Fin 6) : Ball := residualBall (below (shape 4 1 3)) B4_1_3Law (stageBPriority (shape 4 1 3)) 1 (fun u => B4_1_3Little u ((stageBPriority (shape 4 1 3)) 1)) 6 a +lemma CB4_1_3I1R6Raw_sound (a : Fin 6) : + (CB4_1_3I1R6Raw a).Encloses (CB4_1_3I1R6Value a) := by + exact residualBall_sound_on (below (shape 4 1 3)) B4_1_3Law (fun u => (stageBLaw (shape 4 1 3) u : ℝ)) (stageBPriority (shape 4 1 3)) 1 (fun u => B4_1_3Little u ((stageBPriority (shape 4 1 3)) 1)) (fun u a => (littleLaw (shape 4 1 3) u ((stageBPriority (shape 4 1 3)) 1) a : ℝ)) (fun u _ => B4_1_3Law_sound u) (fun u _ a => B4_1_3Little_sound u ((stageBPriority (shape 4 1 3)) 1) a) 6 a +def CB4_1_3I1R6Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB4_1_3I1R6Certificates_valid : + CB4_1_3I1R6Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB4_1_3I1R6CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB4_1_3I1R6P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB4_1_3I1R6Certificates (CB4_1_3I1R6CertificateIndex a)).input +lemma CB4_1_3I1R6P_check : ∀ a : Fin 6, contains (CB4_1_3I1R6Raw a) (CB4_1_3I1R6P a) = true := by + decide +kernel +lemma CB4_1_3I1R6P_sound (a : Fin 6) : + (CB4_1_3I1R6P a).Encloses (CB4_1_3I1R6Value a) := + contains_sound (CB4_1_3I1R6Raw_sound a) (CB4_1_3I1R6P_check a) +def CB4_1_3I1R6Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB4_1_3I1R6Certificates (CB4_1_3I1R6CertificateIndex a)).output +lemma CB4_1_3I1R6Terms_sound (a : Fin 6) : + (CB4_1_3I1R6Terms a).Encloses (Foundation.entropyTerm (CB4_1_3I1R6Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB4_1_3I1R6Certificates_valid + (CB4_1_3I1R6CertificateIndex a) (CB4_1_3I1R6P_sound a) +def CB4_1_3I1R6Entropy : Ball := ⟨0, 0⟩ +lemma CB4_1_3I1R6Entropy_sound : CB4_1_3I1R6Entropy.Encloses (Foundation.finiteEntropy CB4_1_3I1R6Value) := by + exact contains_sound (entropyFin_enclosed 6 CB4_1_3I1R6Value CB4_1_3I1R6Terms CB4_1_3I1R6Terms_sound) (by decide +kernel) +def CB4_1_3I1R6Mass : Ball := ⟨0, 0⟩ +lemma CB4_1_3I1R6Mass_sound : CB4_1_3I1R6Mass.Encloses (∑ a, CB4_1_3I1R6Value a) := by + exact contains_sound (finSumBall_sound 6 CB4_1_3I1R6P CB4_1_3I1R6Value CB4_1_3I1R6P_sound) (by decide +kernel) +def CB4_1_3I1R6MassTerm : Ball := .exact 0 +lemma CB4_1_3I1R6MassTerm_sound : CB4_1_3I1R6MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB4_1_3I1R6Value a))) := + entropyTerm_zero_ball (CB4_1_3I1R6Mass_sound) +def CB4_1_3I1R6H : Ball := ⟨0, 0⟩ +lemma CB4_1_3I1R6H_sound : CB4_1_3I1R6H.Encloses (homogeneousEntropy CB4_1_3I1R6Value) := by + exact contains_sound (homogeneous_enclosed CB4_1_3I1R6Value CB4_1_3I1R6MassTerm_sound CB4_1_3I1R6Entropy_sound) (by decide +kernel) +def CB4_1_3I1R7Value (a : Fin 6) : ℝ := residualLaw (below (shape 4 1 3)) (fun u => (stageBLaw (shape 4 1 3) u : ℝ)) (stageBPriority (shape 4 1 3)) 1 (fun u a => (littleLaw (shape 4 1 3) u ((stageBPriority (shape 4 1 3)) 1) a : ℝ)) 7 a +def CB4_1_3I1R7Raw (a : Fin 6) : Ball := residualBall (below (shape 4 1 3)) B4_1_3Law (stageBPriority (shape 4 1 3)) 1 (fun u => B4_1_3Little u ((stageBPriority (shape 4 1 3)) 1)) 7 a +lemma CB4_1_3I1R7Raw_sound (a : Fin 6) : + (CB4_1_3I1R7Raw a).Encloses (CB4_1_3I1R7Value a) := by + exact residualBall_sound_on (below (shape 4 1 3)) B4_1_3Law (fun u => (stageBLaw (shape 4 1 3) u : ℝ)) (stageBPriority (shape 4 1 3)) 1 (fun u => B4_1_3Little u ((stageBPriority (shape 4 1 3)) 1)) (fun u a => (littleLaw (shape 4 1 3) u ((stageBPriority (shape 4 1 3)) 1) a : ℝ)) (fun u _ => B4_1_3Law_sound u) (fun u _ a => B4_1_3Little_sound u ((stageBPriority (shape 4 1 3)) 1) a) 7 a +def CB4_1_3I1R7Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB4_1_3I1R7Certificates_valid : + CB4_1_3I1R7Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB4_1_3I1R7CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB4_1_3I1R7P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB4_1_3I1R7Certificates (CB4_1_3I1R7CertificateIndex a)).input +lemma CB4_1_3I1R7P_check : ∀ a : Fin 6, contains (CB4_1_3I1R7Raw a) (CB4_1_3I1R7P a) = true := by + decide +kernel +lemma CB4_1_3I1R7P_sound (a : Fin 6) : + (CB4_1_3I1R7P a).Encloses (CB4_1_3I1R7Value a) := + contains_sound (CB4_1_3I1R7Raw_sound a) (CB4_1_3I1R7P_check a) +def CB4_1_3I1R7Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB4_1_3I1R7Certificates (CB4_1_3I1R7CertificateIndex a)).output +lemma CB4_1_3I1R7Terms_sound (a : Fin 6) : + (CB4_1_3I1R7Terms a).Encloses (Foundation.entropyTerm (CB4_1_3I1R7Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB4_1_3I1R7Certificates_valid + (CB4_1_3I1R7CertificateIndex a) (CB4_1_3I1R7P_sound a) +def CB4_1_3I1R7Entropy : Ball := ⟨0, 0⟩ +lemma CB4_1_3I1R7Entropy_sound : CB4_1_3I1R7Entropy.Encloses (Foundation.finiteEntropy CB4_1_3I1R7Value) := by + exact contains_sound (entropyFin_enclosed 6 CB4_1_3I1R7Value CB4_1_3I1R7Terms CB4_1_3I1R7Terms_sound) (by decide +kernel) +def CB4_1_3I1R7Mass : Ball := ⟨0, 0⟩ +lemma CB4_1_3I1R7Mass_sound : CB4_1_3I1R7Mass.Encloses (∑ a, CB4_1_3I1R7Value a) := by + exact contains_sound (finSumBall_sound 6 CB4_1_3I1R7P CB4_1_3I1R7Value CB4_1_3I1R7P_sound) (by decide +kernel) +def CB4_1_3I1R7MassTerm : Ball := .exact 0 +lemma CB4_1_3I1R7MassTerm_sound : CB4_1_3I1R7MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB4_1_3I1R7Value a))) := + entropyTerm_zero_ball (CB4_1_3I1R7Mass_sound) +def CB4_1_3I1R7H : Ball := ⟨0, 0⟩ +lemma CB4_1_3I1R7H_sound : CB4_1_3I1R7H.Encloses (homogeneousEntropy CB4_1_3I1R7Value) := by + exact contains_sound (homogeneous_enclosed CB4_1_3I1R7Value CB4_1_3I1R7MassTerm_sound CB4_1_3I1R7Entropy_sound) (by decide +kernel) +def CB4_1_3I1R8Value (a : Fin 6) : ℝ := residualLaw (below (shape 4 1 3)) (fun u => (stageBLaw (shape 4 1 3) u : ℝ)) (stageBPriority (shape 4 1 3)) 1 (fun u a => (littleLaw (shape 4 1 3) u ((stageBPriority (shape 4 1 3)) 1) a : ℝ)) 8 a +def CB4_1_3I1R8Raw (a : Fin 6) : Ball := residualBall (below (shape 4 1 3)) B4_1_3Law (stageBPriority (shape 4 1 3)) 1 (fun u => B4_1_3Little u ((stageBPriority (shape 4 1 3)) 1)) 8 a +lemma CB4_1_3I1R8Raw_sound (a : Fin 6) : + (CB4_1_3I1R8Raw a).Encloses (CB4_1_3I1R8Value a) := by + exact residualBall_sound_on (below (shape 4 1 3)) B4_1_3Law (fun u => (stageBLaw (shape 4 1 3) u : ℝ)) (stageBPriority (shape 4 1 3)) 1 (fun u => B4_1_3Little u ((stageBPriority (shape 4 1 3)) 1)) (fun u a => (littleLaw (shape 4 1 3) u ((stageBPriority (shape 4 1 3)) 1) a : ℝ)) (fun u _ => B4_1_3Law_sound u) (fun u _ a => B4_1_3Little_sound u ((stageBPriority (shape 4 1 3)) 1) a) 8 a +def CB4_1_3I1R8Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB4_1_3I1R8Certificates_valid : + CB4_1_3I1R8Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB4_1_3I1R8CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB4_1_3I1R8P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB4_1_3I1R8Certificates (CB4_1_3I1R8CertificateIndex a)).input +lemma CB4_1_3I1R8P_check : ∀ a : Fin 6, contains (CB4_1_3I1R8Raw a) (CB4_1_3I1R8P a) = true := by + decide +kernel +lemma CB4_1_3I1R8P_sound (a : Fin 6) : + (CB4_1_3I1R8P a).Encloses (CB4_1_3I1R8Value a) := + contains_sound (CB4_1_3I1R8Raw_sound a) (CB4_1_3I1R8P_check a) +def CB4_1_3I1R8Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB4_1_3I1R8Certificates (CB4_1_3I1R8CertificateIndex a)).output +lemma CB4_1_3I1R8Terms_sound (a : Fin 6) : + (CB4_1_3I1R8Terms a).Encloses (Foundation.entropyTerm (CB4_1_3I1R8Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB4_1_3I1R8Certificates_valid + (CB4_1_3I1R8CertificateIndex a) (CB4_1_3I1R8P_sound a) +def CB4_1_3I1R8Entropy : Ball := ⟨0, 0⟩ +lemma CB4_1_3I1R8Entropy_sound : CB4_1_3I1R8Entropy.Encloses (Foundation.finiteEntropy CB4_1_3I1R8Value) := by + exact contains_sound (entropyFin_enclosed 6 CB4_1_3I1R8Value CB4_1_3I1R8Terms CB4_1_3I1R8Terms_sound) (by decide +kernel) +def CB4_1_3I1R8Mass : Ball := ⟨0, 0⟩ +lemma CB4_1_3I1R8Mass_sound : CB4_1_3I1R8Mass.Encloses (∑ a, CB4_1_3I1R8Value a) := by + exact contains_sound (finSumBall_sound 6 CB4_1_3I1R8P CB4_1_3I1R8Value CB4_1_3I1R8P_sound) (by decide +kernel) +def CB4_1_3I1R8MassTerm : Ball := .exact 0 +lemma CB4_1_3I1R8MassTerm_sound : CB4_1_3I1R8MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB4_1_3I1R8Value a))) := + entropyTerm_zero_ball (CB4_1_3I1R8Mass_sound) +def CB4_1_3I1R8H : Ball := ⟨0, 0⟩ +lemma CB4_1_3I1R8H_sound : CB4_1_3I1R8H.Encloses (homogeneousEntropy CB4_1_3I1R8Value) := by + exact contains_sound (homogeneous_enclosed CB4_1_3I1R8Value CB4_1_3I1R8MassTerm_sound CB4_1_3I1R8Entropy_sound) (by decide +kernel) +def CB4_1_3I1R9Value (a : Fin 6) : ℝ := residualLaw (below (shape 4 1 3)) (fun u => (stageBLaw (shape 4 1 3) u : ℝ)) (stageBPriority (shape 4 1 3)) 1 (fun u a => (littleLaw (shape 4 1 3) u ((stageBPriority (shape 4 1 3)) 1) a : ℝ)) 9 a +def CB4_1_3I1R9Raw (a : Fin 6) : Ball := residualBall (below (shape 4 1 3)) B4_1_3Law (stageBPriority (shape 4 1 3)) 1 (fun u => B4_1_3Little u ((stageBPriority (shape 4 1 3)) 1)) 9 a +lemma CB4_1_3I1R9Raw_sound (a : Fin 6) : + (CB4_1_3I1R9Raw a).Encloses (CB4_1_3I1R9Value a) := by + exact residualBall_sound_on (below (shape 4 1 3)) B4_1_3Law (fun u => (stageBLaw (shape 4 1 3) u : ℝ)) (stageBPriority (shape 4 1 3)) 1 (fun u => B4_1_3Little u ((stageBPriority (shape 4 1 3)) 1)) (fun u a => (littleLaw (shape 4 1 3) u ((stageBPriority (shape 4 1 3)) 1) a : ℝ)) (fun u _ => B4_1_3Law_sound u) (fun u _ a => B4_1_3Little_sound u ((stageBPriority (shape 4 1 3)) 1) a) 9 a +def CB4_1_3I1R9Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB4_1_3I1R9Certificates_valid : + CB4_1_3I1R9Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB4_1_3I1R9CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB4_1_3I1R9P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB4_1_3I1R9Certificates (CB4_1_3I1R9CertificateIndex a)).input +lemma CB4_1_3I1R9P_check : ∀ a : Fin 6, contains (CB4_1_3I1R9Raw a) (CB4_1_3I1R9P a) = true := by + decide +kernel +lemma CB4_1_3I1R9P_sound (a : Fin 6) : + (CB4_1_3I1R9P a).Encloses (CB4_1_3I1R9Value a) := + contains_sound (CB4_1_3I1R9Raw_sound a) (CB4_1_3I1R9P_check a) +def CB4_1_3I1R9Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB4_1_3I1R9Certificates (CB4_1_3I1R9CertificateIndex a)).output +lemma CB4_1_3I1R9Terms_sound (a : Fin 6) : + (CB4_1_3I1R9Terms a).Encloses (Foundation.entropyTerm (CB4_1_3I1R9Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB4_1_3I1R9Certificates_valid + (CB4_1_3I1R9CertificateIndex a) (CB4_1_3I1R9P_sound a) +def CB4_1_3I1R9Entropy : Ball := ⟨0, 0⟩ +lemma CB4_1_3I1R9Entropy_sound : CB4_1_3I1R9Entropy.Encloses (Foundation.finiteEntropy CB4_1_3I1R9Value) := by + exact contains_sound (entropyFin_enclosed 6 CB4_1_3I1R9Value CB4_1_3I1R9Terms CB4_1_3I1R9Terms_sound) (by decide +kernel) +def CB4_1_3I1R9Mass : Ball := ⟨0, 0⟩ +lemma CB4_1_3I1R9Mass_sound : CB4_1_3I1R9Mass.Encloses (∑ a, CB4_1_3I1R9Value a) := by + exact contains_sound (finSumBall_sound 6 CB4_1_3I1R9P CB4_1_3I1R9Value CB4_1_3I1R9P_sound) (by decide +kernel) +def CB4_1_3I1R9MassTerm : Ball := .exact 0 +lemma CB4_1_3I1R9MassTerm_sound : CB4_1_3I1R9MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB4_1_3I1R9Value a))) := + entropyTerm_zero_ball (CB4_1_3I1R9Mass_sound) +def CB4_1_3I1R9H : Ball := ⟨0, 0⟩ +lemma CB4_1_3I1R9H_sound : CB4_1_3I1R9H.Encloses (homogeneousEntropy CB4_1_3I1R9Value) := by + exact contains_sound (homogeneous_enclosed CB4_1_3I1R9Value CB4_1_3I1R9MassTerm_sound CB4_1_3I1R9Entropy_sound) (by decide +kernel) +def CB4_1_3I1R10Value (a : Fin 6) : ℝ := residualLaw (below (shape 4 1 3)) (fun u => (stageBLaw (shape 4 1 3) u : ℝ)) (stageBPriority (shape 4 1 3)) 1 (fun u a => (littleLaw (shape 4 1 3) u ((stageBPriority (shape 4 1 3)) 1) a : ℝ)) 10 a +def CB4_1_3I1R10Raw (a : Fin 6) : Ball := residualBall (below (shape 4 1 3)) B4_1_3Law (stageBPriority (shape 4 1 3)) 1 (fun u => B4_1_3Little u ((stageBPriority (shape 4 1 3)) 1)) 10 a +lemma CB4_1_3I1R10Raw_sound (a : Fin 6) : + (CB4_1_3I1R10Raw a).Encloses (CB4_1_3I1R10Value a) := by + exact residualBall_sound_on (below (shape 4 1 3)) B4_1_3Law (fun u => (stageBLaw (shape 4 1 3) u : ℝ)) (stageBPriority (shape 4 1 3)) 1 (fun u => B4_1_3Little u ((stageBPriority (shape 4 1 3)) 1)) (fun u a => (littleLaw (shape 4 1 3) u ((stageBPriority (shape 4 1 3)) 1) a : ℝ)) (fun u _ => B4_1_3Law_sound u) (fun u _ a => B4_1_3Little_sound u ((stageBPriority (shape 4 1 3)) 1) a) 10 a +def CB4_1_3I1R10Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB4_1_3I1R10Certificates_valid : + CB4_1_3I1R10Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB4_1_3I1R10CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB4_1_3I1R10P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB4_1_3I1R10Certificates (CB4_1_3I1R10CertificateIndex a)).input +lemma CB4_1_3I1R10P_check : ∀ a : Fin 6, contains (CB4_1_3I1R10Raw a) (CB4_1_3I1R10P a) = true := by + decide +kernel +lemma CB4_1_3I1R10P_sound (a : Fin 6) : + (CB4_1_3I1R10P a).Encloses (CB4_1_3I1R10Value a) := + contains_sound (CB4_1_3I1R10Raw_sound a) (CB4_1_3I1R10P_check a) +def CB4_1_3I1R10Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB4_1_3I1R10Certificates (CB4_1_3I1R10CertificateIndex a)).output +lemma CB4_1_3I1R10Terms_sound (a : Fin 6) : + (CB4_1_3I1R10Terms a).Encloses (Foundation.entropyTerm (CB4_1_3I1R10Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB4_1_3I1R10Certificates_valid + (CB4_1_3I1R10CertificateIndex a) (CB4_1_3I1R10P_sound a) +def CB4_1_3I1R10Entropy : Ball := ⟨0, 0⟩ +lemma CB4_1_3I1R10Entropy_sound : CB4_1_3I1R10Entropy.Encloses (Foundation.finiteEntropy CB4_1_3I1R10Value) := by + exact contains_sound (entropyFin_enclosed 6 CB4_1_3I1R10Value CB4_1_3I1R10Terms CB4_1_3I1R10Terms_sound) (by decide +kernel) +def CB4_1_3I1R10Mass : Ball := ⟨0, 0⟩ +lemma CB4_1_3I1R10Mass_sound : CB4_1_3I1R10Mass.Encloses (∑ a, CB4_1_3I1R10Value a) := by + exact contains_sound (finSumBall_sound 6 CB4_1_3I1R10P CB4_1_3I1R10Value CB4_1_3I1R10P_sound) (by decide +kernel) +def CB4_1_3I1R10MassTerm : Ball := .exact 0 +lemma CB4_1_3I1R10MassTerm_sound : CB4_1_3I1R10MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB4_1_3I1R10Value a))) := + entropyTerm_zero_ball (CB4_1_3I1R10Mass_sound) +def CB4_1_3I1R10H : Ball := ⟨0, 0⟩ +lemma CB4_1_3I1R10H_sound : CB4_1_3I1R10H.Encloses (homogeneousEntropy CB4_1_3I1R10Value) := by + exact contains_sound (homogeneous_enclosed CB4_1_3I1R10Value CB4_1_3I1R10MassTerm_sound CB4_1_3I1R10Entropy_sound) (by decide +kernel) +def CB4_1_3I1R11Value (a : Fin 6) : ℝ := residualLaw (below (shape 4 1 3)) (fun u => (stageBLaw (shape 4 1 3) u : ℝ)) (stageBPriority (shape 4 1 3)) 1 (fun u a => (littleLaw (shape 4 1 3) u ((stageBPriority (shape 4 1 3)) 1) a : ℝ)) 11 a +def CB4_1_3I1R11Raw (a : Fin 6) : Ball := residualBall (below (shape 4 1 3)) B4_1_3Law (stageBPriority (shape 4 1 3)) 1 (fun u => B4_1_3Little u ((stageBPriority (shape 4 1 3)) 1)) 11 a +lemma CB4_1_3I1R11Raw_sound (a : Fin 6) : + (CB4_1_3I1R11Raw a).Encloses (CB4_1_3I1R11Value a) := by + exact residualBall_sound_on (below (shape 4 1 3)) B4_1_3Law (fun u => (stageBLaw (shape 4 1 3) u : ℝ)) (stageBPriority (shape 4 1 3)) 1 (fun u => B4_1_3Little u ((stageBPriority (shape 4 1 3)) 1)) (fun u a => (littleLaw (shape 4 1 3) u ((stageBPriority (shape 4 1 3)) 1) a : ℝ)) (fun u _ => B4_1_3Law_sound u) (fun u _ a => B4_1_3Little_sound u ((stageBPriority (shape 4 1 3)) 1) a) 11 a +def CB4_1_3I1R11Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB4_1_3I1R11Certificates_valid : + CB4_1_3I1R11Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB4_1_3I1R11CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB4_1_3I1R11P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB4_1_3I1R11Certificates (CB4_1_3I1R11CertificateIndex a)).input +lemma CB4_1_3I1R11P_check : ∀ a : Fin 6, contains (CB4_1_3I1R11Raw a) (CB4_1_3I1R11P a) = true := by + decide +kernel +lemma CB4_1_3I1R11P_sound (a : Fin 6) : + (CB4_1_3I1R11P a).Encloses (CB4_1_3I1R11Value a) := + contains_sound (CB4_1_3I1R11Raw_sound a) (CB4_1_3I1R11P_check a) +def CB4_1_3I1R11Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB4_1_3I1R11Certificates (CB4_1_3I1R11CertificateIndex a)).output +lemma CB4_1_3I1R11Terms_sound (a : Fin 6) : + (CB4_1_3I1R11Terms a).Encloses (Foundation.entropyTerm (CB4_1_3I1R11Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB4_1_3I1R11Certificates_valid + (CB4_1_3I1R11CertificateIndex a) (CB4_1_3I1R11P_sound a) +def CB4_1_3I1R11Entropy : Ball := ⟨0, 0⟩ +lemma CB4_1_3I1R11Entropy_sound : CB4_1_3I1R11Entropy.Encloses (Foundation.finiteEntropy CB4_1_3I1R11Value) := by + exact contains_sound (entropyFin_enclosed 6 CB4_1_3I1R11Value CB4_1_3I1R11Terms CB4_1_3I1R11Terms_sound) (by decide +kernel) +def CB4_1_3I1R11Mass : Ball := ⟨0, 0⟩ +lemma CB4_1_3I1R11Mass_sound : CB4_1_3I1R11Mass.Encloses (∑ a, CB4_1_3I1R11Value a) := by + exact contains_sound (finSumBall_sound 6 CB4_1_3I1R11P CB4_1_3I1R11Value CB4_1_3I1R11P_sound) (by decide +kernel) +def CB4_1_3I1R11MassTerm : Ball := .exact 0 +lemma CB4_1_3I1R11MassTerm_sound : CB4_1_3I1R11MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB4_1_3I1R11Value a))) := + entropyTerm_zero_ball (CB4_1_3I1R11Mass_sound) +def CB4_1_3I1R11H : Ball := ⟨0, 0⟩ +lemma CB4_1_3I1R11H_sound : CB4_1_3I1R11H.Encloses (homogeneousEntropy CB4_1_3I1R11Value) := by + exact contains_sound (homogeneous_enclosed CB4_1_3I1R11Value CB4_1_3I1R11MassTerm_sound CB4_1_3I1R11Entropy_sound) (by decide +kernel) +def CB4_1_3I1R12Value (a : Fin 6) : ℝ := residualLaw (below (shape 4 1 3)) (fun u => (stageBLaw (shape 4 1 3) u : ℝ)) (stageBPriority (shape 4 1 3)) 1 (fun u a => (littleLaw (shape 4 1 3) u ((stageBPriority (shape 4 1 3)) 1) a : ℝ)) 12 a +def CB4_1_3I1R12Raw (a : Fin 6) : Ball := residualBall (below (shape 4 1 3)) B4_1_3Law (stageBPriority (shape 4 1 3)) 1 (fun u => B4_1_3Little u ((stageBPriority (shape 4 1 3)) 1)) 12 a +lemma CB4_1_3I1R12Raw_sound (a : Fin 6) : + (CB4_1_3I1R12Raw a).Encloses (CB4_1_3I1R12Value a) := by + exact residualBall_sound_on (below (shape 4 1 3)) B4_1_3Law (fun u => (stageBLaw (shape 4 1 3) u : ℝ)) (stageBPriority (shape 4 1 3)) 1 (fun u => B4_1_3Little u ((stageBPriority (shape 4 1 3)) 1)) (fun u a => (littleLaw (shape 4 1 3) u ((stageBPriority (shape 4 1 3)) 1) a : ℝ)) (fun u _ => B4_1_3Law_sound u) (fun u _ a => B4_1_3Little_sound u ((stageBPriority (shape 4 1 3)) 1) a) 12 a +def CB4_1_3I1R12Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB4_1_3I1R12Certificates_valid : + CB4_1_3I1R12Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB4_1_3I1R12CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB4_1_3I1R12P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB4_1_3I1R12Certificates (CB4_1_3I1R12CertificateIndex a)).input +lemma CB4_1_3I1R12P_check : ∀ a : Fin 6, contains (CB4_1_3I1R12Raw a) (CB4_1_3I1R12P a) = true := by + decide +kernel +lemma CB4_1_3I1R12P_sound (a : Fin 6) : + (CB4_1_3I1R12P a).Encloses (CB4_1_3I1R12Value a) := + contains_sound (CB4_1_3I1R12Raw_sound a) (CB4_1_3I1R12P_check a) +def CB4_1_3I1R12Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB4_1_3I1R12Certificates (CB4_1_3I1R12CertificateIndex a)).output +lemma CB4_1_3I1R12Terms_sound (a : Fin 6) : + (CB4_1_3I1R12Terms a).Encloses (Foundation.entropyTerm (CB4_1_3I1R12Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB4_1_3I1R12Certificates_valid + (CB4_1_3I1R12CertificateIndex a) (CB4_1_3I1R12P_sound a) +def CB4_1_3I1R12Entropy : Ball := ⟨0, 0⟩ +lemma CB4_1_3I1R12Entropy_sound : CB4_1_3I1R12Entropy.Encloses (Foundation.finiteEntropy CB4_1_3I1R12Value) := by + exact contains_sound (entropyFin_enclosed 6 CB4_1_3I1R12Value CB4_1_3I1R12Terms CB4_1_3I1R12Terms_sound) (by decide +kernel) +def CB4_1_3I1R12Mass : Ball := ⟨0, 0⟩ +lemma CB4_1_3I1R12Mass_sound : CB4_1_3I1R12Mass.Encloses (∑ a, CB4_1_3I1R12Value a) := by + exact contains_sound (finSumBall_sound 6 CB4_1_3I1R12P CB4_1_3I1R12Value CB4_1_3I1R12P_sound) (by decide +kernel) +def CB4_1_3I1R12MassTerm : Ball := .exact 0 +lemma CB4_1_3I1R12MassTerm_sound : CB4_1_3I1R12MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB4_1_3I1R12Value a))) := + entropyTerm_zero_ball (CB4_1_3I1R12Mass_sound) +def CB4_1_3I1R12H : Ball := ⟨0, 0⟩ +lemma CB4_1_3I1R12H_sound : CB4_1_3I1R12H.Encloses (homogeneousEntropy CB4_1_3I1R12Value) := by + exact contains_sound (homogeneous_enclosed CB4_1_3I1R12Value CB4_1_3I1R12MassTerm_sound CB4_1_3I1R12Entropy_sound) (by decide +kernel) +def CB4_1_3I1R13Value (a : Fin 6) : ℝ := residualLaw (below (shape 4 1 3)) (fun u => (stageBLaw (shape 4 1 3) u : ℝ)) (stageBPriority (shape 4 1 3)) 1 (fun u a => (littleLaw (shape 4 1 3) u ((stageBPriority (shape 4 1 3)) 1) a : ℝ)) 13 a +def CB4_1_3I1R13Raw (a : Fin 6) : Ball := residualBall (below (shape 4 1 3)) B4_1_3Law (stageBPriority (shape 4 1 3)) 1 (fun u => B4_1_3Little u ((stageBPriority (shape 4 1 3)) 1)) 13 a +lemma CB4_1_3I1R13Raw_sound (a : Fin 6) : + (CB4_1_3I1R13Raw a).Encloses (CB4_1_3I1R13Value a) := by + exact residualBall_sound_on (below (shape 4 1 3)) B4_1_3Law (fun u => (stageBLaw (shape 4 1 3) u : ℝ)) (stageBPriority (shape 4 1 3)) 1 (fun u => B4_1_3Little u ((stageBPriority (shape 4 1 3)) 1)) (fun u a => (littleLaw (shape 4 1 3) u ((stageBPriority (shape 4 1 3)) 1) a : ℝ)) (fun u _ => B4_1_3Law_sound u) (fun u _ a => B4_1_3Little_sound u ((stageBPriority (shape 4 1 3)) 1) a) 13 a +def CB4_1_3I1R13Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB4_1_3I1R13Certificates_valid : + CB4_1_3I1R13Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB4_1_3I1R13CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB4_1_3I1R13P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB4_1_3I1R13Certificates (CB4_1_3I1R13CertificateIndex a)).input +lemma CB4_1_3I1R13P_check : ∀ a : Fin 6, contains (CB4_1_3I1R13Raw a) (CB4_1_3I1R13P a) = true := by + decide +kernel +lemma CB4_1_3I1R13P_sound (a : Fin 6) : + (CB4_1_3I1R13P a).Encloses (CB4_1_3I1R13Value a) := + contains_sound (CB4_1_3I1R13Raw_sound a) (CB4_1_3I1R13P_check a) +def CB4_1_3I1R13Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB4_1_3I1R13Certificates (CB4_1_3I1R13CertificateIndex a)).output +lemma CB4_1_3I1R13Terms_sound (a : Fin 6) : + (CB4_1_3I1R13Terms a).Encloses (Foundation.entropyTerm (CB4_1_3I1R13Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB4_1_3I1R13Certificates_valid + (CB4_1_3I1R13CertificateIndex a) (CB4_1_3I1R13P_sound a) +def CB4_1_3I1R13Entropy : Ball := ⟨0, 0⟩ +lemma CB4_1_3I1R13Entropy_sound : CB4_1_3I1R13Entropy.Encloses (Foundation.finiteEntropy CB4_1_3I1R13Value) := by + exact contains_sound (entropyFin_enclosed 6 CB4_1_3I1R13Value CB4_1_3I1R13Terms CB4_1_3I1R13Terms_sound) (by decide +kernel) +def CB4_1_3I1R13Mass : Ball := ⟨0, 0⟩ +lemma CB4_1_3I1R13Mass_sound : CB4_1_3I1R13Mass.Encloses (∑ a, CB4_1_3I1R13Value a) := by + exact contains_sound (finSumBall_sound 6 CB4_1_3I1R13P CB4_1_3I1R13Value CB4_1_3I1R13P_sound) (by decide +kernel) +def CB4_1_3I1R13MassTerm : Ball := .exact 0 +lemma CB4_1_3I1R13MassTerm_sound : CB4_1_3I1R13MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB4_1_3I1R13Value a))) := + entropyTerm_zero_ball (CB4_1_3I1R13Mass_sound) +def CB4_1_3I1R13H : Ball := ⟨0, 0⟩ +lemma CB4_1_3I1R13H_sound : CB4_1_3I1R13H.Encloses (homogeneousEntropy CB4_1_3I1R13Value) := by + exact contains_sound (homogeneous_enclosed CB4_1_3I1R13Value CB4_1_3I1R13MassTerm_sound CB4_1_3I1R13Entropy_sound) (by decide +kernel) +def CB4_1_3I1R14Value (a : Fin 6) : ℝ := residualLaw (below (shape 4 1 3)) (fun u => (stageBLaw (shape 4 1 3) u : ℝ)) (stageBPriority (shape 4 1 3)) 1 (fun u a => (littleLaw (shape 4 1 3) u ((stageBPriority (shape 4 1 3)) 1) a : ℝ)) 14 a +def CB4_1_3I1R14Raw (a : Fin 6) : Ball := residualBall (below (shape 4 1 3)) B4_1_3Law (stageBPriority (shape 4 1 3)) 1 (fun u => B4_1_3Little u ((stageBPriority (shape 4 1 3)) 1)) 14 a +lemma CB4_1_3I1R14Raw_sound (a : Fin 6) : + (CB4_1_3I1R14Raw a).Encloses (CB4_1_3I1R14Value a) := by + exact residualBall_sound_on (below (shape 4 1 3)) B4_1_3Law (fun u => (stageBLaw (shape 4 1 3) u : ℝ)) (stageBPriority (shape 4 1 3)) 1 (fun u => B4_1_3Little u ((stageBPriority (shape 4 1 3)) 1)) (fun u a => (littleLaw (shape 4 1 3) u ((stageBPriority (shape 4 1 3)) 1) a : ℝ)) (fun u _ => B4_1_3Law_sound u) (fun u _ a => B4_1_3Little_sound u ((stageBPriority (shape 4 1 3)) 1) a) 14 a +def CB4_1_3I1R14Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB4_1_3I1R14Certificates_valid : + CB4_1_3I1R14Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB4_1_3I1R14CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB4_1_3I1R14P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB4_1_3I1R14Certificates (CB4_1_3I1R14CertificateIndex a)).input +lemma CB4_1_3I1R14P_check : ∀ a : Fin 6, contains (CB4_1_3I1R14Raw a) (CB4_1_3I1R14P a) = true := by + decide +kernel +lemma CB4_1_3I1R14P_sound (a : Fin 6) : + (CB4_1_3I1R14P a).Encloses (CB4_1_3I1R14Value a) := + contains_sound (CB4_1_3I1R14Raw_sound a) (CB4_1_3I1R14P_check a) +def CB4_1_3I1R14Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB4_1_3I1R14Certificates (CB4_1_3I1R14CertificateIndex a)).output +lemma CB4_1_3I1R14Terms_sound (a : Fin 6) : + (CB4_1_3I1R14Terms a).Encloses (Foundation.entropyTerm (CB4_1_3I1R14Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB4_1_3I1R14Certificates_valid + (CB4_1_3I1R14CertificateIndex a) (CB4_1_3I1R14P_sound a) +def CB4_1_3I1R14Entropy : Ball := ⟨0, 0⟩ +lemma CB4_1_3I1R14Entropy_sound : CB4_1_3I1R14Entropy.Encloses (Foundation.finiteEntropy CB4_1_3I1R14Value) := by + exact contains_sound (entropyFin_enclosed 6 CB4_1_3I1R14Value CB4_1_3I1R14Terms CB4_1_3I1R14Terms_sound) (by decide +kernel) +def CB4_1_3I1R14Mass : Ball := ⟨0, 0⟩ +lemma CB4_1_3I1R14Mass_sound : CB4_1_3I1R14Mass.Encloses (∑ a, CB4_1_3I1R14Value a) := by + exact contains_sound (finSumBall_sound 6 CB4_1_3I1R14P CB4_1_3I1R14Value CB4_1_3I1R14P_sound) (by decide +kernel) +def CB4_1_3I1R14MassTerm : Ball := .exact 0 +lemma CB4_1_3I1R14MassTerm_sound : CB4_1_3I1R14MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB4_1_3I1R14Value a))) := + entropyTerm_zero_ball (CB4_1_3I1R14Mass_sound) +def CB4_1_3I1R14H : Ball := ⟨0, 0⟩ +lemma CB4_1_3I1R14H_sound : CB4_1_3I1R14H.Encloses (homogeneousEntropy CB4_1_3I1R14Value) := by + exact contains_sound (homogeneous_enclosed CB4_1_3I1R14Value CB4_1_3I1R14MassTerm_sound CB4_1_3I1R14Entropy_sound) (by decide +kernel) +def CB4_1_3I1R15Value (a : Fin 6) : ℝ := residualLaw (below (shape 4 1 3)) (fun u => (stageBLaw (shape 4 1 3) u : ℝ)) (stageBPriority (shape 4 1 3)) 1 (fun u a => (littleLaw (shape 4 1 3) u ((stageBPriority (shape 4 1 3)) 1) a : ℝ)) 15 a +def CB4_1_3I1R15Raw (a : Fin 6) : Ball := residualBall (below (shape 4 1 3)) B4_1_3Law (stageBPriority (shape 4 1 3)) 1 (fun u => B4_1_3Little u ((stageBPriority (shape 4 1 3)) 1)) 15 a +lemma CB4_1_3I1R15Raw_sound (a : Fin 6) : + (CB4_1_3I1R15Raw a).Encloses (CB4_1_3I1R15Value a) := by + exact residualBall_sound_on (below (shape 4 1 3)) B4_1_3Law (fun u => (stageBLaw (shape 4 1 3) u : ℝ)) (stageBPriority (shape 4 1 3)) 1 (fun u => B4_1_3Little u ((stageBPriority (shape 4 1 3)) 1)) (fun u a => (littleLaw (shape 4 1 3) u ((stageBPriority (shape 4 1 3)) 1) a : ℝ)) (fun u _ => B4_1_3Law_sound u) (fun u _ a => B4_1_3Little_sound u ((stageBPriority (shape 4 1 3)) 1) a) 15 a +def CB4_1_3I1R15Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB4_1_3I1R15Certificates_valid : + CB4_1_3I1R15Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB4_1_3I1R15CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB4_1_3I1R15P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB4_1_3I1R15Certificates (CB4_1_3I1R15CertificateIndex a)).input +lemma CB4_1_3I1R15P_check : ∀ a : Fin 6, contains (CB4_1_3I1R15Raw a) (CB4_1_3I1R15P a) = true := by + decide +kernel +lemma CB4_1_3I1R15P_sound (a : Fin 6) : + (CB4_1_3I1R15P a).Encloses (CB4_1_3I1R15Value a) := + contains_sound (CB4_1_3I1R15Raw_sound a) (CB4_1_3I1R15P_check a) +def CB4_1_3I1R15Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB4_1_3I1R15Certificates (CB4_1_3I1R15CertificateIndex a)).output +lemma CB4_1_3I1R15Terms_sound (a : Fin 6) : + (CB4_1_3I1R15Terms a).Encloses (Foundation.entropyTerm (CB4_1_3I1R15Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB4_1_3I1R15Certificates_valid + (CB4_1_3I1R15CertificateIndex a) (CB4_1_3I1R15P_sound a) +def CB4_1_3I1R15Entropy : Ball := ⟨0, 0⟩ +lemma CB4_1_3I1R15Entropy_sound : CB4_1_3I1R15Entropy.Encloses (Foundation.finiteEntropy CB4_1_3I1R15Value) := by + exact contains_sound (entropyFin_enclosed 6 CB4_1_3I1R15Value CB4_1_3I1R15Terms CB4_1_3I1R15Terms_sound) (by decide +kernel) +def CB4_1_3I1R15Mass : Ball := ⟨0, 0⟩ +lemma CB4_1_3I1R15Mass_sound : CB4_1_3I1R15Mass.Encloses (∑ a, CB4_1_3I1R15Value a) := by + exact contains_sound (finSumBall_sound 6 CB4_1_3I1R15P CB4_1_3I1R15Value CB4_1_3I1R15P_sound) (by decide +kernel) +def CB4_1_3I1R15MassTerm : Ball := .exact 0 +lemma CB4_1_3I1R15MassTerm_sound : CB4_1_3I1R15MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB4_1_3I1R15Value a))) := + entropyTerm_zero_ball (CB4_1_3I1R15Mass_sound) +def CB4_1_3I1R15H : Ball := ⟨0, 0⟩ +lemma CB4_1_3I1R15H_sound : CB4_1_3I1R15H.Encloses (homogeneousEntropy CB4_1_3I1R15Value) := by + exact contains_sound (homogeneous_enclosed CB4_1_3I1R15Value CB4_1_3I1R15MassTerm_sound CB4_1_3I1R15Entropy_sound) (by decide +kernel) +def CB4_1_3I1R16Value (a : Fin 6) : ℝ := residualLaw (below (shape 4 1 3)) (fun u => (stageBLaw (shape 4 1 3) u : ℝ)) (stageBPriority (shape 4 1 3)) 1 (fun u a => (littleLaw (shape 4 1 3) u ((stageBPriority (shape 4 1 3)) 1) a : ℝ)) 16 a +def CB4_1_3I1R16Raw (a : Fin 6) : Ball := residualBall (below (shape 4 1 3)) B4_1_3Law (stageBPriority (shape 4 1 3)) 1 (fun u => B4_1_3Little u ((stageBPriority (shape 4 1 3)) 1)) 16 a +lemma CB4_1_3I1R16Raw_sound (a : Fin 6) : + (CB4_1_3I1R16Raw a).Encloses (CB4_1_3I1R16Value a) := by + exact residualBall_sound_on (below (shape 4 1 3)) B4_1_3Law (fun u => (stageBLaw (shape 4 1 3) u : ℝ)) (stageBPriority (shape 4 1 3)) 1 (fun u => B4_1_3Little u ((stageBPriority (shape 4 1 3)) 1)) (fun u a => (littleLaw (shape 4 1 3) u ((stageBPriority (shape 4 1 3)) 1) a : ℝ)) (fun u _ => B4_1_3Law_sound u) (fun u _ a => B4_1_3Little_sound u ((stageBPriority (shape 4 1 3)) 1) a) 16 a +def CB4_1_3I1R16Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB4_1_3I1R16Certificates_valid : + CB4_1_3I1R16Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB4_1_3I1R16CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB4_1_3I1R16P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB4_1_3I1R16Certificates (CB4_1_3I1R16CertificateIndex a)).input +lemma CB4_1_3I1R16P_check : ∀ a : Fin 6, contains (CB4_1_3I1R16Raw a) (CB4_1_3I1R16P a) = true := by + decide +kernel +lemma CB4_1_3I1R16P_sound (a : Fin 6) : + (CB4_1_3I1R16P a).Encloses (CB4_1_3I1R16Value a) := + contains_sound (CB4_1_3I1R16Raw_sound a) (CB4_1_3I1R16P_check a) +def CB4_1_3I1R16Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB4_1_3I1R16Certificates (CB4_1_3I1R16CertificateIndex a)).output +lemma CB4_1_3I1R16Terms_sound (a : Fin 6) : + (CB4_1_3I1R16Terms a).Encloses (Foundation.entropyTerm (CB4_1_3I1R16Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB4_1_3I1R16Certificates_valid + (CB4_1_3I1R16CertificateIndex a) (CB4_1_3I1R16P_sound a) +def CB4_1_3I1R16Entropy : Ball := ⟨0, 0⟩ +lemma CB4_1_3I1R16Entropy_sound : CB4_1_3I1R16Entropy.Encloses (Foundation.finiteEntropy CB4_1_3I1R16Value) := by + exact contains_sound (entropyFin_enclosed 6 CB4_1_3I1R16Value CB4_1_3I1R16Terms CB4_1_3I1R16Terms_sound) (by decide +kernel) +def CB4_1_3I1R16Mass : Ball := ⟨0, 0⟩ +lemma CB4_1_3I1R16Mass_sound : CB4_1_3I1R16Mass.Encloses (∑ a, CB4_1_3I1R16Value a) := by + exact contains_sound (finSumBall_sound 6 CB4_1_3I1R16P CB4_1_3I1R16Value CB4_1_3I1R16P_sound) (by decide +kernel) +def CB4_1_3I1R16MassTerm : Ball := .exact 0 +lemma CB4_1_3I1R16MassTerm_sound : CB4_1_3I1R16MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB4_1_3I1R16Value a))) := + entropyTerm_zero_ball (CB4_1_3I1R16Mass_sound) +def CB4_1_3I1R16H : Ball := ⟨0, 0⟩ +lemma CB4_1_3I1R16H_sound : CB4_1_3I1R16H.Encloses (homogeneousEntropy CB4_1_3I1R16Value) := by + exact contains_sound (homogeneous_enclosed CB4_1_3I1R16Value CB4_1_3I1R16MassTerm_sound CB4_1_3I1R16Entropy_sound) (by decide +kernel) +def CB4_1_3I1ResidualEntropies (a : Fin 17) : Ball := + match a.val with + | 0 => CB4_1_3I1R0H + | 1 => CB4_1_3I1R1H + | 2 => CB4_1_3I1R2H + | 3 => CB4_1_3I1R3H + | 4 => CB4_1_3I1R4H + | 5 => CB4_1_3I1R5H + | 6 => CB4_1_3I1R6H + | 7 => CB4_1_3I1R7H + | 8 => CB4_1_3I1R8H + | 9 => CB4_1_3I1R9H + | 10 => CB4_1_3I1R10H + | 11 => CB4_1_3I1R11H + | 12 => CB4_1_3I1R12H + | 13 => CB4_1_3I1R13H + | 14 => CB4_1_3I1R14H + | 15 => CB4_1_3I1R15H + | 16 => CB4_1_3I1R16H + | _ => (.exact 0) +lemma CB4_1_3I1ResidualEntropies_sound (k : Fin 17) : + (CB4_1_3I1ResidualEntropies k).Encloses (homogeneousEntropy + (residualLaw (below (shape 4 1 3)) (fun u => (stageBLaw (shape 4 1 3) u : ℝ)) (stageBPriority (shape 4 1 3)) 1 (fun u a => (littleLaw (shape 4 1 3) u ((stageBPriority (shape 4 1 3)) 1) a : ℝ)) k)) := by + fin_cases k + · exact CB4_1_3I1R0H_sound + · exact CB4_1_3I1R1H_sound + · exact CB4_1_3I1R2H_sound + · exact CB4_1_3I1R3H_sound + · exact CB4_1_3I1R4H_sound + · exact CB4_1_3I1R5H_sound + · exact CB4_1_3I1R6H_sound + · exact CB4_1_3I1R7H_sound + · exact CB4_1_3I1R8H_sound + · exact CB4_1_3I1R9H_sound + · exact CB4_1_3I1R10H_sound + · exact CB4_1_3I1R11H_sound + · exact CB4_1_3I1R12H_sound + · exact CB4_1_3I1R13H_sound + · exact CB4_1_3I1R14H_sound + · exact CB4_1_3I1R15H_sound + · exact CB4_1_3I1R16H_sound +def CB4_1_3I1S0_1_3Value (a : Fin 6) : ℝ := (littleLaw (shape 4 1 3) (shape 0 1 3) ((stageBPriority (shape 4 1 3)) 1) a : ℝ) +def CB4_1_3I1S0_1_3E_4Log : Ball := .exact 0 +lemma CB4_1_3I1S0_1_3E_4Log_sound : CB4_1_3I1S0_1_3E_4Log.Encloses (Real.log (CB4_1_3I1S0_1_3Value (4 : Fin 6))) := by + exact log_exact_one_ball ((B4_1_3Little_sound (shape 0 1 3) ((stageBPriority (shape 4 1 3)) 1)) (4 : Fin 6)) +def CB4_1_3I1S0_1_3E_4 : Ball := ⟨0, 0⟩ +lemma CB4_1_3I1S0_1_3E_4_sound : CB4_1_3I1S0_1_3E_4.Encloses (Foundation.entropyTerm (CB4_1_3I1S0_1_3Value (4 : Fin 6))) := by + exact contains_sound (entropyTerm_ball ((B4_1_3Little_sound (shape 0 1 3) ((stageBPriority (shape 4 1 3)) 1)) (4 : Fin 6)) CB4_1_3I1S0_1_3E_4Log_sound) (by decide +kernel) +def CB4_1_3I1S0_1_3Terms (a : Fin 6) : Ball := + match a.val with + | 4 => ⟨0, 0⟩ + | _ => (.exact 0) +lemma CB4_1_3I1S0_1_3Terms_sound (a : Fin 6) : + (CB4_1_3I1S0_1_3Terms a).Encloses (Foundation.entropyTerm (CB4_1_3I1S0_1_3Value a)) := by + fin_cases a + · exact (entropyTerm_zero_ball ((B4_1_3Little_sound (shape 0 1 3) ((stageBPriority (shape 4 1 3)) 1)) (0 : Fin 6))) + · exact (entropyTerm_zero_ball ((B4_1_3Little_sound (shape 0 1 3) ((stageBPriority (shape 4 1 3)) 1)) (1 : Fin 6))) + · exact (entropyTerm_zero_ball ((B4_1_3Little_sound (shape 0 1 3) ((stageBPriority (shape 4 1 3)) 1)) (2 : Fin 6))) + · exact (entropyTerm_zero_ball ((B4_1_3Little_sound (shape 0 1 3) ((stageBPriority (shape 4 1 3)) 1)) (3 : Fin 6))) + · exact CB4_1_3I1S0_1_3E_4_sound + · exact (entropyTerm_zero_ball ((B4_1_3Little_sound (shape 0 1 3) ((stageBPriority (shape 4 1 3)) 1)) (5 : Fin 6))) +def CB4_1_3I1S0_1_3Entropy : Ball := ⟨0, 0⟩ +lemma CB4_1_3I1S0_1_3Entropy_sound : CB4_1_3I1S0_1_3Entropy.Encloses (Foundation.finiteEntropy CB4_1_3I1S0_1_3Value) := by + exact contains_sound (entropyFin_enclosed 6 CB4_1_3I1S0_1_3Value CB4_1_3I1S0_1_3Terms CB4_1_3I1S0_1_3Terms_sound) (by decide +kernel) +def CB4_1_3I1S0_1_3Mass : Ball := ⟨1, 0⟩ +lemma CB4_1_3I1S0_1_3Mass_sound : CB4_1_3I1S0_1_3Mass.Encloses (∑ a, CB4_1_3I1S0_1_3Value a) := by + exact contains_sound (finSumBall_sound 6 (B4_1_3Little (shape 0 1 3) ((stageBPriority (shape 4 1 3)) 1)) CB4_1_3I1S0_1_3Value (B4_1_3Little_sound (shape 0 1 3) ((stageBPriority (shape 4 1 3)) 1))) (by decide +kernel) +def CB4_1_3I1S0_1_3MassTermLog : Ball := .exact 0 +lemma CB4_1_3I1S0_1_3MassTermLog_sound : CB4_1_3I1S0_1_3MassTermLog.Encloses (Real.log ((∑ a, CB4_1_3I1S0_1_3Value a))) := by + exact log_exact_one_ball (CB4_1_3I1S0_1_3Mass_sound) +def CB4_1_3I1S0_1_3MassTerm : Ball := ⟨0, 0⟩ +lemma CB4_1_3I1S0_1_3MassTerm_sound : CB4_1_3I1S0_1_3MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB4_1_3I1S0_1_3Value a))) := by + exact contains_sound (entropyTerm_ball (CB4_1_3I1S0_1_3Mass_sound) CB4_1_3I1S0_1_3MassTermLog_sound) (by decide +kernel) +def CB4_1_3I1S0_1_3H : Ball := ⟨0, 0⟩ +lemma CB4_1_3I1S0_1_3H_sound : CB4_1_3I1S0_1_3H.Encloses (homogeneousEntropy CB4_1_3I1S0_1_3Value) := by + exact contains_sound (homogeneous_enclosed CB4_1_3I1S0_1_3Value CB4_1_3I1S0_1_3MassTerm_sound CB4_1_3I1S0_1_3Entropy_sound) (by decide +kernel) +def CB4_1_3I1Singles (s : Shape) : Ball := + match s 0, s 1, s 2 with + | 0, 1, 3 => CB4_1_3I1S0_1_3H + | _, _, _ => (.exact 0) +lemma CB4_1_3I1Singles_sound (u : Shape) (hu : u ∈ below (shape 4 1 3)) + (hd : designated (stageBPriority (shape 4 1 3)) 1 u) : + (CB4_1_3I1Singles u).Encloses (homogeneousEntropy ((fun u a => (littleLaw (shape 4 1 3) u ((stageBPriority (shape 4 1 3)) 1) a : ℝ)) u)) := by + rw [B4_1_3_below] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl + · exact CB4_1_3I1S0_1_3H_sound + · exact (show ¬ designated (stageBPriority (shape 4 1 3)) 1 (shape 1 0 3) by decide +kernel) hd |>.elim + · exact (show ¬ designated (stageBPriority (shape 4 1 3)) 1 (shape 1 1 2) by decide +kernel) hd |>.elim + · exact (show ¬ designated (stageBPriority (shape 4 1 3)) 1 (shape 2 0 2) by decide +kernel) hd |>.elim + · exact (show ¬ designated (stageBPriority (shape 4 1 3)) 1 (shape 2 1 1) by decide +kernel) hd |>.elim + · exact (show ¬ designated (stageBPriority (shape 4 1 3)) 1 (shape 3 0 1) by decide +kernel) hd |>.elim + · exact (show ¬ designated (stageBPriority (shape 4 1 3)) 1 (shape 3 1 0) by decide +kernel) hd |>.elim + · exact (show ¬ designated (stageBPriority (shape 4 1 3)) 1 (shape 4 0 0) by decide +kernel) hd |>.elim +def CB4_1_3I1Singleton : Ball := ⟨0, 0⟩ +lemma CB4_1_3I1Singleton_sound : CB4_1_3I1Singleton.Encloses + (singletonEntropy (below (shape 4 1 3)) (fun u => (stageBLaw (shape 4 1 3) u : ℝ)) (stageBPriority (shape 4 1 3)) 1 (fun u a => (littleLaw (shape 4 1 3) u ((stageBPriority (shape 4 1 3)) 1) a : ℝ))) := by + exact contains_sound (singletonBall_sound (below (shape 4 1 3)) B4_1_3Law (fun u => (stageBLaw (shape 4 1 3) u : ℝ)) (stageBPriority (shape 4 1 3)) 1 + CB4_1_3I1Singles (fun u a => (littleLaw (shape 4 1 3) u ((stageBPriority (shape 4 1 3)) 1) a : ℝ)) (fun u _ => B4_1_3Law_sound u) CB4_1_3I1Singles_sound) (by decide +kernel) +def CB4_1_3I1Group : Ball := ⟨(7275369214767643422929228408687 / 50000000000000000000000000000000), (6764398581 / 5000000000000000000000000000000)⟩ +lemma CB4_1_3I1Group_sound : CB4_1_3I1Group.Encloses + (groupedEntropy (below (shape 4 1 3)) (fun u => (stageBLaw (shape 4 1 3) u : ℝ)) (stageBPriority (shape 4 1 3)) 1 (fun u a => (littleLaw (shape 4 1 3) u ((stageBPriority (shape 4 1 3)) 1) a : ℝ))) := by + exact contains_sound (Ball.add_sound CB4_1_3I1Singleton_sound + (finSumBall_sound 17 CB4_1_3I1ResidualEntropies _ CB4_1_3I1ResidualEntropies_sound)) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CB4_1_3I1H : Ball := ⟨(40774960481591935815520811893549 / 50000000000000000000000000000000), (363554979689 / 100000000000000000000000000000000)⟩ +lemma CB4_1_3I1_sound : CB4_1_3I1H.Encloses (stageBCapacity (shape 4 1 3) 1) := by + have hb := contains_sound (Ball.add_sound CB4_1_3I1PairH_sound + (Ball.neg_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) CB4_1_3I1Group_sound))) + (show contains (.add CB4_1_3I1PairH (.neg (.mul (.exact 2) CB4_1_3I1Group))) CB4_1_3I1H = true by decide +kernel) + unfold CB4_1_3I1PairValue at hb + simpa only [stageBCapacity, nativeCapacity, + show (1 : Fin 3) ≠ 0 by decide, ite_false, sub_eq_add_neg] using hb + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/CapacityB/CapB4_1_3I2.lean b/lean/OAI/LinearAlgebra/MatrixFields/CapacityB/CapB4_1_3I2.lean new file mode 100644 index 0000000000000000000000000000000000000000..6e52c75f7bba933838ce174589092cc4ed08d9d4 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/CapacityB/CapB4_1_3I2.lean @@ -0,0 +1,1041 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Certificates.Terminal4_1_3 + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CB4_1_3I2PairValue (a : PairSlot) : ℝ := pairLaw (below (shape 4 1 3)) (shape 4 1 3) (fun u => (stageBLaw (shape 4 1 3) u : ℝ)) (fun u a => (littleLaw (shape 4 1 3) u ((stageBPriority (shape 4 1 3)) 2) a : ℝ)) a +def CB4_1_3I2PairRaw (a : PairSlot) : Ball := pairLawBall (below (shape 4 1 3)) (shape 4 1 3) B4_1_3Law (fun u => B4_1_3Little u ((stageBPriority (shape 4 1 3)) 2)) a +lemma CB4_1_3I2PairRaw_sound (a : PairSlot) : + (CB4_1_3I2PairRaw a).Encloses (CB4_1_3I2PairValue a) := by + exact pairLawBall_sound_on (below (shape 4 1 3)) (shape 4 1 3) B4_1_3Law (fun u => (stageBLaw (shape 4 1 3) u : ℝ)) (fun u => B4_1_3Little u ((stageBPriority (shape 4 1 3)) 2)) (fun u a => (littleLaw (shape 4 1 3) u ((stageBPriority (shape 4 1 3)) 2) a : ℝ)) (fun u _ => B4_1_3Law_sound u) (fun u _ a => B4_1_3Little_sound u ((stageBPriority (shape 4 1 3)) 2) a) (fun u _ a => B4_1_3Little_sound (complement (shape 4 1 3) u) ((stageBPriority (shape 4 1 3)) 2) a) a +def CB4_1_3I2PairCertificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(33446547050938077933247687037 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(53534388759604419469623257687 / 20000000000000000000000000000000), (46036787 / 50000000000000000000000000000000)⟩ ⟨(-800297691090102173365334880393559 / 100000000000000000000000000000000), (68821427717 / 25000000000000000000000000000000)⟩ ⟨-12, 33446547050938077933247687037, 24414062500000000000000000000⟩, + .log ⟨(7864636411117022342973839771027 / 100000000000000000000000000000000), (3 / 20000000000000000000000000000000)⟩ ⟨(624942166526389002777467507497 / 3125000000000000000000000000000), (1040875969 / 12500000000000000000000000000000)⟩ ⟨(-127139693963322650996914985395911 / 50000000000000000000000000000000), (21175823721 / 20000000000000000000000000000000)⟩ ⟨-4, 7864636411117022342973839771027, 6250000000000000000000000000000⟩, + .log ⟨(75912799250947798122822246208417 / 100000000000000000000000000000000), (19 / 100000000000000000000000000000000)⟩ ⟨(261505248482584004104412047689 / 1250000000000000000000000000000), (32150321069 / 100000000000000000000000000000000)⟩ ⟨(-13779244136057544666179378258031 / 50000000000000000000000000000000), (4235164739 / 10000000000000000000000000000000)⟩ ⟨-1, 75912799250947798122822246208417, 50000000000000000000000000000000⟩, + .log ⟨(4133302117167199798769837390289 / 100000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ ⟨(13169087233778501598943394933873 / 100000000000000000000000000000000), (5251564621 / 100000000000000000000000000000000)⟩ ⟨(-318609355437198673996433703880103 / 100000000000000000000000000000000), (63527471073 / 50000000000000000000000000000000)⟩ ⟨-5, 4133302117167199798769837390289, 3125000000000000000000000000000⟩, + .log ⟨(24430598381881437823904094877 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(203191463172947425273224106509 / 100000000000000000000000000000000), (16813489 / 25000000000000000000000000000000)⟩ ⟨(-831708908626819067219012525153877 / 100000000000000000000000000000000), (275285711971 / 100000000000000000000000000000000)⟩ ⟨-12, 24430598381881437823904094877, 24414062500000000000000000000⟩] +lemma CB4_1_3I2PairCertificates_valid : + CB4_1_3I2PairCertificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB4_1_3I2PairCertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 0, 5 => 1 + | 1, 4 => 2 + | 2, 2 => 3 + | 2, 3 => 4 + | 3, 2 => 4 + | 3, 3 => 5 + | 4, 1 => 2 + | 5, 0 => 1 + | _, _ => 0 +def CB4_1_3I2PairP (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CB4_1_3I2PairCertificates (CB4_1_3I2PairCertificateIndex a)).input +lemma CB4_1_3I2PairP_check : ∀ a : PairSlot, contains (CB4_1_3I2PairRaw a) (CB4_1_3I2PairP a) = true := by + decide +kernel +lemma CB4_1_3I2PairP_sound (a : PairSlot) : + (CB4_1_3I2PairP a).Encloses (CB4_1_3I2PairValue a) := + contains_sound (CB4_1_3I2PairRaw_sound a) (CB4_1_3I2PairP_check a) +def CB4_1_3I2PairTerms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CB4_1_3I2PairCertificates (CB4_1_3I2PairCertificateIndex a)).output +lemma CB4_1_3I2PairTerms_sound (a : PairSlot) : + (CB4_1_3I2PairTerms a).Encloses (Foundation.entropyTerm (CB4_1_3I2PairValue a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB4_1_3I2PairCertificates_valid + (CB4_1_3I2PairCertificateIndex a) (CB4_1_3I2PairP_sound a) +def CB4_1_3I2PairEntropy : Ball := ⟨(87993428354621611323967130846053 / 100000000000000000000000000000000), (59558866919 / 100000000000000000000000000000000)⟩ +lemma CB4_1_3I2PairEntropy_sound : CB4_1_3I2PairEntropy.Encloses (Foundation.finiteEntropy CB4_1_3I2PairValue) := by + exact contains_sound (entropyPair_enclosed CB4_1_3I2PairValue CB4_1_3I2PairTerms CB4_1_3I2PairTerms_sound) (by decide +kernel) +def CB4_1_3I2PairMass : Ball := ⟨1, (7 / 12500000000000000000000000000000)⟩ +lemma CB4_1_3I2PairMass_sound : CB4_1_3I2PairMass.Encloses (∑ a, CB4_1_3I2PairValue a) := by + exact contains_sound (pairSumBall_sound CB4_1_3I2PairP CB4_1_3I2PairValue CB4_1_3I2PairP_sound) (by decide +kernel) +def CB4_1_3I2PairMassTermLogWitness : LogWitness := ⟨0, 1, 1⟩ +def CB4_1_3I2PairMassTermLog : Ball := ⟨0, (10587911869 / 50000000000000000000000000000000)⟩ +lemma CB4_1_3I2PairMassTermLog_sound : CB4_1_3I2PairMassTermLog.Encloses (Real.log ((∑ a, CB4_1_3I2PairValue a))) := by + exact checkLog_sound logTwoBall_sound (CB4_1_3I2PairMass_sound) (w := CB4_1_3I2PairMassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB4_1_3I2PairMassTerm : Ball := ⟨0, (21175823739 / 100000000000000000000000000000000)⟩ +lemma CB4_1_3I2PairMassTerm_sound : CB4_1_3I2PairMassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB4_1_3I2PairValue a))) := by + exact contains_sound (entropyTerm_ball (CB4_1_3I2PairMass_sound) CB4_1_3I2PairMassTermLog_sound) (by decide +kernel) +def CB4_1_3I2PairH : Ball := ⟨(87993428354621611323967130846053 / 100000000000000000000000000000000), (40367345329 / 50000000000000000000000000000000)⟩ +lemma CB4_1_3I2PairH_sound : CB4_1_3I2PairH.Encloses (homogeneousEntropy CB4_1_3I2PairValue) := by + exact contains_sound (homogeneous_enclosed CB4_1_3I2PairValue CB4_1_3I2PairMassTerm_sound CB4_1_3I2PairEntropy_sound) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CB4_1_3I2R0Value (a : Fin 6) : ℝ := residualLaw (below (shape 4 1 3)) (fun u => (stageBLaw (shape 4 1 3) u : ℝ)) (stageBPriority (shape 4 1 3)) 2 (fun u a => (littleLaw (shape 4 1 3) u ((stageBPriority (shape 4 1 3)) 2) a : ℝ)) 0 a +def CB4_1_3I2R0Raw (a : Fin 6) : Ball := residualBall (below (shape 4 1 3)) B4_1_3Law (stageBPriority (shape 4 1 3)) 2 (fun u => B4_1_3Little u ((stageBPriority (shape 4 1 3)) 2)) 0 a +lemma CB4_1_3I2R0Raw_sound (a : Fin 6) : + (CB4_1_3I2R0Raw a).Encloses (CB4_1_3I2R0Value a) := by + exact residualBall_sound_on (below (shape 4 1 3)) B4_1_3Law (fun u => (stageBLaw (shape 4 1 3) u : ℝ)) (stageBPriority (shape 4 1 3)) 2 (fun u => B4_1_3Little u ((stageBPriority (shape 4 1 3)) 2)) (fun u a => (littleLaw (shape 4 1 3) u ((stageBPriority (shape 4 1 3)) 2) a : ℝ)) (fun u _ => B4_1_3Law_sound u) (fun u _ a => B4_1_3Little_sound u ((stageBPriority (shape 4 1 3)) 2) a) 0 a +def CB4_1_3I2R0Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(33446547050938077933247687037 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(53534388759604419469623257687 / 20000000000000000000000000000000), (46036787 / 50000000000000000000000000000000)⟩ ⟨(-800297691090102173365334880393559 / 100000000000000000000000000000000), (68821427717 / 25000000000000000000000000000000)⟩ ⟨-12, 33446547050938077933247687037, 24414062500000000000000000000⟩] +lemma CB4_1_3I2R0Certificates_valid : + CB4_1_3I2R0Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB4_1_3I2R0CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | 0 => 1 + | _ => 0 +def CB4_1_3I2R0P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB4_1_3I2R0Certificates (CB4_1_3I2R0CertificateIndex a)).input +lemma CB4_1_3I2R0P_check : ∀ a : Fin 6, contains (CB4_1_3I2R0Raw a) (CB4_1_3I2R0P a) = true := by + decide +kernel +lemma CB4_1_3I2R0P_sound (a : Fin 6) : + (CB4_1_3I2R0P a).Encloses (CB4_1_3I2R0Value a) := + contains_sound (CB4_1_3I2R0Raw_sound a) (CB4_1_3I2R0P_check a) +def CB4_1_3I2R0Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB4_1_3I2R0Certificates (CB4_1_3I2R0CertificateIndex a)).output +lemma CB4_1_3I2R0Terms_sound (a : Fin 6) : + (CB4_1_3I2R0Terms a).Encloses (Foundation.entropyTerm (CB4_1_3I2R0Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB4_1_3I2R0Certificates_valid + (CB4_1_3I2R0CertificateIndex a) (CB4_1_3I2R0P_sound a) +def CB4_1_3I2R0Entropy : Ball := ⟨(53534388759604419469623257687 / 20000000000000000000000000000000), (46036787 / 50000000000000000000000000000000)⟩ +lemma CB4_1_3I2R0Entropy_sound : CB4_1_3I2R0Entropy.Encloses (Foundation.finiteEntropy CB4_1_3I2R0Value) := by + exact contains_sound (entropyFin_enclosed 6 CB4_1_3I2R0Value CB4_1_3I2R0Terms CB4_1_3I2R0Terms_sound) (by decide +kernel) +def CB4_1_3I2R0Mass : Ball := ⟨(33446547050938077933247687037 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ +lemma CB4_1_3I2R0Mass_sound : CB4_1_3I2R0Mass.Encloses (∑ a, CB4_1_3I2R0Value a) := by + exact contains_sound (finSumBall_sound 6 CB4_1_3I2R0P CB4_1_3I2R0Value CB4_1_3I2R0P_sound) (by decide +kernel) +def CB4_1_3I2R0MassTermLogWitness : LogWitness := ⟨-12, 33446547050938077933247687037, 24414062500000000000000000000⟩ +def CB4_1_3I2R0MassTermLog : Ball := ⟨(-800297691090102173365334880393559 / 100000000000000000000000000000000), (68821427717 / 25000000000000000000000000000000)⟩ +lemma CB4_1_3I2R0MassTermLog_sound : CB4_1_3I2R0MassTermLog.Encloses (Real.log ((∑ a, CB4_1_3I2R0Value a))) := by + exact checkLog_sound logTwoBall_sound (CB4_1_3I2R0Mass_sound) (w := CB4_1_3I2R0MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB4_1_3I2R0MassTerm : Ball := ⟨(53534388759604419469623257687 / 20000000000000000000000000000000), (46036787 / 50000000000000000000000000000000)⟩ +lemma CB4_1_3I2R0MassTerm_sound : CB4_1_3I2R0MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB4_1_3I2R0Value a))) := by + exact contains_sound (entropyTerm_ball (CB4_1_3I2R0Mass_sound) CB4_1_3I2R0MassTermLog_sound) (by decide +kernel) +def CB4_1_3I2R0H : Ball := ⟨0, (46036787 / 25000000000000000000000000000000)⟩ +lemma CB4_1_3I2R0H_sound : CB4_1_3I2R0H.Encloses (homogeneousEntropy CB4_1_3I2R0Value) := by + exact contains_sound (homogeneous_enclosed CB4_1_3I2R0Value CB4_1_3I2R0MassTerm_sound CB4_1_3I2R0Entropy_sound) (by decide +kernel) +def CB4_1_3I2R1Value (a : Fin 6) : ℝ := residualLaw (below (shape 4 1 3)) (fun u => (stageBLaw (shape 4 1 3) u : ℝ)) (stageBPriority (shape 4 1 3)) 2 (fun u a => (littleLaw (shape 4 1 3) u ((stageBPriority (shape 4 1 3)) 2) a : ℝ)) 1 a +def CB4_1_3I2R1Raw (a : Fin 6) : Ball := residualBall (below (shape 4 1 3)) B4_1_3Law (stageBPriority (shape 4 1 3)) 2 (fun u => B4_1_3Little u ((stageBPriority (shape 4 1 3)) 2)) 1 a +lemma CB4_1_3I2R1Raw_sound (a : Fin 6) : + (CB4_1_3I2R1Raw a).Encloses (CB4_1_3I2R1Value a) := by + exact residualBall_sound_on (below (shape 4 1 3)) B4_1_3Law (fun u => (stageBLaw (shape 4 1 3) u : ℝ)) (stageBPriority (shape 4 1 3)) 2 (fun u => B4_1_3Little u ((stageBPriority (shape 4 1 3)) 2)) (fun u a => (littleLaw (shape 4 1 3) u ((stageBPriority (shape 4 1 3)) 2) a : ℝ)) (fun u _ => B4_1_3Law_sound u) (fun u _ a => B4_1_3Little_sound u ((stageBPriority (shape 4 1 3)) 2) a) 1 a +def CB4_1_3I2R1Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(3286575346523891131058813407701 / 50000000000000000000000000000000), (1 / 10000000000000000000000000000000)⟩ ⟨(3578655809697544406731761086259 / 20000000000000000000000000000000), (1739898511 / 25000000000000000000000000000000)⟩ ⟨(-68054422772525543341333758289357 / 25000000000000000000000000000000), (52939559283 / 50000000000000000000000000000000)⟩ ⟨-4, 3286575346523891131058813407701, 3125000000000000000000000000000⟩] +lemma CB4_1_3I2R1Certificates_valid : + CB4_1_3I2R1Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB4_1_3I2R1CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | 1 => 1 + | _ => 0 +def CB4_1_3I2R1P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB4_1_3I2R1Certificates (CB4_1_3I2R1CertificateIndex a)).input +lemma CB4_1_3I2R1P_check : ∀ a : Fin 6, contains (CB4_1_3I2R1Raw a) (CB4_1_3I2R1P a) = true := by + decide +kernel +lemma CB4_1_3I2R1P_sound (a : Fin 6) : + (CB4_1_3I2R1P a).Encloses (CB4_1_3I2R1Value a) := + contains_sound (CB4_1_3I2R1Raw_sound a) (CB4_1_3I2R1P_check a) +def CB4_1_3I2R1Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB4_1_3I2R1Certificates (CB4_1_3I2R1CertificateIndex a)).output +lemma CB4_1_3I2R1Terms_sound (a : Fin 6) : + (CB4_1_3I2R1Terms a).Encloses (Foundation.entropyTerm (CB4_1_3I2R1Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB4_1_3I2R1Certificates_valid + (CB4_1_3I2R1CertificateIndex a) (CB4_1_3I2R1P_sound a) +def CB4_1_3I2R1Entropy : Ball := ⟨(3578655809697544406731761086259 / 20000000000000000000000000000000), (1739898511 / 25000000000000000000000000000000)⟩ +lemma CB4_1_3I2R1Entropy_sound : CB4_1_3I2R1Entropy.Encloses (Foundation.finiteEntropy CB4_1_3I2R1Value) := by + exact contains_sound (entropyFin_enclosed 6 CB4_1_3I2R1Value CB4_1_3I2R1Terms CB4_1_3I2R1Terms_sound) (by decide +kernel) +def CB4_1_3I2R1Mass : Ball := ⟨(3286575346523891131058813407701 / 50000000000000000000000000000000), (1 / 10000000000000000000000000000000)⟩ +lemma CB4_1_3I2R1Mass_sound : CB4_1_3I2R1Mass.Encloses (∑ a, CB4_1_3I2R1Value a) := by + exact contains_sound (finSumBall_sound 6 CB4_1_3I2R1P CB4_1_3I2R1Value CB4_1_3I2R1P_sound) (by decide +kernel) +def CB4_1_3I2R1MassTermLogWitness : LogWitness := ⟨-4, 3286575346523891131058813407701, 3125000000000000000000000000000⟩ +def CB4_1_3I2R1MassTermLog : Ball := ⟨(-68054422772525543341333758289357 / 25000000000000000000000000000000), (52939559283 / 50000000000000000000000000000000)⟩ +lemma CB4_1_3I2R1MassTermLog_sound : CB4_1_3I2R1MassTermLog.Encloses (Real.log ((∑ a, CB4_1_3I2R1Value a))) := by + exact checkLog_sound logTwoBall_sound (CB4_1_3I2R1Mass_sound) (w := CB4_1_3I2R1MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB4_1_3I2R1MassTerm : Ball := ⟨(3578655809697544406731761086259 / 20000000000000000000000000000000), (1739898511 / 25000000000000000000000000000000)⟩ +lemma CB4_1_3I2R1MassTerm_sound : CB4_1_3I2R1MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB4_1_3I2R1Value a))) := by + exact contains_sound (entropyTerm_ball (CB4_1_3I2R1Mass_sound) CB4_1_3I2R1MassTermLog_sound) (by decide +kernel) +def CB4_1_3I2R1H : Ball := ⟨0, (1739898511 / 12500000000000000000000000000000)⟩ +lemma CB4_1_3I2R1H_sound : CB4_1_3I2R1H.Encloses (homogeneousEntropy CB4_1_3I2R1Value) := by + exact contains_sound (homogeneous_enclosed CB4_1_3I2R1Value CB4_1_3I2R1MassTerm_sound CB4_1_3I2R1Entropy_sound) (by decide +kernel) +def CB4_1_3I2R2Value (a : Fin 6) : ℝ := residualLaw (below (shape 4 1 3)) (fun u => (stageBLaw (shape 4 1 3) u : ℝ)) (stageBPriority (shape 4 1 3)) 2 (fun u a => (littleLaw (shape 4 1 3) u ((stageBPriority (shape 4 1 3)) 2) a : ℝ)) 2 a +def CB4_1_3I2R2Raw (a : Fin 6) : Ball := residualBall (below (shape 4 1 3)) B4_1_3Law (stageBPriority (shape 4 1 3)) 2 (fun u => B4_1_3Little u ((stageBPriority (shape 4 1 3)) 2)) 2 a +lemma CB4_1_3I2R2Raw_sound (a : Fin 6) : + (CB4_1_3I2R2Raw a).Encloses (CB4_1_3I2R2Value a) := by + exact residualBall_sound_on (below (shape 4 1 3)) B4_1_3Law (fun u => (stageBLaw (shape 4 1 3) u : ℝ)) (stageBPriority (shape 4 1 3)) 2 (fun u => B4_1_3Little u ((stageBPriority (shape 4 1 3)) 2)) (fun u a => (littleLaw (shape 4 1 3) u ((stageBPriority (shape 4 1 3)) 2) a : ℝ)) (fun u _ => B4_1_3Law_sound u) (fun u _ a => B4_1_3Little_sound u ((stageBPriority (shape 4 1 3)) 2) a) 2 a +def CB4_1_3I2R2Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(41974306131278246667128681924021 / 100000000000000000000000000000000), (11 / 100000000000000000000000000000000)⟩ ⟨(910960510144736257769626510157 / 2500000000000000000000000000000), (26665215197 / 100000000000000000000000000000000)⟩ ⟨(-86811251368456602009051630303223 / 100000000000000000000000000000000), (2541098843 / 4000000000000000000000000000000)⟩ ⟨-2, 41974306131278246667128681924021, 25000000000000000000000000000000⟩, + .log ⟨(25522182110758582392846123583 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(850391399186025198171391566687 / 100000000000000000000000000000000), (74312321 / 25000000000000000000000000000000)⟩ ⟨(-166598489795187317148391514913309 / 25000000000000000000000000000000), (14558378831 / 6250000000000000000000000000000)⟩ ⟨-10, 25522182110758582392846123583, 19531250000000000000000000000⟩] +lemma CB4_1_3I2R2Certificates_valid : + CB4_1_3I2R2Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB4_1_3I2R2CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | 2 => 1 + | 3 => 2 + | _ => 0 +def CB4_1_3I2R2P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB4_1_3I2R2Certificates (CB4_1_3I2R2CertificateIndex a)).input +lemma CB4_1_3I2R2P_check : ∀ a : Fin 6, contains (CB4_1_3I2R2Raw a) (CB4_1_3I2R2P a) = true := by + decide +kernel +lemma CB4_1_3I2R2P_sound (a : Fin 6) : + (CB4_1_3I2R2P a).Encloses (CB4_1_3I2R2Value a) := + contains_sound (CB4_1_3I2R2Raw_sound a) (CB4_1_3I2R2P_check a) +def CB4_1_3I2R2Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB4_1_3I2R2Certificates (CB4_1_3I2R2CertificateIndex a)).output +lemma CB4_1_3I2R2Terms_sound (a : Fin 6) : + (CB4_1_3I2R2Terms a).Encloses (Foundation.entropyTerm (CB4_1_3I2R2Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB4_1_3I2R2Certificates_valid + (CB4_1_3I2R2CertificateIndex a) (CB4_1_3I2R2P_sound a) +def CB4_1_3I2R2Entropy : Ball := ⟨(37288811804975475508956451972967 / 100000000000000000000000000000000), (26962464481 / 100000000000000000000000000000000)⟩ +lemma CB4_1_3I2R2Entropy_sound : CB4_1_3I2R2Entropy.Encloses (Foundation.finiteEntropy CB4_1_3I2R2Value) := by + exact contains_sound (entropyFin_enclosed 6 CB4_1_3I2R2Value CB4_1_3I2R2Terms CB4_1_3I2R2Terms_sound) (by decide +kernel) +def CB4_1_3I2R2Mass : Ball := ⟨(2631369815114502473693307033871 / 6250000000000000000000000000000), (3 / 25000000000000000000000000000000)⟩ +lemma CB4_1_3I2R2Mass_sound : CB4_1_3I2R2Mass.Encloses (∑ a, CB4_1_3I2R2Value a) := by + exact contains_sound (finSumBall_sound 6 CB4_1_3I2R2P CB4_1_3I2R2Value CB4_1_3I2R2P_sound) (by decide +kernel) +def CB4_1_3I2R2MassTermLogWitness : LogWitness := ⟨-2, 2631369815114502473693307033871, 1562500000000000000000000000000⟩ +def CB4_1_3I2R2MassTermLog : Ball := ⟨(-43253845545051086682667535674217 / 50000000000000000000000000000000), (63527471077 / 100000000000000000000000000000000)⟩ +lemma CB4_1_3I2R2MassTermLog_sound : CB4_1_3I2R2MassTermLog.Encloses (Real.log ((∑ a, CB4_1_3I2R2Value a))) := by + exact checkLog_sound logTwoBall_sound (CB4_1_3I2R2Mass_sound) (w := CB4_1_3I2R2MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB4_1_3I2R2MassTerm : Ball := ⟨(36421396337559143821240452719497 / 100000000000000000000000000000000), (26746283183 / 100000000000000000000000000000000)⟩ +lemma CB4_1_3I2R2MassTerm_sound : CB4_1_3I2R2MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB4_1_3I2R2Value a))) := by + exact contains_sound (entropyTerm_ball (CB4_1_3I2R2Mass_sound) CB4_1_3I2R2MassTermLog_sound) (by decide +kernel) +def CB4_1_3I2R2H : Ball := ⟨(86741546741633168771599925347 / 10000000000000000000000000000000), (3356796729 / 6250000000000000000000000000000)⟩ +lemma CB4_1_3I2R2H_sound : CB4_1_3I2R2H.Encloses (homogeneousEntropy CB4_1_3I2R2Value) := by + exact contains_sound (homogeneous_enclosed CB4_1_3I2R2Value CB4_1_3I2R2MassTerm_sound CB4_1_3I2R2Entropy_sound) (by decide +kernel) +def CB4_1_3I2R3Value (a : Fin 6) : ℝ := residualLaw (below (shape 4 1 3)) (fun u => (stageBLaw (shape 4 1 3) u : ℝ)) (stageBPriority (shape 4 1 3)) 2 (fun u a => (littleLaw (shape 4 1 3) u ((stageBPriority (shape 4 1 3)) 2) a : ℝ)) 3 a +def CB4_1_3I2R3Raw (a : Fin 6) : Ball := residualBall (below (shape 4 1 3)) B4_1_3Law (stageBPriority (shape 4 1 3)) 2 (fun u => B4_1_3Little u ((stageBPriority (shape 4 1 3)) 2)) 3 a +lemma CB4_1_3I2R3Raw_sound (a : Fin 6) : + (CB4_1_3I2R3Raw a).Encloses (CB4_1_3I2R3Value a) := by + exact residualBall_sound_on (below (shape 4 1 3)) B4_1_3Law (fun u => (stageBLaw (shape 4 1 3) u : ℝ)) (stageBPriority (shape 4 1 3)) 2 (fun u => B4_1_3Little u ((stageBPriority (shape 4 1 3)) 2)) (fun u a => (littleLaw (shape 4 1 3) u ((stageBPriority (shape 4 1 3)) 2) a : ℝ)) (fun u _ => B4_1_3Law_sound u) (fun u _ a => B4_1_3Little_sound u ((stageBPriority (shape 4 1 3)) 2) a) 3 a +def CB4_1_3I2R3Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB4_1_3I2R3Certificates_valid : + CB4_1_3I2R3Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB4_1_3I2R3CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB4_1_3I2R3P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB4_1_3I2R3Certificates (CB4_1_3I2R3CertificateIndex a)).input +lemma CB4_1_3I2R3P_check : ∀ a : Fin 6, contains (CB4_1_3I2R3Raw a) (CB4_1_3I2R3P a) = true := by + decide +kernel +lemma CB4_1_3I2R3P_sound (a : Fin 6) : + (CB4_1_3I2R3P a).Encloses (CB4_1_3I2R3Value a) := + contains_sound (CB4_1_3I2R3Raw_sound a) (CB4_1_3I2R3P_check a) +def CB4_1_3I2R3Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB4_1_3I2R3Certificates (CB4_1_3I2R3CertificateIndex a)).output +lemma CB4_1_3I2R3Terms_sound (a : Fin 6) : + (CB4_1_3I2R3Terms a).Encloses (Foundation.entropyTerm (CB4_1_3I2R3Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB4_1_3I2R3Certificates_valid + (CB4_1_3I2R3CertificateIndex a) (CB4_1_3I2R3P_sound a) +def CB4_1_3I2R3Entropy : Ball := ⟨0, 0⟩ +lemma CB4_1_3I2R3Entropy_sound : CB4_1_3I2R3Entropy.Encloses (Foundation.finiteEntropy CB4_1_3I2R3Value) := by + exact contains_sound (entropyFin_enclosed 6 CB4_1_3I2R3Value CB4_1_3I2R3Terms CB4_1_3I2R3Terms_sound) (by decide +kernel) +def CB4_1_3I2R3Mass : Ball := ⟨0, 0⟩ +lemma CB4_1_3I2R3Mass_sound : CB4_1_3I2R3Mass.Encloses (∑ a, CB4_1_3I2R3Value a) := by + exact contains_sound (finSumBall_sound 6 CB4_1_3I2R3P CB4_1_3I2R3Value CB4_1_3I2R3P_sound) (by decide +kernel) +def CB4_1_3I2R3MassTerm : Ball := .exact 0 +lemma CB4_1_3I2R3MassTerm_sound : CB4_1_3I2R3MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB4_1_3I2R3Value a))) := + entropyTerm_zero_ball (CB4_1_3I2R3Mass_sound) +def CB4_1_3I2R3H : Ball := ⟨0, 0⟩ +lemma CB4_1_3I2R3H_sound : CB4_1_3I2R3H.Encloses (homogeneousEntropy CB4_1_3I2R3Value) := by + exact contains_sound (homogeneous_enclosed CB4_1_3I2R3Value CB4_1_3I2R3MassTerm_sound CB4_1_3I2R3Entropy_sound) (by decide +kernel) +def CB4_1_3I2R4Value (a : Fin 6) : ℝ := residualLaw (below (shape 4 1 3)) (fun u => (stageBLaw (shape 4 1 3) u : ℝ)) (stageBPriority (shape 4 1 3)) 2 (fun u a => (littleLaw (shape 4 1 3) u ((stageBPriority (shape 4 1 3)) 2) a : ℝ)) 4 a +def CB4_1_3I2R4Raw (a : Fin 6) : Ball := residualBall (below (shape 4 1 3)) B4_1_3Law (stageBPriority (shape 4 1 3)) 2 (fun u => B4_1_3Little u ((stageBPriority (shape 4 1 3)) 2)) 4 a +lemma CB4_1_3I2R4Raw_sound (a : Fin 6) : + (CB4_1_3I2R4Raw a).Encloses (CB4_1_3I2R4Value a) := by + exact residualBall_sound_on (below (shape 4 1 3)) B4_1_3Law (fun u => (stageBLaw (shape 4 1 3) u : ℝ)) (stageBPriority (shape 4 1 3)) 2 (fun u => B4_1_3Little u ((stageBPriority (shape 4 1 3)) 2)) (fun u a => (littleLaw (shape 4 1 3) u ((stageBPriority (shape 4 1 3)) 2) a : ℝ)) (fun u _ => B4_1_3Law_sound u) (fun u _ a => B4_1_3Little_sound u ((stageBPriority (shape 4 1 3)) 2) a) 4 a +def CB4_1_3I2R4Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB4_1_3I2R4Certificates_valid : + CB4_1_3I2R4Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB4_1_3I2R4CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB4_1_3I2R4P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB4_1_3I2R4Certificates (CB4_1_3I2R4CertificateIndex a)).input +lemma CB4_1_3I2R4P_check : ∀ a : Fin 6, contains (CB4_1_3I2R4Raw a) (CB4_1_3I2R4P a) = true := by + decide +kernel +lemma CB4_1_3I2R4P_sound (a : Fin 6) : + (CB4_1_3I2R4P a).Encloses (CB4_1_3I2R4Value a) := + contains_sound (CB4_1_3I2R4Raw_sound a) (CB4_1_3I2R4P_check a) +def CB4_1_3I2R4Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB4_1_3I2R4Certificates (CB4_1_3I2R4CertificateIndex a)).output +lemma CB4_1_3I2R4Terms_sound (a : Fin 6) : + (CB4_1_3I2R4Terms a).Encloses (Foundation.entropyTerm (CB4_1_3I2R4Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB4_1_3I2R4Certificates_valid + (CB4_1_3I2R4CertificateIndex a) (CB4_1_3I2R4P_sound a) +def CB4_1_3I2R4Entropy : Ball := ⟨0, 0⟩ +lemma CB4_1_3I2R4Entropy_sound : CB4_1_3I2R4Entropy.Encloses (Foundation.finiteEntropy CB4_1_3I2R4Value) := by + exact contains_sound (entropyFin_enclosed 6 CB4_1_3I2R4Value CB4_1_3I2R4Terms CB4_1_3I2R4Terms_sound) (by decide +kernel) +def CB4_1_3I2R4Mass : Ball := ⟨0, 0⟩ +lemma CB4_1_3I2R4Mass_sound : CB4_1_3I2R4Mass.Encloses (∑ a, CB4_1_3I2R4Value a) := by + exact contains_sound (finSumBall_sound 6 CB4_1_3I2R4P CB4_1_3I2R4Value CB4_1_3I2R4P_sound) (by decide +kernel) +def CB4_1_3I2R4MassTerm : Ball := .exact 0 +lemma CB4_1_3I2R4MassTerm_sound : CB4_1_3I2R4MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB4_1_3I2R4Value a))) := + entropyTerm_zero_ball (CB4_1_3I2R4Mass_sound) +def CB4_1_3I2R4H : Ball := ⟨0, 0⟩ +lemma CB4_1_3I2R4H_sound : CB4_1_3I2R4H.Encloses (homogeneousEntropy CB4_1_3I2R4Value) := by + exact contains_sound (homogeneous_enclosed CB4_1_3I2R4Value CB4_1_3I2R4MassTerm_sound CB4_1_3I2R4Entropy_sound) (by decide +kernel) +def CB4_1_3I2R5Value (a : Fin 6) : ℝ := residualLaw (below (shape 4 1 3)) (fun u => (stageBLaw (shape 4 1 3) u : ℝ)) (stageBPriority (shape 4 1 3)) 2 (fun u a => (littleLaw (shape 4 1 3) u ((stageBPriority (shape 4 1 3)) 2) a : ℝ)) 5 a +def CB4_1_3I2R5Raw (a : Fin 6) : Ball := residualBall (below (shape 4 1 3)) B4_1_3Law (stageBPriority (shape 4 1 3)) 2 (fun u => B4_1_3Little u ((stageBPriority (shape 4 1 3)) 2)) 5 a +lemma CB4_1_3I2R5Raw_sound (a : Fin 6) : + (CB4_1_3I2R5Raw a).Encloses (CB4_1_3I2R5Value a) := by + exact residualBall_sound_on (below (shape 4 1 3)) B4_1_3Law (fun u => (stageBLaw (shape 4 1 3) u : ℝ)) (stageBPriority (shape 4 1 3)) 2 (fun u => B4_1_3Little u ((stageBPriority (shape 4 1 3)) 2)) (fun u a => (littleLaw (shape 4 1 3) u ((stageBPriority (shape 4 1 3)) 2) a : ℝ)) (fun u _ => B4_1_3Law_sound u) (fun u _ a => B4_1_3Little_sound u ((stageBPriority (shape 4 1 3)) 2) a) 5 a +def CB4_1_3I2R5Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB4_1_3I2R5Certificates_valid : + CB4_1_3I2R5Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB4_1_3I2R5CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB4_1_3I2R5P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB4_1_3I2R5Certificates (CB4_1_3I2R5CertificateIndex a)).input +lemma CB4_1_3I2R5P_check : ∀ a : Fin 6, contains (CB4_1_3I2R5Raw a) (CB4_1_3I2R5P a) = true := by + decide +kernel +lemma CB4_1_3I2R5P_sound (a : Fin 6) : + (CB4_1_3I2R5P a).Encloses (CB4_1_3I2R5Value a) := + contains_sound (CB4_1_3I2R5Raw_sound a) (CB4_1_3I2R5P_check a) +def CB4_1_3I2R5Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB4_1_3I2R5Certificates (CB4_1_3I2R5CertificateIndex a)).output +lemma CB4_1_3I2R5Terms_sound (a : Fin 6) : + (CB4_1_3I2R5Terms a).Encloses (Foundation.entropyTerm (CB4_1_3I2R5Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB4_1_3I2R5Certificates_valid + (CB4_1_3I2R5CertificateIndex a) (CB4_1_3I2R5P_sound a) +def CB4_1_3I2R5Entropy : Ball := ⟨0, 0⟩ +lemma CB4_1_3I2R5Entropy_sound : CB4_1_3I2R5Entropy.Encloses (Foundation.finiteEntropy CB4_1_3I2R5Value) := by + exact contains_sound (entropyFin_enclosed 6 CB4_1_3I2R5Value CB4_1_3I2R5Terms CB4_1_3I2R5Terms_sound) (by decide +kernel) +def CB4_1_3I2R5Mass : Ball := ⟨0, 0⟩ +lemma CB4_1_3I2R5Mass_sound : CB4_1_3I2R5Mass.Encloses (∑ a, CB4_1_3I2R5Value a) := by + exact contains_sound (finSumBall_sound 6 CB4_1_3I2R5P CB4_1_3I2R5Value CB4_1_3I2R5P_sound) (by decide +kernel) +def CB4_1_3I2R5MassTerm : Ball := .exact 0 +lemma CB4_1_3I2R5MassTerm_sound : CB4_1_3I2R5MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB4_1_3I2R5Value a))) := + entropyTerm_zero_ball (CB4_1_3I2R5Mass_sound) +def CB4_1_3I2R5H : Ball := ⟨0, 0⟩ +lemma CB4_1_3I2R5H_sound : CB4_1_3I2R5H.Encloses (homogeneousEntropy CB4_1_3I2R5Value) := by + exact contains_sound (homogeneous_enclosed CB4_1_3I2R5Value CB4_1_3I2R5MassTerm_sound CB4_1_3I2R5Entropy_sound) (by decide +kernel) +def CB4_1_3I2R6Value (a : Fin 6) : ℝ := residualLaw (below (shape 4 1 3)) (fun u => (stageBLaw (shape 4 1 3) u : ℝ)) (stageBPriority (shape 4 1 3)) 2 (fun u a => (littleLaw (shape 4 1 3) u ((stageBPriority (shape 4 1 3)) 2) a : ℝ)) 6 a +def CB4_1_3I2R6Raw (a : Fin 6) : Ball := residualBall (below (shape 4 1 3)) B4_1_3Law (stageBPriority (shape 4 1 3)) 2 (fun u => B4_1_3Little u ((stageBPriority (shape 4 1 3)) 2)) 6 a +lemma CB4_1_3I2R6Raw_sound (a : Fin 6) : + (CB4_1_3I2R6Raw a).Encloses (CB4_1_3I2R6Value a) := by + exact residualBall_sound_on (below (shape 4 1 3)) B4_1_3Law (fun u => (stageBLaw (shape 4 1 3) u : ℝ)) (stageBPriority (shape 4 1 3)) 2 (fun u => B4_1_3Little u ((stageBPriority (shape 4 1 3)) 2)) (fun u a => (littleLaw (shape 4 1 3) u ((stageBPriority (shape 4 1 3)) 2) a : ℝ)) (fun u _ => B4_1_3Law_sound u) (fun u _ a => B4_1_3Little_sound u ((stageBPriority (shape 4 1 3)) 2) a) 6 a +def CB4_1_3I2R6Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB4_1_3I2R6Certificates_valid : + CB4_1_3I2R6Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB4_1_3I2R6CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB4_1_3I2R6P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB4_1_3I2R6Certificates (CB4_1_3I2R6CertificateIndex a)).input +lemma CB4_1_3I2R6P_check : ∀ a : Fin 6, contains (CB4_1_3I2R6Raw a) (CB4_1_3I2R6P a) = true := by + decide +kernel +lemma CB4_1_3I2R6P_sound (a : Fin 6) : + (CB4_1_3I2R6P a).Encloses (CB4_1_3I2R6Value a) := + contains_sound (CB4_1_3I2R6Raw_sound a) (CB4_1_3I2R6P_check a) +def CB4_1_3I2R6Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB4_1_3I2R6Certificates (CB4_1_3I2R6CertificateIndex a)).output +lemma CB4_1_3I2R6Terms_sound (a : Fin 6) : + (CB4_1_3I2R6Terms a).Encloses (Foundation.entropyTerm (CB4_1_3I2R6Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB4_1_3I2R6Certificates_valid + (CB4_1_3I2R6CertificateIndex a) (CB4_1_3I2R6P_sound a) +def CB4_1_3I2R6Entropy : Ball := ⟨0, 0⟩ +lemma CB4_1_3I2R6Entropy_sound : CB4_1_3I2R6Entropy.Encloses (Foundation.finiteEntropy CB4_1_3I2R6Value) := by + exact contains_sound (entropyFin_enclosed 6 CB4_1_3I2R6Value CB4_1_3I2R6Terms CB4_1_3I2R6Terms_sound) (by decide +kernel) +def CB4_1_3I2R6Mass : Ball := ⟨0, 0⟩ +lemma CB4_1_3I2R6Mass_sound : CB4_1_3I2R6Mass.Encloses (∑ a, CB4_1_3I2R6Value a) := by + exact contains_sound (finSumBall_sound 6 CB4_1_3I2R6P CB4_1_3I2R6Value CB4_1_3I2R6P_sound) (by decide +kernel) +def CB4_1_3I2R6MassTerm : Ball := .exact 0 +lemma CB4_1_3I2R6MassTerm_sound : CB4_1_3I2R6MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB4_1_3I2R6Value a))) := + entropyTerm_zero_ball (CB4_1_3I2R6Mass_sound) +def CB4_1_3I2R6H : Ball := ⟨0, 0⟩ +lemma CB4_1_3I2R6H_sound : CB4_1_3I2R6H.Encloses (homogeneousEntropy CB4_1_3I2R6Value) := by + exact contains_sound (homogeneous_enclosed CB4_1_3I2R6Value CB4_1_3I2R6MassTerm_sound CB4_1_3I2R6Entropy_sound) (by decide +kernel) +def CB4_1_3I2R7Value (a : Fin 6) : ℝ := residualLaw (below (shape 4 1 3)) (fun u => (stageBLaw (shape 4 1 3) u : ℝ)) (stageBPriority (shape 4 1 3)) 2 (fun u a => (littleLaw (shape 4 1 3) u ((stageBPriority (shape 4 1 3)) 2) a : ℝ)) 7 a +def CB4_1_3I2R7Raw (a : Fin 6) : Ball := residualBall (below (shape 4 1 3)) B4_1_3Law (stageBPriority (shape 4 1 3)) 2 (fun u => B4_1_3Little u ((stageBPriority (shape 4 1 3)) 2)) 7 a +lemma CB4_1_3I2R7Raw_sound (a : Fin 6) : + (CB4_1_3I2R7Raw a).Encloses (CB4_1_3I2R7Value a) := by + exact residualBall_sound_on (below (shape 4 1 3)) B4_1_3Law (fun u => (stageBLaw (shape 4 1 3) u : ℝ)) (stageBPriority (shape 4 1 3)) 2 (fun u => B4_1_3Little u ((stageBPriority (shape 4 1 3)) 2)) (fun u a => (littleLaw (shape 4 1 3) u ((stageBPriority (shape 4 1 3)) 2) a : ℝ)) (fun u _ => B4_1_3Law_sound u) (fun u _ a => B4_1_3Little_sound u ((stageBPriority (shape 4 1 3)) 2) a) 7 a +def CB4_1_3I2R7Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB4_1_3I2R7Certificates_valid : + CB4_1_3I2R7Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB4_1_3I2R7CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB4_1_3I2R7P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB4_1_3I2R7Certificates (CB4_1_3I2R7CertificateIndex a)).input +lemma CB4_1_3I2R7P_check : ∀ a : Fin 6, contains (CB4_1_3I2R7Raw a) (CB4_1_3I2R7P a) = true := by + decide +kernel +lemma CB4_1_3I2R7P_sound (a : Fin 6) : + (CB4_1_3I2R7P a).Encloses (CB4_1_3I2R7Value a) := + contains_sound (CB4_1_3I2R7Raw_sound a) (CB4_1_3I2R7P_check a) +def CB4_1_3I2R7Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB4_1_3I2R7Certificates (CB4_1_3I2R7CertificateIndex a)).output +lemma CB4_1_3I2R7Terms_sound (a : Fin 6) : + (CB4_1_3I2R7Terms a).Encloses (Foundation.entropyTerm (CB4_1_3I2R7Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB4_1_3I2R7Certificates_valid + (CB4_1_3I2R7CertificateIndex a) (CB4_1_3I2R7P_sound a) +def CB4_1_3I2R7Entropy : Ball := ⟨0, 0⟩ +lemma CB4_1_3I2R7Entropy_sound : CB4_1_3I2R7Entropy.Encloses (Foundation.finiteEntropy CB4_1_3I2R7Value) := by + exact contains_sound (entropyFin_enclosed 6 CB4_1_3I2R7Value CB4_1_3I2R7Terms CB4_1_3I2R7Terms_sound) (by decide +kernel) +def CB4_1_3I2R7Mass : Ball := ⟨0, 0⟩ +lemma CB4_1_3I2R7Mass_sound : CB4_1_3I2R7Mass.Encloses (∑ a, CB4_1_3I2R7Value a) := by + exact contains_sound (finSumBall_sound 6 CB4_1_3I2R7P CB4_1_3I2R7Value CB4_1_3I2R7P_sound) (by decide +kernel) +def CB4_1_3I2R7MassTerm : Ball := .exact 0 +lemma CB4_1_3I2R7MassTerm_sound : CB4_1_3I2R7MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB4_1_3I2R7Value a))) := + entropyTerm_zero_ball (CB4_1_3I2R7Mass_sound) +def CB4_1_3I2R7H : Ball := ⟨0, 0⟩ +lemma CB4_1_3I2R7H_sound : CB4_1_3I2R7H.Encloses (homogeneousEntropy CB4_1_3I2R7Value) := by + exact contains_sound (homogeneous_enclosed CB4_1_3I2R7Value CB4_1_3I2R7MassTerm_sound CB4_1_3I2R7Entropy_sound) (by decide +kernel) +def CB4_1_3I2R8Value (a : Fin 6) : ℝ := residualLaw (below (shape 4 1 3)) (fun u => (stageBLaw (shape 4 1 3) u : ℝ)) (stageBPriority (shape 4 1 3)) 2 (fun u a => (littleLaw (shape 4 1 3) u ((stageBPriority (shape 4 1 3)) 2) a : ℝ)) 8 a +def CB4_1_3I2R8Raw (a : Fin 6) : Ball := residualBall (below (shape 4 1 3)) B4_1_3Law (stageBPriority (shape 4 1 3)) 2 (fun u => B4_1_3Little u ((stageBPriority (shape 4 1 3)) 2)) 8 a +lemma CB4_1_3I2R8Raw_sound (a : Fin 6) : + (CB4_1_3I2R8Raw a).Encloses (CB4_1_3I2R8Value a) := by + exact residualBall_sound_on (below (shape 4 1 3)) B4_1_3Law (fun u => (stageBLaw (shape 4 1 3) u : ℝ)) (stageBPriority (shape 4 1 3)) 2 (fun u => B4_1_3Little u ((stageBPriority (shape 4 1 3)) 2)) (fun u a => (littleLaw (shape 4 1 3) u ((stageBPriority (shape 4 1 3)) 2) a : ℝ)) (fun u _ => B4_1_3Law_sound u) (fun u _ a => B4_1_3Little_sound u ((stageBPriority (shape 4 1 3)) 2) a) 8 a +def CB4_1_3I2R8Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB4_1_3I2R8Certificates_valid : + CB4_1_3I2R8Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB4_1_3I2R8CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB4_1_3I2R8P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB4_1_3I2R8Certificates (CB4_1_3I2R8CertificateIndex a)).input +lemma CB4_1_3I2R8P_check : ∀ a : Fin 6, contains (CB4_1_3I2R8Raw a) (CB4_1_3I2R8P a) = true := by + decide +kernel +lemma CB4_1_3I2R8P_sound (a : Fin 6) : + (CB4_1_3I2R8P a).Encloses (CB4_1_3I2R8Value a) := + contains_sound (CB4_1_3I2R8Raw_sound a) (CB4_1_3I2R8P_check a) +def CB4_1_3I2R8Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB4_1_3I2R8Certificates (CB4_1_3I2R8CertificateIndex a)).output +lemma CB4_1_3I2R8Terms_sound (a : Fin 6) : + (CB4_1_3I2R8Terms a).Encloses (Foundation.entropyTerm (CB4_1_3I2R8Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB4_1_3I2R8Certificates_valid + (CB4_1_3I2R8CertificateIndex a) (CB4_1_3I2R8P_sound a) +def CB4_1_3I2R8Entropy : Ball := ⟨0, 0⟩ +lemma CB4_1_3I2R8Entropy_sound : CB4_1_3I2R8Entropy.Encloses (Foundation.finiteEntropy CB4_1_3I2R8Value) := by + exact contains_sound (entropyFin_enclosed 6 CB4_1_3I2R8Value CB4_1_3I2R8Terms CB4_1_3I2R8Terms_sound) (by decide +kernel) +def CB4_1_3I2R8Mass : Ball := ⟨0, 0⟩ +lemma CB4_1_3I2R8Mass_sound : CB4_1_3I2R8Mass.Encloses (∑ a, CB4_1_3I2R8Value a) := by + exact contains_sound (finSumBall_sound 6 CB4_1_3I2R8P CB4_1_3I2R8Value CB4_1_3I2R8P_sound) (by decide +kernel) +def CB4_1_3I2R8MassTerm : Ball := .exact 0 +lemma CB4_1_3I2R8MassTerm_sound : CB4_1_3I2R8MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB4_1_3I2R8Value a))) := + entropyTerm_zero_ball (CB4_1_3I2R8Mass_sound) +def CB4_1_3I2R8H : Ball := ⟨0, 0⟩ +lemma CB4_1_3I2R8H_sound : CB4_1_3I2R8H.Encloses (homogeneousEntropy CB4_1_3I2R8Value) := by + exact contains_sound (homogeneous_enclosed CB4_1_3I2R8Value CB4_1_3I2R8MassTerm_sound CB4_1_3I2R8Entropy_sound) (by decide +kernel) +def CB4_1_3I2R9Value (a : Fin 6) : ℝ := residualLaw (below (shape 4 1 3)) (fun u => (stageBLaw (shape 4 1 3) u : ℝ)) (stageBPriority (shape 4 1 3)) 2 (fun u a => (littleLaw (shape 4 1 3) u ((stageBPriority (shape 4 1 3)) 2) a : ℝ)) 9 a +def CB4_1_3I2R9Raw (a : Fin 6) : Ball := residualBall (below (shape 4 1 3)) B4_1_3Law (stageBPriority (shape 4 1 3)) 2 (fun u => B4_1_3Little u ((stageBPriority (shape 4 1 3)) 2)) 9 a +lemma CB4_1_3I2R9Raw_sound (a : Fin 6) : + (CB4_1_3I2R9Raw a).Encloses (CB4_1_3I2R9Value a) := by + exact residualBall_sound_on (below (shape 4 1 3)) B4_1_3Law (fun u => (stageBLaw (shape 4 1 3) u : ℝ)) (stageBPriority (shape 4 1 3)) 2 (fun u => B4_1_3Little u ((stageBPriority (shape 4 1 3)) 2)) (fun u a => (littleLaw (shape 4 1 3) u ((stageBPriority (shape 4 1 3)) 2) a : ℝ)) (fun u _ => B4_1_3Law_sound u) (fun u _ a => B4_1_3Little_sound u ((stageBPriority (shape 4 1 3)) 2) a) 9 a +def CB4_1_3I2R9Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB4_1_3I2R9Certificates_valid : + CB4_1_3I2R9Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB4_1_3I2R9CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB4_1_3I2R9P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB4_1_3I2R9Certificates (CB4_1_3I2R9CertificateIndex a)).input +lemma CB4_1_3I2R9P_check : ∀ a : Fin 6, contains (CB4_1_3I2R9Raw a) (CB4_1_3I2R9P a) = true := by + decide +kernel +lemma CB4_1_3I2R9P_sound (a : Fin 6) : + (CB4_1_3I2R9P a).Encloses (CB4_1_3I2R9Value a) := + contains_sound (CB4_1_3I2R9Raw_sound a) (CB4_1_3I2R9P_check a) +def CB4_1_3I2R9Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB4_1_3I2R9Certificates (CB4_1_3I2R9CertificateIndex a)).output +lemma CB4_1_3I2R9Terms_sound (a : Fin 6) : + (CB4_1_3I2R9Terms a).Encloses (Foundation.entropyTerm (CB4_1_3I2R9Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB4_1_3I2R9Certificates_valid + (CB4_1_3I2R9CertificateIndex a) (CB4_1_3I2R9P_sound a) +def CB4_1_3I2R9Entropy : Ball := ⟨0, 0⟩ +lemma CB4_1_3I2R9Entropy_sound : CB4_1_3I2R9Entropy.Encloses (Foundation.finiteEntropy CB4_1_3I2R9Value) := by + exact contains_sound (entropyFin_enclosed 6 CB4_1_3I2R9Value CB4_1_3I2R9Terms CB4_1_3I2R9Terms_sound) (by decide +kernel) +def CB4_1_3I2R9Mass : Ball := ⟨0, 0⟩ +lemma CB4_1_3I2R9Mass_sound : CB4_1_3I2R9Mass.Encloses (∑ a, CB4_1_3I2R9Value a) := by + exact contains_sound (finSumBall_sound 6 CB4_1_3I2R9P CB4_1_3I2R9Value CB4_1_3I2R9P_sound) (by decide +kernel) +def CB4_1_3I2R9MassTerm : Ball := .exact 0 +lemma CB4_1_3I2R9MassTerm_sound : CB4_1_3I2R9MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB4_1_3I2R9Value a))) := + entropyTerm_zero_ball (CB4_1_3I2R9Mass_sound) +def CB4_1_3I2R9H : Ball := ⟨0, 0⟩ +lemma CB4_1_3I2R9H_sound : CB4_1_3I2R9H.Encloses (homogeneousEntropy CB4_1_3I2R9Value) := by + exact contains_sound (homogeneous_enclosed CB4_1_3I2R9Value CB4_1_3I2R9MassTerm_sound CB4_1_3I2R9Entropy_sound) (by decide +kernel) +def CB4_1_3I2R10Value (a : Fin 6) : ℝ := residualLaw (below (shape 4 1 3)) (fun u => (stageBLaw (shape 4 1 3) u : ℝ)) (stageBPriority (shape 4 1 3)) 2 (fun u a => (littleLaw (shape 4 1 3) u ((stageBPriority (shape 4 1 3)) 2) a : ℝ)) 10 a +def CB4_1_3I2R10Raw (a : Fin 6) : Ball := residualBall (below (shape 4 1 3)) B4_1_3Law (stageBPriority (shape 4 1 3)) 2 (fun u => B4_1_3Little u ((stageBPriority (shape 4 1 3)) 2)) 10 a +lemma CB4_1_3I2R10Raw_sound (a : Fin 6) : + (CB4_1_3I2R10Raw a).Encloses (CB4_1_3I2R10Value a) := by + exact residualBall_sound_on (below (shape 4 1 3)) B4_1_3Law (fun u => (stageBLaw (shape 4 1 3) u : ℝ)) (stageBPriority (shape 4 1 3)) 2 (fun u => B4_1_3Little u ((stageBPriority (shape 4 1 3)) 2)) (fun u a => (littleLaw (shape 4 1 3) u ((stageBPriority (shape 4 1 3)) 2) a : ℝ)) (fun u _ => B4_1_3Law_sound u) (fun u _ a => B4_1_3Little_sound u ((stageBPriority (shape 4 1 3)) 2) a) 10 a +def CB4_1_3I2R10Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB4_1_3I2R10Certificates_valid : + CB4_1_3I2R10Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB4_1_3I2R10CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB4_1_3I2R10P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB4_1_3I2R10Certificates (CB4_1_3I2R10CertificateIndex a)).input +lemma CB4_1_3I2R10P_check : ∀ a : Fin 6, contains (CB4_1_3I2R10Raw a) (CB4_1_3I2R10P a) = true := by + decide +kernel +lemma CB4_1_3I2R10P_sound (a : Fin 6) : + (CB4_1_3I2R10P a).Encloses (CB4_1_3I2R10Value a) := + contains_sound (CB4_1_3I2R10Raw_sound a) (CB4_1_3I2R10P_check a) +def CB4_1_3I2R10Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB4_1_3I2R10Certificates (CB4_1_3I2R10CertificateIndex a)).output +lemma CB4_1_3I2R10Terms_sound (a : Fin 6) : + (CB4_1_3I2R10Terms a).Encloses (Foundation.entropyTerm (CB4_1_3I2R10Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB4_1_3I2R10Certificates_valid + (CB4_1_3I2R10CertificateIndex a) (CB4_1_3I2R10P_sound a) +def CB4_1_3I2R10Entropy : Ball := ⟨0, 0⟩ +lemma CB4_1_3I2R10Entropy_sound : CB4_1_3I2R10Entropy.Encloses (Foundation.finiteEntropy CB4_1_3I2R10Value) := by + exact contains_sound (entropyFin_enclosed 6 CB4_1_3I2R10Value CB4_1_3I2R10Terms CB4_1_3I2R10Terms_sound) (by decide +kernel) +def CB4_1_3I2R10Mass : Ball := ⟨0, 0⟩ +lemma CB4_1_3I2R10Mass_sound : CB4_1_3I2R10Mass.Encloses (∑ a, CB4_1_3I2R10Value a) := by + exact contains_sound (finSumBall_sound 6 CB4_1_3I2R10P CB4_1_3I2R10Value CB4_1_3I2R10P_sound) (by decide +kernel) +def CB4_1_3I2R10MassTerm : Ball := .exact 0 +lemma CB4_1_3I2R10MassTerm_sound : CB4_1_3I2R10MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB4_1_3I2R10Value a))) := + entropyTerm_zero_ball (CB4_1_3I2R10Mass_sound) +def CB4_1_3I2R10H : Ball := ⟨0, 0⟩ +lemma CB4_1_3I2R10H_sound : CB4_1_3I2R10H.Encloses (homogeneousEntropy CB4_1_3I2R10Value) := by + exact contains_sound (homogeneous_enclosed CB4_1_3I2R10Value CB4_1_3I2R10MassTerm_sound CB4_1_3I2R10Entropy_sound) (by decide +kernel) +def CB4_1_3I2R11Value (a : Fin 6) : ℝ := residualLaw (below (shape 4 1 3)) (fun u => (stageBLaw (shape 4 1 3) u : ℝ)) (stageBPriority (shape 4 1 3)) 2 (fun u a => (littleLaw (shape 4 1 3) u ((stageBPriority (shape 4 1 3)) 2) a : ℝ)) 11 a +def CB4_1_3I2R11Raw (a : Fin 6) : Ball := residualBall (below (shape 4 1 3)) B4_1_3Law (stageBPriority (shape 4 1 3)) 2 (fun u => B4_1_3Little u ((stageBPriority (shape 4 1 3)) 2)) 11 a +lemma CB4_1_3I2R11Raw_sound (a : Fin 6) : + (CB4_1_3I2R11Raw a).Encloses (CB4_1_3I2R11Value a) := by + exact residualBall_sound_on (below (shape 4 1 3)) B4_1_3Law (fun u => (stageBLaw (shape 4 1 3) u : ℝ)) (stageBPriority (shape 4 1 3)) 2 (fun u => B4_1_3Little u ((stageBPriority (shape 4 1 3)) 2)) (fun u a => (littleLaw (shape 4 1 3) u ((stageBPriority (shape 4 1 3)) 2) a : ℝ)) (fun u _ => B4_1_3Law_sound u) (fun u _ a => B4_1_3Little_sound u ((stageBPriority (shape 4 1 3)) 2) a) 11 a +def CB4_1_3I2R11Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB4_1_3I2R11Certificates_valid : + CB4_1_3I2R11Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB4_1_3I2R11CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB4_1_3I2R11P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB4_1_3I2R11Certificates (CB4_1_3I2R11CertificateIndex a)).input +lemma CB4_1_3I2R11P_check : ∀ a : Fin 6, contains (CB4_1_3I2R11Raw a) (CB4_1_3I2R11P a) = true := by + decide +kernel +lemma CB4_1_3I2R11P_sound (a : Fin 6) : + (CB4_1_3I2R11P a).Encloses (CB4_1_3I2R11Value a) := + contains_sound (CB4_1_3I2R11Raw_sound a) (CB4_1_3I2R11P_check a) +def CB4_1_3I2R11Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB4_1_3I2R11Certificates (CB4_1_3I2R11CertificateIndex a)).output +lemma CB4_1_3I2R11Terms_sound (a : Fin 6) : + (CB4_1_3I2R11Terms a).Encloses (Foundation.entropyTerm (CB4_1_3I2R11Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB4_1_3I2R11Certificates_valid + (CB4_1_3I2R11CertificateIndex a) (CB4_1_3I2R11P_sound a) +def CB4_1_3I2R11Entropy : Ball := ⟨0, 0⟩ +lemma CB4_1_3I2R11Entropy_sound : CB4_1_3I2R11Entropy.Encloses (Foundation.finiteEntropy CB4_1_3I2R11Value) := by + exact contains_sound (entropyFin_enclosed 6 CB4_1_3I2R11Value CB4_1_3I2R11Terms CB4_1_3I2R11Terms_sound) (by decide +kernel) +def CB4_1_3I2R11Mass : Ball := ⟨0, 0⟩ +lemma CB4_1_3I2R11Mass_sound : CB4_1_3I2R11Mass.Encloses (∑ a, CB4_1_3I2R11Value a) := by + exact contains_sound (finSumBall_sound 6 CB4_1_3I2R11P CB4_1_3I2R11Value CB4_1_3I2R11P_sound) (by decide +kernel) +def CB4_1_3I2R11MassTerm : Ball := .exact 0 +lemma CB4_1_3I2R11MassTerm_sound : CB4_1_3I2R11MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB4_1_3I2R11Value a))) := + entropyTerm_zero_ball (CB4_1_3I2R11Mass_sound) +def CB4_1_3I2R11H : Ball := ⟨0, 0⟩ +lemma CB4_1_3I2R11H_sound : CB4_1_3I2R11H.Encloses (homogeneousEntropy CB4_1_3I2R11Value) := by + exact contains_sound (homogeneous_enclosed CB4_1_3I2R11Value CB4_1_3I2R11MassTerm_sound CB4_1_3I2R11Entropy_sound) (by decide +kernel) +def CB4_1_3I2R12Value (a : Fin 6) : ℝ := residualLaw (below (shape 4 1 3)) (fun u => (stageBLaw (shape 4 1 3) u : ℝ)) (stageBPriority (shape 4 1 3)) 2 (fun u a => (littleLaw (shape 4 1 3) u ((stageBPriority (shape 4 1 3)) 2) a : ℝ)) 12 a +def CB4_1_3I2R12Raw (a : Fin 6) : Ball := residualBall (below (shape 4 1 3)) B4_1_3Law (stageBPriority (shape 4 1 3)) 2 (fun u => B4_1_3Little u ((stageBPriority (shape 4 1 3)) 2)) 12 a +lemma CB4_1_3I2R12Raw_sound (a : Fin 6) : + (CB4_1_3I2R12Raw a).Encloses (CB4_1_3I2R12Value a) := by + exact residualBall_sound_on (below (shape 4 1 3)) B4_1_3Law (fun u => (stageBLaw (shape 4 1 3) u : ℝ)) (stageBPriority (shape 4 1 3)) 2 (fun u => B4_1_3Little u ((stageBPriority (shape 4 1 3)) 2)) (fun u a => (littleLaw (shape 4 1 3) u ((stageBPriority (shape 4 1 3)) 2) a : ℝ)) (fun u _ => B4_1_3Law_sound u) (fun u _ a => B4_1_3Little_sound u ((stageBPriority (shape 4 1 3)) 2) a) 12 a +def CB4_1_3I2R12Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB4_1_3I2R12Certificates_valid : + CB4_1_3I2R12Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB4_1_3I2R12CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB4_1_3I2R12P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB4_1_3I2R12Certificates (CB4_1_3I2R12CertificateIndex a)).input +lemma CB4_1_3I2R12P_check : ∀ a : Fin 6, contains (CB4_1_3I2R12Raw a) (CB4_1_3I2R12P a) = true := by + decide +kernel +lemma CB4_1_3I2R12P_sound (a : Fin 6) : + (CB4_1_3I2R12P a).Encloses (CB4_1_3I2R12Value a) := + contains_sound (CB4_1_3I2R12Raw_sound a) (CB4_1_3I2R12P_check a) +def CB4_1_3I2R12Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB4_1_3I2R12Certificates (CB4_1_3I2R12CertificateIndex a)).output +lemma CB4_1_3I2R12Terms_sound (a : Fin 6) : + (CB4_1_3I2R12Terms a).Encloses (Foundation.entropyTerm (CB4_1_3I2R12Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB4_1_3I2R12Certificates_valid + (CB4_1_3I2R12CertificateIndex a) (CB4_1_3I2R12P_sound a) +def CB4_1_3I2R12Entropy : Ball := ⟨0, 0⟩ +lemma CB4_1_3I2R12Entropy_sound : CB4_1_3I2R12Entropy.Encloses (Foundation.finiteEntropy CB4_1_3I2R12Value) := by + exact contains_sound (entropyFin_enclosed 6 CB4_1_3I2R12Value CB4_1_3I2R12Terms CB4_1_3I2R12Terms_sound) (by decide +kernel) +def CB4_1_3I2R12Mass : Ball := ⟨0, 0⟩ +lemma CB4_1_3I2R12Mass_sound : CB4_1_3I2R12Mass.Encloses (∑ a, CB4_1_3I2R12Value a) := by + exact contains_sound (finSumBall_sound 6 CB4_1_3I2R12P CB4_1_3I2R12Value CB4_1_3I2R12P_sound) (by decide +kernel) +def CB4_1_3I2R12MassTerm : Ball := .exact 0 +lemma CB4_1_3I2R12MassTerm_sound : CB4_1_3I2R12MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB4_1_3I2R12Value a))) := + entropyTerm_zero_ball (CB4_1_3I2R12Mass_sound) +def CB4_1_3I2R12H : Ball := ⟨0, 0⟩ +lemma CB4_1_3I2R12H_sound : CB4_1_3I2R12H.Encloses (homogeneousEntropy CB4_1_3I2R12Value) := by + exact contains_sound (homogeneous_enclosed CB4_1_3I2R12Value CB4_1_3I2R12MassTerm_sound CB4_1_3I2R12Entropy_sound) (by decide +kernel) +def CB4_1_3I2R13Value (a : Fin 6) : ℝ := residualLaw (below (shape 4 1 3)) (fun u => (stageBLaw (shape 4 1 3) u : ℝ)) (stageBPriority (shape 4 1 3)) 2 (fun u a => (littleLaw (shape 4 1 3) u ((stageBPriority (shape 4 1 3)) 2) a : ℝ)) 13 a +def CB4_1_3I2R13Raw (a : Fin 6) : Ball := residualBall (below (shape 4 1 3)) B4_1_3Law (stageBPriority (shape 4 1 3)) 2 (fun u => B4_1_3Little u ((stageBPriority (shape 4 1 3)) 2)) 13 a +lemma CB4_1_3I2R13Raw_sound (a : Fin 6) : + (CB4_1_3I2R13Raw a).Encloses (CB4_1_3I2R13Value a) := by + exact residualBall_sound_on (below (shape 4 1 3)) B4_1_3Law (fun u => (stageBLaw (shape 4 1 3) u : ℝ)) (stageBPriority (shape 4 1 3)) 2 (fun u => B4_1_3Little u ((stageBPriority (shape 4 1 3)) 2)) (fun u a => (littleLaw (shape 4 1 3) u ((stageBPriority (shape 4 1 3)) 2) a : ℝ)) (fun u _ => B4_1_3Law_sound u) (fun u _ a => B4_1_3Little_sound u ((stageBPriority (shape 4 1 3)) 2) a) 13 a +def CB4_1_3I2R13Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB4_1_3I2R13Certificates_valid : + CB4_1_3I2R13Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB4_1_3I2R13CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB4_1_3I2R13P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB4_1_3I2R13Certificates (CB4_1_3I2R13CertificateIndex a)).input +lemma CB4_1_3I2R13P_check : ∀ a : Fin 6, contains (CB4_1_3I2R13Raw a) (CB4_1_3I2R13P a) = true := by + decide +kernel +lemma CB4_1_3I2R13P_sound (a : Fin 6) : + (CB4_1_3I2R13P a).Encloses (CB4_1_3I2R13Value a) := + contains_sound (CB4_1_3I2R13Raw_sound a) (CB4_1_3I2R13P_check a) +def CB4_1_3I2R13Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB4_1_3I2R13Certificates (CB4_1_3I2R13CertificateIndex a)).output +lemma CB4_1_3I2R13Terms_sound (a : Fin 6) : + (CB4_1_3I2R13Terms a).Encloses (Foundation.entropyTerm (CB4_1_3I2R13Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB4_1_3I2R13Certificates_valid + (CB4_1_3I2R13CertificateIndex a) (CB4_1_3I2R13P_sound a) +def CB4_1_3I2R13Entropy : Ball := ⟨0, 0⟩ +lemma CB4_1_3I2R13Entropy_sound : CB4_1_3I2R13Entropy.Encloses (Foundation.finiteEntropy CB4_1_3I2R13Value) := by + exact contains_sound (entropyFin_enclosed 6 CB4_1_3I2R13Value CB4_1_3I2R13Terms CB4_1_3I2R13Terms_sound) (by decide +kernel) +def CB4_1_3I2R13Mass : Ball := ⟨0, 0⟩ +lemma CB4_1_3I2R13Mass_sound : CB4_1_3I2R13Mass.Encloses (∑ a, CB4_1_3I2R13Value a) := by + exact contains_sound (finSumBall_sound 6 CB4_1_3I2R13P CB4_1_3I2R13Value CB4_1_3I2R13P_sound) (by decide +kernel) +def CB4_1_3I2R13MassTerm : Ball := .exact 0 +lemma CB4_1_3I2R13MassTerm_sound : CB4_1_3I2R13MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB4_1_3I2R13Value a))) := + entropyTerm_zero_ball (CB4_1_3I2R13Mass_sound) +def CB4_1_3I2R13H : Ball := ⟨0, 0⟩ +lemma CB4_1_3I2R13H_sound : CB4_1_3I2R13H.Encloses (homogeneousEntropy CB4_1_3I2R13Value) := by + exact contains_sound (homogeneous_enclosed CB4_1_3I2R13Value CB4_1_3I2R13MassTerm_sound CB4_1_3I2R13Entropy_sound) (by decide +kernel) +def CB4_1_3I2R14Value (a : Fin 6) : ℝ := residualLaw (below (shape 4 1 3)) (fun u => (stageBLaw (shape 4 1 3) u : ℝ)) (stageBPriority (shape 4 1 3)) 2 (fun u a => (littleLaw (shape 4 1 3) u ((stageBPriority (shape 4 1 3)) 2) a : ℝ)) 14 a +def CB4_1_3I2R14Raw (a : Fin 6) : Ball := residualBall (below (shape 4 1 3)) B4_1_3Law (stageBPriority (shape 4 1 3)) 2 (fun u => B4_1_3Little u ((stageBPriority (shape 4 1 3)) 2)) 14 a +lemma CB4_1_3I2R14Raw_sound (a : Fin 6) : + (CB4_1_3I2R14Raw a).Encloses (CB4_1_3I2R14Value a) := by + exact residualBall_sound_on (below (shape 4 1 3)) B4_1_3Law (fun u => (stageBLaw (shape 4 1 3) u : ℝ)) (stageBPriority (shape 4 1 3)) 2 (fun u => B4_1_3Little u ((stageBPriority (shape 4 1 3)) 2)) (fun u a => (littleLaw (shape 4 1 3) u ((stageBPriority (shape 4 1 3)) 2) a : ℝ)) (fun u _ => B4_1_3Law_sound u) (fun u _ a => B4_1_3Little_sound u ((stageBPriority (shape 4 1 3)) 2) a) 14 a +def CB4_1_3I2R14Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB4_1_3I2R14Certificates_valid : + CB4_1_3I2R14Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB4_1_3I2R14CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB4_1_3I2R14P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB4_1_3I2R14Certificates (CB4_1_3I2R14CertificateIndex a)).input +lemma CB4_1_3I2R14P_check : ∀ a : Fin 6, contains (CB4_1_3I2R14Raw a) (CB4_1_3I2R14P a) = true := by + decide +kernel +lemma CB4_1_3I2R14P_sound (a : Fin 6) : + (CB4_1_3I2R14P a).Encloses (CB4_1_3I2R14Value a) := + contains_sound (CB4_1_3I2R14Raw_sound a) (CB4_1_3I2R14P_check a) +def CB4_1_3I2R14Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB4_1_3I2R14Certificates (CB4_1_3I2R14CertificateIndex a)).output +lemma CB4_1_3I2R14Terms_sound (a : Fin 6) : + (CB4_1_3I2R14Terms a).Encloses (Foundation.entropyTerm (CB4_1_3I2R14Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB4_1_3I2R14Certificates_valid + (CB4_1_3I2R14CertificateIndex a) (CB4_1_3I2R14P_sound a) +def CB4_1_3I2R14Entropy : Ball := ⟨0, 0⟩ +lemma CB4_1_3I2R14Entropy_sound : CB4_1_3I2R14Entropy.Encloses (Foundation.finiteEntropy CB4_1_3I2R14Value) := by + exact contains_sound (entropyFin_enclosed 6 CB4_1_3I2R14Value CB4_1_3I2R14Terms CB4_1_3I2R14Terms_sound) (by decide +kernel) +def CB4_1_3I2R14Mass : Ball := ⟨0, 0⟩ +lemma CB4_1_3I2R14Mass_sound : CB4_1_3I2R14Mass.Encloses (∑ a, CB4_1_3I2R14Value a) := by + exact contains_sound (finSumBall_sound 6 CB4_1_3I2R14P CB4_1_3I2R14Value CB4_1_3I2R14P_sound) (by decide +kernel) +def CB4_1_3I2R14MassTerm : Ball := .exact 0 +lemma CB4_1_3I2R14MassTerm_sound : CB4_1_3I2R14MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB4_1_3I2R14Value a))) := + entropyTerm_zero_ball (CB4_1_3I2R14Mass_sound) +def CB4_1_3I2R14H : Ball := ⟨0, 0⟩ +lemma CB4_1_3I2R14H_sound : CB4_1_3I2R14H.Encloses (homogeneousEntropy CB4_1_3I2R14Value) := by + exact contains_sound (homogeneous_enclosed CB4_1_3I2R14Value CB4_1_3I2R14MassTerm_sound CB4_1_3I2R14Entropy_sound) (by decide +kernel) +def CB4_1_3I2R15Value (a : Fin 6) : ℝ := residualLaw (below (shape 4 1 3)) (fun u => (stageBLaw (shape 4 1 3) u : ℝ)) (stageBPriority (shape 4 1 3)) 2 (fun u a => (littleLaw (shape 4 1 3) u ((stageBPriority (shape 4 1 3)) 2) a : ℝ)) 15 a +def CB4_1_3I2R15Raw (a : Fin 6) : Ball := residualBall (below (shape 4 1 3)) B4_1_3Law (stageBPriority (shape 4 1 3)) 2 (fun u => B4_1_3Little u ((stageBPriority (shape 4 1 3)) 2)) 15 a +lemma CB4_1_3I2R15Raw_sound (a : Fin 6) : + (CB4_1_3I2R15Raw a).Encloses (CB4_1_3I2R15Value a) := by + exact residualBall_sound_on (below (shape 4 1 3)) B4_1_3Law (fun u => (stageBLaw (shape 4 1 3) u : ℝ)) (stageBPriority (shape 4 1 3)) 2 (fun u => B4_1_3Little u ((stageBPriority (shape 4 1 3)) 2)) (fun u a => (littleLaw (shape 4 1 3) u ((stageBPriority (shape 4 1 3)) 2) a : ℝ)) (fun u _ => B4_1_3Law_sound u) (fun u _ a => B4_1_3Little_sound u ((stageBPriority (shape 4 1 3)) 2) a) 15 a +def CB4_1_3I2R15Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB4_1_3I2R15Certificates_valid : + CB4_1_3I2R15Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB4_1_3I2R15CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB4_1_3I2R15P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB4_1_3I2R15Certificates (CB4_1_3I2R15CertificateIndex a)).input +lemma CB4_1_3I2R15P_check : ∀ a : Fin 6, contains (CB4_1_3I2R15Raw a) (CB4_1_3I2R15P a) = true := by + decide +kernel +lemma CB4_1_3I2R15P_sound (a : Fin 6) : + (CB4_1_3I2R15P a).Encloses (CB4_1_3I2R15Value a) := + contains_sound (CB4_1_3I2R15Raw_sound a) (CB4_1_3I2R15P_check a) +def CB4_1_3I2R15Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB4_1_3I2R15Certificates (CB4_1_3I2R15CertificateIndex a)).output +lemma CB4_1_3I2R15Terms_sound (a : Fin 6) : + (CB4_1_3I2R15Terms a).Encloses (Foundation.entropyTerm (CB4_1_3I2R15Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB4_1_3I2R15Certificates_valid + (CB4_1_3I2R15CertificateIndex a) (CB4_1_3I2R15P_sound a) +def CB4_1_3I2R15Entropy : Ball := ⟨0, 0⟩ +lemma CB4_1_3I2R15Entropy_sound : CB4_1_3I2R15Entropy.Encloses (Foundation.finiteEntropy CB4_1_3I2R15Value) := by + exact contains_sound (entropyFin_enclosed 6 CB4_1_3I2R15Value CB4_1_3I2R15Terms CB4_1_3I2R15Terms_sound) (by decide +kernel) +def CB4_1_3I2R15Mass : Ball := ⟨0, 0⟩ +lemma CB4_1_3I2R15Mass_sound : CB4_1_3I2R15Mass.Encloses (∑ a, CB4_1_3I2R15Value a) := by + exact contains_sound (finSumBall_sound 6 CB4_1_3I2R15P CB4_1_3I2R15Value CB4_1_3I2R15P_sound) (by decide +kernel) +def CB4_1_3I2R15MassTerm : Ball := .exact 0 +lemma CB4_1_3I2R15MassTerm_sound : CB4_1_3I2R15MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB4_1_3I2R15Value a))) := + entropyTerm_zero_ball (CB4_1_3I2R15Mass_sound) +def CB4_1_3I2R15H : Ball := ⟨0, 0⟩ +lemma CB4_1_3I2R15H_sound : CB4_1_3I2R15H.Encloses (homogeneousEntropy CB4_1_3I2R15Value) := by + exact contains_sound (homogeneous_enclosed CB4_1_3I2R15Value CB4_1_3I2R15MassTerm_sound CB4_1_3I2R15Entropy_sound) (by decide +kernel) +def CB4_1_3I2R16Value (a : Fin 6) : ℝ := residualLaw (below (shape 4 1 3)) (fun u => (stageBLaw (shape 4 1 3) u : ℝ)) (stageBPriority (shape 4 1 3)) 2 (fun u a => (littleLaw (shape 4 1 3) u ((stageBPriority (shape 4 1 3)) 2) a : ℝ)) 16 a +def CB4_1_3I2R16Raw (a : Fin 6) : Ball := residualBall (below (shape 4 1 3)) B4_1_3Law (stageBPriority (shape 4 1 3)) 2 (fun u => B4_1_3Little u ((stageBPriority (shape 4 1 3)) 2)) 16 a +lemma CB4_1_3I2R16Raw_sound (a : Fin 6) : + (CB4_1_3I2R16Raw a).Encloses (CB4_1_3I2R16Value a) := by + exact residualBall_sound_on (below (shape 4 1 3)) B4_1_3Law (fun u => (stageBLaw (shape 4 1 3) u : ℝ)) (stageBPriority (shape 4 1 3)) 2 (fun u => B4_1_3Little u ((stageBPriority (shape 4 1 3)) 2)) (fun u a => (littleLaw (shape 4 1 3) u ((stageBPriority (shape 4 1 3)) 2) a : ℝ)) (fun u _ => B4_1_3Law_sound u) (fun u _ a => B4_1_3Little_sound u ((stageBPriority (shape 4 1 3)) 2) a) 16 a +def CB4_1_3I2R16Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB4_1_3I2R16Certificates_valid : + CB4_1_3I2R16Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB4_1_3I2R16CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB4_1_3I2R16P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB4_1_3I2R16Certificates (CB4_1_3I2R16CertificateIndex a)).input +lemma CB4_1_3I2R16P_check : ∀ a : Fin 6, contains (CB4_1_3I2R16Raw a) (CB4_1_3I2R16P a) = true := by + decide +kernel +lemma CB4_1_3I2R16P_sound (a : Fin 6) : + (CB4_1_3I2R16P a).Encloses (CB4_1_3I2R16Value a) := + contains_sound (CB4_1_3I2R16Raw_sound a) (CB4_1_3I2R16P_check a) +def CB4_1_3I2R16Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB4_1_3I2R16Certificates (CB4_1_3I2R16CertificateIndex a)).output +lemma CB4_1_3I2R16Terms_sound (a : Fin 6) : + (CB4_1_3I2R16Terms a).Encloses (Foundation.entropyTerm (CB4_1_3I2R16Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB4_1_3I2R16Certificates_valid + (CB4_1_3I2R16CertificateIndex a) (CB4_1_3I2R16P_sound a) +def CB4_1_3I2R16Entropy : Ball := ⟨0, 0⟩ +lemma CB4_1_3I2R16Entropy_sound : CB4_1_3I2R16Entropy.Encloses (Foundation.finiteEntropy CB4_1_3I2R16Value) := by + exact contains_sound (entropyFin_enclosed 6 CB4_1_3I2R16Value CB4_1_3I2R16Terms CB4_1_3I2R16Terms_sound) (by decide +kernel) +def CB4_1_3I2R16Mass : Ball := ⟨0, 0⟩ +lemma CB4_1_3I2R16Mass_sound : CB4_1_3I2R16Mass.Encloses (∑ a, CB4_1_3I2R16Value a) := by + exact contains_sound (finSumBall_sound 6 CB4_1_3I2R16P CB4_1_3I2R16Value CB4_1_3I2R16P_sound) (by decide +kernel) +def CB4_1_3I2R16MassTerm : Ball := .exact 0 +lemma CB4_1_3I2R16MassTerm_sound : CB4_1_3I2R16MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB4_1_3I2R16Value a))) := + entropyTerm_zero_ball (CB4_1_3I2R16Mass_sound) +def CB4_1_3I2R16H : Ball := ⟨0, 0⟩ +lemma CB4_1_3I2R16H_sound : CB4_1_3I2R16H.Encloses (homogeneousEntropy CB4_1_3I2R16Value) := by + exact contains_sound (homogeneous_enclosed CB4_1_3I2R16Value CB4_1_3I2R16MassTerm_sound CB4_1_3I2R16Entropy_sound) (by decide +kernel) +def CB4_1_3I2ResidualEntropies (a : Fin 17) : Ball := + match a.val with + | 0 => CB4_1_3I2R0H + | 1 => CB4_1_3I2R1H + | 2 => CB4_1_3I2R2H + | 3 => CB4_1_3I2R3H + | 4 => CB4_1_3I2R4H + | 5 => CB4_1_3I2R5H + | 6 => CB4_1_3I2R6H + | 7 => CB4_1_3I2R7H + | 8 => CB4_1_3I2R8H + | 9 => CB4_1_3I2R9H + | 10 => CB4_1_3I2R10H + | 11 => CB4_1_3I2R11H + | 12 => CB4_1_3I2R12H + | 13 => CB4_1_3I2R13H + | 14 => CB4_1_3I2R14H + | 15 => CB4_1_3I2R15H + | 16 => CB4_1_3I2R16H + | _ => (.exact 0) +lemma CB4_1_3I2ResidualEntropies_sound (k : Fin 17) : + (CB4_1_3I2ResidualEntropies k).Encloses (homogeneousEntropy + (residualLaw (below (shape 4 1 3)) (fun u => (stageBLaw (shape 4 1 3) u : ℝ)) (stageBPriority (shape 4 1 3)) 2 (fun u a => (littleLaw (shape 4 1 3) u ((stageBPriority (shape 4 1 3)) 2) a : ℝ)) k)) := by + fin_cases k + · exact CB4_1_3I2R0H_sound + · exact CB4_1_3I2R1H_sound + · exact CB4_1_3I2R2H_sound + · exact CB4_1_3I2R3H_sound + · exact CB4_1_3I2R4H_sound + · exact CB4_1_3I2R5H_sound + · exact CB4_1_3I2R6H_sound + · exact CB4_1_3I2R7H_sound + · exact CB4_1_3I2R8H_sound + · exact CB4_1_3I2R9H_sound + · exact CB4_1_3I2R10H_sound + · exact CB4_1_3I2R11H_sound + · exact CB4_1_3I2R12H_sound + · exact CB4_1_3I2R13H_sound + · exact CB4_1_3I2R14H_sound + · exact CB4_1_3I2R15H_sound + · exact CB4_1_3I2R16H_sound +def CB4_1_3I2S1_0_3Value (a : Fin 6) : ℝ := (littleLaw (shape 4 1 3) (shape 1 0 3) ((stageBPriority (shape 4 1 3)) 2) a : ℝ) +def CB4_1_3I2S1_0_3E_1Log : Ball := .exact 0 +lemma CB4_1_3I2S1_0_3E_1Log_sound : CB4_1_3I2S1_0_3E_1Log.Encloses (Real.log (CB4_1_3I2S1_0_3Value (1 : Fin 6))) := by + exact log_exact_one_ball ((B4_1_3Little_sound (shape 1 0 3) ((stageBPriority (shape 4 1 3)) 2)) (1 : Fin 6)) +def CB4_1_3I2S1_0_3E_1 : Ball := ⟨0, 0⟩ +lemma CB4_1_3I2S1_0_3E_1_sound : CB4_1_3I2S1_0_3E_1.Encloses (Foundation.entropyTerm (CB4_1_3I2S1_0_3Value (1 : Fin 6))) := by + exact contains_sound (entropyTerm_ball ((B4_1_3Little_sound (shape 1 0 3) ((stageBPriority (shape 4 1 3)) 2)) (1 : Fin 6)) CB4_1_3I2S1_0_3E_1Log_sound) (by decide +kernel) +def CB4_1_3I2S1_0_3Terms (a : Fin 6) : Ball := + match a.val with + | 1 => ⟨0, 0⟩ + | _ => (.exact 0) +lemma CB4_1_3I2S1_0_3Terms_sound (a : Fin 6) : + (CB4_1_3I2S1_0_3Terms a).Encloses (Foundation.entropyTerm (CB4_1_3I2S1_0_3Value a)) := by + fin_cases a + · exact (entropyTerm_zero_ball ((B4_1_3Little_sound (shape 1 0 3) ((stageBPriority (shape 4 1 3)) 2)) (0 : Fin 6))) + · exact CB4_1_3I2S1_0_3E_1_sound + · exact (entropyTerm_zero_ball ((B4_1_3Little_sound (shape 1 0 3) ((stageBPriority (shape 4 1 3)) 2)) (2 : Fin 6))) + · exact (entropyTerm_zero_ball ((B4_1_3Little_sound (shape 1 0 3) ((stageBPriority (shape 4 1 3)) 2)) (3 : Fin 6))) + · exact (entropyTerm_zero_ball ((B4_1_3Little_sound (shape 1 0 3) ((stageBPriority (shape 4 1 3)) 2)) (4 : Fin 6))) + · exact (entropyTerm_zero_ball ((B4_1_3Little_sound (shape 1 0 3) ((stageBPriority (shape 4 1 3)) 2)) (5 : Fin 6))) +def CB4_1_3I2S1_0_3Entropy : Ball := ⟨0, 0⟩ +lemma CB4_1_3I2S1_0_3Entropy_sound : CB4_1_3I2S1_0_3Entropy.Encloses (Foundation.finiteEntropy CB4_1_3I2S1_0_3Value) := by + exact contains_sound (entropyFin_enclosed 6 CB4_1_3I2S1_0_3Value CB4_1_3I2S1_0_3Terms CB4_1_3I2S1_0_3Terms_sound) (by decide +kernel) +def CB4_1_3I2S1_0_3Mass : Ball := ⟨1, 0⟩ +lemma CB4_1_3I2S1_0_3Mass_sound : CB4_1_3I2S1_0_3Mass.Encloses (∑ a, CB4_1_3I2S1_0_3Value a) := by + exact contains_sound (finSumBall_sound 6 (B4_1_3Little (shape 1 0 3) ((stageBPriority (shape 4 1 3)) 2)) CB4_1_3I2S1_0_3Value (B4_1_3Little_sound (shape 1 0 3) ((stageBPriority (shape 4 1 3)) 2))) (by decide +kernel) +def CB4_1_3I2S1_0_3MassTermLog : Ball := .exact 0 +lemma CB4_1_3I2S1_0_3MassTermLog_sound : CB4_1_3I2S1_0_3MassTermLog.Encloses (Real.log ((∑ a, CB4_1_3I2S1_0_3Value a))) := by + exact log_exact_one_ball (CB4_1_3I2S1_0_3Mass_sound) +def CB4_1_3I2S1_0_3MassTerm : Ball := ⟨0, 0⟩ +lemma CB4_1_3I2S1_0_3MassTerm_sound : CB4_1_3I2S1_0_3MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB4_1_3I2S1_0_3Value a))) := by + exact contains_sound (entropyTerm_ball (CB4_1_3I2S1_0_3Mass_sound) CB4_1_3I2S1_0_3MassTermLog_sound) (by decide +kernel) +def CB4_1_3I2S1_0_3H : Ball := ⟨0, 0⟩ +lemma CB4_1_3I2S1_0_3H_sound : CB4_1_3I2S1_0_3H.Encloses (homogeneousEntropy CB4_1_3I2S1_0_3Value) := by + exact contains_sound (homogeneous_enclosed CB4_1_3I2S1_0_3Value CB4_1_3I2S1_0_3MassTerm_sound CB4_1_3I2S1_0_3Entropy_sound) (by decide +kernel) +def CB4_1_3I2S2_0_2Value (a : Fin 6) : ℝ := (littleLaw (shape 4 1 3) (shape 2 0 2) ((stageBPriority (shape 4 1 3)) 2) a : ℝ) +def CB4_1_3I2S2_0_2E_2LogWitness : LogWitness := ⟨-1, 904277, 500000⟩ +def CB4_1_3I2S2_0_2E_2Log : Ball := ⟨(-10061954959653018265030300181801 / 100000000000000000000000000000000), (21175823683 / 50000000000000000000000000000000)⟩ +lemma CB4_1_3I2S2_0_2E_2Log_sound : CB4_1_3I2S2_0_2E_2Log.Encloses (Real.log (CB4_1_3I2S2_0_2Value (2 : Fin 6))) := by + exact checkLog_sound logTwoBall_sound ((B4_1_3Little_sound (shape 2 0 2) ((stageBPriority (shape 4 1 3)) 2)) (2 : Fin 6)) (w := CB4_1_3I2S2_0_2E_2LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB4_1_3I2S2_0_2E_2 : Ball := ⟨(4549397222525076198823402378749 / 50000000000000000000000000000000), (19148810313 / 50000000000000000000000000000000)⟩ +lemma CB4_1_3I2S2_0_2E_2_sound : CB4_1_3I2S2_0_2E_2.Encloses (Foundation.entropyTerm (CB4_1_3I2S2_0_2Value (2 : Fin 6))) := by + exact contains_sound (entropyTerm_ball ((B4_1_3Little_sound (shape 2 0 2) ((stageBPriority (shape 4 1 3)) 2)) (2 : Fin 6)) CB4_1_3I2S2_0_2E_2Log_sound) (by decide +kernel) +def CB4_1_3I2S2_0_2E_3LogWitness : LogWitness := ⟨-4, 95723, 62500⟩ +def CB4_1_3I2S2_0_2E_3Log : Ball := ⟨(-234629667502064329567169639454029 / 100000000000000000000000000000000), (21175823683 / 20000000000000000000000000000000)⟩ +lemma CB4_1_3I2S2_0_2E_3Log_sound : CB4_1_3I2S2_0_2E_3Log.Encloses (Real.log (CB4_1_3I2S2_0_2Value (3 : Fin 6))) := by + exact checkLog_sound logTwoBall_sound ((B4_1_3Little_sound (shape 2 0 2) ((stageBPriority (shape 4 1 3)) 2)) (3 : Fin 6)) (w := CB4_1_3I2S2_0_2E_3LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB4_1_3I2S2_0_2E_3 : Ball := ⟨(11229727831150051909579089698729 / 50000000000000000000000000000000), (10135066853 / 100000000000000000000000000000000)⟩ +lemma CB4_1_3I2S2_0_2E_3_sound : CB4_1_3I2S2_0_2E_3.Encloses (Foundation.entropyTerm (CB4_1_3I2S2_0_2Value (3 : Fin 6))) := by + exact contains_sound (entropyTerm_ball ((B4_1_3Little_sound (shape 2 0 2) ((stageBPriority (shape 4 1 3)) 2)) (3 : Fin 6)) CB4_1_3I2S2_0_2E_3Log_sound) (by decide +kernel) +def CB4_1_3I2S2_0_2Terms (a : Fin 6) : Ball := + match a.val with + | 2 => ⟨(4549397222525076198823402378749 / 50000000000000000000000000000000), (19148810313 / 50000000000000000000000000000000)⟩ + | 3 => ⟨(11229727831150051909579089698729 / 50000000000000000000000000000000), (10135066853 / 100000000000000000000000000000000)⟩ + | _ => (.exact 0) +lemma CB4_1_3I2S2_0_2Terms_sound (a : Fin 6) : + (CB4_1_3I2S2_0_2Terms a).Encloses (Foundation.entropyTerm (CB4_1_3I2S2_0_2Value a)) := by + fin_cases a + · exact (entropyTerm_zero_ball ((B4_1_3Little_sound (shape 2 0 2) ((stageBPriority (shape 4 1 3)) 2)) (0 : Fin 6))) + · exact (entropyTerm_zero_ball ((B4_1_3Little_sound (shape 2 0 2) ((stageBPriority (shape 4 1 3)) 2)) (1 : Fin 6))) + · exact CB4_1_3I2S2_0_2E_2_sound + · exact CB4_1_3I2S2_0_2E_3_sound + · exact (entropyTerm_zero_ball ((B4_1_3Little_sound (shape 2 0 2) ((stageBPriority (shape 4 1 3)) 2)) (4 : Fin 6))) + · exact (entropyTerm_zero_ball ((B4_1_3Little_sound (shape 2 0 2) ((stageBPriority (shape 4 1 3)) 2)) (5 : Fin 6))) +def CB4_1_3I2S2_0_2Entropy : Ball := ⟨(7889562526837564054201246038739 / 25000000000000000000000000000000), (48432687479 / 100000000000000000000000000000000)⟩ +lemma CB4_1_3I2S2_0_2Entropy_sound : CB4_1_3I2S2_0_2Entropy.Encloses (Foundation.finiteEntropy CB4_1_3I2S2_0_2Value) := by + exact contains_sound (entropyFin_enclosed 6 CB4_1_3I2S2_0_2Value CB4_1_3I2S2_0_2Terms CB4_1_3I2S2_0_2Terms_sound) (by decide +kernel) +def CB4_1_3I2S2_0_2Mass : Ball := ⟨1, 0⟩ +lemma CB4_1_3I2S2_0_2Mass_sound : CB4_1_3I2S2_0_2Mass.Encloses (∑ a, CB4_1_3I2S2_0_2Value a) := by + exact contains_sound (finSumBall_sound 6 (B4_1_3Little (shape 2 0 2) ((stageBPriority (shape 4 1 3)) 2)) CB4_1_3I2S2_0_2Value (B4_1_3Little_sound (shape 2 0 2) ((stageBPriority (shape 4 1 3)) 2))) (by decide +kernel) +def CB4_1_3I2S2_0_2MassTermLog : Ball := .exact 0 +lemma CB4_1_3I2S2_0_2MassTermLog_sound : CB4_1_3I2S2_0_2MassTermLog.Encloses (Real.log ((∑ a, CB4_1_3I2S2_0_2Value a))) := by + exact log_exact_one_ball (CB4_1_3I2S2_0_2Mass_sound) +def CB4_1_3I2S2_0_2MassTerm : Ball := ⟨0, 0⟩ +lemma CB4_1_3I2S2_0_2MassTerm_sound : CB4_1_3I2S2_0_2MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB4_1_3I2S2_0_2Value a))) := by + exact contains_sound (entropyTerm_ball (CB4_1_3I2S2_0_2Mass_sound) CB4_1_3I2S2_0_2MassTermLog_sound) (by decide +kernel) +def CB4_1_3I2S2_0_2H : Ball := ⟨(7889562526837564054201246038739 / 25000000000000000000000000000000), (48432687479 / 100000000000000000000000000000000)⟩ +lemma CB4_1_3I2S2_0_2H_sound : CB4_1_3I2S2_0_2H.Encloses (homogeneousEntropy CB4_1_3I2S2_0_2Value) := by + exact contains_sound (homogeneous_enclosed CB4_1_3I2S2_0_2Value CB4_1_3I2S2_0_2MassTerm_sound CB4_1_3I2S2_0_2Entropy_sound) (by decide +kernel) +def CB4_1_3I2S3_0_1Value (a : Fin 6) : ℝ := (littleLaw (shape 4 1 3) (shape 3 0 1) ((stageBPriority (shape 4 1 3)) 2) a : ℝ) +def CB4_1_3I2S3_0_1E_4Log : Ball := .exact 0 +lemma CB4_1_3I2S3_0_1E_4Log_sound : CB4_1_3I2S3_0_1E_4Log.Encloses (Real.log (CB4_1_3I2S3_0_1Value (4 : Fin 6))) := by + exact log_exact_one_ball ((B4_1_3Little_sound (shape 3 0 1) ((stageBPriority (shape 4 1 3)) 2)) (4 : Fin 6)) +def CB4_1_3I2S3_0_1E_4 : Ball := ⟨0, 0⟩ +lemma CB4_1_3I2S3_0_1E_4_sound : CB4_1_3I2S3_0_1E_4.Encloses (Foundation.entropyTerm (CB4_1_3I2S3_0_1Value (4 : Fin 6))) := by + exact contains_sound (entropyTerm_ball ((B4_1_3Little_sound (shape 3 0 1) ((stageBPriority (shape 4 1 3)) 2)) (4 : Fin 6)) CB4_1_3I2S3_0_1E_4Log_sound) (by decide +kernel) +def CB4_1_3I2S3_0_1Terms (a : Fin 6) : Ball := + match a.val with + | 4 => ⟨0, 0⟩ + | _ => (.exact 0) +lemma CB4_1_3I2S3_0_1Terms_sound (a : Fin 6) : + (CB4_1_3I2S3_0_1Terms a).Encloses (Foundation.entropyTerm (CB4_1_3I2S3_0_1Value a)) := by + fin_cases a + · exact (entropyTerm_zero_ball ((B4_1_3Little_sound (shape 3 0 1) ((stageBPriority (shape 4 1 3)) 2)) (0 : Fin 6))) + · exact (entropyTerm_zero_ball ((B4_1_3Little_sound (shape 3 0 1) ((stageBPriority (shape 4 1 3)) 2)) (1 : Fin 6))) + · exact (entropyTerm_zero_ball ((B4_1_3Little_sound (shape 3 0 1) ((stageBPriority (shape 4 1 3)) 2)) (2 : Fin 6))) + · exact (entropyTerm_zero_ball ((B4_1_3Little_sound (shape 3 0 1) ((stageBPriority (shape 4 1 3)) 2)) (3 : Fin 6))) + · exact CB4_1_3I2S3_0_1E_4_sound + · exact (entropyTerm_zero_ball ((B4_1_3Little_sound (shape 3 0 1) ((stageBPriority (shape 4 1 3)) 2)) (5 : Fin 6))) +def CB4_1_3I2S3_0_1Entropy : Ball := ⟨0, 0⟩ +lemma CB4_1_3I2S3_0_1Entropy_sound : CB4_1_3I2S3_0_1Entropy.Encloses (Foundation.finiteEntropy CB4_1_3I2S3_0_1Value) := by + exact contains_sound (entropyFin_enclosed 6 CB4_1_3I2S3_0_1Value CB4_1_3I2S3_0_1Terms CB4_1_3I2S3_0_1Terms_sound) (by decide +kernel) +def CB4_1_3I2S3_0_1Mass : Ball := ⟨1, 0⟩ +lemma CB4_1_3I2S3_0_1Mass_sound : CB4_1_3I2S3_0_1Mass.Encloses (∑ a, CB4_1_3I2S3_0_1Value a) := by + exact contains_sound (finSumBall_sound 6 (B4_1_3Little (shape 3 0 1) ((stageBPriority (shape 4 1 3)) 2)) CB4_1_3I2S3_0_1Value (B4_1_3Little_sound (shape 3 0 1) ((stageBPriority (shape 4 1 3)) 2))) (by decide +kernel) +def CB4_1_3I2S3_0_1MassTermLog : Ball := .exact 0 +lemma CB4_1_3I2S3_0_1MassTermLog_sound : CB4_1_3I2S3_0_1MassTermLog.Encloses (Real.log ((∑ a, CB4_1_3I2S3_0_1Value a))) := by + exact log_exact_one_ball (CB4_1_3I2S3_0_1Mass_sound) +def CB4_1_3I2S3_0_1MassTerm : Ball := ⟨0, 0⟩ +lemma CB4_1_3I2S3_0_1MassTerm_sound : CB4_1_3I2S3_0_1MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB4_1_3I2S3_0_1Value a))) := by + exact contains_sound (entropyTerm_ball (CB4_1_3I2S3_0_1Mass_sound) CB4_1_3I2S3_0_1MassTermLog_sound) (by decide +kernel) +def CB4_1_3I2S3_0_1H : Ball := ⟨0, 0⟩ +lemma CB4_1_3I2S3_0_1H_sound : CB4_1_3I2S3_0_1H.Encloses (homogeneousEntropy CB4_1_3I2S3_0_1Value) := by + exact contains_sound (homogeneous_enclosed CB4_1_3I2S3_0_1Value CB4_1_3I2S3_0_1MassTerm_sound CB4_1_3I2S3_0_1Entropy_sound) (by decide +kernel) +def CB4_1_3I2S3_1_0Value (a : Fin 6) : ℝ := (littleLaw (shape 4 1 3) (shape 3 1 0) ((stageBPriority (shape 4 1 3)) 2) a : ℝ) +def CB4_1_3I2S3_1_0E_4Log : Ball := .exact 0 +lemma CB4_1_3I2S3_1_0E_4Log_sound : CB4_1_3I2S3_1_0E_4Log.Encloses (Real.log (CB4_1_3I2S3_1_0Value (4 : Fin 6))) := by + exact log_exact_one_ball ((B4_1_3Little_sound (shape 3 1 0) ((stageBPriority (shape 4 1 3)) 2)) (4 : Fin 6)) +def CB4_1_3I2S3_1_0E_4 : Ball := ⟨0, 0⟩ +lemma CB4_1_3I2S3_1_0E_4_sound : CB4_1_3I2S3_1_0E_4.Encloses (Foundation.entropyTerm (CB4_1_3I2S3_1_0Value (4 : Fin 6))) := by + exact contains_sound (entropyTerm_ball ((B4_1_3Little_sound (shape 3 1 0) ((stageBPriority (shape 4 1 3)) 2)) (4 : Fin 6)) CB4_1_3I2S3_1_0E_4Log_sound) (by decide +kernel) +def CB4_1_3I2S3_1_0Terms (a : Fin 6) : Ball := + match a.val with + | 4 => ⟨0, 0⟩ + | _ => (.exact 0) +lemma CB4_1_3I2S3_1_0Terms_sound (a : Fin 6) : + (CB4_1_3I2S3_1_0Terms a).Encloses (Foundation.entropyTerm (CB4_1_3I2S3_1_0Value a)) := by + fin_cases a + · exact (entropyTerm_zero_ball ((B4_1_3Little_sound (shape 3 1 0) ((stageBPriority (shape 4 1 3)) 2)) (0 : Fin 6))) + · exact (entropyTerm_zero_ball ((B4_1_3Little_sound (shape 3 1 0) ((stageBPriority (shape 4 1 3)) 2)) (1 : Fin 6))) + · exact (entropyTerm_zero_ball ((B4_1_3Little_sound (shape 3 1 0) ((stageBPriority (shape 4 1 3)) 2)) (2 : Fin 6))) + · exact (entropyTerm_zero_ball ((B4_1_3Little_sound (shape 3 1 0) ((stageBPriority (shape 4 1 3)) 2)) (3 : Fin 6))) + · exact CB4_1_3I2S3_1_0E_4_sound + · exact (entropyTerm_zero_ball ((B4_1_3Little_sound (shape 3 1 0) ((stageBPriority (shape 4 1 3)) 2)) (5 : Fin 6))) +def CB4_1_3I2S3_1_0Entropy : Ball := ⟨0, 0⟩ +lemma CB4_1_3I2S3_1_0Entropy_sound : CB4_1_3I2S3_1_0Entropy.Encloses (Foundation.finiteEntropy CB4_1_3I2S3_1_0Value) := by + exact contains_sound (entropyFin_enclosed 6 CB4_1_3I2S3_1_0Value CB4_1_3I2S3_1_0Terms CB4_1_3I2S3_1_0Terms_sound) (by decide +kernel) +def CB4_1_3I2S3_1_0Mass : Ball := ⟨1, 0⟩ +lemma CB4_1_3I2S3_1_0Mass_sound : CB4_1_3I2S3_1_0Mass.Encloses (∑ a, CB4_1_3I2S3_1_0Value a) := by + exact contains_sound (finSumBall_sound 6 (B4_1_3Little (shape 3 1 0) ((stageBPriority (shape 4 1 3)) 2)) CB4_1_3I2S3_1_0Value (B4_1_3Little_sound (shape 3 1 0) ((stageBPriority (shape 4 1 3)) 2))) (by decide +kernel) +def CB4_1_3I2S3_1_0MassTermLog : Ball := .exact 0 +lemma CB4_1_3I2S3_1_0MassTermLog_sound : CB4_1_3I2S3_1_0MassTermLog.Encloses (Real.log ((∑ a, CB4_1_3I2S3_1_0Value a))) := by + exact log_exact_one_ball (CB4_1_3I2S3_1_0Mass_sound) +def CB4_1_3I2S3_1_0MassTerm : Ball := ⟨0, 0⟩ +lemma CB4_1_3I2S3_1_0MassTerm_sound : CB4_1_3I2S3_1_0MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB4_1_3I2S3_1_0Value a))) := by + exact contains_sound (entropyTerm_ball (CB4_1_3I2S3_1_0Mass_sound) CB4_1_3I2S3_1_0MassTermLog_sound) (by decide +kernel) +def CB4_1_3I2S3_1_0H : Ball := ⟨0, 0⟩ +lemma CB4_1_3I2S3_1_0H_sound : CB4_1_3I2S3_1_0H.Encloses (homogeneousEntropy CB4_1_3I2S3_1_0Value) := by + exact contains_sound (homogeneous_enclosed CB4_1_3I2S3_1_0Value CB4_1_3I2S3_1_0MassTerm_sound CB4_1_3I2S3_1_0Entropy_sound) (by decide +kernel) +def CB4_1_3I2S4_0_0Value (a : Fin 6) : ℝ := (littleLaw (shape 4 1 3) (shape 4 0 0) ((stageBPriority (shape 4 1 3)) 2) a : ℝ) +def CB4_1_3I2S4_0_0E_5Log : Ball := .exact 0 +lemma CB4_1_3I2S4_0_0E_5Log_sound : CB4_1_3I2S4_0_0E_5Log.Encloses (Real.log (CB4_1_3I2S4_0_0Value (5 : Fin 6))) := by + exact log_exact_one_ball ((B4_1_3Little_sound (shape 4 0 0) ((stageBPriority (shape 4 1 3)) 2)) (5 : Fin 6)) +def CB4_1_3I2S4_0_0E_5 : Ball := ⟨0, 0⟩ +lemma CB4_1_3I2S4_0_0E_5_sound : CB4_1_3I2S4_0_0E_5.Encloses (Foundation.entropyTerm (CB4_1_3I2S4_0_0Value (5 : Fin 6))) := by + exact contains_sound (entropyTerm_ball ((B4_1_3Little_sound (shape 4 0 0) ((stageBPriority (shape 4 1 3)) 2)) (5 : Fin 6)) CB4_1_3I2S4_0_0E_5Log_sound) (by decide +kernel) +def CB4_1_3I2S4_0_0Terms (a : Fin 6) : Ball := + match a.val with + | 5 => ⟨0, 0⟩ + | _ => (.exact 0) +lemma CB4_1_3I2S4_0_0Terms_sound (a : Fin 6) : + (CB4_1_3I2S4_0_0Terms a).Encloses (Foundation.entropyTerm (CB4_1_3I2S4_0_0Value a)) := by + fin_cases a + · exact (entropyTerm_zero_ball ((B4_1_3Little_sound (shape 4 0 0) ((stageBPriority (shape 4 1 3)) 2)) (0 : Fin 6))) + · exact (entropyTerm_zero_ball ((B4_1_3Little_sound (shape 4 0 0) ((stageBPriority (shape 4 1 3)) 2)) (1 : Fin 6))) + · exact (entropyTerm_zero_ball ((B4_1_3Little_sound (shape 4 0 0) ((stageBPriority (shape 4 1 3)) 2)) (2 : Fin 6))) + · exact (entropyTerm_zero_ball ((B4_1_3Little_sound (shape 4 0 0) ((stageBPriority (shape 4 1 3)) 2)) (3 : Fin 6))) + · exact (entropyTerm_zero_ball ((B4_1_3Little_sound (shape 4 0 0) ((stageBPriority (shape 4 1 3)) 2)) (4 : Fin 6))) + · exact CB4_1_3I2S4_0_0E_5_sound +def CB4_1_3I2S4_0_0Entropy : Ball := ⟨0, 0⟩ +lemma CB4_1_3I2S4_0_0Entropy_sound : CB4_1_3I2S4_0_0Entropy.Encloses (Foundation.finiteEntropy CB4_1_3I2S4_0_0Value) := by + exact contains_sound (entropyFin_enclosed 6 CB4_1_3I2S4_0_0Value CB4_1_3I2S4_0_0Terms CB4_1_3I2S4_0_0Terms_sound) (by decide +kernel) +def CB4_1_3I2S4_0_0Mass : Ball := ⟨1, 0⟩ +lemma CB4_1_3I2S4_0_0Mass_sound : CB4_1_3I2S4_0_0Mass.Encloses (∑ a, CB4_1_3I2S4_0_0Value a) := by + exact contains_sound (finSumBall_sound 6 (B4_1_3Little (shape 4 0 0) ((stageBPriority (shape 4 1 3)) 2)) CB4_1_3I2S4_0_0Value (B4_1_3Little_sound (shape 4 0 0) ((stageBPriority (shape 4 1 3)) 2))) (by decide +kernel) +def CB4_1_3I2S4_0_0MassTermLog : Ball := .exact 0 +lemma CB4_1_3I2S4_0_0MassTermLog_sound : CB4_1_3I2S4_0_0MassTermLog.Encloses (Real.log ((∑ a, CB4_1_3I2S4_0_0Value a))) := by + exact log_exact_one_ball (CB4_1_3I2S4_0_0Mass_sound) +def CB4_1_3I2S4_0_0MassTerm : Ball := ⟨0, 0⟩ +lemma CB4_1_3I2S4_0_0MassTerm_sound : CB4_1_3I2S4_0_0MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB4_1_3I2S4_0_0Value a))) := by + exact contains_sound (entropyTerm_ball (CB4_1_3I2S4_0_0Mass_sound) CB4_1_3I2S4_0_0MassTermLog_sound) (by decide +kernel) +def CB4_1_3I2S4_0_0H : Ball := ⟨0, 0⟩ +lemma CB4_1_3I2S4_0_0H_sound : CB4_1_3I2S4_0_0H.Encloses (homogeneousEntropy CB4_1_3I2S4_0_0Value) := by + exact contains_sound (homogeneous_enclosed CB4_1_3I2S4_0_0Value CB4_1_3I2S4_0_0MassTerm_sound CB4_1_3I2S4_0_0Entropy_sound) (by decide +kernel) +def CB4_1_3I2Singles (s : Shape) : Ball := + match s 0, s 1, s 2 with + | 1, 0, 3 => CB4_1_3I2S1_0_3H + | 2, 0, 2 => CB4_1_3I2S2_0_2H + | 3, 0, 1 => CB4_1_3I2S3_0_1H + | 3, 1, 0 => CB4_1_3I2S3_1_0H + | 4, 0, 0 => CB4_1_3I2S4_0_0H + | _, _, _ => (.exact 0) +lemma CB4_1_3I2Singles_sound (u : Shape) (hu : u ∈ below (shape 4 1 3)) + (hd : designated (stageBPriority (shape 4 1 3)) 2 u) : + (CB4_1_3I2Singles u).Encloses (homogeneousEntropy ((fun u a => (littleLaw (shape 4 1 3) u ((stageBPriority (shape 4 1 3)) 2) a : ℝ)) u)) := by + rw [B4_1_3_below] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl + · exact (show ¬ designated (stageBPriority (shape 4 1 3)) 2 (shape 0 1 3) by decide +kernel) hd |>.elim + · exact CB4_1_3I2S1_0_3H_sound + · exact (show ¬ designated (stageBPriority (shape 4 1 3)) 2 (shape 1 1 2) by decide +kernel) hd |>.elim + · exact CB4_1_3I2S2_0_2H_sound + · exact (show ¬ designated (stageBPriority (shape 4 1 3)) 2 (shape 2 1 1) by decide +kernel) hd |>.elim + · exact CB4_1_3I2S3_0_1H_sound + · exact CB4_1_3I2S3_1_0H_sound + · exact CB4_1_3I2S4_0_0H_sound +def CB4_1_3I2Singleton : Ball := ⟨(83041426750315471544140407637 / 625000000000000000000000000000), (20391089907 / 100000000000000000000000000000000)⟩ +lemma CB4_1_3I2Singleton_sound : CB4_1_3I2Singleton.Encloses + (singletonEntropy (below (shape 4 1 3)) (fun u => (stageBLaw (shape 4 1 3) u : ℝ)) (stageBPriority (shape 4 1 3)) 2 (fun u a => (littleLaw (shape 4 1 3) u ((stageBPriority (shape 4 1 3)) 2) a : ℝ))) := by + exact contains_sound (singletonBall_sound (below (shape 4 1 3)) B4_1_3Law (fun u => (stageBLaw (shape 4 1 3) u : ℝ)) (stageBPriority (shape 4 1 3)) 2 + CB4_1_3I2Singles (fun u a => (littleLaw (shape 4 1 3) u ((stageBPriority (shape 4 1 3)) 2) a : ℝ)) (fun u _ => B4_1_3Law_sound u) CB4_1_3I2Singles_sound) (by decide +kernel) +def CB4_1_3I2Group : Ball := ⟨(1415404374746680713477846447539 / 10000000000000000000000000000000), (88203172807 / 100000000000000000000000000000000)⟩ +lemma CB4_1_3I2Group_sound : CB4_1_3I2Group.Encloses + (groupedEntropy (below (shape 4 1 3)) (fun u => (stageBLaw (shape 4 1 3) u : ℝ)) (stageBPriority (shape 4 1 3)) 2 (fun u a => (littleLaw (shape 4 1 3) u ((stageBPriority (shape 4 1 3)) 2) a : ℝ))) := by + exact contains_sound (Ball.add_sound CB4_1_3I2Singleton_sound + (finSumBall_sound 17 CB4_1_3I2ResidualEntropies _ CB4_1_3I2ResidualEntropies_sound)) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CB4_1_3I2H : Ball := ⟨(59685340859687997054410201895273 / 100000000000000000000000000000000), (16071314767 / 6250000000000000000000000000000)⟩ +lemma CB4_1_3I2_sound : CB4_1_3I2H.Encloses (stageBCapacity (shape 4 1 3) 2) := by + have hb := contains_sound (Ball.add_sound CB4_1_3I2PairH_sound + (Ball.neg_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) CB4_1_3I2Group_sound))) + (show contains (.add CB4_1_3I2PairH (.neg (.mul (.exact 2) CB4_1_3I2Group))) CB4_1_3I2H = true by decide +kernel) + unfold CB4_1_3I2PairValue at hb + simpa only [stageBCapacity, nativeCapacity, + show (2 : Fin 3) ≠ 0 by decide, ite_false, sub_eq_add_neg] using hb + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/CapacityB/CapB4_2_2I0.lean b/lean/OAI/LinearAlgebra/MatrixFields/CapacityB/CapB4_2_2I0.lean new file mode 100644 index 0000000000000000000000000000000000000000..8cf58200c7a2f97b42cfe9e1532e72da319bdf62 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/CapacityB/CapB4_2_2I0.lean @@ -0,0 +1,74 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Certificates.Terminal4_2_2 + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CB4_2_2I0Value (a : Fin 17) : ℝ := marginal (below (shape 4 2 2)) (fun u => (stageBLaw (shape 4 2 2) u : ℝ)) ((stageBPriority (shape 4 2 2)) 0) a +def CB4_2_2I0Raw (a : Fin 17) : Ball := marginalBall (below (shape 4 2 2)) B4_2_2Law ((stageBPriority (shape 4 2 2)) 0) a +lemma CB4_2_2I0Raw_sound (a : Fin 17) : + (CB4_2_2I0Raw a).Encloses (CB4_2_2I0Value a) := by + exact marginalBall_sound (below (shape 4 2 2)) B4_2_2Law (fun u => (stageBLaw (shape 4 2 2) u : ℝ)) (fun u _ => B4_2_2Law_sound u) ((stageBPriority (shape 4 2 2)) 0) a +def CB4_2_2I0Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(18443922190366941637623808000193 / 100000000000000000000000000000000), (69 / 100000000000000000000000000000000)⟩ ⟨(31178256963042688675819307809239 / 100000000000000000000000000000000), (15622609959 / 100000000000000000000000000000000)⟩ ⟨(-42260882258718742705346530515367 / 25000000000000000000000000000000), (42351647553 / 50000000000000000000000000000000)⟩ ⟨-3, 18443922190366941637623808000193, 12500000000000000000000000000000⟩, + .log ⟨(63112155619266116724752383999613 / 100000000000000000000000000000000), (93 / 100000000000000000000000000000000)⟩ ⟨(726194960879906850566047157421 / 2500000000000000000000000000000), (2672903773 / 10000000000000000000000000000000)⟩ ⟨(-23012839721742060809676949114857 / 50000000000000000000000000000000), (42351647513 / 100000000000000000000000000000000)⟩ ⟨-1, 63112155619266116724752383999613, 50000000000000000000000000000000⟩] +lemma CB4_2_2I0Certificates_valid : + CB4_2_2I0Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB4_2_2I0CertificateIndex (a : Fin 17) : ℕ := + match a.val with + | 2 => 1 + | 1 => 2 + | 0 => 1 + | _ => 0 +def CB4_2_2I0P (a : Fin 17) : Ball := + (CompactCertificate.entropyLookup CB4_2_2I0Certificates (CB4_2_2I0CertificateIndex a)).input +lemma CB4_2_2I0P_check : ∀ a : Fin 17, contains (CB4_2_2I0Raw a) (CB4_2_2I0P a) = true := by + decide +kernel +lemma CB4_2_2I0P_sound (a : Fin 17) : + (CB4_2_2I0P a).Encloses (CB4_2_2I0Value a) := + contains_sound (CB4_2_2I0Raw_sound a) (CB4_2_2I0P_check a) +def CB4_2_2I0Terms (a : Fin 17) : Ball := + (CompactCertificate.entropyLookup CB4_2_2I0Certificates (CB4_2_2I0CertificateIndex a)).output +lemma CB4_2_2I0Terms_sound (a : Fin 17) : + (CB4_2_2I0Terms a).Encloses (Foundation.entropyTerm (CB4_2_2I0Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB4_2_2I0Certificates_valid + (CB4_2_2I0CertificateIndex a) (CB4_2_2I0P_sound a) +def CB4_2_2I0Entropy : Ball := ⟨(45702156180640825687140250957659 / 50000000000000000000000000000000), (3623391103 / 6250000000000000000000000000000)⟩ +lemma CB4_2_2I0Entropy_sound : CB4_2_2I0Entropy.Encloses (Foundation.finiteEntropy CB4_2_2I0Value) := by + exact contains_sound (entropyFin_enclosed 17 CB4_2_2I0Value CB4_2_2I0Terms CB4_2_2I0Terms_sound) (by decide +kernel) +def CB4_2_2I0Mass : Ball := ⟨(99999999999999999999999999999999 / 100000000000000000000000000000000), (231 / 100000000000000000000000000000000)⟩ +lemma CB4_2_2I0Mass_sound : CB4_2_2I0Mass.Encloses (∑ a, CB4_2_2I0Value a) := by + exact contains_sound (finSumBall_sound 17 CB4_2_2I0P CB4_2_2I0Value CB4_2_2I0P_sound) (by decide +kernel) +def CB4_2_2I0MassTermLogWitness : LogWitness := ⟨-1, 99999999999999999999999999999999, 50000000000000000000000000000000⟩ +def CB4_2_2I0MassTermLog : Ball := ⟨0, (42351647597 / 100000000000000000000000000000000)⟩ +lemma CB4_2_2I0MassTermLog_sound : CB4_2_2I0MassTermLog.Encloses (Real.log ((∑ a, CB4_2_2I0Value a))) := by + exact checkLog_sound logTwoBall_sound (CB4_2_2I0Mass_sound) (w := CB4_2_2I0MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB4_2_2I0MassTerm : Ball := ⟨0, (21175823799 / 50000000000000000000000000000000)⟩ +lemma CB4_2_2I0MassTerm_sound : CB4_2_2I0MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB4_2_2I0Value a))) := by + exact contains_sound (entropyTerm_ball (CB4_2_2I0Mass_sound) CB4_2_2I0MassTermLog_sound) (by decide +kernel) +def CB4_2_2I0H : Ball := ⟨(45702156180640825687140250957659 / 50000000000000000000000000000000), (50162952623 / 50000000000000000000000000000000)⟩ +lemma CB4_2_2I0H_sound : CB4_2_2I0H.Encloses (homogeneousEntropy CB4_2_2I0Value) := by + exact contains_sound (homogeneous_enclosed CB4_2_2I0Value CB4_2_2I0MassTerm_sound CB4_2_2I0Entropy_sound) (by decide +kernel) +lemma CB4_2_2I0_sound : CB4_2_2I0H.Encloses (stageBCapacity (shape 4 2 2) 0) := by + exact CB4_2_2I0H_sound + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/CapacityB/CapB4_2_2I1.lean b/lean/OAI/LinearAlgebra/MatrixFields/CapacityB/CapB4_2_2I1.lean new file mode 100644 index 0000000000000000000000000000000000000000..f1d229e3fa603629099cb171581bcf33f0b9b403 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/CapacityB/CapB4_2_2I1.lean @@ -0,0 +1,893 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Certificates.Terminal4_2_2 + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CB4_2_2I1PairValue (a : PairSlot) : ℝ := pairLaw (below (shape 4 2 2)) (shape 4 2 2) (fun u => (stageBLaw (shape 4 2 2) u : ℝ)) (fun u a => (littleLaw (shape 4 2 2) u ((stageBPriority (shape 4 2 2)) 1) a : ℝ)) a +def CB4_2_2I1PairRaw (a : PairSlot) : Ball := pairLawBall (below (shape 4 2 2)) (shape 4 2 2) B4_2_2Law (fun u => B4_2_2Little u ((stageBPriority (shape 4 2 2)) 1)) a +lemma CB4_2_2I1PairRaw_sound (a : PairSlot) : + (CB4_2_2I1PairRaw a).Encloses (CB4_2_2I1PairValue a) := by + exact pairLawBall_sound_on (below (shape 4 2 2)) (shape 4 2 2) B4_2_2Law (fun u => (stageBLaw (shape 4 2 2) u : ℝ)) (fun u => B4_2_2Little u ((stageBPriority (shape 4 2 2)) 1)) (fun u a => (littleLaw (shape 4 2 2) u ((stageBPriority (shape 4 2 2)) 1) a : ℝ)) (fun u _ => B4_2_2Law_sound u) (fun u _ a => B4_2_2Little_sound u ((stageBPriority (shape 4 2 2)) 1) a) (fun u _ a => B4_2_2Little_sound (complement (shape 4 2 2) u) ((stageBPriority (shape 4 2 2)) 1) a) a +def CB4_2_2I1PairCertificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(8381053538293561989694981145863 / 50000000000000000000000000000000), (1 / 1562500000000000000000000000000)⟩ ⟨(14968975461369020432318723817513 / 50000000000000000000000000000000), (14198057139 / 100000000000000000000000000000000)⟩ ⟨(-178604937827623076843999388352607 / 100000000000000000000000000000000), (84703295113 / 100000000000000000000000000000000)⟩ ⟨-3, 8381053538293561989694981145863, 6250000000000000000000000000000⟩, + .log ⟨(1683384830026987155576128449497 / 100000000000000000000000000000000), (7 / 100000000000000000000000000000000)⟩ ⟨(1375111158290971157936727085847 / 20000000000000000000000000000000), (2495294261 / 100000000000000000000000000000000)⟩ ⟨(-25527272748385133186942042108869 / 6250000000000000000000000000000), (37057691549 / 25000000000000000000000000000000)⟩ ⟨-6, 1683384830026987155576128449497, 1562500000000000000000000000000⟩, + .log ⟨(63109016186771777730067818517553 / 100000000000000000000000000000000), (93 / 100000000000000000000000000000000)⟩ ⟨(29049492844469626210844809336407 / 100000000000000000000000000000000), (835240879 / 3125000000000000000000000000000)⟩ ⟨(-46030653937778645685871837091337 / 100000000000000000000000000000000), (42351647513 / 100000000000000000000000000000000)⟩ ⟨-1, 63109016186771777730067818517553, 50000000000000000000000000000000⟩] +lemma CB4_2_2I1PairCertificates_valid : + CB4_2_2I1PairCertificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB4_2_2I1PairCertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 2, 0 => 1 + | 3, 0 => 2 + | 1, 1 => 3 + | 0, 2 => 1 + | 0, 3 => 2 + | _, _ => 0 +def CB4_2_2I1PairP (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CB4_2_2I1PairCertificates (CB4_2_2I1PairCertificateIndex a)).input +lemma CB4_2_2I1PairP_check : ∀ a : PairSlot, contains (CB4_2_2I1PairRaw a) (CB4_2_2I1PairP a) = true := by + decide +kernel +lemma CB4_2_2I1PairP_sound (a : PairSlot) : + (CB4_2_2I1PairP a).Encloses (CB4_2_2I1PairValue a) := + contains_sound (CB4_2_2I1PairRaw_sound a) (CB4_2_2I1PairP_check a) +def CB4_2_2I1PairTerms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CB4_2_2I1PairCertificates (CB4_2_2I1PairCertificateIndex a)).output +lemma CB4_2_2I1PairTerms_sound (a : PairSlot) : + (CB4_2_2I1PairTerms a).Encloses (Foundation.entropyTerm (CB4_2_2I1PairValue a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB4_2_2I1PairCertificates_valid + (CB4_2_2I1PairCertificateIndex a) (CB4_2_2I1PairP_sound a) +def CB4_2_2I1PairEntropy : Ball := ⟨(102676506272855419519486975464929 / 100000000000000000000000000000000), (3757150683 / 6250000000000000000000000000000)⟩ +lemma CB4_2_2I1PairEntropy_sound : CB4_2_2I1PairEntropy.Encloses (Foundation.finiteEntropy CB4_2_2I1PairValue) := by + exact contains_sound (entropyPair_enclosed CB4_2_2I1PairValue CB4_2_2I1PairTerms CB4_2_2I1PairTerms_sound) (by decide +kernel) +def CB4_2_2I1PairMass : Ball := ⟨(99999999999999999999999999999999 / 100000000000000000000000000000000), (47 / 20000000000000000000000000000000)⟩ +lemma CB4_2_2I1PairMass_sound : CB4_2_2I1PairMass.Encloses (∑ a, CB4_2_2I1PairValue a) := by + exact contains_sound (pairSumBall_sound CB4_2_2I1PairP CB4_2_2I1PairValue CB4_2_2I1PairP_sound) (by decide +kernel) +def CB4_2_2I1PairMassTermLogWitness : LogWitness := ⟨-1, 99999999999999999999999999999999, 50000000000000000000000000000000⟩ +def CB4_2_2I1PairMassTermLog : Ball := ⟨0, (42351647601 / 100000000000000000000000000000000)⟩ +lemma CB4_2_2I1PairMassTermLog_sound : CB4_2_2I1PairMassTermLog.Encloses (Real.log ((∑ a, CB4_2_2I1PairValue a))) := by + exact checkLog_sound logTwoBall_sound (CB4_2_2I1PairMass_sound) (w := CB4_2_2I1PairMassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB4_2_2I1PairMassTerm : Ball := ⟨0, (21175823801 / 50000000000000000000000000000000)⟩ +lemma CB4_2_2I1PairMassTerm_sound : CB4_2_2I1PairMassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB4_2_2I1PairValue a))) := by + exact contains_sound (entropyTerm_ball (CB4_2_2I1PairMass_sound) CB4_2_2I1PairMassTermLog_sound) (by decide +kernel) +def CB4_2_2I1PairH : Ball := ⟨(102676506272855419519486975464929 / 100000000000000000000000000000000), (10246605853 / 10000000000000000000000000000000)⟩ +lemma CB4_2_2I1PairH_sound : CB4_2_2I1PairH.Encloses (homogeneousEntropy CB4_2_2I1PairValue) := by + exact contains_sound (homogeneous_enclosed CB4_2_2I1PairValue CB4_2_2I1PairMassTerm_sound CB4_2_2I1PairEntropy_sound) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CB4_2_2I1R0Value (a : Fin 6) : ℝ := residualLaw (below (shape 4 2 2)) (fun u => (stageBLaw (shape 4 2 2) u : ℝ)) (stageBPriority (shape 4 2 2)) 1 (fun u a => (littleLaw (shape 4 2 2) u ((stageBPriority (shape 4 2 2)) 1) a : ℝ)) 0 a +def CB4_2_2I1R0Raw (a : Fin 6) : Ball := residualBall (below (shape 4 2 2)) B4_2_2Law (stageBPriority (shape 4 2 2)) 1 (fun u => B4_2_2Little u ((stageBPriority (shape 4 2 2)) 1)) 0 a +lemma CB4_2_2I1R0Raw_sound (a : Fin 6) : + (CB4_2_2I1R0Raw a).Encloses (CB4_2_2I1R0Value a) := by + exact residualBall_sound_on (below (shape 4 2 2)) B4_2_2Law (fun u => (stageBLaw (shape 4 2 2) u : ℝ)) (stageBPriority (shape 4 2 2)) 1 (fun u => B4_2_2Little u ((stageBPriority (shape 4 2 2)) 1)) (fun u a => (littleLaw (shape 4 2 2) u ((stageBPriority (shape 4 2 2)) 1) a : ℝ)) (fun u _ => B4_2_2Law_sound u) (fun u _ a => B4_2_2Little_sound u ((stageBPriority (shape 4 2 2)) 1) a) 0 a +def CB4_2_2I1R0Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(18445491906614111134966090741223 / 100000000000000000000000000000000), (69 / 100000000000000000000000000000000)⟩ ⟨(15589670341870072259151924157867 / 50000000000000000000000000000000), (15623939561 / 100000000000000000000000000000000)⟩ ⟨(-169035018646263266787855854619957 / 100000000000000000000000000000000), (42351647553 / 50000000000000000000000000000000)⟩ ⟨-3, 18445491906614111134966090741223, 12500000000000000000000000000000⟩] +lemma CB4_2_2I1R0Certificates_valid : + CB4_2_2I1R0Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB4_2_2I1R0CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | 0 => 1 + | _ => 0 +def CB4_2_2I1R0P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB4_2_2I1R0Certificates (CB4_2_2I1R0CertificateIndex a)).input +lemma CB4_2_2I1R0P_check : ∀ a : Fin 6, contains (CB4_2_2I1R0Raw a) (CB4_2_2I1R0P a) = true := by + decide +kernel +lemma CB4_2_2I1R0P_sound (a : Fin 6) : + (CB4_2_2I1R0P a).Encloses (CB4_2_2I1R0Value a) := + contains_sound (CB4_2_2I1R0Raw_sound a) (CB4_2_2I1R0P_check a) +def CB4_2_2I1R0Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB4_2_2I1R0Certificates (CB4_2_2I1R0CertificateIndex a)).output +lemma CB4_2_2I1R0Terms_sound (a : Fin 6) : + (CB4_2_2I1R0Terms a).Encloses (Foundation.entropyTerm (CB4_2_2I1R0Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB4_2_2I1R0Certificates_valid + (CB4_2_2I1R0CertificateIndex a) (CB4_2_2I1R0P_sound a) +def CB4_2_2I1R0Entropy : Ball := ⟨(15589670341870072259151924157867 / 50000000000000000000000000000000), (15623939561 / 100000000000000000000000000000000)⟩ +lemma CB4_2_2I1R0Entropy_sound : CB4_2_2I1R0Entropy.Encloses (Foundation.finiteEntropy CB4_2_2I1R0Value) := by + exact contains_sound (entropyFin_enclosed 6 CB4_2_2I1R0Value CB4_2_2I1R0Terms CB4_2_2I1R0Terms_sound) (by decide +kernel) +def CB4_2_2I1R0Mass : Ball := ⟨(18445491906614111134966090741223 / 100000000000000000000000000000000), (69 / 100000000000000000000000000000000)⟩ +lemma CB4_2_2I1R0Mass_sound : CB4_2_2I1R0Mass.Encloses (∑ a, CB4_2_2I1R0Value a) := by + exact contains_sound (finSumBall_sound 6 CB4_2_2I1R0P CB4_2_2I1R0Value CB4_2_2I1R0P_sound) (by decide +kernel) +def CB4_2_2I1R0MassTermLogWitness : LogWitness := ⟨-3, 18445491906614111134966090741223, 12500000000000000000000000000000⟩ +def CB4_2_2I1R0MassTermLog : Ball := ⟨(-169035018646263266787855854619957 / 100000000000000000000000000000000), (42351647553 / 50000000000000000000000000000000)⟩ +lemma CB4_2_2I1R0MassTermLog_sound : CB4_2_2I1R0MassTermLog.Encloses (Real.log ((∑ a, CB4_2_2I1R0Value a))) := by + exact checkLog_sound logTwoBall_sound (CB4_2_2I1R0Mass_sound) (w := CB4_2_2I1R0MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB4_2_2I1R0MassTerm : Ball := ⟨(15589670341870072259151924157867 / 50000000000000000000000000000000), (15623939561 / 100000000000000000000000000000000)⟩ +lemma CB4_2_2I1R0MassTerm_sound : CB4_2_2I1R0MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB4_2_2I1R0Value a))) := by + exact contains_sound (entropyTerm_ball (CB4_2_2I1R0Mass_sound) CB4_2_2I1R0MassTermLog_sound) (by decide +kernel) +def CB4_2_2I1R0H : Ball := ⟨0, (15623939561 / 50000000000000000000000000000000)⟩ +lemma CB4_2_2I1R0H_sound : CB4_2_2I1R0H.Encloses (homogeneousEntropy CB4_2_2I1R0Value) := by + exact contains_sound (homogeneous_enclosed CB4_2_2I1R0Value CB4_2_2I1R0MassTerm_sound CB4_2_2I1R0Entropy_sound) (by decide +kernel) +def CB4_2_2I1R1Value (a : Fin 6) : ℝ := residualLaw (below (shape 4 2 2)) (fun u => (stageBLaw (shape 4 2 2) u : ℝ)) (stageBPriority (shape 4 2 2)) 1 (fun u a => (littleLaw (shape 4 2 2) u ((stageBPriority (shape 4 2 2)) 1) a : ℝ)) 1 a +def CB4_2_2I1R1Raw (a : Fin 6) : Ball := residualBall (below (shape 4 2 2)) B4_2_2Law (stageBPriority (shape 4 2 2)) 1 (fun u => B4_2_2Little u ((stageBPriority (shape 4 2 2)) 1)) 1 a +lemma CB4_2_2I1R1Raw_sound (a : Fin 6) : + (CB4_2_2I1R1Raw a).Encloses (CB4_2_2I1R1Value a) := by + exact residualBall_sound_on (below (shape 4 2 2)) B4_2_2Law (fun u => (stageBLaw (shape 4 2 2) u : ℝ)) (stageBPriority (shape 4 2 2)) 1 (fun u => B4_2_2Little u ((stageBPriority (shape 4 2 2)) 1)) (fun u a => (littleLaw (shape 4 2 2) u ((stageBPriority (shape 4 2 2)) 1) a : ℝ)) (fun u _ => B4_2_2Law_sound u) (fun u _ a => B4_2_2Little_sound u ((stageBPriority (shape 4 2 2)) 1) a) 1 a +def CB4_2_2I1R1Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(63109016186771777730067818517553 / 100000000000000000000000000000000), (93 / 100000000000000000000000000000000)⟩ ⟨(29049492844469626210844809336407 / 100000000000000000000000000000000), (835240879 / 3125000000000000000000000000000)⟩ ⟨(-46030653937778645685871837091337 / 100000000000000000000000000000000), (42351647513 / 100000000000000000000000000000000)⟩ ⟨-1, 63109016186771777730067818517553, 50000000000000000000000000000000⟩] +lemma CB4_2_2I1R1Certificates_valid : + CB4_2_2I1R1Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB4_2_2I1R1CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | 1 => 1 + | _ => 0 +def CB4_2_2I1R1P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB4_2_2I1R1Certificates (CB4_2_2I1R1CertificateIndex a)).input +lemma CB4_2_2I1R1P_check : ∀ a : Fin 6, contains (CB4_2_2I1R1Raw a) (CB4_2_2I1R1P a) = true := by + decide +kernel +lemma CB4_2_2I1R1P_sound (a : Fin 6) : + (CB4_2_2I1R1P a).Encloses (CB4_2_2I1R1Value a) := + contains_sound (CB4_2_2I1R1Raw_sound a) (CB4_2_2I1R1P_check a) +def CB4_2_2I1R1Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB4_2_2I1R1Certificates (CB4_2_2I1R1CertificateIndex a)).output +lemma CB4_2_2I1R1Terms_sound (a : Fin 6) : + (CB4_2_2I1R1Terms a).Encloses (Foundation.entropyTerm (CB4_2_2I1R1Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB4_2_2I1R1Certificates_valid + (CB4_2_2I1R1CertificateIndex a) (CB4_2_2I1R1P_sound a) +def CB4_2_2I1R1Entropy : Ball := ⟨(29049492844469626210844809336407 / 100000000000000000000000000000000), (835240879 / 3125000000000000000000000000000)⟩ +lemma CB4_2_2I1R1Entropy_sound : CB4_2_2I1R1Entropy.Encloses (Foundation.finiteEntropy CB4_2_2I1R1Value) := by + exact contains_sound (entropyFin_enclosed 6 CB4_2_2I1R1Value CB4_2_2I1R1Terms CB4_2_2I1R1Terms_sound) (by decide +kernel) +def CB4_2_2I1R1Mass : Ball := ⟨(63109016186771777730067818517553 / 100000000000000000000000000000000), (93 / 100000000000000000000000000000000)⟩ +lemma CB4_2_2I1R1Mass_sound : CB4_2_2I1R1Mass.Encloses (∑ a, CB4_2_2I1R1Value a) := by + exact contains_sound (finSumBall_sound 6 CB4_2_2I1R1P CB4_2_2I1R1Value CB4_2_2I1R1P_sound) (by decide +kernel) +def CB4_2_2I1R1MassTermLogWitness : LogWitness := ⟨-1, 63109016186771777730067818517553, 50000000000000000000000000000000⟩ +def CB4_2_2I1R1MassTermLog : Ball := ⟨(-46030653937778645685871837091337 / 100000000000000000000000000000000), (42351647513 / 100000000000000000000000000000000)⟩ +lemma CB4_2_2I1R1MassTermLog_sound : CB4_2_2I1R1MassTermLog.Encloses (Real.log ((∑ a, CB4_2_2I1R1Value a))) := by + exact checkLog_sound logTwoBall_sound (CB4_2_2I1R1Mass_sound) (w := CB4_2_2I1R1MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB4_2_2I1R1MassTerm : Ball := ⟨(29049492844469626210844809336407 / 100000000000000000000000000000000), (835240879 / 3125000000000000000000000000000)⟩ +lemma CB4_2_2I1R1MassTerm_sound : CB4_2_2I1R1MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB4_2_2I1R1Value a))) := by + exact contains_sound (entropyTerm_ball (CB4_2_2I1R1Mass_sound) CB4_2_2I1R1MassTermLog_sound) (by decide +kernel) +def CB4_2_2I1R1H : Ball := ⟨0, (835240879 / 1562500000000000000000000000000)⟩ +lemma CB4_2_2I1R1H_sound : CB4_2_2I1R1H.Encloses (homogeneousEntropy CB4_2_2I1R1Value) := by + exact contains_sound (homogeneous_enclosed CB4_2_2I1R1Value CB4_2_2I1R1MassTerm_sound CB4_2_2I1R1Entropy_sound) (by decide +kernel) +def CB4_2_2I1R2Value (a : Fin 6) : ℝ := residualLaw (below (shape 4 2 2)) (fun u => (stageBLaw (shape 4 2 2) u : ℝ)) (stageBPriority (shape 4 2 2)) 1 (fun u a => (littleLaw (shape 4 2 2) u ((stageBPriority (shape 4 2 2)) 1) a : ℝ)) 2 a +def CB4_2_2I1R2Raw (a : Fin 6) : Ball := residualBall (below (shape 4 2 2)) B4_2_2Law (stageBPriority (shape 4 2 2)) 1 (fun u => B4_2_2Little u ((stageBPriority (shape 4 2 2)) 1)) 2 a +lemma CB4_2_2I1R2Raw_sound (a : Fin 6) : + (CB4_2_2I1R2Raw a).Encloses (CB4_2_2I1R2Value a) := by + exact residualBall_sound_on (below (shape 4 2 2)) B4_2_2Law (fun u => (stageBLaw (shape 4 2 2) u : ℝ)) (stageBPriority (shape 4 2 2)) 1 (fun u => B4_2_2Little u ((stageBPriority (shape 4 2 2)) 1)) (fun u a => (littleLaw (shape 4 2 2) u ((stageBPriority (shape 4 2 2)) 1) a : ℝ)) (fun u _ => B4_2_2Law_sound u) (fun u _ a => B4_2_2Little_sound u ((stageBPriority (shape 4 2 2)) 1) a) 2 a +def CB4_2_2I1R2Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(16731266654505405003582755364601 / 100000000000000000000000000000000), (63 / 100000000000000000000000000000000)⟩ ⟨(3739210054904612691168873886269 / 12500000000000000000000000000000), (14171934283 / 100000000000000000000000000000000)⟩ ⟨(-44697274057224066538312434542437 / 25000000000000000000000000000000), (21175823777 / 25000000000000000000000000000000)⟩ ⟨-3, 16731266654505405003582755364601, 12500000000000000000000000000000⟩, + .log ⟨(1681299968119507082608667718731 / 100000000000000000000000000000000), (7 / 100000000000000000000000000000000)⟩ ⟨(53665031465748522976083372373 / 781250000000000000000000000000), (1246101927 / 50000000000000000000000000000000)⟩ ⟨(-204280145062357856938742151803547 / 50000000000000000000000000000000), (37057691549 / 25000000000000000000000000000000)⟩ ⟨-6, 1681299968119507082608667718731, 1562500000000000000000000000000⟩] +lemma CB4_2_2I1R2Certificates_valid : + CB4_2_2I1R2Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB4_2_2I1R2CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | 2 => 1 + | 3 => 2 + | _ => 0 +def CB4_2_2I1R2P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB4_2_2I1R2Certificates (CB4_2_2I1R2CertificateIndex a)).input +lemma CB4_2_2I1R2P_check : ∀ a : Fin 6, contains (CB4_2_2I1R2Raw a) (CB4_2_2I1R2P a) = true := by + decide +kernel +lemma CB4_2_2I1R2P_sound (a : Fin 6) : + (CB4_2_2I1R2P a).Encloses (CB4_2_2I1R2Value a) := + contains_sound (CB4_2_2I1R2Raw_sound a) (CB4_2_2I1R2P_check a) +def CB4_2_2I1R2Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB4_2_2I1R2Certificates (CB4_2_2I1R2CertificateIndex a)).output +lemma CB4_2_2I1R2Terms_sound (a : Fin 6) : + (CB4_2_2I1R2Terms a).Encloses (Foundation.entropyTerm (CB4_2_2I1R2Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB4_2_2I1R2Certificates_valid + (CB4_2_2I1R2CertificateIndex a) (CB4_2_2I1R2P_sound a) +def CB4_2_2I1R2Entropy : Ball := ⟨(4597850558356589058786207844237 / 12500000000000000000000000000000), (16664138137 / 100000000000000000000000000000000)⟩ +lemma CB4_2_2I1R2Entropy_sound : CB4_2_2I1R2Entropy.Encloses (Foundation.finiteEntropy CB4_2_2I1R2Value) := by + exact contains_sound (entropyFin_enclosed 6 CB4_2_2I1R2Value CB4_2_2I1R2Terms CB4_2_2I1R2Terms_sound) (by decide +kernel) +def CB4_2_2I1R2Mass : Ball := ⟨(4603141655656228021547855770833 / 25000000000000000000000000000000), (7 / 10000000000000000000000000000000)⟩ +lemma CB4_2_2I1R2Mass_sound : CB4_2_2I1R2Mass.Encloses (∑ a, CB4_2_2I1R2Value a) := by + exact contains_sound (finSumBall_sound 6 CB4_2_2I1R2P CB4_2_2I1R2Value CB4_2_2I1R2P_sound) (by decide +kernel) +def CB4_2_2I1R2MassTermLogWitness : LogWitness := ⟨-3, 4603141655656228021547855770833, 3125000000000000000000000000000⟩ +def CB4_2_2I1R2MassTermLog : Ball := ⟨(-16921367858691658829236060089209 / 10000000000000000000000000000000), (10587911889 / 12500000000000000000000000000000)⟩ +lemma CB4_2_2I1R2MassTermLog_sound : CB4_2_2I1R2MassTermLog.Encloses (Real.log ((∑ a, CB4_2_2I1R2Value a))) := by + exact checkLog_sound logTwoBall_sound (CB4_2_2I1R2Mass_sound) (w := CB4_2_2I1R2MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB4_2_2I1R2MassTerm : Ball := ⟨(7789145326102600430969774397921 / 25000000000000000000000000000000), (15596050763 / 100000000000000000000000000000000)⟩ +lemma CB4_2_2I1R2MassTerm_sound : CB4_2_2I1R2MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB4_2_2I1R2Value a))) := by + exact contains_sound (entropyTerm_ball (CB4_2_2I1R2Mass_sound) CB4_2_2I1R2MassTermLog_sound) (by decide +kernel) +def CB4_2_2I1R2H : Ball := ⟨(1406555790610577686602641290553 / 25000000000000000000000000000000), (322601889 / 1000000000000000000000000000000)⟩ +lemma CB4_2_2I1R2H_sound : CB4_2_2I1R2H.Encloses (homogeneousEntropy CB4_2_2I1R2Value) := by + exact contains_sound (homogeneous_enclosed CB4_2_2I1R2Value CB4_2_2I1R2MassTerm_sound CB4_2_2I1R2Entropy_sound) (by decide +kernel) +def CB4_2_2I1R3Value (a : Fin 6) : ℝ := residualLaw (below (shape 4 2 2)) (fun u => (stageBLaw (shape 4 2 2) u : ℝ)) (stageBPriority (shape 4 2 2)) 1 (fun u a => (littleLaw (shape 4 2 2) u ((stageBPriority (shape 4 2 2)) 1) a : ℝ)) 3 a +def CB4_2_2I1R3Raw (a : Fin 6) : Ball := residualBall (below (shape 4 2 2)) B4_2_2Law (stageBPriority (shape 4 2 2)) 1 (fun u => B4_2_2Little u ((stageBPriority (shape 4 2 2)) 1)) 3 a +lemma CB4_2_2I1R3Raw_sound (a : Fin 6) : + (CB4_2_2I1R3Raw a).Encloses (CB4_2_2I1R3Value a) := by + exact residualBall_sound_on (below (shape 4 2 2)) B4_2_2Law (fun u => (stageBLaw (shape 4 2 2) u : ℝ)) (stageBPriority (shape 4 2 2)) 1 (fun u => B4_2_2Little u ((stageBPriority (shape 4 2 2)) 1)) (fun u a => (littleLaw (shape 4 2 2) u ((stageBPriority (shape 4 2 2)) 1) a : ℝ)) (fun u _ => B4_2_2Law_sound u) (fun u _ a => B4_2_2Little_sound u ((stageBPriority (shape 4 2 2)) 1) a) 3 a +def CB4_2_2I1R3Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB4_2_2I1R3Certificates_valid : + CB4_2_2I1R3Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB4_2_2I1R3CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB4_2_2I1R3P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB4_2_2I1R3Certificates (CB4_2_2I1R3CertificateIndex a)).input +lemma CB4_2_2I1R3P_check : ∀ a : Fin 6, contains (CB4_2_2I1R3Raw a) (CB4_2_2I1R3P a) = true := by + decide +kernel +lemma CB4_2_2I1R3P_sound (a : Fin 6) : + (CB4_2_2I1R3P a).Encloses (CB4_2_2I1R3Value a) := + contains_sound (CB4_2_2I1R3Raw_sound a) (CB4_2_2I1R3P_check a) +def CB4_2_2I1R3Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB4_2_2I1R3Certificates (CB4_2_2I1R3CertificateIndex a)).output +lemma CB4_2_2I1R3Terms_sound (a : Fin 6) : + (CB4_2_2I1R3Terms a).Encloses (Foundation.entropyTerm (CB4_2_2I1R3Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB4_2_2I1R3Certificates_valid + (CB4_2_2I1R3CertificateIndex a) (CB4_2_2I1R3P_sound a) +def CB4_2_2I1R3Entropy : Ball := ⟨0, 0⟩ +lemma CB4_2_2I1R3Entropy_sound : CB4_2_2I1R3Entropy.Encloses (Foundation.finiteEntropy CB4_2_2I1R3Value) := by + exact contains_sound (entropyFin_enclosed 6 CB4_2_2I1R3Value CB4_2_2I1R3Terms CB4_2_2I1R3Terms_sound) (by decide +kernel) +def CB4_2_2I1R3Mass : Ball := ⟨0, 0⟩ +lemma CB4_2_2I1R3Mass_sound : CB4_2_2I1R3Mass.Encloses (∑ a, CB4_2_2I1R3Value a) := by + exact contains_sound (finSumBall_sound 6 CB4_2_2I1R3P CB4_2_2I1R3Value CB4_2_2I1R3P_sound) (by decide +kernel) +def CB4_2_2I1R3MassTerm : Ball := .exact 0 +lemma CB4_2_2I1R3MassTerm_sound : CB4_2_2I1R3MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB4_2_2I1R3Value a))) := + entropyTerm_zero_ball (CB4_2_2I1R3Mass_sound) +def CB4_2_2I1R3H : Ball := ⟨0, 0⟩ +lemma CB4_2_2I1R3H_sound : CB4_2_2I1R3H.Encloses (homogeneousEntropy CB4_2_2I1R3Value) := by + exact contains_sound (homogeneous_enclosed CB4_2_2I1R3Value CB4_2_2I1R3MassTerm_sound CB4_2_2I1R3Entropy_sound) (by decide +kernel) +def CB4_2_2I1R4Value (a : Fin 6) : ℝ := residualLaw (below (shape 4 2 2)) (fun u => (stageBLaw (shape 4 2 2) u : ℝ)) (stageBPriority (shape 4 2 2)) 1 (fun u a => (littleLaw (shape 4 2 2) u ((stageBPriority (shape 4 2 2)) 1) a : ℝ)) 4 a +def CB4_2_2I1R4Raw (a : Fin 6) : Ball := residualBall (below (shape 4 2 2)) B4_2_2Law (stageBPriority (shape 4 2 2)) 1 (fun u => B4_2_2Little u ((stageBPriority (shape 4 2 2)) 1)) 4 a +lemma CB4_2_2I1R4Raw_sound (a : Fin 6) : + (CB4_2_2I1R4Raw a).Encloses (CB4_2_2I1R4Value a) := by + exact residualBall_sound_on (below (shape 4 2 2)) B4_2_2Law (fun u => (stageBLaw (shape 4 2 2) u : ℝ)) (stageBPriority (shape 4 2 2)) 1 (fun u => B4_2_2Little u ((stageBPriority (shape 4 2 2)) 1)) (fun u a => (littleLaw (shape 4 2 2) u ((stageBPriority (shape 4 2 2)) 1) a : ℝ)) (fun u _ => B4_2_2Law_sound u) (fun u _ a => B4_2_2Little_sound u ((stageBPriority (shape 4 2 2)) 1) a) 4 a +def CB4_2_2I1R4Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB4_2_2I1R4Certificates_valid : + CB4_2_2I1R4Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB4_2_2I1R4CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB4_2_2I1R4P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB4_2_2I1R4Certificates (CB4_2_2I1R4CertificateIndex a)).input +lemma CB4_2_2I1R4P_check : ∀ a : Fin 6, contains (CB4_2_2I1R4Raw a) (CB4_2_2I1R4P a) = true := by + decide +kernel +lemma CB4_2_2I1R4P_sound (a : Fin 6) : + (CB4_2_2I1R4P a).Encloses (CB4_2_2I1R4Value a) := + contains_sound (CB4_2_2I1R4Raw_sound a) (CB4_2_2I1R4P_check a) +def CB4_2_2I1R4Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB4_2_2I1R4Certificates (CB4_2_2I1R4CertificateIndex a)).output +lemma CB4_2_2I1R4Terms_sound (a : Fin 6) : + (CB4_2_2I1R4Terms a).Encloses (Foundation.entropyTerm (CB4_2_2I1R4Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB4_2_2I1R4Certificates_valid + (CB4_2_2I1R4CertificateIndex a) (CB4_2_2I1R4P_sound a) +def CB4_2_2I1R4Entropy : Ball := ⟨0, 0⟩ +lemma CB4_2_2I1R4Entropy_sound : CB4_2_2I1R4Entropy.Encloses (Foundation.finiteEntropy CB4_2_2I1R4Value) := by + exact contains_sound (entropyFin_enclosed 6 CB4_2_2I1R4Value CB4_2_2I1R4Terms CB4_2_2I1R4Terms_sound) (by decide +kernel) +def CB4_2_2I1R4Mass : Ball := ⟨0, 0⟩ +lemma CB4_2_2I1R4Mass_sound : CB4_2_2I1R4Mass.Encloses (∑ a, CB4_2_2I1R4Value a) := by + exact contains_sound (finSumBall_sound 6 CB4_2_2I1R4P CB4_2_2I1R4Value CB4_2_2I1R4P_sound) (by decide +kernel) +def CB4_2_2I1R4MassTerm : Ball := .exact 0 +lemma CB4_2_2I1R4MassTerm_sound : CB4_2_2I1R4MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB4_2_2I1R4Value a))) := + entropyTerm_zero_ball (CB4_2_2I1R4Mass_sound) +def CB4_2_2I1R4H : Ball := ⟨0, 0⟩ +lemma CB4_2_2I1R4H_sound : CB4_2_2I1R4H.Encloses (homogeneousEntropy CB4_2_2I1R4Value) := by + exact contains_sound (homogeneous_enclosed CB4_2_2I1R4Value CB4_2_2I1R4MassTerm_sound CB4_2_2I1R4Entropy_sound) (by decide +kernel) +def CB4_2_2I1R5Value (a : Fin 6) : ℝ := residualLaw (below (shape 4 2 2)) (fun u => (stageBLaw (shape 4 2 2) u : ℝ)) (stageBPriority (shape 4 2 2)) 1 (fun u a => (littleLaw (shape 4 2 2) u ((stageBPriority (shape 4 2 2)) 1) a : ℝ)) 5 a +def CB4_2_2I1R5Raw (a : Fin 6) : Ball := residualBall (below (shape 4 2 2)) B4_2_2Law (stageBPriority (shape 4 2 2)) 1 (fun u => B4_2_2Little u ((stageBPriority (shape 4 2 2)) 1)) 5 a +lemma CB4_2_2I1R5Raw_sound (a : Fin 6) : + (CB4_2_2I1R5Raw a).Encloses (CB4_2_2I1R5Value a) := by + exact residualBall_sound_on (below (shape 4 2 2)) B4_2_2Law (fun u => (stageBLaw (shape 4 2 2) u : ℝ)) (stageBPriority (shape 4 2 2)) 1 (fun u => B4_2_2Little u ((stageBPriority (shape 4 2 2)) 1)) (fun u a => (littleLaw (shape 4 2 2) u ((stageBPriority (shape 4 2 2)) 1) a : ℝ)) (fun u _ => B4_2_2Law_sound u) (fun u _ a => B4_2_2Little_sound u ((stageBPriority (shape 4 2 2)) 1) a) 5 a +def CB4_2_2I1R5Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB4_2_2I1R5Certificates_valid : + CB4_2_2I1R5Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB4_2_2I1R5CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB4_2_2I1R5P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB4_2_2I1R5Certificates (CB4_2_2I1R5CertificateIndex a)).input +lemma CB4_2_2I1R5P_check : ∀ a : Fin 6, contains (CB4_2_2I1R5Raw a) (CB4_2_2I1R5P a) = true := by + decide +kernel +lemma CB4_2_2I1R5P_sound (a : Fin 6) : + (CB4_2_2I1R5P a).Encloses (CB4_2_2I1R5Value a) := + contains_sound (CB4_2_2I1R5Raw_sound a) (CB4_2_2I1R5P_check a) +def CB4_2_2I1R5Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB4_2_2I1R5Certificates (CB4_2_2I1R5CertificateIndex a)).output +lemma CB4_2_2I1R5Terms_sound (a : Fin 6) : + (CB4_2_2I1R5Terms a).Encloses (Foundation.entropyTerm (CB4_2_2I1R5Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB4_2_2I1R5Certificates_valid + (CB4_2_2I1R5CertificateIndex a) (CB4_2_2I1R5P_sound a) +def CB4_2_2I1R5Entropy : Ball := ⟨0, 0⟩ +lemma CB4_2_2I1R5Entropy_sound : CB4_2_2I1R5Entropy.Encloses (Foundation.finiteEntropy CB4_2_2I1R5Value) := by + exact contains_sound (entropyFin_enclosed 6 CB4_2_2I1R5Value CB4_2_2I1R5Terms CB4_2_2I1R5Terms_sound) (by decide +kernel) +def CB4_2_2I1R5Mass : Ball := ⟨0, 0⟩ +lemma CB4_2_2I1R5Mass_sound : CB4_2_2I1R5Mass.Encloses (∑ a, CB4_2_2I1R5Value a) := by + exact contains_sound (finSumBall_sound 6 CB4_2_2I1R5P CB4_2_2I1R5Value CB4_2_2I1R5P_sound) (by decide +kernel) +def CB4_2_2I1R5MassTerm : Ball := .exact 0 +lemma CB4_2_2I1R5MassTerm_sound : CB4_2_2I1R5MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB4_2_2I1R5Value a))) := + entropyTerm_zero_ball (CB4_2_2I1R5Mass_sound) +def CB4_2_2I1R5H : Ball := ⟨0, 0⟩ +lemma CB4_2_2I1R5H_sound : CB4_2_2I1R5H.Encloses (homogeneousEntropy CB4_2_2I1R5Value) := by + exact contains_sound (homogeneous_enclosed CB4_2_2I1R5Value CB4_2_2I1R5MassTerm_sound CB4_2_2I1R5Entropy_sound) (by decide +kernel) +def CB4_2_2I1R6Value (a : Fin 6) : ℝ := residualLaw (below (shape 4 2 2)) (fun u => (stageBLaw (shape 4 2 2) u : ℝ)) (stageBPriority (shape 4 2 2)) 1 (fun u a => (littleLaw (shape 4 2 2) u ((stageBPriority (shape 4 2 2)) 1) a : ℝ)) 6 a +def CB4_2_2I1R6Raw (a : Fin 6) : Ball := residualBall (below (shape 4 2 2)) B4_2_2Law (stageBPriority (shape 4 2 2)) 1 (fun u => B4_2_2Little u ((stageBPriority (shape 4 2 2)) 1)) 6 a +lemma CB4_2_2I1R6Raw_sound (a : Fin 6) : + (CB4_2_2I1R6Raw a).Encloses (CB4_2_2I1R6Value a) := by + exact residualBall_sound_on (below (shape 4 2 2)) B4_2_2Law (fun u => (stageBLaw (shape 4 2 2) u : ℝ)) (stageBPriority (shape 4 2 2)) 1 (fun u => B4_2_2Little u ((stageBPriority (shape 4 2 2)) 1)) (fun u a => (littleLaw (shape 4 2 2) u ((stageBPriority (shape 4 2 2)) 1) a : ℝ)) (fun u _ => B4_2_2Law_sound u) (fun u _ a => B4_2_2Little_sound u ((stageBPriority (shape 4 2 2)) 1) a) 6 a +def CB4_2_2I1R6Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB4_2_2I1R6Certificates_valid : + CB4_2_2I1R6Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB4_2_2I1R6CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB4_2_2I1R6P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB4_2_2I1R6Certificates (CB4_2_2I1R6CertificateIndex a)).input +lemma CB4_2_2I1R6P_check : ∀ a : Fin 6, contains (CB4_2_2I1R6Raw a) (CB4_2_2I1R6P a) = true := by + decide +kernel +lemma CB4_2_2I1R6P_sound (a : Fin 6) : + (CB4_2_2I1R6P a).Encloses (CB4_2_2I1R6Value a) := + contains_sound (CB4_2_2I1R6Raw_sound a) (CB4_2_2I1R6P_check a) +def CB4_2_2I1R6Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB4_2_2I1R6Certificates (CB4_2_2I1R6CertificateIndex a)).output +lemma CB4_2_2I1R6Terms_sound (a : Fin 6) : + (CB4_2_2I1R6Terms a).Encloses (Foundation.entropyTerm (CB4_2_2I1R6Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB4_2_2I1R6Certificates_valid + (CB4_2_2I1R6CertificateIndex a) (CB4_2_2I1R6P_sound a) +def CB4_2_2I1R6Entropy : Ball := ⟨0, 0⟩ +lemma CB4_2_2I1R6Entropy_sound : CB4_2_2I1R6Entropy.Encloses (Foundation.finiteEntropy CB4_2_2I1R6Value) := by + exact contains_sound (entropyFin_enclosed 6 CB4_2_2I1R6Value CB4_2_2I1R6Terms CB4_2_2I1R6Terms_sound) (by decide +kernel) +def CB4_2_2I1R6Mass : Ball := ⟨0, 0⟩ +lemma CB4_2_2I1R6Mass_sound : CB4_2_2I1R6Mass.Encloses (∑ a, CB4_2_2I1R6Value a) := by + exact contains_sound (finSumBall_sound 6 CB4_2_2I1R6P CB4_2_2I1R6Value CB4_2_2I1R6P_sound) (by decide +kernel) +def CB4_2_2I1R6MassTerm : Ball := .exact 0 +lemma CB4_2_2I1R6MassTerm_sound : CB4_2_2I1R6MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB4_2_2I1R6Value a))) := + entropyTerm_zero_ball (CB4_2_2I1R6Mass_sound) +def CB4_2_2I1R6H : Ball := ⟨0, 0⟩ +lemma CB4_2_2I1R6H_sound : CB4_2_2I1R6H.Encloses (homogeneousEntropy CB4_2_2I1R6Value) := by + exact contains_sound (homogeneous_enclosed CB4_2_2I1R6Value CB4_2_2I1R6MassTerm_sound CB4_2_2I1R6Entropy_sound) (by decide +kernel) +def CB4_2_2I1R7Value (a : Fin 6) : ℝ := residualLaw (below (shape 4 2 2)) (fun u => (stageBLaw (shape 4 2 2) u : ℝ)) (stageBPriority (shape 4 2 2)) 1 (fun u a => (littleLaw (shape 4 2 2) u ((stageBPriority (shape 4 2 2)) 1) a : ℝ)) 7 a +def CB4_2_2I1R7Raw (a : Fin 6) : Ball := residualBall (below (shape 4 2 2)) B4_2_2Law (stageBPriority (shape 4 2 2)) 1 (fun u => B4_2_2Little u ((stageBPriority (shape 4 2 2)) 1)) 7 a +lemma CB4_2_2I1R7Raw_sound (a : Fin 6) : + (CB4_2_2I1R7Raw a).Encloses (CB4_2_2I1R7Value a) := by + exact residualBall_sound_on (below (shape 4 2 2)) B4_2_2Law (fun u => (stageBLaw (shape 4 2 2) u : ℝ)) (stageBPriority (shape 4 2 2)) 1 (fun u => B4_2_2Little u ((stageBPriority (shape 4 2 2)) 1)) (fun u a => (littleLaw (shape 4 2 2) u ((stageBPriority (shape 4 2 2)) 1) a : ℝ)) (fun u _ => B4_2_2Law_sound u) (fun u _ a => B4_2_2Little_sound u ((stageBPriority (shape 4 2 2)) 1) a) 7 a +def CB4_2_2I1R7Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB4_2_2I1R7Certificates_valid : + CB4_2_2I1R7Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB4_2_2I1R7CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB4_2_2I1R7P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB4_2_2I1R7Certificates (CB4_2_2I1R7CertificateIndex a)).input +lemma CB4_2_2I1R7P_check : ∀ a : Fin 6, contains (CB4_2_2I1R7Raw a) (CB4_2_2I1R7P a) = true := by + decide +kernel +lemma CB4_2_2I1R7P_sound (a : Fin 6) : + (CB4_2_2I1R7P a).Encloses (CB4_2_2I1R7Value a) := + contains_sound (CB4_2_2I1R7Raw_sound a) (CB4_2_2I1R7P_check a) +def CB4_2_2I1R7Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB4_2_2I1R7Certificates (CB4_2_2I1R7CertificateIndex a)).output +lemma CB4_2_2I1R7Terms_sound (a : Fin 6) : + (CB4_2_2I1R7Terms a).Encloses (Foundation.entropyTerm (CB4_2_2I1R7Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB4_2_2I1R7Certificates_valid + (CB4_2_2I1R7CertificateIndex a) (CB4_2_2I1R7P_sound a) +def CB4_2_2I1R7Entropy : Ball := ⟨0, 0⟩ +lemma CB4_2_2I1R7Entropy_sound : CB4_2_2I1R7Entropy.Encloses (Foundation.finiteEntropy CB4_2_2I1R7Value) := by + exact contains_sound (entropyFin_enclosed 6 CB4_2_2I1R7Value CB4_2_2I1R7Terms CB4_2_2I1R7Terms_sound) (by decide +kernel) +def CB4_2_2I1R7Mass : Ball := ⟨0, 0⟩ +lemma CB4_2_2I1R7Mass_sound : CB4_2_2I1R7Mass.Encloses (∑ a, CB4_2_2I1R7Value a) := by + exact contains_sound (finSumBall_sound 6 CB4_2_2I1R7P CB4_2_2I1R7Value CB4_2_2I1R7P_sound) (by decide +kernel) +def CB4_2_2I1R7MassTerm : Ball := .exact 0 +lemma CB4_2_2I1R7MassTerm_sound : CB4_2_2I1R7MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB4_2_2I1R7Value a))) := + entropyTerm_zero_ball (CB4_2_2I1R7Mass_sound) +def CB4_2_2I1R7H : Ball := ⟨0, 0⟩ +lemma CB4_2_2I1R7H_sound : CB4_2_2I1R7H.Encloses (homogeneousEntropy CB4_2_2I1R7Value) := by + exact contains_sound (homogeneous_enclosed CB4_2_2I1R7Value CB4_2_2I1R7MassTerm_sound CB4_2_2I1R7Entropy_sound) (by decide +kernel) +def CB4_2_2I1R8Value (a : Fin 6) : ℝ := residualLaw (below (shape 4 2 2)) (fun u => (stageBLaw (shape 4 2 2) u : ℝ)) (stageBPriority (shape 4 2 2)) 1 (fun u a => (littleLaw (shape 4 2 2) u ((stageBPriority (shape 4 2 2)) 1) a : ℝ)) 8 a +def CB4_2_2I1R8Raw (a : Fin 6) : Ball := residualBall (below (shape 4 2 2)) B4_2_2Law (stageBPriority (shape 4 2 2)) 1 (fun u => B4_2_2Little u ((stageBPriority (shape 4 2 2)) 1)) 8 a +lemma CB4_2_2I1R8Raw_sound (a : Fin 6) : + (CB4_2_2I1R8Raw a).Encloses (CB4_2_2I1R8Value a) := by + exact residualBall_sound_on (below (shape 4 2 2)) B4_2_2Law (fun u => (stageBLaw (shape 4 2 2) u : ℝ)) (stageBPriority (shape 4 2 2)) 1 (fun u => B4_2_2Little u ((stageBPriority (shape 4 2 2)) 1)) (fun u a => (littleLaw (shape 4 2 2) u ((stageBPriority (shape 4 2 2)) 1) a : ℝ)) (fun u _ => B4_2_2Law_sound u) (fun u _ a => B4_2_2Little_sound u ((stageBPriority (shape 4 2 2)) 1) a) 8 a +def CB4_2_2I1R8Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB4_2_2I1R8Certificates_valid : + CB4_2_2I1R8Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB4_2_2I1R8CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB4_2_2I1R8P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB4_2_2I1R8Certificates (CB4_2_2I1R8CertificateIndex a)).input +lemma CB4_2_2I1R8P_check : ∀ a : Fin 6, contains (CB4_2_2I1R8Raw a) (CB4_2_2I1R8P a) = true := by + decide +kernel +lemma CB4_2_2I1R8P_sound (a : Fin 6) : + (CB4_2_2I1R8P a).Encloses (CB4_2_2I1R8Value a) := + contains_sound (CB4_2_2I1R8Raw_sound a) (CB4_2_2I1R8P_check a) +def CB4_2_2I1R8Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB4_2_2I1R8Certificates (CB4_2_2I1R8CertificateIndex a)).output +lemma CB4_2_2I1R8Terms_sound (a : Fin 6) : + (CB4_2_2I1R8Terms a).Encloses (Foundation.entropyTerm (CB4_2_2I1R8Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB4_2_2I1R8Certificates_valid + (CB4_2_2I1R8CertificateIndex a) (CB4_2_2I1R8P_sound a) +def CB4_2_2I1R8Entropy : Ball := ⟨0, 0⟩ +lemma CB4_2_2I1R8Entropy_sound : CB4_2_2I1R8Entropy.Encloses (Foundation.finiteEntropy CB4_2_2I1R8Value) := by + exact contains_sound (entropyFin_enclosed 6 CB4_2_2I1R8Value CB4_2_2I1R8Terms CB4_2_2I1R8Terms_sound) (by decide +kernel) +def CB4_2_2I1R8Mass : Ball := ⟨0, 0⟩ +lemma CB4_2_2I1R8Mass_sound : CB4_2_2I1R8Mass.Encloses (∑ a, CB4_2_2I1R8Value a) := by + exact contains_sound (finSumBall_sound 6 CB4_2_2I1R8P CB4_2_2I1R8Value CB4_2_2I1R8P_sound) (by decide +kernel) +def CB4_2_2I1R8MassTerm : Ball := .exact 0 +lemma CB4_2_2I1R8MassTerm_sound : CB4_2_2I1R8MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB4_2_2I1R8Value a))) := + entropyTerm_zero_ball (CB4_2_2I1R8Mass_sound) +def CB4_2_2I1R8H : Ball := ⟨0, 0⟩ +lemma CB4_2_2I1R8H_sound : CB4_2_2I1R8H.Encloses (homogeneousEntropy CB4_2_2I1R8Value) := by + exact contains_sound (homogeneous_enclosed CB4_2_2I1R8Value CB4_2_2I1R8MassTerm_sound CB4_2_2I1R8Entropy_sound) (by decide +kernel) +def CB4_2_2I1R9Value (a : Fin 6) : ℝ := residualLaw (below (shape 4 2 2)) (fun u => (stageBLaw (shape 4 2 2) u : ℝ)) (stageBPriority (shape 4 2 2)) 1 (fun u a => (littleLaw (shape 4 2 2) u ((stageBPriority (shape 4 2 2)) 1) a : ℝ)) 9 a +def CB4_2_2I1R9Raw (a : Fin 6) : Ball := residualBall (below (shape 4 2 2)) B4_2_2Law (stageBPriority (shape 4 2 2)) 1 (fun u => B4_2_2Little u ((stageBPriority (shape 4 2 2)) 1)) 9 a +lemma CB4_2_2I1R9Raw_sound (a : Fin 6) : + (CB4_2_2I1R9Raw a).Encloses (CB4_2_2I1R9Value a) := by + exact residualBall_sound_on (below (shape 4 2 2)) B4_2_2Law (fun u => (stageBLaw (shape 4 2 2) u : ℝ)) (stageBPriority (shape 4 2 2)) 1 (fun u => B4_2_2Little u ((stageBPriority (shape 4 2 2)) 1)) (fun u a => (littleLaw (shape 4 2 2) u ((stageBPriority (shape 4 2 2)) 1) a : ℝ)) (fun u _ => B4_2_2Law_sound u) (fun u _ a => B4_2_2Little_sound u ((stageBPriority (shape 4 2 2)) 1) a) 9 a +def CB4_2_2I1R9Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB4_2_2I1R9Certificates_valid : + CB4_2_2I1R9Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB4_2_2I1R9CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB4_2_2I1R9P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB4_2_2I1R9Certificates (CB4_2_2I1R9CertificateIndex a)).input +lemma CB4_2_2I1R9P_check : ∀ a : Fin 6, contains (CB4_2_2I1R9Raw a) (CB4_2_2I1R9P a) = true := by + decide +kernel +lemma CB4_2_2I1R9P_sound (a : Fin 6) : + (CB4_2_2I1R9P a).Encloses (CB4_2_2I1R9Value a) := + contains_sound (CB4_2_2I1R9Raw_sound a) (CB4_2_2I1R9P_check a) +def CB4_2_2I1R9Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB4_2_2I1R9Certificates (CB4_2_2I1R9CertificateIndex a)).output +lemma CB4_2_2I1R9Terms_sound (a : Fin 6) : + (CB4_2_2I1R9Terms a).Encloses (Foundation.entropyTerm (CB4_2_2I1R9Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB4_2_2I1R9Certificates_valid + (CB4_2_2I1R9CertificateIndex a) (CB4_2_2I1R9P_sound a) +def CB4_2_2I1R9Entropy : Ball := ⟨0, 0⟩ +lemma CB4_2_2I1R9Entropy_sound : CB4_2_2I1R9Entropy.Encloses (Foundation.finiteEntropy CB4_2_2I1R9Value) := by + exact contains_sound (entropyFin_enclosed 6 CB4_2_2I1R9Value CB4_2_2I1R9Terms CB4_2_2I1R9Terms_sound) (by decide +kernel) +def CB4_2_2I1R9Mass : Ball := ⟨0, 0⟩ +lemma CB4_2_2I1R9Mass_sound : CB4_2_2I1R9Mass.Encloses (∑ a, CB4_2_2I1R9Value a) := by + exact contains_sound (finSumBall_sound 6 CB4_2_2I1R9P CB4_2_2I1R9Value CB4_2_2I1R9P_sound) (by decide +kernel) +def CB4_2_2I1R9MassTerm : Ball := .exact 0 +lemma CB4_2_2I1R9MassTerm_sound : CB4_2_2I1R9MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB4_2_2I1R9Value a))) := + entropyTerm_zero_ball (CB4_2_2I1R9Mass_sound) +def CB4_2_2I1R9H : Ball := ⟨0, 0⟩ +lemma CB4_2_2I1R9H_sound : CB4_2_2I1R9H.Encloses (homogeneousEntropy CB4_2_2I1R9Value) := by + exact contains_sound (homogeneous_enclosed CB4_2_2I1R9Value CB4_2_2I1R9MassTerm_sound CB4_2_2I1R9Entropy_sound) (by decide +kernel) +def CB4_2_2I1R10Value (a : Fin 6) : ℝ := residualLaw (below (shape 4 2 2)) (fun u => (stageBLaw (shape 4 2 2) u : ℝ)) (stageBPriority (shape 4 2 2)) 1 (fun u a => (littleLaw (shape 4 2 2) u ((stageBPriority (shape 4 2 2)) 1) a : ℝ)) 10 a +def CB4_2_2I1R10Raw (a : Fin 6) : Ball := residualBall (below (shape 4 2 2)) B4_2_2Law (stageBPriority (shape 4 2 2)) 1 (fun u => B4_2_2Little u ((stageBPriority (shape 4 2 2)) 1)) 10 a +lemma CB4_2_2I1R10Raw_sound (a : Fin 6) : + (CB4_2_2I1R10Raw a).Encloses (CB4_2_2I1R10Value a) := by + exact residualBall_sound_on (below (shape 4 2 2)) B4_2_2Law (fun u => (stageBLaw (shape 4 2 2) u : ℝ)) (stageBPriority (shape 4 2 2)) 1 (fun u => B4_2_2Little u ((stageBPriority (shape 4 2 2)) 1)) (fun u a => (littleLaw (shape 4 2 2) u ((stageBPriority (shape 4 2 2)) 1) a : ℝ)) (fun u _ => B4_2_2Law_sound u) (fun u _ a => B4_2_2Little_sound u ((stageBPriority (shape 4 2 2)) 1) a) 10 a +def CB4_2_2I1R10Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB4_2_2I1R10Certificates_valid : + CB4_2_2I1R10Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB4_2_2I1R10CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB4_2_2I1R10P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB4_2_2I1R10Certificates (CB4_2_2I1R10CertificateIndex a)).input +lemma CB4_2_2I1R10P_check : ∀ a : Fin 6, contains (CB4_2_2I1R10Raw a) (CB4_2_2I1R10P a) = true := by + decide +kernel +lemma CB4_2_2I1R10P_sound (a : Fin 6) : + (CB4_2_2I1R10P a).Encloses (CB4_2_2I1R10Value a) := + contains_sound (CB4_2_2I1R10Raw_sound a) (CB4_2_2I1R10P_check a) +def CB4_2_2I1R10Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB4_2_2I1R10Certificates (CB4_2_2I1R10CertificateIndex a)).output +lemma CB4_2_2I1R10Terms_sound (a : Fin 6) : + (CB4_2_2I1R10Terms a).Encloses (Foundation.entropyTerm (CB4_2_2I1R10Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB4_2_2I1R10Certificates_valid + (CB4_2_2I1R10CertificateIndex a) (CB4_2_2I1R10P_sound a) +def CB4_2_2I1R10Entropy : Ball := ⟨0, 0⟩ +lemma CB4_2_2I1R10Entropy_sound : CB4_2_2I1R10Entropy.Encloses (Foundation.finiteEntropy CB4_2_2I1R10Value) := by + exact contains_sound (entropyFin_enclosed 6 CB4_2_2I1R10Value CB4_2_2I1R10Terms CB4_2_2I1R10Terms_sound) (by decide +kernel) +def CB4_2_2I1R10Mass : Ball := ⟨0, 0⟩ +lemma CB4_2_2I1R10Mass_sound : CB4_2_2I1R10Mass.Encloses (∑ a, CB4_2_2I1R10Value a) := by + exact contains_sound (finSumBall_sound 6 CB4_2_2I1R10P CB4_2_2I1R10Value CB4_2_2I1R10P_sound) (by decide +kernel) +def CB4_2_2I1R10MassTerm : Ball := .exact 0 +lemma CB4_2_2I1R10MassTerm_sound : CB4_2_2I1R10MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB4_2_2I1R10Value a))) := + entropyTerm_zero_ball (CB4_2_2I1R10Mass_sound) +def CB4_2_2I1R10H : Ball := ⟨0, 0⟩ +lemma CB4_2_2I1R10H_sound : CB4_2_2I1R10H.Encloses (homogeneousEntropy CB4_2_2I1R10Value) := by + exact contains_sound (homogeneous_enclosed CB4_2_2I1R10Value CB4_2_2I1R10MassTerm_sound CB4_2_2I1R10Entropy_sound) (by decide +kernel) +def CB4_2_2I1R11Value (a : Fin 6) : ℝ := residualLaw (below (shape 4 2 2)) (fun u => (stageBLaw (shape 4 2 2) u : ℝ)) (stageBPriority (shape 4 2 2)) 1 (fun u a => (littleLaw (shape 4 2 2) u ((stageBPriority (shape 4 2 2)) 1) a : ℝ)) 11 a +def CB4_2_2I1R11Raw (a : Fin 6) : Ball := residualBall (below (shape 4 2 2)) B4_2_2Law (stageBPriority (shape 4 2 2)) 1 (fun u => B4_2_2Little u ((stageBPriority (shape 4 2 2)) 1)) 11 a +lemma CB4_2_2I1R11Raw_sound (a : Fin 6) : + (CB4_2_2I1R11Raw a).Encloses (CB4_2_2I1R11Value a) := by + exact residualBall_sound_on (below (shape 4 2 2)) B4_2_2Law (fun u => (stageBLaw (shape 4 2 2) u : ℝ)) (stageBPriority (shape 4 2 2)) 1 (fun u => B4_2_2Little u ((stageBPriority (shape 4 2 2)) 1)) (fun u a => (littleLaw (shape 4 2 2) u ((stageBPriority (shape 4 2 2)) 1) a : ℝ)) (fun u _ => B4_2_2Law_sound u) (fun u _ a => B4_2_2Little_sound u ((stageBPriority (shape 4 2 2)) 1) a) 11 a +def CB4_2_2I1R11Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB4_2_2I1R11Certificates_valid : + CB4_2_2I1R11Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB4_2_2I1R11CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB4_2_2I1R11P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB4_2_2I1R11Certificates (CB4_2_2I1R11CertificateIndex a)).input +lemma CB4_2_2I1R11P_check : ∀ a : Fin 6, contains (CB4_2_2I1R11Raw a) (CB4_2_2I1R11P a) = true := by + decide +kernel +lemma CB4_2_2I1R11P_sound (a : Fin 6) : + (CB4_2_2I1R11P a).Encloses (CB4_2_2I1R11Value a) := + contains_sound (CB4_2_2I1R11Raw_sound a) (CB4_2_2I1R11P_check a) +def CB4_2_2I1R11Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB4_2_2I1R11Certificates (CB4_2_2I1R11CertificateIndex a)).output +lemma CB4_2_2I1R11Terms_sound (a : Fin 6) : + (CB4_2_2I1R11Terms a).Encloses (Foundation.entropyTerm (CB4_2_2I1R11Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB4_2_2I1R11Certificates_valid + (CB4_2_2I1R11CertificateIndex a) (CB4_2_2I1R11P_sound a) +def CB4_2_2I1R11Entropy : Ball := ⟨0, 0⟩ +lemma CB4_2_2I1R11Entropy_sound : CB4_2_2I1R11Entropy.Encloses (Foundation.finiteEntropy CB4_2_2I1R11Value) := by + exact contains_sound (entropyFin_enclosed 6 CB4_2_2I1R11Value CB4_2_2I1R11Terms CB4_2_2I1R11Terms_sound) (by decide +kernel) +def CB4_2_2I1R11Mass : Ball := ⟨0, 0⟩ +lemma CB4_2_2I1R11Mass_sound : CB4_2_2I1R11Mass.Encloses (∑ a, CB4_2_2I1R11Value a) := by + exact contains_sound (finSumBall_sound 6 CB4_2_2I1R11P CB4_2_2I1R11Value CB4_2_2I1R11P_sound) (by decide +kernel) +def CB4_2_2I1R11MassTerm : Ball := .exact 0 +lemma CB4_2_2I1R11MassTerm_sound : CB4_2_2I1R11MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB4_2_2I1R11Value a))) := + entropyTerm_zero_ball (CB4_2_2I1R11Mass_sound) +def CB4_2_2I1R11H : Ball := ⟨0, 0⟩ +lemma CB4_2_2I1R11H_sound : CB4_2_2I1R11H.Encloses (homogeneousEntropy CB4_2_2I1R11Value) := by + exact contains_sound (homogeneous_enclosed CB4_2_2I1R11Value CB4_2_2I1R11MassTerm_sound CB4_2_2I1R11Entropy_sound) (by decide +kernel) +def CB4_2_2I1R12Value (a : Fin 6) : ℝ := residualLaw (below (shape 4 2 2)) (fun u => (stageBLaw (shape 4 2 2) u : ℝ)) (stageBPriority (shape 4 2 2)) 1 (fun u a => (littleLaw (shape 4 2 2) u ((stageBPriority (shape 4 2 2)) 1) a : ℝ)) 12 a +def CB4_2_2I1R12Raw (a : Fin 6) : Ball := residualBall (below (shape 4 2 2)) B4_2_2Law (stageBPriority (shape 4 2 2)) 1 (fun u => B4_2_2Little u ((stageBPriority (shape 4 2 2)) 1)) 12 a +lemma CB4_2_2I1R12Raw_sound (a : Fin 6) : + (CB4_2_2I1R12Raw a).Encloses (CB4_2_2I1R12Value a) := by + exact residualBall_sound_on (below (shape 4 2 2)) B4_2_2Law (fun u => (stageBLaw (shape 4 2 2) u : ℝ)) (stageBPriority (shape 4 2 2)) 1 (fun u => B4_2_2Little u ((stageBPriority (shape 4 2 2)) 1)) (fun u a => (littleLaw (shape 4 2 2) u ((stageBPriority (shape 4 2 2)) 1) a : ℝ)) (fun u _ => B4_2_2Law_sound u) (fun u _ a => B4_2_2Little_sound u ((stageBPriority (shape 4 2 2)) 1) a) 12 a +def CB4_2_2I1R12Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB4_2_2I1R12Certificates_valid : + CB4_2_2I1R12Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB4_2_2I1R12CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB4_2_2I1R12P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB4_2_2I1R12Certificates (CB4_2_2I1R12CertificateIndex a)).input +lemma CB4_2_2I1R12P_check : ∀ a : Fin 6, contains (CB4_2_2I1R12Raw a) (CB4_2_2I1R12P a) = true := by + decide +kernel +lemma CB4_2_2I1R12P_sound (a : Fin 6) : + (CB4_2_2I1R12P a).Encloses (CB4_2_2I1R12Value a) := + contains_sound (CB4_2_2I1R12Raw_sound a) (CB4_2_2I1R12P_check a) +def CB4_2_2I1R12Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB4_2_2I1R12Certificates (CB4_2_2I1R12CertificateIndex a)).output +lemma CB4_2_2I1R12Terms_sound (a : Fin 6) : + (CB4_2_2I1R12Terms a).Encloses (Foundation.entropyTerm (CB4_2_2I1R12Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB4_2_2I1R12Certificates_valid + (CB4_2_2I1R12CertificateIndex a) (CB4_2_2I1R12P_sound a) +def CB4_2_2I1R12Entropy : Ball := ⟨0, 0⟩ +lemma CB4_2_2I1R12Entropy_sound : CB4_2_2I1R12Entropy.Encloses (Foundation.finiteEntropy CB4_2_2I1R12Value) := by + exact contains_sound (entropyFin_enclosed 6 CB4_2_2I1R12Value CB4_2_2I1R12Terms CB4_2_2I1R12Terms_sound) (by decide +kernel) +def CB4_2_2I1R12Mass : Ball := ⟨0, 0⟩ +lemma CB4_2_2I1R12Mass_sound : CB4_2_2I1R12Mass.Encloses (∑ a, CB4_2_2I1R12Value a) := by + exact contains_sound (finSumBall_sound 6 CB4_2_2I1R12P CB4_2_2I1R12Value CB4_2_2I1R12P_sound) (by decide +kernel) +def CB4_2_2I1R12MassTerm : Ball := .exact 0 +lemma CB4_2_2I1R12MassTerm_sound : CB4_2_2I1R12MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB4_2_2I1R12Value a))) := + entropyTerm_zero_ball (CB4_2_2I1R12Mass_sound) +def CB4_2_2I1R12H : Ball := ⟨0, 0⟩ +lemma CB4_2_2I1R12H_sound : CB4_2_2I1R12H.Encloses (homogeneousEntropy CB4_2_2I1R12Value) := by + exact contains_sound (homogeneous_enclosed CB4_2_2I1R12Value CB4_2_2I1R12MassTerm_sound CB4_2_2I1R12Entropy_sound) (by decide +kernel) +def CB4_2_2I1R13Value (a : Fin 6) : ℝ := residualLaw (below (shape 4 2 2)) (fun u => (stageBLaw (shape 4 2 2) u : ℝ)) (stageBPriority (shape 4 2 2)) 1 (fun u a => (littleLaw (shape 4 2 2) u ((stageBPriority (shape 4 2 2)) 1) a : ℝ)) 13 a +def CB4_2_2I1R13Raw (a : Fin 6) : Ball := residualBall (below (shape 4 2 2)) B4_2_2Law (stageBPriority (shape 4 2 2)) 1 (fun u => B4_2_2Little u ((stageBPriority (shape 4 2 2)) 1)) 13 a +lemma CB4_2_2I1R13Raw_sound (a : Fin 6) : + (CB4_2_2I1R13Raw a).Encloses (CB4_2_2I1R13Value a) := by + exact residualBall_sound_on (below (shape 4 2 2)) B4_2_2Law (fun u => (stageBLaw (shape 4 2 2) u : ℝ)) (stageBPriority (shape 4 2 2)) 1 (fun u => B4_2_2Little u ((stageBPriority (shape 4 2 2)) 1)) (fun u a => (littleLaw (shape 4 2 2) u ((stageBPriority (shape 4 2 2)) 1) a : ℝ)) (fun u _ => B4_2_2Law_sound u) (fun u _ a => B4_2_2Little_sound u ((stageBPriority (shape 4 2 2)) 1) a) 13 a +def CB4_2_2I1R13Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB4_2_2I1R13Certificates_valid : + CB4_2_2I1R13Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB4_2_2I1R13CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB4_2_2I1R13P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB4_2_2I1R13Certificates (CB4_2_2I1R13CertificateIndex a)).input +lemma CB4_2_2I1R13P_check : ∀ a : Fin 6, contains (CB4_2_2I1R13Raw a) (CB4_2_2I1R13P a) = true := by + decide +kernel +lemma CB4_2_2I1R13P_sound (a : Fin 6) : + (CB4_2_2I1R13P a).Encloses (CB4_2_2I1R13Value a) := + contains_sound (CB4_2_2I1R13Raw_sound a) (CB4_2_2I1R13P_check a) +def CB4_2_2I1R13Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB4_2_2I1R13Certificates (CB4_2_2I1R13CertificateIndex a)).output +lemma CB4_2_2I1R13Terms_sound (a : Fin 6) : + (CB4_2_2I1R13Terms a).Encloses (Foundation.entropyTerm (CB4_2_2I1R13Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB4_2_2I1R13Certificates_valid + (CB4_2_2I1R13CertificateIndex a) (CB4_2_2I1R13P_sound a) +def CB4_2_2I1R13Entropy : Ball := ⟨0, 0⟩ +lemma CB4_2_2I1R13Entropy_sound : CB4_2_2I1R13Entropy.Encloses (Foundation.finiteEntropy CB4_2_2I1R13Value) := by + exact contains_sound (entropyFin_enclosed 6 CB4_2_2I1R13Value CB4_2_2I1R13Terms CB4_2_2I1R13Terms_sound) (by decide +kernel) +def CB4_2_2I1R13Mass : Ball := ⟨0, 0⟩ +lemma CB4_2_2I1R13Mass_sound : CB4_2_2I1R13Mass.Encloses (∑ a, CB4_2_2I1R13Value a) := by + exact contains_sound (finSumBall_sound 6 CB4_2_2I1R13P CB4_2_2I1R13Value CB4_2_2I1R13P_sound) (by decide +kernel) +def CB4_2_2I1R13MassTerm : Ball := .exact 0 +lemma CB4_2_2I1R13MassTerm_sound : CB4_2_2I1R13MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB4_2_2I1R13Value a))) := + entropyTerm_zero_ball (CB4_2_2I1R13Mass_sound) +def CB4_2_2I1R13H : Ball := ⟨0, 0⟩ +lemma CB4_2_2I1R13H_sound : CB4_2_2I1R13H.Encloses (homogeneousEntropy CB4_2_2I1R13Value) := by + exact contains_sound (homogeneous_enclosed CB4_2_2I1R13Value CB4_2_2I1R13MassTerm_sound CB4_2_2I1R13Entropy_sound) (by decide +kernel) +def CB4_2_2I1R14Value (a : Fin 6) : ℝ := residualLaw (below (shape 4 2 2)) (fun u => (stageBLaw (shape 4 2 2) u : ℝ)) (stageBPriority (shape 4 2 2)) 1 (fun u a => (littleLaw (shape 4 2 2) u ((stageBPriority (shape 4 2 2)) 1) a : ℝ)) 14 a +def CB4_2_2I1R14Raw (a : Fin 6) : Ball := residualBall (below (shape 4 2 2)) B4_2_2Law (stageBPriority (shape 4 2 2)) 1 (fun u => B4_2_2Little u ((stageBPriority (shape 4 2 2)) 1)) 14 a +lemma CB4_2_2I1R14Raw_sound (a : Fin 6) : + (CB4_2_2I1R14Raw a).Encloses (CB4_2_2I1R14Value a) := by + exact residualBall_sound_on (below (shape 4 2 2)) B4_2_2Law (fun u => (stageBLaw (shape 4 2 2) u : ℝ)) (stageBPriority (shape 4 2 2)) 1 (fun u => B4_2_2Little u ((stageBPriority (shape 4 2 2)) 1)) (fun u a => (littleLaw (shape 4 2 2) u ((stageBPriority (shape 4 2 2)) 1) a : ℝ)) (fun u _ => B4_2_2Law_sound u) (fun u _ a => B4_2_2Little_sound u ((stageBPriority (shape 4 2 2)) 1) a) 14 a +def CB4_2_2I1R14Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB4_2_2I1R14Certificates_valid : + CB4_2_2I1R14Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB4_2_2I1R14CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB4_2_2I1R14P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB4_2_2I1R14Certificates (CB4_2_2I1R14CertificateIndex a)).input +lemma CB4_2_2I1R14P_check : ∀ a : Fin 6, contains (CB4_2_2I1R14Raw a) (CB4_2_2I1R14P a) = true := by + decide +kernel +lemma CB4_2_2I1R14P_sound (a : Fin 6) : + (CB4_2_2I1R14P a).Encloses (CB4_2_2I1R14Value a) := + contains_sound (CB4_2_2I1R14Raw_sound a) (CB4_2_2I1R14P_check a) +def CB4_2_2I1R14Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB4_2_2I1R14Certificates (CB4_2_2I1R14CertificateIndex a)).output +lemma CB4_2_2I1R14Terms_sound (a : Fin 6) : + (CB4_2_2I1R14Terms a).Encloses (Foundation.entropyTerm (CB4_2_2I1R14Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB4_2_2I1R14Certificates_valid + (CB4_2_2I1R14CertificateIndex a) (CB4_2_2I1R14P_sound a) +def CB4_2_2I1R14Entropy : Ball := ⟨0, 0⟩ +lemma CB4_2_2I1R14Entropy_sound : CB4_2_2I1R14Entropy.Encloses (Foundation.finiteEntropy CB4_2_2I1R14Value) := by + exact contains_sound (entropyFin_enclosed 6 CB4_2_2I1R14Value CB4_2_2I1R14Terms CB4_2_2I1R14Terms_sound) (by decide +kernel) +def CB4_2_2I1R14Mass : Ball := ⟨0, 0⟩ +lemma CB4_2_2I1R14Mass_sound : CB4_2_2I1R14Mass.Encloses (∑ a, CB4_2_2I1R14Value a) := by + exact contains_sound (finSumBall_sound 6 CB4_2_2I1R14P CB4_2_2I1R14Value CB4_2_2I1R14P_sound) (by decide +kernel) +def CB4_2_2I1R14MassTerm : Ball := .exact 0 +lemma CB4_2_2I1R14MassTerm_sound : CB4_2_2I1R14MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB4_2_2I1R14Value a))) := + entropyTerm_zero_ball (CB4_2_2I1R14Mass_sound) +def CB4_2_2I1R14H : Ball := ⟨0, 0⟩ +lemma CB4_2_2I1R14H_sound : CB4_2_2I1R14H.Encloses (homogeneousEntropy CB4_2_2I1R14Value) := by + exact contains_sound (homogeneous_enclosed CB4_2_2I1R14Value CB4_2_2I1R14MassTerm_sound CB4_2_2I1R14Entropy_sound) (by decide +kernel) +def CB4_2_2I1R15Value (a : Fin 6) : ℝ := residualLaw (below (shape 4 2 2)) (fun u => (stageBLaw (shape 4 2 2) u : ℝ)) (stageBPriority (shape 4 2 2)) 1 (fun u a => (littleLaw (shape 4 2 2) u ((stageBPriority (shape 4 2 2)) 1) a : ℝ)) 15 a +def CB4_2_2I1R15Raw (a : Fin 6) : Ball := residualBall (below (shape 4 2 2)) B4_2_2Law (stageBPriority (shape 4 2 2)) 1 (fun u => B4_2_2Little u ((stageBPriority (shape 4 2 2)) 1)) 15 a +lemma CB4_2_2I1R15Raw_sound (a : Fin 6) : + (CB4_2_2I1R15Raw a).Encloses (CB4_2_2I1R15Value a) := by + exact residualBall_sound_on (below (shape 4 2 2)) B4_2_2Law (fun u => (stageBLaw (shape 4 2 2) u : ℝ)) (stageBPriority (shape 4 2 2)) 1 (fun u => B4_2_2Little u ((stageBPriority (shape 4 2 2)) 1)) (fun u a => (littleLaw (shape 4 2 2) u ((stageBPriority (shape 4 2 2)) 1) a : ℝ)) (fun u _ => B4_2_2Law_sound u) (fun u _ a => B4_2_2Little_sound u ((stageBPriority (shape 4 2 2)) 1) a) 15 a +def CB4_2_2I1R15Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB4_2_2I1R15Certificates_valid : + CB4_2_2I1R15Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB4_2_2I1R15CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB4_2_2I1R15P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB4_2_2I1R15Certificates (CB4_2_2I1R15CertificateIndex a)).input +lemma CB4_2_2I1R15P_check : ∀ a : Fin 6, contains (CB4_2_2I1R15Raw a) (CB4_2_2I1R15P a) = true := by + decide +kernel +lemma CB4_2_2I1R15P_sound (a : Fin 6) : + (CB4_2_2I1R15P a).Encloses (CB4_2_2I1R15Value a) := + contains_sound (CB4_2_2I1R15Raw_sound a) (CB4_2_2I1R15P_check a) +def CB4_2_2I1R15Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB4_2_2I1R15Certificates (CB4_2_2I1R15CertificateIndex a)).output +lemma CB4_2_2I1R15Terms_sound (a : Fin 6) : + (CB4_2_2I1R15Terms a).Encloses (Foundation.entropyTerm (CB4_2_2I1R15Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB4_2_2I1R15Certificates_valid + (CB4_2_2I1R15CertificateIndex a) (CB4_2_2I1R15P_sound a) +def CB4_2_2I1R15Entropy : Ball := ⟨0, 0⟩ +lemma CB4_2_2I1R15Entropy_sound : CB4_2_2I1R15Entropy.Encloses (Foundation.finiteEntropy CB4_2_2I1R15Value) := by + exact contains_sound (entropyFin_enclosed 6 CB4_2_2I1R15Value CB4_2_2I1R15Terms CB4_2_2I1R15Terms_sound) (by decide +kernel) +def CB4_2_2I1R15Mass : Ball := ⟨0, 0⟩ +lemma CB4_2_2I1R15Mass_sound : CB4_2_2I1R15Mass.Encloses (∑ a, CB4_2_2I1R15Value a) := by + exact contains_sound (finSumBall_sound 6 CB4_2_2I1R15P CB4_2_2I1R15Value CB4_2_2I1R15P_sound) (by decide +kernel) +def CB4_2_2I1R15MassTerm : Ball := .exact 0 +lemma CB4_2_2I1R15MassTerm_sound : CB4_2_2I1R15MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB4_2_2I1R15Value a))) := + entropyTerm_zero_ball (CB4_2_2I1R15Mass_sound) +def CB4_2_2I1R15H : Ball := ⟨0, 0⟩ +lemma CB4_2_2I1R15H_sound : CB4_2_2I1R15H.Encloses (homogeneousEntropy CB4_2_2I1R15Value) := by + exact contains_sound (homogeneous_enclosed CB4_2_2I1R15Value CB4_2_2I1R15MassTerm_sound CB4_2_2I1R15Entropy_sound) (by decide +kernel) +def CB4_2_2I1R16Value (a : Fin 6) : ℝ := residualLaw (below (shape 4 2 2)) (fun u => (stageBLaw (shape 4 2 2) u : ℝ)) (stageBPriority (shape 4 2 2)) 1 (fun u a => (littleLaw (shape 4 2 2) u ((stageBPriority (shape 4 2 2)) 1) a : ℝ)) 16 a +def CB4_2_2I1R16Raw (a : Fin 6) : Ball := residualBall (below (shape 4 2 2)) B4_2_2Law (stageBPriority (shape 4 2 2)) 1 (fun u => B4_2_2Little u ((stageBPriority (shape 4 2 2)) 1)) 16 a +lemma CB4_2_2I1R16Raw_sound (a : Fin 6) : + (CB4_2_2I1R16Raw a).Encloses (CB4_2_2I1R16Value a) := by + exact residualBall_sound_on (below (shape 4 2 2)) B4_2_2Law (fun u => (stageBLaw (shape 4 2 2) u : ℝ)) (stageBPriority (shape 4 2 2)) 1 (fun u => B4_2_2Little u ((stageBPriority (shape 4 2 2)) 1)) (fun u a => (littleLaw (shape 4 2 2) u ((stageBPriority (shape 4 2 2)) 1) a : ℝ)) (fun u _ => B4_2_2Law_sound u) (fun u _ a => B4_2_2Little_sound u ((stageBPriority (shape 4 2 2)) 1) a) 16 a +def CB4_2_2I1R16Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB4_2_2I1R16Certificates_valid : + CB4_2_2I1R16Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB4_2_2I1R16CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB4_2_2I1R16P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB4_2_2I1R16Certificates (CB4_2_2I1R16CertificateIndex a)).input +lemma CB4_2_2I1R16P_check : ∀ a : Fin 6, contains (CB4_2_2I1R16Raw a) (CB4_2_2I1R16P a) = true := by + decide +kernel +lemma CB4_2_2I1R16P_sound (a : Fin 6) : + (CB4_2_2I1R16P a).Encloses (CB4_2_2I1R16Value a) := + contains_sound (CB4_2_2I1R16Raw_sound a) (CB4_2_2I1R16P_check a) +def CB4_2_2I1R16Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB4_2_2I1R16Certificates (CB4_2_2I1R16CertificateIndex a)).output +lemma CB4_2_2I1R16Terms_sound (a : Fin 6) : + (CB4_2_2I1R16Terms a).Encloses (Foundation.entropyTerm (CB4_2_2I1R16Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB4_2_2I1R16Certificates_valid + (CB4_2_2I1R16CertificateIndex a) (CB4_2_2I1R16P_sound a) +def CB4_2_2I1R16Entropy : Ball := ⟨0, 0⟩ +lemma CB4_2_2I1R16Entropy_sound : CB4_2_2I1R16Entropy.Encloses (Foundation.finiteEntropy CB4_2_2I1R16Value) := by + exact contains_sound (entropyFin_enclosed 6 CB4_2_2I1R16Value CB4_2_2I1R16Terms CB4_2_2I1R16Terms_sound) (by decide +kernel) +def CB4_2_2I1R16Mass : Ball := ⟨0, 0⟩ +lemma CB4_2_2I1R16Mass_sound : CB4_2_2I1R16Mass.Encloses (∑ a, CB4_2_2I1R16Value a) := by + exact contains_sound (finSumBall_sound 6 CB4_2_2I1R16P CB4_2_2I1R16Value CB4_2_2I1R16P_sound) (by decide +kernel) +def CB4_2_2I1R16MassTerm : Ball := .exact 0 +lemma CB4_2_2I1R16MassTerm_sound : CB4_2_2I1R16MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB4_2_2I1R16Value a))) := + entropyTerm_zero_ball (CB4_2_2I1R16Mass_sound) +def CB4_2_2I1R16H : Ball := ⟨0, 0⟩ +lemma CB4_2_2I1R16H_sound : CB4_2_2I1R16H.Encloses (homogeneousEntropy CB4_2_2I1R16Value) := by + exact contains_sound (homogeneous_enclosed CB4_2_2I1R16Value CB4_2_2I1R16MassTerm_sound CB4_2_2I1R16Entropy_sound) (by decide +kernel) +def CB4_2_2I1ResidualEntropies (a : Fin 17) : Ball := + match a.val with + | 0 => CB4_2_2I1R0H + | 1 => CB4_2_2I1R1H + | 2 => CB4_2_2I1R2H + | 3 => CB4_2_2I1R3H + | 4 => CB4_2_2I1R4H + | 5 => CB4_2_2I1R5H + | 6 => CB4_2_2I1R6H + | 7 => CB4_2_2I1R7H + | 8 => CB4_2_2I1R8H + | 9 => CB4_2_2I1R9H + | 10 => CB4_2_2I1R10H + | 11 => CB4_2_2I1R11H + | 12 => CB4_2_2I1R12H + | 13 => CB4_2_2I1R13H + | 14 => CB4_2_2I1R14H + | 15 => CB4_2_2I1R15H + | 16 => CB4_2_2I1R16H + | _ => (.exact 0) +lemma CB4_2_2I1ResidualEntropies_sound (k : Fin 17) : + (CB4_2_2I1ResidualEntropies k).Encloses (homogeneousEntropy + (residualLaw (below (shape 4 2 2)) (fun u => (stageBLaw (shape 4 2 2) u : ℝ)) (stageBPriority (shape 4 2 2)) 1 (fun u a => (littleLaw (shape 4 2 2) u ((stageBPriority (shape 4 2 2)) 1) a : ℝ)) k)) := by + fin_cases k + · exact CB4_2_2I1R0H_sound + · exact CB4_2_2I1R1H_sound + · exact CB4_2_2I1R2H_sound + · exact CB4_2_2I1R3H_sound + · exact CB4_2_2I1R4H_sound + · exact CB4_2_2I1R5H_sound + · exact CB4_2_2I1R6H_sound + · exact CB4_2_2I1R7H_sound + · exact CB4_2_2I1R8H_sound + · exact CB4_2_2I1R9H_sound + · exact CB4_2_2I1R10H_sound + · exact CB4_2_2I1R11H_sound + · exact CB4_2_2I1R12H_sound + · exact CB4_2_2I1R13H_sound + · exact CB4_2_2I1R14H_sound + · exact CB4_2_2I1R15H_sound + · exact CB4_2_2I1R16H_sound +def CB4_2_2I1S0_2_2Value (a : Fin 6) : ℝ := (littleLaw (shape 4 2 2) (shape 0 2 2) ((stageBPriority (shape 4 2 2)) 1) a : ℝ) +def CB4_2_2I1S0_2_2E_2LogWitness : LogWitness := ⟨-1, 936679, 500000⟩ +def CB4_2_2I1S0_2_2E_2Log : Ball := ⟨(-6541463814935642164057959379121 / 100000000000000000000000000000000), (21175823683 / 50000000000000000000000000000000)⟩ +lemma CB4_2_2I1S0_2_2E_2Log_sound : CB4_2_2I1S0_2_2E_2Log.Encloses (Real.log (CB4_2_2I1S0_2_2Value (2 : Fin 6))) := by + exact checkLog_sound logTwoBall_sound ((B4_2_2Little_sound (shape 0 2 2) ((stageBPriority (shape 4 2 2)) 1)) (2 : Fin 6)) (w := CB4_2_2I1S0_2_2E_2LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB4_2_2I1S0_2_2E_2 : Ball := ⟨(1531812946177525591646911333319 / 25000000000000000000000000000000), (2479368669 / 6250000000000000000000000000000)⟩ +lemma CB4_2_2I1S0_2_2E_2_sound : CB4_2_2I1S0_2_2E_2.Encloses (Foundation.entropyTerm (CB4_2_2I1S0_2_2Value (2 : Fin 6))) := by + exact contains_sound (entropyTerm_ball ((B4_2_2Little_sound (shape 0 2 2) ((stageBPriority (shape 4 2 2)) 1)) (2 : Fin 6)) CB4_2_2I1S0_2_2E_2Log_sound) (by decide +kernel) +def CB4_2_2I1S0_2_2E_3LogWitness : LogWitness := ⟨-4, 63321, 62500⟩ +def CB4_2_2I1S0_2_2E_3Log : Ball := ⟨(-275953825129554669064816416181401 / 100000000000000000000000000000000), (52939559207 / 50000000000000000000000000000000)⟩ +lemma CB4_2_2I1S0_2_2E_3Log_sound : CB4_2_2I1S0_2_2E_3Log.Encloses (Real.log (CB4_2_2I1S0_2_2Value (3 : Fin 6))) := by + exact checkLog_sound logTwoBall_sound ((B4_2_2Little_sound (shape 0 2 2) ((stageBPriority (shape 4 2 2)) 1)) (3 : Fin 6)) (w := CB4_2_2I1S0_2_2E_3LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB4_2_2I1S0_2_2E_3 : Ball := ⟨(8736836080514265599926620144511 / 50000000000000000000000000000000), (3352185829 / 50000000000000000000000000000000)⟩ +lemma CB4_2_2I1S0_2_2E_3_sound : CB4_2_2I1S0_2_2E_3.Encloses (Foundation.entropyTerm (CB4_2_2I1S0_2_2Value (3 : Fin 6))) := by + exact contains_sound (entropyTerm_ball ((B4_2_2Little_sound (shape 0 2 2) ((stageBPriority (shape 4 2 2)) 1)) (3 : Fin 6)) CB4_2_2I1S0_2_2E_3Log_sound) (by decide +kernel) +def CB4_2_2I1S0_2_2Terms (a : Fin 6) : Ball := + match a.val with + | 2 => ⟨(1531812946177525591646911333319 / 25000000000000000000000000000000), (2479368669 / 6250000000000000000000000000000)⟩ + | 3 => ⟨(8736836080514265599926620144511 / 50000000000000000000000000000000), (3352185829 / 50000000000000000000000000000000)⟩ + | _ => (.exact 0) +lemma CB4_2_2I1S0_2_2Terms_sound (a : Fin 6) : + (CB4_2_2I1S0_2_2Terms a).Encloses (Foundation.entropyTerm (CB4_2_2I1S0_2_2Value a)) := by + fin_cases a + · exact (entropyTerm_zero_ball ((B4_2_2Little_sound (shape 0 2 2) ((stageBPriority (shape 4 2 2)) 1)) (0 : Fin 6))) + · exact (entropyTerm_zero_ball ((B4_2_2Little_sound (shape 0 2 2) ((stageBPriority (shape 4 2 2)) 1)) (1 : Fin 6))) + · exact CB4_2_2I1S0_2_2E_2_sound + · exact CB4_2_2I1S0_2_2E_3_sound + · exact (entropyTerm_zero_ball ((B4_2_2Little_sound (shape 0 2 2) ((stageBPriority (shape 4 2 2)) 1)) (4 : Fin 6))) + · exact (entropyTerm_zero_ball ((B4_2_2Little_sound (shape 0 2 2) ((stageBPriority (shape 4 2 2)) 1)) (5 : Fin 6))) +def CB4_2_2I1S0_2_2Entropy : Ball := ⟨(11800461972869316783220442811149 / 50000000000000000000000000000000), (23187135181 / 50000000000000000000000000000000)⟩ +lemma CB4_2_2I1S0_2_2Entropy_sound : CB4_2_2I1S0_2_2Entropy.Encloses (Foundation.finiteEntropy CB4_2_2I1S0_2_2Value) := by + exact contains_sound (entropyFin_enclosed 6 CB4_2_2I1S0_2_2Value CB4_2_2I1S0_2_2Terms CB4_2_2I1S0_2_2Terms_sound) (by decide +kernel) +def CB4_2_2I1S0_2_2Mass : Ball := ⟨1, 0⟩ +lemma CB4_2_2I1S0_2_2Mass_sound : CB4_2_2I1S0_2_2Mass.Encloses (∑ a, CB4_2_2I1S0_2_2Value a) := by + exact contains_sound (finSumBall_sound 6 (B4_2_2Little (shape 0 2 2) ((stageBPriority (shape 4 2 2)) 1)) CB4_2_2I1S0_2_2Value (B4_2_2Little_sound (shape 0 2 2) ((stageBPriority (shape 4 2 2)) 1))) (by decide +kernel) +def CB4_2_2I1S0_2_2MassTermLog : Ball := .exact 0 +lemma CB4_2_2I1S0_2_2MassTermLog_sound : CB4_2_2I1S0_2_2MassTermLog.Encloses (Real.log ((∑ a, CB4_2_2I1S0_2_2Value a))) := by + exact log_exact_one_ball (CB4_2_2I1S0_2_2Mass_sound) +def CB4_2_2I1S0_2_2MassTerm : Ball := ⟨0, 0⟩ +lemma CB4_2_2I1S0_2_2MassTerm_sound : CB4_2_2I1S0_2_2MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB4_2_2I1S0_2_2Value a))) := by + exact contains_sound (entropyTerm_ball (CB4_2_2I1S0_2_2Mass_sound) CB4_2_2I1S0_2_2MassTermLog_sound) (by decide +kernel) +def CB4_2_2I1S0_2_2H : Ball := ⟨(11800461972869316783220442811149 / 50000000000000000000000000000000), (23187135181 / 50000000000000000000000000000000)⟩ +lemma CB4_2_2I1S0_2_2H_sound : CB4_2_2I1S0_2_2H.Encloses (homogeneousEntropy CB4_2_2I1S0_2_2Value) := by + exact contains_sound (homogeneous_enclosed CB4_2_2I1S0_2_2Value CB4_2_2I1S0_2_2MassTerm_sound CB4_2_2I1S0_2_2Entropy_sound) (by decide +kernel) +def CB4_2_2I1Singles (s : Shape) : Ball := + match s 0, s 1, s 2 with + | 0, 2, 2 => CB4_2_2I1S0_2_2H + | _, _, _ => (.exact 0) +lemma CB4_2_2I1Singles_sound (u : Shape) (hu : u ∈ below (shape 4 2 2)) + (hd : designated (stageBPriority (shape 4 2 2)) 1 u) : + (CB4_2_2I1Singles u).Encloses (homogeneousEntropy ((fun u a => (littleLaw (shape 4 2 2) u ((stageBPriority (shape 4 2 2)) 1) a : ℝ)) u)) := by + rw [B4_2_2_below] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl + · exact CB4_2_2I1S0_2_2H_sound + · exact (show ¬ designated (stageBPriority (shape 4 2 2)) 1 (shape 1 1 2) by decide +kernel) hd |>.elim + · exact (show ¬ designated (stageBPriority (shape 4 2 2)) 1 (shape 1 2 1) by decide +kernel) hd |>.elim + · exact (show ¬ designated (stageBPriority (shape 4 2 2)) 1 (shape 2 0 2) by decide +kernel) hd |>.elim + · exact (show ¬ designated (stageBPriority (shape 4 2 2)) 1 (shape 2 1 1) by decide +kernel) hd |>.elim + · exact (show ¬ designated (stageBPriority (shape 4 2 2)) 1 (shape 2 2 0) by decide +kernel) hd |>.elim + · exact (show ¬ designated (stageBPriority (shape 4 2 2)) 1 (shape 3 0 1) by decide +kernel) hd |>.elim + · exact (show ¬ designated (stageBPriority (shape 4 2 2)) 1 (shape 3 1 0) by decide +kernel) hd |>.elim + · exact (show ¬ designated (stageBPriority (shape 4 2 2)) 1 (shape 4 0 0) by decide +kernel) hd |>.elim +def CB4_2_2I1Singleton : Ball := ⟨(7770671233209326715362979197 / 100000000000000000000000000000000), (15268861 / 100000000000000000000000000000000)⟩ +lemma CB4_2_2I1Singleton_sound : CB4_2_2I1Singleton.Encloses + (singletonEntropy (below (shape 4 2 2)) (fun u => (stageBLaw (shape 4 2 2) u : ℝ)) (stageBPriority (shape 4 2 2)) 1 (fun u a => (littleLaw (shape 4 2 2) u ((stageBPriority (shape 4 2 2)) 1) a : ℝ))) := by + exact contains_sound (singletonBall_sound (below (shape 4 2 2)) B4_2_2Law (fun u => (stageBLaw (shape 4 2 2) u : ℝ)) (stageBPriority (shape 4 2 2)) 1 + CB4_2_2I1Singles (fun u a => (littleLaw (shape 4 2 2) u ((stageBPriority (shape 4 2 2)) 1) a : ℝ)) (fun u _ => B4_2_2Law_sound u) CB4_2_2I1Singles_sound) (by decide +kernel) +def CB4_2_2I1Group : Ball := ⟨(5633993833675520073125928141409 / 100000000000000000000000000000000), (116978753139 / 100000000000000000000000000000000)⟩ +lemma CB4_2_2I1Group_sound : CB4_2_2I1Group.Encloses + (groupedEntropy (below (shape 4 2 2)) (fun u => (stageBLaw (shape 4 2 2) u : ℝ)) (stageBPriority (shape 4 2 2)) 1 (fun u a => (littleLaw (shape 4 2 2) u ((stageBPriority (shape 4 2 2)) 1) a : ℝ))) := by + exact contains_sound (Ball.add_sound CB4_2_2I1Singleton_sound + (finSumBall_sound 17 CB4_2_2I1ResidualEntropies _ CB4_2_2I1ResidualEntropies_sound)) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CB4_2_2I1H : Ball := ⟨(91408518605504379373235119182111 / 100000000000000000000000000000000), (42052945601 / 12500000000000000000000000000000)⟩ +lemma CB4_2_2I1_sound : CB4_2_2I1H.Encloses (stageBCapacity (shape 4 2 2) 1) := by + have hb := contains_sound (Ball.add_sound CB4_2_2I1PairH_sound + (Ball.neg_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) CB4_2_2I1Group_sound))) + (show contains (.add CB4_2_2I1PairH (.neg (.mul (.exact 2) CB4_2_2I1Group))) CB4_2_2I1H = true by decide +kernel) + simp only [stageBCapacity, nativeCapacity, + show (1 : Fin 3) ≠ 0 by decide, ite_false, sub_eq_add_neg] + exact hb + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/CapacityB/CapB4_2_2I2.lean b/lean/OAI/LinearAlgebra/MatrixFields/CapacityB/CapB4_2_2I2.lean new file mode 100644 index 0000000000000000000000000000000000000000..2295fe7050e2786ca8f886de3e8815fb0a55761e --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/CapacityB/CapB4_2_2I2.lean @@ -0,0 +1,1055 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Certificates.Terminal4_2_2 + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CB4_2_2I2PairValue (a : PairSlot) : ℝ := pairLaw (below (shape 4 2 2)) (shape 4 2 2) (fun u => (stageBLaw (shape 4 2 2) u : ℝ)) (fun u a => (littleLaw (shape 4 2 2) u ((stageBPriority (shape 4 2 2)) 2) a : ℝ)) a +def CB4_2_2I2PairRaw (a : PairSlot) : Ball := pairLawBall (below (shape 4 2 2)) (shape 4 2 2) B4_2_2Law (fun u => B4_2_2Little u ((stageBPriority (shape 4 2 2)) 2)) a +lemma CB4_2_2I2PairRaw_sound (a : PairSlot) : + (CB4_2_2I2PairRaw a).Encloses (CB4_2_2I2PairValue a) := by + exact pairLawBall_sound_on (below (shape 4 2 2)) (shape 4 2 2) B4_2_2Law (fun u => (stageBLaw (shape 4 2 2) u : ℝ)) (fun u => B4_2_2Little u ((stageBPriority (shape 4 2 2)) 2)) (fun u a => (littleLaw (shape 4 2 2) u ((stageBPriority (shape 4 2 2)) 2) a : ℝ)) (fun u _ => B4_2_2Law_sound u) (fun u _ a => B4_2_2Little_sound u ((stageBPriority (shape 4 2 2)) 2) a) (fun u _ a => B4_2_2Little_sound (complement (shape 4 2 2) u) ((stageBPriority (shape 4 2 2)) 2) a) a +def CB4_2_2I2PairCertificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(32925283989199048774667657891 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(264017467412789009261745911423 / 100000000000000000000000000000000), (90638611 / 100000000000000000000000000000000)⟩ ⟨(-801868459204174003272721095524521 / 100000000000000000000000000000000), (68821427729 / 25000000000000000000000000000000)⟩ ⟨-12, 32925283989199048774667657891, 24414062500000000000000000000⟩, + .log ⟨(3924290670247618121826431431639 / 50000000000000000000000000000000), (3 / 10000000000000000000000000000000)⟩ ⟨(19973363265378585772023469851697 / 100000000000000000000000000000000), (8310008839 / 100000000000000000000000000000000)⟩ ⟨(-254483739148179485664331227253563 / 100000000000000000000000000000000), (26469779699 / 25000000000000000000000000000000)⟩ ⟨-4, 3924290670247618121826431431639, 3125000000000000000000000000000⟩, + .log ⟨(77179955630623675545342364672979 / 100000000000000000000000000000000), (147 / 100000000000000000000000000000000)⟩ ⟨(19991955146403358793157370481653 / 100000000000000000000000000000000), (32686982831 / 100000000000000000000000000000000)⟩ ⟨(-5180608095211419303120443613199 / 20000000000000000000000000000000), (10587911889 / 25000000000000000000000000000000)⟩ ⟨-1, 77179955630623675545342364672979, 50000000000000000000000000000000⟩, + .log ⟨(3365567162619738339457547396989 / 100000000000000000000000000000000), (11 / 100000000000000000000000000000000)⟩ ⟨(11414569039020176213057669577501 / 100000000000000000000000000000000), (4276119459 / 100000000000000000000000000000000)⟩ ⟨(-339157368951007371594172603698707 / 100000000000000000000000000000000), (15881867803 / 12500000000000000000000000000000)⟩ ⟨-5, 3365567162619738339457547396989, 3125000000000000000000000000000⟩, + .log ⟨(20368549697998574430467468169 / 6250000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ ⟨(233274673747783325687614767143 / 12500000000000000000000000000000), (345056661 / 50000000000000000000000000000000)⟩ ⟨(-572634471296464055917993227639807 / 100000000000000000000000000000000), (52939559361 / 25000000000000000000000000000000)⟩ ⟨-9, 20368549697998574430467468169, 12207031250000000000000000000⟩] +lemma CB4_2_2I2PairCertificates_valid : + CB4_2_2I2PairCertificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB4_2_2I2PairCertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 0, 5 => 1 + | 1, 4 => 2 + | 2, 2 => 3 + | 2, 3 => 4 + | 3, 2 => 4 + | 3, 3 => 5 + | 4, 1 => 2 + | 5, 0 => 1 + | _, _ => 0 +def CB4_2_2I2PairP (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CB4_2_2I2PairCertificates (CB4_2_2I2PairCertificateIndex a)).input +lemma CB4_2_2I2PairP_check : ∀ a : PairSlot, contains (CB4_2_2I2PairRaw a) (CB4_2_2I2PairP a) = true := by + decide +kernel +lemma CB4_2_2I2PairP_sound (a : PairSlot) : + (CB4_2_2I2PairP a).Encloses (CB4_2_2I2PairValue a) := + contains_sound (CB4_2_2I2PairRaw_sound a) (CB4_2_2I2PairP_check a) +def CB4_2_2I2PairTerms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CB4_2_2I2PairCertificates (CB4_2_2I2PairCertificateIndex a)).output +lemma CB4_2_2I2PairTerms_sound (a : PairSlot) : + (CB4_2_2I2PairTerms a).Encloses (Foundation.entropyTerm (CB4_2_2I2PairValue a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB4_2_2I2PairCertificates_valid + (CB4_2_2I2PairCertificateIndex a) (CB4_2_2I2PairP_sound a) +def CB4_2_2I2PairEntropy : Ball := ⟨(85162052080008727387344059300039 / 100000000000000000000000000000000), (58730629971 / 100000000000000000000000000000000)⟩ +lemma CB4_2_2I2PairEntropy_sound : CB4_2_2I2PairEntropy.Encloses (Foundation.finiteEntropy CB4_2_2I2PairValue) := by + exact contains_sound (entropyPair_enclosed CB4_2_2I2PairValue CB4_2_2I2PairTerms CB4_2_2I2PairTerms_sound) (by decide +kernel) +def CB4_2_2I2PairMass : Ball := ⟨(99999999999999999999999999999999 / 100000000000000000000000000000000), (233 / 100000000000000000000000000000000)⟩ +lemma CB4_2_2I2PairMass_sound : CB4_2_2I2PairMass.Encloses (∑ a, CB4_2_2I2PairValue a) := by + exact contains_sound (pairSumBall_sound CB4_2_2I2PairP CB4_2_2I2PairValue CB4_2_2I2PairP_sound) (by decide +kernel) +def CB4_2_2I2PairMassTermLogWitness : LogWitness := ⟨-1, 99999999999999999999999999999999, 50000000000000000000000000000000⟩ +def CB4_2_2I2PairMassTermLog : Ball := ⟨0, (42351647599 / 100000000000000000000000000000000)⟩ +lemma CB4_2_2I2PairMassTermLog_sound : CB4_2_2I2PairMassTermLog.Encloses (Real.log ((∑ a, CB4_2_2I2PairValue a))) := by + exact checkLog_sound logTwoBall_sound (CB4_2_2I2PairMass_sound) (w := CB4_2_2I2PairMassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB4_2_2I2PairMassTerm : Ball := ⟨0, (105879119 / 250000000000000000000000000000)⟩ +lemma CB4_2_2I2PairMassTerm_sound : CB4_2_2I2PairMassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB4_2_2I2PairValue a))) := by + exact contains_sound (entropyTerm_ball (CB4_2_2I2PairMass_sound) CB4_2_2I2PairMassTermLog_sound) (by decide +kernel) +def CB4_2_2I2PairH : Ball := ⟨(85162052080008727387344059300039 / 100000000000000000000000000000000), (101082277571 / 100000000000000000000000000000000)⟩ +lemma CB4_2_2I2PairH_sound : CB4_2_2I2PairH.Encloses (homogeneousEntropy CB4_2_2I2PairValue) := by + exact contains_sound (homogeneous_enclosed CB4_2_2I2PairValue CB4_2_2I2PairMassTerm_sound CB4_2_2I2PairEntropy_sound) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CB4_2_2I2R0Value (a : Fin 6) : ℝ := residualLaw (below (shape 4 2 2)) (fun u => (stageBLaw (shape 4 2 2) u : ℝ)) (stageBPriority (shape 4 2 2)) 2 (fun u a => (littleLaw (shape 4 2 2) u ((stageBPriority (shape 4 2 2)) 2) a : ℝ)) 0 a +def CB4_2_2I2R0Raw (a : Fin 6) : Ball := residualBall (below (shape 4 2 2)) B4_2_2Law (stageBPriority (shape 4 2 2)) 2 (fun u => B4_2_2Little u ((stageBPriority (shape 4 2 2)) 2)) 0 a +lemma CB4_2_2I2R0Raw_sound (a : Fin 6) : + (CB4_2_2I2R0Raw a).Encloses (CB4_2_2I2R0Value a) := by + exact residualBall_sound_on (below (shape 4 2 2)) B4_2_2Law (fun u => (stageBLaw (shape 4 2 2) u : ℝ)) (stageBPriority (shape 4 2 2)) 2 (fun u => B4_2_2Little u ((stageBPriority (shape 4 2 2)) 2)) (fun u a => (littleLaw (shape 4 2 2) u ((stageBPriority (shape 4 2 2)) 2) a : ℝ)) (fun u _ => B4_2_2Law_sound u) (fun u _ a => B4_2_2Little_sound u ((stageBPriority (shape 4 2 2)) 2) a) 0 a +def CB4_2_2I2R0Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(32925283989199048774667657891 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(264017467412789009261745911423 / 100000000000000000000000000000000), (90638611 / 100000000000000000000000000000000)⟩ ⟨(-801868459204174003272721095524521 / 100000000000000000000000000000000), (68821427729 / 25000000000000000000000000000000)⟩ ⟨-12, 32925283989199048774667657891, 24414062500000000000000000000⟩] +lemma CB4_2_2I2R0Certificates_valid : + CB4_2_2I2R0Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB4_2_2I2R0CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | 0 => 1 + | _ => 0 +def CB4_2_2I2R0P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB4_2_2I2R0Certificates (CB4_2_2I2R0CertificateIndex a)).input +lemma CB4_2_2I2R0P_check : ∀ a : Fin 6, contains (CB4_2_2I2R0Raw a) (CB4_2_2I2R0P a) = true := by + decide +kernel +lemma CB4_2_2I2R0P_sound (a : Fin 6) : + (CB4_2_2I2R0P a).Encloses (CB4_2_2I2R0Value a) := + contains_sound (CB4_2_2I2R0Raw_sound a) (CB4_2_2I2R0P_check a) +def CB4_2_2I2R0Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB4_2_2I2R0Certificates (CB4_2_2I2R0CertificateIndex a)).output +lemma CB4_2_2I2R0Terms_sound (a : Fin 6) : + (CB4_2_2I2R0Terms a).Encloses (Foundation.entropyTerm (CB4_2_2I2R0Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB4_2_2I2R0Certificates_valid + (CB4_2_2I2R0CertificateIndex a) (CB4_2_2I2R0P_sound a) +def CB4_2_2I2R0Entropy : Ball := ⟨(264017467412789009261745911423 / 100000000000000000000000000000000), (90638611 / 100000000000000000000000000000000)⟩ +lemma CB4_2_2I2R0Entropy_sound : CB4_2_2I2R0Entropy.Encloses (Foundation.finiteEntropy CB4_2_2I2R0Value) := by + exact contains_sound (entropyFin_enclosed 6 CB4_2_2I2R0Value CB4_2_2I2R0Terms CB4_2_2I2R0Terms_sound) (by decide +kernel) +def CB4_2_2I2R0Mass : Ball := ⟨(32925283989199048774667657891 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ +lemma CB4_2_2I2R0Mass_sound : CB4_2_2I2R0Mass.Encloses (∑ a, CB4_2_2I2R0Value a) := by + exact contains_sound (finSumBall_sound 6 CB4_2_2I2R0P CB4_2_2I2R0Value CB4_2_2I2R0P_sound) (by decide +kernel) +def CB4_2_2I2R0MassTermLogWitness : LogWitness := ⟨-12, 32925283989199048774667657891, 24414062500000000000000000000⟩ +def CB4_2_2I2R0MassTermLog : Ball := ⟨(-801868459204174003272721095524521 / 100000000000000000000000000000000), (68821427729 / 25000000000000000000000000000000)⟩ +lemma CB4_2_2I2R0MassTermLog_sound : CB4_2_2I2R0MassTermLog.Encloses (Real.log ((∑ a, CB4_2_2I2R0Value a))) := by + exact checkLog_sound logTwoBall_sound (CB4_2_2I2R0Mass_sound) (w := CB4_2_2I2R0MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB4_2_2I2R0MassTerm : Ball := ⟨(264017467412789009261745911423 / 100000000000000000000000000000000), (90638611 / 100000000000000000000000000000000)⟩ +lemma CB4_2_2I2R0MassTerm_sound : CB4_2_2I2R0MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB4_2_2I2R0Value a))) := by + exact contains_sound (entropyTerm_ball (CB4_2_2I2R0Mass_sound) CB4_2_2I2R0MassTermLog_sound) (by decide +kernel) +def CB4_2_2I2R0H : Ball := ⟨0, (90638611 / 50000000000000000000000000000000)⟩ +lemma CB4_2_2I2R0H_sound : CB4_2_2I2R0H.Encloses (homogeneousEntropy CB4_2_2I2R0Value) := by + exact contains_sound (homogeneous_enclosed CB4_2_2I2R0Value CB4_2_2I2R0MassTerm_sound CB4_2_2I2R0Entropy_sound) (by decide +kernel) +def CB4_2_2I2R1Value (a : Fin 6) : ℝ := residualLaw (below (shape 4 2 2)) (fun u => (stageBLaw (shape 4 2 2) u : ℝ)) (stageBPriority (shape 4 2 2)) 2 (fun u a => (littleLaw (shape 4 2 2) u ((stageBPriority (shape 4 2 2)) 2) a : ℝ)) 1 a +def CB4_2_2I2R1Raw (a : Fin 6) : Ball := residualBall (below (shape 4 2 2)) B4_2_2Law (stageBPriority (shape 4 2 2)) 2 (fun u => B4_2_2Little u ((stageBPriority (shape 4 2 2)) 2)) 1 a +lemma CB4_2_2I2R1Raw_sound (a : Fin 6) : + (CB4_2_2I2R1Raw a).Encloses (CB4_2_2I2R1Value a) := by + exact residualBall_sound_on (below (shape 4 2 2)) B4_2_2Law (fun u => (stageBLaw (shape 4 2 2) u : ℝ)) (stageBPriority (shape 4 2 2)) 2 (fun u => B4_2_2Little u ((stageBPriority (shape 4 2 2)) 2)) (fun u a => (littleLaw (shape 4 2 2) u ((stageBPriority (shape 4 2 2)) 2) a : ℝ)) (fun u _ => B4_2_2Law_sound u) (fun u _ a => B4_2_2Little_sound u ((stageBPriority (shape 4 2 2)) 2) a) 1 a +def CB4_2_2I2R1Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(3924290670247618121826431431639 / 50000000000000000000000000000000), (3 / 10000000000000000000000000000000)⟩ ⟨(19973363265378585772023469851697 / 100000000000000000000000000000000), (8310008839 / 100000000000000000000000000000000)⟩ ⟨(-254483739148179485664331227253563 / 100000000000000000000000000000000), (26469779699 / 25000000000000000000000000000000)⟩ ⟨-4, 3924290670247618121826431431639, 3125000000000000000000000000000⟩] +lemma CB4_2_2I2R1Certificates_valid : + CB4_2_2I2R1Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB4_2_2I2R1CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | 1 => 1 + | _ => 0 +def CB4_2_2I2R1P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB4_2_2I2R1Certificates (CB4_2_2I2R1CertificateIndex a)).input +lemma CB4_2_2I2R1P_check : ∀ a : Fin 6, contains (CB4_2_2I2R1Raw a) (CB4_2_2I2R1P a) = true := by + decide +kernel +lemma CB4_2_2I2R1P_sound (a : Fin 6) : + (CB4_2_2I2R1P a).Encloses (CB4_2_2I2R1Value a) := + contains_sound (CB4_2_2I2R1Raw_sound a) (CB4_2_2I2R1P_check a) +def CB4_2_2I2R1Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB4_2_2I2R1Certificates (CB4_2_2I2R1CertificateIndex a)).output +lemma CB4_2_2I2R1Terms_sound (a : Fin 6) : + (CB4_2_2I2R1Terms a).Encloses (Foundation.entropyTerm (CB4_2_2I2R1Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB4_2_2I2R1Certificates_valid + (CB4_2_2I2R1CertificateIndex a) (CB4_2_2I2R1P_sound a) +def CB4_2_2I2R1Entropy : Ball := ⟨(19973363265378585772023469851697 / 100000000000000000000000000000000), (8310008839 / 100000000000000000000000000000000)⟩ +lemma CB4_2_2I2R1Entropy_sound : CB4_2_2I2R1Entropy.Encloses (Foundation.finiteEntropy CB4_2_2I2R1Value) := by + exact contains_sound (entropyFin_enclosed 6 CB4_2_2I2R1Value CB4_2_2I2R1Terms CB4_2_2I2R1Terms_sound) (by decide +kernel) +def CB4_2_2I2R1Mass : Ball := ⟨(3924290670247618121826431431639 / 50000000000000000000000000000000), (3 / 10000000000000000000000000000000)⟩ +lemma CB4_2_2I2R1Mass_sound : CB4_2_2I2R1Mass.Encloses (∑ a, CB4_2_2I2R1Value a) := by + exact contains_sound (finSumBall_sound 6 CB4_2_2I2R1P CB4_2_2I2R1Value CB4_2_2I2R1P_sound) (by decide +kernel) +def CB4_2_2I2R1MassTermLogWitness : LogWitness := ⟨-4, 3924290670247618121826431431639, 3125000000000000000000000000000⟩ +def CB4_2_2I2R1MassTermLog : Ball := ⟨(-254483739148179485664331227253563 / 100000000000000000000000000000000), (26469779699 / 25000000000000000000000000000000)⟩ +lemma CB4_2_2I2R1MassTermLog_sound : CB4_2_2I2R1MassTermLog.Encloses (Real.log ((∑ a, CB4_2_2I2R1Value a))) := by + exact checkLog_sound logTwoBall_sound (CB4_2_2I2R1Mass_sound) (w := CB4_2_2I2R1MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB4_2_2I2R1MassTerm : Ball := ⟨(19973363265378585772023469851697 / 100000000000000000000000000000000), (8310008839 / 100000000000000000000000000000000)⟩ +lemma CB4_2_2I2R1MassTerm_sound : CB4_2_2I2R1MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB4_2_2I2R1Value a))) := by + exact contains_sound (entropyTerm_ball (CB4_2_2I2R1Mass_sound) CB4_2_2I2R1MassTermLog_sound) (by decide +kernel) +def CB4_2_2I2R1H : Ball := ⟨0, (8310008839 / 50000000000000000000000000000000)⟩ +lemma CB4_2_2I2R1H_sound : CB4_2_2I2R1H.Encloses (homogeneousEntropy CB4_2_2I2R1Value) := by + exact contains_sound (homogeneous_enclosed CB4_2_2I2R1Value CB4_2_2I2R1MassTerm_sound CB4_2_2I2R1Entropy_sound) (by decide +kernel) +def CB4_2_2I2R2Value (a : Fin 6) : ℝ := residualLaw (below (shape 4 2 2)) (fun u => (stageBLaw (shape 4 2 2) u : ℝ)) (stageBPriority (shape 4 2 2)) 2 (fun u a => (littleLaw (shape 4 2 2) u ((stageBPriority (shape 4 2 2)) 2) a : ℝ)) 2 a +def CB4_2_2I2R2Raw (a : Fin 6) : Ball := residualBall (below (shape 4 2 2)) B4_2_2Law (stageBPriority (shape 4 2 2)) 2 (fun u => B4_2_2Little u ((stageBPriority (shape 4 2 2)) 2)) 2 a +lemma CB4_2_2I2R2Raw_sound (a : Fin 6) : + (CB4_2_2I2R2Raw a).Encloses (CB4_2_2I2R2Value a) := by + exact residualBall_sound_on (below (shape 4 2 2)) B4_2_2Law (fun u => (stageBLaw (shape 4 2 2) u : ℝ)) (stageBPriority (shape 4 2 2)) 2 (fun u => B4_2_2Little u ((stageBPriority (shape 4 2 2)) 2)) (fun u a => (littleLaw (shape 4 2 2) u ((stageBPriority (shape 4 2 2)) 2) a : ℝ)) (fun u _ => B4_2_2Law_sound u) (fun u _ a => B4_2_2Little_sound u ((stageBPriority (shape 4 2 2)) 2) a) 2 a +def CB4_2_2I2R2Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(54606597188412179771489877547937 / 100000000000000000000000000000000), (63 / 100000000000000000000000000000000)⟩ ⟨(6607567353600587271775121013497 / 20000000000000000000000000000000), (23126793581 / 100000000000000000000000000000000)⟩ ⟨(-30250774145485251926939796014479 / 50000000000000000000000000000000), (1058791187 / 2500000000000000000000000000000)⟩ ⟨-1, 54606597188412179771489877547937, 50000000000000000000000000000000⟩, + .log ⟨(81925921763941401533420105921 / 12500000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ ⟨(3295170994711641414745310598131 / 100000000000000000000000000000000), (1249091203 / 100000000000000000000000000000000)⟩ ⟨(-62845855968178721135666464092211 / 12500000000000000000000000000000), (47645603363 / 25000000000000000000000000000000)⟩ ⟨-8, 81925921763941401533420105921, 48828125000000000000000000000⟩] +lemma CB4_2_2I2R2Certificates_valid : + CB4_2_2I2R2Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB4_2_2I2R2CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | 2 => 1 + | 3 => 2 + | _ => 0 +def CB4_2_2I2R2P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB4_2_2I2R2Certificates (CB4_2_2I2R2CertificateIndex a)).input +lemma CB4_2_2I2R2P_check : ∀ a : Fin 6, contains (CB4_2_2I2R2Raw a) (CB4_2_2I2R2P a) = true := by + decide +kernel +lemma CB4_2_2I2R2P_sound (a : Fin 6) : + (CB4_2_2I2R2P a).Encloses (CB4_2_2I2R2Value a) := + contains_sound (CB4_2_2I2R2Raw_sound a) (CB4_2_2I2R2P_check a) +def CB4_2_2I2R2Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB4_2_2I2R2Certificates (CB4_2_2I2R2CertificateIndex a)).output +lemma CB4_2_2I2R2Terms_sound (a : Fin 6) : + (CB4_2_2I2R2Terms a).Encloses (Foundation.entropyTerm (CB4_2_2I2R2Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB4_2_2I2R2Certificates_valid + (CB4_2_2I2R2CertificateIndex a) (CB4_2_2I2R2P_sound a) +def CB4_2_2I2R2Entropy : Ball := ⟨(2270812985169661110851307229101 / 6250000000000000000000000000000), (1523492799 / 6250000000000000000000000000000)⟩ +lemma CB4_2_2I2R2Entropy_sound : CB4_2_2I2R2Entropy.Encloses (Foundation.finiteEntropy CB4_2_2I2R2Value) := by + exact contains_sound (entropyFin_enclosed 6 CB4_2_2I2R2Value CB4_2_2I2R2Terms CB4_2_2I2R2Terms_sound) (by decide +kernel) +def CB4_2_2I2R2Mass : Ball := ⟨(11052400912504742196751447679061 / 20000000000000000000000000000000), (13 / 20000000000000000000000000000000)⟩ +lemma CB4_2_2I2R2Mass_sound : CB4_2_2I2R2Mass.Encloses (∑ a, CB4_2_2I2R2Value a) := by + exact contains_sound (finSumBall_sound 6 CB4_2_2I2R2P CB4_2_2I2R2Value CB4_2_2I2R2P_sound) (by decide +kernel) +def CB4_2_2I2R2MassTermLogWitness : LogWitness := ⟨-1, 11052400912504742196751447679061, 10000000000000000000000000000000⟩ +def CB4_2_2I2R2MassTermLog : Ball := ⟨(-29654229602087001636360652787339 / 50000000000000000000000000000000), (42351647483 / 100000000000000000000000000000000)⟩ +lemma CB4_2_2I2R2MassTermLog_sound : CB4_2_2I2R2MassTermLog.Encloses (Real.log ((∑ a, CB4_2_2I2R2Value a))) := by + exact checkLog_sound logTwoBall_sound (CB4_2_2I2R2Mass_sound) (w := CB4_2_2I2R2MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB4_2_2I2R2MassTerm : Ball := ⟨(4096880428921643937267339657819 / 12500000000000000000000000000000), (5851092351 / 25000000000000000000000000000000)⟩ +lemma CB4_2_2I2R2MassTerm_sound : CB4_2_2I2R2MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB4_2_2I2R2Value a))) := by + exact contains_sound (entropyTerm_ball (CB4_2_2I2R2Mass_sound) CB4_2_2I2R2MassTermLog_sound) (by decide +kernel) +def CB4_2_2I2R2H : Ball := ⟨(444745541417678284435274800383 / 12500000000000000000000000000000), (11945063547 / 25000000000000000000000000000000)⟩ +lemma CB4_2_2I2R2H_sound : CB4_2_2I2R2H.Encloses (homogeneousEntropy CB4_2_2I2R2Value) := by + exact contains_sound (homogeneous_enclosed CB4_2_2I2R2Value CB4_2_2I2R2MassTerm_sound CB4_2_2I2R2Entropy_sound) (by decide +kernel) +def CB4_2_2I2R3Value (a : Fin 6) : ℝ := residualLaw (below (shape 4 2 2)) (fun u => (stageBLaw (shape 4 2 2) u : ℝ)) (stageBPriority (shape 4 2 2)) 2 (fun u a => (littleLaw (shape 4 2 2) u ((stageBPriority (shape 4 2 2)) 2) a : ℝ)) 3 a +def CB4_2_2I2R3Raw (a : Fin 6) : Ball := residualBall (below (shape 4 2 2)) B4_2_2Law (stageBPriority (shape 4 2 2)) 2 (fun u => B4_2_2Little u ((stageBPriority (shape 4 2 2)) 2)) 3 a +lemma CB4_2_2I2R3Raw_sound (a : Fin 6) : + (CB4_2_2I2R3Raw a).Encloses (CB4_2_2I2R3Value a) := by + exact residualBall_sound_on (below (shape 4 2 2)) B4_2_2Law (fun u => (stageBLaw (shape 4 2 2) u : ℝ)) (stageBPriority (shape 4 2 2)) 2 (fun u => B4_2_2Little u ((stageBPriority (shape 4 2 2)) 2)) (fun u a => (littleLaw (shape 4 2 2) u ((stageBPriority (shape 4 2 2)) 2) a : ℝ)) (fun u _ => B4_2_2Law_sound u) (fun u _ a => B4_2_2Little_sound u ((stageBPriority (shape 4 2 2)) 2) a) 3 a +def CB4_2_2I2R3Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB4_2_2I2R3Certificates_valid : + CB4_2_2I2R3Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB4_2_2I2R3CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB4_2_2I2R3P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB4_2_2I2R3Certificates (CB4_2_2I2R3CertificateIndex a)).input +lemma CB4_2_2I2R3P_check : ∀ a : Fin 6, contains (CB4_2_2I2R3Raw a) (CB4_2_2I2R3P a) = true := by + decide +kernel +lemma CB4_2_2I2R3P_sound (a : Fin 6) : + (CB4_2_2I2R3P a).Encloses (CB4_2_2I2R3Value a) := + contains_sound (CB4_2_2I2R3Raw_sound a) (CB4_2_2I2R3P_check a) +def CB4_2_2I2R3Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB4_2_2I2R3Certificates (CB4_2_2I2R3CertificateIndex a)).output +lemma CB4_2_2I2R3Terms_sound (a : Fin 6) : + (CB4_2_2I2R3Terms a).Encloses (Foundation.entropyTerm (CB4_2_2I2R3Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB4_2_2I2R3Certificates_valid + (CB4_2_2I2R3CertificateIndex a) (CB4_2_2I2R3P_sound a) +def CB4_2_2I2R3Entropy : Ball := ⟨0, 0⟩ +lemma CB4_2_2I2R3Entropy_sound : CB4_2_2I2R3Entropy.Encloses (Foundation.finiteEntropy CB4_2_2I2R3Value) := by + exact contains_sound (entropyFin_enclosed 6 CB4_2_2I2R3Value CB4_2_2I2R3Terms CB4_2_2I2R3Terms_sound) (by decide +kernel) +def CB4_2_2I2R3Mass : Ball := ⟨0, 0⟩ +lemma CB4_2_2I2R3Mass_sound : CB4_2_2I2R3Mass.Encloses (∑ a, CB4_2_2I2R3Value a) := by + exact contains_sound (finSumBall_sound 6 CB4_2_2I2R3P CB4_2_2I2R3Value CB4_2_2I2R3P_sound) (by decide +kernel) +def CB4_2_2I2R3MassTerm : Ball := .exact 0 +lemma CB4_2_2I2R3MassTerm_sound : CB4_2_2I2R3MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB4_2_2I2R3Value a))) := + entropyTerm_zero_ball (CB4_2_2I2R3Mass_sound) +def CB4_2_2I2R3H : Ball := ⟨0, 0⟩ +lemma CB4_2_2I2R3H_sound : CB4_2_2I2R3H.Encloses (homogeneousEntropy CB4_2_2I2R3Value) := by + exact contains_sound (homogeneous_enclosed CB4_2_2I2R3Value CB4_2_2I2R3MassTerm_sound CB4_2_2I2R3Entropy_sound) (by decide +kernel) +def CB4_2_2I2R4Value (a : Fin 6) : ℝ := residualLaw (below (shape 4 2 2)) (fun u => (stageBLaw (shape 4 2 2) u : ℝ)) (stageBPriority (shape 4 2 2)) 2 (fun u a => (littleLaw (shape 4 2 2) u ((stageBPriority (shape 4 2 2)) 2) a : ℝ)) 4 a +def CB4_2_2I2R4Raw (a : Fin 6) : Ball := residualBall (below (shape 4 2 2)) B4_2_2Law (stageBPriority (shape 4 2 2)) 2 (fun u => B4_2_2Little u ((stageBPriority (shape 4 2 2)) 2)) 4 a +lemma CB4_2_2I2R4Raw_sound (a : Fin 6) : + (CB4_2_2I2R4Raw a).Encloses (CB4_2_2I2R4Value a) := by + exact residualBall_sound_on (below (shape 4 2 2)) B4_2_2Law (fun u => (stageBLaw (shape 4 2 2) u : ℝ)) (stageBPriority (shape 4 2 2)) 2 (fun u => B4_2_2Little u ((stageBPriority (shape 4 2 2)) 2)) (fun u a => (littleLaw (shape 4 2 2) u ((stageBPriority (shape 4 2 2)) 2) a : ℝ)) (fun u _ => B4_2_2Law_sound u) (fun u _ a => B4_2_2Little_sound u ((stageBPriority (shape 4 2 2)) 2) a) 4 a +def CB4_2_2I2R4Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB4_2_2I2R4Certificates_valid : + CB4_2_2I2R4Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB4_2_2I2R4CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB4_2_2I2R4P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB4_2_2I2R4Certificates (CB4_2_2I2R4CertificateIndex a)).input +lemma CB4_2_2I2R4P_check : ∀ a : Fin 6, contains (CB4_2_2I2R4Raw a) (CB4_2_2I2R4P a) = true := by + decide +kernel +lemma CB4_2_2I2R4P_sound (a : Fin 6) : + (CB4_2_2I2R4P a).Encloses (CB4_2_2I2R4Value a) := + contains_sound (CB4_2_2I2R4Raw_sound a) (CB4_2_2I2R4P_check a) +def CB4_2_2I2R4Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB4_2_2I2R4Certificates (CB4_2_2I2R4CertificateIndex a)).output +lemma CB4_2_2I2R4Terms_sound (a : Fin 6) : + (CB4_2_2I2R4Terms a).Encloses (Foundation.entropyTerm (CB4_2_2I2R4Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB4_2_2I2R4Certificates_valid + (CB4_2_2I2R4CertificateIndex a) (CB4_2_2I2R4P_sound a) +def CB4_2_2I2R4Entropy : Ball := ⟨0, 0⟩ +lemma CB4_2_2I2R4Entropy_sound : CB4_2_2I2R4Entropy.Encloses (Foundation.finiteEntropy CB4_2_2I2R4Value) := by + exact contains_sound (entropyFin_enclosed 6 CB4_2_2I2R4Value CB4_2_2I2R4Terms CB4_2_2I2R4Terms_sound) (by decide +kernel) +def CB4_2_2I2R4Mass : Ball := ⟨0, 0⟩ +lemma CB4_2_2I2R4Mass_sound : CB4_2_2I2R4Mass.Encloses (∑ a, CB4_2_2I2R4Value a) := by + exact contains_sound (finSumBall_sound 6 CB4_2_2I2R4P CB4_2_2I2R4Value CB4_2_2I2R4P_sound) (by decide +kernel) +def CB4_2_2I2R4MassTerm : Ball := .exact 0 +lemma CB4_2_2I2R4MassTerm_sound : CB4_2_2I2R4MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB4_2_2I2R4Value a))) := + entropyTerm_zero_ball (CB4_2_2I2R4Mass_sound) +def CB4_2_2I2R4H : Ball := ⟨0, 0⟩ +lemma CB4_2_2I2R4H_sound : CB4_2_2I2R4H.Encloses (homogeneousEntropy CB4_2_2I2R4Value) := by + exact contains_sound (homogeneous_enclosed CB4_2_2I2R4Value CB4_2_2I2R4MassTerm_sound CB4_2_2I2R4Entropy_sound) (by decide +kernel) +def CB4_2_2I2R5Value (a : Fin 6) : ℝ := residualLaw (below (shape 4 2 2)) (fun u => (stageBLaw (shape 4 2 2) u : ℝ)) (stageBPriority (shape 4 2 2)) 2 (fun u a => (littleLaw (shape 4 2 2) u ((stageBPriority (shape 4 2 2)) 2) a : ℝ)) 5 a +def CB4_2_2I2R5Raw (a : Fin 6) : Ball := residualBall (below (shape 4 2 2)) B4_2_2Law (stageBPriority (shape 4 2 2)) 2 (fun u => B4_2_2Little u ((stageBPriority (shape 4 2 2)) 2)) 5 a +lemma CB4_2_2I2R5Raw_sound (a : Fin 6) : + (CB4_2_2I2R5Raw a).Encloses (CB4_2_2I2R5Value a) := by + exact residualBall_sound_on (below (shape 4 2 2)) B4_2_2Law (fun u => (stageBLaw (shape 4 2 2) u : ℝ)) (stageBPriority (shape 4 2 2)) 2 (fun u => B4_2_2Little u ((stageBPriority (shape 4 2 2)) 2)) (fun u a => (littleLaw (shape 4 2 2) u ((stageBPriority (shape 4 2 2)) 2) a : ℝ)) (fun u _ => B4_2_2Law_sound u) (fun u _ a => B4_2_2Little_sound u ((stageBPriority (shape 4 2 2)) 2) a) 5 a +def CB4_2_2I2R5Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB4_2_2I2R5Certificates_valid : + CB4_2_2I2R5Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB4_2_2I2R5CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB4_2_2I2R5P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB4_2_2I2R5Certificates (CB4_2_2I2R5CertificateIndex a)).input +lemma CB4_2_2I2R5P_check : ∀ a : Fin 6, contains (CB4_2_2I2R5Raw a) (CB4_2_2I2R5P a) = true := by + decide +kernel +lemma CB4_2_2I2R5P_sound (a : Fin 6) : + (CB4_2_2I2R5P a).Encloses (CB4_2_2I2R5Value a) := + contains_sound (CB4_2_2I2R5Raw_sound a) (CB4_2_2I2R5P_check a) +def CB4_2_2I2R5Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB4_2_2I2R5Certificates (CB4_2_2I2R5CertificateIndex a)).output +lemma CB4_2_2I2R5Terms_sound (a : Fin 6) : + (CB4_2_2I2R5Terms a).Encloses (Foundation.entropyTerm (CB4_2_2I2R5Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB4_2_2I2R5Certificates_valid + (CB4_2_2I2R5CertificateIndex a) (CB4_2_2I2R5P_sound a) +def CB4_2_2I2R5Entropy : Ball := ⟨0, 0⟩ +lemma CB4_2_2I2R5Entropy_sound : CB4_2_2I2R5Entropy.Encloses (Foundation.finiteEntropy CB4_2_2I2R5Value) := by + exact contains_sound (entropyFin_enclosed 6 CB4_2_2I2R5Value CB4_2_2I2R5Terms CB4_2_2I2R5Terms_sound) (by decide +kernel) +def CB4_2_2I2R5Mass : Ball := ⟨0, 0⟩ +lemma CB4_2_2I2R5Mass_sound : CB4_2_2I2R5Mass.Encloses (∑ a, CB4_2_2I2R5Value a) := by + exact contains_sound (finSumBall_sound 6 CB4_2_2I2R5P CB4_2_2I2R5Value CB4_2_2I2R5P_sound) (by decide +kernel) +def CB4_2_2I2R5MassTerm : Ball := .exact 0 +lemma CB4_2_2I2R5MassTerm_sound : CB4_2_2I2R5MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB4_2_2I2R5Value a))) := + entropyTerm_zero_ball (CB4_2_2I2R5Mass_sound) +def CB4_2_2I2R5H : Ball := ⟨0, 0⟩ +lemma CB4_2_2I2R5H_sound : CB4_2_2I2R5H.Encloses (homogeneousEntropy CB4_2_2I2R5Value) := by + exact contains_sound (homogeneous_enclosed CB4_2_2I2R5Value CB4_2_2I2R5MassTerm_sound CB4_2_2I2R5Entropy_sound) (by decide +kernel) +def CB4_2_2I2R6Value (a : Fin 6) : ℝ := residualLaw (below (shape 4 2 2)) (fun u => (stageBLaw (shape 4 2 2) u : ℝ)) (stageBPriority (shape 4 2 2)) 2 (fun u a => (littleLaw (shape 4 2 2) u ((stageBPriority (shape 4 2 2)) 2) a : ℝ)) 6 a +def CB4_2_2I2R6Raw (a : Fin 6) : Ball := residualBall (below (shape 4 2 2)) B4_2_2Law (stageBPriority (shape 4 2 2)) 2 (fun u => B4_2_2Little u ((stageBPriority (shape 4 2 2)) 2)) 6 a +lemma CB4_2_2I2R6Raw_sound (a : Fin 6) : + (CB4_2_2I2R6Raw a).Encloses (CB4_2_2I2R6Value a) := by + exact residualBall_sound_on (below (shape 4 2 2)) B4_2_2Law (fun u => (stageBLaw (shape 4 2 2) u : ℝ)) (stageBPriority (shape 4 2 2)) 2 (fun u => B4_2_2Little u ((stageBPriority (shape 4 2 2)) 2)) (fun u a => (littleLaw (shape 4 2 2) u ((stageBPriority (shape 4 2 2)) 2) a : ℝ)) (fun u _ => B4_2_2Law_sound u) (fun u _ a => B4_2_2Little_sound u ((stageBPriority (shape 4 2 2)) 2) a) 6 a +def CB4_2_2I2R6Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB4_2_2I2R6Certificates_valid : + CB4_2_2I2R6Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB4_2_2I2R6CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB4_2_2I2R6P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB4_2_2I2R6Certificates (CB4_2_2I2R6CertificateIndex a)).input +lemma CB4_2_2I2R6P_check : ∀ a : Fin 6, contains (CB4_2_2I2R6Raw a) (CB4_2_2I2R6P a) = true := by + decide +kernel +lemma CB4_2_2I2R6P_sound (a : Fin 6) : + (CB4_2_2I2R6P a).Encloses (CB4_2_2I2R6Value a) := + contains_sound (CB4_2_2I2R6Raw_sound a) (CB4_2_2I2R6P_check a) +def CB4_2_2I2R6Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB4_2_2I2R6Certificates (CB4_2_2I2R6CertificateIndex a)).output +lemma CB4_2_2I2R6Terms_sound (a : Fin 6) : + (CB4_2_2I2R6Terms a).Encloses (Foundation.entropyTerm (CB4_2_2I2R6Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB4_2_2I2R6Certificates_valid + (CB4_2_2I2R6CertificateIndex a) (CB4_2_2I2R6P_sound a) +def CB4_2_2I2R6Entropy : Ball := ⟨0, 0⟩ +lemma CB4_2_2I2R6Entropy_sound : CB4_2_2I2R6Entropy.Encloses (Foundation.finiteEntropy CB4_2_2I2R6Value) := by + exact contains_sound (entropyFin_enclosed 6 CB4_2_2I2R6Value CB4_2_2I2R6Terms CB4_2_2I2R6Terms_sound) (by decide +kernel) +def CB4_2_2I2R6Mass : Ball := ⟨0, 0⟩ +lemma CB4_2_2I2R6Mass_sound : CB4_2_2I2R6Mass.Encloses (∑ a, CB4_2_2I2R6Value a) := by + exact contains_sound (finSumBall_sound 6 CB4_2_2I2R6P CB4_2_2I2R6Value CB4_2_2I2R6P_sound) (by decide +kernel) +def CB4_2_2I2R6MassTerm : Ball := .exact 0 +lemma CB4_2_2I2R6MassTerm_sound : CB4_2_2I2R6MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB4_2_2I2R6Value a))) := + entropyTerm_zero_ball (CB4_2_2I2R6Mass_sound) +def CB4_2_2I2R6H : Ball := ⟨0, 0⟩ +lemma CB4_2_2I2R6H_sound : CB4_2_2I2R6H.Encloses (homogeneousEntropy CB4_2_2I2R6Value) := by + exact contains_sound (homogeneous_enclosed CB4_2_2I2R6Value CB4_2_2I2R6MassTerm_sound CB4_2_2I2R6Entropy_sound) (by decide +kernel) +def CB4_2_2I2R7Value (a : Fin 6) : ℝ := residualLaw (below (shape 4 2 2)) (fun u => (stageBLaw (shape 4 2 2) u : ℝ)) (stageBPriority (shape 4 2 2)) 2 (fun u a => (littleLaw (shape 4 2 2) u ((stageBPriority (shape 4 2 2)) 2) a : ℝ)) 7 a +def CB4_2_2I2R7Raw (a : Fin 6) : Ball := residualBall (below (shape 4 2 2)) B4_2_2Law (stageBPriority (shape 4 2 2)) 2 (fun u => B4_2_2Little u ((stageBPriority (shape 4 2 2)) 2)) 7 a +lemma CB4_2_2I2R7Raw_sound (a : Fin 6) : + (CB4_2_2I2R7Raw a).Encloses (CB4_2_2I2R7Value a) := by + exact residualBall_sound_on (below (shape 4 2 2)) B4_2_2Law (fun u => (stageBLaw (shape 4 2 2) u : ℝ)) (stageBPriority (shape 4 2 2)) 2 (fun u => B4_2_2Little u ((stageBPriority (shape 4 2 2)) 2)) (fun u a => (littleLaw (shape 4 2 2) u ((stageBPriority (shape 4 2 2)) 2) a : ℝ)) (fun u _ => B4_2_2Law_sound u) (fun u _ a => B4_2_2Little_sound u ((stageBPriority (shape 4 2 2)) 2) a) 7 a +def CB4_2_2I2R7Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB4_2_2I2R7Certificates_valid : + CB4_2_2I2R7Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB4_2_2I2R7CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB4_2_2I2R7P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB4_2_2I2R7Certificates (CB4_2_2I2R7CertificateIndex a)).input +lemma CB4_2_2I2R7P_check : ∀ a : Fin 6, contains (CB4_2_2I2R7Raw a) (CB4_2_2I2R7P a) = true := by + decide +kernel +lemma CB4_2_2I2R7P_sound (a : Fin 6) : + (CB4_2_2I2R7P a).Encloses (CB4_2_2I2R7Value a) := + contains_sound (CB4_2_2I2R7Raw_sound a) (CB4_2_2I2R7P_check a) +def CB4_2_2I2R7Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB4_2_2I2R7Certificates (CB4_2_2I2R7CertificateIndex a)).output +lemma CB4_2_2I2R7Terms_sound (a : Fin 6) : + (CB4_2_2I2R7Terms a).Encloses (Foundation.entropyTerm (CB4_2_2I2R7Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB4_2_2I2R7Certificates_valid + (CB4_2_2I2R7CertificateIndex a) (CB4_2_2I2R7P_sound a) +def CB4_2_2I2R7Entropy : Ball := ⟨0, 0⟩ +lemma CB4_2_2I2R7Entropy_sound : CB4_2_2I2R7Entropy.Encloses (Foundation.finiteEntropy CB4_2_2I2R7Value) := by + exact contains_sound (entropyFin_enclosed 6 CB4_2_2I2R7Value CB4_2_2I2R7Terms CB4_2_2I2R7Terms_sound) (by decide +kernel) +def CB4_2_2I2R7Mass : Ball := ⟨0, 0⟩ +lemma CB4_2_2I2R7Mass_sound : CB4_2_2I2R7Mass.Encloses (∑ a, CB4_2_2I2R7Value a) := by + exact contains_sound (finSumBall_sound 6 CB4_2_2I2R7P CB4_2_2I2R7Value CB4_2_2I2R7P_sound) (by decide +kernel) +def CB4_2_2I2R7MassTerm : Ball := .exact 0 +lemma CB4_2_2I2R7MassTerm_sound : CB4_2_2I2R7MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB4_2_2I2R7Value a))) := + entropyTerm_zero_ball (CB4_2_2I2R7Mass_sound) +def CB4_2_2I2R7H : Ball := ⟨0, 0⟩ +lemma CB4_2_2I2R7H_sound : CB4_2_2I2R7H.Encloses (homogeneousEntropy CB4_2_2I2R7Value) := by + exact contains_sound (homogeneous_enclosed CB4_2_2I2R7Value CB4_2_2I2R7MassTerm_sound CB4_2_2I2R7Entropy_sound) (by decide +kernel) +def CB4_2_2I2R8Value (a : Fin 6) : ℝ := residualLaw (below (shape 4 2 2)) (fun u => (stageBLaw (shape 4 2 2) u : ℝ)) (stageBPriority (shape 4 2 2)) 2 (fun u a => (littleLaw (shape 4 2 2) u ((stageBPriority (shape 4 2 2)) 2) a : ℝ)) 8 a +def CB4_2_2I2R8Raw (a : Fin 6) : Ball := residualBall (below (shape 4 2 2)) B4_2_2Law (stageBPriority (shape 4 2 2)) 2 (fun u => B4_2_2Little u ((stageBPriority (shape 4 2 2)) 2)) 8 a +lemma CB4_2_2I2R8Raw_sound (a : Fin 6) : + (CB4_2_2I2R8Raw a).Encloses (CB4_2_2I2R8Value a) := by + exact residualBall_sound_on (below (shape 4 2 2)) B4_2_2Law (fun u => (stageBLaw (shape 4 2 2) u : ℝ)) (stageBPriority (shape 4 2 2)) 2 (fun u => B4_2_2Little u ((stageBPriority (shape 4 2 2)) 2)) (fun u a => (littleLaw (shape 4 2 2) u ((stageBPriority (shape 4 2 2)) 2) a : ℝ)) (fun u _ => B4_2_2Law_sound u) (fun u _ a => B4_2_2Little_sound u ((stageBPriority (shape 4 2 2)) 2) a) 8 a +def CB4_2_2I2R8Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB4_2_2I2R8Certificates_valid : + CB4_2_2I2R8Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB4_2_2I2R8CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB4_2_2I2R8P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB4_2_2I2R8Certificates (CB4_2_2I2R8CertificateIndex a)).input +lemma CB4_2_2I2R8P_check : ∀ a : Fin 6, contains (CB4_2_2I2R8Raw a) (CB4_2_2I2R8P a) = true := by + decide +kernel +lemma CB4_2_2I2R8P_sound (a : Fin 6) : + (CB4_2_2I2R8P a).Encloses (CB4_2_2I2R8Value a) := + contains_sound (CB4_2_2I2R8Raw_sound a) (CB4_2_2I2R8P_check a) +def CB4_2_2I2R8Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB4_2_2I2R8Certificates (CB4_2_2I2R8CertificateIndex a)).output +lemma CB4_2_2I2R8Terms_sound (a : Fin 6) : + (CB4_2_2I2R8Terms a).Encloses (Foundation.entropyTerm (CB4_2_2I2R8Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB4_2_2I2R8Certificates_valid + (CB4_2_2I2R8CertificateIndex a) (CB4_2_2I2R8P_sound a) +def CB4_2_2I2R8Entropy : Ball := ⟨0, 0⟩ +lemma CB4_2_2I2R8Entropy_sound : CB4_2_2I2R8Entropy.Encloses (Foundation.finiteEntropy CB4_2_2I2R8Value) := by + exact contains_sound (entropyFin_enclosed 6 CB4_2_2I2R8Value CB4_2_2I2R8Terms CB4_2_2I2R8Terms_sound) (by decide +kernel) +def CB4_2_2I2R8Mass : Ball := ⟨0, 0⟩ +lemma CB4_2_2I2R8Mass_sound : CB4_2_2I2R8Mass.Encloses (∑ a, CB4_2_2I2R8Value a) := by + exact contains_sound (finSumBall_sound 6 CB4_2_2I2R8P CB4_2_2I2R8Value CB4_2_2I2R8P_sound) (by decide +kernel) +def CB4_2_2I2R8MassTerm : Ball := .exact 0 +lemma CB4_2_2I2R8MassTerm_sound : CB4_2_2I2R8MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB4_2_2I2R8Value a))) := + entropyTerm_zero_ball (CB4_2_2I2R8Mass_sound) +def CB4_2_2I2R8H : Ball := ⟨0, 0⟩ +lemma CB4_2_2I2R8H_sound : CB4_2_2I2R8H.Encloses (homogeneousEntropy CB4_2_2I2R8Value) := by + exact contains_sound (homogeneous_enclosed CB4_2_2I2R8Value CB4_2_2I2R8MassTerm_sound CB4_2_2I2R8Entropy_sound) (by decide +kernel) +def CB4_2_2I2R9Value (a : Fin 6) : ℝ := residualLaw (below (shape 4 2 2)) (fun u => (stageBLaw (shape 4 2 2) u : ℝ)) (stageBPriority (shape 4 2 2)) 2 (fun u a => (littleLaw (shape 4 2 2) u ((stageBPriority (shape 4 2 2)) 2) a : ℝ)) 9 a +def CB4_2_2I2R9Raw (a : Fin 6) : Ball := residualBall (below (shape 4 2 2)) B4_2_2Law (stageBPriority (shape 4 2 2)) 2 (fun u => B4_2_2Little u ((stageBPriority (shape 4 2 2)) 2)) 9 a +lemma CB4_2_2I2R9Raw_sound (a : Fin 6) : + (CB4_2_2I2R9Raw a).Encloses (CB4_2_2I2R9Value a) := by + exact residualBall_sound_on (below (shape 4 2 2)) B4_2_2Law (fun u => (stageBLaw (shape 4 2 2) u : ℝ)) (stageBPriority (shape 4 2 2)) 2 (fun u => B4_2_2Little u ((stageBPriority (shape 4 2 2)) 2)) (fun u a => (littleLaw (shape 4 2 2) u ((stageBPriority (shape 4 2 2)) 2) a : ℝ)) (fun u _ => B4_2_2Law_sound u) (fun u _ a => B4_2_2Little_sound u ((stageBPriority (shape 4 2 2)) 2) a) 9 a +def CB4_2_2I2R9Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB4_2_2I2R9Certificates_valid : + CB4_2_2I2R9Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB4_2_2I2R9CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB4_2_2I2R9P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB4_2_2I2R9Certificates (CB4_2_2I2R9CertificateIndex a)).input +lemma CB4_2_2I2R9P_check : ∀ a : Fin 6, contains (CB4_2_2I2R9Raw a) (CB4_2_2I2R9P a) = true := by + decide +kernel +lemma CB4_2_2I2R9P_sound (a : Fin 6) : + (CB4_2_2I2R9P a).Encloses (CB4_2_2I2R9Value a) := + contains_sound (CB4_2_2I2R9Raw_sound a) (CB4_2_2I2R9P_check a) +def CB4_2_2I2R9Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB4_2_2I2R9Certificates (CB4_2_2I2R9CertificateIndex a)).output +lemma CB4_2_2I2R9Terms_sound (a : Fin 6) : + (CB4_2_2I2R9Terms a).Encloses (Foundation.entropyTerm (CB4_2_2I2R9Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB4_2_2I2R9Certificates_valid + (CB4_2_2I2R9CertificateIndex a) (CB4_2_2I2R9P_sound a) +def CB4_2_2I2R9Entropy : Ball := ⟨0, 0⟩ +lemma CB4_2_2I2R9Entropy_sound : CB4_2_2I2R9Entropy.Encloses (Foundation.finiteEntropy CB4_2_2I2R9Value) := by + exact contains_sound (entropyFin_enclosed 6 CB4_2_2I2R9Value CB4_2_2I2R9Terms CB4_2_2I2R9Terms_sound) (by decide +kernel) +def CB4_2_2I2R9Mass : Ball := ⟨0, 0⟩ +lemma CB4_2_2I2R9Mass_sound : CB4_2_2I2R9Mass.Encloses (∑ a, CB4_2_2I2R9Value a) := by + exact contains_sound (finSumBall_sound 6 CB4_2_2I2R9P CB4_2_2I2R9Value CB4_2_2I2R9P_sound) (by decide +kernel) +def CB4_2_2I2R9MassTerm : Ball := .exact 0 +lemma CB4_2_2I2R9MassTerm_sound : CB4_2_2I2R9MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB4_2_2I2R9Value a))) := + entropyTerm_zero_ball (CB4_2_2I2R9Mass_sound) +def CB4_2_2I2R9H : Ball := ⟨0, 0⟩ +lemma CB4_2_2I2R9H_sound : CB4_2_2I2R9H.Encloses (homogeneousEntropy CB4_2_2I2R9Value) := by + exact contains_sound (homogeneous_enclosed CB4_2_2I2R9Value CB4_2_2I2R9MassTerm_sound CB4_2_2I2R9Entropy_sound) (by decide +kernel) +def CB4_2_2I2R10Value (a : Fin 6) : ℝ := residualLaw (below (shape 4 2 2)) (fun u => (stageBLaw (shape 4 2 2) u : ℝ)) (stageBPriority (shape 4 2 2)) 2 (fun u a => (littleLaw (shape 4 2 2) u ((stageBPriority (shape 4 2 2)) 2) a : ℝ)) 10 a +def CB4_2_2I2R10Raw (a : Fin 6) : Ball := residualBall (below (shape 4 2 2)) B4_2_2Law (stageBPriority (shape 4 2 2)) 2 (fun u => B4_2_2Little u ((stageBPriority (shape 4 2 2)) 2)) 10 a +lemma CB4_2_2I2R10Raw_sound (a : Fin 6) : + (CB4_2_2I2R10Raw a).Encloses (CB4_2_2I2R10Value a) := by + exact residualBall_sound_on (below (shape 4 2 2)) B4_2_2Law (fun u => (stageBLaw (shape 4 2 2) u : ℝ)) (stageBPriority (shape 4 2 2)) 2 (fun u => B4_2_2Little u ((stageBPriority (shape 4 2 2)) 2)) (fun u a => (littleLaw (shape 4 2 2) u ((stageBPriority (shape 4 2 2)) 2) a : ℝ)) (fun u _ => B4_2_2Law_sound u) (fun u _ a => B4_2_2Little_sound u ((stageBPriority (shape 4 2 2)) 2) a) 10 a +def CB4_2_2I2R10Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB4_2_2I2R10Certificates_valid : + CB4_2_2I2R10Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB4_2_2I2R10CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB4_2_2I2R10P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB4_2_2I2R10Certificates (CB4_2_2I2R10CertificateIndex a)).input +lemma CB4_2_2I2R10P_check : ∀ a : Fin 6, contains (CB4_2_2I2R10Raw a) (CB4_2_2I2R10P a) = true := by + decide +kernel +lemma CB4_2_2I2R10P_sound (a : Fin 6) : + (CB4_2_2I2R10P a).Encloses (CB4_2_2I2R10Value a) := + contains_sound (CB4_2_2I2R10Raw_sound a) (CB4_2_2I2R10P_check a) +def CB4_2_2I2R10Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB4_2_2I2R10Certificates (CB4_2_2I2R10CertificateIndex a)).output +lemma CB4_2_2I2R10Terms_sound (a : Fin 6) : + (CB4_2_2I2R10Terms a).Encloses (Foundation.entropyTerm (CB4_2_2I2R10Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB4_2_2I2R10Certificates_valid + (CB4_2_2I2R10CertificateIndex a) (CB4_2_2I2R10P_sound a) +def CB4_2_2I2R10Entropy : Ball := ⟨0, 0⟩ +lemma CB4_2_2I2R10Entropy_sound : CB4_2_2I2R10Entropy.Encloses (Foundation.finiteEntropy CB4_2_2I2R10Value) := by + exact contains_sound (entropyFin_enclosed 6 CB4_2_2I2R10Value CB4_2_2I2R10Terms CB4_2_2I2R10Terms_sound) (by decide +kernel) +def CB4_2_2I2R10Mass : Ball := ⟨0, 0⟩ +lemma CB4_2_2I2R10Mass_sound : CB4_2_2I2R10Mass.Encloses (∑ a, CB4_2_2I2R10Value a) := by + exact contains_sound (finSumBall_sound 6 CB4_2_2I2R10P CB4_2_2I2R10Value CB4_2_2I2R10P_sound) (by decide +kernel) +def CB4_2_2I2R10MassTerm : Ball := .exact 0 +lemma CB4_2_2I2R10MassTerm_sound : CB4_2_2I2R10MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB4_2_2I2R10Value a))) := + entropyTerm_zero_ball (CB4_2_2I2R10Mass_sound) +def CB4_2_2I2R10H : Ball := ⟨0, 0⟩ +lemma CB4_2_2I2R10H_sound : CB4_2_2I2R10H.Encloses (homogeneousEntropy CB4_2_2I2R10Value) := by + exact contains_sound (homogeneous_enclosed CB4_2_2I2R10Value CB4_2_2I2R10MassTerm_sound CB4_2_2I2R10Entropy_sound) (by decide +kernel) +def CB4_2_2I2R11Value (a : Fin 6) : ℝ := residualLaw (below (shape 4 2 2)) (fun u => (stageBLaw (shape 4 2 2) u : ℝ)) (stageBPriority (shape 4 2 2)) 2 (fun u a => (littleLaw (shape 4 2 2) u ((stageBPriority (shape 4 2 2)) 2) a : ℝ)) 11 a +def CB4_2_2I2R11Raw (a : Fin 6) : Ball := residualBall (below (shape 4 2 2)) B4_2_2Law (stageBPriority (shape 4 2 2)) 2 (fun u => B4_2_2Little u ((stageBPriority (shape 4 2 2)) 2)) 11 a +lemma CB4_2_2I2R11Raw_sound (a : Fin 6) : + (CB4_2_2I2R11Raw a).Encloses (CB4_2_2I2R11Value a) := by + exact residualBall_sound_on (below (shape 4 2 2)) B4_2_2Law (fun u => (stageBLaw (shape 4 2 2) u : ℝ)) (stageBPriority (shape 4 2 2)) 2 (fun u => B4_2_2Little u ((stageBPriority (shape 4 2 2)) 2)) (fun u a => (littleLaw (shape 4 2 2) u ((stageBPriority (shape 4 2 2)) 2) a : ℝ)) (fun u _ => B4_2_2Law_sound u) (fun u _ a => B4_2_2Little_sound u ((stageBPriority (shape 4 2 2)) 2) a) 11 a +def CB4_2_2I2R11Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB4_2_2I2R11Certificates_valid : + CB4_2_2I2R11Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB4_2_2I2R11CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB4_2_2I2R11P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB4_2_2I2R11Certificates (CB4_2_2I2R11CertificateIndex a)).input +lemma CB4_2_2I2R11P_check : ∀ a : Fin 6, contains (CB4_2_2I2R11Raw a) (CB4_2_2I2R11P a) = true := by + decide +kernel +lemma CB4_2_2I2R11P_sound (a : Fin 6) : + (CB4_2_2I2R11P a).Encloses (CB4_2_2I2R11Value a) := + contains_sound (CB4_2_2I2R11Raw_sound a) (CB4_2_2I2R11P_check a) +def CB4_2_2I2R11Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB4_2_2I2R11Certificates (CB4_2_2I2R11CertificateIndex a)).output +lemma CB4_2_2I2R11Terms_sound (a : Fin 6) : + (CB4_2_2I2R11Terms a).Encloses (Foundation.entropyTerm (CB4_2_2I2R11Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB4_2_2I2R11Certificates_valid + (CB4_2_2I2R11CertificateIndex a) (CB4_2_2I2R11P_sound a) +def CB4_2_2I2R11Entropy : Ball := ⟨0, 0⟩ +lemma CB4_2_2I2R11Entropy_sound : CB4_2_2I2R11Entropy.Encloses (Foundation.finiteEntropy CB4_2_2I2R11Value) := by + exact contains_sound (entropyFin_enclosed 6 CB4_2_2I2R11Value CB4_2_2I2R11Terms CB4_2_2I2R11Terms_sound) (by decide +kernel) +def CB4_2_2I2R11Mass : Ball := ⟨0, 0⟩ +lemma CB4_2_2I2R11Mass_sound : CB4_2_2I2R11Mass.Encloses (∑ a, CB4_2_2I2R11Value a) := by + exact contains_sound (finSumBall_sound 6 CB4_2_2I2R11P CB4_2_2I2R11Value CB4_2_2I2R11P_sound) (by decide +kernel) +def CB4_2_2I2R11MassTerm : Ball := .exact 0 +lemma CB4_2_2I2R11MassTerm_sound : CB4_2_2I2R11MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB4_2_2I2R11Value a))) := + entropyTerm_zero_ball (CB4_2_2I2R11Mass_sound) +def CB4_2_2I2R11H : Ball := ⟨0, 0⟩ +lemma CB4_2_2I2R11H_sound : CB4_2_2I2R11H.Encloses (homogeneousEntropy CB4_2_2I2R11Value) := by + exact contains_sound (homogeneous_enclosed CB4_2_2I2R11Value CB4_2_2I2R11MassTerm_sound CB4_2_2I2R11Entropy_sound) (by decide +kernel) +def CB4_2_2I2R12Value (a : Fin 6) : ℝ := residualLaw (below (shape 4 2 2)) (fun u => (stageBLaw (shape 4 2 2) u : ℝ)) (stageBPriority (shape 4 2 2)) 2 (fun u a => (littleLaw (shape 4 2 2) u ((stageBPriority (shape 4 2 2)) 2) a : ℝ)) 12 a +def CB4_2_2I2R12Raw (a : Fin 6) : Ball := residualBall (below (shape 4 2 2)) B4_2_2Law (stageBPriority (shape 4 2 2)) 2 (fun u => B4_2_2Little u ((stageBPriority (shape 4 2 2)) 2)) 12 a +lemma CB4_2_2I2R12Raw_sound (a : Fin 6) : + (CB4_2_2I2R12Raw a).Encloses (CB4_2_2I2R12Value a) := by + exact residualBall_sound_on (below (shape 4 2 2)) B4_2_2Law (fun u => (stageBLaw (shape 4 2 2) u : ℝ)) (stageBPriority (shape 4 2 2)) 2 (fun u => B4_2_2Little u ((stageBPriority (shape 4 2 2)) 2)) (fun u a => (littleLaw (shape 4 2 2) u ((stageBPriority (shape 4 2 2)) 2) a : ℝ)) (fun u _ => B4_2_2Law_sound u) (fun u _ a => B4_2_2Little_sound u ((stageBPriority (shape 4 2 2)) 2) a) 12 a +def CB4_2_2I2R12Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB4_2_2I2R12Certificates_valid : + CB4_2_2I2R12Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB4_2_2I2R12CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB4_2_2I2R12P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB4_2_2I2R12Certificates (CB4_2_2I2R12CertificateIndex a)).input +lemma CB4_2_2I2R12P_check : ∀ a : Fin 6, contains (CB4_2_2I2R12Raw a) (CB4_2_2I2R12P a) = true := by + decide +kernel +lemma CB4_2_2I2R12P_sound (a : Fin 6) : + (CB4_2_2I2R12P a).Encloses (CB4_2_2I2R12Value a) := + contains_sound (CB4_2_2I2R12Raw_sound a) (CB4_2_2I2R12P_check a) +def CB4_2_2I2R12Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB4_2_2I2R12Certificates (CB4_2_2I2R12CertificateIndex a)).output +lemma CB4_2_2I2R12Terms_sound (a : Fin 6) : + (CB4_2_2I2R12Terms a).Encloses (Foundation.entropyTerm (CB4_2_2I2R12Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB4_2_2I2R12Certificates_valid + (CB4_2_2I2R12CertificateIndex a) (CB4_2_2I2R12P_sound a) +def CB4_2_2I2R12Entropy : Ball := ⟨0, 0⟩ +lemma CB4_2_2I2R12Entropy_sound : CB4_2_2I2R12Entropy.Encloses (Foundation.finiteEntropy CB4_2_2I2R12Value) := by + exact contains_sound (entropyFin_enclosed 6 CB4_2_2I2R12Value CB4_2_2I2R12Terms CB4_2_2I2R12Terms_sound) (by decide +kernel) +def CB4_2_2I2R12Mass : Ball := ⟨0, 0⟩ +lemma CB4_2_2I2R12Mass_sound : CB4_2_2I2R12Mass.Encloses (∑ a, CB4_2_2I2R12Value a) := by + exact contains_sound (finSumBall_sound 6 CB4_2_2I2R12P CB4_2_2I2R12Value CB4_2_2I2R12P_sound) (by decide +kernel) +def CB4_2_2I2R12MassTerm : Ball := .exact 0 +lemma CB4_2_2I2R12MassTerm_sound : CB4_2_2I2R12MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB4_2_2I2R12Value a))) := + entropyTerm_zero_ball (CB4_2_2I2R12Mass_sound) +def CB4_2_2I2R12H : Ball := ⟨0, 0⟩ +lemma CB4_2_2I2R12H_sound : CB4_2_2I2R12H.Encloses (homogeneousEntropy CB4_2_2I2R12Value) := by + exact contains_sound (homogeneous_enclosed CB4_2_2I2R12Value CB4_2_2I2R12MassTerm_sound CB4_2_2I2R12Entropy_sound) (by decide +kernel) +def CB4_2_2I2R13Value (a : Fin 6) : ℝ := residualLaw (below (shape 4 2 2)) (fun u => (stageBLaw (shape 4 2 2) u : ℝ)) (stageBPriority (shape 4 2 2)) 2 (fun u a => (littleLaw (shape 4 2 2) u ((stageBPriority (shape 4 2 2)) 2) a : ℝ)) 13 a +def CB4_2_2I2R13Raw (a : Fin 6) : Ball := residualBall (below (shape 4 2 2)) B4_2_2Law (stageBPriority (shape 4 2 2)) 2 (fun u => B4_2_2Little u ((stageBPriority (shape 4 2 2)) 2)) 13 a +lemma CB4_2_2I2R13Raw_sound (a : Fin 6) : + (CB4_2_2I2R13Raw a).Encloses (CB4_2_2I2R13Value a) := by + exact residualBall_sound_on (below (shape 4 2 2)) B4_2_2Law (fun u => (stageBLaw (shape 4 2 2) u : ℝ)) (stageBPriority (shape 4 2 2)) 2 (fun u => B4_2_2Little u ((stageBPriority (shape 4 2 2)) 2)) (fun u a => (littleLaw (shape 4 2 2) u ((stageBPriority (shape 4 2 2)) 2) a : ℝ)) (fun u _ => B4_2_2Law_sound u) (fun u _ a => B4_2_2Little_sound u ((stageBPriority (shape 4 2 2)) 2) a) 13 a +def CB4_2_2I2R13Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB4_2_2I2R13Certificates_valid : + CB4_2_2I2R13Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB4_2_2I2R13CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB4_2_2I2R13P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB4_2_2I2R13Certificates (CB4_2_2I2R13CertificateIndex a)).input +lemma CB4_2_2I2R13P_check : ∀ a : Fin 6, contains (CB4_2_2I2R13Raw a) (CB4_2_2I2R13P a) = true := by + decide +kernel +lemma CB4_2_2I2R13P_sound (a : Fin 6) : + (CB4_2_2I2R13P a).Encloses (CB4_2_2I2R13Value a) := + contains_sound (CB4_2_2I2R13Raw_sound a) (CB4_2_2I2R13P_check a) +def CB4_2_2I2R13Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB4_2_2I2R13Certificates (CB4_2_2I2R13CertificateIndex a)).output +lemma CB4_2_2I2R13Terms_sound (a : Fin 6) : + (CB4_2_2I2R13Terms a).Encloses (Foundation.entropyTerm (CB4_2_2I2R13Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB4_2_2I2R13Certificates_valid + (CB4_2_2I2R13CertificateIndex a) (CB4_2_2I2R13P_sound a) +def CB4_2_2I2R13Entropy : Ball := ⟨0, 0⟩ +lemma CB4_2_2I2R13Entropy_sound : CB4_2_2I2R13Entropy.Encloses (Foundation.finiteEntropy CB4_2_2I2R13Value) := by + exact contains_sound (entropyFin_enclosed 6 CB4_2_2I2R13Value CB4_2_2I2R13Terms CB4_2_2I2R13Terms_sound) (by decide +kernel) +def CB4_2_2I2R13Mass : Ball := ⟨0, 0⟩ +lemma CB4_2_2I2R13Mass_sound : CB4_2_2I2R13Mass.Encloses (∑ a, CB4_2_2I2R13Value a) := by + exact contains_sound (finSumBall_sound 6 CB4_2_2I2R13P CB4_2_2I2R13Value CB4_2_2I2R13P_sound) (by decide +kernel) +def CB4_2_2I2R13MassTerm : Ball := .exact 0 +lemma CB4_2_2I2R13MassTerm_sound : CB4_2_2I2R13MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB4_2_2I2R13Value a))) := + entropyTerm_zero_ball (CB4_2_2I2R13Mass_sound) +def CB4_2_2I2R13H : Ball := ⟨0, 0⟩ +lemma CB4_2_2I2R13H_sound : CB4_2_2I2R13H.Encloses (homogeneousEntropy CB4_2_2I2R13Value) := by + exact contains_sound (homogeneous_enclosed CB4_2_2I2R13Value CB4_2_2I2R13MassTerm_sound CB4_2_2I2R13Entropy_sound) (by decide +kernel) +def CB4_2_2I2R14Value (a : Fin 6) : ℝ := residualLaw (below (shape 4 2 2)) (fun u => (stageBLaw (shape 4 2 2) u : ℝ)) (stageBPriority (shape 4 2 2)) 2 (fun u a => (littleLaw (shape 4 2 2) u ((stageBPriority (shape 4 2 2)) 2) a : ℝ)) 14 a +def CB4_2_2I2R14Raw (a : Fin 6) : Ball := residualBall (below (shape 4 2 2)) B4_2_2Law (stageBPriority (shape 4 2 2)) 2 (fun u => B4_2_2Little u ((stageBPriority (shape 4 2 2)) 2)) 14 a +lemma CB4_2_2I2R14Raw_sound (a : Fin 6) : + (CB4_2_2I2R14Raw a).Encloses (CB4_2_2I2R14Value a) := by + exact residualBall_sound_on (below (shape 4 2 2)) B4_2_2Law (fun u => (stageBLaw (shape 4 2 2) u : ℝ)) (stageBPriority (shape 4 2 2)) 2 (fun u => B4_2_2Little u ((stageBPriority (shape 4 2 2)) 2)) (fun u a => (littleLaw (shape 4 2 2) u ((stageBPriority (shape 4 2 2)) 2) a : ℝ)) (fun u _ => B4_2_2Law_sound u) (fun u _ a => B4_2_2Little_sound u ((stageBPriority (shape 4 2 2)) 2) a) 14 a +def CB4_2_2I2R14Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB4_2_2I2R14Certificates_valid : + CB4_2_2I2R14Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB4_2_2I2R14CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB4_2_2I2R14P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB4_2_2I2R14Certificates (CB4_2_2I2R14CertificateIndex a)).input +lemma CB4_2_2I2R14P_check : ∀ a : Fin 6, contains (CB4_2_2I2R14Raw a) (CB4_2_2I2R14P a) = true := by + decide +kernel +lemma CB4_2_2I2R14P_sound (a : Fin 6) : + (CB4_2_2I2R14P a).Encloses (CB4_2_2I2R14Value a) := + contains_sound (CB4_2_2I2R14Raw_sound a) (CB4_2_2I2R14P_check a) +def CB4_2_2I2R14Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB4_2_2I2R14Certificates (CB4_2_2I2R14CertificateIndex a)).output +lemma CB4_2_2I2R14Terms_sound (a : Fin 6) : + (CB4_2_2I2R14Terms a).Encloses (Foundation.entropyTerm (CB4_2_2I2R14Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB4_2_2I2R14Certificates_valid + (CB4_2_2I2R14CertificateIndex a) (CB4_2_2I2R14P_sound a) +def CB4_2_2I2R14Entropy : Ball := ⟨0, 0⟩ +lemma CB4_2_2I2R14Entropy_sound : CB4_2_2I2R14Entropy.Encloses (Foundation.finiteEntropy CB4_2_2I2R14Value) := by + exact contains_sound (entropyFin_enclosed 6 CB4_2_2I2R14Value CB4_2_2I2R14Terms CB4_2_2I2R14Terms_sound) (by decide +kernel) +def CB4_2_2I2R14Mass : Ball := ⟨0, 0⟩ +lemma CB4_2_2I2R14Mass_sound : CB4_2_2I2R14Mass.Encloses (∑ a, CB4_2_2I2R14Value a) := by + exact contains_sound (finSumBall_sound 6 CB4_2_2I2R14P CB4_2_2I2R14Value CB4_2_2I2R14P_sound) (by decide +kernel) +def CB4_2_2I2R14MassTerm : Ball := .exact 0 +lemma CB4_2_2I2R14MassTerm_sound : CB4_2_2I2R14MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB4_2_2I2R14Value a))) := + entropyTerm_zero_ball (CB4_2_2I2R14Mass_sound) +def CB4_2_2I2R14H : Ball := ⟨0, 0⟩ +lemma CB4_2_2I2R14H_sound : CB4_2_2I2R14H.Encloses (homogeneousEntropy CB4_2_2I2R14Value) := by + exact contains_sound (homogeneous_enclosed CB4_2_2I2R14Value CB4_2_2I2R14MassTerm_sound CB4_2_2I2R14Entropy_sound) (by decide +kernel) +def CB4_2_2I2R15Value (a : Fin 6) : ℝ := residualLaw (below (shape 4 2 2)) (fun u => (stageBLaw (shape 4 2 2) u : ℝ)) (stageBPriority (shape 4 2 2)) 2 (fun u a => (littleLaw (shape 4 2 2) u ((stageBPriority (shape 4 2 2)) 2) a : ℝ)) 15 a +def CB4_2_2I2R15Raw (a : Fin 6) : Ball := residualBall (below (shape 4 2 2)) B4_2_2Law (stageBPriority (shape 4 2 2)) 2 (fun u => B4_2_2Little u ((stageBPriority (shape 4 2 2)) 2)) 15 a +lemma CB4_2_2I2R15Raw_sound (a : Fin 6) : + (CB4_2_2I2R15Raw a).Encloses (CB4_2_2I2R15Value a) := by + exact residualBall_sound_on (below (shape 4 2 2)) B4_2_2Law (fun u => (stageBLaw (shape 4 2 2) u : ℝ)) (stageBPriority (shape 4 2 2)) 2 (fun u => B4_2_2Little u ((stageBPriority (shape 4 2 2)) 2)) (fun u a => (littleLaw (shape 4 2 2) u ((stageBPriority (shape 4 2 2)) 2) a : ℝ)) (fun u _ => B4_2_2Law_sound u) (fun u _ a => B4_2_2Little_sound u ((stageBPriority (shape 4 2 2)) 2) a) 15 a +def CB4_2_2I2R15Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB4_2_2I2R15Certificates_valid : + CB4_2_2I2R15Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB4_2_2I2R15CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB4_2_2I2R15P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB4_2_2I2R15Certificates (CB4_2_2I2R15CertificateIndex a)).input +lemma CB4_2_2I2R15P_check : ∀ a : Fin 6, contains (CB4_2_2I2R15Raw a) (CB4_2_2I2R15P a) = true := by + decide +kernel +lemma CB4_2_2I2R15P_sound (a : Fin 6) : + (CB4_2_2I2R15P a).Encloses (CB4_2_2I2R15Value a) := + contains_sound (CB4_2_2I2R15Raw_sound a) (CB4_2_2I2R15P_check a) +def CB4_2_2I2R15Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB4_2_2I2R15Certificates (CB4_2_2I2R15CertificateIndex a)).output +lemma CB4_2_2I2R15Terms_sound (a : Fin 6) : + (CB4_2_2I2R15Terms a).Encloses (Foundation.entropyTerm (CB4_2_2I2R15Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB4_2_2I2R15Certificates_valid + (CB4_2_2I2R15CertificateIndex a) (CB4_2_2I2R15P_sound a) +def CB4_2_2I2R15Entropy : Ball := ⟨0, 0⟩ +lemma CB4_2_2I2R15Entropy_sound : CB4_2_2I2R15Entropy.Encloses (Foundation.finiteEntropy CB4_2_2I2R15Value) := by + exact contains_sound (entropyFin_enclosed 6 CB4_2_2I2R15Value CB4_2_2I2R15Terms CB4_2_2I2R15Terms_sound) (by decide +kernel) +def CB4_2_2I2R15Mass : Ball := ⟨0, 0⟩ +lemma CB4_2_2I2R15Mass_sound : CB4_2_2I2R15Mass.Encloses (∑ a, CB4_2_2I2R15Value a) := by + exact contains_sound (finSumBall_sound 6 CB4_2_2I2R15P CB4_2_2I2R15Value CB4_2_2I2R15P_sound) (by decide +kernel) +def CB4_2_2I2R15MassTerm : Ball := .exact 0 +lemma CB4_2_2I2R15MassTerm_sound : CB4_2_2I2R15MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB4_2_2I2R15Value a))) := + entropyTerm_zero_ball (CB4_2_2I2R15Mass_sound) +def CB4_2_2I2R15H : Ball := ⟨0, 0⟩ +lemma CB4_2_2I2R15H_sound : CB4_2_2I2R15H.Encloses (homogeneousEntropy CB4_2_2I2R15Value) := by + exact contains_sound (homogeneous_enclosed CB4_2_2I2R15Value CB4_2_2I2R15MassTerm_sound CB4_2_2I2R15Entropy_sound) (by decide +kernel) +def CB4_2_2I2R16Value (a : Fin 6) : ℝ := residualLaw (below (shape 4 2 2)) (fun u => (stageBLaw (shape 4 2 2) u : ℝ)) (stageBPriority (shape 4 2 2)) 2 (fun u a => (littleLaw (shape 4 2 2) u ((stageBPriority (shape 4 2 2)) 2) a : ℝ)) 16 a +def CB4_2_2I2R16Raw (a : Fin 6) : Ball := residualBall (below (shape 4 2 2)) B4_2_2Law (stageBPriority (shape 4 2 2)) 2 (fun u => B4_2_2Little u ((stageBPriority (shape 4 2 2)) 2)) 16 a +lemma CB4_2_2I2R16Raw_sound (a : Fin 6) : + (CB4_2_2I2R16Raw a).Encloses (CB4_2_2I2R16Value a) := by + exact residualBall_sound_on (below (shape 4 2 2)) B4_2_2Law (fun u => (stageBLaw (shape 4 2 2) u : ℝ)) (stageBPriority (shape 4 2 2)) 2 (fun u => B4_2_2Little u ((stageBPriority (shape 4 2 2)) 2)) (fun u a => (littleLaw (shape 4 2 2) u ((stageBPriority (shape 4 2 2)) 2) a : ℝ)) (fun u _ => B4_2_2Law_sound u) (fun u _ a => B4_2_2Little_sound u ((stageBPriority (shape 4 2 2)) 2) a) 16 a +def CB4_2_2I2R16Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB4_2_2I2R16Certificates_valid : + CB4_2_2I2R16Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB4_2_2I2R16CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB4_2_2I2R16P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB4_2_2I2R16Certificates (CB4_2_2I2R16CertificateIndex a)).input +lemma CB4_2_2I2R16P_check : ∀ a : Fin 6, contains (CB4_2_2I2R16Raw a) (CB4_2_2I2R16P a) = true := by + decide +kernel +lemma CB4_2_2I2R16P_sound (a : Fin 6) : + (CB4_2_2I2R16P a).Encloses (CB4_2_2I2R16Value a) := + contains_sound (CB4_2_2I2R16Raw_sound a) (CB4_2_2I2R16P_check a) +def CB4_2_2I2R16Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB4_2_2I2R16Certificates (CB4_2_2I2R16CertificateIndex a)).output +lemma CB4_2_2I2R16Terms_sound (a : Fin 6) : + (CB4_2_2I2R16Terms a).Encloses (Foundation.entropyTerm (CB4_2_2I2R16Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB4_2_2I2R16Certificates_valid + (CB4_2_2I2R16CertificateIndex a) (CB4_2_2I2R16P_sound a) +def CB4_2_2I2R16Entropy : Ball := ⟨0, 0⟩ +lemma CB4_2_2I2R16Entropy_sound : CB4_2_2I2R16Entropy.Encloses (Foundation.finiteEntropy CB4_2_2I2R16Value) := by + exact contains_sound (entropyFin_enclosed 6 CB4_2_2I2R16Value CB4_2_2I2R16Terms CB4_2_2I2R16Terms_sound) (by decide +kernel) +def CB4_2_2I2R16Mass : Ball := ⟨0, 0⟩ +lemma CB4_2_2I2R16Mass_sound : CB4_2_2I2R16Mass.Encloses (∑ a, CB4_2_2I2R16Value a) := by + exact contains_sound (finSumBall_sound 6 CB4_2_2I2R16P CB4_2_2I2R16Value CB4_2_2I2R16P_sound) (by decide +kernel) +def CB4_2_2I2R16MassTerm : Ball := .exact 0 +lemma CB4_2_2I2R16MassTerm_sound : CB4_2_2I2R16MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB4_2_2I2R16Value a))) := + entropyTerm_zero_ball (CB4_2_2I2R16Mass_sound) +def CB4_2_2I2R16H : Ball := ⟨0, 0⟩ +lemma CB4_2_2I2R16H_sound : CB4_2_2I2R16H.Encloses (homogeneousEntropy CB4_2_2I2R16Value) := by + exact contains_sound (homogeneous_enclosed CB4_2_2I2R16Value CB4_2_2I2R16MassTerm_sound CB4_2_2I2R16Entropy_sound) (by decide +kernel) +def CB4_2_2I2ResidualEntropies (a : Fin 17) : Ball := + match a.val with + | 0 => CB4_2_2I2R0H + | 1 => CB4_2_2I2R1H + | 2 => CB4_2_2I2R2H + | 3 => CB4_2_2I2R3H + | 4 => CB4_2_2I2R4H + | 5 => CB4_2_2I2R5H + | 6 => CB4_2_2I2R6H + | 7 => CB4_2_2I2R7H + | 8 => CB4_2_2I2R8H + | 9 => CB4_2_2I2R9H + | 10 => CB4_2_2I2R10H + | 11 => CB4_2_2I2R11H + | 12 => CB4_2_2I2R12H + | 13 => CB4_2_2I2R13H + | 14 => CB4_2_2I2R14H + | 15 => CB4_2_2I2R15H + | 16 => CB4_2_2I2R16H + | _ => (.exact 0) +lemma CB4_2_2I2ResidualEntropies_sound (k : Fin 17) : + (CB4_2_2I2ResidualEntropies k).Encloses (homogeneousEntropy + (residualLaw (below (shape 4 2 2)) (fun u => (stageBLaw (shape 4 2 2) u : ℝ)) (stageBPriority (shape 4 2 2)) 2 (fun u a => (littleLaw (shape 4 2 2) u ((stageBPriority (shape 4 2 2)) 2) a : ℝ)) k)) := by + fin_cases k + · exact CB4_2_2I2R0H_sound + · exact CB4_2_2I2R1H_sound + · exact CB4_2_2I2R2H_sound + · exact CB4_2_2I2R3H_sound + · exact CB4_2_2I2R4H_sound + · exact CB4_2_2I2R5H_sound + · exact CB4_2_2I2R6H_sound + · exact CB4_2_2I2R7H_sound + · exact CB4_2_2I2R8H_sound + · exact CB4_2_2I2R9H_sound + · exact CB4_2_2I2R10H_sound + · exact CB4_2_2I2R11H_sound + · exact CB4_2_2I2R12H_sound + · exact CB4_2_2I2R13H_sound + · exact CB4_2_2I2R14H_sound + · exact CB4_2_2I2R15H_sound + · exact CB4_2_2I2R16H_sound +def CB4_2_2I2S2_0_2Value (a : Fin 6) : ℝ := (littleLaw (shape 4 2 2) (shape 2 0 2) ((stageBPriority (shape 4 2 2)) 2) a : ℝ) +def CB4_2_2I2S2_0_2E_2LogWitness : LogWitness := ⟨-1, 447669, 250000⟩ +def CB4_2_2I2S2_0_2E_2Log : Ball := ⟨(-11055397836918052136994139561117 / 100000000000000000000000000000000), (21175823683 / 50000000000000000000000000000000)⟩ +lemma CB4_2_2I2S2_0_2E_2Log_sound : CB4_2_2I2S2_0_2E_2Log.Encloses (Real.log (CB4_2_2I2S2_0_2Value (2 : Fin 6))) := by + exact checkLog_sound logTwoBall_sound ((B4_2_2Little_sound (shape 2 0 2) ((stageBPriority (shape 4 2 2)) 2)) (2 : Fin 6)) (w := CB4_2_2I2S2_0_2E_2LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB4_2_2I2S2_0_2E_2 : Ball := ⟨(9898317788510534964232058926371 / 100000000000000000000000000000000), (151676157 / 400000000000000000000000000000)⟩ +lemma CB4_2_2I2S2_0_2E_2_sound : CB4_2_2I2S2_0_2E_2.Encloses (Foundation.entropyTerm (CB4_2_2I2S2_0_2Value (2 : Fin 6))) := by + exact contains_sound (entropyTerm_ball ((B4_2_2Little_sound (shape 2 0 2) ((stageBPriority (shape 4 2 2)) 2)) (2 : Fin 6)) CB4_2_2I2S2_0_2E_2Log_sound) (by decide +kernel) +def CB4_2_2I2S2_0_2E_3LogWitness : LogWitness := ⟨-4, 52331, 31250⟩ +def CB4_2_2I2S2_0_2E_3Log : Ball := ⟨(-14106369804520244990198383124901 / 6250000000000000000000000000000), (21175823683 / 20000000000000000000000000000000)⟩ +lemma CB4_2_2I2S2_0_2E_3Log_sound : CB4_2_2I2S2_0_2E_3Log.Encloses (Real.log (CB4_2_2I2S2_0_2Value (3 : Fin 6))) := by + exact checkLog_sound logTwoBall_sound ((B4_2_2Little_sound (shape 2 0 2) ((stageBPriority (shape 4 2 2)) 2)) (3 : Fin 6)) (w := CB4_2_2I2S2_0_2E_3LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB4_2_2I2S2_0_2E_3 : Ball := ⟨(11811207011845583049313145396947 / 50000000000000000000000000000000), (2770380073 / 25000000000000000000000000000000)⟩ +lemma CB4_2_2I2S2_0_2E_3_sound : CB4_2_2I2S2_0_2E_3.Encloses (Foundation.entropyTerm (CB4_2_2I2S2_0_2Value (3 : Fin 6))) := by + exact contains_sound (entropyTerm_ball ((B4_2_2Little_sound (shape 2 0 2) ((stageBPriority (shape 4 2 2)) 2)) (3 : Fin 6)) CB4_2_2I2S2_0_2E_3Log_sound) (by decide +kernel) +def CB4_2_2I2S2_0_2Terms (a : Fin 6) : Ball := + match a.val with + | 2 => ⟨(9898317788510534964232058926371 / 100000000000000000000000000000000), (151676157 / 400000000000000000000000000000)⟩ + | 3 => ⟨(11811207011845583049313145396947 / 50000000000000000000000000000000), (2770380073 / 25000000000000000000000000000000)⟩ + | _ => (.exact 0) +lemma CB4_2_2I2S2_0_2Terms_sound (a : Fin 6) : + (CB4_2_2I2S2_0_2Terms a).Encloses (Foundation.entropyTerm (CB4_2_2I2S2_0_2Value a)) := by + fin_cases a + · exact (entropyTerm_zero_ball ((B4_2_2Little_sound (shape 2 0 2) ((stageBPriority (shape 4 2 2)) 2)) (0 : Fin 6))) + · exact (entropyTerm_zero_ball ((B4_2_2Little_sound (shape 2 0 2) ((stageBPriority (shape 4 2 2)) 2)) (1 : Fin 6))) + · exact CB4_2_2I2S2_0_2E_2_sound + · exact CB4_2_2I2S2_0_2E_3_sound + · exact (entropyTerm_zero_ball ((B4_2_2Little_sound (shape 2 0 2) ((stageBPriority (shape 4 2 2)) 2)) (4 : Fin 6))) + · exact (entropyTerm_zero_ball ((B4_2_2Little_sound (shape 2 0 2) ((stageBPriority (shape 4 2 2)) 2)) (5 : Fin 6))) +def CB4_2_2I2S2_0_2Entropy : Ball := ⟨(6704146362440340212571669944053 / 20000000000000000000000000000000), (24500279771 / 50000000000000000000000000000000)⟩ +lemma CB4_2_2I2S2_0_2Entropy_sound : CB4_2_2I2S2_0_2Entropy.Encloses (Foundation.finiteEntropy CB4_2_2I2S2_0_2Value) := by + exact contains_sound (entropyFin_enclosed 6 CB4_2_2I2S2_0_2Value CB4_2_2I2S2_0_2Terms CB4_2_2I2S2_0_2Terms_sound) (by decide +kernel) +def CB4_2_2I2S2_0_2Mass : Ball := ⟨1, 0⟩ +lemma CB4_2_2I2S2_0_2Mass_sound : CB4_2_2I2S2_0_2Mass.Encloses (∑ a, CB4_2_2I2S2_0_2Value a) := by + exact contains_sound (finSumBall_sound 6 (B4_2_2Little (shape 2 0 2) ((stageBPriority (shape 4 2 2)) 2)) CB4_2_2I2S2_0_2Value (B4_2_2Little_sound (shape 2 0 2) ((stageBPriority (shape 4 2 2)) 2))) (by decide +kernel) +def CB4_2_2I2S2_0_2MassTermLog : Ball := .exact 0 +lemma CB4_2_2I2S2_0_2MassTermLog_sound : CB4_2_2I2S2_0_2MassTermLog.Encloses (Real.log ((∑ a, CB4_2_2I2S2_0_2Value a))) := by + exact log_exact_one_ball (CB4_2_2I2S2_0_2Mass_sound) +def CB4_2_2I2S2_0_2MassTerm : Ball := ⟨0, 0⟩ +lemma CB4_2_2I2S2_0_2MassTerm_sound : CB4_2_2I2S2_0_2MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB4_2_2I2S2_0_2Value a))) := by + exact contains_sound (entropyTerm_ball (CB4_2_2I2S2_0_2Mass_sound) CB4_2_2I2S2_0_2MassTermLog_sound) (by decide +kernel) +def CB4_2_2I2S2_0_2H : Ball := ⟨(6704146362440340212571669944053 / 20000000000000000000000000000000), (24500279771 / 50000000000000000000000000000000)⟩ +lemma CB4_2_2I2S2_0_2H_sound : CB4_2_2I2S2_0_2H.Encloses (homogeneousEntropy CB4_2_2I2S2_0_2Value) := by + exact contains_sound (homogeneous_enclosed CB4_2_2I2S2_0_2Value CB4_2_2I2S2_0_2MassTerm_sound CB4_2_2I2S2_0_2Entropy_sound) (by decide +kernel) +def CB4_2_2I2S2_2_0Value (a : Fin 6) : ℝ := (littleLaw (shape 4 2 2) (shape 2 2 0) ((stageBPriority (shape 4 2 2)) 2) a : ℝ) +def CB4_2_2I2S2_2_0E_2LogWitness : LogWitness := ⟨-1, 447549, 250000⟩ +def CB4_2_2I2S2_2_0E_2Log : Ball := ⟨(-692637934343495837134511622293 / 6250000000000000000000000000000), (21175823683 / 50000000000000000000000000000000)⟩ +lemma CB4_2_2I2S2_2_0E_2Log_sound : CB4_2_2I2S2_2_0E_2Log.Encloses (Real.log (CB4_2_2I2S2_2_0Value (2 : Fin 6))) := by + exact checkLog_sound logTwoBall_sound ((B4_2_2Little_sound (shape 2 2 0) ((stageBPriority (shape 4 2 2)) 2)) (2 : Fin 6)) (w := CB4_2_2I2S2_2_0E_2LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB4_2_2I2S2_2_0E_2 : Ball := ⟨(495983063803995549461941667273 / 5000000000000000000000000000000), (7581774971 / 20000000000000000000000000000000)⟩ +lemma CB4_2_2I2S2_2_0E_2_sound : CB4_2_2I2S2_2_0E_2.Encloses (Foundation.entropyTerm (CB4_2_2I2S2_2_0Value (2 : Fin 6))) := by + exact contains_sound (entropyTerm_ball ((B4_2_2Little_sound (shape 2 2 0) ((stageBPriority (shape 4 2 2)) 2)) (2 : Fin 6)) CB4_2_2I2S2_2_0E_2Log_sound) (by decide +kernel) +def CB4_2_2I2S2_2_0E_3LogWitness : LogWitness := ⟨-4, 52451, 31250⟩ +def CB4_2_2I2S2_2_0E_3Log : Ball := ⟨(-225472869798470476592187191794959 / 100000000000000000000000000000000), (52939559207 / 50000000000000000000000000000000)⟩ +lemma CB4_2_2I2S2_2_0E_3Log_sound : CB4_2_2I2S2_2_0E_3Log.Encloses (Real.log (CB4_2_2I2S2_2_0Value (3 : Fin 6))) := by + exact checkLog_sound logTwoBall_sound ((B4_2_2Little_sound (shape 2 2 0) ((stageBPriority (shape 4 2 2)) 2)) (3 : Fin 6)) (w := CB4_2_2I2S2_2_0E_3LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB4_2_2I2S2_2_0E_3 : Ball := ⟨(946102199503965997418944831747 / 4000000000000000000000000000000), (11106931281 / 100000000000000000000000000000000)⟩ +lemma CB4_2_2I2S2_2_0E_3_sound : CB4_2_2I2S2_2_0E_3.Encloses (Foundation.entropyTerm (CB4_2_2I2S2_2_0Value (3 : Fin 6))) := by + exact contains_sound (entropyTerm_ball ((B4_2_2Little_sound (shape 2 2 0) ((stageBPriority (shape 4 2 2)) 2)) (3 : Fin 6)) CB4_2_2I2S2_2_0E_3Log_sound) (by decide +kernel) +def CB4_2_2I2S2_2_0Terms (a : Fin 6) : Ball := + match a.val with + | 2 => ⟨(495983063803995549461941667273 / 5000000000000000000000000000000), (7581774971 / 20000000000000000000000000000000)⟩ + | 3 => ⟨(946102199503965997418944831747 / 4000000000000000000000000000000), (11106931281 / 100000000000000000000000000000000)⟩ + | _ => (.exact 0) +lemma CB4_2_2I2S2_2_0Terms_sound (a : Fin 6) : + (CB4_2_2I2S2_2_0Terms a).Encloses (Foundation.entropyTerm (CB4_2_2I2S2_2_0Value a)) := by + fin_cases a + · exact (entropyTerm_zero_ball ((B4_2_2Little_sound (shape 2 2 0) ((stageBPriority (shape 4 2 2)) 2)) (0 : Fin 6))) + · exact (entropyTerm_zero_ball ((B4_2_2Little_sound (shape 2 2 0) ((stageBPriority (shape 4 2 2)) 2)) (1 : Fin 6))) + · exact CB4_2_2I2S2_2_0E_2_sound + · exact CB4_2_2I2S2_2_0E_3_sound + · exact (entropyTerm_zero_ball ((B4_2_2Little_sound (shape 2 2 0) ((stageBPriority (shape 4 2 2)) 2)) (4 : Fin 6))) + · exact (entropyTerm_zero_ball ((B4_2_2Little_sound (shape 2 2 0) ((stageBPriority (shape 4 2 2)) 2)) (5 : Fin 6))) +def CB4_2_2I2S2_2_0Entropy : Ball := ⟨(6714443252735812184942490827827 / 20000000000000000000000000000000), (6126975767 / 12500000000000000000000000000000)⟩ +lemma CB4_2_2I2S2_2_0Entropy_sound : CB4_2_2I2S2_2_0Entropy.Encloses (Foundation.finiteEntropy CB4_2_2I2S2_2_0Value) := by + exact contains_sound (entropyFin_enclosed 6 CB4_2_2I2S2_2_0Value CB4_2_2I2S2_2_0Terms CB4_2_2I2S2_2_0Terms_sound) (by decide +kernel) +def CB4_2_2I2S2_2_0Mass : Ball := ⟨1, 0⟩ +lemma CB4_2_2I2S2_2_0Mass_sound : CB4_2_2I2S2_2_0Mass.Encloses (∑ a, CB4_2_2I2S2_2_0Value a) := by + exact contains_sound (finSumBall_sound 6 (B4_2_2Little (shape 2 2 0) ((stageBPriority (shape 4 2 2)) 2)) CB4_2_2I2S2_2_0Value (B4_2_2Little_sound (shape 2 2 0) ((stageBPriority (shape 4 2 2)) 2))) (by decide +kernel) +def CB4_2_2I2S2_2_0MassTermLog : Ball := .exact 0 +lemma CB4_2_2I2S2_2_0MassTermLog_sound : CB4_2_2I2S2_2_0MassTermLog.Encloses (Real.log ((∑ a, CB4_2_2I2S2_2_0Value a))) := by + exact log_exact_one_ball (CB4_2_2I2S2_2_0Mass_sound) +def CB4_2_2I2S2_2_0MassTerm : Ball := ⟨0, 0⟩ +lemma CB4_2_2I2S2_2_0MassTerm_sound : CB4_2_2I2S2_2_0MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB4_2_2I2S2_2_0Value a))) := by + exact contains_sound (entropyTerm_ball (CB4_2_2I2S2_2_0Mass_sound) CB4_2_2I2S2_2_0MassTermLog_sound) (by decide +kernel) +def CB4_2_2I2S2_2_0H : Ball := ⟨(6714443252735812184942490827827 / 20000000000000000000000000000000), (6126975767 / 12500000000000000000000000000000)⟩ +lemma CB4_2_2I2S2_2_0H_sound : CB4_2_2I2S2_2_0H.Encloses (homogeneousEntropy CB4_2_2I2S2_2_0Value) := by + exact contains_sound (homogeneous_enclosed CB4_2_2I2S2_2_0Value CB4_2_2I2S2_2_0MassTerm_sound CB4_2_2I2S2_2_0Entropy_sound) (by decide +kernel) +def CB4_2_2I2S3_0_1Value (a : Fin 6) : ℝ := (littleLaw (shape 4 2 2) (shape 3 0 1) ((stageBPriority (shape 4 2 2)) 2) a : ℝ) +def CB4_2_2I2S3_0_1E_4Log : Ball := .exact 0 +lemma CB4_2_2I2S3_0_1E_4Log_sound : CB4_2_2I2S3_0_1E_4Log.Encloses (Real.log (CB4_2_2I2S3_0_1Value (4 : Fin 6))) := by + exact log_exact_one_ball ((B4_2_2Little_sound (shape 3 0 1) ((stageBPriority (shape 4 2 2)) 2)) (4 : Fin 6)) +def CB4_2_2I2S3_0_1E_4 : Ball := ⟨0, 0⟩ +lemma CB4_2_2I2S3_0_1E_4_sound : CB4_2_2I2S3_0_1E_4.Encloses (Foundation.entropyTerm (CB4_2_2I2S3_0_1Value (4 : Fin 6))) := by + exact contains_sound (entropyTerm_ball ((B4_2_2Little_sound (shape 3 0 1) ((stageBPriority (shape 4 2 2)) 2)) (4 : Fin 6)) CB4_2_2I2S3_0_1E_4Log_sound) (by decide +kernel) +def CB4_2_2I2S3_0_1Terms (a : Fin 6) : Ball := + match a.val with + | 4 => ⟨0, 0⟩ + | _ => (.exact 0) +lemma CB4_2_2I2S3_0_1Terms_sound (a : Fin 6) : + (CB4_2_2I2S3_0_1Terms a).Encloses (Foundation.entropyTerm (CB4_2_2I2S3_0_1Value a)) := by + fin_cases a + · exact (entropyTerm_zero_ball ((B4_2_2Little_sound (shape 3 0 1) ((stageBPriority (shape 4 2 2)) 2)) (0 : Fin 6))) + · exact (entropyTerm_zero_ball ((B4_2_2Little_sound (shape 3 0 1) ((stageBPriority (shape 4 2 2)) 2)) (1 : Fin 6))) + · exact (entropyTerm_zero_ball ((B4_2_2Little_sound (shape 3 0 1) ((stageBPriority (shape 4 2 2)) 2)) (2 : Fin 6))) + · exact (entropyTerm_zero_ball ((B4_2_2Little_sound (shape 3 0 1) ((stageBPriority (shape 4 2 2)) 2)) (3 : Fin 6))) + · exact CB4_2_2I2S3_0_1E_4_sound + · exact (entropyTerm_zero_ball ((B4_2_2Little_sound (shape 3 0 1) ((stageBPriority (shape 4 2 2)) 2)) (5 : Fin 6))) +def CB4_2_2I2S3_0_1Entropy : Ball := ⟨0, 0⟩ +lemma CB4_2_2I2S3_0_1Entropy_sound : CB4_2_2I2S3_0_1Entropy.Encloses (Foundation.finiteEntropy CB4_2_2I2S3_0_1Value) := by + exact contains_sound (entropyFin_enclosed 6 CB4_2_2I2S3_0_1Value CB4_2_2I2S3_0_1Terms CB4_2_2I2S3_0_1Terms_sound) (by decide +kernel) +def CB4_2_2I2S3_0_1Mass : Ball := ⟨1, 0⟩ +lemma CB4_2_2I2S3_0_1Mass_sound : CB4_2_2I2S3_0_1Mass.Encloses (∑ a, CB4_2_2I2S3_0_1Value a) := by + exact contains_sound (finSumBall_sound 6 (B4_2_2Little (shape 3 0 1) ((stageBPriority (shape 4 2 2)) 2)) CB4_2_2I2S3_0_1Value (B4_2_2Little_sound (shape 3 0 1) ((stageBPriority (shape 4 2 2)) 2))) (by decide +kernel) +def CB4_2_2I2S3_0_1MassTermLog : Ball := .exact 0 +lemma CB4_2_2I2S3_0_1MassTermLog_sound : CB4_2_2I2S3_0_1MassTermLog.Encloses (Real.log ((∑ a, CB4_2_2I2S3_0_1Value a))) := by + exact log_exact_one_ball (CB4_2_2I2S3_0_1Mass_sound) +def CB4_2_2I2S3_0_1MassTerm : Ball := ⟨0, 0⟩ +lemma CB4_2_2I2S3_0_1MassTerm_sound : CB4_2_2I2S3_0_1MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB4_2_2I2S3_0_1Value a))) := by + exact contains_sound (entropyTerm_ball (CB4_2_2I2S3_0_1Mass_sound) CB4_2_2I2S3_0_1MassTermLog_sound) (by decide +kernel) +def CB4_2_2I2S3_0_1H : Ball := ⟨0, 0⟩ +lemma CB4_2_2I2S3_0_1H_sound : CB4_2_2I2S3_0_1H.Encloses (homogeneousEntropy CB4_2_2I2S3_0_1Value) := by + exact contains_sound (homogeneous_enclosed CB4_2_2I2S3_0_1Value CB4_2_2I2S3_0_1MassTerm_sound CB4_2_2I2S3_0_1Entropy_sound) (by decide +kernel) +def CB4_2_2I2S3_1_0Value (a : Fin 6) : ℝ := (littleLaw (shape 4 2 2) (shape 3 1 0) ((stageBPriority (shape 4 2 2)) 2) a : ℝ) +def CB4_2_2I2S3_1_0E_4Log : Ball := .exact 0 +lemma CB4_2_2I2S3_1_0E_4Log_sound : CB4_2_2I2S3_1_0E_4Log.Encloses (Real.log (CB4_2_2I2S3_1_0Value (4 : Fin 6))) := by + exact log_exact_one_ball ((B4_2_2Little_sound (shape 3 1 0) ((stageBPriority (shape 4 2 2)) 2)) (4 : Fin 6)) +def CB4_2_2I2S3_1_0E_4 : Ball := ⟨0, 0⟩ +lemma CB4_2_2I2S3_1_0E_4_sound : CB4_2_2I2S3_1_0E_4.Encloses (Foundation.entropyTerm (CB4_2_2I2S3_1_0Value (4 : Fin 6))) := by + exact contains_sound (entropyTerm_ball ((B4_2_2Little_sound (shape 3 1 0) ((stageBPriority (shape 4 2 2)) 2)) (4 : Fin 6)) CB4_2_2I2S3_1_0E_4Log_sound) (by decide +kernel) +def CB4_2_2I2S3_1_0Terms (a : Fin 6) : Ball := + match a.val with + | 4 => ⟨0, 0⟩ + | _ => (.exact 0) +lemma CB4_2_2I2S3_1_0Terms_sound (a : Fin 6) : + (CB4_2_2I2S3_1_0Terms a).Encloses (Foundation.entropyTerm (CB4_2_2I2S3_1_0Value a)) := by + fin_cases a + · exact (entropyTerm_zero_ball ((B4_2_2Little_sound (shape 3 1 0) ((stageBPriority (shape 4 2 2)) 2)) (0 : Fin 6))) + · exact (entropyTerm_zero_ball ((B4_2_2Little_sound (shape 3 1 0) ((stageBPriority (shape 4 2 2)) 2)) (1 : Fin 6))) + · exact (entropyTerm_zero_ball ((B4_2_2Little_sound (shape 3 1 0) ((stageBPriority (shape 4 2 2)) 2)) (2 : Fin 6))) + · exact (entropyTerm_zero_ball ((B4_2_2Little_sound (shape 3 1 0) ((stageBPriority (shape 4 2 2)) 2)) (3 : Fin 6))) + · exact CB4_2_2I2S3_1_0E_4_sound + · exact (entropyTerm_zero_ball ((B4_2_2Little_sound (shape 3 1 0) ((stageBPriority (shape 4 2 2)) 2)) (5 : Fin 6))) +def CB4_2_2I2S3_1_0Entropy : Ball := ⟨0, 0⟩ +lemma CB4_2_2I2S3_1_0Entropy_sound : CB4_2_2I2S3_1_0Entropy.Encloses (Foundation.finiteEntropy CB4_2_2I2S3_1_0Value) := by + exact contains_sound (entropyFin_enclosed 6 CB4_2_2I2S3_1_0Value CB4_2_2I2S3_1_0Terms CB4_2_2I2S3_1_0Terms_sound) (by decide +kernel) +def CB4_2_2I2S3_1_0Mass : Ball := ⟨1, 0⟩ +lemma CB4_2_2I2S3_1_0Mass_sound : CB4_2_2I2S3_1_0Mass.Encloses (∑ a, CB4_2_2I2S3_1_0Value a) := by + exact contains_sound (finSumBall_sound 6 (B4_2_2Little (shape 3 1 0) ((stageBPriority (shape 4 2 2)) 2)) CB4_2_2I2S3_1_0Value (B4_2_2Little_sound (shape 3 1 0) ((stageBPriority (shape 4 2 2)) 2))) (by decide +kernel) +def CB4_2_2I2S3_1_0MassTermLog : Ball := .exact 0 +lemma CB4_2_2I2S3_1_0MassTermLog_sound : CB4_2_2I2S3_1_0MassTermLog.Encloses (Real.log ((∑ a, CB4_2_2I2S3_1_0Value a))) := by + exact log_exact_one_ball (CB4_2_2I2S3_1_0Mass_sound) +def CB4_2_2I2S3_1_0MassTerm : Ball := ⟨0, 0⟩ +lemma CB4_2_2I2S3_1_0MassTerm_sound : CB4_2_2I2S3_1_0MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB4_2_2I2S3_1_0Value a))) := by + exact contains_sound (entropyTerm_ball (CB4_2_2I2S3_1_0Mass_sound) CB4_2_2I2S3_1_0MassTermLog_sound) (by decide +kernel) +def CB4_2_2I2S3_1_0H : Ball := ⟨0, 0⟩ +lemma CB4_2_2I2S3_1_0H_sound : CB4_2_2I2S3_1_0H.Encloses (homogeneousEntropy CB4_2_2I2S3_1_0Value) := by + exact contains_sound (homogeneous_enclosed CB4_2_2I2S3_1_0Value CB4_2_2I2S3_1_0MassTerm_sound CB4_2_2I2S3_1_0Entropy_sound) (by decide +kernel) +def CB4_2_2I2S4_0_0Value (a : Fin 6) : ℝ := (littleLaw (shape 4 2 2) (shape 4 0 0) ((stageBPriority (shape 4 2 2)) 2) a : ℝ) +def CB4_2_2I2S4_0_0E_5Log : Ball := .exact 0 +lemma CB4_2_2I2S4_0_0E_5Log_sound : CB4_2_2I2S4_0_0E_5Log.Encloses (Real.log (CB4_2_2I2S4_0_0Value (5 : Fin 6))) := by + exact log_exact_one_ball ((B4_2_2Little_sound (shape 4 0 0) ((stageBPriority (shape 4 2 2)) 2)) (5 : Fin 6)) +def CB4_2_2I2S4_0_0E_5 : Ball := ⟨0, 0⟩ +lemma CB4_2_2I2S4_0_0E_5_sound : CB4_2_2I2S4_0_0E_5.Encloses (Foundation.entropyTerm (CB4_2_2I2S4_0_0Value (5 : Fin 6))) := by + exact contains_sound (entropyTerm_ball ((B4_2_2Little_sound (shape 4 0 0) ((stageBPriority (shape 4 2 2)) 2)) (5 : Fin 6)) CB4_2_2I2S4_0_0E_5Log_sound) (by decide +kernel) +def CB4_2_2I2S4_0_0Terms (a : Fin 6) : Ball := + match a.val with + | 5 => ⟨0, 0⟩ + | _ => (.exact 0) +lemma CB4_2_2I2S4_0_0Terms_sound (a : Fin 6) : + (CB4_2_2I2S4_0_0Terms a).Encloses (Foundation.entropyTerm (CB4_2_2I2S4_0_0Value a)) := by + fin_cases a + · exact (entropyTerm_zero_ball ((B4_2_2Little_sound (shape 4 0 0) ((stageBPriority (shape 4 2 2)) 2)) (0 : Fin 6))) + · exact (entropyTerm_zero_ball ((B4_2_2Little_sound (shape 4 0 0) ((stageBPriority (shape 4 2 2)) 2)) (1 : Fin 6))) + · exact (entropyTerm_zero_ball ((B4_2_2Little_sound (shape 4 0 0) ((stageBPriority (shape 4 2 2)) 2)) (2 : Fin 6))) + · exact (entropyTerm_zero_ball ((B4_2_2Little_sound (shape 4 0 0) ((stageBPriority (shape 4 2 2)) 2)) (3 : Fin 6))) + · exact (entropyTerm_zero_ball ((B4_2_2Little_sound (shape 4 0 0) ((stageBPriority (shape 4 2 2)) 2)) (4 : Fin 6))) + · exact CB4_2_2I2S4_0_0E_5_sound +def CB4_2_2I2S4_0_0Entropy : Ball := ⟨0, 0⟩ +lemma CB4_2_2I2S4_0_0Entropy_sound : CB4_2_2I2S4_0_0Entropy.Encloses (Foundation.finiteEntropy CB4_2_2I2S4_0_0Value) := by + exact contains_sound (entropyFin_enclosed 6 CB4_2_2I2S4_0_0Value CB4_2_2I2S4_0_0Terms CB4_2_2I2S4_0_0Terms_sound) (by decide +kernel) +def CB4_2_2I2S4_0_0Mass : Ball := ⟨1, 0⟩ +lemma CB4_2_2I2S4_0_0Mass_sound : CB4_2_2I2S4_0_0Mass.Encloses (∑ a, CB4_2_2I2S4_0_0Value a) := by + exact contains_sound (finSumBall_sound 6 (B4_2_2Little (shape 4 0 0) ((stageBPriority (shape 4 2 2)) 2)) CB4_2_2I2S4_0_0Value (B4_2_2Little_sound (shape 4 0 0) ((stageBPriority (shape 4 2 2)) 2))) (by decide +kernel) +def CB4_2_2I2S4_0_0MassTermLog : Ball := .exact 0 +lemma CB4_2_2I2S4_0_0MassTermLog_sound : CB4_2_2I2S4_0_0MassTermLog.Encloses (Real.log ((∑ a, CB4_2_2I2S4_0_0Value a))) := by + exact log_exact_one_ball (CB4_2_2I2S4_0_0Mass_sound) +def CB4_2_2I2S4_0_0MassTerm : Ball := ⟨0, 0⟩ +lemma CB4_2_2I2S4_0_0MassTerm_sound : CB4_2_2I2S4_0_0MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB4_2_2I2S4_0_0Value a))) := by + exact contains_sound (entropyTerm_ball (CB4_2_2I2S4_0_0Mass_sound) CB4_2_2I2S4_0_0MassTermLog_sound) (by decide +kernel) +def CB4_2_2I2S4_0_0H : Ball := ⟨0, 0⟩ +lemma CB4_2_2I2S4_0_0H_sound : CB4_2_2I2S4_0_0H.Encloses (homogeneousEntropy CB4_2_2I2S4_0_0Value) := by + exact contains_sound (homogeneous_enclosed CB4_2_2I2S4_0_0Value CB4_2_2I2S4_0_0MassTerm_sound CB4_2_2I2S4_0_0Entropy_sound) (by decide +kernel) +def CB4_2_2I2Singles (s : Shape) : Ball := + match s 0, s 1, s 2 with + | 2, 0, 2 => CB4_2_2I2S2_0_2H + | 2, 2, 0 => CB4_2_2I2S2_2_0H + | 3, 0, 1 => CB4_2_2I2S3_0_1H + | 3, 1, 0 => CB4_2_2I2S3_1_0H + | 4, 0, 0 => CB4_2_2I2S4_0_0H + | _, _, _ => (.exact 0) +lemma CB4_2_2I2Singles_sound (u : Shape) (hu : u ∈ below (shape 4 2 2)) + (hd : designated (stageBPriority (shape 4 2 2)) 2 u) : + (CB4_2_2I2Singles u).Encloses (homogeneousEntropy ((fun u a => (littleLaw (shape 4 2 2) u ((stageBPriority (shape 4 2 2)) 2) a : ℝ)) u)) := by + rw [B4_2_2_below] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl + · exact (show ¬ designated (stageBPriority (shape 4 2 2)) 2 (shape 0 2 2) by decide +kernel) hd |>.elim + · exact (show ¬ designated (stageBPriority (shape 4 2 2)) 2 (shape 1 1 2) by decide +kernel) hd |>.elim + · exact (show ¬ designated (stageBPriority (shape 4 2 2)) 2 (shape 1 2 1) by decide +kernel) hd |>.elim + · exact CB4_2_2I2S2_0_2H_sound + · exact (show ¬ designated (stageBPriority (shape 4 2 2)) 2 (shape 2 1 1) by decide +kernel) hd |>.elim + · exact CB4_2_2I2S2_2_0H_sound + · exact CB4_2_2I2S3_0_1H_sound + · exact CB4_2_2I2S3_1_0H_sound + · exact CB4_2_2I2S4_0_0H_sound +def CB4_2_2I2Singleton : Ball := ⟨(388803395094619629894314275621 / 4000000000000000000000000000000), (2840022457 / 20000000000000000000000000000000)⟩ +lemma CB4_2_2I2Singleton_sound : CB4_2_2I2Singleton.Encloses + (singletonEntropy (below (shape 4 2 2)) (fun u => (stageBLaw (shape 4 2 2) u : ℝ)) (stageBPriority (shape 4 2 2)) 2 (fun u a => (littleLaw (shape 4 2 2) u ((stageBPriority (shape 4 2 2)) 2) a : ℝ))) := by + exact contains_sound (singletonBall_sound (below (shape 4 2 2)) B4_2_2Law (fun u => (stageBLaw (shape 4 2 2) u : ℝ)) (stageBPriority (shape 4 2 2)) 2 + CB4_2_2I2Singles (fun u a => (littleLaw (shape 4 2 2) u ((stageBPriority (shape 4 2 2)) 2) a : ℝ)) (fun u _ => B4_2_2Law_sound u) CB4_2_2I2Singles_sound) (by decide +kernel) +def CB4_2_2I2Group : Ball := ⟨(13278049208706917022840055293589 / 100000000000000000000000000000000), (78781661373 / 100000000000000000000000000000000)⟩ +lemma CB4_2_2I2Group_sound : CB4_2_2I2Group.Encloses + (groupedEntropy (below (shape 4 2 2)) (fun u => (stageBLaw (shape 4 2 2) u : ℝ)) (stageBPriority (shape 4 2 2)) 2 (fun u a => (littleLaw (shape 4 2 2) u ((stageBPriority (shape 4 2 2)) 2) a : ℝ))) := by + exact contains_sound (Ball.add_sound CB4_2_2I2Singleton_sound + (finSumBall_sound 17 CB4_2_2I2ResidualEntropies _ CB4_2_2I2ResidualEntropies_sound)) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CB4_2_2I2H : Ball := ⟨(58605953662594893341663948712861 / 100000000000000000000000000000000), (258645600317 / 100000000000000000000000000000000)⟩ +lemma CB4_2_2I2_sound : CB4_2_2I2H.Encloses (stageBCapacity (shape 4 2 2) 2) := by + have hb := contains_sound (Ball.add_sound CB4_2_2I2PairH_sound + (Ball.neg_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) CB4_2_2I2Group_sound))) + (show contains (.add CB4_2_2I2PairH (.neg (.mul (.exact 2) CB4_2_2I2Group))) CB4_2_2I2H = true by decide +kernel) + simp only [stageBCapacity, nativeCapacity, + show (2 : Fin 3) ≠ 0 by decide, ite_false, sub_eq_add_neg] + exact hb + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/CapacityB/CapB4_3_1I0.lean b/lean/OAI/LinearAlgebra/MatrixFields/CapacityB/CapB4_3_1I0.lean new file mode 100644 index 0000000000000000000000000000000000000000..0c51f491dd57cfeabae1d27b01ba06f240392a6c --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/CapacityB/CapB4_3_1I0.lean @@ -0,0 +1,72 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Certificates.Terminal4_3_1 + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CB4_3_1I0Value (a : Fin 17) : ℝ := marginal (below (shape 4 3 1)) (fun u => (stageBLaw (shape 4 3 1) u : ℝ)) ((stageBPriority (shape 4 3 1)) 0) a +def CB4_3_1I0Raw (a : Fin 17) : Ball := marginalBall (below (shape 4 3 1)) B4_3_1Law ((stageBPriority (shape 4 3 1)) 0) a +lemma CB4_3_1I0Raw_sound (a : Fin 17) : + (CB4_3_1I0Raw a).Encloses (CB4_3_1I0Value a) := by + exact marginalBall_sound (below (shape 4 3 1)) B4_3_1Law (fun u => (stageBLaw (shape 4 3 1) u : ℝ)) (fun u _ => B4_3_1Law_sound u) ((stageBPriority (shape 4 3 1)) 0) a +def CB4_3_1I0Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(50000000000000000000000000000001 / 100000000000000000000000000000000), (31 / 100000000000000000000000000000000)⟩ ⟨(6931471805599453094172319305033 / 20000000000000000000000000000000), (2646977967 / 12500000000000000000000000000000)⟩ ⟨(-8664339756999316367715399131291 / 12500000000000000000000000000000), (42351647427 / 100000000000000000000000000000000)⟩ ⟨-1, 50000000000000000000000000000001, 50000000000000000000000000000000⟩] +lemma CB4_3_1I0Certificates_valid : + CB4_3_1I0Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB4_3_1I0CertificateIndex (a : Fin 17) : ℕ := + match a.val with + | 1 => 1 + | 0 => 1 + | _ => 0 +def CB4_3_1I0P (a : Fin 17) : Ball := + (CompactCertificate.entropyLookup CB4_3_1I0Certificates (CB4_3_1I0CertificateIndex a)).input +lemma CB4_3_1I0P_check : ∀ a : Fin 17, contains (CB4_3_1I0Raw a) (CB4_3_1I0P a) = true := by + decide +kernel +lemma CB4_3_1I0P_sound (a : Fin 17) : + (CB4_3_1I0P a).Encloses (CB4_3_1I0Value a) := + contains_sound (CB4_3_1I0Raw_sound a) (CB4_3_1I0P_check a) +def CB4_3_1I0Terms (a : Fin 17) : Ball := + (CompactCertificate.entropyLookup CB4_3_1I0Certificates (CB4_3_1I0CertificateIndex a)).output +lemma CB4_3_1I0Terms_sound (a : Fin 17) : + (CB4_3_1I0Terms a).Encloses (Foundation.entropyTerm (CB4_3_1I0Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB4_3_1I0Certificates_valid + (CB4_3_1I0CertificateIndex a) (CB4_3_1I0P_sound a) +def CB4_3_1I0Entropy : Ball := ⟨(6931471805599453094172319305033 / 10000000000000000000000000000000), (2646977967 / 6250000000000000000000000000000)⟩ +lemma CB4_3_1I0Entropy_sound : CB4_3_1I0Entropy.Encloses (Foundation.finiteEntropy CB4_3_1I0Value) := by + exact contains_sound (entropyFin_enclosed 17 CB4_3_1I0Value CB4_3_1I0Terms CB4_3_1I0Terms_sound) (by decide +kernel) +def CB4_3_1I0Mass : Ball := ⟨(50000000000000000000000000000001 / 50000000000000000000000000000000), (31 / 50000000000000000000000000000000)⟩ +lemma CB4_3_1I0Mass_sound : CB4_3_1I0Mass.Encloses (∑ a, CB4_3_1I0Value a) := by + exact contains_sound (finSumBall_sound 17 CB4_3_1I0P CB4_3_1I0Value CB4_3_1I0P_sound) (by decide +kernel) +def CB4_3_1I0MassTermLogWitness : LogWitness := ⟨0, 50000000000000000000000000000001, 50000000000000000000000000000000⟩ +def CB4_3_1I0MassTermLog : Ball := ⟨(1 / 50000000000000000000000000000000), (165436123 / 781250000000000000000000000000)⟩ +lemma CB4_3_1I0MassTermLog_sound : CB4_3_1I0MassTermLog.Encloses (Real.log ((∑ a, CB4_3_1I0Value a))) := by + exact checkLog_sound logTwoBall_sound (CB4_3_1I0Mass_sound) (w := CB4_3_1I0MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB4_3_1I0MassTerm : Ball := ⟨(-1 / 50000000000000000000000000000000), (4235164749 / 20000000000000000000000000000000)⟩ +lemma CB4_3_1I0MassTerm_sound : CB4_3_1I0MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB4_3_1I0Value a))) := by + exact contains_sound (entropyTerm_ball (CB4_3_1I0Mass_sound) CB4_3_1I0MassTermLog_sound) (by decide +kernel) +def CB4_3_1I0H : Ball := ⟨(17328679513998632735430798262583 / 25000000000000000000000000000000), (63527471217 / 100000000000000000000000000000000)⟩ +lemma CB4_3_1I0H_sound : CB4_3_1I0H.Encloses (homogeneousEntropy CB4_3_1I0Value) := by + exact contains_sound (homogeneous_enclosed CB4_3_1I0Value CB4_3_1I0MassTerm_sound CB4_3_1I0Entropy_sound) (by decide +kernel) +lemma CB4_3_1I0_sound : CB4_3_1I0H.Encloses (stageBCapacity (shape 4 3 1) 0) := by + exact CB4_3_1I0H_sound + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/CapacityB/CapB4_3_1I1.lean b/lean/OAI/LinearAlgebra/MatrixFields/CapacityB/CapB4_3_1I1.lean new file mode 100644 index 0000000000000000000000000000000000000000..94df3bd132cd17ae79cebead64b10e457c2314c6 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/CapacityB/CapB4_3_1I1.lean @@ -0,0 +1,888 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Certificates.Terminal4_3_1 + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CB4_3_1I1PairValue (a : PairSlot) : ℝ := pairLaw (below (shape 4 3 1)) (shape 4 3 1) (fun u => (stageBLaw (shape 4 3 1) u : ℝ)) (fun u a => (littleLaw (shape 4 3 1) u ((stageBPriority (shape 4 3 1)) 1) a : ℝ)) a +def CB4_3_1I1PairRaw (a : PairSlot) : Ball := pairLawBall (below (shape 4 3 1)) (shape 4 3 1) B4_3_1Law (fun u => B4_3_1Little u ((stageBPriority (shape 4 3 1)) 1)) a +lemma CB4_3_1I1PairRaw_sound (a : PairSlot) : + (CB4_3_1I1PairRaw a).Encloses (CB4_3_1I1PairValue a) := by + exact pairLawBall_sound_on (below (shape 4 3 1)) (shape 4 3 1) B4_3_1Law (fun u => (stageBLaw (shape 4 3 1) u : ℝ)) (fun u => B4_3_1Little u ((stageBPriority (shape 4 3 1)) 1)) (fun u a => (littleLaw (shape 4 3 1) u ((stageBPriority (shape 4 3 1)) 1) a : ℝ)) (fun u _ => B4_3_1Law_sound u) (fun u _ a => B4_3_1Little_sound u ((stageBPriority (shape 4 3 1)) 1) a) (fun u _ a => B4_3_1Little_sound (complement (shape 4 3 1) u) ((stageBPriority (shape 4 3 1)) 1) a) a +def CB4_3_1I1PairCertificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(663549549127581616184973285819 / 50000000000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ ⟨(1147190843975657773974584037547 / 20000000000000000000000000000000), (1124096677 / 50000000000000000000000000000000)⟩ ⟨(-216108737750623834291693366203169 / 50000000000000000000000000000000), (42351647479 / 25000000000000000000000000000000)⟩ ⟨-7, 663549549127581616184973285819, 390625000000000000000000000000⟩, + .log ⟨(22175975409536958176216013675929 / 50000000000000000000000000000000), (3 / 12500000000000000000000000000000)⟩ ⟨(90146835953294368688057748091 / 250000000000000000000000000000), (704391819 / 2500000000000000000000000000000)⟩ ⟨(-2540667160308030643941501584461 / 3125000000000000000000000000000), (63527471103 / 100000000000000000000000000000000)⟩ ⟨-2, 22175975409536958176216013675929, 12500000000000000000000000000000⟩, + .log ⟨(864190016534184083039605215301 / 20000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ ⟨(13575106757374623747264395272099 / 100000000000000000000000000000000), (1097996127 / 20000000000000000000000000000000)⟩ ⟨(-314169488136817510983487125336409 / 100000000000000000000000000000000), (1985233471 / 1562500000000000000000000000000)⟩ ⟨-5, 864190016534184083039605215301, 625000000000000000000000000000⟩] +lemma CB4_3_1I1PairCertificates_valid : + CB4_3_1I1PairCertificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB4_3_1I1PairCertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 4, 0 => 1 + | 2, 1 => 2 + | 3, 1 => 3 + | 1, 2 => 2 + | 1, 3 => 3 + | 0, 4 => 1 + | _, _ => 0 +def CB4_3_1I1PairP (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CB4_3_1I1PairCertificates (CB4_3_1I1PairCertificateIndex a)).input +lemma CB4_3_1I1PairP_check : ∀ a : PairSlot, contains (CB4_3_1I1PairRaw a) (CB4_3_1I1PairP a) = true := by + decide +kernel +lemma CB4_3_1I1PairP_sound (a : PairSlot) : + (CB4_3_1I1PairP a).Encloses (CB4_3_1I1PairValue a) := + contains_sound (CB4_3_1I1PairRaw_sound a) (CB4_3_1I1PairP_check a) +def CB4_3_1I1PairTerms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CB4_3_1I1PairCertificates (CB4_3_1I1PairCertificateIndex a)).output +lemma CB4_3_1I1PairTerms_sound (a : PairSlot) : + (CB4_3_1I1PairTerms a).Encloses (Foundation.entropyTerm (CB4_3_1I1PairValue a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB4_3_1I1PairCertificates_valid + (CB4_3_1I1PairCertificateIndex a) (CB4_3_1I1PairP_sound a) +def CB4_3_1I1PairEntropy : Ball := ⟨(27684897679285330046180207348117 / 25000000000000000000000000000000), (35913846749 / 50000000000000000000000000000000)⟩ +lemma CB4_3_1I1PairEntropy_sound : CB4_3_1I1PairEntropy.Encloses (Foundation.finiteEntropy CB4_3_1I1PairValue) := by + exact contains_sound (entropyPair_enclosed CB4_3_1I1PairValue CB4_3_1I1PairTerms CB4_3_1I1PairTerms_sound) (by decide +kernel) +def CB4_3_1I1PairMass : Ball := ⟨(50000000000000000000000000000001 / 50000000000000000000000000000000), (1 / 1562500000000000000000000000000)⟩ +lemma CB4_3_1I1PairMass_sound : CB4_3_1I1PairMass.Encloses (∑ a, CB4_3_1I1PairValue a) := by + exact contains_sound (pairSumBall_sound CB4_3_1I1PairP CB4_3_1I1PairValue CB4_3_1I1PairP_sound) (by decide +kernel) +def CB4_3_1I1PairMassTermLogWitness : LogWitness := ⟨0, 50000000000000000000000000000001, 50000000000000000000000000000000⟩ +def CB4_3_1I1PairMassTermLog : Ball := ⟨(1 / 50000000000000000000000000000000), (10587911873 / 50000000000000000000000000000000)⟩ +lemma CB4_3_1I1PairMassTermLog_sound : CB4_3_1I1PairMassTermLog.Encloses (Real.log ((∑ a, CB4_3_1I1PairValue a))) := by + exact checkLog_sound logTwoBall_sound (CB4_3_1I1PairMass_sound) (w := CB4_3_1I1PairMassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB4_3_1I1PairMassTerm : Ball := ⟨(-1 / 50000000000000000000000000000000), (21175823747 / 100000000000000000000000000000000)⟩ +lemma CB4_3_1I1PairMassTerm_sound : CB4_3_1I1PairMassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB4_3_1I1PairValue a))) := by + exact contains_sound (entropyTerm_ball (CB4_3_1I1PairMass_sound) CB4_3_1I1PairMassTermLog_sound) (by decide +kernel) +def CB4_3_1I1PairH : Ball := ⟨(11073959071714132018472082939247 / 10000000000000000000000000000000), (18600703449 / 20000000000000000000000000000000)⟩ +lemma CB4_3_1I1PairH_sound : CB4_3_1I1PairH.Encloses (homogeneousEntropy CB4_3_1I1PairValue) := by + exact contains_sound (homogeneous_enclosed CB4_3_1I1PairValue CB4_3_1I1PairMassTerm_sound CB4_3_1I1PairEntropy_sound) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CB4_3_1I1R0Value (a : Fin 6) : ℝ := residualLaw (below (shape 4 3 1)) (fun u => (stageBLaw (shape 4 3 1) u : ℝ)) (stageBPriority (shape 4 3 1)) 1 (fun u a => (littleLaw (shape 4 3 1) u ((stageBPriority (shape 4 3 1)) 1) a : ℝ)) 0 a +def CB4_3_1I1R0Raw (a : Fin 6) : Ball := residualBall (below (shape 4 3 1)) B4_3_1Law (stageBPriority (shape 4 3 1)) 1 (fun u => B4_3_1Little u ((stageBPriority (shape 4 3 1)) 1)) 0 a +lemma CB4_3_1I1R0Raw_sound (a : Fin 6) : + (CB4_3_1I1R0Raw a).Encloses (CB4_3_1I1R0Value a) := by + exact residualBall_sound_on (below (shape 4 3 1)) B4_3_1Law (fun u => (stageBLaw (shape 4 3 1) u : ℝ)) (stageBPriority (shape 4 3 1)) 1 (fun u => B4_3_1Little u ((stageBPriority (shape 4 3 1)) 1)) (fun u a => (littleLaw (shape 4 3 1) u ((stageBPriority (shape 4 3 1)) 1) a : ℝ)) (fun u _ => B4_3_1Law_sound u) (fun u _ a => B4_3_1Little_sound u ((stageBPriority (shape 4 3 1)) 1) a) 0 a +def CB4_3_1I1R0Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(663549549127581616184973285819 / 50000000000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ ⟨(1147190843975657773974584037547 / 20000000000000000000000000000000), (1124096677 / 50000000000000000000000000000000)⟩ ⟨(-216108737750623834291693366203169 / 50000000000000000000000000000000), (42351647479 / 25000000000000000000000000000000)⟩ ⟨-7, 663549549127581616184973285819, 390625000000000000000000000000⟩] +lemma CB4_3_1I1R0Certificates_valid : + CB4_3_1I1R0Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB4_3_1I1R0CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | 0 => 1 + | _ => 0 +def CB4_3_1I1R0P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB4_3_1I1R0Certificates (CB4_3_1I1R0CertificateIndex a)).input +lemma CB4_3_1I1R0P_check : ∀ a : Fin 6, contains (CB4_3_1I1R0Raw a) (CB4_3_1I1R0P a) = true := by + decide +kernel +lemma CB4_3_1I1R0P_sound (a : Fin 6) : + (CB4_3_1I1R0P a).Encloses (CB4_3_1I1R0Value a) := + contains_sound (CB4_3_1I1R0Raw_sound a) (CB4_3_1I1R0P_check a) +def CB4_3_1I1R0Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB4_3_1I1R0Certificates (CB4_3_1I1R0CertificateIndex a)).output +lemma CB4_3_1I1R0Terms_sound (a : Fin 6) : + (CB4_3_1I1R0Terms a).Encloses (Foundation.entropyTerm (CB4_3_1I1R0Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB4_3_1I1R0Certificates_valid + (CB4_3_1I1R0CertificateIndex a) (CB4_3_1I1R0P_sound a) +def CB4_3_1I1R0Entropy : Ball := ⟨(1147190843975657773974584037547 / 20000000000000000000000000000000), (1124096677 / 50000000000000000000000000000000)⟩ +lemma CB4_3_1I1R0Entropy_sound : CB4_3_1I1R0Entropy.Encloses (Foundation.finiteEntropy CB4_3_1I1R0Value) := by + exact contains_sound (entropyFin_enclosed 6 CB4_3_1I1R0Value CB4_3_1I1R0Terms CB4_3_1I1R0Terms_sound) (by decide +kernel) +def CB4_3_1I1R0Mass : Ball := ⟨(663549549127581616184973285819 / 50000000000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ +lemma CB4_3_1I1R0Mass_sound : CB4_3_1I1R0Mass.Encloses (∑ a, CB4_3_1I1R0Value a) := by + exact contains_sound (finSumBall_sound 6 CB4_3_1I1R0P CB4_3_1I1R0Value CB4_3_1I1R0P_sound) (by decide +kernel) +def CB4_3_1I1R0MassTermLogWitness : LogWitness := ⟨-7, 663549549127581616184973285819, 390625000000000000000000000000⟩ +def CB4_3_1I1R0MassTermLog : Ball := ⟨(-216108737750623834291693366203169 / 50000000000000000000000000000000), (42351647479 / 25000000000000000000000000000000)⟩ +lemma CB4_3_1I1R0MassTermLog_sound : CB4_3_1I1R0MassTermLog.Encloses (Real.log ((∑ a, CB4_3_1I1R0Value a))) := by + exact checkLog_sound logTwoBall_sound (CB4_3_1I1R0Mass_sound) (w := CB4_3_1I1R0MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB4_3_1I1R0MassTerm : Ball := ⟨(1147190843975657773974584037547 / 20000000000000000000000000000000), (1124096677 / 50000000000000000000000000000000)⟩ +lemma CB4_3_1I1R0MassTerm_sound : CB4_3_1I1R0MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB4_3_1I1R0Value a))) := by + exact contains_sound (entropyTerm_ball (CB4_3_1I1R0Mass_sound) CB4_3_1I1R0MassTermLog_sound) (by decide +kernel) +def CB4_3_1I1R0H : Ball := ⟨0, (1124096677 / 25000000000000000000000000000000)⟩ +lemma CB4_3_1I1R0H_sound : CB4_3_1I1R0H.Encloses (homogeneousEntropy CB4_3_1I1R0Value) := by + exact contains_sound (homogeneous_enclosed CB4_3_1I1R0Value CB4_3_1I1R0MassTerm_sound CB4_3_1I1R0Entropy_sound) (by decide +kernel) +def CB4_3_1I1R1Value (a : Fin 6) : ℝ := residualLaw (below (shape 4 3 1)) (fun u => (stageBLaw (shape 4 3 1) u : ℝ)) (stageBPriority (shape 4 3 1)) 1 (fun u a => (littleLaw (shape 4 3 1) u ((stageBPriority (shape 4 3 1)) 1) a : ℝ)) 1 a +def CB4_3_1I1R1Raw (a : Fin 6) : Ball := residualBall (below (shape 4 3 1)) B4_3_1Law (stageBPriority (shape 4 3 1)) 1 (fun u => B4_3_1Little u ((stageBPriority (shape 4 3 1)) 1)) 1 a +lemma CB4_3_1I1R1Raw_sound (a : Fin 6) : + (CB4_3_1I1R1Raw a).Encloses (CB4_3_1I1R1Value a) := by + exact residualBall_sound_on (below (shape 4 3 1)) B4_3_1Law (fun u => (stageBLaw (shape 4 3 1) u : ℝ)) (stageBPriority (shape 4 3 1)) 1 (fun u => B4_3_1Little u ((stageBPriority (shape 4 3 1)) 1)) (fun u a => (littleLaw (shape 4 3 1) u ((stageBPriority (shape 4 3 1)) 1) a : ℝ)) (fun u _ => B4_3_1Law_sound u) (fun u _ a => B4_3_1Little_sound u ((stageBPriority (shape 4 3 1)) 1) a) 1 a +def CB4_3_1I1R1Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(48672900901744836767630053428363 / 100000000000000000000000000000000), (1 / 4000000000000000000000000000000)⟩ ⟨(273803228812459785691571806703 / 781250000000000000000000000000), (966270721 / 3125000000000000000000000000000)⟩ ⟨(-3600238802156385008240902157601 / 5000000000000000000000000000000), (635274711 / 1000000000000000000000000000000)⟩ ⟨-2, 48672900901744836767630053428363, 25000000000000000000000000000000⟩] +lemma CB4_3_1I1R1Certificates_valid : + CB4_3_1I1R1Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB4_3_1I1R1CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | 1 => 1 + | _ => 0 +def CB4_3_1I1R1P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB4_3_1I1R1Certificates (CB4_3_1I1R1CertificateIndex a)).input +lemma CB4_3_1I1R1P_check : ∀ a : Fin 6, contains (CB4_3_1I1R1Raw a) (CB4_3_1I1R1P a) = true := by + decide +kernel +lemma CB4_3_1I1R1P_sound (a : Fin 6) : + (CB4_3_1I1R1P a).Encloses (CB4_3_1I1R1Value a) := + contains_sound (CB4_3_1I1R1Raw_sound a) (CB4_3_1I1R1P_check a) +def CB4_3_1I1R1Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB4_3_1I1R1Certificates (CB4_3_1I1R1CertificateIndex a)).output +lemma CB4_3_1I1R1Terms_sound (a : Fin 6) : + (CB4_3_1I1R1Terms a).Encloses (Foundation.entropyTerm (CB4_3_1I1R1Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB4_3_1I1R1Certificates_valid + (CB4_3_1I1R1CertificateIndex a) (CB4_3_1I1R1P_sound a) +def CB4_3_1I1R1Entropy : Ball := ⟨(273803228812459785691571806703 / 781250000000000000000000000000), (966270721 / 3125000000000000000000000000000)⟩ +lemma CB4_3_1I1R1Entropy_sound : CB4_3_1I1R1Entropy.Encloses (Foundation.finiteEntropy CB4_3_1I1R1Value) := by + exact contains_sound (entropyFin_enclosed 6 CB4_3_1I1R1Value CB4_3_1I1R1Terms CB4_3_1I1R1Terms_sound) (by decide +kernel) +def CB4_3_1I1R1Mass : Ball := ⟨(48672900901744836767630053428363 / 100000000000000000000000000000000), (1 / 4000000000000000000000000000000)⟩ +lemma CB4_3_1I1R1Mass_sound : CB4_3_1I1R1Mass.Encloses (∑ a, CB4_3_1I1R1Value a) := by + exact contains_sound (finSumBall_sound 6 CB4_3_1I1R1P CB4_3_1I1R1Value CB4_3_1I1R1P_sound) (by decide +kernel) +def CB4_3_1I1R1MassTermLogWitness : LogWitness := ⟨-2, 48672900901744836767630053428363, 25000000000000000000000000000000⟩ +def CB4_3_1I1R1MassTermLog : Ball := ⟨(-3600238802156385008240902157601 / 5000000000000000000000000000000), (635274711 / 1000000000000000000000000000000)⟩ +lemma CB4_3_1I1R1MassTermLog_sound : CB4_3_1I1R1MassTermLog.Encloses (Real.log ((∑ a, CB4_3_1I1R1Value a))) := by + exact checkLog_sound logTwoBall_sound (CB4_3_1I1R1Mass_sound) (w := CB4_3_1I1R1MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB4_3_1I1R1MassTerm : Ball := ⟨(273803228812459785691571806703 / 781250000000000000000000000000), (966270721 / 3125000000000000000000000000000)⟩ +lemma CB4_3_1I1R1MassTerm_sound : CB4_3_1I1R1MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB4_3_1I1R1Value a))) := by + exact contains_sound (entropyTerm_ball (CB4_3_1I1R1Mass_sound) CB4_3_1I1R1MassTermLog_sound) (by decide +kernel) +def CB4_3_1I1R1H : Ball := ⟨0, (966270721 / 1562500000000000000000000000000)⟩ +lemma CB4_3_1I1R1H_sound : CB4_3_1I1R1H.Encloses (homogeneousEntropy CB4_3_1I1R1Value) := by + exact contains_sound (homogeneous_enclosed CB4_3_1I1R1Value CB4_3_1I1R1MassTerm_sound CB4_3_1I1R1Entropy_sound) (by decide +kernel) +def CB4_3_1I1R2Value (a : Fin 6) : ℝ := residualLaw (below (shape 4 3 1)) (fun u => (stageBLaw (shape 4 3 1) u : ℝ)) (stageBPriority (shape 4 3 1)) 1 (fun u a => (littleLaw (shape 4 3 1) u ((stageBPriority (shape 4 3 1)) 1) a : ℝ)) 2 a +def CB4_3_1I1R2Raw (a : Fin 6) : Ball := residualBall (below (shape 4 3 1)) B4_3_1Law (stageBPriority (shape 4 3 1)) 1 (fun u => B4_3_1Little u ((stageBPriority (shape 4 3 1)) 1)) 2 a +lemma CB4_3_1I1R2Raw_sound (a : Fin 6) : + (CB4_3_1I1R2Raw a).Encloses (CB4_3_1I1R2Value a) := by + exact residualBall_sound_on (below (shape 4 3 1)) B4_3_1Law (fun u => (stageBLaw (shape 4 3 1) u : ℝ)) (stageBPriority (shape 4 3 1)) 1 (fun u => B4_3_1Little u ((stageBPriority (shape 4 3 1)) 1)) (fun u a => (littleLaw (shape 4 3 1) u ((stageBPriority (shape 4 3 1)) 1) a : ℝ)) (fun u _ => B4_3_1Law_sound u) (fun u _ a => B4_3_1Little_sound u ((stageBPriority (shape 4 3 1)) 1) a) 2 a +def CB4_3_1I1R2Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(22175975409536958176216013675929 / 50000000000000000000000000000000), (3 / 12500000000000000000000000000000)⟩ ⟨(90146835953294368688057748091 / 250000000000000000000000000000), (704391819 / 2500000000000000000000000000000)⟩ ⟨(-2540667160308030643941501584461 / 3125000000000000000000000000000), (63527471103 / 100000000000000000000000000000000)⟩ ⟨-2, 22175975409536958176216013675929, 12500000000000000000000000000000⟩, + .log ⟨(864190016534184083039605215301 / 20000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ ⟨(13575106757374623747264395272099 / 100000000000000000000000000000000), (1097996127 / 20000000000000000000000000000000)⟩ ⟨(-314169488136817510983487125336409 / 100000000000000000000000000000000), (1985233471 / 1562500000000000000000000000000)⟩ ⟨-5, 864190016534184083039605215301, 625000000000000000000000000000⟩] +lemma CB4_3_1I1R2Certificates_valid : + CB4_3_1I1R2Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB4_3_1I1R2CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | 2 => 1 + | 3 => 2 + | _ => 0 +def CB4_3_1I1R2P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB4_3_1I1R2Certificates (CB4_3_1I1R2CertificateIndex a)).input +lemma CB4_3_1I1R2P_check : ∀ a : Fin 6, contains (CB4_3_1I1R2Raw a) (CB4_3_1I1R2P a) = true := by + decide +kernel +lemma CB4_3_1I1R2P_sound (a : Fin 6) : + (CB4_3_1I1R2P a).Encloses (CB4_3_1I1R2Value a) := + contains_sound (CB4_3_1I1R2Raw_sound a) (CB4_3_1I1R2P_check a) +def CB4_3_1I1R2Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB4_3_1I1R2Certificates (CB4_3_1I1R2CertificateIndex a)).output +lemma CB4_3_1I1R2Terms_sound (a : Fin 6) : + (CB4_3_1I1R2Terms a).Encloses (Foundation.entropyTerm (CB4_3_1I1R2Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB4_3_1I1R2Certificates_valid + (CB4_3_1I1R2CertificateIndex a) (CB4_3_1I1R2P_sound a) +def CB4_3_1I1R2Entropy : Ball := ⟨(49633841138692371222487494508499 / 100000000000000000000000000000000), (6733130679 / 20000000000000000000000000000000)⟩ +lemma CB4_3_1I1R2Entropy_sound : CB4_3_1I1R2Entropy.Encloses (Foundation.finiteEntropy CB4_3_1I1R2Value) := by + exact contains_sound (entropyFin_enclosed 6 CB4_3_1I1R2Value CB4_3_1I1R2Terms CB4_3_1I1R2Terms_sound) (by decide +kernel) +def CB4_3_1I1R2Mass : Ball := ⟨(48672900901744836767630053428363 / 100000000000000000000000000000000), (13 / 50000000000000000000000000000000)⟩ +lemma CB4_3_1I1R2Mass_sound : CB4_3_1I1R2Mass.Encloses (∑ a, CB4_3_1I1R2Value a) := by + exact contains_sound (finSumBall_sound 6 CB4_3_1I1R2P CB4_3_1I1R2Value CB4_3_1I1R2P_sound) (by decide +kernel) +def CB4_3_1I1R2MassTermLogWitness : LogWitness := ⟨-2, 48672900901744836767630053428363, 25000000000000000000000000000000⟩ +def CB4_3_1I1R2MassTermLog : Ball := ⟨(-3600238802156385008240902157601 / 5000000000000000000000000000000), (31763735551 / 50000000000000000000000000000000)⟩ +lemma CB4_3_1I1R2MassTermLog_sound : CB4_3_1I1R2MassTermLog.Encloses (Real.log ((∑ a, CB4_3_1I1R2Value a))) := by + exact checkLog_sound logTwoBall_sound (CB4_3_1I1R2Mass_sound) (w := CB4_3_1I1R2MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB4_3_1I1R2MassTerm : Ball := ⟨(273803228812459785691571806703 / 781250000000000000000000000000), (15460331537 / 50000000000000000000000000000000)⟩ +lemma CB4_3_1I1R2MassTerm_sound : CB4_3_1I1R2MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB4_3_1I1R2Value a))) := by + exact contains_sound (entropyTerm_ball (CB4_3_1I1R2Mass_sound) CB4_3_1I1R2MassTermLog_sound) (by decide +kernel) +def CB4_3_1I1R2H : Ball := ⟨(2917405570139503730793260650103 / 20000000000000000000000000000000), (64586316469 / 100000000000000000000000000000000)⟩ +lemma CB4_3_1I1R2H_sound : CB4_3_1I1R2H.Encloses (homogeneousEntropy CB4_3_1I1R2Value) := by + exact contains_sound (homogeneous_enclosed CB4_3_1I1R2Value CB4_3_1I1R2MassTerm_sound CB4_3_1I1R2Entropy_sound) (by decide +kernel) +def CB4_3_1I1R3Value (a : Fin 6) : ℝ := residualLaw (below (shape 4 3 1)) (fun u => (stageBLaw (shape 4 3 1) u : ℝ)) (stageBPriority (shape 4 3 1)) 1 (fun u a => (littleLaw (shape 4 3 1) u ((stageBPriority (shape 4 3 1)) 1) a : ℝ)) 3 a +def CB4_3_1I1R3Raw (a : Fin 6) : Ball := residualBall (below (shape 4 3 1)) B4_3_1Law (stageBPriority (shape 4 3 1)) 1 (fun u => B4_3_1Little u ((stageBPriority (shape 4 3 1)) 1)) 3 a +lemma CB4_3_1I1R3Raw_sound (a : Fin 6) : + (CB4_3_1I1R3Raw a).Encloses (CB4_3_1I1R3Value a) := by + exact residualBall_sound_on (below (shape 4 3 1)) B4_3_1Law (fun u => (stageBLaw (shape 4 3 1) u : ℝ)) (stageBPriority (shape 4 3 1)) 1 (fun u => B4_3_1Little u ((stageBPriority (shape 4 3 1)) 1)) (fun u a => (littleLaw (shape 4 3 1) u ((stageBPriority (shape 4 3 1)) 1) a : ℝ)) (fun u _ => B4_3_1Law_sound u) (fun u _ a => B4_3_1Little_sound u ((stageBPriority (shape 4 3 1)) 1) a) 3 a +def CB4_3_1I1R3Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(1293653321378517322144444232489 / 100000000000000000000000000000000), (1 / 20000000000000000000000000000000)⟩ ⟨(5624416465391076871446041112211 / 100000000000000000000000000000000), (2191533999 / 100000000000000000000000000000000)⟩ ⟨(-434769993818567805721764350077799 / 100000000000000000000000000000000), (3388131797 / 2000000000000000000000000000000)⟩ ⟨-7, 1293653321378517322144444232489, 781250000000000000000000000000⟩] +lemma CB4_3_1I1R3Certificates_valid : + CB4_3_1I1R3Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB4_3_1I1R3CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | 4 => 1 + | _ => 0 +def CB4_3_1I1R3P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB4_3_1I1R3Certificates (CB4_3_1I1R3CertificateIndex a)).input +lemma CB4_3_1I1R3P_check : ∀ a : Fin 6, contains (CB4_3_1I1R3Raw a) (CB4_3_1I1R3P a) = true := by + decide +kernel +lemma CB4_3_1I1R3P_sound (a : Fin 6) : + (CB4_3_1I1R3P a).Encloses (CB4_3_1I1R3Value a) := + contains_sound (CB4_3_1I1R3Raw_sound a) (CB4_3_1I1R3P_check a) +def CB4_3_1I1R3Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB4_3_1I1R3Certificates (CB4_3_1I1R3CertificateIndex a)).output +lemma CB4_3_1I1R3Terms_sound (a : Fin 6) : + (CB4_3_1I1R3Terms a).Encloses (Foundation.entropyTerm (CB4_3_1I1R3Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB4_3_1I1R3Certificates_valid + (CB4_3_1I1R3CertificateIndex a) (CB4_3_1I1R3P_sound a) +def CB4_3_1I1R3Entropy : Ball := ⟨(5624416465391076871446041112211 / 100000000000000000000000000000000), (2191533999 / 100000000000000000000000000000000)⟩ +lemma CB4_3_1I1R3Entropy_sound : CB4_3_1I1R3Entropy.Encloses (Foundation.finiteEntropy CB4_3_1I1R3Value) := by + exact contains_sound (entropyFin_enclosed 6 CB4_3_1I1R3Value CB4_3_1I1R3Terms CB4_3_1I1R3Terms_sound) (by decide +kernel) +def CB4_3_1I1R3Mass : Ball := ⟨(1293653321378517322144444232489 / 100000000000000000000000000000000), (1 / 20000000000000000000000000000000)⟩ +lemma CB4_3_1I1R3Mass_sound : CB4_3_1I1R3Mass.Encloses (∑ a, CB4_3_1I1R3Value a) := by + exact contains_sound (finSumBall_sound 6 CB4_3_1I1R3P CB4_3_1I1R3Value CB4_3_1I1R3P_sound) (by decide +kernel) +def CB4_3_1I1R3MassTermLogWitness : LogWitness := ⟨-7, 1293653321378517322144444232489, 781250000000000000000000000000⟩ +def CB4_3_1I1R3MassTermLog : Ball := ⟨(-434769993818567805721764350077799 / 100000000000000000000000000000000), (3388131797 / 2000000000000000000000000000000)⟩ +lemma CB4_3_1I1R3MassTermLog_sound : CB4_3_1I1R3MassTermLog.Encloses (Real.log ((∑ a, CB4_3_1I1R3Value a))) := by + exact checkLog_sound logTwoBall_sound (CB4_3_1I1R3Mass_sound) (w := CB4_3_1I1R3MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB4_3_1I1R3MassTerm : Ball := ⟨(5624416465391076871446041112211 / 100000000000000000000000000000000), (2191533999 / 100000000000000000000000000000000)⟩ +lemma CB4_3_1I1R3MassTerm_sound : CB4_3_1I1R3MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB4_3_1I1R3Value a))) := by + exact contains_sound (entropyTerm_ball (CB4_3_1I1R3Mass_sound) CB4_3_1I1R3MassTermLog_sound) (by decide +kernel) +def CB4_3_1I1R3H : Ball := ⟨0, (2191533999 / 50000000000000000000000000000000)⟩ +lemma CB4_3_1I1R3H_sound : CB4_3_1I1R3H.Encloses (homogeneousEntropy CB4_3_1I1R3Value) := by + exact contains_sound (homogeneous_enclosed CB4_3_1I1R3Value CB4_3_1I1R3MassTerm_sound CB4_3_1I1R3Entropy_sound) (by decide +kernel) +def CB4_3_1I1R4Value (a : Fin 6) : ℝ := residualLaw (below (shape 4 3 1)) (fun u => (stageBLaw (shape 4 3 1) u : ℝ)) (stageBPriority (shape 4 3 1)) 1 (fun u a => (littleLaw (shape 4 3 1) u ((stageBPriority (shape 4 3 1)) 1) a : ℝ)) 4 a +def CB4_3_1I1R4Raw (a : Fin 6) : Ball := residualBall (below (shape 4 3 1)) B4_3_1Law (stageBPriority (shape 4 3 1)) 1 (fun u => B4_3_1Little u ((stageBPriority (shape 4 3 1)) 1)) 4 a +lemma CB4_3_1I1R4Raw_sound (a : Fin 6) : + (CB4_3_1I1R4Raw a).Encloses (CB4_3_1I1R4Value a) := by + exact residualBall_sound_on (below (shape 4 3 1)) B4_3_1Law (fun u => (stageBLaw (shape 4 3 1) u : ℝ)) (stageBPriority (shape 4 3 1)) 1 (fun u => B4_3_1Little u ((stageBPriority (shape 4 3 1)) 1)) (fun u a => (littleLaw (shape 4 3 1) u ((stageBPriority (shape 4 3 1)) 1) a : ℝ)) (fun u _ => B4_3_1Law_sound u) (fun u _ a => B4_3_1Little_sound u ((stageBPriority (shape 4 3 1)) 1) a) 4 a +def CB4_3_1I1R4Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB4_3_1I1R4Certificates_valid : + CB4_3_1I1R4Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB4_3_1I1R4CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB4_3_1I1R4P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB4_3_1I1R4Certificates (CB4_3_1I1R4CertificateIndex a)).input +lemma CB4_3_1I1R4P_check : ∀ a : Fin 6, contains (CB4_3_1I1R4Raw a) (CB4_3_1I1R4P a) = true := by + decide +kernel +lemma CB4_3_1I1R4P_sound (a : Fin 6) : + (CB4_3_1I1R4P a).Encloses (CB4_3_1I1R4Value a) := + contains_sound (CB4_3_1I1R4Raw_sound a) (CB4_3_1I1R4P_check a) +def CB4_3_1I1R4Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB4_3_1I1R4Certificates (CB4_3_1I1R4CertificateIndex a)).output +lemma CB4_3_1I1R4Terms_sound (a : Fin 6) : + (CB4_3_1I1R4Terms a).Encloses (Foundation.entropyTerm (CB4_3_1I1R4Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB4_3_1I1R4Certificates_valid + (CB4_3_1I1R4CertificateIndex a) (CB4_3_1I1R4P_sound a) +def CB4_3_1I1R4Entropy : Ball := ⟨0, 0⟩ +lemma CB4_3_1I1R4Entropy_sound : CB4_3_1I1R4Entropy.Encloses (Foundation.finiteEntropy CB4_3_1I1R4Value) := by + exact contains_sound (entropyFin_enclosed 6 CB4_3_1I1R4Value CB4_3_1I1R4Terms CB4_3_1I1R4Terms_sound) (by decide +kernel) +def CB4_3_1I1R4Mass : Ball := ⟨0, 0⟩ +lemma CB4_3_1I1R4Mass_sound : CB4_3_1I1R4Mass.Encloses (∑ a, CB4_3_1I1R4Value a) := by + exact contains_sound (finSumBall_sound 6 CB4_3_1I1R4P CB4_3_1I1R4Value CB4_3_1I1R4P_sound) (by decide +kernel) +def CB4_3_1I1R4MassTerm : Ball := .exact 0 +lemma CB4_3_1I1R4MassTerm_sound : CB4_3_1I1R4MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB4_3_1I1R4Value a))) := + entropyTerm_zero_ball (CB4_3_1I1R4Mass_sound) +def CB4_3_1I1R4H : Ball := ⟨0, 0⟩ +lemma CB4_3_1I1R4H_sound : CB4_3_1I1R4H.Encloses (homogeneousEntropy CB4_3_1I1R4Value) := by + exact contains_sound (homogeneous_enclosed CB4_3_1I1R4Value CB4_3_1I1R4MassTerm_sound CB4_3_1I1R4Entropy_sound) (by decide +kernel) +def CB4_3_1I1R5Value (a : Fin 6) : ℝ := residualLaw (below (shape 4 3 1)) (fun u => (stageBLaw (shape 4 3 1) u : ℝ)) (stageBPriority (shape 4 3 1)) 1 (fun u a => (littleLaw (shape 4 3 1) u ((stageBPriority (shape 4 3 1)) 1) a : ℝ)) 5 a +def CB4_3_1I1R5Raw (a : Fin 6) : Ball := residualBall (below (shape 4 3 1)) B4_3_1Law (stageBPriority (shape 4 3 1)) 1 (fun u => B4_3_1Little u ((stageBPriority (shape 4 3 1)) 1)) 5 a +lemma CB4_3_1I1R5Raw_sound (a : Fin 6) : + (CB4_3_1I1R5Raw a).Encloses (CB4_3_1I1R5Value a) := by + exact residualBall_sound_on (below (shape 4 3 1)) B4_3_1Law (fun u => (stageBLaw (shape 4 3 1) u : ℝ)) (stageBPriority (shape 4 3 1)) 1 (fun u => B4_3_1Little u ((stageBPriority (shape 4 3 1)) 1)) (fun u a => (littleLaw (shape 4 3 1) u ((stageBPriority (shape 4 3 1)) 1) a : ℝ)) (fun u _ => B4_3_1Law_sound u) (fun u _ a => B4_3_1Little_sound u ((stageBPriority (shape 4 3 1)) 1) a) 5 a +def CB4_3_1I1R5Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB4_3_1I1R5Certificates_valid : + CB4_3_1I1R5Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB4_3_1I1R5CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB4_3_1I1R5P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB4_3_1I1R5Certificates (CB4_3_1I1R5CertificateIndex a)).input +lemma CB4_3_1I1R5P_check : ∀ a : Fin 6, contains (CB4_3_1I1R5Raw a) (CB4_3_1I1R5P a) = true := by + decide +kernel +lemma CB4_3_1I1R5P_sound (a : Fin 6) : + (CB4_3_1I1R5P a).Encloses (CB4_3_1I1R5Value a) := + contains_sound (CB4_3_1I1R5Raw_sound a) (CB4_3_1I1R5P_check a) +def CB4_3_1I1R5Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB4_3_1I1R5Certificates (CB4_3_1I1R5CertificateIndex a)).output +lemma CB4_3_1I1R5Terms_sound (a : Fin 6) : + (CB4_3_1I1R5Terms a).Encloses (Foundation.entropyTerm (CB4_3_1I1R5Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB4_3_1I1R5Certificates_valid + (CB4_3_1I1R5CertificateIndex a) (CB4_3_1I1R5P_sound a) +def CB4_3_1I1R5Entropy : Ball := ⟨0, 0⟩ +lemma CB4_3_1I1R5Entropy_sound : CB4_3_1I1R5Entropy.Encloses (Foundation.finiteEntropy CB4_3_1I1R5Value) := by + exact contains_sound (entropyFin_enclosed 6 CB4_3_1I1R5Value CB4_3_1I1R5Terms CB4_3_1I1R5Terms_sound) (by decide +kernel) +def CB4_3_1I1R5Mass : Ball := ⟨0, 0⟩ +lemma CB4_3_1I1R5Mass_sound : CB4_3_1I1R5Mass.Encloses (∑ a, CB4_3_1I1R5Value a) := by + exact contains_sound (finSumBall_sound 6 CB4_3_1I1R5P CB4_3_1I1R5Value CB4_3_1I1R5P_sound) (by decide +kernel) +def CB4_3_1I1R5MassTerm : Ball := .exact 0 +lemma CB4_3_1I1R5MassTerm_sound : CB4_3_1I1R5MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB4_3_1I1R5Value a))) := + entropyTerm_zero_ball (CB4_3_1I1R5Mass_sound) +def CB4_3_1I1R5H : Ball := ⟨0, 0⟩ +lemma CB4_3_1I1R5H_sound : CB4_3_1I1R5H.Encloses (homogeneousEntropy CB4_3_1I1R5Value) := by + exact contains_sound (homogeneous_enclosed CB4_3_1I1R5Value CB4_3_1I1R5MassTerm_sound CB4_3_1I1R5Entropy_sound) (by decide +kernel) +def CB4_3_1I1R6Value (a : Fin 6) : ℝ := residualLaw (below (shape 4 3 1)) (fun u => (stageBLaw (shape 4 3 1) u : ℝ)) (stageBPriority (shape 4 3 1)) 1 (fun u a => (littleLaw (shape 4 3 1) u ((stageBPriority (shape 4 3 1)) 1) a : ℝ)) 6 a +def CB4_3_1I1R6Raw (a : Fin 6) : Ball := residualBall (below (shape 4 3 1)) B4_3_1Law (stageBPriority (shape 4 3 1)) 1 (fun u => B4_3_1Little u ((stageBPriority (shape 4 3 1)) 1)) 6 a +lemma CB4_3_1I1R6Raw_sound (a : Fin 6) : + (CB4_3_1I1R6Raw a).Encloses (CB4_3_1I1R6Value a) := by + exact residualBall_sound_on (below (shape 4 3 1)) B4_3_1Law (fun u => (stageBLaw (shape 4 3 1) u : ℝ)) (stageBPriority (shape 4 3 1)) 1 (fun u => B4_3_1Little u ((stageBPriority (shape 4 3 1)) 1)) (fun u a => (littleLaw (shape 4 3 1) u ((stageBPriority (shape 4 3 1)) 1) a : ℝ)) (fun u _ => B4_3_1Law_sound u) (fun u _ a => B4_3_1Little_sound u ((stageBPriority (shape 4 3 1)) 1) a) 6 a +def CB4_3_1I1R6Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB4_3_1I1R6Certificates_valid : + CB4_3_1I1R6Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB4_3_1I1R6CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB4_3_1I1R6P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB4_3_1I1R6Certificates (CB4_3_1I1R6CertificateIndex a)).input +lemma CB4_3_1I1R6P_check : ∀ a : Fin 6, contains (CB4_3_1I1R6Raw a) (CB4_3_1I1R6P a) = true := by + decide +kernel +lemma CB4_3_1I1R6P_sound (a : Fin 6) : + (CB4_3_1I1R6P a).Encloses (CB4_3_1I1R6Value a) := + contains_sound (CB4_3_1I1R6Raw_sound a) (CB4_3_1I1R6P_check a) +def CB4_3_1I1R6Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB4_3_1I1R6Certificates (CB4_3_1I1R6CertificateIndex a)).output +lemma CB4_3_1I1R6Terms_sound (a : Fin 6) : + (CB4_3_1I1R6Terms a).Encloses (Foundation.entropyTerm (CB4_3_1I1R6Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB4_3_1I1R6Certificates_valid + (CB4_3_1I1R6CertificateIndex a) (CB4_3_1I1R6P_sound a) +def CB4_3_1I1R6Entropy : Ball := ⟨0, 0⟩ +lemma CB4_3_1I1R6Entropy_sound : CB4_3_1I1R6Entropy.Encloses (Foundation.finiteEntropy CB4_3_1I1R6Value) := by + exact contains_sound (entropyFin_enclosed 6 CB4_3_1I1R6Value CB4_3_1I1R6Terms CB4_3_1I1R6Terms_sound) (by decide +kernel) +def CB4_3_1I1R6Mass : Ball := ⟨0, 0⟩ +lemma CB4_3_1I1R6Mass_sound : CB4_3_1I1R6Mass.Encloses (∑ a, CB4_3_1I1R6Value a) := by + exact contains_sound (finSumBall_sound 6 CB4_3_1I1R6P CB4_3_1I1R6Value CB4_3_1I1R6P_sound) (by decide +kernel) +def CB4_3_1I1R6MassTerm : Ball := .exact 0 +lemma CB4_3_1I1R6MassTerm_sound : CB4_3_1I1R6MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB4_3_1I1R6Value a))) := + entropyTerm_zero_ball (CB4_3_1I1R6Mass_sound) +def CB4_3_1I1R6H : Ball := ⟨0, 0⟩ +lemma CB4_3_1I1R6H_sound : CB4_3_1I1R6H.Encloses (homogeneousEntropy CB4_3_1I1R6Value) := by + exact contains_sound (homogeneous_enclosed CB4_3_1I1R6Value CB4_3_1I1R6MassTerm_sound CB4_3_1I1R6Entropy_sound) (by decide +kernel) +def CB4_3_1I1R7Value (a : Fin 6) : ℝ := residualLaw (below (shape 4 3 1)) (fun u => (stageBLaw (shape 4 3 1) u : ℝ)) (stageBPriority (shape 4 3 1)) 1 (fun u a => (littleLaw (shape 4 3 1) u ((stageBPriority (shape 4 3 1)) 1) a : ℝ)) 7 a +def CB4_3_1I1R7Raw (a : Fin 6) : Ball := residualBall (below (shape 4 3 1)) B4_3_1Law (stageBPriority (shape 4 3 1)) 1 (fun u => B4_3_1Little u ((stageBPriority (shape 4 3 1)) 1)) 7 a +lemma CB4_3_1I1R7Raw_sound (a : Fin 6) : + (CB4_3_1I1R7Raw a).Encloses (CB4_3_1I1R7Value a) := by + exact residualBall_sound_on (below (shape 4 3 1)) B4_3_1Law (fun u => (stageBLaw (shape 4 3 1) u : ℝ)) (stageBPriority (shape 4 3 1)) 1 (fun u => B4_3_1Little u ((stageBPriority (shape 4 3 1)) 1)) (fun u a => (littleLaw (shape 4 3 1) u ((stageBPriority (shape 4 3 1)) 1) a : ℝ)) (fun u _ => B4_3_1Law_sound u) (fun u _ a => B4_3_1Little_sound u ((stageBPriority (shape 4 3 1)) 1) a) 7 a +def CB4_3_1I1R7Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB4_3_1I1R7Certificates_valid : + CB4_3_1I1R7Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB4_3_1I1R7CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB4_3_1I1R7P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB4_3_1I1R7Certificates (CB4_3_1I1R7CertificateIndex a)).input +lemma CB4_3_1I1R7P_check : ∀ a : Fin 6, contains (CB4_3_1I1R7Raw a) (CB4_3_1I1R7P a) = true := by + decide +kernel +lemma CB4_3_1I1R7P_sound (a : Fin 6) : + (CB4_3_1I1R7P a).Encloses (CB4_3_1I1R7Value a) := + contains_sound (CB4_3_1I1R7Raw_sound a) (CB4_3_1I1R7P_check a) +def CB4_3_1I1R7Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB4_3_1I1R7Certificates (CB4_3_1I1R7CertificateIndex a)).output +lemma CB4_3_1I1R7Terms_sound (a : Fin 6) : + (CB4_3_1I1R7Terms a).Encloses (Foundation.entropyTerm (CB4_3_1I1R7Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB4_3_1I1R7Certificates_valid + (CB4_3_1I1R7CertificateIndex a) (CB4_3_1I1R7P_sound a) +def CB4_3_1I1R7Entropy : Ball := ⟨0, 0⟩ +lemma CB4_3_1I1R7Entropy_sound : CB4_3_1I1R7Entropy.Encloses (Foundation.finiteEntropy CB4_3_1I1R7Value) := by + exact contains_sound (entropyFin_enclosed 6 CB4_3_1I1R7Value CB4_3_1I1R7Terms CB4_3_1I1R7Terms_sound) (by decide +kernel) +def CB4_3_1I1R7Mass : Ball := ⟨0, 0⟩ +lemma CB4_3_1I1R7Mass_sound : CB4_3_1I1R7Mass.Encloses (∑ a, CB4_3_1I1R7Value a) := by + exact contains_sound (finSumBall_sound 6 CB4_3_1I1R7P CB4_3_1I1R7Value CB4_3_1I1R7P_sound) (by decide +kernel) +def CB4_3_1I1R7MassTerm : Ball := .exact 0 +lemma CB4_3_1I1R7MassTerm_sound : CB4_3_1I1R7MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB4_3_1I1R7Value a))) := + entropyTerm_zero_ball (CB4_3_1I1R7Mass_sound) +def CB4_3_1I1R7H : Ball := ⟨0, 0⟩ +lemma CB4_3_1I1R7H_sound : CB4_3_1I1R7H.Encloses (homogeneousEntropy CB4_3_1I1R7Value) := by + exact contains_sound (homogeneous_enclosed CB4_3_1I1R7Value CB4_3_1I1R7MassTerm_sound CB4_3_1I1R7Entropy_sound) (by decide +kernel) +def CB4_3_1I1R8Value (a : Fin 6) : ℝ := residualLaw (below (shape 4 3 1)) (fun u => (stageBLaw (shape 4 3 1) u : ℝ)) (stageBPriority (shape 4 3 1)) 1 (fun u a => (littleLaw (shape 4 3 1) u ((stageBPriority (shape 4 3 1)) 1) a : ℝ)) 8 a +def CB4_3_1I1R8Raw (a : Fin 6) : Ball := residualBall (below (shape 4 3 1)) B4_3_1Law (stageBPriority (shape 4 3 1)) 1 (fun u => B4_3_1Little u ((stageBPriority (shape 4 3 1)) 1)) 8 a +lemma CB4_3_1I1R8Raw_sound (a : Fin 6) : + (CB4_3_1I1R8Raw a).Encloses (CB4_3_1I1R8Value a) := by + exact residualBall_sound_on (below (shape 4 3 1)) B4_3_1Law (fun u => (stageBLaw (shape 4 3 1) u : ℝ)) (stageBPriority (shape 4 3 1)) 1 (fun u => B4_3_1Little u ((stageBPriority (shape 4 3 1)) 1)) (fun u a => (littleLaw (shape 4 3 1) u ((stageBPriority (shape 4 3 1)) 1) a : ℝ)) (fun u _ => B4_3_1Law_sound u) (fun u _ a => B4_3_1Little_sound u ((stageBPriority (shape 4 3 1)) 1) a) 8 a +def CB4_3_1I1R8Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB4_3_1I1R8Certificates_valid : + CB4_3_1I1R8Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB4_3_1I1R8CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB4_3_1I1R8P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB4_3_1I1R8Certificates (CB4_3_1I1R8CertificateIndex a)).input +lemma CB4_3_1I1R8P_check : ∀ a : Fin 6, contains (CB4_3_1I1R8Raw a) (CB4_3_1I1R8P a) = true := by + decide +kernel +lemma CB4_3_1I1R8P_sound (a : Fin 6) : + (CB4_3_1I1R8P a).Encloses (CB4_3_1I1R8Value a) := + contains_sound (CB4_3_1I1R8Raw_sound a) (CB4_3_1I1R8P_check a) +def CB4_3_1I1R8Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB4_3_1I1R8Certificates (CB4_3_1I1R8CertificateIndex a)).output +lemma CB4_3_1I1R8Terms_sound (a : Fin 6) : + (CB4_3_1I1R8Terms a).Encloses (Foundation.entropyTerm (CB4_3_1I1R8Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB4_3_1I1R8Certificates_valid + (CB4_3_1I1R8CertificateIndex a) (CB4_3_1I1R8P_sound a) +def CB4_3_1I1R8Entropy : Ball := ⟨0, 0⟩ +lemma CB4_3_1I1R8Entropy_sound : CB4_3_1I1R8Entropy.Encloses (Foundation.finiteEntropy CB4_3_1I1R8Value) := by + exact contains_sound (entropyFin_enclosed 6 CB4_3_1I1R8Value CB4_3_1I1R8Terms CB4_3_1I1R8Terms_sound) (by decide +kernel) +def CB4_3_1I1R8Mass : Ball := ⟨0, 0⟩ +lemma CB4_3_1I1R8Mass_sound : CB4_3_1I1R8Mass.Encloses (∑ a, CB4_3_1I1R8Value a) := by + exact contains_sound (finSumBall_sound 6 CB4_3_1I1R8P CB4_3_1I1R8Value CB4_3_1I1R8P_sound) (by decide +kernel) +def CB4_3_1I1R8MassTerm : Ball := .exact 0 +lemma CB4_3_1I1R8MassTerm_sound : CB4_3_1I1R8MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB4_3_1I1R8Value a))) := + entropyTerm_zero_ball (CB4_3_1I1R8Mass_sound) +def CB4_3_1I1R8H : Ball := ⟨0, 0⟩ +lemma CB4_3_1I1R8H_sound : CB4_3_1I1R8H.Encloses (homogeneousEntropy CB4_3_1I1R8Value) := by + exact contains_sound (homogeneous_enclosed CB4_3_1I1R8Value CB4_3_1I1R8MassTerm_sound CB4_3_1I1R8Entropy_sound) (by decide +kernel) +def CB4_3_1I1R9Value (a : Fin 6) : ℝ := residualLaw (below (shape 4 3 1)) (fun u => (stageBLaw (shape 4 3 1) u : ℝ)) (stageBPriority (shape 4 3 1)) 1 (fun u a => (littleLaw (shape 4 3 1) u ((stageBPriority (shape 4 3 1)) 1) a : ℝ)) 9 a +def CB4_3_1I1R9Raw (a : Fin 6) : Ball := residualBall (below (shape 4 3 1)) B4_3_1Law (stageBPriority (shape 4 3 1)) 1 (fun u => B4_3_1Little u ((stageBPriority (shape 4 3 1)) 1)) 9 a +lemma CB4_3_1I1R9Raw_sound (a : Fin 6) : + (CB4_3_1I1R9Raw a).Encloses (CB4_3_1I1R9Value a) := by + exact residualBall_sound_on (below (shape 4 3 1)) B4_3_1Law (fun u => (stageBLaw (shape 4 3 1) u : ℝ)) (stageBPriority (shape 4 3 1)) 1 (fun u => B4_3_1Little u ((stageBPriority (shape 4 3 1)) 1)) (fun u a => (littleLaw (shape 4 3 1) u ((stageBPriority (shape 4 3 1)) 1) a : ℝ)) (fun u _ => B4_3_1Law_sound u) (fun u _ a => B4_3_1Little_sound u ((stageBPriority (shape 4 3 1)) 1) a) 9 a +def CB4_3_1I1R9Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB4_3_1I1R9Certificates_valid : + CB4_3_1I1R9Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB4_3_1I1R9CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB4_3_1I1R9P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB4_3_1I1R9Certificates (CB4_3_1I1R9CertificateIndex a)).input +lemma CB4_3_1I1R9P_check : ∀ a : Fin 6, contains (CB4_3_1I1R9Raw a) (CB4_3_1I1R9P a) = true := by + decide +kernel +lemma CB4_3_1I1R9P_sound (a : Fin 6) : + (CB4_3_1I1R9P a).Encloses (CB4_3_1I1R9Value a) := + contains_sound (CB4_3_1I1R9Raw_sound a) (CB4_3_1I1R9P_check a) +def CB4_3_1I1R9Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB4_3_1I1R9Certificates (CB4_3_1I1R9CertificateIndex a)).output +lemma CB4_3_1I1R9Terms_sound (a : Fin 6) : + (CB4_3_1I1R9Terms a).Encloses (Foundation.entropyTerm (CB4_3_1I1R9Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB4_3_1I1R9Certificates_valid + (CB4_3_1I1R9CertificateIndex a) (CB4_3_1I1R9P_sound a) +def CB4_3_1I1R9Entropy : Ball := ⟨0, 0⟩ +lemma CB4_3_1I1R9Entropy_sound : CB4_3_1I1R9Entropy.Encloses (Foundation.finiteEntropy CB4_3_1I1R9Value) := by + exact contains_sound (entropyFin_enclosed 6 CB4_3_1I1R9Value CB4_3_1I1R9Terms CB4_3_1I1R9Terms_sound) (by decide +kernel) +def CB4_3_1I1R9Mass : Ball := ⟨0, 0⟩ +lemma CB4_3_1I1R9Mass_sound : CB4_3_1I1R9Mass.Encloses (∑ a, CB4_3_1I1R9Value a) := by + exact contains_sound (finSumBall_sound 6 CB4_3_1I1R9P CB4_3_1I1R9Value CB4_3_1I1R9P_sound) (by decide +kernel) +def CB4_3_1I1R9MassTerm : Ball := .exact 0 +lemma CB4_3_1I1R9MassTerm_sound : CB4_3_1I1R9MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB4_3_1I1R9Value a))) := + entropyTerm_zero_ball (CB4_3_1I1R9Mass_sound) +def CB4_3_1I1R9H : Ball := ⟨0, 0⟩ +lemma CB4_3_1I1R9H_sound : CB4_3_1I1R9H.Encloses (homogeneousEntropy CB4_3_1I1R9Value) := by + exact contains_sound (homogeneous_enclosed CB4_3_1I1R9Value CB4_3_1I1R9MassTerm_sound CB4_3_1I1R9Entropy_sound) (by decide +kernel) +def CB4_3_1I1R10Value (a : Fin 6) : ℝ := residualLaw (below (shape 4 3 1)) (fun u => (stageBLaw (shape 4 3 1) u : ℝ)) (stageBPriority (shape 4 3 1)) 1 (fun u a => (littleLaw (shape 4 3 1) u ((stageBPriority (shape 4 3 1)) 1) a : ℝ)) 10 a +def CB4_3_1I1R10Raw (a : Fin 6) : Ball := residualBall (below (shape 4 3 1)) B4_3_1Law (stageBPriority (shape 4 3 1)) 1 (fun u => B4_3_1Little u ((stageBPriority (shape 4 3 1)) 1)) 10 a +lemma CB4_3_1I1R10Raw_sound (a : Fin 6) : + (CB4_3_1I1R10Raw a).Encloses (CB4_3_1I1R10Value a) := by + exact residualBall_sound_on (below (shape 4 3 1)) B4_3_1Law (fun u => (stageBLaw (shape 4 3 1) u : ℝ)) (stageBPriority (shape 4 3 1)) 1 (fun u => B4_3_1Little u ((stageBPriority (shape 4 3 1)) 1)) (fun u a => (littleLaw (shape 4 3 1) u ((stageBPriority (shape 4 3 1)) 1) a : ℝ)) (fun u _ => B4_3_1Law_sound u) (fun u _ a => B4_3_1Little_sound u ((stageBPriority (shape 4 3 1)) 1) a) 10 a +def CB4_3_1I1R10Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB4_3_1I1R10Certificates_valid : + CB4_3_1I1R10Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB4_3_1I1R10CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB4_3_1I1R10P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB4_3_1I1R10Certificates (CB4_3_1I1R10CertificateIndex a)).input +lemma CB4_3_1I1R10P_check : ∀ a : Fin 6, contains (CB4_3_1I1R10Raw a) (CB4_3_1I1R10P a) = true := by + decide +kernel +lemma CB4_3_1I1R10P_sound (a : Fin 6) : + (CB4_3_1I1R10P a).Encloses (CB4_3_1I1R10Value a) := + contains_sound (CB4_3_1I1R10Raw_sound a) (CB4_3_1I1R10P_check a) +def CB4_3_1I1R10Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB4_3_1I1R10Certificates (CB4_3_1I1R10CertificateIndex a)).output +lemma CB4_3_1I1R10Terms_sound (a : Fin 6) : + (CB4_3_1I1R10Terms a).Encloses (Foundation.entropyTerm (CB4_3_1I1R10Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB4_3_1I1R10Certificates_valid + (CB4_3_1I1R10CertificateIndex a) (CB4_3_1I1R10P_sound a) +def CB4_3_1I1R10Entropy : Ball := ⟨0, 0⟩ +lemma CB4_3_1I1R10Entropy_sound : CB4_3_1I1R10Entropy.Encloses (Foundation.finiteEntropy CB4_3_1I1R10Value) := by + exact contains_sound (entropyFin_enclosed 6 CB4_3_1I1R10Value CB4_3_1I1R10Terms CB4_3_1I1R10Terms_sound) (by decide +kernel) +def CB4_3_1I1R10Mass : Ball := ⟨0, 0⟩ +lemma CB4_3_1I1R10Mass_sound : CB4_3_1I1R10Mass.Encloses (∑ a, CB4_3_1I1R10Value a) := by + exact contains_sound (finSumBall_sound 6 CB4_3_1I1R10P CB4_3_1I1R10Value CB4_3_1I1R10P_sound) (by decide +kernel) +def CB4_3_1I1R10MassTerm : Ball := .exact 0 +lemma CB4_3_1I1R10MassTerm_sound : CB4_3_1I1R10MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB4_3_1I1R10Value a))) := + entropyTerm_zero_ball (CB4_3_1I1R10Mass_sound) +def CB4_3_1I1R10H : Ball := ⟨0, 0⟩ +lemma CB4_3_1I1R10H_sound : CB4_3_1I1R10H.Encloses (homogeneousEntropy CB4_3_1I1R10Value) := by + exact contains_sound (homogeneous_enclosed CB4_3_1I1R10Value CB4_3_1I1R10MassTerm_sound CB4_3_1I1R10Entropy_sound) (by decide +kernel) +def CB4_3_1I1R11Value (a : Fin 6) : ℝ := residualLaw (below (shape 4 3 1)) (fun u => (stageBLaw (shape 4 3 1) u : ℝ)) (stageBPriority (shape 4 3 1)) 1 (fun u a => (littleLaw (shape 4 3 1) u ((stageBPriority (shape 4 3 1)) 1) a : ℝ)) 11 a +def CB4_3_1I1R11Raw (a : Fin 6) : Ball := residualBall (below (shape 4 3 1)) B4_3_1Law (stageBPriority (shape 4 3 1)) 1 (fun u => B4_3_1Little u ((stageBPriority (shape 4 3 1)) 1)) 11 a +lemma CB4_3_1I1R11Raw_sound (a : Fin 6) : + (CB4_3_1I1R11Raw a).Encloses (CB4_3_1I1R11Value a) := by + exact residualBall_sound_on (below (shape 4 3 1)) B4_3_1Law (fun u => (stageBLaw (shape 4 3 1) u : ℝ)) (stageBPriority (shape 4 3 1)) 1 (fun u => B4_3_1Little u ((stageBPriority (shape 4 3 1)) 1)) (fun u a => (littleLaw (shape 4 3 1) u ((stageBPriority (shape 4 3 1)) 1) a : ℝ)) (fun u _ => B4_3_1Law_sound u) (fun u _ a => B4_3_1Little_sound u ((stageBPriority (shape 4 3 1)) 1) a) 11 a +def CB4_3_1I1R11Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB4_3_1I1R11Certificates_valid : + CB4_3_1I1R11Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB4_3_1I1R11CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB4_3_1I1R11P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB4_3_1I1R11Certificates (CB4_3_1I1R11CertificateIndex a)).input +lemma CB4_3_1I1R11P_check : ∀ a : Fin 6, contains (CB4_3_1I1R11Raw a) (CB4_3_1I1R11P a) = true := by + decide +kernel +lemma CB4_3_1I1R11P_sound (a : Fin 6) : + (CB4_3_1I1R11P a).Encloses (CB4_3_1I1R11Value a) := + contains_sound (CB4_3_1I1R11Raw_sound a) (CB4_3_1I1R11P_check a) +def CB4_3_1I1R11Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB4_3_1I1R11Certificates (CB4_3_1I1R11CertificateIndex a)).output +lemma CB4_3_1I1R11Terms_sound (a : Fin 6) : + (CB4_3_1I1R11Terms a).Encloses (Foundation.entropyTerm (CB4_3_1I1R11Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB4_3_1I1R11Certificates_valid + (CB4_3_1I1R11CertificateIndex a) (CB4_3_1I1R11P_sound a) +def CB4_3_1I1R11Entropy : Ball := ⟨0, 0⟩ +lemma CB4_3_1I1R11Entropy_sound : CB4_3_1I1R11Entropy.Encloses (Foundation.finiteEntropy CB4_3_1I1R11Value) := by + exact contains_sound (entropyFin_enclosed 6 CB4_3_1I1R11Value CB4_3_1I1R11Terms CB4_3_1I1R11Terms_sound) (by decide +kernel) +def CB4_3_1I1R11Mass : Ball := ⟨0, 0⟩ +lemma CB4_3_1I1R11Mass_sound : CB4_3_1I1R11Mass.Encloses (∑ a, CB4_3_1I1R11Value a) := by + exact contains_sound (finSumBall_sound 6 CB4_3_1I1R11P CB4_3_1I1R11Value CB4_3_1I1R11P_sound) (by decide +kernel) +def CB4_3_1I1R11MassTerm : Ball := .exact 0 +lemma CB4_3_1I1R11MassTerm_sound : CB4_3_1I1R11MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB4_3_1I1R11Value a))) := + entropyTerm_zero_ball (CB4_3_1I1R11Mass_sound) +def CB4_3_1I1R11H : Ball := ⟨0, 0⟩ +lemma CB4_3_1I1R11H_sound : CB4_3_1I1R11H.Encloses (homogeneousEntropy CB4_3_1I1R11Value) := by + exact contains_sound (homogeneous_enclosed CB4_3_1I1R11Value CB4_3_1I1R11MassTerm_sound CB4_3_1I1R11Entropy_sound) (by decide +kernel) +def CB4_3_1I1R12Value (a : Fin 6) : ℝ := residualLaw (below (shape 4 3 1)) (fun u => (stageBLaw (shape 4 3 1) u : ℝ)) (stageBPriority (shape 4 3 1)) 1 (fun u a => (littleLaw (shape 4 3 1) u ((stageBPriority (shape 4 3 1)) 1) a : ℝ)) 12 a +def CB4_3_1I1R12Raw (a : Fin 6) : Ball := residualBall (below (shape 4 3 1)) B4_3_1Law (stageBPriority (shape 4 3 1)) 1 (fun u => B4_3_1Little u ((stageBPriority (shape 4 3 1)) 1)) 12 a +lemma CB4_3_1I1R12Raw_sound (a : Fin 6) : + (CB4_3_1I1R12Raw a).Encloses (CB4_3_1I1R12Value a) := by + exact residualBall_sound_on (below (shape 4 3 1)) B4_3_1Law (fun u => (stageBLaw (shape 4 3 1) u : ℝ)) (stageBPriority (shape 4 3 1)) 1 (fun u => B4_3_1Little u ((stageBPriority (shape 4 3 1)) 1)) (fun u a => (littleLaw (shape 4 3 1) u ((stageBPriority (shape 4 3 1)) 1) a : ℝ)) (fun u _ => B4_3_1Law_sound u) (fun u _ a => B4_3_1Little_sound u ((stageBPriority (shape 4 3 1)) 1) a) 12 a +def CB4_3_1I1R12Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB4_3_1I1R12Certificates_valid : + CB4_3_1I1R12Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB4_3_1I1R12CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB4_3_1I1R12P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB4_3_1I1R12Certificates (CB4_3_1I1R12CertificateIndex a)).input +lemma CB4_3_1I1R12P_check : ∀ a : Fin 6, contains (CB4_3_1I1R12Raw a) (CB4_3_1I1R12P a) = true := by + decide +kernel +lemma CB4_3_1I1R12P_sound (a : Fin 6) : + (CB4_3_1I1R12P a).Encloses (CB4_3_1I1R12Value a) := + contains_sound (CB4_3_1I1R12Raw_sound a) (CB4_3_1I1R12P_check a) +def CB4_3_1I1R12Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB4_3_1I1R12Certificates (CB4_3_1I1R12CertificateIndex a)).output +lemma CB4_3_1I1R12Terms_sound (a : Fin 6) : + (CB4_3_1I1R12Terms a).Encloses (Foundation.entropyTerm (CB4_3_1I1R12Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB4_3_1I1R12Certificates_valid + (CB4_3_1I1R12CertificateIndex a) (CB4_3_1I1R12P_sound a) +def CB4_3_1I1R12Entropy : Ball := ⟨0, 0⟩ +lemma CB4_3_1I1R12Entropy_sound : CB4_3_1I1R12Entropy.Encloses (Foundation.finiteEntropy CB4_3_1I1R12Value) := by + exact contains_sound (entropyFin_enclosed 6 CB4_3_1I1R12Value CB4_3_1I1R12Terms CB4_3_1I1R12Terms_sound) (by decide +kernel) +def CB4_3_1I1R12Mass : Ball := ⟨0, 0⟩ +lemma CB4_3_1I1R12Mass_sound : CB4_3_1I1R12Mass.Encloses (∑ a, CB4_3_1I1R12Value a) := by + exact contains_sound (finSumBall_sound 6 CB4_3_1I1R12P CB4_3_1I1R12Value CB4_3_1I1R12P_sound) (by decide +kernel) +def CB4_3_1I1R12MassTerm : Ball := .exact 0 +lemma CB4_3_1I1R12MassTerm_sound : CB4_3_1I1R12MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB4_3_1I1R12Value a))) := + entropyTerm_zero_ball (CB4_3_1I1R12Mass_sound) +def CB4_3_1I1R12H : Ball := ⟨0, 0⟩ +lemma CB4_3_1I1R12H_sound : CB4_3_1I1R12H.Encloses (homogeneousEntropy CB4_3_1I1R12Value) := by + exact contains_sound (homogeneous_enclosed CB4_3_1I1R12Value CB4_3_1I1R12MassTerm_sound CB4_3_1I1R12Entropy_sound) (by decide +kernel) +def CB4_3_1I1R13Value (a : Fin 6) : ℝ := residualLaw (below (shape 4 3 1)) (fun u => (stageBLaw (shape 4 3 1) u : ℝ)) (stageBPriority (shape 4 3 1)) 1 (fun u a => (littleLaw (shape 4 3 1) u ((stageBPriority (shape 4 3 1)) 1) a : ℝ)) 13 a +def CB4_3_1I1R13Raw (a : Fin 6) : Ball := residualBall (below (shape 4 3 1)) B4_3_1Law (stageBPriority (shape 4 3 1)) 1 (fun u => B4_3_1Little u ((stageBPriority (shape 4 3 1)) 1)) 13 a +lemma CB4_3_1I1R13Raw_sound (a : Fin 6) : + (CB4_3_1I1R13Raw a).Encloses (CB4_3_1I1R13Value a) := by + exact residualBall_sound_on (below (shape 4 3 1)) B4_3_1Law (fun u => (stageBLaw (shape 4 3 1) u : ℝ)) (stageBPriority (shape 4 3 1)) 1 (fun u => B4_3_1Little u ((stageBPriority (shape 4 3 1)) 1)) (fun u a => (littleLaw (shape 4 3 1) u ((stageBPriority (shape 4 3 1)) 1) a : ℝ)) (fun u _ => B4_3_1Law_sound u) (fun u _ a => B4_3_1Little_sound u ((stageBPriority (shape 4 3 1)) 1) a) 13 a +def CB4_3_1I1R13Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB4_3_1I1R13Certificates_valid : + CB4_3_1I1R13Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB4_3_1I1R13CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB4_3_1I1R13P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB4_3_1I1R13Certificates (CB4_3_1I1R13CertificateIndex a)).input +lemma CB4_3_1I1R13P_check : ∀ a : Fin 6, contains (CB4_3_1I1R13Raw a) (CB4_3_1I1R13P a) = true := by + decide +kernel +lemma CB4_3_1I1R13P_sound (a : Fin 6) : + (CB4_3_1I1R13P a).Encloses (CB4_3_1I1R13Value a) := + contains_sound (CB4_3_1I1R13Raw_sound a) (CB4_3_1I1R13P_check a) +def CB4_3_1I1R13Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB4_3_1I1R13Certificates (CB4_3_1I1R13CertificateIndex a)).output +lemma CB4_3_1I1R13Terms_sound (a : Fin 6) : + (CB4_3_1I1R13Terms a).Encloses (Foundation.entropyTerm (CB4_3_1I1R13Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB4_3_1I1R13Certificates_valid + (CB4_3_1I1R13CertificateIndex a) (CB4_3_1I1R13P_sound a) +def CB4_3_1I1R13Entropy : Ball := ⟨0, 0⟩ +lemma CB4_3_1I1R13Entropy_sound : CB4_3_1I1R13Entropy.Encloses (Foundation.finiteEntropy CB4_3_1I1R13Value) := by + exact contains_sound (entropyFin_enclosed 6 CB4_3_1I1R13Value CB4_3_1I1R13Terms CB4_3_1I1R13Terms_sound) (by decide +kernel) +def CB4_3_1I1R13Mass : Ball := ⟨0, 0⟩ +lemma CB4_3_1I1R13Mass_sound : CB4_3_1I1R13Mass.Encloses (∑ a, CB4_3_1I1R13Value a) := by + exact contains_sound (finSumBall_sound 6 CB4_3_1I1R13P CB4_3_1I1R13Value CB4_3_1I1R13P_sound) (by decide +kernel) +def CB4_3_1I1R13MassTerm : Ball := .exact 0 +lemma CB4_3_1I1R13MassTerm_sound : CB4_3_1I1R13MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB4_3_1I1R13Value a))) := + entropyTerm_zero_ball (CB4_3_1I1R13Mass_sound) +def CB4_3_1I1R13H : Ball := ⟨0, 0⟩ +lemma CB4_3_1I1R13H_sound : CB4_3_1I1R13H.Encloses (homogeneousEntropy CB4_3_1I1R13Value) := by + exact contains_sound (homogeneous_enclosed CB4_3_1I1R13Value CB4_3_1I1R13MassTerm_sound CB4_3_1I1R13Entropy_sound) (by decide +kernel) +def CB4_3_1I1R14Value (a : Fin 6) : ℝ := residualLaw (below (shape 4 3 1)) (fun u => (stageBLaw (shape 4 3 1) u : ℝ)) (stageBPriority (shape 4 3 1)) 1 (fun u a => (littleLaw (shape 4 3 1) u ((stageBPriority (shape 4 3 1)) 1) a : ℝ)) 14 a +def CB4_3_1I1R14Raw (a : Fin 6) : Ball := residualBall (below (shape 4 3 1)) B4_3_1Law (stageBPriority (shape 4 3 1)) 1 (fun u => B4_3_1Little u ((stageBPriority (shape 4 3 1)) 1)) 14 a +lemma CB4_3_1I1R14Raw_sound (a : Fin 6) : + (CB4_3_1I1R14Raw a).Encloses (CB4_3_1I1R14Value a) := by + exact residualBall_sound_on (below (shape 4 3 1)) B4_3_1Law (fun u => (stageBLaw (shape 4 3 1) u : ℝ)) (stageBPriority (shape 4 3 1)) 1 (fun u => B4_3_1Little u ((stageBPriority (shape 4 3 1)) 1)) (fun u a => (littleLaw (shape 4 3 1) u ((stageBPriority (shape 4 3 1)) 1) a : ℝ)) (fun u _ => B4_3_1Law_sound u) (fun u _ a => B4_3_1Little_sound u ((stageBPriority (shape 4 3 1)) 1) a) 14 a +def CB4_3_1I1R14Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB4_3_1I1R14Certificates_valid : + CB4_3_1I1R14Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB4_3_1I1R14CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB4_3_1I1R14P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB4_3_1I1R14Certificates (CB4_3_1I1R14CertificateIndex a)).input +lemma CB4_3_1I1R14P_check : ∀ a : Fin 6, contains (CB4_3_1I1R14Raw a) (CB4_3_1I1R14P a) = true := by + decide +kernel +lemma CB4_3_1I1R14P_sound (a : Fin 6) : + (CB4_3_1I1R14P a).Encloses (CB4_3_1I1R14Value a) := + contains_sound (CB4_3_1I1R14Raw_sound a) (CB4_3_1I1R14P_check a) +def CB4_3_1I1R14Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB4_3_1I1R14Certificates (CB4_3_1I1R14CertificateIndex a)).output +lemma CB4_3_1I1R14Terms_sound (a : Fin 6) : + (CB4_3_1I1R14Terms a).Encloses (Foundation.entropyTerm (CB4_3_1I1R14Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB4_3_1I1R14Certificates_valid + (CB4_3_1I1R14CertificateIndex a) (CB4_3_1I1R14P_sound a) +def CB4_3_1I1R14Entropy : Ball := ⟨0, 0⟩ +lemma CB4_3_1I1R14Entropy_sound : CB4_3_1I1R14Entropy.Encloses (Foundation.finiteEntropy CB4_3_1I1R14Value) := by + exact contains_sound (entropyFin_enclosed 6 CB4_3_1I1R14Value CB4_3_1I1R14Terms CB4_3_1I1R14Terms_sound) (by decide +kernel) +def CB4_3_1I1R14Mass : Ball := ⟨0, 0⟩ +lemma CB4_3_1I1R14Mass_sound : CB4_3_1I1R14Mass.Encloses (∑ a, CB4_3_1I1R14Value a) := by + exact contains_sound (finSumBall_sound 6 CB4_3_1I1R14P CB4_3_1I1R14Value CB4_3_1I1R14P_sound) (by decide +kernel) +def CB4_3_1I1R14MassTerm : Ball := .exact 0 +lemma CB4_3_1I1R14MassTerm_sound : CB4_3_1I1R14MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB4_3_1I1R14Value a))) := + entropyTerm_zero_ball (CB4_3_1I1R14Mass_sound) +def CB4_3_1I1R14H : Ball := ⟨0, 0⟩ +lemma CB4_3_1I1R14H_sound : CB4_3_1I1R14H.Encloses (homogeneousEntropy CB4_3_1I1R14Value) := by + exact contains_sound (homogeneous_enclosed CB4_3_1I1R14Value CB4_3_1I1R14MassTerm_sound CB4_3_1I1R14Entropy_sound) (by decide +kernel) +def CB4_3_1I1R15Value (a : Fin 6) : ℝ := residualLaw (below (shape 4 3 1)) (fun u => (stageBLaw (shape 4 3 1) u : ℝ)) (stageBPriority (shape 4 3 1)) 1 (fun u a => (littleLaw (shape 4 3 1) u ((stageBPriority (shape 4 3 1)) 1) a : ℝ)) 15 a +def CB4_3_1I1R15Raw (a : Fin 6) : Ball := residualBall (below (shape 4 3 1)) B4_3_1Law (stageBPriority (shape 4 3 1)) 1 (fun u => B4_3_1Little u ((stageBPriority (shape 4 3 1)) 1)) 15 a +lemma CB4_3_1I1R15Raw_sound (a : Fin 6) : + (CB4_3_1I1R15Raw a).Encloses (CB4_3_1I1R15Value a) := by + exact residualBall_sound_on (below (shape 4 3 1)) B4_3_1Law (fun u => (stageBLaw (shape 4 3 1) u : ℝ)) (stageBPriority (shape 4 3 1)) 1 (fun u => B4_3_1Little u ((stageBPriority (shape 4 3 1)) 1)) (fun u a => (littleLaw (shape 4 3 1) u ((stageBPriority (shape 4 3 1)) 1) a : ℝ)) (fun u _ => B4_3_1Law_sound u) (fun u _ a => B4_3_1Little_sound u ((stageBPriority (shape 4 3 1)) 1) a) 15 a +def CB4_3_1I1R15Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB4_3_1I1R15Certificates_valid : + CB4_3_1I1R15Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB4_3_1I1R15CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB4_3_1I1R15P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB4_3_1I1R15Certificates (CB4_3_1I1R15CertificateIndex a)).input +lemma CB4_3_1I1R15P_check : ∀ a : Fin 6, contains (CB4_3_1I1R15Raw a) (CB4_3_1I1R15P a) = true := by + decide +kernel +lemma CB4_3_1I1R15P_sound (a : Fin 6) : + (CB4_3_1I1R15P a).Encloses (CB4_3_1I1R15Value a) := + contains_sound (CB4_3_1I1R15Raw_sound a) (CB4_3_1I1R15P_check a) +def CB4_3_1I1R15Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB4_3_1I1R15Certificates (CB4_3_1I1R15CertificateIndex a)).output +lemma CB4_3_1I1R15Terms_sound (a : Fin 6) : + (CB4_3_1I1R15Terms a).Encloses (Foundation.entropyTerm (CB4_3_1I1R15Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB4_3_1I1R15Certificates_valid + (CB4_3_1I1R15CertificateIndex a) (CB4_3_1I1R15P_sound a) +def CB4_3_1I1R15Entropy : Ball := ⟨0, 0⟩ +lemma CB4_3_1I1R15Entropy_sound : CB4_3_1I1R15Entropy.Encloses (Foundation.finiteEntropy CB4_3_1I1R15Value) := by + exact contains_sound (entropyFin_enclosed 6 CB4_3_1I1R15Value CB4_3_1I1R15Terms CB4_3_1I1R15Terms_sound) (by decide +kernel) +def CB4_3_1I1R15Mass : Ball := ⟨0, 0⟩ +lemma CB4_3_1I1R15Mass_sound : CB4_3_1I1R15Mass.Encloses (∑ a, CB4_3_1I1R15Value a) := by + exact contains_sound (finSumBall_sound 6 CB4_3_1I1R15P CB4_3_1I1R15Value CB4_3_1I1R15P_sound) (by decide +kernel) +def CB4_3_1I1R15MassTerm : Ball := .exact 0 +lemma CB4_3_1I1R15MassTerm_sound : CB4_3_1I1R15MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB4_3_1I1R15Value a))) := + entropyTerm_zero_ball (CB4_3_1I1R15Mass_sound) +def CB4_3_1I1R15H : Ball := ⟨0, 0⟩ +lemma CB4_3_1I1R15H_sound : CB4_3_1I1R15H.Encloses (homogeneousEntropy CB4_3_1I1R15Value) := by + exact contains_sound (homogeneous_enclosed CB4_3_1I1R15Value CB4_3_1I1R15MassTerm_sound CB4_3_1I1R15Entropy_sound) (by decide +kernel) +def CB4_3_1I1R16Value (a : Fin 6) : ℝ := residualLaw (below (shape 4 3 1)) (fun u => (stageBLaw (shape 4 3 1) u : ℝ)) (stageBPriority (shape 4 3 1)) 1 (fun u a => (littleLaw (shape 4 3 1) u ((stageBPriority (shape 4 3 1)) 1) a : ℝ)) 16 a +def CB4_3_1I1R16Raw (a : Fin 6) : Ball := residualBall (below (shape 4 3 1)) B4_3_1Law (stageBPriority (shape 4 3 1)) 1 (fun u => B4_3_1Little u ((stageBPriority (shape 4 3 1)) 1)) 16 a +lemma CB4_3_1I1R16Raw_sound (a : Fin 6) : + (CB4_3_1I1R16Raw a).Encloses (CB4_3_1I1R16Value a) := by + exact residualBall_sound_on (below (shape 4 3 1)) B4_3_1Law (fun u => (stageBLaw (shape 4 3 1) u : ℝ)) (stageBPriority (shape 4 3 1)) 1 (fun u => B4_3_1Little u ((stageBPriority (shape 4 3 1)) 1)) (fun u a => (littleLaw (shape 4 3 1) u ((stageBPriority (shape 4 3 1)) 1) a : ℝ)) (fun u _ => B4_3_1Law_sound u) (fun u _ a => B4_3_1Little_sound u ((stageBPriority (shape 4 3 1)) 1) a) 16 a +def CB4_3_1I1R16Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB4_3_1I1R16Certificates_valid : + CB4_3_1I1R16Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB4_3_1I1R16CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB4_3_1I1R16P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB4_3_1I1R16Certificates (CB4_3_1I1R16CertificateIndex a)).input +lemma CB4_3_1I1R16P_check : ∀ a : Fin 6, contains (CB4_3_1I1R16Raw a) (CB4_3_1I1R16P a) = true := by + decide +kernel +lemma CB4_3_1I1R16P_sound (a : Fin 6) : + (CB4_3_1I1R16P a).Encloses (CB4_3_1I1R16Value a) := + contains_sound (CB4_3_1I1R16Raw_sound a) (CB4_3_1I1R16P_check a) +def CB4_3_1I1R16Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB4_3_1I1R16Certificates (CB4_3_1I1R16CertificateIndex a)).output +lemma CB4_3_1I1R16Terms_sound (a : Fin 6) : + (CB4_3_1I1R16Terms a).Encloses (Foundation.entropyTerm (CB4_3_1I1R16Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB4_3_1I1R16Certificates_valid + (CB4_3_1I1R16CertificateIndex a) (CB4_3_1I1R16P_sound a) +def CB4_3_1I1R16Entropy : Ball := ⟨0, 0⟩ +lemma CB4_3_1I1R16Entropy_sound : CB4_3_1I1R16Entropy.Encloses (Foundation.finiteEntropy CB4_3_1I1R16Value) := by + exact contains_sound (entropyFin_enclosed 6 CB4_3_1I1R16Value CB4_3_1I1R16Terms CB4_3_1I1R16Terms_sound) (by decide +kernel) +def CB4_3_1I1R16Mass : Ball := ⟨0, 0⟩ +lemma CB4_3_1I1R16Mass_sound : CB4_3_1I1R16Mass.Encloses (∑ a, CB4_3_1I1R16Value a) := by + exact contains_sound (finSumBall_sound 6 CB4_3_1I1R16P CB4_3_1I1R16Value CB4_3_1I1R16P_sound) (by decide +kernel) +def CB4_3_1I1R16MassTerm : Ball := .exact 0 +lemma CB4_3_1I1R16MassTerm_sound : CB4_3_1I1R16MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB4_3_1I1R16Value a))) := + entropyTerm_zero_ball (CB4_3_1I1R16Mass_sound) +def CB4_3_1I1R16H : Ball := ⟨0, 0⟩ +lemma CB4_3_1I1R16H_sound : CB4_3_1I1R16H.Encloses (homogeneousEntropy CB4_3_1I1R16Value) := by + exact contains_sound (homogeneous_enclosed CB4_3_1I1R16Value CB4_3_1I1R16MassTerm_sound CB4_3_1I1R16Entropy_sound) (by decide +kernel) +def CB4_3_1I1ResidualEntropies (a : Fin 17) : Ball := + match a.val with + | 0 => CB4_3_1I1R0H + | 1 => CB4_3_1I1R1H + | 2 => CB4_3_1I1R2H + | 3 => CB4_3_1I1R3H + | 4 => CB4_3_1I1R4H + | 5 => CB4_3_1I1R5H + | 6 => CB4_3_1I1R6H + | 7 => CB4_3_1I1R7H + | 8 => CB4_3_1I1R8H + | 9 => CB4_3_1I1R9H + | 10 => CB4_3_1I1R10H + | 11 => CB4_3_1I1R11H + | 12 => CB4_3_1I1R12H + | 13 => CB4_3_1I1R13H + | 14 => CB4_3_1I1R14H + | 15 => CB4_3_1I1R15H + | 16 => CB4_3_1I1R16H + | _ => (.exact 0) +lemma CB4_3_1I1ResidualEntropies_sound (k : Fin 17) : + (CB4_3_1I1ResidualEntropies k).Encloses (homogeneousEntropy + (residualLaw (below (shape 4 3 1)) (fun u => (stageBLaw (shape 4 3 1) u : ℝ)) (stageBPriority (shape 4 3 1)) 1 (fun u a => (littleLaw (shape 4 3 1) u ((stageBPriority (shape 4 3 1)) 1) a : ℝ)) k)) := by + fin_cases k + · exact CB4_3_1I1R0H_sound + · exact CB4_3_1I1R1H_sound + · exact CB4_3_1I1R2H_sound + · exact CB4_3_1I1R3H_sound + · exact CB4_3_1I1R4H_sound + · exact CB4_3_1I1R5H_sound + · exact CB4_3_1I1R6H_sound + · exact CB4_3_1I1R7H_sound + · exact CB4_3_1I1R8H_sound + · exact CB4_3_1I1R9H_sound + · exact CB4_3_1I1R10H_sound + · exact CB4_3_1I1R11H_sound + · exact CB4_3_1I1R12H_sound + · exact CB4_3_1I1R13H_sound + · exact CB4_3_1I1R14H_sound + · exact CB4_3_1I1R15H_sound + · exact CB4_3_1I1R16H_sound +def CB4_3_1I1S0_3_1Value (a : Fin 6) : ℝ := (littleLaw (shape 4 3 1) (shape 0 3 1) ((stageBPriority (shape 4 3 1)) 1) a : ℝ) +def CB4_3_1I1S0_3_1E_4Log : Ball := .exact 0 +lemma CB4_3_1I1S0_3_1E_4Log_sound : CB4_3_1I1S0_3_1E_4Log.Encloses (Real.log (CB4_3_1I1S0_3_1Value (4 : Fin 6))) := by + exact log_exact_one_ball ((B4_3_1Little_sound (shape 0 3 1) ((stageBPriority (shape 4 3 1)) 1)) (4 : Fin 6)) +def CB4_3_1I1S0_3_1E_4 : Ball := ⟨0, 0⟩ +lemma CB4_3_1I1S0_3_1E_4_sound : CB4_3_1I1S0_3_1E_4.Encloses (Foundation.entropyTerm (CB4_3_1I1S0_3_1Value (4 : Fin 6))) := by + exact contains_sound (entropyTerm_ball ((B4_3_1Little_sound (shape 0 3 1) ((stageBPriority (shape 4 3 1)) 1)) (4 : Fin 6)) CB4_3_1I1S0_3_1E_4Log_sound) (by decide +kernel) +def CB4_3_1I1S0_3_1Terms (a : Fin 6) : Ball := + match a.val with + | 4 => ⟨0, 0⟩ + | _ => (.exact 0) +lemma CB4_3_1I1S0_3_1Terms_sound (a : Fin 6) : + (CB4_3_1I1S0_3_1Terms a).Encloses (Foundation.entropyTerm (CB4_3_1I1S0_3_1Value a)) := by + fin_cases a + · exact (entropyTerm_zero_ball ((B4_3_1Little_sound (shape 0 3 1) ((stageBPriority (shape 4 3 1)) 1)) (0 : Fin 6))) + · exact (entropyTerm_zero_ball ((B4_3_1Little_sound (shape 0 3 1) ((stageBPriority (shape 4 3 1)) 1)) (1 : Fin 6))) + · exact (entropyTerm_zero_ball ((B4_3_1Little_sound (shape 0 3 1) ((stageBPriority (shape 4 3 1)) 1)) (2 : Fin 6))) + · exact (entropyTerm_zero_ball ((B4_3_1Little_sound (shape 0 3 1) ((stageBPriority (shape 4 3 1)) 1)) (3 : Fin 6))) + · exact CB4_3_1I1S0_3_1E_4_sound + · exact (entropyTerm_zero_ball ((B4_3_1Little_sound (shape 0 3 1) ((stageBPriority (shape 4 3 1)) 1)) (5 : Fin 6))) +def CB4_3_1I1S0_3_1Entropy : Ball := ⟨0, 0⟩ +lemma CB4_3_1I1S0_3_1Entropy_sound : CB4_3_1I1S0_3_1Entropy.Encloses (Foundation.finiteEntropy CB4_3_1I1S0_3_1Value) := by + exact contains_sound (entropyFin_enclosed 6 CB4_3_1I1S0_3_1Value CB4_3_1I1S0_3_1Terms CB4_3_1I1S0_3_1Terms_sound) (by decide +kernel) +def CB4_3_1I1S0_3_1Mass : Ball := ⟨1, 0⟩ +lemma CB4_3_1I1S0_3_1Mass_sound : CB4_3_1I1S0_3_1Mass.Encloses (∑ a, CB4_3_1I1S0_3_1Value a) := by + exact contains_sound (finSumBall_sound 6 (B4_3_1Little (shape 0 3 1) ((stageBPriority (shape 4 3 1)) 1)) CB4_3_1I1S0_3_1Value (B4_3_1Little_sound (shape 0 3 1) ((stageBPriority (shape 4 3 1)) 1))) (by decide +kernel) +def CB4_3_1I1S0_3_1MassTermLog : Ball := .exact 0 +lemma CB4_3_1I1S0_3_1MassTermLog_sound : CB4_3_1I1S0_3_1MassTermLog.Encloses (Real.log ((∑ a, CB4_3_1I1S0_3_1Value a))) := by + exact log_exact_one_ball (CB4_3_1I1S0_3_1Mass_sound) +def CB4_3_1I1S0_3_1MassTerm : Ball := ⟨0, 0⟩ +lemma CB4_3_1I1S0_3_1MassTerm_sound : CB4_3_1I1S0_3_1MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB4_3_1I1S0_3_1Value a))) := by + exact contains_sound (entropyTerm_ball (CB4_3_1I1S0_3_1Mass_sound) CB4_3_1I1S0_3_1MassTermLog_sound) (by decide +kernel) +def CB4_3_1I1S0_3_1H : Ball := ⟨0, 0⟩ +lemma CB4_3_1I1S0_3_1H_sound : CB4_3_1I1S0_3_1H.Encloses (homogeneousEntropy CB4_3_1I1S0_3_1Value) := by + exact contains_sound (homogeneous_enclosed CB4_3_1I1S0_3_1Value CB4_3_1I1S0_3_1MassTerm_sound CB4_3_1I1S0_3_1Entropy_sound) (by decide +kernel) +def CB4_3_1I1Singles (s : Shape) : Ball := + match s 0, s 1, s 2 with + | 0, 3, 1 => CB4_3_1I1S0_3_1H + | _, _, _ => (.exact 0) +lemma CB4_3_1I1Singles_sound (u : Shape) (hu : u ∈ below (shape 4 3 1)) + (hd : designated (stageBPriority (shape 4 3 1)) 1 u) : + (CB4_3_1I1Singles u).Encloses (homogeneousEntropy ((fun u a => (littleLaw (shape 4 3 1) u ((stageBPriority (shape 4 3 1)) 1) a : ℝ)) u)) := by + rw [B4_3_1_below] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl + · exact CB4_3_1I1S0_3_1H_sound + · exact (show ¬ designated (stageBPriority (shape 4 3 1)) 1 (shape 1 2 1) by decide +kernel) hd |>.elim + · exact (show ¬ designated (stageBPriority (shape 4 3 1)) 1 (shape 1 3 0) by decide +kernel) hd |>.elim + · exact (show ¬ designated (stageBPriority (shape 4 3 1)) 1 (shape 2 1 1) by decide +kernel) hd |>.elim + · exact (show ¬ designated (stageBPriority (shape 4 3 1)) 1 (shape 2 2 0) by decide +kernel) hd |>.elim + · exact (show ¬ designated (stageBPriority (shape 4 3 1)) 1 (shape 3 0 1) by decide +kernel) hd |>.elim + · exact (show ¬ designated (stageBPriority (shape 4 3 1)) 1 (shape 3 1 0) by decide +kernel) hd |>.elim + · exact (show ¬ designated (stageBPriority (shape 4 3 1)) 1 (shape 4 0 0) by decide +kernel) hd |>.elim +def CB4_3_1I1Singleton : Ball := ⟨0, 0⟩ +lemma CB4_3_1I1Singleton_sound : CB4_3_1I1Singleton.Encloses + (singletonEntropy (below (shape 4 3 1)) (fun u => (stageBLaw (shape 4 3 1) u : ℝ)) (stageBPriority (shape 4 3 1)) 1 (fun u a => (littleLaw (shape 4 3 1) u ((stageBPriority (shape 4 3 1)) 1) a : ℝ))) := by + exact contains_sound (singletonBall_sound (below (shape 4 3 1)) B4_3_1Law (fun u => (stageBLaw (shape 4 3 1) u : ℝ)) (stageBPriority (shape 4 3 1)) 1 + CB4_3_1I1Singles (fun u a => (littleLaw (shape 4 3 1) u ((stageBPriority (shape 4 3 1)) 1) a : ℝ)) (fun u _ => B4_3_1Law_sound u) CB4_3_1I1Singles_sound) (by decide +kernel) +def CB4_3_1I1Group : Ball := ⟨(2917405570139503730793260650103 / 20000000000000000000000000000000), (135307097319 / 100000000000000000000000000000000)⟩ +lemma CB4_3_1I1Group_sound : CB4_3_1I1Group.Encloses + (groupedEntropy (below (shape 4 3 1)) (fun u => (stageBLaw (shape 4 3 1) u : ℝ)) (stageBPriority (shape 4 3 1)) 1 (fun u a => (littleLaw (shape 4 3 1) u ((stageBPriority (shape 4 3 1)) 1) a : ℝ))) := by + exact contains_sound (Ball.add_sound CB4_3_1I1Singleton_sound + (finSumBall_sound 17 CB4_3_1I1ResidualEntropies _ CB4_3_1I1ResidualEntropies_sound)) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CB4_3_1I1H : Ball := ⟨(1019569187696828535959852786143 / 1250000000000000000000000000000), (363617711883 / 100000000000000000000000000000000)⟩ +lemma CB4_3_1I1_sound : CB4_3_1I1H.Encloses (stageBCapacity (shape 4 3 1) 1) := by + have hb := contains_sound (Ball.add_sound CB4_3_1I1PairH_sound + (Ball.neg_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) CB4_3_1I1Group_sound))) + (show contains (.add CB4_3_1I1PairH (.neg (.mul (.exact 2) CB4_3_1I1Group))) CB4_3_1I1H = true by decide +kernel) + unfold CB4_3_1I1PairValue at hb + simpa only [stageBCapacity, nativeCapacity, + show (1 : Fin 3) ≠ 0 by decide, ite_false, sub_eq_add_neg] using hb + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/CapacityB/CapB4_3_1I2.lean b/lean/OAI/LinearAlgebra/MatrixFields/CapacityB/CapB4_3_1I2.lean new file mode 100644 index 0000000000000000000000000000000000000000..5486add99c05fdd1bec96e032bd853e498a85a25 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/CapacityB/CapB4_3_1I2.lean @@ -0,0 +1,1041 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Certificates.Terminal4_3_1 + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CB4_3_1I2PairValue (a : PairSlot) : ℝ := pairLaw (below (shape 4 3 1)) (shape 4 3 1) (fun u => (stageBLaw (shape 4 3 1) u : ℝ)) (fun u a => (littleLaw (shape 4 3 1) u ((stageBPriority (shape 4 3 1)) 2) a : ℝ)) a +def CB4_3_1I2PairRaw (a : PairSlot) : Ball := pairLawBall (below (shape 4 3 1)) (shape 4 3 1) B4_3_1Law (fun u => B4_3_1Little u ((stageBPriority (shape 4 3 1)) 2)) a +lemma CB4_3_1I2PairRaw_sound (a : PairSlot) : + (CB4_3_1I2PairRaw a).Encloses (CB4_3_1I2PairValue a) := by + exact pairLawBall_sound_on (below (shape 4 3 1)) (shape 4 3 1) B4_3_1Law (fun u => (stageBLaw (shape 4 3 1) u : ℝ)) (fun u => B4_3_1Little u ((stageBPriority (shape 4 3 1)) 2)) (fun u a => (littleLaw (shape 4 3 1) u ((stageBPriority (shape 4 3 1)) 2) a : ℝ)) (fun u _ => B4_3_1Law_sound u) (fun u _ a => B4_3_1Little_sound u ((stageBPriority (shape 4 3 1)) 2) a) (fun u _ a => B4_3_1Little_sound (complement (shape 4 3 1) u) ((stageBPriority (shape 4 3 1)) 2) a) a +def CB4_3_1I2PairCertificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(33445776876645910225502339149 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(66916637569092300013809787887 / 25000000000000000000000000000000), (46035727 / 50000000000000000000000000000000)⟩ ⟨(-160059998763713561144352850920053 / 20000000000000000000000000000000), (68821427717 / 25000000000000000000000000000000)⟩ ⟨-12, 33445776876645910225502339149, 24414062500000000000000000000⟩, + .log ⟨(7861396357689534306132328191817 / 100000000000000000000000000000000), (17 / 100000000000000000000000000000000)⟩ ⟨(999657496337087923571046141681 / 5000000000000000000000000000000), (416178861 / 5000000000000000000000000000000)⟩ ⟨(-254320594167544918853353365611073 / 100000000000000000000000000000000), (10587911863 / 10000000000000000000000000000000)⟩ ⟨-4, 7861396357689534306132328191817, 6250000000000000000000000000000⟩, + .log ⟨(1517934657342094088384406991891 / 2000000000000000000000000000000), (3 / 12500000000000000000000000000000)⟩ ⟨(261650711370711363939136650333 / 1250000000000000000000000000000), (32143516697 / 100000000000000000000000000000000)⟩ ⟨(-13789827387108331031511443051951 / 50000000000000000000000000000000), (42351647397 / 100000000000000000000000000000000)⟩ ⟨-1, 1517934657342094088384406991891, 1000000000000000000000000000000⟩, + .log ⟨(4144793288664198085105361786561 / 100000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ ⟨(13194192050951886106583167249909 / 100000000000000000000000000000000), (2633082361 / 50000000000000000000000000000000)⟩ ⟨(-318331726868921065296730018238409 / 100000000000000000000000000000000), (63527471073 / 50000000000000000000000000000000)⟩ ⟨-5, 4144793288664198085105361786561, 3125000000000000000000000000000⟩, + .log ⟨(23996286434538977853265770399 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(100004840208826547166857491469 / 50000000000000000000000000000000), (71139769 / 100000000000000000000000000000000)⟩ ⟨(-833502637848870660423137584477063 / 100000000000000000000000000000000), (296461535729 / 100000000000000000000000000000000)⟩ ⟨-13, 23996286434538977853265770399, 12207031250000000000000000000⟩] +lemma CB4_3_1I2PairCertificates_valid : + CB4_3_1I2PairCertificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB4_3_1I2PairCertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 0, 5 => 1 + | 1, 4 => 2 + | 2, 2 => 3 + | 2, 3 => 4 + | 3, 2 => 4 + | 3, 3 => 5 + | 4, 1 => 2 + | 5, 0 => 1 + | _, _ => 0 +def CB4_3_1I2PairP (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CB4_3_1I2PairCertificates (CB4_3_1I2PairCertificateIndex a)).input +lemma CB4_3_1I2PairP_check : ∀ a : PairSlot, contains (CB4_3_1I2PairRaw a) (CB4_3_1I2PairP a) = true := by + decide +kernel +lemma CB4_3_1I2PairP_sound (a : PairSlot) : + (CB4_3_1I2PairP a).Encloses (CB4_3_1I2PairValue a) := + contains_sound (CB4_3_1I2PairRaw_sound a) (CB4_3_1I2PairP_check a) +def CB4_3_1I2PairTerms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CB4_3_1I2PairCertificates (CB4_3_1I2PairCertificateIndex a)).output +lemma CB4_3_1I2PairTerms_sound (a : PairSlot) : + (CB4_3_1I2PairTerms a).Encloses (Foundation.entropyTerm (CB4_3_1I2PairValue a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB4_3_1I2PairCertificates_valid + (CB4_3_1I2PairCertificateIndex a) (CB4_3_1I2PairP_sound a) +def CB4_3_1I2PairEntropy : Ball := ⟨(22010520911503647441395826369933 / 25000000000000000000000000000000), (29789141629 / 50000000000000000000000000000000)⟩ +lemma CB4_3_1I2PairEntropy_sound : CB4_3_1I2PairEntropy.Encloses (Foundation.finiteEntropy CB4_3_1I2PairValue) := by + exact contains_sound (entropyPair_enclosed CB4_3_1I2PairValue CB4_3_1I2PairTerms CB4_3_1I2PairTerms_sound) (by decide +kernel) +def CB4_3_1I2PairMass : Ball := ⟨(100000000000000000000000000000003 / 100000000000000000000000000000000), (13 / 20000000000000000000000000000000)⟩ +lemma CB4_3_1I2PairMass_sound : CB4_3_1I2PairMass.Encloses (∑ a, CB4_3_1I2PairValue a) := by + exact contains_sound (pairSumBall_sound CB4_3_1I2PairP CB4_3_1I2PairValue CB4_3_1I2PairP_sound) (by decide +kernel) +def CB4_3_1I2PairMassTermLogWitness : LogWitness := ⟨0, 100000000000000000000000000000003, 100000000000000000000000000000000⟩ +def CB4_3_1I2PairMassTermLog : Ball := ⟨(3 / 100000000000000000000000000000000), (21175823747 / 100000000000000000000000000000000)⟩ +lemma CB4_3_1I2PairMassTermLog_sound : CB4_3_1I2PairMassTermLog.Encloses (Real.log ((∑ a, CB4_3_1I2PairValue a))) := by + exact checkLog_sound logTwoBall_sound (CB4_3_1I2PairMass_sound) (w := CB4_3_1I2PairMassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB4_3_1I2PairMassTerm : Ball := ⟨(-3 / 100000000000000000000000000000000), (5293955937 / 25000000000000000000000000000000)⟩ +lemma CB4_3_1I2PairMassTerm_sound : CB4_3_1I2PairMassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB4_3_1I2PairValue a))) := by + exact contains_sound (entropyTerm_ball (CB4_3_1I2PairMass_sound) CB4_3_1I2PairMassTermLog_sound) (by decide +kernel) +def CB4_3_1I2PairH : Ball := ⟨(17608416729202917953116661095947 / 20000000000000000000000000000000), (40377053503 / 50000000000000000000000000000000)⟩ +lemma CB4_3_1I2PairH_sound : CB4_3_1I2PairH.Encloses (homogeneousEntropy CB4_3_1I2PairValue) := by + exact contains_sound (homogeneous_enclosed CB4_3_1I2PairValue CB4_3_1I2PairMassTerm_sound CB4_3_1I2PairEntropy_sound) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CB4_3_1I2R0Value (a : Fin 6) : ℝ := residualLaw (below (shape 4 3 1)) (fun u => (stageBLaw (shape 4 3 1) u : ℝ)) (stageBPriority (shape 4 3 1)) 2 (fun u a => (littleLaw (shape 4 3 1) u ((stageBPriority (shape 4 3 1)) 2) a : ℝ)) 0 a +def CB4_3_1I2R0Raw (a : Fin 6) : Ball := residualBall (below (shape 4 3 1)) B4_3_1Law (stageBPriority (shape 4 3 1)) 2 (fun u => B4_3_1Little u ((stageBPriority (shape 4 3 1)) 2)) 0 a +lemma CB4_3_1I2R0Raw_sound (a : Fin 6) : + (CB4_3_1I2R0Raw a).Encloses (CB4_3_1I2R0Value a) := by + exact residualBall_sound_on (below (shape 4 3 1)) B4_3_1Law (fun u => (stageBLaw (shape 4 3 1) u : ℝ)) (stageBPriority (shape 4 3 1)) 2 (fun u => B4_3_1Little u ((stageBPriority (shape 4 3 1)) 2)) (fun u a => (littleLaw (shape 4 3 1) u ((stageBPriority (shape 4 3 1)) 2) a : ℝ)) (fun u _ => B4_3_1Law_sound u) (fun u _ a => B4_3_1Little_sound u ((stageBPriority (shape 4 3 1)) 2) a) 0 a +def CB4_3_1I2R0Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(33445776876645910225502339149 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(66916637569092300013809787887 / 25000000000000000000000000000000), (46035727 / 50000000000000000000000000000000)⟩ ⟨(-160059998763713561144352850920053 / 20000000000000000000000000000000), (68821427717 / 25000000000000000000000000000000)⟩ ⟨-12, 33445776876645910225502339149, 24414062500000000000000000000⟩] +lemma CB4_3_1I2R0Certificates_valid : + CB4_3_1I2R0Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB4_3_1I2R0CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | 0 => 1 + | _ => 0 +def CB4_3_1I2R0P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB4_3_1I2R0Certificates (CB4_3_1I2R0CertificateIndex a)).input +lemma CB4_3_1I2R0P_check : ∀ a : Fin 6, contains (CB4_3_1I2R0Raw a) (CB4_3_1I2R0P a) = true := by + decide +kernel +lemma CB4_3_1I2R0P_sound (a : Fin 6) : + (CB4_3_1I2R0P a).Encloses (CB4_3_1I2R0Value a) := + contains_sound (CB4_3_1I2R0Raw_sound a) (CB4_3_1I2R0P_check a) +def CB4_3_1I2R0Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB4_3_1I2R0Certificates (CB4_3_1I2R0CertificateIndex a)).output +lemma CB4_3_1I2R0Terms_sound (a : Fin 6) : + (CB4_3_1I2R0Terms a).Encloses (Foundation.entropyTerm (CB4_3_1I2R0Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB4_3_1I2R0Certificates_valid + (CB4_3_1I2R0CertificateIndex a) (CB4_3_1I2R0P_sound a) +def CB4_3_1I2R0Entropy : Ball := ⟨(66916637569092300013809787887 / 25000000000000000000000000000000), (46035727 / 50000000000000000000000000000000)⟩ +lemma CB4_3_1I2R0Entropy_sound : CB4_3_1I2R0Entropy.Encloses (Foundation.finiteEntropy CB4_3_1I2R0Value) := by + exact contains_sound (entropyFin_enclosed 6 CB4_3_1I2R0Value CB4_3_1I2R0Terms CB4_3_1I2R0Terms_sound) (by decide +kernel) +def CB4_3_1I2R0Mass : Ball := ⟨(33445776876645910225502339149 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ +lemma CB4_3_1I2R0Mass_sound : CB4_3_1I2R0Mass.Encloses (∑ a, CB4_3_1I2R0Value a) := by + exact contains_sound (finSumBall_sound 6 CB4_3_1I2R0P CB4_3_1I2R0Value CB4_3_1I2R0P_sound) (by decide +kernel) +def CB4_3_1I2R0MassTermLogWitness : LogWitness := ⟨-12, 33445776876645910225502339149, 24414062500000000000000000000⟩ +def CB4_3_1I2R0MassTermLog : Ball := ⟨(-160059998763713561144352850920053 / 20000000000000000000000000000000), (68821427717 / 25000000000000000000000000000000)⟩ +lemma CB4_3_1I2R0MassTermLog_sound : CB4_3_1I2R0MassTermLog.Encloses (Real.log ((∑ a, CB4_3_1I2R0Value a))) := by + exact checkLog_sound logTwoBall_sound (CB4_3_1I2R0Mass_sound) (w := CB4_3_1I2R0MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB4_3_1I2R0MassTerm : Ball := ⟨(66916637569092300013809787887 / 25000000000000000000000000000000), (46035727 / 50000000000000000000000000000000)⟩ +lemma CB4_3_1I2R0MassTerm_sound : CB4_3_1I2R0MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB4_3_1I2R0Value a))) := by + exact contains_sound (entropyTerm_ball (CB4_3_1I2R0Mass_sound) CB4_3_1I2R0MassTermLog_sound) (by decide +kernel) +def CB4_3_1I2R0H : Ball := ⟨0, (46035727 / 25000000000000000000000000000000)⟩ +lemma CB4_3_1I2R0H_sound : CB4_3_1I2R0H.Encloses (homogeneousEntropy CB4_3_1I2R0Value) := by + exact contains_sound (homogeneous_enclosed CB4_3_1I2R0Value CB4_3_1I2R0MassTerm_sound CB4_3_1I2R0Entropy_sound) (by decide +kernel) +def CB4_3_1I2R1Value (a : Fin 6) : ℝ := residualLaw (below (shape 4 3 1)) (fun u => (stageBLaw (shape 4 3 1) u : ℝ)) (stageBPriority (shape 4 3 1)) 2 (fun u a => (littleLaw (shape 4 3 1) u ((stageBPriority (shape 4 3 1)) 2) a : ℝ)) 1 a +def CB4_3_1I2R1Raw (a : Fin 6) : Ball := residualBall (below (shape 4 3 1)) B4_3_1Law (stageBPriority (shape 4 3 1)) 2 (fun u => B4_3_1Little u ((stageBPriority (shape 4 3 1)) 2)) 1 a +lemma CB4_3_1I2R1Raw_sound (a : Fin 6) : + (CB4_3_1I2R1Raw a).Encloses (CB4_3_1I2R1Value a) := by + exact residualBall_sound_on (below (shape 4 3 1)) B4_3_1Law (fun u => (stageBLaw (shape 4 3 1) u : ℝ)) (stageBPriority (shape 4 3 1)) 2 (fun u => B4_3_1Little u ((stageBPriority (shape 4 3 1)) 2)) (fun u a => (littleLaw (shape 4 3 1) u ((stageBPriority (shape 4 3 1)) 2) a : ℝ)) (fun u _ => B4_3_1Law_sound u) (fun u _ a => B4_3_1Little_sound u ((stageBPriority (shape 4 3 1)) 2) a) 1 a +def CB4_3_1I2R1Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(205241969884719280749621373729 / 3125000000000000000000000000000), (3 / 25000000000000000000000000000000)⟩ ⟨(17883963881894316763402895444343 / 100000000000000000000000000000000), (869233559 / 12500000000000000000000000000000)⟩ ⟨(-13614999690928390286088220368213 / 5000000000000000000000000000000), (105879118597 / 100000000000000000000000000000000)⟩ ⟨-4, 205241969884719280749621373729, 195312500000000000000000000000⟩] +lemma CB4_3_1I2R1Certificates_valid : + CB4_3_1I2R1Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB4_3_1I2R1CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | 1 => 1 + | _ => 0 +def CB4_3_1I2R1P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB4_3_1I2R1Certificates (CB4_3_1I2R1CertificateIndex a)).input +lemma CB4_3_1I2R1P_check : ∀ a : Fin 6, contains (CB4_3_1I2R1Raw a) (CB4_3_1I2R1P a) = true := by + decide +kernel +lemma CB4_3_1I2R1P_sound (a : Fin 6) : + (CB4_3_1I2R1P a).Encloses (CB4_3_1I2R1Value a) := + contains_sound (CB4_3_1I2R1Raw_sound a) (CB4_3_1I2R1P_check a) +def CB4_3_1I2R1Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB4_3_1I2R1Certificates (CB4_3_1I2R1CertificateIndex a)).output +lemma CB4_3_1I2R1Terms_sound (a : Fin 6) : + (CB4_3_1I2R1Terms a).Encloses (Foundation.entropyTerm (CB4_3_1I2R1Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB4_3_1I2R1Certificates_valid + (CB4_3_1I2R1CertificateIndex a) (CB4_3_1I2R1P_sound a) +def CB4_3_1I2R1Entropy : Ball := ⟨(17883963881894316763402895444343 / 100000000000000000000000000000000), (869233559 / 12500000000000000000000000000000)⟩ +lemma CB4_3_1I2R1Entropy_sound : CB4_3_1I2R1Entropy.Encloses (Foundation.finiteEntropy CB4_3_1I2R1Value) := by + exact contains_sound (entropyFin_enclosed 6 CB4_3_1I2R1Value CB4_3_1I2R1Terms CB4_3_1I2R1Terms_sound) (by decide +kernel) +def CB4_3_1I2R1Mass : Ball := ⟨(205241969884719280749621373729 / 3125000000000000000000000000000), (3 / 25000000000000000000000000000000)⟩ +lemma CB4_3_1I2R1Mass_sound : CB4_3_1I2R1Mass.Encloses (∑ a, CB4_3_1I2R1Value a) := by + exact contains_sound (finSumBall_sound 6 CB4_3_1I2R1P CB4_3_1I2R1Value CB4_3_1I2R1P_sound) (by decide +kernel) +def CB4_3_1I2R1MassTermLogWitness : LogWitness := ⟨-4, 205241969884719280749621373729, 195312500000000000000000000000⟩ +def CB4_3_1I2R1MassTermLog : Ball := ⟨(-13614999690928390286088220368213 / 5000000000000000000000000000000), (105879118597 / 100000000000000000000000000000000)⟩ +lemma CB4_3_1I2R1MassTermLog_sound : CB4_3_1I2R1MassTermLog.Encloses (Real.log ((∑ a, CB4_3_1I2R1Value a))) := by + exact checkLog_sound logTwoBall_sound (CB4_3_1I2R1Mass_sound) (w := CB4_3_1I2R1MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB4_3_1I2R1MassTerm : Ball := ⟨(17883963881894316763402895444343 / 100000000000000000000000000000000), (869233559 / 12500000000000000000000000000000)⟩ +lemma CB4_3_1I2R1MassTerm_sound : CB4_3_1I2R1MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB4_3_1I2R1Value a))) := by + exact contains_sound (entropyTerm_ball (CB4_3_1I2R1Mass_sound) CB4_3_1I2R1MassTermLog_sound) (by decide +kernel) +def CB4_3_1I2R1H : Ball := ⟨0, (869233559 / 6250000000000000000000000000000)⟩ +lemma CB4_3_1I2R1H_sound : CB4_3_1I2R1H.Encloses (homogeneousEntropy CB4_3_1I2R1Value) := by + exact contains_sound (homogeneous_enclosed CB4_3_1I2R1Value CB4_3_1I2R1MassTerm_sound CB4_3_1I2R1Entropy_sound) (by decide +kernel) +def CB4_3_1I2R2Value (a : Fin 6) : ℝ := residualLaw (below (shape 4 3 1)) (fun u => (stageBLaw (shape 4 3 1) u : ℝ)) (stageBPriority (shape 4 3 1)) 2 (fun u a => (littleLaw (shape 4 3 1) u ((stageBPriority (shape 4 3 1)) 2) a : ℝ)) 2 a +def CB4_3_1I2R2Raw (a : Fin 6) : Ball := residualBall (below (shape 4 3 1)) B4_3_1Law (stageBPriority (shape 4 3 1)) 2 (fun u => B4_3_1Little u ((stageBPriority (shape 4 3 1)) 2)) 2 a +lemma CB4_3_1I2R2Raw_sound (a : Fin 6) : + (CB4_3_1I2R2Raw a).Encloses (CB4_3_1I2R2Value a) := by + exact residualBall_sound_on (below (shape 4 3 1)) B4_3_1Law (fun u => (stageBLaw (shape 4 3 1) u : ℝ)) (stageBPriority (shape 4 3 1)) 2 (fun u => B4_3_1Little u ((stageBPriority (shape 4 3 1)) 2)) (fun u a => (littleLaw (shape 4 3 1) u ((stageBPriority (shape 4 3 1)) 2) a : ℝ)) (fun u _ => B4_3_1Law_sound u) (fun u _ a => B4_3_1Little_sound u ((stageBPriority (shape 4 3 1)) 2) a) 2 a +def CB4_3_1I2R2Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(2099011593102353882017205157611 / 5000000000000000000000000000000), (7 / 50000000000000000000000000000000)⟩ ⟨(36437638457790357055348919873311 / 100000000000000000000000000000000), (26668979669 / 100000000000000000000000000000000)⟩ ⟨(-347188539382341108541610836743 / 400000000000000000000000000000), (31763735541 / 50000000000000000000000000000000)⟩ ⟨-2, 2099011593102353882017205157611, 1250000000000000000000000000000⟩, + .log ⟨(24985200677348428659613263363 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(83515580203663942172171693191 / 10000000000000000000000000000000), (290995221 / 100000000000000000000000000000000)⟩ ⟨(-668520387585913035565075107393799 / 100000000000000000000000000000000), (232934061313 / 100000000000000000000000000000000)⟩ ⟨-10, 24985200677348428659613263363, 19531250000000000000000000000⟩] +lemma CB4_3_1I2R2Certificates_valid : + CB4_3_1I2R2Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB4_3_1I2R2CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | 2 => 1 + | 3 => 2 + | _ => 0 +def CB4_3_1I2R2P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB4_3_1I2R2Certificates (CB4_3_1I2R2CertificateIndex a)).input +lemma CB4_3_1I2R2P_check : ∀ a : Fin 6, contains (CB4_3_1I2R2Raw a) (CB4_3_1I2R2P a) = true := by + decide +kernel +lemma CB4_3_1I2R2P_sound (a : Fin 6) : + (CB4_3_1I2R2P a).Encloses (CB4_3_1I2R2Value a) := + contains_sound (CB4_3_1I2R2Raw_sound a) (CB4_3_1I2R2P_check a) +def CB4_3_1I2R2Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB4_3_1I2R2Certificates (CB4_3_1I2R2CertificateIndex a)).output +lemma CB4_3_1I2R2Terms_sound (a : Fin 6) : + (CB4_3_1I2R2Terms a).Encloses (Foundation.entropyTerm (CB4_3_1I2R2Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB4_3_1I2R2Certificates_valid + (CB4_3_1I2R2CertificateIndex a) (CB4_3_1I2R2P_sound a) +def CB4_3_1I2R2Entropy : Ball := ⟨(37272794259826996477070636805221 / 100000000000000000000000000000000), (2695997489 / 10000000000000000000000000000000)⟩ +lemma CB4_3_1I2R2Entropy_sound : CB4_3_1I2R2Entropy.Encloses (Foundation.finiteEntropy CB4_3_1I2R2Value) := by + exact contains_sound (entropyFin_enclosed 6 CB4_3_1I2R2Value CB4_3_1I2R2Terms CB4_3_1I2R2Terms_sound) (by decide +kernel) +def CB4_3_1I2R2Mass : Ball := ⟨(8421031573086763956728433893807 / 20000000000000000000000000000000), (3 / 20000000000000000000000000000000)⟩ +lemma CB4_3_1I2R2Mass_sound : CB4_3_1I2R2Mass.Encloses (∑ a, CB4_3_1I2R2Value a) := by + exact contains_sound (finSumBall_sound 6 CB4_3_1I2R2P CB4_3_1I2R2Value CB4_3_1I2R2P_sound) (by decide +kernel) +def CB4_3_1I2R2MassTermLogWitness : LogWitness := ⟨-2, 8421031573086763956728433893807, 5000000000000000000000000000000⟩ +def CB4_3_1I2R2MassTermLog : Ball := ⟨(-86499993818567805721764445555273 / 100000000000000000000000000000000), (15881867771 / 25000000000000000000000000000000)⟩ +lemma CB4_3_1I2R2MassTermLog_sound : CB4_3_1I2R2MassTermLog.Encloses (Real.log ((∑ a, CB4_3_1I2R2Value a))) := by + exact checkLog_sound logTwoBall_sound (CB4_3_1I2R2Mass_sound) (w := CB4_3_1I2R2MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB4_3_1I2R2MassTerm : Ball := ⟨(9105239737724617591812405821 / 25000000000000000000000000000), (13374171001 / 50000000000000000000000000000000)⟩ +lemma CB4_3_1I2R2MassTerm_sound : CB4_3_1I2R2MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB4_3_1I2R2Value a))) := by + exact contains_sound (entropyTerm_ball (CB4_3_1I2R2Mass_sound) CB4_3_1I2R2MassTermLog_sound) (by decide +kernel) +def CB4_3_1I2R2H : Ball := ⟨(851835308928526109821013521221 / 100000000000000000000000000000000), (13427079223 / 25000000000000000000000000000000)⟩ +lemma CB4_3_1I2R2H_sound : CB4_3_1I2R2H.Encloses (homogeneousEntropy CB4_3_1I2R2Value) := by + exact contains_sound (homogeneous_enclosed CB4_3_1I2R2Value CB4_3_1I2R2MassTerm_sound CB4_3_1I2R2Entropy_sound) (by decide +kernel) +def CB4_3_1I2R3Value (a : Fin 6) : ℝ := residualLaw (below (shape 4 3 1)) (fun u => (stageBLaw (shape 4 3 1) u : ℝ)) (stageBPriority (shape 4 3 1)) 2 (fun u a => (littleLaw (shape 4 3 1) u ((stageBPriority (shape 4 3 1)) 2) a : ℝ)) 3 a +def CB4_3_1I2R3Raw (a : Fin 6) : Ball := residualBall (below (shape 4 3 1)) B4_3_1Law (stageBPriority (shape 4 3 1)) 2 (fun u => B4_3_1Little u ((stageBPriority (shape 4 3 1)) 2)) 3 a +lemma CB4_3_1I2R3Raw_sound (a : Fin 6) : + (CB4_3_1I2R3Raw a).Encloses (CB4_3_1I2R3Value a) := by + exact residualBall_sound_on (below (shape 4 3 1)) B4_3_1Law (fun u => (stageBLaw (shape 4 3 1) u : ℝ)) (stageBPriority (shape 4 3 1)) 2 (fun u => B4_3_1Little u ((stageBPriority (shape 4 3 1)) 2)) (fun u a => (littleLaw (shape 4 3 1) u ((stageBPriority (shape 4 3 1)) 2) a : ℝ)) (fun u _ => B4_3_1Law_sound u) (fun u _ a => B4_3_1Little_sound u ((stageBPriority (shape 4 3 1)) 2) a) 3 a +def CB4_3_1I2R3Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB4_3_1I2R3Certificates_valid : + CB4_3_1I2R3Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB4_3_1I2R3CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB4_3_1I2R3P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB4_3_1I2R3Certificates (CB4_3_1I2R3CertificateIndex a)).input +lemma CB4_3_1I2R3P_check : ∀ a : Fin 6, contains (CB4_3_1I2R3Raw a) (CB4_3_1I2R3P a) = true := by + decide +kernel +lemma CB4_3_1I2R3P_sound (a : Fin 6) : + (CB4_3_1I2R3P a).Encloses (CB4_3_1I2R3Value a) := + contains_sound (CB4_3_1I2R3Raw_sound a) (CB4_3_1I2R3P_check a) +def CB4_3_1I2R3Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB4_3_1I2R3Certificates (CB4_3_1I2R3CertificateIndex a)).output +lemma CB4_3_1I2R3Terms_sound (a : Fin 6) : + (CB4_3_1I2R3Terms a).Encloses (Foundation.entropyTerm (CB4_3_1I2R3Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB4_3_1I2R3Certificates_valid + (CB4_3_1I2R3CertificateIndex a) (CB4_3_1I2R3P_sound a) +def CB4_3_1I2R3Entropy : Ball := ⟨0, 0⟩ +lemma CB4_3_1I2R3Entropy_sound : CB4_3_1I2R3Entropy.Encloses (Foundation.finiteEntropy CB4_3_1I2R3Value) := by + exact contains_sound (entropyFin_enclosed 6 CB4_3_1I2R3Value CB4_3_1I2R3Terms CB4_3_1I2R3Terms_sound) (by decide +kernel) +def CB4_3_1I2R3Mass : Ball := ⟨0, 0⟩ +lemma CB4_3_1I2R3Mass_sound : CB4_3_1I2R3Mass.Encloses (∑ a, CB4_3_1I2R3Value a) := by + exact contains_sound (finSumBall_sound 6 CB4_3_1I2R3P CB4_3_1I2R3Value CB4_3_1I2R3P_sound) (by decide +kernel) +def CB4_3_1I2R3MassTerm : Ball := .exact 0 +lemma CB4_3_1I2R3MassTerm_sound : CB4_3_1I2R3MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB4_3_1I2R3Value a))) := + entropyTerm_zero_ball (CB4_3_1I2R3Mass_sound) +def CB4_3_1I2R3H : Ball := ⟨0, 0⟩ +lemma CB4_3_1I2R3H_sound : CB4_3_1I2R3H.Encloses (homogeneousEntropy CB4_3_1I2R3Value) := by + exact contains_sound (homogeneous_enclosed CB4_3_1I2R3Value CB4_3_1I2R3MassTerm_sound CB4_3_1I2R3Entropy_sound) (by decide +kernel) +def CB4_3_1I2R4Value (a : Fin 6) : ℝ := residualLaw (below (shape 4 3 1)) (fun u => (stageBLaw (shape 4 3 1) u : ℝ)) (stageBPriority (shape 4 3 1)) 2 (fun u a => (littleLaw (shape 4 3 1) u ((stageBPriority (shape 4 3 1)) 2) a : ℝ)) 4 a +def CB4_3_1I2R4Raw (a : Fin 6) : Ball := residualBall (below (shape 4 3 1)) B4_3_1Law (stageBPriority (shape 4 3 1)) 2 (fun u => B4_3_1Little u ((stageBPriority (shape 4 3 1)) 2)) 4 a +lemma CB4_3_1I2R4Raw_sound (a : Fin 6) : + (CB4_3_1I2R4Raw a).Encloses (CB4_3_1I2R4Value a) := by + exact residualBall_sound_on (below (shape 4 3 1)) B4_3_1Law (fun u => (stageBLaw (shape 4 3 1) u : ℝ)) (stageBPriority (shape 4 3 1)) 2 (fun u => B4_3_1Little u ((stageBPriority (shape 4 3 1)) 2)) (fun u a => (littleLaw (shape 4 3 1) u ((stageBPriority (shape 4 3 1)) 2) a : ℝ)) (fun u _ => B4_3_1Law_sound u) (fun u _ a => B4_3_1Little_sound u ((stageBPriority (shape 4 3 1)) 2) a) 4 a +def CB4_3_1I2R4Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB4_3_1I2R4Certificates_valid : + CB4_3_1I2R4Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB4_3_1I2R4CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB4_3_1I2R4P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB4_3_1I2R4Certificates (CB4_3_1I2R4CertificateIndex a)).input +lemma CB4_3_1I2R4P_check : ∀ a : Fin 6, contains (CB4_3_1I2R4Raw a) (CB4_3_1I2R4P a) = true := by + decide +kernel +lemma CB4_3_1I2R4P_sound (a : Fin 6) : + (CB4_3_1I2R4P a).Encloses (CB4_3_1I2R4Value a) := + contains_sound (CB4_3_1I2R4Raw_sound a) (CB4_3_1I2R4P_check a) +def CB4_3_1I2R4Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB4_3_1I2R4Certificates (CB4_3_1I2R4CertificateIndex a)).output +lemma CB4_3_1I2R4Terms_sound (a : Fin 6) : + (CB4_3_1I2R4Terms a).Encloses (Foundation.entropyTerm (CB4_3_1I2R4Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB4_3_1I2R4Certificates_valid + (CB4_3_1I2R4CertificateIndex a) (CB4_3_1I2R4P_sound a) +def CB4_3_1I2R4Entropy : Ball := ⟨0, 0⟩ +lemma CB4_3_1I2R4Entropy_sound : CB4_3_1I2R4Entropy.Encloses (Foundation.finiteEntropy CB4_3_1I2R4Value) := by + exact contains_sound (entropyFin_enclosed 6 CB4_3_1I2R4Value CB4_3_1I2R4Terms CB4_3_1I2R4Terms_sound) (by decide +kernel) +def CB4_3_1I2R4Mass : Ball := ⟨0, 0⟩ +lemma CB4_3_1I2R4Mass_sound : CB4_3_1I2R4Mass.Encloses (∑ a, CB4_3_1I2R4Value a) := by + exact contains_sound (finSumBall_sound 6 CB4_3_1I2R4P CB4_3_1I2R4Value CB4_3_1I2R4P_sound) (by decide +kernel) +def CB4_3_1I2R4MassTerm : Ball := .exact 0 +lemma CB4_3_1I2R4MassTerm_sound : CB4_3_1I2R4MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB4_3_1I2R4Value a))) := + entropyTerm_zero_ball (CB4_3_1I2R4Mass_sound) +def CB4_3_1I2R4H : Ball := ⟨0, 0⟩ +lemma CB4_3_1I2R4H_sound : CB4_3_1I2R4H.Encloses (homogeneousEntropy CB4_3_1I2R4Value) := by + exact contains_sound (homogeneous_enclosed CB4_3_1I2R4Value CB4_3_1I2R4MassTerm_sound CB4_3_1I2R4Entropy_sound) (by decide +kernel) +def CB4_3_1I2R5Value (a : Fin 6) : ℝ := residualLaw (below (shape 4 3 1)) (fun u => (stageBLaw (shape 4 3 1) u : ℝ)) (stageBPriority (shape 4 3 1)) 2 (fun u a => (littleLaw (shape 4 3 1) u ((stageBPriority (shape 4 3 1)) 2) a : ℝ)) 5 a +def CB4_3_1I2R5Raw (a : Fin 6) : Ball := residualBall (below (shape 4 3 1)) B4_3_1Law (stageBPriority (shape 4 3 1)) 2 (fun u => B4_3_1Little u ((stageBPriority (shape 4 3 1)) 2)) 5 a +lemma CB4_3_1I2R5Raw_sound (a : Fin 6) : + (CB4_3_1I2R5Raw a).Encloses (CB4_3_1I2R5Value a) := by + exact residualBall_sound_on (below (shape 4 3 1)) B4_3_1Law (fun u => (stageBLaw (shape 4 3 1) u : ℝ)) (stageBPriority (shape 4 3 1)) 2 (fun u => B4_3_1Little u ((stageBPriority (shape 4 3 1)) 2)) (fun u a => (littleLaw (shape 4 3 1) u ((stageBPriority (shape 4 3 1)) 2) a : ℝ)) (fun u _ => B4_3_1Law_sound u) (fun u _ a => B4_3_1Little_sound u ((stageBPriority (shape 4 3 1)) 2) a) 5 a +def CB4_3_1I2R5Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB4_3_1I2R5Certificates_valid : + CB4_3_1I2R5Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB4_3_1I2R5CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB4_3_1I2R5P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB4_3_1I2R5Certificates (CB4_3_1I2R5CertificateIndex a)).input +lemma CB4_3_1I2R5P_check : ∀ a : Fin 6, contains (CB4_3_1I2R5Raw a) (CB4_3_1I2R5P a) = true := by + decide +kernel +lemma CB4_3_1I2R5P_sound (a : Fin 6) : + (CB4_3_1I2R5P a).Encloses (CB4_3_1I2R5Value a) := + contains_sound (CB4_3_1I2R5Raw_sound a) (CB4_3_1I2R5P_check a) +def CB4_3_1I2R5Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB4_3_1I2R5Certificates (CB4_3_1I2R5CertificateIndex a)).output +lemma CB4_3_1I2R5Terms_sound (a : Fin 6) : + (CB4_3_1I2R5Terms a).Encloses (Foundation.entropyTerm (CB4_3_1I2R5Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB4_3_1I2R5Certificates_valid + (CB4_3_1I2R5CertificateIndex a) (CB4_3_1I2R5P_sound a) +def CB4_3_1I2R5Entropy : Ball := ⟨0, 0⟩ +lemma CB4_3_1I2R5Entropy_sound : CB4_3_1I2R5Entropy.Encloses (Foundation.finiteEntropy CB4_3_1I2R5Value) := by + exact contains_sound (entropyFin_enclosed 6 CB4_3_1I2R5Value CB4_3_1I2R5Terms CB4_3_1I2R5Terms_sound) (by decide +kernel) +def CB4_3_1I2R5Mass : Ball := ⟨0, 0⟩ +lemma CB4_3_1I2R5Mass_sound : CB4_3_1I2R5Mass.Encloses (∑ a, CB4_3_1I2R5Value a) := by + exact contains_sound (finSumBall_sound 6 CB4_3_1I2R5P CB4_3_1I2R5Value CB4_3_1I2R5P_sound) (by decide +kernel) +def CB4_3_1I2R5MassTerm : Ball := .exact 0 +lemma CB4_3_1I2R5MassTerm_sound : CB4_3_1I2R5MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB4_3_1I2R5Value a))) := + entropyTerm_zero_ball (CB4_3_1I2R5Mass_sound) +def CB4_3_1I2R5H : Ball := ⟨0, 0⟩ +lemma CB4_3_1I2R5H_sound : CB4_3_1I2R5H.Encloses (homogeneousEntropy CB4_3_1I2R5Value) := by + exact contains_sound (homogeneous_enclosed CB4_3_1I2R5Value CB4_3_1I2R5MassTerm_sound CB4_3_1I2R5Entropy_sound) (by decide +kernel) +def CB4_3_1I2R6Value (a : Fin 6) : ℝ := residualLaw (below (shape 4 3 1)) (fun u => (stageBLaw (shape 4 3 1) u : ℝ)) (stageBPriority (shape 4 3 1)) 2 (fun u a => (littleLaw (shape 4 3 1) u ((stageBPriority (shape 4 3 1)) 2) a : ℝ)) 6 a +def CB4_3_1I2R6Raw (a : Fin 6) : Ball := residualBall (below (shape 4 3 1)) B4_3_1Law (stageBPriority (shape 4 3 1)) 2 (fun u => B4_3_1Little u ((stageBPriority (shape 4 3 1)) 2)) 6 a +lemma CB4_3_1I2R6Raw_sound (a : Fin 6) : + (CB4_3_1I2R6Raw a).Encloses (CB4_3_1I2R6Value a) := by + exact residualBall_sound_on (below (shape 4 3 1)) B4_3_1Law (fun u => (stageBLaw (shape 4 3 1) u : ℝ)) (stageBPriority (shape 4 3 1)) 2 (fun u => B4_3_1Little u ((stageBPriority (shape 4 3 1)) 2)) (fun u a => (littleLaw (shape 4 3 1) u ((stageBPriority (shape 4 3 1)) 2) a : ℝ)) (fun u _ => B4_3_1Law_sound u) (fun u _ a => B4_3_1Little_sound u ((stageBPriority (shape 4 3 1)) 2) a) 6 a +def CB4_3_1I2R6Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB4_3_1I2R6Certificates_valid : + CB4_3_1I2R6Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB4_3_1I2R6CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB4_3_1I2R6P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB4_3_1I2R6Certificates (CB4_3_1I2R6CertificateIndex a)).input +lemma CB4_3_1I2R6P_check : ∀ a : Fin 6, contains (CB4_3_1I2R6Raw a) (CB4_3_1I2R6P a) = true := by + decide +kernel +lemma CB4_3_1I2R6P_sound (a : Fin 6) : + (CB4_3_1I2R6P a).Encloses (CB4_3_1I2R6Value a) := + contains_sound (CB4_3_1I2R6Raw_sound a) (CB4_3_1I2R6P_check a) +def CB4_3_1I2R6Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB4_3_1I2R6Certificates (CB4_3_1I2R6CertificateIndex a)).output +lemma CB4_3_1I2R6Terms_sound (a : Fin 6) : + (CB4_3_1I2R6Terms a).Encloses (Foundation.entropyTerm (CB4_3_1I2R6Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB4_3_1I2R6Certificates_valid + (CB4_3_1I2R6CertificateIndex a) (CB4_3_1I2R6P_sound a) +def CB4_3_1I2R6Entropy : Ball := ⟨0, 0⟩ +lemma CB4_3_1I2R6Entropy_sound : CB4_3_1I2R6Entropy.Encloses (Foundation.finiteEntropy CB4_3_1I2R6Value) := by + exact contains_sound (entropyFin_enclosed 6 CB4_3_1I2R6Value CB4_3_1I2R6Terms CB4_3_1I2R6Terms_sound) (by decide +kernel) +def CB4_3_1I2R6Mass : Ball := ⟨0, 0⟩ +lemma CB4_3_1I2R6Mass_sound : CB4_3_1I2R6Mass.Encloses (∑ a, CB4_3_1I2R6Value a) := by + exact contains_sound (finSumBall_sound 6 CB4_3_1I2R6P CB4_3_1I2R6Value CB4_3_1I2R6P_sound) (by decide +kernel) +def CB4_3_1I2R6MassTerm : Ball := .exact 0 +lemma CB4_3_1I2R6MassTerm_sound : CB4_3_1I2R6MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB4_3_1I2R6Value a))) := + entropyTerm_zero_ball (CB4_3_1I2R6Mass_sound) +def CB4_3_1I2R6H : Ball := ⟨0, 0⟩ +lemma CB4_3_1I2R6H_sound : CB4_3_1I2R6H.Encloses (homogeneousEntropy CB4_3_1I2R6Value) := by + exact contains_sound (homogeneous_enclosed CB4_3_1I2R6Value CB4_3_1I2R6MassTerm_sound CB4_3_1I2R6Entropy_sound) (by decide +kernel) +def CB4_3_1I2R7Value (a : Fin 6) : ℝ := residualLaw (below (shape 4 3 1)) (fun u => (stageBLaw (shape 4 3 1) u : ℝ)) (stageBPriority (shape 4 3 1)) 2 (fun u a => (littleLaw (shape 4 3 1) u ((stageBPriority (shape 4 3 1)) 2) a : ℝ)) 7 a +def CB4_3_1I2R7Raw (a : Fin 6) : Ball := residualBall (below (shape 4 3 1)) B4_3_1Law (stageBPriority (shape 4 3 1)) 2 (fun u => B4_3_1Little u ((stageBPriority (shape 4 3 1)) 2)) 7 a +lemma CB4_3_1I2R7Raw_sound (a : Fin 6) : + (CB4_3_1I2R7Raw a).Encloses (CB4_3_1I2R7Value a) := by + exact residualBall_sound_on (below (shape 4 3 1)) B4_3_1Law (fun u => (stageBLaw (shape 4 3 1) u : ℝ)) (stageBPriority (shape 4 3 1)) 2 (fun u => B4_3_1Little u ((stageBPriority (shape 4 3 1)) 2)) (fun u a => (littleLaw (shape 4 3 1) u ((stageBPriority (shape 4 3 1)) 2) a : ℝ)) (fun u _ => B4_3_1Law_sound u) (fun u _ a => B4_3_1Little_sound u ((stageBPriority (shape 4 3 1)) 2) a) 7 a +def CB4_3_1I2R7Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB4_3_1I2R7Certificates_valid : + CB4_3_1I2R7Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB4_3_1I2R7CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB4_3_1I2R7P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB4_3_1I2R7Certificates (CB4_3_1I2R7CertificateIndex a)).input +lemma CB4_3_1I2R7P_check : ∀ a : Fin 6, contains (CB4_3_1I2R7Raw a) (CB4_3_1I2R7P a) = true := by + decide +kernel +lemma CB4_3_1I2R7P_sound (a : Fin 6) : + (CB4_3_1I2R7P a).Encloses (CB4_3_1I2R7Value a) := + contains_sound (CB4_3_1I2R7Raw_sound a) (CB4_3_1I2R7P_check a) +def CB4_3_1I2R7Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB4_3_1I2R7Certificates (CB4_3_1I2R7CertificateIndex a)).output +lemma CB4_3_1I2R7Terms_sound (a : Fin 6) : + (CB4_3_1I2R7Terms a).Encloses (Foundation.entropyTerm (CB4_3_1I2R7Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB4_3_1I2R7Certificates_valid + (CB4_3_1I2R7CertificateIndex a) (CB4_3_1I2R7P_sound a) +def CB4_3_1I2R7Entropy : Ball := ⟨0, 0⟩ +lemma CB4_3_1I2R7Entropy_sound : CB4_3_1I2R7Entropy.Encloses (Foundation.finiteEntropy CB4_3_1I2R7Value) := by + exact contains_sound (entropyFin_enclosed 6 CB4_3_1I2R7Value CB4_3_1I2R7Terms CB4_3_1I2R7Terms_sound) (by decide +kernel) +def CB4_3_1I2R7Mass : Ball := ⟨0, 0⟩ +lemma CB4_3_1I2R7Mass_sound : CB4_3_1I2R7Mass.Encloses (∑ a, CB4_3_1I2R7Value a) := by + exact contains_sound (finSumBall_sound 6 CB4_3_1I2R7P CB4_3_1I2R7Value CB4_3_1I2R7P_sound) (by decide +kernel) +def CB4_3_1I2R7MassTerm : Ball := .exact 0 +lemma CB4_3_1I2R7MassTerm_sound : CB4_3_1I2R7MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB4_3_1I2R7Value a))) := + entropyTerm_zero_ball (CB4_3_1I2R7Mass_sound) +def CB4_3_1I2R7H : Ball := ⟨0, 0⟩ +lemma CB4_3_1I2R7H_sound : CB4_3_1I2R7H.Encloses (homogeneousEntropy CB4_3_1I2R7Value) := by + exact contains_sound (homogeneous_enclosed CB4_3_1I2R7Value CB4_3_1I2R7MassTerm_sound CB4_3_1I2R7Entropy_sound) (by decide +kernel) +def CB4_3_1I2R8Value (a : Fin 6) : ℝ := residualLaw (below (shape 4 3 1)) (fun u => (stageBLaw (shape 4 3 1) u : ℝ)) (stageBPriority (shape 4 3 1)) 2 (fun u a => (littleLaw (shape 4 3 1) u ((stageBPriority (shape 4 3 1)) 2) a : ℝ)) 8 a +def CB4_3_1I2R8Raw (a : Fin 6) : Ball := residualBall (below (shape 4 3 1)) B4_3_1Law (stageBPriority (shape 4 3 1)) 2 (fun u => B4_3_1Little u ((stageBPriority (shape 4 3 1)) 2)) 8 a +lemma CB4_3_1I2R8Raw_sound (a : Fin 6) : + (CB4_3_1I2R8Raw a).Encloses (CB4_3_1I2R8Value a) := by + exact residualBall_sound_on (below (shape 4 3 1)) B4_3_1Law (fun u => (stageBLaw (shape 4 3 1) u : ℝ)) (stageBPriority (shape 4 3 1)) 2 (fun u => B4_3_1Little u ((stageBPriority (shape 4 3 1)) 2)) (fun u a => (littleLaw (shape 4 3 1) u ((stageBPriority (shape 4 3 1)) 2) a : ℝ)) (fun u _ => B4_3_1Law_sound u) (fun u _ a => B4_3_1Little_sound u ((stageBPriority (shape 4 3 1)) 2) a) 8 a +def CB4_3_1I2R8Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB4_3_1I2R8Certificates_valid : + CB4_3_1I2R8Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB4_3_1I2R8CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB4_3_1I2R8P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB4_3_1I2R8Certificates (CB4_3_1I2R8CertificateIndex a)).input +lemma CB4_3_1I2R8P_check : ∀ a : Fin 6, contains (CB4_3_1I2R8Raw a) (CB4_3_1I2R8P a) = true := by + decide +kernel +lemma CB4_3_1I2R8P_sound (a : Fin 6) : + (CB4_3_1I2R8P a).Encloses (CB4_3_1I2R8Value a) := + contains_sound (CB4_3_1I2R8Raw_sound a) (CB4_3_1I2R8P_check a) +def CB4_3_1I2R8Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB4_3_1I2R8Certificates (CB4_3_1I2R8CertificateIndex a)).output +lemma CB4_3_1I2R8Terms_sound (a : Fin 6) : + (CB4_3_1I2R8Terms a).Encloses (Foundation.entropyTerm (CB4_3_1I2R8Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB4_3_1I2R8Certificates_valid + (CB4_3_1I2R8CertificateIndex a) (CB4_3_1I2R8P_sound a) +def CB4_3_1I2R8Entropy : Ball := ⟨0, 0⟩ +lemma CB4_3_1I2R8Entropy_sound : CB4_3_1I2R8Entropy.Encloses (Foundation.finiteEntropy CB4_3_1I2R8Value) := by + exact contains_sound (entropyFin_enclosed 6 CB4_3_1I2R8Value CB4_3_1I2R8Terms CB4_3_1I2R8Terms_sound) (by decide +kernel) +def CB4_3_1I2R8Mass : Ball := ⟨0, 0⟩ +lemma CB4_3_1I2R8Mass_sound : CB4_3_1I2R8Mass.Encloses (∑ a, CB4_3_1I2R8Value a) := by + exact contains_sound (finSumBall_sound 6 CB4_3_1I2R8P CB4_3_1I2R8Value CB4_3_1I2R8P_sound) (by decide +kernel) +def CB4_3_1I2R8MassTerm : Ball := .exact 0 +lemma CB4_3_1I2R8MassTerm_sound : CB4_3_1I2R8MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB4_3_1I2R8Value a))) := + entropyTerm_zero_ball (CB4_3_1I2R8Mass_sound) +def CB4_3_1I2R8H : Ball := ⟨0, 0⟩ +lemma CB4_3_1I2R8H_sound : CB4_3_1I2R8H.Encloses (homogeneousEntropy CB4_3_1I2R8Value) := by + exact contains_sound (homogeneous_enclosed CB4_3_1I2R8Value CB4_3_1I2R8MassTerm_sound CB4_3_1I2R8Entropy_sound) (by decide +kernel) +def CB4_3_1I2R9Value (a : Fin 6) : ℝ := residualLaw (below (shape 4 3 1)) (fun u => (stageBLaw (shape 4 3 1) u : ℝ)) (stageBPriority (shape 4 3 1)) 2 (fun u a => (littleLaw (shape 4 3 1) u ((stageBPriority (shape 4 3 1)) 2) a : ℝ)) 9 a +def CB4_3_1I2R9Raw (a : Fin 6) : Ball := residualBall (below (shape 4 3 1)) B4_3_1Law (stageBPriority (shape 4 3 1)) 2 (fun u => B4_3_1Little u ((stageBPriority (shape 4 3 1)) 2)) 9 a +lemma CB4_3_1I2R9Raw_sound (a : Fin 6) : + (CB4_3_1I2R9Raw a).Encloses (CB4_3_1I2R9Value a) := by + exact residualBall_sound_on (below (shape 4 3 1)) B4_3_1Law (fun u => (stageBLaw (shape 4 3 1) u : ℝ)) (stageBPriority (shape 4 3 1)) 2 (fun u => B4_3_1Little u ((stageBPriority (shape 4 3 1)) 2)) (fun u a => (littleLaw (shape 4 3 1) u ((stageBPriority (shape 4 3 1)) 2) a : ℝ)) (fun u _ => B4_3_1Law_sound u) (fun u _ a => B4_3_1Little_sound u ((stageBPriority (shape 4 3 1)) 2) a) 9 a +def CB4_3_1I2R9Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB4_3_1I2R9Certificates_valid : + CB4_3_1I2R9Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB4_3_1I2R9CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB4_3_1I2R9P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB4_3_1I2R9Certificates (CB4_3_1I2R9CertificateIndex a)).input +lemma CB4_3_1I2R9P_check : ∀ a : Fin 6, contains (CB4_3_1I2R9Raw a) (CB4_3_1I2R9P a) = true := by + decide +kernel +lemma CB4_3_1I2R9P_sound (a : Fin 6) : + (CB4_3_1I2R9P a).Encloses (CB4_3_1I2R9Value a) := + contains_sound (CB4_3_1I2R9Raw_sound a) (CB4_3_1I2R9P_check a) +def CB4_3_1I2R9Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB4_3_1I2R9Certificates (CB4_3_1I2R9CertificateIndex a)).output +lemma CB4_3_1I2R9Terms_sound (a : Fin 6) : + (CB4_3_1I2R9Terms a).Encloses (Foundation.entropyTerm (CB4_3_1I2R9Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB4_3_1I2R9Certificates_valid + (CB4_3_1I2R9CertificateIndex a) (CB4_3_1I2R9P_sound a) +def CB4_3_1I2R9Entropy : Ball := ⟨0, 0⟩ +lemma CB4_3_1I2R9Entropy_sound : CB4_3_1I2R9Entropy.Encloses (Foundation.finiteEntropy CB4_3_1I2R9Value) := by + exact contains_sound (entropyFin_enclosed 6 CB4_3_1I2R9Value CB4_3_1I2R9Terms CB4_3_1I2R9Terms_sound) (by decide +kernel) +def CB4_3_1I2R9Mass : Ball := ⟨0, 0⟩ +lemma CB4_3_1I2R9Mass_sound : CB4_3_1I2R9Mass.Encloses (∑ a, CB4_3_1I2R9Value a) := by + exact contains_sound (finSumBall_sound 6 CB4_3_1I2R9P CB4_3_1I2R9Value CB4_3_1I2R9P_sound) (by decide +kernel) +def CB4_3_1I2R9MassTerm : Ball := .exact 0 +lemma CB4_3_1I2R9MassTerm_sound : CB4_3_1I2R9MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB4_3_1I2R9Value a))) := + entropyTerm_zero_ball (CB4_3_1I2R9Mass_sound) +def CB4_3_1I2R9H : Ball := ⟨0, 0⟩ +lemma CB4_3_1I2R9H_sound : CB4_3_1I2R9H.Encloses (homogeneousEntropy CB4_3_1I2R9Value) := by + exact contains_sound (homogeneous_enclosed CB4_3_1I2R9Value CB4_3_1I2R9MassTerm_sound CB4_3_1I2R9Entropy_sound) (by decide +kernel) +def CB4_3_1I2R10Value (a : Fin 6) : ℝ := residualLaw (below (shape 4 3 1)) (fun u => (stageBLaw (shape 4 3 1) u : ℝ)) (stageBPriority (shape 4 3 1)) 2 (fun u a => (littleLaw (shape 4 3 1) u ((stageBPriority (shape 4 3 1)) 2) a : ℝ)) 10 a +def CB4_3_1I2R10Raw (a : Fin 6) : Ball := residualBall (below (shape 4 3 1)) B4_3_1Law (stageBPriority (shape 4 3 1)) 2 (fun u => B4_3_1Little u ((stageBPriority (shape 4 3 1)) 2)) 10 a +lemma CB4_3_1I2R10Raw_sound (a : Fin 6) : + (CB4_3_1I2R10Raw a).Encloses (CB4_3_1I2R10Value a) := by + exact residualBall_sound_on (below (shape 4 3 1)) B4_3_1Law (fun u => (stageBLaw (shape 4 3 1) u : ℝ)) (stageBPriority (shape 4 3 1)) 2 (fun u => B4_3_1Little u ((stageBPriority (shape 4 3 1)) 2)) (fun u a => (littleLaw (shape 4 3 1) u ((stageBPriority (shape 4 3 1)) 2) a : ℝ)) (fun u _ => B4_3_1Law_sound u) (fun u _ a => B4_3_1Little_sound u ((stageBPriority (shape 4 3 1)) 2) a) 10 a +def CB4_3_1I2R10Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB4_3_1I2R10Certificates_valid : + CB4_3_1I2R10Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB4_3_1I2R10CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB4_3_1I2R10P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB4_3_1I2R10Certificates (CB4_3_1I2R10CertificateIndex a)).input +lemma CB4_3_1I2R10P_check : ∀ a : Fin 6, contains (CB4_3_1I2R10Raw a) (CB4_3_1I2R10P a) = true := by + decide +kernel +lemma CB4_3_1I2R10P_sound (a : Fin 6) : + (CB4_3_1I2R10P a).Encloses (CB4_3_1I2R10Value a) := + contains_sound (CB4_3_1I2R10Raw_sound a) (CB4_3_1I2R10P_check a) +def CB4_3_1I2R10Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB4_3_1I2R10Certificates (CB4_3_1I2R10CertificateIndex a)).output +lemma CB4_3_1I2R10Terms_sound (a : Fin 6) : + (CB4_3_1I2R10Terms a).Encloses (Foundation.entropyTerm (CB4_3_1I2R10Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB4_3_1I2R10Certificates_valid + (CB4_3_1I2R10CertificateIndex a) (CB4_3_1I2R10P_sound a) +def CB4_3_1I2R10Entropy : Ball := ⟨0, 0⟩ +lemma CB4_3_1I2R10Entropy_sound : CB4_3_1I2R10Entropy.Encloses (Foundation.finiteEntropy CB4_3_1I2R10Value) := by + exact contains_sound (entropyFin_enclosed 6 CB4_3_1I2R10Value CB4_3_1I2R10Terms CB4_3_1I2R10Terms_sound) (by decide +kernel) +def CB4_3_1I2R10Mass : Ball := ⟨0, 0⟩ +lemma CB4_3_1I2R10Mass_sound : CB4_3_1I2R10Mass.Encloses (∑ a, CB4_3_1I2R10Value a) := by + exact contains_sound (finSumBall_sound 6 CB4_3_1I2R10P CB4_3_1I2R10Value CB4_3_1I2R10P_sound) (by decide +kernel) +def CB4_3_1I2R10MassTerm : Ball := .exact 0 +lemma CB4_3_1I2R10MassTerm_sound : CB4_3_1I2R10MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB4_3_1I2R10Value a))) := + entropyTerm_zero_ball (CB4_3_1I2R10Mass_sound) +def CB4_3_1I2R10H : Ball := ⟨0, 0⟩ +lemma CB4_3_1I2R10H_sound : CB4_3_1I2R10H.Encloses (homogeneousEntropy CB4_3_1I2R10Value) := by + exact contains_sound (homogeneous_enclosed CB4_3_1I2R10Value CB4_3_1I2R10MassTerm_sound CB4_3_1I2R10Entropy_sound) (by decide +kernel) +def CB4_3_1I2R11Value (a : Fin 6) : ℝ := residualLaw (below (shape 4 3 1)) (fun u => (stageBLaw (shape 4 3 1) u : ℝ)) (stageBPriority (shape 4 3 1)) 2 (fun u a => (littleLaw (shape 4 3 1) u ((stageBPriority (shape 4 3 1)) 2) a : ℝ)) 11 a +def CB4_3_1I2R11Raw (a : Fin 6) : Ball := residualBall (below (shape 4 3 1)) B4_3_1Law (stageBPriority (shape 4 3 1)) 2 (fun u => B4_3_1Little u ((stageBPriority (shape 4 3 1)) 2)) 11 a +lemma CB4_3_1I2R11Raw_sound (a : Fin 6) : + (CB4_3_1I2R11Raw a).Encloses (CB4_3_1I2R11Value a) := by + exact residualBall_sound_on (below (shape 4 3 1)) B4_3_1Law (fun u => (stageBLaw (shape 4 3 1) u : ℝ)) (stageBPriority (shape 4 3 1)) 2 (fun u => B4_3_1Little u ((stageBPriority (shape 4 3 1)) 2)) (fun u a => (littleLaw (shape 4 3 1) u ((stageBPriority (shape 4 3 1)) 2) a : ℝ)) (fun u _ => B4_3_1Law_sound u) (fun u _ a => B4_3_1Little_sound u ((stageBPriority (shape 4 3 1)) 2) a) 11 a +def CB4_3_1I2R11Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB4_3_1I2R11Certificates_valid : + CB4_3_1I2R11Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB4_3_1I2R11CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB4_3_1I2R11P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB4_3_1I2R11Certificates (CB4_3_1I2R11CertificateIndex a)).input +lemma CB4_3_1I2R11P_check : ∀ a : Fin 6, contains (CB4_3_1I2R11Raw a) (CB4_3_1I2R11P a) = true := by + decide +kernel +lemma CB4_3_1I2R11P_sound (a : Fin 6) : + (CB4_3_1I2R11P a).Encloses (CB4_3_1I2R11Value a) := + contains_sound (CB4_3_1I2R11Raw_sound a) (CB4_3_1I2R11P_check a) +def CB4_3_1I2R11Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB4_3_1I2R11Certificates (CB4_3_1I2R11CertificateIndex a)).output +lemma CB4_3_1I2R11Terms_sound (a : Fin 6) : + (CB4_3_1I2R11Terms a).Encloses (Foundation.entropyTerm (CB4_3_1I2R11Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB4_3_1I2R11Certificates_valid + (CB4_3_1I2R11CertificateIndex a) (CB4_3_1I2R11P_sound a) +def CB4_3_1I2R11Entropy : Ball := ⟨0, 0⟩ +lemma CB4_3_1I2R11Entropy_sound : CB4_3_1I2R11Entropy.Encloses (Foundation.finiteEntropy CB4_3_1I2R11Value) := by + exact contains_sound (entropyFin_enclosed 6 CB4_3_1I2R11Value CB4_3_1I2R11Terms CB4_3_1I2R11Terms_sound) (by decide +kernel) +def CB4_3_1I2R11Mass : Ball := ⟨0, 0⟩ +lemma CB4_3_1I2R11Mass_sound : CB4_3_1I2R11Mass.Encloses (∑ a, CB4_3_1I2R11Value a) := by + exact contains_sound (finSumBall_sound 6 CB4_3_1I2R11P CB4_3_1I2R11Value CB4_3_1I2R11P_sound) (by decide +kernel) +def CB4_3_1I2R11MassTerm : Ball := .exact 0 +lemma CB4_3_1I2R11MassTerm_sound : CB4_3_1I2R11MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB4_3_1I2R11Value a))) := + entropyTerm_zero_ball (CB4_3_1I2R11Mass_sound) +def CB4_3_1I2R11H : Ball := ⟨0, 0⟩ +lemma CB4_3_1I2R11H_sound : CB4_3_1I2R11H.Encloses (homogeneousEntropy CB4_3_1I2R11Value) := by + exact contains_sound (homogeneous_enclosed CB4_3_1I2R11Value CB4_3_1I2R11MassTerm_sound CB4_3_1I2R11Entropy_sound) (by decide +kernel) +def CB4_3_1I2R12Value (a : Fin 6) : ℝ := residualLaw (below (shape 4 3 1)) (fun u => (stageBLaw (shape 4 3 1) u : ℝ)) (stageBPriority (shape 4 3 1)) 2 (fun u a => (littleLaw (shape 4 3 1) u ((stageBPriority (shape 4 3 1)) 2) a : ℝ)) 12 a +def CB4_3_1I2R12Raw (a : Fin 6) : Ball := residualBall (below (shape 4 3 1)) B4_3_1Law (stageBPriority (shape 4 3 1)) 2 (fun u => B4_3_1Little u ((stageBPriority (shape 4 3 1)) 2)) 12 a +lemma CB4_3_1I2R12Raw_sound (a : Fin 6) : + (CB4_3_1I2R12Raw a).Encloses (CB4_3_1I2R12Value a) := by + exact residualBall_sound_on (below (shape 4 3 1)) B4_3_1Law (fun u => (stageBLaw (shape 4 3 1) u : ℝ)) (stageBPriority (shape 4 3 1)) 2 (fun u => B4_3_1Little u ((stageBPriority (shape 4 3 1)) 2)) (fun u a => (littleLaw (shape 4 3 1) u ((stageBPriority (shape 4 3 1)) 2) a : ℝ)) (fun u _ => B4_3_1Law_sound u) (fun u _ a => B4_3_1Little_sound u ((stageBPriority (shape 4 3 1)) 2) a) 12 a +def CB4_3_1I2R12Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB4_3_1I2R12Certificates_valid : + CB4_3_1I2R12Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB4_3_1I2R12CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB4_3_1I2R12P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB4_3_1I2R12Certificates (CB4_3_1I2R12CertificateIndex a)).input +lemma CB4_3_1I2R12P_check : ∀ a : Fin 6, contains (CB4_3_1I2R12Raw a) (CB4_3_1I2R12P a) = true := by + decide +kernel +lemma CB4_3_1I2R12P_sound (a : Fin 6) : + (CB4_3_1I2R12P a).Encloses (CB4_3_1I2R12Value a) := + contains_sound (CB4_3_1I2R12Raw_sound a) (CB4_3_1I2R12P_check a) +def CB4_3_1I2R12Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB4_3_1I2R12Certificates (CB4_3_1I2R12CertificateIndex a)).output +lemma CB4_3_1I2R12Terms_sound (a : Fin 6) : + (CB4_3_1I2R12Terms a).Encloses (Foundation.entropyTerm (CB4_3_1I2R12Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB4_3_1I2R12Certificates_valid + (CB4_3_1I2R12CertificateIndex a) (CB4_3_1I2R12P_sound a) +def CB4_3_1I2R12Entropy : Ball := ⟨0, 0⟩ +lemma CB4_3_1I2R12Entropy_sound : CB4_3_1I2R12Entropy.Encloses (Foundation.finiteEntropy CB4_3_1I2R12Value) := by + exact contains_sound (entropyFin_enclosed 6 CB4_3_1I2R12Value CB4_3_1I2R12Terms CB4_3_1I2R12Terms_sound) (by decide +kernel) +def CB4_3_1I2R12Mass : Ball := ⟨0, 0⟩ +lemma CB4_3_1I2R12Mass_sound : CB4_3_1I2R12Mass.Encloses (∑ a, CB4_3_1I2R12Value a) := by + exact contains_sound (finSumBall_sound 6 CB4_3_1I2R12P CB4_3_1I2R12Value CB4_3_1I2R12P_sound) (by decide +kernel) +def CB4_3_1I2R12MassTerm : Ball := .exact 0 +lemma CB4_3_1I2R12MassTerm_sound : CB4_3_1I2R12MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB4_3_1I2R12Value a))) := + entropyTerm_zero_ball (CB4_3_1I2R12Mass_sound) +def CB4_3_1I2R12H : Ball := ⟨0, 0⟩ +lemma CB4_3_1I2R12H_sound : CB4_3_1I2R12H.Encloses (homogeneousEntropy CB4_3_1I2R12Value) := by + exact contains_sound (homogeneous_enclosed CB4_3_1I2R12Value CB4_3_1I2R12MassTerm_sound CB4_3_1I2R12Entropy_sound) (by decide +kernel) +def CB4_3_1I2R13Value (a : Fin 6) : ℝ := residualLaw (below (shape 4 3 1)) (fun u => (stageBLaw (shape 4 3 1) u : ℝ)) (stageBPriority (shape 4 3 1)) 2 (fun u a => (littleLaw (shape 4 3 1) u ((stageBPriority (shape 4 3 1)) 2) a : ℝ)) 13 a +def CB4_3_1I2R13Raw (a : Fin 6) : Ball := residualBall (below (shape 4 3 1)) B4_3_1Law (stageBPriority (shape 4 3 1)) 2 (fun u => B4_3_1Little u ((stageBPriority (shape 4 3 1)) 2)) 13 a +lemma CB4_3_1I2R13Raw_sound (a : Fin 6) : + (CB4_3_1I2R13Raw a).Encloses (CB4_3_1I2R13Value a) := by + exact residualBall_sound_on (below (shape 4 3 1)) B4_3_1Law (fun u => (stageBLaw (shape 4 3 1) u : ℝ)) (stageBPriority (shape 4 3 1)) 2 (fun u => B4_3_1Little u ((stageBPriority (shape 4 3 1)) 2)) (fun u a => (littleLaw (shape 4 3 1) u ((stageBPriority (shape 4 3 1)) 2) a : ℝ)) (fun u _ => B4_3_1Law_sound u) (fun u _ a => B4_3_1Little_sound u ((stageBPriority (shape 4 3 1)) 2) a) 13 a +def CB4_3_1I2R13Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB4_3_1I2R13Certificates_valid : + CB4_3_1I2R13Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB4_3_1I2R13CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB4_3_1I2R13P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB4_3_1I2R13Certificates (CB4_3_1I2R13CertificateIndex a)).input +lemma CB4_3_1I2R13P_check : ∀ a : Fin 6, contains (CB4_3_1I2R13Raw a) (CB4_3_1I2R13P a) = true := by + decide +kernel +lemma CB4_3_1I2R13P_sound (a : Fin 6) : + (CB4_3_1I2R13P a).Encloses (CB4_3_1I2R13Value a) := + contains_sound (CB4_3_1I2R13Raw_sound a) (CB4_3_1I2R13P_check a) +def CB4_3_1I2R13Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB4_3_1I2R13Certificates (CB4_3_1I2R13CertificateIndex a)).output +lemma CB4_3_1I2R13Terms_sound (a : Fin 6) : + (CB4_3_1I2R13Terms a).Encloses (Foundation.entropyTerm (CB4_3_1I2R13Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB4_3_1I2R13Certificates_valid + (CB4_3_1I2R13CertificateIndex a) (CB4_3_1I2R13P_sound a) +def CB4_3_1I2R13Entropy : Ball := ⟨0, 0⟩ +lemma CB4_3_1I2R13Entropy_sound : CB4_3_1I2R13Entropy.Encloses (Foundation.finiteEntropy CB4_3_1I2R13Value) := by + exact contains_sound (entropyFin_enclosed 6 CB4_3_1I2R13Value CB4_3_1I2R13Terms CB4_3_1I2R13Terms_sound) (by decide +kernel) +def CB4_3_1I2R13Mass : Ball := ⟨0, 0⟩ +lemma CB4_3_1I2R13Mass_sound : CB4_3_1I2R13Mass.Encloses (∑ a, CB4_3_1I2R13Value a) := by + exact contains_sound (finSumBall_sound 6 CB4_3_1I2R13P CB4_3_1I2R13Value CB4_3_1I2R13P_sound) (by decide +kernel) +def CB4_3_1I2R13MassTerm : Ball := .exact 0 +lemma CB4_3_1I2R13MassTerm_sound : CB4_3_1I2R13MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB4_3_1I2R13Value a))) := + entropyTerm_zero_ball (CB4_3_1I2R13Mass_sound) +def CB4_3_1I2R13H : Ball := ⟨0, 0⟩ +lemma CB4_3_1I2R13H_sound : CB4_3_1I2R13H.Encloses (homogeneousEntropy CB4_3_1I2R13Value) := by + exact contains_sound (homogeneous_enclosed CB4_3_1I2R13Value CB4_3_1I2R13MassTerm_sound CB4_3_1I2R13Entropy_sound) (by decide +kernel) +def CB4_3_1I2R14Value (a : Fin 6) : ℝ := residualLaw (below (shape 4 3 1)) (fun u => (stageBLaw (shape 4 3 1) u : ℝ)) (stageBPriority (shape 4 3 1)) 2 (fun u a => (littleLaw (shape 4 3 1) u ((stageBPriority (shape 4 3 1)) 2) a : ℝ)) 14 a +def CB4_3_1I2R14Raw (a : Fin 6) : Ball := residualBall (below (shape 4 3 1)) B4_3_1Law (stageBPriority (shape 4 3 1)) 2 (fun u => B4_3_1Little u ((stageBPriority (shape 4 3 1)) 2)) 14 a +lemma CB4_3_1I2R14Raw_sound (a : Fin 6) : + (CB4_3_1I2R14Raw a).Encloses (CB4_3_1I2R14Value a) := by + exact residualBall_sound_on (below (shape 4 3 1)) B4_3_1Law (fun u => (stageBLaw (shape 4 3 1) u : ℝ)) (stageBPriority (shape 4 3 1)) 2 (fun u => B4_3_1Little u ((stageBPriority (shape 4 3 1)) 2)) (fun u a => (littleLaw (shape 4 3 1) u ((stageBPriority (shape 4 3 1)) 2) a : ℝ)) (fun u _ => B4_3_1Law_sound u) (fun u _ a => B4_3_1Little_sound u ((stageBPriority (shape 4 3 1)) 2) a) 14 a +def CB4_3_1I2R14Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB4_3_1I2R14Certificates_valid : + CB4_3_1I2R14Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB4_3_1I2R14CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB4_3_1I2R14P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB4_3_1I2R14Certificates (CB4_3_1I2R14CertificateIndex a)).input +lemma CB4_3_1I2R14P_check : ∀ a : Fin 6, contains (CB4_3_1I2R14Raw a) (CB4_3_1I2R14P a) = true := by + decide +kernel +lemma CB4_3_1I2R14P_sound (a : Fin 6) : + (CB4_3_1I2R14P a).Encloses (CB4_3_1I2R14Value a) := + contains_sound (CB4_3_1I2R14Raw_sound a) (CB4_3_1I2R14P_check a) +def CB4_3_1I2R14Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB4_3_1I2R14Certificates (CB4_3_1I2R14CertificateIndex a)).output +lemma CB4_3_1I2R14Terms_sound (a : Fin 6) : + (CB4_3_1I2R14Terms a).Encloses (Foundation.entropyTerm (CB4_3_1I2R14Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB4_3_1I2R14Certificates_valid + (CB4_3_1I2R14CertificateIndex a) (CB4_3_1I2R14P_sound a) +def CB4_3_1I2R14Entropy : Ball := ⟨0, 0⟩ +lemma CB4_3_1I2R14Entropy_sound : CB4_3_1I2R14Entropy.Encloses (Foundation.finiteEntropy CB4_3_1I2R14Value) := by + exact contains_sound (entropyFin_enclosed 6 CB4_3_1I2R14Value CB4_3_1I2R14Terms CB4_3_1I2R14Terms_sound) (by decide +kernel) +def CB4_3_1I2R14Mass : Ball := ⟨0, 0⟩ +lemma CB4_3_1I2R14Mass_sound : CB4_3_1I2R14Mass.Encloses (∑ a, CB4_3_1I2R14Value a) := by + exact contains_sound (finSumBall_sound 6 CB4_3_1I2R14P CB4_3_1I2R14Value CB4_3_1I2R14P_sound) (by decide +kernel) +def CB4_3_1I2R14MassTerm : Ball := .exact 0 +lemma CB4_3_1I2R14MassTerm_sound : CB4_3_1I2R14MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB4_3_1I2R14Value a))) := + entropyTerm_zero_ball (CB4_3_1I2R14Mass_sound) +def CB4_3_1I2R14H : Ball := ⟨0, 0⟩ +lemma CB4_3_1I2R14H_sound : CB4_3_1I2R14H.Encloses (homogeneousEntropy CB4_3_1I2R14Value) := by + exact contains_sound (homogeneous_enclosed CB4_3_1I2R14Value CB4_3_1I2R14MassTerm_sound CB4_3_1I2R14Entropy_sound) (by decide +kernel) +def CB4_3_1I2R15Value (a : Fin 6) : ℝ := residualLaw (below (shape 4 3 1)) (fun u => (stageBLaw (shape 4 3 1) u : ℝ)) (stageBPriority (shape 4 3 1)) 2 (fun u a => (littleLaw (shape 4 3 1) u ((stageBPriority (shape 4 3 1)) 2) a : ℝ)) 15 a +def CB4_3_1I2R15Raw (a : Fin 6) : Ball := residualBall (below (shape 4 3 1)) B4_3_1Law (stageBPriority (shape 4 3 1)) 2 (fun u => B4_3_1Little u ((stageBPriority (shape 4 3 1)) 2)) 15 a +lemma CB4_3_1I2R15Raw_sound (a : Fin 6) : + (CB4_3_1I2R15Raw a).Encloses (CB4_3_1I2R15Value a) := by + exact residualBall_sound_on (below (shape 4 3 1)) B4_3_1Law (fun u => (stageBLaw (shape 4 3 1) u : ℝ)) (stageBPriority (shape 4 3 1)) 2 (fun u => B4_3_1Little u ((stageBPriority (shape 4 3 1)) 2)) (fun u a => (littleLaw (shape 4 3 1) u ((stageBPriority (shape 4 3 1)) 2) a : ℝ)) (fun u _ => B4_3_1Law_sound u) (fun u _ a => B4_3_1Little_sound u ((stageBPriority (shape 4 3 1)) 2) a) 15 a +def CB4_3_1I2R15Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB4_3_1I2R15Certificates_valid : + CB4_3_1I2R15Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB4_3_1I2R15CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB4_3_1I2R15P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB4_3_1I2R15Certificates (CB4_3_1I2R15CertificateIndex a)).input +lemma CB4_3_1I2R15P_check : ∀ a : Fin 6, contains (CB4_3_1I2R15Raw a) (CB4_3_1I2R15P a) = true := by + decide +kernel +lemma CB4_3_1I2R15P_sound (a : Fin 6) : + (CB4_3_1I2R15P a).Encloses (CB4_3_1I2R15Value a) := + contains_sound (CB4_3_1I2R15Raw_sound a) (CB4_3_1I2R15P_check a) +def CB4_3_1I2R15Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB4_3_1I2R15Certificates (CB4_3_1I2R15CertificateIndex a)).output +lemma CB4_3_1I2R15Terms_sound (a : Fin 6) : + (CB4_3_1I2R15Terms a).Encloses (Foundation.entropyTerm (CB4_3_1I2R15Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB4_3_1I2R15Certificates_valid + (CB4_3_1I2R15CertificateIndex a) (CB4_3_1I2R15P_sound a) +def CB4_3_1I2R15Entropy : Ball := ⟨0, 0⟩ +lemma CB4_3_1I2R15Entropy_sound : CB4_3_1I2R15Entropy.Encloses (Foundation.finiteEntropy CB4_3_1I2R15Value) := by + exact contains_sound (entropyFin_enclosed 6 CB4_3_1I2R15Value CB4_3_1I2R15Terms CB4_3_1I2R15Terms_sound) (by decide +kernel) +def CB4_3_1I2R15Mass : Ball := ⟨0, 0⟩ +lemma CB4_3_1I2R15Mass_sound : CB4_3_1I2R15Mass.Encloses (∑ a, CB4_3_1I2R15Value a) := by + exact contains_sound (finSumBall_sound 6 CB4_3_1I2R15P CB4_3_1I2R15Value CB4_3_1I2R15P_sound) (by decide +kernel) +def CB4_3_1I2R15MassTerm : Ball := .exact 0 +lemma CB4_3_1I2R15MassTerm_sound : CB4_3_1I2R15MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB4_3_1I2R15Value a))) := + entropyTerm_zero_ball (CB4_3_1I2R15Mass_sound) +def CB4_3_1I2R15H : Ball := ⟨0, 0⟩ +lemma CB4_3_1I2R15H_sound : CB4_3_1I2R15H.Encloses (homogeneousEntropy CB4_3_1I2R15Value) := by + exact contains_sound (homogeneous_enclosed CB4_3_1I2R15Value CB4_3_1I2R15MassTerm_sound CB4_3_1I2R15Entropy_sound) (by decide +kernel) +def CB4_3_1I2R16Value (a : Fin 6) : ℝ := residualLaw (below (shape 4 3 1)) (fun u => (stageBLaw (shape 4 3 1) u : ℝ)) (stageBPriority (shape 4 3 1)) 2 (fun u a => (littleLaw (shape 4 3 1) u ((stageBPriority (shape 4 3 1)) 2) a : ℝ)) 16 a +def CB4_3_1I2R16Raw (a : Fin 6) : Ball := residualBall (below (shape 4 3 1)) B4_3_1Law (stageBPriority (shape 4 3 1)) 2 (fun u => B4_3_1Little u ((stageBPriority (shape 4 3 1)) 2)) 16 a +lemma CB4_3_1I2R16Raw_sound (a : Fin 6) : + (CB4_3_1I2R16Raw a).Encloses (CB4_3_1I2R16Value a) := by + exact residualBall_sound_on (below (shape 4 3 1)) B4_3_1Law (fun u => (stageBLaw (shape 4 3 1) u : ℝ)) (stageBPriority (shape 4 3 1)) 2 (fun u => B4_3_1Little u ((stageBPriority (shape 4 3 1)) 2)) (fun u a => (littleLaw (shape 4 3 1) u ((stageBPriority (shape 4 3 1)) 2) a : ℝ)) (fun u _ => B4_3_1Law_sound u) (fun u _ a => B4_3_1Little_sound u ((stageBPriority (shape 4 3 1)) 2) a) 16 a +def CB4_3_1I2R16Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB4_3_1I2R16Certificates_valid : + CB4_3_1I2R16Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB4_3_1I2R16CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB4_3_1I2R16P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB4_3_1I2R16Certificates (CB4_3_1I2R16CertificateIndex a)).input +lemma CB4_3_1I2R16P_check : ∀ a : Fin 6, contains (CB4_3_1I2R16Raw a) (CB4_3_1I2R16P a) = true := by + decide +kernel +lemma CB4_3_1I2R16P_sound (a : Fin 6) : + (CB4_3_1I2R16P a).Encloses (CB4_3_1I2R16Value a) := + contains_sound (CB4_3_1I2R16Raw_sound a) (CB4_3_1I2R16P_check a) +def CB4_3_1I2R16Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB4_3_1I2R16Certificates (CB4_3_1I2R16CertificateIndex a)).output +lemma CB4_3_1I2R16Terms_sound (a : Fin 6) : + (CB4_3_1I2R16Terms a).Encloses (Foundation.entropyTerm (CB4_3_1I2R16Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB4_3_1I2R16Certificates_valid + (CB4_3_1I2R16CertificateIndex a) (CB4_3_1I2R16P_sound a) +def CB4_3_1I2R16Entropy : Ball := ⟨0, 0⟩ +lemma CB4_3_1I2R16Entropy_sound : CB4_3_1I2R16Entropy.Encloses (Foundation.finiteEntropy CB4_3_1I2R16Value) := by + exact contains_sound (entropyFin_enclosed 6 CB4_3_1I2R16Value CB4_3_1I2R16Terms CB4_3_1I2R16Terms_sound) (by decide +kernel) +def CB4_3_1I2R16Mass : Ball := ⟨0, 0⟩ +lemma CB4_3_1I2R16Mass_sound : CB4_3_1I2R16Mass.Encloses (∑ a, CB4_3_1I2R16Value a) := by + exact contains_sound (finSumBall_sound 6 CB4_3_1I2R16P CB4_3_1I2R16Value CB4_3_1I2R16P_sound) (by decide +kernel) +def CB4_3_1I2R16MassTerm : Ball := .exact 0 +lemma CB4_3_1I2R16MassTerm_sound : CB4_3_1I2R16MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB4_3_1I2R16Value a))) := + entropyTerm_zero_ball (CB4_3_1I2R16Mass_sound) +def CB4_3_1I2R16H : Ball := ⟨0, 0⟩ +lemma CB4_3_1I2R16H_sound : CB4_3_1I2R16H.Encloses (homogeneousEntropy CB4_3_1I2R16Value) := by + exact contains_sound (homogeneous_enclosed CB4_3_1I2R16Value CB4_3_1I2R16MassTerm_sound CB4_3_1I2R16Entropy_sound) (by decide +kernel) +def CB4_3_1I2ResidualEntropies (a : Fin 17) : Ball := + match a.val with + | 0 => CB4_3_1I2R0H + | 1 => CB4_3_1I2R1H + | 2 => CB4_3_1I2R2H + | 3 => CB4_3_1I2R3H + | 4 => CB4_3_1I2R4H + | 5 => CB4_3_1I2R5H + | 6 => CB4_3_1I2R6H + | 7 => CB4_3_1I2R7H + | 8 => CB4_3_1I2R8H + | 9 => CB4_3_1I2R9H + | 10 => CB4_3_1I2R10H + | 11 => CB4_3_1I2R11H + | 12 => CB4_3_1I2R12H + | 13 => CB4_3_1I2R13H + | 14 => CB4_3_1I2R14H + | 15 => CB4_3_1I2R15H + | 16 => CB4_3_1I2R16H + | _ => (.exact 0) +lemma CB4_3_1I2ResidualEntropies_sound (k : Fin 17) : + (CB4_3_1I2ResidualEntropies k).Encloses (homogeneousEntropy + (residualLaw (below (shape 4 3 1)) (fun u => (stageBLaw (shape 4 3 1) u : ℝ)) (stageBPriority (shape 4 3 1)) 2 (fun u a => (littleLaw (shape 4 3 1) u ((stageBPriority (shape 4 3 1)) 2) a : ℝ)) k)) := by + fin_cases k + · exact CB4_3_1I2R0H_sound + · exact CB4_3_1I2R1H_sound + · exact CB4_3_1I2R2H_sound + · exact CB4_3_1I2R3H_sound + · exact CB4_3_1I2R4H_sound + · exact CB4_3_1I2R5H_sound + · exact CB4_3_1I2R6H_sound + · exact CB4_3_1I2R7H_sound + · exact CB4_3_1I2R8H_sound + · exact CB4_3_1I2R9H_sound + · exact CB4_3_1I2R10H_sound + · exact CB4_3_1I2R11H_sound + · exact CB4_3_1I2R12H_sound + · exact CB4_3_1I2R13H_sound + · exact CB4_3_1I2R14H_sound + · exact CB4_3_1I2R15H_sound + · exact CB4_3_1I2R16H_sound +def CB4_3_1I2S1_3_0Value (a : Fin 6) : ℝ := (littleLaw (shape 4 3 1) (shape 1 3 0) ((stageBPriority (shape 4 3 1)) 2) a : ℝ) +def CB4_3_1I2S1_3_0E_1Log : Ball := .exact 0 +lemma CB4_3_1I2S1_3_0E_1Log_sound : CB4_3_1I2S1_3_0E_1Log.Encloses (Real.log (CB4_3_1I2S1_3_0Value (1 : Fin 6))) := by + exact log_exact_one_ball ((B4_3_1Little_sound (shape 1 3 0) ((stageBPriority (shape 4 3 1)) 2)) (1 : Fin 6)) +def CB4_3_1I2S1_3_0E_1 : Ball := ⟨0, 0⟩ +lemma CB4_3_1I2S1_3_0E_1_sound : CB4_3_1I2S1_3_0E_1.Encloses (Foundation.entropyTerm (CB4_3_1I2S1_3_0Value (1 : Fin 6))) := by + exact contains_sound (entropyTerm_ball ((B4_3_1Little_sound (shape 1 3 0) ((stageBPriority (shape 4 3 1)) 2)) (1 : Fin 6)) CB4_3_1I2S1_3_0E_1Log_sound) (by decide +kernel) +def CB4_3_1I2S1_3_0Terms (a : Fin 6) : Ball := + match a.val with + | 1 => ⟨0, 0⟩ + | _ => (.exact 0) +lemma CB4_3_1I2S1_3_0Terms_sound (a : Fin 6) : + (CB4_3_1I2S1_3_0Terms a).Encloses (Foundation.entropyTerm (CB4_3_1I2S1_3_0Value a)) := by + fin_cases a + · exact (entropyTerm_zero_ball ((B4_3_1Little_sound (shape 1 3 0) ((stageBPriority (shape 4 3 1)) 2)) (0 : Fin 6))) + · exact CB4_3_1I2S1_3_0E_1_sound + · exact (entropyTerm_zero_ball ((B4_3_1Little_sound (shape 1 3 0) ((stageBPriority (shape 4 3 1)) 2)) (2 : Fin 6))) + · exact (entropyTerm_zero_ball ((B4_3_1Little_sound (shape 1 3 0) ((stageBPriority (shape 4 3 1)) 2)) (3 : Fin 6))) + · exact (entropyTerm_zero_ball ((B4_3_1Little_sound (shape 1 3 0) ((stageBPriority (shape 4 3 1)) 2)) (4 : Fin 6))) + · exact (entropyTerm_zero_ball ((B4_3_1Little_sound (shape 1 3 0) ((stageBPriority (shape 4 3 1)) 2)) (5 : Fin 6))) +def CB4_3_1I2S1_3_0Entropy : Ball := ⟨0, 0⟩ +lemma CB4_3_1I2S1_3_0Entropy_sound : CB4_3_1I2S1_3_0Entropy.Encloses (Foundation.finiteEntropy CB4_3_1I2S1_3_0Value) := by + exact contains_sound (entropyFin_enclosed 6 CB4_3_1I2S1_3_0Value CB4_3_1I2S1_3_0Terms CB4_3_1I2S1_3_0Terms_sound) (by decide +kernel) +def CB4_3_1I2S1_3_0Mass : Ball := ⟨1, 0⟩ +lemma CB4_3_1I2S1_3_0Mass_sound : CB4_3_1I2S1_3_0Mass.Encloses (∑ a, CB4_3_1I2S1_3_0Value a) := by + exact contains_sound (finSumBall_sound 6 (B4_3_1Little (shape 1 3 0) ((stageBPriority (shape 4 3 1)) 2)) CB4_3_1I2S1_3_0Value (B4_3_1Little_sound (shape 1 3 0) ((stageBPriority (shape 4 3 1)) 2))) (by decide +kernel) +def CB4_3_1I2S1_3_0MassTermLog : Ball := .exact 0 +lemma CB4_3_1I2S1_3_0MassTermLog_sound : CB4_3_1I2S1_3_0MassTermLog.Encloses (Real.log ((∑ a, CB4_3_1I2S1_3_0Value a))) := by + exact log_exact_one_ball (CB4_3_1I2S1_3_0Mass_sound) +def CB4_3_1I2S1_3_0MassTerm : Ball := ⟨0, 0⟩ +lemma CB4_3_1I2S1_3_0MassTerm_sound : CB4_3_1I2S1_3_0MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB4_3_1I2S1_3_0Value a))) := by + exact contains_sound (entropyTerm_ball (CB4_3_1I2S1_3_0Mass_sound) CB4_3_1I2S1_3_0MassTermLog_sound) (by decide +kernel) +def CB4_3_1I2S1_3_0H : Ball := ⟨0, 0⟩ +lemma CB4_3_1I2S1_3_0H_sound : CB4_3_1I2S1_3_0H.Encloses (homogeneousEntropy CB4_3_1I2S1_3_0Value) := by + exact contains_sound (homogeneous_enclosed CB4_3_1I2S1_3_0Value CB4_3_1I2S1_3_0MassTerm_sound CB4_3_1I2S1_3_0Entropy_sound) (by decide +kernel) +def CB4_3_1I2S2_2_0Value (a : Fin 6) : ℝ := (littleLaw (shape 4 3 1) (shape 2 2 0) ((stageBPriority (shape 4 3 1)) 2) a : ℝ) +def CB4_3_1I2S2_2_0E_2LogWitness : LogWitness := ⟨-1, 451979, 250000⟩ +def CB4_3_1I2S2_2_0E_2Log : Ball := ⟨(-1009723798462591586934335088673 / 10000000000000000000000000000000), (21175823683 / 50000000000000000000000000000000)⟩ +lemma CB4_3_1I2S2_2_0E_2Log_sound : CB4_3_1I2S2_2_0E_2Log.Encloses (Real.log (CB4_3_1I2S2_2_0Value (2 : Fin 6))) := by + exact checkLog_sound logTwoBall_sound ((B4_3_1Little_sound (shape 2 2 0) ((stageBPriority (shape 4 3 1)) 2)) (2 : Fin 6)) (w := CB4_3_1I2S2_2_0E_2LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB4_3_1I2S2_2_0E_2 : Ball := ⟨(9127479054106473657419876780867 / 100000000000000000000000000000000), (765682209 / 2000000000000000000000000000000)⟩ +lemma CB4_3_1I2S2_2_0E_2_sound : CB4_3_1I2S2_2_0E_2.Encloses (Foundation.entropyTerm (CB4_3_1I2S2_2_0Value (2 : Fin 6))) := by + exact contains_sound (entropyTerm_ball ((B4_3_1Little_sound (shape 2 2 0) ((stageBPriority (shape 4 3 1)) 2)) (2 : Fin 6)) CB4_3_1I2S2_2_0E_2Log_sound) (by decide +kernel) +def CB4_3_1I2S2_2_0E_3LogWitness : LogWitness := ⟨-4, 48021, 31250⟩ +def CB4_3_1I2S2_2_0E_3Log : Ball := ⟨(-234296968318952155799785664084377 / 100000000000000000000000000000000), (52939559207 / 50000000000000000000000000000000)⟩ +lemma CB4_3_1I2S2_2_0E_3Log_sound : CB4_3_1I2S2_2_0E_3Log.Encloses (Real.log (CB4_3_1I2S2_2_0Value (3 : Fin 6))) := by + exact checkLog_sound logTwoBall_sound ((B4_3_1Little_sound (shape 2 2 0) ((stageBPriority (shape 4 3 1)) 2)) (3 : Fin 6)) (w := CB4_3_1I2S2_2_0E_3LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB4_3_1I2S2_2_0E_3 : Ball := ⟨(2812793678911100368415376843749 / 12500000000000000000000000000000), (10168842291 / 100000000000000000000000000000000)⟩ +lemma CB4_3_1I2S2_2_0E_3_sound : CB4_3_1I2S2_2_0E_3.Encloses (Foundation.entropyTerm (CB4_3_1I2S2_2_0Value (3 : Fin 6))) := by + exact contains_sound (entropyTerm_ball ((B4_3_1Little_sound (shape 2 2 0) ((stageBPriority (shape 4 3 1)) 2)) (3 : Fin 6)) CB4_3_1I2S2_2_0E_3Log_sound) (by decide +kernel) +def CB4_3_1I2S2_2_0Terms (a : Fin 6) : Ball := + match a.val with + | 2 => ⟨(9127479054106473657419876780867 / 100000000000000000000000000000000), (765682209 / 2000000000000000000000000000000)⟩ + | 3 => ⟨(2812793678911100368415376843749 / 12500000000000000000000000000000), (10168842291 / 100000000000000000000000000000000)⟩ + | _ => (.exact 0) +lemma CB4_3_1I2S2_2_0Terms_sound (a : Fin 6) : + (CB4_3_1I2S2_2_0Terms a).Encloses (Foundation.entropyTerm (CB4_3_1I2S2_2_0Value a)) := by + fin_cases a + · exact (entropyTerm_zero_ball ((B4_3_1Little_sound (shape 2 2 0) ((stageBPriority (shape 4 3 1)) 2)) (0 : Fin 6))) + · exact (entropyTerm_zero_ball ((B4_3_1Little_sound (shape 2 2 0) ((stageBPriority (shape 4 3 1)) 2)) (1 : Fin 6))) + · exact CB4_3_1I2S2_2_0E_2_sound + · exact CB4_3_1I2S2_2_0E_3_sound + · exact (entropyTerm_zero_ball ((B4_3_1Little_sound (shape 2 2 0) ((stageBPriority (shape 4 3 1)) 2)) (4 : Fin 6))) + · exact (entropyTerm_zero_ball ((B4_3_1Little_sound (shape 2 2 0) ((stageBPriority (shape 4 3 1)) 2)) (5 : Fin 6))) +def CB4_3_1I2S2_2_0Entropy : Ball := ⟨(31629828485395276604742891530859 / 100000000000000000000000000000000), (48452952741 / 100000000000000000000000000000000)⟩ +lemma CB4_3_1I2S2_2_0Entropy_sound : CB4_3_1I2S2_2_0Entropy.Encloses (Foundation.finiteEntropy CB4_3_1I2S2_2_0Value) := by + exact contains_sound (entropyFin_enclosed 6 CB4_3_1I2S2_2_0Value CB4_3_1I2S2_2_0Terms CB4_3_1I2S2_2_0Terms_sound) (by decide +kernel) +def CB4_3_1I2S2_2_0Mass : Ball := ⟨1, 0⟩ +lemma CB4_3_1I2S2_2_0Mass_sound : CB4_3_1I2S2_2_0Mass.Encloses (∑ a, CB4_3_1I2S2_2_0Value a) := by + exact contains_sound (finSumBall_sound 6 (B4_3_1Little (shape 2 2 0) ((stageBPriority (shape 4 3 1)) 2)) CB4_3_1I2S2_2_0Value (B4_3_1Little_sound (shape 2 2 0) ((stageBPriority (shape 4 3 1)) 2))) (by decide +kernel) +def CB4_3_1I2S2_2_0MassTermLog : Ball := .exact 0 +lemma CB4_3_1I2S2_2_0MassTermLog_sound : CB4_3_1I2S2_2_0MassTermLog.Encloses (Real.log ((∑ a, CB4_3_1I2S2_2_0Value a))) := by + exact log_exact_one_ball (CB4_3_1I2S2_2_0Mass_sound) +def CB4_3_1I2S2_2_0MassTerm : Ball := ⟨0, 0⟩ +lemma CB4_3_1I2S2_2_0MassTerm_sound : CB4_3_1I2S2_2_0MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB4_3_1I2S2_2_0Value a))) := by + exact contains_sound (entropyTerm_ball (CB4_3_1I2S2_2_0Mass_sound) CB4_3_1I2S2_2_0MassTermLog_sound) (by decide +kernel) +def CB4_3_1I2S2_2_0H : Ball := ⟨(31629828485395276604742891530859 / 100000000000000000000000000000000), (48452952741 / 100000000000000000000000000000000)⟩ +lemma CB4_3_1I2S2_2_0H_sound : CB4_3_1I2S2_2_0H.Encloses (homogeneousEntropy CB4_3_1I2S2_2_0Value) := by + exact contains_sound (homogeneous_enclosed CB4_3_1I2S2_2_0Value CB4_3_1I2S2_2_0MassTerm_sound CB4_3_1I2S2_2_0Entropy_sound) (by decide +kernel) +def CB4_3_1I2S3_0_1Value (a : Fin 6) : ℝ := (littleLaw (shape 4 3 1) (shape 3 0 1) ((stageBPriority (shape 4 3 1)) 2) a : ℝ) +def CB4_3_1I2S3_0_1E_4Log : Ball := .exact 0 +lemma CB4_3_1I2S3_0_1E_4Log_sound : CB4_3_1I2S3_0_1E_4Log.Encloses (Real.log (CB4_3_1I2S3_0_1Value (4 : Fin 6))) := by + exact log_exact_one_ball ((B4_3_1Little_sound (shape 3 0 1) ((stageBPriority (shape 4 3 1)) 2)) (4 : Fin 6)) +def CB4_3_1I2S3_0_1E_4 : Ball := ⟨0, 0⟩ +lemma CB4_3_1I2S3_0_1E_4_sound : CB4_3_1I2S3_0_1E_4.Encloses (Foundation.entropyTerm (CB4_3_1I2S3_0_1Value (4 : Fin 6))) := by + exact contains_sound (entropyTerm_ball ((B4_3_1Little_sound (shape 3 0 1) ((stageBPriority (shape 4 3 1)) 2)) (4 : Fin 6)) CB4_3_1I2S3_0_1E_4Log_sound) (by decide +kernel) +def CB4_3_1I2S3_0_1Terms (a : Fin 6) : Ball := + match a.val with + | 4 => ⟨0, 0⟩ + | _ => (.exact 0) +lemma CB4_3_1I2S3_0_1Terms_sound (a : Fin 6) : + (CB4_3_1I2S3_0_1Terms a).Encloses (Foundation.entropyTerm (CB4_3_1I2S3_0_1Value a)) := by + fin_cases a + · exact (entropyTerm_zero_ball ((B4_3_1Little_sound (shape 3 0 1) ((stageBPriority (shape 4 3 1)) 2)) (0 : Fin 6))) + · exact (entropyTerm_zero_ball ((B4_3_1Little_sound (shape 3 0 1) ((stageBPriority (shape 4 3 1)) 2)) (1 : Fin 6))) + · exact (entropyTerm_zero_ball ((B4_3_1Little_sound (shape 3 0 1) ((stageBPriority (shape 4 3 1)) 2)) (2 : Fin 6))) + · exact (entropyTerm_zero_ball ((B4_3_1Little_sound (shape 3 0 1) ((stageBPriority (shape 4 3 1)) 2)) (3 : Fin 6))) + · exact CB4_3_1I2S3_0_1E_4_sound + · exact (entropyTerm_zero_ball ((B4_3_1Little_sound (shape 3 0 1) ((stageBPriority (shape 4 3 1)) 2)) (5 : Fin 6))) +def CB4_3_1I2S3_0_1Entropy : Ball := ⟨0, 0⟩ +lemma CB4_3_1I2S3_0_1Entropy_sound : CB4_3_1I2S3_0_1Entropy.Encloses (Foundation.finiteEntropy CB4_3_1I2S3_0_1Value) := by + exact contains_sound (entropyFin_enclosed 6 CB4_3_1I2S3_0_1Value CB4_3_1I2S3_0_1Terms CB4_3_1I2S3_0_1Terms_sound) (by decide +kernel) +def CB4_3_1I2S3_0_1Mass : Ball := ⟨1, 0⟩ +lemma CB4_3_1I2S3_0_1Mass_sound : CB4_3_1I2S3_0_1Mass.Encloses (∑ a, CB4_3_1I2S3_0_1Value a) := by + exact contains_sound (finSumBall_sound 6 (B4_3_1Little (shape 3 0 1) ((stageBPriority (shape 4 3 1)) 2)) CB4_3_1I2S3_0_1Value (B4_3_1Little_sound (shape 3 0 1) ((stageBPriority (shape 4 3 1)) 2))) (by decide +kernel) +def CB4_3_1I2S3_0_1MassTermLog : Ball := .exact 0 +lemma CB4_3_1I2S3_0_1MassTermLog_sound : CB4_3_1I2S3_0_1MassTermLog.Encloses (Real.log ((∑ a, CB4_3_1I2S3_0_1Value a))) := by + exact log_exact_one_ball (CB4_3_1I2S3_0_1Mass_sound) +def CB4_3_1I2S3_0_1MassTerm : Ball := ⟨0, 0⟩ +lemma CB4_3_1I2S3_0_1MassTerm_sound : CB4_3_1I2S3_0_1MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB4_3_1I2S3_0_1Value a))) := by + exact contains_sound (entropyTerm_ball (CB4_3_1I2S3_0_1Mass_sound) CB4_3_1I2S3_0_1MassTermLog_sound) (by decide +kernel) +def CB4_3_1I2S3_0_1H : Ball := ⟨0, 0⟩ +lemma CB4_3_1I2S3_0_1H_sound : CB4_3_1I2S3_0_1H.Encloses (homogeneousEntropy CB4_3_1I2S3_0_1Value) := by + exact contains_sound (homogeneous_enclosed CB4_3_1I2S3_0_1Value CB4_3_1I2S3_0_1MassTerm_sound CB4_3_1I2S3_0_1Entropy_sound) (by decide +kernel) +def CB4_3_1I2S3_1_0Value (a : Fin 6) : ℝ := (littleLaw (shape 4 3 1) (shape 3 1 0) ((stageBPriority (shape 4 3 1)) 2) a : ℝ) +def CB4_3_1I2S3_1_0E_4Log : Ball := .exact 0 +lemma CB4_3_1I2S3_1_0E_4Log_sound : CB4_3_1I2S3_1_0E_4Log.Encloses (Real.log (CB4_3_1I2S3_1_0Value (4 : Fin 6))) := by + exact log_exact_one_ball ((B4_3_1Little_sound (shape 3 1 0) ((stageBPriority (shape 4 3 1)) 2)) (4 : Fin 6)) +def CB4_3_1I2S3_1_0E_4 : Ball := ⟨0, 0⟩ +lemma CB4_3_1I2S3_1_0E_4_sound : CB4_3_1I2S3_1_0E_4.Encloses (Foundation.entropyTerm (CB4_3_1I2S3_1_0Value (4 : Fin 6))) := by + exact contains_sound (entropyTerm_ball ((B4_3_1Little_sound (shape 3 1 0) ((stageBPriority (shape 4 3 1)) 2)) (4 : Fin 6)) CB4_3_1I2S3_1_0E_4Log_sound) (by decide +kernel) +def CB4_3_1I2S3_1_0Terms (a : Fin 6) : Ball := + match a.val with + | 4 => ⟨0, 0⟩ + | _ => (.exact 0) +lemma CB4_3_1I2S3_1_0Terms_sound (a : Fin 6) : + (CB4_3_1I2S3_1_0Terms a).Encloses (Foundation.entropyTerm (CB4_3_1I2S3_1_0Value a)) := by + fin_cases a + · exact (entropyTerm_zero_ball ((B4_3_1Little_sound (shape 3 1 0) ((stageBPriority (shape 4 3 1)) 2)) (0 : Fin 6))) + · exact (entropyTerm_zero_ball ((B4_3_1Little_sound (shape 3 1 0) ((stageBPriority (shape 4 3 1)) 2)) (1 : Fin 6))) + · exact (entropyTerm_zero_ball ((B4_3_1Little_sound (shape 3 1 0) ((stageBPriority (shape 4 3 1)) 2)) (2 : Fin 6))) + · exact (entropyTerm_zero_ball ((B4_3_1Little_sound (shape 3 1 0) ((stageBPriority (shape 4 3 1)) 2)) (3 : Fin 6))) + · exact CB4_3_1I2S3_1_0E_4_sound + · exact (entropyTerm_zero_ball ((B4_3_1Little_sound (shape 3 1 0) ((stageBPriority (shape 4 3 1)) 2)) (5 : Fin 6))) +def CB4_3_1I2S3_1_0Entropy : Ball := ⟨0, 0⟩ +lemma CB4_3_1I2S3_1_0Entropy_sound : CB4_3_1I2S3_1_0Entropy.Encloses (Foundation.finiteEntropy CB4_3_1I2S3_1_0Value) := by + exact contains_sound (entropyFin_enclosed 6 CB4_3_1I2S3_1_0Value CB4_3_1I2S3_1_0Terms CB4_3_1I2S3_1_0Terms_sound) (by decide +kernel) +def CB4_3_1I2S3_1_0Mass : Ball := ⟨1, 0⟩ +lemma CB4_3_1I2S3_1_0Mass_sound : CB4_3_1I2S3_1_0Mass.Encloses (∑ a, CB4_3_1I2S3_1_0Value a) := by + exact contains_sound (finSumBall_sound 6 (B4_3_1Little (shape 3 1 0) ((stageBPriority (shape 4 3 1)) 2)) CB4_3_1I2S3_1_0Value (B4_3_1Little_sound (shape 3 1 0) ((stageBPriority (shape 4 3 1)) 2))) (by decide +kernel) +def CB4_3_1I2S3_1_0MassTermLog : Ball := .exact 0 +lemma CB4_3_1I2S3_1_0MassTermLog_sound : CB4_3_1I2S3_1_0MassTermLog.Encloses (Real.log ((∑ a, CB4_3_1I2S3_1_0Value a))) := by + exact log_exact_one_ball (CB4_3_1I2S3_1_0Mass_sound) +def CB4_3_1I2S3_1_0MassTerm : Ball := ⟨0, 0⟩ +lemma CB4_3_1I2S3_1_0MassTerm_sound : CB4_3_1I2S3_1_0MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB4_3_1I2S3_1_0Value a))) := by + exact contains_sound (entropyTerm_ball (CB4_3_1I2S3_1_0Mass_sound) CB4_3_1I2S3_1_0MassTermLog_sound) (by decide +kernel) +def CB4_3_1I2S3_1_0H : Ball := ⟨0, 0⟩ +lemma CB4_3_1I2S3_1_0H_sound : CB4_3_1I2S3_1_0H.Encloses (homogeneousEntropy CB4_3_1I2S3_1_0Value) := by + exact contains_sound (homogeneous_enclosed CB4_3_1I2S3_1_0Value CB4_3_1I2S3_1_0MassTerm_sound CB4_3_1I2S3_1_0Entropy_sound) (by decide +kernel) +def CB4_3_1I2S4_0_0Value (a : Fin 6) : ℝ := (littleLaw (shape 4 3 1) (shape 4 0 0) ((stageBPriority (shape 4 3 1)) 2) a : ℝ) +def CB4_3_1I2S4_0_0E_5Log : Ball := .exact 0 +lemma CB4_3_1I2S4_0_0E_5Log_sound : CB4_3_1I2S4_0_0E_5Log.Encloses (Real.log (CB4_3_1I2S4_0_0Value (5 : Fin 6))) := by + exact log_exact_one_ball ((B4_3_1Little_sound (shape 4 0 0) ((stageBPriority (shape 4 3 1)) 2)) (5 : Fin 6)) +def CB4_3_1I2S4_0_0E_5 : Ball := ⟨0, 0⟩ +lemma CB4_3_1I2S4_0_0E_5_sound : CB4_3_1I2S4_0_0E_5.Encloses (Foundation.entropyTerm (CB4_3_1I2S4_0_0Value (5 : Fin 6))) := by + exact contains_sound (entropyTerm_ball ((B4_3_1Little_sound (shape 4 0 0) ((stageBPriority (shape 4 3 1)) 2)) (5 : Fin 6)) CB4_3_1I2S4_0_0E_5Log_sound) (by decide +kernel) +def CB4_3_1I2S4_0_0Terms (a : Fin 6) : Ball := + match a.val with + | 5 => ⟨0, 0⟩ + | _ => (.exact 0) +lemma CB4_3_1I2S4_0_0Terms_sound (a : Fin 6) : + (CB4_3_1I2S4_0_0Terms a).Encloses (Foundation.entropyTerm (CB4_3_1I2S4_0_0Value a)) := by + fin_cases a + · exact (entropyTerm_zero_ball ((B4_3_1Little_sound (shape 4 0 0) ((stageBPriority (shape 4 3 1)) 2)) (0 : Fin 6))) + · exact (entropyTerm_zero_ball ((B4_3_1Little_sound (shape 4 0 0) ((stageBPriority (shape 4 3 1)) 2)) (1 : Fin 6))) + · exact (entropyTerm_zero_ball ((B4_3_1Little_sound (shape 4 0 0) ((stageBPriority (shape 4 3 1)) 2)) (2 : Fin 6))) + · exact (entropyTerm_zero_ball ((B4_3_1Little_sound (shape 4 0 0) ((stageBPriority (shape 4 3 1)) 2)) (3 : Fin 6))) + · exact (entropyTerm_zero_ball ((B4_3_1Little_sound (shape 4 0 0) ((stageBPriority (shape 4 3 1)) 2)) (4 : Fin 6))) + · exact CB4_3_1I2S4_0_0E_5_sound +def CB4_3_1I2S4_0_0Entropy : Ball := ⟨0, 0⟩ +lemma CB4_3_1I2S4_0_0Entropy_sound : CB4_3_1I2S4_0_0Entropy.Encloses (Foundation.finiteEntropy CB4_3_1I2S4_0_0Value) := by + exact contains_sound (entropyFin_enclosed 6 CB4_3_1I2S4_0_0Value CB4_3_1I2S4_0_0Terms CB4_3_1I2S4_0_0Terms_sound) (by decide +kernel) +def CB4_3_1I2S4_0_0Mass : Ball := ⟨1, 0⟩ +lemma CB4_3_1I2S4_0_0Mass_sound : CB4_3_1I2S4_0_0Mass.Encloses (∑ a, CB4_3_1I2S4_0_0Value a) := by + exact contains_sound (finSumBall_sound 6 (B4_3_1Little (shape 4 0 0) ((stageBPriority (shape 4 3 1)) 2)) CB4_3_1I2S4_0_0Value (B4_3_1Little_sound (shape 4 0 0) ((stageBPriority (shape 4 3 1)) 2))) (by decide +kernel) +def CB4_3_1I2S4_0_0MassTermLog : Ball := .exact 0 +lemma CB4_3_1I2S4_0_0MassTermLog_sound : CB4_3_1I2S4_0_0MassTermLog.Encloses (Real.log ((∑ a, CB4_3_1I2S4_0_0Value a))) := by + exact log_exact_one_ball (CB4_3_1I2S4_0_0Mass_sound) +def CB4_3_1I2S4_0_0MassTerm : Ball := ⟨0, 0⟩ +lemma CB4_3_1I2S4_0_0MassTerm_sound : CB4_3_1I2S4_0_0MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB4_3_1I2S4_0_0Value a))) := by + exact contains_sound (entropyTerm_ball (CB4_3_1I2S4_0_0Mass_sound) CB4_3_1I2S4_0_0MassTermLog_sound) (by decide +kernel) +def CB4_3_1I2S4_0_0H : Ball := ⟨0, 0⟩ +lemma CB4_3_1I2S4_0_0H_sound : CB4_3_1I2S4_0_0H.Encloses (homogeneousEntropy CB4_3_1I2S4_0_0Value) := by + exact contains_sound (homogeneous_enclosed CB4_3_1I2S4_0_0Value CB4_3_1I2S4_0_0MassTerm_sound CB4_3_1I2S4_0_0Entropy_sound) (by decide +kernel) +def CB4_3_1I2Singles (s : Shape) : Ball := + match s 0, s 1, s 2 with + | 1, 3, 0 => CB4_3_1I2S1_3_0H + | 2, 2, 0 => CB4_3_1I2S2_2_0H + | 3, 0, 1 => CB4_3_1I2S3_0_1H + | 3, 1, 0 => CB4_3_1I2S3_1_0H + | 4, 0, 0 => CB4_3_1I2S4_0_0H + | _, _, _ => (.exact 0) +lemma CB4_3_1I2Singles_sound (u : Shape) (hu : u ∈ below (shape 4 3 1)) + (hd : designated (stageBPriority (shape 4 3 1)) 2 u) : + (CB4_3_1I2Singles u).Encloses (homogeneousEntropy ((fun u a => (littleLaw (shape 4 3 1) u ((stageBPriority (shape 4 3 1)) 2) a : ℝ)) u)) := by + rw [B4_3_1_below] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl + · exact (show ¬ designated (stageBPriority (shape 4 3 1)) 2 (shape 0 3 1) by decide +kernel) hd |>.elim + · exact (show ¬ designated (stageBPriority (shape 4 3 1)) 2 (shape 1 2 1) by decide +kernel) hd |>.elim + · exact CB4_3_1I2S1_3_0H_sound + · exact (show ¬ designated (stageBPriority (shape 4 3 1)) 2 (shape 2 1 1) by decide +kernel) hd |>.elim + · exact CB4_3_1I2S2_2_0H_sound + · exact CB4_3_1I2S3_0_1H_sound + · exact CB4_3_1I2S3_1_0H_sound + · exact CB4_3_1I2S4_0_0H_sound +def CB4_3_1I2Singleton : Ball := ⟨(6658894608170818068591068816867 / 50000000000000000000000000000000), (20401192247 / 100000000000000000000000000000000)⟩ +lemma CB4_3_1I2Singleton_sound : CB4_3_1I2Singleton.Encloses + (singletonEntropy (below (shape 4 3 1)) (fun u => (stageBLaw (shape 4 3 1) u : ℝ)) (stageBPriority (shape 4 3 1)) 2 (fun u a => (littleLaw (shape 4 3 1) u ((stageBPriority (shape 4 3 1)) 2) a : ℝ))) := by + exact contains_sound (singletonBall_sound (below (shape 4 3 1)) B4_3_1Law (fun u => (stageBLaw (shape 4 3 1) u : ℝ)) (stageBPriority (shape 4 3 1)) 2 + CB4_3_1I2Singles (fun u a => (littleLaw (shape 4 3 1) u ((stageBPriority (shape 4 3 1)) 2) a : ℝ)) (fun u _ => B4_3_1Law_sound u) CB4_3_1I2Singles_sound) (by decide +kernel) +def CB4_3_1I2Group : Ball := ⟨(2833924905054032449400630230991 / 20000000000000000000000000000000), (88201388991 / 100000000000000000000000000000000)⟩ +lemma CB4_3_1I2Group_sound : CB4_3_1I2Group.Encloses + (groupedEntropy (below (shape 4 3 1)) (fun u => (stageBLaw (shape 4 3 1) u : ℝ)) (stageBPriority (shape 4 3 1)) 2 (fun u a => (littleLaw (shape 4 3 1) u ((stageBPriority (shape 4 3 1)) 2) a : ℝ))) := by + exact contains_sound (Ball.add_sound CB4_3_1I2Singleton_sound + (finSumBall_sound 17 CB4_3_1I2ResidualEntropies _ CB4_3_1I2ResidualEntropies_sound)) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CB4_3_1I2H : Ball := ⟨(2388113383818970610863080126793 / 4000000000000000000000000000000), (64289221247 / 25000000000000000000000000000000)⟩ +lemma CB4_3_1I2_sound : CB4_3_1I2H.Encloses (stageBCapacity (shape 4 3 1) 2) := by + have hb := contains_sound (Ball.add_sound CB4_3_1I2PairH_sound + (Ball.neg_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) CB4_3_1I2Group_sound))) + (show contains (.add CB4_3_1I2PairH (.neg (.mul (.exact 2) CB4_3_1I2Group))) CB4_3_1I2H = true by decide +kernel) + unfold CB4_3_1I2PairValue at hb + simpa only [stageBCapacity, nativeCapacity, + show (2 : Fin 3) ≠ 0 by decide, ite_false, sub_eq_add_neg] using hb + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/CapacityB/CapB5_1_2I0.lean b/lean/OAI/LinearAlgebra/MatrixFields/CapacityB/CapB5_1_2I0.lean new file mode 100644 index 0000000000000000000000000000000000000000..bc29ce2993fe9b61da344e683bda55f41b03f3bf --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/CapacityB/CapB5_1_2I0.lean @@ -0,0 +1,72 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Certificates.SplitB5_1_2 + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CB5_1_2I0Value (a : Fin 17) : ℝ := marginal (below (shape 5 1 2)) (fun u => (stageBLaw (shape 5 1 2) u : ℝ)) ((stageBPriority (shape 5 1 2)) 0) a +def CB5_1_2I0Raw (a : Fin 17) : Ball := marginalBall (below (shape 5 1 2)) B5_1_2Law ((stageBPriority (shape 5 1 2)) 0) a +lemma CB5_1_2I0Raw_sound (a : Fin 17) : + (CB5_1_2I0Raw a).Encloses (CB5_1_2I0Value a) := by + exact marginalBall_sound (below (shape 5 1 2)) B5_1_2Law (fun u => (stageBLaw (shape 5 1 2) u : ℝ)) (fun u _ => B5_1_2Law_sound u) ((stageBPriority (shape 5 1 2)) 0) a +def CB5_1_2I0Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(1 / 2), (53 / 100000000000000000000000000000000)⟩ ⟨(6931471805599453094172319305033 / 20000000000000000000000000000000), (21175823773 / 100000000000000000000000000000000)⟩ ⟨(-6931471805599453094172319305033 / 10000000000000000000000000000000), (42351647471 / 100000000000000000000000000000000)⟩ ⟨-1, 1, 1⟩] +lemma CB5_1_2I0Certificates_valid : + CB5_1_2I0Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB5_1_2I0CertificateIndex (a : Fin 17) : ℕ := + match a.val with + | 1 => 1 + | 0 => 1 + | _ => 0 +def CB5_1_2I0P (a : Fin 17) : Ball := + (CompactCertificate.entropyLookup CB5_1_2I0Certificates (CB5_1_2I0CertificateIndex a)).input +lemma CB5_1_2I0P_check : ∀ a : Fin 17, contains (CB5_1_2I0Raw a) (CB5_1_2I0P a) = true := by + decide +kernel +lemma CB5_1_2I0P_sound (a : Fin 17) : + (CB5_1_2I0P a).Encloses (CB5_1_2I0Value a) := + contains_sound (CB5_1_2I0Raw_sound a) (CB5_1_2I0P_check a) +def CB5_1_2I0Terms (a : Fin 17) : Ball := + (CompactCertificate.entropyLookup CB5_1_2I0Certificates (CB5_1_2I0CertificateIndex a)).output +lemma CB5_1_2I0Terms_sound (a : Fin 17) : + (CB5_1_2I0Terms a).Encloses (Foundation.entropyTerm (CB5_1_2I0Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB5_1_2I0Certificates_valid + (CB5_1_2I0CertificateIndex a) (CB5_1_2I0P_sound a) +def CB5_1_2I0Entropy : Ball := ⟨(6931471805599453094172319305033 / 10000000000000000000000000000000), (21175823773 / 50000000000000000000000000000000)⟩ +lemma CB5_1_2I0Entropy_sound : CB5_1_2I0Entropy.Encloses (Foundation.finiteEntropy CB5_1_2I0Value) := by + exact contains_sound (entropyFin_enclosed 17 CB5_1_2I0Value CB5_1_2I0Terms CB5_1_2I0Terms_sound) (by decide +kernel) +def CB5_1_2I0Mass : Ball := ⟨1, (53 / 50000000000000000000000000000000)⟩ +lemma CB5_1_2I0Mass_sound : CB5_1_2I0Mass.Encloses (∑ a, CB5_1_2I0Value a) := by + exact contains_sound (finSumBall_sound 17 CB5_1_2I0P CB5_1_2I0Value CB5_1_2I0P_sound) (by decide +kernel) +def CB5_1_2I0MassTermLogWitness : LogWitness := ⟨0, 1, 1⟩ +def CB5_1_2I0MassTermLog : Ball := ⟨0, (5293955947 / 25000000000000000000000000000000)⟩ +lemma CB5_1_2I0MassTermLog_sound : CB5_1_2I0MassTermLog.Encloses (Real.log ((∑ a, CB5_1_2I0Value a))) := by + exact checkLog_sound logTwoBall_sound (CB5_1_2I0Mass_sound) (w := CB5_1_2I0MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB5_1_2I0MassTerm : Ball := ⟨0, (21175823789 / 100000000000000000000000000000000)⟩ +lemma CB5_1_2I0MassTerm_sound : CB5_1_2I0MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB5_1_2I0Value a))) := by + exact contains_sound (entropyTerm_ball (CB5_1_2I0Mass_sound) CB5_1_2I0MassTermLog_sound) (by decide +kernel) +def CB5_1_2I0H : Ball := ⟨(6931471805599453094172319305033 / 10000000000000000000000000000000), (12705494267 / 20000000000000000000000000000000)⟩ +lemma CB5_1_2I0H_sound : CB5_1_2I0H.Encloses (homogeneousEntropy CB5_1_2I0Value) := by + exact contains_sound (homogeneous_enclosed CB5_1_2I0Value CB5_1_2I0MassTerm_sound CB5_1_2I0Entropy_sound) (by decide +kernel) +lemma CB5_1_2I0_sound : CB5_1_2I0H.Encloses (stageBCapacity (shape 5 1 2) 0) := by + exact CB5_1_2I0H_sound + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/CapacityB/CapB5_1_2I1.lean b/lean/OAI/LinearAlgebra/MatrixFields/CapacityB/CapB5_1_2I1.lean new file mode 100644 index 0000000000000000000000000000000000000000..3de6b006c23e8c246624f7a7c70883bda53547bc --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/CapacityB/CapB5_1_2I1.lean @@ -0,0 +1,841 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Certificates.SupportedContraction + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CB5_1_2I1PairValue (a : PairSlot) : ℝ := pairLaw (below (shape 5 1 2)) (shape 5 1 2) (fun u => (stageBLaw (shape 5 1 2) u : ℝ)) (fun u a => (littleLaw (shape 5 1 2) u ((stageBPriority (shape 5 1 2)) 1) a : ℝ)) a +def CB5_1_2I1PairRaw (a : PairSlot) : Ball := pairLawBall (below (shape 5 1 2)) (shape 5 1 2) B5_1_2Law (fun u => B5_1_2Little u ((stageBPriority (shape 5 1 2)) 1)) a +lemma CB5_1_2I1PairRaw_sound (a : PairSlot) : + (CB5_1_2I1PairRaw a).Encloses (CB5_1_2I1PairValue a) := by + exact pairLawBall_sound_on (below (shape 5 1 2)) (shape 5 1 2) B5_1_2Law (fun u => (stageBLaw (shape 5 1 2) u : ℝ)) (fun u => B5_1_2Little u ((stageBPriority (shape 5 1 2)) 1)) (fun u a => (littleLaw (shape 5 1 2) u ((stageBPriority (shape 5 1 2)) 1) a : ℝ)) (fun u _ => B5_1_2Law_sound u) (fun u _ a => B5_1_2Little_sound u ((stageBPriority (shape 5 1 2)) 1) a) (fun u _ a => B5_1_2Little_sound (complement (shape 5 1 2) u) ((stageBPriority (shape 5 1 2)) 1) a) a +def CB5_1_2I1PairCertificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(16505214817994806105572714739171 / 100000000000000000000000000000000), (33 / 100000000000000000000000000000000)⟩ ⟨(29734042252061927929320034727547 / 100000000000000000000000000000000), (6990230423 / 50000000000000000000000000000000)⟩ ⟨(-90074690271963004686404362733121 / 50000000000000000000000000000000), (84703294931 / 100000000000000000000000000000000)⟩ ⟨-3, 16505214817994806105572714739171, 12500000000000000000000000000000⟩, + .log ⟨(49570105911377387117154514831 / 2500000000000000000000000000000), (1 / 20000000000000000000000000000000)⟩ ⟨(7773897415469105343374013757949 / 100000000000000000000000000000000), (2939125929 / 100000000000000000000000000000000)⟩ ⟨(-7841316124447528729465058620191 / 2000000000000000000000000000000), (9264422877 / 6250000000000000000000000000000)⟩ ⟨-6, 49570105911377387117154514831, 39062500000000000000000000000⟩, + .log ⟨(31511980945550098409741104667589 / 50000000000000000000000000000000), (17 / 50000000000000000000000000000000)⟩ ⟨(29095338750505488883321329985571 / 100000000000000000000000000000000), (13345843073 / 50000000000000000000000000000000)⟩ ⟨(-9233103688650880947564362099801 / 20000000000000000000000000000000), (42351647419 / 100000000000000000000000000000000)⟩ ⟨-1, 31511980945550098409741104667589, 25000000000000000000000000000000⟩] +lemma CB5_1_2I1PairCertificates_valid : + CB5_1_2I1PairCertificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB5_1_2I1PairCertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 2, 0 => 1 + | 3, 0 => 2 + | 1, 1 => 3 + | 0, 2 => 1 + | 0, 3 => 2 + | _, _ => 0 +def CB5_1_2I1PairP (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CB5_1_2I1PairCertificates (CB5_1_2I1PairCertificateIndex a)).input +lemma CB5_1_2I1PairP_check : ∀ a : PairSlot, contains (CB5_1_2I1PairRaw a) (CB5_1_2I1PairP a) = true := by + decide +kernel +lemma CB5_1_2I1PairP_sound (a : PairSlot) : + (CB5_1_2I1PairP a).Encloses (CB5_1_2I1PairValue a) := + contains_sound (CB5_1_2I1PairRaw_sound a) (CB5_1_2I1PairP_check a) +def CB5_1_2I1PairTerms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CB5_1_2I1PairCertificates (CB5_1_2I1PairCertificateIndex a)).output +lemma CB5_1_2I1PairTerms_sound (a : PairSlot) : + (CB5_1_2I1PairTerms a).Encloses (Foundation.entropyTerm (CB5_1_2I1PairValue a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB5_1_2I1PairCertificates_valid + (CB5_1_2I1PairCertificateIndex a) (CB5_1_2I1PairP_sound a) +def CB5_1_2I1PairEntropy : Ball := ⟨(104111218085567555428709426956563 / 100000000000000000000000000000000), (3783178731 / 6250000000000000000000000000000)⟩ +lemma CB5_1_2I1PairEntropy_sound : CB5_1_2I1PairEntropy.Encloses (Foundation.finiteEntropy CB5_1_2I1PairValue) := by + exact contains_sound (entropyPair_enclosed CB5_1_2I1PairValue CB5_1_2I1PairTerms CB5_1_2I1PairTerms_sound) (by decide +kernel) +def CB5_1_2I1PairMass : Ball := ⟨1, (11 / 10000000000000000000000000000000)⟩ +lemma CB5_1_2I1PairMass_sound : CB5_1_2I1PairMass.Encloses (∑ a, CB5_1_2I1PairValue a) := by + exact contains_sound (pairSumBall_sound CB5_1_2I1PairP CB5_1_2I1PairValue CB5_1_2I1PairP_sound) (by decide +kernel) +def CB5_1_2I1PairMassTermLogWitness : LogWitness := ⟨0, 1, 1⟩ +def CB5_1_2I1PairMassTermLog : Ball := ⟨0, (1323488987 / 6250000000000000000000000000000)⟩ +lemma CB5_1_2I1PairMassTermLog_sound : CB5_1_2I1PairMassTermLog.Encloses (Real.log ((∑ a, CB5_1_2I1PairValue a))) := by + exact checkLog_sound logTwoBall_sound (CB5_1_2I1PairMass_sound) (w := CB5_1_2I1PairMassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB5_1_2I1PairMassTerm : Ball := ⟨0, (21175823793 / 100000000000000000000000000000000)⟩ +lemma CB5_1_2I1PairMassTerm_sound : CB5_1_2I1PairMassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB5_1_2I1PairValue a))) := by + exact contains_sound (entropyTerm_ball (CB5_1_2I1PairMass_sound) CB5_1_2I1PairMassTermLog_sound) (by decide +kernel) +def CB5_1_2I1PairH : Ball := ⟨(104111218085567555428709426956563 / 100000000000000000000000000000000), (81706683489 / 100000000000000000000000000000000)⟩ +lemma CB5_1_2I1PairH_sound : CB5_1_2I1PairH.Encloses (homogeneousEntropy CB5_1_2I1PairValue) := by + exact contains_sound (homogeneous_enclosed CB5_1_2I1PairValue CB5_1_2I1PairMassTerm_sound CB5_1_2I1PairEntropy_sound) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CB5_1_2I1R0Value (a : Fin 6) : ℝ := residualLaw (below (shape 5 1 2)) (fun u => (stageBLaw (shape 5 1 2) u : ℝ)) (stageBPriority (shape 5 1 2)) 1 (fun u a => (littleLaw (shape 5 1 2) u ((stageBPriority (shape 5 1 2)) 1) a : ℝ)) 0 a +def CB5_1_2I1R0Raw (a : Fin 6) : Ball := residualBall (below (shape 5 1 2)) B5_1_2Law (stageBPriority (shape 5 1 2)) 1 (fun u => B5_1_2Little u ((stageBPriority (shape 5 1 2)) 1)) 0 a +lemma CB5_1_2I1R0Raw_sound (a : Fin 6) : + (CB5_1_2I1R0Raw a).Encloses (CB5_1_2I1R0Value a) := by + exact residualBall_sound_on (below (shape 5 1 2)) B5_1_2Law (fun u => (stageBLaw (shape 5 1 2) u : ℝ)) (stageBPriority (shape 5 1 2)) 1 (fun u => B5_1_2Little u ((stageBPriority (shape 5 1 2)) 1)) (fun u a => (littleLaw (shape 5 1 2) u ((stageBPriority (shape 5 1 2)) 1) a : ℝ)) (fun u _ => B5_1_2Law_sound u) (fun u _ a => B5_1_2Little_sound u ((stageBPriority (shape 5 1 2)) 1) a) 0 a +def CB5_1_2I1R0Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(18488019054449901590258895332411 / 100000000000000000000000000000000), (9 / 25000000000000000000000000000000)⟩ ⟨(31208650321412316625707562012269 / 100000000000000000000000000000000), (15659961367 / 100000000000000000000000000000000)⟩ ⟨(-168804728237775546533865029872577 / 100000000000000000000000000000000), (42351647463 / 50000000000000000000000000000000)⟩ ⟨-3, 18488019054449901590258895332411, 12500000000000000000000000000000⟩] +lemma CB5_1_2I1R0Certificates_valid : + CB5_1_2I1R0Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB5_1_2I1R0CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | 0 => 1 + | _ => 0 +def CB5_1_2I1R0P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB5_1_2I1R0Certificates (CB5_1_2I1R0CertificateIndex a)).input +lemma CB5_1_2I1R0P_check : ∀ a : Fin 6, contains (CB5_1_2I1R0Raw a) (CB5_1_2I1R0P a) = true := by + decide +kernel +lemma CB5_1_2I1R0P_sound (a : Fin 6) : + (CB5_1_2I1R0P a).Encloses (CB5_1_2I1R0Value a) := + contains_sound (CB5_1_2I1R0Raw_sound a) (CB5_1_2I1R0P_check a) +def CB5_1_2I1R0Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB5_1_2I1R0Certificates (CB5_1_2I1R0CertificateIndex a)).output +lemma CB5_1_2I1R0Terms_sound (a : Fin 6) : + (CB5_1_2I1R0Terms a).Encloses (Foundation.entropyTerm (CB5_1_2I1R0Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB5_1_2I1R0Certificates_valid + (CB5_1_2I1R0CertificateIndex a) (CB5_1_2I1R0P_sound a) +def CB5_1_2I1R0Entropy : Ball := ⟨(31208650321412316625707562012269 / 100000000000000000000000000000000), (15659961367 / 100000000000000000000000000000000)⟩ +lemma CB5_1_2I1R0Entropy_sound : CB5_1_2I1R0Entropy.Encloses (Foundation.finiteEntropy CB5_1_2I1R0Value) := by + exact contains_sound (entropyFin_enclosed 6 CB5_1_2I1R0Value CB5_1_2I1R0Terms CB5_1_2I1R0Terms_sound) (by decide +kernel) +def CB5_1_2I1R0Mass : Ball := ⟨(18488019054449901590258895332411 / 100000000000000000000000000000000), (9 / 25000000000000000000000000000000)⟩ +lemma CB5_1_2I1R0Mass_sound : CB5_1_2I1R0Mass.Encloses (∑ a, CB5_1_2I1R0Value a) := by + exact contains_sound (finSumBall_sound 6 CB5_1_2I1R0P CB5_1_2I1R0Value CB5_1_2I1R0P_sound) (by decide +kernel) +def CB5_1_2I1R0MassTermLogWitness : LogWitness := ⟨-3, 18488019054449901590258895332411, 12500000000000000000000000000000⟩ +def CB5_1_2I1R0MassTermLog : Ball := ⟨(-168804728237775546533865029872577 / 100000000000000000000000000000000), (42351647463 / 50000000000000000000000000000000)⟩ +lemma CB5_1_2I1R0MassTermLog_sound : CB5_1_2I1R0MassTermLog.Encloses (Real.log ((∑ a, CB5_1_2I1R0Value a))) := by + exact checkLog_sound logTwoBall_sound (CB5_1_2I1R0Mass_sound) (w := CB5_1_2I1R0MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB5_1_2I1R0MassTerm : Ball := ⟨(31208650321412316625707562012269 / 100000000000000000000000000000000), (15659961367 / 100000000000000000000000000000000)⟩ +lemma CB5_1_2I1R0MassTerm_sound : CB5_1_2I1R0MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB5_1_2I1R0Value a))) := by + exact contains_sound (entropyTerm_ball (CB5_1_2I1R0Mass_sound) CB5_1_2I1R0MassTermLog_sound) (by decide +kernel) +def CB5_1_2I1R0H : Ball := ⟨0, (15659961367 / 50000000000000000000000000000000)⟩ +lemma CB5_1_2I1R0H_sound : CB5_1_2I1R0H.Encloses (homogeneousEntropy CB5_1_2I1R0Value) := by + exact contains_sound (homogeneous_enclosed CB5_1_2I1R0Value CB5_1_2I1R0MassTerm_sound CB5_1_2I1R0Entropy_sound) (by decide +kernel) +def CB5_1_2I1R1Value (a : Fin 6) : ℝ := residualLaw (below (shape 5 1 2)) (fun u => (stageBLaw (shape 5 1 2) u : ℝ)) (stageBPriority (shape 5 1 2)) 1 (fun u a => (littleLaw (shape 5 1 2) u ((stageBPriority (shape 5 1 2)) 1) a : ℝ)) 1 a +def CB5_1_2I1R1Raw (a : Fin 6) : Ball := residualBall (below (shape 5 1 2)) B5_1_2Law (stageBPriority (shape 5 1 2)) 1 (fun u => B5_1_2Little u ((stageBPriority (shape 5 1 2)) 1)) 1 a +lemma CB5_1_2I1R1Raw_sound (a : Fin 6) : + (CB5_1_2I1R1Raw a).Encloses (CB5_1_2I1R1Value a) := by + exact residualBall_sound_on (below (shape 5 1 2)) B5_1_2Law (fun u => (stageBLaw (shape 5 1 2) u : ℝ)) (stageBPriority (shape 5 1 2)) 1 (fun u => B5_1_2Little u ((stageBPriority (shape 5 1 2)) 1)) (fun u a => (littleLaw (shape 5 1 2) u ((stageBPriority (shape 5 1 2)) 1) a : ℝ)) (fun u _ => B5_1_2Law_sound u) (fun u _ a => B5_1_2Little_sound u ((stageBPriority (shape 5 1 2)) 1) a) 1 a +def CB5_1_2I1R1Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(31511980945550098409741104667589 / 50000000000000000000000000000000), (17 / 50000000000000000000000000000000)⟩ ⟨(29095338750505488883321329985571 / 100000000000000000000000000000000), (13345843073 / 50000000000000000000000000000000)⟩ ⟨(-9233103688650880947564362099801 / 20000000000000000000000000000000), (42351647419 / 100000000000000000000000000000000)⟩ ⟨-1, 31511980945550098409741104667589, 25000000000000000000000000000000⟩] +lemma CB5_1_2I1R1Certificates_valid : + CB5_1_2I1R1Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB5_1_2I1R1CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | 1 => 1 + | _ => 0 +def CB5_1_2I1R1P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB5_1_2I1R1Certificates (CB5_1_2I1R1CertificateIndex a)).input +lemma CB5_1_2I1R1P_check : ∀ a : Fin 6, contains (CB5_1_2I1R1Raw a) (CB5_1_2I1R1P a) = true := by + decide +kernel +lemma CB5_1_2I1R1P_sound (a : Fin 6) : + (CB5_1_2I1R1P a).Encloses (CB5_1_2I1R1Value a) := + contains_sound (CB5_1_2I1R1Raw_sound a) (CB5_1_2I1R1P_check a) +def CB5_1_2I1R1Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB5_1_2I1R1Certificates (CB5_1_2I1R1CertificateIndex a)).output +lemma CB5_1_2I1R1Terms_sound (a : Fin 6) : + (CB5_1_2I1R1Terms a).Encloses (Foundation.entropyTerm (CB5_1_2I1R1Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB5_1_2I1R1Certificates_valid + (CB5_1_2I1R1CertificateIndex a) (CB5_1_2I1R1P_sound a) +def CB5_1_2I1R1Entropy : Ball := ⟨(29095338750505488883321329985571 / 100000000000000000000000000000000), (13345843073 / 50000000000000000000000000000000)⟩ +lemma CB5_1_2I1R1Entropy_sound : CB5_1_2I1R1Entropy.Encloses (Foundation.finiteEntropy CB5_1_2I1R1Value) := by + exact contains_sound (entropyFin_enclosed 6 CB5_1_2I1R1Value CB5_1_2I1R1Terms CB5_1_2I1R1Terms_sound) (by decide +kernel) +def CB5_1_2I1R1Mass : Ball := ⟨(31511980945550098409741104667589 / 50000000000000000000000000000000), (17 / 50000000000000000000000000000000)⟩ +lemma CB5_1_2I1R1Mass_sound : CB5_1_2I1R1Mass.Encloses (∑ a, CB5_1_2I1R1Value a) := by + exact contains_sound (finSumBall_sound 6 CB5_1_2I1R1P CB5_1_2I1R1Value CB5_1_2I1R1P_sound) (by decide +kernel) +def CB5_1_2I1R1MassTermLogWitness : LogWitness := ⟨-1, 31511980945550098409741104667589, 25000000000000000000000000000000⟩ +def CB5_1_2I1R1MassTermLog : Ball := ⟨(-9233103688650880947564362099801 / 20000000000000000000000000000000), (42351647419 / 100000000000000000000000000000000)⟩ +lemma CB5_1_2I1R1MassTermLog_sound : CB5_1_2I1R1MassTermLog.Encloses (Real.log ((∑ a, CB5_1_2I1R1Value a))) := by + exact checkLog_sound logTwoBall_sound (CB5_1_2I1R1Mass_sound) (w := CB5_1_2I1R1MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB5_1_2I1R1MassTerm : Ball := ⟨(29095338750505488883321329985571 / 100000000000000000000000000000000), (13345843073 / 50000000000000000000000000000000)⟩ +lemma CB5_1_2I1R1MassTerm_sound : CB5_1_2I1R1MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB5_1_2I1R1Value a))) := by + exact contains_sound (entropyTerm_ball (CB5_1_2I1R1Mass_sound) CB5_1_2I1R1MassTermLog_sound) (by decide +kernel) +def CB5_1_2I1R1H : Ball := ⟨0, (13345843073 / 25000000000000000000000000000000)⟩ +lemma CB5_1_2I1R1H_sound : CB5_1_2I1R1H.Encloses (homogeneousEntropy CB5_1_2I1R1Value) := by + exact contains_sound (homogeneous_enclosed CB5_1_2I1R1Value CB5_1_2I1R1MassTerm_sound CB5_1_2I1R1Entropy_sound) (by decide +kernel) +def CB5_1_2I1R2Value (a : Fin 6) : ℝ := residualLaw (below (shape 5 1 2)) (fun u => (stageBLaw (shape 5 1 2) u : ℝ)) (stageBPriority (shape 5 1 2)) 1 (fun u a => (littleLaw (shape 5 1 2) u ((stageBPriority (shape 5 1 2)) 1) a : ℝ)) 2 a +def CB5_1_2I1R2Raw (a : Fin 6) : Ball := residualBall (below (shape 5 1 2)) B5_1_2Law (stageBPriority (shape 5 1 2)) 1 (fun u => B5_1_2Little u ((stageBPriority (shape 5 1 2)) 1)) 2 a +lemma CB5_1_2I1R2Raw_sound (a : Fin 6) : + (CB5_1_2I1R2Raw a).Encloses (CB5_1_2I1R2Value a) := by + exact residualBall_sound_on (below (shape 5 1 2)) B5_1_2Law (fun u => (stageBLaw (shape 5 1 2) u : ℝ)) (stageBPriority (shape 5 1 2)) 1 (fun u => B5_1_2Little u ((stageBPriority (shape 5 1 2)) 1)) (fun u a => (littleLaw (shape 5 1 2) u ((stageBPriority (shape 5 1 2)) 1) a : ℝ)) (fun u _ => B5_1_2Law_sound u) (fun u _ a => B5_1_2Little_sound u ((stageBPriority (shape 5 1 2)) 1) a) 2 a +def CB5_1_2I1R2Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(16505214817994806105572714739171 / 100000000000000000000000000000000), (33 / 100000000000000000000000000000000)⟩ ⟨(29734042252061927929320034727547 / 100000000000000000000000000000000), (6990230423 / 50000000000000000000000000000000)⟩ ⟨(-90074690271963004686404362733121 / 50000000000000000000000000000000), (84703294931 / 100000000000000000000000000000000)⟩ ⟨-3, 16505214817994806105572714739171, 12500000000000000000000000000000⟩, + .log ⟨(49570105911377387117154514831 / 2500000000000000000000000000000), (1 / 20000000000000000000000000000000)⟩ ⟨(7773897415469105343374013757949 / 100000000000000000000000000000000), (2939125929 / 100000000000000000000000000000000)⟩ ⟨(-7841316124447528729465058620191 / 2000000000000000000000000000000), (9264422877 / 6250000000000000000000000000000)⟩ ⟨-6, 49570105911377387117154514831, 39062500000000000000000000000⟩] +lemma CB5_1_2I1R2Certificates_valid : + CB5_1_2I1R2Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB5_1_2I1R2CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | 2 => 1 + | 3 => 2 + | _ => 0 +def CB5_1_2I1R2P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB5_1_2I1R2Certificates (CB5_1_2I1R2CertificateIndex a)).input +lemma CB5_1_2I1R2P_check : ∀ a : Fin 6, contains (CB5_1_2I1R2Raw a) (CB5_1_2I1R2P a) = true := by + decide +kernel +lemma CB5_1_2I1R2P_sound (a : Fin 6) : + (CB5_1_2I1R2P a).Encloses (CB5_1_2I1R2Value a) := + contains_sound (CB5_1_2I1R2Raw_sound a) (CB5_1_2I1R2P_check a) +def CB5_1_2I1R2Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB5_1_2I1R2Certificates (CB5_1_2I1R2CertificateIndex a)).output +lemma CB5_1_2I1R2Terms_sound (a : Fin 6) : + (CB5_1_2I1R2Terms a).Encloses (Foundation.entropyTerm (CB5_1_2I1R2Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB5_1_2I1R2Certificates_valid + (CB5_1_2I1R2CertificateIndex a) (CB5_1_2I1R2P_sound a) +def CB5_1_2I1R2Entropy : Ball := ⟨(4688492458441379159086756060687 / 12500000000000000000000000000000), (676783471 / 4000000000000000000000000000000)⟩ +lemma CB5_1_2I1R2Entropy_sound : CB5_1_2I1R2Entropy.Encloses (Foundation.finiteEntropy CB5_1_2I1R2Value) := by + exact contains_sound (entropyFin_enclosed 6 CB5_1_2I1R2Value CB5_1_2I1R2Terms CB5_1_2I1R2Terms_sound) (by decide +kernel) +def CB5_1_2I1R2Mass : Ball := ⟨(18488019054449901590258895332411 / 100000000000000000000000000000000), (19 / 50000000000000000000000000000000)⟩ +lemma CB5_1_2I1R2Mass_sound : CB5_1_2I1R2Mass.Encloses (∑ a, CB5_1_2I1R2Value a) := by + exact contains_sound (finSumBall_sound 6 CB5_1_2I1R2P CB5_1_2I1R2Value CB5_1_2I1R2P_sound) (by decide +kernel) +def CB5_1_2I1R2MassTermLogWitness : LogWitness := ⟨-3, 18488019054449901590258895332411, 12500000000000000000000000000000⟩ +def CB5_1_2I1R2MassTermLog : Ball := ⟨(-168804728237775546533865029872577 / 100000000000000000000000000000000), (84703294937 / 100000000000000000000000000000000)⟩ +lemma CB5_1_2I1R2MassTermLog_sound : CB5_1_2I1R2MassTermLog.Encloses (Real.log ((∑ a, CB5_1_2I1R2Value a))) := by + exact checkLog_sound logTwoBall_sound (CB5_1_2I1R2Mass_sound) (w := CB5_1_2I1R2MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB5_1_2I1R2MassTerm : Ball := ⟨(31208650321412316625707562012269 / 100000000000000000000000000000000), (15659961373 / 100000000000000000000000000000000)⟩ +lemma CB5_1_2I1R2MassTerm_sound : CB5_1_2I1R2MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB5_1_2I1R2Value a))) := by + exact contains_sound (entropyTerm_ball (CB5_1_2I1R2Mass_sound) CB5_1_2I1R2MassTermLog_sound) (by decide +kernel) +def CB5_1_2I1R2H : Ball := ⟨(6299289346118716646986486473227 / 100000000000000000000000000000000), (8144887037 / 25000000000000000000000000000000)⟩ +lemma CB5_1_2I1R2H_sound : CB5_1_2I1R2H.Encloses (homogeneousEntropy CB5_1_2I1R2Value) := by + exact contains_sound (homogeneous_enclosed CB5_1_2I1R2Value CB5_1_2I1R2MassTerm_sound CB5_1_2I1R2Entropy_sound) (by decide +kernel) +def CB5_1_2I1R3Value (a : Fin 6) : ℝ := residualLaw (below (shape 5 1 2)) (fun u => (stageBLaw (shape 5 1 2) u : ℝ)) (stageBPriority (shape 5 1 2)) 1 (fun u a => (littleLaw (shape 5 1 2) u ((stageBPriority (shape 5 1 2)) 1) a : ℝ)) 3 a +def CB5_1_2I1R3Raw (a : Fin 6) : Ball := residualBall (below (shape 5 1 2)) B5_1_2Law (stageBPriority (shape 5 1 2)) 1 (fun u => B5_1_2Little u ((stageBPriority (shape 5 1 2)) 1)) 3 a +lemma CB5_1_2I1R3Raw_sound (a : Fin 6) : + (CB5_1_2I1R3Raw a).Encloses (CB5_1_2I1R3Value a) := by + exact residualBall_sound_on (below (shape 5 1 2)) B5_1_2Law (fun u => (stageBLaw (shape 5 1 2) u : ℝ)) (stageBPriority (shape 5 1 2)) 1 (fun u => B5_1_2Little u ((stageBPriority (shape 5 1 2)) 1)) (fun u a => (littleLaw (shape 5 1 2) u ((stageBPriority (shape 5 1 2)) 1) a : ℝ)) (fun u _ => B5_1_2Law_sound u) (fun u _ a => B5_1_2Little_sound u ((stageBPriority (shape 5 1 2)) 1) a) 3 a +def CB5_1_2I1R3Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB5_1_2I1R3Certificates_valid : + CB5_1_2I1R3Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB5_1_2I1R3CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB5_1_2I1R3P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB5_1_2I1R3Certificates (CB5_1_2I1R3CertificateIndex a)).input +lemma CB5_1_2I1R3P_check : ∀ a : Fin 6, contains (CB5_1_2I1R3Raw a) (CB5_1_2I1R3P a) = true := by + decide +kernel +lemma CB5_1_2I1R3P_sound (a : Fin 6) : + (CB5_1_2I1R3P a).Encloses (CB5_1_2I1R3Value a) := + contains_sound (CB5_1_2I1R3Raw_sound a) (CB5_1_2I1R3P_check a) +def CB5_1_2I1R3Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB5_1_2I1R3Certificates (CB5_1_2I1R3CertificateIndex a)).output +lemma CB5_1_2I1R3Terms_sound (a : Fin 6) : + (CB5_1_2I1R3Terms a).Encloses (Foundation.entropyTerm (CB5_1_2I1R3Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB5_1_2I1R3Certificates_valid + (CB5_1_2I1R3CertificateIndex a) (CB5_1_2I1R3P_sound a) +def CB5_1_2I1R3Entropy : Ball := ⟨0, 0⟩ +lemma CB5_1_2I1R3Entropy_sound : CB5_1_2I1R3Entropy.Encloses (Foundation.finiteEntropy CB5_1_2I1R3Value) := by + exact contains_sound (entropyFin_enclosed 6 CB5_1_2I1R3Value CB5_1_2I1R3Terms CB5_1_2I1R3Terms_sound) (by decide +kernel) +def CB5_1_2I1R3Mass : Ball := ⟨0, 0⟩ +lemma CB5_1_2I1R3Mass_sound : CB5_1_2I1R3Mass.Encloses (∑ a, CB5_1_2I1R3Value a) := by + exact contains_sound (finSumBall_sound 6 CB5_1_2I1R3P CB5_1_2I1R3Value CB5_1_2I1R3P_sound) (by decide +kernel) +def CB5_1_2I1R3MassTerm : Ball := .exact 0 +lemma CB5_1_2I1R3MassTerm_sound : CB5_1_2I1R3MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB5_1_2I1R3Value a))) := + entropyTerm_zero_ball (CB5_1_2I1R3Mass_sound) +def CB5_1_2I1R3H : Ball := ⟨0, 0⟩ +lemma CB5_1_2I1R3H_sound : CB5_1_2I1R3H.Encloses (homogeneousEntropy CB5_1_2I1R3Value) := by + exact contains_sound (homogeneous_enclosed CB5_1_2I1R3Value CB5_1_2I1R3MassTerm_sound CB5_1_2I1R3Entropy_sound) (by decide +kernel) +def CB5_1_2I1R4Value (a : Fin 6) : ℝ := residualLaw (below (shape 5 1 2)) (fun u => (stageBLaw (shape 5 1 2) u : ℝ)) (stageBPriority (shape 5 1 2)) 1 (fun u a => (littleLaw (shape 5 1 2) u ((stageBPriority (shape 5 1 2)) 1) a : ℝ)) 4 a +def CB5_1_2I1R4Raw (a : Fin 6) : Ball := residualBall (below (shape 5 1 2)) B5_1_2Law (stageBPriority (shape 5 1 2)) 1 (fun u => B5_1_2Little u ((stageBPriority (shape 5 1 2)) 1)) 4 a +lemma CB5_1_2I1R4Raw_sound (a : Fin 6) : + (CB5_1_2I1R4Raw a).Encloses (CB5_1_2I1R4Value a) := by + exact residualBall_sound_on (below (shape 5 1 2)) B5_1_2Law (fun u => (stageBLaw (shape 5 1 2) u : ℝ)) (stageBPriority (shape 5 1 2)) 1 (fun u => B5_1_2Little u ((stageBPriority (shape 5 1 2)) 1)) (fun u a => (littleLaw (shape 5 1 2) u ((stageBPriority (shape 5 1 2)) 1) a : ℝ)) (fun u _ => B5_1_2Law_sound u) (fun u _ a => B5_1_2Little_sound u ((stageBPriority (shape 5 1 2)) 1) a) 4 a +def CB5_1_2I1R4Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB5_1_2I1R4Certificates_valid : + CB5_1_2I1R4Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB5_1_2I1R4CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB5_1_2I1R4P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB5_1_2I1R4Certificates (CB5_1_2I1R4CertificateIndex a)).input +lemma CB5_1_2I1R4P_check : ∀ a : Fin 6, contains (CB5_1_2I1R4Raw a) (CB5_1_2I1R4P a) = true := by + decide +kernel +lemma CB5_1_2I1R4P_sound (a : Fin 6) : + (CB5_1_2I1R4P a).Encloses (CB5_1_2I1R4Value a) := + contains_sound (CB5_1_2I1R4Raw_sound a) (CB5_1_2I1R4P_check a) +def CB5_1_2I1R4Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB5_1_2I1R4Certificates (CB5_1_2I1R4CertificateIndex a)).output +lemma CB5_1_2I1R4Terms_sound (a : Fin 6) : + (CB5_1_2I1R4Terms a).Encloses (Foundation.entropyTerm (CB5_1_2I1R4Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB5_1_2I1R4Certificates_valid + (CB5_1_2I1R4CertificateIndex a) (CB5_1_2I1R4P_sound a) +def CB5_1_2I1R4Entropy : Ball := ⟨0, 0⟩ +lemma CB5_1_2I1R4Entropy_sound : CB5_1_2I1R4Entropy.Encloses (Foundation.finiteEntropy CB5_1_2I1R4Value) := by + exact contains_sound (entropyFin_enclosed 6 CB5_1_2I1R4Value CB5_1_2I1R4Terms CB5_1_2I1R4Terms_sound) (by decide +kernel) +def CB5_1_2I1R4Mass : Ball := ⟨0, 0⟩ +lemma CB5_1_2I1R4Mass_sound : CB5_1_2I1R4Mass.Encloses (∑ a, CB5_1_2I1R4Value a) := by + exact contains_sound (finSumBall_sound 6 CB5_1_2I1R4P CB5_1_2I1R4Value CB5_1_2I1R4P_sound) (by decide +kernel) +def CB5_1_2I1R4MassTerm : Ball := .exact 0 +lemma CB5_1_2I1R4MassTerm_sound : CB5_1_2I1R4MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB5_1_2I1R4Value a))) := + entropyTerm_zero_ball (CB5_1_2I1R4Mass_sound) +def CB5_1_2I1R4H : Ball := ⟨0, 0⟩ +lemma CB5_1_2I1R4H_sound : CB5_1_2I1R4H.Encloses (homogeneousEntropy CB5_1_2I1R4Value) := by + exact contains_sound (homogeneous_enclosed CB5_1_2I1R4Value CB5_1_2I1R4MassTerm_sound CB5_1_2I1R4Entropy_sound) (by decide +kernel) +def CB5_1_2I1R5Value (a : Fin 6) : ℝ := residualLaw (below (shape 5 1 2)) (fun u => (stageBLaw (shape 5 1 2) u : ℝ)) (stageBPriority (shape 5 1 2)) 1 (fun u a => (littleLaw (shape 5 1 2) u ((stageBPriority (shape 5 1 2)) 1) a : ℝ)) 5 a +def CB5_1_2I1R5Raw (a : Fin 6) : Ball := residualBall (below (shape 5 1 2)) B5_1_2Law (stageBPriority (shape 5 1 2)) 1 (fun u => B5_1_2Little u ((stageBPriority (shape 5 1 2)) 1)) 5 a +lemma CB5_1_2I1R5Raw_sound (a : Fin 6) : + (CB5_1_2I1R5Raw a).Encloses (CB5_1_2I1R5Value a) := by + exact residualBall_sound_on (below (shape 5 1 2)) B5_1_2Law (fun u => (stageBLaw (shape 5 1 2) u : ℝ)) (stageBPriority (shape 5 1 2)) 1 (fun u => B5_1_2Little u ((stageBPriority (shape 5 1 2)) 1)) (fun u a => (littleLaw (shape 5 1 2) u ((stageBPriority (shape 5 1 2)) 1) a : ℝ)) (fun u _ => B5_1_2Law_sound u) (fun u _ a => B5_1_2Little_sound u ((stageBPriority (shape 5 1 2)) 1) a) 5 a +def CB5_1_2I1R5Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB5_1_2I1R5Certificates_valid : + CB5_1_2I1R5Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB5_1_2I1R5CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB5_1_2I1R5P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB5_1_2I1R5Certificates (CB5_1_2I1R5CertificateIndex a)).input +lemma CB5_1_2I1R5P_check : ∀ a : Fin 6, contains (CB5_1_2I1R5Raw a) (CB5_1_2I1R5P a) = true := by + decide +kernel +lemma CB5_1_2I1R5P_sound (a : Fin 6) : + (CB5_1_2I1R5P a).Encloses (CB5_1_2I1R5Value a) := + contains_sound (CB5_1_2I1R5Raw_sound a) (CB5_1_2I1R5P_check a) +def CB5_1_2I1R5Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB5_1_2I1R5Certificates (CB5_1_2I1R5CertificateIndex a)).output +lemma CB5_1_2I1R5Terms_sound (a : Fin 6) : + (CB5_1_2I1R5Terms a).Encloses (Foundation.entropyTerm (CB5_1_2I1R5Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB5_1_2I1R5Certificates_valid + (CB5_1_2I1R5CertificateIndex a) (CB5_1_2I1R5P_sound a) +def CB5_1_2I1R5Entropy : Ball := ⟨0, 0⟩ +lemma CB5_1_2I1R5Entropy_sound : CB5_1_2I1R5Entropy.Encloses (Foundation.finiteEntropy CB5_1_2I1R5Value) := by + exact contains_sound (entropyFin_enclosed 6 CB5_1_2I1R5Value CB5_1_2I1R5Terms CB5_1_2I1R5Terms_sound) (by decide +kernel) +def CB5_1_2I1R5Mass : Ball := ⟨0, 0⟩ +lemma CB5_1_2I1R5Mass_sound : CB5_1_2I1R5Mass.Encloses (∑ a, CB5_1_2I1R5Value a) := by + exact contains_sound (finSumBall_sound 6 CB5_1_2I1R5P CB5_1_2I1R5Value CB5_1_2I1R5P_sound) (by decide +kernel) +def CB5_1_2I1R5MassTerm : Ball := .exact 0 +lemma CB5_1_2I1R5MassTerm_sound : CB5_1_2I1R5MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB5_1_2I1R5Value a))) := + entropyTerm_zero_ball (CB5_1_2I1R5Mass_sound) +def CB5_1_2I1R5H : Ball := ⟨0, 0⟩ +lemma CB5_1_2I1R5H_sound : CB5_1_2I1R5H.Encloses (homogeneousEntropy CB5_1_2I1R5Value) := by + exact contains_sound (homogeneous_enclosed CB5_1_2I1R5Value CB5_1_2I1R5MassTerm_sound CB5_1_2I1R5Entropy_sound) (by decide +kernel) +def CB5_1_2I1R6Value (a : Fin 6) : ℝ := residualLaw (below (shape 5 1 2)) (fun u => (stageBLaw (shape 5 1 2) u : ℝ)) (stageBPriority (shape 5 1 2)) 1 (fun u a => (littleLaw (shape 5 1 2) u ((stageBPriority (shape 5 1 2)) 1) a : ℝ)) 6 a +def CB5_1_2I1R6Raw (a : Fin 6) : Ball := residualBall (below (shape 5 1 2)) B5_1_2Law (stageBPriority (shape 5 1 2)) 1 (fun u => B5_1_2Little u ((stageBPriority (shape 5 1 2)) 1)) 6 a +lemma CB5_1_2I1R6Raw_sound (a : Fin 6) : + (CB5_1_2I1R6Raw a).Encloses (CB5_1_2I1R6Value a) := by + exact residualBall_sound_on (below (shape 5 1 2)) B5_1_2Law (fun u => (stageBLaw (shape 5 1 2) u : ℝ)) (stageBPriority (shape 5 1 2)) 1 (fun u => B5_1_2Little u ((stageBPriority (shape 5 1 2)) 1)) (fun u a => (littleLaw (shape 5 1 2) u ((stageBPriority (shape 5 1 2)) 1) a : ℝ)) (fun u _ => B5_1_2Law_sound u) (fun u _ a => B5_1_2Little_sound u ((stageBPriority (shape 5 1 2)) 1) a) 6 a +def CB5_1_2I1R6Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB5_1_2I1R6Certificates_valid : + CB5_1_2I1R6Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB5_1_2I1R6CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB5_1_2I1R6P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB5_1_2I1R6Certificates (CB5_1_2I1R6CertificateIndex a)).input +lemma CB5_1_2I1R6P_check : ∀ a : Fin 6, contains (CB5_1_2I1R6Raw a) (CB5_1_2I1R6P a) = true := by + decide +kernel +lemma CB5_1_2I1R6P_sound (a : Fin 6) : + (CB5_1_2I1R6P a).Encloses (CB5_1_2I1R6Value a) := + contains_sound (CB5_1_2I1R6Raw_sound a) (CB5_1_2I1R6P_check a) +def CB5_1_2I1R6Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB5_1_2I1R6Certificates (CB5_1_2I1R6CertificateIndex a)).output +lemma CB5_1_2I1R6Terms_sound (a : Fin 6) : + (CB5_1_2I1R6Terms a).Encloses (Foundation.entropyTerm (CB5_1_2I1R6Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB5_1_2I1R6Certificates_valid + (CB5_1_2I1R6CertificateIndex a) (CB5_1_2I1R6P_sound a) +def CB5_1_2I1R6Entropy : Ball := ⟨0, 0⟩ +lemma CB5_1_2I1R6Entropy_sound : CB5_1_2I1R6Entropy.Encloses (Foundation.finiteEntropy CB5_1_2I1R6Value) := by + exact contains_sound (entropyFin_enclosed 6 CB5_1_2I1R6Value CB5_1_2I1R6Terms CB5_1_2I1R6Terms_sound) (by decide +kernel) +def CB5_1_2I1R6Mass : Ball := ⟨0, 0⟩ +lemma CB5_1_2I1R6Mass_sound : CB5_1_2I1R6Mass.Encloses (∑ a, CB5_1_2I1R6Value a) := by + exact contains_sound (finSumBall_sound 6 CB5_1_2I1R6P CB5_1_2I1R6Value CB5_1_2I1R6P_sound) (by decide +kernel) +def CB5_1_2I1R6MassTerm : Ball := .exact 0 +lemma CB5_1_2I1R6MassTerm_sound : CB5_1_2I1R6MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB5_1_2I1R6Value a))) := + entropyTerm_zero_ball (CB5_1_2I1R6Mass_sound) +def CB5_1_2I1R6H : Ball := ⟨0, 0⟩ +lemma CB5_1_2I1R6H_sound : CB5_1_2I1R6H.Encloses (homogeneousEntropy CB5_1_2I1R6Value) := by + exact contains_sound (homogeneous_enclosed CB5_1_2I1R6Value CB5_1_2I1R6MassTerm_sound CB5_1_2I1R6Entropy_sound) (by decide +kernel) +def CB5_1_2I1R7Value (a : Fin 6) : ℝ := residualLaw (below (shape 5 1 2)) (fun u => (stageBLaw (shape 5 1 2) u : ℝ)) (stageBPriority (shape 5 1 2)) 1 (fun u a => (littleLaw (shape 5 1 2) u ((stageBPriority (shape 5 1 2)) 1) a : ℝ)) 7 a +def CB5_1_2I1R7Raw (a : Fin 6) : Ball := residualBall (below (shape 5 1 2)) B5_1_2Law (stageBPriority (shape 5 1 2)) 1 (fun u => B5_1_2Little u ((stageBPriority (shape 5 1 2)) 1)) 7 a +lemma CB5_1_2I1R7Raw_sound (a : Fin 6) : + (CB5_1_2I1R7Raw a).Encloses (CB5_1_2I1R7Value a) := by + exact residualBall_sound_on (below (shape 5 1 2)) B5_1_2Law (fun u => (stageBLaw (shape 5 1 2) u : ℝ)) (stageBPriority (shape 5 1 2)) 1 (fun u => B5_1_2Little u ((stageBPriority (shape 5 1 2)) 1)) (fun u a => (littleLaw (shape 5 1 2) u ((stageBPriority (shape 5 1 2)) 1) a : ℝ)) (fun u _ => B5_1_2Law_sound u) (fun u _ a => B5_1_2Little_sound u ((stageBPriority (shape 5 1 2)) 1) a) 7 a +def CB5_1_2I1R7Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB5_1_2I1R7Certificates_valid : + CB5_1_2I1R7Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB5_1_2I1R7CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB5_1_2I1R7P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB5_1_2I1R7Certificates (CB5_1_2I1R7CertificateIndex a)).input +lemma CB5_1_2I1R7P_check : ∀ a : Fin 6, contains (CB5_1_2I1R7Raw a) (CB5_1_2I1R7P a) = true := by + decide +kernel +lemma CB5_1_2I1R7P_sound (a : Fin 6) : + (CB5_1_2I1R7P a).Encloses (CB5_1_2I1R7Value a) := + contains_sound (CB5_1_2I1R7Raw_sound a) (CB5_1_2I1R7P_check a) +def CB5_1_2I1R7Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB5_1_2I1R7Certificates (CB5_1_2I1R7CertificateIndex a)).output +lemma CB5_1_2I1R7Terms_sound (a : Fin 6) : + (CB5_1_2I1R7Terms a).Encloses (Foundation.entropyTerm (CB5_1_2I1R7Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB5_1_2I1R7Certificates_valid + (CB5_1_2I1R7CertificateIndex a) (CB5_1_2I1R7P_sound a) +def CB5_1_2I1R7Entropy : Ball := ⟨0, 0⟩ +lemma CB5_1_2I1R7Entropy_sound : CB5_1_2I1R7Entropy.Encloses (Foundation.finiteEntropy CB5_1_2I1R7Value) := by + exact contains_sound (entropyFin_enclosed 6 CB5_1_2I1R7Value CB5_1_2I1R7Terms CB5_1_2I1R7Terms_sound) (by decide +kernel) +def CB5_1_2I1R7Mass : Ball := ⟨0, 0⟩ +lemma CB5_1_2I1R7Mass_sound : CB5_1_2I1R7Mass.Encloses (∑ a, CB5_1_2I1R7Value a) := by + exact contains_sound (finSumBall_sound 6 CB5_1_2I1R7P CB5_1_2I1R7Value CB5_1_2I1R7P_sound) (by decide +kernel) +def CB5_1_2I1R7MassTerm : Ball := .exact 0 +lemma CB5_1_2I1R7MassTerm_sound : CB5_1_2I1R7MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB5_1_2I1R7Value a))) := + entropyTerm_zero_ball (CB5_1_2I1R7Mass_sound) +def CB5_1_2I1R7H : Ball := ⟨0, 0⟩ +lemma CB5_1_2I1R7H_sound : CB5_1_2I1R7H.Encloses (homogeneousEntropy CB5_1_2I1R7Value) := by + exact contains_sound (homogeneous_enclosed CB5_1_2I1R7Value CB5_1_2I1R7MassTerm_sound CB5_1_2I1R7Entropy_sound) (by decide +kernel) +def CB5_1_2I1R8Value (a : Fin 6) : ℝ := residualLaw (below (shape 5 1 2)) (fun u => (stageBLaw (shape 5 1 2) u : ℝ)) (stageBPriority (shape 5 1 2)) 1 (fun u a => (littleLaw (shape 5 1 2) u ((stageBPriority (shape 5 1 2)) 1) a : ℝ)) 8 a +def CB5_1_2I1R8Raw (a : Fin 6) : Ball := residualBall (below (shape 5 1 2)) B5_1_2Law (stageBPriority (shape 5 1 2)) 1 (fun u => B5_1_2Little u ((stageBPriority (shape 5 1 2)) 1)) 8 a +lemma CB5_1_2I1R8Raw_sound (a : Fin 6) : + (CB5_1_2I1R8Raw a).Encloses (CB5_1_2I1R8Value a) := by + exact residualBall_sound_on (below (shape 5 1 2)) B5_1_2Law (fun u => (stageBLaw (shape 5 1 2) u : ℝ)) (stageBPriority (shape 5 1 2)) 1 (fun u => B5_1_2Little u ((stageBPriority (shape 5 1 2)) 1)) (fun u a => (littleLaw (shape 5 1 2) u ((stageBPriority (shape 5 1 2)) 1) a : ℝ)) (fun u _ => B5_1_2Law_sound u) (fun u _ a => B5_1_2Little_sound u ((stageBPriority (shape 5 1 2)) 1) a) 8 a +def CB5_1_2I1R8Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB5_1_2I1R8Certificates_valid : + CB5_1_2I1R8Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB5_1_2I1R8CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB5_1_2I1R8P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB5_1_2I1R8Certificates (CB5_1_2I1R8CertificateIndex a)).input +lemma CB5_1_2I1R8P_check : ∀ a : Fin 6, contains (CB5_1_2I1R8Raw a) (CB5_1_2I1R8P a) = true := by + decide +kernel +lemma CB5_1_2I1R8P_sound (a : Fin 6) : + (CB5_1_2I1R8P a).Encloses (CB5_1_2I1R8Value a) := + contains_sound (CB5_1_2I1R8Raw_sound a) (CB5_1_2I1R8P_check a) +def CB5_1_2I1R8Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB5_1_2I1R8Certificates (CB5_1_2I1R8CertificateIndex a)).output +lemma CB5_1_2I1R8Terms_sound (a : Fin 6) : + (CB5_1_2I1R8Terms a).Encloses (Foundation.entropyTerm (CB5_1_2I1R8Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB5_1_2I1R8Certificates_valid + (CB5_1_2I1R8CertificateIndex a) (CB5_1_2I1R8P_sound a) +def CB5_1_2I1R8Entropy : Ball := ⟨0, 0⟩ +lemma CB5_1_2I1R8Entropy_sound : CB5_1_2I1R8Entropy.Encloses (Foundation.finiteEntropy CB5_1_2I1R8Value) := by + exact contains_sound (entropyFin_enclosed 6 CB5_1_2I1R8Value CB5_1_2I1R8Terms CB5_1_2I1R8Terms_sound) (by decide +kernel) +def CB5_1_2I1R8Mass : Ball := ⟨0, 0⟩ +lemma CB5_1_2I1R8Mass_sound : CB5_1_2I1R8Mass.Encloses (∑ a, CB5_1_2I1R8Value a) := by + exact contains_sound (finSumBall_sound 6 CB5_1_2I1R8P CB5_1_2I1R8Value CB5_1_2I1R8P_sound) (by decide +kernel) +def CB5_1_2I1R8MassTerm : Ball := .exact 0 +lemma CB5_1_2I1R8MassTerm_sound : CB5_1_2I1R8MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB5_1_2I1R8Value a))) := + entropyTerm_zero_ball (CB5_1_2I1R8Mass_sound) +def CB5_1_2I1R8H : Ball := ⟨0, 0⟩ +lemma CB5_1_2I1R8H_sound : CB5_1_2I1R8H.Encloses (homogeneousEntropy CB5_1_2I1R8Value) := by + exact contains_sound (homogeneous_enclosed CB5_1_2I1R8Value CB5_1_2I1R8MassTerm_sound CB5_1_2I1R8Entropy_sound) (by decide +kernel) +def CB5_1_2I1R9Value (a : Fin 6) : ℝ := residualLaw (below (shape 5 1 2)) (fun u => (stageBLaw (shape 5 1 2) u : ℝ)) (stageBPriority (shape 5 1 2)) 1 (fun u a => (littleLaw (shape 5 1 2) u ((stageBPriority (shape 5 1 2)) 1) a : ℝ)) 9 a +def CB5_1_2I1R9Raw (a : Fin 6) : Ball := residualBall (below (shape 5 1 2)) B5_1_2Law (stageBPriority (shape 5 1 2)) 1 (fun u => B5_1_2Little u ((stageBPriority (shape 5 1 2)) 1)) 9 a +lemma CB5_1_2I1R9Raw_sound (a : Fin 6) : + (CB5_1_2I1R9Raw a).Encloses (CB5_1_2I1R9Value a) := by + exact residualBall_sound_on (below (shape 5 1 2)) B5_1_2Law (fun u => (stageBLaw (shape 5 1 2) u : ℝ)) (stageBPriority (shape 5 1 2)) 1 (fun u => B5_1_2Little u ((stageBPriority (shape 5 1 2)) 1)) (fun u a => (littleLaw (shape 5 1 2) u ((stageBPriority (shape 5 1 2)) 1) a : ℝ)) (fun u _ => B5_1_2Law_sound u) (fun u _ a => B5_1_2Little_sound u ((stageBPriority (shape 5 1 2)) 1) a) 9 a +def CB5_1_2I1R9Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB5_1_2I1R9Certificates_valid : + CB5_1_2I1R9Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB5_1_2I1R9CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB5_1_2I1R9P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB5_1_2I1R9Certificates (CB5_1_2I1R9CertificateIndex a)).input +lemma CB5_1_2I1R9P_check : ∀ a : Fin 6, contains (CB5_1_2I1R9Raw a) (CB5_1_2I1R9P a) = true := by + decide +kernel +lemma CB5_1_2I1R9P_sound (a : Fin 6) : + (CB5_1_2I1R9P a).Encloses (CB5_1_2I1R9Value a) := + contains_sound (CB5_1_2I1R9Raw_sound a) (CB5_1_2I1R9P_check a) +def CB5_1_2I1R9Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB5_1_2I1R9Certificates (CB5_1_2I1R9CertificateIndex a)).output +lemma CB5_1_2I1R9Terms_sound (a : Fin 6) : + (CB5_1_2I1R9Terms a).Encloses (Foundation.entropyTerm (CB5_1_2I1R9Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB5_1_2I1R9Certificates_valid + (CB5_1_2I1R9CertificateIndex a) (CB5_1_2I1R9P_sound a) +def CB5_1_2I1R9Entropy : Ball := ⟨0, 0⟩ +lemma CB5_1_2I1R9Entropy_sound : CB5_1_2I1R9Entropy.Encloses (Foundation.finiteEntropy CB5_1_2I1R9Value) := by + exact contains_sound (entropyFin_enclosed 6 CB5_1_2I1R9Value CB5_1_2I1R9Terms CB5_1_2I1R9Terms_sound) (by decide +kernel) +def CB5_1_2I1R9Mass : Ball := ⟨0, 0⟩ +lemma CB5_1_2I1R9Mass_sound : CB5_1_2I1R9Mass.Encloses (∑ a, CB5_1_2I1R9Value a) := by + exact contains_sound (finSumBall_sound 6 CB5_1_2I1R9P CB5_1_2I1R9Value CB5_1_2I1R9P_sound) (by decide +kernel) +def CB5_1_2I1R9MassTerm : Ball := .exact 0 +lemma CB5_1_2I1R9MassTerm_sound : CB5_1_2I1R9MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB5_1_2I1R9Value a))) := + entropyTerm_zero_ball (CB5_1_2I1R9Mass_sound) +def CB5_1_2I1R9H : Ball := ⟨0, 0⟩ +lemma CB5_1_2I1R9H_sound : CB5_1_2I1R9H.Encloses (homogeneousEntropy CB5_1_2I1R9Value) := by + exact contains_sound (homogeneous_enclosed CB5_1_2I1R9Value CB5_1_2I1R9MassTerm_sound CB5_1_2I1R9Entropy_sound) (by decide +kernel) +def CB5_1_2I1R10Value (a : Fin 6) : ℝ := residualLaw (below (shape 5 1 2)) (fun u => (stageBLaw (shape 5 1 2) u : ℝ)) (stageBPriority (shape 5 1 2)) 1 (fun u a => (littleLaw (shape 5 1 2) u ((stageBPriority (shape 5 1 2)) 1) a : ℝ)) 10 a +def CB5_1_2I1R10Raw (a : Fin 6) : Ball := residualBall (below (shape 5 1 2)) B5_1_2Law (stageBPriority (shape 5 1 2)) 1 (fun u => B5_1_2Little u ((stageBPriority (shape 5 1 2)) 1)) 10 a +lemma CB5_1_2I1R10Raw_sound (a : Fin 6) : + (CB5_1_2I1R10Raw a).Encloses (CB5_1_2I1R10Value a) := by + exact residualBall_sound_on (below (shape 5 1 2)) B5_1_2Law (fun u => (stageBLaw (shape 5 1 2) u : ℝ)) (stageBPriority (shape 5 1 2)) 1 (fun u => B5_1_2Little u ((stageBPriority (shape 5 1 2)) 1)) (fun u a => (littleLaw (shape 5 1 2) u ((stageBPriority (shape 5 1 2)) 1) a : ℝ)) (fun u _ => B5_1_2Law_sound u) (fun u _ a => B5_1_2Little_sound u ((stageBPriority (shape 5 1 2)) 1) a) 10 a +def CB5_1_2I1R10Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB5_1_2I1R10Certificates_valid : + CB5_1_2I1R10Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB5_1_2I1R10CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB5_1_2I1R10P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB5_1_2I1R10Certificates (CB5_1_2I1R10CertificateIndex a)).input +lemma CB5_1_2I1R10P_check : ∀ a : Fin 6, contains (CB5_1_2I1R10Raw a) (CB5_1_2I1R10P a) = true := by + decide +kernel +lemma CB5_1_2I1R10P_sound (a : Fin 6) : + (CB5_1_2I1R10P a).Encloses (CB5_1_2I1R10Value a) := + contains_sound (CB5_1_2I1R10Raw_sound a) (CB5_1_2I1R10P_check a) +def CB5_1_2I1R10Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB5_1_2I1R10Certificates (CB5_1_2I1R10CertificateIndex a)).output +lemma CB5_1_2I1R10Terms_sound (a : Fin 6) : + (CB5_1_2I1R10Terms a).Encloses (Foundation.entropyTerm (CB5_1_2I1R10Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB5_1_2I1R10Certificates_valid + (CB5_1_2I1R10CertificateIndex a) (CB5_1_2I1R10P_sound a) +def CB5_1_2I1R10Entropy : Ball := ⟨0, 0⟩ +lemma CB5_1_2I1R10Entropy_sound : CB5_1_2I1R10Entropy.Encloses (Foundation.finiteEntropy CB5_1_2I1R10Value) := by + exact contains_sound (entropyFin_enclosed 6 CB5_1_2I1R10Value CB5_1_2I1R10Terms CB5_1_2I1R10Terms_sound) (by decide +kernel) +def CB5_1_2I1R10Mass : Ball := ⟨0, 0⟩ +lemma CB5_1_2I1R10Mass_sound : CB5_1_2I1R10Mass.Encloses (∑ a, CB5_1_2I1R10Value a) := by + exact contains_sound (finSumBall_sound 6 CB5_1_2I1R10P CB5_1_2I1R10Value CB5_1_2I1R10P_sound) (by decide +kernel) +def CB5_1_2I1R10MassTerm : Ball := .exact 0 +lemma CB5_1_2I1R10MassTerm_sound : CB5_1_2I1R10MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB5_1_2I1R10Value a))) := + entropyTerm_zero_ball (CB5_1_2I1R10Mass_sound) +def CB5_1_2I1R10H : Ball := ⟨0, 0⟩ +lemma CB5_1_2I1R10H_sound : CB5_1_2I1R10H.Encloses (homogeneousEntropy CB5_1_2I1R10Value) := by + exact contains_sound (homogeneous_enclosed CB5_1_2I1R10Value CB5_1_2I1R10MassTerm_sound CB5_1_2I1R10Entropy_sound) (by decide +kernel) +def CB5_1_2I1R11Value (a : Fin 6) : ℝ := residualLaw (below (shape 5 1 2)) (fun u => (stageBLaw (shape 5 1 2) u : ℝ)) (stageBPriority (shape 5 1 2)) 1 (fun u a => (littleLaw (shape 5 1 2) u ((stageBPriority (shape 5 1 2)) 1) a : ℝ)) 11 a +def CB5_1_2I1R11Raw (a : Fin 6) : Ball := residualBall (below (shape 5 1 2)) B5_1_2Law (stageBPriority (shape 5 1 2)) 1 (fun u => B5_1_2Little u ((stageBPriority (shape 5 1 2)) 1)) 11 a +lemma CB5_1_2I1R11Raw_sound (a : Fin 6) : + (CB5_1_2I1R11Raw a).Encloses (CB5_1_2I1R11Value a) := by + exact residualBall_sound_on (below (shape 5 1 2)) B5_1_2Law (fun u => (stageBLaw (shape 5 1 2) u : ℝ)) (stageBPriority (shape 5 1 2)) 1 (fun u => B5_1_2Little u ((stageBPriority (shape 5 1 2)) 1)) (fun u a => (littleLaw (shape 5 1 2) u ((stageBPriority (shape 5 1 2)) 1) a : ℝ)) (fun u _ => B5_1_2Law_sound u) (fun u _ a => B5_1_2Little_sound u ((stageBPriority (shape 5 1 2)) 1) a) 11 a +def CB5_1_2I1R11Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB5_1_2I1R11Certificates_valid : + CB5_1_2I1R11Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB5_1_2I1R11CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB5_1_2I1R11P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB5_1_2I1R11Certificates (CB5_1_2I1R11CertificateIndex a)).input +lemma CB5_1_2I1R11P_check : ∀ a : Fin 6, contains (CB5_1_2I1R11Raw a) (CB5_1_2I1R11P a) = true := by + decide +kernel +lemma CB5_1_2I1R11P_sound (a : Fin 6) : + (CB5_1_2I1R11P a).Encloses (CB5_1_2I1R11Value a) := + contains_sound (CB5_1_2I1R11Raw_sound a) (CB5_1_2I1R11P_check a) +def CB5_1_2I1R11Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB5_1_2I1R11Certificates (CB5_1_2I1R11CertificateIndex a)).output +lemma CB5_1_2I1R11Terms_sound (a : Fin 6) : + (CB5_1_2I1R11Terms a).Encloses (Foundation.entropyTerm (CB5_1_2I1R11Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB5_1_2I1R11Certificates_valid + (CB5_1_2I1R11CertificateIndex a) (CB5_1_2I1R11P_sound a) +def CB5_1_2I1R11Entropy : Ball := ⟨0, 0⟩ +lemma CB5_1_2I1R11Entropy_sound : CB5_1_2I1R11Entropy.Encloses (Foundation.finiteEntropy CB5_1_2I1R11Value) := by + exact contains_sound (entropyFin_enclosed 6 CB5_1_2I1R11Value CB5_1_2I1R11Terms CB5_1_2I1R11Terms_sound) (by decide +kernel) +def CB5_1_2I1R11Mass : Ball := ⟨0, 0⟩ +lemma CB5_1_2I1R11Mass_sound : CB5_1_2I1R11Mass.Encloses (∑ a, CB5_1_2I1R11Value a) := by + exact contains_sound (finSumBall_sound 6 CB5_1_2I1R11P CB5_1_2I1R11Value CB5_1_2I1R11P_sound) (by decide +kernel) +def CB5_1_2I1R11MassTerm : Ball := .exact 0 +lemma CB5_1_2I1R11MassTerm_sound : CB5_1_2I1R11MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB5_1_2I1R11Value a))) := + entropyTerm_zero_ball (CB5_1_2I1R11Mass_sound) +def CB5_1_2I1R11H : Ball := ⟨0, 0⟩ +lemma CB5_1_2I1R11H_sound : CB5_1_2I1R11H.Encloses (homogeneousEntropy CB5_1_2I1R11Value) := by + exact contains_sound (homogeneous_enclosed CB5_1_2I1R11Value CB5_1_2I1R11MassTerm_sound CB5_1_2I1R11Entropy_sound) (by decide +kernel) +def CB5_1_2I1R12Value (a : Fin 6) : ℝ := residualLaw (below (shape 5 1 2)) (fun u => (stageBLaw (shape 5 1 2) u : ℝ)) (stageBPriority (shape 5 1 2)) 1 (fun u a => (littleLaw (shape 5 1 2) u ((stageBPriority (shape 5 1 2)) 1) a : ℝ)) 12 a +def CB5_1_2I1R12Raw (a : Fin 6) : Ball := residualBall (below (shape 5 1 2)) B5_1_2Law (stageBPriority (shape 5 1 2)) 1 (fun u => B5_1_2Little u ((stageBPriority (shape 5 1 2)) 1)) 12 a +lemma CB5_1_2I1R12Raw_sound (a : Fin 6) : + (CB5_1_2I1R12Raw a).Encloses (CB5_1_2I1R12Value a) := by + exact residualBall_sound_on (below (shape 5 1 2)) B5_1_2Law (fun u => (stageBLaw (shape 5 1 2) u : ℝ)) (stageBPriority (shape 5 1 2)) 1 (fun u => B5_1_2Little u ((stageBPriority (shape 5 1 2)) 1)) (fun u a => (littleLaw (shape 5 1 2) u ((stageBPriority (shape 5 1 2)) 1) a : ℝ)) (fun u _ => B5_1_2Law_sound u) (fun u _ a => B5_1_2Little_sound u ((stageBPriority (shape 5 1 2)) 1) a) 12 a +def CB5_1_2I1R12Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB5_1_2I1R12Certificates_valid : + CB5_1_2I1R12Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB5_1_2I1R12CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB5_1_2I1R12P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB5_1_2I1R12Certificates (CB5_1_2I1R12CertificateIndex a)).input +lemma CB5_1_2I1R12P_check : ∀ a : Fin 6, contains (CB5_1_2I1R12Raw a) (CB5_1_2I1R12P a) = true := by + decide +kernel +lemma CB5_1_2I1R12P_sound (a : Fin 6) : + (CB5_1_2I1R12P a).Encloses (CB5_1_2I1R12Value a) := + contains_sound (CB5_1_2I1R12Raw_sound a) (CB5_1_2I1R12P_check a) +def CB5_1_2I1R12Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB5_1_2I1R12Certificates (CB5_1_2I1R12CertificateIndex a)).output +lemma CB5_1_2I1R12Terms_sound (a : Fin 6) : + (CB5_1_2I1R12Terms a).Encloses (Foundation.entropyTerm (CB5_1_2I1R12Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB5_1_2I1R12Certificates_valid + (CB5_1_2I1R12CertificateIndex a) (CB5_1_2I1R12P_sound a) +def CB5_1_2I1R12Entropy : Ball := ⟨0, 0⟩ +lemma CB5_1_2I1R12Entropy_sound : CB5_1_2I1R12Entropy.Encloses (Foundation.finiteEntropy CB5_1_2I1R12Value) := by + exact contains_sound (entropyFin_enclosed 6 CB5_1_2I1R12Value CB5_1_2I1R12Terms CB5_1_2I1R12Terms_sound) (by decide +kernel) +def CB5_1_2I1R12Mass : Ball := ⟨0, 0⟩ +lemma CB5_1_2I1R12Mass_sound : CB5_1_2I1R12Mass.Encloses (∑ a, CB5_1_2I1R12Value a) := by + exact contains_sound (finSumBall_sound 6 CB5_1_2I1R12P CB5_1_2I1R12Value CB5_1_2I1R12P_sound) (by decide +kernel) +def CB5_1_2I1R12MassTerm : Ball := .exact 0 +lemma CB5_1_2I1R12MassTerm_sound : CB5_1_2I1R12MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB5_1_2I1R12Value a))) := + entropyTerm_zero_ball (CB5_1_2I1R12Mass_sound) +def CB5_1_2I1R12H : Ball := ⟨0, 0⟩ +lemma CB5_1_2I1R12H_sound : CB5_1_2I1R12H.Encloses (homogeneousEntropy CB5_1_2I1R12Value) := by + exact contains_sound (homogeneous_enclosed CB5_1_2I1R12Value CB5_1_2I1R12MassTerm_sound CB5_1_2I1R12Entropy_sound) (by decide +kernel) +def CB5_1_2I1R13Value (a : Fin 6) : ℝ := residualLaw (below (shape 5 1 2)) (fun u => (stageBLaw (shape 5 1 2) u : ℝ)) (stageBPriority (shape 5 1 2)) 1 (fun u a => (littleLaw (shape 5 1 2) u ((stageBPriority (shape 5 1 2)) 1) a : ℝ)) 13 a +def CB5_1_2I1R13Raw (a : Fin 6) : Ball := residualBall (below (shape 5 1 2)) B5_1_2Law (stageBPriority (shape 5 1 2)) 1 (fun u => B5_1_2Little u ((stageBPriority (shape 5 1 2)) 1)) 13 a +lemma CB5_1_2I1R13Raw_sound (a : Fin 6) : + (CB5_1_2I1R13Raw a).Encloses (CB5_1_2I1R13Value a) := by + exact residualBall_sound_on (below (shape 5 1 2)) B5_1_2Law (fun u => (stageBLaw (shape 5 1 2) u : ℝ)) (stageBPriority (shape 5 1 2)) 1 (fun u => B5_1_2Little u ((stageBPriority (shape 5 1 2)) 1)) (fun u a => (littleLaw (shape 5 1 2) u ((stageBPriority (shape 5 1 2)) 1) a : ℝ)) (fun u _ => B5_1_2Law_sound u) (fun u _ a => B5_1_2Little_sound u ((stageBPriority (shape 5 1 2)) 1) a) 13 a +def CB5_1_2I1R13Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB5_1_2I1R13Certificates_valid : + CB5_1_2I1R13Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB5_1_2I1R13CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB5_1_2I1R13P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB5_1_2I1R13Certificates (CB5_1_2I1R13CertificateIndex a)).input +lemma CB5_1_2I1R13P_check : ∀ a : Fin 6, contains (CB5_1_2I1R13Raw a) (CB5_1_2I1R13P a) = true := by + decide +kernel +lemma CB5_1_2I1R13P_sound (a : Fin 6) : + (CB5_1_2I1R13P a).Encloses (CB5_1_2I1R13Value a) := + contains_sound (CB5_1_2I1R13Raw_sound a) (CB5_1_2I1R13P_check a) +def CB5_1_2I1R13Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB5_1_2I1R13Certificates (CB5_1_2I1R13CertificateIndex a)).output +lemma CB5_1_2I1R13Terms_sound (a : Fin 6) : + (CB5_1_2I1R13Terms a).Encloses (Foundation.entropyTerm (CB5_1_2I1R13Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB5_1_2I1R13Certificates_valid + (CB5_1_2I1R13CertificateIndex a) (CB5_1_2I1R13P_sound a) +def CB5_1_2I1R13Entropy : Ball := ⟨0, 0⟩ +lemma CB5_1_2I1R13Entropy_sound : CB5_1_2I1R13Entropy.Encloses (Foundation.finiteEntropy CB5_1_2I1R13Value) := by + exact contains_sound (entropyFin_enclosed 6 CB5_1_2I1R13Value CB5_1_2I1R13Terms CB5_1_2I1R13Terms_sound) (by decide +kernel) +def CB5_1_2I1R13Mass : Ball := ⟨0, 0⟩ +lemma CB5_1_2I1R13Mass_sound : CB5_1_2I1R13Mass.Encloses (∑ a, CB5_1_2I1R13Value a) := by + exact contains_sound (finSumBall_sound 6 CB5_1_2I1R13P CB5_1_2I1R13Value CB5_1_2I1R13P_sound) (by decide +kernel) +def CB5_1_2I1R13MassTerm : Ball := .exact 0 +lemma CB5_1_2I1R13MassTerm_sound : CB5_1_2I1R13MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB5_1_2I1R13Value a))) := + entropyTerm_zero_ball (CB5_1_2I1R13Mass_sound) +def CB5_1_2I1R13H : Ball := ⟨0, 0⟩ +lemma CB5_1_2I1R13H_sound : CB5_1_2I1R13H.Encloses (homogeneousEntropy CB5_1_2I1R13Value) := by + exact contains_sound (homogeneous_enclosed CB5_1_2I1R13Value CB5_1_2I1R13MassTerm_sound CB5_1_2I1R13Entropy_sound) (by decide +kernel) +def CB5_1_2I1R14Value (a : Fin 6) : ℝ := residualLaw (below (shape 5 1 2)) (fun u => (stageBLaw (shape 5 1 2) u : ℝ)) (stageBPriority (shape 5 1 2)) 1 (fun u a => (littleLaw (shape 5 1 2) u ((stageBPriority (shape 5 1 2)) 1) a : ℝ)) 14 a +def CB5_1_2I1R14Raw (a : Fin 6) : Ball := residualBall (below (shape 5 1 2)) B5_1_2Law (stageBPriority (shape 5 1 2)) 1 (fun u => B5_1_2Little u ((stageBPriority (shape 5 1 2)) 1)) 14 a +lemma CB5_1_2I1R14Raw_sound (a : Fin 6) : + (CB5_1_2I1R14Raw a).Encloses (CB5_1_2I1R14Value a) := by + exact residualBall_sound_on (below (shape 5 1 2)) B5_1_2Law (fun u => (stageBLaw (shape 5 1 2) u : ℝ)) (stageBPriority (shape 5 1 2)) 1 (fun u => B5_1_2Little u ((stageBPriority (shape 5 1 2)) 1)) (fun u a => (littleLaw (shape 5 1 2) u ((stageBPriority (shape 5 1 2)) 1) a : ℝ)) (fun u _ => B5_1_2Law_sound u) (fun u _ a => B5_1_2Little_sound u ((stageBPriority (shape 5 1 2)) 1) a) 14 a +def CB5_1_2I1R14Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB5_1_2I1R14Certificates_valid : + CB5_1_2I1R14Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB5_1_2I1R14CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB5_1_2I1R14P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB5_1_2I1R14Certificates (CB5_1_2I1R14CertificateIndex a)).input +lemma CB5_1_2I1R14P_check : ∀ a : Fin 6, contains (CB5_1_2I1R14Raw a) (CB5_1_2I1R14P a) = true := by + decide +kernel +lemma CB5_1_2I1R14P_sound (a : Fin 6) : + (CB5_1_2I1R14P a).Encloses (CB5_1_2I1R14Value a) := + contains_sound (CB5_1_2I1R14Raw_sound a) (CB5_1_2I1R14P_check a) +def CB5_1_2I1R14Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB5_1_2I1R14Certificates (CB5_1_2I1R14CertificateIndex a)).output +lemma CB5_1_2I1R14Terms_sound (a : Fin 6) : + (CB5_1_2I1R14Terms a).Encloses (Foundation.entropyTerm (CB5_1_2I1R14Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB5_1_2I1R14Certificates_valid + (CB5_1_2I1R14CertificateIndex a) (CB5_1_2I1R14P_sound a) +def CB5_1_2I1R14Entropy : Ball := ⟨0, 0⟩ +lemma CB5_1_2I1R14Entropy_sound : CB5_1_2I1R14Entropy.Encloses (Foundation.finiteEntropy CB5_1_2I1R14Value) := by + exact contains_sound (entropyFin_enclosed 6 CB5_1_2I1R14Value CB5_1_2I1R14Terms CB5_1_2I1R14Terms_sound) (by decide +kernel) +def CB5_1_2I1R14Mass : Ball := ⟨0, 0⟩ +lemma CB5_1_2I1R14Mass_sound : CB5_1_2I1R14Mass.Encloses (∑ a, CB5_1_2I1R14Value a) := by + exact contains_sound (finSumBall_sound 6 CB5_1_2I1R14P CB5_1_2I1R14Value CB5_1_2I1R14P_sound) (by decide +kernel) +def CB5_1_2I1R14MassTerm : Ball := .exact 0 +lemma CB5_1_2I1R14MassTerm_sound : CB5_1_2I1R14MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB5_1_2I1R14Value a))) := + entropyTerm_zero_ball (CB5_1_2I1R14Mass_sound) +def CB5_1_2I1R14H : Ball := ⟨0, 0⟩ +lemma CB5_1_2I1R14H_sound : CB5_1_2I1R14H.Encloses (homogeneousEntropy CB5_1_2I1R14Value) := by + exact contains_sound (homogeneous_enclosed CB5_1_2I1R14Value CB5_1_2I1R14MassTerm_sound CB5_1_2I1R14Entropy_sound) (by decide +kernel) +def CB5_1_2I1R15Value (a : Fin 6) : ℝ := residualLaw (below (shape 5 1 2)) (fun u => (stageBLaw (shape 5 1 2) u : ℝ)) (stageBPriority (shape 5 1 2)) 1 (fun u a => (littleLaw (shape 5 1 2) u ((stageBPriority (shape 5 1 2)) 1) a : ℝ)) 15 a +def CB5_1_2I1R15Raw (a : Fin 6) : Ball := residualBall (below (shape 5 1 2)) B5_1_2Law (stageBPriority (shape 5 1 2)) 1 (fun u => B5_1_2Little u ((stageBPriority (shape 5 1 2)) 1)) 15 a +lemma CB5_1_2I1R15Raw_sound (a : Fin 6) : + (CB5_1_2I1R15Raw a).Encloses (CB5_1_2I1R15Value a) := by + exact residualBall_sound_on (below (shape 5 1 2)) B5_1_2Law (fun u => (stageBLaw (shape 5 1 2) u : ℝ)) (stageBPriority (shape 5 1 2)) 1 (fun u => B5_1_2Little u ((stageBPriority (shape 5 1 2)) 1)) (fun u a => (littleLaw (shape 5 1 2) u ((stageBPriority (shape 5 1 2)) 1) a : ℝ)) (fun u _ => B5_1_2Law_sound u) (fun u _ a => B5_1_2Little_sound u ((stageBPriority (shape 5 1 2)) 1) a) 15 a +def CB5_1_2I1R15Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB5_1_2I1R15Certificates_valid : + CB5_1_2I1R15Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB5_1_2I1R15CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB5_1_2I1R15P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB5_1_2I1R15Certificates (CB5_1_2I1R15CertificateIndex a)).input +lemma CB5_1_2I1R15P_check : ∀ a : Fin 6, contains (CB5_1_2I1R15Raw a) (CB5_1_2I1R15P a) = true := by + decide +kernel +lemma CB5_1_2I1R15P_sound (a : Fin 6) : + (CB5_1_2I1R15P a).Encloses (CB5_1_2I1R15Value a) := + contains_sound (CB5_1_2I1R15Raw_sound a) (CB5_1_2I1R15P_check a) +def CB5_1_2I1R15Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB5_1_2I1R15Certificates (CB5_1_2I1R15CertificateIndex a)).output +lemma CB5_1_2I1R15Terms_sound (a : Fin 6) : + (CB5_1_2I1R15Terms a).Encloses (Foundation.entropyTerm (CB5_1_2I1R15Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB5_1_2I1R15Certificates_valid + (CB5_1_2I1R15CertificateIndex a) (CB5_1_2I1R15P_sound a) +def CB5_1_2I1R15Entropy : Ball := ⟨0, 0⟩ +lemma CB5_1_2I1R15Entropy_sound : CB5_1_2I1R15Entropy.Encloses (Foundation.finiteEntropy CB5_1_2I1R15Value) := by + exact contains_sound (entropyFin_enclosed 6 CB5_1_2I1R15Value CB5_1_2I1R15Terms CB5_1_2I1R15Terms_sound) (by decide +kernel) +def CB5_1_2I1R15Mass : Ball := ⟨0, 0⟩ +lemma CB5_1_2I1R15Mass_sound : CB5_1_2I1R15Mass.Encloses (∑ a, CB5_1_2I1R15Value a) := by + exact contains_sound (finSumBall_sound 6 CB5_1_2I1R15P CB5_1_2I1R15Value CB5_1_2I1R15P_sound) (by decide +kernel) +def CB5_1_2I1R15MassTerm : Ball := .exact 0 +lemma CB5_1_2I1R15MassTerm_sound : CB5_1_2I1R15MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB5_1_2I1R15Value a))) := + entropyTerm_zero_ball (CB5_1_2I1R15Mass_sound) +def CB5_1_2I1R15H : Ball := ⟨0, 0⟩ +lemma CB5_1_2I1R15H_sound : CB5_1_2I1R15H.Encloses (homogeneousEntropy CB5_1_2I1R15Value) := by + exact contains_sound (homogeneous_enclosed CB5_1_2I1R15Value CB5_1_2I1R15MassTerm_sound CB5_1_2I1R15Entropy_sound) (by decide +kernel) +def CB5_1_2I1R16Value (a : Fin 6) : ℝ := residualLaw (below (shape 5 1 2)) (fun u => (stageBLaw (shape 5 1 2) u : ℝ)) (stageBPriority (shape 5 1 2)) 1 (fun u a => (littleLaw (shape 5 1 2) u ((stageBPriority (shape 5 1 2)) 1) a : ℝ)) 16 a +def CB5_1_2I1R16Raw (a : Fin 6) : Ball := residualBall (below (shape 5 1 2)) B5_1_2Law (stageBPriority (shape 5 1 2)) 1 (fun u => B5_1_2Little u ((stageBPriority (shape 5 1 2)) 1)) 16 a +lemma CB5_1_2I1R16Raw_sound (a : Fin 6) : + (CB5_1_2I1R16Raw a).Encloses (CB5_1_2I1R16Value a) := by + exact residualBall_sound_on (below (shape 5 1 2)) B5_1_2Law (fun u => (stageBLaw (shape 5 1 2) u : ℝ)) (stageBPriority (shape 5 1 2)) 1 (fun u => B5_1_2Little u ((stageBPriority (shape 5 1 2)) 1)) (fun u a => (littleLaw (shape 5 1 2) u ((stageBPriority (shape 5 1 2)) 1) a : ℝ)) (fun u _ => B5_1_2Law_sound u) (fun u _ a => B5_1_2Little_sound u ((stageBPriority (shape 5 1 2)) 1) a) 16 a +def CB5_1_2I1R16Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB5_1_2I1R16Certificates_valid : + CB5_1_2I1R16Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB5_1_2I1R16CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB5_1_2I1R16P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB5_1_2I1R16Certificates (CB5_1_2I1R16CertificateIndex a)).input +lemma CB5_1_2I1R16P_check : ∀ a : Fin 6, contains (CB5_1_2I1R16Raw a) (CB5_1_2I1R16P a) = true := by + decide +kernel +lemma CB5_1_2I1R16P_sound (a : Fin 6) : + (CB5_1_2I1R16P a).Encloses (CB5_1_2I1R16Value a) := + contains_sound (CB5_1_2I1R16Raw_sound a) (CB5_1_2I1R16P_check a) +def CB5_1_2I1R16Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB5_1_2I1R16Certificates (CB5_1_2I1R16CertificateIndex a)).output +lemma CB5_1_2I1R16Terms_sound (a : Fin 6) : + (CB5_1_2I1R16Terms a).Encloses (Foundation.entropyTerm (CB5_1_2I1R16Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB5_1_2I1R16Certificates_valid + (CB5_1_2I1R16CertificateIndex a) (CB5_1_2I1R16P_sound a) +def CB5_1_2I1R16Entropy : Ball := ⟨0, 0⟩ +lemma CB5_1_2I1R16Entropy_sound : CB5_1_2I1R16Entropy.Encloses (Foundation.finiteEntropy CB5_1_2I1R16Value) := by + exact contains_sound (entropyFin_enclosed 6 CB5_1_2I1R16Value CB5_1_2I1R16Terms CB5_1_2I1R16Terms_sound) (by decide +kernel) +def CB5_1_2I1R16Mass : Ball := ⟨0, 0⟩ +lemma CB5_1_2I1R16Mass_sound : CB5_1_2I1R16Mass.Encloses (∑ a, CB5_1_2I1R16Value a) := by + exact contains_sound (finSumBall_sound 6 CB5_1_2I1R16P CB5_1_2I1R16Value CB5_1_2I1R16P_sound) (by decide +kernel) +def CB5_1_2I1R16MassTerm : Ball := .exact 0 +lemma CB5_1_2I1R16MassTerm_sound : CB5_1_2I1R16MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB5_1_2I1R16Value a))) := + entropyTerm_zero_ball (CB5_1_2I1R16Mass_sound) +def CB5_1_2I1R16H : Ball := ⟨0, 0⟩ +lemma CB5_1_2I1R16H_sound : CB5_1_2I1R16H.Encloses (homogeneousEntropy CB5_1_2I1R16Value) := by + exact contains_sound (homogeneous_enclosed CB5_1_2I1R16Value CB5_1_2I1R16MassTerm_sound CB5_1_2I1R16Entropy_sound) (by decide +kernel) +def CB5_1_2I1ResidualEntropies (a : Fin 17) : Ball := + match a.val with + | 0 => CB5_1_2I1R0H + | 1 => CB5_1_2I1R1H + | 2 => CB5_1_2I1R2H + | 3 => CB5_1_2I1R3H + | 4 => CB5_1_2I1R4H + | 5 => CB5_1_2I1R5H + | 6 => CB5_1_2I1R6H + | 7 => CB5_1_2I1R7H + | 8 => CB5_1_2I1R8H + | 9 => CB5_1_2I1R9H + | 10 => CB5_1_2I1R10H + | 11 => CB5_1_2I1R11H + | 12 => CB5_1_2I1R12H + | 13 => CB5_1_2I1R13H + | 14 => CB5_1_2I1R14H + | 15 => CB5_1_2I1R15H + | 16 => CB5_1_2I1R16H + | _ => (.exact 0) +lemma CB5_1_2I1ResidualEntropies_sound (k : Fin 17) : + (CB5_1_2I1ResidualEntropies k).Encloses (homogeneousEntropy + (residualLaw (below (shape 5 1 2)) (fun u => (stageBLaw (shape 5 1 2) u : ℝ)) (stageBPriority (shape 5 1 2)) 1 (fun u a => (littleLaw (shape 5 1 2) u ((stageBPriority (shape 5 1 2)) 1) a : ℝ)) k)) := by + fin_cases k + · exact CB5_1_2I1R0H_sound + · exact CB5_1_2I1R1H_sound + · exact CB5_1_2I1R2H_sound + · exact CB5_1_2I1R3H_sound + · exact CB5_1_2I1R4H_sound + · exact CB5_1_2I1R5H_sound + · exact CB5_1_2I1R6H_sound + · exact CB5_1_2I1R7H_sound + · exact CB5_1_2I1R8H_sound + · exact CB5_1_2I1R9H_sound + · exact CB5_1_2I1R10H_sound + · exact CB5_1_2I1R11H_sound + · exact CB5_1_2I1R12H_sound + · exact CB5_1_2I1R13H_sound + · exact CB5_1_2I1R14H_sound + · exact CB5_1_2I1R15H_sound + · exact CB5_1_2I1R16H_sound +def CB5_1_2I1Singles (s : Shape) : Ball := + match s 0, s 1, s 2 with + | _, _, _ => (.exact 0) +lemma CB5_1_2I1Singles_sound (u : Shape) (hu : u ∈ below (shape 5 1 2)) + (hd : designated (stageBPriority (shape 5 1 2)) 1 u) : + (CB5_1_2I1Singles u).Encloses (homogeneousEntropy ((fun u a => (littleLaw (shape 5 1 2) u ((stageBPriority (shape 5 1 2)) 1) a : ℝ)) u)) := by + rw [B5_1_2_below] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl | rfl | rfl + · exact (show ¬ designated (stageBPriority (shape 5 1 2)) 1 (shape 1 1 2) by decide +kernel) hd |>.elim + · exact (show ¬ designated (stageBPriority (shape 5 1 2)) 1 (shape 2 0 2) by decide +kernel) hd |>.elim + · exact (show ¬ designated (stageBPriority (shape 5 1 2)) 1 (shape 2 1 1) by decide +kernel) hd |>.elim + · exact (show ¬ designated (stageBPriority (shape 5 1 2)) 1 (shape 3 0 1) by decide +kernel) hd |>.elim + · exact (show ¬ designated (stageBPriority (shape 5 1 2)) 1 (shape 3 1 0) by decide +kernel) hd |>.elim + · exact (show ¬ designated (stageBPriority (shape 5 1 2)) 1 (shape 4 0 0) by decide +kernel) hd |>.elim +def CB5_1_2I1Singleton : Ball := ⟨0, 0⟩ +lemma CB5_1_2I1Singleton_sound : CB5_1_2I1Singleton.Encloses + (singletonEntropy (below (shape 5 1 2)) (fun u => (stageBLaw (shape 5 1 2) u : ℝ)) (stageBPriority (shape 5 1 2)) 1 (fun u a => (littleLaw (shape 5 1 2) u ((stageBPriority (shape 5 1 2)) 1) a : ℝ))) := by + exact contains_sound (singletonBall_sound (below (shape 5 1 2)) B5_1_2Law (fun u => (stageBLaw (shape 5 1 2) u : ℝ)) (stageBPriority (shape 5 1 2)) 1 + CB5_1_2I1Singles (fun u a => (littleLaw (shape 5 1 2) u ((stageBPriority (shape 5 1 2)) 1) a : ℝ)) (fun u _ => B5_1_2Law_sound u) CB5_1_2I1Singles_sound) (by decide +kernel) +def CB5_1_2I1Group : Ball := ⟨(6299289346118716646986486473227 / 100000000000000000000000000000000), (58641421587 / 50000000000000000000000000000000)⟩ +lemma CB5_1_2I1Group_sound : CB5_1_2I1Group.Encloses + (groupedEntropy (below (shape 5 1 2)) (fun u => (stageBLaw (shape 5 1 2) u : ℝ)) (stageBPriority (shape 5 1 2)) 1 (fun u a => (littleLaw (shape 5 1 2) u ((stageBPriority (shape 5 1 2)) 1) a : ℝ))) := by + exact contains_sound (Ball.add_sound CB5_1_2I1Singleton_sound + (finSumBall_sound 17 CB5_1_2I1ResidualEntropies _ CB5_1_2I1ResidualEntropies_sound)) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CB5_1_2I1H : Ball := ⟨(91512639393330122134736454010109 / 100000000000000000000000000000000), (316272369837 / 100000000000000000000000000000000)⟩ +lemma CB5_1_2I1_sound : CB5_1_2I1H.Encloses (stageBCapacity (shape 5 1 2) 1) := by + have hb := contains_sound (Ball.add_sound CB5_1_2I1PairH_sound + (Ball.neg_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) CB5_1_2I1Group_sound))) + (show contains (.add CB5_1_2I1PairH (.neg (.mul (.exact 2) CB5_1_2I1Group))) CB5_1_2I1H = true by decide +kernel) + unfold CB5_1_2I1PairValue at hb + simpa only [stageBCapacity, nativeCapacity, + show (1 : Fin 3) ≠ 0 by decide, ite_false, sub_eq_add_neg] using hb + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/CapacityB/CapB5_1_2I2.lean b/lean/OAI/LinearAlgebra/MatrixFields/CapacityB/CapB5_1_2I2.lean new file mode 100644 index 0000000000000000000000000000000000000000..2937a9c91ef0849ed61ec02627946f293335d65e --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/CapacityB/CapB5_1_2I2.lean @@ -0,0 +1,991 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Certificates.SupportedContraction + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CB5_1_2I2PairValue (a : PairSlot) : ℝ := pairLaw (below (shape 5 1 2)) (shape 5 1 2) (fun u => (stageBLaw (shape 5 1 2) u : ℝ)) (fun u a => (littleLaw (shape 5 1 2) u ((stageBPriority (shape 5 1 2)) 2) a : ℝ)) a +def CB5_1_2I2PairRaw (a : PairSlot) : Ball := pairLawBall (below (shape 5 1 2)) (shape 5 1 2) B5_1_2Law (fun u => B5_1_2Little u ((stageBPriority (shape 5 1 2)) 2)) a +lemma CB5_1_2I2PairRaw_sound (a : PairSlot) : + (CB5_1_2I2PairRaw a).Encloses (CB5_1_2I2PairValue a) := by + exact pairLawBall_sound_on (below (shape 5 1 2)) (shape 5 1 2) B5_1_2Law (fun u => (stageBLaw (shape 5 1 2) u : ℝ)) (fun u => B5_1_2Little u ((stageBPriority (shape 5 1 2)) 2)) (fun u a => (littleLaw (shape 5 1 2) u ((stageBPriority (shape 5 1 2)) 2) a : ℝ)) (fun u _ => B5_1_2Law_sound u) (fun u _ a => B5_1_2Little_sound u ((stageBPriority (shape 5 1 2)) 2) a) (fun u _ a => B5_1_2Little_sound (complement (shape 5 1 2) u) ((stageBPriority (shape 5 1 2)) 2) a) a +def CB5_1_2I2PairCertificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(715243539925161855344559597823 / 100000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ ⟨(3533519351837877097933777673677 / 100000000000000000000000000000000), (1363128417 / 100000000000000000000000000000000)⟩ ⟨(-247015118249624467839772444506523 / 50000000000000000000000000000000), (95291206783 / 50000000000000000000000000000000)⟩ ⟨-8, 715243539925161855344559597823, 390625000000000000000000000000⟩, + .log ⟨(47206419312694013248239704463141 / 100000000000000000000000000000000), (47 / 100000000000000000000000000000000)⟩ ⟨(17717520383457034023941812023077 / 50000000000000000000000000000000), (5997808889 / 20000000000000000000000000000000)⟩ ⟨(-37532015012824145859083618599493 / 50000000000000000000000000000000), (63527471149 / 100000000000000000000000000000000)⟩ ⟨-2, 47206419312694013248239704463141, 25000000000000000000000000000000⟩, + .log ⟨(519584286845206224103933984759 / 25000000000000000000000000000000), (1 / 20000000000000000000000000000000)⟩ ⟨(8050651056256028142810153266311 / 100000000000000000000000000000000), (1540367547 / 50000000000000000000000000000000)⟩ ⟨(-96840051509468401463964207778457 / 25000000000000000000000000000000), (148230766021 / 100000000000000000000000000000000)⟩ ⟨-6, 519584286845206224103933984759, 390625000000000000000000000000⟩] +lemma CB5_1_2I2PairCertificates_valid : + CB5_1_2I2PairCertificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB5_1_2I2PairCertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 1, 5 => 1 + | 2, 4 => 2 + | 3, 4 => 3 + | 4, 2 => 2 + | 4, 3 => 3 + | 5, 1 => 1 + | _, _ => 0 +def CB5_1_2I2PairP (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CB5_1_2I2PairCertificates (CB5_1_2I2PairCertificateIndex a)).input +lemma CB5_1_2I2PairP_check : ∀ a : PairSlot, contains (CB5_1_2I2PairRaw a) (CB5_1_2I2PairP a) = true := by + decide +kernel +lemma CB5_1_2I2PairP_sound (a : PairSlot) : + (CB5_1_2I2PairP a).Encloses (CB5_1_2I2PairValue a) := + contains_sound (CB5_1_2I2PairRaw_sound a) (CB5_1_2I2PairP_check a) +def CB5_1_2I2PairTerms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CB5_1_2I2PairCertificates (CB5_1_2I2PairCertificateIndex a)).output +lemma CB5_1_2I2PairTerms_sound (a : PairSlot) : + (CB5_1_2I2PairTerms a).Encloses (Foundation.entropyTerm (CB5_1_2I2PairValue a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB5_1_2I2PairCertificates_valid + (CB5_1_2I2PairCertificateIndex a) (CB5_1_2I2PairP_sound a) +def CB5_1_2I2PairEntropy : Ball := ⟨(23509605587503986644313777493071 / 25000000000000000000000000000000), (8608226989 / 12500000000000000000000000000000)⟩ +lemma CB5_1_2I2PairEntropy_sound : CB5_1_2I2PairEntropy.Encloses (Foundation.finiteEntropy CB5_1_2I2PairValue) := by + exact contains_sound (entropyPair_enclosed CB5_1_2I2PairValue CB5_1_2I2PairTerms CB5_1_2I2PairTerms_sound) (by decide +kernel) +def CB5_1_2I2PairMass : Ball := ⟨1, (11 / 10000000000000000000000000000000)⟩ +lemma CB5_1_2I2PairMass_sound : CB5_1_2I2PairMass.Encloses (∑ a, CB5_1_2I2PairValue a) := by + exact contains_sound (pairSumBall_sound CB5_1_2I2PairP CB5_1_2I2PairValue CB5_1_2I2PairP_sound) (by decide +kernel) +def CB5_1_2I2PairMassTermLogWitness : LogWitness := ⟨0, 1, 1⟩ +def CB5_1_2I2PairMassTermLog : Ball := ⟨0, (1323488987 / 6250000000000000000000000000000)⟩ +lemma CB5_1_2I2PairMassTermLog_sound : CB5_1_2I2PairMassTermLog.Encloses (Real.log ((∑ a, CB5_1_2I2PairValue a))) := by + exact checkLog_sound logTwoBall_sound (CB5_1_2I2PairMass_sound) (w := CB5_1_2I2PairMassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB5_1_2I2PairMassTerm : Ball := ⟨0, (21175823793 / 100000000000000000000000000000000)⟩ +lemma CB5_1_2I2PairMassTerm_sound : CB5_1_2I2PairMassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB5_1_2I2PairValue a))) := by + exact contains_sound (entropyTerm_ball (CB5_1_2I2PairMass_sound) CB5_1_2I2PairMassTermLog_sound) (by decide +kernel) +def CB5_1_2I2PairH : Ball := ⟨(23509605587503986644313777493071 / 25000000000000000000000000000000), (18008327941 / 20000000000000000000000000000000)⟩ +lemma CB5_1_2I2PairH_sound : CB5_1_2I2PairH.Encloses (homogeneousEntropy CB5_1_2I2PairValue) := by + exact contains_sound (homogeneous_enclosed CB5_1_2I2PairValue CB5_1_2I2PairMassTerm_sound CB5_1_2I2PairEntropy_sound) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CB5_1_2I2R0Value (a : Fin 6) : ℝ := residualLaw (below (shape 5 1 2)) (fun u => (stageBLaw (shape 5 1 2) u : ℝ)) (stageBPriority (shape 5 1 2)) 2 (fun u a => (littleLaw (shape 5 1 2) u ((stageBPriority (shape 5 1 2)) 2) a : ℝ)) 0 a +def CB5_1_2I2R0Raw (a : Fin 6) : Ball := residualBall (below (shape 5 1 2)) B5_1_2Law (stageBPriority (shape 5 1 2)) 2 (fun u => B5_1_2Little u ((stageBPriority (shape 5 1 2)) 2)) 0 a +lemma CB5_1_2I2R0Raw_sound (a : Fin 6) : + (CB5_1_2I2R0Raw a).Encloses (CB5_1_2I2R0Value a) := by + exact residualBall_sound_on (below (shape 5 1 2)) B5_1_2Law (fun u => (stageBLaw (shape 5 1 2) u : ℝ)) (stageBPriority (shape 5 1 2)) 2 (fun u => B5_1_2Little u ((stageBPriority (shape 5 1 2)) 2)) (fun u a => (littleLaw (shape 5 1 2) u ((stageBPriority (shape 5 1 2)) 2) a : ℝ)) (fun u _ => B5_1_2Law_sound u) (fun u _ a => B5_1_2Little_sound u ((stageBPriority (shape 5 1 2)) 2) a) 0 a +def CB5_1_2I2R0Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB5_1_2I2R0Certificates_valid : + CB5_1_2I2R0Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB5_1_2I2R0CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB5_1_2I2R0P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB5_1_2I2R0Certificates (CB5_1_2I2R0CertificateIndex a)).input +lemma CB5_1_2I2R0P_check : ∀ a : Fin 6, contains (CB5_1_2I2R0Raw a) (CB5_1_2I2R0P a) = true := by + decide +kernel +lemma CB5_1_2I2R0P_sound (a : Fin 6) : + (CB5_1_2I2R0P a).Encloses (CB5_1_2I2R0Value a) := + contains_sound (CB5_1_2I2R0Raw_sound a) (CB5_1_2I2R0P_check a) +def CB5_1_2I2R0Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB5_1_2I2R0Certificates (CB5_1_2I2R0CertificateIndex a)).output +lemma CB5_1_2I2R0Terms_sound (a : Fin 6) : + (CB5_1_2I2R0Terms a).Encloses (Foundation.entropyTerm (CB5_1_2I2R0Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB5_1_2I2R0Certificates_valid + (CB5_1_2I2R0CertificateIndex a) (CB5_1_2I2R0P_sound a) +def CB5_1_2I2R0Entropy : Ball := ⟨0, 0⟩ +lemma CB5_1_2I2R0Entropy_sound : CB5_1_2I2R0Entropy.Encloses (Foundation.finiteEntropy CB5_1_2I2R0Value) := by + exact contains_sound (entropyFin_enclosed 6 CB5_1_2I2R0Value CB5_1_2I2R0Terms CB5_1_2I2R0Terms_sound) (by decide +kernel) +def CB5_1_2I2R0Mass : Ball := ⟨0, 0⟩ +lemma CB5_1_2I2R0Mass_sound : CB5_1_2I2R0Mass.Encloses (∑ a, CB5_1_2I2R0Value a) := by + exact contains_sound (finSumBall_sound 6 CB5_1_2I2R0P CB5_1_2I2R0Value CB5_1_2I2R0P_sound) (by decide +kernel) +def CB5_1_2I2R0MassTerm : Ball := .exact 0 +lemma CB5_1_2I2R0MassTerm_sound : CB5_1_2I2R0MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB5_1_2I2R0Value a))) := + entropyTerm_zero_ball (CB5_1_2I2R0Mass_sound) +def CB5_1_2I2R0H : Ball := ⟨0, 0⟩ +lemma CB5_1_2I2R0H_sound : CB5_1_2I2R0H.Encloses (homogeneousEntropy CB5_1_2I2R0Value) := by + exact contains_sound (homogeneous_enclosed CB5_1_2I2R0Value CB5_1_2I2R0MassTerm_sound CB5_1_2I2R0Entropy_sound) (by decide +kernel) +def CB5_1_2I2R1Value (a : Fin 6) : ℝ := residualLaw (below (shape 5 1 2)) (fun u => (stageBLaw (shape 5 1 2) u : ℝ)) (stageBPriority (shape 5 1 2)) 2 (fun u a => (littleLaw (shape 5 1 2) u ((stageBPriority (shape 5 1 2)) 2) a : ℝ)) 1 a +def CB5_1_2I2R1Raw (a : Fin 6) : Ball := residualBall (below (shape 5 1 2)) B5_1_2Law (stageBPriority (shape 5 1 2)) 2 (fun u => B5_1_2Little u ((stageBPriority (shape 5 1 2)) 2)) 1 a +lemma CB5_1_2I2R1Raw_sound (a : Fin 6) : + (CB5_1_2I2R1Raw a).Encloses (CB5_1_2I2R1Value a) := by + exact residualBall_sound_on (below (shape 5 1 2)) B5_1_2Law (fun u => (stageBLaw (shape 5 1 2) u : ℝ)) (stageBPriority (shape 5 1 2)) 2 (fun u => B5_1_2Little u ((stageBPriority (shape 5 1 2)) 2)) (fun u a => (littleLaw (shape 5 1 2) u ((stageBPriority (shape 5 1 2)) 2) a : ℝ)) (fun u _ => B5_1_2Law_sound u) (fun u _ a => B5_1_2Little_sound u ((stageBPriority (shape 5 1 2)) 2) a) 1 a +def CB5_1_2I2R1Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(715243539925161855344559597823 / 100000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ ⟨(3533519351837877097933777673677 / 100000000000000000000000000000000), (1363128417 / 100000000000000000000000000000000)⟩ ⟨(-247015118249624467839772444506523 / 50000000000000000000000000000000), (95291206783 / 50000000000000000000000000000000)⟩ ⟨-8, 715243539925161855344559597823, 390625000000000000000000000000⟩] +lemma CB5_1_2I2R1Certificates_valid : + CB5_1_2I2R1Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB5_1_2I2R1CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | 1 => 1 + | _ => 0 +def CB5_1_2I2R1P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB5_1_2I2R1Certificates (CB5_1_2I2R1CertificateIndex a)).input +lemma CB5_1_2I2R1P_check : ∀ a : Fin 6, contains (CB5_1_2I2R1Raw a) (CB5_1_2I2R1P a) = true := by + decide +kernel +lemma CB5_1_2I2R1P_sound (a : Fin 6) : + (CB5_1_2I2R1P a).Encloses (CB5_1_2I2R1Value a) := + contains_sound (CB5_1_2I2R1Raw_sound a) (CB5_1_2I2R1P_check a) +def CB5_1_2I2R1Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB5_1_2I2R1Certificates (CB5_1_2I2R1CertificateIndex a)).output +lemma CB5_1_2I2R1Terms_sound (a : Fin 6) : + (CB5_1_2I2R1Terms a).Encloses (Foundation.entropyTerm (CB5_1_2I2R1Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB5_1_2I2R1Certificates_valid + (CB5_1_2I2R1CertificateIndex a) (CB5_1_2I2R1P_sound a) +def CB5_1_2I2R1Entropy : Ball := ⟨(3533519351837877097933777673677 / 100000000000000000000000000000000), (1363128417 / 100000000000000000000000000000000)⟩ +lemma CB5_1_2I2R1Entropy_sound : CB5_1_2I2R1Entropy.Encloses (Foundation.finiteEntropy CB5_1_2I2R1Value) := by + exact contains_sound (entropyFin_enclosed 6 CB5_1_2I2R1Value CB5_1_2I2R1Terms CB5_1_2I2R1Terms_sound) (by decide +kernel) +def CB5_1_2I2R1Mass : Ball := ⟨(715243539925161855344559597823 / 100000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +lemma CB5_1_2I2R1Mass_sound : CB5_1_2I2R1Mass.Encloses (∑ a, CB5_1_2I2R1Value a) := by + exact contains_sound (finSumBall_sound 6 CB5_1_2I2R1P CB5_1_2I2R1Value CB5_1_2I2R1P_sound) (by decide +kernel) +def CB5_1_2I2R1MassTermLogWitness : LogWitness := ⟨-8, 715243539925161855344559597823, 390625000000000000000000000000⟩ +def CB5_1_2I2R1MassTermLog : Ball := ⟨(-247015118249624467839772444506523 / 50000000000000000000000000000000), (95291206783 / 50000000000000000000000000000000)⟩ +lemma CB5_1_2I2R1MassTermLog_sound : CB5_1_2I2R1MassTermLog.Encloses (Real.log ((∑ a, CB5_1_2I2R1Value a))) := by + exact checkLog_sound logTwoBall_sound (CB5_1_2I2R1Mass_sound) (w := CB5_1_2I2R1MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB5_1_2I2R1MassTerm : Ball := ⟨(3533519351837877097933777673677 / 100000000000000000000000000000000), (1363128417 / 100000000000000000000000000000000)⟩ +lemma CB5_1_2I2R1MassTerm_sound : CB5_1_2I2R1MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB5_1_2I2R1Value a))) := by + exact contains_sound (entropyTerm_ball (CB5_1_2I2R1Mass_sound) CB5_1_2I2R1MassTermLog_sound) (by decide +kernel) +def CB5_1_2I2R1H : Ball := ⟨0, (1363128417 / 50000000000000000000000000000000)⟩ +lemma CB5_1_2I2R1H_sound : CB5_1_2I2R1H.Encloses (homogeneousEntropy CB5_1_2I2R1Value) := by + exact contains_sound (homogeneous_enclosed CB5_1_2I2R1Value CB5_1_2I2R1MassTerm_sound CB5_1_2I2R1Entropy_sound) (by decide +kernel) +def CB5_1_2I2R2Value (a : Fin 6) : ℝ := residualLaw (below (shape 5 1 2)) (fun u => (stageBLaw (shape 5 1 2) u : ℝ)) (stageBPriority (shape 5 1 2)) 2 (fun u a => (littleLaw (shape 5 1 2) u ((stageBPriority (shape 5 1 2)) 2) a : ℝ)) 2 a +def CB5_1_2I2R2Raw (a : Fin 6) : Ball := residualBall (below (shape 5 1 2)) B5_1_2Law (stageBPriority (shape 5 1 2)) 2 (fun u => B5_1_2Little u ((stageBPriority (shape 5 1 2)) 2)) 2 a +lemma CB5_1_2I2R2Raw_sound (a : Fin 6) : + (CB5_1_2I2R2Raw a).Encloses (CB5_1_2I2R2Value a) := by + exact residualBall_sound_on (below (shape 5 1 2)) B5_1_2Law (fun u => (stageBLaw (shape 5 1 2) u : ℝ)) (stageBPriority (shape 5 1 2)) 2 (fun u => B5_1_2Little u ((stageBPriority (shape 5 1 2)) 2)) (fun u a => (littleLaw (shape 5 1 2) u ((stageBPriority (shape 5 1 2)) 2) a : ℝ)) (fun u _ => B5_1_2Law_sound u) (fun u _ a => B5_1_2Little_sound u ((stageBPriority (shape 5 1 2)) 2) a) 2 a +def CB5_1_2I2R2Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(957836126388584464034420063 / 3051757812500000000000000000), (17 / 100000000000000000000000000000000)⟩ ⟨(2273150951942751179081618308153 / 6250000000000000000000000000000), (9969484907 / 50000000000000000000000000000000)⟩ ⟨(-28969908256597909506085221295941 / 25000000000000000000000000000000), (63527471103 / 100000000000000000000000000000000)⟩ ⟨-2, 957836126388584464034420063, 762939453125000000000000000⟩, + .log ⟨(25121351209792538452245608641 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(839024168275589113007705883313 / 100000000000000000000000000000000), (146290463 / 50000000000000000000000000000000)⟩ ⟨(-166994235554600585818279647600737 / 25000000000000000000000000000000), (232934061309 / 100000000000000000000000000000000)⟩ ⟨-10, 25121351209792538452245608641, 19531250000000000000000000000⟩] +lemma CB5_1_2I2R2Certificates_valid : + CB5_1_2I2R2Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB5_1_2I2R2CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | 2 => 1 + | 3 => 2 + | _ => 0 +def CB5_1_2I2R2P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB5_1_2I2R2Certificates (CB5_1_2I2R2CertificateIndex a)).input +lemma CB5_1_2I2R2P_check : ∀ a : Fin 6, contains (CB5_1_2I2R2Raw a) (CB5_1_2I2R2P a) = true := by + decide +kernel +lemma CB5_1_2I2R2P_sound (a : Fin 6) : + (CB5_1_2I2R2P a).Encloses (CB5_1_2I2R2Value a) := + contains_sound (CB5_1_2I2R2Raw_sound a) (CB5_1_2I2R2P_check a) +def CB5_1_2I2R2Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB5_1_2I2R2Certificates (CB5_1_2I2R2CertificateIndex a)).output +lemma CB5_1_2I2R2Terms_sound (a : Fin 6) : + (CB5_1_2I2R2Terms a).Encloses (Foundation.entropyTerm (CB5_1_2I2R2Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB5_1_2I2R2Certificates_valid + (CB5_1_2I2R2CertificateIndex a) (CB5_1_2I2R2P_sound a) +def CB5_1_2I2R2Entropy : Ball := ⟨(37209439399359607978313598813761 / 100000000000000000000000000000000), (1011577537 / 5000000000000000000000000000000)⟩ +lemma CB5_1_2I2R2Entropy_sound : CB5_1_2I2R2Entropy.Encloses (Foundation.finiteEntropy CB5_1_2I2R2Value) := by + exact contains_sound (entropyFin_enclosed 6 CB5_1_2I2R2Value CB5_1_2I2R2Terms CB5_1_2I2R2Terms_sound) (by decide +kernel) +def CB5_1_2I2R2Mass : Ball := ⟨(31511980945550098409741104667589 / 100000000000000000000000000000000), (9 / 50000000000000000000000000000000)⟩ +lemma CB5_1_2I2R2Mass_sound : CB5_1_2I2R2Mass.Encloses (∑ a, CB5_1_2I2R2Value a) := by + exact contains_sound (finSumBall_sound 6 CB5_1_2I2R2P CB5_1_2I2R2Value CB5_1_2I2R2P_sound) (by decide +kernel) +def CB5_1_2I2R2MassTermLogWitness : LogWitness := ⟨-2, 31511980945550098409741104667589, 25000000000000000000000000000000⟩ +def CB5_1_2I2R2MassTermLog : Ball := ⟨(-23096047299849787135909000709867 / 20000000000000000000000000000000), (12705494221 / 20000000000000000000000000000000)⟩ +lemma CB5_1_2I2R2MassTermLog_sound : CB5_1_2I2R2MassTermLog.Encloses (Real.log ((∑ a, CB5_1_2I2R2Value a))) := by + exact checkLog_sound logTwoBall_sound (CB5_1_2I2R2Mass_sound) (w := CB5_1_2I2R2MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB5_1_2I2R2MassTerm : Ball := ⟨(36390110121519514624001162896127 / 100000000000000000000000000000000), (20018764611 / 100000000000000000000000000000000)⟩ +lemma CB5_1_2I2R2MassTerm_sound : CB5_1_2I2R2MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB5_1_2I2R2Value a))) := by + exact contains_sound (entropyTerm_ball (CB5_1_2I2R2Mass_sound) CB5_1_2I2R2MassTermLog_sound) (by decide +kernel) +def CB5_1_2I2R2H : Ball := ⟨(409664638920046677156217958817 / 50000000000000000000000000000000), (40250315351 / 100000000000000000000000000000000)⟩ +lemma CB5_1_2I2R2H_sound : CB5_1_2I2R2H.Encloses (homogeneousEntropy CB5_1_2I2R2Value) := by + exact contains_sound (homogeneous_enclosed CB5_1_2I2R2Value CB5_1_2I2R2MassTerm_sound CB5_1_2I2R2Entropy_sound) (by decide +kernel) +def CB5_1_2I2R3Value (a : Fin 6) : ℝ := residualLaw (below (shape 5 1 2)) (fun u => (stageBLaw (shape 5 1 2) u : ℝ)) (stageBPriority (shape 5 1 2)) 2 (fun u a => (littleLaw (shape 5 1 2) u ((stageBPriority (shape 5 1 2)) 2) a : ℝ)) 3 a +def CB5_1_2I2R3Raw (a : Fin 6) : Ball := residualBall (below (shape 5 1 2)) B5_1_2Law (stageBPriority (shape 5 1 2)) 2 (fun u => B5_1_2Little u ((stageBPriority (shape 5 1 2)) 2)) 3 a +lemma CB5_1_2I2R3Raw_sound (a : Fin 6) : + (CB5_1_2I2R3Raw a).Encloses (CB5_1_2I2R3Value a) := by + exact residualBall_sound_on (below (shape 5 1 2)) B5_1_2Law (fun u => (stageBLaw (shape 5 1 2) u : ℝ)) (stageBPriority (shape 5 1 2)) 2 (fun u => B5_1_2Little u ((stageBPriority (shape 5 1 2)) 2)) (fun u a => (littleLaw (shape 5 1 2) u ((stageBPriority (shape 5 1 2)) 2) a : ℝ)) (fun u _ => B5_1_2Law_sound u) (fun u _ a => B5_1_2Little_sound u ((stageBPriority (shape 5 1 2)) 2) a) 3 a +def CB5_1_2I2R3Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB5_1_2I2R3Certificates_valid : + CB5_1_2I2R3Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB5_1_2I2R3CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB5_1_2I2R3P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB5_1_2I2R3Certificates (CB5_1_2I2R3CertificateIndex a)).input +lemma CB5_1_2I2R3P_check : ∀ a : Fin 6, contains (CB5_1_2I2R3Raw a) (CB5_1_2I2R3P a) = true := by + decide +kernel +lemma CB5_1_2I2R3P_sound (a : Fin 6) : + (CB5_1_2I2R3P a).Encloses (CB5_1_2I2R3Value a) := + contains_sound (CB5_1_2I2R3Raw_sound a) (CB5_1_2I2R3P_check a) +def CB5_1_2I2R3Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB5_1_2I2R3Certificates (CB5_1_2I2R3CertificateIndex a)).output +lemma CB5_1_2I2R3Terms_sound (a : Fin 6) : + (CB5_1_2I2R3Terms a).Encloses (Foundation.entropyTerm (CB5_1_2I2R3Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB5_1_2I2R3Certificates_valid + (CB5_1_2I2R3CertificateIndex a) (CB5_1_2I2R3P_sound a) +def CB5_1_2I2R3Entropy : Ball := ⟨0, 0⟩ +lemma CB5_1_2I2R3Entropy_sound : CB5_1_2I2R3Entropy.Encloses (Foundation.finiteEntropy CB5_1_2I2R3Value) := by + exact contains_sound (entropyFin_enclosed 6 CB5_1_2I2R3Value CB5_1_2I2R3Terms CB5_1_2I2R3Terms_sound) (by decide +kernel) +def CB5_1_2I2R3Mass : Ball := ⟨0, 0⟩ +lemma CB5_1_2I2R3Mass_sound : CB5_1_2I2R3Mass.Encloses (∑ a, CB5_1_2I2R3Value a) := by + exact contains_sound (finSumBall_sound 6 CB5_1_2I2R3P CB5_1_2I2R3Value CB5_1_2I2R3P_sound) (by decide +kernel) +def CB5_1_2I2R3MassTerm : Ball := .exact 0 +lemma CB5_1_2I2R3MassTerm_sound : CB5_1_2I2R3MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB5_1_2I2R3Value a))) := + entropyTerm_zero_ball (CB5_1_2I2R3Mass_sound) +def CB5_1_2I2R3H : Ball := ⟨0, 0⟩ +lemma CB5_1_2I2R3H_sound : CB5_1_2I2R3H.Encloses (homogeneousEntropy CB5_1_2I2R3Value) := by + exact contains_sound (homogeneous_enclosed CB5_1_2I2R3Value CB5_1_2I2R3MassTerm_sound CB5_1_2I2R3Entropy_sound) (by decide +kernel) +def CB5_1_2I2R4Value (a : Fin 6) : ℝ := residualLaw (below (shape 5 1 2)) (fun u => (stageBLaw (shape 5 1 2) u : ℝ)) (stageBPriority (shape 5 1 2)) 2 (fun u a => (littleLaw (shape 5 1 2) u ((stageBPriority (shape 5 1 2)) 2) a : ℝ)) 4 a +def CB5_1_2I2R4Raw (a : Fin 6) : Ball := residualBall (below (shape 5 1 2)) B5_1_2Law (stageBPriority (shape 5 1 2)) 2 (fun u => B5_1_2Little u ((stageBPriority (shape 5 1 2)) 2)) 4 a +lemma CB5_1_2I2R4Raw_sound (a : Fin 6) : + (CB5_1_2I2R4Raw a).Encloses (CB5_1_2I2R4Value a) := by + exact residualBall_sound_on (below (shape 5 1 2)) B5_1_2Law (fun u => (stageBLaw (shape 5 1 2) u : ℝ)) (stageBPriority (shape 5 1 2)) 2 (fun u => B5_1_2Little u ((stageBPriority (shape 5 1 2)) 2)) (fun u a => (littleLaw (shape 5 1 2) u ((stageBPriority (shape 5 1 2)) 2) a : ℝ)) (fun u _ => B5_1_2Law_sound u) (fun u _ a => B5_1_2Little_sound u ((stageBPriority (shape 5 1 2)) 2) a) 4 a +def CB5_1_2I2R4Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB5_1_2I2R4Certificates_valid : + CB5_1_2I2R4Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB5_1_2I2R4CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB5_1_2I2R4P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB5_1_2I2R4Certificates (CB5_1_2I2R4CertificateIndex a)).input +lemma CB5_1_2I2R4P_check : ∀ a : Fin 6, contains (CB5_1_2I2R4Raw a) (CB5_1_2I2R4P a) = true := by + decide +kernel +lemma CB5_1_2I2R4P_sound (a : Fin 6) : + (CB5_1_2I2R4P a).Encloses (CB5_1_2I2R4Value a) := + contains_sound (CB5_1_2I2R4Raw_sound a) (CB5_1_2I2R4P_check a) +def CB5_1_2I2R4Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB5_1_2I2R4Certificates (CB5_1_2I2R4CertificateIndex a)).output +lemma CB5_1_2I2R4Terms_sound (a : Fin 6) : + (CB5_1_2I2R4Terms a).Encloses (Foundation.entropyTerm (CB5_1_2I2R4Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB5_1_2I2R4Certificates_valid + (CB5_1_2I2R4CertificateIndex a) (CB5_1_2I2R4P_sound a) +def CB5_1_2I2R4Entropy : Ball := ⟨0, 0⟩ +lemma CB5_1_2I2R4Entropy_sound : CB5_1_2I2R4Entropy.Encloses (Foundation.finiteEntropy CB5_1_2I2R4Value) := by + exact contains_sound (entropyFin_enclosed 6 CB5_1_2I2R4Value CB5_1_2I2R4Terms CB5_1_2I2R4Terms_sound) (by decide +kernel) +def CB5_1_2I2R4Mass : Ball := ⟨0, 0⟩ +lemma CB5_1_2I2R4Mass_sound : CB5_1_2I2R4Mass.Encloses (∑ a, CB5_1_2I2R4Value a) := by + exact contains_sound (finSumBall_sound 6 CB5_1_2I2R4P CB5_1_2I2R4Value CB5_1_2I2R4P_sound) (by decide +kernel) +def CB5_1_2I2R4MassTerm : Ball := .exact 0 +lemma CB5_1_2I2R4MassTerm_sound : CB5_1_2I2R4MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB5_1_2I2R4Value a))) := + entropyTerm_zero_ball (CB5_1_2I2R4Mass_sound) +def CB5_1_2I2R4H : Ball := ⟨0, 0⟩ +lemma CB5_1_2I2R4H_sound : CB5_1_2I2R4H.Encloses (homogeneousEntropy CB5_1_2I2R4Value) := by + exact contains_sound (homogeneous_enclosed CB5_1_2I2R4Value CB5_1_2I2R4MassTerm_sound CB5_1_2I2R4Entropy_sound) (by decide +kernel) +def CB5_1_2I2R5Value (a : Fin 6) : ℝ := residualLaw (below (shape 5 1 2)) (fun u => (stageBLaw (shape 5 1 2) u : ℝ)) (stageBPriority (shape 5 1 2)) 2 (fun u a => (littleLaw (shape 5 1 2) u ((stageBPriority (shape 5 1 2)) 2) a : ℝ)) 5 a +def CB5_1_2I2R5Raw (a : Fin 6) : Ball := residualBall (below (shape 5 1 2)) B5_1_2Law (stageBPriority (shape 5 1 2)) 2 (fun u => B5_1_2Little u ((stageBPriority (shape 5 1 2)) 2)) 5 a +lemma CB5_1_2I2R5Raw_sound (a : Fin 6) : + (CB5_1_2I2R5Raw a).Encloses (CB5_1_2I2R5Value a) := by + exact residualBall_sound_on (below (shape 5 1 2)) B5_1_2Law (fun u => (stageBLaw (shape 5 1 2) u : ℝ)) (stageBPriority (shape 5 1 2)) 2 (fun u => B5_1_2Little u ((stageBPriority (shape 5 1 2)) 2)) (fun u a => (littleLaw (shape 5 1 2) u ((stageBPriority (shape 5 1 2)) 2) a : ℝ)) (fun u _ => B5_1_2Law_sound u) (fun u _ a => B5_1_2Little_sound u ((stageBPriority (shape 5 1 2)) 2) a) 5 a +def CB5_1_2I2R5Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB5_1_2I2R5Certificates_valid : + CB5_1_2I2R5Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB5_1_2I2R5CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB5_1_2I2R5P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB5_1_2I2R5Certificates (CB5_1_2I2R5CertificateIndex a)).input +lemma CB5_1_2I2R5P_check : ∀ a : Fin 6, contains (CB5_1_2I2R5Raw a) (CB5_1_2I2R5P a) = true := by + decide +kernel +lemma CB5_1_2I2R5P_sound (a : Fin 6) : + (CB5_1_2I2R5P a).Encloses (CB5_1_2I2R5Value a) := + contains_sound (CB5_1_2I2R5Raw_sound a) (CB5_1_2I2R5P_check a) +def CB5_1_2I2R5Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB5_1_2I2R5Certificates (CB5_1_2I2R5CertificateIndex a)).output +lemma CB5_1_2I2R5Terms_sound (a : Fin 6) : + (CB5_1_2I2R5Terms a).Encloses (Foundation.entropyTerm (CB5_1_2I2R5Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB5_1_2I2R5Certificates_valid + (CB5_1_2I2R5CertificateIndex a) (CB5_1_2I2R5P_sound a) +def CB5_1_2I2R5Entropy : Ball := ⟨0, 0⟩ +lemma CB5_1_2I2R5Entropy_sound : CB5_1_2I2R5Entropy.Encloses (Foundation.finiteEntropy CB5_1_2I2R5Value) := by + exact contains_sound (entropyFin_enclosed 6 CB5_1_2I2R5Value CB5_1_2I2R5Terms CB5_1_2I2R5Terms_sound) (by decide +kernel) +def CB5_1_2I2R5Mass : Ball := ⟨0, 0⟩ +lemma CB5_1_2I2R5Mass_sound : CB5_1_2I2R5Mass.Encloses (∑ a, CB5_1_2I2R5Value a) := by + exact contains_sound (finSumBall_sound 6 CB5_1_2I2R5P CB5_1_2I2R5Value CB5_1_2I2R5P_sound) (by decide +kernel) +def CB5_1_2I2R5MassTerm : Ball := .exact 0 +lemma CB5_1_2I2R5MassTerm_sound : CB5_1_2I2R5MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB5_1_2I2R5Value a))) := + entropyTerm_zero_ball (CB5_1_2I2R5Mass_sound) +def CB5_1_2I2R5H : Ball := ⟨0, 0⟩ +lemma CB5_1_2I2R5H_sound : CB5_1_2I2R5H.Encloses (homogeneousEntropy CB5_1_2I2R5Value) := by + exact contains_sound (homogeneous_enclosed CB5_1_2I2R5Value CB5_1_2I2R5MassTerm_sound CB5_1_2I2R5Entropy_sound) (by decide +kernel) +def CB5_1_2I2R6Value (a : Fin 6) : ℝ := residualLaw (below (shape 5 1 2)) (fun u => (stageBLaw (shape 5 1 2) u : ℝ)) (stageBPriority (shape 5 1 2)) 2 (fun u a => (littleLaw (shape 5 1 2) u ((stageBPriority (shape 5 1 2)) 2) a : ℝ)) 6 a +def CB5_1_2I2R6Raw (a : Fin 6) : Ball := residualBall (below (shape 5 1 2)) B5_1_2Law (stageBPriority (shape 5 1 2)) 2 (fun u => B5_1_2Little u ((stageBPriority (shape 5 1 2)) 2)) 6 a +lemma CB5_1_2I2R6Raw_sound (a : Fin 6) : + (CB5_1_2I2R6Raw a).Encloses (CB5_1_2I2R6Value a) := by + exact residualBall_sound_on (below (shape 5 1 2)) B5_1_2Law (fun u => (stageBLaw (shape 5 1 2) u : ℝ)) (stageBPriority (shape 5 1 2)) 2 (fun u => B5_1_2Little u ((stageBPriority (shape 5 1 2)) 2)) (fun u a => (littleLaw (shape 5 1 2) u ((stageBPriority (shape 5 1 2)) 2) a : ℝ)) (fun u _ => B5_1_2Law_sound u) (fun u _ a => B5_1_2Little_sound u ((stageBPriority (shape 5 1 2)) 2) a) 6 a +def CB5_1_2I2R6Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB5_1_2I2R6Certificates_valid : + CB5_1_2I2R6Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB5_1_2I2R6CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB5_1_2I2R6P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB5_1_2I2R6Certificates (CB5_1_2I2R6CertificateIndex a)).input +lemma CB5_1_2I2R6P_check : ∀ a : Fin 6, contains (CB5_1_2I2R6Raw a) (CB5_1_2I2R6P a) = true := by + decide +kernel +lemma CB5_1_2I2R6P_sound (a : Fin 6) : + (CB5_1_2I2R6P a).Encloses (CB5_1_2I2R6Value a) := + contains_sound (CB5_1_2I2R6Raw_sound a) (CB5_1_2I2R6P_check a) +def CB5_1_2I2R6Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB5_1_2I2R6Certificates (CB5_1_2I2R6CertificateIndex a)).output +lemma CB5_1_2I2R6Terms_sound (a : Fin 6) : + (CB5_1_2I2R6Terms a).Encloses (Foundation.entropyTerm (CB5_1_2I2R6Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB5_1_2I2R6Certificates_valid + (CB5_1_2I2R6CertificateIndex a) (CB5_1_2I2R6P_sound a) +def CB5_1_2I2R6Entropy : Ball := ⟨0, 0⟩ +lemma CB5_1_2I2R6Entropy_sound : CB5_1_2I2R6Entropy.Encloses (Foundation.finiteEntropy CB5_1_2I2R6Value) := by + exact contains_sound (entropyFin_enclosed 6 CB5_1_2I2R6Value CB5_1_2I2R6Terms CB5_1_2I2R6Terms_sound) (by decide +kernel) +def CB5_1_2I2R6Mass : Ball := ⟨0, 0⟩ +lemma CB5_1_2I2R6Mass_sound : CB5_1_2I2R6Mass.Encloses (∑ a, CB5_1_2I2R6Value a) := by + exact contains_sound (finSumBall_sound 6 CB5_1_2I2R6P CB5_1_2I2R6Value CB5_1_2I2R6P_sound) (by decide +kernel) +def CB5_1_2I2R6MassTerm : Ball := .exact 0 +lemma CB5_1_2I2R6MassTerm_sound : CB5_1_2I2R6MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB5_1_2I2R6Value a))) := + entropyTerm_zero_ball (CB5_1_2I2R6Mass_sound) +def CB5_1_2I2R6H : Ball := ⟨0, 0⟩ +lemma CB5_1_2I2R6H_sound : CB5_1_2I2R6H.Encloses (homogeneousEntropy CB5_1_2I2R6Value) := by + exact contains_sound (homogeneous_enclosed CB5_1_2I2R6Value CB5_1_2I2R6MassTerm_sound CB5_1_2I2R6Entropy_sound) (by decide +kernel) +def CB5_1_2I2R7Value (a : Fin 6) : ℝ := residualLaw (below (shape 5 1 2)) (fun u => (stageBLaw (shape 5 1 2) u : ℝ)) (stageBPriority (shape 5 1 2)) 2 (fun u a => (littleLaw (shape 5 1 2) u ((stageBPriority (shape 5 1 2)) 2) a : ℝ)) 7 a +def CB5_1_2I2R7Raw (a : Fin 6) : Ball := residualBall (below (shape 5 1 2)) B5_1_2Law (stageBPriority (shape 5 1 2)) 2 (fun u => B5_1_2Little u ((stageBPriority (shape 5 1 2)) 2)) 7 a +lemma CB5_1_2I2R7Raw_sound (a : Fin 6) : + (CB5_1_2I2R7Raw a).Encloses (CB5_1_2I2R7Value a) := by + exact residualBall_sound_on (below (shape 5 1 2)) B5_1_2Law (fun u => (stageBLaw (shape 5 1 2) u : ℝ)) (stageBPriority (shape 5 1 2)) 2 (fun u => B5_1_2Little u ((stageBPriority (shape 5 1 2)) 2)) (fun u a => (littleLaw (shape 5 1 2) u ((stageBPriority (shape 5 1 2)) 2) a : ℝ)) (fun u _ => B5_1_2Law_sound u) (fun u _ a => B5_1_2Little_sound u ((stageBPriority (shape 5 1 2)) 2) a) 7 a +def CB5_1_2I2R7Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB5_1_2I2R7Certificates_valid : + CB5_1_2I2R7Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB5_1_2I2R7CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB5_1_2I2R7P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB5_1_2I2R7Certificates (CB5_1_2I2R7CertificateIndex a)).input +lemma CB5_1_2I2R7P_check : ∀ a : Fin 6, contains (CB5_1_2I2R7Raw a) (CB5_1_2I2R7P a) = true := by + decide +kernel +lemma CB5_1_2I2R7P_sound (a : Fin 6) : + (CB5_1_2I2R7P a).Encloses (CB5_1_2I2R7Value a) := + contains_sound (CB5_1_2I2R7Raw_sound a) (CB5_1_2I2R7P_check a) +def CB5_1_2I2R7Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB5_1_2I2R7Certificates (CB5_1_2I2R7CertificateIndex a)).output +lemma CB5_1_2I2R7Terms_sound (a : Fin 6) : + (CB5_1_2I2R7Terms a).Encloses (Foundation.entropyTerm (CB5_1_2I2R7Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB5_1_2I2R7Certificates_valid + (CB5_1_2I2R7CertificateIndex a) (CB5_1_2I2R7P_sound a) +def CB5_1_2I2R7Entropy : Ball := ⟨0, 0⟩ +lemma CB5_1_2I2R7Entropy_sound : CB5_1_2I2R7Entropy.Encloses (Foundation.finiteEntropy CB5_1_2I2R7Value) := by + exact contains_sound (entropyFin_enclosed 6 CB5_1_2I2R7Value CB5_1_2I2R7Terms CB5_1_2I2R7Terms_sound) (by decide +kernel) +def CB5_1_2I2R7Mass : Ball := ⟨0, 0⟩ +lemma CB5_1_2I2R7Mass_sound : CB5_1_2I2R7Mass.Encloses (∑ a, CB5_1_2I2R7Value a) := by + exact contains_sound (finSumBall_sound 6 CB5_1_2I2R7P CB5_1_2I2R7Value CB5_1_2I2R7P_sound) (by decide +kernel) +def CB5_1_2I2R7MassTerm : Ball := .exact 0 +lemma CB5_1_2I2R7MassTerm_sound : CB5_1_2I2R7MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB5_1_2I2R7Value a))) := + entropyTerm_zero_ball (CB5_1_2I2R7Mass_sound) +def CB5_1_2I2R7H : Ball := ⟨0, 0⟩ +lemma CB5_1_2I2R7H_sound : CB5_1_2I2R7H.Encloses (homogeneousEntropy CB5_1_2I2R7Value) := by + exact contains_sound (homogeneous_enclosed CB5_1_2I2R7Value CB5_1_2I2R7MassTerm_sound CB5_1_2I2R7Entropy_sound) (by decide +kernel) +def CB5_1_2I2R8Value (a : Fin 6) : ℝ := residualLaw (below (shape 5 1 2)) (fun u => (stageBLaw (shape 5 1 2) u : ℝ)) (stageBPriority (shape 5 1 2)) 2 (fun u a => (littleLaw (shape 5 1 2) u ((stageBPriority (shape 5 1 2)) 2) a : ℝ)) 8 a +def CB5_1_2I2R8Raw (a : Fin 6) : Ball := residualBall (below (shape 5 1 2)) B5_1_2Law (stageBPriority (shape 5 1 2)) 2 (fun u => B5_1_2Little u ((stageBPriority (shape 5 1 2)) 2)) 8 a +lemma CB5_1_2I2R8Raw_sound (a : Fin 6) : + (CB5_1_2I2R8Raw a).Encloses (CB5_1_2I2R8Value a) := by + exact residualBall_sound_on (below (shape 5 1 2)) B5_1_2Law (fun u => (stageBLaw (shape 5 1 2) u : ℝ)) (stageBPriority (shape 5 1 2)) 2 (fun u => B5_1_2Little u ((stageBPriority (shape 5 1 2)) 2)) (fun u a => (littleLaw (shape 5 1 2) u ((stageBPriority (shape 5 1 2)) 2) a : ℝ)) (fun u _ => B5_1_2Law_sound u) (fun u _ a => B5_1_2Little_sound u ((stageBPriority (shape 5 1 2)) 2) a) 8 a +def CB5_1_2I2R8Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB5_1_2I2R8Certificates_valid : + CB5_1_2I2R8Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB5_1_2I2R8CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB5_1_2I2R8P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB5_1_2I2R8Certificates (CB5_1_2I2R8CertificateIndex a)).input +lemma CB5_1_2I2R8P_check : ∀ a : Fin 6, contains (CB5_1_2I2R8Raw a) (CB5_1_2I2R8P a) = true := by + decide +kernel +lemma CB5_1_2I2R8P_sound (a : Fin 6) : + (CB5_1_2I2R8P a).Encloses (CB5_1_2I2R8Value a) := + contains_sound (CB5_1_2I2R8Raw_sound a) (CB5_1_2I2R8P_check a) +def CB5_1_2I2R8Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB5_1_2I2R8Certificates (CB5_1_2I2R8CertificateIndex a)).output +lemma CB5_1_2I2R8Terms_sound (a : Fin 6) : + (CB5_1_2I2R8Terms a).Encloses (Foundation.entropyTerm (CB5_1_2I2R8Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB5_1_2I2R8Certificates_valid + (CB5_1_2I2R8CertificateIndex a) (CB5_1_2I2R8P_sound a) +def CB5_1_2I2R8Entropy : Ball := ⟨0, 0⟩ +lemma CB5_1_2I2R8Entropy_sound : CB5_1_2I2R8Entropy.Encloses (Foundation.finiteEntropy CB5_1_2I2R8Value) := by + exact contains_sound (entropyFin_enclosed 6 CB5_1_2I2R8Value CB5_1_2I2R8Terms CB5_1_2I2R8Terms_sound) (by decide +kernel) +def CB5_1_2I2R8Mass : Ball := ⟨0, 0⟩ +lemma CB5_1_2I2R8Mass_sound : CB5_1_2I2R8Mass.Encloses (∑ a, CB5_1_2I2R8Value a) := by + exact contains_sound (finSumBall_sound 6 CB5_1_2I2R8P CB5_1_2I2R8Value CB5_1_2I2R8P_sound) (by decide +kernel) +def CB5_1_2I2R8MassTerm : Ball := .exact 0 +lemma CB5_1_2I2R8MassTerm_sound : CB5_1_2I2R8MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB5_1_2I2R8Value a))) := + entropyTerm_zero_ball (CB5_1_2I2R8Mass_sound) +def CB5_1_2I2R8H : Ball := ⟨0, 0⟩ +lemma CB5_1_2I2R8H_sound : CB5_1_2I2R8H.Encloses (homogeneousEntropy CB5_1_2I2R8Value) := by + exact contains_sound (homogeneous_enclosed CB5_1_2I2R8Value CB5_1_2I2R8MassTerm_sound CB5_1_2I2R8Entropy_sound) (by decide +kernel) +def CB5_1_2I2R9Value (a : Fin 6) : ℝ := residualLaw (below (shape 5 1 2)) (fun u => (stageBLaw (shape 5 1 2) u : ℝ)) (stageBPriority (shape 5 1 2)) 2 (fun u a => (littleLaw (shape 5 1 2) u ((stageBPriority (shape 5 1 2)) 2) a : ℝ)) 9 a +def CB5_1_2I2R9Raw (a : Fin 6) : Ball := residualBall (below (shape 5 1 2)) B5_1_2Law (stageBPriority (shape 5 1 2)) 2 (fun u => B5_1_2Little u ((stageBPriority (shape 5 1 2)) 2)) 9 a +lemma CB5_1_2I2R9Raw_sound (a : Fin 6) : + (CB5_1_2I2R9Raw a).Encloses (CB5_1_2I2R9Value a) := by + exact residualBall_sound_on (below (shape 5 1 2)) B5_1_2Law (fun u => (stageBLaw (shape 5 1 2) u : ℝ)) (stageBPriority (shape 5 1 2)) 2 (fun u => B5_1_2Little u ((stageBPriority (shape 5 1 2)) 2)) (fun u a => (littleLaw (shape 5 1 2) u ((stageBPriority (shape 5 1 2)) 2) a : ℝ)) (fun u _ => B5_1_2Law_sound u) (fun u _ a => B5_1_2Little_sound u ((stageBPriority (shape 5 1 2)) 2) a) 9 a +def CB5_1_2I2R9Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB5_1_2I2R9Certificates_valid : + CB5_1_2I2R9Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB5_1_2I2R9CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB5_1_2I2R9P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB5_1_2I2R9Certificates (CB5_1_2I2R9CertificateIndex a)).input +lemma CB5_1_2I2R9P_check : ∀ a : Fin 6, contains (CB5_1_2I2R9Raw a) (CB5_1_2I2R9P a) = true := by + decide +kernel +lemma CB5_1_2I2R9P_sound (a : Fin 6) : + (CB5_1_2I2R9P a).Encloses (CB5_1_2I2R9Value a) := + contains_sound (CB5_1_2I2R9Raw_sound a) (CB5_1_2I2R9P_check a) +def CB5_1_2I2R9Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB5_1_2I2R9Certificates (CB5_1_2I2R9CertificateIndex a)).output +lemma CB5_1_2I2R9Terms_sound (a : Fin 6) : + (CB5_1_2I2R9Terms a).Encloses (Foundation.entropyTerm (CB5_1_2I2R9Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB5_1_2I2R9Certificates_valid + (CB5_1_2I2R9CertificateIndex a) (CB5_1_2I2R9P_sound a) +def CB5_1_2I2R9Entropy : Ball := ⟨0, 0⟩ +lemma CB5_1_2I2R9Entropy_sound : CB5_1_2I2R9Entropy.Encloses (Foundation.finiteEntropy CB5_1_2I2R9Value) := by + exact contains_sound (entropyFin_enclosed 6 CB5_1_2I2R9Value CB5_1_2I2R9Terms CB5_1_2I2R9Terms_sound) (by decide +kernel) +def CB5_1_2I2R9Mass : Ball := ⟨0, 0⟩ +lemma CB5_1_2I2R9Mass_sound : CB5_1_2I2R9Mass.Encloses (∑ a, CB5_1_2I2R9Value a) := by + exact contains_sound (finSumBall_sound 6 CB5_1_2I2R9P CB5_1_2I2R9Value CB5_1_2I2R9P_sound) (by decide +kernel) +def CB5_1_2I2R9MassTerm : Ball := .exact 0 +lemma CB5_1_2I2R9MassTerm_sound : CB5_1_2I2R9MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB5_1_2I2R9Value a))) := + entropyTerm_zero_ball (CB5_1_2I2R9Mass_sound) +def CB5_1_2I2R9H : Ball := ⟨0, 0⟩ +lemma CB5_1_2I2R9H_sound : CB5_1_2I2R9H.Encloses (homogeneousEntropy CB5_1_2I2R9Value) := by + exact contains_sound (homogeneous_enclosed CB5_1_2I2R9Value CB5_1_2I2R9MassTerm_sound CB5_1_2I2R9Entropy_sound) (by decide +kernel) +def CB5_1_2I2R10Value (a : Fin 6) : ℝ := residualLaw (below (shape 5 1 2)) (fun u => (stageBLaw (shape 5 1 2) u : ℝ)) (stageBPriority (shape 5 1 2)) 2 (fun u a => (littleLaw (shape 5 1 2) u ((stageBPriority (shape 5 1 2)) 2) a : ℝ)) 10 a +def CB5_1_2I2R10Raw (a : Fin 6) : Ball := residualBall (below (shape 5 1 2)) B5_1_2Law (stageBPriority (shape 5 1 2)) 2 (fun u => B5_1_2Little u ((stageBPriority (shape 5 1 2)) 2)) 10 a +lemma CB5_1_2I2R10Raw_sound (a : Fin 6) : + (CB5_1_2I2R10Raw a).Encloses (CB5_1_2I2R10Value a) := by + exact residualBall_sound_on (below (shape 5 1 2)) B5_1_2Law (fun u => (stageBLaw (shape 5 1 2) u : ℝ)) (stageBPriority (shape 5 1 2)) 2 (fun u => B5_1_2Little u ((stageBPriority (shape 5 1 2)) 2)) (fun u a => (littleLaw (shape 5 1 2) u ((stageBPriority (shape 5 1 2)) 2) a : ℝ)) (fun u _ => B5_1_2Law_sound u) (fun u _ a => B5_1_2Little_sound u ((stageBPriority (shape 5 1 2)) 2) a) 10 a +def CB5_1_2I2R10Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB5_1_2I2R10Certificates_valid : + CB5_1_2I2R10Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB5_1_2I2R10CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB5_1_2I2R10P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB5_1_2I2R10Certificates (CB5_1_2I2R10CertificateIndex a)).input +lemma CB5_1_2I2R10P_check : ∀ a : Fin 6, contains (CB5_1_2I2R10Raw a) (CB5_1_2I2R10P a) = true := by + decide +kernel +lemma CB5_1_2I2R10P_sound (a : Fin 6) : + (CB5_1_2I2R10P a).Encloses (CB5_1_2I2R10Value a) := + contains_sound (CB5_1_2I2R10Raw_sound a) (CB5_1_2I2R10P_check a) +def CB5_1_2I2R10Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB5_1_2I2R10Certificates (CB5_1_2I2R10CertificateIndex a)).output +lemma CB5_1_2I2R10Terms_sound (a : Fin 6) : + (CB5_1_2I2R10Terms a).Encloses (Foundation.entropyTerm (CB5_1_2I2R10Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB5_1_2I2R10Certificates_valid + (CB5_1_2I2R10CertificateIndex a) (CB5_1_2I2R10P_sound a) +def CB5_1_2I2R10Entropy : Ball := ⟨0, 0⟩ +lemma CB5_1_2I2R10Entropy_sound : CB5_1_2I2R10Entropy.Encloses (Foundation.finiteEntropy CB5_1_2I2R10Value) := by + exact contains_sound (entropyFin_enclosed 6 CB5_1_2I2R10Value CB5_1_2I2R10Terms CB5_1_2I2R10Terms_sound) (by decide +kernel) +def CB5_1_2I2R10Mass : Ball := ⟨0, 0⟩ +lemma CB5_1_2I2R10Mass_sound : CB5_1_2I2R10Mass.Encloses (∑ a, CB5_1_2I2R10Value a) := by + exact contains_sound (finSumBall_sound 6 CB5_1_2I2R10P CB5_1_2I2R10Value CB5_1_2I2R10P_sound) (by decide +kernel) +def CB5_1_2I2R10MassTerm : Ball := .exact 0 +lemma CB5_1_2I2R10MassTerm_sound : CB5_1_2I2R10MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB5_1_2I2R10Value a))) := + entropyTerm_zero_ball (CB5_1_2I2R10Mass_sound) +def CB5_1_2I2R10H : Ball := ⟨0, 0⟩ +lemma CB5_1_2I2R10H_sound : CB5_1_2I2R10H.Encloses (homogeneousEntropy CB5_1_2I2R10Value) := by + exact contains_sound (homogeneous_enclosed CB5_1_2I2R10Value CB5_1_2I2R10MassTerm_sound CB5_1_2I2R10Entropy_sound) (by decide +kernel) +def CB5_1_2I2R11Value (a : Fin 6) : ℝ := residualLaw (below (shape 5 1 2)) (fun u => (stageBLaw (shape 5 1 2) u : ℝ)) (stageBPriority (shape 5 1 2)) 2 (fun u a => (littleLaw (shape 5 1 2) u ((stageBPriority (shape 5 1 2)) 2) a : ℝ)) 11 a +def CB5_1_2I2R11Raw (a : Fin 6) : Ball := residualBall (below (shape 5 1 2)) B5_1_2Law (stageBPriority (shape 5 1 2)) 2 (fun u => B5_1_2Little u ((stageBPriority (shape 5 1 2)) 2)) 11 a +lemma CB5_1_2I2R11Raw_sound (a : Fin 6) : + (CB5_1_2I2R11Raw a).Encloses (CB5_1_2I2R11Value a) := by + exact residualBall_sound_on (below (shape 5 1 2)) B5_1_2Law (fun u => (stageBLaw (shape 5 1 2) u : ℝ)) (stageBPriority (shape 5 1 2)) 2 (fun u => B5_1_2Little u ((stageBPriority (shape 5 1 2)) 2)) (fun u a => (littleLaw (shape 5 1 2) u ((stageBPriority (shape 5 1 2)) 2) a : ℝ)) (fun u _ => B5_1_2Law_sound u) (fun u _ a => B5_1_2Little_sound u ((stageBPriority (shape 5 1 2)) 2) a) 11 a +def CB5_1_2I2R11Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB5_1_2I2R11Certificates_valid : + CB5_1_2I2R11Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB5_1_2I2R11CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB5_1_2I2R11P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB5_1_2I2R11Certificates (CB5_1_2I2R11CertificateIndex a)).input +lemma CB5_1_2I2R11P_check : ∀ a : Fin 6, contains (CB5_1_2I2R11Raw a) (CB5_1_2I2R11P a) = true := by + decide +kernel +lemma CB5_1_2I2R11P_sound (a : Fin 6) : + (CB5_1_2I2R11P a).Encloses (CB5_1_2I2R11Value a) := + contains_sound (CB5_1_2I2R11Raw_sound a) (CB5_1_2I2R11P_check a) +def CB5_1_2I2R11Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB5_1_2I2R11Certificates (CB5_1_2I2R11CertificateIndex a)).output +lemma CB5_1_2I2R11Terms_sound (a : Fin 6) : + (CB5_1_2I2R11Terms a).Encloses (Foundation.entropyTerm (CB5_1_2I2R11Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB5_1_2I2R11Certificates_valid + (CB5_1_2I2R11CertificateIndex a) (CB5_1_2I2R11P_sound a) +def CB5_1_2I2R11Entropy : Ball := ⟨0, 0⟩ +lemma CB5_1_2I2R11Entropy_sound : CB5_1_2I2R11Entropy.Encloses (Foundation.finiteEntropy CB5_1_2I2R11Value) := by + exact contains_sound (entropyFin_enclosed 6 CB5_1_2I2R11Value CB5_1_2I2R11Terms CB5_1_2I2R11Terms_sound) (by decide +kernel) +def CB5_1_2I2R11Mass : Ball := ⟨0, 0⟩ +lemma CB5_1_2I2R11Mass_sound : CB5_1_2I2R11Mass.Encloses (∑ a, CB5_1_2I2R11Value a) := by + exact contains_sound (finSumBall_sound 6 CB5_1_2I2R11P CB5_1_2I2R11Value CB5_1_2I2R11P_sound) (by decide +kernel) +def CB5_1_2I2R11MassTerm : Ball := .exact 0 +lemma CB5_1_2I2R11MassTerm_sound : CB5_1_2I2R11MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB5_1_2I2R11Value a))) := + entropyTerm_zero_ball (CB5_1_2I2R11Mass_sound) +def CB5_1_2I2R11H : Ball := ⟨0, 0⟩ +lemma CB5_1_2I2R11H_sound : CB5_1_2I2R11H.Encloses (homogeneousEntropy CB5_1_2I2R11Value) := by + exact contains_sound (homogeneous_enclosed CB5_1_2I2R11Value CB5_1_2I2R11MassTerm_sound CB5_1_2I2R11Entropy_sound) (by decide +kernel) +def CB5_1_2I2R12Value (a : Fin 6) : ℝ := residualLaw (below (shape 5 1 2)) (fun u => (stageBLaw (shape 5 1 2) u : ℝ)) (stageBPriority (shape 5 1 2)) 2 (fun u a => (littleLaw (shape 5 1 2) u ((stageBPriority (shape 5 1 2)) 2) a : ℝ)) 12 a +def CB5_1_2I2R12Raw (a : Fin 6) : Ball := residualBall (below (shape 5 1 2)) B5_1_2Law (stageBPriority (shape 5 1 2)) 2 (fun u => B5_1_2Little u ((stageBPriority (shape 5 1 2)) 2)) 12 a +lemma CB5_1_2I2R12Raw_sound (a : Fin 6) : + (CB5_1_2I2R12Raw a).Encloses (CB5_1_2I2R12Value a) := by + exact residualBall_sound_on (below (shape 5 1 2)) B5_1_2Law (fun u => (stageBLaw (shape 5 1 2) u : ℝ)) (stageBPriority (shape 5 1 2)) 2 (fun u => B5_1_2Little u ((stageBPriority (shape 5 1 2)) 2)) (fun u a => (littleLaw (shape 5 1 2) u ((stageBPriority (shape 5 1 2)) 2) a : ℝ)) (fun u _ => B5_1_2Law_sound u) (fun u _ a => B5_1_2Little_sound u ((stageBPriority (shape 5 1 2)) 2) a) 12 a +def CB5_1_2I2R12Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB5_1_2I2R12Certificates_valid : + CB5_1_2I2R12Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB5_1_2I2R12CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB5_1_2I2R12P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB5_1_2I2R12Certificates (CB5_1_2I2R12CertificateIndex a)).input +lemma CB5_1_2I2R12P_check : ∀ a : Fin 6, contains (CB5_1_2I2R12Raw a) (CB5_1_2I2R12P a) = true := by + decide +kernel +lemma CB5_1_2I2R12P_sound (a : Fin 6) : + (CB5_1_2I2R12P a).Encloses (CB5_1_2I2R12Value a) := + contains_sound (CB5_1_2I2R12Raw_sound a) (CB5_1_2I2R12P_check a) +def CB5_1_2I2R12Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB5_1_2I2R12Certificates (CB5_1_2I2R12CertificateIndex a)).output +lemma CB5_1_2I2R12Terms_sound (a : Fin 6) : + (CB5_1_2I2R12Terms a).Encloses (Foundation.entropyTerm (CB5_1_2I2R12Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB5_1_2I2R12Certificates_valid + (CB5_1_2I2R12CertificateIndex a) (CB5_1_2I2R12P_sound a) +def CB5_1_2I2R12Entropy : Ball := ⟨0, 0⟩ +lemma CB5_1_2I2R12Entropy_sound : CB5_1_2I2R12Entropy.Encloses (Foundation.finiteEntropy CB5_1_2I2R12Value) := by + exact contains_sound (entropyFin_enclosed 6 CB5_1_2I2R12Value CB5_1_2I2R12Terms CB5_1_2I2R12Terms_sound) (by decide +kernel) +def CB5_1_2I2R12Mass : Ball := ⟨0, 0⟩ +lemma CB5_1_2I2R12Mass_sound : CB5_1_2I2R12Mass.Encloses (∑ a, CB5_1_2I2R12Value a) := by + exact contains_sound (finSumBall_sound 6 CB5_1_2I2R12P CB5_1_2I2R12Value CB5_1_2I2R12P_sound) (by decide +kernel) +def CB5_1_2I2R12MassTerm : Ball := .exact 0 +lemma CB5_1_2I2R12MassTerm_sound : CB5_1_2I2R12MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB5_1_2I2R12Value a))) := + entropyTerm_zero_ball (CB5_1_2I2R12Mass_sound) +def CB5_1_2I2R12H : Ball := ⟨0, 0⟩ +lemma CB5_1_2I2R12H_sound : CB5_1_2I2R12H.Encloses (homogeneousEntropy CB5_1_2I2R12Value) := by + exact contains_sound (homogeneous_enclosed CB5_1_2I2R12Value CB5_1_2I2R12MassTerm_sound CB5_1_2I2R12Entropy_sound) (by decide +kernel) +def CB5_1_2I2R13Value (a : Fin 6) : ℝ := residualLaw (below (shape 5 1 2)) (fun u => (stageBLaw (shape 5 1 2) u : ℝ)) (stageBPriority (shape 5 1 2)) 2 (fun u a => (littleLaw (shape 5 1 2) u ((stageBPriority (shape 5 1 2)) 2) a : ℝ)) 13 a +def CB5_1_2I2R13Raw (a : Fin 6) : Ball := residualBall (below (shape 5 1 2)) B5_1_2Law (stageBPriority (shape 5 1 2)) 2 (fun u => B5_1_2Little u ((stageBPriority (shape 5 1 2)) 2)) 13 a +lemma CB5_1_2I2R13Raw_sound (a : Fin 6) : + (CB5_1_2I2R13Raw a).Encloses (CB5_1_2I2R13Value a) := by + exact residualBall_sound_on (below (shape 5 1 2)) B5_1_2Law (fun u => (stageBLaw (shape 5 1 2) u : ℝ)) (stageBPriority (shape 5 1 2)) 2 (fun u => B5_1_2Little u ((stageBPriority (shape 5 1 2)) 2)) (fun u a => (littleLaw (shape 5 1 2) u ((stageBPriority (shape 5 1 2)) 2) a : ℝ)) (fun u _ => B5_1_2Law_sound u) (fun u _ a => B5_1_2Little_sound u ((stageBPriority (shape 5 1 2)) 2) a) 13 a +def CB5_1_2I2R13Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB5_1_2I2R13Certificates_valid : + CB5_1_2I2R13Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB5_1_2I2R13CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB5_1_2I2R13P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB5_1_2I2R13Certificates (CB5_1_2I2R13CertificateIndex a)).input +lemma CB5_1_2I2R13P_check : ∀ a : Fin 6, contains (CB5_1_2I2R13Raw a) (CB5_1_2I2R13P a) = true := by + decide +kernel +lemma CB5_1_2I2R13P_sound (a : Fin 6) : + (CB5_1_2I2R13P a).Encloses (CB5_1_2I2R13Value a) := + contains_sound (CB5_1_2I2R13Raw_sound a) (CB5_1_2I2R13P_check a) +def CB5_1_2I2R13Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB5_1_2I2R13Certificates (CB5_1_2I2R13CertificateIndex a)).output +lemma CB5_1_2I2R13Terms_sound (a : Fin 6) : + (CB5_1_2I2R13Terms a).Encloses (Foundation.entropyTerm (CB5_1_2I2R13Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB5_1_2I2R13Certificates_valid + (CB5_1_2I2R13CertificateIndex a) (CB5_1_2I2R13P_sound a) +def CB5_1_2I2R13Entropy : Ball := ⟨0, 0⟩ +lemma CB5_1_2I2R13Entropy_sound : CB5_1_2I2R13Entropy.Encloses (Foundation.finiteEntropy CB5_1_2I2R13Value) := by + exact contains_sound (entropyFin_enclosed 6 CB5_1_2I2R13Value CB5_1_2I2R13Terms CB5_1_2I2R13Terms_sound) (by decide +kernel) +def CB5_1_2I2R13Mass : Ball := ⟨0, 0⟩ +lemma CB5_1_2I2R13Mass_sound : CB5_1_2I2R13Mass.Encloses (∑ a, CB5_1_2I2R13Value a) := by + exact contains_sound (finSumBall_sound 6 CB5_1_2I2R13P CB5_1_2I2R13Value CB5_1_2I2R13P_sound) (by decide +kernel) +def CB5_1_2I2R13MassTerm : Ball := .exact 0 +lemma CB5_1_2I2R13MassTerm_sound : CB5_1_2I2R13MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB5_1_2I2R13Value a))) := + entropyTerm_zero_ball (CB5_1_2I2R13Mass_sound) +def CB5_1_2I2R13H : Ball := ⟨0, 0⟩ +lemma CB5_1_2I2R13H_sound : CB5_1_2I2R13H.Encloses (homogeneousEntropy CB5_1_2I2R13Value) := by + exact contains_sound (homogeneous_enclosed CB5_1_2I2R13Value CB5_1_2I2R13MassTerm_sound CB5_1_2I2R13Entropy_sound) (by decide +kernel) +def CB5_1_2I2R14Value (a : Fin 6) : ℝ := residualLaw (below (shape 5 1 2)) (fun u => (stageBLaw (shape 5 1 2) u : ℝ)) (stageBPriority (shape 5 1 2)) 2 (fun u a => (littleLaw (shape 5 1 2) u ((stageBPriority (shape 5 1 2)) 2) a : ℝ)) 14 a +def CB5_1_2I2R14Raw (a : Fin 6) : Ball := residualBall (below (shape 5 1 2)) B5_1_2Law (stageBPriority (shape 5 1 2)) 2 (fun u => B5_1_2Little u ((stageBPriority (shape 5 1 2)) 2)) 14 a +lemma CB5_1_2I2R14Raw_sound (a : Fin 6) : + (CB5_1_2I2R14Raw a).Encloses (CB5_1_2I2R14Value a) := by + exact residualBall_sound_on (below (shape 5 1 2)) B5_1_2Law (fun u => (stageBLaw (shape 5 1 2) u : ℝ)) (stageBPriority (shape 5 1 2)) 2 (fun u => B5_1_2Little u ((stageBPriority (shape 5 1 2)) 2)) (fun u a => (littleLaw (shape 5 1 2) u ((stageBPriority (shape 5 1 2)) 2) a : ℝ)) (fun u _ => B5_1_2Law_sound u) (fun u _ a => B5_1_2Little_sound u ((stageBPriority (shape 5 1 2)) 2) a) 14 a +def CB5_1_2I2R14Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB5_1_2I2R14Certificates_valid : + CB5_1_2I2R14Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB5_1_2I2R14CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB5_1_2I2R14P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB5_1_2I2R14Certificates (CB5_1_2I2R14CertificateIndex a)).input +lemma CB5_1_2I2R14P_check : ∀ a : Fin 6, contains (CB5_1_2I2R14Raw a) (CB5_1_2I2R14P a) = true := by + decide +kernel +lemma CB5_1_2I2R14P_sound (a : Fin 6) : + (CB5_1_2I2R14P a).Encloses (CB5_1_2I2R14Value a) := + contains_sound (CB5_1_2I2R14Raw_sound a) (CB5_1_2I2R14P_check a) +def CB5_1_2I2R14Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB5_1_2I2R14Certificates (CB5_1_2I2R14CertificateIndex a)).output +lemma CB5_1_2I2R14Terms_sound (a : Fin 6) : + (CB5_1_2I2R14Terms a).Encloses (Foundation.entropyTerm (CB5_1_2I2R14Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB5_1_2I2R14Certificates_valid + (CB5_1_2I2R14CertificateIndex a) (CB5_1_2I2R14P_sound a) +def CB5_1_2I2R14Entropy : Ball := ⟨0, 0⟩ +lemma CB5_1_2I2R14Entropy_sound : CB5_1_2I2R14Entropy.Encloses (Foundation.finiteEntropy CB5_1_2I2R14Value) := by + exact contains_sound (entropyFin_enclosed 6 CB5_1_2I2R14Value CB5_1_2I2R14Terms CB5_1_2I2R14Terms_sound) (by decide +kernel) +def CB5_1_2I2R14Mass : Ball := ⟨0, 0⟩ +lemma CB5_1_2I2R14Mass_sound : CB5_1_2I2R14Mass.Encloses (∑ a, CB5_1_2I2R14Value a) := by + exact contains_sound (finSumBall_sound 6 CB5_1_2I2R14P CB5_1_2I2R14Value CB5_1_2I2R14P_sound) (by decide +kernel) +def CB5_1_2I2R14MassTerm : Ball := .exact 0 +lemma CB5_1_2I2R14MassTerm_sound : CB5_1_2I2R14MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB5_1_2I2R14Value a))) := + entropyTerm_zero_ball (CB5_1_2I2R14Mass_sound) +def CB5_1_2I2R14H : Ball := ⟨0, 0⟩ +lemma CB5_1_2I2R14H_sound : CB5_1_2I2R14H.Encloses (homogeneousEntropy CB5_1_2I2R14Value) := by + exact contains_sound (homogeneous_enclosed CB5_1_2I2R14Value CB5_1_2I2R14MassTerm_sound CB5_1_2I2R14Entropy_sound) (by decide +kernel) +def CB5_1_2I2R15Value (a : Fin 6) : ℝ := residualLaw (below (shape 5 1 2)) (fun u => (stageBLaw (shape 5 1 2) u : ℝ)) (stageBPriority (shape 5 1 2)) 2 (fun u a => (littleLaw (shape 5 1 2) u ((stageBPriority (shape 5 1 2)) 2) a : ℝ)) 15 a +def CB5_1_2I2R15Raw (a : Fin 6) : Ball := residualBall (below (shape 5 1 2)) B5_1_2Law (stageBPriority (shape 5 1 2)) 2 (fun u => B5_1_2Little u ((stageBPriority (shape 5 1 2)) 2)) 15 a +lemma CB5_1_2I2R15Raw_sound (a : Fin 6) : + (CB5_1_2I2R15Raw a).Encloses (CB5_1_2I2R15Value a) := by + exact residualBall_sound_on (below (shape 5 1 2)) B5_1_2Law (fun u => (stageBLaw (shape 5 1 2) u : ℝ)) (stageBPriority (shape 5 1 2)) 2 (fun u => B5_1_2Little u ((stageBPriority (shape 5 1 2)) 2)) (fun u a => (littleLaw (shape 5 1 2) u ((stageBPriority (shape 5 1 2)) 2) a : ℝ)) (fun u _ => B5_1_2Law_sound u) (fun u _ a => B5_1_2Little_sound u ((stageBPriority (shape 5 1 2)) 2) a) 15 a +def CB5_1_2I2R15Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB5_1_2I2R15Certificates_valid : + CB5_1_2I2R15Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB5_1_2I2R15CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB5_1_2I2R15P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB5_1_2I2R15Certificates (CB5_1_2I2R15CertificateIndex a)).input +lemma CB5_1_2I2R15P_check : ∀ a : Fin 6, contains (CB5_1_2I2R15Raw a) (CB5_1_2I2R15P a) = true := by + decide +kernel +lemma CB5_1_2I2R15P_sound (a : Fin 6) : + (CB5_1_2I2R15P a).Encloses (CB5_1_2I2R15Value a) := + contains_sound (CB5_1_2I2R15Raw_sound a) (CB5_1_2I2R15P_check a) +def CB5_1_2I2R15Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB5_1_2I2R15Certificates (CB5_1_2I2R15CertificateIndex a)).output +lemma CB5_1_2I2R15Terms_sound (a : Fin 6) : + (CB5_1_2I2R15Terms a).Encloses (Foundation.entropyTerm (CB5_1_2I2R15Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB5_1_2I2R15Certificates_valid + (CB5_1_2I2R15CertificateIndex a) (CB5_1_2I2R15P_sound a) +def CB5_1_2I2R15Entropy : Ball := ⟨0, 0⟩ +lemma CB5_1_2I2R15Entropy_sound : CB5_1_2I2R15Entropy.Encloses (Foundation.finiteEntropy CB5_1_2I2R15Value) := by + exact contains_sound (entropyFin_enclosed 6 CB5_1_2I2R15Value CB5_1_2I2R15Terms CB5_1_2I2R15Terms_sound) (by decide +kernel) +def CB5_1_2I2R15Mass : Ball := ⟨0, 0⟩ +lemma CB5_1_2I2R15Mass_sound : CB5_1_2I2R15Mass.Encloses (∑ a, CB5_1_2I2R15Value a) := by + exact contains_sound (finSumBall_sound 6 CB5_1_2I2R15P CB5_1_2I2R15Value CB5_1_2I2R15P_sound) (by decide +kernel) +def CB5_1_2I2R15MassTerm : Ball := .exact 0 +lemma CB5_1_2I2R15MassTerm_sound : CB5_1_2I2R15MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB5_1_2I2R15Value a))) := + entropyTerm_zero_ball (CB5_1_2I2R15Mass_sound) +def CB5_1_2I2R15H : Ball := ⟨0, 0⟩ +lemma CB5_1_2I2R15H_sound : CB5_1_2I2R15H.Encloses (homogeneousEntropy CB5_1_2I2R15Value) := by + exact contains_sound (homogeneous_enclosed CB5_1_2I2R15Value CB5_1_2I2R15MassTerm_sound CB5_1_2I2R15Entropy_sound) (by decide +kernel) +def CB5_1_2I2R16Value (a : Fin 6) : ℝ := residualLaw (below (shape 5 1 2)) (fun u => (stageBLaw (shape 5 1 2) u : ℝ)) (stageBPriority (shape 5 1 2)) 2 (fun u a => (littleLaw (shape 5 1 2) u ((stageBPriority (shape 5 1 2)) 2) a : ℝ)) 16 a +def CB5_1_2I2R16Raw (a : Fin 6) : Ball := residualBall (below (shape 5 1 2)) B5_1_2Law (stageBPriority (shape 5 1 2)) 2 (fun u => B5_1_2Little u ((stageBPriority (shape 5 1 2)) 2)) 16 a +lemma CB5_1_2I2R16Raw_sound (a : Fin 6) : + (CB5_1_2I2R16Raw a).Encloses (CB5_1_2I2R16Value a) := by + exact residualBall_sound_on (below (shape 5 1 2)) B5_1_2Law (fun u => (stageBLaw (shape 5 1 2) u : ℝ)) (stageBPriority (shape 5 1 2)) 2 (fun u => B5_1_2Little u ((stageBPriority (shape 5 1 2)) 2)) (fun u a => (littleLaw (shape 5 1 2) u ((stageBPriority (shape 5 1 2)) 2) a : ℝ)) (fun u _ => B5_1_2Law_sound u) (fun u _ a => B5_1_2Little_sound u ((stageBPriority (shape 5 1 2)) 2) a) 16 a +def CB5_1_2I2R16Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB5_1_2I2R16Certificates_valid : + CB5_1_2I2R16Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB5_1_2I2R16CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB5_1_2I2R16P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB5_1_2I2R16Certificates (CB5_1_2I2R16CertificateIndex a)).input +lemma CB5_1_2I2R16P_check : ∀ a : Fin 6, contains (CB5_1_2I2R16Raw a) (CB5_1_2I2R16P a) = true := by + decide +kernel +lemma CB5_1_2I2R16P_sound (a : Fin 6) : + (CB5_1_2I2R16P a).Encloses (CB5_1_2I2R16Value a) := + contains_sound (CB5_1_2I2R16Raw_sound a) (CB5_1_2I2R16P_check a) +def CB5_1_2I2R16Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB5_1_2I2R16Certificates (CB5_1_2I2R16CertificateIndex a)).output +lemma CB5_1_2I2R16Terms_sound (a : Fin 6) : + (CB5_1_2I2R16Terms a).Encloses (Foundation.entropyTerm (CB5_1_2I2R16Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB5_1_2I2R16Certificates_valid + (CB5_1_2I2R16CertificateIndex a) (CB5_1_2I2R16P_sound a) +def CB5_1_2I2R16Entropy : Ball := ⟨0, 0⟩ +lemma CB5_1_2I2R16Entropy_sound : CB5_1_2I2R16Entropy.Encloses (Foundation.finiteEntropy CB5_1_2I2R16Value) := by + exact contains_sound (entropyFin_enclosed 6 CB5_1_2I2R16Value CB5_1_2I2R16Terms CB5_1_2I2R16Terms_sound) (by decide +kernel) +def CB5_1_2I2R16Mass : Ball := ⟨0, 0⟩ +lemma CB5_1_2I2R16Mass_sound : CB5_1_2I2R16Mass.Encloses (∑ a, CB5_1_2I2R16Value a) := by + exact contains_sound (finSumBall_sound 6 CB5_1_2I2R16P CB5_1_2I2R16Value CB5_1_2I2R16P_sound) (by decide +kernel) +def CB5_1_2I2R16MassTerm : Ball := .exact 0 +lemma CB5_1_2I2R16MassTerm_sound : CB5_1_2I2R16MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB5_1_2I2R16Value a))) := + entropyTerm_zero_ball (CB5_1_2I2R16Mass_sound) +def CB5_1_2I2R16H : Ball := ⟨0, 0⟩ +lemma CB5_1_2I2R16H_sound : CB5_1_2I2R16H.Encloses (homogeneousEntropy CB5_1_2I2R16Value) := by + exact contains_sound (homogeneous_enclosed CB5_1_2I2R16Value CB5_1_2I2R16MassTerm_sound CB5_1_2I2R16Entropy_sound) (by decide +kernel) +def CB5_1_2I2ResidualEntropies (a : Fin 17) : Ball := + match a.val with + | 0 => CB5_1_2I2R0H + | 1 => CB5_1_2I2R1H + | 2 => CB5_1_2I2R2H + | 3 => CB5_1_2I2R3H + | 4 => CB5_1_2I2R4H + | 5 => CB5_1_2I2R5H + | 6 => CB5_1_2I2R6H + | 7 => CB5_1_2I2R7H + | 8 => CB5_1_2I2R8H + | 9 => CB5_1_2I2R9H + | 10 => CB5_1_2I2R10H + | 11 => CB5_1_2I2R11H + | 12 => CB5_1_2I2R12H + | 13 => CB5_1_2I2R13H + | 14 => CB5_1_2I2R14H + | 15 => CB5_1_2I2R15H + | 16 => CB5_1_2I2R16H + | _ => (.exact 0) +lemma CB5_1_2I2ResidualEntropies_sound (k : Fin 17) : + (CB5_1_2I2ResidualEntropies k).Encloses (homogeneousEntropy + (residualLaw (below (shape 5 1 2)) (fun u => (stageBLaw (shape 5 1 2) u : ℝ)) (stageBPriority (shape 5 1 2)) 2 (fun u a => (littleLaw (shape 5 1 2) u ((stageBPriority (shape 5 1 2)) 2) a : ℝ)) k)) := by + fin_cases k + · exact CB5_1_2I2R0H_sound + · exact CB5_1_2I2R1H_sound + · exact CB5_1_2I2R2H_sound + · exact CB5_1_2I2R3H_sound + · exact CB5_1_2I2R4H_sound + · exact CB5_1_2I2R5H_sound + · exact CB5_1_2I2R6H_sound + · exact CB5_1_2I2R7H_sound + · exact CB5_1_2I2R8H_sound + · exact CB5_1_2I2R9H_sound + · exact CB5_1_2I2R10H_sound + · exact CB5_1_2I2R11H_sound + · exact CB5_1_2I2R12H_sound + · exact CB5_1_2I2R13H_sound + · exact CB5_1_2I2R14H_sound + · exact CB5_1_2I2R15H_sound + · exact CB5_1_2I2R16H_sound +def CB5_1_2I2S2_0_2Value (a : Fin 6) : ℝ := (littleLaw (shape 5 1 2) (shape 2 0 2) ((stageBPriority (shape 5 1 2)) 2) a : ℝ) +def CB5_1_2I2S2_0_2E_2LogWitness : LogWitness := ⟨-1, 55633, 31250⟩ +def CB5_1_2I2S2_0_2E_2Log : Ball := ⟨(-2327800127447388996729312677817 / 20000000000000000000000000000000), (21175823683 / 50000000000000000000000000000000)⟩ +lemma CB5_1_2I2S2_0_2E_2Log_sound : CB5_1_2I2S2_0_2E_2Log.Encloses (Real.log (CB5_1_2I2S2_0_2Value (2 : Fin 6))) := by + exact checkLog_sound logTwoBall_sound ((B5_1_2Little_sound (shape 2 0 2) ((stageBPriority (shape 5 1 2)) 2)) (2 : Fin 6)) (w := CB5_1_2I2S2_0_2E_2LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB5_1_2I2S2_0_2E_2 : Ball := ⟨(10360200359222447364403348176399 / 100000000000000000000000000000000), (1178074599 / 3125000000000000000000000000000)⟩ +lemma CB5_1_2I2S2_0_2E_2_sound : CB5_1_2I2S2_0_2E_2.Encloses (Foundation.entropyTerm (CB5_1_2I2S2_0_2Value (2 : Fin 6))) := by + exact contains_sound (entropyTerm_ball ((B5_1_2Little_sound (shape 2 0 2) ((stageBPriority (shape 5 1 2)) 2)) (2 : Fin 6)) CB5_1_2I2S2_0_2E_2Log_sound) (by decide +kernel) +def CB5_1_2I2S2_0_2E_3LogWitness : LogWitness := ⟨-4, 27468, 15625⟩ +def CB5_1_2I2S2_0_2E_3Log : Ball := ⟨(-22084392271038164781658598089709 / 10000000000000000000000000000000), (21175823683 / 20000000000000000000000000000000)⟩ +lemma CB5_1_2I2S2_0_2E_3Log_sound : CB5_1_2I2S2_0_2E_3Log.Encloses (Real.log (CB5_1_2I2S2_0_2Value (3 : Fin 6))) := by + exact checkLog_sound logTwoBall_sound ((B5_1_2Little_sound (shape 2 0 2) ((stageBPriority (shape 5 1 2)) 2)) (3 : Fin 6)) (w := CB5_1_2I2S2_0_2E_3LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB5_1_2I2S2_0_2E_3 : Ball := ⟨(38823301561656083854246295829 / 160000000000000000000000000000), (11633150499 / 100000000000000000000000000000000)⟩ +lemma CB5_1_2I2S2_0_2E_3_sound : CB5_1_2I2S2_0_2E_3.Encloses (Foundation.entropyTerm (CB5_1_2I2S2_0_2Value (3 : Fin 6))) := by + exact contains_sound (entropyTerm_ball ((B5_1_2Little_sound (shape 2 0 2) ((stageBPriority (shape 5 1 2)) 2)) (3 : Fin 6)) CB5_1_2I2S2_0_2E_3Log_sound) (by decide +kernel) +def CB5_1_2I2S2_0_2Terms (a : Fin 6) : Ball := + match a.val with + | 2 => ⟨(10360200359222447364403348176399 / 100000000000000000000000000000000), (1178074599 / 3125000000000000000000000000000)⟩ + | 3 => ⟨(38823301561656083854246295829 / 160000000000000000000000000000), (11633150499 / 100000000000000000000000000000000)⟩ + | _ => (.exact 0) +lemma CB5_1_2I2S2_0_2Terms_sound (a : Fin 6) : + (CB5_1_2I2S2_0_2Terms a).Encloses (Foundation.entropyTerm (CB5_1_2I2S2_0_2Value a)) := by + fin_cases a + · exact (entropyTerm_zero_ball ((B5_1_2Little_sound (shape 2 0 2) ((stageBPriority (shape 5 1 2)) 2)) (0 : Fin 6))) + · exact (entropyTerm_zero_ball ((B5_1_2Little_sound (shape 2 0 2) ((stageBPriority (shape 5 1 2)) 2)) (1 : Fin 6))) + · exact CB5_1_2I2S2_0_2E_2_sound + · exact CB5_1_2I2S2_0_2E_3_sound + · exact (entropyTerm_zero_ball ((B5_1_2Little_sound (shape 2 0 2) ((stageBPriority (shape 5 1 2)) 2)) (4 : Fin 6))) + · exact (entropyTerm_zero_ball ((B5_1_2Little_sound (shape 2 0 2) ((stageBPriority (shape 5 1 2)) 2)) (5 : Fin 6))) +def CB5_1_2I2S2_0_2Entropy : Ball := ⟨(8656190958814374943326820767381 / 25000000000000000000000000000000), (49331537667 / 100000000000000000000000000000000)⟩ +lemma CB5_1_2I2S2_0_2Entropy_sound : CB5_1_2I2S2_0_2Entropy.Encloses (Foundation.finiteEntropy CB5_1_2I2S2_0_2Value) := by + exact contains_sound (entropyFin_enclosed 6 CB5_1_2I2S2_0_2Value CB5_1_2I2S2_0_2Terms CB5_1_2I2S2_0_2Terms_sound) (by decide +kernel) +def CB5_1_2I2S2_0_2Mass : Ball := ⟨1, 0⟩ +lemma CB5_1_2I2S2_0_2Mass_sound : CB5_1_2I2S2_0_2Mass.Encloses (∑ a, CB5_1_2I2S2_0_2Value a) := by + exact contains_sound (finSumBall_sound 6 (B5_1_2Little (shape 2 0 2) ((stageBPriority (shape 5 1 2)) 2)) CB5_1_2I2S2_0_2Value (B5_1_2Little_sound (shape 2 0 2) ((stageBPriority (shape 5 1 2)) 2))) (by decide +kernel) +def CB5_1_2I2S2_0_2MassTermLog : Ball := .exact 0 +lemma CB5_1_2I2S2_0_2MassTermLog_sound : CB5_1_2I2S2_0_2MassTermLog.Encloses (Real.log ((∑ a, CB5_1_2I2S2_0_2Value a))) := by + exact log_exact_one_ball (CB5_1_2I2S2_0_2Mass_sound) +def CB5_1_2I2S2_0_2MassTerm : Ball := ⟨0, 0⟩ +lemma CB5_1_2I2S2_0_2MassTerm_sound : CB5_1_2I2S2_0_2MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB5_1_2I2S2_0_2Value a))) := by + exact contains_sound (entropyTerm_ball (CB5_1_2I2S2_0_2Mass_sound) CB5_1_2I2S2_0_2MassTermLog_sound) (by decide +kernel) +def CB5_1_2I2S2_0_2H : Ball := ⟨(8656190958814374943326820767381 / 25000000000000000000000000000000), (49331537667 / 100000000000000000000000000000000)⟩ +lemma CB5_1_2I2S2_0_2H_sound : CB5_1_2I2S2_0_2H.Encloses (homogeneousEntropy CB5_1_2I2S2_0_2Value) := by + exact contains_sound (homogeneous_enclosed CB5_1_2I2S2_0_2Value CB5_1_2I2S2_0_2MassTerm_sound CB5_1_2I2S2_0_2Entropy_sound) (by decide +kernel) +def CB5_1_2I2S3_0_1Value (a : Fin 6) : ℝ := (littleLaw (shape 5 1 2) (shape 3 0 1) ((stageBPriority (shape 5 1 2)) 2) a : ℝ) +def CB5_1_2I2S3_0_1E_4Log : Ball := .exact 0 +lemma CB5_1_2I2S3_0_1E_4Log_sound : CB5_1_2I2S3_0_1E_4Log.Encloses (Real.log (CB5_1_2I2S3_0_1Value (4 : Fin 6))) := by + exact log_exact_one_ball ((B5_1_2Little_sound (shape 3 0 1) ((stageBPriority (shape 5 1 2)) 2)) (4 : Fin 6)) +def CB5_1_2I2S3_0_1E_4 : Ball := ⟨0, 0⟩ +lemma CB5_1_2I2S3_0_1E_4_sound : CB5_1_2I2S3_0_1E_4.Encloses (Foundation.entropyTerm (CB5_1_2I2S3_0_1Value (4 : Fin 6))) := by + exact contains_sound (entropyTerm_ball ((B5_1_2Little_sound (shape 3 0 1) ((stageBPriority (shape 5 1 2)) 2)) (4 : Fin 6)) CB5_1_2I2S3_0_1E_4Log_sound) (by decide +kernel) +def CB5_1_2I2S3_0_1Terms (a : Fin 6) : Ball := + match a.val with + | 4 => ⟨0, 0⟩ + | _ => (.exact 0) +lemma CB5_1_2I2S3_0_1Terms_sound (a : Fin 6) : + (CB5_1_2I2S3_0_1Terms a).Encloses (Foundation.entropyTerm (CB5_1_2I2S3_0_1Value a)) := by + fin_cases a + · exact (entropyTerm_zero_ball ((B5_1_2Little_sound (shape 3 0 1) ((stageBPriority (shape 5 1 2)) 2)) (0 : Fin 6))) + · exact (entropyTerm_zero_ball ((B5_1_2Little_sound (shape 3 0 1) ((stageBPriority (shape 5 1 2)) 2)) (1 : Fin 6))) + · exact (entropyTerm_zero_ball ((B5_1_2Little_sound (shape 3 0 1) ((stageBPriority (shape 5 1 2)) 2)) (2 : Fin 6))) + · exact (entropyTerm_zero_ball ((B5_1_2Little_sound (shape 3 0 1) ((stageBPriority (shape 5 1 2)) 2)) (3 : Fin 6))) + · exact CB5_1_2I2S3_0_1E_4_sound + · exact (entropyTerm_zero_ball ((B5_1_2Little_sound (shape 3 0 1) ((stageBPriority (shape 5 1 2)) 2)) (5 : Fin 6))) +def CB5_1_2I2S3_0_1Entropy : Ball := ⟨0, 0⟩ +lemma CB5_1_2I2S3_0_1Entropy_sound : CB5_1_2I2S3_0_1Entropy.Encloses (Foundation.finiteEntropy CB5_1_2I2S3_0_1Value) := by + exact contains_sound (entropyFin_enclosed 6 CB5_1_2I2S3_0_1Value CB5_1_2I2S3_0_1Terms CB5_1_2I2S3_0_1Terms_sound) (by decide +kernel) +def CB5_1_2I2S3_0_1Mass : Ball := ⟨1, 0⟩ +lemma CB5_1_2I2S3_0_1Mass_sound : CB5_1_2I2S3_0_1Mass.Encloses (∑ a, CB5_1_2I2S3_0_1Value a) := by + exact contains_sound (finSumBall_sound 6 (B5_1_2Little (shape 3 0 1) ((stageBPriority (shape 5 1 2)) 2)) CB5_1_2I2S3_0_1Value (B5_1_2Little_sound (shape 3 0 1) ((stageBPriority (shape 5 1 2)) 2))) (by decide +kernel) +def CB5_1_2I2S3_0_1MassTermLog : Ball := .exact 0 +lemma CB5_1_2I2S3_0_1MassTermLog_sound : CB5_1_2I2S3_0_1MassTermLog.Encloses (Real.log ((∑ a, CB5_1_2I2S3_0_1Value a))) := by + exact log_exact_one_ball (CB5_1_2I2S3_0_1Mass_sound) +def CB5_1_2I2S3_0_1MassTerm : Ball := ⟨0, 0⟩ +lemma CB5_1_2I2S3_0_1MassTerm_sound : CB5_1_2I2S3_0_1MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB5_1_2I2S3_0_1Value a))) := by + exact contains_sound (entropyTerm_ball (CB5_1_2I2S3_0_1Mass_sound) CB5_1_2I2S3_0_1MassTermLog_sound) (by decide +kernel) +def CB5_1_2I2S3_0_1H : Ball := ⟨0, 0⟩ +lemma CB5_1_2I2S3_0_1H_sound : CB5_1_2I2S3_0_1H.Encloses (homogeneousEntropy CB5_1_2I2S3_0_1Value) := by + exact contains_sound (homogeneous_enclosed CB5_1_2I2S3_0_1Value CB5_1_2I2S3_0_1MassTerm_sound CB5_1_2I2S3_0_1Entropy_sound) (by decide +kernel) +def CB5_1_2I2S3_1_0Value (a : Fin 6) : ℝ := (littleLaw (shape 5 1 2) (shape 3 1 0) ((stageBPriority (shape 5 1 2)) 2) a : ℝ) +def CB5_1_2I2S3_1_0E_4Log : Ball := .exact 0 +lemma CB5_1_2I2S3_1_0E_4Log_sound : CB5_1_2I2S3_1_0E_4Log.Encloses (Real.log (CB5_1_2I2S3_1_0Value (4 : Fin 6))) := by + exact log_exact_one_ball ((B5_1_2Little_sound (shape 3 1 0) ((stageBPriority (shape 5 1 2)) 2)) (4 : Fin 6)) +def CB5_1_2I2S3_1_0E_4 : Ball := ⟨0, 0⟩ +lemma CB5_1_2I2S3_1_0E_4_sound : CB5_1_2I2S3_1_0E_4.Encloses (Foundation.entropyTerm (CB5_1_2I2S3_1_0Value (4 : Fin 6))) := by + exact contains_sound (entropyTerm_ball ((B5_1_2Little_sound (shape 3 1 0) ((stageBPriority (shape 5 1 2)) 2)) (4 : Fin 6)) CB5_1_2I2S3_1_0E_4Log_sound) (by decide +kernel) +def CB5_1_2I2S3_1_0Terms (a : Fin 6) : Ball := + match a.val with + | 4 => ⟨0, 0⟩ + | _ => (.exact 0) +lemma CB5_1_2I2S3_1_0Terms_sound (a : Fin 6) : + (CB5_1_2I2S3_1_0Terms a).Encloses (Foundation.entropyTerm (CB5_1_2I2S3_1_0Value a)) := by + fin_cases a + · exact (entropyTerm_zero_ball ((B5_1_2Little_sound (shape 3 1 0) ((stageBPriority (shape 5 1 2)) 2)) (0 : Fin 6))) + · exact (entropyTerm_zero_ball ((B5_1_2Little_sound (shape 3 1 0) ((stageBPriority (shape 5 1 2)) 2)) (1 : Fin 6))) + · exact (entropyTerm_zero_ball ((B5_1_2Little_sound (shape 3 1 0) ((stageBPriority (shape 5 1 2)) 2)) (2 : Fin 6))) + · exact (entropyTerm_zero_ball ((B5_1_2Little_sound (shape 3 1 0) ((stageBPriority (shape 5 1 2)) 2)) (3 : Fin 6))) + · exact CB5_1_2I2S3_1_0E_4_sound + · exact (entropyTerm_zero_ball ((B5_1_2Little_sound (shape 3 1 0) ((stageBPriority (shape 5 1 2)) 2)) (5 : Fin 6))) +def CB5_1_2I2S3_1_0Entropy : Ball := ⟨0, 0⟩ +lemma CB5_1_2I2S3_1_0Entropy_sound : CB5_1_2I2S3_1_0Entropy.Encloses (Foundation.finiteEntropy CB5_1_2I2S3_1_0Value) := by + exact contains_sound (entropyFin_enclosed 6 CB5_1_2I2S3_1_0Value CB5_1_2I2S3_1_0Terms CB5_1_2I2S3_1_0Terms_sound) (by decide +kernel) +def CB5_1_2I2S3_1_0Mass : Ball := ⟨1, 0⟩ +lemma CB5_1_2I2S3_1_0Mass_sound : CB5_1_2I2S3_1_0Mass.Encloses (∑ a, CB5_1_2I2S3_1_0Value a) := by + exact contains_sound (finSumBall_sound 6 (B5_1_2Little (shape 3 1 0) ((stageBPriority (shape 5 1 2)) 2)) CB5_1_2I2S3_1_0Value (B5_1_2Little_sound (shape 3 1 0) ((stageBPriority (shape 5 1 2)) 2))) (by decide +kernel) +def CB5_1_2I2S3_1_0MassTermLog : Ball := .exact 0 +lemma CB5_1_2I2S3_1_0MassTermLog_sound : CB5_1_2I2S3_1_0MassTermLog.Encloses (Real.log ((∑ a, CB5_1_2I2S3_1_0Value a))) := by + exact log_exact_one_ball (CB5_1_2I2S3_1_0Mass_sound) +def CB5_1_2I2S3_1_0MassTerm : Ball := ⟨0, 0⟩ +lemma CB5_1_2I2S3_1_0MassTerm_sound : CB5_1_2I2S3_1_0MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB5_1_2I2S3_1_0Value a))) := by + exact contains_sound (entropyTerm_ball (CB5_1_2I2S3_1_0Mass_sound) CB5_1_2I2S3_1_0MassTermLog_sound) (by decide +kernel) +def CB5_1_2I2S3_1_0H : Ball := ⟨0, 0⟩ +lemma CB5_1_2I2S3_1_0H_sound : CB5_1_2I2S3_1_0H.Encloses (homogeneousEntropy CB5_1_2I2S3_1_0Value) := by + exact contains_sound (homogeneous_enclosed CB5_1_2I2S3_1_0Value CB5_1_2I2S3_1_0MassTerm_sound CB5_1_2I2S3_1_0Entropy_sound) (by decide +kernel) +def CB5_1_2I2S4_0_0Value (a : Fin 6) : ℝ := (littleLaw (shape 5 1 2) (shape 4 0 0) ((stageBPriority (shape 5 1 2)) 2) a : ℝ) +def CB5_1_2I2S4_0_0E_5Log : Ball := .exact 0 +lemma CB5_1_2I2S4_0_0E_5Log_sound : CB5_1_2I2S4_0_0E_5Log.Encloses (Real.log (CB5_1_2I2S4_0_0Value (5 : Fin 6))) := by + exact log_exact_one_ball ((B5_1_2Little_sound (shape 4 0 0) ((stageBPriority (shape 5 1 2)) 2)) (5 : Fin 6)) +def CB5_1_2I2S4_0_0E_5 : Ball := ⟨0, 0⟩ +lemma CB5_1_2I2S4_0_0E_5_sound : CB5_1_2I2S4_0_0E_5.Encloses (Foundation.entropyTerm (CB5_1_2I2S4_0_0Value (5 : Fin 6))) := by + exact contains_sound (entropyTerm_ball ((B5_1_2Little_sound (shape 4 0 0) ((stageBPriority (shape 5 1 2)) 2)) (5 : Fin 6)) CB5_1_2I2S4_0_0E_5Log_sound) (by decide +kernel) +def CB5_1_2I2S4_0_0Terms (a : Fin 6) : Ball := + match a.val with + | 5 => ⟨0, 0⟩ + | _ => (.exact 0) +lemma CB5_1_2I2S4_0_0Terms_sound (a : Fin 6) : + (CB5_1_2I2S4_0_0Terms a).Encloses (Foundation.entropyTerm (CB5_1_2I2S4_0_0Value a)) := by + fin_cases a + · exact (entropyTerm_zero_ball ((B5_1_2Little_sound (shape 4 0 0) ((stageBPriority (shape 5 1 2)) 2)) (0 : Fin 6))) + · exact (entropyTerm_zero_ball ((B5_1_2Little_sound (shape 4 0 0) ((stageBPriority (shape 5 1 2)) 2)) (1 : Fin 6))) + · exact (entropyTerm_zero_ball ((B5_1_2Little_sound (shape 4 0 0) ((stageBPriority (shape 5 1 2)) 2)) (2 : Fin 6))) + · exact (entropyTerm_zero_ball ((B5_1_2Little_sound (shape 4 0 0) ((stageBPriority (shape 5 1 2)) 2)) (3 : Fin 6))) + · exact (entropyTerm_zero_ball ((B5_1_2Little_sound (shape 4 0 0) ((stageBPriority (shape 5 1 2)) 2)) (4 : Fin 6))) + · exact CB5_1_2I2S4_0_0E_5_sound +def CB5_1_2I2S4_0_0Entropy : Ball := ⟨0, 0⟩ +lemma CB5_1_2I2S4_0_0Entropy_sound : CB5_1_2I2S4_0_0Entropy.Encloses (Foundation.finiteEntropy CB5_1_2I2S4_0_0Value) := by + exact contains_sound (entropyFin_enclosed 6 CB5_1_2I2S4_0_0Value CB5_1_2I2S4_0_0Terms CB5_1_2I2S4_0_0Terms_sound) (by decide +kernel) +def CB5_1_2I2S4_0_0Mass : Ball := ⟨1, 0⟩ +lemma CB5_1_2I2S4_0_0Mass_sound : CB5_1_2I2S4_0_0Mass.Encloses (∑ a, CB5_1_2I2S4_0_0Value a) := by + exact contains_sound (finSumBall_sound 6 (B5_1_2Little (shape 4 0 0) ((stageBPriority (shape 5 1 2)) 2)) CB5_1_2I2S4_0_0Value (B5_1_2Little_sound (shape 4 0 0) ((stageBPriority (shape 5 1 2)) 2))) (by decide +kernel) +def CB5_1_2I2S4_0_0MassTermLog : Ball := .exact 0 +lemma CB5_1_2I2S4_0_0MassTermLog_sound : CB5_1_2I2S4_0_0MassTermLog.Encloses (Real.log ((∑ a, CB5_1_2I2S4_0_0Value a))) := by + exact log_exact_one_ball (CB5_1_2I2S4_0_0Mass_sound) +def CB5_1_2I2S4_0_0MassTerm : Ball := ⟨0, 0⟩ +lemma CB5_1_2I2S4_0_0MassTerm_sound : CB5_1_2I2S4_0_0MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB5_1_2I2S4_0_0Value a))) := by + exact contains_sound (entropyTerm_ball (CB5_1_2I2S4_0_0Mass_sound) CB5_1_2I2S4_0_0MassTermLog_sound) (by decide +kernel) +def CB5_1_2I2S4_0_0H : Ball := ⟨0, 0⟩ +lemma CB5_1_2I2S4_0_0H_sound : CB5_1_2I2S4_0_0H.Encloses (homogeneousEntropy CB5_1_2I2S4_0_0Value) := by + exact contains_sound (homogeneous_enclosed CB5_1_2I2S4_0_0Value CB5_1_2I2S4_0_0MassTerm_sound CB5_1_2I2S4_0_0Entropy_sound) (by decide +kernel) +def CB5_1_2I2Singles (s : Shape) : Ball := + match s 0, s 1, s 2 with + | 2, 0, 2 => CB5_1_2I2S2_0_2H + | 3, 0, 1 => CB5_1_2I2S3_0_1H + | 3, 1, 0 => CB5_1_2I2S3_1_0H + | 4, 0, 0 => CB5_1_2I2S4_0_0H + | _, _, _ => (.exact 0) +lemma CB5_1_2I2Singles_sound (u : Shape) (hu : u ∈ below (shape 5 1 2)) + (hd : designated (stageBPriority (shape 5 1 2)) 2 u) : + (CB5_1_2I2Singles u).Encloses (homogeneousEntropy ((fun u a => (littleLaw (shape 5 1 2) u ((stageBPriority (shape 5 1 2)) 2) a : ℝ)) u)) := by + rw [B5_1_2_below] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl | rfl | rfl + · exact (show ¬ designated (stageBPriority (shape 5 1 2)) 2 (shape 1 1 2) by decide +kernel) hd |>.elim + · exact CB5_1_2I2S2_0_2H_sound + · exact (show ¬ designated (stageBPriority (shape 5 1 2)) 2 (shape 2 1 1) by decide +kernel) hd |>.elim + · exact CB5_1_2I2S3_0_1H_sound + · exact CB5_1_2I2S3_1_0H_sound + · exact CB5_1_2I2S4_0_0H_sound +def CB5_1_2I2Singleton : Ball := ⟨(6153781548874662112522807304647 / 100000000000000000000000000000000), (8767583459 / 100000000000000000000000000000000)⟩ +lemma CB5_1_2I2Singleton_sound : CB5_1_2I2Singleton.Encloses + (singletonEntropy (below (shape 5 1 2)) (fun u => (stageBLaw (shape 5 1 2) u : ℝ)) (stageBPriority (shape 5 1 2)) 2 (fun u a => (littleLaw (shape 5 1 2) u ((stageBPriority (shape 5 1 2)) 2) a : ℝ))) := by + exact contains_sound (singletonBall_sound (below (shape 5 1 2)) B5_1_2Law (fun u => (stageBLaw (shape 5 1 2) u : ℝ)) (stageBPriority (shape 5 1 2)) 2 + CB5_1_2I2Singles (fun u a => (littleLaw (shape 5 1 2) u ((stageBPriority (shape 5 1 2)) 2) a : ℝ)) (fun u _ => B5_1_2Law_sound u) CB5_1_2I2Singles_sound) (by decide +kernel) +def CB5_1_2I2Group : Ball := ⟨(6973110826714755466835243222281 / 100000000000000000000000000000000), (12936038911 / 25000000000000000000000000000000)⟩ +lemma CB5_1_2I2Group_sound : CB5_1_2I2Group.Encloses + (groupedEntropy (below (shape 5 1 2)) (fun u => (stageBLaw (shape 5 1 2) u : ℝ)) (stageBPriority (shape 5 1 2)) 2 (fun u a => (littleLaw (shape 5 1 2) u ((stageBPriority (shape 5 1 2)) 2) a : ℝ))) := by + exact contains_sound (Ball.add_sound CB5_1_2I2Singleton_sound + (finSumBall_sound 17 CB5_1_2I2ResidualEntropies _ CB5_1_2I2ResidualEntropies_sound)) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CB5_1_2I2H : Ball := ⟨(40046100348293217821792311763861 / 50000000000000000000000000000000), (193529950993 / 100000000000000000000000000000000)⟩ +lemma CB5_1_2I2_sound : CB5_1_2I2H.Encloses (stageBCapacity (shape 5 1 2) 2) := by + have hb := contains_sound (Ball.add_sound CB5_1_2I2PairH_sound + (Ball.neg_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) CB5_1_2I2Group_sound))) + (show contains (.add CB5_1_2I2PairH (.neg (.mul (.exact 2) CB5_1_2I2Group))) CB5_1_2I2H = true by decide +kernel) + unfold CB5_1_2I2PairValue at hb + simpa only [stageBCapacity, nativeCapacity, + show (2 : Fin 3) ≠ 0 by decide, ite_false, sub_eq_add_neg] using hb + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/CapacityB/CapB5_2_1I0.lean b/lean/OAI/LinearAlgebra/MatrixFields/CapacityB/CapB5_2_1I0.lean new file mode 100644 index 0000000000000000000000000000000000000000..3638cf0694c4cf5a5b1b12ab7768482237876808 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/CapacityB/CapB5_2_1I0.lean @@ -0,0 +1,72 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Certificates.Terminal5_2_1 + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CB5_2_1I0Value (a : Fin 17) : ℝ := marginal (below (shape 5 2 1)) (fun u => (stageBLaw (shape 5 2 1) u : ℝ)) ((stageBPriority (shape 5 2 1)) 0) a +def CB5_2_1I0Raw (a : Fin 17) : Ball := marginalBall (below (shape 5 2 1)) B5_2_1Law ((stageBPriority (shape 5 2 1)) 0) a +lemma CB5_2_1I0Raw_sound (a : Fin 17) : + (CB5_2_1I0Raw a).Encloses (CB5_2_1I0Value a) := by + exact marginalBall_sound (below (shape 5 2 1)) B5_2_1Law (fun u => (stageBLaw (shape 5 2 1) u : ℝ)) (fun u _ => B5_2_1Law_sound u) ((stageBPriority (shape 5 2 1)) 0) a +def CB5_2_1I0Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(1 / 2), (53 / 100000000000000000000000000000000)⟩ ⟨(6931471805599453094172319305033 / 20000000000000000000000000000000), (21175823773 / 100000000000000000000000000000000)⟩ ⟨(-6931471805599453094172319305033 / 10000000000000000000000000000000), (42351647471 / 100000000000000000000000000000000)⟩ ⟨-1, 1, 1⟩] +lemma CB5_2_1I0Certificates_valid : + CB5_2_1I0Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB5_2_1I0CertificateIndex (a : Fin 17) : ℕ := + match a.val with + | 1 => 1 + | 0 => 1 + | _ => 0 +def CB5_2_1I0P (a : Fin 17) : Ball := + (CompactCertificate.entropyLookup CB5_2_1I0Certificates (CB5_2_1I0CertificateIndex a)).input +lemma CB5_2_1I0P_check : ∀ a : Fin 17, contains (CB5_2_1I0Raw a) (CB5_2_1I0P a) = true := by + decide +kernel +lemma CB5_2_1I0P_sound (a : Fin 17) : + (CB5_2_1I0P a).Encloses (CB5_2_1I0Value a) := + contains_sound (CB5_2_1I0Raw_sound a) (CB5_2_1I0P_check a) +def CB5_2_1I0Terms (a : Fin 17) : Ball := + (CompactCertificate.entropyLookup CB5_2_1I0Certificates (CB5_2_1I0CertificateIndex a)).output +lemma CB5_2_1I0Terms_sound (a : Fin 17) : + (CB5_2_1I0Terms a).Encloses (Foundation.entropyTerm (CB5_2_1I0Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB5_2_1I0Certificates_valid + (CB5_2_1I0CertificateIndex a) (CB5_2_1I0P_sound a) +def CB5_2_1I0Entropy : Ball := ⟨(6931471805599453094172319305033 / 10000000000000000000000000000000), (21175823773 / 50000000000000000000000000000000)⟩ +lemma CB5_2_1I0Entropy_sound : CB5_2_1I0Entropy.Encloses (Foundation.finiteEntropy CB5_2_1I0Value) := by + exact contains_sound (entropyFin_enclosed 17 CB5_2_1I0Value CB5_2_1I0Terms CB5_2_1I0Terms_sound) (by decide +kernel) +def CB5_2_1I0Mass : Ball := ⟨1, (53 / 50000000000000000000000000000000)⟩ +lemma CB5_2_1I0Mass_sound : CB5_2_1I0Mass.Encloses (∑ a, CB5_2_1I0Value a) := by + exact contains_sound (finSumBall_sound 17 CB5_2_1I0P CB5_2_1I0Value CB5_2_1I0P_sound) (by decide +kernel) +def CB5_2_1I0MassTermLogWitness : LogWitness := ⟨0, 1, 1⟩ +def CB5_2_1I0MassTermLog : Ball := ⟨0, (5293955947 / 25000000000000000000000000000000)⟩ +lemma CB5_2_1I0MassTermLog_sound : CB5_2_1I0MassTermLog.Encloses (Real.log ((∑ a, CB5_2_1I0Value a))) := by + exact checkLog_sound logTwoBall_sound (CB5_2_1I0Mass_sound) (w := CB5_2_1I0MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB5_2_1I0MassTerm : Ball := ⟨0, (21175823789 / 100000000000000000000000000000000)⟩ +lemma CB5_2_1I0MassTerm_sound : CB5_2_1I0MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB5_2_1I0Value a))) := by + exact contains_sound (entropyTerm_ball (CB5_2_1I0Mass_sound) CB5_2_1I0MassTermLog_sound) (by decide +kernel) +def CB5_2_1I0H : Ball := ⟨(6931471805599453094172319305033 / 10000000000000000000000000000000), (12705494267 / 20000000000000000000000000000000)⟩ +lemma CB5_2_1I0H_sound : CB5_2_1I0H.Encloses (homogeneousEntropy CB5_2_1I0Value) := by + exact contains_sound (homogeneous_enclosed CB5_2_1I0Value CB5_2_1I0MassTerm_sound CB5_2_1I0Entropy_sound) (by decide +kernel) +lemma CB5_2_1I0_sound : CB5_2_1I0H.Encloses (stageBCapacity (shape 5 2 1) 0) := by + exact CB5_2_1I0H_sound + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/CapacityB/CapB5_2_1I1.lean b/lean/OAI/LinearAlgebra/MatrixFields/CapacityB/CapB5_2_1I1.lean new file mode 100644 index 0000000000000000000000000000000000000000..185bf28133dc6fd0355e39bf1632ee94d4c30eed --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/CapacityB/CapB5_2_1I1.lean @@ -0,0 +1,841 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Certificates.Terminal5_2_1 + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CB5_2_1I1PairValue (a : PairSlot) : ℝ := pairLaw (below (shape 5 2 1)) (shape 5 2 1) (fun u => (stageBLaw (shape 5 2 1) u : ℝ)) (fun u a => (littleLaw (shape 5 2 1) u ((stageBPriority (shape 5 2 1)) 1) a : ℝ)) a +def CB5_2_1I1PairRaw (a : PairSlot) : Ball := pairLawBall (below (shape 5 2 1)) (shape 5 2 1) B5_2_1Law (fun u => B5_2_1Little u ((stageBPriority (shape 5 2 1)) 1)) a +lemma CB5_2_1I1PairRaw_sound (a : PairSlot) : + (CB5_2_1I1PairRaw a).Encloses (CB5_2_1I1PairValue a) := by + exact pairLawBall_sound_on (below (shape 5 2 1)) (shape 5 2 1) B5_2_1Law (fun u => (stageBLaw (shape 5 2 1) u : ℝ)) (fun u => B5_2_1Little u ((stageBPriority (shape 5 2 1)) 1)) (fun u a => (littleLaw (shape 5 2 1) u ((stageBPriority (shape 5 2 1)) 1) a : ℝ)) (fun u _ => B5_2_1Law_sound u) (fun u _ a => B5_2_1Little_sound u ((stageBPriority (shape 5 2 1)) 1) a) (fun u _ a => B5_2_1Little_sound (complement (shape 5 2 1) u) ((stageBPriority (shape 5 2 1)) 1) a) a +def CB5_2_1I1PairCertificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(8251288847660790062385380988161 / 50000000000000000000000000000000), (33 / 100000000000000000000000000000000)⟩ ⟨(29731928403890637480496172123267 / 100000000000000000000000000000000), (13978227117 / 100000000000000000000000000000000)⟩ ⟨(-90082679666218234075586429991739 / 50000000000000000000000000000000), (84703294931 / 100000000000000000000000000000000)⟩ ⟨-3, 8251288847660790062385380988161, 6250000000000000000000000000000⟩, + .log ⟨(496830304206321792542832136267 / 25000000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ ⟨(62296678635940329152577077383 / 800000000000000000000000000000), (2945821479 / 100000000000000000000000000000000)⟩ ⟨(-391838257628642468839827015994241 / 100000000000000000000000000000000), (74115382991 / 50000000000000000000000000000000)⟩ ⟨-6, 496830304206321792542832136267, 390625000000000000000000000000⟩, + .log ⟨(3151010108785313270505790947861 / 5000000000000000000000000000000), (17 / 50000000000000000000000000000000)⟩ ⟨(363717033270625690470714504197 / 1250000000000000000000000000000), (5338018769 / 20000000000000000000000000000000)⟩ ⟨(-1442858879826140153114781181427 / 3125000000000000000000000000000), (42351647419 / 100000000000000000000000000000000)⟩ ⟨-1, 3151010108785313270505790947861, 2500000000000000000000000000000⟩] +lemma CB5_2_1I1PairCertificates_valid : + CB5_2_1I1PairCertificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB5_2_1I1PairCertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 2, 0 => 1 + | 3, 0 => 2 + | 1, 1 => 3 + | 0, 2 => 1 + | 0, 3 => 2 + | _, _ => 0 +def CB5_2_1I1PairP (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CB5_2_1I1PairCertificates (CB5_2_1I1PairCertificateIndex a)).input +lemma CB5_2_1I1PairP_check : ∀ a : PairSlot, contains (CB5_2_1I1PairRaw a) (CB5_2_1I1PairP a) = true := by + decide +kernel +lemma CB5_2_1I1PairP_sound (a : PairSlot) : + (CB5_2_1I1PairP a).Encloses (CB5_2_1I1PairValue a) := + contains_sound (CB5_2_1I1PairRaw_sound a) (CB5_2_1I1PairP_check a) +def CB5_2_1I1PairTerms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CB5_2_1I1PairCertificates (CB5_2_1I1PairCertificateIndex a)).output +lemma CB5_2_1I1PairTerms_sound (a : PairSlot) : + (CB5_2_1I1PairTerms a).Encloses (Foundation.entropyTerm (CB5_2_1I1PairValue a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB5_2_1I1PairCertificates_valid + (CB5_2_1I1PairCertificateIndex a) (CB5_2_1I1PairP_sound a) +def CB5_2_1I1PairEntropy : Ball := ⟨(26033847282104103121698443482011 / 25000000000000000000000000000000), (60538191037 / 100000000000000000000000000000000)⟩ +lemma CB5_2_1I1PairEntropy_sound : CB5_2_1I1PairEntropy.Encloses (Foundation.finiteEntropy CB5_2_1I1PairValue) := by + exact contains_sound (entropyPair_enclosed CB5_2_1I1PairValue CB5_2_1I1PairTerms CB5_2_1I1PairTerms_sound) (by decide +kernel) +def CB5_2_1I1PairMass : Ball := ⟨1, (27 / 25000000000000000000000000000000)⟩ +lemma CB5_2_1I1PairMass_sound : CB5_2_1I1PairMass.Encloses (∑ a, CB5_2_1I1PairValue a) := by + exact contains_sound (pairSumBall_sound CB5_2_1I1PairP CB5_2_1I1PairValue CB5_2_1I1PairP_sound) (by decide +kernel) +def CB5_2_1I1PairMassTermLogWitness : LogWitness := ⟨0, 1, 1⟩ +def CB5_2_1I1PairMassTermLog : Ball := ⟨0, (2117582379 / 10000000000000000000000000000000)⟩ +lemma CB5_2_1I1PairMassTermLog_sound : CB5_2_1I1PairMassTermLog.Encloses (Real.log ((∑ a, CB5_2_1I1PairValue a))) := by + exact checkLog_sound logTwoBall_sound (CB5_2_1I1PairMass_sound) (w := CB5_2_1I1PairMassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB5_2_1I1PairMassTerm : Ball := ⟨0, (21175823791 / 100000000000000000000000000000000)⟩ +lemma CB5_2_1I1PairMassTerm_sound : CB5_2_1I1PairMassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB5_2_1I1PairValue a))) := by + exact contains_sound (entropyTerm_ball (CB5_2_1I1PairMass_sound) CB5_2_1I1PairMassTermLog_sound) (by decide +kernel) +def CB5_2_1I1PairH : Ball := ⟨(26033847282104103121698443482011 / 25000000000000000000000000000000), (20428503707 / 25000000000000000000000000000000)⟩ +lemma CB5_2_1I1PairH_sound : CB5_2_1I1PairH.Encloses (homogeneousEntropy CB5_2_1I1PairValue) := by + exact contains_sound (homogeneous_enclosed CB5_2_1I1PairValue CB5_2_1I1PairMassTerm_sound CB5_2_1I1PairEntropy_sound) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CB5_2_1I1R0Value (a : Fin 6) : ℝ := residualLaw (below (shape 5 2 1)) (fun u => (stageBLaw (shape 5 2 1) u : ℝ)) (stageBPriority (shape 5 2 1)) 1 (fun u a => (littleLaw (shape 5 2 1) u ((stageBPriority (shape 5 2 1)) 1) a : ℝ)) 0 a +def CB5_2_1I1R0Raw (a : Fin 6) : Ball := residualBall (below (shape 5 2 1)) B5_2_1Law (stageBPriority (shape 5 2 1)) 1 (fun u => B5_2_1Little u ((stageBPriority (shape 5 2 1)) 1)) 0 a +lemma CB5_2_1I1R0Raw_sound (a : Fin 6) : + (CB5_2_1I1R0Raw a).Encloses (CB5_2_1I1R0Value a) := by + exact residualBall_sound_on (below (shape 5 2 1)) B5_2_1Law (fun u => (stageBLaw (shape 5 2 1) u : ℝ)) (stageBPriority (shape 5 2 1)) 1 (fun u => B5_2_1Little u ((stageBPriority (shape 5 2 1)) 1)) (fun u a => (littleLaw (shape 5 2 1) u ((stageBPriority (shape 5 2 1)) 1) a : ℝ)) (fun u _ => B5_2_1Law_sound u) (fun u _ a => B5_2_1Little_sound u ((stageBPriority (shape 5 2 1)) 1) a) 0 a +def CB5_2_1I1R0Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(1848989891214686729494209052139 / 10000000000000000000000000000000), (9 / 25000000000000000000000000000000)⟩ ⟨(15604971828411725998343746085051 / 50000000000000000000000000000000), (15661553669 / 100000000000000000000000000000000)⟩ ⟨(-4219864019418759598795757864871 / 2500000000000000000000000000000), (42351647463 / 50000000000000000000000000000000)⟩ ⟨-3, 1848989891214686729494209052139, 1250000000000000000000000000000⟩] +lemma CB5_2_1I1R0Certificates_valid : + CB5_2_1I1R0Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB5_2_1I1R0CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | 0 => 1 + | _ => 0 +def CB5_2_1I1R0P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB5_2_1I1R0Certificates (CB5_2_1I1R0CertificateIndex a)).input +lemma CB5_2_1I1R0P_check : ∀ a : Fin 6, contains (CB5_2_1I1R0Raw a) (CB5_2_1I1R0P a) = true := by + decide +kernel +lemma CB5_2_1I1R0P_sound (a : Fin 6) : + (CB5_2_1I1R0P a).Encloses (CB5_2_1I1R0Value a) := + contains_sound (CB5_2_1I1R0Raw_sound a) (CB5_2_1I1R0P_check a) +def CB5_2_1I1R0Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB5_2_1I1R0Certificates (CB5_2_1I1R0CertificateIndex a)).output +lemma CB5_2_1I1R0Terms_sound (a : Fin 6) : + (CB5_2_1I1R0Terms a).Encloses (Foundation.entropyTerm (CB5_2_1I1R0Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB5_2_1I1R0Certificates_valid + (CB5_2_1I1R0CertificateIndex a) (CB5_2_1I1R0P_sound a) +def CB5_2_1I1R0Entropy : Ball := ⟨(15604971828411725998343746085051 / 50000000000000000000000000000000), (15661553669 / 100000000000000000000000000000000)⟩ +lemma CB5_2_1I1R0Entropy_sound : CB5_2_1I1R0Entropy.Encloses (Foundation.finiteEntropy CB5_2_1I1R0Value) := by + exact contains_sound (entropyFin_enclosed 6 CB5_2_1I1R0Value CB5_2_1I1R0Terms CB5_2_1I1R0Terms_sound) (by decide +kernel) +def CB5_2_1I1R0Mass : Ball := ⟨(1848989891214686729494209052139 / 10000000000000000000000000000000), (9 / 25000000000000000000000000000000)⟩ +lemma CB5_2_1I1R0Mass_sound : CB5_2_1I1R0Mass.Encloses (∑ a, CB5_2_1I1R0Value a) := by + exact contains_sound (finSumBall_sound 6 CB5_2_1I1R0P CB5_2_1I1R0Value CB5_2_1I1R0P_sound) (by decide +kernel) +def CB5_2_1I1R0MassTermLogWitness : LogWitness := ⟨-3, 1848989891214686729494209052139, 1250000000000000000000000000000⟩ +def CB5_2_1I1R0MassTermLog : Ball := ⟨(-4219864019418759598795757864871 / 2500000000000000000000000000000), (42351647463 / 50000000000000000000000000000000)⟩ +lemma CB5_2_1I1R0MassTermLog_sound : CB5_2_1I1R0MassTermLog.Encloses (Real.log ((∑ a, CB5_2_1I1R0Value a))) := by + exact checkLog_sound logTwoBall_sound (CB5_2_1I1R0Mass_sound) (w := CB5_2_1I1R0MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB5_2_1I1R0MassTerm : Ball := ⟨(15604971828411725998343746085051 / 50000000000000000000000000000000), (15661553669 / 100000000000000000000000000000000)⟩ +lemma CB5_2_1I1R0MassTerm_sound : CB5_2_1I1R0MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB5_2_1I1R0Value a))) := by + exact contains_sound (entropyTerm_ball (CB5_2_1I1R0Mass_sound) CB5_2_1I1R0MassTermLog_sound) (by decide +kernel) +def CB5_2_1I1R0H : Ball := ⟨0, (15661553669 / 50000000000000000000000000000000)⟩ +lemma CB5_2_1I1R0H_sound : CB5_2_1I1R0H.Encloses (homogeneousEntropy CB5_2_1I1R0Value) := by + exact contains_sound (homogeneous_enclosed CB5_2_1I1R0Value CB5_2_1I1R0MassTerm_sound CB5_2_1I1R0Entropy_sound) (by decide +kernel) +def CB5_2_1I1R1Value (a : Fin 6) : ℝ := residualLaw (below (shape 5 2 1)) (fun u => (stageBLaw (shape 5 2 1) u : ℝ)) (stageBPriority (shape 5 2 1)) 1 (fun u a => (littleLaw (shape 5 2 1) u ((stageBPriority (shape 5 2 1)) 1) a : ℝ)) 1 a +def CB5_2_1I1R1Raw (a : Fin 6) : Ball := residualBall (below (shape 5 2 1)) B5_2_1Law (stageBPriority (shape 5 2 1)) 1 (fun u => B5_2_1Little u ((stageBPriority (shape 5 2 1)) 1)) 1 a +lemma CB5_2_1I1R1Raw_sound (a : Fin 6) : + (CB5_2_1I1R1Raw a).Encloses (CB5_2_1I1R1Value a) := by + exact residualBall_sound_on (below (shape 5 2 1)) B5_2_1Law (fun u => (stageBLaw (shape 5 2 1) u : ℝ)) (stageBPriority (shape 5 2 1)) 1 (fun u => B5_2_1Little u ((stageBPriority (shape 5 2 1)) 1)) (fun u a => (littleLaw (shape 5 2 1) u ((stageBPriority (shape 5 2 1)) 1) a : ℝ)) (fun u _ => B5_2_1Law_sound u) (fun u _ a => B5_2_1Little_sound u ((stageBPriority (shape 5 2 1)) 1) a) 1 a +def CB5_2_1I1R1Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(3151010108785313270505790947861 / 5000000000000000000000000000000), (17 / 50000000000000000000000000000000)⟩ ⟨(363717033270625690470714504197 / 1250000000000000000000000000000), (5338018769 / 20000000000000000000000000000000)⟩ ⟨(-1442858879826140153114781181427 / 3125000000000000000000000000000), (42351647419 / 100000000000000000000000000000000)⟩ ⟨-1, 3151010108785313270505790947861, 2500000000000000000000000000000⟩] +lemma CB5_2_1I1R1Certificates_valid : + CB5_2_1I1R1Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB5_2_1I1R1CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | 1 => 1 + | _ => 0 +def CB5_2_1I1R1P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB5_2_1I1R1Certificates (CB5_2_1I1R1CertificateIndex a)).input +lemma CB5_2_1I1R1P_check : ∀ a : Fin 6, contains (CB5_2_1I1R1Raw a) (CB5_2_1I1R1P a) = true := by + decide +kernel +lemma CB5_2_1I1R1P_sound (a : Fin 6) : + (CB5_2_1I1R1P a).Encloses (CB5_2_1I1R1Value a) := + contains_sound (CB5_2_1I1R1Raw_sound a) (CB5_2_1I1R1P_check a) +def CB5_2_1I1R1Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB5_2_1I1R1Certificates (CB5_2_1I1R1CertificateIndex a)).output +lemma CB5_2_1I1R1Terms_sound (a : Fin 6) : + (CB5_2_1I1R1Terms a).Encloses (Foundation.entropyTerm (CB5_2_1I1R1Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB5_2_1I1R1Certificates_valid + (CB5_2_1I1R1CertificateIndex a) (CB5_2_1I1R1P_sound a) +def CB5_2_1I1R1Entropy : Ball := ⟨(363717033270625690470714504197 / 1250000000000000000000000000000), (5338018769 / 20000000000000000000000000000000)⟩ +lemma CB5_2_1I1R1Entropy_sound : CB5_2_1I1R1Entropy.Encloses (Foundation.finiteEntropy CB5_2_1I1R1Value) := by + exact contains_sound (entropyFin_enclosed 6 CB5_2_1I1R1Value CB5_2_1I1R1Terms CB5_2_1I1R1Terms_sound) (by decide +kernel) +def CB5_2_1I1R1Mass : Ball := ⟨(3151010108785313270505790947861 / 5000000000000000000000000000000), (17 / 50000000000000000000000000000000)⟩ +lemma CB5_2_1I1R1Mass_sound : CB5_2_1I1R1Mass.Encloses (∑ a, CB5_2_1I1R1Value a) := by + exact contains_sound (finSumBall_sound 6 CB5_2_1I1R1P CB5_2_1I1R1Value CB5_2_1I1R1P_sound) (by decide +kernel) +def CB5_2_1I1R1MassTermLogWitness : LogWitness := ⟨-1, 3151010108785313270505790947861, 2500000000000000000000000000000⟩ +def CB5_2_1I1R1MassTermLog : Ball := ⟨(-1442858879826140153114781181427 / 3125000000000000000000000000000), (42351647419 / 100000000000000000000000000000000)⟩ +lemma CB5_2_1I1R1MassTermLog_sound : CB5_2_1I1R1MassTermLog.Encloses (Real.log ((∑ a, CB5_2_1I1R1Value a))) := by + exact checkLog_sound logTwoBall_sound (CB5_2_1I1R1Mass_sound) (w := CB5_2_1I1R1MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB5_2_1I1R1MassTerm : Ball := ⟨(363717033270625690470714504197 / 1250000000000000000000000000000), (5338018769 / 20000000000000000000000000000000)⟩ +lemma CB5_2_1I1R1MassTerm_sound : CB5_2_1I1R1MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB5_2_1I1R1Value a))) := by + exact contains_sound (entropyTerm_ball (CB5_2_1I1R1Mass_sound) CB5_2_1I1R1MassTermLog_sound) (by decide +kernel) +def CB5_2_1I1R1H : Ball := ⟨0, (5338018769 / 10000000000000000000000000000000)⟩ +lemma CB5_2_1I1R1H_sound : CB5_2_1I1R1H.Encloses (homogeneousEntropy CB5_2_1I1R1Value) := by + exact contains_sound (homogeneous_enclosed CB5_2_1I1R1Value CB5_2_1I1R1MassTerm_sound CB5_2_1I1R1Entropy_sound) (by decide +kernel) +def CB5_2_1I1R2Value (a : Fin 6) : ℝ := residualLaw (below (shape 5 2 1)) (fun u => (stageBLaw (shape 5 2 1) u : ℝ)) (stageBPriority (shape 5 2 1)) 1 (fun u a => (littleLaw (shape 5 2 1) u ((stageBPriority (shape 5 2 1)) 1) a : ℝ)) 2 a +def CB5_2_1I1R2Raw (a : Fin 6) : Ball := residualBall (below (shape 5 2 1)) B5_2_1Law (stageBPriority (shape 5 2 1)) 1 (fun u => B5_2_1Little u ((stageBPriority (shape 5 2 1)) 1)) 2 a +lemma CB5_2_1I1R2Raw_sound (a : Fin 6) : + (CB5_2_1I1R2Raw a).Encloses (CB5_2_1I1R2Value a) := by + exact residualBall_sound_on (below (shape 5 2 1)) B5_2_1Law (fun u => (stageBLaw (shape 5 2 1) u : ℝ)) (stageBPriority (shape 5 2 1)) 1 (fun u => B5_2_1Little u ((stageBPriority (shape 5 2 1)) 1)) (fun u a => (littleLaw (shape 5 2 1) u ((stageBPriority (shape 5 2 1)) 1) a : ℝ)) (fun u _ => B5_2_1Law_sound u) (fun u _ a => B5_2_1Little_sound u ((stageBPriority (shape 5 2 1)) 1) a) 2 a +def CB5_2_1I1R2Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(8251288847660790062385380988161 / 50000000000000000000000000000000), (33 / 100000000000000000000000000000000)⟩ ⟨(29731928403890637480496172123267 / 100000000000000000000000000000000), (13978227117 / 100000000000000000000000000000000)⟩ ⟨(-90082679666218234075586429991739 / 50000000000000000000000000000000), (84703294931 / 100000000000000000000000000000000)⟩ ⟨-3, 8251288847660790062385380988161, 6250000000000000000000000000000⟩, + .log ⟨(496830304206321792542832136267 / 25000000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ ⟨(62296678635940329152577077383 / 800000000000000000000000000000), (2945821479 / 100000000000000000000000000000000)⟩ ⟨(-391838257628642468839827015994241 / 100000000000000000000000000000000), (74115382991 / 50000000000000000000000000000000)⟩ ⟨-6, 496830304206321792542832136267, 390625000000000000000000000000⟩] +lemma CB5_2_1I1R2Certificates_valid : + CB5_2_1I1R2Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB5_2_1I1R2CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | 2 => 1 + | 3 => 2 + | _ => 0 +def CB5_2_1I1R2P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB5_2_1I1R2Certificates (CB5_2_1I1R2CertificateIndex a)).input +lemma CB5_2_1I1R2P_check : ∀ a : Fin 6, contains (CB5_2_1I1R2Raw a) (CB5_2_1I1R2P a) = true := by + decide +kernel +lemma CB5_2_1I1R2P_sound (a : Fin 6) : + (CB5_2_1I1R2P a).Encloses (CB5_2_1I1R2Value a) := + contains_sound (CB5_2_1I1R2Raw_sound a) (CB5_2_1I1R2P_check a) +def CB5_2_1I1R2Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB5_2_1I1R2Certificates (CB5_2_1I1R2CertificateIndex a)).output +lemma CB5_2_1I1R2Terms_sound (a : Fin 6) : + (CB5_2_1I1R2Terms a).Encloses (Foundation.entropyTerm (CB5_2_1I1R2Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB5_2_1I1R2Certificates_valid + (CB5_2_1I1R2CertificateIndex a) (CB5_2_1I1R2P_sound a) +def CB5_2_1I1R2Entropy : Ball := ⟨(18759506616691589312284153398071 / 50000000000000000000000000000000), (4231012149 / 25000000000000000000000000000000)⟩ +lemma CB5_2_1I1R2Entropy_sound : CB5_2_1I1R2Entropy.Encloses (Foundation.finiteEntropy CB5_2_1I1R2Value) := by + exact contains_sound (entropyFin_enclosed 6 CB5_2_1I1R2Value CB5_2_1I1R2Terms CB5_2_1I1R2Terms_sound) (by decide +kernel) +def CB5_2_1I1R2Mass : Ball := ⟨(1848989891214686729494209052139 / 10000000000000000000000000000000), (37 / 100000000000000000000000000000000)⟩ +lemma CB5_2_1I1R2Mass_sound : CB5_2_1I1R2Mass.Encloses (∑ a, CB5_2_1I1R2Value a) := by + exact contains_sound (finSumBall_sound 6 CB5_2_1I1R2P CB5_2_1I1R2Value CB5_2_1I1R2P_sound) (by decide +kernel) +def CB5_2_1I1R2MassTermLogWitness : LogWitness := ⟨-3, 1848989891214686729494209052139, 1250000000000000000000000000000⟩ +def CB5_2_1I1R2MassTermLog : Ball := ⟨(-4219864019418759598795757864871 / 2500000000000000000000000000000), (84703294931 / 100000000000000000000000000000000)⟩ +lemma CB5_2_1I1R2MassTermLog_sound : CB5_2_1I1R2MassTermLog.Encloses (Real.log ((∑ a, CB5_2_1I1R2Value a))) := by + exact checkLog_sound logTwoBall_sound (CB5_2_1I1R2Mass_sound) (w := CB5_2_1I1R2MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB5_2_1I1R2MassTerm : Ball := ⟨(15604971828411725998343746085051 / 50000000000000000000000000000000), (15661553671 / 100000000000000000000000000000000)⟩ +lemma CB5_2_1I1R2MassTerm_sound : CB5_2_1I1R2MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB5_2_1I1R2Value a))) := by + exact contains_sound (entropyTerm_ball (CB5_2_1I1R2Mass_sound) CB5_2_1I1R2MassTermLog_sound) (by decide +kernel) +def CB5_2_1I1R2H : Ball := ⟨(157726739413993165697020365651 / 2500000000000000000000000000000), (32585602267 / 100000000000000000000000000000000)⟩ +lemma CB5_2_1I1R2H_sound : CB5_2_1I1R2H.Encloses (homogeneousEntropy CB5_2_1I1R2Value) := by + exact contains_sound (homogeneous_enclosed CB5_2_1I1R2Value CB5_2_1I1R2MassTerm_sound CB5_2_1I1R2Entropy_sound) (by decide +kernel) +def CB5_2_1I1R3Value (a : Fin 6) : ℝ := residualLaw (below (shape 5 2 1)) (fun u => (stageBLaw (shape 5 2 1) u : ℝ)) (stageBPriority (shape 5 2 1)) 1 (fun u a => (littleLaw (shape 5 2 1) u ((stageBPriority (shape 5 2 1)) 1) a : ℝ)) 3 a +def CB5_2_1I1R3Raw (a : Fin 6) : Ball := residualBall (below (shape 5 2 1)) B5_2_1Law (stageBPriority (shape 5 2 1)) 1 (fun u => B5_2_1Little u ((stageBPriority (shape 5 2 1)) 1)) 3 a +lemma CB5_2_1I1R3Raw_sound (a : Fin 6) : + (CB5_2_1I1R3Raw a).Encloses (CB5_2_1I1R3Value a) := by + exact residualBall_sound_on (below (shape 5 2 1)) B5_2_1Law (fun u => (stageBLaw (shape 5 2 1) u : ℝ)) (stageBPriority (shape 5 2 1)) 1 (fun u => B5_2_1Little u ((stageBPriority (shape 5 2 1)) 1)) (fun u a => (littleLaw (shape 5 2 1) u ((stageBPriority (shape 5 2 1)) 1) a : ℝ)) (fun u _ => B5_2_1Law_sound u) (fun u _ a => B5_2_1Little_sound u ((stageBPriority (shape 5 2 1)) 1) a) 3 a +def CB5_2_1I1R3Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB5_2_1I1R3Certificates_valid : + CB5_2_1I1R3Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB5_2_1I1R3CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB5_2_1I1R3P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB5_2_1I1R3Certificates (CB5_2_1I1R3CertificateIndex a)).input +lemma CB5_2_1I1R3P_check : ∀ a : Fin 6, contains (CB5_2_1I1R3Raw a) (CB5_2_1I1R3P a) = true := by + decide +kernel +lemma CB5_2_1I1R3P_sound (a : Fin 6) : + (CB5_2_1I1R3P a).Encloses (CB5_2_1I1R3Value a) := + contains_sound (CB5_2_1I1R3Raw_sound a) (CB5_2_1I1R3P_check a) +def CB5_2_1I1R3Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB5_2_1I1R3Certificates (CB5_2_1I1R3CertificateIndex a)).output +lemma CB5_2_1I1R3Terms_sound (a : Fin 6) : + (CB5_2_1I1R3Terms a).Encloses (Foundation.entropyTerm (CB5_2_1I1R3Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB5_2_1I1R3Certificates_valid + (CB5_2_1I1R3CertificateIndex a) (CB5_2_1I1R3P_sound a) +def CB5_2_1I1R3Entropy : Ball := ⟨0, 0⟩ +lemma CB5_2_1I1R3Entropy_sound : CB5_2_1I1R3Entropy.Encloses (Foundation.finiteEntropy CB5_2_1I1R3Value) := by + exact contains_sound (entropyFin_enclosed 6 CB5_2_1I1R3Value CB5_2_1I1R3Terms CB5_2_1I1R3Terms_sound) (by decide +kernel) +def CB5_2_1I1R3Mass : Ball := ⟨0, 0⟩ +lemma CB5_2_1I1R3Mass_sound : CB5_2_1I1R3Mass.Encloses (∑ a, CB5_2_1I1R3Value a) := by + exact contains_sound (finSumBall_sound 6 CB5_2_1I1R3P CB5_2_1I1R3Value CB5_2_1I1R3P_sound) (by decide +kernel) +def CB5_2_1I1R3MassTerm : Ball := .exact 0 +lemma CB5_2_1I1R3MassTerm_sound : CB5_2_1I1R3MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB5_2_1I1R3Value a))) := + entropyTerm_zero_ball (CB5_2_1I1R3Mass_sound) +def CB5_2_1I1R3H : Ball := ⟨0, 0⟩ +lemma CB5_2_1I1R3H_sound : CB5_2_1I1R3H.Encloses (homogeneousEntropy CB5_2_1I1R3Value) := by + exact contains_sound (homogeneous_enclosed CB5_2_1I1R3Value CB5_2_1I1R3MassTerm_sound CB5_2_1I1R3Entropy_sound) (by decide +kernel) +def CB5_2_1I1R4Value (a : Fin 6) : ℝ := residualLaw (below (shape 5 2 1)) (fun u => (stageBLaw (shape 5 2 1) u : ℝ)) (stageBPriority (shape 5 2 1)) 1 (fun u a => (littleLaw (shape 5 2 1) u ((stageBPriority (shape 5 2 1)) 1) a : ℝ)) 4 a +def CB5_2_1I1R4Raw (a : Fin 6) : Ball := residualBall (below (shape 5 2 1)) B5_2_1Law (stageBPriority (shape 5 2 1)) 1 (fun u => B5_2_1Little u ((stageBPriority (shape 5 2 1)) 1)) 4 a +lemma CB5_2_1I1R4Raw_sound (a : Fin 6) : + (CB5_2_1I1R4Raw a).Encloses (CB5_2_1I1R4Value a) := by + exact residualBall_sound_on (below (shape 5 2 1)) B5_2_1Law (fun u => (stageBLaw (shape 5 2 1) u : ℝ)) (stageBPriority (shape 5 2 1)) 1 (fun u => B5_2_1Little u ((stageBPriority (shape 5 2 1)) 1)) (fun u a => (littleLaw (shape 5 2 1) u ((stageBPriority (shape 5 2 1)) 1) a : ℝ)) (fun u _ => B5_2_1Law_sound u) (fun u _ a => B5_2_1Little_sound u ((stageBPriority (shape 5 2 1)) 1) a) 4 a +def CB5_2_1I1R4Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB5_2_1I1R4Certificates_valid : + CB5_2_1I1R4Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB5_2_1I1R4CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB5_2_1I1R4P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB5_2_1I1R4Certificates (CB5_2_1I1R4CertificateIndex a)).input +lemma CB5_2_1I1R4P_check : ∀ a : Fin 6, contains (CB5_2_1I1R4Raw a) (CB5_2_1I1R4P a) = true := by + decide +kernel +lemma CB5_2_1I1R4P_sound (a : Fin 6) : + (CB5_2_1I1R4P a).Encloses (CB5_2_1I1R4Value a) := + contains_sound (CB5_2_1I1R4Raw_sound a) (CB5_2_1I1R4P_check a) +def CB5_2_1I1R4Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB5_2_1I1R4Certificates (CB5_2_1I1R4CertificateIndex a)).output +lemma CB5_2_1I1R4Terms_sound (a : Fin 6) : + (CB5_2_1I1R4Terms a).Encloses (Foundation.entropyTerm (CB5_2_1I1R4Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB5_2_1I1R4Certificates_valid + (CB5_2_1I1R4CertificateIndex a) (CB5_2_1I1R4P_sound a) +def CB5_2_1I1R4Entropy : Ball := ⟨0, 0⟩ +lemma CB5_2_1I1R4Entropy_sound : CB5_2_1I1R4Entropy.Encloses (Foundation.finiteEntropy CB5_2_1I1R4Value) := by + exact contains_sound (entropyFin_enclosed 6 CB5_2_1I1R4Value CB5_2_1I1R4Terms CB5_2_1I1R4Terms_sound) (by decide +kernel) +def CB5_2_1I1R4Mass : Ball := ⟨0, 0⟩ +lemma CB5_2_1I1R4Mass_sound : CB5_2_1I1R4Mass.Encloses (∑ a, CB5_2_1I1R4Value a) := by + exact contains_sound (finSumBall_sound 6 CB5_2_1I1R4P CB5_2_1I1R4Value CB5_2_1I1R4P_sound) (by decide +kernel) +def CB5_2_1I1R4MassTerm : Ball := .exact 0 +lemma CB5_2_1I1R4MassTerm_sound : CB5_2_1I1R4MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB5_2_1I1R4Value a))) := + entropyTerm_zero_ball (CB5_2_1I1R4Mass_sound) +def CB5_2_1I1R4H : Ball := ⟨0, 0⟩ +lemma CB5_2_1I1R4H_sound : CB5_2_1I1R4H.Encloses (homogeneousEntropy CB5_2_1I1R4Value) := by + exact contains_sound (homogeneous_enclosed CB5_2_1I1R4Value CB5_2_1I1R4MassTerm_sound CB5_2_1I1R4Entropy_sound) (by decide +kernel) +def CB5_2_1I1R5Value (a : Fin 6) : ℝ := residualLaw (below (shape 5 2 1)) (fun u => (stageBLaw (shape 5 2 1) u : ℝ)) (stageBPriority (shape 5 2 1)) 1 (fun u a => (littleLaw (shape 5 2 1) u ((stageBPriority (shape 5 2 1)) 1) a : ℝ)) 5 a +def CB5_2_1I1R5Raw (a : Fin 6) : Ball := residualBall (below (shape 5 2 1)) B5_2_1Law (stageBPriority (shape 5 2 1)) 1 (fun u => B5_2_1Little u ((stageBPriority (shape 5 2 1)) 1)) 5 a +lemma CB5_2_1I1R5Raw_sound (a : Fin 6) : + (CB5_2_1I1R5Raw a).Encloses (CB5_2_1I1R5Value a) := by + exact residualBall_sound_on (below (shape 5 2 1)) B5_2_1Law (fun u => (stageBLaw (shape 5 2 1) u : ℝ)) (stageBPriority (shape 5 2 1)) 1 (fun u => B5_2_1Little u ((stageBPriority (shape 5 2 1)) 1)) (fun u a => (littleLaw (shape 5 2 1) u ((stageBPriority (shape 5 2 1)) 1) a : ℝ)) (fun u _ => B5_2_1Law_sound u) (fun u _ a => B5_2_1Little_sound u ((stageBPriority (shape 5 2 1)) 1) a) 5 a +def CB5_2_1I1R5Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB5_2_1I1R5Certificates_valid : + CB5_2_1I1R5Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB5_2_1I1R5CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB5_2_1I1R5P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB5_2_1I1R5Certificates (CB5_2_1I1R5CertificateIndex a)).input +lemma CB5_2_1I1R5P_check : ∀ a : Fin 6, contains (CB5_2_1I1R5Raw a) (CB5_2_1I1R5P a) = true := by + decide +kernel +lemma CB5_2_1I1R5P_sound (a : Fin 6) : + (CB5_2_1I1R5P a).Encloses (CB5_2_1I1R5Value a) := + contains_sound (CB5_2_1I1R5Raw_sound a) (CB5_2_1I1R5P_check a) +def CB5_2_1I1R5Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB5_2_1I1R5Certificates (CB5_2_1I1R5CertificateIndex a)).output +lemma CB5_2_1I1R5Terms_sound (a : Fin 6) : + (CB5_2_1I1R5Terms a).Encloses (Foundation.entropyTerm (CB5_2_1I1R5Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB5_2_1I1R5Certificates_valid + (CB5_2_1I1R5CertificateIndex a) (CB5_2_1I1R5P_sound a) +def CB5_2_1I1R5Entropy : Ball := ⟨0, 0⟩ +lemma CB5_2_1I1R5Entropy_sound : CB5_2_1I1R5Entropy.Encloses (Foundation.finiteEntropy CB5_2_1I1R5Value) := by + exact contains_sound (entropyFin_enclosed 6 CB5_2_1I1R5Value CB5_2_1I1R5Terms CB5_2_1I1R5Terms_sound) (by decide +kernel) +def CB5_2_1I1R5Mass : Ball := ⟨0, 0⟩ +lemma CB5_2_1I1R5Mass_sound : CB5_2_1I1R5Mass.Encloses (∑ a, CB5_2_1I1R5Value a) := by + exact contains_sound (finSumBall_sound 6 CB5_2_1I1R5P CB5_2_1I1R5Value CB5_2_1I1R5P_sound) (by decide +kernel) +def CB5_2_1I1R5MassTerm : Ball := .exact 0 +lemma CB5_2_1I1R5MassTerm_sound : CB5_2_1I1R5MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB5_2_1I1R5Value a))) := + entropyTerm_zero_ball (CB5_2_1I1R5Mass_sound) +def CB5_2_1I1R5H : Ball := ⟨0, 0⟩ +lemma CB5_2_1I1R5H_sound : CB5_2_1I1R5H.Encloses (homogeneousEntropy CB5_2_1I1R5Value) := by + exact contains_sound (homogeneous_enclosed CB5_2_1I1R5Value CB5_2_1I1R5MassTerm_sound CB5_2_1I1R5Entropy_sound) (by decide +kernel) +def CB5_2_1I1R6Value (a : Fin 6) : ℝ := residualLaw (below (shape 5 2 1)) (fun u => (stageBLaw (shape 5 2 1) u : ℝ)) (stageBPriority (shape 5 2 1)) 1 (fun u a => (littleLaw (shape 5 2 1) u ((stageBPriority (shape 5 2 1)) 1) a : ℝ)) 6 a +def CB5_2_1I1R6Raw (a : Fin 6) : Ball := residualBall (below (shape 5 2 1)) B5_2_1Law (stageBPriority (shape 5 2 1)) 1 (fun u => B5_2_1Little u ((stageBPriority (shape 5 2 1)) 1)) 6 a +lemma CB5_2_1I1R6Raw_sound (a : Fin 6) : + (CB5_2_1I1R6Raw a).Encloses (CB5_2_1I1R6Value a) := by + exact residualBall_sound_on (below (shape 5 2 1)) B5_2_1Law (fun u => (stageBLaw (shape 5 2 1) u : ℝ)) (stageBPriority (shape 5 2 1)) 1 (fun u => B5_2_1Little u ((stageBPriority (shape 5 2 1)) 1)) (fun u a => (littleLaw (shape 5 2 1) u ((stageBPriority (shape 5 2 1)) 1) a : ℝ)) (fun u _ => B5_2_1Law_sound u) (fun u _ a => B5_2_1Little_sound u ((stageBPriority (shape 5 2 1)) 1) a) 6 a +def CB5_2_1I1R6Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB5_2_1I1R6Certificates_valid : + CB5_2_1I1R6Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB5_2_1I1R6CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB5_2_1I1R6P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB5_2_1I1R6Certificates (CB5_2_1I1R6CertificateIndex a)).input +lemma CB5_2_1I1R6P_check : ∀ a : Fin 6, contains (CB5_2_1I1R6Raw a) (CB5_2_1I1R6P a) = true := by + decide +kernel +lemma CB5_2_1I1R6P_sound (a : Fin 6) : + (CB5_2_1I1R6P a).Encloses (CB5_2_1I1R6Value a) := + contains_sound (CB5_2_1I1R6Raw_sound a) (CB5_2_1I1R6P_check a) +def CB5_2_1I1R6Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB5_2_1I1R6Certificates (CB5_2_1I1R6CertificateIndex a)).output +lemma CB5_2_1I1R6Terms_sound (a : Fin 6) : + (CB5_2_1I1R6Terms a).Encloses (Foundation.entropyTerm (CB5_2_1I1R6Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB5_2_1I1R6Certificates_valid + (CB5_2_1I1R6CertificateIndex a) (CB5_2_1I1R6P_sound a) +def CB5_2_1I1R6Entropy : Ball := ⟨0, 0⟩ +lemma CB5_2_1I1R6Entropy_sound : CB5_2_1I1R6Entropy.Encloses (Foundation.finiteEntropy CB5_2_1I1R6Value) := by + exact contains_sound (entropyFin_enclosed 6 CB5_2_1I1R6Value CB5_2_1I1R6Terms CB5_2_1I1R6Terms_sound) (by decide +kernel) +def CB5_2_1I1R6Mass : Ball := ⟨0, 0⟩ +lemma CB5_2_1I1R6Mass_sound : CB5_2_1I1R6Mass.Encloses (∑ a, CB5_2_1I1R6Value a) := by + exact contains_sound (finSumBall_sound 6 CB5_2_1I1R6P CB5_2_1I1R6Value CB5_2_1I1R6P_sound) (by decide +kernel) +def CB5_2_1I1R6MassTerm : Ball := .exact 0 +lemma CB5_2_1I1R6MassTerm_sound : CB5_2_1I1R6MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB5_2_1I1R6Value a))) := + entropyTerm_zero_ball (CB5_2_1I1R6Mass_sound) +def CB5_2_1I1R6H : Ball := ⟨0, 0⟩ +lemma CB5_2_1I1R6H_sound : CB5_2_1I1R6H.Encloses (homogeneousEntropy CB5_2_1I1R6Value) := by + exact contains_sound (homogeneous_enclosed CB5_2_1I1R6Value CB5_2_1I1R6MassTerm_sound CB5_2_1I1R6Entropy_sound) (by decide +kernel) +def CB5_2_1I1R7Value (a : Fin 6) : ℝ := residualLaw (below (shape 5 2 1)) (fun u => (stageBLaw (shape 5 2 1) u : ℝ)) (stageBPriority (shape 5 2 1)) 1 (fun u a => (littleLaw (shape 5 2 1) u ((stageBPriority (shape 5 2 1)) 1) a : ℝ)) 7 a +def CB5_2_1I1R7Raw (a : Fin 6) : Ball := residualBall (below (shape 5 2 1)) B5_2_1Law (stageBPriority (shape 5 2 1)) 1 (fun u => B5_2_1Little u ((stageBPriority (shape 5 2 1)) 1)) 7 a +lemma CB5_2_1I1R7Raw_sound (a : Fin 6) : + (CB5_2_1I1R7Raw a).Encloses (CB5_2_1I1R7Value a) := by + exact residualBall_sound_on (below (shape 5 2 1)) B5_2_1Law (fun u => (stageBLaw (shape 5 2 1) u : ℝ)) (stageBPriority (shape 5 2 1)) 1 (fun u => B5_2_1Little u ((stageBPriority (shape 5 2 1)) 1)) (fun u a => (littleLaw (shape 5 2 1) u ((stageBPriority (shape 5 2 1)) 1) a : ℝ)) (fun u _ => B5_2_1Law_sound u) (fun u _ a => B5_2_1Little_sound u ((stageBPriority (shape 5 2 1)) 1) a) 7 a +def CB5_2_1I1R7Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB5_2_1I1R7Certificates_valid : + CB5_2_1I1R7Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB5_2_1I1R7CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB5_2_1I1R7P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB5_2_1I1R7Certificates (CB5_2_1I1R7CertificateIndex a)).input +lemma CB5_2_1I1R7P_check : ∀ a : Fin 6, contains (CB5_2_1I1R7Raw a) (CB5_2_1I1R7P a) = true := by + decide +kernel +lemma CB5_2_1I1R7P_sound (a : Fin 6) : + (CB5_2_1I1R7P a).Encloses (CB5_2_1I1R7Value a) := + contains_sound (CB5_2_1I1R7Raw_sound a) (CB5_2_1I1R7P_check a) +def CB5_2_1I1R7Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB5_2_1I1R7Certificates (CB5_2_1I1R7CertificateIndex a)).output +lemma CB5_2_1I1R7Terms_sound (a : Fin 6) : + (CB5_2_1I1R7Terms a).Encloses (Foundation.entropyTerm (CB5_2_1I1R7Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB5_2_1I1R7Certificates_valid + (CB5_2_1I1R7CertificateIndex a) (CB5_2_1I1R7P_sound a) +def CB5_2_1I1R7Entropy : Ball := ⟨0, 0⟩ +lemma CB5_2_1I1R7Entropy_sound : CB5_2_1I1R7Entropy.Encloses (Foundation.finiteEntropy CB5_2_1I1R7Value) := by + exact contains_sound (entropyFin_enclosed 6 CB5_2_1I1R7Value CB5_2_1I1R7Terms CB5_2_1I1R7Terms_sound) (by decide +kernel) +def CB5_2_1I1R7Mass : Ball := ⟨0, 0⟩ +lemma CB5_2_1I1R7Mass_sound : CB5_2_1I1R7Mass.Encloses (∑ a, CB5_2_1I1R7Value a) := by + exact contains_sound (finSumBall_sound 6 CB5_2_1I1R7P CB5_2_1I1R7Value CB5_2_1I1R7P_sound) (by decide +kernel) +def CB5_2_1I1R7MassTerm : Ball := .exact 0 +lemma CB5_2_1I1R7MassTerm_sound : CB5_2_1I1R7MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB5_2_1I1R7Value a))) := + entropyTerm_zero_ball (CB5_2_1I1R7Mass_sound) +def CB5_2_1I1R7H : Ball := ⟨0, 0⟩ +lemma CB5_2_1I1R7H_sound : CB5_2_1I1R7H.Encloses (homogeneousEntropy CB5_2_1I1R7Value) := by + exact contains_sound (homogeneous_enclosed CB5_2_1I1R7Value CB5_2_1I1R7MassTerm_sound CB5_2_1I1R7Entropy_sound) (by decide +kernel) +def CB5_2_1I1R8Value (a : Fin 6) : ℝ := residualLaw (below (shape 5 2 1)) (fun u => (stageBLaw (shape 5 2 1) u : ℝ)) (stageBPriority (shape 5 2 1)) 1 (fun u a => (littleLaw (shape 5 2 1) u ((stageBPriority (shape 5 2 1)) 1) a : ℝ)) 8 a +def CB5_2_1I1R8Raw (a : Fin 6) : Ball := residualBall (below (shape 5 2 1)) B5_2_1Law (stageBPriority (shape 5 2 1)) 1 (fun u => B5_2_1Little u ((stageBPriority (shape 5 2 1)) 1)) 8 a +lemma CB5_2_1I1R8Raw_sound (a : Fin 6) : + (CB5_2_1I1R8Raw a).Encloses (CB5_2_1I1R8Value a) := by + exact residualBall_sound_on (below (shape 5 2 1)) B5_2_1Law (fun u => (stageBLaw (shape 5 2 1) u : ℝ)) (stageBPriority (shape 5 2 1)) 1 (fun u => B5_2_1Little u ((stageBPriority (shape 5 2 1)) 1)) (fun u a => (littleLaw (shape 5 2 1) u ((stageBPriority (shape 5 2 1)) 1) a : ℝ)) (fun u _ => B5_2_1Law_sound u) (fun u _ a => B5_2_1Little_sound u ((stageBPriority (shape 5 2 1)) 1) a) 8 a +def CB5_2_1I1R8Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB5_2_1I1R8Certificates_valid : + CB5_2_1I1R8Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB5_2_1I1R8CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB5_2_1I1R8P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB5_2_1I1R8Certificates (CB5_2_1I1R8CertificateIndex a)).input +lemma CB5_2_1I1R8P_check : ∀ a : Fin 6, contains (CB5_2_1I1R8Raw a) (CB5_2_1I1R8P a) = true := by + decide +kernel +lemma CB5_2_1I1R8P_sound (a : Fin 6) : + (CB5_2_1I1R8P a).Encloses (CB5_2_1I1R8Value a) := + contains_sound (CB5_2_1I1R8Raw_sound a) (CB5_2_1I1R8P_check a) +def CB5_2_1I1R8Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB5_2_1I1R8Certificates (CB5_2_1I1R8CertificateIndex a)).output +lemma CB5_2_1I1R8Terms_sound (a : Fin 6) : + (CB5_2_1I1R8Terms a).Encloses (Foundation.entropyTerm (CB5_2_1I1R8Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB5_2_1I1R8Certificates_valid + (CB5_2_1I1R8CertificateIndex a) (CB5_2_1I1R8P_sound a) +def CB5_2_1I1R8Entropy : Ball := ⟨0, 0⟩ +lemma CB5_2_1I1R8Entropy_sound : CB5_2_1I1R8Entropy.Encloses (Foundation.finiteEntropy CB5_2_1I1R8Value) := by + exact contains_sound (entropyFin_enclosed 6 CB5_2_1I1R8Value CB5_2_1I1R8Terms CB5_2_1I1R8Terms_sound) (by decide +kernel) +def CB5_2_1I1R8Mass : Ball := ⟨0, 0⟩ +lemma CB5_2_1I1R8Mass_sound : CB5_2_1I1R8Mass.Encloses (∑ a, CB5_2_1I1R8Value a) := by + exact contains_sound (finSumBall_sound 6 CB5_2_1I1R8P CB5_2_1I1R8Value CB5_2_1I1R8P_sound) (by decide +kernel) +def CB5_2_1I1R8MassTerm : Ball := .exact 0 +lemma CB5_2_1I1R8MassTerm_sound : CB5_2_1I1R8MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB5_2_1I1R8Value a))) := + entropyTerm_zero_ball (CB5_2_1I1R8Mass_sound) +def CB5_2_1I1R8H : Ball := ⟨0, 0⟩ +lemma CB5_2_1I1R8H_sound : CB5_2_1I1R8H.Encloses (homogeneousEntropy CB5_2_1I1R8Value) := by + exact contains_sound (homogeneous_enclosed CB5_2_1I1R8Value CB5_2_1I1R8MassTerm_sound CB5_2_1I1R8Entropy_sound) (by decide +kernel) +def CB5_2_1I1R9Value (a : Fin 6) : ℝ := residualLaw (below (shape 5 2 1)) (fun u => (stageBLaw (shape 5 2 1) u : ℝ)) (stageBPriority (shape 5 2 1)) 1 (fun u a => (littleLaw (shape 5 2 1) u ((stageBPriority (shape 5 2 1)) 1) a : ℝ)) 9 a +def CB5_2_1I1R9Raw (a : Fin 6) : Ball := residualBall (below (shape 5 2 1)) B5_2_1Law (stageBPriority (shape 5 2 1)) 1 (fun u => B5_2_1Little u ((stageBPriority (shape 5 2 1)) 1)) 9 a +lemma CB5_2_1I1R9Raw_sound (a : Fin 6) : + (CB5_2_1I1R9Raw a).Encloses (CB5_2_1I1R9Value a) := by + exact residualBall_sound_on (below (shape 5 2 1)) B5_2_1Law (fun u => (stageBLaw (shape 5 2 1) u : ℝ)) (stageBPriority (shape 5 2 1)) 1 (fun u => B5_2_1Little u ((stageBPriority (shape 5 2 1)) 1)) (fun u a => (littleLaw (shape 5 2 1) u ((stageBPriority (shape 5 2 1)) 1) a : ℝ)) (fun u _ => B5_2_1Law_sound u) (fun u _ a => B5_2_1Little_sound u ((stageBPriority (shape 5 2 1)) 1) a) 9 a +def CB5_2_1I1R9Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB5_2_1I1R9Certificates_valid : + CB5_2_1I1R9Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB5_2_1I1R9CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB5_2_1I1R9P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB5_2_1I1R9Certificates (CB5_2_1I1R9CertificateIndex a)).input +lemma CB5_2_1I1R9P_check : ∀ a : Fin 6, contains (CB5_2_1I1R9Raw a) (CB5_2_1I1R9P a) = true := by + decide +kernel +lemma CB5_2_1I1R9P_sound (a : Fin 6) : + (CB5_2_1I1R9P a).Encloses (CB5_2_1I1R9Value a) := + contains_sound (CB5_2_1I1R9Raw_sound a) (CB5_2_1I1R9P_check a) +def CB5_2_1I1R9Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB5_2_1I1R9Certificates (CB5_2_1I1R9CertificateIndex a)).output +lemma CB5_2_1I1R9Terms_sound (a : Fin 6) : + (CB5_2_1I1R9Terms a).Encloses (Foundation.entropyTerm (CB5_2_1I1R9Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB5_2_1I1R9Certificates_valid + (CB5_2_1I1R9CertificateIndex a) (CB5_2_1I1R9P_sound a) +def CB5_2_1I1R9Entropy : Ball := ⟨0, 0⟩ +lemma CB5_2_1I1R9Entropy_sound : CB5_2_1I1R9Entropy.Encloses (Foundation.finiteEntropy CB5_2_1I1R9Value) := by + exact contains_sound (entropyFin_enclosed 6 CB5_2_1I1R9Value CB5_2_1I1R9Terms CB5_2_1I1R9Terms_sound) (by decide +kernel) +def CB5_2_1I1R9Mass : Ball := ⟨0, 0⟩ +lemma CB5_2_1I1R9Mass_sound : CB5_2_1I1R9Mass.Encloses (∑ a, CB5_2_1I1R9Value a) := by + exact contains_sound (finSumBall_sound 6 CB5_2_1I1R9P CB5_2_1I1R9Value CB5_2_1I1R9P_sound) (by decide +kernel) +def CB5_2_1I1R9MassTerm : Ball := .exact 0 +lemma CB5_2_1I1R9MassTerm_sound : CB5_2_1I1R9MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB5_2_1I1R9Value a))) := + entropyTerm_zero_ball (CB5_2_1I1R9Mass_sound) +def CB5_2_1I1R9H : Ball := ⟨0, 0⟩ +lemma CB5_2_1I1R9H_sound : CB5_2_1I1R9H.Encloses (homogeneousEntropy CB5_2_1I1R9Value) := by + exact contains_sound (homogeneous_enclosed CB5_2_1I1R9Value CB5_2_1I1R9MassTerm_sound CB5_2_1I1R9Entropy_sound) (by decide +kernel) +def CB5_2_1I1R10Value (a : Fin 6) : ℝ := residualLaw (below (shape 5 2 1)) (fun u => (stageBLaw (shape 5 2 1) u : ℝ)) (stageBPriority (shape 5 2 1)) 1 (fun u a => (littleLaw (shape 5 2 1) u ((stageBPriority (shape 5 2 1)) 1) a : ℝ)) 10 a +def CB5_2_1I1R10Raw (a : Fin 6) : Ball := residualBall (below (shape 5 2 1)) B5_2_1Law (stageBPriority (shape 5 2 1)) 1 (fun u => B5_2_1Little u ((stageBPriority (shape 5 2 1)) 1)) 10 a +lemma CB5_2_1I1R10Raw_sound (a : Fin 6) : + (CB5_2_1I1R10Raw a).Encloses (CB5_2_1I1R10Value a) := by + exact residualBall_sound_on (below (shape 5 2 1)) B5_2_1Law (fun u => (stageBLaw (shape 5 2 1) u : ℝ)) (stageBPriority (shape 5 2 1)) 1 (fun u => B5_2_1Little u ((stageBPriority (shape 5 2 1)) 1)) (fun u a => (littleLaw (shape 5 2 1) u ((stageBPriority (shape 5 2 1)) 1) a : ℝ)) (fun u _ => B5_2_1Law_sound u) (fun u _ a => B5_2_1Little_sound u ((stageBPriority (shape 5 2 1)) 1) a) 10 a +def CB5_2_1I1R10Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB5_2_1I1R10Certificates_valid : + CB5_2_1I1R10Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB5_2_1I1R10CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB5_2_1I1R10P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB5_2_1I1R10Certificates (CB5_2_1I1R10CertificateIndex a)).input +lemma CB5_2_1I1R10P_check : ∀ a : Fin 6, contains (CB5_2_1I1R10Raw a) (CB5_2_1I1R10P a) = true := by + decide +kernel +lemma CB5_2_1I1R10P_sound (a : Fin 6) : + (CB5_2_1I1R10P a).Encloses (CB5_2_1I1R10Value a) := + contains_sound (CB5_2_1I1R10Raw_sound a) (CB5_2_1I1R10P_check a) +def CB5_2_1I1R10Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB5_2_1I1R10Certificates (CB5_2_1I1R10CertificateIndex a)).output +lemma CB5_2_1I1R10Terms_sound (a : Fin 6) : + (CB5_2_1I1R10Terms a).Encloses (Foundation.entropyTerm (CB5_2_1I1R10Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB5_2_1I1R10Certificates_valid + (CB5_2_1I1R10CertificateIndex a) (CB5_2_1I1R10P_sound a) +def CB5_2_1I1R10Entropy : Ball := ⟨0, 0⟩ +lemma CB5_2_1I1R10Entropy_sound : CB5_2_1I1R10Entropy.Encloses (Foundation.finiteEntropy CB5_2_1I1R10Value) := by + exact contains_sound (entropyFin_enclosed 6 CB5_2_1I1R10Value CB5_2_1I1R10Terms CB5_2_1I1R10Terms_sound) (by decide +kernel) +def CB5_2_1I1R10Mass : Ball := ⟨0, 0⟩ +lemma CB5_2_1I1R10Mass_sound : CB5_2_1I1R10Mass.Encloses (∑ a, CB5_2_1I1R10Value a) := by + exact contains_sound (finSumBall_sound 6 CB5_2_1I1R10P CB5_2_1I1R10Value CB5_2_1I1R10P_sound) (by decide +kernel) +def CB5_2_1I1R10MassTerm : Ball := .exact 0 +lemma CB5_2_1I1R10MassTerm_sound : CB5_2_1I1R10MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB5_2_1I1R10Value a))) := + entropyTerm_zero_ball (CB5_2_1I1R10Mass_sound) +def CB5_2_1I1R10H : Ball := ⟨0, 0⟩ +lemma CB5_2_1I1R10H_sound : CB5_2_1I1R10H.Encloses (homogeneousEntropy CB5_2_1I1R10Value) := by + exact contains_sound (homogeneous_enclosed CB5_2_1I1R10Value CB5_2_1I1R10MassTerm_sound CB5_2_1I1R10Entropy_sound) (by decide +kernel) +def CB5_2_1I1R11Value (a : Fin 6) : ℝ := residualLaw (below (shape 5 2 1)) (fun u => (stageBLaw (shape 5 2 1) u : ℝ)) (stageBPriority (shape 5 2 1)) 1 (fun u a => (littleLaw (shape 5 2 1) u ((stageBPriority (shape 5 2 1)) 1) a : ℝ)) 11 a +def CB5_2_1I1R11Raw (a : Fin 6) : Ball := residualBall (below (shape 5 2 1)) B5_2_1Law (stageBPriority (shape 5 2 1)) 1 (fun u => B5_2_1Little u ((stageBPriority (shape 5 2 1)) 1)) 11 a +lemma CB5_2_1I1R11Raw_sound (a : Fin 6) : + (CB5_2_1I1R11Raw a).Encloses (CB5_2_1I1R11Value a) := by + exact residualBall_sound_on (below (shape 5 2 1)) B5_2_1Law (fun u => (stageBLaw (shape 5 2 1) u : ℝ)) (stageBPriority (shape 5 2 1)) 1 (fun u => B5_2_1Little u ((stageBPriority (shape 5 2 1)) 1)) (fun u a => (littleLaw (shape 5 2 1) u ((stageBPriority (shape 5 2 1)) 1) a : ℝ)) (fun u _ => B5_2_1Law_sound u) (fun u _ a => B5_2_1Little_sound u ((stageBPriority (shape 5 2 1)) 1) a) 11 a +def CB5_2_1I1R11Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB5_2_1I1R11Certificates_valid : + CB5_2_1I1R11Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB5_2_1I1R11CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB5_2_1I1R11P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB5_2_1I1R11Certificates (CB5_2_1I1R11CertificateIndex a)).input +lemma CB5_2_1I1R11P_check : ∀ a : Fin 6, contains (CB5_2_1I1R11Raw a) (CB5_2_1I1R11P a) = true := by + decide +kernel +lemma CB5_2_1I1R11P_sound (a : Fin 6) : + (CB5_2_1I1R11P a).Encloses (CB5_2_1I1R11Value a) := + contains_sound (CB5_2_1I1R11Raw_sound a) (CB5_2_1I1R11P_check a) +def CB5_2_1I1R11Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB5_2_1I1R11Certificates (CB5_2_1I1R11CertificateIndex a)).output +lemma CB5_2_1I1R11Terms_sound (a : Fin 6) : + (CB5_2_1I1R11Terms a).Encloses (Foundation.entropyTerm (CB5_2_1I1R11Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB5_2_1I1R11Certificates_valid + (CB5_2_1I1R11CertificateIndex a) (CB5_2_1I1R11P_sound a) +def CB5_2_1I1R11Entropy : Ball := ⟨0, 0⟩ +lemma CB5_2_1I1R11Entropy_sound : CB5_2_1I1R11Entropy.Encloses (Foundation.finiteEntropy CB5_2_1I1R11Value) := by + exact contains_sound (entropyFin_enclosed 6 CB5_2_1I1R11Value CB5_2_1I1R11Terms CB5_2_1I1R11Terms_sound) (by decide +kernel) +def CB5_2_1I1R11Mass : Ball := ⟨0, 0⟩ +lemma CB5_2_1I1R11Mass_sound : CB5_2_1I1R11Mass.Encloses (∑ a, CB5_2_1I1R11Value a) := by + exact contains_sound (finSumBall_sound 6 CB5_2_1I1R11P CB5_2_1I1R11Value CB5_2_1I1R11P_sound) (by decide +kernel) +def CB5_2_1I1R11MassTerm : Ball := .exact 0 +lemma CB5_2_1I1R11MassTerm_sound : CB5_2_1I1R11MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB5_2_1I1R11Value a))) := + entropyTerm_zero_ball (CB5_2_1I1R11Mass_sound) +def CB5_2_1I1R11H : Ball := ⟨0, 0⟩ +lemma CB5_2_1I1R11H_sound : CB5_2_1I1R11H.Encloses (homogeneousEntropy CB5_2_1I1R11Value) := by + exact contains_sound (homogeneous_enclosed CB5_2_1I1R11Value CB5_2_1I1R11MassTerm_sound CB5_2_1I1R11Entropy_sound) (by decide +kernel) +def CB5_2_1I1R12Value (a : Fin 6) : ℝ := residualLaw (below (shape 5 2 1)) (fun u => (stageBLaw (shape 5 2 1) u : ℝ)) (stageBPriority (shape 5 2 1)) 1 (fun u a => (littleLaw (shape 5 2 1) u ((stageBPriority (shape 5 2 1)) 1) a : ℝ)) 12 a +def CB5_2_1I1R12Raw (a : Fin 6) : Ball := residualBall (below (shape 5 2 1)) B5_2_1Law (stageBPriority (shape 5 2 1)) 1 (fun u => B5_2_1Little u ((stageBPriority (shape 5 2 1)) 1)) 12 a +lemma CB5_2_1I1R12Raw_sound (a : Fin 6) : + (CB5_2_1I1R12Raw a).Encloses (CB5_2_1I1R12Value a) := by + exact residualBall_sound_on (below (shape 5 2 1)) B5_2_1Law (fun u => (stageBLaw (shape 5 2 1) u : ℝ)) (stageBPriority (shape 5 2 1)) 1 (fun u => B5_2_1Little u ((stageBPriority (shape 5 2 1)) 1)) (fun u a => (littleLaw (shape 5 2 1) u ((stageBPriority (shape 5 2 1)) 1) a : ℝ)) (fun u _ => B5_2_1Law_sound u) (fun u _ a => B5_2_1Little_sound u ((stageBPriority (shape 5 2 1)) 1) a) 12 a +def CB5_2_1I1R12Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB5_2_1I1R12Certificates_valid : + CB5_2_1I1R12Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB5_2_1I1R12CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB5_2_1I1R12P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB5_2_1I1R12Certificates (CB5_2_1I1R12CertificateIndex a)).input +lemma CB5_2_1I1R12P_check : ∀ a : Fin 6, contains (CB5_2_1I1R12Raw a) (CB5_2_1I1R12P a) = true := by + decide +kernel +lemma CB5_2_1I1R12P_sound (a : Fin 6) : + (CB5_2_1I1R12P a).Encloses (CB5_2_1I1R12Value a) := + contains_sound (CB5_2_1I1R12Raw_sound a) (CB5_2_1I1R12P_check a) +def CB5_2_1I1R12Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB5_2_1I1R12Certificates (CB5_2_1I1R12CertificateIndex a)).output +lemma CB5_2_1I1R12Terms_sound (a : Fin 6) : + (CB5_2_1I1R12Terms a).Encloses (Foundation.entropyTerm (CB5_2_1I1R12Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB5_2_1I1R12Certificates_valid + (CB5_2_1I1R12CertificateIndex a) (CB5_2_1I1R12P_sound a) +def CB5_2_1I1R12Entropy : Ball := ⟨0, 0⟩ +lemma CB5_2_1I1R12Entropy_sound : CB5_2_1I1R12Entropy.Encloses (Foundation.finiteEntropy CB5_2_1I1R12Value) := by + exact contains_sound (entropyFin_enclosed 6 CB5_2_1I1R12Value CB5_2_1I1R12Terms CB5_2_1I1R12Terms_sound) (by decide +kernel) +def CB5_2_1I1R12Mass : Ball := ⟨0, 0⟩ +lemma CB5_2_1I1R12Mass_sound : CB5_2_1I1R12Mass.Encloses (∑ a, CB5_2_1I1R12Value a) := by + exact contains_sound (finSumBall_sound 6 CB5_2_1I1R12P CB5_2_1I1R12Value CB5_2_1I1R12P_sound) (by decide +kernel) +def CB5_2_1I1R12MassTerm : Ball := .exact 0 +lemma CB5_2_1I1R12MassTerm_sound : CB5_2_1I1R12MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB5_2_1I1R12Value a))) := + entropyTerm_zero_ball (CB5_2_1I1R12Mass_sound) +def CB5_2_1I1R12H : Ball := ⟨0, 0⟩ +lemma CB5_2_1I1R12H_sound : CB5_2_1I1R12H.Encloses (homogeneousEntropy CB5_2_1I1R12Value) := by + exact contains_sound (homogeneous_enclosed CB5_2_1I1R12Value CB5_2_1I1R12MassTerm_sound CB5_2_1I1R12Entropy_sound) (by decide +kernel) +def CB5_2_1I1R13Value (a : Fin 6) : ℝ := residualLaw (below (shape 5 2 1)) (fun u => (stageBLaw (shape 5 2 1) u : ℝ)) (stageBPriority (shape 5 2 1)) 1 (fun u a => (littleLaw (shape 5 2 1) u ((stageBPriority (shape 5 2 1)) 1) a : ℝ)) 13 a +def CB5_2_1I1R13Raw (a : Fin 6) : Ball := residualBall (below (shape 5 2 1)) B5_2_1Law (stageBPriority (shape 5 2 1)) 1 (fun u => B5_2_1Little u ((stageBPriority (shape 5 2 1)) 1)) 13 a +lemma CB5_2_1I1R13Raw_sound (a : Fin 6) : + (CB5_2_1I1R13Raw a).Encloses (CB5_2_1I1R13Value a) := by + exact residualBall_sound_on (below (shape 5 2 1)) B5_2_1Law (fun u => (stageBLaw (shape 5 2 1) u : ℝ)) (stageBPriority (shape 5 2 1)) 1 (fun u => B5_2_1Little u ((stageBPriority (shape 5 2 1)) 1)) (fun u a => (littleLaw (shape 5 2 1) u ((stageBPriority (shape 5 2 1)) 1) a : ℝ)) (fun u _ => B5_2_1Law_sound u) (fun u _ a => B5_2_1Little_sound u ((stageBPriority (shape 5 2 1)) 1) a) 13 a +def CB5_2_1I1R13Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB5_2_1I1R13Certificates_valid : + CB5_2_1I1R13Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB5_2_1I1R13CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB5_2_1I1R13P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB5_2_1I1R13Certificates (CB5_2_1I1R13CertificateIndex a)).input +lemma CB5_2_1I1R13P_check : ∀ a : Fin 6, contains (CB5_2_1I1R13Raw a) (CB5_2_1I1R13P a) = true := by + decide +kernel +lemma CB5_2_1I1R13P_sound (a : Fin 6) : + (CB5_2_1I1R13P a).Encloses (CB5_2_1I1R13Value a) := + contains_sound (CB5_2_1I1R13Raw_sound a) (CB5_2_1I1R13P_check a) +def CB5_2_1I1R13Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB5_2_1I1R13Certificates (CB5_2_1I1R13CertificateIndex a)).output +lemma CB5_2_1I1R13Terms_sound (a : Fin 6) : + (CB5_2_1I1R13Terms a).Encloses (Foundation.entropyTerm (CB5_2_1I1R13Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB5_2_1I1R13Certificates_valid + (CB5_2_1I1R13CertificateIndex a) (CB5_2_1I1R13P_sound a) +def CB5_2_1I1R13Entropy : Ball := ⟨0, 0⟩ +lemma CB5_2_1I1R13Entropy_sound : CB5_2_1I1R13Entropy.Encloses (Foundation.finiteEntropy CB5_2_1I1R13Value) := by + exact contains_sound (entropyFin_enclosed 6 CB5_2_1I1R13Value CB5_2_1I1R13Terms CB5_2_1I1R13Terms_sound) (by decide +kernel) +def CB5_2_1I1R13Mass : Ball := ⟨0, 0⟩ +lemma CB5_2_1I1R13Mass_sound : CB5_2_1I1R13Mass.Encloses (∑ a, CB5_2_1I1R13Value a) := by + exact contains_sound (finSumBall_sound 6 CB5_2_1I1R13P CB5_2_1I1R13Value CB5_2_1I1R13P_sound) (by decide +kernel) +def CB5_2_1I1R13MassTerm : Ball := .exact 0 +lemma CB5_2_1I1R13MassTerm_sound : CB5_2_1I1R13MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB5_2_1I1R13Value a))) := + entropyTerm_zero_ball (CB5_2_1I1R13Mass_sound) +def CB5_2_1I1R13H : Ball := ⟨0, 0⟩ +lemma CB5_2_1I1R13H_sound : CB5_2_1I1R13H.Encloses (homogeneousEntropy CB5_2_1I1R13Value) := by + exact contains_sound (homogeneous_enclosed CB5_2_1I1R13Value CB5_2_1I1R13MassTerm_sound CB5_2_1I1R13Entropy_sound) (by decide +kernel) +def CB5_2_1I1R14Value (a : Fin 6) : ℝ := residualLaw (below (shape 5 2 1)) (fun u => (stageBLaw (shape 5 2 1) u : ℝ)) (stageBPriority (shape 5 2 1)) 1 (fun u a => (littleLaw (shape 5 2 1) u ((stageBPriority (shape 5 2 1)) 1) a : ℝ)) 14 a +def CB5_2_1I1R14Raw (a : Fin 6) : Ball := residualBall (below (shape 5 2 1)) B5_2_1Law (stageBPriority (shape 5 2 1)) 1 (fun u => B5_2_1Little u ((stageBPriority (shape 5 2 1)) 1)) 14 a +lemma CB5_2_1I1R14Raw_sound (a : Fin 6) : + (CB5_2_1I1R14Raw a).Encloses (CB5_2_1I1R14Value a) := by + exact residualBall_sound_on (below (shape 5 2 1)) B5_2_1Law (fun u => (stageBLaw (shape 5 2 1) u : ℝ)) (stageBPriority (shape 5 2 1)) 1 (fun u => B5_2_1Little u ((stageBPriority (shape 5 2 1)) 1)) (fun u a => (littleLaw (shape 5 2 1) u ((stageBPriority (shape 5 2 1)) 1) a : ℝ)) (fun u _ => B5_2_1Law_sound u) (fun u _ a => B5_2_1Little_sound u ((stageBPriority (shape 5 2 1)) 1) a) 14 a +def CB5_2_1I1R14Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB5_2_1I1R14Certificates_valid : + CB5_2_1I1R14Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB5_2_1I1R14CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB5_2_1I1R14P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB5_2_1I1R14Certificates (CB5_2_1I1R14CertificateIndex a)).input +lemma CB5_2_1I1R14P_check : ∀ a : Fin 6, contains (CB5_2_1I1R14Raw a) (CB5_2_1I1R14P a) = true := by + decide +kernel +lemma CB5_2_1I1R14P_sound (a : Fin 6) : + (CB5_2_1I1R14P a).Encloses (CB5_2_1I1R14Value a) := + contains_sound (CB5_2_1I1R14Raw_sound a) (CB5_2_1I1R14P_check a) +def CB5_2_1I1R14Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB5_2_1I1R14Certificates (CB5_2_1I1R14CertificateIndex a)).output +lemma CB5_2_1I1R14Terms_sound (a : Fin 6) : + (CB5_2_1I1R14Terms a).Encloses (Foundation.entropyTerm (CB5_2_1I1R14Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB5_2_1I1R14Certificates_valid + (CB5_2_1I1R14CertificateIndex a) (CB5_2_1I1R14P_sound a) +def CB5_2_1I1R14Entropy : Ball := ⟨0, 0⟩ +lemma CB5_2_1I1R14Entropy_sound : CB5_2_1I1R14Entropy.Encloses (Foundation.finiteEntropy CB5_2_1I1R14Value) := by + exact contains_sound (entropyFin_enclosed 6 CB5_2_1I1R14Value CB5_2_1I1R14Terms CB5_2_1I1R14Terms_sound) (by decide +kernel) +def CB5_2_1I1R14Mass : Ball := ⟨0, 0⟩ +lemma CB5_2_1I1R14Mass_sound : CB5_2_1I1R14Mass.Encloses (∑ a, CB5_2_1I1R14Value a) := by + exact contains_sound (finSumBall_sound 6 CB5_2_1I1R14P CB5_2_1I1R14Value CB5_2_1I1R14P_sound) (by decide +kernel) +def CB5_2_1I1R14MassTerm : Ball := .exact 0 +lemma CB5_2_1I1R14MassTerm_sound : CB5_2_1I1R14MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB5_2_1I1R14Value a))) := + entropyTerm_zero_ball (CB5_2_1I1R14Mass_sound) +def CB5_2_1I1R14H : Ball := ⟨0, 0⟩ +lemma CB5_2_1I1R14H_sound : CB5_2_1I1R14H.Encloses (homogeneousEntropy CB5_2_1I1R14Value) := by + exact contains_sound (homogeneous_enclosed CB5_2_1I1R14Value CB5_2_1I1R14MassTerm_sound CB5_2_1I1R14Entropy_sound) (by decide +kernel) +def CB5_2_1I1R15Value (a : Fin 6) : ℝ := residualLaw (below (shape 5 2 1)) (fun u => (stageBLaw (shape 5 2 1) u : ℝ)) (stageBPriority (shape 5 2 1)) 1 (fun u a => (littleLaw (shape 5 2 1) u ((stageBPriority (shape 5 2 1)) 1) a : ℝ)) 15 a +def CB5_2_1I1R15Raw (a : Fin 6) : Ball := residualBall (below (shape 5 2 1)) B5_2_1Law (stageBPriority (shape 5 2 1)) 1 (fun u => B5_2_1Little u ((stageBPriority (shape 5 2 1)) 1)) 15 a +lemma CB5_2_1I1R15Raw_sound (a : Fin 6) : + (CB5_2_1I1R15Raw a).Encloses (CB5_2_1I1R15Value a) := by + exact residualBall_sound_on (below (shape 5 2 1)) B5_2_1Law (fun u => (stageBLaw (shape 5 2 1) u : ℝ)) (stageBPriority (shape 5 2 1)) 1 (fun u => B5_2_1Little u ((stageBPriority (shape 5 2 1)) 1)) (fun u a => (littleLaw (shape 5 2 1) u ((stageBPriority (shape 5 2 1)) 1) a : ℝ)) (fun u _ => B5_2_1Law_sound u) (fun u _ a => B5_2_1Little_sound u ((stageBPriority (shape 5 2 1)) 1) a) 15 a +def CB5_2_1I1R15Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB5_2_1I1R15Certificates_valid : + CB5_2_1I1R15Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB5_2_1I1R15CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB5_2_1I1R15P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB5_2_1I1R15Certificates (CB5_2_1I1R15CertificateIndex a)).input +lemma CB5_2_1I1R15P_check : ∀ a : Fin 6, contains (CB5_2_1I1R15Raw a) (CB5_2_1I1R15P a) = true := by + decide +kernel +lemma CB5_2_1I1R15P_sound (a : Fin 6) : + (CB5_2_1I1R15P a).Encloses (CB5_2_1I1R15Value a) := + contains_sound (CB5_2_1I1R15Raw_sound a) (CB5_2_1I1R15P_check a) +def CB5_2_1I1R15Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB5_2_1I1R15Certificates (CB5_2_1I1R15CertificateIndex a)).output +lemma CB5_2_1I1R15Terms_sound (a : Fin 6) : + (CB5_2_1I1R15Terms a).Encloses (Foundation.entropyTerm (CB5_2_1I1R15Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB5_2_1I1R15Certificates_valid + (CB5_2_1I1R15CertificateIndex a) (CB5_2_1I1R15P_sound a) +def CB5_2_1I1R15Entropy : Ball := ⟨0, 0⟩ +lemma CB5_2_1I1R15Entropy_sound : CB5_2_1I1R15Entropy.Encloses (Foundation.finiteEntropy CB5_2_1I1R15Value) := by + exact contains_sound (entropyFin_enclosed 6 CB5_2_1I1R15Value CB5_2_1I1R15Terms CB5_2_1I1R15Terms_sound) (by decide +kernel) +def CB5_2_1I1R15Mass : Ball := ⟨0, 0⟩ +lemma CB5_2_1I1R15Mass_sound : CB5_2_1I1R15Mass.Encloses (∑ a, CB5_2_1I1R15Value a) := by + exact contains_sound (finSumBall_sound 6 CB5_2_1I1R15P CB5_2_1I1R15Value CB5_2_1I1R15P_sound) (by decide +kernel) +def CB5_2_1I1R15MassTerm : Ball := .exact 0 +lemma CB5_2_1I1R15MassTerm_sound : CB5_2_1I1R15MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB5_2_1I1R15Value a))) := + entropyTerm_zero_ball (CB5_2_1I1R15Mass_sound) +def CB5_2_1I1R15H : Ball := ⟨0, 0⟩ +lemma CB5_2_1I1R15H_sound : CB5_2_1I1R15H.Encloses (homogeneousEntropy CB5_2_1I1R15Value) := by + exact contains_sound (homogeneous_enclosed CB5_2_1I1R15Value CB5_2_1I1R15MassTerm_sound CB5_2_1I1R15Entropy_sound) (by decide +kernel) +def CB5_2_1I1R16Value (a : Fin 6) : ℝ := residualLaw (below (shape 5 2 1)) (fun u => (stageBLaw (shape 5 2 1) u : ℝ)) (stageBPriority (shape 5 2 1)) 1 (fun u a => (littleLaw (shape 5 2 1) u ((stageBPriority (shape 5 2 1)) 1) a : ℝ)) 16 a +def CB5_2_1I1R16Raw (a : Fin 6) : Ball := residualBall (below (shape 5 2 1)) B5_2_1Law (stageBPriority (shape 5 2 1)) 1 (fun u => B5_2_1Little u ((stageBPriority (shape 5 2 1)) 1)) 16 a +lemma CB5_2_1I1R16Raw_sound (a : Fin 6) : + (CB5_2_1I1R16Raw a).Encloses (CB5_2_1I1R16Value a) := by + exact residualBall_sound_on (below (shape 5 2 1)) B5_2_1Law (fun u => (stageBLaw (shape 5 2 1) u : ℝ)) (stageBPriority (shape 5 2 1)) 1 (fun u => B5_2_1Little u ((stageBPriority (shape 5 2 1)) 1)) (fun u a => (littleLaw (shape 5 2 1) u ((stageBPriority (shape 5 2 1)) 1) a : ℝ)) (fun u _ => B5_2_1Law_sound u) (fun u _ a => B5_2_1Little_sound u ((stageBPriority (shape 5 2 1)) 1) a) 16 a +def CB5_2_1I1R16Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB5_2_1I1R16Certificates_valid : + CB5_2_1I1R16Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB5_2_1I1R16CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB5_2_1I1R16P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB5_2_1I1R16Certificates (CB5_2_1I1R16CertificateIndex a)).input +lemma CB5_2_1I1R16P_check : ∀ a : Fin 6, contains (CB5_2_1I1R16Raw a) (CB5_2_1I1R16P a) = true := by + decide +kernel +lemma CB5_2_1I1R16P_sound (a : Fin 6) : + (CB5_2_1I1R16P a).Encloses (CB5_2_1I1R16Value a) := + contains_sound (CB5_2_1I1R16Raw_sound a) (CB5_2_1I1R16P_check a) +def CB5_2_1I1R16Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB5_2_1I1R16Certificates (CB5_2_1I1R16CertificateIndex a)).output +lemma CB5_2_1I1R16Terms_sound (a : Fin 6) : + (CB5_2_1I1R16Terms a).Encloses (Foundation.entropyTerm (CB5_2_1I1R16Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB5_2_1I1R16Certificates_valid + (CB5_2_1I1R16CertificateIndex a) (CB5_2_1I1R16P_sound a) +def CB5_2_1I1R16Entropy : Ball := ⟨0, 0⟩ +lemma CB5_2_1I1R16Entropy_sound : CB5_2_1I1R16Entropy.Encloses (Foundation.finiteEntropy CB5_2_1I1R16Value) := by + exact contains_sound (entropyFin_enclosed 6 CB5_2_1I1R16Value CB5_2_1I1R16Terms CB5_2_1I1R16Terms_sound) (by decide +kernel) +def CB5_2_1I1R16Mass : Ball := ⟨0, 0⟩ +lemma CB5_2_1I1R16Mass_sound : CB5_2_1I1R16Mass.Encloses (∑ a, CB5_2_1I1R16Value a) := by + exact contains_sound (finSumBall_sound 6 CB5_2_1I1R16P CB5_2_1I1R16Value CB5_2_1I1R16P_sound) (by decide +kernel) +def CB5_2_1I1R16MassTerm : Ball := .exact 0 +lemma CB5_2_1I1R16MassTerm_sound : CB5_2_1I1R16MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB5_2_1I1R16Value a))) := + entropyTerm_zero_ball (CB5_2_1I1R16Mass_sound) +def CB5_2_1I1R16H : Ball := ⟨0, 0⟩ +lemma CB5_2_1I1R16H_sound : CB5_2_1I1R16H.Encloses (homogeneousEntropy CB5_2_1I1R16Value) := by + exact contains_sound (homogeneous_enclosed CB5_2_1I1R16Value CB5_2_1I1R16MassTerm_sound CB5_2_1I1R16Entropy_sound) (by decide +kernel) +def CB5_2_1I1ResidualEntropies (a : Fin 17) : Ball := + match a.val with + | 0 => CB5_2_1I1R0H + | 1 => CB5_2_1I1R1H + | 2 => CB5_2_1I1R2H + | 3 => CB5_2_1I1R3H + | 4 => CB5_2_1I1R4H + | 5 => CB5_2_1I1R5H + | 6 => CB5_2_1I1R6H + | 7 => CB5_2_1I1R7H + | 8 => CB5_2_1I1R8H + | 9 => CB5_2_1I1R9H + | 10 => CB5_2_1I1R10H + | 11 => CB5_2_1I1R11H + | 12 => CB5_2_1I1R12H + | 13 => CB5_2_1I1R13H + | 14 => CB5_2_1I1R14H + | 15 => CB5_2_1I1R15H + | 16 => CB5_2_1I1R16H + | _ => (.exact 0) +lemma CB5_2_1I1ResidualEntropies_sound (k : Fin 17) : + (CB5_2_1I1ResidualEntropies k).Encloses (homogeneousEntropy + (residualLaw (below (shape 5 2 1)) (fun u => (stageBLaw (shape 5 2 1) u : ℝ)) (stageBPriority (shape 5 2 1)) 1 (fun u a => (littleLaw (shape 5 2 1) u ((stageBPriority (shape 5 2 1)) 1) a : ℝ)) k)) := by + fin_cases k + · exact CB5_2_1I1R0H_sound + · exact CB5_2_1I1R1H_sound + · exact CB5_2_1I1R2H_sound + · exact CB5_2_1I1R3H_sound + · exact CB5_2_1I1R4H_sound + · exact CB5_2_1I1R5H_sound + · exact CB5_2_1I1R6H_sound + · exact CB5_2_1I1R7H_sound + · exact CB5_2_1I1R8H_sound + · exact CB5_2_1I1R9H_sound + · exact CB5_2_1I1R10H_sound + · exact CB5_2_1I1R11H_sound + · exact CB5_2_1I1R12H_sound + · exact CB5_2_1I1R13H_sound + · exact CB5_2_1I1R14H_sound + · exact CB5_2_1I1R15H_sound + · exact CB5_2_1I1R16H_sound +def CB5_2_1I1Singles (s : Shape) : Ball := + match s 0, s 1, s 2 with + | _, _, _ => (.exact 0) +lemma CB5_2_1I1Singles_sound (u : Shape) (hu : u ∈ below (shape 5 2 1)) + (hd : designated (stageBPriority (shape 5 2 1)) 1 u) : + (CB5_2_1I1Singles u).Encloses (homogeneousEntropy ((fun u a => (littleLaw (shape 5 2 1) u ((stageBPriority (shape 5 2 1)) 1) a : ℝ)) u)) := by + rw [B5_2_1_below] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl | rfl | rfl + · exact (show ¬ designated (stageBPriority (shape 5 2 1)) 1 (shape 1 2 1) by decide +kernel) hd |>.elim + · exact (show ¬ designated (stageBPriority (shape 5 2 1)) 1 (shape 2 1 1) by decide +kernel) hd |>.elim + · exact (show ¬ designated (stageBPriority (shape 5 2 1)) 1 (shape 2 2 0) by decide +kernel) hd |>.elim + · exact (show ¬ designated (stageBPriority (shape 5 2 1)) 1 (shape 3 0 1) by decide +kernel) hd |>.elim + · exact (show ¬ designated (stageBPriority (shape 5 2 1)) 1 (shape 3 1 0) by decide +kernel) hd |>.elim + · exact (show ¬ designated (stageBPriority (shape 5 2 1)) 1 (shape 4 0 0) by decide +kernel) hd |>.elim +def CB5_2_1I1Singleton : Ball := ⟨0, 0⟩ +lemma CB5_2_1I1Singleton_sound : CB5_2_1I1Singleton.Encloses + (singletonEntropy (below (shape 5 2 1)) (fun u => (stageBLaw (shape 5 2 1) u : ℝ)) (stageBPriority (shape 5 2 1)) 1 (fun u a => (littleLaw (shape 5 2 1) u ((stageBPriority (shape 5 2 1)) 1) a : ℝ))) := by + exact contains_sound (singletonBall_sound (below (shape 5 2 1)) B5_2_1Law (fun u => (stageBLaw (shape 5 2 1) u : ℝ)) (stageBPriority (shape 5 2 1)) 1 + CB5_2_1I1Singles (fun u a => (littleLaw (shape 5 2 1) u ((stageBPriority (shape 5 2 1)) 1) a : ℝ)) (fun u _ => B5_2_1Law_sound u) CB5_2_1I1Singles_sound) (by decide +kernel) +def CB5_2_1I1Group : Ball := ⟨(157726739413993165697020365651 / 2500000000000000000000000000000), (23457779459 / 20000000000000000000000000000000)⟩ +lemma CB5_2_1I1Group_sound : CB5_2_1I1Group.Encloses + (groupedEntropy (below (shape 5 2 1)) (fun u => (stageBLaw (shape 5 2 1) u : ℝ)) (stageBPriority (shape 5 2 1)) 1 (fun u a => (littleLaw (shape 5 2 1) u ((stageBPriority (shape 5 2 1)) 1) a : ℝ))) := by + exact contains_sound (Ball.add_sound CB5_2_1I1Singleton_sound + (finSumBall_sound 17 CB5_2_1I1ResidualEntropies _ CB5_2_1I1ResidualEntropies_sound)) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CB5_2_1I1H : Ball := ⟨(22879312493824239807758036168991 / 25000000000000000000000000000000), (158145904709 / 50000000000000000000000000000000)⟩ +lemma CB5_2_1I1_sound : CB5_2_1I1H.Encloses (stageBCapacity (shape 5 2 1) 1) := by + have hb := contains_sound (Ball.add_sound CB5_2_1I1PairH_sound + (Ball.neg_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) CB5_2_1I1Group_sound))) + (show contains (.add CB5_2_1I1PairH (.neg (.mul (.exact 2) CB5_2_1I1Group))) CB5_2_1I1H = true by decide +kernel) + unfold CB5_2_1I1PairValue at hb + simpa only [stageBCapacity, nativeCapacity, + show (1 : Fin 3) ≠ 0 by decide, ite_false, sub_eq_add_neg] using hb + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/CapacityB/CapB5_2_1I2.lean b/lean/OAI/LinearAlgebra/MatrixFields/CapacityB/CapB5_2_1I2.lean new file mode 100644 index 0000000000000000000000000000000000000000..9e3a623f204826a6d4169aee2fd32b65d048181e --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/CapacityB/CapB5_2_1I2.lean @@ -0,0 +1,991 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Certificates.Terminal5_2_1 + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CB5_2_1I2PairValue (a : PairSlot) : ℝ := pairLaw (below (shape 5 2 1)) (shape 5 2 1) (fun u => (stageBLaw (shape 5 2 1) u : ℝ)) (fun u a => (littleLaw (shape 5 2 1) u ((stageBPriority (shape 5 2 1)) 2) a : ℝ)) a +def CB5_2_1I2PairRaw (a : PairSlot) : Ball := pairLawBall (below (shape 5 2 1)) (shape 5 2 1) B5_2_1Law (fun u => B5_2_1Little u ((stageBPriority (shape 5 2 1)) 2)) a +lemma CB5_2_1I2PairRaw_sound (a : PairSlot) : + (CB5_2_1I2PairRaw a).Encloses (CB5_2_1I2PairValue a) := by + exact pairLawBall_sound_on (below (shape 5 2 1)) (shape 5 2 1) B5_2_1Law (fun u => (stageBLaw (shape 5 2 1) u : ℝ)) (fun u => B5_2_1Little u ((stageBPriority (shape 5 2 1)) 2)) (fun u a => (littleLaw (shape 5 2 1) u ((stageBPriority (shape 5 2 1)) 2) a : ℝ)) (fun u _ => B5_2_1Law_sound u) (fun u _ a => B5_2_1Little_sound u ((stageBPriority (shape 5 2 1)) 2) a) (fun u _ a => B5_2_1Little_sound (complement (shape 5 2 1) u) ((stageBPriority (shape 5 2 1)) 2) a) a +def CB5_2_1I2PairCertificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(357314469969927548416673592027 / 50000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ ⟨(1765548688963737013294197353 / 50000000000000000000000000000), (1361957097 / 100000000000000000000000000000000)⟩ ⟨(-386028282976899231126090684623 / 78125000000000000000000000000), (190582413567 / 100000000000000000000000000000000)⟩ ⟨-8, 357314469969927548416673592027, 195312500000000000000000000000⟩, + .log ⟨(2950462341058093169205656218569 / 6250000000000000000000000000000), (47 / 100000000000000000000000000000000)⟩ ⟨(35434796847027417166598529257081 / 100000000000000000000000000000000), (5997933167 / 20000000000000000000000000000000)⟩ ⟨(-37530978994718978903390200891973 / 50000000000000000000000000000000), (15881867787 / 25000000000000000000000000000000)⟩ ⟨-2, 2950462341058093169205656218569, 1562500000000000000000000000000⟩, + .log ⟨(1038986801565327097938076659421 / 50000000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ ⟨(8049606342952131962626332520331 / 100000000000000000000000000000000), (616039241 / 20000000000000000000000000000000)⟩ ⟨(-387377699640874925212272146653461 / 100000000000000000000000000000000), (148230765973 / 100000000000000000000000000000000)⟩ ⟨-6, 1038986801565327097938076659421, 781250000000000000000000000000⟩] +lemma CB5_2_1I2PairCertificates_valid : + CB5_2_1I2PairCertificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB5_2_1I2PairCertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 1, 5 => 1 + | 2, 4 => 2 + | 3, 4 => 3 + | 4, 2 => 2 + | 4, 3 => 3 + | 5, 1 => 1 + | _, _ => 0 +def CB5_2_1I2PairP (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CB5_2_1I2PairCertificates (CB5_2_1I2PairCertificateIndex a)).input +lemma CB5_2_1I2PairP_check : ∀ a : PairSlot, contains (CB5_2_1I2PairRaw a) (CB5_2_1I2PairP a) = true := by + decide +kernel +lemma CB5_2_1I2PairP_sound (a : PairSlot) : + (CB5_2_1I2PairP a).Encloses (CB5_2_1I2PairValue a) := + contains_sound (CB5_2_1I2PairRaw_sound a) (CB5_2_1I2PairP_check a) +def CB5_2_1I2PairTerms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CB5_2_1I2PairCertificates (CB5_2_1I2PairCertificateIndex a)).output +lemma CB5_2_1I2PairTerms_sound (a : PairSlot) : + (CB5_2_1I2PairTerms a).Encloses (Foundation.entropyTerm (CB5_2_1I2PairValue a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB5_2_1I2PairCertificates_valid + (CB5_2_1I2PairCertificateIndex a) (CB5_2_1I2PairP_sound a) +def CB5_2_1I2PairEntropy : Ball := ⟨(11753875141976755788953314120853 / 12500000000000000000000000000000), (34431819137 / 50000000000000000000000000000000)⟩ +lemma CB5_2_1I2PairEntropy_sound : CB5_2_1I2PairEntropy.Encloses (Foundation.finiteEntropy CB5_2_1I2PairValue) := by + exact contains_sound (entropyPair_enclosed CB5_2_1I2PairValue CB5_2_1I2PairTerms CB5_2_1I2PairTerms_sound) (by decide +kernel) +def CB5_2_1I2PairMass : Ball := ⟨1, (27 / 25000000000000000000000000000000)⟩ +lemma CB5_2_1I2PairMass_sound : CB5_2_1I2PairMass.Encloses (∑ a, CB5_2_1I2PairValue a) := by + exact contains_sound (pairSumBall_sound CB5_2_1I2PairP CB5_2_1I2PairValue CB5_2_1I2PairP_sound) (by decide +kernel) +def CB5_2_1I2PairMassTermLogWitness : LogWitness := ⟨0, 1, 1⟩ +def CB5_2_1I2PairMassTermLog : Ball := ⟨0, (2117582379 / 10000000000000000000000000000000)⟩ +lemma CB5_2_1I2PairMassTermLog_sound : CB5_2_1I2PairMassTermLog.Encloses (Real.log ((∑ a, CB5_2_1I2PairValue a))) := by + exact checkLog_sound logTwoBall_sound (CB5_2_1I2PairMass_sound) (w := CB5_2_1I2PairMassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB5_2_1I2PairMassTerm : Ball := ⟨0, (21175823791 / 100000000000000000000000000000000)⟩ +lemma CB5_2_1I2PairMassTerm_sound : CB5_2_1I2PairMassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB5_2_1I2PairValue a))) := by + exact contains_sound (entropyTerm_ball (CB5_2_1I2PairMass_sound) CB5_2_1I2PairMassTermLog_sound) (by decide +kernel) +def CB5_2_1I2PairH : Ball := ⟨(11753875141976755788953314120853 / 12500000000000000000000000000000), (18007892413 / 20000000000000000000000000000000)⟩ +lemma CB5_2_1I2PairH_sound : CB5_2_1I2PairH.Encloses (homogeneousEntropy CB5_2_1I2PairValue) := by + exact contains_sound (homogeneous_enclosed CB5_2_1I2PairValue CB5_2_1I2PairMassTerm_sound CB5_2_1I2PairEntropy_sound) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CB5_2_1I2R0Value (a : Fin 6) : ℝ := residualLaw (below (shape 5 2 1)) (fun u => (stageBLaw (shape 5 2 1) u : ℝ)) (stageBPriority (shape 5 2 1)) 2 (fun u a => (littleLaw (shape 5 2 1) u ((stageBPriority (shape 5 2 1)) 2) a : ℝ)) 0 a +def CB5_2_1I2R0Raw (a : Fin 6) : Ball := residualBall (below (shape 5 2 1)) B5_2_1Law (stageBPriority (shape 5 2 1)) 2 (fun u => B5_2_1Little u ((stageBPriority (shape 5 2 1)) 2)) 0 a +lemma CB5_2_1I2R0Raw_sound (a : Fin 6) : + (CB5_2_1I2R0Raw a).Encloses (CB5_2_1I2R0Value a) := by + exact residualBall_sound_on (below (shape 5 2 1)) B5_2_1Law (fun u => (stageBLaw (shape 5 2 1) u : ℝ)) (stageBPriority (shape 5 2 1)) 2 (fun u => B5_2_1Little u ((stageBPriority (shape 5 2 1)) 2)) (fun u a => (littleLaw (shape 5 2 1) u ((stageBPriority (shape 5 2 1)) 2) a : ℝ)) (fun u _ => B5_2_1Law_sound u) (fun u _ a => B5_2_1Little_sound u ((stageBPriority (shape 5 2 1)) 2) a) 0 a +def CB5_2_1I2R0Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB5_2_1I2R0Certificates_valid : + CB5_2_1I2R0Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB5_2_1I2R0CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB5_2_1I2R0P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB5_2_1I2R0Certificates (CB5_2_1I2R0CertificateIndex a)).input +lemma CB5_2_1I2R0P_check : ∀ a : Fin 6, contains (CB5_2_1I2R0Raw a) (CB5_2_1I2R0P a) = true := by + decide +kernel +lemma CB5_2_1I2R0P_sound (a : Fin 6) : + (CB5_2_1I2R0P a).Encloses (CB5_2_1I2R0Value a) := + contains_sound (CB5_2_1I2R0Raw_sound a) (CB5_2_1I2R0P_check a) +def CB5_2_1I2R0Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB5_2_1I2R0Certificates (CB5_2_1I2R0CertificateIndex a)).output +lemma CB5_2_1I2R0Terms_sound (a : Fin 6) : + (CB5_2_1I2R0Terms a).Encloses (Foundation.entropyTerm (CB5_2_1I2R0Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB5_2_1I2R0Certificates_valid + (CB5_2_1I2R0CertificateIndex a) (CB5_2_1I2R0P_sound a) +def CB5_2_1I2R0Entropy : Ball := ⟨0, 0⟩ +lemma CB5_2_1I2R0Entropy_sound : CB5_2_1I2R0Entropy.Encloses (Foundation.finiteEntropy CB5_2_1I2R0Value) := by + exact contains_sound (entropyFin_enclosed 6 CB5_2_1I2R0Value CB5_2_1I2R0Terms CB5_2_1I2R0Terms_sound) (by decide +kernel) +def CB5_2_1I2R0Mass : Ball := ⟨0, 0⟩ +lemma CB5_2_1I2R0Mass_sound : CB5_2_1I2R0Mass.Encloses (∑ a, CB5_2_1I2R0Value a) := by + exact contains_sound (finSumBall_sound 6 CB5_2_1I2R0P CB5_2_1I2R0Value CB5_2_1I2R0P_sound) (by decide +kernel) +def CB5_2_1I2R0MassTerm : Ball := .exact 0 +lemma CB5_2_1I2R0MassTerm_sound : CB5_2_1I2R0MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB5_2_1I2R0Value a))) := + entropyTerm_zero_ball (CB5_2_1I2R0Mass_sound) +def CB5_2_1I2R0H : Ball := ⟨0, 0⟩ +lemma CB5_2_1I2R0H_sound : CB5_2_1I2R0H.Encloses (homogeneousEntropy CB5_2_1I2R0Value) := by + exact contains_sound (homogeneous_enclosed CB5_2_1I2R0Value CB5_2_1I2R0MassTerm_sound CB5_2_1I2R0Entropy_sound) (by decide +kernel) +def CB5_2_1I2R1Value (a : Fin 6) : ℝ := residualLaw (below (shape 5 2 1)) (fun u => (stageBLaw (shape 5 2 1) u : ℝ)) (stageBPriority (shape 5 2 1)) 2 (fun u a => (littleLaw (shape 5 2 1) u ((stageBPriority (shape 5 2 1)) 2) a : ℝ)) 1 a +def CB5_2_1I2R1Raw (a : Fin 6) : Ball := residualBall (below (shape 5 2 1)) B5_2_1Law (stageBPriority (shape 5 2 1)) 2 (fun u => B5_2_1Little u ((stageBPriority (shape 5 2 1)) 2)) 1 a +lemma CB5_2_1I2R1Raw_sound (a : Fin 6) : + (CB5_2_1I2R1Raw a).Encloses (CB5_2_1I2R1Value a) := by + exact residualBall_sound_on (below (shape 5 2 1)) B5_2_1Law (fun u => (stageBLaw (shape 5 2 1) u : ℝ)) (stageBPriority (shape 5 2 1)) 2 (fun u => B5_2_1Little u ((stageBPriority (shape 5 2 1)) 2)) (fun u a => (littleLaw (shape 5 2 1) u ((stageBPriority (shape 5 2 1)) 2) a : ℝ)) (fun u _ => B5_2_1Law_sound u) (fun u _ a => B5_2_1Little_sound u ((stageBPriority (shape 5 2 1)) 2) a) 1 a +def CB5_2_1I2R1Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(357314469969927548416673592027 / 50000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ ⟨(1765548688963737013294197353 / 50000000000000000000000000000), (1361957097 / 100000000000000000000000000000000)⟩ ⟨(-386028282976899231126090684623 / 78125000000000000000000000000), (190582413567 / 100000000000000000000000000000000)⟩ ⟨-8, 357314469969927548416673592027, 195312500000000000000000000000⟩] +lemma CB5_2_1I2R1Certificates_valid : + CB5_2_1I2R1Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB5_2_1I2R1CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | 1 => 1 + | _ => 0 +def CB5_2_1I2R1P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB5_2_1I2R1Certificates (CB5_2_1I2R1CertificateIndex a)).input +lemma CB5_2_1I2R1P_check : ∀ a : Fin 6, contains (CB5_2_1I2R1Raw a) (CB5_2_1I2R1P a) = true := by + decide +kernel +lemma CB5_2_1I2R1P_sound (a : Fin 6) : + (CB5_2_1I2R1P a).Encloses (CB5_2_1I2R1Value a) := + contains_sound (CB5_2_1I2R1Raw_sound a) (CB5_2_1I2R1P_check a) +def CB5_2_1I2R1Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB5_2_1I2R1Certificates (CB5_2_1I2R1CertificateIndex a)).output +lemma CB5_2_1I2R1Terms_sound (a : Fin 6) : + (CB5_2_1I2R1Terms a).Encloses (Foundation.entropyTerm (CB5_2_1I2R1Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB5_2_1I2R1Certificates_valid + (CB5_2_1I2R1CertificateIndex a) (CB5_2_1I2R1P_sound a) +def CB5_2_1I2R1Entropy : Ball := ⟨(1765548688963737013294197353 / 50000000000000000000000000000), (1361957097 / 100000000000000000000000000000000)⟩ +lemma CB5_2_1I2R1Entropy_sound : CB5_2_1I2R1Entropy.Encloses (Foundation.finiteEntropy CB5_2_1I2R1Value) := by + exact contains_sound (entropyFin_enclosed 6 CB5_2_1I2R1Value CB5_2_1I2R1Terms CB5_2_1I2R1Terms_sound) (by decide +kernel) +def CB5_2_1I2R1Mass : Ball := ⟨(357314469969927548416673592027 / 50000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +lemma CB5_2_1I2R1Mass_sound : CB5_2_1I2R1Mass.Encloses (∑ a, CB5_2_1I2R1Value a) := by + exact contains_sound (finSumBall_sound 6 CB5_2_1I2R1P CB5_2_1I2R1Value CB5_2_1I2R1P_sound) (by decide +kernel) +def CB5_2_1I2R1MassTermLogWitness : LogWitness := ⟨-8, 357314469969927548416673592027, 195312500000000000000000000000⟩ +def CB5_2_1I2R1MassTermLog : Ball := ⟨(-386028282976899231126090684623 / 78125000000000000000000000000), (190582413567 / 100000000000000000000000000000000)⟩ +lemma CB5_2_1I2R1MassTermLog_sound : CB5_2_1I2R1MassTermLog.Encloses (Real.log ((∑ a, CB5_2_1I2R1Value a))) := by + exact checkLog_sound logTwoBall_sound (CB5_2_1I2R1Mass_sound) (w := CB5_2_1I2R1MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB5_2_1I2R1MassTerm : Ball := ⟨(1765548688963737013294197353 / 50000000000000000000000000000), (1361957097 / 100000000000000000000000000000000)⟩ +lemma CB5_2_1I2R1MassTerm_sound : CB5_2_1I2R1MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB5_2_1I2R1Value a))) := by + exact contains_sound (entropyTerm_ball (CB5_2_1I2R1Mass_sound) CB5_2_1I2R1MassTermLog_sound) (by decide +kernel) +def CB5_2_1I2R1H : Ball := ⟨0, (1361957097 / 50000000000000000000000000000000)⟩ +lemma CB5_2_1I2R1H_sound : CB5_2_1I2R1H.Encloses (homogeneousEntropy CB5_2_1I2R1Value) := by + exact contains_sound (homogeneous_enclosed CB5_2_1I2R1Value CB5_2_1I2R1MassTerm_sound CB5_2_1I2R1Entropy_sound) (by decide +kernel) +def CB5_2_1I2R2Value (a : Fin 6) : ℝ := residualLaw (below (shape 5 2 1)) (fun u => (stageBLaw (shape 5 2 1) u : ℝ)) (stageBPriority (shape 5 2 1)) 2 (fun u a => (littleLaw (shape 5 2 1) u ((stageBPriority (shape 5 2 1)) 2) a : ℝ)) 2 a +def CB5_2_1I2R2Raw (a : Fin 6) : Ball := residualBall (below (shape 5 2 1)) B5_2_1Law (stageBPriority (shape 5 2 1)) 2 (fun u => B5_2_1Little u ((stageBPriority (shape 5 2 1)) 2)) 2 a +lemma CB5_2_1I2R2Raw_sound (a : Fin 6) : + (CB5_2_1I2R2Raw a).Encloses (CB5_2_1I2R2Value a) := by + exact residualBall_sound_on (below (shape 5 2 1)) B5_2_1Law (fun u => (stageBLaw (shape 5 2 1) u : ℝ)) (stageBPriority (shape 5 2 1)) 2 (fun u => B5_2_1Little u ((stageBPriority (shape 5 2 1)) 2)) (fun u a => (littleLaw (shape 5 2 1) u ((stageBPriority (shape 5 2 1)) 2) a : ℝ)) (fun u _ => B5_2_1Law_sound u) (fun u _ a => B5_2_1Little_sound u ((stageBPriority (shape 5 2 1)) 2) a) 2 a +def CB5_2_1I2R2Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(31389291360282303794266717453669 / 100000000000000000000000000000000), (17 / 100000000000000000000000000000000)⟩ ⟨(909271958288411609593400969681 / 2500000000000000000000000000000), (19940823019 / 100000000000000000000000000000000)⟩ ⟨(-115870339072252818198395155685549 / 100000000000000000000000000000000), (63527471103 / 100000000000000000000000000000000)⟩ ⟨-2, 31389291360282303794266717453669, 25000000000000000000000000000000⟩, + .log ⟨(120809727570828910791192024941 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ ⟨(162337072483012858063204652021 / 20000000000000000000000000000000), (70351753 / 25000000000000000000000000000000)⟩ ⟨(-26874834625851977830357946977153 / 4000000000000000000000000000000), (11646703067 / 5000000000000000000000000000000)⟩ ⟨-10, 120809727570828910791192024941, 97656250000000000000000000000⟩] +lemma CB5_2_1I2R2Certificates_valid : + CB5_2_1I2R2Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB5_2_1I2R2CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | 2 => 1 + | 3 => 2 + | _ => 0 +def CB5_2_1I2R2P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB5_2_1I2R2Certificates (CB5_2_1I2R2CertificateIndex a)).input +lemma CB5_2_1I2R2P_check : ∀ a : Fin 6, contains (CB5_2_1I2R2Raw a) (CB5_2_1I2R2P a) = true := by + decide +kernel +lemma CB5_2_1I2R2P_sound (a : Fin 6) : + (CB5_2_1I2R2P a).Encloses (CB5_2_1I2R2Value a) := + contains_sound (CB5_2_1I2R2Raw_sound a) (CB5_2_1I2R2P_check a) +def CB5_2_1I2R2Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB5_2_1I2R2Certificates (CB5_2_1I2R2CertificateIndex a)).output +lemma CB5_2_1I2R2Terms_sound (a : Fin 6) : + (CB5_2_1I2R2Terms a).Encloses (Foundation.entropyTerm (CB5_2_1I2R2Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB5_2_1I2R2Certificates_valid + (CB5_2_1I2R2CertificateIndex a) (CB5_2_1I2R2P_sound a) +def CB5_2_1I2R2Entropy : Ball := ⟨(7436512738790305734810412409469 / 20000000000000000000000000000000), (20222230031 / 100000000000000000000000000000000)⟩ +lemma CB5_2_1I2R2Entropy_sound : CB5_2_1I2R2Entropy.Encloses (Foundation.finiteEntropy CB5_2_1I2R2Value) := by + exact contains_sound (entropyFin_enclosed 6 CB5_2_1I2R2Value CB5_2_1I2R2Terms CB5_2_1I2R2Terms_sound) (by decide +kernel) +def CB5_2_1I2R2Mass : Ball := ⟨(3151010108785313270505790947861 / 10000000000000000000000000000000), (9 / 50000000000000000000000000000000)⟩ +lemma CB5_2_1I2R2Mass_sound : CB5_2_1I2R2Mass.Encloses (∑ a, CB5_2_1I2R2Value a) := by + exact contains_sound (finSumBall_sound 6 CB5_2_1I2R2P CB5_2_1I2R2Value CB5_2_1I2R2P_sound) (by decide +kernel) +def CB5_2_1I2R2MassTermLogWitness : LogWitness := ⟨-2, 3151010108785313270505790947861, 2500000000000000000000000000000⟩ +def CB5_2_1I2R2MassTermLog : Ball := ⟨(-57743101105215507920698095427997 / 50000000000000000000000000000000), (31763735553 / 50000000000000000000000000000000)⟩ +lemma CB5_2_1I2R2MassTermLog_sound : CB5_2_1I2R2MassTermLog.Encloses (Real.log ((∑ a, CB5_2_1I2R2Value a))) := by + exact checkLog_sound logTwoBall_sound (CB5_2_1I2R2Mass_sound) (w := CB5_2_1I2R2MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB5_2_1I2R2MassTerm : Ball := ⟨(2274363691189330756931963794129 / 6250000000000000000000000000000), (10008785193 / 50000000000000000000000000000000)⟩ +lemma CB5_2_1I2R2MassTerm_sound : CB5_2_1I2R2MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB5_2_1I2R2Value a))) := by + exact contains_sound (entropyTerm_ball (CB5_2_1I2R2Mass_sound) CB5_2_1I2R2MassTermLog_sound) (by decide +kernel) +def CB5_2_1I2R2H : Ball := ⟨(792744634922236563140641341281 / 100000000000000000000000000000000), (40239800417 / 100000000000000000000000000000000)⟩ +lemma CB5_2_1I2R2H_sound : CB5_2_1I2R2H.Encloses (homogeneousEntropy CB5_2_1I2R2Value) := by + exact contains_sound (homogeneous_enclosed CB5_2_1I2R2Value CB5_2_1I2R2MassTerm_sound CB5_2_1I2R2Entropy_sound) (by decide +kernel) +def CB5_2_1I2R3Value (a : Fin 6) : ℝ := residualLaw (below (shape 5 2 1)) (fun u => (stageBLaw (shape 5 2 1) u : ℝ)) (stageBPriority (shape 5 2 1)) 2 (fun u a => (littleLaw (shape 5 2 1) u ((stageBPriority (shape 5 2 1)) 2) a : ℝ)) 3 a +def CB5_2_1I2R3Raw (a : Fin 6) : Ball := residualBall (below (shape 5 2 1)) B5_2_1Law (stageBPriority (shape 5 2 1)) 2 (fun u => B5_2_1Little u ((stageBPriority (shape 5 2 1)) 2)) 3 a +lemma CB5_2_1I2R3Raw_sound (a : Fin 6) : + (CB5_2_1I2R3Raw a).Encloses (CB5_2_1I2R3Value a) := by + exact residualBall_sound_on (below (shape 5 2 1)) B5_2_1Law (fun u => (stageBLaw (shape 5 2 1) u : ℝ)) (stageBPriority (shape 5 2 1)) 2 (fun u => B5_2_1Little u ((stageBPriority (shape 5 2 1)) 2)) (fun u a => (littleLaw (shape 5 2 1) u ((stageBPriority (shape 5 2 1)) 2) a : ℝ)) (fun u _ => B5_2_1Law_sound u) (fun u _ a => B5_2_1Little_sound u ((stageBPriority (shape 5 2 1)) 2) a) 3 a +def CB5_2_1I2R3Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB5_2_1I2R3Certificates_valid : + CB5_2_1I2R3Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB5_2_1I2R3CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB5_2_1I2R3P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB5_2_1I2R3Certificates (CB5_2_1I2R3CertificateIndex a)).input +lemma CB5_2_1I2R3P_check : ∀ a : Fin 6, contains (CB5_2_1I2R3Raw a) (CB5_2_1I2R3P a) = true := by + decide +kernel +lemma CB5_2_1I2R3P_sound (a : Fin 6) : + (CB5_2_1I2R3P a).Encloses (CB5_2_1I2R3Value a) := + contains_sound (CB5_2_1I2R3Raw_sound a) (CB5_2_1I2R3P_check a) +def CB5_2_1I2R3Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB5_2_1I2R3Certificates (CB5_2_1I2R3CertificateIndex a)).output +lemma CB5_2_1I2R3Terms_sound (a : Fin 6) : + (CB5_2_1I2R3Terms a).Encloses (Foundation.entropyTerm (CB5_2_1I2R3Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB5_2_1I2R3Certificates_valid + (CB5_2_1I2R3CertificateIndex a) (CB5_2_1I2R3P_sound a) +def CB5_2_1I2R3Entropy : Ball := ⟨0, 0⟩ +lemma CB5_2_1I2R3Entropy_sound : CB5_2_1I2R3Entropy.Encloses (Foundation.finiteEntropy CB5_2_1I2R3Value) := by + exact contains_sound (entropyFin_enclosed 6 CB5_2_1I2R3Value CB5_2_1I2R3Terms CB5_2_1I2R3Terms_sound) (by decide +kernel) +def CB5_2_1I2R3Mass : Ball := ⟨0, 0⟩ +lemma CB5_2_1I2R3Mass_sound : CB5_2_1I2R3Mass.Encloses (∑ a, CB5_2_1I2R3Value a) := by + exact contains_sound (finSumBall_sound 6 CB5_2_1I2R3P CB5_2_1I2R3Value CB5_2_1I2R3P_sound) (by decide +kernel) +def CB5_2_1I2R3MassTerm : Ball := .exact 0 +lemma CB5_2_1I2R3MassTerm_sound : CB5_2_1I2R3MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB5_2_1I2R3Value a))) := + entropyTerm_zero_ball (CB5_2_1I2R3Mass_sound) +def CB5_2_1I2R3H : Ball := ⟨0, 0⟩ +lemma CB5_2_1I2R3H_sound : CB5_2_1I2R3H.Encloses (homogeneousEntropy CB5_2_1I2R3Value) := by + exact contains_sound (homogeneous_enclosed CB5_2_1I2R3Value CB5_2_1I2R3MassTerm_sound CB5_2_1I2R3Entropy_sound) (by decide +kernel) +def CB5_2_1I2R4Value (a : Fin 6) : ℝ := residualLaw (below (shape 5 2 1)) (fun u => (stageBLaw (shape 5 2 1) u : ℝ)) (stageBPriority (shape 5 2 1)) 2 (fun u a => (littleLaw (shape 5 2 1) u ((stageBPriority (shape 5 2 1)) 2) a : ℝ)) 4 a +def CB5_2_1I2R4Raw (a : Fin 6) : Ball := residualBall (below (shape 5 2 1)) B5_2_1Law (stageBPriority (shape 5 2 1)) 2 (fun u => B5_2_1Little u ((stageBPriority (shape 5 2 1)) 2)) 4 a +lemma CB5_2_1I2R4Raw_sound (a : Fin 6) : + (CB5_2_1I2R4Raw a).Encloses (CB5_2_1I2R4Value a) := by + exact residualBall_sound_on (below (shape 5 2 1)) B5_2_1Law (fun u => (stageBLaw (shape 5 2 1) u : ℝ)) (stageBPriority (shape 5 2 1)) 2 (fun u => B5_2_1Little u ((stageBPriority (shape 5 2 1)) 2)) (fun u a => (littleLaw (shape 5 2 1) u ((stageBPriority (shape 5 2 1)) 2) a : ℝ)) (fun u _ => B5_2_1Law_sound u) (fun u _ a => B5_2_1Little_sound u ((stageBPriority (shape 5 2 1)) 2) a) 4 a +def CB5_2_1I2R4Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB5_2_1I2R4Certificates_valid : + CB5_2_1I2R4Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB5_2_1I2R4CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB5_2_1I2R4P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB5_2_1I2R4Certificates (CB5_2_1I2R4CertificateIndex a)).input +lemma CB5_2_1I2R4P_check : ∀ a : Fin 6, contains (CB5_2_1I2R4Raw a) (CB5_2_1I2R4P a) = true := by + decide +kernel +lemma CB5_2_1I2R4P_sound (a : Fin 6) : + (CB5_2_1I2R4P a).Encloses (CB5_2_1I2R4Value a) := + contains_sound (CB5_2_1I2R4Raw_sound a) (CB5_2_1I2R4P_check a) +def CB5_2_1I2R4Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB5_2_1I2R4Certificates (CB5_2_1I2R4CertificateIndex a)).output +lemma CB5_2_1I2R4Terms_sound (a : Fin 6) : + (CB5_2_1I2R4Terms a).Encloses (Foundation.entropyTerm (CB5_2_1I2R4Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB5_2_1I2R4Certificates_valid + (CB5_2_1I2R4CertificateIndex a) (CB5_2_1I2R4P_sound a) +def CB5_2_1I2R4Entropy : Ball := ⟨0, 0⟩ +lemma CB5_2_1I2R4Entropy_sound : CB5_2_1I2R4Entropy.Encloses (Foundation.finiteEntropy CB5_2_1I2R4Value) := by + exact contains_sound (entropyFin_enclosed 6 CB5_2_1I2R4Value CB5_2_1I2R4Terms CB5_2_1I2R4Terms_sound) (by decide +kernel) +def CB5_2_1I2R4Mass : Ball := ⟨0, 0⟩ +lemma CB5_2_1I2R4Mass_sound : CB5_2_1I2R4Mass.Encloses (∑ a, CB5_2_1I2R4Value a) := by + exact contains_sound (finSumBall_sound 6 CB5_2_1I2R4P CB5_2_1I2R4Value CB5_2_1I2R4P_sound) (by decide +kernel) +def CB5_2_1I2R4MassTerm : Ball := .exact 0 +lemma CB5_2_1I2R4MassTerm_sound : CB5_2_1I2R4MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB5_2_1I2R4Value a))) := + entropyTerm_zero_ball (CB5_2_1I2R4Mass_sound) +def CB5_2_1I2R4H : Ball := ⟨0, 0⟩ +lemma CB5_2_1I2R4H_sound : CB5_2_1I2R4H.Encloses (homogeneousEntropy CB5_2_1I2R4Value) := by + exact contains_sound (homogeneous_enclosed CB5_2_1I2R4Value CB5_2_1I2R4MassTerm_sound CB5_2_1I2R4Entropy_sound) (by decide +kernel) +def CB5_2_1I2R5Value (a : Fin 6) : ℝ := residualLaw (below (shape 5 2 1)) (fun u => (stageBLaw (shape 5 2 1) u : ℝ)) (stageBPriority (shape 5 2 1)) 2 (fun u a => (littleLaw (shape 5 2 1) u ((stageBPriority (shape 5 2 1)) 2) a : ℝ)) 5 a +def CB5_2_1I2R5Raw (a : Fin 6) : Ball := residualBall (below (shape 5 2 1)) B5_2_1Law (stageBPriority (shape 5 2 1)) 2 (fun u => B5_2_1Little u ((stageBPriority (shape 5 2 1)) 2)) 5 a +lemma CB5_2_1I2R5Raw_sound (a : Fin 6) : + (CB5_2_1I2R5Raw a).Encloses (CB5_2_1I2R5Value a) := by + exact residualBall_sound_on (below (shape 5 2 1)) B5_2_1Law (fun u => (stageBLaw (shape 5 2 1) u : ℝ)) (stageBPriority (shape 5 2 1)) 2 (fun u => B5_2_1Little u ((stageBPriority (shape 5 2 1)) 2)) (fun u a => (littleLaw (shape 5 2 1) u ((stageBPriority (shape 5 2 1)) 2) a : ℝ)) (fun u _ => B5_2_1Law_sound u) (fun u _ a => B5_2_1Little_sound u ((stageBPriority (shape 5 2 1)) 2) a) 5 a +def CB5_2_1I2R5Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB5_2_1I2R5Certificates_valid : + CB5_2_1I2R5Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB5_2_1I2R5CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB5_2_1I2R5P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB5_2_1I2R5Certificates (CB5_2_1I2R5CertificateIndex a)).input +lemma CB5_2_1I2R5P_check : ∀ a : Fin 6, contains (CB5_2_1I2R5Raw a) (CB5_2_1I2R5P a) = true := by + decide +kernel +lemma CB5_2_1I2R5P_sound (a : Fin 6) : + (CB5_2_1I2R5P a).Encloses (CB5_2_1I2R5Value a) := + contains_sound (CB5_2_1I2R5Raw_sound a) (CB5_2_1I2R5P_check a) +def CB5_2_1I2R5Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB5_2_1I2R5Certificates (CB5_2_1I2R5CertificateIndex a)).output +lemma CB5_2_1I2R5Terms_sound (a : Fin 6) : + (CB5_2_1I2R5Terms a).Encloses (Foundation.entropyTerm (CB5_2_1I2R5Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB5_2_1I2R5Certificates_valid + (CB5_2_1I2R5CertificateIndex a) (CB5_2_1I2R5P_sound a) +def CB5_2_1I2R5Entropy : Ball := ⟨0, 0⟩ +lemma CB5_2_1I2R5Entropy_sound : CB5_2_1I2R5Entropy.Encloses (Foundation.finiteEntropy CB5_2_1I2R5Value) := by + exact contains_sound (entropyFin_enclosed 6 CB5_2_1I2R5Value CB5_2_1I2R5Terms CB5_2_1I2R5Terms_sound) (by decide +kernel) +def CB5_2_1I2R5Mass : Ball := ⟨0, 0⟩ +lemma CB5_2_1I2R5Mass_sound : CB5_2_1I2R5Mass.Encloses (∑ a, CB5_2_1I2R5Value a) := by + exact contains_sound (finSumBall_sound 6 CB5_2_1I2R5P CB5_2_1I2R5Value CB5_2_1I2R5P_sound) (by decide +kernel) +def CB5_2_1I2R5MassTerm : Ball := .exact 0 +lemma CB5_2_1I2R5MassTerm_sound : CB5_2_1I2R5MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB5_2_1I2R5Value a))) := + entropyTerm_zero_ball (CB5_2_1I2R5Mass_sound) +def CB5_2_1I2R5H : Ball := ⟨0, 0⟩ +lemma CB5_2_1I2R5H_sound : CB5_2_1I2R5H.Encloses (homogeneousEntropy CB5_2_1I2R5Value) := by + exact contains_sound (homogeneous_enclosed CB5_2_1I2R5Value CB5_2_1I2R5MassTerm_sound CB5_2_1I2R5Entropy_sound) (by decide +kernel) +def CB5_2_1I2R6Value (a : Fin 6) : ℝ := residualLaw (below (shape 5 2 1)) (fun u => (stageBLaw (shape 5 2 1) u : ℝ)) (stageBPriority (shape 5 2 1)) 2 (fun u a => (littleLaw (shape 5 2 1) u ((stageBPriority (shape 5 2 1)) 2) a : ℝ)) 6 a +def CB5_2_1I2R6Raw (a : Fin 6) : Ball := residualBall (below (shape 5 2 1)) B5_2_1Law (stageBPriority (shape 5 2 1)) 2 (fun u => B5_2_1Little u ((stageBPriority (shape 5 2 1)) 2)) 6 a +lemma CB5_2_1I2R6Raw_sound (a : Fin 6) : + (CB5_2_1I2R6Raw a).Encloses (CB5_2_1I2R6Value a) := by + exact residualBall_sound_on (below (shape 5 2 1)) B5_2_1Law (fun u => (stageBLaw (shape 5 2 1) u : ℝ)) (stageBPriority (shape 5 2 1)) 2 (fun u => B5_2_1Little u ((stageBPriority (shape 5 2 1)) 2)) (fun u a => (littleLaw (shape 5 2 1) u ((stageBPriority (shape 5 2 1)) 2) a : ℝ)) (fun u _ => B5_2_1Law_sound u) (fun u _ a => B5_2_1Little_sound u ((stageBPriority (shape 5 2 1)) 2) a) 6 a +def CB5_2_1I2R6Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB5_2_1I2R6Certificates_valid : + CB5_2_1I2R6Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB5_2_1I2R6CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB5_2_1I2R6P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB5_2_1I2R6Certificates (CB5_2_1I2R6CertificateIndex a)).input +lemma CB5_2_1I2R6P_check : ∀ a : Fin 6, contains (CB5_2_1I2R6Raw a) (CB5_2_1I2R6P a) = true := by + decide +kernel +lemma CB5_2_1I2R6P_sound (a : Fin 6) : + (CB5_2_1I2R6P a).Encloses (CB5_2_1I2R6Value a) := + contains_sound (CB5_2_1I2R6Raw_sound a) (CB5_2_1I2R6P_check a) +def CB5_2_1I2R6Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB5_2_1I2R6Certificates (CB5_2_1I2R6CertificateIndex a)).output +lemma CB5_2_1I2R6Terms_sound (a : Fin 6) : + (CB5_2_1I2R6Terms a).Encloses (Foundation.entropyTerm (CB5_2_1I2R6Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB5_2_1I2R6Certificates_valid + (CB5_2_1I2R6CertificateIndex a) (CB5_2_1I2R6P_sound a) +def CB5_2_1I2R6Entropy : Ball := ⟨0, 0⟩ +lemma CB5_2_1I2R6Entropy_sound : CB5_2_1I2R6Entropy.Encloses (Foundation.finiteEntropy CB5_2_1I2R6Value) := by + exact contains_sound (entropyFin_enclosed 6 CB5_2_1I2R6Value CB5_2_1I2R6Terms CB5_2_1I2R6Terms_sound) (by decide +kernel) +def CB5_2_1I2R6Mass : Ball := ⟨0, 0⟩ +lemma CB5_2_1I2R6Mass_sound : CB5_2_1I2R6Mass.Encloses (∑ a, CB5_2_1I2R6Value a) := by + exact contains_sound (finSumBall_sound 6 CB5_2_1I2R6P CB5_2_1I2R6Value CB5_2_1I2R6P_sound) (by decide +kernel) +def CB5_2_1I2R6MassTerm : Ball := .exact 0 +lemma CB5_2_1I2R6MassTerm_sound : CB5_2_1I2R6MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB5_2_1I2R6Value a))) := + entropyTerm_zero_ball (CB5_2_1I2R6Mass_sound) +def CB5_2_1I2R6H : Ball := ⟨0, 0⟩ +lemma CB5_2_1I2R6H_sound : CB5_2_1I2R6H.Encloses (homogeneousEntropy CB5_2_1I2R6Value) := by + exact contains_sound (homogeneous_enclosed CB5_2_1I2R6Value CB5_2_1I2R6MassTerm_sound CB5_2_1I2R6Entropy_sound) (by decide +kernel) +def CB5_2_1I2R7Value (a : Fin 6) : ℝ := residualLaw (below (shape 5 2 1)) (fun u => (stageBLaw (shape 5 2 1) u : ℝ)) (stageBPriority (shape 5 2 1)) 2 (fun u a => (littleLaw (shape 5 2 1) u ((stageBPriority (shape 5 2 1)) 2) a : ℝ)) 7 a +def CB5_2_1I2R7Raw (a : Fin 6) : Ball := residualBall (below (shape 5 2 1)) B5_2_1Law (stageBPriority (shape 5 2 1)) 2 (fun u => B5_2_1Little u ((stageBPriority (shape 5 2 1)) 2)) 7 a +lemma CB5_2_1I2R7Raw_sound (a : Fin 6) : + (CB5_2_1I2R7Raw a).Encloses (CB5_2_1I2R7Value a) := by + exact residualBall_sound_on (below (shape 5 2 1)) B5_2_1Law (fun u => (stageBLaw (shape 5 2 1) u : ℝ)) (stageBPriority (shape 5 2 1)) 2 (fun u => B5_2_1Little u ((stageBPriority (shape 5 2 1)) 2)) (fun u a => (littleLaw (shape 5 2 1) u ((stageBPriority (shape 5 2 1)) 2) a : ℝ)) (fun u _ => B5_2_1Law_sound u) (fun u _ a => B5_2_1Little_sound u ((stageBPriority (shape 5 2 1)) 2) a) 7 a +def CB5_2_1I2R7Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB5_2_1I2R7Certificates_valid : + CB5_2_1I2R7Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB5_2_1I2R7CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB5_2_1I2R7P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB5_2_1I2R7Certificates (CB5_2_1I2R7CertificateIndex a)).input +lemma CB5_2_1I2R7P_check : ∀ a : Fin 6, contains (CB5_2_1I2R7Raw a) (CB5_2_1I2R7P a) = true := by + decide +kernel +lemma CB5_2_1I2R7P_sound (a : Fin 6) : + (CB5_2_1I2R7P a).Encloses (CB5_2_1I2R7Value a) := + contains_sound (CB5_2_1I2R7Raw_sound a) (CB5_2_1I2R7P_check a) +def CB5_2_1I2R7Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB5_2_1I2R7Certificates (CB5_2_1I2R7CertificateIndex a)).output +lemma CB5_2_1I2R7Terms_sound (a : Fin 6) : + (CB5_2_1I2R7Terms a).Encloses (Foundation.entropyTerm (CB5_2_1I2R7Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB5_2_1I2R7Certificates_valid + (CB5_2_1I2R7CertificateIndex a) (CB5_2_1I2R7P_sound a) +def CB5_2_1I2R7Entropy : Ball := ⟨0, 0⟩ +lemma CB5_2_1I2R7Entropy_sound : CB5_2_1I2R7Entropy.Encloses (Foundation.finiteEntropy CB5_2_1I2R7Value) := by + exact contains_sound (entropyFin_enclosed 6 CB5_2_1I2R7Value CB5_2_1I2R7Terms CB5_2_1I2R7Terms_sound) (by decide +kernel) +def CB5_2_1I2R7Mass : Ball := ⟨0, 0⟩ +lemma CB5_2_1I2R7Mass_sound : CB5_2_1I2R7Mass.Encloses (∑ a, CB5_2_1I2R7Value a) := by + exact contains_sound (finSumBall_sound 6 CB5_2_1I2R7P CB5_2_1I2R7Value CB5_2_1I2R7P_sound) (by decide +kernel) +def CB5_2_1I2R7MassTerm : Ball := .exact 0 +lemma CB5_2_1I2R7MassTerm_sound : CB5_2_1I2R7MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB5_2_1I2R7Value a))) := + entropyTerm_zero_ball (CB5_2_1I2R7Mass_sound) +def CB5_2_1I2R7H : Ball := ⟨0, 0⟩ +lemma CB5_2_1I2R7H_sound : CB5_2_1I2R7H.Encloses (homogeneousEntropy CB5_2_1I2R7Value) := by + exact contains_sound (homogeneous_enclosed CB5_2_1I2R7Value CB5_2_1I2R7MassTerm_sound CB5_2_1I2R7Entropy_sound) (by decide +kernel) +def CB5_2_1I2R8Value (a : Fin 6) : ℝ := residualLaw (below (shape 5 2 1)) (fun u => (stageBLaw (shape 5 2 1) u : ℝ)) (stageBPriority (shape 5 2 1)) 2 (fun u a => (littleLaw (shape 5 2 1) u ((stageBPriority (shape 5 2 1)) 2) a : ℝ)) 8 a +def CB5_2_1I2R8Raw (a : Fin 6) : Ball := residualBall (below (shape 5 2 1)) B5_2_1Law (stageBPriority (shape 5 2 1)) 2 (fun u => B5_2_1Little u ((stageBPriority (shape 5 2 1)) 2)) 8 a +lemma CB5_2_1I2R8Raw_sound (a : Fin 6) : + (CB5_2_1I2R8Raw a).Encloses (CB5_2_1I2R8Value a) := by + exact residualBall_sound_on (below (shape 5 2 1)) B5_2_1Law (fun u => (stageBLaw (shape 5 2 1) u : ℝ)) (stageBPriority (shape 5 2 1)) 2 (fun u => B5_2_1Little u ((stageBPriority (shape 5 2 1)) 2)) (fun u a => (littleLaw (shape 5 2 1) u ((stageBPriority (shape 5 2 1)) 2) a : ℝ)) (fun u _ => B5_2_1Law_sound u) (fun u _ a => B5_2_1Little_sound u ((stageBPriority (shape 5 2 1)) 2) a) 8 a +def CB5_2_1I2R8Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB5_2_1I2R8Certificates_valid : + CB5_2_1I2R8Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB5_2_1I2R8CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB5_2_1I2R8P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB5_2_1I2R8Certificates (CB5_2_1I2R8CertificateIndex a)).input +lemma CB5_2_1I2R8P_check : ∀ a : Fin 6, contains (CB5_2_1I2R8Raw a) (CB5_2_1I2R8P a) = true := by + decide +kernel +lemma CB5_2_1I2R8P_sound (a : Fin 6) : + (CB5_2_1I2R8P a).Encloses (CB5_2_1I2R8Value a) := + contains_sound (CB5_2_1I2R8Raw_sound a) (CB5_2_1I2R8P_check a) +def CB5_2_1I2R8Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB5_2_1I2R8Certificates (CB5_2_1I2R8CertificateIndex a)).output +lemma CB5_2_1I2R8Terms_sound (a : Fin 6) : + (CB5_2_1I2R8Terms a).Encloses (Foundation.entropyTerm (CB5_2_1I2R8Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB5_2_1I2R8Certificates_valid + (CB5_2_1I2R8CertificateIndex a) (CB5_2_1I2R8P_sound a) +def CB5_2_1I2R8Entropy : Ball := ⟨0, 0⟩ +lemma CB5_2_1I2R8Entropy_sound : CB5_2_1I2R8Entropy.Encloses (Foundation.finiteEntropy CB5_2_1I2R8Value) := by + exact contains_sound (entropyFin_enclosed 6 CB5_2_1I2R8Value CB5_2_1I2R8Terms CB5_2_1I2R8Terms_sound) (by decide +kernel) +def CB5_2_1I2R8Mass : Ball := ⟨0, 0⟩ +lemma CB5_2_1I2R8Mass_sound : CB5_2_1I2R8Mass.Encloses (∑ a, CB5_2_1I2R8Value a) := by + exact contains_sound (finSumBall_sound 6 CB5_2_1I2R8P CB5_2_1I2R8Value CB5_2_1I2R8P_sound) (by decide +kernel) +def CB5_2_1I2R8MassTerm : Ball := .exact 0 +lemma CB5_2_1I2R8MassTerm_sound : CB5_2_1I2R8MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB5_2_1I2R8Value a))) := + entropyTerm_zero_ball (CB5_2_1I2R8Mass_sound) +def CB5_2_1I2R8H : Ball := ⟨0, 0⟩ +lemma CB5_2_1I2R8H_sound : CB5_2_1I2R8H.Encloses (homogeneousEntropy CB5_2_1I2R8Value) := by + exact contains_sound (homogeneous_enclosed CB5_2_1I2R8Value CB5_2_1I2R8MassTerm_sound CB5_2_1I2R8Entropy_sound) (by decide +kernel) +def CB5_2_1I2R9Value (a : Fin 6) : ℝ := residualLaw (below (shape 5 2 1)) (fun u => (stageBLaw (shape 5 2 1) u : ℝ)) (stageBPriority (shape 5 2 1)) 2 (fun u a => (littleLaw (shape 5 2 1) u ((stageBPriority (shape 5 2 1)) 2) a : ℝ)) 9 a +def CB5_2_1I2R9Raw (a : Fin 6) : Ball := residualBall (below (shape 5 2 1)) B5_2_1Law (stageBPriority (shape 5 2 1)) 2 (fun u => B5_2_1Little u ((stageBPriority (shape 5 2 1)) 2)) 9 a +lemma CB5_2_1I2R9Raw_sound (a : Fin 6) : + (CB5_2_1I2R9Raw a).Encloses (CB5_2_1I2R9Value a) := by + exact residualBall_sound_on (below (shape 5 2 1)) B5_2_1Law (fun u => (stageBLaw (shape 5 2 1) u : ℝ)) (stageBPriority (shape 5 2 1)) 2 (fun u => B5_2_1Little u ((stageBPriority (shape 5 2 1)) 2)) (fun u a => (littleLaw (shape 5 2 1) u ((stageBPriority (shape 5 2 1)) 2) a : ℝ)) (fun u _ => B5_2_1Law_sound u) (fun u _ a => B5_2_1Little_sound u ((stageBPriority (shape 5 2 1)) 2) a) 9 a +def CB5_2_1I2R9Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB5_2_1I2R9Certificates_valid : + CB5_2_1I2R9Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB5_2_1I2R9CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB5_2_1I2R9P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB5_2_1I2R9Certificates (CB5_2_1I2R9CertificateIndex a)).input +lemma CB5_2_1I2R9P_check : ∀ a : Fin 6, contains (CB5_2_1I2R9Raw a) (CB5_2_1I2R9P a) = true := by + decide +kernel +lemma CB5_2_1I2R9P_sound (a : Fin 6) : + (CB5_2_1I2R9P a).Encloses (CB5_2_1I2R9Value a) := + contains_sound (CB5_2_1I2R9Raw_sound a) (CB5_2_1I2R9P_check a) +def CB5_2_1I2R9Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB5_2_1I2R9Certificates (CB5_2_1I2R9CertificateIndex a)).output +lemma CB5_2_1I2R9Terms_sound (a : Fin 6) : + (CB5_2_1I2R9Terms a).Encloses (Foundation.entropyTerm (CB5_2_1I2R9Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB5_2_1I2R9Certificates_valid + (CB5_2_1I2R9CertificateIndex a) (CB5_2_1I2R9P_sound a) +def CB5_2_1I2R9Entropy : Ball := ⟨0, 0⟩ +lemma CB5_2_1I2R9Entropy_sound : CB5_2_1I2R9Entropy.Encloses (Foundation.finiteEntropy CB5_2_1I2R9Value) := by + exact contains_sound (entropyFin_enclosed 6 CB5_2_1I2R9Value CB5_2_1I2R9Terms CB5_2_1I2R9Terms_sound) (by decide +kernel) +def CB5_2_1I2R9Mass : Ball := ⟨0, 0⟩ +lemma CB5_2_1I2R9Mass_sound : CB5_2_1I2R9Mass.Encloses (∑ a, CB5_2_1I2R9Value a) := by + exact contains_sound (finSumBall_sound 6 CB5_2_1I2R9P CB5_2_1I2R9Value CB5_2_1I2R9P_sound) (by decide +kernel) +def CB5_2_1I2R9MassTerm : Ball := .exact 0 +lemma CB5_2_1I2R9MassTerm_sound : CB5_2_1I2R9MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB5_2_1I2R9Value a))) := + entropyTerm_zero_ball (CB5_2_1I2R9Mass_sound) +def CB5_2_1I2R9H : Ball := ⟨0, 0⟩ +lemma CB5_2_1I2R9H_sound : CB5_2_1I2R9H.Encloses (homogeneousEntropy CB5_2_1I2R9Value) := by + exact contains_sound (homogeneous_enclosed CB5_2_1I2R9Value CB5_2_1I2R9MassTerm_sound CB5_2_1I2R9Entropy_sound) (by decide +kernel) +def CB5_2_1I2R10Value (a : Fin 6) : ℝ := residualLaw (below (shape 5 2 1)) (fun u => (stageBLaw (shape 5 2 1) u : ℝ)) (stageBPriority (shape 5 2 1)) 2 (fun u a => (littleLaw (shape 5 2 1) u ((stageBPriority (shape 5 2 1)) 2) a : ℝ)) 10 a +def CB5_2_1I2R10Raw (a : Fin 6) : Ball := residualBall (below (shape 5 2 1)) B5_2_1Law (stageBPriority (shape 5 2 1)) 2 (fun u => B5_2_1Little u ((stageBPriority (shape 5 2 1)) 2)) 10 a +lemma CB5_2_1I2R10Raw_sound (a : Fin 6) : + (CB5_2_1I2R10Raw a).Encloses (CB5_2_1I2R10Value a) := by + exact residualBall_sound_on (below (shape 5 2 1)) B5_2_1Law (fun u => (stageBLaw (shape 5 2 1) u : ℝ)) (stageBPriority (shape 5 2 1)) 2 (fun u => B5_2_1Little u ((stageBPriority (shape 5 2 1)) 2)) (fun u a => (littleLaw (shape 5 2 1) u ((stageBPriority (shape 5 2 1)) 2) a : ℝ)) (fun u _ => B5_2_1Law_sound u) (fun u _ a => B5_2_1Little_sound u ((stageBPriority (shape 5 2 1)) 2) a) 10 a +def CB5_2_1I2R10Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB5_2_1I2R10Certificates_valid : + CB5_2_1I2R10Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB5_2_1I2R10CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB5_2_1I2R10P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB5_2_1I2R10Certificates (CB5_2_1I2R10CertificateIndex a)).input +lemma CB5_2_1I2R10P_check : ∀ a : Fin 6, contains (CB5_2_1I2R10Raw a) (CB5_2_1I2R10P a) = true := by + decide +kernel +lemma CB5_2_1I2R10P_sound (a : Fin 6) : + (CB5_2_1I2R10P a).Encloses (CB5_2_1I2R10Value a) := + contains_sound (CB5_2_1I2R10Raw_sound a) (CB5_2_1I2R10P_check a) +def CB5_2_1I2R10Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB5_2_1I2R10Certificates (CB5_2_1I2R10CertificateIndex a)).output +lemma CB5_2_1I2R10Terms_sound (a : Fin 6) : + (CB5_2_1I2R10Terms a).Encloses (Foundation.entropyTerm (CB5_2_1I2R10Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB5_2_1I2R10Certificates_valid + (CB5_2_1I2R10CertificateIndex a) (CB5_2_1I2R10P_sound a) +def CB5_2_1I2R10Entropy : Ball := ⟨0, 0⟩ +lemma CB5_2_1I2R10Entropy_sound : CB5_2_1I2R10Entropy.Encloses (Foundation.finiteEntropy CB5_2_1I2R10Value) := by + exact contains_sound (entropyFin_enclosed 6 CB5_2_1I2R10Value CB5_2_1I2R10Terms CB5_2_1I2R10Terms_sound) (by decide +kernel) +def CB5_2_1I2R10Mass : Ball := ⟨0, 0⟩ +lemma CB5_2_1I2R10Mass_sound : CB5_2_1I2R10Mass.Encloses (∑ a, CB5_2_1I2R10Value a) := by + exact contains_sound (finSumBall_sound 6 CB5_2_1I2R10P CB5_2_1I2R10Value CB5_2_1I2R10P_sound) (by decide +kernel) +def CB5_2_1I2R10MassTerm : Ball := .exact 0 +lemma CB5_2_1I2R10MassTerm_sound : CB5_2_1I2R10MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB5_2_1I2R10Value a))) := + entropyTerm_zero_ball (CB5_2_1I2R10Mass_sound) +def CB5_2_1I2R10H : Ball := ⟨0, 0⟩ +lemma CB5_2_1I2R10H_sound : CB5_2_1I2R10H.Encloses (homogeneousEntropy CB5_2_1I2R10Value) := by + exact contains_sound (homogeneous_enclosed CB5_2_1I2R10Value CB5_2_1I2R10MassTerm_sound CB5_2_1I2R10Entropy_sound) (by decide +kernel) +def CB5_2_1I2R11Value (a : Fin 6) : ℝ := residualLaw (below (shape 5 2 1)) (fun u => (stageBLaw (shape 5 2 1) u : ℝ)) (stageBPriority (shape 5 2 1)) 2 (fun u a => (littleLaw (shape 5 2 1) u ((stageBPriority (shape 5 2 1)) 2) a : ℝ)) 11 a +def CB5_2_1I2R11Raw (a : Fin 6) : Ball := residualBall (below (shape 5 2 1)) B5_2_1Law (stageBPriority (shape 5 2 1)) 2 (fun u => B5_2_1Little u ((stageBPriority (shape 5 2 1)) 2)) 11 a +lemma CB5_2_1I2R11Raw_sound (a : Fin 6) : + (CB5_2_1I2R11Raw a).Encloses (CB5_2_1I2R11Value a) := by + exact residualBall_sound_on (below (shape 5 2 1)) B5_2_1Law (fun u => (stageBLaw (shape 5 2 1) u : ℝ)) (stageBPriority (shape 5 2 1)) 2 (fun u => B5_2_1Little u ((stageBPriority (shape 5 2 1)) 2)) (fun u a => (littleLaw (shape 5 2 1) u ((stageBPriority (shape 5 2 1)) 2) a : ℝ)) (fun u _ => B5_2_1Law_sound u) (fun u _ a => B5_2_1Little_sound u ((stageBPriority (shape 5 2 1)) 2) a) 11 a +def CB5_2_1I2R11Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB5_2_1I2R11Certificates_valid : + CB5_2_1I2R11Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB5_2_1I2R11CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB5_2_1I2R11P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB5_2_1I2R11Certificates (CB5_2_1I2R11CertificateIndex a)).input +lemma CB5_2_1I2R11P_check : ∀ a : Fin 6, contains (CB5_2_1I2R11Raw a) (CB5_2_1I2R11P a) = true := by + decide +kernel +lemma CB5_2_1I2R11P_sound (a : Fin 6) : + (CB5_2_1I2R11P a).Encloses (CB5_2_1I2R11Value a) := + contains_sound (CB5_2_1I2R11Raw_sound a) (CB5_2_1I2R11P_check a) +def CB5_2_1I2R11Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB5_2_1I2R11Certificates (CB5_2_1I2R11CertificateIndex a)).output +lemma CB5_2_1I2R11Terms_sound (a : Fin 6) : + (CB5_2_1I2R11Terms a).Encloses (Foundation.entropyTerm (CB5_2_1I2R11Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB5_2_1I2R11Certificates_valid + (CB5_2_1I2R11CertificateIndex a) (CB5_2_1I2R11P_sound a) +def CB5_2_1I2R11Entropy : Ball := ⟨0, 0⟩ +lemma CB5_2_1I2R11Entropy_sound : CB5_2_1I2R11Entropy.Encloses (Foundation.finiteEntropy CB5_2_1I2R11Value) := by + exact contains_sound (entropyFin_enclosed 6 CB5_2_1I2R11Value CB5_2_1I2R11Terms CB5_2_1I2R11Terms_sound) (by decide +kernel) +def CB5_2_1I2R11Mass : Ball := ⟨0, 0⟩ +lemma CB5_2_1I2R11Mass_sound : CB5_2_1I2R11Mass.Encloses (∑ a, CB5_2_1I2R11Value a) := by + exact contains_sound (finSumBall_sound 6 CB5_2_1I2R11P CB5_2_1I2R11Value CB5_2_1I2R11P_sound) (by decide +kernel) +def CB5_2_1I2R11MassTerm : Ball := .exact 0 +lemma CB5_2_1I2R11MassTerm_sound : CB5_2_1I2R11MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB5_2_1I2R11Value a))) := + entropyTerm_zero_ball (CB5_2_1I2R11Mass_sound) +def CB5_2_1I2R11H : Ball := ⟨0, 0⟩ +lemma CB5_2_1I2R11H_sound : CB5_2_1I2R11H.Encloses (homogeneousEntropy CB5_2_1I2R11Value) := by + exact contains_sound (homogeneous_enclosed CB5_2_1I2R11Value CB5_2_1I2R11MassTerm_sound CB5_2_1I2R11Entropy_sound) (by decide +kernel) +def CB5_2_1I2R12Value (a : Fin 6) : ℝ := residualLaw (below (shape 5 2 1)) (fun u => (stageBLaw (shape 5 2 1) u : ℝ)) (stageBPriority (shape 5 2 1)) 2 (fun u a => (littleLaw (shape 5 2 1) u ((stageBPriority (shape 5 2 1)) 2) a : ℝ)) 12 a +def CB5_2_1I2R12Raw (a : Fin 6) : Ball := residualBall (below (shape 5 2 1)) B5_2_1Law (stageBPriority (shape 5 2 1)) 2 (fun u => B5_2_1Little u ((stageBPriority (shape 5 2 1)) 2)) 12 a +lemma CB5_2_1I2R12Raw_sound (a : Fin 6) : + (CB5_2_1I2R12Raw a).Encloses (CB5_2_1I2R12Value a) := by + exact residualBall_sound_on (below (shape 5 2 1)) B5_2_1Law (fun u => (stageBLaw (shape 5 2 1) u : ℝ)) (stageBPriority (shape 5 2 1)) 2 (fun u => B5_2_1Little u ((stageBPriority (shape 5 2 1)) 2)) (fun u a => (littleLaw (shape 5 2 1) u ((stageBPriority (shape 5 2 1)) 2) a : ℝ)) (fun u _ => B5_2_1Law_sound u) (fun u _ a => B5_2_1Little_sound u ((stageBPriority (shape 5 2 1)) 2) a) 12 a +def CB5_2_1I2R12Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB5_2_1I2R12Certificates_valid : + CB5_2_1I2R12Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB5_2_1I2R12CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB5_2_1I2R12P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB5_2_1I2R12Certificates (CB5_2_1I2R12CertificateIndex a)).input +lemma CB5_2_1I2R12P_check : ∀ a : Fin 6, contains (CB5_2_1I2R12Raw a) (CB5_2_1I2R12P a) = true := by + decide +kernel +lemma CB5_2_1I2R12P_sound (a : Fin 6) : + (CB5_2_1I2R12P a).Encloses (CB5_2_1I2R12Value a) := + contains_sound (CB5_2_1I2R12Raw_sound a) (CB5_2_1I2R12P_check a) +def CB5_2_1I2R12Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB5_2_1I2R12Certificates (CB5_2_1I2R12CertificateIndex a)).output +lemma CB5_2_1I2R12Terms_sound (a : Fin 6) : + (CB5_2_1I2R12Terms a).Encloses (Foundation.entropyTerm (CB5_2_1I2R12Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB5_2_1I2R12Certificates_valid + (CB5_2_1I2R12CertificateIndex a) (CB5_2_1I2R12P_sound a) +def CB5_2_1I2R12Entropy : Ball := ⟨0, 0⟩ +lemma CB5_2_1I2R12Entropy_sound : CB5_2_1I2R12Entropy.Encloses (Foundation.finiteEntropy CB5_2_1I2R12Value) := by + exact contains_sound (entropyFin_enclosed 6 CB5_2_1I2R12Value CB5_2_1I2R12Terms CB5_2_1I2R12Terms_sound) (by decide +kernel) +def CB5_2_1I2R12Mass : Ball := ⟨0, 0⟩ +lemma CB5_2_1I2R12Mass_sound : CB5_2_1I2R12Mass.Encloses (∑ a, CB5_2_1I2R12Value a) := by + exact contains_sound (finSumBall_sound 6 CB5_2_1I2R12P CB5_2_1I2R12Value CB5_2_1I2R12P_sound) (by decide +kernel) +def CB5_2_1I2R12MassTerm : Ball := .exact 0 +lemma CB5_2_1I2R12MassTerm_sound : CB5_2_1I2R12MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB5_2_1I2R12Value a))) := + entropyTerm_zero_ball (CB5_2_1I2R12Mass_sound) +def CB5_2_1I2R12H : Ball := ⟨0, 0⟩ +lemma CB5_2_1I2R12H_sound : CB5_2_1I2R12H.Encloses (homogeneousEntropy CB5_2_1I2R12Value) := by + exact contains_sound (homogeneous_enclosed CB5_2_1I2R12Value CB5_2_1I2R12MassTerm_sound CB5_2_1I2R12Entropy_sound) (by decide +kernel) +def CB5_2_1I2R13Value (a : Fin 6) : ℝ := residualLaw (below (shape 5 2 1)) (fun u => (stageBLaw (shape 5 2 1) u : ℝ)) (stageBPriority (shape 5 2 1)) 2 (fun u a => (littleLaw (shape 5 2 1) u ((stageBPriority (shape 5 2 1)) 2) a : ℝ)) 13 a +def CB5_2_1I2R13Raw (a : Fin 6) : Ball := residualBall (below (shape 5 2 1)) B5_2_1Law (stageBPriority (shape 5 2 1)) 2 (fun u => B5_2_1Little u ((stageBPriority (shape 5 2 1)) 2)) 13 a +lemma CB5_2_1I2R13Raw_sound (a : Fin 6) : + (CB5_2_1I2R13Raw a).Encloses (CB5_2_1I2R13Value a) := by + exact residualBall_sound_on (below (shape 5 2 1)) B5_2_1Law (fun u => (stageBLaw (shape 5 2 1) u : ℝ)) (stageBPriority (shape 5 2 1)) 2 (fun u => B5_2_1Little u ((stageBPriority (shape 5 2 1)) 2)) (fun u a => (littleLaw (shape 5 2 1) u ((stageBPriority (shape 5 2 1)) 2) a : ℝ)) (fun u _ => B5_2_1Law_sound u) (fun u _ a => B5_2_1Little_sound u ((stageBPriority (shape 5 2 1)) 2) a) 13 a +def CB5_2_1I2R13Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB5_2_1I2R13Certificates_valid : + CB5_2_1I2R13Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB5_2_1I2R13CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB5_2_1I2R13P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB5_2_1I2R13Certificates (CB5_2_1I2R13CertificateIndex a)).input +lemma CB5_2_1I2R13P_check : ∀ a : Fin 6, contains (CB5_2_1I2R13Raw a) (CB5_2_1I2R13P a) = true := by + decide +kernel +lemma CB5_2_1I2R13P_sound (a : Fin 6) : + (CB5_2_1I2R13P a).Encloses (CB5_2_1I2R13Value a) := + contains_sound (CB5_2_1I2R13Raw_sound a) (CB5_2_1I2R13P_check a) +def CB5_2_1I2R13Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB5_2_1I2R13Certificates (CB5_2_1I2R13CertificateIndex a)).output +lemma CB5_2_1I2R13Terms_sound (a : Fin 6) : + (CB5_2_1I2R13Terms a).Encloses (Foundation.entropyTerm (CB5_2_1I2R13Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB5_2_1I2R13Certificates_valid + (CB5_2_1I2R13CertificateIndex a) (CB5_2_1I2R13P_sound a) +def CB5_2_1I2R13Entropy : Ball := ⟨0, 0⟩ +lemma CB5_2_1I2R13Entropy_sound : CB5_2_1I2R13Entropy.Encloses (Foundation.finiteEntropy CB5_2_1I2R13Value) := by + exact contains_sound (entropyFin_enclosed 6 CB5_2_1I2R13Value CB5_2_1I2R13Terms CB5_2_1I2R13Terms_sound) (by decide +kernel) +def CB5_2_1I2R13Mass : Ball := ⟨0, 0⟩ +lemma CB5_2_1I2R13Mass_sound : CB5_2_1I2R13Mass.Encloses (∑ a, CB5_2_1I2R13Value a) := by + exact contains_sound (finSumBall_sound 6 CB5_2_1I2R13P CB5_2_1I2R13Value CB5_2_1I2R13P_sound) (by decide +kernel) +def CB5_2_1I2R13MassTerm : Ball := .exact 0 +lemma CB5_2_1I2R13MassTerm_sound : CB5_2_1I2R13MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB5_2_1I2R13Value a))) := + entropyTerm_zero_ball (CB5_2_1I2R13Mass_sound) +def CB5_2_1I2R13H : Ball := ⟨0, 0⟩ +lemma CB5_2_1I2R13H_sound : CB5_2_1I2R13H.Encloses (homogeneousEntropy CB5_2_1I2R13Value) := by + exact contains_sound (homogeneous_enclosed CB5_2_1I2R13Value CB5_2_1I2R13MassTerm_sound CB5_2_1I2R13Entropy_sound) (by decide +kernel) +def CB5_2_1I2R14Value (a : Fin 6) : ℝ := residualLaw (below (shape 5 2 1)) (fun u => (stageBLaw (shape 5 2 1) u : ℝ)) (stageBPriority (shape 5 2 1)) 2 (fun u a => (littleLaw (shape 5 2 1) u ((stageBPriority (shape 5 2 1)) 2) a : ℝ)) 14 a +def CB5_2_1I2R14Raw (a : Fin 6) : Ball := residualBall (below (shape 5 2 1)) B5_2_1Law (stageBPriority (shape 5 2 1)) 2 (fun u => B5_2_1Little u ((stageBPriority (shape 5 2 1)) 2)) 14 a +lemma CB5_2_1I2R14Raw_sound (a : Fin 6) : + (CB5_2_1I2R14Raw a).Encloses (CB5_2_1I2R14Value a) := by + exact residualBall_sound_on (below (shape 5 2 1)) B5_2_1Law (fun u => (stageBLaw (shape 5 2 1) u : ℝ)) (stageBPriority (shape 5 2 1)) 2 (fun u => B5_2_1Little u ((stageBPriority (shape 5 2 1)) 2)) (fun u a => (littleLaw (shape 5 2 1) u ((stageBPriority (shape 5 2 1)) 2) a : ℝ)) (fun u _ => B5_2_1Law_sound u) (fun u _ a => B5_2_1Little_sound u ((stageBPriority (shape 5 2 1)) 2) a) 14 a +def CB5_2_1I2R14Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB5_2_1I2R14Certificates_valid : + CB5_2_1I2R14Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB5_2_1I2R14CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB5_2_1I2R14P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB5_2_1I2R14Certificates (CB5_2_1I2R14CertificateIndex a)).input +lemma CB5_2_1I2R14P_check : ∀ a : Fin 6, contains (CB5_2_1I2R14Raw a) (CB5_2_1I2R14P a) = true := by + decide +kernel +lemma CB5_2_1I2R14P_sound (a : Fin 6) : + (CB5_2_1I2R14P a).Encloses (CB5_2_1I2R14Value a) := + contains_sound (CB5_2_1I2R14Raw_sound a) (CB5_2_1I2R14P_check a) +def CB5_2_1I2R14Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB5_2_1I2R14Certificates (CB5_2_1I2R14CertificateIndex a)).output +lemma CB5_2_1I2R14Terms_sound (a : Fin 6) : + (CB5_2_1I2R14Terms a).Encloses (Foundation.entropyTerm (CB5_2_1I2R14Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB5_2_1I2R14Certificates_valid + (CB5_2_1I2R14CertificateIndex a) (CB5_2_1I2R14P_sound a) +def CB5_2_1I2R14Entropy : Ball := ⟨0, 0⟩ +lemma CB5_2_1I2R14Entropy_sound : CB5_2_1I2R14Entropy.Encloses (Foundation.finiteEntropy CB5_2_1I2R14Value) := by + exact contains_sound (entropyFin_enclosed 6 CB5_2_1I2R14Value CB5_2_1I2R14Terms CB5_2_1I2R14Terms_sound) (by decide +kernel) +def CB5_2_1I2R14Mass : Ball := ⟨0, 0⟩ +lemma CB5_2_1I2R14Mass_sound : CB5_2_1I2R14Mass.Encloses (∑ a, CB5_2_1I2R14Value a) := by + exact contains_sound (finSumBall_sound 6 CB5_2_1I2R14P CB5_2_1I2R14Value CB5_2_1I2R14P_sound) (by decide +kernel) +def CB5_2_1I2R14MassTerm : Ball := .exact 0 +lemma CB5_2_1I2R14MassTerm_sound : CB5_2_1I2R14MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB5_2_1I2R14Value a))) := + entropyTerm_zero_ball (CB5_2_1I2R14Mass_sound) +def CB5_2_1I2R14H : Ball := ⟨0, 0⟩ +lemma CB5_2_1I2R14H_sound : CB5_2_1I2R14H.Encloses (homogeneousEntropy CB5_2_1I2R14Value) := by + exact contains_sound (homogeneous_enclosed CB5_2_1I2R14Value CB5_2_1I2R14MassTerm_sound CB5_2_1I2R14Entropy_sound) (by decide +kernel) +def CB5_2_1I2R15Value (a : Fin 6) : ℝ := residualLaw (below (shape 5 2 1)) (fun u => (stageBLaw (shape 5 2 1) u : ℝ)) (stageBPriority (shape 5 2 1)) 2 (fun u a => (littleLaw (shape 5 2 1) u ((stageBPriority (shape 5 2 1)) 2) a : ℝ)) 15 a +def CB5_2_1I2R15Raw (a : Fin 6) : Ball := residualBall (below (shape 5 2 1)) B5_2_1Law (stageBPriority (shape 5 2 1)) 2 (fun u => B5_2_1Little u ((stageBPriority (shape 5 2 1)) 2)) 15 a +lemma CB5_2_1I2R15Raw_sound (a : Fin 6) : + (CB5_2_1I2R15Raw a).Encloses (CB5_2_1I2R15Value a) := by + exact residualBall_sound_on (below (shape 5 2 1)) B5_2_1Law (fun u => (stageBLaw (shape 5 2 1) u : ℝ)) (stageBPriority (shape 5 2 1)) 2 (fun u => B5_2_1Little u ((stageBPriority (shape 5 2 1)) 2)) (fun u a => (littleLaw (shape 5 2 1) u ((stageBPriority (shape 5 2 1)) 2) a : ℝ)) (fun u _ => B5_2_1Law_sound u) (fun u _ a => B5_2_1Little_sound u ((stageBPriority (shape 5 2 1)) 2) a) 15 a +def CB5_2_1I2R15Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB5_2_1I2R15Certificates_valid : + CB5_2_1I2R15Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB5_2_1I2R15CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB5_2_1I2R15P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB5_2_1I2R15Certificates (CB5_2_1I2R15CertificateIndex a)).input +lemma CB5_2_1I2R15P_check : ∀ a : Fin 6, contains (CB5_2_1I2R15Raw a) (CB5_2_1I2R15P a) = true := by + decide +kernel +lemma CB5_2_1I2R15P_sound (a : Fin 6) : + (CB5_2_1I2R15P a).Encloses (CB5_2_1I2R15Value a) := + contains_sound (CB5_2_1I2R15Raw_sound a) (CB5_2_1I2R15P_check a) +def CB5_2_1I2R15Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB5_2_1I2R15Certificates (CB5_2_1I2R15CertificateIndex a)).output +lemma CB5_2_1I2R15Terms_sound (a : Fin 6) : + (CB5_2_1I2R15Terms a).Encloses (Foundation.entropyTerm (CB5_2_1I2R15Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB5_2_1I2R15Certificates_valid + (CB5_2_1I2R15CertificateIndex a) (CB5_2_1I2R15P_sound a) +def CB5_2_1I2R15Entropy : Ball := ⟨0, 0⟩ +lemma CB5_2_1I2R15Entropy_sound : CB5_2_1I2R15Entropy.Encloses (Foundation.finiteEntropy CB5_2_1I2R15Value) := by + exact contains_sound (entropyFin_enclosed 6 CB5_2_1I2R15Value CB5_2_1I2R15Terms CB5_2_1I2R15Terms_sound) (by decide +kernel) +def CB5_2_1I2R15Mass : Ball := ⟨0, 0⟩ +lemma CB5_2_1I2R15Mass_sound : CB5_2_1I2R15Mass.Encloses (∑ a, CB5_2_1I2R15Value a) := by + exact contains_sound (finSumBall_sound 6 CB5_2_1I2R15P CB5_2_1I2R15Value CB5_2_1I2R15P_sound) (by decide +kernel) +def CB5_2_1I2R15MassTerm : Ball := .exact 0 +lemma CB5_2_1I2R15MassTerm_sound : CB5_2_1I2R15MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB5_2_1I2R15Value a))) := + entropyTerm_zero_ball (CB5_2_1I2R15Mass_sound) +def CB5_2_1I2R15H : Ball := ⟨0, 0⟩ +lemma CB5_2_1I2R15H_sound : CB5_2_1I2R15H.Encloses (homogeneousEntropy CB5_2_1I2R15Value) := by + exact contains_sound (homogeneous_enclosed CB5_2_1I2R15Value CB5_2_1I2R15MassTerm_sound CB5_2_1I2R15Entropy_sound) (by decide +kernel) +def CB5_2_1I2R16Value (a : Fin 6) : ℝ := residualLaw (below (shape 5 2 1)) (fun u => (stageBLaw (shape 5 2 1) u : ℝ)) (stageBPriority (shape 5 2 1)) 2 (fun u a => (littleLaw (shape 5 2 1) u ((stageBPriority (shape 5 2 1)) 2) a : ℝ)) 16 a +def CB5_2_1I2R16Raw (a : Fin 6) : Ball := residualBall (below (shape 5 2 1)) B5_2_1Law (stageBPriority (shape 5 2 1)) 2 (fun u => B5_2_1Little u ((stageBPriority (shape 5 2 1)) 2)) 16 a +lemma CB5_2_1I2R16Raw_sound (a : Fin 6) : + (CB5_2_1I2R16Raw a).Encloses (CB5_2_1I2R16Value a) := by + exact residualBall_sound_on (below (shape 5 2 1)) B5_2_1Law (fun u => (stageBLaw (shape 5 2 1) u : ℝ)) (stageBPriority (shape 5 2 1)) 2 (fun u => B5_2_1Little u ((stageBPriority (shape 5 2 1)) 2)) (fun u a => (littleLaw (shape 5 2 1) u ((stageBPriority (shape 5 2 1)) 2) a : ℝ)) (fun u _ => B5_2_1Law_sound u) (fun u _ a => B5_2_1Little_sound u ((stageBPriority (shape 5 2 1)) 2) a) 16 a +def CB5_2_1I2R16Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB5_2_1I2R16Certificates_valid : + CB5_2_1I2R16Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB5_2_1I2R16CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB5_2_1I2R16P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB5_2_1I2R16Certificates (CB5_2_1I2R16CertificateIndex a)).input +lemma CB5_2_1I2R16P_check : ∀ a : Fin 6, contains (CB5_2_1I2R16Raw a) (CB5_2_1I2R16P a) = true := by + decide +kernel +lemma CB5_2_1I2R16P_sound (a : Fin 6) : + (CB5_2_1I2R16P a).Encloses (CB5_2_1I2R16Value a) := + contains_sound (CB5_2_1I2R16Raw_sound a) (CB5_2_1I2R16P_check a) +def CB5_2_1I2R16Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB5_2_1I2R16Certificates (CB5_2_1I2R16CertificateIndex a)).output +lemma CB5_2_1I2R16Terms_sound (a : Fin 6) : + (CB5_2_1I2R16Terms a).Encloses (Foundation.entropyTerm (CB5_2_1I2R16Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB5_2_1I2R16Certificates_valid + (CB5_2_1I2R16CertificateIndex a) (CB5_2_1I2R16P_sound a) +def CB5_2_1I2R16Entropy : Ball := ⟨0, 0⟩ +lemma CB5_2_1I2R16Entropy_sound : CB5_2_1I2R16Entropy.Encloses (Foundation.finiteEntropy CB5_2_1I2R16Value) := by + exact contains_sound (entropyFin_enclosed 6 CB5_2_1I2R16Value CB5_2_1I2R16Terms CB5_2_1I2R16Terms_sound) (by decide +kernel) +def CB5_2_1I2R16Mass : Ball := ⟨0, 0⟩ +lemma CB5_2_1I2R16Mass_sound : CB5_2_1I2R16Mass.Encloses (∑ a, CB5_2_1I2R16Value a) := by + exact contains_sound (finSumBall_sound 6 CB5_2_1I2R16P CB5_2_1I2R16Value CB5_2_1I2R16P_sound) (by decide +kernel) +def CB5_2_1I2R16MassTerm : Ball := .exact 0 +lemma CB5_2_1I2R16MassTerm_sound : CB5_2_1I2R16MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB5_2_1I2R16Value a))) := + entropyTerm_zero_ball (CB5_2_1I2R16Mass_sound) +def CB5_2_1I2R16H : Ball := ⟨0, 0⟩ +lemma CB5_2_1I2R16H_sound : CB5_2_1I2R16H.Encloses (homogeneousEntropy CB5_2_1I2R16Value) := by + exact contains_sound (homogeneous_enclosed CB5_2_1I2R16Value CB5_2_1I2R16MassTerm_sound CB5_2_1I2R16Entropy_sound) (by decide +kernel) +def CB5_2_1I2ResidualEntropies (a : Fin 17) : Ball := + match a.val with + | 0 => CB5_2_1I2R0H + | 1 => CB5_2_1I2R1H + | 2 => CB5_2_1I2R2H + | 3 => CB5_2_1I2R3H + | 4 => CB5_2_1I2R4H + | 5 => CB5_2_1I2R5H + | 6 => CB5_2_1I2R6H + | 7 => CB5_2_1I2R7H + | 8 => CB5_2_1I2R8H + | 9 => CB5_2_1I2R9H + | 10 => CB5_2_1I2R10H + | 11 => CB5_2_1I2R11H + | 12 => CB5_2_1I2R12H + | 13 => CB5_2_1I2R13H + | 14 => CB5_2_1I2R14H + | 15 => CB5_2_1I2R15H + | 16 => CB5_2_1I2R16H + | _ => (.exact 0) +lemma CB5_2_1I2ResidualEntropies_sound (k : Fin 17) : + (CB5_2_1I2ResidualEntropies k).Encloses (homogeneousEntropy + (residualLaw (below (shape 5 2 1)) (fun u => (stageBLaw (shape 5 2 1) u : ℝ)) (stageBPriority (shape 5 2 1)) 2 (fun u a => (littleLaw (shape 5 2 1) u ((stageBPriority (shape 5 2 1)) 2) a : ℝ)) k)) := by + fin_cases k + · exact CB5_2_1I2R0H_sound + · exact CB5_2_1I2R1H_sound + · exact CB5_2_1I2R2H_sound + · exact CB5_2_1I2R3H_sound + · exact CB5_2_1I2R4H_sound + · exact CB5_2_1I2R5H_sound + · exact CB5_2_1I2R6H_sound + · exact CB5_2_1I2R7H_sound + · exact CB5_2_1I2R8H_sound + · exact CB5_2_1I2R9H_sound + · exact CB5_2_1I2R10H_sound + · exact CB5_2_1I2R11H_sound + · exact CB5_2_1I2R12H_sound + · exact CB5_2_1I2R13H_sound + · exact CB5_2_1I2R14H_sound + · exact CB5_2_1I2R15H_sound + · exact CB5_2_1I2R16H_sound +def CB5_2_1I2S2_2_0Value (a : Fin 6) : ℝ := (littleLaw (shape 5 2 1) (shape 2 2 0) ((stageBPriority (shape 5 2 1)) 2) a : ℝ) +def CB5_2_1I2S2_2_0E_2LogWitness : LogWitness := ⟨-1, 444947, 250000⟩ +def CB5_2_1I2S2_2_0E_2Log : Ball := ⟨(-11665292447264905939613678307427 / 100000000000000000000000000000000), (8470329473 / 20000000000000000000000000000000)⟩ +lemma CB5_2_1I2S2_2_0E_2Log_sound : CB5_2_1I2S2_2_0E_2Log.Encloses (Real.log (CB5_2_1I2S2_2_0Value (2 : Fin 6))) := by + exact checkLog_sound logTwoBall_sound ((B5_2_1Little_sound (shape 2 2 0) ((stageBPriority (shape 5 2 1)) 2)) (2 : Fin 6)) (w := CB5_2_1I2S2_2_0E_2LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB5_2_1I2S2_2_0E_2 : Ball := ⟨(10380873757066356206226574643709 / 100000000000000000000000000000000), (37688476881 / 100000000000000000000000000000000)⟩ +lemma CB5_2_1I2S2_2_0E_2_sound : CB5_2_1I2S2_2_0E_2.Encloses (Foundation.entropyTerm (CB5_2_1I2S2_2_0Value (2 : Fin 6))) := by + exact contains_sound (entropyTerm_ball ((B5_2_1Little_sound (shape 2 2 0) ((stageBPriority (shape 5 2 1)) 2)) (2 : Fin 6)) CB5_2_1I2S2_2_0E_2Log_sound) (by decide +kernel) +def CB5_2_1I2S2_2_0E_3LogWitness : LogWitness := ⟨-4, 55053, 31250⟩ +def CB5_2_1I2S2_2_0E_3Log : Ball := ⟨(-110315587041277227232948872211851 / 50000000000000000000000000000000), (21175823683 / 20000000000000000000000000000000)⟩ +lemma CB5_2_1I2S2_2_0E_3Log_sound : CB5_2_1I2S2_2_0E_3Log.Encloses (Real.log (CB5_2_1I2S2_2_0Value (3 : Fin 6))) := by + exact checkLog_sound logTwoBall_sound ((B5_2_1Little_sound (shape 2 2 0) ((stageBPriority (shape 5 2 1)) 2)) (3 : Fin 6)) (w := CB5_2_1I2S2_2_0E_3LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB5_2_1I2S2_2_0E_3 : Ball := ⟨(6073204013383435190855534261879 / 25000000000000000000000000000000), (11657926213 / 100000000000000000000000000000000)⟩ +lemma CB5_2_1I2S2_2_0E_3_sound : CB5_2_1I2S2_2_0E_3.Encloses (Foundation.entropyTerm (CB5_2_1I2S2_2_0Value (3 : Fin 6))) := by + exact contains_sound (entropyTerm_ball ((B5_2_1Little_sound (shape 2 2 0) ((stageBPriority (shape 5 2 1)) 2)) (3 : Fin 6)) CB5_2_1I2S2_2_0E_3Log_sound) (by decide +kernel) +def CB5_2_1I2S2_2_0Terms (a : Fin 6) : Ball := + match a.val with + | 2 => ⟨(10380873757066356206226574643709 / 100000000000000000000000000000000), (37688476881 / 100000000000000000000000000000000)⟩ + | 3 => ⟨(6073204013383435190855534261879 / 25000000000000000000000000000000), (11657926213 / 100000000000000000000000000000000)⟩ + | _ => (.exact 0) +lemma CB5_2_1I2S2_2_0Terms_sound (a : Fin 6) : + (CB5_2_1I2S2_2_0Terms a).Encloses (Foundation.entropyTerm (CB5_2_1I2S2_2_0Value a)) := by + fin_cases a + · exact (entropyTerm_zero_ball ((B5_2_1Little_sound (shape 2 2 0) ((stageBPriority (shape 5 2 1)) 2)) (0 : Fin 6))) + · exact (entropyTerm_zero_ball ((B5_2_1Little_sound (shape 2 2 0) ((stageBPriority (shape 5 2 1)) 2)) (1 : Fin 6))) + · exact CB5_2_1I2S2_2_0E_2_sound + · exact CB5_2_1I2S2_2_0E_3_sound + · exact (entropyTerm_zero_ball ((B5_2_1Little_sound (shape 2 2 0) ((stageBPriority (shape 5 2 1)) 2)) (4 : Fin 6))) + · exact (entropyTerm_zero_ball ((B5_2_1Little_sound (shape 2 2 0) ((stageBPriority (shape 5 2 1)) 2)) (5 : Fin 6))) +def CB5_2_1I2S2_2_0Entropy : Ball := ⟨(1386947592424003878785948467649 / 4000000000000000000000000000000), (24673201547 / 50000000000000000000000000000000)⟩ +lemma CB5_2_1I2S2_2_0Entropy_sound : CB5_2_1I2S2_2_0Entropy.Encloses (Foundation.finiteEntropy CB5_2_1I2S2_2_0Value) := by + exact contains_sound (entropyFin_enclosed 6 CB5_2_1I2S2_2_0Value CB5_2_1I2S2_2_0Terms CB5_2_1I2S2_2_0Terms_sound) (by decide +kernel) +def CB5_2_1I2S2_2_0Mass : Ball := ⟨1, 0⟩ +lemma CB5_2_1I2S2_2_0Mass_sound : CB5_2_1I2S2_2_0Mass.Encloses (∑ a, CB5_2_1I2S2_2_0Value a) := by + exact contains_sound (finSumBall_sound 6 (B5_2_1Little (shape 2 2 0) ((stageBPriority (shape 5 2 1)) 2)) CB5_2_1I2S2_2_0Value (B5_2_1Little_sound (shape 2 2 0) ((stageBPriority (shape 5 2 1)) 2))) (by decide +kernel) +def CB5_2_1I2S2_2_0MassTermLog : Ball := .exact 0 +lemma CB5_2_1I2S2_2_0MassTermLog_sound : CB5_2_1I2S2_2_0MassTermLog.Encloses (Real.log ((∑ a, CB5_2_1I2S2_2_0Value a))) := by + exact log_exact_one_ball (CB5_2_1I2S2_2_0Mass_sound) +def CB5_2_1I2S2_2_0MassTerm : Ball := ⟨0, 0⟩ +lemma CB5_2_1I2S2_2_0MassTerm_sound : CB5_2_1I2S2_2_0MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB5_2_1I2S2_2_0Value a))) := by + exact contains_sound (entropyTerm_ball (CB5_2_1I2S2_2_0Mass_sound) CB5_2_1I2S2_2_0MassTermLog_sound) (by decide +kernel) +def CB5_2_1I2S2_2_0H : Ball := ⟨(1386947592424003878785948467649 / 4000000000000000000000000000000), (24673201547 / 50000000000000000000000000000000)⟩ +lemma CB5_2_1I2S2_2_0H_sound : CB5_2_1I2S2_2_0H.Encloses (homogeneousEntropy CB5_2_1I2S2_2_0Value) := by + exact contains_sound (homogeneous_enclosed CB5_2_1I2S2_2_0Value CB5_2_1I2S2_2_0MassTerm_sound CB5_2_1I2S2_2_0Entropy_sound) (by decide +kernel) +def CB5_2_1I2S3_0_1Value (a : Fin 6) : ℝ := (littleLaw (shape 5 2 1) (shape 3 0 1) ((stageBPriority (shape 5 2 1)) 2) a : ℝ) +def CB5_2_1I2S3_0_1E_4Log : Ball := .exact 0 +lemma CB5_2_1I2S3_0_1E_4Log_sound : CB5_2_1I2S3_0_1E_4Log.Encloses (Real.log (CB5_2_1I2S3_0_1Value (4 : Fin 6))) := by + exact log_exact_one_ball ((B5_2_1Little_sound (shape 3 0 1) ((stageBPriority (shape 5 2 1)) 2)) (4 : Fin 6)) +def CB5_2_1I2S3_0_1E_4 : Ball := ⟨0, 0⟩ +lemma CB5_2_1I2S3_0_1E_4_sound : CB5_2_1I2S3_0_1E_4.Encloses (Foundation.entropyTerm (CB5_2_1I2S3_0_1Value (4 : Fin 6))) := by + exact contains_sound (entropyTerm_ball ((B5_2_1Little_sound (shape 3 0 1) ((stageBPriority (shape 5 2 1)) 2)) (4 : Fin 6)) CB5_2_1I2S3_0_1E_4Log_sound) (by decide +kernel) +def CB5_2_1I2S3_0_1Terms (a : Fin 6) : Ball := + match a.val with + | 4 => ⟨0, 0⟩ + | _ => (.exact 0) +lemma CB5_2_1I2S3_0_1Terms_sound (a : Fin 6) : + (CB5_2_1I2S3_0_1Terms a).Encloses (Foundation.entropyTerm (CB5_2_1I2S3_0_1Value a)) := by + fin_cases a + · exact (entropyTerm_zero_ball ((B5_2_1Little_sound (shape 3 0 1) ((stageBPriority (shape 5 2 1)) 2)) (0 : Fin 6))) + · exact (entropyTerm_zero_ball ((B5_2_1Little_sound (shape 3 0 1) ((stageBPriority (shape 5 2 1)) 2)) (1 : Fin 6))) + · exact (entropyTerm_zero_ball ((B5_2_1Little_sound (shape 3 0 1) ((stageBPriority (shape 5 2 1)) 2)) (2 : Fin 6))) + · exact (entropyTerm_zero_ball ((B5_2_1Little_sound (shape 3 0 1) ((stageBPriority (shape 5 2 1)) 2)) (3 : Fin 6))) + · exact CB5_2_1I2S3_0_1E_4_sound + · exact (entropyTerm_zero_ball ((B5_2_1Little_sound (shape 3 0 1) ((stageBPriority (shape 5 2 1)) 2)) (5 : Fin 6))) +def CB5_2_1I2S3_0_1Entropy : Ball := ⟨0, 0⟩ +lemma CB5_2_1I2S3_0_1Entropy_sound : CB5_2_1I2S3_0_1Entropy.Encloses (Foundation.finiteEntropy CB5_2_1I2S3_0_1Value) := by + exact contains_sound (entropyFin_enclosed 6 CB5_2_1I2S3_0_1Value CB5_2_1I2S3_0_1Terms CB5_2_1I2S3_0_1Terms_sound) (by decide +kernel) +def CB5_2_1I2S3_0_1Mass : Ball := ⟨1, 0⟩ +lemma CB5_2_1I2S3_0_1Mass_sound : CB5_2_1I2S3_0_1Mass.Encloses (∑ a, CB5_2_1I2S3_0_1Value a) := by + exact contains_sound (finSumBall_sound 6 (B5_2_1Little (shape 3 0 1) ((stageBPriority (shape 5 2 1)) 2)) CB5_2_1I2S3_0_1Value (B5_2_1Little_sound (shape 3 0 1) ((stageBPriority (shape 5 2 1)) 2))) (by decide +kernel) +def CB5_2_1I2S3_0_1MassTermLog : Ball := .exact 0 +lemma CB5_2_1I2S3_0_1MassTermLog_sound : CB5_2_1I2S3_0_1MassTermLog.Encloses (Real.log ((∑ a, CB5_2_1I2S3_0_1Value a))) := by + exact log_exact_one_ball (CB5_2_1I2S3_0_1Mass_sound) +def CB5_2_1I2S3_0_1MassTerm : Ball := ⟨0, 0⟩ +lemma CB5_2_1I2S3_0_1MassTerm_sound : CB5_2_1I2S3_0_1MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB5_2_1I2S3_0_1Value a))) := by + exact contains_sound (entropyTerm_ball (CB5_2_1I2S3_0_1Mass_sound) CB5_2_1I2S3_0_1MassTermLog_sound) (by decide +kernel) +def CB5_2_1I2S3_0_1H : Ball := ⟨0, 0⟩ +lemma CB5_2_1I2S3_0_1H_sound : CB5_2_1I2S3_0_1H.Encloses (homogeneousEntropy CB5_2_1I2S3_0_1Value) := by + exact contains_sound (homogeneous_enclosed CB5_2_1I2S3_0_1Value CB5_2_1I2S3_0_1MassTerm_sound CB5_2_1I2S3_0_1Entropy_sound) (by decide +kernel) +def CB5_2_1I2S3_1_0Value (a : Fin 6) : ℝ := (littleLaw (shape 5 2 1) (shape 3 1 0) ((stageBPriority (shape 5 2 1)) 2) a : ℝ) +def CB5_2_1I2S3_1_0E_4Log : Ball := .exact 0 +lemma CB5_2_1I2S3_1_0E_4Log_sound : CB5_2_1I2S3_1_0E_4Log.Encloses (Real.log (CB5_2_1I2S3_1_0Value (4 : Fin 6))) := by + exact log_exact_one_ball ((B5_2_1Little_sound (shape 3 1 0) ((stageBPriority (shape 5 2 1)) 2)) (4 : Fin 6)) +def CB5_2_1I2S3_1_0E_4 : Ball := ⟨0, 0⟩ +lemma CB5_2_1I2S3_1_0E_4_sound : CB5_2_1I2S3_1_0E_4.Encloses (Foundation.entropyTerm (CB5_2_1I2S3_1_0Value (4 : Fin 6))) := by + exact contains_sound (entropyTerm_ball ((B5_2_1Little_sound (shape 3 1 0) ((stageBPriority (shape 5 2 1)) 2)) (4 : Fin 6)) CB5_2_1I2S3_1_0E_4Log_sound) (by decide +kernel) +def CB5_2_1I2S3_1_0Terms (a : Fin 6) : Ball := + match a.val with + | 4 => ⟨0, 0⟩ + | _ => (.exact 0) +lemma CB5_2_1I2S3_1_0Terms_sound (a : Fin 6) : + (CB5_2_1I2S3_1_0Terms a).Encloses (Foundation.entropyTerm (CB5_2_1I2S3_1_0Value a)) := by + fin_cases a + · exact (entropyTerm_zero_ball ((B5_2_1Little_sound (shape 3 1 0) ((stageBPriority (shape 5 2 1)) 2)) (0 : Fin 6))) + · exact (entropyTerm_zero_ball ((B5_2_1Little_sound (shape 3 1 0) ((stageBPriority (shape 5 2 1)) 2)) (1 : Fin 6))) + · exact (entropyTerm_zero_ball ((B5_2_1Little_sound (shape 3 1 0) ((stageBPriority (shape 5 2 1)) 2)) (2 : Fin 6))) + · exact (entropyTerm_zero_ball ((B5_2_1Little_sound (shape 3 1 0) ((stageBPriority (shape 5 2 1)) 2)) (3 : Fin 6))) + · exact CB5_2_1I2S3_1_0E_4_sound + · exact (entropyTerm_zero_ball ((B5_2_1Little_sound (shape 3 1 0) ((stageBPriority (shape 5 2 1)) 2)) (5 : Fin 6))) +def CB5_2_1I2S3_1_0Entropy : Ball := ⟨0, 0⟩ +lemma CB5_2_1I2S3_1_0Entropy_sound : CB5_2_1I2S3_1_0Entropy.Encloses (Foundation.finiteEntropy CB5_2_1I2S3_1_0Value) := by + exact contains_sound (entropyFin_enclosed 6 CB5_2_1I2S3_1_0Value CB5_2_1I2S3_1_0Terms CB5_2_1I2S3_1_0Terms_sound) (by decide +kernel) +def CB5_2_1I2S3_1_0Mass : Ball := ⟨1, 0⟩ +lemma CB5_2_1I2S3_1_0Mass_sound : CB5_2_1I2S3_1_0Mass.Encloses (∑ a, CB5_2_1I2S3_1_0Value a) := by + exact contains_sound (finSumBall_sound 6 (B5_2_1Little (shape 3 1 0) ((stageBPriority (shape 5 2 1)) 2)) CB5_2_1I2S3_1_0Value (B5_2_1Little_sound (shape 3 1 0) ((stageBPriority (shape 5 2 1)) 2))) (by decide +kernel) +def CB5_2_1I2S3_1_0MassTermLog : Ball := .exact 0 +lemma CB5_2_1I2S3_1_0MassTermLog_sound : CB5_2_1I2S3_1_0MassTermLog.Encloses (Real.log ((∑ a, CB5_2_1I2S3_1_0Value a))) := by + exact log_exact_one_ball (CB5_2_1I2S3_1_0Mass_sound) +def CB5_2_1I2S3_1_0MassTerm : Ball := ⟨0, 0⟩ +lemma CB5_2_1I2S3_1_0MassTerm_sound : CB5_2_1I2S3_1_0MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB5_2_1I2S3_1_0Value a))) := by + exact contains_sound (entropyTerm_ball (CB5_2_1I2S3_1_0Mass_sound) CB5_2_1I2S3_1_0MassTermLog_sound) (by decide +kernel) +def CB5_2_1I2S3_1_0H : Ball := ⟨0, 0⟩ +lemma CB5_2_1I2S3_1_0H_sound : CB5_2_1I2S3_1_0H.Encloses (homogeneousEntropy CB5_2_1I2S3_1_0Value) := by + exact contains_sound (homogeneous_enclosed CB5_2_1I2S3_1_0Value CB5_2_1I2S3_1_0MassTerm_sound CB5_2_1I2S3_1_0Entropy_sound) (by decide +kernel) +def CB5_2_1I2S4_0_0Value (a : Fin 6) : ℝ := (littleLaw (shape 5 2 1) (shape 4 0 0) ((stageBPriority (shape 5 2 1)) 2) a : ℝ) +def CB5_2_1I2S4_0_0E_5Log : Ball := .exact 0 +lemma CB5_2_1I2S4_0_0E_5Log_sound : CB5_2_1I2S4_0_0E_5Log.Encloses (Real.log (CB5_2_1I2S4_0_0Value (5 : Fin 6))) := by + exact log_exact_one_ball ((B5_2_1Little_sound (shape 4 0 0) ((stageBPriority (shape 5 2 1)) 2)) (5 : Fin 6)) +def CB5_2_1I2S4_0_0E_5 : Ball := ⟨0, 0⟩ +lemma CB5_2_1I2S4_0_0E_5_sound : CB5_2_1I2S4_0_0E_5.Encloses (Foundation.entropyTerm (CB5_2_1I2S4_0_0Value (5 : Fin 6))) := by + exact contains_sound (entropyTerm_ball ((B5_2_1Little_sound (shape 4 0 0) ((stageBPriority (shape 5 2 1)) 2)) (5 : Fin 6)) CB5_2_1I2S4_0_0E_5Log_sound) (by decide +kernel) +def CB5_2_1I2S4_0_0Terms (a : Fin 6) : Ball := + match a.val with + | 5 => ⟨0, 0⟩ + | _ => (.exact 0) +lemma CB5_2_1I2S4_0_0Terms_sound (a : Fin 6) : + (CB5_2_1I2S4_0_0Terms a).Encloses (Foundation.entropyTerm (CB5_2_1I2S4_0_0Value a)) := by + fin_cases a + · exact (entropyTerm_zero_ball ((B5_2_1Little_sound (shape 4 0 0) ((stageBPriority (shape 5 2 1)) 2)) (0 : Fin 6))) + · exact (entropyTerm_zero_ball ((B5_2_1Little_sound (shape 4 0 0) ((stageBPriority (shape 5 2 1)) 2)) (1 : Fin 6))) + · exact (entropyTerm_zero_ball ((B5_2_1Little_sound (shape 4 0 0) ((stageBPriority (shape 5 2 1)) 2)) (2 : Fin 6))) + · exact (entropyTerm_zero_ball ((B5_2_1Little_sound (shape 4 0 0) ((stageBPriority (shape 5 2 1)) 2)) (3 : Fin 6))) + · exact (entropyTerm_zero_ball ((B5_2_1Little_sound (shape 4 0 0) ((stageBPriority (shape 5 2 1)) 2)) (4 : Fin 6))) + · exact CB5_2_1I2S4_0_0E_5_sound +def CB5_2_1I2S4_0_0Entropy : Ball := ⟨0, 0⟩ +lemma CB5_2_1I2S4_0_0Entropy_sound : CB5_2_1I2S4_0_0Entropy.Encloses (Foundation.finiteEntropy CB5_2_1I2S4_0_0Value) := by + exact contains_sound (entropyFin_enclosed 6 CB5_2_1I2S4_0_0Value CB5_2_1I2S4_0_0Terms CB5_2_1I2S4_0_0Terms_sound) (by decide +kernel) +def CB5_2_1I2S4_0_0Mass : Ball := ⟨1, 0⟩ +lemma CB5_2_1I2S4_0_0Mass_sound : CB5_2_1I2S4_0_0Mass.Encloses (∑ a, CB5_2_1I2S4_0_0Value a) := by + exact contains_sound (finSumBall_sound 6 (B5_2_1Little (shape 4 0 0) ((stageBPriority (shape 5 2 1)) 2)) CB5_2_1I2S4_0_0Value (B5_2_1Little_sound (shape 4 0 0) ((stageBPriority (shape 5 2 1)) 2))) (by decide +kernel) +def CB5_2_1I2S4_0_0MassTermLog : Ball := .exact 0 +lemma CB5_2_1I2S4_0_0MassTermLog_sound : CB5_2_1I2S4_0_0MassTermLog.Encloses (Real.log ((∑ a, CB5_2_1I2S4_0_0Value a))) := by + exact log_exact_one_ball (CB5_2_1I2S4_0_0Mass_sound) +def CB5_2_1I2S4_0_0MassTerm : Ball := ⟨0, 0⟩ +lemma CB5_2_1I2S4_0_0MassTerm_sound : CB5_2_1I2S4_0_0MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB5_2_1I2S4_0_0Value a))) := by + exact contains_sound (entropyTerm_ball (CB5_2_1I2S4_0_0Mass_sound) CB5_2_1I2S4_0_0MassTermLog_sound) (by decide +kernel) +def CB5_2_1I2S4_0_0H : Ball := ⟨0, 0⟩ +lemma CB5_2_1I2S4_0_0H_sound : CB5_2_1I2S4_0_0H.Encloses (homogeneousEntropy CB5_2_1I2S4_0_0Value) := by + exact contains_sound (homogeneous_enclosed CB5_2_1I2S4_0_0Value CB5_2_1I2S4_0_0MassTerm_sound CB5_2_1I2S4_0_0Entropy_sound) (by decide +kernel) +def CB5_2_1I2Singles (s : Shape) : Ball := + match s 0, s 1, s 2 with + | 2, 2, 0 => CB5_2_1I2S2_2_0H + | 3, 0, 1 => CB5_2_1I2S3_0_1H + | 3, 1, 0 => CB5_2_1I2S3_1_0H + | 4, 0, 0 => CB5_2_1I2S4_0_0H + | _, _, _ => (.exact 0) +lemma CB5_2_1I2Singles_sound (u : Shape) (hu : u ∈ below (shape 5 2 1)) + (hd : designated (stageBPriority (shape 5 2 1)) 2 u) : + (CB5_2_1I2Singles u).Encloses (homogeneousEntropy ((fun u a => (littleLaw (shape 5 2 1) u ((stageBPriority (shape 5 2 1)) 2) a : ℝ)) u)) := by + rw [B5_2_1_below] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl | rfl | rfl + · exact (show ¬ designated (stageBPriority (shape 5 2 1)) 2 (shape 1 2 1) by decide +kernel) hd |>.elim + · exact (show ¬ designated (stageBPriority (shape 5 2 1)) 2 (shape 2 1 1) by decide +kernel) hd |>.elim + · exact CB5_2_1I2S2_2_0H_sound + · exact CB5_2_1I2S3_0_1H_sound + · exact CB5_2_1I2S3_1_0H_sound + · exact CB5_2_1I2S4_0_0H_sound +def CB5_2_1I2Singleton : Ball := ⟨(308167098657990073854559001417 / 5000000000000000000000000000000), (68527003 / 781250000000000000000000000000)⟩ +lemma CB5_2_1I2Singleton_sound : CB5_2_1I2Singleton.Encloses + (singletonEntropy (below (shape 5 2 1)) (fun u => (stageBLaw (shape 5 2 1) u : ℝ)) (stageBPriority (shape 5 2 1)) 2 (fun u a => (littleLaw (shape 5 2 1) u ((stageBPriority (shape 5 2 1)) 2) a : ℝ))) := by + exact contains_sound (singletonBall_sound (below (shape 5 2 1)) B5_2_1Law (fun u => (stageBLaw (shape 5 2 1) u : ℝ)) (stageBPriority (shape 5 2 1)) 2 + CB5_2_1I2Singles (fun u a => (littleLaw (shape 5 2 1) u ((stageBPriority (shape 5 2 1)) 2) a : ℝ)) (fun u _ => B5_2_1Law_sound u) CB5_2_1I2Singles_sound) (by decide +kernel) +def CB5_2_1I2Group : Ball := ⟨(6956086608082038040231821369621 / 100000000000000000000000000000000), (10347034199 / 20000000000000000000000000000000)⟩ +lemma CB5_2_1I2Group_sound : CB5_2_1I2Group.Encloses + (groupedEntropy (below (shape 5 2 1)) (fun u => (stageBLaw (shape 5 2 1) u : ℝ)) (stageBPriority (shape 5 2 1)) 2 (fun u a => (littleLaw (shape 5 2 1) u ((stageBPriority (shape 5 2 1)) 2) a : ℝ))) := by + exact contains_sound (Ball.add_sound CB5_2_1I2Singleton_sound + (finSumBall_sound 17 CB5_2_1I2ResidualEntropies _ CB5_2_1I2ResidualEntropies_sound)) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CB5_2_1I2H : Ball := ⟨(40059413959824985115581435113791 / 50000000000000000000000000000000), (38701960811 / 20000000000000000000000000000000)⟩ +lemma CB5_2_1I2_sound : CB5_2_1I2H.Encloses (stageBCapacity (shape 5 2 1) 2) := by + have hb := contains_sound (Ball.add_sound CB5_2_1I2PairH_sound + (Ball.neg_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) CB5_2_1I2Group_sound))) + (show contains (.add CB5_2_1I2PairH (.neg (.mul (.exact 2) CB5_2_1I2Group))) CB5_2_1I2H = true by decide +kernel) + unfold CB5_2_1I2PairValue at hb + simpa only [stageBCapacity, nativeCapacity, + show (2 : Fin 3) ≠ 0 by decide, ite_false, sub_eq_add_neg] using hb + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/CapacityB/CapB6_1_1I0.lean b/lean/OAI/LinearAlgebra/MatrixFields/CapacityB/CapB6_1_1I0.lean new file mode 100644 index 0000000000000000000000000000000000000000..9f03768dcfaf631deeaed1e9308067e1d49f73c4 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/CapacityB/CapB6_1_1I0.lean @@ -0,0 +1,72 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Certificates.NativeInterior + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CB6_1_1I0Value (a : Fin 17) : ℝ := marginal (below (shape 6 1 1)) (fun u => (stageBLaw (shape 6 1 1) u : ℝ)) ((stageBPriority (shape 6 1 1)) 0) a +def CB6_1_1I0Raw (a : Fin 17) : Ball := marginalBall (below (shape 6 1 1)) B6_1_1Law ((stageBPriority (shape 6 1 1)) 0) a +lemma CB6_1_1I0Raw_sound (a : Fin 17) : + (CB6_1_1I0Raw a).Encloses (CB6_1_1I0Value a) := by + exact marginalBall_sound (below (shape 6 1 1)) B6_1_1Law (fun u => (stageBLaw (shape 6 1 1) u : ℝ)) (fun u _ => B6_1_1Law_sound u) ((stageBPriority (shape 6 1 1)) 0) a +def CB6_1_1I0Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(1 / 2), (13 / 20000000000000000000000000000000)⟩ ⟨(6931471805599453094172319305033 / 20000000000000000000000000000000), (21175823793 / 100000000000000000000000000000000)⟩ ⟨(-6931471805599453094172319305033 / 10000000000000000000000000000000), (8470329499 / 20000000000000000000000000000000)⟩ ⟨-1, 1, 1⟩] +lemma CB6_1_1I0Certificates_valid : + CB6_1_1I0Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB6_1_1I0CertificateIndex (a : Fin 17) : ℕ := + match a.val with + | 1 => 1 + | 0 => 1 + | _ => 0 +def CB6_1_1I0P (a : Fin 17) : Ball := + (CompactCertificate.entropyLookup CB6_1_1I0Certificates (CB6_1_1I0CertificateIndex a)).input +lemma CB6_1_1I0P_check : ∀ a : Fin 17, contains (CB6_1_1I0Raw a) (CB6_1_1I0P a) = true := by + decide +kernel +lemma CB6_1_1I0P_sound (a : Fin 17) : + (CB6_1_1I0P a).Encloses (CB6_1_1I0Value a) := + contains_sound (CB6_1_1I0Raw_sound a) (CB6_1_1I0P_check a) +def CB6_1_1I0Terms (a : Fin 17) : Ball := + (CompactCertificate.entropyLookup CB6_1_1I0Certificates (CB6_1_1I0CertificateIndex a)).output +lemma CB6_1_1I0Terms_sound (a : Fin 17) : + (CB6_1_1I0Terms a).Encloses (Foundation.entropyTerm (CB6_1_1I0Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB6_1_1I0Certificates_valid + (CB6_1_1I0CertificateIndex a) (CB6_1_1I0P_sound a) +def CB6_1_1I0Entropy : Ball := ⟨(6931471805599453094172319305033 / 10000000000000000000000000000000), (21175823793 / 50000000000000000000000000000000)⟩ +lemma CB6_1_1I0Entropy_sound : CB6_1_1I0Entropy.Encloses (Foundation.finiteEntropy CB6_1_1I0Value) := by + exact contains_sound (entropyFin_enclosed 17 CB6_1_1I0Value CB6_1_1I0Terms CB6_1_1I0Terms_sound) (by decide +kernel) +def CB6_1_1I0Mass : Ball := ⟨1, (13 / 10000000000000000000000000000000)⟩ +lemma CB6_1_1I0Mass_sound : CB6_1_1I0Mass.Encloses (∑ a, CB6_1_1I0Value a) := by + exact contains_sound (finSumBall_sound 17 CB6_1_1I0P CB6_1_1I0Value CB6_1_1I0P_sound) (by decide +kernel) +def CB6_1_1I0MassTermLogWitness : LogWitness := ⟨0, 1, 1⟩ +def CB6_1_1I0MassTermLog : Ball := ⟨0, (5293955953 / 25000000000000000000000000000000)⟩ +lemma CB6_1_1I0MassTermLog_sound : CB6_1_1I0MassTermLog.Encloses (Real.log ((∑ a, CB6_1_1I0Value a))) := by + exact checkLog_sound logTwoBall_sound (CB6_1_1I0Mass_sound) (w := CB6_1_1I0MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB6_1_1I0MassTerm : Ball := ⟨0, (21175823813 / 100000000000000000000000000000000)⟩ +lemma CB6_1_1I0MassTerm_sound : CB6_1_1I0MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB6_1_1I0Value a))) := by + exact contains_sound (entropyTerm_ball (CB6_1_1I0Mass_sound) CB6_1_1I0MassTermLog_sound) (by decide +kernel) +def CB6_1_1I0H : Ball := ⟨(6931471805599453094172319305033 / 10000000000000000000000000000000), (63527471399 / 100000000000000000000000000000000)⟩ +lemma CB6_1_1I0H_sound : CB6_1_1I0H.Encloses (homogeneousEntropy CB6_1_1I0Value) := by + exact contains_sound (homogeneous_enclosed CB6_1_1I0Value CB6_1_1I0MassTerm_sound CB6_1_1I0Entropy_sound) (by decide +kernel) +lemma CB6_1_1I0_sound : CB6_1_1I0H.Encloses (stageBCapacity (shape 6 1 1) 0) := by + exact CB6_1_1I0H_sound + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/CapacityB/CapB6_1_1I1.lean b/lean/OAI/LinearAlgebra/MatrixFields/CapacityB/CapB6_1_1I1.lean new file mode 100644 index 0000000000000000000000000000000000000000..aee07005c3adfa43e5d1e5009fd65a2476dba523 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/CapacityB/CapB6_1_1I1.lean @@ -0,0 +1,824 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Certificates.NativeInterior + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CB6_1_1I1PairValue (a : PairSlot) : ℝ := pairLaw (below (shape 6 1 1)) (shape 6 1 1) (fun u => (stageBLaw (shape 6 1 1) u : ℝ)) (fun u a => (littleLaw (shape 6 1 1) u ((stageBPriority (shape 6 1 1)) 1) a : ℝ)) a +def CB6_1_1I1PairRaw (a : PairSlot) : Ball := pairLawBall (below (shape 6 1 1)) (shape 6 1 1) B6_1_1Law (fun u => B6_1_1Little u ((stageBPriority (shape 6 1 1)) 1)) a +lemma CB6_1_1I1PairRaw_sound (a : PairSlot) : + (CB6_1_1I1PairRaw a).Encloses (CB6_1_1I1PairValue a) := by + exact pairLawBall_sound_on (below (shape 6 1 1)) (shape 6 1 1) B6_1_1Law (fun u => (stageBLaw (shape 6 1 1) u : ℝ)) (fun u => B6_1_1Little u ((stageBPriority (shape 6 1 1)) 1)) (fun u a => (littleLaw (shape 6 1 1) u ((stageBPriority (shape 6 1 1)) 1) a : ℝ)) (fun u _ => B6_1_1Law_sound u) (fun u _ a => B6_1_1Little_sound u ((stageBPriority (shape 6 1 1)) 1) a) (fun u _ a => B6_1_1Little_sound (complement (shape 6 1 1) u) ((stageBPriority (shape 6 1 1)) 1) a) a +def CB6_1_1I1PairCertificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(1 / 2), (13 / 20000000000000000000000000000000)⟩ ⟨(6931471805599453094172319305033 / 20000000000000000000000000000000), (21175823793 / 100000000000000000000000000000000)⟩ ⟨(-6931471805599453094172319305033 / 10000000000000000000000000000000), (8470329499 / 20000000000000000000000000000000)⟩ ⟨-1, 1, 1⟩] +lemma CB6_1_1I1PairCertificates_valid : + CB6_1_1I1PairCertificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB6_1_1I1PairCertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 1, 0 => 1 + | 0, 1 => 1 + | _, _ => 0 +def CB6_1_1I1PairP (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CB6_1_1I1PairCertificates (CB6_1_1I1PairCertificateIndex a)).input +lemma CB6_1_1I1PairP_check : ∀ a : PairSlot, contains (CB6_1_1I1PairRaw a) (CB6_1_1I1PairP a) = true := by + decide +kernel +lemma CB6_1_1I1PairP_sound (a : PairSlot) : + (CB6_1_1I1PairP a).Encloses (CB6_1_1I1PairValue a) := + contains_sound (CB6_1_1I1PairRaw_sound a) (CB6_1_1I1PairP_check a) +def CB6_1_1I1PairTerms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CB6_1_1I1PairCertificates (CB6_1_1I1PairCertificateIndex a)).output +lemma CB6_1_1I1PairTerms_sound (a : PairSlot) : + (CB6_1_1I1PairTerms a).Encloses (Foundation.entropyTerm (CB6_1_1I1PairValue a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB6_1_1I1PairCertificates_valid + (CB6_1_1I1PairCertificateIndex a) (CB6_1_1I1PairP_sound a) +def CB6_1_1I1PairEntropy : Ball := ⟨(6931471805599453094172319305033 / 10000000000000000000000000000000), (21175823793 / 50000000000000000000000000000000)⟩ +lemma CB6_1_1I1PairEntropy_sound : CB6_1_1I1PairEntropy.Encloses (Foundation.finiteEntropy CB6_1_1I1PairValue) := by + exact contains_sound (entropyPair_enclosed CB6_1_1I1PairValue CB6_1_1I1PairTerms CB6_1_1I1PairTerms_sound) (by decide +kernel) +def CB6_1_1I1PairMass : Ball := ⟨1, (13 / 10000000000000000000000000000000)⟩ +lemma CB6_1_1I1PairMass_sound : CB6_1_1I1PairMass.Encloses (∑ a, CB6_1_1I1PairValue a) := by + exact contains_sound (pairSumBall_sound CB6_1_1I1PairP CB6_1_1I1PairValue CB6_1_1I1PairP_sound) (by decide +kernel) +def CB6_1_1I1PairMassTermLogWitness : LogWitness := ⟨0, 1, 1⟩ +def CB6_1_1I1PairMassTermLog : Ball := ⟨0, (5293955953 / 25000000000000000000000000000000)⟩ +lemma CB6_1_1I1PairMassTermLog_sound : CB6_1_1I1PairMassTermLog.Encloses (Real.log ((∑ a, CB6_1_1I1PairValue a))) := by + exact checkLog_sound logTwoBall_sound (CB6_1_1I1PairMass_sound) (w := CB6_1_1I1PairMassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB6_1_1I1PairMassTerm : Ball := ⟨0, (21175823813 / 100000000000000000000000000000000)⟩ +lemma CB6_1_1I1PairMassTerm_sound : CB6_1_1I1PairMassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB6_1_1I1PairValue a))) := by + exact contains_sound (entropyTerm_ball (CB6_1_1I1PairMass_sound) CB6_1_1I1PairMassTermLog_sound) (by decide +kernel) +def CB6_1_1I1PairH : Ball := ⟨(6931471805599453094172319305033 / 10000000000000000000000000000000), (63527471399 / 100000000000000000000000000000000)⟩ +lemma CB6_1_1I1PairH_sound : CB6_1_1I1PairH.Encloses (homogeneousEntropy CB6_1_1I1PairValue) := by + exact contains_sound (homogeneous_enclosed CB6_1_1I1PairValue CB6_1_1I1PairMassTerm_sound CB6_1_1I1PairEntropy_sound) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CB6_1_1I1R0Value (a : Fin 6) : ℝ := residualLaw (below (shape 6 1 1)) (fun u => (stageBLaw (shape 6 1 1) u : ℝ)) (stageBPriority (shape 6 1 1)) 1 (fun u a => (littleLaw (shape 6 1 1) u ((stageBPriority (shape 6 1 1)) 1) a : ℝ)) 0 a +def CB6_1_1I1R0Raw (a : Fin 6) : Ball := residualBall (below (shape 6 1 1)) B6_1_1Law (stageBPriority (shape 6 1 1)) 1 (fun u => B6_1_1Little u ((stageBPriority (shape 6 1 1)) 1)) 0 a +lemma CB6_1_1I1R0Raw_sound (a : Fin 6) : + (CB6_1_1I1R0Raw a).Encloses (CB6_1_1I1R0Value a) := by + exact residualBall_sound_on (below (shape 6 1 1)) B6_1_1Law (fun u => (stageBLaw (shape 6 1 1) u : ℝ)) (stageBPriority (shape 6 1 1)) 1 (fun u => B6_1_1Little u ((stageBPriority (shape 6 1 1)) 1)) (fun u a => (littleLaw (shape 6 1 1) u ((stageBPriority (shape 6 1 1)) 1) a : ℝ)) (fun u _ => B6_1_1Law_sound u) (fun u _ a => B6_1_1Little_sound u ((stageBPriority (shape 6 1 1)) 1) a) 0 a +def CB6_1_1I1R0Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(1 / 2), (13 / 20000000000000000000000000000000)⟩ ⟨(6931471805599453094172319305033 / 20000000000000000000000000000000), (21175823793 / 100000000000000000000000000000000)⟩ ⟨(-6931471805599453094172319305033 / 10000000000000000000000000000000), (8470329499 / 20000000000000000000000000000000)⟩ ⟨-1, 1, 1⟩] +lemma CB6_1_1I1R0Certificates_valid : + CB6_1_1I1R0Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB6_1_1I1R0CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | 0 => 1 + | _ => 0 +def CB6_1_1I1R0P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB6_1_1I1R0Certificates (CB6_1_1I1R0CertificateIndex a)).input +lemma CB6_1_1I1R0P_check : ∀ a : Fin 6, contains (CB6_1_1I1R0Raw a) (CB6_1_1I1R0P a) = true := by + decide +kernel +lemma CB6_1_1I1R0P_sound (a : Fin 6) : + (CB6_1_1I1R0P a).Encloses (CB6_1_1I1R0Value a) := + contains_sound (CB6_1_1I1R0Raw_sound a) (CB6_1_1I1R0P_check a) +def CB6_1_1I1R0Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB6_1_1I1R0Certificates (CB6_1_1I1R0CertificateIndex a)).output +lemma CB6_1_1I1R0Terms_sound (a : Fin 6) : + (CB6_1_1I1R0Terms a).Encloses (Foundation.entropyTerm (CB6_1_1I1R0Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB6_1_1I1R0Certificates_valid + (CB6_1_1I1R0CertificateIndex a) (CB6_1_1I1R0P_sound a) +def CB6_1_1I1R0Entropy : Ball := ⟨(6931471805599453094172319305033 / 20000000000000000000000000000000), (21175823793 / 100000000000000000000000000000000)⟩ +lemma CB6_1_1I1R0Entropy_sound : CB6_1_1I1R0Entropy.Encloses (Foundation.finiteEntropy CB6_1_1I1R0Value) := by + exact contains_sound (entropyFin_enclosed 6 CB6_1_1I1R0Value CB6_1_1I1R0Terms CB6_1_1I1R0Terms_sound) (by decide +kernel) +def CB6_1_1I1R0Mass : Ball := ⟨(1 / 2), (13 / 20000000000000000000000000000000)⟩ +lemma CB6_1_1I1R0Mass_sound : CB6_1_1I1R0Mass.Encloses (∑ a, CB6_1_1I1R0Value a) := by + exact contains_sound (finSumBall_sound 6 CB6_1_1I1R0P CB6_1_1I1R0Value CB6_1_1I1R0P_sound) (by decide +kernel) +def CB6_1_1I1R0MassTermLogWitness : LogWitness := ⟨-1, 1, 1⟩ +def CB6_1_1I1R0MassTermLog : Ball := ⟨(-6931471805599453094172319305033 / 10000000000000000000000000000000), (8470329499 / 20000000000000000000000000000000)⟩ +lemma CB6_1_1I1R0MassTermLog_sound : CB6_1_1I1R0MassTermLog.Encloses (Real.log ((∑ a, CB6_1_1I1R0Value a))) := by + exact checkLog_sound logTwoBall_sound (CB6_1_1I1R0Mass_sound) (w := CB6_1_1I1R0MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB6_1_1I1R0MassTerm : Ball := ⟨(6931471805599453094172319305033 / 20000000000000000000000000000000), (21175823793 / 100000000000000000000000000000000)⟩ +lemma CB6_1_1I1R0MassTerm_sound : CB6_1_1I1R0MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB6_1_1I1R0Value a))) := by + exact contains_sound (entropyTerm_ball (CB6_1_1I1R0Mass_sound) CB6_1_1I1R0MassTermLog_sound) (by decide +kernel) +def CB6_1_1I1R0H : Ball := ⟨0, (21175823793 / 50000000000000000000000000000000)⟩ +lemma CB6_1_1I1R0H_sound : CB6_1_1I1R0H.Encloses (homogeneousEntropy CB6_1_1I1R0Value) := by + exact contains_sound (homogeneous_enclosed CB6_1_1I1R0Value CB6_1_1I1R0MassTerm_sound CB6_1_1I1R0Entropy_sound) (by decide +kernel) +def CB6_1_1I1R1Value (a : Fin 6) : ℝ := residualLaw (below (shape 6 1 1)) (fun u => (stageBLaw (shape 6 1 1) u : ℝ)) (stageBPriority (shape 6 1 1)) 1 (fun u a => (littleLaw (shape 6 1 1) u ((stageBPriority (shape 6 1 1)) 1) a : ℝ)) 1 a +def CB6_1_1I1R1Raw (a : Fin 6) : Ball := residualBall (below (shape 6 1 1)) B6_1_1Law (stageBPriority (shape 6 1 1)) 1 (fun u => B6_1_1Little u ((stageBPriority (shape 6 1 1)) 1)) 1 a +lemma CB6_1_1I1R1Raw_sound (a : Fin 6) : + (CB6_1_1I1R1Raw a).Encloses (CB6_1_1I1R1Value a) := by + exact residualBall_sound_on (below (shape 6 1 1)) B6_1_1Law (fun u => (stageBLaw (shape 6 1 1) u : ℝ)) (stageBPriority (shape 6 1 1)) 1 (fun u => B6_1_1Little u ((stageBPriority (shape 6 1 1)) 1)) (fun u a => (littleLaw (shape 6 1 1) u ((stageBPriority (shape 6 1 1)) 1) a : ℝ)) (fun u _ => B6_1_1Law_sound u) (fun u _ a => B6_1_1Little_sound u ((stageBPriority (shape 6 1 1)) 1) a) 1 a +def CB6_1_1I1R1Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(1 / 2), (13 / 20000000000000000000000000000000)⟩ ⟨(6931471805599453094172319305033 / 20000000000000000000000000000000), (21175823793 / 100000000000000000000000000000000)⟩ ⟨(-6931471805599453094172319305033 / 10000000000000000000000000000000), (8470329499 / 20000000000000000000000000000000)⟩ ⟨-1, 1, 1⟩] +lemma CB6_1_1I1R1Certificates_valid : + CB6_1_1I1R1Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB6_1_1I1R1CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | 1 => 1 + | _ => 0 +def CB6_1_1I1R1P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB6_1_1I1R1Certificates (CB6_1_1I1R1CertificateIndex a)).input +lemma CB6_1_1I1R1P_check : ∀ a : Fin 6, contains (CB6_1_1I1R1Raw a) (CB6_1_1I1R1P a) = true := by + decide +kernel +lemma CB6_1_1I1R1P_sound (a : Fin 6) : + (CB6_1_1I1R1P a).Encloses (CB6_1_1I1R1Value a) := + contains_sound (CB6_1_1I1R1Raw_sound a) (CB6_1_1I1R1P_check a) +def CB6_1_1I1R1Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB6_1_1I1R1Certificates (CB6_1_1I1R1CertificateIndex a)).output +lemma CB6_1_1I1R1Terms_sound (a : Fin 6) : + (CB6_1_1I1R1Terms a).Encloses (Foundation.entropyTerm (CB6_1_1I1R1Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB6_1_1I1R1Certificates_valid + (CB6_1_1I1R1CertificateIndex a) (CB6_1_1I1R1P_sound a) +def CB6_1_1I1R1Entropy : Ball := ⟨(6931471805599453094172319305033 / 20000000000000000000000000000000), (21175823793 / 100000000000000000000000000000000)⟩ +lemma CB6_1_1I1R1Entropy_sound : CB6_1_1I1R1Entropy.Encloses (Foundation.finiteEntropy CB6_1_1I1R1Value) := by + exact contains_sound (entropyFin_enclosed 6 CB6_1_1I1R1Value CB6_1_1I1R1Terms CB6_1_1I1R1Terms_sound) (by decide +kernel) +def CB6_1_1I1R1Mass : Ball := ⟨(1 / 2), (13 / 20000000000000000000000000000000)⟩ +lemma CB6_1_1I1R1Mass_sound : CB6_1_1I1R1Mass.Encloses (∑ a, CB6_1_1I1R1Value a) := by + exact contains_sound (finSumBall_sound 6 CB6_1_1I1R1P CB6_1_1I1R1Value CB6_1_1I1R1P_sound) (by decide +kernel) +def CB6_1_1I1R1MassTermLogWitness : LogWitness := ⟨-1, 1, 1⟩ +def CB6_1_1I1R1MassTermLog : Ball := ⟨(-6931471805599453094172319305033 / 10000000000000000000000000000000), (8470329499 / 20000000000000000000000000000000)⟩ +lemma CB6_1_1I1R1MassTermLog_sound : CB6_1_1I1R1MassTermLog.Encloses (Real.log ((∑ a, CB6_1_1I1R1Value a))) := by + exact checkLog_sound logTwoBall_sound (CB6_1_1I1R1Mass_sound) (w := CB6_1_1I1R1MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB6_1_1I1R1MassTerm : Ball := ⟨(6931471805599453094172319305033 / 20000000000000000000000000000000), (21175823793 / 100000000000000000000000000000000)⟩ +lemma CB6_1_1I1R1MassTerm_sound : CB6_1_1I1R1MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB6_1_1I1R1Value a))) := by + exact contains_sound (entropyTerm_ball (CB6_1_1I1R1Mass_sound) CB6_1_1I1R1MassTermLog_sound) (by decide +kernel) +def CB6_1_1I1R1H : Ball := ⟨0, (21175823793 / 50000000000000000000000000000000)⟩ +lemma CB6_1_1I1R1H_sound : CB6_1_1I1R1H.Encloses (homogeneousEntropy CB6_1_1I1R1Value) := by + exact contains_sound (homogeneous_enclosed CB6_1_1I1R1Value CB6_1_1I1R1MassTerm_sound CB6_1_1I1R1Entropy_sound) (by decide +kernel) +def CB6_1_1I1R2Value (a : Fin 6) : ℝ := residualLaw (below (shape 6 1 1)) (fun u => (stageBLaw (shape 6 1 1) u : ℝ)) (stageBPriority (shape 6 1 1)) 1 (fun u a => (littleLaw (shape 6 1 1) u ((stageBPriority (shape 6 1 1)) 1) a : ℝ)) 2 a +def CB6_1_1I1R2Raw (a : Fin 6) : Ball := residualBall (below (shape 6 1 1)) B6_1_1Law (stageBPriority (shape 6 1 1)) 1 (fun u => B6_1_1Little u ((stageBPriority (shape 6 1 1)) 1)) 2 a +lemma CB6_1_1I1R2Raw_sound (a : Fin 6) : + (CB6_1_1I1R2Raw a).Encloses (CB6_1_1I1R2Value a) := by + exact residualBall_sound_on (below (shape 6 1 1)) B6_1_1Law (fun u => (stageBLaw (shape 6 1 1) u : ℝ)) (stageBPriority (shape 6 1 1)) 1 (fun u => B6_1_1Little u ((stageBPriority (shape 6 1 1)) 1)) (fun u a => (littleLaw (shape 6 1 1) u ((stageBPriority (shape 6 1 1)) 1) a : ℝ)) (fun u _ => B6_1_1Law_sound u) (fun u _ a => B6_1_1Little_sound u ((stageBPriority (shape 6 1 1)) 1) a) 2 a +def CB6_1_1I1R2Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB6_1_1I1R2Certificates_valid : + CB6_1_1I1R2Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB6_1_1I1R2CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB6_1_1I1R2P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB6_1_1I1R2Certificates (CB6_1_1I1R2CertificateIndex a)).input +lemma CB6_1_1I1R2P_check : ∀ a : Fin 6, contains (CB6_1_1I1R2Raw a) (CB6_1_1I1R2P a) = true := by + decide +kernel +lemma CB6_1_1I1R2P_sound (a : Fin 6) : + (CB6_1_1I1R2P a).Encloses (CB6_1_1I1R2Value a) := + contains_sound (CB6_1_1I1R2Raw_sound a) (CB6_1_1I1R2P_check a) +def CB6_1_1I1R2Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB6_1_1I1R2Certificates (CB6_1_1I1R2CertificateIndex a)).output +lemma CB6_1_1I1R2Terms_sound (a : Fin 6) : + (CB6_1_1I1R2Terms a).Encloses (Foundation.entropyTerm (CB6_1_1I1R2Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB6_1_1I1R2Certificates_valid + (CB6_1_1I1R2CertificateIndex a) (CB6_1_1I1R2P_sound a) +def CB6_1_1I1R2Entropy : Ball := ⟨0, 0⟩ +lemma CB6_1_1I1R2Entropy_sound : CB6_1_1I1R2Entropy.Encloses (Foundation.finiteEntropy CB6_1_1I1R2Value) := by + exact contains_sound (entropyFin_enclosed 6 CB6_1_1I1R2Value CB6_1_1I1R2Terms CB6_1_1I1R2Terms_sound) (by decide +kernel) +def CB6_1_1I1R2Mass : Ball := ⟨0, 0⟩ +lemma CB6_1_1I1R2Mass_sound : CB6_1_1I1R2Mass.Encloses (∑ a, CB6_1_1I1R2Value a) := by + exact contains_sound (finSumBall_sound 6 CB6_1_1I1R2P CB6_1_1I1R2Value CB6_1_1I1R2P_sound) (by decide +kernel) +def CB6_1_1I1R2MassTerm : Ball := .exact 0 +lemma CB6_1_1I1R2MassTerm_sound : CB6_1_1I1R2MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB6_1_1I1R2Value a))) := + entropyTerm_zero_ball (CB6_1_1I1R2Mass_sound) +def CB6_1_1I1R2H : Ball := ⟨0, 0⟩ +lemma CB6_1_1I1R2H_sound : CB6_1_1I1R2H.Encloses (homogeneousEntropy CB6_1_1I1R2Value) := by + exact contains_sound (homogeneous_enclosed CB6_1_1I1R2Value CB6_1_1I1R2MassTerm_sound CB6_1_1I1R2Entropy_sound) (by decide +kernel) +def CB6_1_1I1R3Value (a : Fin 6) : ℝ := residualLaw (below (shape 6 1 1)) (fun u => (stageBLaw (shape 6 1 1) u : ℝ)) (stageBPriority (shape 6 1 1)) 1 (fun u a => (littleLaw (shape 6 1 1) u ((stageBPriority (shape 6 1 1)) 1) a : ℝ)) 3 a +def CB6_1_1I1R3Raw (a : Fin 6) : Ball := residualBall (below (shape 6 1 1)) B6_1_1Law (stageBPriority (shape 6 1 1)) 1 (fun u => B6_1_1Little u ((stageBPriority (shape 6 1 1)) 1)) 3 a +lemma CB6_1_1I1R3Raw_sound (a : Fin 6) : + (CB6_1_1I1R3Raw a).Encloses (CB6_1_1I1R3Value a) := by + exact residualBall_sound_on (below (shape 6 1 1)) B6_1_1Law (fun u => (stageBLaw (shape 6 1 1) u : ℝ)) (stageBPriority (shape 6 1 1)) 1 (fun u => B6_1_1Little u ((stageBPriority (shape 6 1 1)) 1)) (fun u a => (littleLaw (shape 6 1 1) u ((stageBPriority (shape 6 1 1)) 1) a : ℝ)) (fun u _ => B6_1_1Law_sound u) (fun u _ a => B6_1_1Little_sound u ((stageBPriority (shape 6 1 1)) 1) a) 3 a +def CB6_1_1I1R3Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB6_1_1I1R3Certificates_valid : + CB6_1_1I1R3Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB6_1_1I1R3CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB6_1_1I1R3P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB6_1_1I1R3Certificates (CB6_1_1I1R3CertificateIndex a)).input +lemma CB6_1_1I1R3P_check : ∀ a : Fin 6, contains (CB6_1_1I1R3Raw a) (CB6_1_1I1R3P a) = true := by + decide +kernel +lemma CB6_1_1I1R3P_sound (a : Fin 6) : + (CB6_1_1I1R3P a).Encloses (CB6_1_1I1R3Value a) := + contains_sound (CB6_1_1I1R3Raw_sound a) (CB6_1_1I1R3P_check a) +def CB6_1_1I1R3Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB6_1_1I1R3Certificates (CB6_1_1I1R3CertificateIndex a)).output +lemma CB6_1_1I1R3Terms_sound (a : Fin 6) : + (CB6_1_1I1R3Terms a).Encloses (Foundation.entropyTerm (CB6_1_1I1R3Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB6_1_1I1R3Certificates_valid + (CB6_1_1I1R3CertificateIndex a) (CB6_1_1I1R3P_sound a) +def CB6_1_1I1R3Entropy : Ball := ⟨0, 0⟩ +lemma CB6_1_1I1R3Entropy_sound : CB6_1_1I1R3Entropy.Encloses (Foundation.finiteEntropy CB6_1_1I1R3Value) := by + exact contains_sound (entropyFin_enclosed 6 CB6_1_1I1R3Value CB6_1_1I1R3Terms CB6_1_1I1R3Terms_sound) (by decide +kernel) +def CB6_1_1I1R3Mass : Ball := ⟨0, 0⟩ +lemma CB6_1_1I1R3Mass_sound : CB6_1_1I1R3Mass.Encloses (∑ a, CB6_1_1I1R3Value a) := by + exact contains_sound (finSumBall_sound 6 CB6_1_1I1R3P CB6_1_1I1R3Value CB6_1_1I1R3P_sound) (by decide +kernel) +def CB6_1_1I1R3MassTerm : Ball := .exact 0 +lemma CB6_1_1I1R3MassTerm_sound : CB6_1_1I1R3MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB6_1_1I1R3Value a))) := + entropyTerm_zero_ball (CB6_1_1I1R3Mass_sound) +def CB6_1_1I1R3H : Ball := ⟨0, 0⟩ +lemma CB6_1_1I1R3H_sound : CB6_1_1I1R3H.Encloses (homogeneousEntropy CB6_1_1I1R3Value) := by + exact contains_sound (homogeneous_enclosed CB6_1_1I1R3Value CB6_1_1I1R3MassTerm_sound CB6_1_1I1R3Entropy_sound) (by decide +kernel) +def CB6_1_1I1R4Value (a : Fin 6) : ℝ := residualLaw (below (shape 6 1 1)) (fun u => (stageBLaw (shape 6 1 1) u : ℝ)) (stageBPriority (shape 6 1 1)) 1 (fun u a => (littleLaw (shape 6 1 1) u ((stageBPriority (shape 6 1 1)) 1) a : ℝ)) 4 a +def CB6_1_1I1R4Raw (a : Fin 6) : Ball := residualBall (below (shape 6 1 1)) B6_1_1Law (stageBPriority (shape 6 1 1)) 1 (fun u => B6_1_1Little u ((stageBPriority (shape 6 1 1)) 1)) 4 a +lemma CB6_1_1I1R4Raw_sound (a : Fin 6) : + (CB6_1_1I1R4Raw a).Encloses (CB6_1_1I1R4Value a) := by + exact residualBall_sound_on (below (shape 6 1 1)) B6_1_1Law (fun u => (stageBLaw (shape 6 1 1) u : ℝ)) (stageBPriority (shape 6 1 1)) 1 (fun u => B6_1_1Little u ((stageBPriority (shape 6 1 1)) 1)) (fun u a => (littleLaw (shape 6 1 1) u ((stageBPriority (shape 6 1 1)) 1) a : ℝ)) (fun u _ => B6_1_1Law_sound u) (fun u _ a => B6_1_1Little_sound u ((stageBPriority (shape 6 1 1)) 1) a) 4 a +def CB6_1_1I1R4Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB6_1_1I1R4Certificates_valid : + CB6_1_1I1R4Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB6_1_1I1R4CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB6_1_1I1R4P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB6_1_1I1R4Certificates (CB6_1_1I1R4CertificateIndex a)).input +lemma CB6_1_1I1R4P_check : ∀ a : Fin 6, contains (CB6_1_1I1R4Raw a) (CB6_1_1I1R4P a) = true := by + decide +kernel +lemma CB6_1_1I1R4P_sound (a : Fin 6) : + (CB6_1_1I1R4P a).Encloses (CB6_1_1I1R4Value a) := + contains_sound (CB6_1_1I1R4Raw_sound a) (CB6_1_1I1R4P_check a) +def CB6_1_1I1R4Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB6_1_1I1R4Certificates (CB6_1_1I1R4CertificateIndex a)).output +lemma CB6_1_1I1R4Terms_sound (a : Fin 6) : + (CB6_1_1I1R4Terms a).Encloses (Foundation.entropyTerm (CB6_1_1I1R4Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB6_1_1I1R4Certificates_valid + (CB6_1_1I1R4CertificateIndex a) (CB6_1_1I1R4P_sound a) +def CB6_1_1I1R4Entropy : Ball := ⟨0, 0⟩ +lemma CB6_1_1I1R4Entropy_sound : CB6_1_1I1R4Entropy.Encloses (Foundation.finiteEntropy CB6_1_1I1R4Value) := by + exact contains_sound (entropyFin_enclosed 6 CB6_1_1I1R4Value CB6_1_1I1R4Terms CB6_1_1I1R4Terms_sound) (by decide +kernel) +def CB6_1_1I1R4Mass : Ball := ⟨0, 0⟩ +lemma CB6_1_1I1R4Mass_sound : CB6_1_1I1R4Mass.Encloses (∑ a, CB6_1_1I1R4Value a) := by + exact contains_sound (finSumBall_sound 6 CB6_1_1I1R4P CB6_1_1I1R4Value CB6_1_1I1R4P_sound) (by decide +kernel) +def CB6_1_1I1R4MassTerm : Ball := .exact 0 +lemma CB6_1_1I1R4MassTerm_sound : CB6_1_1I1R4MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB6_1_1I1R4Value a))) := + entropyTerm_zero_ball (CB6_1_1I1R4Mass_sound) +def CB6_1_1I1R4H : Ball := ⟨0, 0⟩ +lemma CB6_1_1I1R4H_sound : CB6_1_1I1R4H.Encloses (homogeneousEntropy CB6_1_1I1R4Value) := by + exact contains_sound (homogeneous_enclosed CB6_1_1I1R4Value CB6_1_1I1R4MassTerm_sound CB6_1_1I1R4Entropy_sound) (by decide +kernel) +def CB6_1_1I1R5Value (a : Fin 6) : ℝ := residualLaw (below (shape 6 1 1)) (fun u => (stageBLaw (shape 6 1 1) u : ℝ)) (stageBPriority (shape 6 1 1)) 1 (fun u a => (littleLaw (shape 6 1 1) u ((stageBPriority (shape 6 1 1)) 1) a : ℝ)) 5 a +def CB6_1_1I1R5Raw (a : Fin 6) : Ball := residualBall (below (shape 6 1 1)) B6_1_1Law (stageBPriority (shape 6 1 1)) 1 (fun u => B6_1_1Little u ((stageBPriority (shape 6 1 1)) 1)) 5 a +lemma CB6_1_1I1R5Raw_sound (a : Fin 6) : + (CB6_1_1I1R5Raw a).Encloses (CB6_1_1I1R5Value a) := by + exact residualBall_sound_on (below (shape 6 1 1)) B6_1_1Law (fun u => (stageBLaw (shape 6 1 1) u : ℝ)) (stageBPriority (shape 6 1 1)) 1 (fun u => B6_1_1Little u ((stageBPriority (shape 6 1 1)) 1)) (fun u a => (littleLaw (shape 6 1 1) u ((stageBPriority (shape 6 1 1)) 1) a : ℝ)) (fun u _ => B6_1_1Law_sound u) (fun u _ a => B6_1_1Little_sound u ((stageBPriority (shape 6 1 1)) 1) a) 5 a +def CB6_1_1I1R5Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB6_1_1I1R5Certificates_valid : + CB6_1_1I1R5Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB6_1_1I1R5CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB6_1_1I1R5P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB6_1_1I1R5Certificates (CB6_1_1I1R5CertificateIndex a)).input +lemma CB6_1_1I1R5P_check : ∀ a : Fin 6, contains (CB6_1_1I1R5Raw a) (CB6_1_1I1R5P a) = true := by + decide +kernel +lemma CB6_1_1I1R5P_sound (a : Fin 6) : + (CB6_1_1I1R5P a).Encloses (CB6_1_1I1R5Value a) := + contains_sound (CB6_1_1I1R5Raw_sound a) (CB6_1_1I1R5P_check a) +def CB6_1_1I1R5Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB6_1_1I1R5Certificates (CB6_1_1I1R5CertificateIndex a)).output +lemma CB6_1_1I1R5Terms_sound (a : Fin 6) : + (CB6_1_1I1R5Terms a).Encloses (Foundation.entropyTerm (CB6_1_1I1R5Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB6_1_1I1R5Certificates_valid + (CB6_1_1I1R5CertificateIndex a) (CB6_1_1I1R5P_sound a) +def CB6_1_1I1R5Entropy : Ball := ⟨0, 0⟩ +lemma CB6_1_1I1R5Entropy_sound : CB6_1_1I1R5Entropy.Encloses (Foundation.finiteEntropy CB6_1_1I1R5Value) := by + exact contains_sound (entropyFin_enclosed 6 CB6_1_1I1R5Value CB6_1_1I1R5Terms CB6_1_1I1R5Terms_sound) (by decide +kernel) +def CB6_1_1I1R5Mass : Ball := ⟨0, 0⟩ +lemma CB6_1_1I1R5Mass_sound : CB6_1_1I1R5Mass.Encloses (∑ a, CB6_1_1I1R5Value a) := by + exact contains_sound (finSumBall_sound 6 CB6_1_1I1R5P CB6_1_1I1R5Value CB6_1_1I1R5P_sound) (by decide +kernel) +def CB6_1_1I1R5MassTerm : Ball := .exact 0 +lemma CB6_1_1I1R5MassTerm_sound : CB6_1_1I1R5MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB6_1_1I1R5Value a))) := + entropyTerm_zero_ball (CB6_1_1I1R5Mass_sound) +def CB6_1_1I1R5H : Ball := ⟨0, 0⟩ +lemma CB6_1_1I1R5H_sound : CB6_1_1I1R5H.Encloses (homogeneousEntropy CB6_1_1I1R5Value) := by + exact contains_sound (homogeneous_enclosed CB6_1_1I1R5Value CB6_1_1I1R5MassTerm_sound CB6_1_1I1R5Entropy_sound) (by decide +kernel) +def CB6_1_1I1R6Value (a : Fin 6) : ℝ := residualLaw (below (shape 6 1 1)) (fun u => (stageBLaw (shape 6 1 1) u : ℝ)) (stageBPriority (shape 6 1 1)) 1 (fun u a => (littleLaw (shape 6 1 1) u ((stageBPriority (shape 6 1 1)) 1) a : ℝ)) 6 a +def CB6_1_1I1R6Raw (a : Fin 6) : Ball := residualBall (below (shape 6 1 1)) B6_1_1Law (stageBPriority (shape 6 1 1)) 1 (fun u => B6_1_1Little u ((stageBPriority (shape 6 1 1)) 1)) 6 a +lemma CB6_1_1I1R6Raw_sound (a : Fin 6) : + (CB6_1_1I1R6Raw a).Encloses (CB6_1_1I1R6Value a) := by + exact residualBall_sound_on (below (shape 6 1 1)) B6_1_1Law (fun u => (stageBLaw (shape 6 1 1) u : ℝ)) (stageBPriority (shape 6 1 1)) 1 (fun u => B6_1_1Little u ((stageBPriority (shape 6 1 1)) 1)) (fun u a => (littleLaw (shape 6 1 1) u ((stageBPriority (shape 6 1 1)) 1) a : ℝ)) (fun u _ => B6_1_1Law_sound u) (fun u _ a => B6_1_1Little_sound u ((stageBPriority (shape 6 1 1)) 1) a) 6 a +def CB6_1_1I1R6Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB6_1_1I1R6Certificates_valid : + CB6_1_1I1R6Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB6_1_1I1R6CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB6_1_1I1R6P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB6_1_1I1R6Certificates (CB6_1_1I1R6CertificateIndex a)).input +lemma CB6_1_1I1R6P_check : ∀ a : Fin 6, contains (CB6_1_1I1R6Raw a) (CB6_1_1I1R6P a) = true := by + decide +kernel +lemma CB6_1_1I1R6P_sound (a : Fin 6) : + (CB6_1_1I1R6P a).Encloses (CB6_1_1I1R6Value a) := + contains_sound (CB6_1_1I1R6Raw_sound a) (CB6_1_1I1R6P_check a) +def CB6_1_1I1R6Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB6_1_1I1R6Certificates (CB6_1_1I1R6CertificateIndex a)).output +lemma CB6_1_1I1R6Terms_sound (a : Fin 6) : + (CB6_1_1I1R6Terms a).Encloses (Foundation.entropyTerm (CB6_1_1I1R6Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB6_1_1I1R6Certificates_valid + (CB6_1_1I1R6CertificateIndex a) (CB6_1_1I1R6P_sound a) +def CB6_1_1I1R6Entropy : Ball := ⟨0, 0⟩ +lemma CB6_1_1I1R6Entropy_sound : CB6_1_1I1R6Entropy.Encloses (Foundation.finiteEntropy CB6_1_1I1R6Value) := by + exact contains_sound (entropyFin_enclosed 6 CB6_1_1I1R6Value CB6_1_1I1R6Terms CB6_1_1I1R6Terms_sound) (by decide +kernel) +def CB6_1_1I1R6Mass : Ball := ⟨0, 0⟩ +lemma CB6_1_1I1R6Mass_sound : CB6_1_1I1R6Mass.Encloses (∑ a, CB6_1_1I1R6Value a) := by + exact contains_sound (finSumBall_sound 6 CB6_1_1I1R6P CB6_1_1I1R6Value CB6_1_1I1R6P_sound) (by decide +kernel) +def CB6_1_1I1R6MassTerm : Ball := .exact 0 +lemma CB6_1_1I1R6MassTerm_sound : CB6_1_1I1R6MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB6_1_1I1R6Value a))) := + entropyTerm_zero_ball (CB6_1_1I1R6Mass_sound) +def CB6_1_1I1R6H : Ball := ⟨0, 0⟩ +lemma CB6_1_1I1R6H_sound : CB6_1_1I1R6H.Encloses (homogeneousEntropy CB6_1_1I1R6Value) := by + exact contains_sound (homogeneous_enclosed CB6_1_1I1R6Value CB6_1_1I1R6MassTerm_sound CB6_1_1I1R6Entropy_sound) (by decide +kernel) +def CB6_1_1I1R7Value (a : Fin 6) : ℝ := residualLaw (below (shape 6 1 1)) (fun u => (stageBLaw (shape 6 1 1) u : ℝ)) (stageBPriority (shape 6 1 1)) 1 (fun u a => (littleLaw (shape 6 1 1) u ((stageBPriority (shape 6 1 1)) 1) a : ℝ)) 7 a +def CB6_1_1I1R7Raw (a : Fin 6) : Ball := residualBall (below (shape 6 1 1)) B6_1_1Law (stageBPriority (shape 6 1 1)) 1 (fun u => B6_1_1Little u ((stageBPriority (shape 6 1 1)) 1)) 7 a +lemma CB6_1_1I1R7Raw_sound (a : Fin 6) : + (CB6_1_1I1R7Raw a).Encloses (CB6_1_1I1R7Value a) := by + exact residualBall_sound_on (below (shape 6 1 1)) B6_1_1Law (fun u => (stageBLaw (shape 6 1 1) u : ℝ)) (stageBPriority (shape 6 1 1)) 1 (fun u => B6_1_1Little u ((stageBPriority (shape 6 1 1)) 1)) (fun u a => (littleLaw (shape 6 1 1) u ((stageBPriority (shape 6 1 1)) 1) a : ℝ)) (fun u _ => B6_1_1Law_sound u) (fun u _ a => B6_1_1Little_sound u ((stageBPriority (shape 6 1 1)) 1) a) 7 a +def CB6_1_1I1R7Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB6_1_1I1R7Certificates_valid : + CB6_1_1I1R7Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB6_1_1I1R7CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB6_1_1I1R7P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB6_1_1I1R7Certificates (CB6_1_1I1R7CertificateIndex a)).input +lemma CB6_1_1I1R7P_check : ∀ a : Fin 6, contains (CB6_1_1I1R7Raw a) (CB6_1_1I1R7P a) = true := by + decide +kernel +lemma CB6_1_1I1R7P_sound (a : Fin 6) : + (CB6_1_1I1R7P a).Encloses (CB6_1_1I1R7Value a) := + contains_sound (CB6_1_1I1R7Raw_sound a) (CB6_1_1I1R7P_check a) +def CB6_1_1I1R7Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB6_1_1I1R7Certificates (CB6_1_1I1R7CertificateIndex a)).output +lemma CB6_1_1I1R7Terms_sound (a : Fin 6) : + (CB6_1_1I1R7Terms a).Encloses (Foundation.entropyTerm (CB6_1_1I1R7Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB6_1_1I1R7Certificates_valid + (CB6_1_1I1R7CertificateIndex a) (CB6_1_1I1R7P_sound a) +def CB6_1_1I1R7Entropy : Ball := ⟨0, 0⟩ +lemma CB6_1_1I1R7Entropy_sound : CB6_1_1I1R7Entropy.Encloses (Foundation.finiteEntropy CB6_1_1I1R7Value) := by + exact contains_sound (entropyFin_enclosed 6 CB6_1_1I1R7Value CB6_1_1I1R7Terms CB6_1_1I1R7Terms_sound) (by decide +kernel) +def CB6_1_1I1R7Mass : Ball := ⟨0, 0⟩ +lemma CB6_1_1I1R7Mass_sound : CB6_1_1I1R7Mass.Encloses (∑ a, CB6_1_1I1R7Value a) := by + exact contains_sound (finSumBall_sound 6 CB6_1_1I1R7P CB6_1_1I1R7Value CB6_1_1I1R7P_sound) (by decide +kernel) +def CB6_1_1I1R7MassTerm : Ball := .exact 0 +lemma CB6_1_1I1R7MassTerm_sound : CB6_1_1I1R7MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB6_1_1I1R7Value a))) := + entropyTerm_zero_ball (CB6_1_1I1R7Mass_sound) +def CB6_1_1I1R7H : Ball := ⟨0, 0⟩ +lemma CB6_1_1I1R7H_sound : CB6_1_1I1R7H.Encloses (homogeneousEntropy CB6_1_1I1R7Value) := by + exact contains_sound (homogeneous_enclosed CB6_1_1I1R7Value CB6_1_1I1R7MassTerm_sound CB6_1_1I1R7Entropy_sound) (by decide +kernel) +def CB6_1_1I1R8Value (a : Fin 6) : ℝ := residualLaw (below (shape 6 1 1)) (fun u => (stageBLaw (shape 6 1 1) u : ℝ)) (stageBPriority (shape 6 1 1)) 1 (fun u a => (littleLaw (shape 6 1 1) u ((stageBPriority (shape 6 1 1)) 1) a : ℝ)) 8 a +def CB6_1_1I1R8Raw (a : Fin 6) : Ball := residualBall (below (shape 6 1 1)) B6_1_1Law (stageBPriority (shape 6 1 1)) 1 (fun u => B6_1_1Little u ((stageBPriority (shape 6 1 1)) 1)) 8 a +lemma CB6_1_1I1R8Raw_sound (a : Fin 6) : + (CB6_1_1I1R8Raw a).Encloses (CB6_1_1I1R8Value a) := by + exact residualBall_sound_on (below (shape 6 1 1)) B6_1_1Law (fun u => (stageBLaw (shape 6 1 1) u : ℝ)) (stageBPriority (shape 6 1 1)) 1 (fun u => B6_1_1Little u ((stageBPriority (shape 6 1 1)) 1)) (fun u a => (littleLaw (shape 6 1 1) u ((stageBPriority (shape 6 1 1)) 1) a : ℝ)) (fun u _ => B6_1_1Law_sound u) (fun u _ a => B6_1_1Little_sound u ((stageBPriority (shape 6 1 1)) 1) a) 8 a +def CB6_1_1I1R8Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB6_1_1I1R8Certificates_valid : + CB6_1_1I1R8Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB6_1_1I1R8CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB6_1_1I1R8P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB6_1_1I1R8Certificates (CB6_1_1I1R8CertificateIndex a)).input +lemma CB6_1_1I1R8P_check : ∀ a : Fin 6, contains (CB6_1_1I1R8Raw a) (CB6_1_1I1R8P a) = true := by + decide +kernel +lemma CB6_1_1I1R8P_sound (a : Fin 6) : + (CB6_1_1I1R8P a).Encloses (CB6_1_1I1R8Value a) := + contains_sound (CB6_1_1I1R8Raw_sound a) (CB6_1_1I1R8P_check a) +def CB6_1_1I1R8Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB6_1_1I1R8Certificates (CB6_1_1I1R8CertificateIndex a)).output +lemma CB6_1_1I1R8Terms_sound (a : Fin 6) : + (CB6_1_1I1R8Terms a).Encloses (Foundation.entropyTerm (CB6_1_1I1R8Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB6_1_1I1R8Certificates_valid + (CB6_1_1I1R8CertificateIndex a) (CB6_1_1I1R8P_sound a) +def CB6_1_1I1R8Entropy : Ball := ⟨0, 0⟩ +lemma CB6_1_1I1R8Entropy_sound : CB6_1_1I1R8Entropy.Encloses (Foundation.finiteEntropy CB6_1_1I1R8Value) := by + exact contains_sound (entropyFin_enclosed 6 CB6_1_1I1R8Value CB6_1_1I1R8Terms CB6_1_1I1R8Terms_sound) (by decide +kernel) +def CB6_1_1I1R8Mass : Ball := ⟨0, 0⟩ +lemma CB6_1_1I1R8Mass_sound : CB6_1_1I1R8Mass.Encloses (∑ a, CB6_1_1I1R8Value a) := by + exact contains_sound (finSumBall_sound 6 CB6_1_1I1R8P CB6_1_1I1R8Value CB6_1_1I1R8P_sound) (by decide +kernel) +def CB6_1_1I1R8MassTerm : Ball := .exact 0 +lemma CB6_1_1I1R8MassTerm_sound : CB6_1_1I1R8MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB6_1_1I1R8Value a))) := + entropyTerm_zero_ball (CB6_1_1I1R8Mass_sound) +def CB6_1_1I1R8H : Ball := ⟨0, 0⟩ +lemma CB6_1_1I1R8H_sound : CB6_1_1I1R8H.Encloses (homogeneousEntropy CB6_1_1I1R8Value) := by + exact contains_sound (homogeneous_enclosed CB6_1_1I1R8Value CB6_1_1I1R8MassTerm_sound CB6_1_1I1R8Entropy_sound) (by decide +kernel) +def CB6_1_1I1R9Value (a : Fin 6) : ℝ := residualLaw (below (shape 6 1 1)) (fun u => (stageBLaw (shape 6 1 1) u : ℝ)) (stageBPriority (shape 6 1 1)) 1 (fun u a => (littleLaw (shape 6 1 1) u ((stageBPriority (shape 6 1 1)) 1) a : ℝ)) 9 a +def CB6_1_1I1R9Raw (a : Fin 6) : Ball := residualBall (below (shape 6 1 1)) B6_1_1Law (stageBPriority (shape 6 1 1)) 1 (fun u => B6_1_1Little u ((stageBPriority (shape 6 1 1)) 1)) 9 a +lemma CB6_1_1I1R9Raw_sound (a : Fin 6) : + (CB6_1_1I1R9Raw a).Encloses (CB6_1_1I1R9Value a) := by + exact residualBall_sound_on (below (shape 6 1 1)) B6_1_1Law (fun u => (stageBLaw (shape 6 1 1) u : ℝ)) (stageBPriority (shape 6 1 1)) 1 (fun u => B6_1_1Little u ((stageBPriority (shape 6 1 1)) 1)) (fun u a => (littleLaw (shape 6 1 1) u ((stageBPriority (shape 6 1 1)) 1) a : ℝ)) (fun u _ => B6_1_1Law_sound u) (fun u _ a => B6_1_1Little_sound u ((stageBPriority (shape 6 1 1)) 1) a) 9 a +def CB6_1_1I1R9Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB6_1_1I1R9Certificates_valid : + CB6_1_1I1R9Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB6_1_1I1R9CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB6_1_1I1R9P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB6_1_1I1R9Certificates (CB6_1_1I1R9CertificateIndex a)).input +lemma CB6_1_1I1R9P_check : ∀ a : Fin 6, contains (CB6_1_1I1R9Raw a) (CB6_1_1I1R9P a) = true := by + decide +kernel +lemma CB6_1_1I1R9P_sound (a : Fin 6) : + (CB6_1_1I1R9P a).Encloses (CB6_1_1I1R9Value a) := + contains_sound (CB6_1_1I1R9Raw_sound a) (CB6_1_1I1R9P_check a) +def CB6_1_1I1R9Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB6_1_1I1R9Certificates (CB6_1_1I1R9CertificateIndex a)).output +lemma CB6_1_1I1R9Terms_sound (a : Fin 6) : + (CB6_1_1I1R9Terms a).Encloses (Foundation.entropyTerm (CB6_1_1I1R9Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB6_1_1I1R9Certificates_valid + (CB6_1_1I1R9CertificateIndex a) (CB6_1_1I1R9P_sound a) +def CB6_1_1I1R9Entropy : Ball := ⟨0, 0⟩ +lemma CB6_1_1I1R9Entropy_sound : CB6_1_1I1R9Entropy.Encloses (Foundation.finiteEntropy CB6_1_1I1R9Value) := by + exact contains_sound (entropyFin_enclosed 6 CB6_1_1I1R9Value CB6_1_1I1R9Terms CB6_1_1I1R9Terms_sound) (by decide +kernel) +def CB6_1_1I1R9Mass : Ball := ⟨0, 0⟩ +lemma CB6_1_1I1R9Mass_sound : CB6_1_1I1R9Mass.Encloses (∑ a, CB6_1_1I1R9Value a) := by + exact contains_sound (finSumBall_sound 6 CB6_1_1I1R9P CB6_1_1I1R9Value CB6_1_1I1R9P_sound) (by decide +kernel) +def CB6_1_1I1R9MassTerm : Ball := .exact 0 +lemma CB6_1_1I1R9MassTerm_sound : CB6_1_1I1R9MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB6_1_1I1R9Value a))) := + entropyTerm_zero_ball (CB6_1_1I1R9Mass_sound) +def CB6_1_1I1R9H : Ball := ⟨0, 0⟩ +lemma CB6_1_1I1R9H_sound : CB6_1_1I1R9H.Encloses (homogeneousEntropy CB6_1_1I1R9Value) := by + exact contains_sound (homogeneous_enclosed CB6_1_1I1R9Value CB6_1_1I1R9MassTerm_sound CB6_1_1I1R9Entropy_sound) (by decide +kernel) +def CB6_1_1I1R10Value (a : Fin 6) : ℝ := residualLaw (below (shape 6 1 1)) (fun u => (stageBLaw (shape 6 1 1) u : ℝ)) (stageBPriority (shape 6 1 1)) 1 (fun u a => (littleLaw (shape 6 1 1) u ((stageBPriority (shape 6 1 1)) 1) a : ℝ)) 10 a +def CB6_1_1I1R10Raw (a : Fin 6) : Ball := residualBall (below (shape 6 1 1)) B6_1_1Law (stageBPriority (shape 6 1 1)) 1 (fun u => B6_1_1Little u ((stageBPriority (shape 6 1 1)) 1)) 10 a +lemma CB6_1_1I1R10Raw_sound (a : Fin 6) : + (CB6_1_1I1R10Raw a).Encloses (CB6_1_1I1R10Value a) := by + exact residualBall_sound_on (below (shape 6 1 1)) B6_1_1Law (fun u => (stageBLaw (shape 6 1 1) u : ℝ)) (stageBPriority (shape 6 1 1)) 1 (fun u => B6_1_1Little u ((stageBPriority (shape 6 1 1)) 1)) (fun u a => (littleLaw (shape 6 1 1) u ((stageBPriority (shape 6 1 1)) 1) a : ℝ)) (fun u _ => B6_1_1Law_sound u) (fun u _ a => B6_1_1Little_sound u ((stageBPriority (shape 6 1 1)) 1) a) 10 a +def CB6_1_1I1R10Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB6_1_1I1R10Certificates_valid : + CB6_1_1I1R10Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB6_1_1I1R10CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB6_1_1I1R10P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB6_1_1I1R10Certificates (CB6_1_1I1R10CertificateIndex a)).input +lemma CB6_1_1I1R10P_check : ∀ a : Fin 6, contains (CB6_1_1I1R10Raw a) (CB6_1_1I1R10P a) = true := by + decide +kernel +lemma CB6_1_1I1R10P_sound (a : Fin 6) : + (CB6_1_1I1R10P a).Encloses (CB6_1_1I1R10Value a) := + contains_sound (CB6_1_1I1R10Raw_sound a) (CB6_1_1I1R10P_check a) +def CB6_1_1I1R10Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB6_1_1I1R10Certificates (CB6_1_1I1R10CertificateIndex a)).output +lemma CB6_1_1I1R10Terms_sound (a : Fin 6) : + (CB6_1_1I1R10Terms a).Encloses (Foundation.entropyTerm (CB6_1_1I1R10Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB6_1_1I1R10Certificates_valid + (CB6_1_1I1R10CertificateIndex a) (CB6_1_1I1R10P_sound a) +def CB6_1_1I1R10Entropy : Ball := ⟨0, 0⟩ +lemma CB6_1_1I1R10Entropy_sound : CB6_1_1I1R10Entropy.Encloses (Foundation.finiteEntropy CB6_1_1I1R10Value) := by + exact contains_sound (entropyFin_enclosed 6 CB6_1_1I1R10Value CB6_1_1I1R10Terms CB6_1_1I1R10Terms_sound) (by decide +kernel) +def CB6_1_1I1R10Mass : Ball := ⟨0, 0⟩ +lemma CB6_1_1I1R10Mass_sound : CB6_1_1I1R10Mass.Encloses (∑ a, CB6_1_1I1R10Value a) := by + exact contains_sound (finSumBall_sound 6 CB6_1_1I1R10P CB6_1_1I1R10Value CB6_1_1I1R10P_sound) (by decide +kernel) +def CB6_1_1I1R10MassTerm : Ball := .exact 0 +lemma CB6_1_1I1R10MassTerm_sound : CB6_1_1I1R10MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB6_1_1I1R10Value a))) := + entropyTerm_zero_ball (CB6_1_1I1R10Mass_sound) +def CB6_1_1I1R10H : Ball := ⟨0, 0⟩ +lemma CB6_1_1I1R10H_sound : CB6_1_1I1R10H.Encloses (homogeneousEntropy CB6_1_1I1R10Value) := by + exact contains_sound (homogeneous_enclosed CB6_1_1I1R10Value CB6_1_1I1R10MassTerm_sound CB6_1_1I1R10Entropy_sound) (by decide +kernel) +def CB6_1_1I1R11Value (a : Fin 6) : ℝ := residualLaw (below (shape 6 1 1)) (fun u => (stageBLaw (shape 6 1 1) u : ℝ)) (stageBPriority (shape 6 1 1)) 1 (fun u a => (littleLaw (shape 6 1 1) u ((stageBPriority (shape 6 1 1)) 1) a : ℝ)) 11 a +def CB6_1_1I1R11Raw (a : Fin 6) : Ball := residualBall (below (shape 6 1 1)) B6_1_1Law (stageBPriority (shape 6 1 1)) 1 (fun u => B6_1_1Little u ((stageBPriority (shape 6 1 1)) 1)) 11 a +lemma CB6_1_1I1R11Raw_sound (a : Fin 6) : + (CB6_1_1I1R11Raw a).Encloses (CB6_1_1I1R11Value a) := by + exact residualBall_sound_on (below (shape 6 1 1)) B6_1_1Law (fun u => (stageBLaw (shape 6 1 1) u : ℝ)) (stageBPriority (shape 6 1 1)) 1 (fun u => B6_1_1Little u ((stageBPriority (shape 6 1 1)) 1)) (fun u a => (littleLaw (shape 6 1 1) u ((stageBPriority (shape 6 1 1)) 1) a : ℝ)) (fun u _ => B6_1_1Law_sound u) (fun u _ a => B6_1_1Little_sound u ((stageBPriority (shape 6 1 1)) 1) a) 11 a +def CB6_1_1I1R11Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB6_1_1I1R11Certificates_valid : + CB6_1_1I1R11Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB6_1_1I1R11CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB6_1_1I1R11P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB6_1_1I1R11Certificates (CB6_1_1I1R11CertificateIndex a)).input +lemma CB6_1_1I1R11P_check : ∀ a : Fin 6, contains (CB6_1_1I1R11Raw a) (CB6_1_1I1R11P a) = true := by + decide +kernel +lemma CB6_1_1I1R11P_sound (a : Fin 6) : + (CB6_1_1I1R11P a).Encloses (CB6_1_1I1R11Value a) := + contains_sound (CB6_1_1I1R11Raw_sound a) (CB6_1_1I1R11P_check a) +def CB6_1_1I1R11Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB6_1_1I1R11Certificates (CB6_1_1I1R11CertificateIndex a)).output +lemma CB6_1_1I1R11Terms_sound (a : Fin 6) : + (CB6_1_1I1R11Terms a).Encloses (Foundation.entropyTerm (CB6_1_1I1R11Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB6_1_1I1R11Certificates_valid + (CB6_1_1I1R11CertificateIndex a) (CB6_1_1I1R11P_sound a) +def CB6_1_1I1R11Entropy : Ball := ⟨0, 0⟩ +lemma CB6_1_1I1R11Entropy_sound : CB6_1_1I1R11Entropy.Encloses (Foundation.finiteEntropy CB6_1_1I1R11Value) := by + exact contains_sound (entropyFin_enclosed 6 CB6_1_1I1R11Value CB6_1_1I1R11Terms CB6_1_1I1R11Terms_sound) (by decide +kernel) +def CB6_1_1I1R11Mass : Ball := ⟨0, 0⟩ +lemma CB6_1_1I1R11Mass_sound : CB6_1_1I1R11Mass.Encloses (∑ a, CB6_1_1I1R11Value a) := by + exact contains_sound (finSumBall_sound 6 CB6_1_1I1R11P CB6_1_1I1R11Value CB6_1_1I1R11P_sound) (by decide +kernel) +def CB6_1_1I1R11MassTerm : Ball := .exact 0 +lemma CB6_1_1I1R11MassTerm_sound : CB6_1_1I1R11MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB6_1_1I1R11Value a))) := + entropyTerm_zero_ball (CB6_1_1I1R11Mass_sound) +def CB6_1_1I1R11H : Ball := ⟨0, 0⟩ +lemma CB6_1_1I1R11H_sound : CB6_1_1I1R11H.Encloses (homogeneousEntropy CB6_1_1I1R11Value) := by + exact contains_sound (homogeneous_enclosed CB6_1_1I1R11Value CB6_1_1I1R11MassTerm_sound CB6_1_1I1R11Entropy_sound) (by decide +kernel) +def CB6_1_1I1R12Value (a : Fin 6) : ℝ := residualLaw (below (shape 6 1 1)) (fun u => (stageBLaw (shape 6 1 1) u : ℝ)) (stageBPriority (shape 6 1 1)) 1 (fun u a => (littleLaw (shape 6 1 1) u ((stageBPriority (shape 6 1 1)) 1) a : ℝ)) 12 a +def CB6_1_1I1R12Raw (a : Fin 6) : Ball := residualBall (below (shape 6 1 1)) B6_1_1Law (stageBPriority (shape 6 1 1)) 1 (fun u => B6_1_1Little u ((stageBPriority (shape 6 1 1)) 1)) 12 a +lemma CB6_1_1I1R12Raw_sound (a : Fin 6) : + (CB6_1_1I1R12Raw a).Encloses (CB6_1_1I1R12Value a) := by + exact residualBall_sound_on (below (shape 6 1 1)) B6_1_1Law (fun u => (stageBLaw (shape 6 1 1) u : ℝ)) (stageBPriority (shape 6 1 1)) 1 (fun u => B6_1_1Little u ((stageBPriority (shape 6 1 1)) 1)) (fun u a => (littleLaw (shape 6 1 1) u ((stageBPriority (shape 6 1 1)) 1) a : ℝ)) (fun u _ => B6_1_1Law_sound u) (fun u _ a => B6_1_1Little_sound u ((stageBPriority (shape 6 1 1)) 1) a) 12 a +def CB6_1_1I1R12Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB6_1_1I1R12Certificates_valid : + CB6_1_1I1R12Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB6_1_1I1R12CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB6_1_1I1R12P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB6_1_1I1R12Certificates (CB6_1_1I1R12CertificateIndex a)).input +lemma CB6_1_1I1R12P_check : ∀ a : Fin 6, contains (CB6_1_1I1R12Raw a) (CB6_1_1I1R12P a) = true := by + decide +kernel +lemma CB6_1_1I1R12P_sound (a : Fin 6) : + (CB6_1_1I1R12P a).Encloses (CB6_1_1I1R12Value a) := + contains_sound (CB6_1_1I1R12Raw_sound a) (CB6_1_1I1R12P_check a) +def CB6_1_1I1R12Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB6_1_1I1R12Certificates (CB6_1_1I1R12CertificateIndex a)).output +lemma CB6_1_1I1R12Terms_sound (a : Fin 6) : + (CB6_1_1I1R12Terms a).Encloses (Foundation.entropyTerm (CB6_1_1I1R12Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB6_1_1I1R12Certificates_valid + (CB6_1_1I1R12CertificateIndex a) (CB6_1_1I1R12P_sound a) +def CB6_1_1I1R12Entropy : Ball := ⟨0, 0⟩ +lemma CB6_1_1I1R12Entropy_sound : CB6_1_1I1R12Entropy.Encloses (Foundation.finiteEntropy CB6_1_1I1R12Value) := by + exact contains_sound (entropyFin_enclosed 6 CB6_1_1I1R12Value CB6_1_1I1R12Terms CB6_1_1I1R12Terms_sound) (by decide +kernel) +def CB6_1_1I1R12Mass : Ball := ⟨0, 0⟩ +lemma CB6_1_1I1R12Mass_sound : CB6_1_1I1R12Mass.Encloses (∑ a, CB6_1_1I1R12Value a) := by + exact contains_sound (finSumBall_sound 6 CB6_1_1I1R12P CB6_1_1I1R12Value CB6_1_1I1R12P_sound) (by decide +kernel) +def CB6_1_1I1R12MassTerm : Ball := .exact 0 +lemma CB6_1_1I1R12MassTerm_sound : CB6_1_1I1R12MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB6_1_1I1R12Value a))) := + entropyTerm_zero_ball (CB6_1_1I1R12Mass_sound) +def CB6_1_1I1R12H : Ball := ⟨0, 0⟩ +lemma CB6_1_1I1R12H_sound : CB6_1_1I1R12H.Encloses (homogeneousEntropy CB6_1_1I1R12Value) := by + exact contains_sound (homogeneous_enclosed CB6_1_1I1R12Value CB6_1_1I1R12MassTerm_sound CB6_1_1I1R12Entropy_sound) (by decide +kernel) +def CB6_1_1I1R13Value (a : Fin 6) : ℝ := residualLaw (below (shape 6 1 1)) (fun u => (stageBLaw (shape 6 1 1) u : ℝ)) (stageBPriority (shape 6 1 1)) 1 (fun u a => (littleLaw (shape 6 1 1) u ((stageBPriority (shape 6 1 1)) 1) a : ℝ)) 13 a +def CB6_1_1I1R13Raw (a : Fin 6) : Ball := residualBall (below (shape 6 1 1)) B6_1_1Law (stageBPriority (shape 6 1 1)) 1 (fun u => B6_1_1Little u ((stageBPriority (shape 6 1 1)) 1)) 13 a +lemma CB6_1_1I1R13Raw_sound (a : Fin 6) : + (CB6_1_1I1R13Raw a).Encloses (CB6_1_1I1R13Value a) := by + exact residualBall_sound_on (below (shape 6 1 1)) B6_1_1Law (fun u => (stageBLaw (shape 6 1 1) u : ℝ)) (stageBPriority (shape 6 1 1)) 1 (fun u => B6_1_1Little u ((stageBPriority (shape 6 1 1)) 1)) (fun u a => (littleLaw (shape 6 1 1) u ((stageBPriority (shape 6 1 1)) 1) a : ℝ)) (fun u _ => B6_1_1Law_sound u) (fun u _ a => B6_1_1Little_sound u ((stageBPriority (shape 6 1 1)) 1) a) 13 a +def CB6_1_1I1R13Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB6_1_1I1R13Certificates_valid : + CB6_1_1I1R13Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB6_1_1I1R13CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB6_1_1I1R13P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB6_1_1I1R13Certificates (CB6_1_1I1R13CertificateIndex a)).input +lemma CB6_1_1I1R13P_check : ∀ a : Fin 6, contains (CB6_1_1I1R13Raw a) (CB6_1_1I1R13P a) = true := by + decide +kernel +lemma CB6_1_1I1R13P_sound (a : Fin 6) : + (CB6_1_1I1R13P a).Encloses (CB6_1_1I1R13Value a) := + contains_sound (CB6_1_1I1R13Raw_sound a) (CB6_1_1I1R13P_check a) +def CB6_1_1I1R13Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB6_1_1I1R13Certificates (CB6_1_1I1R13CertificateIndex a)).output +lemma CB6_1_1I1R13Terms_sound (a : Fin 6) : + (CB6_1_1I1R13Terms a).Encloses (Foundation.entropyTerm (CB6_1_1I1R13Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB6_1_1I1R13Certificates_valid + (CB6_1_1I1R13CertificateIndex a) (CB6_1_1I1R13P_sound a) +def CB6_1_1I1R13Entropy : Ball := ⟨0, 0⟩ +lemma CB6_1_1I1R13Entropy_sound : CB6_1_1I1R13Entropy.Encloses (Foundation.finiteEntropy CB6_1_1I1R13Value) := by + exact contains_sound (entropyFin_enclosed 6 CB6_1_1I1R13Value CB6_1_1I1R13Terms CB6_1_1I1R13Terms_sound) (by decide +kernel) +def CB6_1_1I1R13Mass : Ball := ⟨0, 0⟩ +lemma CB6_1_1I1R13Mass_sound : CB6_1_1I1R13Mass.Encloses (∑ a, CB6_1_1I1R13Value a) := by + exact contains_sound (finSumBall_sound 6 CB6_1_1I1R13P CB6_1_1I1R13Value CB6_1_1I1R13P_sound) (by decide +kernel) +def CB6_1_1I1R13MassTerm : Ball := .exact 0 +lemma CB6_1_1I1R13MassTerm_sound : CB6_1_1I1R13MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB6_1_1I1R13Value a))) := + entropyTerm_zero_ball (CB6_1_1I1R13Mass_sound) +def CB6_1_1I1R13H : Ball := ⟨0, 0⟩ +lemma CB6_1_1I1R13H_sound : CB6_1_1I1R13H.Encloses (homogeneousEntropy CB6_1_1I1R13Value) := by + exact contains_sound (homogeneous_enclosed CB6_1_1I1R13Value CB6_1_1I1R13MassTerm_sound CB6_1_1I1R13Entropy_sound) (by decide +kernel) +def CB6_1_1I1R14Value (a : Fin 6) : ℝ := residualLaw (below (shape 6 1 1)) (fun u => (stageBLaw (shape 6 1 1) u : ℝ)) (stageBPriority (shape 6 1 1)) 1 (fun u a => (littleLaw (shape 6 1 1) u ((stageBPriority (shape 6 1 1)) 1) a : ℝ)) 14 a +def CB6_1_1I1R14Raw (a : Fin 6) : Ball := residualBall (below (shape 6 1 1)) B6_1_1Law (stageBPriority (shape 6 1 1)) 1 (fun u => B6_1_1Little u ((stageBPriority (shape 6 1 1)) 1)) 14 a +lemma CB6_1_1I1R14Raw_sound (a : Fin 6) : + (CB6_1_1I1R14Raw a).Encloses (CB6_1_1I1R14Value a) := by + exact residualBall_sound_on (below (shape 6 1 1)) B6_1_1Law (fun u => (stageBLaw (shape 6 1 1) u : ℝ)) (stageBPriority (shape 6 1 1)) 1 (fun u => B6_1_1Little u ((stageBPriority (shape 6 1 1)) 1)) (fun u a => (littleLaw (shape 6 1 1) u ((stageBPriority (shape 6 1 1)) 1) a : ℝ)) (fun u _ => B6_1_1Law_sound u) (fun u _ a => B6_1_1Little_sound u ((stageBPriority (shape 6 1 1)) 1) a) 14 a +def CB6_1_1I1R14Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB6_1_1I1R14Certificates_valid : + CB6_1_1I1R14Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB6_1_1I1R14CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB6_1_1I1R14P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB6_1_1I1R14Certificates (CB6_1_1I1R14CertificateIndex a)).input +lemma CB6_1_1I1R14P_check : ∀ a : Fin 6, contains (CB6_1_1I1R14Raw a) (CB6_1_1I1R14P a) = true := by + decide +kernel +lemma CB6_1_1I1R14P_sound (a : Fin 6) : + (CB6_1_1I1R14P a).Encloses (CB6_1_1I1R14Value a) := + contains_sound (CB6_1_1I1R14Raw_sound a) (CB6_1_1I1R14P_check a) +def CB6_1_1I1R14Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB6_1_1I1R14Certificates (CB6_1_1I1R14CertificateIndex a)).output +lemma CB6_1_1I1R14Terms_sound (a : Fin 6) : + (CB6_1_1I1R14Terms a).Encloses (Foundation.entropyTerm (CB6_1_1I1R14Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB6_1_1I1R14Certificates_valid + (CB6_1_1I1R14CertificateIndex a) (CB6_1_1I1R14P_sound a) +def CB6_1_1I1R14Entropy : Ball := ⟨0, 0⟩ +lemma CB6_1_1I1R14Entropy_sound : CB6_1_1I1R14Entropy.Encloses (Foundation.finiteEntropy CB6_1_1I1R14Value) := by + exact contains_sound (entropyFin_enclosed 6 CB6_1_1I1R14Value CB6_1_1I1R14Terms CB6_1_1I1R14Terms_sound) (by decide +kernel) +def CB6_1_1I1R14Mass : Ball := ⟨0, 0⟩ +lemma CB6_1_1I1R14Mass_sound : CB6_1_1I1R14Mass.Encloses (∑ a, CB6_1_1I1R14Value a) := by + exact contains_sound (finSumBall_sound 6 CB6_1_1I1R14P CB6_1_1I1R14Value CB6_1_1I1R14P_sound) (by decide +kernel) +def CB6_1_1I1R14MassTerm : Ball := .exact 0 +lemma CB6_1_1I1R14MassTerm_sound : CB6_1_1I1R14MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB6_1_1I1R14Value a))) := + entropyTerm_zero_ball (CB6_1_1I1R14Mass_sound) +def CB6_1_1I1R14H : Ball := ⟨0, 0⟩ +lemma CB6_1_1I1R14H_sound : CB6_1_1I1R14H.Encloses (homogeneousEntropy CB6_1_1I1R14Value) := by + exact contains_sound (homogeneous_enclosed CB6_1_1I1R14Value CB6_1_1I1R14MassTerm_sound CB6_1_1I1R14Entropy_sound) (by decide +kernel) +def CB6_1_1I1R15Value (a : Fin 6) : ℝ := residualLaw (below (shape 6 1 1)) (fun u => (stageBLaw (shape 6 1 1) u : ℝ)) (stageBPriority (shape 6 1 1)) 1 (fun u a => (littleLaw (shape 6 1 1) u ((stageBPriority (shape 6 1 1)) 1) a : ℝ)) 15 a +def CB6_1_1I1R15Raw (a : Fin 6) : Ball := residualBall (below (shape 6 1 1)) B6_1_1Law (stageBPriority (shape 6 1 1)) 1 (fun u => B6_1_1Little u ((stageBPriority (shape 6 1 1)) 1)) 15 a +lemma CB6_1_1I1R15Raw_sound (a : Fin 6) : + (CB6_1_1I1R15Raw a).Encloses (CB6_1_1I1R15Value a) := by + exact residualBall_sound_on (below (shape 6 1 1)) B6_1_1Law (fun u => (stageBLaw (shape 6 1 1) u : ℝ)) (stageBPriority (shape 6 1 1)) 1 (fun u => B6_1_1Little u ((stageBPriority (shape 6 1 1)) 1)) (fun u a => (littleLaw (shape 6 1 1) u ((stageBPriority (shape 6 1 1)) 1) a : ℝ)) (fun u _ => B6_1_1Law_sound u) (fun u _ a => B6_1_1Little_sound u ((stageBPriority (shape 6 1 1)) 1) a) 15 a +def CB6_1_1I1R15Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB6_1_1I1R15Certificates_valid : + CB6_1_1I1R15Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB6_1_1I1R15CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB6_1_1I1R15P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB6_1_1I1R15Certificates (CB6_1_1I1R15CertificateIndex a)).input +lemma CB6_1_1I1R15P_check : ∀ a : Fin 6, contains (CB6_1_1I1R15Raw a) (CB6_1_1I1R15P a) = true := by + decide +kernel +lemma CB6_1_1I1R15P_sound (a : Fin 6) : + (CB6_1_1I1R15P a).Encloses (CB6_1_1I1R15Value a) := + contains_sound (CB6_1_1I1R15Raw_sound a) (CB6_1_1I1R15P_check a) +def CB6_1_1I1R15Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB6_1_1I1R15Certificates (CB6_1_1I1R15CertificateIndex a)).output +lemma CB6_1_1I1R15Terms_sound (a : Fin 6) : + (CB6_1_1I1R15Terms a).Encloses (Foundation.entropyTerm (CB6_1_1I1R15Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB6_1_1I1R15Certificates_valid + (CB6_1_1I1R15CertificateIndex a) (CB6_1_1I1R15P_sound a) +def CB6_1_1I1R15Entropy : Ball := ⟨0, 0⟩ +lemma CB6_1_1I1R15Entropy_sound : CB6_1_1I1R15Entropy.Encloses (Foundation.finiteEntropy CB6_1_1I1R15Value) := by + exact contains_sound (entropyFin_enclosed 6 CB6_1_1I1R15Value CB6_1_1I1R15Terms CB6_1_1I1R15Terms_sound) (by decide +kernel) +def CB6_1_1I1R15Mass : Ball := ⟨0, 0⟩ +lemma CB6_1_1I1R15Mass_sound : CB6_1_1I1R15Mass.Encloses (∑ a, CB6_1_1I1R15Value a) := by + exact contains_sound (finSumBall_sound 6 CB6_1_1I1R15P CB6_1_1I1R15Value CB6_1_1I1R15P_sound) (by decide +kernel) +def CB6_1_1I1R15MassTerm : Ball := .exact 0 +lemma CB6_1_1I1R15MassTerm_sound : CB6_1_1I1R15MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB6_1_1I1R15Value a))) := + entropyTerm_zero_ball (CB6_1_1I1R15Mass_sound) +def CB6_1_1I1R15H : Ball := ⟨0, 0⟩ +lemma CB6_1_1I1R15H_sound : CB6_1_1I1R15H.Encloses (homogeneousEntropy CB6_1_1I1R15Value) := by + exact contains_sound (homogeneous_enclosed CB6_1_1I1R15Value CB6_1_1I1R15MassTerm_sound CB6_1_1I1R15Entropy_sound) (by decide +kernel) +def CB6_1_1I1R16Value (a : Fin 6) : ℝ := residualLaw (below (shape 6 1 1)) (fun u => (stageBLaw (shape 6 1 1) u : ℝ)) (stageBPriority (shape 6 1 1)) 1 (fun u a => (littleLaw (shape 6 1 1) u ((stageBPriority (shape 6 1 1)) 1) a : ℝ)) 16 a +def CB6_1_1I1R16Raw (a : Fin 6) : Ball := residualBall (below (shape 6 1 1)) B6_1_1Law (stageBPriority (shape 6 1 1)) 1 (fun u => B6_1_1Little u ((stageBPriority (shape 6 1 1)) 1)) 16 a +lemma CB6_1_1I1R16Raw_sound (a : Fin 6) : + (CB6_1_1I1R16Raw a).Encloses (CB6_1_1I1R16Value a) := by + exact residualBall_sound_on (below (shape 6 1 1)) B6_1_1Law (fun u => (stageBLaw (shape 6 1 1) u : ℝ)) (stageBPriority (shape 6 1 1)) 1 (fun u => B6_1_1Little u ((stageBPriority (shape 6 1 1)) 1)) (fun u a => (littleLaw (shape 6 1 1) u ((stageBPriority (shape 6 1 1)) 1) a : ℝ)) (fun u _ => B6_1_1Law_sound u) (fun u _ a => B6_1_1Little_sound u ((stageBPriority (shape 6 1 1)) 1) a) 16 a +def CB6_1_1I1R16Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB6_1_1I1R16Certificates_valid : + CB6_1_1I1R16Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB6_1_1I1R16CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB6_1_1I1R16P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB6_1_1I1R16Certificates (CB6_1_1I1R16CertificateIndex a)).input +lemma CB6_1_1I1R16P_check : ∀ a : Fin 6, contains (CB6_1_1I1R16Raw a) (CB6_1_1I1R16P a) = true := by + decide +kernel +lemma CB6_1_1I1R16P_sound (a : Fin 6) : + (CB6_1_1I1R16P a).Encloses (CB6_1_1I1R16Value a) := + contains_sound (CB6_1_1I1R16Raw_sound a) (CB6_1_1I1R16P_check a) +def CB6_1_1I1R16Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB6_1_1I1R16Certificates (CB6_1_1I1R16CertificateIndex a)).output +lemma CB6_1_1I1R16Terms_sound (a : Fin 6) : + (CB6_1_1I1R16Terms a).Encloses (Foundation.entropyTerm (CB6_1_1I1R16Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB6_1_1I1R16Certificates_valid + (CB6_1_1I1R16CertificateIndex a) (CB6_1_1I1R16P_sound a) +def CB6_1_1I1R16Entropy : Ball := ⟨0, 0⟩ +lemma CB6_1_1I1R16Entropy_sound : CB6_1_1I1R16Entropy.Encloses (Foundation.finiteEntropy CB6_1_1I1R16Value) := by + exact contains_sound (entropyFin_enclosed 6 CB6_1_1I1R16Value CB6_1_1I1R16Terms CB6_1_1I1R16Terms_sound) (by decide +kernel) +def CB6_1_1I1R16Mass : Ball := ⟨0, 0⟩ +lemma CB6_1_1I1R16Mass_sound : CB6_1_1I1R16Mass.Encloses (∑ a, CB6_1_1I1R16Value a) := by + exact contains_sound (finSumBall_sound 6 CB6_1_1I1R16P CB6_1_1I1R16Value CB6_1_1I1R16P_sound) (by decide +kernel) +def CB6_1_1I1R16MassTerm : Ball := .exact 0 +lemma CB6_1_1I1R16MassTerm_sound : CB6_1_1I1R16MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB6_1_1I1R16Value a))) := + entropyTerm_zero_ball (CB6_1_1I1R16Mass_sound) +def CB6_1_1I1R16H : Ball := ⟨0, 0⟩ +lemma CB6_1_1I1R16H_sound : CB6_1_1I1R16H.Encloses (homogeneousEntropy CB6_1_1I1R16Value) := by + exact contains_sound (homogeneous_enclosed CB6_1_1I1R16Value CB6_1_1I1R16MassTerm_sound CB6_1_1I1R16Entropy_sound) (by decide +kernel) +def CB6_1_1I1ResidualEntropies (a : Fin 17) : Ball := + match a.val with + | 0 => CB6_1_1I1R0H + | 1 => CB6_1_1I1R1H + | 2 => CB6_1_1I1R2H + | 3 => CB6_1_1I1R3H + | 4 => CB6_1_1I1R4H + | 5 => CB6_1_1I1R5H + | 6 => CB6_1_1I1R6H + | 7 => CB6_1_1I1R7H + | 8 => CB6_1_1I1R8H + | 9 => CB6_1_1I1R9H + | 10 => CB6_1_1I1R10H + | 11 => CB6_1_1I1R11H + | 12 => CB6_1_1I1R12H + | 13 => CB6_1_1I1R13H + | 14 => CB6_1_1I1R14H + | 15 => CB6_1_1I1R15H + | 16 => CB6_1_1I1R16H + | _ => (.exact 0) +lemma CB6_1_1I1ResidualEntropies_sound (k : Fin 17) : + (CB6_1_1I1ResidualEntropies k).Encloses (homogeneousEntropy + (residualLaw (below (shape 6 1 1)) (fun u => (stageBLaw (shape 6 1 1) u : ℝ)) (stageBPriority (shape 6 1 1)) 1 (fun u a => (littleLaw (shape 6 1 1) u ((stageBPriority (shape 6 1 1)) 1) a : ℝ)) k)) := by + fin_cases k + · exact CB6_1_1I1R0H_sound + · exact CB6_1_1I1R1H_sound + · exact CB6_1_1I1R2H_sound + · exact CB6_1_1I1R3H_sound + · exact CB6_1_1I1R4H_sound + · exact CB6_1_1I1R5H_sound + · exact CB6_1_1I1R6H_sound + · exact CB6_1_1I1R7H_sound + · exact CB6_1_1I1R8H_sound + · exact CB6_1_1I1R9H_sound + · exact CB6_1_1I1R10H_sound + · exact CB6_1_1I1R11H_sound + · exact CB6_1_1I1R12H_sound + · exact CB6_1_1I1R13H_sound + · exact CB6_1_1I1R14H_sound + · exact CB6_1_1I1R15H_sound + · exact CB6_1_1I1R16H_sound +def CB6_1_1I1Singles (s : Shape) : Ball := + match s 0, s 1, s 2 with + | _, _, _ => (.exact 0) +lemma CB6_1_1I1Singles_sound (u : Shape) (hu : u ∈ below (shape 6 1 1)) + (hd : designated (stageBPriority (shape 6 1 1)) 1 u) : + (CB6_1_1I1Singles u).Encloses (homogeneousEntropy ((fun u a => (littleLaw (shape 6 1 1) u ((stageBPriority (shape 6 1 1)) 1) a : ℝ)) u)) := by + rw [B6_1_1_below] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl + · exact (show ¬ designated (stageBPriority (shape 6 1 1)) 1 (shape 2 1 1) by decide +kernel) hd |>.elim + · exact (show ¬ designated (stageBPriority (shape 6 1 1)) 1 (shape 3 0 1) by decide +kernel) hd |>.elim + · exact (show ¬ designated (stageBPriority (shape 6 1 1)) 1 (shape 3 1 0) by decide +kernel) hd |>.elim + · exact (show ¬ designated (stageBPriority (shape 6 1 1)) 1 (shape 4 0 0) by decide +kernel) hd |>.elim +def CB6_1_1I1Singleton : Ball := ⟨0, 0⟩ +lemma CB6_1_1I1Singleton_sound : CB6_1_1I1Singleton.Encloses + (singletonEntropy (below (shape 6 1 1)) (fun u => (stageBLaw (shape 6 1 1) u : ℝ)) (stageBPriority (shape 6 1 1)) 1 (fun u a => (littleLaw (shape 6 1 1) u ((stageBPriority (shape 6 1 1)) 1) a : ℝ))) := by + exact contains_sound (singletonBall_sound (below (shape 6 1 1)) B6_1_1Law (fun u => (stageBLaw (shape 6 1 1) u : ℝ)) (stageBPriority (shape 6 1 1)) 1 + CB6_1_1I1Singles (fun u a => (littleLaw (shape 6 1 1) u ((stageBPriority (shape 6 1 1)) 1) a : ℝ)) (fun u _ => B6_1_1Law_sound u) CB6_1_1I1Singles_sound) (by decide +kernel) +def CB6_1_1I1Group : Ball := ⟨0, (21175823793 / 25000000000000000000000000000000)⟩ +lemma CB6_1_1I1Group_sound : CB6_1_1I1Group.Encloses + (groupedEntropy (below (shape 6 1 1)) (fun u => (stageBLaw (shape 6 1 1) u : ℝ)) (stageBPriority (shape 6 1 1)) 1 (fun u a => (littleLaw (shape 6 1 1) u ((stageBPriority (shape 6 1 1)) 1) a : ℝ))) := by + exact contains_sound (Ball.add_sound CB6_1_1I1Singleton_sound + (finSumBall_sound 17 CB6_1_1I1ResidualEntropies _ CB6_1_1I1ResidualEntropies_sound)) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CB6_1_1I1H : Ball := ⟨(6931471805599453094172319305033 / 10000000000000000000000000000000), (232934061743 / 100000000000000000000000000000000)⟩ +lemma CB6_1_1I1_sound : CB6_1_1I1H.Encloses (stageBCapacity (shape 6 1 1) 1) := by + have hb := contains_sound (Ball.add_sound CB6_1_1I1PairH_sound + (Ball.neg_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) CB6_1_1I1Group_sound))) + (show contains (.add CB6_1_1I1PairH (.neg (.mul (.exact 2) CB6_1_1I1Group))) CB6_1_1I1H = true by decide +kernel) + unfold CB6_1_1I1PairValue at hb + simpa only [stageBCapacity, nativeCapacity, + show (1 : Fin 3) ≠ 0 by decide, ite_false, sub_eq_add_neg] using hb + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/CapacityB/CapB6_1_1I2.lean b/lean/OAI/LinearAlgebra/MatrixFields/CapacityB/CapB6_1_1I2.lean new file mode 100644 index 0000000000000000000000000000000000000000..851589bba128962e2120df0a387f329e5f7926c1 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/CapacityB/CapB6_1_1I2.lean @@ -0,0 +1,931 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Certificates.NativeInterior + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CB6_1_1I2PairValue (a : PairSlot) : ℝ := pairLaw (below (shape 6 1 1)) (shape 6 1 1) (fun u => (stageBLaw (shape 6 1 1) u : ℝ)) (fun u a => (littleLaw (shape 6 1 1) u ((stageBPriority (shape 6 1 1)) 2) a : ℝ)) a +def CB6_1_1I2PairRaw (a : PairSlot) : Ball := pairLawBall (below (shape 6 1 1)) (shape 6 1 1) B6_1_1Law (fun u => B6_1_1Little u ((stageBPriority (shape 6 1 1)) 2)) a +lemma CB6_1_1I2PairRaw_sound (a : PairSlot) : + (CB6_1_1I2PairRaw a).Encloses (CB6_1_1I2PairValue a) := by + exact pairLawBall_sound_on (below (shape 6 1 1)) (shape 6 1 1) B6_1_1Law (fun u => (stageBLaw (shape 6 1 1) u : ℝ)) (fun u => B6_1_1Little u ((stageBPriority (shape 6 1 1)) 2)) (fun u a => (littleLaw (shape 6 1 1) u ((stageBPriority (shape 6 1 1)) 2) a : ℝ)) (fun u _ => B6_1_1Law_sound u) (fun u _ a => B6_1_1Little_sound u ((stageBPriority (shape 6 1 1)) 2) a) (fun u _ a => B6_1_1Little_sound (complement (shape 6 1 1) u) ((stageBPriority (shape 6 1 1)) 2) a) a +def CB6_1_1I2PairCertificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(2335026597000525930807493756423 / 10000000000000000000000000000000), (23 / 50000000000000000000000000000000)⟩ ⟨(6792881033012198704545432958047 / 20000000000000000000000000000000), (19778444719 / 100000000000000000000000000000000)⟩ ⟨(-72728090567983674950078491652741 / 50000000000000000000000000000000), (84703294929 / 100000000000000000000000000000000)⟩ ⟨-3, 2335026597000525930807493756423, 1250000000000000000000000000000⟩, + .log ⟨(149723592147492123923952773557 / 10000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ ⟨(1572677708112943242842492197897 / 25000000000000000000000000000000), (2536416327 / 100000000000000000000000000000000)⟩ ⟨(-105038737419798517471371269498513 / 25000000000000000000000000000000), (5293955927 / 3125000000000000000000000000000)⟩ ⟨-7, 149723592147492123923952773557, 78125000000000000000000000000⟩, + .log ⟨(125762490542599097263427673501 / 250000000000000000000000000000), (17 / 50000000000000000000000000000000)⟩ ⟨(8640710434411545663323659384189 / 25000000000000000000000000000000), (21304994663 / 100000000000000000000000000000000)⟩ ⟨(-17176644636114111149204353480011 / 25000000000000000000000000000000), (42351647433 / 100000000000000000000000000000000)⟩ ⟨-1, 125762490542599097263427673501, 125000000000000000000000000000⟩] +lemma CB6_1_1I2PairCertificates_valid : + CB6_1_1I2PairCertificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB6_1_1I2PairCertificateIndex (a : PairSlot) : ℕ := + match a.1.val, a.2.val with + | 2, 5 => 1 + | 3, 5 => 2 + | 4, 4 => 3 + | 5, 2 => 1 + | 5, 3 => 2 + | _, _ => 0 +def CB6_1_1I2PairP (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CB6_1_1I2PairCertificates (CB6_1_1I2PairCertificateIndex a)).input +lemma CB6_1_1I2PairP_check : ∀ a : PairSlot, contains (CB6_1_1I2PairRaw a) (CB6_1_1I2PairP a) = true := by + decide +kernel +lemma CB6_1_1I2PairP_sound (a : PairSlot) : + (CB6_1_1I2PairP a).Encloses (CB6_1_1I2PairValue a) := + contains_sound (CB6_1_1I2PairRaw_sound a) (CB6_1_1I2PairP_check a) +def CB6_1_1I2PairTerms (a : PairSlot) : Ball := + (CompactCertificate.entropyLookup CB6_1_1I2PairCertificates (CB6_1_1I2PairCertificateIndex a)).output +lemma CB6_1_1I2PairTerms_sound (a : PairSlot) : + (CB6_1_1I2PairTerms a).Encloses (Foundation.entropyTerm (CB6_1_1I2PairValue a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB6_1_1I2PairCertificates_valid + (CB6_1_1I2PairCertificateIndex a) (CB6_1_1I2PairP_sound a) +def CB6_1_1I2PairEntropy : Ball := ⟨(57536536866335857820744452350201 / 50000000000000000000000000000000), (13186943351 / 20000000000000000000000000000000)⟩ +lemma CB6_1_1I2PairEntropy_sound : CB6_1_1I2PairEntropy.Encloses (Foundation.finiteEntropy CB6_1_1I2PairValue) := by + exact contains_sound (entropyPair_enclosed CB6_1_1I2PairValue CB6_1_1I2PairTerms CB6_1_1I2PairTerms_sound) (by decide +kernel) +def CB6_1_1I2PairMass : Ball := ⟨1, (33 / 25000000000000000000000000000000)⟩ +lemma CB6_1_1I2PairMass_sound : CB6_1_1I2PairMass.Encloses (∑ a, CB6_1_1I2PairValue a) := by + exact contains_sound (pairSumBall_sound CB6_1_1I2PairP CB6_1_1I2PairValue CB6_1_1I2PairP_sound) (by decide +kernel) +def CB6_1_1I2PairMassTermLogWitness : LogWitness := ⟨0, 1, 1⟩ +def CB6_1_1I2PairMassTermLog : Ball := ⟨0, (10587911907 / 50000000000000000000000000000000)⟩ +lemma CB6_1_1I2PairMassTermLog_sound : CB6_1_1I2PairMassTermLog.Encloses (Real.log ((∑ a, CB6_1_1I2PairValue a))) := by + exact checkLog_sound logTwoBall_sound (CB6_1_1I2PairMass_sound) (w := CB6_1_1I2PairMassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB6_1_1I2PairMassTerm : Ball := ⟨0, (4235164763 / 20000000000000000000000000000000)⟩ +lemma CB6_1_1I2PairMassTerm_sound : CB6_1_1I2PairMassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB6_1_1I2PairValue a))) := by + exact contains_sound (entropyTerm_ball (CB6_1_1I2PairMass_sound) CB6_1_1I2PairMassTermLog_sound) (by decide +kernel) +def CB6_1_1I2PairH : Ball := ⟨(57536536866335857820744452350201 / 50000000000000000000000000000000), (8711054057 / 10000000000000000000000000000000)⟩ +lemma CB6_1_1I2PairH_sound : CB6_1_1I2PairH.Encloses (homogeneousEntropy CB6_1_1I2PairValue) := by + exact contains_sound (homogeneous_enclosed CB6_1_1I2PairValue CB6_1_1I2PairMassTerm_sound CB6_1_1I2PairEntropy_sound) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CB6_1_1I2R0Value (a : Fin 6) : ℝ := residualLaw (below (shape 6 1 1)) (fun u => (stageBLaw (shape 6 1 1) u : ℝ)) (stageBPriority (shape 6 1 1)) 2 (fun u a => (littleLaw (shape 6 1 1) u ((stageBPriority (shape 6 1 1)) 2) a : ℝ)) 0 a +def CB6_1_1I2R0Raw (a : Fin 6) : Ball := residualBall (below (shape 6 1 1)) B6_1_1Law (stageBPriority (shape 6 1 1)) 2 (fun u => B6_1_1Little u ((stageBPriority (shape 6 1 1)) 2)) 0 a +lemma CB6_1_1I2R0Raw_sound (a : Fin 6) : + (CB6_1_1I2R0Raw a).Encloses (CB6_1_1I2R0Value a) := by + exact residualBall_sound_on (below (shape 6 1 1)) B6_1_1Law (fun u => (stageBLaw (shape 6 1 1) u : ℝ)) (stageBPriority (shape 6 1 1)) 2 (fun u => B6_1_1Little u ((stageBPriority (shape 6 1 1)) 2)) (fun u a => (littleLaw (shape 6 1 1) u ((stageBPriority (shape 6 1 1)) 2) a : ℝ)) (fun u _ => B6_1_1Law_sound u) (fun u _ a => B6_1_1Little_sound u ((stageBPriority (shape 6 1 1)) 2) a) 0 a +def CB6_1_1I2R0Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB6_1_1I2R0Certificates_valid : + CB6_1_1I2R0Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB6_1_1I2R0CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB6_1_1I2R0P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB6_1_1I2R0Certificates (CB6_1_1I2R0CertificateIndex a)).input +lemma CB6_1_1I2R0P_check : ∀ a : Fin 6, contains (CB6_1_1I2R0Raw a) (CB6_1_1I2R0P a) = true := by + decide +kernel +lemma CB6_1_1I2R0P_sound (a : Fin 6) : + (CB6_1_1I2R0P a).Encloses (CB6_1_1I2R0Value a) := + contains_sound (CB6_1_1I2R0Raw_sound a) (CB6_1_1I2R0P_check a) +def CB6_1_1I2R0Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB6_1_1I2R0Certificates (CB6_1_1I2R0CertificateIndex a)).output +lemma CB6_1_1I2R0Terms_sound (a : Fin 6) : + (CB6_1_1I2R0Terms a).Encloses (Foundation.entropyTerm (CB6_1_1I2R0Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB6_1_1I2R0Certificates_valid + (CB6_1_1I2R0CertificateIndex a) (CB6_1_1I2R0P_sound a) +def CB6_1_1I2R0Entropy : Ball := ⟨0, 0⟩ +lemma CB6_1_1I2R0Entropy_sound : CB6_1_1I2R0Entropy.Encloses (Foundation.finiteEntropy CB6_1_1I2R0Value) := by + exact contains_sound (entropyFin_enclosed 6 CB6_1_1I2R0Value CB6_1_1I2R0Terms CB6_1_1I2R0Terms_sound) (by decide +kernel) +def CB6_1_1I2R0Mass : Ball := ⟨0, 0⟩ +lemma CB6_1_1I2R0Mass_sound : CB6_1_1I2R0Mass.Encloses (∑ a, CB6_1_1I2R0Value a) := by + exact contains_sound (finSumBall_sound 6 CB6_1_1I2R0P CB6_1_1I2R0Value CB6_1_1I2R0P_sound) (by decide +kernel) +def CB6_1_1I2R0MassTerm : Ball := .exact 0 +lemma CB6_1_1I2R0MassTerm_sound : CB6_1_1I2R0MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB6_1_1I2R0Value a))) := + entropyTerm_zero_ball (CB6_1_1I2R0Mass_sound) +def CB6_1_1I2R0H : Ball := ⟨0, 0⟩ +lemma CB6_1_1I2R0H_sound : CB6_1_1I2R0H.Encloses (homogeneousEntropy CB6_1_1I2R0Value) := by + exact contains_sound (homogeneous_enclosed CB6_1_1I2R0Value CB6_1_1I2R0MassTerm_sound CB6_1_1I2R0Entropy_sound) (by decide +kernel) +def CB6_1_1I2R1Value (a : Fin 6) : ℝ := residualLaw (below (shape 6 1 1)) (fun u => (stageBLaw (shape 6 1 1) u : ℝ)) (stageBPriority (shape 6 1 1)) 2 (fun u a => (littleLaw (shape 6 1 1) u ((stageBPriority (shape 6 1 1)) 2) a : ℝ)) 1 a +def CB6_1_1I2R1Raw (a : Fin 6) : Ball := residualBall (below (shape 6 1 1)) B6_1_1Law (stageBPriority (shape 6 1 1)) 2 (fun u => B6_1_1Little u ((stageBPriority (shape 6 1 1)) 2)) 1 a +lemma CB6_1_1I2R1Raw_sound (a : Fin 6) : + (CB6_1_1I2R1Raw a).Encloses (CB6_1_1I2R1Value a) := by + exact residualBall_sound_on (below (shape 6 1 1)) B6_1_1Law (fun u => (stageBLaw (shape 6 1 1) u : ℝ)) (stageBPriority (shape 6 1 1)) 2 (fun u => B6_1_1Little u ((stageBPriority (shape 6 1 1)) 2)) (fun u a => (littleLaw (shape 6 1 1) u ((stageBPriority (shape 6 1 1)) 2) a : ℝ)) (fun u _ => B6_1_1Law_sound u) (fun u _ a => B6_1_1Little_sound u ((stageBPriority (shape 6 1 1)) 2) a) 1 a +def CB6_1_1I2R1Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB6_1_1I2R1Certificates_valid : + CB6_1_1I2R1Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB6_1_1I2R1CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB6_1_1I2R1P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB6_1_1I2R1Certificates (CB6_1_1I2R1CertificateIndex a)).input +lemma CB6_1_1I2R1P_check : ∀ a : Fin 6, contains (CB6_1_1I2R1Raw a) (CB6_1_1I2R1P a) = true := by + decide +kernel +lemma CB6_1_1I2R1P_sound (a : Fin 6) : + (CB6_1_1I2R1P a).Encloses (CB6_1_1I2R1Value a) := + contains_sound (CB6_1_1I2R1Raw_sound a) (CB6_1_1I2R1P_check a) +def CB6_1_1I2R1Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB6_1_1I2R1Certificates (CB6_1_1I2R1CertificateIndex a)).output +lemma CB6_1_1I2R1Terms_sound (a : Fin 6) : + (CB6_1_1I2R1Terms a).Encloses (Foundation.entropyTerm (CB6_1_1I2R1Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB6_1_1I2R1Certificates_valid + (CB6_1_1I2R1CertificateIndex a) (CB6_1_1I2R1P_sound a) +def CB6_1_1I2R1Entropy : Ball := ⟨0, 0⟩ +lemma CB6_1_1I2R1Entropy_sound : CB6_1_1I2R1Entropy.Encloses (Foundation.finiteEntropy CB6_1_1I2R1Value) := by + exact contains_sound (entropyFin_enclosed 6 CB6_1_1I2R1Value CB6_1_1I2R1Terms CB6_1_1I2R1Terms_sound) (by decide +kernel) +def CB6_1_1I2R1Mass : Ball := ⟨0, 0⟩ +lemma CB6_1_1I2R1Mass_sound : CB6_1_1I2R1Mass.Encloses (∑ a, CB6_1_1I2R1Value a) := by + exact contains_sound (finSumBall_sound 6 CB6_1_1I2R1P CB6_1_1I2R1Value CB6_1_1I2R1P_sound) (by decide +kernel) +def CB6_1_1I2R1MassTerm : Ball := .exact 0 +lemma CB6_1_1I2R1MassTerm_sound : CB6_1_1I2R1MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB6_1_1I2R1Value a))) := + entropyTerm_zero_ball (CB6_1_1I2R1Mass_sound) +def CB6_1_1I2R1H : Ball := ⟨0, 0⟩ +lemma CB6_1_1I2R1H_sound : CB6_1_1I2R1H.Encloses (homogeneousEntropy CB6_1_1I2R1Value) := by + exact contains_sound (homogeneous_enclosed CB6_1_1I2R1Value CB6_1_1I2R1MassTerm_sound CB6_1_1I2R1Entropy_sound) (by decide +kernel) +def CB6_1_1I2R2Value (a : Fin 6) : ℝ := residualLaw (below (shape 6 1 1)) (fun u => (stageBLaw (shape 6 1 1) u : ℝ)) (stageBPriority (shape 6 1 1)) 2 (fun u a => (littleLaw (shape 6 1 1) u ((stageBPriority (shape 6 1 1)) 2) a : ℝ)) 2 a +def CB6_1_1I2R2Raw (a : Fin 6) : Ball := residualBall (below (shape 6 1 1)) B6_1_1Law (stageBPriority (shape 6 1 1)) 2 (fun u => B6_1_1Little u ((stageBPriority (shape 6 1 1)) 2)) 2 a +lemma CB6_1_1I2R2Raw_sound (a : Fin 6) : + (CB6_1_1I2R2Raw a).Encloses (CB6_1_1I2R2Value a) := by + exact residualBall_sound_on (below (shape 6 1 1)) B6_1_1Law (fun u => (stageBLaw (shape 6 1 1) u : ℝ)) (stageBPriority (shape 6 1 1)) 2 (fun u => B6_1_1Little u ((stageBPriority (shape 6 1 1)) 2)) (fun u a => (littleLaw (shape 6 1 1) u ((stageBPriority (shape 6 1 1)) 2) a : ℝ)) (fun u _ => B6_1_1Law_sound u) (fun u _ a => B6_1_1Little_sound u ((stageBPriority (shape 6 1 1)) 2) a) 2 a +def CB6_1_1I2R2Certificates : List CompactCertificate.EntropyDatum := + [.zero, + .log ⟨(2335026597000525930807493756423 / 10000000000000000000000000000000), (23 / 50000000000000000000000000000000)⟩ ⟨(6792881033012198704545432958047 / 20000000000000000000000000000000), (19778444719 / 100000000000000000000000000000000)⟩ ⟨(-72728090567983674950078491652741 / 50000000000000000000000000000000), (84703294929 / 100000000000000000000000000000000)⟩ ⟨-3, 2335026597000525930807493756423, 1250000000000000000000000000000⟩, + .log ⟨(149723592147492123923952773557 / 10000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ ⟨(1572677708112943242842492197897 / 25000000000000000000000000000000), (2536416327 / 100000000000000000000000000000000)⟩ ⟨(-105038737419798517471371269498513 / 25000000000000000000000000000000), (5293955927 / 3125000000000000000000000000000)⟩ ⟨-7, 149723592147492123923952773557, 78125000000000000000000000000⟩] +lemma CB6_1_1I2R2Certificates_valid : + CB6_1_1I2R2Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB6_1_1I2R2CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | 2 => 1 + | 3 => 2 + | _ => 0 +def CB6_1_1I2R2P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB6_1_1I2R2Certificates (CB6_1_1I2R2CertificateIndex a)).input +lemma CB6_1_1I2R2P_check : ∀ a : Fin 6, contains (CB6_1_1I2R2Raw a) (CB6_1_1I2R2P a) = true := by + decide +kernel +lemma CB6_1_1I2R2P_sound (a : Fin 6) : + (CB6_1_1I2R2P a).Encloses (CB6_1_1I2R2Value a) := + contains_sound (CB6_1_1I2R2Raw_sound a) (CB6_1_1I2R2P_check a) +def CB6_1_1I2R2Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB6_1_1I2R2Certificates (CB6_1_1I2R2CertificateIndex a)).output +lemma CB6_1_1I2R2Terms_sound (a : Fin 6) : + (CB6_1_1I2R2Terms a).Encloses (Foundation.entropyTerm (CB6_1_1I2R2Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB6_1_1I2R2Certificates_valid + (CB6_1_1I2R2CertificateIndex a) (CB6_1_1I2R2P_sound a) +def CB6_1_1I2R2Entropy : Ball := ⟨(40255115997512766494097133581823 / 100000000000000000000000000000000), (11157430523 / 50000000000000000000000000000000)⟩ +lemma CB6_1_1I2R2Entropy_sound : CB6_1_1I2R2Entropy.Encloses (Foundation.finiteEntropy CB6_1_1I2R2Value) := by + exact contains_sound (entropyFin_enclosed 6 CB6_1_1I2R2Value CB6_1_1I2R2Terms CB6_1_1I2R2Terms_sound) (by decide +kernel) +def CB6_1_1I2R2Mass : Ball := ⟨(124237509457400902736572326499 / 500000000000000000000000000000), (49 / 100000000000000000000000000000000)⟩ +lemma CB6_1_1I2R2Mass_sound : CB6_1_1I2R2Mass.Encloses (∑ a, CB6_1_1I2R2Value a) := by + exact contains_sound (finSumBall_sound 6 CB6_1_1I2R2P CB6_1_1I2R2Value CB6_1_1I2R2P_sound) (by decide +kernel) +def CB6_1_1I2R2MassTermLogWitness : LogWitness := ⟨-3, 124237509457400902736572326499, 62500000000000000000000000000⟩ +def CB6_1_1I2R2MassTermLog : Ball := ⟨(-139241296600450975538540600627167 / 100000000000000000000000000000000), (84703294929 / 100000000000000000000000000000000)⟩ +lemma CB6_1_1I2R2MassTermLog_sound : CB6_1_1I2R2MassTermLog.Encloses (Real.log ((∑ a, CB6_1_1I2R2Value a))) := by + exact checkLog_sound logTwoBall_sound (CB6_1_1I2R2Mass_sound) (w := CB6_1_1I2R2MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def CB6_1_1I2R2MassTerm : Ball := ⟨(17298991903259292240785313317123 / 50000000000000000000000000000000), (10523326439 / 50000000000000000000000000000000)⟩ +lemma CB6_1_1I2R2MassTerm_sound : CB6_1_1I2R2MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB6_1_1I2R2Value a))) := by + exact contains_sound (entropyTerm_ball (CB6_1_1I2R2Mass_sound) CB6_1_1I2R2MassTermLog_sound) (by decide +kernel) +def CB6_1_1I2R2H : Ball := ⟨(5657132190994182012526506947577 / 100000000000000000000000000000000), (10840378481 / 25000000000000000000000000000000)⟩ +lemma CB6_1_1I2R2H_sound : CB6_1_1I2R2H.Encloses (homogeneousEntropy CB6_1_1I2R2Value) := by + exact contains_sound (homogeneous_enclosed CB6_1_1I2R2Value CB6_1_1I2R2MassTerm_sound CB6_1_1I2R2Entropy_sound) (by decide +kernel) +def CB6_1_1I2R3Value (a : Fin 6) : ℝ := residualLaw (below (shape 6 1 1)) (fun u => (stageBLaw (shape 6 1 1) u : ℝ)) (stageBPriority (shape 6 1 1)) 2 (fun u a => (littleLaw (shape 6 1 1) u ((stageBPriority (shape 6 1 1)) 2) a : ℝ)) 3 a +def CB6_1_1I2R3Raw (a : Fin 6) : Ball := residualBall (below (shape 6 1 1)) B6_1_1Law (stageBPriority (shape 6 1 1)) 2 (fun u => B6_1_1Little u ((stageBPriority (shape 6 1 1)) 2)) 3 a +lemma CB6_1_1I2R3Raw_sound (a : Fin 6) : + (CB6_1_1I2R3Raw a).Encloses (CB6_1_1I2R3Value a) := by + exact residualBall_sound_on (below (shape 6 1 1)) B6_1_1Law (fun u => (stageBLaw (shape 6 1 1) u : ℝ)) (stageBPriority (shape 6 1 1)) 2 (fun u => B6_1_1Little u ((stageBPriority (shape 6 1 1)) 2)) (fun u a => (littleLaw (shape 6 1 1) u ((stageBPriority (shape 6 1 1)) 2) a : ℝ)) (fun u _ => B6_1_1Law_sound u) (fun u _ a => B6_1_1Little_sound u ((stageBPriority (shape 6 1 1)) 2) a) 3 a +def CB6_1_1I2R3Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB6_1_1I2R3Certificates_valid : + CB6_1_1I2R3Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB6_1_1I2R3CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB6_1_1I2R3P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB6_1_1I2R3Certificates (CB6_1_1I2R3CertificateIndex a)).input +lemma CB6_1_1I2R3P_check : ∀ a : Fin 6, contains (CB6_1_1I2R3Raw a) (CB6_1_1I2R3P a) = true := by + decide +kernel +lemma CB6_1_1I2R3P_sound (a : Fin 6) : + (CB6_1_1I2R3P a).Encloses (CB6_1_1I2R3Value a) := + contains_sound (CB6_1_1I2R3Raw_sound a) (CB6_1_1I2R3P_check a) +def CB6_1_1I2R3Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB6_1_1I2R3Certificates (CB6_1_1I2R3CertificateIndex a)).output +lemma CB6_1_1I2R3Terms_sound (a : Fin 6) : + (CB6_1_1I2R3Terms a).Encloses (Foundation.entropyTerm (CB6_1_1I2R3Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB6_1_1I2R3Certificates_valid + (CB6_1_1I2R3CertificateIndex a) (CB6_1_1I2R3P_sound a) +def CB6_1_1I2R3Entropy : Ball := ⟨0, 0⟩ +lemma CB6_1_1I2R3Entropy_sound : CB6_1_1I2R3Entropy.Encloses (Foundation.finiteEntropy CB6_1_1I2R3Value) := by + exact contains_sound (entropyFin_enclosed 6 CB6_1_1I2R3Value CB6_1_1I2R3Terms CB6_1_1I2R3Terms_sound) (by decide +kernel) +def CB6_1_1I2R3Mass : Ball := ⟨0, 0⟩ +lemma CB6_1_1I2R3Mass_sound : CB6_1_1I2R3Mass.Encloses (∑ a, CB6_1_1I2R3Value a) := by + exact contains_sound (finSumBall_sound 6 CB6_1_1I2R3P CB6_1_1I2R3Value CB6_1_1I2R3P_sound) (by decide +kernel) +def CB6_1_1I2R3MassTerm : Ball := .exact 0 +lemma CB6_1_1I2R3MassTerm_sound : CB6_1_1I2R3MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB6_1_1I2R3Value a))) := + entropyTerm_zero_ball (CB6_1_1I2R3Mass_sound) +def CB6_1_1I2R3H : Ball := ⟨0, 0⟩ +lemma CB6_1_1I2R3H_sound : CB6_1_1I2R3H.Encloses (homogeneousEntropy CB6_1_1I2R3Value) := by + exact contains_sound (homogeneous_enclosed CB6_1_1I2R3Value CB6_1_1I2R3MassTerm_sound CB6_1_1I2R3Entropy_sound) (by decide +kernel) +def CB6_1_1I2R4Value (a : Fin 6) : ℝ := residualLaw (below (shape 6 1 1)) (fun u => (stageBLaw (shape 6 1 1) u : ℝ)) (stageBPriority (shape 6 1 1)) 2 (fun u a => (littleLaw (shape 6 1 1) u ((stageBPriority (shape 6 1 1)) 2) a : ℝ)) 4 a +def CB6_1_1I2R4Raw (a : Fin 6) : Ball := residualBall (below (shape 6 1 1)) B6_1_1Law (stageBPriority (shape 6 1 1)) 2 (fun u => B6_1_1Little u ((stageBPriority (shape 6 1 1)) 2)) 4 a +lemma CB6_1_1I2R4Raw_sound (a : Fin 6) : + (CB6_1_1I2R4Raw a).Encloses (CB6_1_1I2R4Value a) := by + exact residualBall_sound_on (below (shape 6 1 1)) B6_1_1Law (fun u => (stageBLaw (shape 6 1 1) u : ℝ)) (stageBPriority (shape 6 1 1)) 2 (fun u => B6_1_1Little u ((stageBPriority (shape 6 1 1)) 2)) (fun u a => (littleLaw (shape 6 1 1) u ((stageBPriority (shape 6 1 1)) 2) a : ℝ)) (fun u _ => B6_1_1Law_sound u) (fun u _ a => B6_1_1Little_sound u ((stageBPriority (shape 6 1 1)) 2) a) 4 a +def CB6_1_1I2R4Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB6_1_1I2R4Certificates_valid : + CB6_1_1I2R4Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB6_1_1I2R4CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB6_1_1I2R4P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB6_1_1I2R4Certificates (CB6_1_1I2R4CertificateIndex a)).input +lemma CB6_1_1I2R4P_check : ∀ a : Fin 6, contains (CB6_1_1I2R4Raw a) (CB6_1_1I2R4P a) = true := by + decide +kernel +lemma CB6_1_1I2R4P_sound (a : Fin 6) : + (CB6_1_1I2R4P a).Encloses (CB6_1_1I2R4Value a) := + contains_sound (CB6_1_1I2R4Raw_sound a) (CB6_1_1I2R4P_check a) +def CB6_1_1I2R4Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB6_1_1I2R4Certificates (CB6_1_1I2R4CertificateIndex a)).output +lemma CB6_1_1I2R4Terms_sound (a : Fin 6) : + (CB6_1_1I2R4Terms a).Encloses (Foundation.entropyTerm (CB6_1_1I2R4Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB6_1_1I2R4Certificates_valid + (CB6_1_1I2R4CertificateIndex a) (CB6_1_1I2R4P_sound a) +def CB6_1_1I2R4Entropy : Ball := ⟨0, 0⟩ +lemma CB6_1_1I2R4Entropy_sound : CB6_1_1I2R4Entropy.Encloses (Foundation.finiteEntropy CB6_1_1I2R4Value) := by + exact contains_sound (entropyFin_enclosed 6 CB6_1_1I2R4Value CB6_1_1I2R4Terms CB6_1_1I2R4Terms_sound) (by decide +kernel) +def CB6_1_1I2R4Mass : Ball := ⟨0, 0⟩ +lemma CB6_1_1I2R4Mass_sound : CB6_1_1I2R4Mass.Encloses (∑ a, CB6_1_1I2R4Value a) := by + exact contains_sound (finSumBall_sound 6 CB6_1_1I2R4P CB6_1_1I2R4Value CB6_1_1I2R4P_sound) (by decide +kernel) +def CB6_1_1I2R4MassTerm : Ball := .exact 0 +lemma CB6_1_1I2R4MassTerm_sound : CB6_1_1I2R4MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB6_1_1I2R4Value a))) := + entropyTerm_zero_ball (CB6_1_1I2R4Mass_sound) +def CB6_1_1I2R4H : Ball := ⟨0, 0⟩ +lemma CB6_1_1I2R4H_sound : CB6_1_1I2R4H.Encloses (homogeneousEntropy CB6_1_1I2R4Value) := by + exact contains_sound (homogeneous_enclosed CB6_1_1I2R4Value CB6_1_1I2R4MassTerm_sound CB6_1_1I2R4Entropy_sound) (by decide +kernel) +def CB6_1_1I2R5Value (a : Fin 6) : ℝ := residualLaw (below (shape 6 1 1)) (fun u => (stageBLaw (shape 6 1 1) u : ℝ)) (stageBPriority (shape 6 1 1)) 2 (fun u a => (littleLaw (shape 6 1 1) u ((stageBPriority (shape 6 1 1)) 2) a : ℝ)) 5 a +def CB6_1_1I2R5Raw (a : Fin 6) : Ball := residualBall (below (shape 6 1 1)) B6_1_1Law (stageBPriority (shape 6 1 1)) 2 (fun u => B6_1_1Little u ((stageBPriority (shape 6 1 1)) 2)) 5 a +lemma CB6_1_1I2R5Raw_sound (a : Fin 6) : + (CB6_1_1I2R5Raw a).Encloses (CB6_1_1I2R5Value a) := by + exact residualBall_sound_on (below (shape 6 1 1)) B6_1_1Law (fun u => (stageBLaw (shape 6 1 1) u : ℝ)) (stageBPriority (shape 6 1 1)) 2 (fun u => B6_1_1Little u ((stageBPriority (shape 6 1 1)) 2)) (fun u a => (littleLaw (shape 6 1 1) u ((stageBPriority (shape 6 1 1)) 2) a : ℝ)) (fun u _ => B6_1_1Law_sound u) (fun u _ a => B6_1_1Little_sound u ((stageBPriority (shape 6 1 1)) 2) a) 5 a +def CB6_1_1I2R5Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB6_1_1I2R5Certificates_valid : + CB6_1_1I2R5Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB6_1_1I2R5CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB6_1_1I2R5P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB6_1_1I2R5Certificates (CB6_1_1I2R5CertificateIndex a)).input +lemma CB6_1_1I2R5P_check : ∀ a : Fin 6, contains (CB6_1_1I2R5Raw a) (CB6_1_1I2R5P a) = true := by + decide +kernel +lemma CB6_1_1I2R5P_sound (a : Fin 6) : + (CB6_1_1I2R5P a).Encloses (CB6_1_1I2R5Value a) := + contains_sound (CB6_1_1I2R5Raw_sound a) (CB6_1_1I2R5P_check a) +def CB6_1_1I2R5Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB6_1_1I2R5Certificates (CB6_1_1I2R5CertificateIndex a)).output +lemma CB6_1_1I2R5Terms_sound (a : Fin 6) : + (CB6_1_1I2R5Terms a).Encloses (Foundation.entropyTerm (CB6_1_1I2R5Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB6_1_1I2R5Certificates_valid + (CB6_1_1I2R5CertificateIndex a) (CB6_1_1I2R5P_sound a) +def CB6_1_1I2R5Entropy : Ball := ⟨0, 0⟩ +lemma CB6_1_1I2R5Entropy_sound : CB6_1_1I2R5Entropy.Encloses (Foundation.finiteEntropy CB6_1_1I2R5Value) := by + exact contains_sound (entropyFin_enclosed 6 CB6_1_1I2R5Value CB6_1_1I2R5Terms CB6_1_1I2R5Terms_sound) (by decide +kernel) +def CB6_1_1I2R5Mass : Ball := ⟨0, 0⟩ +lemma CB6_1_1I2R5Mass_sound : CB6_1_1I2R5Mass.Encloses (∑ a, CB6_1_1I2R5Value a) := by + exact contains_sound (finSumBall_sound 6 CB6_1_1I2R5P CB6_1_1I2R5Value CB6_1_1I2R5P_sound) (by decide +kernel) +def CB6_1_1I2R5MassTerm : Ball := .exact 0 +lemma CB6_1_1I2R5MassTerm_sound : CB6_1_1I2R5MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB6_1_1I2R5Value a))) := + entropyTerm_zero_ball (CB6_1_1I2R5Mass_sound) +def CB6_1_1I2R5H : Ball := ⟨0, 0⟩ +lemma CB6_1_1I2R5H_sound : CB6_1_1I2R5H.Encloses (homogeneousEntropy CB6_1_1I2R5Value) := by + exact contains_sound (homogeneous_enclosed CB6_1_1I2R5Value CB6_1_1I2R5MassTerm_sound CB6_1_1I2R5Entropy_sound) (by decide +kernel) +def CB6_1_1I2R6Value (a : Fin 6) : ℝ := residualLaw (below (shape 6 1 1)) (fun u => (stageBLaw (shape 6 1 1) u : ℝ)) (stageBPriority (shape 6 1 1)) 2 (fun u a => (littleLaw (shape 6 1 1) u ((stageBPriority (shape 6 1 1)) 2) a : ℝ)) 6 a +def CB6_1_1I2R6Raw (a : Fin 6) : Ball := residualBall (below (shape 6 1 1)) B6_1_1Law (stageBPriority (shape 6 1 1)) 2 (fun u => B6_1_1Little u ((stageBPriority (shape 6 1 1)) 2)) 6 a +lemma CB6_1_1I2R6Raw_sound (a : Fin 6) : + (CB6_1_1I2R6Raw a).Encloses (CB6_1_1I2R6Value a) := by + exact residualBall_sound_on (below (shape 6 1 1)) B6_1_1Law (fun u => (stageBLaw (shape 6 1 1) u : ℝ)) (stageBPriority (shape 6 1 1)) 2 (fun u => B6_1_1Little u ((stageBPriority (shape 6 1 1)) 2)) (fun u a => (littleLaw (shape 6 1 1) u ((stageBPriority (shape 6 1 1)) 2) a : ℝ)) (fun u _ => B6_1_1Law_sound u) (fun u _ a => B6_1_1Little_sound u ((stageBPriority (shape 6 1 1)) 2) a) 6 a +def CB6_1_1I2R6Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB6_1_1I2R6Certificates_valid : + CB6_1_1I2R6Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB6_1_1I2R6CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB6_1_1I2R6P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB6_1_1I2R6Certificates (CB6_1_1I2R6CertificateIndex a)).input +lemma CB6_1_1I2R6P_check : ∀ a : Fin 6, contains (CB6_1_1I2R6Raw a) (CB6_1_1I2R6P a) = true := by + decide +kernel +lemma CB6_1_1I2R6P_sound (a : Fin 6) : + (CB6_1_1I2R6P a).Encloses (CB6_1_1I2R6Value a) := + contains_sound (CB6_1_1I2R6Raw_sound a) (CB6_1_1I2R6P_check a) +def CB6_1_1I2R6Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB6_1_1I2R6Certificates (CB6_1_1I2R6CertificateIndex a)).output +lemma CB6_1_1I2R6Terms_sound (a : Fin 6) : + (CB6_1_1I2R6Terms a).Encloses (Foundation.entropyTerm (CB6_1_1I2R6Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB6_1_1I2R6Certificates_valid + (CB6_1_1I2R6CertificateIndex a) (CB6_1_1I2R6P_sound a) +def CB6_1_1I2R6Entropy : Ball := ⟨0, 0⟩ +lemma CB6_1_1I2R6Entropy_sound : CB6_1_1I2R6Entropy.Encloses (Foundation.finiteEntropy CB6_1_1I2R6Value) := by + exact contains_sound (entropyFin_enclosed 6 CB6_1_1I2R6Value CB6_1_1I2R6Terms CB6_1_1I2R6Terms_sound) (by decide +kernel) +def CB6_1_1I2R6Mass : Ball := ⟨0, 0⟩ +lemma CB6_1_1I2R6Mass_sound : CB6_1_1I2R6Mass.Encloses (∑ a, CB6_1_1I2R6Value a) := by + exact contains_sound (finSumBall_sound 6 CB6_1_1I2R6P CB6_1_1I2R6Value CB6_1_1I2R6P_sound) (by decide +kernel) +def CB6_1_1I2R6MassTerm : Ball := .exact 0 +lemma CB6_1_1I2R6MassTerm_sound : CB6_1_1I2R6MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB6_1_1I2R6Value a))) := + entropyTerm_zero_ball (CB6_1_1I2R6Mass_sound) +def CB6_1_1I2R6H : Ball := ⟨0, 0⟩ +lemma CB6_1_1I2R6H_sound : CB6_1_1I2R6H.Encloses (homogeneousEntropy CB6_1_1I2R6Value) := by + exact contains_sound (homogeneous_enclosed CB6_1_1I2R6Value CB6_1_1I2R6MassTerm_sound CB6_1_1I2R6Entropy_sound) (by decide +kernel) +def CB6_1_1I2R7Value (a : Fin 6) : ℝ := residualLaw (below (shape 6 1 1)) (fun u => (stageBLaw (shape 6 1 1) u : ℝ)) (stageBPriority (shape 6 1 1)) 2 (fun u a => (littleLaw (shape 6 1 1) u ((stageBPriority (shape 6 1 1)) 2) a : ℝ)) 7 a +def CB6_1_1I2R7Raw (a : Fin 6) : Ball := residualBall (below (shape 6 1 1)) B6_1_1Law (stageBPriority (shape 6 1 1)) 2 (fun u => B6_1_1Little u ((stageBPriority (shape 6 1 1)) 2)) 7 a +lemma CB6_1_1I2R7Raw_sound (a : Fin 6) : + (CB6_1_1I2R7Raw a).Encloses (CB6_1_1I2R7Value a) := by + exact residualBall_sound_on (below (shape 6 1 1)) B6_1_1Law (fun u => (stageBLaw (shape 6 1 1) u : ℝ)) (stageBPriority (shape 6 1 1)) 2 (fun u => B6_1_1Little u ((stageBPriority (shape 6 1 1)) 2)) (fun u a => (littleLaw (shape 6 1 1) u ((stageBPriority (shape 6 1 1)) 2) a : ℝ)) (fun u _ => B6_1_1Law_sound u) (fun u _ a => B6_1_1Little_sound u ((stageBPriority (shape 6 1 1)) 2) a) 7 a +def CB6_1_1I2R7Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB6_1_1I2R7Certificates_valid : + CB6_1_1I2R7Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB6_1_1I2R7CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB6_1_1I2R7P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB6_1_1I2R7Certificates (CB6_1_1I2R7CertificateIndex a)).input +lemma CB6_1_1I2R7P_check : ∀ a : Fin 6, contains (CB6_1_1I2R7Raw a) (CB6_1_1I2R7P a) = true := by + decide +kernel +lemma CB6_1_1I2R7P_sound (a : Fin 6) : + (CB6_1_1I2R7P a).Encloses (CB6_1_1I2R7Value a) := + contains_sound (CB6_1_1I2R7Raw_sound a) (CB6_1_1I2R7P_check a) +def CB6_1_1I2R7Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB6_1_1I2R7Certificates (CB6_1_1I2R7CertificateIndex a)).output +lemma CB6_1_1I2R7Terms_sound (a : Fin 6) : + (CB6_1_1I2R7Terms a).Encloses (Foundation.entropyTerm (CB6_1_1I2R7Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB6_1_1I2R7Certificates_valid + (CB6_1_1I2R7CertificateIndex a) (CB6_1_1I2R7P_sound a) +def CB6_1_1I2R7Entropy : Ball := ⟨0, 0⟩ +lemma CB6_1_1I2R7Entropy_sound : CB6_1_1I2R7Entropy.Encloses (Foundation.finiteEntropy CB6_1_1I2R7Value) := by + exact contains_sound (entropyFin_enclosed 6 CB6_1_1I2R7Value CB6_1_1I2R7Terms CB6_1_1I2R7Terms_sound) (by decide +kernel) +def CB6_1_1I2R7Mass : Ball := ⟨0, 0⟩ +lemma CB6_1_1I2R7Mass_sound : CB6_1_1I2R7Mass.Encloses (∑ a, CB6_1_1I2R7Value a) := by + exact contains_sound (finSumBall_sound 6 CB6_1_1I2R7P CB6_1_1I2R7Value CB6_1_1I2R7P_sound) (by decide +kernel) +def CB6_1_1I2R7MassTerm : Ball := .exact 0 +lemma CB6_1_1I2R7MassTerm_sound : CB6_1_1I2R7MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB6_1_1I2R7Value a))) := + entropyTerm_zero_ball (CB6_1_1I2R7Mass_sound) +def CB6_1_1I2R7H : Ball := ⟨0, 0⟩ +lemma CB6_1_1I2R7H_sound : CB6_1_1I2R7H.Encloses (homogeneousEntropy CB6_1_1I2R7Value) := by + exact contains_sound (homogeneous_enclosed CB6_1_1I2R7Value CB6_1_1I2R7MassTerm_sound CB6_1_1I2R7Entropy_sound) (by decide +kernel) +def CB6_1_1I2R8Value (a : Fin 6) : ℝ := residualLaw (below (shape 6 1 1)) (fun u => (stageBLaw (shape 6 1 1) u : ℝ)) (stageBPriority (shape 6 1 1)) 2 (fun u a => (littleLaw (shape 6 1 1) u ((stageBPriority (shape 6 1 1)) 2) a : ℝ)) 8 a +def CB6_1_1I2R8Raw (a : Fin 6) : Ball := residualBall (below (shape 6 1 1)) B6_1_1Law (stageBPriority (shape 6 1 1)) 2 (fun u => B6_1_1Little u ((stageBPriority (shape 6 1 1)) 2)) 8 a +lemma CB6_1_1I2R8Raw_sound (a : Fin 6) : + (CB6_1_1I2R8Raw a).Encloses (CB6_1_1I2R8Value a) := by + exact residualBall_sound_on (below (shape 6 1 1)) B6_1_1Law (fun u => (stageBLaw (shape 6 1 1) u : ℝ)) (stageBPriority (shape 6 1 1)) 2 (fun u => B6_1_1Little u ((stageBPriority (shape 6 1 1)) 2)) (fun u a => (littleLaw (shape 6 1 1) u ((stageBPriority (shape 6 1 1)) 2) a : ℝ)) (fun u _ => B6_1_1Law_sound u) (fun u _ a => B6_1_1Little_sound u ((stageBPriority (shape 6 1 1)) 2) a) 8 a +def CB6_1_1I2R8Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB6_1_1I2R8Certificates_valid : + CB6_1_1I2R8Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB6_1_1I2R8CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB6_1_1I2R8P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB6_1_1I2R8Certificates (CB6_1_1I2R8CertificateIndex a)).input +lemma CB6_1_1I2R8P_check : ∀ a : Fin 6, contains (CB6_1_1I2R8Raw a) (CB6_1_1I2R8P a) = true := by + decide +kernel +lemma CB6_1_1I2R8P_sound (a : Fin 6) : + (CB6_1_1I2R8P a).Encloses (CB6_1_1I2R8Value a) := + contains_sound (CB6_1_1I2R8Raw_sound a) (CB6_1_1I2R8P_check a) +def CB6_1_1I2R8Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB6_1_1I2R8Certificates (CB6_1_1I2R8CertificateIndex a)).output +lemma CB6_1_1I2R8Terms_sound (a : Fin 6) : + (CB6_1_1I2R8Terms a).Encloses (Foundation.entropyTerm (CB6_1_1I2R8Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB6_1_1I2R8Certificates_valid + (CB6_1_1I2R8CertificateIndex a) (CB6_1_1I2R8P_sound a) +def CB6_1_1I2R8Entropy : Ball := ⟨0, 0⟩ +lemma CB6_1_1I2R8Entropy_sound : CB6_1_1I2R8Entropy.Encloses (Foundation.finiteEntropy CB6_1_1I2R8Value) := by + exact contains_sound (entropyFin_enclosed 6 CB6_1_1I2R8Value CB6_1_1I2R8Terms CB6_1_1I2R8Terms_sound) (by decide +kernel) +def CB6_1_1I2R8Mass : Ball := ⟨0, 0⟩ +lemma CB6_1_1I2R8Mass_sound : CB6_1_1I2R8Mass.Encloses (∑ a, CB6_1_1I2R8Value a) := by + exact contains_sound (finSumBall_sound 6 CB6_1_1I2R8P CB6_1_1I2R8Value CB6_1_1I2R8P_sound) (by decide +kernel) +def CB6_1_1I2R8MassTerm : Ball := .exact 0 +lemma CB6_1_1I2R8MassTerm_sound : CB6_1_1I2R8MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB6_1_1I2R8Value a))) := + entropyTerm_zero_ball (CB6_1_1I2R8Mass_sound) +def CB6_1_1I2R8H : Ball := ⟨0, 0⟩ +lemma CB6_1_1I2R8H_sound : CB6_1_1I2R8H.Encloses (homogeneousEntropy CB6_1_1I2R8Value) := by + exact contains_sound (homogeneous_enclosed CB6_1_1I2R8Value CB6_1_1I2R8MassTerm_sound CB6_1_1I2R8Entropy_sound) (by decide +kernel) +def CB6_1_1I2R9Value (a : Fin 6) : ℝ := residualLaw (below (shape 6 1 1)) (fun u => (stageBLaw (shape 6 1 1) u : ℝ)) (stageBPriority (shape 6 1 1)) 2 (fun u a => (littleLaw (shape 6 1 1) u ((stageBPriority (shape 6 1 1)) 2) a : ℝ)) 9 a +def CB6_1_1I2R9Raw (a : Fin 6) : Ball := residualBall (below (shape 6 1 1)) B6_1_1Law (stageBPriority (shape 6 1 1)) 2 (fun u => B6_1_1Little u ((stageBPriority (shape 6 1 1)) 2)) 9 a +lemma CB6_1_1I2R9Raw_sound (a : Fin 6) : + (CB6_1_1I2R9Raw a).Encloses (CB6_1_1I2R9Value a) := by + exact residualBall_sound_on (below (shape 6 1 1)) B6_1_1Law (fun u => (stageBLaw (shape 6 1 1) u : ℝ)) (stageBPriority (shape 6 1 1)) 2 (fun u => B6_1_1Little u ((stageBPriority (shape 6 1 1)) 2)) (fun u a => (littleLaw (shape 6 1 1) u ((stageBPriority (shape 6 1 1)) 2) a : ℝ)) (fun u _ => B6_1_1Law_sound u) (fun u _ a => B6_1_1Little_sound u ((stageBPriority (shape 6 1 1)) 2) a) 9 a +def CB6_1_1I2R9Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB6_1_1I2R9Certificates_valid : + CB6_1_1I2R9Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB6_1_1I2R9CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB6_1_1I2R9P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB6_1_1I2R9Certificates (CB6_1_1I2R9CertificateIndex a)).input +lemma CB6_1_1I2R9P_check : ∀ a : Fin 6, contains (CB6_1_1I2R9Raw a) (CB6_1_1I2R9P a) = true := by + decide +kernel +lemma CB6_1_1I2R9P_sound (a : Fin 6) : + (CB6_1_1I2R9P a).Encloses (CB6_1_1I2R9Value a) := + contains_sound (CB6_1_1I2R9Raw_sound a) (CB6_1_1I2R9P_check a) +def CB6_1_1I2R9Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB6_1_1I2R9Certificates (CB6_1_1I2R9CertificateIndex a)).output +lemma CB6_1_1I2R9Terms_sound (a : Fin 6) : + (CB6_1_1I2R9Terms a).Encloses (Foundation.entropyTerm (CB6_1_1I2R9Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB6_1_1I2R9Certificates_valid + (CB6_1_1I2R9CertificateIndex a) (CB6_1_1I2R9P_sound a) +def CB6_1_1I2R9Entropy : Ball := ⟨0, 0⟩ +lemma CB6_1_1I2R9Entropy_sound : CB6_1_1I2R9Entropy.Encloses (Foundation.finiteEntropy CB6_1_1I2R9Value) := by + exact contains_sound (entropyFin_enclosed 6 CB6_1_1I2R9Value CB6_1_1I2R9Terms CB6_1_1I2R9Terms_sound) (by decide +kernel) +def CB6_1_1I2R9Mass : Ball := ⟨0, 0⟩ +lemma CB6_1_1I2R9Mass_sound : CB6_1_1I2R9Mass.Encloses (∑ a, CB6_1_1I2R9Value a) := by + exact contains_sound (finSumBall_sound 6 CB6_1_1I2R9P CB6_1_1I2R9Value CB6_1_1I2R9P_sound) (by decide +kernel) +def CB6_1_1I2R9MassTerm : Ball := .exact 0 +lemma CB6_1_1I2R9MassTerm_sound : CB6_1_1I2R9MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB6_1_1I2R9Value a))) := + entropyTerm_zero_ball (CB6_1_1I2R9Mass_sound) +def CB6_1_1I2R9H : Ball := ⟨0, 0⟩ +lemma CB6_1_1I2R9H_sound : CB6_1_1I2R9H.Encloses (homogeneousEntropy CB6_1_1I2R9Value) := by + exact contains_sound (homogeneous_enclosed CB6_1_1I2R9Value CB6_1_1I2R9MassTerm_sound CB6_1_1I2R9Entropy_sound) (by decide +kernel) +def CB6_1_1I2R10Value (a : Fin 6) : ℝ := residualLaw (below (shape 6 1 1)) (fun u => (stageBLaw (shape 6 1 1) u : ℝ)) (stageBPriority (shape 6 1 1)) 2 (fun u a => (littleLaw (shape 6 1 1) u ((stageBPriority (shape 6 1 1)) 2) a : ℝ)) 10 a +def CB6_1_1I2R10Raw (a : Fin 6) : Ball := residualBall (below (shape 6 1 1)) B6_1_1Law (stageBPriority (shape 6 1 1)) 2 (fun u => B6_1_1Little u ((stageBPriority (shape 6 1 1)) 2)) 10 a +lemma CB6_1_1I2R10Raw_sound (a : Fin 6) : + (CB6_1_1I2R10Raw a).Encloses (CB6_1_1I2R10Value a) := by + exact residualBall_sound_on (below (shape 6 1 1)) B6_1_1Law (fun u => (stageBLaw (shape 6 1 1) u : ℝ)) (stageBPriority (shape 6 1 1)) 2 (fun u => B6_1_1Little u ((stageBPriority (shape 6 1 1)) 2)) (fun u a => (littleLaw (shape 6 1 1) u ((stageBPriority (shape 6 1 1)) 2) a : ℝ)) (fun u _ => B6_1_1Law_sound u) (fun u _ a => B6_1_1Little_sound u ((stageBPriority (shape 6 1 1)) 2) a) 10 a +def CB6_1_1I2R10Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB6_1_1I2R10Certificates_valid : + CB6_1_1I2R10Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB6_1_1I2R10CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB6_1_1I2R10P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB6_1_1I2R10Certificates (CB6_1_1I2R10CertificateIndex a)).input +lemma CB6_1_1I2R10P_check : ∀ a : Fin 6, contains (CB6_1_1I2R10Raw a) (CB6_1_1I2R10P a) = true := by + decide +kernel +lemma CB6_1_1I2R10P_sound (a : Fin 6) : + (CB6_1_1I2R10P a).Encloses (CB6_1_1I2R10Value a) := + contains_sound (CB6_1_1I2R10Raw_sound a) (CB6_1_1I2R10P_check a) +def CB6_1_1I2R10Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB6_1_1I2R10Certificates (CB6_1_1I2R10CertificateIndex a)).output +lemma CB6_1_1I2R10Terms_sound (a : Fin 6) : + (CB6_1_1I2R10Terms a).Encloses (Foundation.entropyTerm (CB6_1_1I2R10Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB6_1_1I2R10Certificates_valid + (CB6_1_1I2R10CertificateIndex a) (CB6_1_1I2R10P_sound a) +def CB6_1_1I2R10Entropy : Ball := ⟨0, 0⟩ +lemma CB6_1_1I2R10Entropy_sound : CB6_1_1I2R10Entropy.Encloses (Foundation.finiteEntropy CB6_1_1I2R10Value) := by + exact contains_sound (entropyFin_enclosed 6 CB6_1_1I2R10Value CB6_1_1I2R10Terms CB6_1_1I2R10Terms_sound) (by decide +kernel) +def CB6_1_1I2R10Mass : Ball := ⟨0, 0⟩ +lemma CB6_1_1I2R10Mass_sound : CB6_1_1I2R10Mass.Encloses (∑ a, CB6_1_1I2R10Value a) := by + exact contains_sound (finSumBall_sound 6 CB6_1_1I2R10P CB6_1_1I2R10Value CB6_1_1I2R10P_sound) (by decide +kernel) +def CB6_1_1I2R10MassTerm : Ball := .exact 0 +lemma CB6_1_1I2R10MassTerm_sound : CB6_1_1I2R10MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB6_1_1I2R10Value a))) := + entropyTerm_zero_ball (CB6_1_1I2R10Mass_sound) +def CB6_1_1I2R10H : Ball := ⟨0, 0⟩ +lemma CB6_1_1I2R10H_sound : CB6_1_1I2R10H.Encloses (homogeneousEntropy CB6_1_1I2R10Value) := by + exact contains_sound (homogeneous_enclosed CB6_1_1I2R10Value CB6_1_1I2R10MassTerm_sound CB6_1_1I2R10Entropy_sound) (by decide +kernel) +def CB6_1_1I2R11Value (a : Fin 6) : ℝ := residualLaw (below (shape 6 1 1)) (fun u => (stageBLaw (shape 6 1 1) u : ℝ)) (stageBPriority (shape 6 1 1)) 2 (fun u a => (littleLaw (shape 6 1 1) u ((stageBPriority (shape 6 1 1)) 2) a : ℝ)) 11 a +def CB6_1_1I2R11Raw (a : Fin 6) : Ball := residualBall (below (shape 6 1 1)) B6_1_1Law (stageBPriority (shape 6 1 1)) 2 (fun u => B6_1_1Little u ((stageBPriority (shape 6 1 1)) 2)) 11 a +lemma CB6_1_1I2R11Raw_sound (a : Fin 6) : + (CB6_1_1I2R11Raw a).Encloses (CB6_1_1I2R11Value a) := by + exact residualBall_sound_on (below (shape 6 1 1)) B6_1_1Law (fun u => (stageBLaw (shape 6 1 1) u : ℝ)) (stageBPriority (shape 6 1 1)) 2 (fun u => B6_1_1Little u ((stageBPriority (shape 6 1 1)) 2)) (fun u a => (littleLaw (shape 6 1 1) u ((stageBPriority (shape 6 1 1)) 2) a : ℝ)) (fun u _ => B6_1_1Law_sound u) (fun u _ a => B6_1_1Little_sound u ((stageBPriority (shape 6 1 1)) 2) a) 11 a +def CB6_1_1I2R11Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB6_1_1I2R11Certificates_valid : + CB6_1_1I2R11Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB6_1_1I2R11CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB6_1_1I2R11P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB6_1_1I2R11Certificates (CB6_1_1I2R11CertificateIndex a)).input +lemma CB6_1_1I2R11P_check : ∀ a : Fin 6, contains (CB6_1_1I2R11Raw a) (CB6_1_1I2R11P a) = true := by + decide +kernel +lemma CB6_1_1I2R11P_sound (a : Fin 6) : + (CB6_1_1I2R11P a).Encloses (CB6_1_1I2R11Value a) := + contains_sound (CB6_1_1I2R11Raw_sound a) (CB6_1_1I2R11P_check a) +def CB6_1_1I2R11Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB6_1_1I2R11Certificates (CB6_1_1I2R11CertificateIndex a)).output +lemma CB6_1_1I2R11Terms_sound (a : Fin 6) : + (CB6_1_1I2R11Terms a).Encloses (Foundation.entropyTerm (CB6_1_1I2R11Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB6_1_1I2R11Certificates_valid + (CB6_1_1I2R11CertificateIndex a) (CB6_1_1I2R11P_sound a) +def CB6_1_1I2R11Entropy : Ball := ⟨0, 0⟩ +lemma CB6_1_1I2R11Entropy_sound : CB6_1_1I2R11Entropy.Encloses (Foundation.finiteEntropy CB6_1_1I2R11Value) := by + exact contains_sound (entropyFin_enclosed 6 CB6_1_1I2R11Value CB6_1_1I2R11Terms CB6_1_1I2R11Terms_sound) (by decide +kernel) +def CB6_1_1I2R11Mass : Ball := ⟨0, 0⟩ +lemma CB6_1_1I2R11Mass_sound : CB6_1_1I2R11Mass.Encloses (∑ a, CB6_1_1I2R11Value a) := by + exact contains_sound (finSumBall_sound 6 CB6_1_1I2R11P CB6_1_1I2R11Value CB6_1_1I2R11P_sound) (by decide +kernel) +def CB6_1_1I2R11MassTerm : Ball := .exact 0 +lemma CB6_1_1I2R11MassTerm_sound : CB6_1_1I2R11MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB6_1_1I2R11Value a))) := + entropyTerm_zero_ball (CB6_1_1I2R11Mass_sound) +def CB6_1_1I2R11H : Ball := ⟨0, 0⟩ +lemma CB6_1_1I2R11H_sound : CB6_1_1I2R11H.Encloses (homogeneousEntropy CB6_1_1I2R11Value) := by + exact contains_sound (homogeneous_enclosed CB6_1_1I2R11Value CB6_1_1I2R11MassTerm_sound CB6_1_1I2R11Entropy_sound) (by decide +kernel) +def CB6_1_1I2R12Value (a : Fin 6) : ℝ := residualLaw (below (shape 6 1 1)) (fun u => (stageBLaw (shape 6 1 1) u : ℝ)) (stageBPriority (shape 6 1 1)) 2 (fun u a => (littleLaw (shape 6 1 1) u ((stageBPriority (shape 6 1 1)) 2) a : ℝ)) 12 a +def CB6_1_1I2R12Raw (a : Fin 6) : Ball := residualBall (below (shape 6 1 1)) B6_1_1Law (stageBPriority (shape 6 1 1)) 2 (fun u => B6_1_1Little u ((stageBPriority (shape 6 1 1)) 2)) 12 a +lemma CB6_1_1I2R12Raw_sound (a : Fin 6) : + (CB6_1_1I2R12Raw a).Encloses (CB6_1_1I2R12Value a) := by + exact residualBall_sound_on (below (shape 6 1 1)) B6_1_1Law (fun u => (stageBLaw (shape 6 1 1) u : ℝ)) (stageBPriority (shape 6 1 1)) 2 (fun u => B6_1_1Little u ((stageBPriority (shape 6 1 1)) 2)) (fun u a => (littleLaw (shape 6 1 1) u ((stageBPriority (shape 6 1 1)) 2) a : ℝ)) (fun u _ => B6_1_1Law_sound u) (fun u _ a => B6_1_1Little_sound u ((stageBPriority (shape 6 1 1)) 2) a) 12 a +def CB6_1_1I2R12Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB6_1_1I2R12Certificates_valid : + CB6_1_1I2R12Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB6_1_1I2R12CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB6_1_1I2R12P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB6_1_1I2R12Certificates (CB6_1_1I2R12CertificateIndex a)).input +lemma CB6_1_1I2R12P_check : ∀ a : Fin 6, contains (CB6_1_1I2R12Raw a) (CB6_1_1I2R12P a) = true := by + decide +kernel +lemma CB6_1_1I2R12P_sound (a : Fin 6) : + (CB6_1_1I2R12P a).Encloses (CB6_1_1I2R12Value a) := + contains_sound (CB6_1_1I2R12Raw_sound a) (CB6_1_1I2R12P_check a) +def CB6_1_1I2R12Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB6_1_1I2R12Certificates (CB6_1_1I2R12CertificateIndex a)).output +lemma CB6_1_1I2R12Terms_sound (a : Fin 6) : + (CB6_1_1I2R12Terms a).Encloses (Foundation.entropyTerm (CB6_1_1I2R12Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB6_1_1I2R12Certificates_valid + (CB6_1_1I2R12CertificateIndex a) (CB6_1_1I2R12P_sound a) +def CB6_1_1I2R12Entropy : Ball := ⟨0, 0⟩ +lemma CB6_1_1I2R12Entropy_sound : CB6_1_1I2R12Entropy.Encloses (Foundation.finiteEntropy CB6_1_1I2R12Value) := by + exact contains_sound (entropyFin_enclosed 6 CB6_1_1I2R12Value CB6_1_1I2R12Terms CB6_1_1I2R12Terms_sound) (by decide +kernel) +def CB6_1_1I2R12Mass : Ball := ⟨0, 0⟩ +lemma CB6_1_1I2R12Mass_sound : CB6_1_1I2R12Mass.Encloses (∑ a, CB6_1_1I2R12Value a) := by + exact contains_sound (finSumBall_sound 6 CB6_1_1I2R12P CB6_1_1I2R12Value CB6_1_1I2R12P_sound) (by decide +kernel) +def CB6_1_1I2R12MassTerm : Ball := .exact 0 +lemma CB6_1_1I2R12MassTerm_sound : CB6_1_1I2R12MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB6_1_1I2R12Value a))) := + entropyTerm_zero_ball (CB6_1_1I2R12Mass_sound) +def CB6_1_1I2R12H : Ball := ⟨0, 0⟩ +lemma CB6_1_1I2R12H_sound : CB6_1_1I2R12H.Encloses (homogeneousEntropy CB6_1_1I2R12Value) := by + exact contains_sound (homogeneous_enclosed CB6_1_1I2R12Value CB6_1_1I2R12MassTerm_sound CB6_1_1I2R12Entropy_sound) (by decide +kernel) +def CB6_1_1I2R13Value (a : Fin 6) : ℝ := residualLaw (below (shape 6 1 1)) (fun u => (stageBLaw (shape 6 1 1) u : ℝ)) (stageBPriority (shape 6 1 1)) 2 (fun u a => (littleLaw (shape 6 1 1) u ((stageBPriority (shape 6 1 1)) 2) a : ℝ)) 13 a +def CB6_1_1I2R13Raw (a : Fin 6) : Ball := residualBall (below (shape 6 1 1)) B6_1_1Law (stageBPriority (shape 6 1 1)) 2 (fun u => B6_1_1Little u ((stageBPriority (shape 6 1 1)) 2)) 13 a +lemma CB6_1_1I2R13Raw_sound (a : Fin 6) : + (CB6_1_1I2R13Raw a).Encloses (CB6_1_1I2R13Value a) := by + exact residualBall_sound_on (below (shape 6 1 1)) B6_1_1Law (fun u => (stageBLaw (shape 6 1 1) u : ℝ)) (stageBPriority (shape 6 1 1)) 2 (fun u => B6_1_1Little u ((stageBPriority (shape 6 1 1)) 2)) (fun u a => (littleLaw (shape 6 1 1) u ((stageBPriority (shape 6 1 1)) 2) a : ℝ)) (fun u _ => B6_1_1Law_sound u) (fun u _ a => B6_1_1Little_sound u ((stageBPriority (shape 6 1 1)) 2) a) 13 a +def CB6_1_1I2R13Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB6_1_1I2R13Certificates_valid : + CB6_1_1I2R13Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB6_1_1I2R13CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB6_1_1I2R13P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB6_1_1I2R13Certificates (CB6_1_1I2R13CertificateIndex a)).input +lemma CB6_1_1I2R13P_check : ∀ a : Fin 6, contains (CB6_1_1I2R13Raw a) (CB6_1_1I2R13P a) = true := by + decide +kernel +lemma CB6_1_1I2R13P_sound (a : Fin 6) : + (CB6_1_1I2R13P a).Encloses (CB6_1_1I2R13Value a) := + contains_sound (CB6_1_1I2R13Raw_sound a) (CB6_1_1I2R13P_check a) +def CB6_1_1I2R13Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB6_1_1I2R13Certificates (CB6_1_1I2R13CertificateIndex a)).output +lemma CB6_1_1I2R13Terms_sound (a : Fin 6) : + (CB6_1_1I2R13Terms a).Encloses (Foundation.entropyTerm (CB6_1_1I2R13Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB6_1_1I2R13Certificates_valid + (CB6_1_1I2R13CertificateIndex a) (CB6_1_1I2R13P_sound a) +def CB6_1_1I2R13Entropy : Ball := ⟨0, 0⟩ +lemma CB6_1_1I2R13Entropy_sound : CB6_1_1I2R13Entropy.Encloses (Foundation.finiteEntropy CB6_1_1I2R13Value) := by + exact contains_sound (entropyFin_enclosed 6 CB6_1_1I2R13Value CB6_1_1I2R13Terms CB6_1_1I2R13Terms_sound) (by decide +kernel) +def CB6_1_1I2R13Mass : Ball := ⟨0, 0⟩ +lemma CB6_1_1I2R13Mass_sound : CB6_1_1I2R13Mass.Encloses (∑ a, CB6_1_1I2R13Value a) := by + exact contains_sound (finSumBall_sound 6 CB6_1_1I2R13P CB6_1_1I2R13Value CB6_1_1I2R13P_sound) (by decide +kernel) +def CB6_1_1I2R13MassTerm : Ball := .exact 0 +lemma CB6_1_1I2R13MassTerm_sound : CB6_1_1I2R13MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB6_1_1I2R13Value a))) := + entropyTerm_zero_ball (CB6_1_1I2R13Mass_sound) +def CB6_1_1I2R13H : Ball := ⟨0, 0⟩ +lemma CB6_1_1I2R13H_sound : CB6_1_1I2R13H.Encloses (homogeneousEntropy CB6_1_1I2R13Value) := by + exact contains_sound (homogeneous_enclosed CB6_1_1I2R13Value CB6_1_1I2R13MassTerm_sound CB6_1_1I2R13Entropy_sound) (by decide +kernel) +def CB6_1_1I2R14Value (a : Fin 6) : ℝ := residualLaw (below (shape 6 1 1)) (fun u => (stageBLaw (shape 6 1 1) u : ℝ)) (stageBPriority (shape 6 1 1)) 2 (fun u a => (littleLaw (shape 6 1 1) u ((stageBPriority (shape 6 1 1)) 2) a : ℝ)) 14 a +def CB6_1_1I2R14Raw (a : Fin 6) : Ball := residualBall (below (shape 6 1 1)) B6_1_1Law (stageBPriority (shape 6 1 1)) 2 (fun u => B6_1_1Little u ((stageBPriority (shape 6 1 1)) 2)) 14 a +lemma CB6_1_1I2R14Raw_sound (a : Fin 6) : + (CB6_1_1I2R14Raw a).Encloses (CB6_1_1I2R14Value a) := by + exact residualBall_sound_on (below (shape 6 1 1)) B6_1_1Law (fun u => (stageBLaw (shape 6 1 1) u : ℝ)) (stageBPriority (shape 6 1 1)) 2 (fun u => B6_1_1Little u ((stageBPriority (shape 6 1 1)) 2)) (fun u a => (littleLaw (shape 6 1 1) u ((stageBPriority (shape 6 1 1)) 2) a : ℝ)) (fun u _ => B6_1_1Law_sound u) (fun u _ a => B6_1_1Little_sound u ((stageBPriority (shape 6 1 1)) 2) a) 14 a +def CB6_1_1I2R14Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB6_1_1I2R14Certificates_valid : + CB6_1_1I2R14Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB6_1_1I2R14CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB6_1_1I2R14P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB6_1_1I2R14Certificates (CB6_1_1I2R14CertificateIndex a)).input +lemma CB6_1_1I2R14P_check : ∀ a : Fin 6, contains (CB6_1_1I2R14Raw a) (CB6_1_1I2R14P a) = true := by + decide +kernel +lemma CB6_1_1I2R14P_sound (a : Fin 6) : + (CB6_1_1I2R14P a).Encloses (CB6_1_1I2R14Value a) := + contains_sound (CB6_1_1I2R14Raw_sound a) (CB6_1_1I2R14P_check a) +def CB6_1_1I2R14Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB6_1_1I2R14Certificates (CB6_1_1I2R14CertificateIndex a)).output +lemma CB6_1_1I2R14Terms_sound (a : Fin 6) : + (CB6_1_1I2R14Terms a).Encloses (Foundation.entropyTerm (CB6_1_1I2R14Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB6_1_1I2R14Certificates_valid + (CB6_1_1I2R14CertificateIndex a) (CB6_1_1I2R14P_sound a) +def CB6_1_1I2R14Entropy : Ball := ⟨0, 0⟩ +lemma CB6_1_1I2R14Entropy_sound : CB6_1_1I2R14Entropy.Encloses (Foundation.finiteEntropy CB6_1_1I2R14Value) := by + exact contains_sound (entropyFin_enclosed 6 CB6_1_1I2R14Value CB6_1_1I2R14Terms CB6_1_1I2R14Terms_sound) (by decide +kernel) +def CB6_1_1I2R14Mass : Ball := ⟨0, 0⟩ +lemma CB6_1_1I2R14Mass_sound : CB6_1_1I2R14Mass.Encloses (∑ a, CB6_1_1I2R14Value a) := by + exact contains_sound (finSumBall_sound 6 CB6_1_1I2R14P CB6_1_1I2R14Value CB6_1_1I2R14P_sound) (by decide +kernel) +def CB6_1_1I2R14MassTerm : Ball := .exact 0 +lemma CB6_1_1I2R14MassTerm_sound : CB6_1_1I2R14MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB6_1_1I2R14Value a))) := + entropyTerm_zero_ball (CB6_1_1I2R14Mass_sound) +def CB6_1_1I2R14H : Ball := ⟨0, 0⟩ +lemma CB6_1_1I2R14H_sound : CB6_1_1I2R14H.Encloses (homogeneousEntropy CB6_1_1I2R14Value) := by + exact contains_sound (homogeneous_enclosed CB6_1_1I2R14Value CB6_1_1I2R14MassTerm_sound CB6_1_1I2R14Entropy_sound) (by decide +kernel) +def CB6_1_1I2R15Value (a : Fin 6) : ℝ := residualLaw (below (shape 6 1 1)) (fun u => (stageBLaw (shape 6 1 1) u : ℝ)) (stageBPriority (shape 6 1 1)) 2 (fun u a => (littleLaw (shape 6 1 1) u ((stageBPriority (shape 6 1 1)) 2) a : ℝ)) 15 a +def CB6_1_1I2R15Raw (a : Fin 6) : Ball := residualBall (below (shape 6 1 1)) B6_1_1Law (stageBPriority (shape 6 1 1)) 2 (fun u => B6_1_1Little u ((stageBPriority (shape 6 1 1)) 2)) 15 a +lemma CB6_1_1I2R15Raw_sound (a : Fin 6) : + (CB6_1_1I2R15Raw a).Encloses (CB6_1_1I2R15Value a) := by + exact residualBall_sound_on (below (shape 6 1 1)) B6_1_1Law (fun u => (stageBLaw (shape 6 1 1) u : ℝ)) (stageBPriority (shape 6 1 1)) 2 (fun u => B6_1_1Little u ((stageBPriority (shape 6 1 1)) 2)) (fun u a => (littleLaw (shape 6 1 1) u ((stageBPriority (shape 6 1 1)) 2) a : ℝ)) (fun u _ => B6_1_1Law_sound u) (fun u _ a => B6_1_1Little_sound u ((stageBPriority (shape 6 1 1)) 2) a) 15 a +def CB6_1_1I2R15Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB6_1_1I2R15Certificates_valid : + CB6_1_1I2R15Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB6_1_1I2R15CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB6_1_1I2R15P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB6_1_1I2R15Certificates (CB6_1_1I2R15CertificateIndex a)).input +lemma CB6_1_1I2R15P_check : ∀ a : Fin 6, contains (CB6_1_1I2R15Raw a) (CB6_1_1I2R15P a) = true := by + decide +kernel +lemma CB6_1_1I2R15P_sound (a : Fin 6) : + (CB6_1_1I2R15P a).Encloses (CB6_1_1I2R15Value a) := + contains_sound (CB6_1_1I2R15Raw_sound a) (CB6_1_1I2R15P_check a) +def CB6_1_1I2R15Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB6_1_1I2R15Certificates (CB6_1_1I2R15CertificateIndex a)).output +lemma CB6_1_1I2R15Terms_sound (a : Fin 6) : + (CB6_1_1I2R15Terms a).Encloses (Foundation.entropyTerm (CB6_1_1I2R15Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB6_1_1I2R15Certificates_valid + (CB6_1_1I2R15CertificateIndex a) (CB6_1_1I2R15P_sound a) +def CB6_1_1I2R15Entropy : Ball := ⟨0, 0⟩ +lemma CB6_1_1I2R15Entropy_sound : CB6_1_1I2R15Entropy.Encloses (Foundation.finiteEntropy CB6_1_1I2R15Value) := by + exact contains_sound (entropyFin_enclosed 6 CB6_1_1I2R15Value CB6_1_1I2R15Terms CB6_1_1I2R15Terms_sound) (by decide +kernel) +def CB6_1_1I2R15Mass : Ball := ⟨0, 0⟩ +lemma CB6_1_1I2R15Mass_sound : CB6_1_1I2R15Mass.Encloses (∑ a, CB6_1_1I2R15Value a) := by + exact contains_sound (finSumBall_sound 6 CB6_1_1I2R15P CB6_1_1I2R15Value CB6_1_1I2R15P_sound) (by decide +kernel) +def CB6_1_1I2R15MassTerm : Ball := .exact 0 +lemma CB6_1_1I2R15MassTerm_sound : CB6_1_1I2R15MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB6_1_1I2R15Value a))) := + entropyTerm_zero_ball (CB6_1_1I2R15Mass_sound) +def CB6_1_1I2R15H : Ball := ⟨0, 0⟩ +lemma CB6_1_1I2R15H_sound : CB6_1_1I2R15H.Encloses (homogeneousEntropy CB6_1_1I2R15Value) := by + exact contains_sound (homogeneous_enclosed CB6_1_1I2R15Value CB6_1_1I2R15MassTerm_sound CB6_1_1I2R15Entropy_sound) (by decide +kernel) +def CB6_1_1I2R16Value (a : Fin 6) : ℝ := residualLaw (below (shape 6 1 1)) (fun u => (stageBLaw (shape 6 1 1) u : ℝ)) (stageBPriority (shape 6 1 1)) 2 (fun u a => (littleLaw (shape 6 1 1) u ((stageBPriority (shape 6 1 1)) 2) a : ℝ)) 16 a +def CB6_1_1I2R16Raw (a : Fin 6) : Ball := residualBall (below (shape 6 1 1)) B6_1_1Law (stageBPriority (shape 6 1 1)) 2 (fun u => B6_1_1Little u ((stageBPriority (shape 6 1 1)) 2)) 16 a +lemma CB6_1_1I2R16Raw_sound (a : Fin 6) : + (CB6_1_1I2R16Raw a).Encloses (CB6_1_1I2R16Value a) := by + exact residualBall_sound_on (below (shape 6 1 1)) B6_1_1Law (fun u => (stageBLaw (shape 6 1 1) u : ℝ)) (stageBPriority (shape 6 1 1)) 2 (fun u => B6_1_1Little u ((stageBPriority (shape 6 1 1)) 2)) (fun u a => (littleLaw (shape 6 1 1) u ((stageBPriority (shape 6 1 1)) 2) a : ℝ)) (fun u _ => B6_1_1Law_sound u) (fun u _ a => B6_1_1Little_sound u ((stageBPriority (shape 6 1 1)) 2) a) 16 a +def CB6_1_1I2R16Certificates : List CompactCertificate.EntropyDatum := + [.zero] +lemma CB6_1_1I2R16Certificates_valid : + CB6_1_1I2R16Certificates.all (fun c => c.check logTwoBall) = true := by decide +kernel +def CB6_1_1I2R16CertificateIndex (a : Fin 6) : ℕ := + match a.val with + | _ => 0 +def CB6_1_1I2R16P (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB6_1_1I2R16Certificates (CB6_1_1I2R16CertificateIndex a)).input +lemma CB6_1_1I2R16P_check : ∀ a : Fin 6, contains (CB6_1_1I2R16Raw a) (CB6_1_1I2R16P a) = true := by + decide +kernel +lemma CB6_1_1I2R16P_sound (a : Fin 6) : + (CB6_1_1I2R16P a).Encloses (CB6_1_1I2R16Value a) := + contains_sound (CB6_1_1I2R16Raw_sound a) (CB6_1_1I2R16P_check a) +def CB6_1_1I2R16Terms (a : Fin 6) : Ball := + (CompactCertificate.entropyLookup CB6_1_1I2R16Certificates (CB6_1_1I2R16CertificateIndex a)).output +lemma CB6_1_1I2R16Terms_sound (a : Fin 6) : + (CB6_1_1I2R16Terms a).Encloses (Foundation.entropyTerm (CB6_1_1I2R16Value a)) := + CompactCertificate.entropyLookup_sound logTwoBall_sound CB6_1_1I2R16Certificates_valid + (CB6_1_1I2R16CertificateIndex a) (CB6_1_1I2R16P_sound a) +def CB6_1_1I2R16Entropy : Ball := ⟨0, 0⟩ +lemma CB6_1_1I2R16Entropy_sound : CB6_1_1I2R16Entropy.Encloses (Foundation.finiteEntropy CB6_1_1I2R16Value) := by + exact contains_sound (entropyFin_enclosed 6 CB6_1_1I2R16Value CB6_1_1I2R16Terms CB6_1_1I2R16Terms_sound) (by decide +kernel) +def CB6_1_1I2R16Mass : Ball := ⟨0, 0⟩ +lemma CB6_1_1I2R16Mass_sound : CB6_1_1I2R16Mass.Encloses (∑ a, CB6_1_1I2R16Value a) := by + exact contains_sound (finSumBall_sound 6 CB6_1_1I2R16P CB6_1_1I2R16Value CB6_1_1I2R16P_sound) (by decide +kernel) +def CB6_1_1I2R16MassTerm : Ball := .exact 0 +lemma CB6_1_1I2R16MassTerm_sound : CB6_1_1I2R16MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB6_1_1I2R16Value a))) := + entropyTerm_zero_ball (CB6_1_1I2R16Mass_sound) +def CB6_1_1I2R16H : Ball := ⟨0, 0⟩ +lemma CB6_1_1I2R16H_sound : CB6_1_1I2R16H.Encloses (homogeneousEntropy CB6_1_1I2R16Value) := by + exact contains_sound (homogeneous_enclosed CB6_1_1I2R16Value CB6_1_1I2R16MassTerm_sound CB6_1_1I2R16Entropy_sound) (by decide +kernel) +def CB6_1_1I2ResidualEntropies (a : Fin 17) : Ball := + match a.val with + | 0 => CB6_1_1I2R0H + | 1 => CB6_1_1I2R1H + | 2 => CB6_1_1I2R2H + | 3 => CB6_1_1I2R3H + | 4 => CB6_1_1I2R4H + | 5 => CB6_1_1I2R5H + | 6 => CB6_1_1I2R6H + | 7 => CB6_1_1I2R7H + | 8 => CB6_1_1I2R8H + | 9 => CB6_1_1I2R9H + | 10 => CB6_1_1I2R10H + | 11 => CB6_1_1I2R11H + | 12 => CB6_1_1I2R12H + | 13 => CB6_1_1I2R13H + | 14 => CB6_1_1I2R14H + | 15 => CB6_1_1I2R15H + | 16 => CB6_1_1I2R16H + | _ => (.exact 0) +lemma CB6_1_1I2ResidualEntropies_sound (k : Fin 17) : + (CB6_1_1I2ResidualEntropies k).Encloses (homogeneousEntropy + (residualLaw (below (shape 6 1 1)) (fun u => (stageBLaw (shape 6 1 1) u : ℝ)) (stageBPriority (shape 6 1 1)) 2 (fun u a => (littleLaw (shape 6 1 1) u ((stageBPriority (shape 6 1 1)) 2) a : ℝ)) k)) := by + fin_cases k + · exact CB6_1_1I2R0H_sound + · exact CB6_1_1I2R1H_sound + · exact CB6_1_1I2R2H_sound + · exact CB6_1_1I2R3H_sound + · exact CB6_1_1I2R4H_sound + · exact CB6_1_1I2R5H_sound + · exact CB6_1_1I2R6H_sound + · exact CB6_1_1I2R7H_sound + · exact CB6_1_1I2R8H_sound + · exact CB6_1_1I2R9H_sound + · exact CB6_1_1I2R10H_sound + · exact CB6_1_1I2R11H_sound + · exact CB6_1_1I2R12H_sound + · exact CB6_1_1I2R13H_sound + · exact CB6_1_1I2R14H_sound + · exact CB6_1_1I2R15H_sound + · exact CB6_1_1I2R16H_sound +def CB6_1_1I2S3_0_1Value (a : Fin 6) : ℝ := (littleLaw (shape 6 1 1) (shape 3 0 1) ((stageBPriority (shape 6 1 1)) 2) a : ℝ) +def CB6_1_1I2S3_0_1E_4Log : Ball := .exact 0 +lemma CB6_1_1I2S3_0_1E_4Log_sound : CB6_1_1I2S3_0_1E_4Log.Encloses (Real.log (CB6_1_1I2S3_0_1Value (4 : Fin 6))) := by + exact log_exact_one_ball ((B6_1_1Little_sound (shape 3 0 1) ((stageBPriority (shape 6 1 1)) 2)) (4 : Fin 6)) +def CB6_1_1I2S3_0_1E_4 : Ball := ⟨0, 0⟩ +lemma CB6_1_1I2S3_0_1E_4_sound : CB6_1_1I2S3_0_1E_4.Encloses (Foundation.entropyTerm (CB6_1_1I2S3_0_1Value (4 : Fin 6))) := by + exact contains_sound (entropyTerm_ball ((B6_1_1Little_sound (shape 3 0 1) ((stageBPriority (shape 6 1 1)) 2)) (4 : Fin 6)) CB6_1_1I2S3_0_1E_4Log_sound) (by decide +kernel) +def CB6_1_1I2S3_0_1Terms (a : Fin 6) : Ball := + match a.val with + | 4 => ⟨0, 0⟩ + | _ => (.exact 0) +lemma CB6_1_1I2S3_0_1Terms_sound (a : Fin 6) : + (CB6_1_1I2S3_0_1Terms a).Encloses (Foundation.entropyTerm (CB6_1_1I2S3_0_1Value a)) := by + fin_cases a + · exact (entropyTerm_zero_ball ((B6_1_1Little_sound (shape 3 0 1) ((stageBPriority (shape 6 1 1)) 2)) (0 : Fin 6))) + · exact (entropyTerm_zero_ball ((B6_1_1Little_sound (shape 3 0 1) ((stageBPriority (shape 6 1 1)) 2)) (1 : Fin 6))) + · exact (entropyTerm_zero_ball ((B6_1_1Little_sound (shape 3 0 1) ((stageBPriority (shape 6 1 1)) 2)) (2 : Fin 6))) + · exact (entropyTerm_zero_ball ((B6_1_1Little_sound (shape 3 0 1) ((stageBPriority (shape 6 1 1)) 2)) (3 : Fin 6))) + · exact CB6_1_1I2S3_0_1E_4_sound + · exact (entropyTerm_zero_ball ((B6_1_1Little_sound (shape 3 0 1) ((stageBPriority (shape 6 1 1)) 2)) (5 : Fin 6))) +def CB6_1_1I2S3_0_1Entropy : Ball := ⟨0, 0⟩ +lemma CB6_1_1I2S3_0_1Entropy_sound : CB6_1_1I2S3_0_1Entropy.Encloses (Foundation.finiteEntropy CB6_1_1I2S3_0_1Value) := by + exact contains_sound (entropyFin_enclosed 6 CB6_1_1I2S3_0_1Value CB6_1_1I2S3_0_1Terms CB6_1_1I2S3_0_1Terms_sound) (by decide +kernel) +def CB6_1_1I2S3_0_1Mass : Ball := ⟨1, 0⟩ +lemma CB6_1_1I2S3_0_1Mass_sound : CB6_1_1I2S3_0_1Mass.Encloses (∑ a, CB6_1_1I2S3_0_1Value a) := by + exact contains_sound (finSumBall_sound 6 (B6_1_1Little (shape 3 0 1) ((stageBPriority (shape 6 1 1)) 2)) CB6_1_1I2S3_0_1Value (B6_1_1Little_sound (shape 3 0 1) ((stageBPriority (shape 6 1 1)) 2))) (by decide +kernel) +def CB6_1_1I2S3_0_1MassTermLog : Ball := .exact 0 +lemma CB6_1_1I2S3_0_1MassTermLog_sound : CB6_1_1I2S3_0_1MassTermLog.Encloses (Real.log ((∑ a, CB6_1_1I2S3_0_1Value a))) := by + exact log_exact_one_ball (CB6_1_1I2S3_0_1Mass_sound) +def CB6_1_1I2S3_0_1MassTerm : Ball := ⟨0, 0⟩ +lemma CB6_1_1I2S3_0_1MassTerm_sound : CB6_1_1I2S3_0_1MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB6_1_1I2S3_0_1Value a))) := by + exact contains_sound (entropyTerm_ball (CB6_1_1I2S3_0_1Mass_sound) CB6_1_1I2S3_0_1MassTermLog_sound) (by decide +kernel) +def CB6_1_1I2S3_0_1H : Ball := ⟨0, 0⟩ +lemma CB6_1_1I2S3_0_1H_sound : CB6_1_1I2S3_0_1H.Encloses (homogeneousEntropy CB6_1_1I2S3_0_1Value) := by + exact contains_sound (homogeneous_enclosed CB6_1_1I2S3_0_1Value CB6_1_1I2S3_0_1MassTerm_sound CB6_1_1I2S3_0_1Entropy_sound) (by decide +kernel) +def CB6_1_1I2S3_1_0Value (a : Fin 6) : ℝ := (littleLaw (shape 6 1 1) (shape 3 1 0) ((stageBPriority (shape 6 1 1)) 2) a : ℝ) +def CB6_1_1I2S3_1_0E_4Log : Ball := .exact 0 +lemma CB6_1_1I2S3_1_0E_4Log_sound : CB6_1_1I2S3_1_0E_4Log.Encloses (Real.log (CB6_1_1I2S3_1_0Value (4 : Fin 6))) := by + exact log_exact_one_ball ((B6_1_1Little_sound (shape 3 1 0) ((stageBPriority (shape 6 1 1)) 2)) (4 : Fin 6)) +def CB6_1_1I2S3_1_0E_4 : Ball := ⟨0, 0⟩ +lemma CB6_1_1I2S3_1_0E_4_sound : CB6_1_1I2S3_1_0E_4.Encloses (Foundation.entropyTerm (CB6_1_1I2S3_1_0Value (4 : Fin 6))) := by + exact contains_sound (entropyTerm_ball ((B6_1_1Little_sound (shape 3 1 0) ((stageBPriority (shape 6 1 1)) 2)) (4 : Fin 6)) CB6_1_1I2S3_1_0E_4Log_sound) (by decide +kernel) +def CB6_1_1I2S3_1_0Terms (a : Fin 6) : Ball := + match a.val with + | 4 => ⟨0, 0⟩ + | _ => (.exact 0) +lemma CB6_1_1I2S3_1_0Terms_sound (a : Fin 6) : + (CB6_1_1I2S3_1_0Terms a).Encloses (Foundation.entropyTerm (CB6_1_1I2S3_1_0Value a)) := by + fin_cases a + · exact (entropyTerm_zero_ball ((B6_1_1Little_sound (shape 3 1 0) ((stageBPriority (shape 6 1 1)) 2)) (0 : Fin 6))) + · exact (entropyTerm_zero_ball ((B6_1_1Little_sound (shape 3 1 0) ((stageBPriority (shape 6 1 1)) 2)) (1 : Fin 6))) + · exact (entropyTerm_zero_ball ((B6_1_1Little_sound (shape 3 1 0) ((stageBPriority (shape 6 1 1)) 2)) (2 : Fin 6))) + · exact (entropyTerm_zero_ball ((B6_1_1Little_sound (shape 3 1 0) ((stageBPriority (shape 6 1 1)) 2)) (3 : Fin 6))) + · exact CB6_1_1I2S3_1_0E_4_sound + · exact (entropyTerm_zero_ball ((B6_1_1Little_sound (shape 3 1 0) ((stageBPriority (shape 6 1 1)) 2)) (5 : Fin 6))) +def CB6_1_1I2S3_1_0Entropy : Ball := ⟨0, 0⟩ +lemma CB6_1_1I2S3_1_0Entropy_sound : CB6_1_1I2S3_1_0Entropy.Encloses (Foundation.finiteEntropy CB6_1_1I2S3_1_0Value) := by + exact contains_sound (entropyFin_enclosed 6 CB6_1_1I2S3_1_0Value CB6_1_1I2S3_1_0Terms CB6_1_1I2S3_1_0Terms_sound) (by decide +kernel) +def CB6_1_1I2S3_1_0Mass : Ball := ⟨1, 0⟩ +lemma CB6_1_1I2S3_1_0Mass_sound : CB6_1_1I2S3_1_0Mass.Encloses (∑ a, CB6_1_1I2S3_1_0Value a) := by + exact contains_sound (finSumBall_sound 6 (B6_1_1Little (shape 3 1 0) ((stageBPriority (shape 6 1 1)) 2)) CB6_1_1I2S3_1_0Value (B6_1_1Little_sound (shape 3 1 0) ((stageBPriority (shape 6 1 1)) 2))) (by decide +kernel) +def CB6_1_1I2S3_1_0MassTermLog : Ball := .exact 0 +lemma CB6_1_1I2S3_1_0MassTermLog_sound : CB6_1_1I2S3_1_0MassTermLog.Encloses (Real.log ((∑ a, CB6_1_1I2S3_1_0Value a))) := by + exact log_exact_one_ball (CB6_1_1I2S3_1_0Mass_sound) +def CB6_1_1I2S3_1_0MassTerm : Ball := ⟨0, 0⟩ +lemma CB6_1_1I2S3_1_0MassTerm_sound : CB6_1_1I2S3_1_0MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB6_1_1I2S3_1_0Value a))) := by + exact contains_sound (entropyTerm_ball (CB6_1_1I2S3_1_0Mass_sound) CB6_1_1I2S3_1_0MassTermLog_sound) (by decide +kernel) +def CB6_1_1I2S3_1_0H : Ball := ⟨0, 0⟩ +lemma CB6_1_1I2S3_1_0H_sound : CB6_1_1I2S3_1_0H.Encloses (homogeneousEntropy CB6_1_1I2S3_1_0Value) := by + exact contains_sound (homogeneous_enclosed CB6_1_1I2S3_1_0Value CB6_1_1I2S3_1_0MassTerm_sound CB6_1_1I2S3_1_0Entropy_sound) (by decide +kernel) +def CB6_1_1I2S4_0_0Value (a : Fin 6) : ℝ := (littleLaw (shape 6 1 1) (shape 4 0 0) ((stageBPriority (shape 6 1 1)) 2) a : ℝ) +def CB6_1_1I2S4_0_0E_5Log : Ball := .exact 0 +lemma CB6_1_1I2S4_0_0E_5Log_sound : CB6_1_1I2S4_0_0E_5Log.Encloses (Real.log (CB6_1_1I2S4_0_0Value (5 : Fin 6))) := by + exact log_exact_one_ball ((B6_1_1Little_sound (shape 4 0 0) ((stageBPriority (shape 6 1 1)) 2)) (5 : Fin 6)) +def CB6_1_1I2S4_0_0E_5 : Ball := ⟨0, 0⟩ +lemma CB6_1_1I2S4_0_0E_5_sound : CB6_1_1I2S4_0_0E_5.Encloses (Foundation.entropyTerm (CB6_1_1I2S4_0_0Value (5 : Fin 6))) := by + exact contains_sound (entropyTerm_ball ((B6_1_1Little_sound (shape 4 0 0) ((stageBPriority (shape 6 1 1)) 2)) (5 : Fin 6)) CB6_1_1I2S4_0_0E_5Log_sound) (by decide +kernel) +def CB6_1_1I2S4_0_0Terms (a : Fin 6) : Ball := + match a.val with + | 5 => ⟨0, 0⟩ + | _ => (.exact 0) +lemma CB6_1_1I2S4_0_0Terms_sound (a : Fin 6) : + (CB6_1_1I2S4_0_0Terms a).Encloses (Foundation.entropyTerm (CB6_1_1I2S4_0_0Value a)) := by + fin_cases a + · exact (entropyTerm_zero_ball ((B6_1_1Little_sound (shape 4 0 0) ((stageBPriority (shape 6 1 1)) 2)) (0 : Fin 6))) + · exact (entropyTerm_zero_ball ((B6_1_1Little_sound (shape 4 0 0) ((stageBPriority (shape 6 1 1)) 2)) (1 : Fin 6))) + · exact (entropyTerm_zero_ball ((B6_1_1Little_sound (shape 4 0 0) ((stageBPriority (shape 6 1 1)) 2)) (2 : Fin 6))) + · exact (entropyTerm_zero_ball ((B6_1_1Little_sound (shape 4 0 0) ((stageBPriority (shape 6 1 1)) 2)) (3 : Fin 6))) + · exact (entropyTerm_zero_ball ((B6_1_1Little_sound (shape 4 0 0) ((stageBPriority (shape 6 1 1)) 2)) (4 : Fin 6))) + · exact CB6_1_1I2S4_0_0E_5_sound +def CB6_1_1I2S4_0_0Entropy : Ball := ⟨0, 0⟩ +lemma CB6_1_1I2S4_0_0Entropy_sound : CB6_1_1I2S4_0_0Entropy.Encloses (Foundation.finiteEntropy CB6_1_1I2S4_0_0Value) := by + exact contains_sound (entropyFin_enclosed 6 CB6_1_1I2S4_0_0Value CB6_1_1I2S4_0_0Terms CB6_1_1I2S4_0_0Terms_sound) (by decide +kernel) +def CB6_1_1I2S4_0_0Mass : Ball := ⟨1, 0⟩ +lemma CB6_1_1I2S4_0_0Mass_sound : CB6_1_1I2S4_0_0Mass.Encloses (∑ a, CB6_1_1I2S4_0_0Value a) := by + exact contains_sound (finSumBall_sound 6 (B6_1_1Little (shape 4 0 0) ((stageBPriority (shape 6 1 1)) 2)) CB6_1_1I2S4_0_0Value (B6_1_1Little_sound (shape 4 0 0) ((stageBPriority (shape 6 1 1)) 2))) (by decide +kernel) +def CB6_1_1I2S4_0_0MassTermLog : Ball := .exact 0 +lemma CB6_1_1I2S4_0_0MassTermLog_sound : CB6_1_1I2S4_0_0MassTermLog.Encloses (Real.log ((∑ a, CB6_1_1I2S4_0_0Value a))) := by + exact log_exact_one_ball (CB6_1_1I2S4_0_0Mass_sound) +def CB6_1_1I2S4_0_0MassTerm : Ball := ⟨0, 0⟩ +lemma CB6_1_1I2S4_0_0MassTerm_sound : CB6_1_1I2S4_0_0MassTerm.Encloses (Foundation.entropyTerm ((∑ a, CB6_1_1I2S4_0_0Value a))) := by + exact contains_sound (entropyTerm_ball (CB6_1_1I2S4_0_0Mass_sound) CB6_1_1I2S4_0_0MassTermLog_sound) (by decide +kernel) +def CB6_1_1I2S4_0_0H : Ball := ⟨0, 0⟩ +lemma CB6_1_1I2S4_0_0H_sound : CB6_1_1I2S4_0_0H.Encloses (homogeneousEntropy CB6_1_1I2S4_0_0Value) := by + exact contains_sound (homogeneous_enclosed CB6_1_1I2S4_0_0Value CB6_1_1I2S4_0_0MassTerm_sound CB6_1_1I2S4_0_0Entropy_sound) (by decide +kernel) +def CB6_1_1I2Singles (s : Shape) : Ball := + match s 0, s 1, s 2 with + | 3, 0, 1 => CB6_1_1I2S3_0_1H + | 3, 1, 0 => CB6_1_1I2S3_1_0H + | 4, 0, 0 => CB6_1_1I2S4_0_0H + | _, _, _ => (.exact 0) +lemma CB6_1_1I2Singles_sound (u : Shape) (hu : u ∈ below (shape 6 1 1)) + (hd : designated (stageBPriority (shape 6 1 1)) 2 u) : + (CB6_1_1I2Singles u).Encloses (homogeneousEntropy ((fun u a => (littleLaw (shape 6 1 1) u ((stageBPriority (shape 6 1 1)) 2) a : ℝ)) u)) := by + rw [B6_1_1_below] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl + · exact (show ¬ designated (stageBPriority (shape 6 1 1)) 2 (shape 2 1 1) by decide +kernel) hd |>.elim + · exact CB6_1_1I2S3_0_1H_sound + · exact CB6_1_1I2S3_1_0H_sound + · exact CB6_1_1I2S4_0_0H_sound +def CB6_1_1I2Singleton : Ball := ⟨0, 0⟩ +lemma CB6_1_1I2Singleton_sound : CB6_1_1I2Singleton.Encloses + (singletonEntropy (below (shape 6 1 1)) (fun u => (stageBLaw (shape 6 1 1) u : ℝ)) (stageBPriority (shape 6 1 1)) 2 (fun u a => (littleLaw (shape 6 1 1) u ((stageBPriority (shape 6 1 1)) 2) a : ℝ))) := by + exact contains_sound (singletonBall_sound (below (shape 6 1 1)) B6_1_1Law (fun u => (stageBLaw (shape 6 1 1) u : ℝ)) (stageBPriority (shape 6 1 1)) 2 + CB6_1_1I2Singles (fun u a => (littleLaw (shape 6 1 1) u ((stageBPriority (shape 6 1 1)) 2) a : ℝ)) (fun u _ => B6_1_1Law_sound u) CB6_1_1I2Singles_sound) (by decide +kernel) +def CB6_1_1I2Group : Ball := ⟨(5657132190994182012526506947577 / 100000000000000000000000000000000), (10840378481 / 25000000000000000000000000000000)⟩ +lemma CB6_1_1I2Group_sound : CB6_1_1I2Group.Encloses + (groupedEntropy (below (shape 6 1 1)) (fun u => (stageBLaw (shape 6 1 1) u : ℝ)) (stageBPriority (shape 6 1 1)) 2 (fun u a => (littleLaw (shape 6 1 1) u ((stageBPriority (shape 6 1 1)) 2) a : ℝ))) := by + exact contains_sound (Ball.add_sound CB6_1_1I2Singleton_sound + (finSumBall_sound 17 CB6_1_1I2ResidualEntropies _ CB6_1_1I2ResidualEntropies_sound)) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def CB6_1_1I2H : Ball := ⟨(202653924513053421125851349229 / 195312500000000000000000000000), (86916784209 / 50000000000000000000000000000000)⟩ +lemma CB6_1_1I2_sound : CB6_1_1I2H.Encloses (stageBCapacity (shape 6 1 1) 2) := by + have hb := contains_sound (Ball.add_sound CB6_1_1I2PairH_sound + (Ball.neg_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) CB6_1_1I2Group_sound))) + (show contains (.add CB6_1_1I2PairH (.neg (.mul (.exact 2) CB6_1_1I2Group))) CB6_1_1I2H = true by decide +kernel) + unfold CB6_1_1I2PairValue at hb + simpa only [stageBCapacity, nativeCapacity, + show (2 : Fin 3) ≠ 0 by decide, ite_false, sub_eq_add_neg] using hb + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/Certificates/CertificatesReplay.lean b/lean/OAI/LinearAlgebra/MatrixFields/Certificates/CertificatesReplay.lean new file mode 100644 index 0000000000000000000000000000000000000000..e3658f70aa37ff89e17c029c32aee5dc7e20b8a1 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/Certificates/CertificatesReplay.lean @@ -0,0 +1,904 @@ +import Mathlib + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +namespace MatrixMultiplication.Foundation.RationalLogCertificate + +open scoped BigOperators + +noncomputable def sumPower (t : ℝ) (n : ℕ) : ℝ := + ∑ i ∈ Finset.range n, t ^ (i + 1) / (i + 1) + +def rationalSumPower (t : ℚ) (n : ℕ) : ℚ := + ∑ i ∈ Finset.range n, t ^ (i + 1) / (i + 1) + +noncomputable def realApprox (n : ℕ) (x : ℝ) : ℝ := + sumPower ((x - 1) / (x + 1)) n - sumPower (-((x - 1) / (x + 1))) n + +def rationalApprox (n : ℕ) (x : ℚ) : ℚ := + rationalSumPower ((x - 1) / (x + 1)) n - + rationalSumPower (-((x - 1) / (x + 1))) n + +@[simp] theorem rationalSumPower_cast (t : ℚ) (n : ℕ) : + (rationalSumPower t n : ℝ) = sumPower (t : ℝ) n := by + simp [rationalSumPower, sumPower] + +@[simp] theorem rationalApprox_cast (n : ℕ) (x : ℚ) : + (rationalApprox n x : ℝ) = realApprox n (x : ℝ) := by + simp [rationalApprox, realApprox] + +theorem symmetric_expansion_error (t : ℝ) (ht : |t| < 1) (n : ℕ) : + |(Real.log (1 + t) - Real.log (1 - t)) - + (sumPower t n - sumPower (-t) n)| ≤ + 2 * (|t| ^ (n + 1) / (1 - |t|)) := by + have hminus : |sumPower t n + Real.log (1 - t)| ≤ + |t| ^ (n + 1) / (1 - |t|) := + Real.abs_log_sub_add_sum_range_le ht n + have hplus : |sumPower (-t) n + Real.log (1 + t)| ≤ + |t| ^ (n + 1) / (1 - |t|) := by + simpa only [sumPower, abs_neg, sub_neg_eq_add] using + Real.abs_log_sub_add_sum_range_le (by simpa using ht : |-t| < 1) n + calc + _ = |(sumPower (-t) n + Real.log (1 + t)) - + (sumPower t n + Real.log (1 - t))| := by congr 1; ring + _ ≤ |sumPower (-t) n + Real.log (1 + t)| + + |sumPower t n + Real.log (1 - t)| := abs_sub _ _ + _ ≤ 2 * (|t| ^ (n + 1) / (1 - |t|)) := by linarith + +theorem normalized_variable_bounds (x : ℝ) (hlo : 1 ≤ x) (hhi : x ≤ 2) : + 0 ≤ (x - 1) / (x + 1) ∧ (x - 1) / (x + 1) ≤ 1 / 3 := by + have hden : 0 < x + 1 := by linarith + constructor + · exact div_nonneg (sub_nonneg.mpr hlo) hden.le + · apply (div_le_iff₀ hden).2 + linarith + +theorem normalized_log_error (x : ℝ) (hlo : 1 ≤ x) (hhi : x ≤ 2) (n : ℕ) : + |Real.log x - realApprox n x| ≤ + 2 * (((x - 1) / (x + 1)) ^ (n + 1) / (1 - (x - 1) / (x + 1))) := by + let t := (x - 1) / (x + 1) + obtain ⟨ht0, ht3⟩ := normalized_variable_bounds x hlo hhi + have ht1 : t < 1 := by dsimp [t]; linarith + have hden : x + 1 ≠ 0 := by linarith + have hminus : 1 - t ≠ 0 := by linarith + have hplus : 1 + t ≠ 0 := by dsimp [t]; linarith + have hratio : (1 + t) / (1 - t) = x := by + dsimp [t] + field_simp [hden] + ring + have hlog : Real.log x = Real.log (1 + t) - Real.log (1 - t) := by + rw [← hratio] + exact Real.log_div hplus hminus + have ht0' : 0 ≤ t := ht0 + have herror := symmetric_expansion_error t (by rwa [abs_of_nonneg ht0']) n + rw [abs_of_nonneg ht0'] at herror + simpa only [realApprox, ← hlog, t] using herror + +theorem normalized_log_error_80 (x : ℝ) (hlo : 1 ≤ x) (hhi : x ≤ 2) : + |Real.log x - realApprox 80 x| < 1 / (2 : ℝ) ^ 120 := by + obtain ⟨ht0, ht3⟩ := normalized_variable_bounds x hlo hhi + apply lt_of_le_of_lt (normalized_log_error x hlo hhi 80) + calc + _ ≤ 2 * (((1 : ℝ) / 3) ^ 81 / (1 - 1 / 3)) := by gcongr + _ < 1 / (2 : ℝ) ^ 120 := by norm_num + +theorem rational_log_error_80 (x : ℚ) (hlo : 1 ≤ x) (hhi : x ≤ 2) : + |Real.log (x : ℝ) - (rationalApprox 80 x : ℝ)| < 1 / (2 : ℝ) ^ 120 := by + rw [rationalApprox_cast] + exact normalized_log_error_80 (x : ℝ) (by exact_mod_cast hlo) (by exact_mod_cast hhi) + +structure ReducedArgument (x : ℚ) where + exponent : ℤ + mantissa : ℚ + lower : 1 ≤ mantissa + upper : mantissa ≤ 2 + value : x = mantissa * (2 : ℚ) ^ exponent + +def reducedApprox {x : ℚ} (d : ReducedArgument x) : ℚ := + rationalApprox 80 d.mantissa + (d.exponent : ℚ) * rationalApprox 80 2 + +theorem ReducedArgument.positive {x : ℚ} (d : ReducedArgument x) : 0 < x := by + rw [d.value] + exact mul_pos (lt_of_lt_of_le (by norm_num) d.lower) (zpow_pos (by norm_num) _) + +theorem reduced_log_error {x : ℚ} (d : ReducedArgument x) : + |Real.log (x : ℝ) - (reducedApprox d : ℝ)| ≤ + (1 + |(d.exponent : ℝ)|) / (2 : ℝ) ^ 120 := by + have hm : (0 : ℝ) < d.mantissa := by + have hlo : (1 : ℝ) ≤ d.mantissa := by exact_mod_cast d.lower + linarith + have hvalue : (x : ℝ) = (d.mantissa : ℝ) * (2 : ℝ) ^ d.exponent := by + simpa only [Rat.cast_mul, Rat.cast_zpow, Rat.cast_ofNat] using + congrArg (fun q : ℚ => (q : ℝ)) d.value + have hlog : Real.log (x : ℝ) = Real.log (d.mantissa : ℝ) + + (d.exponent : ℝ) * Real.log 2 := by + rw [hvalue, Real.log_mul (ne_of_gt hm) (zpow_ne_zero _ (by norm_num)), + Real.log_zpow] + have hmerr := (rational_log_error_80 d.mantissa d.lower d.upper).le + have htwoerr := (rational_log_error_80 2 (by norm_num) (by norm_num)).le + have hcast : (reducedApprox d : ℝ) = (rationalApprox 80 d.mantissa : ℝ) + + (d.exponent : ℝ) * (rationalApprox 80 2 : ℝ) := by + simp [reducedApprox] + rw [hlog, hcast] + calc + _ = |(Real.log (d.mantissa : ℝ) - (rationalApprox 80 d.mantissa : ℝ)) + + (d.exponent : ℝ) * (Real.log 2 - (rationalApprox 80 2 : ℝ))| := by + congr 1 + ring + _ ≤ |Real.log (d.mantissa : ℝ) - (rationalApprox 80 d.mantissa : ℝ)| + + |(d.exponent : ℝ)| * |Real.log 2 - (rationalApprox 80 2 : ℝ)| := by + simpa only [abs_mul] using abs_add_le + (Real.log (d.mantissa : ℝ) - (rationalApprox 80 d.mantissa : ℝ)) + ((d.exponent : ℝ) * (Real.log 2 - (rationalApprox 80 2 : ℝ))) + _ ≤ 1 / (2 : ℝ) ^ 120 + |(d.exponent : ℝ)| * (1 / (2 : ℝ) ^ 120) := by + exact add_le_add hmerr (mul_le_mul_of_nonneg_left htwoerr (abs_nonneg _)) + _ = (1 + |(d.exponent : ℝ)|) / (2 : ℝ) ^ 120 := by ring + +theorem reduced_entropy_error {x : ℚ} (d : ReducedArgument x) : + |(-(x : ℝ) * Real.log (x : ℝ)) - (-x * reducedApprox d : ℚ)| ≤ + (x : ℝ) * ((1 + |(d.exponent : ℝ)|) / (2 : ℝ) ^ 120) := by + have hx : (0 : ℝ) ≤ x := by exact_mod_cast d.positive.le + have hcast : ((-x * reducedApprox d : ℚ) : ℝ) = -(x : ℝ) * (reducedApprox d : ℝ) := by + simp + rw [hcast, ← mul_sub, abs_mul, abs_neg, abs_of_nonneg hx] + exact mul_le_mul_of_nonneg_left (reduced_log_error d) hx + +def finiteEntropyApprox {ι : Type*} [Fintype ι] (p : ι → ℚ) + (d : ∀ i, ReducedArgument (p i)) : ℚ := + ∑ i, -p i * reducedApprox (d i) + +theorem finite_entropy_error {ι : Type*} [Fintype ι] (p : ι → ℚ) + (d : ∀ i, ReducedArgument (p i)) : + |(∑ i, -(p i : ℝ) * Real.log (p i : ℝ)) - (finiteEntropyApprox p d : ℝ)| ≤ + ∑ i, (p i : ℝ) * ((1 + |((d i).exponent : ℝ)|) / (2 : ℝ) ^ 120) := by + have hcast : (finiteEntropyApprox p d : ℝ) = + ∑ i, ((-p i * reducedApprox (d i) : ℚ) : ℝ) := by + simp [finiteEntropyApprox] + rw [hcast, ← Finset.sum_sub_distrib] + calc + _ ≤ ∑ i, |(-(p i : ℝ) * Real.log (p i : ℝ)) - + ((-p i * reducedApprox (d i) : ℚ) : ℝ)| := + Finset.abs_sum_le_sum_abs _ _ + _ ≤ _ := Finset.sum_le_sum (fun i _ => reduced_entropy_error (d i)) + +theorem finite_entropy_error_of_exponent_bound {ι : Type*} [Fintype ι] + (p : ι → ℚ) (d : ∀ i, ReducedArgument (p i)) + (hnorm : ∑ i, p i = 1) (K : ℝ) + (hK : ∀ i, |((d i).exponent : ℝ)| ≤ K) : + |(∑ i, -(p i : ℝ) * Real.log (p i : ℝ)) - (finiteEntropyApprox p d : ℝ)| ≤ + (1 + K) / (2 : ℝ) ^ 120 := by + apply (finite_entropy_error p d).trans + have hnorm' : ∑ i, (p i : ℝ) = 1 := by exact_mod_cast hnorm + calc + _ ≤ ∑ i, (p i : ℝ) * ((1 + K) / (2 : ℝ) ^ 120) := by + apply Finset.sum_le_sum + intro i _ + have hp : (0 : ℝ) ≤ p i := by exact_mod_cast (d i).positive.le + apply mul_le_mul_of_nonneg_left _ hp + exact div_le_div_of_nonneg_right (add_le_add (le_refl 1) (hK i)) (by positivity) + _ = (1 + K) / (2 : ℝ) ^ 120 := by rw [← Finset.sum_mul, hnorm', one_mul] + +end MatrixMultiplication.Foundation.RationalLogCertificate + +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +namespace MatrixMultiplication.AllFieldCertificates + +open MatrixMultiplication.Foundation.RationalLogCertificate + +structure Ball where + center : ℚ + radius : ℚ + deriving DecidableEq + +namespace Ball + +def Encloses (b : Ball) (x : ℝ) : Prop := |x - (b.center : ℝ)| ≤ (b.radius : ℝ) + +def exact (q : ℚ) : Ball := ⟨q, 0⟩ +def add (a b : Ball) : Ball := ⟨a.center + b.center, a.radius + b.radius⟩ +def neg (a : Ball) : Ball := ⟨-a.center, a.radius⟩ +def mul (a b : Ball) : Ball := + ⟨a.center * b.center, + |a.center| * b.radius + |b.center| * a.radius + a.radius * b.radius⟩ + +def lower (b : Ball) : ℚ := b.center - b.radius +def upper (b : Ball) : ℚ := b.center + b.radius + +def ofBounds (lo hi : ℚ) : Ball := ⟨(lo + hi) / 2, (hi - lo) / 2⟩ + +theorem nonnegative_radius {b : Ball} {x : ℝ} (h : b.Encloses x) : 0 ≤ b.radius := by + have : (0 : ℝ) ≤ b.radius := (abs_nonneg _).trans h + exact_mod_cast this + +theorem bounds {b : Ball} {x : ℝ} (h : b.Encloses x) : + (b.lower : ℝ) ≤ x ∧ x ≤ (b.upper : ℝ) := by + obtain ⟨hl, hu⟩ := abs_le.mp h + simp only [lower, upper, Rat.cast_sub, Rat.cast_add] + constructor <;> linarith + +theorem ofBounds_sound {lo hi : ℚ} {x : ℝ} + (hlo : (lo : ℝ) ≤ x) (hhi : x ≤ (hi : ℝ)) : + (ofBounds lo hi).Encloses x := by + simp only [Encloses, ofBounds, Rat.cast_add, Rat.cast_div, Rat.cast_ofNat, + Rat.cast_sub] + exact abs_le.mpr ⟨by linarith, by linarith⟩ + +theorem exact_sound (q : ℚ) : (exact q).Encloses (q : ℝ) := by + simp [Encloses, exact] + +theorem add_sound {a b : Ball} {x y : ℝ} (hx : a.Encloses x) (hy : b.Encloses y) : + (add a b).Encloses (x + y) := by + unfold Encloses add + simp only [Rat.cast_add] + calc + _ = |(x - (a.center : ℝ)) + (y - (b.center : ℝ))| := by congr 1; ring + _ ≤ |x - (a.center : ℝ)| + |y - (b.center : ℝ)| := abs_add_le _ _ + _ ≤ _ := add_le_add hx hy + +theorem neg_sound {a : Ball} {x : ℝ} (hx : a.Encloses x) : + (neg a).Encloses (-x) := by + simpa only [Encloses, neg, Rat.cast_neg, neg_sub_neg, abs_sub_comm] using hx + +theorem mul_sound {a b : Ball} {x y : ℝ} (hx : a.Encloses x) (hy : b.Encloses y) : + (mul a b).Encloses (x * y) := by + have ha : (0 : ℝ) ≤ a.radius := by exact_mod_cast nonnegative_radius hx + have hb : (0 : ℝ) ≤ b.radius := by exact_mod_cast nonnegative_radius hy + unfold Encloses mul + simp only [Rat.cast_mul, Rat.cast_add, Rat.cast_abs] + calc + _ = |(a.center : ℝ) * (y - (b.center : ℝ)) + + (b.center : ℝ) * (x - (a.center : ℝ)) + + (x - (a.center : ℝ)) * (y - (b.center : ℝ))| := by congr 1; ring + _ ≤ |(a.center : ℝ) * (y - (b.center : ℝ))| + + |(b.center : ℝ) * (x - (a.center : ℝ))| + + |(x - (a.center : ℝ)) * (y - (b.center : ℝ))| := + (abs_add_le _ _).trans (add_le_add (abs_add_le _ _) (le_refl _)) + _ = |(a.center : ℝ)| * |y - (b.center : ℝ)| + + |(b.center : ℝ)| * |x - (a.center : ℝ)| + + |x - (a.center : ℝ)| * |y - (b.center : ℝ)| := by simp only [abs_mul] + _ ≤ _ := add_le_add + (add_le_add (mul_le_mul_of_nonneg_left hy (abs_nonneg _)) + (mul_le_mul_of_nonneg_left hx (abs_nonneg _))) + (mul_le_mul hx hy (abs_nonneg _) ha) + +theorem widen_sound {a b : Ball} {x : ℝ} (hx : a.Encloses x) + (h : |a.center - b.center| + a.radius ≤ b.radius) : b.Encloses x := by + have hc : |(a.center : ℝ) - (b.center : ℝ)| + (a.radius : ℝ) ≤ (b.radius : ℝ) := by + exact_mod_cast h + unfold Encloses + calc + _ = |(x - (a.center : ℝ)) + ((a.center : ℝ) - (b.center : ℝ))| := by congr 1; ring + _ ≤ |x - (a.center : ℝ)| + |(a.center : ℝ) - (b.center : ℝ)| := abs_add_le _ _ + _ ≤ (a.radius : ℝ) + |(a.center : ℝ) - (b.center : ℝ)| := add_le_add hx (le_refl _) + _ ≤ _ := by linarith + +def inv (a : Ball) : Ball := ofBounds (1 / a.upper) (1 / a.lower) + +theorem inv_sound {a : Ball} {x : ℝ} (hx : a.Encloses x) + (hpos : 0 < a.lower) : (inv a).Encloses x⁻¹ := by + have hlo : (0 : ℝ) < a.lower := by exact_mod_cast hpos + obtain ⟨hl, hu⟩ := bounds hx + have hxp : 0 < x := lt_of_lt_of_le hlo hl + apply ofBounds_sound + · simpa only [Rat.cast_div, Rat.cast_one, Rat.cast_inv, one_div] using + one_div_le_one_div_of_le hxp hu + · simpa only [Rat.cast_div, Rat.cast_one, Rat.cast_inv, one_div] using + one_div_le_one_div_of_le hlo hl + +end Ball + +def reductionError {x : ℚ} (d : ReducedArgument x) : ℚ := + (1 + |(d.exponent : ℚ)|) / 2 ^ 120 + +theorem reduction_error_cast {x : ℚ} (d : ReducedArgument x) : + (reductionError d : ℝ) = (1 + |(d.exponent : ℝ)|) / 2 ^ 120 := by + simp [reductionError] + +def logBall (b : Ball) (dl : ReducedArgument b.lower) (du : ReducedArgument b.upper) : Ball := + Ball.ofBounds (reducedApprox dl - reductionError dl) (reducedApprox du + reductionError du) + +theorem logBall_sound {b : Ball} {x : ℝ} (hx : b.Encloses x) + (dl : ReducedArgument b.lower) (du : ReducedArgument b.upper) : + (logBall b dl du).Encloses (Real.log x) := by + have hlo : (0 : ℝ) < b.lower := by exact_mod_cast dl.positive + obtain ⟨hl, hu⟩ := Ball.bounds hx + have hxp : 0 < x := lt_of_lt_of_le hlo hl + have el := abs_le.mp (reduced_log_error dl) + have eu := abs_le.mp (reduced_log_error du) + apply Ball.ofBounds_sound + · have hm := Real.log_le_log hlo hl + simp only [Rat.cast_sub, reduction_error_cast] + linarith [el.1] + · have hm := Real.log_le_log hxp hu + simp only [Rat.cast_add, reduction_error_cast] + linarith [eu.2] + +theorem log_center_lipschitz {b : Ball} {x : ℝ} (hx : b.Encloses x) + (hpos : 0 < b.lower) : + |Real.log x - Real.log (b.center : ℝ)| ≤ (b.radius / b.lower : ℚ) := by + have hr : (0 : ℝ) ≤ b.radius := by exact_mod_cast Ball.nonnegative_radius hx + have hl : (0 : ℝ) < b.lower := by exact_mod_cast hpos + have hcl : (b.lower : ℝ) ≤ b.center := by + simp only [Ball.lower, Rat.cast_sub] + linarith + have hc : (0 : ℝ) < b.center := hl.trans_le hcl + obtain ⟨hxl, _⟩ := Ball.bounds hx + have hxp : 0 < x := hl.trans_le hxl + have logs (a c : ℝ) (ha : 0 < a) (hc : 0 < c) : + Real.log a - Real.log c ≤ (a - c) / c := by + rw [← Real.log_div ha.ne' hc.ne'] + have h := Real.log_le_sub_one_of_pos (div_pos ha hc) + have he : a / c - 1 = (a - c) / c := by field_simp + rwa [he] at h + have hup : Real.log x - Real.log (b.center : ℝ) ≤ (b.radius : ℝ) / (b.lower : ℝ) := by + calc + _ ≤ (x - (b.center : ℝ)) / (b.center : ℝ) := logs _ _ hxp hc + _ ≤ (b.radius : ℝ) / (b.center : ℝ) := + div_le_div_of_nonneg_right (abs_le.mp hx).2 hc.le + _ ≤ _ := div_le_div_of_nonneg_left hr hl hcl + have hdown : Real.log (b.center : ℝ) - Real.log x ≤ + (b.radius : ℝ) / (b.lower : ℝ) := by + calc + _ ≤ ((b.center : ℝ) - x) / x := logs _ _ hc hxp + _ ≤ (b.radius : ℝ) / x := + div_le_div_of_nonneg_right (by linarith [(abs_le.mp hx).1]) hxp.le + _ ≤ _ := div_le_div_of_nonneg_left hr hl hxl + rw [Rat.cast_div] + exact abs_le.mpr ⟨by linarith, hup⟩ + +inductive Expression where + | constant : ℚ → Expression + | add : Expression → Expression → Expression + | neg : Expression → Expression + | mul : Expression → Expression → Expression + | inv : Expression → Expression + | log : Expression → Expression + +noncomputable def Expression.value : Expression → ℝ + | .constant q => q + | .add a b => a.value + b.value + | .neg a => -a.value + | .mul a b => a.value * b.value + | .inv a => a.value⁻¹ + | .log a => Real.log a.value + +inductive Certificate : Expression → Ball → Prop where + | constant (q : ℚ) : Certificate (.constant q) (.exact q) + | add {e f a b} : Certificate e a → Certificate f b → Certificate (.add e f) (.add a b) + | neg {e a} : Certificate e a → Certificate (.neg e) (.neg a) + | mul {e f a b} : Certificate e a → Certificate f b → Certificate (.mul e f) (.mul a b) + | inv {e a} : Certificate e a → 0 < a.lower → Certificate (.inv e) (.inv a) + | log {e a} (dl : ReducedArgument a.lower) (du : ReducedArgument a.upper) : + Certificate e a → Certificate (.log e) (logBall a dl du) + | widen {e a b} : Certificate e a → |a.center - b.center| + a.radius ≤ b.radius → + Certificate e b + +theorem Certificate.sound {e : Expression} {b : Ball} (h : Certificate e b) : + b.Encloses e.value := by + induction h with + | constant q => exact Ball.exact_sound q + | add _ _ ih₁ ih₂ => exact Ball.add_sound ih₁ ih₂ + | neg _ ih => exact Ball.neg_sound ih + | mul _ _ ih₁ ih₂ => exact Ball.mul_sound ih₁ ih₂ + | inv _ hp ih => exact Ball.inv_sound ih hp + | log dl du _ ih => exact logBall_sound ih dl du + | widen _ hw ih => exact Ball.widen_sound ih hw + +theorem published_endpoint_below_target : + (2371054886006745685 : ℚ) / 10 ^ 18 < (2371054887 : ℚ) / 10 ^ 9 := by + decide +kernel + +theorem value_below_target_of_certificate {e : Expression} {b : Ball} + (hc : Certificate e b) + (hu : b.upper ≤ (2371054886006745685 : ℚ) / 10 ^ 18) : + e.value < (2371054887 : ℝ) / 10 ^ 9 := by + have hbound := (Ball.bounds hc.sound).2 + have hu' : (b.upper : ℝ) ≤ (2371054886006745685 : ℝ) / 10 ^ 18 := by + have hcast : (b.upper : ℝ) ≤ ((2371054886006745685 / 10 ^ 18 : ℚ) : ℝ) := + Rat.cast_le.mpr hu + simpa only [Rat.cast_div, Rat.cast_pow, Rat.cast_ofNat] using hcast + have htarget : (2371054886006745685 : ℝ) / 10 ^ 18 < + (2371054887 : ℝ) / 10 ^ 9 := by + have hcast : ((2371054886006745685 / 10 ^ 18 : ℚ) : ℝ) < + ((2371054887 / 10 ^ 9 : ℚ) : ℝ) := Rat.cast_lt.mpr published_endpoint_below_target + simpa only [Rat.cast_div, Rat.cast_pow, Rat.cast_ofNat] using hcast + exact lt_of_le_of_lt (hbound.trans hu') htarget + +end MatrixMultiplication.AllFieldCertificates + +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +namespace MatrixMultiplication.AllFieldCertificates.Replay + +open MatrixMultiplication.Foundation.RationalLogCertificate + +inductive Op where + | constant (q : ℚ) + | add (i j : ℕ) + | neg (i : ℕ) + | mul (i j : ℕ) + | inv (i : ℕ) + | log (i : ℕ) + deriving DecidableEq, Repr + +instance : Hashable Op where + hash + | .constant q => hash ((0 : ℕ), q.num, q.den) + | .add i j => hash ((1 : ℕ), i, j) + | .neg i => hash ((2 : ℕ), i) + | .mul i j => hash ((3 : ℕ), i, j) + | .inv i => hash ((4 : ℕ), i) + | .log i => hash ((5 : ℕ), i) + +abbrev Program := Array Op + +noncomputable def Op.value (v : ℕ → ℝ) : Op → ℝ + | .constant q => q + | .add i j => v i + v j + | .neg i => -v i + | .mul i j => v i * v j + | .inv i => (v i)⁻¹ + | .log i => Real.log (v i) + +noncomputable def Program.eval (p : Program) : Array ℝ := + p.foldl (fun v op => v.push (op.value (fun i => v[i]?.getD 0))) #[] + +def contains (a b : Ball) : Bool := + decide (|a.center - b.center| + a.radius ≤ b.radius) + +theorem contains_sound {a b : Ball} {x : ℝ} + (ha : a.Encloses x) (hab : contains a b = true) : b.Encloses x := + Ball.widen_sound ha (of_decide_eq_true hab) + +noncomputable def polynomial (t : ℝ) : List ℚ → ℝ + | [] => 0 + | a :: as => (a : ℝ) + t * polynomial t as + +def traceHead (trace : List Ball) : Ball := trace.headD (.exact 0) + +def checkPolynomial (t : Ball) : List ℚ → List Ball → Bool + | [], [] => true + | a :: as, b :: bs => + contains (Ball.add (.exact a) (Ball.mul t (traceHead bs))) b && + checkPolynomial t as bs + | _, _ => false + +theorem checkPolynomial_sound {t : Ball} {x : ℝ} (hx : t.Encloses x) + (as : List ℚ) (trace : List Ball) + (h : checkPolynomial t as trace = true) : + (traceHead trace).Encloses (polynomial x as) := by + induction as generalizing trace with + | nil => + cases trace with + | nil => simpa [traceHead, polynomial] using Ball.exact_sound 0 + | cons b bs => simp [checkPolynomial] at h + | cons a as ih => + cases trace with + | nil => simp [checkPolynomial] at h + | cons b bs => + simp only [checkPolynomial, Bool.and_eq_true] at h + exact contains_sound + (Ball.add_sound (Ball.exact_sound a) (Ball.mul_sound hx (ih bs h.2))) h.1 + +def logCoefficients : List ℚ := + (List.range 24).map (fun i => 1 / (2 * (i : ℚ) + 1)) + +theorem realApprox_eq_polynomial (x : ℝ) : + realApprox 48 x = + 2 * ((x - 1) / (x + 1)) * + polynomial (((x - 1) / (x + 1)) ^ 2) logCoefficients := by + simp only [realApprox, sumPower] + norm_num [Finset.sum_range_succ, logCoefficients, List.range_succ, + polynomial, List.map_append, List.foldr_append] + ring + +theorem normalized_log_error_48 (x : ℝ) (hlo : 1 ≤ x) (hhi : x ≤ 2) : + |Real.log x - realApprox 48 x| < 1 / (2 : ℝ) ^ 72 := by + obtain ⟨ht0, ht3⟩ := normalized_variable_bounds x hlo hhi + apply lt_of_le_of_lt (normalized_log_error x hlo hhi 48) + calc + _ ≤ 2 * (((1 : ℝ) / 3) ^ 49 / (1 - 1 / 3)) := by gcongr + _ < 1 / (2 : ℝ) ^ 72 := by norm_num + +def pad (b : Ball) (error : ℚ) : Ball := ⟨b.center, b.radius + error⟩ + +theorem pad_sound {b : Ball} {x y : ℝ} {error : ℚ} + (hx : b.Encloses x) (hxy : |y - x| ≤ (error : ℝ)) : + (pad b error).Encloses y := by + unfold Ball.Encloses pad at * + simp only [Rat.cast_add] + calc + _ = |(y - x) + (x - (b.center : ℝ))| := by congr 1; ring + _ ≤ |y - x| + |x - (b.center : ℝ)| := abs_add_le _ _ + _ ≤ (error : ℝ) + (b.radius : ℝ) := add_le_add hxy hx + _ = _ := by ring + +def logVariable (m : ℚ) : ℚ := (m - 1) / (m + 1) + +def normalizedLogBall (m : ℚ) (trace : List Ball) : Ball := + pad (Ball.mul (.exact (2 * logVariable m)) (traceHead trace)) (1 / 2 ^ 72) + +theorem normalizedLogBall_sound {m : ℚ} {trace : List Ball} + (hlo : 1 ≤ m) (hhi : m ≤ 2) + (hc : checkPolynomial (.exact (logVariable m ^ 2)) logCoefficients trace = true) : + (normalizedLogBall m trace).Encloses (Real.log (m : ℝ)) := by + have hp := checkPolynomial_sound (Ball.exact_sound (logVariable m ^ 2)) + logCoefficients trace hc + have hv : (logVariable m : ℝ) = ((m : ℝ) - 1) / ((m : ℝ) + 1) := by + simp [logVariable] + have ha : (Ball.mul (.exact (2 * logVariable m)) (traceHead trace)).Encloses + (realApprox 48 (m : ℝ)) := by + rw [realApprox_eq_polynomial] + convert Ball.mul_sound (Ball.exact_sound (2 * logVariable m)) hp using 1 + simp [hv] + apply pad_sound ha + have h := (normalized_log_error_48 (m : ℝ) + (by exact_mod_cast hlo) (by exact_mod_cast hhi)).le + simpa using h + +end MatrixMultiplication.AllFieldCertificates.Replay + +namespace MatrixMultiplication.CompactCertificate + +structure NInterval where + lo : ℕ + hi : ℕ + deriving DecidableEq, Repr + +namespace NInterval + +def Encloses (S : ℕ) (a : NInterval) (x : ℝ) : Prop := + (a.lo : ℝ) / S ≤ x ∧ x ≤ (a.hi : ℝ) / S + +def zero : NInterval := ⟨0, 0⟩ +def add (a b : NInterval) : NInterval := ⟨a.lo + b.lo, a.hi + b.hi⟩ +def mul (S : ℕ) (a b : NInterval) : NInterval := + ⟨a.lo * b.lo / S, a.hi * b.hi / S + 1⟩ +def frac (S n d : ℕ) : NInterval := ⟨n * S / d, n * S / d + 1⟩ + +lemma div_floor_bounds (n d : ℕ) (hd : 0 < d) : + ((n / d : ℕ) : ℝ) ≤ (n : ℝ) / d ∧ + (n : ℝ) / d ≤ ((n / d : ℕ) : ℝ) + 1 := by + have hd' : (0 : ℝ) < d := by exact_mod_cast hd + constructor + · apply (le_div_iff₀ hd').2 + exact_mod_cast Nat.div_mul_le_self n d + · apply (div_le_iff₀ hd').2 + have h := Nat.lt_div_mul_add (a := n) hd + exact_mod_cast (by simpa only [Nat.add_mul, Nat.one_mul] using h.le : n ≤ (n / d + 1) * d) + +lemma zero_sound (S : ℕ) : Encloses S zero 0 := by simp [Encloses, zero] + +lemma nonneg {S : ℕ} {a : NInterval} {x : ℝ} (h : Encloses S a x) : 0 ≤ x := + (div_nonneg (Nat.cast_nonneg _) (Nat.cast_nonneg _)).trans h.1 + +lemma add_sound {S : ℕ} {a b : NInterval} {x y : ℝ} + (hx : Encloses S a x) (hy : Encloses S b y) : + Encloses S (add a b) (x + y) := by + simpa [Encloses, add, Nat.cast_add, add_div] using And.intro (add_le_add hx.1 hy.1) (add_le_add hx.2 hy.2) + +lemma mul_sound {S : ℕ} (hS : 0 < S) {a b : NInterval} {x y : ℝ} + (hx : Encloses S a x) (hy : Encloses S b y) : + Encloses S (mul S a b) (x * y) := by + have hS' : (0 : ℝ) < S := by exact_mod_cast hS + have hlo := (div_floor_bounds (a.lo * b.lo) S hS).1 + have hhi := (div_floor_bounds (a.hi * b.hi) S hS).2 + unfold Encloses mul + simp only [Nat.cast_add, Nat.cast_one] + constructor + · calc + _ ≤ ((a.lo : ℝ) * b.lo / S) / S := by + exact div_le_div_of_nonneg_right (by simpa only [Nat.cast_mul] using hlo) hS'.le + _ = ((a.lo : ℝ) / S) * ((b.lo : ℝ) / S) := by ring + _ ≤ x * y := mul_le_mul hx.1 hy.1 (by positivity) (nonneg hx) + · calc + x * y ≤ ((a.hi : ℝ) / S) * ((b.hi : ℝ) / S) := + mul_le_mul hx.2 hy.2 (nonneg hy) (by positivity) + _ = ((a.hi : ℝ) * b.hi / S) / S := by ring + _ ≤ _ := div_le_div_of_nonneg_right (by simpa only [Nat.cast_mul] using hhi) hS'.le + +lemma frac_sound {S n d : ℕ} (hS : 0 < S) (hd : 0 < d) : + Encloses S (frac S n d) ((n : ℝ) / d) := by + have hS' : (0 : ℝ) < S := by exact_mod_cast hS + have hb := div_floor_bounds (n * S) d hd + unfold Encloses frac + simp only [Nat.cast_add, Nat.cast_one] + constructor + · calc + _ ≤ ((n : ℝ) * S / d) / S := + div_le_div_of_nonneg_right (by simpa only [Nat.cast_mul] using hb.1) hS'.le + _ = _ := by field_simp + · calc + (n : ℝ) / d = ((n : ℝ) * S / d) / S := by field_simp + _ ≤ _ := div_le_div_of_nonneg_right (by simpa only [Nat.cast_mul] using hb.2) hS'.le + +def oddHorner (S : ℕ) (t : NInterval) (start : ℕ) : ℕ → NInterval + | 0 => zero + | n + 1 => add (frac S 1 (2 * start + 1)) + (mul S t (oddHorner S t (start + 1) n)) + +noncomputable def oddPolynomial (t : ℝ) (start : ℕ) : ℕ → ℝ + | 0 => 0 + | n + 1 => 1 / (2 * (start : ℝ) + 1) + t * oddPolynomial t (start + 1) n + +lemma oddHorner_sound {S : ℕ} (hS : 0 < S) {t : NInterval} {x : ℝ} + (hx : Encloses S t x) (start n : ℕ) : + Encloses S (oddHorner S t start n) (oddPolynomial x start n) := by + induction n generalizing start with + | zero => exact zero_sound S + | succ n ih => + apply add_sound + · simpa only [Nat.cast_one, Nat.cast_add, Nat.cast_mul, Nat.cast_ofNat] + using (frac_sound (n := 1) hS (by omega : 0 < 2 * start + 1)) + · exact mul_sound hS hx (ih (start + 1)) + +end NInterval +end MatrixMultiplication.CompactCertificate + +namespace MatrixMultiplication.CompactCertificate +open AllFieldCertificates AllFieldCertificates.Replay +open Foundation.RationalLogCertificate + +lemma oddPolynomial_eq (x : ℝ) : + NInterval.oddPolynomial x 0 24 = polynomial x logCoefficients := by + norm_num [NInterval.oddPolynomial, polynomial, logCoefficients, List.range_succ] + +def scale : ℕ := 10 ^ 40 +lemma scale_pos : 0 < scale := by decide + +def logApprox (n d : ℕ) : NInterval := + let u := NInterval.frac scale (n - d) (n + d) + NInterval.mul scale (NInterval.add u u) + (NInterval.oddHorner scale (NInterval.mul scale u u) 0 24) + +lemma logApprox_sound {n d : ℕ} (hd : 0 < d) (hlo : d ≤ n) : + (logApprox n d).Encloses scale (realApprox 48 ((n : ℝ) / d)) := by + have hd' : (d : ℝ) ≠ 0 := by exact_mod_cast hd.ne' + have hsum : 0 < n + d := by omega + have hu := NInterval.frac_sound (n := n - d) scale_pos hsum + have heq : (((n : ℝ) / d - 1) / ((n : ℝ) / d + 1)) = + ((n - d : ℕ) : ℝ) / (n + d : ℕ) := by + rw [Nat.cast_sub hlo, Nat.cast_add] + field_simp + rw [realApprox_eq_polynomial, heq, ← oddPolynomial_eq] + simpa only [logApprox, two_mul, pow_two] using + NInterval.mul_sound scale_pos (NInterval.add_sound hu hu) + (NInterval.oddHorner_sound scale_pos (NInterval.mul_sound scale_pos hu hu) 0 24) + +def NInterval.ball (a : NInterval) : Ball := + Ball.ofBounds ((a.lo : ℚ) / scale) ((a.hi : ℚ) / scale) + +lemma NInterval.ball_sound {a : NInterval} {x : ℝ} (h : a.Encloses scale x) : + a.ball.Encloses x := by + apply Ball.ofBounds_sound + · simpa only [Rat.cast_div, Rat.cast_natCast] using h.1 + · simpa only [Rat.cast_div, Rat.cast_natCast] using h.2 + +def normalized (n d : ℕ) : Ball := pad (logApprox n d).ball (1 / 2 ^ 72) + +lemma normalized_sound {n d : ℕ} (hd : 0 < d) (hlo : d ≤ n) (hhi : n ≤ 2 * d) : + (normalized n d).Encloses (Real.log ((n : ℝ) / d)) := by + apply pad_sound (NInterval.ball_sound (logApprox_sound hd hlo)) + have hd' : (0 : ℝ) < d := by exact_mod_cast hd + have hl : 1 ≤ (n : ℝ) / d := (le_div_iff₀ hd').2 (by simpa only [one_mul] using (Nat.cast_le.mpr hlo : (d : ℝ) ≤ n)) + have hh : (n : ℝ) / d ≤ 2 := (div_le_iff₀ hd').2 (by exact_mod_cast hhi) + simpa only [Rat.cast_div, Rat.cast_one, Rat.cast_pow, Rat.cast_ofNat] using + (normalized_log_error_48 ((n : ℝ) / d) hl hh).le + +structure LogData where + exponent : ℤ + numerator : ℕ + denominator : ℕ + deriving DecidableEq + +def logResult (two a : Ball) (w : LogData) : Ball := + pad (Ball.add (normalized w.numerator w.denominator) + (Ball.mul (.exact w.exponent) two)) (a.radius / a.lower) + +def checkLog (two a b : Ball) (w : LogData) : Bool := + decide (0 < a.lower ∧ 0 < w.denominator ∧ w.denominator ≤ w.numerator ∧ + w.numerator ≤ 2 * w.denominator ∧ + a.center = (w.numerator : ℚ) / w.denominator * (2 : ℚ) ^ w.exponent) && + contains (logResult two a w) b + +lemma checkLog_sound {two a b : Ball} {w : LogData} {x : ℝ} + (htwo : two.Encloses (Real.log 2)) (hx : a.Encloses x) + (h : checkLog two a b w = true) : b.Encloses (Real.log x) := by + simp only [checkLog, Bool.and_eq_true] at h + obtain ⟨hpos, hd, hlo, hhi, heq⟩ := of_decide_eq_true h.1 + have hm : (0 : ℝ) < (w.numerator : ℝ) / w.denominator := by + have hn : 0 < w.numerator := lt_of_lt_of_le hd hlo + exact div_pos (Nat.cast_pos.mpr hn) (Nat.cast_pos.mpr hd) + have heq' : (a.center : ℝ) = ((w.numerator : ℝ) / w.denominator) * (2 : ℝ) ^ w.exponent := by + simpa only [Rat.cast_mul, Rat.cast_zpow, Rat.cast_ofNat, Rat.cast_div, Rat.cast_natCast] using + congrArg (fun q : ℚ => (q : ℝ)) heq + have hlog : Real.log (a.center : ℝ) = + Real.log ((w.numerator : ℝ) / w.denominator) + (w.exponent : ℝ) * Real.log 2 := by + rw [heq', Real.log_mul (ne_of_gt hm) (zpow_ne_zero _ (by norm_num)), Real.log_zpow] + have hcenter : (Ball.add (normalized w.numerator w.denominator) + (Ball.mul (.exact w.exponent) two)).Encloses (Real.log (a.center : ℝ)) := by + rw [hlog] + exact Ball.add_sound (normalized_sound hd hlo hhi) + (by simpa using Ball.mul_sound (Ball.exact_sound (w.exponent : ℚ)) htwo) + exact contains_sound (pad_sound hcenter (log_center_lipschitz hx hpos)) h.2 + +end MatrixMultiplication.CompactCertificate + +namespace MatrixMultiplication.AllFieldCertificates.Replay +abbrev LogWitness := MatrixMultiplication.CompactCertificate.LogData +abbrev logResult := MatrixMultiplication.CompactCertificate.logResult + +def checkLog (two a b : Ball) (w : LogWitness) : Bool := + decide (0 < a.lower ∧ 0 < w.denominator ∧ w.denominator ≤ w.numerator ∧ + w.numerator ≤ 2 * w.denominator ∧ + a.center = (w.numerator : ℚ) / w.denominator * (2 : ℚ) ^ w.exponent) && + contains (logResult two a w) b + +theorem checkLog_sound {two a b : Ball} {w : LogWitness} {x : ℝ} + (htwo : two.Encloses (Real.log 2)) (hx : a.Encloses x) + (h : checkLog two a b w = true) : b.Encloses (Real.log x) := + MatrixMultiplication.CompactCertificate.checkLog_sound htwo hx h + +structure Witness where + ball : Ball + logarithm : Option LogWitness := none + deriving DecidableEq + +def ballAt (v : Array Ball) (i : ℕ) : Ball := v[i]?.getD (.exact 0) + +def checkStep (two : Ball) (v : Array Ball) (op : Op) (w : Witness) : Bool := + match op with + | .constant q => contains (.exact q) w.ball + | .add i j => contains (Ball.add (ballAt v i) (ballAt v j)) w.ball + | .neg i => contains (Ball.neg (ballAt v i)) w.ball + | .mul i j => contains (Ball.mul (ballAt v i) (ballAt v j)) w.ball + | .inv i => decide (0 < (ballAt v i).lower) && contains (Ball.inv (ballAt v i)) w.ball + | .log i => match w.logarithm with + | none => false + | some lw => checkLog two (ballAt v i) w.ball lw + +def Related (bs : Array Ball) (vs : Array ℝ) : Prop := + bs.size = vs.size ∧ ∀ i, (ballAt bs i).Encloses (vs[i]?.getD 0) + +theorem checkStep_sound {two : Ball} (htwo : two.Encloses (Real.log 2)) + {bs : Array Ball} {vs : Array ℝ} (hr : Related bs vs) + {op : Op} {w : Witness} (hc : checkStep two bs op w = true) : + w.ball.Encloses (op.value (fun i => vs[i]?.getD 0)) := by + cases op with + | constant q => exact contains_sound (Ball.exact_sound q) hc + | add i j => exact contains_sound (Ball.add_sound (hr.2 i) (hr.2 j)) hc + | neg i => exact contains_sound (Ball.neg_sound (hr.2 i)) hc + | mul i j => exact contains_sound (Ball.mul_sound (hr.2 i) (hr.2 j)) hc + | inv i => + simp only [checkStep, Bool.and_eq_true] at hc + exact contains_sound (Ball.inv_sound (hr.2 i) (of_decide_eq_true hc.1)) hc.2 + | log i => + cases hw : w.logarithm with + | none => simp [checkStep, hw] at hc + | some lw => + simp only [checkStep, hw] at hc + exact checkLog_sound htwo (hr.2 i) hc + +theorem Related.push {bs : Array Ball} {vs : Array ℝ} (hr : Related bs vs) + {b : Ball} {v : ℝ} (hv : b.Encloses v) : Related (bs.push b) (vs.push v) := by + constructor + · simpa using hr.1 + · intro i + simp only [ballAt, Array.getElem?_push, ← hr.1] + split_ifs with hi + · exact hv + · exact hr.2 i + +theorem Related.empty : Related #[] #[] := by + constructor + · rfl + · intro i + simpa [ballAt] using Ball.exact_sound 0 + +noncomputable def evalFrom (ops : List Op) (vs : Array ℝ) : Array ℝ := + ops.foldl (fun v op => v.push (op.value (fun i => v[i]?.getD 0))) vs + +def ballsFrom (ws : List Witness) (bs : Array Ball) : Array Ball := + ws.foldl (fun b w => b.push w.ball) bs + +def checkFrom (two : Ball) : List Op → List Witness → Array Ball → Bool + | [], [], _ => true + | op :: ops, w :: ws, bs => + checkStep two bs op w && checkFrom two ops ws (bs.push w.ball) + | _, _, _ => false + +theorem checkFrom_sound {two : Ball} (htwo : two.Encloses (Real.log 2)) + (ops : List Op) (ws : List Witness) {bs : Array Ball} {vs : Array ℝ} + (hr : Related bs vs) (hc : checkFrom two ops ws bs = true) : + Related (ballsFrom ws bs) (evalFrom ops vs) := by + induction ops generalizing ws bs vs with + | nil => + cases ws with + | nil => exact hr + | cons w ws => simp [checkFrom] at hc + | cons op ops ih => + cases ws with + | nil => simp [checkFrom] at hc + | cons w ws => + simp only [checkFrom, Bool.and_eq_true] at hc + exact ih ws (hr.push (checkStep_sound htwo hr hc.1)) hc.2 + +def checkProgram (two : Ball) (p : Program) (ws : List Witness) : Bool := + checkFrom two p.toList ws #[] + +theorem checkProgram_sound {two : Ball} (htwo : two.Encloses (Real.log 2)) + {p : Program} {ws : List Witness} (hc : checkProgram two p ws = true) : + Related (ballsFrom ws #[]) p.eval := by + have h := checkFrom_sound htwo p.toList ws Related.empty hc + simpa only [evalFrom, Array.foldl_toList, Program.eval] using h + +theorem evalFrom_append (as bs : List Op) (v : Array ℝ) : + evalFrom (as ++ bs) v = evalFrom bs (evalFrom as v) := by + simp [evalFrom, List.foldl_append] + +theorem ballsFrom_append (as bs : List Witness) (v : Array Ball) : + ballsFrom (as ++ bs) v = ballsFrom bs (ballsFrom as v) := by + simp [ballsFrom, List.foldl_append] + +theorem checkFrom_append (two : Ball) (as bs : List Op) (aw bw : List Witness) + (v : Array Ball) (hlen : as.length = aw.length) : + checkFrom two (as ++ bs) (aw ++ bw) v = + (checkFrom two as aw v && checkFrom two bs bw (ballsFrom aw v)) := by + induction as generalizing aw v with + | nil => + cases aw with + | nil => simp [checkFrom, ballsFrom] + | cons w ws => simp at hlen + | cons a as ih => + cases aw with + | nil => simp at hlen + | cons w ws => + simp only [List.length_cons, Nat.add_right_cancel_iff] at hlen + simp only [List.cons_append, checkFrom, ballsFrom, List.foldl_cons] + rw [ih ws (v.push w.ball) hlen] + exact (Bool.and_assoc _ _ _).symm + +theorem checked_upper_bound {two : Ball} (htwo : two.Encloses (Real.log 2)) + {p : Program} {ws : List Witness} (hc : checkProgram two p ws = true) + (i : ℕ) (bound : ℚ) (hb : (ballAt (ballsFrom ws #[]) i).upper ≤ bound) : + p.eval[i]?.getD 0 ≤ (bound : ℝ) := by + have hv := (Ball.bounds ((checkProgram_sound htwo hc).2 i)).2 + exact hv.trans (by exact_mod_cast hb) + +theorem checked_below_target {two : Ball} (htwo : two.Encloses (Real.log 2)) + {p : Program} {ws : List Witness} (hc : checkProgram two p ws = true) + (i : ℕ) (hb : (ballAt (ballsFrom ws #[]) i).upper < (2371054887 : ℚ) / 10 ^ 9) : + p.eval[i]?.getD 0 < (2371054887 : ℝ) / 10 ^ 9 := by + have hv := (Ball.bounds ((checkProgram_sound htwo hc).2 i)).2 + apply lt_of_le_of_lt hv + have hcast : ((ballAt (ballsFrom ws #[]) i).upper : ℝ) < + (((2371054887 : ℚ) / 10 ^ 9 : ℚ) : ℝ) := Rat.cast_lt.mpr hb + simpa only [Rat.cast_div, Rat.cast_pow, Rat.cast_ofNat] using hcast + +end MatrixMultiplication.AllFieldCertificates.Replay + +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/Certificates/Four0_1_7.lean b/lean/OAI/LinearAlgebra/MatrixFields/Certificates/Four0_1_7.lean new file mode 100644 index 0000000000000000000000000000000000000000..8c9a22231375c57f30f2c1dea9abc973dd514e1e --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/Certificates/Four0_1_7.lean @@ -0,0 +1,206 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Certificates.Zero0_1_7 + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def Z0_1_7Value (a : PairSlot) : ℝ := (zeroPairLaw (shape 0 1 7) a.1 a.2 : ℝ) +def Z0_1_7E_4_5LogWitness : LogWitness := ⟨-1, 1, 1⟩ +def Z0_1_7E_4_5Log : Ball := ⟨(-6931471805599453094172319305033 / 10000000000000000000000000000000), (8470329473 / 20000000000000000000000000000000)⟩ +lemma Z0_1_7E_4_5Log_sound : Z0_1_7E_4_5Log.Encloses (Real.log (Z0_1_7Value ((4,5) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound (Z0_1_7Probs_sound ((4,5) : PairSlot)) (w := Z0_1_7E_4_5LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z0_1_7E_4_5 : Ball := ⟨(6931471805599453094172319305033 / 20000000000000000000000000000000), (21175823683 / 100000000000000000000000000000000)⟩ +lemma Z0_1_7E_4_5_sound : Z0_1_7E_4_5.Encloses (Foundation.entropyTerm (Z0_1_7Value ((4,5) : PairSlot))) := by + exact contains_sound (entropyTerm_ball (Z0_1_7Probs_sound ((4,5) : PairSlot)) Z0_1_7E_4_5Log_sound) (by decide +kernel) +def Z0_1_7E_5_4LogWitness : LogWitness := ⟨-1, 1, 1⟩ +def Z0_1_7E_5_4Log : Ball := ⟨(-6931471805599453094172319305033 / 10000000000000000000000000000000), (8470329473 / 20000000000000000000000000000000)⟩ +lemma Z0_1_7E_5_4Log_sound : Z0_1_7E_5_4Log.Encloses (Real.log (Z0_1_7Value ((5,4) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound (Z0_1_7Probs_sound ((5,4) : PairSlot)) (w := Z0_1_7E_5_4LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z0_1_7E_5_4 : Ball := ⟨(6931471805599453094172319305033 / 20000000000000000000000000000000), (21175823683 / 100000000000000000000000000000000)⟩ +lemma Z0_1_7E_5_4_sound : Z0_1_7E_5_4.Encloses (Foundation.entropyTerm (Z0_1_7Value ((5,4) : PairSlot))) := by + exact contains_sound (entropyTerm_ball (Z0_1_7Probs_sound ((5,4) : PairSlot)) Z0_1_7E_5_4Log_sound) (by decide +kernel) +def Z0_1_7Terms (a : PairSlot) : Ball := + match a.1.val, a.2.val with + | 4, 5 => ⟨(6931471805599453094172319305033 / 20000000000000000000000000000000), (21175823683 / 100000000000000000000000000000000)⟩ + | 5, 4 => ⟨(6931471805599453094172319305033 / 20000000000000000000000000000000), (21175823683 / 100000000000000000000000000000000)⟩ + | _, _ => (.exact 0) +lemma Z0_1_7Terms_sound (a : PairSlot) : + (Z0_1_7Terms a).Encloses (Foundation.entropyTerm (Z0_1_7Value a)) := by + rcases a with ⟨i,j⟩ + revert j i + apply forall_fin6 + · exact forall_fin6 (entropyTerm_zero_ball (Z0_1_7Probs_sound ((0,0) : PairSlot))) (entropyTerm_zero_ball (Z0_1_7Probs_sound ((0,1) : PairSlot))) (entropyTerm_zero_ball (Z0_1_7Probs_sound ((0,2) : PairSlot))) (entropyTerm_zero_ball (Z0_1_7Probs_sound ((0,3) : PairSlot))) (entropyTerm_zero_ball (Z0_1_7Probs_sound ((0,4) : PairSlot))) (entropyTerm_zero_ball (Z0_1_7Probs_sound ((0,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball (Z0_1_7Probs_sound ((1,0) : PairSlot))) (entropyTerm_zero_ball (Z0_1_7Probs_sound ((1,1) : PairSlot))) (entropyTerm_zero_ball (Z0_1_7Probs_sound ((1,2) : PairSlot))) (entropyTerm_zero_ball (Z0_1_7Probs_sound ((1,3) : PairSlot))) (entropyTerm_zero_ball (Z0_1_7Probs_sound ((1,4) : PairSlot))) (entropyTerm_zero_ball (Z0_1_7Probs_sound ((1,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball (Z0_1_7Probs_sound ((2,0) : PairSlot))) (entropyTerm_zero_ball (Z0_1_7Probs_sound ((2,1) : PairSlot))) (entropyTerm_zero_ball (Z0_1_7Probs_sound ((2,2) : PairSlot))) (entropyTerm_zero_ball (Z0_1_7Probs_sound ((2,3) : PairSlot))) (entropyTerm_zero_ball (Z0_1_7Probs_sound ((2,4) : PairSlot))) (entropyTerm_zero_ball (Z0_1_7Probs_sound ((2,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball (Z0_1_7Probs_sound ((3,0) : PairSlot))) (entropyTerm_zero_ball (Z0_1_7Probs_sound ((3,1) : PairSlot))) (entropyTerm_zero_ball (Z0_1_7Probs_sound ((3,2) : PairSlot))) (entropyTerm_zero_ball (Z0_1_7Probs_sound ((3,3) : PairSlot))) (entropyTerm_zero_ball (Z0_1_7Probs_sound ((3,4) : PairSlot))) (entropyTerm_zero_ball (Z0_1_7Probs_sound ((3,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball (Z0_1_7Probs_sound ((4,0) : PairSlot))) (entropyTerm_zero_ball (Z0_1_7Probs_sound ((4,1) : PairSlot))) (entropyTerm_zero_ball (Z0_1_7Probs_sound ((4,2) : PairSlot))) (entropyTerm_zero_ball (Z0_1_7Probs_sound ((4,3) : PairSlot))) (entropyTerm_zero_ball (Z0_1_7Probs_sound ((4,4) : PairSlot))) Z0_1_7E_4_5_sound + · exact forall_fin6 (entropyTerm_zero_ball (Z0_1_7Probs_sound ((5,0) : PairSlot))) (entropyTerm_zero_ball (Z0_1_7Probs_sound ((5,1) : PairSlot))) (entropyTerm_zero_ball (Z0_1_7Probs_sound ((5,2) : PairSlot))) (entropyTerm_zero_ball (Z0_1_7Probs_sound ((5,3) : PairSlot))) Z0_1_7E_5_4_sound (entropyTerm_zero_ball (Z0_1_7Probs_sound ((5,5) : PairSlot))) +def Z0_1_7Entropy : Ball := ⟨(6931471805599453094172319305033 / 10000000000000000000000000000000), (21175823683 / 50000000000000000000000000000000)⟩ +lemma Z0_1_7Entropy_sound : Z0_1_7Entropy.Encloses (Foundation.finiteEntropy Z0_1_7Value) := by + exact contains_sound (entropyPair_enclosed Z0_1_7Value Z0_1_7Terms Z0_1_7Terms_sound) (by decide +kernel) +def Z0_1_7Labels : Ball := ⟨(115129254649702284200899544090987 / 50000000000000000000000000000000), (21175823683 / 25000000000000000000000000000000)⟩ +lemma Z0_1_7Labels_sound : Z0_1_7Labels.Encloses + (∑ a : PairSlot, (zeroPairLaw (shape 0 1 7) a.1 a.2 : ℝ) * + Real.log (AllFieldParameters.multiplicity a.1 * AllFieldParameters.multiplicity a.2 : ℕ)) := by + exact contains_sound (pairSumBall_sound (fun a => .mul (Z0_1_7Probs a) (multLogs a)) + _ (fun a => Ball.mul_sound (Z0_1_7Probs_sound a) (multLogs_sound a))) (by decide +kernel) +def Z0_1_7Four : Ball := ⟨(18723326709712443708970142577019 / 6250000000000000000000000000000), (63527471049 / 50000000000000000000000000000000)⟩ +lemma Z0_1_7Four_sound : Z0_1_7Four.Encloses (AllFieldZeroLeafRates.fourRate (shape 0 1 7)) := by + exact contains_sound (Ball.add_sound Z0_1_7Entropy_sound Z0_1_7Labels_sound) (by decide +kernel) +def Z0_1_7H0Value (a : PairSlot) : ℝ := (halfLaw (shape 0 1 7) 0 a : ℝ) +def Z0_1_7H0E_0_0Log : Ball := .exact 0 +lemma Z0_1_7H0E_0_0Log_sound : Z0_1_7H0E_0_0Log.Encloses (Real.log (Z0_1_7H0Value ((0,0) : PairSlot))) := by + exact log_exact_one_ball ((Z0_1_7Half_sound 0) ((0,0) : PairSlot)) +def Z0_1_7H0E_0_0 : Ball := ⟨0, 0⟩ +lemma Z0_1_7H0E_0_0_sound : Z0_1_7H0E_0_0.Encloses (Foundation.entropyTerm (Z0_1_7H0Value ((0,0) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z0_1_7Half_sound 0) ((0,0) : PairSlot)) Z0_1_7H0E_0_0Log_sound) (by decide +kernel) +def Z0_1_7H0Terms (a : PairSlot) : Ball := + match a.1.val, a.2.val with + | 0, 0 => ⟨0, 0⟩ + | _, _ => (.exact 0) +lemma Z0_1_7H0Terms_sound (a : PairSlot) : + (Z0_1_7H0Terms a).Encloses (Foundation.entropyTerm (Z0_1_7H0Value a)) := by + rcases a with ⟨i,j⟩ + revert j i + apply forall_fin6 + · exact forall_fin6 Z0_1_7H0E_0_0_sound (entropyTerm_zero_ball ((Z0_1_7Half_sound 0) ((0,1) : PairSlot))) (entropyTerm_zero_ball ((Z0_1_7Half_sound 0) ((0,2) : PairSlot))) (entropyTerm_zero_ball ((Z0_1_7Half_sound 0) ((0,3) : PairSlot))) (entropyTerm_zero_ball ((Z0_1_7Half_sound 0) ((0,4) : PairSlot))) (entropyTerm_zero_ball ((Z0_1_7Half_sound 0) ((0,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z0_1_7Half_sound 0) ((1,0) : PairSlot))) (entropyTerm_zero_ball ((Z0_1_7Half_sound 0) ((1,1) : PairSlot))) (entropyTerm_zero_ball ((Z0_1_7Half_sound 0) ((1,2) : PairSlot))) (entropyTerm_zero_ball ((Z0_1_7Half_sound 0) ((1,3) : PairSlot))) (entropyTerm_zero_ball ((Z0_1_7Half_sound 0) ((1,4) : PairSlot))) (entropyTerm_zero_ball ((Z0_1_7Half_sound 0) ((1,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z0_1_7Half_sound 0) ((2,0) : PairSlot))) (entropyTerm_zero_ball ((Z0_1_7Half_sound 0) ((2,1) : PairSlot))) (entropyTerm_zero_ball ((Z0_1_7Half_sound 0) ((2,2) : PairSlot))) (entropyTerm_zero_ball ((Z0_1_7Half_sound 0) ((2,3) : PairSlot))) (entropyTerm_zero_ball ((Z0_1_7Half_sound 0) ((2,4) : PairSlot))) (entropyTerm_zero_ball ((Z0_1_7Half_sound 0) ((2,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z0_1_7Half_sound 0) ((3,0) : PairSlot))) (entropyTerm_zero_ball ((Z0_1_7Half_sound 0) ((3,1) : PairSlot))) (entropyTerm_zero_ball ((Z0_1_7Half_sound 0) ((3,2) : PairSlot))) (entropyTerm_zero_ball ((Z0_1_7Half_sound 0) ((3,3) : PairSlot))) (entropyTerm_zero_ball ((Z0_1_7Half_sound 0) ((3,4) : PairSlot))) (entropyTerm_zero_ball ((Z0_1_7Half_sound 0) ((3,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z0_1_7Half_sound 0) ((4,0) : PairSlot))) (entropyTerm_zero_ball ((Z0_1_7Half_sound 0) ((4,1) : PairSlot))) (entropyTerm_zero_ball ((Z0_1_7Half_sound 0) ((4,2) : PairSlot))) (entropyTerm_zero_ball ((Z0_1_7Half_sound 0) ((4,3) : PairSlot))) (entropyTerm_zero_ball ((Z0_1_7Half_sound 0) ((4,4) : PairSlot))) (entropyTerm_zero_ball ((Z0_1_7Half_sound 0) ((4,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z0_1_7Half_sound 0) ((5,0) : PairSlot))) (entropyTerm_zero_ball ((Z0_1_7Half_sound 0) ((5,1) : PairSlot))) (entropyTerm_zero_ball ((Z0_1_7Half_sound 0) ((5,2) : PairSlot))) (entropyTerm_zero_ball ((Z0_1_7Half_sound 0) ((5,3) : PairSlot))) (entropyTerm_zero_ball ((Z0_1_7Half_sound 0) ((5,4) : PairSlot))) (entropyTerm_zero_ball ((Z0_1_7Half_sound 0) ((5,5) : PairSlot))) +def Z0_1_7H0Entropy : Ball := ⟨0, 0⟩ +lemma Z0_1_7H0Entropy_sound : Z0_1_7H0Entropy.Encloses (Foundation.finiteEntropy Z0_1_7H0Value) := by + exact contains_sound (entropyPair_enclosed Z0_1_7H0Value Z0_1_7H0Terms Z0_1_7H0Terms_sound) (by decide +kernel) +def Z0_1_7H0Mass : Ball := ⟨1, 0⟩ +lemma Z0_1_7H0Mass_sound : Z0_1_7H0Mass.Encloses (∑ a, Z0_1_7H0Value a) := by + exact contains_sound (pairSumBall_sound (Z0_1_7Half 0) Z0_1_7H0Value (Z0_1_7Half_sound 0)) (by decide +kernel) +def Z0_1_7H0MassTermLog : Ball := .exact 0 +lemma Z0_1_7H0MassTermLog_sound : Z0_1_7H0MassTermLog.Encloses (Real.log ((∑ a, Z0_1_7H0Value a))) := by + exact log_exact_one_ball (Z0_1_7H0Mass_sound) +def Z0_1_7H0MassTerm : Ball := ⟨0, 0⟩ +lemma Z0_1_7H0MassTerm_sound : Z0_1_7H0MassTerm.Encloses (Foundation.entropyTerm ((∑ a, Z0_1_7H0Value a))) := by + exact contains_sound (entropyTerm_ball (Z0_1_7H0Mass_sound) Z0_1_7H0MassTermLog_sound) (by decide +kernel) +def Z0_1_7H0H : Ball := ⟨0, 0⟩ +lemma Z0_1_7H0H_sound : Z0_1_7H0H.Encloses (homogeneousEntropy Z0_1_7H0Value) := by + exact contains_sound (homogeneous_enclosed Z0_1_7H0Value Z0_1_7H0MassTerm_sound Z0_1_7H0Entropy_sound) (by decide +kernel) +def Z0_1_7H1Value (a : PairSlot) : ℝ := (halfLaw (shape 0 1 7) 1 a : ℝ) +def Z0_1_7H1E_1_0LogWitness : LogWitness := ⟨-1, 1, 1⟩ +def Z0_1_7H1E_1_0Log : Ball := ⟨(-6931471805599453094172319305033 / 10000000000000000000000000000000), (8470329473 / 20000000000000000000000000000000)⟩ +lemma Z0_1_7H1E_1_0Log_sound : Z0_1_7H1E_1_0Log.Encloses (Real.log (Z0_1_7H1Value ((1,0) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound ((Z0_1_7Half_sound 1) ((1,0) : PairSlot)) (w := Z0_1_7H1E_1_0LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z0_1_7H1E_1_0 : Ball := ⟨(6931471805599453094172319305033 / 20000000000000000000000000000000), (21175823683 / 100000000000000000000000000000000)⟩ +lemma Z0_1_7H1E_1_0_sound : Z0_1_7H1E_1_0.Encloses (Foundation.entropyTerm (Z0_1_7H1Value ((1,0) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z0_1_7Half_sound 1) ((1,0) : PairSlot)) Z0_1_7H1E_1_0Log_sound) (by decide +kernel) +def Z0_1_7H1E_0_1LogWitness : LogWitness := ⟨-1, 1, 1⟩ +def Z0_1_7H1E_0_1Log : Ball := ⟨(-6931471805599453094172319305033 / 10000000000000000000000000000000), (8470329473 / 20000000000000000000000000000000)⟩ +lemma Z0_1_7H1E_0_1Log_sound : Z0_1_7H1E_0_1Log.Encloses (Real.log (Z0_1_7H1Value ((0,1) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound ((Z0_1_7Half_sound 1) ((0,1) : PairSlot)) (w := Z0_1_7H1E_0_1LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z0_1_7H1E_0_1 : Ball := ⟨(6931471805599453094172319305033 / 20000000000000000000000000000000), (21175823683 / 100000000000000000000000000000000)⟩ +lemma Z0_1_7H1E_0_1_sound : Z0_1_7H1E_0_1.Encloses (Foundation.entropyTerm (Z0_1_7H1Value ((0,1) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z0_1_7Half_sound 1) ((0,1) : PairSlot)) Z0_1_7H1E_0_1Log_sound) (by decide +kernel) +def Z0_1_7H1Terms (a : PairSlot) : Ball := + match a.1.val, a.2.val with + | 1, 0 => ⟨(6931471805599453094172319305033 / 20000000000000000000000000000000), (21175823683 / 100000000000000000000000000000000)⟩ + | 0, 1 => ⟨(6931471805599453094172319305033 / 20000000000000000000000000000000), (21175823683 / 100000000000000000000000000000000)⟩ + | _, _ => (.exact 0) +lemma Z0_1_7H1Terms_sound (a : PairSlot) : + (Z0_1_7H1Terms a).Encloses (Foundation.entropyTerm (Z0_1_7H1Value a)) := by + rcases a with ⟨i,j⟩ + revert j i + apply forall_fin6 + · exact forall_fin6 (entropyTerm_zero_ball ((Z0_1_7Half_sound 1) ((0,0) : PairSlot))) Z0_1_7H1E_0_1_sound (entropyTerm_zero_ball ((Z0_1_7Half_sound 1) ((0,2) : PairSlot))) (entropyTerm_zero_ball ((Z0_1_7Half_sound 1) ((0,3) : PairSlot))) (entropyTerm_zero_ball ((Z0_1_7Half_sound 1) ((0,4) : PairSlot))) (entropyTerm_zero_ball ((Z0_1_7Half_sound 1) ((0,5) : PairSlot))) + · exact forall_fin6 Z0_1_7H1E_1_0_sound (entropyTerm_zero_ball ((Z0_1_7Half_sound 1) ((1,1) : PairSlot))) (entropyTerm_zero_ball ((Z0_1_7Half_sound 1) ((1,2) : PairSlot))) (entropyTerm_zero_ball ((Z0_1_7Half_sound 1) ((1,3) : PairSlot))) (entropyTerm_zero_ball ((Z0_1_7Half_sound 1) ((1,4) : PairSlot))) (entropyTerm_zero_ball ((Z0_1_7Half_sound 1) ((1,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z0_1_7Half_sound 1) ((2,0) : PairSlot))) (entropyTerm_zero_ball ((Z0_1_7Half_sound 1) ((2,1) : PairSlot))) (entropyTerm_zero_ball ((Z0_1_7Half_sound 1) ((2,2) : PairSlot))) (entropyTerm_zero_ball ((Z0_1_7Half_sound 1) ((2,3) : PairSlot))) (entropyTerm_zero_ball ((Z0_1_7Half_sound 1) ((2,4) : PairSlot))) (entropyTerm_zero_ball ((Z0_1_7Half_sound 1) ((2,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z0_1_7Half_sound 1) ((3,0) : PairSlot))) (entropyTerm_zero_ball ((Z0_1_7Half_sound 1) ((3,1) : PairSlot))) (entropyTerm_zero_ball ((Z0_1_7Half_sound 1) ((3,2) : PairSlot))) (entropyTerm_zero_ball ((Z0_1_7Half_sound 1) ((3,3) : PairSlot))) (entropyTerm_zero_ball ((Z0_1_7Half_sound 1) ((3,4) : PairSlot))) (entropyTerm_zero_ball ((Z0_1_7Half_sound 1) ((3,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z0_1_7Half_sound 1) ((4,0) : PairSlot))) (entropyTerm_zero_ball ((Z0_1_7Half_sound 1) ((4,1) : PairSlot))) (entropyTerm_zero_ball ((Z0_1_7Half_sound 1) ((4,2) : PairSlot))) (entropyTerm_zero_ball ((Z0_1_7Half_sound 1) ((4,3) : PairSlot))) (entropyTerm_zero_ball ((Z0_1_7Half_sound 1) ((4,4) : PairSlot))) (entropyTerm_zero_ball ((Z0_1_7Half_sound 1) ((4,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z0_1_7Half_sound 1) ((5,0) : PairSlot))) (entropyTerm_zero_ball ((Z0_1_7Half_sound 1) ((5,1) : PairSlot))) (entropyTerm_zero_ball ((Z0_1_7Half_sound 1) ((5,2) : PairSlot))) (entropyTerm_zero_ball ((Z0_1_7Half_sound 1) ((5,3) : PairSlot))) (entropyTerm_zero_ball ((Z0_1_7Half_sound 1) ((5,4) : PairSlot))) (entropyTerm_zero_ball ((Z0_1_7Half_sound 1) ((5,5) : PairSlot))) +def Z0_1_7H1Entropy : Ball := ⟨(6931471805599453094172319305033 / 10000000000000000000000000000000), (21175823683 / 50000000000000000000000000000000)⟩ +lemma Z0_1_7H1Entropy_sound : Z0_1_7H1Entropy.Encloses (Foundation.finiteEntropy Z0_1_7H1Value) := by + exact contains_sound (entropyPair_enclosed Z0_1_7H1Value Z0_1_7H1Terms Z0_1_7H1Terms_sound) (by decide +kernel) +def Z0_1_7H1Mass : Ball := ⟨1, 0⟩ +lemma Z0_1_7H1Mass_sound : Z0_1_7H1Mass.Encloses (∑ a, Z0_1_7H1Value a) := by + exact contains_sound (pairSumBall_sound (Z0_1_7Half 1) Z0_1_7H1Value (Z0_1_7Half_sound 1)) (by decide +kernel) +def Z0_1_7H1MassTermLog : Ball := .exact 0 +lemma Z0_1_7H1MassTermLog_sound : Z0_1_7H1MassTermLog.Encloses (Real.log ((∑ a, Z0_1_7H1Value a))) := by + exact log_exact_one_ball (Z0_1_7H1Mass_sound) +def Z0_1_7H1MassTerm : Ball := ⟨0, 0⟩ +lemma Z0_1_7H1MassTerm_sound : Z0_1_7H1MassTerm.Encloses (Foundation.entropyTerm ((∑ a, Z0_1_7H1Value a))) := by + exact contains_sound (entropyTerm_ball (Z0_1_7H1Mass_sound) Z0_1_7H1MassTermLog_sound) (by decide +kernel) +def Z0_1_7H1H : Ball := ⟨(6931471805599453094172319305033 / 10000000000000000000000000000000), (21175823683 / 50000000000000000000000000000000)⟩ +lemma Z0_1_7H1H_sound : Z0_1_7H1H.Encloses (homogeneousEntropy Z0_1_7H1Value) := by + exact contains_sound (homogeneous_enclosed Z0_1_7H1Value Z0_1_7H1MassTerm_sound Z0_1_7H1Entropy_sound) (by decide +kernel) +def Z0_1_7H2Value (a : PairSlot) : ℝ := (halfLaw (shape 0 1 7) 2 a : ℝ) +def Z0_1_7H2E_4_5LogWitness : LogWitness := ⟨-1, 1, 1⟩ +def Z0_1_7H2E_4_5Log : Ball := ⟨(-6931471805599453094172319305033 / 10000000000000000000000000000000), (8470329473 / 20000000000000000000000000000000)⟩ +lemma Z0_1_7H2E_4_5Log_sound : Z0_1_7H2E_4_5Log.Encloses (Real.log (Z0_1_7H2Value ((4,5) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound ((Z0_1_7Half_sound 2) ((4,5) : PairSlot)) (w := Z0_1_7H2E_4_5LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z0_1_7H2E_4_5 : Ball := ⟨(6931471805599453094172319305033 / 20000000000000000000000000000000), (21175823683 / 100000000000000000000000000000000)⟩ +lemma Z0_1_7H2E_4_5_sound : Z0_1_7H2E_4_5.Encloses (Foundation.entropyTerm (Z0_1_7H2Value ((4,5) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z0_1_7Half_sound 2) ((4,5) : PairSlot)) Z0_1_7H2E_4_5Log_sound) (by decide +kernel) +def Z0_1_7H2E_5_4LogWitness : LogWitness := ⟨-1, 1, 1⟩ +def Z0_1_7H2E_5_4Log : Ball := ⟨(-6931471805599453094172319305033 / 10000000000000000000000000000000), (8470329473 / 20000000000000000000000000000000)⟩ +lemma Z0_1_7H2E_5_4Log_sound : Z0_1_7H2E_5_4Log.Encloses (Real.log (Z0_1_7H2Value ((5,4) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound ((Z0_1_7Half_sound 2) ((5,4) : PairSlot)) (w := Z0_1_7H2E_5_4LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z0_1_7H2E_5_4 : Ball := ⟨(6931471805599453094172319305033 / 20000000000000000000000000000000), (21175823683 / 100000000000000000000000000000000)⟩ +lemma Z0_1_7H2E_5_4_sound : Z0_1_7H2E_5_4.Encloses (Foundation.entropyTerm (Z0_1_7H2Value ((5,4) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z0_1_7Half_sound 2) ((5,4) : PairSlot)) Z0_1_7H2E_5_4Log_sound) (by decide +kernel) +def Z0_1_7H2Terms (a : PairSlot) : Ball := + match a.1.val, a.2.val with + | 4, 5 => ⟨(6931471805599453094172319305033 / 20000000000000000000000000000000), (21175823683 / 100000000000000000000000000000000)⟩ + | 5, 4 => ⟨(6931471805599453094172319305033 / 20000000000000000000000000000000), (21175823683 / 100000000000000000000000000000000)⟩ + | _, _ => (.exact 0) +lemma Z0_1_7H2Terms_sound (a : PairSlot) : + (Z0_1_7H2Terms a).Encloses (Foundation.entropyTerm (Z0_1_7H2Value a)) := by + rcases a with ⟨i,j⟩ + revert j i + apply forall_fin6 + · exact forall_fin6 (entropyTerm_zero_ball ((Z0_1_7Half_sound 2) ((0,0) : PairSlot))) (entropyTerm_zero_ball ((Z0_1_7Half_sound 2) ((0,1) : PairSlot))) (entropyTerm_zero_ball ((Z0_1_7Half_sound 2) ((0,2) : PairSlot))) (entropyTerm_zero_ball ((Z0_1_7Half_sound 2) ((0,3) : PairSlot))) (entropyTerm_zero_ball ((Z0_1_7Half_sound 2) ((0,4) : PairSlot))) (entropyTerm_zero_ball ((Z0_1_7Half_sound 2) ((0,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z0_1_7Half_sound 2) ((1,0) : PairSlot))) (entropyTerm_zero_ball ((Z0_1_7Half_sound 2) ((1,1) : PairSlot))) (entropyTerm_zero_ball ((Z0_1_7Half_sound 2) ((1,2) : PairSlot))) (entropyTerm_zero_ball ((Z0_1_7Half_sound 2) ((1,3) : PairSlot))) (entropyTerm_zero_ball ((Z0_1_7Half_sound 2) ((1,4) : PairSlot))) (entropyTerm_zero_ball ((Z0_1_7Half_sound 2) ((1,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z0_1_7Half_sound 2) ((2,0) : PairSlot))) (entropyTerm_zero_ball ((Z0_1_7Half_sound 2) ((2,1) : PairSlot))) (entropyTerm_zero_ball ((Z0_1_7Half_sound 2) ((2,2) : PairSlot))) (entropyTerm_zero_ball ((Z0_1_7Half_sound 2) ((2,3) : PairSlot))) (entropyTerm_zero_ball ((Z0_1_7Half_sound 2) ((2,4) : PairSlot))) (entropyTerm_zero_ball ((Z0_1_7Half_sound 2) ((2,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z0_1_7Half_sound 2) ((3,0) : PairSlot))) (entropyTerm_zero_ball ((Z0_1_7Half_sound 2) ((3,1) : PairSlot))) (entropyTerm_zero_ball ((Z0_1_7Half_sound 2) ((3,2) : PairSlot))) (entropyTerm_zero_ball ((Z0_1_7Half_sound 2) ((3,3) : PairSlot))) (entropyTerm_zero_ball ((Z0_1_7Half_sound 2) ((3,4) : PairSlot))) (entropyTerm_zero_ball ((Z0_1_7Half_sound 2) ((3,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z0_1_7Half_sound 2) ((4,0) : PairSlot))) (entropyTerm_zero_ball ((Z0_1_7Half_sound 2) ((4,1) : PairSlot))) (entropyTerm_zero_ball ((Z0_1_7Half_sound 2) ((4,2) : PairSlot))) (entropyTerm_zero_ball ((Z0_1_7Half_sound 2) ((4,3) : PairSlot))) (entropyTerm_zero_ball ((Z0_1_7Half_sound 2) ((4,4) : PairSlot))) Z0_1_7H2E_4_5_sound + · exact forall_fin6 (entropyTerm_zero_ball ((Z0_1_7Half_sound 2) ((5,0) : PairSlot))) (entropyTerm_zero_ball ((Z0_1_7Half_sound 2) ((5,1) : PairSlot))) (entropyTerm_zero_ball ((Z0_1_7Half_sound 2) ((5,2) : PairSlot))) (entropyTerm_zero_ball ((Z0_1_7Half_sound 2) ((5,3) : PairSlot))) Z0_1_7H2E_5_4_sound (entropyTerm_zero_ball ((Z0_1_7Half_sound 2) ((5,5) : PairSlot))) +def Z0_1_7H2Entropy : Ball := ⟨(6931471805599453094172319305033 / 10000000000000000000000000000000), (21175823683 / 50000000000000000000000000000000)⟩ +lemma Z0_1_7H2Entropy_sound : Z0_1_7H2Entropy.Encloses (Foundation.finiteEntropy Z0_1_7H2Value) := by + exact contains_sound (entropyPair_enclosed Z0_1_7H2Value Z0_1_7H2Terms Z0_1_7H2Terms_sound) (by decide +kernel) +def Z0_1_7H2Mass : Ball := ⟨1, 0⟩ +lemma Z0_1_7H2Mass_sound : Z0_1_7H2Mass.Encloses (∑ a, Z0_1_7H2Value a) := by + exact contains_sound (pairSumBall_sound (Z0_1_7Half 2) Z0_1_7H2Value (Z0_1_7Half_sound 2)) (by decide +kernel) +def Z0_1_7H2MassTermLog : Ball := .exact 0 +lemma Z0_1_7H2MassTermLog_sound : Z0_1_7H2MassTermLog.Encloses (Real.log ((∑ a, Z0_1_7H2Value a))) := by + exact log_exact_one_ball (Z0_1_7H2Mass_sound) +def Z0_1_7H2MassTerm : Ball := ⟨0, 0⟩ +lemma Z0_1_7H2MassTerm_sound : Z0_1_7H2MassTerm.Encloses (Foundation.entropyTerm ((∑ a, Z0_1_7H2Value a))) := by + exact contains_sound (entropyTerm_ball (Z0_1_7H2Mass_sound) Z0_1_7H2MassTermLog_sound) (by decide +kernel) +def Z0_1_7H2H : Ball := ⟨(6931471805599453094172319305033 / 10000000000000000000000000000000), (21175823683 / 50000000000000000000000000000000)⟩ +lemma Z0_1_7H2H_sound : Z0_1_7H2H.Encloses (homogeneousEntropy Z0_1_7H2Value) := by + exact contains_sound (homogeneous_enclosed Z0_1_7H2Value Z0_1_7H2MassTerm_sound Z0_1_7H2Entropy_sound) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/Certificates/Four0_3_5.lean b/lean/OAI/LinearAlgebra/MatrixFields/Certificates/Four0_3_5.lean new file mode 100644 index 0000000000000000000000000000000000000000..6f5b6be13350faa0ebd667c457b79724976fbf7e --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/Certificates/Four0_3_5.lean @@ -0,0 +1,1258 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Certificates.SplitB5_1_2 + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate +open scoped BigOperators +def w200Trace : List Ball := [ + ⟨(101822820454478576364624693210983 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(50454333140138780095138986896843 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(50302432261710796797673490870941 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(8371103169920852457012116486571 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4181765490184627481086621930999 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(104481089995403957581214526993 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(34812028439039215519527827849 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(9943080834335387989894922787 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2485145708554468849328645333 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(276071808085179654271380119 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(27602641726950831010849701 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(156811704748517803969837 / 6250000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(209058036203815504523453 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4019947411255285616841 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(574228753900953010197 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(76557974095447743761 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w200S0 : Ball := ⟨(103678867653049807566136453831703 / 100000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +def w200S1 : Ball := ⟨(53746537989093088562620806817527 / 50000000000000000000000000000000), (7 / 100000000000000000000000000000000)⟩ +def w200S2 : Ball := ⟨(115547613832521061602219594540823 / 100000000000000000000000000000000), (1 / 6250000000000000000000000000000)⟩ +def w200S3 : Ball := ⟨(66756255311947062869080886566633 / 50000000000000000000000000000000), (19 / 50000000000000000000000000000000)⟩ +def w200S4 : Ball := ⟨(17825590493095441792359042364731 / 10000000000000000000000000000000), (51 / 50000000000000000000000000000000)⟩ +def w200S5 : Ball := ⟨(63550335285506919132405912074879 / 20000000000000000000000000000000), (91 / 25000000000000000000000000000000)⟩ +abbrev w200 : Ball := w200S5 +lemma w200_sound : w200.Encloses (weight (11561) : ℝ) := by + exact weight_enclosed_of_trace (11561) w200Trace w200S0 w200S1 w200S2 w200S3 w200S4 w200S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def w201Trace : List Ball := [ + ⟨(102914636574548265730553134114759 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(101450340333436127022026748977301 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(25241143563363280962014448944159 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(3357412966824382785429865106037 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1047680795825287522555360752867 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(837340003593266496712724243919 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(69730488017545672562413193419 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(3982550427688823527492235683 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1244049333538284529198387107 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(276366978159400434363077709 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(13814732922896008484333783 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1255610973946833151426491 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(20922988979585752012691 / 10000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(16092062163103247635707 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(574637755486081014877 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1197014847005796687 / 1562500000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w201S0 : Ball := ⟨(21182844842542695188576018812291 / 20000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +def w201S1 : Ball := ⟨(112178228905809415229126498228343 / 100000000000000000000000000000000), (7 / 100000000000000000000000000000000)⟩ +def w201S2 : Ball := ⟨(62919775202220875163649729179667 / 50000000000000000000000000000000), (1 / 6250000000000000000000000000000)⟩ +def w201S3 : Ball := ⟨(158355924459920358883725625181743 / 100000000000000000000000000000000), (41 / 100000000000000000000000000000000)⟩ +def w201S4 : Ball := ⟨(250765988115560030064146963920001 / 100000000000000000000000000000000), (131 / 100000000000000000000000000000000)⟩ +def w201S5 : Ball := ⟨(314417903977865971190225770588127 / 50000000000000000000000000000000), (329 / 50000000000000000000000000000000)⟩ +abbrev w201 : Ball := w201S5 +lemma w201_sound : w201.Encloses (weight (18387) : ℝ) := by + exact weight_enclosed_of_trace (18387) w201Trace w201S0 w201S1 w201S2 w201S3 w201S4 w201S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def w202Trace : List Ball := [ + ⟨(51713390685185762319526489215421 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(50851884553834533690268646719977 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(25283162421355108596361245630931 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(16808008687374281364421925783323 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(83898064601069751960087028993 / 2000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(104754455154223451447541394857 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(174450302372631357707209257 / 125000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1992514959647404271945143271 / 10000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(622368801366733070748750647 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(276504553758549412423486779 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(27641966794746975267329611 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1256131638079534257425953 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(104654982228108140926653 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4024445019738765061811 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(574828300997153000947 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(38316337916283146111 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w202S0 : Ball := ⟨(21394198209269260544267878317171 / 20000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +def w202S1 : Ball := ⟨(1144279292543750086472332290649 / 1000000000000000000000000000000), (7 / 100000000000000000000000000000000)⟩ +def w202S2 : Ball := ⟨(65468754967221259612133124940191 / 50000000000000000000000000000000), (17 / 100000000000000000000000000000000)⟩ +def w202S3 : Ball := ⟨(171446315078322334150028919584107 / 100000000000000000000000000000000), (9 / 20000000000000000000000000000000)⟩ +def w202S4 : Ball := ⟨(293938389539353761505766188389617 / 100000000000000000000000000000000), (31 / 20000000000000000000000000000000)⟩ +def w202S5 : Ball := ⟨(10799972105623609100886591912781 / 1250000000000000000000000000000), (57 / 6250000000000000000000000000000)⟩ +abbrev w202 : Ball := w202S5 +lemma w202_sound : w202.Encloses (weight (21564) : ℝ) := by + exact weight_enclosed_of_trace (21564) w202Trace w202S0 w202S1 w202S2 w202S3 w202S4 w202S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def w203Trace : List Ball := [ + ⟨(103476244123961483680514706322297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(101728223106325997052099316244637 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(10114886036110087913521375368703 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(3362005629193244840131698032459 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(262206637950722513016595328081 / 6250000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(838102695415265963569707036261 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(69784904719636107711000682983 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(19926344409937310525468007741 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(99584314489584496755577971 / 4000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1080147700146577521638151 / 390625000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(27643171399431228570087641 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2512363616141576004545311 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(104658840016887089749977 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(50307284416386804559 / 312500000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1149693320081583450947 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(76634961020165839941 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w203S0 : Ball := ⟨(13384166372502091849025456287829 / 12500000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +def w203S1 : Ball := ⟨(114646982071562114602890062248891 / 100000000000000000000000000000000), (7 / 100000000000000000000000000000000)⟩ +def w203S2 : Ball := ⟨(131439304981170849346400844756921 / 100000000000000000000000000000000), (17 / 100000000000000000000000000000000)⟩ +def w203S3 : Ball := ⟨(172762908939332440490557994868611 / 100000000000000000000000000000000), (9 / 20000000000000000000000000000000)⟩ +def w203S4 : Ball := ⟨(298470227051800728781169252302483 / 100000000000000000000000000000000), (39 / 25000000000000000000000000000000)⟩ +def w203S5 : Ball := ⟨(17816895287270695911769071124509 / 2000000000000000000000000000000), (233 / 25000000000000000000000000000000)⟩ +abbrev w203 : Ball := w203S5 +lemma w203_sound : w203.Encloses (weight (21870) : ℝ) := by + exact weight_enclosed_of_trace (21870) w203Trace w203S0 w203S1 w203S2 w203S3 w203S4 w203S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def w204Trace : List Ball := [ + ⟨(103525730532585083765635802348327 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(50876342461545220283344911231277 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(12645634365731894420561489628819 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(16812047992137884047502410253269 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4195709248808582419501979411331 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(419084879392723706137269042773 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(139579378127390445633614782483 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(3985507870138855669413527241 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2489740531729785778538711783 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(55306213974347011881980101 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(3455547012540234070444851 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(39257249430006272998507 / 1562500000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(20932539613938223374423 / 10000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(643955279308795327133 / 4000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(287432510088517885517 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(3831862310388269383 / 5000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w204S0 : Ball := ⟨(53587884411527097257720310770709 / 50000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +def w204S1 : Ball := ⟨(14358306778515944353807100067073 / 12500000000000000000000000000000), (7 / 100000000000000000000000000000000)⟩ +def w204S2 : Ball := ⟨(26388604613885045236344938057137 / 20000000000000000000000000000000), (17 / 100000000000000000000000000000000)⟩ +def w204S3 : Ball := ⟨(174089613366988774345708680104477 / 100000000000000000000000000000000), (23 / 50000000000000000000000000000000)⟩ +def w204S4 : Ball := ⟨(303071934822676365370582651560239 / 100000000000000000000000000000000), (161 / 100000000000000000000000000000000)⟩ +def w204S5 : Ball := ⟨(918525976771605908947026239697719 / 100000000000000000000000000000000), (61 / 6250000000000000000000000000000)⟩ +abbrev w204 : Ball := w204S5 +lemma w204_sound : w204.Encloses (weight (22176) : ℝ) := by + exact weight_enclosed_of_trace (22176) w204Trace w204S0 w204S1 w204S2 w204S3 w204S4 w204S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def w205Trace : List Ball := [ + ⟨(5177200545407457936725894863887 / 5000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(101761720185538229175443234678713 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(10117106364076151216148505490391 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2101599247631588965830777341127 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4195858100725417846781520925281 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(838194526340381141976164274447 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(34895727988139861943243329813 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4981995162963319191238227741 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1244894763636742717740821001 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(138267983163070956995587373 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(5528964199570413908071197 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2512501021775516541394697 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(52332061421111141025519 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(16099085454201065924189 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1149743601007171603473 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(76638090084231887307 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w205S0 : Ball := ⟨(13401702743683639964664889390029 / 12500000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +def w205S1 : Ball := ⟨(114947607315236866066441667858927 / 100000000000000000000000000000000), (7 / 100000000000000000000000000000000)⟩ +def w205S2 : Ball := ⟨(66064762137489479422041135891683 / 50000000000000000000000000000000), (17 / 100000000000000000000000000000000)⟩ +def w205S3 : Ball := ⟨(174582111851322539597817893821251 / 100000000000000000000000000000000), (23 / 50000000000000000000000000000000)⟩ +def w205S4 : Ball := ⟨(304789137784676939344863442210539 / 100000000000000000000000000000000), (161 / 100000000000000000000000000000000)⟩ +def w205S5 : Ball := ⟨(116120523139408479936453058760027 / 12500000000000000000000000000000), (491 / 50000000000000000000000000000000)⟩ +abbrev w205 : Ball := w205S5 +lemma w205_sound : w205.Encloses (weight (22289) : ℝ) := by + exact weight_enclosed_of_trace (22289) w205Trace w205S0 w205S1 w205S2 w205S3 w205S4 w205S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def w206Trace : List Ball := [ + ⟨(103545628795959314165950669719991 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(20352503963531647752889623936447 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(50585796820542302760069805669789 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(8406430000158611741438531518567 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4195871273884764445699523615369 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(8381967182197667420524887739 / 1000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(139583224687985182306806671269 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(3985603941177880510044223719 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1244896931622925230797416981 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(138268199824139957697478547 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(5528972073989377787395821 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(157031518832231551947237 / 6250000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2616606223250532723649 / 1250000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(8049551730378985243373 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(35929525033728765733 / 3125000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(3831908238178260293 / 5000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w206S0 : Ball := ⟨(107216972427505987290765464338847 / 100000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +def w206S1 : Ball := ⟨(7184674485325361950708801541639 / 6250000000000000000000000000000), (7 / 100000000000000000000000000000000)⟩ +def w206S2 : Ball := ⟨(13214604149781825186918545561921 / 10000000000000000000000000000000), (17 / 100000000000000000000000000000000)⟩ +def w206S3 : Ball := ⟨(87312881417715517459652138019057 / 50000000000000000000000000000000), (23 / 50000000000000000000000000000000)⟩ +def w206S4 : Ball := ⟨(152470785229281034202046247661839 / 50000000000000000000000000000000), (161 / 100000000000000000000000000000000)⟩ +def w206S5 : Ball := ⟨(929893613937341743734618904774797 / 100000000000000000000000000000000), (983 / 100000000000000000000000000000000)⟩ +abbrev w206 : Ball := w206S5 +lemma w206_sound : w206.Encloses (weight (22299) : ℝ) := by + exact weight_enclosed_of_trace (22299) w206Trace w206S0 w206S1 w206S2 w206S3 w206S4 w206S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def w207Trace : List Ball := [ + ⟨(25895388104022644530724097899391 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(25445068450534723132339712073629 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(50591680359171050077246254983811 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(16814325734624219592274019343683 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1049040933937590164609761037369 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(838245380469968240056906398379 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(139590167729956054486335492629 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(9964443370254117986897260201 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1244945062665348131301459951 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(276546019717521712116120507 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1105829378276622846144099 / 4000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(314072138642797392816147 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(6541690509486492628183 / 3125000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(8049751607999990192331 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(574885721641004008983 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(38319911322382438867 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w207S0 : Ball := ⟨(10729138000927319882225079156397 / 10000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +def w207S1 : Ball := ⟨(14389300280367835746741645602973 / 12500000000000000000000000000000), (7 / 100000000000000000000000000000000)⟩ +def w207S2 : Ball := ⟨(66256628018750040456736781907719 / 50000000000000000000000000000000), (17 / 100000000000000000000000000000000)⟩ +def w207S3 : Ball := ⟨(4389940756415012911405482122683 / 2500000000000000000000000000000), (23 / 50000000000000000000000000000000)⟩ +def w207S4 : Ball := ⟨(77086319379334462897050088564097 / 25000000000000000000000000000000), (81 / 50000000000000000000000000000000)⟩ +def w207S5 : Ball := ⟨(95076810167244095568735509015263 / 10000000000000000000000000000000), (1 / 100000000000000000000000000000)⟩ +abbrev w207 : Ball := w207S5 +lemma w207_sound : w207.Encloses (weight (22521) : ℝ) := by + exact weight_enclosed_of_trace (22521) w207Trace w207S0 w207S1 w207S2 w207S3 w207S4 w207S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def w208Trace : List Ball := [ + ⟨(51800406950826843680044904406619 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(101789792272895755762256079526159 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(50594834569491328968369739255389 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(16815111505055235854974961283079 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4196320519818210270199141099999 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(419135733590722311413066195503 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(17449236212407383366781122517 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4982337882474756504311598923 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(31124271600418638659055071 / 1250000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(276551176671687180049383751 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(27646203019880523641287881 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2512616138364183427012361 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4186741947709709968707 / 2000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(8049858753420616865717 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(574892862468114940523 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(38320355664415684257 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w208S0 : Ball := ⟨(53665643205425399614428139110893 / 50000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +def w208S1 : Ball := ⟨(115200050426080854395202845284261 / 100000000000000000000000000000000), (7 / 100000000000000000000000000000000)⟩ +def w208S2 : Ball := ⟨(132710516181715716422850695559243 / 100000000000000000000000000000000), (17 / 100000000000000000000000000000000)⟩ +def w208S3 : Ball := ⟨(8806040552608714508296490796161 / 5000000000000000000000000000000), (23 / 50000000000000000000000000000000)⟩ +def w208S4 : Ball := ⟨(310185400856756775974679240532751 / 100000000000000000000000000000000), (163 / 100000000000000000000000000000000)⟩ +def w208S5 : Ball := ⟨(962149829046668872508647133712219 / 100000000000000000000000000000000), (253 / 25000000000000000000000000000000)⟩ +abbrev w208 : Ball := w208S5 +lemma w208_sound : w208.Encloses (weight (22640) : ℝ) := by + exact weight_enclosed_of_trace (22640) w208Trace w208S0 w208S1 w208S2 w208S3 w208S4 w208S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def w209Trace : List Ball := [ + ⟨(12959554713508152279185215440391 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(50913578854064562025107176500673 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1581475490655752845643617086897 / 3125000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(525568616422807859605960774401 / 3125000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4196935892692184102800449779973 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(838373854517296019631332172769 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(139608497759818203605801585627 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(19931175721416082521492444377 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(311268031838806428012894919 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(276571416155347290376093749 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(3456005246854663437124877 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1256384657136512321865361 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(209348875512432180046181 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(8050279257384380547259 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(287460443655318268061 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(38322099426848672467 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w209S0 : Ball := ⟨(107488037358343274815059916710221 / 100000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +def w209S1 : Ball := ⟨(115536781751485994924545595743119 / 100000000000000000000000000000000), (7 / 100000000000000000000000000000000)⟩ +def w209S2 : Ball := ⟨(133487479374905072050598726075087 / 100000000000000000000000000000000), (17 / 100000000000000000000000000000000)⟩ +def w209S3 : Ball := ⟨(35637814299731414010498763636029 / 20000000000000000000000000000000), (23 / 50000000000000000000000000000000)⟩ +def w209S4 : Ball := ⟨(79378363003883803422826157257159 / 25000000000000000000000000000000), (33 / 20000000000000000000000000000000)⟩ +def w209S5 : Ball := ⟨(1008147922108215826536089331573577 / 100000000000000000000000000000000), (1049 / 100000000000000000000000000000000)⟩ +abbrev w209 : Ball := w209S5 +lemma w209_sound : w209.Encloses (weight (23107) : ℝ) := by + exact weight_enclosed_of_trace (23107) w209Trace w209S0 w209S1 w209S2 w209S3 w209S4 w209S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def w210Trace : List Ball := [ + ⟨(51893245148916510458043424523677 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(25470379536419883400903718472069 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1582038296207461198700810466893 / 3125000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(16822681675305026040216865465753 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4197830889117548098550711822711 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(83852275996653983039556461231 / 10000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(69814871042885691579669102517 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(19933828554813601828283962531 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(622609693391141400438528143 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(276600848387063126853210251 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(27650716144400109715282851 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(125649602844320609064871 / 5000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(104683001325018801543213 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(503180670441951815627 / 3125000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1149923277782722628013 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(19162317395107418669 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w210S0 : Ball := ⟨(107716355683421877826589855435717 / 100000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +def w210S1 : Ball := ⟨(116028132817174526805366257070471 / 100000000000000000000000000000000), (7 / 100000000000000000000000000000000)⟩ +def w210S2 : Ball := ⟨(134625276050398923941953560270113 / 100000000000000000000000000000000), (17 / 100000000000000000000000000000000)⟩ +def w210S3 : Ball := ⟨(45309912379115285235292658989 / 25000000000000000000000000000), (23 / 50000000000000000000000000000000)⟩ +def w210S4 : Ball := ⟨(164239052784248365396833507609001 / 50000000000000000000000000000000), (21 / 12500000000000000000000000000000)⟩ +def w210S5 : Ball := ⟨(53948932918934241491393153621359 / 5000000000000000000000000000000), (69 / 6250000000000000000000000000000)⟩ +abbrev w210 : Ball := w210S5 +lemma w210_sound : w210.Encloses (weight (23786) : ℝ) := by + exact weight_enclosed_of_trace (23786) w210Trace w210S0 w210S1 w210S2 w210S3 w210S4 w210S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def w211Trace : List Ball := [ + ⟨(103804167939780837402223169024839 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(101890248230162625546048469382577 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(12657029371250055968518732003029 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(8411700991842295028415022551883 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4197974592654152320760083688793 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(419273334002737363879198454921 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(69816576484002771124517450627 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4983563618274305822279220691 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(622621514642440807034863683 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(276605573679061076457394481 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(27651145473504446803332271 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2513027817195059070766647 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(104684376157518386426437 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(16101977788981006858953 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(287484090625769471841 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(38325041792581423451 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w211S0 : Ball := ⟨(107753052816702238613884623658711 / 100000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +def w211S1 : Ball := ⟨(14513400489148777798448977633907 / 12500000000000000000000000000000), (7 / 100000000000000000000000000000000)⟩ +def w211S2 : Ball := ⟨(67404414002695674453294593824097 / 50000000000000000000000000000000), (17 / 100000000000000000000000000000000)⟩ +def w211S3 : Ball := ⟨(45433550270467967137254515929207 / 25000000000000000000000000000000), (23 / 50000000000000000000000000000000)⟩ +def w211S4 : Ball := ⟨(330273198428662382369686571479973 / 100000000000000000000000000000000), (21 / 12500000000000000000000000000000)⟩ +def w211S5 : Ball := ⟨(1090803856002985959588218424995479 / 100000000000000000000000000000000), (111 / 10000000000000000000000000000000)⟩ +abbrev w211 : Ball := w211S5 +lemma w211_sound : w211.Encloses (weight (23895) : ℝ) := by + exact weight_enclosed_of_trace (23895) w211Trace w211S0 w211S1 w211S2 w211S3 w211S4 w211S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def w212Trace : List Ball := [ + ⟨(104599190331904000628813745749773 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(102282361957695475795426967817593 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(50757928032702220761458732478273 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(3371144213839886630993041810373 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4204420655395460160923869849437 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(41980945142865793878327258623 / 5000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(139786103806686646370685142859 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(19953351427846437846605133823 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2492605997950580621616267583 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(276817408672746412089431721 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(27670391168531640866962909 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1257315388652445222384767 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(20949200107234286778673 / 10000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(16110777814427754415279 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1150522818400496287701 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(76686549503622296281 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w212S0 : Ball := ⟨(2735247654522469839306770641499 / 2500000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +def w212S1 : Ball := ⟨(119705275705130760332354839999003 / 100000000000000000000000000000000), (7 / 100000000000000000000000000000000)⟩ +def w212S2 : Ball := ⟨(143293530316413686502966442062081 / 100000000000000000000000000000000), (9 / 50000000000000000000000000000000)⟩ +def w212S3 : Ball := ⟨(205330358305409682587644549156297 / 100000000000000000000000000000000), (13 / 25000000000000000000000000000000)⟩ +def w212S4 : Ball := ⟨(421605560418279230180499175283079 / 100000000000000000000000000000000), (107 / 50000000000000000000000000000000)⟩ +def w212S5 : Ball := ⟨(444378121439028245820485065374781 / 25000000000000000000000000000000), (361 / 20000000000000000000000000000000)⟩ +abbrev w212 : Ball := w212S5 +lemma w212_sound : w212.Encloses (weight (28778) : ℝ) := by + exact weight_enclosed_of_trace (28778) w212Trace w212S0 w212S1 w212S2 w212S3 w212S4 w212S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def w213Trace : List Ball := [ + ⟨(26157275859831324365744712686873 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(102297096135084782165894288125237 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(50762802612280673532417540836009 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(8428467108518888518131731208281 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2102331277191924252303948066939 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(839659132591981502102374193413 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(139791841633052312150345307513 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(9977033877707794746937397177 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(155792844371048270478953783 / 6250000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(55365070667083236885364113 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(27671112915875068429899469 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2514690888058899122923109 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(41899324535930645125891 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4027776946775240287859 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1150544807802969279649 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(76687916135422025799 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w213S0 : Ball := ⟨(13684061608146290988157528392871 / 12500000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +def w213S1 : Ball := ⟨(11984226694114768349011650235349 / 10000000000000000000000000000000), (7 / 100000000000000000000000000000000)⟩ +def w213S2 : Ball := ⟨(143621689455932989459716626308857 / 100000000000000000000000000000000), (9 / 50000000000000000000000000000000)⟩ +def w213S3 : Ball := ⟨(103135948410882266209611447706969 / 50000000000000000000000000000000), (13 / 25000000000000000000000000000000)⟩ +def w213S4 : Ball := ⟨(212740477092243365053150468547347 / 50000000000000000000000000000000), (43 / 20000000000000000000000000000000)⟩ +def w213S5 : Ball := ⟨(1810340423737412958859742418376039 / 100000000000000000000000000000000), (183 / 10000000000000000000000000000000)⟩ +abbrev w213 : Ball := w213S5 +lemma w213_sound : w213.Encloses (weight (28961) : ℝ) := by + exact weight_enclosed_of_trace (28961) w213Trace w213S0 w213S1 w213S2 w213S3 w213S4 w213S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def w214Trace : List Ball := [ + ⟨(104643817941585644011055002692351 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(25576085871526041849464749260823 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(6345650025415076652394745911099 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(168575308982545337599772491421 / 1000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2102390764796993902426298307757 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(839678918917955610443536100733 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(139794663665906762263941727861 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(9977210032209544594571907023 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2492724615865845181013675637 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(138414630349275657661540399 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(6917866971559857065203159 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2514720451697499889277579 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(163671012242745719121 / 78125000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(16111270073369578912207 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1150555622549900526709 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(3067543529976875711 / 4000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w214S0 : Ball := ⟨(10950328633391721530023496365059 / 10000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +def w214S1 : Ball := ⟨(59954848589639303830955584287619 / 50000000000000000000000000000000), (7 / 100000000000000000000000000000000)⟩ +def w214S2 : Ball := ⟨(143783354776262960787841124947389 / 100000000000000000000000000000000), (17 / 100000000000000000000000000000000)⟩ +def w214S3 : Ball := ⟨(206736531107167007786767430192427 / 100000000000000000000000000000000), (49 / 100000000000000000000000000000000)⟩ +def w214S4 : Ball := ⟨(427399932942246318664573400015031 / 100000000000000000000000000000000), (203 / 100000000000000000000000000000000)⟩ +def w214S5 : Ball := ⟨(1826707026790366499368061289878069 / 100000000000000000000000000000000), (217 / 12500000000000000000000000000000)⟩ +abbrev w214 : Ball := w214S5 +lemma w214_sound : w214.Encloses (weight (29051) : ℝ) := by + exact weight_enclosed_of_trace (29051) w214Trace w214S0 w214S1 w214S2 w214S3 w214S4 w214S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def w215Trace : List Ball := [ + ⟨(4187139477920639001521954579241 / 4000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(25580354429913406215624451251207 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2030833941261415319001599566811 / 4000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4214734136816501247527535360147 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2102530902224251221744589674839 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(52482845616424531760260647249 / 6250000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(139801311514672859643088353773 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(9977624995758146510741508493 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2492816736415580119971232367 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(138419232552779537202049137 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(5534460814325991472207583 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2514790093025414121162599 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(20950425000837357552979 / 10000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(16111652359746262246549 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(5752905490170948669 / 500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4793135715705515381 / 6250000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w215S0 : Ball := ⟨(54787928148629754201638919915641 / 50000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +def w215S1 : Ball := ⟨(120068682832776662632199403468457 / 100000000000000000000000000000000), (1 / 12500000000000000000000000000000)⟩ +def w215S2 : Ball := ⟨(72082442985989586293653180480559 / 50000000000000000000000000000000), (1 / 5000000000000000000000000000000)⟩ +def w215S3 : Ball := ⟨(25979392934142196527039824898701 / 12500000000000000000000000000000), (29 / 50000000000000000000000000000000)⟩ +def w215S4 : Ball := ⟨(215977234312498395921809841175079 / 50000000000000000000000000000000), (121 / 50000000000000000000000000000000)⟩ +def w215S5 : Ball := ⟨(932923314825516689178279739912999 / 50000000000000000000000000000000), (523 / 25000000000000000000000000000000)⟩ +abbrev w215 : Ball := w215S5 +lemma w215_sound : w215.Encloses (weight (29263) : ℝ) := by + exact weight_enclosed_of_trace (29263) w215Trace w215S0 w215S1 w215S2 w215S3 w215S4 w215S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def w216Trace : List Ball := [ + ⟨(104993814194427227654078850042443 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(102476628332481265185663204667291 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(50822179453251562101591990094477 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(16871708672598427120010057088159 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4207608176103844111189235274951 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4200744844137739594466446919 / 500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(139861700535376900037574461287 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(159702309542728519984293019 / 800000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2493653488700243236021188337 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(27692206831372224786004067 / 10000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(27679898912162961846196791 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1257711306164639667969443 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(8382115201319447733169 / 4000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(3223024873382905372317 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(575406234119915477163 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(76704547222952067529 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w216S0 : Ball := ⟨(110237010190939083914979690986313 / 100000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +def w216S1 : Ball := ⟨(60760992079186037211553222282009 / 50000000000000000000000000000000), (1 / 12500000000000000000000000000000)⟩ +def w216S2 : Ball := ⟨(147675926337876334132648151302889 / 100000000000000000000000000000000), (1 / 5000000000000000000000000000000)⟩ +def w216S3 : Ball := ⟨(109040896098749385736044311593007 / 50000000000000000000000000000000), (3 / 5000000000000000000000000000000)⟩ +def w216S4 : Ball := ⟨(475596680880730360398688945874217 / 100000000000000000000000000000000), (263 / 100000000000000000000000000000000)⟩ +def w216S5 : Ball := ⟨(2261922028647672715373258457489591 / 100000000000000000000000000000000), (1251 / 50000000000000000000000000000000)⟩ +abbrev w216 : Ball := w216S5 +lemma w216_sound : w216.Encloses (weight (31188) : ℝ) := by + exact weight_enclosed_of_trace (31188) w216Trace w216S0 w216S1 w216S2 w216S3 w216S4 w216S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def w217Trace : List Ball := [ + ⟨(105769353286979812971192319657867 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(102857710838126923549030157140649 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2547405059336496561618057510189 / 5000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(845151205508880701865196014289 / 5000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2106924673338435528550926461533 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(52574160131711393877303756643 / 6250000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(70004824995700874286271306077 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(9990627689679511359106118577 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(62392573665020423810114129 / 2500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(270631658485270657042287 / 97656250000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(27698497726817026655144159 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(39327679210857430103861 / 1562500000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(209671954104694842353667 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(16123625401104954019783 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(287844734674196536367 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(38369860594472552971 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w217S0 : Ball := ⟨(111871560947459473664054516305441 / 100000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +def w217S1 : Ball := ⟨(1001219691905691168706627485123 / 800000000000000000000000000000), (1 / 12500000000000000000000000000000)⟩ +def w217S2 : Ball := ⟨(9789461635348897909844075914913 / 6250000000000000000000000000000), (21 / 100000000000000000000000000000000)⟩ +def w217S3 : Ball := ⟨(245333911321517871695417010569293 / 100000000000000000000000000000000), (67 / 100000000000000000000000000000000)⟩ +def w217S4 : Ball := ⟨(300943640221571974711197268886683 / 50000000000000000000000000000000), (329 / 100000000000000000000000000000000)⟩ +def w217S5 : Ball := ⟨(905670745898109532322454496910537 / 25000000000000000000000000000000), (3961 / 100000000000000000000000000000000)⟩ +abbrev w217 : Ball := w217S5 +lemma w217_sound : w217.Encloses (weight (35898) : ℝ) := by + exact weight_enclosed_of_trace (35898) w217Trace w217S0 w217S1 w217S2 w217S3 w217S4 w217S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def w218Trace : List Ball := [ + ⟨(13238388542478214491069816710213 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(51462651949150012173333989767371 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(50970419942610208866284797643267 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(16908572139896372938996229116847 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(421495474849614805725191168537 / 10000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(420685148387848002702850616237 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(140035844466856609575439150853 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(3996904902667181614397471657 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(499213144876440899368362439 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(27716305853430552915679447 / 10000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(6925447363574626909025197 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(62931139500745194432373 / 2500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(41938605269701210777891 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4031282436416385493907 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(575739588632402068971 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(76745941977410541399 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w218S0 : Ball := ⟨(112163155969035817115278550282571 / 100000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +def w218S1 : Ball := ⟨(62902867784671275251678483296571 / 50000000000000000000000000000000), (7 / 100000000000000000000000000000000)⟩ +def w218S2 : Ball := ⟨(158270831021433413898498261129089 / 100000000000000000000000000000000), (9 / 50000000000000000000000000000000)⟩ +def w218S3 : Ball := ⟨(125248279761075647291119650566281 / 50000000000000000000000000000000), (29 / 50000000000000000000000000000000)⟩ +def w218S4 : Ball := ⟨(156871315831086716032836373326129 / 25000000000000000000000000000000), (291 / 100000000000000000000000000000000)⟩ +def w218S5 : Ball := ⟨(1968688778446124618952830375459677 / 50000000000000000000000000000000), (3653 / 100000000000000000000000000000000)⟩ +abbrev w218 : Ball := w218S5 +lemma w218_sound : w218.Encloses (weight (36731) : ℝ) := by + exact weight_enclosed_of_trace (36731) w218Trace w218S0 w218S1 w218S2 w218S3 w218S4 w218S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def w219Trace : List Ball := [ + ⟨(106215680491545755045005023524179 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(12884575941845941067043294948159 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(5102036178196093237793563948317 / 10000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(3384196825616027372211588988827 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4217427391097373213028738309537 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(420890623113675921432978149363 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(70047213901119971249691626091 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2498979428084996990116058961 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1560548114011708352159219 / 62500000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(277244097281943643244595353 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(27709150025502850262332103 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(62946462422495109382441 / 2500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(41948028645634175042909 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(8064246672628801471309 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(28792582462514276983 / 2500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(19189961817318613987 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w219S0 : Ball := ⟨(56408853911410667440272538284187 / 50000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +def w219S1 : Ball := ⟨(127278351983954822208393780317689 / 100000000000000000000000000000000), (1 / 12500000000000000000000000000000)⟩ +def w219S2 : Ball := ⟨(20249723604689370533165211977669 / 12500000000000000000000000000000), (21 / 100000000000000000000000000000000)⟩ +def w219S3 : Ball := ⟨(65608208970610219892984087578197 / 25000000000000000000000000000000), (69 / 100000000000000000000000000000000)⟩ +def w219S4 : Ball := ⟨(688709933493001492706155916439689 / 100000000000000000000000000000000), (363 / 100000000000000000000000000000000)⟩ +def w219S5 : Ball := ⟨(948642744983869078528327463215923 / 20000000000000000000000000000000), (5001 / 100000000000000000000000000000000)⟩ +abbrev w219 : Ball := w219S5 +lemma w219_sound : w219.Encloses (weight (38593) : ℝ) := by + exact weight_enclosed_of_trace (38593) w219Trace w219S0 w219S1 w219S2 w219S3 w219S4 w219S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def w220Trace : List Ball := [ + ⟨(107084875445820695299160640798929 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(51751013322893069819703829251007 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(639508164219432470845289050563 / 1250000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(8477915588519967441379618215731 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4224366834186848782196458478141 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(421467132471827180933903528311 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(28051752975897456057263041407 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(5003085176464713268693896309 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2499152076901265839392861109 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(277471339570016106830320771 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(13864894100534230352649571 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(629894230254313233324011 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(52468058976305529150023 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(3227584546491913337963 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(115233155763175004841 / 10000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(38399400004766706569 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w220S0 : Ball := ⟨(22934341098493864111607004013547 / 20000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +def w220S1 : Ball := ⟨(65748000202758092698444430463227 / 50000000000000000000000000000000), (1 / 12500000000000000000000000000000)⟩ +def w220S2 : Ball := ⟨(172911981226475127943419719316139 / 100000000000000000000000000000000), (11 / 50000000000000000000000000000000)⟩ +def w220S3 : Ball := ⟨(59797106503329774182282605479647 / 20000000000000000000000000000000), (77 / 100000000000000000000000000000000)⟩ +def w220S4 : Ball := ⟨(893923486542640993202223535508217 / 100000000000000000000000000000000), (461 / 100000000000000000000000000000000)⟩ +def w220S5 : Ball := ⟨(7990991997925512528741271791289959 / 100000000000000000000000000000000), (8243 / 100000000000000000000000000000000)⟩ +abbrev w220 : Ball := w220S5 +lemma w220_sound : w220.Encloses (weight (43809) : ℝ) := by + exact weight_enclosed_of_trace (43809) w220Trace w220S0 w220S1 w220S2 w220S3 w220S4 w220S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def w221Trace : List Ball := [ + ⟨(1339268057276728021287355743117 / 1250000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(103529674328232375697388589204029 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(51169763971928340460930461652633 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(16958093234741610868133632130949 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4224817169183960154458012937249 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(421504537239991756930953554861 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(140269425642877557666143042301 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(20013670748924004291178521387 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2499299633013892986065666731 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(55497215336508526036764087 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(3466390817375991407338651 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1259844175301900332267297 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(209880800918803626493431 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(16138534117346308669933 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(72023268194617138687 / 6250000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(38400662085499790113 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w221S0 : Ball := ⟨(28698222867868499965608344436317 / 25000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +def w221S1 : Ball := ⟨(65887039661908040866861959994153 / 50000000000000000000000000000000), (1 / 12500000000000000000000000000000)⟩ +def w221S2 : Ball := ⟨(21705509977049216220696550478549 / 12500000000000000000000000000000), (11 / 50000000000000000000000000000000)⟩ +def w221S3 : Ball := ⟨(301522664552821162795341339417369 / 100000000000000000000000000000000), (77 / 100000000000000000000000000000000)⟩ +def w221S4 : Ball := ⟨(909159172390331157488692529352999 / 100000000000000000000000000000000), (93 / 20000000000000000000000000000000)⟩ +def w221S5 : Ball := ⟨(826570400741471888048801011204779 / 10000000000000000000000000000000), (1057 / 12500000000000000000000000000000)⟩ +abbrev w221 : Ball := w221S5 +lemma w221_sound : w221.Encloses (weight (44147) : ℝ) := by + exact weight_enclosed_of_trace (44147) w221Trace w221S0 w221S1 w221S2 w221S3 w221S4 w221S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def w222Trace : List Ball := [ + ⟨(107293056450183004216559407785969 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(25900937406314496019033677655931 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(5119417029577177059234251085819 / 10000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(8482076148605313627577099232459 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1056505835191194489878475710739 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(168641886809869605887557279701 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1402979769654933300819045039 / 1000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(5004308182915532959302548207 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(156230924613593684958645997 / 6250000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(138762771260011013819957181 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(3466838817656256972993287 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(251998674973509908747547 / 10000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2623796713296139566769 / 1250000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(403504283054310769571 / 2500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(576240684370531357171 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(76808082650664909263 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w222S0 : Ball := ⟨(28779499906055391914939566548151 / 25000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +def w222S1 : Ball := ⟨(1325215383748227699292153438721 / 1000000000000000000000000000000), (7 / 100000000000000000000000000000000)⟩ +def w222S2 : Ball := ⟨(87809790666148120186858229318343 / 50000000000000000000000000000000), (19 / 100000000000000000000000000000000)⟩ +def w222S3 : Ball := ⟨(1927639834208188382189720445229 / 625000000000000000000000000000), (67 / 100000000000000000000000000000000)⟩ +def w222S4 : Ball := ⟨(190248720917820006042275069622991 / 20000000000000000000000000000000), (207 / 50000000000000000000000000000000)⟩ +def w222S5 : Ball := ⟨(9048643952716640880565939814702921 / 100000000000000000000000000000000), (7877 / 100000000000000000000000000000000)⟩ +abbrev w222 : Ball := w222S5 +lemma w222_sound : w222.Encloses (weight (45052) : ℝ) := by + exact weight_enclosed_of_trace (45052) w222Trace w222S0 w222S1 w222S2 w222S3 w222S4 w222S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def Z0_3_5Raw (ij : PairSlot) : Ball := + match ij.1.val, ij.2.val with + | 0, 0 => w195 + | 0, 1 => w195 + | 0, 2 => w195 + | 0, 3 => w195 + | 0, 4 => w195 + | 0, 5 => w195 + | 1, 0 => w195 + | 1, 1 => w195 + | 1, 2 => w195 + | 1, 3 => w195 + | 1, 4 => w195 + | 1, 5 => w172 + | 2, 0 => w195 + | 2, 1 => w195 + | 2, 2 => w195 + | 2, 3 => w195 + | 2, 4 => w209 + | 2, 5 => w195 + | 3, 0 => w195 + | 3, 1 => w195 + | 3, 2 => w195 + | 3, 3 => w195 + | 3, 4 => w195 + | 3, 5 => w195 + | 4, 0 => w195 + | 4, 1 => w195 + | 4, 2 => w209 + | 4, 3 => w195 + | 4, 4 => w195 + | 4, 5 => w195 + | 5, 0 => w195 + | 5, 1 => w172 + | 5, 2 => w195 + | 5, 3 => w195 + | 5, 4 => w195 + | 5, 5 => w195 + | _, _ => (.exact 0) +lemma Z0_3_5Raw_sound_0 (j : Fin 6) : + (Z0_3_5Raw (0,j)).Encloses (weight (orderedPairInteger (shape 0 3 5) 0 j) : ℝ) := by + fin_cases j + · change (Z0_3_5Raw (0,0)).Encloses (weight (orderedPairInteger (shape 0 3 5) 0 0) : ℝ) + have he : orderedPairInteger (shape 0 3 5) 0 0 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_3_5Raw (0,1)).Encloses (weight (orderedPairInteger (shape 0 3 5) 0 1) : ℝ) + have he : orderedPairInteger (shape 0 3 5) 0 1 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_3_5Raw (0,2)).Encloses (weight (orderedPairInteger (shape 0 3 5) 0 2) : ℝ) + have he : orderedPairInteger (shape 0 3 5) 0 2 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_3_5Raw (0,3)).Encloses (weight (orderedPairInteger (shape 0 3 5) 0 3) : ℝ) + have he : orderedPairInteger (shape 0 3 5) 0 3 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_3_5Raw (0,4)).Encloses (weight (orderedPairInteger (shape 0 3 5) 0 4) : ℝ) + have he : orderedPairInteger (shape 0 3 5) 0 4 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_3_5Raw (0,5)).Encloses (weight (orderedPairInteger (shape 0 3 5) 0 5) : ℝ) + have he : orderedPairInteger (shape 0 3 5) 0 5 = (0) := by decide +kernel + rw [he] + exact w195_sound +lemma Z0_3_5Raw_sound_1 (j : Fin 6) : + (Z0_3_5Raw (1,j)).Encloses (weight (orderedPairInteger (shape 0 3 5) 1 j) : ℝ) := by + fin_cases j + · change (Z0_3_5Raw (1,0)).Encloses (weight (orderedPairInteger (shape 0 3 5) 1 0) : ℝ) + have he : orderedPairInteger (shape 0 3 5) 1 0 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_3_5Raw (1,1)).Encloses (weight (orderedPairInteger (shape 0 3 5) 1 1) : ℝ) + have he : orderedPairInteger (shape 0 3 5) 1 1 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_3_5Raw (1,2)).Encloses (weight (orderedPairInteger (shape 0 3 5) 1 2) : ℝ) + have he : orderedPairInteger (shape 0 3 5) 1 2 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_3_5Raw (1,3)).Encloses (weight (orderedPairInteger (shape 0 3 5) 1 3) : ℝ) + have he : orderedPairInteger (shape 0 3 5) 1 3 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_3_5Raw (1,4)).Encloses (weight (orderedPairInteger (shape 0 3 5) 1 4) : ℝ) + have he : orderedPairInteger (shape 0 3 5) 1 4 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_3_5Raw (1,5)).Encloses (weight (orderedPairInteger (shape 0 3 5) 1 5) : ℝ) + have he : orderedPairInteger (shape 0 3 5) 1 5 = (-4779) := by decide +kernel + rw [he] + exact w172_sound +lemma Z0_3_5Raw_sound_2 (j : Fin 6) : + (Z0_3_5Raw (2,j)).Encloses (weight (orderedPairInteger (shape 0 3 5) 2 j) : ℝ) := by + fin_cases j + · change (Z0_3_5Raw (2,0)).Encloses (weight (orderedPairInteger (shape 0 3 5) 2 0) : ℝ) + have he : orderedPairInteger (shape 0 3 5) 2 0 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_3_5Raw (2,1)).Encloses (weight (orderedPairInteger (shape 0 3 5) 2 1) : ℝ) + have he : orderedPairInteger (shape 0 3 5) 2 1 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_3_5Raw (2,2)).Encloses (weight (orderedPairInteger (shape 0 3 5) 2 2) : ℝ) + have he : orderedPairInteger (shape 0 3 5) 2 2 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_3_5Raw (2,3)).Encloses (weight (orderedPairInteger (shape 0 3 5) 2 3) : ℝ) + have he : orderedPairInteger (shape 0 3 5) 2 3 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_3_5Raw (2,4)).Encloses (weight (orderedPairInteger (shape 0 3 5) 2 4) : ℝ) + have he : orderedPairInteger (shape 0 3 5) 2 4 = (23107) := by decide +kernel + rw [he] + exact w209_sound + · change (Z0_3_5Raw (2,5)).Encloses (weight (orderedPairInteger (shape 0 3 5) 2 5) : ℝ) + have he : orderedPairInteger (shape 0 3 5) 2 5 = (0) := by decide +kernel + rw [he] + exact w195_sound +lemma Z0_3_5Raw_sound_3 (j : Fin 6) : + (Z0_3_5Raw (3,j)).Encloses (weight (orderedPairInteger (shape 0 3 5) 3 j) : ℝ) := by + fin_cases j + · change (Z0_3_5Raw (3,0)).Encloses (weight (orderedPairInteger (shape 0 3 5) 3 0) : ℝ) + have he : orderedPairInteger (shape 0 3 5) 3 0 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_3_5Raw (3,1)).Encloses (weight (orderedPairInteger (shape 0 3 5) 3 1) : ℝ) + have he : orderedPairInteger (shape 0 3 5) 3 1 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_3_5Raw (3,2)).Encloses (weight (orderedPairInteger (shape 0 3 5) 3 2) : ℝ) + have he : orderedPairInteger (shape 0 3 5) 3 2 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_3_5Raw (3,3)).Encloses (weight (orderedPairInteger (shape 0 3 5) 3 3) : ℝ) + have he : orderedPairInteger (shape 0 3 5) 3 3 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_3_5Raw (3,4)).Encloses (weight (orderedPairInteger (shape 0 3 5) 3 4) : ℝ) + have he : orderedPairInteger (shape 0 3 5) 3 4 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_3_5Raw (3,5)).Encloses (weight (orderedPairInteger (shape 0 3 5) 3 5) : ℝ) + have he : orderedPairInteger (shape 0 3 5) 3 5 = (0) := by decide +kernel + rw [he] + exact w195_sound +lemma Z0_3_5Raw_sound_4 (j : Fin 6) : + (Z0_3_5Raw (4,j)).Encloses (weight (orderedPairInteger (shape 0 3 5) 4 j) : ℝ) := by + fin_cases j + · change (Z0_3_5Raw (4,0)).Encloses (weight (orderedPairInteger (shape 0 3 5) 4 0) : ℝ) + have he : orderedPairInteger (shape 0 3 5) 4 0 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_3_5Raw (4,1)).Encloses (weight (orderedPairInteger (shape 0 3 5) 4 1) : ℝ) + have he : orderedPairInteger (shape 0 3 5) 4 1 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_3_5Raw (4,2)).Encloses (weight (orderedPairInteger (shape 0 3 5) 4 2) : ℝ) + have he : orderedPairInteger (shape 0 3 5) 4 2 = (23107) := by decide +kernel + rw [he] + exact w209_sound + · change (Z0_3_5Raw (4,3)).Encloses (weight (orderedPairInteger (shape 0 3 5) 4 3) : ℝ) + have he : orderedPairInteger (shape 0 3 5) 4 3 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_3_5Raw (4,4)).Encloses (weight (orderedPairInteger (shape 0 3 5) 4 4) : ℝ) + have he : orderedPairInteger (shape 0 3 5) 4 4 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_3_5Raw (4,5)).Encloses (weight (orderedPairInteger (shape 0 3 5) 4 5) : ℝ) + have he : orderedPairInteger (shape 0 3 5) 4 5 = (0) := by decide +kernel + rw [he] + exact w195_sound +lemma Z0_3_5Raw_sound_5 (j : Fin 6) : + (Z0_3_5Raw (5,j)).Encloses (weight (orderedPairInteger (shape 0 3 5) 5 j) : ℝ) := by + fin_cases j + · change (Z0_3_5Raw (5,0)).Encloses (weight (orderedPairInteger (shape 0 3 5) 5 0) : ℝ) + have he : orderedPairInteger (shape 0 3 5) 5 0 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_3_5Raw (5,1)).Encloses (weight (orderedPairInteger (shape 0 3 5) 5 1) : ℝ) + have he : orderedPairInteger (shape 0 3 5) 5 1 = (-4779) := by decide +kernel + rw [he] + exact w172_sound + · change (Z0_3_5Raw (5,2)).Encloses (weight (orderedPairInteger (shape 0 3 5) 5 2) : ℝ) + have he : orderedPairInteger (shape 0 3 5) 5 2 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_3_5Raw (5,3)).Encloses (weight (orderedPairInteger (shape 0 3 5) 5 3) : ℝ) + have he : orderedPairInteger (shape 0 3 5) 5 3 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_3_5Raw (5,4)).Encloses (weight (orderedPairInteger (shape 0 3 5) 5 4) : ℝ) + have he : orderedPairInteger (shape 0 3 5) 5 4 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_3_5Raw (5,5)).Encloses (weight (orderedPairInteger (shape 0 3 5) 5 5) : ℝ) + have he : orderedPairInteger (shape 0 3 5) 5 5 = (0) := by decide +kernel + rw [he] + exact w195_sound +lemma Z0_3_5Raw_sound (ij : PairSlot) : + (Z0_3_5Raw ij).Encloses (weight (orderedPairInteger (shape 0 3 5) ij.1 ij.2) : ℝ) := by + rcases ij with ⟨i,j⟩ + revert i + exact forall_fin6 (Z0_3_5Raw_sound_0 j) (Z0_3_5Raw_sound_1 j) (Z0_3_5Raw_sound_2 j) (Z0_3_5Raw_sound_3 j) (Z0_3_5Raw_sound_4 j) (Z0_3_5Raw_sound_5 j) +def Z0_3_5Den : Ball := ⟨(1170156342338406474588056742626719 / 50000000000000000000000000000000), (283 / 12500000000000000000000000000000)⟩ +lemma Z0_3_5Den_sound : Z0_3_5Den.Encloses + (((orderedPairs (shape 0 3 5)).map (fun ij => weight (orderedPairInteger (shape 0 3 5) ij.1 ij.2))).sum : ℝ) := by + exact contains_sound (list_cast_enclosed (orderedPairs (shape 0 3 5)) Z0_3_5Raw + (fun ij => weight (orderedPairInteger (shape 0 3 5) ij.1 ij.2)) + (fun ij _ => Z0_3_5Raw_sound ij)) (by decide +kernel) +lemma Z0_3_5Den_pos : 0 < Z0_3_5Den.lower := by decide +kernel +def Z0_3_5Probs (ij : PairSlot) : Ball := + match ij.1.val, ij.2.val with + | 1, 5 => ⟨(1324789218043180893556977378811 / 50000000000000000000000000000000), (7 / 100000000000000000000000000000000)⟩ + | 2, 4 => ⟨(43077488265096366404092710992583 / 100000000000000000000000000000000), (87 / 100000000000000000000000000000000)⟩ + | 3, 4 => ⟨(854586659763454361758666849959 / 20000000000000000000000000000000), (1 / 20000000000000000000000000000000)⟩ + | 4, 2 => ⟨(43077488265096366404092710992583 / 100000000000000000000000000000000), (87 / 100000000000000000000000000000000)⟩ + | 4, 3 => ⟨(854586659763454361758666849959 / 20000000000000000000000000000000), (1 / 20000000000000000000000000000000)⟩ + | 5, 1 => ⟨(1324789218043180893556977378811 / 50000000000000000000000000000000), (7 / 100000000000000000000000000000000)⟩ + | _, _ => (.exact 0) +lemma Z0_3_5Contains : ∀ i j : Fin 6, + statisticWeight i + statisticWeight j = shapeMax (shape 0 3 5) → + contains (.mul (Z0_3_5Raw (i,j)) (.inv Z0_3_5Den)) (Z0_3_5Probs (i,j)) = true := by + decide +kernel +lemma Z0_3_5Zero : ∀ i j : Fin 6, + statisticWeight i + statisticWeight j ≠ shapeMax (shape 0 3 5) → Z0_3_5Probs (i,j) = .exact 0 := by + decide +kernel +lemma Z0_3_5Probs_sound (ij : PairSlot) : + (Z0_3_5Probs ij).Encloses (zeroPairLaw (shape 0 3 5) ij.1 ij.2 : ℝ) := by + by_cases h : statisticWeight ij.1 + statisticWeight ij.2 = shapeMax (shape 0 3 5) + · have hb := contains_sound (Ball.mul_sound (Z0_3_5Raw_sound ij) + (Ball.inv_sound Z0_3_5Den_sound Z0_3_5Den_pos)) (Z0_3_5Contains ij.1 ij.2 h) + simpa only [zeroPairLaw, h, ite_true, Rat.cast_div, Rat.cast_mul, + Rat.cast_inv, div_eq_mul_inv] using hb + · rw [Z0_3_5Zero ij.1 ij.2 h] + simpa only [zeroPairLaw, h, ite_false] using Ball.exact_sound 0 + +def Z0_3_5Half (w : Fin 3) (ij : PairSlot) : Ball := + if (shape 0 3 5) w = 0 then if ij = (0,0) then .exact 1 else .exact 0 + else if w = halfMaxAxis (shape 0 3 5) then Z0_3_5Probs ij + else Z0_3_5Probs (kappa ij.1, kappa ij.2) +lemma Z0_3_5Half_sound (w : Fin 3) (ij : PairSlot) : + (Z0_3_5Half w ij).Encloses (halfLaw (shape 0 3 5) w ij : ℝ) := by + have hp : positive (shape 0 3 5) = false := by decide +kernel + simp only [Z0_3_5Half, halfLaw, hp, Bool.false_eq_true, ite_false] + split_ifs + · exact Ball.exact_sound 1 + · exact Ball.exact_sound 0 + · exact Z0_3_5Probs_sound _ + · exact Z0_3_5Probs_sound _ + +def Z0_3_5Value (a : PairSlot) : ℝ := (zeroPairLaw (shape 0 3 5) a.1 a.2 : ℝ) +def Z0_3_5E_1_5LogWitness : LogWitness := ⟨-6, 1324789218043180893556977378811, 781250000000000000000000000000⟩ +def Z0_3_5E_1_5Log : Ball := ⟨(-363076963936676832605430257687637 / 100000000000000000000000000000000), (29646153209 / 20000000000000000000000000000000)⟩ +lemma Z0_3_5E_1_5Log_sound : Z0_3_5E_1_5Log.Encloses (Real.log (Z0_3_5Value ((1,5) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound (Z0_3_5Probs_sound ((1,5) : PairSlot)) (w := Z0_3_5E_1_5LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z0_3_5E_1_5 : Ball := ⟨(9620008942863245806376100207999 / 100000000000000000000000000000000), (3927490439 / 100000000000000000000000000000000)⟩ +lemma Z0_3_5E_1_5_sound : Z0_3_5E_1_5.Encloses (Foundation.entropyTerm (Z0_3_5Value ((1,5) : PairSlot))) := by + exact contains_sound (entropyTerm_ball (Z0_3_5Probs_sound ((1,5) : PairSlot)) Z0_3_5E_1_5Log_sound) (by decide +kernel) +def Z0_3_5E_2_4LogWitness : LogWitness := ⟨-2, 43077488265096366404092710992583, 25000000000000000000000000000000⟩ +def Z0_3_5E_2_4Log : Ball := ⟨(-21054240984169208151357583517443 / 25000000000000000000000000000000), (50821977 / 80000000000000000000000000000)⟩ +lemma Z0_3_5E_2_4Log_sound : Z0_3_5E_2_4Log.Encloses (Real.log (Z0_3_5Value ((2,4) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound (Z0_3_5Probs_sound ((2,4) : PairSlot)) (w := Z0_3_5E_2_4LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z0_3_5E_2_4 : Ball := ⟨(4534819094630300182044972074441 / 12500000000000000000000000000000), (27366039047 / 100000000000000000000000000000000)⟩ +lemma Z0_3_5E_2_4_sound : Z0_3_5E_2_4.Encloses (Foundation.entropyTerm (Z0_3_5Value ((2,4) : PairSlot))) := by + exact contains_sound (entropyTerm_ball (Z0_3_5Probs_sound ((2,4) : PairSlot)) Z0_3_5E_2_4Log_sound) (by decide +kernel) +def Z0_3_5E_3_4LogWitness : LogWitness := ⟨-5, 854586659763454361758666849959, 625000000000000000000000000000⟩ +def Z0_3_5E_3_4Log : Ball := ⟨(-315286963936676832605430276783021 / 100000000000000000000000000000000), (25410988443 / 20000000000000000000000000000000)⟩ +lemma Z0_3_5E_3_4Log_sound : Z0_3_5E_3_4Log.Encloses (Real.log (Z0_3_5Value ((3,4) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound (Z0_3_5Probs_sound ((3,4) : PairSlot)) (w := Z0_3_5E_3_4LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z0_3_5E_3_4 : Ball := ⟨(2694400333776053497620803489567 / 20000000000000000000000000000000), (108579459 / 2000000000000000000000000000000)⟩ +lemma Z0_3_5E_3_4_sound : Z0_3_5E_3_4.Encloses (Foundation.entropyTerm (Z0_3_5Value ((3,4) : PairSlot))) := by + exact contains_sound (entropyTerm_ball (Z0_3_5Probs_sound ((3,4) : PairSlot)) Z0_3_5E_3_4Log_sound) (by decide +kernel) +def Z0_3_5E_4_2LogWitness : LogWitness := ⟨-2, 43077488265096366404092710992583, 25000000000000000000000000000000⟩ +def Z0_3_5E_4_2Log : Ball := ⟨(-21054240984169208151357583517443 / 25000000000000000000000000000000), (50821977 / 80000000000000000000000000000)⟩ +lemma Z0_3_5E_4_2Log_sound : Z0_3_5E_4_2Log.Encloses (Real.log (Z0_3_5Value ((4,2) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound (Z0_3_5Probs_sound ((4,2) : PairSlot)) (w := Z0_3_5E_4_2LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z0_3_5E_4_2 : Ball := ⟨(4534819094630300182044972074441 / 12500000000000000000000000000000), (27366039047 / 100000000000000000000000000000000)⟩ +lemma Z0_3_5E_4_2_sound : Z0_3_5E_4_2.Encloses (Foundation.entropyTerm (Z0_3_5Value ((4,2) : PairSlot))) := by + exact contains_sound (entropyTerm_ball (Z0_3_5Probs_sound ((4,2) : PairSlot)) Z0_3_5E_4_2Log_sound) (by decide +kernel) +def Z0_3_5E_4_3LogWitness : LogWitness := ⟨-5, 854586659763454361758666849959, 625000000000000000000000000000⟩ +def Z0_3_5E_4_3Log : Ball := ⟨(-315286963936676832605430276783021 / 100000000000000000000000000000000), (25410988443 / 20000000000000000000000000000000)⟩ +lemma Z0_3_5E_4_3Log_sound : Z0_3_5E_4_3Log.Encloses (Real.log (Z0_3_5Value ((4,3) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound (Z0_3_5Probs_sound ((4,3) : PairSlot)) (w := Z0_3_5E_4_3LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z0_3_5E_4_3 : Ball := ⟨(2694400333776053497620803489567 / 20000000000000000000000000000000), (108579459 / 2000000000000000000000000000000)⟩ +lemma Z0_3_5E_4_3_sound : Z0_3_5E_4_3.Encloses (Foundation.entropyTerm (Z0_3_5Value ((4,3) : PairSlot))) := by + exact contains_sound (entropyTerm_ball (Z0_3_5Probs_sound ((4,3) : PairSlot)) Z0_3_5E_4_3Log_sound) (by decide +kernel) +def Z0_3_5E_5_1LogWitness : LogWitness := ⟨-6, 1324789218043180893556977378811, 781250000000000000000000000000⟩ +def Z0_3_5E_5_1Log : Ball := ⟨(-363076963936676832605430257687637 / 100000000000000000000000000000000), (29646153209 / 20000000000000000000000000000000)⟩ +lemma Z0_3_5E_5_1Log_sound : Z0_3_5E_5_1Log.Encloses (Real.log (Z0_3_5Value ((5,1) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound (Z0_3_5Probs_sound ((5,1) : PairSlot)) (w := Z0_3_5E_5_1LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z0_3_5E_5_1 : Ball := ⟨(9620008942863245806376100207999 / 100000000000000000000000000000000), (3927490439 / 100000000000000000000000000000000)⟩ +lemma Z0_3_5E_5_1_sound : Z0_3_5E_5_1.Encloses (Foundation.entropyTerm (Z0_3_5Value ((5,1) : PairSlot))) := by + exact contains_sound (entropyTerm_ball (Z0_3_5Probs_sound ((5,1) : PairSlot)) Z0_3_5E_5_1Log_sound) (by decide +kernel) +def Z0_3_5Terms (a : PairSlot) : Ball := + match a.1.val, a.2.val with + | 1, 5 => ⟨(9620008942863245806376100207999 / 100000000000000000000000000000000), (3927490439 / 100000000000000000000000000000000)⟩ + | 2, 4 => ⟨(4534819094630300182044972074441 / 12500000000000000000000000000000), (27366039047 / 100000000000000000000000000000000)⟩ + | 3, 4 => ⟨(2694400333776053497620803489567 / 20000000000000000000000000000000), (108579459 / 2000000000000000000000000000000)⟩ + | 4, 2 => ⟨(4534819094630300182044972074441 / 12500000000000000000000000000000), (27366039047 / 100000000000000000000000000000000)⟩ + | 4, 3 => ⟨(2694400333776053497620803489567 / 20000000000000000000000000000000), (108579459 / 2000000000000000000000000000000)⟩ + | 5, 1 => ⟨(9620008942863245806376100207999 / 100000000000000000000000000000000), (3927490439 / 100000000000000000000000000000000)⟩ + | _, _ => (.exact 0) +lemma Z0_3_5Terms_sound (a : PairSlot) : + (Z0_3_5Terms a).Encloses (Foundation.entropyTerm (Z0_3_5Value a)) := by + rcases a with ⟨i,j⟩ + revert j i + apply forall_fin6 + · exact forall_fin6 (entropyTerm_zero_ball (Z0_3_5Probs_sound ((0,0) : PairSlot))) (entropyTerm_zero_ball (Z0_3_5Probs_sound ((0,1) : PairSlot))) (entropyTerm_zero_ball (Z0_3_5Probs_sound ((0,2) : PairSlot))) (entropyTerm_zero_ball (Z0_3_5Probs_sound ((0,3) : PairSlot))) (entropyTerm_zero_ball (Z0_3_5Probs_sound ((0,4) : PairSlot))) (entropyTerm_zero_ball (Z0_3_5Probs_sound ((0,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball (Z0_3_5Probs_sound ((1,0) : PairSlot))) (entropyTerm_zero_ball (Z0_3_5Probs_sound ((1,1) : PairSlot))) (entropyTerm_zero_ball (Z0_3_5Probs_sound ((1,2) : PairSlot))) (entropyTerm_zero_ball (Z0_3_5Probs_sound ((1,3) : PairSlot))) (entropyTerm_zero_ball (Z0_3_5Probs_sound ((1,4) : PairSlot))) Z0_3_5E_1_5_sound + · exact forall_fin6 (entropyTerm_zero_ball (Z0_3_5Probs_sound ((2,0) : PairSlot))) (entropyTerm_zero_ball (Z0_3_5Probs_sound ((2,1) : PairSlot))) (entropyTerm_zero_ball (Z0_3_5Probs_sound ((2,2) : PairSlot))) (entropyTerm_zero_ball (Z0_3_5Probs_sound ((2,3) : PairSlot))) Z0_3_5E_2_4_sound (entropyTerm_zero_ball (Z0_3_5Probs_sound ((2,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball (Z0_3_5Probs_sound ((3,0) : PairSlot))) (entropyTerm_zero_ball (Z0_3_5Probs_sound ((3,1) : PairSlot))) (entropyTerm_zero_ball (Z0_3_5Probs_sound ((3,2) : PairSlot))) (entropyTerm_zero_ball (Z0_3_5Probs_sound ((3,3) : PairSlot))) Z0_3_5E_3_4_sound (entropyTerm_zero_ball (Z0_3_5Probs_sound ((3,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball (Z0_3_5Probs_sound ((4,0) : PairSlot))) (entropyTerm_zero_ball (Z0_3_5Probs_sound ((4,1) : PairSlot))) Z0_3_5E_4_2_sound Z0_3_5E_4_3_sound (entropyTerm_zero_ball (Z0_3_5Probs_sound ((4,4) : PairSlot))) (entropyTerm_zero_ball (Z0_3_5Probs_sound ((4,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball (Z0_3_5Probs_sound ((5,0) : PairSlot))) Z0_3_5E_5_1_sound (entropyTerm_zero_ball (Z0_3_5Probs_sound ((5,2) : PairSlot))) (entropyTerm_zero_ball (Z0_3_5Probs_sound ((5,3) : PairSlot))) (entropyTerm_zero_ball (Z0_3_5Probs_sound ((5,4) : PairSlot))) (entropyTerm_zero_ball (Z0_3_5Probs_sound ((5,5) : PairSlot))) +def Z0_3_5Entropy : Ball := ⟨(29685281684392957375419947125681 / 25000000000000000000000000000000), (9180625609 / 12500000000000000000000000000000)⟩ +lemma Z0_3_5Entropy_sound : Z0_3_5Entropy.Encloses (Foundation.finiteEntropy Z0_3_5Value) := by + exact contains_sound (entropyPair_enclosed Z0_3_5Value Z0_3_5Terms Z0_3_5Terms_sound) (by decide +kernel) +def Z0_3_5Labels : Ball := ⟨(128376055945530243441219837539503 / 25000000000000000000000000000000), (31897811419 / 20000000000000000000000000000000)⟩ +lemma Z0_3_5Labels_sound : Z0_3_5Labels.Encloses + (∑ a : PairSlot, (zeroPairLaw (shape 0 3 5) a.1 a.2 : ℝ) * + Real.log (AllFieldParameters.multiplicity a.1 * AllFieldParameters.multiplicity a.2 : ℕ)) := by + exact contains_sound (pairSumBall_sound (fun a => .mul (Z0_3_5Probs a) (multLogs a)) + _ (fun a => Ball.mul_sound (Z0_3_5Probs_sound a) (multLogs_sound a))) (by decide +kernel) +def Z0_3_5Four : Ball := ⟨(4939416800935100025519993270787 / 781250000000000000000000000000), (232934061967 / 100000000000000000000000000000000)⟩ +lemma Z0_3_5Four_sound : Z0_3_5Four.Encloses (AllFieldZeroLeafRates.fourRate (shape 0 3 5)) := by + exact contains_sound (Ball.add_sound Z0_3_5Entropy_sound Z0_3_5Labels_sound) (by decide +kernel) +def Z0_3_5H0Value (a : PairSlot) : ℝ := (halfLaw (shape 0 3 5) 0 a : ℝ) +def Z0_3_5H0E_0_0Log : Ball := .exact 0 +lemma Z0_3_5H0E_0_0Log_sound : Z0_3_5H0E_0_0Log.Encloses (Real.log (Z0_3_5H0Value ((0,0) : PairSlot))) := by + exact log_exact_one_ball ((Z0_3_5Half_sound 0) ((0,0) : PairSlot)) +def Z0_3_5H0E_0_0 : Ball := ⟨0, 0⟩ +lemma Z0_3_5H0E_0_0_sound : Z0_3_5H0E_0_0.Encloses (Foundation.entropyTerm (Z0_3_5H0Value ((0,0) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z0_3_5Half_sound 0) ((0,0) : PairSlot)) Z0_3_5H0E_0_0Log_sound) (by decide +kernel) +def Z0_3_5H0Terms (a : PairSlot) : Ball := + match a.1.val, a.2.val with + | 0, 0 => ⟨0, 0⟩ + | _, _ => (.exact 0) +lemma Z0_3_5H0Terms_sound (a : PairSlot) : + (Z0_3_5H0Terms a).Encloses (Foundation.entropyTerm (Z0_3_5H0Value a)) := by + rcases a with ⟨i,j⟩ + revert j i + apply forall_fin6 + · exact forall_fin6 Z0_3_5H0E_0_0_sound (entropyTerm_zero_ball ((Z0_3_5Half_sound 0) ((0,1) : PairSlot))) (entropyTerm_zero_ball ((Z0_3_5Half_sound 0) ((0,2) : PairSlot))) (entropyTerm_zero_ball ((Z0_3_5Half_sound 0) ((0,3) : PairSlot))) (entropyTerm_zero_ball ((Z0_3_5Half_sound 0) ((0,4) : PairSlot))) (entropyTerm_zero_ball ((Z0_3_5Half_sound 0) ((0,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z0_3_5Half_sound 0) ((1,0) : PairSlot))) (entropyTerm_zero_ball ((Z0_3_5Half_sound 0) ((1,1) : PairSlot))) (entropyTerm_zero_ball ((Z0_3_5Half_sound 0) ((1,2) : PairSlot))) (entropyTerm_zero_ball ((Z0_3_5Half_sound 0) ((1,3) : PairSlot))) (entropyTerm_zero_ball ((Z0_3_5Half_sound 0) ((1,4) : PairSlot))) (entropyTerm_zero_ball ((Z0_3_5Half_sound 0) ((1,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z0_3_5Half_sound 0) ((2,0) : PairSlot))) (entropyTerm_zero_ball ((Z0_3_5Half_sound 0) ((2,1) : PairSlot))) (entropyTerm_zero_ball ((Z0_3_5Half_sound 0) ((2,2) : PairSlot))) (entropyTerm_zero_ball ((Z0_3_5Half_sound 0) ((2,3) : PairSlot))) (entropyTerm_zero_ball ((Z0_3_5Half_sound 0) ((2,4) : PairSlot))) (entropyTerm_zero_ball ((Z0_3_5Half_sound 0) ((2,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z0_3_5Half_sound 0) ((3,0) : PairSlot))) (entropyTerm_zero_ball ((Z0_3_5Half_sound 0) ((3,1) : PairSlot))) (entropyTerm_zero_ball ((Z0_3_5Half_sound 0) ((3,2) : PairSlot))) (entropyTerm_zero_ball ((Z0_3_5Half_sound 0) ((3,3) : PairSlot))) (entropyTerm_zero_ball ((Z0_3_5Half_sound 0) ((3,4) : PairSlot))) (entropyTerm_zero_ball ((Z0_3_5Half_sound 0) ((3,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z0_3_5Half_sound 0) ((4,0) : PairSlot))) (entropyTerm_zero_ball ((Z0_3_5Half_sound 0) ((4,1) : PairSlot))) (entropyTerm_zero_ball ((Z0_3_5Half_sound 0) ((4,2) : PairSlot))) (entropyTerm_zero_ball ((Z0_3_5Half_sound 0) ((4,3) : PairSlot))) (entropyTerm_zero_ball ((Z0_3_5Half_sound 0) ((4,4) : PairSlot))) (entropyTerm_zero_ball ((Z0_3_5Half_sound 0) ((4,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z0_3_5Half_sound 0) ((5,0) : PairSlot))) (entropyTerm_zero_ball ((Z0_3_5Half_sound 0) ((5,1) : PairSlot))) (entropyTerm_zero_ball ((Z0_3_5Half_sound 0) ((5,2) : PairSlot))) (entropyTerm_zero_ball ((Z0_3_5Half_sound 0) ((5,3) : PairSlot))) (entropyTerm_zero_ball ((Z0_3_5Half_sound 0) ((5,4) : PairSlot))) (entropyTerm_zero_ball ((Z0_3_5Half_sound 0) ((5,5) : PairSlot))) +def Z0_3_5H0Entropy : Ball := ⟨0, 0⟩ +lemma Z0_3_5H0Entropy_sound : Z0_3_5H0Entropy.Encloses (Foundation.finiteEntropy Z0_3_5H0Value) := by + exact contains_sound (entropyPair_enclosed Z0_3_5H0Value Z0_3_5H0Terms Z0_3_5H0Terms_sound) (by decide +kernel) +def Z0_3_5H0Mass : Ball := ⟨1, 0⟩ +lemma Z0_3_5H0Mass_sound : Z0_3_5H0Mass.Encloses (∑ a, Z0_3_5H0Value a) := by + exact contains_sound (pairSumBall_sound (Z0_3_5Half 0) Z0_3_5H0Value (Z0_3_5Half_sound 0)) (by decide +kernel) +def Z0_3_5H0MassTermLog : Ball := .exact 0 +lemma Z0_3_5H0MassTermLog_sound : Z0_3_5H0MassTermLog.Encloses (Real.log ((∑ a, Z0_3_5H0Value a))) := by + exact log_exact_one_ball (Z0_3_5H0Mass_sound) +def Z0_3_5H0MassTerm : Ball := ⟨0, 0⟩ +lemma Z0_3_5H0MassTerm_sound : Z0_3_5H0MassTerm.Encloses (Foundation.entropyTerm ((∑ a, Z0_3_5H0Value a))) := by + exact contains_sound (entropyTerm_ball (Z0_3_5H0Mass_sound) Z0_3_5H0MassTermLog_sound) (by decide +kernel) +def Z0_3_5H0H : Ball := ⟨0, 0⟩ +lemma Z0_3_5H0H_sound : Z0_3_5H0H.Encloses (homogeneousEntropy Z0_3_5H0Value) := by + exact contains_sound (homogeneous_enclosed Z0_3_5H0Value Z0_3_5H0MassTerm_sound Z0_3_5H0Entropy_sound) (by decide +kernel) +def Z0_3_5H1Value (a : PairSlot) : ℝ := (halfLaw (shape 0 3 5) 1 a : ℝ) +def Z0_3_5H1E_4_0LogWitness : LogWitness := ⟨-6, 1324789218043180893556977378811, 781250000000000000000000000000⟩ +def Z0_3_5H1E_4_0Log : Ball := ⟨(-363076963936676832605430257687637 / 100000000000000000000000000000000), (29646153209 / 20000000000000000000000000000000)⟩ +lemma Z0_3_5H1E_4_0Log_sound : Z0_3_5H1E_4_0Log.Encloses (Real.log (Z0_3_5H1Value ((4,0) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound ((Z0_3_5Half_sound 1) ((4,0) : PairSlot)) (w := Z0_3_5H1E_4_0LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z0_3_5H1E_4_0 : Ball := ⟨(9620008942863245806376100207999 / 100000000000000000000000000000000), (3927490439 / 100000000000000000000000000000000)⟩ +lemma Z0_3_5H1E_4_0_sound : Z0_3_5H1E_4_0.Encloses (Foundation.entropyTerm (Z0_3_5H1Value ((4,0) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z0_3_5Half_sound 1) ((4,0) : PairSlot)) Z0_3_5H1E_4_0Log_sound) (by decide +kernel) +def Z0_3_5H1E_2_1LogWitness : LogWitness := ⟨-2, 43077488265096366404092710992583, 25000000000000000000000000000000⟩ +def Z0_3_5H1E_2_1Log : Ball := ⟨(-21054240984169208151357583517443 / 25000000000000000000000000000000), (50821977 / 80000000000000000000000000000)⟩ +lemma Z0_3_5H1E_2_1Log_sound : Z0_3_5H1E_2_1Log.Encloses (Real.log (Z0_3_5H1Value ((2,1) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound ((Z0_3_5Half_sound 1) ((2,1) : PairSlot)) (w := Z0_3_5H1E_2_1LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z0_3_5H1E_2_1 : Ball := ⟨(4534819094630300182044972074441 / 12500000000000000000000000000000), (27366039047 / 100000000000000000000000000000000)⟩ +lemma Z0_3_5H1E_2_1_sound : Z0_3_5H1E_2_1.Encloses (Foundation.entropyTerm (Z0_3_5H1Value ((2,1) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z0_3_5Half_sound 1) ((2,1) : PairSlot)) Z0_3_5H1E_2_1Log_sound) (by decide +kernel) +def Z0_3_5H1E_3_1LogWitness : LogWitness := ⟨-5, 854586659763454361758666849959, 625000000000000000000000000000⟩ +def Z0_3_5H1E_3_1Log : Ball := ⟨(-315286963936676832605430276783021 / 100000000000000000000000000000000), (25410988443 / 20000000000000000000000000000000)⟩ +lemma Z0_3_5H1E_3_1Log_sound : Z0_3_5H1E_3_1Log.Encloses (Real.log (Z0_3_5H1Value ((3,1) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound ((Z0_3_5Half_sound 1) ((3,1) : PairSlot)) (w := Z0_3_5H1E_3_1LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z0_3_5H1E_3_1 : Ball := ⟨(2694400333776053497620803489567 / 20000000000000000000000000000000), (108579459 / 2000000000000000000000000000000)⟩ +lemma Z0_3_5H1E_3_1_sound : Z0_3_5H1E_3_1.Encloses (Foundation.entropyTerm (Z0_3_5H1Value ((3,1) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z0_3_5Half_sound 1) ((3,1) : PairSlot)) Z0_3_5H1E_3_1Log_sound) (by decide +kernel) +def Z0_3_5H1E_1_2LogWitness : LogWitness := ⟨-2, 43077488265096366404092710992583, 25000000000000000000000000000000⟩ +def Z0_3_5H1E_1_2Log : Ball := ⟨(-21054240984169208151357583517443 / 25000000000000000000000000000000), (50821977 / 80000000000000000000000000000)⟩ +lemma Z0_3_5H1E_1_2Log_sound : Z0_3_5H1E_1_2Log.Encloses (Real.log (Z0_3_5H1Value ((1,2) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound ((Z0_3_5Half_sound 1) ((1,2) : PairSlot)) (w := Z0_3_5H1E_1_2LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z0_3_5H1E_1_2 : Ball := ⟨(4534819094630300182044972074441 / 12500000000000000000000000000000), (27366039047 / 100000000000000000000000000000000)⟩ +lemma Z0_3_5H1E_1_2_sound : Z0_3_5H1E_1_2.Encloses (Foundation.entropyTerm (Z0_3_5H1Value ((1,2) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z0_3_5Half_sound 1) ((1,2) : PairSlot)) Z0_3_5H1E_1_2Log_sound) (by decide +kernel) +def Z0_3_5H1E_1_3LogWitness : LogWitness := ⟨-5, 854586659763454361758666849959, 625000000000000000000000000000⟩ +def Z0_3_5H1E_1_3Log : Ball := ⟨(-315286963936676832605430276783021 / 100000000000000000000000000000000), (25410988443 / 20000000000000000000000000000000)⟩ +lemma Z0_3_5H1E_1_3Log_sound : Z0_3_5H1E_1_3Log.Encloses (Real.log (Z0_3_5H1Value ((1,3) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound ((Z0_3_5Half_sound 1) ((1,3) : PairSlot)) (w := Z0_3_5H1E_1_3LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z0_3_5H1E_1_3 : Ball := ⟨(2694400333776053497620803489567 / 20000000000000000000000000000000), (108579459 / 2000000000000000000000000000000)⟩ +lemma Z0_3_5H1E_1_3_sound : Z0_3_5H1E_1_3.Encloses (Foundation.entropyTerm (Z0_3_5H1Value ((1,3) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z0_3_5Half_sound 1) ((1,3) : PairSlot)) Z0_3_5H1E_1_3Log_sound) (by decide +kernel) +def Z0_3_5H1E_0_4LogWitness : LogWitness := ⟨-6, 1324789218043180893556977378811, 781250000000000000000000000000⟩ +def Z0_3_5H1E_0_4Log : Ball := ⟨(-363076963936676832605430257687637 / 100000000000000000000000000000000), (29646153209 / 20000000000000000000000000000000)⟩ +lemma Z0_3_5H1E_0_4Log_sound : Z0_3_5H1E_0_4Log.Encloses (Real.log (Z0_3_5H1Value ((0,4) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound ((Z0_3_5Half_sound 1) ((0,4) : PairSlot)) (w := Z0_3_5H1E_0_4LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z0_3_5H1E_0_4 : Ball := ⟨(9620008942863245806376100207999 / 100000000000000000000000000000000), (3927490439 / 100000000000000000000000000000000)⟩ +lemma Z0_3_5H1E_0_4_sound : Z0_3_5H1E_0_4.Encloses (Foundation.entropyTerm (Z0_3_5H1Value ((0,4) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z0_3_5Half_sound 1) ((0,4) : PairSlot)) Z0_3_5H1E_0_4Log_sound) (by decide +kernel) +def Z0_3_5H1Terms (a : PairSlot) : Ball := + match a.1.val, a.2.val with + | 4, 0 => ⟨(9620008942863245806376100207999 / 100000000000000000000000000000000), (3927490439 / 100000000000000000000000000000000)⟩ + | 2, 1 => ⟨(4534819094630300182044972074441 / 12500000000000000000000000000000), (27366039047 / 100000000000000000000000000000000)⟩ + | 3, 1 => ⟨(2694400333776053497620803489567 / 20000000000000000000000000000000), (108579459 / 2000000000000000000000000000000)⟩ + | 1, 2 => ⟨(4534819094630300182044972074441 / 12500000000000000000000000000000), (27366039047 / 100000000000000000000000000000000)⟩ + | 1, 3 => ⟨(2694400333776053497620803489567 / 20000000000000000000000000000000), (108579459 / 2000000000000000000000000000000)⟩ + | 0, 4 => ⟨(9620008942863245806376100207999 / 100000000000000000000000000000000), (3927490439 / 100000000000000000000000000000000)⟩ + | _, _ => (.exact 0) +lemma Z0_3_5H1Terms_sound (a : PairSlot) : + (Z0_3_5H1Terms a).Encloses (Foundation.entropyTerm (Z0_3_5H1Value a)) := by + rcases a with ⟨i,j⟩ + revert j i + apply forall_fin6 + · exact forall_fin6 (entropyTerm_zero_ball ((Z0_3_5Half_sound 1) ((0,0) : PairSlot))) (entropyTerm_zero_ball ((Z0_3_5Half_sound 1) ((0,1) : PairSlot))) (entropyTerm_zero_ball ((Z0_3_5Half_sound 1) ((0,2) : PairSlot))) (entropyTerm_zero_ball ((Z0_3_5Half_sound 1) ((0,3) : PairSlot))) Z0_3_5H1E_0_4_sound (entropyTerm_zero_ball ((Z0_3_5Half_sound 1) ((0,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z0_3_5Half_sound 1) ((1,0) : PairSlot))) (entropyTerm_zero_ball ((Z0_3_5Half_sound 1) ((1,1) : PairSlot))) Z0_3_5H1E_1_2_sound Z0_3_5H1E_1_3_sound (entropyTerm_zero_ball ((Z0_3_5Half_sound 1) ((1,4) : PairSlot))) (entropyTerm_zero_ball ((Z0_3_5Half_sound 1) ((1,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z0_3_5Half_sound 1) ((2,0) : PairSlot))) Z0_3_5H1E_2_1_sound (entropyTerm_zero_ball ((Z0_3_5Half_sound 1) ((2,2) : PairSlot))) (entropyTerm_zero_ball ((Z0_3_5Half_sound 1) ((2,3) : PairSlot))) (entropyTerm_zero_ball ((Z0_3_5Half_sound 1) ((2,4) : PairSlot))) (entropyTerm_zero_ball ((Z0_3_5Half_sound 1) ((2,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z0_3_5Half_sound 1) ((3,0) : PairSlot))) Z0_3_5H1E_3_1_sound (entropyTerm_zero_ball ((Z0_3_5Half_sound 1) ((3,2) : PairSlot))) (entropyTerm_zero_ball ((Z0_3_5Half_sound 1) ((3,3) : PairSlot))) (entropyTerm_zero_ball ((Z0_3_5Half_sound 1) ((3,4) : PairSlot))) (entropyTerm_zero_ball ((Z0_3_5Half_sound 1) ((3,5) : PairSlot))) + · exact forall_fin6 Z0_3_5H1E_4_0_sound (entropyTerm_zero_ball ((Z0_3_5Half_sound 1) ((4,1) : PairSlot))) (entropyTerm_zero_ball ((Z0_3_5Half_sound 1) ((4,2) : PairSlot))) (entropyTerm_zero_ball ((Z0_3_5Half_sound 1) ((4,3) : PairSlot))) (entropyTerm_zero_ball ((Z0_3_5Half_sound 1) ((4,4) : PairSlot))) (entropyTerm_zero_ball ((Z0_3_5Half_sound 1) ((4,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z0_3_5Half_sound 1) ((5,0) : PairSlot))) (entropyTerm_zero_ball ((Z0_3_5Half_sound 1) ((5,1) : PairSlot))) (entropyTerm_zero_ball ((Z0_3_5Half_sound 1) ((5,2) : PairSlot))) (entropyTerm_zero_ball ((Z0_3_5Half_sound 1) ((5,3) : PairSlot))) (entropyTerm_zero_ball ((Z0_3_5Half_sound 1) ((5,4) : PairSlot))) (entropyTerm_zero_ball ((Z0_3_5Half_sound 1) ((5,5) : PairSlot))) +def Z0_3_5H1Entropy : Ball := ⟨(29685281684392957375419947125681 / 25000000000000000000000000000000), (9180625609 / 12500000000000000000000000000000)⟩ +lemma Z0_3_5H1Entropy_sound : Z0_3_5H1Entropy.Encloses (Foundation.finiteEntropy Z0_3_5H1Value) := by + exact contains_sound (entropyPair_enclosed Z0_3_5H1Value Z0_3_5H1Terms Z0_3_5H1Terms_sound) (by decide +kernel) +def Z0_3_5H1Mass : Ball := ⟨1, (99 / 50000000000000000000000000000000)⟩ +lemma Z0_3_5H1Mass_sound : Z0_3_5H1Mass.Encloses (∑ a, Z0_3_5H1Value a) := by + exact contains_sound (pairSumBall_sound (Z0_3_5Half 1) Z0_3_5H1Value (Z0_3_5Half_sound 1)) (by decide +kernel) +def Z0_3_5H1MassTermLogWitness : LogWitness := ⟨0, 1, 1⟩ +def Z0_3_5H1MassTermLog : Ball := ⟨0, (529395597 / 2500000000000000000000000000000)⟩ +lemma Z0_3_5H1MassTermLog_sound : Z0_3_5H1MassTermLog.Encloses (Real.log ((∑ a, Z0_3_5H1Value a))) := by + exact checkLog_sound logTwoBall_sound (Z0_3_5H1Mass_sound) (w := Z0_3_5H1MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z0_3_5H1MassTerm : Ball := ⟨0, (21175823881 / 100000000000000000000000000000000)⟩ +lemma Z0_3_5H1MassTerm_sound : Z0_3_5H1MassTerm.Encloses (Foundation.entropyTerm ((∑ a, Z0_3_5H1Value a))) := by + exact contains_sound (entropyTerm_ball (Z0_3_5H1Mass_sound) Z0_3_5H1MassTermLog_sound) (by decide +kernel) +def Z0_3_5H1H : Ball := ⟨(29685281684392957375419947125681 / 25000000000000000000000000000000), (94620828753 / 100000000000000000000000000000000)⟩ +lemma Z0_3_5H1H_sound : Z0_3_5H1H.Encloses (homogeneousEntropy Z0_3_5H1Value) := by + exact contains_sound (homogeneous_enclosed Z0_3_5H1Value Z0_3_5H1MassTerm_sound Z0_3_5H1Entropy_sound) (by decide +kernel) +def Z0_3_5H2Value (a : PairSlot) : ℝ := (halfLaw (shape 0 3 5) 2 a : ℝ) +def Z0_3_5H2E_1_5LogWitness : LogWitness := ⟨-6, 1324789218043180893556977378811, 781250000000000000000000000000⟩ +def Z0_3_5H2E_1_5Log : Ball := ⟨(-363076963936676832605430257687637 / 100000000000000000000000000000000), (29646153209 / 20000000000000000000000000000000)⟩ +lemma Z0_3_5H2E_1_5Log_sound : Z0_3_5H2E_1_5Log.Encloses (Real.log (Z0_3_5H2Value ((1,5) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound ((Z0_3_5Half_sound 2) ((1,5) : PairSlot)) (w := Z0_3_5H2E_1_5LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z0_3_5H2E_1_5 : Ball := ⟨(9620008942863245806376100207999 / 100000000000000000000000000000000), (3927490439 / 100000000000000000000000000000000)⟩ +lemma Z0_3_5H2E_1_5_sound : Z0_3_5H2E_1_5.Encloses (Foundation.entropyTerm (Z0_3_5H2Value ((1,5) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z0_3_5Half_sound 2) ((1,5) : PairSlot)) Z0_3_5H2E_1_5Log_sound) (by decide +kernel) +def Z0_3_5H2E_2_4LogWitness : LogWitness := ⟨-2, 43077488265096366404092710992583, 25000000000000000000000000000000⟩ +def Z0_3_5H2E_2_4Log : Ball := ⟨(-21054240984169208151357583517443 / 25000000000000000000000000000000), (50821977 / 80000000000000000000000000000)⟩ +lemma Z0_3_5H2E_2_4Log_sound : Z0_3_5H2E_2_4Log.Encloses (Real.log (Z0_3_5H2Value ((2,4) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound ((Z0_3_5Half_sound 2) ((2,4) : PairSlot)) (w := Z0_3_5H2E_2_4LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z0_3_5H2E_2_4 : Ball := ⟨(4534819094630300182044972074441 / 12500000000000000000000000000000), (27366039047 / 100000000000000000000000000000000)⟩ +lemma Z0_3_5H2E_2_4_sound : Z0_3_5H2E_2_4.Encloses (Foundation.entropyTerm (Z0_3_5H2Value ((2,4) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z0_3_5Half_sound 2) ((2,4) : PairSlot)) Z0_3_5H2E_2_4Log_sound) (by decide +kernel) +def Z0_3_5H2E_3_4LogWitness : LogWitness := ⟨-5, 854586659763454361758666849959, 625000000000000000000000000000⟩ +def Z0_3_5H2E_3_4Log : Ball := ⟨(-315286963936676832605430276783021 / 100000000000000000000000000000000), (25410988443 / 20000000000000000000000000000000)⟩ +lemma Z0_3_5H2E_3_4Log_sound : Z0_3_5H2E_3_4Log.Encloses (Real.log (Z0_3_5H2Value ((3,4) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound ((Z0_3_5Half_sound 2) ((3,4) : PairSlot)) (w := Z0_3_5H2E_3_4LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z0_3_5H2E_3_4 : Ball := ⟨(2694400333776053497620803489567 / 20000000000000000000000000000000), (108579459 / 2000000000000000000000000000000)⟩ +lemma Z0_3_5H2E_3_4_sound : Z0_3_5H2E_3_4.Encloses (Foundation.entropyTerm (Z0_3_5H2Value ((3,4) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z0_3_5Half_sound 2) ((3,4) : PairSlot)) Z0_3_5H2E_3_4Log_sound) (by decide +kernel) +def Z0_3_5H2E_4_2LogWitness : LogWitness := ⟨-2, 43077488265096366404092710992583, 25000000000000000000000000000000⟩ +def Z0_3_5H2E_4_2Log : Ball := ⟨(-21054240984169208151357583517443 / 25000000000000000000000000000000), (50821977 / 80000000000000000000000000000)⟩ +lemma Z0_3_5H2E_4_2Log_sound : Z0_3_5H2E_4_2Log.Encloses (Real.log (Z0_3_5H2Value ((4,2) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound ((Z0_3_5Half_sound 2) ((4,2) : PairSlot)) (w := Z0_3_5H2E_4_2LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z0_3_5H2E_4_2 : Ball := ⟨(4534819094630300182044972074441 / 12500000000000000000000000000000), (27366039047 / 100000000000000000000000000000000)⟩ +lemma Z0_3_5H2E_4_2_sound : Z0_3_5H2E_4_2.Encloses (Foundation.entropyTerm (Z0_3_5H2Value ((4,2) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z0_3_5Half_sound 2) ((4,2) : PairSlot)) Z0_3_5H2E_4_2Log_sound) (by decide +kernel) +def Z0_3_5H2E_4_3LogWitness : LogWitness := ⟨-5, 854586659763454361758666849959, 625000000000000000000000000000⟩ +def Z0_3_5H2E_4_3Log : Ball := ⟨(-315286963936676832605430276783021 / 100000000000000000000000000000000), (25410988443 / 20000000000000000000000000000000)⟩ +lemma Z0_3_5H2E_4_3Log_sound : Z0_3_5H2E_4_3Log.Encloses (Real.log (Z0_3_5H2Value ((4,3) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound ((Z0_3_5Half_sound 2) ((4,3) : PairSlot)) (w := Z0_3_5H2E_4_3LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z0_3_5H2E_4_3 : Ball := ⟨(2694400333776053497620803489567 / 20000000000000000000000000000000), (108579459 / 2000000000000000000000000000000)⟩ +lemma Z0_3_5H2E_4_3_sound : Z0_3_5H2E_4_3.Encloses (Foundation.entropyTerm (Z0_3_5H2Value ((4,3) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z0_3_5Half_sound 2) ((4,3) : PairSlot)) Z0_3_5H2E_4_3Log_sound) (by decide +kernel) +def Z0_3_5H2E_5_1LogWitness : LogWitness := ⟨-6, 1324789218043180893556977378811, 781250000000000000000000000000⟩ +def Z0_3_5H2E_5_1Log : Ball := ⟨(-363076963936676832605430257687637 / 100000000000000000000000000000000), (29646153209 / 20000000000000000000000000000000)⟩ +lemma Z0_3_5H2E_5_1Log_sound : Z0_3_5H2E_5_1Log.Encloses (Real.log (Z0_3_5H2Value ((5,1) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound ((Z0_3_5Half_sound 2) ((5,1) : PairSlot)) (w := Z0_3_5H2E_5_1LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z0_3_5H2E_5_1 : Ball := ⟨(9620008942863245806376100207999 / 100000000000000000000000000000000), (3927490439 / 100000000000000000000000000000000)⟩ +lemma Z0_3_5H2E_5_1_sound : Z0_3_5H2E_5_1.Encloses (Foundation.entropyTerm (Z0_3_5H2Value ((5,1) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z0_3_5Half_sound 2) ((5,1) : PairSlot)) Z0_3_5H2E_5_1Log_sound) (by decide +kernel) +def Z0_3_5H2Terms (a : PairSlot) : Ball := + match a.1.val, a.2.val with + | 1, 5 => ⟨(9620008942863245806376100207999 / 100000000000000000000000000000000), (3927490439 / 100000000000000000000000000000000)⟩ + | 2, 4 => ⟨(4534819094630300182044972074441 / 12500000000000000000000000000000), (27366039047 / 100000000000000000000000000000000)⟩ + | 3, 4 => ⟨(2694400333776053497620803489567 / 20000000000000000000000000000000), (108579459 / 2000000000000000000000000000000)⟩ + | 4, 2 => ⟨(4534819094630300182044972074441 / 12500000000000000000000000000000), (27366039047 / 100000000000000000000000000000000)⟩ + | 4, 3 => ⟨(2694400333776053497620803489567 / 20000000000000000000000000000000), (108579459 / 2000000000000000000000000000000)⟩ + | 5, 1 => ⟨(9620008942863245806376100207999 / 100000000000000000000000000000000), (3927490439 / 100000000000000000000000000000000)⟩ + | _, _ => (.exact 0) +lemma Z0_3_5H2Terms_sound (a : PairSlot) : + (Z0_3_5H2Terms a).Encloses (Foundation.entropyTerm (Z0_3_5H2Value a)) := by + rcases a with ⟨i,j⟩ + revert j i + apply forall_fin6 + · exact forall_fin6 (entropyTerm_zero_ball ((Z0_3_5Half_sound 2) ((0,0) : PairSlot))) (entropyTerm_zero_ball ((Z0_3_5Half_sound 2) ((0,1) : PairSlot))) (entropyTerm_zero_ball ((Z0_3_5Half_sound 2) ((0,2) : PairSlot))) (entropyTerm_zero_ball ((Z0_3_5Half_sound 2) ((0,3) : PairSlot))) (entropyTerm_zero_ball ((Z0_3_5Half_sound 2) ((0,4) : PairSlot))) (entropyTerm_zero_ball ((Z0_3_5Half_sound 2) ((0,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z0_3_5Half_sound 2) ((1,0) : PairSlot))) (entropyTerm_zero_ball ((Z0_3_5Half_sound 2) ((1,1) : PairSlot))) (entropyTerm_zero_ball ((Z0_3_5Half_sound 2) ((1,2) : PairSlot))) (entropyTerm_zero_ball ((Z0_3_5Half_sound 2) ((1,3) : PairSlot))) (entropyTerm_zero_ball ((Z0_3_5Half_sound 2) ((1,4) : PairSlot))) Z0_3_5H2E_1_5_sound + · exact forall_fin6 (entropyTerm_zero_ball ((Z0_3_5Half_sound 2) ((2,0) : PairSlot))) (entropyTerm_zero_ball ((Z0_3_5Half_sound 2) ((2,1) : PairSlot))) (entropyTerm_zero_ball ((Z0_3_5Half_sound 2) ((2,2) : PairSlot))) (entropyTerm_zero_ball ((Z0_3_5Half_sound 2) ((2,3) : PairSlot))) Z0_3_5H2E_2_4_sound (entropyTerm_zero_ball ((Z0_3_5Half_sound 2) ((2,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z0_3_5Half_sound 2) ((3,0) : PairSlot))) (entropyTerm_zero_ball ((Z0_3_5Half_sound 2) ((3,1) : PairSlot))) (entropyTerm_zero_ball ((Z0_3_5Half_sound 2) ((3,2) : PairSlot))) (entropyTerm_zero_ball ((Z0_3_5Half_sound 2) ((3,3) : PairSlot))) Z0_3_5H2E_3_4_sound (entropyTerm_zero_ball ((Z0_3_5Half_sound 2) ((3,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z0_3_5Half_sound 2) ((4,0) : PairSlot))) (entropyTerm_zero_ball ((Z0_3_5Half_sound 2) ((4,1) : PairSlot))) Z0_3_5H2E_4_2_sound Z0_3_5H2E_4_3_sound (entropyTerm_zero_ball ((Z0_3_5Half_sound 2) ((4,4) : PairSlot))) (entropyTerm_zero_ball ((Z0_3_5Half_sound 2) ((4,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z0_3_5Half_sound 2) ((5,0) : PairSlot))) Z0_3_5H2E_5_1_sound (entropyTerm_zero_ball ((Z0_3_5Half_sound 2) ((5,2) : PairSlot))) (entropyTerm_zero_ball ((Z0_3_5Half_sound 2) ((5,3) : PairSlot))) (entropyTerm_zero_ball ((Z0_3_5Half_sound 2) ((5,4) : PairSlot))) (entropyTerm_zero_ball ((Z0_3_5Half_sound 2) ((5,5) : PairSlot))) +def Z0_3_5H2Entropy : Ball := ⟨(29685281684392957375419947125681 / 25000000000000000000000000000000), (9180625609 / 12500000000000000000000000000000)⟩ +lemma Z0_3_5H2Entropy_sound : Z0_3_5H2Entropy.Encloses (Foundation.finiteEntropy Z0_3_5H2Value) := by + exact contains_sound (entropyPair_enclosed Z0_3_5H2Value Z0_3_5H2Terms Z0_3_5H2Terms_sound) (by decide +kernel) +def Z0_3_5H2Mass : Ball := ⟨1, (99 / 50000000000000000000000000000000)⟩ +lemma Z0_3_5H2Mass_sound : Z0_3_5H2Mass.Encloses (∑ a, Z0_3_5H2Value a) := by + exact contains_sound (pairSumBall_sound (Z0_3_5Half 2) Z0_3_5H2Value (Z0_3_5Half_sound 2)) (by decide +kernel) +def Z0_3_5H2MassTermLogWitness : LogWitness := ⟨0, 1, 1⟩ +def Z0_3_5H2MassTermLog : Ball := ⟨0, (529395597 / 2500000000000000000000000000000)⟩ +lemma Z0_3_5H2MassTermLog_sound : Z0_3_5H2MassTermLog.Encloses (Real.log ((∑ a, Z0_3_5H2Value a))) := by + exact checkLog_sound logTwoBall_sound (Z0_3_5H2Mass_sound) (w := Z0_3_5H2MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z0_3_5H2MassTerm : Ball := ⟨0, (21175823881 / 100000000000000000000000000000000)⟩ +lemma Z0_3_5H2MassTerm_sound : Z0_3_5H2MassTerm.Encloses (Foundation.entropyTerm ((∑ a, Z0_3_5H2Value a))) := by + exact contains_sound (entropyTerm_ball (Z0_3_5H2Mass_sound) Z0_3_5H2MassTermLog_sound) (by decide +kernel) +def Z0_3_5H2H : Ball := ⟨(29685281684392957375419947125681 / 25000000000000000000000000000000), (94620828753 / 100000000000000000000000000000000)⟩ +lemma Z0_3_5H2H_sound : Z0_3_5H2H.Encloses (homogeneousEntropy Z0_3_5H2Value) := by + exact contains_sound (homogeneous_enclosed Z0_3_5H2Value Z0_3_5H2MassTerm_sound Z0_3_5H2Entropy_sound) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/Certificates/Four0_4_4.lean b/lean/OAI/LinearAlgebra/MatrixFields/Certificates/Four0_4_4.lean new file mode 100644 index 0000000000000000000000000000000000000000..abdae23e63afdded313918c14a6f5d2c5e4c4ac2 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/Certificates/Four0_4_4.lean @@ -0,0 +1,1378 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Certificates.Four0_3_5 + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate +open scoped BigOperators +def w100Trace : List Ball := [ + ⟨(97363808048856985660165450324797 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(24669008783652023299422619489561 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(49557697616728292986202720009597 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(8277971847405909721320013857111 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1036125599296733877895790875611 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(829636943913202670104224184279 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(69180290937057681209201526347 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(9887603504943763630568931009 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(618204060192434284275661 / 25000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(137419382645792895122512207 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(27490539647607580977378537 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(312455615292126214428737 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(52084839931333836241107 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(8014226755796370619681 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1145034983417882232977 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(76343950594090103019 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w100S0 : Ball := ⟨(47398555588873341724686046775559 / 50000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +def w100S1 : Ball := ⟨(89864922876460651932578619425867 / 100000000000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ +def w100S2 : Ball := ⟨(5047315227245138132602455108267 / 6250000000000000000000000000000), (3 / 25000000000000000000000000000000)⟩ +def w100S3 : Ball := ⟨(16304250242035609848233936841687 / 25000000000000000000000000000000), (1 / 5000000000000000000000000000000)⟩ +def w100S4 : Ball := ⟨(42532572152786918770779642257387 / 100000000000000000000000000000000), (27 / 100000000000000000000000000000000)⟩ +def w100S5 : Ball := ⟨(18090196939320252698965158083619 / 100000000000000000000000000000000), (3 / 12500000000000000000000000000000)⟩ +abbrev w100 : Ball := w100S5 +lemma w100_sound : w100.Encloses (weight (-17098) : ℝ) := by + exact weight_enclosed_of_trace (-17098) w100Trace w100S0 w100S1 w100S2 w100S3 w100S4 w100S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def w101Trace : List Ball := [ + ⟨(3895599123548468284740572794943 / 4000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(49344618433903682032105496895659 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(3097632357775341925532331817753 / 6250000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(8278525829507818815695444470319 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1036181095602306844152453985853 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(103709248528603521478675284201 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(34591469734185622156975632523 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(19775869630963970638737423483 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(494577981753009617233388509 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(274846135646728491105893797 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(6872802487348840077319109 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2499700799830994901321347 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(20834365924809551918189 / 10000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(16028760698020866745539 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(229011093376800501783 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4771577192413948883 / 6250000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w101S0 : Ball := ⟨(94848078321197464170988729902259 / 100000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +def w101S1 : Ball := ⟨(1405649681441251308336265589321 / 1562500000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ +def w101S2 : Ball := ⟨(40465429031647053471787242492501 / 50000000000000000000000000000000), (11 / 100000000000000000000000000000000)⟩ +def w101S3 : Ball := ⟨(65498037868610567665806252872733 / 100000000000000000000000000000000), (9 / 50000000000000000000000000000000)⟩ +def w101S4 : Ball := ⟨(21449964823189719768081407158467 / 50000000000000000000000000000000), (3 / 12500000000000000000000000000000)⟩ +def w101S5 : Ball := ⟨(18404039636643055441287351883573 / 100000000000000000000000000000000), (21 / 100000000000000000000000000000000)⟩ +abbrev w101 : Ball := w101S5 +lemma w101_sound : w101.Encloses (weight (-16926) : ℝ) := by + exact weight_enclosed_of_trace (-16926) w101Trace w101S0 w101S1 w101S2 w101S3 w101S4 w101S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def w102Trace : List Ball := [ + ⟨(60878913648034409468052631867 / 62500000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(98697450764775831185808012854031 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(49564867741451218329441213711879 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1034858810984676070060732001001 / 6250000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4144862487875837400842557608431 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(41484851733547565632409171981 / 5000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(138369174381621573131335512017 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(9888140931419290232301599329 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(3956697182567992423080141 / 160000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(137425360437312930472833923 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(5498325390916810406557127 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1249867780996989019973771 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(52086583508592306868843 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(16028951802100474624337 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(572534104926856056703 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(19086508536872422661 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w102S0 : Ball := ⟨(47439899225149827711648009783193 / 50000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +def w102S1 : Ball := ⟨(45010880769847424474168206678323 / 50000000000000000000000000000000), (7 / 100000000000000000000000000000000)⟩ +def w102S2 : Ball := ⟨(4051958775354841350593506941473 / 5000000000000000000000000000000), (7 / 50000000000000000000000000000000)⟩ +def w102S3 : Ball := ⟨(16418369917175105673666336203141 / 25000000000000000000000000000000), (3 / 12500000000000000000000000000000)⟩ +def w102S4 : Ball := ⟨(8626011863590415562837422362351 / 20000000000000000000000000000000), (1 / 3125000000000000000000000000000)⟩ +def w102S5 : Ball := ⟨(18602020167700648516904861253201 / 100000000000000000000000000000000), (7 / 25000000000000000000000000000000)⟩ +abbrev w102 : Ball := w102S5 +lemma w102_sound : w102.Encloses (weight (-16819) : ℝ) := by + exact weight_enclosed_of_trace (-16819) w102Trace w102S0 w102S1 w102S2 w102S3 w102S4 w102S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def w103Trace : List Ball := [ + ⟨(97461677405583320429892784906173 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(24681350052061302413683039502419 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(24787112328260887905542961829461 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(16560086285388239495898441707087 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2072666181045074120074870073867 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(414887721937763384103098514643 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(6919019304151326895676799119 / 5000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(19777684336183811864227296597 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2473091659377625013244781297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(137433160130880981787953733 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(27493045638531965225528077 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2499853825008342345713443 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(208355433784922537024077 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(16029601945026421849607 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4580446247079516223 / 400000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(7634875247522248597 / 10000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w103S0 : Ball := ⟨(94987785627099903091492533052489 / 100000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ +def w103S1 : Ball := ⟨(45113397091699434650026722873749 / 50000000000000000000000000000000), (1 / 20000000000000000000000000000000)⟩ +def w103S2 : Ball := ⟨(40704371943067100169864190687187 / 50000000000000000000000000000000), (1 / 10000000000000000000000000000000)⟩ +def w103S3 : Ball := ⟨(66273835811181925431687419899547 / 100000000000000000000000000000000), (17 / 100000000000000000000000000000000)⟩ +def w103S4 : Ball := ⟨(43922213131274998201000278230563 / 100000000000000000000000000000000), (23 / 100000000000000000000000000000000)⟩ +def w103S5 : Ball := ⟨(19291608063491458823510272196767 / 100000000000000000000000000000000), (21 / 100000000000000000000000000000000)⟩ +abbrev w103 : Ball := w103S5 +lemma w103_sound : w103.Encloses (weight (-16455) : ℝ) := by + exact weight_enclosed_of_trace (-16455) w103Trace w103S0 w103S1 w103S2 w103S3 w103S4 w103S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def w104Trace : List Ball := [ + ⟨(24367056458004436300887556459291 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(98728702626653855089437939569527 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(49575330181667849302931920271901 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(16560363376345140514475446379693 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2072693937538896459979922729193 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(829784707340921148693978387759 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(138381710647318923299242332883 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(9888925012331768747678401287 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1236555039849939546370309859 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(137434081576428291290061171 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1099728529567358823028379 / 4000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2499867796321523835158437 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(208356508804213203871251 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(3205935750175274059761 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(572558341608467961737 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(76349073596355755747 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w104S0 : Ball := ⟨(95000550468412112792381367549949 / 100000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +def w104S1 : Ball := ⟨(22562761473253292258216097161543 / 25000000000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ +def w104S2 : Ball := ⟨(16290502569565538410855641806651 / 20000000000000000000000000000000), (3 / 25000000000000000000000000000000)⟩ +def w104S3 : Ball := ⟨(33172559246127676203892981796617 / 50000000000000000000000000000000), (1 / 5000000000000000000000000000000)⟩ +def w104S4 : Ball := ⟨(687761679336156738369940581373 / 1562500000000000000000000000000), (27 / 100000000000000000000000000000000)⟩ +def w104S5 : Ball := ⟨(19374740584992378334820330188889 / 100000000000000000000000000000000), (3 / 12500000000000000000000000000000)⟩ +abbrev w104 : Ball := w104S5 +lemma w104_sound : w104.Encloses (weight (-16412) : ℝ) := by + exact weight_enclosed_of_trace (-16412) w104Trace w104S0 w104S1 w104S2 w104S3 w104S4 w104S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def w105Trace : List Ball := [ + ⟨(779916394708736003084630050167 / 800000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1974789114185250434156337250049 / 2000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(49578929822516353674852998920349 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4140316396102717061425772661271 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(829113724726044609349663886589 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(207453717172503637348547037581 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(138386023336038699671393628681 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(19778389492632810914267854783 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1236585027276899814619765151 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(274874163419096538471127961 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(68734397321766770348597 / 250000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(15624458033230706272989 / 625000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(26045001117300264636043 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(200374110264932499389 / 1250000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(286283339498669107889 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1192970611047222117 / 1562500000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w105S0 : Ball := ⟨(1485033160975275615600053254807 / 1562500000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +def w105S1 : Ball := ⟨(90330050117477124487665552944853 / 100000000000000000000000000000000), (7 / 100000000000000000000000000000000)⟩ +def w105S2 : Ball := ⟨(81595179542259290714549823394629 / 100000000000000000000000000000000), (13 / 100000000000000000000000000000000)⟩ +def w105S3 : Ball := ⟨(66577733245335290745785998548529 / 100000000000000000000000000000000), (11 / 50000000000000000000000000000000)⟩ +def w105S4 : Ball := ⟨(44325945640870240256900270583241 / 100000000000000000000000000000000), (3 / 10000000000000000000000000000000)⟩ +def w105S5 : Ball := ⟨(1227993410598364658901849609783 / 6250000000000000000000000000000), (27 / 100000000000000000000000000000000)⟩ +abbrev w105 : Ball := w105S5 +lemma w105_sound : w105.Encloses (weight (-16272) : ℝ) := by + exact weight_enclosed_of_trace (-16272) w105Trace w105S0 w105S1 w105S2 w105S3 w105S4 w105S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def w106Trace : List Ball := [ + ⟨(6093334849905789442156207233017 / 6250000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(98741376067256485032340612661157 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(49579572656850469582200276780919 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(331228534025604071387730485889 / 2000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2072800450770492468126150003653 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(829820254843128421566729980361 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(138386793483790455507241084659 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(3955697165790575050835165963 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2473180764624746108566604101 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1374376174601400906221137 / 500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(13746928187677238261257689 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1249960704256325574778183 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(208360633973857689866493 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(8014986738687510075361 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(286284083920422957299 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(7635030580535551187 / 10000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w106S0 : Ball := ⟨(9504954775827560844624340219581 / 10000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +def w106S1 : Ball := ⟨(90344165290527157429115168254217 / 100000000000000000000000000000000), (7 / 100000000000000000000000000000000)⟩ +def w106S2 : Ball := ⟨(40810341010210459899599711666827 / 50000000000000000000000000000000), (7 / 50000000000000000000000000000000)⟩ +def w106S3 : Ball := ⟨(16654839333696657006432334846111 / 25000000000000000000000000000000), (3 / 12500000000000000000000000000000)⟩ +def w106S4 : Ball := ⟨(44381387716999888946266223964909 / 100000000000000000000000000000000), (33 / 100000000000000000000000000000000)⟩ +def w106S5 : Ball := ⟨(19697075756866686146513677305887 / 100000000000000000000000000000000), (3 / 10000000000000000000000000000000)⟩ +abbrev w106 : Ball := w106S5 +lemma w106_sound : w106.Encloses (weight (-16247) : ℝ) := by + exact weight_enclosed_of_trace (-16247) w106Trace w106S0 w106S1 w106S2 w106S3 w106S4 w106S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def w107Trace : List Ball := [ + ⟨(48747288136539656265494084659123 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(98741990592354207781733581890681 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(49579778366482358500554688710143 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(16561478259208729579715452029597 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4145611230560978856381388492169 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(829821978424792079720304925103 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(138387039932656094115289196819 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(19778516656751564450015575127 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1236592095932544020211977867 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(68718894450565855594093199 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2749388755841553392993741 / 10000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2499924007945581777002379 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(104180416992969527736073 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2003748470925226035863 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1145137288544617278939 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(9543795693602770839 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w107S0 : Ball := ⟨(95051924026672796537326677897943 / 100000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +def w107S1 : Ball := ⟨(90348682611723772593783151765771 / 100000000000000000000000000000000), (7 / 100000000000000000000000000000000)⟩ +def w107S2 : Ball := ⟨(81628844496739975780380322680573 / 100000000000000000000000000000000), (13 / 100000000000000000000000000000000)⟩ +def w107S3 : Ball := ⟨(66632682538729562298314907798171 / 100000000000000000000000000000000), (11 / 50000000000000000000000000000000)⟩ +def w107S4 : Ball := ⟨(44399143823071155074751540684837 / 100000000000000000000000000000000), (3 / 10000000000000000000000000000000)⟩ +def w107S5 : Ball := ⟨(3942567944443515008248530009517 / 20000000000000000000000000000000), (27 / 100000000000000000000000000000000)⟩ +abbrev w107 : Ball := w107S5 +lemma w107_sound : w107.Encloses (weight (-16239) : ℝ) := by + exact weight_enclosed_of_trace (-16239) w107Trace w107S0 w107S1 w107S2 w107S3 w107S4 w107S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def w108Trace : List Ball := [ + ⟨(3899917108269645427163782122097 / 4000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(49371840281361323468566505717711 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(49580344074582596055674457749879 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1656162004483804183069291731377 / 10000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1036409908896835034580988867453 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(207456679576508881718800733597 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(69193858835499664956633635233 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(19778601433638635037173077051 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2473193616820126343198087539 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(274876520731728552785691713 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(27493973312167872820136069 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2499931156411877212160093 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(813911656332038192193 / 390625000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(16030027065098110504007 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(71571244307835223249 / 6250000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(76350529843355467529 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w108S0 : Ball := ⟨(95058459071089208081579451801823 / 100000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +def w108S1 : Ball := ⟨(45180553204849710742921267271791 / 50000000000000000000000000000000), (7 / 100000000000000000000000000000000)⟩ +def w108S2 : Ball := ⟨(40825647757925109369477027461183 / 50000000000000000000000000000000), (13 / 100000000000000000000000000000000)⟩ +def w108S3 : Ball := ⟨(33334670297083510191195896164257 / 50000000000000000000000000000000), (11 / 50000000000000000000000000000000)⟩ +def w108S4 : Ball := ⟨(22224004876305232751778324710039 / 50000000000000000000000000000000), (3 / 10000000000000000000000000000000)⟩ +def w108S5 : Ball := ⟨(1234765981855096909259414847717 / 6250000000000000000000000000000), (27 / 100000000000000000000000000000000)⟩ +abbrev w108 : Ball := w108S5 +lemma w108_sound : w108.Encloses (weight (-16217) : ℝ) := by + exact weight_enclosed_of_trace (-16217) w108Trace w108S0 w108S1 w108S2 w108S3 w108S4 w108S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def w109Trace : List Ball := [ + ⟨(97507525631389871537318249775667 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1234356502964035390705336250753 / 1250000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(49581964110522966193313356533743 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(16562026078079833866500669704371 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1036430244762489044605640334733 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(165968058371854803469449173579 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(138389658499316716051502902103 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(9889422103695388632135432177 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(38644071981592178760929483 / 1562500000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(137439610485689598230468101 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(687355472061121767623613 / 2500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2499951627228721460455087 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(52090739784082377616681 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(16030139600405272269499 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1145147412805440827763 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(19087750080788843603 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w109S0 : Ball := ⟨(47538587773780763829984326129127 / 50000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +def w109S1 : Ball := ⟨(90396693101018316770119866638629 / 100000000000000000000000000000000), (7 / 100000000000000000000000000000000)⟩ +def w109S2 : Ball := ⟨(16343124247199385094190509277069 / 20000000000000000000000000000000), (7 / 50000000000000000000000000000000)⟩ +def w109S3 : Ball := ⟨(66774427539849116935937584105619 / 100000000000000000000000000000000), (3 / 12500000000000000000000000000000)⟩ +def w109S4 : Ball := ⟨(2786765108296600119464703018341 / 6250000000000000000000000000000), (33 / 100000000000000000000000000000000)⟩ +def w109S5 : Ball := ⟨(1242569563011097822718992583849 / 6250000000000000000000000000000), (3 / 10000000000000000000000000000000)⟩ +abbrev w109 : Ball := w109S5 +lemma w109_sound : w109.Encloses (weight (-16154) : ℝ) := by + exact weight_enclosed_of_trace (-16154) w109Trace w109S0 w109S1 w109S2 w109S3 w109S4 w109S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def w110Trace : List Ball := [ + ⟨(24389263436545781482875278548833 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(49386745923393752095498354759849 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(49590322702381535015610961361651 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(16564120947363547287193425266481 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(518267581290640618981572557639 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(829910320208901224399214830679 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(138399671466078066702624404489 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4945024173967499513697485881 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(309169981173002539901832421 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(274893151545536501984938507 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(27495485777139358519565267 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2500057235566401232858267 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(41674217016529314221291 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(16030720163120093424319 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(286296531192329775209 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(76353427401488227381 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w110S0 : Ball := ⟨(47586893678178315425997572795663 / 50000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +def w110S1 : Ball := ⟨(22645124499382473221202193438177 / 25000000000000000000000000000000), (7 / 100000000000000000000000000000000)⟩ +def w110S2 : Ball := ⟨(41024133087402584673956860758699 / 50000000000000000000000000000000), (7 / 50000000000000000000000000000000)⟩ +def w110S3 : Ball := ⟨(16829794955729195240555475917429 / 25000000000000000000000000000000), (3 / 12500000000000000000000000000000)⟩ +def w110S4 : Ball := ⟨(22659359860151029182956227654751 / 50000000000000000000000000000000), (33 / 100000000000000000000000000000000)⟩ +def w110S5 : Ball := ⟨(20537863570872946752478267677131 / 100000000000000000000000000000000), (31 / 100000000000000000000000000000000)⟩ +abbrev w110 : Ball := w110S5 +lemma w110_sound : w110.Encloses (weight (-15829) : ℝ) := by + exact weight_enclosed_of_trace (-15829) w110Trace w110S0 w110S1 w110S2 w110S3 w110S4 w110S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def w111Trace : List Ball := [ + ⟨(24397686808340299350437115437549 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(24697619340223501776028070218387 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(6199500969277257282868883272437 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4141386425237742050732279041557 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4146426067276205586368036922141 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(414978972638874019449097786283 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(27681296201622096854025716187 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(19780948468617308816414472731 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2473454542389849448561644689 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(274902625069429427719694161 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(27496347326682882865362643 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(625032263485471934338049 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(208376611062394265628489 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(8015557484094806019717 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1145212450312765144373 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(381775389073772837 / 500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w111S0 : Ball := ⟨(95239539455657962049596314293829 / 100000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +def w111S1 : Ball := ⟨(90705698757258297021902745980781 / 100000000000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ +def w111S2 : Ball := ⟨(10284404733803111710957685166399 / 12500000000000000000000000000000), (3 / 25000000000000000000000000000000)⟩ +def w111S3 : Ball := ⟨(33846073833174992976719001278833 / 50000000000000000000000000000000), (1 / 5000000000000000000000000000000)⟩ +def w111S4 : Ball := ⟨(11455567139207329623096061572967 / 25000000000000000000000000000000), (7 / 25000000000000000000000000000000)⟩ +def w111S5 : Ball := ⟨(20996802956941888344896637178211 / 100000000000000000000000000000000), (27 / 100000000000000000000000000000000)⟩ +abbrev w111 : Ball := w111S5 +lemma w111_sound : w111.Encloses (weight (-15608) : ℝ) := by + exact weight_enclosed_of_trace (-15608) w111Trace w111S0 w111S1 w111S2 w111S3 w111S4 w111S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def w112Trace : List Ball := [ + ⟨(2440744783513884815630487181939 / 2500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(98810157767362475238374683582699 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(155008107430631157064267381097 / 312500000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(662687853587126193950079081121 / 4000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1036689181745824053305780496531 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(830013118639727084670961148193 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(138414369717821726414682027739 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(19781935219058362655835795723 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1236782120093353079843129093 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(274913599667493446332487519 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(13748672691307143159680527 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(625053062757731455927721 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(208383012537615582879683 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(16031572321642810314461 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1145242946484806041943 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(38178494802843761177 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w112S0 : Ball := ⟨(95315761572003847278242151901881 / 100000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +def w112S1 : Ball := ⟨(90850944040510853236952602027213 / 100000000000000000000000000000000), (7 / 100000000000000000000000000000000)⟩ +def w112S2 : Ball := ⟨(82538940330520345192863283848431 / 100000000000000000000000000000000), (7 / 50000000000000000000000000000000)⟩ +def w112S3 : Ball := ⟨(68126766708851979905497606139467 / 100000000000000000000000000000000), (3 / 12500000000000000000000000000000)⟩ +def w112S4 : Ball := ⟨(5801570427752928037235255587489 / 12500000000000000000000000000000), (17 / 50000000000000000000000000000000)⟩ +def w112S5 : Ball := ⟨(21541260434033467135061329885171 / 100000000000000000000000000000000), (1 / 3125000000000000000000000000000)⟩ +abbrev w112 : Ball := w112S5 +lemma w112_sound : w112.Encloses (weight (-15352) : ℝ) := by + exact weight_enclosed_of_trace (-15352) w112Trace w112S0 w112S1 w112S2 w112S3 w112S4 w112S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def w113Trace : List Ball := [ + ⟨(97656338048605712805937164589279 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(24705884320930685930297382113281 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(49607071973741205589583725787371 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(3313663681718650977288384452269 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(518372687170440269994699724981 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(166010124575207330264910722941 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(6920986601231639496702529721 / 5000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(19782605950975315001746505477 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1236819402704467373193081867 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(8591283106859154492021341 / 3125000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(6874505946669788176468889 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(500053760394153193784799 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(208387363748832619052453 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(8015941596486930866217 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1145263675224788170587 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(3054331561043490607 / 4000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w113S0 : Ball := ⟨(47683801805317779196887858105789 / 50000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +def w113S1 : Ball := ⟨(90949798184353083940376255242911 / 100000000000000000000000000000000), (7 / 100000000000000000000000000000000)⟩ +def w113S2 : Ball := ⟨(41359328948872777620472942375029 / 50000000000000000000000000000000), (13 / 100000000000000000000000000000000)⟩ +def w113S3 : Ball := ⟨(34211881822021315602238959736387 / 50000000000000000000000000000000), (11 / 50000000000000000000000000000000)⟩ +def w113S4 : Ball := ⟨(9363622862431620267308228420527 / 20000000000000000000000000000000), (31 / 100000000000000000000000000000000)⟩ +def w113S5 : Ball := ⟨(2191935827746303246238151343337 / 10000000000000000000000000000000), (3 / 10000000000000000000000000000000)⟩ +abbrev w113 : Ball := w113S5 +lemma w113_sound : w113.Encloses (weight (-15178) : ℝ) := by + exact weight_enclosed_of_trace (-15178) w113Trace w113S0 w113S1 w113S2 w113S3 w113S4 w113S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def w114Trace : List Ball := [ + ⟨(97709758464289577222673794134833 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(9885045743557260436260937103501 / 10000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(12404020117910932154201553439333 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(3314115162503556585433277519661 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4147433683253681769637078753133 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(830126071237546135617498291161 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(17303814921970314085972712019 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(618248601465303751156181193 / 3125000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(6184472012961557361043611 / 250000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(274936065782884890756485777 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(5499877697105072730185399 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(50007651220309254172387 / 2000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(104198058348188160471767 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(3206501708591692245519 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(286326343276540294553 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(38180451401376707263 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w114S0 : Ball := ⟨(95471968991498086802643485933219 / 100000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +def w114S1 : Ball := ⟨(45574484315567861068174292710759 / 50000000000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ +def w114S2 : Ball := ⟨(41540672412598819398290787277163 / 50000000000000000000000000000000), (3 / 25000000000000000000000000000000)⟩ +def w114S3 : Ball := ⟨(69025098579633944746442227146727 / 100000000000000000000000000000000), (21 / 100000000000000000000000000000000)⟩ +def w114S4 : Ball := ⟨(23822321169640920082375148313019 / 50000000000000000000000000000000), (3 / 10000000000000000000000000000000)⟩ +def w114S5 : Ball := ⟨(22700119436380877386136648698619 / 100000000000000000000000000000000), (3 / 10000000000000000000000000000000)⟩ +abbrev w114 : Ball := w114S5 +lemma w114_sound : w114.Encloses (weight (-14828) : ℝ) := by + exact weight_enclosed_of_trace (-14828) w114Trace w114S0 w114S1 w114S2 w114S3 w114S4 w114S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def w115Trace : List Ball := [ + ⟨(6109331774019216187232330970433 / 6250000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(98870384655311019475662767709953 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(49622748342435825078991603104561 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(16572246608625983214041733343471 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4147768353767410919071818714061 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(207545477649867500526849640809 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(17304812870414338532142330141 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1978495383124961248679789739 / 10000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(309237476945452854929631139 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2749471714509358464953089 / 1000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(3437549805329453114224957 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1250233374430986093929039 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(104201297158617659899957 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(16032971331266991214199 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(286334057844721094857 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(38181418498743182523 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w115S0 : Ball := ⟨(95549272896104404998317042425223 / 100000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +def w115S1 : Ball := ⟨(45648317754871159350839069576171 / 50000000000000000000000000000000), (7 / 100000000000000000000000000000000)⟩ +def w115S2 : Ball := ⟨(20837689138496855222396993476761 / 25000000000000000000000000000000), (7 / 50000000000000000000000000000000)⟩ +def w115S3 : Ball := ⟨(69473486181220769981767628112183 / 100000000000000000000000000000000), (3 / 12500000000000000000000000000000)⟩ +def w115S4 : Ball := ⟨(24132826410861366426580373032973 / 50000000000000000000000000000000), (17 / 50000000000000000000000000000000)⟩ +def w115S5 : Ball := ⟨(1455983276441919752492185641891 / 6250000000000000000000000000000), (17 / 50000000000000000000000000000000)⟩ +abbrev w115 : Ball := w115S5 +lemma w115_sound : w115.Encloses (weight (-14569) : ℝ) := by + exact weight_enclosed_of_trace (-14569) w115Trace w115S0 w115S1 w115S2 w115S3 w115S4 w115S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def w116Trace : List Ball := [ + ⟨(19557285924324712926249365025373 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(61805678580941934071008652049 / 62500000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(49629005522508691280688280177571 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(16573814434904200778968357277313 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4148082390616932020586207537771 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(207558576571097541035422352601 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(138445994089322091487652566983 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(9892945404256259136927475221 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(154625248519678894279825211 / 6250000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(137478795898206902201990313 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(5500269214084397009901469 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(312568217584283697054161 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(208408672116255248222151 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1603340555301372363313 / 10000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1145365184772456959947 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(76364651705286005881 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w116S0 : Ball := ⟨(95621858181447385214965137983451 / 100000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ +def w116S1 : Ball := ⟨(91435397620728362399165453997559 / 100000000000000000000000000000000), (1 / 20000000000000000000000000000000)⟩ +def w116S2 : Ball := ⟨(41802159690303489377794156983269 / 50000000000000000000000000000000), (1 / 10000000000000000000000000000000)⟩ +def w116S3 : Ball := ⟨(69896822190945356758785291445181 / 100000000000000000000000000000000), (9 / 50000000000000000000000000000000)⟩ +def w116S4 : Ball := ⟨(48855657523926312626507541724637 / 100000000000000000000000000000000), (13 / 50000000000000000000000000000000)⟩ +def w116S5 : Ball := ⟨(2386875272095177720409624195233 / 10000000000000000000000000000000), (13 / 50000000000000000000000000000000)⟩ +abbrev w116 : Ball := w116S5 +lemma w116_sound : w116.Encloses (weight (-14326) : ℝ) := by + exact weight_enclosed_of_trace (-14326) w116Trace w116S0 w116S1 w116S2 w116S3 w116S4 w116S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def w117Trace : List Ball := [ + ⟨(97798653689314581510578822656451 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(6180952718476536541965961936121 / 6250000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(24815532879414074486471633234623 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(16574330643688379707729149212597 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(32407701452438213862669329661 / 781250000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(830251557133805070672131183313 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(138448460458942026054287239437 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1236637455978837104033832521 / 6250000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1237019134824037182085065389 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(274961022519985155020208423 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(5500331611950034584212441 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1250285873608709397615931 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(208410673109783283373811 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(8016774255739579801549 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1145374717055397839997 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1193207017811758661 / 1562500000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w117S0 : Ball := ⟨(4782288331721242302570610247679 / 5000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +def w117S1 : Ball := ⟨(11435140843858571428167095920533 / 12500000000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ +def w117S2 : Ball := ⟨(83687965516084813478060763696919 / 100000000000000000000000000000000), (3 / 25000000000000000000000000000000)⟩ +def w117S3 : Ball := ⟨(17509188930553502202776224057417 / 25000000000000000000000000000000), (21 / 100000000000000000000000000000000)⟩ +def w117S4 : Ball := ⟨(49051471520930767069354643160821 / 100000000000000000000000000000000), (3 / 10000000000000000000000000000000)⟩ +def w117S5 : Ball := ⟨(24060468583686820991892726149029 / 100000000000000000000000000000000), (3 / 10000000000000000000000000000000)⟩ +abbrev w117 : Ball := w117S5 +lemma w117_sound : w117.Encloses (weight (-14246) : ℝ) := by + exact weight_enclosed_of_trace (-14246) w117Trace w117S0 w117S1 w117S2 w117S3 w117S4 w117S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def w118Trace : List Ball := [ + ⟨(97837322362202445024817715127483 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(49457360401287614668643690359859 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(24818791050948803835348972321179 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(16575963323485392035540300785447 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4148512801830612729284225254077 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(830306116992390475577967845173 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(27691252171849195503950724261 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(9893587471287903817857902299 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1237073363974184443661036083 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2199774981565762138883957 / 800000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(275026447687221514793313 / 1000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2500653996197603863692723 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(52104250371677425141003 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(16034000633289866788877 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1145404863883270115771 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(76367138527085513693 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w118S0 : Ball := ⟨(95721416470055186173513887544197 / 100000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +def w118S1 : Ball := ⟨(45812947855168761291483100357037 / 50000000000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ +def w118S2 : Ball := ⟨(41976523823608240110366878898297 / 50000000000000000000000000000000), (3 / 25000000000000000000000000000000)⟩ +def w118S3 : Ball := ⟨(17620285523139501462952088387209 / 25000000000000000000000000000000), (21 / 100000000000000000000000000000000)⟩ +def w118S4 : Ball := ⟨(12418978476678379789808138734467 / 25000000000000000000000000000000), (3 / 10000000000000000000000000000000)⟩ +def w118S5 : Ball := ⟨(987078568986885443794057967137 / 4000000000000000000000000000000), (3 / 10000000000000000000000000000000)⟩ +abbrev w118 : Ball := w118S5 +lemma w118_sound : w118.Encloses (weight (-13993) : ℝ) := by + exact weight_enclosed_of_trace (-13993) w118Trace w118S0 w118S1 w118S2 w118S3 w118S4 w118S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def w119Trace : List Ball := [ + ⟨(48938385491804113902550017367019 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(49467294156925162167308983262309 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(9928845710022459786596307597303 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(16577628534992987469371364297817 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(829769264960388587826625643451 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(207590440360815173306600065951 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(3461605405253894554854686019 / 2500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2473521244896143835174069917 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(494851467702103772947575151 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(274982938103766156174816439 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1718978190295596216255561 / 6250000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(625184468949122009096099 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(208423455297972939011387 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(16034461714827266083523 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1145435608036625420927 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(76369065253885132357 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w119S0 : Ball := ⟨(19159724596355387066919815318401 / 20000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +def w119S1 : Ball := ⟨(45886880826023199983806758374853 / 50000000000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ +def w119S2 : Ball := ⟨(84224233277666223682408489638391 / 100000000000000000000000000000000), (3 / 25000000000000000000000000000000)⟩ +def w119S3 : Ball := ⟨(17734303678026846291032782597533 / 25000000000000000000000000000000), (21 / 100000000000000000000000000000000)⟩ +def w119S4 : Ball := ⟨(6290110538889530564792147807987 / 12500000000000000000000000000000), (3 / 10000000000000000000000000000000)⟩ +def w119S5 : Ball := ⟨(25321913978527449986390800664989 / 100000000000000000000000000000000), (31 / 100000000000000000000000000000000)⟩ +abbrev w119 : Ball := w119S5 +lemma w119_sound : w119.Encloses (weight (-13735) : ℝ) := by + exact weight_enclosed_of_trace (-13735) w119Trace w119S0 w119S1 w119S2 w119S3 w119S4 w119S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def w120Trace : List Ball := [ + ⟨(12238726246103792446425272336367 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(19790245135713923726645545348043 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(49649794046559958187310813393203 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(414475571790862416083067217157 / 2500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(414912558773495191509326928377 / 10000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1328653363863888276585466387 / 160000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(138470877119463177686720802817 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(9894501532378695516960392259 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(618587487387531455527602021 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(274992202789168979705630121 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(5500898712057891334618917 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(78150253267895524022093 / 3125000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(20842885877429318964939 / 10000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(16034847755617434080557 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1145461348522489241403 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(763706783274848131 / 1000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w120S0 : Ball := ⟨(95863308881324689403144852296653 / 100000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +def w120S1 : Ball := ⟨(91897739896762650732492304402069 / 100000000000000000000000000000000), (7 / 100000000000000000000000000000000)⟩ +def w120S2 : Ball := ⟨(42225972990665209240543624838329 / 50000000000000000000000000000000), (7 / 50000000000000000000000000000000)⟩ +def w120S3 : Ball := ⟨(35660655900167755098964590680273 / 50000000000000000000000000000000), (3 / 12500000000000000000000000000000)⟩ +def w120S4 : Ball := ⟨(25433647584603386474386431416807 / 50000000000000000000000000000000), (7 / 20000000000000000000000000000000)⟩ +def w120S5 : Ball := ⟨(5174963435662413399594860430483 / 20000000000000000000000000000000), (9 / 25000000000000000000000000000000)⟩ +abbrev w120 : Ball := w120S5 +lemma w120_sound : w120.Encloses (weight (-13519) : ℝ) := by + exact weight_enclosed_of_trace (-13519) w120Trace w120S0 w120S1 w120S2 w120S3 w120S4 w120S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def w121Trace : List Ball := [ + ⟨(24503779902084132319802811489177 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(618776523003186258526616489219 / 625000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(24833763715755869646733360765899 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(16583465344282351506608855089179 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1037503825227217333742487132577 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(415278391590300533313833967323 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(27698419417795194320409245731 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(618489283630141511717964669 / 3125000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2474644974468104802002671433 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(8594428634752329089684821 / 3125000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2750717744384696591237699 / 10000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2501031820505949163386381 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(104223035790762101007359 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(16036077482686008691863 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(229108668798811952593 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(76375816265617129539 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w121S0 : Ball := ⟨(48034818359182579943855409263233 / 50000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +def w121S1 : Ball := ⟨(23073437747996638417592153396739 / 25000000000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ +def w121S2 : Ball := ⟨(42590682360854094798332445616487 / 50000000000000000000000000000000), (3 / 25000000000000000000000000000000)⟩ +def w121S3 : Ball := ⟨(72558648958526725204917615031683 / 100000000000000000000000000000000), (21 / 100000000000000000000000000000000)⟩ +def w121S4 : Ball := ⟨(411309182709899330019232275643 / 781250000000000000000000000000), (31 / 100000000000000000000000000000000)⟩ +def w121S5 : Ball := ⟨(13858835970579279869466542234599 / 50000000000000000000000000000000), (33 / 100000000000000000000000000000000)⟩ +abbrev w121 : Ball := w121S5 +lemma w121_sound : w121.Encloses (weight (-12831) : ℝ) := by + exact weight_enclosed_of_trace (-12831) w121Trace w121S0 w121S1 w121S2 w121S3 w121S4 w121S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def w122Trace : List Ball := [ + ⟨(98033958699397176287538926466877 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(99013726187111046268105686276237 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(6208837349001912067323347332473 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(8292129883152746903700883606333 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(830034879306745828289827676429 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(830583324290212160782035103381 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(27699178275063746188713679093 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(9896065812279709041749913089 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(7733430391945732820497901 / 312500000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(17189187082454064119705413 / 6250000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(6876914329164376585289069 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2501071820126373882331437 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(5211228728735278783473 / 2500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(3207259470140015896057 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1145558004232174711117 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(3818836741070847387 / 5000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w122S0 : Ball := ⟨(48053285291375556500693921401103 / 50000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +def w122S1 : Ball := ⟨(92364729091773216080904413271947 / 100000000000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ +def w122S2 : Ball := ⟨(85312431801966574739646796033671 / 100000000000000000000000000000000), (3 / 25000000000000000000000000000000)⟩ +def w122S3 : Ball := ⟨(2274440943739124308348533594259 / 3125000000000000000000000000000), (21 / 100000000000000000000000000000000)⟩ +def w122S4 : Ball := ⟨(6621544456392855586937891564517 / 12500000000000000000000000000000), (31 / 100000000000000000000000000000000)⟩ +def w122S5 : Ball := ⟨(28060704632311652738271218766657 / 100000000000000000000000000000000), (33 / 100000000000000000000000000000000)⟩ +abbrev w122 : Ball := w122S5 +lemma w122_sound : w122.Encloses (weight (-12708) : ℝ) := by + exact weight_enclosed_of_trace (-12708) w122Trace w122S0 w122S1 w122S2 w122S3 w122S4 w122S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def w123Trace : List Ball := [ + ⟨(19621870256091549138729653628773 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(99051668345370232159881171244799 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2484169363797689168615137538181 / 5000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(16587438063979915007059553968821 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2075405440386421993637529740549 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(207672375819550483190663858137 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(8656941896304520532671580831 / 6250000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1237126876282123006364098207 / 6250000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1237454374744549260398127817 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(275048103189607750302716243 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(6877394240355680718493119 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2501231830421363645571343 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(52115365066250581975997 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(16037176879039260673897 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(286404162178833339819 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(38190204522308110271 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w123S0 : Ball := ⟨(48127224043361279522551499696501 / 50000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +def w123S1 : Ball := ⟨(92649187764795681075883948667669 / 100000000000000000000000000000000), (7 / 100000000000000000000000000000000)⟩ +def w123S2 : Ball := ⟨(85838719934763657304963000931437 / 100000000000000000000000000000000), (7 / 50000000000000000000000000000000)⟩ +def w123S3 : Ball := ⟨(7368285840038791695409127702851 / 10000000000000000000000000000000), (1 / 4000000000000000000000000000000)⟩ +def w123S4 : Ball := ⟨(5429163622051616219998684211497 / 10000000000000000000000000000000), (19 / 50000000000000000000000000000000)⟩ +def w123S5 : Ball := ⟨(29475817635008624691846674652017 / 100000000000000000000000000000000), (21 / 50000000000000000000000000000000)⟩ +abbrev w123 : Ball := w123S5 +lemma w123_sound : w123.Encloses (weight (-12216) : ℝ) := by + exact weight_enclosed_of_trace (-12216) w123Trace w123S0 w123S1 w123S2 w123S3 w123S4 w123S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def w124Trace : List Ball := [ + ⟨(12273790611535785076337223241083 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(19818481672429507343487628433517 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(24848504800888796237148742845051 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(16590850005333745418344383841107 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4151494118161327765764973336617 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(415401738681420969245539494861 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(138527363202814228186411696697 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(19796067683759655166444473191 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1237567625193322474929408639 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(68767690240728389751423031 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2751163734129212976761497 / 10000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(500280713963158219765633 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(208474673696414985738331 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(16038120863299332170827 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(114567959054250122191 / 10000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(15276870422683088027 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w124S0 : Ball := ⟨(24103349756131836960033683747273 / 25000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +def w124S1 : Ball := ⟨(92955435114627309480469876285961 / 100000000000000000000000000000000), (7 / 100000000000000000000000000000000)⟩ +def w124S2 : Ball := ⟨(21601782293374219611032056969617 / 25000000000000000000000000000000), (7 / 50000000000000000000000000000000)⟩ +def w124S3 : Ball := ⟨(7466191972005375343739380987529 / 10000000000000000000000000000000), (1 / 4000000000000000000000000000000)⟩ +def w124S4 : Ball := ⟨(55744022562837515480547442472997 / 100000000000000000000000000000000), (19 / 50000000000000000000000000000000)⟩ +def w124S5 : Ball := ⟨(7768490128715345018830058107081 / 25000000000000000000000000000000), (43 / 100000000000000000000000000000000)⟩ +abbrev w124 : Ball := w124S5 +lemma w124_sound : w124.Encloses (weight (-11688) : ℝ) := by + exact weight_enclosed_of_trace (-11688) w124Trace w124S0 w124S1 w124S2 w124S3 w124S4 w124S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def Z0_4_4Raw (ij : PairSlot) : Ball := + match ij.1.val, ij.2.val with + | 0, 0 => w195 + | 0, 1 => w195 + | 0, 2 => w195 + | 0, 3 => w195 + | 0, 4 => w195 + | 0, 5 => w121 + | 1, 0 => w195 + | 1, 1 => w195 + | 1, 2 => w195 + | 1, 3 => w195 + | 1, 4 => w215 + | 1, 5 => w195 + | 2, 0 => w195 + | 2, 1 => w195 + | 2, 2 => w222 + | 2, 3 => w205 + | 2, 4 => w195 + | 2, 5 => w195 + | 3, 0 => w195 + | 3, 1 => w195 + | 3, 2 => w205 + | 3, 3 => w195 + | 3, 4 => w195 + | 3, 5 => w195 + | 4, 0 => w195 + | 4, 1 => w215 + | 4, 2 => w195 + | 4, 3 => w195 + | 4, 4 => w195 + | 4, 5 => w195 + | 5, 0 => w121 + | 5, 1 => w195 + | 5, 2 => w195 + | 5, 3 => w195 + | 5, 4 => w195 + | 5, 5 => w195 + | _, _ => (.exact 0) +lemma Z0_4_4Raw_sound_0 (j : Fin 6) : + (Z0_4_4Raw (0,j)).Encloses (weight (orderedPairInteger (shape 0 4 4) 0 j) : ℝ) := by + fin_cases j + · change (Z0_4_4Raw (0,0)).Encloses (weight (orderedPairInteger (shape 0 4 4) 0 0) : ℝ) + have he : orderedPairInteger (shape 0 4 4) 0 0 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_4_4Raw (0,1)).Encloses (weight (orderedPairInteger (shape 0 4 4) 0 1) : ℝ) + have he : orderedPairInteger (shape 0 4 4) 0 1 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_4_4Raw (0,2)).Encloses (weight (orderedPairInteger (shape 0 4 4) 0 2) : ℝ) + have he : orderedPairInteger (shape 0 4 4) 0 2 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_4_4Raw (0,3)).Encloses (weight (orderedPairInteger (shape 0 4 4) 0 3) : ℝ) + have he : orderedPairInteger (shape 0 4 4) 0 3 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_4_4Raw (0,4)).Encloses (weight (orderedPairInteger (shape 0 4 4) 0 4) : ℝ) + have he : orderedPairInteger (shape 0 4 4) 0 4 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_4_4Raw (0,5)).Encloses (weight (orderedPairInteger (shape 0 4 4) 0 5) : ℝ) + have he : orderedPairInteger (shape 0 4 4) 0 5 = (-12831) := by decide +kernel + rw [he] + exact w121_sound +lemma Z0_4_4Raw_sound_1 (j : Fin 6) : + (Z0_4_4Raw (1,j)).Encloses (weight (orderedPairInteger (shape 0 4 4) 1 j) : ℝ) := by + fin_cases j + · change (Z0_4_4Raw (1,0)).Encloses (weight (orderedPairInteger (shape 0 4 4) 1 0) : ℝ) + have he : orderedPairInteger (shape 0 4 4) 1 0 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_4_4Raw (1,1)).Encloses (weight (orderedPairInteger (shape 0 4 4) 1 1) : ℝ) + have he : orderedPairInteger (shape 0 4 4) 1 1 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_4_4Raw (1,2)).Encloses (weight (orderedPairInteger (shape 0 4 4) 1 2) : ℝ) + have he : orderedPairInteger (shape 0 4 4) 1 2 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_4_4Raw (1,3)).Encloses (weight (orderedPairInteger (shape 0 4 4) 1 3) : ℝ) + have he : orderedPairInteger (shape 0 4 4) 1 3 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_4_4Raw (1,4)).Encloses (weight (orderedPairInteger (shape 0 4 4) 1 4) : ℝ) + have he : orderedPairInteger (shape 0 4 4) 1 4 = (29263) := by decide +kernel + rw [he] + exact w215_sound + · change (Z0_4_4Raw (1,5)).Encloses (weight (orderedPairInteger (shape 0 4 4) 1 5) : ℝ) + have he : orderedPairInteger (shape 0 4 4) 1 5 = (0) := by decide +kernel + rw [he] + exact w195_sound +lemma Z0_4_4Raw_sound_2 (j : Fin 6) : + (Z0_4_4Raw (2,j)).Encloses (weight (orderedPairInteger (shape 0 4 4) 2 j) : ℝ) := by + fin_cases j + · change (Z0_4_4Raw (2,0)).Encloses (weight (orderedPairInteger (shape 0 4 4) 2 0) : ℝ) + have he : orderedPairInteger (shape 0 4 4) 2 0 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_4_4Raw (2,1)).Encloses (weight (orderedPairInteger (shape 0 4 4) 2 1) : ℝ) + have he : orderedPairInteger (shape 0 4 4) 2 1 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_4_4Raw (2,2)).Encloses (weight (orderedPairInteger (shape 0 4 4) 2 2) : ℝ) + have he : orderedPairInteger (shape 0 4 4) 2 2 = (45052) := by decide +kernel + rw [he] + exact w222_sound + · change (Z0_4_4Raw (2,3)).Encloses (weight (orderedPairInteger (shape 0 4 4) 2 3) : ℝ) + have he : orderedPairInteger (shape 0 4 4) 2 3 = (22289) := by decide +kernel + rw [he] + exact w205_sound + · change (Z0_4_4Raw (2,4)).Encloses (weight (orderedPairInteger (shape 0 4 4) 2 4) : ℝ) + have he : orderedPairInteger (shape 0 4 4) 2 4 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_4_4Raw (2,5)).Encloses (weight (orderedPairInteger (shape 0 4 4) 2 5) : ℝ) + have he : orderedPairInteger (shape 0 4 4) 2 5 = (0) := by decide +kernel + rw [he] + exact w195_sound +lemma Z0_4_4Raw_sound_3 (j : Fin 6) : + (Z0_4_4Raw (3,j)).Encloses (weight (orderedPairInteger (shape 0 4 4) 3 j) : ℝ) := by + fin_cases j + · change (Z0_4_4Raw (3,0)).Encloses (weight (orderedPairInteger (shape 0 4 4) 3 0) : ℝ) + have he : orderedPairInteger (shape 0 4 4) 3 0 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_4_4Raw (3,1)).Encloses (weight (orderedPairInteger (shape 0 4 4) 3 1) : ℝ) + have he : orderedPairInteger (shape 0 4 4) 3 1 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_4_4Raw (3,2)).Encloses (weight (orderedPairInteger (shape 0 4 4) 3 2) : ℝ) + have he : orderedPairInteger (shape 0 4 4) 3 2 = (22289) := by decide +kernel + rw [he] + exact w205_sound + · change (Z0_4_4Raw (3,3)).Encloses (weight (orderedPairInteger (shape 0 4 4) 3 3) : ℝ) + have he : orderedPairInteger (shape 0 4 4) 3 3 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_4_4Raw (3,4)).Encloses (weight (orderedPairInteger (shape 0 4 4) 3 4) : ℝ) + have he : orderedPairInteger (shape 0 4 4) 3 4 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_4_4Raw (3,5)).Encloses (weight (orderedPairInteger (shape 0 4 4) 3 5) : ℝ) + have he : orderedPairInteger (shape 0 4 4) 3 5 = (0) := by decide +kernel + rw [he] + exact w195_sound +lemma Z0_4_4Raw_sound_4 (j : Fin 6) : + (Z0_4_4Raw (4,j)).Encloses (weight (orderedPairInteger (shape 0 4 4) 4 j) : ℝ) := by + fin_cases j + · change (Z0_4_4Raw (4,0)).Encloses (weight (orderedPairInteger (shape 0 4 4) 4 0) : ℝ) + have he : orderedPairInteger (shape 0 4 4) 4 0 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_4_4Raw (4,1)).Encloses (weight (orderedPairInteger (shape 0 4 4) 4 1) : ℝ) + have he : orderedPairInteger (shape 0 4 4) 4 1 = (29263) := by decide +kernel + rw [he] + exact w215_sound + · change (Z0_4_4Raw (4,2)).Encloses (weight (orderedPairInteger (shape 0 4 4) 4 2) : ℝ) + have he : orderedPairInteger (shape 0 4 4) 4 2 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_4_4Raw (4,3)).Encloses (weight (orderedPairInteger (shape 0 4 4) 4 3) : ℝ) + have he : orderedPairInteger (shape 0 4 4) 4 3 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_4_4Raw (4,4)).Encloses (weight (orderedPairInteger (shape 0 4 4) 4 4) : ℝ) + have he : orderedPairInteger (shape 0 4 4) 4 4 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_4_4Raw (4,5)).Encloses (weight (orderedPairInteger (shape 0 4 4) 4 5) : ℝ) + have he : orderedPairInteger (shape 0 4 4) 4 5 = (0) := by decide +kernel + rw [he] + exact w195_sound +lemma Z0_4_4Raw_sound_5 (j : Fin 6) : + (Z0_4_4Raw (5,j)).Encloses (weight (orderedPairInteger (shape 0 4 4) 5 j) : ℝ) := by + fin_cases j + · change (Z0_4_4Raw (5,0)).Encloses (weight (orderedPairInteger (shape 0 4 4) 5 0) : ℝ) + have he : orderedPairInteger (shape 0 4 4) 5 0 = (-12831) := by decide +kernel + rw [he] + exact w121_sound + · change (Z0_4_4Raw (5,1)).Encloses (weight (orderedPairInteger (shape 0 4 4) 5 1) : ℝ) + have he : orderedPairInteger (shape 0 4 4) 5 1 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_4_4Raw (5,2)).Encloses (weight (orderedPairInteger (shape 0 4 4) 5 2) : ℝ) + have he : orderedPairInteger (shape 0 4 4) 5 2 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_4_4Raw (5,3)).Encloses (weight (orderedPairInteger (shape 0 4 4) 5 3) : ℝ) + have he : orderedPairInteger (shape 0 4 4) 5 3 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_4_4Raw (5,4)).Encloses (weight (orderedPairInteger (shape 0 4 4) 5 4) : ℝ) + have he : orderedPairInteger (shape 0 4 4) 5 4 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_4_4Raw (5,5)).Encloses (weight (orderedPairInteger (shape 0 4 4) 5 5) : ℝ) + have he : orderedPairInteger (shape 0 4 4) 5 5 = (0) := by decide +kernel + rw [he] + exact w195_sound +lemma Z0_4_4Raw_sound (ij : PairSlot) : + (Z0_4_4Raw ij).Encloses (weight (orderedPairInteger (shape 0 4 4) ij.1 ij.2) : ℝ) := by + rcases ij with ⟨i,j⟩ + revert i + exact forall_fin6 (Z0_4_4Raw_sound_0 j) (Z0_4_4Raw_sound_1 j) (Z0_4_4Raw_sound_2 j) (Z0_4_4Raw_sound_3 j) (Z0_4_4Raw_sound_4 j) (Z0_4_4Raw_sound_5 j) +def Z0_4_4Den : Ball := ⟨(2958740185226312087148034776690749 / 20000000000000000000000000000000), (14091 / 100000000000000000000000000000000)⟩ +lemma Z0_4_4Den_sound : Z0_4_4Den.Encloses + (((orderedPairs (shape 0 4 4)).map (fun ij => weight (orderedPairInteger (shape 0 4 4) ij.1 ij.2))).sum : ℝ) := by + exact contains_sound (list_cast_enclosed (orderedPairs (shape 0 4 4)) Z0_4_4Raw + (fun ij => weight (orderedPairInteger (shape 0 4 4) ij.1 ij.2)) + (fun ij _ => Z0_4_4Raw_sound ij)) (by decide +kernel) +lemma Z0_4_4Den_pos : 0 < Z0_4_4Den.lower := by decide +kernel +def Z0_4_4Probs (ij : PairSlot) : Ball := + match ij.1.val, ij.2.val with + | 0, 5 => ⟨(7494452423922705001235812089 / 4000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 1, 4 => ⟨(1261243984157612676036813528611 / 10000000000000000000000000000000), (27 / 100000000000000000000000000000000)⟩ + | 2, 2 => ⟨(61165519013116834840287783186423 / 100000000000000000000000000000000), (7 / 6250000000000000000000000000000)⟩ + | 2, 3 => ⟨(784932206749518952016351104847 / 12500000000000000000000000000000), (7 / 50000000000000000000000000000000)⟩ + | 3, 2 => ⟨(784932206749518952016351104847 / 12500000000000000000000000000000), (7 / 50000000000000000000000000000000)⟩ + | 3, 3 => ⟨(675963374542473156652537959353 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 4, 1 => ⟨(1261243984157612676036813528611 / 10000000000000000000000000000000), (27 / 100000000000000000000000000000000)⟩ + | 5, 0 => ⟨(7494452423922705001235812089 / 4000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | _, _ => (.exact 0) +lemma Z0_4_4Contains : ∀ i j : Fin 6, + statisticWeight i + statisticWeight j = shapeMax (shape 0 4 4) → + contains (.mul (Z0_4_4Raw (i,j)) (.inv Z0_4_4Den)) (Z0_4_4Probs (i,j)) = true := by + decide +kernel +lemma Z0_4_4Zero : ∀ i j : Fin 6, + statisticWeight i + statisticWeight j ≠ shapeMax (shape 0 4 4) → Z0_4_4Probs (i,j) = .exact 0 := by + decide +kernel +lemma Z0_4_4Probs_sound (ij : PairSlot) : + (Z0_4_4Probs ij).Encloses (zeroPairLaw (shape 0 4 4) ij.1 ij.2 : ℝ) := by + by_cases h : statisticWeight ij.1 + statisticWeight ij.2 = shapeMax (shape 0 4 4) + · have hb := contains_sound (Ball.mul_sound (Z0_4_4Raw_sound ij) + (Ball.inv_sound Z0_4_4Den_sound Z0_4_4Den_pos)) (Z0_4_4Contains ij.1 ij.2 h) + simpa only [zeroPairLaw, h, ite_true, Rat.cast_div, Rat.cast_mul, + Rat.cast_inv, div_eq_mul_inv] using hb + · rw [Z0_4_4Zero ij.1 ij.2 h] + simpa only [zeroPairLaw, h, ite_false] using Ball.exact_sound 0 + +def Z0_4_4Half (w : Fin 3) (ij : PairSlot) : Ball := + if (shape 0 4 4) w = 0 then if ij = (0,0) then .exact 1 else .exact 0 + else if w = halfMaxAxis (shape 0 4 4) then Z0_4_4Probs ij + else Z0_4_4Probs (kappa ij.1, kappa ij.2) +lemma Z0_4_4Half_sound (w : Fin 3) (ij : PairSlot) : + (Z0_4_4Half w ij).Encloses (halfLaw (shape 0 4 4) w ij : ℝ) := by + have hp : positive (shape 0 4 4) = false := by decide +kernel + simp only [Z0_4_4Half, halfLaw, hp, Bool.false_eq_true, ite_false] + split_ifs + · exact Ball.exact_sound 1 + · exact Ball.exact_sound 0 + · exact Z0_4_4Probs_sound _ + · exact Z0_4_4Probs_sound _ + +def Z0_4_4Value (a : PairSlot) : ℝ := (zeroPairLaw (shape 0 4 4) a.1 a.2 : ℝ) +def Z0_4_4E_0_5LogWitness : LogWitness := ⟨-10, 7494452423922705001235812089, 3906250000000000000000000000⟩ +def Z0_4_4E_0_5Log : Ball := ⟨(-627988657006593341151923689501087 / 100000000000000000000000000000000), (232934061047 / 100000000000000000000000000000000)⟩ +lemma Z0_4_4E_0_5Log_sound : Z0_4_4E_0_5Log.Encloses (Real.log (Z0_4_4Value ((0,5) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound (Z0_4_4Probs_sound ((0,5) : PairSlot)) (w := Z0_4_4E_0_5LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z0_4_4E_0_5 : Ball := ⟨(588303889087378458388880598603 / 50000000000000000000000000000000), (109107079 / 25000000000000000000000000000000)⟩ +lemma Z0_4_4E_0_5_sound : Z0_4_4E_0_5.Encloses (Foundation.entropyTerm (Z0_4_4Value ((0,5) : PairSlot))) := by + exact contains_sound (entropyTerm_ball (Z0_4_4Probs_sound ((0,5) : PairSlot)) Z0_4_4E_0_5Log_sound) (by decide +kernel) +def Z0_4_4E_1_4LogWitness : LogWitness := ⟨-3, 1261243984157612676036813528611, 1250000000000000000000000000000⟩ +def Z0_4_4E_1_4Log : Ball := ⟨(-20704865700659334115192382203811 / 10000000000000000000000000000000), (16940658989 / 20000000000000000000000000000000)⟩ +lemma Z0_4_4E_1_4Log_sound : Z0_4_4E_1_4Log.Encloses (Real.log (Z0_4_4Value ((1,4) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound (Z0_4_4Probs_sound ((1,4) : PairSlot)) (w := Z0_4_4E_1_4LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z0_4_4E_1_4 : Ball := ⟨(26113887307747879276296106837317 / 100000000000000000000000000000000), (427326087 / 4000000000000000000000000000000)⟩ +lemma Z0_4_4E_1_4_sound : Z0_4_4E_1_4.Encloses (Foundation.entropyTerm (Z0_4_4Value ((1,4) : PairSlot))) := by + exact contains_sound (entropyTerm_ball (Z0_4_4Probs_sound ((1,4) : PairSlot)) Z0_4_4E_1_4Log_sound) (by decide +kernel) +def Z0_4_4E_2_2LogWitness : LogWitness := ⟨-1, 61165519013116834840287783186423, 50000000000000000000000000000000⟩ +def Z0_4_4E_2_2Log : Ball := ⟨(-6144832125824167643990482528629 / 12500000000000000000000000000000), (10587911887 / 25000000000000000000000000000000)⟩ +lemma Z0_4_4E_2_2Log_sound : Z0_4_4E_2_2Log.Encloses (Real.log (Z0_4_4Value ((2,2) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound (Z0_4_4Probs_sound ((2,2) : PairSlot)) (w := Z0_4_4E_2_2LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z0_4_4E_2_2 : Ball := ⟨(15034073848980370592136607206397 / 50000000000000000000000000000000), (25904605089 / 100000000000000000000000000000000)⟩ +lemma Z0_4_4E_2_2_sound : Z0_4_4E_2_2.Encloses (Foundation.entropyTerm (Z0_4_4Value ((2,2) : PairSlot))) := by + exact contains_sound (entropyTerm_ball (Z0_4_4Probs_sound ((2,2) : PairSlot)) Z0_4_4E_2_2Log_sound) (by decide +kernel) +def Z0_4_4E_2_3LogWitness : LogWitness := ⟨-4, 784932206749518952016351104847, 781250000000000000000000000000⟩ +def Z0_4_4E_2_3Log : Ball := ⟨(-17299291062912083821995237683913 / 6250000000000000000000000000000), (105879118637 / 100000000000000000000000000000000)⟩ +lemma Z0_4_4E_2_3Log_sound : Z0_4_4E_2_3Log.Encloses (Real.log (Z0_4_4Value ((2,3) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound (Z0_4_4Probs_sound ((2,3) : PairSlot)) (w := Z0_4_4E_2_3LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z0_4_4E_2_3 : Ball := ⟨(543150828368552529862213075723 / 3125000000000000000000000000000), (6648634459 / 100000000000000000000000000000000)⟩ +lemma Z0_4_4E_2_3_sound : Z0_4_4E_2_3.Encloses (Foundation.entropyTerm (Z0_4_4Value ((2,3) : PairSlot))) := by + exact contains_sound (entropyTerm_ball (Z0_4_4Probs_sound ((2,3) : PairSlot)) Z0_4_4E_2_3Log_sound) (by decide +kernel) +def Z0_4_4E_3_2LogWitness : LogWitness := ⟨-4, 784932206749518952016351104847, 781250000000000000000000000000⟩ +def Z0_4_4E_3_2Log : Ball := ⟨(-17299291062912083821995237683913 / 6250000000000000000000000000000), (105879118637 / 100000000000000000000000000000000)⟩ +lemma Z0_4_4E_3_2Log_sound : Z0_4_4E_3_2Log.Encloses (Real.log (Z0_4_4Value ((3,2) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound (Z0_4_4Probs_sound ((3,2) : PairSlot)) (w := Z0_4_4E_3_2LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z0_4_4E_3_2 : Ball := ⟨(543150828368552529862213075723 / 3125000000000000000000000000000), (6648634459 / 100000000000000000000000000000000)⟩ +lemma Z0_4_4E_3_2_sound : Z0_4_4E_3_2.Encloses (Foundation.entropyTerm (Z0_4_4Value ((3,2) : PairSlot))) := by + exact contains_sound (entropyTerm_ball (Z0_4_4Probs_sound ((3,2) : PairSlot)) Z0_4_4E_3_2Log_sound) (by decide +kernel) +def Z0_4_4E_3_3LogWitness : LogWitness := ⟨-8, 675963374542473156652537959353, 390625000000000000000000000000⟩ +def Z0_4_4E_3_3Log : Ball := ⟨(-49967865700659334115192372656099 / 10000000000000000000000000000000), (38116482659 / 20000000000000000000000000000000)⟩ +lemma Z0_4_4E_3_3Log_sound : Z0_4_4E_3_3Log.Encloses (Real.log (Z0_4_4Value ((3,3) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound (Z0_4_4Probs_sound ((3,3) : PairSlot)) (w := Z0_4_4E_3_3LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z0_4_4E_3_3 : Ball := ⟨(1688822355885139167546274512777 / 50000000000000000000000000000000), (644133659 / 50000000000000000000000000000000)⟩ +lemma Z0_4_4E_3_3_sound : Z0_4_4E_3_3.Encloses (Foundation.entropyTerm (Z0_4_4Value ((3,3) : PairSlot))) := by + exact contains_sound (entropyTerm_ball (Z0_4_4Probs_sound ((3,3) : PairSlot)) Z0_4_4E_3_3Log_sound) (by decide +kernel) +def Z0_4_4E_4_1LogWitness : LogWitness := ⟨-3, 1261243984157612676036813528611, 1250000000000000000000000000000⟩ +def Z0_4_4E_4_1Log : Ball := ⟨(-20704865700659334115192382203811 / 10000000000000000000000000000000), (16940658989 / 20000000000000000000000000000000)⟩ +lemma Z0_4_4E_4_1Log_sound : Z0_4_4E_4_1Log.Encloses (Real.log (Z0_4_4Value ((4,1) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound (Z0_4_4Probs_sound ((4,1) : PairSlot)) (w := Z0_4_4E_4_1LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z0_4_4E_4_1 : Ball := ⟨(26113887307747879276296106837317 / 100000000000000000000000000000000), (427326087 / 4000000000000000000000000000000)⟩ +lemma Z0_4_4E_4_1_sound : Z0_4_4E_4_1.Encloses (Foundation.entropyTerm (Z0_4_4Value ((4,1) : PairSlot))) := by + exact contains_sound (entropyTerm_ball (Z0_4_4Probs_sound ((4,1) : PairSlot)) Z0_4_4E_4_1Log_sound) (by decide +kernel) +def Z0_4_4E_5_0LogWitness : LogWitness := ⟨-10, 7494452423922705001235812089, 3906250000000000000000000000⟩ +def Z0_4_4E_5_0Log : Ball := ⟨(-627988657006593341151923689501087 / 100000000000000000000000000000000), (232934061047 / 100000000000000000000000000000000)⟩ +lemma Z0_4_4E_5_0Log_sound : Z0_4_4E_5_0Log.Encloses (Real.log (Z0_4_4Value ((5,0) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound (Z0_4_4Probs_sound ((5,0) : PairSlot)) (w := Z0_4_4E_5_0LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z0_4_4E_5_0 : Ball := ⟨(588303889087378458388880598603 / 50000000000000000000000000000000), (109107079 / 25000000000000000000000000000000)⟩ +lemma Z0_4_4E_5_0_sound : Z0_4_4E_5_0.Encloses (Foundation.entropyTerm (Z0_4_4Value ((5,0) : PairSlot))) := by + exact contains_sound (entropyTerm_ball (Z0_4_4Probs_sound ((5,0) : PairSlot)) Z0_4_4E_5_0Log_sound) (by decide +kernel) +def Z0_4_4Terms (a : PairSlot) : Ball := + match a.1.val, a.2.val with + | 0, 5 => ⟨(588303889087378458388880598603 / 50000000000000000000000000000000), (109107079 / 25000000000000000000000000000000)⟩ + | 1, 4 => ⟨(26113887307747879276296106837317 / 100000000000000000000000000000000), (427326087 / 4000000000000000000000000000000)⟩ + | 2, 2 => ⟨(15034073848980370592136607206397 / 50000000000000000000000000000000), (25904605089 / 100000000000000000000000000000000)⟩ + | 2, 3 => ⟨(543150828368552529862213075723 / 3125000000000000000000000000000), (6648634459 / 100000000000000000000000000000000)⟩ + | 3, 2 => ⟨(543150828368552529862213075723 / 3125000000000000000000000000000), (6648634459 / 100000000000000000000000000000000)⟩ + | 3, 3 => ⟨(1688822355885139167546274512777 / 50000000000000000000000000000000), (644133659 / 50000000000000000000000000000000)⟩ + | 4, 1 => ⟨(26113887307747879276296106837317 / 100000000000000000000000000000000), (427326087 / 4000000000000000000000000000000)⟩ + | 5, 0 => ⟨(588303889087378458388880598603 / 50000000000000000000000000000000), (109107079 / 25000000000000000000000000000000)⟩ + | _, _ => (.exact 0) +lemma Z0_4_4Terms_sound (a : PairSlot) : + (Z0_4_4Terms a).Encloses (Foundation.entropyTerm (Z0_4_4Value a)) := by + rcases a with ⟨i,j⟩ + revert j i + apply forall_fin6 + · exact forall_fin6 (entropyTerm_zero_ball (Z0_4_4Probs_sound ((0,0) : PairSlot))) (entropyTerm_zero_ball (Z0_4_4Probs_sound ((0,1) : PairSlot))) (entropyTerm_zero_ball (Z0_4_4Probs_sound ((0,2) : PairSlot))) (entropyTerm_zero_ball (Z0_4_4Probs_sound ((0,3) : PairSlot))) (entropyTerm_zero_ball (Z0_4_4Probs_sound ((0,4) : PairSlot))) Z0_4_4E_0_5_sound + · exact forall_fin6 (entropyTerm_zero_ball (Z0_4_4Probs_sound ((1,0) : PairSlot))) (entropyTerm_zero_ball (Z0_4_4Probs_sound ((1,1) : PairSlot))) (entropyTerm_zero_ball (Z0_4_4Probs_sound ((1,2) : PairSlot))) (entropyTerm_zero_ball (Z0_4_4Probs_sound ((1,3) : PairSlot))) Z0_4_4E_1_4_sound (entropyTerm_zero_ball (Z0_4_4Probs_sound ((1,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball (Z0_4_4Probs_sound ((2,0) : PairSlot))) (entropyTerm_zero_ball (Z0_4_4Probs_sound ((2,1) : PairSlot))) Z0_4_4E_2_2_sound Z0_4_4E_2_3_sound (entropyTerm_zero_ball (Z0_4_4Probs_sound ((2,4) : PairSlot))) (entropyTerm_zero_ball (Z0_4_4Probs_sound ((2,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball (Z0_4_4Probs_sound ((3,0) : PairSlot))) (entropyTerm_zero_ball (Z0_4_4Probs_sound ((3,1) : PairSlot))) Z0_4_4E_3_2_sound Z0_4_4E_3_3_sound (entropyTerm_zero_ball (Z0_4_4Probs_sound ((3,4) : PairSlot))) (entropyTerm_zero_ball (Z0_4_4Probs_sound ((3,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball (Z0_4_4Probs_sound ((4,0) : PairSlot))) Z0_4_4E_4_1_sound (entropyTerm_zero_ball (Z0_4_4Probs_sound ((4,2) : PairSlot))) (entropyTerm_zero_ball (Z0_4_4Probs_sound ((4,3) : PairSlot))) (entropyTerm_zero_ball (Z0_4_4Probs_sound ((4,4) : PairSlot))) (entropyTerm_zero_ball (Z0_4_4Probs_sound ((4,5) : PairSlot))) + · exact forall_fin6 Z0_4_4E_5_0_sound (entropyTerm_zero_ball (Z0_4_4Probs_sound ((5,1) : PairSlot))) (entropyTerm_zero_ball (Z0_4_4Probs_sound ((5,2) : PairSlot))) (entropyTerm_zero_ball (Z0_4_4Probs_sound ((5,3) : PairSlot))) (entropyTerm_zero_ball (Z0_4_4Probs_sound ((5,4) : PairSlot))) (entropyTerm_zero_ball (Z0_4_4Probs_sound ((5,5) : PairSlot))) +def Z0_4_4Entropy : Ball := ⟨(61394217798581826908347568176833 / 50000000000000000000000000000000), (62729302307 / 100000000000000000000000000000000)⟩ +lemma Z0_4_4Entropy_sound : Z0_4_4Entropy.Encloses (Foundation.finiteEntropy Z0_4_4Value) := by + exact contains_sound (entropyPair_enclosed Z0_4_4Value Z0_4_4Terms Z0_4_4Terms_sound) (by decide +kernel) +def Z0_4_4Labels : Ball := ⟨(280000567309103515217519170238121 / 50000000000000000000000000000000), (91650101511 / 50000000000000000000000000000000)⟩ +lemma Z0_4_4Labels_sound : Z0_4_4Labels.Encloses + (∑ a : PairSlot, (zeroPairLaw (shape 0 4 4) a.1 a.2 : ℝ) * + Real.log (AllFieldParameters.multiplicity a.1 * AllFieldParameters.multiplicity a.2 : ℕ)) := by + exact contains_sound (pairSumBall_sound (fun a => .mul (Z0_4_4Probs a) (multLogs a)) + _ (fun a => Ball.mul_sound (Z0_4_4Probs_sound a) (multLogs_sound a))) (by decide +kernel) +def Z0_4_4Four : Ball := ⟨(170697392553842671062933369207477 / 25000000000000000000000000000000), (246029505329 / 100000000000000000000000000000000)⟩ +lemma Z0_4_4Four_sound : Z0_4_4Four.Encloses (AllFieldZeroLeafRates.fourRate (shape 0 4 4)) := by + exact contains_sound (Ball.add_sound Z0_4_4Entropy_sound Z0_4_4Labels_sound) (by decide +kernel) +def Z0_4_4H0Value (a : PairSlot) : ℝ := (halfLaw (shape 0 4 4) 0 a : ℝ) +def Z0_4_4H0E_0_0Log : Ball := .exact 0 +lemma Z0_4_4H0E_0_0Log_sound : Z0_4_4H0E_0_0Log.Encloses (Real.log (Z0_4_4H0Value ((0,0) : PairSlot))) := by + exact log_exact_one_ball ((Z0_4_4Half_sound 0) ((0,0) : PairSlot)) +def Z0_4_4H0E_0_0 : Ball := ⟨0, 0⟩ +lemma Z0_4_4H0E_0_0_sound : Z0_4_4H0E_0_0.Encloses (Foundation.entropyTerm (Z0_4_4H0Value ((0,0) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z0_4_4Half_sound 0) ((0,0) : PairSlot)) Z0_4_4H0E_0_0Log_sound) (by decide +kernel) +def Z0_4_4H0Terms (a : PairSlot) : Ball := + match a.1.val, a.2.val with + | 0, 0 => ⟨0, 0⟩ + | _, _ => (.exact 0) +lemma Z0_4_4H0Terms_sound (a : PairSlot) : + (Z0_4_4H0Terms a).Encloses (Foundation.entropyTerm (Z0_4_4H0Value a)) := by + rcases a with ⟨i,j⟩ + revert j i + apply forall_fin6 + · exact forall_fin6 Z0_4_4H0E_0_0_sound (entropyTerm_zero_ball ((Z0_4_4Half_sound 0) ((0,1) : PairSlot))) (entropyTerm_zero_ball ((Z0_4_4Half_sound 0) ((0,2) : PairSlot))) (entropyTerm_zero_ball ((Z0_4_4Half_sound 0) ((0,3) : PairSlot))) (entropyTerm_zero_ball ((Z0_4_4Half_sound 0) ((0,4) : PairSlot))) (entropyTerm_zero_ball ((Z0_4_4Half_sound 0) ((0,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z0_4_4Half_sound 0) ((1,0) : PairSlot))) (entropyTerm_zero_ball ((Z0_4_4Half_sound 0) ((1,1) : PairSlot))) (entropyTerm_zero_ball ((Z0_4_4Half_sound 0) ((1,2) : PairSlot))) (entropyTerm_zero_ball ((Z0_4_4Half_sound 0) ((1,3) : PairSlot))) (entropyTerm_zero_ball ((Z0_4_4Half_sound 0) ((1,4) : PairSlot))) (entropyTerm_zero_ball ((Z0_4_4Half_sound 0) ((1,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z0_4_4Half_sound 0) ((2,0) : PairSlot))) (entropyTerm_zero_ball ((Z0_4_4Half_sound 0) ((2,1) : PairSlot))) (entropyTerm_zero_ball ((Z0_4_4Half_sound 0) ((2,2) : PairSlot))) (entropyTerm_zero_ball ((Z0_4_4Half_sound 0) ((2,3) : PairSlot))) (entropyTerm_zero_ball ((Z0_4_4Half_sound 0) ((2,4) : PairSlot))) (entropyTerm_zero_ball ((Z0_4_4Half_sound 0) ((2,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z0_4_4Half_sound 0) ((3,0) : PairSlot))) (entropyTerm_zero_ball ((Z0_4_4Half_sound 0) ((3,1) : PairSlot))) (entropyTerm_zero_ball ((Z0_4_4Half_sound 0) ((3,2) : PairSlot))) (entropyTerm_zero_ball ((Z0_4_4Half_sound 0) ((3,3) : PairSlot))) (entropyTerm_zero_ball ((Z0_4_4Half_sound 0) ((3,4) : PairSlot))) (entropyTerm_zero_ball ((Z0_4_4Half_sound 0) ((3,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z0_4_4Half_sound 0) ((4,0) : PairSlot))) (entropyTerm_zero_ball ((Z0_4_4Half_sound 0) ((4,1) : PairSlot))) (entropyTerm_zero_ball ((Z0_4_4Half_sound 0) ((4,2) : PairSlot))) (entropyTerm_zero_ball ((Z0_4_4Half_sound 0) ((4,3) : PairSlot))) (entropyTerm_zero_ball ((Z0_4_4Half_sound 0) ((4,4) : PairSlot))) (entropyTerm_zero_ball ((Z0_4_4Half_sound 0) ((4,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z0_4_4Half_sound 0) ((5,0) : PairSlot))) (entropyTerm_zero_ball ((Z0_4_4Half_sound 0) ((5,1) : PairSlot))) (entropyTerm_zero_ball ((Z0_4_4Half_sound 0) ((5,2) : PairSlot))) (entropyTerm_zero_ball ((Z0_4_4Half_sound 0) ((5,3) : PairSlot))) (entropyTerm_zero_ball ((Z0_4_4Half_sound 0) ((5,4) : PairSlot))) (entropyTerm_zero_ball ((Z0_4_4Half_sound 0) ((5,5) : PairSlot))) +def Z0_4_4H0Entropy : Ball := ⟨0, 0⟩ +lemma Z0_4_4H0Entropy_sound : Z0_4_4H0Entropy.Encloses (Foundation.finiteEntropy Z0_4_4H0Value) := by + exact contains_sound (entropyPair_enclosed Z0_4_4H0Value Z0_4_4H0Terms Z0_4_4H0Terms_sound) (by decide +kernel) +def Z0_4_4H0Mass : Ball := ⟨1, 0⟩ +lemma Z0_4_4H0Mass_sound : Z0_4_4H0Mass.Encloses (∑ a, Z0_4_4H0Value a) := by + exact contains_sound (pairSumBall_sound (Z0_4_4Half 0) Z0_4_4H0Value (Z0_4_4Half_sound 0)) (by decide +kernel) +def Z0_4_4H0MassTermLog : Ball := .exact 0 +lemma Z0_4_4H0MassTermLog_sound : Z0_4_4H0MassTermLog.Encloses (Real.log ((∑ a, Z0_4_4H0Value a))) := by + exact log_exact_one_ball (Z0_4_4H0Mass_sound) +def Z0_4_4H0MassTerm : Ball := ⟨0, 0⟩ +lemma Z0_4_4H0MassTerm_sound : Z0_4_4H0MassTerm.Encloses (Foundation.entropyTerm ((∑ a, Z0_4_4H0Value a))) := by + exact contains_sound (entropyTerm_ball (Z0_4_4H0Mass_sound) Z0_4_4H0MassTermLog_sound) (by decide +kernel) +def Z0_4_4H0H : Ball := ⟨0, 0⟩ +lemma Z0_4_4H0H_sound : Z0_4_4H0H.Encloses (homogeneousEntropy Z0_4_4H0Value) := by + exact contains_sound (homogeneous_enclosed Z0_4_4H0Value Z0_4_4H0MassTerm_sound Z0_4_4H0Entropy_sound) (by decide +kernel) +def Z0_4_4H1Value (a : PairSlot) : ℝ := (halfLaw (shape 0 4 4) 1 a : ℝ) +def Z0_4_4H1E_0_5LogWitness : LogWitness := ⟨-10, 7494452423922705001235812089, 3906250000000000000000000000⟩ +def Z0_4_4H1E_0_5Log : Ball := ⟨(-627988657006593341151923689501087 / 100000000000000000000000000000000), (232934061047 / 100000000000000000000000000000000)⟩ +lemma Z0_4_4H1E_0_5Log_sound : Z0_4_4H1E_0_5Log.Encloses (Real.log (Z0_4_4H1Value ((0,5) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound ((Z0_4_4Half_sound 1) ((0,5) : PairSlot)) (w := Z0_4_4H1E_0_5LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z0_4_4H1E_0_5 : Ball := ⟨(588303889087378458388880598603 / 50000000000000000000000000000000), (109107079 / 25000000000000000000000000000000)⟩ +lemma Z0_4_4H1E_0_5_sound : Z0_4_4H1E_0_5.Encloses (Foundation.entropyTerm (Z0_4_4H1Value ((0,5) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z0_4_4Half_sound 1) ((0,5) : PairSlot)) Z0_4_4H1E_0_5Log_sound) (by decide +kernel) +def Z0_4_4H1E_1_4LogWitness : LogWitness := ⟨-3, 1261243984157612676036813528611, 1250000000000000000000000000000⟩ +def Z0_4_4H1E_1_4Log : Ball := ⟨(-20704865700659334115192382203811 / 10000000000000000000000000000000), (16940658989 / 20000000000000000000000000000000)⟩ +lemma Z0_4_4H1E_1_4Log_sound : Z0_4_4H1E_1_4Log.Encloses (Real.log (Z0_4_4H1Value ((1,4) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound ((Z0_4_4Half_sound 1) ((1,4) : PairSlot)) (w := Z0_4_4H1E_1_4LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z0_4_4H1E_1_4 : Ball := ⟨(26113887307747879276296106837317 / 100000000000000000000000000000000), (427326087 / 4000000000000000000000000000000)⟩ +lemma Z0_4_4H1E_1_4_sound : Z0_4_4H1E_1_4.Encloses (Foundation.entropyTerm (Z0_4_4H1Value ((1,4) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z0_4_4Half_sound 1) ((1,4) : PairSlot)) Z0_4_4H1E_1_4Log_sound) (by decide +kernel) +def Z0_4_4H1E_2_2LogWitness : LogWitness := ⟨-1, 61165519013116834840287783186423, 50000000000000000000000000000000⟩ +def Z0_4_4H1E_2_2Log : Ball := ⟨(-6144832125824167643990482528629 / 12500000000000000000000000000000), (10587911887 / 25000000000000000000000000000000)⟩ +lemma Z0_4_4H1E_2_2Log_sound : Z0_4_4H1E_2_2Log.Encloses (Real.log (Z0_4_4H1Value ((2,2) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound ((Z0_4_4Half_sound 1) ((2,2) : PairSlot)) (w := Z0_4_4H1E_2_2LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z0_4_4H1E_2_2 : Ball := ⟨(15034073848980370592136607206397 / 50000000000000000000000000000000), (25904605089 / 100000000000000000000000000000000)⟩ +lemma Z0_4_4H1E_2_2_sound : Z0_4_4H1E_2_2.Encloses (Foundation.entropyTerm (Z0_4_4H1Value ((2,2) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z0_4_4Half_sound 1) ((2,2) : PairSlot)) Z0_4_4H1E_2_2Log_sound) (by decide +kernel) +def Z0_4_4H1E_2_3LogWitness : LogWitness := ⟨-4, 784932206749518952016351104847, 781250000000000000000000000000⟩ +def Z0_4_4H1E_2_3Log : Ball := ⟨(-17299291062912083821995237683913 / 6250000000000000000000000000000), (105879118637 / 100000000000000000000000000000000)⟩ +lemma Z0_4_4H1E_2_3Log_sound : Z0_4_4H1E_2_3Log.Encloses (Real.log (Z0_4_4H1Value ((2,3) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound ((Z0_4_4Half_sound 1) ((2,3) : PairSlot)) (w := Z0_4_4H1E_2_3LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z0_4_4H1E_2_3 : Ball := ⟨(543150828368552529862213075723 / 3125000000000000000000000000000), (6648634459 / 100000000000000000000000000000000)⟩ +lemma Z0_4_4H1E_2_3_sound : Z0_4_4H1E_2_3.Encloses (Foundation.entropyTerm (Z0_4_4H1Value ((2,3) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z0_4_4Half_sound 1) ((2,3) : PairSlot)) Z0_4_4H1E_2_3Log_sound) (by decide +kernel) +def Z0_4_4H1E_3_2LogWitness : LogWitness := ⟨-4, 784932206749518952016351104847, 781250000000000000000000000000⟩ +def Z0_4_4H1E_3_2Log : Ball := ⟨(-17299291062912083821995237683913 / 6250000000000000000000000000000), (105879118637 / 100000000000000000000000000000000)⟩ +lemma Z0_4_4H1E_3_2Log_sound : Z0_4_4H1E_3_2Log.Encloses (Real.log (Z0_4_4H1Value ((3,2) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound ((Z0_4_4Half_sound 1) ((3,2) : PairSlot)) (w := Z0_4_4H1E_3_2LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z0_4_4H1E_3_2 : Ball := ⟨(543150828368552529862213075723 / 3125000000000000000000000000000), (6648634459 / 100000000000000000000000000000000)⟩ +lemma Z0_4_4H1E_3_2_sound : Z0_4_4H1E_3_2.Encloses (Foundation.entropyTerm (Z0_4_4H1Value ((3,2) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z0_4_4Half_sound 1) ((3,2) : PairSlot)) Z0_4_4H1E_3_2Log_sound) (by decide +kernel) +def Z0_4_4H1E_3_3LogWitness : LogWitness := ⟨-8, 675963374542473156652537959353, 390625000000000000000000000000⟩ +def Z0_4_4H1E_3_3Log : Ball := ⟨(-49967865700659334115192372656099 / 10000000000000000000000000000000), (38116482659 / 20000000000000000000000000000000)⟩ +lemma Z0_4_4H1E_3_3Log_sound : Z0_4_4H1E_3_3Log.Encloses (Real.log (Z0_4_4H1Value ((3,3) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound ((Z0_4_4Half_sound 1) ((3,3) : PairSlot)) (w := Z0_4_4H1E_3_3LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z0_4_4H1E_3_3 : Ball := ⟨(1688822355885139167546274512777 / 50000000000000000000000000000000), (644133659 / 50000000000000000000000000000000)⟩ +lemma Z0_4_4H1E_3_3_sound : Z0_4_4H1E_3_3.Encloses (Foundation.entropyTerm (Z0_4_4H1Value ((3,3) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z0_4_4Half_sound 1) ((3,3) : PairSlot)) Z0_4_4H1E_3_3Log_sound) (by decide +kernel) +def Z0_4_4H1E_4_1LogWitness : LogWitness := ⟨-3, 1261243984157612676036813528611, 1250000000000000000000000000000⟩ +def Z0_4_4H1E_4_1Log : Ball := ⟨(-20704865700659334115192382203811 / 10000000000000000000000000000000), (16940658989 / 20000000000000000000000000000000)⟩ +lemma Z0_4_4H1E_4_1Log_sound : Z0_4_4H1E_4_1Log.Encloses (Real.log (Z0_4_4H1Value ((4,1) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound ((Z0_4_4Half_sound 1) ((4,1) : PairSlot)) (w := Z0_4_4H1E_4_1LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z0_4_4H1E_4_1 : Ball := ⟨(26113887307747879276296106837317 / 100000000000000000000000000000000), (427326087 / 4000000000000000000000000000000)⟩ +lemma Z0_4_4H1E_4_1_sound : Z0_4_4H1E_4_1.Encloses (Foundation.entropyTerm (Z0_4_4H1Value ((4,1) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z0_4_4Half_sound 1) ((4,1) : PairSlot)) Z0_4_4H1E_4_1Log_sound) (by decide +kernel) +def Z0_4_4H1E_5_0LogWitness : LogWitness := ⟨-10, 7494452423922705001235812089, 3906250000000000000000000000⟩ +def Z0_4_4H1E_5_0Log : Ball := ⟨(-627988657006593341151923689501087 / 100000000000000000000000000000000), (232934061047 / 100000000000000000000000000000000)⟩ +lemma Z0_4_4H1E_5_0Log_sound : Z0_4_4H1E_5_0Log.Encloses (Real.log (Z0_4_4H1Value ((5,0) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound ((Z0_4_4Half_sound 1) ((5,0) : PairSlot)) (w := Z0_4_4H1E_5_0LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z0_4_4H1E_5_0 : Ball := ⟨(588303889087378458388880598603 / 50000000000000000000000000000000), (109107079 / 25000000000000000000000000000000)⟩ +lemma Z0_4_4H1E_5_0_sound : Z0_4_4H1E_5_0.Encloses (Foundation.entropyTerm (Z0_4_4H1Value ((5,0) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z0_4_4Half_sound 1) ((5,0) : PairSlot)) Z0_4_4H1E_5_0Log_sound) (by decide +kernel) +def Z0_4_4H1Terms (a : PairSlot) : Ball := + match a.1.val, a.2.val with + | 0, 5 => ⟨(588303889087378458388880598603 / 50000000000000000000000000000000), (109107079 / 25000000000000000000000000000000)⟩ + | 1, 4 => ⟨(26113887307747879276296106837317 / 100000000000000000000000000000000), (427326087 / 4000000000000000000000000000000)⟩ + | 2, 2 => ⟨(15034073848980370592136607206397 / 50000000000000000000000000000000), (25904605089 / 100000000000000000000000000000000)⟩ + | 2, 3 => ⟨(543150828368552529862213075723 / 3125000000000000000000000000000), (6648634459 / 100000000000000000000000000000000)⟩ + | 3, 2 => ⟨(543150828368552529862213075723 / 3125000000000000000000000000000), (6648634459 / 100000000000000000000000000000000)⟩ + | 3, 3 => ⟨(1688822355885139167546274512777 / 50000000000000000000000000000000), (644133659 / 50000000000000000000000000000000)⟩ + | 4, 1 => ⟨(26113887307747879276296106837317 / 100000000000000000000000000000000), (427326087 / 4000000000000000000000000000000)⟩ + | 5, 0 => ⟨(588303889087378458388880598603 / 50000000000000000000000000000000), (109107079 / 25000000000000000000000000000000)⟩ + | _, _ => (.exact 0) +lemma Z0_4_4H1Terms_sound (a : PairSlot) : + (Z0_4_4H1Terms a).Encloses (Foundation.entropyTerm (Z0_4_4H1Value a)) := by + rcases a with ⟨i,j⟩ + revert j i + apply forall_fin6 + · exact forall_fin6 (entropyTerm_zero_ball ((Z0_4_4Half_sound 1) ((0,0) : PairSlot))) (entropyTerm_zero_ball ((Z0_4_4Half_sound 1) ((0,1) : PairSlot))) (entropyTerm_zero_ball ((Z0_4_4Half_sound 1) ((0,2) : PairSlot))) (entropyTerm_zero_ball ((Z0_4_4Half_sound 1) ((0,3) : PairSlot))) (entropyTerm_zero_ball ((Z0_4_4Half_sound 1) ((0,4) : PairSlot))) Z0_4_4H1E_0_5_sound + · exact forall_fin6 (entropyTerm_zero_ball ((Z0_4_4Half_sound 1) ((1,0) : PairSlot))) (entropyTerm_zero_ball ((Z0_4_4Half_sound 1) ((1,1) : PairSlot))) (entropyTerm_zero_ball ((Z0_4_4Half_sound 1) ((1,2) : PairSlot))) (entropyTerm_zero_ball ((Z0_4_4Half_sound 1) ((1,3) : PairSlot))) Z0_4_4H1E_1_4_sound (entropyTerm_zero_ball ((Z0_4_4Half_sound 1) ((1,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z0_4_4Half_sound 1) ((2,0) : PairSlot))) (entropyTerm_zero_ball ((Z0_4_4Half_sound 1) ((2,1) : PairSlot))) Z0_4_4H1E_2_2_sound Z0_4_4H1E_2_3_sound (entropyTerm_zero_ball ((Z0_4_4Half_sound 1) ((2,4) : PairSlot))) (entropyTerm_zero_ball ((Z0_4_4Half_sound 1) ((2,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z0_4_4Half_sound 1) ((3,0) : PairSlot))) (entropyTerm_zero_ball ((Z0_4_4Half_sound 1) ((3,1) : PairSlot))) Z0_4_4H1E_3_2_sound Z0_4_4H1E_3_3_sound (entropyTerm_zero_ball ((Z0_4_4Half_sound 1) ((3,4) : PairSlot))) (entropyTerm_zero_ball ((Z0_4_4Half_sound 1) ((3,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z0_4_4Half_sound 1) ((4,0) : PairSlot))) Z0_4_4H1E_4_1_sound (entropyTerm_zero_ball ((Z0_4_4Half_sound 1) ((4,2) : PairSlot))) (entropyTerm_zero_ball ((Z0_4_4Half_sound 1) ((4,3) : PairSlot))) (entropyTerm_zero_ball ((Z0_4_4Half_sound 1) ((4,4) : PairSlot))) (entropyTerm_zero_ball ((Z0_4_4Half_sound 1) ((4,5) : PairSlot))) + · exact forall_fin6 Z0_4_4H1E_5_0_sound (entropyTerm_zero_ball ((Z0_4_4Half_sound 1) ((5,1) : PairSlot))) (entropyTerm_zero_ball ((Z0_4_4Half_sound 1) ((5,2) : PairSlot))) (entropyTerm_zero_ball ((Z0_4_4Half_sound 1) ((5,3) : PairSlot))) (entropyTerm_zero_ball ((Z0_4_4Half_sound 1) ((5,4) : PairSlot))) (entropyTerm_zero_ball ((Z0_4_4Half_sound 1) ((5,5) : PairSlot))) +def Z0_4_4H1Entropy : Ball := ⟨(61394217798581826908347568176833 / 50000000000000000000000000000000), (62729302307 / 100000000000000000000000000000000)⟩ +lemma Z0_4_4H1Entropy_sound : Z0_4_4H1Entropy.Encloses (Foundation.finiteEntropy Z0_4_4H1Value) := by + exact contains_sound (entropyPair_enclosed Z0_4_4H1Value Z0_4_4H1Terms Z0_4_4H1Terms_sound) (by decide +kernel) +def Z0_4_4H1Mass : Ball := ⟨(49999999999999999999999999999999 / 50000000000000000000000000000000), (197 / 100000000000000000000000000000000)⟩ +lemma Z0_4_4H1Mass_sound : Z0_4_4H1Mass.Encloses (∑ a, Z0_4_4H1Value a) := by + exact contains_sound (pairSumBall_sound (Z0_4_4Half 1) Z0_4_4H1Value (Z0_4_4Half_sound 1)) (by decide +kernel) +def Z0_4_4H1MassTermLogWitness : LogWitness := ⟨-1, 49999999999999999999999999999999, 25000000000000000000000000000000⟩ +def Z0_4_4H1MassTermLog : Ball := ⟨(-1 / 100000000000000000000000000000000), (42351647563 / 100000000000000000000000000000000)⟩ +lemma Z0_4_4H1MassTermLog_sound : Z0_4_4H1MassTermLog.Encloses (Real.log ((∑ a, Z0_4_4H1Value a))) := by + exact checkLog_sound logTwoBall_sound (Z0_4_4H1Mass_sound) (w := Z0_4_4H1MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z0_4_4H1MassTerm : Ball := ⟨(1 / 100000000000000000000000000000000), (10587911891 / 25000000000000000000000000000000)⟩ +lemma Z0_4_4H1MassTerm_sound : Z0_4_4H1MassTerm.Encloses (Foundation.entropyTerm ((∑ a, Z0_4_4H1Value a))) := by + exact contains_sound (entropyTerm_ball (Z0_4_4H1Mass_sound) Z0_4_4H1MassTermLog_sound) (by decide +kernel) +def Z0_4_4H1H : Ball := ⟨(24557687119432730763339027270733 / 20000000000000000000000000000000), (105080949871 / 100000000000000000000000000000000)⟩ +lemma Z0_4_4H1H_sound : Z0_4_4H1H.Encloses (homogeneousEntropy Z0_4_4H1Value) := by + exact contains_sound (homogeneous_enclosed Z0_4_4H1Value Z0_4_4H1MassTerm_sound Z0_4_4H1Entropy_sound) (by decide +kernel) +def Z0_4_4H2Value (a : PairSlot) : ℝ := (halfLaw (shape 0 4 4) 2 a : ℝ) +def Z0_4_4H2E_5_0LogWitness : LogWitness := ⟨-10, 7494452423922705001235812089, 3906250000000000000000000000⟩ +def Z0_4_4H2E_5_0Log : Ball := ⟨(-627988657006593341151923689501087 / 100000000000000000000000000000000), (232934061047 / 100000000000000000000000000000000)⟩ +lemma Z0_4_4H2E_5_0Log_sound : Z0_4_4H2E_5_0Log.Encloses (Real.log (Z0_4_4H2Value ((5,0) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound ((Z0_4_4Half_sound 2) ((5,0) : PairSlot)) (w := Z0_4_4H2E_5_0LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z0_4_4H2E_5_0 : Ball := ⟨(588303889087378458388880598603 / 50000000000000000000000000000000), (109107079 / 25000000000000000000000000000000)⟩ +lemma Z0_4_4H2E_5_0_sound : Z0_4_4H2E_5_0.Encloses (Foundation.entropyTerm (Z0_4_4H2Value ((5,0) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z0_4_4Half_sound 2) ((5,0) : PairSlot)) Z0_4_4H2E_5_0Log_sound) (by decide +kernel) +def Z0_4_4H2E_4_1LogWitness : LogWitness := ⟨-3, 1261243984157612676036813528611, 1250000000000000000000000000000⟩ +def Z0_4_4H2E_4_1Log : Ball := ⟨(-20704865700659334115192382203811 / 10000000000000000000000000000000), (16940658989 / 20000000000000000000000000000000)⟩ +lemma Z0_4_4H2E_4_1Log_sound : Z0_4_4H2E_4_1Log.Encloses (Real.log (Z0_4_4H2Value ((4,1) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound ((Z0_4_4Half_sound 2) ((4,1) : PairSlot)) (w := Z0_4_4H2E_4_1LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z0_4_4H2E_4_1 : Ball := ⟨(26113887307747879276296106837317 / 100000000000000000000000000000000), (427326087 / 4000000000000000000000000000000)⟩ +lemma Z0_4_4H2E_4_1_sound : Z0_4_4H2E_4_1.Encloses (Foundation.entropyTerm (Z0_4_4H2Value ((4,1) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z0_4_4Half_sound 2) ((4,1) : PairSlot)) Z0_4_4H2E_4_1Log_sound) (by decide +kernel) +def Z0_4_4H2E_2_2LogWitness : LogWitness := ⟨-1, 61165519013116834840287783186423, 50000000000000000000000000000000⟩ +def Z0_4_4H2E_2_2Log : Ball := ⟨(-6144832125824167643990482528629 / 12500000000000000000000000000000), (10587911887 / 25000000000000000000000000000000)⟩ +lemma Z0_4_4H2E_2_2Log_sound : Z0_4_4H2E_2_2Log.Encloses (Real.log (Z0_4_4H2Value ((2,2) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound ((Z0_4_4Half_sound 2) ((2,2) : PairSlot)) (w := Z0_4_4H2E_2_2LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z0_4_4H2E_2_2 : Ball := ⟨(15034073848980370592136607206397 / 50000000000000000000000000000000), (25904605089 / 100000000000000000000000000000000)⟩ +lemma Z0_4_4H2E_2_2_sound : Z0_4_4H2E_2_2.Encloses (Foundation.entropyTerm (Z0_4_4H2Value ((2,2) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z0_4_4Half_sound 2) ((2,2) : PairSlot)) Z0_4_4H2E_2_2Log_sound) (by decide +kernel) +def Z0_4_4H2E_2_3LogWitness : LogWitness := ⟨-4, 784932206749518952016351104847, 781250000000000000000000000000⟩ +def Z0_4_4H2E_2_3Log : Ball := ⟨(-17299291062912083821995237683913 / 6250000000000000000000000000000), (105879118637 / 100000000000000000000000000000000)⟩ +lemma Z0_4_4H2E_2_3Log_sound : Z0_4_4H2E_2_3Log.Encloses (Real.log (Z0_4_4H2Value ((2,3) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound ((Z0_4_4Half_sound 2) ((2,3) : PairSlot)) (w := Z0_4_4H2E_2_3LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z0_4_4H2E_2_3 : Ball := ⟨(543150828368552529862213075723 / 3125000000000000000000000000000), (6648634459 / 100000000000000000000000000000000)⟩ +lemma Z0_4_4H2E_2_3_sound : Z0_4_4H2E_2_3.Encloses (Foundation.entropyTerm (Z0_4_4H2Value ((2,3) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z0_4_4Half_sound 2) ((2,3) : PairSlot)) Z0_4_4H2E_2_3Log_sound) (by decide +kernel) +def Z0_4_4H2E_3_2LogWitness : LogWitness := ⟨-4, 784932206749518952016351104847, 781250000000000000000000000000⟩ +def Z0_4_4H2E_3_2Log : Ball := ⟨(-17299291062912083821995237683913 / 6250000000000000000000000000000), (105879118637 / 100000000000000000000000000000000)⟩ +lemma Z0_4_4H2E_3_2Log_sound : Z0_4_4H2E_3_2Log.Encloses (Real.log (Z0_4_4H2Value ((3,2) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound ((Z0_4_4Half_sound 2) ((3,2) : PairSlot)) (w := Z0_4_4H2E_3_2LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z0_4_4H2E_3_2 : Ball := ⟨(543150828368552529862213075723 / 3125000000000000000000000000000), (6648634459 / 100000000000000000000000000000000)⟩ +lemma Z0_4_4H2E_3_2_sound : Z0_4_4H2E_3_2.Encloses (Foundation.entropyTerm (Z0_4_4H2Value ((3,2) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z0_4_4Half_sound 2) ((3,2) : PairSlot)) Z0_4_4H2E_3_2Log_sound) (by decide +kernel) +def Z0_4_4H2E_3_3LogWitness : LogWitness := ⟨-8, 675963374542473156652537959353, 390625000000000000000000000000⟩ +def Z0_4_4H2E_3_3Log : Ball := ⟨(-49967865700659334115192372656099 / 10000000000000000000000000000000), (38116482659 / 20000000000000000000000000000000)⟩ +lemma Z0_4_4H2E_3_3Log_sound : Z0_4_4H2E_3_3Log.Encloses (Real.log (Z0_4_4H2Value ((3,3) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound ((Z0_4_4Half_sound 2) ((3,3) : PairSlot)) (w := Z0_4_4H2E_3_3LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z0_4_4H2E_3_3 : Ball := ⟨(1688822355885139167546274512777 / 50000000000000000000000000000000), (644133659 / 50000000000000000000000000000000)⟩ +lemma Z0_4_4H2E_3_3_sound : Z0_4_4H2E_3_3.Encloses (Foundation.entropyTerm (Z0_4_4H2Value ((3,3) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z0_4_4Half_sound 2) ((3,3) : PairSlot)) Z0_4_4H2E_3_3Log_sound) (by decide +kernel) +def Z0_4_4H2E_1_4LogWitness : LogWitness := ⟨-3, 1261243984157612676036813528611, 1250000000000000000000000000000⟩ +def Z0_4_4H2E_1_4Log : Ball := ⟨(-20704865700659334115192382203811 / 10000000000000000000000000000000), (16940658989 / 20000000000000000000000000000000)⟩ +lemma Z0_4_4H2E_1_4Log_sound : Z0_4_4H2E_1_4Log.Encloses (Real.log (Z0_4_4H2Value ((1,4) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound ((Z0_4_4Half_sound 2) ((1,4) : PairSlot)) (w := Z0_4_4H2E_1_4LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z0_4_4H2E_1_4 : Ball := ⟨(26113887307747879276296106837317 / 100000000000000000000000000000000), (427326087 / 4000000000000000000000000000000)⟩ +lemma Z0_4_4H2E_1_4_sound : Z0_4_4H2E_1_4.Encloses (Foundation.entropyTerm (Z0_4_4H2Value ((1,4) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z0_4_4Half_sound 2) ((1,4) : PairSlot)) Z0_4_4H2E_1_4Log_sound) (by decide +kernel) +def Z0_4_4H2E_0_5LogWitness : LogWitness := ⟨-10, 7494452423922705001235812089, 3906250000000000000000000000⟩ +def Z0_4_4H2E_0_5Log : Ball := ⟨(-627988657006593341151923689501087 / 100000000000000000000000000000000), (232934061047 / 100000000000000000000000000000000)⟩ +lemma Z0_4_4H2E_0_5Log_sound : Z0_4_4H2E_0_5Log.Encloses (Real.log (Z0_4_4H2Value ((0,5) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound ((Z0_4_4Half_sound 2) ((0,5) : PairSlot)) (w := Z0_4_4H2E_0_5LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z0_4_4H2E_0_5 : Ball := ⟨(588303889087378458388880598603 / 50000000000000000000000000000000), (109107079 / 25000000000000000000000000000000)⟩ +lemma Z0_4_4H2E_0_5_sound : Z0_4_4H2E_0_5.Encloses (Foundation.entropyTerm (Z0_4_4H2Value ((0,5) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z0_4_4Half_sound 2) ((0,5) : PairSlot)) Z0_4_4H2E_0_5Log_sound) (by decide +kernel) +def Z0_4_4H2Terms (a : PairSlot) : Ball := + match a.1.val, a.2.val with + | 5, 0 => ⟨(588303889087378458388880598603 / 50000000000000000000000000000000), (109107079 / 25000000000000000000000000000000)⟩ + | 4, 1 => ⟨(26113887307747879276296106837317 / 100000000000000000000000000000000), (427326087 / 4000000000000000000000000000000)⟩ + | 2, 2 => ⟨(15034073848980370592136607206397 / 50000000000000000000000000000000), (25904605089 / 100000000000000000000000000000000)⟩ + | 2, 3 => ⟨(543150828368552529862213075723 / 3125000000000000000000000000000), (6648634459 / 100000000000000000000000000000000)⟩ + | 3, 2 => ⟨(543150828368552529862213075723 / 3125000000000000000000000000000), (6648634459 / 100000000000000000000000000000000)⟩ + | 3, 3 => ⟨(1688822355885139167546274512777 / 50000000000000000000000000000000), (644133659 / 50000000000000000000000000000000)⟩ + | 1, 4 => ⟨(26113887307747879276296106837317 / 100000000000000000000000000000000), (427326087 / 4000000000000000000000000000000)⟩ + | 0, 5 => ⟨(588303889087378458388880598603 / 50000000000000000000000000000000), (109107079 / 25000000000000000000000000000000)⟩ + | _, _ => (.exact 0) +lemma Z0_4_4H2Terms_sound (a : PairSlot) : + (Z0_4_4H2Terms a).Encloses (Foundation.entropyTerm (Z0_4_4H2Value a)) := by + rcases a with ⟨i,j⟩ + revert j i + apply forall_fin6 + · exact forall_fin6 (entropyTerm_zero_ball ((Z0_4_4Half_sound 2) ((0,0) : PairSlot))) (entropyTerm_zero_ball ((Z0_4_4Half_sound 2) ((0,1) : PairSlot))) (entropyTerm_zero_ball ((Z0_4_4Half_sound 2) ((0,2) : PairSlot))) (entropyTerm_zero_ball ((Z0_4_4Half_sound 2) ((0,3) : PairSlot))) (entropyTerm_zero_ball ((Z0_4_4Half_sound 2) ((0,4) : PairSlot))) Z0_4_4H2E_0_5_sound + · exact forall_fin6 (entropyTerm_zero_ball ((Z0_4_4Half_sound 2) ((1,0) : PairSlot))) (entropyTerm_zero_ball ((Z0_4_4Half_sound 2) ((1,1) : PairSlot))) (entropyTerm_zero_ball ((Z0_4_4Half_sound 2) ((1,2) : PairSlot))) (entropyTerm_zero_ball ((Z0_4_4Half_sound 2) ((1,3) : PairSlot))) Z0_4_4H2E_1_4_sound (entropyTerm_zero_ball ((Z0_4_4Half_sound 2) ((1,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z0_4_4Half_sound 2) ((2,0) : PairSlot))) (entropyTerm_zero_ball ((Z0_4_4Half_sound 2) ((2,1) : PairSlot))) Z0_4_4H2E_2_2_sound Z0_4_4H2E_2_3_sound (entropyTerm_zero_ball ((Z0_4_4Half_sound 2) ((2,4) : PairSlot))) (entropyTerm_zero_ball ((Z0_4_4Half_sound 2) ((2,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z0_4_4Half_sound 2) ((3,0) : PairSlot))) (entropyTerm_zero_ball ((Z0_4_4Half_sound 2) ((3,1) : PairSlot))) Z0_4_4H2E_3_2_sound Z0_4_4H2E_3_3_sound (entropyTerm_zero_ball ((Z0_4_4Half_sound 2) ((3,4) : PairSlot))) (entropyTerm_zero_ball ((Z0_4_4Half_sound 2) ((3,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z0_4_4Half_sound 2) ((4,0) : PairSlot))) Z0_4_4H2E_4_1_sound (entropyTerm_zero_ball ((Z0_4_4Half_sound 2) ((4,2) : PairSlot))) (entropyTerm_zero_ball ((Z0_4_4Half_sound 2) ((4,3) : PairSlot))) (entropyTerm_zero_ball ((Z0_4_4Half_sound 2) ((4,4) : PairSlot))) (entropyTerm_zero_ball ((Z0_4_4Half_sound 2) ((4,5) : PairSlot))) + · exact forall_fin6 Z0_4_4H2E_5_0_sound (entropyTerm_zero_ball ((Z0_4_4Half_sound 2) ((5,1) : PairSlot))) (entropyTerm_zero_ball ((Z0_4_4Half_sound 2) ((5,2) : PairSlot))) (entropyTerm_zero_ball ((Z0_4_4Half_sound 2) ((5,3) : PairSlot))) (entropyTerm_zero_ball ((Z0_4_4Half_sound 2) ((5,4) : PairSlot))) (entropyTerm_zero_ball ((Z0_4_4Half_sound 2) ((5,5) : PairSlot))) +def Z0_4_4H2Entropy : Ball := ⟨(61394217798581826908347568176833 / 50000000000000000000000000000000), (62729302307 / 100000000000000000000000000000000)⟩ +lemma Z0_4_4H2Entropy_sound : Z0_4_4H2Entropy.Encloses (Foundation.finiteEntropy Z0_4_4H2Value) := by + exact contains_sound (entropyPair_enclosed Z0_4_4H2Value Z0_4_4H2Terms Z0_4_4H2Terms_sound) (by decide +kernel) +def Z0_4_4H2Mass : Ball := ⟨(49999999999999999999999999999999 / 50000000000000000000000000000000), (197 / 100000000000000000000000000000000)⟩ +lemma Z0_4_4H2Mass_sound : Z0_4_4H2Mass.Encloses (∑ a, Z0_4_4H2Value a) := by + exact contains_sound (pairSumBall_sound (Z0_4_4Half 2) Z0_4_4H2Value (Z0_4_4Half_sound 2)) (by decide +kernel) +def Z0_4_4H2MassTermLogWitness : LogWitness := ⟨-1, 49999999999999999999999999999999, 25000000000000000000000000000000⟩ +def Z0_4_4H2MassTermLog : Ball := ⟨(-1 / 100000000000000000000000000000000), (42351647563 / 100000000000000000000000000000000)⟩ +lemma Z0_4_4H2MassTermLog_sound : Z0_4_4H2MassTermLog.Encloses (Real.log ((∑ a, Z0_4_4H2Value a))) := by + exact checkLog_sound logTwoBall_sound (Z0_4_4H2Mass_sound) (w := Z0_4_4H2MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z0_4_4H2MassTerm : Ball := ⟨(1 / 100000000000000000000000000000000), (10587911891 / 25000000000000000000000000000000)⟩ +lemma Z0_4_4H2MassTerm_sound : Z0_4_4H2MassTerm.Encloses (Foundation.entropyTerm ((∑ a, Z0_4_4H2Value a))) := by + exact contains_sound (entropyTerm_ball (Z0_4_4H2Mass_sound) Z0_4_4H2MassTermLog_sound) (by decide +kernel) +def Z0_4_4H2H : Ball := ⟨(24557687119432730763339027270733 / 20000000000000000000000000000000), (105080949871 / 100000000000000000000000000000000)⟩ +lemma Z0_4_4H2H_sound : Z0_4_4H2H.Encloses (homogeneousEntropy Z0_4_4H2Value) := by + exact contains_sound (homogeneous_enclosed Z0_4_4H2Value Z0_4_4H2MassTerm_sound Z0_4_4H2Entropy_sound) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/Certificates/Four0_5_3.lean b/lean/OAI/LinearAlgebra/MatrixFields/Certificates/Four0_5_3.lean new file mode 100644 index 0000000000000000000000000000000000000000..a5a70196cd3b907965497895ddbe1093ee0e7da7 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/Certificates/Four0_5_3.lean @@ -0,0 +1,604 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Certificates.Four0_3_5 + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def Z0_5_3Raw (ij : PairSlot) : Ball := + match ij.1.val, ij.2.val with + | 0, 0 => w195 + | 0, 1 => w195 + | 0, 2 => w195 + | 0, 3 => w195 + | 0, 4 => w195 + | 0, 5 => w195 + | 1, 0 => w195 + | 1, 1 => w195 + | 1, 2 => w195 + | 1, 3 => w195 + | 1, 4 => w195 + | 1, 5 => w158 + | 2, 0 => w195 + | 2, 1 => w195 + | 2, 2 => w195 + | 2, 3 => w195 + | 2, 4 => w211 + | 2, 5 => w195 + | 3, 0 => w195 + | 3, 1 => w195 + | 3, 2 => w195 + | 3, 3 => w195 + | 3, 4 => w195 + | 3, 5 => w195 + | 4, 0 => w195 + | 4, 1 => w195 + | 4, 2 => w211 + | 4, 3 => w195 + | 4, 4 => w195 + | 4, 5 => w195 + | 5, 0 => w195 + | 5, 1 => w158 + | 5, 2 => w195 + | 5, 3 => w195 + | 5, 4 => w195 + | 5, 5 => w195 + | _, _ => (.exact 0) +lemma Z0_5_3Raw_sound_0 (j : Fin 6) : + (Z0_5_3Raw (0,j)).Encloses (weight (orderedPairInteger (shape 0 5 3) 0 j) : ℝ) := by + fin_cases j + · change (Z0_5_3Raw (0,0)).Encloses (weight (orderedPairInteger (shape 0 5 3) 0 0) : ℝ) + have he : orderedPairInteger (shape 0 5 3) 0 0 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_5_3Raw (0,1)).Encloses (weight (orderedPairInteger (shape 0 5 3) 0 1) : ℝ) + have he : orderedPairInteger (shape 0 5 3) 0 1 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_5_3Raw (0,2)).Encloses (weight (orderedPairInteger (shape 0 5 3) 0 2) : ℝ) + have he : orderedPairInteger (shape 0 5 3) 0 2 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_5_3Raw (0,3)).Encloses (weight (orderedPairInteger (shape 0 5 3) 0 3) : ℝ) + have he : orderedPairInteger (shape 0 5 3) 0 3 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_5_3Raw (0,4)).Encloses (weight (orderedPairInteger (shape 0 5 3) 0 4) : ℝ) + have he : orderedPairInteger (shape 0 5 3) 0 4 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_5_3Raw (0,5)).Encloses (weight (orderedPairInteger (shape 0 5 3) 0 5) : ℝ) + have he : orderedPairInteger (shape 0 5 3) 0 5 = (0) := by decide +kernel + rw [he] + exact w195_sound +lemma Z0_5_3Raw_sound_1 (j : Fin 6) : + (Z0_5_3Raw (1,j)).Encloses (weight (orderedPairInteger (shape 0 5 3) 1 j) : ℝ) := by + fin_cases j + · change (Z0_5_3Raw (1,0)).Encloses (weight (orderedPairInteger (shape 0 5 3) 1 0) : ℝ) + have he : orderedPairInteger (shape 0 5 3) 1 0 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_5_3Raw (1,1)).Encloses (weight (orderedPairInteger (shape 0 5 3) 1 1) : ℝ) + have he : orderedPairInteger (shape 0 5 3) 1 1 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_5_3Raw (1,2)).Encloses (weight (orderedPairInteger (shape 0 5 3) 1 2) : ℝ) + have he : orderedPairInteger (shape 0 5 3) 1 2 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_5_3Raw (1,3)).Encloses (weight (orderedPairInteger (shape 0 5 3) 1 3) : ℝ) + have he : orderedPairInteger (shape 0 5 3) 1 3 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_5_3Raw (1,4)).Encloses (weight (orderedPairInteger (shape 0 5 3) 1 4) : ℝ) + have he : orderedPairInteger (shape 0 5 3) 1 4 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_5_3Raw (1,5)).Encloses (weight (orderedPairInteger (shape 0 5 3) 1 5) : ℝ) + have he : orderedPairInteger (shape 0 5 3) 1 5 = (-6216) := by decide +kernel + rw [he] + exact w158_sound +lemma Z0_5_3Raw_sound_2 (j : Fin 6) : + (Z0_5_3Raw (2,j)).Encloses (weight (orderedPairInteger (shape 0 5 3) 2 j) : ℝ) := by + fin_cases j + · change (Z0_5_3Raw (2,0)).Encloses (weight (orderedPairInteger (shape 0 5 3) 2 0) : ℝ) + have he : orderedPairInteger (shape 0 5 3) 2 0 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_5_3Raw (2,1)).Encloses (weight (orderedPairInteger (shape 0 5 3) 2 1) : ℝ) + have he : orderedPairInteger (shape 0 5 3) 2 1 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_5_3Raw (2,2)).Encloses (weight (orderedPairInteger (shape 0 5 3) 2 2) : ℝ) + have he : orderedPairInteger (shape 0 5 3) 2 2 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_5_3Raw (2,3)).Encloses (weight (orderedPairInteger (shape 0 5 3) 2 3) : ℝ) + have he : orderedPairInteger (shape 0 5 3) 2 3 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_5_3Raw (2,4)).Encloses (weight (orderedPairInteger (shape 0 5 3) 2 4) : ℝ) + have he : orderedPairInteger (shape 0 5 3) 2 4 = (23895) := by decide +kernel + rw [he] + exact w211_sound + · change (Z0_5_3Raw (2,5)).Encloses (weight (orderedPairInteger (shape 0 5 3) 2 5) : ℝ) + have he : orderedPairInteger (shape 0 5 3) 2 5 = (0) := by decide +kernel + rw [he] + exact w195_sound +lemma Z0_5_3Raw_sound_3 (j : Fin 6) : + (Z0_5_3Raw (3,j)).Encloses (weight (orderedPairInteger (shape 0 5 3) 3 j) : ℝ) := by + fin_cases j + · change (Z0_5_3Raw (3,0)).Encloses (weight (orderedPairInteger (shape 0 5 3) 3 0) : ℝ) + have he : orderedPairInteger (shape 0 5 3) 3 0 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_5_3Raw (3,1)).Encloses (weight (orderedPairInteger (shape 0 5 3) 3 1) : ℝ) + have he : orderedPairInteger (shape 0 5 3) 3 1 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_5_3Raw (3,2)).Encloses (weight (orderedPairInteger (shape 0 5 3) 3 2) : ℝ) + have he : orderedPairInteger (shape 0 5 3) 3 2 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_5_3Raw (3,3)).Encloses (weight (orderedPairInteger (shape 0 5 3) 3 3) : ℝ) + have he : orderedPairInteger (shape 0 5 3) 3 3 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_5_3Raw (3,4)).Encloses (weight (orderedPairInteger (shape 0 5 3) 3 4) : ℝ) + have he : orderedPairInteger (shape 0 5 3) 3 4 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_5_3Raw (3,5)).Encloses (weight (orderedPairInteger (shape 0 5 3) 3 5) : ℝ) + have he : orderedPairInteger (shape 0 5 3) 3 5 = (0) := by decide +kernel + rw [he] + exact w195_sound +lemma Z0_5_3Raw_sound_4 (j : Fin 6) : + (Z0_5_3Raw (4,j)).Encloses (weight (orderedPairInteger (shape 0 5 3) 4 j) : ℝ) := by + fin_cases j + · change (Z0_5_3Raw (4,0)).Encloses (weight (orderedPairInteger (shape 0 5 3) 4 0) : ℝ) + have he : orderedPairInteger (shape 0 5 3) 4 0 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_5_3Raw (4,1)).Encloses (weight (orderedPairInteger (shape 0 5 3) 4 1) : ℝ) + have he : orderedPairInteger (shape 0 5 3) 4 1 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_5_3Raw (4,2)).Encloses (weight (orderedPairInteger (shape 0 5 3) 4 2) : ℝ) + have he : orderedPairInteger (shape 0 5 3) 4 2 = (23895) := by decide +kernel + rw [he] + exact w211_sound + · change (Z0_5_3Raw (4,3)).Encloses (weight (orderedPairInteger (shape 0 5 3) 4 3) : ℝ) + have he : orderedPairInteger (shape 0 5 3) 4 3 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_5_3Raw (4,4)).Encloses (weight (orderedPairInteger (shape 0 5 3) 4 4) : ℝ) + have he : orderedPairInteger (shape 0 5 3) 4 4 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_5_3Raw (4,5)).Encloses (weight (orderedPairInteger (shape 0 5 3) 4 5) : ℝ) + have he : orderedPairInteger (shape 0 5 3) 4 5 = (0) := by decide +kernel + rw [he] + exact w195_sound +lemma Z0_5_3Raw_sound_5 (j : Fin 6) : + (Z0_5_3Raw (5,j)).Encloses (weight (orderedPairInteger (shape 0 5 3) 5 j) : ℝ) := by + fin_cases j + · change (Z0_5_3Raw (5,0)).Encloses (weight (orderedPairInteger (shape 0 5 3) 5 0) : ℝ) + have he : orderedPairInteger (shape 0 5 3) 5 0 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_5_3Raw (5,1)).Encloses (weight (orderedPairInteger (shape 0 5 3) 5 1) : ℝ) + have he : orderedPairInteger (shape 0 5 3) 5 1 = (-6216) := by decide +kernel + rw [he] + exact w158_sound + · change (Z0_5_3Raw (5,2)).Encloses (weight (orderedPairInteger (shape 0 5 3) 5 2) : ℝ) + have he : orderedPairInteger (shape 0 5 3) 5 2 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_5_3Raw (5,3)).Encloses (weight (orderedPairInteger (shape 0 5 3) 5 3) : ℝ) + have he : orderedPairInteger (shape 0 5 3) 5 3 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_5_3Raw (5,4)).Encloses (weight (orderedPairInteger (shape 0 5 3) 5 4) : ℝ) + have he : orderedPairInteger (shape 0 5 3) 5 4 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_5_3Raw (5,5)).Encloses (weight (orderedPairInteger (shape 0 5 3) 5 5) : ℝ) + have he : orderedPairInteger (shape 0 5 3) 5 5 = (0) := by decide +kernel + rw [he] + exact w195_sound +lemma Z0_5_3Raw_sound (ij : PairSlot) : + (Z0_5_3Raw ij).Encloses (weight (orderedPairInteger (shape 0 5 3) ij.1 ij.2) : ℝ) := by + rcases ij with ⟨i,j⟩ + revert i + exact forall_fin6 (Z0_5_3Raw_sound_0 j) (Z0_5_3Raw_sound_1 j) (Z0_5_3Raw_sound_2 j) (Z0_5_3Raw_sound_3 j) (Z0_5_3Raw_sound_4 j) (Z0_5_3Raw_sound_5 j) +def Z0_5_3Den : Ball := ⟨(1244512297472617284129636959856319 / 50000000000000000000000000000000), (59 / 2500000000000000000000000000000)⟩ +lemma Z0_5_3Den_sound : Z0_5_3Den.Encloses + (((orderedPairs (shape 0 5 3)).map (fun ij => weight (orderedPairInteger (shape 0 5 3) ij.1 ij.2))).sum : ℝ) := by + exact contains_sound (list_cast_enclosed (orderedPairs (shape 0 5 3)) Z0_5_3Raw + (fun ij => weight (orderedPairInteger (shape 0 5 3) ij.1 ij.2)) + (fun ij _ => Z0_5_3Raw_sound ij)) (by decide +kernel) +lemma Z0_5_3Den_pos : 0 < Z0_5_3Den.lower := by decide +kernel +def Z0_5_3Probs (ij : PairSlot) : Ball := + match ij.1.val, ij.2.val with + | 1, 5 => ⟨(2157810797800214543118318532199 / 100000000000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ + | 2, 4 => ⟨(4382455112007387232015528108533 / 10000000000000000000000000000000), (87 / 100000000000000000000000000000000)⟩ + | 3, 4 => ⟨(4017638082125913136726400382471 / 100000000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ + | 4, 2 => ⟨(4382455112007387232015528108533 / 10000000000000000000000000000000), (87 / 100000000000000000000000000000000)⟩ + | 4, 3 => ⟨(4017638082125913136726400382471 / 100000000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ + | 5, 1 => ⟨(2157810797800214543118318532199 / 100000000000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ + | _, _ => (.exact 0) +lemma Z0_5_3Contains : ∀ i j : Fin 6, + statisticWeight i + statisticWeight j = shapeMax (shape 0 5 3) → + contains (.mul (Z0_5_3Raw (i,j)) (.inv Z0_5_3Den)) (Z0_5_3Probs (i,j)) = true := by + decide +kernel +lemma Z0_5_3Zero : ∀ i j : Fin 6, + statisticWeight i + statisticWeight j ≠ shapeMax (shape 0 5 3) → Z0_5_3Probs (i,j) = .exact 0 := by + decide +kernel +lemma Z0_5_3Probs_sound (ij : PairSlot) : + (Z0_5_3Probs ij).Encloses (zeroPairLaw (shape 0 5 3) ij.1 ij.2 : ℝ) := by + by_cases h : statisticWeight ij.1 + statisticWeight ij.2 = shapeMax (shape 0 5 3) + · have hb := contains_sound (Ball.mul_sound (Z0_5_3Raw_sound ij) + (Ball.inv_sound Z0_5_3Den_sound Z0_5_3Den_pos)) (Z0_5_3Contains ij.1 ij.2 h) + simpa only [zeroPairLaw, h, ite_true, Rat.cast_div, Rat.cast_mul, + Rat.cast_inv, div_eq_mul_inv] using hb + · rw [Z0_5_3Zero ij.1 ij.2 h] + simpa only [zeroPairLaw, h, ite_false] using Ball.exact_sound 0 + +def Z0_5_3Half (w : Fin 3) (ij : PairSlot) : Ball := + if (shape 0 5 3) w = 0 then if ij = (0,0) then .exact 1 else .exact 0 + else if w = halfMaxAxis (shape 0 5 3) then Z0_5_3Probs ij + else Z0_5_3Probs (kappa ij.1, kappa ij.2) +lemma Z0_5_3Half_sound (w : Fin 3) (ij : PairSlot) : + (Z0_5_3Half w ij).Encloses (halfLaw (shape 0 5 3) w ij : ℝ) := by + have hp : positive (shape 0 5 3) = false := by decide +kernel + simp only [Z0_5_3Half, halfLaw, hp, Bool.false_eq_true, ite_false] + split_ifs + · exact Ball.exact_sound 1 + · exact Ball.exact_sound 0 + · exact Z0_5_3Probs_sound _ + · exact Z0_5_3Probs_sound _ + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def Z0_5_3Value (a : PairSlot) : ℝ := (zeroPairLaw (shape 0 5 3) a.1 a.2 : ℝ) +def Z0_5_3E_1_5LogWitness : LogWitness := ⟨-6, 2157810797800214543118318532199, 1562500000000000000000000000000⟩ +def Z0_5_3E_1_5Log : Ball := ⟨(-5993868746542471569477025801103 / 1562500000000000000000000000000), (148230766059 / 100000000000000000000000000000000)⟩ +lemma Z0_5_3E_1_5Log_sound : Z0_5_3E_1_5Log.Encloses (Real.log (Z0_5_3Value ((1,5) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound (Z0_5_3Probs_sound ((1,5) : PairSlot)) (w := Z0_5_3E_1_5LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z0_5_3E_1_5 : Ball := ⟨(8277526209207412807813577207303 / 100000000000000000000000000000000), (6397079 / 200000000000000000000000000000)⟩ +lemma Z0_5_3E_1_5_sound : Z0_5_3E_1_5.Encloses (Foundation.entropyTerm (Z0_5_3Value ((1,5) : PairSlot))) := by + exact contains_sound (entropyTerm_ball (Z0_5_3Probs_sound ((1,5) : PairSlot)) Z0_5_3E_1_5Log_sound) (by decide +kernel) +def Z0_5_3E_2_4LogWitness : LogWitness := ⟨-2, 4382455112007387232015528108533, 2500000000000000000000000000000⟩ +def Z0_5_3E_2_4Log : Ball := ⟨(-41248799889359090223264863826827 / 50000000000000000000000000000000), (63527471247 / 100000000000000000000000000000000)⟩ +lemma Z0_5_3E_2_4Log_sound : Z0_5_3E_2_4Log.Encloses (Real.log (Z0_5_3Value ((2,4) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound (Z0_5_3Probs_sound ((2,4) : PairSlot)) (w := Z0_5_3E_2_4LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z0_5_3E_2_4 : Ball := ⟨(18077101393929149380776110958019 / 50000000000000000000000000000000), (5568125837 / 20000000000000000000000000000000)⟩ +lemma Z0_5_3E_2_4_sound : Z0_5_3E_2_4.Encloses (Foundation.entropyTerm (Z0_5_3Value ((2,4) : PairSlot))) := by + exact contains_sound (entropyTerm_ball (Z0_5_3Probs_sound ((2,4) : PairSlot)) Z0_5_3E_2_4Log_sound) (by decide +kernel) +def Z0_5_3E_3_4LogWitness : LogWitness := ⟨-5, 4017638082125913136726400382471, 3125000000000000000000000000000⟩ +def Z0_5_3E_3_4Log : Ball := ⟨(-321447599778718180446529670366099 / 100000000000000000000000000000000), (127054942197 / 100000000000000000000000000000000)⟩ +lemma Z0_5_3E_3_4Log_sound : Z0_5_3E_3_4Log.Encloses (Real.log (Z0_5_3Value ((3,4) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound (Z0_5_3Probs_sound ((3,4) : PairSlot)) (w := Z0_5_3E_3_4LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z0_5_3E_3_4 : Ball := ⟨(1614325147848684263111295424987 / 12500000000000000000000000000000), (5104607757 / 100000000000000000000000000000000)⟩ +lemma Z0_5_3E_3_4_sound : Z0_5_3E_3_4.Encloses (Foundation.entropyTerm (Z0_5_3Value ((3,4) : PairSlot))) := by + exact contains_sound (entropyTerm_ball (Z0_5_3Probs_sound ((3,4) : PairSlot)) Z0_5_3E_3_4Log_sound) (by decide +kernel) +def Z0_5_3E_4_2LogWitness : LogWitness := ⟨-2, 4382455112007387232015528108533, 2500000000000000000000000000000⟩ +def Z0_5_3E_4_2Log : Ball := ⟨(-41248799889359090223264863826827 / 50000000000000000000000000000000), (63527471247 / 100000000000000000000000000000000)⟩ +lemma Z0_5_3E_4_2Log_sound : Z0_5_3E_4_2Log.Encloses (Real.log (Z0_5_3Value ((4,2) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound (Z0_5_3Probs_sound ((4,2) : PairSlot)) (w := Z0_5_3E_4_2LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z0_5_3E_4_2 : Ball := ⟨(18077101393929149380776110958019 / 50000000000000000000000000000000), (5568125837 / 20000000000000000000000000000000)⟩ +lemma Z0_5_3E_4_2_sound : Z0_5_3E_4_2.Encloses (Foundation.entropyTerm (Z0_5_3Value ((4,2) : PairSlot))) := by + exact contains_sound (entropyTerm_ball (Z0_5_3Probs_sound ((4,2) : PairSlot)) Z0_5_3E_4_2Log_sound) (by decide +kernel) +def Z0_5_3E_4_3LogWitness : LogWitness := ⟨-5, 4017638082125913136726400382471, 3125000000000000000000000000000⟩ +def Z0_5_3E_4_3Log : Ball := ⟨(-321447599778718180446529670366099 / 100000000000000000000000000000000), (127054942197 / 100000000000000000000000000000000)⟩ +lemma Z0_5_3E_4_3Log_sound : Z0_5_3E_4_3Log.Encloses (Real.log (Z0_5_3Value ((4,3) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound (Z0_5_3Probs_sound ((4,3) : PairSlot)) (w := Z0_5_3E_4_3LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z0_5_3E_4_3 : Ball := ⟨(1614325147848684263111295424987 / 12500000000000000000000000000000), (5104607757 / 100000000000000000000000000000000)⟩ +lemma Z0_5_3E_4_3_sound : Z0_5_3E_4_3.Encloses (Foundation.entropyTerm (Z0_5_3Value ((4,3) : PairSlot))) := by + exact contains_sound (entropyTerm_ball (Z0_5_3Probs_sound ((4,3) : PairSlot)) Z0_5_3E_4_3Log_sound) (by decide +kernel) +def Z0_5_3E_5_1LogWitness : LogWitness := ⟨-6, 2157810797800214543118318532199, 1562500000000000000000000000000⟩ +def Z0_5_3E_5_1Log : Ball := ⟨(-5993868746542471569477025801103 / 1562500000000000000000000000000), (148230766059 / 100000000000000000000000000000000)⟩ +lemma Z0_5_3E_5_1Log_sound : Z0_5_3E_5_1Log.Encloses (Real.log (Z0_5_3Value ((5,1) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound (Z0_5_3Probs_sound ((5,1) : PairSlot)) (w := Z0_5_3E_5_1LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z0_5_3E_5_1 : Ball := ⟨(8277526209207412807813577207303 / 100000000000000000000000000000000), (6397079 / 200000000000000000000000000000)⟩ +lemma Z0_5_3E_5_1_sound : Z0_5_3E_5_1.Encloses (Foundation.entropyTerm (Z0_5_3Value ((5,1) : PairSlot))) := by + exact contains_sound (entropyTerm_ball (Z0_5_3Probs_sound ((5,1) : PairSlot)) Z0_5_3E_5_1Log_sound) (by decide +kernel) +def Z0_5_3Terms (a : PairSlot) : Ball := + match a.1.val, a.2.val with + | 1, 5 => ⟨(8277526209207412807813577207303 / 100000000000000000000000000000000), (6397079 / 200000000000000000000000000000)⟩ + | 2, 4 => ⟨(18077101393929149380776110958019 / 50000000000000000000000000000000), (5568125837 / 20000000000000000000000000000000)⟩ + | 3, 4 => ⟨(1614325147848684263111295424987 / 12500000000000000000000000000000), (5104607757 / 100000000000000000000000000000000)⟩ + | 4, 2 => ⟨(18077101393929149380776110958019 / 50000000000000000000000000000000), (5568125837 / 20000000000000000000000000000000)⟩ + | 4, 3 => ⟨(1614325147848684263111295424987 / 12500000000000000000000000000000), (5104607757 / 100000000000000000000000000000000)⟩ + | 5, 1 => ⟨(8277526209207412807813577207303 / 100000000000000000000000000000000), (6397079 / 200000000000000000000000000000)⟩ + | _, _ => (.exact 0) +lemma Z0_5_3Terms_sound (a : PairSlot) : + (Z0_5_3Terms a).Encloses (Foundation.entropyTerm (Z0_5_3Value a)) := by + rcases a with ⟨i,j⟩ + revert j i + apply forall_fin6 + · exact forall_fin6 (entropyTerm_zero_ball (Z0_5_3Probs_sound ((0,0) : PairSlot))) (entropyTerm_zero_ball (Z0_5_3Probs_sound ((0,1) : PairSlot))) (entropyTerm_zero_ball (Z0_5_3Probs_sound ((0,2) : PairSlot))) (entropyTerm_zero_ball (Z0_5_3Probs_sound ((0,3) : PairSlot))) (entropyTerm_zero_ball (Z0_5_3Probs_sound ((0,4) : PairSlot))) (entropyTerm_zero_ball (Z0_5_3Probs_sound ((0,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball (Z0_5_3Probs_sound ((1,0) : PairSlot))) (entropyTerm_zero_ball (Z0_5_3Probs_sound ((1,1) : PairSlot))) (entropyTerm_zero_ball (Z0_5_3Probs_sound ((1,2) : PairSlot))) (entropyTerm_zero_ball (Z0_5_3Probs_sound ((1,3) : PairSlot))) (entropyTerm_zero_ball (Z0_5_3Probs_sound ((1,4) : PairSlot))) Z0_5_3E_1_5_sound + · exact forall_fin6 (entropyTerm_zero_ball (Z0_5_3Probs_sound ((2,0) : PairSlot))) (entropyTerm_zero_ball (Z0_5_3Probs_sound ((2,1) : PairSlot))) (entropyTerm_zero_ball (Z0_5_3Probs_sound ((2,2) : PairSlot))) (entropyTerm_zero_ball (Z0_5_3Probs_sound ((2,3) : PairSlot))) Z0_5_3E_2_4_sound (entropyTerm_zero_ball (Z0_5_3Probs_sound ((2,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball (Z0_5_3Probs_sound ((3,0) : PairSlot))) (entropyTerm_zero_ball (Z0_5_3Probs_sound ((3,1) : PairSlot))) (entropyTerm_zero_ball (Z0_5_3Probs_sound ((3,2) : PairSlot))) (entropyTerm_zero_ball (Z0_5_3Probs_sound ((3,3) : PairSlot))) Z0_5_3E_3_4_sound (entropyTerm_zero_ball (Z0_5_3Probs_sound ((3,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball (Z0_5_3Probs_sound ((4,0) : PairSlot))) (entropyTerm_zero_ball (Z0_5_3Probs_sound ((4,1) : PairSlot))) Z0_5_3E_4_2_sound Z0_5_3E_4_3_sound (entropyTerm_zero_ball (Z0_5_3Probs_sound ((4,4) : PairSlot))) (entropyTerm_zero_ball (Z0_5_3Probs_sound ((4,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball (Z0_5_3Probs_sound ((5,0) : PairSlot))) Z0_5_3E_5_1_sound (entropyTerm_zero_ball (Z0_5_3Probs_sound ((5,2) : PairSlot))) (entropyTerm_zero_ball (Z0_5_3Probs_sound ((5,3) : PairSlot))) (entropyTerm_zero_ball (Z0_5_3Probs_sound ((5,4) : PairSlot))) (entropyTerm_zero_ball (Z0_5_3Probs_sound ((5,5) : PairSlot))) +def Z0_5_3Entropy : Ball := ⟨(57346330179855185674256162523237 / 50000000000000000000000000000000), (18071888221 / 25000000000000000000000000000000)⟩ +lemma Z0_5_3Entropy_sound : Z0_5_3Entropy.Encloses (Foundation.finiteEntropy Z0_5_3Value) := by + exact contains_sound (entropyPair_enclosed Z0_5_3Value Z0_5_3Terms Z0_5_3Terms_sound) (by decide +kernel) +def Z0_5_3Labels : Ball := ⟨(517959714589889087433695657320217 / 100000000000000000000000000000000), (160646509059 / 100000000000000000000000000000000)⟩ +lemma Z0_5_3Labels_sound : Z0_5_3Labels.Encloses + (∑ a : PairSlot, (zeroPairLaw (shape 0 5 3) a.1 a.2 : ℝ) * + Real.log (AllFieldParameters.multiplicity a.1 * AllFieldParameters.multiplicity a.2 : ℕ)) := by + exact contains_sound (pairSumBall_sound (fun a => .mul (Z0_5_3Probs a) (multLogs a)) + _ (fun a => Ball.mul_sound (Z0_5_3Probs_sound a) (multLogs_sound a))) (by decide +kernel) +def Z0_5_3Four : Ball := ⟨(632652374949599458782207982366691 / 100000000000000000000000000000000), (232934061943 / 100000000000000000000000000000000)⟩ +lemma Z0_5_3Four_sound : Z0_5_3Four.Encloses (AllFieldZeroLeafRates.fourRate (shape 0 5 3)) := by + exact contains_sound (Ball.add_sound Z0_5_3Entropy_sound Z0_5_3Labels_sound) (by decide +kernel) +def Z0_5_3H0Value (a : PairSlot) : ℝ := (halfLaw (shape 0 5 3) 0 a : ℝ) +def Z0_5_3H0E_0_0Log : Ball := .exact 0 +lemma Z0_5_3H0E_0_0Log_sound : Z0_5_3H0E_0_0Log.Encloses (Real.log (Z0_5_3H0Value ((0,0) : PairSlot))) := by + exact log_exact_one_ball ((Z0_5_3Half_sound 0) ((0,0) : PairSlot)) +def Z0_5_3H0E_0_0 : Ball := ⟨0, 0⟩ +lemma Z0_5_3H0E_0_0_sound : Z0_5_3H0E_0_0.Encloses (Foundation.entropyTerm (Z0_5_3H0Value ((0,0) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z0_5_3Half_sound 0) ((0,0) : PairSlot)) Z0_5_3H0E_0_0Log_sound) (by decide +kernel) +def Z0_5_3H0Terms (a : PairSlot) : Ball := + match a.1.val, a.2.val with + | 0, 0 => ⟨0, 0⟩ + | _, _ => (.exact 0) +lemma Z0_5_3H0Terms_sound (a : PairSlot) : + (Z0_5_3H0Terms a).Encloses (Foundation.entropyTerm (Z0_5_3H0Value a)) := by + rcases a with ⟨i,j⟩ + revert j i + apply forall_fin6 + · exact forall_fin6 Z0_5_3H0E_0_0_sound (entropyTerm_zero_ball ((Z0_5_3Half_sound 0) ((0,1) : PairSlot))) (entropyTerm_zero_ball ((Z0_5_3Half_sound 0) ((0,2) : PairSlot))) (entropyTerm_zero_ball ((Z0_5_3Half_sound 0) ((0,3) : PairSlot))) (entropyTerm_zero_ball ((Z0_5_3Half_sound 0) ((0,4) : PairSlot))) (entropyTerm_zero_ball ((Z0_5_3Half_sound 0) ((0,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z0_5_3Half_sound 0) ((1,0) : PairSlot))) (entropyTerm_zero_ball ((Z0_5_3Half_sound 0) ((1,1) : PairSlot))) (entropyTerm_zero_ball ((Z0_5_3Half_sound 0) ((1,2) : PairSlot))) (entropyTerm_zero_ball ((Z0_5_3Half_sound 0) ((1,3) : PairSlot))) (entropyTerm_zero_ball ((Z0_5_3Half_sound 0) ((1,4) : PairSlot))) (entropyTerm_zero_ball ((Z0_5_3Half_sound 0) ((1,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z0_5_3Half_sound 0) ((2,0) : PairSlot))) (entropyTerm_zero_ball ((Z0_5_3Half_sound 0) ((2,1) : PairSlot))) (entropyTerm_zero_ball ((Z0_5_3Half_sound 0) ((2,2) : PairSlot))) (entropyTerm_zero_ball ((Z0_5_3Half_sound 0) ((2,3) : PairSlot))) (entropyTerm_zero_ball ((Z0_5_3Half_sound 0) ((2,4) : PairSlot))) (entropyTerm_zero_ball ((Z0_5_3Half_sound 0) ((2,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z0_5_3Half_sound 0) ((3,0) : PairSlot))) (entropyTerm_zero_ball ((Z0_5_3Half_sound 0) ((3,1) : PairSlot))) (entropyTerm_zero_ball ((Z0_5_3Half_sound 0) ((3,2) : PairSlot))) (entropyTerm_zero_ball ((Z0_5_3Half_sound 0) ((3,3) : PairSlot))) (entropyTerm_zero_ball ((Z0_5_3Half_sound 0) ((3,4) : PairSlot))) (entropyTerm_zero_ball ((Z0_5_3Half_sound 0) ((3,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z0_5_3Half_sound 0) ((4,0) : PairSlot))) (entropyTerm_zero_ball ((Z0_5_3Half_sound 0) ((4,1) : PairSlot))) (entropyTerm_zero_ball ((Z0_5_3Half_sound 0) ((4,2) : PairSlot))) (entropyTerm_zero_ball ((Z0_5_3Half_sound 0) ((4,3) : PairSlot))) (entropyTerm_zero_ball ((Z0_5_3Half_sound 0) ((4,4) : PairSlot))) (entropyTerm_zero_ball ((Z0_5_3Half_sound 0) ((4,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z0_5_3Half_sound 0) ((5,0) : PairSlot))) (entropyTerm_zero_ball ((Z0_5_3Half_sound 0) ((5,1) : PairSlot))) (entropyTerm_zero_ball ((Z0_5_3Half_sound 0) ((5,2) : PairSlot))) (entropyTerm_zero_ball ((Z0_5_3Half_sound 0) ((5,3) : PairSlot))) (entropyTerm_zero_ball ((Z0_5_3Half_sound 0) ((5,4) : PairSlot))) (entropyTerm_zero_ball ((Z0_5_3Half_sound 0) ((5,5) : PairSlot))) +def Z0_5_3H0Entropy : Ball := ⟨0, 0⟩ +lemma Z0_5_3H0Entropy_sound : Z0_5_3H0Entropy.Encloses (Foundation.finiteEntropy Z0_5_3H0Value) := by + exact contains_sound (entropyPair_enclosed Z0_5_3H0Value Z0_5_3H0Terms Z0_5_3H0Terms_sound) (by decide +kernel) +def Z0_5_3H0Mass : Ball := ⟨1, 0⟩ +lemma Z0_5_3H0Mass_sound : Z0_5_3H0Mass.Encloses (∑ a, Z0_5_3H0Value a) := by + exact contains_sound (pairSumBall_sound (Z0_5_3Half 0) Z0_5_3H0Value (Z0_5_3Half_sound 0)) (by decide +kernel) +def Z0_5_3H0MassTermLog : Ball := .exact 0 +lemma Z0_5_3H0MassTermLog_sound : Z0_5_3H0MassTermLog.Encloses (Real.log ((∑ a, Z0_5_3H0Value a))) := by + exact log_exact_one_ball (Z0_5_3H0Mass_sound) +def Z0_5_3H0MassTerm : Ball := ⟨0, 0⟩ +lemma Z0_5_3H0MassTerm_sound : Z0_5_3H0MassTerm.Encloses (Foundation.entropyTerm ((∑ a, Z0_5_3H0Value a))) := by + exact contains_sound (entropyTerm_ball (Z0_5_3H0Mass_sound) Z0_5_3H0MassTermLog_sound) (by decide +kernel) +def Z0_5_3H0H : Ball := ⟨0, 0⟩ +lemma Z0_5_3H0H_sound : Z0_5_3H0H.Encloses (homogeneousEntropy Z0_5_3H0Value) := by + exact contains_sound (homogeneous_enclosed Z0_5_3H0Value Z0_5_3H0MassTerm_sound Z0_5_3H0Entropy_sound) (by decide +kernel) +def Z0_5_3H1Value (a : PairSlot) : ℝ := (halfLaw (shape 0 5 3) 1 a : ℝ) +def Z0_5_3H1E_1_5LogWitness : LogWitness := ⟨-6, 2157810797800214543118318532199, 1562500000000000000000000000000⟩ +def Z0_5_3H1E_1_5Log : Ball := ⟨(-5993868746542471569477025801103 / 1562500000000000000000000000000), (148230766059 / 100000000000000000000000000000000)⟩ +lemma Z0_5_3H1E_1_5Log_sound : Z0_5_3H1E_1_5Log.Encloses (Real.log (Z0_5_3H1Value ((1,5) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound ((Z0_5_3Half_sound 1) ((1,5) : PairSlot)) (w := Z0_5_3H1E_1_5LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z0_5_3H1E_1_5 : Ball := ⟨(8277526209207412807813577207303 / 100000000000000000000000000000000), (6397079 / 200000000000000000000000000000)⟩ +lemma Z0_5_3H1E_1_5_sound : Z0_5_3H1E_1_5.Encloses (Foundation.entropyTerm (Z0_5_3H1Value ((1,5) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z0_5_3Half_sound 1) ((1,5) : PairSlot)) Z0_5_3H1E_1_5Log_sound) (by decide +kernel) +def Z0_5_3H1E_2_4LogWitness : LogWitness := ⟨-2, 4382455112007387232015528108533, 2500000000000000000000000000000⟩ +def Z0_5_3H1E_2_4Log : Ball := ⟨(-41248799889359090223264863826827 / 50000000000000000000000000000000), (63527471247 / 100000000000000000000000000000000)⟩ +lemma Z0_5_3H1E_2_4Log_sound : Z0_5_3H1E_2_4Log.Encloses (Real.log (Z0_5_3H1Value ((2,4) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound ((Z0_5_3Half_sound 1) ((2,4) : PairSlot)) (w := Z0_5_3H1E_2_4LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z0_5_3H1E_2_4 : Ball := ⟨(18077101393929149380776110958019 / 50000000000000000000000000000000), (5568125837 / 20000000000000000000000000000000)⟩ +lemma Z0_5_3H1E_2_4_sound : Z0_5_3H1E_2_4.Encloses (Foundation.entropyTerm (Z0_5_3H1Value ((2,4) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z0_5_3Half_sound 1) ((2,4) : PairSlot)) Z0_5_3H1E_2_4Log_sound) (by decide +kernel) +def Z0_5_3H1E_3_4LogWitness : LogWitness := ⟨-5, 4017638082125913136726400382471, 3125000000000000000000000000000⟩ +def Z0_5_3H1E_3_4Log : Ball := ⟨(-321447599778718180446529670366099 / 100000000000000000000000000000000), (127054942197 / 100000000000000000000000000000000)⟩ +lemma Z0_5_3H1E_3_4Log_sound : Z0_5_3H1E_3_4Log.Encloses (Real.log (Z0_5_3H1Value ((3,4) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound ((Z0_5_3Half_sound 1) ((3,4) : PairSlot)) (w := Z0_5_3H1E_3_4LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z0_5_3H1E_3_4 : Ball := ⟨(1614325147848684263111295424987 / 12500000000000000000000000000000), (5104607757 / 100000000000000000000000000000000)⟩ +lemma Z0_5_3H1E_3_4_sound : Z0_5_3H1E_3_4.Encloses (Foundation.entropyTerm (Z0_5_3H1Value ((3,4) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z0_5_3Half_sound 1) ((3,4) : PairSlot)) Z0_5_3H1E_3_4Log_sound) (by decide +kernel) +def Z0_5_3H1E_4_2LogWitness : LogWitness := ⟨-2, 4382455112007387232015528108533, 2500000000000000000000000000000⟩ +def Z0_5_3H1E_4_2Log : Ball := ⟨(-41248799889359090223264863826827 / 50000000000000000000000000000000), (63527471247 / 100000000000000000000000000000000)⟩ +lemma Z0_5_3H1E_4_2Log_sound : Z0_5_3H1E_4_2Log.Encloses (Real.log (Z0_5_3H1Value ((4,2) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound ((Z0_5_3Half_sound 1) ((4,2) : PairSlot)) (w := Z0_5_3H1E_4_2LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z0_5_3H1E_4_2 : Ball := ⟨(18077101393929149380776110958019 / 50000000000000000000000000000000), (5568125837 / 20000000000000000000000000000000)⟩ +lemma Z0_5_3H1E_4_2_sound : Z0_5_3H1E_4_2.Encloses (Foundation.entropyTerm (Z0_5_3H1Value ((4,2) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z0_5_3Half_sound 1) ((4,2) : PairSlot)) Z0_5_3H1E_4_2Log_sound) (by decide +kernel) +def Z0_5_3H1E_4_3LogWitness : LogWitness := ⟨-5, 4017638082125913136726400382471, 3125000000000000000000000000000⟩ +def Z0_5_3H1E_4_3Log : Ball := ⟨(-321447599778718180446529670366099 / 100000000000000000000000000000000), (127054942197 / 100000000000000000000000000000000)⟩ +lemma Z0_5_3H1E_4_3Log_sound : Z0_5_3H1E_4_3Log.Encloses (Real.log (Z0_5_3H1Value ((4,3) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound ((Z0_5_3Half_sound 1) ((4,3) : PairSlot)) (w := Z0_5_3H1E_4_3LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z0_5_3H1E_4_3 : Ball := ⟨(1614325147848684263111295424987 / 12500000000000000000000000000000), (5104607757 / 100000000000000000000000000000000)⟩ +lemma Z0_5_3H1E_4_3_sound : Z0_5_3H1E_4_3.Encloses (Foundation.entropyTerm (Z0_5_3H1Value ((4,3) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z0_5_3Half_sound 1) ((4,3) : PairSlot)) Z0_5_3H1E_4_3Log_sound) (by decide +kernel) +def Z0_5_3H1E_5_1LogWitness : LogWitness := ⟨-6, 2157810797800214543118318532199, 1562500000000000000000000000000⟩ +def Z0_5_3H1E_5_1Log : Ball := ⟨(-5993868746542471569477025801103 / 1562500000000000000000000000000), (148230766059 / 100000000000000000000000000000000)⟩ +lemma Z0_5_3H1E_5_1Log_sound : Z0_5_3H1E_5_1Log.Encloses (Real.log (Z0_5_3H1Value ((5,1) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound ((Z0_5_3Half_sound 1) ((5,1) : PairSlot)) (w := Z0_5_3H1E_5_1LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z0_5_3H1E_5_1 : Ball := ⟨(8277526209207412807813577207303 / 100000000000000000000000000000000), (6397079 / 200000000000000000000000000000)⟩ +lemma Z0_5_3H1E_5_1_sound : Z0_5_3H1E_5_1.Encloses (Foundation.entropyTerm (Z0_5_3H1Value ((5,1) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z0_5_3Half_sound 1) ((5,1) : PairSlot)) Z0_5_3H1E_5_1Log_sound) (by decide +kernel) +def Z0_5_3H1Terms (a : PairSlot) : Ball := + match a.1.val, a.2.val with + | 1, 5 => ⟨(8277526209207412807813577207303 / 100000000000000000000000000000000), (6397079 / 200000000000000000000000000000)⟩ + | 2, 4 => ⟨(18077101393929149380776110958019 / 50000000000000000000000000000000), (5568125837 / 20000000000000000000000000000000)⟩ + | 3, 4 => ⟨(1614325147848684263111295424987 / 12500000000000000000000000000000), (5104607757 / 100000000000000000000000000000000)⟩ + | 4, 2 => ⟨(18077101393929149380776110958019 / 50000000000000000000000000000000), (5568125837 / 20000000000000000000000000000000)⟩ + | 4, 3 => ⟨(1614325147848684263111295424987 / 12500000000000000000000000000000), (5104607757 / 100000000000000000000000000000000)⟩ + | 5, 1 => ⟨(8277526209207412807813577207303 / 100000000000000000000000000000000), (6397079 / 200000000000000000000000000000)⟩ + | _, _ => (.exact 0) +lemma Z0_5_3H1Terms_sound (a : PairSlot) : + (Z0_5_3H1Terms a).Encloses (Foundation.entropyTerm (Z0_5_3H1Value a)) := by + rcases a with ⟨i,j⟩ + revert j i + apply forall_fin6 + · exact forall_fin6 (entropyTerm_zero_ball ((Z0_5_3Half_sound 1) ((0,0) : PairSlot))) (entropyTerm_zero_ball ((Z0_5_3Half_sound 1) ((0,1) : PairSlot))) (entropyTerm_zero_ball ((Z0_5_3Half_sound 1) ((0,2) : PairSlot))) (entropyTerm_zero_ball ((Z0_5_3Half_sound 1) ((0,3) : PairSlot))) (entropyTerm_zero_ball ((Z0_5_3Half_sound 1) ((0,4) : PairSlot))) (entropyTerm_zero_ball ((Z0_5_3Half_sound 1) ((0,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z0_5_3Half_sound 1) ((1,0) : PairSlot))) (entropyTerm_zero_ball ((Z0_5_3Half_sound 1) ((1,1) : PairSlot))) (entropyTerm_zero_ball ((Z0_5_3Half_sound 1) ((1,2) : PairSlot))) (entropyTerm_zero_ball ((Z0_5_3Half_sound 1) ((1,3) : PairSlot))) (entropyTerm_zero_ball ((Z0_5_3Half_sound 1) ((1,4) : PairSlot))) Z0_5_3H1E_1_5_sound + · exact forall_fin6 (entropyTerm_zero_ball ((Z0_5_3Half_sound 1) ((2,0) : PairSlot))) (entropyTerm_zero_ball ((Z0_5_3Half_sound 1) ((2,1) : PairSlot))) (entropyTerm_zero_ball ((Z0_5_3Half_sound 1) ((2,2) : PairSlot))) (entropyTerm_zero_ball ((Z0_5_3Half_sound 1) ((2,3) : PairSlot))) Z0_5_3H1E_2_4_sound (entropyTerm_zero_ball ((Z0_5_3Half_sound 1) ((2,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z0_5_3Half_sound 1) ((3,0) : PairSlot))) (entropyTerm_zero_ball ((Z0_5_3Half_sound 1) ((3,1) : PairSlot))) (entropyTerm_zero_ball ((Z0_5_3Half_sound 1) ((3,2) : PairSlot))) (entropyTerm_zero_ball ((Z0_5_3Half_sound 1) ((3,3) : PairSlot))) Z0_5_3H1E_3_4_sound (entropyTerm_zero_ball ((Z0_5_3Half_sound 1) ((3,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z0_5_3Half_sound 1) ((4,0) : PairSlot))) (entropyTerm_zero_ball ((Z0_5_3Half_sound 1) ((4,1) : PairSlot))) Z0_5_3H1E_4_2_sound Z0_5_3H1E_4_3_sound (entropyTerm_zero_ball ((Z0_5_3Half_sound 1) ((4,4) : PairSlot))) (entropyTerm_zero_ball ((Z0_5_3Half_sound 1) ((4,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z0_5_3Half_sound 1) ((5,0) : PairSlot))) Z0_5_3H1E_5_1_sound (entropyTerm_zero_ball ((Z0_5_3Half_sound 1) ((5,2) : PairSlot))) (entropyTerm_zero_ball ((Z0_5_3Half_sound 1) ((5,3) : PairSlot))) (entropyTerm_zero_ball ((Z0_5_3Half_sound 1) ((5,4) : PairSlot))) (entropyTerm_zero_ball ((Z0_5_3Half_sound 1) ((5,5) : PairSlot))) +def Z0_5_3H1Entropy : Ball := ⟨(57346330179855185674256162523237 / 50000000000000000000000000000000), (18071888221 / 25000000000000000000000000000000)⟩ +lemma Z0_5_3H1Entropy_sound : Z0_5_3H1Entropy.Encloses (Foundation.finiteEntropy Z0_5_3H1Value) := by + exact contains_sound (entropyPair_enclosed Z0_5_3H1Value Z0_5_3H1Terms Z0_5_3H1Terms_sound) (by decide +kernel) +def Z0_5_3H1Mass : Ball := ⟨1, (97 / 50000000000000000000000000000000)⟩ +lemma Z0_5_3H1Mass_sound : Z0_5_3H1Mass.Encloses (∑ a, Z0_5_3H1Value a) := by + exact contains_sound (pairSumBall_sound (Z0_5_3Half 1) Z0_5_3H1Value (Z0_5_3Half_sound 1)) (by decide +kernel) +def Z0_5_3H1MassTermLogWitness : LogWitness := ⟨0, 1, 1⟩ +def Z0_5_3H1MassTermLog : Ball := ⟨0, (5293955969 / 25000000000000000000000000000000)⟩ +lemma Z0_5_3H1MassTermLog_sound : Z0_5_3H1MassTermLog.Encloses (Real.log ((∑ a, Z0_5_3H1Value a))) := by + exact checkLog_sound logTwoBall_sound (Z0_5_3H1Mass_sound) (w := Z0_5_3H1MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z0_5_3H1MassTerm : Ball := ⟨0, (21175823877 / 100000000000000000000000000000000)⟩ +lemma Z0_5_3H1MassTerm_sound : Z0_5_3H1MassTerm.Encloses (Foundation.entropyTerm ((∑ a, Z0_5_3H1Value a))) := by + exact contains_sound (entropyTerm_ball (Z0_5_3H1Mass_sound) Z0_5_3H1MassTermLog_sound) (by decide +kernel) +def Z0_5_3H1H : Ball := ⟨(57346330179855185674256162523237 / 50000000000000000000000000000000), (93463376761 / 100000000000000000000000000000000)⟩ +lemma Z0_5_3H1H_sound : Z0_5_3H1H.Encloses (homogeneousEntropy Z0_5_3H1Value) := by + exact contains_sound (homogeneous_enclosed Z0_5_3H1Value Z0_5_3H1MassTerm_sound Z0_5_3H1Entropy_sound) (by decide +kernel) +def Z0_5_3H2Value (a : PairSlot) : ℝ := (halfLaw (shape 0 5 3) 2 a : ℝ) +def Z0_5_3H2E_4_0LogWitness : LogWitness := ⟨-6, 2157810797800214543118318532199, 1562500000000000000000000000000⟩ +def Z0_5_3H2E_4_0Log : Ball := ⟨(-5993868746542471569477025801103 / 1562500000000000000000000000000), (148230766059 / 100000000000000000000000000000000)⟩ +lemma Z0_5_3H2E_4_0Log_sound : Z0_5_3H2E_4_0Log.Encloses (Real.log (Z0_5_3H2Value ((4,0) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound ((Z0_5_3Half_sound 2) ((4,0) : PairSlot)) (w := Z0_5_3H2E_4_0LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z0_5_3H2E_4_0 : Ball := ⟨(8277526209207412807813577207303 / 100000000000000000000000000000000), (6397079 / 200000000000000000000000000000)⟩ +lemma Z0_5_3H2E_4_0_sound : Z0_5_3H2E_4_0.Encloses (Foundation.entropyTerm (Z0_5_3H2Value ((4,0) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z0_5_3Half_sound 2) ((4,0) : PairSlot)) Z0_5_3H2E_4_0Log_sound) (by decide +kernel) +def Z0_5_3H2E_2_1LogWitness : LogWitness := ⟨-2, 4382455112007387232015528108533, 2500000000000000000000000000000⟩ +def Z0_5_3H2E_2_1Log : Ball := ⟨(-41248799889359090223264863826827 / 50000000000000000000000000000000), (63527471247 / 100000000000000000000000000000000)⟩ +lemma Z0_5_3H2E_2_1Log_sound : Z0_5_3H2E_2_1Log.Encloses (Real.log (Z0_5_3H2Value ((2,1) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound ((Z0_5_3Half_sound 2) ((2,1) : PairSlot)) (w := Z0_5_3H2E_2_1LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z0_5_3H2E_2_1 : Ball := ⟨(18077101393929149380776110958019 / 50000000000000000000000000000000), (5568125837 / 20000000000000000000000000000000)⟩ +lemma Z0_5_3H2E_2_1_sound : Z0_5_3H2E_2_1.Encloses (Foundation.entropyTerm (Z0_5_3H2Value ((2,1) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z0_5_3Half_sound 2) ((2,1) : PairSlot)) Z0_5_3H2E_2_1Log_sound) (by decide +kernel) +def Z0_5_3H2E_3_1LogWitness : LogWitness := ⟨-5, 4017638082125913136726400382471, 3125000000000000000000000000000⟩ +def Z0_5_3H2E_3_1Log : Ball := ⟨(-321447599778718180446529670366099 / 100000000000000000000000000000000), (127054942197 / 100000000000000000000000000000000)⟩ +lemma Z0_5_3H2E_3_1Log_sound : Z0_5_3H2E_3_1Log.Encloses (Real.log (Z0_5_3H2Value ((3,1) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound ((Z0_5_3Half_sound 2) ((3,1) : PairSlot)) (w := Z0_5_3H2E_3_1LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z0_5_3H2E_3_1 : Ball := ⟨(1614325147848684263111295424987 / 12500000000000000000000000000000), (5104607757 / 100000000000000000000000000000000)⟩ +lemma Z0_5_3H2E_3_1_sound : Z0_5_3H2E_3_1.Encloses (Foundation.entropyTerm (Z0_5_3H2Value ((3,1) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z0_5_3Half_sound 2) ((3,1) : PairSlot)) Z0_5_3H2E_3_1Log_sound) (by decide +kernel) +def Z0_5_3H2E_1_2LogWitness : LogWitness := ⟨-2, 4382455112007387232015528108533, 2500000000000000000000000000000⟩ +def Z0_5_3H2E_1_2Log : Ball := ⟨(-41248799889359090223264863826827 / 50000000000000000000000000000000), (63527471247 / 100000000000000000000000000000000)⟩ +lemma Z0_5_3H2E_1_2Log_sound : Z0_5_3H2E_1_2Log.Encloses (Real.log (Z0_5_3H2Value ((1,2) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound ((Z0_5_3Half_sound 2) ((1,2) : PairSlot)) (w := Z0_5_3H2E_1_2LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z0_5_3H2E_1_2 : Ball := ⟨(18077101393929149380776110958019 / 50000000000000000000000000000000), (5568125837 / 20000000000000000000000000000000)⟩ +lemma Z0_5_3H2E_1_2_sound : Z0_5_3H2E_1_2.Encloses (Foundation.entropyTerm (Z0_5_3H2Value ((1,2) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z0_5_3Half_sound 2) ((1,2) : PairSlot)) Z0_5_3H2E_1_2Log_sound) (by decide +kernel) +def Z0_5_3H2E_1_3LogWitness : LogWitness := ⟨-5, 4017638082125913136726400382471, 3125000000000000000000000000000⟩ +def Z0_5_3H2E_1_3Log : Ball := ⟨(-321447599778718180446529670366099 / 100000000000000000000000000000000), (127054942197 / 100000000000000000000000000000000)⟩ +lemma Z0_5_3H2E_1_3Log_sound : Z0_5_3H2E_1_3Log.Encloses (Real.log (Z0_5_3H2Value ((1,3) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound ((Z0_5_3Half_sound 2) ((1,3) : PairSlot)) (w := Z0_5_3H2E_1_3LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z0_5_3H2E_1_3 : Ball := ⟨(1614325147848684263111295424987 / 12500000000000000000000000000000), (5104607757 / 100000000000000000000000000000000)⟩ +lemma Z0_5_3H2E_1_3_sound : Z0_5_3H2E_1_3.Encloses (Foundation.entropyTerm (Z0_5_3H2Value ((1,3) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z0_5_3Half_sound 2) ((1,3) : PairSlot)) Z0_5_3H2E_1_3Log_sound) (by decide +kernel) +def Z0_5_3H2E_0_4LogWitness : LogWitness := ⟨-6, 2157810797800214543118318532199, 1562500000000000000000000000000⟩ +def Z0_5_3H2E_0_4Log : Ball := ⟨(-5993868746542471569477025801103 / 1562500000000000000000000000000), (148230766059 / 100000000000000000000000000000000)⟩ +lemma Z0_5_3H2E_0_4Log_sound : Z0_5_3H2E_0_4Log.Encloses (Real.log (Z0_5_3H2Value ((0,4) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound ((Z0_5_3Half_sound 2) ((0,4) : PairSlot)) (w := Z0_5_3H2E_0_4LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z0_5_3H2E_0_4 : Ball := ⟨(8277526209207412807813577207303 / 100000000000000000000000000000000), (6397079 / 200000000000000000000000000000)⟩ +lemma Z0_5_3H2E_0_4_sound : Z0_5_3H2E_0_4.Encloses (Foundation.entropyTerm (Z0_5_3H2Value ((0,4) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z0_5_3Half_sound 2) ((0,4) : PairSlot)) Z0_5_3H2E_0_4Log_sound) (by decide +kernel) +def Z0_5_3H2Terms (a : PairSlot) : Ball := + match a.1.val, a.2.val with + | 4, 0 => ⟨(8277526209207412807813577207303 / 100000000000000000000000000000000), (6397079 / 200000000000000000000000000000)⟩ + | 2, 1 => ⟨(18077101393929149380776110958019 / 50000000000000000000000000000000), (5568125837 / 20000000000000000000000000000000)⟩ + | 3, 1 => ⟨(1614325147848684263111295424987 / 12500000000000000000000000000000), (5104607757 / 100000000000000000000000000000000)⟩ + | 1, 2 => ⟨(18077101393929149380776110958019 / 50000000000000000000000000000000), (5568125837 / 20000000000000000000000000000000)⟩ + | 1, 3 => ⟨(1614325147848684263111295424987 / 12500000000000000000000000000000), (5104607757 / 100000000000000000000000000000000)⟩ + | 0, 4 => ⟨(8277526209207412807813577207303 / 100000000000000000000000000000000), (6397079 / 200000000000000000000000000000)⟩ + | _, _ => (.exact 0) +lemma Z0_5_3H2Terms_sound (a : PairSlot) : + (Z0_5_3H2Terms a).Encloses (Foundation.entropyTerm (Z0_5_3H2Value a)) := by + rcases a with ⟨i,j⟩ + revert j i + apply forall_fin6 + · exact forall_fin6 (entropyTerm_zero_ball ((Z0_5_3Half_sound 2) ((0,0) : PairSlot))) (entropyTerm_zero_ball ((Z0_5_3Half_sound 2) ((0,1) : PairSlot))) (entropyTerm_zero_ball ((Z0_5_3Half_sound 2) ((0,2) : PairSlot))) (entropyTerm_zero_ball ((Z0_5_3Half_sound 2) ((0,3) : PairSlot))) Z0_5_3H2E_0_4_sound (entropyTerm_zero_ball ((Z0_5_3Half_sound 2) ((0,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z0_5_3Half_sound 2) ((1,0) : PairSlot))) (entropyTerm_zero_ball ((Z0_5_3Half_sound 2) ((1,1) : PairSlot))) Z0_5_3H2E_1_2_sound Z0_5_3H2E_1_3_sound (entropyTerm_zero_ball ((Z0_5_3Half_sound 2) ((1,4) : PairSlot))) (entropyTerm_zero_ball ((Z0_5_3Half_sound 2) ((1,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z0_5_3Half_sound 2) ((2,0) : PairSlot))) Z0_5_3H2E_2_1_sound (entropyTerm_zero_ball ((Z0_5_3Half_sound 2) ((2,2) : PairSlot))) (entropyTerm_zero_ball ((Z0_5_3Half_sound 2) ((2,3) : PairSlot))) (entropyTerm_zero_ball ((Z0_5_3Half_sound 2) ((2,4) : PairSlot))) (entropyTerm_zero_ball ((Z0_5_3Half_sound 2) ((2,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z0_5_3Half_sound 2) ((3,0) : PairSlot))) Z0_5_3H2E_3_1_sound (entropyTerm_zero_ball ((Z0_5_3Half_sound 2) ((3,2) : PairSlot))) (entropyTerm_zero_ball ((Z0_5_3Half_sound 2) ((3,3) : PairSlot))) (entropyTerm_zero_ball ((Z0_5_3Half_sound 2) ((3,4) : PairSlot))) (entropyTerm_zero_ball ((Z0_5_3Half_sound 2) ((3,5) : PairSlot))) + · exact forall_fin6 Z0_5_3H2E_4_0_sound (entropyTerm_zero_ball ((Z0_5_3Half_sound 2) ((4,1) : PairSlot))) (entropyTerm_zero_ball ((Z0_5_3Half_sound 2) ((4,2) : PairSlot))) (entropyTerm_zero_ball ((Z0_5_3Half_sound 2) ((4,3) : PairSlot))) (entropyTerm_zero_ball ((Z0_5_3Half_sound 2) ((4,4) : PairSlot))) (entropyTerm_zero_ball ((Z0_5_3Half_sound 2) ((4,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z0_5_3Half_sound 2) ((5,0) : PairSlot))) (entropyTerm_zero_ball ((Z0_5_3Half_sound 2) ((5,1) : PairSlot))) (entropyTerm_zero_ball ((Z0_5_3Half_sound 2) ((5,2) : PairSlot))) (entropyTerm_zero_ball ((Z0_5_3Half_sound 2) ((5,3) : PairSlot))) (entropyTerm_zero_ball ((Z0_5_3Half_sound 2) ((5,4) : PairSlot))) (entropyTerm_zero_ball ((Z0_5_3Half_sound 2) ((5,5) : PairSlot))) +def Z0_5_3H2Entropy : Ball := ⟨(57346330179855185674256162523237 / 50000000000000000000000000000000), (18071888221 / 25000000000000000000000000000000)⟩ +lemma Z0_5_3H2Entropy_sound : Z0_5_3H2Entropy.Encloses (Foundation.finiteEntropy Z0_5_3H2Value) := by + exact contains_sound (entropyPair_enclosed Z0_5_3H2Value Z0_5_3H2Terms Z0_5_3H2Terms_sound) (by decide +kernel) +def Z0_5_3H2Mass : Ball := ⟨1, (97 / 50000000000000000000000000000000)⟩ +lemma Z0_5_3H2Mass_sound : Z0_5_3H2Mass.Encloses (∑ a, Z0_5_3H2Value a) := by + exact contains_sound (pairSumBall_sound (Z0_5_3Half 2) Z0_5_3H2Value (Z0_5_3Half_sound 2)) (by decide +kernel) +def Z0_5_3H2MassTermLogWitness : LogWitness := ⟨0, 1, 1⟩ +def Z0_5_3H2MassTermLog : Ball := ⟨0, (5293955969 / 25000000000000000000000000000000)⟩ +lemma Z0_5_3H2MassTermLog_sound : Z0_5_3H2MassTermLog.Encloses (Real.log ((∑ a, Z0_5_3H2Value a))) := by + exact checkLog_sound logTwoBall_sound (Z0_5_3H2Mass_sound) (w := Z0_5_3H2MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z0_5_3H2MassTerm : Ball := ⟨0, (21175823877 / 100000000000000000000000000000000)⟩ +lemma Z0_5_3H2MassTerm_sound : Z0_5_3H2MassTerm.Encloses (Foundation.entropyTerm ((∑ a, Z0_5_3H2Value a))) := by + exact contains_sound (entropyTerm_ball (Z0_5_3H2Mass_sound) Z0_5_3H2MassTermLog_sound) (by decide +kernel) +def Z0_5_3H2H : Ball := ⟨(57346330179855185674256162523237 / 50000000000000000000000000000000), (93463376761 / 100000000000000000000000000000000)⟩ +lemma Z0_5_3H2H_sound : Z0_5_3H2H.Encloses (homogeneousEntropy Z0_5_3H2Value) := by + exact contains_sound (homogeneous_enclosed Z0_5_3H2Value Z0_5_3H2MassTerm_sound Z0_5_3H2Entropy_sound) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/Certificates/Four0_7_1.lean b/lean/OAI/LinearAlgebra/MatrixFields/Certificates/Four0_7_1.lean new file mode 100644 index 0000000000000000000000000000000000000000..9e3a704811bcca89fe3ca6cde99fa3a1bb4e5e41 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/Certificates/Four0_7_1.lean @@ -0,0 +1,455 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Certificates.Zero0_1_7 + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def Z0_7_1Raw (ij : PairSlot) : Ball := + match ij.1.val, ij.2.val with + | 0, 0 => w195 + | 0, 1 => w195 + | 0, 2 => w195 + | 0, 3 => w195 + | 0, 4 => w195 + | 0, 5 => w195 + | 1, 0 => w195 + | 1, 1 => w195 + | 1, 2 => w195 + | 1, 3 => w195 + | 1, 4 => w195 + | 1, 5 => w195 + | 2, 0 => w195 + | 2, 1 => w195 + | 2, 2 => w195 + | 2, 3 => w195 + | 2, 4 => w195 + | 2, 5 => w195 + | 3, 0 => w195 + | 3, 1 => w195 + | 3, 2 => w195 + | 3, 3 => w195 + | 3, 4 => w195 + | 3, 5 => w195 + | 4, 0 => w195 + | 4, 1 => w195 + | 4, 2 => w195 + | 4, 3 => w195 + | 4, 4 => w195 + | 4, 5 => w195 + | 5, 0 => w195 + | 5, 1 => w195 + | 5, 2 => w195 + | 5, 3 => w195 + | 5, 4 => w195 + | 5, 5 => w195 + | _, _ => (.exact 0) +lemma Z0_7_1Raw_sound_0 (j : Fin 6) : + (Z0_7_1Raw (0,j)).Encloses (weight (orderedPairInteger (shape 0 7 1) 0 j) : ℝ) := by + fin_cases j + · change (Z0_7_1Raw (0,0)).Encloses (weight (orderedPairInteger (shape 0 7 1) 0 0) : ℝ) + have he : orderedPairInteger (shape 0 7 1) 0 0 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_7_1Raw (0,1)).Encloses (weight (orderedPairInteger (shape 0 7 1) 0 1) : ℝ) + have he : orderedPairInteger (shape 0 7 1) 0 1 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_7_1Raw (0,2)).Encloses (weight (orderedPairInteger (shape 0 7 1) 0 2) : ℝ) + have he : orderedPairInteger (shape 0 7 1) 0 2 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_7_1Raw (0,3)).Encloses (weight (orderedPairInteger (shape 0 7 1) 0 3) : ℝ) + have he : orderedPairInteger (shape 0 7 1) 0 3 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_7_1Raw (0,4)).Encloses (weight (orderedPairInteger (shape 0 7 1) 0 4) : ℝ) + have he : orderedPairInteger (shape 0 7 1) 0 4 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_7_1Raw (0,5)).Encloses (weight (orderedPairInteger (shape 0 7 1) 0 5) : ℝ) + have he : orderedPairInteger (shape 0 7 1) 0 5 = (0) := by decide +kernel + rw [he] + exact w195_sound +lemma Z0_7_1Raw_sound_1 (j : Fin 6) : + (Z0_7_1Raw (1,j)).Encloses (weight (orderedPairInteger (shape 0 7 1) 1 j) : ℝ) := by + fin_cases j + · change (Z0_7_1Raw (1,0)).Encloses (weight (orderedPairInteger (shape 0 7 1) 1 0) : ℝ) + have he : orderedPairInteger (shape 0 7 1) 1 0 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_7_1Raw (1,1)).Encloses (weight (orderedPairInteger (shape 0 7 1) 1 1) : ℝ) + have he : orderedPairInteger (shape 0 7 1) 1 1 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_7_1Raw (1,2)).Encloses (weight (orderedPairInteger (shape 0 7 1) 1 2) : ℝ) + have he : orderedPairInteger (shape 0 7 1) 1 2 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_7_1Raw (1,3)).Encloses (weight (orderedPairInteger (shape 0 7 1) 1 3) : ℝ) + have he : orderedPairInteger (shape 0 7 1) 1 3 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_7_1Raw (1,4)).Encloses (weight (orderedPairInteger (shape 0 7 1) 1 4) : ℝ) + have he : orderedPairInteger (shape 0 7 1) 1 4 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_7_1Raw (1,5)).Encloses (weight (orderedPairInteger (shape 0 7 1) 1 5) : ℝ) + have he : orderedPairInteger (shape 0 7 1) 1 5 = (0) := by decide +kernel + rw [he] + exact w195_sound +lemma Z0_7_1Raw_sound_2 (j : Fin 6) : + (Z0_7_1Raw (2,j)).Encloses (weight (orderedPairInteger (shape 0 7 1) 2 j) : ℝ) := by + fin_cases j + · change (Z0_7_1Raw (2,0)).Encloses (weight (orderedPairInteger (shape 0 7 1) 2 0) : ℝ) + have he : orderedPairInteger (shape 0 7 1) 2 0 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_7_1Raw (2,1)).Encloses (weight (orderedPairInteger (shape 0 7 1) 2 1) : ℝ) + have he : orderedPairInteger (shape 0 7 1) 2 1 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_7_1Raw (2,2)).Encloses (weight (orderedPairInteger (shape 0 7 1) 2 2) : ℝ) + have he : orderedPairInteger (shape 0 7 1) 2 2 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_7_1Raw (2,3)).Encloses (weight (orderedPairInteger (shape 0 7 1) 2 3) : ℝ) + have he : orderedPairInteger (shape 0 7 1) 2 3 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_7_1Raw (2,4)).Encloses (weight (orderedPairInteger (shape 0 7 1) 2 4) : ℝ) + have he : orderedPairInteger (shape 0 7 1) 2 4 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_7_1Raw (2,5)).Encloses (weight (orderedPairInteger (shape 0 7 1) 2 5) : ℝ) + have he : orderedPairInteger (shape 0 7 1) 2 5 = (0) := by decide +kernel + rw [he] + exact w195_sound +lemma Z0_7_1Raw_sound_3 (j : Fin 6) : + (Z0_7_1Raw (3,j)).Encloses (weight (orderedPairInteger (shape 0 7 1) 3 j) : ℝ) := by + fin_cases j + · change (Z0_7_1Raw (3,0)).Encloses (weight (orderedPairInteger (shape 0 7 1) 3 0) : ℝ) + have he : orderedPairInteger (shape 0 7 1) 3 0 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_7_1Raw (3,1)).Encloses (weight (orderedPairInteger (shape 0 7 1) 3 1) : ℝ) + have he : orderedPairInteger (shape 0 7 1) 3 1 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_7_1Raw (3,2)).Encloses (weight (orderedPairInteger (shape 0 7 1) 3 2) : ℝ) + have he : orderedPairInteger (shape 0 7 1) 3 2 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_7_1Raw (3,3)).Encloses (weight (orderedPairInteger (shape 0 7 1) 3 3) : ℝ) + have he : orderedPairInteger (shape 0 7 1) 3 3 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_7_1Raw (3,4)).Encloses (weight (orderedPairInteger (shape 0 7 1) 3 4) : ℝ) + have he : orderedPairInteger (shape 0 7 1) 3 4 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_7_1Raw (3,5)).Encloses (weight (orderedPairInteger (shape 0 7 1) 3 5) : ℝ) + have he : orderedPairInteger (shape 0 7 1) 3 5 = (0) := by decide +kernel + rw [he] + exact w195_sound +lemma Z0_7_1Raw_sound_4 (j : Fin 6) : + (Z0_7_1Raw (4,j)).Encloses (weight (orderedPairInteger (shape 0 7 1) 4 j) : ℝ) := by + fin_cases j + · change (Z0_7_1Raw (4,0)).Encloses (weight (orderedPairInteger (shape 0 7 1) 4 0) : ℝ) + have he : orderedPairInteger (shape 0 7 1) 4 0 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_7_1Raw (4,1)).Encloses (weight (orderedPairInteger (shape 0 7 1) 4 1) : ℝ) + have he : orderedPairInteger (shape 0 7 1) 4 1 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_7_1Raw (4,2)).Encloses (weight (orderedPairInteger (shape 0 7 1) 4 2) : ℝ) + have he : orderedPairInteger (shape 0 7 1) 4 2 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_7_1Raw (4,3)).Encloses (weight (orderedPairInteger (shape 0 7 1) 4 3) : ℝ) + have he : orderedPairInteger (shape 0 7 1) 4 3 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_7_1Raw (4,4)).Encloses (weight (orderedPairInteger (shape 0 7 1) 4 4) : ℝ) + have he : orderedPairInteger (shape 0 7 1) 4 4 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_7_1Raw (4,5)).Encloses (weight (orderedPairInteger (shape 0 7 1) 4 5) : ℝ) + have he : orderedPairInteger (shape 0 7 1) 4 5 = (0) := by decide +kernel + rw [he] + exact w195_sound +lemma Z0_7_1Raw_sound_5 (j : Fin 6) : + (Z0_7_1Raw (5,j)).Encloses (weight (orderedPairInteger (shape 0 7 1) 5 j) : ℝ) := by + fin_cases j + · change (Z0_7_1Raw (5,0)).Encloses (weight (orderedPairInteger (shape 0 7 1) 5 0) : ℝ) + have he : orderedPairInteger (shape 0 7 1) 5 0 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_7_1Raw (5,1)).Encloses (weight (orderedPairInteger (shape 0 7 1) 5 1) : ℝ) + have he : orderedPairInteger (shape 0 7 1) 5 1 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_7_1Raw (5,2)).Encloses (weight (orderedPairInteger (shape 0 7 1) 5 2) : ℝ) + have he : orderedPairInteger (shape 0 7 1) 5 2 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_7_1Raw (5,3)).Encloses (weight (orderedPairInteger (shape 0 7 1) 5 3) : ℝ) + have he : orderedPairInteger (shape 0 7 1) 5 3 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_7_1Raw (5,4)).Encloses (weight (orderedPairInteger (shape 0 7 1) 5 4) : ℝ) + have he : orderedPairInteger (shape 0 7 1) 5 4 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_7_1Raw (5,5)).Encloses (weight (orderedPairInteger (shape 0 7 1) 5 5) : ℝ) + have he : orderedPairInteger (shape 0 7 1) 5 5 = (0) := by decide +kernel + rw [he] + exact w195_sound +lemma Z0_7_1Raw_sound (ij : PairSlot) : + (Z0_7_1Raw ij).Encloses (weight (orderedPairInteger (shape 0 7 1) ij.1 ij.2) : ℝ) := by + rcases ij with ⟨i,j⟩ + revert i + exact forall_fin6 (Z0_7_1Raw_sound_0 j) (Z0_7_1Raw_sound_1 j) (Z0_7_1Raw_sound_2 j) (Z0_7_1Raw_sound_3 j) (Z0_7_1Raw_sound_4 j) (Z0_7_1Raw_sound_5 j) +def Z0_7_1Den : Ball := ⟨2, 0⟩ +lemma Z0_7_1Den_sound : Z0_7_1Den.Encloses + (((orderedPairs (shape 0 7 1)).map (fun ij => weight (orderedPairInteger (shape 0 7 1) ij.1 ij.2))).sum : ℝ) := by + exact contains_sound (list_cast_enclosed (orderedPairs (shape 0 7 1)) Z0_7_1Raw + (fun ij => weight (orderedPairInteger (shape 0 7 1) ij.1 ij.2)) + (fun ij _ => Z0_7_1Raw_sound ij)) (by decide +kernel) +lemma Z0_7_1Den_pos : 0 < Z0_7_1Den.lower := by decide +kernel +def Z0_7_1Probs (ij : PairSlot) : Ball := + match ij.1.val, ij.2.val with + | 4, 5 => ⟨(1 / 2), 0⟩ + | 5, 4 => ⟨(1 / 2), 0⟩ + | _, _ => (.exact 0) +lemma Z0_7_1Contains : ∀ i j : Fin 6, + statisticWeight i + statisticWeight j = shapeMax (shape 0 7 1) → + contains (.mul (Z0_7_1Raw (i,j)) (.inv Z0_7_1Den)) (Z0_7_1Probs (i,j)) = true := by + decide +kernel +lemma Z0_7_1Zero : ∀ i j : Fin 6, + statisticWeight i + statisticWeight j ≠ shapeMax (shape 0 7 1) → Z0_7_1Probs (i,j) = .exact 0 := by + decide +kernel +lemma Z0_7_1Probs_sound (ij : PairSlot) : + (Z0_7_1Probs ij).Encloses (zeroPairLaw (shape 0 7 1) ij.1 ij.2 : ℝ) := by + by_cases h : statisticWeight ij.1 + statisticWeight ij.2 = shapeMax (shape 0 7 1) + · have hb := contains_sound (Ball.mul_sound (Z0_7_1Raw_sound ij) + (Ball.inv_sound Z0_7_1Den_sound Z0_7_1Den_pos)) (Z0_7_1Contains ij.1 ij.2 h) + simpa only [zeroPairLaw, h, ite_true, Rat.cast_div, Rat.cast_mul, + Rat.cast_inv, div_eq_mul_inv] using hb + · rw [Z0_7_1Zero ij.1 ij.2 h] + simpa only [zeroPairLaw, h, ite_false] using Ball.exact_sound 0 + +def Z0_7_1Half (w : Fin 3) (ij : PairSlot) : Ball := + if (shape 0 7 1) w = 0 then if ij = (0,0) then .exact 1 else .exact 0 + else if w = halfMaxAxis (shape 0 7 1) then Z0_7_1Probs ij + else Z0_7_1Probs (kappa ij.1, kappa ij.2) +lemma Z0_7_1Half_sound (w : Fin 3) (ij : PairSlot) : + (Z0_7_1Half w ij).Encloses (halfLaw (shape 0 7 1) w ij : ℝ) := by + have hp : positive (shape 0 7 1) = false := by decide +kernel + simp only [Z0_7_1Half, halfLaw, hp, Bool.false_eq_true, ite_false] + split_ifs + · exact Ball.exact_sound 1 + · exact Ball.exact_sound 0 + · exact Z0_7_1Probs_sound _ + · exact Z0_7_1Probs_sound _ + +def Z0_7_1Value (a : PairSlot) : ℝ := (zeroPairLaw (shape 0 7 1) a.1 a.2 : ℝ) +def Z0_7_1E_4_5LogWitness : LogWitness := ⟨-1, 1, 1⟩ +def Z0_7_1E_4_5Log : Ball := ⟨(-6931471805599453094172319305033 / 10000000000000000000000000000000), (8470329473 / 20000000000000000000000000000000)⟩ +lemma Z0_7_1E_4_5Log_sound : Z0_7_1E_4_5Log.Encloses (Real.log (Z0_7_1Value ((4,5) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound (Z0_7_1Probs_sound ((4,5) : PairSlot)) (w := Z0_7_1E_4_5LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z0_7_1E_4_5 : Ball := ⟨(6931471805599453094172319305033 / 20000000000000000000000000000000), (21175823683 / 100000000000000000000000000000000)⟩ +lemma Z0_7_1E_4_5_sound : Z0_7_1E_4_5.Encloses (Foundation.entropyTerm (Z0_7_1Value ((4,5) : PairSlot))) := by + exact contains_sound (entropyTerm_ball (Z0_7_1Probs_sound ((4,5) : PairSlot)) Z0_7_1E_4_5Log_sound) (by decide +kernel) +def Z0_7_1E_5_4LogWitness : LogWitness := ⟨-1, 1, 1⟩ +def Z0_7_1E_5_4Log : Ball := ⟨(-6931471805599453094172319305033 / 10000000000000000000000000000000), (8470329473 / 20000000000000000000000000000000)⟩ +lemma Z0_7_1E_5_4Log_sound : Z0_7_1E_5_4Log.Encloses (Real.log (Z0_7_1Value ((5,4) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound (Z0_7_1Probs_sound ((5,4) : PairSlot)) (w := Z0_7_1E_5_4LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z0_7_1E_5_4 : Ball := ⟨(6931471805599453094172319305033 / 20000000000000000000000000000000), (21175823683 / 100000000000000000000000000000000)⟩ +lemma Z0_7_1E_5_4_sound : Z0_7_1E_5_4.Encloses (Foundation.entropyTerm (Z0_7_1Value ((5,4) : PairSlot))) := by + exact contains_sound (entropyTerm_ball (Z0_7_1Probs_sound ((5,4) : PairSlot)) Z0_7_1E_5_4Log_sound) (by decide +kernel) +def Z0_7_1Terms (a : PairSlot) : Ball := + match a.1.val, a.2.val with + | 4, 5 => ⟨(6931471805599453094172319305033 / 20000000000000000000000000000000), (21175823683 / 100000000000000000000000000000000)⟩ + | 5, 4 => ⟨(6931471805599453094172319305033 / 20000000000000000000000000000000), (21175823683 / 100000000000000000000000000000000)⟩ + | _, _ => (.exact 0) +lemma Z0_7_1Terms_sound (a : PairSlot) : + (Z0_7_1Terms a).Encloses (Foundation.entropyTerm (Z0_7_1Value a)) := by + rcases a with ⟨i,j⟩ + revert j i + apply forall_fin6 + · exact forall_fin6 (entropyTerm_zero_ball (Z0_7_1Probs_sound ((0,0) : PairSlot))) (entropyTerm_zero_ball (Z0_7_1Probs_sound ((0,1) : PairSlot))) (entropyTerm_zero_ball (Z0_7_1Probs_sound ((0,2) : PairSlot))) (entropyTerm_zero_ball (Z0_7_1Probs_sound ((0,3) : PairSlot))) (entropyTerm_zero_ball (Z0_7_1Probs_sound ((0,4) : PairSlot))) (entropyTerm_zero_ball (Z0_7_1Probs_sound ((0,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball (Z0_7_1Probs_sound ((1,0) : PairSlot))) (entropyTerm_zero_ball (Z0_7_1Probs_sound ((1,1) : PairSlot))) (entropyTerm_zero_ball (Z0_7_1Probs_sound ((1,2) : PairSlot))) (entropyTerm_zero_ball (Z0_7_1Probs_sound ((1,3) : PairSlot))) (entropyTerm_zero_ball (Z0_7_1Probs_sound ((1,4) : PairSlot))) (entropyTerm_zero_ball (Z0_7_1Probs_sound ((1,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball (Z0_7_1Probs_sound ((2,0) : PairSlot))) (entropyTerm_zero_ball (Z0_7_1Probs_sound ((2,1) : PairSlot))) (entropyTerm_zero_ball (Z0_7_1Probs_sound ((2,2) : PairSlot))) (entropyTerm_zero_ball (Z0_7_1Probs_sound ((2,3) : PairSlot))) (entropyTerm_zero_ball (Z0_7_1Probs_sound ((2,4) : PairSlot))) (entropyTerm_zero_ball (Z0_7_1Probs_sound ((2,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball (Z0_7_1Probs_sound ((3,0) : PairSlot))) (entropyTerm_zero_ball (Z0_7_1Probs_sound ((3,1) : PairSlot))) (entropyTerm_zero_ball (Z0_7_1Probs_sound ((3,2) : PairSlot))) (entropyTerm_zero_ball (Z0_7_1Probs_sound ((3,3) : PairSlot))) (entropyTerm_zero_ball (Z0_7_1Probs_sound ((3,4) : PairSlot))) (entropyTerm_zero_ball (Z0_7_1Probs_sound ((3,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball (Z0_7_1Probs_sound ((4,0) : PairSlot))) (entropyTerm_zero_ball (Z0_7_1Probs_sound ((4,1) : PairSlot))) (entropyTerm_zero_ball (Z0_7_1Probs_sound ((4,2) : PairSlot))) (entropyTerm_zero_ball (Z0_7_1Probs_sound ((4,3) : PairSlot))) (entropyTerm_zero_ball (Z0_7_1Probs_sound ((4,4) : PairSlot))) Z0_7_1E_4_5_sound + · exact forall_fin6 (entropyTerm_zero_ball (Z0_7_1Probs_sound ((5,0) : PairSlot))) (entropyTerm_zero_ball (Z0_7_1Probs_sound ((5,1) : PairSlot))) (entropyTerm_zero_ball (Z0_7_1Probs_sound ((5,2) : PairSlot))) (entropyTerm_zero_ball (Z0_7_1Probs_sound ((5,3) : PairSlot))) Z0_7_1E_5_4_sound (entropyTerm_zero_ball (Z0_7_1Probs_sound ((5,5) : PairSlot))) +def Z0_7_1Entropy : Ball := ⟨(6931471805599453094172319305033 / 10000000000000000000000000000000), (21175823683 / 50000000000000000000000000000000)⟩ +lemma Z0_7_1Entropy_sound : Z0_7_1Entropy.Encloses (Foundation.finiteEntropy Z0_7_1Value) := by + exact contains_sound (entropyPair_enclosed Z0_7_1Value Z0_7_1Terms Z0_7_1Terms_sound) (by decide +kernel) +def Z0_7_1Labels : Ball := ⟨(115129254649702284200899544090987 / 50000000000000000000000000000000), (21175823683 / 25000000000000000000000000000000)⟩ +lemma Z0_7_1Labels_sound : Z0_7_1Labels.Encloses + (∑ a : PairSlot, (zeroPairLaw (shape 0 7 1) a.1 a.2 : ℝ) * + Real.log (AllFieldParameters.multiplicity a.1 * AllFieldParameters.multiplicity a.2 : ℕ)) := by + exact contains_sound (pairSumBall_sound (fun a => .mul (Z0_7_1Probs a) (multLogs a)) + _ (fun a => Ball.mul_sound (Z0_7_1Probs_sound a) (multLogs_sound a))) (by decide +kernel) +def Z0_7_1Four : Ball := ⟨(18723326709712443708970142577019 / 6250000000000000000000000000000), (63527471049 / 50000000000000000000000000000000)⟩ +lemma Z0_7_1Four_sound : Z0_7_1Four.Encloses (AllFieldZeroLeafRates.fourRate (shape 0 7 1)) := by + exact contains_sound (Ball.add_sound Z0_7_1Entropy_sound Z0_7_1Labels_sound) (by decide +kernel) +def Z0_7_1H0Value (a : PairSlot) : ℝ := (halfLaw (shape 0 7 1) 0 a : ℝ) +def Z0_7_1H0E_0_0Log : Ball := .exact 0 +lemma Z0_7_1H0E_0_0Log_sound : Z0_7_1H0E_0_0Log.Encloses (Real.log (Z0_7_1H0Value ((0,0) : PairSlot))) := by + exact log_exact_one_ball ((Z0_7_1Half_sound 0) ((0,0) : PairSlot)) +def Z0_7_1H0E_0_0 : Ball := ⟨0, 0⟩ +lemma Z0_7_1H0E_0_0_sound : Z0_7_1H0E_0_0.Encloses (Foundation.entropyTerm (Z0_7_1H0Value ((0,0) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z0_7_1Half_sound 0) ((0,0) : PairSlot)) Z0_7_1H0E_0_0Log_sound) (by decide +kernel) +def Z0_7_1H0Terms (a : PairSlot) : Ball := + match a.1.val, a.2.val with + | 0, 0 => ⟨0, 0⟩ + | _, _ => (.exact 0) +lemma Z0_7_1H0Terms_sound (a : PairSlot) : + (Z0_7_1H0Terms a).Encloses (Foundation.entropyTerm (Z0_7_1H0Value a)) := by + rcases a with ⟨i,j⟩ + revert j i + apply forall_fin6 + · exact forall_fin6 Z0_7_1H0E_0_0_sound (entropyTerm_zero_ball ((Z0_7_1Half_sound 0) ((0,1) : PairSlot))) (entropyTerm_zero_ball ((Z0_7_1Half_sound 0) ((0,2) : PairSlot))) (entropyTerm_zero_ball ((Z0_7_1Half_sound 0) ((0,3) : PairSlot))) (entropyTerm_zero_ball ((Z0_7_1Half_sound 0) ((0,4) : PairSlot))) (entropyTerm_zero_ball ((Z0_7_1Half_sound 0) ((0,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z0_7_1Half_sound 0) ((1,0) : PairSlot))) (entropyTerm_zero_ball ((Z0_7_1Half_sound 0) ((1,1) : PairSlot))) (entropyTerm_zero_ball ((Z0_7_1Half_sound 0) ((1,2) : PairSlot))) (entropyTerm_zero_ball ((Z0_7_1Half_sound 0) ((1,3) : PairSlot))) (entropyTerm_zero_ball ((Z0_7_1Half_sound 0) ((1,4) : PairSlot))) (entropyTerm_zero_ball ((Z0_7_1Half_sound 0) ((1,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z0_7_1Half_sound 0) ((2,0) : PairSlot))) (entropyTerm_zero_ball ((Z0_7_1Half_sound 0) ((2,1) : PairSlot))) (entropyTerm_zero_ball ((Z0_7_1Half_sound 0) ((2,2) : PairSlot))) (entropyTerm_zero_ball ((Z0_7_1Half_sound 0) ((2,3) : PairSlot))) (entropyTerm_zero_ball ((Z0_7_1Half_sound 0) ((2,4) : PairSlot))) (entropyTerm_zero_ball ((Z0_7_1Half_sound 0) ((2,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z0_7_1Half_sound 0) ((3,0) : PairSlot))) (entropyTerm_zero_ball ((Z0_7_1Half_sound 0) ((3,1) : PairSlot))) (entropyTerm_zero_ball ((Z0_7_1Half_sound 0) ((3,2) : PairSlot))) (entropyTerm_zero_ball ((Z0_7_1Half_sound 0) ((3,3) : PairSlot))) (entropyTerm_zero_ball ((Z0_7_1Half_sound 0) ((3,4) : PairSlot))) (entropyTerm_zero_ball ((Z0_7_1Half_sound 0) ((3,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z0_7_1Half_sound 0) ((4,0) : PairSlot))) (entropyTerm_zero_ball ((Z0_7_1Half_sound 0) ((4,1) : PairSlot))) (entropyTerm_zero_ball ((Z0_7_1Half_sound 0) ((4,2) : PairSlot))) (entropyTerm_zero_ball ((Z0_7_1Half_sound 0) ((4,3) : PairSlot))) (entropyTerm_zero_ball ((Z0_7_1Half_sound 0) ((4,4) : PairSlot))) (entropyTerm_zero_ball ((Z0_7_1Half_sound 0) ((4,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z0_7_1Half_sound 0) ((5,0) : PairSlot))) (entropyTerm_zero_ball ((Z0_7_1Half_sound 0) ((5,1) : PairSlot))) (entropyTerm_zero_ball ((Z0_7_1Half_sound 0) ((5,2) : PairSlot))) (entropyTerm_zero_ball ((Z0_7_1Half_sound 0) ((5,3) : PairSlot))) (entropyTerm_zero_ball ((Z0_7_1Half_sound 0) ((5,4) : PairSlot))) (entropyTerm_zero_ball ((Z0_7_1Half_sound 0) ((5,5) : PairSlot))) +def Z0_7_1H0Entropy : Ball := ⟨0, 0⟩ +lemma Z0_7_1H0Entropy_sound : Z0_7_1H0Entropy.Encloses (Foundation.finiteEntropy Z0_7_1H0Value) := by + exact contains_sound (entropyPair_enclosed Z0_7_1H0Value Z0_7_1H0Terms Z0_7_1H0Terms_sound) (by decide +kernel) +def Z0_7_1H0Mass : Ball := ⟨1, 0⟩ +lemma Z0_7_1H0Mass_sound : Z0_7_1H0Mass.Encloses (∑ a, Z0_7_1H0Value a) := by + exact contains_sound (pairSumBall_sound (Z0_7_1Half 0) Z0_7_1H0Value (Z0_7_1Half_sound 0)) (by decide +kernel) +def Z0_7_1H0MassTermLog : Ball := .exact 0 +lemma Z0_7_1H0MassTermLog_sound : Z0_7_1H0MassTermLog.Encloses (Real.log ((∑ a, Z0_7_1H0Value a))) := by + exact log_exact_one_ball (Z0_7_1H0Mass_sound) +def Z0_7_1H0MassTerm : Ball := ⟨0, 0⟩ +lemma Z0_7_1H0MassTerm_sound : Z0_7_1H0MassTerm.Encloses (Foundation.entropyTerm ((∑ a, Z0_7_1H0Value a))) := by + exact contains_sound (entropyTerm_ball (Z0_7_1H0Mass_sound) Z0_7_1H0MassTermLog_sound) (by decide +kernel) +def Z0_7_1H0H : Ball := ⟨0, 0⟩ +lemma Z0_7_1H0H_sound : Z0_7_1H0H.Encloses (homogeneousEntropy Z0_7_1H0Value) := by + exact contains_sound (homogeneous_enclosed Z0_7_1H0Value Z0_7_1H0MassTerm_sound Z0_7_1H0Entropy_sound) (by decide +kernel) +def Z0_7_1H1Value (a : PairSlot) : ℝ := (halfLaw (shape 0 7 1) 1 a : ℝ) +def Z0_7_1H1E_4_5LogWitness : LogWitness := ⟨-1, 1, 1⟩ +def Z0_7_1H1E_4_5Log : Ball := ⟨(-6931471805599453094172319305033 / 10000000000000000000000000000000), (8470329473 / 20000000000000000000000000000000)⟩ +lemma Z0_7_1H1E_4_5Log_sound : Z0_7_1H1E_4_5Log.Encloses (Real.log (Z0_7_1H1Value ((4,5) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound ((Z0_7_1Half_sound 1) ((4,5) : PairSlot)) (w := Z0_7_1H1E_4_5LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z0_7_1H1E_4_5 : Ball := ⟨(6931471805599453094172319305033 / 20000000000000000000000000000000), (21175823683 / 100000000000000000000000000000000)⟩ +lemma Z0_7_1H1E_4_5_sound : Z0_7_1H1E_4_5.Encloses (Foundation.entropyTerm (Z0_7_1H1Value ((4,5) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z0_7_1Half_sound 1) ((4,5) : PairSlot)) Z0_7_1H1E_4_5Log_sound) (by decide +kernel) +def Z0_7_1H1E_5_4LogWitness : LogWitness := ⟨-1, 1, 1⟩ +def Z0_7_1H1E_5_4Log : Ball := ⟨(-6931471805599453094172319305033 / 10000000000000000000000000000000), (8470329473 / 20000000000000000000000000000000)⟩ +lemma Z0_7_1H1E_5_4Log_sound : Z0_7_1H1E_5_4Log.Encloses (Real.log (Z0_7_1H1Value ((5,4) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound ((Z0_7_1Half_sound 1) ((5,4) : PairSlot)) (w := Z0_7_1H1E_5_4LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z0_7_1H1E_5_4 : Ball := ⟨(6931471805599453094172319305033 / 20000000000000000000000000000000), (21175823683 / 100000000000000000000000000000000)⟩ +lemma Z0_7_1H1E_5_4_sound : Z0_7_1H1E_5_4.Encloses (Foundation.entropyTerm (Z0_7_1H1Value ((5,4) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z0_7_1Half_sound 1) ((5,4) : PairSlot)) Z0_7_1H1E_5_4Log_sound) (by decide +kernel) +def Z0_7_1H1Terms (a : PairSlot) : Ball := + match a.1.val, a.2.val with + | 4, 5 => ⟨(6931471805599453094172319305033 / 20000000000000000000000000000000), (21175823683 / 100000000000000000000000000000000)⟩ + | 5, 4 => ⟨(6931471805599453094172319305033 / 20000000000000000000000000000000), (21175823683 / 100000000000000000000000000000000)⟩ + | _, _ => (.exact 0) +lemma Z0_7_1H1Terms_sound (a : PairSlot) : + (Z0_7_1H1Terms a).Encloses (Foundation.entropyTerm (Z0_7_1H1Value a)) := by + rcases a with ⟨i,j⟩ + revert j i + apply forall_fin6 + · exact forall_fin6 (entropyTerm_zero_ball ((Z0_7_1Half_sound 1) ((0,0) : PairSlot))) (entropyTerm_zero_ball ((Z0_7_1Half_sound 1) ((0,1) : PairSlot))) (entropyTerm_zero_ball ((Z0_7_1Half_sound 1) ((0,2) : PairSlot))) (entropyTerm_zero_ball ((Z0_7_1Half_sound 1) ((0,3) : PairSlot))) (entropyTerm_zero_ball ((Z0_7_1Half_sound 1) ((0,4) : PairSlot))) (entropyTerm_zero_ball ((Z0_7_1Half_sound 1) ((0,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z0_7_1Half_sound 1) ((1,0) : PairSlot))) (entropyTerm_zero_ball ((Z0_7_1Half_sound 1) ((1,1) : PairSlot))) (entropyTerm_zero_ball ((Z0_7_1Half_sound 1) ((1,2) : PairSlot))) (entropyTerm_zero_ball ((Z0_7_1Half_sound 1) ((1,3) : PairSlot))) (entropyTerm_zero_ball ((Z0_7_1Half_sound 1) ((1,4) : PairSlot))) (entropyTerm_zero_ball ((Z0_7_1Half_sound 1) ((1,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z0_7_1Half_sound 1) ((2,0) : PairSlot))) (entropyTerm_zero_ball ((Z0_7_1Half_sound 1) ((2,1) : PairSlot))) (entropyTerm_zero_ball ((Z0_7_1Half_sound 1) ((2,2) : PairSlot))) (entropyTerm_zero_ball ((Z0_7_1Half_sound 1) ((2,3) : PairSlot))) (entropyTerm_zero_ball ((Z0_7_1Half_sound 1) ((2,4) : PairSlot))) (entropyTerm_zero_ball ((Z0_7_1Half_sound 1) ((2,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z0_7_1Half_sound 1) ((3,0) : PairSlot))) (entropyTerm_zero_ball ((Z0_7_1Half_sound 1) ((3,1) : PairSlot))) (entropyTerm_zero_ball ((Z0_7_1Half_sound 1) ((3,2) : PairSlot))) (entropyTerm_zero_ball ((Z0_7_1Half_sound 1) ((3,3) : PairSlot))) (entropyTerm_zero_ball ((Z0_7_1Half_sound 1) ((3,4) : PairSlot))) (entropyTerm_zero_ball ((Z0_7_1Half_sound 1) ((3,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z0_7_1Half_sound 1) ((4,0) : PairSlot))) (entropyTerm_zero_ball ((Z0_7_1Half_sound 1) ((4,1) : PairSlot))) (entropyTerm_zero_ball ((Z0_7_1Half_sound 1) ((4,2) : PairSlot))) (entropyTerm_zero_ball ((Z0_7_1Half_sound 1) ((4,3) : PairSlot))) (entropyTerm_zero_ball ((Z0_7_1Half_sound 1) ((4,4) : PairSlot))) Z0_7_1H1E_4_5_sound + · exact forall_fin6 (entropyTerm_zero_ball ((Z0_7_1Half_sound 1) ((5,0) : PairSlot))) (entropyTerm_zero_ball ((Z0_7_1Half_sound 1) ((5,1) : PairSlot))) (entropyTerm_zero_ball ((Z0_7_1Half_sound 1) ((5,2) : PairSlot))) (entropyTerm_zero_ball ((Z0_7_1Half_sound 1) ((5,3) : PairSlot))) Z0_7_1H1E_5_4_sound (entropyTerm_zero_ball ((Z0_7_1Half_sound 1) ((5,5) : PairSlot))) +def Z0_7_1H1Entropy : Ball := ⟨(6931471805599453094172319305033 / 10000000000000000000000000000000), (21175823683 / 50000000000000000000000000000000)⟩ +lemma Z0_7_1H1Entropy_sound : Z0_7_1H1Entropy.Encloses (Foundation.finiteEntropy Z0_7_1H1Value) := by + exact contains_sound (entropyPair_enclosed Z0_7_1H1Value Z0_7_1H1Terms Z0_7_1H1Terms_sound) (by decide +kernel) +def Z0_7_1H1Mass : Ball := ⟨1, 0⟩ +lemma Z0_7_1H1Mass_sound : Z0_7_1H1Mass.Encloses (∑ a, Z0_7_1H1Value a) := by + exact contains_sound (pairSumBall_sound (Z0_7_1Half 1) Z0_7_1H1Value (Z0_7_1Half_sound 1)) (by decide +kernel) +def Z0_7_1H1MassTermLog : Ball := .exact 0 +lemma Z0_7_1H1MassTermLog_sound : Z0_7_1H1MassTermLog.Encloses (Real.log ((∑ a, Z0_7_1H1Value a))) := by + exact log_exact_one_ball (Z0_7_1H1Mass_sound) +def Z0_7_1H1MassTerm : Ball := ⟨0, 0⟩ +lemma Z0_7_1H1MassTerm_sound : Z0_7_1H1MassTerm.Encloses (Foundation.entropyTerm ((∑ a, Z0_7_1H1Value a))) := by + exact contains_sound (entropyTerm_ball (Z0_7_1H1Mass_sound) Z0_7_1H1MassTermLog_sound) (by decide +kernel) +def Z0_7_1H1H : Ball := ⟨(6931471805599453094172319305033 / 10000000000000000000000000000000), (21175823683 / 50000000000000000000000000000000)⟩ +lemma Z0_7_1H1H_sound : Z0_7_1H1H.Encloses (homogeneousEntropy Z0_7_1H1Value) := by + exact contains_sound (homogeneous_enclosed Z0_7_1H1Value Z0_7_1H1MassTerm_sound Z0_7_1H1Entropy_sound) (by decide +kernel) +def Z0_7_1H2Value (a : PairSlot) : ℝ := (halfLaw (shape 0 7 1) 2 a : ℝ) +def Z0_7_1H2E_1_0LogWitness : LogWitness := ⟨-1, 1, 1⟩ +def Z0_7_1H2E_1_0Log : Ball := ⟨(-6931471805599453094172319305033 / 10000000000000000000000000000000), (8470329473 / 20000000000000000000000000000000)⟩ +lemma Z0_7_1H2E_1_0Log_sound : Z0_7_1H2E_1_0Log.Encloses (Real.log (Z0_7_1H2Value ((1,0) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound ((Z0_7_1Half_sound 2) ((1,0) : PairSlot)) (w := Z0_7_1H2E_1_0LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z0_7_1H2E_1_0 : Ball := ⟨(6931471805599453094172319305033 / 20000000000000000000000000000000), (21175823683 / 100000000000000000000000000000000)⟩ +lemma Z0_7_1H2E_1_0_sound : Z0_7_1H2E_1_0.Encloses (Foundation.entropyTerm (Z0_7_1H2Value ((1,0) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z0_7_1Half_sound 2) ((1,0) : PairSlot)) Z0_7_1H2E_1_0Log_sound) (by decide +kernel) +def Z0_7_1H2E_0_1LogWitness : LogWitness := ⟨-1, 1, 1⟩ +def Z0_7_1H2E_0_1Log : Ball := ⟨(-6931471805599453094172319305033 / 10000000000000000000000000000000), (8470329473 / 20000000000000000000000000000000)⟩ +lemma Z0_7_1H2E_0_1Log_sound : Z0_7_1H2E_0_1Log.Encloses (Real.log (Z0_7_1H2Value ((0,1) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound ((Z0_7_1Half_sound 2) ((0,1) : PairSlot)) (w := Z0_7_1H2E_0_1LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z0_7_1H2E_0_1 : Ball := ⟨(6931471805599453094172319305033 / 20000000000000000000000000000000), (21175823683 / 100000000000000000000000000000000)⟩ +lemma Z0_7_1H2E_0_1_sound : Z0_7_1H2E_0_1.Encloses (Foundation.entropyTerm (Z0_7_1H2Value ((0,1) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z0_7_1Half_sound 2) ((0,1) : PairSlot)) Z0_7_1H2E_0_1Log_sound) (by decide +kernel) +def Z0_7_1H2Terms (a : PairSlot) : Ball := + match a.1.val, a.2.val with + | 1, 0 => ⟨(6931471805599453094172319305033 / 20000000000000000000000000000000), (21175823683 / 100000000000000000000000000000000)⟩ + | 0, 1 => ⟨(6931471805599453094172319305033 / 20000000000000000000000000000000), (21175823683 / 100000000000000000000000000000000)⟩ + | _, _ => (.exact 0) +lemma Z0_7_1H2Terms_sound (a : PairSlot) : + (Z0_7_1H2Terms a).Encloses (Foundation.entropyTerm (Z0_7_1H2Value a)) := by + rcases a with ⟨i,j⟩ + revert j i + apply forall_fin6 + · exact forall_fin6 (entropyTerm_zero_ball ((Z0_7_1Half_sound 2) ((0,0) : PairSlot))) Z0_7_1H2E_0_1_sound (entropyTerm_zero_ball ((Z0_7_1Half_sound 2) ((0,2) : PairSlot))) (entropyTerm_zero_ball ((Z0_7_1Half_sound 2) ((0,3) : PairSlot))) (entropyTerm_zero_ball ((Z0_7_1Half_sound 2) ((0,4) : PairSlot))) (entropyTerm_zero_ball ((Z0_7_1Half_sound 2) ((0,5) : PairSlot))) + · exact forall_fin6 Z0_7_1H2E_1_0_sound (entropyTerm_zero_ball ((Z0_7_1Half_sound 2) ((1,1) : PairSlot))) (entropyTerm_zero_ball ((Z0_7_1Half_sound 2) ((1,2) : PairSlot))) (entropyTerm_zero_ball ((Z0_7_1Half_sound 2) ((1,3) : PairSlot))) (entropyTerm_zero_ball ((Z0_7_1Half_sound 2) ((1,4) : PairSlot))) (entropyTerm_zero_ball ((Z0_7_1Half_sound 2) ((1,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z0_7_1Half_sound 2) ((2,0) : PairSlot))) (entropyTerm_zero_ball ((Z0_7_1Half_sound 2) ((2,1) : PairSlot))) (entropyTerm_zero_ball ((Z0_7_1Half_sound 2) ((2,2) : PairSlot))) (entropyTerm_zero_ball ((Z0_7_1Half_sound 2) ((2,3) : PairSlot))) (entropyTerm_zero_ball ((Z0_7_1Half_sound 2) ((2,4) : PairSlot))) (entropyTerm_zero_ball ((Z0_7_1Half_sound 2) ((2,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z0_7_1Half_sound 2) ((3,0) : PairSlot))) (entropyTerm_zero_ball ((Z0_7_1Half_sound 2) ((3,1) : PairSlot))) (entropyTerm_zero_ball ((Z0_7_1Half_sound 2) ((3,2) : PairSlot))) (entropyTerm_zero_ball ((Z0_7_1Half_sound 2) ((3,3) : PairSlot))) (entropyTerm_zero_ball ((Z0_7_1Half_sound 2) ((3,4) : PairSlot))) (entropyTerm_zero_ball ((Z0_7_1Half_sound 2) ((3,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z0_7_1Half_sound 2) ((4,0) : PairSlot))) (entropyTerm_zero_ball ((Z0_7_1Half_sound 2) ((4,1) : PairSlot))) (entropyTerm_zero_ball ((Z0_7_1Half_sound 2) ((4,2) : PairSlot))) (entropyTerm_zero_ball ((Z0_7_1Half_sound 2) ((4,3) : PairSlot))) (entropyTerm_zero_ball ((Z0_7_1Half_sound 2) ((4,4) : PairSlot))) (entropyTerm_zero_ball ((Z0_7_1Half_sound 2) ((4,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z0_7_1Half_sound 2) ((5,0) : PairSlot))) (entropyTerm_zero_ball ((Z0_7_1Half_sound 2) ((5,1) : PairSlot))) (entropyTerm_zero_ball ((Z0_7_1Half_sound 2) ((5,2) : PairSlot))) (entropyTerm_zero_ball ((Z0_7_1Half_sound 2) ((5,3) : PairSlot))) (entropyTerm_zero_ball ((Z0_7_1Half_sound 2) ((5,4) : PairSlot))) (entropyTerm_zero_ball ((Z0_7_1Half_sound 2) ((5,5) : PairSlot))) +def Z0_7_1H2Entropy : Ball := ⟨(6931471805599453094172319305033 / 10000000000000000000000000000000), (21175823683 / 50000000000000000000000000000000)⟩ +lemma Z0_7_1H2Entropy_sound : Z0_7_1H2Entropy.Encloses (Foundation.finiteEntropy Z0_7_1H2Value) := by + exact contains_sound (entropyPair_enclosed Z0_7_1H2Value Z0_7_1H2Terms Z0_7_1H2Terms_sound) (by decide +kernel) +def Z0_7_1H2Mass : Ball := ⟨1, 0⟩ +lemma Z0_7_1H2Mass_sound : Z0_7_1H2Mass.Encloses (∑ a, Z0_7_1H2Value a) := by + exact contains_sound (pairSumBall_sound (Z0_7_1Half 2) Z0_7_1H2Value (Z0_7_1Half_sound 2)) (by decide +kernel) +def Z0_7_1H2MassTermLog : Ball := .exact 0 +lemma Z0_7_1H2MassTermLog_sound : Z0_7_1H2MassTermLog.Encloses (Real.log ((∑ a, Z0_7_1H2Value a))) := by + exact log_exact_one_ball (Z0_7_1H2Mass_sound) +def Z0_7_1H2MassTerm : Ball := ⟨0, 0⟩ +lemma Z0_7_1H2MassTerm_sound : Z0_7_1H2MassTerm.Encloses (Foundation.entropyTerm ((∑ a, Z0_7_1H2Value a))) := by + exact contains_sound (entropyTerm_ball (Z0_7_1H2Mass_sound) Z0_7_1H2MassTermLog_sound) (by decide +kernel) +def Z0_7_1H2H : Ball := ⟨(6931471805599453094172319305033 / 10000000000000000000000000000000), (21175823683 / 50000000000000000000000000000000)⟩ +lemma Z0_7_1H2H_sound : Z0_7_1H2H.Encloses (homogeneousEntropy Z0_7_1H2Value) := by + exact contains_sound (homogeneous_enclosed Z0_7_1H2Value Z0_7_1H2MassTerm_sound Z0_7_1H2Entropy_sound) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/Certificates/Four0_8_0.lean b/lean/OAI/LinearAlgebra/MatrixFields/Certificates/Four0_8_0.lean new file mode 100644 index 0000000000000000000000000000000000000000..41fa31b13709892356f6907d108077a564f11f92 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/Certificates/Four0_8_0.lean @@ -0,0 +1,415 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Certificates.Zero0_1_7 + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def Z0_8_0Raw (ij : PairSlot) : Ball := + match ij.1.val, ij.2.val with + | 0, 0 => w195 + | 0, 1 => w195 + | 0, 2 => w195 + | 0, 3 => w195 + | 0, 4 => w195 + | 0, 5 => w195 + | 1, 0 => w195 + | 1, 1 => w195 + | 1, 2 => w195 + | 1, 3 => w195 + | 1, 4 => w195 + | 1, 5 => w195 + | 2, 0 => w195 + | 2, 1 => w195 + | 2, 2 => w195 + | 2, 3 => w195 + | 2, 4 => w195 + | 2, 5 => w195 + | 3, 0 => w195 + | 3, 1 => w195 + | 3, 2 => w195 + | 3, 3 => w195 + | 3, 4 => w195 + | 3, 5 => w195 + | 4, 0 => w195 + | 4, 1 => w195 + | 4, 2 => w195 + | 4, 3 => w195 + | 4, 4 => w195 + | 4, 5 => w195 + | 5, 0 => w195 + | 5, 1 => w195 + | 5, 2 => w195 + | 5, 3 => w195 + | 5, 4 => w195 + | 5, 5 => w195 + | _, _ => (.exact 0) +lemma Z0_8_0Raw_sound_0 (j : Fin 6) : + (Z0_8_0Raw (0,j)).Encloses (weight (orderedPairInteger (shape 0 8 0) 0 j) : ℝ) := by + fin_cases j + · change (Z0_8_0Raw (0,0)).Encloses (weight (orderedPairInteger (shape 0 8 0) 0 0) : ℝ) + have he : orderedPairInteger (shape 0 8 0) 0 0 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_8_0Raw (0,1)).Encloses (weight (orderedPairInteger (shape 0 8 0) 0 1) : ℝ) + have he : orderedPairInteger (shape 0 8 0) 0 1 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_8_0Raw (0,2)).Encloses (weight (orderedPairInteger (shape 0 8 0) 0 2) : ℝ) + have he : orderedPairInteger (shape 0 8 0) 0 2 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_8_0Raw (0,3)).Encloses (weight (orderedPairInteger (shape 0 8 0) 0 3) : ℝ) + have he : orderedPairInteger (shape 0 8 0) 0 3 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_8_0Raw (0,4)).Encloses (weight (orderedPairInteger (shape 0 8 0) 0 4) : ℝ) + have he : orderedPairInteger (shape 0 8 0) 0 4 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_8_0Raw (0,5)).Encloses (weight (orderedPairInteger (shape 0 8 0) 0 5) : ℝ) + have he : orderedPairInteger (shape 0 8 0) 0 5 = (0) := by decide +kernel + rw [he] + exact w195_sound +lemma Z0_8_0Raw_sound_1 (j : Fin 6) : + (Z0_8_0Raw (1,j)).Encloses (weight (orderedPairInteger (shape 0 8 0) 1 j) : ℝ) := by + fin_cases j + · change (Z0_8_0Raw (1,0)).Encloses (weight (orderedPairInteger (shape 0 8 0) 1 0) : ℝ) + have he : orderedPairInteger (shape 0 8 0) 1 0 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_8_0Raw (1,1)).Encloses (weight (orderedPairInteger (shape 0 8 0) 1 1) : ℝ) + have he : orderedPairInteger (shape 0 8 0) 1 1 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_8_0Raw (1,2)).Encloses (weight (orderedPairInteger (shape 0 8 0) 1 2) : ℝ) + have he : orderedPairInteger (shape 0 8 0) 1 2 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_8_0Raw (1,3)).Encloses (weight (orderedPairInteger (shape 0 8 0) 1 3) : ℝ) + have he : orderedPairInteger (shape 0 8 0) 1 3 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_8_0Raw (1,4)).Encloses (weight (orderedPairInteger (shape 0 8 0) 1 4) : ℝ) + have he : orderedPairInteger (shape 0 8 0) 1 4 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_8_0Raw (1,5)).Encloses (weight (orderedPairInteger (shape 0 8 0) 1 5) : ℝ) + have he : orderedPairInteger (shape 0 8 0) 1 5 = (0) := by decide +kernel + rw [he] + exact w195_sound +lemma Z0_8_0Raw_sound_2 (j : Fin 6) : + (Z0_8_0Raw (2,j)).Encloses (weight (orderedPairInteger (shape 0 8 0) 2 j) : ℝ) := by + fin_cases j + · change (Z0_8_0Raw (2,0)).Encloses (weight (orderedPairInteger (shape 0 8 0) 2 0) : ℝ) + have he : orderedPairInteger (shape 0 8 0) 2 0 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_8_0Raw (2,1)).Encloses (weight (orderedPairInteger (shape 0 8 0) 2 1) : ℝ) + have he : orderedPairInteger (shape 0 8 0) 2 1 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_8_0Raw (2,2)).Encloses (weight (orderedPairInteger (shape 0 8 0) 2 2) : ℝ) + have he : orderedPairInteger (shape 0 8 0) 2 2 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_8_0Raw (2,3)).Encloses (weight (orderedPairInteger (shape 0 8 0) 2 3) : ℝ) + have he : orderedPairInteger (shape 0 8 0) 2 3 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_8_0Raw (2,4)).Encloses (weight (orderedPairInteger (shape 0 8 0) 2 4) : ℝ) + have he : orderedPairInteger (shape 0 8 0) 2 4 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_8_0Raw (2,5)).Encloses (weight (orderedPairInteger (shape 0 8 0) 2 5) : ℝ) + have he : orderedPairInteger (shape 0 8 0) 2 5 = (0) := by decide +kernel + rw [he] + exact w195_sound +lemma Z0_8_0Raw_sound_3 (j : Fin 6) : + (Z0_8_0Raw (3,j)).Encloses (weight (orderedPairInteger (shape 0 8 0) 3 j) : ℝ) := by + fin_cases j + · change (Z0_8_0Raw (3,0)).Encloses (weight (orderedPairInteger (shape 0 8 0) 3 0) : ℝ) + have he : orderedPairInteger (shape 0 8 0) 3 0 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_8_0Raw (3,1)).Encloses (weight (orderedPairInteger (shape 0 8 0) 3 1) : ℝ) + have he : orderedPairInteger (shape 0 8 0) 3 1 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_8_0Raw (3,2)).Encloses (weight (orderedPairInteger (shape 0 8 0) 3 2) : ℝ) + have he : orderedPairInteger (shape 0 8 0) 3 2 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_8_0Raw (3,3)).Encloses (weight (orderedPairInteger (shape 0 8 0) 3 3) : ℝ) + have he : orderedPairInteger (shape 0 8 0) 3 3 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_8_0Raw (3,4)).Encloses (weight (orderedPairInteger (shape 0 8 0) 3 4) : ℝ) + have he : orderedPairInteger (shape 0 8 0) 3 4 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_8_0Raw (3,5)).Encloses (weight (orderedPairInteger (shape 0 8 0) 3 5) : ℝ) + have he : orderedPairInteger (shape 0 8 0) 3 5 = (0) := by decide +kernel + rw [he] + exact w195_sound +lemma Z0_8_0Raw_sound_4 (j : Fin 6) : + (Z0_8_0Raw (4,j)).Encloses (weight (orderedPairInteger (shape 0 8 0) 4 j) : ℝ) := by + fin_cases j + · change (Z0_8_0Raw (4,0)).Encloses (weight (orderedPairInteger (shape 0 8 0) 4 0) : ℝ) + have he : orderedPairInteger (shape 0 8 0) 4 0 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_8_0Raw (4,1)).Encloses (weight (orderedPairInteger (shape 0 8 0) 4 1) : ℝ) + have he : orderedPairInteger (shape 0 8 0) 4 1 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_8_0Raw (4,2)).Encloses (weight (orderedPairInteger (shape 0 8 0) 4 2) : ℝ) + have he : orderedPairInteger (shape 0 8 0) 4 2 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_8_0Raw (4,3)).Encloses (weight (orderedPairInteger (shape 0 8 0) 4 3) : ℝ) + have he : orderedPairInteger (shape 0 8 0) 4 3 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_8_0Raw (4,4)).Encloses (weight (orderedPairInteger (shape 0 8 0) 4 4) : ℝ) + have he : orderedPairInteger (shape 0 8 0) 4 4 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_8_0Raw (4,5)).Encloses (weight (orderedPairInteger (shape 0 8 0) 4 5) : ℝ) + have he : orderedPairInteger (shape 0 8 0) 4 5 = (0) := by decide +kernel + rw [he] + exact w195_sound +lemma Z0_8_0Raw_sound_5 (j : Fin 6) : + (Z0_8_0Raw (5,j)).Encloses (weight (orderedPairInteger (shape 0 8 0) 5 j) : ℝ) := by + fin_cases j + · change (Z0_8_0Raw (5,0)).Encloses (weight (orderedPairInteger (shape 0 8 0) 5 0) : ℝ) + have he : orderedPairInteger (shape 0 8 0) 5 0 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_8_0Raw (5,1)).Encloses (weight (orderedPairInteger (shape 0 8 0) 5 1) : ℝ) + have he : orderedPairInteger (shape 0 8 0) 5 1 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_8_0Raw (5,2)).Encloses (weight (orderedPairInteger (shape 0 8 0) 5 2) : ℝ) + have he : orderedPairInteger (shape 0 8 0) 5 2 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_8_0Raw (5,3)).Encloses (weight (orderedPairInteger (shape 0 8 0) 5 3) : ℝ) + have he : orderedPairInteger (shape 0 8 0) 5 3 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_8_0Raw (5,4)).Encloses (weight (orderedPairInteger (shape 0 8 0) 5 4) : ℝ) + have he : orderedPairInteger (shape 0 8 0) 5 4 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_8_0Raw (5,5)).Encloses (weight (orderedPairInteger (shape 0 8 0) 5 5) : ℝ) + have he : orderedPairInteger (shape 0 8 0) 5 5 = (0) := by decide +kernel + rw [he] + exact w195_sound +lemma Z0_8_0Raw_sound (ij : PairSlot) : + (Z0_8_0Raw ij).Encloses (weight (orderedPairInteger (shape 0 8 0) ij.1 ij.2) : ℝ) := by + rcases ij with ⟨i,j⟩ + revert i + exact forall_fin6 (Z0_8_0Raw_sound_0 j) (Z0_8_0Raw_sound_1 j) (Z0_8_0Raw_sound_2 j) (Z0_8_0Raw_sound_3 j) (Z0_8_0Raw_sound_4 j) (Z0_8_0Raw_sound_5 j) +def Z0_8_0Den : Ball := ⟨1, 0⟩ +lemma Z0_8_0Den_sound : Z0_8_0Den.Encloses + (((orderedPairs (shape 0 8 0)).map (fun ij => weight (orderedPairInteger (shape 0 8 0) ij.1 ij.2))).sum : ℝ) := by + exact contains_sound (list_cast_enclosed (orderedPairs (shape 0 8 0)) Z0_8_0Raw + (fun ij => weight (orderedPairInteger (shape 0 8 0) ij.1 ij.2)) + (fun ij _ => Z0_8_0Raw_sound ij)) (by decide +kernel) +lemma Z0_8_0Den_pos : 0 < Z0_8_0Den.lower := by decide +kernel +def Z0_8_0Probs (ij : PairSlot) : Ball := + match ij.1.val, ij.2.val with + | 5, 5 => ⟨1, 0⟩ + | _, _ => (.exact 0) +lemma Z0_8_0Contains : ∀ i j : Fin 6, + statisticWeight i + statisticWeight j = shapeMax (shape 0 8 0) → + contains (.mul (Z0_8_0Raw (i,j)) (.inv Z0_8_0Den)) (Z0_8_0Probs (i,j)) = true := by + decide +kernel +lemma Z0_8_0Zero : ∀ i j : Fin 6, + statisticWeight i + statisticWeight j ≠ shapeMax (shape 0 8 0) → Z0_8_0Probs (i,j) = .exact 0 := by + decide +kernel +lemma Z0_8_0Probs_sound (ij : PairSlot) : + (Z0_8_0Probs ij).Encloses (zeroPairLaw (shape 0 8 0) ij.1 ij.2 : ℝ) := by + by_cases h : statisticWeight ij.1 + statisticWeight ij.2 = shapeMax (shape 0 8 0) + · have hb := contains_sound (Ball.mul_sound (Z0_8_0Raw_sound ij) + (Ball.inv_sound Z0_8_0Den_sound Z0_8_0Den_pos)) (Z0_8_0Contains ij.1 ij.2 h) + simpa only [zeroPairLaw, h, ite_true, Rat.cast_div, Rat.cast_mul, + Rat.cast_inv, div_eq_mul_inv] using hb + · rw [Z0_8_0Zero ij.1 ij.2 h] + simpa only [zeroPairLaw, h, ite_false] using Ball.exact_sound 0 + +def Z0_8_0Half (w : Fin 3) (ij : PairSlot) : Ball := + if (shape 0 8 0) w = 0 then if ij = (0,0) then .exact 1 else .exact 0 + else if w = halfMaxAxis (shape 0 8 0) then Z0_8_0Probs ij + else Z0_8_0Probs (kappa ij.1, kappa ij.2) +lemma Z0_8_0Half_sound (w : Fin 3) (ij : PairSlot) : + (Z0_8_0Half w ij).Encloses (halfLaw (shape 0 8 0) w ij : ℝ) := by + have hp : positive (shape 0 8 0) = false := by decide +kernel + simp only [Z0_8_0Half, halfLaw, hp, Bool.false_eq_true, ite_false] + split_ifs + · exact Ball.exact_sound 1 + · exact Ball.exact_sound 0 + · exact Z0_8_0Probs_sound _ + · exact Z0_8_0Probs_sound _ + +def Z0_8_0Value (a : PairSlot) : ℝ := (zeroPairLaw (shape 0 8 0) a.1 a.2 : ℝ) +def Z0_8_0E_5_5Log : Ball := .exact 0 +lemma Z0_8_0E_5_5Log_sound : Z0_8_0E_5_5Log.Encloses (Real.log (Z0_8_0Value ((5,5) : PairSlot))) := by + exact log_exact_one_ball (Z0_8_0Probs_sound ((5,5) : PairSlot)) +def Z0_8_0E_5_5 : Ball := ⟨0, 0⟩ +lemma Z0_8_0E_5_5_sound : Z0_8_0E_5_5.Encloses (Foundation.entropyTerm (Z0_8_0Value ((5,5) : PairSlot))) := by + exact contains_sound (entropyTerm_ball (Z0_8_0Probs_sound ((5,5) : PairSlot)) Z0_8_0E_5_5Log_sound) (by decide +kernel) +def Z0_8_0Terms (a : PairSlot) : Ball := + match a.1.val, a.2.val with + | 5, 5 => ⟨0, 0⟩ + | _, _ => (.exact 0) +lemma Z0_8_0Terms_sound (a : PairSlot) : + (Z0_8_0Terms a).Encloses (Foundation.entropyTerm (Z0_8_0Value a)) := by + rcases a with ⟨i,j⟩ + revert j i + apply forall_fin6 + · exact forall_fin6 (entropyTerm_zero_ball (Z0_8_0Probs_sound ((0,0) : PairSlot))) (entropyTerm_zero_ball (Z0_8_0Probs_sound ((0,1) : PairSlot))) (entropyTerm_zero_ball (Z0_8_0Probs_sound ((0,2) : PairSlot))) (entropyTerm_zero_ball (Z0_8_0Probs_sound ((0,3) : PairSlot))) (entropyTerm_zero_ball (Z0_8_0Probs_sound ((0,4) : PairSlot))) (entropyTerm_zero_ball (Z0_8_0Probs_sound ((0,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball (Z0_8_0Probs_sound ((1,0) : PairSlot))) (entropyTerm_zero_ball (Z0_8_0Probs_sound ((1,1) : PairSlot))) (entropyTerm_zero_ball (Z0_8_0Probs_sound ((1,2) : PairSlot))) (entropyTerm_zero_ball (Z0_8_0Probs_sound ((1,3) : PairSlot))) (entropyTerm_zero_ball (Z0_8_0Probs_sound ((1,4) : PairSlot))) (entropyTerm_zero_ball (Z0_8_0Probs_sound ((1,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball (Z0_8_0Probs_sound ((2,0) : PairSlot))) (entropyTerm_zero_ball (Z0_8_0Probs_sound ((2,1) : PairSlot))) (entropyTerm_zero_ball (Z0_8_0Probs_sound ((2,2) : PairSlot))) (entropyTerm_zero_ball (Z0_8_0Probs_sound ((2,3) : PairSlot))) (entropyTerm_zero_ball (Z0_8_0Probs_sound ((2,4) : PairSlot))) (entropyTerm_zero_ball (Z0_8_0Probs_sound ((2,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball (Z0_8_0Probs_sound ((3,0) : PairSlot))) (entropyTerm_zero_ball (Z0_8_0Probs_sound ((3,1) : PairSlot))) (entropyTerm_zero_ball (Z0_8_0Probs_sound ((3,2) : PairSlot))) (entropyTerm_zero_ball (Z0_8_0Probs_sound ((3,3) : PairSlot))) (entropyTerm_zero_ball (Z0_8_0Probs_sound ((3,4) : PairSlot))) (entropyTerm_zero_ball (Z0_8_0Probs_sound ((3,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball (Z0_8_0Probs_sound ((4,0) : PairSlot))) (entropyTerm_zero_ball (Z0_8_0Probs_sound ((4,1) : PairSlot))) (entropyTerm_zero_ball (Z0_8_0Probs_sound ((4,2) : PairSlot))) (entropyTerm_zero_ball (Z0_8_0Probs_sound ((4,3) : PairSlot))) (entropyTerm_zero_ball (Z0_8_0Probs_sound ((4,4) : PairSlot))) (entropyTerm_zero_ball (Z0_8_0Probs_sound ((4,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball (Z0_8_0Probs_sound ((5,0) : PairSlot))) (entropyTerm_zero_ball (Z0_8_0Probs_sound ((5,1) : PairSlot))) (entropyTerm_zero_ball (Z0_8_0Probs_sound ((5,2) : PairSlot))) (entropyTerm_zero_ball (Z0_8_0Probs_sound ((5,3) : PairSlot))) (entropyTerm_zero_ball (Z0_8_0Probs_sound ((5,4) : PairSlot))) Z0_8_0E_5_5_sound +def Z0_8_0Entropy : Ball := ⟨0, 0⟩ +lemma Z0_8_0Entropy_sound : Z0_8_0Entropy.Encloses (Foundation.finiteEntropy Z0_8_0Value) := by + exact contains_sound (entropyPair_enclosed Z0_8_0Value Z0_8_0Terms Z0_8_0Terms_sound) (by decide +kernel) +def Z0_8_0Labels : Ball := ⟨0, 0⟩ +lemma Z0_8_0Labels_sound : Z0_8_0Labels.Encloses + (∑ a : PairSlot, (zeroPairLaw (shape 0 8 0) a.1 a.2 : ℝ) * + Real.log (AllFieldParameters.multiplicity a.1 * AllFieldParameters.multiplicity a.2 : ℕ)) := by + exact contains_sound (pairSumBall_sound (fun a => .mul (Z0_8_0Probs a) (multLogs a)) + _ (fun a => Ball.mul_sound (Z0_8_0Probs_sound a) (multLogs_sound a))) (by decide +kernel) +def Z0_8_0Four : Ball := ⟨0, 0⟩ +lemma Z0_8_0Four_sound : Z0_8_0Four.Encloses (AllFieldZeroLeafRates.fourRate (shape 0 8 0)) := by + exact contains_sound (Ball.add_sound Z0_8_0Entropy_sound Z0_8_0Labels_sound) (by decide +kernel) +def Z0_8_0H0Value (a : PairSlot) : ℝ := (halfLaw (shape 0 8 0) 0 a : ℝ) +def Z0_8_0H0E_0_0Log : Ball := .exact 0 +lemma Z0_8_0H0E_0_0Log_sound : Z0_8_0H0E_0_0Log.Encloses (Real.log (Z0_8_0H0Value ((0,0) : PairSlot))) := by + exact log_exact_one_ball ((Z0_8_0Half_sound 0) ((0,0) : PairSlot)) +def Z0_8_0H0E_0_0 : Ball := ⟨0, 0⟩ +lemma Z0_8_0H0E_0_0_sound : Z0_8_0H0E_0_0.Encloses (Foundation.entropyTerm (Z0_8_0H0Value ((0,0) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z0_8_0Half_sound 0) ((0,0) : PairSlot)) Z0_8_0H0E_0_0Log_sound) (by decide +kernel) +def Z0_8_0H0Terms (a : PairSlot) : Ball := + match a.1.val, a.2.val with + | 0, 0 => ⟨0, 0⟩ + | _, _ => (.exact 0) +lemma Z0_8_0H0Terms_sound (a : PairSlot) : + (Z0_8_0H0Terms a).Encloses (Foundation.entropyTerm (Z0_8_0H0Value a)) := by + rcases a with ⟨i,j⟩ + revert j i + apply forall_fin6 + · exact forall_fin6 Z0_8_0H0E_0_0_sound (entropyTerm_zero_ball ((Z0_8_0Half_sound 0) ((0,1) : PairSlot))) (entropyTerm_zero_ball ((Z0_8_0Half_sound 0) ((0,2) : PairSlot))) (entropyTerm_zero_ball ((Z0_8_0Half_sound 0) ((0,3) : PairSlot))) (entropyTerm_zero_ball ((Z0_8_0Half_sound 0) ((0,4) : PairSlot))) (entropyTerm_zero_ball ((Z0_8_0Half_sound 0) ((0,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z0_8_0Half_sound 0) ((1,0) : PairSlot))) (entropyTerm_zero_ball ((Z0_8_0Half_sound 0) ((1,1) : PairSlot))) (entropyTerm_zero_ball ((Z0_8_0Half_sound 0) ((1,2) : PairSlot))) (entropyTerm_zero_ball ((Z0_8_0Half_sound 0) ((1,3) : PairSlot))) (entropyTerm_zero_ball ((Z0_8_0Half_sound 0) ((1,4) : PairSlot))) (entropyTerm_zero_ball ((Z0_8_0Half_sound 0) ((1,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z0_8_0Half_sound 0) ((2,0) : PairSlot))) (entropyTerm_zero_ball ((Z0_8_0Half_sound 0) ((2,1) : PairSlot))) (entropyTerm_zero_ball ((Z0_8_0Half_sound 0) ((2,2) : PairSlot))) (entropyTerm_zero_ball ((Z0_8_0Half_sound 0) ((2,3) : PairSlot))) (entropyTerm_zero_ball ((Z0_8_0Half_sound 0) ((2,4) : PairSlot))) (entropyTerm_zero_ball ((Z0_8_0Half_sound 0) ((2,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z0_8_0Half_sound 0) ((3,0) : PairSlot))) (entropyTerm_zero_ball ((Z0_8_0Half_sound 0) ((3,1) : PairSlot))) (entropyTerm_zero_ball ((Z0_8_0Half_sound 0) ((3,2) : PairSlot))) (entropyTerm_zero_ball ((Z0_8_0Half_sound 0) ((3,3) : PairSlot))) (entropyTerm_zero_ball ((Z0_8_0Half_sound 0) ((3,4) : PairSlot))) (entropyTerm_zero_ball ((Z0_8_0Half_sound 0) ((3,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z0_8_0Half_sound 0) ((4,0) : PairSlot))) (entropyTerm_zero_ball ((Z0_8_0Half_sound 0) ((4,1) : PairSlot))) (entropyTerm_zero_ball ((Z0_8_0Half_sound 0) ((4,2) : PairSlot))) (entropyTerm_zero_ball ((Z0_8_0Half_sound 0) ((4,3) : PairSlot))) (entropyTerm_zero_ball ((Z0_8_0Half_sound 0) ((4,4) : PairSlot))) (entropyTerm_zero_ball ((Z0_8_0Half_sound 0) ((4,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z0_8_0Half_sound 0) ((5,0) : PairSlot))) (entropyTerm_zero_ball ((Z0_8_0Half_sound 0) ((5,1) : PairSlot))) (entropyTerm_zero_ball ((Z0_8_0Half_sound 0) ((5,2) : PairSlot))) (entropyTerm_zero_ball ((Z0_8_0Half_sound 0) ((5,3) : PairSlot))) (entropyTerm_zero_ball ((Z0_8_0Half_sound 0) ((5,4) : PairSlot))) (entropyTerm_zero_ball ((Z0_8_0Half_sound 0) ((5,5) : PairSlot))) +def Z0_8_0H0Entropy : Ball := ⟨0, 0⟩ +lemma Z0_8_0H0Entropy_sound : Z0_8_0H0Entropy.Encloses (Foundation.finiteEntropy Z0_8_0H0Value) := by + exact contains_sound (entropyPair_enclosed Z0_8_0H0Value Z0_8_0H0Terms Z0_8_0H0Terms_sound) (by decide +kernel) +def Z0_8_0H0Mass : Ball := ⟨1, 0⟩ +lemma Z0_8_0H0Mass_sound : Z0_8_0H0Mass.Encloses (∑ a, Z0_8_0H0Value a) := by + exact contains_sound (pairSumBall_sound (Z0_8_0Half 0) Z0_8_0H0Value (Z0_8_0Half_sound 0)) (by decide +kernel) +def Z0_8_0H0MassTermLog : Ball := .exact 0 +lemma Z0_8_0H0MassTermLog_sound : Z0_8_0H0MassTermLog.Encloses (Real.log ((∑ a, Z0_8_0H0Value a))) := by + exact log_exact_one_ball (Z0_8_0H0Mass_sound) +def Z0_8_0H0MassTerm : Ball := ⟨0, 0⟩ +lemma Z0_8_0H0MassTerm_sound : Z0_8_0H0MassTerm.Encloses (Foundation.entropyTerm ((∑ a, Z0_8_0H0Value a))) := by + exact contains_sound (entropyTerm_ball (Z0_8_0H0Mass_sound) Z0_8_0H0MassTermLog_sound) (by decide +kernel) +def Z0_8_0H0H : Ball := ⟨0, 0⟩ +lemma Z0_8_0H0H_sound : Z0_8_0H0H.Encloses (homogeneousEntropy Z0_8_0H0Value) := by + exact contains_sound (homogeneous_enclosed Z0_8_0H0Value Z0_8_0H0MassTerm_sound Z0_8_0H0Entropy_sound) (by decide +kernel) +def Z0_8_0H1Value (a : PairSlot) : ℝ := (halfLaw (shape 0 8 0) 1 a : ℝ) +def Z0_8_0H1E_5_5Log : Ball := .exact 0 +lemma Z0_8_0H1E_5_5Log_sound : Z0_8_0H1E_5_5Log.Encloses (Real.log (Z0_8_0H1Value ((5,5) : PairSlot))) := by + exact log_exact_one_ball ((Z0_8_0Half_sound 1) ((5,5) : PairSlot)) +def Z0_8_0H1E_5_5 : Ball := ⟨0, 0⟩ +lemma Z0_8_0H1E_5_5_sound : Z0_8_0H1E_5_5.Encloses (Foundation.entropyTerm (Z0_8_0H1Value ((5,5) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z0_8_0Half_sound 1) ((5,5) : PairSlot)) Z0_8_0H1E_5_5Log_sound) (by decide +kernel) +def Z0_8_0H1Terms (a : PairSlot) : Ball := + match a.1.val, a.2.val with + | 5, 5 => ⟨0, 0⟩ + | _, _ => (.exact 0) +lemma Z0_8_0H1Terms_sound (a : PairSlot) : + (Z0_8_0H1Terms a).Encloses (Foundation.entropyTerm (Z0_8_0H1Value a)) := by + rcases a with ⟨i,j⟩ + revert j i + apply forall_fin6 + · exact forall_fin6 (entropyTerm_zero_ball ((Z0_8_0Half_sound 1) ((0,0) : PairSlot))) (entropyTerm_zero_ball ((Z0_8_0Half_sound 1) ((0,1) : PairSlot))) (entropyTerm_zero_ball ((Z0_8_0Half_sound 1) ((0,2) : PairSlot))) (entropyTerm_zero_ball ((Z0_8_0Half_sound 1) ((0,3) : PairSlot))) (entropyTerm_zero_ball ((Z0_8_0Half_sound 1) ((0,4) : PairSlot))) (entropyTerm_zero_ball ((Z0_8_0Half_sound 1) ((0,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z0_8_0Half_sound 1) ((1,0) : PairSlot))) (entropyTerm_zero_ball ((Z0_8_0Half_sound 1) ((1,1) : PairSlot))) (entropyTerm_zero_ball ((Z0_8_0Half_sound 1) ((1,2) : PairSlot))) (entropyTerm_zero_ball ((Z0_8_0Half_sound 1) ((1,3) : PairSlot))) (entropyTerm_zero_ball ((Z0_8_0Half_sound 1) ((1,4) : PairSlot))) (entropyTerm_zero_ball ((Z0_8_0Half_sound 1) ((1,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z0_8_0Half_sound 1) ((2,0) : PairSlot))) (entropyTerm_zero_ball ((Z0_8_0Half_sound 1) ((2,1) : PairSlot))) (entropyTerm_zero_ball ((Z0_8_0Half_sound 1) ((2,2) : PairSlot))) (entropyTerm_zero_ball ((Z0_8_0Half_sound 1) ((2,3) : PairSlot))) (entropyTerm_zero_ball ((Z0_8_0Half_sound 1) ((2,4) : PairSlot))) (entropyTerm_zero_ball ((Z0_8_0Half_sound 1) ((2,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z0_8_0Half_sound 1) ((3,0) : PairSlot))) (entropyTerm_zero_ball ((Z0_8_0Half_sound 1) ((3,1) : PairSlot))) (entropyTerm_zero_ball ((Z0_8_0Half_sound 1) ((3,2) : PairSlot))) (entropyTerm_zero_ball ((Z0_8_0Half_sound 1) ((3,3) : PairSlot))) (entropyTerm_zero_ball ((Z0_8_0Half_sound 1) ((3,4) : PairSlot))) (entropyTerm_zero_ball ((Z0_8_0Half_sound 1) ((3,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z0_8_0Half_sound 1) ((4,0) : PairSlot))) (entropyTerm_zero_ball ((Z0_8_0Half_sound 1) ((4,1) : PairSlot))) (entropyTerm_zero_ball ((Z0_8_0Half_sound 1) ((4,2) : PairSlot))) (entropyTerm_zero_ball ((Z0_8_0Half_sound 1) ((4,3) : PairSlot))) (entropyTerm_zero_ball ((Z0_8_0Half_sound 1) ((4,4) : PairSlot))) (entropyTerm_zero_ball ((Z0_8_0Half_sound 1) ((4,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z0_8_0Half_sound 1) ((5,0) : PairSlot))) (entropyTerm_zero_ball ((Z0_8_0Half_sound 1) ((5,1) : PairSlot))) (entropyTerm_zero_ball ((Z0_8_0Half_sound 1) ((5,2) : PairSlot))) (entropyTerm_zero_ball ((Z0_8_0Half_sound 1) ((5,3) : PairSlot))) (entropyTerm_zero_ball ((Z0_8_0Half_sound 1) ((5,4) : PairSlot))) Z0_8_0H1E_5_5_sound +def Z0_8_0H1Entropy : Ball := ⟨0, 0⟩ +lemma Z0_8_0H1Entropy_sound : Z0_8_0H1Entropy.Encloses (Foundation.finiteEntropy Z0_8_0H1Value) := by + exact contains_sound (entropyPair_enclosed Z0_8_0H1Value Z0_8_0H1Terms Z0_8_0H1Terms_sound) (by decide +kernel) +def Z0_8_0H1Mass : Ball := ⟨1, 0⟩ +lemma Z0_8_0H1Mass_sound : Z0_8_0H1Mass.Encloses (∑ a, Z0_8_0H1Value a) := by + exact contains_sound (pairSumBall_sound (Z0_8_0Half 1) Z0_8_0H1Value (Z0_8_0Half_sound 1)) (by decide +kernel) +def Z0_8_0H1MassTermLog : Ball := .exact 0 +lemma Z0_8_0H1MassTermLog_sound : Z0_8_0H1MassTermLog.Encloses (Real.log ((∑ a, Z0_8_0H1Value a))) := by + exact log_exact_one_ball (Z0_8_0H1Mass_sound) +def Z0_8_0H1MassTerm : Ball := ⟨0, 0⟩ +lemma Z0_8_0H1MassTerm_sound : Z0_8_0H1MassTerm.Encloses (Foundation.entropyTerm ((∑ a, Z0_8_0H1Value a))) := by + exact contains_sound (entropyTerm_ball (Z0_8_0H1Mass_sound) Z0_8_0H1MassTermLog_sound) (by decide +kernel) +def Z0_8_0H1H : Ball := ⟨0, 0⟩ +lemma Z0_8_0H1H_sound : Z0_8_0H1H.Encloses (homogeneousEntropy Z0_8_0H1Value) := by + exact contains_sound (homogeneous_enclosed Z0_8_0H1Value Z0_8_0H1MassTerm_sound Z0_8_0H1Entropy_sound) (by decide +kernel) +def Z0_8_0H2Value (a : PairSlot) : ℝ := (halfLaw (shape 0 8 0) 2 a : ℝ) +def Z0_8_0H2E_0_0Log : Ball := .exact 0 +lemma Z0_8_0H2E_0_0Log_sound : Z0_8_0H2E_0_0Log.Encloses (Real.log (Z0_8_0H2Value ((0,0) : PairSlot))) := by + exact log_exact_one_ball ((Z0_8_0Half_sound 2) ((0,0) : PairSlot)) +def Z0_8_0H2E_0_0 : Ball := ⟨0, 0⟩ +lemma Z0_8_0H2E_0_0_sound : Z0_8_0H2E_0_0.Encloses (Foundation.entropyTerm (Z0_8_0H2Value ((0,0) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z0_8_0Half_sound 2) ((0,0) : PairSlot)) Z0_8_0H2E_0_0Log_sound) (by decide +kernel) +def Z0_8_0H2Terms (a : PairSlot) : Ball := + match a.1.val, a.2.val with + | 0, 0 => ⟨0, 0⟩ + | _, _ => (.exact 0) +lemma Z0_8_0H2Terms_sound (a : PairSlot) : + (Z0_8_0H2Terms a).Encloses (Foundation.entropyTerm (Z0_8_0H2Value a)) := by + rcases a with ⟨i,j⟩ + revert j i + apply forall_fin6 + · exact forall_fin6 Z0_8_0H2E_0_0_sound (entropyTerm_zero_ball ((Z0_8_0Half_sound 2) ((0,1) : PairSlot))) (entropyTerm_zero_ball ((Z0_8_0Half_sound 2) ((0,2) : PairSlot))) (entropyTerm_zero_ball ((Z0_8_0Half_sound 2) ((0,3) : PairSlot))) (entropyTerm_zero_ball ((Z0_8_0Half_sound 2) ((0,4) : PairSlot))) (entropyTerm_zero_ball ((Z0_8_0Half_sound 2) ((0,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z0_8_0Half_sound 2) ((1,0) : PairSlot))) (entropyTerm_zero_ball ((Z0_8_0Half_sound 2) ((1,1) : PairSlot))) (entropyTerm_zero_ball ((Z0_8_0Half_sound 2) ((1,2) : PairSlot))) (entropyTerm_zero_ball ((Z0_8_0Half_sound 2) ((1,3) : PairSlot))) (entropyTerm_zero_ball ((Z0_8_0Half_sound 2) ((1,4) : PairSlot))) (entropyTerm_zero_ball ((Z0_8_0Half_sound 2) ((1,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z0_8_0Half_sound 2) ((2,0) : PairSlot))) (entropyTerm_zero_ball ((Z0_8_0Half_sound 2) ((2,1) : PairSlot))) (entropyTerm_zero_ball ((Z0_8_0Half_sound 2) ((2,2) : PairSlot))) (entropyTerm_zero_ball ((Z0_8_0Half_sound 2) ((2,3) : PairSlot))) (entropyTerm_zero_ball ((Z0_8_0Half_sound 2) ((2,4) : PairSlot))) (entropyTerm_zero_ball ((Z0_8_0Half_sound 2) ((2,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z0_8_0Half_sound 2) ((3,0) : PairSlot))) (entropyTerm_zero_ball ((Z0_8_0Half_sound 2) ((3,1) : PairSlot))) (entropyTerm_zero_ball ((Z0_8_0Half_sound 2) ((3,2) : PairSlot))) (entropyTerm_zero_ball ((Z0_8_0Half_sound 2) ((3,3) : PairSlot))) (entropyTerm_zero_ball ((Z0_8_0Half_sound 2) ((3,4) : PairSlot))) (entropyTerm_zero_ball ((Z0_8_0Half_sound 2) ((3,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z0_8_0Half_sound 2) ((4,0) : PairSlot))) (entropyTerm_zero_ball ((Z0_8_0Half_sound 2) ((4,1) : PairSlot))) (entropyTerm_zero_ball ((Z0_8_0Half_sound 2) ((4,2) : PairSlot))) (entropyTerm_zero_ball ((Z0_8_0Half_sound 2) ((4,3) : PairSlot))) (entropyTerm_zero_ball ((Z0_8_0Half_sound 2) ((4,4) : PairSlot))) (entropyTerm_zero_ball ((Z0_8_0Half_sound 2) ((4,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z0_8_0Half_sound 2) ((5,0) : PairSlot))) (entropyTerm_zero_ball ((Z0_8_0Half_sound 2) ((5,1) : PairSlot))) (entropyTerm_zero_ball ((Z0_8_0Half_sound 2) ((5,2) : PairSlot))) (entropyTerm_zero_ball ((Z0_8_0Half_sound 2) ((5,3) : PairSlot))) (entropyTerm_zero_ball ((Z0_8_0Half_sound 2) ((5,4) : PairSlot))) (entropyTerm_zero_ball ((Z0_8_0Half_sound 2) ((5,5) : PairSlot))) +def Z0_8_0H2Entropy : Ball := ⟨0, 0⟩ +lemma Z0_8_0H2Entropy_sound : Z0_8_0H2Entropy.Encloses (Foundation.finiteEntropy Z0_8_0H2Value) := by + exact contains_sound (entropyPair_enclosed Z0_8_0H2Value Z0_8_0H2Terms Z0_8_0H2Terms_sound) (by decide +kernel) +def Z0_8_0H2Mass : Ball := ⟨1, 0⟩ +lemma Z0_8_0H2Mass_sound : Z0_8_0H2Mass.Encloses (∑ a, Z0_8_0H2Value a) := by + exact contains_sound (pairSumBall_sound (Z0_8_0Half 2) Z0_8_0H2Value (Z0_8_0Half_sound 2)) (by decide +kernel) +def Z0_8_0H2MassTermLog : Ball := .exact 0 +lemma Z0_8_0H2MassTermLog_sound : Z0_8_0H2MassTermLog.Encloses (Real.log ((∑ a, Z0_8_0H2Value a))) := by + exact log_exact_one_ball (Z0_8_0H2Mass_sound) +def Z0_8_0H2MassTerm : Ball := ⟨0, 0⟩ +lemma Z0_8_0H2MassTerm_sound : Z0_8_0H2MassTerm.Encloses (Foundation.entropyTerm ((∑ a, Z0_8_0H2Value a))) := by + exact contains_sound (entropyTerm_ball (Z0_8_0H2Mass_sound) Z0_8_0H2MassTermLog_sound) (by decide +kernel) +def Z0_8_0H2H : Ball := ⟨0, 0⟩ +lemma Z0_8_0H2H_sound : Z0_8_0H2H.Encloses (homogeneousEntropy Z0_8_0H2Value) := by + exact contains_sound (homogeneous_enclosed Z0_8_0H2Value Z0_8_0H2MassTerm_sound Z0_8_0H2Entropy_sound) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/Certificates/Four1_0_7.lean b/lean/OAI/LinearAlgebra/MatrixFields/Certificates/Four1_0_7.lean new file mode 100644 index 0000000000000000000000000000000000000000..974e90f155e3aac31d9b7a334bf1912277a34b0f --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/Certificates/Four1_0_7.lean @@ -0,0 +1,455 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Certificates.Zero0_1_7 + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def Z1_0_7Raw (ij : PairSlot) : Ball := + match ij.1.val, ij.2.val with + | 0, 0 => w195 + | 0, 1 => w195 + | 0, 2 => w195 + | 0, 3 => w195 + | 0, 4 => w195 + | 0, 5 => w195 + | 1, 0 => w195 + | 1, 1 => w195 + | 1, 2 => w195 + | 1, 3 => w195 + | 1, 4 => w195 + | 1, 5 => w195 + | 2, 0 => w195 + | 2, 1 => w195 + | 2, 2 => w195 + | 2, 3 => w195 + | 2, 4 => w195 + | 2, 5 => w195 + | 3, 0 => w195 + | 3, 1 => w195 + | 3, 2 => w195 + | 3, 3 => w195 + | 3, 4 => w195 + | 3, 5 => w195 + | 4, 0 => w195 + | 4, 1 => w195 + | 4, 2 => w195 + | 4, 3 => w195 + | 4, 4 => w195 + | 4, 5 => w195 + | 5, 0 => w195 + | 5, 1 => w195 + | 5, 2 => w195 + | 5, 3 => w195 + | 5, 4 => w195 + | 5, 5 => w195 + | _, _ => (.exact 0) +lemma Z1_0_7Raw_sound_0 (j : Fin 6) : + (Z1_0_7Raw (0,j)).Encloses (weight (orderedPairInteger (shape 1 0 7) 0 j) : ℝ) := by + fin_cases j + · change (Z1_0_7Raw (0,0)).Encloses (weight (orderedPairInteger (shape 1 0 7) 0 0) : ℝ) + have he : orderedPairInteger (shape 1 0 7) 0 0 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z1_0_7Raw (0,1)).Encloses (weight (orderedPairInteger (shape 1 0 7) 0 1) : ℝ) + have he : orderedPairInteger (shape 1 0 7) 0 1 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z1_0_7Raw (0,2)).Encloses (weight (orderedPairInteger (shape 1 0 7) 0 2) : ℝ) + have he : orderedPairInteger (shape 1 0 7) 0 2 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z1_0_7Raw (0,3)).Encloses (weight (orderedPairInteger (shape 1 0 7) 0 3) : ℝ) + have he : orderedPairInteger (shape 1 0 7) 0 3 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z1_0_7Raw (0,4)).Encloses (weight (orderedPairInteger (shape 1 0 7) 0 4) : ℝ) + have he : orderedPairInteger (shape 1 0 7) 0 4 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z1_0_7Raw (0,5)).Encloses (weight (orderedPairInteger (shape 1 0 7) 0 5) : ℝ) + have he : orderedPairInteger (shape 1 0 7) 0 5 = (0) := by decide +kernel + rw [he] + exact w195_sound +lemma Z1_0_7Raw_sound_1 (j : Fin 6) : + (Z1_0_7Raw (1,j)).Encloses (weight (orderedPairInteger (shape 1 0 7) 1 j) : ℝ) := by + fin_cases j + · change (Z1_0_7Raw (1,0)).Encloses (weight (orderedPairInteger (shape 1 0 7) 1 0) : ℝ) + have he : orderedPairInteger (shape 1 0 7) 1 0 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z1_0_7Raw (1,1)).Encloses (weight (orderedPairInteger (shape 1 0 7) 1 1) : ℝ) + have he : orderedPairInteger (shape 1 0 7) 1 1 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z1_0_7Raw (1,2)).Encloses (weight (orderedPairInteger (shape 1 0 7) 1 2) : ℝ) + have he : orderedPairInteger (shape 1 0 7) 1 2 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z1_0_7Raw (1,3)).Encloses (weight (orderedPairInteger (shape 1 0 7) 1 3) : ℝ) + have he : orderedPairInteger (shape 1 0 7) 1 3 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z1_0_7Raw (1,4)).Encloses (weight (orderedPairInteger (shape 1 0 7) 1 4) : ℝ) + have he : orderedPairInteger (shape 1 0 7) 1 4 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z1_0_7Raw (1,5)).Encloses (weight (orderedPairInteger (shape 1 0 7) 1 5) : ℝ) + have he : orderedPairInteger (shape 1 0 7) 1 5 = (0) := by decide +kernel + rw [he] + exact w195_sound +lemma Z1_0_7Raw_sound_2 (j : Fin 6) : + (Z1_0_7Raw (2,j)).Encloses (weight (orderedPairInteger (shape 1 0 7) 2 j) : ℝ) := by + fin_cases j + · change (Z1_0_7Raw (2,0)).Encloses (weight (orderedPairInteger (shape 1 0 7) 2 0) : ℝ) + have he : orderedPairInteger (shape 1 0 7) 2 0 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z1_0_7Raw (2,1)).Encloses (weight (orderedPairInteger (shape 1 0 7) 2 1) : ℝ) + have he : orderedPairInteger (shape 1 0 7) 2 1 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z1_0_7Raw (2,2)).Encloses (weight (orderedPairInteger (shape 1 0 7) 2 2) : ℝ) + have he : orderedPairInteger (shape 1 0 7) 2 2 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z1_0_7Raw (2,3)).Encloses (weight (orderedPairInteger (shape 1 0 7) 2 3) : ℝ) + have he : orderedPairInteger (shape 1 0 7) 2 3 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z1_0_7Raw (2,4)).Encloses (weight (orderedPairInteger (shape 1 0 7) 2 4) : ℝ) + have he : orderedPairInteger (shape 1 0 7) 2 4 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z1_0_7Raw (2,5)).Encloses (weight (orderedPairInteger (shape 1 0 7) 2 5) : ℝ) + have he : orderedPairInteger (shape 1 0 7) 2 5 = (0) := by decide +kernel + rw [he] + exact w195_sound +lemma Z1_0_7Raw_sound_3 (j : Fin 6) : + (Z1_0_7Raw (3,j)).Encloses (weight (orderedPairInteger (shape 1 0 7) 3 j) : ℝ) := by + fin_cases j + · change (Z1_0_7Raw (3,0)).Encloses (weight (orderedPairInteger (shape 1 0 7) 3 0) : ℝ) + have he : orderedPairInteger (shape 1 0 7) 3 0 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z1_0_7Raw (3,1)).Encloses (weight (orderedPairInteger (shape 1 0 7) 3 1) : ℝ) + have he : orderedPairInteger (shape 1 0 7) 3 1 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z1_0_7Raw (3,2)).Encloses (weight (orderedPairInteger (shape 1 0 7) 3 2) : ℝ) + have he : orderedPairInteger (shape 1 0 7) 3 2 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z1_0_7Raw (3,3)).Encloses (weight (orderedPairInteger (shape 1 0 7) 3 3) : ℝ) + have he : orderedPairInteger (shape 1 0 7) 3 3 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z1_0_7Raw (3,4)).Encloses (weight (orderedPairInteger (shape 1 0 7) 3 4) : ℝ) + have he : orderedPairInteger (shape 1 0 7) 3 4 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z1_0_7Raw (3,5)).Encloses (weight (orderedPairInteger (shape 1 0 7) 3 5) : ℝ) + have he : orderedPairInteger (shape 1 0 7) 3 5 = (0) := by decide +kernel + rw [he] + exact w195_sound +lemma Z1_0_7Raw_sound_4 (j : Fin 6) : + (Z1_0_7Raw (4,j)).Encloses (weight (orderedPairInteger (shape 1 0 7) 4 j) : ℝ) := by + fin_cases j + · change (Z1_0_7Raw (4,0)).Encloses (weight (orderedPairInteger (shape 1 0 7) 4 0) : ℝ) + have he : orderedPairInteger (shape 1 0 7) 4 0 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z1_0_7Raw (4,1)).Encloses (weight (orderedPairInteger (shape 1 0 7) 4 1) : ℝ) + have he : orderedPairInteger (shape 1 0 7) 4 1 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z1_0_7Raw (4,2)).Encloses (weight (orderedPairInteger (shape 1 0 7) 4 2) : ℝ) + have he : orderedPairInteger (shape 1 0 7) 4 2 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z1_0_7Raw (4,3)).Encloses (weight (orderedPairInteger (shape 1 0 7) 4 3) : ℝ) + have he : orderedPairInteger (shape 1 0 7) 4 3 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z1_0_7Raw (4,4)).Encloses (weight (orderedPairInteger (shape 1 0 7) 4 4) : ℝ) + have he : orderedPairInteger (shape 1 0 7) 4 4 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z1_0_7Raw (4,5)).Encloses (weight (orderedPairInteger (shape 1 0 7) 4 5) : ℝ) + have he : orderedPairInteger (shape 1 0 7) 4 5 = (0) := by decide +kernel + rw [he] + exact w195_sound +lemma Z1_0_7Raw_sound_5 (j : Fin 6) : + (Z1_0_7Raw (5,j)).Encloses (weight (orderedPairInteger (shape 1 0 7) 5 j) : ℝ) := by + fin_cases j + · change (Z1_0_7Raw (5,0)).Encloses (weight (orderedPairInteger (shape 1 0 7) 5 0) : ℝ) + have he : orderedPairInteger (shape 1 0 7) 5 0 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z1_0_7Raw (5,1)).Encloses (weight (orderedPairInteger (shape 1 0 7) 5 1) : ℝ) + have he : orderedPairInteger (shape 1 0 7) 5 1 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z1_0_7Raw (5,2)).Encloses (weight (orderedPairInteger (shape 1 0 7) 5 2) : ℝ) + have he : orderedPairInteger (shape 1 0 7) 5 2 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z1_0_7Raw (5,3)).Encloses (weight (orderedPairInteger (shape 1 0 7) 5 3) : ℝ) + have he : orderedPairInteger (shape 1 0 7) 5 3 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z1_0_7Raw (5,4)).Encloses (weight (orderedPairInteger (shape 1 0 7) 5 4) : ℝ) + have he : orderedPairInteger (shape 1 0 7) 5 4 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z1_0_7Raw (5,5)).Encloses (weight (orderedPairInteger (shape 1 0 7) 5 5) : ℝ) + have he : orderedPairInteger (shape 1 0 7) 5 5 = (0) := by decide +kernel + rw [he] + exact w195_sound +lemma Z1_0_7Raw_sound (ij : PairSlot) : + (Z1_0_7Raw ij).Encloses (weight (orderedPairInteger (shape 1 0 7) ij.1 ij.2) : ℝ) := by + rcases ij with ⟨i,j⟩ + revert i + exact forall_fin6 (Z1_0_7Raw_sound_0 j) (Z1_0_7Raw_sound_1 j) (Z1_0_7Raw_sound_2 j) (Z1_0_7Raw_sound_3 j) (Z1_0_7Raw_sound_4 j) (Z1_0_7Raw_sound_5 j) +def Z1_0_7Den : Ball := ⟨2, 0⟩ +lemma Z1_0_7Den_sound : Z1_0_7Den.Encloses + (((orderedPairs (shape 1 0 7)).map (fun ij => weight (orderedPairInteger (shape 1 0 7) ij.1 ij.2))).sum : ℝ) := by + exact contains_sound (list_cast_enclosed (orderedPairs (shape 1 0 7)) Z1_0_7Raw + (fun ij => weight (orderedPairInteger (shape 1 0 7) ij.1 ij.2)) + (fun ij _ => Z1_0_7Raw_sound ij)) (by decide +kernel) +lemma Z1_0_7Den_pos : 0 < Z1_0_7Den.lower := by decide +kernel +def Z1_0_7Probs (ij : PairSlot) : Ball := + match ij.1.val, ij.2.val with + | 4, 5 => ⟨(1 / 2), 0⟩ + | 5, 4 => ⟨(1 / 2), 0⟩ + | _, _ => (.exact 0) +lemma Z1_0_7Contains : ∀ i j : Fin 6, + statisticWeight i + statisticWeight j = shapeMax (shape 1 0 7) → + contains (.mul (Z1_0_7Raw (i,j)) (.inv Z1_0_7Den)) (Z1_0_7Probs (i,j)) = true := by + decide +kernel +lemma Z1_0_7Zero : ∀ i j : Fin 6, + statisticWeight i + statisticWeight j ≠ shapeMax (shape 1 0 7) → Z1_0_7Probs (i,j) = .exact 0 := by + decide +kernel +lemma Z1_0_7Probs_sound (ij : PairSlot) : + (Z1_0_7Probs ij).Encloses (zeroPairLaw (shape 1 0 7) ij.1 ij.2 : ℝ) := by + by_cases h : statisticWeight ij.1 + statisticWeight ij.2 = shapeMax (shape 1 0 7) + · have hb := contains_sound (Ball.mul_sound (Z1_0_7Raw_sound ij) + (Ball.inv_sound Z1_0_7Den_sound Z1_0_7Den_pos)) (Z1_0_7Contains ij.1 ij.2 h) + simpa only [zeroPairLaw, h, ite_true, Rat.cast_div, Rat.cast_mul, + Rat.cast_inv, div_eq_mul_inv] using hb + · rw [Z1_0_7Zero ij.1 ij.2 h] + simpa only [zeroPairLaw, h, ite_false] using Ball.exact_sound 0 + +def Z1_0_7Half (w : Fin 3) (ij : PairSlot) : Ball := + if (shape 1 0 7) w = 0 then if ij = (0,0) then .exact 1 else .exact 0 + else if w = halfMaxAxis (shape 1 0 7) then Z1_0_7Probs ij + else Z1_0_7Probs (kappa ij.1, kappa ij.2) +lemma Z1_0_7Half_sound (w : Fin 3) (ij : PairSlot) : + (Z1_0_7Half w ij).Encloses (halfLaw (shape 1 0 7) w ij : ℝ) := by + have hp : positive (shape 1 0 7) = false := by decide +kernel + simp only [Z1_0_7Half, halfLaw, hp, Bool.false_eq_true, ite_false] + split_ifs + · exact Ball.exact_sound 1 + · exact Ball.exact_sound 0 + · exact Z1_0_7Probs_sound _ + · exact Z1_0_7Probs_sound _ + +def Z1_0_7Value (a : PairSlot) : ℝ := (zeroPairLaw (shape 1 0 7) a.1 a.2 : ℝ) +def Z1_0_7E_4_5LogWitness : LogWitness := ⟨-1, 1, 1⟩ +def Z1_0_7E_4_5Log : Ball := ⟨(-6931471805599453094172319305033 / 10000000000000000000000000000000), (8470329473 / 20000000000000000000000000000000)⟩ +lemma Z1_0_7E_4_5Log_sound : Z1_0_7E_4_5Log.Encloses (Real.log (Z1_0_7Value ((4,5) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound (Z1_0_7Probs_sound ((4,5) : PairSlot)) (w := Z1_0_7E_4_5LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z1_0_7E_4_5 : Ball := ⟨(6931471805599453094172319305033 / 20000000000000000000000000000000), (21175823683 / 100000000000000000000000000000000)⟩ +lemma Z1_0_7E_4_5_sound : Z1_0_7E_4_5.Encloses (Foundation.entropyTerm (Z1_0_7Value ((4,5) : PairSlot))) := by + exact contains_sound (entropyTerm_ball (Z1_0_7Probs_sound ((4,5) : PairSlot)) Z1_0_7E_4_5Log_sound) (by decide +kernel) +def Z1_0_7E_5_4LogWitness : LogWitness := ⟨-1, 1, 1⟩ +def Z1_0_7E_5_4Log : Ball := ⟨(-6931471805599453094172319305033 / 10000000000000000000000000000000), (8470329473 / 20000000000000000000000000000000)⟩ +lemma Z1_0_7E_5_4Log_sound : Z1_0_7E_5_4Log.Encloses (Real.log (Z1_0_7Value ((5,4) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound (Z1_0_7Probs_sound ((5,4) : PairSlot)) (w := Z1_0_7E_5_4LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z1_0_7E_5_4 : Ball := ⟨(6931471805599453094172319305033 / 20000000000000000000000000000000), (21175823683 / 100000000000000000000000000000000)⟩ +lemma Z1_0_7E_5_4_sound : Z1_0_7E_5_4.Encloses (Foundation.entropyTerm (Z1_0_7Value ((5,4) : PairSlot))) := by + exact contains_sound (entropyTerm_ball (Z1_0_7Probs_sound ((5,4) : PairSlot)) Z1_0_7E_5_4Log_sound) (by decide +kernel) +def Z1_0_7Terms (a : PairSlot) : Ball := + match a.1.val, a.2.val with + | 4, 5 => ⟨(6931471805599453094172319305033 / 20000000000000000000000000000000), (21175823683 / 100000000000000000000000000000000)⟩ + | 5, 4 => ⟨(6931471805599453094172319305033 / 20000000000000000000000000000000), (21175823683 / 100000000000000000000000000000000)⟩ + | _, _ => (.exact 0) +lemma Z1_0_7Terms_sound (a : PairSlot) : + (Z1_0_7Terms a).Encloses (Foundation.entropyTerm (Z1_0_7Value a)) := by + rcases a with ⟨i,j⟩ + revert j i + apply forall_fin6 + · exact forall_fin6 (entropyTerm_zero_ball (Z1_0_7Probs_sound ((0,0) : PairSlot))) (entropyTerm_zero_ball (Z1_0_7Probs_sound ((0,1) : PairSlot))) (entropyTerm_zero_ball (Z1_0_7Probs_sound ((0,2) : PairSlot))) (entropyTerm_zero_ball (Z1_0_7Probs_sound ((0,3) : PairSlot))) (entropyTerm_zero_ball (Z1_0_7Probs_sound ((0,4) : PairSlot))) (entropyTerm_zero_ball (Z1_0_7Probs_sound ((0,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball (Z1_0_7Probs_sound ((1,0) : PairSlot))) (entropyTerm_zero_ball (Z1_0_7Probs_sound ((1,1) : PairSlot))) (entropyTerm_zero_ball (Z1_0_7Probs_sound ((1,2) : PairSlot))) (entropyTerm_zero_ball (Z1_0_7Probs_sound ((1,3) : PairSlot))) (entropyTerm_zero_ball (Z1_0_7Probs_sound ((1,4) : PairSlot))) (entropyTerm_zero_ball (Z1_0_7Probs_sound ((1,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball (Z1_0_7Probs_sound ((2,0) : PairSlot))) (entropyTerm_zero_ball (Z1_0_7Probs_sound ((2,1) : PairSlot))) (entropyTerm_zero_ball (Z1_0_7Probs_sound ((2,2) : PairSlot))) (entropyTerm_zero_ball (Z1_0_7Probs_sound ((2,3) : PairSlot))) (entropyTerm_zero_ball (Z1_0_7Probs_sound ((2,4) : PairSlot))) (entropyTerm_zero_ball (Z1_0_7Probs_sound ((2,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball (Z1_0_7Probs_sound ((3,0) : PairSlot))) (entropyTerm_zero_ball (Z1_0_7Probs_sound ((3,1) : PairSlot))) (entropyTerm_zero_ball (Z1_0_7Probs_sound ((3,2) : PairSlot))) (entropyTerm_zero_ball (Z1_0_7Probs_sound ((3,3) : PairSlot))) (entropyTerm_zero_ball (Z1_0_7Probs_sound ((3,4) : PairSlot))) (entropyTerm_zero_ball (Z1_0_7Probs_sound ((3,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball (Z1_0_7Probs_sound ((4,0) : PairSlot))) (entropyTerm_zero_ball (Z1_0_7Probs_sound ((4,1) : PairSlot))) (entropyTerm_zero_ball (Z1_0_7Probs_sound ((4,2) : PairSlot))) (entropyTerm_zero_ball (Z1_0_7Probs_sound ((4,3) : PairSlot))) (entropyTerm_zero_ball (Z1_0_7Probs_sound ((4,4) : PairSlot))) Z1_0_7E_4_5_sound + · exact forall_fin6 (entropyTerm_zero_ball (Z1_0_7Probs_sound ((5,0) : PairSlot))) (entropyTerm_zero_ball (Z1_0_7Probs_sound ((5,1) : PairSlot))) (entropyTerm_zero_ball (Z1_0_7Probs_sound ((5,2) : PairSlot))) (entropyTerm_zero_ball (Z1_0_7Probs_sound ((5,3) : PairSlot))) Z1_0_7E_5_4_sound (entropyTerm_zero_ball (Z1_0_7Probs_sound ((5,5) : PairSlot))) +def Z1_0_7Entropy : Ball := ⟨(6931471805599453094172319305033 / 10000000000000000000000000000000), (21175823683 / 50000000000000000000000000000000)⟩ +lemma Z1_0_7Entropy_sound : Z1_0_7Entropy.Encloses (Foundation.finiteEntropy Z1_0_7Value) := by + exact contains_sound (entropyPair_enclosed Z1_0_7Value Z1_0_7Terms Z1_0_7Terms_sound) (by decide +kernel) +def Z1_0_7Labels : Ball := ⟨(115129254649702284200899544090987 / 50000000000000000000000000000000), (21175823683 / 25000000000000000000000000000000)⟩ +lemma Z1_0_7Labels_sound : Z1_0_7Labels.Encloses + (∑ a : PairSlot, (zeroPairLaw (shape 1 0 7) a.1 a.2 : ℝ) * + Real.log (AllFieldParameters.multiplicity a.1 * AllFieldParameters.multiplicity a.2 : ℕ)) := by + exact contains_sound (pairSumBall_sound (fun a => .mul (Z1_0_7Probs a) (multLogs a)) + _ (fun a => Ball.mul_sound (Z1_0_7Probs_sound a) (multLogs_sound a))) (by decide +kernel) +def Z1_0_7Four : Ball := ⟨(18723326709712443708970142577019 / 6250000000000000000000000000000), (63527471049 / 50000000000000000000000000000000)⟩ +lemma Z1_0_7Four_sound : Z1_0_7Four.Encloses (AllFieldZeroLeafRates.fourRate (shape 1 0 7)) := by + exact contains_sound (Ball.add_sound Z1_0_7Entropy_sound Z1_0_7Labels_sound) (by decide +kernel) +def Z1_0_7H0Value (a : PairSlot) : ℝ := (halfLaw (shape 1 0 7) 0 a : ℝ) +def Z1_0_7H0E_1_0LogWitness : LogWitness := ⟨-1, 1, 1⟩ +def Z1_0_7H0E_1_0Log : Ball := ⟨(-6931471805599453094172319305033 / 10000000000000000000000000000000), (8470329473 / 20000000000000000000000000000000)⟩ +lemma Z1_0_7H0E_1_0Log_sound : Z1_0_7H0E_1_0Log.Encloses (Real.log (Z1_0_7H0Value ((1,0) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound ((Z1_0_7Half_sound 0) ((1,0) : PairSlot)) (w := Z1_0_7H0E_1_0LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z1_0_7H0E_1_0 : Ball := ⟨(6931471805599453094172319305033 / 20000000000000000000000000000000), (21175823683 / 100000000000000000000000000000000)⟩ +lemma Z1_0_7H0E_1_0_sound : Z1_0_7H0E_1_0.Encloses (Foundation.entropyTerm (Z1_0_7H0Value ((1,0) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z1_0_7Half_sound 0) ((1,0) : PairSlot)) Z1_0_7H0E_1_0Log_sound) (by decide +kernel) +def Z1_0_7H0E_0_1LogWitness : LogWitness := ⟨-1, 1, 1⟩ +def Z1_0_7H0E_0_1Log : Ball := ⟨(-6931471805599453094172319305033 / 10000000000000000000000000000000), (8470329473 / 20000000000000000000000000000000)⟩ +lemma Z1_0_7H0E_0_1Log_sound : Z1_0_7H0E_0_1Log.Encloses (Real.log (Z1_0_7H0Value ((0,1) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound ((Z1_0_7Half_sound 0) ((0,1) : PairSlot)) (w := Z1_0_7H0E_0_1LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z1_0_7H0E_0_1 : Ball := ⟨(6931471805599453094172319305033 / 20000000000000000000000000000000), (21175823683 / 100000000000000000000000000000000)⟩ +lemma Z1_0_7H0E_0_1_sound : Z1_0_7H0E_0_1.Encloses (Foundation.entropyTerm (Z1_0_7H0Value ((0,1) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z1_0_7Half_sound 0) ((0,1) : PairSlot)) Z1_0_7H0E_0_1Log_sound) (by decide +kernel) +def Z1_0_7H0Terms (a : PairSlot) : Ball := + match a.1.val, a.2.val with + | 1, 0 => ⟨(6931471805599453094172319305033 / 20000000000000000000000000000000), (21175823683 / 100000000000000000000000000000000)⟩ + | 0, 1 => ⟨(6931471805599453094172319305033 / 20000000000000000000000000000000), (21175823683 / 100000000000000000000000000000000)⟩ + | _, _ => (.exact 0) +lemma Z1_0_7H0Terms_sound (a : PairSlot) : + (Z1_0_7H0Terms a).Encloses (Foundation.entropyTerm (Z1_0_7H0Value a)) := by + rcases a with ⟨i,j⟩ + revert j i + apply forall_fin6 + · exact forall_fin6 (entropyTerm_zero_ball ((Z1_0_7Half_sound 0) ((0,0) : PairSlot))) Z1_0_7H0E_0_1_sound (entropyTerm_zero_ball ((Z1_0_7Half_sound 0) ((0,2) : PairSlot))) (entropyTerm_zero_ball ((Z1_0_7Half_sound 0) ((0,3) : PairSlot))) (entropyTerm_zero_ball ((Z1_0_7Half_sound 0) ((0,4) : PairSlot))) (entropyTerm_zero_ball ((Z1_0_7Half_sound 0) ((0,5) : PairSlot))) + · exact forall_fin6 Z1_0_7H0E_1_0_sound (entropyTerm_zero_ball ((Z1_0_7Half_sound 0) ((1,1) : PairSlot))) (entropyTerm_zero_ball ((Z1_0_7Half_sound 0) ((1,2) : PairSlot))) (entropyTerm_zero_ball ((Z1_0_7Half_sound 0) ((1,3) : PairSlot))) (entropyTerm_zero_ball ((Z1_0_7Half_sound 0) ((1,4) : PairSlot))) (entropyTerm_zero_ball ((Z1_0_7Half_sound 0) ((1,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z1_0_7Half_sound 0) ((2,0) : PairSlot))) (entropyTerm_zero_ball ((Z1_0_7Half_sound 0) ((2,1) : PairSlot))) (entropyTerm_zero_ball ((Z1_0_7Half_sound 0) ((2,2) : PairSlot))) (entropyTerm_zero_ball ((Z1_0_7Half_sound 0) ((2,3) : PairSlot))) (entropyTerm_zero_ball ((Z1_0_7Half_sound 0) ((2,4) : PairSlot))) (entropyTerm_zero_ball ((Z1_0_7Half_sound 0) ((2,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z1_0_7Half_sound 0) ((3,0) : PairSlot))) (entropyTerm_zero_ball ((Z1_0_7Half_sound 0) ((3,1) : PairSlot))) (entropyTerm_zero_ball ((Z1_0_7Half_sound 0) ((3,2) : PairSlot))) (entropyTerm_zero_ball ((Z1_0_7Half_sound 0) ((3,3) : PairSlot))) (entropyTerm_zero_ball ((Z1_0_7Half_sound 0) ((3,4) : PairSlot))) (entropyTerm_zero_ball ((Z1_0_7Half_sound 0) ((3,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z1_0_7Half_sound 0) ((4,0) : PairSlot))) (entropyTerm_zero_ball ((Z1_0_7Half_sound 0) ((4,1) : PairSlot))) (entropyTerm_zero_ball ((Z1_0_7Half_sound 0) ((4,2) : PairSlot))) (entropyTerm_zero_ball ((Z1_0_7Half_sound 0) ((4,3) : PairSlot))) (entropyTerm_zero_ball ((Z1_0_7Half_sound 0) ((4,4) : PairSlot))) (entropyTerm_zero_ball ((Z1_0_7Half_sound 0) ((4,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z1_0_7Half_sound 0) ((5,0) : PairSlot))) (entropyTerm_zero_ball ((Z1_0_7Half_sound 0) ((5,1) : PairSlot))) (entropyTerm_zero_ball ((Z1_0_7Half_sound 0) ((5,2) : PairSlot))) (entropyTerm_zero_ball ((Z1_0_7Half_sound 0) ((5,3) : PairSlot))) (entropyTerm_zero_ball ((Z1_0_7Half_sound 0) ((5,4) : PairSlot))) (entropyTerm_zero_ball ((Z1_0_7Half_sound 0) ((5,5) : PairSlot))) +def Z1_0_7H0Entropy : Ball := ⟨(6931471805599453094172319305033 / 10000000000000000000000000000000), (21175823683 / 50000000000000000000000000000000)⟩ +lemma Z1_0_7H0Entropy_sound : Z1_0_7H0Entropy.Encloses (Foundation.finiteEntropy Z1_0_7H0Value) := by + exact contains_sound (entropyPair_enclosed Z1_0_7H0Value Z1_0_7H0Terms Z1_0_7H0Terms_sound) (by decide +kernel) +def Z1_0_7H0Mass : Ball := ⟨1, 0⟩ +lemma Z1_0_7H0Mass_sound : Z1_0_7H0Mass.Encloses (∑ a, Z1_0_7H0Value a) := by + exact contains_sound (pairSumBall_sound (Z1_0_7Half 0) Z1_0_7H0Value (Z1_0_7Half_sound 0)) (by decide +kernel) +def Z1_0_7H0MassTermLog : Ball := .exact 0 +lemma Z1_0_7H0MassTermLog_sound : Z1_0_7H0MassTermLog.Encloses (Real.log ((∑ a, Z1_0_7H0Value a))) := by + exact log_exact_one_ball (Z1_0_7H0Mass_sound) +def Z1_0_7H0MassTerm : Ball := ⟨0, 0⟩ +lemma Z1_0_7H0MassTerm_sound : Z1_0_7H0MassTerm.Encloses (Foundation.entropyTerm ((∑ a, Z1_0_7H0Value a))) := by + exact contains_sound (entropyTerm_ball (Z1_0_7H0Mass_sound) Z1_0_7H0MassTermLog_sound) (by decide +kernel) +def Z1_0_7H0H : Ball := ⟨(6931471805599453094172319305033 / 10000000000000000000000000000000), (21175823683 / 50000000000000000000000000000000)⟩ +lemma Z1_0_7H0H_sound : Z1_0_7H0H.Encloses (homogeneousEntropy Z1_0_7H0Value) := by + exact contains_sound (homogeneous_enclosed Z1_0_7H0Value Z1_0_7H0MassTerm_sound Z1_0_7H0Entropy_sound) (by decide +kernel) +def Z1_0_7H1Value (a : PairSlot) : ℝ := (halfLaw (shape 1 0 7) 1 a : ℝ) +def Z1_0_7H1E_0_0Log : Ball := .exact 0 +lemma Z1_0_7H1E_0_0Log_sound : Z1_0_7H1E_0_0Log.Encloses (Real.log (Z1_0_7H1Value ((0,0) : PairSlot))) := by + exact log_exact_one_ball ((Z1_0_7Half_sound 1) ((0,0) : PairSlot)) +def Z1_0_7H1E_0_0 : Ball := ⟨0, 0⟩ +lemma Z1_0_7H1E_0_0_sound : Z1_0_7H1E_0_0.Encloses (Foundation.entropyTerm (Z1_0_7H1Value ((0,0) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z1_0_7Half_sound 1) ((0,0) : PairSlot)) Z1_0_7H1E_0_0Log_sound) (by decide +kernel) +def Z1_0_7H1Terms (a : PairSlot) : Ball := + match a.1.val, a.2.val with + | 0, 0 => ⟨0, 0⟩ + | _, _ => (.exact 0) +lemma Z1_0_7H1Terms_sound (a : PairSlot) : + (Z1_0_7H1Terms a).Encloses (Foundation.entropyTerm (Z1_0_7H1Value a)) := by + rcases a with ⟨i,j⟩ + revert j i + apply forall_fin6 + · exact forall_fin6 Z1_0_7H1E_0_0_sound (entropyTerm_zero_ball ((Z1_0_7Half_sound 1) ((0,1) : PairSlot))) (entropyTerm_zero_ball ((Z1_0_7Half_sound 1) ((0,2) : PairSlot))) (entropyTerm_zero_ball ((Z1_0_7Half_sound 1) ((0,3) : PairSlot))) (entropyTerm_zero_ball ((Z1_0_7Half_sound 1) ((0,4) : PairSlot))) (entropyTerm_zero_ball ((Z1_0_7Half_sound 1) ((0,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z1_0_7Half_sound 1) ((1,0) : PairSlot))) (entropyTerm_zero_ball ((Z1_0_7Half_sound 1) ((1,1) : PairSlot))) (entropyTerm_zero_ball ((Z1_0_7Half_sound 1) ((1,2) : PairSlot))) (entropyTerm_zero_ball ((Z1_0_7Half_sound 1) ((1,3) : PairSlot))) (entropyTerm_zero_ball ((Z1_0_7Half_sound 1) ((1,4) : PairSlot))) (entropyTerm_zero_ball ((Z1_0_7Half_sound 1) ((1,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z1_0_7Half_sound 1) ((2,0) : PairSlot))) (entropyTerm_zero_ball ((Z1_0_7Half_sound 1) ((2,1) : PairSlot))) (entropyTerm_zero_ball ((Z1_0_7Half_sound 1) ((2,2) : PairSlot))) (entropyTerm_zero_ball ((Z1_0_7Half_sound 1) ((2,3) : PairSlot))) (entropyTerm_zero_ball ((Z1_0_7Half_sound 1) ((2,4) : PairSlot))) (entropyTerm_zero_ball ((Z1_0_7Half_sound 1) ((2,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z1_0_7Half_sound 1) ((3,0) : PairSlot))) (entropyTerm_zero_ball ((Z1_0_7Half_sound 1) ((3,1) : PairSlot))) (entropyTerm_zero_ball ((Z1_0_7Half_sound 1) ((3,2) : PairSlot))) (entropyTerm_zero_ball ((Z1_0_7Half_sound 1) ((3,3) : PairSlot))) (entropyTerm_zero_ball ((Z1_0_7Half_sound 1) ((3,4) : PairSlot))) (entropyTerm_zero_ball ((Z1_0_7Half_sound 1) ((3,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z1_0_7Half_sound 1) ((4,0) : PairSlot))) (entropyTerm_zero_ball ((Z1_0_7Half_sound 1) ((4,1) : PairSlot))) (entropyTerm_zero_ball ((Z1_0_7Half_sound 1) ((4,2) : PairSlot))) (entropyTerm_zero_ball ((Z1_0_7Half_sound 1) ((4,3) : PairSlot))) (entropyTerm_zero_ball ((Z1_0_7Half_sound 1) ((4,4) : PairSlot))) (entropyTerm_zero_ball ((Z1_0_7Half_sound 1) ((4,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z1_0_7Half_sound 1) ((5,0) : PairSlot))) (entropyTerm_zero_ball ((Z1_0_7Half_sound 1) ((5,1) : PairSlot))) (entropyTerm_zero_ball ((Z1_0_7Half_sound 1) ((5,2) : PairSlot))) (entropyTerm_zero_ball ((Z1_0_7Half_sound 1) ((5,3) : PairSlot))) (entropyTerm_zero_ball ((Z1_0_7Half_sound 1) ((5,4) : PairSlot))) (entropyTerm_zero_ball ((Z1_0_7Half_sound 1) ((5,5) : PairSlot))) +def Z1_0_7H1Entropy : Ball := ⟨0, 0⟩ +lemma Z1_0_7H1Entropy_sound : Z1_0_7H1Entropy.Encloses (Foundation.finiteEntropy Z1_0_7H1Value) := by + exact contains_sound (entropyPair_enclosed Z1_0_7H1Value Z1_0_7H1Terms Z1_0_7H1Terms_sound) (by decide +kernel) +def Z1_0_7H1Mass : Ball := ⟨1, 0⟩ +lemma Z1_0_7H1Mass_sound : Z1_0_7H1Mass.Encloses (∑ a, Z1_0_7H1Value a) := by + exact contains_sound (pairSumBall_sound (Z1_0_7Half 1) Z1_0_7H1Value (Z1_0_7Half_sound 1)) (by decide +kernel) +def Z1_0_7H1MassTermLog : Ball := .exact 0 +lemma Z1_0_7H1MassTermLog_sound : Z1_0_7H1MassTermLog.Encloses (Real.log ((∑ a, Z1_0_7H1Value a))) := by + exact log_exact_one_ball (Z1_0_7H1Mass_sound) +def Z1_0_7H1MassTerm : Ball := ⟨0, 0⟩ +lemma Z1_0_7H1MassTerm_sound : Z1_0_7H1MassTerm.Encloses (Foundation.entropyTerm ((∑ a, Z1_0_7H1Value a))) := by + exact contains_sound (entropyTerm_ball (Z1_0_7H1Mass_sound) Z1_0_7H1MassTermLog_sound) (by decide +kernel) +def Z1_0_7H1H : Ball := ⟨0, 0⟩ +lemma Z1_0_7H1H_sound : Z1_0_7H1H.Encloses (homogeneousEntropy Z1_0_7H1Value) := by + exact contains_sound (homogeneous_enclosed Z1_0_7H1Value Z1_0_7H1MassTerm_sound Z1_0_7H1Entropy_sound) (by decide +kernel) +def Z1_0_7H2Value (a : PairSlot) : ℝ := (halfLaw (shape 1 0 7) 2 a : ℝ) +def Z1_0_7H2E_4_5LogWitness : LogWitness := ⟨-1, 1, 1⟩ +def Z1_0_7H2E_4_5Log : Ball := ⟨(-6931471805599453094172319305033 / 10000000000000000000000000000000), (8470329473 / 20000000000000000000000000000000)⟩ +lemma Z1_0_7H2E_4_5Log_sound : Z1_0_7H2E_4_5Log.Encloses (Real.log (Z1_0_7H2Value ((4,5) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound ((Z1_0_7Half_sound 2) ((4,5) : PairSlot)) (w := Z1_0_7H2E_4_5LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z1_0_7H2E_4_5 : Ball := ⟨(6931471805599453094172319305033 / 20000000000000000000000000000000), (21175823683 / 100000000000000000000000000000000)⟩ +lemma Z1_0_7H2E_4_5_sound : Z1_0_7H2E_4_5.Encloses (Foundation.entropyTerm (Z1_0_7H2Value ((4,5) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z1_0_7Half_sound 2) ((4,5) : PairSlot)) Z1_0_7H2E_4_5Log_sound) (by decide +kernel) +def Z1_0_7H2E_5_4LogWitness : LogWitness := ⟨-1, 1, 1⟩ +def Z1_0_7H2E_5_4Log : Ball := ⟨(-6931471805599453094172319305033 / 10000000000000000000000000000000), (8470329473 / 20000000000000000000000000000000)⟩ +lemma Z1_0_7H2E_5_4Log_sound : Z1_0_7H2E_5_4Log.Encloses (Real.log (Z1_0_7H2Value ((5,4) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound ((Z1_0_7Half_sound 2) ((5,4) : PairSlot)) (w := Z1_0_7H2E_5_4LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z1_0_7H2E_5_4 : Ball := ⟨(6931471805599453094172319305033 / 20000000000000000000000000000000), (21175823683 / 100000000000000000000000000000000)⟩ +lemma Z1_0_7H2E_5_4_sound : Z1_0_7H2E_5_4.Encloses (Foundation.entropyTerm (Z1_0_7H2Value ((5,4) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z1_0_7Half_sound 2) ((5,4) : PairSlot)) Z1_0_7H2E_5_4Log_sound) (by decide +kernel) +def Z1_0_7H2Terms (a : PairSlot) : Ball := + match a.1.val, a.2.val with + | 4, 5 => ⟨(6931471805599453094172319305033 / 20000000000000000000000000000000), (21175823683 / 100000000000000000000000000000000)⟩ + | 5, 4 => ⟨(6931471805599453094172319305033 / 20000000000000000000000000000000), (21175823683 / 100000000000000000000000000000000)⟩ + | _, _ => (.exact 0) +lemma Z1_0_7H2Terms_sound (a : PairSlot) : + (Z1_0_7H2Terms a).Encloses (Foundation.entropyTerm (Z1_0_7H2Value a)) := by + rcases a with ⟨i,j⟩ + revert j i + apply forall_fin6 + · exact forall_fin6 (entropyTerm_zero_ball ((Z1_0_7Half_sound 2) ((0,0) : PairSlot))) (entropyTerm_zero_ball ((Z1_0_7Half_sound 2) ((0,1) : PairSlot))) (entropyTerm_zero_ball ((Z1_0_7Half_sound 2) ((0,2) : PairSlot))) (entropyTerm_zero_ball ((Z1_0_7Half_sound 2) ((0,3) : PairSlot))) (entropyTerm_zero_ball ((Z1_0_7Half_sound 2) ((0,4) : PairSlot))) (entropyTerm_zero_ball ((Z1_0_7Half_sound 2) ((0,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z1_0_7Half_sound 2) ((1,0) : PairSlot))) (entropyTerm_zero_ball ((Z1_0_7Half_sound 2) ((1,1) : PairSlot))) (entropyTerm_zero_ball ((Z1_0_7Half_sound 2) ((1,2) : PairSlot))) (entropyTerm_zero_ball ((Z1_0_7Half_sound 2) ((1,3) : PairSlot))) (entropyTerm_zero_ball ((Z1_0_7Half_sound 2) ((1,4) : PairSlot))) (entropyTerm_zero_ball ((Z1_0_7Half_sound 2) ((1,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z1_0_7Half_sound 2) ((2,0) : PairSlot))) (entropyTerm_zero_ball ((Z1_0_7Half_sound 2) ((2,1) : PairSlot))) (entropyTerm_zero_ball ((Z1_0_7Half_sound 2) ((2,2) : PairSlot))) (entropyTerm_zero_ball ((Z1_0_7Half_sound 2) ((2,3) : PairSlot))) (entropyTerm_zero_ball ((Z1_0_7Half_sound 2) ((2,4) : PairSlot))) (entropyTerm_zero_ball ((Z1_0_7Half_sound 2) ((2,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z1_0_7Half_sound 2) ((3,0) : PairSlot))) (entropyTerm_zero_ball ((Z1_0_7Half_sound 2) ((3,1) : PairSlot))) (entropyTerm_zero_ball ((Z1_0_7Half_sound 2) ((3,2) : PairSlot))) (entropyTerm_zero_ball ((Z1_0_7Half_sound 2) ((3,3) : PairSlot))) (entropyTerm_zero_ball ((Z1_0_7Half_sound 2) ((3,4) : PairSlot))) (entropyTerm_zero_ball ((Z1_0_7Half_sound 2) ((3,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z1_0_7Half_sound 2) ((4,0) : PairSlot))) (entropyTerm_zero_ball ((Z1_0_7Half_sound 2) ((4,1) : PairSlot))) (entropyTerm_zero_ball ((Z1_0_7Half_sound 2) ((4,2) : PairSlot))) (entropyTerm_zero_ball ((Z1_0_7Half_sound 2) ((4,3) : PairSlot))) (entropyTerm_zero_ball ((Z1_0_7Half_sound 2) ((4,4) : PairSlot))) Z1_0_7H2E_4_5_sound + · exact forall_fin6 (entropyTerm_zero_ball ((Z1_0_7Half_sound 2) ((5,0) : PairSlot))) (entropyTerm_zero_ball ((Z1_0_7Half_sound 2) ((5,1) : PairSlot))) (entropyTerm_zero_ball ((Z1_0_7Half_sound 2) ((5,2) : PairSlot))) (entropyTerm_zero_ball ((Z1_0_7Half_sound 2) ((5,3) : PairSlot))) Z1_0_7H2E_5_4_sound (entropyTerm_zero_ball ((Z1_0_7Half_sound 2) ((5,5) : PairSlot))) +def Z1_0_7H2Entropy : Ball := ⟨(6931471805599453094172319305033 / 10000000000000000000000000000000), (21175823683 / 50000000000000000000000000000000)⟩ +lemma Z1_0_7H2Entropy_sound : Z1_0_7H2Entropy.Encloses (Foundation.finiteEntropy Z1_0_7H2Value) := by + exact contains_sound (entropyPair_enclosed Z1_0_7H2Value Z1_0_7H2Terms Z1_0_7H2Terms_sound) (by decide +kernel) +def Z1_0_7H2Mass : Ball := ⟨1, 0⟩ +lemma Z1_0_7H2Mass_sound : Z1_0_7H2Mass.Encloses (∑ a, Z1_0_7H2Value a) := by + exact contains_sound (pairSumBall_sound (Z1_0_7Half 2) Z1_0_7H2Value (Z1_0_7Half_sound 2)) (by decide +kernel) +def Z1_0_7H2MassTermLog : Ball := .exact 0 +lemma Z1_0_7H2MassTermLog_sound : Z1_0_7H2MassTermLog.Encloses (Real.log ((∑ a, Z1_0_7H2Value a))) := by + exact log_exact_one_ball (Z1_0_7H2Mass_sound) +def Z1_0_7H2MassTerm : Ball := ⟨0, 0⟩ +lemma Z1_0_7H2MassTerm_sound : Z1_0_7H2MassTerm.Encloses (Foundation.entropyTerm ((∑ a, Z1_0_7H2Value a))) := by + exact contains_sound (entropyTerm_ball (Z1_0_7H2Mass_sound) Z1_0_7H2MassTermLog_sound) (by decide +kernel) +def Z1_0_7H2H : Ball := ⟨(6931471805599453094172319305033 / 10000000000000000000000000000000), (21175823683 / 50000000000000000000000000000000)⟩ +lemma Z1_0_7H2H_sound : Z1_0_7H2H.Encloses (homogeneousEntropy Z1_0_7H2Value) := by + exact contains_sound (homogeneous_enclosed Z1_0_7H2Value Z1_0_7H2MassTerm_sound Z1_0_7H2Entropy_sound) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/Certificates/Four1_7_0.lean b/lean/OAI/LinearAlgebra/MatrixFields/Certificates/Four1_7_0.lean new file mode 100644 index 0000000000000000000000000000000000000000..69705420db082b7c2fbdb2cea6aadb718e684b25 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/Certificates/Four1_7_0.lean @@ -0,0 +1,455 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Certificates.Zero0_1_7 + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def Z1_7_0Raw (ij : PairSlot) : Ball := + match ij.1.val, ij.2.val with + | 0, 0 => w195 + | 0, 1 => w195 + | 0, 2 => w195 + | 0, 3 => w195 + | 0, 4 => w195 + | 0, 5 => w195 + | 1, 0 => w195 + | 1, 1 => w195 + | 1, 2 => w195 + | 1, 3 => w195 + | 1, 4 => w195 + | 1, 5 => w195 + | 2, 0 => w195 + | 2, 1 => w195 + | 2, 2 => w195 + | 2, 3 => w195 + | 2, 4 => w195 + | 2, 5 => w195 + | 3, 0 => w195 + | 3, 1 => w195 + | 3, 2 => w195 + | 3, 3 => w195 + | 3, 4 => w195 + | 3, 5 => w195 + | 4, 0 => w195 + | 4, 1 => w195 + | 4, 2 => w195 + | 4, 3 => w195 + | 4, 4 => w195 + | 4, 5 => w195 + | 5, 0 => w195 + | 5, 1 => w195 + | 5, 2 => w195 + | 5, 3 => w195 + | 5, 4 => w195 + | 5, 5 => w195 + | _, _ => (.exact 0) +lemma Z1_7_0Raw_sound_0 (j : Fin 6) : + (Z1_7_0Raw (0,j)).Encloses (weight (orderedPairInteger (shape 1 7 0) 0 j) : ℝ) := by + fin_cases j + · change (Z1_7_0Raw (0,0)).Encloses (weight (orderedPairInteger (shape 1 7 0) 0 0) : ℝ) + have he : orderedPairInteger (shape 1 7 0) 0 0 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z1_7_0Raw (0,1)).Encloses (weight (orderedPairInteger (shape 1 7 0) 0 1) : ℝ) + have he : orderedPairInteger (shape 1 7 0) 0 1 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z1_7_0Raw (0,2)).Encloses (weight (orderedPairInteger (shape 1 7 0) 0 2) : ℝ) + have he : orderedPairInteger (shape 1 7 0) 0 2 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z1_7_0Raw (0,3)).Encloses (weight (orderedPairInteger (shape 1 7 0) 0 3) : ℝ) + have he : orderedPairInteger (shape 1 7 0) 0 3 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z1_7_0Raw (0,4)).Encloses (weight (orderedPairInteger (shape 1 7 0) 0 4) : ℝ) + have he : orderedPairInteger (shape 1 7 0) 0 4 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z1_7_0Raw (0,5)).Encloses (weight (orderedPairInteger (shape 1 7 0) 0 5) : ℝ) + have he : orderedPairInteger (shape 1 7 0) 0 5 = (0) := by decide +kernel + rw [he] + exact w195_sound +lemma Z1_7_0Raw_sound_1 (j : Fin 6) : + (Z1_7_0Raw (1,j)).Encloses (weight (orderedPairInteger (shape 1 7 0) 1 j) : ℝ) := by + fin_cases j + · change (Z1_7_0Raw (1,0)).Encloses (weight (orderedPairInteger (shape 1 7 0) 1 0) : ℝ) + have he : orderedPairInteger (shape 1 7 0) 1 0 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z1_7_0Raw (1,1)).Encloses (weight (orderedPairInteger (shape 1 7 0) 1 1) : ℝ) + have he : orderedPairInteger (shape 1 7 0) 1 1 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z1_7_0Raw (1,2)).Encloses (weight (orderedPairInteger (shape 1 7 0) 1 2) : ℝ) + have he : orderedPairInteger (shape 1 7 0) 1 2 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z1_7_0Raw (1,3)).Encloses (weight (orderedPairInteger (shape 1 7 0) 1 3) : ℝ) + have he : orderedPairInteger (shape 1 7 0) 1 3 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z1_7_0Raw (1,4)).Encloses (weight (orderedPairInteger (shape 1 7 0) 1 4) : ℝ) + have he : orderedPairInteger (shape 1 7 0) 1 4 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z1_7_0Raw (1,5)).Encloses (weight (orderedPairInteger (shape 1 7 0) 1 5) : ℝ) + have he : orderedPairInteger (shape 1 7 0) 1 5 = (0) := by decide +kernel + rw [he] + exact w195_sound +lemma Z1_7_0Raw_sound_2 (j : Fin 6) : + (Z1_7_0Raw (2,j)).Encloses (weight (orderedPairInteger (shape 1 7 0) 2 j) : ℝ) := by + fin_cases j + · change (Z1_7_0Raw (2,0)).Encloses (weight (orderedPairInteger (shape 1 7 0) 2 0) : ℝ) + have he : orderedPairInteger (shape 1 7 0) 2 0 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z1_7_0Raw (2,1)).Encloses (weight (orderedPairInteger (shape 1 7 0) 2 1) : ℝ) + have he : orderedPairInteger (shape 1 7 0) 2 1 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z1_7_0Raw (2,2)).Encloses (weight (orderedPairInteger (shape 1 7 0) 2 2) : ℝ) + have he : orderedPairInteger (shape 1 7 0) 2 2 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z1_7_0Raw (2,3)).Encloses (weight (orderedPairInteger (shape 1 7 0) 2 3) : ℝ) + have he : orderedPairInteger (shape 1 7 0) 2 3 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z1_7_0Raw (2,4)).Encloses (weight (orderedPairInteger (shape 1 7 0) 2 4) : ℝ) + have he : orderedPairInteger (shape 1 7 0) 2 4 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z1_7_0Raw (2,5)).Encloses (weight (orderedPairInteger (shape 1 7 0) 2 5) : ℝ) + have he : orderedPairInteger (shape 1 7 0) 2 5 = (0) := by decide +kernel + rw [he] + exact w195_sound +lemma Z1_7_0Raw_sound_3 (j : Fin 6) : + (Z1_7_0Raw (3,j)).Encloses (weight (orderedPairInteger (shape 1 7 0) 3 j) : ℝ) := by + fin_cases j + · change (Z1_7_0Raw (3,0)).Encloses (weight (orderedPairInteger (shape 1 7 0) 3 0) : ℝ) + have he : orderedPairInteger (shape 1 7 0) 3 0 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z1_7_0Raw (3,1)).Encloses (weight (orderedPairInteger (shape 1 7 0) 3 1) : ℝ) + have he : orderedPairInteger (shape 1 7 0) 3 1 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z1_7_0Raw (3,2)).Encloses (weight (orderedPairInteger (shape 1 7 0) 3 2) : ℝ) + have he : orderedPairInteger (shape 1 7 0) 3 2 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z1_7_0Raw (3,3)).Encloses (weight (orderedPairInteger (shape 1 7 0) 3 3) : ℝ) + have he : orderedPairInteger (shape 1 7 0) 3 3 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z1_7_0Raw (3,4)).Encloses (weight (orderedPairInteger (shape 1 7 0) 3 4) : ℝ) + have he : orderedPairInteger (shape 1 7 0) 3 4 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z1_7_0Raw (3,5)).Encloses (weight (orderedPairInteger (shape 1 7 0) 3 5) : ℝ) + have he : orderedPairInteger (shape 1 7 0) 3 5 = (0) := by decide +kernel + rw [he] + exact w195_sound +lemma Z1_7_0Raw_sound_4 (j : Fin 6) : + (Z1_7_0Raw (4,j)).Encloses (weight (orderedPairInteger (shape 1 7 0) 4 j) : ℝ) := by + fin_cases j + · change (Z1_7_0Raw (4,0)).Encloses (weight (orderedPairInteger (shape 1 7 0) 4 0) : ℝ) + have he : orderedPairInteger (shape 1 7 0) 4 0 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z1_7_0Raw (4,1)).Encloses (weight (orderedPairInteger (shape 1 7 0) 4 1) : ℝ) + have he : orderedPairInteger (shape 1 7 0) 4 1 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z1_7_0Raw (4,2)).Encloses (weight (orderedPairInteger (shape 1 7 0) 4 2) : ℝ) + have he : orderedPairInteger (shape 1 7 0) 4 2 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z1_7_0Raw (4,3)).Encloses (weight (orderedPairInteger (shape 1 7 0) 4 3) : ℝ) + have he : orderedPairInteger (shape 1 7 0) 4 3 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z1_7_0Raw (4,4)).Encloses (weight (orderedPairInteger (shape 1 7 0) 4 4) : ℝ) + have he : orderedPairInteger (shape 1 7 0) 4 4 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z1_7_0Raw (4,5)).Encloses (weight (orderedPairInteger (shape 1 7 0) 4 5) : ℝ) + have he : orderedPairInteger (shape 1 7 0) 4 5 = (0) := by decide +kernel + rw [he] + exact w195_sound +lemma Z1_7_0Raw_sound_5 (j : Fin 6) : + (Z1_7_0Raw (5,j)).Encloses (weight (orderedPairInteger (shape 1 7 0) 5 j) : ℝ) := by + fin_cases j + · change (Z1_7_0Raw (5,0)).Encloses (weight (orderedPairInteger (shape 1 7 0) 5 0) : ℝ) + have he : orderedPairInteger (shape 1 7 0) 5 0 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z1_7_0Raw (5,1)).Encloses (weight (orderedPairInteger (shape 1 7 0) 5 1) : ℝ) + have he : orderedPairInteger (shape 1 7 0) 5 1 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z1_7_0Raw (5,2)).Encloses (weight (orderedPairInteger (shape 1 7 0) 5 2) : ℝ) + have he : orderedPairInteger (shape 1 7 0) 5 2 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z1_7_0Raw (5,3)).Encloses (weight (orderedPairInteger (shape 1 7 0) 5 3) : ℝ) + have he : orderedPairInteger (shape 1 7 0) 5 3 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z1_7_0Raw (5,4)).Encloses (weight (orderedPairInteger (shape 1 7 0) 5 4) : ℝ) + have he : orderedPairInteger (shape 1 7 0) 5 4 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z1_7_0Raw (5,5)).Encloses (weight (orderedPairInteger (shape 1 7 0) 5 5) : ℝ) + have he : orderedPairInteger (shape 1 7 0) 5 5 = (0) := by decide +kernel + rw [he] + exact w195_sound +lemma Z1_7_0Raw_sound (ij : PairSlot) : + (Z1_7_0Raw ij).Encloses (weight (orderedPairInteger (shape 1 7 0) ij.1 ij.2) : ℝ) := by + rcases ij with ⟨i,j⟩ + revert i + exact forall_fin6 (Z1_7_0Raw_sound_0 j) (Z1_7_0Raw_sound_1 j) (Z1_7_0Raw_sound_2 j) (Z1_7_0Raw_sound_3 j) (Z1_7_0Raw_sound_4 j) (Z1_7_0Raw_sound_5 j) +def Z1_7_0Den : Ball := ⟨2, 0⟩ +lemma Z1_7_0Den_sound : Z1_7_0Den.Encloses + (((orderedPairs (shape 1 7 0)).map (fun ij => weight (orderedPairInteger (shape 1 7 0) ij.1 ij.2))).sum : ℝ) := by + exact contains_sound (list_cast_enclosed (orderedPairs (shape 1 7 0)) Z1_7_0Raw + (fun ij => weight (orderedPairInteger (shape 1 7 0) ij.1 ij.2)) + (fun ij _ => Z1_7_0Raw_sound ij)) (by decide +kernel) +lemma Z1_7_0Den_pos : 0 < Z1_7_0Den.lower := by decide +kernel +def Z1_7_0Probs (ij : PairSlot) : Ball := + match ij.1.val, ij.2.val with + | 4, 5 => ⟨(1 / 2), 0⟩ + | 5, 4 => ⟨(1 / 2), 0⟩ + | _, _ => (.exact 0) +lemma Z1_7_0Contains : ∀ i j : Fin 6, + statisticWeight i + statisticWeight j = shapeMax (shape 1 7 0) → + contains (.mul (Z1_7_0Raw (i,j)) (.inv Z1_7_0Den)) (Z1_7_0Probs (i,j)) = true := by + decide +kernel +lemma Z1_7_0Zero : ∀ i j : Fin 6, + statisticWeight i + statisticWeight j ≠ shapeMax (shape 1 7 0) → Z1_7_0Probs (i,j) = .exact 0 := by + decide +kernel +lemma Z1_7_0Probs_sound (ij : PairSlot) : + (Z1_7_0Probs ij).Encloses (zeroPairLaw (shape 1 7 0) ij.1 ij.2 : ℝ) := by + by_cases h : statisticWeight ij.1 + statisticWeight ij.2 = shapeMax (shape 1 7 0) + · have hb := contains_sound (Ball.mul_sound (Z1_7_0Raw_sound ij) + (Ball.inv_sound Z1_7_0Den_sound Z1_7_0Den_pos)) (Z1_7_0Contains ij.1 ij.2 h) + simpa only [zeroPairLaw, h, ite_true, Rat.cast_div, Rat.cast_mul, + Rat.cast_inv, div_eq_mul_inv] using hb + · rw [Z1_7_0Zero ij.1 ij.2 h] + simpa only [zeroPairLaw, h, ite_false] using Ball.exact_sound 0 + +def Z1_7_0Half (w : Fin 3) (ij : PairSlot) : Ball := + if (shape 1 7 0) w = 0 then if ij = (0,0) then .exact 1 else .exact 0 + else if w = halfMaxAxis (shape 1 7 0) then Z1_7_0Probs ij + else Z1_7_0Probs (kappa ij.1, kappa ij.2) +lemma Z1_7_0Half_sound (w : Fin 3) (ij : PairSlot) : + (Z1_7_0Half w ij).Encloses (halfLaw (shape 1 7 0) w ij : ℝ) := by + have hp : positive (shape 1 7 0) = false := by decide +kernel + simp only [Z1_7_0Half, halfLaw, hp, Bool.false_eq_true, ite_false] + split_ifs + · exact Ball.exact_sound 1 + · exact Ball.exact_sound 0 + · exact Z1_7_0Probs_sound _ + · exact Z1_7_0Probs_sound _ + +def Z1_7_0Value (a : PairSlot) : ℝ := (zeroPairLaw (shape 1 7 0) a.1 a.2 : ℝ) +def Z1_7_0E_4_5LogWitness : LogWitness := ⟨-1, 1, 1⟩ +def Z1_7_0E_4_5Log : Ball := ⟨(-6931471805599453094172319305033 / 10000000000000000000000000000000), (8470329473 / 20000000000000000000000000000000)⟩ +lemma Z1_7_0E_4_5Log_sound : Z1_7_0E_4_5Log.Encloses (Real.log (Z1_7_0Value ((4,5) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound (Z1_7_0Probs_sound ((4,5) : PairSlot)) (w := Z1_7_0E_4_5LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z1_7_0E_4_5 : Ball := ⟨(6931471805599453094172319305033 / 20000000000000000000000000000000), (21175823683 / 100000000000000000000000000000000)⟩ +lemma Z1_7_0E_4_5_sound : Z1_7_0E_4_5.Encloses (Foundation.entropyTerm (Z1_7_0Value ((4,5) : PairSlot))) := by + exact contains_sound (entropyTerm_ball (Z1_7_0Probs_sound ((4,5) : PairSlot)) Z1_7_0E_4_5Log_sound) (by decide +kernel) +def Z1_7_0E_5_4LogWitness : LogWitness := ⟨-1, 1, 1⟩ +def Z1_7_0E_5_4Log : Ball := ⟨(-6931471805599453094172319305033 / 10000000000000000000000000000000), (8470329473 / 20000000000000000000000000000000)⟩ +lemma Z1_7_0E_5_4Log_sound : Z1_7_0E_5_4Log.Encloses (Real.log (Z1_7_0Value ((5,4) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound (Z1_7_0Probs_sound ((5,4) : PairSlot)) (w := Z1_7_0E_5_4LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z1_7_0E_5_4 : Ball := ⟨(6931471805599453094172319305033 / 20000000000000000000000000000000), (21175823683 / 100000000000000000000000000000000)⟩ +lemma Z1_7_0E_5_4_sound : Z1_7_0E_5_4.Encloses (Foundation.entropyTerm (Z1_7_0Value ((5,4) : PairSlot))) := by + exact contains_sound (entropyTerm_ball (Z1_7_0Probs_sound ((5,4) : PairSlot)) Z1_7_0E_5_4Log_sound) (by decide +kernel) +def Z1_7_0Terms (a : PairSlot) : Ball := + match a.1.val, a.2.val with + | 4, 5 => ⟨(6931471805599453094172319305033 / 20000000000000000000000000000000), (21175823683 / 100000000000000000000000000000000)⟩ + | 5, 4 => ⟨(6931471805599453094172319305033 / 20000000000000000000000000000000), (21175823683 / 100000000000000000000000000000000)⟩ + | _, _ => (.exact 0) +lemma Z1_7_0Terms_sound (a : PairSlot) : + (Z1_7_0Terms a).Encloses (Foundation.entropyTerm (Z1_7_0Value a)) := by + rcases a with ⟨i,j⟩ + revert j i + apply forall_fin6 + · exact forall_fin6 (entropyTerm_zero_ball (Z1_7_0Probs_sound ((0,0) : PairSlot))) (entropyTerm_zero_ball (Z1_7_0Probs_sound ((0,1) : PairSlot))) (entropyTerm_zero_ball (Z1_7_0Probs_sound ((0,2) : PairSlot))) (entropyTerm_zero_ball (Z1_7_0Probs_sound ((0,3) : PairSlot))) (entropyTerm_zero_ball (Z1_7_0Probs_sound ((0,4) : PairSlot))) (entropyTerm_zero_ball (Z1_7_0Probs_sound ((0,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball (Z1_7_0Probs_sound ((1,0) : PairSlot))) (entropyTerm_zero_ball (Z1_7_0Probs_sound ((1,1) : PairSlot))) (entropyTerm_zero_ball (Z1_7_0Probs_sound ((1,2) : PairSlot))) (entropyTerm_zero_ball (Z1_7_0Probs_sound ((1,3) : PairSlot))) (entropyTerm_zero_ball (Z1_7_0Probs_sound ((1,4) : PairSlot))) (entropyTerm_zero_ball (Z1_7_0Probs_sound ((1,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball (Z1_7_0Probs_sound ((2,0) : PairSlot))) (entropyTerm_zero_ball (Z1_7_0Probs_sound ((2,1) : PairSlot))) (entropyTerm_zero_ball (Z1_7_0Probs_sound ((2,2) : PairSlot))) (entropyTerm_zero_ball (Z1_7_0Probs_sound ((2,3) : PairSlot))) (entropyTerm_zero_ball (Z1_7_0Probs_sound ((2,4) : PairSlot))) (entropyTerm_zero_ball (Z1_7_0Probs_sound ((2,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball (Z1_7_0Probs_sound ((3,0) : PairSlot))) (entropyTerm_zero_ball (Z1_7_0Probs_sound ((3,1) : PairSlot))) (entropyTerm_zero_ball (Z1_7_0Probs_sound ((3,2) : PairSlot))) (entropyTerm_zero_ball (Z1_7_0Probs_sound ((3,3) : PairSlot))) (entropyTerm_zero_ball (Z1_7_0Probs_sound ((3,4) : PairSlot))) (entropyTerm_zero_ball (Z1_7_0Probs_sound ((3,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball (Z1_7_0Probs_sound ((4,0) : PairSlot))) (entropyTerm_zero_ball (Z1_7_0Probs_sound ((4,1) : PairSlot))) (entropyTerm_zero_ball (Z1_7_0Probs_sound ((4,2) : PairSlot))) (entropyTerm_zero_ball (Z1_7_0Probs_sound ((4,3) : PairSlot))) (entropyTerm_zero_ball (Z1_7_0Probs_sound ((4,4) : PairSlot))) Z1_7_0E_4_5_sound + · exact forall_fin6 (entropyTerm_zero_ball (Z1_7_0Probs_sound ((5,0) : PairSlot))) (entropyTerm_zero_ball (Z1_7_0Probs_sound ((5,1) : PairSlot))) (entropyTerm_zero_ball (Z1_7_0Probs_sound ((5,2) : PairSlot))) (entropyTerm_zero_ball (Z1_7_0Probs_sound ((5,3) : PairSlot))) Z1_7_0E_5_4_sound (entropyTerm_zero_ball (Z1_7_0Probs_sound ((5,5) : PairSlot))) +def Z1_7_0Entropy : Ball := ⟨(6931471805599453094172319305033 / 10000000000000000000000000000000), (21175823683 / 50000000000000000000000000000000)⟩ +lemma Z1_7_0Entropy_sound : Z1_7_0Entropy.Encloses (Foundation.finiteEntropy Z1_7_0Value) := by + exact contains_sound (entropyPair_enclosed Z1_7_0Value Z1_7_0Terms Z1_7_0Terms_sound) (by decide +kernel) +def Z1_7_0Labels : Ball := ⟨(115129254649702284200899544090987 / 50000000000000000000000000000000), (21175823683 / 25000000000000000000000000000000)⟩ +lemma Z1_7_0Labels_sound : Z1_7_0Labels.Encloses + (∑ a : PairSlot, (zeroPairLaw (shape 1 7 0) a.1 a.2 : ℝ) * + Real.log (AllFieldParameters.multiplicity a.1 * AllFieldParameters.multiplicity a.2 : ℕ)) := by + exact contains_sound (pairSumBall_sound (fun a => .mul (Z1_7_0Probs a) (multLogs a)) + _ (fun a => Ball.mul_sound (Z1_7_0Probs_sound a) (multLogs_sound a))) (by decide +kernel) +def Z1_7_0Four : Ball := ⟨(18723326709712443708970142577019 / 6250000000000000000000000000000), (63527471049 / 50000000000000000000000000000000)⟩ +lemma Z1_7_0Four_sound : Z1_7_0Four.Encloses (AllFieldZeroLeafRates.fourRate (shape 1 7 0)) := by + exact contains_sound (Ball.add_sound Z1_7_0Entropy_sound Z1_7_0Labels_sound) (by decide +kernel) +def Z1_7_0H0Value (a : PairSlot) : ℝ := (halfLaw (shape 1 7 0) 0 a : ℝ) +def Z1_7_0H0E_1_0LogWitness : LogWitness := ⟨-1, 1, 1⟩ +def Z1_7_0H0E_1_0Log : Ball := ⟨(-6931471805599453094172319305033 / 10000000000000000000000000000000), (8470329473 / 20000000000000000000000000000000)⟩ +lemma Z1_7_0H0E_1_0Log_sound : Z1_7_0H0E_1_0Log.Encloses (Real.log (Z1_7_0H0Value ((1,0) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound ((Z1_7_0Half_sound 0) ((1,0) : PairSlot)) (w := Z1_7_0H0E_1_0LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z1_7_0H0E_1_0 : Ball := ⟨(6931471805599453094172319305033 / 20000000000000000000000000000000), (21175823683 / 100000000000000000000000000000000)⟩ +lemma Z1_7_0H0E_1_0_sound : Z1_7_0H0E_1_0.Encloses (Foundation.entropyTerm (Z1_7_0H0Value ((1,0) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z1_7_0Half_sound 0) ((1,0) : PairSlot)) Z1_7_0H0E_1_0Log_sound) (by decide +kernel) +def Z1_7_0H0E_0_1LogWitness : LogWitness := ⟨-1, 1, 1⟩ +def Z1_7_0H0E_0_1Log : Ball := ⟨(-6931471805599453094172319305033 / 10000000000000000000000000000000), (8470329473 / 20000000000000000000000000000000)⟩ +lemma Z1_7_0H0E_0_1Log_sound : Z1_7_0H0E_0_1Log.Encloses (Real.log (Z1_7_0H0Value ((0,1) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound ((Z1_7_0Half_sound 0) ((0,1) : PairSlot)) (w := Z1_7_0H0E_0_1LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z1_7_0H0E_0_1 : Ball := ⟨(6931471805599453094172319305033 / 20000000000000000000000000000000), (21175823683 / 100000000000000000000000000000000)⟩ +lemma Z1_7_0H0E_0_1_sound : Z1_7_0H0E_0_1.Encloses (Foundation.entropyTerm (Z1_7_0H0Value ((0,1) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z1_7_0Half_sound 0) ((0,1) : PairSlot)) Z1_7_0H0E_0_1Log_sound) (by decide +kernel) +def Z1_7_0H0Terms (a : PairSlot) : Ball := + match a.1.val, a.2.val with + | 1, 0 => ⟨(6931471805599453094172319305033 / 20000000000000000000000000000000), (21175823683 / 100000000000000000000000000000000)⟩ + | 0, 1 => ⟨(6931471805599453094172319305033 / 20000000000000000000000000000000), (21175823683 / 100000000000000000000000000000000)⟩ + | _, _ => (.exact 0) +lemma Z1_7_0H0Terms_sound (a : PairSlot) : + (Z1_7_0H0Terms a).Encloses (Foundation.entropyTerm (Z1_7_0H0Value a)) := by + rcases a with ⟨i,j⟩ + revert j i + apply forall_fin6 + · exact forall_fin6 (entropyTerm_zero_ball ((Z1_7_0Half_sound 0) ((0,0) : PairSlot))) Z1_7_0H0E_0_1_sound (entropyTerm_zero_ball ((Z1_7_0Half_sound 0) ((0,2) : PairSlot))) (entropyTerm_zero_ball ((Z1_7_0Half_sound 0) ((0,3) : PairSlot))) (entropyTerm_zero_ball ((Z1_7_0Half_sound 0) ((0,4) : PairSlot))) (entropyTerm_zero_ball ((Z1_7_0Half_sound 0) ((0,5) : PairSlot))) + · exact forall_fin6 Z1_7_0H0E_1_0_sound (entropyTerm_zero_ball ((Z1_7_0Half_sound 0) ((1,1) : PairSlot))) (entropyTerm_zero_ball ((Z1_7_0Half_sound 0) ((1,2) : PairSlot))) (entropyTerm_zero_ball ((Z1_7_0Half_sound 0) ((1,3) : PairSlot))) (entropyTerm_zero_ball ((Z1_7_0Half_sound 0) ((1,4) : PairSlot))) (entropyTerm_zero_ball ((Z1_7_0Half_sound 0) ((1,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z1_7_0Half_sound 0) ((2,0) : PairSlot))) (entropyTerm_zero_ball ((Z1_7_0Half_sound 0) ((2,1) : PairSlot))) (entropyTerm_zero_ball ((Z1_7_0Half_sound 0) ((2,2) : PairSlot))) (entropyTerm_zero_ball ((Z1_7_0Half_sound 0) ((2,3) : PairSlot))) (entropyTerm_zero_ball ((Z1_7_0Half_sound 0) ((2,4) : PairSlot))) (entropyTerm_zero_ball ((Z1_7_0Half_sound 0) ((2,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z1_7_0Half_sound 0) ((3,0) : PairSlot))) (entropyTerm_zero_ball ((Z1_7_0Half_sound 0) ((3,1) : PairSlot))) (entropyTerm_zero_ball ((Z1_7_0Half_sound 0) ((3,2) : PairSlot))) (entropyTerm_zero_ball ((Z1_7_0Half_sound 0) ((3,3) : PairSlot))) (entropyTerm_zero_ball ((Z1_7_0Half_sound 0) ((3,4) : PairSlot))) (entropyTerm_zero_ball ((Z1_7_0Half_sound 0) ((3,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z1_7_0Half_sound 0) ((4,0) : PairSlot))) (entropyTerm_zero_ball ((Z1_7_0Half_sound 0) ((4,1) : PairSlot))) (entropyTerm_zero_ball ((Z1_7_0Half_sound 0) ((4,2) : PairSlot))) (entropyTerm_zero_ball ((Z1_7_0Half_sound 0) ((4,3) : PairSlot))) (entropyTerm_zero_ball ((Z1_7_0Half_sound 0) ((4,4) : PairSlot))) (entropyTerm_zero_ball ((Z1_7_0Half_sound 0) ((4,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z1_7_0Half_sound 0) ((5,0) : PairSlot))) (entropyTerm_zero_ball ((Z1_7_0Half_sound 0) ((5,1) : PairSlot))) (entropyTerm_zero_ball ((Z1_7_0Half_sound 0) ((5,2) : PairSlot))) (entropyTerm_zero_ball ((Z1_7_0Half_sound 0) ((5,3) : PairSlot))) (entropyTerm_zero_ball ((Z1_7_0Half_sound 0) ((5,4) : PairSlot))) (entropyTerm_zero_ball ((Z1_7_0Half_sound 0) ((5,5) : PairSlot))) +def Z1_7_0H0Entropy : Ball := ⟨(6931471805599453094172319305033 / 10000000000000000000000000000000), (21175823683 / 50000000000000000000000000000000)⟩ +lemma Z1_7_0H0Entropy_sound : Z1_7_0H0Entropy.Encloses (Foundation.finiteEntropy Z1_7_0H0Value) := by + exact contains_sound (entropyPair_enclosed Z1_7_0H0Value Z1_7_0H0Terms Z1_7_0H0Terms_sound) (by decide +kernel) +def Z1_7_0H0Mass : Ball := ⟨1, 0⟩ +lemma Z1_7_0H0Mass_sound : Z1_7_0H0Mass.Encloses (∑ a, Z1_7_0H0Value a) := by + exact contains_sound (pairSumBall_sound (Z1_7_0Half 0) Z1_7_0H0Value (Z1_7_0Half_sound 0)) (by decide +kernel) +def Z1_7_0H0MassTermLog : Ball := .exact 0 +lemma Z1_7_0H0MassTermLog_sound : Z1_7_0H0MassTermLog.Encloses (Real.log ((∑ a, Z1_7_0H0Value a))) := by + exact log_exact_one_ball (Z1_7_0H0Mass_sound) +def Z1_7_0H0MassTerm : Ball := ⟨0, 0⟩ +lemma Z1_7_0H0MassTerm_sound : Z1_7_0H0MassTerm.Encloses (Foundation.entropyTerm ((∑ a, Z1_7_0H0Value a))) := by + exact contains_sound (entropyTerm_ball (Z1_7_0H0Mass_sound) Z1_7_0H0MassTermLog_sound) (by decide +kernel) +def Z1_7_0H0H : Ball := ⟨(6931471805599453094172319305033 / 10000000000000000000000000000000), (21175823683 / 50000000000000000000000000000000)⟩ +lemma Z1_7_0H0H_sound : Z1_7_0H0H.Encloses (homogeneousEntropy Z1_7_0H0Value) := by + exact contains_sound (homogeneous_enclosed Z1_7_0H0Value Z1_7_0H0MassTerm_sound Z1_7_0H0Entropy_sound) (by decide +kernel) +def Z1_7_0H1Value (a : PairSlot) : ℝ := (halfLaw (shape 1 7 0) 1 a : ℝ) +def Z1_7_0H1E_4_5LogWitness : LogWitness := ⟨-1, 1, 1⟩ +def Z1_7_0H1E_4_5Log : Ball := ⟨(-6931471805599453094172319305033 / 10000000000000000000000000000000), (8470329473 / 20000000000000000000000000000000)⟩ +lemma Z1_7_0H1E_4_5Log_sound : Z1_7_0H1E_4_5Log.Encloses (Real.log (Z1_7_0H1Value ((4,5) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound ((Z1_7_0Half_sound 1) ((4,5) : PairSlot)) (w := Z1_7_0H1E_4_5LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z1_7_0H1E_4_5 : Ball := ⟨(6931471805599453094172319305033 / 20000000000000000000000000000000), (21175823683 / 100000000000000000000000000000000)⟩ +lemma Z1_7_0H1E_4_5_sound : Z1_7_0H1E_4_5.Encloses (Foundation.entropyTerm (Z1_7_0H1Value ((4,5) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z1_7_0Half_sound 1) ((4,5) : PairSlot)) Z1_7_0H1E_4_5Log_sound) (by decide +kernel) +def Z1_7_0H1E_5_4LogWitness : LogWitness := ⟨-1, 1, 1⟩ +def Z1_7_0H1E_5_4Log : Ball := ⟨(-6931471805599453094172319305033 / 10000000000000000000000000000000), (8470329473 / 20000000000000000000000000000000)⟩ +lemma Z1_7_0H1E_5_4Log_sound : Z1_7_0H1E_5_4Log.Encloses (Real.log (Z1_7_0H1Value ((5,4) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound ((Z1_7_0Half_sound 1) ((5,4) : PairSlot)) (w := Z1_7_0H1E_5_4LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z1_7_0H1E_5_4 : Ball := ⟨(6931471805599453094172319305033 / 20000000000000000000000000000000), (21175823683 / 100000000000000000000000000000000)⟩ +lemma Z1_7_0H1E_5_4_sound : Z1_7_0H1E_5_4.Encloses (Foundation.entropyTerm (Z1_7_0H1Value ((5,4) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z1_7_0Half_sound 1) ((5,4) : PairSlot)) Z1_7_0H1E_5_4Log_sound) (by decide +kernel) +def Z1_7_0H1Terms (a : PairSlot) : Ball := + match a.1.val, a.2.val with + | 4, 5 => ⟨(6931471805599453094172319305033 / 20000000000000000000000000000000), (21175823683 / 100000000000000000000000000000000)⟩ + | 5, 4 => ⟨(6931471805599453094172319305033 / 20000000000000000000000000000000), (21175823683 / 100000000000000000000000000000000)⟩ + | _, _ => (.exact 0) +lemma Z1_7_0H1Terms_sound (a : PairSlot) : + (Z1_7_0H1Terms a).Encloses (Foundation.entropyTerm (Z1_7_0H1Value a)) := by + rcases a with ⟨i,j⟩ + revert j i + apply forall_fin6 + · exact forall_fin6 (entropyTerm_zero_ball ((Z1_7_0Half_sound 1) ((0,0) : PairSlot))) (entropyTerm_zero_ball ((Z1_7_0Half_sound 1) ((0,1) : PairSlot))) (entropyTerm_zero_ball ((Z1_7_0Half_sound 1) ((0,2) : PairSlot))) (entropyTerm_zero_ball ((Z1_7_0Half_sound 1) ((0,3) : PairSlot))) (entropyTerm_zero_ball ((Z1_7_0Half_sound 1) ((0,4) : PairSlot))) (entropyTerm_zero_ball ((Z1_7_0Half_sound 1) ((0,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z1_7_0Half_sound 1) ((1,0) : PairSlot))) (entropyTerm_zero_ball ((Z1_7_0Half_sound 1) ((1,1) : PairSlot))) (entropyTerm_zero_ball ((Z1_7_0Half_sound 1) ((1,2) : PairSlot))) (entropyTerm_zero_ball ((Z1_7_0Half_sound 1) ((1,3) : PairSlot))) (entropyTerm_zero_ball ((Z1_7_0Half_sound 1) ((1,4) : PairSlot))) (entropyTerm_zero_ball ((Z1_7_0Half_sound 1) ((1,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z1_7_0Half_sound 1) ((2,0) : PairSlot))) (entropyTerm_zero_ball ((Z1_7_0Half_sound 1) ((2,1) : PairSlot))) (entropyTerm_zero_ball ((Z1_7_0Half_sound 1) ((2,2) : PairSlot))) (entropyTerm_zero_ball ((Z1_7_0Half_sound 1) ((2,3) : PairSlot))) (entropyTerm_zero_ball ((Z1_7_0Half_sound 1) ((2,4) : PairSlot))) (entropyTerm_zero_ball ((Z1_7_0Half_sound 1) ((2,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z1_7_0Half_sound 1) ((3,0) : PairSlot))) (entropyTerm_zero_ball ((Z1_7_0Half_sound 1) ((3,1) : PairSlot))) (entropyTerm_zero_ball ((Z1_7_0Half_sound 1) ((3,2) : PairSlot))) (entropyTerm_zero_ball ((Z1_7_0Half_sound 1) ((3,3) : PairSlot))) (entropyTerm_zero_ball ((Z1_7_0Half_sound 1) ((3,4) : PairSlot))) (entropyTerm_zero_ball ((Z1_7_0Half_sound 1) ((3,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z1_7_0Half_sound 1) ((4,0) : PairSlot))) (entropyTerm_zero_ball ((Z1_7_0Half_sound 1) ((4,1) : PairSlot))) (entropyTerm_zero_ball ((Z1_7_0Half_sound 1) ((4,2) : PairSlot))) (entropyTerm_zero_ball ((Z1_7_0Half_sound 1) ((4,3) : PairSlot))) (entropyTerm_zero_ball ((Z1_7_0Half_sound 1) ((4,4) : PairSlot))) Z1_7_0H1E_4_5_sound + · exact forall_fin6 (entropyTerm_zero_ball ((Z1_7_0Half_sound 1) ((5,0) : PairSlot))) (entropyTerm_zero_ball ((Z1_7_0Half_sound 1) ((5,1) : PairSlot))) (entropyTerm_zero_ball ((Z1_7_0Half_sound 1) ((5,2) : PairSlot))) (entropyTerm_zero_ball ((Z1_7_0Half_sound 1) ((5,3) : PairSlot))) Z1_7_0H1E_5_4_sound (entropyTerm_zero_ball ((Z1_7_0Half_sound 1) ((5,5) : PairSlot))) +def Z1_7_0H1Entropy : Ball := ⟨(6931471805599453094172319305033 / 10000000000000000000000000000000), (21175823683 / 50000000000000000000000000000000)⟩ +lemma Z1_7_0H1Entropy_sound : Z1_7_0H1Entropy.Encloses (Foundation.finiteEntropy Z1_7_0H1Value) := by + exact contains_sound (entropyPair_enclosed Z1_7_0H1Value Z1_7_0H1Terms Z1_7_0H1Terms_sound) (by decide +kernel) +def Z1_7_0H1Mass : Ball := ⟨1, 0⟩ +lemma Z1_7_0H1Mass_sound : Z1_7_0H1Mass.Encloses (∑ a, Z1_7_0H1Value a) := by + exact contains_sound (pairSumBall_sound (Z1_7_0Half 1) Z1_7_0H1Value (Z1_7_0Half_sound 1)) (by decide +kernel) +def Z1_7_0H1MassTermLog : Ball := .exact 0 +lemma Z1_7_0H1MassTermLog_sound : Z1_7_0H1MassTermLog.Encloses (Real.log ((∑ a, Z1_7_0H1Value a))) := by + exact log_exact_one_ball (Z1_7_0H1Mass_sound) +def Z1_7_0H1MassTerm : Ball := ⟨0, 0⟩ +lemma Z1_7_0H1MassTerm_sound : Z1_7_0H1MassTerm.Encloses (Foundation.entropyTerm ((∑ a, Z1_7_0H1Value a))) := by + exact contains_sound (entropyTerm_ball (Z1_7_0H1Mass_sound) Z1_7_0H1MassTermLog_sound) (by decide +kernel) +def Z1_7_0H1H : Ball := ⟨(6931471805599453094172319305033 / 10000000000000000000000000000000), (21175823683 / 50000000000000000000000000000000)⟩ +lemma Z1_7_0H1H_sound : Z1_7_0H1H.Encloses (homogeneousEntropy Z1_7_0H1Value) := by + exact contains_sound (homogeneous_enclosed Z1_7_0H1Value Z1_7_0H1MassTerm_sound Z1_7_0H1Entropy_sound) (by decide +kernel) +def Z1_7_0H2Value (a : PairSlot) : ℝ := (halfLaw (shape 1 7 0) 2 a : ℝ) +def Z1_7_0H2E_0_0Log : Ball := .exact 0 +lemma Z1_7_0H2E_0_0Log_sound : Z1_7_0H2E_0_0Log.Encloses (Real.log (Z1_7_0H2Value ((0,0) : PairSlot))) := by + exact log_exact_one_ball ((Z1_7_0Half_sound 2) ((0,0) : PairSlot)) +def Z1_7_0H2E_0_0 : Ball := ⟨0, 0⟩ +lemma Z1_7_0H2E_0_0_sound : Z1_7_0H2E_0_0.Encloses (Foundation.entropyTerm (Z1_7_0H2Value ((0,0) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z1_7_0Half_sound 2) ((0,0) : PairSlot)) Z1_7_0H2E_0_0Log_sound) (by decide +kernel) +def Z1_7_0H2Terms (a : PairSlot) : Ball := + match a.1.val, a.2.val with + | 0, 0 => ⟨0, 0⟩ + | _, _ => (.exact 0) +lemma Z1_7_0H2Terms_sound (a : PairSlot) : + (Z1_7_0H2Terms a).Encloses (Foundation.entropyTerm (Z1_7_0H2Value a)) := by + rcases a with ⟨i,j⟩ + revert j i + apply forall_fin6 + · exact forall_fin6 Z1_7_0H2E_0_0_sound (entropyTerm_zero_ball ((Z1_7_0Half_sound 2) ((0,1) : PairSlot))) (entropyTerm_zero_ball ((Z1_7_0Half_sound 2) ((0,2) : PairSlot))) (entropyTerm_zero_ball ((Z1_7_0Half_sound 2) ((0,3) : PairSlot))) (entropyTerm_zero_ball ((Z1_7_0Half_sound 2) ((0,4) : PairSlot))) (entropyTerm_zero_ball ((Z1_7_0Half_sound 2) ((0,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z1_7_0Half_sound 2) ((1,0) : PairSlot))) (entropyTerm_zero_ball ((Z1_7_0Half_sound 2) ((1,1) : PairSlot))) (entropyTerm_zero_ball ((Z1_7_0Half_sound 2) ((1,2) : PairSlot))) (entropyTerm_zero_ball ((Z1_7_0Half_sound 2) ((1,3) : PairSlot))) (entropyTerm_zero_ball ((Z1_7_0Half_sound 2) ((1,4) : PairSlot))) (entropyTerm_zero_ball ((Z1_7_0Half_sound 2) ((1,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z1_7_0Half_sound 2) ((2,0) : PairSlot))) (entropyTerm_zero_ball ((Z1_7_0Half_sound 2) ((2,1) : PairSlot))) (entropyTerm_zero_ball ((Z1_7_0Half_sound 2) ((2,2) : PairSlot))) (entropyTerm_zero_ball ((Z1_7_0Half_sound 2) ((2,3) : PairSlot))) (entropyTerm_zero_ball ((Z1_7_0Half_sound 2) ((2,4) : PairSlot))) (entropyTerm_zero_ball ((Z1_7_0Half_sound 2) ((2,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z1_7_0Half_sound 2) ((3,0) : PairSlot))) (entropyTerm_zero_ball ((Z1_7_0Half_sound 2) ((3,1) : PairSlot))) (entropyTerm_zero_ball ((Z1_7_0Half_sound 2) ((3,2) : PairSlot))) (entropyTerm_zero_ball ((Z1_7_0Half_sound 2) ((3,3) : PairSlot))) (entropyTerm_zero_ball ((Z1_7_0Half_sound 2) ((3,4) : PairSlot))) (entropyTerm_zero_ball ((Z1_7_0Half_sound 2) ((3,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z1_7_0Half_sound 2) ((4,0) : PairSlot))) (entropyTerm_zero_ball ((Z1_7_0Half_sound 2) ((4,1) : PairSlot))) (entropyTerm_zero_ball ((Z1_7_0Half_sound 2) ((4,2) : PairSlot))) (entropyTerm_zero_ball ((Z1_7_0Half_sound 2) ((4,3) : PairSlot))) (entropyTerm_zero_ball ((Z1_7_0Half_sound 2) ((4,4) : PairSlot))) (entropyTerm_zero_ball ((Z1_7_0Half_sound 2) ((4,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z1_7_0Half_sound 2) ((5,0) : PairSlot))) (entropyTerm_zero_ball ((Z1_7_0Half_sound 2) ((5,1) : PairSlot))) (entropyTerm_zero_ball ((Z1_7_0Half_sound 2) ((5,2) : PairSlot))) (entropyTerm_zero_ball ((Z1_7_0Half_sound 2) ((5,3) : PairSlot))) (entropyTerm_zero_ball ((Z1_7_0Half_sound 2) ((5,4) : PairSlot))) (entropyTerm_zero_ball ((Z1_7_0Half_sound 2) ((5,5) : PairSlot))) +def Z1_7_0H2Entropy : Ball := ⟨0, 0⟩ +lemma Z1_7_0H2Entropy_sound : Z1_7_0H2Entropy.Encloses (Foundation.finiteEntropy Z1_7_0H2Value) := by + exact contains_sound (entropyPair_enclosed Z1_7_0H2Value Z1_7_0H2Terms Z1_7_0H2Terms_sound) (by decide +kernel) +def Z1_7_0H2Mass : Ball := ⟨1, 0⟩ +lemma Z1_7_0H2Mass_sound : Z1_7_0H2Mass.Encloses (∑ a, Z1_7_0H2Value a) := by + exact contains_sound (pairSumBall_sound (Z1_7_0Half 2) Z1_7_0H2Value (Z1_7_0Half_sound 2)) (by decide +kernel) +def Z1_7_0H2MassTermLog : Ball := .exact 0 +lemma Z1_7_0H2MassTermLog_sound : Z1_7_0H2MassTermLog.Encloses (Real.log ((∑ a, Z1_7_0H2Value a))) := by + exact log_exact_one_ball (Z1_7_0H2Mass_sound) +def Z1_7_0H2MassTerm : Ball := ⟨0, 0⟩ +lemma Z1_7_0H2MassTerm_sound : Z1_7_0H2MassTerm.Encloses (Foundation.entropyTerm ((∑ a, Z1_7_0H2Value a))) := by + exact contains_sound (entropyTerm_ball (Z1_7_0H2Mass_sound) Z1_7_0H2MassTermLog_sound) (by decide +kernel) +def Z1_7_0H2H : Ball := ⟨0, 0⟩ +lemma Z1_7_0H2H_sound : Z1_7_0H2H.Encloses (homogeneousEntropy Z1_7_0H2Value) := by + exact contains_sound (homogeneous_enclosed Z1_7_0H2Value Z1_7_0H2MassTerm_sound Z1_7_0H2Entropy_sound) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/Certificates/Four2_0_6.lean b/lean/OAI/LinearAlgebra/MatrixFields/Certificates/Four2_0_6.lean new file mode 100644 index 0000000000000000000000000000000000000000..9396ce7a167bd912e7382e76814fa98901b4d906 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/Certificates/Four2_0_6.lean @@ -0,0 +1,573 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Certificates.SplitA1_3_12 + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def Z2_0_6Raw (ij : PairSlot) : Ball := + match ij.1.val, ij.2.val with + | 0, 0 => w195 + | 0, 1 => w195 + | 0, 2 => w195 + | 0, 3 => w195 + | 0, 4 => w195 + | 0, 5 => w195 + | 1, 0 => w195 + | 1, 1 => w195 + | 1, 2 => w195 + | 1, 3 => w195 + | 1, 4 => w195 + | 1, 5 => w195 + | 2, 0 => w195 + | 2, 1 => w195 + | 2, 2 => w195 + | 2, 3 => w195 + | 2, 4 => w195 + | 2, 5 => w136 + | 3, 0 => w195 + | 3, 1 => w195 + | 3, 2 => w195 + | 3, 3 => w195 + | 3, 4 => w195 + | 3, 5 => w54 + | 4, 0 => w195 + | 4, 1 => w195 + | 4, 2 => w195 + | 4, 3 => w195 + | 4, 4 => w195 + | 4, 5 => w195 + | 5, 0 => w195 + | 5, 1 => w195 + | 5, 2 => w136 + | 5, 3 => w54 + | 5, 4 => w195 + | 5, 5 => w195 + | _, _ => (.exact 0) +lemma Z2_0_6Raw_sound_0 (j : Fin 6) : + (Z2_0_6Raw (0,j)).Encloses (weight (orderedPairInteger (shape 2 0 6) 0 j) : ℝ) := by + fin_cases j + · change (Z2_0_6Raw (0,0)).Encloses (weight (orderedPairInteger (shape 2 0 6) 0 0) : ℝ) + have he : orderedPairInteger (shape 2 0 6) 0 0 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z2_0_6Raw (0,1)).Encloses (weight (orderedPairInteger (shape 2 0 6) 0 1) : ℝ) + have he : orderedPairInteger (shape 2 0 6) 0 1 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z2_0_6Raw (0,2)).Encloses (weight (orderedPairInteger (shape 2 0 6) 0 2) : ℝ) + have he : orderedPairInteger (shape 2 0 6) 0 2 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z2_0_6Raw (0,3)).Encloses (weight (orderedPairInteger (shape 2 0 6) 0 3) : ℝ) + have he : orderedPairInteger (shape 2 0 6) 0 3 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z2_0_6Raw (0,4)).Encloses (weight (orderedPairInteger (shape 2 0 6) 0 4) : ℝ) + have he : orderedPairInteger (shape 2 0 6) 0 4 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z2_0_6Raw (0,5)).Encloses (weight (orderedPairInteger (shape 2 0 6) 0 5) : ℝ) + have he : orderedPairInteger (shape 2 0 6) 0 5 = (0) := by decide +kernel + rw [he] + exact w195_sound +lemma Z2_0_6Raw_sound_1 (j : Fin 6) : + (Z2_0_6Raw (1,j)).Encloses (weight (orderedPairInteger (shape 2 0 6) 1 j) : ℝ) := by + fin_cases j + · change (Z2_0_6Raw (1,0)).Encloses (weight (orderedPairInteger (shape 2 0 6) 1 0) : ℝ) + have he : orderedPairInteger (shape 2 0 6) 1 0 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z2_0_6Raw (1,1)).Encloses (weight (orderedPairInteger (shape 2 0 6) 1 1) : ℝ) + have he : orderedPairInteger (shape 2 0 6) 1 1 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z2_0_6Raw (1,2)).Encloses (weight (orderedPairInteger (shape 2 0 6) 1 2) : ℝ) + have he : orderedPairInteger (shape 2 0 6) 1 2 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z2_0_6Raw (1,3)).Encloses (weight (orderedPairInteger (shape 2 0 6) 1 3) : ℝ) + have he : orderedPairInteger (shape 2 0 6) 1 3 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z2_0_6Raw (1,4)).Encloses (weight (orderedPairInteger (shape 2 0 6) 1 4) : ℝ) + have he : orderedPairInteger (shape 2 0 6) 1 4 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z2_0_6Raw (1,5)).Encloses (weight (orderedPairInteger (shape 2 0 6) 1 5) : ℝ) + have he : orderedPairInteger (shape 2 0 6) 1 5 = (0) := by decide +kernel + rw [he] + exact w195_sound +lemma Z2_0_6Raw_sound_2 (j : Fin 6) : + (Z2_0_6Raw (2,j)).Encloses (weight (orderedPairInteger (shape 2 0 6) 2 j) : ℝ) := by + fin_cases j + · change (Z2_0_6Raw (2,0)).Encloses (weight (orderedPairInteger (shape 2 0 6) 2 0) : ℝ) + have he : orderedPairInteger (shape 2 0 6) 2 0 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z2_0_6Raw (2,1)).Encloses (weight (orderedPairInteger (shape 2 0 6) 2 1) : ℝ) + have he : orderedPairInteger (shape 2 0 6) 2 1 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z2_0_6Raw (2,2)).Encloses (weight (orderedPairInteger (shape 2 0 6) 2 2) : ℝ) + have he : orderedPairInteger (shape 2 0 6) 2 2 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z2_0_6Raw (2,3)).Encloses (weight (orderedPairInteger (shape 2 0 6) 2 3) : ℝ) + have he : orderedPairInteger (shape 2 0 6) 2 3 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z2_0_6Raw (2,4)).Encloses (weight (orderedPairInteger (shape 2 0 6) 2 4) : ℝ) + have he : orderedPairInteger (shape 2 0 6) 2 4 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z2_0_6Raw (2,5)).Encloses (weight (orderedPairInteger (shape 2 0 6) 2 5) : ℝ) + have he : orderedPairInteger (shape 2 0 6) 2 5 = (-9623) := by decide +kernel + rw [he] + exact w136_sound +lemma Z2_0_6Raw_sound_3 (j : Fin 6) : + (Z2_0_6Raw (3,j)).Encloses (weight (orderedPairInteger (shape 2 0 6) 3 j) : ℝ) := by + fin_cases j + · change (Z2_0_6Raw (3,0)).Encloses (weight (orderedPairInteger (shape 2 0 6) 3 0) : ℝ) + have he : orderedPairInteger (shape 2 0 6) 3 0 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z2_0_6Raw (3,1)).Encloses (weight (orderedPairInteger (shape 2 0 6) 3 1) : ℝ) + have he : orderedPairInteger (shape 2 0 6) 3 1 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z2_0_6Raw (3,2)).Encloses (weight (orderedPairInteger (shape 2 0 6) 3 2) : ℝ) + have he : orderedPairInteger (shape 2 0 6) 3 2 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z2_0_6Raw (3,3)).Encloses (weight (orderedPairInteger (shape 2 0 6) 3 3) : ℝ) + have he : orderedPairInteger (shape 2 0 6) 3 3 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z2_0_6Raw (3,4)).Encloses (weight (orderedPairInteger (shape 2 0 6) 3 4) : ℝ) + have he : orderedPairInteger (shape 2 0 6) 3 4 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z2_0_6Raw (3,5)).Encloses (weight (orderedPairInteger (shape 2 0 6) 3 5) : ℝ) + have he : orderedPairInteger (shape 2 0 6) 3 5 = (-34674) := by decide +kernel + rw [he] + exact w54_sound +lemma Z2_0_6Raw_sound_4 (j : Fin 6) : + (Z2_0_6Raw (4,j)).Encloses (weight (orderedPairInteger (shape 2 0 6) 4 j) : ℝ) := by + fin_cases j + · change (Z2_0_6Raw (4,0)).Encloses (weight (orderedPairInteger (shape 2 0 6) 4 0) : ℝ) + have he : orderedPairInteger (shape 2 0 6) 4 0 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z2_0_6Raw (4,1)).Encloses (weight (orderedPairInteger (shape 2 0 6) 4 1) : ℝ) + have he : orderedPairInteger (shape 2 0 6) 4 1 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z2_0_6Raw (4,2)).Encloses (weight (orderedPairInteger (shape 2 0 6) 4 2) : ℝ) + have he : orderedPairInteger (shape 2 0 6) 4 2 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z2_0_6Raw (4,3)).Encloses (weight (orderedPairInteger (shape 2 0 6) 4 3) : ℝ) + have he : orderedPairInteger (shape 2 0 6) 4 3 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z2_0_6Raw (4,4)).Encloses (weight (orderedPairInteger (shape 2 0 6) 4 4) : ℝ) + have he : orderedPairInteger (shape 2 0 6) 4 4 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z2_0_6Raw (4,5)).Encloses (weight (orderedPairInteger (shape 2 0 6) 4 5) : ℝ) + have he : orderedPairInteger (shape 2 0 6) 4 5 = (0) := by decide +kernel + rw [he] + exact w195_sound +lemma Z2_0_6Raw_sound_5 (j : Fin 6) : + (Z2_0_6Raw (5,j)).Encloses (weight (orderedPairInteger (shape 2 0 6) 5 j) : ℝ) := by + fin_cases j + · change (Z2_0_6Raw (5,0)).Encloses (weight (orderedPairInteger (shape 2 0 6) 5 0) : ℝ) + have he : orderedPairInteger (shape 2 0 6) 5 0 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z2_0_6Raw (5,1)).Encloses (weight (orderedPairInteger (shape 2 0 6) 5 1) : ℝ) + have he : orderedPairInteger (shape 2 0 6) 5 1 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z2_0_6Raw (5,2)).Encloses (weight (orderedPairInteger (shape 2 0 6) 5 2) : ℝ) + have he : orderedPairInteger (shape 2 0 6) 5 2 = (-9623) := by decide +kernel + rw [he] + exact w136_sound + · change (Z2_0_6Raw (5,3)).Encloses (weight (orderedPairInteger (shape 2 0 6) 5 3) : ℝ) + have he : orderedPairInteger (shape 2 0 6) 5 3 = (-34674) := by decide +kernel + rw [he] + exact w54_sound + · change (Z2_0_6Raw (5,4)).Encloses (weight (orderedPairInteger (shape 2 0 6) 5 4) : ℝ) + have he : orderedPairInteger (shape 2 0 6) 5 4 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z2_0_6Raw (5,5)).Encloses (weight (orderedPairInteger (shape 2 0 6) 5 5) : ℝ) + have he : orderedPairInteger (shape 2 0 6) 5 5 = (0) := by decide +kernel + rw [he] + exact w195_sound +lemma Z2_0_6Raw_sound (ij : PairSlot) : + (Z2_0_6Raw ij).Encloses (weight (orderedPairInteger (shape 2 0 6) ij.1 ij.2) : ℝ) := by + rcases ij with ⟨i,j⟩ + revert i + exact forall_fin6 (Z2_0_6Raw_sound_0 j) (Z2_0_6Raw_sound_1 j) (Z2_0_6Raw_sound_2 j) (Z2_0_6Raw_sound_3 j) (Z2_0_6Raw_sound_4 j) (Z2_0_6Raw_sound_5 j) +def Z2_0_6Den : Ball := ⟨(730569027616488524394965632979 / 400000000000000000000000000000), (3 / 3125000000000000000000000000000)⟩ +lemma Z2_0_6Den_sound : Z2_0_6Den.Encloses + (((orderedPairs (shape 2 0 6)).map (fun ij => weight (orderedPairInteger (shape 2 0 6) ij.1 ij.2))).sum : ℝ) := by + exact contains_sound (list_cast_enclosed (orderedPairs (shape 2 0 6)) Z2_0_6Raw + (fun ij => weight (orderedPairInteger (shape 2 0 6) ij.1 ij.2)) + (fun ij _ => Z2_0_6Raw_sound ij)) (by decide +kernel) +lemma Z2_0_6Den_pos : 0 < Z2_0_6Den.lower := by decide +kernel +def Z2_0_6Probs (ij : PairSlot) : Ball := + match ij.1.val, ij.2.val with + | 2, 5 => ⟨(10457964405071752630514678883453 / 50000000000000000000000000000000), (9 / 25000000000000000000000000000000)⟩ + | 3, 5 => ⟨(1708150169428319858018410671529 / 100000000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ + | 4, 4 => ⟨(5475184204085634976190446312313 / 10000000000000000000000000000000), (3 / 10000000000000000000000000000000)⟩ + | 5, 2 => ⟨(10457964405071752630514678883453 / 50000000000000000000000000000000), (9 / 25000000000000000000000000000000)⟩ + | 5, 3 => ⟨(1708150169428319858018410671529 / 100000000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ + | _, _ => (.exact 0) +lemma Z2_0_6Contains : ∀ i j : Fin 6, + statisticWeight i + statisticWeight j = shapeMax (shape 2 0 6) → + contains (.mul (Z2_0_6Raw (i,j)) (.inv Z2_0_6Den)) (Z2_0_6Probs (i,j)) = true := by + decide +kernel +lemma Z2_0_6Zero : ∀ i j : Fin 6, + statisticWeight i + statisticWeight j ≠ shapeMax (shape 2 0 6) → Z2_0_6Probs (i,j) = .exact 0 := by + decide +kernel +lemma Z2_0_6Probs_sound (ij : PairSlot) : + (Z2_0_6Probs ij).Encloses (zeroPairLaw (shape 2 0 6) ij.1 ij.2 : ℝ) := by + by_cases h : statisticWeight ij.1 + statisticWeight ij.2 = shapeMax (shape 2 0 6) + · have hb := contains_sound (Ball.mul_sound (Z2_0_6Raw_sound ij) + (Ball.inv_sound Z2_0_6Den_sound Z2_0_6Den_pos)) (Z2_0_6Contains ij.1 ij.2 h) + simpa only [zeroPairLaw, h, ite_true, Rat.cast_div, Rat.cast_mul, + Rat.cast_inv, div_eq_mul_inv] using hb + · rw [Z2_0_6Zero ij.1 ij.2 h] + simpa only [zeroPairLaw, h, ite_false] using Ball.exact_sound 0 + +def Z2_0_6Half (w : Fin 3) (ij : PairSlot) : Ball := + if (shape 2 0 6) w = 0 then if ij = (0,0) then .exact 1 else .exact 0 + else if w = halfMaxAxis (shape 2 0 6) then Z2_0_6Probs ij + else Z2_0_6Probs (kappa ij.1, kappa ij.2) +lemma Z2_0_6Half_sound (w : Fin 3) (ij : PairSlot) : + (Z2_0_6Half w ij).Encloses (halfLaw (shape 2 0 6) w ij : ℝ) := by + have hp : positive (shape 2 0 6) = false := by decide +kernel + simp only [Z2_0_6Half, halfLaw, hp, Bool.false_eq_true, ite_false] + split_ifs + · exact Ball.exact_sound 1 + · exact Ball.exact_sound 0 + · exact Z2_0_6Probs_sound _ + · exact Z2_0_6Probs_sound _ + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def Z2_0_6Value (a : PairSlot) : ℝ := (zeroPairLaw (shape 2 0 6) a.1 a.2 : ℝ) +def Z2_0_6E_2_5LogWitness : LogWitness := ⟨-3, 10457964405071752630514678883453, 6250000000000000000000000000000⟩ +def Z2_0_6E_2_5Log : Ball := ⟨(-78232958663779813935933970438769 / 50000000000000000000000000000000), (10587911863 / 12500000000000000000000000000000)⟩ +lemma Z2_0_6E_2_5Log_sound : Z2_0_6E_2_5Log.Encloses (Real.log (Z2_0_6Value ((2,5) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound (Z2_0_6Probs_sound ((2,5) : PairSlot)) (w := Z2_0_6E_2_5LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z2_0_6E_2_5 : Ball := ⟨(32726299880370363099063710099363 / 100000000000000000000000000000000), (17716480919 / 100000000000000000000000000000000)⟩ +lemma Z2_0_6E_2_5_sound : Z2_0_6E_2_5.Encloses (Foundation.entropyTerm (Z2_0_6Value ((2,5) : PairSlot))) := by + exact contains_sound (entropyTerm_ball (Z2_0_6Probs_sound ((2,5) : PairSlot)) Z2_0_6E_2_5Log_sound) (by decide +kernel) +def Z2_0_6E_3_5LogWitness : LogWitness := ⟨-6, 1708150169428319858018410671529, 1562500000000000000000000000000⟩ +def Z2_0_6E_3_5Log : Ball := ⟨(-203487958663779813935933941795503 / 50000000000000000000000000000000), (74115383007 / 50000000000000000000000000000000)⟩ +lemma Z2_0_6E_3_5Log_sound : Z2_0_6E_3_5Log.Encloses (Real.log (Z2_0_6Value ((3,5) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound (Z2_0_6Probs_sound ((3,5) : PairSlot)) (w := Z2_0_6E_3_5LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z2_0_6E_3_5 : Ball := ⟨(1737939955340792184583902537331 / 25000000000000000000000000000000), (1266002049 / 50000000000000000000000000000000)⟩ +lemma Z2_0_6E_3_5_sound : Z2_0_6E_3_5.Encloses (Foundation.entropyTerm (Z2_0_6Value ((3,5) : PairSlot))) := by + exact contains_sound (entropyTerm_ball (Z2_0_6Probs_sound ((3,5) : PairSlot)) Z2_0_6E_3_5Log_sound) (by decide +kernel) +def Z2_0_6E_4_4LogWitness : LogWitness := ⟨-1, 5475184204085634976190446312313, 5000000000000000000000000000000⟩ +def Z2_0_6E_4_4Log : Ball := ⟨(-6023591732755962787186797906847 / 10000000000000000000000000000000), (2117582371 / 5000000000000000000000000000000)⟩ +lemma Z2_0_6E_4_4Log_sound : Z2_0_6E_4_4Log.Encloses (Real.log (Z2_0_6Value ((4,4) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound (Z2_0_6Probs_sound ((4,4) : PairSlot)) (w := Z2_0_6E_4_4LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z2_0_6E_4_4 : Ball := ⟨(32980274307046266973832495616429 / 100000000000000000000000000000000), (5797076779 / 25000000000000000000000000000000)⟩ +lemma Z2_0_6E_4_4_sound : Z2_0_6E_4_4.Encloses (Foundation.entropyTerm (Z2_0_6Value ((4,4) : PairSlot))) := by + exact contains_sound (entropyTerm_ball (Z2_0_6Probs_sound ((4,4) : PairSlot)) Z2_0_6E_4_4Log_sound) (by decide +kernel) +def Z2_0_6E_5_2LogWitness : LogWitness := ⟨-3, 10457964405071752630514678883453, 6250000000000000000000000000000⟩ +def Z2_0_6E_5_2Log : Ball := ⟨(-78232958663779813935933970438769 / 50000000000000000000000000000000), (10587911863 / 12500000000000000000000000000000)⟩ +lemma Z2_0_6E_5_2Log_sound : Z2_0_6E_5_2Log.Encloses (Real.log (Z2_0_6Value ((5,2) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound (Z2_0_6Probs_sound ((5,2) : PairSlot)) (w := Z2_0_6E_5_2LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z2_0_6E_5_2 : Ball := ⟨(32726299880370363099063710099363 / 100000000000000000000000000000000), (17716480919 / 100000000000000000000000000000000)⟩ +lemma Z2_0_6E_5_2_sound : Z2_0_6E_5_2.Encloses (Foundation.entropyTerm (Z2_0_6Value ((5,2) : PairSlot))) := by + exact contains_sound (entropyTerm_ball (Z2_0_6Probs_sound ((5,2) : PairSlot)) Z2_0_6E_5_2Log_sound) (by decide +kernel) +def Z2_0_6E_5_3LogWitness : LogWitness := ⟨-6, 1708150169428319858018410671529, 1562500000000000000000000000000⟩ +def Z2_0_6E_5_3Log : Ball := ⟨(-203487958663779813935933941795503 / 50000000000000000000000000000000), (74115383007 / 50000000000000000000000000000000)⟩ +lemma Z2_0_6E_5_3Log_sound : Z2_0_6E_5_3Log.Encloses (Real.log (Z2_0_6Value ((5,3) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound (Z2_0_6Probs_sound ((5,3) : PairSlot)) (w := Z2_0_6E_5_3LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z2_0_6E_5_3 : Ball := ⟨(1737939955340792184583902537331 / 25000000000000000000000000000000), (1266002049 / 50000000000000000000000000000000)⟩ +lemma Z2_0_6E_5_3_sound : Z2_0_6E_5_3.Encloses (Foundation.entropyTerm (Z2_0_6Value ((5,3) : PairSlot))) := by + exact contains_sound (entropyTerm_ball (Z2_0_6Probs_sound ((5,3) : PairSlot)) Z2_0_6E_5_3Log_sound) (by decide +kernel) +def Z2_0_6Terms (a : PairSlot) : Ball := + match a.1.val, a.2.val with + | 2, 5 => ⟨(32726299880370363099063710099363 / 100000000000000000000000000000000), (17716480919 / 100000000000000000000000000000000)⟩ + | 3, 5 => ⟨(1737939955340792184583902537331 / 25000000000000000000000000000000), (1266002049 / 50000000000000000000000000000000)⟩ + | 4, 4 => ⟨(32980274307046266973832495616429 / 100000000000000000000000000000000), (5797076779 / 25000000000000000000000000000000)⟩ + | 5, 2 => ⟨(32726299880370363099063710099363 / 100000000000000000000000000000000), (17716480919 / 100000000000000000000000000000000)⟩ + | 5, 3 => ⟨(1737939955340792184583902537331 / 25000000000000000000000000000000), (1266002049 / 50000000000000000000000000000000)⟩ + | _, _ => (.exact 0) +lemma Z2_0_6Terms_sound (a : PairSlot) : + (Z2_0_6Terms a).Encloses (Foundation.entropyTerm (Z2_0_6Value a)) := by + rcases a with ⟨i,j⟩ + revert j i + apply forall_fin6 + · exact forall_fin6 (entropyTerm_zero_ball (Z2_0_6Probs_sound ((0,0) : PairSlot))) (entropyTerm_zero_ball (Z2_0_6Probs_sound ((0,1) : PairSlot))) (entropyTerm_zero_ball (Z2_0_6Probs_sound ((0,2) : PairSlot))) (entropyTerm_zero_ball (Z2_0_6Probs_sound ((0,3) : PairSlot))) (entropyTerm_zero_ball (Z2_0_6Probs_sound ((0,4) : PairSlot))) (entropyTerm_zero_ball (Z2_0_6Probs_sound ((0,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball (Z2_0_6Probs_sound ((1,0) : PairSlot))) (entropyTerm_zero_ball (Z2_0_6Probs_sound ((1,1) : PairSlot))) (entropyTerm_zero_ball (Z2_0_6Probs_sound ((1,2) : PairSlot))) (entropyTerm_zero_ball (Z2_0_6Probs_sound ((1,3) : PairSlot))) (entropyTerm_zero_ball (Z2_0_6Probs_sound ((1,4) : PairSlot))) (entropyTerm_zero_ball (Z2_0_6Probs_sound ((1,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball (Z2_0_6Probs_sound ((2,0) : PairSlot))) (entropyTerm_zero_ball (Z2_0_6Probs_sound ((2,1) : PairSlot))) (entropyTerm_zero_ball (Z2_0_6Probs_sound ((2,2) : PairSlot))) (entropyTerm_zero_ball (Z2_0_6Probs_sound ((2,3) : PairSlot))) (entropyTerm_zero_ball (Z2_0_6Probs_sound ((2,4) : PairSlot))) Z2_0_6E_2_5_sound + · exact forall_fin6 (entropyTerm_zero_ball (Z2_0_6Probs_sound ((3,0) : PairSlot))) (entropyTerm_zero_ball (Z2_0_6Probs_sound ((3,1) : PairSlot))) (entropyTerm_zero_ball (Z2_0_6Probs_sound ((3,2) : PairSlot))) (entropyTerm_zero_ball (Z2_0_6Probs_sound ((3,3) : PairSlot))) (entropyTerm_zero_ball (Z2_0_6Probs_sound ((3,4) : PairSlot))) Z2_0_6E_3_5_sound + · exact forall_fin6 (entropyTerm_zero_ball (Z2_0_6Probs_sound ((4,0) : PairSlot))) (entropyTerm_zero_ball (Z2_0_6Probs_sound ((4,1) : PairSlot))) (entropyTerm_zero_ball (Z2_0_6Probs_sound ((4,2) : PairSlot))) (entropyTerm_zero_ball (Z2_0_6Probs_sound ((4,3) : PairSlot))) Z2_0_6E_4_4_sound (entropyTerm_zero_ball (Z2_0_6Probs_sound ((4,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball (Z2_0_6Probs_sound ((5,0) : PairSlot))) (entropyTerm_zero_ball (Z2_0_6Probs_sound ((5,1) : PairSlot))) Z2_0_6E_5_2_sound Z2_0_6E_5_3_sound (entropyTerm_zero_ball (Z2_0_6Probs_sound ((5,4) : PairSlot))) (entropyTerm_zero_ball (Z2_0_6Probs_sound ((5,5) : PairSlot))) +def Z2_0_6Entropy : Ball := ⟨(112336393710513330648631136113803 / 100000000000000000000000000000000), (1273705543 / 2000000000000000000000000000000)⟩ +lemma Z2_0_6Entropy_sound : Z2_0_6Entropy.Encloses (Foundation.finiteEntropy Z2_0_6Value) := by + exact contains_sound (entropyPair_enclosed Z2_0_6Value Z2_0_6Terms Z2_0_6Terms_sound) (by decide +kernel) +def Z2_0_6Labels : Ball := ⟨(389161104745575982126957038149479 / 100000000000000000000000000000000), (126897136649 / 100000000000000000000000000000000)⟩ +lemma Z2_0_6Labels_sound : Z2_0_6Labels.Encloses + (∑ a : PairSlot, (zeroPairLaw (shape 2 0 6) a.1 a.2 : ℝ) * + Real.log (AllFieldParameters.multiplicity a.1 * AllFieldParameters.multiplicity a.2 : ℕ)) := by + exact contains_sound (pairSumBall_sound (fun a => .mul (Z2_0_6Probs a) (multLogs a)) + _ (fun a => Ball.mul_sound (Z2_0_6Probs_sound a) (multLogs_sound a))) (by decide +kernel) +def Z2_0_6Four : Ball := ⟨(250748749228044656387794087131641 / 50000000000000000000000000000000), (190582413799 / 100000000000000000000000000000000)⟩ +lemma Z2_0_6Four_sound : Z2_0_6Four.Encloses (AllFieldZeroLeafRates.fourRate (shape 2 0 6)) := by + exact contains_sound (Ball.add_sound Z2_0_6Entropy_sound Z2_0_6Labels_sound) (by decide +kernel) +def Z2_0_6H0Value (a : PairSlot) : ℝ := (halfLaw (shape 2 0 6) 0 a : ℝ) +def Z2_0_6H0E_2_0LogWitness : LogWitness := ⟨-3, 10457964405071752630514678883453, 6250000000000000000000000000000⟩ +def Z2_0_6H0E_2_0Log : Ball := ⟨(-78232958663779813935933970438769 / 50000000000000000000000000000000), (10587911863 / 12500000000000000000000000000000)⟩ +lemma Z2_0_6H0E_2_0Log_sound : Z2_0_6H0E_2_0Log.Encloses (Real.log (Z2_0_6H0Value ((2,0) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound ((Z2_0_6Half_sound 0) ((2,0) : PairSlot)) (w := Z2_0_6H0E_2_0LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z2_0_6H0E_2_0 : Ball := ⟨(32726299880370363099063710099363 / 100000000000000000000000000000000), (17716480919 / 100000000000000000000000000000000)⟩ +lemma Z2_0_6H0E_2_0_sound : Z2_0_6H0E_2_0.Encloses (Foundation.entropyTerm (Z2_0_6H0Value ((2,0) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z2_0_6Half_sound 0) ((2,0) : PairSlot)) Z2_0_6H0E_2_0Log_sound) (by decide +kernel) +def Z2_0_6H0E_3_0LogWitness : LogWitness := ⟨-6, 1708150169428319858018410671529, 1562500000000000000000000000000⟩ +def Z2_0_6H0E_3_0Log : Ball := ⟨(-203487958663779813935933941795503 / 50000000000000000000000000000000), (74115383007 / 50000000000000000000000000000000)⟩ +lemma Z2_0_6H0E_3_0Log_sound : Z2_0_6H0E_3_0Log.Encloses (Real.log (Z2_0_6H0Value ((3,0) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound ((Z2_0_6Half_sound 0) ((3,0) : PairSlot)) (w := Z2_0_6H0E_3_0LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z2_0_6H0E_3_0 : Ball := ⟨(1737939955340792184583902537331 / 25000000000000000000000000000000), (1266002049 / 50000000000000000000000000000000)⟩ +lemma Z2_0_6H0E_3_0_sound : Z2_0_6H0E_3_0.Encloses (Foundation.entropyTerm (Z2_0_6H0Value ((3,0) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z2_0_6Half_sound 0) ((3,0) : PairSlot)) Z2_0_6H0E_3_0Log_sound) (by decide +kernel) +def Z2_0_6H0E_1_1LogWitness : LogWitness := ⟨-1, 5475184204085634976190446312313, 5000000000000000000000000000000⟩ +def Z2_0_6H0E_1_1Log : Ball := ⟨(-6023591732755962787186797906847 / 10000000000000000000000000000000), (2117582371 / 5000000000000000000000000000000)⟩ +lemma Z2_0_6H0E_1_1Log_sound : Z2_0_6H0E_1_1Log.Encloses (Real.log (Z2_0_6H0Value ((1,1) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound ((Z2_0_6Half_sound 0) ((1,1) : PairSlot)) (w := Z2_0_6H0E_1_1LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z2_0_6H0E_1_1 : Ball := ⟨(32980274307046266973832495616429 / 100000000000000000000000000000000), (5797076779 / 25000000000000000000000000000000)⟩ +lemma Z2_0_6H0E_1_1_sound : Z2_0_6H0E_1_1.Encloses (Foundation.entropyTerm (Z2_0_6H0Value ((1,1) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z2_0_6Half_sound 0) ((1,1) : PairSlot)) Z2_0_6H0E_1_1Log_sound) (by decide +kernel) +def Z2_0_6H0E_0_2LogWitness : LogWitness := ⟨-3, 10457964405071752630514678883453, 6250000000000000000000000000000⟩ +def Z2_0_6H0E_0_2Log : Ball := ⟨(-78232958663779813935933970438769 / 50000000000000000000000000000000), (10587911863 / 12500000000000000000000000000000)⟩ +lemma Z2_0_6H0E_0_2Log_sound : Z2_0_6H0E_0_2Log.Encloses (Real.log (Z2_0_6H0Value ((0,2) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound ((Z2_0_6Half_sound 0) ((0,2) : PairSlot)) (w := Z2_0_6H0E_0_2LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z2_0_6H0E_0_2 : Ball := ⟨(32726299880370363099063710099363 / 100000000000000000000000000000000), (17716480919 / 100000000000000000000000000000000)⟩ +lemma Z2_0_6H0E_0_2_sound : Z2_0_6H0E_0_2.Encloses (Foundation.entropyTerm (Z2_0_6H0Value ((0,2) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z2_0_6Half_sound 0) ((0,2) : PairSlot)) Z2_0_6H0E_0_2Log_sound) (by decide +kernel) +def Z2_0_6H0E_0_3LogWitness : LogWitness := ⟨-6, 1708150169428319858018410671529, 1562500000000000000000000000000⟩ +def Z2_0_6H0E_0_3Log : Ball := ⟨(-203487958663779813935933941795503 / 50000000000000000000000000000000), (74115383007 / 50000000000000000000000000000000)⟩ +lemma Z2_0_6H0E_0_3Log_sound : Z2_0_6H0E_0_3Log.Encloses (Real.log (Z2_0_6H0Value ((0,3) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound ((Z2_0_6Half_sound 0) ((0,3) : PairSlot)) (w := Z2_0_6H0E_0_3LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z2_0_6H0E_0_3 : Ball := ⟨(1737939955340792184583902537331 / 25000000000000000000000000000000), (1266002049 / 50000000000000000000000000000000)⟩ +lemma Z2_0_6H0E_0_3_sound : Z2_0_6H0E_0_3.Encloses (Foundation.entropyTerm (Z2_0_6H0Value ((0,3) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z2_0_6Half_sound 0) ((0,3) : PairSlot)) Z2_0_6H0E_0_3Log_sound) (by decide +kernel) +def Z2_0_6H0Terms (a : PairSlot) : Ball := + match a.1.val, a.2.val with + | 2, 0 => ⟨(32726299880370363099063710099363 / 100000000000000000000000000000000), (17716480919 / 100000000000000000000000000000000)⟩ + | 3, 0 => ⟨(1737939955340792184583902537331 / 25000000000000000000000000000000), (1266002049 / 50000000000000000000000000000000)⟩ + | 1, 1 => ⟨(32980274307046266973832495616429 / 100000000000000000000000000000000), (5797076779 / 25000000000000000000000000000000)⟩ + | 0, 2 => ⟨(32726299880370363099063710099363 / 100000000000000000000000000000000), (17716480919 / 100000000000000000000000000000000)⟩ + | 0, 3 => ⟨(1737939955340792184583902537331 / 25000000000000000000000000000000), (1266002049 / 50000000000000000000000000000000)⟩ + | _, _ => (.exact 0) +lemma Z2_0_6H0Terms_sound (a : PairSlot) : + (Z2_0_6H0Terms a).Encloses (Foundation.entropyTerm (Z2_0_6H0Value a)) := by + rcases a with ⟨i,j⟩ + revert j i + apply forall_fin6 + · exact forall_fin6 (entropyTerm_zero_ball ((Z2_0_6Half_sound 0) ((0,0) : PairSlot))) (entropyTerm_zero_ball ((Z2_0_6Half_sound 0) ((0,1) : PairSlot))) Z2_0_6H0E_0_2_sound Z2_0_6H0E_0_3_sound (entropyTerm_zero_ball ((Z2_0_6Half_sound 0) ((0,4) : PairSlot))) (entropyTerm_zero_ball ((Z2_0_6Half_sound 0) ((0,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z2_0_6Half_sound 0) ((1,0) : PairSlot))) Z2_0_6H0E_1_1_sound (entropyTerm_zero_ball ((Z2_0_6Half_sound 0) ((1,2) : PairSlot))) (entropyTerm_zero_ball ((Z2_0_6Half_sound 0) ((1,3) : PairSlot))) (entropyTerm_zero_ball ((Z2_0_6Half_sound 0) ((1,4) : PairSlot))) (entropyTerm_zero_ball ((Z2_0_6Half_sound 0) ((1,5) : PairSlot))) + · exact forall_fin6 Z2_0_6H0E_2_0_sound (entropyTerm_zero_ball ((Z2_0_6Half_sound 0) ((2,1) : PairSlot))) (entropyTerm_zero_ball ((Z2_0_6Half_sound 0) ((2,2) : PairSlot))) (entropyTerm_zero_ball ((Z2_0_6Half_sound 0) ((2,3) : PairSlot))) (entropyTerm_zero_ball ((Z2_0_6Half_sound 0) ((2,4) : PairSlot))) (entropyTerm_zero_ball ((Z2_0_6Half_sound 0) ((2,5) : PairSlot))) + · exact forall_fin6 Z2_0_6H0E_3_0_sound (entropyTerm_zero_ball ((Z2_0_6Half_sound 0) ((3,1) : PairSlot))) (entropyTerm_zero_ball ((Z2_0_6Half_sound 0) ((3,2) : PairSlot))) (entropyTerm_zero_ball ((Z2_0_6Half_sound 0) ((3,3) : PairSlot))) (entropyTerm_zero_ball ((Z2_0_6Half_sound 0) ((3,4) : PairSlot))) (entropyTerm_zero_ball ((Z2_0_6Half_sound 0) ((3,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z2_0_6Half_sound 0) ((4,0) : PairSlot))) (entropyTerm_zero_ball ((Z2_0_6Half_sound 0) ((4,1) : PairSlot))) (entropyTerm_zero_ball ((Z2_0_6Half_sound 0) ((4,2) : PairSlot))) (entropyTerm_zero_ball ((Z2_0_6Half_sound 0) ((4,3) : PairSlot))) (entropyTerm_zero_ball ((Z2_0_6Half_sound 0) ((4,4) : PairSlot))) (entropyTerm_zero_ball ((Z2_0_6Half_sound 0) ((4,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z2_0_6Half_sound 0) ((5,0) : PairSlot))) (entropyTerm_zero_ball ((Z2_0_6Half_sound 0) ((5,1) : PairSlot))) (entropyTerm_zero_ball ((Z2_0_6Half_sound 0) ((5,2) : PairSlot))) (entropyTerm_zero_ball ((Z2_0_6Half_sound 0) ((5,3) : PairSlot))) (entropyTerm_zero_ball ((Z2_0_6Half_sound 0) ((5,4) : PairSlot))) (entropyTerm_zero_ball ((Z2_0_6Half_sound 0) ((5,5) : PairSlot))) +def Z2_0_6H0Entropy : Ball := ⟨(112336393710513330648631136113803 / 100000000000000000000000000000000), (1273705543 / 2000000000000000000000000000000)⟩ +lemma Z2_0_6H0Entropy_sound : Z2_0_6H0Entropy.Encloses (Foundation.finiteEntropy Z2_0_6H0Value) := by + exact contains_sound (entropyPair_enclosed Z2_0_6H0Value Z2_0_6H0Terms Z2_0_6H0Terms_sound) (by decide +kernel) +def Z2_0_6H0Mass : Ball := ⟨1, (11 / 10000000000000000000000000000000)⟩ +lemma Z2_0_6H0Mass_sound : Z2_0_6H0Mass.Encloses (∑ a, Z2_0_6H0Value a) := by + exact contains_sound (pairSumBall_sound (Z2_0_6Half 0) Z2_0_6H0Value (Z2_0_6Half_sound 0)) (by decide +kernel) +def Z2_0_6H0MassTermLogWitness : LogWitness := ⟨0, 1, 1⟩ +def Z2_0_6H0MassTermLog : Ball := ⟨0, (1323488987 / 6250000000000000000000000000000)⟩ +lemma Z2_0_6H0MassTermLog_sound : Z2_0_6H0MassTermLog.Encloses (Real.log ((∑ a, Z2_0_6H0Value a))) := by + exact checkLog_sound logTwoBall_sound (Z2_0_6H0Mass_sound) (w := Z2_0_6H0MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z2_0_6H0MassTerm : Ball := ⟨0, (21175823793 / 100000000000000000000000000000000)⟩ +lemma Z2_0_6H0MassTerm_sound : Z2_0_6H0MassTerm.Encloses (Foundation.entropyTerm ((∑ a, Z2_0_6H0Value a))) := by + exact contains_sound (entropyTerm_ball (Z2_0_6H0Mass_sound) Z2_0_6H0MassTermLog_sound) (by decide +kernel) +def Z2_0_6H0H : Ball := ⟨(112336393710513330648631136113803 / 100000000000000000000000000000000), (84861100943 / 100000000000000000000000000000000)⟩ +lemma Z2_0_6H0H_sound : Z2_0_6H0H.Encloses (homogeneousEntropy Z2_0_6H0Value) := by + exact contains_sound (homogeneous_enclosed Z2_0_6H0Value Z2_0_6H0MassTerm_sound Z2_0_6H0Entropy_sound) (by decide +kernel) +def Z2_0_6H1Value (a : PairSlot) : ℝ := (halfLaw (shape 2 0 6) 1 a : ℝ) +def Z2_0_6H1E_0_0Log : Ball := .exact 0 +lemma Z2_0_6H1E_0_0Log_sound : Z2_0_6H1E_0_0Log.Encloses (Real.log (Z2_0_6H1Value ((0,0) : PairSlot))) := by + exact log_exact_one_ball ((Z2_0_6Half_sound 1) ((0,0) : PairSlot)) +def Z2_0_6H1E_0_0 : Ball := ⟨0, 0⟩ +lemma Z2_0_6H1E_0_0_sound : Z2_0_6H1E_0_0.Encloses (Foundation.entropyTerm (Z2_0_6H1Value ((0,0) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z2_0_6Half_sound 1) ((0,0) : PairSlot)) Z2_0_6H1E_0_0Log_sound) (by decide +kernel) +def Z2_0_6H1Terms (a : PairSlot) : Ball := + match a.1.val, a.2.val with + | 0, 0 => ⟨0, 0⟩ + | _, _ => (.exact 0) +lemma Z2_0_6H1Terms_sound (a : PairSlot) : + (Z2_0_6H1Terms a).Encloses (Foundation.entropyTerm (Z2_0_6H1Value a)) := by + rcases a with ⟨i,j⟩ + revert j i + apply forall_fin6 + · exact forall_fin6 Z2_0_6H1E_0_0_sound (entropyTerm_zero_ball ((Z2_0_6Half_sound 1) ((0,1) : PairSlot))) (entropyTerm_zero_ball ((Z2_0_6Half_sound 1) ((0,2) : PairSlot))) (entropyTerm_zero_ball ((Z2_0_6Half_sound 1) ((0,3) : PairSlot))) (entropyTerm_zero_ball ((Z2_0_6Half_sound 1) ((0,4) : PairSlot))) (entropyTerm_zero_ball ((Z2_0_6Half_sound 1) ((0,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z2_0_6Half_sound 1) ((1,0) : PairSlot))) (entropyTerm_zero_ball ((Z2_0_6Half_sound 1) ((1,1) : PairSlot))) (entropyTerm_zero_ball ((Z2_0_6Half_sound 1) ((1,2) : PairSlot))) (entropyTerm_zero_ball ((Z2_0_6Half_sound 1) ((1,3) : PairSlot))) (entropyTerm_zero_ball ((Z2_0_6Half_sound 1) ((1,4) : PairSlot))) (entropyTerm_zero_ball ((Z2_0_6Half_sound 1) ((1,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z2_0_6Half_sound 1) ((2,0) : PairSlot))) (entropyTerm_zero_ball ((Z2_0_6Half_sound 1) ((2,1) : PairSlot))) (entropyTerm_zero_ball ((Z2_0_6Half_sound 1) ((2,2) : PairSlot))) (entropyTerm_zero_ball ((Z2_0_6Half_sound 1) ((2,3) : PairSlot))) (entropyTerm_zero_ball ((Z2_0_6Half_sound 1) ((2,4) : PairSlot))) (entropyTerm_zero_ball ((Z2_0_6Half_sound 1) ((2,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z2_0_6Half_sound 1) ((3,0) : PairSlot))) (entropyTerm_zero_ball ((Z2_0_6Half_sound 1) ((3,1) : PairSlot))) (entropyTerm_zero_ball ((Z2_0_6Half_sound 1) ((3,2) : PairSlot))) (entropyTerm_zero_ball ((Z2_0_6Half_sound 1) ((3,3) : PairSlot))) (entropyTerm_zero_ball ((Z2_0_6Half_sound 1) ((3,4) : PairSlot))) (entropyTerm_zero_ball ((Z2_0_6Half_sound 1) ((3,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z2_0_6Half_sound 1) ((4,0) : PairSlot))) (entropyTerm_zero_ball ((Z2_0_6Half_sound 1) ((4,1) : PairSlot))) (entropyTerm_zero_ball ((Z2_0_6Half_sound 1) ((4,2) : PairSlot))) (entropyTerm_zero_ball ((Z2_0_6Half_sound 1) ((4,3) : PairSlot))) (entropyTerm_zero_ball ((Z2_0_6Half_sound 1) ((4,4) : PairSlot))) (entropyTerm_zero_ball ((Z2_0_6Half_sound 1) ((4,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z2_0_6Half_sound 1) ((5,0) : PairSlot))) (entropyTerm_zero_ball ((Z2_0_6Half_sound 1) ((5,1) : PairSlot))) (entropyTerm_zero_ball ((Z2_0_6Half_sound 1) ((5,2) : PairSlot))) (entropyTerm_zero_ball ((Z2_0_6Half_sound 1) ((5,3) : PairSlot))) (entropyTerm_zero_ball ((Z2_0_6Half_sound 1) ((5,4) : PairSlot))) (entropyTerm_zero_ball ((Z2_0_6Half_sound 1) ((5,5) : PairSlot))) +def Z2_0_6H1Entropy : Ball := ⟨0, 0⟩ +lemma Z2_0_6H1Entropy_sound : Z2_0_6H1Entropy.Encloses (Foundation.finiteEntropy Z2_0_6H1Value) := by + exact contains_sound (entropyPair_enclosed Z2_0_6H1Value Z2_0_6H1Terms Z2_0_6H1Terms_sound) (by decide +kernel) +def Z2_0_6H1Mass : Ball := ⟨1, 0⟩ +lemma Z2_0_6H1Mass_sound : Z2_0_6H1Mass.Encloses (∑ a, Z2_0_6H1Value a) := by + exact contains_sound (pairSumBall_sound (Z2_0_6Half 1) Z2_0_6H1Value (Z2_0_6Half_sound 1)) (by decide +kernel) +def Z2_0_6H1MassTermLog : Ball := .exact 0 +lemma Z2_0_6H1MassTermLog_sound : Z2_0_6H1MassTermLog.Encloses (Real.log ((∑ a, Z2_0_6H1Value a))) := by + exact log_exact_one_ball (Z2_0_6H1Mass_sound) +def Z2_0_6H1MassTerm : Ball := ⟨0, 0⟩ +lemma Z2_0_6H1MassTerm_sound : Z2_0_6H1MassTerm.Encloses (Foundation.entropyTerm ((∑ a, Z2_0_6H1Value a))) := by + exact contains_sound (entropyTerm_ball (Z2_0_6H1Mass_sound) Z2_0_6H1MassTermLog_sound) (by decide +kernel) +def Z2_0_6H1H : Ball := ⟨0, 0⟩ +lemma Z2_0_6H1H_sound : Z2_0_6H1H.Encloses (homogeneousEntropy Z2_0_6H1Value) := by + exact contains_sound (homogeneous_enclosed Z2_0_6H1Value Z2_0_6H1MassTerm_sound Z2_0_6H1Entropy_sound) (by decide +kernel) +def Z2_0_6H2Value (a : PairSlot) : ℝ := (halfLaw (shape 2 0 6) 2 a : ℝ) +def Z2_0_6H2E_2_5LogWitness : LogWitness := ⟨-3, 10457964405071752630514678883453, 6250000000000000000000000000000⟩ +def Z2_0_6H2E_2_5Log : Ball := ⟨(-78232958663779813935933970438769 / 50000000000000000000000000000000), (10587911863 / 12500000000000000000000000000000)⟩ +lemma Z2_0_6H2E_2_5Log_sound : Z2_0_6H2E_2_5Log.Encloses (Real.log (Z2_0_6H2Value ((2,5) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound ((Z2_0_6Half_sound 2) ((2,5) : PairSlot)) (w := Z2_0_6H2E_2_5LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z2_0_6H2E_2_5 : Ball := ⟨(32726299880370363099063710099363 / 100000000000000000000000000000000), (17716480919 / 100000000000000000000000000000000)⟩ +lemma Z2_0_6H2E_2_5_sound : Z2_0_6H2E_2_5.Encloses (Foundation.entropyTerm (Z2_0_6H2Value ((2,5) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z2_0_6Half_sound 2) ((2,5) : PairSlot)) Z2_0_6H2E_2_5Log_sound) (by decide +kernel) +def Z2_0_6H2E_3_5LogWitness : LogWitness := ⟨-6, 1708150169428319858018410671529, 1562500000000000000000000000000⟩ +def Z2_0_6H2E_3_5Log : Ball := ⟨(-203487958663779813935933941795503 / 50000000000000000000000000000000), (74115383007 / 50000000000000000000000000000000)⟩ +lemma Z2_0_6H2E_3_5Log_sound : Z2_0_6H2E_3_5Log.Encloses (Real.log (Z2_0_6H2Value ((3,5) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound ((Z2_0_6Half_sound 2) ((3,5) : PairSlot)) (w := Z2_0_6H2E_3_5LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z2_0_6H2E_3_5 : Ball := ⟨(1737939955340792184583902537331 / 25000000000000000000000000000000), (1266002049 / 50000000000000000000000000000000)⟩ +lemma Z2_0_6H2E_3_5_sound : Z2_0_6H2E_3_5.Encloses (Foundation.entropyTerm (Z2_0_6H2Value ((3,5) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z2_0_6Half_sound 2) ((3,5) : PairSlot)) Z2_0_6H2E_3_5Log_sound) (by decide +kernel) +def Z2_0_6H2E_4_4LogWitness : LogWitness := ⟨-1, 5475184204085634976190446312313, 5000000000000000000000000000000⟩ +def Z2_0_6H2E_4_4Log : Ball := ⟨(-6023591732755962787186797906847 / 10000000000000000000000000000000), (2117582371 / 5000000000000000000000000000000)⟩ +lemma Z2_0_6H2E_4_4Log_sound : Z2_0_6H2E_4_4Log.Encloses (Real.log (Z2_0_6H2Value ((4,4) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound ((Z2_0_6Half_sound 2) ((4,4) : PairSlot)) (w := Z2_0_6H2E_4_4LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z2_0_6H2E_4_4 : Ball := ⟨(32980274307046266973832495616429 / 100000000000000000000000000000000), (5797076779 / 25000000000000000000000000000000)⟩ +lemma Z2_0_6H2E_4_4_sound : Z2_0_6H2E_4_4.Encloses (Foundation.entropyTerm (Z2_0_6H2Value ((4,4) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z2_0_6Half_sound 2) ((4,4) : PairSlot)) Z2_0_6H2E_4_4Log_sound) (by decide +kernel) +def Z2_0_6H2E_5_2LogWitness : LogWitness := ⟨-3, 10457964405071752630514678883453, 6250000000000000000000000000000⟩ +def Z2_0_6H2E_5_2Log : Ball := ⟨(-78232958663779813935933970438769 / 50000000000000000000000000000000), (10587911863 / 12500000000000000000000000000000)⟩ +lemma Z2_0_6H2E_5_2Log_sound : Z2_0_6H2E_5_2Log.Encloses (Real.log (Z2_0_6H2Value ((5,2) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound ((Z2_0_6Half_sound 2) ((5,2) : PairSlot)) (w := Z2_0_6H2E_5_2LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z2_0_6H2E_5_2 : Ball := ⟨(32726299880370363099063710099363 / 100000000000000000000000000000000), (17716480919 / 100000000000000000000000000000000)⟩ +lemma Z2_0_6H2E_5_2_sound : Z2_0_6H2E_5_2.Encloses (Foundation.entropyTerm (Z2_0_6H2Value ((5,2) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z2_0_6Half_sound 2) ((5,2) : PairSlot)) Z2_0_6H2E_5_2Log_sound) (by decide +kernel) +def Z2_0_6H2E_5_3LogWitness : LogWitness := ⟨-6, 1708150169428319858018410671529, 1562500000000000000000000000000⟩ +def Z2_0_6H2E_5_3Log : Ball := ⟨(-203487958663779813935933941795503 / 50000000000000000000000000000000), (74115383007 / 50000000000000000000000000000000)⟩ +lemma Z2_0_6H2E_5_3Log_sound : Z2_0_6H2E_5_3Log.Encloses (Real.log (Z2_0_6H2Value ((5,3) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound ((Z2_0_6Half_sound 2) ((5,3) : PairSlot)) (w := Z2_0_6H2E_5_3LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z2_0_6H2E_5_3 : Ball := ⟨(1737939955340792184583902537331 / 25000000000000000000000000000000), (1266002049 / 50000000000000000000000000000000)⟩ +lemma Z2_0_6H2E_5_3_sound : Z2_0_6H2E_5_3.Encloses (Foundation.entropyTerm (Z2_0_6H2Value ((5,3) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z2_0_6Half_sound 2) ((5,3) : PairSlot)) Z2_0_6H2E_5_3Log_sound) (by decide +kernel) +def Z2_0_6H2Terms (a : PairSlot) : Ball := + match a.1.val, a.2.val with + | 2, 5 => ⟨(32726299880370363099063710099363 / 100000000000000000000000000000000), (17716480919 / 100000000000000000000000000000000)⟩ + | 3, 5 => ⟨(1737939955340792184583902537331 / 25000000000000000000000000000000), (1266002049 / 50000000000000000000000000000000)⟩ + | 4, 4 => ⟨(32980274307046266973832495616429 / 100000000000000000000000000000000), (5797076779 / 25000000000000000000000000000000)⟩ + | 5, 2 => ⟨(32726299880370363099063710099363 / 100000000000000000000000000000000), (17716480919 / 100000000000000000000000000000000)⟩ + | 5, 3 => ⟨(1737939955340792184583902537331 / 25000000000000000000000000000000), (1266002049 / 50000000000000000000000000000000)⟩ + | _, _ => (.exact 0) +lemma Z2_0_6H2Terms_sound (a : PairSlot) : + (Z2_0_6H2Terms a).Encloses (Foundation.entropyTerm (Z2_0_6H2Value a)) := by + rcases a with ⟨i,j⟩ + revert j i + apply forall_fin6 + · exact forall_fin6 (entropyTerm_zero_ball ((Z2_0_6Half_sound 2) ((0,0) : PairSlot))) (entropyTerm_zero_ball ((Z2_0_6Half_sound 2) ((0,1) : PairSlot))) (entropyTerm_zero_ball ((Z2_0_6Half_sound 2) ((0,2) : PairSlot))) (entropyTerm_zero_ball ((Z2_0_6Half_sound 2) ((0,3) : PairSlot))) (entropyTerm_zero_ball ((Z2_0_6Half_sound 2) ((0,4) : PairSlot))) (entropyTerm_zero_ball ((Z2_0_6Half_sound 2) ((0,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z2_0_6Half_sound 2) ((1,0) : PairSlot))) (entropyTerm_zero_ball ((Z2_0_6Half_sound 2) ((1,1) : PairSlot))) (entropyTerm_zero_ball ((Z2_0_6Half_sound 2) ((1,2) : PairSlot))) (entropyTerm_zero_ball ((Z2_0_6Half_sound 2) ((1,3) : PairSlot))) (entropyTerm_zero_ball ((Z2_0_6Half_sound 2) ((1,4) : PairSlot))) (entropyTerm_zero_ball ((Z2_0_6Half_sound 2) ((1,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z2_0_6Half_sound 2) ((2,0) : PairSlot))) (entropyTerm_zero_ball ((Z2_0_6Half_sound 2) ((2,1) : PairSlot))) (entropyTerm_zero_ball ((Z2_0_6Half_sound 2) ((2,2) : PairSlot))) (entropyTerm_zero_ball ((Z2_0_6Half_sound 2) ((2,3) : PairSlot))) (entropyTerm_zero_ball ((Z2_0_6Half_sound 2) ((2,4) : PairSlot))) Z2_0_6H2E_2_5_sound + · exact forall_fin6 (entropyTerm_zero_ball ((Z2_0_6Half_sound 2) ((3,0) : PairSlot))) (entropyTerm_zero_ball ((Z2_0_6Half_sound 2) ((3,1) : PairSlot))) (entropyTerm_zero_ball ((Z2_0_6Half_sound 2) ((3,2) : PairSlot))) (entropyTerm_zero_ball ((Z2_0_6Half_sound 2) ((3,3) : PairSlot))) (entropyTerm_zero_ball ((Z2_0_6Half_sound 2) ((3,4) : PairSlot))) Z2_0_6H2E_3_5_sound + · exact forall_fin6 (entropyTerm_zero_ball ((Z2_0_6Half_sound 2) ((4,0) : PairSlot))) (entropyTerm_zero_ball ((Z2_0_6Half_sound 2) ((4,1) : PairSlot))) (entropyTerm_zero_ball ((Z2_0_6Half_sound 2) ((4,2) : PairSlot))) (entropyTerm_zero_ball ((Z2_0_6Half_sound 2) ((4,3) : PairSlot))) Z2_0_6H2E_4_4_sound (entropyTerm_zero_ball ((Z2_0_6Half_sound 2) ((4,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z2_0_6Half_sound 2) ((5,0) : PairSlot))) (entropyTerm_zero_ball ((Z2_0_6Half_sound 2) ((5,1) : PairSlot))) Z2_0_6H2E_5_2_sound Z2_0_6H2E_5_3_sound (entropyTerm_zero_ball ((Z2_0_6Half_sound 2) ((5,4) : PairSlot))) (entropyTerm_zero_ball ((Z2_0_6Half_sound 2) ((5,5) : PairSlot))) +def Z2_0_6H2Entropy : Ball := ⟨(112336393710513330648631136113803 / 100000000000000000000000000000000), (1273705543 / 2000000000000000000000000000000)⟩ +lemma Z2_0_6H2Entropy_sound : Z2_0_6H2Entropy.Encloses (Foundation.finiteEntropy Z2_0_6H2Value) := by + exact contains_sound (entropyPair_enclosed Z2_0_6H2Value Z2_0_6H2Terms Z2_0_6H2Terms_sound) (by decide +kernel) +def Z2_0_6H2Mass : Ball := ⟨1, (11 / 10000000000000000000000000000000)⟩ +lemma Z2_0_6H2Mass_sound : Z2_0_6H2Mass.Encloses (∑ a, Z2_0_6H2Value a) := by + exact contains_sound (pairSumBall_sound (Z2_0_6Half 2) Z2_0_6H2Value (Z2_0_6Half_sound 2)) (by decide +kernel) +def Z2_0_6H2MassTermLogWitness : LogWitness := ⟨0, 1, 1⟩ +def Z2_0_6H2MassTermLog : Ball := ⟨0, (1323488987 / 6250000000000000000000000000000)⟩ +lemma Z2_0_6H2MassTermLog_sound : Z2_0_6H2MassTermLog.Encloses (Real.log ((∑ a, Z2_0_6H2Value a))) := by + exact checkLog_sound logTwoBall_sound (Z2_0_6H2Mass_sound) (w := Z2_0_6H2MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z2_0_6H2MassTerm : Ball := ⟨0, (21175823793 / 100000000000000000000000000000000)⟩ +lemma Z2_0_6H2MassTerm_sound : Z2_0_6H2MassTerm.Encloses (Foundation.entropyTerm ((∑ a, Z2_0_6H2Value a))) := by + exact contains_sound (entropyTerm_ball (Z2_0_6H2Mass_sound) Z2_0_6H2MassTermLog_sound) (by decide +kernel) +def Z2_0_6H2H : Ball := ⟨(112336393710513330648631136113803 / 100000000000000000000000000000000), (84861100943 / 100000000000000000000000000000000)⟩ +lemma Z2_0_6H2H_sound : Z2_0_6H2H.Encloses (homogeneousEntropy Z2_0_6H2Value) := by + exact contains_sound (homogeneous_enclosed Z2_0_6H2Value Z2_0_6H2MassTerm_sound Z2_0_6H2Entropy_sound) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/Certificates/Four2_6_0.lean b/lean/OAI/LinearAlgebra/MatrixFields/Certificates/Four2_6_0.lean new file mode 100644 index 0000000000000000000000000000000000000000..4ef9f2fe9fa8f47476927a1c133fd38ce1c47ea2 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/Certificates/Four2_6_0.lean @@ -0,0 +1,573 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Certificates.SplitB1_1_6 + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def Z2_6_0Raw (ij : PairSlot) : Ball := + match ij.1.val, ij.2.val with + | 0, 0 => w195 + | 0, 1 => w195 + | 0, 2 => w195 + | 0, 3 => w195 + | 0, 4 => w195 + | 0, 5 => w195 + | 1, 0 => w195 + | 1, 1 => w195 + | 1, 2 => w195 + | 1, 3 => w195 + | 1, 4 => w195 + | 1, 5 => w195 + | 2, 0 => w195 + | 2, 1 => w195 + | 2, 2 => w195 + | 2, 3 => w195 + | 2, 4 => w195 + | 2, 5 => w122 + | 3, 0 => w195 + | 3, 1 => w195 + | 3, 2 => w195 + | 3, 3 => w195 + | 3, 4 => w195 + | 3, 5 => w49 + | 4, 0 => w195 + | 4, 1 => w195 + | 4, 2 => w195 + | 4, 3 => w195 + | 4, 4 => w195 + | 4, 5 => w195 + | 5, 0 => w195 + | 5, 1 => w195 + | 5, 2 => w122 + | 5, 3 => w49 + | 5, 4 => w195 + | 5, 5 => w195 + | _, _ => (.exact 0) +lemma Z2_6_0Raw_sound_0 (j : Fin 6) : + (Z2_6_0Raw (0,j)).Encloses (weight (orderedPairInteger (shape 2 6 0) 0 j) : ℝ) := by + fin_cases j + · change (Z2_6_0Raw (0,0)).Encloses (weight (orderedPairInteger (shape 2 6 0) 0 0) : ℝ) + have he : orderedPairInteger (shape 2 6 0) 0 0 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z2_6_0Raw (0,1)).Encloses (weight (orderedPairInteger (shape 2 6 0) 0 1) : ℝ) + have he : orderedPairInteger (shape 2 6 0) 0 1 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z2_6_0Raw (0,2)).Encloses (weight (orderedPairInteger (shape 2 6 0) 0 2) : ℝ) + have he : orderedPairInteger (shape 2 6 0) 0 2 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z2_6_0Raw (0,3)).Encloses (weight (orderedPairInteger (shape 2 6 0) 0 3) : ℝ) + have he : orderedPairInteger (shape 2 6 0) 0 3 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z2_6_0Raw (0,4)).Encloses (weight (orderedPairInteger (shape 2 6 0) 0 4) : ℝ) + have he : orderedPairInteger (shape 2 6 0) 0 4 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z2_6_0Raw (0,5)).Encloses (weight (orderedPairInteger (shape 2 6 0) 0 5) : ℝ) + have he : orderedPairInteger (shape 2 6 0) 0 5 = (0) := by decide +kernel + rw [he] + exact w195_sound +lemma Z2_6_0Raw_sound_1 (j : Fin 6) : + (Z2_6_0Raw (1,j)).Encloses (weight (orderedPairInteger (shape 2 6 0) 1 j) : ℝ) := by + fin_cases j + · change (Z2_6_0Raw (1,0)).Encloses (weight (orderedPairInteger (shape 2 6 0) 1 0) : ℝ) + have he : orderedPairInteger (shape 2 6 0) 1 0 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z2_6_0Raw (1,1)).Encloses (weight (orderedPairInteger (shape 2 6 0) 1 1) : ℝ) + have he : orderedPairInteger (shape 2 6 0) 1 1 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z2_6_0Raw (1,2)).Encloses (weight (orderedPairInteger (shape 2 6 0) 1 2) : ℝ) + have he : orderedPairInteger (shape 2 6 0) 1 2 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z2_6_0Raw (1,3)).Encloses (weight (orderedPairInteger (shape 2 6 0) 1 3) : ℝ) + have he : orderedPairInteger (shape 2 6 0) 1 3 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z2_6_0Raw (1,4)).Encloses (weight (orderedPairInteger (shape 2 6 0) 1 4) : ℝ) + have he : orderedPairInteger (shape 2 6 0) 1 4 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z2_6_0Raw (1,5)).Encloses (weight (orderedPairInteger (shape 2 6 0) 1 5) : ℝ) + have he : orderedPairInteger (shape 2 6 0) 1 5 = (0) := by decide +kernel + rw [he] + exact w195_sound +lemma Z2_6_0Raw_sound_2 (j : Fin 6) : + (Z2_6_0Raw (2,j)).Encloses (weight (orderedPairInteger (shape 2 6 0) 2 j) : ℝ) := by + fin_cases j + · change (Z2_6_0Raw (2,0)).Encloses (weight (orderedPairInteger (shape 2 6 0) 2 0) : ℝ) + have he : orderedPairInteger (shape 2 6 0) 2 0 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z2_6_0Raw (2,1)).Encloses (weight (orderedPairInteger (shape 2 6 0) 2 1) : ℝ) + have he : orderedPairInteger (shape 2 6 0) 2 1 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z2_6_0Raw (2,2)).Encloses (weight (orderedPairInteger (shape 2 6 0) 2 2) : ℝ) + have he : orderedPairInteger (shape 2 6 0) 2 2 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z2_6_0Raw (2,3)).Encloses (weight (orderedPairInteger (shape 2 6 0) 2 3) : ℝ) + have he : orderedPairInteger (shape 2 6 0) 2 3 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z2_6_0Raw (2,4)).Encloses (weight (orderedPairInteger (shape 2 6 0) 2 4) : ℝ) + have he : orderedPairInteger (shape 2 6 0) 2 4 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z2_6_0Raw (2,5)).Encloses (weight (orderedPairInteger (shape 2 6 0) 2 5) : ℝ) + have he : orderedPairInteger (shape 2 6 0) 2 5 = (-12708) := by decide +kernel + rw [he] + exact w122_sound +lemma Z2_6_0Raw_sound_3 (j : Fin 6) : + (Z2_6_0Raw (3,j)).Encloses (weight (orderedPairInteger (shape 2 6 0) 3 j) : ℝ) := by + fin_cases j + · change (Z2_6_0Raw (3,0)).Encloses (weight (orderedPairInteger (shape 2 6 0) 3 0) : ℝ) + have he : orderedPairInteger (shape 2 6 0) 3 0 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z2_6_0Raw (3,1)).Encloses (weight (orderedPairInteger (shape 2 6 0) 3 1) : ℝ) + have he : orderedPairInteger (shape 2 6 0) 3 1 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z2_6_0Raw (3,2)).Encloses (weight (orderedPairInteger (shape 2 6 0) 3 2) : ℝ) + have he : orderedPairInteger (shape 2 6 0) 3 2 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z2_6_0Raw (3,3)).Encloses (weight (orderedPairInteger (shape 2 6 0) 3 3) : ℝ) + have he : orderedPairInteger (shape 2 6 0) 3 3 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z2_6_0Raw (3,4)).Encloses (weight (orderedPairInteger (shape 2 6 0) 3 4) : ℝ) + have he : orderedPairInteger (shape 2 6 0) 3 4 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z2_6_0Raw (3,5)).Encloses (weight (orderedPairInteger (shape 2 6 0) 3 5) : ℝ) + have he : orderedPairInteger (shape 2 6 0) 3 5 = (-36610) := by decide +kernel + rw [he] + exact w49_sound +lemma Z2_6_0Raw_sound_4 (j : Fin 6) : + (Z2_6_0Raw (4,j)).Encloses (weight (orderedPairInteger (shape 2 6 0) 4 j) : ℝ) := by + fin_cases j + · change (Z2_6_0Raw (4,0)).Encloses (weight (orderedPairInteger (shape 2 6 0) 4 0) : ℝ) + have he : orderedPairInteger (shape 2 6 0) 4 0 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z2_6_0Raw (4,1)).Encloses (weight (orderedPairInteger (shape 2 6 0) 4 1) : ℝ) + have he : orderedPairInteger (shape 2 6 0) 4 1 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z2_6_0Raw (4,2)).Encloses (weight (orderedPairInteger (shape 2 6 0) 4 2) : ℝ) + have he : orderedPairInteger (shape 2 6 0) 4 2 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z2_6_0Raw (4,3)).Encloses (weight (orderedPairInteger (shape 2 6 0) 4 3) : ℝ) + have he : orderedPairInteger (shape 2 6 0) 4 3 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z2_6_0Raw (4,4)).Encloses (weight (orderedPairInteger (shape 2 6 0) 4 4) : ℝ) + have he : orderedPairInteger (shape 2 6 0) 4 4 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z2_6_0Raw (4,5)).Encloses (weight (orderedPairInteger (shape 2 6 0) 4 5) : ℝ) + have he : orderedPairInteger (shape 2 6 0) 4 5 = (0) := by decide +kernel + rw [he] + exact w195_sound +lemma Z2_6_0Raw_sound_5 (j : Fin 6) : + (Z2_6_0Raw (5,j)).Encloses (weight (orderedPairInteger (shape 2 6 0) 5 j) : ℝ) := by + fin_cases j + · change (Z2_6_0Raw (5,0)).Encloses (weight (orderedPairInteger (shape 2 6 0) 5 0) : ℝ) + have he : orderedPairInteger (shape 2 6 0) 5 0 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z2_6_0Raw (5,1)).Encloses (weight (orderedPairInteger (shape 2 6 0) 5 1) : ℝ) + have he : orderedPairInteger (shape 2 6 0) 5 1 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z2_6_0Raw (5,2)).Encloses (weight (orderedPairInteger (shape 2 6 0) 5 2) : ℝ) + have he : orderedPairInteger (shape 2 6 0) 5 2 = (-12708) := by decide +kernel + rw [he] + exact w122_sound + · change (Z2_6_0Raw (5,3)).Encloses (weight (orderedPairInteger (shape 2 6 0) 5 3) : ℝ) + have he : orderedPairInteger (shape 2 6 0) 5 3 = (-36610) := by decide +kernel + rw [he] + exact w49_sound + · change (Z2_6_0Raw (5,4)).Encloses (weight (orderedPairInteger (shape 2 6 0) 5 4) : ℝ) + have he : orderedPairInteger (shape 2 6 0) 5 4 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z2_6_0Raw (5,5)).Encloses (weight (orderedPairInteger (shape 2 6 0) 5 5) : ℝ) + have he : orderedPairInteger (shape 2 6 0) 5 5 = (0) := by decide +kernel + rw [he] + exact w195_sound +lemma Z2_6_0Raw_sound (ij : PairSlot) : + (Z2_6_0Raw ij).Encloses (weight (orderedPairInteger (shape 2 6 0) ij.1 ij.2) : ℝ) := by + rcases ij with ⟨i,j⟩ + revert i + exact forall_fin6 (Z2_6_0Raw_sound_0 j) (Z2_6_0Raw_sound_1 j) (Z2_6_0Raw_sound_2 j) (Z2_6_0Raw_sound_3 j) (Z2_6_0Raw_sound_4 j) (Z2_6_0Raw_sound_5 j) +def Z2_6_0Den : Ball := ⟨(40315691969935939784363805731103 / 25000000000000000000000000000000), (9 / 12500000000000000000000000000000)⟩ +lemma Z2_6_0Den_sound : Z2_6_0Den.Encloses + (((orderedPairs (shape 2 6 0)).map (fun ij => weight (orderedPairInteger (shape 2 6 0) ij.1 ij.2))).sum : ℝ) := by + exact contains_sound (list_cast_enclosed (orderedPairs (shape 2 6 0)) Z2_6_0Raw + (fun ij => weight (orderedPairInteger (shape 2 6 0) ij.1 ij.2)) + (fun ij _ => Z2_6_0Raw_sound ij)) (by decide +kernel) +lemma Z2_6_0Den_pos : 0 < Z2_6_0Den.lower := by decide +kernel +def Z2_6_0Probs (ij : PairSlot) : Ball := + match ij.1.val, ij.2.val with + | 2, 5 => ⟨(8700304788653067056094286446733 / 50000000000000000000000000000000), (29 / 100000000000000000000000000000000)⟩ + | 3, 5 => ⟨(1594093504259596830505224830177 / 100000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ + | 4, 4 => ⟨(12402118767373707622922480910543 / 20000000000000000000000000000000), (7 / 25000000000000000000000000000000)⟩ + | 5, 2 => ⟨(8700304788653067056094286446733 / 50000000000000000000000000000000), (29 / 100000000000000000000000000000000)⟩ + | 5, 3 => ⟨(1594093504259596830505224830177 / 100000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ + | _, _ => (.exact 0) +lemma Z2_6_0Contains : ∀ i j : Fin 6, + statisticWeight i + statisticWeight j = shapeMax (shape 2 6 0) → + contains (.mul (Z2_6_0Raw (i,j)) (.inv Z2_6_0Den)) (Z2_6_0Probs (i,j)) = true := by + decide +kernel +lemma Z2_6_0Zero : ∀ i j : Fin 6, + statisticWeight i + statisticWeight j ≠ shapeMax (shape 2 6 0) → Z2_6_0Probs (i,j) = .exact 0 := by + decide +kernel +lemma Z2_6_0Probs_sound (ij : PairSlot) : + (Z2_6_0Probs ij).Encloses (zeroPairLaw (shape 2 6 0) ij.1 ij.2 : ℝ) := by + by_cases h : statisticWeight ij.1 + statisticWeight ij.2 = shapeMax (shape 2 6 0) + · have hb := contains_sound (Ball.mul_sound (Z2_6_0Raw_sound ij) + (Ball.inv_sound Z2_6_0Den_sound Z2_6_0Den_pos)) (Z2_6_0Contains ij.1 ij.2 h) + simpa only [zeroPairLaw, h, ite_true, Rat.cast_div, Rat.cast_mul, + Rat.cast_inv, div_eq_mul_inv] using hb + · rw [Z2_6_0Zero ij.1 ij.2 h] + simpa only [zeroPairLaw, h, ite_false] using Ball.exact_sound 0 + +def Z2_6_0Half (w : Fin 3) (ij : PairSlot) : Ball := + if (shape 2 6 0) w = 0 then if ij = (0,0) then .exact 1 else .exact 0 + else if w = halfMaxAxis (shape 2 6 0) then Z2_6_0Probs ij + else Z2_6_0Probs (kappa ij.1, kappa ij.2) +lemma Z2_6_0Half_sound (w : Fin 3) (ij : PairSlot) : + (Z2_6_0Half w ij).Encloses (halfLaw (shape 2 6 0) w ij : ℝ) := by + have hp : positive (shape 2 6 0) = false := by decide +kernel + simp only [Z2_6_0Half, halfLaw, hp, Bool.false_eq_true, ite_false] + split_ifs + · exact Ball.exact_sound 1 + · exact Ball.exact_sound 0 + · exact Z2_6_0Probs_sound _ + · exact Z2_6_0Probs_sound _ + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def Z2_6_0Value (a : PairSlot) : ℝ := (zeroPairLaw (shape 2 6 0) a.1 a.2 : ℝ) +def Z2_6_0E_2_5LogWitness : LogWitness := ⟨-3, 8700304788653067056094286446733, 6250000000000000000000000000000⟩ +def Z2_6_0E_2_5Log : Ball := ⟨(-87433247360137101787010999920051 / 50000000000000000000000000000000), (42351647449 / 50000000000000000000000000000000)⟩ +lemma Z2_6_0E_2_5Log_sound : Z2_6_0E_2_5Log.Encloses (Real.log (Z2_6_0Value ((2,5) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound (Z2_6_0Probs_sound ((2,5) : PairSlot)) (w := Z2_6_0E_2_5LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z2_6_0E_2_5 : Ball := ⟨(30427836027795558418888937514137 / 100000000000000000000000000000000), (460590303 / 3125000000000000000000000000000)⟩ +lemma Z2_6_0E_2_5_sound : Z2_6_0E_2_5.Encloses (Foundation.entropyTerm (Z2_6_0Value ((2,5) : PairSlot))) := by + exact contains_sound (entropyTerm_ball (Z2_6_0Probs_sound ((2,5) : PairSlot)) Z2_6_0E_2_5Log_sound) (by decide +kernel) +def Z2_6_0E_3_5LogWitness : LogWitness := ⟨-6, 1594093504259596830505224830177, 1562500000000000000000000000000⟩ +def Z2_6_0E_3_5Log : Ball := ⟨(-20694324736013710178701097127681 / 5000000000000000000000000000000), (9264422873 / 6250000000000000000000000000000)⟩ +lemma Z2_6_0E_3_5Log_sound : Z2_6_0E_3_5Log.Encloses (Real.log (Z2_6_0Value ((3,5) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound (Z2_6_0Probs_sound ((3,5) : PairSlot)) (w := Z2_6_0E_3_5LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z2_6_0E_3_5 : Ball := ⟨(1649434431835907568086056539411 / 25000000000000000000000000000000), (94517481 / 4000000000000000000000000000000)⟩ +lemma Z2_6_0E_3_5_sound : Z2_6_0E_3_5.Encloses (Foundation.entropyTerm (Z2_6_0Value ((3,5) : PairSlot))) := by + exact contains_sound (entropyTerm_ball (Z2_6_0Probs_sound ((3,5) : PairSlot)) Z2_6_0E_3_5Log_sound) (by decide +kernel) +def Z2_6_0E_4_4LogWitness : LogWitness := ⟨-1, 12402118767373707622922480910543, 10000000000000000000000000000000⟩ +def Z2_6_0E_4_4Log : Ball := ⟨(-47786494720274203574022038031033 / 100000000000000000000000000000000), (4235164741 / 10000000000000000000000000000000)⟩ +lemma Z2_6_0E_4_4Log_sound : Z2_6_0E_4_4Log.Encloses (Real.log (Z2_6_0Value ((4,4) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound (Z2_6_0Probs_sound ((4,4) : PairSlot)) (w := Z2_6_0E_4_4LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z2_6_0E_4_4 : Ball := ⟨(14816344574932932322026713712577 / 50000000000000000000000000000000), (26262508073 / 100000000000000000000000000000000)⟩ +lemma Z2_6_0E_4_4_sound : Z2_6_0E_4_4.Encloses (Foundation.entropyTerm (Z2_6_0Value ((4,4) : PairSlot))) := by + exact contains_sound (entropyTerm_ball (Z2_6_0Probs_sound ((4,4) : PairSlot)) Z2_6_0E_4_4Log_sound) (by decide +kernel) +def Z2_6_0E_5_2LogWitness : LogWitness := ⟨-3, 8700304788653067056094286446733, 6250000000000000000000000000000⟩ +def Z2_6_0E_5_2Log : Ball := ⟨(-87433247360137101787010999920051 / 50000000000000000000000000000000), (42351647449 / 50000000000000000000000000000000)⟩ +lemma Z2_6_0E_5_2Log_sound : Z2_6_0E_5_2Log.Encloses (Real.log (Z2_6_0Value ((5,2) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound (Z2_6_0Probs_sound ((5,2) : PairSlot)) (w := Z2_6_0E_5_2LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z2_6_0E_5_2 : Ball := ⟨(30427836027795558418888937514137 / 100000000000000000000000000000000), (460590303 / 3125000000000000000000000000000)⟩ +lemma Z2_6_0E_5_2_sound : Z2_6_0E_5_2.Encloses (Foundation.entropyTerm (Z2_6_0Value ((5,2) : PairSlot))) := by + exact contains_sound (entropyTerm_ball (Z2_6_0Probs_sound ((5,2) : PairSlot)) Z2_6_0E_5_2Log_sound) (by decide +kernel) +def Z2_6_0E_5_3LogWitness : LogWitness := ⟨-6, 1594093504259596830505224830177, 1562500000000000000000000000000⟩ +def Z2_6_0E_5_3Log : Ball := ⟨(-20694324736013710178701097127681 / 5000000000000000000000000000000), (9264422873 / 6250000000000000000000000000000)⟩ +lemma Z2_6_0E_5_3Log_sound : Z2_6_0E_5_3Log.Encloses (Real.log (Z2_6_0Value ((5,3) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound (Z2_6_0Probs_sound ((5,3) : PairSlot)) (w := Z2_6_0E_5_3LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z2_6_0E_5_3 : Ball := ⟨(1649434431835907568086056539411 / 25000000000000000000000000000000), (94517481 / 4000000000000000000000000000000)⟩ +lemma Z2_6_0E_5_3_sound : Z2_6_0E_5_3.Encloses (Foundation.entropyTerm (Z2_6_0Value ((5,3) : PairSlot))) := by + exact contains_sound (entropyTerm_ball (Z2_6_0Probs_sound ((5,3) : PairSlot)) Z2_6_0E_5_3Log_sound) (by decide +kernel) +def Z2_6_0Terms (a : PairSlot) : Ball := + match a.1.val, a.2.val with + | 2, 5 => ⟨(30427836027795558418888937514137 / 100000000000000000000000000000000), (460590303 / 3125000000000000000000000000000)⟩ + | 3, 5 => ⟨(1649434431835907568086056539411 / 25000000000000000000000000000000), (94517481 / 4000000000000000000000000000000)⟩ + | 4, 4 => ⟨(14816344574932932322026713712577 / 50000000000000000000000000000000), (26262508073 / 100000000000000000000000000000000)⟩ + | 5, 2 => ⟨(30427836027795558418888937514137 / 100000000000000000000000000000000), (460590303 / 3125000000000000000000000000000)⟩ + | 5, 3 => ⟨(1649434431835907568086056539411 / 25000000000000000000000000000000), (94517481 / 4000000000000000000000000000000)⟩ + | _, _ => (.exact 0) +lemma Z2_6_0Terms_sound (a : PairSlot) : + (Z2_6_0Terms a).Encloses (Foundation.entropyTerm (Z2_6_0Value a)) := by + rcases a with ⟨i,j⟩ + revert j i + apply forall_fin6 + · exact forall_fin6 (entropyTerm_zero_ball (Z2_6_0Probs_sound ((0,0) : PairSlot))) (entropyTerm_zero_ball (Z2_6_0Probs_sound ((0,1) : PairSlot))) (entropyTerm_zero_ball (Z2_6_0Probs_sound ((0,2) : PairSlot))) (entropyTerm_zero_ball (Z2_6_0Probs_sound ((0,3) : PairSlot))) (entropyTerm_zero_ball (Z2_6_0Probs_sound ((0,4) : PairSlot))) (entropyTerm_zero_ball (Z2_6_0Probs_sound ((0,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball (Z2_6_0Probs_sound ((1,0) : PairSlot))) (entropyTerm_zero_ball (Z2_6_0Probs_sound ((1,1) : PairSlot))) (entropyTerm_zero_ball (Z2_6_0Probs_sound ((1,2) : PairSlot))) (entropyTerm_zero_ball (Z2_6_0Probs_sound ((1,3) : PairSlot))) (entropyTerm_zero_ball (Z2_6_0Probs_sound ((1,4) : PairSlot))) (entropyTerm_zero_ball (Z2_6_0Probs_sound ((1,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball (Z2_6_0Probs_sound ((2,0) : PairSlot))) (entropyTerm_zero_ball (Z2_6_0Probs_sound ((2,1) : PairSlot))) (entropyTerm_zero_ball (Z2_6_0Probs_sound ((2,2) : PairSlot))) (entropyTerm_zero_ball (Z2_6_0Probs_sound ((2,3) : PairSlot))) (entropyTerm_zero_ball (Z2_6_0Probs_sound ((2,4) : PairSlot))) Z2_6_0E_2_5_sound + · exact forall_fin6 (entropyTerm_zero_ball (Z2_6_0Probs_sound ((3,0) : PairSlot))) (entropyTerm_zero_ball (Z2_6_0Probs_sound ((3,1) : PairSlot))) (entropyTerm_zero_ball (Z2_6_0Probs_sound ((3,2) : PairSlot))) (entropyTerm_zero_ball (Z2_6_0Probs_sound ((3,3) : PairSlot))) (entropyTerm_zero_ball (Z2_6_0Probs_sound ((3,4) : PairSlot))) Z2_6_0E_3_5_sound + · exact forall_fin6 (entropyTerm_zero_ball (Z2_6_0Probs_sound ((4,0) : PairSlot))) (entropyTerm_zero_ball (Z2_6_0Probs_sound ((4,1) : PairSlot))) (entropyTerm_zero_ball (Z2_6_0Probs_sound ((4,2) : PairSlot))) (entropyTerm_zero_ball (Z2_6_0Probs_sound ((4,3) : PairSlot))) Z2_6_0E_4_4_sound (entropyTerm_zero_ball (Z2_6_0Probs_sound ((4,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball (Z2_6_0Probs_sound ((5,0) : PairSlot))) (entropyTerm_zero_ball (Z2_6_0Probs_sound ((5,1) : PairSlot))) Z2_6_0E_5_2_sound Z2_6_0E_5_3_sound (entropyTerm_zero_ball (Z2_6_0Probs_sound ((5,4) : PairSlot))) (entropyTerm_zero_ball (Z2_6_0Probs_sound ((5,5) : PairSlot))) +def Z2_6_0Entropy : Ball := ⟨(25920959165036060506629938692179 / 25000000000000000000000000000000), (12093232303 / 20000000000000000000000000000000)⟩ +lemma Z2_6_0Entropy_sound : Z2_6_0Entropy.Encloses (Foundation.finiteEntropy Z2_6_0Value) := by + exact contains_sound (entropyPair_enclosed Z2_6_0Value Z2_6_0Terms Z2_6_0Terms_sound) (by decide +kernel) +def Z2_6_0Labels : Ball := ⟨(99950005950434599058581087087857 / 25000000000000000000000000000000), (130116252187 / 100000000000000000000000000000000)⟩ +lemma Z2_6_0Labels_sound : Z2_6_0Labels.Encloses + (∑ a : PairSlot, (zeroPairLaw (shape 2 6 0) a.1 a.2 : ℝ) * + Real.log (AllFieldParameters.multiplicity a.1 * AllFieldParameters.multiplicity a.2 : ℕ)) := by + exact contains_sound (pairSumBall_sound (fun a => .mul (Z2_6_0Probs a) (multLogs a)) + _ (fun a => Ball.mul_sound (Z2_6_0Probs_sound a) (multLogs_sound a))) (by decide +kernel) +def Z2_6_0Four : Ball := ⟨(31467741278867664891302756445009 / 6250000000000000000000000000000), (95291206851 / 50000000000000000000000000000000)⟩ +lemma Z2_6_0Four_sound : Z2_6_0Four.Encloses (AllFieldZeroLeafRates.fourRate (shape 2 6 0)) := by + exact contains_sound (Ball.add_sound Z2_6_0Entropy_sound Z2_6_0Labels_sound) (by decide +kernel) +def Z2_6_0H0Value (a : PairSlot) : ℝ := (halfLaw (shape 2 6 0) 0 a : ℝ) +def Z2_6_0H0E_2_0LogWitness : LogWitness := ⟨-3, 8700304788653067056094286446733, 6250000000000000000000000000000⟩ +def Z2_6_0H0E_2_0Log : Ball := ⟨(-87433247360137101787010999920051 / 50000000000000000000000000000000), (42351647449 / 50000000000000000000000000000000)⟩ +lemma Z2_6_0H0E_2_0Log_sound : Z2_6_0H0E_2_0Log.Encloses (Real.log (Z2_6_0H0Value ((2,0) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound ((Z2_6_0Half_sound 0) ((2,0) : PairSlot)) (w := Z2_6_0H0E_2_0LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z2_6_0H0E_2_0 : Ball := ⟨(30427836027795558418888937514137 / 100000000000000000000000000000000), (460590303 / 3125000000000000000000000000000)⟩ +lemma Z2_6_0H0E_2_0_sound : Z2_6_0H0E_2_0.Encloses (Foundation.entropyTerm (Z2_6_0H0Value ((2,0) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z2_6_0Half_sound 0) ((2,0) : PairSlot)) Z2_6_0H0E_2_0Log_sound) (by decide +kernel) +def Z2_6_0H0E_3_0LogWitness : LogWitness := ⟨-6, 1594093504259596830505224830177, 1562500000000000000000000000000⟩ +def Z2_6_0H0E_3_0Log : Ball := ⟨(-20694324736013710178701097127681 / 5000000000000000000000000000000), (9264422873 / 6250000000000000000000000000000)⟩ +lemma Z2_6_0H0E_3_0Log_sound : Z2_6_0H0E_3_0Log.Encloses (Real.log (Z2_6_0H0Value ((3,0) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound ((Z2_6_0Half_sound 0) ((3,0) : PairSlot)) (w := Z2_6_0H0E_3_0LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z2_6_0H0E_3_0 : Ball := ⟨(1649434431835907568086056539411 / 25000000000000000000000000000000), (94517481 / 4000000000000000000000000000000)⟩ +lemma Z2_6_0H0E_3_0_sound : Z2_6_0H0E_3_0.Encloses (Foundation.entropyTerm (Z2_6_0H0Value ((3,0) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z2_6_0Half_sound 0) ((3,0) : PairSlot)) Z2_6_0H0E_3_0Log_sound) (by decide +kernel) +def Z2_6_0H0E_1_1LogWitness : LogWitness := ⟨-1, 12402118767373707622922480910543, 10000000000000000000000000000000⟩ +def Z2_6_0H0E_1_1Log : Ball := ⟨(-47786494720274203574022038031033 / 100000000000000000000000000000000), (4235164741 / 10000000000000000000000000000000)⟩ +lemma Z2_6_0H0E_1_1Log_sound : Z2_6_0H0E_1_1Log.Encloses (Real.log (Z2_6_0H0Value ((1,1) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound ((Z2_6_0Half_sound 0) ((1,1) : PairSlot)) (w := Z2_6_0H0E_1_1LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z2_6_0H0E_1_1 : Ball := ⟨(14816344574932932322026713712577 / 50000000000000000000000000000000), (26262508073 / 100000000000000000000000000000000)⟩ +lemma Z2_6_0H0E_1_1_sound : Z2_6_0H0E_1_1.Encloses (Foundation.entropyTerm (Z2_6_0H0Value ((1,1) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z2_6_0Half_sound 0) ((1,1) : PairSlot)) Z2_6_0H0E_1_1Log_sound) (by decide +kernel) +def Z2_6_0H0E_0_2LogWitness : LogWitness := ⟨-3, 8700304788653067056094286446733, 6250000000000000000000000000000⟩ +def Z2_6_0H0E_0_2Log : Ball := ⟨(-87433247360137101787010999920051 / 50000000000000000000000000000000), (42351647449 / 50000000000000000000000000000000)⟩ +lemma Z2_6_0H0E_0_2Log_sound : Z2_6_0H0E_0_2Log.Encloses (Real.log (Z2_6_0H0Value ((0,2) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound ((Z2_6_0Half_sound 0) ((0,2) : PairSlot)) (w := Z2_6_0H0E_0_2LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z2_6_0H0E_0_2 : Ball := ⟨(30427836027795558418888937514137 / 100000000000000000000000000000000), (460590303 / 3125000000000000000000000000000)⟩ +lemma Z2_6_0H0E_0_2_sound : Z2_6_0H0E_0_2.Encloses (Foundation.entropyTerm (Z2_6_0H0Value ((0,2) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z2_6_0Half_sound 0) ((0,2) : PairSlot)) Z2_6_0H0E_0_2Log_sound) (by decide +kernel) +def Z2_6_0H0E_0_3LogWitness : LogWitness := ⟨-6, 1594093504259596830505224830177, 1562500000000000000000000000000⟩ +def Z2_6_0H0E_0_3Log : Ball := ⟨(-20694324736013710178701097127681 / 5000000000000000000000000000000), (9264422873 / 6250000000000000000000000000000)⟩ +lemma Z2_6_0H0E_0_3Log_sound : Z2_6_0H0E_0_3Log.Encloses (Real.log (Z2_6_0H0Value ((0,3) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound ((Z2_6_0Half_sound 0) ((0,3) : PairSlot)) (w := Z2_6_0H0E_0_3LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z2_6_0H0E_0_3 : Ball := ⟨(1649434431835907568086056539411 / 25000000000000000000000000000000), (94517481 / 4000000000000000000000000000000)⟩ +lemma Z2_6_0H0E_0_3_sound : Z2_6_0H0E_0_3.Encloses (Foundation.entropyTerm (Z2_6_0H0Value ((0,3) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z2_6_0Half_sound 0) ((0,3) : PairSlot)) Z2_6_0H0E_0_3Log_sound) (by decide +kernel) +def Z2_6_0H0Terms (a : PairSlot) : Ball := + match a.1.val, a.2.val with + | 2, 0 => ⟨(30427836027795558418888937514137 / 100000000000000000000000000000000), (460590303 / 3125000000000000000000000000000)⟩ + | 3, 0 => ⟨(1649434431835907568086056539411 / 25000000000000000000000000000000), (94517481 / 4000000000000000000000000000000)⟩ + | 1, 1 => ⟨(14816344574932932322026713712577 / 50000000000000000000000000000000), (26262508073 / 100000000000000000000000000000000)⟩ + | 0, 2 => ⟨(30427836027795558418888937514137 / 100000000000000000000000000000000), (460590303 / 3125000000000000000000000000000)⟩ + | 0, 3 => ⟨(1649434431835907568086056539411 / 25000000000000000000000000000000), (94517481 / 4000000000000000000000000000000)⟩ + | _, _ => (.exact 0) +lemma Z2_6_0H0Terms_sound (a : PairSlot) : + (Z2_6_0H0Terms a).Encloses (Foundation.entropyTerm (Z2_6_0H0Value a)) := by + rcases a with ⟨i,j⟩ + revert j i + apply forall_fin6 + · exact forall_fin6 (entropyTerm_zero_ball ((Z2_6_0Half_sound 0) ((0,0) : PairSlot))) (entropyTerm_zero_ball ((Z2_6_0Half_sound 0) ((0,1) : PairSlot))) Z2_6_0H0E_0_2_sound Z2_6_0H0E_0_3_sound (entropyTerm_zero_ball ((Z2_6_0Half_sound 0) ((0,4) : PairSlot))) (entropyTerm_zero_ball ((Z2_6_0Half_sound 0) ((0,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z2_6_0Half_sound 0) ((1,0) : PairSlot))) Z2_6_0H0E_1_1_sound (entropyTerm_zero_ball ((Z2_6_0Half_sound 0) ((1,2) : PairSlot))) (entropyTerm_zero_ball ((Z2_6_0Half_sound 0) ((1,3) : PairSlot))) (entropyTerm_zero_ball ((Z2_6_0Half_sound 0) ((1,4) : PairSlot))) (entropyTerm_zero_ball ((Z2_6_0Half_sound 0) ((1,5) : PairSlot))) + · exact forall_fin6 Z2_6_0H0E_2_0_sound (entropyTerm_zero_ball ((Z2_6_0Half_sound 0) ((2,1) : PairSlot))) (entropyTerm_zero_ball ((Z2_6_0Half_sound 0) ((2,2) : PairSlot))) (entropyTerm_zero_ball ((Z2_6_0Half_sound 0) ((2,3) : PairSlot))) (entropyTerm_zero_ball ((Z2_6_0Half_sound 0) ((2,4) : PairSlot))) (entropyTerm_zero_ball ((Z2_6_0Half_sound 0) ((2,5) : PairSlot))) + · exact forall_fin6 Z2_6_0H0E_3_0_sound (entropyTerm_zero_ball ((Z2_6_0Half_sound 0) ((3,1) : PairSlot))) (entropyTerm_zero_ball ((Z2_6_0Half_sound 0) ((3,2) : PairSlot))) (entropyTerm_zero_ball ((Z2_6_0Half_sound 0) ((3,3) : PairSlot))) (entropyTerm_zero_ball ((Z2_6_0Half_sound 0) ((3,4) : PairSlot))) (entropyTerm_zero_ball ((Z2_6_0Half_sound 0) ((3,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z2_6_0Half_sound 0) ((4,0) : PairSlot))) (entropyTerm_zero_ball ((Z2_6_0Half_sound 0) ((4,1) : PairSlot))) (entropyTerm_zero_ball ((Z2_6_0Half_sound 0) ((4,2) : PairSlot))) (entropyTerm_zero_ball ((Z2_6_0Half_sound 0) ((4,3) : PairSlot))) (entropyTerm_zero_ball ((Z2_6_0Half_sound 0) ((4,4) : PairSlot))) (entropyTerm_zero_ball ((Z2_6_0Half_sound 0) ((4,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z2_6_0Half_sound 0) ((5,0) : PairSlot))) (entropyTerm_zero_ball ((Z2_6_0Half_sound 0) ((5,1) : PairSlot))) (entropyTerm_zero_ball ((Z2_6_0Half_sound 0) ((5,2) : PairSlot))) (entropyTerm_zero_ball ((Z2_6_0Half_sound 0) ((5,3) : PairSlot))) (entropyTerm_zero_ball ((Z2_6_0Half_sound 0) ((5,4) : PairSlot))) (entropyTerm_zero_ball ((Z2_6_0Half_sound 0) ((5,5) : PairSlot))) +def Z2_6_0H0Entropy : Ball := ⟨(25920959165036060506629938692179 / 25000000000000000000000000000000), (12093232303 / 20000000000000000000000000000000)⟩ +lemma Z2_6_0H0Entropy_sound : Z2_6_0H0Entropy.Encloses (Foundation.finiteEntropy Z2_6_0H0Value) := by + exact contains_sound (entropyPair_enclosed Z2_6_0H0Value Z2_6_0H0Terms Z2_6_0H0Terms_sound) (by decide +kernel) +def Z2_6_0H0Mass : Ball := ⟨(100000000000000000000000000000001 / 100000000000000000000000000000000), (23 / 25000000000000000000000000000000)⟩ +lemma Z2_6_0H0Mass_sound : Z2_6_0H0Mass.Encloses (∑ a, Z2_6_0H0Value a) := by + exact contains_sound (pairSumBall_sound (Z2_6_0Half 0) Z2_6_0H0Value (Z2_6_0Half_sound 0)) (by decide +kernel) +def Z2_6_0H0MassTermLogWitness : LogWitness := ⟨0, 100000000000000000000000000000001, 100000000000000000000000000000000⟩ +def Z2_6_0H0MassTermLog : Ball := ⟨(1 / 100000000000000000000000000000000), (10587911887 / 50000000000000000000000000000000)⟩ +lemma Z2_6_0H0MassTermLog_sound : Z2_6_0H0MassTermLog.Encloses (Real.log ((∑ a, Z2_6_0H0Value a))) := by + exact checkLog_sound logTwoBall_sound (Z2_6_0H0Mass_sound) (w := Z2_6_0H0MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z2_6_0H0MassTerm : Ball := ⟨(-1 / 100000000000000000000000000000000), (847032951 / 4000000000000000000000000000000)⟩ +lemma Z2_6_0H0MassTerm_sound : Z2_6_0H0MassTerm.Encloses (Foundation.entropyTerm ((∑ a, Z2_6_0H0Value a))) := by + exact contains_sound (entropyTerm_ball (Z2_6_0H0Mass_sound) Z2_6_0H0MassTermLog_sound) (by decide +kernel) +def Z2_6_0H0H : Ball := ⟨(103683836660144242026519754768717 / 100000000000000000000000000000000), (8164198529 / 10000000000000000000000000000000)⟩ +lemma Z2_6_0H0H_sound : Z2_6_0H0H.Encloses (homogeneousEntropy Z2_6_0H0Value) := by + exact contains_sound (homogeneous_enclosed Z2_6_0H0Value Z2_6_0H0MassTerm_sound Z2_6_0H0Entropy_sound) (by decide +kernel) +def Z2_6_0H1Value (a : PairSlot) : ℝ := (halfLaw (shape 2 6 0) 1 a : ℝ) +def Z2_6_0H1E_2_5LogWitness : LogWitness := ⟨-3, 8700304788653067056094286446733, 6250000000000000000000000000000⟩ +def Z2_6_0H1E_2_5Log : Ball := ⟨(-87433247360137101787010999920051 / 50000000000000000000000000000000), (42351647449 / 50000000000000000000000000000000)⟩ +lemma Z2_6_0H1E_2_5Log_sound : Z2_6_0H1E_2_5Log.Encloses (Real.log (Z2_6_0H1Value ((2,5) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound ((Z2_6_0Half_sound 1) ((2,5) : PairSlot)) (w := Z2_6_0H1E_2_5LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z2_6_0H1E_2_5 : Ball := ⟨(30427836027795558418888937514137 / 100000000000000000000000000000000), (460590303 / 3125000000000000000000000000000)⟩ +lemma Z2_6_0H1E_2_5_sound : Z2_6_0H1E_2_5.Encloses (Foundation.entropyTerm (Z2_6_0H1Value ((2,5) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z2_6_0Half_sound 1) ((2,5) : PairSlot)) Z2_6_0H1E_2_5Log_sound) (by decide +kernel) +def Z2_6_0H1E_3_5LogWitness : LogWitness := ⟨-6, 1594093504259596830505224830177, 1562500000000000000000000000000⟩ +def Z2_6_0H1E_3_5Log : Ball := ⟨(-20694324736013710178701097127681 / 5000000000000000000000000000000), (9264422873 / 6250000000000000000000000000000)⟩ +lemma Z2_6_0H1E_3_5Log_sound : Z2_6_0H1E_3_5Log.Encloses (Real.log (Z2_6_0H1Value ((3,5) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound ((Z2_6_0Half_sound 1) ((3,5) : PairSlot)) (w := Z2_6_0H1E_3_5LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z2_6_0H1E_3_5 : Ball := ⟨(1649434431835907568086056539411 / 25000000000000000000000000000000), (94517481 / 4000000000000000000000000000000)⟩ +lemma Z2_6_0H1E_3_5_sound : Z2_6_0H1E_3_5.Encloses (Foundation.entropyTerm (Z2_6_0H1Value ((3,5) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z2_6_0Half_sound 1) ((3,5) : PairSlot)) Z2_6_0H1E_3_5Log_sound) (by decide +kernel) +def Z2_6_0H1E_4_4LogWitness : LogWitness := ⟨-1, 12402118767373707622922480910543, 10000000000000000000000000000000⟩ +def Z2_6_0H1E_4_4Log : Ball := ⟨(-47786494720274203574022038031033 / 100000000000000000000000000000000), (4235164741 / 10000000000000000000000000000000)⟩ +lemma Z2_6_0H1E_4_4Log_sound : Z2_6_0H1E_4_4Log.Encloses (Real.log (Z2_6_0H1Value ((4,4) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound ((Z2_6_0Half_sound 1) ((4,4) : PairSlot)) (w := Z2_6_0H1E_4_4LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z2_6_0H1E_4_4 : Ball := ⟨(14816344574932932322026713712577 / 50000000000000000000000000000000), (26262508073 / 100000000000000000000000000000000)⟩ +lemma Z2_6_0H1E_4_4_sound : Z2_6_0H1E_4_4.Encloses (Foundation.entropyTerm (Z2_6_0H1Value ((4,4) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z2_6_0Half_sound 1) ((4,4) : PairSlot)) Z2_6_0H1E_4_4Log_sound) (by decide +kernel) +def Z2_6_0H1E_5_2LogWitness : LogWitness := ⟨-3, 8700304788653067056094286446733, 6250000000000000000000000000000⟩ +def Z2_6_0H1E_5_2Log : Ball := ⟨(-87433247360137101787010999920051 / 50000000000000000000000000000000), (42351647449 / 50000000000000000000000000000000)⟩ +lemma Z2_6_0H1E_5_2Log_sound : Z2_6_0H1E_5_2Log.Encloses (Real.log (Z2_6_0H1Value ((5,2) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound ((Z2_6_0Half_sound 1) ((5,2) : PairSlot)) (w := Z2_6_0H1E_5_2LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z2_6_0H1E_5_2 : Ball := ⟨(30427836027795558418888937514137 / 100000000000000000000000000000000), (460590303 / 3125000000000000000000000000000)⟩ +lemma Z2_6_0H1E_5_2_sound : Z2_6_0H1E_5_2.Encloses (Foundation.entropyTerm (Z2_6_0H1Value ((5,2) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z2_6_0Half_sound 1) ((5,2) : PairSlot)) Z2_6_0H1E_5_2Log_sound) (by decide +kernel) +def Z2_6_0H1E_5_3LogWitness : LogWitness := ⟨-6, 1594093504259596830505224830177, 1562500000000000000000000000000⟩ +def Z2_6_0H1E_5_3Log : Ball := ⟨(-20694324736013710178701097127681 / 5000000000000000000000000000000), (9264422873 / 6250000000000000000000000000000)⟩ +lemma Z2_6_0H1E_5_3Log_sound : Z2_6_0H1E_5_3Log.Encloses (Real.log (Z2_6_0H1Value ((5,3) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound ((Z2_6_0Half_sound 1) ((5,3) : PairSlot)) (w := Z2_6_0H1E_5_3LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z2_6_0H1E_5_3 : Ball := ⟨(1649434431835907568086056539411 / 25000000000000000000000000000000), (94517481 / 4000000000000000000000000000000)⟩ +lemma Z2_6_0H1E_5_3_sound : Z2_6_0H1E_5_3.Encloses (Foundation.entropyTerm (Z2_6_0H1Value ((5,3) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z2_6_0Half_sound 1) ((5,3) : PairSlot)) Z2_6_0H1E_5_3Log_sound) (by decide +kernel) +def Z2_6_0H1Terms (a : PairSlot) : Ball := + match a.1.val, a.2.val with + | 2, 5 => ⟨(30427836027795558418888937514137 / 100000000000000000000000000000000), (460590303 / 3125000000000000000000000000000)⟩ + | 3, 5 => ⟨(1649434431835907568086056539411 / 25000000000000000000000000000000), (94517481 / 4000000000000000000000000000000)⟩ + | 4, 4 => ⟨(14816344574932932322026713712577 / 50000000000000000000000000000000), (26262508073 / 100000000000000000000000000000000)⟩ + | 5, 2 => ⟨(30427836027795558418888937514137 / 100000000000000000000000000000000), (460590303 / 3125000000000000000000000000000)⟩ + | 5, 3 => ⟨(1649434431835907568086056539411 / 25000000000000000000000000000000), (94517481 / 4000000000000000000000000000000)⟩ + | _, _ => (.exact 0) +lemma Z2_6_0H1Terms_sound (a : PairSlot) : + (Z2_6_0H1Terms a).Encloses (Foundation.entropyTerm (Z2_6_0H1Value a)) := by + rcases a with ⟨i,j⟩ + revert j i + apply forall_fin6 + · exact forall_fin6 (entropyTerm_zero_ball ((Z2_6_0Half_sound 1) ((0,0) : PairSlot))) (entropyTerm_zero_ball ((Z2_6_0Half_sound 1) ((0,1) : PairSlot))) (entropyTerm_zero_ball ((Z2_6_0Half_sound 1) ((0,2) : PairSlot))) (entropyTerm_zero_ball ((Z2_6_0Half_sound 1) ((0,3) : PairSlot))) (entropyTerm_zero_ball ((Z2_6_0Half_sound 1) ((0,4) : PairSlot))) (entropyTerm_zero_ball ((Z2_6_0Half_sound 1) ((0,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z2_6_0Half_sound 1) ((1,0) : PairSlot))) (entropyTerm_zero_ball ((Z2_6_0Half_sound 1) ((1,1) : PairSlot))) (entropyTerm_zero_ball ((Z2_6_0Half_sound 1) ((1,2) : PairSlot))) (entropyTerm_zero_ball ((Z2_6_0Half_sound 1) ((1,3) : PairSlot))) (entropyTerm_zero_ball ((Z2_6_0Half_sound 1) ((1,4) : PairSlot))) (entropyTerm_zero_ball ((Z2_6_0Half_sound 1) ((1,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z2_6_0Half_sound 1) ((2,0) : PairSlot))) (entropyTerm_zero_ball ((Z2_6_0Half_sound 1) ((2,1) : PairSlot))) (entropyTerm_zero_ball ((Z2_6_0Half_sound 1) ((2,2) : PairSlot))) (entropyTerm_zero_ball ((Z2_6_0Half_sound 1) ((2,3) : PairSlot))) (entropyTerm_zero_ball ((Z2_6_0Half_sound 1) ((2,4) : PairSlot))) Z2_6_0H1E_2_5_sound + · exact forall_fin6 (entropyTerm_zero_ball ((Z2_6_0Half_sound 1) ((3,0) : PairSlot))) (entropyTerm_zero_ball ((Z2_6_0Half_sound 1) ((3,1) : PairSlot))) (entropyTerm_zero_ball ((Z2_6_0Half_sound 1) ((3,2) : PairSlot))) (entropyTerm_zero_ball ((Z2_6_0Half_sound 1) ((3,3) : PairSlot))) (entropyTerm_zero_ball ((Z2_6_0Half_sound 1) ((3,4) : PairSlot))) Z2_6_0H1E_3_5_sound + · exact forall_fin6 (entropyTerm_zero_ball ((Z2_6_0Half_sound 1) ((4,0) : PairSlot))) (entropyTerm_zero_ball ((Z2_6_0Half_sound 1) ((4,1) : PairSlot))) (entropyTerm_zero_ball ((Z2_6_0Half_sound 1) ((4,2) : PairSlot))) (entropyTerm_zero_ball ((Z2_6_0Half_sound 1) ((4,3) : PairSlot))) Z2_6_0H1E_4_4_sound (entropyTerm_zero_ball ((Z2_6_0Half_sound 1) ((4,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z2_6_0Half_sound 1) ((5,0) : PairSlot))) (entropyTerm_zero_ball ((Z2_6_0Half_sound 1) ((5,1) : PairSlot))) Z2_6_0H1E_5_2_sound Z2_6_0H1E_5_3_sound (entropyTerm_zero_ball ((Z2_6_0Half_sound 1) ((5,4) : PairSlot))) (entropyTerm_zero_ball ((Z2_6_0Half_sound 1) ((5,5) : PairSlot))) +def Z2_6_0H1Entropy : Ball := ⟨(25920959165036060506629938692179 / 25000000000000000000000000000000), (12093232303 / 20000000000000000000000000000000)⟩ +lemma Z2_6_0H1Entropy_sound : Z2_6_0H1Entropy.Encloses (Foundation.finiteEntropy Z2_6_0H1Value) := by + exact contains_sound (entropyPair_enclosed Z2_6_0H1Value Z2_6_0H1Terms Z2_6_0H1Terms_sound) (by decide +kernel) +def Z2_6_0H1Mass : Ball := ⟨(100000000000000000000000000000001 / 100000000000000000000000000000000), (23 / 25000000000000000000000000000000)⟩ +lemma Z2_6_0H1Mass_sound : Z2_6_0H1Mass.Encloses (∑ a, Z2_6_0H1Value a) := by + exact contains_sound (pairSumBall_sound (Z2_6_0Half 1) Z2_6_0H1Value (Z2_6_0Half_sound 1)) (by decide +kernel) +def Z2_6_0H1MassTermLogWitness : LogWitness := ⟨0, 100000000000000000000000000000001, 100000000000000000000000000000000⟩ +def Z2_6_0H1MassTermLog : Ball := ⟨(1 / 100000000000000000000000000000000), (10587911887 / 50000000000000000000000000000000)⟩ +lemma Z2_6_0H1MassTermLog_sound : Z2_6_0H1MassTermLog.Encloses (Real.log ((∑ a, Z2_6_0H1Value a))) := by + exact checkLog_sound logTwoBall_sound (Z2_6_0H1Mass_sound) (w := Z2_6_0H1MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z2_6_0H1MassTerm : Ball := ⟨(-1 / 100000000000000000000000000000000), (847032951 / 4000000000000000000000000000000)⟩ +lemma Z2_6_0H1MassTerm_sound : Z2_6_0H1MassTerm.Encloses (Foundation.entropyTerm ((∑ a, Z2_6_0H1Value a))) := by + exact contains_sound (entropyTerm_ball (Z2_6_0H1Mass_sound) Z2_6_0H1MassTermLog_sound) (by decide +kernel) +def Z2_6_0H1H : Ball := ⟨(103683836660144242026519754768717 / 100000000000000000000000000000000), (8164198529 / 10000000000000000000000000000000)⟩ +lemma Z2_6_0H1H_sound : Z2_6_0H1H.Encloses (homogeneousEntropy Z2_6_0H1Value) := by + exact contains_sound (homogeneous_enclosed Z2_6_0H1Value Z2_6_0H1MassTerm_sound Z2_6_0H1Entropy_sound) (by decide +kernel) +def Z2_6_0H2Value (a : PairSlot) : ℝ := (halfLaw (shape 2 6 0) 2 a : ℝ) +def Z2_6_0H2E_0_0Log : Ball := .exact 0 +lemma Z2_6_0H2E_0_0Log_sound : Z2_6_0H2E_0_0Log.Encloses (Real.log (Z2_6_0H2Value ((0,0) : PairSlot))) := by + exact log_exact_one_ball ((Z2_6_0Half_sound 2) ((0,0) : PairSlot)) +def Z2_6_0H2E_0_0 : Ball := ⟨0, 0⟩ +lemma Z2_6_0H2E_0_0_sound : Z2_6_0H2E_0_0.Encloses (Foundation.entropyTerm (Z2_6_0H2Value ((0,0) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z2_6_0Half_sound 2) ((0,0) : PairSlot)) Z2_6_0H2E_0_0Log_sound) (by decide +kernel) +def Z2_6_0H2Terms (a : PairSlot) : Ball := + match a.1.val, a.2.val with + | 0, 0 => ⟨0, 0⟩ + | _, _ => (.exact 0) +lemma Z2_6_0H2Terms_sound (a : PairSlot) : + (Z2_6_0H2Terms a).Encloses (Foundation.entropyTerm (Z2_6_0H2Value a)) := by + rcases a with ⟨i,j⟩ + revert j i + apply forall_fin6 + · exact forall_fin6 Z2_6_0H2E_0_0_sound (entropyTerm_zero_ball ((Z2_6_0Half_sound 2) ((0,1) : PairSlot))) (entropyTerm_zero_ball ((Z2_6_0Half_sound 2) ((0,2) : PairSlot))) (entropyTerm_zero_ball ((Z2_6_0Half_sound 2) ((0,3) : PairSlot))) (entropyTerm_zero_ball ((Z2_6_0Half_sound 2) ((0,4) : PairSlot))) (entropyTerm_zero_ball ((Z2_6_0Half_sound 2) ((0,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z2_6_0Half_sound 2) ((1,0) : PairSlot))) (entropyTerm_zero_ball ((Z2_6_0Half_sound 2) ((1,1) : PairSlot))) (entropyTerm_zero_ball ((Z2_6_0Half_sound 2) ((1,2) : PairSlot))) (entropyTerm_zero_ball ((Z2_6_0Half_sound 2) ((1,3) : PairSlot))) (entropyTerm_zero_ball ((Z2_6_0Half_sound 2) ((1,4) : PairSlot))) (entropyTerm_zero_ball ((Z2_6_0Half_sound 2) ((1,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z2_6_0Half_sound 2) ((2,0) : PairSlot))) (entropyTerm_zero_ball ((Z2_6_0Half_sound 2) ((2,1) : PairSlot))) (entropyTerm_zero_ball ((Z2_6_0Half_sound 2) ((2,2) : PairSlot))) (entropyTerm_zero_ball ((Z2_6_0Half_sound 2) ((2,3) : PairSlot))) (entropyTerm_zero_ball ((Z2_6_0Half_sound 2) ((2,4) : PairSlot))) (entropyTerm_zero_ball ((Z2_6_0Half_sound 2) ((2,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z2_6_0Half_sound 2) ((3,0) : PairSlot))) (entropyTerm_zero_ball ((Z2_6_0Half_sound 2) ((3,1) : PairSlot))) (entropyTerm_zero_ball ((Z2_6_0Half_sound 2) ((3,2) : PairSlot))) (entropyTerm_zero_ball ((Z2_6_0Half_sound 2) ((3,3) : PairSlot))) (entropyTerm_zero_ball ((Z2_6_0Half_sound 2) ((3,4) : PairSlot))) (entropyTerm_zero_ball ((Z2_6_0Half_sound 2) ((3,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z2_6_0Half_sound 2) ((4,0) : PairSlot))) (entropyTerm_zero_ball ((Z2_6_0Half_sound 2) ((4,1) : PairSlot))) (entropyTerm_zero_ball ((Z2_6_0Half_sound 2) ((4,2) : PairSlot))) (entropyTerm_zero_ball ((Z2_6_0Half_sound 2) ((4,3) : PairSlot))) (entropyTerm_zero_ball ((Z2_6_0Half_sound 2) ((4,4) : PairSlot))) (entropyTerm_zero_ball ((Z2_6_0Half_sound 2) ((4,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z2_6_0Half_sound 2) ((5,0) : PairSlot))) (entropyTerm_zero_ball ((Z2_6_0Half_sound 2) ((5,1) : PairSlot))) (entropyTerm_zero_ball ((Z2_6_0Half_sound 2) ((5,2) : PairSlot))) (entropyTerm_zero_ball ((Z2_6_0Half_sound 2) ((5,3) : PairSlot))) (entropyTerm_zero_ball ((Z2_6_0Half_sound 2) ((5,4) : PairSlot))) (entropyTerm_zero_ball ((Z2_6_0Half_sound 2) ((5,5) : PairSlot))) +def Z2_6_0H2Entropy : Ball := ⟨0, 0⟩ +lemma Z2_6_0H2Entropy_sound : Z2_6_0H2Entropy.Encloses (Foundation.finiteEntropy Z2_6_0H2Value) := by + exact contains_sound (entropyPair_enclosed Z2_6_0H2Value Z2_6_0H2Terms Z2_6_0H2Terms_sound) (by decide +kernel) +def Z2_6_0H2Mass : Ball := ⟨1, 0⟩ +lemma Z2_6_0H2Mass_sound : Z2_6_0H2Mass.Encloses (∑ a, Z2_6_0H2Value a) := by + exact contains_sound (pairSumBall_sound (Z2_6_0Half 2) Z2_6_0H2Value (Z2_6_0Half_sound 2)) (by decide +kernel) +def Z2_6_0H2MassTermLog : Ball := .exact 0 +lemma Z2_6_0H2MassTermLog_sound : Z2_6_0H2MassTermLog.Encloses (Real.log ((∑ a, Z2_6_0H2Value a))) := by + exact log_exact_one_ball (Z2_6_0H2Mass_sound) +def Z2_6_0H2MassTerm : Ball := ⟨0, 0⟩ +lemma Z2_6_0H2MassTerm_sound : Z2_6_0H2MassTerm.Encloses (Foundation.entropyTerm ((∑ a, Z2_6_0H2Value a))) := by + exact contains_sound (entropyTerm_ball (Z2_6_0H2Mass_sound) Z2_6_0H2MassTermLog_sound) (by decide +kernel) +def Z2_6_0H2H : Ball := ⟨0, 0⟩ +lemma Z2_6_0H2H_sound : Z2_6_0H2H.Encloses (homogeneousEntropy Z2_6_0H2Value) := by + exact contains_sound (homogeneous_enclosed Z2_6_0H2Value Z2_6_0H2MassTerm_sound Z2_6_0H2Entropy_sound) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/Certificates/Four3_0_5.lean b/lean/OAI/LinearAlgebra/MatrixFields/Certificates/Four3_0_5.lean new file mode 100644 index 0000000000000000000000000000000000000000..f9f24c7dcc9ed59301d1b1881b21bc8a617e313e --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/Certificates/Four3_0_5.lean @@ -0,0 +1,604 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Certificates.Four0_3_5 + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def Z3_0_5Raw (ij : PairSlot) : Ball := + match ij.1.val, ij.2.val with + | 0, 0 => w195 + | 0, 1 => w195 + | 0, 2 => w195 + | 0, 3 => w195 + | 0, 4 => w195 + | 0, 5 => w195 + | 1, 0 => w195 + | 1, 1 => w195 + | 1, 2 => w195 + | 1, 3 => w195 + | 1, 4 => w195 + | 1, 5 => w189 + | 2, 0 => w195 + | 2, 1 => w195 + | 2, 2 => w195 + | 2, 3 => w195 + | 2, 4 => w202 + | 2, 5 => w195 + | 3, 0 => w195 + | 3, 1 => w195 + | 3, 2 => w195 + | 3, 3 => w195 + | 3, 4 => w195 + | 3, 5 => w195 + | 4, 0 => w195 + | 4, 1 => w195 + | 4, 2 => w202 + | 4, 3 => w195 + | 4, 4 => w195 + | 4, 5 => w195 + | 5, 0 => w195 + | 5, 1 => w189 + | 5, 2 => w195 + | 5, 3 => w195 + | 5, 4 => w195 + | 5, 5 => w195 + | _, _ => (.exact 0) +lemma Z3_0_5Raw_sound_0 (j : Fin 6) : + (Z3_0_5Raw (0,j)).Encloses (weight (orderedPairInteger (shape 3 0 5) 0 j) : ℝ) := by + fin_cases j + · change (Z3_0_5Raw (0,0)).Encloses (weight (orderedPairInteger (shape 3 0 5) 0 0) : ℝ) + have he : orderedPairInteger (shape 3 0 5) 0 0 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z3_0_5Raw (0,1)).Encloses (weight (orderedPairInteger (shape 3 0 5) 0 1) : ℝ) + have he : orderedPairInteger (shape 3 0 5) 0 1 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z3_0_5Raw (0,2)).Encloses (weight (orderedPairInteger (shape 3 0 5) 0 2) : ℝ) + have he : orderedPairInteger (shape 3 0 5) 0 2 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z3_0_5Raw (0,3)).Encloses (weight (orderedPairInteger (shape 3 0 5) 0 3) : ℝ) + have he : orderedPairInteger (shape 3 0 5) 0 3 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z3_0_5Raw (0,4)).Encloses (weight (orderedPairInteger (shape 3 0 5) 0 4) : ℝ) + have he : orderedPairInteger (shape 3 0 5) 0 4 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z3_0_5Raw (0,5)).Encloses (weight (orderedPairInteger (shape 3 0 5) 0 5) : ℝ) + have he : orderedPairInteger (shape 3 0 5) 0 5 = (0) := by decide +kernel + rw [he] + exact w195_sound +lemma Z3_0_5Raw_sound_1 (j : Fin 6) : + (Z3_0_5Raw (1,j)).Encloses (weight (orderedPairInteger (shape 3 0 5) 1 j) : ℝ) := by + fin_cases j + · change (Z3_0_5Raw (1,0)).Encloses (weight (orderedPairInteger (shape 3 0 5) 1 0) : ℝ) + have he : orderedPairInteger (shape 3 0 5) 1 0 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z3_0_5Raw (1,1)).Encloses (weight (orderedPairInteger (shape 3 0 5) 1 1) : ℝ) + have he : orderedPairInteger (shape 3 0 5) 1 1 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z3_0_5Raw (1,2)).Encloses (weight (orderedPairInteger (shape 3 0 5) 1 2) : ℝ) + have he : orderedPairInteger (shape 3 0 5) 1 2 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z3_0_5Raw (1,3)).Encloses (weight (orderedPairInteger (shape 3 0 5) 1 3) : ℝ) + have he : orderedPairInteger (shape 3 0 5) 1 3 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z3_0_5Raw (1,4)).Encloses (weight (orderedPairInteger (shape 3 0 5) 1 4) : ℝ) + have he : orderedPairInteger (shape 3 0 5) 1 4 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z3_0_5Raw (1,5)).Encloses (weight (orderedPairInteger (shape 3 0 5) 1 5) : ℝ) + have he : orderedPairInteger (shape 3 0 5) 1 5 = (-2174) := by decide +kernel + rw [he] + exact w189_sound +lemma Z3_0_5Raw_sound_2 (j : Fin 6) : + (Z3_0_5Raw (2,j)).Encloses (weight (orderedPairInteger (shape 3 0 5) 2 j) : ℝ) := by + fin_cases j + · change (Z3_0_5Raw (2,0)).Encloses (weight (orderedPairInteger (shape 3 0 5) 2 0) : ℝ) + have he : orderedPairInteger (shape 3 0 5) 2 0 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z3_0_5Raw (2,1)).Encloses (weight (orderedPairInteger (shape 3 0 5) 2 1) : ℝ) + have he : orderedPairInteger (shape 3 0 5) 2 1 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z3_0_5Raw (2,2)).Encloses (weight (orderedPairInteger (shape 3 0 5) 2 2) : ℝ) + have he : orderedPairInteger (shape 3 0 5) 2 2 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z3_0_5Raw (2,3)).Encloses (weight (orderedPairInteger (shape 3 0 5) 2 3) : ℝ) + have he : orderedPairInteger (shape 3 0 5) 2 3 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z3_0_5Raw (2,4)).Encloses (weight (orderedPairInteger (shape 3 0 5) 2 4) : ℝ) + have he : orderedPairInteger (shape 3 0 5) 2 4 = (21564) := by decide +kernel + rw [he] + exact w202_sound + · change (Z3_0_5Raw (2,5)).Encloses (weight (orderedPairInteger (shape 3 0 5) 2 5) : ℝ) + have he : orderedPairInteger (shape 3 0 5) 2 5 = (0) := by decide +kernel + rw [he] + exact w195_sound +lemma Z3_0_5Raw_sound_3 (j : Fin 6) : + (Z3_0_5Raw (3,j)).Encloses (weight (orderedPairInteger (shape 3 0 5) 3 j) : ℝ) := by + fin_cases j + · change (Z3_0_5Raw (3,0)).Encloses (weight (orderedPairInteger (shape 3 0 5) 3 0) : ℝ) + have he : orderedPairInteger (shape 3 0 5) 3 0 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z3_0_5Raw (3,1)).Encloses (weight (orderedPairInteger (shape 3 0 5) 3 1) : ℝ) + have he : orderedPairInteger (shape 3 0 5) 3 1 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z3_0_5Raw (3,2)).Encloses (weight (orderedPairInteger (shape 3 0 5) 3 2) : ℝ) + have he : orderedPairInteger (shape 3 0 5) 3 2 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z3_0_5Raw (3,3)).Encloses (weight (orderedPairInteger (shape 3 0 5) 3 3) : ℝ) + have he : orderedPairInteger (shape 3 0 5) 3 3 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z3_0_5Raw (3,4)).Encloses (weight (orderedPairInteger (shape 3 0 5) 3 4) : ℝ) + have he : orderedPairInteger (shape 3 0 5) 3 4 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z3_0_5Raw (3,5)).Encloses (weight (orderedPairInteger (shape 3 0 5) 3 5) : ℝ) + have he : orderedPairInteger (shape 3 0 5) 3 5 = (0) := by decide +kernel + rw [he] + exact w195_sound +lemma Z3_0_5Raw_sound_4 (j : Fin 6) : + (Z3_0_5Raw (4,j)).Encloses (weight (orderedPairInteger (shape 3 0 5) 4 j) : ℝ) := by + fin_cases j + · change (Z3_0_5Raw (4,0)).Encloses (weight (orderedPairInteger (shape 3 0 5) 4 0) : ℝ) + have he : orderedPairInteger (shape 3 0 5) 4 0 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z3_0_5Raw (4,1)).Encloses (weight (orderedPairInteger (shape 3 0 5) 4 1) : ℝ) + have he : orderedPairInteger (shape 3 0 5) 4 1 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z3_0_5Raw (4,2)).Encloses (weight (orderedPairInteger (shape 3 0 5) 4 2) : ℝ) + have he : orderedPairInteger (shape 3 0 5) 4 2 = (21564) := by decide +kernel + rw [he] + exact w202_sound + · change (Z3_0_5Raw (4,3)).Encloses (weight (orderedPairInteger (shape 3 0 5) 4 3) : ℝ) + have he : orderedPairInteger (shape 3 0 5) 4 3 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z3_0_5Raw (4,4)).Encloses (weight (orderedPairInteger (shape 3 0 5) 4 4) : ℝ) + have he : orderedPairInteger (shape 3 0 5) 4 4 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z3_0_5Raw (4,5)).Encloses (weight (orderedPairInteger (shape 3 0 5) 4 5) : ℝ) + have he : orderedPairInteger (shape 3 0 5) 4 5 = (0) := by decide +kernel + rw [he] + exact w195_sound +lemma Z3_0_5Raw_sound_5 (j : Fin 6) : + (Z3_0_5Raw (5,j)).Encloses (weight (orderedPairInteger (shape 3 0 5) 5 j) : ℝ) := by + fin_cases j + · change (Z3_0_5Raw (5,0)).Encloses (weight (orderedPairInteger (shape 3 0 5) 5 0) : ℝ) + have he : orderedPairInteger (shape 3 0 5) 5 0 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z3_0_5Raw (5,1)).Encloses (weight (orderedPairInteger (shape 3 0 5) 5 1) : ℝ) + have he : orderedPairInteger (shape 3 0 5) 5 1 = (-2174) := by decide +kernel + rw [he] + exact w189_sound + · change (Z3_0_5Raw (5,2)).Encloses (weight (orderedPairInteger (shape 3 0 5) 5 2) : ℝ) + have he : orderedPairInteger (shape 3 0 5) 5 2 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z3_0_5Raw (5,3)).Encloses (weight (orderedPairInteger (shape 3 0 5) 5 3) : ℝ) + have he : orderedPairInteger (shape 3 0 5) 5 3 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z3_0_5Raw (5,4)).Encloses (weight (orderedPairInteger (shape 3 0 5) 5 4) : ℝ) + have he : orderedPairInteger (shape 3 0 5) 5 4 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z3_0_5Raw (5,5)).Encloses (weight (orderedPairInteger (shape 3 0 5) 5 5) : ℝ) + have he : orderedPairInteger (shape 3 0 5) 5 5 = (0) := by decide +kernel + rw [he] + exact w195_sound +lemma Z3_0_5Raw_sound (ij : PairSlot) : + (Z3_0_5Raw ij).Encloses (weight (orderedPairInteger (shape 3 0 5) ij.1 ij.2) : ℝ) := by + rcases ij with ⟨i,j⟩ + revert i + exact forall_fin6 (Z3_0_5Raw_sound_0 j) (Z3_0_5Raw_sound_1 j) (Z3_0_5Raw_sound_2 j) (Z3_0_5Raw_sound_3 j) (Z3_0_5Raw_sound_4 j) (Z3_0_5Raw_sound_5 j) +def Z3_0_5Den : Ball := ⟨(522229287310098961532365085049411 / 25000000000000000000000000000000), (1017 / 50000000000000000000000000000000)⟩ +lemma Z3_0_5Den_sound : Z3_0_5Den.Encloses + (((orderedPairs (shape 3 0 5)).map (fun ij => weight (orderedPairInteger (shape 3 0 5) ij.1 ij.2))).sum : ℝ) := by + exact contains_sound (list_cast_enclosed (orderedPairs (shape 3 0 5)) Z3_0_5Raw + (fun ij => weight (orderedPairInteger (shape 3 0 5) ij.1 ij.2)) + (fun ij _ => Z3_0_5Raw_sound ij)) (by decide +kernel) +lemma Z3_0_5Den_pos : 0 < Z3_0_5Den.lower := by decide +kernel +def Z3_0_5Probs (ij : PairSlot) : Ball := + match ij.1.val, ij.2.val with + | 1, 5 => ⟨(3851794993380545981064826935537 / 100000000000000000000000000000000), (1 / 10000000000000000000000000000000)⟩ + | 2, 4 => ⟨(41361035729160865645318261676507 / 100000000000000000000000000000000), (17 / 20000000000000000000000000000000)⟩ + | 3, 4 => ⟨(1196792319364647093404227846989 / 25000000000000000000000000000000), (1 / 20000000000000000000000000000000)⟩ + | 4, 2 => ⟨(41361035729160865645318261676507 / 100000000000000000000000000000000), (17 / 20000000000000000000000000000000)⟩ + | 4, 3 => ⟨(1196792319364647093404227846989 / 25000000000000000000000000000000), (1 / 20000000000000000000000000000000)⟩ + | 5, 1 => ⟨(3851794993380545981064826935537 / 100000000000000000000000000000000), (1 / 10000000000000000000000000000000)⟩ + | _, _ => (.exact 0) +lemma Z3_0_5Contains : ∀ i j : Fin 6, + statisticWeight i + statisticWeight j = shapeMax (shape 3 0 5) → + contains (.mul (Z3_0_5Raw (i,j)) (.inv Z3_0_5Den)) (Z3_0_5Probs (i,j)) = true := by + decide +kernel +lemma Z3_0_5Zero : ∀ i j : Fin 6, + statisticWeight i + statisticWeight j ≠ shapeMax (shape 3 0 5) → Z3_0_5Probs (i,j) = .exact 0 := by + decide +kernel +lemma Z3_0_5Probs_sound (ij : PairSlot) : + (Z3_0_5Probs ij).Encloses (zeroPairLaw (shape 3 0 5) ij.1 ij.2 : ℝ) := by + by_cases h : statisticWeight ij.1 + statisticWeight ij.2 = shapeMax (shape 3 0 5) + · have hb := contains_sound (Ball.mul_sound (Z3_0_5Raw_sound ij) + (Ball.inv_sound Z3_0_5Den_sound Z3_0_5Den_pos)) (Z3_0_5Contains ij.1 ij.2 h) + simpa only [zeroPairLaw, h, ite_true, Rat.cast_div, Rat.cast_mul, + Rat.cast_inv, div_eq_mul_inv] using hb + · rw [Z3_0_5Zero ij.1 ij.2 h] + simpa only [zeroPairLaw, h, ite_false] using Ball.exact_sound 0 + +def Z3_0_5Half (w : Fin 3) (ij : PairSlot) : Ball := + if (shape 3 0 5) w = 0 then if ij = (0,0) then .exact 1 else .exact 0 + else if w = halfMaxAxis (shape 3 0 5) then Z3_0_5Probs ij + else Z3_0_5Probs (kappa ij.1, kappa ij.2) +lemma Z3_0_5Half_sound (w : Fin 3) (ij : PairSlot) : + (Z3_0_5Half w ij).Encloses (halfLaw (shape 3 0 5) w ij : ℝ) := by + have hp : positive (shape 3 0 5) = false := by decide +kernel + simp only [Z3_0_5Half, halfLaw, hp, Bool.false_eq_true, ite_false] + split_ifs + · exact Ball.exact_sound 1 + · exact Ball.exact_sound 0 + · exact Z3_0_5Probs_sound _ + · exact Z3_0_5Probs_sound _ + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def Z3_0_5Value (a : PairSlot) : ℝ := (zeroPairLaw (shape 3 0 5) a.1 a.2 : ℝ) +def Z3_0_5E_1_5LogWitness : LogWitness := ⟨-5, 3851794993380545981064826935537, 3125000000000000000000000000000⟩ +def Z3_0_5E_1_5Log : Ball := ⟨(-2605304731435115244590336352331 / 800000000000000000000000000000), (127054942357 / 100000000000000000000000000000000)⟩ +lemma Z3_0_5E_1_5Log_sound : Z3_0_5E_1_5Log.Encloses (Real.log (Z3_0_5Value ((1,5) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound (Z3_0_5Probs_sound ((1,5) : PairSlot)) (w := Z3_0_5E_1_5LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z3_0_5E_1_5 : Ball := ⟨(6271937325482765530304899555359 / 50000000000000000000000000000000), (2446947971 / 50000000000000000000000000000000)⟩ +lemma Z3_0_5E_1_5_sound : Z3_0_5E_1_5.Encloses (Foundation.entropyTerm (Z3_0_5Value ((1,5) : PairSlot))) := by + exact contains_sound (entropyTerm_ball (Z3_0_5Probs_sound ((1,5) : PairSlot)) Z3_0_5E_1_5Log_sound) (by decide +kernel) +def Z3_0_5E_2_4LogWitness : LogWitness := ⟨-2, 41361035729160865645318261676507, 25000000000000000000000000000000⟩ +def Z3_0_5E_2_4Log : Ball := ⟨(-17656618285877881114758420265571 / 20000000000000000000000000000000), (31763735627 / 50000000000000000000000000000000)⟩ +lemma Z3_0_5E_2_4Log_sound : Z3_0_5E_2_4Log.Encloses (Real.log (Z3_0_5Value ((2,4) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound (Z3_0_5Probs_sound ((2,4) : PairSlot)) (w := Z3_0_5E_2_4LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z3_0_5E_2_4 : Ball := ⟨(36514800988917506010651666724087 / 100000000000000000000000000000000), (26275620159 / 100000000000000000000000000000000)⟩ +lemma Z3_0_5E_2_4_sound : Z3_0_5E_2_4.Encloses (Foundation.entropyTerm (Z3_0_5Value ((2,4) : PairSlot))) := by + exact contains_sound (entropyTerm_ball (Z3_0_5Probs_sound ((2,4) : PairSlot)) Z3_0_5E_2_4Log_sound) (by decide +kernel) +def Z3_0_5E_3_4LogWitness : LogWitness := ⟨-5, 1196792319364647093404227846989, 781250000000000000000000000000⟩ +def Z3_0_5E_3_4Log : Ball := ⟨(-303923091429389405573792044041373 / 100000000000000000000000000000000), (63527471101 / 50000000000000000000000000000000)⟩ +lemma Z3_0_5E_3_4Log_sound : Z3_0_5E_3_4Log.Encloses (Real.log (Z3_0_5Value ((3,4) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound (Z3_0_5Probs_sound ((3,4) : PairSlot)) (w := Z3_0_5E_3_4LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z3_0_5E_3_4 : Ball := ⟨(1454931286001010573435377377673 / 10000000000000000000000000000000), (3041167587 / 50000000000000000000000000000000)⟩ +lemma Z3_0_5E_3_4_sound : Z3_0_5E_3_4.Encloses (Foundation.entropyTerm (Z3_0_5Value ((3,4) : PairSlot))) := by + exact contains_sound (entropyTerm_ball (Z3_0_5Probs_sound ((3,4) : PairSlot)) Z3_0_5E_3_4Log_sound) (by decide +kernel) +def Z3_0_5E_4_2LogWitness : LogWitness := ⟨-2, 41361035729160865645318261676507, 25000000000000000000000000000000⟩ +def Z3_0_5E_4_2Log : Ball := ⟨(-17656618285877881114758420265571 / 20000000000000000000000000000000), (31763735627 / 50000000000000000000000000000000)⟩ +lemma Z3_0_5E_4_2Log_sound : Z3_0_5E_4_2Log.Encloses (Real.log (Z3_0_5Value ((4,2) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound (Z3_0_5Probs_sound ((4,2) : PairSlot)) (w := Z3_0_5E_4_2LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z3_0_5E_4_2 : Ball := ⟨(36514800988917506010651666724087 / 100000000000000000000000000000000), (26275620159 / 100000000000000000000000000000000)⟩ +lemma Z3_0_5E_4_2_sound : Z3_0_5E_4_2.Encloses (Foundation.entropyTerm (Z3_0_5Value ((4,2) : PairSlot))) := by + exact contains_sound (entropyTerm_ball (Z3_0_5Probs_sound ((4,2) : PairSlot)) Z3_0_5E_4_2Log_sound) (by decide +kernel) +def Z3_0_5E_4_3LogWitness : LogWitness := ⟨-5, 1196792319364647093404227846989, 781250000000000000000000000000⟩ +def Z3_0_5E_4_3Log : Ball := ⟨(-303923091429389405573792044041373 / 100000000000000000000000000000000), (63527471101 / 50000000000000000000000000000000)⟩ +lemma Z3_0_5E_4_3Log_sound : Z3_0_5E_4_3Log.Encloses (Real.log (Z3_0_5Value ((4,3) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound (Z3_0_5Probs_sound ((4,3) : PairSlot)) (w := Z3_0_5E_4_3LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z3_0_5E_4_3 : Ball := ⟨(1454931286001010573435377377673 / 10000000000000000000000000000000), (3041167587 / 50000000000000000000000000000000)⟩ +lemma Z3_0_5E_4_3_sound : Z3_0_5E_4_3.Encloses (Foundation.entropyTerm (Z3_0_5Value ((4,3) : PairSlot))) := by + exact contains_sound (entropyTerm_ball (Z3_0_5Probs_sound ((4,3) : PairSlot)) Z3_0_5E_4_3Log_sound) (by decide +kernel) +def Z3_0_5E_5_1LogWitness : LogWitness := ⟨-5, 3851794993380545981064826935537, 3125000000000000000000000000000⟩ +def Z3_0_5E_5_1Log : Ball := ⟨(-2605304731435115244590336352331 / 800000000000000000000000000000), (127054942357 / 100000000000000000000000000000000)⟩ +lemma Z3_0_5E_5_1Log_sound : Z3_0_5E_5_1Log.Encloses (Real.log (Z3_0_5Value ((5,1) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound (Z3_0_5Probs_sound ((5,1) : PairSlot)) (w := Z3_0_5E_5_1LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z3_0_5E_5_1 : Ball := ⟨(6271937325482765530304899555359 / 50000000000000000000000000000000), (2446947971 / 50000000000000000000000000000000)⟩ +lemma Z3_0_5E_5_1_sound : Z3_0_5E_5_1.Encloses (Foundation.entropyTerm (Z3_0_5Value ((5,1) : PairSlot))) := by + exact contains_sound (entropyTerm_ball (Z3_0_5Probs_sound ((5,1) : PairSlot)) Z3_0_5E_5_1Log_sound) (by decide +kernel) +def Z3_0_5Terms (a : PairSlot) : Ball := + match a.1.val, a.2.val with + | 1, 5 => ⟨(6271937325482765530304899555359 / 50000000000000000000000000000000), (2446947971 / 50000000000000000000000000000000)⟩ + | 2, 4 => ⟨(36514800988917506010651666724087 / 100000000000000000000000000000000), (26275620159 / 100000000000000000000000000000000)⟩ + | 3, 4 => ⟨(1454931286001010573435377377673 / 10000000000000000000000000000000), (3041167587 / 50000000000000000000000000000000)⟩ + | 4, 2 => ⟨(36514800988917506010651666724087 / 100000000000000000000000000000000), (26275620159 / 100000000000000000000000000000000)⟩ + | 4, 3 => ⟨(1454931286001010573435377377673 / 10000000000000000000000000000000), (3041167587 / 50000000000000000000000000000000)⟩ + | 5, 1 => ⟨(6271937325482765530304899555359 / 50000000000000000000000000000000), (2446947971 / 50000000000000000000000000000000)⟩ + | _, _ => (.exact 0) +lemma Z3_0_5Terms_sound (a : PairSlot) : + (Z3_0_5Terms a).Encloses (Foundation.entropyTerm (Z3_0_5Value a)) := by + rcases a with ⟨i,j⟩ + revert j i + apply forall_fin6 + · exact forall_fin6 (entropyTerm_zero_ball (Z3_0_5Probs_sound ((0,0) : PairSlot))) (entropyTerm_zero_ball (Z3_0_5Probs_sound ((0,1) : PairSlot))) (entropyTerm_zero_ball (Z3_0_5Probs_sound ((0,2) : PairSlot))) (entropyTerm_zero_ball (Z3_0_5Probs_sound ((0,3) : PairSlot))) (entropyTerm_zero_ball (Z3_0_5Probs_sound ((0,4) : PairSlot))) (entropyTerm_zero_ball (Z3_0_5Probs_sound ((0,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball (Z3_0_5Probs_sound ((1,0) : PairSlot))) (entropyTerm_zero_ball (Z3_0_5Probs_sound ((1,1) : PairSlot))) (entropyTerm_zero_ball (Z3_0_5Probs_sound ((1,2) : PairSlot))) (entropyTerm_zero_ball (Z3_0_5Probs_sound ((1,3) : PairSlot))) (entropyTerm_zero_ball (Z3_0_5Probs_sound ((1,4) : PairSlot))) Z3_0_5E_1_5_sound + · exact forall_fin6 (entropyTerm_zero_ball (Z3_0_5Probs_sound ((2,0) : PairSlot))) (entropyTerm_zero_ball (Z3_0_5Probs_sound ((2,1) : PairSlot))) (entropyTerm_zero_ball (Z3_0_5Probs_sound ((2,2) : PairSlot))) (entropyTerm_zero_ball (Z3_0_5Probs_sound ((2,3) : PairSlot))) Z3_0_5E_2_4_sound (entropyTerm_zero_ball (Z3_0_5Probs_sound ((2,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball (Z3_0_5Probs_sound ((3,0) : PairSlot))) (entropyTerm_zero_ball (Z3_0_5Probs_sound ((3,1) : PairSlot))) (entropyTerm_zero_ball (Z3_0_5Probs_sound ((3,2) : PairSlot))) (entropyTerm_zero_ball (Z3_0_5Probs_sound ((3,3) : PairSlot))) Z3_0_5E_3_4_sound (entropyTerm_zero_ball (Z3_0_5Probs_sound ((3,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball (Z3_0_5Probs_sound ((4,0) : PairSlot))) (entropyTerm_zero_ball (Z3_0_5Probs_sound ((4,1) : PairSlot))) Z3_0_5E_4_2_sound Z3_0_5E_4_3_sound (entropyTerm_zero_ball (Z3_0_5Probs_sound ((4,4) : PairSlot))) (entropyTerm_zero_ball (Z3_0_5Probs_sound ((4,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball (Z3_0_5Probs_sound ((5,0) : PairSlot))) Z3_0_5E_5_1_sound (entropyTerm_zero_ball (Z3_0_5Probs_sound ((5,2) : PairSlot))) (entropyTerm_zero_ball (Z3_0_5Probs_sound ((5,3) : PairSlot))) (entropyTerm_zero_ball (Z3_0_5Probs_sound ((5,4) : PairSlot))) (entropyTerm_zero_ball (Z3_0_5Probs_sound ((5,5) : PairSlot))) +def Z3_0_5Entropy : Ball := ⟨(12721597699978628561123047922307 / 10000000000000000000000000000000), (1490074051 / 2000000000000000000000000000000)⟩ +lemma Z3_0_5Entropy_sound : Z3_0_5Entropy.Encloses (Foundation.finiteEntropy Z3_0_5Value) := by + exact contains_sound (entropyPair_enclosed Z3_0_5Value Z3_0_5Terms Z3_0_5Terms_sound) (by decide +kernel) +def Z3_0_5Labels : Ball := ⟨(125791752768670849860793716024527 / 25000000000000000000000000000000), (78399530397 / 50000000000000000000000000000000)⟩ +lemma Z3_0_5Labels_sound : Z3_0_5Labels.Encloses + (∑ a : PairSlot, (zeroPairLaw (shape 3 0 5) a.1 a.2 : ℝ) * + Real.log (AllFieldParameters.multiplicity a.1 * AllFieldParameters.multiplicity a.2 : ℕ)) := by + exact contains_sound (pairSumBall_sound (fun a => .mul (Z3_0_5Probs a) (multLogs a)) + _ (fun a => Ball.mul_sound (Z3_0_5Probs_sound a) (multLogs_sound a))) (by decide +kernel) +def Z3_0_5Four : Ball := ⟨(315191494037234842527202671660589 / 50000000000000000000000000000000), (14456422709 / 6250000000000000000000000000000)⟩ +lemma Z3_0_5Four_sound : Z3_0_5Four.Encloses (AllFieldZeroLeafRates.fourRate (shape 3 0 5)) := by + exact contains_sound (Ball.add_sound Z3_0_5Entropy_sound Z3_0_5Labels_sound) (by decide +kernel) +def Z3_0_5H0Value (a : PairSlot) : ℝ := (halfLaw (shape 3 0 5) 0 a : ℝ) +def Z3_0_5H0E_4_0LogWitness : LogWitness := ⟨-5, 3851794993380545981064826935537, 3125000000000000000000000000000⟩ +def Z3_0_5H0E_4_0Log : Ball := ⟨(-2605304731435115244590336352331 / 800000000000000000000000000000), (127054942357 / 100000000000000000000000000000000)⟩ +lemma Z3_0_5H0E_4_0Log_sound : Z3_0_5H0E_4_0Log.Encloses (Real.log (Z3_0_5H0Value ((4,0) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound ((Z3_0_5Half_sound 0) ((4,0) : PairSlot)) (w := Z3_0_5H0E_4_0LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z3_0_5H0E_4_0 : Ball := ⟨(6271937325482765530304899555359 / 50000000000000000000000000000000), (2446947971 / 50000000000000000000000000000000)⟩ +lemma Z3_0_5H0E_4_0_sound : Z3_0_5H0E_4_0.Encloses (Foundation.entropyTerm (Z3_0_5H0Value ((4,0) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z3_0_5Half_sound 0) ((4,0) : PairSlot)) Z3_0_5H0E_4_0Log_sound) (by decide +kernel) +def Z3_0_5H0E_2_1LogWitness : LogWitness := ⟨-2, 41361035729160865645318261676507, 25000000000000000000000000000000⟩ +def Z3_0_5H0E_2_1Log : Ball := ⟨(-17656618285877881114758420265571 / 20000000000000000000000000000000), (31763735627 / 50000000000000000000000000000000)⟩ +lemma Z3_0_5H0E_2_1Log_sound : Z3_0_5H0E_2_1Log.Encloses (Real.log (Z3_0_5H0Value ((2,1) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound ((Z3_0_5Half_sound 0) ((2,1) : PairSlot)) (w := Z3_0_5H0E_2_1LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z3_0_5H0E_2_1 : Ball := ⟨(36514800988917506010651666724087 / 100000000000000000000000000000000), (26275620159 / 100000000000000000000000000000000)⟩ +lemma Z3_0_5H0E_2_1_sound : Z3_0_5H0E_2_1.Encloses (Foundation.entropyTerm (Z3_0_5H0Value ((2,1) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z3_0_5Half_sound 0) ((2,1) : PairSlot)) Z3_0_5H0E_2_1Log_sound) (by decide +kernel) +def Z3_0_5H0E_3_1LogWitness : LogWitness := ⟨-5, 1196792319364647093404227846989, 781250000000000000000000000000⟩ +def Z3_0_5H0E_3_1Log : Ball := ⟨(-303923091429389405573792044041373 / 100000000000000000000000000000000), (63527471101 / 50000000000000000000000000000000)⟩ +lemma Z3_0_5H0E_3_1Log_sound : Z3_0_5H0E_3_1Log.Encloses (Real.log (Z3_0_5H0Value ((3,1) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound ((Z3_0_5Half_sound 0) ((3,1) : PairSlot)) (w := Z3_0_5H0E_3_1LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z3_0_5H0E_3_1 : Ball := ⟨(1454931286001010573435377377673 / 10000000000000000000000000000000), (3041167587 / 50000000000000000000000000000000)⟩ +lemma Z3_0_5H0E_3_1_sound : Z3_0_5H0E_3_1.Encloses (Foundation.entropyTerm (Z3_0_5H0Value ((3,1) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z3_0_5Half_sound 0) ((3,1) : PairSlot)) Z3_0_5H0E_3_1Log_sound) (by decide +kernel) +def Z3_0_5H0E_1_2LogWitness : LogWitness := ⟨-2, 41361035729160865645318261676507, 25000000000000000000000000000000⟩ +def Z3_0_5H0E_1_2Log : Ball := ⟨(-17656618285877881114758420265571 / 20000000000000000000000000000000), (31763735627 / 50000000000000000000000000000000)⟩ +lemma Z3_0_5H0E_1_2Log_sound : Z3_0_5H0E_1_2Log.Encloses (Real.log (Z3_0_5H0Value ((1,2) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound ((Z3_0_5Half_sound 0) ((1,2) : PairSlot)) (w := Z3_0_5H0E_1_2LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z3_0_5H0E_1_2 : Ball := ⟨(36514800988917506010651666724087 / 100000000000000000000000000000000), (26275620159 / 100000000000000000000000000000000)⟩ +lemma Z3_0_5H0E_1_2_sound : Z3_0_5H0E_1_2.Encloses (Foundation.entropyTerm (Z3_0_5H0Value ((1,2) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z3_0_5Half_sound 0) ((1,2) : PairSlot)) Z3_0_5H0E_1_2Log_sound) (by decide +kernel) +def Z3_0_5H0E_1_3LogWitness : LogWitness := ⟨-5, 1196792319364647093404227846989, 781250000000000000000000000000⟩ +def Z3_0_5H0E_1_3Log : Ball := ⟨(-303923091429389405573792044041373 / 100000000000000000000000000000000), (63527471101 / 50000000000000000000000000000000)⟩ +lemma Z3_0_5H0E_1_3Log_sound : Z3_0_5H0E_1_3Log.Encloses (Real.log (Z3_0_5H0Value ((1,3) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound ((Z3_0_5Half_sound 0) ((1,3) : PairSlot)) (w := Z3_0_5H0E_1_3LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z3_0_5H0E_1_3 : Ball := ⟨(1454931286001010573435377377673 / 10000000000000000000000000000000), (3041167587 / 50000000000000000000000000000000)⟩ +lemma Z3_0_5H0E_1_3_sound : Z3_0_5H0E_1_3.Encloses (Foundation.entropyTerm (Z3_0_5H0Value ((1,3) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z3_0_5Half_sound 0) ((1,3) : PairSlot)) Z3_0_5H0E_1_3Log_sound) (by decide +kernel) +def Z3_0_5H0E_0_4LogWitness : LogWitness := ⟨-5, 3851794993380545981064826935537, 3125000000000000000000000000000⟩ +def Z3_0_5H0E_0_4Log : Ball := ⟨(-2605304731435115244590336352331 / 800000000000000000000000000000), (127054942357 / 100000000000000000000000000000000)⟩ +lemma Z3_0_5H0E_0_4Log_sound : Z3_0_5H0E_0_4Log.Encloses (Real.log (Z3_0_5H0Value ((0,4) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound ((Z3_0_5Half_sound 0) ((0,4) : PairSlot)) (w := Z3_0_5H0E_0_4LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z3_0_5H0E_0_4 : Ball := ⟨(6271937325482765530304899555359 / 50000000000000000000000000000000), (2446947971 / 50000000000000000000000000000000)⟩ +lemma Z3_0_5H0E_0_4_sound : Z3_0_5H0E_0_4.Encloses (Foundation.entropyTerm (Z3_0_5H0Value ((0,4) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z3_0_5Half_sound 0) ((0,4) : PairSlot)) Z3_0_5H0E_0_4Log_sound) (by decide +kernel) +def Z3_0_5H0Terms (a : PairSlot) : Ball := + match a.1.val, a.2.val with + | 4, 0 => ⟨(6271937325482765530304899555359 / 50000000000000000000000000000000), (2446947971 / 50000000000000000000000000000000)⟩ + | 2, 1 => ⟨(36514800988917506010651666724087 / 100000000000000000000000000000000), (26275620159 / 100000000000000000000000000000000)⟩ + | 3, 1 => ⟨(1454931286001010573435377377673 / 10000000000000000000000000000000), (3041167587 / 50000000000000000000000000000000)⟩ + | 1, 2 => ⟨(36514800988917506010651666724087 / 100000000000000000000000000000000), (26275620159 / 100000000000000000000000000000000)⟩ + | 1, 3 => ⟨(1454931286001010573435377377673 / 10000000000000000000000000000000), (3041167587 / 50000000000000000000000000000000)⟩ + | 0, 4 => ⟨(6271937325482765530304899555359 / 50000000000000000000000000000000), (2446947971 / 50000000000000000000000000000000)⟩ + | _, _ => (.exact 0) +lemma Z3_0_5H0Terms_sound (a : PairSlot) : + (Z3_0_5H0Terms a).Encloses (Foundation.entropyTerm (Z3_0_5H0Value a)) := by + rcases a with ⟨i,j⟩ + revert j i + apply forall_fin6 + · exact forall_fin6 (entropyTerm_zero_ball ((Z3_0_5Half_sound 0) ((0,0) : PairSlot))) (entropyTerm_zero_ball ((Z3_0_5Half_sound 0) ((0,1) : PairSlot))) (entropyTerm_zero_ball ((Z3_0_5Half_sound 0) ((0,2) : PairSlot))) (entropyTerm_zero_ball ((Z3_0_5Half_sound 0) ((0,3) : PairSlot))) Z3_0_5H0E_0_4_sound (entropyTerm_zero_ball ((Z3_0_5Half_sound 0) ((0,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z3_0_5Half_sound 0) ((1,0) : PairSlot))) (entropyTerm_zero_ball ((Z3_0_5Half_sound 0) ((1,1) : PairSlot))) Z3_0_5H0E_1_2_sound Z3_0_5H0E_1_3_sound (entropyTerm_zero_ball ((Z3_0_5Half_sound 0) ((1,4) : PairSlot))) (entropyTerm_zero_ball ((Z3_0_5Half_sound 0) ((1,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z3_0_5Half_sound 0) ((2,0) : PairSlot))) Z3_0_5H0E_2_1_sound (entropyTerm_zero_ball ((Z3_0_5Half_sound 0) ((2,2) : PairSlot))) (entropyTerm_zero_ball ((Z3_0_5Half_sound 0) ((2,3) : PairSlot))) (entropyTerm_zero_ball ((Z3_0_5Half_sound 0) ((2,4) : PairSlot))) (entropyTerm_zero_ball ((Z3_0_5Half_sound 0) ((2,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z3_0_5Half_sound 0) ((3,0) : PairSlot))) Z3_0_5H0E_3_1_sound (entropyTerm_zero_ball ((Z3_0_5Half_sound 0) ((3,2) : PairSlot))) (entropyTerm_zero_ball ((Z3_0_5Half_sound 0) ((3,3) : PairSlot))) (entropyTerm_zero_ball ((Z3_0_5Half_sound 0) ((3,4) : PairSlot))) (entropyTerm_zero_ball ((Z3_0_5Half_sound 0) ((3,5) : PairSlot))) + · exact forall_fin6 Z3_0_5H0E_4_0_sound (entropyTerm_zero_ball ((Z3_0_5Half_sound 0) ((4,1) : PairSlot))) (entropyTerm_zero_ball ((Z3_0_5Half_sound 0) ((4,2) : PairSlot))) (entropyTerm_zero_ball ((Z3_0_5Half_sound 0) ((4,3) : PairSlot))) (entropyTerm_zero_ball ((Z3_0_5Half_sound 0) ((4,4) : PairSlot))) (entropyTerm_zero_ball ((Z3_0_5Half_sound 0) ((4,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z3_0_5Half_sound 0) ((5,0) : PairSlot))) (entropyTerm_zero_ball ((Z3_0_5Half_sound 0) ((5,1) : PairSlot))) (entropyTerm_zero_ball ((Z3_0_5Half_sound 0) ((5,2) : PairSlot))) (entropyTerm_zero_ball ((Z3_0_5Half_sound 0) ((5,3) : PairSlot))) (entropyTerm_zero_ball ((Z3_0_5Half_sound 0) ((5,4) : PairSlot))) (entropyTerm_zero_ball ((Z3_0_5Half_sound 0) ((5,5) : PairSlot))) +def Z3_0_5H0Entropy : Ball := ⟨(12721597699978628561123047922307 / 10000000000000000000000000000000), (1490074051 / 2000000000000000000000000000000)⟩ +lemma Z3_0_5H0Entropy_sound : Z3_0_5H0Entropy.Encloses (Foundation.finiteEntropy Z3_0_5H0Value) := by + exact contains_sound (entropyPair_enclosed Z3_0_5H0Value Z3_0_5H0Terms Z3_0_5H0Terms_sound) (by decide +kernel) +def Z3_0_5H0Mass : Ball := ⟨1, (1 / 500000000000000000000000000000)⟩ +lemma Z3_0_5H0Mass_sound : Z3_0_5H0Mass.Encloses (∑ a, Z3_0_5H0Value a) := by + exact contains_sound (pairSumBall_sound (Z3_0_5Half 0) Z3_0_5H0Value (Z3_0_5Half_sound 0)) (by decide +kernel) +def Z3_0_5H0MassTermLogWitness : LogWitness := ⟨0, 1, 1⟩ +def Z3_0_5H0MassTermLog : Ball := ⟨0, (10587911941 / 50000000000000000000000000000000)⟩ +lemma Z3_0_5H0MassTermLog_sound : Z3_0_5H0MassTermLog.Encloses (Real.log ((∑ a, Z3_0_5H0Value a))) := by + exact checkLog_sound logTwoBall_sound (Z3_0_5H0Mass_sound) (w := Z3_0_5H0MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z3_0_5H0MassTerm : Ball := ⟨0, (21175823883 / 100000000000000000000000000000000)⟩ +lemma Z3_0_5H0MassTerm_sound : Z3_0_5H0MassTerm.Encloses (Foundation.entropyTerm ((∑ a, Z3_0_5H0Value a))) := by + exact contains_sound (entropyTerm_ball (Z3_0_5H0Mass_sound) Z3_0_5H0MassTermLog_sound) (by decide +kernel) +def Z3_0_5H0H : Ball := ⟨(12721597699978628561123047922307 / 10000000000000000000000000000000), (95679526433 / 100000000000000000000000000000000)⟩ +lemma Z3_0_5H0H_sound : Z3_0_5H0H.Encloses (homogeneousEntropy Z3_0_5H0Value) := by + exact contains_sound (homogeneous_enclosed Z3_0_5H0Value Z3_0_5H0MassTerm_sound Z3_0_5H0Entropy_sound) (by decide +kernel) +def Z3_0_5H1Value (a : PairSlot) : ℝ := (halfLaw (shape 3 0 5) 1 a : ℝ) +def Z3_0_5H1E_0_0Log : Ball := .exact 0 +lemma Z3_0_5H1E_0_0Log_sound : Z3_0_5H1E_0_0Log.Encloses (Real.log (Z3_0_5H1Value ((0,0) : PairSlot))) := by + exact log_exact_one_ball ((Z3_0_5Half_sound 1) ((0,0) : PairSlot)) +def Z3_0_5H1E_0_0 : Ball := ⟨0, 0⟩ +lemma Z3_0_5H1E_0_0_sound : Z3_0_5H1E_0_0.Encloses (Foundation.entropyTerm (Z3_0_5H1Value ((0,0) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z3_0_5Half_sound 1) ((0,0) : PairSlot)) Z3_0_5H1E_0_0Log_sound) (by decide +kernel) +def Z3_0_5H1Terms (a : PairSlot) : Ball := + match a.1.val, a.2.val with + | 0, 0 => ⟨0, 0⟩ + | _, _ => (.exact 0) +lemma Z3_0_5H1Terms_sound (a : PairSlot) : + (Z3_0_5H1Terms a).Encloses (Foundation.entropyTerm (Z3_0_5H1Value a)) := by + rcases a with ⟨i,j⟩ + revert j i + apply forall_fin6 + · exact forall_fin6 Z3_0_5H1E_0_0_sound (entropyTerm_zero_ball ((Z3_0_5Half_sound 1) ((0,1) : PairSlot))) (entropyTerm_zero_ball ((Z3_0_5Half_sound 1) ((0,2) : PairSlot))) (entropyTerm_zero_ball ((Z3_0_5Half_sound 1) ((0,3) : PairSlot))) (entropyTerm_zero_ball ((Z3_0_5Half_sound 1) ((0,4) : PairSlot))) (entropyTerm_zero_ball ((Z3_0_5Half_sound 1) ((0,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z3_0_5Half_sound 1) ((1,0) : PairSlot))) (entropyTerm_zero_ball ((Z3_0_5Half_sound 1) ((1,1) : PairSlot))) (entropyTerm_zero_ball ((Z3_0_5Half_sound 1) ((1,2) : PairSlot))) (entropyTerm_zero_ball ((Z3_0_5Half_sound 1) ((1,3) : PairSlot))) (entropyTerm_zero_ball ((Z3_0_5Half_sound 1) ((1,4) : PairSlot))) (entropyTerm_zero_ball ((Z3_0_5Half_sound 1) ((1,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z3_0_5Half_sound 1) ((2,0) : PairSlot))) (entropyTerm_zero_ball ((Z3_0_5Half_sound 1) ((2,1) : PairSlot))) (entropyTerm_zero_ball ((Z3_0_5Half_sound 1) ((2,2) : PairSlot))) (entropyTerm_zero_ball ((Z3_0_5Half_sound 1) ((2,3) : PairSlot))) (entropyTerm_zero_ball ((Z3_0_5Half_sound 1) ((2,4) : PairSlot))) (entropyTerm_zero_ball ((Z3_0_5Half_sound 1) ((2,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z3_0_5Half_sound 1) ((3,0) : PairSlot))) (entropyTerm_zero_ball ((Z3_0_5Half_sound 1) ((3,1) : PairSlot))) (entropyTerm_zero_ball ((Z3_0_5Half_sound 1) ((3,2) : PairSlot))) (entropyTerm_zero_ball ((Z3_0_5Half_sound 1) ((3,3) : PairSlot))) (entropyTerm_zero_ball ((Z3_0_5Half_sound 1) ((3,4) : PairSlot))) (entropyTerm_zero_ball ((Z3_0_5Half_sound 1) ((3,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z3_0_5Half_sound 1) ((4,0) : PairSlot))) (entropyTerm_zero_ball ((Z3_0_5Half_sound 1) ((4,1) : PairSlot))) (entropyTerm_zero_ball ((Z3_0_5Half_sound 1) ((4,2) : PairSlot))) (entropyTerm_zero_ball ((Z3_0_5Half_sound 1) ((4,3) : PairSlot))) (entropyTerm_zero_ball ((Z3_0_5Half_sound 1) ((4,4) : PairSlot))) (entropyTerm_zero_ball ((Z3_0_5Half_sound 1) ((4,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z3_0_5Half_sound 1) ((5,0) : PairSlot))) (entropyTerm_zero_ball ((Z3_0_5Half_sound 1) ((5,1) : PairSlot))) (entropyTerm_zero_ball ((Z3_0_5Half_sound 1) ((5,2) : PairSlot))) (entropyTerm_zero_ball ((Z3_0_5Half_sound 1) ((5,3) : PairSlot))) (entropyTerm_zero_ball ((Z3_0_5Half_sound 1) ((5,4) : PairSlot))) (entropyTerm_zero_ball ((Z3_0_5Half_sound 1) ((5,5) : PairSlot))) +def Z3_0_5H1Entropy : Ball := ⟨0, 0⟩ +lemma Z3_0_5H1Entropy_sound : Z3_0_5H1Entropy.Encloses (Foundation.finiteEntropy Z3_0_5H1Value) := by + exact contains_sound (entropyPair_enclosed Z3_0_5H1Value Z3_0_5H1Terms Z3_0_5H1Terms_sound) (by decide +kernel) +def Z3_0_5H1Mass : Ball := ⟨1, 0⟩ +lemma Z3_0_5H1Mass_sound : Z3_0_5H1Mass.Encloses (∑ a, Z3_0_5H1Value a) := by + exact contains_sound (pairSumBall_sound (Z3_0_5Half 1) Z3_0_5H1Value (Z3_0_5Half_sound 1)) (by decide +kernel) +def Z3_0_5H1MassTermLog : Ball := .exact 0 +lemma Z3_0_5H1MassTermLog_sound : Z3_0_5H1MassTermLog.Encloses (Real.log ((∑ a, Z3_0_5H1Value a))) := by + exact log_exact_one_ball (Z3_0_5H1Mass_sound) +def Z3_0_5H1MassTerm : Ball := ⟨0, 0⟩ +lemma Z3_0_5H1MassTerm_sound : Z3_0_5H1MassTerm.Encloses (Foundation.entropyTerm ((∑ a, Z3_0_5H1Value a))) := by + exact contains_sound (entropyTerm_ball (Z3_0_5H1Mass_sound) Z3_0_5H1MassTermLog_sound) (by decide +kernel) +def Z3_0_5H1H : Ball := ⟨0, 0⟩ +lemma Z3_0_5H1H_sound : Z3_0_5H1H.Encloses (homogeneousEntropy Z3_0_5H1Value) := by + exact contains_sound (homogeneous_enclosed Z3_0_5H1Value Z3_0_5H1MassTerm_sound Z3_0_5H1Entropy_sound) (by decide +kernel) +def Z3_0_5H2Value (a : PairSlot) : ℝ := (halfLaw (shape 3 0 5) 2 a : ℝ) +def Z3_0_5H2E_1_5LogWitness : LogWitness := ⟨-5, 3851794993380545981064826935537, 3125000000000000000000000000000⟩ +def Z3_0_5H2E_1_5Log : Ball := ⟨(-2605304731435115244590336352331 / 800000000000000000000000000000), (127054942357 / 100000000000000000000000000000000)⟩ +lemma Z3_0_5H2E_1_5Log_sound : Z3_0_5H2E_1_5Log.Encloses (Real.log (Z3_0_5H2Value ((1,5) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound ((Z3_0_5Half_sound 2) ((1,5) : PairSlot)) (w := Z3_0_5H2E_1_5LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z3_0_5H2E_1_5 : Ball := ⟨(6271937325482765530304899555359 / 50000000000000000000000000000000), (2446947971 / 50000000000000000000000000000000)⟩ +lemma Z3_0_5H2E_1_5_sound : Z3_0_5H2E_1_5.Encloses (Foundation.entropyTerm (Z3_0_5H2Value ((1,5) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z3_0_5Half_sound 2) ((1,5) : PairSlot)) Z3_0_5H2E_1_5Log_sound) (by decide +kernel) +def Z3_0_5H2E_2_4LogWitness : LogWitness := ⟨-2, 41361035729160865645318261676507, 25000000000000000000000000000000⟩ +def Z3_0_5H2E_2_4Log : Ball := ⟨(-17656618285877881114758420265571 / 20000000000000000000000000000000), (31763735627 / 50000000000000000000000000000000)⟩ +lemma Z3_0_5H2E_2_4Log_sound : Z3_0_5H2E_2_4Log.Encloses (Real.log (Z3_0_5H2Value ((2,4) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound ((Z3_0_5Half_sound 2) ((2,4) : PairSlot)) (w := Z3_0_5H2E_2_4LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z3_0_5H2E_2_4 : Ball := ⟨(36514800988917506010651666724087 / 100000000000000000000000000000000), (26275620159 / 100000000000000000000000000000000)⟩ +lemma Z3_0_5H2E_2_4_sound : Z3_0_5H2E_2_4.Encloses (Foundation.entropyTerm (Z3_0_5H2Value ((2,4) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z3_0_5Half_sound 2) ((2,4) : PairSlot)) Z3_0_5H2E_2_4Log_sound) (by decide +kernel) +def Z3_0_5H2E_3_4LogWitness : LogWitness := ⟨-5, 1196792319364647093404227846989, 781250000000000000000000000000⟩ +def Z3_0_5H2E_3_4Log : Ball := ⟨(-303923091429389405573792044041373 / 100000000000000000000000000000000), (63527471101 / 50000000000000000000000000000000)⟩ +lemma Z3_0_5H2E_3_4Log_sound : Z3_0_5H2E_3_4Log.Encloses (Real.log (Z3_0_5H2Value ((3,4) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound ((Z3_0_5Half_sound 2) ((3,4) : PairSlot)) (w := Z3_0_5H2E_3_4LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z3_0_5H2E_3_4 : Ball := ⟨(1454931286001010573435377377673 / 10000000000000000000000000000000), (3041167587 / 50000000000000000000000000000000)⟩ +lemma Z3_0_5H2E_3_4_sound : Z3_0_5H2E_3_4.Encloses (Foundation.entropyTerm (Z3_0_5H2Value ((3,4) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z3_0_5Half_sound 2) ((3,4) : PairSlot)) Z3_0_5H2E_3_4Log_sound) (by decide +kernel) +def Z3_0_5H2E_4_2LogWitness : LogWitness := ⟨-2, 41361035729160865645318261676507, 25000000000000000000000000000000⟩ +def Z3_0_5H2E_4_2Log : Ball := ⟨(-17656618285877881114758420265571 / 20000000000000000000000000000000), (31763735627 / 50000000000000000000000000000000)⟩ +lemma Z3_0_5H2E_4_2Log_sound : Z3_0_5H2E_4_2Log.Encloses (Real.log (Z3_0_5H2Value ((4,2) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound ((Z3_0_5Half_sound 2) ((4,2) : PairSlot)) (w := Z3_0_5H2E_4_2LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z3_0_5H2E_4_2 : Ball := ⟨(36514800988917506010651666724087 / 100000000000000000000000000000000), (26275620159 / 100000000000000000000000000000000)⟩ +lemma Z3_0_5H2E_4_2_sound : Z3_0_5H2E_4_2.Encloses (Foundation.entropyTerm (Z3_0_5H2Value ((4,2) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z3_0_5Half_sound 2) ((4,2) : PairSlot)) Z3_0_5H2E_4_2Log_sound) (by decide +kernel) +def Z3_0_5H2E_4_3LogWitness : LogWitness := ⟨-5, 1196792319364647093404227846989, 781250000000000000000000000000⟩ +def Z3_0_5H2E_4_3Log : Ball := ⟨(-303923091429389405573792044041373 / 100000000000000000000000000000000), (63527471101 / 50000000000000000000000000000000)⟩ +lemma Z3_0_5H2E_4_3Log_sound : Z3_0_5H2E_4_3Log.Encloses (Real.log (Z3_0_5H2Value ((4,3) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound ((Z3_0_5Half_sound 2) ((4,3) : PairSlot)) (w := Z3_0_5H2E_4_3LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z3_0_5H2E_4_3 : Ball := ⟨(1454931286001010573435377377673 / 10000000000000000000000000000000), (3041167587 / 50000000000000000000000000000000)⟩ +lemma Z3_0_5H2E_4_3_sound : Z3_0_5H2E_4_3.Encloses (Foundation.entropyTerm (Z3_0_5H2Value ((4,3) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z3_0_5Half_sound 2) ((4,3) : PairSlot)) Z3_0_5H2E_4_3Log_sound) (by decide +kernel) +def Z3_0_5H2E_5_1LogWitness : LogWitness := ⟨-5, 3851794993380545981064826935537, 3125000000000000000000000000000⟩ +def Z3_0_5H2E_5_1Log : Ball := ⟨(-2605304731435115244590336352331 / 800000000000000000000000000000), (127054942357 / 100000000000000000000000000000000)⟩ +lemma Z3_0_5H2E_5_1Log_sound : Z3_0_5H2E_5_1Log.Encloses (Real.log (Z3_0_5H2Value ((5,1) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound ((Z3_0_5Half_sound 2) ((5,1) : PairSlot)) (w := Z3_0_5H2E_5_1LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z3_0_5H2E_5_1 : Ball := ⟨(6271937325482765530304899555359 / 50000000000000000000000000000000), (2446947971 / 50000000000000000000000000000000)⟩ +lemma Z3_0_5H2E_5_1_sound : Z3_0_5H2E_5_1.Encloses (Foundation.entropyTerm (Z3_0_5H2Value ((5,1) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z3_0_5Half_sound 2) ((5,1) : PairSlot)) Z3_0_5H2E_5_1Log_sound) (by decide +kernel) +def Z3_0_5H2Terms (a : PairSlot) : Ball := + match a.1.val, a.2.val with + | 1, 5 => ⟨(6271937325482765530304899555359 / 50000000000000000000000000000000), (2446947971 / 50000000000000000000000000000000)⟩ + | 2, 4 => ⟨(36514800988917506010651666724087 / 100000000000000000000000000000000), (26275620159 / 100000000000000000000000000000000)⟩ + | 3, 4 => ⟨(1454931286001010573435377377673 / 10000000000000000000000000000000), (3041167587 / 50000000000000000000000000000000)⟩ + | 4, 2 => ⟨(36514800988917506010651666724087 / 100000000000000000000000000000000), (26275620159 / 100000000000000000000000000000000)⟩ + | 4, 3 => ⟨(1454931286001010573435377377673 / 10000000000000000000000000000000), (3041167587 / 50000000000000000000000000000000)⟩ + | 5, 1 => ⟨(6271937325482765530304899555359 / 50000000000000000000000000000000), (2446947971 / 50000000000000000000000000000000)⟩ + | _, _ => (.exact 0) +lemma Z3_0_5H2Terms_sound (a : PairSlot) : + (Z3_0_5H2Terms a).Encloses (Foundation.entropyTerm (Z3_0_5H2Value a)) := by + rcases a with ⟨i,j⟩ + revert j i + apply forall_fin6 + · exact forall_fin6 (entropyTerm_zero_ball ((Z3_0_5Half_sound 2) ((0,0) : PairSlot))) (entropyTerm_zero_ball ((Z3_0_5Half_sound 2) ((0,1) : PairSlot))) (entropyTerm_zero_ball ((Z3_0_5Half_sound 2) ((0,2) : PairSlot))) (entropyTerm_zero_ball ((Z3_0_5Half_sound 2) ((0,3) : PairSlot))) (entropyTerm_zero_ball ((Z3_0_5Half_sound 2) ((0,4) : PairSlot))) (entropyTerm_zero_ball ((Z3_0_5Half_sound 2) ((0,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z3_0_5Half_sound 2) ((1,0) : PairSlot))) (entropyTerm_zero_ball ((Z3_0_5Half_sound 2) ((1,1) : PairSlot))) (entropyTerm_zero_ball ((Z3_0_5Half_sound 2) ((1,2) : PairSlot))) (entropyTerm_zero_ball ((Z3_0_5Half_sound 2) ((1,3) : PairSlot))) (entropyTerm_zero_ball ((Z3_0_5Half_sound 2) ((1,4) : PairSlot))) Z3_0_5H2E_1_5_sound + · exact forall_fin6 (entropyTerm_zero_ball ((Z3_0_5Half_sound 2) ((2,0) : PairSlot))) (entropyTerm_zero_ball ((Z3_0_5Half_sound 2) ((2,1) : PairSlot))) (entropyTerm_zero_ball ((Z3_0_5Half_sound 2) ((2,2) : PairSlot))) (entropyTerm_zero_ball ((Z3_0_5Half_sound 2) ((2,3) : PairSlot))) Z3_0_5H2E_2_4_sound (entropyTerm_zero_ball ((Z3_0_5Half_sound 2) ((2,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z3_0_5Half_sound 2) ((3,0) : PairSlot))) (entropyTerm_zero_ball ((Z3_0_5Half_sound 2) ((3,1) : PairSlot))) (entropyTerm_zero_ball ((Z3_0_5Half_sound 2) ((3,2) : PairSlot))) (entropyTerm_zero_ball ((Z3_0_5Half_sound 2) ((3,3) : PairSlot))) Z3_0_5H2E_3_4_sound (entropyTerm_zero_ball ((Z3_0_5Half_sound 2) ((3,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z3_0_5Half_sound 2) ((4,0) : PairSlot))) (entropyTerm_zero_ball ((Z3_0_5Half_sound 2) ((4,1) : PairSlot))) Z3_0_5H2E_4_2_sound Z3_0_5H2E_4_3_sound (entropyTerm_zero_ball ((Z3_0_5Half_sound 2) ((4,4) : PairSlot))) (entropyTerm_zero_ball ((Z3_0_5Half_sound 2) ((4,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z3_0_5Half_sound 2) ((5,0) : PairSlot))) Z3_0_5H2E_5_1_sound (entropyTerm_zero_ball ((Z3_0_5Half_sound 2) ((5,2) : PairSlot))) (entropyTerm_zero_ball ((Z3_0_5Half_sound 2) ((5,3) : PairSlot))) (entropyTerm_zero_ball ((Z3_0_5Half_sound 2) ((5,4) : PairSlot))) (entropyTerm_zero_ball ((Z3_0_5Half_sound 2) ((5,5) : PairSlot))) +def Z3_0_5H2Entropy : Ball := ⟨(12721597699978628561123047922307 / 10000000000000000000000000000000), (1490074051 / 2000000000000000000000000000000)⟩ +lemma Z3_0_5H2Entropy_sound : Z3_0_5H2Entropy.Encloses (Foundation.finiteEntropy Z3_0_5H2Value) := by + exact contains_sound (entropyPair_enclosed Z3_0_5H2Value Z3_0_5H2Terms Z3_0_5H2Terms_sound) (by decide +kernel) +def Z3_0_5H2Mass : Ball := ⟨1, (1 / 500000000000000000000000000000)⟩ +lemma Z3_0_5H2Mass_sound : Z3_0_5H2Mass.Encloses (∑ a, Z3_0_5H2Value a) := by + exact contains_sound (pairSumBall_sound (Z3_0_5Half 2) Z3_0_5H2Value (Z3_0_5Half_sound 2)) (by decide +kernel) +def Z3_0_5H2MassTermLogWitness : LogWitness := ⟨0, 1, 1⟩ +def Z3_0_5H2MassTermLog : Ball := ⟨0, (10587911941 / 50000000000000000000000000000000)⟩ +lemma Z3_0_5H2MassTermLog_sound : Z3_0_5H2MassTermLog.Encloses (Real.log ((∑ a, Z3_0_5H2Value a))) := by + exact checkLog_sound logTwoBall_sound (Z3_0_5H2Mass_sound) (w := Z3_0_5H2MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z3_0_5H2MassTerm : Ball := ⟨0, (21175823883 / 100000000000000000000000000000000)⟩ +lemma Z3_0_5H2MassTerm_sound : Z3_0_5H2MassTerm.Encloses (Foundation.entropyTerm ((∑ a, Z3_0_5H2Value a))) := by + exact contains_sound (entropyTerm_ball (Z3_0_5H2Mass_sound) Z3_0_5H2MassTermLog_sound) (by decide +kernel) +def Z3_0_5H2H : Ball := ⟨(12721597699978628561123047922307 / 10000000000000000000000000000000), (95679526433 / 100000000000000000000000000000000)⟩ +lemma Z3_0_5H2H_sound : Z3_0_5H2H.Encloses (homogeneousEntropy Z3_0_5H2Value) := by + exact contains_sound (homogeneous_enclosed Z3_0_5H2Value Z3_0_5H2MassTerm_sound Z3_0_5H2Entropy_sound) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/Certificates/Four3_5_0.lean b/lean/OAI/LinearAlgebra/MatrixFields/Certificates/Four3_5_0.lean new file mode 100644 index 0000000000000000000000000000000000000000..4b0055cf4020dea55b3212356745b89ba3a4eb9b --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/Certificates/Four3_5_0.lean @@ -0,0 +1,604 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Certificates.Four0_3_5 + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def Z3_5_0Raw (ij : PairSlot) : Ball := + match ij.1.val, ij.2.val with + | 0, 0 => w195 + | 0, 1 => w195 + | 0, 2 => w195 + | 0, 3 => w195 + | 0, 4 => w195 + | 0, 5 => w195 + | 1, 0 => w195 + | 1, 1 => w195 + | 1, 2 => w195 + | 1, 3 => w195 + | 1, 4 => w195 + | 1, 5 => w165 + | 2, 0 => w195 + | 2, 1 => w195 + | 2, 2 => w195 + | 2, 3 => w195 + | 2, 4 => w207 + | 2, 5 => w195 + | 3, 0 => w195 + | 3, 1 => w195 + | 3, 2 => w195 + | 3, 3 => w195 + | 3, 4 => w195 + | 3, 5 => w195 + | 4, 0 => w195 + | 4, 1 => w195 + | 4, 2 => w207 + | 4, 3 => w195 + | 4, 4 => w195 + | 4, 5 => w195 + | 5, 0 => w195 + | 5, 1 => w165 + | 5, 2 => w195 + | 5, 3 => w195 + | 5, 4 => w195 + | 5, 5 => w195 + | _, _ => (.exact 0) +lemma Z3_5_0Raw_sound_0 (j : Fin 6) : + (Z3_5_0Raw (0,j)).Encloses (weight (orderedPairInteger (shape 3 5 0) 0 j) : ℝ) := by + fin_cases j + · change (Z3_5_0Raw (0,0)).Encloses (weight (orderedPairInteger (shape 3 5 0) 0 0) : ℝ) + have he : orderedPairInteger (shape 3 5 0) 0 0 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z3_5_0Raw (0,1)).Encloses (weight (orderedPairInteger (shape 3 5 0) 0 1) : ℝ) + have he : orderedPairInteger (shape 3 5 0) 0 1 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z3_5_0Raw (0,2)).Encloses (weight (orderedPairInteger (shape 3 5 0) 0 2) : ℝ) + have he : orderedPairInteger (shape 3 5 0) 0 2 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z3_5_0Raw (0,3)).Encloses (weight (orderedPairInteger (shape 3 5 0) 0 3) : ℝ) + have he : orderedPairInteger (shape 3 5 0) 0 3 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z3_5_0Raw (0,4)).Encloses (weight (orderedPairInteger (shape 3 5 0) 0 4) : ℝ) + have he : orderedPairInteger (shape 3 5 0) 0 4 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z3_5_0Raw (0,5)).Encloses (weight (orderedPairInteger (shape 3 5 0) 0 5) : ℝ) + have he : orderedPairInteger (shape 3 5 0) 0 5 = (0) := by decide +kernel + rw [he] + exact w195_sound +lemma Z3_5_0Raw_sound_1 (j : Fin 6) : + (Z3_5_0Raw (1,j)).Encloses (weight (orderedPairInteger (shape 3 5 0) 1 j) : ℝ) := by + fin_cases j + · change (Z3_5_0Raw (1,0)).Encloses (weight (orderedPairInteger (shape 3 5 0) 1 0) : ℝ) + have he : orderedPairInteger (shape 3 5 0) 1 0 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z3_5_0Raw (1,1)).Encloses (weight (orderedPairInteger (shape 3 5 0) 1 1) : ℝ) + have he : orderedPairInteger (shape 3 5 0) 1 1 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z3_5_0Raw (1,2)).Encloses (weight (orderedPairInteger (shape 3 5 0) 1 2) : ℝ) + have he : orderedPairInteger (shape 3 5 0) 1 2 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z3_5_0Raw (1,3)).Encloses (weight (orderedPairInteger (shape 3 5 0) 1 3) : ℝ) + have he : orderedPairInteger (shape 3 5 0) 1 3 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z3_5_0Raw (1,4)).Encloses (weight (orderedPairInteger (shape 3 5 0) 1 4) : ℝ) + have he : orderedPairInteger (shape 3 5 0) 1 4 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z3_5_0Raw (1,5)).Encloses (weight (orderedPairInteger (shape 3 5 0) 1 5) : ℝ) + have he : orderedPairInteger (shape 3 5 0) 1 5 = (-5587) := by decide +kernel + rw [he] + exact w165_sound +lemma Z3_5_0Raw_sound_2 (j : Fin 6) : + (Z3_5_0Raw (2,j)).Encloses (weight (orderedPairInteger (shape 3 5 0) 2 j) : ℝ) := by + fin_cases j + · change (Z3_5_0Raw (2,0)).Encloses (weight (orderedPairInteger (shape 3 5 0) 2 0) : ℝ) + have he : orderedPairInteger (shape 3 5 0) 2 0 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z3_5_0Raw (2,1)).Encloses (weight (orderedPairInteger (shape 3 5 0) 2 1) : ℝ) + have he : orderedPairInteger (shape 3 5 0) 2 1 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z3_5_0Raw (2,2)).Encloses (weight (orderedPairInteger (shape 3 5 0) 2 2) : ℝ) + have he : orderedPairInteger (shape 3 5 0) 2 2 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z3_5_0Raw (2,3)).Encloses (weight (orderedPairInteger (shape 3 5 0) 2 3) : ℝ) + have he : orderedPairInteger (shape 3 5 0) 2 3 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z3_5_0Raw (2,4)).Encloses (weight (orderedPairInteger (shape 3 5 0) 2 4) : ℝ) + have he : orderedPairInteger (shape 3 5 0) 2 4 = (22521) := by decide +kernel + rw [he] + exact w207_sound + · change (Z3_5_0Raw (2,5)).Encloses (weight (orderedPairInteger (shape 3 5 0) 2 5) : ℝ) + have he : orderedPairInteger (shape 3 5 0) 2 5 = (0) := by decide +kernel + rw [he] + exact w195_sound +lemma Z3_5_0Raw_sound_3 (j : Fin 6) : + (Z3_5_0Raw (3,j)).Encloses (weight (orderedPairInteger (shape 3 5 0) 3 j) : ℝ) := by + fin_cases j + · change (Z3_5_0Raw (3,0)).Encloses (weight (orderedPairInteger (shape 3 5 0) 3 0) : ℝ) + have he : orderedPairInteger (shape 3 5 0) 3 0 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z3_5_0Raw (3,1)).Encloses (weight (orderedPairInteger (shape 3 5 0) 3 1) : ℝ) + have he : orderedPairInteger (shape 3 5 0) 3 1 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z3_5_0Raw (3,2)).Encloses (weight (orderedPairInteger (shape 3 5 0) 3 2) : ℝ) + have he : orderedPairInteger (shape 3 5 0) 3 2 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z3_5_0Raw (3,3)).Encloses (weight (orderedPairInteger (shape 3 5 0) 3 3) : ℝ) + have he : orderedPairInteger (shape 3 5 0) 3 3 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z3_5_0Raw (3,4)).Encloses (weight (orderedPairInteger (shape 3 5 0) 3 4) : ℝ) + have he : orderedPairInteger (shape 3 5 0) 3 4 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z3_5_0Raw (3,5)).Encloses (weight (orderedPairInteger (shape 3 5 0) 3 5) : ℝ) + have he : orderedPairInteger (shape 3 5 0) 3 5 = (0) := by decide +kernel + rw [he] + exact w195_sound +lemma Z3_5_0Raw_sound_4 (j : Fin 6) : + (Z3_5_0Raw (4,j)).Encloses (weight (orderedPairInteger (shape 3 5 0) 4 j) : ℝ) := by + fin_cases j + · change (Z3_5_0Raw (4,0)).Encloses (weight (orderedPairInteger (shape 3 5 0) 4 0) : ℝ) + have he : orderedPairInteger (shape 3 5 0) 4 0 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z3_5_0Raw (4,1)).Encloses (weight (orderedPairInteger (shape 3 5 0) 4 1) : ℝ) + have he : orderedPairInteger (shape 3 5 0) 4 1 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z3_5_0Raw (4,2)).Encloses (weight (orderedPairInteger (shape 3 5 0) 4 2) : ℝ) + have he : orderedPairInteger (shape 3 5 0) 4 2 = (22521) := by decide +kernel + rw [he] + exact w207_sound + · change (Z3_5_0Raw (4,3)).Encloses (weight (orderedPairInteger (shape 3 5 0) 4 3) : ℝ) + have he : orderedPairInteger (shape 3 5 0) 4 3 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z3_5_0Raw (4,4)).Encloses (weight (orderedPairInteger (shape 3 5 0) 4 4) : ℝ) + have he : orderedPairInteger (shape 3 5 0) 4 4 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z3_5_0Raw (4,5)).Encloses (weight (orderedPairInteger (shape 3 5 0) 4 5) : ℝ) + have he : orderedPairInteger (shape 3 5 0) 4 5 = (0) := by decide +kernel + rw [he] + exact w195_sound +lemma Z3_5_0Raw_sound_5 (j : Fin 6) : + (Z3_5_0Raw (5,j)).Encloses (weight (orderedPairInteger (shape 3 5 0) 5 j) : ℝ) := by + fin_cases j + · change (Z3_5_0Raw (5,0)).Encloses (weight (orderedPairInteger (shape 3 5 0) 5 0) : ℝ) + have he : orderedPairInteger (shape 3 5 0) 5 0 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z3_5_0Raw (5,1)).Encloses (weight (orderedPairInteger (shape 3 5 0) 5 1) : ℝ) + have he : orderedPairInteger (shape 3 5 0) 5 1 = (-5587) := by decide +kernel + rw [he] + exact w165_sound + · change (Z3_5_0Raw (5,2)).Encloses (weight (orderedPairInteger (shape 3 5 0) 5 2) : ℝ) + have he : orderedPairInteger (shape 3 5 0) 5 2 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z3_5_0Raw (5,3)).Encloses (weight (orderedPairInteger (shape 3 5 0) 5 3) : ℝ) + have he : orderedPairInteger (shape 3 5 0) 5 3 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z3_5_0Raw (5,4)).Encloses (weight (orderedPairInteger (shape 3 5 0) 5 4) : ℝ) + have he : orderedPairInteger (shape 3 5 0) 5 4 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z3_5_0Raw (5,5)).Encloses (weight (orderedPairInteger (shape 3 5 0) 5 5) : ℝ) + have he : orderedPairInteger (shape 3 5 0) 5 5 = (0) := by decide +kernel + rw [he] + exact w195_sound +lemma Z3_5_0Raw_sound (ij : PairSlot) : + (Z3_5_0Raw ij).Encloses (weight (orderedPairInteger (shape 3 5 0) ij.1 ij.2) : ℝ) := by + rcases ij with ⟨i,j⟩ + revert i + exact forall_fin6 (Z3_5_0Raw_sound_0 j) (Z3_5_0Raw_sound_1 j) (Z3_5_0Raw_sound_2 j) (Z3_5_0Raw_sound_3 j) (Z3_5_0Raw_sound_4 j) (Z3_5_0Raw_sound_5 j) +def Z3_5_0Den : Ball := ⟨(1107963313523711256690127341051801 / 50000000000000000000000000000000), (1063 / 50000000000000000000000000000000)⟩ +lemma Z3_5_0Den_sound : Z3_5_0Den.Encloses + (((orderedPairs (shape 3 5 0)).map (fun ij => weight (orderedPairInteger (shape 3 5 0) ij.1 ij.2))).sum : ℝ) := by + exact contains_sound (list_cast_enclosed (orderedPairs (shape 3 5 0)) Z3_5_0Raw + (fun ij => weight (orderedPairInteger (shape 3 5 0) ij.1 ij.2)) + (fun ij _ => Z3_5_0Raw_sound ij)) (by decide +kernel) +lemma Z3_5_0Den_pos : 0 < Z3_5_0Den.lower := by decide +kernel +def Z3_5_0Probs (ij : PairSlot) : Ball := + match ij.1.val, ij.2.val with + | 1, 5 => ⟨(645274206658629135363561930529 / 25000000000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ + | 2, 4 => ⟨(21453059186785379874419022991011 / 50000000000000000000000000000000), (87 / 100000000000000000000000000000000)⟩ + | 3, 4 => ⟨(2256392399897361854853853147931 / 50000000000000000000000000000000), (1 / 20000000000000000000000000000000)⟩ + | 4, 2 => ⟨(21453059186785379874419022991011 / 50000000000000000000000000000000), (87 / 100000000000000000000000000000000)⟩ + | 4, 3 => ⟨(2256392399897361854853853147931 / 50000000000000000000000000000000), (1 / 20000000000000000000000000000000)⟩ + | 5, 1 => ⟨(645274206658629135363561930529 / 25000000000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ + | _, _ => (.exact 0) +lemma Z3_5_0Contains : ∀ i j : Fin 6, + statisticWeight i + statisticWeight j = shapeMax (shape 3 5 0) → + contains (.mul (Z3_5_0Raw (i,j)) (.inv Z3_5_0Den)) (Z3_5_0Probs (i,j)) = true := by + decide +kernel +lemma Z3_5_0Zero : ∀ i j : Fin 6, + statisticWeight i + statisticWeight j ≠ shapeMax (shape 3 5 0) → Z3_5_0Probs (i,j) = .exact 0 := by + decide +kernel +lemma Z3_5_0Probs_sound (ij : PairSlot) : + (Z3_5_0Probs ij).Encloses (zeroPairLaw (shape 3 5 0) ij.1 ij.2 : ℝ) := by + by_cases h : statisticWeight ij.1 + statisticWeight ij.2 = shapeMax (shape 3 5 0) + · have hb := contains_sound (Ball.mul_sound (Z3_5_0Raw_sound ij) + (Ball.inv_sound Z3_5_0Den_sound Z3_5_0Den_pos)) (Z3_5_0Contains ij.1 ij.2 h) + simpa only [zeroPairLaw, h, ite_true, Rat.cast_div, Rat.cast_mul, + Rat.cast_inv, div_eq_mul_inv] using hb + · rw [Z3_5_0Zero ij.1 ij.2 h] + simpa only [zeroPairLaw, h, ite_false] using Ball.exact_sound 0 + +def Z3_5_0Half (w : Fin 3) (ij : PairSlot) : Ball := + if (shape 3 5 0) w = 0 then if ij = (0,0) then .exact 1 else .exact 0 + else if w = halfMaxAxis (shape 3 5 0) then Z3_5_0Probs ij + else Z3_5_0Probs (kappa ij.1, kappa ij.2) +lemma Z3_5_0Half_sound (w : Fin 3) (ij : PairSlot) : + (Z3_5_0Half w ij).Encloses (halfLaw (shape 3 5 0) w ij : ℝ) := by + have hp : positive (shape 3 5 0) = false := by decide +kernel + simp only [Z3_5_0Half, halfLaw, hp, Bool.false_eq_true, ite_false] + split_ifs + · exact Ball.exact_sound 1 + · exact Ball.exact_sound 0 + · exact Z3_5_0Probs_sound _ + · exact Z3_5_0Probs_sound _ + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def Z3_5_0Value (a : PairSlot) : ℝ := (zeroPairLaw (shape 3 5 0) a.1 a.2 : ℝ) +def Z3_5_0E_1_5LogWitness : LogWitness := ⟨-6, 645274206658629135363561930529, 390625000000000000000000000000⟩ +def Z3_5_0E_1_5Log : Ball := ⟨(-365695575079275035532022819518357 / 100000000000000000000000000000000), (148230766013 / 100000000000000000000000000000000)⟩ +lemma Z3_5_0E_1_5Log_sound : Z3_5_0E_1_5Log.Encloses (Real.log (Z3_5_0Value ((1,5) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound (Z3_5_0Probs_sound ((1,5) : PairSlot)) (w := Z3_5_0E_1_5LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z3_5_0E_1_5 : Ball := ⟨(1887791376702802768234330198239 / 20000000000000000000000000000000), (191298981 / 5000000000000000000000000000000)⟩ +lemma Z3_5_0E_1_5_sound : Z3_5_0E_1_5.Encloses (Foundation.entropyTerm (Z3_5_0Value ((1,5) : PairSlot))) := by + exact contains_sound (entropyTerm_ball (Z3_5_0Probs_sound ((1,5) : PairSlot)) Z3_5_0E_1_5Log_sound) (by decide +kernel) +def Z3_5_0E_2_4LogWitness : LogWitness := ⟨-2, 21453059186785379874419022991011, 12500000000000000000000000000000⟩ +def Z3_5_0E_2_4Log : Ball := ⟨(-21153893769818758883005723975117 / 25000000000000000000000000000000), (63527471251 / 100000000000000000000000000000000)⟩ +lemma Z3_5_0E_2_4Log_sound : Z3_5_0E_2_4Log.Encloses (Real.log (Z3_5_0Value ((2,4) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound (Z3_5_0Probs_sound ((2,4) : PairSlot)) (w := Z3_5_0E_2_4LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z3_5_0E_2_4 : Ball := ⟨(4538157350748923372425986557083 / 12500000000000000000000000000000), (27257172089 / 100000000000000000000000000000000)⟩ +lemma Z3_5_0E_2_4_sound : Z3_5_0E_2_4.Encloses (Foundation.entropyTerm (Z3_5_0Value ((2,4) : PairSlot))) := by + exact contains_sound (entropyTerm_ball (Z3_5_0Probs_sound ((2,4) : PairSlot)) Z3_5_0E_2_4Log_sound) (by decide +kernel) +def Z3_5_0E_3_4LogWitness : LogWitness := ⟨-5, 2256392399897361854853853147931, 1562500000000000000000000000000⟩ +def Z3_5_0E_3_4Log : Ball := ⟨(-309825575079275035532022838613839 / 100000000000000000000000000000000), (31019273 / 24414062500000000000000000000)⟩ +lemma Z3_5_0E_3_4Log_sound : Z3_5_0E_3_4Log.Encloses (Real.log (Z3_5_0Value ((3,4) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound (Z3_5_0Probs_sound ((3,4) : PairSlot)) (w := Z3_5_0E_3_4LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z3_5_0E_3_4 : Ball := ⟨(13981761458054113306784224791891 / 100000000000000000000000000000000), (716714517 / 12500000000000000000000000000000)⟩ +lemma Z3_5_0E_3_4_sound : Z3_5_0E_3_4.Encloses (Foundation.entropyTerm (Z3_5_0Value ((3,4) : PairSlot))) := by + exact contains_sound (entropyTerm_ball (Z3_5_0Probs_sound ((3,4) : PairSlot)) Z3_5_0E_3_4Log_sound) (by decide +kernel) +def Z3_5_0E_4_2LogWitness : LogWitness := ⟨-2, 21453059186785379874419022991011, 12500000000000000000000000000000⟩ +def Z3_5_0E_4_2Log : Ball := ⟨(-21153893769818758883005723975117 / 25000000000000000000000000000000), (63527471251 / 100000000000000000000000000000000)⟩ +lemma Z3_5_0E_4_2Log_sound : Z3_5_0E_4_2Log.Encloses (Real.log (Z3_5_0Value ((4,2) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound (Z3_5_0Probs_sound ((4,2) : PairSlot)) (w := Z3_5_0E_4_2LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z3_5_0E_4_2 : Ball := ⟨(4538157350748923372425986557083 / 12500000000000000000000000000000), (27257172089 / 100000000000000000000000000000000)⟩ +lemma Z3_5_0E_4_2_sound : Z3_5_0E_4_2.Encloses (Foundation.entropyTerm (Z3_5_0Value ((4,2) : PairSlot))) := by + exact contains_sound (entropyTerm_ball (Z3_5_0Probs_sound ((4,2) : PairSlot)) Z3_5_0E_4_2Log_sound) (by decide +kernel) +def Z3_5_0E_4_3LogWitness : LogWitness := ⟨-5, 2256392399897361854853853147931, 1562500000000000000000000000000⟩ +def Z3_5_0E_4_3Log : Ball := ⟨(-309825575079275035532022838613839 / 100000000000000000000000000000000), (31019273 / 24414062500000000000000000000)⟩ +lemma Z3_5_0E_4_3Log_sound : Z3_5_0E_4_3Log.Encloses (Real.log (Z3_5_0Value ((4,3) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound (Z3_5_0Probs_sound ((4,3) : PairSlot)) (w := Z3_5_0E_4_3LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z3_5_0E_4_3 : Ball := ⟨(13981761458054113306784224791891 / 100000000000000000000000000000000), (716714517 / 12500000000000000000000000000000)⟩ +lemma Z3_5_0E_4_3_sound : Z3_5_0E_4_3.Encloses (Foundation.entropyTerm (Z3_5_0Value ((4,3) : PairSlot))) := by + exact contains_sound (entropyTerm_ball (Z3_5_0Probs_sound ((4,3) : PairSlot)) Z3_5_0E_4_3Log_sound) (by decide +kernel) +def Z3_5_0E_5_1LogWitness : LogWitness := ⟨-6, 645274206658629135363561930529, 390625000000000000000000000000⟩ +def Z3_5_0E_5_1Log : Ball := ⟨(-365695575079275035532022819518357 / 100000000000000000000000000000000), (148230766013 / 100000000000000000000000000000000)⟩ +lemma Z3_5_0E_5_1Log_sound : Z3_5_0E_5_1Log.Encloses (Real.log (Z3_5_0Value ((5,1) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound (Z3_5_0Probs_sound ((5,1) : PairSlot)) (w := Z3_5_0E_5_1LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z3_5_0E_5_1 : Ball := ⟨(1887791376702802768234330198239 / 20000000000000000000000000000000), (191298981 / 5000000000000000000000000000000)⟩ +lemma Z3_5_0E_5_1_sound : Z3_5_0E_5_1.Encloses (Foundation.entropyTerm (Z3_5_0Value ((5,1) : PairSlot))) := by + exact contains_sound (entropyTerm_ball (Z3_5_0Probs_sound ((5,1) : PairSlot)) Z3_5_0E_5_1Log_sound) (by decide +kernel) +def Z3_5_0Terms (a : PairSlot) : Ball := + match a.1.val, a.2.val with + | 1, 5 => ⟨(1887791376702802768234330198239 / 20000000000000000000000000000000), (191298981 / 5000000000000000000000000000000)⟩ + | 2, 4 => ⟨(4538157350748923372425986557083 / 12500000000000000000000000000000), (27257172089 / 100000000000000000000000000000000)⟩ + | 3, 4 => ⟨(13981761458054113306784224791891 / 100000000000000000000000000000000), (716714517 / 12500000000000000000000000000000)⟩ + | 4, 2 => ⟨(4538157350748923372425986557083 / 12500000000000000000000000000000), (27257172089 / 100000000000000000000000000000000)⟩ + | 4, 3 => ⟨(13981761458054113306784224791891 / 100000000000000000000000000000000), (716714517 / 12500000000000000000000000000000)⟩ + | 5, 1 => ⟨(1887791376702802768234330198239 / 20000000000000000000000000000000), (191298981 / 5000000000000000000000000000000)⟩ + | _, _ => (.exact 0) +lemma Z3_5_0Terms_sound (a : PairSlot) : + (Z3_5_0Terms a).Encloses (Foundation.entropyTerm (Z3_5_0Value a)) := by + rcases a with ⟨i,j⟩ + revert j i + apply forall_fin6 + · exact forall_fin6 (entropyTerm_zero_ball (Z3_5_0Probs_sound ((0,0) : PairSlot))) (entropyTerm_zero_ball (Z3_5_0Probs_sound ((0,1) : PairSlot))) (entropyTerm_zero_ball (Z3_5_0Probs_sound ((0,2) : PairSlot))) (entropyTerm_zero_ball (Z3_5_0Probs_sound ((0,3) : PairSlot))) (entropyTerm_zero_ball (Z3_5_0Probs_sound ((0,4) : PairSlot))) (entropyTerm_zero_ball (Z3_5_0Probs_sound ((0,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball (Z3_5_0Probs_sound ((1,0) : PairSlot))) (entropyTerm_zero_ball (Z3_5_0Probs_sound ((1,1) : PairSlot))) (entropyTerm_zero_ball (Z3_5_0Probs_sound ((1,2) : PairSlot))) (entropyTerm_zero_ball (Z3_5_0Probs_sound ((1,3) : PairSlot))) (entropyTerm_zero_ball (Z3_5_0Probs_sound ((1,4) : PairSlot))) Z3_5_0E_1_5_sound + · exact forall_fin6 (entropyTerm_zero_ball (Z3_5_0Probs_sound ((2,0) : PairSlot))) (entropyTerm_zero_ball (Z3_5_0Probs_sound ((2,1) : PairSlot))) (entropyTerm_zero_ball (Z3_5_0Probs_sound ((2,2) : PairSlot))) (entropyTerm_zero_ball (Z3_5_0Probs_sound ((2,3) : PairSlot))) Z3_5_0E_2_4_sound (entropyTerm_zero_ball (Z3_5_0Probs_sound ((2,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball (Z3_5_0Probs_sound ((3,0) : PairSlot))) (entropyTerm_zero_ball (Z3_5_0Probs_sound ((3,1) : PairSlot))) (entropyTerm_zero_ball (Z3_5_0Probs_sound ((3,2) : PairSlot))) (entropyTerm_zero_ball (Z3_5_0Probs_sound ((3,3) : PairSlot))) Z3_5_0E_3_4_sound (entropyTerm_zero_ball (Z3_5_0Probs_sound ((3,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball (Z3_5_0Probs_sound ((4,0) : PairSlot))) (entropyTerm_zero_ball (Z3_5_0Probs_sound ((4,1) : PairSlot))) Z3_5_0E_4_2_sound Z3_5_0E_4_3_sound (entropyTerm_zero_ball (Z3_5_0Probs_sound ((4,4) : PairSlot))) (entropyTerm_zero_ball (Z3_5_0Probs_sound ((4,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball (Z3_5_0Probs_sound ((5,0) : PairSlot))) Z3_5_0E_5_1_sound (entropyTerm_zero_ball (Z3_5_0Probs_sound ((5,2) : PairSlot))) (entropyTerm_zero_ball (Z3_5_0Probs_sound ((5,3) : PairSlot))) (entropyTerm_zero_ball (Z3_5_0Probs_sound ((5,4) : PairSlot))) (entropyTerm_zero_ball (Z3_5_0Probs_sound ((5,5) : PairSlot))) +def Z3_5_0Entropy : Ball := ⟨(238903908590238056509455072959 / 200000000000000000000000000000), (7363373569 / 10000000000000000000000000000000)⟩ +lemma Z3_5_0Entropy_sound : Z3_5_0Entropy.Encloses (Foundation.finiteEntropy Z3_5_0Value) := by + exact contains_sound (entropyPair_enclosed Z3_5_0Value Z3_5_0Terms Z3_5_0Terms_sound) (by decide +kernel) +def Z3_5_0Labels : Ball := ⟨(256366745881774017426327259984771 / 50000000000000000000000000000000), (19912540783 / 12500000000000000000000000000000)⟩ +lemma Z3_5_0Labels_sound : Z3_5_0Labels.Encloses + (∑ a : PairSlot, (zeroPairLaw (shape 3 5 0) a.1 a.2 : ℝ) * + Real.log (AllFieldParameters.multiplicity a.1 * AllFieldParameters.multiplicity a.2 : ℕ)) := by + exact contains_sound (pairSumBall_sound (fun a => .mul (Z3_5_0Probs a) (multLogs a)) + _ (fun a => Ball.mul_sound (Z3_5_0Probs_sound a) (multLogs_sound a))) (by decide +kernel) +def Z3_5_0Four : Ball := ⟨(316092723029333531553691028224521 / 50000000000000000000000000000000), (116467030977 / 50000000000000000000000000000000)⟩ +lemma Z3_5_0Four_sound : Z3_5_0Four.Encloses (AllFieldZeroLeafRates.fourRate (shape 3 5 0)) := by + exact contains_sound (Ball.add_sound Z3_5_0Entropy_sound Z3_5_0Labels_sound) (by decide +kernel) +def Z3_5_0H0Value (a : PairSlot) : ℝ := (halfLaw (shape 3 5 0) 0 a : ℝ) +def Z3_5_0H0E_4_0LogWitness : LogWitness := ⟨-6, 645274206658629135363561930529, 390625000000000000000000000000⟩ +def Z3_5_0H0E_4_0Log : Ball := ⟨(-365695575079275035532022819518357 / 100000000000000000000000000000000), (148230766013 / 100000000000000000000000000000000)⟩ +lemma Z3_5_0H0E_4_0Log_sound : Z3_5_0H0E_4_0Log.Encloses (Real.log (Z3_5_0H0Value ((4,0) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound ((Z3_5_0Half_sound 0) ((4,0) : PairSlot)) (w := Z3_5_0H0E_4_0LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z3_5_0H0E_4_0 : Ball := ⟨(1887791376702802768234330198239 / 20000000000000000000000000000000), (191298981 / 5000000000000000000000000000000)⟩ +lemma Z3_5_0H0E_4_0_sound : Z3_5_0H0E_4_0.Encloses (Foundation.entropyTerm (Z3_5_0H0Value ((4,0) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z3_5_0Half_sound 0) ((4,0) : PairSlot)) Z3_5_0H0E_4_0Log_sound) (by decide +kernel) +def Z3_5_0H0E_2_1LogWitness : LogWitness := ⟨-2, 21453059186785379874419022991011, 12500000000000000000000000000000⟩ +def Z3_5_0H0E_2_1Log : Ball := ⟨(-21153893769818758883005723975117 / 25000000000000000000000000000000), (63527471251 / 100000000000000000000000000000000)⟩ +lemma Z3_5_0H0E_2_1Log_sound : Z3_5_0H0E_2_1Log.Encloses (Real.log (Z3_5_0H0Value ((2,1) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound ((Z3_5_0Half_sound 0) ((2,1) : PairSlot)) (w := Z3_5_0H0E_2_1LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z3_5_0H0E_2_1 : Ball := ⟨(4538157350748923372425986557083 / 12500000000000000000000000000000), (27257172089 / 100000000000000000000000000000000)⟩ +lemma Z3_5_0H0E_2_1_sound : Z3_5_0H0E_2_1.Encloses (Foundation.entropyTerm (Z3_5_0H0Value ((2,1) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z3_5_0Half_sound 0) ((2,1) : PairSlot)) Z3_5_0H0E_2_1Log_sound) (by decide +kernel) +def Z3_5_0H0E_3_1LogWitness : LogWitness := ⟨-5, 2256392399897361854853853147931, 1562500000000000000000000000000⟩ +def Z3_5_0H0E_3_1Log : Ball := ⟨(-309825575079275035532022838613839 / 100000000000000000000000000000000), (31019273 / 24414062500000000000000000000)⟩ +lemma Z3_5_0H0E_3_1Log_sound : Z3_5_0H0E_3_1Log.Encloses (Real.log (Z3_5_0H0Value ((3,1) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound ((Z3_5_0Half_sound 0) ((3,1) : PairSlot)) (w := Z3_5_0H0E_3_1LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z3_5_0H0E_3_1 : Ball := ⟨(13981761458054113306784224791891 / 100000000000000000000000000000000), (716714517 / 12500000000000000000000000000000)⟩ +lemma Z3_5_0H0E_3_1_sound : Z3_5_0H0E_3_1.Encloses (Foundation.entropyTerm (Z3_5_0H0Value ((3,1) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z3_5_0Half_sound 0) ((3,1) : PairSlot)) Z3_5_0H0E_3_1Log_sound) (by decide +kernel) +def Z3_5_0H0E_1_2LogWitness : LogWitness := ⟨-2, 21453059186785379874419022991011, 12500000000000000000000000000000⟩ +def Z3_5_0H0E_1_2Log : Ball := ⟨(-21153893769818758883005723975117 / 25000000000000000000000000000000), (63527471251 / 100000000000000000000000000000000)⟩ +lemma Z3_5_0H0E_1_2Log_sound : Z3_5_0H0E_1_2Log.Encloses (Real.log (Z3_5_0H0Value ((1,2) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound ((Z3_5_0Half_sound 0) ((1,2) : PairSlot)) (w := Z3_5_0H0E_1_2LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z3_5_0H0E_1_2 : Ball := ⟨(4538157350748923372425986557083 / 12500000000000000000000000000000), (27257172089 / 100000000000000000000000000000000)⟩ +lemma Z3_5_0H0E_1_2_sound : Z3_5_0H0E_1_2.Encloses (Foundation.entropyTerm (Z3_5_0H0Value ((1,2) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z3_5_0Half_sound 0) ((1,2) : PairSlot)) Z3_5_0H0E_1_2Log_sound) (by decide +kernel) +def Z3_5_0H0E_1_3LogWitness : LogWitness := ⟨-5, 2256392399897361854853853147931, 1562500000000000000000000000000⟩ +def Z3_5_0H0E_1_3Log : Ball := ⟨(-309825575079275035532022838613839 / 100000000000000000000000000000000), (31019273 / 24414062500000000000000000000)⟩ +lemma Z3_5_0H0E_1_3Log_sound : Z3_5_0H0E_1_3Log.Encloses (Real.log (Z3_5_0H0Value ((1,3) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound ((Z3_5_0Half_sound 0) ((1,3) : PairSlot)) (w := Z3_5_0H0E_1_3LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z3_5_0H0E_1_3 : Ball := ⟨(13981761458054113306784224791891 / 100000000000000000000000000000000), (716714517 / 12500000000000000000000000000000)⟩ +lemma Z3_5_0H0E_1_3_sound : Z3_5_0H0E_1_3.Encloses (Foundation.entropyTerm (Z3_5_0H0Value ((1,3) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z3_5_0Half_sound 0) ((1,3) : PairSlot)) Z3_5_0H0E_1_3Log_sound) (by decide +kernel) +def Z3_5_0H0E_0_4LogWitness : LogWitness := ⟨-6, 645274206658629135363561930529, 390625000000000000000000000000⟩ +def Z3_5_0H0E_0_4Log : Ball := ⟨(-365695575079275035532022819518357 / 100000000000000000000000000000000), (148230766013 / 100000000000000000000000000000000)⟩ +lemma Z3_5_0H0E_0_4Log_sound : Z3_5_0H0E_0_4Log.Encloses (Real.log (Z3_5_0H0Value ((0,4) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound ((Z3_5_0Half_sound 0) ((0,4) : PairSlot)) (w := Z3_5_0H0E_0_4LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z3_5_0H0E_0_4 : Ball := ⟨(1887791376702802768234330198239 / 20000000000000000000000000000000), (191298981 / 5000000000000000000000000000000)⟩ +lemma Z3_5_0H0E_0_4_sound : Z3_5_0H0E_0_4.Encloses (Foundation.entropyTerm (Z3_5_0H0Value ((0,4) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z3_5_0Half_sound 0) ((0,4) : PairSlot)) Z3_5_0H0E_0_4Log_sound) (by decide +kernel) +def Z3_5_0H0Terms (a : PairSlot) : Ball := + match a.1.val, a.2.val with + | 4, 0 => ⟨(1887791376702802768234330198239 / 20000000000000000000000000000000), (191298981 / 5000000000000000000000000000000)⟩ + | 2, 1 => ⟨(4538157350748923372425986557083 / 12500000000000000000000000000000), (27257172089 / 100000000000000000000000000000000)⟩ + | 3, 1 => ⟨(13981761458054113306784224791891 / 100000000000000000000000000000000), (716714517 / 12500000000000000000000000000000)⟩ + | 1, 2 => ⟨(4538157350748923372425986557083 / 12500000000000000000000000000000), (27257172089 / 100000000000000000000000000000000)⟩ + | 1, 3 => ⟨(13981761458054113306784224791891 / 100000000000000000000000000000000), (716714517 / 12500000000000000000000000000000)⟩ + | 0, 4 => ⟨(1887791376702802768234330198239 / 20000000000000000000000000000000), (191298981 / 5000000000000000000000000000000)⟩ + | _, _ => (.exact 0) +lemma Z3_5_0H0Terms_sound (a : PairSlot) : + (Z3_5_0H0Terms a).Encloses (Foundation.entropyTerm (Z3_5_0H0Value a)) := by + rcases a with ⟨i,j⟩ + revert j i + apply forall_fin6 + · exact forall_fin6 (entropyTerm_zero_ball ((Z3_5_0Half_sound 0) ((0,0) : PairSlot))) (entropyTerm_zero_ball ((Z3_5_0Half_sound 0) ((0,1) : PairSlot))) (entropyTerm_zero_ball ((Z3_5_0Half_sound 0) ((0,2) : PairSlot))) (entropyTerm_zero_ball ((Z3_5_0Half_sound 0) ((0,3) : PairSlot))) Z3_5_0H0E_0_4_sound (entropyTerm_zero_ball ((Z3_5_0Half_sound 0) ((0,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z3_5_0Half_sound 0) ((1,0) : PairSlot))) (entropyTerm_zero_ball ((Z3_5_0Half_sound 0) ((1,1) : PairSlot))) Z3_5_0H0E_1_2_sound Z3_5_0H0E_1_3_sound (entropyTerm_zero_ball ((Z3_5_0Half_sound 0) ((1,4) : PairSlot))) (entropyTerm_zero_ball ((Z3_5_0Half_sound 0) ((1,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z3_5_0Half_sound 0) ((2,0) : PairSlot))) Z3_5_0H0E_2_1_sound (entropyTerm_zero_ball ((Z3_5_0Half_sound 0) ((2,2) : PairSlot))) (entropyTerm_zero_ball ((Z3_5_0Half_sound 0) ((2,3) : PairSlot))) (entropyTerm_zero_ball ((Z3_5_0Half_sound 0) ((2,4) : PairSlot))) (entropyTerm_zero_ball ((Z3_5_0Half_sound 0) ((2,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z3_5_0Half_sound 0) ((3,0) : PairSlot))) Z3_5_0H0E_3_1_sound (entropyTerm_zero_ball ((Z3_5_0Half_sound 0) ((3,2) : PairSlot))) (entropyTerm_zero_ball ((Z3_5_0Half_sound 0) ((3,3) : PairSlot))) (entropyTerm_zero_ball ((Z3_5_0Half_sound 0) ((3,4) : PairSlot))) (entropyTerm_zero_ball ((Z3_5_0Half_sound 0) ((3,5) : PairSlot))) + · exact forall_fin6 Z3_5_0H0E_4_0_sound (entropyTerm_zero_ball ((Z3_5_0Half_sound 0) ((4,1) : PairSlot))) (entropyTerm_zero_ball ((Z3_5_0Half_sound 0) ((4,2) : PairSlot))) (entropyTerm_zero_ball ((Z3_5_0Half_sound 0) ((4,3) : PairSlot))) (entropyTerm_zero_ball ((Z3_5_0Half_sound 0) ((4,4) : PairSlot))) (entropyTerm_zero_ball ((Z3_5_0Half_sound 0) ((4,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z3_5_0Half_sound 0) ((5,0) : PairSlot))) (entropyTerm_zero_ball ((Z3_5_0Half_sound 0) ((5,1) : PairSlot))) (entropyTerm_zero_ball ((Z3_5_0Half_sound 0) ((5,2) : PairSlot))) (entropyTerm_zero_ball ((Z3_5_0Half_sound 0) ((5,3) : PairSlot))) (entropyTerm_zero_ball ((Z3_5_0Half_sound 0) ((5,4) : PairSlot))) (entropyTerm_zero_ball ((Z3_5_0Half_sound 0) ((5,5) : PairSlot))) +def Z3_5_0H0Entropy : Ball := ⟨(238903908590238056509455072959 / 200000000000000000000000000000), (7363373569 / 10000000000000000000000000000000)⟩ +lemma Z3_5_0H0Entropy_sound : Z3_5_0H0Entropy.Encloses (Foundation.finiteEntropy Z3_5_0H0Value) := by + exact contains_sound (entropyPair_enclosed Z3_5_0H0Value Z3_5_0H0Terms Z3_5_0H0Terms_sound) (by decide +kernel) +def Z3_5_0H0Mass : Ball := ⟨1, (49 / 25000000000000000000000000000000)⟩ +lemma Z3_5_0H0Mass_sound : Z3_5_0H0Mass.Encloses (∑ a, Z3_5_0H0Value a) := by + exact contains_sound (pairSumBall_sound (Z3_5_0Half 0) Z3_5_0H0Value (Z3_5_0Half_sound 0)) (by decide +kernel) +def Z3_5_0H0MassTermLogWitness : LogWitness := ⟨0, 1, 1⟩ +def Z3_5_0H0MassTermLog : Ball := ⟨0, (10587911939 / 50000000000000000000000000000000)⟩ +lemma Z3_5_0H0MassTermLog_sound : Z3_5_0H0MassTermLog.Encloses (Real.log ((∑ a, Z3_5_0H0Value a))) := by + exact checkLog_sound logTwoBall_sound (Z3_5_0H0Mass_sound) (w := Z3_5_0H0MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z3_5_0H0MassTerm : Ball := ⟨0, (21175823879 / 100000000000000000000000000000000)⟩ +lemma Z3_5_0H0MassTerm_sound : Z3_5_0H0MassTerm.Encloses (Foundation.entropyTerm ((∑ a, Z3_5_0H0Value a))) := by + exact contains_sound (entropyTerm_ball (Z3_5_0H0Mass_sound) Z3_5_0H0MassTermLog_sound) (by decide +kernel) +def Z3_5_0H0H : Ball := ⟨(238903908590238056509455072959 / 200000000000000000000000000000), (94809559569 / 100000000000000000000000000000000)⟩ +lemma Z3_5_0H0H_sound : Z3_5_0H0H.Encloses (homogeneousEntropy Z3_5_0H0Value) := by + exact contains_sound (homogeneous_enclosed Z3_5_0H0Value Z3_5_0H0MassTerm_sound Z3_5_0H0Entropy_sound) (by decide +kernel) +def Z3_5_0H1Value (a : PairSlot) : ℝ := (halfLaw (shape 3 5 0) 1 a : ℝ) +def Z3_5_0H1E_1_5LogWitness : LogWitness := ⟨-6, 645274206658629135363561930529, 390625000000000000000000000000⟩ +def Z3_5_0H1E_1_5Log : Ball := ⟨(-365695575079275035532022819518357 / 100000000000000000000000000000000), (148230766013 / 100000000000000000000000000000000)⟩ +lemma Z3_5_0H1E_1_5Log_sound : Z3_5_0H1E_1_5Log.Encloses (Real.log (Z3_5_0H1Value ((1,5) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound ((Z3_5_0Half_sound 1) ((1,5) : PairSlot)) (w := Z3_5_0H1E_1_5LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z3_5_0H1E_1_5 : Ball := ⟨(1887791376702802768234330198239 / 20000000000000000000000000000000), (191298981 / 5000000000000000000000000000000)⟩ +lemma Z3_5_0H1E_1_5_sound : Z3_5_0H1E_1_5.Encloses (Foundation.entropyTerm (Z3_5_0H1Value ((1,5) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z3_5_0Half_sound 1) ((1,5) : PairSlot)) Z3_5_0H1E_1_5Log_sound) (by decide +kernel) +def Z3_5_0H1E_2_4LogWitness : LogWitness := ⟨-2, 21453059186785379874419022991011, 12500000000000000000000000000000⟩ +def Z3_5_0H1E_2_4Log : Ball := ⟨(-21153893769818758883005723975117 / 25000000000000000000000000000000), (63527471251 / 100000000000000000000000000000000)⟩ +lemma Z3_5_0H1E_2_4Log_sound : Z3_5_0H1E_2_4Log.Encloses (Real.log (Z3_5_0H1Value ((2,4) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound ((Z3_5_0Half_sound 1) ((2,4) : PairSlot)) (w := Z3_5_0H1E_2_4LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z3_5_0H1E_2_4 : Ball := ⟨(4538157350748923372425986557083 / 12500000000000000000000000000000), (27257172089 / 100000000000000000000000000000000)⟩ +lemma Z3_5_0H1E_2_4_sound : Z3_5_0H1E_2_4.Encloses (Foundation.entropyTerm (Z3_5_0H1Value ((2,4) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z3_5_0Half_sound 1) ((2,4) : PairSlot)) Z3_5_0H1E_2_4Log_sound) (by decide +kernel) +def Z3_5_0H1E_3_4LogWitness : LogWitness := ⟨-5, 2256392399897361854853853147931, 1562500000000000000000000000000⟩ +def Z3_5_0H1E_3_4Log : Ball := ⟨(-309825575079275035532022838613839 / 100000000000000000000000000000000), (31019273 / 24414062500000000000000000000)⟩ +lemma Z3_5_0H1E_3_4Log_sound : Z3_5_0H1E_3_4Log.Encloses (Real.log (Z3_5_0H1Value ((3,4) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound ((Z3_5_0Half_sound 1) ((3,4) : PairSlot)) (w := Z3_5_0H1E_3_4LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z3_5_0H1E_3_4 : Ball := ⟨(13981761458054113306784224791891 / 100000000000000000000000000000000), (716714517 / 12500000000000000000000000000000)⟩ +lemma Z3_5_0H1E_3_4_sound : Z3_5_0H1E_3_4.Encloses (Foundation.entropyTerm (Z3_5_0H1Value ((3,4) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z3_5_0Half_sound 1) ((3,4) : PairSlot)) Z3_5_0H1E_3_4Log_sound) (by decide +kernel) +def Z3_5_0H1E_4_2LogWitness : LogWitness := ⟨-2, 21453059186785379874419022991011, 12500000000000000000000000000000⟩ +def Z3_5_0H1E_4_2Log : Ball := ⟨(-21153893769818758883005723975117 / 25000000000000000000000000000000), (63527471251 / 100000000000000000000000000000000)⟩ +lemma Z3_5_0H1E_4_2Log_sound : Z3_5_0H1E_4_2Log.Encloses (Real.log (Z3_5_0H1Value ((4,2) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound ((Z3_5_0Half_sound 1) ((4,2) : PairSlot)) (w := Z3_5_0H1E_4_2LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z3_5_0H1E_4_2 : Ball := ⟨(4538157350748923372425986557083 / 12500000000000000000000000000000), (27257172089 / 100000000000000000000000000000000)⟩ +lemma Z3_5_0H1E_4_2_sound : Z3_5_0H1E_4_2.Encloses (Foundation.entropyTerm (Z3_5_0H1Value ((4,2) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z3_5_0Half_sound 1) ((4,2) : PairSlot)) Z3_5_0H1E_4_2Log_sound) (by decide +kernel) +def Z3_5_0H1E_4_3LogWitness : LogWitness := ⟨-5, 2256392399897361854853853147931, 1562500000000000000000000000000⟩ +def Z3_5_0H1E_4_3Log : Ball := ⟨(-309825575079275035532022838613839 / 100000000000000000000000000000000), (31019273 / 24414062500000000000000000000)⟩ +lemma Z3_5_0H1E_4_3Log_sound : Z3_5_0H1E_4_3Log.Encloses (Real.log (Z3_5_0H1Value ((4,3) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound ((Z3_5_0Half_sound 1) ((4,3) : PairSlot)) (w := Z3_5_0H1E_4_3LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z3_5_0H1E_4_3 : Ball := ⟨(13981761458054113306784224791891 / 100000000000000000000000000000000), (716714517 / 12500000000000000000000000000000)⟩ +lemma Z3_5_0H1E_4_3_sound : Z3_5_0H1E_4_3.Encloses (Foundation.entropyTerm (Z3_5_0H1Value ((4,3) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z3_5_0Half_sound 1) ((4,3) : PairSlot)) Z3_5_0H1E_4_3Log_sound) (by decide +kernel) +def Z3_5_0H1E_5_1LogWitness : LogWitness := ⟨-6, 645274206658629135363561930529, 390625000000000000000000000000⟩ +def Z3_5_0H1E_5_1Log : Ball := ⟨(-365695575079275035532022819518357 / 100000000000000000000000000000000), (148230766013 / 100000000000000000000000000000000)⟩ +lemma Z3_5_0H1E_5_1Log_sound : Z3_5_0H1E_5_1Log.Encloses (Real.log (Z3_5_0H1Value ((5,1) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound ((Z3_5_0Half_sound 1) ((5,1) : PairSlot)) (w := Z3_5_0H1E_5_1LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z3_5_0H1E_5_1 : Ball := ⟨(1887791376702802768234330198239 / 20000000000000000000000000000000), (191298981 / 5000000000000000000000000000000)⟩ +lemma Z3_5_0H1E_5_1_sound : Z3_5_0H1E_5_1.Encloses (Foundation.entropyTerm (Z3_5_0H1Value ((5,1) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z3_5_0Half_sound 1) ((5,1) : PairSlot)) Z3_5_0H1E_5_1Log_sound) (by decide +kernel) +def Z3_5_0H1Terms (a : PairSlot) : Ball := + match a.1.val, a.2.val with + | 1, 5 => ⟨(1887791376702802768234330198239 / 20000000000000000000000000000000), (191298981 / 5000000000000000000000000000000)⟩ + | 2, 4 => ⟨(4538157350748923372425986557083 / 12500000000000000000000000000000), (27257172089 / 100000000000000000000000000000000)⟩ + | 3, 4 => ⟨(13981761458054113306784224791891 / 100000000000000000000000000000000), (716714517 / 12500000000000000000000000000000)⟩ + | 4, 2 => ⟨(4538157350748923372425986557083 / 12500000000000000000000000000000), (27257172089 / 100000000000000000000000000000000)⟩ + | 4, 3 => ⟨(13981761458054113306784224791891 / 100000000000000000000000000000000), (716714517 / 12500000000000000000000000000000)⟩ + | 5, 1 => ⟨(1887791376702802768234330198239 / 20000000000000000000000000000000), (191298981 / 5000000000000000000000000000000)⟩ + | _, _ => (.exact 0) +lemma Z3_5_0H1Terms_sound (a : PairSlot) : + (Z3_5_0H1Terms a).Encloses (Foundation.entropyTerm (Z3_5_0H1Value a)) := by + rcases a with ⟨i,j⟩ + revert j i + apply forall_fin6 + · exact forall_fin6 (entropyTerm_zero_ball ((Z3_5_0Half_sound 1) ((0,0) : PairSlot))) (entropyTerm_zero_ball ((Z3_5_0Half_sound 1) ((0,1) : PairSlot))) (entropyTerm_zero_ball ((Z3_5_0Half_sound 1) ((0,2) : PairSlot))) (entropyTerm_zero_ball ((Z3_5_0Half_sound 1) ((0,3) : PairSlot))) (entropyTerm_zero_ball ((Z3_5_0Half_sound 1) ((0,4) : PairSlot))) (entropyTerm_zero_ball ((Z3_5_0Half_sound 1) ((0,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z3_5_0Half_sound 1) ((1,0) : PairSlot))) (entropyTerm_zero_ball ((Z3_5_0Half_sound 1) ((1,1) : PairSlot))) (entropyTerm_zero_ball ((Z3_5_0Half_sound 1) ((1,2) : PairSlot))) (entropyTerm_zero_ball ((Z3_5_0Half_sound 1) ((1,3) : PairSlot))) (entropyTerm_zero_ball ((Z3_5_0Half_sound 1) ((1,4) : PairSlot))) Z3_5_0H1E_1_5_sound + · exact forall_fin6 (entropyTerm_zero_ball ((Z3_5_0Half_sound 1) ((2,0) : PairSlot))) (entropyTerm_zero_ball ((Z3_5_0Half_sound 1) ((2,1) : PairSlot))) (entropyTerm_zero_ball ((Z3_5_0Half_sound 1) ((2,2) : PairSlot))) (entropyTerm_zero_ball ((Z3_5_0Half_sound 1) ((2,3) : PairSlot))) Z3_5_0H1E_2_4_sound (entropyTerm_zero_ball ((Z3_5_0Half_sound 1) ((2,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z3_5_0Half_sound 1) ((3,0) : PairSlot))) (entropyTerm_zero_ball ((Z3_5_0Half_sound 1) ((3,1) : PairSlot))) (entropyTerm_zero_ball ((Z3_5_0Half_sound 1) ((3,2) : PairSlot))) (entropyTerm_zero_ball ((Z3_5_0Half_sound 1) ((3,3) : PairSlot))) Z3_5_0H1E_3_4_sound (entropyTerm_zero_ball ((Z3_5_0Half_sound 1) ((3,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z3_5_0Half_sound 1) ((4,0) : PairSlot))) (entropyTerm_zero_ball ((Z3_5_0Half_sound 1) ((4,1) : PairSlot))) Z3_5_0H1E_4_2_sound Z3_5_0H1E_4_3_sound (entropyTerm_zero_ball ((Z3_5_0Half_sound 1) ((4,4) : PairSlot))) (entropyTerm_zero_ball ((Z3_5_0Half_sound 1) ((4,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z3_5_0Half_sound 1) ((5,0) : PairSlot))) Z3_5_0H1E_5_1_sound (entropyTerm_zero_ball ((Z3_5_0Half_sound 1) ((5,2) : PairSlot))) (entropyTerm_zero_ball ((Z3_5_0Half_sound 1) ((5,3) : PairSlot))) (entropyTerm_zero_ball ((Z3_5_0Half_sound 1) ((5,4) : PairSlot))) (entropyTerm_zero_ball ((Z3_5_0Half_sound 1) ((5,5) : PairSlot))) +def Z3_5_0H1Entropy : Ball := ⟨(238903908590238056509455072959 / 200000000000000000000000000000), (7363373569 / 10000000000000000000000000000000)⟩ +lemma Z3_5_0H1Entropy_sound : Z3_5_0H1Entropy.Encloses (Foundation.finiteEntropy Z3_5_0H1Value) := by + exact contains_sound (entropyPair_enclosed Z3_5_0H1Value Z3_5_0H1Terms Z3_5_0H1Terms_sound) (by decide +kernel) +def Z3_5_0H1Mass : Ball := ⟨1, (49 / 25000000000000000000000000000000)⟩ +lemma Z3_5_0H1Mass_sound : Z3_5_0H1Mass.Encloses (∑ a, Z3_5_0H1Value a) := by + exact contains_sound (pairSumBall_sound (Z3_5_0Half 1) Z3_5_0H1Value (Z3_5_0Half_sound 1)) (by decide +kernel) +def Z3_5_0H1MassTermLogWitness : LogWitness := ⟨0, 1, 1⟩ +def Z3_5_0H1MassTermLog : Ball := ⟨0, (10587911939 / 50000000000000000000000000000000)⟩ +lemma Z3_5_0H1MassTermLog_sound : Z3_5_0H1MassTermLog.Encloses (Real.log ((∑ a, Z3_5_0H1Value a))) := by + exact checkLog_sound logTwoBall_sound (Z3_5_0H1Mass_sound) (w := Z3_5_0H1MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z3_5_0H1MassTerm : Ball := ⟨0, (21175823879 / 100000000000000000000000000000000)⟩ +lemma Z3_5_0H1MassTerm_sound : Z3_5_0H1MassTerm.Encloses (Foundation.entropyTerm ((∑ a, Z3_5_0H1Value a))) := by + exact contains_sound (entropyTerm_ball (Z3_5_0H1Mass_sound) Z3_5_0H1MassTermLog_sound) (by decide +kernel) +def Z3_5_0H1H : Ball := ⟨(238903908590238056509455072959 / 200000000000000000000000000000), (94809559569 / 100000000000000000000000000000000)⟩ +lemma Z3_5_0H1H_sound : Z3_5_0H1H.Encloses (homogeneousEntropy Z3_5_0H1Value) := by + exact contains_sound (homogeneous_enclosed Z3_5_0H1Value Z3_5_0H1MassTerm_sound Z3_5_0H1Entropy_sound) (by decide +kernel) +def Z3_5_0H2Value (a : PairSlot) : ℝ := (halfLaw (shape 3 5 0) 2 a : ℝ) +def Z3_5_0H2E_0_0Log : Ball := .exact 0 +lemma Z3_5_0H2E_0_0Log_sound : Z3_5_0H2E_0_0Log.Encloses (Real.log (Z3_5_0H2Value ((0,0) : PairSlot))) := by + exact log_exact_one_ball ((Z3_5_0Half_sound 2) ((0,0) : PairSlot)) +def Z3_5_0H2E_0_0 : Ball := ⟨0, 0⟩ +lemma Z3_5_0H2E_0_0_sound : Z3_5_0H2E_0_0.Encloses (Foundation.entropyTerm (Z3_5_0H2Value ((0,0) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z3_5_0Half_sound 2) ((0,0) : PairSlot)) Z3_5_0H2E_0_0Log_sound) (by decide +kernel) +def Z3_5_0H2Terms (a : PairSlot) : Ball := + match a.1.val, a.2.val with + | 0, 0 => ⟨0, 0⟩ + | _, _ => (.exact 0) +lemma Z3_5_0H2Terms_sound (a : PairSlot) : + (Z3_5_0H2Terms a).Encloses (Foundation.entropyTerm (Z3_5_0H2Value a)) := by + rcases a with ⟨i,j⟩ + revert j i + apply forall_fin6 + · exact forall_fin6 Z3_5_0H2E_0_0_sound (entropyTerm_zero_ball ((Z3_5_0Half_sound 2) ((0,1) : PairSlot))) (entropyTerm_zero_ball ((Z3_5_0Half_sound 2) ((0,2) : PairSlot))) (entropyTerm_zero_ball ((Z3_5_0Half_sound 2) ((0,3) : PairSlot))) (entropyTerm_zero_ball ((Z3_5_0Half_sound 2) ((0,4) : PairSlot))) (entropyTerm_zero_ball ((Z3_5_0Half_sound 2) ((0,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z3_5_0Half_sound 2) ((1,0) : PairSlot))) (entropyTerm_zero_ball ((Z3_5_0Half_sound 2) ((1,1) : PairSlot))) (entropyTerm_zero_ball ((Z3_5_0Half_sound 2) ((1,2) : PairSlot))) (entropyTerm_zero_ball ((Z3_5_0Half_sound 2) ((1,3) : PairSlot))) (entropyTerm_zero_ball ((Z3_5_0Half_sound 2) ((1,4) : PairSlot))) (entropyTerm_zero_ball ((Z3_5_0Half_sound 2) ((1,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z3_5_0Half_sound 2) ((2,0) : PairSlot))) (entropyTerm_zero_ball ((Z3_5_0Half_sound 2) ((2,1) : PairSlot))) (entropyTerm_zero_ball ((Z3_5_0Half_sound 2) ((2,2) : PairSlot))) (entropyTerm_zero_ball ((Z3_5_0Half_sound 2) ((2,3) : PairSlot))) (entropyTerm_zero_ball ((Z3_5_0Half_sound 2) ((2,4) : PairSlot))) (entropyTerm_zero_ball ((Z3_5_0Half_sound 2) ((2,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z3_5_0Half_sound 2) ((3,0) : PairSlot))) (entropyTerm_zero_ball ((Z3_5_0Half_sound 2) ((3,1) : PairSlot))) (entropyTerm_zero_ball ((Z3_5_0Half_sound 2) ((3,2) : PairSlot))) (entropyTerm_zero_ball ((Z3_5_0Half_sound 2) ((3,3) : PairSlot))) (entropyTerm_zero_ball ((Z3_5_0Half_sound 2) ((3,4) : PairSlot))) (entropyTerm_zero_ball ((Z3_5_0Half_sound 2) ((3,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z3_5_0Half_sound 2) ((4,0) : PairSlot))) (entropyTerm_zero_ball ((Z3_5_0Half_sound 2) ((4,1) : PairSlot))) (entropyTerm_zero_ball ((Z3_5_0Half_sound 2) ((4,2) : PairSlot))) (entropyTerm_zero_ball ((Z3_5_0Half_sound 2) ((4,3) : PairSlot))) (entropyTerm_zero_ball ((Z3_5_0Half_sound 2) ((4,4) : PairSlot))) (entropyTerm_zero_ball ((Z3_5_0Half_sound 2) ((4,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z3_5_0Half_sound 2) ((5,0) : PairSlot))) (entropyTerm_zero_ball ((Z3_5_0Half_sound 2) ((5,1) : PairSlot))) (entropyTerm_zero_ball ((Z3_5_0Half_sound 2) ((5,2) : PairSlot))) (entropyTerm_zero_ball ((Z3_5_0Half_sound 2) ((5,3) : PairSlot))) (entropyTerm_zero_ball ((Z3_5_0Half_sound 2) ((5,4) : PairSlot))) (entropyTerm_zero_ball ((Z3_5_0Half_sound 2) ((5,5) : PairSlot))) +def Z3_5_0H2Entropy : Ball := ⟨0, 0⟩ +lemma Z3_5_0H2Entropy_sound : Z3_5_0H2Entropy.Encloses (Foundation.finiteEntropy Z3_5_0H2Value) := by + exact contains_sound (entropyPair_enclosed Z3_5_0H2Value Z3_5_0H2Terms Z3_5_0H2Terms_sound) (by decide +kernel) +def Z3_5_0H2Mass : Ball := ⟨1, 0⟩ +lemma Z3_5_0H2Mass_sound : Z3_5_0H2Mass.Encloses (∑ a, Z3_5_0H2Value a) := by + exact contains_sound (pairSumBall_sound (Z3_5_0Half 2) Z3_5_0H2Value (Z3_5_0Half_sound 2)) (by decide +kernel) +def Z3_5_0H2MassTermLog : Ball := .exact 0 +lemma Z3_5_0H2MassTermLog_sound : Z3_5_0H2MassTermLog.Encloses (Real.log ((∑ a, Z3_5_0H2Value a))) := by + exact log_exact_one_ball (Z3_5_0H2Mass_sound) +def Z3_5_0H2MassTerm : Ball := ⟨0, 0⟩ +lemma Z3_5_0H2MassTerm_sound : Z3_5_0H2MassTerm.Encloses (Foundation.entropyTerm ((∑ a, Z3_5_0H2Value a))) := by + exact contains_sound (entropyTerm_ball (Z3_5_0H2Mass_sound) Z3_5_0H2MassTermLog_sound) (by decide +kernel) +def Z3_5_0H2H : Ball := ⟨0, 0⟩ +lemma Z3_5_0H2H_sound : Z3_5_0H2H.Encloses (homogeneousEntropy Z3_5_0H2Value) := by + exact contains_sound (homogeneous_enclosed Z3_5_0H2Value Z3_5_0H2MassTerm_sound Z3_5_0H2Entropy_sound) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/Certificates/Four4_0_4.lean b/lean/OAI/LinearAlgebra/MatrixFields/Certificates/Four4_0_4.lean new file mode 100644 index 0000000000000000000000000000000000000000..f3027b5a9f8591bb9f759d216c5aca2750630eea --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/Certificates/Four4_0_4.lean @@ -0,0 +1,666 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Certificates.SplitA1_3_12 + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def Z4_0_4Raw (ij : PairSlot) : Ball := + match ij.1.val, ij.2.val with + | 0, 0 => w195 + | 0, 1 => w195 + | 0, 2 => w195 + | 0, 3 => w195 + | 0, 4 => w195 + | 0, 5 => w132 + | 1, 0 => w195 + | 1, 1 => w195 + | 1, 2 => w195 + | 1, 3 => w195 + | 1, 4 => w213 + | 1, 5 => w195 + | 2, 0 => w195 + | 2, 1 => w195 + | 2, 2 => w220 + | 2, 3 => w206 + | 2, 4 => w195 + | 2, 5 => w195 + | 3, 0 => w195 + | 3, 1 => w195 + | 3, 2 => w206 + | 3, 3 => w195 + | 3, 4 => w195 + | 3, 5 => w195 + | 4, 0 => w195 + | 4, 1 => w213 + | 4, 2 => w195 + | 4, 3 => w195 + | 4, 4 => w195 + | 4, 5 => w195 + | 5, 0 => w132 + | 5, 1 => w195 + | 5, 2 => w195 + | 5, 3 => w195 + | 5, 4 => w195 + | 5, 5 => w195 + | _, _ => (.exact 0) +lemma Z4_0_4Raw_sound_0 (j : Fin 6) : + (Z4_0_4Raw (0,j)).Encloses (weight (orderedPairInteger (shape 4 0 4) 0 j) : ℝ) := by + fin_cases j + · change (Z4_0_4Raw (0,0)).Encloses (weight (orderedPairInteger (shape 4 0 4) 0 0) : ℝ) + have he : orderedPairInteger (shape 4 0 4) 0 0 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z4_0_4Raw (0,1)).Encloses (weight (orderedPairInteger (shape 4 0 4) 0 1) : ℝ) + have he : orderedPairInteger (shape 4 0 4) 0 1 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z4_0_4Raw (0,2)).Encloses (weight (orderedPairInteger (shape 4 0 4) 0 2) : ℝ) + have he : orderedPairInteger (shape 4 0 4) 0 2 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z4_0_4Raw (0,3)).Encloses (weight (orderedPairInteger (shape 4 0 4) 0 3) : ℝ) + have he : orderedPairInteger (shape 4 0 4) 0 3 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z4_0_4Raw (0,4)).Encloses (weight (orderedPairInteger (shape 4 0 4) 0 4) : ℝ) + have he : orderedPairInteger (shape 4 0 4) 0 4 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z4_0_4Raw (0,5)).Encloses (weight (orderedPairInteger (shape 4 0 4) 0 5) : ℝ) + have he : orderedPairInteger (shape 4 0 4) 0 5 = (-9766) := by decide +kernel + rw [he] + exact w132_sound +lemma Z4_0_4Raw_sound_1 (j : Fin 6) : + (Z4_0_4Raw (1,j)).Encloses (weight (orderedPairInteger (shape 4 0 4) 1 j) : ℝ) := by + fin_cases j + · change (Z4_0_4Raw (1,0)).Encloses (weight (orderedPairInteger (shape 4 0 4) 1 0) : ℝ) + have he : orderedPairInteger (shape 4 0 4) 1 0 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z4_0_4Raw (1,1)).Encloses (weight (orderedPairInteger (shape 4 0 4) 1 1) : ℝ) + have he : orderedPairInteger (shape 4 0 4) 1 1 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z4_0_4Raw (1,2)).Encloses (weight (orderedPairInteger (shape 4 0 4) 1 2) : ℝ) + have he : orderedPairInteger (shape 4 0 4) 1 2 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z4_0_4Raw (1,3)).Encloses (weight (orderedPairInteger (shape 4 0 4) 1 3) : ℝ) + have he : orderedPairInteger (shape 4 0 4) 1 3 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z4_0_4Raw (1,4)).Encloses (weight (orderedPairInteger (shape 4 0 4) 1 4) : ℝ) + have he : orderedPairInteger (shape 4 0 4) 1 4 = (28961) := by decide +kernel + rw [he] + exact w213_sound + · change (Z4_0_4Raw (1,5)).Encloses (weight (orderedPairInteger (shape 4 0 4) 1 5) : ℝ) + have he : orderedPairInteger (shape 4 0 4) 1 5 = (0) := by decide +kernel + rw [he] + exact w195_sound +lemma Z4_0_4Raw_sound_2 (j : Fin 6) : + (Z4_0_4Raw (2,j)).Encloses (weight (orderedPairInteger (shape 4 0 4) 2 j) : ℝ) := by + fin_cases j + · change (Z4_0_4Raw (2,0)).Encloses (weight (orderedPairInteger (shape 4 0 4) 2 0) : ℝ) + have he : orderedPairInteger (shape 4 0 4) 2 0 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z4_0_4Raw (2,1)).Encloses (weight (orderedPairInteger (shape 4 0 4) 2 1) : ℝ) + have he : orderedPairInteger (shape 4 0 4) 2 1 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z4_0_4Raw (2,2)).Encloses (weight (orderedPairInteger (shape 4 0 4) 2 2) : ℝ) + have he : orderedPairInteger (shape 4 0 4) 2 2 = (43809) := by decide +kernel + rw [he] + exact w220_sound + · change (Z4_0_4Raw (2,3)).Encloses (weight (orderedPairInteger (shape 4 0 4) 2 3) : ℝ) + have he : orderedPairInteger (shape 4 0 4) 2 3 = (22299) := by decide +kernel + rw [he] + exact w206_sound + · change (Z4_0_4Raw (2,4)).Encloses (weight (orderedPairInteger (shape 4 0 4) 2 4) : ℝ) + have he : orderedPairInteger (shape 4 0 4) 2 4 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z4_0_4Raw (2,5)).Encloses (weight (orderedPairInteger (shape 4 0 4) 2 5) : ℝ) + have he : orderedPairInteger (shape 4 0 4) 2 5 = (0) := by decide +kernel + rw [he] + exact w195_sound +lemma Z4_0_4Raw_sound_3 (j : Fin 6) : + (Z4_0_4Raw (3,j)).Encloses (weight (orderedPairInteger (shape 4 0 4) 3 j) : ℝ) := by + fin_cases j + · change (Z4_0_4Raw (3,0)).Encloses (weight (orderedPairInteger (shape 4 0 4) 3 0) : ℝ) + have he : orderedPairInteger (shape 4 0 4) 3 0 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z4_0_4Raw (3,1)).Encloses (weight (orderedPairInteger (shape 4 0 4) 3 1) : ℝ) + have he : orderedPairInteger (shape 4 0 4) 3 1 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z4_0_4Raw (3,2)).Encloses (weight (orderedPairInteger (shape 4 0 4) 3 2) : ℝ) + have he : orderedPairInteger (shape 4 0 4) 3 2 = (22299) := by decide +kernel + rw [he] + exact w206_sound + · change (Z4_0_4Raw (3,3)).Encloses (weight (orderedPairInteger (shape 4 0 4) 3 3) : ℝ) + have he : orderedPairInteger (shape 4 0 4) 3 3 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z4_0_4Raw (3,4)).Encloses (weight (orderedPairInteger (shape 4 0 4) 3 4) : ℝ) + have he : orderedPairInteger (shape 4 0 4) 3 4 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z4_0_4Raw (3,5)).Encloses (weight (orderedPairInteger (shape 4 0 4) 3 5) : ℝ) + have he : orderedPairInteger (shape 4 0 4) 3 5 = (0) := by decide +kernel + rw [he] + exact w195_sound +lemma Z4_0_4Raw_sound_4 (j : Fin 6) : + (Z4_0_4Raw (4,j)).Encloses (weight (orderedPairInteger (shape 4 0 4) 4 j) : ℝ) := by + fin_cases j + · change (Z4_0_4Raw (4,0)).Encloses (weight (orderedPairInteger (shape 4 0 4) 4 0) : ℝ) + have he : orderedPairInteger (shape 4 0 4) 4 0 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z4_0_4Raw (4,1)).Encloses (weight (orderedPairInteger (shape 4 0 4) 4 1) : ℝ) + have he : orderedPairInteger (shape 4 0 4) 4 1 = (28961) := by decide +kernel + rw [he] + exact w213_sound + · change (Z4_0_4Raw (4,2)).Encloses (weight (orderedPairInteger (shape 4 0 4) 4 2) : ℝ) + have he : orderedPairInteger (shape 4 0 4) 4 2 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z4_0_4Raw (4,3)).Encloses (weight (orderedPairInteger (shape 4 0 4) 4 3) : ℝ) + have he : orderedPairInteger (shape 4 0 4) 4 3 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z4_0_4Raw (4,4)).Encloses (weight (orderedPairInteger (shape 4 0 4) 4 4) : ℝ) + have he : orderedPairInteger (shape 4 0 4) 4 4 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z4_0_4Raw (4,5)).Encloses (weight (orderedPairInteger (shape 4 0 4) 4 5) : ℝ) + have he : orderedPairInteger (shape 4 0 4) 4 5 = (0) := by decide +kernel + rw [he] + exact w195_sound +lemma Z4_0_4Raw_sound_5 (j : Fin 6) : + (Z4_0_4Raw (5,j)).Encloses (weight (orderedPairInteger (shape 4 0 4) 5 j) : ℝ) := by + fin_cases j + · change (Z4_0_4Raw (5,0)).Encloses (weight (orderedPairInteger (shape 4 0 4) 5 0) : ℝ) + have he : orderedPairInteger (shape 4 0 4) 5 0 = (-9766) := by decide +kernel + rw [he] + exact w132_sound + · change (Z4_0_4Raw (5,1)).Encloses (weight (orderedPairInteger (shape 4 0 4) 5 1) : ℝ) + have he : orderedPairInteger (shape 4 0 4) 5 1 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z4_0_4Raw (5,2)).Encloses (weight (orderedPairInteger (shape 4 0 4) 5 2) : ℝ) + have he : orderedPairInteger (shape 4 0 4) 5 2 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z4_0_4Raw (5,3)).Encloses (weight (orderedPairInteger (shape 4 0 4) 5 3) : ℝ) + have he : orderedPairInteger (shape 4 0 4) 5 3 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z4_0_4Raw (5,4)).Encloses (weight (orderedPairInteger (shape 4 0 4) 5 4) : ℝ) + have he : orderedPairInteger (shape 4 0 4) 5 4 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z4_0_4Raw (5,5)).Encloses (weight (orderedPairInteger (shape 4 0 4) 5 5) : ℝ) + have he : orderedPairInteger (shape 4 0 4) 5 5 = (0) := by decide +kernel + rw [he] + exact w195_sound +lemma Z4_0_4Raw_sound (ij : PairSlot) : + (Z4_0_4Raw ij).Encloses (weight (orderedPairInteger (shape 4 0 4) ij.1 ij.2) : ℝ) := by + rcases ij with ⟨i,j⟩ + revert i + exact forall_fin6 (Z4_0_4Raw_sound_0 j) (Z4_0_4Raw_sound_1 j) (Z4_0_4Raw_sound_2 j) (Z4_0_4Raw_sound_3 j) (Z4_0_4Raw_sound_4 j) (Z4_0_4Raw_sound_5 j) +def Z4_0_4Den : Ball := ⟨(13646777938944276882364160176219867 / 100000000000000000000000000000000), (13969 / 100000000000000000000000000000000)⟩ +lemma Z4_0_4Den_sound : Z4_0_4Den.Encloses + (((orderedPairs (shape 4 0 4)).map (fun ij => weight (orderedPairInteger (shape 4 0 4) ij.1 ij.2))).sum : ℝ) := by + exact contains_sound (list_cast_enclosed (orderedPairs (shape 4 0 4)) Z4_0_4Raw + (fun ij => weight (orderedPairInteger (shape 4 0 4) ij.1 ij.2)) + (fun ij _ => Z4_0_4Raw_sound ij)) (by decide +kernel) +lemma Z4_0_4Den_pos : 0 < Z4_0_4Den.lower := by decide +kernel +def Z4_0_4Probs (ij : PairSlot) : Ball := + match ij.1.val, ij.2.val with + | 0, 5 => ⟨(55190951304569688595534186513 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 1, 4 => ⟨(6632849277085335226067309879167 / 50000000000000000000000000000000), (7 / 25000000000000000000000000000000)⟩ + | 2, 2 => ⟨(5855588794422561384849059336303 / 10000000000000000000000000000000), (121 / 100000000000000000000000000000000)⟩ + | 2, 3 => ⟨(3407007932926322989871260497747 / 50000000000000000000000000000000), (3 / 20000000000000000000000000000000)⟩ + | 3, 2 => ⟨(3407007932926322989871260497747 / 50000000000000000000000000000000), (3 / 20000000000000000000000000000000)⟩ + | 3, 3 => ⟨(146554740536411280359956652837 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 4, 1 => ⟨(6632849277085335226067309879167 / 50000000000000000000000000000000), (7 / 25000000000000000000000000000000)⟩ + | 5, 0 => ⟨(55190951304569688595534186513 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | _, _ => (.exact 0) +lemma Z4_0_4Contains : ∀ i j : Fin 6, + statisticWeight i + statisticWeight j = shapeMax (shape 4 0 4) → + contains (.mul (Z4_0_4Raw (i,j)) (.inv Z4_0_4Den)) (Z4_0_4Probs (i,j)) = true := by + decide +kernel +lemma Z4_0_4Zero : ∀ i j : Fin 6, + statisticWeight i + statisticWeight j ≠ shapeMax (shape 4 0 4) → Z4_0_4Probs (i,j) = .exact 0 := by + decide +kernel +lemma Z4_0_4Probs_sound (ij : PairSlot) : + (Z4_0_4Probs ij).Encloses (zeroPairLaw (shape 4 0 4) ij.1 ij.2 : ℝ) := by + by_cases h : statisticWeight ij.1 + statisticWeight ij.2 = shapeMax (shape 4 0 4) + · have hb := contains_sound (Ball.mul_sound (Z4_0_4Raw_sound ij) + (Ball.inv_sound Z4_0_4Den_sound Z4_0_4Den_pos)) (Z4_0_4Contains ij.1 ij.2 h) + simpa only [zeroPairLaw, h, ite_true, Rat.cast_div, Rat.cast_mul, + Rat.cast_inv, div_eq_mul_inv] using hb + · rw [Z4_0_4Zero ij.1 ij.2 h] + simpa only [zeroPairLaw, h, ite_false] using Ball.exact_sound 0 + +def Z4_0_4Half (w : Fin 3) (ij : PairSlot) : Ball := + if (shape 4 0 4) w = 0 then if ij = (0,0) then .exact 1 else .exact 0 + else if w = halfMaxAxis (shape 4 0 4) then Z4_0_4Probs ij + else Z4_0_4Probs (kappa ij.1, kappa ij.2) +lemma Z4_0_4Half_sound (w : Fin 3) (ij : PairSlot) : + (Z4_0_4Half w ij).Encloses (halfLaw (shape 4 0 4) w ij : ℝ) := by + have hp : positive (shape 4 0 4) = false := by decide +kernel + simp only [Z4_0_4Half, halfLaw, hp, Bool.false_eq_true, ite_false] + split_ifs + · exact Ball.exact_sound 1 + · exact Ball.exact_sound 0 + · exact Z4_0_4Probs_sound _ + · exact Z4_0_4Probs_sound _ + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def Z4_0_4Value (a : PairSlot) : ℝ := (zeroPairLaw (shape 4 0 4) a.1 a.2 : ℝ) +def Z4_0_4E_0_5LogWitness : LogWitness := ⟨-9, 55190951304569688595534186513, 39062500000000000000000000000⟩ +def Z4_0_4E_0_5Log : Ball := ⟨(-589268853833220841124255600121907 / 100000000000000000000000000000000), (26469779649 / 12500000000000000000000000000000)⟩ +lemma Z4_0_4E_0_5Log_sound : Z4_0_4E_0_5Log.Encloses (Real.log (Z4_0_4Value ((0,5) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound (Z4_0_4Probs_sound ((0,5) : PairSlot)) (w := Z4_0_4E_0_5LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z4_0_4E_0_5 : Ball := ⟨(1626115430860444246284949942957 / 100000000000000000000000000000000), (116871387 / 20000000000000000000000000000000)⟩ +lemma Z4_0_4E_0_5_sound : Z4_0_4E_0_5.Encloses (Foundation.entropyTerm (Z4_0_4Value ((0,5) : PairSlot))) := by + exact contains_sound (entropyTerm_ball (Z4_0_4Probs_sound ((0,5) : PairSlot)) Z4_0_4E_0_5Log_sound) (by decide +kernel) +def Z4_0_4E_1_4LogWitness : LogWitness := ⟨-3, 6632849277085335226067309879167, 6250000000000000000000000000000⟩ +def Z4_0_4E_1_4Log : Ball := ⟨(-201998853833220841124255714694749 / 100000000000000000000000000000000), (42351647471 / 50000000000000000000000000000000)⟩ +lemma Z4_0_4E_1_4Log_sound : Z4_0_4E_1_4Log.Encloses (Real.log (Z4_0_4Value ((1,4) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound (Z4_0_4Probs_sound ((1,4) : PairSlot)) (w := Z4_0_4E_1_4LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z4_0_4E_1_4 : Ball := ⟨(837392469762340720305966731003 / 3125000000000000000000000000000), (1123648383 / 10000000000000000000000000000000)⟩ +lemma Z4_0_4E_1_4_sound : Z4_0_4E_1_4.Encloses (Foundation.entropyTerm (Z4_0_4Value ((1,4) : PairSlot))) := by + exact contains_sound (entropyTerm_ball (Z4_0_4Probs_sound ((1,4) : PairSlot)) Z4_0_4E_1_4Log_sound) (by decide +kernel) +def Z4_0_4E_2_2LogWitness : LogWitness := ⟨-1, 5855588794422561384849059336303, 5000000000000000000000000000000⟩ +def Z4_0_4E_2_2Log : Ball := ⟨(-53518853833220841124255752885733 / 100000000000000000000000000000000), (10587911893 / 25000000000000000000000000000000)⟩ +lemma Z4_0_4E_2_2Log_sound : Z4_0_4E_2_2Log.Encloses (Real.log (Z4_0_4Value ((2,2) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound (Z4_0_4Probs_sound ((2,2) : PairSlot)) (w := Z4_0_4E_2_2LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z4_0_4E_2_2 : Ball := ⟨(31338440079614690320574653450617 / 100000000000000000000000000000000), (77498073 / 312500000000000000000000000000)⟩ +lemma Z4_0_4E_2_2_sound : Z4_0_4E_2_2.Encloses (Foundation.entropyTerm (Z4_0_4Value ((2,2) : PairSlot))) := by + exact contains_sound (entropyTerm_ball (Z4_0_4Probs_sound ((2,2) : PairSlot)) Z4_0_4E_2_2Log_sound) (by decide +kernel) +def Z4_0_4E_2_3LogWitness : LogWitness := ⟨-4, 3407007932926322989871260497747, 3125000000000000000000000000000⟩ +def Z4_0_4E_2_3Log : Ball := ⟨(-6715471345830521028106392389981 / 2500000000000000000000000000000), (52939559317 / 50000000000000000000000000000000)⟩ +lemma Z4_0_4E_2_3Log_sound : Z4_0_4E_2_3Log.Encloses (Real.log (Z4_0_4Value ((2,3) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound (Z4_0_4Probs_sound ((2,3) : PairSlot)) (w := Z4_0_4E_2_3LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z4_0_4E_2_3 : Ball := ⟨(18303731318867196612732623716901 / 100000000000000000000000000000000), (7214619983 / 100000000000000000000000000000000)⟩ +lemma Z4_0_4E_2_3_sound : Z4_0_4E_2_3.Encloses (Foundation.entropyTerm (Z4_0_4Value ((2,3) : PairSlot))) := by + exact contains_sound (entropyTerm_ball (Z4_0_4Probs_sound ((2,3) : PairSlot)) Z4_0_4E_2_3Log_sound) (by decide +kernel) +def Z4_0_4E_3_2LogWitness : LogWitness := ⟨-4, 3407007932926322989871260497747, 3125000000000000000000000000000⟩ +def Z4_0_4E_3_2Log : Ball := ⟨(-6715471345830521028106392389981 / 2500000000000000000000000000000), (52939559317 / 50000000000000000000000000000000)⟩ +lemma Z4_0_4E_3_2Log_sound : Z4_0_4E_3_2Log.Encloses (Real.log (Z4_0_4Value ((3,2) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound (Z4_0_4Probs_sound ((3,2) : PairSlot)) (w := Z4_0_4E_3_2LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z4_0_4E_3_2 : Ball := ⟨(18303731318867196612732623716901 / 100000000000000000000000000000000), (7214619983 / 100000000000000000000000000000000)⟩ +lemma Z4_0_4E_3_2_sound : Z4_0_4E_3_2.Encloses (Foundation.entropyTerm (Z4_0_4Value ((3,2) : PairSlot))) := by + exact contains_sound (entropyTerm_ball (Z4_0_4Probs_sound ((3,2) : PairSlot)) Z4_0_4E_3_2Log_sound) (by decide +kernel) +def Z4_0_4E_3_3LogWitness : LogWitness := ⟨-8, 146554740536411280359956652837, 78125000000000000000000000000⟩ +def Z4_0_4E_3_3Log : Ball := ⟨(-245804426916610420562127809721047 / 50000000000000000000000000000000), (190582413283 / 100000000000000000000000000000000)⟩ +lemma Z4_0_4E_3_3Log_sound : Z4_0_4E_3_3Log.Encloses (Real.log (Z4_0_4Value ((3,3) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound (Z4_0_4Probs_sound ((3,3) : PairSlot)) (w := Z4_0_4E_3_3LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z4_0_4E_3_3 : Ball := ⟨(3602380400946510922725768272093 / 100000000000000000000000000000000), (349134453 / 25000000000000000000000000000000)⟩ +lemma Z4_0_4E_3_3_sound : Z4_0_4E_3_3.Encloses (Foundation.entropyTerm (Z4_0_4Value ((3,3) : PairSlot))) := by + exact contains_sound (entropyTerm_ball (Z4_0_4Probs_sound ((3,3) : PairSlot)) Z4_0_4E_3_3Log_sound) (by decide +kernel) +def Z4_0_4E_4_1LogWitness : LogWitness := ⟨-3, 6632849277085335226067309879167, 6250000000000000000000000000000⟩ +def Z4_0_4E_4_1Log : Ball := ⟨(-201998853833220841124255714694749 / 100000000000000000000000000000000), (42351647471 / 50000000000000000000000000000000)⟩ +lemma Z4_0_4E_4_1Log_sound : Z4_0_4E_4_1Log.Encloses (Real.log (Z4_0_4Value ((4,1) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound (Z4_0_4Probs_sound ((4,1) : PairSlot)) (w := Z4_0_4E_4_1LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z4_0_4E_4_1 : Ball := ⟨(837392469762340720305966731003 / 3125000000000000000000000000000), (1123648383 / 10000000000000000000000000000000)⟩ +lemma Z4_0_4E_4_1_sound : Z4_0_4E_4_1.Encloses (Foundation.entropyTerm (Z4_0_4Value ((4,1) : PairSlot))) := by + exact contains_sound (entropyTerm_ball (Z4_0_4Probs_sound ((4,1) : PairSlot)) Z4_0_4E_4_1Log_sound) (by decide +kernel) +def Z4_0_4E_5_0LogWitness : LogWitness := ⟨-9, 55190951304569688595534186513, 39062500000000000000000000000⟩ +def Z4_0_4E_5_0Log : Ball := ⟨(-589268853833220841124255600121907 / 100000000000000000000000000000000), (26469779649 / 12500000000000000000000000000000)⟩ +lemma Z4_0_4E_5_0Log_sound : Z4_0_4E_5_0Log.Encloses (Real.log (Z4_0_4Value ((5,0) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound (Z4_0_4Probs_sound ((5,0) : PairSlot)) (w := Z4_0_4E_5_0LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z4_0_4E_5_0 : Ball := ⟨(1626115430860444246284949942957 / 100000000000000000000000000000000), (116871387 / 20000000000000000000000000000000)⟩ +lemma Z4_0_4E_5_0_sound : Z4_0_4E_5_0.Encloses (Foundation.entropyTerm (Z4_0_4Value ((5,0) : PairSlot))) := by + exact contains_sound (entropyTerm_ball (Z4_0_4Probs_sound ((5,0) : PairSlot)) Z4_0_4E_5_0Log_sound) (by decide +kernel) +def Z4_0_4Terms (a : PairSlot) : Ball := + match a.1.val, a.2.val with + | 0, 5 => ⟨(1626115430860444246284949942957 / 100000000000000000000000000000000), (116871387 / 20000000000000000000000000000000)⟩ + | 1, 4 => ⟨(837392469762340720305966731003 / 3125000000000000000000000000000), (1123648383 / 10000000000000000000000000000000)⟩ + | 2, 2 => ⟨(31338440079614690320574653450617 / 100000000000000000000000000000000), (77498073 / 312500000000000000000000000000)⟩ + | 2, 3 => ⟨(18303731318867196612732623716901 / 100000000000000000000000000000000), (7214619983 / 100000000000000000000000000000000)⟩ + | 3, 2 => ⟨(18303731318867196612732623716901 / 100000000000000000000000000000000), (7214619983 / 100000000000000000000000000000000)⟩ + | 3, 3 => ⟨(3602380400946510922725768272093 / 100000000000000000000000000000000), (349134453 / 25000000000000000000000000000000)⟩ + | 4, 1 => ⟨(837392469762340720305966731003 / 3125000000000000000000000000000), (1123648383 / 10000000000000000000000000000000)⟩ + | 5, 0 => ⟨(1626115430860444246284949942957 / 100000000000000000000000000000000), (116871387 / 20000000000000000000000000000000)⟩ + | _, _ => (.exact 0) +lemma Z4_0_4Terms_sound (a : PairSlot) : + (Z4_0_4Terms a).Encloses (Foundation.entropyTerm (Z4_0_4Value a)) := by + rcases a with ⟨i,j⟩ + revert j i + apply forall_fin6 + · exact forall_fin6 (entropyTerm_zero_ball (Z4_0_4Probs_sound ((0,0) : PairSlot))) (entropyTerm_zero_ball (Z4_0_4Probs_sound ((0,1) : PairSlot))) (entropyTerm_zero_ball (Z4_0_4Probs_sound ((0,2) : PairSlot))) (entropyTerm_zero_ball (Z4_0_4Probs_sound ((0,3) : PairSlot))) (entropyTerm_zero_ball (Z4_0_4Probs_sound ((0,4) : PairSlot))) Z4_0_4E_0_5_sound + · exact forall_fin6 (entropyTerm_zero_ball (Z4_0_4Probs_sound ((1,0) : PairSlot))) (entropyTerm_zero_ball (Z4_0_4Probs_sound ((1,1) : PairSlot))) (entropyTerm_zero_ball (Z4_0_4Probs_sound ((1,2) : PairSlot))) (entropyTerm_zero_ball (Z4_0_4Probs_sound ((1,3) : PairSlot))) Z4_0_4E_1_4_sound (entropyTerm_zero_ball (Z4_0_4Probs_sound ((1,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball (Z4_0_4Probs_sound ((2,0) : PairSlot))) (entropyTerm_zero_ball (Z4_0_4Probs_sound ((2,1) : PairSlot))) Z4_0_4E_2_2_sound Z4_0_4E_2_3_sound (entropyTerm_zero_ball (Z4_0_4Probs_sound ((2,4) : PairSlot))) (entropyTerm_zero_ball (Z4_0_4Probs_sound ((2,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball (Z4_0_4Probs_sound ((3,0) : PairSlot))) (entropyTerm_zero_ball (Z4_0_4Probs_sound ((3,1) : PairSlot))) Z4_0_4E_3_2_sound Z4_0_4E_3_3_sound (entropyTerm_zero_ball (Z4_0_4Probs_sound ((3,4) : PairSlot))) (entropyTerm_zero_ball (Z4_0_4Probs_sound ((3,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball (Z4_0_4Probs_sound ((4,0) : PairSlot))) Z4_0_4E_4_1_sound (entropyTerm_zero_ball (Z4_0_4Probs_sound ((4,2) : PairSlot))) (entropyTerm_zero_ball (Z4_0_4Probs_sound ((4,3) : PairSlot))) (entropyTerm_zero_ball (Z4_0_4Probs_sound ((4,4) : PairSlot))) (entropyTerm_zero_ball (Z4_0_4Probs_sound ((4,5) : PairSlot))) + · exact forall_fin6 Z4_0_4E_5_0_sound (entropyTerm_zero_ball (Z4_0_4Probs_sound ((5,1) : PairSlot))) (entropyTerm_zero_ball (Z4_0_4Probs_sound ((5,2) : PairSlot))) (entropyTerm_zero_ball (Z4_0_4Probs_sound ((5,3) : PairSlot))) (entropyTerm_zero_ball (Z4_0_4Probs_sound ((5,4) : PairSlot))) (entropyTerm_zero_ball (Z4_0_4Probs_sound ((5,5) : PairSlot))) +def Z4_0_4Entropy : Ball := ⟨(64196816022403144530458719913309 / 50000000000000000000000000000000), (16066710667 / 25000000000000000000000000000000)⟩ +lemma Z4_0_4Entropy_sound : Z4_0_4Entropy.Encloses (Foundation.finiteEntropy Z4_0_4Value) := by + exact contains_sound (entropyPair_enclosed Z4_0_4Value Z4_0_4Terms Z4_0_4Terms_sound) (by decide +kernel) +def Z4_0_4Labels : Ball := ⟨(55347887687580346776034112349573 / 10000000000000000000000000000000), (565953783 / 312500000000000000000000000000)⟩ +lemma Z4_0_4Labels_sound : Z4_0_4Labels.Encloses + (∑ a : PairSlot, (zeroPairLaw (shape 4 0 4) a.1 a.2 : ℝ) * + Real.log (AllFieldParameters.multiplicity a.1 * AllFieldParameters.multiplicity a.2 : ℕ)) := by + exact contains_sound (pairSumBall_sound (fun a => .mul (Z4_0_4Probs a) (multLogs a)) + _ (fun a => Ball.mul_sound (Z4_0_4Probs_sound a) (multLogs_sound a))) (by decide +kernel) +def Z4_0_4Four : Ball := ⟨(170468127230152439205314640830587 / 25000000000000000000000000000000), (61343013307 / 25000000000000000000000000000000)⟩ +lemma Z4_0_4Four_sound : Z4_0_4Four.Encloses (AllFieldZeroLeafRates.fourRate (shape 4 0 4)) := by + exact contains_sound (Ball.add_sound Z4_0_4Entropy_sound Z4_0_4Labels_sound) (by decide +kernel) +def Z4_0_4H0Value (a : PairSlot) : ℝ := (halfLaw (shape 4 0 4) 0 a : ℝ) +def Z4_0_4H0E_0_5LogWitness : LogWitness := ⟨-9, 55190951304569688595534186513, 39062500000000000000000000000⟩ +def Z4_0_4H0E_0_5Log : Ball := ⟨(-589268853833220841124255600121907 / 100000000000000000000000000000000), (26469779649 / 12500000000000000000000000000000)⟩ +lemma Z4_0_4H0E_0_5Log_sound : Z4_0_4H0E_0_5Log.Encloses (Real.log (Z4_0_4H0Value ((0,5) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound ((Z4_0_4Half_sound 0) ((0,5) : PairSlot)) (w := Z4_0_4H0E_0_5LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z4_0_4H0E_0_5 : Ball := ⟨(1626115430860444246284949942957 / 100000000000000000000000000000000), (116871387 / 20000000000000000000000000000000)⟩ +lemma Z4_0_4H0E_0_5_sound : Z4_0_4H0E_0_5.Encloses (Foundation.entropyTerm (Z4_0_4H0Value ((0,5) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z4_0_4Half_sound 0) ((0,5) : PairSlot)) Z4_0_4H0E_0_5Log_sound) (by decide +kernel) +def Z4_0_4H0E_1_4LogWitness : LogWitness := ⟨-3, 6632849277085335226067309879167, 6250000000000000000000000000000⟩ +def Z4_0_4H0E_1_4Log : Ball := ⟨(-201998853833220841124255714694749 / 100000000000000000000000000000000), (42351647471 / 50000000000000000000000000000000)⟩ +lemma Z4_0_4H0E_1_4Log_sound : Z4_0_4H0E_1_4Log.Encloses (Real.log (Z4_0_4H0Value ((1,4) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound ((Z4_0_4Half_sound 0) ((1,4) : PairSlot)) (w := Z4_0_4H0E_1_4LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z4_0_4H0E_1_4 : Ball := ⟨(837392469762340720305966731003 / 3125000000000000000000000000000), (1123648383 / 10000000000000000000000000000000)⟩ +lemma Z4_0_4H0E_1_4_sound : Z4_0_4H0E_1_4.Encloses (Foundation.entropyTerm (Z4_0_4H0Value ((1,4) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z4_0_4Half_sound 0) ((1,4) : PairSlot)) Z4_0_4H0E_1_4Log_sound) (by decide +kernel) +def Z4_0_4H0E_2_2LogWitness : LogWitness := ⟨-1, 5855588794422561384849059336303, 5000000000000000000000000000000⟩ +def Z4_0_4H0E_2_2Log : Ball := ⟨(-53518853833220841124255752885733 / 100000000000000000000000000000000), (10587911893 / 25000000000000000000000000000000)⟩ +lemma Z4_0_4H0E_2_2Log_sound : Z4_0_4H0E_2_2Log.Encloses (Real.log (Z4_0_4H0Value ((2,2) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound ((Z4_0_4Half_sound 0) ((2,2) : PairSlot)) (w := Z4_0_4H0E_2_2LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z4_0_4H0E_2_2 : Ball := ⟨(31338440079614690320574653450617 / 100000000000000000000000000000000), (77498073 / 312500000000000000000000000000)⟩ +lemma Z4_0_4H0E_2_2_sound : Z4_0_4H0E_2_2.Encloses (Foundation.entropyTerm (Z4_0_4H0Value ((2,2) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z4_0_4Half_sound 0) ((2,2) : PairSlot)) Z4_0_4H0E_2_2Log_sound) (by decide +kernel) +def Z4_0_4H0E_2_3LogWitness : LogWitness := ⟨-4, 3407007932926322989871260497747, 3125000000000000000000000000000⟩ +def Z4_0_4H0E_2_3Log : Ball := ⟨(-6715471345830521028106392389981 / 2500000000000000000000000000000), (52939559317 / 50000000000000000000000000000000)⟩ +lemma Z4_0_4H0E_2_3Log_sound : Z4_0_4H0E_2_3Log.Encloses (Real.log (Z4_0_4H0Value ((2,3) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound ((Z4_0_4Half_sound 0) ((2,3) : PairSlot)) (w := Z4_0_4H0E_2_3LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z4_0_4H0E_2_3 : Ball := ⟨(18303731318867196612732623716901 / 100000000000000000000000000000000), (7214619983 / 100000000000000000000000000000000)⟩ +lemma Z4_0_4H0E_2_3_sound : Z4_0_4H0E_2_3.Encloses (Foundation.entropyTerm (Z4_0_4H0Value ((2,3) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z4_0_4Half_sound 0) ((2,3) : PairSlot)) Z4_0_4H0E_2_3Log_sound) (by decide +kernel) +def Z4_0_4H0E_3_2LogWitness : LogWitness := ⟨-4, 3407007932926322989871260497747, 3125000000000000000000000000000⟩ +def Z4_0_4H0E_3_2Log : Ball := ⟨(-6715471345830521028106392389981 / 2500000000000000000000000000000), (52939559317 / 50000000000000000000000000000000)⟩ +lemma Z4_0_4H0E_3_2Log_sound : Z4_0_4H0E_3_2Log.Encloses (Real.log (Z4_0_4H0Value ((3,2) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound ((Z4_0_4Half_sound 0) ((3,2) : PairSlot)) (w := Z4_0_4H0E_3_2LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z4_0_4H0E_3_2 : Ball := ⟨(18303731318867196612732623716901 / 100000000000000000000000000000000), (7214619983 / 100000000000000000000000000000000)⟩ +lemma Z4_0_4H0E_3_2_sound : Z4_0_4H0E_3_2.Encloses (Foundation.entropyTerm (Z4_0_4H0Value ((3,2) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z4_0_4Half_sound 0) ((3,2) : PairSlot)) Z4_0_4H0E_3_2Log_sound) (by decide +kernel) +def Z4_0_4H0E_3_3LogWitness : LogWitness := ⟨-8, 146554740536411280359956652837, 78125000000000000000000000000⟩ +def Z4_0_4H0E_3_3Log : Ball := ⟨(-245804426916610420562127809721047 / 50000000000000000000000000000000), (190582413283 / 100000000000000000000000000000000)⟩ +lemma Z4_0_4H0E_3_3Log_sound : Z4_0_4H0E_3_3Log.Encloses (Real.log (Z4_0_4H0Value ((3,3) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound ((Z4_0_4Half_sound 0) ((3,3) : PairSlot)) (w := Z4_0_4H0E_3_3LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z4_0_4H0E_3_3 : Ball := ⟨(3602380400946510922725768272093 / 100000000000000000000000000000000), (349134453 / 25000000000000000000000000000000)⟩ +lemma Z4_0_4H0E_3_3_sound : Z4_0_4H0E_3_3.Encloses (Foundation.entropyTerm (Z4_0_4H0Value ((3,3) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z4_0_4Half_sound 0) ((3,3) : PairSlot)) Z4_0_4H0E_3_3Log_sound) (by decide +kernel) +def Z4_0_4H0E_4_1LogWitness : LogWitness := ⟨-3, 6632849277085335226067309879167, 6250000000000000000000000000000⟩ +def Z4_0_4H0E_4_1Log : Ball := ⟨(-201998853833220841124255714694749 / 100000000000000000000000000000000), (42351647471 / 50000000000000000000000000000000)⟩ +lemma Z4_0_4H0E_4_1Log_sound : Z4_0_4H0E_4_1Log.Encloses (Real.log (Z4_0_4H0Value ((4,1) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound ((Z4_0_4Half_sound 0) ((4,1) : PairSlot)) (w := Z4_0_4H0E_4_1LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z4_0_4H0E_4_1 : Ball := ⟨(837392469762340720305966731003 / 3125000000000000000000000000000), (1123648383 / 10000000000000000000000000000000)⟩ +lemma Z4_0_4H0E_4_1_sound : Z4_0_4H0E_4_1.Encloses (Foundation.entropyTerm (Z4_0_4H0Value ((4,1) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z4_0_4Half_sound 0) ((4,1) : PairSlot)) Z4_0_4H0E_4_1Log_sound) (by decide +kernel) +def Z4_0_4H0E_5_0LogWitness : LogWitness := ⟨-9, 55190951304569688595534186513, 39062500000000000000000000000⟩ +def Z4_0_4H0E_5_0Log : Ball := ⟨(-589268853833220841124255600121907 / 100000000000000000000000000000000), (26469779649 / 12500000000000000000000000000000)⟩ +lemma Z4_0_4H0E_5_0Log_sound : Z4_0_4H0E_5_0Log.Encloses (Real.log (Z4_0_4H0Value ((5,0) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound ((Z4_0_4Half_sound 0) ((5,0) : PairSlot)) (w := Z4_0_4H0E_5_0LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z4_0_4H0E_5_0 : Ball := ⟨(1626115430860444246284949942957 / 100000000000000000000000000000000), (116871387 / 20000000000000000000000000000000)⟩ +lemma Z4_0_4H0E_5_0_sound : Z4_0_4H0E_5_0.Encloses (Foundation.entropyTerm (Z4_0_4H0Value ((5,0) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z4_0_4Half_sound 0) ((5,0) : PairSlot)) Z4_0_4H0E_5_0Log_sound) (by decide +kernel) +def Z4_0_4H0Terms (a : PairSlot) : Ball := + match a.1.val, a.2.val with + | 0, 5 => ⟨(1626115430860444246284949942957 / 100000000000000000000000000000000), (116871387 / 20000000000000000000000000000000)⟩ + | 1, 4 => ⟨(837392469762340720305966731003 / 3125000000000000000000000000000), (1123648383 / 10000000000000000000000000000000)⟩ + | 2, 2 => ⟨(31338440079614690320574653450617 / 100000000000000000000000000000000), (77498073 / 312500000000000000000000000000)⟩ + | 2, 3 => ⟨(18303731318867196612732623716901 / 100000000000000000000000000000000), (7214619983 / 100000000000000000000000000000000)⟩ + | 3, 2 => ⟨(18303731318867196612732623716901 / 100000000000000000000000000000000), (7214619983 / 100000000000000000000000000000000)⟩ + | 3, 3 => ⟨(3602380400946510922725768272093 / 100000000000000000000000000000000), (349134453 / 25000000000000000000000000000000)⟩ + | 4, 1 => ⟨(837392469762340720305966731003 / 3125000000000000000000000000000), (1123648383 / 10000000000000000000000000000000)⟩ + | 5, 0 => ⟨(1626115430860444246284949942957 / 100000000000000000000000000000000), (116871387 / 20000000000000000000000000000000)⟩ + | _, _ => (.exact 0) +lemma Z4_0_4H0Terms_sound (a : PairSlot) : + (Z4_0_4H0Terms a).Encloses (Foundation.entropyTerm (Z4_0_4H0Value a)) := by + rcases a with ⟨i,j⟩ + revert j i + apply forall_fin6 + · exact forall_fin6 (entropyTerm_zero_ball ((Z4_0_4Half_sound 0) ((0,0) : PairSlot))) (entropyTerm_zero_ball ((Z4_0_4Half_sound 0) ((0,1) : PairSlot))) (entropyTerm_zero_ball ((Z4_0_4Half_sound 0) ((0,2) : PairSlot))) (entropyTerm_zero_ball ((Z4_0_4Half_sound 0) ((0,3) : PairSlot))) (entropyTerm_zero_ball ((Z4_0_4Half_sound 0) ((0,4) : PairSlot))) Z4_0_4H0E_0_5_sound + · exact forall_fin6 (entropyTerm_zero_ball ((Z4_0_4Half_sound 0) ((1,0) : PairSlot))) (entropyTerm_zero_ball ((Z4_0_4Half_sound 0) ((1,1) : PairSlot))) (entropyTerm_zero_ball ((Z4_0_4Half_sound 0) ((1,2) : PairSlot))) (entropyTerm_zero_ball ((Z4_0_4Half_sound 0) ((1,3) : PairSlot))) Z4_0_4H0E_1_4_sound (entropyTerm_zero_ball ((Z4_0_4Half_sound 0) ((1,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z4_0_4Half_sound 0) ((2,0) : PairSlot))) (entropyTerm_zero_ball ((Z4_0_4Half_sound 0) ((2,1) : PairSlot))) Z4_0_4H0E_2_2_sound Z4_0_4H0E_2_3_sound (entropyTerm_zero_ball ((Z4_0_4Half_sound 0) ((2,4) : PairSlot))) (entropyTerm_zero_ball ((Z4_0_4Half_sound 0) ((2,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z4_0_4Half_sound 0) ((3,0) : PairSlot))) (entropyTerm_zero_ball ((Z4_0_4Half_sound 0) ((3,1) : PairSlot))) Z4_0_4H0E_3_2_sound Z4_0_4H0E_3_3_sound (entropyTerm_zero_ball ((Z4_0_4Half_sound 0) ((3,4) : PairSlot))) (entropyTerm_zero_ball ((Z4_0_4Half_sound 0) ((3,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z4_0_4Half_sound 0) ((4,0) : PairSlot))) Z4_0_4H0E_4_1_sound (entropyTerm_zero_ball ((Z4_0_4Half_sound 0) ((4,2) : PairSlot))) (entropyTerm_zero_ball ((Z4_0_4Half_sound 0) ((4,3) : PairSlot))) (entropyTerm_zero_ball ((Z4_0_4Half_sound 0) ((4,4) : PairSlot))) (entropyTerm_zero_ball ((Z4_0_4Half_sound 0) ((4,5) : PairSlot))) + · exact forall_fin6 Z4_0_4H0E_5_0_sound (entropyTerm_zero_ball ((Z4_0_4Half_sound 0) ((5,1) : PairSlot))) (entropyTerm_zero_ball ((Z4_0_4Half_sound 0) ((5,2) : PairSlot))) (entropyTerm_zero_ball ((Z4_0_4Half_sound 0) ((5,3) : PairSlot))) (entropyTerm_zero_ball ((Z4_0_4Half_sound 0) ((5,4) : PairSlot))) (entropyTerm_zero_ball ((Z4_0_4Half_sound 0) ((5,5) : PairSlot))) +def Z4_0_4H0Entropy : Ball := ⟨(64196816022403144530458719913309 / 50000000000000000000000000000000), (16066710667 / 25000000000000000000000000000000)⟩ +lemma Z4_0_4H0Entropy_sound : Z4_0_4H0Entropy.Encloses (Foundation.finiteEntropy Z4_0_4H0Value) := by + exact contains_sound (entropyPair_enclosed Z4_0_4H0Value Z4_0_4H0Terms Z4_0_4H0Terms_sound) (by decide +kernel) +def Z4_0_4H0Mass : Ball := ⟨(100000000000000000000000000000001 / 100000000000000000000000000000000), (21 / 10000000000000000000000000000000)⟩ +lemma Z4_0_4H0Mass_sound : Z4_0_4H0Mass.Encloses (∑ a, Z4_0_4H0Value a) := by + exact contains_sound (pairSumBall_sound (Z4_0_4Half 0) Z4_0_4H0Value (Z4_0_4Half_sound 0)) (by decide +kernel) +def Z4_0_4H0MassTermLogWitness : LogWitness := ⟨0, 100000000000000000000000000000001, 100000000000000000000000000000000⟩ +def Z4_0_4H0MassTermLog : Ball := ⟨(1 / 100000000000000000000000000000000), (5293955973 / 25000000000000000000000000000000)⟩ +lemma Z4_0_4H0MassTermLog_sound : Z4_0_4H0MassTermLog.Encloses (Real.log ((∑ a, Z4_0_4H0Value a))) := by + exact checkLog_sound logTwoBall_sound (Z4_0_4H0Mass_sound) (w := Z4_0_4H0MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z4_0_4H0MassTerm : Ball := ⟨(-1 / 100000000000000000000000000000000), (21175823893 / 100000000000000000000000000000000)⟩ +lemma Z4_0_4H0MassTerm_sound : Z4_0_4H0MassTerm.Encloses (Foundation.entropyTerm ((∑ a, Z4_0_4H0Value a))) := by + exact contains_sound (entropyTerm_ball (Z4_0_4H0Mass_sound) Z4_0_4H0MassTermLog_sound) (by decide +kernel) +def Z4_0_4H0H : Ball := ⟨(128393632044806289060917439826619 / 100000000000000000000000000000000), (85442666561 / 100000000000000000000000000000000)⟩ +lemma Z4_0_4H0H_sound : Z4_0_4H0H.Encloses (homogeneousEntropy Z4_0_4H0Value) := by + exact contains_sound (homogeneous_enclosed Z4_0_4H0Value Z4_0_4H0MassTerm_sound Z4_0_4H0Entropy_sound) (by decide +kernel) +def Z4_0_4H1Value (a : PairSlot) : ℝ := (halfLaw (shape 4 0 4) 1 a : ℝ) +def Z4_0_4H1E_0_0Log : Ball := .exact 0 +lemma Z4_0_4H1E_0_0Log_sound : Z4_0_4H1E_0_0Log.Encloses (Real.log (Z4_0_4H1Value ((0,0) : PairSlot))) := by + exact log_exact_one_ball ((Z4_0_4Half_sound 1) ((0,0) : PairSlot)) +def Z4_0_4H1E_0_0 : Ball := ⟨0, 0⟩ +lemma Z4_0_4H1E_0_0_sound : Z4_0_4H1E_0_0.Encloses (Foundation.entropyTerm (Z4_0_4H1Value ((0,0) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z4_0_4Half_sound 1) ((0,0) : PairSlot)) Z4_0_4H1E_0_0Log_sound) (by decide +kernel) +def Z4_0_4H1Terms (a : PairSlot) : Ball := + match a.1.val, a.2.val with + | 0, 0 => ⟨0, 0⟩ + | _, _ => (.exact 0) +lemma Z4_0_4H1Terms_sound (a : PairSlot) : + (Z4_0_4H1Terms a).Encloses (Foundation.entropyTerm (Z4_0_4H1Value a)) := by + rcases a with ⟨i,j⟩ + revert j i + apply forall_fin6 + · exact forall_fin6 Z4_0_4H1E_0_0_sound (entropyTerm_zero_ball ((Z4_0_4Half_sound 1) ((0,1) : PairSlot))) (entropyTerm_zero_ball ((Z4_0_4Half_sound 1) ((0,2) : PairSlot))) (entropyTerm_zero_ball ((Z4_0_4Half_sound 1) ((0,3) : PairSlot))) (entropyTerm_zero_ball ((Z4_0_4Half_sound 1) ((0,4) : PairSlot))) (entropyTerm_zero_ball ((Z4_0_4Half_sound 1) ((0,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z4_0_4Half_sound 1) ((1,0) : PairSlot))) (entropyTerm_zero_ball ((Z4_0_4Half_sound 1) ((1,1) : PairSlot))) (entropyTerm_zero_ball ((Z4_0_4Half_sound 1) ((1,2) : PairSlot))) (entropyTerm_zero_ball ((Z4_0_4Half_sound 1) ((1,3) : PairSlot))) (entropyTerm_zero_ball ((Z4_0_4Half_sound 1) ((1,4) : PairSlot))) (entropyTerm_zero_ball ((Z4_0_4Half_sound 1) ((1,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z4_0_4Half_sound 1) ((2,0) : PairSlot))) (entropyTerm_zero_ball ((Z4_0_4Half_sound 1) ((2,1) : PairSlot))) (entropyTerm_zero_ball ((Z4_0_4Half_sound 1) ((2,2) : PairSlot))) (entropyTerm_zero_ball ((Z4_0_4Half_sound 1) ((2,3) : PairSlot))) (entropyTerm_zero_ball ((Z4_0_4Half_sound 1) ((2,4) : PairSlot))) (entropyTerm_zero_ball ((Z4_0_4Half_sound 1) ((2,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z4_0_4Half_sound 1) ((3,0) : PairSlot))) (entropyTerm_zero_ball ((Z4_0_4Half_sound 1) ((3,1) : PairSlot))) (entropyTerm_zero_ball ((Z4_0_4Half_sound 1) ((3,2) : PairSlot))) (entropyTerm_zero_ball ((Z4_0_4Half_sound 1) ((3,3) : PairSlot))) (entropyTerm_zero_ball ((Z4_0_4Half_sound 1) ((3,4) : PairSlot))) (entropyTerm_zero_ball ((Z4_0_4Half_sound 1) ((3,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z4_0_4Half_sound 1) ((4,0) : PairSlot))) (entropyTerm_zero_ball ((Z4_0_4Half_sound 1) ((4,1) : PairSlot))) (entropyTerm_zero_ball ((Z4_0_4Half_sound 1) ((4,2) : PairSlot))) (entropyTerm_zero_ball ((Z4_0_4Half_sound 1) ((4,3) : PairSlot))) (entropyTerm_zero_ball ((Z4_0_4Half_sound 1) ((4,4) : PairSlot))) (entropyTerm_zero_ball ((Z4_0_4Half_sound 1) ((4,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z4_0_4Half_sound 1) ((5,0) : PairSlot))) (entropyTerm_zero_ball ((Z4_0_4Half_sound 1) ((5,1) : PairSlot))) (entropyTerm_zero_ball ((Z4_0_4Half_sound 1) ((5,2) : PairSlot))) (entropyTerm_zero_ball ((Z4_0_4Half_sound 1) ((5,3) : PairSlot))) (entropyTerm_zero_ball ((Z4_0_4Half_sound 1) ((5,4) : PairSlot))) (entropyTerm_zero_ball ((Z4_0_4Half_sound 1) ((5,5) : PairSlot))) +def Z4_0_4H1Entropy : Ball := ⟨0, 0⟩ +lemma Z4_0_4H1Entropy_sound : Z4_0_4H1Entropy.Encloses (Foundation.finiteEntropy Z4_0_4H1Value) := by + exact contains_sound (entropyPair_enclosed Z4_0_4H1Value Z4_0_4H1Terms Z4_0_4H1Terms_sound) (by decide +kernel) +def Z4_0_4H1Mass : Ball := ⟨1, 0⟩ +lemma Z4_0_4H1Mass_sound : Z4_0_4H1Mass.Encloses (∑ a, Z4_0_4H1Value a) := by + exact contains_sound (pairSumBall_sound (Z4_0_4Half 1) Z4_0_4H1Value (Z4_0_4Half_sound 1)) (by decide +kernel) +def Z4_0_4H1MassTermLog : Ball := .exact 0 +lemma Z4_0_4H1MassTermLog_sound : Z4_0_4H1MassTermLog.Encloses (Real.log ((∑ a, Z4_0_4H1Value a))) := by + exact log_exact_one_ball (Z4_0_4H1Mass_sound) +def Z4_0_4H1MassTerm : Ball := ⟨0, 0⟩ +lemma Z4_0_4H1MassTerm_sound : Z4_0_4H1MassTerm.Encloses (Foundation.entropyTerm ((∑ a, Z4_0_4H1Value a))) := by + exact contains_sound (entropyTerm_ball (Z4_0_4H1Mass_sound) Z4_0_4H1MassTermLog_sound) (by decide +kernel) +def Z4_0_4H1H : Ball := ⟨0, 0⟩ +lemma Z4_0_4H1H_sound : Z4_0_4H1H.Encloses (homogeneousEntropy Z4_0_4H1Value) := by + exact contains_sound (homogeneous_enclosed Z4_0_4H1Value Z4_0_4H1MassTerm_sound Z4_0_4H1Entropy_sound) (by decide +kernel) +def Z4_0_4H2Value (a : PairSlot) : ℝ := (halfLaw (shape 4 0 4) 2 a : ℝ) +def Z4_0_4H2E_5_0LogWitness : LogWitness := ⟨-9, 55190951304569688595534186513, 39062500000000000000000000000⟩ +def Z4_0_4H2E_5_0Log : Ball := ⟨(-589268853833220841124255600121907 / 100000000000000000000000000000000), (26469779649 / 12500000000000000000000000000000)⟩ +lemma Z4_0_4H2E_5_0Log_sound : Z4_0_4H2E_5_0Log.Encloses (Real.log (Z4_0_4H2Value ((5,0) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound ((Z4_0_4Half_sound 2) ((5,0) : PairSlot)) (w := Z4_0_4H2E_5_0LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z4_0_4H2E_5_0 : Ball := ⟨(1626115430860444246284949942957 / 100000000000000000000000000000000), (116871387 / 20000000000000000000000000000000)⟩ +lemma Z4_0_4H2E_5_0_sound : Z4_0_4H2E_5_0.Encloses (Foundation.entropyTerm (Z4_0_4H2Value ((5,0) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z4_0_4Half_sound 2) ((5,0) : PairSlot)) Z4_0_4H2E_5_0Log_sound) (by decide +kernel) +def Z4_0_4H2E_4_1LogWitness : LogWitness := ⟨-3, 6632849277085335226067309879167, 6250000000000000000000000000000⟩ +def Z4_0_4H2E_4_1Log : Ball := ⟨(-201998853833220841124255714694749 / 100000000000000000000000000000000), (42351647471 / 50000000000000000000000000000000)⟩ +lemma Z4_0_4H2E_4_1Log_sound : Z4_0_4H2E_4_1Log.Encloses (Real.log (Z4_0_4H2Value ((4,1) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound ((Z4_0_4Half_sound 2) ((4,1) : PairSlot)) (w := Z4_0_4H2E_4_1LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z4_0_4H2E_4_1 : Ball := ⟨(837392469762340720305966731003 / 3125000000000000000000000000000), (1123648383 / 10000000000000000000000000000000)⟩ +lemma Z4_0_4H2E_4_1_sound : Z4_0_4H2E_4_1.Encloses (Foundation.entropyTerm (Z4_0_4H2Value ((4,1) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z4_0_4Half_sound 2) ((4,1) : PairSlot)) Z4_0_4H2E_4_1Log_sound) (by decide +kernel) +def Z4_0_4H2E_2_2LogWitness : LogWitness := ⟨-1, 5855588794422561384849059336303, 5000000000000000000000000000000⟩ +def Z4_0_4H2E_2_2Log : Ball := ⟨(-53518853833220841124255752885733 / 100000000000000000000000000000000), (10587911893 / 25000000000000000000000000000000)⟩ +lemma Z4_0_4H2E_2_2Log_sound : Z4_0_4H2E_2_2Log.Encloses (Real.log (Z4_0_4H2Value ((2,2) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound ((Z4_0_4Half_sound 2) ((2,2) : PairSlot)) (w := Z4_0_4H2E_2_2LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z4_0_4H2E_2_2 : Ball := ⟨(31338440079614690320574653450617 / 100000000000000000000000000000000), (77498073 / 312500000000000000000000000000)⟩ +lemma Z4_0_4H2E_2_2_sound : Z4_0_4H2E_2_2.Encloses (Foundation.entropyTerm (Z4_0_4H2Value ((2,2) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z4_0_4Half_sound 2) ((2,2) : PairSlot)) Z4_0_4H2E_2_2Log_sound) (by decide +kernel) +def Z4_0_4H2E_2_3LogWitness : LogWitness := ⟨-4, 3407007932926322989871260497747, 3125000000000000000000000000000⟩ +def Z4_0_4H2E_2_3Log : Ball := ⟨(-6715471345830521028106392389981 / 2500000000000000000000000000000), (52939559317 / 50000000000000000000000000000000)⟩ +lemma Z4_0_4H2E_2_3Log_sound : Z4_0_4H2E_2_3Log.Encloses (Real.log (Z4_0_4H2Value ((2,3) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound ((Z4_0_4Half_sound 2) ((2,3) : PairSlot)) (w := Z4_0_4H2E_2_3LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z4_0_4H2E_2_3 : Ball := ⟨(18303731318867196612732623716901 / 100000000000000000000000000000000), (7214619983 / 100000000000000000000000000000000)⟩ +lemma Z4_0_4H2E_2_3_sound : Z4_0_4H2E_2_3.Encloses (Foundation.entropyTerm (Z4_0_4H2Value ((2,3) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z4_0_4Half_sound 2) ((2,3) : PairSlot)) Z4_0_4H2E_2_3Log_sound) (by decide +kernel) +def Z4_0_4H2E_3_2LogWitness : LogWitness := ⟨-4, 3407007932926322989871260497747, 3125000000000000000000000000000⟩ +def Z4_0_4H2E_3_2Log : Ball := ⟨(-6715471345830521028106392389981 / 2500000000000000000000000000000), (52939559317 / 50000000000000000000000000000000)⟩ +lemma Z4_0_4H2E_3_2Log_sound : Z4_0_4H2E_3_2Log.Encloses (Real.log (Z4_0_4H2Value ((3,2) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound ((Z4_0_4Half_sound 2) ((3,2) : PairSlot)) (w := Z4_0_4H2E_3_2LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z4_0_4H2E_3_2 : Ball := ⟨(18303731318867196612732623716901 / 100000000000000000000000000000000), (7214619983 / 100000000000000000000000000000000)⟩ +lemma Z4_0_4H2E_3_2_sound : Z4_0_4H2E_3_2.Encloses (Foundation.entropyTerm (Z4_0_4H2Value ((3,2) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z4_0_4Half_sound 2) ((3,2) : PairSlot)) Z4_0_4H2E_3_2Log_sound) (by decide +kernel) +def Z4_0_4H2E_3_3LogWitness : LogWitness := ⟨-8, 146554740536411280359956652837, 78125000000000000000000000000⟩ +def Z4_0_4H2E_3_3Log : Ball := ⟨(-245804426916610420562127809721047 / 50000000000000000000000000000000), (190582413283 / 100000000000000000000000000000000)⟩ +lemma Z4_0_4H2E_3_3Log_sound : Z4_0_4H2E_3_3Log.Encloses (Real.log (Z4_0_4H2Value ((3,3) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound ((Z4_0_4Half_sound 2) ((3,3) : PairSlot)) (w := Z4_0_4H2E_3_3LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z4_0_4H2E_3_3 : Ball := ⟨(3602380400946510922725768272093 / 100000000000000000000000000000000), (349134453 / 25000000000000000000000000000000)⟩ +lemma Z4_0_4H2E_3_3_sound : Z4_0_4H2E_3_3.Encloses (Foundation.entropyTerm (Z4_0_4H2Value ((3,3) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z4_0_4Half_sound 2) ((3,3) : PairSlot)) Z4_0_4H2E_3_3Log_sound) (by decide +kernel) +def Z4_0_4H2E_1_4LogWitness : LogWitness := ⟨-3, 6632849277085335226067309879167, 6250000000000000000000000000000⟩ +def Z4_0_4H2E_1_4Log : Ball := ⟨(-201998853833220841124255714694749 / 100000000000000000000000000000000), (42351647471 / 50000000000000000000000000000000)⟩ +lemma Z4_0_4H2E_1_4Log_sound : Z4_0_4H2E_1_4Log.Encloses (Real.log (Z4_0_4H2Value ((1,4) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound ((Z4_0_4Half_sound 2) ((1,4) : PairSlot)) (w := Z4_0_4H2E_1_4LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z4_0_4H2E_1_4 : Ball := ⟨(837392469762340720305966731003 / 3125000000000000000000000000000), (1123648383 / 10000000000000000000000000000000)⟩ +lemma Z4_0_4H2E_1_4_sound : Z4_0_4H2E_1_4.Encloses (Foundation.entropyTerm (Z4_0_4H2Value ((1,4) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z4_0_4Half_sound 2) ((1,4) : PairSlot)) Z4_0_4H2E_1_4Log_sound) (by decide +kernel) +def Z4_0_4H2E_0_5LogWitness : LogWitness := ⟨-9, 55190951304569688595534186513, 39062500000000000000000000000⟩ +def Z4_0_4H2E_0_5Log : Ball := ⟨(-589268853833220841124255600121907 / 100000000000000000000000000000000), (26469779649 / 12500000000000000000000000000000)⟩ +lemma Z4_0_4H2E_0_5Log_sound : Z4_0_4H2E_0_5Log.Encloses (Real.log (Z4_0_4H2Value ((0,5) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound ((Z4_0_4Half_sound 2) ((0,5) : PairSlot)) (w := Z4_0_4H2E_0_5LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z4_0_4H2E_0_5 : Ball := ⟨(1626115430860444246284949942957 / 100000000000000000000000000000000), (116871387 / 20000000000000000000000000000000)⟩ +lemma Z4_0_4H2E_0_5_sound : Z4_0_4H2E_0_5.Encloses (Foundation.entropyTerm (Z4_0_4H2Value ((0,5) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z4_0_4Half_sound 2) ((0,5) : PairSlot)) Z4_0_4H2E_0_5Log_sound) (by decide +kernel) +def Z4_0_4H2Terms (a : PairSlot) : Ball := + match a.1.val, a.2.val with + | 5, 0 => ⟨(1626115430860444246284949942957 / 100000000000000000000000000000000), (116871387 / 20000000000000000000000000000000)⟩ + | 4, 1 => ⟨(837392469762340720305966731003 / 3125000000000000000000000000000), (1123648383 / 10000000000000000000000000000000)⟩ + | 2, 2 => ⟨(31338440079614690320574653450617 / 100000000000000000000000000000000), (77498073 / 312500000000000000000000000000)⟩ + | 2, 3 => ⟨(18303731318867196612732623716901 / 100000000000000000000000000000000), (7214619983 / 100000000000000000000000000000000)⟩ + | 3, 2 => ⟨(18303731318867196612732623716901 / 100000000000000000000000000000000), (7214619983 / 100000000000000000000000000000000)⟩ + | 3, 3 => ⟨(3602380400946510922725768272093 / 100000000000000000000000000000000), (349134453 / 25000000000000000000000000000000)⟩ + | 1, 4 => ⟨(837392469762340720305966731003 / 3125000000000000000000000000000), (1123648383 / 10000000000000000000000000000000)⟩ + | 0, 5 => ⟨(1626115430860444246284949942957 / 100000000000000000000000000000000), (116871387 / 20000000000000000000000000000000)⟩ + | _, _ => (.exact 0) +lemma Z4_0_4H2Terms_sound (a : PairSlot) : + (Z4_0_4H2Terms a).Encloses (Foundation.entropyTerm (Z4_0_4H2Value a)) := by + rcases a with ⟨i,j⟩ + revert j i + apply forall_fin6 + · exact forall_fin6 (entropyTerm_zero_ball ((Z4_0_4Half_sound 2) ((0,0) : PairSlot))) (entropyTerm_zero_ball ((Z4_0_4Half_sound 2) ((0,1) : PairSlot))) (entropyTerm_zero_ball ((Z4_0_4Half_sound 2) ((0,2) : PairSlot))) (entropyTerm_zero_ball ((Z4_0_4Half_sound 2) ((0,3) : PairSlot))) (entropyTerm_zero_ball ((Z4_0_4Half_sound 2) ((0,4) : PairSlot))) Z4_0_4H2E_0_5_sound + · exact forall_fin6 (entropyTerm_zero_ball ((Z4_0_4Half_sound 2) ((1,0) : PairSlot))) (entropyTerm_zero_ball ((Z4_0_4Half_sound 2) ((1,1) : PairSlot))) (entropyTerm_zero_ball ((Z4_0_4Half_sound 2) ((1,2) : PairSlot))) (entropyTerm_zero_ball ((Z4_0_4Half_sound 2) ((1,3) : PairSlot))) Z4_0_4H2E_1_4_sound (entropyTerm_zero_ball ((Z4_0_4Half_sound 2) ((1,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z4_0_4Half_sound 2) ((2,0) : PairSlot))) (entropyTerm_zero_ball ((Z4_0_4Half_sound 2) ((2,1) : PairSlot))) Z4_0_4H2E_2_2_sound Z4_0_4H2E_2_3_sound (entropyTerm_zero_ball ((Z4_0_4Half_sound 2) ((2,4) : PairSlot))) (entropyTerm_zero_ball ((Z4_0_4Half_sound 2) ((2,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z4_0_4Half_sound 2) ((3,0) : PairSlot))) (entropyTerm_zero_ball ((Z4_0_4Half_sound 2) ((3,1) : PairSlot))) Z4_0_4H2E_3_2_sound Z4_0_4H2E_3_3_sound (entropyTerm_zero_ball ((Z4_0_4Half_sound 2) ((3,4) : PairSlot))) (entropyTerm_zero_ball ((Z4_0_4Half_sound 2) ((3,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z4_0_4Half_sound 2) ((4,0) : PairSlot))) Z4_0_4H2E_4_1_sound (entropyTerm_zero_ball ((Z4_0_4Half_sound 2) ((4,2) : PairSlot))) (entropyTerm_zero_ball ((Z4_0_4Half_sound 2) ((4,3) : PairSlot))) (entropyTerm_zero_ball ((Z4_0_4Half_sound 2) ((4,4) : PairSlot))) (entropyTerm_zero_ball ((Z4_0_4Half_sound 2) ((4,5) : PairSlot))) + · exact forall_fin6 Z4_0_4H2E_5_0_sound (entropyTerm_zero_ball ((Z4_0_4Half_sound 2) ((5,1) : PairSlot))) (entropyTerm_zero_ball ((Z4_0_4Half_sound 2) ((5,2) : PairSlot))) (entropyTerm_zero_ball ((Z4_0_4Half_sound 2) ((5,3) : PairSlot))) (entropyTerm_zero_ball ((Z4_0_4Half_sound 2) ((5,4) : PairSlot))) (entropyTerm_zero_ball ((Z4_0_4Half_sound 2) ((5,5) : PairSlot))) +def Z4_0_4H2Entropy : Ball := ⟨(64196816022403144530458719913309 / 50000000000000000000000000000000), (16066710667 / 25000000000000000000000000000000)⟩ +lemma Z4_0_4H2Entropy_sound : Z4_0_4H2Entropy.Encloses (Foundation.finiteEntropy Z4_0_4H2Value) := by + exact contains_sound (entropyPair_enclosed Z4_0_4H2Value Z4_0_4H2Terms Z4_0_4H2Terms_sound) (by decide +kernel) +def Z4_0_4H2Mass : Ball := ⟨(100000000000000000000000000000001 / 100000000000000000000000000000000), (21 / 10000000000000000000000000000000)⟩ +lemma Z4_0_4H2Mass_sound : Z4_0_4H2Mass.Encloses (∑ a, Z4_0_4H2Value a) := by + exact contains_sound (pairSumBall_sound (Z4_0_4Half 2) Z4_0_4H2Value (Z4_0_4Half_sound 2)) (by decide +kernel) +def Z4_0_4H2MassTermLogWitness : LogWitness := ⟨0, 100000000000000000000000000000001, 100000000000000000000000000000000⟩ +def Z4_0_4H2MassTermLog : Ball := ⟨(1 / 100000000000000000000000000000000), (5293955973 / 25000000000000000000000000000000)⟩ +lemma Z4_0_4H2MassTermLog_sound : Z4_0_4H2MassTermLog.Encloses (Real.log ((∑ a, Z4_0_4H2Value a))) := by + exact checkLog_sound logTwoBall_sound (Z4_0_4H2Mass_sound) (w := Z4_0_4H2MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z4_0_4H2MassTerm : Ball := ⟨(-1 / 100000000000000000000000000000000), (21175823893 / 100000000000000000000000000000000)⟩ +lemma Z4_0_4H2MassTerm_sound : Z4_0_4H2MassTerm.Encloses (Foundation.entropyTerm ((∑ a, Z4_0_4H2Value a))) := by + exact contains_sound (entropyTerm_ball (Z4_0_4H2Mass_sound) Z4_0_4H2MassTermLog_sound) (by decide +kernel) +def Z4_0_4H2H : Ball := ⟨(128393632044806289060917439826619 / 100000000000000000000000000000000), (85442666561 / 100000000000000000000000000000000)⟩ +lemma Z4_0_4H2H_sound : Z4_0_4H2H.Encloses (homogeneousEntropy Z4_0_4H2Value) := by + exact contains_sound (homogeneous_enclosed Z4_0_4H2Value Z4_0_4H2MassTerm_sound Z4_0_4H2Entropy_sound) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/Certificates/Four4_4_0.lean b/lean/OAI/LinearAlgebra/MatrixFields/Certificates/Four4_4_0.lean new file mode 100644 index 0000000000000000000000000000000000000000..ff7ea4540243bd95caac650ae491fffa0020d12e --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/Certificates/Four4_4_0.lean @@ -0,0 +1,666 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Certificates.Four0_4_4 + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def Z4_4_0Raw (ij : PairSlot) : Ball := + match ij.1.val, ij.2.val with + | 0, 0 => w195 + | 0, 1 => w195 + | 0, 2 => w195 + | 0, 3 => w195 + | 0, 4 => w195 + | 0, 5 => w123 + | 1, 0 => w195 + | 1, 1 => w195 + | 1, 2 => w195 + | 1, 3 => w195 + | 1, 4 => w212 + | 1, 5 => w195 + | 2, 0 => w195 + | 2, 1 => w195 + | 2, 2 => w221 + | 2, 3 => w204 + | 2, 4 => w195 + | 2, 5 => w195 + | 3, 0 => w195 + | 3, 1 => w195 + | 3, 2 => w204 + | 3, 3 => w195 + | 3, 4 => w195 + | 3, 5 => w195 + | 4, 0 => w195 + | 4, 1 => w212 + | 4, 2 => w195 + | 4, 3 => w195 + | 4, 4 => w195 + | 4, 5 => w195 + | 5, 0 => w123 + | 5, 1 => w195 + | 5, 2 => w195 + | 5, 3 => w195 + | 5, 4 => w195 + | 5, 5 => w195 + | _, _ => (.exact 0) +lemma Z4_4_0Raw_sound_0 (j : Fin 6) : + (Z4_4_0Raw (0,j)).Encloses (weight (orderedPairInteger (shape 4 4 0) 0 j) : ℝ) := by + fin_cases j + · change (Z4_4_0Raw (0,0)).Encloses (weight (orderedPairInteger (shape 4 4 0) 0 0) : ℝ) + have he : orderedPairInteger (shape 4 4 0) 0 0 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z4_4_0Raw (0,1)).Encloses (weight (orderedPairInteger (shape 4 4 0) 0 1) : ℝ) + have he : orderedPairInteger (shape 4 4 0) 0 1 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z4_4_0Raw (0,2)).Encloses (weight (orderedPairInteger (shape 4 4 0) 0 2) : ℝ) + have he : orderedPairInteger (shape 4 4 0) 0 2 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z4_4_0Raw (0,3)).Encloses (weight (orderedPairInteger (shape 4 4 0) 0 3) : ℝ) + have he : orderedPairInteger (shape 4 4 0) 0 3 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z4_4_0Raw (0,4)).Encloses (weight (orderedPairInteger (shape 4 4 0) 0 4) : ℝ) + have he : orderedPairInteger (shape 4 4 0) 0 4 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z4_4_0Raw (0,5)).Encloses (weight (orderedPairInteger (shape 4 4 0) 0 5) : ℝ) + have he : orderedPairInteger (shape 4 4 0) 0 5 = (-12216) := by decide +kernel + rw [he] + exact w123_sound +lemma Z4_4_0Raw_sound_1 (j : Fin 6) : + (Z4_4_0Raw (1,j)).Encloses (weight (orderedPairInteger (shape 4 4 0) 1 j) : ℝ) := by + fin_cases j + · change (Z4_4_0Raw (1,0)).Encloses (weight (orderedPairInteger (shape 4 4 0) 1 0) : ℝ) + have he : orderedPairInteger (shape 4 4 0) 1 0 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z4_4_0Raw (1,1)).Encloses (weight (orderedPairInteger (shape 4 4 0) 1 1) : ℝ) + have he : orderedPairInteger (shape 4 4 0) 1 1 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z4_4_0Raw (1,2)).Encloses (weight (orderedPairInteger (shape 4 4 0) 1 2) : ℝ) + have he : orderedPairInteger (shape 4 4 0) 1 2 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z4_4_0Raw (1,3)).Encloses (weight (orderedPairInteger (shape 4 4 0) 1 3) : ℝ) + have he : orderedPairInteger (shape 4 4 0) 1 3 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z4_4_0Raw (1,4)).Encloses (weight (orderedPairInteger (shape 4 4 0) 1 4) : ℝ) + have he : orderedPairInteger (shape 4 4 0) 1 4 = (28778) := by decide +kernel + rw [he] + exact w212_sound + · change (Z4_4_0Raw (1,5)).Encloses (weight (orderedPairInteger (shape 4 4 0) 1 5) : ℝ) + have he : orderedPairInteger (shape 4 4 0) 1 5 = (0) := by decide +kernel + rw [he] + exact w195_sound +lemma Z4_4_0Raw_sound_2 (j : Fin 6) : + (Z4_4_0Raw (2,j)).Encloses (weight (orderedPairInteger (shape 4 4 0) 2 j) : ℝ) := by + fin_cases j + · change (Z4_4_0Raw (2,0)).Encloses (weight (orderedPairInteger (shape 4 4 0) 2 0) : ℝ) + have he : orderedPairInteger (shape 4 4 0) 2 0 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z4_4_0Raw (2,1)).Encloses (weight (orderedPairInteger (shape 4 4 0) 2 1) : ℝ) + have he : orderedPairInteger (shape 4 4 0) 2 1 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z4_4_0Raw (2,2)).Encloses (weight (orderedPairInteger (shape 4 4 0) 2 2) : ℝ) + have he : orderedPairInteger (shape 4 4 0) 2 2 = (44147) := by decide +kernel + rw [he] + exact w221_sound + · change (Z4_4_0Raw (2,3)).Encloses (weight (orderedPairInteger (shape 4 4 0) 2 3) : ℝ) + have he : orderedPairInteger (shape 4 4 0) 2 3 = (22176) := by decide +kernel + rw [he] + exact w204_sound + · change (Z4_4_0Raw (2,4)).Encloses (weight (orderedPairInteger (shape 4 4 0) 2 4) : ℝ) + have he : orderedPairInteger (shape 4 4 0) 2 4 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z4_4_0Raw (2,5)).Encloses (weight (orderedPairInteger (shape 4 4 0) 2 5) : ℝ) + have he : orderedPairInteger (shape 4 4 0) 2 5 = (0) := by decide +kernel + rw [he] + exact w195_sound +lemma Z4_4_0Raw_sound_3 (j : Fin 6) : + (Z4_4_0Raw (3,j)).Encloses (weight (orderedPairInteger (shape 4 4 0) 3 j) : ℝ) := by + fin_cases j + · change (Z4_4_0Raw (3,0)).Encloses (weight (orderedPairInteger (shape 4 4 0) 3 0) : ℝ) + have he : orderedPairInteger (shape 4 4 0) 3 0 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z4_4_0Raw (3,1)).Encloses (weight (orderedPairInteger (shape 4 4 0) 3 1) : ℝ) + have he : orderedPairInteger (shape 4 4 0) 3 1 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z4_4_0Raw (3,2)).Encloses (weight (orderedPairInteger (shape 4 4 0) 3 2) : ℝ) + have he : orderedPairInteger (shape 4 4 0) 3 2 = (22176) := by decide +kernel + rw [he] + exact w204_sound + · change (Z4_4_0Raw (3,3)).Encloses (weight (orderedPairInteger (shape 4 4 0) 3 3) : ℝ) + have he : orderedPairInteger (shape 4 4 0) 3 3 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z4_4_0Raw (3,4)).Encloses (weight (orderedPairInteger (shape 4 4 0) 3 4) : ℝ) + have he : orderedPairInteger (shape 4 4 0) 3 4 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z4_4_0Raw (3,5)).Encloses (weight (orderedPairInteger (shape 4 4 0) 3 5) : ℝ) + have he : orderedPairInteger (shape 4 4 0) 3 5 = (0) := by decide +kernel + rw [he] + exact w195_sound +lemma Z4_4_0Raw_sound_4 (j : Fin 6) : + (Z4_4_0Raw (4,j)).Encloses (weight (orderedPairInteger (shape 4 4 0) 4 j) : ℝ) := by + fin_cases j + · change (Z4_4_0Raw (4,0)).Encloses (weight (orderedPairInteger (shape 4 4 0) 4 0) : ℝ) + have he : orderedPairInteger (shape 4 4 0) 4 0 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z4_4_0Raw (4,1)).Encloses (weight (orderedPairInteger (shape 4 4 0) 4 1) : ℝ) + have he : orderedPairInteger (shape 4 4 0) 4 1 = (28778) := by decide +kernel + rw [he] + exact w212_sound + · change (Z4_4_0Raw (4,2)).Encloses (weight (orderedPairInteger (shape 4 4 0) 4 2) : ℝ) + have he : orderedPairInteger (shape 4 4 0) 4 2 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z4_4_0Raw (4,3)).Encloses (weight (orderedPairInteger (shape 4 4 0) 4 3) : ℝ) + have he : orderedPairInteger (shape 4 4 0) 4 3 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z4_4_0Raw (4,4)).Encloses (weight (orderedPairInteger (shape 4 4 0) 4 4) : ℝ) + have he : orderedPairInteger (shape 4 4 0) 4 4 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z4_4_0Raw (4,5)).Encloses (weight (orderedPairInteger (shape 4 4 0) 4 5) : ℝ) + have he : orderedPairInteger (shape 4 4 0) 4 5 = (0) := by decide +kernel + rw [he] + exact w195_sound +lemma Z4_4_0Raw_sound_5 (j : Fin 6) : + (Z4_4_0Raw (5,j)).Encloses (weight (orderedPairInteger (shape 4 4 0) 5 j) : ℝ) := by + fin_cases j + · change (Z4_4_0Raw (5,0)).Encloses (weight (orderedPairInteger (shape 4 4 0) 5 0) : ℝ) + have he : orderedPairInteger (shape 4 4 0) 5 0 = (-12216) := by decide +kernel + rw [he] + exact w123_sound + · change (Z4_4_0Raw (5,1)).Encloses (weight (orderedPairInteger (shape 4 4 0) 5 1) : ℝ) + have he : orderedPairInteger (shape 4 4 0) 5 1 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z4_4_0Raw (5,2)).Encloses (weight (orderedPairInteger (shape 4 4 0) 5 2) : ℝ) + have he : orderedPairInteger (shape 4 4 0) 5 2 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z4_4_0Raw (5,3)).Encloses (weight (orderedPairInteger (shape 4 4 0) 5 3) : ℝ) + have he : orderedPairInteger (shape 4 4 0) 5 3 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z4_4_0Raw (5,4)).Encloses (weight (orderedPairInteger (shape 4 4 0) 5 4) : ℝ) + have he : orderedPairInteger (shape 4 4 0) 5 4 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z4_4_0Raw (5,5)).Encloses (weight (orderedPairInteger (shape 4 4 0) 5 5) : ℝ) + have he : orderedPairInteger (shape 4 4 0) 5 5 = (0) := by decide +kernel + rw [he] + exact w195_sound +lemma Z4_4_0Raw_sound (ij : PairSlot) : + (Z4_4_0Raw ij).Encloses (weight (orderedPairInteger (shape 4 4 0) ij.1 ij.2) : ℝ) := by + rcases ij with ⟨i,j⟩ + revert i + exact forall_fin6 (Z4_4_0Raw_sound_0 j) (Z4_4_0Raw_sound_1 j) (Z4_4_0Raw_sound_2 j) (Z4_4_0Raw_sound_3 j) (Z4_4_0Raw_sound_4 j) (Z4_4_0Raw_sound_5 j) +def Z4_4_0Den : Ball := ⟨(1381673256774017391432963646374551 / 10000000000000000000000000000000), (7051 / 50000000000000000000000000000000)⟩ +lemma Z4_4_0Den_sound : Z4_4_0Den.Encloses + (((orderedPairs (shape 4 4 0)).map (fun ij => weight (orderedPairInteger (shape 4 4 0) ij.1 ij.2))).sum : ℝ) := by + exact contains_sound (list_cast_enclosed (orderedPairs (shape 4 4 0)) Z4_4_0Raw + (fun ij => weight (orderedPairInteger (shape 4 4 0) ij.1 ij.2)) + (fun ij _ => Z4_4_0Raw_sound ij)) (by decide +kernel) +lemma Z4_4_0Den_pos : 0 < Z4_4_0Den.lower := by decide +kernel +def Z4_4_0Probs (ij : PairSlot) : Ball := + match ij.1.val, ij.2.val with + | 0, 5 => ⟨(13333388289568308767749416709 / 6250000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 1, 4 => ⟨(12864926472604064794547580018297 / 100000000000000000000000000000000), (27 / 100000000000000000000000000000000)⟩ + | 2, 2 => ⟨(59823869115870383240874620994737 / 100000000000000000000000000000000), (123 / 100000000000000000000000000000000)⟩ + | 2, 3 => ⟨(1661981174399030590448466000577 / 25000000000000000000000000000000), (7 / 50000000000000000000000000000000)⟩ + | 3, 2 => ⟨(1661981174399030590448466000577 / 25000000000000000000000000000000), (7 / 50000000000000000000000000000000)⟩ + | 3, 3 => ⟨(180940029615764141468627407341 / 25000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ + | 4, 1 => ⟨(12864926472604064794547580018297 / 100000000000000000000000000000000), (27 / 100000000000000000000000000000000)⟩ + | 5, 0 => ⟨(13333388289568308767749416709 / 6250000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | _, _ => (.exact 0) +lemma Z4_4_0Contains : ∀ i j : Fin 6, + statisticWeight i + statisticWeight j = shapeMax (shape 4 4 0) → + contains (.mul (Z4_4_0Raw (i,j)) (.inv Z4_4_0Den)) (Z4_4_0Probs (i,j)) = true := by + decide +kernel +lemma Z4_4_0Zero : ∀ i j : Fin 6, + statisticWeight i + statisticWeight j ≠ shapeMax (shape 4 4 0) → Z4_4_0Probs (i,j) = .exact 0 := by + decide +kernel +lemma Z4_4_0Probs_sound (ij : PairSlot) : + (Z4_4_0Probs ij).Encloses (zeroPairLaw (shape 4 4 0) ij.1 ij.2 : ℝ) := by + by_cases h : statisticWeight ij.1 + statisticWeight ij.2 = shapeMax (shape 4 4 0) + · have hb := contains_sound (Ball.mul_sound (Z4_4_0Raw_sound ij) + (Ball.inv_sound Z4_4_0Den_sound Z4_4_0Den_pos)) (Z4_4_0Contains ij.1 ij.2 h) + simpa only [zeroPairLaw, h, ite_true, Rat.cast_div, Rat.cast_mul, + Rat.cast_inv, div_eq_mul_inv] using hb + · rw [Z4_4_0Zero ij.1 ij.2 h] + simpa only [zeroPairLaw, h, ite_false] using Ball.exact_sound 0 + +def Z4_4_0Half (w : Fin 3) (ij : PairSlot) : Ball := + if (shape 4 4 0) w = 0 then if ij = (0,0) then .exact 1 else .exact 0 + else if w = halfMaxAxis (shape 4 4 0) then Z4_4_0Probs ij + else Z4_4_0Probs (kappa ij.1, kappa ij.2) +lemma Z4_4_0Half_sound (w : Fin 3) (ij : PairSlot) : + (Z4_4_0Half w ij).Encloses (halfLaw (shape 4 4 0) w ij : ℝ) := by + have hp : positive (shape 4 4 0) = false := by decide +kernel + simp only [Z4_4_0Half, halfLaw, hp, Bool.false_eq_true, ite_false] + split_ifs + · exact Ball.exact_sound 1 + · exact Ball.exact_sound 0 + · exact Z4_4_0Probs_sound _ + · exact Z4_4_0Probs_sound _ + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def Z4_4_0Value (a : PairSlot) : ℝ := (zeroPairLaw (shape 4 4 0) a.1 a.2 : ℝ) +def Z4_4_0E_0_5LogWitness : LogWitness := ⟨-9, 13333388289568308767749416709, 12207031250000000000000000000⟩ +def Z4_4_0E_0_5Log : Ball := ⟨(-615006545557549166812452928547037 / 100000000000000000000000000000000), (105879118649 / 50000000000000000000000000000000)⟩ +lemma Z4_4_0E_0_5Log_sound : Z4_4_0E_0_5Log.Encloses (Real.log (Z4_4_0Value ((0,5) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound (Z4_4_0Probs_sound ((0,5) : PairSlot)) (w := Z4_4_0E_0_5LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z4_4_0E_0_5 : Ball := ⟨(1312019371607181543741200578043 / 100000000000000000000000000000000), (18070111 / 4000000000000000000000000000000)⟩ +lemma Z4_4_0E_0_5_sound : Z4_4_0E_0_5.Encloses (Foundation.entropyTerm (Z4_4_0Value ((0,5) : PairSlot))) := by + exact contains_sound (entropyTerm_ball (Z4_4_0Probs_sound ((0,5) : PairSlot)) Z4_4_0E_0_5Log_sound) (by decide +kernel) +def Z4_4_0E_1_4LogWitness : LogWitness := ⟨-3, 12864926472604064794547580018297, 12500000000000000000000000000000⟩ +def Z4_4_0E_1_4Log : Ball := ⟨(-102533272778774583406226521559951 / 50000000000000000000000000000000), (84703294941 / 100000000000000000000000000000000)⟩ +lemma Z4_4_0E_1_4Log_sound : Z4_4_0E_1_4Log.Encloses (Real.log (Z4_4_0Value ((1,4) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound (Z4_4_0Probs_sound ((1,4) : PairSlot)) (w := Z4_4_0E_1_4LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z4_4_0E_1_4 : Ball := ⟨(26381660305887817562778739090541 / 100000000000000000000000000000000), (1089701667 / 10000000000000000000000000000000)⟩ +lemma Z4_4_0E_1_4_sound : Z4_4_0E_1_4.Encloses (Foundation.entropyTerm (Z4_4_0Value ((1,4) : PairSlot))) := by + exact contains_sound (entropyTerm_ball (Z4_4_0Probs_sound ((1,4) : PairSlot)) Z4_4_0E_1_4Log_sound) (by decide +kernel) +def Z4_4_0E_2_2LogWitness : LogWitness := ⟨-1, 59823869115870383240874620994737, 50000000000000000000000000000000⟩ +def Z4_4_0E_2_2Log : Ball := ⟨(-51376545557549166812453081310857 / 100000000000000000000000000000000), (42351647571 / 100000000000000000000000000000000)⟩ +lemma Z4_4_0E_2_2Log_sound : Z4_4_0E_2_2Log.Encloses (Real.log (Z4_4_0Value ((2,2) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound (Z4_4_0Probs_sound ((2,2) : PairSlot)) (w := Z4_4_0E_2_2LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z4_4_0E_2_2 : Ball := ⟨(480241208915683334342627678761 / 1562500000000000000000000000000), (1013455771 / 4000000000000000000000000000000)⟩ +lemma Z4_4_0E_2_2_sound : Z4_4_0E_2_2.Encloses (Foundation.entropyTerm (Z4_4_0Value ((2,2) : PairSlot))) := by + exact contains_sound (entropyTerm_ball (Z4_4_0Probs_sound ((2,2) : PairSlot)) Z4_4_0E_2_2Log_sound) (by decide +kernel) +def Z4_4_0E_2_3LogWitness : LogWitness := ⟨-4, 1661981174399030590448466000577, 1562500000000000000000000000000⟩ +def Z4_4_0E_2_3Log : Ball := ⟨(-135543272778774583406226512012229 / 50000000000000000000000000000000), (847032949 / 800000000000000000000000000000)⟩ +lemma Z4_4_0E_2_3Log_sound : Z4_4_0E_2_3Log.Encloses (Real.log (Z4_4_0Value ((2,3) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound (Z4_4_0Probs_sound ((2,3) : PairSlot)) (w := Z4_4_0E_2_3LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z4_4_0E_2_3 : Ball := ⟨(3604325882796094985265170692573 / 20000000000000000000000000000000), (1407752823 / 20000000000000000000000000000000)⟩ +lemma Z4_4_0E_2_3_sound : Z4_4_0E_2_3.Encloses (Foundation.entropyTerm (Z4_4_0Value ((2,3) : PairSlot))) := by + exact contains_sound (entropyTerm_ball (Z4_4_0Probs_sound ((2,3) : PairSlot)) Z4_4_0E_2_3Log_sound) (by decide +kernel) +def Z4_4_0E_3_2LogWitness : LogWitness := ⟨-4, 1661981174399030590448466000577, 1562500000000000000000000000000⟩ +def Z4_4_0E_3_2Log : Ball := ⟨(-135543272778774583406226512012229 / 50000000000000000000000000000000), (847032949 / 800000000000000000000000000000)⟩ +lemma Z4_4_0E_3_2Log_sound : Z4_4_0E_3_2Log.Encloses (Real.log (Z4_4_0Value ((3,2) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound (Z4_4_0Probs_sound ((3,2) : PairSlot)) (w := Z4_4_0E_3_2LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z4_4_0E_3_2 : Ball := ⟨(3604325882796094985265170692573 / 20000000000000000000000000000000), (1407752823 / 20000000000000000000000000000000)⟩ +lemma Z4_4_0E_3_2_sound : Z4_4_0E_3_2.Encloses (Foundation.entropyTerm (Z4_4_0Value ((3,2) : PairSlot))) := by + exact contains_sound (entropyTerm_ball (Z4_4_0Probs_sound ((3,2) : PairSlot)) Z4_4_0E_3_2Log_sound) (by decide +kernel) +def Z4_4_0E_3_3LogWitness : LogWitness := ⟨-8, 180940029615764141468627407341, 97656250000000000000000000000⟩ +def Z4_4_0E_3_3Log : Ball := ⟨(-15401454548673411462889154616633 / 3125000000000000000000000000000), (190582413423 / 100000000000000000000000000000000)⟩ +lemma Z4_4_0E_3_3Log_sound : Z4_4_0E_3_3Log.Encloses (Real.log (Z4_4_0Value ((3,3) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound (Z4_4_0Probs_sound ((3,3) : PairSlot)) (w := Z4_4_0E_3_3LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z4_4_0E_3_3 : Ball := ⟨(1783513370984199948259882031059 / 50000000000000000000000000000000), (172419939 / 12500000000000000000000000000000)⟩ +lemma Z4_4_0E_3_3_sound : Z4_4_0E_3_3.Encloses (Foundation.entropyTerm (Z4_4_0Value ((3,3) : PairSlot))) := by + exact contains_sound (entropyTerm_ball (Z4_4_0Probs_sound ((3,3) : PairSlot)) Z4_4_0E_3_3Log_sound) (by decide +kernel) +def Z4_4_0E_4_1LogWitness : LogWitness := ⟨-3, 12864926472604064794547580018297, 12500000000000000000000000000000⟩ +def Z4_4_0E_4_1Log : Ball := ⟨(-102533272778774583406226521559951 / 50000000000000000000000000000000), (84703294941 / 100000000000000000000000000000000)⟩ +lemma Z4_4_0E_4_1Log_sound : Z4_4_0E_4_1Log.Encloses (Real.log (Z4_4_0Value ((4,1) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound (Z4_4_0Probs_sound ((4,1) : PairSlot)) (w := Z4_4_0E_4_1LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z4_4_0E_4_1 : Ball := ⟨(26381660305887817562778739090541 / 100000000000000000000000000000000), (1089701667 / 10000000000000000000000000000000)⟩ +lemma Z4_4_0E_4_1_sound : Z4_4_0E_4_1.Encloses (Foundation.entropyTerm (Z4_4_0Value ((4,1) : PairSlot))) := by + exact contains_sound (entropyTerm_ball (Z4_4_0Probs_sound ((4,1) : PairSlot)) Z4_4_0E_4_1Log_sound) (by decide +kernel) +def Z4_4_0E_5_0LogWitness : LogWitness := ⟨-9, 13333388289568308767749416709, 12207031250000000000000000000⟩ +def Z4_4_0E_5_0Log : Ball := ⟨(-615006545557549166812452928547037 / 100000000000000000000000000000000), (105879118649 / 50000000000000000000000000000000)⟩ +lemma Z4_4_0E_5_0Log_sound : Z4_4_0E_5_0Log.Encloses (Real.log (Z4_4_0Value ((5,0) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound (Z4_4_0Probs_sound ((5,0) : PairSlot)) (w := Z4_4_0E_5_0LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z4_4_0E_5_0 : Ball := ⟨(1312019371607181543741200578043 / 100000000000000000000000000000000), (18070111 / 4000000000000000000000000000000)⟩ +lemma Z4_4_0E_5_0_sound : Z4_4_0E_5_0.Encloses (Foundation.entropyTerm (Z4_4_0Value ((5,0) : PairSlot))) := by + exact contains_sound (entropyTerm_ball (Z4_4_0Probs_sound ((5,0) : PairSlot)) Z4_4_0E_5_0Log_sound) (by decide +kernel) +def Z4_4_0Terms (a : PairSlot) : Ball := + match a.1.val, a.2.val with + | 0, 5 => ⟨(1312019371607181543741200578043 / 100000000000000000000000000000000), (18070111 / 4000000000000000000000000000000)⟩ + | 1, 4 => ⟨(26381660305887817562778739090541 / 100000000000000000000000000000000), (1089701667 / 10000000000000000000000000000000)⟩ + | 2, 2 => ⟨(480241208915683334342627678761 / 1562500000000000000000000000000), (1013455771 / 4000000000000000000000000000000)⟩ + | 2, 3 => ⟨(3604325882796094985265170692573 / 20000000000000000000000000000000), (1407752823 / 20000000000000000000000000000000)⟩ + | 3, 2 => ⟨(3604325882796094985265170692573 / 20000000000000000000000000000000), (1407752823 / 20000000000000000000000000000000)⟩ + | 3, 3 => ⟨(1783513370984199948259882031059 / 50000000000000000000000000000000), (172419939 / 12500000000000000000000000000000)⟩ + | 4, 1 => ⟨(26381660305887817562778739090541 / 100000000000000000000000000000000), (1089701667 / 10000000000000000000000000000000)⟩ + | 5, 0 => ⟨(1312019371607181543741200578043 / 100000000000000000000000000000000), (18070111 / 4000000000000000000000000000000)⟩ + | _, _ => (.exact 0) +lemma Z4_4_0Terms_sound (a : PairSlot) : + (Z4_4_0Terms a).Encloses (Foundation.entropyTerm (Z4_4_0Value a)) := by + rcases a with ⟨i,j⟩ + revert j i + apply forall_fin6 + · exact forall_fin6 (entropyTerm_zero_ball (Z4_4_0Probs_sound ((0,0) : PairSlot))) (entropyTerm_zero_ball (Z4_4_0Probs_sound ((0,1) : PairSlot))) (entropyTerm_zero_ball (Z4_4_0Probs_sound ((0,2) : PairSlot))) (entropyTerm_zero_ball (Z4_4_0Probs_sound ((0,3) : PairSlot))) (entropyTerm_zero_ball (Z4_4_0Probs_sound ((0,4) : PairSlot))) Z4_4_0E_0_5_sound + · exact forall_fin6 (entropyTerm_zero_ball (Z4_4_0Probs_sound ((1,0) : PairSlot))) (entropyTerm_zero_ball (Z4_4_0Probs_sound ((1,1) : PairSlot))) (entropyTerm_zero_ball (Z4_4_0Probs_sound ((1,2) : PairSlot))) (entropyTerm_zero_ball (Z4_4_0Probs_sound ((1,3) : PairSlot))) Z4_4_0E_1_4_sound (entropyTerm_zero_ball (Z4_4_0Probs_sound ((1,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball (Z4_4_0Probs_sound ((2,0) : PairSlot))) (entropyTerm_zero_ball (Z4_4_0Probs_sound ((2,1) : PairSlot))) Z4_4_0E_2_2_sound Z4_4_0E_2_3_sound (entropyTerm_zero_ball (Z4_4_0Probs_sound ((2,4) : PairSlot))) (entropyTerm_zero_ball (Z4_4_0Probs_sound ((2,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball (Z4_4_0Probs_sound ((3,0) : PairSlot))) (entropyTerm_zero_ball (Z4_4_0Probs_sound ((3,1) : PairSlot))) Z4_4_0E_3_2_sound Z4_4_0E_3_3_sound (entropyTerm_zero_ball (Z4_4_0Probs_sound ((3,4) : PairSlot))) (entropyTerm_zero_ball (Z4_4_0Probs_sound ((3,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball (Z4_4_0Probs_sound ((4,0) : PairSlot))) Z4_4_0E_4_1_sound (entropyTerm_zero_ball (Z4_4_0Probs_sound ((4,2) : PairSlot))) (entropyTerm_zero_ball (Z4_4_0Probs_sound ((4,3) : PairSlot))) (entropyTerm_zero_ball (Z4_4_0Probs_sound ((4,4) : PairSlot))) (entropyTerm_zero_ball (Z4_4_0Probs_sound ((4,5) : PairSlot))) + · exact forall_fin6 Z4_4_0E_5_0_sound (entropyTerm_zero_ball (Z4_4_0Probs_sound ((5,1) : PairSlot))) (entropyTerm_zero_ball (Z4_4_0Probs_sound ((5,2) : PairSlot))) (entropyTerm_zero_ball (Z4_4_0Probs_sound ((5,3) : PairSlot))) (entropyTerm_zero_ball (Z4_4_0Probs_sound ((5,4) : PairSlot))) (entropyTerm_zero_ball (Z4_4_0Probs_sound ((5,5) : PairSlot))) +def Z4_4_0Entropy : Ball := ⟨(3143327057388077034003488044143 / 2500000000000000000000000000000), (63490820907 / 100000000000000000000000000000000)⟩ +lemma Z4_4_0Entropy_sound : Z4_4_0Entropy.Encloses (Foundation.finiteEntropy Z4_4_0Value) := by + exact contains_sound (entropyPair_enclosed Z4_4_0Value Z4_4_0Terms Z4_4_0Terms_sound) (by decide +kernel) +def Z4_4_0Labels : Ball := ⟨(278319288524584121929550231720779 / 50000000000000000000000000000000), (182174349901 / 100000000000000000000000000000000)⟩ +lemma Z4_4_0Labels_sound : Z4_4_0Labels.Encloses + (∑ a : PairSlot, (zeroPairLaw (shape 4 4 0) a.1 a.2 : ℝ) * + Real.log (AllFieldParameters.multiplicity a.1 * AllFieldParameters.multiplicity a.2 : ℕ)) := by + exact contains_sound (pairSumBall_sound (fun a => .mul (Z4_4_0Probs a) (multLogs a)) + _ (fun a => Ball.mul_sound (Z4_4_0Probs_sound a) (multLogs_sound a))) (by decide +kernel) +def Z4_4_0Four : Ball := ⟨(341185829672345662609619992603639 / 50000000000000000000000000000000), (30708146351 / 12500000000000000000000000000000)⟩ +lemma Z4_4_0Four_sound : Z4_4_0Four.Encloses (AllFieldZeroLeafRates.fourRate (shape 4 4 0)) := by + exact contains_sound (Ball.add_sound Z4_4_0Entropy_sound Z4_4_0Labels_sound) (by decide +kernel) +def Z4_4_0H0Value (a : PairSlot) : ℝ := (halfLaw (shape 4 4 0) 0 a : ℝ) +def Z4_4_0H0E_0_5LogWitness : LogWitness := ⟨-9, 13333388289568308767749416709, 12207031250000000000000000000⟩ +def Z4_4_0H0E_0_5Log : Ball := ⟨(-615006545557549166812452928547037 / 100000000000000000000000000000000), (105879118649 / 50000000000000000000000000000000)⟩ +lemma Z4_4_0H0E_0_5Log_sound : Z4_4_0H0E_0_5Log.Encloses (Real.log (Z4_4_0H0Value ((0,5) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound ((Z4_4_0Half_sound 0) ((0,5) : PairSlot)) (w := Z4_4_0H0E_0_5LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z4_4_0H0E_0_5 : Ball := ⟨(1312019371607181543741200578043 / 100000000000000000000000000000000), (18070111 / 4000000000000000000000000000000)⟩ +lemma Z4_4_0H0E_0_5_sound : Z4_4_0H0E_0_5.Encloses (Foundation.entropyTerm (Z4_4_0H0Value ((0,5) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z4_4_0Half_sound 0) ((0,5) : PairSlot)) Z4_4_0H0E_0_5Log_sound) (by decide +kernel) +def Z4_4_0H0E_1_4LogWitness : LogWitness := ⟨-3, 12864926472604064794547580018297, 12500000000000000000000000000000⟩ +def Z4_4_0H0E_1_4Log : Ball := ⟨(-102533272778774583406226521559951 / 50000000000000000000000000000000), (84703294941 / 100000000000000000000000000000000)⟩ +lemma Z4_4_0H0E_1_4Log_sound : Z4_4_0H0E_1_4Log.Encloses (Real.log (Z4_4_0H0Value ((1,4) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound ((Z4_4_0Half_sound 0) ((1,4) : PairSlot)) (w := Z4_4_0H0E_1_4LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z4_4_0H0E_1_4 : Ball := ⟨(26381660305887817562778739090541 / 100000000000000000000000000000000), (1089701667 / 10000000000000000000000000000000)⟩ +lemma Z4_4_0H0E_1_4_sound : Z4_4_0H0E_1_4.Encloses (Foundation.entropyTerm (Z4_4_0H0Value ((1,4) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z4_4_0Half_sound 0) ((1,4) : PairSlot)) Z4_4_0H0E_1_4Log_sound) (by decide +kernel) +def Z4_4_0H0E_2_2LogWitness : LogWitness := ⟨-1, 59823869115870383240874620994737, 50000000000000000000000000000000⟩ +def Z4_4_0H0E_2_2Log : Ball := ⟨(-51376545557549166812453081310857 / 100000000000000000000000000000000), (42351647571 / 100000000000000000000000000000000)⟩ +lemma Z4_4_0H0E_2_2Log_sound : Z4_4_0H0E_2_2Log.Encloses (Real.log (Z4_4_0H0Value ((2,2) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound ((Z4_4_0Half_sound 0) ((2,2) : PairSlot)) (w := Z4_4_0H0E_2_2LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z4_4_0H0E_2_2 : Ball := ⟨(480241208915683334342627678761 / 1562500000000000000000000000000), (1013455771 / 4000000000000000000000000000000)⟩ +lemma Z4_4_0H0E_2_2_sound : Z4_4_0H0E_2_2.Encloses (Foundation.entropyTerm (Z4_4_0H0Value ((2,2) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z4_4_0Half_sound 0) ((2,2) : PairSlot)) Z4_4_0H0E_2_2Log_sound) (by decide +kernel) +def Z4_4_0H0E_2_3LogWitness : LogWitness := ⟨-4, 1661981174399030590448466000577, 1562500000000000000000000000000⟩ +def Z4_4_0H0E_2_3Log : Ball := ⟨(-135543272778774583406226512012229 / 50000000000000000000000000000000), (847032949 / 800000000000000000000000000000)⟩ +lemma Z4_4_0H0E_2_3Log_sound : Z4_4_0H0E_2_3Log.Encloses (Real.log (Z4_4_0H0Value ((2,3) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound ((Z4_4_0Half_sound 0) ((2,3) : PairSlot)) (w := Z4_4_0H0E_2_3LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z4_4_0H0E_2_3 : Ball := ⟨(3604325882796094985265170692573 / 20000000000000000000000000000000), (1407752823 / 20000000000000000000000000000000)⟩ +lemma Z4_4_0H0E_2_3_sound : Z4_4_0H0E_2_3.Encloses (Foundation.entropyTerm (Z4_4_0H0Value ((2,3) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z4_4_0Half_sound 0) ((2,3) : PairSlot)) Z4_4_0H0E_2_3Log_sound) (by decide +kernel) +def Z4_4_0H0E_3_2LogWitness : LogWitness := ⟨-4, 1661981174399030590448466000577, 1562500000000000000000000000000⟩ +def Z4_4_0H0E_3_2Log : Ball := ⟨(-135543272778774583406226512012229 / 50000000000000000000000000000000), (847032949 / 800000000000000000000000000000)⟩ +lemma Z4_4_0H0E_3_2Log_sound : Z4_4_0H0E_3_2Log.Encloses (Real.log (Z4_4_0H0Value ((3,2) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound ((Z4_4_0Half_sound 0) ((3,2) : PairSlot)) (w := Z4_4_0H0E_3_2LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z4_4_0H0E_3_2 : Ball := ⟨(3604325882796094985265170692573 / 20000000000000000000000000000000), (1407752823 / 20000000000000000000000000000000)⟩ +lemma Z4_4_0H0E_3_2_sound : Z4_4_0H0E_3_2.Encloses (Foundation.entropyTerm (Z4_4_0H0Value ((3,2) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z4_4_0Half_sound 0) ((3,2) : PairSlot)) Z4_4_0H0E_3_2Log_sound) (by decide +kernel) +def Z4_4_0H0E_3_3LogWitness : LogWitness := ⟨-8, 180940029615764141468627407341, 97656250000000000000000000000⟩ +def Z4_4_0H0E_3_3Log : Ball := ⟨(-15401454548673411462889154616633 / 3125000000000000000000000000000), (190582413423 / 100000000000000000000000000000000)⟩ +lemma Z4_4_0H0E_3_3Log_sound : Z4_4_0H0E_3_3Log.Encloses (Real.log (Z4_4_0H0Value ((3,3) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound ((Z4_4_0Half_sound 0) ((3,3) : PairSlot)) (w := Z4_4_0H0E_3_3LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z4_4_0H0E_3_3 : Ball := ⟨(1783513370984199948259882031059 / 50000000000000000000000000000000), (172419939 / 12500000000000000000000000000000)⟩ +lemma Z4_4_0H0E_3_3_sound : Z4_4_0H0E_3_3.Encloses (Foundation.entropyTerm (Z4_4_0H0Value ((3,3) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z4_4_0Half_sound 0) ((3,3) : PairSlot)) Z4_4_0H0E_3_3Log_sound) (by decide +kernel) +def Z4_4_0H0E_4_1LogWitness : LogWitness := ⟨-3, 12864926472604064794547580018297, 12500000000000000000000000000000⟩ +def Z4_4_0H0E_4_1Log : Ball := ⟨(-102533272778774583406226521559951 / 50000000000000000000000000000000), (84703294941 / 100000000000000000000000000000000)⟩ +lemma Z4_4_0H0E_4_1Log_sound : Z4_4_0H0E_4_1Log.Encloses (Real.log (Z4_4_0H0Value ((4,1) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound ((Z4_4_0Half_sound 0) ((4,1) : PairSlot)) (w := Z4_4_0H0E_4_1LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z4_4_0H0E_4_1 : Ball := ⟨(26381660305887817562778739090541 / 100000000000000000000000000000000), (1089701667 / 10000000000000000000000000000000)⟩ +lemma Z4_4_0H0E_4_1_sound : Z4_4_0H0E_4_1.Encloses (Foundation.entropyTerm (Z4_4_0H0Value ((4,1) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z4_4_0Half_sound 0) ((4,1) : PairSlot)) Z4_4_0H0E_4_1Log_sound) (by decide +kernel) +def Z4_4_0H0E_5_0LogWitness : LogWitness := ⟨-9, 13333388289568308767749416709, 12207031250000000000000000000⟩ +def Z4_4_0H0E_5_0Log : Ball := ⟨(-615006545557549166812452928547037 / 100000000000000000000000000000000), (105879118649 / 50000000000000000000000000000000)⟩ +lemma Z4_4_0H0E_5_0Log_sound : Z4_4_0H0E_5_0Log.Encloses (Real.log (Z4_4_0H0Value ((5,0) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound ((Z4_4_0Half_sound 0) ((5,0) : PairSlot)) (w := Z4_4_0H0E_5_0LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z4_4_0H0E_5_0 : Ball := ⟨(1312019371607181543741200578043 / 100000000000000000000000000000000), (18070111 / 4000000000000000000000000000000)⟩ +lemma Z4_4_0H0E_5_0_sound : Z4_4_0H0E_5_0.Encloses (Foundation.entropyTerm (Z4_4_0H0Value ((5,0) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z4_4_0Half_sound 0) ((5,0) : PairSlot)) Z4_4_0H0E_5_0Log_sound) (by decide +kernel) +def Z4_4_0H0Terms (a : PairSlot) : Ball := + match a.1.val, a.2.val with + | 0, 5 => ⟨(1312019371607181543741200578043 / 100000000000000000000000000000000), (18070111 / 4000000000000000000000000000000)⟩ + | 1, 4 => ⟨(26381660305887817562778739090541 / 100000000000000000000000000000000), (1089701667 / 10000000000000000000000000000000)⟩ + | 2, 2 => ⟨(480241208915683334342627678761 / 1562500000000000000000000000000), (1013455771 / 4000000000000000000000000000000)⟩ + | 2, 3 => ⟨(3604325882796094985265170692573 / 20000000000000000000000000000000), (1407752823 / 20000000000000000000000000000000)⟩ + | 3, 2 => ⟨(3604325882796094985265170692573 / 20000000000000000000000000000000), (1407752823 / 20000000000000000000000000000000)⟩ + | 3, 3 => ⟨(1783513370984199948259882031059 / 50000000000000000000000000000000), (172419939 / 12500000000000000000000000000000)⟩ + | 4, 1 => ⟨(26381660305887817562778739090541 / 100000000000000000000000000000000), (1089701667 / 10000000000000000000000000000000)⟩ + | 5, 0 => ⟨(1312019371607181543741200578043 / 100000000000000000000000000000000), (18070111 / 4000000000000000000000000000000)⟩ + | _, _ => (.exact 0) +lemma Z4_4_0H0Terms_sound (a : PairSlot) : + (Z4_4_0H0Terms a).Encloses (Foundation.entropyTerm (Z4_4_0H0Value a)) := by + rcases a with ⟨i,j⟩ + revert j i + apply forall_fin6 + · exact forall_fin6 (entropyTerm_zero_ball ((Z4_4_0Half_sound 0) ((0,0) : PairSlot))) (entropyTerm_zero_ball ((Z4_4_0Half_sound 0) ((0,1) : PairSlot))) (entropyTerm_zero_ball ((Z4_4_0Half_sound 0) ((0,2) : PairSlot))) (entropyTerm_zero_ball ((Z4_4_0Half_sound 0) ((0,3) : PairSlot))) (entropyTerm_zero_ball ((Z4_4_0Half_sound 0) ((0,4) : PairSlot))) Z4_4_0H0E_0_5_sound + · exact forall_fin6 (entropyTerm_zero_ball ((Z4_4_0Half_sound 0) ((1,0) : PairSlot))) (entropyTerm_zero_ball ((Z4_4_0Half_sound 0) ((1,1) : PairSlot))) (entropyTerm_zero_ball ((Z4_4_0Half_sound 0) ((1,2) : PairSlot))) (entropyTerm_zero_ball ((Z4_4_0Half_sound 0) ((1,3) : PairSlot))) Z4_4_0H0E_1_4_sound (entropyTerm_zero_ball ((Z4_4_0Half_sound 0) ((1,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z4_4_0Half_sound 0) ((2,0) : PairSlot))) (entropyTerm_zero_ball ((Z4_4_0Half_sound 0) ((2,1) : PairSlot))) Z4_4_0H0E_2_2_sound Z4_4_0H0E_2_3_sound (entropyTerm_zero_ball ((Z4_4_0Half_sound 0) ((2,4) : PairSlot))) (entropyTerm_zero_ball ((Z4_4_0Half_sound 0) ((2,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z4_4_0Half_sound 0) ((3,0) : PairSlot))) (entropyTerm_zero_ball ((Z4_4_0Half_sound 0) ((3,1) : PairSlot))) Z4_4_0H0E_3_2_sound Z4_4_0H0E_3_3_sound (entropyTerm_zero_ball ((Z4_4_0Half_sound 0) ((3,4) : PairSlot))) (entropyTerm_zero_ball ((Z4_4_0Half_sound 0) ((3,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z4_4_0Half_sound 0) ((4,0) : PairSlot))) Z4_4_0H0E_4_1_sound (entropyTerm_zero_ball ((Z4_4_0Half_sound 0) ((4,2) : PairSlot))) (entropyTerm_zero_ball ((Z4_4_0Half_sound 0) ((4,3) : PairSlot))) (entropyTerm_zero_ball ((Z4_4_0Half_sound 0) ((4,4) : PairSlot))) (entropyTerm_zero_ball ((Z4_4_0Half_sound 0) ((4,5) : PairSlot))) + · exact forall_fin6 Z4_4_0H0E_5_0_sound (entropyTerm_zero_ball ((Z4_4_0Half_sound 0) ((5,1) : PairSlot))) (entropyTerm_zero_ball ((Z4_4_0Half_sound 0) ((5,2) : PairSlot))) (entropyTerm_zero_ball ((Z4_4_0Half_sound 0) ((5,3) : PairSlot))) (entropyTerm_zero_ball ((Z4_4_0Half_sound 0) ((5,4) : PairSlot))) (entropyTerm_zero_ball ((Z4_4_0Half_sound 0) ((5,5) : PairSlot))) +def Z4_4_0H0Entropy : Ball := ⟨(3143327057388077034003488044143 / 2500000000000000000000000000000), (63490820907 / 100000000000000000000000000000000)⟩ +lemma Z4_4_0H0Entropy_sound : Z4_4_0H0Entropy.Encloses (Foundation.finiteEntropy Z4_4_0H0Value) := by + exact contains_sound (entropyPair_enclosed Z4_4_0H0Value Z4_4_0H0Terms Z4_4_0H0Terms_sound) (by decide +kernel) +def Z4_4_0H0Mass : Ball := ⟨(99999999999999999999999999999999 / 100000000000000000000000000000000), (209 / 100000000000000000000000000000000)⟩ +lemma Z4_4_0H0Mass_sound : Z4_4_0H0Mass.Encloses (∑ a, Z4_4_0H0Value a) := by + exact contains_sound (pairSumBall_sound (Z4_4_0Half 0) Z4_4_0H0Value (Z4_4_0Half_sound 0)) (by decide +kernel) +def Z4_4_0H0MassTermLogWitness : LogWitness := ⟨-1, 99999999999999999999999999999999, 50000000000000000000000000000000⟩ +def Z4_4_0H0MassTermLog : Ball := ⟨0, (1694065903 / 4000000000000000000000000000000)⟩ +lemma Z4_4_0H0MassTermLog_sound : Z4_4_0H0MassTermLog.Encloses (Real.log ((∑ a, Z4_4_0H0Value a))) := by + exact checkLog_sound logTwoBall_sound (Z4_4_0H0Mass_sound) (w := Z4_4_0H0MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z4_4_0H0MassTerm : Ball := ⟨0, (5293955947 / 12500000000000000000000000000000)⟩ +lemma Z4_4_0H0MassTerm_sound : Z4_4_0H0MassTerm.Encloses (Foundation.entropyTerm ((∑ a, Z4_4_0H0Value a))) := by + exact contains_sound (entropyTerm_ball (Z4_4_0H0Mass_sound) Z4_4_0H0MassTermLog_sound) (by decide +kernel) +def Z4_4_0H0H : Ball := ⟨(3143327057388077034003488044143 / 2500000000000000000000000000000), (105842468483 / 100000000000000000000000000000000)⟩ +lemma Z4_4_0H0H_sound : Z4_4_0H0H.Encloses (homogeneousEntropy Z4_4_0H0Value) := by + exact contains_sound (homogeneous_enclosed Z4_4_0H0Value Z4_4_0H0MassTerm_sound Z4_4_0H0Entropy_sound) (by decide +kernel) +def Z4_4_0H1Value (a : PairSlot) : ℝ := (halfLaw (shape 4 4 0) 1 a : ℝ) +def Z4_4_0H1E_5_0LogWitness : LogWitness := ⟨-9, 13333388289568308767749416709, 12207031250000000000000000000⟩ +def Z4_4_0H1E_5_0Log : Ball := ⟨(-615006545557549166812452928547037 / 100000000000000000000000000000000), (105879118649 / 50000000000000000000000000000000)⟩ +lemma Z4_4_0H1E_5_0Log_sound : Z4_4_0H1E_5_0Log.Encloses (Real.log (Z4_4_0H1Value ((5,0) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound ((Z4_4_0Half_sound 1) ((5,0) : PairSlot)) (w := Z4_4_0H1E_5_0LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z4_4_0H1E_5_0 : Ball := ⟨(1312019371607181543741200578043 / 100000000000000000000000000000000), (18070111 / 4000000000000000000000000000000)⟩ +lemma Z4_4_0H1E_5_0_sound : Z4_4_0H1E_5_0.Encloses (Foundation.entropyTerm (Z4_4_0H1Value ((5,0) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z4_4_0Half_sound 1) ((5,0) : PairSlot)) Z4_4_0H1E_5_0Log_sound) (by decide +kernel) +def Z4_4_0H1E_4_1LogWitness : LogWitness := ⟨-3, 12864926472604064794547580018297, 12500000000000000000000000000000⟩ +def Z4_4_0H1E_4_1Log : Ball := ⟨(-102533272778774583406226521559951 / 50000000000000000000000000000000), (84703294941 / 100000000000000000000000000000000)⟩ +lemma Z4_4_0H1E_4_1Log_sound : Z4_4_0H1E_4_1Log.Encloses (Real.log (Z4_4_0H1Value ((4,1) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound ((Z4_4_0Half_sound 1) ((4,1) : PairSlot)) (w := Z4_4_0H1E_4_1LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z4_4_0H1E_4_1 : Ball := ⟨(26381660305887817562778739090541 / 100000000000000000000000000000000), (1089701667 / 10000000000000000000000000000000)⟩ +lemma Z4_4_0H1E_4_1_sound : Z4_4_0H1E_4_1.Encloses (Foundation.entropyTerm (Z4_4_0H1Value ((4,1) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z4_4_0Half_sound 1) ((4,1) : PairSlot)) Z4_4_0H1E_4_1Log_sound) (by decide +kernel) +def Z4_4_0H1E_2_2LogWitness : LogWitness := ⟨-1, 59823869115870383240874620994737, 50000000000000000000000000000000⟩ +def Z4_4_0H1E_2_2Log : Ball := ⟨(-51376545557549166812453081310857 / 100000000000000000000000000000000), (42351647571 / 100000000000000000000000000000000)⟩ +lemma Z4_4_0H1E_2_2Log_sound : Z4_4_0H1E_2_2Log.Encloses (Real.log (Z4_4_0H1Value ((2,2) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound ((Z4_4_0Half_sound 1) ((2,2) : PairSlot)) (w := Z4_4_0H1E_2_2LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z4_4_0H1E_2_2 : Ball := ⟨(480241208915683334342627678761 / 1562500000000000000000000000000), (1013455771 / 4000000000000000000000000000000)⟩ +lemma Z4_4_0H1E_2_2_sound : Z4_4_0H1E_2_2.Encloses (Foundation.entropyTerm (Z4_4_0H1Value ((2,2) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z4_4_0Half_sound 1) ((2,2) : PairSlot)) Z4_4_0H1E_2_2Log_sound) (by decide +kernel) +def Z4_4_0H1E_2_3LogWitness : LogWitness := ⟨-4, 1661981174399030590448466000577, 1562500000000000000000000000000⟩ +def Z4_4_0H1E_2_3Log : Ball := ⟨(-135543272778774583406226512012229 / 50000000000000000000000000000000), (847032949 / 800000000000000000000000000000)⟩ +lemma Z4_4_0H1E_2_3Log_sound : Z4_4_0H1E_2_3Log.Encloses (Real.log (Z4_4_0H1Value ((2,3) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound ((Z4_4_0Half_sound 1) ((2,3) : PairSlot)) (w := Z4_4_0H1E_2_3LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z4_4_0H1E_2_3 : Ball := ⟨(3604325882796094985265170692573 / 20000000000000000000000000000000), (1407752823 / 20000000000000000000000000000000)⟩ +lemma Z4_4_0H1E_2_3_sound : Z4_4_0H1E_2_3.Encloses (Foundation.entropyTerm (Z4_4_0H1Value ((2,3) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z4_4_0Half_sound 1) ((2,3) : PairSlot)) Z4_4_0H1E_2_3Log_sound) (by decide +kernel) +def Z4_4_0H1E_3_2LogWitness : LogWitness := ⟨-4, 1661981174399030590448466000577, 1562500000000000000000000000000⟩ +def Z4_4_0H1E_3_2Log : Ball := ⟨(-135543272778774583406226512012229 / 50000000000000000000000000000000), (847032949 / 800000000000000000000000000000)⟩ +lemma Z4_4_0H1E_3_2Log_sound : Z4_4_0H1E_3_2Log.Encloses (Real.log (Z4_4_0H1Value ((3,2) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound ((Z4_4_0Half_sound 1) ((3,2) : PairSlot)) (w := Z4_4_0H1E_3_2LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z4_4_0H1E_3_2 : Ball := ⟨(3604325882796094985265170692573 / 20000000000000000000000000000000), (1407752823 / 20000000000000000000000000000000)⟩ +lemma Z4_4_0H1E_3_2_sound : Z4_4_0H1E_3_2.Encloses (Foundation.entropyTerm (Z4_4_0H1Value ((3,2) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z4_4_0Half_sound 1) ((3,2) : PairSlot)) Z4_4_0H1E_3_2Log_sound) (by decide +kernel) +def Z4_4_0H1E_3_3LogWitness : LogWitness := ⟨-8, 180940029615764141468627407341, 97656250000000000000000000000⟩ +def Z4_4_0H1E_3_3Log : Ball := ⟨(-15401454548673411462889154616633 / 3125000000000000000000000000000), (190582413423 / 100000000000000000000000000000000)⟩ +lemma Z4_4_0H1E_3_3Log_sound : Z4_4_0H1E_3_3Log.Encloses (Real.log (Z4_4_0H1Value ((3,3) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound ((Z4_4_0Half_sound 1) ((3,3) : PairSlot)) (w := Z4_4_0H1E_3_3LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z4_4_0H1E_3_3 : Ball := ⟨(1783513370984199948259882031059 / 50000000000000000000000000000000), (172419939 / 12500000000000000000000000000000)⟩ +lemma Z4_4_0H1E_3_3_sound : Z4_4_0H1E_3_3.Encloses (Foundation.entropyTerm (Z4_4_0H1Value ((3,3) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z4_4_0Half_sound 1) ((3,3) : PairSlot)) Z4_4_0H1E_3_3Log_sound) (by decide +kernel) +def Z4_4_0H1E_1_4LogWitness : LogWitness := ⟨-3, 12864926472604064794547580018297, 12500000000000000000000000000000⟩ +def Z4_4_0H1E_1_4Log : Ball := ⟨(-102533272778774583406226521559951 / 50000000000000000000000000000000), (84703294941 / 100000000000000000000000000000000)⟩ +lemma Z4_4_0H1E_1_4Log_sound : Z4_4_0H1E_1_4Log.Encloses (Real.log (Z4_4_0H1Value ((1,4) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound ((Z4_4_0Half_sound 1) ((1,4) : PairSlot)) (w := Z4_4_0H1E_1_4LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z4_4_0H1E_1_4 : Ball := ⟨(26381660305887817562778739090541 / 100000000000000000000000000000000), (1089701667 / 10000000000000000000000000000000)⟩ +lemma Z4_4_0H1E_1_4_sound : Z4_4_0H1E_1_4.Encloses (Foundation.entropyTerm (Z4_4_0H1Value ((1,4) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z4_4_0Half_sound 1) ((1,4) : PairSlot)) Z4_4_0H1E_1_4Log_sound) (by decide +kernel) +def Z4_4_0H1E_0_5LogWitness : LogWitness := ⟨-9, 13333388289568308767749416709, 12207031250000000000000000000⟩ +def Z4_4_0H1E_0_5Log : Ball := ⟨(-615006545557549166812452928547037 / 100000000000000000000000000000000), (105879118649 / 50000000000000000000000000000000)⟩ +lemma Z4_4_0H1E_0_5Log_sound : Z4_4_0H1E_0_5Log.Encloses (Real.log (Z4_4_0H1Value ((0,5) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound ((Z4_4_0Half_sound 1) ((0,5) : PairSlot)) (w := Z4_4_0H1E_0_5LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z4_4_0H1E_0_5 : Ball := ⟨(1312019371607181543741200578043 / 100000000000000000000000000000000), (18070111 / 4000000000000000000000000000000)⟩ +lemma Z4_4_0H1E_0_5_sound : Z4_4_0H1E_0_5.Encloses (Foundation.entropyTerm (Z4_4_0H1Value ((0,5) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z4_4_0Half_sound 1) ((0,5) : PairSlot)) Z4_4_0H1E_0_5Log_sound) (by decide +kernel) +def Z4_4_0H1Terms (a : PairSlot) : Ball := + match a.1.val, a.2.val with + | 5, 0 => ⟨(1312019371607181543741200578043 / 100000000000000000000000000000000), (18070111 / 4000000000000000000000000000000)⟩ + | 4, 1 => ⟨(26381660305887817562778739090541 / 100000000000000000000000000000000), (1089701667 / 10000000000000000000000000000000)⟩ + | 2, 2 => ⟨(480241208915683334342627678761 / 1562500000000000000000000000000), (1013455771 / 4000000000000000000000000000000)⟩ + | 2, 3 => ⟨(3604325882796094985265170692573 / 20000000000000000000000000000000), (1407752823 / 20000000000000000000000000000000)⟩ + | 3, 2 => ⟨(3604325882796094985265170692573 / 20000000000000000000000000000000), (1407752823 / 20000000000000000000000000000000)⟩ + | 3, 3 => ⟨(1783513370984199948259882031059 / 50000000000000000000000000000000), (172419939 / 12500000000000000000000000000000)⟩ + | 1, 4 => ⟨(26381660305887817562778739090541 / 100000000000000000000000000000000), (1089701667 / 10000000000000000000000000000000)⟩ + | 0, 5 => ⟨(1312019371607181543741200578043 / 100000000000000000000000000000000), (18070111 / 4000000000000000000000000000000)⟩ + | _, _ => (.exact 0) +lemma Z4_4_0H1Terms_sound (a : PairSlot) : + (Z4_4_0H1Terms a).Encloses (Foundation.entropyTerm (Z4_4_0H1Value a)) := by + rcases a with ⟨i,j⟩ + revert j i + apply forall_fin6 + · exact forall_fin6 (entropyTerm_zero_ball ((Z4_4_0Half_sound 1) ((0,0) : PairSlot))) (entropyTerm_zero_ball ((Z4_4_0Half_sound 1) ((0,1) : PairSlot))) (entropyTerm_zero_ball ((Z4_4_0Half_sound 1) ((0,2) : PairSlot))) (entropyTerm_zero_ball ((Z4_4_0Half_sound 1) ((0,3) : PairSlot))) (entropyTerm_zero_ball ((Z4_4_0Half_sound 1) ((0,4) : PairSlot))) Z4_4_0H1E_0_5_sound + · exact forall_fin6 (entropyTerm_zero_ball ((Z4_4_0Half_sound 1) ((1,0) : PairSlot))) (entropyTerm_zero_ball ((Z4_4_0Half_sound 1) ((1,1) : PairSlot))) (entropyTerm_zero_ball ((Z4_4_0Half_sound 1) ((1,2) : PairSlot))) (entropyTerm_zero_ball ((Z4_4_0Half_sound 1) ((1,3) : PairSlot))) Z4_4_0H1E_1_4_sound (entropyTerm_zero_ball ((Z4_4_0Half_sound 1) ((1,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z4_4_0Half_sound 1) ((2,0) : PairSlot))) (entropyTerm_zero_ball ((Z4_4_0Half_sound 1) ((2,1) : PairSlot))) Z4_4_0H1E_2_2_sound Z4_4_0H1E_2_3_sound (entropyTerm_zero_ball ((Z4_4_0Half_sound 1) ((2,4) : PairSlot))) (entropyTerm_zero_ball ((Z4_4_0Half_sound 1) ((2,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z4_4_0Half_sound 1) ((3,0) : PairSlot))) (entropyTerm_zero_ball ((Z4_4_0Half_sound 1) ((3,1) : PairSlot))) Z4_4_0H1E_3_2_sound Z4_4_0H1E_3_3_sound (entropyTerm_zero_ball ((Z4_4_0Half_sound 1) ((3,4) : PairSlot))) (entropyTerm_zero_ball ((Z4_4_0Half_sound 1) ((3,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z4_4_0Half_sound 1) ((4,0) : PairSlot))) Z4_4_0H1E_4_1_sound (entropyTerm_zero_ball ((Z4_4_0Half_sound 1) ((4,2) : PairSlot))) (entropyTerm_zero_ball ((Z4_4_0Half_sound 1) ((4,3) : PairSlot))) (entropyTerm_zero_ball ((Z4_4_0Half_sound 1) ((4,4) : PairSlot))) (entropyTerm_zero_ball ((Z4_4_0Half_sound 1) ((4,5) : PairSlot))) + · exact forall_fin6 Z4_4_0H1E_5_0_sound (entropyTerm_zero_ball ((Z4_4_0Half_sound 1) ((5,1) : PairSlot))) (entropyTerm_zero_ball ((Z4_4_0Half_sound 1) ((5,2) : PairSlot))) (entropyTerm_zero_ball ((Z4_4_0Half_sound 1) ((5,3) : PairSlot))) (entropyTerm_zero_ball ((Z4_4_0Half_sound 1) ((5,4) : PairSlot))) (entropyTerm_zero_ball ((Z4_4_0Half_sound 1) ((5,5) : PairSlot))) +def Z4_4_0H1Entropy : Ball := ⟨(3143327057388077034003488044143 / 2500000000000000000000000000000), (63490820907 / 100000000000000000000000000000000)⟩ +lemma Z4_4_0H1Entropy_sound : Z4_4_0H1Entropy.Encloses (Foundation.finiteEntropy Z4_4_0H1Value) := by + exact contains_sound (entropyPair_enclosed Z4_4_0H1Value Z4_4_0H1Terms Z4_4_0H1Terms_sound) (by decide +kernel) +def Z4_4_0H1Mass : Ball := ⟨(99999999999999999999999999999999 / 100000000000000000000000000000000), (209 / 100000000000000000000000000000000)⟩ +lemma Z4_4_0H1Mass_sound : Z4_4_0H1Mass.Encloses (∑ a, Z4_4_0H1Value a) := by + exact contains_sound (pairSumBall_sound (Z4_4_0Half 1) Z4_4_0H1Value (Z4_4_0Half_sound 1)) (by decide +kernel) +def Z4_4_0H1MassTermLogWitness : LogWitness := ⟨-1, 99999999999999999999999999999999, 50000000000000000000000000000000⟩ +def Z4_4_0H1MassTermLog : Ball := ⟨0, (1694065903 / 4000000000000000000000000000000)⟩ +lemma Z4_4_0H1MassTermLog_sound : Z4_4_0H1MassTermLog.Encloses (Real.log ((∑ a, Z4_4_0H1Value a))) := by + exact checkLog_sound logTwoBall_sound (Z4_4_0H1Mass_sound) (w := Z4_4_0H1MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z4_4_0H1MassTerm : Ball := ⟨0, (5293955947 / 12500000000000000000000000000000)⟩ +lemma Z4_4_0H1MassTerm_sound : Z4_4_0H1MassTerm.Encloses (Foundation.entropyTerm ((∑ a, Z4_4_0H1Value a))) := by + exact contains_sound (entropyTerm_ball (Z4_4_0H1Mass_sound) Z4_4_0H1MassTermLog_sound) (by decide +kernel) +def Z4_4_0H1H : Ball := ⟨(3143327057388077034003488044143 / 2500000000000000000000000000000), (105842468483 / 100000000000000000000000000000000)⟩ +lemma Z4_4_0H1H_sound : Z4_4_0H1H.Encloses (homogeneousEntropy Z4_4_0H1Value) := by + exact contains_sound (homogeneous_enclosed Z4_4_0H1Value Z4_4_0H1MassTerm_sound Z4_4_0H1Entropy_sound) (by decide +kernel) +def Z4_4_0H2Value (a : PairSlot) : ℝ := (halfLaw (shape 4 4 0) 2 a : ℝ) +def Z4_4_0H2E_0_0Log : Ball := .exact 0 +lemma Z4_4_0H2E_0_0Log_sound : Z4_4_0H2E_0_0Log.Encloses (Real.log (Z4_4_0H2Value ((0,0) : PairSlot))) := by + exact log_exact_one_ball ((Z4_4_0Half_sound 2) ((0,0) : PairSlot)) +def Z4_4_0H2E_0_0 : Ball := ⟨0, 0⟩ +lemma Z4_4_0H2E_0_0_sound : Z4_4_0H2E_0_0.Encloses (Foundation.entropyTerm (Z4_4_0H2Value ((0,0) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z4_4_0Half_sound 2) ((0,0) : PairSlot)) Z4_4_0H2E_0_0Log_sound) (by decide +kernel) +def Z4_4_0H2Terms (a : PairSlot) : Ball := + match a.1.val, a.2.val with + | 0, 0 => ⟨0, 0⟩ + | _, _ => (.exact 0) +lemma Z4_4_0H2Terms_sound (a : PairSlot) : + (Z4_4_0H2Terms a).Encloses (Foundation.entropyTerm (Z4_4_0H2Value a)) := by + rcases a with ⟨i,j⟩ + revert j i + apply forall_fin6 + · exact forall_fin6 Z4_4_0H2E_0_0_sound (entropyTerm_zero_ball ((Z4_4_0Half_sound 2) ((0,1) : PairSlot))) (entropyTerm_zero_ball ((Z4_4_0Half_sound 2) ((0,2) : PairSlot))) (entropyTerm_zero_ball ((Z4_4_0Half_sound 2) ((0,3) : PairSlot))) (entropyTerm_zero_ball ((Z4_4_0Half_sound 2) ((0,4) : PairSlot))) (entropyTerm_zero_ball ((Z4_4_0Half_sound 2) ((0,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z4_4_0Half_sound 2) ((1,0) : PairSlot))) (entropyTerm_zero_ball ((Z4_4_0Half_sound 2) ((1,1) : PairSlot))) (entropyTerm_zero_ball ((Z4_4_0Half_sound 2) ((1,2) : PairSlot))) (entropyTerm_zero_ball ((Z4_4_0Half_sound 2) ((1,3) : PairSlot))) (entropyTerm_zero_ball ((Z4_4_0Half_sound 2) ((1,4) : PairSlot))) (entropyTerm_zero_ball ((Z4_4_0Half_sound 2) ((1,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z4_4_0Half_sound 2) ((2,0) : PairSlot))) (entropyTerm_zero_ball ((Z4_4_0Half_sound 2) ((2,1) : PairSlot))) (entropyTerm_zero_ball ((Z4_4_0Half_sound 2) ((2,2) : PairSlot))) (entropyTerm_zero_ball ((Z4_4_0Half_sound 2) ((2,3) : PairSlot))) (entropyTerm_zero_ball ((Z4_4_0Half_sound 2) ((2,4) : PairSlot))) (entropyTerm_zero_ball ((Z4_4_0Half_sound 2) ((2,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z4_4_0Half_sound 2) ((3,0) : PairSlot))) (entropyTerm_zero_ball ((Z4_4_0Half_sound 2) ((3,1) : PairSlot))) (entropyTerm_zero_ball ((Z4_4_0Half_sound 2) ((3,2) : PairSlot))) (entropyTerm_zero_ball ((Z4_4_0Half_sound 2) ((3,3) : PairSlot))) (entropyTerm_zero_ball ((Z4_4_0Half_sound 2) ((3,4) : PairSlot))) (entropyTerm_zero_ball ((Z4_4_0Half_sound 2) ((3,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z4_4_0Half_sound 2) ((4,0) : PairSlot))) (entropyTerm_zero_ball ((Z4_4_0Half_sound 2) ((4,1) : PairSlot))) (entropyTerm_zero_ball ((Z4_4_0Half_sound 2) ((4,2) : PairSlot))) (entropyTerm_zero_ball ((Z4_4_0Half_sound 2) ((4,3) : PairSlot))) (entropyTerm_zero_ball ((Z4_4_0Half_sound 2) ((4,4) : PairSlot))) (entropyTerm_zero_ball ((Z4_4_0Half_sound 2) ((4,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z4_4_0Half_sound 2) ((5,0) : PairSlot))) (entropyTerm_zero_ball ((Z4_4_0Half_sound 2) ((5,1) : PairSlot))) (entropyTerm_zero_ball ((Z4_4_0Half_sound 2) ((5,2) : PairSlot))) (entropyTerm_zero_ball ((Z4_4_0Half_sound 2) ((5,3) : PairSlot))) (entropyTerm_zero_ball ((Z4_4_0Half_sound 2) ((5,4) : PairSlot))) (entropyTerm_zero_ball ((Z4_4_0Half_sound 2) ((5,5) : PairSlot))) +def Z4_4_0H2Entropy : Ball := ⟨0, 0⟩ +lemma Z4_4_0H2Entropy_sound : Z4_4_0H2Entropy.Encloses (Foundation.finiteEntropy Z4_4_0H2Value) := by + exact contains_sound (entropyPair_enclosed Z4_4_0H2Value Z4_4_0H2Terms Z4_4_0H2Terms_sound) (by decide +kernel) +def Z4_4_0H2Mass : Ball := ⟨1, 0⟩ +lemma Z4_4_0H2Mass_sound : Z4_4_0H2Mass.Encloses (∑ a, Z4_4_0H2Value a) := by + exact contains_sound (pairSumBall_sound (Z4_4_0Half 2) Z4_4_0H2Value (Z4_4_0Half_sound 2)) (by decide +kernel) +def Z4_4_0H2MassTermLog : Ball := .exact 0 +lemma Z4_4_0H2MassTermLog_sound : Z4_4_0H2MassTermLog.Encloses (Real.log ((∑ a, Z4_4_0H2Value a))) := by + exact log_exact_one_ball (Z4_4_0H2Mass_sound) +def Z4_4_0H2MassTerm : Ball := ⟨0, 0⟩ +lemma Z4_4_0H2MassTerm_sound : Z4_4_0H2MassTerm.Encloses (Foundation.entropyTerm ((∑ a, Z4_4_0H2Value a))) := by + exact contains_sound (entropyTerm_ball (Z4_4_0H2Mass_sound) Z4_4_0H2MassTermLog_sound) (by decide +kernel) +def Z4_4_0H2H : Ball := ⟨0, 0⟩ +lemma Z4_4_0H2H_sound : Z4_4_0H2H.Encloses (homogeneousEntropy Z4_4_0H2Value) := by + exact contains_sound (homogeneous_enclosed Z4_4_0H2Value Z4_4_0H2MassTerm_sound Z4_4_0H2Entropy_sound) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/Certificates/Four5_0_3.lean b/lean/OAI/LinearAlgebra/MatrixFields/Certificates/Four5_0_3.lean new file mode 100644 index 0000000000000000000000000000000000000000..9c0e6ed0f3769016695c3b8a74d30a2331ce7395 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/Certificates/Four5_0_3.lean @@ -0,0 +1,604 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Certificates.SplitA1_3_12 + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def Z5_0_3Raw (ij : PairSlot) : Ball := + match ij.1.val, ij.2.val with + | 0, 0 => w195 + | 0, 1 => w195 + | 0, 2 => w195 + | 0, 3 => w195 + | 0, 4 => w195 + | 0, 5 => w195 + | 1, 0 => w195 + | 1, 1 => w195 + | 1, 2 => w195 + | 1, 3 => w195 + | 1, 4 => w195 + | 1, 5 => w139 + | 2, 0 => w195 + | 2, 1 => w195 + | 2, 2 => w195 + | 2, 3 => w195 + | 2, 4 => w203 + | 2, 5 => w195 + | 3, 0 => w195 + | 3, 1 => w195 + | 3, 2 => w195 + | 3, 3 => w195 + | 3, 4 => w195 + | 3, 5 => w195 + | 4, 0 => w195 + | 4, 1 => w195 + | 4, 2 => w203 + | 4, 3 => w195 + | 4, 4 => w195 + | 4, 5 => w195 + | 5, 0 => w195 + | 5, 1 => w139 + | 5, 2 => w195 + | 5, 3 => w195 + | 5, 4 => w195 + | 5, 5 => w195 + | _, _ => (.exact 0) +lemma Z5_0_3Raw_sound_0 (j : Fin 6) : + (Z5_0_3Raw (0,j)).Encloses (weight (orderedPairInteger (shape 5 0 3) 0 j) : ℝ) := by + fin_cases j + · change (Z5_0_3Raw (0,0)).Encloses (weight (orderedPairInteger (shape 5 0 3) 0 0) : ℝ) + have he : orderedPairInteger (shape 5 0 3) 0 0 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z5_0_3Raw (0,1)).Encloses (weight (orderedPairInteger (shape 5 0 3) 0 1) : ℝ) + have he : orderedPairInteger (shape 5 0 3) 0 1 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z5_0_3Raw (0,2)).Encloses (weight (orderedPairInteger (shape 5 0 3) 0 2) : ℝ) + have he : orderedPairInteger (shape 5 0 3) 0 2 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z5_0_3Raw (0,3)).Encloses (weight (orderedPairInteger (shape 5 0 3) 0 3) : ℝ) + have he : orderedPairInteger (shape 5 0 3) 0 3 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z5_0_3Raw (0,4)).Encloses (weight (orderedPairInteger (shape 5 0 3) 0 4) : ℝ) + have he : orderedPairInteger (shape 5 0 3) 0 4 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z5_0_3Raw (0,5)).Encloses (weight (orderedPairInteger (shape 5 0 3) 0 5) : ℝ) + have he : orderedPairInteger (shape 5 0 3) 0 5 = (0) := by decide +kernel + rw [he] + exact w195_sound +lemma Z5_0_3Raw_sound_1 (j : Fin 6) : + (Z5_0_3Raw (1,j)).Encloses (weight (orderedPairInteger (shape 5 0 3) 1 j) : ℝ) := by + fin_cases j + · change (Z5_0_3Raw (1,0)).Encloses (weight (orderedPairInteger (shape 5 0 3) 1 0) : ℝ) + have he : orderedPairInteger (shape 5 0 3) 1 0 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z5_0_3Raw (1,1)).Encloses (weight (orderedPairInteger (shape 5 0 3) 1 1) : ℝ) + have he : orderedPairInteger (shape 5 0 3) 1 1 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z5_0_3Raw (1,2)).Encloses (weight (orderedPairInteger (shape 5 0 3) 1 2) : ℝ) + have he : orderedPairInteger (shape 5 0 3) 1 2 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z5_0_3Raw (1,3)).Encloses (weight (orderedPairInteger (shape 5 0 3) 1 3) : ℝ) + have he : orderedPairInteger (shape 5 0 3) 1 3 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z5_0_3Raw (1,4)).Encloses (weight (orderedPairInteger (shape 5 0 3) 1 4) : ℝ) + have he : orderedPairInteger (shape 5 0 3) 1 4 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z5_0_3Raw (1,5)).Encloses (weight (orderedPairInteger (shape 5 0 3) 1 5) : ℝ) + have he : orderedPairInteger (shape 5 0 3) 1 5 = (-7811) := by decide +kernel + rw [he] + exact w139_sound +lemma Z5_0_3Raw_sound_2 (j : Fin 6) : + (Z5_0_3Raw (2,j)).Encloses (weight (orderedPairInteger (shape 5 0 3) 2 j) : ℝ) := by + fin_cases j + · change (Z5_0_3Raw (2,0)).Encloses (weight (orderedPairInteger (shape 5 0 3) 2 0) : ℝ) + have he : orderedPairInteger (shape 5 0 3) 2 0 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z5_0_3Raw (2,1)).Encloses (weight (orderedPairInteger (shape 5 0 3) 2 1) : ℝ) + have he : orderedPairInteger (shape 5 0 3) 2 1 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z5_0_3Raw (2,2)).Encloses (weight (orderedPairInteger (shape 5 0 3) 2 2) : ℝ) + have he : orderedPairInteger (shape 5 0 3) 2 2 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z5_0_3Raw (2,3)).Encloses (weight (orderedPairInteger (shape 5 0 3) 2 3) : ℝ) + have he : orderedPairInteger (shape 5 0 3) 2 3 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z5_0_3Raw (2,4)).Encloses (weight (orderedPairInteger (shape 5 0 3) 2 4) : ℝ) + have he : orderedPairInteger (shape 5 0 3) 2 4 = (21870) := by decide +kernel + rw [he] + exact w203_sound + · change (Z5_0_3Raw (2,5)).Encloses (weight (orderedPairInteger (shape 5 0 3) 2 5) : ℝ) + have he : orderedPairInteger (shape 5 0 3) 2 5 = (0) := by decide +kernel + rw [he] + exact w195_sound +lemma Z5_0_3Raw_sound_3 (j : Fin 6) : + (Z5_0_3Raw (3,j)).Encloses (weight (orderedPairInteger (shape 5 0 3) 3 j) : ℝ) := by + fin_cases j + · change (Z5_0_3Raw (3,0)).Encloses (weight (orderedPairInteger (shape 5 0 3) 3 0) : ℝ) + have he : orderedPairInteger (shape 5 0 3) 3 0 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z5_0_3Raw (3,1)).Encloses (weight (orderedPairInteger (shape 5 0 3) 3 1) : ℝ) + have he : orderedPairInteger (shape 5 0 3) 3 1 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z5_0_3Raw (3,2)).Encloses (weight (orderedPairInteger (shape 5 0 3) 3 2) : ℝ) + have he : orderedPairInteger (shape 5 0 3) 3 2 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z5_0_3Raw (3,3)).Encloses (weight (orderedPairInteger (shape 5 0 3) 3 3) : ℝ) + have he : orderedPairInteger (shape 5 0 3) 3 3 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z5_0_3Raw (3,4)).Encloses (weight (orderedPairInteger (shape 5 0 3) 3 4) : ℝ) + have he : orderedPairInteger (shape 5 0 3) 3 4 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z5_0_3Raw (3,5)).Encloses (weight (orderedPairInteger (shape 5 0 3) 3 5) : ℝ) + have he : orderedPairInteger (shape 5 0 3) 3 5 = (0) := by decide +kernel + rw [he] + exact w195_sound +lemma Z5_0_3Raw_sound_4 (j : Fin 6) : + (Z5_0_3Raw (4,j)).Encloses (weight (orderedPairInteger (shape 5 0 3) 4 j) : ℝ) := by + fin_cases j + · change (Z5_0_3Raw (4,0)).Encloses (weight (orderedPairInteger (shape 5 0 3) 4 0) : ℝ) + have he : orderedPairInteger (shape 5 0 3) 4 0 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z5_0_3Raw (4,1)).Encloses (weight (orderedPairInteger (shape 5 0 3) 4 1) : ℝ) + have he : orderedPairInteger (shape 5 0 3) 4 1 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z5_0_3Raw (4,2)).Encloses (weight (orderedPairInteger (shape 5 0 3) 4 2) : ℝ) + have he : orderedPairInteger (shape 5 0 3) 4 2 = (21870) := by decide +kernel + rw [he] + exact w203_sound + · change (Z5_0_3Raw (4,3)).Encloses (weight (orderedPairInteger (shape 5 0 3) 4 3) : ℝ) + have he : orderedPairInteger (shape 5 0 3) 4 3 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z5_0_3Raw (4,4)).Encloses (weight (orderedPairInteger (shape 5 0 3) 4 4) : ℝ) + have he : orderedPairInteger (shape 5 0 3) 4 4 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z5_0_3Raw (4,5)).Encloses (weight (orderedPairInteger (shape 5 0 3) 4 5) : ℝ) + have he : orderedPairInteger (shape 5 0 3) 4 5 = (0) := by decide +kernel + rw [he] + exact w195_sound +lemma Z5_0_3Raw_sound_5 (j : Fin 6) : + (Z5_0_3Raw (5,j)).Encloses (weight (orderedPairInteger (shape 5 0 3) 5 j) : ℝ) := by + fin_cases j + · change (Z5_0_3Raw (5,0)).Encloses (weight (orderedPairInteger (shape 5 0 3) 5 0) : ℝ) + have he : orderedPairInteger (shape 5 0 3) 5 0 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z5_0_3Raw (5,1)).Encloses (weight (orderedPairInteger (shape 5 0 3) 5 1) : ℝ) + have he : orderedPairInteger (shape 5 0 3) 5 1 = (-7811) := by decide +kernel + rw [he] + exact w139_sound + · change (Z5_0_3Raw (5,2)).Encloses (weight (orderedPairInteger (shape 5 0 3) 5 2) : ℝ) + have he : orderedPairInteger (shape 5 0 3) 5 2 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z5_0_3Raw (5,3)).Encloses (weight (orderedPairInteger (shape 5 0 3) 5 3) : ℝ) + have he : orderedPairInteger (shape 5 0 3) 5 3 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z5_0_3Raw (5,4)).Encloses (weight (orderedPairInteger (shape 5 0 3) 5 4) : ℝ) + have he : orderedPairInteger (shape 5 0 3) 5 4 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z5_0_3Raw (5,5)).Encloses (weight (orderedPairInteger (shape 5 0 3) 5 5) : ℝ) + have he : orderedPairInteger (shape 5 0 3) 5 5 = (0) := by decide +kernel + rw [he] + exact w195_sound +lemma Z5_0_3Raw_sound (ij : PairSlot) : + (Z5_0_3Raw ij).Encloses (weight (orderedPairInteger (shape 5 0 3) ij.1 ij.2) : ℝ) := by + rcases ij with ⟨i,j⟩ + revert i + exact forall_fin6 (Z5_0_3Raw_sound_0 j) (Z5_0_3Raw_sound_1 j) (Z5_0_3Raw_sound_2 j) (Z5_0_3Raw_sound_3 j) (Z5_0_3Raw_sound_4 j) (Z5_0_3Raw_sound_5 j) +def Z5_0_3Den : Ball := ⟨(518317484278105540989009344894649 / 25000000000000000000000000000000), (983 / 50000000000000000000000000000000)⟩ +lemma Z5_0_3Den_sound : Z5_0_3Den.Encloses + (((orderedPairs (shape 5 0 3)).map (fun ij => weight (orderedPairInteger (shape 5 0 3) ij.1 ij.2))).sum : ℝ) := by + exact contains_sound (list_cast_enclosed (orderedPairs (shape 5 0 3)) Z5_0_3Raw + (fun ij => weight (orderedPairInteger (shape 5 0 3) ij.1 ij.2)) + (fun ij _ => Z5_0_3Raw_sound ij)) (by decide +kernel) +lemma Z5_0_3Den_pos : 0 < Z5_0_3Den.lower := by decide +kernel +def Z5_0_3Probs (ij : PairSlot) : Ball := + match ij.1.val, ij.2.val with + | 1, 5 => ⟨(2208598281054095678468725843991 / 100000000000000000000000000000000), (1 / 20000000000000000000000000000000)⟩ + | 2, 4 => ⟨(42968103111757469343913723803283 / 100000000000000000000000000000000), (43 / 50000000000000000000000000000000)⟩ + | 3, 4 => ⟨(2411649303594217488808775176363 / 50000000000000000000000000000000), (1 / 20000000000000000000000000000000)⟩ + | 4, 2 => ⟨(42968103111757469343913723803283 / 100000000000000000000000000000000), (43 / 50000000000000000000000000000000)⟩ + | 4, 3 => ⟨(2411649303594217488808775176363 / 50000000000000000000000000000000), (1 / 20000000000000000000000000000000)⟩ + | 5, 1 => ⟨(2208598281054095678468725843991 / 100000000000000000000000000000000), (1 / 20000000000000000000000000000000)⟩ + | _, _ => (.exact 0) +lemma Z5_0_3Contains : ∀ i j : Fin 6, + statisticWeight i + statisticWeight j = shapeMax (shape 5 0 3) → + contains (.mul (Z5_0_3Raw (i,j)) (.inv Z5_0_3Den)) (Z5_0_3Probs (i,j)) = true := by + decide +kernel +lemma Z5_0_3Zero : ∀ i j : Fin 6, + statisticWeight i + statisticWeight j ≠ shapeMax (shape 5 0 3) → Z5_0_3Probs (i,j) = .exact 0 := by + decide +kernel +lemma Z5_0_3Probs_sound (ij : PairSlot) : + (Z5_0_3Probs ij).Encloses (zeroPairLaw (shape 5 0 3) ij.1 ij.2 : ℝ) := by + by_cases h : statisticWeight ij.1 + statisticWeight ij.2 = shapeMax (shape 5 0 3) + · have hb := contains_sound (Ball.mul_sound (Z5_0_3Raw_sound ij) + (Ball.inv_sound Z5_0_3Den_sound Z5_0_3Den_pos)) (Z5_0_3Contains ij.1 ij.2 h) + simpa only [zeroPairLaw, h, ite_true, Rat.cast_div, Rat.cast_mul, + Rat.cast_inv, div_eq_mul_inv] using hb + · rw [Z5_0_3Zero ij.1 ij.2 h] + simpa only [zeroPairLaw, h, ite_false] using Ball.exact_sound 0 + +def Z5_0_3Half (w : Fin 3) (ij : PairSlot) : Ball := + if (shape 5 0 3) w = 0 then if ij = (0,0) then .exact 1 else .exact 0 + else if w = halfMaxAxis (shape 5 0 3) then Z5_0_3Probs ij + else Z5_0_3Probs (kappa ij.1, kappa ij.2) +lemma Z5_0_3Half_sound (w : Fin 3) (ij : PairSlot) : + (Z5_0_3Half w ij).Encloses (halfLaw (shape 5 0 3) w ij : ℝ) := by + have hp : positive (shape 5 0 3) = false := by decide +kernel + simp only [Z5_0_3Half, halfLaw, hp, Bool.false_eq_true, ite_false] + split_ifs + · exact Ball.exact_sound 1 + · exact Ball.exact_sound 0 + · exact Z5_0_3Probs_sound _ + · exact Z5_0_3Probs_sound _ + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def Z5_0_3Value (a : PairSlot) : ℝ := (zeroPairLaw (shape 5 0 3) a.1 a.2 : ℝ) +def Z5_0_3E_1_5LogWitness : LogWitness := ⟨-6, 2208598281054095678468725843991, 1562500000000000000000000000000⟩ +def Z5_0_3E_1_5Log : Ball := ⟨(-381281213365411604359879013926363 / 100000000000000000000000000000000), (148230766007 / 100000000000000000000000000000000)⟩ +lemma Z5_0_3E_1_5Log_sound : Z5_0_3E_1_5Log.Encloses (Real.log (Z5_0_3Value ((1,5) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound (Z5_0_3Probs_sound ((1,5) : PairSlot)) (w := Z5_0_3E_1_5LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z5_0_3E_1_5 : Ball := ⟨(8420970324370679601710618565453 / 100000000000000000000000000000000), (327382217 / 10000000000000000000000000000000)⟩ +lemma Z5_0_3E_1_5_sound : Z5_0_3E_1_5.Encloses (Foundation.entropyTerm (Z5_0_3Value ((1,5) : PairSlot))) := by + exact contains_sound (entropyTerm_ball (Z5_0_3Probs_sound ((1,5) : PairSlot)) Z5_0_3E_1_5Log_sound) (by decide +kernel) +def Z5_0_3E_2_4LogWitness : LogWitness := ⟨-2, 42968103111757469343913723803283, 25000000000000000000000000000000⟩ +def Z5_0_3E_2_4Log : Ball := ⟨(-42235606682705802179939545154249 / 50000000000000000000000000000000), (63527471249 / 100000000000000000000000000000000)⟩ +lemma Z5_0_3E_2_4Log_sound : Z5_0_3E_2_4Log.Encloses (Real.log (Z5_0_3Value ((2,4) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound (Z5_0_3Probs_sound ((2,4) : PairSlot)) (w := Z5_0_3E_2_4LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z5_0_3E_2_4 : Ball := ⟨(36295678058602714916587164090917 / 100000000000000000000000000000000), (1706034339 / 6250000000000000000000000000000)⟩ +lemma Z5_0_3E_2_4_sound : Z5_0_3E_2_4.Encloses (Foundation.entropyTerm (Z5_0_3Value ((2,4) : PairSlot))) := by + exact contains_sound (entropyTerm_ball (Z5_0_3Probs_sound ((2,4) : PairSlot)) Z5_0_3E_2_4Log_sound) (by decide +kernel) +def Z5_0_3E_3_4LogWitness : LogWitness := ⟨-5, 2411649303594217488808775176363, 1562500000000000000000000000000⟩ +def Z5_0_3E_3_4Log : Ball := ⟨(-303171213365411604359879033021803 / 100000000000000000000000000000000), (127054942201 / 100000000000000000000000000000000)⟩ +lemma Z5_0_3E_3_4Log_sound : Z5_0_3E_3_4Log.Encloses (Real.log (Z5_0_3Value ((3,4) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound (Z5_0_3Probs_sound ((3,4) : PairSlot)) (w := Z5_0_3E_3_4LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z5_0_3E_3_4 : Ball := ⟨(7311426455825088170477182923379 / 50000000000000000000000000000000), (3064119637 / 50000000000000000000000000000000)⟩ +lemma Z5_0_3E_3_4_sound : Z5_0_3E_3_4.Encloses (Foundation.entropyTerm (Z5_0_3Value ((3,4) : PairSlot))) := by + exact contains_sound (entropyTerm_ball (Z5_0_3Probs_sound ((3,4) : PairSlot)) Z5_0_3E_3_4Log_sound) (by decide +kernel) +def Z5_0_3E_4_2LogWitness : LogWitness := ⟨-2, 42968103111757469343913723803283, 25000000000000000000000000000000⟩ +def Z5_0_3E_4_2Log : Ball := ⟨(-42235606682705802179939545154249 / 50000000000000000000000000000000), (63527471249 / 100000000000000000000000000000000)⟩ +lemma Z5_0_3E_4_2Log_sound : Z5_0_3E_4_2Log.Encloses (Real.log (Z5_0_3Value ((4,2) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound (Z5_0_3Probs_sound ((4,2) : PairSlot)) (w := Z5_0_3E_4_2LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z5_0_3E_4_2 : Ball := ⟨(36295678058602714916587164090917 / 100000000000000000000000000000000), (1706034339 / 6250000000000000000000000000000)⟩ +lemma Z5_0_3E_4_2_sound : Z5_0_3E_4_2.Encloses (Foundation.entropyTerm (Z5_0_3Value ((4,2) : PairSlot))) := by + exact contains_sound (entropyTerm_ball (Z5_0_3Probs_sound ((4,2) : PairSlot)) Z5_0_3E_4_2Log_sound) (by decide +kernel) +def Z5_0_3E_4_3LogWitness : LogWitness := ⟨-5, 2411649303594217488808775176363, 1562500000000000000000000000000⟩ +def Z5_0_3E_4_3Log : Ball := ⟨(-303171213365411604359879033021803 / 100000000000000000000000000000000), (127054942201 / 100000000000000000000000000000000)⟩ +lemma Z5_0_3E_4_3Log_sound : Z5_0_3E_4_3Log.Encloses (Real.log (Z5_0_3Value ((4,3) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound (Z5_0_3Probs_sound ((4,3) : PairSlot)) (w := Z5_0_3E_4_3LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z5_0_3E_4_3 : Ball := ⟨(7311426455825088170477182923379 / 50000000000000000000000000000000), (3064119637 / 50000000000000000000000000000000)⟩ +lemma Z5_0_3E_4_3_sound : Z5_0_3E_4_3.Encloses (Foundation.entropyTerm (Z5_0_3Value ((4,3) : PairSlot))) := by + exact contains_sound (entropyTerm_ball (Z5_0_3Probs_sound ((4,3) : PairSlot)) Z5_0_3E_4_3Log_sound) (by decide +kernel) +def Z5_0_3E_5_1LogWitness : LogWitness := ⟨-6, 2208598281054095678468725843991, 1562500000000000000000000000000⟩ +def Z5_0_3E_5_1Log : Ball := ⟨(-381281213365411604359879013926363 / 100000000000000000000000000000000), (148230766007 / 100000000000000000000000000000000)⟩ +lemma Z5_0_3E_5_1Log_sound : Z5_0_3E_5_1Log.Encloses (Real.log (Z5_0_3Value ((5,1) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound (Z5_0_3Probs_sound ((5,1) : PairSlot)) (w := Z5_0_3E_5_1LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z5_0_3E_5_1 : Ball := ⟨(8420970324370679601710618565453 / 100000000000000000000000000000000), (327382217 / 10000000000000000000000000000000)⟩ +lemma Z5_0_3E_5_1_sound : Z5_0_3E_5_1.Encloses (Foundation.entropyTerm (Z5_0_3Value ((5,1) : PairSlot))) := by + exact contains_sound (entropyTerm_ball (Z5_0_3Probs_sound ((5,1) : PairSlot)) Z5_0_3E_5_1Log_sound) (by decide +kernel) +def Z5_0_3Terms (a : PairSlot) : Ball := + match a.1.val, a.2.val with + | 1, 5 => ⟨(8420970324370679601710618565453 / 100000000000000000000000000000000), (327382217 / 10000000000000000000000000000000)⟩ + | 2, 4 => ⟨(36295678058602714916587164090917 / 100000000000000000000000000000000), (1706034339 / 6250000000000000000000000000000)⟩ + | 3, 4 => ⟨(7311426455825088170477182923379 / 50000000000000000000000000000000), (3064119637 / 50000000000000000000000000000000)⟩ + | 4, 2 => ⟨(36295678058602714916587164090917 / 100000000000000000000000000000000), (1706034339 / 6250000000000000000000000000000)⟩ + | 4, 3 => ⟨(7311426455825088170477182923379 / 50000000000000000000000000000000), (3064119637 / 50000000000000000000000000000000)⟩ + | 5, 1 => ⟨(8420970324370679601710618565453 / 100000000000000000000000000000000), (327382217 / 10000000000000000000000000000000)⟩ + | _, _ => (.exact 0) +lemma Z5_0_3Terms_sound (a : PairSlot) : + (Z5_0_3Terms a).Encloses (Foundation.entropyTerm (Z5_0_3Value a)) := by + rcases a with ⟨i,j⟩ + revert j i + apply forall_fin6 + · exact forall_fin6 (entropyTerm_zero_ball (Z5_0_3Probs_sound ((0,0) : PairSlot))) (entropyTerm_zero_ball (Z5_0_3Probs_sound ((0,1) : PairSlot))) (entropyTerm_zero_ball (Z5_0_3Probs_sound ((0,2) : PairSlot))) (entropyTerm_zero_ball (Z5_0_3Probs_sound ((0,3) : PairSlot))) (entropyTerm_zero_ball (Z5_0_3Probs_sound ((0,4) : PairSlot))) (entropyTerm_zero_ball (Z5_0_3Probs_sound ((0,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball (Z5_0_3Probs_sound ((1,0) : PairSlot))) (entropyTerm_zero_ball (Z5_0_3Probs_sound ((1,1) : PairSlot))) (entropyTerm_zero_ball (Z5_0_3Probs_sound ((1,2) : PairSlot))) (entropyTerm_zero_ball (Z5_0_3Probs_sound ((1,3) : PairSlot))) (entropyTerm_zero_ball (Z5_0_3Probs_sound ((1,4) : PairSlot))) Z5_0_3E_1_5_sound + · exact forall_fin6 (entropyTerm_zero_ball (Z5_0_3Probs_sound ((2,0) : PairSlot))) (entropyTerm_zero_ball (Z5_0_3Probs_sound ((2,1) : PairSlot))) (entropyTerm_zero_ball (Z5_0_3Probs_sound ((2,2) : PairSlot))) (entropyTerm_zero_ball (Z5_0_3Probs_sound ((2,3) : PairSlot))) Z5_0_3E_2_4_sound (entropyTerm_zero_ball (Z5_0_3Probs_sound ((2,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball (Z5_0_3Probs_sound ((3,0) : PairSlot))) (entropyTerm_zero_ball (Z5_0_3Probs_sound ((3,1) : PairSlot))) (entropyTerm_zero_ball (Z5_0_3Probs_sound ((3,2) : PairSlot))) (entropyTerm_zero_ball (Z5_0_3Probs_sound ((3,3) : PairSlot))) Z5_0_3E_3_4_sound (entropyTerm_zero_ball (Z5_0_3Probs_sound ((3,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball (Z5_0_3Probs_sound ((4,0) : PairSlot))) (entropyTerm_zero_ball (Z5_0_3Probs_sound ((4,1) : PairSlot))) Z5_0_3E_4_2_sound Z5_0_3E_4_3_sound (entropyTerm_zero_ball (Z5_0_3Probs_sound ((4,4) : PairSlot))) (entropyTerm_zero_ball (Z5_0_3Probs_sound ((4,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball (Z5_0_3Probs_sound ((5,0) : PairSlot))) Z5_0_3E_5_1_sound (entropyTerm_zero_ball (Z5_0_3Probs_sound ((5,2) : PairSlot))) (entropyTerm_zero_ball (Z5_0_3Probs_sound ((5,3) : PairSlot))) (entropyTerm_zero_ball (Z5_0_3Probs_sound ((5,4) : PairSlot))) (entropyTerm_zero_ball (Z5_0_3Probs_sound ((5,5) : PairSlot))) +def Z5_0_3Entropy : Ball := ⟨(7417437661827946357406518562891 / 6250000000000000000000000000000), (9174652717 / 12500000000000000000000000000000)⟩ +lemma Z5_0_3Entropy_sound : Z5_0_3Entropy.Encloses (Foundation.finiteEntropy Z5_0_3Value) := by + exact contains_sound (entropyPair_enclosed Z5_0_3Value Z5_0_3Terms Z5_0_3Terms_sound) (by decide +kernel) +def Z5_0_3Labels : Ball := ⟨(64195374706788471650300819324119 / 12500000000000000000000000000000), (311595391 / 195312500000000000000000000000)⟩ +lemma Z5_0_3Labels_sound : Z5_0_3Labels.Encloses + (∑ a : PairSlot, (zeroPairLaw (shape 5 0 3) a.1 a.2 : ℝ) * + Real.log (AllFieldParameters.multiplicity a.1 * AllFieldParameters.multiplicity a.2 : ℕ)) := by + exact contains_sound (pairSumBall_sound (fun a => .mul (Z5_0_3Probs a) (multLogs a)) + _ (fun a => Ball.mul_sound (Z5_0_3Probs_sound a) (multLogs_sound a))) (by decide +kernel) +def Z5_0_3Four : Ball := ⟨(79030250030444364365113856449901 / 12500000000000000000000000000000), (29116757741 / 12500000000000000000000000000000)⟩ +lemma Z5_0_3Four_sound : Z5_0_3Four.Encloses (AllFieldZeroLeafRates.fourRate (shape 5 0 3)) := by + exact contains_sound (Ball.add_sound Z5_0_3Entropy_sound Z5_0_3Labels_sound) (by decide +kernel) +def Z5_0_3H0Value (a : PairSlot) : ℝ := (halfLaw (shape 5 0 3) 0 a : ℝ) +def Z5_0_3H0E_1_5LogWitness : LogWitness := ⟨-6, 2208598281054095678468725843991, 1562500000000000000000000000000⟩ +def Z5_0_3H0E_1_5Log : Ball := ⟨(-381281213365411604359879013926363 / 100000000000000000000000000000000), (148230766007 / 100000000000000000000000000000000)⟩ +lemma Z5_0_3H0E_1_5Log_sound : Z5_0_3H0E_1_5Log.Encloses (Real.log (Z5_0_3H0Value ((1,5) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound ((Z5_0_3Half_sound 0) ((1,5) : PairSlot)) (w := Z5_0_3H0E_1_5LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z5_0_3H0E_1_5 : Ball := ⟨(8420970324370679601710618565453 / 100000000000000000000000000000000), (327382217 / 10000000000000000000000000000000)⟩ +lemma Z5_0_3H0E_1_5_sound : Z5_0_3H0E_1_5.Encloses (Foundation.entropyTerm (Z5_0_3H0Value ((1,5) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z5_0_3Half_sound 0) ((1,5) : PairSlot)) Z5_0_3H0E_1_5Log_sound) (by decide +kernel) +def Z5_0_3H0E_2_4LogWitness : LogWitness := ⟨-2, 42968103111757469343913723803283, 25000000000000000000000000000000⟩ +def Z5_0_3H0E_2_4Log : Ball := ⟨(-42235606682705802179939545154249 / 50000000000000000000000000000000), (63527471249 / 100000000000000000000000000000000)⟩ +lemma Z5_0_3H0E_2_4Log_sound : Z5_0_3H0E_2_4Log.Encloses (Real.log (Z5_0_3H0Value ((2,4) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound ((Z5_0_3Half_sound 0) ((2,4) : PairSlot)) (w := Z5_0_3H0E_2_4LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z5_0_3H0E_2_4 : Ball := ⟨(36295678058602714916587164090917 / 100000000000000000000000000000000), (1706034339 / 6250000000000000000000000000000)⟩ +lemma Z5_0_3H0E_2_4_sound : Z5_0_3H0E_2_4.Encloses (Foundation.entropyTerm (Z5_0_3H0Value ((2,4) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z5_0_3Half_sound 0) ((2,4) : PairSlot)) Z5_0_3H0E_2_4Log_sound) (by decide +kernel) +def Z5_0_3H0E_3_4LogWitness : LogWitness := ⟨-5, 2411649303594217488808775176363, 1562500000000000000000000000000⟩ +def Z5_0_3H0E_3_4Log : Ball := ⟨(-303171213365411604359879033021803 / 100000000000000000000000000000000), (127054942201 / 100000000000000000000000000000000)⟩ +lemma Z5_0_3H0E_3_4Log_sound : Z5_0_3H0E_3_4Log.Encloses (Real.log (Z5_0_3H0Value ((3,4) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound ((Z5_0_3Half_sound 0) ((3,4) : PairSlot)) (w := Z5_0_3H0E_3_4LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z5_0_3H0E_3_4 : Ball := ⟨(7311426455825088170477182923379 / 50000000000000000000000000000000), (3064119637 / 50000000000000000000000000000000)⟩ +lemma Z5_0_3H0E_3_4_sound : Z5_0_3H0E_3_4.Encloses (Foundation.entropyTerm (Z5_0_3H0Value ((3,4) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z5_0_3Half_sound 0) ((3,4) : PairSlot)) Z5_0_3H0E_3_4Log_sound) (by decide +kernel) +def Z5_0_3H0E_4_2LogWitness : LogWitness := ⟨-2, 42968103111757469343913723803283, 25000000000000000000000000000000⟩ +def Z5_0_3H0E_4_2Log : Ball := ⟨(-42235606682705802179939545154249 / 50000000000000000000000000000000), (63527471249 / 100000000000000000000000000000000)⟩ +lemma Z5_0_3H0E_4_2Log_sound : Z5_0_3H0E_4_2Log.Encloses (Real.log (Z5_0_3H0Value ((4,2) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound ((Z5_0_3Half_sound 0) ((4,2) : PairSlot)) (w := Z5_0_3H0E_4_2LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z5_0_3H0E_4_2 : Ball := ⟨(36295678058602714916587164090917 / 100000000000000000000000000000000), (1706034339 / 6250000000000000000000000000000)⟩ +lemma Z5_0_3H0E_4_2_sound : Z5_0_3H0E_4_2.Encloses (Foundation.entropyTerm (Z5_0_3H0Value ((4,2) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z5_0_3Half_sound 0) ((4,2) : PairSlot)) Z5_0_3H0E_4_2Log_sound) (by decide +kernel) +def Z5_0_3H0E_4_3LogWitness : LogWitness := ⟨-5, 2411649303594217488808775176363, 1562500000000000000000000000000⟩ +def Z5_0_3H0E_4_3Log : Ball := ⟨(-303171213365411604359879033021803 / 100000000000000000000000000000000), (127054942201 / 100000000000000000000000000000000)⟩ +lemma Z5_0_3H0E_4_3Log_sound : Z5_0_3H0E_4_3Log.Encloses (Real.log (Z5_0_3H0Value ((4,3) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound ((Z5_0_3Half_sound 0) ((4,3) : PairSlot)) (w := Z5_0_3H0E_4_3LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z5_0_3H0E_4_3 : Ball := ⟨(7311426455825088170477182923379 / 50000000000000000000000000000000), (3064119637 / 50000000000000000000000000000000)⟩ +lemma Z5_0_3H0E_4_3_sound : Z5_0_3H0E_4_3.Encloses (Foundation.entropyTerm (Z5_0_3H0Value ((4,3) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z5_0_3Half_sound 0) ((4,3) : PairSlot)) Z5_0_3H0E_4_3Log_sound) (by decide +kernel) +def Z5_0_3H0E_5_1LogWitness : LogWitness := ⟨-6, 2208598281054095678468725843991, 1562500000000000000000000000000⟩ +def Z5_0_3H0E_5_1Log : Ball := ⟨(-381281213365411604359879013926363 / 100000000000000000000000000000000), (148230766007 / 100000000000000000000000000000000)⟩ +lemma Z5_0_3H0E_5_1Log_sound : Z5_0_3H0E_5_1Log.Encloses (Real.log (Z5_0_3H0Value ((5,1) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound ((Z5_0_3Half_sound 0) ((5,1) : PairSlot)) (w := Z5_0_3H0E_5_1LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z5_0_3H0E_5_1 : Ball := ⟨(8420970324370679601710618565453 / 100000000000000000000000000000000), (327382217 / 10000000000000000000000000000000)⟩ +lemma Z5_0_3H0E_5_1_sound : Z5_0_3H0E_5_1.Encloses (Foundation.entropyTerm (Z5_0_3H0Value ((5,1) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z5_0_3Half_sound 0) ((5,1) : PairSlot)) Z5_0_3H0E_5_1Log_sound) (by decide +kernel) +def Z5_0_3H0Terms (a : PairSlot) : Ball := + match a.1.val, a.2.val with + | 1, 5 => ⟨(8420970324370679601710618565453 / 100000000000000000000000000000000), (327382217 / 10000000000000000000000000000000)⟩ + | 2, 4 => ⟨(36295678058602714916587164090917 / 100000000000000000000000000000000), (1706034339 / 6250000000000000000000000000000)⟩ + | 3, 4 => ⟨(7311426455825088170477182923379 / 50000000000000000000000000000000), (3064119637 / 50000000000000000000000000000000)⟩ + | 4, 2 => ⟨(36295678058602714916587164090917 / 100000000000000000000000000000000), (1706034339 / 6250000000000000000000000000000)⟩ + | 4, 3 => ⟨(7311426455825088170477182923379 / 50000000000000000000000000000000), (3064119637 / 50000000000000000000000000000000)⟩ + | 5, 1 => ⟨(8420970324370679601710618565453 / 100000000000000000000000000000000), (327382217 / 10000000000000000000000000000000)⟩ + | _, _ => (.exact 0) +lemma Z5_0_3H0Terms_sound (a : PairSlot) : + (Z5_0_3H0Terms a).Encloses (Foundation.entropyTerm (Z5_0_3H0Value a)) := by + rcases a with ⟨i,j⟩ + revert j i + apply forall_fin6 + · exact forall_fin6 (entropyTerm_zero_ball ((Z5_0_3Half_sound 0) ((0,0) : PairSlot))) (entropyTerm_zero_ball ((Z5_0_3Half_sound 0) ((0,1) : PairSlot))) (entropyTerm_zero_ball ((Z5_0_3Half_sound 0) ((0,2) : PairSlot))) (entropyTerm_zero_ball ((Z5_0_3Half_sound 0) ((0,3) : PairSlot))) (entropyTerm_zero_ball ((Z5_0_3Half_sound 0) ((0,4) : PairSlot))) (entropyTerm_zero_ball ((Z5_0_3Half_sound 0) ((0,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z5_0_3Half_sound 0) ((1,0) : PairSlot))) (entropyTerm_zero_ball ((Z5_0_3Half_sound 0) ((1,1) : PairSlot))) (entropyTerm_zero_ball ((Z5_0_3Half_sound 0) ((1,2) : PairSlot))) (entropyTerm_zero_ball ((Z5_0_3Half_sound 0) ((1,3) : PairSlot))) (entropyTerm_zero_ball ((Z5_0_3Half_sound 0) ((1,4) : PairSlot))) Z5_0_3H0E_1_5_sound + · exact forall_fin6 (entropyTerm_zero_ball ((Z5_0_3Half_sound 0) ((2,0) : PairSlot))) (entropyTerm_zero_ball ((Z5_0_3Half_sound 0) ((2,1) : PairSlot))) (entropyTerm_zero_ball ((Z5_0_3Half_sound 0) ((2,2) : PairSlot))) (entropyTerm_zero_ball ((Z5_0_3Half_sound 0) ((2,3) : PairSlot))) Z5_0_3H0E_2_4_sound (entropyTerm_zero_ball ((Z5_0_3Half_sound 0) ((2,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z5_0_3Half_sound 0) ((3,0) : PairSlot))) (entropyTerm_zero_ball ((Z5_0_3Half_sound 0) ((3,1) : PairSlot))) (entropyTerm_zero_ball ((Z5_0_3Half_sound 0) ((3,2) : PairSlot))) (entropyTerm_zero_ball ((Z5_0_3Half_sound 0) ((3,3) : PairSlot))) Z5_0_3H0E_3_4_sound (entropyTerm_zero_ball ((Z5_0_3Half_sound 0) ((3,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z5_0_3Half_sound 0) ((4,0) : PairSlot))) (entropyTerm_zero_ball ((Z5_0_3Half_sound 0) ((4,1) : PairSlot))) Z5_0_3H0E_4_2_sound Z5_0_3H0E_4_3_sound (entropyTerm_zero_ball ((Z5_0_3Half_sound 0) ((4,4) : PairSlot))) (entropyTerm_zero_ball ((Z5_0_3Half_sound 0) ((4,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z5_0_3Half_sound 0) ((5,0) : PairSlot))) Z5_0_3H0E_5_1_sound (entropyTerm_zero_ball ((Z5_0_3Half_sound 0) ((5,2) : PairSlot))) (entropyTerm_zero_ball ((Z5_0_3Half_sound 0) ((5,3) : PairSlot))) (entropyTerm_zero_ball ((Z5_0_3Half_sound 0) ((5,4) : PairSlot))) (entropyTerm_zero_ball ((Z5_0_3Half_sound 0) ((5,5) : PairSlot))) +def Z5_0_3H0Entropy : Ball := ⟨(7417437661827946357406518562891 / 6250000000000000000000000000000), (9174652717 / 12500000000000000000000000000000)⟩ +lemma Z5_0_3H0Entropy_sound : Z5_0_3H0Entropy.Encloses (Foundation.finiteEntropy Z5_0_3H0Value) := by + exact contains_sound (entropyPair_enclosed Z5_0_3H0Value Z5_0_3H0Terms Z5_0_3H0Terms_sound) (by decide +kernel) +def Z5_0_3H0Mass : Ball := ⟨1, (3 / 1562500000000000000000000000000)⟩ +lemma Z5_0_3H0Mass_sound : Z5_0_3H0Mass.Encloses (∑ a, Z5_0_3H0Value a) := by + exact contains_sound (pairSumBall_sound (Z5_0_3Half 0) Z5_0_3H0Value (Z5_0_3Half_sound 0)) (by decide +kernel) +def Z5_0_3H0MassTermLogWitness : LogWitness := ⟨0, 1, 1⟩ +def Z5_0_3H0MassTermLog : Ball := ⟨0, (10587911937 / 50000000000000000000000000000000)⟩ +lemma Z5_0_3H0MassTermLog_sound : Z5_0_3H0MassTermLog.Encloses (Real.log ((∑ a, Z5_0_3H0Value a))) := by + exact checkLog_sound logTwoBall_sound (Z5_0_3H0Mass_sound) (w := Z5_0_3H0MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z5_0_3H0MassTerm : Ball := ⟨0, (169406591 / 800000000000000000000000000000)⟩ +lemma Z5_0_3H0MassTerm_sound : Z5_0_3H0MassTerm.Encloses (Foundation.entropyTerm ((∑ a, Z5_0_3H0Value a))) := by + exact contains_sound (entropyTerm_ball (Z5_0_3H0Mass_sound) Z5_0_3H0MassTermLog_sound) (by decide +kernel) +def Z5_0_3H0H : Ball := ⟨(7417437661827946357406518562891 / 6250000000000000000000000000000), (94573045611 / 100000000000000000000000000000000)⟩ +lemma Z5_0_3H0H_sound : Z5_0_3H0H.Encloses (homogeneousEntropy Z5_0_3H0Value) := by + exact contains_sound (homogeneous_enclosed Z5_0_3H0Value Z5_0_3H0MassTerm_sound Z5_0_3H0Entropy_sound) (by decide +kernel) +def Z5_0_3H1Value (a : PairSlot) : ℝ := (halfLaw (shape 5 0 3) 1 a : ℝ) +def Z5_0_3H1E_0_0Log : Ball := .exact 0 +lemma Z5_0_3H1E_0_0Log_sound : Z5_0_3H1E_0_0Log.Encloses (Real.log (Z5_0_3H1Value ((0,0) : PairSlot))) := by + exact log_exact_one_ball ((Z5_0_3Half_sound 1) ((0,0) : PairSlot)) +def Z5_0_3H1E_0_0 : Ball := ⟨0, 0⟩ +lemma Z5_0_3H1E_0_0_sound : Z5_0_3H1E_0_0.Encloses (Foundation.entropyTerm (Z5_0_3H1Value ((0,0) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z5_0_3Half_sound 1) ((0,0) : PairSlot)) Z5_0_3H1E_0_0Log_sound) (by decide +kernel) +def Z5_0_3H1Terms (a : PairSlot) : Ball := + match a.1.val, a.2.val with + | 0, 0 => ⟨0, 0⟩ + | _, _ => (.exact 0) +lemma Z5_0_3H1Terms_sound (a : PairSlot) : + (Z5_0_3H1Terms a).Encloses (Foundation.entropyTerm (Z5_0_3H1Value a)) := by + rcases a with ⟨i,j⟩ + revert j i + apply forall_fin6 + · exact forall_fin6 Z5_0_3H1E_0_0_sound (entropyTerm_zero_ball ((Z5_0_3Half_sound 1) ((0,1) : PairSlot))) (entropyTerm_zero_ball ((Z5_0_3Half_sound 1) ((0,2) : PairSlot))) (entropyTerm_zero_ball ((Z5_0_3Half_sound 1) ((0,3) : PairSlot))) (entropyTerm_zero_ball ((Z5_0_3Half_sound 1) ((0,4) : PairSlot))) (entropyTerm_zero_ball ((Z5_0_3Half_sound 1) ((0,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z5_0_3Half_sound 1) ((1,0) : PairSlot))) (entropyTerm_zero_ball ((Z5_0_3Half_sound 1) ((1,1) : PairSlot))) (entropyTerm_zero_ball ((Z5_0_3Half_sound 1) ((1,2) : PairSlot))) (entropyTerm_zero_ball ((Z5_0_3Half_sound 1) ((1,3) : PairSlot))) (entropyTerm_zero_ball ((Z5_0_3Half_sound 1) ((1,4) : PairSlot))) (entropyTerm_zero_ball ((Z5_0_3Half_sound 1) ((1,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z5_0_3Half_sound 1) ((2,0) : PairSlot))) (entropyTerm_zero_ball ((Z5_0_3Half_sound 1) ((2,1) : PairSlot))) (entropyTerm_zero_ball ((Z5_0_3Half_sound 1) ((2,2) : PairSlot))) (entropyTerm_zero_ball ((Z5_0_3Half_sound 1) ((2,3) : PairSlot))) (entropyTerm_zero_ball ((Z5_0_3Half_sound 1) ((2,4) : PairSlot))) (entropyTerm_zero_ball ((Z5_0_3Half_sound 1) ((2,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z5_0_3Half_sound 1) ((3,0) : PairSlot))) (entropyTerm_zero_ball ((Z5_0_3Half_sound 1) ((3,1) : PairSlot))) (entropyTerm_zero_ball ((Z5_0_3Half_sound 1) ((3,2) : PairSlot))) (entropyTerm_zero_ball ((Z5_0_3Half_sound 1) ((3,3) : PairSlot))) (entropyTerm_zero_ball ((Z5_0_3Half_sound 1) ((3,4) : PairSlot))) (entropyTerm_zero_ball ((Z5_0_3Half_sound 1) ((3,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z5_0_3Half_sound 1) ((4,0) : PairSlot))) (entropyTerm_zero_ball ((Z5_0_3Half_sound 1) ((4,1) : PairSlot))) (entropyTerm_zero_ball ((Z5_0_3Half_sound 1) ((4,2) : PairSlot))) (entropyTerm_zero_ball ((Z5_0_3Half_sound 1) ((4,3) : PairSlot))) (entropyTerm_zero_ball ((Z5_0_3Half_sound 1) ((4,4) : PairSlot))) (entropyTerm_zero_ball ((Z5_0_3Half_sound 1) ((4,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z5_0_3Half_sound 1) ((5,0) : PairSlot))) (entropyTerm_zero_ball ((Z5_0_3Half_sound 1) ((5,1) : PairSlot))) (entropyTerm_zero_ball ((Z5_0_3Half_sound 1) ((5,2) : PairSlot))) (entropyTerm_zero_ball ((Z5_0_3Half_sound 1) ((5,3) : PairSlot))) (entropyTerm_zero_ball ((Z5_0_3Half_sound 1) ((5,4) : PairSlot))) (entropyTerm_zero_ball ((Z5_0_3Half_sound 1) ((5,5) : PairSlot))) +def Z5_0_3H1Entropy : Ball := ⟨0, 0⟩ +lemma Z5_0_3H1Entropy_sound : Z5_0_3H1Entropy.Encloses (Foundation.finiteEntropy Z5_0_3H1Value) := by + exact contains_sound (entropyPair_enclosed Z5_0_3H1Value Z5_0_3H1Terms Z5_0_3H1Terms_sound) (by decide +kernel) +def Z5_0_3H1Mass : Ball := ⟨1, 0⟩ +lemma Z5_0_3H1Mass_sound : Z5_0_3H1Mass.Encloses (∑ a, Z5_0_3H1Value a) := by + exact contains_sound (pairSumBall_sound (Z5_0_3Half 1) Z5_0_3H1Value (Z5_0_3Half_sound 1)) (by decide +kernel) +def Z5_0_3H1MassTermLog : Ball := .exact 0 +lemma Z5_0_3H1MassTermLog_sound : Z5_0_3H1MassTermLog.Encloses (Real.log ((∑ a, Z5_0_3H1Value a))) := by + exact log_exact_one_ball (Z5_0_3H1Mass_sound) +def Z5_0_3H1MassTerm : Ball := ⟨0, 0⟩ +lemma Z5_0_3H1MassTerm_sound : Z5_0_3H1MassTerm.Encloses (Foundation.entropyTerm ((∑ a, Z5_0_3H1Value a))) := by + exact contains_sound (entropyTerm_ball (Z5_0_3H1Mass_sound) Z5_0_3H1MassTermLog_sound) (by decide +kernel) +def Z5_0_3H1H : Ball := ⟨0, 0⟩ +lemma Z5_0_3H1H_sound : Z5_0_3H1H.Encloses (homogeneousEntropy Z5_0_3H1Value) := by + exact contains_sound (homogeneous_enclosed Z5_0_3H1Value Z5_0_3H1MassTerm_sound Z5_0_3H1Entropy_sound) (by decide +kernel) +def Z5_0_3H2Value (a : PairSlot) : ℝ := (halfLaw (shape 5 0 3) 2 a : ℝ) +def Z5_0_3H2E_4_0LogWitness : LogWitness := ⟨-6, 2208598281054095678468725843991, 1562500000000000000000000000000⟩ +def Z5_0_3H2E_4_0Log : Ball := ⟨(-381281213365411604359879013926363 / 100000000000000000000000000000000), (148230766007 / 100000000000000000000000000000000)⟩ +lemma Z5_0_3H2E_4_0Log_sound : Z5_0_3H2E_4_0Log.Encloses (Real.log (Z5_0_3H2Value ((4,0) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound ((Z5_0_3Half_sound 2) ((4,0) : PairSlot)) (w := Z5_0_3H2E_4_0LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z5_0_3H2E_4_0 : Ball := ⟨(8420970324370679601710618565453 / 100000000000000000000000000000000), (327382217 / 10000000000000000000000000000000)⟩ +lemma Z5_0_3H2E_4_0_sound : Z5_0_3H2E_4_0.Encloses (Foundation.entropyTerm (Z5_0_3H2Value ((4,0) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z5_0_3Half_sound 2) ((4,0) : PairSlot)) Z5_0_3H2E_4_0Log_sound) (by decide +kernel) +def Z5_0_3H2E_2_1LogWitness : LogWitness := ⟨-2, 42968103111757469343913723803283, 25000000000000000000000000000000⟩ +def Z5_0_3H2E_2_1Log : Ball := ⟨(-42235606682705802179939545154249 / 50000000000000000000000000000000), (63527471249 / 100000000000000000000000000000000)⟩ +lemma Z5_0_3H2E_2_1Log_sound : Z5_0_3H2E_2_1Log.Encloses (Real.log (Z5_0_3H2Value ((2,1) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound ((Z5_0_3Half_sound 2) ((2,1) : PairSlot)) (w := Z5_0_3H2E_2_1LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z5_0_3H2E_2_1 : Ball := ⟨(36295678058602714916587164090917 / 100000000000000000000000000000000), (1706034339 / 6250000000000000000000000000000)⟩ +lemma Z5_0_3H2E_2_1_sound : Z5_0_3H2E_2_1.Encloses (Foundation.entropyTerm (Z5_0_3H2Value ((2,1) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z5_0_3Half_sound 2) ((2,1) : PairSlot)) Z5_0_3H2E_2_1Log_sound) (by decide +kernel) +def Z5_0_3H2E_3_1LogWitness : LogWitness := ⟨-5, 2411649303594217488808775176363, 1562500000000000000000000000000⟩ +def Z5_0_3H2E_3_1Log : Ball := ⟨(-303171213365411604359879033021803 / 100000000000000000000000000000000), (127054942201 / 100000000000000000000000000000000)⟩ +lemma Z5_0_3H2E_3_1Log_sound : Z5_0_3H2E_3_1Log.Encloses (Real.log (Z5_0_3H2Value ((3,1) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound ((Z5_0_3Half_sound 2) ((3,1) : PairSlot)) (w := Z5_0_3H2E_3_1LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z5_0_3H2E_3_1 : Ball := ⟨(7311426455825088170477182923379 / 50000000000000000000000000000000), (3064119637 / 50000000000000000000000000000000)⟩ +lemma Z5_0_3H2E_3_1_sound : Z5_0_3H2E_3_1.Encloses (Foundation.entropyTerm (Z5_0_3H2Value ((3,1) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z5_0_3Half_sound 2) ((3,1) : PairSlot)) Z5_0_3H2E_3_1Log_sound) (by decide +kernel) +def Z5_0_3H2E_1_2LogWitness : LogWitness := ⟨-2, 42968103111757469343913723803283, 25000000000000000000000000000000⟩ +def Z5_0_3H2E_1_2Log : Ball := ⟨(-42235606682705802179939545154249 / 50000000000000000000000000000000), (63527471249 / 100000000000000000000000000000000)⟩ +lemma Z5_0_3H2E_1_2Log_sound : Z5_0_3H2E_1_2Log.Encloses (Real.log (Z5_0_3H2Value ((1,2) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound ((Z5_0_3Half_sound 2) ((1,2) : PairSlot)) (w := Z5_0_3H2E_1_2LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z5_0_3H2E_1_2 : Ball := ⟨(36295678058602714916587164090917 / 100000000000000000000000000000000), (1706034339 / 6250000000000000000000000000000)⟩ +lemma Z5_0_3H2E_1_2_sound : Z5_0_3H2E_1_2.Encloses (Foundation.entropyTerm (Z5_0_3H2Value ((1,2) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z5_0_3Half_sound 2) ((1,2) : PairSlot)) Z5_0_3H2E_1_2Log_sound) (by decide +kernel) +def Z5_0_3H2E_1_3LogWitness : LogWitness := ⟨-5, 2411649303594217488808775176363, 1562500000000000000000000000000⟩ +def Z5_0_3H2E_1_3Log : Ball := ⟨(-303171213365411604359879033021803 / 100000000000000000000000000000000), (127054942201 / 100000000000000000000000000000000)⟩ +lemma Z5_0_3H2E_1_3Log_sound : Z5_0_3H2E_1_3Log.Encloses (Real.log (Z5_0_3H2Value ((1,3) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound ((Z5_0_3Half_sound 2) ((1,3) : PairSlot)) (w := Z5_0_3H2E_1_3LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z5_0_3H2E_1_3 : Ball := ⟨(7311426455825088170477182923379 / 50000000000000000000000000000000), (3064119637 / 50000000000000000000000000000000)⟩ +lemma Z5_0_3H2E_1_3_sound : Z5_0_3H2E_1_3.Encloses (Foundation.entropyTerm (Z5_0_3H2Value ((1,3) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z5_0_3Half_sound 2) ((1,3) : PairSlot)) Z5_0_3H2E_1_3Log_sound) (by decide +kernel) +def Z5_0_3H2E_0_4LogWitness : LogWitness := ⟨-6, 2208598281054095678468725843991, 1562500000000000000000000000000⟩ +def Z5_0_3H2E_0_4Log : Ball := ⟨(-381281213365411604359879013926363 / 100000000000000000000000000000000), (148230766007 / 100000000000000000000000000000000)⟩ +lemma Z5_0_3H2E_0_4Log_sound : Z5_0_3H2E_0_4Log.Encloses (Real.log (Z5_0_3H2Value ((0,4) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound ((Z5_0_3Half_sound 2) ((0,4) : PairSlot)) (w := Z5_0_3H2E_0_4LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z5_0_3H2E_0_4 : Ball := ⟨(8420970324370679601710618565453 / 100000000000000000000000000000000), (327382217 / 10000000000000000000000000000000)⟩ +lemma Z5_0_3H2E_0_4_sound : Z5_0_3H2E_0_4.Encloses (Foundation.entropyTerm (Z5_0_3H2Value ((0,4) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z5_0_3Half_sound 2) ((0,4) : PairSlot)) Z5_0_3H2E_0_4Log_sound) (by decide +kernel) +def Z5_0_3H2Terms (a : PairSlot) : Ball := + match a.1.val, a.2.val with + | 4, 0 => ⟨(8420970324370679601710618565453 / 100000000000000000000000000000000), (327382217 / 10000000000000000000000000000000)⟩ + | 2, 1 => ⟨(36295678058602714916587164090917 / 100000000000000000000000000000000), (1706034339 / 6250000000000000000000000000000)⟩ + | 3, 1 => ⟨(7311426455825088170477182923379 / 50000000000000000000000000000000), (3064119637 / 50000000000000000000000000000000)⟩ + | 1, 2 => ⟨(36295678058602714916587164090917 / 100000000000000000000000000000000), (1706034339 / 6250000000000000000000000000000)⟩ + | 1, 3 => ⟨(7311426455825088170477182923379 / 50000000000000000000000000000000), (3064119637 / 50000000000000000000000000000000)⟩ + | 0, 4 => ⟨(8420970324370679601710618565453 / 100000000000000000000000000000000), (327382217 / 10000000000000000000000000000000)⟩ + | _, _ => (.exact 0) +lemma Z5_0_3H2Terms_sound (a : PairSlot) : + (Z5_0_3H2Terms a).Encloses (Foundation.entropyTerm (Z5_0_3H2Value a)) := by + rcases a with ⟨i,j⟩ + revert j i + apply forall_fin6 + · exact forall_fin6 (entropyTerm_zero_ball ((Z5_0_3Half_sound 2) ((0,0) : PairSlot))) (entropyTerm_zero_ball ((Z5_0_3Half_sound 2) ((0,1) : PairSlot))) (entropyTerm_zero_ball ((Z5_0_3Half_sound 2) ((0,2) : PairSlot))) (entropyTerm_zero_ball ((Z5_0_3Half_sound 2) ((0,3) : PairSlot))) Z5_0_3H2E_0_4_sound (entropyTerm_zero_ball ((Z5_0_3Half_sound 2) ((0,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z5_0_3Half_sound 2) ((1,0) : PairSlot))) (entropyTerm_zero_ball ((Z5_0_3Half_sound 2) ((1,1) : PairSlot))) Z5_0_3H2E_1_2_sound Z5_0_3H2E_1_3_sound (entropyTerm_zero_ball ((Z5_0_3Half_sound 2) ((1,4) : PairSlot))) (entropyTerm_zero_ball ((Z5_0_3Half_sound 2) ((1,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z5_0_3Half_sound 2) ((2,0) : PairSlot))) Z5_0_3H2E_2_1_sound (entropyTerm_zero_ball ((Z5_0_3Half_sound 2) ((2,2) : PairSlot))) (entropyTerm_zero_ball ((Z5_0_3Half_sound 2) ((2,3) : PairSlot))) (entropyTerm_zero_ball ((Z5_0_3Half_sound 2) ((2,4) : PairSlot))) (entropyTerm_zero_ball ((Z5_0_3Half_sound 2) ((2,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z5_0_3Half_sound 2) ((3,0) : PairSlot))) Z5_0_3H2E_3_1_sound (entropyTerm_zero_ball ((Z5_0_3Half_sound 2) ((3,2) : PairSlot))) (entropyTerm_zero_ball ((Z5_0_3Half_sound 2) ((3,3) : PairSlot))) (entropyTerm_zero_ball ((Z5_0_3Half_sound 2) ((3,4) : PairSlot))) (entropyTerm_zero_ball ((Z5_0_3Half_sound 2) ((3,5) : PairSlot))) + · exact forall_fin6 Z5_0_3H2E_4_0_sound (entropyTerm_zero_ball ((Z5_0_3Half_sound 2) ((4,1) : PairSlot))) (entropyTerm_zero_ball ((Z5_0_3Half_sound 2) ((4,2) : PairSlot))) (entropyTerm_zero_ball ((Z5_0_3Half_sound 2) ((4,3) : PairSlot))) (entropyTerm_zero_ball ((Z5_0_3Half_sound 2) ((4,4) : PairSlot))) (entropyTerm_zero_ball ((Z5_0_3Half_sound 2) ((4,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z5_0_3Half_sound 2) ((5,0) : PairSlot))) (entropyTerm_zero_ball ((Z5_0_3Half_sound 2) ((5,1) : PairSlot))) (entropyTerm_zero_ball ((Z5_0_3Half_sound 2) ((5,2) : PairSlot))) (entropyTerm_zero_ball ((Z5_0_3Half_sound 2) ((5,3) : PairSlot))) (entropyTerm_zero_ball ((Z5_0_3Half_sound 2) ((5,4) : PairSlot))) (entropyTerm_zero_ball ((Z5_0_3Half_sound 2) ((5,5) : PairSlot))) +def Z5_0_3H2Entropy : Ball := ⟨(7417437661827946357406518562891 / 6250000000000000000000000000000), (9174652717 / 12500000000000000000000000000000)⟩ +lemma Z5_0_3H2Entropy_sound : Z5_0_3H2Entropy.Encloses (Foundation.finiteEntropy Z5_0_3H2Value) := by + exact contains_sound (entropyPair_enclosed Z5_0_3H2Value Z5_0_3H2Terms Z5_0_3H2Terms_sound) (by decide +kernel) +def Z5_0_3H2Mass : Ball := ⟨1, (3 / 1562500000000000000000000000000)⟩ +lemma Z5_0_3H2Mass_sound : Z5_0_3H2Mass.Encloses (∑ a, Z5_0_3H2Value a) := by + exact contains_sound (pairSumBall_sound (Z5_0_3Half 2) Z5_0_3H2Value (Z5_0_3Half_sound 2)) (by decide +kernel) +def Z5_0_3H2MassTermLogWitness : LogWitness := ⟨0, 1, 1⟩ +def Z5_0_3H2MassTermLog : Ball := ⟨0, (10587911937 / 50000000000000000000000000000000)⟩ +lemma Z5_0_3H2MassTermLog_sound : Z5_0_3H2MassTermLog.Encloses (Real.log ((∑ a, Z5_0_3H2Value a))) := by + exact checkLog_sound logTwoBall_sound (Z5_0_3H2Mass_sound) (w := Z5_0_3H2MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z5_0_3H2MassTerm : Ball := ⟨0, (169406591 / 800000000000000000000000000000)⟩ +lemma Z5_0_3H2MassTerm_sound : Z5_0_3H2MassTerm.Encloses (Foundation.entropyTerm ((∑ a, Z5_0_3H2Value a))) := by + exact contains_sound (entropyTerm_ball (Z5_0_3H2Mass_sound) Z5_0_3H2MassTermLog_sound) (by decide +kernel) +def Z5_0_3H2H : Ball := ⟨(7417437661827946357406518562891 / 6250000000000000000000000000000), (94573045611 / 100000000000000000000000000000000)⟩ +lemma Z5_0_3H2H_sound : Z5_0_3H2H.Encloses (homogeneousEntropy Z5_0_3H2Value) := by + exact contains_sound (homogeneous_enclosed Z5_0_3H2Value Z5_0_3H2MassTerm_sound Z5_0_3H2Entropy_sound) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/Certificates/Four5_3_0.lean b/lean/OAI/LinearAlgebra/MatrixFields/Certificates/Four5_3_0.lean new file mode 100644 index 0000000000000000000000000000000000000000..694a822140c99d20d90f7abd58464d1106c68f87 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/Certificates/Four5_3_0.lean @@ -0,0 +1,604 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Certificates.Four0_3_5 + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def Z5_3_0Raw (ij : PairSlot) : Ball := + match ij.1.val, ij.2.val with + | 0, 0 => w195 + | 0, 1 => w195 + | 0, 2 => w195 + | 0, 3 => w195 + | 0, 4 => w195 + | 0, 5 => w195 + | 1, 0 => w195 + | 1, 1 => w195 + | 1, 2 => w195 + | 1, 3 => w195 + | 1, 4 => w195 + | 1, 5 => w159 + | 2, 0 => w195 + | 2, 1 => w195 + | 2, 2 => w195 + | 2, 3 => w195 + | 2, 4 => w210 + | 2, 5 => w195 + | 3, 0 => w195 + | 3, 1 => w195 + | 3, 2 => w195 + | 3, 3 => w195 + | 3, 4 => w195 + | 3, 5 => w195 + | 4, 0 => w195 + | 4, 1 => w195 + | 4, 2 => w210 + | 4, 3 => w195 + | 4, 4 => w195 + | 4, 5 => w195 + | 5, 0 => w195 + | 5, 1 => w159 + | 5, 2 => w195 + | 5, 3 => w195 + | 5, 4 => w195 + | 5, 5 => w195 + | _, _ => (.exact 0) +lemma Z5_3_0Raw_sound_0 (j : Fin 6) : + (Z5_3_0Raw (0,j)).Encloses (weight (orderedPairInteger (shape 5 3 0) 0 j) : ℝ) := by + fin_cases j + · change (Z5_3_0Raw (0,0)).Encloses (weight (orderedPairInteger (shape 5 3 0) 0 0) : ℝ) + have he : orderedPairInteger (shape 5 3 0) 0 0 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z5_3_0Raw (0,1)).Encloses (weight (orderedPairInteger (shape 5 3 0) 0 1) : ℝ) + have he : orderedPairInteger (shape 5 3 0) 0 1 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z5_3_0Raw (0,2)).Encloses (weight (orderedPairInteger (shape 5 3 0) 0 2) : ℝ) + have he : orderedPairInteger (shape 5 3 0) 0 2 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z5_3_0Raw (0,3)).Encloses (weight (orderedPairInteger (shape 5 3 0) 0 3) : ℝ) + have he : orderedPairInteger (shape 5 3 0) 0 3 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z5_3_0Raw (0,4)).Encloses (weight (orderedPairInteger (shape 5 3 0) 0 4) : ℝ) + have he : orderedPairInteger (shape 5 3 0) 0 4 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z5_3_0Raw (0,5)).Encloses (weight (orderedPairInteger (shape 5 3 0) 0 5) : ℝ) + have he : orderedPairInteger (shape 5 3 0) 0 5 = (0) := by decide +kernel + rw [he] + exact w195_sound +lemma Z5_3_0Raw_sound_1 (j : Fin 6) : + (Z5_3_0Raw (1,j)).Encloses (weight (orderedPairInteger (shape 5 3 0) 1 j) : ℝ) := by + fin_cases j + · change (Z5_3_0Raw (1,0)).Encloses (weight (orderedPairInteger (shape 5 3 0) 1 0) : ℝ) + have he : orderedPairInteger (shape 5 3 0) 1 0 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z5_3_0Raw (1,1)).Encloses (weight (orderedPairInteger (shape 5 3 0) 1 1) : ℝ) + have he : orderedPairInteger (shape 5 3 0) 1 1 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z5_3_0Raw (1,2)).Encloses (weight (orderedPairInteger (shape 5 3 0) 1 2) : ℝ) + have he : orderedPairInteger (shape 5 3 0) 1 2 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z5_3_0Raw (1,3)).Encloses (weight (orderedPairInteger (shape 5 3 0) 1 3) : ℝ) + have he : orderedPairInteger (shape 5 3 0) 1 3 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z5_3_0Raw (1,4)).Encloses (weight (orderedPairInteger (shape 5 3 0) 1 4) : ℝ) + have he : orderedPairInteger (shape 5 3 0) 1 4 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z5_3_0Raw (1,5)).Encloses (weight (orderedPairInteger (shape 5 3 0) 1 5) : ℝ) + have he : orderedPairInteger (shape 5 3 0) 1 5 = (-6053) := by decide +kernel + rw [he] + exact w159_sound +lemma Z5_3_0Raw_sound_2 (j : Fin 6) : + (Z5_3_0Raw (2,j)).Encloses (weight (orderedPairInteger (shape 5 3 0) 2 j) : ℝ) := by + fin_cases j + · change (Z5_3_0Raw (2,0)).Encloses (weight (orderedPairInteger (shape 5 3 0) 2 0) : ℝ) + have he : orderedPairInteger (shape 5 3 0) 2 0 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z5_3_0Raw (2,1)).Encloses (weight (orderedPairInteger (shape 5 3 0) 2 1) : ℝ) + have he : orderedPairInteger (shape 5 3 0) 2 1 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z5_3_0Raw (2,2)).Encloses (weight (orderedPairInteger (shape 5 3 0) 2 2) : ℝ) + have he : orderedPairInteger (shape 5 3 0) 2 2 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z5_3_0Raw (2,3)).Encloses (weight (orderedPairInteger (shape 5 3 0) 2 3) : ℝ) + have he : orderedPairInteger (shape 5 3 0) 2 3 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z5_3_0Raw (2,4)).Encloses (weight (orderedPairInteger (shape 5 3 0) 2 4) : ℝ) + have he : orderedPairInteger (shape 5 3 0) 2 4 = (23786) := by decide +kernel + rw [he] + exact w210_sound + · change (Z5_3_0Raw (2,5)).Encloses (weight (orderedPairInteger (shape 5 3 0) 2 5) : ℝ) + have he : orderedPairInteger (shape 5 3 0) 2 5 = (0) := by decide +kernel + rw [he] + exact w195_sound +lemma Z5_3_0Raw_sound_3 (j : Fin 6) : + (Z5_3_0Raw (3,j)).Encloses (weight (orderedPairInteger (shape 5 3 0) 3 j) : ℝ) := by + fin_cases j + · change (Z5_3_0Raw (3,0)).Encloses (weight (orderedPairInteger (shape 5 3 0) 3 0) : ℝ) + have he : orderedPairInteger (shape 5 3 0) 3 0 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z5_3_0Raw (3,1)).Encloses (weight (orderedPairInteger (shape 5 3 0) 3 1) : ℝ) + have he : orderedPairInteger (shape 5 3 0) 3 1 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z5_3_0Raw (3,2)).Encloses (weight (orderedPairInteger (shape 5 3 0) 3 2) : ℝ) + have he : orderedPairInteger (shape 5 3 0) 3 2 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z5_3_0Raw (3,3)).Encloses (weight (orderedPairInteger (shape 5 3 0) 3 3) : ℝ) + have he : orderedPairInteger (shape 5 3 0) 3 3 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z5_3_0Raw (3,4)).Encloses (weight (orderedPairInteger (shape 5 3 0) 3 4) : ℝ) + have he : orderedPairInteger (shape 5 3 0) 3 4 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z5_3_0Raw (3,5)).Encloses (weight (orderedPairInteger (shape 5 3 0) 3 5) : ℝ) + have he : orderedPairInteger (shape 5 3 0) 3 5 = (0) := by decide +kernel + rw [he] + exact w195_sound +lemma Z5_3_0Raw_sound_4 (j : Fin 6) : + (Z5_3_0Raw (4,j)).Encloses (weight (orderedPairInteger (shape 5 3 0) 4 j) : ℝ) := by + fin_cases j + · change (Z5_3_0Raw (4,0)).Encloses (weight (orderedPairInteger (shape 5 3 0) 4 0) : ℝ) + have he : orderedPairInteger (shape 5 3 0) 4 0 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z5_3_0Raw (4,1)).Encloses (weight (orderedPairInteger (shape 5 3 0) 4 1) : ℝ) + have he : orderedPairInteger (shape 5 3 0) 4 1 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z5_3_0Raw (4,2)).Encloses (weight (orderedPairInteger (shape 5 3 0) 4 2) : ℝ) + have he : orderedPairInteger (shape 5 3 0) 4 2 = (23786) := by decide +kernel + rw [he] + exact w210_sound + · change (Z5_3_0Raw (4,3)).Encloses (weight (orderedPairInteger (shape 5 3 0) 4 3) : ℝ) + have he : orderedPairInteger (shape 5 3 0) 4 3 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z5_3_0Raw (4,4)).Encloses (weight (orderedPairInteger (shape 5 3 0) 4 4) : ℝ) + have he : orderedPairInteger (shape 5 3 0) 4 4 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z5_3_0Raw (4,5)).Encloses (weight (orderedPairInteger (shape 5 3 0) 4 5) : ℝ) + have he : orderedPairInteger (shape 5 3 0) 4 5 = (0) := by decide +kernel + rw [he] + exact w195_sound +lemma Z5_3_0Raw_sound_5 (j : Fin 6) : + (Z5_3_0Raw (5,j)).Encloses (weight (orderedPairInteger (shape 5 3 0) 5 j) : ℝ) := by + fin_cases j + · change (Z5_3_0Raw (5,0)).Encloses (weight (orderedPairInteger (shape 5 3 0) 5 0) : ℝ) + have he : orderedPairInteger (shape 5 3 0) 5 0 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z5_3_0Raw (5,1)).Encloses (weight (orderedPairInteger (shape 5 3 0) 5 1) : ℝ) + have he : orderedPairInteger (shape 5 3 0) 5 1 = (-6053) := by decide +kernel + rw [he] + exact w159_sound + · change (Z5_3_0Raw (5,2)).Encloses (weight (orderedPairInteger (shape 5 3 0) 5 2) : ℝ) + have he : orderedPairInteger (shape 5 3 0) 5 2 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z5_3_0Raw (5,3)).Encloses (weight (orderedPairInteger (shape 5 3 0) 5 3) : ℝ) + have he : orderedPairInteger (shape 5 3 0) 5 3 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z5_3_0Raw (5,4)).Encloses (weight (orderedPairInteger (shape 5 3 0) 5 4) : ℝ) + have he : orderedPairInteger (shape 5 3 0) 5 4 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z5_3_0Raw (5,5)).Encloses (weight (orderedPairInteger (shape 5 3 0) 5 5) : ℝ) + have he : orderedPairInteger (shape 5 3 0) 5 5 = (0) := by decide +kernel + rw [he] + exact w195_sound +lemma Z5_3_0Raw_sound (ij : PairSlot) : + (Z5_3_0Raw ij).Encloses (weight (orderedPairInteger (shape 5 3 0) ij.1 ij.2) : ℝ) := by + rcases ij with ⟨i,j⟩ + revert i + exact forall_fin6 (Z5_3_0Raw_sound_0 j) (Z5_3_0Raw_sound_1 j) (Z5_3_0Raw_sound_2 j) (Z5_3_0Raw_sound_3 j) (Z5_3_0Raw_sound_4 j) (Z5_3_0Raw_sound_5 j) +def Z5_3_0Den : Ball := ⟨(61678486063347289235346358275403 / 2500000000000000000000000000000), (587 / 25000000000000000000000000000000)⟩ +lemma Z5_3_0Den_sound : Z5_3_0Den.Encloses + (((orderedPairs (shape 5 3 0)).map (fun ij => weight (orderedPairInteger (shape 5 3 0) ij.1 ij.2))).sum : ℝ) := by + exact contains_sound (list_cast_enclosed (orderedPairs (shape 5 3 0)) Z5_3_0Raw + (fun ij => weight (orderedPairInteger (shape 5 3 0) ij.1 ij.2)) + (fun ij _ => Z5_3_0Raw_sound ij)) (by decide +kernel) +lemma Z5_3_0Den_pos : 0 < Z5_3_0Den.lower := by decide +kernel +def Z5_3_0Probs (ij : PairSlot) : Ball := + match ij.1.val, ij.2.val with + | 1, 5 => ⟨(2212727093860282562448201536591 / 100000000000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ + | 2, 4 => ⟨(43733995727072191717374739083017 / 100000000000000000000000000000000), (87 / 100000000000000000000000000000000)⟩ + | 3, 4 => ⟨(506659647383440715022132422549 / 12500000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ + | 4, 2 => ⟨(43733995727072191717374739083017 / 100000000000000000000000000000000), (87 / 100000000000000000000000000000000)⟩ + | 4, 3 => ⟨(506659647383440715022132422549 / 12500000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ + | 5, 1 => ⟨(2212727093860282562448201536591 / 100000000000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ + | _, _ => (.exact 0) +lemma Z5_3_0Contains : ∀ i j : Fin 6, + statisticWeight i + statisticWeight j = shapeMax (shape 5 3 0) → + contains (.mul (Z5_3_0Raw (i,j)) (.inv Z5_3_0Den)) (Z5_3_0Probs (i,j)) = true := by + decide +kernel +lemma Z5_3_0Zero : ∀ i j : Fin 6, + statisticWeight i + statisticWeight j ≠ shapeMax (shape 5 3 0) → Z5_3_0Probs (i,j) = .exact 0 := by + decide +kernel +lemma Z5_3_0Probs_sound (ij : PairSlot) : + (Z5_3_0Probs ij).Encloses (zeroPairLaw (shape 5 3 0) ij.1 ij.2 : ℝ) := by + by_cases h : statisticWeight ij.1 + statisticWeight ij.2 = shapeMax (shape 5 3 0) + · have hb := contains_sound (Ball.mul_sound (Z5_3_0Raw_sound ij) + (Ball.inv_sound Z5_3_0Den_sound Z5_3_0Den_pos)) (Z5_3_0Contains ij.1 ij.2 h) + simpa only [zeroPairLaw, h, ite_true, Rat.cast_div, Rat.cast_mul, + Rat.cast_inv, div_eq_mul_inv] using hb + · rw [Z5_3_0Zero ij.1 ij.2 h] + simpa only [zeroPairLaw, h, ite_false] using Ball.exact_sound 0 + +def Z5_3_0Half (w : Fin 3) (ij : PairSlot) : Ball := + if (shape 5 3 0) w = 0 then if ij = (0,0) then .exact 1 else .exact 0 + else if w = halfMaxAxis (shape 5 3 0) then Z5_3_0Probs ij + else Z5_3_0Probs (kappa ij.1, kappa ij.2) +lemma Z5_3_0Half_sound (w : Fin 3) (ij : PairSlot) : + (Z5_3_0Half w ij).Encloses (halfLaw (shape 5 3 0) w ij : ℝ) := by + have hp : positive (shape 5 3 0) = false := by decide +kernel + simp only [Z5_3_0Half, halfLaw, hp, Bool.false_eq_true, ite_false] + split_ifs + · exact Ball.exact_sound 1 + · exact Ball.exact_sound 0 + · exact Z5_3_0Probs_sound _ + · exact Z5_3_0Probs_sound _ + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def Z5_3_0Value (a : PairSlot) : ℝ := (zeroPairLaw (shape 5 3 0) a.1 a.2 : ℝ) +def Z5_3_0E_1_5LogWitness : LogWitness := ⟨-6, 2212727093860282562448201536591, 1562500000000000000000000000000⟩ +def Z5_3_0E_1_5Log : Ball := ⟨(-190547222603130891450597651942923 / 50000000000000000000000000000000), (37057691513 / 25000000000000000000000000000000)⟩ +lemma Z5_3_0E_1_5Log_sound : Z5_3_0E_1_5Log.Encloses (Real.log (Z5_3_0Value ((1,5) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound (Z5_3_0Probs_sound ((1,5) : PairSlot)) (w := Z5_3_0E_1_5LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z5_3_0E_1_5 : Ball := ⟨(2108145010568870815331944029893 / 25000000000000000000000000000000), (1639971173 / 50000000000000000000000000000000)⟩ +lemma Z5_3_0E_1_5_sound : Z5_3_0E_1_5.Encloses (Foundation.entropyTerm (Z5_3_0Value ((1,5) : PairSlot))) := by + exact contains_sound (entropyTerm_ball (Z5_3_0Probs_sound ((1,5) : PairSlot)) Z5_3_0E_1_5Log_sound) (by decide +kernel) +def Z5_3_0E_2_4LogWitness : LogWitness := ⟨-2, 43733995727072191717374739083017, 25000000000000000000000000000000⟩ +def Z5_3_0E_2_4Log : Ball := ⟨(-1033805565078272286264942253359 / 1250000000000000000000000000000), (3970466953 / 6250000000000000000000000000000)⟩ +lemma Z5_3_0E_2_4Log_sound : Z5_3_0E_2_4Log.Encloses (Real.log (Z5_3_0Value ((2,4) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound (Z5_3_0Probs_sound ((2,4) : PairSlot)) (w := Z5_3_0E_2_4LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z5_3_0E_2_4 : Ball := ⟨(7233991706521058045956490938163 / 20000000000000000000000000000000), (13891550817 / 50000000000000000000000000000000)⟩ +lemma Z5_3_0E_2_4_sound : Z5_3_0E_2_4.Encloses (Foundation.entropyTerm (Z5_3_0Value ((2,4) : PairSlot))) := by + exact contains_sound (entropyTerm_ball (Z5_3_0Probs_sound ((2,4) : PairSlot)) Z5_3_0E_2_4Log_sound) (by decide +kernel) +def Z5_3_0E_3_4LogWitness : LogWitness := ⟨-5, 506659647383440715022132422549, 390625000000000000000000000000⟩ +def Z5_3_0E_3_4Log : Ball := ⟨(-160282222603130891450597661490659 / 50000000000000000000000000000000), (31763735549 / 25000000000000000000000000000000)⟩ +lemma Z5_3_0E_3_4Log_sound : Z5_3_0E_3_4Log.Encloses (Real.log (Z5_3_0Value ((3,4) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound (Z5_3_0Probs_sound ((3,4) : PairSlot)) (w := Z5_3_0E_3_4LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z5_3_0E_3_4 : Ball := ⟨(2598673100349966355117959463809 / 20000000000000000000000000000000), (514988899 / 10000000000000000000000000000000)⟩ +lemma Z5_3_0E_3_4_sound : Z5_3_0E_3_4.Encloses (Foundation.entropyTerm (Z5_3_0Value ((3,4) : PairSlot))) := by + exact contains_sound (entropyTerm_ball (Z5_3_0Probs_sound ((3,4) : PairSlot)) Z5_3_0E_3_4Log_sound) (by decide +kernel) +def Z5_3_0E_4_2LogWitness : LogWitness := ⟨-2, 43733995727072191717374739083017, 25000000000000000000000000000000⟩ +def Z5_3_0E_4_2Log : Ball := ⟨(-1033805565078272286264942253359 / 1250000000000000000000000000000), (3970466953 / 6250000000000000000000000000000)⟩ +lemma Z5_3_0E_4_2Log_sound : Z5_3_0E_4_2Log.Encloses (Real.log (Z5_3_0Value ((4,2) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound (Z5_3_0Probs_sound ((4,2) : PairSlot)) (w := Z5_3_0E_4_2LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z5_3_0E_4_2 : Ball := ⟨(7233991706521058045956490938163 / 20000000000000000000000000000000), (13891550817 / 50000000000000000000000000000000)⟩ +lemma Z5_3_0E_4_2_sound : Z5_3_0E_4_2.Encloses (Foundation.entropyTerm (Z5_3_0Value ((4,2) : PairSlot))) := by + exact contains_sound (entropyTerm_ball (Z5_3_0Probs_sound ((4,2) : PairSlot)) Z5_3_0E_4_2Log_sound) (by decide +kernel) +def Z5_3_0E_4_3LogWitness : LogWitness := ⟨-5, 506659647383440715022132422549, 390625000000000000000000000000⟩ +def Z5_3_0E_4_3Log : Ball := ⟨(-160282222603130891450597661490659 / 50000000000000000000000000000000), (31763735549 / 25000000000000000000000000000000)⟩ +lemma Z5_3_0E_4_3Log_sound : Z5_3_0E_4_3Log.Encloses (Real.log (Z5_3_0Value ((4,3) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound (Z5_3_0Probs_sound ((4,3) : PairSlot)) (w := Z5_3_0E_4_3LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z5_3_0E_4_3 : Ball := ⟨(2598673100349966355117959463809 / 20000000000000000000000000000000), (514988899 / 10000000000000000000000000000000)⟩ +lemma Z5_3_0E_4_3_sound : Z5_3_0E_4_3.Encloses (Foundation.entropyTerm (Z5_3_0Value ((4,3) : PairSlot))) := by + exact contains_sound (entropyTerm_ball (Z5_3_0Probs_sound ((4,3) : PairSlot)) Z5_3_0E_4_3Log_sound) (by decide +kernel) +def Z5_3_0E_5_1LogWitness : LogWitness := ⟨-6, 2212727093860282562448201536591, 1562500000000000000000000000000⟩ +def Z5_3_0E_5_1Log : Ball := ⟨(-190547222603130891450597651942923 / 50000000000000000000000000000000), (37057691513 / 25000000000000000000000000000000)⟩ +lemma Z5_3_0E_5_1Log_sound : Z5_3_0E_5_1Log.Encloses (Real.log (Z5_3_0Value ((5,1) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound (Z5_3_0Probs_sound ((5,1) : PairSlot)) (w := Z5_3_0E_5_1LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z5_3_0E_5_1 : Ball := ⟨(2108145010568870815331944029893 / 25000000000000000000000000000000), (1639971173 / 50000000000000000000000000000000)⟩ +lemma Z5_3_0E_5_1_sound : Z5_3_0E_5_1.Encloses (Foundation.entropyTerm (Z5_3_0Value ((5,1) : PairSlot))) := by + exact contains_sound (entropyTerm_ball (Z5_3_0Probs_sound ((5,1) : PairSlot)) Z5_3_0E_5_1Log_sound) (by decide +kernel) +def Z5_3_0Terms (a : PairSlot) : Ball := + match a.1.val, a.2.val with + | 1, 5 => ⟨(2108145010568870815331944029893 / 25000000000000000000000000000000), (1639971173 / 50000000000000000000000000000000)⟩ + | 2, 4 => ⟨(7233991706521058045956490938163 / 20000000000000000000000000000000), (13891550817 / 50000000000000000000000000000000)⟩ + | 3, 4 => ⟨(2598673100349966355117959463809 / 20000000000000000000000000000000), (514988899 / 10000000000000000000000000000000)⟩ + | 4, 2 => ⟨(7233991706521058045956490938163 / 20000000000000000000000000000000), (13891550817 / 50000000000000000000000000000000)⟩ + | 4, 3 => ⟨(2598673100349966355117959463809 / 20000000000000000000000000000000), (514988899 / 10000000000000000000000000000000)⟩ + | 5, 1 => ⟨(2108145010568870815331944029893 / 25000000000000000000000000000000), (1639971173 / 50000000000000000000000000000000)⟩ + | _, _ => (.exact 0) +lemma Z5_3_0Terms_sound (a : PairSlot) : + (Z5_3_0Terms a).Encloses (Foundation.entropyTerm (Z5_3_0Value a)) := by + rcases a with ⟨i,j⟩ + revert j i + apply forall_fin6 + · exact forall_fin6 (entropyTerm_zero_ball (Z5_3_0Probs_sound ((0,0) : PairSlot))) (entropyTerm_zero_ball (Z5_3_0Probs_sound ((0,1) : PairSlot))) (entropyTerm_zero_ball (Z5_3_0Probs_sound ((0,2) : PairSlot))) (entropyTerm_zero_ball (Z5_3_0Probs_sound ((0,3) : PairSlot))) (entropyTerm_zero_ball (Z5_3_0Probs_sound ((0,4) : PairSlot))) (entropyTerm_zero_ball (Z5_3_0Probs_sound ((0,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball (Z5_3_0Probs_sound ((1,0) : PairSlot))) (entropyTerm_zero_ball (Z5_3_0Probs_sound ((1,1) : PairSlot))) (entropyTerm_zero_ball (Z5_3_0Probs_sound ((1,2) : PairSlot))) (entropyTerm_zero_ball (Z5_3_0Probs_sound ((1,3) : PairSlot))) (entropyTerm_zero_ball (Z5_3_0Probs_sound ((1,4) : PairSlot))) Z5_3_0E_1_5_sound + · exact forall_fin6 (entropyTerm_zero_ball (Z5_3_0Probs_sound ((2,0) : PairSlot))) (entropyTerm_zero_ball (Z5_3_0Probs_sound ((2,1) : PairSlot))) (entropyTerm_zero_ball (Z5_3_0Probs_sound ((2,2) : PairSlot))) (entropyTerm_zero_ball (Z5_3_0Probs_sound ((2,3) : PairSlot))) Z5_3_0E_2_4_sound (entropyTerm_zero_ball (Z5_3_0Probs_sound ((2,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball (Z5_3_0Probs_sound ((3,0) : PairSlot))) (entropyTerm_zero_ball (Z5_3_0Probs_sound ((3,1) : PairSlot))) (entropyTerm_zero_ball (Z5_3_0Probs_sound ((3,2) : PairSlot))) (entropyTerm_zero_ball (Z5_3_0Probs_sound ((3,3) : PairSlot))) Z5_3_0E_3_4_sound (entropyTerm_zero_ball (Z5_3_0Probs_sound ((3,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball (Z5_3_0Probs_sound ((4,0) : PairSlot))) (entropyTerm_zero_ball (Z5_3_0Probs_sound ((4,1) : PairSlot))) Z5_3_0E_4_2_sound Z5_3_0E_4_3_sound (entropyTerm_zero_ball (Z5_3_0Probs_sound ((4,4) : PairSlot))) (entropyTerm_zero_ball (Z5_3_0Probs_sound ((4,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball (Z5_3_0Probs_sound ((5,0) : PairSlot))) Z5_3_0E_5_1_sound (entropyTerm_zero_ball (Z5_3_0Probs_sound ((5,2) : PairSlot))) (entropyTerm_zero_ball (Z5_3_0Probs_sound ((5,3) : PairSlot))) (entropyTerm_zero_ball (Z5_3_0Probs_sound ((5,4) : PairSlot))) (entropyTerm_zero_ball (Z5_3_0Probs_sound ((5,5) : PairSlot))) +def Z5_3_0Entropy : Ball := ⟨(7199488009578825658337503516179 / 6250000000000000000000000000000), (3621293297 / 5000000000000000000000000000000)⟩ +lemma Z5_3_0Entropy_sound : Z5_3_0Entropy.Encloses (Foundation.finiteEntropy Z5_3_0Value) := by + exact contains_sound (entropyPair_enclosed Z5_3_0Value Z5_3_0Terms Z5_3_0Terms_sound) (by decide +kernel) +def Z5_3_0Labels : Ball := ⟨(64678268467290694076293789695021 / 12500000000000000000000000000000), (40127049 / 25000000000000000000000000000)⟩ +lemma Z5_3_0Labels_sound : Z5_3_0Labels.Encloses + (∑ a : PairSlot, (zeroPairLaw (shape 5 3 0) a.1 a.2 : ℝ) * + Real.log (AllFieldParameters.multiplicity a.1 * AllFieldParameters.multiplicity a.2 : ℕ)) := by + exact contains_sound (pairSumBall_sound (fun a => .mul (Z5_3_0Probs a) (multLogs a)) + _ (fun a => Ball.mul_sound (Z5_3_0Probs_sound a) (multLogs_sound a))) (by decide +kernel) +def Z5_3_0Four : Ball := ⟨(79077244486448345392968796727379 / 12500000000000000000000000000000), (11646703097 / 5000000000000000000000000000000)⟩ +lemma Z5_3_0Four_sound : Z5_3_0Four.Encloses (AllFieldZeroLeafRates.fourRate (shape 5 3 0)) := by + exact contains_sound (Ball.add_sound Z5_3_0Entropy_sound Z5_3_0Labels_sound) (by decide +kernel) +def Z5_3_0H0Value (a : PairSlot) : ℝ := (halfLaw (shape 5 3 0) 0 a : ℝ) +def Z5_3_0H0E_1_5LogWitness : LogWitness := ⟨-6, 2212727093860282562448201536591, 1562500000000000000000000000000⟩ +def Z5_3_0H0E_1_5Log : Ball := ⟨(-190547222603130891450597651942923 / 50000000000000000000000000000000), (37057691513 / 25000000000000000000000000000000)⟩ +lemma Z5_3_0H0E_1_5Log_sound : Z5_3_0H0E_1_5Log.Encloses (Real.log (Z5_3_0H0Value ((1,5) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound ((Z5_3_0Half_sound 0) ((1,5) : PairSlot)) (w := Z5_3_0H0E_1_5LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z5_3_0H0E_1_5 : Ball := ⟨(2108145010568870815331944029893 / 25000000000000000000000000000000), (1639971173 / 50000000000000000000000000000000)⟩ +lemma Z5_3_0H0E_1_5_sound : Z5_3_0H0E_1_5.Encloses (Foundation.entropyTerm (Z5_3_0H0Value ((1,5) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z5_3_0Half_sound 0) ((1,5) : PairSlot)) Z5_3_0H0E_1_5Log_sound) (by decide +kernel) +def Z5_3_0H0E_2_4LogWitness : LogWitness := ⟨-2, 43733995727072191717374739083017, 25000000000000000000000000000000⟩ +def Z5_3_0H0E_2_4Log : Ball := ⟨(-1033805565078272286264942253359 / 1250000000000000000000000000000), (3970466953 / 6250000000000000000000000000000)⟩ +lemma Z5_3_0H0E_2_4Log_sound : Z5_3_0H0E_2_4Log.Encloses (Real.log (Z5_3_0H0Value ((2,4) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound ((Z5_3_0Half_sound 0) ((2,4) : PairSlot)) (w := Z5_3_0H0E_2_4LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z5_3_0H0E_2_4 : Ball := ⟨(7233991706521058045956490938163 / 20000000000000000000000000000000), (13891550817 / 50000000000000000000000000000000)⟩ +lemma Z5_3_0H0E_2_4_sound : Z5_3_0H0E_2_4.Encloses (Foundation.entropyTerm (Z5_3_0H0Value ((2,4) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z5_3_0Half_sound 0) ((2,4) : PairSlot)) Z5_3_0H0E_2_4Log_sound) (by decide +kernel) +def Z5_3_0H0E_3_4LogWitness : LogWitness := ⟨-5, 506659647383440715022132422549, 390625000000000000000000000000⟩ +def Z5_3_0H0E_3_4Log : Ball := ⟨(-160282222603130891450597661490659 / 50000000000000000000000000000000), (31763735549 / 25000000000000000000000000000000)⟩ +lemma Z5_3_0H0E_3_4Log_sound : Z5_3_0H0E_3_4Log.Encloses (Real.log (Z5_3_0H0Value ((3,4) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound ((Z5_3_0Half_sound 0) ((3,4) : PairSlot)) (w := Z5_3_0H0E_3_4LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z5_3_0H0E_3_4 : Ball := ⟨(2598673100349966355117959463809 / 20000000000000000000000000000000), (514988899 / 10000000000000000000000000000000)⟩ +lemma Z5_3_0H0E_3_4_sound : Z5_3_0H0E_3_4.Encloses (Foundation.entropyTerm (Z5_3_0H0Value ((3,4) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z5_3_0Half_sound 0) ((3,4) : PairSlot)) Z5_3_0H0E_3_4Log_sound) (by decide +kernel) +def Z5_3_0H0E_4_2LogWitness : LogWitness := ⟨-2, 43733995727072191717374739083017, 25000000000000000000000000000000⟩ +def Z5_3_0H0E_4_2Log : Ball := ⟨(-1033805565078272286264942253359 / 1250000000000000000000000000000), (3970466953 / 6250000000000000000000000000000)⟩ +lemma Z5_3_0H0E_4_2Log_sound : Z5_3_0H0E_4_2Log.Encloses (Real.log (Z5_3_0H0Value ((4,2) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound ((Z5_3_0Half_sound 0) ((4,2) : PairSlot)) (w := Z5_3_0H0E_4_2LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z5_3_0H0E_4_2 : Ball := ⟨(7233991706521058045956490938163 / 20000000000000000000000000000000), (13891550817 / 50000000000000000000000000000000)⟩ +lemma Z5_3_0H0E_4_2_sound : Z5_3_0H0E_4_2.Encloses (Foundation.entropyTerm (Z5_3_0H0Value ((4,2) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z5_3_0Half_sound 0) ((4,2) : PairSlot)) Z5_3_0H0E_4_2Log_sound) (by decide +kernel) +def Z5_3_0H0E_4_3LogWitness : LogWitness := ⟨-5, 506659647383440715022132422549, 390625000000000000000000000000⟩ +def Z5_3_0H0E_4_3Log : Ball := ⟨(-160282222603130891450597661490659 / 50000000000000000000000000000000), (31763735549 / 25000000000000000000000000000000)⟩ +lemma Z5_3_0H0E_4_3Log_sound : Z5_3_0H0E_4_3Log.Encloses (Real.log (Z5_3_0H0Value ((4,3) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound ((Z5_3_0Half_sound 0) ((4,3) : PairSlot)) (w := Z5_3_0H0E_4_3LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z5_3_0H0E_4_3 : Ball := ⟨(2598673100349966355117959463809 / 20000000000000000000000000000000), (514988899 / 10000000000000000000000000000000)⟩ +lemma Z5_3_0H0E_4_3_sound : Z5_3_0H0E_4_3.Encloses (Foundation.entropyTerm (Z5_3_0H0Value ((4,3) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z5_3_0Half_sound 0) ((4,3) : PairSlot)) Z5_3_0H0E_4_3Log_sound) (by decide +kernel) +def Z5_3_0H0E_5_1LogWitness : LogWitness := ⟨-6, 2212727093860282562448201536591, 1562500000000000000000000000000⟩ +def Z5_3_0H0E_5_1Log : Ball := ⟨(-190547222603130891450597651942923 / 50000000000000000000000000000000), (37057691513 / 25000000000000000000000000000000)⟩ +lemma Z5_3_0H0E_5_1Log_sound : Z5_3_0H0E_5_1Log.Encloses (Real.log (Z5_3_0H0Value ((5,1) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound ((Z5_3_0Half_sound 0) ((5,1) : PairSlot)) (w := Z5_3_0H0E_5_1LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z5_3_0H0E_5_1 : Ball := ⟨(2108145010568870815331944029893 / 25000000000000000000000000000000), (1639971173 / 50000000000000000000000000000000)⟩ +lemma Z5_3_0H0E_5_1_sound : Z5_3_0H0E_5_1.Encloses (Foundation.entropyTerm (Z5_3_0H0Value ((5,1) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z5_3_0Half_sound 0) ((5,1) : PairSlot)) Z5_3_0H0E_5_1Log_sound) (by decide +kernel) +def Z5_3_0H0Terms (a : PairSlot) : Ball := + match a.1.val, a.2.val with + | 1, 5 => ⟨(2108145010568870815331944029893 / 25000000000000000000000000000000), (1639971173 / 50000000000000000000000000000000)⟩ + | 2, 4 => ⟨(7233991706521058045956490938163 / 20000000000000000000000000000000), (13891550817 / 50000000000000000000000000000000)⟩ + | 3, 4 => ⟨(2598673100349966355117959463809 / 20000000000000000000000000000000), (514988899 / 10000000000000000000000000000000)⟩ + | 4, 2 => ⟨(7233991706521058045956490938163 / 20000000000000000000000000000000), (13891550817 / 50000000000000000000000000000000)⟩ + | 4, 3 => ⟨(2598673100349966355117959463809 / 20000000000000000000000000000000), (514988899 / 10000000000000000000000000000000)⟩ + | 5, 1 => ⟨(2108145010568870815331944029893 / 25000000000000000000000000000000), (1639971173 / 50000000000000000000000000000000)⟩ + | _, _ => (.exact 0) +lemma Z5_3_0H0Terms_sound (a : PairSlot) : + (Z5_3_0H0Terms a).Encloses (Foundation.entropyTerm (Z5_3_0H0Value a)) := by + rcases a with ⟨i,j⟩ + revert j i + apply forall_fin6 + · exact forall_fin6 (entropyTerm_zero_ball ((Z5_3_0Half_sound 0) ((0,0) : PairSlot))) (entropyTerm_zero_ball ((Z5_3_0Half_sound 0) ((0,1) : PairSlot))) (entropyTerm_zero_ball ((Z5_3_0Half_sound 0) ((0,2) : PairSlot))) (entropyTerm_zero_ball ((Z5_3_0Half_sound 0) ((0,3) : PairSlot))) (entropyTerm_zero_ball ((Z5_3_0Half_sound 0) ((0,4) : PairSlot))) (entropyTerm_zero_ball ((Z5_3_0Half_sound 0) ((0,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z5_3_0Half_sound 0) ((1,0) : PairSlot))) (entropyTerm_zero_ball ((Z5_3_0Half_sound 0) ((1,1) : PairSlot))) (entropyTerm_zero_ball ((Z5_3_0Half_sound 0) ((1,2) : PairSlot))) (entropyTerm_zero_ball ((Z5_3_0Half_sound 0) ((1,3) : PairSlot))) (entropyTerm_zero_ball ((Z5_3_0Half_sound 0) ((1,4) : PairSlot))) Z5_3_0H0E_1_5_sound + · exact forall_fin6 (entropyTerm_zero_ball ((Z5_3_0Half_sound 0) ((2,0) : PairSlot))) (entropyTerm_zero_ball ((Z5_3_0Half_sound 0) ((2,1) : PairSlot))) (entropyTerm_zero_ball ((Z5_3_0Half_sound 0) ((2,2) : PairSlot))) (entropyTerm_zero_ball ((Z5_3_0Half_sound 0) ((2,3) : PairSlot))) Z5_3_0H0E_2_4_sound (entropyTerm_zero_ball ((Z5_3_0Half_sound 0) ((2,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z5_3_0Half_sound 0) ((3,0) : PairSlot))) (entropyTerm_zero_ball ((Z5_3_0Half_sound 0) ((3,1) : PairSlot))) (entropyTerm_zero_ball ((Z5_3_0Half_sound 0) ((3,2) : PairSlot))) (entropyTerm_zero_ball ((Z5_3_0Half_sound 0) ((3,3) : PairSlot))) Z5_3_0H0E_3_4_sound (entropyTerm_zero_ball ((Z5_3_0Half_sound 0) ((3,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z5_3_0Half_sound 0) ((4,0) : PairSlot))) (entropyTerm_zero_ball ((Z5_3_0Half_sound 0) ((4,1) : PairSlot))) Z5_3_0H0E_4_2_sound Z5_3_0H0E_4_3_sound (entropyTerm_zero_ball ((Z5_3_0Half_sound 0) ((4,4) : PairSlot))) (entropyTerm_zero_ball ((Z5_3_0Half_sound 0) ((4,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z5_3_0Half_sound 0) ((5,0) : PairSlot))) Z5_3_0H0E_5_1_sound (entropyTerm_zero_ball ((Z5_3_0Half_sound 0) ((5,2) : PairSlot))) (entropyTerm_zero_ball ((Z5_3_0Half_sound 0) ((5,3) : PairSlot))) (entropyTerm_zero_ball ((Z5_3_0Half_sound 0) ((5,4) : PairSlot))) (entropyTerm_zero_ball ((Z5_3_0Half_sound 0) ((5,5) : PairSlot))) +def Z5_3_0H0Entropy : Ball := ⟨(7199488009578825658337503516179 / 6250000000000000000000000000000), (3621293297 / 5000000000000000000000000000000)⟩ +lemma Z5_3_0H0Entropy_sound : Z5_3_0H0Entropy.Encloses (Foundation.finiteEntropy Z5_3_0H0Value) := by + exact contains_sound (entropyPair_enclosed Z5_3_0H0Value Z5_3_0H0Terms Z5_3_0H0Terms_sound) (by decide +kernel) +def Z5_3_0H0Mass : Ball := ⟨1, (97 / 50000000000000000000000000000000)⟩ +lemma Z5_3_0H0Mass_sound : Z5_3_0H0Mass.Encloses (∑ a, Z5_3_0H0Value a) := by + exact contains_sound (pairSumBall_sound (Z5_3_0Half 0) Z5_3_0H0Value (Z5_3_0Half_sound 0)) (by decide +kernel) +def Z5_3_0H0MassTermLogWitness : LogWitness := ⟨0, 1, 1⟩ +def Z5_3_0H0MassTermLog : Ball := ⟨0, (5293955969 / 25000000000000000000000000000000)⟩ +lemma Z5_3_0H0MassTermLog_sound : Z5_3_0H0MassTermLog.Encloses (Real.log ((∑ a, Z5_3_0H0Value a))) := by + exact checkLog_sound logTwoBall_sound (Z5_3_0H0Mass_sound) (w := Z5_3_0H0MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z5_3_0H0MassTerm : Ball := ⟨0, (21175823877 / 100000000000000000000000000000000)⟩ +lemma Z5_3_0H0MassTerm_sound : Z5_3_0H0MassTerm.Encloses (Foundation.entropyTerm ((∑ a, Z5_3_0H0Value a))) := by + exact contains_sound (entropyTerm_ball (Z5_3_0H0Mass_sound) Z5_3_0H0MassTermLog_sound) (by decide +kernel) +def Z5_3_0H0H : Ball := ⟨(7199488009578825658337503516179 / 6250000000000000000000000000000), (93601689817 / 100000000000000000000000000000000)⟩ +lemma Z5_3_0H0H_sound : Z5_3_0H0H.Encloses (homogeneousEntropy Z5_3_0H0Value) := by + exact contains_sound (homogeneous_enclosed Z5_3_0H0Value Z5_3_0H0MassTerm_sound Z5_3_0H0Entropy_sound) (by decide +kernel) +def Z5_3_0H1Value (a : PairSlot) : ℝ := (halfLaw (shape 5 3 0) 1 a : ℝ) +def Z5_3_0H1E_4_0LogWitness : LogWitness := ⟨-6, 2212727093860282562448201536591, 1562500000000000000000000000000⟩ +def Z5_3_0H1E_4_0Log : Ball := ⟨(-190547222603130891450597651942923 / 50000000000000000000000000000000), (37057691513 / 25000000000000000000000000000000)⟩ +lemma Z5_3_0H1E_4_0Log_sound : Z5_3_0H1E_4_0Log.Encloses (Real.log (Z5_3_0H1Value ((4,0) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound ((Z5_3_0Half_sound 1) ((4,0) : PairSlot)) (w := Z5_3_0H1E_4_0LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z5_3_0H1E_4_0 : Ball := ⟨(2108145010568870815331944029893 / 25000000000000000000000000000000), (1639971173 / 50000000000000000000000000000000)⟩ +lemma Z5_3_0H1E_4_0_sound : Z5_3_0H1E_4_0.Encloses (Foundation.entropyTerm (Z5_3_0H1Value ((4,0) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z5_3_0Half_sound 1) ((4,0) : PairSlot)) Z5_3_0H1E_4_0Log_sound) (by decide +kernel) +def Z5_3_0H1E_2_1LogWitness : LogWitness := ⟨-2, 43733995727072191717374739083017, 25000000000000000000000000000000⟩ +def Z5_3_0H1E_2_1Log : Ball := ⟨(-1033805565078272286264942253359 / 1250000000000000000000000000000), (3970466953 / 6250000000000000000000000000000)⟩ +lemma Z5_3_0H1E_2_1Log_sound : Z5_3_0H1E_2_1Log.Encloses (Real.log (Z5_3_0H1Value ((2,1) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound ((Z5_3_0Half_sound 1) ((2,1) : PairSlot)) (w := Z5_3_0H1E_2_1LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z5_3_0H1E_2_1 : Ball := ⟨(7233991706521058045956490938163 / 20000000000000000000000000000000), (13891550817 / 50000000000000000000000000000000)⟩ +lemma Z5_3_0H1E_2_1_sound : Z5_3_0H1E_2_1.Encloses (Foundation.entropyTerm (Z5_3_0H1Value ((2,1) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z5_3_0Half_sound 1) ((2,1) : PairSlot)) Z5_3_0H1E_2_1Log_sound) (by decide +kernel) +def Z5_3_0H1E_3_1LogWitness : LogWitness := ⟨-5, 506659647383440715022132422549, 390625000000000000000000000000⟩ +def Z5_3_0H1E_3_1Log : Ball := ⟨(-160282222603130891450597661490659 / 50000000000000000000000000000000), (31763735549 / 25000000000000000000000000000000)⟩ +lemma Z5_3_0H1E_3_1Log_sound : Z5_3_0H1E_3_1Log.Encloses (Real.log (Z5_3_0H1Value ((3,1) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound ((Z5_3_0Half_sound 1) ((3,1) : PairSlot)) (w := Z5_3_0H1E_3_1LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z5_3_0H1E_3_1 : Ball := ⟨(2598673100349966355117959463809 / 20000000000000000000000000000000), (514988899 / 10000000000000000000000000000000)⟩ +lemma Z5_3_0H1E_3_1_sound : Z5_3_0H1E_3_1.Encloses (Foundation.entropyTerm (Z5_3_0H1Value ((3,1) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z5_3_0Half_sound 1) ((3,1) : PairSlot)) Z5_3_0H1E_3_1Log_sound) (by decide +kernel) +def Z5_3_0H1E_1_2LogWitness : LogWitness := ⟨-2, 43733995727072191717374739083017, 25000000000000000000000000000000⟩ +def Z5_3_0H1E_1_2Log : Ball := ⟨(-1033805565078272286264942253359 / 1250000000000000000000000000000), (3970466953 / 6250000000000000000000000000000)⟩ +lemma Z5_3_0H1E_1_2Log_sound : Z5_3_0H1E_1_2Log.Encloses (Real.log (Z5_3_0H1Value ((1,2) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound ((Z5_3_0Half_sound 1) ((1,2) : PairSlot)) (w := Z5_3_0H1E_1_2LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z5_3_0H1E_1_2 : Ball := ⟨(7233991706521058045956490938163 / 20000000000000000000000000000000), (13891550817 / 50000000000000000000000000000000)⟩ +lemma Z5_3_0H1E_1_2_sound : Z5_3_0H1E_1_2.Encloses (Foundation.entropyTerm (Z5_3_0H1Value ((1,2) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z5_3_0Half_sound 1) ((1,2) : PairSlot)) Z5_3_0H1E_1_2Log_sound) (by decide +kernel) +def Z5_3_0H1E_1_3LogWitness : LogWitness := ⟨-5, 506659647383440715022132422549, 390625000000000000000000000000⟩ +def Z5_3_0H1E_1_3Log : Ball := ⟨(-160282222603130891450597661490659 / 50000000000000000000000000000000), (31763735549 / 25000000000000000000000000000000)⟩ +lemma Z5_3_0H1E_1_3Log_sound : Z5_3_0H1E_1_3Log.Encloses (Real.log (Z5_3_0H1Value ((1,3) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound ((Z5_3_0Half_sound 1) ((1,3) : PairSlot)) (w := Z5_3_0H1E_1_3LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z5_3_0H1E_1_3 : Ball := ⟨(2598673100349966355117959463809 / 20000000000000000000000000000000), (514988899 / 10000000000000000000000000000000)⟩ +lemma Z5_3_0H1E_1_3_sound : Z5_3_0H1E_1_3.Encloses (Foundation.entropyTerm (Z5_3_0H1Value ((1,3) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z5_3_0Half_sound 1) ((1,3) : PairSlot)) Z5_3_0H1E_1_3Log_sound) (by decide +kernel) +def Z5_3_0H1E_0_4LogWitness : LogWitness := ⟨-6, 2212727093860282562448201536591, 1562500000000000000000000000000⟩ +def Z5_3_0H1E_0_4Log : Ball := ⟨(-190547222603130891450597651942923 / 50000000000000000000000000000000), (37057691513 / 25000000000000000000000000000000)⟩ +lemma Z5_3_0H1E_0_4Log_sound : Z5_3_0H1E_0_4Log.Encloses (Real.log (Z5_3_0H1Value ((0,4) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound ((Z5_3_0Half_sound 1) ((0,4) : PairSlot)) (w := Z5_3_0H1E_0_4LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z5_3_0H1E_0_4 : Ball := ⟨(2108145010568870815331944029893 / 25000000000000000000000000000000), (1639971173 / 50000000000000000000000000000000)⟩ +lemma Z5_3_0H1E_0_4_sound : Z5_3_0H1E_0_4.Encloses (Foundation.entropyTerm (Z5_3_0H1Value ((0,4) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z5_3_0Half_sound 1) ((0,4) : PairSlot)) Z5_3_0H1E_0_4Log_sound) (by decide +kernel) +def Z5_3_0H1Terms (a : PairSlot) : Ball := + match a.1.val, a.2.val with + | 4, 0 => ⟨(2108145010568870815331944029893 / 25000000000000000000000000000000), (1639971173 / 50000000000000000000000000000000)⟩ + | 2, 1 => ⟨(7233991706521058045956490938163 / 20000000000000000000000000000000), (13891550817 / 50000000000000000000000000000000)⟩ + | 3, 1 => ⟨(2598673100349966355117959463809 / 20000000000000000000000000000000), (514988899 / 10000000000000000000000000000000)⟩ + | 1, 2 => ⟨(7233991706521058045956490938163 / 20000000000000000000000000000000), (13891550817 / 50000000000000000000000000000000)⟩ + | 1, 3 => ⟨(2598673100349966355117959463809 / 20000000000000000000000000000000), (514988899 / 10000000000000000000000000000000)⟩ + | 0, 4 => ⟨(2108145010568870815331944029893 / 25000000000000000000000000000000), (1639971173 / 50000000000000000000000000000000)⟩ + | _, _ => (.exact 0) +lemma Z5_3_0H1Terms_sound (a : PairSlot) : + (Z5_3_0H1Terms a).Encloses (Foundation.entropyTerm (Z5_3_0H1Value a)) := by + rcases a with ⟨i,j⟩ + revert j i + apply forall_fin6 + · exact forall_fin6 (entropyTerm_zero_ball ((Z5_3_0Half_sound 1) ((0,0) : PairSlot))) (entropyTerm_zero_ball ((Z5_3_0Half_sound 1) ((0,1) : PairSlot))) (entropyTerm_zero_ball ((Z5_3_0Half_sound 1) ((0,2) : PairSlot))) (entropyTerm_zero_ball ((Z5_3_0Half_sound 1) ((0,3) : PairSlot))) Z5_3_0H1E_0_4_sound (entropyTerm_zero_ball ((Z5_3_0Half_sound 1) ((0,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z5_3_0Half_sound 1) ((1,0) : PairSlot))) (entropyTerm_zero_ball ((Z5_3_0Half_sound 1) ((1,1) : PairSlot))) Z5_3_0H1E_1_2_sound Z5_3_0H1E_1_3_sound (entropyTerm_zero_ball ((Z5_3_0Half_sound 1) ((1,4) : PairSlot))) (entropyTerm_zero_ball ((Z5_3_0Half_sound 1) ((1,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z5_3_0Half_sound 1) ((2,0) : PairSlot))) Z5_3_0H1E_2_1_sound (entropyTerm_zero_ball ((Z5_3_0Half_sound 1) ((2,2) : PairSlot))) (entropyTerm_zero_ball ((Z5_3_0Half_sound 1) ((2,3) : PairSlot))) (entropyTerm_zero_ball ((Z5_3_0Half_sound 1) ((2,4) : PairSlot))) (entropyTerm_zero_ball ((Z5_3_0Half_sound 1) ((2,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z5_3_0Half_sound 1) ((3,0) : PairSlot))) Z5_3_0H1E_3_1_sound (entropyTerm_zero_ball ((Z5_3_0Half_sound 1) ((3,2) : PairSlot))) (entropyTerm_zero_ball ((Z5_3_0Half_sound 1) ((3,3) : PairSlot))) (entropyTerm_zero_ball ((Z5_3_0Half_sound 1) ((3,4) : PairSlot))) (entropyTerm_zero_ball ((Z5_3_0Half_sound 1) ((3,5) : PairSlot))) + · exact forall_fin6 Z5_3_0H1E_4_0_sound (entropyTerm_zero_ball ((Z5_3_0Half_sound 1) ((4,1) : PairSlot))) (entropyTerm_zero_ball ((Z5_3_0Half_sound 1) ((4,2) : PairSlot))) (entropyTerm_zero_ball ((Z5_3_0Half_sound 1) ((4,3) : PairSlot))) (entropyTerm_zero_ball ((Z5_3_0Half_sound 1) ((4,4) : PairSlot))) (entropyTerm_zero_ball ((Z5_3_0Half_sound 1) ((4,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z5_3_0Half_sound 1) ((5,0) : PairSlot))) (entropyTerm_zero_ball ((Z5_3_0Half_sound 1) ((5,1) : PairSlot))) (entropyTerm_zero_ball ((Z5_3_0Half_sound 1) ((5,2) : PairSlot))) (entropyTerm_zero_ball ((Z5_3_0Half_sound 1) ((5,3) : PairSlot))) (entropyTerm_zero_ball ((Z5_3_0Half_sound 1) ((5,4) : PairSlot))) (entropyTerm_zero_ball ((Z5_3_0Half_sound 1) ((5,5) : PairSlot))) +def Z5_3_0H1Entropy : Ball := ⟨(7199488009578825658337503516179 / 6250000000000000000000000000000), (3621293297 / 5000000000000000000000000000000)⟩ +lemma Z5_3_0H1Entropy_sound : Z5_3_0H1Entropy.Encloses (Foundation.finiteEntropy Z5_3_0H1Value) := by + exact contains_sound (entropyPair_enclosed Z5_3_0H1Value Z5_3_0H1Terms Z5_3_0H1Terms_sound) (by decide +kernel) +def Z5_3_0H1Mass : Ball := ⟨1, (97 / 50000000000000000000000000000000)⟩ +lemma Z5_3_0H1Mass_sound : Z5_3_0H1Mass.Encloses (∑ a, Z5_3_0H1Value a) := by + exact contains_sound (pairSumBall_sound (Z5_3_0Half 1) Z5_3_0H1Value (Z5_3_0Half_sound 1)) (by decide +kernel) +def Z5_3_0H1MassTermLogWitness : LogWitness := ⟨0, 1, 1⟩ +def Z5_3_0H1MassTermLog : Ball := ⟨0, (5293955969 / 25000000000000000000000000000000)⟩ +lemma Z5_3_0H1MassTermLog_sound : Z5_3_0H1MassTermLog.Encloses (Real.log ((∑ a, Z5_3_0H1Value a))) := by + exact checkLog_sound logTwoBall_sound (Z5_3_0H1Mass_sound) (w := Z5_3_0H1MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z5_3_0H1MassTerm : Ball := ⟨0, (21175823877 / 100000000000000000000000000000000)⟩ +lemma Z5_3_0H1MassTerm_sound : Z5_3_0H1MassTerm.Encloses (Foundation.entropyTerm ((∑ a, Z5_3_0H1Value a))) := by + exact contains_sound (entropyTerm_ball (Z5_3_0H1Mass_sound) Z5_3_0H1MassTermLog_sound) (by decide +kernel) +def Z5_3_0H1H : Ball := ⟨(7199488009578825658337503516179 / 6250000000000000000000000000000), (93601689817 / 100000000000000000000000000000000)⟩ +lemma Z5_3_0H1H_sound : Z5_3_0H1H.Encloses (homogeneousEntropy Z5_3_0H1Value) := by + exact contains_sound (homogeneous_enclosed Z5_3_0H1Value Z5_3_0H1MassTerm_sound Z5_3_0H1Entropy_sound) (by decide +kernel) +def Z5_3_0H2Value (a : PairSlot) : ℝ := (halfLaw (shape 5 3 0) 2 a : ℝ) +def Z5_3_0H2E_0_0Log : Ball := .exact 0 +lemma Z5_3_0H2E_0_0Log_sound : Z5_3_0H2E_0_0Log.Encloses (Real.log (Z5_3_0H2Value ((0,0) : PairSlot))) := by + exact log_exact_one_ball ((Z5_3_0Half_sound 2) ((0,0) : PairSlot)) +def Z5_3_0H2E_0_0 : Ball := ⟨0, 0⟩ +lemma Z5_3_0H2E_0_0_sound : Z5_3_0H2E_0_0.Encloses (Foundation.entropyTerm (Z5_3_0H2Value ((0,0) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z5_3_0Half_sound 2) ((0,0) : PairSlot)) Z5_3_0H2E_0_0Log_sound) (by decide +kernel) +def Z5_3_0H2Terms (a : PairSlot) : Ball := + match a.1.val, a.2.val with + | 0, 0 => ⟨0, 0⟩ + | _, _ => (.exact 0) +lemma Z5_3_0H2Terms_sound (a : PairSlot) : + (Z5_3_0H2Terms a).Encloses (Foundation.entropyTerm (Z5_3_0H2Value a)) := by + rcases a with ⟨i,j⟩ + revert j i + apply forall_fin6 + · exact forall_fin6 Z5_3_0H2E_0_0_sound (entropyTerm_zero_ball ((Z5_3_0Half_sound 2) ((0,1) : PairSlot))) (entropyTerm_zero_ball ((Z5_3_0Half_sound 2) ((0,2) : PairSlot))) (entropyTerm_zero_ball ((Z5_3_0Half_sound 2) ((0,3) : PairSlot))) (entropyTerm_zero_ball ((Z5_3_0Half_sound 2) ((0,4) : PairSlot))) (entropyTerm_zero_ball ((Z5_3_0Half_sound 2) ((0,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z5_3_0Half_sound 2) ((1,0) : PairSlot))) (entropyTerm_zero_ball ((Z5_3_0Half_sound 2) ((1,1) : PairSlot))) (entropyTerm_zero_ball ((Z5_3_0Half_sound 2) ((1,2) : PairSlot))) (entropyTerm_zero_ball ((Z5_3_0Half_sound 2) ((1,3) : PairSlot))) (entropyTerm_zero_ball ((Z5_3_0Half_sound 2) ((1,4) : PairSlot))) (entropyTerm_zero_ball ((Z5_3_0Half_sound 2) ((1,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z5_3_0Half_sound 2) ((2,0) : PairSlot))) (entropyTerm_zero_ball ((Z5_3_0Half_sound 2) ((2,1) : PairSlot))) (entropyTerm_zero_ball ((Z5_3_0Half_sound 2) ((2,2) : PairSlot))) (entropyTerm_zero_ball ((Z5_3_0Half_sound 2) ((2,3) : PairSlot))) (entropyTerm_zero_ball ((Z5_3_0Half_sound 2) ((2,4) : PairSlot))) (entropyTerm_zero_ball ((Z5_3_0Half_sound 2) ((2,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z5_3_0Half_sound 2) ((3,0) : PairSlot))) (entropyTerm_zero_ball ((Z5_3_0Half_sound 2) ((3,1) : PairSlot))) (entropyTerm_zero_ball ((Z5_3_0Half_sound 2) ((3,2) : PairSlot))) (entropyTerm_zero_ball ((Z5_3_0Half_sound 2) ((3,3) : PairSlot))) (entropyTerm_zero_ball ((Z5_3_0Half_sound 2) ((3,4) : PairSlot))) (entropyTerm_zero_ball ((Z5_3_0Half_sound 2) ((3,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z5_3_0Half_sound 2) ((4,0) : PairSlot))) (entropyTerm_zero_ball ((Z5_3_0Half_sound 2) ((4,1) : PairSlot))) (entropyTerm_zero_ball ((Z5_3_0Half_sound 2) ((4,2) : PairSlot))) (entropyTerm_zero_ball ((Z5_3_0Half_sound 2) ((4,3) : PairSlot))) (entropyTerm_zero_ball ((Z5_3_0Half_sound 2) ((4,4) : PairSlot))) (entropyTerm_zero_ball ((Z5_3_0Half_sound 2) ((4,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z5_3_0Half_sound 2) ((5,0) : PairSlot))) (entropyTerm_zero_ball ((Z5_3_0Half_sound 2) ((5,1) : PairSlot))) (entropyTerm_zero_ball ((Z5_3_0Half_sound 2) ((5,2) : PairSlot))) (entropyTerm_zero_ball ((Z5_3_0Half_sound 2) ((5,3) : PairSlot))) (entropyTerm_zero_ball ((Z5_3_0Half_sound 2) ((5,4) : PairSlot))) (entropyTerm_zero_ball ((Z5_3_0Half_sound 2) ((5,5) : PairSlot))) +def Z5_3_0H2Entropy : Ball := ⟨0, 0⟩ +lemma Z5_3_0H2Entropy_sound : Z5_3_0H2Entropy.Encloses (Foundation.finiteEntropy Z5_3_0H2Value) := by + exact contains_sound (entropyPair_enclosed Z5_3_0H2Value Z5_3_0H2Terms Z5_3_0H2Terms_sound) (by decide +kernel) +def Z5_3_0H2Mass : Ball := ⟨1, 0⟩ +lemma Z5_3_0H2Mass_sound : Z5_3_0H2Mass.Encloses (∑ a, Z5_3_0H2Value a) := by + exact contains_sound (pairSumBall_sound (Z5_3_0Half 2) Z5_3_0H2Value (Z5_3_0Half_sound 2)) (by decide +kernel) +def Z5_3_0H2MassTermLog : Ball := .exact 0 +lemma Z5_3_0H2MassTermLog_sound : Z5_3_0H2MassTermLog.Encloses (Real.log ((∑ a, Z5_3_0H2Value a))) := by + exact log_exact_one_ball (Z5_3_0H2Mass_sound) +def Z5_3_0H2MassTerm : Ball := ⟨0, 0⟩ +lemma Z5_3_0H2MassTerm_sound : Z5_3_0H2MassTerm.Encloses (Foundation.entropyTerm ((∑ a, Z5_3_0H2Value a))) := by + exact contains_sound (entropyTerm_ball (Z5_3_0H2Mass_sound) Z5_3_0H2MassTermLog_sound) (by decide +kernel) +def Z5_3_0H2H : Ball := ⟨0, 0⟩ +lemma Z5_3_0H2H_sound : Z5_3_0H2H.Encloses (homogeneousEntropy Z5_3_0H2Value) := by + exact contains_sound (homogeneous_enclosed Z5_3_0H2Value Z5_3_0H2MassTerm_sound Z5_3_0H2Entropy_sound) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/Certificates/Four6_0_2.lean b/lean/OAI/LinearAlgebra/MatrixFields/Certificates/Four6_0_2.lean new file mode 100644 index 0000000000000000000000000000000000000000..b8b8ae642b2ff7d6c1916ed9ef9f2859eec4c5a1 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/Certificates/Four6_0_2.lean @@ -0,0 +1,554 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Certificates.Zero0_1_7 + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def Z6_0_2Raw (ij : PairSlot) : Ball := + match ij.1.val, ij.2.val with + | 0, 0 => w195 + | 0, 1 => w195 + | 0, 2 => w195 + | 0, 3 => w195 + | 0, 4 => w195 + | 0, 5 => w195 + | 1, 0 => w195 + | 1, 1 => w195 + | 1, 2 => w195 + | 1, 3 => w195 + | 1, 4 => w195 + | 1, 5 => w195 + | 2, 0 => w195 + | 2, 1 => w195 + | 2, 2 => w195 + | 2, 3 => w195 + | 2, 4 => w195 + | 2, 5 => w192 + | 3, 0 => w195 + | 3, 1 => w195 + | 3, 2 => w195 + | 3, 3 => w195 + | 3, 4 => w195 + | 3, 5 => w197 + | 4, 0 => w195 + | 4, 1 => w195 + | 4, 2 => w195 + | 4, 3 => w195 + | 4, 4 => w195 + | 4, 5 => w195 + | 5, 0 => w195 + | 5, 1 => w195 + | 5, 2 => w192 + | 5, 3 => w197 + | 5, 4 => w195 + | 5, 5 => w195 + | _, _ => (.exact 0) +lemma Z6_0_2Raw_sound_0 (j : Fin 6) : + (Z6_0_2Raw (0,j)).Encloses (weight (orderedPairInteger (shape 6 0 2) 0 j) : ℝ) := by + fin_cases j + · change (Z6_0_2Raw (0,0)).Encloses (weight (orderedPairInteger (shape 6 0 2) 0 0) : ℝ) + have he : orderedPairInteger (shape 6 0 2) 0 0 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z6_0_2Raw (0,1)).Encloses (weight (orderedPairInteger (shape 6 0 2) 0 1) : ℝ) + have he : orderedPairInteger (shape 6 0 2) 0 1 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z6_0_2Raw (0,2)).Encloses (weight (orderedPairInteger (shape 6 0 2) 0 2) : ℝ) + have he : orderedPairInteger (shape 6 0 2) 0 2 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z6_0_2Raw (0,3)).Encloses (weight (orderedPairInteger (shape 6 0 2) 0 3) : ℝ) + have he : orderedPairInteger (shape 6 0 2) 0 3 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z6_0_2Raw (0,4)).Encloses (weight (orderedPairInteger (shape 6 0 2) 0 4) : ℝ) + have he : orderedPairInteger (shape 6 0 2) 0 4 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z6_0_2Raw (0,5)).Encloses (weight (orderedPairInteger (shape 6 0 2) 0 5) : ℝ) + have he : orderedPairInteger (shape 6 0 2) 0 5 = (0) := by decide +kernel + rw [he] + exact w195_sound +lemma Z6_0_2Raw_sound_1 (j : Fin 6) : + (Z6_0_2Raw (1,j)).Encloses (weight (orderedPairInteger (shape 6 0 2) 1 j) : ℝ) := by + fin_cases j + · change (Z6_0_2Raw (1,0)).Encloses (weight (orderedPairInteger (shape 6 0 2) 1 0) : ℝ) + have he : orderedPairInteger (shape 6 0 2) 1 0 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z6_0_2Raw (1,1)).Encloses (weight (orderedPairInteger (shape 6 0 2) 1 1) : ℝ) + have he : orderedPairInteger (shape 6 0 2) 1 1 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z6_0_2Raw (1,2)).Encloses (weight (orderedPairInteger (shape 6 0 2) 1 2) : ℝ) + have he : orderedPairInteger (shape 6 0 2) 1 2 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z6_0_2Raw (1,3)).Encloses (weight (orderedPairInteger (shape 6 0 2) 1 3) : ℝ) + have he : orderedPairInteger (shape 6 0 2) 1 3 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z6_0_2Raw (1,4)).Encloses (weight (orderedPairInteger (shape 6 0 2) 1 4) : ℝ) + have he : orderedPairInteger (shape 6 0 2) 1 4 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z6_0_2Raw (1,5)).Encloses (weight (orderedPairInteger (shape 6 0 2) 1 5) : ℝ) + have he : orderedPairInteger (shape 6 0 2) 1 5 = (0) := by decide +kernel + rw [he] + exact w195_sound +lemma Z6_0_2Raw_sound_2 (j : Fin 6) : + (Z6_0_2Raw (2,j)).Encloses (weight (orderedPairInteger (shape 6 0 2) 2 j) : ℝ) := by + fin_cases j + · change (Z6_0_2Raw (2,0)).Encloses (weight (orderedPairInteger (shape 6 0 2) 2 0) : ℝ) + have he : orderedPairInteger (shape 6 0 2) 2 0 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z6_0_2Raw (2,1)).Encloses (weight (orderedPairInteger (shape 6 0 2) 2 1) : ℝ) + have he : orderedPairInteger (shape 6 0 2) 2 1 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z6_0_2Raw (2,2)).Encloses (weight (orderedPairInteger (shape 6 0 2) 2 2) : ℝ) + have he : orderedPairInteger (shape 6 0 2) 2 2 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z6_0_2Raw (2,3)).Encloses (weight (orderedPairInteger (shape 6 0 2) 2 3) : ℝ) + have he : orderedPairInteger (shape 6 0 2) 2 3 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z6_0_2Raw (2,4)).Encloses (weight (orderedPairInteger (shape 6 0 2) 2 4) : ℝ) + have he : orderedPairInteger (shape 6 0 2) 2 4 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z6_0_2Raw (2,5)).Encloses (weight (orderedPairInteger (shape 6 0 2) 2 5) : ℝ) + have he : orderedPairInteger (shape 6 0 2) 2 5 = (-166) := by decide +kernel + rw [he] + exact w192_sound +lemma Z6_0_2Raw_sound_3 (j : Fin 6) : + (Z6_0_2Raw (3,j)).Encloses (weight (orderedPairInteger (shape 6 0 2) 3 j) : ℝ) := by + fin_cases j + · change (Z6_0_2Raw (3,0)).Encloses (weight (orderedPairInteger (shape 6 0 2) 3 0) : ℝ) + have he : orderedPairInteger (shape 6 0 2) 3 0 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z6_0_2Raw (3,1)).Encloses (weight (orderedPairInteger (shape 6 0 2) 3 1) : ℝ) + have he : orderedPairInteger (shape 6 0 2) 3 1 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z6_0_2Raw (3,2)).Encloses (weight (orderedPairInteger (shape 6 0 2) 3 2) : ℝ) + have he : orderedPairInteger (shape 6 0 2) 3 2 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z6_0_2Raw (3,3)).Encloses (weight (orderedPairInteger (shape 6 0 2) 3 3) : ℝ) + have he : orderedPairInteger (shape 6 0 2) 3 3 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z6_0_2Raw (3,4)).Encloses (weight (orderedPairInteger (shape 6 0 2) 3 4) : ℝ) + have he : orderedPairInteger (shape 6 0 2) 3 4 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z6_0_2Raw (3,5)).Encloses (weight (orderedPairInteger (shape 6 0 2) 3 5) : ℝ) + have he : orderedPairInteger (shape 6 0 2) 3 5 = (94) := by decide +kernel + rw [he] + exact w197_sound +lemma Z6_0_2Raw_sound_4 (j : Fin 6) : + (Z6_0_2Raw (4,j)).Encloses (weight (orderedPairInteger (shape 6 0 2) 4 j) : ℝ) := by + fin_cases j + · change (Z6_0_2Raw (4,0)).Encloses (weight (orderedPairInteger (shape 6 0 2) 4 0) : ℝ) + have he : orderedPairInteger (shape 6 0 2) 4 0 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z6_0_2Raw (4,1)).Encloses (weight (orderedPairInteger (shape 6 0 2) 4 1) : ℝ) + have he : orderedPairInteger (shape 6 0 2) 4 1 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z6_0_2Raw (4,2)).Encloses (weight (orderedPairInteger (shape 6 0 2) 4 2) : ℝ) + have he : orderedPairInteger (shape 6 0 2) 4 2 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z6_0_2Raw (4,3)).Encloses (weight (orderedPairInteger (shape 6 0 2) 4 3) : ℝ) + have he : orderedPairInteger (shape 6 0 2) 4 3 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z6_0_2Raw (4,4)).Encloses (weight (orderedPairInteger (shape 6 0 2) 4 4) : ℝ) + have he : orderedPairInteger (shape 6 0 2) 4 4 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z6_0_2Raw (4,5)).Encloses (weight (orderedPairInteger (shape 6 0 2) 4 5) : ℝ) + have he : orderedPairInteger (shape 6 0 2) 4 5 = (0) := by decide +kernel + rw [he] + exact w195_sound +lemma Z6_0_2Raw_sound_5 (j : Fin 6) : + (Z6_0_2Raw (5,j)).Encloses (weight (orderedPairInteger (shape 6 0 2) 5 j) : ℝ) := by + fin_cases j + · change (Z6_0_2Raw (5,0)).Encloses (weight (orderedPairInteger (shape 6 0 2) 5 0) : ℝ) + have he : orderedPairInteger (shape 6 0 2) 5 0 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z6_0_2Raw (5,1)).Encloses (weight (orderedPairInteger (shape 6 0 2) 5 1) : ℝ) + have he : orderedPairInteger (shape 6 0 2) 5 1 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z6_0_2Raw (5,2)).Encloses (weight (orderedPairInteger (shape 6 0 2) 5 2) : ℝ) + have he : orderedPairInteger (shape 6 0 2) 5 2 = (-166) := by decide +kernel + rw [he] + exact w192_sound + · change (Z6_0_2Raw (5,3)).Encloses (weight (orderedPairInteger (shape 6 0 2) 5 3) : ℝ) + have he : orderedPairInteger (shape 6 0 2) 5 3 = (94) := by decide +kernel + rw [he] + exact w197_sound + · change (Z6_0_2Raw (5,4)).Encloses (weight (orderedPairInteger (shape 6 0 2) 5 4) : ℝ) + have he : orderedPairInteger (shape 6 0 2) 5 4 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z6_0_2Raw (5,5)).Encloses (weight (orderedPairInteger (shape 6 0 2) 5 5) : ℝ) + have he : orderedPairInteger (shape 6 0 2) 5 5 = (0) := by decide +kernel + rw [he] + exact w195_sound +lemma Z6_0_2Raw_sound (ij : PairSlot) : + (Z6_0_2Raw ij).Encloses (weight (orderedPairInteger (shape 6 0 2) ij.1 ij.2) : ℝ) := by + rcases ij with ⟨i,j⟩ + revert i + exact forall_fin6 (Z6_0_2Raw_sound_0 j) (Z6_0_2Raw_sound_1 j) (Z6_0_2Raw_sound_2 j) (Z6_0_2Raw_sound_3 j) (Z6_0_2Raw_sound_4 j) (Z6_0_2Raw_sound_5 j) +def Z6_0_2Den : Ball := ⟨(249298133952733756367028847637691 / 50000000000000000000000000000000), (253 / 50000000000000000000000000000000)⟩ +lemma Z6_0_2Den_sound : Z6_0_2Den.Encloses + (((orderedPairs (shape 6 0 2)).map (fun ij => weight (orderedPairInteger (shape 6 0 2) ij.1 ij.2))).sum : ℝ) := by + exact contains_sound (list_cast_enclosed (orderedPairs (shape 6 0 2)) Z6_0_2Raw + (fun ij => weight (orderedPairInteger (shape 6 0 2) ij.1 ij.2)) + (fun ij _ => Z6_0_2Raw_sound ij)) (by decide +kernel) +lemma Z6_0_2Den_pos : 0 < Z6_0_2Den.lower := by decide +kernel +def Z6_0_2Probs (ij : PairSlot) : Ball := + match ij.1.val, ij.2.val with + | 2, 5 => ⟨(19726120793130810407094355236181 / 100000000000000000000000000000000), (23 / 50000000000000000000000000000000)⟩ + | 3, 5 => ⟨(20245725524523564193484784547927 / 100000000000000000000000000000000), (47 / 100000000000000000000000000000000)⟩ + | 4, 4 => ⟨(20056307364691250798841720431783 / 100000000000000000000000000000000), (21 / 100000000000000000000000000000000)⟩ + | 5, 2 => ⟨(19726120793130810407094355236181 / 100000000000000000000000000000000), (23 / 50000000000000000000000000000000)⟩ + | 5, 3 => ⟨(20245725524523564193484784547927 / 100000000000000000000000000000000), (47 / 100000000000000000000000000000000)⟩ + | _, _ => (.exact 0) +lemma Z6_0_2Contains : ∀ i j : Fin 6, + statisticWeight i + statisticWeight j = shapeMax (shape 6 0 2) → + contains (.mul (Z6_0_2Raw (i,j)) (.inv Z6_0_2Den)) (Z6_0_2Probs (i,j)) = true := by + decide +kernel +lemma Z6_0_2Zero : ∀ i j : Fin 6, + statisticWeight i + statisticWeight j ≠ shapeMax (shape 6 0 2) → Z6_0_2Probs (i,j) = .exact 0 := by + decide +kernel +lemma Z6_0_2Probs_sound (ij : PairSlot) : + (Z6_0_2Probs ij).Encloses (zeroPairLaw (shape 6 0 2) ij.1 ij.2 : ℝ) := by + by_cases h : statisticWeight ij.1 + statisticWeight ij.2 = shapeMax (shape 6 0 2) + · have hb := contains_sound (Ball.mul_sound (Z6_0_2Raw_sound ij) + (Ball.inv_sound Z6_0_2Den_sound Z6_0_2Den_pos)) (Z6_0_2Contains ij.1 ij.2 h) + simpa only [zeroPairLaw, h, ite_true, Rat.cast_div, Rat.cast_mul, + Rat.cast_inv, div_eq_mul_inv] using hb + · rw [Z6_0_2Zero ij.1 ij.2 h] + simpa only [zeroPairLaw, h, ite_false] using Ball.exact_sound 0 + +def Z6_0_2Half (w : Fin 3) (ij : PairSlot) : Ball := + if (shape 6 0 2) w = 0 then if ij = (0,0) then .exact 1 else .exact 0 + else if w = halfMaxAxis (shape 6 0 2) then Z6_0_2Probs ij + else Z6_0_2Probs (kappa ij.1, kappa ij.2) +lemma Z6_0_2Half_sound (w : Fin 3) (ij : PairSlot) : + (Z6_0_2Half w ij).Encloses (halfLaw (shape 6 0 2) w ij : ℝ) := by + have hp : positive (shape 6 0 2) = false := by decide +kernel + simp only [Z6_0_2Half, halfLaw, hp, Bool.false_eq_true, ite_false] + split_ifs + · exact Ball.exact_sound 1 + · exact Ball.exact_sound 0 + · exact Z6_0_2Probs_sound _ + · exact Z6_0_2Probs_sound _ + +def Z6_0_2Value (a : PairSlot) : ℝ := (zeroPairLaw (shape 6 0 2) a.1 a.2 : ℝ) +def Z6_0_2E_2_5LogWitness : LogWitness := ⟨-3, 19726120793130810407094355236181, 12500000000000000000000000000000⟩ +def Z6_0_2E_2_5Log : Ball := ⟨(-6492905999703497484642802902389 / 4000000000000000000000000000000), (16940658993 / 20000000000000000000000000000000)⟩ +lemma Z6_0_2E_2_5Log_sound : Z6_0_2E_2_5Log.Encloses (Real.log (Z6_0_2Value ((2,5) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound (Z6_0_2Probs_sound ((2,5) : PairSlot)) (w := Z6_0_2E_2_5LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z6_0_2E_2_5 : Ball := ⟨(4002495251518592288865068392969 / 12500000000000000000000000000000), (4177168589 / 25000000000000000000000000000000)⟩ +lemma Z6_0_2E_2_5_sound : Z6_0_2E_2_5.Encloses (Foundation.entropyTerm (Z6_0_2Value ((2,5) : PairSlot))) := by + exact contains_sound (entropyTerm_ball (Z6_0_2Probs_sound ((2,5) : PairSlot)) Z6_0_2E_2_5Log_sound) (by decide +kernel) +def Z6_0_2E_3_5LogWitness : LogWitness := ⟨-3, 20245725524523564193484784547927, 12500000000000000000000000000000⟩ +def Z6_0_2E_3_5Log : Ball := ⟨(-79861324996293718558035036279851 / 50000000000000000000000000000000), (21175823741 / 25000000000000000000000000000000)⟩ +lemma Z6_0_2E_3_5Log_sound : Z6_0_2E_3_5Log.Encloses (Real.log (Z6_0_2Value ((3,5) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound (Z6_0_2Probs_sound ((3,5) : PairSlot)) (w := Z6_0_2E_3_5LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z6_0_2E_3_5 : Ball := ⟨(6467401863598941893694372777521 / 20000000000000000000000000000000), (3429759337 / 20000000000000000000000000000000)⟩ +lemma Z6_0_2E_3_5_sound : Z6_0_2E_3_5.Encloses (Foundation.entropyTerm (Z6_0_2Value ((3,5) : PairSlot))) := by + exact contains_sound (entropyTerm_ball (Z6_0_2Probs_sound ((3,5) : PairSlot)) Z6_0_2E_3_5Log_sound) (by decide +kernel) +def Z6_0_2E_4_4LogWitness : LogWitness := ⟨-3, 20056307364691250798841720431783, 12500000000000000000000000000000⟩ +def Z6_0_2E_4_4Log : Ball := ⟨(-160662649992587437116070072559717 / 100000000000000000000000000000000), (21175823709 / 25000000000000000000000000000000)⟩ +lemma Z6_0_2E_4_4Log_sound : Z6_0_2E_4_4Log.Encloses (Real.log (Z6_0_2Value ((4,4) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound (Z6_0_2Probs_sound ((4,4) : PairSlot)) (w := Z6_0_2E_4_4LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z6_0_2E_4_4 : Ball := ⟨(32222994902771441455963269141339 / 100000000000000000000000000000000), (3397670639 / 20000000000000000000000000000000)⟩ +lemma Z6_0_2E_4_4_sound : Z6_0_2E_4_4.Encloses (Foundation.entropyTerm (Z6_0_2Value ((4,4) : PairSlot))) := by + exact contains_sound (entropyTerm_ball (Z6_0_2Probs_sound ((4,4) : PairSlot)) Z6_0_2E_4_4Log_sound) (by decide +kernel) +def Z6_0_2E_5_2LogWitness : LogWitness := ⟨-3, 19726120793130810407094355236181, 12500000000000000000000000000000⟩ +def Z6_0_2E_5_2Log : Ball := ⟨(-6492905999703497484642802902389 / 4000000000000000000000000000000), (16940658993 / 20000000000000000000000000000000)⟩ +lemma Z6_0_2E_5_2Log_sound : Z6_0_2E_5_2Log.Encloses (Real.log (Z6_0_2Value ((5,2) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound (Z6_0_2Probs_sound ((5,2) : PairSlot)) (w := Z6_0_2E_5_2LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z6_0_2E_5_2 : Ball := ⟨(4002495251518592288865068392969 / 12500000000000000000000000000000), (4177168589 / 25000000000000000000000000000000)⟩ +lemma Z6_0_2E_5_2_sound : Z6_0_2E_5_2.Encloses (Foundation.entropyTerm (Z6_0_2Value ((5,2) : PairSlot))) := by + exact contains_sound (entropyTerm_ball (Z6_0_2Probs_sound ((5,2) : PairSlot)) Z6_0_2E_5_2Log_sound) (by decide +kernel) +def Z6_0_2E_5_3LogWitness : LogWitness := ⟨-3, 20245725524523564193484784547927, 12500000000000000000000000000000⟩ +def Z6_0_2E_5_3Log : Ball := ⟨(-79861324996293718558035036279851 / 50000000000000000000000000000000), (21175823741 / 25000000000000000000000000000000)⟩ +lemma Z6_0_2E_5_3Log_sound : Z6_0_2E_5_3Log.Encloses (Real.log (Z6_0_2Value ((5,3) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound (Z6_0_2Probs_sound ((5,3) : PairSlot)) (w := Z6_0_2E_5_3LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z6_0_2E_5_3 : Ball := ⟨(6467401863598941893694372777521 / 20000000000000000000000000000000), (3429759337 / 20000000000000000000000000000000)⟩ +lemma Z6_0_2E_5_3_sound : Z6_0_2E_5_3.Encloses (Foundation.entropyTerm (Z6_0_2Value ((5,3) : PairSlot))) := by + exact contains_sound (entropyTerm_ball (Z6_0_2Probs_sound ((5,3) : PairSlot)) Z6_0_2E_5_3Log_sound) (by decide +kernel) +def Z6_0_2Terms (a : PairSlot) : Ball := + match a.1.val, a.2.val with + | 2, 5 => ⟨(4002495251518592288865068392969 / 12500000000000000000000000000000), (4177168589 / 25000000000000000000000000000000)⟩ + | 3, 5 => ⟨(6467401863598941893694372777521 / 20000000000000000000000000000000), (3429759337 / 20000000000000000000000000000000)⟩ + | 4, 4 => ⟨(32222994902771441455963269141339 / 100000000000000000000000000000000), (3397670639 / 20000000000000000000000000000000)⟩ + | 5, 2 => ⟨(4002495251518592288865068392969 / 12500000000000000000000000000000), (4177168589 / 25000000000000000000000000000000)⟩ + | 5, 3 => ⟨(6467401863598941893694372777521 / 20000000000000000000000000000000), (3429759337 / 20000000000000000000000000000000)⟩ + | _, _ => (.exact 0) +lemma Z6_0_2Terms_sound (a : PairSlot) : + (Z6_0_2Terms a).Encloses (Foundation.entropyTerm (Z6_0_2Value a)) := by + rcases a with ⟨i,j⟩ + revert j i + apply forall_fin6 + · exact forall_fin6 (entropyTerm_zero_ball (Z6_0_2Probs_sound ((0,0) : PairSlot))) (entropyTerm_zero_ball (Z6_0_2Probs_sound ((0,1) : PairSlot))) (entropyTerm_zero_ball (Z6_0_2Probs_sound ((0,2) : PairSlot))) (entropyTerm_zero_ball (Z6_0_2Probs_sound ((0,3) : PairSlot))) (entropyTerm_zero_ball (Z6_0_2Probs_sound ((0,4) : PairSlot))) (entropyTerm_zero_ball (Z6_0_2Probs_sound ((0,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball (Z6_0_2Probs_sound ((1,0) : PairSlot))) (entropyTerm_zero_ball (Z6_0_2Probs_sound ((1,1) : PairSlot))) (entropyTerm_zero_ball (Z6_0_2Probs_sound ((1,2) : PairSlot))) (entropyTerm_zero_ball (Z6_0_2Probs_sound ((1,3) : PairSlot))) (entropyTerm_zero_ball (Z6_0_2Probs_sound ((1,4) : PairSlot))) (entropyTerm_zero_ball (Z6_0_2Probs_sound ((1,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball (Z6_0_2Probs_sound ((2,0) : PairSlot))) (entropyTerm_zero_ball (Z6_0_2Probs_sound ((2,1) : PairSlot))) (entropyTerm_zero_ball (Z6_0_2Probs_sound ((2,2) : PairSlot))) (entropyTerm_zero_ball (Z6_0_2Probs_sound ((2,3) : PairSlot))) (entropyTerm_zero_ball (Z6_0_2Probs_sound ((2,4) : PairSlot))) Z6_0_2E_2_5_sound + · exact forall_fin6 (entropyTerm_zero_ball (Z6_0_2Probs_sound ((3,0) : PairSlot))) (entropyTerm_zero_ball (Z6_0_2Probs_sound ((3,1) : PairSlot))) (entropyTerm_zero_ball (Z6_0_2Probs_sound ((3,2) : PairSlot))) (entropyTerm_zero_ball (Z6_0_2Probs_sound ((3,3) : PairSlot))) (entropyTerm_zero_ball (Z6_0_2Probs_sound ((3,4) : PairSlot))) Z6_0_2E_3_5_sound + · exact forall_fin6 (entropyTerm_zero_ball (Z6_0_2Probs_sound ((4,0) : PairSlot))) (entropyTerm_zero_ball (Z6_0_2Probs_sound ((4,1) : PairSlot))) (entropyTerm_zero_ball (Z6_0_2Probs_sound ((4,2) : PairSlot))) (entropyTerm_zero_ball (Z6_0_2Probs_sound ((4,3) : PairSlot))) Z6_0_2E_4_4_sound (entropyTerm_zero_ball (Z6_0_2Probs_sound ((4,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball (Z6_0_2Probs_sound ((5,0) : PairSlot))) (entropyTerm_zero_ball (Z6_0_2Probs_sound ((5,1) : PairSlot))) Z6_0_2E_5_2_sound Z6_0_2E_5_3_sound (entropyTerm_zero_ball (Z6_0_2Probs_sound ((5,4) : PairSlot))) (entropyTerm_zero_ball (Z6_0_2Probs_sound ((5,5) : PairSlot))) +def Z6_0_2Entropy : Ball := ⟨(160936937563058337014748091204053 / 100000000000000000000000000000000), (84703295277 / 100000000000000000000000000000000)⟩ +lemma Z6_0_2Entropy_sound : Z6_0_2Entropy.Encloses (Foundation.finiteEntropy Z6_0_2Value) := by + exact contains_sound (entropyPair_enclosed Z6_0_2Value Z6_0_2Terms Z6_0_2Terms_sound) (by decide +kernel) +def Z6_0_2Labels : Ball := ⟨(49484222105438999677313478916931 / 20000000000000000000000000000000), (443250503 / 500000000000000000000000000000)⟩ +lemma Z6_0_2Labels_sound : Z6_0_2Labels.Encloses + (∑ a : PairSlot, (zeroPairLaw (shape 6 0 2) a.1 a.2 : ℝ) * + Real.log (AllFieldParameters.multiplicity a.1 * AllFieldParameters.multiplicity a.2 : ℕ)) := by + exact contains_sound (pairSumBall_sound (fun a => .mul (Z6_0_2Probs a) (multLogs a)) + _ (fun a => Ball.mul_sound (Z6_0_2Probs_sound a) (multLogs_sound a))) (by decide +kernel) +def Z6_0_2Four : Ball := ⟨(102089512022563333850328871447177 / 25000000000000000000000000000000), (173353395877 / 100000000000000000000000000000000)⟩ +lemma Z6_0_2Four_sound : Z6_0_2Four.Encloses (AllFieldZeroLeafRates.fourRate (shape 6 0 2)) := by + exact contains_sound (Ball.add_sound Z6_0_2Entropy_sound Z6_0_2Labels_sound) (by decide +kernel) +def Z6_0_2H0Value (a : PairSlot) : ℝ := (halfLaw (shape 6 0 2) 0 a : ℝ) +def Z6_0_2H0E_2_5LogWitness : LogWitness := ⟨-3, 19726120793130810407094355236181, 12500000000000000000000000000000⟩ +def Z6_0_2H0E_2_5Log : Ball := ⟨(-6492905999703497484642802902389 / 4000000000000000000000000000000), (16940658993 / 20000000000000000000000000000000)⟩ +lemma Z6_0_2H0E_2_5Log_sound : Z6_0_2H0E_2_5Log.Encloses (Real.log (Z6_0_2H0Value ((2,5) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound ((Z6_0_2Half_sound 0) ((2,5) : PairSlot)) (w := Z6_0_2H0E_2_5LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z6_0_2H0E_2_5 : Ball := ⟨(4002495251518592288865068392969 / 12500000000000000000000000000000), (4177168589 / 25000000000000000000000000000000)⟩ +lemma Z6_0_2H0E_2_5_sound : Z6_0_2H0E_2_5.Encloses (Foundation.entropyTerm (Z6_0_2H0Value ((2,5) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z6_0_2Half_sound 0) ((2,5) : PairSlot)) Z6_0_2H0E_2_5Log_sound) (by decide +kernel) +def Z6_0_2H0E_3_5LogWitness : LogWitness := ⟨-3, 20245725524523564193484784547927, 12500000000000000000000000000000⟩ +def Z6_0_2H0E_3_5Log : Ball := ⟨(-79861324996293718558035036279851 / 50000000000000000000000000000000), (21175823741 / 25000000000000000000000000000000)⟩ +lemma Z6_0_2H0E_3_5Log_sound : Z6_0_2H0E_3_5Log.Encloses (Real.log (Z6_0_2H0Value ((3,5) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound ((Z6_0_2Half_sound 0) ((3,5) : PairSlot)) (w := Z6_0_2H0E_3_5LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z6_0_2H0E_3_5 : Ball := ⟨(6467401863598941893694372777521 / 20000000000000000000000000000000), (3429759337 / 20000000000000000000000000000000)⟩ +lemma Z6_0_2H0E_3_5_sound : Z6_0_2H0E_3_5.Encloses (Foundation.entropyTerm (Z6_0_2H0Value ((3,5) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z6_0_2Half_sound 0) ((3,5) : PairSlot)) Z6_0_2H0E_3_5Log_sound) (by decide +kernel) +def Z6_0_2H0E_4_4LogWitness : LogWitness := ⟨-3, 20056307364691250798841720431783, 12500000000000000000000000000000⟩ +def Z6_0_2H0E_4_4Log : Ball := ⟨(-160662649992587437116070072559717 / 100000000000000000000000000000000), (21175823709 / 25000000000000000000000000000000)⟩ +lemma Z6_0_2H0E_4_4Log_sound : Z6_0_2H0E_4_4Log.Encloses (Real.log (Z6_0_2H0Value ((4,4) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound ((Z6_0_2Half_sound 0) ((4,4) : PairSlot)) (w := Z6_0_2H0E_4_4LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z6_0_2H0E_4_4 : Ball := ⟨(32222994902771441455963269141339 / 100000000000000000000000000000000), (3397670639 / 20000000000000000000000000000000)⟩ +lemma Z6_0_2H0E_4_4_sound : Z6_0_2H0E_4_4.Encloses (Foundation.entropyTerm (Z6_0_2H0Value ((4,4) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z6_0_2Half_sound 0) ((4,4) : PairSlot)) Z6_0_2H0E_4_4Log_sound) (by decide +kernel) +def Z6_0_2H0E_5_2LogWitness : LogWitness := ⟨-3, 19726120793130810407094355236181, 12500000000000000000000000000000⟩ +def Z6_0_2H0E_5_2Log : Ball := ⟨(-6492905999703497484642802902389 / 4000000000000000000000000000000), (16940658993 / 20000000000000000000000000000000)⟩ +lemma Z6_0_2H0E_5_2Log_sound : Z6_0_2H0E_5_2Log.Encloses (Real.log (Z6_0_2H0Value ((5,2) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound ((Z6_0_2Half_sound 0) ((5,2) : PairSlot)) (w := Z6_0_2H0E_5_2LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z6_0_2H0E_5_2 : Ball := ⟨(4002495251518592288865068392969 / 12500000000000000000000000000000), (4177168589 / 25000000000000000000000000000000)⟩ +lemma Z6_0_2H0E_5_2_sound : Z6_0_2H0E_5_2.Encloses (Foundation.entropyTerm (Z6_0_2H0Value ((5,2) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z6_0_2Half_sound 0) ((5,2) : PairSlot)) Z6_0_2H0E_5_2Log_sound) (by decide +kernel) +def Z6_0_2H0E_5_3LogWitness : LogWitness := ⟨-3, 20245725524523564193484784547927, 12500000000000000000000000000000⟩ +def Z6_0_2H0E_5_3Log : Ball := ⟨(-79861324996293718558035036279851 / 50000000000000000000000000000000), (21175823741 / 25000000000000000000000000000000)⟩ +lemma Z6_0_2H0E_5_3Log_sound : Z6_0_2H0E_5_3Log.Encloses (Real.log (Z6_0_2H0Value ((5,3) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound ((Z6_0_2Half_sound 0) ((5,3) : PairSlot)) (w := Z6_0_2H0E_5_3LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z6_0_2H0E_5_3 : Ball := ⟨(6467401863598941893694372777521 / 20000000000000000000000000000000), (3429759337 / 20000000000000000000000000000000)⟩ +lemma Z6_0_2H0E_5_3_sound : Z6_0_2H0E_5_3.Encloses (Foundation.entropyTerm (Z6_0_2H0Value ((5,3) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z6_0_2Half_sound 0) ((5,3) : PairSlot)) Z6_0_2H0E_5_3Log_sound) (by decide +kernel) +def Z6_0_2H0Terms (a : PairSlot) : Ball := + match a.1.val, a.2.val with + | 2, 5 => ⟨(4002495251518592288865068392969 / 12500000000000000000000000000000), (4177168589 / 25000000000000000000000000000000)⟩ + | 3, 5 => ⟨(6467401863598941893694372777521 / 20000000000000000000000000000000), (3429759337 / 20000000000000000000000000000000)⟩ + | 4, 4 => ⟨(32222994902771441455963269141339 / 100000000000000000000000000000000), (3397670639 / 20000000000000000000000000000000)⟩ + | 5, 2 => ⟨(4002495251518592288865068392969 / 12500000000000000000000000000000), (4177168589 / 25000000000000000000000000000000)⟩ + | 5, 3 => ⟨(6467401863598941893694372777521 / 20000000000000000000000000000000), (3429759337 / 20000000000000000000000000000000)⟩ + | _, _ => (.exact 0) +lemma Z6_0_2H0Terms_sound (a : PairSlot) : + (Z6_0_2H0Terms a).Encloses (Foundation.entropyTerm (Z6_0_2H0Value a)) := by + rcases a with ⟨i,j⟩ + revert j i + apply forall_fin6 + · exact forall_fin6 (entropyTerm_zero_ball ((Z6_0_2Half_sound 0) ((0,0) : PairSlot))) (entropyTerm_zero_ball ((Z6_0_2Half_sound 0) ((0,1) : PairSlot))) (entropyTerm_zero_ball ((Z6_0_2Half_sound 0) ((0,2) : PairSlot))) (entropyTerm_zero_ball ((Z6_0_2Half_sound 0) ((0,3) : PairSlot))) (entropyTerm_zero_ball ((Z6_0_2Half_sound 0) ((0,4) : PairSlot))) (entropyTerm_zero_ball ((Z6_0_2Half_sound 0) ((0,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z6_0_2Half_sound 0) ((1,0) : PairSlot))) (entropyTerm_zero_ball ((Z6_0_2Half_sound 0) ((1,1) : PairSlot))) (entropyTerm_zero_ball ((Z6_0_2Half_sound 0) ((1,2) : PairSlot))) (entropyTerm_zero_ball ((Z6_0_2Half_sound 0) ((1,3) : PairSlot))) (entropyTerm_zero_ball ((Z6_0_2Half_sound 0) ((1,4) : PairSlot))) (entropyTerm_zero_ball ((Z6_0_2Half_sound 0) ((1,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z6_0_2Half_sound 0) ((2,0) : PairSlot))) (entropyTerm_zero_ball ((Z6_0_2Half_sound 0) ((2,1) : PairSlot))) (entropyTerm_zero_ball ((Z6_0_2Half_sound 0) ((2,2) : PairSlot))) (entropyTerm_zero_ball ((Z6_0_2Half_sound 0) ((2,3) : PairSlot))) (entropyTerm_zero_ball ((Z6_0_2Half_sound 0) ((2,4) : PairSlot))) Z6_0_2H0E_2_5_sound + · exact forall_fin6 (entropyTerm_zero_ball ((Z6_0_2Half_sound 0) ((3,0) : PairSlot))) (entropyTerm_zero_ball ((Z6_0_2Half_sound 0) ((3,1) : PairSlot))) (entropyTerm_zero_ball ((Z6_0_2Half_sound 0) ((3,2) : PairSlot))) (entropyTerm_zero_ball ((Z6_0_2Half_sound 0) ((3,3) : PairSlot))) (entropyTerm_zero_ball ((Z6_0_2Half_sound 0) ((3,4) : PairSlot))) Z6_0_2H0E_3_5_sound + · exact forall_fin6 (entropyTerm_zero_ball ((Z6_0_2Half_sound 0) ((4,0) : PairSlot))) (entropyTerm_zero_ball ((Z6_0_2Half_sound 0) ((4,1) : PairSlot))) (entropyTerm_zero_ball ((Z6_0_2Half_sound 0) ((4,2) : PairSlot))) (entropyTerm_zero_ball ((Z6_0_2Half_sound 0) ((4,3) : PairSlot))) Z6_0_2H0E_4_4_sound (entropyTerm_zero_ball ((Z6_0_2Half_sound 0) ((4,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z6_0_2Half_sound 0) ((5,0) : PairSlot))) (entropyTerm_zero_ball ((Z6_0_2Half_sound 0) ((5,1) : PairSlot))) Z6_0_2H0E_5_2_sound Z6_0_2H0E_5_3_sound (entropyTerm_zero_ball ((Z6_0_2Half_sound 0) ((5,4) : PairSlot))) (entropyTerm_zero_ball ((Z6_0_2Half_sound 0) ((5,5) : PairSlot))) +def Z6_0_2H0Entropy : Ball := ⟨(160936937563058337014748091204053 / 100000000000000000000000000000000), (84703295277 / 100000000000000000000000000000000)⟩ +lemma Z6_0_2H0Entropy_sound : Z6_0_2H0Entropy.Encloses (Foundation.finiteEntropy Z6_0_2H0Value) := by + exact contains_sound (entropyPair_enclosed Z6_0_2H0Value Z6_0_2H0Terms Z6_0_2H0Terms_sound) (by decide +kernel) +def Z6_0_2H0Mass : Ball := ⟨(99999999999999999999999999999999 / 100000000000000000000000000000000), (207 / 100000000000000000000000000000000)⟩ +lemma Z6_0_2H0Mass_sound : Z6_0_2H0Mass.Encloses (∑ a, Z6_0_2H0Value a) := by + exact contains_sound (pairSumBall_sound (Z6_0_2Half 0) Z6_0_2H0Value (Z6_0_2Half_sound 0)) (by decide +kernel) +def Z6_0_2H0MassTermLogWitness : LogWitness := ⟨-1, 99999999999999999999999999999999, 50000000000000000000000000000000⟩ +def Z6_0_2H0MassTermLog : Ball := ⟨0, (42351647573 / 100000000000000000000000000000000)⟩ +lemma Z6_0_2H0MassTermLog_sound : Z6_0_2H0MassTermLog.Encloses (Real.log ((∑ a, Z6_0_2H0Value a))) := by + exact checkLog_sound logTwoBall_sound (Z6_0_2H0Mass_sound) (w := Z6_0_2H0MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z6_0_2H0MassTerm : Ball := ⟨0, (21175823787 / 50000000000000000000000000000000)⟩ +lemma Z6_0_2H0MassTerm_sound : Z6_0_2H0MassTerm.Encloses (Foundation.entropyTerm ((∑ a, Z6_0_2H0Value a))) := by + exact contains_sound (entropyTerm_ball (Z6_0_2H0Mass_sound) Z6_0_2H0MassTermLog_sound) (by decide +kernel) +def Z6_0_2H0H : Ball := ⟨(160936937563058337014748091204053 / 100000000000000000000000000000000), (127054942851 / 100000000000000000000000000000000)⟩ +lemma Z6_0_2H0H_sound : Z6_0_2H0H.Encloses (homogeneousEntropy Z6_0_2H0Value) := by + exact contains_sound (homogeneous_enclosed Z6_0_2H0Value Z6_0_2H0MassTerm_sound Z6_0_2H0Entropy_sound) (by decide +kernel) +def Z6_0_2H1Value (a : PairSlot) : ℝ := (halfLaw (shape 6 0 2) 1 a : ℝ) +def Z6_0_2H1E_0_0Log : Ball := .exact 0 +lemma Z6_0_2H1E_0_0Log_sound : Z6_0_2H1E_0_0Log.Encloses (Real.log (Z6_0_2H1Value ((0,0) : PairSlot))) := by + exact log_exact_one_ball ((Z6_0_2Half_sound 1) ((0,0) : PairSlot)) +def Z6_0_2H1E_0_0 : Ball := ⟨0, 0⟩ +lemma Z6_0_2H1E_0_0_sound : Z6_0_2H1E_0_0.Encloses (Foundation.entropyTerm (Z6_0_2H1Value ((0,0) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z6_0_2Half_sound 1) ((0,0) : PairSlot)) Z6_0_2H1E_0_0Log_sound) (by decide +kernel) +def Z6_0_2H1Terms (a : PairSlot) : Ball := + match a.1.val, a.2.val with + | 0, 0 => ⟨0, 0⟩ + | _, _ => (.exact 0) +lemma Z6_0_2H1Terms_sound (a : PairSlot) : + (Z6_0_2H1Terms a).Encloses (Foundation.entropyTerm (Z6_0_2H1Value a)) := by + rcases a with ⟨i,j⟩ + revert j i + apply forall_fin6 + · exact forall_fin6 Z6_0_2H1E_0_0_sound (entropyTerm_zero_ball ((Z6_0_2Half_sound 1) ((0,1) : PairSlot))) (entropyTerm_zero_ball ((Z6_0_2Half_sound 1) ((0,2) : PairSlot))) (entropyTerm_zero_ball ((Z6_0_2Half_sound 1) ((0,3) : PairSlot))) (entropyTerm_zero_ball ((Z6_0_2Half_sound 1) ((0,4) : PairSlot))) (entropyTerm_zero_ball ((Z6_0_2Half_sound 1) ((0,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z6_0_2Half_sound 1) ((1,0) : PairSlot))) (entropyTerm_zero_ball ((Z6_0_2Half_sound 1) ((1,1) : PairSlot))) (entropyTerm_zero_ball ((Z6_0_2Half_sound 1) ((1,2) : PairSlot))) (entropyTerm_zero_ball ((Z6_0_2Half_sound 1) ((1,3) : PairSlot))) (entropyTerm_zero_ball ((Z6_0_2Half_sound 1) ((1,4) : PairSlot))) (entropyTerm_zero_ball ((Z6_0_2Half_sound 1) ((1,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z6_0_2Half_sound 1) ((2,0) : PairSlot))) (entropyTerm_zero_ball ((Z6_0_2Half_sound 1) ((2,1) : PairSlot))) (entropyTerm_zero_ball ((Z6_0_2Half_sound 1) ((2,2) : PairSlot))) (entropyTerm_zero_ball ((Z6_0_2Half_sound 1) ((2,3) : PairSlot))) (entropyTerm_zero_ball ((Z6_0_2Half_sound 1) ((2,4) : PairSlot))) (entropyTerm_zero_ball ((Z6_0_2Half_sound 1) ((2,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z6_0_2Half_sound 1) ((3,0) : PairSlot))) (entropyTerm_zero_ball ((Z6_0_2Half_sound 1) ((3,1) : PairSlot))) (entropyTerm_zero_ball ((Z6_0_2Half_sound 1) ((3,2) : PairSlot))) (entropyTerm_zero_ball ((Z6_0_2Half_sound 1) ((3,3) : PairSlot))) (entropyTerm_zero_ball ((Z6_0_2Half_sound 1) ((3,4) : PairSlot))) (entropyTerm_zero_ball ((Z6_0_2Half_sound 1) ((3,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z6_0_2Half_sound 1) ((4,0) : PairSlot))) (entropyTerm_zero_ball ((Z6_0_2Half_sound 1) ((4,1) : PairSlot))) (entropyTerm_zero_ball ((Z6_0_2Half_sound 1) ((4,2) : PairSlot))) (entropyTerm_zero_ball ((Z6_0_2Half_sound 1) ((4,3) : PairSlot))) (entropyTerm_zero_ball ((Z6_0_2Half_sound 1) ((4,4) : PairSlot))) (entropyTerm_zero_ball ((Z6_0_2Half_sound 1) ((4,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z6_0_2Half_sound 1) ((5,0) : PairSlot))) (entropyTerm_zero_ball ((Z6_0_2Half_sound 1) ((5,1) : PairSlot))) (entropyTerm_zero_ball ((Z6_0_2Half_sound 1) ((5,2) : PairSlot))) (entropyTerm_zero_ball ((Z6_0_2Half_sound 1) ((5,3) : PairSlot))) (entropyTerm_zero_ball ((Z6_0_2Half_sound 1) ((5,4) : PairSlot))) (entropyTerm_zero_ball ((Z6_0_2Half_sound 1) ((5,5) : PairSlot))) +def Z6_0_2H1Entropy : Ball := ⟨0, 0⟩ +lemma Z6_0_2H1Entropy_sound : Z6_0_2H1Entropy.Encloses (Foundation.finiteEntropy Z6_0_2H1Value) := by + exact contains_sound (entropyPair_enclosed Z6_0_2H1Value Z6_0_2H1Terms Z6_0_2H1Terms_sound) (by decide +kernel) +def Z6_0_2H1Mass : Ball := ⟨1, 0⟩ +lemma Z6_0_2H1Mass_sound : Z6_0_2H1Mass.Encloses (∑ a, Z6_0_2H1Value a) := by + exact contains_sound (pairSumBall_sound (Z6_0_2Half 1) Z6_0_2H1Value (Z6_0_2Half_sound 1)) (by decide +kernel) +def Z6_0_2H1MassTermLog : Ball := .exact 0 +lemma Z6_0_2H1MassTermLog_sound : Z6_0_2H1MassTermLog.Encloses (Real.log ((∑ a, Z6_0_2H1Value a))) := by + exact log_exact_one_ball (Z6_0_2H1Mass_sound) +def Z6_0_2H1MassTerm : Ball := ⟨0, 0⟩ +lemma Z6_0_2H1MassTerm_sound : Z6_0_2H1MassTerm.Encloses (Foundation.entropyTerm ((∑ a, Z6_0_2H1Value a))) := by + exact contains_sound (entropyTerm_ball (Z6_0_2H1Mass_sound) Z6_0_2H1MassTermLog_sound) (by decide +kernel) +def Z6_0_2H1H : Ball := ⟨0, 0⟩ +lemma Z6_0_2H1H_sound : Z6_0_2H1H.Encloses (homogeneousEntropy Z6_0_2H1Value) := by + exact contains_sound (homogeneous_enclosed Z6_0_2H1Value Z6_0_2H1MassTerm_sound Z6_0_2H1Entropy_sound) (by decide +kernel) +def Z6_0_2H2Value (a : PairSlot) : ℝ := (halfLaw (shape 6 0 2) 2 a : ℝ) +def Z6_0_2H2E_2_0LogWitness : LogWitness := ⟨-3, 19726120793130810407094355236181, 12500000000000000000000000000000⟩ +def Z6_0_2H2E_2_0Log : Ball := ⟨(-6492905999703497484642802902389 / 4000000000000000000000000000000), (16940658993 / 20000000000000000000000000000000)⟩ +lemma Z6_0_2H2E_2_0Log_sound : Z6_0_2H2E_2_0Log.Encloses (Real.log (Z6_0_2H2Value ((2,0) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound ((Z6_0_2Half_sound 2) ((2,0) : PairSlot)) (w := Z6_0_2H2E_2_0LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z6_0_2H2E_2_0 : Ball := ⟨(4002495251518592288865068392969 / 12500000000000000000000000000000), (4177168589 / 25000000000000000000000000000000)⟩ +lemma Z6_0_2H2E_2_0_sound : Z6_0_2H2E_2_0.Encloses (Foundation.entropyTerm (Z6_0_2H2Value ((2,0) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z6_0_2Half_sound 2) ((2,0) : PairSlot)) Z6_0_2H2E_2_0Log_sound) (by decide +kernel) +def Z6_0_2H2E_3_0LogWitness : LogWitness := ⟨-3, 20245725524523564193484784547927, 12500000000000000000000000000000⟩ +def Z6_0_2H2E_3_0Log : Ball := ⟨(-79861324996293718558035036279851 / 50000000000000000000000000000000), (21175823741 / 25000000000000000000000000000000)⟩ +lemma Z6_0_2H2E_3_0Log_sound : Z6_0_2H2E_3_0Log.Encloses (Real.log (Z6_0_2H2Value ((3,0) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound ((Z6_0_2Half_sound 2) ((3,0) : PairSlot)) (w := Z6_0_2H2E_3_0LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z6_0_2H2E_3_0 : Ball := ⟨(6467401863598941893694372777521 / 20000000000000000000000000000000), (3429759337 / 20000000000000000000000000000000)⟩ +lemma Z6_0_2H2E_3_0_sound : Z6_0_2H2E_3_0.Encloses (Foundation.entropyTerm (Z6_0_2H2Value ((3,0) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z6_0_2Half_sound 2) ((3,0) : PairSlot)) Z6_0_2H2E_3_0Log_sound) (by decide +kernel) +def Z6_0_2H2E_1_1LogWitness : LogWitness := ⟨-3, 20056307364691250798841720431783, 12500000000000000000000000000000⟩ +def Z6_0_2H2E_1_1Log : Ball := ⟨(-160662649992587437116070072559717 / 100000000000000000000000000000000), (21175823709 / 25000000000000000000000000000000)⟩ +lemma Z6_0_2H2E_1_1Log_sound : Z6_0_2H2E_1_1Log.Encloses (Real.log (Z6_0_2H2Value ((1,1) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound ((Z6_0_2Half_sound 2) ((1,1) : PairSlot)) (w := Z6_0_2H2E_1_1LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z6_0_2H2E_1_1 : Ball := ⟨(32222994902771441455963269141339 / 100000000000000000000000000000000), (3397670639 / 20000000000000000000000000000000)⟩ +lemma Z6_0_2H2E_1_1_sound : Z6_0_2H2E_1_1.Encloses (Foundation.entropyTerm (Z6_0_2H2Value ((1,1) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z6_0_2Half_sound 2) ((1,1) : PairSlot)) Z6_0_2H2E_1_1Log_sound) (by decide +kernel) +def Z6_0_2H2E_0_2LogWitness : LogWitness := ⟨-3, 19726120793130810407094355236181, 12500000000000000000000000000000⟩ +def Z6_0_2H2E_0_2Log : Ball := ⟨(-6492905999703497484642802902389 / 4000000000000000000000000000000), (16940658993 / 20000000000000000000000000000000)⟩ +lemma Z6_0_2H2E_0_2Log_sound : Z6_0_2H2E_0_2Log.Encloses (Real.log (Z6_0_2H2Value ((0,2) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound ((Z6_0_2Half_sound 2) ((0,2) : PairSlot)) (w := Z6_0_2H2E_0_2LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z6_0_2H2E_0_2 : Ball := ⟨(4002495251518592288865068392969 / 12500000000000000000000000000000), (4177168589 / 25000000000000000000000000000000)⟩ +lemma Z6_0_2H2E_0_2_sound : Z6_0_2H2E_0_2.Encloses (Foundation.entropyTerm (Z6_0_2H2Value ((0,2) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z6_0_2Half_sound 2) ((0,2) : PairSlot)) Z6_0_2H2E_0_2Log_sound) (by decide +kernel) +def Z6_0_2H2E_0_3LogWitness : LogWitness := ⟨-3, 20245725524523564193484784547927, 12500000000000000000000000000000⟩ +def Z6_0_2H2E_0_3Log : Ball := ⟨(-79861324996293718558035036279851 / 50000000000000000000000000000000), (21175823741 / 25000000000000000000000000000000)⟩ +lemma Z6_0_2H2E_0_3Log_sound : Z6_0_2H2E_0_3Log.Encloses (Real.log (Z6_0_2H2Value ((0,3) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound ((Z6_0_2Half_sound 2) ((0,3) : PairSlot)) (w := Z6_0_2H2E_0_3LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z6_0_2H2E_0_3 : Ball := ⟨(6467401863598941893694372777521 / 20000000000000000000000000000000), (3429759337 / 20000000000000000000000000000000)⟩ +lemma Z6_0_2H2E_0_3_sound : Z6_0_2H2E_0_3.Encloses (Foundation.entropyTerm (Z6_0_2H2Value ((0,3) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z6_0_2Half_sound 2) ((0,3) : PairSlot)) Z6_0_2H2E_0_3Log_sound) (by decide +kernel) +def Z6_0_2H2Terms (a : PairSlot) : Ball := + match a.1.val, a.2.val with + | 2, 0 => ⟨(4002495251518592288865068392969 / 12500000000000000000000000000000), (4177168589 / 25000000000000000000000000000000)⟩ + | 3, 0 => ⟨(6467401863598941893694372777521 / 20000000000000000000000000000000), (3429759337 / 20000000000000000000000000000000)⟩ + | 1, 1 => ⟨(32222994902771441455963269141339 / 100000000000000000000000000000000), (3397670639 / 20000000000000000000000000000000)⟩ + | 0, 2 => ⟨(4002495251518592288865068392969 / 12500000000000000000000000000000), (4177168589 / 25000000000000000000000000000000)⟩ + | 0, 3 => ⟨(6467401863598941893694372777521 / 20000000000000000000000000000000), (3429759337 / 20000000000000000000000000000000)⟩ + | _, _ => (.exact 0) +lemma Z6_0_2H2Terms_sound (a : PairSlot) : + (Z6_0_2H2Terms a).Encloses (Foundation.entropyTerm (Z6_0_2H2Value a)) := by + rcases a with ⟨i,j⟩ + revert j i + apply forall_fin6 + · exact forall_fin6 (entropyTerm_zero_ball ((Z6_0_2Half_sound 2) ((0,0) : PairSlot))) (entropyTerm_zero_ball ((Z6_0_2Half_sound 2) ((0,1) : PairSlot))) Z6_0_2H2E_0_2_sound Z6_0_2H2E_0_3_sound (entropyTerm_zero_ball ((Z6_0_2Half_sound 2) ((0,4) : PairSlot))) (entropyTerm_zero_ball ((Z6_0_2Half_sound 2) ((0,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z6_0_2Half_sound 2) ((1,0) : PairSlot))) Z6_0_2H2E_1_1_sound (entropyTerm_zero_ball ((Z6_0_2Half_sound 2) ((1,2) : PairSlot))) (entropyTerm_zero_ball ((Z6_0_2Half_sound 2) ((1,3) : PairSlot))) (entropyTerm_zero_ball ((Z6_0_2Half_sound 2) ((1,4) : PairSlot))) (entropyTerm_zero_ball ((Z6_0_2Half_sound 2) ((1,5) : PairSlot))) + · exact forall_fin6 Z6_0_2H2E_2_0_sound (entropyTerm_zero_ball ((Z6_0_2Half_sound 2) ((2,1) : PairSlot))) (entropyTerm_zero_ball ((Z6_0_2Half_sound 2) ((2,2) : PairSlot))) (entropyTerm_zero_ball ((Z6_0_2Half_sound 2) ((2,3) : PairSlot))) (entropyTerm_zero_ball ((Z6_0_2Half_sound 2) ((2,4) : PairSlot))) (entropyTerm_zero_ball ((Z6_0_2Half_sound 2) ((2,5) : PairSlot))) + · exact forall_fin6 Z6_0_2H2E_3_0_sound (entropyTerm_zero_ball ((Z6_0_2Half_sound 2) ((3,1) : PairSlot))) (entropyTerm_zero_ball ((Z6_0_2Half_sound 2) ((3,2) : PairSlot))) (entropyTerm_zero_ball ((Z6_0_2Half_sound 2) ((3,3) : PairSlot))) (entropyTerm_zero_ball ((Z6_0_2Half_sound 2) ((3,4) : PairSlot))) (entropyTerm_zero_ball ((Z6_0_2Half_sound 2) ((3,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z6_0_2Half_sound 2) ((4,0) : PairSlot))) (entropyTerm_zero_ball ((Z6_0_2Half_sound 2) ((4,1) : PairSlot))) (entropyTerm_zero_ball ((Z6_0_2Half_sound 2) ((4,2) : PairSlot))) (entropyTerm_zero_ball ((Z6_0_2Half_sound 2) ((4,3) : PairSlot))) (entropyTerm_zero_ball ((Z6_0_2Half_sound 2) ((4,4) : PairSlot))) (entropyTerm_zero_ball ((Z6_0_2Half_sound 2) ((4,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z6_0_2Half_sound 2) ((5,0) : PairSlot))) (entropyTerm_zero_ball ((Z6_0_2Half_sound 2) ((5,1) : PairSlot))) (entropyTerm_zero_ball ((Z6_0_2Half_sound 2) ((5,2) : PairSlot))) (entropyTerm_zero_ball ((Z6_0_2Half_sound 2) ((5,3) : PairSlot))) (entropyTerm_zero_ball ((Z6_0_2Half_sound 2) ((5,4) : PairSlot))) (entropyTerm_zero_ball ((Z6_0_2Half_sound 2) ((5,5) : PairSlot))) +def Z6_0_2H2Entropy : Ball := ⟨(160936937563058337014748091204053 / 100000000000000000000000000000000), (84703295277 / 100000000000000000000000000000000)⟩ +lemma Z6_0_2H2Entropy_sound : Z6_0_2H2Entropy.Encloses (Foundation.finiteEntropy Z6_0_2H2Value) := by + exact contains_sound (entropyPair_enclosed Z6_0_2H2Value Z6_0_2H2Terms Z6_0_2H2Terms_sound) (by decide +kernel) +def Z6_0_2H2Mass : Ball := ⟨(99999999999999999999999999999999 / 100000000000000000000000000000000), (207 / 100000000000000000000000000000000)⟩ +lemma Z6_0_2H2Mass_sound : Z6_0_2H2Mass.Encloses (∑ a, Z6_0_2H2Value a) := by + exact contains_sound (pairSumBall_sound (Z6_0_2Half 2) Z6_0_2H2Value (Z6_0_2Half_sound 2)) (by decide +kernel) +def Z6_0_2H2MassTermLogWitness : LogWitness := ⟨-1, 99999999999999999999999999999999, 50000000000000000000000000000000⟩ +def Z6_0_2H2MassTermLog : Ball := ⟨0, (42351647573 / 100000000000000000000000000000000)⟩ +lemma Z6_0_2H2MassTermLog_sound : Z6_0_2H2MassTermLog.Encloses (Real.log ((∑ a, Z6_0_2H2Value a))) := by + exact checkLog_sound logTwoBall_sound (Z6_0_2H2Mass_sound) (w := Z6_0_2H2MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z6_0_2H2MassTerm : Ball := ⟨0, (21175823787 / 50000000000000000000000000000000)⟩ +lemma Z6_0_2H2MassTerm_sound : Z6_0_2H2MassTerm.Encloses (Foundation.entropyTerm ((∑ a, Z6_0_2H2Value a))) := by + exact contains_sound (entropyTerm_ball (Z6_0_2H2Mass_sound) Z6_0_2H2MassTermLog_sound) (by decide +kernel) +def Z6_0_2H2H : Ball := ⟨(160936937563058337014748091204053 / 100000000000000000000000000000000), (127054942851 / 100000000000000000000000000000000)⟩ +lemma Z6_0_2H2H_sound : Z6_0_2H2H.Encloses (homogeneousEntropy Z6_0_2H2Value) := by + exact contains_sound (homogeneous_enclosed Z6_0_2H2Value Z6_0_2H2MassTerm_sound Z6_0_2H2Entropy_sound) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/Certificates/Four6_2_0.lean b/lean/OAI/LinearAlgebra/MatrixFields/Certificates/Four6_2_0.lean new file mode 100644 index 0000000000000000000000000000000000000000..db8fbafa4ec6c25c45940dbaeab567c7ecc4597f --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/Certificates/Four6_2_0.lean @@ -0,0 +1,554 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Certificates.Zero0_1_7 + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def Z6_2_0Raw (ij : PairSlot) : Ball := + match ij.1.val, ij.2.val with + | 0, 0 => w195 + | 0, 1 => w195 + | 0, 2 => w195 + | 0, 3 => w195 + | 0, 4 => w195 + | 0, 5 => w195 + | 1, 0 => w195 + | 1, 1 => w195 + | 1, 2 => w195 + | 1, 3 => w195 + | 1, 4 => w195 + | 1, 5 => w195 + | 2, 0 => w195 + | 2, 1 => w195 + | 2, 2 => w195 + | 2, 3 => w195 + | 2, 4 => w195 + | 2, 5 => w194 + | 3, 0 => w195 + | 3, 1 => w195 + | 3, 2 => w195 + | 3, 3 => w195 + | 3, 4 => w195 + | 3, 5 => w196 + | 4, 0 => w195 + | 4, 1 => w195 + | 4, 2 => w195 + | 4, 3 => w195 + | 4, 4 => w195 + | 4, 5 => w195 + | 5, 0 => w195 + | 5, 1 => w195 + | 5, 2 => w194 + | 5, 3 => w196 + | 5, 4 => w195 + | 5, 5 => w195 + | _, _ => (.exact 0) +lemma Z6_2_0Raw_sound_0 (j : Fin 6) : + (Z6_2_0Raw (0,j)).Encloses (weight (orderedPairInteger (shape 6 2 0) 0 j) : ℝ) := by + fin_cases j + · change (Z6_2_0Raw (0,0)).Encloses (weight (orderedPairInteger (shape 6 2 0) 0 0) : ℝ) + have he : orderedPairInteger (shape 6 2 0) 0 0 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z6_2_0Raw (0,1)).Encloses (weight (orderedPairInteger (shape 6 2 0) 0 1) : ℝ) + have he : orderedPairInteger (shape 6 2 0) 0 1 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z6_2_0Raw (0,2)).Encloses (weight (orderedPairInteger (shape 6 2 0) 0 2) : ℝ) + have he : orderedPairInteger (shape 6 2 0) 0 2 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z6_2_0Raw (0,3)).Encloses (weight (orderedPairInteger (shape 6 2 0) 0 3) : ℝ) + have he : orderedPairInteger (shape 6 2 0) 0 3 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z6_2_0Raw (0,4)).Encloses (weight (orderedPairInteger (shape 6 2 0) 0 4) : ℝ) + have he : orderedPairInteger (shape 6 2 0) 0 4 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z6_2_0Raw (0,5)).Encloses (weight (orderedPairInteger (shape 6 2 0) 0 5) : ℝ) + have he : orderedPairInteger (shape 6 2 0) 0 5 = (0) := by decide +kernel + rw [he] + exact w195_sound +lemma Z6_2_0Raw_sound_1 (j : Fin 6) : + (Z6_2_0Raw (1,j)).Encloses (weight (orderedPairInteger (shape 6 2 0) 1 j) : ℝ) := by + fin_cases j + · change (Z6_2_0Raw (1,0)).Encloses (weight (orderedPairInteger (shape 6 2 0) 1 0) : ℝ) + have he : orderedPairInteger (shape 6 2 0) 1 0 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z6_2_0Raw (1,1)).Encloses (weight (orderedPairInteger (shape 6 2 0) 1 1) : ℝ) + have he : orderedPairInteger (shape 6 2 0) 1 1 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z6_2_0Raw (1,2)).Encloses (weight (orderedPairInteger (shape 6 2 0) 1 2) : ℝ) + have he : orderedPairInteger (shape 6 2 0) 1 2 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z6_2_0Raw (1,3)).Encloses (weight (orderedPairInteger (shape 6 2 0) 1 3) : ℝ) + have he : orderedPairInteger (shape 6 2 0) 1 3 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z6_2_0Raw (1,4)).Encloses (weight (orderedPairInteger (shape 6 2 0) 1 4) : ℝ) + have he : orderedPairInteger (shape 6 2 0) 1 4 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z6_2_0Raw (1,5)).Encloses (weight (orderedPairInteger (shape 6 2 0) 1 5) : ℝ) + have he : orderedPairInteger (shape 6 2 0) 1 5 = (0) := by decide +kernel + rw [he] + exact w195_sound +lemma Z6_2_0Raw_sound_2 (j : Fin 6) : + (Z6_2_0Raw (2,j)).Encloses (weight (orderedPairInteger (shape 6 2 0) 2 j) : ℝ) := by + fin_cases j + · change (Z6_2_0Raw (2,0)).Encloses (weight (orderedPairInteger (shape 6 2 0) 2 0) : ℝ) + have he : orderedPairInteger (shape 6 2 0) 2 0 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z6_2_0Raw (2,1)).Encloses (weight (orderedPairInteger (shape 6 2 0) 2 1) : ℝ) + have he : orderedPairInteger (shape 6 2 0) 2 1 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z6_2_0Raw (2,2)).Encloses (weight (orderedPairInteger (shape 6 2 0) 2 2) : ℝ) + have he : orderedPairInteger (shape 6 2 0) 2 2 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z6_2_0Raw (2,3)).Encloses (weight (orderedPairInteger (shape 6 2 0) 2 3) : ℝ) + have he : orderedPairInteger (shape 6 2 0) 2 3 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z6_2_0Raw (2,4)).Encloses (weight (orderedPairInteger (shape 6 2 0) 2 4) : ℝ) + have he : orderedPairInteger (shape 6 2 0) 2 4 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z6_2_0Raw (2,5)).Encloses (weight (orderedPairInteger (shape 6 2 0) 2 5) : ℝ) + have he : orderedPairInteger (shape 6 2 0) 2 5 = (-52) := by decide +kernel + rw [he] + exact w194_sound +lemma Z6_2_0Raw_sound_3 (j : Fin 6) : + (Z6_2_0Raw (3,j)).Encloses (weight (orderedPairInteger (shape 6 2 0) 3 j) : ℝ) := by + fin_cases j + · change (Z6_2_0Raw (3,0)).Encloses (weight (orderedPairInteger (shape 6 2 0) 3 0) : ℝ) + have he : orderedPairInteger (shape 6 2 0) 3 0 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z6_2_0Raw (3,1)).Encloses (weight (orderedPairInteger (shape 6 2 0) 3 1) : ℝ) + have he : orderedPairInteger (shape 6 2 0) 3 1 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z6_2_0Raw (3,2)).Encloses (weight (orderedPairInteger (shape 6 2 0) 3 2) : ℝ) + have he : orderedPairInteger (shape 6 2 0) 3 2 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z6_2_0Raw (3,3)).Encloses (weight (orderedPairInteger (shape 6 2 0) 3 3) : ℝ) + have he : orderedPairInteger (shape 6 2 0) 3 3 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z6_2_0Raw (3,4)).Encloses (weight (orderedPairInteger (shape 6 2 0) 3 4) : ℝ) + have he : orderedPairInteger (shape 6 2 0) 3 4 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z6_2_0Raw (3,5)).Encloses (weight (orderedPairInteger (shape 6 2 0) 3 5) : ℝ) + have he : orderedPairInteger (shape 6 2 0) 3 5 = (17) := by decide +kernel + rw [he] + exact w196_sound +lemma Z6_2_0Raw_sound_4 (j : Fin 6) : + (Z6_2_0Raw (4,j)).Encloses (weight (orderedPairInteger (shape 6 2 0) 4 j) : ℝ) := by + fin_cases j + · change (Z6_2_0Raw (4,0)).Encloses (weight (orderedPairInteger (shape 6 2 0) 4 0) : ℝ) + have he : orderedPairInteger (shape 6 2 0) 4 0 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z6_2_0Raw (4,1)).Encloses (weight (orderedPairInteger (shape 6 2 0) 4 1) : ℝ) + have he : orderedPairInteger (shape 6 2 0) 4 1 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z6_2_0Raw (4,2)).Encloses (weight (orderedPairInteger (shape 6 2 0) 4 2) : ℝ) + have he : orderedPairInteger (shape 6 2 0) 4 2 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z6_2_0Raw (4,3)).Encloses (weight (orderedPairInteger (shape 6 2 0) 4 3) : ℝ) + have he : orderedPairInteger (shape 6 2 0) 4 3 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z6_2_0Raw (4,4)).Encloses (weight (orderedPairInteger (shape 6 2 0) 4 4) : ℝ) + have he : orderedPairInteger (shape 6 2 0) 4 4 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z6_2_0Raw (4,5)).Encloses (weight (orderedPairInteger (shape 6 2 0) 4 5) : ℝ) + have he : orderedPairInteger (shape 6 2 0) 4 5 = (0) := by decide +kernel + rw [he] + exact w195_sound +lemma Z6_2_0Raw_sound_5 (j : Fin 6) : + (Z6_2_0Raw (5,j)).Encloses (weight (orderedPairInteger (shape 6 2 0) 5 j) : ℝ) := by + fin_cases j + · change (Z6_2_0Raw (5,0)).Encloses (weight (orderedPairInteger (shape 6 2 0) 5 0) : ℝ) + have he : orderedPairInteger (shape 6 2 0) 5 0 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z6_2_0Raw (5,1)).Encloses (weight (orderedPairInteger (shape 6 2 0) 5 1) : ℝ) + have he : orderedPairInteger (shape 6 2 0) 5 1 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z6_2_0Raw (5,2)).Encloses (weight (orderedPairInteger (shape 6 2 0) 5 2) : ℝ) + have he : orderedPairInteger (shape 6 2 0) 5 2 = (-52) := by decide +kernel + rw [he] + exact w194_sound + · change (Z6_2_0Raw (5,3)).Encloses (weight (orderedPairInteger (shape 6 2 0) 5 3) : ℝ) + have he : orderedPairInteger (shape 6 2 0) 5 3 = (17) := by decide +kernel + rw [he] + exact w196_sound + · change (Z6_2_0Raw (5,4)).Encloses (weight (orderedPairInteger (shape 6 2 0) 5 4) : ℝ) + have he : orderedPairInteger (shape 6 2 0) 5 4 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z6_2_0Raw (5,5)).Encloses (weight (orderedPairInteger (shape 6 2 0) 5 5) : ℝ) + have he : orderedPairInteger (shape 6 2 0) 5 5 = (0) := by decide +kernel + rw [he] + exact w195_sound +lemma Z6_2_0Raw_sound (ij : PairSlot) : + (Z6_2_0Raw ij).Encloses (weight (orderedPairInteger (shape 6 2 0) ij.1 ij.2) : ℝ) := by + rcases ij with ⟨i,j⟩ + revert i + exact forall_fin6 (Z6_2_0Raw_sound_0 j) (Z6_2_0Raw_sound_1 j) (Z6_2_0Raw_sound_2 j) (Z6_2_0Raw_sound_3 j) (Z6_2_0Raw_sound_4 j) (Z6_2_0Raw_sound_5 j) +def Z6_2_0Den : Ball := ⟨(249651494241494819962441097012029 / 50000000000000000000000000000000), (127 / 25000000000000000000000000000000)⟩ +lemma Z6_2_0Den_sound : Z6_2_0Den.Encloses + (((orderedPairs (shape 6 2 0)).map (fun ij => weight (orderedPairInteger (shape 6 2 0) ij.1 ij.2))).sum : ℝ) := by + exact contains_sound (list_cast_enclosed (orderedPairs (shape 6 2 0)) Z6_2_0Raw + (fun ij => weight (orderedPairInteger (shape 6 2 0) ij.1 ij.2)) + (fun ij _ => Z6_2_0Raw_sound ij)) (by decide +kernel) +lemma Z6_2_0Den_pos : 0 < Z6_2_0Den.lower := by decide +kernel +def Z6_2_0Probs (ij : PairSlot) : Ball := + match ij.1.val, ij.2.val with + | 2, 5 => ⟨(19924044508891583790197036118597 / 100000000000000000000000000000000), (47 / 100000000000000000000000000000000)⟩ + | 3, 5 => ⟨(4012399160127629130320676344027 / 20000000000000000000000000000000), (47 / 100000000000000000000000000000000)⟩ + | 4, 4 => ⟨(10013959690470270558199582161267 / 50000000000000000000000000000000), (21 / 100000000000000000000000000000000)⟩ + | 5, 2 => ⟨(19924044508891583790197036118597 / 100000000000000000000000000000000), (47 / 100000000000000000000000000000000)⟩ + | 5, 3 => ⟨(4012399160127629130320676344027 / 20000000000000000000000000000000), (47 / 100000000000000000000000000000000)⟩ + | _, _ => (.exact 0) +lemma Z6_2_0Contains : ∀ i j : Fin 6, + statisticWeight i + statisticWeight j = shapeMax (shape 6 2 0) → + contains (.mul (Z6_2_0Raw (i,j)) (.inv Z6_2_0Den)) (Z6_2_0Probs (i,j)) = true := by + decide +kernel +lemma Z6_2_0Zero : ∀ i j : Fin 6, + statisticWeight i + statisticWeight j ≠ shapeMax (shape 6 2 0) → Z6_2_0Probs (i,j) = .exact 0 := by + decide +kernel +lemma Z6_2_0Probs_sound (ij : PairSlot) : + (Z6_2_0Probs ij).Encloses (zeroPairLaw (shape 6 2 0) ij.1 ij.2 : ℝ) := by + by_cases h : statisticWeight ij.1 + statisticWeight ij.2 = shapeMax (shape 6 2 0) + · have hb := contains_sound (Ball.mul_sound (Z6_2_0Raw_sound ij) + (Ball.inv_sound Z6_2_0Den_sound Z6_2_0Den_pos)) (Z6_2_0Contains ij.1 ij.2 h) + simpa only [zeroPairLaw, h, ite_true, Rat.cast_div, Rat.cast_mul, + Rat.cast_inv, div_eq_mul_inv] using hb + · rw [Z6_2_0Zero ij.1 ij.2 h] + simpa only [zeroPairLaw, h, ite_false] using Ball.exact_sound 0 + +def Z6_2_0Half (w : Fin 3) (ij : PairSlot) : Ball := + if (shape 6 2 0) w = 0 then if ij = (0,0) then .exact 1 else .exact 0 + else if w = halfMaxAxis (shape 6 2 0) then Z6_2_0Probs ij + else Z6_2_0Probs (kappa ij.1, kappa ij.2) +lemma Z6_2_0Half_sound (w : Fin 3) (ij : PairSlot) : + (Z6_2_0Half w ij).Encloses (halfLaw (shape 6 2 0) w ij : ℝ) := by + have hp : positive (shape 6 2 0) = false := by decide +kernel + simp only [Z6_2_0Half, halfLaw, hp, Bool.false_eq_true, ite_false] + split_ifs + · exact Ball.exact_sound 1 + · exact Ball.exact_sound 0 + · exact Z6_2_0Probs_sound _ + · exact Z6_2_0Probs_sound _ + +def Z6_2_0Value (a : PairSlot) : ℝ := (zeroPairLaw (shape 6 2 0) a.1 a.2 : ℝ) +def Z6_2_0E_2_5LogWitness : LogWitness := ⟨-3, 19924044508891583790197036118597, 12500000000000000000000000000000⟩ +def Z6_2_0E_2_5Log : Ball := ⟨(-3226485833692046100593323447671 / 2000000000000000000000000000000), (84703294967 / 100000000000000000000000000000000)⟩ +lemma Z6_2_0E_2_5Log_sound : Z6_2_0E_2_5Log.Encloses (Real.log (Z6_2_0Value ((2,5) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound (Z6_2_0Probs_sound ((2,5) : PairSlot)) (w := Z6_2_0E_2_5LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z6_2_0E_2_5 : Ball := ⟨(32142323678894247471214709989819 / 100000000000000000000000000000000), (8438161133 / 50000000000000000000000000000000)⟩ +lemma Z6_2_0E_2_5_sound : Z6_2_0E_2_5.Encloses (Foundation.entropyTerm (Z6_2_0Value ((2,5) : PairSlot))) := by + exact contains_sound (entropyTerm_ball (Z6_2_0Probs_sound ((2,5) : PairSlot)) Z6_2_0E_2_5Log_sound) (by decide +kernel) +def Z6_2_0E_3_5LogWitness : LogWitness := ⟨-3, 4012399160127629130320676344027, 2500000000000000000000000000000⟩ +def Z6_2_0E_3_5Log : Ball := ⟨(-160634291684602305029666172383581 / 100000000000000000000000000000000), (42351647483 / 50000000000000000000000000000000)⟩ +lemma Z6_2_0E_3_5Log_sound : Z6_2_0E_3_5Log.Encloses (Real.log (Z6_2_0Value ((3,5) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound (Z6_2_0Probs_sound ((3,5) : PairSlot)) (w := Z6_2_0E_3_5LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z6_2_0E_3_5 : Ball := ⟨(32226444852149744429123998456101 / 100000000000000000000000000000000), (4248292889 / 25000000000000000000000000000000)⟩ +lemma Z6_2_0E_3_5_sound : Z6_2_0E_3_5.Encloses (Foundation.entropyTerm (Z6_2_0Value ((3,5) : PairSlot))) := by + exact contains_sound (entropyTerm_ball (Z6_2_0Probs_sound ((3,5) : PairSlot)) Z6_2_0E_3_5Log_sound) (by decide +kernel) +def Z6_2_0E_4_4LogWitness : LogWitness := ⟨-3, 10013959690470270558199582161267, 6250000000000000000000000000000⟩ +def Z6_2_0E_4_4Log : Ball := ⟨(-160804291684602305029666172383561 / 100000000000000000000000000000000), (21175823709 / 25000000000000000000000000000000)⟩ +lemma Z6_2_0E_4_4Log_sound : Z6_2_0E_4_4Log.Encloses (Real.log (Z6_2_0Value ((4,4) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound (Z6_2_0Probs_sound ((4,4) : PairSlot)) (w := Z6_2_0E_4_4LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z6_2_0E_4_4 : Ball := ⟨(8051438474921156001297838292377 / 25000000000000000000000000000000), (16964307637 / 100000000000000000000000000000000)⟩ +lemma Z6_2_0E_4_4_sound : Z6_2_0E_4_4.Encloses (Foundation.entropyTerm (Z6_2_0Value ((4,4) : PairSlot))) := by + exact contains_sound (entropyTerm_ball (Z6_2_0Probs_sound ((4,4) : PairSlot)) Z6_2_0E_4_4Log_sound) (by decide +kernel) +def Z6_2_0E_5_2LogWitness : LogWitness := ⟨-3, 19924044508891583790197036118597, 12500000000000000000000000000000⟩ +def Z6_2_0E_5_2Log : Ball := ⟨(-3226485833692046100593323447671 / 2000000000000000000000000000000), (84703294967 / 100000000000000000000000000000000)⟩ +lemma Z6_2_0E_5_2Log_sound : Z6_2_0E_5_2Log.Encloses (Real.log (Z6_2_0Value ((5,2) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound (Z6_2_0Probs_sound ((5,2) : PairSlot)) (w := Z6_2_0E_5_2LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z6_2_0E_5_2 : Ball := ⟨(32142323678894247471214709989819 / 100000000000000000000000000000000), (8438161133 / 50000000000000000000000000000000)⟩ +lemma Z6_2_0E_5_2_sound : Z6_2_0E_5_2.Encloses (Foundation.entropyTerm (Z6_2_0Value ((5,2) : PairSlot))) := by + exact contains_sound (entropyTerm_ball (Z6_2_0Probs_sound ((5,2) : PairSlot)) Z6_2_0E_5_2Log_sound) (by decide +kernel) +def Z6_2_0E_5_3LogWitness : LogWitness := ⟨-3, 4012399160127629130320676344027, 2500000000000000000000000000000⟩ +def Z6_2_0E_5_3Log : Ball := ⟨(-160634291684602305029666172383581 / 100000000000000000000000000000000), (42351647483 / 50000000000000000000000000000000)⟩ +lemma Z6_2_0E_5_3Log_sound : Z6_2_0E_5_3Log.Encloses (Real.log (Z6_2_0Value ((5,3) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound (Z6_2_0Probs_sound ((5,3) : PairSlot)) (w := Z6_2_0E_5_3LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z6_2_0E_5_3 : Ball := ⟨(32226444852149744429123998456101 / 100000000000000000000000000000000), (4248292889 / 25000000000000000000000000000000)⟩ +lemma Z6_2_0E_5_3_sound : Z6_2_0E_5_3.Encloses (Foundation.entropyTerm (Z6_2_0Value ((5,3) : PairSlot))) := by + exact contains_sound (entropyTerm_ball (Z6_2_0Probs_sound ((5,3) : PairSlot)) Z6_2_0E_5_3Log_sound) (by decide +kernel) +def Z6_2_0Terms (a : PairSlot) : Ball := + match a.1.val, a.2.val with + | 2, 5 => ⟨(32142323678894247471214709989819 / 100000000000000000000000000000000), (8438161133 / 50000000000000000000000000000000)⟩ + | 3, 5 => ⟨(32226444852149744429123998456101 / 100000000000000000000000000000000), (4248292889 / 25000000000000000000000000000000)⟩ + | 4, 4 => ⟨(8051438474921156001297838292377 / 25000000000000000000000000000000), (16964307637 / 100000000000000000000000000000000)⟩ + | 5, 2 => ⟨(32142323678894247471214709989819 / 100000000000000000000000000000000), (8438161133 / 50000000000000000000000000000000)⟩ + | 5, 3 => ⟨(32226444852149744429123998456101 / 100000000000000000000000000000000), (4248292889 / 25000000000000000000000000000000)⟩ + | _, _ => (.exact 0) +lemma Z6_2_0Terms_sound (a : PairSlot) : + (Z6_2_0Terms a).Encloses (Foundation.entropyTerm (Z6_2_0Value a)) := by + rcases a with ⟨i,j⟩ + revert j i + apply forall_fin6 + · exact forall_fin6 (entropyTerm_zero_ball (Z6_2_0Probs_sound ((0,0) : PairSlot))) (entropyTerm_zero_ball (Z6_2_0Probs_sound ((0,1) : PairSlot))) (entropyTerm_zero_ball (Z6_2_0Probs_sound ((0,2) : PairSlot))) (entropyTerm_zero_ball (Z6_2_0Probs_sound ((0,3) : PairSlot))) (entropyTerm_zero_ball (Z6_2_0Probs_sound ((0,4) : PairSlot))) (entropyTerm_zero_ball (Z6_2_0Probs_sound ((0,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball (Z6_2_0Probs_sound ((1,0) : PairSlot))) (entropyTerm_zero_ball (Z6_2_0Probs_sound ((1,1) : PairSlot))) (entropyTerm_zero_ball (Z6_2_0Probs_sound ((1,2) : PairSlot))) (entropyTerm_zero_ball (Z6_2_0Probs_sound ((1,3) : PairSlot))) (entropyTerm_zero_ball (Z6_2_0Probs_sound ((1,4) : PairSlot))) (entropyTerm_zero_ball (Z6_2_0Probs_sound ((1,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball (Z6_2_0Probs_sound ((2,0) : PairSlot))) (entropyTerm_zero_ball (Z6_2_0Probs_sound ((2,1) : PairSlot))) (entropyTerm_zero_ball (Z6_2_0Probs_sound ((2,2) : PairSlot))) (entropyTerm_zero_ball (Z6_2_0Probs_sound ((2,3) : PairSlot))) (entropyTerm_zero_ball (Z6_2_0Probs_sound ((2,4) : PairSlot))) Z6_2_0E_2_5_sound + · exact forall_fin6 (entropyTerm_zero_ball (Z6_2_0Probs_sound ((3,0) : PairSlot))) (entropyTerm_zero_ball (Z6_2_0Probs_sound ((3,1) : PairSlot))) (entropyTerm_zero_ball (Z6_2_0Probs_sound ((3,2) : PairSlot))) (entropyTerm_zero_ball (Z6_2_0Probs_sound ((3,3) : PairSlot))) (entropyTerm_zero_ball (Z6_2_0Probs_sound ((3,4) : PairSlot))) Z6_2_0E_3_5_sound + · exact forall_fin6 (entropyTerm_zero_ball (Z6_2_0Probs_sound ((4,0) : PairSlot))) (entropyTerm_zero_ball (Z6_2_0Probs_sound ((4,1) : PairSlot))) (entropyTerm_zero_ball (Z6_2_0Probs_sound ((4,2) : PairSlot))) (entropyTerm_zero_ball (Z6_2_0Probs_sound ((4,3) : PairSlot))) Z6_2_0E_4_4_sound (entropyTerm_zero_ball (Z6_2_0Probs_sound ((4,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball (Z6_2_0Probs_sound ((5,0) : PairSlot))) (entropyTerm_zero_ball (Z6_2_0Probs_sound ((5,1) : PairSlot))) Z6_2_0E_5_2_sound Z6_2_0E_5_3_sound (entropyTerm_zero_ball (Z6_2_0Probs_sound ((5,4) : PairSlot))) (entropyTerm_zero_ball (Z6_2_0Probs_sound ((5,5) : PairSlot))) +def Z6_2_0Entropy : Ball := ⟨(40235822740443151951467192515337 / 25000000000000000000000000000000), (84703295281 / 100000000000000000000000000000000)⟩ +lemma Z6_2_0Entropy_sound : Z6_2_0Entropy.Encloses (Foundation.finiteEntropy Z6_2_0Value) := by + exact contains_sound (entropyPair_enclosed Z6_2_0Value Z6_2_0Terms Z6_2_0Terms_sound) (by decide +kernel) +def Z6_2_0Labels : Ball := ⟨(12415492963912716150755123942433 / 5000000000000000000000000000000), (44435757761 / 50000000000000000000000000000000)⟩ +lemma Z6_2_0Labels_sound : Z6_2_0Labels.Encloses + (∑ a : PairSlot, (zeroPairLaw (shape 6 2 0) a.1 a.2 : ℝ) * + Real.log (AllFieldParameters.multiplicity a.1 * AllFieldParameters.multiplicity a.2 : ℕ)) := by + exact contains_sound (pairSumBall_sound (fun a => .mul (Z6_2_0Probs a) (multLogs a)) + _ (fun a => Ball.mul_sound (Z6_2_0Probs_sound a) (multLogs_sound a))) (by decide +kernel) +def Z6_2_0Four : Ball := ⟨(51156643780003366352621406113751 / 12500000000000000000000000000000), (173574810803 / 100000000000000000000000000000000)⟩ +lemma Z6_2_0Four_sound : Z6_2_0Four.Encloses (AllFieldZeroLeafRates.fourRate (shape 6 2 0)) := by + exact contains_sound (Ball.add_sound Z6_2_0Entropy_sound Z6_2_0Labels_sound) (by decide +kernel) +def Z6_2_0H0Value (a : PairSlot) : ℝ := (halfLaw (shape 6 2 0) 0 a : ℝ) +def Z6_2_0H0E_2_5LogWitness : LogWitness := ⟨-3, 19924044508891583790197036118597, 12500000000000000000000000000000⟩ +def Z6_2_0H0E_2_5Log : Ball := ⟨(-3226485833692046100593323447671 / 2000000000000000000000000000000), (84703294967 / 100000000000000000000000000000000)⟩ +lemma Z6_2_0H0E_2_5Log_sound : Z6_2_0H0E_2_5Log.Encloses (Real.log (Z6_2_0H0Value ((2,5) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound ((Z6_2_0Half_sound 0) ((2,5) : PairSlot)) (w := Z6_2_0H0E_2_5LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z6_2_0H0E_2_5 : Ball := ⟨(32142323678894247471214709989819 / 100000000000000000000000000000000), (8438161133 / 50000000000000000000000000000000)⟩ +lemma Z6_2_0H0E_2_5_sound : Z6_2_0H0E_2_5.Encloses (Foundation.entropyTerm (Z6_2_0H0Value ((2,5) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z6_2_0Half_sound 0) ((2,5) : PairSlot)) Z6_2_0H0E_2_5Log_sound) (by decide +kernel) +def Z6_2_0H0E_3_5LogWitness : LogWitness := ⟨-3, 4012399160127629130320676344027, 2500000000000000000000000000000⟩ +def Z6_2_0H0E_3_5Log : Ball := ⟨(-160634291684602305029666172383581 / 100000000000000000000000000000000), (42351647483 / 50000000000000000000000000000000)⟩ +lemma Z6_2_0H0E_3_5Log_sound : Z6_2_0H0E_3_5Log.Encloses (Real.log (Z6_2_0H0Value ((3,5) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound ((Z6_2_0Half_sound 0) ((3,5) : PairSlot)) (w := Z6_2_0H0E_3_5LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z6_2_0H0E_3_5 : Ball := ⟨(32226444852149744429123998456101 / 100000000000000000000000000000000), (4248292889 / 25000000000000000000000000000000)⟩ +lemma Z6_2_0H0E_3_5_sound : Z6_2_0H0E_3_5.Encloses (Foundation.entropyTerm (Z6_2_0H0Value ((3,5) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z6_2_0Half_sound 0) ((3,5) : PairSlot)) Z6_2_0H0E_3_5Log_sound) (by decide +kernel) +def Z6_2_0H0E_4_4LogWitness : LogWitness := ⟨-3, 10013959690470270558199582161267, 6250000000000000000000000000000⟩ +def Z6_2_0H0E_4_4Log : Ball := ⟨(-160804291684602305029666172383561 / 100000000000000000000000000000000), (21175823709 / 25000000000000000000000000000000)⟩ +lemma Z6_2_0H0E_4_4Log_sound : Z6_2_0H0E_4_4Log.Encloses (Real.log (Z6_2_0H0Value ((4,4) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound ((Z6_2_0Half_sound 0) ((4,4) : PairSlot)) (w := Z6_2_0H0E_4_4LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z6_2_0H0E_4_4 : Ball := ⟨(8051438474921156001297838292377 / 25000000000000000000000000000000), (16964307637 / 100000000000000000000000000000000)⟩ +lemma Z6_2_0H0E_4_4_sound : Z6_2_0H0E_4_4.Encloses (Foundation.entropyTerm (Z6_2_0H0Value ((4,4) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z6_2_0Half_sound 0) ((4,4) : PairSlot)) Z6_2_0H0E_4_4Log_sound) (by decide +kernel) +def Z6_2_0H0E_5_2LogWitness : LogWitness := ⟨-3, 19924044508891583790197036118597, 12500000000000000000000000000000⟩ +def Z6_2_0H0E_5_2Log : Ball := ⟨(-3226485833692046100593323447671 / 2000000000000000000000000000000), (84703294967 / 100000000000000000000000000000000)⟩ +lemma Z6_2_0H0E_5_2Log_sound : Z6_2_0H0E_5_2Log.Encloses (Real.log (Z6_2_0H0Value ((5,2) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound ((Z6_2_0Half_sound 0) ((5,2) : PairSlot)) (w := Z6_2_0H0E_5_2LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z6_2_0H0E_5_2 : Ball := ⟨(32142323678894247471214709989819 / 100000000000000000000000000000000), (8438161133 / 50000000000000000000000000000000)⟩ +lemma Z6_2_0H0E_5_2_sound : Z6_2_0H0E_5_2.Encloses (Foundation.entropyTerm (Z6_2_0H0Value ((5,2) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z6_2_0Half_sound 0) ((5,2) : PairSlot)) Z6_2_0H0E_5_2Log_sound) (by decide +kernel) +def Z6_2_0H0E_5_3LogWitness : LogWitness := ⟨-3, 4012399160127629130320676344027, 2500000000000000000000000000000⟩ +def Z6_2_0H0E_5_3Log : Ball := ⟨(-160634291684602305029666172383581 / 100000000000000000000000000000000), (42351647483 / 50000000000000000000000000000000)⟩ +lemma Z6_2_0H0E_5_3Log_sound : Z6_2_0H0E_5_3Log.Encloses (Real.log (Z6_2_0H0Value ((5,3) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound ((Z6_2_0Half_sound 0) ((5,3) : PairSlot)) (w := Z6_2_0H0E_5_3LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z6_2_0H0E_5_3 : Ball := ⟨(32226444852149744429123998456101 / 100000000000000000000000000000000), (4248292889 / 25000000000000000000000000000000)⟩ +lemma Z6_2_0H0E_5_3_sound : Z6_2_0H0E_5_3.Encloses (Foundation.entropyTerm (Z6_2_0H0Value ((5,3) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z6_2_0Half_sound 0) ((5,3) : PairSlot)) Z6_2_0H0E_5_3Log_sound) (by decide +kernel) +def Z6_2_0H0Terms (a : PairSlot) : Ball := + match a.1.val, a.2.val with + | 2, 5 => ⟨(32142323678894247471214709989819 / 100000000000000000000000000000000), (8438161133 / 50000000000000000000000000000000)⟩ + | 3, 5 => ⟨(32226444852149744429123998456101 / 100000000000000000000000000000000), (4248292889 / 25000000000000000000000000000000)⟩ + | 4, 4 => ⟨(8051438474921156001297838292377 / 25000000000000000000000000000000), (16964307637 / 100000000000000000000000000000000)⟩ + | 5, 2 => ⟨(32142323678894247471214709989819 / 100000000000000000000000000000000), (8438161133 / 50000000000000000000000000000000)⟩ + | 5, 3 => ⟨(32226444852149744429123998456101 / 100000000000000000000000000000000), (4248292889 / 25000000000000000000000000000000)⟩ + | _, _ => (.exact 0) +lemma Z6_2_0H0Terms_sound (a : PairSlot) : + (Z6_2_0H0Terms a).Encloses (Foundation.entropyTerm (Z6_2_0H0Value a)) := by + rcases a with ⟨i,j⟩ + revert j i + apply forall_fin6 + · exact forall_fin6 (entropyTerm_zero_ball ((Z6_2_0Half_sound 0) ((0,0) : PairSlot))) (entropyTerm_zero_ball ((Z6_2_0Half_sound 0) ((0,1) : PairSlot))) (entropyTerm_zero_ball ((Z6_2_0Half_sound 0) ((0,2) : PairSlot))) (entropyTerm_zero_ball ((Z6_2_0Half_sound 0) ((0,3) : PairSlot))) (entropyTerm_zero_ball ((Z6_2_0Half_sound 0) ((0,4) : PairSlot))) (entropyTerm_zero_ball ((Z6_2_0Half_sound 0) ((0,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z6_2_0Half_sound 0) ((1,0) : PairSlot))) (entropyTerm_zero_ball ((Z6_2_0Half_sound 0) ((1,1) : PairSlot))) (entropyTerm_zero_ball ((Z6_2_0Half_sound 0) ((1,2) : PairSlot))) (entropyTerm_zero_ball ((Z6_2_0Half_sound 0) ((1,3) : PairSlot))) (entropyTerm_zero_ball ((Z6_2_0Half_sound 0) ((1,4) : PairSlot))) (entropyTerm_zero_ball ((Z6_2_0Half_sound 0) ((1,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z6_2_0Half_sound 0) ((2,0) : PairSlot))) (entropyTerm_zero_ball ((Z6_2_0Half_sound 0) ((2,1) : PairSlot))) (entropyTerm_zero_ball ((Z6_2_0Half_sound 0) ((2,2) : PairSlot))) (entropyTerm_zero_ball ((Z6_2_0Half_sound 0) ((2,3) : PairSlot))) (entropyTerm_zero_ball ((Z6_2_0Half_sound 0) ((2,4) : PairSlot))) Z6_2_0H0E_2_5_sound + · exact forall_fin6 (entropyTerm_zero_ball ((Z6_2_0Half_sound 0) ((3,0) : PairSlot))) (entropyTerm_zero_ball ((Z6_2_0Half_sound 0) ((3,1) : PairSlot))) (entropyTerm_zero_ball ((Z6_2_0Half_sound 0) ((3,2) : PairSlot))) (entropyTerm_zero_ball ((Z6_2_0Half_sound 0) ((3,3) : PairSlot))) (entropyTerm_zero_ball ((Z6_2_0Half_sound 0) ((3,4) : PairSlot))) Z6_2_0H0E_3_5_sound + · exact forall_fin6 (entropyTerm_zero_ball ((Z6_2_0Half_sound 0) ((4,0) : PairSlot))) (entropyTerm_zero_ball ((Z6_2_0Half_sound 0) ((4,1) : PairSlot))) (entropyTerm_zero_ball ((Z6_2_0Half_sound 0) ((4,2) : PairSlot))) (entropyTerm_zero_ball ((Z6_2_0Half_sound 0) ((4,3) : PairSlot))) Z6_2_0H0E_4_4_sound (entropyTerm_zero_ball ((Z6_2_0Half_sound 0) ((4,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z6_2_0Half_sound 0) ((5,0) : PairSlot))) (entropyTerm_zero_ball ((Z6_2_0Half_sound 0) ((5,1) : PairSlot))) Z6_2_0H0E_5_2_sound Z6_2_0H0E_5_3_sound (entropyTerm_zero_ball ((Z6_2_0Half_sound 0) ((5,4) : PairSlot))) (entropyTerm_zero_ball ((Z6_2_0Half_sound 0) ((5,5) : PairSlot))) +def Z6_2_0H0Entropy : Ball := ⟨(40235822740443151951467192515337 / 25000000000000000000000000000000), (84703295281 / 100000000000000000000000000000000)⟩ +lemma Z6_2_0H0Entropy_sound : Z6_2_0H0Entropy.Encloses (Foundation.finiteEntropy Z6_2_0H0Value) := by + exact contains_sound (entropyPair_enclosed Z6_2_0H0Value Z6_2_0H0Terms Z6_2_0H0Terms_sound) (by decide +kernel) +def Z6_2_0H0Mass : Ball := ⟨(49999999999999999999999999999999 / 50000000000000000000000000000000), (209 / 100000000000000000000000000000000)⟩ +lemma Z6_2_0H0Mass_sound : Z6_2_0H0Mass.Encloses (∑ a, Z6_2_0H0Value a) := by + exact contains_sound (pairSumBall_sound (Z6_2_0Half 0) Z6_2_0H0Value (Z6_2_0Half_sound 0)) (by decide +kernel) +def Z6_2_0H0MassTermLogWitness : LogWitness := ⟨-1, 49999999999999999999999999999999, 25000000000000000000000000000000⟩ +def Z6_2_0H0MassTermLog : Ball := ⟨(-1 / 100000000000000000000000000000000), (1694065903 / 4000000000000000000000000000000)⟩ +lemma Z6_2_0H0MassTermLog_sound : Z6_2_0H0MassTermLog.Encloses (Real.log ((∑ a, Z6_2_0H0Value a))) := by + exact checkLog_sound logTwoBall_sound (Z6_2_0H0Mass_sound) (w := Z6_2_0H0MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z6_2_0H0MassTerm : Ball := ⟨(1 / 100000000000000000000000000000000), (5293955947 / 12500000000000000000000000000000)⟩ +lemma Z6_2_0H0MassTerm_sound : Z6_2_0H0MassTerm.Encloses (Foundation.entropyTerm ((∑ a, Z6_2_0H0Value a))) := by + exact contains_sound (entropyTerm_ball (Z6_2_0H0Mass_sound) Z6_2_0H0MassTermLog_sound) (by decide +kernel) +def Z6_2_0H0H : Ball := ⟨(160943290961772607805868770061347 / 100000000000000000000000000000000), (127054942857 / 100000000000000000000000000000000)⟩ +lemma Z6_2_0H0H_sound : Z6_2_0H0H.Encloses (homogeneousEntropy Z6_2_0H0Value) := by + exact contains_sound (homogeneous_enclosed Z6_2_0H0Value Z6_2_0H0MassTerm_sound Z6_2_0H0Entropy_sound) (by decide +kernel) +def Z6_2_0H1Value (a : PairSlot) : ℝ := (halfLaw (shape 6 2 0) 1 a : ℝ) +def Z6_2_0H1E_2_0LogWitness : LogWitness := ⟨-3, 19924044508891583790197036118597, 12500000000000000000000000000000⟩ +def Z6_2_0H1E_2_0Log : Ball := ⟨(-3226485833692046100593323447671 / 2000000000000000000000000000000), (84703294967 / 100000000000000000000000000000000)⟩ +lemma Z6_2_0H1E_2_0Log_sound : Z6_2_0H1E_2_0Log.Encloses (Real.log (Z6_2_0H1Value ((2,0) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound ((Z6_2_0Half_sound 1) ((2,0) : PairSlot)) (w := Z6_2_0H1E_2_0LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z6_2_0H1E_2_0 : Ball := ⟨(32142323678894247471214709989819 / 100000000000000000000000000000000), (8438161133 / 50000000000000000000000000000000)⟩ +lemma Z6_2_0H1E_2_0_sound : Z6_2_0H1E_2_0.Encloses (Foundation.entropyTerm (Z6_2_0H1Value ((2,0) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z6_2_0Half_sound 1) ((2,0) : PairSlot)) Z6_2_0H1E_2_0Log_sound) (by decide +kernel) +def Z6_2_0H1E_3_0LogWitness : LogWitness := ⟨-3, 4012399160127629130320676344027, 2500000000000000000000000000000⟩ +def Z6_2_0H1E_3_0Log : Ball := ⟨(-160634291684602305029666172383581 / 100000000000000000000000000000000), (42351647483 / 50000000000000000000000000000000)⟩ +lemma Z6_2_0H1E_3_0Log_sound : Z6_2_0H1E_3_0Log.Encloses (Real.log (Z6_2_0H1Value ((3,0) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound ((Z6_2_0Half_sound 1) ((3,0) : PairSlot)) (w := Z6_2_0H1E_3_0LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z6_2_0H1E_3_0 : Ball := ⟨(32226444852149744429123998456101 / 100000000000000000000000000000000), (4248292889 / 25000000000000000000000000000000)⟩ +lemma Z6_2_0H1E_3_0_sound : Z6_2_0H1E_3_0.Encloses (Foundation.entropyTerm (Z6_2_0H1Value ((3,0) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z6_2_0Half_sound 1) ((3,0) : PairSlot)) Z6_2_0H1E_3_0Log_sound) (by decide +kernel) +def Z6_2_0H1E_1_1LogWitness : LogWitness := ⟨-3, 10013959690470270558199582161267, 6250000000000000000000000000000⟩ +def Z6_2_0H1E_1_1Log : Ball := ⟨(-160804291684602305029666172383561 / 100000000000000000000000000000000), (21175823709 / 25000000000000000000000000000000)⟩ +lemma Z6_2_0H1E_1_1Log_sound : Z6_2_0H1E_1_1Log.Encloses (Real.log (Z6_2_0H1Value ((1,1) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound ((Z6_2_0Half_sound 1) ((1,1) : PairSlot)) (w := Z6_2_0H1E_1_1LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z6_2_0H1E_1_1 : Ball := ⟨(8051438474921156001297838292377 / 25000000000000000000000000000000), (16964307637 / 100000000000000000000000000000000)⟩ +lemma Z6_2_0H1E_1_1_sound : Z6_2_0H1E_1_1.Encloses (Foundation.entropyTerm (Z6_2_0H1Value ((1,1) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z6_2_0Half_sound 1) ((1,1) : PairSlot)) Z6_2_0H1E_1_1Log_sound) (by decide +kernel) +def Z6_2_0H1E_0_2LogWitness : LogWitness := ⟨-3, 19924044508891583790197036118597, 12500000000000000000000000000000⟩ +def Z6_2_0H1E_0_2Log : Ball := ⟨(-3226485833692046100593323447671 / 2000000000000000000000000000000), (84703294967 / 100000000000000000000000000000000)⟩ +lemma Z6_2_0H1E_0_2Log_sound : Z6_2_0H1E_0_2Log.Encloses (Real.log (Z6_2_0H1Value ((0,2) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound ((Z6_2_0Half_sound 1) ((0,2) : PairSlot)) (w := Z6_2_0H1E_0_2LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z6_2_0H1E_0_2 : Ball := ⟨(32142323678894247471214709989819 / 100000000000000000000000000000000), (8438161133 / 50000000000000000000000000000000)⟩ +lemma Z6_2_0H1E_0_2_sound : Z6_2_0H1E_0_2.Encloses (Foundation.entropyTerm (Z6_2_0H1Value ((0,2) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z6_2_0Half_sound 1) ((0,2) : PairSlot)) Z6_2_0H1E_0_2Log_sound) (by decide +kernel) +def Z6_2_0H1E_0_3LogWitness : LogWitness := ⟨-3, 4012399160127629130320676344027, 2500000000000000000000000000000⟩ +def Z6_2_0H1E_0_3Log : Ball := ⟨(-160634291684602305029666172383581 / 100000000000000000000000000000000), (42351647483 / 50000000000000000000000000000000)⟩ +lemma Z6_2_0H1E_0_3Log_sound : Z6_2_0H1E_0_3Log.Encloses (Real.log (Z6_2_0H1Value ((0,3) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound ((Z6_2_0Half_sound 1) ((0,3) : PairSlot)) (w := Z6_2_0H1E_0_3LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z6_2_0H1E_0_3 : Ball := ⟨(32226444852149744429123998456101 / 100000000000000000000000000000000), (4248292889 / 25000000000000000000000000000000)⟩ +lemma Z6_2_0H1E_0_3_sound : Z6_2_0H1E_0_3.Encloses (Foundation.entropyTerm (Z6_2_0H1Value ((0,3) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z6_2_0Half_sound 1) ((0,3) : PairSlot)) Z6_2_0H1E_0_3Log_sound) (by decide +kernel) +def Z6_2_0H1Terms (a : PairSlot) : Ball := + match a.1.val, a.2.val with + | 2, 0 => ⟨(32142323678894247471214709989819 / 100000000000000000000000000000000), (8438161133 / 50000000000000000000000000000000)⟩ + | 3, 0 => ⟨(32226444852149744429123998456101 / 100000000000000000000000000000000), (4248292889 / 25000000000000000000000000000000)⟩ + | 1, 1 => ⟨(8051438474921156001297838292377 / 25000000000000000000000000000000), (16964307637 / 100000000000000000000000000000000)⟩ + | 0, 2 => ⟨(32142323678894247471214709989819 / 100000000000000000000000000000000), (8438161133 / 50000000000000000000000000000000)⟩ + | 0, 3 => ⟨(32226444852149744429123998456101 / 100000000000000000000000000000000), (4248292889 / 25000000000000000000000000000000)⟩ + | _, _ => (.exact 0) +lemma Z6_2_0H1Terms_sound (a : PairSlot) : + (Z6_2_0H1Terms a).Encloses (Foundation.entropyTerm (Z6_2_0H1Value a)) := by + rcases a with ⟨i,j⟩ + revert j i + apply forall_fin6 + · exact forall_fin6 (entropyTerm_zero_ball ((Z6_2_0Half_sound 1) ((0,0) : PairSlot))) (entropyTerm_zero_ball ((Z6_2_0Half_sound 1) ((0,1) : PairSlot))) Z6_2_0H1E_0_2_sound Z6_2_0H1E_0_3_sound (entropyTerm_zero_ball ((Z6_2_0Half_sound 1) ((0,4) : PairSlot))) (entropyTerm_zero_ball ((Z6_2_0Half_sound 1) ((0,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z6_2_0Half_sound 1) ((1,0) : PairSlot))) Z6_2_0H1E_1_1_sound (entropyTerm_zero_ball ((Z6_2_0Half_sound 1) ((1,2) : PairSlot))) (entropyTerm_zero_ball ((Z6_2_0Half_sound 1) ((1,3) : PairSlot))) (entropyTerm_zero_ball ((Z6_2_0Half_sound 1) ((1,4) : PairSlot))) (entropyTerm_zero_ball ((Z6_2_0Half_sound 1) ((1,5) : PairSlot))) + · exact forall_fin6 Z6_2_0H1E_2_0_sound (entropyTerm_zero_ball ((Z6_2_0Half_sound 1) ((2,1) : PairSlot))) (entropyTerm_zero_ball ((Z6_2_0Half_sound 1) ((2,2) : PairSlot))) (entropyTerm_zero_ball ((Z6_2_0Half_sound 1) ((2,3) : PairSlot))) (entropyTerm_zero_ball ((Z6_2_0Half_sound 1) ((2,4) : PairSlot))) (entropyTerm_zero_ball ((Z6_2_0Half_sound 1) ((2,5) : PairSlot))) + · exact forall_fin6 Z6_2_0H1E_3_0_sound (entropyTerm_zero_ball ((Z6_2_0Half_sound 1) ((3,1) : PairSlot))) (entropyTerm_zero_ball ((Z6_2_0Half_sound 1) ((3,2) : PairSlot))) (entropyTerm_zero_ball ((Z6_2_0Half_sound 1) ((3,3) : PairSlot))) (entropyTerm_zero_ball ((Z6_2_0Half_sound 1) ((3,4) : PairSlot))) (entropyTerm_zero_ball ((Z6_2_0Half_sound 1) ((3,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z6_2_0Half_sound 1) ((4,0) : PairSlot))) (entropyTerm_zero_ball ((Z6_2_0Half_sound 1) ((4,1) : PairSlot))) (entropyTerm_zero_ball ((Z6_2_0Half_sound 1) ((4,2) : PairSlot))) (entropyTerm_zero_ball ((Z6_2_0Half_sound 1) ((4,3) : PairSlot))) (entropyTerm_zero_ball ((Z6_2_0Half_sound 1) ((4,4) : PairSlot))) (entropyTerm_zero_ball ((Z6_2_0Half_sound 1) ((4,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z6_2_0Half_sound 1) ((5,0) : PairSlot))) (entropyTerm_zero_ball ((Z6_2_0Half_sound 1) ((5,1) : PairSlot))) (entropyTerm_zero_ball ((Z6_2_0Half_sound 1) ((5,2) : PairSlot))) (entropyTerm_zero_ball ((Z6_2_0Half_sound 1) ((5,3) : PairSlot))) (entropyTerm_zero_ball ((Z6_2_0Half_sound 1) ((5,4) : PairSlot))) (entropyTerm_zero_ball ((Z6_2_0Half_sound 1) ((5,5) : PairSlot))) +def Z6_2_0H1Entropy : Ball := ⟨(40235822740443151951467192515337 / 25000000000000000000000000000000), (84703295281 / 100000000000000000000000000000000)⟩ +lemma Z6_2_0H1Entropy_sound : Z6_2_0H1Entropy.Encloses (Foundation.finiteEntropy Z6_2_0H1Value) := by + exact contains_sound (entropyPair_enclosed Z6_2_0H1Value Z6_2_0H1Terms Z6_2_0H1Terms_sound) (by decide +kernel) +def Z6_2_0H1Mass : Ball := ⟨(49999999999999999999999999999999 / 50000000000000000000000000000000), (209 / 100000000000000000000000000000000)⟩ +lemma Z6_2_0H1Mass_sound : Z6_2_0H1Mass.Encloses (∑ a, Z6_2_0H1Value a) := by + exact contains_sound (pairSumBall_sound (Z6_2_0Half 1) Z6_2_0H1Value (Z6_2_0Half_sound 1)) (by decide +kernel) +def Z6_2_0H1MassTermLogWitness : LogWitness := ⟨-1, 49999999999999999999999999999999, 25000000000000000000000000000000⟩ +def Z6_2_0H1MassTermLog : Ball := ⟨(-1 / 100000000000000000000000000000000), (1694065903 / 4000000000000000000000000000000)⟩ +lemma Z6_2_0H1MassTermLog_sound : Z6_2_0H1MassTermLog.Encloses (Real.log ((∑ a, Z6_2_0H1Value a))) := by + exact checkLog_sound logTwoBall_sound (Z6_2_0H1Mass_sound) (w := Z6_2_0H1MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z6_2_0H1MassTerm : Ball := ⟨(1 / 100000000000000000000000000000000), (5293955947 / 12500000000000000000000000000000)⟩ +lemma Z6_2_0H1MassTerm_sound : Z6_2_0H1MassTerm.Encloses (Foundation.entropyTerm ((∑ a, Z6_2_0H1Value a))) := by + exact contains_sound (entropyTerm_ball (Z6_2_0H1Mass_sound) Z6_2_0H1MassTermLog_sound) (by decide +kernel) +def Z6_2_0H1H : Ball := ⟨(160943290961772607805868770061347 / 100000000000000000000000000000000), (127054942857 / 100000000000000000000000000000000)⟩ +lemma Z6_2_0H1H_sound : Z6_2_0H1H.Encloses (homogeneousEntropy Z6_2_0H1Value) := by + exact contains_sound (homogeneous_enclosed Z6_2_0H1Value Z6_2_0H1MassTerm_sound Z6_2_0H1Entropy_sound) (by decide +kernel) +def Z6_2_0H2Value (a : PairSlot) : ℝ := (halfLaw (shape 6 2 0) 2 a : ℝ) +def Z6_2_0H2E_0_0Log : Ball := .exact 0 +lemma Z6_2_0H2E_0_0Log_sound : Z6_2_0H2E_0_0Log.Encloses (Real.log (Z6_2_0H2Value ((0,0) : PairSlot))) := by + exact log_exact_one_ball ((Z6_2_0Half_sound 2) ((0,0) : PairSlot)) +def Z6_2_0H2E_0_0 : Ball := ⟨0, 0⟩ +lemma Z6_2_0H2E_0_0_sound : Z6_2_0H2E_0_0.Encloses (Foundation.entropyTerm (Z6_2_0H2Value ((0,0) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z6_2_0Half_sound 2) ((0,0) : PairSlot)) Z6_2_0H2E_0_0Log_sound) (by decide +kernel) +def Z6_2_0H2Terms (a : PairSlot) : Ball := + match a.1.val, a.2.val with + | 0, 0 => ⟨0, 0⟩ + | _, _ => (.exact 0) +lemma Z6_2_0H2Terms_sound (a : PairSlot) : + (Z6_2_0H2Terms a).Encloses (Foundation.entropyTerm (Z6_2_0H2Value a)) := by + rcases a with ⟨i,j⟩ + revert j i + apply forall_fin6 + · exact forall_fin6 Z6_2_0H2E_0_0_sound (entropyTerm_zero_ball ((Z6_2_0Half_sound 2) ((0,1) : PairSlot))) (entropyTerm_zero_ball ((Z6_2_0Half_sound 2) ((0,2) : PairSlot))) (entropyTerm_zero_ball ((Z6_2_0Half_sound 2) ((0,3) : PairSlot))) (entropyTerm_zero_ball ((Z6_2_0Half_sound 2) ((0,4) : PairSlot))) (entropyTerm_zero_ball ((Z6_2_0Half_sound 2) ((0,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z6_2_0Half_sound 2) ((1,0) : PairSlot))) (entropyTerm_zero_ball ((Z6_2_0Half_sound 2) ((1,1) : PairSlot))) (entropyTerm_zero_ball ((Z6_2_0Half_sound 2) ((1,2) : PairSlot))) (entropyTerm_zero_ball ((Z6_2_0Half_sound 2) ((1,3) : PairSlot))) (entropyTerm_zero_ball ((Z6_2_0Half_sound 2) ((1,4) : PairSlot))) (entropyTerm_zero_ball ((Z6_2_0Half_sound 2) ((1,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z6_2_0Half_sound 2) ((2,0) : PairSlot))) (entropyTerm_zero_ball ((Z6_2_0Half_sound 2) ((2,1) : PairSlot))) (entropyTerm_zero_ball ((Z6_2_0Half_sound 2) ((2,2) : PairSlot))) (entropyTerm_zero_ball ((Z6_2_0Half_sound 2) ((2,3) : PairSlot))) (entropyTerm_zero_ball ((Z6_2_0Half_sound 2) ((2,4) : PairSlot))) (entropyTerm_zero_ball ((Z6_2_0Half_sound 2) ((2,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z6_2_0Half_sound 2) ((3,0) : PairSlot))) (entropyTerm_zero_ball ((Z6_2_0Half_sound 2) ((3,1) : PairSlot))) (entropyTerm_zero_ball ((Z6_2_0Half_sound 2) ((3,2) : PairSlot))) (entropyTerm_zero_ball ((Z6_2_0Half_sound 2) ((3,3) : PairSlot))) (entropyTerm_zero_ball ((Z6_2_0Half_sound 2) ((3,4) : PairSlot))) (entropyTerm_zero_ball ((Z6_2_0Half_sound 2) ((3,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z6_2_0Half_sound 2) ((4,0) : PairSlot))) (entropyTerm_zero_ball ((Z6_2_0Half_sound 2) ((4,1) : PairSlot))) (entropyTerm_zero_ball ((Z6_2_0Half_sound 2) ((4,2) : PairSlot))) (entropyTerm_zero_ball ((Z6_2_0Half_sound 2) ((4,3) : PairSlot))) (entropyTerm_zero_ball ((Z6_2_0Half_sound 2) ((4,4) : PairSlot))) (entropyTerm_zero_ball ((Z6_2_0Half_sound 2) ((4,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z6_2_0Half_sound 2) ((5,0) : PairSlot))) (entropyTerm_zero_ball ((Z6_2_0Half_sound 2) ((5,1) : PairSlot))) (entropyTerm_zero_ball ((Z6_2_0Half_sound 2) ((5,2) : PairSlot))) (entropyTerm_zero_ball ((Z6_2_0Half_sound 2) ((5,3) : PairSlot))) (entropyTerm_zero_ball ((Z6_2_0Half_sound 2) ((5,4) : PairSlot))) (entropyTerm_zero_ball ((Z6_2_0Half_sound 2) ((5,5) : PairSlot))) +def Z6_2_0H2Entropy : Ball := ⟨0, 0⟩ +lemma Z6_2_0H2Entropy_sound : Z6_2_0H2Entropy.Encloses (Foundation.finiteEntropy Z6_2_0H2Value) := by + exact contains_sound (entropyPair_enclosed Z6_2_0H2Value Z6_2_0H2Terms Z6_2_0H2Terms_sound) (by decide +kernel) +def Z6_2_0H2Mass : Ball := ⟨1, 0⟩ +lemma Z6_2_0H2Mass_sound : Z6_2_0H2Mass.Encloses (∑ a, Z6_2_0H2Value a) := by + exact contains_sound (pairSumBall_sound (Z6_2_0Half 2) Z6_2_0H2Value (Z6_2_0Half_sound 2)) (by decide +kernel) +def Z6_2_0H2MassTermLog : Ball := .exact 0 +lemma Z6_2_0H2MassTermLog_sound : Z6_2_0H2MassTermLog.Encloses (Real.log ((∑ a, Z6_2_0H2Value a))) := by + exact log_exact_one_ball (Z6_2_0H2Mass_sound) +def Z6_2_0H2MassTerm : Ball := ⟨0, 0⟩ +lemma Z6_2_0H2MassTerm_sound : Z6_2_0H2MassTerm.Encloses (Foundation.entropyTerm ((∑ a, Z6_2_0H2Value a))) := by + exact contains_sound (entropyTerm_ball (Z6_2_0H2Mass_sound) Z6_2_0H2MassTermLog_sound) (by decide +kernel) +def Z6_2_0H2H : Ball := ⟨0, 0⟩ +lemma Z6_2_0H2H_sound : Z6_2_0H2H.Encloses (homogeneousEntropy Z6_2_0H2Value) := by + exact contains_sound (homogeneous_enclosed Z6_2_0H2Value Z6_2_0H2MassTerm_sound Z6_2_0H2Entropy_sound) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/Certificates/Four7_0_1.lean b/lean/OAI/LinearAlgebra/MatrixFields/Certificates/Four7_0_1.lean new file mode 100644 index 0000000000000000000000000000000000000000..56bb75a360bf52c0cded2cbb873439f9968d9147 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/Certificates/Four7_0_1.lean @@ -0,0 +1,455 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Certificates.Zero0_1_7 + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def Z7_0_1Raw (ij : PairSlot) : Ball := + match ij.1.val, ij.2.val with + | 0, 0 => w195 + | 0, 1 => w195 + | 0, 2 => w195 + | 0, 3 => w195 + | 0, 4 => w195 + | 0, 5 => w195 + | 1, 0 => w195 + | 1, 1 => w195 + | 1, 2 => w195 + | 1, 3 => w195 + | 1, 4 => w195 + | 1, 5 => w195 + | 2, 0 => w195 + | 2, 1 => w195 + | 2, 2 => w195 + | 2, 3 => w195 + | 2, 4 => w195 + | 2, 5 => w195 + | 3, 0 => w195 + | 3, 1 => w195 + | 3, 2 => w195 + | 3, 3 => w195 + | 3, 4 => w195 + | 3, 5 => w195 + | 4, 0 => w195 + | 4, 1 => w195 + | 4, 2 => w195 + | 4, 3 => w195 + | 4, 4 => w195 + | 4, 5 => w195 + | 5, 0 => w195 + | 5, 1 => w195 + | 5, 2 => w195 + | 5, 3 => w195 + | 5, 4 => w195 + | 5, 5 => w195 + | _, _ => (.exact 0) +lemma Z7_0_1Raw_sound_0 (j : Fin 6) : + (Z7_0_1Raw (0,j)).Encloses (weight (orderedPairInteger (shape 7 0 1) 0 j) : ℝ) := by + fin_cases j + · change (Z7_0_1Raw (0,0)).Encloses (weight (orderedPairInteger (shape 7 0 1) 0 0) : ℝ) + have he : orderedPairInteger (shape 7 0 1) 0 0 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z7_0_1Raw (0,1)).Encloses (weight (orderedPairInteger (shape 7 0 1) 0 1) : ℝ) + have he : orderedPairInteger (shape 7 0 1) 0 1 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z7_0_1Raw (0,2)).Encloses (weight (orderedPairInteger (shape 7 0 1) 0 2) : ℝ) + have he : orderedPairInteger (shape 7 0 1) 0 2 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z7_0_1Raw (0,3)).Encloses (weight (orderedPairInteger (shape 7 0 1) 0 3) : ℝ) + have he : orderedPairInteger (shape 7 0 1) 0 3 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z7_0_1Raw (0,4)).Encloses (weight (orderedPairInteger (shape 7 0 1) 0 4) : ℝ) + have he : orderedPairInteger (shape 7 0 1) 0 4 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z7_0_1Raw (0,5)).Encloses (weight (orderedPairInteger (shape 7 0 1) 0 5) : ℝ) + have he : orderedPairInteger (shape 7 0 1) 0 5 = (0) := by decide +kernel + rw [he] + exact w195_sound +lemma Z7_0_1Raw_sound_1 (j : Fin 6) : + (Z7_0_1Raw (1,j)).Encloses (weight (orderedPairInteger (shape 7 0 1) 1 j) : ℝ) := by + fin_cases j + · change (Z7_0_1Raw (1,0)).Encloses (weight (orderedPairInteger (shape 7 0 1) 1 0) : ℝ) + have he : orderedPairInteger (shape 7 0 1) 1 0 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z7_0_1Raw (1,1)).Encloses (weight (orderedPairInteger (shape 7 0 1) 1 1) : ℝ) + have he : orderedPairInteger (shape 7 0 1) 1 1 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z7_0_1Raw (1,2)).Encloses (weight (orderedPairInteger (shape 7 0 1) 1 2) : ℝ) + have he : orderedPairInteger (shape 7 0 1) 1 2 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z7_0_1Raw (1,3)).Encloses (weight (orderedPairInteger (shape 7 0 1) 1 3) : ℝ) + have he : orderedPairInteger (shape 7 0 1) 1 3 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z7_0_1Raw (1,4)).Encloses (weight (orderedPairInteger (shape 7 0 1) 1 4) : ℝ) + have he : orderedPairInteger (shape 7 0 1) 1 4 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z7_0_1Raw (1,5)).Encloses (weight (orderedPairInteger (shape 7 0 1) 1 5) : ℝ) + have he : orderedPairInteger (shape 7 0 1) 1 5 = (0) := by decide +kernel + rw [he] + exact w195_sound +lemma Z7_0_1Raw_sound_2 (j : Fin 6) : + (Z7_0_1Raw (2,j)).Encloses (weight (orderedPairInteger (shape 7 0 1) 2 j) : ℝ) := by + fin_cases j + · change (Z7_0_1Raw (2,0)).Encloses (weight (orderedPairInteger (shape 7 0 1) 2 0) : ℝ) + have he : orderedPairInteger (shape 7 0 1) 2 0 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z7_0_1Raw (2,1)).Encloses (weight (orderedPairInteger (shape 7 0 1) 2 1) : ℝ) + have he : orderedPairInteger (shape 7 0 1) 2 1 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z7_0_1Raw (2,2)).Encloses (weight (orderedPairInteger (shape 7 0 1) 2 2) : ℝ) + have he : orderedPairInteger (shape 7 0 1) 2 2 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z7_0_1Raw (2,3)).Encloses (weight (orderedPairInteger (shape 7 0 1) 2 3) : ℝ) + have he : orderedPairInteger (shape 7 0 1) 2 3 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z7_0_1Raw (2,4)).Encloses (weight (orderedPairInteger (shape 7 0 1) 2 4) : ℝ) + have he : orderedPairInteger (shape 7 0 1) 2 4 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z7_0_1Raw (2,5)).Encloses (weight (orderedPairInteger (shape 7 0 1) 2 5) : ℝ) + have he : orderedPairInteger (shape 7 0 1) 2 5 = (0) := by decide +kernel + rw [he] + exact w195_sound +lemma Z7_0_1Raw_sound_3 (j : Fin 6) : + (Z7_0_1Raw (3,j)).Encloses (weight (orderedPairInteger (shape 7 0 1) 3 j) : ℝ) := by + fin_cases j + · change (Z7_0_1Raw (3,0)).Encloses (weight (orderedPairInteger (shape 7 0 1) 3 0) : ℝ) + have he : orderedPairInteger (shape 7 0 1) 3 0 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z7_0_1Raw (3,1)).Encloses (weight (orderedPairInteger (shape 7 0 1) 3 1) : ℝ) + have he : orderedPairInteger (shape 7 0 1) 3 1 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z7_0_1Raw (3,2)).Encloses (weight (orderedPairInteger (shape 7 0 1) 3 2) : ℝ) + have he : orderedPairInteger (shape 7 0 1) 3 2 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z7_0_1Raw (3,3)).Encloses (weight (orderedPairInteger (shape 7 0 1) 3 3) : ℝ) + have he : orderedPairInteger (shape 7 0 1) 3 3 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z7_0_1Raw (3,4)).Encloses (weight (orderedPairInteger (shape 7 0 1) 3 4) : ℝ) + have he : orderedPairInteger (shape 7 0 1) 3 4 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z7_0_1Raw (3,5)).Encloses (weight (orderedPairInteger (shape 7 0 1) 3 5) : ℝ) + have he : orderedPairInteger (shape 7 0 1) 3 5 = (0) := by decide +kernel + rw [he] + exact w195_sound +lemma Z7_0_1Raw_sound_4 (j : Fin 6) : + (Z7_0_1Raw (4,j)).Encloses (weight (orderedPairInteger (shape 7 0 1) 4 j) : ℝ) := by + fin_cases j + · change (Z7_0_1Raw (4,0)).Encloses (weight (orderedPairInteger (shape 7 0 1) 4 0) : ℝ) + have he : orderedPairInteger (shape 7 0 1) 4 0 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z7_0_1Raw (4,1)).Encloses (weight (orderedPairInteger (shape 7 0 1) 4 1) : ℝ) + have he : orderedPairInteger (shape 7 0 1) 4 1 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z7_0_1Raw (4,2)).Encloses (weight (orderedPairInteger (shape 7 0 1) 4 2) : ℝ) + have he : orderedPairInteger (shape 7 0 1) 4 2 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z7_0_1Raw (4,3)).Encloses (weight (orderedPairInteger (shape 7 0 1) 4 3) : ℝ) + have he : orderedPairInteger (shape 7 0 1) 4 3 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z7_0_1Raw (4,4)).Encloses (weight (orderedPairInteger (shape 7 0 1) 4 4) : ℝ) + have he : orderedPairInteger (shape 7 0 1) 4 4 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z7_0_1Raw (4,5)).Encloses (weight (orderedPairInteger (shape 7 0 1) 4 5) : ℝ) + have he : orderedPairInteger (shape 7 0 1) 4 5 = (0) := by decide +kernel + rw [he] + exact w195_sound +lemma Z7_0_1Raw_sound_5 (j : Fin 6) : + (Z7_0_1Raw (5,j)).Encloses (weight (orderedPairInteger (shape 7 0 1) 5 j) : ℝ) := by + fin_cases j + · change (Z7_0_1Raw (5,0)).Encloses (weight (orderedPairInteger (shape 7 0 1) 5 0) : ℝ) + have he : orderedPairInteger (shape 7 0 1) 5 0 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z7_0_1Raw (5,1)).Encloses (weight (orderedPairInteger (shape 7 0 1) 5 1) : ℝ) + have he : orderedPairInteger (shape 7 0 1) 5 1 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z7_0_1Raw (5,2)).Encloses (weight (orderedPairInteger (shape 7 0 1) 5 2) : ℝ) + have he : orderedPairInteger (shape 7 0 1) 5 2 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z7_0_1Raw (5,3)).Encloses (weight (orderedPairInteger (shape 7 0 1) 5 3) : ℝ) + have he : orderedPairInteger (shape 7 0 1) 5 3 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z7_0_1Raw (5,4)).Encloses (weight (orderedPairInteger (shape 7 0 1) 5 4) : ℝ) + have he : orderedPairInteger (shape 7 0 1) 5 4 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z7_0_1Raw (5,5)).Encloses (weight (orderedPairInteger (shape 7 0 1) 5 5) : ℝ) + have he : orderedPairInteger (shape 7 0 1) 5 5 = (0) := by decide +kernel + rw [he] + exact w195_sound +lemma Z7_0_1Raw_sound (ij : PairSlot) : + (Z7_0_1Raw ij).Encloses (weight (orderedPairInteger (shape 7 0 1) ij.1 ij.2) : ℝ) := by + rcases ij with ⟨i,j⟩ + revert i + exact forall_fin6 (Z7_0_1Raw_sound_0 j) (Z7_0_1Raw_sound_1 j) (Z7_0_1Raw_sound_2 j) (Z7_0_1Raw_sound_3 j) (Z7_0_1Raw_sound_4 j) (Z7_0_1Raw_sound_5 j) +def Z7_0_1Den : Ball := ⟨2, 0⟩ +lemma Z7_0_1Den_sound : Z7_0_1Den.Encloses + (((orderedPairs (shape 7 0 1)).map (fun ij => weight (orderedPairInteger (shape 7 0 1) ij.1 ij.2))).sum : ℝ) := by + exact contains_sound (list_cast_enclosed (orderedPairs (shape 7 0 1)) Z7_0_1Raw + (fun ij => weight (orderedPairInteger (shape 7 0 1) ij.1 ij.2)) + (fun ij _ => Z7_0_1Raw_sound ij)) (by decide +kernel) +lemma Z7_0_1Den_pos : 0 < Z7_0_1Den.lower := by decide +kernel +def Z7_0_1Probs (ij : PairSlot) : Ball := + match ij.1.val, ij.2.val with + | 4, 5 => ⟨(1 / 2), 0⟩ + | 5, 4 => ⟨(1 / 2), 0⟩ + | _, _ => (.exact 0) +lemma Z7_0_1Contains : ∀ i j : Fin 6, + statisticWeight i + statisticWeight j = shapeMax (shape 7 0 1) → + contains (.mul (Z7_0_1Raw (i,j)) (.inv Z7_0_1Den)) (Z7_0_1Probs (i,j)) = true := by + decide +kernel +lemma Z7_0_1Zero : ∀ i j : Fin 6, + statisticWeight i + statisticWeight j ≠ shapeMax (shape 7 0 1) → Z7_0_1Probs (i,j) = .exact 0 := by + decide +kernel +lemma Z7_0_1Probs_sound (ij : PairSlot) : + (Z7_0_1Probs ij).Encloses (zeroPairLaw (shape 7 0 1) ij.1 ij.2 : ℝ) := by + by_cases h : statisticWeight ij.1 + statisticWeight ij.2 = shapeMax (shape 7 0 1) + · have hb := contains_sound (Ball.mul_sound (Z7_0_1Raw_sound ij) + (Ball.inv_sound Z7_0_1Den_sound Z7_0_1Den_pos)) (Z7_0_1Contains ij.1 ij.2 h) + simpa only [zeroPairLaw, h, ite_true, Rat.cast_div, Rat.cast_mul, + Rat.cast_inv, div_eq_mul_inv] using hb + · rw [Z7_0_1Zero ij.1 ij.2 h] + simpa only [zeroPairLaw, h, ite_false] using Ball.exact_sound 0 + +def Z7_0_1Half (w : Fin 3) (ij : PairSlot) : Ball := + if (shape 7 0 1) w = 0 then if ij = (0,0) then .exact 1 else .exact 0 + else if w = halfMaxAxis (shape 7 0 1) then Z7_0_1Probs ij + else Z7_0_1Probs (kappa ij.1, kappa ij.2) +lemma Z7_0_1Half_sound (w : Fin 3) (ij : PairSlot) : + (Z7_0_1Half w ij).Encloses (halfLaw (shape 7 0 1) w ij : ℝ) := by + have hp : positive (shape 7 0 1) = false := by decide +kernel + simp only [Z7_0_1Half, halfLaw, hp, Bool.false_eq_true, ite_false] + split_ifs + · exact Ball.exact_sound 1 + · exact Ball.exact_sound 0 + · exact Z7_0_1Probs_sound _ + · exact Z7_0_1Probs_sound _ + +def Z7_0_1Value (a : PairSlot) : ℝ := (zeroPairLaw (shape 7 0 1) a.1 a.2 : ℝ) +def Z7_0_1E_4_5LogWitness : LogWitness := ⟨-1, 1, 1⟩ +def Z7_0_1E_4_5Log : Ball := ⟨(-6931471805599453094172319305033 / 10000000000000000000000000000000), (8470329473 / 20000000000000000000000000000000)⟩ +lemma Z7_0_1E_4_5Log_sound : Z7_0_1E_4_5Log.Encloses (Real.log (Z7_0_1Value ((4,5) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound (Z7_0_1Probs_sound ((4,5) : PairSlot)) (w := Z7_0_1E_4_5LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z7_0_1E_4_5 : Ball := ⟨(6931471805599453094172319305033 / 20000000000000000000000000000000), (21175823683 / 100000000000000000000000000000000)⟩ +lemma Z7_0_1E_4_5_sound : Z7_0_1E_4_5.Encloses (Foundation.entropyTerm (Z7_0_1Value ((4,5) : PairSlot))) := by + exact contains_sound (entropyTerm_ball (Z7_0_1Probs_sound ((4,5) : PairSlot)) Z7_0_1E_4_5Log_sound) (by decide +kernel) +def Z7_0_1E_5_4LogWitness : LogWitness := ⟨-1, 1, 1⟩ +def Z7_0_1E_5_4Log : Ball := ⟨(-6931471805599453094172319305033 / 10000000000000000000000000000000), (8470329473 / 20000000000000000000000000000000)⟩ +lemma Z7_0_1E_5_4Log_sound : Z7_0_1E_5_4Log.Encloses (Real.log (Z7_0_1Value ((5,4) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound (Z7_0_1Probs_sound ((5,4) : PairSlot)) (w := Z7_0_1E_5_4LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z7_0_1E_5_4 : Ball := ⟨(6931471805599453094172319305033 / 20000000000000000000000000000000), (21175823683 / 100000000000000000000000000000000)⟩ +lemma Z7_0_1E_5_4_sound : Z7_0_1E_5_4.Encloses (Foundation.entropyTerm (Z7_0_1Value ((5,4) : PairSlot))) := by + exact contains_sound (entropyTerm_ball (Z7_0_1Probs_sound ((5,4) : PairSlot)) Z7_0_1E_5_4Log_sound) (by decide +kernel) +def Z7_0_1Terms (a : PairSlot) : Ball := + match a.1.val, a.2.val with + | 4, 5 => ⟨(6931471805599453094172319305033 / 20000000000000000000000000000000), (21175823683 / 100000000000000000000000000000000)⟩ + | 5, 4 => ⟨(6931471805599453094172319305033 / 20000000000000000000000000000000), (21175823683 / 100000000000000000000000000000000)⟩ + | _, _ => (.exact 0) +lemma Z7_0_1Terms_sound (a : PairSlot) : + (Z7_0_1Terms a).Encloses (Foundation.entropyTerm (Z7_0_1Value a)) := by + rcases a with ⟨i,j⟩ + revert j i + apply forall_fin6 + · exact forall_fin6 (entropyTerm_zero_ball (Z7_0_1Probs_sound ((0,0) : PairSlot))) (entropyTerm_zero_ball (Z7_0_1Probs_sound ((0,1) : PairSlot))) (entropyTerm_zero_ball (Z7_0_1Probs_sound ((0,2) : PairSlot))) (entropyTerm_zero_ball (Z7_0_1Probs_sound ((0,3) : PairSlot))) (entropyTerm_zero_ball (Z7_0_1Probs_sound ((0,4) : PairSlot))) (entropyTerm_zero_ball (Z7_0_1Probs_sound ((0,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball (Z7_0_1Probs_sound ((1,0) : PairSlot))) (entropyTerm_zero_ball (Z7_0_1Probs_sound ((1,1) : PairSlot))) (entropyTerm_zero_ball (Z7_0_1Probs_sound ((1,2) : PairSlot))) (entropyTerm_zero_ball (Z7_0_1Probs_sound ((1,3) : PairSlot))) (entropyTerm_zero_ball (Z7_0_1Probs_sound ((1,4) : PairSlot))) (entropyTerm_zero_ball (Z7_0_1Probs_sound ((1,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball (Z7_0_1Probs_sound ((2,0) : PairSlot))) (entropyTerm_zero_ball (Z7_0_1Probs_sound ((2,1) : PairSlot))) (entropyTerm_zero_ball (Z7_0_1Probs_sound ((2,2) : PairSlot))) (entropyTerm_zero_ball (Z7_0_1Probs_sound ((2,3) : PairSlot))) (entropyTerm_zero_ball (Z7_0_1Probs_sound ((2,4) : PairSlot))) (entropyTerm_zero_ball (Z7_0_1Probs_sound ((2,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball (Z7_0_1Probs_sound ((3,0) : PairSlot))) (entropyTerm_zero_ball (Z7_0_1Probs_sound ((3,1) : PairSlot))) (entropyTerm_zero_ball (Z7_0_1Probs_sound ((3,2) : PairSlot))) (entropyTerm_zero_ball (Z7_0_1Probs_sound ((3,3) : PairSlot))) (entropyTerm_zero_ball (Z7_0_1Probs_sound ((3,4) : PairSlot))) (entropyTerm_zero_ball (Z7_0_1Probs_sound ((3,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball (Z7_0_1Probs_sound ((4,0) : PairSlot))) (entropyTerm_zero_ball (Z7_0_1Probs_sound ((4,1) : PairSlot))) (entropyTerm_zero_ball (Z7_0_1Probs_sound ((4,2) : PairSlot))) (entropyTerm_zero_ball (Z7_0_1Probs_sound ((4,3) : PairSlot))) (entropyTerm_zero_ball (Z7_0_1Probs_sound ((4,4) : PairSlot))) Z7_0_1E_4_5_sound + · exact forall_fin6 (entropyTerm_zero_ball (Z7_0_1Probs_sound ((5,0) : PairSlot))) (entropyTerm_zero_ball (Z7_0_1Probs_sound ((5,1) : PairSlot))) (entropyTerm_zero_ball (Z7_0_1Probs_sound ((5,2) : PairSlot))) (entropyTerm_zero_ball (Z7_0_1Probs_sound ((5,3) : PairSlot))) Z7_0_1E_5_4_sound (entropyTerm_zero_ball (Z7_0_1Probs_sound ((5,5) : PairSlot))) +def Z7_0_1Entropy : Ball := ⟨(6931471805599453094172319305033 / 10000000000000000000000000000000), (21175823683 / 50000000000000000000000000000000)⟩ +lemma Z7_0_1Entropy_sound : Z7_0_1Entropy.Encloses (Foundation.finiteEntropy Z7_0_1Value) := by + exact contains_sound (entropyPair_enclosed Z7_0_1Value Z7_0_1Terms Z7_0_1Terms_sound) (by decide +kernel) +def Z7_0_1Labels : Ball := ⟨(115129254649702284200899544090987 / 50000000000000000000000000000000), (21175823683 / 25000000000000000000000000000000)⟩ +lemma Z7_0_1Labels_sound : Z7_0_1Labels.Encloses + (∑ a : PairSlot, (zeroPairLaw (shape 7 0 1) a.1 a.2 : ℝ) * + Real.log (AllFieldParameters.multiplicity a.1 * AllFieldParameters.multiplicity a.2 : ℕ)) := by + exact contains_sound (pairSumBall_sound (fun a => .mul (Z7_0_1Probs a) (multLogs a)) + _ (fun a => Ball.mul_sound (Z7_0_1Probs_sound a) (multLogs_sound a))) (by decide +kernel) +def Z7_0_1Four : Ball := ⟨(18723326709712443708970142577019 / 6250000000000000000000000000000), (63527471049 / 50000000000000000000000000000000)⟩ +lemma Z7_0_1Four_sound : Z7_0_1Four.Encloses (AllFieldZeroLeafRates.fourRate (shape 7 0 1)) := by + exact contains_sound (Ball.add_sound Z7_0_1Entropy_sound Z7_0_1Labels_sound) (by decide +kernel) +def Z7_0_1H0Value (a : PairSlot) : ℝ := (halfLaw (shape 7 0 1) 0 a : ℝ) +def Z7_0_1H0E_4_5LogWitness : LogWitness := ⟨-1, 1, 1⟩ +def Z7_0_1H0E_4_5Log : Ball := ⟨(-6931471805599453094172319305033 / 10000000000000000000000000000000), (8470329473 / 20000000000000000000000000000000)⟩ +lemma Z7_0_1H0E_4_5Log_sound : Z7_0_1H0E_4_5Log.Encloses (Real.log (Z7_0_1H0Value ((4,5) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound ((Z7_0_1Half_sound 0) ((4,5) : PairSlot)) (w := Z7_0_1H0E_4_5LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z7_0_1H0E_4_5 : Ball := ⟨(6931471805599453094172319305033 / 20000000000000000000000000000000), (21175823683 / 100000000000000000000000000000000)⟩ +lemma Z7_0_1H0E_4_5_sound : Z7_0_1H0E_4_5.Encloses (Foundation.entropyTerm (Z7_0_1H0Value ((4,5) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z7_0_1Half_sound 0) ((4,5) : PairSlot)) Z7_0_1H0E_4_5Log_sound) (by decide +kernel) +def Z7_0_1H0E_5_4LogWitness : LogWitness := ⟨-1, 1, 1⟩ +def Z7_0_1H0E_5_4Log : Ball := ⟨(-6931471805599453094172319305033 / 10000000000000000000000000000000), (8470329473 / 20000000000000000000000000000000)⟩ +lemma Z7_0_1H0E_5_4Log_sound : Z7_0_1H0E_5_4Log.Encloses (Real.log (Z7_0_1H0Value ((5,4) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound ((Z7_0_1Half_sound 0) ((5,4) : PairSlot)) (w := Z7_0_1H0E_5_4LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z7_0_1H0E_5_4 : Ball := ⟨(6931471805599453094172319305033 / 20000000000000000000000000000000), (21175823683 / 100000000000000000000000000000000)⟩ +lemma Z7_0_1H0E_5_4_sound : Z7_0_1H0E_5_4.Encloses (Foundation.entropyTerm (Z7_0_1H0Value ((5,4) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z7_0_1Half_sound 0) ((5,4) : PairSlot)) Z7_0_1H0E_5_4Log_sound) (by decide +kernel) +def Z7_0_1H0Terms (a : PairSlot) : Ball := + match a.1.val, a.2.val with + | 4, 5 => ⟨(6931471805599453094172319305033 / 20000000000000000000000000000000), (21175823683 / 100000000000000000000000000000000)⟩ + | 5, 4 => ⟨(6931471805599453094172319305033 / 20000000000000000000000000000000), (21175823683 / 100000000000000000000000000000000)⟩ + | _, _ => (.exact 0) +lemma Z7_0_1H0Terms_sound (a : PairSlot) : + (Z7_0_1H0Terms a).Encloses (Foundation.entropyTerm (Z7_0_1H0Value a)) := by + rcases a with ⟨i,j⟩ + revert j i + apply forall_fin6 + · exact forall_fin6 (entropyTerm_zero_ball ((Z7_0_1Half_sound 0) ((0,0) : PairSlot))) (entropyTerm_zero_ball ((Z7_0_1Half_sound 0) ((0,1) : PairSlot))) (entropyTerm_zero_ball ((Z7_0_1Half_sound 0) ((0,2) : PairSlot))) (entropyTerm_zero_ball ((Z7_0_1Half_sound 0) ((0,3) : PairSlot))) (entropyTerm_zero_ball ((Z7_0_1Half_sound 0) ((0,4) : PairSlot))) (entropyTerm_zero_ball ((Z7_0_1Half_sound 0) ((0,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z7_0_1Half_sound 0) ((1,0) : PairSlot))) (entropyTerm_zero_ball ((Z7_0_1Half_sound 0) ((1,1) : PairSlot))) (entropyTerm_zero_ball ((Z7_0_1Half_sound 0) ((1,2) : PairSlot))) (entropyTerm_zero_ball ((Z7_0_1Half_sound 0) ((1,3) : PairSlot))) (entropyTerm_zero_ball ((Z7_0_1Half_sound 0) ((1,4) : PairSlot))) (entropyTerm_zero_ball ((Z7_0_1Half_sound 0) ((1,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z7_0_1Half_sound 0) ((2,0) : PairSlot))) (entropyTerm_zero_ball ((Z7_0_1Half_sound 0) ((2,1) : PairSlot))) (entropyTerm_zero_ball ((Z7_0_1Half_sound 0) ((2,2) : PairSlot))) (entropyTerm_zero_ball ((Z7_0_1Half_sound 0) ((2,3) : PairSlot))) (entropyTerm_zero_ball ((Z7_0_1Half_sound 0) ((2,4) : PairSlot))) (entropyTerm_zero_ball ((Z7_0_1Half_sound 0) ((2,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z7_0_1Half_sound 0) ((3,0) : PairSlot))) (entropyTerm_zero_ball ((Z7_0_1Half_sound 0) ((3,1) : PairSlot))) (entropyTerm_zero_ball ((Z7_0_1Half_sound 0) ((3,2) : PairSlot))) (entropyTerm_zero_ball ((Z7_0_1Half_sound 0) ((3,3) : PairSlot))) (entropyTerm_zero_ball ((Z7_0_1Half_sound 0) ((3,4) : PairSlot))) (entropyTerm_zero_ball ((Z7_0_1Half_sound 0) ((3,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z7_0_1Half_sound 0) ((4,0) : PairSlot))) (entropyTerm_zero_ball ((Z7_0_1Half_sound 0) ((4,1) : PairSlot))) (entropyTerm_zero_ball ((Z7_0_1Half_sound 0) ((4,2) : PairSlot))) (entropyTerm_zero_ball ((Z7_0_1Half_sound 0) ((4,3) : PairSlot))) (entropyTerm_zero_ball ((Z7_0_1Half_sound 0) ((4,4) : PairSlot))) Z7_0_1H0E_4_5_sound + · exact forall_fin6 (entropyTerm_zero_ball ((Z7_0_1Half_sound 0) ((5,0) : PairSlot))) (entropyTerm_zero_ball ((Z7_0_1Half_sound 0) ((5,1) : PairSlot))) (entropyTerm_zero_ball ((Z7_0_1Half_sound 0) ((5,2) : PairSlot))) (entropyTerm_zero_ball ((Z7_0_1Half_sound 0) ((5,3) : PairSlot))) Z7_0_1H0E_5_4_sound (entropyTerm_zero_ball ((Z7_0_1Half_sound 0) ((5,5) : PairSlot))) +def Z7_0_1H0Entropy : Ball := ⟨(6931471805599453094172319305033 / 10000000000000000000000000000000), (21175823683 / 50000000000000000000000000000000)⟩ +lemma Z7_0_1H0Entropy_sound : Z7_0_1H0Entropy.Encloses (Foundation.finiteEntropy Z7_0_1H0Value) := by + exact contains_sound (entropyPair_enclosed Z7_0_1H0Value Z7_0_1H0Terms Z7_0_1H0Terms_sound) (by decide +kernel) +def Z7_0_1H0Mass : Ball := ⟨1, 0⟩ +lemma Z7_0_1H0Mass_sound : Z7_0_1H0Mass.Encloses (∑ a, Z7_0_1H0Value a) := by + exact contains_sound (pairSumBall_sound (Z7_0_1Half 0) Z7_0_1H0Value (Z7_0_1Half_sound 0)) (by decide +kernel) +def Z7_0_1H0MassTermLog : Ball := .exact 0 +lemma Z7_0_1H0MassTermLog_sound : Z7_0_1H0MassTermLog.Encloses (Real.log ((∑ a, Z7_0_1H0Value a))) := by + exact log_exact_one_ball (Z7_0_1H0Mass_sound) +def Z7_0_1H0MassTerm : Ball := ⟨0, 0⟩ +lemma Z7_0_1H0MassTerm_sound : Z7_0_1H0MassTerm.Encloses (Foundation.entropyTerm ((∑ a, Z7_0_1H0Value a))) := by + exact contains_sound (entropyTerm_ball (Z7_0_1H0Mass_sound) Z7_0_1H0MassTermLog_sound) (by decide +kernel) +def Z7_0_1H0H : Ball := ⟨(6931471805599453094172319305033 / 10000000000000000000000000000000), (21175823683 / 50000000000000000000000000000000)⟩ +lemma Z7_0_1H0H_sound : Z7_0_1H0H.Encloses (homogeneousEntropy Z7_0_1H0Value) := by + exact contains_sound (homogeneous_enclosed Z7_0_1H0Value Z7_0_1H0MassTerm_sound Z7_0_1H0Entropy_sound) (by decide +kernel) +def Z7_0_1H1Value (a : PairSlot) : ℝ := (halfLaw (shape 7 0 1) 1 a : ℝ) +def Z7_0_1H1E_0_0Log : Ball := .exact 0 +lemma Z7_0_1H1E_0_0Log_sound : Z7_0_1H1E_0_0Log.Encloses (Real.log (Z7_0_1H1Value ((0,0) : PairSlot))) := by + exact log_exact_one_ball ((Z7_0_1Half_sound 1) ((0,0) : PairSlot)) +def Z7_0_1H1E_0_0 : Ball := ⟨0, 0⟩ +lemma Z7_0_1H1E_0_0_sound : Z7_0_1H1E_0_0.Encloses (Foundation.entropyTerm (Z7_0_1H1Value ((0,0) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z7_0_1Half_sound 1) ((0,0) : PairSlot)) Z7_0_1H1E_0_0Log_sound) (by decide +kernel) +def Z7_0_1H1Terms (a : PairSlot) : Ball := + match a.1.val, a.2.val with + | 0, 0 => ⟨0, 0⟩ + | _, _ => (.exact 0) +lemma Z7_0_1H1Terms_sound (a : PairSlot) : + (Z7_0_1H1Terms a).Encloses (Foundation.entropyTerm (Z7_0_1H1Value a)) := by + rcases a with ⟨i,j⟩ + revert j i + apply forall_fin6 + · exact forall_fin6 Z7_0_1H1E_0_0_sound (entropyTerm_zero_ball ((Z7_0_1Half_sound 1) ((0,1) : PairSlot))) (entropyTerm_zero_ball ((Z7_0_1Half_sound 1) ((0,2) : PairSlot))) (entropyTerm_zero_ball ((Z7_0_1Half_sound 1) ((0,3) : PairSlot))) (entropyTerm_zero_ball ((Z7_0_1Half_sound 1) ((0,4) : PairSlot))) (entropyTerm_zero_ball ((Z7_0_1Half_sound 1) ((0,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z7_0_1Half_sound 1) ((1,0) : PairSlot))) (entropyTerm_zero_ball ((Z7_0_1Half_sound 1) ((1,1) : PairSlot))) (entropyTerm_zero_ball ((Z7_0_1Half_sound 1) ((1,2) : PairSlot))) (entropyTerm_zero_ball ((Z7_0_1Half_sound 1) ((1,3) : PairSlot))) (entropyTerm_zero_ball ((Z7_0_1Half_sound 1) ((1,4) : PairSlot))) (entropyTerm_zero_ball ((Z7_0_1Half_sound 1) ((1,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z7_0_1Half_sound 1) ((2,0) : PairSlot))) (entropyTerm_zero_ball ((Z7_0_1Half_sound 1) ((2,1) : PairSlot))) (entropyTerm_zero_ball ((Z7_0_1Half_sound 1) ((2,2) : PairSlot))) (entropyTerm_zero_ball ((Z7_0_1Half_sound 1) ((2,3) : PairSlot))) (entropyTerm_zero_ball ((Z7_0_1Half_sound 1) ((2,4) : PairSlot))) (entropyTerm_zero_ball ((Z7_0_1Half_sound 1) ((2,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z7_0_1Half_sound 1) ((3,0) : PairSlot))) (entropyTerm_zero_ball ((Z7_0_1Half_sound 1) ((3,1) : PairSlot))) (entropyTerm_zero_ball ((Z7_0_1Half_sound 1) ((3,2) : PairSlot))) (entropyTerm_zero_ball ((Z7_0_1Half_sound 1) ((3,3) : PairSlot))) (entropyTerm_zero_ball ((Z7_0_1Half_sound 1) ((3,4) : PairSlot))) (entropyTerm_zero_ball ((Z7_0_1Half_sound 1) ((3,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z7_0_1Half_sound 1) ((4,0) : PairSlot))) (entropyTerm_zero_ball ((Z7_0_1Half_sound 1) ((4,1) : PairSlot))) (entropyTerm_zero_ball ((Z7_0_1Half_sound 1) ((4,2) : PairSlot))) (entropyTerm_zero_ball ((Z7_0_1Half_sound 1) ((4,3) : PairSlot))) (entropyTerm_zero_ball ((Z7_0_1Half_sound 1) ((4,4) : PairSlot))) (entropyTerm_zero_ball ((Z7_0_1Half_sound 1) ((4,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z7_0_1Half_sound 1) ((5,0) : PairSlot))) (entropyTerm_zero_ball ((Z7_0_1Half_sound 1) ((5,1) : PairSlot))) (entropyTerm_zero_ball ((Z7_0_1Half_sound 1) ((5,2) : PairSlot))) (entropyTerm_zero_ball ((Z7_0_1Half_sound 1) ((5,3) : PairSlot))) (entropyTerm_zero_ball ((Z7_0_1Half_sound 1) ((5,4) : PairSlot))) (entropyTerm_zero_ball ((Z7_0_1Half_sound 1) ((5,5) : PairSlot))) +def Z7_0_1H1Entropy : Ball := ⟨0, 0⟩ +lemma Z7_0_1H1Entropy_sound : Z7_0_1H1Entropy.Encloses (Foundation.finiteEntropy Z7_0_1H1Value) := by + exact contains_sound (entropyPair_enclosed Z7_0_1H1Value Z7_0_1H1Terms Z7_0_1H1Terms_sound) (by decide +kernel) +def Z7_0_1H1Mass : Ball := ⟨1, 0⟩ +lemma Z7_0_1H1Mass_sound : Z7_0_1H1Mass.Encloses (∑ a, Z7_0_1H1Value a) := by + exact contains_sound (pairSumBall_sound (Z7_0_1Half 1) Z7_0_1H1Value (Z7_0_1Half_sound 1)) (by decide +kernel) +def Z7_0_1H1MassTermLog : Ball := .exact 0 +lemma Z7_0_1H1MassTermLog_sound : Z7_0_1H1MassTermLog.Encloses (Real.log ((∑ a, Z7_0_1H1Value a))) := by + exact log_exact_one_ball (Z7_0_1H1Mass_sound) +def Z7_0_1H1MassTerm : Ball := ⟨0, 0⟩ +lemma Z7_0_1H1MassTerm_sound : Z7_0_1H1MassTerm.Encloses (Foundation.entropyTerm ((∑ a, Z7_0_1H1Value a))) := by + exact contains_sound (entropyTerm_ball (Z7_0_1H1Mass_sound) Z7_0_1H1MassTermLog_sound) (by decide +kernel) +def Z7_0_1H1H : Ball := ⟨0, 0⟩ +lemma Z7_0_1H1H_sound : Z7_0_1H1H.Encloses (homogeneousEntropy Z7_0_1H1Value) := by + exact contains_sound (homogeneous_enclosed Z7_0_1H1Value Z7_0_1H1MassTerm_sound Z7_0_1H1Entropy_sound) (by decide +kernel) +def Z7_0_1H2Value (a : PairSlot) : ℝ := (halfLaw (shape 7 0 1) 2 a : ℝ) +def Z7_0_1H2E_1_0LogWitness : LogWitness := ⟨-1, 1, 1⟩ +def Z7_0_1H2E_1_0Log : Ball := ⟨(-6931471805599453094172319305033 / 10000000000000000000000000000000), (8470329473 / 20000000000000000000000000000000)⟩ +lemma Z7_0_1H2E_1_0Log_sound : Z7_0_1H2E_1_0Log.Encloses (Real.log (Z7_0_1H2Value ((1,0) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound ((Z7_0_1Half_sound 2) ((1,0) : PairSlot)) (w := Z7_0_1H2E_1_0LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z7_0_1H2E_1_0 : Ball := ⟨(6931471805599453094172319305033 / 20000000000000000000000000000000), (21175823683 / 100000000000000000000000000000000)⟩ +lemma Z7_0_1H2E_1_0_sound : Z7_0_1H2E_1_0.Encloses (Foundation.entropyTerm (Z7_0_1H2Value ((1,0) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z7_0_1Half_sound 2) ((1,0) : PairSlot)) Z7_0_1H2E_1_0Log_sound) (by decide +kernel) +def Z7_0_1H2E_0_1LogWitness : LogWitness := ⟨-1, 1, 1⟩ +def Z7_0_1H2E_0_1Log : Ball := ⟨(-6931471805599453094172319305033 / 10000000000000000000000000000000), (8470329473 / 20000000000000000000000000000000)⟩ +lemma Z7_0_1H2E_0_1Log_sound : Z7_0_1H2E_0_1Log.Encloses (Real.log (Z7_0_1H2Value ((0,1) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound ((Z7_0_1Half_sound 2) ((0,1) : PairSlot)) (w := Z7_0_1H2E_0_1LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z7_0_1H2E_0_1 : Ball := ⟨(6931471805599453094172319305033 / 20000000000000000000000000000000), (21175823683 / 100000000000000000000000000000000)⟩ +lemma Z7_0_1H2E_0_1_sound : Z7_0_1H2E_0_1.Encloses (Foundation.entropyTerm (Z7_0_1H2Value ((0,1) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z7_0_1Half_sound 2) ((0,1) : PairSlot)) Z7_0_1H2E_0_1Log_sound) (by decide +kernel) +def Z7_0_1H2Terms (a : PairSlot) : Ball := + match a.1.val, a.2.val with + | 1, 0 => ⟨(6931471805599453094172319305033 / 20000000000000000000000000000000), (21175823683 / 100000000000000000000000000000000)⟩ + | 0, 1 => ⟨(6931471805599453094172319305033 / 20000000000000000000000000000000), (21175823683 / 100000000000000000000000000000000)⟩ + | _, _ => (.exact 0) +lemma Z7_0_1H2Terms_sound (a : PairSlot) : + (Z7_0_1H2Terms a).Encloses (Foundation.entropyTerm (Z7_0_1H2Value a)) := by + rcases a with ⟨i,j⟩ + revert j i + apply forall_fin6 + · exact forall_fin6 (entropyTerm_zero_ball ((Z7_0_1Half_sound 2) ((0,0) : PairSlot))) Z7_0_1H2E_0_1_sound (entropyTerm_zero_ball ((Z7_0_1Half_sound 2) ((0,2) : PairSlot))) (entropyTerm_zero_ball ((Z7_0_1Half_sound 2) ((0,3) : PairSlot))) (entropyTerm_zero_ball ((Z7_0_1Half_sound 2) ((0,4) : PairSlot))) (entropyTerm_zero_ball ((Z7_0_1Half_sound 2) ((0,5) : PairSlot))) + · exact forall_fin6 Z7_0_1H2E_1_0_sound (entropyTerm_zero_ball ((Z7_0_1Half_sound 2) ((1,1) : PairSlot))) (entropyTerm_zero_ball ((Z7_0_1Half_sound 2) ((1,2) : PairSlot))) (entropyTerm_zero_ball ((Z7_0_1Half_sound 2) ((1,3) : PairSlot))) (entropyTerm_zero_ball ((Z7_0_1Half_sound 2) ((1,4) : PairSlot))) (entropyTerm_zero_ball ((Z7_0_1Half_sound 2) ((1,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z7_0_1Half_sound 2) ((2,0) : PairSlot))) (entropyTerm_zero_ball ((Z7_0_1Half_sound 2) ((2,1) : PairSlot))) (entropyTerm_zero_ball ((Z7_0_1Half_sound 2) ((2,2) : PairSlot))) (entropyTerm_zero_ball ((Z7_0_1Half_sound 2) ((2,3) : PairSlot))) (entropyTerm_zero_ball ((Z7_0_1Half_sound 2) ((2,4) : PairSlot))) (entropyTerm_zero_ball ((Z7_0_1Half_sound 2) ((2,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z7_0_1Half_sound 2) ((3,0) : PairSlot))) (entropyTerm_zero_ball ((Z7_0_1Half_sound 2) ((3,1) : PairSlot))) (entropyTerm_zero_ball ((Z7_0_1Half_sound 2) ((3,2) : PairSlot))) (entropyTerm_zero_ball ((Z7_0_1Half_sound 2) ((3,3) : PairSlot))) (entropyTerm_zero_ball ((Z7_0_1Half_sound 2) ((3,4) : PairSlot))) (entropyTerm_zero_ball ((Z7_0_1Half_sound 2) ((3,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z7_0_1Half_sound 2) ((4,0) : PairSlot))) (entropyTerm_zero_ball ((Z7_0_1Half_sound 2) ((4,1) : PairSlot))) (entropyTerm_zero_ball ((Z7_0_1Half_sound 2) ((4,2) : PairSlot))) (entropyTerm_zero_ball ((Z7_0_1Half_sound 2) ((4,3) : PairSlot))) (entropyTerm_zero_ball ((Z7_0_1Half_sound 2) ((4,4) : PairSlot))) (entropyTerm_zero_ball ((Z7_0_1Half_sound 2) ((4,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z7_0_1Half_sound 2) ((5,0) : PairSlot))) (entropyTerm_zero_ball ((Z7_0_1Half_sound 2) ((5,1) : PairSlot))) (entropyTerm_zero_ball ((Z7_0_1Half_sound 2) ((5,2) : PairSlot))) (entropyTerm_zero_ball ((Z7_0_1Half_sound 2) ((5,3) : PairSlot))) (entropyTerm_zero_ball ((Z7_0_1Half_sound 2) ((5,4) : PairSlot))) (entropyTerm_zero_ball ((Z7_0_1Half_sound 2) ((5,5) : PairSlot))) +def Z7_0_1H2Entropy : Ball := ⟨(6931471805599453094172319305033 / 10000000000000000000000000000000), (21175823683 / 50000000000000000000000000000000)⟩ +lemma Z7_0_1H2Entropy_sound : Z7_0_1H2Entropy.Encloses (Foundation.finiteEntropy Z7_0_1H2Value) := by + exact contains_sound (entropyPair_enclosed Z7_0_1H2Value Z7_0_1H2Terms Z7_0_1H2Terms_sound) (by decide +kernel) +def Z7_0_1H2Mass : Ball := ⟨1, 0⟩ +lemma Z7_0_1H2Mass_sound : Z7_0_1H2Mass.Encloses (∑ a, Z7_0_1H2Value a) := by + exact contains_sound (pairSumBall_sound (Z7_0_1Half 2) Z7_0_1H2Value (Z7_0_1Half_sound 2)) (by decide +kernel) +def Z7_0_1H2MassTermLog : Ball := .exact 0 +lemma Z7_0_1H2MassTermLog_sound : Z7_0_1H2MassTermLog.Encloses (Real.log ((∑ a, Z7_0_1H2Value a))) := by + exact log_exact_one_ball (Z7_0_1H2Mass_sound) +def Z7_0_1H2MassTerm : Ball := ⟨0, 0⟩ +lemma Z7_0_1H2MassTerm_sound : Z7_0_1H2MassTerm.Encloses (Foundation.entropyTerm ((∑ a, Z7_0_1H2Value a))) := by + exact contains_sound (entropyTerm_ball (Z7_0_1H2Mass_sound) Z7_0_1H2MassTermLog_sound) (by decide +kernel) +def Z7_0_1H2H : Ball := ⟨(6931471805599453094172319305033 / 10000000000000000000000000000000), (21175823683 / 50000000000000000000000000000000)⟩ +lemma Z7_0_1H2H_sound : Z7_0_1H2H.Encloses (homogeneousEntropy Z7_0_1H2Value) := by + exact contains_sound (homogeneous_enclosed Z7_0_1H2Value Z7_0_1H2MassTerm_sound Z7_0_1H2Entropy_sound) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/Certificates/Four7_1_0.lean b/lean/OAI/LinearAlgebra/MatrixFields/Certificates/Four7_1_0.lean new file mode 100644 index 0000000000000000000000000000000000000000..50cd69b6551d0acf5a6c60a166fbbde1e72abb41 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/Certificates/Four7_1_0.lean @@ -0,0 +1,455 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Certificates.Zero0_1_7 + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def Z7_1_0Raw (ij : PairSlot) : Ball := + match ij.1.val, ij.2.val with + | 0, 0 => w195 + | 0, 1 => w195 + | 0, 2 => w195 + | 0, 3 => w195 + | 0, 4 => w195 + | 0, 5 => w195 + | 1, 0 => w195 + | 1, 1 => w195 + | 1, 2 => w195 + | 1, 3 => w195 + | 1, 4 => w195 + | 1, 5 => w195 + | 2, 0 => w195 + | 2, 1 => w195 + | 2, 2 => w195 + | 2, 3 => w195 + | 2, 4 => w195 + | 2, 5 => w195 + | 3, 0 => w195 + | 3, 1 => w195 + | 3, 2 => w195 + | 3, 3 => w195 + | 3, 4 => w195 + | 3, 5 => w195 + | 4, 0 => w195 + | 4, 1 => w195 + | 4, 2 => w195 + | 4, 3 => w195 + | 4, 4 => w195 + | 4, 5 => w195 + | 5, 0 => w195 + | 5, 1 => w195 + | 5, 2 => w195 + | 5, 3 => w195 + | 5, 4 => w195 + | 5, 5 => w195 + | _, _ => (.exact 0) +lemma Z7_1_0Raw_sound_0 (j : Fin 6) : + (Z7_1_0Raw (0,j)).Encloses (weight (orderedPairInteger (shape 7 1 0) 0 j) : ℝ) := by + fin_cases j + · change (Z7_1_0Raw (0,0)).Encloses (weight (orderedPairInteger (shape 7 1 0) 0 0) : ℝ) + have he : orderedPairInteger (shape 7 1 0) 0 0 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z7_1_0Raw (0,1)).Encloses (weight (orderedPairInteger (shape 7 1 0) 0 1) : ℝ) + have he : orderedPairInteger (shape 7 1 0) 0 1 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z7_1_0Raw (0,2)).Encloses (weight (orderedPairInteger (shape 7 1 0) 0 2) : ℝ) + have he : orderedPairInteger (shape 7 1 0) 0 2 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z7_1_0Raw (0,3)).Encloses (weight (orderedPairInteger (shape 7 1 0) 0 3) : ℝ) + have he : orderedPairInteger (shape 7 1 0) 0 3 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z7_1_0Raw (0,4)).Encloses (weight (orderedPairInteger (shape 7 1 0) 0 4) : ℝ) + have he : orderedPairInteger (shape 7 1 0) 0 4 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z7_1_0Raw (0,5)).Encloses (weight (orderedPairInteger (shape 7 1 0) 0 5) : ℝ) + have he : orderedPairInteger (shape 7 1 0) 0 5 = (0) := by decide +kernel + rw [he] + exact w195_sound +lemma Z7_1_0Raw_sound_1 (j : Fin 6) : + (Z7_1_0Raw (1,j)).Encloses (weight (orderedPairInteger (shape 7 1 0) 1 j) : ℝ) := by + fin_cases j + · change (Z7_1_0Raw (1,0)).Encloses (weight (orderedPairInteger (shape 7 1 0) 1 0) : ℝ) + have he : orderedPairInteger (shape 7 1 0) 1 0 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z7_1_0Raw (1,1)).Encloses (weight (orderedPairInteger (shape 7 1 0) 1 1) : ℝ) + have he : orderedPairInteger (shape 7 1 0) 1 1 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z7_1_0Raw (1,2)).Encloses (weight (orderedPairInteger (shape 7 1 0) 1 2) : ℝ) + have he : orderedPairInteger (shape 7 1 0) 1 2 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z7_1_0Raw (1,3)).Encloses (weight (orderedPairInteger (shape 7 1 0) 1 3) : ℝ) + have he : orderedPairInteger (shape 7 1 0) 1 3 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z7_1_0Raw (1,4)).Encloses (weight (orderedPairInteger (shape 7 1 0) 1 4) : ℝ) + have he : orderedPairInteger (shape 7 1 0) 1 4 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z7_1_0Raw (1,5)).Encloses (weight (orderedPairInteger (shape 7 1 0) 1 5) : ℝ) + have he : orderedPairInteger (shape 7 1 0) 1 5 = (0) := by decide +kernel + rw [he] + exact w195_sound +lemma Z7_1_0Raw_sound_2 (j : Fin 6) : + (Z7_1_0Raw (2,j)).Encloses (weight (orderedPairInteger (shape 7 1 0) 2 j) : ℝ) := by + fin_cases j + · change (Z7_1_0Raw (2,0)).Encloses (weight (orderedPairInteger (shape 7 1 0) 2 0) : ℝ) + have he : orderedPairInteger (shape 7 1 0) 2 0 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z7_1_0Raw (2,1)).Encloses (weight (orderedPairInteger (shape 7 1 0) 2 1) : ℝ) + have he : orderedPairInteger (shape 7 1 0) 2 1 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z7_1_0Raw (2,2)).Encloses (weight (orderedPairInteger (shape 7 1 0) 2 2) : ℝ) + have he : orderedPairInteger (shape 7 1 0) 2 2 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z7_1_0Raw (2,3)).Encloses (weight (orderedPairInteger (shape 7 1 0) 2 3) : ℝ) + have he : orderedPairInteger (shape 7 1 0) 2 3 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z7_1_0Raw (2,4)).Encloses (weight (orderedPairInteger (shape 7 1 0) 2 4) : ℝ) + have he : orderedPairInteger (shape 7 1 0) 2 4 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z7_1_0Raw (2,5)).Encloses (weight (orderedPairInteger (shape 7 1 0) 2 5) : ℝ) + have he : orderedPairInteger (shape 7 1 0) 2 5 = (0) := by decide +kernel + rw [he] + exact w195_sound +lemma Z7_1_0Raw_sound_3 (j : Fin 6) : + (Z7_1_0Raw (3,j)).Encloses (weight (orderedPairInteger (shape 7 1 0) 3 j) : ℝ) := by + fin_cases j + · change (Z7_1_0Raw (3,0)).Encloses (weight (orderedPairInteger (shape 7 1 0) 3 0) : ℝ) + have he : orderedPairInteger (shape 7 1 0) 3 0 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z7_1_0Raw (3,1)).Encloses (weight (orderedPairInteger (shape 7 1 0) 3 1) : ℝ) + have he : orderedPairInteger (shape 7 1 0) 3 1 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z7_1_0Raw (3,2)).Encloses (weight (orderedPairInteger (shape 7 1 0) 3 2) : ℝ) + have he : orderedPairInteger (shape 7 1 0) 3 2 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z7_1_0Raw (3,3)).Encloses (weight (orderedPairInteger (shape 7 1 0) 3 3) : ℝ) + have he : orderedPairInteger (shape 7 1 0) 3 3 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z7_1_0Raw (3,4)).Encloses (weight (orderedPairInteger (shape 7 1 0) 3 4) : ℝ) + have he : orderedPairInteger (shape 7 1 0) 3 4 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z7_1_0Raw (3,5)).Encloses (weight (orderedPairInteger (shape 7 1 0) 3 5) : ℝ) + have he : orderedPairInteger (shape 7 1 0) 3 5 = (0) := by decide +kernel + rw [he] + exact w195_sound +lemma Z7_1_0Raw_sound_4 (j : Fin 6) : + (Z7_1_0Raw (4,j)).Encloses (weight (orderedPairInteger (shape 7 1 0) 4 j) : ℝ) := by + fin_cases j + · change (Z7_1_0Raw (4,0)).Encloses (weight (orderedPairInteger (shape 7 1 0) 4 0) : ℝ) + have he : orderedPairInteger (shape 7 1 0) 4 0 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z7_1_0Raw (4,1)).Encloses (weight (orderedPairInteger (shape 7 1 0) 4 1) : ℝ) + have he : orderedPairInteger (shape 7 1 0) 4 1 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z7_1_0Raw (4,2)).Encloses (weight (orderedPairInteger (shape 7 1 0) 4 2) : ℝ) + have he : orderedPairInteger (shape 7 1 0) 4 2 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z7_1_0Raw (4,3)).Encloses (weight (orderedPairInteger (shape 7 1 0) 4 3) : ℝ) + have he : orderedPairInteger (shape 7 1 0) 4 3 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z7_1_0Raw (4,4)).Encloses (weight (orderedPairInteger (shape 7 1 0) 4 4) : ℝ) + have he : orderedPairInteger (shape 7 1 0) 4 4 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z7_1_0Raw (4,5)).Encloses (weight (orderedPairInteger (shape 7 1 0) 4 5) : ℝ) + have he : orderedPairInteger (shape 7 1 0) 4 5 = (0) := by decide +kernel + rw [he] + exact w195_sound +lemma Z7_1_0Raw_sound_5 (j : Fin 6) : + (Z7_1_0Raw (5,j)).Encloses (weight (orderedPairInteger (shape 7 1 0) 5 j) : ℝ) := by + fin_cases j + · change (Z7_1_0Raw (5,0)).Encloses (weight (orderedPairInteger (shape 7 1 0) 5 0) : ℝ) + have he : orderedPairInteger (shape 7 1 0) 5 0 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z7_1_0Raw (5,1)).Encloses (weight (orderedPairInteger (shape 7 1 0) 5 1) : ℝ) + have he : orderedPairInteger (shape 7 1 0) 5 1 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z7_1_0Raw (5,2)).Encloses (weight (orderedPairInteger (shape 7 1 0) 5 2) : ℝ) + have he : orderedPairInteger (shape 7 1 0) 5 2 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z7_1_0Raw (5,3)).Encloses (weight (orderedPairInteger (shape 7 1 0) 5 3) : ℝ) + have he : orderedPairInteger (shape 7 1 0) 5 3 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z7_1_0Raw (5,4)).Encloses (weight (orderedPairInteger (shape 7 1 0) 5 4) : ℝ) + have he : orderedPairInteger (shape 7 1 0) 5 4 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z7_1_0Raw (5,5)).Encloses (weight (orderedPairInteger (shape 7 1 0) 5 5) : ℝ) + have he : orderedPairInteger (shape 7 1 0) 5 5 = (0) := by decide +kernel + rw [he] + exact w195_sound +lemma Z7_1_0Raw_sound (ij : PairSlot) : + (Z7_1_0Raw ij).Encloses (weight (orderedPairInteger (shape 7 1 0) ij.1 ij.2) : ℝ) := by + rcases ij with ⟨i,j⟩ + revert i + exact forall_fin6 (Z7_1_0Raw_sound_0 j) (Z7_1_0Raw_sound_1 j) (Z7_1_0Raw_sound_2 j) (Z7_1_0Raw_sound_3 j) (Z7_1_0Raw_sound_4 j) (Z7_1_0Raw_sound_5 j) +def Z7_1_0Den : Ball := ⟨2, 0⟩ +lemma Z7_1_0Den_sound : Z7_1_0Den.Encloses + (((orderedPairs (shape 7 1 0)).map (fun ij => weight (orderedPairInteger (shape 7 1 0) ij.1 ij.2))).sum : ℝ) := by + exact contains_sound (list_cast_enclosed (orderedPairs (shape 7 1 0)) Z7_1_0Raw + (fun ij => weight (orderedPairInteger (shape 7 1 0) ij.1 ij.2)) + (fun ij _ => Z7_1_0Raw_sound ij)) (by decide +kernel) +lemma Z7_1_0Den_pos : 0 < Z7_1_0Den.lower := by decide +kernel +def Z7_1_0Probs (ij : PairSlot) : Ball := + match ij.1.val, ij.2.val with + | 4, 5 => ⟨(1 / 2), 0⟩ + | 5, 4 => ⟨(1 / 2), 0⟩ + | _, _ => (.exact 0) +lemma Z7_1_0Contains : ∀ i j : Fin 6, + statisticWeight i + statisticWeight j = shapeMax (shape 7 1 0) → + contains (.mul (Z7_1_0Raw (i,j)) (.inv Z7_1_0Den)) (Z7_1_0Probs (i,j)) = true := by + decide +kernel +lemma Z7_1_0Zero : ∀ i j : Fin 6, + statisticWeight i + statisticWeight j ≠ shapeMax (shape 7 1 0) → Z7_1_0Probs (i,j) = .exact 0 := by + decide +kernel +lemma Z7_1_0Probs_sound (ij : PairSlot) : + (Z7_1_0Probs ij).Encloses (zeroPairLaw (shape 7 1 0) ij.1 ij.2 : ℝ) := by + by_cases h : statisticWeight ij.1 + statisticWeight ij.2 = shapeMax (shape 7 1 0) + · have hb := contains_sound (Ball.mul_sound (Z7_1_0Raw_sound ij) + (Ball.inv_sound Z7_1_0Den_sound Z7_1_0Den_pos)) (Z7_1_0Contains ij.1 ij.2 h) + simpa only [zeroPairLaw, h, ite_true, Rat.cast_div, Rat.cast_mul, + Rat.cast_inv, div_eq_mul_inv] using hb + · rw [Z7_1_0Zero ij.1 ij.2 h] + simpa only [zeroPairLaw, h, ite_false] using Ball.exact_sound 0 + +def Z7_1_0Half (w : Fin 3) (ij : PairSlot) : Ball := + if (shape 7 1 0) w = 0 then if ij = (0,0) then .exact 1 else .exact 0 + else if w = halfMaxAxis (shape 7 1 0) then Z7_1_0Probs ij + else Z7_1_0Probs (kappa ij.1, kappa ij.2) +lemma Z7_1_0Half_sound (w : Fin 3) (ij : PairSlot) : + (Z7_1_0Half w ij).Encloses (halfLaw (shape 7 1 0) w ij : ℝ) := by + have hp : positive (shape 7 1 0) = false := by decide +kernel + simp only [Z7_1_0Half, halfLaw, hp, Bool.false_eq_true, ite_false] + split_ifs + · exact Ball.exact_sound 1 + · exact Ball.exact_sound 0 + · exact Z7_1_0Probs_sound _ + · exact Z7_1_0Probs_sound _ + +def Z7_1_0Value (a : PairSlot) : ℝ := (zeroPairLaw (shape 7 1 0) a.1 a.2 : ℝ) +def Z7_1_0E_4_5LogWitness : LogWitness := ⟨-1, 1, 1⟩ +def Z7_1_0E_4_5Log : Ball := ⟨(-6931471805599453094172319305033 / 10000000000000000000000000000000), (8470329473 / 20000000000000000000000000000000)⟩ +lemma Z7_1_0E_4_5Log_sound : Z7_1_0E_4_5Log.Encloses (Real.log (Z7_1_0Value ((4,5) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound (Z7_1_0Probs_sound ((4,5) : PairSlot)) (w := Z7_1_0E_4_5LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z7_1_0E_4_5 : Ball := ⟨(6931471805599453094172319305033 / 20000000000000000000000000000000), (21175823683 / 100000000000000000000000000000000)⟩ +lemma Z7_1_0E_4_5_sound : Z7_1_0E_4_5.Encloses (Foundation.entropyTerm (Z7_1_0Value ((4,5) : PairSlot))) := by + exact contains_sound (entropyTerm_ball (Z7_1_0Probs_sound ((4,5) : PairSlot)) Z7_1_0E_4_5Log_sound) (by decide +kernel) +def Z7_1_0E_5_4LogWitness : LogWitness := ⟨-1, 1, 1⟩ +def Z7_1_0E_5_4Log : Ball := ⟨(-6931471805599453094172319305033 / 10000000000000000000000000000000), (8470329473 / 20000000000000000000000000000000)⟩ +lemma Z7_1_0E_5_4Log_sound : Z7_1_0E_5_4Log.Encloses (Real.log (Z7_1_0Value ((5,4) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound (Z7_1_0Probs_sound ((5,4) : PairSlot)) (w := Z7_1_0E_5_4LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z7_1_0E_5_4 : Ball := ⟨(6931471805599453094172319305033 / 20000000000000000000000000000000), (21175823683 / 100000000000000000000000000000000)⟩ +lemma Z7_1_0E_5_4_sound : Z7_1_0E_5_4.Encloses (Foundation.entropyTerm (Z7_1_0Value ((5,4) : PairSlot))) := by + exact contains_sound (entropyTerm_ball (Z7_1_0Probs_sound ((5,4) : PairSlot)) Z7_1_0E_5_4Log_sound) (by decide +kernel) +def Z7_1_0Terms (a : PairSlot) : Ball := + match a.1.val, a.2.val with + | 4, 5 => ⟨(6931471805599453094172319305033 / 20000000000000000000000000000000), (21175823683 / 100000000000000000000000000000000)⟩ + | 5, 4 => ⟨(6931471805599453094172319305033 / 20000000000000000000000000000000), (21175823683 / 100000000000000000000000000000000)⟩ + | _, _ => (.exact 0) +lemma Z7_1_0Terms_sound (a : PairSlot) : + (Z7_1_0Terms a).Encloses (Foundation.entropyTerm (Z7_1_0Value a)) := by + rcases a with ⟨i,j⟩ + revert j i + apply forall_fin6 + · exact forall_fin6 (entropyTerm_zero_ball (Z7_1_0Probs_sound ((0,0) : PairSlot))) (entropyTerm_zero_ball (Z7_1_0Probs_sound ((0,1) : PairSlot))) (entropyTerm_zero_ball (Z7_1_0Probs_sound ((0,2) : PairSlot))) (entropyTerm_zero_ball (Z7_1_0Probs_sound ((0,3) : PairSlot))) (entropyTerm_zero_ball (Z7_1_0Probs_sound ((0,4) : PairSlot))) (entropyTerm_zero_ball (Z7_1_0Probs_sound ((0,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball (Z7_1_0Probs_sound ((1,0) : PairSlot))) (entropyTerm_zero_ball (Z7_1_0Probs_sound ((1,1) : PairSlot))) (entropyTerm_zero_ball (Z7_1_0Probs_sound ((1,2) : PairSlot))) (entropyTerm_zero_ball (Z7_1_0Probs_sound ((1,3) : PairSlot))) (entropyTerm_zero_ball (Z7_1_0Probs_sound ((1,4) : PairSlot))) (entropyTerm_zero_ball (Z7_1_0Probs_sound ((1,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball (Z7_1_0Probs_sound ((2,0) : PairSlot))) (entropyTerm_zero_ball (Z7_1_0Probs_sound ((2,1) : PairSlot))) (entropyTerm_zero_ball (Z7_1_0Probs_sound ((2,2) : PairSlot))) (entropyTerm_zero_ball (Z7_1_0Probs_sound ((2,3) : PairSlot))) (entropyTerm_zero_ball (Z7_1_0Probs_sound ((2,4) : PairSlot))) (entropyTerm_zero_ball (Z7_1_0Probs_sound ((2,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball (Z7_1_0Probs_sound ((3,0) : PairSlot))) (entropyTerm_zero_ball (Z7_1_0Probs_sound ((3,1) : PairSlot))) (entropyTerm_zero_ball (Z7_1_0Probs_sound ((3,2) : PairSlot))) (entropyTerm_zero_ball (Z7_1_0Probs_sound ((3,3) : PairSlot))) (entropyTerm_zero_ball (Z7_1_0Probs_sound ((3,4) : PairSlot))) (entropyTerm_zero_ball (Z7_1_0Probs_sound ((3,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball (Z7_1_0Probs_sound ((4,0) : PairSlot))) (entropyTerm_zero_ball (Z7_1_0Probs_sound ((4,1) : PairSlot))) (entropyTerm_zero_ball (Z7_1_0Probs_sound ((4,2) : PairSlot))) (entropyTerm_zero_ball (Z7_1_0Probs_sound ((4,3) : PairSlot))) (entropyTerm_zero_ball (Z7_1_0Probs_sound ((4,4) : PairSlot))) Z7_1_0E_4_5_sound + · exact forall_fin6 (entropyTerm_zero_ball (Z7_1_0Probs_sound ((5,0) : PairSlot))) (entropyTerm_zero_ball (Z7_1_0Probs_sound ((5,1) : PairSlot))) (entropyTerm_zero_ball (Z7_1_0Probs_sound ((5,2) : PairSlot))) (entropyTerm_zero_ball (Z7_1_0Probs_sound ((5,3) : PairSlot))) Z7_1_0E_5_4_sound (entropyTerm_zero_ball (Z7_1_0Probs_sound ((5,5) : PairSlot))) +def Z7_1_0Entropy : Ball := ⟨(6931471805599453094172319305033 / 10000000000000000000000000000000), (21175823683 / 50000000000000000000000000000000)⟩ +lemma Z7_1_0Entropy_sound : Z7_1_0Entropy.Encloses (Foundation.finiteEntropy Z7_1_0Value) := by + exact contains_sound (entropyPair_enclosed Z7_1_0Value Z7_1_0Terms Z7_1_0Terms_sound) (by decide +kernel) +def Z7_1_0Labels : Ball := ⟨(115129254649702284200899544090987 / 50000000000000000000000000000000), (21175823683 / 25000000000000000000000000000000)⟩ +lemma Z7_1_0Labels_sound : Z7_1_0Labels.Encloses + (∑ a : PairSlot, (zeroPairLaw (shape 7 1 0) a.1 a.2 : ℝ) * + Real.log (AllFieldParameters.multiplicity a.1 * AllFieldParameters.multiplicity a.2 : ℕ)) := by + exact contains_sound (pairSumBall_sound (fun a => .mul (Z7_1_0Probs a) (multLogs a)) + _ (fun a => Ball.mul_sound (Z7_1_0Probs_sound a) (multLogs_sound a))) (by decide +kernel) +def Z7_1_0Four : Ball := ⟨(18723326709712443708970142577019 / 6250000000000000000000000000000), (63527471049 / 50000000000000000000000000000000)⟩ +lemma Z7_1_0Four_sound : Z7_1_0Four.Encloses (AllFieldZeroLeafRates.fourRate (shape 7 1 0)) := by + exact contains_sound (Ball.add_sound Z7_1_0Entropy_sound Z7_1_0Labels_sound) (by decide +kernel) +def Z7_1_0H0Value (a : PairSlot) : ℝ := (halfLaw (shape 7 1 0) 0 a : ℝ) +def Z7_1_0H0E_4_5LogWitness : LogWitness := ⟨-1, 1, 1⟩ +def Z7_1_0H0E_4_5Log : Ball := ⟨(-6931471805599453094172319305033 / 10000000000000000000000000000000), (8470329473 / 20000000000000000000000000000000)⟩ +lemma Z7_1_0H0E_4_5Log_sound : Z7_1_0H0E_4_5Log.Encloses (Real.log (Z7_1_0H0Value ((4,5) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound ((Z7_1_0Half_sound 0) ((4,5) : PairSlot)) (w := Z7_1_0H0E_4_5LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z7_1_0H0E_4_5 : Ball := ⟨(6931471805599453094172319305033 / 20000000000000000000000000000000), (21175823683 / 100000000000000000000000000000000)⟩ +lemma Z7_1_0H0E_4_5_sound : Z7_1_0H0E_4_5.Encloses (Foundation.entropyTerm (Z7_1_0H0Value ((4,5) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z7_1_0Half_sound 0) ((4,5) : PairSlot)) Z7_1_0H0E_4_5Log_sound) (by decide +kernel) +def Z7_1_0H0E_5_4LogWitness : LogWitness := ⟨-1, 1, 1⟩ +def Z7_1_0H0E_5_4Log : Ball := ⟨(-6931471805599453094172319305033 / 10000000000000000000000000000000), (8470329473 / 20000000000000000000000000000000)⟩ +lemma Z7_1_0H0E_5_4Log_sound : Z7_1_0H0E_5_4Log.Encloses (Real.log (Z7_1_0H0Value ((5,4) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound ((Z7_1_0Half_sound 0) ((5,4) : PairSlot)) (w := Z7_1_0H0E_5_4LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z7_1_0H0E_5_4 : Ball := ⟨(6931471805599453094172319305033 / 20000000000000000000000000000000), (21175823683 / 100000000000000000000000000000000)⟩ +lemma Z7_1_0H0E_5_4_sound : Z7_1_0H0E_5_4.Encloses (Foundation.entropyTerm (Z7_1_0H0Value ((5,4) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z7_1_0Half_sound 0) ((5,4) : PairSlot)) Z7_1_0H0E_5_4Log_sound) (by decide +kernel) +def Z7_1_0H0Terms (a : PairSlot) : Ball := + match a.1.val, a.2.val with + | 4, 5 => ⟨(6931471805599453094172319305033 / 20000000000000000000000000000000), (21175823683 / 100000000000000000000000000000000)⟩ + | 5, 4 => ⟨(6931471805599453094172319305033 / 20000000000000000000000000000000), (21175823683 / 100000000000000000000000000000000)⟩ + | _, _ => (.exact 0) +lemma Z7_1_0H0Terms_sound (a : PairSlot) : + (Z7_1_0H0Terms a).Encloses (Foundation.entropyTerm (Z7_1_0H0Value a)) := by + rcases a with ⟨i,j⟩ + revert j i + apply forall_fin6 + · exact forall_fin6 (entropyTerm_zero_ball ((Z7_1_0Half_sound 0) ((0,0) : PairSlot))) (entropyTerm_zero_ball ((Z7_1_0Half_sound 0) ((0,1) : PairSlot))) (entropyTerm_zero_ball ((Z7_1_0Half_sound 0) ((0,2) : PairSlot))) (entropyTerm_zero_ball ((Z7_1_0Half_sound 0) ((0,3) : PairSlot))) (entropyTerm_zero_ball ((Z7_1_0Half_sound 0) ((0,4) : PairSlot))) (entropyTerm_zero_ball ((Z7_1_0Half_sound 0) ((0,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z7_1_0Half_sound 0) ((1,0) : PairSlot))) (entropyTerm_zero_ball ((Z7_1_0Half_sound 0) ((1,1) : PairSlot))) (entropyTerm_zero_ball ((Z7_1_0Half_sound 0) ((1,2) : PairSlot))) (entropyTerm_zero_ball ((Z7_1_0Half_sound 0) ((1,3) : PairSlot))) (entropyTerm_zero_ball ((Z7_1_0Half_sound 0) ((1,4) : PairSlot))) (entropyTerm_zero_ball ((Z7_1_0Half_sound 0) ((1,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z7_1_0Half_sound 0) ((2,0) : PairSlot))) (entropyTerm_zero_ball ((Z7_1_0Half_sound 0) ((2,1) : PairSlot))) (entropyTerm_zero_ball ((Z7_1_0Half_sound 0) ((2,2) : PairSlot))) (entropyTerm_zero_ball ((Z7_1_0Half_sound 0) ((2,3) : PairSlot))) (entropyTerm_zero_ball ((Z7_1_0Half_sound 0) ((2,4) : PairSlot))) (entropyTerm_zero_ball ((Z7_1_0Half_sound 0) ((2,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z7_1_0Half_sound 0) ((3,0) : PairSlot))) (entropyTerm_zero_ball ((Z7_1_0Half_sound 0) ((3,1) : PairSlot))) (entropyTerm_zero_ball ((Z7_1_0Half_sound 0) ((3,2) : PairSlot))) (entropyTerm_zero_ball ((Z7_1_0Half_sound 0) ((3,3) : PairSlot))) (entropyTerm_zero_ball ((Z7_1_0Half_sound 0) ((3,4) : PairSlot))) (entropyTerm_zero_ball ((Z7_1_0Half_sound 0) ((3,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z7_1_0Half_sound 0) ((4,0) : PairSlot))) (entropyTerm_zero_ball ((Z7_1_0Half_sound 0) ((4,1) : PairSlot))) (entropyTerm_zero_ball ((Z7_1_0Half_sound 0) ((4,2) : PairSlot))) (entropyTerm_zero_ball ((Z7_1_0Half_sound 0) ((4,3) : PairSlot))) (entropyTerm_zero_ball ((Z7_1_0Half_sound 0) ((4,4) : PairSlot))) Z7_1_0H0E_4_5_sound + · exact forall_fin6 (entropyTerm_zero_ball ((Z7_1_0Half_sound 0) ((5,0) : PairSlot))) (entropyTerm_zero_ball ((Z7_1_0Half_sound 0) ((5,1) : PairSlot))) (entropyTerm_zero_ball ((Z7_1_0Half_sound 0) ((5,2) : PairSlot))) (entropyTerm_zero_ball ((Z7_1_0Half_sound 0) ((5,3) : PairSlot))) Z7_1_0H0E_5_4_sound (entropyTerm_zero_ball ((Z7_1_0Half_sound 0) ((5,5) : PairSlot))) +def Z7_1_0H0Entropy : Ball := ⟨(6931471805599453094172319305033 / 10000000000000000000000000000000), (21175823683 / 50000000000000000000000000000000)⟩ +lemma Z7_1_0H0Entropy_sound : Z7_1_0H0Entropy.Encloses (Foundation.finiteEntropy Z7_1_0H0Value) := by + exact contains_sound (entropyPair_enclosed Z7_1_0H0Value Z7_1_0H0Terms Z7_1_0H0Terms_sound) (by decide +kernel) +def Z7_1_0H0Mass : Ball := ⟨1, 0⟩ +lemma Z7_1_0H0Mass_sound : Z7_1_0H0Mass.Encloses (∑ a, Z7_1_0H0Value a) := by + exact contains_sound (pairSumBall_sound (Z7_1_0Half 0) Z7_1_0H0Value (Z7_1_0Half_sound 0)) (by decide +kernel) +def Z7_1_0H0MassTermLog : Ball := .exact 0 +lemma Z7_1_0H0MassTermLog_sound : Z7_1_0H0MassTermLog.Encloses (Real.log ((∑ a, Z7_1_0H0Value a))) := by + exact log_exact_one_ball (Z7_1_0H0Mass_sound) +def Z7_1_0H0MassTerm : Ball := ⟨0, 0⟩ +lemma Z7_1_0H0MassTerm_sound : Z7_1_0H0MassTerm.Encloses (Foundation.entropyTerm ((∑ a, Z7_1_0H0Value a))) := by + exact contains_sound (entropyTerm_ball (Z7_1_0H0Mass_sound) Z7_1_0H0MassTermLog_sound) (by decide +kernel) +def Z7_1_0H0H : Ball := ⟨(6931471805599453094172319305033 / 10000000000000000000000000000000), (21175823683 / 50000000000000000000000000000000)⟩ +lemma Z7_1_0H0H_sound : Z7_1_0H0H.Encloses (homogeneousEntropy Z7_1_0H0Value) := by + exact contains_sound (homogeneous_enclosed Z7_1_0H0Value Z7_1_0H0MassTerm_sound Z7_1_0H0Entropy_sound) (by decide +kernel) +def Z7_1_0H1Value (a : PairSlot) : ℝ := (halfLaw (shape 7 1 0) 1 a : ℝ) +def Z7_1_0H1E_1_0LogWitness : LogWitness := ⟨-1, 1, 1⟩ +def Z7_1_0H1E_1_0Log : Ball := ⟨(-6931471805599453094172319305033 / 10000000000000000000000000000000), (8470329473 / 20000000000000000000000000000000)⟩ +lemma Z7_1_0H1E_1_0Log_sound : Z7_1_0H1E_1_0Log.Encloses (Real.log (Z7_1_0H1Value ((1,0) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound ((Z7_1_0Half_sound 1) ((1,0) : PairSlot)) (w := Z7_1_0H1E_1_0LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z7_1_0H1E_1_0 : Ball := ⟨(6931471805599453094172319305033 / 20000000000000000000000000000000), (21175823683 / 100000000000000000000000000000000)⟩ +lemma Z7_1_0H1E_1_0_sound : Z7_1_0H1E_1_0.Encloses (Foundation.entropyTerm (Z7_1_0H1Value ((1,0) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z7_1_0Half_sound 1) ((1,0) : PairSlot)) Z7_1_0H1E_1_0Log_sound) (by decide +kernel) +def Z7_1_0H1E_0_1LogWitness : LogWitness := ⟨-1, 1, 1⟩ +def Z7_1_0H1E_0_1Log : Ball := ⟨(-6931471805599453094172319305033 / 10000000000000000000000000000000), (8470329473 / 20000000000000000000000000000000)⟩ +lemma Z7_1_0H1E_0_1Log_sound : Z7_1_0H1E_0_1Log.Encloses (Real.log (Z7_1_0H1Value ((0,1) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound ((Z7_1_0Half_sound 1) ((0,1) : PairSlot)) (w := Z7_1_0H1E_0_1LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z7_1_0H1E_0_1 : Ball := ⟨(6931471805599453094172319305033 / 20000000000000000000000000000000), (21175823683 / 100000000000000000000000000000000)⟩ +lemma Z7_1_0H1E_0_1_sound : Z7_1_0H1E_0_1.Encloses (Foundation.entropyTerm (Z7_1_0H1Value ((0,1) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z7_1_0Half_sound 1) ((0,1) : PairSlot)) Z7_1_0H1E_0_1Log_sound) (by decide +kernel) +def Z7_1_0H1Terms (a : PairSlot) : Ball := + match a.1.val, a.2.val with + | 1, 0 => ⟨(6931471805599453094172319305033 / 20000000000000000000000000000000), (21175823683 / 100000000000000000000000000000000)⟩ + | 0, 1 => ⟨(6931471805599453094172319305033 / 20000000000000000000000000000000), (21175823683 / 100000000000000000000000000000000)⟩ + | _, _ => (.exact 0) +lemma Z7_1_0H1Terms_sound (a : PairSlot) : + (Z7_1_0H1Terms a).Encloses (Foundation.entropyTerm (Z7_1_0H1Value a)) := by + rcases a with ⟨i,j⟩ + revert j i + apply forall_fin6 + · exact forall_fin6 (entropyTerm_zero_ball ((Z7_1_0Half_sound 1) ((0,0) : PairSlot))) Z7_1_0H1E_0_1_sound (entropyTerm_zero_ball ((Z7_1_0Half_sound 1) ((0,2) : PairSlot))) (entropyTerm_zero_ball ((Z7_1_0Half_sound 1) ((0,3) : PairSlot))) (entropyTerm_zero_ball ((Z7_1_0Half_sound 1) ((0,4) : PairSlot))) (entropyTerm_zero_ball ((Z7_1_0Half_sound 1) ((0,5) : PairSlot))) + · exact forall_fin6 Z7_1_0H1E_1_0_sound (entropyTerm_zero_ball ((Z7_1_0Half_sound 1) ((1,1) : PairSlot))) (entropyTerm_zero_ball ((Z7_1_0Half_sound 1) ((1,2) : PairSlot))) (entropyTerm_zero_ball ((Z7_1_0Half_sound 1) ((1,3) : PairSlot))) (entropyTerm_zero_ball ((Z7_1_0Half_sound 1) ((1,4) : PairSlot))) (entropyTerm_zero_ball ((Z7_1_0Half_sound 1) ((1,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z7_1_0Half_sound 1) ((2,0) : PairSlot))) (entropyTerm_zero_ball ((Z7_1_0Half_sound 1) ((2,1) : PairSlot))) (entropyTerm_zero_ball ((Z7_1_0Half_sound 1) ((2,2) : PairSlot))) (entropyTerm_zero_ball ((Z7_1_0Half_sound 1) ((2,3) : PairSlot))) (entropyTerm_zero_ball ((Z7_1_0Half_sound 1) ((2,4) : PairSlot))) (entropyTerm_zero_ball ((Z7_1_0Half_sound 1) ((2,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z7_1_0Half_sound 1) ((3,0) : PairSlot))) (entropyTerm_zero_ball ((Z7_1_0Half_sound 1) ((3,1) : PairSlot))) (entropyTerm_zero_ball ((Z7_1_0Half_sound 1) ((3,2) : PairSlot))) (entropyTerm_zero_ball ((Z7_1_0Half_sound 1) ((3,3) : PairSlot))) (entropyTerm_zero_ball ((Z7_1_0Half_sound 1) ((3,4) : PairSlot))) (entropyTerm_zero_ball ((Z7_1_0Half_sound 1) ((3,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z7_1_0Half_sound 1) ((4,0) : PairSlot))) (entropyTerm_zero_ball ((Z7_1_0Half_sound 1) ((4,1) : PairSlot))) (entropyTerm_zero_ball ((Z7_1_0Half_sound 1) ((4,2) : PairSlot))) (entropyTerm_zero_ball ((Z7_1_0Half_sound 1) ((4,3) : PairSlot))) (entropyTerm_zero_ball ((Z7_1_0Half_sound 1) ((4,4) : PairSlot))) (entropyTerm_zero_ball ((Z7_1_0Half_sound 1) ((4,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z7_1_0Half_sound 1) ((5,0) : PairSlot))) (entropyTerm_zero_ball ((Z7_1_0Half_sound 1) ((5,1) : PairSlot))) (entropyTerm_zero_ball ((Z7_1_0Half_sound 1) ((5,2) : PairSlot))) (entropyTerm_zero_ball ((Z7_1_0Half_sound 1) ((5,3) : PairSlot))) (entropyTerm_zero_ball ((Z7_1_0Half_sound 1) ((5,4) : PairSlot))) (entropyTerm_zero_ball ((Z7_1_0Half_sound 1) ((5,5) : PairSlot))) +def Z7_1_0H1Entropy : Ball := ⟨(6931471805599453094172319305033 / 10000000000000000000000000000000), (21175823683 / 50000000000000000000000000000000)⟩ +lemma Z7_1_0H1Entropy_sound : Z7_1_0H1Entropy.Encloses (Foundation.finiteEntropy Z7_1_0H1Value) := by + exact contains_sound (entropyPair_enclosed Z7_1_0H1Value Z7_1_0H1Terms Z7_1_0H1Terms_sound) (by decide +kernel) +def Z7_1_0H1Mass : Ball := ⟨1, 0⟩ +lemma Z7_1_0H1Mass_sound : Z7_1_0H1Mass.Encloses (∑ a, Z7_1_0H1Value a) := by + exact contains_sound (pairSumBall_sound (Z7_1_0Half 1) Z7_1_0H1Value (Z7_1_0Half_sound 1)) (by decide +kernel) +def Z7_1_0H1MassTermLog : Ball := .exact 0 +lemma Z7_1_0H1MassTermLog_sound : Z7_1_0H1MassTermLog.Encloses (Real.log ((∑ a, Z7_1_0H1Value a))) := by + exact log_exact_one_ball (Z7_1_0H1Mass_sound) +def Z7_1_0H1MassTerm : Ball := ⟨0, 0⟩ +lemma Z7_1_0H1MassTerm_sound : Z7_1_0H1MassTerm.Encloses (Foundation.entropyTerm ((∑ a, Z7_1_0H1Value a))) := by + exact contains_sound (entropyTerm_ball (Z7_1_0H1Mass_sound) Z7_1_0H1MassTermLog_sound) (by decide +kernel) +def Z7_1_0H1H : Ball := ⟨(6931471805599453094172319305033 / 10000000000000000000000000000000), (21175823683 / 50000000000000000000000000000000)⟩ +lemma Z7_1_0H1H_sound : Z7_1_0H1H.Encloses (homogeneousEntropy Z7_1_0H1Value) := by + exact contains_sound (homogeneous_enclosed Z7_1_0H1Value Z7_1_0H1MassTerm_sound Z7_1_0H1Entropy_sound) (by decide +kernel) +def Z7_1_0H2Value (a : PairSlot) : ℝ := (halfLaw (shape 7 1 0) 2 a : ℝ) +def Z7_1_0H2E_0_0Log : Ball := .exact 0 +lemma Z7_1_0H2E_0_0Log_sound : Z7_1_0H2E_0_0Log.Encloses (Real.log (Z7_1_0H2Value ((0,0) : PairSlot))) := by + exact log_exact_one_ball ((Z7_1_0Half_sound 2) ((0,0) : PairSlot)) +def Z7_1_0H2E_0_0 : Ball := ⟨0, 0⟩ +lemma Z7_1_0H2E_0_0_sound : Z7_1_0H2E_0_0.Encloses (Foundation.entropyTerm (Z7_1_0H2Value ((0,0) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z7_1_0Half_sound 2) ((0,0) : PairSlot)) Z7_1_0H2E_0_0Log_sound) (by decide +kernel) +def Z7_1_0H2Terms (a : PairSlot) : Ball := + match a.1.val, a.2.val with + | 0, 0 => ⟨0, 0⟩ + | _, _ => (.exact 0) +lemma Z7_1_0H2Terms_sound (a : PairSlot) : + (Z7_1_0H2Terms a).Encloses (Foundation.entropyTerm (Z7_1_0H2Value a)) := by + rcases a with ⟨i,j⟩ + revert j i + apply forall_fin6 + · exact forall_fin6 Z7_1_0H2E_0_0_sound (entropyTerm_zero_ball ((Z7_1_0Half_sound 2) ((0,1) : PairSlot))) (entropyTerm_zero_ball ((Z7_1_0Half_sound 2) ((0,2) : PairSlot))) (entropyTerm_zero_ball ((Z7_1_0Half_sound 2) ((0,3) : PairSlot))) (entropyTerm_zero_ball ((Z7_1_0Half_sound 2) ((0,4) : PairSlot))) (entropyTerm_zero_ball ((Z7_1_0Half_sound 2) ((0,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z7_1_0Half_sound 2) ((1,0) : PairSlot))) (entropyTerm_zero_ball ((Z7_1_0Half_sound 2) ((1,1) : PairSlot))) (entropyTerm_zero_ball ((Z7_1_0Half_sound 2) ((1,2) : PairSlot))) (entropyTerm_zero_ball ((Z7_1_0Half_sound 2) ((1,3) : PairSlot))) (entropyTerm_zero_ball ((Z7_1_0Half_sound 2) ((1,4) : PairSlot))) (entropyTerm_zero_ball ((Z7_1_0Half_sound 2) ((1,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z7_1_0Half_sound 2) ((2,0) : PairSlot))) (entropyTerm_zero_ball ((Z7_1_0Half_sound 2) ((2,1) : PairSlot))) (entropyTerm_zero_ball ((Z7_1_0Half_sound 2) ((2,2) : PairSlot))) (entropyTerm_zero_ball ((Z7_1_0Half_sound 2) ((2,3) : PairSlot))) (entropyTerm_zero_ball ((Z7_1_0Half_sound 2) ((2,4) : PairSlot))) (entropyTerm_zero_ball ((Z7_1_0Half_sound 2) ((2,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z7_1_0Half_sound 2) ((3,0) : PairSlot))) (entropyTerm_zero_ball ((Z7_1_0Half_sound 2) ((3,1) : PairSlot))) (entropyTerm_zero_ball ((Z7_1_0Half_sound 2) ((3,2) : PairSlot))) (entropyTerm_zero_ball ((Z7_1_0Half_sound 2) ((3,3) : PairSlot))) (entropyTerm_zero_ball ((Z7_1_0Half_sound 2) ((3,4) : PairSlot))) (entropyTerm_zero_ball ((Z7_1_0Half_sound 2) ((3,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z7_1_0Half_sound 2) ((4,0) : PairSlot))) (entropyTerm_zero_ball ((Z7_1_0Half_sound 2) ((4,1) : PairSlot))) (entropyTerm_zero_ball ((Z7_1_0Half_sound 2) ((4,2) : PairSlot))) (entropyTerm_zero_ball ((Z7_1_0Half_sound 2) ((4,3) : PairSlot))) (entropyTerm_zero_ball ((Z7_1_0Half_sound 2) ((4,4) : PairSlot))) (entropyTerm_zero_ball ((Z7_1_0Half_sound 2) ((4,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z7_1_0Half_sound 2) ((5,0) : PairSlot))) (entropyTerm_zero_ball ((Z7_1_0Half_sound 2) ((5,1) : PairSlot))) (entropyTerm_zero_ball ((Z7_1_0Half_sound 2) ((5,2) : PairSlot))) (entropyTerm_zero_ball ((Z7_1_0Half_sound 2) ((5,3) : PairSlot))) (entropyTerm_zero_ball ((Z7_1_0Half_sound 2) ((5,4) : PairSlot))) (entropyTerm_zero_ball ((Z7_1_0Half_sound 2) ((5,5) : PairSlot))) +def Z7_1_0H2Entropy : Ball := ⟨0, 0⟩ +lemma Z7_1_0H2Entropy_sound : Z7_1_0H2Entropy.Encloses (Foundation.finiteEntropy Z7_1_0H2Value) := by + exact contains_sound (entropyPair_enclosed Z7_1_0H2Value Z7_1_0H2Terms Z7_1_0H2Terms_sound) (by decide +kernel) +def Z7_1_0H2Mass : Ball := ⟨1, 0⟩ +lemma Z7_1_0H2Mass_sound : Z7_1_0H2Mass.Encloses (∑ a, Z7_1_0H2Value a) := by + exact contains_sound (pairSumBall_sound (Z7_1_0Half 2) Z7_1_0H2Value (Z7_1_0Half_sound 2)) (by decide +kernel) +def Z7_1_0H2MassTermLog : Ball := .exact 0 +lemma Z7_1_0H2MassTermLog_sound : Z7_1_0H2MassTermLog.Encloses (Real.log ((∑ a, Z7_1_0H2Value a))) := by + exact log_exact_one_ball (Z7_1_0H2Mass_sound) +def Z7_1_0H2MassTerm : Ball := ⟨0, 0⟩ +lemma Z7_1_0H2MassTerm_sound : Z7_1_0H2MassTerm.Encloses (Foundation.entropyTerm ((∑ a, Z7_1_0H2Value a))) := by + exact contains_sound (entropyTerm_ball (Z7_1_0H2Mass_sound) Z7_1_0H2MassTermLog_sound) (by decide +kernel) +def Z7_1_0H2H : Ball := ⟨0, 0⟩ +lemma Z7_1_0H2H_sound : Z7_1_0H2H.Encloses (homogeneousEntropy Z7_1_0H2Value) := by + exact contains_sound (homogeneous_enclosed Z7_1_0H2Value Z7_1_0H2MassTerm_sound Z7_1_0H2Entropy_sound) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/Certificates/Four8_0_0.lean b/lean/OAI/LinearAlgebra/MatrixFields/Certificates/Four8_0_0.lean new file mode 100644 index 0000000000000000000000000000000000000000..a5e5e6a6c7ac87bfd34303fb44acac8014712487 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/Certificates/Four8_0_0.lean @@ -0,0 +1,415 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Certificates.Zero0_1_7 + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def Z8_0_0Raw (ij : PairSlot) : Ball := + match ij.1.val, ij.2.val with + | 0, 0 => w195 + | 0, 1 => w195 + | 0, 2 => w195 + | 0, 3 => w195 + | 0, 4 => w195 + | 0, 5 => w195 + | 1, 0 => w195 + | 1, 1 => w195 + | 1, 2 => w195 + | 1, 3 => w195 + | 1, 4 => w195 + | 1, 5 => w195 + | 2, 0 => w195 + | 2, 1 => w195 + | 2, 2 => w195 + | 2, 3 => w195 + | 2, 4 => w195 + | 2, 5 => w195 + | 3, 0 => w195 + | 3, 1 => w195 + | 3, 2 => w195 + | 3, 3 => w195 + | 3, 4 => w195 + | 3, 5 => w195 + | 4, 0 => w195 + | 4, 1 => w195 + | 4, 2 => w195 + | 4, 3 => w195 + | 4, 4 => w195 + | 4, 5 => w195 + | 5, 0 => w195 + | 5, 1 => w195 + | 5, 2 => w195 + | 5, 3 => w195 + | 5, 4 => w195 + | 5, 5 => w195 + | _, _ => (.exact 0) +lemma Z8_0_0Raw_sound_0 (j : Fin 6) : + (Z8_0_0Raw (0,j)).Encloses (weight (orderedPairInteger (shape 8 0 0) 0 j) : ℝ) := by + fin_cases j + · change (Z8_0_0Raw (0,0)).Encloses (weight (orderedPairInteger (shape 8 0 0) 0 0) : ℝ) + have he : orderedPairInteger (shape 8 0 0) 0 0 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z8_0_0Raw (0,1)).Encloses (weight (orderedPairInteger (shape 8 0 0) 0 1) : ℝ) + have he : orderedPairInteger (shape 8 0 0) 0 1 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z8_0_0Raw (0,2)).Encloses (weight (orderedPairInteger (shape 8 0 0) 0 2) : ℝ) + have he : orderedPairInteger (shape 8 0 0) 0 2 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z8_0_0Raw (0,3)).Encloses (weight (orderedPairInteger (shape 8 0 0) 0 3) : ℝ) + have he : orderedPairInteger (shape 8 0 0) 0 3 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z8_0_0Raw (0,4)).Encloses (weight (orderedPairInteger (shape 8 0 0) 0 4) : ℝ) + have he : orderedPairInteger (shape 8 0 0) 0 4 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z8_0_0Raw (0,5)).Encloses (weight (orderedPairInteger (shape 8 0 0) 0 5) : ℝ) + have he : orderedPairInteger (shape 8 0 0) 0 5 = (0) := by decide +kernel + rw [he] + exact w195_sound +lemma Z8_0_0Raw_sound_1 (j : Fin 6) : + (Z8_0_0Raw (1,j)).Encloses (weight (orderedPairInteger (shape 8 0 0) 1 j) : ℝ) := by + fin_cases j + · change (Z8_0_0Raw (1,0)).Encloses (weight (orderedPairInteger (shape 8 0 0) 1 0) : ℝ) + have he : orderedPairInteger (shape 8 0 0) 1 0 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z8_0_0Raw (1,1)).Encloses (weight (orderedPairInteger (shape 8 0 0) 1 1) : ℝ) + have he : orderedPairInteger (shape 8 0 0) 1 1 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z8_0_0Raw (1,2)).Encloses (weight (orderedPairInteger (shape 8 0 0) 1 2) : ℝ) + have he : orderedPairInteger (shape 8 0 0) 1 2 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z8_0_0Raw (1,3)).Encloses (weight (orderedPairInteger (shape 8 0 0) 1 3) : ℝ) + have he : orderedPairInteger (shape 8 0 0) 1 3 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z8_0_0Raw (1,4)).Encloses (weight (orderedPairInteger (shape 8 0 0) 1 4) : ℝ) + have he : orderedPairInteger (shape 8 0 0) 1 4 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z8_0_0Raw (1,5)).Encloses (weight (orderedPairInteger (shape 8 0 0) 1 5) : ℝ) + have he : orderedPairInteger (shape 8 0 0) 1 5 = (0) := by decide +kernel + rw [he] + exact w195_sound +lemma Z8_0_0Raw_sound_2 (j : Fin 6) : + (Z8_0_0Raw (2,j)).Encloses (weight (orderedPairInteger (shape 8 0 0) 2 j) : ℝ) := by + fin_cases j + · change (Z8_0_0Raw (2,0)).Encloses (weight (orderedPairInteger (shape 8 0 0) 2 0) : ℝ) + have he : orderedPairInteger (shape 8 0 0) 2 0 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z8_0_0Raw (2,1)).Encloses (weight (orderedPairInteger (shape 8 0 0) 2 1) : ℝ) + have he : orderedPairInteger (shape 8 0 0) 2 1 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z8_0_0Raw (2,2)).Encloses (weight (orderedPairInteger (shape 8 0 0) 2 2) : ℝ) + have he : orderedPairInteger (shape 8 0 0) 2 2 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z8_0_0Raw (2,3)).Encloses (weight (orderedPairInteger (shape 8 0 0) 2 3) : ℝ) + have he : orderedPairInteger (shape 8 0 0) 2 3 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z8_0_0Raw (2,4)).Encloses (weight (orderedPairInteger (shape 8 0 0) 2 4) : ℝ) + have he : orderedPairInteger (shape 8 0 0) 2 4 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z8_0_0Raw (2,5)).Encloses (weight (orderedPairInteger (shape 8 0 0) 2 5) : ℝ) + have he : orderedPairInteger (shape 8 0 0) 2 5 = (0) := by decide +kernel + rw [he] + exact w195_sound +lemma Z8_0_0Raw_sound_3 (j : Fin 6) : + (Z8_0_0Raw (3,j)).Encloses (weight (orderedPairInteger (shape 8 0 0) 3 j) : ℝ) := by + fin_cases j + · change (Z8_0_0Raw (3,0)).Encloses (weight (orderedPairInteger (shape 8 0 0) 3 0) : ℝ) + have he : orderedPairInteger (shape 8 0 0) 3 0 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z8_0_0Raw (3,1)).Encloses (weight (orderedPairInteger (shape 8 0 0) 3 1) : ℝ) + have he : orderedPairInteger (shape 8 0 0) 3 1 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z8_0_0Raw (3,2)).Encloses (weight (orderedPairInteger (shape 8 0 0) 3 2) : ℝ) + have he : orderedPairInteger (shape 8 0 0) 3 2 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z8_0_0Raw (3,3)).Encloses (weight (orderedPairInteger (shape 8 0 0) 3 3) : ℝ) + have he : orderedPairInteger (shape 8 0 0) 3 3 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z8_0_0Raw (3,4)).Encloses (weight (orderedPairInteger (shape 8 0 0) 3 4) : ℝ) + have he : orderedPairInteger (shape 8 0 0) 3 4 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z8_0_0Raw (3,5)).Encloses (weight (orderedPairInteger (shape 8 0 0) 3 5) : ℝ) + have he : orderedPairInteger (shape 8 0 0) 3 5 = (0) := by decide +kernel + rw [he] + exact w195_sound +lemma Z8_0_0Raw_sound_4 (j : Fin 6) : + (Z8_0_0Raw (4,j)).Encloses (weight (orderedPairInteger (shape 8 0 0) 4 j) : ℝ) := by + fin_cases j + · change (Z8_0_0Raw (4,0)).Encloses (weight (orderedPairInteger (shape 8 0 0) 4 0) : ℝ) + have he : orderedPairInteger (shape 8 0 0) 4 0 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z8_0_0Raw (4,1)).Encloses (weight (orderedPairInteger (shape 8 0 0) 4 1) : ℝ) + have he : orderedPairInteger (shape 8 0 0) 4 1 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z8_0_0Raw (4,2)).Encloses (weight (orderedPairInteger (shape 8 0 0) 4 2) : ℝ) + have he : orderedPairInteger (shape 8 0 0) 4 2 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z8_0_0Raw (4,3)).Encloses (weight (orderedPairInteger (shape 8 0 0) 4 3) : ℝ) + have he : orderedPairInteger (shape 8 0 0) 4 3 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z8_0_0Raw (4,4)).Encloses (weight (orderedPairInteger (shape 8 0 0) 4 4) : ℝ) + have he : orderedPairInteger (shape 8 0 0) 4 4 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z8_0_0Raw (4,5)).Encloses (weight (orderedPairInteger (shape 8 0 0) 4 5) : ℝ) + have he : orderedPairInteger (shape 8 0 0) 4 5 = (0) := by decide +kernel + rw [he] + exact w195_sound +lemma Z8_0_0Raw_sound_5 (j : Fin 6) : + (Z8_0_0Raw (5,j)).Encloses (weight (orderedPairInteger (shape 8 0 0) 5 j) : ℝ) := by + fin_cases j + · change (Z8_0_0Raw (5,0)).Encloses (weight (orderedPairInteger (shape 8 0 0) 5 0) : ℝ) + have he : orderedPairInteger (shape 8 0 0) 5 0 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z8_0_0Raw (5,1)).Encloses (weight (orderedPairInteger (shape 8 0 0) 5 1) : ℝ) + have he : orderedPairInteger (shape 8 0 0) 5 1 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z8_0_0Raw (5,2)).Encloses (weight (orderedPairInteger (shape 8 0 0) 5 2) : ℝ) + have he : orderedPairInteger (shape 8 0 0) 5 2 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z8_0_0Raw (5,3)).Encloses (weight (orderedPairInteger (shape 8 0 0) 5 3) : ℝ) + have he : orderedPairInteger (shape 8 0 0) 5 3 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z8_0_0Raw (5,4)).Encloses (weight (orderedPairInteger (shape 8 0 0) 5 4) : ℝ) + have he : orderedPairInteger (shape 8 0 0) 5 4 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z8_0_0Raw (5,5)).Encloses (weight (orderedPairInteger (shape 8 0 0) 5 5) : ℝ) + have he : orderedPairInteger (shape 8 0 0) 5 5 = (0) := by decide +kernel + rw [he] + exact w195_sound +lemma Z8_0_0Raw_sound (ij : PairSlot) : + (Z8_0_0Raw ij).Encloses (weight (orderedPairInteger (shape 8 0 0) ij.1 ij.2) : ℝ) := by + rcases ij with ⟨i,j⟩ + revert i + exact forall_fin6 (Z8_0_0Raw_sound_0 j) (Z8_0_0Raw_sound_1 j) (Z8_0_0Raw_sound_2 j) (Z8_0_0Raw_sound_3 j) (Z8_0_0Raw_sound_4 j) (Z8_0_0Raw_sound_5 j) +def Z8_0_0Den : Ball := ⟨1, 0⟩ +lemma Z8_0_0Den_sound : Z8_0_0Den.Encloses + (((orderedPairs (shape 8 0 0)).map (fun ij => weight (orderedPairInteger (shape 8 0 0) ij.1 ij.2))).sum : ℝ) := by + exact contains_sound (list_cast_enclosed (orderedPairs (shape 8 0 0)) Z8_0_0Raw + (fun ij => weight (orderedPairInteger (shape 8 0 0) ij.1 ij.2)) + (fun ij _ => Z8_0_0Raw_sound ij)) (by decide +kernel) +lemma Z8_0_0Den_pos : 0 < Z8_0_0Den.lower := by decide +kernel +def Z8_0_0Probs (ij : PairSlot) : Ball := + match ij.1.val, ij.2.val with + | 5, 5 => ⟨1, 0⟩ + | _, _ => (.exact 0) +lemma Z8_0_0Contains : ∀ i j : Fin 6, + statisticWeight i + statisticWeight j = shapeMax (shape 8 0 0) → + contains (.mul (Z8_0_0Raw (i,j)) (.inv Z8_0_0Den)) (Z8_0_0Probs (i,j)) = true := by + decide +kernel +lemma Z8_0_0Zero : ∀ i j : Fin 6, + statisticWeight i + statisticWeight j ≠ shapeMax (shape 8 0 0) → Z8_0_0Probs (i,j) = .exact 0 := by + decide +kernel +lemma Z8_0_0Probs_sound (ij : PairSlot) : + (Z8_0_0Probs ij).Encloses (zeroPairLaw (shape 8 0 0) ij.1 ij.2 : ℝ) := by + by_cases h : statisticWeight ij.1 + statisticWeight ij.2 = shapeMax (shape 8 0 0) + · have hb := contains_sound (Ball.mul_sound (Z8_0_0Raw_sound ij) + (Ball.inv_sound Z8_0_0Den_sound Z8_0_0Den_pos)) (Z8_0_0Contains ij.1 ij.2 h) + simpa only [zeroPairLaw, h, ite_true, Rat.cast_div, Rat.cast_mul, + Rat.cast_inv, div_eq_mul_inv] using hb + · rw [Z8_0_0Zero ij.1 ij.2 h] + simpa only [zeroPairLaw, h, ite_false] using Ball.exact_sound 0 + +def Z8_0_0Half (w : Fin 3) (ij : PairSlot) : Ball := + if (shape 8 0 0) w = 0 then if ij = (0,0) then .exact 1 else .exact 0 + else if w = halfMaxAxis (shape 8 0 0) then Z8_0_0Probs ij + else Z8_0_0Probs (kappa ij.1, kappa ij.2) +lemma Z8_0_0Half_sound (w : Fin 3) (ij : PairSlot) : + (Z8_0_0Half w ij).Encloses (halfLaw (shape 8 0 0) w ij : ℝ) := by + have hp : positive (shape 8 0 0) = false := by decide +kernel + simp only [Z8_0_0Half, halfLaw, hp, Bool.false_eq_true, ite_false] + split_ifs + · exact Ball.exact_sound 1 + · exact Ball.exact_sound 0 + · exact Z8_0_0Probs_sound _ + · exact Z8_0_0Probs_sound _ + +def Z8_0_0Value (a : PairSlot) : ℝ := (zeroPairLaw (shape 8 0 0) a.1 a.2 : ℝ) +def Z8_0_0E_5_5Log : Ball := .exact 0 +lemma Z8_0_0E_5_5Log_sound : Z8_0_0E_5_5Log.Encloses (Real.log (Z8_0_0Value ((5,5) : PairSlot))) := by + exact log_exact_one_ball (Z8_0_0Probs_sound ((5,5) : PairSlot)) +def Z8_0_0E_5_5 : Ball := ⟨0, 0⟩ +lemma Z8_0_0E_5_5_sound : Z8_0_0E_5_5.Encloses (Foundation.entropyTerm (Z8_0_0Value ((5,5) : PairSlot))) := by + exact contains_sound (entropyTerm_ball (Z8_0_0Probs_sound ((5,5) : PairSlot)) Z8_0_0E_5_5Log_sound) (by decide +kernel) +def Z8_0_0Terms (a : PairSlot) : Ball := + match a.1.val, a.2.val with + | 5, 5 => ⟨0, 0⟩ + | _, _ => (.exact 0) +lemma Z8_0_0Terms_sound (a : PairSlot) : + (Z8_0_0Terms a).Encloses (Foundation.entropyTerm (Z8_0_0Value a)) := by + rcases a with ⟨i,j⟩ + revert j i + apply forall_fin6 + · exact forall_fin6 (entropyTerm_zero_ball (Z8_0_0Probs_sound ((0,0) : PairSlot))) (entropyTerm_zero_ball (Z8_0_0Probs_sound ((0,1) : PairSlot))) (entropyTerm_zero_ball (Z8_0_0Probs_sound ((0,2) : PairSlot))) (entropyTerm_zero_ball (Z8_0_0Probs_sound ((0,3) : PairSlot))) (entropyTerm_zero_ball (Z8_0_0Probs_sound ((0,4) : PairSlot))) (entropyTerm_zero_ball (Z8_0_0Probs_sound ((0,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball (Z8_0_0Probs_sound ((1,0) : PairSlot))) (entropyTerm_zero_ball (Z8_0_0Probs_sound ((1,1) : PairSlot))) (entropyTerm_zero_ball (Z8_0_0Probs_sound ((1,2) : PairSlot))) (entropyTerm_zero_ball (Z8_0_0Probs_sound ((1,3) : PairSlot))) (entropyTerm_zero_ball (Z8_0_0Probs_sound ((1,4) : PairSlot))) (entropyTerm_zero_ball (Z8_0_0Probs_sound ((1,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball (Z8_0_0Probs_sound ((2,0) : PairSlot))) (entropyTerm_zero_ball (Z8_0_0Probs_sound ((2,1) : PairSlot))) (entropyTerm_zero_ball (Z8_0_0Probs_sound ((2,2) : PairSlot))) (entropyTerm_zero_ball (Z8_0_0Probs_sound ((2,3) : PairSlot))) (entropyTerm_zero_ball (Z8_0_0Probs_sound ((2,4) : PairSlot))) (entropyTerm_zero_ball (Z8_0_0Probs_sound ((2,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball (Z8_0_0Probs_sound ((3,0) : PairSlot))) (entropyTerm_zero_ball (Z8_0_0Probs_sound ((3,1) : PairSlot))) (entropyTerm_zero_ball (Z8_0_0Probs_sound ((3,2) : PairSlot))) (entropyTerm_zero_ball (Z8_0_0Probs_sound ((3,3) : PairSlot))) (entropyTerm_zero_ball (Z8_0_0Probs_sound ((3,4) : PairSlot))) (entropyTerm_zero_ball (Z8_0_0Probs_sound ((3,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball (Z8_0_0Probs_sound ((4,0) : PairSlot))) (entropyTerm_zero_ball (Z8_0_0Probs_sound ((4,1) : PairSlot))) (entropyTerm_zero_ball (Z8_0_0Probs_sound ((4,2) : PairSlot))) (entropyTerm_zero_ball (Z8_0_0Probs_sound ((4,3) : PairSlot))) (entropyTerm_zero_ball (Z8_0_0Probs_sound ((4,4) : PairSlot))) (entropyTerm_zero_ball (Z8_0_0Probs_sound ((4,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball (Z8_0_0Probs_sound ((5,0) : PairSlot))) (entropyTerm_zero_ball (Z8_0_0Probs_sound ((5,1) : PairSlot))) (entropyTerm_zero_ball (Z8_0_0Probs_sound ((5,2) : PairSlot))) (entropyTerm_zero_ball (Z8_0_0Probs_sound ((5,3) : PairSlot))) (entropyTerm_zero_ball (Z8_0_0Probs_sound ((5,4) : PairSlot))) Z8_0_0E_5_5_sound +def Z8_0_0Entropy : Ball := ⟨0, 0⟩ +lemma Z8_0_0Entropy_sound : Z8_0_0Entropy.Encloses (Foundation.finiteEntropy Z8_0_0Value) := by + exact contains_sound (entropyPair_enclosed Z8_0_0Value Z8_0_0Terms Z8_0_0Terms_sound) (by decide +kernel) +def Z8_0_0Labels : Ball := ⟨0, 0⟩ +lemma Z8_0_0Labels_sound : Z8_0_0Labels.Encloses + (∑ a : PairSlot, (zeroPairLaw (shape 8 0 0) a.1 a.2 : ℝ) * + Real.log (AllFieldParameters.multiplicity a.1 * AllFieldParameters.multiplicity a.2 : ℕ)) := by + exact contains_sound (pairSumBall_sound (fun a => .mul (Z8_0_0Probs a) (multLogs a)) + _ (fun a => Ball.mul_sound (Z8_0_0Probs_sound a) (multLogs_sound a))) (by decide +kernel) +def Z8_0_0Four : Ball := ⟨0, 0⟩ +lemma Z8_0_0Four_sound : Z8_0_0Four.Encloses (AllFieldZeroLeafRates.fourRate (shape 8 0 0)) := by + exact contains_sound (Ball.add_sound Z8_0_0Entropy_sound Z8_0_0Labels_sound) (by decide +kernel) +def Z8_0_0H0Value (a : PairSlot) : ℝ := (halfLaw (shape 8 0 0) 0 a : ℝ) +def Z8_0_0H0E_5_5Log : Ball := .exact 0 +lemma Z8_0_0H0E_5_5Log_sound : Z8_0_0H0E_5_5Log.Encloses (Real.log (Z8_0_0H0Value ((5,5) : PairSlot))) := by + exact log_exact_one_ball ((Z8_0_0Half_sound 0) ((5,5) : PairSlot)) +def Z8_0_0H0E_5_5 : Ball := ⟨0, 0⟩ +lemma Z8_0_0H0E_5_5_sound : Z8_0_0H0E_5_5.Encloses (Foundation.entropyTerm (Z8_0_0H0Value ((5,5) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z8_0_0Half_sound 0) ((5,5) : PairSlot)) Z8_0_0H0E_5_5Log_sound) (by decide +kernel) +def Z8_0_0H0Terms (a : PairSlot) : Ball := + match a.1.val, a.2.val with + | 5, 5 => ⟨0, 0⟩ + | _, _ => (.exact 0) +lemma Z8_0_0H0Terms_sound (a : PairSlot) : + (Z8_0_0H0Terms a).Encloses (Foundation.entropyTerm (Z8_0_0H0Value a)) := by + rcases a with ⟨i,j⟩ + revert j i + apply forall_fin6 + · exact forall_fin6 (entropyTerm_zero_ball ((Z8_0_0Half_sound 0) ((0,0) : PairSlot))) (entropyTerm_zero_ball ((Z8_0_0Half_sound 0) ((0,1) : PairSlot))) (entropyTerm_zero_ball ((Z8_0_0Half_sound 0) ((0,2) : PairSlot))) (entropyTerm_zero_ball ((Z8_0_0Half_sound 0) ((0,3) : PairSlot))) (entropyTerm_zero_ball ((Z8_0_0Half_sound 0) ((0,4) : PairSlot))) (entropyTerm_zero_ball ((Z8_0_0Half_sound 0) ((0,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z8_0_0Half_sound 0) ((1,0) : PairSlot))) (entropyTerm_zero_ball ((Z8_0_0Half_sound 0) ((1,1) : PairSlot))) (entropyTerm_zero_ball ((Z8_0_0Half_sound 0) ((1,2) : PairSlot))) (entropyTerm_zero_ball ((Z8_0_0Half_sound 0) ((1,3) : PairSlot))) (entropyTerm_zero_ball ((Z8_0_0Half_sound 0) ((1,4) : PairSlot))) (entropyTerm_zero_ball ((Z8_0_0Half_sound 0) ((1,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z8_0_0Half_sound 0) ((2,0) : PairSlot))) (entropyTerm_zero_ball ((Z8_0_0Half_sound 0) ((2,1) : PairSlot))) (entropyTerm_zero_ball ((Z8_0_0Half_sound 0) ((2,2) : PairSlot))) (entropyTerm_zero_ball ((Z8_0_0Half_sound 0) ((2,3) : PairSlot))) (entropyTerm_zero_ball ((Z8_0_0Half_sound 0) ((2,4) : PairSlot))) (entropyTerm_zero_ball ((Z8_0_0Half_sound 0) ((2,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z8_0_0Half_sound 0) ((3,0) : PairSlot))) (entropyTerm_zero_ball ((Z8_0_0Half_sound 0) ((3,1) : PairSlot))) (entropyTerm_zero_ball ((Z8_0_0Half_sound 0) ((3,2) : PairSlot))) (entropyTerm_zero_ball ((Z8_0_0Half_sound 0) ((3,3) : PairSlot))) (entropyTerm_zero_ball ((Z8_0_0Half_sound 0) ((3,4) : PairSlot))) (entropyTerm_zero_ball ((Z8_0_0Half_sound 0) ((3,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z8_0_0Half_sound 0) ((4,0) : PairSlot))) (entropyTerm_zero_ball ((Z8_0_0Half_sound 0) ((4,1) : PairSlot))) (entropyTerm_zero_ball ((Z8_0_0Half_sound 0) ((4,2) : PairSlot))) (entropyTerm_zero_ball ((Z8_0_0Half_sound 0) ((4,3) : PairSlot))) (entropyTerm_zero_ball ((Z8_0_0Half_sound 0) ((4,4) : PairSlot))) (entropyTerm_zero_ball ((Z8_0_0Half_sound 0) ((4,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z8_0_0Half_sound 0) ((5,0) : PairSlot))) (entropyTerm_zero_ball ((Z8_0_0Half_sound 0) ((5,1) : PairSlot))) (entropyTerm_zero_ball ((Z8_0_0Half_sound 0) ((5,2) : PairSlot))) (entropyTerm_zero_ball ((Z8_0_0Half_sound 0) ((5,3) : PairSlot))) (entropyTerm_zero_ball ((Z8_0_0Half_sound 0) ((5,4) : PairSlot))) Z8_0_0H0E_5_5_sound +def Z8_0_0H0Entropy : Ball := ⟨0, 0⟩ +lemma Z8_0_0H0Entropy_sound : Z8_0_0H0Entropy.Encloses (Foundation.finiteEntropy Z8_0_0H0Value) := by + exact contains_sound (entropyPair_enclosed Z8_0_0H0Value Z8_0_0H0Terms Z8_0_0H0Terms_sound) (by decide +kernel) +def Z8_0_0H0Mass : Ball := ⟨1, 0⟩ +lemma Z8_0_0H0Mass_sound : Z8_0_0H0Mass.Encloses (∑ a, Z8_0_0H0Value a) := by + exact contains_sound (pairSumBall_sound (Z8_0_0Half 0) Z8_0_0H0Value (Z8_0_0Half_sound 0)) (by decide +kernel) +def Z8_0_0H0MassTermLog : Ball := .exact 0 +lemma Z8_0_0H0MassTermLog_sound : Z8_0_0H0MassTermLog.Encloses (Real.log ((∑ a, Z8_0_0H0Value a))) := by + exact log_exact_one_ball (Z8_0_0H0Mass_sound) +def Z8_0_0H0MassTerm : Ball := ⟨0, 0⟩ +lemma Z8_0_0H0MassTerm_sound : Z8_0_0H0MassTerm.Encloses (Foundation.entropyTerm ((∑ a, Z8_0_0H0Value a))) := by + exact contains_sound (entropyTerm_ball (Z8_0_0H0Mass_sound) Z8_0_0H0MassTermLog_sound) (by decide +kernel) +def Z8_0_0H0H : Ball := ⟨0, 0⟩ +lemma Z8_0_0H0H_sound : Z8_0_0H0H.Encloses (homogeneousEntropy Z8_0_0H0Value) := by + exact contains_sound (homogeneous_enclosed Z8_0_0H0Value Z8_0_0H0MassTerm_sound Z8_0_0H0Entropy_sound) (by decide +kernel) +def Z8_0_0H1Value (a : PairSlot) : ℝ := (halfLaw (shape 8 0 0) 1 a : ℝ) +def Z8_0_0H1E_0_0Log : Ball := .exact 0 +lemma Z8_0_0H1E_0_0Log_sound : Z8_0_0H1E_0_0Log.Encloses (Real.log (Z8_0_0H1Value ((0,0) : PairSlot))) := by + exact log_exact_one_ball ((Z8_0_0Half_sound 1) ((0,0) : PairSlot)) +def Z8_0_0H1E_0_0 : Ball := ⟨0, 0⟩ +lemma Z8_0_0H1E_0_0_sound : Z8_0_0H1E_0_0.Encloses (Foundation.entropyTerm (Z8_0_0H1Value ((0,0) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z8_0_0Half_sound 1) ((0,0) : PairSlot)) Z8_0_0H1E_0_0Log_sound) (by decide +kernel) +def Z8_0_0H1Terms (a : PairSlot) : Ball := + match a.1.val, a.2.val with + | 0, 0 => ⟨0, 0⟩ + | _, _ => (.exact 0) +lemma Z8_0_0H1Terms_sound (a : PairSlot) : + (Z8_0_0H1Terms a).Encloses (Foundation.entropyTerm (Z8_0_0H1Value a)) := by + rcases a with ⟨i,j⟩ + revert j i + apply forall_fin6 + · exact forall_fin6 Z8_0_0H1E_0_0_sound (entropyTerm_zero_ball ((Z8_0_0Half_sound 1) ((0,1) : PairSlot))) (entropyTerm_zero_ball ((Z8_0_0Half_sound 1) ((0,2) : PairSlot))) (entropyTerm_zero_ball ((Z8_0_0Half_sound 1) ((0,3) : PairSlot))) (entropyTerm_zero_ball ((Z8_0_0Half_sound 1) ((0,4) : PairSlot))) (entropyTerm_zero_ball ((Z8_0_0Half_sound 1) ((0,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z8_0_0Half_sound 1) ((1,0) : PairSlot))) (entropyTerm_zero_ball ((Z8_0_0Half_sound 1) ((1,1) : PairSlot))) (entropyTerm_zero_ball ((Z8_0_0Half_sound 1) ((1,2) : PairSlot))) (entropyTerm_zero_ball ((Z8_0_0Half_sound 1) ((1,3) : PairSlot))) (entropyTerm_zero_ball ((Z8_0_0Half_sound 1) ((1,4) : PairSlot))) (entropyTerm_zero_ball ((Z8_0_0Half_sound 1) ((1,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z8_0_0Half_sound 1) ((2,0) : PairSlot))) (entropyTerm_zero_ball ((Z8_0_0Half_sound 1) ((2,1) : PairSlot))) (entropyTerm_zero_ball ((Z8_0_0Half_sound 1) ((2,2) : PairSlot))) (entropyTerm_zero_ball ((Z8_0_0Half_sound 1) ((2,3) : PairSlot))) (entropyTerm_zero_ball ((Z8_0_0Half_sound 1) ((2,4) : PairSlot))) (entropyTerm_zero_ball ((Z8_0_0Half_sound 1) ((2,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z8_0_0Half_sound 1) ((3,0) : PairSlot))) (entropyTerm_zero_ball ((Z8_0_0Half_sound 1) ((3,1) : PairSlot))) (entropyTerm_zero_ball ((Z8_0_0Half_sound 1) ((3,2) : PairSlot))) (entropyTerm_zero_ball ((Z8_0_0Half_sound 1) ((3,3) : PairSlot))) (entropyTerm_zero_ball ((Z8_0_0Half_sound 1) ((3,4) : PairSlot))) (entropyTerm_zero_ball ((Z8_0_0Half_sound 1) ((3,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z8_0_0Half_sound 1) ((4,0) : PairSlot))) (entropyTerm_zero_ball ((Z8_0_0Half_sound 1) ((4,1) : PairSlot))) (entropyTerm_zero_ball ((Z8_0_0Half_sound 1) ((4,2) : PairSlot))) (entropyTerm_zero_ball ((Z8_0_0Half_sound 1) ((4,3) : PairSlot))) (entropyTerm_zero_ball ((Z8_0_0Half_sound 1) ((4,4) : PairSlot))) (entropyTerm_zero_ball ((Z8_0_0Half_sound 1) ((4,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z8_0_0Half_sound 1) ((5,0) : PairSlot))) (entropyTerm_zero_ball ((Z8_0_0Half_sound 1) ((5,1) : PairSlot))) (entropyTerm_zero_ball ((Z8_0_0Half_sound 1) ((5,2) : PairSlot))) (entropyTerm_zero_ball ((Z8_0_0Half_sound 1) ((5,3) : PairSlot))) (entropyTerm_zero_ball ((Z8_0_0Half_sound 1) ((5,4) : PairSlot))) (entropyTerm_zero_ball ((Z8_0_0Half_sound 1) ((5,5) : PairSlot))) +def Z8_0_0H1Entropy : Ball := ⟨0, 0⟩ +lemma Z8_0_0H1Entropy_sound : Z8_0_0H1Entropy.Encloses (Foundation.finiteEntropy Z8_0_0H1Value) := by + exact contains_sound (entropyPair_enclosed Z8_0_0H1Value Z8_0_0H1Terms Z8_0_0H1Terms_sound) (by decide +kernel) +def Z8_0_0H1Mass : Ball := ⟨1, 0⟩ +lemma Z8_0_0H1Mass_sound : Z8_0_0H1Mass.Encloses (∑ a, Z8_0_0H1Value a) := by + exact contains_sound (pairSumBall_sound (Z8_0_0Half 1) Z8_0_0H1Value (Z8_0_0Half_sound 1)) (by decide +kernel) +def Z8_0_0H1MassTermLog : Ball := .exact 0 +lemma Z8_0_0H1MassTermLog_sound : Z8_0_0H1MassTermLog.Encloses (Real.log ((∑ a, Z8_0_0H1Value a))) := by + exact log_exact_one_ball (Z8_0_0H1Mass_sound) +def Z8_0_0H1MassTerm : Ball := ⟨0, 0⟩ +lemma Z8_0_0H1MassTerm_sound : Z8_0_0H1MassTerm.Encloses (Foundation.entropyTerm ((∑ a, Z8_0_0H1Value a))) := by + exact contains_sound (entropyTerm_ball (Z8_0_0H1Mass_sound) Z8_0_0H1MassTermLog_sound) (by decide +kernel) +def Z8_0_0H1H : Ball := ⟨0, 0⟩ +lemma Z8_0_0H1H_sound : Z8_0_0H1H.Encloses (homogeneousEntropy Z8_0_0H1Value) := by + exact contains_sound (homogeneous_enclosed Z8_0_0H1Value Z8_0_0H1MassTerm_sound Z8_0_0H1Entropy_sound) (by decide +kernel) +def Z8_0_0H2Value (a : PairSlot) : ℝ := (halfLaw (shape 8 0 0) 2 a : ℝ) +def Z8_0_0H2E_0_0Log : Ball := .exact 0 +lemma Z8_0_0H2E_0_0Log_sound : Z8_0_0H2E_0_0Log.Encloses (Real.log (Z8_0_0H2Value ((0,0) : PairSlot))) := by + exact log_exact_one_ball ((Z8_0_0Half_sound 2) ((0,0) : PairSlot)) +def Z8_0_0H2E_0_0 : Ball := ⟨0, 0⟩ +lemma Z8_0_0H2E_0_0_sound : Z8_0_0H2E_0_0.Encloses (Foundation.entropyTerm (Z8_0_0H2Value ((0,0) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z8_0_0Half_sound 2) ((0,0) : PairSlot)) Z8_0_0H2E_0_0Log_sound) (by decide +kernel) +def Z8_0_0H2Terms (a : PairSlot) : Ball := + match a.1.val, a.2.val with + | 0, 0 => ⟨0, 0⟩ + | _, _ => (.exact 0) +lemma Z8_0_0H2Terms_sound (a : PairSlot) : + (Z8_0_0H2Terms a).Encloses (Foundation.entropyTerm (Z8_0_0H2Value a)) := by + rcases a with ⟨i,j⟩ + revert j i + apply forall_fin6 + · exact forall_fin6 Z8_0_0H2E_0_0_sound (entropyTerm_zero_ball ((Z8_0_0Half_sound 2) ((0,1) : PairSlot))) (entropyTerm_zero_ball ((Z8_0_0Half_sound 2) ((0,2) : PairSlot))) (entropyTerm_zero_ball ((Z8_0_0Half_sound 2) ((0,3) : PairSlot))) (entropyTerm_zero_ball ((Z8_0_0Half_sound 2) ((0,4) : PairSlot))) (entropyTerm_zero_ball ((Z8_0_0Half_sound 2) ((0,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z8_0_0Half_sound 2) ((1,0) : PairSlot))) (entropyTerm_zero_ball ((Z8_0_0Half_sound 2) ((1,1) : PairSlot))) (entropyTerm_zero_ball ((Z8_0_0Half_sound 2) ((1,2) : PairSlot))) (entropyTerm_zero_ball ((Z8_0_0Half_sound 2) ((1,3) : PairSlot))) (entropyTerm_zero_ball ((Z8_0_0Half_sound 2) ((1,4) : PairSlot))) (entropyTerm_zero_ball ((Z8_0_0Half_sound 2) ((1,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z8_0_0Half_sound 2) ((2,0) : PairSlot))) (entropyTerm_zero_ball ((Z8_0_0Half_sound 2) ((2,1) : PairSlot))) (entropyTerm_zero_ball ((Z8_0_0Half_sound 2) ((2,2) : PairSlot))) (entropyTerm_zero_ball ((Z8_0_0Half_sound 2) ((2,3) : PairSlot))) (entropyTerm_zero_ball ((Z8_0_0Half_sound 2) ((2,4) : PairSlot))) (entropyTerm_zero_ball ((Z8_0_0Half_sound 2) ((2,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z8_0_0Half_sound 2) ((3,0) : PairSlot))) (entropyTerm_zero_ball ((Z8_0_0Half_sound 2) ((3,1) : PairSlot))) (entropyTerm_zero_ball ((Z8_0_0Half_sound 2) ((3,2) : PairSlot))) (entropyTerm_zero_ball ((Z8_0_0Half_sound 2) ((3,3) : PairSlot))) (entropyTerm_zero_ball ((Z8_0_0Half_sound 2) ((3,4) : PairSlot))) (entropyTerm_zero_ball ((Z8_0_0Half_sound 2) ((3,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z8_0_0Half_sound 2) ((4,0) : PairSlot))) (entropyTerm_zero_ball ((Z8_0_0Half_sound 2) ((4,1) : PairSlot))) (entropyTerm_zero_ball ((Z8_0_0Half_sound 2) ((4,2) : PairSlot))) (entropyTerm_zero_ball ((Z8_0_0Half_sound 2) ((4,3) : PairSlot))) (entropyTerm_zero_ball ((Z8_0_0Half_sound 2) ((4,4) : PairSlot))) (entropyTerm_zero_ball ((Z8_0_0Half_sound 2) ((4,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z8_0_0Half_sound 2) ((5,0) : PairSlot))) (entropyTerm_zero_ball ((Z8_0_0Half_sound 2) ((5,1) : PairSlot))) (entropyTerm_zero_ball ((Z8_0_0Half_sound 2) ((5,2) : PairSlot))) (entropyTerm_zero_ball ((Z8_0_0Half_sound 2) ((5,3) : PairSlot))) (entropyTerm_zero_ball ((Z8_0_0Half_sound 2) ((5,4) : PairSlot))) (entropyTerm_zero_ball ((Z8_0_0Half_sound 2) ((5,5) : PairSlot))) +def Z8_0_0H2Entropy : Ball := ⟨0, 0⟩ +lemma Z8_0_0H2Entropy_sound : Z8_0_0H2Entropy.Encloses (Foundation.finiteEntropy Z8_0_0H2Value) := by + exact contains_sound (entropyPair_enclosed Z8_0_0H2Value Z8_0_0H2Terms Z8_0_0H2Terms_sound) (by decide +kernel) +def Z8_0_0H2Mass : Ball := ⟨1, 0⟩ +lemma Z8_0_0H2Mass_sound : Z8_0_0H2Mass.Encloses (∑ a, Z8_0_0H2Value a) := by + exact contains_sound (pairSumBall_sound (Z8_0_0Half 2) Z8_0_0H2Value (Z8_0_0Half_sound 2)) (by decide +kernel) +def Z8_0_0H2MassTermLog : Ball := .exact 0 +lemma Z8_0_0H2MassTermLog_sound : Z8_0_0H2MassTermLog.Encloses (Real.log ((∑ a, Z8_0_0H2Value a))) := by + exact log_exact_one_ball (Z8_0_0H2Mass_sound) +def Z8_0_0H2MassTerm : Ball := ⟨0, 0⟩ +lemma Z8_0_0H2MassTerm_sound : Z8_0_0H2MassTerm.Encloses (Foundation.entropyTerm ((∑ a, Z8_0_0H2Value a))) := by + exact contains_sound (entropyTerm_ball (Z8_0_0H2Mass_sound) Z8_0_0H2MassTermLog_sound) (by decide +kernel) +def Z8_0_0H2H : Ball := ⟨0, 0⟩ +lemma Z8_0_0H2H_sound : Z8_0_0H2H.Encloses (homogeneousEntropy Z8_0_0H2Value) := by + exact contains_sound (homogeneous_enclosed Z8_0_0H2Value Z8_0_0H2MassTerm_sound Z8_0_0H2Entropy_sound) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/Certificates/InitialProbabilities.lean b/lean/OAI/LinearAlgebra/MatrixFields/Certificates/InitialProbabilities.lean new file mode 100644 index 0000000000000000000000000000000000000000..63d71d0cb5449db9fd9febf61c033fc5a0882a7c --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/Certificates/InitialProbabilities.lean @@ -0,0 +1,297 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Certificates.SparseContraction + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate +open scoped BigOperators +lemma sortedInitial_list : sortedInitial = [ + (shape 0 0 16), + (shape 0 1 15), + (shape 0 2 14), + (shape 0 3 13), + (shape 0 4 12), + (shape 0 5 11), + (shape 0 6 10), + (shape 0 7 9), + (shape 0 8 8), + (shape 1 1 14), + (shape 1 2 13), + (shape 1 3 12), + (shape 1 4 11), + (shape 1 5 10), + (shape 1 6 9), + (shape 1 7 8), + (shape 2 2 12), + (shape 2 3 11), + (shape 2 4 10), + (shape 2 5 9), + (shape 2 6 8), + (shape 2 7 7), + (shape 3 3 10), + (shape 3 4 9), + (shape 3 5 8), + (shape 3 6 7), + (shape 4 4 8), + (shape 4 5 7), + (shape 4 6 6), + (shape 5 5 6)] := by decide +kernel +lemma positiveInitial_list : positiveInitial = [ + (shape 1 1 14), + (shape 1 2 13), + (shape 1 3 12), + (shape 1 4 11), + (shape 1 5 10), + (shape 1 6 9), + (shape 1 7 8), + (shape 2 2 12), + (shape 2 3 11), + (shape 2 4 10), + (shape 2 5 9), + (shape 2 6 8), + (shape 2 7 7), + (shape 3 3 10), + (shape 3 4 9), + (shape 3 5 8), + (shape 3 6 7), + (shape 4 4 8), + (shape 4 5 7), + (shape 4 6 6), + (shape 5 5 6)] := by decide +kernel +lemma positiveSecond_list : positiveSecond = [ + (shape 1 1 6), + (shape 1 2 5), + (shape 1 3 4), + (shape 1 4 3), + (shape 1 5 2), + (shape 1 6 1), + (shape 2 1 5), + (shape 2 2 4), + (shape 2 3 3), + (shape 2 4 2), + (shape 2 5 1), + (shape 3 1 4), + (shape 3 2 3), + (shape 3 3 2), + (shape 3 4 1), + (shape 4 1 3), + (shape 4 2 2), + (shape 4 3 1), + (shape 5 1 2), + (shape 5 2 1), + (shape 6 1 1)] := by decide +kernel +lemma zeroSecond_list : zeroSecond = [ + (shape 0 0 8), + (shape 0 1 7), + (shape 0 2 6), + (shape 0 3 5), + (shape 0 4 4), + (shape 0 5 3), + (shape 0 6 2), + (shape 0 7 1), + (shape 0 8 0), + (shape 1 0 7), + (shape 1 7 0), + (shape 2 0 6), + (shape 2 6 0), + (shape 3 0 5), + (shape 3 5 0), + (shape 4 0 4), + (shape 4 4 0), + (shape 5 0 3), + (shape 5 3 0), + (shape 6 0 2), + (shape 6 2 0), + (shape 7 0 1), + (shape 7 1 0), + (shape 8 0 0)] := by decide +kernel +lemma allSecond_list : shapes 8 = [ + (shape 0 0 8), + (shape 0 1 7), + (shape 0 2 6), + (shape 0 3 5), + (shape 0 4 4), + (shape 0 5 3), + (shape 0 6 2), + (shape 0 7 1), + (shape 0 8 0), + (shape 1 0 7), + (shape 1 1 6), + (shape 1 2 5), + (shape 1 3 4), + (shape 1 4 3), + (shape 1 5 2), + (shape 1 6 1), + (shape 1 7 0), + (shape 2 0 6), + (shape 2 1 5), + (shape 2 2 4), + (shape 2 3 3), + (shape 2 4 2), + (shape 2 5 1), + (shape 2 6 0), + (shape 3 0 5), + (shape 3 1 4), + (shape 3 2 3), + (shape 3 3 2), + (shape 3 4 1), + (shape 3 5 0), + (shape 4 0 4), + (shape 4 1 3), + (shape 4 2 2), + (shape 4 3 1), + (shape 4 4 0), + (shape 5 0 3), + (shape 5 1 2), + (shape 5 2 1), + (shape 5 3 0), + (shape 6 0 2), + (shape 6 1 1), + (shape 6 2 0), + (shape 7 0 1), + (shape 7 1 0), + (shape 8 0 0)] := by decide +kernel + +def initialProbs (s : Shape) : Ball := + match s 0, s 1, s 2 with + | 0, 0, 16 => ⟨(13145890586460581196177 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 0, 1, 15 => ⟨(42540492515727185225981 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 0, 2, 14 => ⟨(4900971162886037110823 / 2000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 0, 3, 13 => ⟨(14604082434529236400348639 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 0, 4, 12 => ⟨(87208931167140990526853381 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 0, 5, 11 => ⟨(566490078566605123939237597 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 0, 6, 10 => ⟨(15474579554896208143672879691 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 0, 7, 9 => ⟨(21368287213656684042157621491 / 20000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ + | 0, 8, 8 => ⟨(42129637360788428263980836207 / 50000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ + | 1, 1, 14 => ⟨(135599977130724015865781 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 1, 2, 13 => ⟨(21858745833413986207356271 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 1, 3, 12 => ⟨(65898522138499345540285359 / 10000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 1, 4, 11 => ⟨(5367158627758357107638360451 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 1, 5, 10 => ⟨(18883866194706956799381439539 / 20000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ + | 1, 6, 9 => ⟨(440207333950294144127188221451 / 100000000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ + | 1, 7, 8 => ⟨(501647985135804550777153238571 / 50000000000000000000000000000000), (9 / 100000000000000000000000000000000)⟩ + | 2, 2, 12 => ⟨(445614366045202627519431351 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 2, 3, 11 => ⟨(18322793467082776251620533929 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 2, 4, 10 => ⟨(202076397116939330043327073307 / 100000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ + | 2, 5, 9 => ⟨(60673895984904206933988362677 / 5000000000000000000000000000000), (1 / 10000000000000000000000000000000)⟩ + | 2, 6, 8 => ⟨(1867579803495739369034613847927 / 50000000000000000000000000000000), (7 / 25000000000000000000000000000000)⟩ + | 2, 7, 7 => ⟨(2698627660502582229985779719163 / 100000000000000000000000000000000), (1 / 5000000000000000000000000000000)⟩ + | 3, 3, 10 => ⟨(25504648673098899027157162387 / 20000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ + | 3, 4, 9 => ⟨(1920317525954107858922782450019 / 100000000000000000000000000000000), (3 / 20000000000000000000000000000000)⟩ + | 3, 5, 8 => ⟨(951656630773752719335842630811 / 12500000000000000000000000000000), (27 / 50000000000000000000000000000000)⟩ + | 3, 6, 7 => ⟨(7428644231760528410384248566849 / 50000000000000000000000000000000), (11 / 10000000000000000000000000000000)⟩ + | 4, 4, 8 => ⟨(4772848850473901186247710959367 / 100000000000000000000000000000000), (7 / 20000000000000000000000000000000)⟩ + | 4, 5, 7 => ⟨(23993682114587954796865544628907 / 100000000000000000000000000000000), (43 / 25000000000000000000000000000000)⟩ + | 4, 6, 6 => ⟨(1012633788103277317843835873381 / 6250000000000000000000000000000), (1 / 800000000000000000000000000000)⟩ + | 5, 5, 6 => ⟨(20868552691024433430449278430017 / 100000000000000000000000000000000), (153 / 100000000000000000000000000000000)⟩ + | _, _, _ => (.exact 0) +lemma initialProbs_0_0_16 : (initialProbs (shape 0 0 16)).Encloses (initialLaw (shape 0 0 16) : ℝ) := by + exact contains_sound (initialLawBall_sound (shape 0 0 16) (by decide +kernel)) (by decide +kernel) +lemma initialProbs_0_1_15 : (initialProbs (shape 0 1 15)).Encloses (initialLaw (shape 0 1 15) : ℝ) := by + exact contains_sound (initialLawBall_sound (shape 0 1 15) (by decide +kernel)) (by decide +kernel) +lemma initialProbs_0_2_14 : (initialProbs (shape 0 2 14)).Encloses (initialLaw (shape 0 2 14) : ℝ) := by + exact contains_sound (initialLawBall_sound (shape 0 2 14) (by decide +kernel)) (by decide +kernel) +lemma initialProbs_0_3_13 : (initialProbs (shape 0 3 13)).Encloses (initialLaw (shape 0 3 13) : ℝ) := by + exact contains_sound (initialLawBall_sound (shape 0 3 13) (by decide +kernel)) (by decide +kernel) +lemma initialProbs_0_4_12 : (initialProbs (shape 0 4 12)).Encloses (initialLaw (shape 0 4 12) : ℝ) := by + exact contains_sound (initialLawBall_sound (shape 0 4 12) (by decide +kernel)) (by decide +kernel) +lemma initialProbs_0_5_11 : (initialProbs (shape 0 5 11)).Encloses (initialLaw (shape 0 5 11) : ℝ) := by + exact contains_sound (initialLawBall_sound (shape 0 5 11) (by decide +kernel)) (by decide +kernel) +lemma initialProbs_0_6_10 : (initialProbs (shape 0 6 10)).Encloses (initialLaw (shape 0 6 10) : ℝ) := by + exact contains_sound (initialLawBall_sound (shape 0 6 10) (by decide +kernel)) (by decide +kernel) +lemma initialProbs_0_7_9 : (initialProbs (shape 0 7 9)).Encloses (initialLaw (shape 0 7 9) : ℝ) := by + exact contains_sound (initialLawBall_sound (shape 0 7 9) (by decide +kernel)) (by decide +kernel) +lemma initialProbs_0_8_8 : (initialProbs (shape 0 8 8)).Encloses (initialLaw (shape 0 8 8) : ℝ) := by + exact contains_sound (initialLawBall_sound (shape 0 8 8) (by decide +kernel)) (by decide +kernel) +lemma initialProbs_1_1_14 : (initialProbs (shape 1 1 14)).Encloses (initialLaw (shape 1 1 14) : ℝ) := by + exact contains_sound (initialLawBall_sound (shape 1 1 14) (by decide +kernel)) (by decide +kernel) +lemma initialProbs_1_2_13 : (initialProbs (shape 1 2 13)).Encloses (initialLaw (shape 1 2 13) : ℝ) := by + exact contains_sound (initialLawBall_sound (shape 1 2 13) (by decide +kernel)) (by decide +kernel) +lemma initialProbs_1_3_12 : (initialProbs (shape 1 3 12)).Encloses (initialLaw (shape 1 3 12) : ℝ) := by + exact contains_sound (initialLawBall_sound (shape 1 3 12) (by decide +kernel)) (by decide +kernel) +lemma initialProbs_1_4_11 : (initialProbs (shape 1 4 11)).Encloses (initialLaw (shape 1 4 11) : ℝ) := by + exact contains_sound (initialLawBall_sound (shape 1 4 11) (by decide +kernel)) (by decide +kernel) +lemma initialProbs_1_5_10 : (initialProbs (shape 1 5 10)).Encloses (initialLaw (shape 1 5 10) : ℝ) := by + exact contains_sound (initialLawBall_sound (shape 1 5 10) (by decide +kernel)) (by decide +kernel) +lemma initialProbs_1_6_9 : (initialProbs (shape 1 6 9)).Encloses (initialLaw (shape 1 6 9) : ℝ) := by + exact contains_sound (initialLawBall_sound (shape 1 6 9) (by decide +kernel)) (by decide +kernel) +lemma initialProbs_1_7_8 : (initialProbs (shape 1 7 8)).Encloses (initialLaw (shape 1 7 8) : ℝ) := by + exact contains_sound (initialLawBall_sound (shape 1 7 8) (by decide +kernel)) (by decide +kernel) +lemma initialProbs_2_2_12 : (initialProbs (shape 2 2 12)).Encloses (initialLaw (shape 2 2 12) : ℝ) := by + exact contains_sound (initialLawBall_sound (shape 2 2 12) (by decide +kernel)) (by decide +kernel) +lemma initialProbs_2_3_11 : (initialProbs (shape 2 3 11)).Encloses (initialLaw (shape 2 3 11) : ℝ) := by + exact contains_sound (initialLawBall_sound (shape 2 3 11) (by decide +kernel)) (by decide +kernel) +lemma initialProbs_2_4_10 : (initialProbs (shape 2 4 10)).Encloses (initialLaw (shape 2 4 10) : ℝ) := by + exact contains_sound (initialLawBall_sound (shape 2 4 10) (by decide +kernel)) (by decide +kernel) +lemma initialProbs_2_5_9 : (initialProbs (shape 2 5 9)).Encloses (initialLaw (shape 2 5 9) : ℝ) := by + exact contains_sound (initialLawBall_sound (shape 2 5 9) (by decide +kernel)) (by decide +kernel) +lemma initialProbs_2_6_8 : (initialProbs (shape 2 6 8)).Encloses (initialLaw (shape 2 6 8) : ℝ) := by + exact contains_sound (initialLawBall_sound (shape 2 6 8) (by decide +kernel)) (by decide +kernel) +lemma initialProbs_2_7_7 : (initialProbs (shape 2 7 7)).Encloses (initialLaw (shape 2 7 7) : ℝ) := by + exact contains_sound (initialLawBall_sound (shape 2 7 7) (by decide +kernel)) (by decide +kernel) +lemma initialProbs_3_3_10 : (initialProbs (shape 3 3 10)).Encloses (initialLaw (shape 3 3 10) : ℝ) := by + exact contains_sound (initialLawBall_sound (shape 3 3 10) (by decide +kernel)) (by decide +kernel) +lemma initialProbs_3_4_9 : (initialProbs (shape 3 4 9)).Encloses (initialLaw (shape 3 4 9) : ℝ) := by + exact contains_sound (initialLawBall_sound (shape 3 4 9) (by decide +kernel)) (by decide +kernel) +lemma initialProbs_3_5_8 : (initialProbs (shape 3 5 8)).Encloses (initialLaw (shape 3 5 8) : ℝ) := by + exact contains_sound (initialLawBall_sound (shape 3 5 8) (by decide +kernel)) (by decide +kernel) +lemma initialProbs_3_6_7 : (initialProbs (shape 3 6 7)).Encloses (initialLaw (shape 3 6 7) : ℝ) := by + exact contains_sound (initialLawBall_sound (shape 3 6 7) (by decide +kernel)) (by decide +kernel) +lemma initialProbs_4_4_8 : (initialProbs (shape 4 4 8)).Encloses (initialLaw (shape 4 4 8) : ℝ) := by + exact contains_sound (initialLawBall_sound (shape 4 4 8) (by decide +kernel)) (by decide +kernel) +lemma initialProbs_4_5_7 : (initialProbs (shape 4 5 7)).Encloses (initialLaw (shape 4 5 7) : ℝ) := by + exact contains_sound (initialLawBall_sound (shape 4 5 7) (by decide +kernel)) (by decide +kernel) +lemma initialProbs_4_6_6 : (initialProbs (shape 4 6 6)).Encloses (initialLaw (shape 4 6 6) : ℝ) := by + exact contains_sound (initialLawBall_sound (shape 4 6 6) (by decide +kernel)) (by decide +kernel) +lemma initialProbs_5_5_6 : (initialProbs (shape 5 5 6)).Encloses (initialLaw (shape 5 5 6) : ℝ) := by + exact contains_sound (initialLawBall_sound (shape 5 5 6) (by decide +kernel)) (by decide +kernel) +lemma initialProbs_sound (g : Shape) (hg : g ∈ sortedInitial) : + (initialProbs g).Encloses (initialLaw g : ℝ) := by + rw [sortedInitial_list] at hg + simp only [List.mem_cons, List.not_mem_nil, or_false] at hg + rcases hg with rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl + · exact initialProbs_0_0_16 + · exact initialProbs_0_1_15 + · exact initialProbs_0_2_14 + · exact initialProbs_0_3_13 + · exact initialProbs_0_4_12 + · exact initialProbs_0_5_11 + · exact initialProbs_0_6_10 + · exact initialProbs_0_7_9 + · exact initialProbs_0_8_8 + · exact initialProbs_1_1_14 + · exact initialProbs_1_2_13 + · exact initialProbs_1_3_12 + · exact initialProbs_1_4_11 + · exact initialProbs_1_5_10 + · exact initialProbs_1_6_9 + · exact initialProbs_1_7_8 + · exact initialProbs_2_2_12 + · exact initialProbs_2_3_11 + · exact initialProbs_2_4_10 + · exact initialProbs_2_5_9 + · exact initialProbs_2_6_8 + · exact initialProbs_2_7_7 + · exact initialProbs_3_3_10 + · exact initialProbs_3_4_9 + · exact initialProbs_3_5_8 + · exact initialProbs_3_6_7 + · exact initialProbs_4_4_8 + · exact initialProbs_4_5_7 + · exact initialProbs_4_6_6 + · exact initialProbs_5_5_6 + +end MatrixMultiplication.NativeNumerics + +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/Certificates/LittleB1_3_4.lean b/lean/OAI/LinearAlgebra/MatrixFields/Certificates/LittleB1_3_4.lean new file mode 100644 index 0000000000000000000000000000000000000000..23561f0883ce43caf19401410328d33a8a3910d1 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/Certificates/LittleB1_3_4.lean @@ -0,0 +1,584 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Certificates.SplitB1_3_4 + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +lemma shapes4_list : shapes 4 = [ + (shape 0 0 4), + (shape 0 1 3), + (shape 0 2 2), + (shape 0 3 1), + (shape 0 4 0), + (shape 1 0 3), + (shape 1 1 2), + (shape 1 2 1), + (shape 1 3 0), + (shape 2 0 2), + (shape 2 1 1), + (shape 2 2 0), + (shape 3 0 1), + (shape 3 1 0), + (shape 4 0 0)] := by decide +kernel +def B1_1_6Binary (u : Shape) : ℚ := + match u 0, u 1, u 2 with + | 1, 1, 2 => (63 / 1000000) + | _, _, _ => 0 +lemma B1_1_6Binary_eq (u : Shape) (hu : u ∈ shapes 4) : + binaryParameter (shape 1 1 6) u = B1_1_6Binary u := by + rw [shapes4_list] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel +def B1_1_6LittleRat (u : Shape) (w : Fin 3) (i : Fin 6) : ℚ := + if u w = 2 then + if i = 2 then 1 - B1_1_6Binary u else if i = 3 then B1_1_6Binary u else 0 + else if i = singletonSlot (u w) then 1 else 0 + +def B1_1_6Little (u : Shape) (w : Fin 3) (i : Fin 6) : Ball := + if u ∈ shapes 4 then .exact (B1_1_6LittleRat u w i) + else .exact (littleLaw (shape 1 1 6) u w i) + +lemma B1_1_6Little_sound (u : Shape) (w : Fin 3) (i : Fin 6) : + (B1_1_6Little u w i).Encloses (littleLaw (shape 1 1 6) u w i : ℝ) := by + by_cases hu : u ∈ shapes 4 + · simp only [B1_1_6Little, hu, ite_true] + apply exact_rat_enclosed + simp only [B1_1_6LittleRat, littleLaw, B1_1_6Binary_eq u hu] + · simp only [B1_1_6Little, hu, ite_false] + exact Ball.exact_sound _ +def B1_1_6Half (w : Fin 3) (ij : PairSlot) : Ball := + match w.val, ij.1.val, ij.2.val with + | 0, 0, 1 => ⟨(1 / 2), (3 / 50000000000000000000000000000000)⟩ + | 0, 1, 0 => ⟨(1 / 2), (3 / 50000000000000000000000000000000)⟩ + | 1, 0, 1 => ⟨(1 / 2), (3 / 50000000000000000000000000000000)⟩ + | 1, 1, 0 => ⟨(1 / 2), (3 / 50000000000000000000000000000000)⟩ + | 2, 5, 2 => ⟨(23395434846455848905473447711 / 2500000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ + | 2, 5, 3 => ⟨(58960210306318037278141611 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 2, 4, 4 => ⟨(49064123645931459725743783949949 / 50000000000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ + | 2, 2, 5 => ⟨(23395434846455848905473447711 / 2500000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ + | 2, 3, 5 => ⟨(58960210306318037278141611 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | _, _, _ => (.exact 0) +lemma B1_1_6Half_check_0_0 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 1 1 6)) (shape 1 1 6) B1_1_6Law + (fun u => B1_1_6Little u 0) ((0 : Fin 6),j)) (B1_1_6Half 0 (0,j)) = true := by + decide +kernel +lemma B1_1_6Half_check_0_1 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 1 1 6)) (shape 1 1 6) B1_1_6Law + (fun u => B1_1_6Little u 0) ((1 : Fin 6),j)) (B1_1_6Half 0 (1,j)) = true := by + decide +kernel +lemma B1_1_6Half_check_0_2 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 1 1 6)) (shape 1 1 6) B1_1_6Law + (fun u => B1_1_6Little u 0) ((2 : Fin 6),j)) (B1_1_6Half 0 (2,j)) = true := by + decide +kernel +lemma B1_1_6Half_check_0_3 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 1 1 6)) (shape 1 1 6) B1_1_6Law + (fun u => B1_1_6Little u 0) ((3 : Fin 6),j)) (B1_1_6Half 0 (3,j)) = true := by + decide +kernel +lemma B1_1_6Half_check_0_4 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 1 1 6)) (shape 1 1 6) B1_1_6Law + (fun u => B1_1_6Little u 0) ((4 : Fin 6),j)) (B1_1_6Half 0 (4,j)) = true := by + decide +kernel +lemma B1_1_6Half_check_0_5 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 1 1 6)) (shape 1 1 6) B1_1_6Law + (fun u => B1_1_6Little u 0) ((5 : Fin 6),j)) (B1_1_6Half 0 (5,j)) = true := by + decide +kernel +lemma B1_1_6Half_check_1_0 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 1 1 6)) (shape 1 1 6) B1_1_6Law + (fun u => B1_1_6Little u 1) ((0 : Fin 6),j)) (B1_1_6Half 1 (0,j)) = true := by + decide +kernel +lemma B1_1_6Half_check_1_1 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 1 1 6)) (shape 1 1 6) B1_1_6Law + (fun u => B1_1_6Little u 1) ((1 : Fin 6),j)) (B1_1_6Half 1 (1,j)) = true := by + decide +kernel +lemma B1_1_6Half_check_1_2 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 1 1 6)) (shape 1 1 6) B1_1_6Law + (fun u => B1_1_6Little u 1) ((2 : Fin 6),j)) (B1_1_6Half 1 (2,j)) = true := by + decide +kernel +lemma B1_1_6Half_check_1_3 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 1 1 6)) (shape 1 1 6) B1_1_6Law + (fun u => B1_1_6Little u 1) ((3 : Fin 6),j)) (B1_1_6Half 1 (3,j)) = true := by + decide +kernel +lemma B1_1_6Half_check_1_4 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 1 1 6)) (shape 1 1 6) B1_1_6Law + (fun u => B1_1_6Little u 1) ((4 : Fin 6),j)) (B1_1_6Half 1 (4,j)) = true := by + decide +kernel +lemma B1_1_6Half_check_1_5 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 1 1 6)) (shape 1 1 6) B1_1_6Law + (fun u => B1_1_6Little u 1) ((5 : Fin 6),j)) (B1_1_6Half 1 (5,j)) = true := by + decide +kernel +lemma B1_1_6Half_check_2_0 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 1 1 6)) (shape 1 1 6) B1_1_6Law + (fun u => B1_1_6Little u 2) ((0 : Fin 6),j)) (B1_1_6Half 2 (0,j)) = true := by + decide +kernel +lemma B1_1_6Half_check_2_1 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 1 1 6)) (shape 1 1 6) B1_1_6Law + (fun u => B1_1_6Little u 2) ((1 : Fin 6),j)) (B1_1_6Half 2 (1,j)) = true := by + decide +kernel +lemma B1_1_6Half_check_2_2 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 1 1 6)) (shape 1 1 6) B1_1_6Law + (fun u => B1_1_6Little u 2) ((2 : Fin 6),j)) (B1_1_6Half 2 (2,j)) = true := by + decide +kernel +lemma B1_1_6Half_check_2_3 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 1 1 6)) (shape 1 1 6) B1_1_6Law + (fun u => B1_1_6Little u 2) ((3 : Fin 6),j)) (B1_1_6Half 2 (3,j)) = true := by + decide +kernel +lemma B1_1_6Half_check_2_4 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 1 1 6)) (shape 1 1 6) B1_1_6Law + (fun u => B1_1_6Little u 2) ((4 : Fin 6),j)) (B1_1_6Half 2 (4,j)) = true := by + decide +kernel +lemma B1_1_6Half_check_2_5 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 1 1 6)) (shape 1 1 6) B1_1_6Law + (fun u => B1_1_6Little u 2) ((5 : Fin 6),j)) (B1_1_6Half 2 (5,j)) = true := by + decide +kernel +lemma B1_1_6Half_sound (w : Fin 3) (ij : PairSlot) : + (B1_1_6Half w ij).Encloses (halfLaw (shape 1 1 6) w ij : ℝ) := by + have hcheck : contains (pairLawBall (below (shape 1 1 6)) (shape 1 1 6) B1_1_6Law + (fun u => B1_1_6Little u w) ij) (B1_1_6Half w ij) = true := by + rcases ij with ⟨i,j⟩ + revert i w + apply forall_fin3 + · exact forall_fin6 (B1_1_6Half_check_0_0 j) (B1_1_6Half_check_0_1 j) (B1_1_6Half_check_0_2 j) (B1_1_6Half_check_0_3 j) (B1_1_6Half_check_0_4 j) (B1_1_6Half_check_0_5 j) + · exact forall_fin6 (B1_1_6Half_check_1_0 j) (B1_1_6Half_check_1_1 j) (B1_1_6Half_check_1_2 j) (B1_1_6Half_check_1_3 j) (B1_1_6Half_check_1_4 j) (B1_1_6Half_check_1_5 j) + · exact forall_fin6 (B1_1_6Half_check_2_0 j) (B1_1_6Half_check_2_1 j) (B1_1_6Half_check_2_2 j) (B1_1_6Half_check_2_3 j) (B1_1_6Half_check_2_4 j) (B1_1_6Half_check_2_5 j) + have h := contains_sound (pairLawBall_sound (below (shape 1 1 6)) (shape 1 1 6) + B1_1_6Law (fun u => (stageBLaw (shape 1 1 6) u : ℝ)) + (fun u => B1_1_6Little u w) (fun u i => (littleLaw (shape 1 1 6) u w i : ℝ)) + (fun u _ => B1_1_6Law_sound u) (fun u i => B1_1_6Little_sound u w i) ij) hcheck + have hp : positive (shape 1 1 6) = true := by decide +kernel + simpa only [halfLaw, hp, ite_true, pairLaw, positiveHalfLaw, Rat.cast_list_sum, + List.map_map, Function.comp_def, Rat.cast_mul] using h + +end MatrixMultiplication.NativeNumerics + +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate +open scoped BigOperators +lemma B1_2_5_below : below (shape 1 2 5) = [ + (shape 0 0 4), + (shape 0 1 3), + (shape 0 2 2), + (shape 1 0 3), + (shape 1 1 2), + (shape 1 2 1)] := by decide +kernel +def B1_2_5Raw (s : Shape) : Ball := + match s 0, s 1, s 2 with + | 0, 0, 4 => ⟨(14279668505343149815259750483 / 6250000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ + | 0, 1, 3 => ⟨1, 0⟩ + | 0, 2, 2 => ⟨(11468822577910492362546082899621 / 20000000000000000000000000000000), (37 / 50000000000000000000000000000000)⟩ + | 1, 0, 3 => ⟨(11468822577910492362546082899621 / 20000000000000000000000000000000), (37 / 50000000000000000000000000000000)⟩ + | 1, 1, 2 => ⟨1, 0⟩ + | 1, 2, 1 => ⟨(14279668505343149815259750483 / 6250000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ + | _, _, _ => (.exact 0) +lemma B1_2_5Raw_0_0_4 : (B1_2_5Raw (shape 0 0 4)).Encloses (splitWeight positiveSecond tablep (shape 1 2 5) (shape 0 0 4) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveSecond tablep (shape 1 2 5) (shape 0 0 4) + (0) (-5561) (-55254) w195 w167 w27 + (by decide +kernel) w195_sound w167_sound w27_sound) (by decide +kernel) +lemma B1_2_5Raw_0_1_3 : (B1_2_5Raw (shape 0 1 3)).Encloses (splitWeight positiveSecond tablep (shape 1 2 5) (shape 0 1 3) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveSecond tablep (shape 1 2 5) (shape 0 1 3) + (0) (0) (0) w195 w195 w195 + (by decide +kernel) w195_sound w195_sound w195_sound) (by decide +kernel) +lemma B1_2_5Raw_0_2_2 : (B1_2_5Raw (shape 0 2 2)).Encloses (splitWeight positiveSecond tablep (shape 1 2 5) (shape 0 2 2) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveSecond tablep (shape 1 2 5) (shape 0 2 2) + (0) (-5561) (0) w195 w167 w195 + (by decide +kernel) w195_sound w167_sound w195_sound) (by decide +kernel) +lemma B1_2_5Raw_1_0_3 : (B1_2_5Raw (shape 1 0 3)).Encloses (splitWeight positiveSecond tablep (shape 1 2 5) (shape 1 0 3) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveSecond tablep (shape 1 2 5) (shape 1 0 3) + (0) (-5561) (0) w195 w167 w195 + (by decide +kernel) w195_sound w167_sound w195_sound) (by decide +kernel) +lemma B1_2_5Raw_1_1_2 : (B1_2_5Raw (shape 1 1 2)).Encloses (splitWeight positiveSecond tablep (shape 1 2 5) (shape 1 1 2) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveSecond tablep (shape 1 2 5) (shape 1 1 2) + (0) (0) (0) w195 w195 w195 + (by decide +kernel) w195_sound w195_sound w195_sound) (by decide +kernel) +lemma B1_2_5Raw_1_2_1 : (B1_2_5Raw (shape 1 2 1)).Encloses (splitWeight positiveSecond tablep (shape 1 2 5) (shape 1 2 1) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveSecond tablep (shape 1 2 5) (shape 1 2 1) + (0) (-5561) (-55254) w195 w167 w27 + (by decide +kernel) w195_sound w167_sound w27_sound) (by decide +kernel) +lemma B1_2_5Raw_sound (u : Shape) (hu : u ∈ below (shape 1 2 5)) : + (B1_2_5Raw u).Encloses (splitWeight positiveSecond tablep (shape 1 2 5) u : ℝ) := by + rw [B1_2_5_below] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl | rfl | rfl + · exact B1_2_5Raw_0_0_4 + · exact B1_2_5Raw_0_1_3 + · exact B1_2_5Raw_0_2_2 + · exact B1_2_5Raw_1_0_3 + · exact B1_2_5Raw_1_1_2 + · exact B1_2_5Raw_1_2_1 +def B1_2_5Den : Ball := ⟨(157572587585637952209774570505833 / 50000000000000000000000000000000), (19 / 12500000000000000000000000000000)⟩ +lemma B1_2_5Den_sound : B1_2_5Den.Encloses (((below (shape 1 2 5)).map (splitWeight positiveSecond tablep (shape 1 2 5))).sum : ℝ) := by + exact contains_sound (list_cast_enclosed (below (shape 1 2 5)) B1_2_5Raw (splitWeight positiveSecond tablep (shape 1 2 5)) B1_2_5Raw_sound) (by decide +kernel) +lemma B1_2_5Den_positive : 0 < B1_2_5Den.lower := by decide +kernel +def B1_2_5Table (s : Shape) : Ball := + match s 0, s 1, s 2 with + | 0, 0, 4 => ⟨(36249118515191988245121850051 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 0, 1, 3 => ⟨(396642594740867223667445521291 / 1250000000000000000000000000000), (1 / 6250000000000000000000000000000)⟩ + | 0, 2, 2 => ⟨(9098047091850119065057057298309 / 50000000000000000000000000000000), (33 / 100000000000000000000000000000000)⟩ + | 1, 0, 3 => ⟨(9098047091850119065057057298309 / 50000000000000000000000000000000), (33 / 100000000000000000000000000000000)⟩ + | 1, 1, 2 => ⟨(396642594740867223667445521291 / 1250000000000000000000000000000), (1 / 6250000000000000000000000000000)⟩ + | 1, 2, 1 => ⟨(36249118515191988245121850051 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | _, _, _ => (.exact 0) +def B1_2_5Law (u : Shape) : Ball := if u ∈ below (shape 1 2 5) then B1_2_5Table u else .exact 0 +lemma B1_2_5Law_check_0_0_4 : contains (.mul (B1_2_5Raw (shape 0 0 4)) (.inv B1_2_5Den)) (B1_2_5Table (shape 0 0 4)) = true := by decide +kernel +lemma B1_2_5Law_check_0_1_3 : contains (.mul (B1_2_5Raw (shape 0 1 3)) (.inv B1_2_5Den)) (B1_2_5Table (shape 0 1 3)) = true := by decide +kernel +lemma B1_2_5Law_check_0_2_2 : contains (.mul (B1_2_5Raw (shape 0 2 2)) (.inv B1_2_5Den)) (B1_2_5Table (shape 0 2 2)) = true := by decide +kernel +lemma B1_2_5Law_check_1_0_3 : contains (.mul (B1_2_5Raw (shape 1 0 3)) (.inv B1_2_5Den)) (B1_2_5Table (shape 1 0 3)) = true := by decide +kernel +lemma B1_2_5Law_check_1_1_2 : contains (.mul (B1_2_5Raw (shape 1 1 2)) (.inv B1_2_5Den)) (B1_2_5Table (shape 1 1 2)) = true := by decide +kernel +lemma B1_2_5Law_check_1_2_1 : contains (.mul (B1_2_5Raw (shape 1 2 1)) (.inv B1_2_5Den)) (B1_2_5Table (shape 1 2 1)) = true := by decide +kernel +lemma B1_2_5Law_check (u : Shape) (hu : u ∈ below (shape 1 2 5)) : + contains (.mul (B1_2_5Raw u) (.inv B1_2_5Den)) (B1_2_5Table u) = true := by + rw [B1_2_5_below] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl | rfl | rfl + · exact B1_2_5Law_check_0_0_4 + · exact B1_2_5Law_check_0_1_3 + · exact B1_2_5Law_check_0_2_2 + · exact B1_2_5Law_check_1_0_3 + · exact B1_2_5Law_check_1_1_2 + · exact B1_2_5Law_check_1_2_1 +lemma B1_2_5Law_sound (u : Shape) : + (B1_2_5Law u).Encloses (stageBLaw (shape 1 2 5) u : ℝ) := by + by_cases hu : u ∈ below (shape 1 2 5) + · have h := contains_sound (Ball.mul_sound (B1_2_5Raw_sound u hu) + (Ball.inv_sound B1_2_5Den_sound B1_2_5Den_positive)) (B1_2_5Law_check u hu) + simpa only [B1_2_5Law, hu, ite_true, stageBLaw, splitLaw, + Rat.cast_div, Rat.cast_mul, Rat.cast_inv, div_eq_mul_inv] using h + · simp only [B1_2_5Law, hu, ite_false, stageBLaw, splitLaw, Rat.cast_zero] + simpa only [Rat.cast_zero] using Ball.exact_sound 0 + +end MatrixMultiplication.NativeNumerics + +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def B1_2_5Binary (u : Shape) : ℚ := + match u 0, u 1, u 2 with + | 0, 2, 2 => (19531 / 200000) + | 1, 2, 1 => (10533 / 250000) + | _, _, _ => 0 +lemma B1_2_5Binary_eq (u : Shape) (hu : u ∈ shapes 4) : + binaryParameter (shape 1 2 5) u = B1_2_5Binary u := by + rw [shapes4_list] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel +def B1_2_5LittleRat (u : Shape) (w : Fin 3) (i : Fin 6) : ℚ := + if u w = 2 then + if i = 2 then 1 - B1_2_5Binary u else if i = 3 then B1_2_5Binary u else 0 + else if i = singletonSlot (u w) then 1 else 0 + +def B1_2_5Little (u : Shape) (w : Fin 3) (i : Fin 6) : Ball := + if u ∈ shapes 4 then .exact (B1_2_5LittleRat u w i) + else .exact (littleLaw (shape 1 2 5) u w i) + +lemma B1_2_5Little_sound (u : Shape) (w : Fin 3) (i : Fin 6) : + (B1_2_5Little u w i).Encloses (littleLaw (shape 1 2 5) u w i : ℝ) := by + by_cases hu : u ∈ shapes 4 + · simp only [B1_2_5Little, hu, ite_true] + apply exact_rat_enclosed + simp only [B1_2_5LittleRat, littleLaw, B1_2_5Binary_eq u hu] + · simp only [B1_2_5Little, hu, ite_false] + exact Ball.exact_sound _ +def B1_2_5Half (w : Fin 3) (ij : PairSlot) : Ball := + match w.val, ij.1.val, ij.2.val with + | 0, 0, 1 => ⟨(1 / 2), (1 / 2000000000000000000000000000000)⟩ + | 0, 1, 0 => ⟨(1 / 2), (1 / 2000000000000000000000000000000)⟩ + | 1, 0, 2 => ⟨(3297719669499762242862115497643 / 20000000000000000000000000000000), (1 / 3125000000000000000000000000000)⟩ + | 1, 0, 3 => ⟨(355998814646362178458756161701 / 20000000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ + | 1, 1, 1 => ⟨(396642594740867223667445521291 / 625000000000000000000000000000), (1 / 3125000000000000000000000000000)⟩ + | 1, 2, 0 => ⟨(3297719669499762242862115497643 / 20000000000000000000000000000000), (1 / 3125000000000000000000000000000)⟩ + | 1, 3, 0 => ⟨(355998814646362178458756161701 / 20000000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ + | 2, 5, 1 => ⟨(36249118515191988245121850051 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 2, 4, 2 => ⟨(9630112437092073853782692487793 / 20000000000000000000000000000000), (47 / 100000000000000000000000000000000)⟩ + | 2, 4, 3 => ⟨(1776939577509246754596293860933 / 100000000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ + | 2, 2, 4 => ⟨(9630112437092073853782692487793 / 20000000000000000000000000000000), (47 / 100000000000000000000000000000000)⟩ + | 2, 3, 4 => ⟨(1776939577509246754596293860933 / 100000000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ + | 2, 1, 5 => ⟨(36249118515191988245121850051 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | _, _, _ => (.exact 0) +lemma B1_2_5Half_check_0_0 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 1 2 5)) (shape 1 2 5) B1_2_5Law + (fun u => B1_2_5Little u 0) ((0 : Fin 6),j)) (B1_2_5Half 0 (0,j)) = true := by + decide +kernel +lemma B1_2_5Half_check_0_1 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 1 2 5)) (shape 1 2 5) B1_2_5Law + (fun u => B1_2_5Little u 0) ((1 : Fin 6),j)) (B1_2_5Half 0 (1,j)) = true := by + decide +kernel +lemma B1_2_5Half_check_0_2 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 1 2 5)) (shape 1 2 5) B1_2_5Law + (fun u => B1_2_5Little u 0) ((2 : Fin 6),j)) (B1_2_5Half 0 (2,j)) = true := by + decide +kernel +lemma B1_2_5Half_check_0_3 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 1 2 5)) (shape 1 2 5) B1_2_5Law + (fun u => B1_2_5Little u 0) ((3 : Fin 6),j)) (B1_2_5Half 0 (3,j)) = true := by + decide +kernel +lemma B1_2_5Half_check_0_4 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 1 2 5)) (shape 1 2 5) B1_2_5Law + (fun u => B1_2_5Little u 0) ((4 : Fin 6),j)) (B1_2_5Half 0 (4,j)) = true := by + decide +kernel +lemma B1_2_5Half_check_0_5 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 1 2 5)) (shape 1 2 5) B1_2_5Law + (fun u => B1_2_5Little u 0) ((5 : Fin 6),j)) (B1_2_5Half 0 (5,j)) = true := by + decide +kernel +lemma B1_2_5Half_check_1_0 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 1 2 5)) (shape 1 2 5) B1_2_5Law + (fun u => B1_2_5Little u 1) ((0 : Fin 6),j)) (B1_2_5Half 1 (0,j)) = true := by + decide +kernel +lemma B1_2_5Half_check_1_1 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 1 2 5)) (shape 1 2 5) B1_2_5Law + (fun u => B1_2_5Little u 1) ((1 : Fin 6),j)) (B1_2_5Half 1 (1,j)) = true := by + decide +kernel +lemma B1_2_5Half_check_1_2 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 1 2 5)) (shape 1 2 5) B1_2_5Law + (fun u => B1_2_5Little u 1) ((2 : Fin 6),j)) (B1_2_5Half 1 (2,j)) = true := by + decide +kernel +lemma B1_2_5Half_check_1_3 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 1 2 5)) (shape 1 2 5) B1_2_5Law + (fun u => B1_2_5Little u 1) ((3 : Fin 6),j)) (B1_2_5Half 1 (3,j)) = true := by + decide +kernel +lemma B1_2_5Half_check_1_4 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 1 2 5)) (shape 1 2 5) B1_2_5Law + (fun u => B1_2_5Little u 1) ((4 : Fin 6),j)) (B1_2_5Half 1 (4,j)) = true := by + decide +kernel +lemma B1_2_5Half_check_1_5 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 1 2 5)) (shape 1 2 5) B1_2_5Law + (fun u => B1_2_5Little u 1) ((5 : Fin 6),j)) (B1_2_5Half 1 (5,j)) = true := by + decide +kernel +lemma B1_2_5Half_check_2_0 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 1 2 5)) (shape 1 2 5) B1_2_5Law + (fun u => B1_2_5Little u 2) ((0 : Fin 6),j)) (B1_2_5Half 2 (0,j)) = true := by + decide +kernel +lemma B1_2_5Half_check_2_1 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 1 2 5)) (shape 1 2 5) B1_2_5Law + (fun u => B1_2_5Little u 2) ((1 : Fin 6),j)) (B1_2_5Half 2 (1,j)) = true := by + decide +kernel +lemma B1_2_5Half_check_2_2 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 1 2 5)) (shape 1 2 5) B1_2_5Law + (fun u => B1_2_5Little u 2) ((2 : Fin 6),j)) (B1_2_5Half 2 (2,j)) = true := by + decide +kernel +lemma B1_2_5Half_check_2_3 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 1 2 5)) (shape 1 2 5) B1_2_5Law + (fun u => B1_2_5Little u 2) ((3 : Fin 6),j)) (B1_2_5Half 2 (3,j)) = true := by + decide +kernel +lemma B1_2_5Half_check_2_4 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 1 2 5)) (shape 1 2 5) B1_2_5Law + (fun u => B1_2_5Little u 2) ((4 : Fin 6),j)) (B1_2_5Half 2 (4,j)) = true := by + decide +kernel +lemma B1_2_5Half_check_2_5 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 1 2 5)) (shape 1 2 5) B1_2_5Law + (fun u => B1_2_5Little u 2) ((5 : Fin 6),j)) (B1_2_5Half 2 (5,j)) = true := by + decide +kernel +lemma B1_2_5Half_sound (w : Fin 3) (ij : PairSlot) : + (B1_2_5Half w ij).Encloses (halfLaw (shape 1 2 5) w ij : ℝ) := by + have hcheck : contains (pairLawBall (below (shape 1 2 5)) (shape 1 2 5) B1_2_5Law + (fun u => B1_2_5Little u w) ij) (B1_2_5Half w ij) = true := by + rcases ij with ⟨i,j⟩ + revert i w + apply forall_fin3 + · exact forall_fin6 (B1_2_5Half_check_0_0 j) (B1_2_5Half_check_0_1 j) (B1_2_5Half_check_0_2 j) (B1_2_5Half_check_0_3 j) (B1_2_5Half_check_0_4 j) (B1_2_5Half_check_0_5 j) + · exact forall_fin6 (B1_2_5Half_check_1_0 j) (B1_2_5Half_check_1_1 j) (B1_2_5Half_check_1_2 j) (B1_2_5Half_check_1_3 j) (B1_2_5Half_check_1_4 j) (B1_2_5Half_check_1_5 j) + · exact forall_fin6 (B1_2_5Half_check_2_0 j) (B1_2_5Half_check_2_1 j) (B1_2_5Half_check_2_2 j) (B1_2_5Half_check_2_3 j) (B1_2_5Half_check_2_4 j) (B1_2_5Half_check_2_5 j) + have h := contains_sound (pairLawBall_sound (below (shape 1 2 5)) (shape 1 2 5) + B1_2_5Law (fun u => (stageBLaw (shape 1 2 5) u : ℝ)) + (fun u => B1_2_5Little u w) (fun u i => (littleLaw (shape 1 2 5) u w i : ℝ)) + (fun u _ => B1_2_5Law_sound u) (fun u i => B1_2_5Little_sound u w i) ij) hcheck + have hp : positive (shape 1 2 5) = true := by decide +kernel + simpa only [halfLaw, hp, ite_true, pairLaw, positiveHalfLaw, Rat.cast_list_sum, + List.map_map, Function.comp_def, Rat.cast_mul] using h + +def B1_3_4Binary (u : Shape) : ℚ := + match u 0, u 1, u 2 with + | 0, 2, 2 => (46483 / 500000) + | 1, 1, 2 => (301 / 250000) + | 1, 2, 1 => (10537 / 250000) + | _, _, _ => 0 +lemma B1_3_4Binary_eq (u : Shape) (hu : u ∈ shapes 4) : + binaryParameter (shape 1 3 4) u = B1_3_4Binary u := by + rw [shapes4_list] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel +def B1_3_4LittleRat (u : Shape) (w : Fin 3) (i : Fin 6) : ℚ := + if u w = 2 then + if i = 2 then 1 - B1_3_4Binary u else if i = 3 then B1_3_4Binary u else 0 + else if i = singletonSlot (u w) then 1 else 0 + +def B1_3_4Little (u : Shape) (w : Fin 3) (i : Fin 6) : Ball := + if u ∈ shapes 4 then .exact (B1_3_4LittleRat u w i) + else .exact (littleLaw (shape 1 3 4) u w i) + +lemma B1_3_4Little_sound (u : Shape) (w : Fin 3) (i : Fin 6) : + (B1_3_4Little u w i).Encloses (littleLaw (shape 1 3 4) u w i : ℝ) := by + by_cases hu : u ∈ shapes 4 + · simp only [B1_3_4Little, hu, ite_true] + apply exact_rat_enclosed + simp only [B1_3_4LittleRat, littleLaw, B1_3_4Binary_eq u hu] + · simp only [B1_3_4Little, hu, ite_false] + exact Ball.exact_sound _ +def B1_3_4Half (w : Fin 3) (ij : PairSlot) : Ball := + match w.val, ij.1.val, ij.2.val with + | 0, 0, 1 => ⟨(1 / 2), (27 / 100000000000000000000000000000000)⟩ + | 0, 1, 0 => ⟨(1 / 2), (27 / 100000000000000000000000000000000)⟩ + | 1, 0, 4 => ⟨(132732360120937838226056869067 / 10000000000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ + | 1, 1, 2 => ⟨(22225619795436123996567854910187 / 50000000000000000000000000000000), (21 / 100000000000000000000000000000000)⟩ + | 1, 1, 3 => ⟨(1055359201979593406150930372239 / 25000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ + | 1, 2, 1 => ⟨(22225619795436123996567854910187 / 50000000000000000000000000000000), (21 / 100000000000000000000000000000000)⟩ + | 1, 3, 1 => ⟨(1055359201979593406150930372239 / 25000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ + | 1, 4, 0 => ⟨(132732360120937838226056869067 / 10000000000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ + | 2, 5, 0 => ⟨(18376602916823826473515371739 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 2, 4, 1 => ⟨(1456119070923005006600137580027 / 20000000000000000000000000000000), (3 / 20000000000000000000000000000000)⟩ + | 2, 2, 2 => ⟨(77369303606423225289931508632371 / 100000000000000000000000000000000), (21 / 100000000000000000000000000000000)⟩ + | 2, 2, 3 => ⟨(4011596667753851198216770545993 / 100000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ + | 2, 3, 2 => ⟨(4011596667753851198216770545993 / 100000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ + | 2, 3, 3 => ⟨(4779571502687297343271865947 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 2, 1, 4 => ⟨(1456119070923005006600137580027 / 20000000000000000000000000000000), (3 / 20000000000000000000000000000000)⟩ + | 2, 0, 5 => ⟨(18376602916823826473515371739 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | _, _, _ => (.exact 0) +lemma B1_3_4Half_check_0_0 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 1 3 4)) (shape 1 3 4) B1_3_4Law + (fun u => B1_3_4Little u 0) ((0 : Fin 6),j)) (B1_3_4Half 0 (0,j)) = true := by + decide +kernel +lemma B1_3_4Half_check_0_1 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 1 3 4)) (shape 1 3 4) B1_3_4Law + (fun u => B1_3_4Little u 0) ((1 : Fin 6),j)) (B1_3_4Half 0 (1,j)) = true := by + decide +kernel +lemma B1_3_4Half_check_0_2 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 1 3 4)) (shape 1 3 4) B1_3_4Law + (fun u => B1_3_4Little u 0) ((2 : Fin 6),j)) (B1_3_4Half 0 (2,j)) = true := by + decide +kernel +lemma B1_3_4Half_check_0_3 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 1 3 4)) (shape 1 3 4) B1_3_4Law + (fun u => B1_3_4Little u 0) ((3 : Fin 6),j)) (B1_3_4Half 0 (3,j)) = true := by + decide +kernel +lemma B1_3_4Half_check_0_4 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 1 3 4)) (shape 1 3 4) B1_3_4Law + (fun u => B1_3_4Little u 0) ((4 : Fin 6),j)) (B1_3_4Half 0 (4,j)) = true := by + decide +kernel +lemma B1_3_4Half_check_0_5 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 1 3 4)) (shape 1 3 4) B1_3_4Law + (fun u => B1_3_4Little u 0) ((5 : Fin 6),j)) (B1_3_4Half 0 (5,j)) = true := by + decide +kernel +lemma B1_3_4Half_check_1_0 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 1 3 4)) (shape 1 3 4) B1_3_4Law + (fun u => B1_3_4Little u 1) ((0 : Fin 6),j)) (B1_3_4Half 1 (0,j)) = true := by + decide +kernel +lemma B1_3_4Half_check_1_1 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 1 3 4)) (shape 1 3 4) B1_3_4Law + (fun u => B1_3_4Little u 1) ((1 : Fin 6),j)) (B1_3_4Half 1 (1,j)) = true := by + decide +kernel +lemma B1_3_4Half_check_1_2 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 1 3 4)) (shape 1 3 4) B1_3_4Law + (fun u => B1_3_4Little u 1) ((2 : Fin 6),j)) (B1_3_4Half 1 (2,j)) = true := by + decide +kernel +lemma B1_3_4Half_check_1_3 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 1 3 4)) (shape 1 3 4) B1_3_4Law + (fun u => B1_3_4Little u 1) ((3 : Fin 6),j)) (B1_3_4Half 1 (3,j)) = true := by + decide +kernel +lemma B1_3_4Half_check_1_4 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 1 3 4)) (shape 1 3 4) B1_3_4Law + (fun u => B1_3_4Little u 1) ((4 : Fin 6),j)) (B1_3_4Half 1 (4,j)) = true := by + decide +kernel +lemma B1_3_4Half_check_1_5 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 1 3 4)) (shape 1 3 4) B1_3_4Law + (fun u => B1_3_4Little u 1) ((5 : Fin 6),j)) (B1_3_4Half 1 (5,j)) = true := by + decide +kernel +lemma B1_3_4Half_check_2_0 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 1 3 4)) (shape 1 3 4) B1_3_4Law + (fun u => B1_3_4Little u 2) ((0 : Fin 6),j)) (B1_3_4Half 2 (0,j)) = true := by + decide +kernel +lemma B1_3_4Half_check_2_1 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 1 3 4)) (shape 1 3 4) B1_3_4Law + (fun u => B1_3_4Little u 2) ((1 : Fin 6),j)) (B1_3_4Half 2 (1,j)) = true := by + decide +kernel +lemma B1_3_4Half_check_2_2 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 1 3 4)) (shape 1 3 4) B1_3_4Law + (fun u => B1_3_4Little u 2) ((2 : Fin 6),j)) (B1_3_4Half 2 (2,j)) = true := by + decide +kernel +lemma B1_3_4Half_check_2_3 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 1 3 4)) (shape 1 3 4) B1_3_4Law + (fun u => B1_3_4Little u 2) ((3 : Fin 6),j)) (B1_3_4Half 2 (3,j)) = true := by + decide +kernel +lemma B1_3_4Half_check_2_4 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 1 3 4)) (shape 1 3 4) B1_3_4Law + (fun u => B1_3_4Little u 2) ((4 : Fin 6),j)) (B1_3_4Half 2 (4,j)) = true := by + decide +kernel +lemma B1_3_4Half_check_2_5 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 1 3 4)) (shape 1 3 4) B1_3_4Law + (fun u => B1_3_4Little u 2) ((5 : Fin 6),j)) (B1_3_4Half 2 (5,j)) = true := by + decide +kernel +lemma B1_3_4Half_sound (w : Fin 3) (ij : PairSlot) : + (B1_3_4Half w ij).Encloses (halfLaw (shape 1 3 4) w ij : ℝ) := by + have hcheck : contains (pairLawBall (below (shape 1 3 4)) (shape 1 3 4) B1_3_4Law + (fun u => B1_3_4Little u w) ij) (B1_3_4Half w ij) = true := by + rcases ij with ⟨i,j⟩ + revert i w + apply forall_fin3 + · exact forall_fin6 (B1_3_4Half_check_0_0 j) (B1_3_4Half_check_0_1 j) (B1_3_4Half_check_0_2 j) (B1_3_4Half_check_0_3 j) (B1_3_4Half_check_0_4 j) (B1_3_4Half_check_0_5 j) + · exact forall_fin6 (B1_3_4Half_check_1_0 j) (B1_3_4Half_check_1_1 j) (B1_3_4Half_check_1_2 j) (B1_3_4Half_check_1_3 j) (B1_3_4Half_check_1_4 j) (B1_3_4Half_check_1_5 j) + · exact forall_fin6 (B1_3_4Half_check_2_0 j) (B1_3_4Half_check_2_1 j) (B1_3_4Half_check_2_2 j) (B1_3_4Half_check_2_3 j) (B1_3_4Half_check_2_4 j) (B1_3_4Half_check_2_5 j) + have h := contains_sound (pairLawBall_sound (below (shape 1 3 4)) (shape 1 3 4) + B1_3_4Law (fun u => (stageBLaw (shape 1 3 4) u : ℝ)) + (fun u => B1_3_4Little u w) (fun u i => (littleLaw (shape 1 3 4) u w i : ℝ)) + (fun u _ => B1_3_4Law_sound u) (fun u i => B1_3_4Little_sound u w i) ij) hcheck + have hp : positive (shape 1 3 4) = true := by decide +kernel + simpa only [halfLaw, hp, ite_true, pairLaw, positiveHalfLaw, Rat.cast_list_sum, + List.map_map, Function.comp_def, Rat.cast_mul] using h + +end MatrixMultiplication.NativeNumerics + +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/Certificates/LittleB1_4_3.lean b/lean/OAI/LinearAlgebra/MatrixFields/Certificates/LittleB1_4_3.lean new file mode 100644 index 0000000000000000000000000000000000000000..0199e6829045cc96419700ebf7f859aff1a32ddb --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/Certificates/LittleB1_4_3.lean @@ -0,0 +1,175 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Certificates.LittleB1_3_4 + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def B1_4_3Binary (u : Shape) : ℚ := + match u 0, u 1, u 2 with + | 0, 2, 2 => (23901 / 250000) + | 1, 1, 2 => (41743 / 1000000) + | 1, 2, 1 => (3057 / 1000000) + | _, _, _ => 0 +lemma B1_4_3Binary_eq (u : Shape) (hu : u ∈ shapes 4) : + binaryParameter (shape 1 4 3) u = B1_4_3Binary u := by + rw [shapes4_list] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel +def B1_4_3LittleRat (u : Shape) (w : Fin 3) (i : Fin 6) : ℚ := + if u w = 2 then + if i = 2 then 1 - B1_4_3Binary u else if i = 3 then B1_4_3Binary u else 0 + else if i = singletonSlot (u w) then 1 else 0 + +def B1_4_3Little (u : Shape) (w : Fin 3) (i : Fin 6) : Ball := + if u ∈ shapes 4 then .exact (B1_4_3LittleRat u w i) + else .exact (littleLaw (shape 1 4 3) u w i) + +lemma B1_4_3Little_sound (u : Shape) (w : Fin 3) (i : Fin 6) : + (B1_4_3Little u w i).Encloses (littleLaw (shape 1 4 3) u w i : ℝ) := by + by_cases hu : u ∈ shapes 4 + · simp only [B1_4_3Little, hu, ite_true] + apply exact_rat_enclosed + simp only [B1_4_3LittleRat, littleLaw, B1_4_3Binary_eq u hu] + · simp only [B1_4_3Little, hu, ite_false] + exact Ball.exact_sound _ +def B1_4_3Half (w : Fin 3) (ij : PairSlot) : Ball := + match w.val, ij.1.val, ij.2.val with + | 0, 0, 1 => ⟨(1 / 2), (27 / 100000000000000000000000000000000)⟩ + | 0, 1, 0 => ⟨(1 / 2), (27 / 100000000000000000000000000000000)⟩ + | 1, 1, 4 => ⟨(1966519024111033745643559687113 / 25000000000000000000000000000000), (3 / 20000000000000000000000000000000)⟩ + | 1, 2, 2 => ⟨(18979543218321732038291109031929 / 25000000000000000000000000000000), (1 / 5000000000000000000000000000000)⟩ + | 1, 2, 3 => ⟨(4129064322164561216004098570321 / 100000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ + | 1, 3, 2 => ⟨(4129064322164561216004098570321 / 100000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ + | 1, 3, 3 => ⟨(3076084781593046714415474453 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 1, 4, 1 => ⟨(1966519024111033745643559687113 / 25000000000000000000000000000000), (3 / 20000000000000000000000000000000)⟩ + | 1, 5, 0 => ⟨(33468805621467537981782719557 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 1, 0, 5 => ⟨(33468805621467537981782719557 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 2, 4, 0 => ⟨(1305555413502823769500199931759 / 100000000000000000000000000000000), (1 / 20000000000000000000000000000000)⟩ + | 2, 2, 1 => ⟨(44394219774093180020469714786281 / 100000000000000000000000000000000), (21 / 100000000000000000000000000000000)⟩ + | 2, 3, 1 => ⟨(107505620310099905250752132049 / 2500000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ + | 2, 1, 2 => ⟨(44394219774093180020469714786281 / 100000000000000000000000000000000), (21 / 100000000000000000000000000000000)⟩ + | 2, 1, 3 => ⟨(107505620310099905250752132049 / 2500000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ + | 2, 0, 4 => ⟨(1305555413502823769500199931759 / 100000000000000000000000000000000), (1 / 20000000000000000000000000000000)⟩ + | _, _, _ => (.exact 0) +lemma B1_4_3Half_check_0_0 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 1 4 3)) (shape 1 4 3) B1_4_3Law + (fun u => B1_4_3Little u 0) ((0 : Fin 6),j)) (B1_4_3Half 0 (0,j)) = true := by + decide +kernel +lemma B1_4_3Half_check_0_1 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 1 4 3)) (shape 1 4 3) B1_4_3Law + (fun u => B1_4_3Little u 0) ((1 : Fin 6),j)) (B1_4_3Half 0 (1,j)) = true := by + decide +kernel +lemma B1_4_3Half_check_0_2 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 1 4 3)) (shape 1 4 3) B1_4_3Law + (fun u => B1_4_3Little u 0) ((2 : Fin 6),j)) (B1_4_3Half 0 (2,j)) = true := by + decide +kernel +lemma B1_4_3Half_check_0_3 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 1 4 3)) (shape 1 4 3) B1_4_3Law + (fun u => B1_4_3Little u 0) ((3 : Fin 6),j)) (B1_4_3Half 0 (3,j)) = true := by + decide +kernel +lemma B1_4_3Half_check_0_4 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 1 4 3)) (shape 1 4 3) B1_4_3Law + (fun u => B1_4_3Little u 0) ((4 : Fin 6),j)) (B1_4_3Half 0 (4,j)) = true := by + decide +kernel +lemma B1_4_3Half_check_0_5 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 1 4 3)) (shape 1 4 3) B1_4_3Law + (fun u => B1_4_3Little u 0) ((5 : Fin 6),j)) (B1_4_3Half 0 (5,j)) = true := by + decide +kernel +lemma B1_4_3Half_check_1_0 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 1 4 3)) (shape 1 4 3) B1_4_3Law + (fun u => B1_4_3Little u 1) ((0 : Fin 6),j)) (B1_4_3Half 1 (0,j)) = true := by + decide +kernel +lemma B1_4_3Half_check_1_1 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 1 4 3)) (shape 1 4 3) B1_4_3Law + (fun u => B1_4_3Little u 1) ((1 : Fin 6),j)) (B1_4_3Half 1 (1,j)) = true := by + decide +kernel +lemma B1_4_3Half_check_1_2 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 1 4 3)) (shape 1 4 3) B1_4_3Law + (fun u => B1_4_3Little u 1) ((2 : Fin 6),j)) (B1_4_3Half 1 (2,j)) = true := by + decide +kernel +lemma B1_4_3Half_check_1_3 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 1 4 3)) (shape 1 4 3) B1_4_3Law + (fun u => B1_4_3Little u 1) ((3 : Fin 6),j)) (B1_4_3Half 1 (3,j)) = true := by + decide +kernel +lemma B1_4_3Half_check_1_4 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 1 4 3)) (shape 1 4 3) B1_4_3Law + (fun u => B1_4_3Little u 1) ((4 : Fin 6),j)) (B1_4_3Half 1 (4,j)) = true := by + decide +kernel +lemma B1_4_3Half_check_1_5 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 1 4 3)) (shape 1 4 3) B1_4_3Law + (fun u => B1_4_3Little u 1) ((5 : Fin 6),j)) (B1_4_3Half 1 (5,j)) = true := by + decide +kernel +lemma B1_4_3Half_check_2_0 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 1 4 3)) (shape 1 4 3) B1_4_3Law + (fun u => B1_4_3Little u 2) ((0 : Fin 6),j)) (B1_4_3Half 2 (0,j)) = true := by + decide +kernel +lemma B1_4_3Half_check_2_1 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 1 4 3)) (shape 1 4 3) B1_4_3Law + (fun u => B1_4_3Little u 2) ((1 : Fin 6),j)) (B1_4_3Half 2 (1,j)) = true := by + decide +kernel +lemma B1_4_3Half_check_2_2 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 1 4 3)) (shape 1 4 3) B1_4_3Law + (fun u => B1_4_3Little u 2) ((2 : Fin 6),j)) (B1_4_3Half 2 (2,j)) = true := by + decide +kernel +lemma B1_4_3Half_check_2_3 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 1 4 3)) (shape 1 4 3) B1_4_3Law + (fun u => B1_4_3Little u 2) ((3 : Fin 6),j)) (B1_4_3Half 2 (3,j)) = true := by + decide +kernel +lemma B1_4_3Half_check_2_4 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 1 4 3)) (shape 1 4 3) B1_4_3Law + (fun u => B1_4_3Little u 2) ((4 : Fin 6),j)) (B1_4_3Half 2 (4,j)) = true := by + decide +kernel +lemma B1_4_3Half_check_2_5 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 1 4 3)) (shape 1 4 3) B1_4_3Law + (fun u => B1_4_3Little u 2) ((5 : Fin 6),j)) (B1_4_3Half 2 (5,j)) = true := by + decide +kernel +lemma B1_4_3Half_sound (w : Fin 3) (ij : PairSlot) : + (B1_4_3Half w ij).Encloses (halfLaw (shape 1 4 3) w ij : ℝ) := by + have hcheck : contains (pairLawBall (below (shape 1 4 3)) (shape 1 4 3) B1_4_3Law + (fun u => B1_4_3Little u w) ij) (B1_4_3Half w ij) = true := by + rcases ij with ⟨i,j⟩ + revert i w + apply forall_fin3 + · exact forall_fin6 (B1_4_3Half_check_0_0 j) (B1_4_3Half_check_0_1 j) (B1_4_3Half_check_0_2 j) (B1_4_3Half_check_0_3 j) (B1_4_3Half_check_0_4 j) (B1_4_3Half_check_0_5 j) + · exact forall_fin6 (B1_4_3Half_check_1_0 j) (B1_4_3Half_check_1_1 j) (B1_4_3Half_check_1_2 j) (B1_4_3Half_check_1_3 j) (B1_4_3Half_check_1_4 j) (B1_4_3Half_check_1_5 j) + · exact forall_fin6 (B1_4_3Half_check_2_0 j) (B1_4_3Half_check_2_1 j) (B1_4_3Half_check_2_2 j) (B1_4_3Half_check_2_3 j) (B1_4_3Half_check_2_4 j) (B1_4_3Half_check_2_5 j) + have h := contains_sound (pairLawBall_sound (below (shape 1 4 3)) (shape 1 4 3) + B1_4_3Law (fun u => (stageBLaw (shape 1 4 3) u : ℝ)) + (fun u => B1_4_3Little u w) (fun u i => (littleLaw (shape 1 4 3) u w i : ℝ)) + (fun u _ => B1_4_3Law_sound u) (fun u i => B1_4_3Little_sound u w i) ij) hcheck + have hp : positive (shape 1 4 3) = true := by decide +kernel + simpa only [halfLaw, hp, ite_true, pairLaw, positiveHalfLaw, Rat.cast_list_sum, + List.map_map, Function.comp_def, Rat.cast_mul] using h + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/Certificates/LittleB1_5_2.lean b/lean/OAI/LinearAlgebra/MatrixFields/Certificates/LittleB1_5_2.lean new file mode 100644 index 0000000000000000000000000000000000000000..f4c46005e789e59f4780ffbb9db09324afaf76db --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/Certificates/LittleB1_5_2.lean @@ -0,0 +1,172 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Certificates.LittleB1_3_4 + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def B1_5_2Binary (u : Shape) : ℚ := + match u 0, u 1, u 2 with + | 0, 2, 2 => (109933 / 1000000) + | 1, 1, 2 => (10523 / 250000) + | 1, 2, 1 => (3747 / 1000000) + | _, _, _ => 0 +lemma B1_5_2Binary_eq (u : Shape) (hu : u ∈ shapes 4) : + binaryParameter (shape 1 5 2) u = B1_5_2Binary u := by + rw [shapes4_list] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel +def B1_5_2LittleRat (u : Shape) (w : Fin 3) (i : Fin 6) : ℚ := + if u w = 2 then + if i = 2 then 1 - B1_5_2Binary u else if i = 3 then B1_5_2Binary u else 0 + else if i = singletonSlot (u w) then 1 else 0 + +def B1_5_2Little (u : Shape) (w : Fin 3) (i : Fin 6) : Ball := + if u ∈ shapes 4 then .exact (B1_5_2LittleRat u w i) + else .exact (littleLaw (shape 1 5 2) u w i) + +lemma B1_5_2Little_sound (u : Shape) (w : Fin 3) (i : Fin 6) : + (B1_5_2Little u w i).Encloses (littleLaw (shape 1 5 2) u w i : ℝ) := by + by_cases hu : u ∈ shapes 4 + · simp only [B1_5_2Little, hu, ite_true] + apply exact_rat_enclosed + simp only [B1_5_2LittleRat, littleLaw, B1_5_2Binary_eq u hu] + · simp only [B1_5_2Little, hu, ite_false] + exact Ball.exact_sound _ +def B1_5_2Half (w : Fin 3) (ij : PairSlot) : Ball := + match w.val, ij.1.val, ij.2.val with + | 0, 0, 1 => ⟨(1 / 2), (51 / 100000000000000000000000000000000)⟩ + | 0, 1, 0 => ⟨(1 / 2), (51 / 100000000000000000000000000000000)⟩ + | 1, 2, 4 => ⟨(944296764805115665482085327337 / 2000000000000000000000000000000), (9 / 20000000000000000000000000000000)⟩ + | 1, 3, 4 => ⟨(518340583815889402541057141607 / 25000000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ + | 1, 4, 2 => ⟨(944296764805115665482085327337 / 2000000000000000000000000000000), (9 / 20000000000000000000000000000000)⟩ + | 1, 4, 3 => ⟨(518340583815889402541057141607 / 25000000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ + | 1, 5, 1 => ⟨(355899712240329557865752533361 / 50000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ + | 1, 1, 5 => ⟨(355899712240329557865752533361 / 50000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ + | 2, 2, 0 => ⟨(2064129144151554264168571077709 / 12500000000000000000000000000000), (1 / 3125000000000000000000000000000)⟩ + | 2, 3, 0 => ⟨(1985286600756920686097122080759 / 100000000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ + | 2, 1, 1 => ⟨(31501680246030645200554309297569 / 50000000000000000000000000000000), (1 / 3125000000000000000000000000000)⟩ + | 2, 0, 2 => ⟨(2064129144151554264168571077709 / 12500000000000000000000000000000), (1 / 3125000000000000000000000000000)⟩ + | 2, 0, 3 => ⟨(1985286600756920686097122080759 / 100000000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ + | _, _, _ => (.exact 0) +lemma B1_5_2Half_check_0_0 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 1 5 2)) (shape 1 5 2) B1_5_2Law + (fun u => B1_5_2Little u 0) ((0 : Fin 6),j)) (B1_5_2Half 0 (0,j)) = true := by + decide +kernel +lemma B1_5_2Half_check_0_1 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 1 5 2)) (shape 1 5 2) B1_5_2Law + (fun u => B1_5_2Little u 0) ((1 : Fin 6),j)) (B1_5_2Half 0 (1,j)) = true := by + decide +kernel +lemma B1_5_2Half_check_0_2 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 1 5 2)) (shape 1 5 2) B1_5_2Law + (fun u => B1_5_2Little u 0) ((2 : Fin 6),j)) (B1_5_2Half 0 (2,j)) = true := by + decide +kernel +lemma B1_5_2Half_check_0_3 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 1 5 2)) (shape 1 5 2) B1_5_2Law + (fun u => B1_5_2Little u 0) ((3 : Fin 6),j)) (B1_5_2Half 0 (3,j)) = true := by + decide +kernel +lemma B1_5_2Half_check_0_4 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 1 5 2)) (shape 1 5 2) B1_5_2Law + (fun u => B1_5_2Little u 0) ((4 : Fin 6),j)) (B1_5_2Half 0 (4,j)) = true := by + decide +kernel +lemma B1_5_2Half_check_0_5 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 1 5 2)) (shape 1 5 2) B1_5_2Law + (fun u => B1_5_2Little u 0) ((5 : Fin 6),j)) (B1_5_2Half 0 (5,j)) = true := by + decide +kernel +lemma B1_5_2Half_check_1_0 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 1 5 2)) (shape 1 5 2) B1_5_2Law + (fun u => B1_5_2Little u 1) ((0 : Fin 6),j)) (B1_5_2Half 1 (0,j)) = true := by + decide +kernel +lemma B1_5_2Half_check_1_1 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 1 5 2)) (shape 1 5 2) B1_5_2Law + (fun u => B1_5_2Little u 1) ((1 : Fin 6),j)) (B1_5_2Half 1 (1,j)) = true := by + decide +kernel +lemma B1_5_2Half_check_1_2 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 1 5 2)) (shape 1 5 2) B1_5_2Law + (fun u => B1_5_2Little u 1) ((2 : Fin 6),j)) (B1_5_2Half 1 (2,j)) = true := by + decide +kernel +lemma B1_5_2Half_check_1_3 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 1 5 2)) (shape 1 5 2) B1_5_2Law + (fun u => B1_5_2Little u 1) ((3 : Fin 6),j)) (B1_5_2Half 1 (3,j)) = true := by + decide +kernel +lemma B1_5_2Half_check_1_4 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 1 5 2)) (shape 1 5 2) B1_5_2Law + (fun u => B1_5_2Little u 1) ((4 : Fin 6),j)) (B1_5_2Half 1 (4,j)) = true := by + decide +kernel +lemma B1_5_2Half_check_1_5 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 1 5 2)) (shape 1 5 2) B1_5_2Law + (fun u => B1_5_2Little u 1) ((5 : Fin 6),j)) (B1_5_2Half 1 (5,j)) = true := by + decide +kernel +lemma B1_5_2Half_check_2_0 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 1 5 2)) (shape 1 5 2) B1_5_2Law + (fun u => B1_5_2Little u 2) ((0 : Fin 6),j)) (B1_5_2Half 2 (0,j)) = true := by + decide +kernel +lemma B1_5_2Half_check_2_1 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 1 5 2)) (shape 1 5 2) B1_5_2Law + (fun u => B1_5_2Little u 2) ((1 : Fin 6),j)) (B1_5_2Half 2 (1,j)) = true := by + decide +kernel +lemma B1_5_2Half_check_2_2 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 1 5 2)) (shape 1 5 2) B1_5_2Law + (fun u => B1_5_2Little u 2) ((2 : Fin 6),j)) (B1_5_2Half 2 (2,j)) = true := by + decide +kernel +lemma B1_5_2Half_check_2_3 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 1 5 2)) (shape 1 5 2) B1_5_2Law + (fun u => B1_5_2Little u 2) ((3 : Fin 6),j)) (B1_5_2Half 2 (3,j)) = true := by + decide +kernel +lemma B1_5_2Half_check_2_4 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 1 5 2)) (shape 1 5 2) B1_5_2Law + (fun u => B1_5_2Little u 2) ((4 : Fin 6),j)) (B1_5_2Half 2 (4,j)) = true := by + decide +kernel +lemma B1_5_2Half_check_2_5 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 1 5 2)) (shape 1 5 2) B1_5_2Law + (fun u => B1_5_2Little u 2) ((5 : Fin 6),j)) (B1_5_2Half 2 (5,j)) = true := by + decide +kernel +lemma B1_5_2Half_sound (w : Fin 3) (ij : PairSlot) : + (B1_5_2Half w ij).Encloses (halfLaw (shape 1 5 2) w ij : ℝ) := by + have hcheck : contains (pairLawBall (below (shape 1 5 2)) (shape 1 5 2) B1_5_2Law + (fun u => B1_5_2Little u w) ij) (B1_5_2Half w ij) = true := by + rcases ij with ⟨i,j⟩ + revert i w + apply forall_fin3 + · exact forall_fin6 (B1_5_2Half_check_0_0 j) (B1_5_2Half_check_0_1 j) (B1_5_2Half_check_0_2 j) (B1_5_2Half_check_0_3 j) (B1_5_2Half_check_0_4 j) (B1_5_2Half_check_0_5 j) + · exact forall_fin6 (B1_5_2Half_check_1_0 j) (B1_5_2Half_check_1_1 j) (B1_5_2Half_check_1_2 j) (B1_5_2Half_check_1_3 j) (B1_5_2Half_check_1_4 j) (B1_5_2Half_check_1_5 j) + · exact forall_fin6 (B1_5_2Half_check_2_0 j) (B1_5_2Half_check_2_1 j) (B1_5_2Half_check_2_2 j) (B1_5_2Half_check_2_3 j) (B1_5_2Half_check_2_4 j) (B1_5_2Half_check_2_5 j) + have h := contains_sound (pairLawBall_sound (below (shape 1 5 2)) (shape 1 5 2) + B1_5_2Law (fun u => (stageBLaw (shape 1 5 2) u : ℝ)) + (fun u => B1_5_2Little u w) (fun u i => (littleLaw (shape 1 5 2) u w i : ℝ)) + (fun u _ => B1_5_2Law_sound u) (fun u i => B1_5_2Little_sound u w i) ij) hcheck + have hp : positive (shape 1 5 2) = true := by decide +kernel + simpa only [halfLaw, hp, ite_true, pairLaw, positiveHalfLaw, Rat.cast_list_sum, + List.map_map, Function.comp_def, Rat.cast_mul] using h + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/Certificates/LittleB2_3_3.lean b/lean/OAI/LinearAlgebra/MatrixFields/Certificates/LittleB2_3_3.lean new file mode 100644 index 0000000000000000000000000000000000000000..dcf8d26b75a2287a5a0668a41b8820fd5444e261 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/Certificates/LittleB2_3_3.lean @@ -0,0 +1,179 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Certificates.LittleB1_3_4 + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def B2_3_3Binary (u : Shape) : ℚ := + match u 0, u 1, u 2 with + | 0, 2, 2 => (55041 / 500000) + | 1, 1, 2 => (573 / 125000) + | 1, 2, 1 => (1687 / 40000) + | 2, 0, 2 => (104091 / 1000000) + | 2, 1, 1 => (19419 / 500000) + | 2, 2, 0 => (102383 / 1000000) + | _, _, _ => 0 +lemma B2_3_3Binary_eq (u : Shape) (hu : u ∈ shapes 4) : + binaryParameter (shape 2 3 3) u = B2_3_3Binary u := by + rw [shapes4_list] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel +def B2_3_3LittleRat (u : Shape) (w : Fin 3) (i : Fin 6) : ℚ := + if u w = 2 then + if i = 2 then 1 - B2_3_3Binary u else if i = 3 then B2_3_3Binary u else 0 + else if i = singletonSlot (u w) then 1 else 0 + +def B2_3_3Little (u : Shape) (w : Fin 3) (i : Fin 6) : Ball := + if u ∈ shapes 4 then .exact (B2_3_3LittleRat u w i) + else .exact (littleLaw (shape 2 3 3) u w i) + +lemma B2_3_3Little_sound (u : Shape) (w : Fin 3) (i : Fin 6) : + (B2_3_3Little u w i).Encloses (littleLaw (shape 2 3 3) u w i : ℝ) := by + by_cases hu : u ∈ shapes 4 + · simp only [B2_3_3Little, hu, ite_true] + apply exact_rat_enclosed + simp only [B2_3_3LittleRat, littleLaw, B2_3_3Binary_eq u hu] + · simp only [B2_3_3Little, hu, ite_false] + exact Ball.exact_sound _ +def B2_3_3Half (w : Fin 3) (ij : PairSlot) : Ball := + match w.val, ij.1.val, ij.2.val with + | 0, 0, 2 => ⟨(8811526653339407816212002016803 / 50000000000000000000000000000000), (27 / 100000000000000000000000000000000)⟩ + | 0, 0, 3 => ⟨(173415754401812546184280998437 / 20000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ + | 0, 1, 1 => ⟨(31509867921312121636654590974209 / 50000000000000000000000000000000), (7 / 25000000000000000000000000000000)⟩ + | 0, 2, 0 => ⟨(8811526653339407816212002016803 / 50000000000000000000000000000000), (27 / 100000000000000000000000000000000)⟩ + | 0, 3, 0 => ⟨(173415754401812546184280998437 / 20000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ + | 1, 1, 2 => ⟨(45457112926707713088575555921683 / 100000000000000000000000000000000), (7 / 20000000000000000000000000000000)⟩ + | 1, 1, 3 => ⟨(3220843048653859968603717052973 / 100000000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ + | 1, 2, 1 => ⟨(45457112926707713088575555921683 / 100000000000000000000000000000000), (7 / 20000000000000000000000000000000)⟩ + | 1, 3, 1 => ⟨(3220843048653859968603717052973 / 100000000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ + | 1, 4, 0 => ⟨(20656937884975420981573859771 / 1562500000000000000000000000000), (1 / 20000000000000000000000000000000)⟩ + | 1, 0, 4 => ⟨(20656937884975420981573859771 / 1562500000000000000000000000000), (1 / 20000000000000000000000000000000)⟩ + | 2, 4, 0 => ⟨(163911127094417036878035098501 / 12500000000000000000000000000000), (1 / 20000000000000000000000000000000)⟩ + | 2, 2, 1 => ⟨(46643247536423404746233613795319 / 100000000000000000000000000000000), (7 / 20000000000000000000000000000000)⟩ + | 2, 3, 1 => ⟨(2045463446821258958742105416673 / 100000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ + | 2, 1, 2 => ⟨(46643247536423404746233613795319 / 100000000000000000000000000000000), (7 / 20000000000000000000000000000000)⟩ + | 2, 1, 3 => ⟨(2045463446821258958742105416673 / 100000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ + | 2, 0, 4 => ⟨(163911127094417036878035098501 / 12500000000000000000000000000000), (1 / 20000000000000000000000000000000)⟩ + | _, _, _ => (.exact 0) +lemma B2_3_3Half_check_0_0 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 2 3 3)) (shape 2 3 3) B2_3_3Law + (fun u => B2_3_3Little u 0) ((0 : Fin 6),j)) (B2_3_3Half 0 (0,j)) = true := by + decide +kernel +lemma B2_3_3Half_check_0_1 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 2 3 3)) (shape 2 3 3) B2_3_3Law + (fun u => B2_3_3Little u 0) ((1 : Fin 6),j)) (B2_3_3Half 0 (1,j)) = true := by + decide +kernel +lemma B2_3_3Half_check_0_2 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 2 3 3)) (shape 2 3 3) B2_3_3Law + (fun u => B2_3_3Little u 0) ((2 : Fin 6),j)) (B2_3_3Half 0 (2,j)) = true := by + decide +kernel +lemma B2_3_3Half_check_0_3 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 2 3 3)) (shape 2 3 3) B2_3_3Law + (fun u => B2_3_3Little u 0) ((3 : Fin 6),j)) (B2_3_3Half 0 (3,j)) = true := by + decide +kernel +lemma B2_3_3Half_check_0_4 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 2 3 3)) (shape 2 3 3) B2_3_3Law + (fun u => B2_3_3Little u 0) ((4 : Fin 6),j)) (B2_3_3Half 0 (4,j)) = true := by + decide +kernel +lemma B2_3_3Half_check_0_5 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 2 3 3)) (shape 2 3 3) B2_3_3Law + (fun u => B2_3_3Little u 0) ((5 : Fin 6),j)) (B2_3_3Half 0 (5,j)) = true := by + decide +kernel +lemma B2_3_3Half_check_1_0 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 2 3 3)) (shape 2 3 3) B2_3_3Law + (fun u => B2_3_3Little u 1) ((0 : Fin 6),j)) (B2_3_3Half 1 (0,j)) = true := by + decide +kernel +lemma B2_3_3Half_check_1_1 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 2 3 3)) (shape 2 3 3) B2_3_3Law + (fun u => B2_3_3Little u 1) ((1 : Fin 6),j)) (B2_3_3Half 1 (1,j)) = true := by + decide +kernel +lemma B2_3_3Half_check_1_2 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 2 3 3)) (shape 2 3 3) B2_3_3Law + (fun u => B2_3_3Little u 1) ((2 : Fin 6),j)) (B2_3_3Half 1 (2,j)) = true := by + decide +kernel +lemma B2_3_3Half_check_1_3 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 2 3 3)) (shape 2 3 3) B2_3_3Law + (fun u => B2_3_3Little u 1) ((3 : Fin 6),j)) (B2_3_3Half 1 (3,j)) = true := by + decide +kernel +lemma B2_3_3Half_check_1_4 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 2 3 3)) (shape 2 3 3) B2_3_3Law + (fun u => B2_3_3Little u 1) ((4 : Fin 6),j)) (B2_3_3Half 1 (4,j)) = true := by + decide +kernel +lemma B2_3_3Half_check_1_5 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 2 3 3)) (shape 2 3 3) B2_3_3Law + (fun u => B2_3_3Little u 1) ((5 : Fin 6),j)) (B2_3_3Half 1 (5,j)) = true := by + decide +kernel +lemma B2_3_3Half_check_2_0 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 2 3 3)) (shape 2 3 3) B2_3_3Law + (fun u => B2_3_3Little u 2) ((0 : Fin 6),j)) (B2_3_3Half 2 (0,j)) = true := by + decide +kernel +lemma B2_3_3Half_check_2_1 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 2 3 3)) (shape 2 3 3) B2_3_3Law + (fun u => B2_3_3Little u 2) ((1 : Fin 6),j)) (B2_3_3Half 2 (1,j)) = true := by + decide +kernel +lemma B2_3_3Half_check_2_2 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 2 3 3)) (shape 2 3 3) B2_3_3Law + (fun u => B2_3_3Little u 2) ((2 : Fin 6),j)) (B2_3_3Half 2 (2,j)) = true := by + decide +kernel +lemma B2_3_3Half_check_2_3 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 2 3 3)) (shape 2 3 3) B2_3_3Law + (fun u => B2_3_3Little u 2) ((3 : Fin 6),j)) (B2_3_3Half 2 (3,j)) = true := by + decide +kernel +lemma B2_3_3Half_check_2_4 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 2 3 3)) (shape 2 3 3) B2_3_3Law + (fun u => B2_3_3Little u 2) ((4 : Fin 6),j)) (B2_3_3Half 2 (4,j)) = true := by + decide +kernel +lemma B2_3_3Half_check_2_5 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 2 3 3)) (shape 2 3 3) B2_3_3Law + (fun u => B2_3_3Little u 2) ((5 : Fin 6),j)) (B2_3_3Half 2 (5,j)) = true := by + decide +kernel +lemma B2_3_3Half_sound (w : Fin 3) (ij : PairSlot) : + (B2_3_3Half w ij).Encloses (halfLaw (shape 2 3 3) w ij : ℝ) := by + have hcheck : contains (pairLawBall (below (shape 2 3 3)) (shape 2 3 3) B2_3_3Law + (fun u => B2_3_3Little u w) ij) (B2_3_3Half w ij) = true := by + rcases ij with ⟨i,j⟩ + revert i w + apply forall_fin3 + · exact forall_fin6 (B2_3_3Half_check_0_0 j) (B2_3_3Half_check_0_1 j) (B2_3_3Half_check_0_2 j) (B2_3_3Half_check_0_3 j) (B2_3_3Half_check_0_4 j) (B2_3_3Half_check_0_5 j) + · exact forall_fin6 (B2_3_3Half_check_1_0 j) (B2_3_3Half_check_1_1 j) (B2_3_3Half_check_1_2 j) (B2_3_3Half_check_1_3 j) (B2_3_3Half_check_1_4 j) (B2_3_3Half_check_1_5 j) + · exact forall_fin6 (B2_3_3Half_check_2_0 j) (B2_3_3Half_check_2_1 j) (B2_3_3Half_check_2_2 j) (B2_3_3Half_check_2_3 j) (B2_3_3Half_check_2_4 j) (B2_3_3Half_check_2_5 j) + have h := contains_sound (pairLawBall_sound (below (shape 2 3 3)) (shape 2 3 3) + B2_3_3Law (fun u => (stageBLaw (shape 2 3 3) u : ℝ)) + (fun u => B2_3_3Little u w) (fun u i => (littleLaw (shape 2 3 3) u w i : ℝ)) + (fun u _ => B2_3_3Law_sound u) (fun u i => B2_3_3Little_sound u w i) ij) hcheck + have hp : positive (shape 2 3 3) = true := by decide +kernel + simpa only [halfLaw, hp, ite_true, pairLaw, positiveHalfLaw, Rat.cast_list_sum, + List.map_map, Function.comp_def, Rat.cast_mul] using h + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/Certificates/LittleB2_5_1.lean b/lean/OAI/LinearAlgebra/MatrixFields/Certificates/LittleB2_5_1.lean new file mode 100644 index 0000000000000000000000000000000000000000..f9792d5e3013cf8cc6fee29a4c326899db8d747f --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/Certificates/LittleB2_5_1.lean @@ -0,0 +1,172 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Certificates.LittleB1_3_4 + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def B2_5_1Binary (u : Shape) : ℚ := + match u 0, u 1, u 2 with + | 1, 2, 1 => (3587 / 1000000) + | 2, 1, 1 => (21083 / 500000) + | 2, 2, 0 => (55043 / 500000) + | _, _, _ => 0 +lemma B2_5_1Binary_eq (u : Shape) (hu : u ∈ shapes 4) : + binaryParameter (shape 2 5 1) u = B2_5_1Binary u := by + rw [shapes4_list] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel +def B2_5_1LittleRat (u : Shape) (w : Fin 3) (i : Fin 6) : ℚ := + if u w = 2 then + if i = 2 then 1 - B2_5_1Binary u else if i = 3 then B2_5_1Binary u else 0 + else if i = singletonSlot (u w) then 1 else 0 + +def B2_5_1Little (u : Shape) (w : Fin 3) (i : Fin 6) : Ball := + if u ∈ shapes 4 then .exact (B2_5_1LittleRat u w i) + else .exact (littleLaw (shape 2 5 1) u w i) + +lemma B2_5_1Little_sound (u : Shape) (w : Fin 3) (i : Fin 6) : + (B2_5_1Little u w i).Encloses (littleLaw (shape 2 5 1) u w i : ℝ) := by + by_cases hu : u ∈ shapes 4 + · simp only [B2_5_1Little, hu, ite_true] + apply exact_rat_enclosed + simp only [B2_5_1LittleRat, littleLaw, B2_5_1Binary_eq u hu] + · simp only [B2_5_1Little, hu, ite_false] + exact Ball.exact_sound _ +def B2_5_1Half (w : Fin 3) (ij : PairSlot) : Ball := + match w.val, ij.1.val, ij.2.val with + | 0, 0, 2 => ⟨(16500511368438802565759232435939 / 100000000000000000000000000000000), (7 / 25000000000000000000000000000000)⟩ + | 0, 0, 3 => ⟨(993526583999480062128659640117 / 50000000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ + | 0, 1, 1 => ⟨(31512435463562237309983448283827 / 50000000000000000000000000000000), (7 / 25000000000000000000000000000000)⟩ + | 0, 2, 0 => ⟨(16500511368438802565759232435939 / 100000000000000000000000000000000), (7 / 25000000000000000000000000000000)⟩ + | 0, 3, 0 => ⟨(993526583999480062128659640117 / 50000000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ + | 1, 4, 2 => ⟨(9444123177522509382296864374047 / 20000000000000000000000000000000), (39 / 100000000000000000000000000000000)⟩ + | 1, 4, 3 => ⟨(2070184148321972828859570473807 / 100000000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ + | 1, 5, 1 => ⟨(354599982032740129828053827979 / 50000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ + | 1, 2, 4 => ⟨(9444123177522509382296864374047 / 20000000000000000000000000000000), (39 / 100000000000000000000000000000000)⟩ + | 1, 3, 4 => ⟨(2070184148321972828859570473807 / 100000000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ + | 1, 1, 5 => ⟨(354599982032740129828053827979 / 50000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ + | 2, 1, 0 => ⟨(1 / 2), (9 / 20000000000000000000000000000000)⟩ + | 2, 0, 1 => ⟨(1 / 2), (9 / 20000000000000000000000000000000)⟩ + | _, _, _ => (.exact 0) +lemma B2_5_1Half_check_0_0 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 2 5 1)) (shape 2 5 1) B2_5_1Law + (fun u => B2_5_1Little u 0) ((0 : Fin 6),j)) (B2_5_1Half 0 (0,j)) = true := by + decide +kernel +lemma B2_5_1Half_check_0_1 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 2 5 1)) (shape 2 5 1) B2_5_1Law + (fun u => B2_5_1Little u 0) ((1 : Fin 6),j)) (B2_5_1Half 0 (1,j)) = true := by + decide +kernel +lemma B2_5_1Half_check_0_2 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 2 5 1)) (shape 2 5 1) B2_5_1Law + (fun u => B2_5_1Little u 0) ((2 : Fin 6),j)) (B2_5_1Half 0 (2,j)) = true := by + decide +kernel +lemma B2_5_1Half_check_0_3 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 2 5 1)) (shape 2 5 1) B2_5_1Law + (fun u => B2_5_1Little u 0) ((3 : Fin 6),j)) (B2_5_1Half 0 (3,j)) = true := by + decide +kernel +lemma B2_5_1Half_check_0_4 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 2 5 1)) (shape 2 5 1) B2_5_1Law + (fun u => B2_5_1Little u 0) ((4 : Fin 6),j)) (B2_5_1Half 0 (4,j)) = true := by + decide +kernel +lemma B2_5_1Half_check_0_5 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 2 5 1)) (shape 2 5 1) B2_5_1Law + (fun u => B2_5_1Little u 0) ((5 : Fin 6),j)) (B2_5_1Half 0 (5,j)) = true := by + decide +kernel +lemma B2_5_1Half_check_1_0 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 2 5 1)) (shape 2 5 1) B2_5_1Law + (fun u => B2_5_1Little u 1) ((0 : Fin 6),j)) (B2_5_1Half 1 (0,j)) = true := by + decide +kernel +lemma B2_5_1Half_check_1_1 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 2 5 1)) (shape 2 5 1) B2_5_1Law + (fun u => B2_5_1Little u 1) ((1 : Fin 6),j)) (B2_5_1Half 1 (1,j)) = true := by + decide +kernel +lemma B2_5_1Half_check_1_2 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 2 5 1)) (shape 2 5 1) B2_5_1Law + (fun u => B2_5_1Little u 1) ((2 : Fin 6),j)) (B2_5_1Half 1 (2,j)) = true := by + decide +kernel +lemma B2_5_1Half_check_1_3 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 2 5 1)) (shape 2 5 1) B2_5_1Law + (fun u => B2_5_1Little u 1) ((3 : Fin 6),j)) (B2_5_1Half 1 (3,j)) = true := by + decide +kernel +lemma B2_5_1Half_check_1_4 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 2 5 1)) (shape 2 5 1) B2_5_1Law + (fun u => B2_5_1Little u 1) ((4 : Fin 6),j)) (B2_5_1Half 1 (4,j)) = true := by + decide +kernel +lemma B2_5_1Half_check_1_5 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 2 5 1)) (shape 2 5 1) B2_5_1Law + (fun u => B2_5_1Little u 1) ((5 : Fin 6),j)) (B2_5_1Half 1 (5,j)) = true := by + decide +kernel +lemma B2_5_1Half_check_2_0 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 2 5 1)) (shape 2 5 1) B2_5_1Law + (fun u => B2_5_1Little u 2) ((0 : Fin 6),j)) (B2_5_1Half 2 (0,j)) = true := by + decide +kernel +lemma B2_5_1Half_check_2_1 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 2 5 1)) (shape 2 5 1) B2_5_1Law + (fun u => B2_5_1Little u 2) ((1 : Fin 6),j)) (B2_5_1Half 2 (1,j)) = true := by + decide +kernel +lemma B2_5_1Half_check_2_2 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 2 5 1)) (shape 2 5 1) B2_5_1Law + (fun u => B2_5_1Little u 2) ((2 : Fin 6),j)) (B2_5_1Half 2 (2,j)) = true := by + decide +kernel +lemma B2_5_1Half_check_2_3 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 2 5 1)) (shape 2 5 1) B2_5_1Law + (fun u => B2_5_1Little u 2) ((3 : Fin 6),j)) (B2_5_1Half 2 (3,j)) = true := by + decide +kernel +lemma B2_5_1Half_check_2_4 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 2 5 1)) (shape 2 5 1) B2_5_1Law + (fun u => B2_5_1Little u 2) ((4 : Fin 6),j)) (B2_5_1Half 2 (4,j)) = true := by + decide +kernel +lemma B2_5_1Half_check_2_5 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 2 5 1)) (shape 2 5 1) B2_5_1Law + (fun u => B2_5_1Little u 2) ((5 : Fin 6),j)) (B2_5_1Half 2 (5,j)) = true := by + decide +kernel +lemma B2_5_1Half_sound (w : Fin 3) (ij : PairSlot) : + (B2_5_1Half w ij).Encloses (halfLaw (shape 2 5 1) w ij : ℝ) := by + have hcheck : contains (pairLawBall (below (shape 2 5 1)) (shape 2 5 1) B2_5_1Law + (fun u => B2_5_1Little u w) ij) (B2_5_1Half w ij) = true := by + rcases ij with ⟨i,j⟩ + revert i w + apply forall_fin3 + · exact forall_fin6 (B2_5_1Half_check_0_0 j) (B2_5_1Half_check_0_1 j) (B2_5_1Half_check_0_2 j) (B2_5_1Half_check_0_3 j) (B2_5_1Half_check_0_4 j) (B2_5_1Half_check_0_5 j) + · exact forall_fin6 (B2_5_1Half_check_1_0 j) (B2_5_1Half_check_1_1 j) (B2_5_1Half_check_1_2 j) (B2_5_1Half_check_1_3 j) (B2_5_1Half_check_1_4 j) (B2_5_1Half_check_1_5 j) + · exact forall_fin6 (B2_5_1Half_check_2_0 j) (B2_5_1Half_check_2_1 j) (B2_5_1Half_check_2_2 j) (B2_5_1Half_check_2_3 j) (B2_5_1Half_check_2_4 j) (B2_5_1Half_check_2_5 j) + have h := contains_sound (pairLawBall_sound (below (shape 2 5 1)) (shape 2 5 1) + B2_5_1Law (fun u => (stageBLaw (shape 2 5 1) u : ℝ)) + (fun u => B2_5_1Little u w) (fun u i => (littleLaw (shape 2 5 1) u w i : ℝ)) + (fun u _ => B2_5_1Law_sound u) (fun u i => B2_5_1Little_sound u w i) ij) hcheck + have hp : positive (shape 2 5 1) = true := by decide +kernel + simpa only [halfLaw, hp, ite_true, pairLaw, positiveHalfLaw, Rat.cast_list_sum, + List.map_map, Function.comp_def, Rat.cast_mul] using h + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/Certificates/NativeInterior.lean b/lean/OAI/LinearAlgebra/MatrixFields/Certificates/NativeInterior.lean new file mode 100644 index 0000000000000000000000000000000000000000..bb79e368c4a0c62cd10581a08fa59e6311de1327 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/Certificates/NativeInterior.lean @@ -0,0 +1,1027 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Certificates.Four0_1_7 +import OAI.LinearAlgebra.MatrixFields.Certificates.Four0_5_3 +import OAI.LinearAlgebra.MatrixFields.Certificates.Four0_7_1 +import OAI.LinearAlgebra.MatrixFields.Certificates.Four0_8_0 +import OAI.LinearAlgebra.MatrixFields.Certificates.Four1_0_7 +import OAI.LinearAlgebra.MatrixFields.Certificates.Four1_7_0 +import OAI.LinearAlgebra.MatrixFields.Certificates.Four2_0_6 +import OAI.LinearAlgebra.MatrixFields.Certificates.Four2_6_0 +import OAI.LinearAlgebra.MatrixFields.Certificates.Four3_0_5 +import OAI.LinearAlgebra.MatrixFields.Certificates.Four3_5_0 +import OAI.LinearAlgebra.MatrixFields.Certificates.Four4_0_4 +import OAI.LinearAlgebra.MatrixFields.Certificates.Four4_4_0 +import OAI.LinearAlgebra.MatrixFields.Certificates.Four5_0_3 +import OAI.LinearAlgebra.MatrixFields.Certificates.Four5_3_0 +import OAI.LinearAlgebra.MatrixFields.Certificates.Four6_0_2 +import OAI.LinearAlgebra.MatrixFields.Certificates.Four6_2_0 +import OAI.LinearAlgebra.MatrixFields.Certificates.Four7_0_1 +import OAI.LinearAlgebra.MatrixFields.Certificates.Four7_1_0 +import OAI.LinearAlgebra.MatrixFields.Certificates.Four8_0_0 +import OAI.LinearAlgebra.MatrixFields.Certificates.Terminal1_2_5 +import OAI.LinearAlgebra.MatrixFields.Certificates.Terminal1_3_4 +import OAI.LinearAlgebra.MatrixFields.Certificates.Terminal1_4_3 +import OAI.LinearAlgebra.MatrixFields.Certificates.Terminal1_5_2 +import OAI.LinearAlgebra.MatrixFields.Certificates.Terminal1_6_1 +import OAI.LinearAlgebra.MatrixFields.Certificates.Terminal2_1_5 +import OAI.LinearAlgebra.MatrixFields.Certificates.Terminal2_2_4 +import OAI.LinearAlgebra.MatrixFields.Certificates.Terminal2_3_3 +import OAI.LinearAlgebra.MatrixFields.Certificates.Terminal2_4_2 +import OAI.LinearAlgebra.MatrixFields.Certificates.Terminal2_5_1 +import OAI.LinearAlgebra.MatrixFields.Certificates.Terminal3_1_4 +import OAI.LinearAlgebra.MatrixFields.Certificates.Terminal3_2_3 +import OAI.LinearAlgebra.MatrixFields.Certificates.Terminal3_3_2 +import OAI.LinearAlgebra.MatrixFields.Certificates.Terminal3_4_1 +import OAI.LinearAlgebra.MatrixFields.Certificates.Terminal4_1_3 +import OAI.LinearAlgebra.MatrixFields.Certificates.Terminal4_2_2 +import OAI.LinearAlgebra.MatrixFields.Certificates.Terminal4_3_1 +import OAI.LinearAlgebra.MatrixFields.Certificates.Terminal5_1_2 +import OAI.LinearAlgebra.MatrixFields.Certificates.Terminal5_2_1 + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate +open scoped BigOperators +lemma B6_1_1_below : below (shape 6 1 1) = [ + (shape 2 1 1), + (shape 3 0 1), + (shape 3 1 0), + (shape 4 0 0)] := by decide +kernel +def B6_1_1Raw (s : Shape) : Ball := + match s 0, s 1, s 2 with + | 2, 1, 1 => ⟨(19757482365589500963001701230393 / 20000000000000000000000000000000), (63 / 50000000000000000000000000000000)⟩ + | 3, 0, 1 => ⟨1, 0⟩ + | 3, 1, 0 => ⟨1, 0⟩ + | 4, 0, 0 => ⟨(19757482365589500963001701230393 / 20000000000000000000000000000000), (63 / 50000000000000000000000000000000)⟩ + | _, _, _ => (.exact 0) +lemma B6_1_1Raw_2_1_1 : (B6_1_1Raw (shape 2 1 1)).Encloses (splitWeight positiveSecond tablep (shape 6 1 1) (shape 2 1 1) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveSecond tablep (shape 6 1 1) (shape 2 1 1) + (-122) (0) (0) w193 w195 w195 + (by decide +kernel) w193_sound w195_sound w195_sound) (by decide +kernel) +lemma B6_1_1Raw_3_0_1 : (B6_1_1Raw (shape 3 0 1)).Encloses (splitWeight positiveSecond tablep (shape 6 1 1) (shape 3 0 1) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveSecond tablep (shape 6 1 1) (shape 3 0 1) + (0) (0) (0) w195 w195 w195 + (by decide +kernel) w195_sound w195_sound w195_sound) (by decide +kernel) +lemma B6_1_1Raw_3_1_0 : (B6_1_1Raw (shape 3 1 0)).Encloses (splitWeight positiveSecond tablep (shape 6 1 1) (shape 3 1 0) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveSecond tablep (shape 6 1 1) (shape 3 1 0) + (0) (0) (0) w195 w195 w195 + (by decide +kernel) w195_sound w195_sound w195_sound) (by decide +kernel) +lemma B6_1_1Raw_4_0_0 : (B6_1_1Raw (shape 4 0 0)).Encloses (splitWeight positiveSecond tablep (shape 6 1 1) (shape 4 0 0) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveSecond tablep (shape 6 1 1) (shape 4 0 0) + (-122) (0) (0) w193 w195 w195 + (by decide +kernel) w193_sound w195_sound w195_sound) (by decide +kernel) +lemma B6_1_1Raw_sound (u : Shape) (hu : u ∈ below (shape 6 1 1)) : + (B6_1_1Raw u).Encloses (splitWeight positiveSecond tablep (shape 6 1 1) u : ℝ) := by + rw [B6_1_1_below] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl + · exact B6_1_1Raw_2_1_1 + · exact B6_1_1Raw_3_0_1 + · exact B6_1_1Raw_3_1_0 + · exact B6_1_1Raw_4_0_0 +def B6_1_1Den : Ball := ⟨(39757482365589500963001701230393 / 10000000000000000000000000000000), (63 / 25000000000000000000000000000000)⟩ +lemma B6_1_1Den_sound : B6_1_1Den.Encloses (((below (shape 6 1 1)).map (splitWeight positiveSecond tablep (shape 6 1 1))).sum : ℝ) := by + exact contains_sound (list_cast_enclosed (below (shape 6 1 1)) B6_1_1Raw (splitWeight positiveSecond tablep (shape 6 1 1)) B6_1_1Raw_sound) (by decide +kernel) +lemma B6_1_1Den_positive : 0 < B6_1_1Den.lower := by decide +kernel +def B6_1_1Table (s : Shape) : Ball := + match s 0, s 1, s 2 with + | 2, 1, 1 => ⟨(124237509457400902736572326499 / 500000000000000000000000000000), (3 / 6250000000000000000000000000000)⟩ + | 3, 0, 1 => ⟨(125762490542599097263427673501 / 500000000000000000000000000000), (17 / 100000000000000000000000000000000)⟩ + | 3, 1, 0 => ⟨(125762490542599097263427673501 / 500000000000000000000000000000), (17 / 100000000000000000000000000000000)⟩ + | 4, 0, 0 => ⟨(124237509457400902736572326499 / 500000000000000000000000000000), (3 / 6250000000000000000000000000000)⟩ + | _, _, _ => (.exact 0) +def B6_1_1Law (u : Shape) : Ball := if u ∈ below (shape 6 1 1) then B6_1_1Table u else .exact 0 +lemma B6_1_1Law_check_2_1_1 : contains (.mul (B6_1_1Raw (shape 2 1 1)) (.inv B6_1_1Den)) (B6_1_1Table (shape 2 1 1)) = true := by decide +kernel +lemma B6_1_1Law_check_3_0_1 : contains (.mul (B6_1_1Raw (shape 3 0 1)) (.inv B6_1_1Den)) (B6_1_1Table (shape 3 0 1)) = true := by decide +kernel +lemma B6_1_1Law_check_3_1_0 : contains (.mul (B6_1_1Raw (shape 3 1 0)) (.inv B6_1_1Den)) (B6_1_1Table (shape 3 1 0)) = true := by decide +kernel +lemma B6_1_1Law_check_4_0_0 : contains (.mul (B6_1_1Raw (shape 4 0 0)) (.inv B6_1_1Den)) (B6_1_1Table (shape 4 0 0)) = true := by decide +kernel +lemma B6_1_1Law_check (u : Shape) (hu : u ∈ below (shape 6 1 1)) : + contains (.mul (B6_1_1Raw u) (.inv B6_1_1Den)) (B6_1_1Table u) = true := by + rw [B6_1_1_below] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl + · exact B6_1_1Law_check_2_1_1 + · exact B6_1_1Law_check_3_0_1 + · exact B6_1_1Law_check_3_1_0 + · exact B6_1_1Law_check_4_0_0 +lemma B6_1_1Law_sound (u : Shape) : + (B6_1_1Law u).Encloses (stageBLaw (shape 6 1 1) u : ℝ) := by + by_cases hu : u ∈ below (shape 6 1 1) + · have h := contains_sound (Ball.mul_sound (B6_1_1Raw_sound u hu) + (Ball.inv_sound B6_1_1Den_sound B6_1_1Den_positive)) (B6_1_1Law_check u hu) + simpa only [B6_1_1Law, hu, ite_true, stageBLaw, splitLaw, + Rat.cast_div, Rat.cast_mul, Rat.cast_inv, div_eq_mul_inv] using h + · simp only [B6_1_1Law, hu, ite_false, stageBLaw, splitLaw, Rat.cast_zero] + simpa only [Rat.cast_zero] using Ball.exact_sound 0 + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def B6_1_1Binary (u : Shape) : ℚ := + match u 0, u 1, u 2 with + | 2, 1, 1 => (60257 / 1000000) + | _, _, _ => 0 +lemma B6_1_1Binary_eq (u : Shape) (hu : u ∈ shapes 4) : + binaryParameter (shape 6 1 1) u = B6_1_1Binary u := by + rw [shapes4_list] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel +def B6_1_1LittleRat (u : Shape) (w : Fin 3) (i : Fin 6) : ℚ := + if u w = 2 then + if i = 2 then 1 - B6_1_1Binary u else if i = 3 then B6_1_1Binary u else 0 + else if i = singletonSlot (u w) then 1 else 0 + +def B6_1_1Little (u : Shape) (w : Fin 3) (i : Fin 6) : Ball := + if u ∈ shapes 4 then .exact (B6_1_1LittleRat u w i) + else .exact (littleLaw (shape 6 1 1) u w i) + +lemma B6_1_1Little_sound (u : Shape) (w : Fin 3) (i : Fin 6) : + (B6_1_1Little u w i).Encloses (littleLaw (shape 6 1 1) u w i : ℝ) := by + by_cases hu : u ∈ shapes 4 + · simp only [B6_1_1Little, hu, ite_true] + apply exact_rat_enclosed + simp only [B6_1_1LittleRat, littleLaw, B6_1_1Binary_eq u hu] + · simp only [B6_1_1Little, hu, ite_false] + exact Ball.exact_sound _ +def B6_1_1Half (w : Fin 3) (ij : PairSlot) : Ball := + match w.val, ij.1.val, ij.2.val with + | 0, 2, 5 => ⟨(2335026597000525930807493756423 / 10000000000000000000000000000000), (23 / 50000000000000000000000000000000)⟩ + | 0, 3, 5 => ⟨(149723592147492123923952773557 / 10000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ + | 0, 4, 4 => ⟨(125762490542599097263427673501 / 250000000000000000000000000000), (17 / 50000000000000000000000000000000)⟩ + | 0, 5, 2 => ⟨(2335026597000525930807493756423 / 10000000000000000000000000000000), (23 / 50000000000000000000000000000000)⟩ + | 0, 5, 3 => ⟨(149723592147492123923952773557 / 10000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ + | 1, 1, 0 => ⟨(1 / 2), (13 / 20000000000000000000000000000000)⟩ + | 1, 0, 1 => ⟨(1 / 2), (13 / 20000000000000000000000000000000)⟩ + | 2, 1, 0 => ⟨(1 / 2), (13 / 20000000000000000000000000000000)⟩ + | 2, 0, 1 => ⟨(1 / 2), (13 / 20000000000000000000000000000000)⟩ + | _, _, _ => (.exact 0) +lemma B6_1_1Half_check_0_0 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 6 1 1)) (shape 6 1 1) B6_1_1Law + (fun u => B6_1_1Little u 0) ((0 : Fin 6),j)) (B6_1_1Half 0 (0,j)) = true := by + decide +kernel +lemma B6_1_1Half_check_0_1 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 6 1 1)) (shape 6 1 1) B6_1_1Law + (fun u => B6_1_1Little u 0) ((1 : Fin 6),j)) (B6_1_1Half 0 (1,j)) = true := by + decide +kernel +lemma B6_1_1Half_check_0_2 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 6 1 1)) (shape 6 1 1) B6_1_1Law + (fun u => B6_1_1Little u 0) ((2 : Fin 6),j)) (B6_1_1Half 0 (2,j)) = true := by + decide +kernel +lemma B6_1_1Half_check_0_3 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 6 1 1)) (shape 6 1 1) B6_1_1Law + (fun u => B6_1_1Little u 0) ((3 : Fin 6),j)) (B6_1_1Half 0 (3,j)) = true := by + decide +kernel +lemma B6_1_1Half_check_0_4 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 6 1 1)) (shape 6 1 1) B6_1_1Law + (fun u => B6_1_1Little u 0) ((4 : Fin 6),j)) (B6_1_1Half 0 (4,j)) = true := by + decide +kernel +lemma B6_1_1Half_check_0_5 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 6 1 1)) (shape 6 1 1) B6_1_1Law + (fun u => B6_1_1Little u 0) ((5 : Fin 6),j)) (B6_1_1Half 0 (5,j)) = true := by + decide +kernel +lemma B6_1_1Half_check_1_0 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 6 1 1)) (shape 6 1 1) B6_1_1Law + (fun u => B6_1_1Little u 1) ((0 : Fin 6),j)) (B6_1_1Half 1 (0,j)) = true := by + decide +kernel +lemma B6_1_1Half_check_1_1 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 6 1 1)) (shape 6 1 1) B6_1_1Law + (fun u => B6_1_1Little u 1) ((1 : Fin 6),j)) (B6_1_1Half 1 (1,j)) = true := by + decide +kernel +lemma B6_1_1Half_check_1_2 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 6 1 1)) (shape 6 1 1) B6_1_1Law + (fun u => B6_1_1Little u 1) ((2 : Fin 6),j)) (B6_1_1Half 1 (2,j)) = true := by + decide +kernel +lemma B6_1_1Half_check_1_3 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 6 1 1)) (shape 6 1 1) B6_1_1Law + (fun u => B6_1_1Little u 1) ((3 : Fin 6),j)) (B6_1_1Half 1 (3,j)) = true := by + decide +kernel +lemma B6_1_1Half_check_1_4 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 6 1 1)) (shape 6 1 1) B6_1_1Law + (fun u => B6_1_1Little u 1) ((4 : Fin 6),j)) (B6_1_1Half 1 (4,j)) = true := by + decide +kernel +lemma B6_1_1Half_check_1_5 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 6 1 1)) (shape 6 1 1) B6_1_1Law + (fun u => B6_1_1Little u 1) ((5 : Fin 6),j)) (B6_1_1Half 1 (5,j)) = true := by + decide +kernel +lemma B6_1_1Half_check_2_0 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 6 1 1)) (shape 6 1 1) B6_1_1Law + (fun u => B6_1_1Little u 2) ((0 : Fin 6),j)) (B6_1_1Half 2 (0,j)) = true := by + decide +kernel +lemma B6_1_1Half_check_2_1 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 6 1 1)) (shape 6 1 1) B6_1_1Law + (fun u => B6_1_1Little u 2) ((1 : Fin 6),j)) (B6_1_1Half 2 (1,j)) = true := by + decide +kernel +lemma B6_1_1Half_check_2_2 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 6 1 1)) (shape 6 1 1) B6_1_1Law + (fun u => B6_1_1Little u 2) ((2 : Fin 6),j)) (B6_1_1Half 2 (2,j)) = true := by + decide +kernel +lemma B6_1_1Half_check_2_3 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 6 1 1)) (shape 6 1 1) B6_1_1Law + (fun u => B6_1_1Little u 2) ((3 : Fin 6),j)) (B6_1_1Half 2 (3,j)) = true := by + decide +kernel +lemma B6_1_1Half_check_2_4 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 6 1 1)) (shape 6 1 1) B6_1_1Law + (fun u => B6_1_1Little u 2) ((4 : Fin 6),j)) (B6_1_1Half 2 (4,j)) = true := by + decide +kernel +lemma B6_1_1Half_check_2_5 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 6 1 1)) (shape 6 1 1) B6_1_1Law + (fun u => B6_1_1Little u 2) ((5 : Fin 6),j)) (B6_1_1Half 2 (5,j)) = true := by + decide +kernel +lemma B6_1_1Half_sound (w : Fin 3) (ij : PairSlot) : + (B6_1_1Half w ij).Encloses (halfLaw (shape 6 1 1) w ij : ℝ) := by + have hcheck : contains (pairLawBall (below (shape 6 1 1)) (shape 6 1 1) B6_1_1Law + (fun u => B6_1_1Little u w) ij) (B6_1_1Half w ij) = true := by + rcases ij with ⟨i,j⟩ + revert i w + apply forall_fin3 + · exact forall_fin6 (B6_1_1Half_check_0_0 j) (B6_1_1Half_check_0_1 j) (B6_1_1Half_check_0_2 j) (B6_1_1Half_check_0_3 j) (B6_1_1Half_check_0_4 j) (B6_1_1Half_check_0_5 j) + · exact forall_fin6 (B6_1_1Half_check_1_0 j) (B6_1_1Half_check_1_1 j) (B6_1_1Half_check_1_2 j) (B6_1_1Half_check_1_3 j) (B6_1_1Half_check_1_4 j) (B6_1_1Half_check_1_5 j) + · exact forall_fin6 (B6_1_1Half_check_2_0 j) (B6_1_1Half_check_2_1 j) (B6_1_1Half_check_2_2 j) (B6_1_1Half_check_2_3 j) (B6_1_1Half_check_2_4 j) (B6_1_1Half_check_2_5 j) + have h := contains_sound (pairLawBall_sound (below (shape 6 1 1)) (shape 6 1 1) + B6_1_1Law (fun u => (stageBLaw (shape 6 1 1) u : ℝ)) + (fun u => B6_1_1Little u w) (fun u i => (littleLaw (shape 6 1 1) u w i : ℝ)) + (fun u _ => B6_1_1Law_sound u) (fun u i => B6_1_1Little_sound u w i) ij) hcheck + have hp : positive (shape 6 1 1) = true := by decide +kernel + simpa only [halfLaw, hp, ite_true, pairLaw, positiveHalfLaw, Rat.cast_list_sum, + List.map_map, Function.comp_def, Rat.cast_mul] using h + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def B6_1_1U2_1_1D : Ball := .exact (60257 / 1000000) +lemma B6_1_1U2_1_1D_sound : B6_1_1U2_1_1D.Encloses (binaryParameter (shape 6 1 1) (shape 2 1 1) : ℝ) := by + apply exact_rat_enclosed + decide +kernel +def B6_1_1U2_1_1OneD : Ball := .exact (939743 / 1000000) +lemma B6_1_1U2_1_1OneD_sound : B6_1_1U2_1_1OneD.Encloses (1 - (binaryParameter (shape 6 1 1) (shape 2 1 1) : ℝ)) := by + have he : binaryParameter (shape 6 1 1) (shape 2 1 1) = (60257 / 1000000) := by decide +kernel + rw [he] + convert Ball.exact_sound ((939743 / 1000000) : ℚ) using 1 <;> norm_num [B6_1_1U2_1_1OneD, Ball.exact] +def B6_1_1U2_1_1EDLogWitness : LogWitness := ⟨-5, 60257, 31250⟩ +def B6_1_1U2_1_1EDLog : Ball := ⟨(-70228413269685773586736117896293 / 25000000000000000000000000000000), (63527471049 / 50000000000000000000000000000000)⟩ +lemma B6_1_1U2_1_1EDLog_sound : B6_1_1U2_1_1EDLog.Encloses (Real.log ((binaryParameter (shape 6 1 1) (shape 2 1 1) : ℝ))) := by + exact checkLog_sound logTwoBall_sound (B6_1_1U2_1_1D_sound) (w := B6_1_1U2_1_1EDLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def B6_1_1U2_1_1ED : Ball := ⟨(4231753498391455659015958256077 / 25000000000000000000000000000000), (7655949647 / 100000000000000000000000000000000)⟩ +lemma B6_1_1U2_1_1ED_sound : B6_1_1U2_1_1ED.Encloses (Foundation.entropyTerm ((binaryParameter (shape 6 1 1) (shape 2 1 1) : ℝ))) := by + exact contains_sound (entropyTerm_ball (B6_1_1U2_1_1D_sound) B6_1_1U2_1_1EDLog_sound) (by decide +kernel) +def B6_1_1U2_1_1EOneDLogWitness : LogWitness := ⟨-1, 939743, 500000⟩ +def B6_1_1U2_1_1EOneDLog : Ball := ⟨(-124297690710327487232327528573 / 2000000000000000000000000000000), (21175823683 / 50000000000000000000000000000000)⟩ +lemma B6_1_1U2_1_1EOneDLog_sound : B6_1_1U2_1_1EOneDLog.Encloses (Real.log ((1 - (binaryParameter (shape 6 1 1) (shape 2 1 1) : ℝ)))) := by + exact checkLog_sound logTwoBall_sound (B6_1_1U2_1_1OneD_sound) (w := B6_1_1U2_1_1EOneDLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def B6_1_1U2_1_1EOneD : Ball := ⟨(5840394238059764191708458434189 / 100000000000000000000000000000000), (39799664151 / 100000000000000000000000000000000)⟩ +lemma B6_1_1U2_1_1EOneD_sound : B6_1_1U2_1_1EOneD.Encloses (Foundation.entropyTerm ((1 - (binaryParameter (shape 6 1 1) (shape 2 1 1) : ℝ)))) := by + exact contains_sound (entropyTerm_ball (B6_1_1U2_1_1OneD_sound) B6_1_1U2_1_1EOneDLog_sound) (by decide +kernel) +def B6_1_1U2_1_1BinaryEntropy : Ball := ⟨(26944105197525649278727705902131 / 100000000000000000000000000000000), (25003798507 / 50000000000000000000000000000000)⟩ +lemma B6_1_1U2_1_1BinaryEntropy_sound : B6_1_1U2_1_1BinaryEntropy.Encloses + (binaryEntropyRate (binaryParameter (shape 6 1 1) (shape 2 1 1))) := by + exact contains_sound (Ball.add_sound (Ball.add_sound B6_1_1U2_1_1EOneD_sound B6_1_1U2_1_1ED_sound) + (Ball.mul_sound B6_1_1U2_1_1D_sound logN2_sound)) (by decide +kernel) +def B6_1_1U2_1_1Leaf : Ball := ⟨(312189592457865916292919997050341 / 100000000000000000000000000000000), (30806741819 / 25000000000000000000000000000000)⟩ +lemma B6_1_1U2_1_1Leaf_sound : B6_1_1U2_1_1Leaf.Encloses (AllFieldTerminalRates.secondLeafRate (shape 6 1 1) (shape 2 1 1)) := by + have hh : shapeMax (shape 2 1 1) = 2 := by decide +kernel + have hp : positive (shape 2 1 1) = true := by decide +kernel + simp only [AllFieldTerminalRates.secondLeafRate, hh, hp, Bool.not_true, Bool.false_eq_true, + show (2 : ℕ) ≠ 4 by decide, show (2 : ℕ) ≠ 3 by decide, ite_false] + have ht : (Ball.exact (1939743 / 1000000)).Encloses (2 - (binaryParameter (shape 6 1 1) (shape 2 1 1) : ℝ)) := by + have he : binaryParameter (shape 6 1 1) (shape 2 1 1) = (60257 / 1000000) := by decide +kernel + rw [he] + convert Ball.exact_sound ((1939743 / 1000000) : ℚ) using 1 + norm_num [Ball.exact] + exact contains_sound (Ball.mul_sound ht logN5_sound) (by decide +kernel) +def B6_1_1U2_1_1Mass : Ball := ⟨0, 0⟩ +lemma B6_1_1U2_1_1Mass_sound : B6_1_1U2_1_1Mass.Encloses (littleMass (shape 6 1 1) (shape 2 1 1) : ℝ) := by + rw [littleMass_cast] + exact contains_sound (Ball.mul_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) (second_6_1_1)) + (B6_1_1Law_sound (shape 2 1 1))) (by decide +kernel) +def B6_1_1U3_0_1Leaf : Ball := ⟨(115129254649702284200899544090987 / 50000000000000000000000000000000), (21175823683 / 25000000000000000000000000000000)⟩ +lemma B6_1_1U3_0_1Leaf_sound : B6_1_1U3_0_1Leaf.Encloses (AllFieldTerminalRates.secondLeafRate (shape 6 1 1) (shape 3 0 1)) := by + have hh : shapeMax (shape 3 0 1) = 3 := by decide +kernel + simp only [AllFieldTerminalRates.secondLeafRate, hh, show (3 : ℕ) ≠ 4 by decide, ite_false, ite_true] + exact logN10_sound +def B6_1_1U3_0_1Mass : Ball := ⟨0, 0⟩ +lemma B6_1_1U3_0_1Mass_sound : B6_1_1U3_0_1Mass.Encloses (littleMass (shape 6 1 1) (shape 3 0 1) : ℝ) := by + rw [littleMass_cast] + exact contains_sound (Ball.mul_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) (second_6_1_1)) + (B6_1_1Law_sound (shape 3 0 1))) (by decide +kernel) +def B6_1_1U3_1_0Leaf : Ball := ⟨(115129254649702284200899544090987 / 50000000000000000000000000000000), (21175823683 / 25000000000000000000000000000000)⟩ +lemma B6_1_1U3_1_0Leaf_sound : B6_1_1U3_1_0Leaf.Encloses (AllFieldTerminalRates.secondLeafRate (shape 6 1 1) (shape 3 1 0)) := by + have hh : shapeMax (shape 3 1 0) = 3 := by decide +kernel + simp only [AllFieldTerminalRates.secondLeafRate, hh, show (3 : ℕ) ≠ 4 by decide, ite_false, ite_true] + exact logN10_sound +def B6_1_1U3_1_0Mass : Ball := ⟨0, 0⟩ +lemma B6_1_1U3_1_0Mass_sound : B6_1_1U3_1_0Mass.Encloses (littleMass (shape 6 1 1) (shape 3 1 0) : ℝ) := by + rw [littleMass_cast] + exact contains_sound (Ball.mul_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) (second_6_1_1)) + (B6_1_1Law_sound (shape 3 1 0))) (by decide +kernel) +def B6_1_1U4_0_0Leaf : Ball := ⟨0, 0⟩ +lemma B6_1_1U4_0_0Leaf_sound : B6_1_1U4_0_0Leaf.Encloses (AllFieldTerminalRates.secondLeafRate (shape 6 1 1) (shape 4 0 0)) := by + have hh : shapeMax (shape 4 0 0) = 4 := by decide +kernel + simp only [AllFieldTerminalRates.secondLeafRate, hh, ite_true] + simpa only [B6_1_1U4_0_0Leaf, Ball.exact, Rat.cast_zero] using Ball.exact_sound 0 +def B6_1_1U4_0_0Mass : Ball := ⟨0, 0⟩ +lemma B6_1_1U4_0_0Mass_sound : B6_1_1U4_0_0Mass.Encloses (littleMass (shape 6 1 1) (shape 4 0 0) : ℝ) := by + rw [littleMass_cast] + exact contains_sound (Ball.mul_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) (second_6_1_1)) + (B6_1_1Law_sound (shape 4 0 0))) (by decide +kernel) +def B6_1_1Leaves (s : Shape) : Ball := + match s 0, s 1, s 2 with + | 2, 1, 1 => B6_1_1U2_1_1Leaf + | 3, 0, 1 => B6_1_1U3_0_1Leaf + | 3, 1, 0 => B6_1_1U3_1_0Leaf + | 4, 0, 0 => B6_1_1U4_0_0Leaf + | _, _, _ => (.exact 0) +lemma B6_1_1Leaves_sound (u : Shape) (hu : u ∈ below (shape 6 1 1)) : + (B6_1_1Leaves u).Encloses (AllFieldTerminalRates.secondLeafRate (shape 6 1 1) u) := by + rw [B6_1_1_below] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl + · exact B6_1_1U2_1_1Leaf_sound + · exact B6_1_1U3_0_1Leaf_sound + · exact B6_1_1U3_1_0Leaf_sound + · exact B6_1_1U4_0_0Leaf_sound +def B6_1_1Masses (s : Shape) : Ball := + match s 0, s 1, s 2 with + | 2, 1, 1 => B6_1_1U2_1_1Mass + | 3, 0, 1 => B6_1_1U3_0_1Mass + | 3, 1, 0 => B6_1_1U3_1_0Mass + | 4, 0, 0 => B6_1_1U4_0_0Mass + | _, _, _ => (.exact 0) +lemma B6_1_1Masses_sound (u : Shape) (hu : u ∈ below (shape 6 1 1)) : + (B6_1_1Masses u).Encloses ((fun u => (littleMass (shape 6 1 1) u : ℝ)) u) := by + rw [B6_1_1_below] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl + · exact B6_1_1U2_1_1Mass_sound + · exact B6_1_1U3_0_1Mass_sound + · exact B6_1_1U3_1_0Mass_sound + · exact B6_1_1U4_0_0Mass_sound +def B6_1_1Binaries (s : Shape) : Ball := + match s 0, s 1, s 2 with + | 2, 1, 1 => B6_1_1U2_1_1BinaryEntropy + | _, _, _ => (.exact 0) +lemma B6_1_1Binaries_sound (u : Shape) (hu : u ∈ (below (shape 6 1 1)).filter positive) : + (B6_1_1Binaries u).Encloses ((fun u => binaryEntropyRate (binaryParameter (shape 6 1 1) u)) u) := by + have hl : (below (shape 6 1 1)).filter positive = [(shape 2 1 1)] := by decide +kernel + rw [hl] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl + · exact B6_1_1U2_1_1BinaryEntropy_sound +def B6_1_1S2 : Ball := ⟨0, 0⟩ +lemma B6_1_1S2_sound : B6_1_1S2.Encloses + (((below (shape 6 1 1)).map fun u => (littleMass (shape 6 1 1) u : ℝ) * AllFieldTerminalRates.secondLeafRate (shape 6 1 1) u).sum) := by + exact contains_sound (listSumBall_sound (below (shape 6 1 1)) + (fun u => .mul (B6_1_1Masses u) (B6_1_1Leaves u)) _ + (fun u hu => Ball.mul_sound (B6_1_1Masses_sound u hu) (B6_1_1Leaves_sound u hu))) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +open AllFieldTerminalRates AllFieldVolumeCertificate +def fourRateBalls (s : Shape) : Ball := + match s 0, s 1, s 2 with + | 0, 0, 8 => Z0_0_8Four + | 0, 1, 7 => Z0_1_7Four + | 0, 2, 6 => Z0_2_6Four + | 0, 3, 5 => Z0_3_5Four + | 0, 4, 4 => Z0_4_4Four + | 0, 5, 3 => Z0_5_3Four + | 0, 6, 2 => Z0_6_2Four + | 0, 7, 1 => Z0_7_1Four + | 0, 8, 0 => Z0_8_0Four + | 1, 0, 7 => Z1_0_7Four + | 1, 7, 0 => Z1_7_0Four + | 2, 0, 6 => Z2_0_6Four + | 2, 6, 0 => Z2_6_0Four + | 3, 0, 5 => Z3_0_5Four + | 3, 5, 0 => Z3_5_0Four + | 4, 0, 4 => Z4_0_4Four + | 4, 4, 0 => Z4_4_0Four + | 5, 0, 3 => Z5_0_3Four + | 5, 3, 0 => Z5_3_0Four + | 6, 0, 2 => Z6_0_2Four + | 6, 2, 0 => Z6_2_0Four + | 7, 0, 1 => Z7_0_1Four + | 7, 1, 0 => Z7_1_0Four + | 8, 0, 0 => Z8_0_0Four + | _, _, _ => (.exact 0) +lemma fourRateBalls_sound (t : Shape) (ht : t ∈ zeroSecond) : + (fourRateBalls t).Encloses (AllFieldZeroLeafRates.fourRate t) := by + rw [zeroSecond_list] at ht + simp only [List.mem_cons, List.not_mem_nil, or_false] at ht + rcases ht with rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl + · exact Z0_0_8Four_sound + · exact Z0_1_7Four_sound + · exact Z0_2_6Four_sound + · exact Z0_3_5Four_sound + · exact Z0_4_4Four_sound + · exact Z0_5_3Four_sound + · exact Z0_6_2Four_sound + · exact Z0_7_1Four_sound + · exact Z0_8_0Four_sound + · exact Z1_0_7Four_sound + · exact Z1_7_0Four_sound + · exact Z2_0_6Four_sound + · exact Z2_6_0Four_sound + · exact Z3_0_5Four_sound + · exact Z3_5_0Four_sound + · exact Z4_0_4Four_sound + · exact Z4_4_0Four_sound + · exact Z5_0_3Four_sound + · exact Z5_3_0Four_sound + · exact Z6_0_2Four_sound + · exact Z6_2_0Four_sound + · exact Z7_0_1Four_sound + · exact Z7_1_0Four_sound + · exact Z8_0_0Four_sound +def nativeS1Ball : Ball := ⟨(88236223598149624413852945550479 / 100000000000000000000000000000000), (32131158713 / 100000000000000000000000000000000)⟩ +lemma nativeS1Ball_sound : nativeS1Ball.Encloses S1 := by + exact contains_sound (listSumBall_sound zeroSecond + (fun t => .mul (secondProbs t) (fourRateBalls t)) _ + (fun t ht => Ball.mul_sound (secondProbs_sound t (List.mem_filter.mp ht).1) + (fourRateBalls_sound t ht))) (by decide +kernel) +def s2ParentBalls (s : Shape) : Ball := + match s 0, s 1, s 2 with + | 1, 1, 6 => B1_1_6S2 + | 1, 2, 5 => B1_2_5S2 + | 1, 3, 4 => B1_3_4S2 + | 1, 4, 3 => B1_4_3S2 + | 1, 5, 2 => B1_5_2S2 + | 1, 6, 1 => B1_6_1S2 + | 2, 1, 5 => B2_1_5S2 + | 2, 2, 4 => B2_2_4S2 + | 2, 3, 3 => B2_3_3S2 + | 2, 4, 2 => B2_4_2S2 + | 2, 5, 1 => B2_5_1S2 + | 3, 1, 4 => B3_1_4S2 + | 3, 2, 3 => B3_2_3S2 + | 3, 3, 2 => B3_3_2S2 + | 3, 4, 1 => B3_4_1S2 + | 4, 1, 3 => B4_1_3S2 + | 4, 2, 2 => B4_2_2S2 + | 4, 3, 1 => B4_3_1S2 + | 5, 1, 2 => B5_1_2S2 + | 5, 2, 1 => B5_2_1S2 + | 6, 1, 1 => B6_1_1S2 + | _, _, _ => (.exact 0) +lemma s2ParentBalls_sound (t : Shape) (ht : t ∈ positiveSecond) : + (s2ParentBalls t).Encloses (((below t).map fun u => + (littleMass t u : ℝ) * secondLeafRate t u).sum) := by + rw [positiveSecond_list] at ht + simp only [List.mem_cons, List.not_mem_nil, or_false] at ht + rcases ht with rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl + · exact B1_1_6S2_sound + · exact B1_2_5S2_sound + · exact B1_3_4S2_sound + · exact B1_4_3S2_sound + · exact B1_5_2S2_sound + · exact B1_6_1S2_sound + · exact B2_1_5S2_sound + · exact B2_2_4S2_sound + · exact B2_3_3S2_sound + · exact B2_4_2S2_sound + · exact B2_5_1S2_sound + · exact B3_1_4S2_sound + · exact B3_2_3S2_sound + · exact B3_3_2S2_sound + · exact B3_4_1S2_sound + · exact B4_1_3S2_sound + · exact B4_2_2S2_sound + · exact B4_3_1S2_sound + · exact B5_1_2S2_sound + · exact B5_2_1S2_sound + · exact B6_1_1S2_sound +def nativeS2Ball : Ball := ⟨(233614080284104308981345775925091 / 20000000000000000000000000000000), (7783352389 / 1562500000000000000000000000000)⟩ +lemma nativeS2Ball_sound : nativeS2Ball.Encloses S2 := by + exact contains_sound (listSumBall_sound positiveSecond s2ParentBalls _ + s2ParentBalls_sound) (by decide +kernel) +def nativeSBall : Ball := ⟨(1259477032159467636236050651212461 / 100000000000000000000000000000000), (531265093341 / 100000000000000000000000000000000)⟩ +lemma nativeSBall_sound : nativeSBall.Encloses S := by + exact contains_sound (Ball.add_sound (Ball.add_sound nativeS0_enclosed + nativeS1Ball_sound) nativeS2Ball_sound) (by decide +kernel) + +theorem native_volume_positive : 0 < S := by + have hl := (Ball.bounds nativeSBall_sound).1 + have hp : (0 : ℝ) < nativeSBall.lower := by norm_num [nativeSBall, Ball.lower] + exact hp.trans_le hl + +theorem nativeS1_strict_bounds : + (882362235981496244 : ℝ)/10^18 < S1 ∧ S1 < (882362235981496245 : ℝ)/10^18 := by + have hb := Ball.bounds nativeS1Ball_sound + norm_num [nativeS1Ball, Ball.lower, Ball.upper] at hb ⊢ + constructor <;> linarith +theorem nativeS2_strict_bounds : + (11680704014205215449 : ℝ)/10^18 < S2 ∧ S2 < (11680704014205215450 : ℝ)/10^18 := by + have hb := Ball.bounds nativeS2Ball_sound + norm_num [nativeS2Ball, Ball.lower, Ball.upper] at hb ⊢ + constructor <;> linarith + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +lemma interior_fold (f : Shape × Shape → ℝ) : + (interiorPairs.map f).sum = (positiveSecond.map (fun t => + (((below t).filter positive).map (fun u => f (t,u))).sum)).sum := by + have h (xs : List Shape) : + ((xs.flatMap (fun t => ((below t).filter positive).map (fun u => (t,u)))).map f).sum = + (xs.map (fun t => (((below t).filter positive).map (fun u => f (t,u))).sum)).sum := by + induction xs with + | nil => simp + | cons t xs ih => simp only [List.flatMap_cons, List.map_append, List.sum_append, + List.map_map, Function.comp_def, List.map_cons, List.sum_cons, ih] + exact h positiveSecond +def B1_1_6Ttotal : Ball := ⟨(3710278844513467307488141523 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ +lemma B1_1_6Ttotal_sound : B1_1_6Ttotal.Encloses + ((((below (shape 1 1 6)).filter positive).map (fun u => (littleMass (shape 1 1 6) u : ℝ))).sum) := by + exact contains_sound (listSumBall_sound ((below (shape 1 1 6)).filter positive) + B1_1_6Masses _ (fun u hu => B1_1_6Masses_sound u (List.mem_filter.mp hu).1)) (by decide +kernel) +def B1_1_6Btotal : Ball := ⟨(10292390592644662403454216507 / 100000000000000000000000000000000), (1178709 / 12500000000000000000000000000000)⟩ +lemma B1_1_6Btotal_sound : B1_1_6Btotal.Encloses + ((((below (shape 1 1 6)).filter positive).map (fun u => (littleMass (shape 1 1 6) u : ℝ) * (2 * Real.log 2 + binaryEntropyRate (binaryParameter (shape 1 1 6) u)))).sum) := by + exact contains_sound (listSumBall_sound ((below (shape 1 1 6)).filter positive) + (fun u => .mul (B1_1_6Masses u) (.add (.mul (.exact 2) logN2) (B1_1_6Binaries u))) _ + (fun u hu => Ball.mul_sound (B1_1_6Masses_sound u (List.mem_filter.mp hu).1) + (Ball.add_sound (Ball.mul_sound (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) + logN2_sound) (B1_1_6Binaries_sound u hu)))) (by decide +kernel) +def B1_2_5Ttotal : Ball := ⟨(4755163798532963526151893931759 / 100000000000000000000000000000000), (57 / 100000000000000000000000000000000)⟩ +lemma B1_2_5Ttotal_sound : B1_2_5Ttotal.Encloses + ((((below (shape 1 2 5)).filter positive).map (fun u => (littleMass (shape 1 2 5) u : ℝ))).sum) := by + exact contains_sound (listSumBall_sound ((below (shape 1 2 5)).filter positive) + B1_2_5Masses _ (fun u hu => B1_2_5Masses_sound u (List.mem_filter.mp hu).1)) (by decide +kernel) +def B1_2_5Btotal : Ball := ⟨(263770662946704051420489805631 / 4000000000000000000000000000000), (4032951479 / 100000000000000000000000000000000)⟩ +lemma B1_2_5Btotal_sound : B1_2_5Btotal.Encloses + ((((below (shape 1 2 5)).filter positive).map (fun u => (littleMass (shape 1 2 5) u : ℝ) * (2 * Real.log 2 + binaryEntropyRate (binaryParameter (shape 1 2 5) u)))).sum) := by + exact contains_sound (listSumBall_sound ((below (shape 1 2 5)).filter positive) + (fun u => .mul (B1_2_5Masses u) (.add (.mul (.exact 2) logN2) (B1_2_5Binaries u))) _ + (fun u hu => Ball.mul_sound (B1_2_5Masses_sound u (List.mem_filter.mp hu).1) + (Ball.add_sound (Ball.mul_sound (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) + logN2_sound) (B1_2_5Binaries_sound u hu)))) (by decide +kernel) +def B1_3_4Ttotal : Ball := ⟨(7480325224810645241814099259701 / 25000000000000000000000000000000), (151 / 50000000000000000000000000000000)⟩ +lemma B1_3_4Ttotal_sound : B1_3_4Ttotal.Encloses + ((((below (shape 1 3 4)).filter positive).map (fun u => (littleMass (shape 1 3 4) u : ℝ))).sum) := by + exact contains_sound (listSumBall_sound ((below (shape 1 3 4)).filter positive) + B1_3_4Masses _ (fun u hu => B1_3_4Masses_sound u (List.mem_filter.mp hu).1)) (by decide +kernel) +def B1_3_4Btotal : Ball := ⟨(10623575146720639793993756588557 / 25000000000000000000000000000000), (38286699949 / 100000000000000000000000000000000)⟩ +lemma B1_3_4Btotal_sound : B1_3_4Btotal.Encloses + ((((below (shape 1 3 4)).filter positive).map (fun u => (littleMass (shape 1 3 4) u : ℝ) * (2 * Real.log 2 + binaryEntropyRate (binaryParameter (shape 1 3 4) u)))).sum) := by + exact contains_sound (listSumBall_sound ((below (shape 1 3 4)).filter positive) + (fun u => .mul (B1_3_4Masses u) (.add (.mul (.exact 2) logN2) (B1_3_4Binaries u))) _ + (fun u hu => Ball.mul_sound (B1_3_4Masses_sound u (List.mem_filter.mp hu).1) + (Ball.add_sound (Ball.mul_sound (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) + logN2_sound) (B1_3_4Binaries_sound u hu)))) (by decide +kernel) +def B1_4_3Ttotal : Ball := ⟨(6944605000406853487412318907203 / 50000000000000000000000000000000), (159 / 100000000000000000000000000000000)⟩ +lemma B1_4_3Ttotal_sound : B1_4_3Ttotal.Encloses + ((((below (shape 1 4 3)).filter positive).map (fun u => (littleMass (shape 1 4 3) u : ℝ))).sum) := by + exact contains_sound (listSumBall_sound ((below (shape 1 4 3)).filter positive) + B1_4_3Masses _ (fun u hu => B1_4_3Masses_sound u (List.mem_filter.mp hu).1)) (by decide +kernel) +def B1_4_3Btotal : Ball := ⟨(19909829730949708038768839279537 / 100000000000000000000000000000000), (17824415679 / 100000000000000000000000000000000)⟩ +lemma B1_4_3Btotal_sound : B1_4_3Btotal.Encloses + ((((below (shape 1 4 3)).filter positive).map (fun u => (littleMass (shape 1 4 3) u : ℝ) * (2 * Real.log 2 + binaryEntropyRate (binaryParameter (shape 1 4 3) u)))).sum) := by + exact contains_sound (listSumBall_sound ((below (shape 1 4 3)).filter positive) + (fun u => .mul (B1_4_3Masses u) (.add (.mul (.exact 2) logN2) (B1_4_3Binaries u))) _ + (fun u hu => Ball.mul_sound (B1_4_3Masses_sound u (List.mem_filter.mp hu).1) + (Ball.add_sound (Ball.mul_sound (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) + logN2_sound) (B1_4_3Binaries_sound u hu)))) (by decide +kernel) +def B1_5_2Ttotal : Ball := ⟨(403356547772450802156337181231 / 100000000000000000000000000000000), (9 / 100000000000000000000000000000000)⟩ +lemma B1_5_2Ttotal_sound : B1_5_2Ttotal.Encloses + ((((below (shape 1 5 2)).filter positive).map (fun u => (littleMass (shape 1 5 2) u : ℝ))).sum) := by + exact contains_sound (listSumBall_sound ((below (shape 1 5 2)).filter positive) + B1_5_2Masses _ (fun u hu => B1_5_2Masses_sound u (List.mem_filter.mp hu).1)) (by decide +kernel) +def B1_5_2Btotal : Ball := ⟨(571743387204363003226748332669 / 100000000000000000000000000000000), (516090839 / 100000000000000000000000000000000)⟩ +lemma B1_5_2Btotal_sound : B1_5_2Btotal.Encloses + ((((below (shape 1 5 2)).filter positive).map (fun u => (littleMass (shape 1 5 2) u : ℝ) * (2 * Real.log 2 + binaryEntropyRate (binaryParameter (shape 1 5 2) u)))).sum) := by + exact contains_sound (listSumBall_sound ((below (shape 1 5 2)).filter positive) + (fun u => .mul (B1_5_2Masses u) (.add (.mul (.exact 2) logN2) (B1_5_2Binaries u))) _ + (fun u hu => Ball.mul_sound (B1_5_2Masses_sound u (List.mem_filter.mp hu).1) + (Ball.add_sound (Ball.mul_sound (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) + logN2_sound) (B1_5_2Binaries_sound u hu)))) (by decide +kernel) +def B1_6_1Ttotal : Ball := ⟨(77881891746725088607012689 / 10000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ +lemma B1_6_1Ttotal_sound : B1_6_1Ttotal.Encloses + ((((below (shape 1 6 1)).filter positive).map (fun u => (littleMass (shape 1 6 1) u : ℝ))).sum) := by + exact contains_sound (listSumBall_sound ((below (shape 1 6 1)).filter positive) + B1_6_1Masses _ (fun u hu => B1_6_1Masses_sound u (List.mem_filter.mp hu).1)) (by decide +kernel) +def B1_6_1Btotal : Ball := ⟨(619013508687338257205025789 / 50000000000000000000000000000000), (1031081 / 100000000000000000000000000000000)⟩ +lemma B1_6_1Btotal_sound : B1_6_1Btotal.Encloses + ((((below (shape 1 6 1)).filter positive).map (fun u => (littleMass (shape 1 6 1) u : ℝ) * (2 * Real.log 2 + binaryEntropyRate (binaryParameter (shape 1 6 1) u)))).sum) := by + exact contains_sound (listSumBall_sound ((below (shape 1 6 1)).filter positive) + (fun u => .mul (B1_6_1Masses u) (.add (.mul (.exact 2) logN2) (B1_6_1Binaries u))) _ + (fun u hu => Ball.mul_sound (B1_6_1Masses_sound u (List.mem_filter.mp hu).1) + (Ball.add_sound (Ball.mul_sound (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) + logN2_sound) (B1_6_1Binaries_sound u hu)))) (by decide +kernel) +def B2_1_5Ttotal : Ball := ⟨(535927124963214472545786930867 / 25000000000000000000000000000000), (29 / 100000000000000000000000000000000)⟩ +lemma B2_1_5Ttotal_sound : B2_1_5Ttotal.Encloses + ((((below (shape 2 1 5)).filter positive).map (fun u => (littleMass (shape 2 1 5) u : ℝ))).sum) := by + exact contains_sound (listSumBall_sound ((below (shape 2 1 5)).filter positive) + B2_1_5Masses _ (fun u hu => B2_1_5Masses_sound u (List.mem_filter.mp hu).1)) (by decide +kernel) +def B2_1_5Btotal : Ball := ⟨(1486547718243755829261660863071 / 50000000000000000000000000000000), (681006439 / 25000000000000000000000000000000)⟩ +lemma B2_1_5Btotal_sound : B2_1_5Btotal.Encloses + ((((below (shape 2 1 5)).filter positive).map (fun u => (littleMass (shape 2 1 5) u : ℝ) * (2 * Real.log 2 + binaryEntropyRate (binaryParameter (shape 2 1 5) u)))).sum) := by + exact contains_sound (listSumBall_sound ((below (shape 2 1 5)).filter positive) + (fun u => .mul (B2_1_5Masses u) (.add (.mul (.exact 2) logN2) (B2_1_5Binaries u))) _ + (fun u hu => Ball.mul_sound (B2_1_5Masses_sound u (List.mem_filter.mp hu).1) + (Ball.add_sound (Ball.mul_sound (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) + logN2_sound) (B2_1_5Binaries_sound u hu)))) (by decide +kernel) +def B2_2_4Ttotal : Ball := ⟨(20957935808074261818840608407343 / 50000000000000000000000000000000), (113 / 25000000000000000000000000000000)⟩ +lemma B2_2_4Ttotal_sound : B2_2_4Ttotal.Encloses + ((((below (shape 2 2 4)).filter positive).map (fun u => (littleMass (shape 2 2 4) u : ℝ))).sum) := by + exact contains_sound (listSumBall_sound ((below (shape 2 2 4)).filter positive) + B2_2_4Masses _ (fun u hu => B2_2_4Masses_sound u (List.mem_filter.mp hu).1)) (by decide +kernel) +def B2_2_4Btotal : Ball := ⟨(61259431592020676095074322312553 / 100000000000000000000000000000000), (54088775631 / 100000000000000000000000000000000)⟩ +lemma B2_2_4Btotal_sound : B2_2_4Btotal.Encloses + ((((below (shape 2 2 4)).filter positive).map (fun u => (littleMass (shape 2 2 4) u : ℝ) * (2 * Real.log 2 + binaryEntropyRate (binaryParameter (shape 2 2 4) u)))).sum) := by + exact contains_sound (listSumBall_sound ((below (shape 2 2 4)).filter positive) + (fun u => .mul (B2_2_4Masses u) (.add (.mul (.exact 2) logN2) (B2_2_4Binaries u))) _ + (fun u hu => Ball.mul_sound (B2_2_4Masses_sound u (List.mem_filter.mp hu).1) + (Ball.add_sound (Ball.mul_sound (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) + logN2_sound) (B2_2_4Binaries_sound u hu)))) (by decide +kernel) +def B2_3_3Ttotal : Ball := ⟨(31969784226000540926113589340621 / 50000000000000000000000000000000), (153 / 25000000000000000000000000000000)⟩ +lemma B2_3_3Ttotal_sound : B2_3_3Ttotal.Encloses + ((((below (shape 2 3 3)).filter positive).map (fun u => (littleMass (shape 2 3 3) u : ℝ))).sum) := by + exact contains_sound (listSumBall_sound ((below (shape 2 3 3)).filter positive) + B2_3_3Masses _ (fun u hu => B2_3_3Masses_sound u (List.mem_filter.mp hu).1)) (by decide +kernel) +def B2_3_3Btotal : Ball := ⟨(97155091397592012920594654935737 / 100000000000000000000000000000000), (8346926389 / 10000000000000000000000000000000)⟩ +lemma B2_3_3Btotal_sound : B2_3_3Btotal.Encloses + ((((below (shape 2 3 3)).filter positive).map (fun u => (littleMass (shape 2 3 3) u : ℝ) * (2 * Real.log 2 + binaryEntropyRate (binaryParameter (shape 2 3 3) u)))).sum) := by + exact contains_sound (listSumBall_sound ((below (shape 2 3 3)).filter positive) + (fun u => .mul (B2_3_3Masses u) (.add (.mul (.exact 2) logN2) (B2_3_3Binaries u))) _ + (fun u hu => Ball.mul_sound (B2_3_3Masses_sound u (List.mem_filter.mp hu).1) + (Ball.add_sound (Ball.mul_sound (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) + logN2_sound) (B2_3_3Binaries_sound u hu)))) (by decide +kernel) +def B2_4_2Ttotal : Ball := ⟨(4469292299776841640211258871473 / 50000000000000000000000000000000), (121 / 100000000000000000000000000000000)⟩ +lemma B2_4_2Ttotal_sound : B2_4_2Ttotal.Encloses + ((((below (shape 2 4 2)).filter positive).map (fun u => (littleMass (shape 2 4 2) u : ℝ))).sum) := by + exact contains_sound (listSumBall_sound ((below (shape 2 4 2)).filter positive) + B2_4_2Masses _ (fun u hu => B2_4_2Masses_sound u (List.mem_filter.mp hu).1)) (by decide +kernel) +def B2_4_2Btotal : Ball := ⟨(13184565128477558357944470754293 / 100000000000000000000000000000000), (11573072161 / 100000000000000000000000000000000)⟩ +lemma B2_4_2Btotal_sound : B2_4_2Btotal.Encloses + ((((below (shape 2 4 2)).filter positive).map (fun u => (littleMass (shape 2 4 2) u : ℝ) * (2 * Real.log 2 + binaryEntropyRate (binaryParameter (shape 2 4 2) u)))).sum) := by + exact contains_sound (listSumBall_sound ((below (shape 2 4 2)).filter positive) + (fun u => .mul (B2_4_2Masses u) (.add (.mul (.exact 2) logN2) (B2_4_2Binaries u))) _ + (fun u hu => Ball.mul_sound (B2_4_2Masses_sound u (List.mem_filter.mp hu).1) + (Ball.add_sound (Ball.mul_sound (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) + logN2_sound) (B2_4_2Binaries_sound u hu)))) (by decide +kernel) +def B2_5_1Ttotal : Ball := ⟨(31645095109351479784189369397 / 50000000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ +lemma B2_5_1Ttotal_sound : B2_5_1Ttotal.Encloses + ((((below (shape 2 5 1)).filter positive).map (fun u => (littleMass (shape 2 5 1) u : ℝ))).sum) := by + exact contains_sound (listSumBall_sound ((below (shape 2 5 1)).filter positive) + B2_5_1Masses _ (fun u hu => B2_5_1Masses_sound u (List.mem_filter.mp hu).1)) (by decide +kernel) +def B2_5_1Btotal : Ball := ⟨(17929724936204266029568343331 / 20000000000000000000000000000000), (20239527 / 25000000000000000000000000000000)⟩ +lemma B2_5_1Btotal_sound : B2_5_1Btotal.Encloses + ((((below (shape 2 5 1)).filter positive).map (fun u => (littleMass (shape 2 5 1) u : ℝ) * (2 * Real.log 2 + binaryEntropyRate (binaryParameter (shape 2 5 1) u)))).sum) := by + exact contains_sound (listSumBall_sound ((below (shape 2 5 1)).filter positive) + (fun u => .mul (B2_5_1Masses u) (.add (.mul (.exact 2) logN2) (B2_5_1Binaries u))) _ + (fun u hu => Ball.mul_sound (B2_5_1Masses_sound u (List.mem_filter.mp hu).1) + (Ball.add_sound (Ball.mul_sound (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) + logN2_sound) (B2_5_1Binaries_sound u hu)))) (by decide +kernel) +def B3_1_4Ttotal : Ball := ⟨(907559782261289135363984197323 / 12500000000000000000000000000000), (11 / 12500000000000000000000000000000)⟩ +lemma B3_1_4Ttotal_sound : B3_1_4Ttotal.Encloses + ((((below (shape 3 1 4)).filter positive).map (fun u => (littleMass (shape 3 1 4) u : ℝ))).sum) := by + exact contains_sound (listSumBall_sound ((below (shape 3 1 4)).filter positive) + B3_1_4Masses _ (fun u hu => B3_1_4Masses_sound u (List.mem_filter.mp hu).1)) (by decide +kernel) +def B3_1_4Btotal : Ball := ⟨(103669017590719797550293135229 / 1000000000000000000000000000000), (4652487271 / 50000000000000000000000000000000)⟩ +lemma B3_1_4Btotal_sound : B3_1_4Btotal.Encloses + ((((below (shape 3 1 4)).filter positive).map (fun u => (littleMass (shape 3 1 4) u : ℝ) * (2 * Real.log 2 + binaryEntropyRate (binaryParameter (shape 3 1 4) u)))).sum) := by + exact contains_sound (listSumBall_sound ((below (shape 3 1 4)).filter positive) + (fun u => .mul (B3_1_4Masses u) (.add (.mul (.exact 2) logN2) (B3_1_4Binaries u))) _ + (fun u hu => Ball.mul_sound (B3_1_4Masses_sound u (List.mem_filter.mp hu).1) + (Ball.add_sound (Ball.mul_sound (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) + logN2_sound) (B3_1_4Binaries_sound u hu)))) (by decide +kernel) +def B3_2_3Ttotal : Ball := ⟨(1150430302257331587531431126831 / 3125000000000000000000000000000), (79 / 20000000000000000000000000000000)⟩ +lemma B3_2_3Ttotal_sound : B3_2_3Ttotal.Encloses + ((((below (shape 3 2 3)).filter positive).map (fun u => (littleMass (shape 3 2 3) u : ℝ))).sum) := by + exact contains_sound (listSumBall_sound ((below (shape 3 2 3)).filter positive) + B3_2_3Masses _ (fun u hu => B3_2_3Masses_sound u (List.mem_filter.mp hu).1)) (by decide +kernel) +def B3_2_3Btotal : Ball := ⟨(55952151483018865110434847256319 / 100000000000000000000000000000000), (12015665981 / 25000000000000000000000000000000)⟩ +lemma B3_2_3Btotal_sound : B3_2_3Btotal.Encloses + ((((below (shape 3 2 3)).filter positive).map (fun u => (littleMass (shape 3 2 3) u : ℝ) * (2 * Real.log 2 + binaryEntropyRate (binaryParameter (shape 3 2 3) u)))).sum) := by + exact contains_sound (listSumBall_sound ((below (shape 3 2 3)).filter positive) + (fun u => .mul (B3_2_3Masses u) (.add (.mul (.exact 2) logN2) (B3_2_3Binaries u))) _ + (fun u hu => Ball.mul_sound (B3_2_3Masses_sound u (List.mem_filter.mp hu).1) + (Ball.add_sound (Ball.mul_sound (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) + logN2_sound) (B3_2_3Binaries_sound u hu)))) (by decide +kernel) +def B3_3_2Ttotal : Ball := ⟨(8758499276755162714699464520641 / 50000000000000000000000000000000), (209 / 100000000000000000000000000000000)⟩ +lemma B3_3_2Ttotal_sound : B3_3_2Ttotal.Encloses + ((((below (shape 3 3 2)).filter positive).map (fun u => (littleMass (shape 3 3 2) u : ℝ))).sum) := by + exact contains_sound (listSumBall_sound ((below (shape 3 3 2)).filter positive) + B3_3_2Masses _ (fun u hu => B3_3_2Masses_sound u (List.mem_filter.mp hu).1)) (by decide +kernel) +def B3_3_2Btotal : Ball := ⟨(13315199039969247677694047381629 / 50000000000000000000000000000000), (11435850877 / 50000000000000000000000000000000)⟩ +lemma B3_3_2Btotal_sound : B3_3_2Btotal.Encloses + ((((below (shape 3 3 2)).filter positive).map (fun u => (littleMass (shape 3 3 2) u : ℝ) * (2 * Real.log 2 + binaryEntropyRate (binaryParameter (shape 3 3 2) u)))).sum) := by + exact contains_sound (listSumBall_sound ((below (shape 3 3 2)).filter positive) + (fun u => .mul (B3_3_2Masses u) (.add (.mul (.exact 2) logN2) (B3_3_2Binaries u))) _ + (fun u hu => Ball.mul_sound (B3_3_2Masses_sound u (List.mem_filter.mp hu).1) + (Ball.add_sound (Ball.mul_sound (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) + logN2_sound) (B3_3_2Binaries_sound u hu)))) (by decide +kernel) +def B3_4_1Ttotal : Ball := ⟨(564009300736610125456854593833 / 100000000000000000000000000000000), (11 / 100000000000000000000000000000000)⟩ +lemma B3_4_1Ttotal_sound : B3_4_1Ttotal.Encloses + ((((below (shape 3 4 1)).filter positive).map (fun u => (littleMass (shape 3 4 1) u : ℝ))).sum) := by + exact contains_sound (listSumBall_sound ((below (shape 3 4 1)).filter positive) + B3_4_1Masses _ (fun u hu => B3_4_1Masses_sound u (List.mem_filter.mp hu).1)) (by decide +kernel) +def B3_4_1Btotal : Ball := ⟨(202057355425613495053354661181 / 25000000000000000000000000000000), (144745553 / 20000000000000000000000000000000)⟩ +lemma B3_4_1Btotal_sound : B3_4_1Btotal.Encloses + ((((below (shape 3 4 1)).filter positive).map (fun u => (littleMass (shape 3 4 1) u : ℝ) * (2 * Real.log 2 + binaryEntropyRate (binaryParameter (shape 3 4 1) u)))).sum) := by + exact contains_sound (listSumBall_sound ((below (shape 3 4 1)).filter positive) + (fun u => .mul (B3_4_1Masses u) (.add (.mul (.exact 2) logN2) (B3_4_1Binaries u))) _ + (fun u hu => Ball.mul_sound (B3_4_1Masses_sound u (List.mem_filter.mp hu).1) + (Ball.add_sound (Ball.mul_sound (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) + logN2_sound) (B3_4_1Binaries_sound u hu)))) (by decide +kernel) +def B4_1_3Ttotal : Ball := ⟨(2233079177302622918447096359641 / 100000000000000000000000000000000), (3 / 10000000000000000000000000000000)⟩ +lemma B4_1_3Ttotal_sound : B4_1_3Ttotal.Encloses + ((((below (shape 4 1 3)).filter positive).map (fun u => (littleMass (shape 4 1 3) u : ℝ))).sum) := by + exact contains_sound (listSumBall_sound ((below (shape 4 1 3)).filter positive) + B4_1_3Masses _ (fun u hu => B4_1_3Masses_sound u (List.mem_filter.mp hu).1)) (by decide +kernel) +def B4_1_3Btotal : Ball := ⟨(64014500780045741535225896199 / 2000000000000000000000000000000), (2865674341 / 100000000000000000000000000000000)⟩ +lemma B4_1_3Btotal_sound : B4_1_3Btotal.Encloses + ((((below (shape 4 1 3)).filter positive).map (fun u => (littleMass (shape 4 1 3) u : ℝ) * (2 * Real.log 2 + binaryEntropyRate (binaryParameter (shape 4 1 3) u)))).sum) := by + exact contains_sound (listSumBall_sound ((below (shape 4 1 3)).filter positive) + (fun u => .mul (B4_1_3Masses u) (.add (.mul (.exact 2) logN2) (B4_1_3Binaries u))) _ + (fun u hu => Ball.mul_sound (B4_1_3Masses_sound u (List.mem_filter.mp hu).1) + (Ball.add_sound (Ball.mul_sound (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) + logN2_sound) (B4_1_3Binaries_sound u hu)))) (by decide +kernel) +def B4_2_2Ttotal : Ball := ⟨(3767097545009369306050857272327 / 100000000000000000000000000000000), (27 / 50000000000000000000000000000000)⟩ +lemma B4_2_2Ttotal_sound : B4_2_2Ttotal.Encloses + ((((below (shape 4 2 2)).filter positive).map (fun u => (littleMass (shape 4 2 2) u : ℝ))).sum) := by + exact contains_sound (listSumBall_sound ((below (shape 4 2 2)).filter positive) + B4_2_2Masses _ (fun u hu => B4_2_2Masses_sound u (List.mem_filter.mp hu).1)) (by decide +kernel) +def B4_2_2Btotal : Ball := ⟨(5557262538143694155705675547867 / 100000000000000000000000000000000), (4877621647 / 100000000000000000000000000000000)⟩ +lemma B4_2_2Btotal_sound : B4_2_2Btotal.Encloses + ((((below (shape 4 2 2)).filter positive).map (fun u => (littleMass (shape 4 2 2) u : ℝ) * (2 * Real.log 2 + binaryEntropyRate (binaryParameter (shape 4 2 2) u)))).sum) := by + exact contains_sound (listSumBall_sound ((below (shape 4 2 2)).filter positive) + (fun u => .mul (B4_2_2Masses u) (.add (.mul (.exact 2) logN2) (B4_2_2Binaries u))) _ + (fun u hu => Ball.mul_sound (B4_2_2Masses_sound u (List.mem_filter.mp hu).1) + (Ball.add_sound (Ball.mul_sound (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) + logN2_sound) (B4_2_2Binaries_sound u hu)))) (by decide +kernel) +def B4_3_1Ttotal : Ball := ⟨(99503874082605676510083297769 / 25000000000000000000000000000000), (9 / 100000000000000000000000000000000)⟩ +lemma B4_3_1Ttotal_sound : B4_3_1Ttotal.Encloses + ((((below (shape 4 3 1)).filter positive).map (fun u => (littleMass (shape 4 3 1) u : ℝ))).sum) := by + exact contains_sound (listSumBall_sound ((below (shape 4 3 1)).filter positive) + B4_3_1Masses _ (fun u hu => B4_3_1Masses_sound u (List.mem_filter.mp hu).1)) (by decide +kernel) +def B4_3_1Btotal : Ball := ⟨(570401113257114350350352476201 / 100000000000000000000000000000000), (510740473 / 100000000000000000000000000000000)⟩ +lemma B4_3_1Btotal_sound : B4_3_1Btotal.Encloses + ((((below (shape 4 3 1)).filter positive).map (fun u => (littleMass (shape 4 3 1) u : ℝ) * (2 * Real.log 2 + binaryEntropyRate (binaryParameter (shape 4 3 1) u)))).sum) := by + exact contains_sound (listSumBall_sound ((below (shape 4 3 1)).filter positive) + (fun u => .mul (B4_3_1Masses u) (.add (.mul (.exact 2) logN2) (B4_3_1Binaries u))) _ + (fun u hu => Ball.mul_sound (B4_3_1Masses_sound u (List.mem_filter.mp hu).1) + (Ball.add_sound (Ball.mul_sound (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) + logN2_sound) (B4_3_1Binaries_sound u hu)))) (by decide +kernel) +def B5_1_2Ttotal : Ball := ⟨(47463286326287333481085364697 / 100000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +lemma B5_1_2Ttotal_sound : B5_1_2Ttotal.Encloses + ((((below (shape 5 1 2)).filter positive).map (fun u => (littleMass (shape 5 1 2) u : ℝ))).sum) := by + exact contains_sound (listSumBall_sound ((below (shape 5 1 2)).filter positive) + B5_1_2Masses _ (fun u hu => B5_1_2Masses_sound u (List.mem_filter.mp hu).1)) (by decide +kernel) +def B5_1_2Btotal : Ball := ⟨(67347402449400564801926883563 / 100000000000000000000000000000000), (60713289 / 100000000000000000000000000000000)⟩ +lemma B5_1_2Btotal_sound : B5_1_2Btotal.Encloses + ((((below (shape 5 1 2)).filter positive).map (fun u => (littleMass (shape 5 1 2) u : ℝ) * (2 * Real.log 2 + binaryEntropyRate (binaryParameter (shape 5 1 2) u)))).sum) := by + exact contains_sound (listSumBall_sound ((below (shape 5 1 2)).filter positive) + (fun u => .mul (B5_1_2Masses u) (.add (.mul (.exact 2) logN2) (B5_1_2Binaries u))) _ + (fun u hu => Ball.mul_sound (B5_1_2Masses_sound u (List.mem_filter.mp hu).1) + (Ball.add_sound (Ball.mul_sound (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) + logN2_sound) (B5_1_2Binaries_sound u hu)))) (by decide +kernel) +def B5_2_1Ttotal : Ball := ⟨(408525735543637671783520101 / 2500000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ +lemma B5_2_1Ttotal_sound : B5_2_1Ttotal.Encloses + ((((below (shape 5 2 1)).filter positive).map (fun u => (littleMass (shape 5 2 1) u : ℝ))).sum) := by + exact contains_sound (listSumBall_sound ((below (shape 5 2 1)).filter positive) + B5_2_1Masses _ (fun u hu => B5_2_1Masses_sound u (List.mem_filter.mp hu).1)) (by decide +kernel) +def B5_2_1Btotal : Ball := ⟨(23171910014948039061690049419 / 100000000000000000000000000000000), (20911247 / 100000000000000000000000000000000)⟩ +lemma B5_2_1Btotal_sound : B5_2_1Btotal.Encloses + ((((below (shape 5 2 1)).filter positive).map (fun u => (littleMass (shape 5 2 1) u : ℝ) * (2 * Real.log 2 + binaryEntropyRate (binaryParameter (shape 5 2 1) u)))).sum) := by + exact contains_sound (listSumBall_sound ((below (shape 5 2 1)).filter positive) + (fun u => .mul (B5_2_1Masses u) (.add (.mul (.exact 2) logN2) (B5_2_1Binaries u))) _ + (fun u hu => Ball.mul_sound (B5_2_1Masses_sound u (List.mem_filter.mp hu).1) + (Ball.add_sound (Ball.mul_sound (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) + logN2_sound) (B5_2_1Binaries_sound u hu)))) (by decide +kernel) +def B6_1_1Ttotal : Ball := ⟨0, 0⟩ +lemma B6_1_1Ttotal_sound : B6_1_1Ttotal.Encloses + ((((below (shape 6 1 1)).filter positive).map (fun u => (littleMass (shape 6 1 1) u : ℝ))).sum) := by + exact contains_sound (listSumBall_sound ((below (shape 6 1 1)).filter positive) + B6_1_1Masses _ (fun u hu => B6_1_1Masses_sound u (List.mem_filter.mp hu).1)) (by decide +kernel) +def B6_1_1Btotal : Ball := ⟨0, 0⟩ +lemma B6_1_1Btotal_sound : B6_1_1Btotal.Encloses + ((((below (shape 6 1 1)).filter positive).map (fun u => (littleMass (shape 6 1 1) u : ℝ) * (2 * Real.log 2 + binaryEntropyRate (binaryParameter (shape 6 1 1) u)))).sum) := by + exact contains_sound (listSumBall_sound ((below (shape 6 1 1)).filter positive) + (fun u => .mul (B6_1_1Masses u) (.add (.mul (.exact 2) logN2) (B6_1_1Binaries u))) _ + (fun u hu => Ball.mul_sound (B6_1_1Masses_sound u (List.mem_filter.mp hu).1) + (Ball.add_sound (Ball.mul_sound (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) + logN2_sound) (B6_1_1Binaries_sound u hu)))) (by decide +kernel) +def TParentBalls (s : Shape) : Ball := + match s 0, s 1, s 2 with + | 1, 1, 6 => B1_1_6Ttotal + | 1, 2, 5 => B1_2_5Ttotal + | 1, 3, 4 => B1_3_4Ttotal + | 1, 4, 3 => B1_4_3Ttotal + | 1, 5, 2 => B1_5_2Ttotal + | 1, 6, 1 => B1_6_1Ttotal + | 2, 1, 5 => B2_1_5Ttotal + | 2, 2, 4 => B2_2_4Ttotal + | 2, 3, 3 => B2_3_3Ttotal + | 2, 4, 2 => B2_4_2Ttotal + | 2, 5, 1 => B2_5_1Ttotal + | 3, 1, 4 => B3_1_4Ttotal + | 3, 2, 3 => B3_2_3Ttotal + | 3, 3, 2 => B3_3_2Ttotal + | 3, 4, 1 => B3_4_1Ttotal + | 4, 1, 3 => B4_1_3Ttotal + | 4, 2, 2 => B4_2_2Ttotal + | 4, 3, 1 => B4_3_1Ttotal + | 5, 1, 2 => B5_1_2Ttotal + | 5, 2, 1 => B5_2_1Ttotal + | 6, 1, 1 => B6_1_1Ttotal + | _, _, _ => (.exact 0) +lemma TParentBalls_sound (t : Shape) (ht : t ∈ positiveSecond) : + (TParentBalls t).Encloses ((((below t).filter positive).map + (fun u => interiorMass (t,u))).sum) := by + rw [positiveSecond_list] at ht + simp only [List.mem_cons, List.not_mem_nil, or_false] at ht + rcases ht with rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl + · exact B1_1_6Ttotal_sound + · exact B1_2_5Ttotal_sound + · exact B1_3_4Ttotal_sound + · exact B1_4_3Ttotal_sound + · exact B1_5_2Ttotal_sound + · exact B1_6_1Ttotal_sound + · exact B2_1_5Ttotal_sound + · exact B2_2_4Ttotal_sound + · exact B2_3_3Ttotal_sound + · exact B2_4_2Ttotal_sound + · exact B2_5_1Ttotal_sound + · exact B3_1_4Ttotal_sound + · exact B3_2_3Ttotal_sound + · exact B3_3_2Ttotal_sound + · exact B3_4_1Ttotal_sound + · exact B4_1_3Ttotal_sound + · exact B4_2_2Ttotal_sound + · exact B4_3_1Ttotal_sound + · exact B5_1_2Ttotal_sound + · exact B5_2_1Ttotal_sound + · exact B6_1_1Ttotal_sound +def BParentBalls (s : Shape) : Ball := + match s 0, s 1, s 2 with + | 1, 1, 6 => B1_1_6Btotal + | 1, 2, 5 => B1_2_5Btotal + | 1, 3, 4 => B1_3_4Btotal + | 1, 4, 3 => B1_4_3Btotal + | 1, 5, 2 => B1_5_2Btotal + | 1, 6, 1 => B1_6_1Btotal + | 2, 1, 5 => B2_1_5Btotal + | 2, 2, 4 => B2_2_4Btotal + | 2, 3, 3 => B2_3_3Btotal + | 2, 4, 2 => B2_4_2Btotal + | 2, 5, 1 => B2_5_1Btotal + | 3, 1, 4 => B3_1_4Btotal + | 3, 2, 3 => B3_2_3Btotal + | 3, 3, 2 => B3_3_2Btotal + | 3, 4, 1 => B3_4_1Btotal + | 4, 1, 3 => B4_1_3Btotal + | 4, 2, 2 => B4_2_2Btotal + | 4, 3, 1 => B4_3_1Btotal + | 5, 1, 2 => B5_1_2Btotal + | 5, 2, 1 => B5_2_1Btotal + | 6, 1, 1 => B6_1_1Btotal + | _, _, _ => (.exact 0) +lemma BParentBalls_sound (t : Shape) (ht : t ∈ positiveSecond) : + (BParentBalls t).Encloses ((((below t).filter positive).map + (fun u => (fun tu => interiorMass tu * (2 * Real.log 2 + interiorEntropy tu)) (t,u))).sum) := by + rw [positiveSecond_list] at ht + simp only [List.mem_cons, List.not_mem_nil, or_false] at ht + rcases ht with rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl + · exact B1_1_6Btotal_sound + · exact B1_2_5Btotal_sound + · exact B1_3_4Btotal_sound + · exact B1_4_3Btotal_sound + · exact B1_5_2Btotal_sound + · exact B1_6_1Btotal_sound + · exact B2_1_5Btotal_sound + · exact B2_2_4Btotal_sound + · exact B2_3_3Btotal_sound + · exact B2_4_2Btotal_sound + · exact B2_5_1Btotal_sound + · exact B3_1_4Btotal_sound + · exact B3_2_3Btotal_sound + · exact B3_3_2Btotal_sound + · exact B3_4_1Btotal_sound + · exact B4_1_3Btotal_sound + · exact B4_2_2Btotal_sound + · exact B4_3_1Btotal_sound + · exact B5_1_2Btotal_sound + · exact B5_2_1Btotal_sound + · exact B6_1_1Btotal_sound +def nativeTBall : Ball := ⟨(7331109571865792290176153698167 / 3125000000000000000000000000000), (637 / 25000000000000000000000000000000)⟩ +lemma nativeTBall_sound : nativeTBall.Encloses nativeT := by + rw [nativeT, interior_fold] + exact contains_sound (listSumBall_sound positiveSecond TParentBalls _ TParentBalls_sound) + (by decide +kernel) +def nativeBBall : Ball := ⟨(926453577659126052246485196733 / 800000000000000000000000000000), (100635147743 / 100000000000000000000000000000000)⟩ +lemma nativeBBall_sound : nativeBBall.Encloses nativeB := by + rw [nativeB, interior_fold] + have hb := contains_sound (Ball.mul_sound + (listSumBall_sound positiveSecond BParentBalls _ BParentBalls_sound) + (show (Ball.exact (1/3)).Encloses (1/(3 : ℝ)) by + convert Ball.exact_sound (1/3) using 1 + norm_num)) + (show contains (.mul (listSumBall positiveSecond BParentBalls) (.exact (1/3))) nativeBBall = true by decide +kernel) + simpa only [one_div, div_eq_mul_inv, one_mul] using hb +def nativeHighBall : Ball := ⟨(81304606881836826911861830543749 / 50000000000000000000000000000000), (99355063329 / 100000000000000000000000000000000)⟩ +lemma nativeHighBall_sound : nativeHighBall.Encloses nativeHigh := by + exact contains_sound (Ball.mul_sound nativeTBall_sound logN2_sound) (by decide +kernel) + +theorem native_denominator_gap : nativeB < nativeHigh := by + have hb := (Ball.bounds nativeBBall_sound).2 + have ht := (Ball.bounds nativeHighBall_sound).1 + have hi : (nativeBBall.upper : ℝ) < nativeHighBall.lower := by + norm_num [nativeBBall, nativeHighBall, Ball.lower, Ball.upper] + exact hb.trans_lt (hi.trans_le ht) + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/Certificates/NativeSharp.lean b/lean/OAI/LinearAlgebra/MatrixFields/Certificates/NativeSharp.lean new file mode 100644 index 0000000000000000000000000000000000000000..4ae0bd86b1a2d724f87d25a6fa85a53cc99cb368 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/Certificates/NativeSharp.lean @@ -0,0 +1,421 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.CapacityA.CapA1_1_14I0 +import OAI.LinearAlgebra.MatrixFields.CapacityA.CapA1_1_14I1 +import OAI.LinearAlgebra.MatrixFields.CapacityA.CapA1_1_14I2 +import OAI.LinearAlgebra.MatrixFields.CapacityA.CapA1_2_13I0 +import OAI.LinearAlgebra.MatrixFields.CapacityA.CapA1_2_13I1 +import OAI.LinearAlgebra.MatrixFields.CapacityA.CapA1_2_13I2 +import OAI.LinearAlgebra.MatrixFields.CapacityA.CapA1_3_12I0 +import OAI.LinearAlgebra.MatrixFields.CapacityA.CapA1_3_12I1 +import OAI.LinearAlgebra.MatrixFields.CapacityA.CapA1_3_12I2 +import OAI.LinearAlgebra.MatrixFields.CapacityA.CapA1_4_11I0 +import OAI.LinearAlgebra.MatrixFields.CapacityA.CapA1_4_11I1 +import OAI.LinearAlgebra.MatrixFields.CapacityA.CapA1_4_11I2 +import OAI.LinearAlgebra.MatrixFields.CapacityA.CapA1_5_10I0 +import OAI.LinearAlgebra.MatrixFields.CapacityA.CapA1_5_10I1 +import OAI.LinearAlgebra.MatrixFields.CapacityA.CapA1_5_10I2 +import OAI.LinearAlgebra.MatrixFields.CapacityA.CapA1_6_9I0 +import OAI.LinearAlgebra.MatrixFields.CapacityA.CapA1_6_9I1 +import OAI.LinearAlgebra.MatrixFields.CapacityA.CapA1_6_9I2 +import OAI.LinearAlgebra.MatrixFields.CapacityA.CapA1_7_8I0 +import OAI.LinearAlgebra.MatrixFields.CapacityA.CapA1_7_8I1 +import OAI.LinearAlgebra.MatrixFields.CapacityA.CapA1_7_8I2 +import OAI.LinearAlgebra.MatrixFields.CapacityA.CapA2_2_12I0 +import OAI.LinearAlgebra.MatrixFields.CapacityA.CapA2_2_12I1 +import OAI.LinearAlgebra.MatrixFields.CapacityA.CapA2_2_12I2 +import OAI.LinearAlgebra.MatrixFields.CapacityA.CapA2_3_11I0 +import OAI.LinearAlgebra.MatrixFields.CapacityA.CapA2_3_11I1 +import OAI.LinearAlgebra.MatrixFields.CapacityA.CapA2_3_11I2 +import OAI.LinearAlgebra.MatrixFields.CapacityA.CapA2_4_10I0 +import OAI.LinearAlgebra.MatrixFields.CapacityA.CapA2_4_10I1 +import OAI.LinearAlgebra.MatrixFields.CapacityA.CapA2_4_10I2 +import OAI.LinearAlgebra.MatrixFields.CapacityA.CapA2_5_9I0 +import OAI.LinearAlgebra.MatrixFields.CapacityA.CapA2_5_9I1 +import OAI.LinearAlgebra.MatrixFields.CapacityA.CapA2_5_9I2 +import OAI.LinearAlgebra.MatrixFields.CapacityA.CapA2_6_8I0 +import OAI.LinearAlgebra.MatrixFields.CapacityA.CapA2_6_8I1 +import OAI.LinearAlgebra.MatrixFields.CapacityA.CapA2_6_8I2 +import OAI.LinearAlgebra.MatrixFields.CapacityA.CapA2_7_7I0 +import OAI.LinearAlgebra.MatrixFields.CapacityA.CapA2_7_7I1 +import OAI.LinearAlgebra.MatrixFields.CapacityA.CapA2_7_7I2 +import OAI.LinearAlgebra.MatrixFields.CapacityA.CapA3_3_10I0 +import OAI.LinearAlgebra.MatrixFields.CapacityA.CapA3_3_10I1 +import OAI.LinearAlgebra.MatrixFields.CapacityA.CapA3_3_10I2 +import OAI.LinearAlgebra.MatrixFields.CapacityA.CapA3_4_9I0 +import OAI.LinearAlgebra.MatrixFields.CapacityA.CapA3_4_9I1 +import OAI.LinearAlgebra.MatrixFields.CapacityA.CapA3_4_9I2 +import OAI.LinearAlgebra.MatrixFields.CapacityA.CapA3_5_8I0 +import OAI.LinearAlgebra.MatrixFields.CapacityA.CapA3_5_8I1 +import OAI.LinearAlgebra.MatrixFields.CapacityA.CapA3_5_8I2 +import OAI.LinearAlgebra.MatrixFields.CapacityA.CapA3_6_7I0 +import OAI.LinearAlgebra.MatrixFields.CapacityA.CapA3_6_7I1 +import OAI.LinearAlgebra.MatrixFields.CapacityA.CapA3_6_7I2 +import OAI.LinearAlgebra.MatrixFields.CapacityA.CapA4_4_8I0 +import OAI.LinearAlgebra.MatrixFields.CapacityA.CapA4_4_8I1 +import OAI.LinearAlgebra.MatrixFields.CapacityA.CapA4_4_8I2 +import OAI.LinearAlgebra.MatrixFields.CapacityA.CapA4_5_7I0 +import OAI.LinearAlgebra.MatrixFields.CapacityA.CapA4_5_7I1 +import OAI.LinearAlgebra.MatrixFields.CapacityA.CapA4_5_7I2 +import OAI.LinearAlgebra.MatrixFields.CapacityA.CapA4_6_6I0 +import OAI.LinearAlgebra.MatrixFields.CapacityA.CapA4_6_6I1 +import OAI.LinearAlgebra.MatrixFields.CapacityA.CapA4_6_6I2 +import OAI.LinearAlgebra.MatrixFields.CapacityA.CapA5_5_6I0 +import OAI.LinearAlgebra.MatrixFields.CapacityA.CapA5_5_6I1 +import OAI.LinearAlgebra.MatrixFields.CapacityA.CapA5_5_6I2 +import OAI.LinearAlgebra.MatrixFields.CapacityB.CapB1_1_6I0 +import OAI.LinearAlgebra.MatrixFields.CapacityB.CapB1_1_6I1 +import OAI.LinearAlgebra.MatrixFields.CapacityB.CapB1_1_6I2 +import OAI.LinearAlgebra.MatrixFields.CapacityB.CapB1_2_5I0 +import OAI.LinearAlgebra.MatrixFields.CapacityB.CapB1_2_5I1 +import OAI.LinearAlgebra.MatrixFields.CapacityB.CapB1_2_5I2 +import OAI.LinearAlgebra.MatrixFields.CapacityB.CapB1_3_4I0 +import OAI.LinearAlgebra.MatrixFields.CapacityB.CapB1_3_4I1 +import OAI.LinearAlgebra.MatrixFields.CapacityB.CapB1_3_4I2 +import OAI.LinearAlgebra.MatrixFields.CapacityB.CapB1_4_3I0 +import OAI.LinearAlgebra.MatrixFields.CapacityB.CapB1_4_3I1 +import OAI.LinearAlgebra.MatrixFields.CapacityB.CapB1_4_3I2 +import OAI.LinearAlgebra.MatrixFields.CapacityB.CapB1_5_2I0 +import OAI.LinearAlgebra.MatrixFields.CapacityB.CapB1_5_2I1 +import OAI.LinearAlgebra.MatrixFields.CapacityB.CapB1_5_2I2 +import OAI.LinearAlgebra.MatrixFields.CapacityB.CapB1_6_1I0 +import OAI.LinearAlgebra.MatrixFields.CapacityB.CapB1_6_1I1 +import OAI.LinearAlgebra.MatrixFields.CapacityB.CapB1_6_1I2 +import OAI.LinearAlgebra.MatrixFields.CapacityB.CapB2_1_5I0 +import OAI.LinearAlgebra.MatrixFields.CapacityB.CapB2_1_5I1 +import OAI.LinearAlgebra.MatrixFields.CapacityB.CapB2_1_5I2 +import OAI.LinearAlgebra.MatrixFields.CapacityB.CapB2_2_4I0 +import OAI.LinearAlgebra.MatrixFields.CapacityB.CapB2_2_4I1 +import OAI.LinearAlgebra.MatrixFields.CapacityB.CapB2_2_4I2 +import OAI.LinearAlgebra.MatrixFields.CapacityB.CapB2_3_3I0 +import OAI.LinearAlgebra.MatrixFields.CapacityB.CapB2_3_3I1 +import OAI.LinearAlgebra.MatrixFields.CapacityB.CapB2_3_3I2 +import OAI.LinearAlgebra.MatrixFields.CapacityB.CapB2_4_2I0 +import OAI.LinearAlgebra.MatrixFields.CapacityB.CapB2_4_2I1 +import OAI.LinearAlgebra.MatrixFields.CapacityB.CapB2_4_2I2 +import OAI.LinearAlgebra.MatrixFields.CapacityB.CapB2_5_1I0 +import OAI.LinearAlgebra.MatrixFields.CapacityB.CapB2_5_1I1 +import OAI.LinearAlgebra.MatrixFields.CapacityB.CapB2_5_1I2 +import OAI.LinearAlgebra.MatrixFields.CapacityB.CapB3_1_4I0 +import OAI.LinearAlgebra.MatrixFields.CapacityB.CapB3_1_4I1 +import OAI.LinearAlgebra.MatrixFields.CapacityB.CapB3_1_4I2 +import OAI.LinearAlgebra.MatrixFields.CapacityB.CapB3_2_3I0 +import OAI.LinearAlgebra.MatrixFields.CapacityB.CapB3_2_3I1 +import OAI.LinearAlgebra.MatrixFields.CapacityB.CapB3_2_3I2 +import OAI.LinearAlgebra.MatrixFields.CapacityB.CapB3_3_2I0 +import OAI.LinearAlgebra.MatrixFields.CapacityB.CapB3_3_2I1 +import OAI.LinearAlgebra.MatrixFields.CapacityB.CapB3_3_2I2 +import OAI.LinearAlgebra.MatrixFields.CapacityB.CapB3_4_1I0 +import OAI.LinearAlgebra.MatrixFields.CapacityB.CapB3_4_1I1 +import OAI.LinearAlgebra.MatrixFields.CapacityB.CapB3_4_1I2 +import OAI.LinearAlgebra.MatrixFields.CapacityB.CapB4_1_3I0 +import OAI.LinearAlgebra.MatrixFields.CapacityB.CapB4_1_3I1 +import OAI.LinearAlgebra.MatrixFields.CapacityB.CapB4_1_3I2 +import OAI.LinearAlgebra.MatrixFields.CapacityB.CapB4_2_2I0 +import OAI.LinearAlgebra.MatrixFields.CapacityB.CapB4_2_2I1 +import OAI.LinearAlgebra.MatrixFields.CapacityB.CapB4_2_2I2 +import OAI.LinearAlgebra.MatrixFields.CapacityB.CapB4_3_1I0 +import OAI.LinearAlgebra.MatrixFields.CapacityB.CapB4_3_1I1 +import OAI.LinearAlgebra.MatrixFields.CapacityB.CapB4_3_1I2 +import OAI.LinearAlgebra.MatrixFields.CapacityB.CapB5_1_2I0 +import OAI.LinearAlgebra.MatrixFields.CapacityB.CapB5_1_2I1 +import OAI.LinearAlgebra.MatrixFields.CapacityB.CapB5_1_2I2 +import OAI.LinearAlgebra.MatrixFields.CapacityB.CapB5_2_1I0 +import OAI.LinearAlgebra.MatrixFields.CapacityB.CapB5_2_1I1 +import OAI.LinearAlgebra.MatrixFields.CapacityB.CapB5_2_1I2 +import OAI.LinearAlgebra.MatrixFields.CapacityB.CapB6_1_1I0 +import OAI.LinearAlgebra.MatrixFields.CapacityB.CapB6_1_1I1 +import OAI.LinearAlgebra.MatrixFields.CapacityB.CapB6_1_1I2 + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def capacityABalls (s : Shape) (i : Fin 3) : Ball := + match s 0, s 1, s 2 with + | 1, 1, 14 => ((Matrix.vecCons (CA1_1_14I0H) (Matrix.vecCons (CA1_1_14I1H) (Matrix.vecCons (CA1_1_14I2H) Matrix.vecEmpty))) i) + | 1, 2, 13 => ((Matrix.vecCons (CA1_2_13I0H) (Matrix.vecCons (CA1_2_13I1H) (Matrix.vecCons (CA1_2_13I2H) Matrix.vecEmpty))) i) + | 1, 3, 12 => ((Matrix.vecCons (CA1_3_12I0H) (Matrix.vecCons (CA1_3_12I1H) (Matrix.vecCons (CA1_3_12I2H) Matrix.vecEmpty))) i) + | 1, 4, 11 => ((Matrix.vecCons (CA1_4_11I0H) (Matrix.vecCons (CA1_4_11I1H) (Matrix.vecCons (CA1_4_11I2H) Matrix.vecEmpty))) i) + | 1, 5, 10 => ((Matrix.vecCons (CA1_5_10I0H) (Matrix.vecCons (CA1_5_10I1H) (Matrix.vecCons (CA1_5_10I2H) Matrix.vecEmpty))) i) + | 1, 6, 9 => ((Matrix.vecCons (CA1_6_9I0H) (Matrix.vecCons (CA1_6_9I1H) (Matrix.vecCons (CA1_6_9I2H) Matrix.vecEmpty))) i) + | 1, 7, 8 => ((Matrix.vecCons (CA1_7_8I0H) (Matrix.vecCons (CA1_7_8I1H) (Matrix.vecCons (CA1_7_8I2H) Matrix.vecEmpty))) i) + | 2, 2, 12 => ((Matrix.vecCons (CA2_2_12I0H) (Matrix.vecCons (CA2_2_12I1H) (Matrix.vecCons (CA2_2_12I2H) Matrix.vecEmpty))) i) + | 2, 3, 11 => ((Matrix.vecCons (CA2_3_11I0H) (Matrix.vecCons (CA2_3_11I1H) (Matrix.vecCons (CA2_3_11I2H) Matrix.vecEmpty))) i) + | 2, 4, 10 => ((Matrix.vecCons (CA2_4_10I0H) (Matrix.vecCons (CA2_4_10I1H) (Matrix.vecCons (CA2_4_10I2H) Matrix.vecEmpty))) i) + | 2, 5, 9 => ((Matrix.vecCons (CA2_5_9I0H) (Matrix.vecCons (CA2_5_9I1H) (Matrix.vecCons (CA2_5_9I2H) Matrix.vecEmpty))) i) + | 2, 6, 8 => ((Matrix.vecCons (CA2_6_8I0H) (Matrix.vecCons (CA2_6_8I1H) (Matrix.vecCons (CA2_6_8I2H) Matrix.vecEmpty))) i) + | 2, 7, 7 => ((Matrix.vecCons (CA2_7_7I0H) (Matrix.vecCons (CA2_7_7I1H) (Matrix.vecCons (CA2_7_7I2H) Matrix.vecEmpty))) i) + | 3, 3, 10 => ((Matrix.vecCons (CA3_3_10I0H) (Matrix.vecCons (CA3_3_10I1H) (Matrix.vecCons (CA3_3_10I2H) Matrix.vecEmpty))) i) + | 3, 4, 9 => ((Matrix.vecCons (CA3_4_9I0H) (Matrix.vecCons (CA3_4_9I1H) (Matrix.vecCons (CA3_4_9I2H) Matrix.vecEmpty))) i) + | 3, 5, 8 => ((Matrix.vecCons (CA3_5_8I0H) (Matrix.vecCons (CA3_5_8I1H) (Matrix.vecCons (CA3_5_8I2H) Matrix.vecEmpty))) i) + | 3, 6, 7 => ((Matrix.vecCons (CA3_6_7I0H) (Matrix.vecCons (CA3_6_7I1H) (Matrix.vecCons (CA3_6_7I2H) Matrix.vecEmpty))) i) + | 4, 4, 8 => ((Matrix.vecCons (CA4_4_8I0H) (Matrix.vecCons (CA4_4_8I1H) (Matrix.vecCons (CA4_4_8I2H) Matrix.vecEmpty))) i) + | 4, 5, 7 => ((Matrix.vecCons (CA4_5_7I0H) (Matrix.vecCons (CA4_5_7I1H) (Matrix.vecCons (CA4_5_7I2H) Matrix.vecEmpty))) i) + | 4, 6, 6 => ((Matrix.vecCons (CA4_6_6I0H) (Matrix.vecCons (CA4_6_6I1H) (Matrix.vecCons (CA4_6_6I2H) Matrix.vecEmpty))) i) + | 5, 5, 6 => ((Matrix.vecCons (CA5_5_6I0H) (Matrix.vecCons (CA5_5_6I1H) (Matrix.vecCons (CA5_5_6I2H) Matrix.vecEmpty))) i) + | _, _, _ => (.exact 0) +lemma capacityABalls_sound (s : Shape) (hs : s ∈ positiveInitial) (i : Fin 3) : + (capacityABalls s i).Encloses (stageACapacity s i) := by + rw [positiveInitial_list] at hs + simp only [List.mem_cons, List.not_mem_nil, or_false] at hs + rcases hs with rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl + · revert i + exact forall_fin3 CA1_1_14I0_sound CA1_1_14I1_sound CA1_1_14I2_sound + · revert i + exact forall_fin3 CA1_2_13I0_sound CA1_2_13I1_sound CA1_2_13I2_sound + · revert i + exact forall_fin3 CA1_3_12I0_sound CA1_3_12I1_sound CA1_3_12I2_sound + · revert i + exact forall_fin3 CA1_4_11I0_sound CA1_4_11I1_sound CA1_4_11I2_sound + · revert i + exact forall_fin3 CA1_5_10I0_sound CA1_5_10I1_sound CA1_5_10I2_sound + · revert i + exact forall_fin3 CA1_6_9I0_sound CA1_6_9I1_sound CA1_6_9I2_sound + · revert i + exact forall_fin3 CA1_7_8I0_sound CA1_7_8I1_sound CA1_7_8I2_sound + · revert i + exact forall_fin3 CA2_2_12I0_sound CA2_2_12I1_sound CA2_2_12I2_sound + · revert i + exact forall_fin3 CA2_3_11I0_sound CA2_3_11I1_sound CA2_3_11I2_sound + · revert i + exact forall_fin3 CA2_4_10I0_sound CA2_4_10I1_sound CA2_4_10I2_sound + · revert i + exact forall_fin3 CA2_5_9I0_sound CA2_5_9I1_sound CA2_5_9I2_sound + · revert i + exact forall_fin3 CA2_6_8I0_sound CA2_6_8I1_sound CA2_6_8I2_sound + · revert i + exact forall_fin3 CA2_7_7I0_sound CA2_7_7I1_sound CA2_7_7I2_sound + · revert i + exact forall_fin3 CA3_3_10I0_sound CA3_3_10I1_sound CA3_3_10I2_sound + · revert i + exact forall_fin3 CA3_4_9I0_sound CA3_4_9I1_sound CA3_4_9I2_sound + · revert i + exact forall_fin3 CA3_5_8I0_sound CA3_5_8I1_sound CA3_5_8I2_sound + · revert i + exact forall_fin3 CA3_6_7I0_sound CA3_6_7I1_sound CA3_6_7I2_sound + · revert i + exact forall_fin3 CA4_4_8I0_sound CA4_4_8I1_sound CA4_4_8I2_sound + · revert i + exact forall_fin3 CA4_5_7I0_sound CA4_5_7I1_sound CA4_5_7I2_sound + · revert i + exact forall_fin3 CA4_6_6I0_sound CA4_6_6I1_sound CA4_6_6I2_sound + · revert i + exact forall_fin3 CA5_5_6I0_sound CA5_5_6I1_sound CA5_5_6I2_sound +def nativeLABall (i : Fin 3) : Ball := (Matrix.vecCons (⟨(117985629820354604769702009255473 / 100000000000000000000000000000000), (25286853793 / 25000000000000000000000000000000)⟩) (Matrix.vecCons (⟨(14553362614718917509713695395419 / 12500000000000000000000000000000), (495362055017 / 100000000000000000000000000000000)⟩) (Matrix.vecCons (⟨(13508474414138305071843256242429 / 12500000000000000000000000000000), (467443928227 / 100000000000000000000000000000000)⟩) Matrix.vecEmpty))) i +lemma nativeLABall_sound_0 : (nativeLABall 0).Encloses (nativeLA 0) := by + exact contains_sound (listSumBall_sound positiveInitial + (fun s => .mul (initialProbs s) (capacityABalls s 0)) _ + (fun s hs => Ball.mul_sound (initialProbs_sound s (List.mem_filter.mp hs).1) + (capacityABalls_sound s hs 0))) (by decide +kernel) +lemma nativeLABall_sound_1 : (nativeLABall 1).Encloses (nativeLA 1) := by + exact contains_sound (listSumBall_sound positiveInitial + (fun s => .mul (initialProbs s) (capacityABalls s 1)) _ + (fun s hs => Ball.mul_sound (initialProbs_sound s (List.mem_filter.mp hs).1) + (capacityABalls_sound s hs 1))) (by decide +kernel) +lemma nativeLABall_sound_2 : (nativeLABall 2).Encloses (nativeLA 2) := by + exact contains_sound (listSumBall_sound positiveInitial + (fun s => .mul (initialProbs s) (capacityABalls s 2)) _ + (fun s hs => Ball.mul_sound (initialProbs_sound s (List.mem_filter.mp hs).1) + (capacityABalls_sound s hs 2))) (by decide +kernel) +lemma nativeLABall_sound (i : Fin 3) : (nativeLABall i).Encloses (nativeLA i) := by + revert i + exact forall_fin3 nativeLABall_sound_0 nativeLABall_sound_1 nativeLABall_sound_2 + +theorem native_stageA_positive (i : Fin 3) : 0 < nativeLA i := by + have hp : 0 < (nativeLABall i).lower := by fin_cases i <;> decide +kernel + have hp' : (0 : ℝ) < (nativeLABall i).lower := by exact_mod_cast hp + exact hp'.trans_le (Ball.bounds (nativeLABall_sound i)).1 +def capacityBBalls (s : Shape) (i : Fin 3) : Ball := + match s 0, s 1, s 2 with + | 1, 1, 6 => ((Matrix.vecCons (CB1_1_6I0H) (Matrix.vecCons (CB1_1_6I1H) (Matrix.vecCons (CB1_1_6I2H) Matrix.vecEmpty))) i) + | 1, 2, 5 => ((Matrix.vecCons (CB1_2_5I0H) (Matrix.vecCons (CB1_2_5I1H) (Matrix.vecCons (CB1_2_5I2H) Matrix.vecEmpty))) i) + | 1, 3, 4 => ((Matrix.vecCons (CB1_3_4I0H) (Matrix.vecCons (CB1_3_4I1H) (Matrix.vecCons (CB1_3_4I2H) Matrix.vecEmpty))) i) + | 1, 4, 3 => ((Matrix.vecCons (CB1_4_3I0H) (Matrix.vecCons (CB1_4_3I1H) (Matrix.vecCons (CB1_4_3I2H) Matrix.vecEmpty))) i) + | 1, 5, 2 => ((Matrix.vecCons (CB1_5_2I0H) (Matrix.vecCons (CB1_5_2I1H) (Matrix.vecCons (CB1_5_2I2H) Matrix.vecEmpty))) i) + | 1, 6, 1 => ((Matrix.vecCons (CB1_6_1I0H) (Matrix.vecCons (CB1_6_1I1H) (Matrix.vecCons (CB1_6_1I2H) Matrix.vecEmpty))) i) + | 2, 1, 5 => ((Matrix.vecCons (CB2_1_5I0H) (Matrix.vecCons (CB2_1_5I1H) (Matrix.vecCons (CB2_1_5I2H) Matrix.vecEmpty))) i) + | 2, 2, 4 => ((Matrix.vecCons (CB2_2_4I0H) (Matrix.vecCons (CB2_2_4I1H) (Matrix.vecCons (CB2_2_4I2H) Matrix.vecEmpty))) i) + | 2, 3, 3 => ((Matrix.vecCons (CB2_3_3I0H) (Matrix.vecCons (CB2_3_3I1H) (Matrix.vecCons (CB2_3_3I2H) Matrix.vecEmpty))) i) + | 2, 4, 2 => ((Matrix.vecCons (CB2_4_2I0H) (Matrix.vecCons (CB2_4_2I1H) (Matrix.vecCons (CB2_4_2I2H) Matrix.vecEmpty))) i) + | 2, 5, 1 => ((Matrix.vecCons (CB2_5_1I0H) (Matrix.vecCons (CB2_5_1I1H) (Matrix.vecCons (CB2_5_1I2H) Matrix.vecEmpty))) i) + | 3, 1, 4 => ((Matrix.vecCons (CB3_1_4I0H) (Matrix.vecCons (CB3_1_4I1H) (Matrix.vecCons (CB3_1_4I2H) Matrix.vecEmpty))) i) + | 3, 2, 3 => ((Matrix.vecCons (CB3_2_3I0H) (Matrix.vecCons (CB3_2_3I1H) (Matrix.vecCons (CB3_2_3I2H) Matrix.vecEmpty))) i) + | 3, 3, 2 => ((Matrix.vecCons (CB3_3_2I0H) (Matrix.vecCons (CB3_3_2I1H) (Matrix.vecCons (CB3_3_2I2H) Matrix.vecEmpty))) i) + | 3, 4, 1 => ((Matrix.vecCons (CB3_4_1I0H) (Matrix.vecCons (CB3_4_1I1H) (Matrix.vecCons (CB3_4_1I2H) Matrix.vecEmpty))) i) + | 4, 1, 3 => ((Matrix.vecCons (CB4_1_3I0H) (Matrix.vecCons (CB4_1_3I1H) (Matrix.vecCons (CB4_1_3I2H) Matrix.vecEmpty))) i) + | 4, 2, 2 => ((Matrix.vecCons (CB4_2_2I0H) (Matrix.vecCons (CB4_2_2I1H) (Matrix.vecCons (CB4_2_2I2H) Matrix.vecEmpty))) i) + | 4, 3, 1 => ((Matrix.vecCons (CB4_3_1I0H) (Matrix.vecCons (CB4_3_1I1H) (Matrix.vecCons (CB4_3_1I2H) Matrix.vecEmpty))) i) + | 5, 1, 2 => ((Matrix.vecCons (CB5_1_2I0H) (Matrix.vecCons (CB5_1_2I1H) (Matrix.vecCons (CB5_1_2I2H) Matrix.vecEmpty))) i) + | 5, 2, 1 => ((Matrix.vecCons (CB5_2_1I0H) (Matrix.vecCons (CB5_2_1I1H) (Matrix.vecCons (CB5_2_1I2H) Matrix.vecEmpty))) i) + | 6, 1, 1 => ((Matrix.vecCons (CB6_1_1I0H) (Matrix.vecCons (CB6_1_1I1H) (Matrix.vecCons (CB6_1_1I2H) Matrix.vecEmpty))) i) + | _, _, _ => (.exact 0) +lemma capacityBBalls_sound (s : Shape) (hs : s ∈ positiveSecond) (i : Fin 3) : + (capacityBBalls s i).Encloses (stageBCapacity s i) := by + rw [positiveSecond_list] at hs + simp only [List.mem_cons, List.not_mem_nil, or_false] at hs + rcases hs with rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl + · revert i + exact forall_fin3 CB1_1_6I0_sound CB1_1_6I1_sound CB1_1_6I2_sound + · revert i + exact forall_fin3 CB1_2_5I0_sound CB1_2_5I1_sound CB1_2_5I2_sound + · revert i + exact forall_fin3 CB1_3_4I0_sound CB1_3_4I1_sound CB1_3_4I2_sound + · revert i + exact forall_fin3 CB1_4_3I0_sound CB1_4_3I1_sound CB1_4_3I2_sound + · revert i + exact forall_fin3 CB1_5_2I0_sound CB1_5_2I1_sound CB1_5_2I2_sound + · revert i + exact forall_fin3 CB1_6_1I0_sound CB1_6_1I1_sound CB1_6_1I2_sound + · revert i + exact forall_fin3 CB2_1_5I0_sound CB2_1_5I1_sound CB2_1_5I2_sound + · revert i + exact forall_fin3 CB2_2_4I0_sound CB2_2_4I1_sound CB2_2_4I2_sound + · revert i + exact forall_fin3 CB2_3_3I0_sound CB2_3_3I1_sound CB2_3_3I2_sound + · revert i + exact forall_fin3 CB2_4_2I0_sound CB2_4_2I1_sound CB2_4_2I2_sound + · revert i + exact forall_fin3 CB2_5_1I0_sound CB2_5_1I1_sound CB2_5_1I2_sound + · revert i + exact forall_fin3 CB3_1_4I0_sound CB3_1_4I1_sound CB3_1_4I2_sound + · revert i + exact forall_fin3 CB3_2_3I0_sound CB3_2_3I1_sound CB3_2_3I2_sound + · revert i + exact forall_fin3 CB3_3_2I0_sound CB3_3_2I1_sound CB3_3_2I2_sound + · revert i + exact forall_fin3 CB3_4_1I0_sound CB3_4_1I1_sound CB3_4_1I2_sound + · revert i + exact forall_fin3 CB4_1_3I0_sound CB4_1_3I1_sound CB4_1_3I2_sound + · revert i + exact forall_fin3 CB4_2_2I0_sound CB4_2_2I1_sound CB4_2_2I2_sound + · revert i + exact forall_fin3 CB4_3_1I0_sound CB4_3_1I1_sound CB4_3_1I2_sound + · revert i + exact forall_fin3 CB5_1_2I0_sound CB5_1_2I1_sound CB5_1_2I2_sound + · revert i + exact forall_fin3 CB5_2_1I0_sound CB5_2_1I1_sound CB5_2_1I2_sound + · revert i + exact forall_fin3 CB6_1_1I0_sound CB6_1_1I1_sound CB6_1_1I2_sound +def nativeLBBall (i : Fin 3) : Ball := (Matrix.vecCons (⟨(36915911542259422191174414642177 / 25000000000000000000000000000000), (143554434849 / 100000000000000000000000000000000)⟩) (Matrix.vecCons (⟨(32908978604932824344186869459233 / 20000000000000000000000000000000), (610647767219 / 100000000000000000000000000000000)⟩) (Matrix.vecCons (⟨(64721008843697680778152495140253 / 50000000000000000000000000000000), (102799797137 / 20000000000000000000000000000000)⟩) Matrix.vecEmpty))) i +lemma nativeLBBall_sound_0 : (nativeLBBall 0).Encloses (nativeLB 0) := by + exact contains_sound (listSumBall_sound positiveSecond + (fun s => .mul (secondProbs s) (capacityBBalls s 0)) _ + (fun s hs => Ball.mul_sound (secondProbs_sound s (List.mem_filter.mp hs).1) + (capacityBBalls_sound s hs 0))) (by decide +kernel) +lemma nativeLBBall_sound_1 : (nativeLBBall 1).Encloses (nativeLB 1) := by + exact contains_sound (listSumBall_sound positiveSecond + (fun s => .mul (secondProbs s) (capacityBBalls s 1)) _ + (fun s hs => Ball.mul_sound (secondProbs_sound s (List.mem_filter.mp hs).1) + (capacityBBalls_sound s hs 1))) (by decide +kernel) +lemma nativeLBBall_sound_2 : (nativeLBBall 2).Encloses (nativeLB 2) := by + exact contains_sound (listSumBall_sound positiveSecond + (fun s => .mul (secondProbs s) (capacityBBalls s 2)) _ + (fun s hs => Ball.mul_sound (secondProbs_sound s (List.mem_filter.mp hs).1) + (capacityBBalls_sound s hs 2))) (by decide +kernel) +lemma nativeLBBall_sound (i : Fin 3) : (nativeLBBall i).Encloses (nativeLB i) := by + revert i + exact forall_fin3 nativeLBBall_sound_0 nativeLBBall_sound_1 nativeLBBall_sound_2 + +theorem native_stageB_positive (i : Fin 3) : 0 < nativeLB i := by + have hp : 0 < (nativeLBBall i).lower := by fin_cases i <;> decide +kernel + have hp' : (0 : ℝ) < (nativeLBBall i).lower := by exact_mod_cast hp + exact hp'.trans_le (Ball.bounds (nativeLBBall_sound i)).1 + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +open AllFieldTerminalRates AllFieldInitialEntropy +def nativeCstarBall : Ball := ⟨(23573978636551704730344303484969 / 6250000000000000000000000000000), (4390100049 / 500000000000000000000000000000)⟩ +lemma nativeCstarBall_sound : nativeCstarBall.Encloses nativeCstar := by + have hb := contains_sound (Ball.add_sound nativeBBall_sound + (Ball.mul_sound (finSumBall_sound 3 (fun i => .add (nativeLABall i) (nativeLBBall i)) + (fun i => nativeLA i + nativeLB i) + (fun i => Ball.add_sound (nativeLABall_sound i) (nativeLBBall_sound i))) + (show (Ball.exact (1/3)).Encloses (1/(3 : ℝ)) by + convert Ball.exact_sound (1/3) using 1 + norm_num))) + (show contains (.add nativeBBall + (.mul (finSumBall 3 (fun i => .add (nativeLABall i) (nativeLBBall i))) (.exact (1/3)))) + nativeCstarBall = true by decide +kernel) + simpa only [nativeCstar, Staggering.totalCapacity, one_div, div_eq_mul_inv, one_mul] using hb +def nativeCBall (i : Fin 3) : Ball := (Matrix.vecCons (⟨(111534382195434982151109187935323 / 100000000000000000000000000000000), (1122721859821 / 100000000000000000000000000000000)⟩) (Matrix.vecCons (⟨(96211864242411813886864945299987 / 100000000000000000000000000000000), (496007458009 / 25000000000000000000000000000000)⟩) (Matrix.vecCons (⟨(69836922592162736777228907769783 / 50000000000000000000000000000000), (29054108183 / 1562500000000000000000000000000)⟩) Matrix.vecEmpty))) i +lemma nativeCBall_sound (i : Fin 3) : + (nativeCBall i).Encloses (nativeCstar - (nativeLA i + nativeLB i)) := by + have hcheck : contains (.add nativeCstarBall (.neg (.add (nativeLABall i) (nativeLBBall i)))) + (nativeCBall i) = true := by fin_cases i <;> decide +kernel + simpa only [sub_eq_add_neg] using contains_sound (Ball.add_sound nativeCstarBall_sound + (Ball.neg_sound (Ball.add_sound (nativeLABall_sound i) (nativeLBBall_sound i)))) hcheck + +theorem native_stageC_feasible (i : Fin 3) : + nativeCstar - (nativeLA i + nativeLB i) < nativeHigh := by + have hp : (nativeCBall i).upper < nativeHighBall.lower := by fin_cases i <;> decide +kernel + have hp' : ((nativeCBall i).upper : ℝ) < nativeHighBall.lower := by exact_mod_cast hp + exact (Ball.bounds (nativeCBall_sound i)).2.trans_lt + (hp'.trans_le (Ball.bounds nativeHighBall_sound).1) + +theorem native_stageC_balanced_positive (i : Fin 3) : 0 < nativeLC nativeLambda i := by + rw [nativeLC_balanced native_denominator_gap] + have hp : 0 < (nativeCBall i).lower := by fin_cases i <;> decide +kernel + have hp' : (0 : ℝ) < (nativeCBall i).lower := by exact_mod_cast hp + exact hp'.trans_le (Ball.bounds (nativeCBall_sound i)).1 +def nativeGapBall : Ball := ⟨(132303397031313521 / 100000000000000000000000000000000), (970498095253 / 50000000000000000000000000000000)⟩ +lemma nativeGapBall_sound : nativeGapBall.Encloses + (nativeH0 + nativeCstar + ((2371054886006746 : ℝ)/10^15)*S/3 - 8*Real.log 7) := by + have ht : (Ball.exact (2371054886006746 / 10^15)).Encloses ((2371054886006746 : ℝ)/10^15) := by + convert Ball.exact_sound (2371054886006746 / 10^15) using 1 + norm_num + have hi : (Ball.exact (1/3)).Encloses (1/(3 : ℝ)) := by + convert Ball.exact_sound (1/3) using 1 + norm_num + have he : (Ball.exact 8).Encloses (8 : ℝ) := by + simpa only [Rat.cast_ofNat] using Ball.exact_sound 8 + have hb := contains_sound (Ball.add_sound + (Ball.add_sound (Ball.add_sound nativeH0_enclosed nativeCstarBall_sound) + (Ball.mul_sound (Ball.mul_sound ht nativeSBall_sound) hi)) + (Ball.neg_sound (Ball.mul_sound he logN7_sound))) + (show contains (.add (.add (.add initialEntropyBall nativeCstarBall) + (.mul (.mul (.exact (2371054886006746 / 10^15)) nativeSBall) (.exact (1/3)))) + (.neg (.mul (.exact 8) logN7))) nativeGapBall = true by decide +kernel) + simpa only [one_div, div_eq_mul_inv, one_mul, sub_eq_add_neg] using hb + +theorem native_sharp_gap : + 0 < nativeH0 + nativeCstar + ((2371054886006746 : ℝ)/10^15)*S/3 - 8*Real.log 7 := by + have hp : (0 : ℝ) < nativeGapBall.lower := by norm_num [nativeGapBall, Ball.lower] + exact hp.trans_le (Ball.bounds nativeGapBall_sound).1 + +theorem native_sharp_rate_bound : + 3 * (8 * Real.log 7 - (nativeH0 + nativeCstar)) / S < (2371054886006746 : ℝ)/10^15 := by + apply (div_lt_iff₀ native_volume_positive).mpr + have hg := native_sharp_gap + linarith + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/Certificates/SparseContraction.lean b/lean/OAI/LinearAlgebra/MatrixFields/Certificates/SparseContraction.lean new file mode 100644 index 0000000000000000000000000000000000000000..b67cf956bb944555d5e602be25ffdd54e97c1e88 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/Certificates/SparseContraction.lean @@ -0,0 +1,1525 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Entropy.InitialEntropy + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section + +namespace MatrixMultiplication.AllFieldInitialEntropyCertificate +open AllFieldParameters AllFieldCertificates AllFieldCertificates.Replay +open scoped BigOperators + +def exponentialCoefficients : List ℚ := + (List.range 17).map (fun j => 1 / (Nat.factorial j : ℚ)) + +lemma exponential_polynomial_cast (n : ℤ) : + (((∑ j ∈ Finset.range 17, ((n : ℚ) / 640000) ^ j / + Nat.factorial j : ℚ) : ℝ)) = + polynomial (((n : ℚ) / 640000 : ℚ) : ℝ) exponentialCoefficients := by + simp only [Rat.cast_sum, Rat.cast_div, Rat.cast_pow, Rat.cast_natCast] + norm_num [Finset.sum_range_succ, exponentialCoefficients, List.range_succ, + polynomial, List.map_append] + ring + +lemma weight_enclosed_of_trace (n : ℤ) (trace : List Ball) + (b₁ b₂ b₃ b₄ b₅ b₆ : Ball) + (hp : checkPolynomial (.exact ((n : ℚ) / 640000)) + exponentialCoefficients trace = true) + (h₁ : contains (.mul (traceHead trace) (traceHead trace)) b₁ = true) + (h₂ : contains (.mul b₁ b₁) b₂ = true) + (h₃ : contains (.mul b₂ b₂) b₃ = true) + (h₄ : contains (.mul b₃ b₃) b₄ = true) + (h₅ : contains (.mul b₄ b₄) b₅ = true) + (h₆ : contains (.mul b₅ b₅) b₆ = true) : + b₆.Encloses (weight n : ℝ) := by + have p := checkPolynomial_sound (Ball.exact_sound ((n : ℚ) / 640000)) + exponentialCoefficients trace hp + rw [← exponential_polynomial_cast] at p + have p₁ := contains_sound (Ball.mul_sound p p) h₁ + have p₂ := contains_sound (Ball.mul_sound p₁ p₁) h₂ + have p₃ := contains_sound (Ball.mul_sound p₂ p₂) h₃ + have p₄ := contains_sound (Ball.mul_sound p₃ p₃) h₄ + have p₅ := contains_sound (Ball.mul_sound p₄ p₄) h₅ + have p₆ := contains_sound (Ball.mul_sound p₅ p₅) h₆ + convert p₆ using 1 + simp only [weight, Rat.cast_pow] + ring + +def weightTrace0 : List Ball := [ + ⟨(45822469347703230916837028446061 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(95761729883054217060631522574569 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1518032241603819172753264716571 / 3125000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(3261876795622354777174156430543 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4095003862446164503471876088913 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(205341225223953618638702205277 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(137176467343829037379890181127 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(19626959451965561090978938867 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1228161761087584971721304317 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(54637558371312300664525013 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(27340322092271316640462777 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2487117682933565567802199 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(103687562373860905549233 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(15959542323714148962659 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(285109727917665106419 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(76054635388880697247 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def weightSquare0_1 : Ball := ⟨(83987947884848086426829976722031 / 100000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +def weightSquare0_2 : Ball := ⟨(70539753899079581546921669791051 / 100000000000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ +def weightSquare0_3 : Ball := ⟨(49758568801427130276705189494043 / 100000000000000000000000000000000), (1 / 10000000000000000000000000000000)⟩ +def weightSquare0_4 : Ball := ⟨(12379575845831786800610165591697 / 50000000000000000000000000000000), (11 / 100000000000000000000000000000000)⟩ +def weightSquare0_5 : Ball := ⟨(61301559249080719838295497489 / 1000000000000000000000000000000), (7 / 100000000000000000000000000000000)⟩ +def weightSquare0_6 : Ball := ⟨(375788116636855394790068879267 / 100000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ +lemma weight_enclosed_0 : weightSquare0_6.Encloses (weight (-55839) : ℝ) := by + exact weight_enclosed_of_trace (-55839) weightTrace0 weightSquare0_1 weightSquare0_2 weightSquare0_3 weightSquare0_4 weightSquare0_5 weightSquare0_6 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def weightTrace1 : List Ball := [ + ⟨(47255022421610958409873827160341 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(97229191696542968020629859555673 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(49072067803428631784511439365999 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(16434031762616588480302150310221 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(164802101549160184047696785151 / 4000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(825553916487359822440105826453 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(137776428077124469979954185547 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(9851051824020091619644825781 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2464686157317462422255187163 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(137012571857256431690259327 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(13708263777035553765322303 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2493473966999507375380809 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(103932227199065796269981 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(3198903658586015670193 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(571385949173744347803 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(76201768611384910161 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def weightSquare1_1 : Ball := ⟨(89321485762678176318205827626583 / 100000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +def weightSquare1_2 : Ball := ⟨(1595665563770464030669190950117 / 2000000000000000000000000000000), (7 / 100000000000000000000000000000000)⟩ +def weightSquare1_3 : Ball := ⟨(31826857392536410151645281386261 / 50000000000000000000000000000000), (3 / 25000000000000000000000000000000)⟩ +def weightSquare1_4 : Ball := ⟨(810359081187879632371486932441 / 2000000000000000000000000000000), (17 / 100000000000000000000000000000000)⟩ +def weightSquare1_5 : Ball := ⟨(16417046011591612337241268965321 / 100000000000000000000000000000000), (7 / 50000000000000000000000000000000)⟩ +def weightSquare1_6 : Ball := ⟨(2695193997467160660436803279809 / 100000000000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ +lemma weight_enclosed_1 : weightSquare1_6.Encloses (weight (-36137) : ℝ) := by + exact weight_enclosed_of_trace (-36137) weightTrace1 weightSquare1_1 weightSquare1_2 weightSquare1_3 weightSquare1_4 weightSquare1_5 weightSquare1_6 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def weightTrace2 : List Ball := [ + ⟨(19462084945085296406442948535709 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(98649101709384577877389230656831 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(24774339675450460154475682836493 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(16553683043349819604053296423209 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(518006181749542381171965125597 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(103695169558496726647696312179 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(138349773272399157380263337543 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(308966483173666977262623271 / 1562500000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2472665918923664623838816993 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(137411862870134171885457943 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(3436146482162016182737377 / 12500000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩, + ⟨(2499530900421064933309269 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(208330586210581940821979 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(125217395867685532157 / 781250000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(143124148124781859341 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(19085332337372655453 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def weightSquare2_1 : Ball := ⟨(94693187602428936210099773718353 / 100000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +def weightSquare2_2 : Ball := ⟨(44833998891544005922143607529859 / 50000000000000000000000000000000), (7 / 100000000000000000000000000000000)⟩ +def weightSquare2_3 : Ball := ⟨(10050437283034845758507319035581 / 12500000000000000000000000000000), (13 / 100000000000000000000000000000000)⟩ +def weightSquare2_4 : Ball := ⟨(64647225331338785478344935394587 / 100000000000000000000000000000000), (11 / 50000000000000000000000000000000)⟩ +def weightSquare2_5 : Ball := ⟨(41792637430408911418759860943933 / 100000000000000000000000000000000), (29 / 100000000000000000000000000000000)⟩ +def weightSquare2_6 : Ball := ⟨(2183280679237019972788253432353 / 12500000000000000000000000000000), (1 / 4000000000000000000000000000000)⟩ +lemma weight_enclosed_2 : weightSquare2_6.Encloses (weight (-17449) : ℝ) := by + exact weight_enclosed_of_trace (-17449) weightTrace2 weightSquare2_1 weightSquare2_2 weightSquare2_3 weightSquare2_4 weightSquare2_5 weightSquare2_6 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def weightTrace3 : List Ball := [ + ⟨(99722261409261526095071612219837 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(99861066332934437727060774889811 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(49953678046044862180395545236147 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(8327542284069720378328946310521 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(26027187701631258446683248593 / 625000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(832947202036967261967421765977 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(27766744907223109458809337961 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(9917187015432196825563880161 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2479392505329480885756231427 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(55099313563992663293648747 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(27550353220886312747669859 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2504630327938123105603659 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(208722914534389897186987 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(8027927063567209908089 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(229372382000523736751 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(76458344396867462343 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def weightSquare3_1 : Ball := ⟨(99445294205770906125170809966217 / 100000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +def weightSquare3_2 : Ball := ⟨(9889366539672332554869689802191 / 10000000000000000000000000000000), (7 / 100000000000000000000000000000000)⟩ +def weightSquare3_3 : Ball := ⟨(24449892638997681165967353683633 / 25000000000000000000000000000000), (7 / 50000000000000000000000000000000)⟩ +def weightSquare3_4 : Ball := ⟨(23911890002340519753388331266581 / 25000000000000000000000000000000), (7 / 25000000000000000000000000000000)⟩ +def weightSquare3_5 : Ball := ⟨(45742278678722600142174067342087 / 50000000000000000000000000000000), (11 / 20000000000000000000000000000000)⟩ +def weightSquare3_6 : Ball := ⟨(83694242348876807273467974770337 / 100000000000000000000000000000000), (51 / 50000000000000000000000000000000)⟩ +lemma weight_enclosed_3 : weightSquare3_6.Encloses (weight (-1780) : ℝ) := by + exact weight_enclosed_of_trace (-1780) weightTrace3 weightSquare3_1 weightSquare3_2 weightSquare3_3 weightSquare3_4 weightSquare3_5 weightSquare3_6 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def weightTrace4 : List Ball := [ + ⟨(50911410227239288182312346605491 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(20181733256055512038055594758737 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(50302432261710796797673490870941 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(8371103169920852457012116486571 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2090882745092313740543310965499 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(104481089995403957581214526993 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(34812028439039215519527827849 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(19886161668670775979789845573 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(621286427138617212332161333 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(276071808085179654271380119 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(27602641726950831010849701 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2508987275976284863517391 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(52264509050953876130863 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(16079789645021142467363 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1148457507801906020393 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(76557974095447743761 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def weightSquare4_1 : Ball := ⟨(1036788676530498075661364538317 / 1000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +def weightSquare4_2 : Ball := ⟨(107493075978186177125241613635047 / 100000000000000000000000000000000), (1 / 12500000000000000000000000000000)⟩ +def weightSquare4_3 : Ball := ⟨(14443451729065132700277449317601 / 12500000000000000000000000000000), (9 / 50000000000000000000000000000000)⟩ +def weightSquare4_4 : Ball := ⟨(133512510623894125738161773133231 / 100000000000000000000000000000000), (21 / 50000000000000000000000000000000)⟩ +def weightSquare4_5 : Ball := ⟨(11140994058184651120224401477951 / 6250000000000000000000000000000), (113 / 100000000000000000000000000000000)⟩ +def weightSquare4_6 : Ball := ⟨(317751676427534595662029560374059 / 100000000000000000000000000000000), (101 / 25000000000000000000000000000000)⟩ +lemma weight_enclosed_4 : weightSquare4_6.Encloses (weight (11561) : ℝ) := by + exact weight_enclosed_of_trace (11561) weightTrace4 weightSquare4_1 weightSquare4_2 weightSquare4_3 weightSquare4_4 weightSquare4_5 weightSquare4_6 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def weightTrace5 : List Ball := [ + ⟨(103600813901653687360089808813237 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(101789792272895755762256079526159 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(12648708642372832242092434813847 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(16815111505055235854974961283079 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2098160259909105135099570549999 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(167654293436288924565226478201 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(17449236212407383366781122517 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4982337882474756504311598923 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(31124271600418638659055071 / 1250000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(276551176671687180049383751 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(27646203019880523641287881 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2512616138364183427012361 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4186741947709709968707 / 2000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(8049858753420616865717 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(574892862468114940523 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(76640711328831368513 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def weightSquare5_1 : Ball := ⟨(13416410801356349903607034777723 / 12500000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +def weightSquare5_2 : Ball := ⟨(115200050426080854395202845284257 / 100000000000000000000000000000000), (7 / 100000000000000000000000000000000)⟩ +def weightSquare5_3 : Ball := ⟨(132710516181715716422850695559233 / 100000000000000000000000000000000), (9 / 50000000000000000000000000000000)⟩ +def weightSquare5_4 : Ball := ⟨(176120811052174290165929815923193 / 100000000000000000000000000000000), (49 / 100000000000000000000000000000000)⟩ +def weightSquare5_5 : Ball := ⟨(62037080171351355194935848106531 / 20000000000000000000000000000000), (87 / 50000000000000000000000000000000)⟩ +def weightSquare5_6 : Ball := ⟨(962149829046668872508647133711623 / 100000000000000000000000000000000), (27 / 2500000000000000000000000000000)⟩ +lemma weight_enclosed_5 : weightSquare5_6.Encloses (weight (22640) : ℝ) := by + exact weight_enclosed_of_trace (22640) weightTrace5 weightSquare5_1 weightSquare5_2 weightSquare5_3 weightSquare5_4 weightSquare5_5 weightSquare5_6 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def weightTrace6 : List Ball := [ + ⟨(52496907097213613827039425021221 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(102476628332481265185663204667291 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(50822179453251562101591990094477 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(16871708672598427120010057088159 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(84152163522076882223784705499 / 2000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(840148968827547918893289383799 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(69930850267688450018787230643 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(159702309542728519984293019 / 800000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2493653488700243236021188337 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(276922068313722247860040669 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(27679898912162961846196791 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(503084522465855867187777 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(26194110004123274166153 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(3223024873382905372317 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(46032498729593238173 / 4000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(9588068402869008441 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def weightSquare6_1 : Ball := ⟨(11023701019093908391497969098631 / 10000000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ +def weightSquare6_2 : Ball := ⟨(121521984158372074423106444564011 / 100000000000000000000000000000000), (1 / 10000000000000000000000000000000)⟩ +def weightSquare6_3 : Ball := ⟨(18459490792234541766581018912859 / 12500000000000000000000000000000), (1 / 4000000000000000000000000000000)⟩ +def weightSquare6_4 : Ball := ⟨(218081792197498771472088623185963 / 100000000000000000000000000000000), (3 / 4000000000000000000000000000000)⟩ +def weightSquare6_5 : Ball := ⟨(237798340440365180199344472936997 / 50000000000000000000000000000000), (41 / 12500000000000000000000000000000)⟩ +def weightSquare6_6 : Ball := ⟨(226192202864767271537325845748747 / 10000000000000000000000000000000), (39 / 1250000000000000000000000000000)⟩ +lemma weight_enclosed_6 : weightSquare6_6.Encloses (weight (31188) : ℝ) := by + exact weight_enclosed_of_trace (31188) weightTrace6 weightSquare6_1 weightSquare6_2 weightSquare6_3 weightSquare6_4 weightSquare6_5 weightSquare6_6 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def weightTrace7 : List Ball := [ + ⟨(13238388542478214491069816710213 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(102925303898300024346667979534741 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(25485209971305104433142398821633 / 50000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩, + ⟨(8454286069948186469498114558423 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4214954748496148057251911685369 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(841370296775696005405701232473 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(140035844466856609575439150853 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4996131128333977017996839571 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(499213144876440899368362439 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(27716305853430552915679447 / 10000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(27701789454298507636100787 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2517245580029807777294919 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(41938605269701210777891 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(16125129745665541975627 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1151479177264804137941 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(38372970988705270699 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def weightSquare7_1 : Ball := ⟨(11216315596903581711527855028257 / 10000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +def weightSquare7_2 : Ball := ⟨(125805735569342550503356966593139 / 100000000000000000000000000000000), (1 / 12500000000000000000000000000000)⟩ +def weightSquare7_3 : Ball := ⟨(158270831021433413898498261129081 / 100000000000000000000000000000000), (21 / 100000000000000000000000000000000)⟩ +def weightSquare7_4 : Ball := ⟨(31312069940268911822779912641567 / 12500000000000000000000000000000), (67 / 100000000000000000000000000000000)⟩ +def weightSquare7_5 : Ball := ⟨(125497052664869372826269098660877 / 20000000000000000000000000000000), (337 / 100000000000000000000000000000000)⟩ +def weightSquare7_6 : Ball := ⟨(393737755689224923790566075091771 / 10000000000000000000000000000000), (423 / 10000000000000000000000000000000)⟩ +lemma weight_enclosed_7 : weightSquare7_6.Encloses (weight (36731) : ℝ) := by + exact weight_enclosed_of_trace (36731) weightTrace7 weightSquare7_1 weightSquare7_2 weightSquare7_3 weightSquare7_4 weightSquare7_5 weightSquare7_6 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def weightTrace8 : List Ball := [ + ⟨(53107840245772877522502511762089 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(103076607534767528536346359585271 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(5102036178196093237793563948317 / 10000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(3384196825616027372211588988827 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(131794605971792912907148072173 / 3125000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(420890623113675921432978149363 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(70047213901119971249691626091 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2498979428084996990116058961 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2496876982418733363454750399 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(34655512160242955405574419 / 12500000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩, + ⟨(27709150025502850262332103 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(62946462422495109382441 / 2500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(41948028645634175042909 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(16128493345257602942617 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(28792582462514276983 / 2500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(76759847269274455947 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def weightSquare8_1 : Ball := ⟨(28204426955705333720136269142093 / 25000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +def weightSquare8_2 : Ball := ⟨(31819587995988705552098445079421 / 25000000000000000000000000000000), (7 / 100000000000000000000000000000000)⟩ +def weightSquare8_3 : Ball := ⟨(161997788837514964265321695821339 / 100000000000000000000000000000000), (19 / 100000000000000000000000000000000)⟩ +def weightSquare8_4 : Ball := ⟨(52486567176488175914387270062549 / 20000000000000000000000000000000), (63 / 100000000000000000000000000000000)⟩ +def weightSquare8_5 : Ball := ⟨(344354966746500746353077958219731 / 50000000000000000000000000000000), (83 / 25000000000000000000000000000000)⟩ +def weightSquare8_6 : Ball := ⟨(592901715614918174080204664509561 / 12500000000000000000000000000000), (2287 / 50000000000000000000000000000000)⟩ +lemma weight_enclosed_8 : weightSquare8_6.Encloses (weight (38593) : ℝ) := by + exact weight_enclosed_of_trace (38593) weightTrace8 weightSquare8_1 weightSquare8_2 weightSquare8_3 weightSquare8_4 weightSquare8_5 weightSquare8_6 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def weightTrace9 : List Ball := [ + ⟨(105769353286979812971192319657867 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(12857213854765865443628769642581 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(50948101186729931232361150203779 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(16903024110177614037303920285779 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(842769869335374211420370584613 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(52574160131711393877303756643 / 6250000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(140009649991401748572542612153 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(19981255379359022718212237153 / 100000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩, + ⟨(62392573665020423810114129 / 2500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(277126818288917152811301887 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(27698497726817026655144159 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(39327679210857430103861 / 1562500000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(104835977052347421176833 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(16123625401104954019783 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(287844734674196536367 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(38369860594472552971 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def weightSquare9_1 : Ball := ⟨(699197255921621710400340726909 / 625000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +def weightSquare9_2 : Ball := ⟨(31288115372052849022082108910093 / 25000000000000000000000000000000), (1 / 12500000000000000000000000000000)⟩ +def weightSquare9_3 : Ball := ⟨(783156930827911832787526073193 / 500000000000000000000000000000), (21 / 100000000000000000000000000000000)⟩ +def weightSquare9_4 : Ball := ⟨(61333477830379467923854252642317 / 25000000000000000000000000000000), (67 / 100000000000000000000000000000000)⟩ +def weightSquare9_5 : Ball := ⟨(601887280443143949422394537773243 / 100000000000000000000000000000000), (33 / 10000000000000000000000000000000)⟩ +def weightSquare9_6 : Ball := ⟨(3622682983592438129289817987640667 / 100000000000000000000000000000000), (3973 / 100000000000000000000000000000000)⟩ +lemma weight_enclosed_9 : weightSquare9_6.Encloses (weight (35898) : ℝ) := by + exact weight_enclosed_of_trace (35898) weightTrace9 weightSquare9_1 weightSquare9_2 weightSquare9_3 weightSquare9_4 weightSquare9_5 weightSquare9_6 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def weightTrace10 : List Ball := [ + ⟨(104643817941585644011055002692351 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(102304343486104167397858997043291 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(6345650025415076652394745911099 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(16857530898254533759977249142099 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2102390764796993902426298307757 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(839678918917955610443536100733 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(6989733183295338113197086393 / 5000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(3990884012883817837828762809 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(623181153966461295253418909 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(138414630349275657661540399 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(6917866971559857065203159 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2514720451697499889277579 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(209498895670714520474879 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(16111270073369578912207 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(287638905637475131677 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(3067543529976875711 / 4000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def weightSquare10_1 : Ball := ⟨(109503286333917215300234963650589 / 100000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +def weightSquare10_2 : Ball := ⟨(23981939435855721532382233715047 / 20000000000000000000000000000000), (1 / 12500000000000000000000000000000)⟩ +def weightSquare10_3 : Ball := ⟨(143783354776262960787841124947381 / 100000000000000000000000000000000), (1 / 5000000000000000000000000000000)⟩ +def weightSquare10_4 : Ball := ⟨(206736531107167007786767430192403 / 100000000000000000000000000000000), (59 / 100000000000000000000000000000000)⟩ +def weightSquare10_5 : Ball := ⟨(427399932942246318664573400014931 / 100000000000000000000000000000000), (49 / 20000000000000000000000000000000)⟩ +def weightSquare10_6 : Ball := ⟨(913353513395183249684030644938607 / 50000000000000000000000000000000), (419 / 20000000000000000000000000000000)⟩ +lemma weight_enclosed_10 : weightSquare10_6.Encloses (weight (29051) : ℝ) := by + exact weight_enclosed_of_trace (29051) weightTrace10 weightSquare10_1 weightSquare10_2 weightSquare10_3 weightSquare10_4 weightSquare10_5 weightSquare10_6 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def weightTrace11 : List Ball := [ + ⟨(51457318287274132865276567057379 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1014503403334361270220267489773 / 1000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(50482287126726561924028897888317 / 100000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩, + ⟨(3357412966824382785429865106037 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1047680795825287522555360752867 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(418670001796633248356362121959 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(69730488017545672562413193419 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(3982550427688823527492235683 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1244049333538284529198387107 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(69091744539850108590769427 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(5525893169158403393733513 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2511221947893666302852981 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(209229889795857520126909 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(8046031081551623817853 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1149275510972162029753 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(76608950208370987967 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def weightSquare11_1 : Ball := ⟨(105914224212713475942880094061453 / 100000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +def weightSquare11_2 : Ball := ⟨(56089114452904707614563249114169 / 50000000000000000000000000000000), (7 / 100000000000000000000000000000000)⟩ +def weightSquare11_3 : Ball := ⟨(62919775202220875163649729179661 / 50000000000000000000000000000000), (17 / 100000000000000000000000000000000)⟩ +def weightSquare11_4 : Ball := ⟨(9897245278745022430232851573857 / 6250000000000000000000000000000), (11 / 25000000000000000000000000000000)⟩ +def weightSquare11_5 : Ball := ⟨(250765988115560030064146963919903 / 100000000000000000000000000000000), (7 / 5000000000000000000000000000000)⟩ +def weightSquare11_6 : Ball := ⟨(314417903977865971190225770587881 / 50000000000000000000000000000000), (703 / 100000000000000000000000000000000)⟩ +lemma weight_enclosed_11 : weightSquare11_6.Encloses (weight (18387) : ℝ) := by + exact weight_enclosed_of_trace (18387) weightTrace11 weightSquare11_1 weightSquare11_2 weightSquare11_3 weightSquare11_4 weightSquare11_5 weightSquare11_6 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def weightTrace12 : List Ball := [ + ⟨(50299565702744265076996558074139 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(50149633731710606664346630250871 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(10019941228855690837754994565271 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(16691585754174909970175937448921 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2085824745654684049952040366639 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(834163685934846265222339166067 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(69503749014945907528607500637 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1241005922081361949527725719 / 6250000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1240902916616263466583660047 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(55147578719850151178826729 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(13786145698506878875057519 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(250645847183754706694749 / 10000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(208863538519519027742349 / 100000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩, + ⟨(16065898544688539931839 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1147531528860113200627 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(7650018722732584753 / 10000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def weightSquare12_1 : Ball := ⟨(50600926197693743461694777077217 / 50000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +def weightSquare12_2 : Ball := ⟨(20483629856515592049753749622719 / 20000000000000000000000000000000), (7 / 100000000000000000000000000000000)⟩ +def weightSquare12_3 : Ball := ⟨(5244738651234212176799626520019 / 5000000000000000000000000000000), (3 / 20000000000000000000000000000000)⟩ +def weightSquare12_4 : Ball := ⟨(110029134079000252453786194910311 / 100000000000000000000000000000000), (1 / 3125000000000000000000000000000)⟩ +def weightSquare12_5 : Ball := ⟨(60532051730873073663919899910177 / 50000000000000000000000000000000), (71 / 100000000000000000000000000000000)⟩ +def weightSquare12_6 : Ball := ⟨(29313034293992750986222098316009 / 20000000000000000000000000000000), (173 / 100000000000000000000000000000000)⟩ +lemma weight_enclosed_12 : weightSquare12_6.Encloses (weight (3823) : ℝ) := by + exact weight_enclosed_of_trace (3823) weightTrace12 weightSquare12_1 weightSquare12_2 weightSquare12_3 weightSquare12_4 weightSquare12_5 weightSquare12_6 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def weightTrace13 : List Ball := [ + ⟨(97749308384307458995717295526927 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(386212440059808669826807686367 / 390625000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(620284354280447813487395038807 / 1250000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(16572246608625983214041733343471 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(207388417688370545953590935703 / 5000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(166036382119894000421479712647 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(138438502963314708257138641127 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1978495383124961248679789739 / 10000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(309237476945452854929631139 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(274947171450935846495308899 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(3437549805329453114224957 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1250233374430986093929039 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(208402594317235319799913 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(8016485665633495607099 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(286334057844721094857 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(15272567399497273009 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def weightSquare13_1 : Ball := ⟨(95549272896104404998317042425221 / 100000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +def weightSquare13_2 : Ball := ⟨(91296635509742318701678139152337 / 100000000000000000000000000000000), (7 / 100000000000000000000000000000000)⟩ +def weightSquare13_3 : Ball := ⟨(41675378276993710444793986953517 / 50000000000000000000000000000000), (7 / 50000000000000000000000000000000)⟩ +def weightSquare13_4 : Ball := ⟨(34736743090610384990883814056083 / 50000000000000000000000000000000), (3 / 12500000000000000000000000000000)⟩ +def weightSquare13_5 : Ball := ⟨(24132826410861366426580373032961 / 50000000000000000000000000000000), (7 / 20000000000000000000000000000000)⟩ +def weightSquare13_6 : Ball := ⟨(23295732423070716039874970270233 / 100000000000000000000000000000000), (17 / 50000000000000000000000000000000)⟩ +lemma weight_enclosed_13 : weightSquare13_6.Encloses (weight (-14569) : ℝ) := by + exact weight_enclosed_of_trace (-14569) weightTrace13 weightSquare13_1 weightSquare13_2 weightSquare13_3 weightSquare13_4 weightSquare13_5 weightSquare13_6 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def weightTrace14 : List Ball := [ + ⟨(9397419149312240765671878406229 / 10000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(96955889088939538910397682022679 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(23916046352232353441792145211 / 48828125000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(3282178827443733390859812092909 / 20000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩, + ⟨(4115406748962183626188354016423 / 100000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩, + ⟨(412388718459236045682322206297 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(34416317034840072279521000559 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2461023229140385701538388279 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(492627540295271625210502361 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(68467532913805441181202433 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(27402422922560608218237489 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2492297689867778508766373 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(207773912733602071421357 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(15988047386627809666029 / 100000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩, + ⟨(571170154415164387469 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(38087296400995144381 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def weightSquare14_1 : Ball := ⟨(88311486667860398901944158266739 / 100000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +def weightSquare14_2 : Ball := ⟨(77989186774876849812044262325737 / 100000000000000000000000000000000), (7 / 100000000000000000000000000000000)⟩ +def weightSquare14_3 : Ball := ⟨(60823132538066261346053024041467 / 100000000000000000000000000000000), (3 / 25000000000000000000000000000000)⟩ +def weightSquare14_4 : Ball := ⟨(1156079203669742114596957224833 / 3125000000000000000000000000000), (1 / 6250000000000000000000000000000)⟩ +def weightSquare14_5 : Ball := ⟨(3421488960403622578089278590681 / 25000000000000000000000000000000), (13 / 100000000000000000000000000000000)⟩ +def weightSquare14_6 : Ball := ⟨(117065867061638619900413203703 / 6250000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ +lemma weight_enclosed_14 : weightSquare14_6.Encloses (weight (-39776) : ℝ) := by + exact weight_enclosed_of_trace (-39776) weightTrace14 weightSquare14_1 weightSquare14_2 weightSquare14_3 weightSquare14_4 weightSquare14_5 weightSquare14_6 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def weightTrace15 : List Ball := [ + ⟨(94147322024652654828833510491163 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(97044248516044896355939512038323 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(49009817859248311627512106727623 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1641837841548993622447410991039 / 10000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(823381940790235157278803689397 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(206257164476878098440948109979 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(137701235103513169711025747113 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(19692689326920054765335269601 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2463638768430057590648224087 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(273920293962133881870515871 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(27406987350225809089504263 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1246339178279343493885119 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(207803214433657946794709 / 100000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩, + ⟨(1998767697855936571617 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(114247998713503541457 / 10000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(76183390027455214293 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def weightSquare15_1 : Ball := ⟨(44318591222068234326289200916567 / 50000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ +def weightSquare15_2 : Ball := ⟨(61379297747149485991007624471 / 78125000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ +def weightSquare15_3 : Ball := ⟨(1928918114269813742751307284463 / 3125000000000000000000000000000), (1 / 12500000000000000000000000000000)⟩ +def weightSquare15_4 : Ball := ⟨(2381264058597257105709481658969 / 6250000000000000000000000000000), (11 / 100000000000000000000000000000000)⟩ +def weightSquare15_5 : Ball := ⟨(14516271402923727674314000842103 / 100000000000000000000000000000000), (9 / 100000000000000000000000000000000)⟩ +def weightSquare15_6 : Ball := ⟨(2107221354433412088486138736011 / 100000000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ +lemma weight_enclosed_15 : weightSquare15_6.Encloses (weight (-38598) : ℝ) := by + exact weight_enclosed_of_trace (-38598) weightTrace15 weightSquare15_1 weightSquare15_2 weightSquare15_3 weightSquare15_4 weightSquare15_5 weightSquare15_6 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def weightTrace16 : List Ball := [ + ⟨(96363397544038665735902571610653 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(3926818916509623635941208316487 / 4000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(24694139865151464166961931335581 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(3302690843648775656223451075217 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(165439458394777402989072424451 / 4000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(82821546947141128907996775141 / 10000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(69078641632151769912138780799 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(19749772217589986559441937981 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(154374259625197756705469647 / 6250000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(274555792962808879841926837 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1373240124245016613661353 / 5000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(249749928356493009833667 / 10000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(52043563214049462922493 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(8008328294019073421673 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(228849664429048117677 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(38147293777383269777 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def weightSquare16_1 : Ball := ⟨(5803690241394023222060139461611 / 6250000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +def weightSquare16_2 : Ball := ⟨(17245604054042734355635644885209 / 20000000000000000000000000000000), (7 / 100000000000000000000000000000000)⟩ +def weightSquare16_3 : Ball := ⟨(116176116870630935339684428353 / 156250000000000000000000000000), (13 / 100000000000000000000000000000000)⟩ +def weightSquare16_4 : Ball := ⟨(11056652395428657424319758888073 / 20000000000000000000000000000000), (21 / 100000000000000000000000000000000)⟩ +def weightSquare16_5 : Ball := ⟨(30562390548334567074915733474673 / 100000000000000000000000000000000), (3 / 12500000000000000000000000000000)⟩ +def weightSquare16_6 : Ball := ⟨(2335149290072325198800662941033 / 25000000000000000000000000000000), (1 / 6250000000000000000000000000000)⟩ +lemma weight_enclosed_16 : weightSquare16_6.Encloses (weight (-23708) : ℝ) := by + exact weight_enclosed_of_trace (-23708) weightTrace16 weightSquare16_1 weightSquare16_2 weightSquare16_3 weightSquare16_4 weightSquare16_5 weightSquare16_6 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def weightBall : Fin 17 → Ball := (Matrix.vecCons (weightSquare0_6) (Matrix.vecCons (weightSquare1_6) (Matrix.vecCons (weightSquare2_6) (Matrix.vecCons (weightSquare3_6) (Matrix.vecCons (weightSquare4_6) (Matrix.vecCons (weightSquare5_6) (Matrix.vecCons (weightSquare6_6) (Matrix.vecCons (weightSquare7_6) (Matrix.vecCons (weightSquare8_6) (Matrix.vecCons (weightSquare9_6) (Matrix.vecCons (weightSquare10_6) (Matrix.vecCons (weightSquare11_6) (Matrix.vecCons (weightSquare12_6) (Matrix.vecCons (weightSquare13_6) (Matrix.vecCons (weightSquare14_6) (Matrix.vecCons (weightSquare15_6) (Matrix.vecCons (weightSquare16_6) Matrix.vecEmpty))))))))))))))))) + +lemma weightBall_sound (k : Fin 17) : + (weightBall k).Encloses (weight (initialInteger k.val) : ℝ) := by + fin_cases k + · exact weight_enclosed_0 + · exact weight_enclosed_1 + · exact weight_enclosed_2 + · exact weight_enclosed_3 + · exact weight_enclosed_4 + · exact weight_enclosed_5 + · exact weight_enclosed_6 + · exact weight_enclosed_7 + · exact weight_enclosed_8 + · exact weight_enclosed_9 + · exact weight_enclosed_10 + · exact weight_enclosed_11 + · exact weight_enclosed_12 + · exact weight_enclosed_13 + · exact weight_enclosed_14 + · exact weight_enclosed_15 + · exact weight_enclosed_16 + +def sourceWeightBall (k : ℕ) : Ball := weightBall ⟨k % 17, Nat.mod_lt _ (by decide)⟩ + +lemma sourceWeightBall_sound (k : ℕ) (hk : k < 17) : + (sourceWeightBall k).Encloses (weight (initialInteger k) : ℝ) := by + simpa only [sourceWeightBall, Nat.mod_eq_of_lt hk] using weightBall_sound ⟨k,hk⟩ + +def listSumBall {α : Type*} (xs : List α) (b : α → Ball) : Ball := + xs.foldr (fun x a => .add (b x) a) (.exact 0) + +lemma listSumBall_sound {α : Type*} (xs : List α) (b : α → Ball) (v : α → ℝ) + (h : ∀ x ∈ xs, (b x).Encloses (v x)) : + (listSumBall xs b).Encloses ((xs.map v).sum) := by + induction xs with + | nil => simpa [listSumBall] using Ball.exact_sound 0 + | cons x xs ih => + simpa only [listSumBall, List.foldr_cons, List.map_cons, List.sum_cons] using + Ball.add_sound (h x (by simp)) (ih (fun y hy => h y (by simp [hy]))) + +def finSumBall : (n : ℕ) → (Fin n → Ball) → Ball + | 0, _ => .exact 0 + | n+1, b => .add (b 0) (finSumBall n (fun i => b i.succ)) + +lemma finSumBall_sound (n : ℕ) (b : Fin n → Ball) (v : Fin n → ℝ) + (h : ∀ i, (b i).Encloses (v i)) : + (finSumBall n b).Encloses (∑ i, v i) := by + induction n with + | zero => simpa [finSumBall] using Ball.exact_sound 0 + | succ n ih => + rw [Fin.sum_univ_succ] + exact Ball.add_sound (h 0) (ih _ _ (fun i => h i.succ)) + +def initialRawBall (s : Shape) : Ball := + .mul (.exact (initialMultiplicity s)) + (.mul (sourceWeightBall (s 0)) + (.mul (sourceWeightBall (s 1)) (sourceWeightBall (s 2)))) + +lemma initial_shape_bound : ∀ s ∈ sortedInitial, ∀ i : Fin 3, s i < 17 := by + decide +kernel + +lemma initialRawBall_sound (s : Shape) (hs : s ∈ sortedInitial) : + (initialRawBall s).Encloses (initialWeight s : ℝ) := by + have h := Ball.mul_sound (Ball.exact_sound (initialMultiplicity s : ℚ)) + (Ball.mul_sound (sourceWeightBall_sound (s 0) (initial_shape_bound s hs 0)) + (Ball.mul_sound (sourceWeightBall_sound (s 1) (initial_shape_bound s hs 1)) + (sourceWeightBall_sound (s 2) (initial_shape_bound s hs 2)))) + simpa only [initialRawBall, initialWeight, Rat.cast_mul, Rat.cast_prod, + Fin.prod_univ_succ, Fin.prod_univ_zero, mul_one, Fin.succ_zero_eq_one, + Fin.succ_one_eq_two] using h + +def initialDenominatorBall : Ball := listSumBall sortedInitial initialRawBall + +lemma initialDenominatorBall_sound : + initialDenominatorBall.Encloses ((sortedInitial.map initialWeight).sum : ℝ) := by + have h := listSumBall_sound sortedInitial initialRawBall + (fun s => (initialWeight s : ℝ)) initialRawBall_sound + simpa only [initialDenominatorBall, Rat.cast_list_sum, List.map_map, + Function.comp_def] using h + +lemma initialDenominatorBall_positive : 0 < initialDenominatorBall.lower := by + decide +kernel + +def initialLawBall (s : Shape) : Ball := + .mul (initialRawBall s) (.inv initialDenominatorBall) + +lemma initialLawBall_sound (s : Shape) (hs : s ∈ sortedInitial) : + (initialLawBall s).Encloses (initialLaw s : ℝ) := by + have h := Ball.mul_sound (initialRawBall_sound s hs) + (Ball.inv_sound initialDenominatorBall_sound initialDenominatorBall_positive) + simpa only [initialLawBall, initialLaw, hs, ite_true, Rat.cast_div, + div_eq_mul_inv, Rat.cast_mul, Rat.cast_inv] using h + +def initialMarginalBall (k : Fin 17) : Ball := + finSumBall sortedInitial.length (fun g => + .mul (initialLawBall (sortedInitial.get g)) + (.exact ((∑ w : Fin 3, if sortedInitial.get g w = k.val then (1 : ℚ) else 0) / 3))) + +lemma initialMarginalBall_sound (k : Fin 17) : + (initialMarginalBall k).Encloses (AllFieldInitialEntropy.nativeInitialMarginal k) := by + apply finSumBall_sound + intro g + have h := Ball.mul_sound (initialLawBall_sound (sortedInitial.get g) (List.get_mem _ _)) + (Ball.exact_sound ((∑ w : Fin 3, if sortedInitial.get g w = k.val then (1 : ℚ) else 0) / 3)) + convert h using 1 + simp only [Rat.cast_div, Rat.cast_sum, apply_ite, Rat.cast_one, + Rat.cast_zero, Rat.cast_ofNat, mul_div_assoc] + +def roundedMarginal : Fin 17 → Ball := (Matrix.vecCons (⟨(37824257369353410027720060279 / 50000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩) (Matrix.vecCons (⟨(32277877294971248510635537179 / 6250000000000000000000000000000), (1 / 20000000000000000000000000000000)⟩) (Matrix.vecCons (⟨(1311429618383774862762137339319 / 50000000000000000000000000000000), (1 / 5000000000000000000000000000000)⟩) (Matrix.vecCons (⟨(8221633968389025907864338663411 / 100000000000000000000000000000000), (3 / 5000000000000000000000000000000)⟩) (Matrix.vecCons (⟨(3458333166749295114800388945299 / 20000000000000000000000000000000), (1 / 781250000000000000000000000000)⟩) (Matrix.vecCons (⟨(24885489904708998392039676962479 / 100000000000000000000000000000000), (181 / 100000000000000000000000000000000)⟩) (Matrix.vecCons (⟨(24112146157967309906901428396197 / 100000000000000000000000000000000), (91 / 50000000000000000000000000000000)⟩) (Matrix.vecCons (⟨(3779863608787839049947557982127 / 25000000000000000000000000000000), (111 / 100000000000000000000000000000000)⟩) (Matrix.vecCons (⟨(5764358674456721497871303174559 / 100000000000000000000000000000000), (43 / 100000000000000000000000000000000)⟩) (Matrix.vecCons (⟨(1226948071890256520646842010821 / 100000000000000000000000000000000), (1 / 10000000000000000000000000000000)⟩) (Matrix.vecCons (⟨(151656043521920341821121947439 / 100000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩) (Matrix.vecCons (⟨(2239268756742155430560743707 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩) (Matrix.vecCons (⟨(484478437366253348343232821 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩) (Matrix.vecCons (⟨(3038569022328601883975409 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩) (Matrix.vecCons (⟨(7930177818229705654311 / 6250000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩) (Matrix.vecCons (⟨(14180164171909061741993 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩) (Matrix.vecCons (⟨(4381963528820193732059 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩) Matrix.vecEmpty))))))))))))))))) + +lemma marginal_containment_0 : contains (initialMarginalBall 0) (roundedMarginal 0) = true := by + decide +kernel + +lemma marginal_containment_1 : contains (initialMarginalBall 1) (roundedMarginal 1) = true := by + decide +kernel + +lemma marginal_containment_2 : contains (initialMarginalBall 2) (roundedMarginal 2) = true := by + decide +kernel + +lemma marginal_containment_3 : contains (initialMarginalBall 3) (roundedMarginal 3) = true := by + decide +kernel + +lemma marginal_containment_4 : contains (initialMarginalBall 4) (roundedMarginal 4) = true := by + decide +kernel + +lemma marginal_containment_5 : contains (initialMarginalBall 5) (roundedMarginal 5) = true := by + decide +kernel + +lemma marginal_containment_6 : contains (initialMarginalBall 6) (roundedMarginal 6) = true := by + decide +kernel + +lemma marginal_containment_7 : contains (initialMarginalBall 7) (roundedMarginal 7) = true := by + decide +kernel + +lemma marginal_containment_8 : contains (initialMarginalBall 8) (roundedMarginal 8) = true := by + decide +kernel + +lemma marginal_containment_9 : contains (initialMarginalBall 9) (roundedMarginal 9) = true := by + decide +kernel + +lemma marginal_containment_10 : contains (initialMarginalBall 10) (roundedMarginal 10) = true := by + decide +kernel + +lemma marginal_containment_11 : contains (initialMarginalBall 11) (roundedMarginal 11) = true := by + decide +kernel + +lemma marginal_containment_12 : contains (initialMarginalBall 12) (roundedMarginal 12) = true := by + decide +kernel + +lemma marginal_containment_13 : contains (initialMarginalBall 13) (roundedMarginal 13) = true := by + decide +kernel + +lemma marginal_containment_14 : contains (initialMarginalBall 14) (roundedMarginal 14) = true := by + decide +kernel + +lemma marginal_containment_15 : contains (initialMarginalBall 15) (roundedMarginal 15) = true := by + decide +kernel + +lemma marginal_containment_16 : contains (initialMarginalBall 16) (roundedMarginal 16) = true := by + decide +kernel + +lemma roundedMarginal_sound (k : Fin 17) : + (roundedMarginal k).Encloses (AllFieldInitialEntropy.nativeInitialMarginal k) := by + apply contains_sound (initialMarginalBall_sound k) + fin_cases k + · exact marginal_containment_0 + · exact marginal_containment_1 + · exact marginal_containment_2 + · exact marginal_containment_3 + · exact marginal_containment_4 + · exact marginal_containment_5 + · exact marginal_containment_6 + · exact marginal_containment_7 + · exact marginal_containment_8 + · exact marginal_containment_9 + · exact marginal_containment_10 + · exact marginal_containment_11 + · exact marginal_containment_12 + · exact marginal_containment_13 + · exact marginal_containment_14 + · exact marginal_containment_15 + · exact marginal_containment_16 + +def logTwoTrace : List Ball := [ + ⟨(20794415416798359282516957915099 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(35748693755926167713263106179463 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(5434560950833877354841988903793 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(3128838846003916954862320107311 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(3056579874686922885058244064393 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2007375097745844772419357263631 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4256848790190598288526447522607 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(7392508992661538424245286176159 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1633145233488461454551893896359 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1463012983749094267437633302527 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(662505795291976835048297229793 / 12500000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩, + ⟨(2421637201939737490310128843981 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4459034852306579173408406148187 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4131313670759212560675655333689 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(240530606468723732046722791867 / 6250000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(450240571609440969944458529469 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(84626577284090520093573740141 / 2500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(3192840549545314506413819178039 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(3021279231622116272010086888069 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2867188760274722123766457668297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(340971970693677773852649492219 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2598762377749677766171251244647 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2458628841607565011820330969267 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(531914893617021276595744680851 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def logTwoBall : Ball := ⟨(6931471805599453094172319305033 / 10000000000000000000000000000000), (21175823683 / 100000000000000000000000000000000)⟩ +lemma logTwoBall_sound : logTwoBall.Encloses (Real.log 2) := by + have h := normalizedLogBall_sound (m := 2) (trace := logTwoTrace) + (by norm_num) (by norm_num) (by decide +kernel) + exact contains_sound h (by decide +kernel) +def marginalLogWitness : Fin 17 → LogWitness := (Matrix.vecCons (⟨-11, 37824257369353410027720060279, 24414062500000000000000000000⟩) (Matrix.vecCons (⟨-8, 32277877294971248510635537179, 24414062500000000000000000000⟩) (Matrix.vecCons (⟨-6, 1311429618383774862762137339319, 781250000000000000000000000000⟩) (Matrix.vecCons (⟨-4, 8221633968389025907864338663411, 6250000000000000000000000000000⟩) (Matrix.vecCons (⟨-3, 3458333166749295114800388945299, 2500000000000000000000000000000⟩) (Matrix.vecCons (⟨-3, 24885489904708998392039676962479, 12500000000000000000000000000000⟩) (Matrix.vecCons (⟨-3, 24112146157967309906901428396197, 12500000000000000000000000000000⟩) (Matrix.vecCons (⟨-3, 3779863608787839049947557982127, 3125000000000000000000000000000⟩) (Matrix.vecCons (⟨-5, 5764358674456721497871303174559, 3125000000000000000000000000000⟩) (Matrix.vecCons (⟨-7, 1226948071890256520646842010821, 781250000000000000000000000000⟩) (Matrix.vecCons (⟨-10, 151656043521920341821121947439, 97656250000000000000000000000⟩) (Matrix.vecCons (⟨-14, 2239268756742155430560743707, 1220703125000000000000000000⟩) (Matrix.vecCons (⟨-18, 484478437366253348343232821, 381469726562500000000000000⟩) (Matrix.vecCons (⟨-23, 3038569022328601883975409, 2980232238769531250000000⟩) (Matrix.vecCons (⟨-30, 31720711272918822617244, 23283064365386962890625⟩) (Matrix.vecCons (⟨-33, 28360328343818123483986, 23283064365386962890625⟩) (Matrix.vecCons (⟨-35, 35055708230561549856472, 23283064365386962890625⟩) Matrix.vecEmpty))))))))))))))))) +def marginalLogBall : Fin 17 → Ball := (Matrix.vecCons (⟨(-359341382912849805381766834083483 / 50000000000000000000000000000000), (254109886839 / 100000000000000000000000000000000)⟩) (Matrix.vecCons (⟨(-526595466063060246707895328811773 / 100000000000000000000000000000000), (38116482823 / 20000000000000000000000000000000)⟩) (Matrix.vecCons (⟨(-182045257575976223204856091760809 / 50000000000000000000000000000000), (9264422909 / 6250000000000000000000000000000)⟩) (Matrix.vecCons (⟨(-249840121706468106425374731856733 / 100000000000000000000000000000000), (13234889893 / 12500000000000000000000000000000)⟩) (Matrix.vecCons (⟨(-175494554427421837074873290309581 / 100000000000000000000000000000000), (5293955967 / 6250000000000000000000000000000)⟩) (Matrix.vecCons (⟨(-139088528712395736536901400948077 / 100000000000000000000000000000000), (84703295459 / 100000000000000000000000000000000)⟩) (Matrix.vecCons (⟨(-27782314111222943517224434997 / 19531250000000000000000000000), (84703295487 / 100000000000000000000000000000000)⟩) (Matrix.vecCons (⟨(-7556751592875787652219540186071 / 4000000000000000000000000000000), (42351647733 / 50000000000000000000000000000000)⟩) (Matrix.vecCons (⟨(-142673814156440611744929044763629 / 50000000000000000000000000000000), (31763735711 / 25000000000000000000000000000000)⟩) (Matrix.vecCons (⟨(-440064034235271909031072697214261 / 100000000000000000000000000000000), (169406590279 / 100000000000000000000000000000000)⟩) (Matrix.vecCons (⟨(-649131037985310617044853658780989 / 100000000000000000000000000000000), (29116757729 / 12500000000000000000000000000000)⟩) (Matrix.vecCons (⟨(-113716727348098189960178186941083 / 12500000000000000000000000000000), (317637364177 / 100000000000000000000000000000000)⟩) (Matrix.vecCons (⟨(-305940195463298290399109426509441 / 25000000000000000000000000000000), (6286575881 / 1562500000000000000000000000000)⟩) (Matrix.vecCons (⟨(-1592299969457533467596519841341019 / 100000000000000000000000000000000), (508227995949 / 100000000000000000000000000000000)⟩) (Matrix.vecCons (⟨(-81940687367260669107912929811931 / 4000000000000000000000000000000), (32861933139 / 5000000000000000000000000000000)⟩) (Matrix.vecCons (⟨(-2267659192418886369231475949409093 / 100000000000000000000000000000000), (90878763719 / 12500000000000000000000000000000)⟩) (Matrix.vecCons (⟨(-1192546955237440450086597482595127 / 50000000000000000000000000000000), (392575236187 / 50000000000000000000000000000000)⟩) Matrix.vecEmpty))))))))))))))))) +lemma marginalLogBall_sound (k : Fin 17) : + (marginalLogBall k).Encloses (Real.log (AllFieldInitialEntropy.nativeInitialMarginal k)) := by + apply checkLog_sound logTwoBall_sound (roundedMarginal_sound k) + (w := marginalLogWitness k) + fin_cases k <;> decide +kernel +def totalMarginalBall : Ball := ⟨(99999999999999999999999999999989 / 100000000000000000000000000000000), (3 / 400000000000000000000000000000)⟩ +lemma totalMarginalBall_sound : + totalMarginalBall.Encloses (∑ k, AllFieldInitialEntropy.nativeInitialMarginal k) := by + apply contains_sound (finSumBall_sound 17 roundedMarginal + AllFieldInitialEntropy.nativeInitialMarginal roundedMarginal_sound) + decide +kernel +def totalLogWitness : LogWitness := ⟨-1, 99999999999999999999999999999989, 50000000000000000000000000000000⟩ +def totalLogBall : Ball := ⟨(-11 / 100000000000000000000000000000000), (10587912029 / 25000000000000000000000000000000)⟩ +lemma totalLogBall_sound : + totalLogBall.Encloses (Real.log (∑ k, AllFieldInitialEntropy.nativeInitialMarginal k)) := by + exact checkLog_sound logTwoBall_sound totalMarginalBall_sound + (w := totalLogWitness) (by decide +kernel) + +def entropySumBall : Ball := + finSumBall 17 (fun k => .neg (.mul (roundedMarginal k) (marginalLogBall k))) + +lemma entropySumBall_sound : + entropySumBall.Encloses (MatrixMultiplication.Foundation.finiteEntropy + AllFieldInitialEntropy.nativeInitialMarginal) := by + apply finSumBall_sound + intro k + have h := Ball.neg_sound (Ball.mul_sound (roundedMarginal_sound k) + (marginalLogBall_sound k)) + convert h using 1 + unfold MatrixMultiplication.Foundation.entropyTerm + ring + +def initialEntropyRawBall : Ball := .add + (.mul totalMarginalBall totalLogBall) entropySumBall + +lemma initialEntropyRawBall_sound : + initialEntropyRawBall.Encloses AllFieldInitialEntropy.nativeH0 := by + exact Ball.add_sound (Ball.mul_sound totalMarginalBall_sound totalLogBall_sound) + entropySumBall_sound +def initialEntropyBall : Ball := ⟨(92057368710548199998533979957297 / 50000000000000000000000000000000), (2107346571 / 1562500000000000000000000000000)⟩ +theorem nativeH0_enclosed : initialEntropyBall.Encloses AllFieldInitialEntropy.nativeH0 := by + exact contains_sound initialEntropyRawBall_sound (by decide +kernel) +theorem nativeH0_strict_bounds : + (184114737421096399996 : ℝ) / 100000000000000000000 < AllFieldInitialEntropy.nativeH0 ∧ + AllFieldInitialEntropy.nativeH0 < (184114737421096399998 : ℝ) / 100000000000000000000 := by + obtain ⟨hl,hu⟩ := Ball.bounds nativeH0_enclosed + norm_num [initialEntropyBall, Ball.lower, Ball.upper] at hl hu ⊢ + constructor <;> linarith + +end MatrixMultiplication.AllFieldInitialEntropyCertificate + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section + +namespace MatrixMultiplication.AllFieldVolumeCertificate +open AllFieldParameters AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldTerminalRates +open scoped BigOperators + +def zeroLeafShape (k : Fin 9) : Shape := shape 0 k.val (16-k.val) +def zeroLeafCoefficient (k : Fin 9) : ℕ := + Contractions.coefficients[shapeMax (zeroLeafShape k)]?.getD 0 + +lemma zeroLeafShape_mem (k : Fin 9) : zeroLeafShape k ∈ sortedInitial := by + revert k + decide +kernel + +lemma initialZeroShapes : sortedInitial.filter (fun g => !positive g) = + List.ofFn zeroLeafShape := by + decide +kernel + +lemma nativeS0_eq_sum : S0 = ∑ k : Fin 9, + (initialLaw (zeroLeafShape k) : ℝ) * initialRate (zeroLeafShape k) := by + rw [S0, initialZeroShapes, List.map_ofFn, List.sum_ofFn] + rfl + +def leafLogWitness0 : LogWitness := ⟨0, 1, 1⟩ +def leafRateBall0 : Ball := ⟨0, (10587911841 / 50000000000000000000000000000000)⟩ +lemma leafRateBall0_sound : leafRateBall0.Encloses + (initialRate (zeroLeafShape 0)) := by + have hc : (Ball.exact (zeroLeafCoefficient 0 : ℚ)).Encloses + (zeroLeafCoefficient 0 : ℝ) := by + simpa using Ball.exact_sound (zeroLeafCoefficient 0 : ℚ) + exact checkLog_sound logTwoBall_sound hc (w := leafLogWitness0) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) + +def leafLogWitness1 : LogWitness := ⟨5, 5, 4⟩ +def leafRateBall1 : Ball := ⟨(368887945411393630285245474282633 / 100000000000000000000000000000000), (127054942097 / 100000000000000000000000000000000)⟩ +lemma leafRateBall1_sound : leafRateBall1.Encloses + (initialRate (zeroLeafShape 1)) := by + have hc : (Ball.exact (zeroLeafCoefficient 1 : ℚ)).Encloses + (zeroLeafCoefficient 1 : ℝ) := by + simpa using Ball.exact_sound (zeroLeafCoefficient 1 : ℚ) + exact checkLog_sound logTwoBall_sound hc (w := leafLogWitness1) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) + +def leafLogWitness2 : LogWitness := ⟨9, 177, 128⟩ +def leafRateBall2 : Ball := ⟨(164061102342342994021143953374117 / 25000000000000000000000000000000), (21175823683 / 10000000000000000000000000000000)⟩ +lemma leafRateBall2_sound : leafRateBall2.Encloses + (initialRate (zeroLeafShape 2)) := by + have hc : (Ball.exact (zeroLeafCoefficient 2 : ℚ)).Encloses + (zeroLeafCoefficient 2 : ℝ) := by + simpa using Ball.exact_sound (zeroLeafCoefficient 2 : ℚ) + exact checkLog_sound logTwoBall_sound hc (w := leafLogWitness2) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) + +def leafLogWitness3 : LogWitness := ⟨12, 455, 256⟩ +def leafRateBall3 : Ball := ⟨(889288614119073165342852571257363 / 100000000000000000000000000000000), (275285707879 / 100000000000000000000000000000000)⟩ +lemma leafRateBall3_sound : leafRateBall3.Encloses + (initialRate (zeroLeafShape 3)) := by + have hc : (Ball.exact (zeroLeafCoefficient 3 : ℚ)).Encloses + (zeroLeafCoefficient 3 : ℝ) := by + simpa using Ball.exact_sound (zeroLeafCoefficient 3 : ℚ) + exact checkLog_sound logTwoBall_sound hc (w := leafLogWitness3) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) + +def leafLogWitness4 : LogWitness := ⟨15, 23989, 16384⟩ +def leafRateBall4 : Ball := ⟨(269462446287246686158044077687313 / 25000000000000000000000000000000), (21175823683 / 6250000000000000000000000000000)⟩ +lemma leafRateBall4_sound : leafRateBall4.Encloses + (initialRate (zeroLeafShape 4)) := by + have hc : (Ball.exact (zeroLeafCoefficient 4 : ℚ)).Encloses + (zeroLeafCoefficient 4 : ℝ) := by + simpa using Ball.exact_sound (zeroLeafCoefficient 4 : ℚ) + exact checkLog_sound logTwoBall_sound hc (w := leafLogWitness4) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) + +def leafLogWitness5 : LogWitness := ⟨17, 26355, 16384⟩ +def leafRateBall5 : Ball := ⟨(9577230336694643113727840367767 / 781250000000000000000000000000), (190582413147 / 50000000000000000000000000000000)⟩ +lemma leafRateBall5_sound : leafRateBall5.Encloses + (initialRate (zeroLeafShape 5)) := by + have hc : (Ball.exact (zeroLeafCoefficient 5 : ℚ)).Encloses + (zeroLeafCoefficient 5 : ℝ) := by + simpa using Ball.exact_sound (zeroLeafCoefficient 5 : ℚ) + exact checkLog_sound logTwoBall_sound hc (w := leafLogWitness5) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) + +def leafLogWitness6 : LogWitness := ⟨19, 38941, 32768⟩ +def leafRateBall6 : Ball := ⟨(1334239168137038775559946496265297 / 100000000000000000000000000000000), (423516473659 / 100000000000000000000000000000000)⟩ +lemma leafRateBall6_sound : leafRateBall6.Encloses + (initialRate (zeroLeafShape 6)) := by + have hc : (Ball.exact (zeroLeafCoefficient 6 : ℚ)).Encloses + (zeroLeafCoefficient 6 : ℝ) := by + simpa using Ball.exact_sound (zeroLeafCoefficient 6 : ℚ) + exact checkLog_sound logTwoBall_sound hc (w := leafLogWitness6) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) + +def leafLogWitness7 : LogWitness := ⟨20, 152675, 131072⟩ +def leafRateBall7 : Ball := ⟨(43798463436784910719256790204483 / 3125000000000000000000000000000), (222346148671 / 50000000000000000000000000000000)⟩ +lemma leafRateBall7_sound : leafRateBall7.Encloses + (initialRate (zeroLeafShape 7)) := by + have hc : (Ball.exact (zeroLeafCoefficient 7 : ℚ)).Encloses + (zeroLeafCoefficient 7 : ℝ) := by + simpa using Ball.exact_sound (zeroLeafCoefficient 7 : ℚ) + exact checkLog_sound logTwoBall_sound hc (w := leafLogWitness7) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) + +def leafLogWitness8 : LogWitness := ⟨20, 1542195, 1048576⟩ +def leafRateBall8 : Ball := ⟨(1424871728425409722017918230467949 / 100000000000000000000000000000000), (222346148671 / 50000000000000000000000000000000)⟩ +lemma leafRateBall8_sound : leafRateBall8.Encloses + (initialRate (zeroLeafShape 8)) := by + have hc : (Ball.exact (zeroLeafCoefficient 8 : ℚ)).Encloses + (zeroLeafCoefficient 8 : ℝ) := by + simpa using Ball.exact_sound (zeroLeafCoefficient 8 : ℚ) + exact checkLog_sound logTwoBall_sound hc (w := leafLogWitness8) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) + +def leafRateBall : Fin 9 → Ball := (Matrix.vecCons (leafRateBall0) (Matrix.vecCons (leafRateBall1) (Matrix.vecCons (leafRateBall2) (Matrix.vecCons (leafRateBall3) (Matrix.vecCons (leafRateBall4) (Matrix.vecCons (leafRateBall5) (Matrix.vecCons (leafRateBall6) (Matrix.vecCons (leafRateBall7) (Matrix.vecCons (leafRateBall8) Matrix.vecEmpty))))))))) +lemma leafRateBall_sound (k : Fin 9) : + (leafRateBall k).Encloses (initialRate (zeroLeafShape k)) := by + fin_cases k + · exact leafRateBall0_sound + · exact leafRateBall1_sound + · exact leafRateBall2_sound + · exact leafRateBall3_sound + · exact leafRateBall4_sound + · exact leafRateBall5_sound + · exact leafRateBall6_sound + · exact leafRateBall7_sound + · exact leafRateBall8_sound +def initialVolumeRawBall : Ball := finSumBall 9 (fun k => + .mul (initialLawBall (zeroLeafShape k)) (leafRateBall k)) + +lemma initialVolumeRawBall_sound : initialVolumeRawBall.Encloses S0 := by + rw [nativeS0_eq_sum] + apply finSumBall_sound + intro k + exact Ball.mul_sound (initialLawBall_sound _ (zeroLeafShape_mem k)) + (leafRateBall_sound k) +def initialVolumeBall : Ball := ⟨(3170407140796466915468826036527 / 100000000000000000000000000000000), (249845433 / 25000000000000000000000000000000)⟩ +theorem nativeS0_enclosed : initialVolumeBall.Encloses S0 := by + exact contains_sound initialVolumeRawBall_sound (by decide +kernel) +theorem nativeS0_strict_bounds : + (3170407140796466915 : ℝ) / 100000000000000000000 < S0 ∧ S0 < (3170407140796466916 : ℝ) / 100000000000000000000 := by + obtain ⟨hl,hu⟩ := Ball.bounds nativeS0_enclosed + norm_num [initialVolumeBall, Ball.lower, Ball.upper] at hl hu ⊢ + constructor <;> linarith +end MatrixMultiplication.AllFieldVolumeCertificate + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate +open scoped BigOperators + +lemma splitWeight_three_enclosed (parents : List Shape) (data : List ℤ) + (s u : Shape) (n₀ n₁ n₂ : ℤ) (b₀ b₁ b₂ : Ball) + (hsig : splitSignature parents data s u = (Matrix.vecCons (n₀) (Matrix.vecCons (n₁) (Matrix.vecCons (n₂) Matrix.vecEmpty)))) + (h₀ : b₀.Encloses (weight n₀ : ℝ)) + (h₁ : b₁.Encloses (weight n₁ : ℝ)) + (h₂ : b₂.Encloses (weight n₂ : ℝ)) : + (Ball.mul b₀ (Ball.mul b₁ b₂)).Encloses (splitWeight parents data s u : ℝ) := by + convert Ball.mul_sound h₀ (Ball.mul_sound h₁ h₂) using 1 + simp [splitWeight, hsig, Fin.prod_univ_succ] + +lemma list_cast_enclosed {A : Type*} (xs : List A) (b : A → Ball) (v : A → ℚ) + (h : ∀ a ∈ xs, (b a).Encloses (v a : ℝ)) : + (listSumBall xs b).Encloses ((xs.map v).sum : ℝ) := by + simpa only [Rat.cast_list_sum, List.map_map, Function.comp_def] using + listSumBall_sound xs b (fun a => (v a : ℝ)) h + +lemma product_fin6_enclosed (bs : Fin 6 → Fin 6 → Ball) (v : PairSlot → ℝ) + (h : ∀ i j, (bs i j).Encloses (v (i,j))) : + (finSumBall 6 (fun i => finSumBall 6 (bs i))).Encloses (∑ s : PairSlot, v s) := by + rw [Fintype.sum_prod_type] + exact finSumBall_sound 6 _ _ (fun i => finSumBall_sound 6 _ _ (h i)) + +lemma entropyTerm_ball {p : ℝ} {b l : Ball} (hb : b.Encloses p) + (hl : l.Encloses (Real.log p)) : + (Ball.mul (Ball.neg b) l).Encloses (Foundation.entropyTerm p) := + Ball.mul_sound (Ball.neg_sound hb) hl + +lemma entropyTerm_zero_ball {p : ℝ} (hp : (Ball.exact 0).Encloses p) : + (Ball.exact 0).Encloses (Foundation.entropyTerm p) := by + have hb := Ball.bounds hp + have h : p = 0 := by norm_num [Ball.lower, Ball.upper, Ball.exact] at hb; linarith + simp only [h, Foundation.entropyTerm, neg_zero, zero_mul] + simpa only [Rat.cast_zero] using Ball.exact_sound 0 + +lemma log_exact_one_ball {p : ℝ} (hp : (Ball.exact 1).Encloses p) : + (Ball.exact 0).Encloses (Real.log p) := by + have hb := Ball.bounds hp + have h : p = 1 := by norm_num [Ball.lower, Ball.upper, Ball.exact] at hb; linarith + rw [h, Real.log_one] + simpa only [Rat.cast_zero] using Ball.exact_sound 0 + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators + +lemma forall_fin6 {P : Fin 6 → Prop} (h0 : P 0) (h1 : P 1) (h2 : P 2) + (h3 : P 3) (h4 : P 4) (h5 : P 5) : ∀ i, P i := by + intro i + fin_cases i <;> assumption + +lemma forall_fin3 {P : Fin 3 → Prop} (h0 : P 0) (h1 : P 1) (h2 : P 2) : ∀ i, P i := by + intro i + fin_cases i <;> assumption + +lemma exact_rat_enclosed {q r : ℚ} (h : q = r) : (Ball.exact q).Encloses (r : ℝ) := by + rw [h] + exact Ball.exact_sound r + +def pairSumBall (bs : PairSlot → Ball) : Ball := + finSumBall 6 (fun i => finSumBall 6 (fun j => bs (i,j))) + +lemma pairSumBall_sound (bs : PairSlot → Ball) (v : PairSlot → ℝ) + (h : ∀ a, (bs a).Encloses (v a)) : + (pairSumBall bs).Encloses (∑ a, v a) := by + exact product_fin6_enclosed _ _ (fun i j => h (i,j)) + +def doublePairSumBall (bs : PairSlot × PairSlot → Ball) : Ball := + pairSumBall fun i => pairSumBall fun j => bs (i,j) + +lemma doublePairSumBall_sound (bs : PairSlot × PairSlot → Ball) + (v : PairSlot × PairSlot → ℝ) (h : ∀ a, (bs a).Encloses (v a)) : + (doublePairSumBall bs).Encloses (∑ a, v a) := by + rw [Fintype.sum_prod_type] + exact pairSumBall_sound _ _ (fun i => pairSumBall_sound _ _ (fun j => h (i,j))) + +lemma entropyFin_enclosed (n : ℕ) (p : Fin n → ℝ) (bs : Fin n → Ball) + (h : ∀ i, (bs i).Encloses (Foundation.entropyTerm (p i))) : + (finSumBall n bs).Encloses (Foundation.finiteEntropy p) := + finSumBall_sound n _ _ h + +lemma entropyPair_enclosed (p : PairSlot → ℝ) (bs : PairSlot → Ball) + (h : ∀ i, (bs i).Encloses (Foundation.entropyTerm (p i))) : + (pairSumBall bs).Encloses (Foundation.finiteEntropy p) := + pairSumBall_sound _ _ h + +lemma entropyDoublePair_enclosed (p : PairSlot × PairSlot → ℝ) + (bs : PairSlot × PairSlot → Ball) + (h : ∀ i, (bs i).Encloses (Foundation.entropyTerm (p i))) : + (doublePairSumBall bs).Encloses (Foundation.finiteEntropy p) := + doublePairSumBall_sound _ _ h + +lemma homogeneous_enclosed {A : Type*} [Fintype A] (p : A → ℝ) + {b e : Ball} (hb : b.Encloses (Foundation.entropyTerm (∑ a, p a))) + (he : e.Encloses (Foundation.finiteEntropy p)) : + (Ball.add (Ball.neg b) e).Encloses (homogeneousEntropy p) := by + convert Ball.add_sound (Ball.neg_sound hb) he using 1 + simp only [homogeneousEntropy, Foundation.entropyTerm, neg_mul, neg_neg] + +instance designatedDecidable (priority : Placement) (position : Fin 3) (u : Shape) : + Decidable (designated priority position u) := by + unfold designated + infer_instance + +def marginalBall (support : List Shape) (p : Shape → Ball) (side : Fin 3) (k : Fin 17) : Ball := + listSumBall support fun u => if u side = k.val then p u else .exact 0 + +lemma marginalBall_sound (support : List Shape) (bs : Shape → Ball) (p : Shape → ℝ) + (h : ∀ u ∈ support, (bs u).Encloses (p u)) (side : Fin 3) (k : Fin 17) : + (marginalBall support bs side k).Encloses (marginal support p side k) := by + apply listSumBall_sound + intro u hu + by_cases hk : u side = k.val + · simpa only [hk, ite_true] using h u hu + · simpa only [hk, ite_false, Rat.cast_zero] using Ball.exact_sound 0 + +def pairLawBall {A : Type*} (support : List Shape) (s : Shape) (p : Shape → Ball) + (q : Shape → A → Ball) (ij : A × A) : Ball := + listSumBall support fun u => .mul (.mul (p u) (q u ij.1)) (q (complement s u) ij.2) + +lemma pairLawBall_sound {A : Type*} [Fintype A] (support : List Shape) (s : Shape) + (bs : Shape → Ball) (p : Shape → ℝ) (bq : Shape → A → Ball) (q : Shape → A → ℝ) + (hp : ∀ u ∈ support, (bs u).Encloses (p u)) + (hq : ∀ u a, (bq u a).Encloses (q u a)) (ij : A × A) : + (pairLawBall support s bs bq ij).Encloses (pairLaw support s p q ij) := by + apply listSumBall_sound + intro u hu + exact Ball.mul_sound (Ball.mul_sound (hp u hu) (hq u ij.1)) (hq _ ij.2) + +lemma pairLawBall_sound_on {A : Type*} [Fintype A] (support : List Shape) (s : Shape) + (bs : Shape → Ball) (p : Shape → ℝ) (bq : Shape → A → Ball) (q : Shape → A → ℝ) + (hp : ∀ u ∈ support, (bs u).Encloses (p u)) + (hq : ∀ u ∈ support, ∀ a, (bq u a).Encloses (q u a)) + (hcq : ∀ u ∈ support, ∀ a, (bq (complement s u) a).Encloses (q (complement s u) a)) + (ij : A × A) : + (pairLawBall support s bs bq ij).Encloses (pairLaw support s p q ij) := by + apply listSumBall_sound + intro u hu + exact Ball.mul_sound (Ball.mul_sound (hp u hu) (hq u hu ij.1)) (hcq u hu ij.2) + +def residualBall {A : Type*} (support : List Shape) (p : Shape → Ball) + (priority : Placement) (position : Fin 3) (q : Shape → A → Ball) + (k : Fin 17) (a : A) : Ball := + listSumBall support fun u => + if ¬ designated priority position u ∧ u (priority position) = k.val + then .mul (p u) (q u a) else .exact 0 + +lemma residualBall_sound {A : Type*} [Fintype A] (support : List Shape) + (bs : Shape → Ball) (p : Shape → ℝ) (priority : Placement) (position : Fin 3) + (bq : Shape → A → Ball) (q : Shape → A → ℝ) + (hp : ∀ u ∈ support, (bs u).Encloses (p u)) + (hq : ∀ u a, (bq u a).Encloses (q u a)) (k : Fin 17) (a : A) : + (residualBall support bs priority position bq k a).Encloses + (residualLaw support p priority position q k a) := by + apply listSumBall_sound + intro u hu + by_cases hk : ¬ designated priority position u ∧ u (priority position) = k.val + · simpa only [ite_eq_left hk] using Ball.mul_sound (hp u hu) (hq u a) + · simpa only [hk, ite_false, Rat.cast_zero] using Ball.exact_sound 0 + +lemma residualBall_sound_on {A : Type*} [Fintype A] (support : List Shape) + (bs : Shape → Ball) (p : Shape → ℝ) (priority : Placement) (position : Fin 3) + (bq : Shape → A → Ball) (q : Shape → A → ℝ) + (hp : ∀ u ∈ support, (bs u).Encloses (p u)) + (hq : ∀ u ∈ support, ∀ a, (bq u a).Encloses (q u a)) (k : Fin 17) (a : A) : + (residualBall support bs priority position bq k a).Encloses + (residualLaw support p priority position q k a) := by + apply listSumBall_sound + intro u hu + by_cases hk : ¬ designated priority position u ∧ u (priority position) = k.val + · simpa only [ite_eq_left hk] using Ball.mul_sound (hp u hu) (hq u hu a) + · simpa only [hk, ite_false, Rat.cast_zero] using Ball.exact_sound 0 + +def singletonBall (support : List Shape) (p : Shape → Ball) + (priority : Placement) (position : Fin 3) (e : Shape → Ball) : Ball := + listSumBall support fun u => + if designated priority position u then .mul (p u) (e u) else .exact 0 + +lemma singletonBall_sound {A : Type*} [Fintype A] (support : List Shape) + (bs : Shape → Ball) (p : Shape → ℝ) (priority : Placement) (position : Fin 3) + (be : Shape → Ball) (q : Shape → A → ℝ) + (hp : ∀ u ∈ support, (bs u).Encloses (p u)) + (he : ∀ u ∈ support, designated priority position u → + (be u).Encloses (homogeneousEntropy (q u))) : + (singletonBall support bs priority position be).Encloses + (singletonEntropy support p priority position q) := by + apply listSumBall_sound + intro u hu + by_cases hk : designated priority position u + · simpa only [hk, ite_true] using Ball.mul_sound (hp u hu) (he u hu hk) + · simpa only [hk, ite_false, Rat.cast_zero] using Ball.exact_sound 0 + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def logN1 : Ball := .exact 0 +lemma logN1_sound : logN1.Encloses (Real.log ((1 : ℝ))) := by + exact log_exact_one_ball ((by convert Ball.exact_sound (1 : ℚ) using 1; norm_num)) +def logN2Witness : LogWitness := ⟨1, 1, 1⟩ +def logN2 : Ball := ⟨(6931471805599453094172319305033 / 10000000000000000000000000000000), (8470329473 / 20000000000000000000000000000000)⟩ +lemma logN2_sound : logN2.Encloses (Real.log ((2 : ℝ))) := by + exact checkLog_sound logTwoBall_sound ((by convert Ball.exact_sound (2 : ℚ) using 1; norm_num)) (w := logN2Witness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def logN4Witness : LogWitness := ⟨2, 1, 1⟩ +def logN4 : Ball := ⟨(6931471805599453094172319305033 / 5000000000000000000000000000000), (7940933881 / 12500000000000000000000000000000)⟩ +lemma logN4_sound : logN4.Encloses (Real.log ((4 : ℝ))) := by + exact checkLog_sound logTwoBall_sound ((by convert Ball.exact_sound (4 : ℚ) using 1; norm_num)) (w := logN4Witness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def logN5Witness : LogWitness := ⟨2, 5, 4⟩ +def logN5 : Ball := ⟨(40235947810852509365018973782911 / 25000000000000000000000000000000), (63527471049 / 100000000000000000000000000000000)⟩ +lemma logN5_sound : logN5.Encloses (Real.log ((5 : ℝ))) := by + exact checkLog_sound logTwoBall_sound ((by convert Ball.exact_sound (5 : ℚ) using 1; norm_num)) (w := logN5Witness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def logN7Witness : LogWitness := ⟨2, 7, 4⟩ +def logN7 : Ball := ⟨(194591014905531330510535236152357 / 100000000000000000000000000000000), (7940933881 / 12500000000000000000000000000000)⟩ +lemma logN7_sound : logN7.Encloses (Real.log ((7 : ℝ))) := by + exact checkLog_sound logTwoBall_sound ((by convert Ball.exact_sound (7 : ℚ) using 1; norm_num)) (w := logN7Witness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def logN10Witness : LogWitness := ⟨3, 5, 4⟩ +def logN10 : Ball := ⟨(115129254649702284200899544090987 / 50000000000000000000000000000000), (21175823683 / 25000000000000000000000000000000)⟩ +lemma logN10_sound : logN10.Encloses (Real.log ((10 : ℝ))) := by + exact checkLog_sound logTwoBall_sound ((by convert Ball.exact_sound (10 : ℚ) using 1; norm_num)) (w := logN10Witness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def logN20Witness : LogWitness := ⟨4, 5, 4⟩ +def logN20 : Ball := ⟨(18723326709712443708970142577019 / 6250000000000000000000000000000), (21175823683 / 20000000000000000000000000000000)⟩ +lemma logN20_sound : logN20.Encloses (Real.log ((20 : ℝ))) := by + exact checkLog_sound logTwoBall_sound ((by convert Ball.exact_sound (20 : ℚ) using 1; norm_num)) (w := logN20Witness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def logN25Witness : LogWitness := ⟨4, 25, 16⟩ +def logN25 : Ball := ⟨(321887582486820074920151790263287 / 100000000000000000000000000000000), (52939559207 / 50000000000000000000000000000000)⟩ +lemma logN25_sound : logN25.Encloses (Real.log ((25 : ℝ))) := by + exact checkLog_sound logTwoBall_sound ((by convert Ball.exact_sound (25 : ℚ) using 1; norm_num)) (w := logN25Witness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def logN50Witness : LogWitness := ⟨5, 25, 16⟩ +def logN50 : Ball := ⟨(391202300542814605861874983313617 / 100000000000000000000000000000000), (127054942097 / 100000000000000000000000000000000)⟩ +lemma logN50_sound : logN50.Encloses (Real.log ((50 : ℝ))) := by + exact checkLog_sound logTwoBall_sound ((by convert Ball.exact_sound (50 : ℚ) using 1; norm_num)) (w := logN50Witness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def logN100Witness : LogWitness := ⟨6, 25, 16⟩ +def logN100 : Ball := ⟨(460517018598809136803598176363947 / 100000000000000000000000000000000), (7411538289 / 5000000000000000000000000000000)⟩ +lemma logN100_sound : logN100.Encloses (Real.log ((100 : ℝ))) := by + exact checkLog_sound logTwoBall_sound ((by convert Ball.exact_sound (100 : ℚ) using 1; norm_num)) (w := logN100Witness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def logN250Witness : LogWitness := ⟨7, 125, 64⟩ +def logN250 : Ball := ⟨(552146091786224643321950874544283 / 100000000000000000000000000000000), (21175823683 / 12500000000000000000000000000000)⟩ +lemma logN250_sound : logN250.Encloses (Real.log ((250 : ℝ))) := by + exact checkLog_sound logTwoBall_sound ((by convert Ball.exact_sound (250 : ℚ) using 1; norm_num)) (w := logN250Witness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def logN625Witness : LogWitness := ⟨9, 625, 512⟩ +def logN625 : Ball := ⟨(321887582486820074920151780715543 / 50000000000000000000000000000000), (211758236829 / 100000000000000000000000000000000)⟩ +lemma logN625_sound : logN625.Encloses (Real.log ((625 : ℝ))) := by + exact checkLog_sound logTwoBall_sound ((by convert Ball.exact_sound (625 : ℚ) using 1; norm_num)) (w := logN625Witness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def multLogs (a : PairSlot) : Ball := + match a.1.val, a.2.val with + | 0, 0 => logN1 + | 0, 1 => logN10 + | 0, 2 => logN25 + | 0, 3 => logN2 + | 0, 4 => logN10 + | 0, 5 => logN1 + | 1, 0 => logN10 + | 1, 1 => logN100 + | 1, 2 => logN250 + | 1, 3 => logN20 + | 1, 4 => logN100 + | 1, 5 => logN10 + | 2, 0 => logN25 + | 2, 1 => logN250 + | 2, 2 => logN625 + | 2, 3 => logN50 + | 2, 4 => logN250 + | 2, 5 => logN25 + | 3, 0 => logN2 + | 3, 1 => logN20 + | 3, 2 => logN50 + | 3, 3 => logN4 + | 3, 4 => logN20 + | 3, 5 => logN2 + | 4, 0 => logN10 + | 4, 1 => logN100 + | 4, 2 => logN250 + | 4, 3 => logN20 + | 4, 4 => logN100 + | 4, 5 => logN10 + | 5, 0 => logN1 + | 5, 1 => logN10 + | 5, 2 => logN25 + | 5, 3 => logN2 + | 5, 4 => logN10 + | 5, 5 => logN1 + | _, _ => (.exact 0) +lemma multLogs_sound (a : PairSlot) : + (multLogs a).Encloses (Real.log (AllFieldParameters.multiplicity a.1 * AllFieldParameters.multiplicity a.2 : ℕ)) := by + rcases a with ⟨i,j⟩ + revert j i + apply forall_fin6 + · apply forall_fin6 + · have he : AllFieldParameters.multiplicity 0 * AllFieldParameters.multiplicity 0 = 1 := by decide +kernel + change (multLogs (0,0)).Encloses (Real.log (AllFieldParameters.multiplicity 0 * AllFieldParameters.multiplicity 0 : ℕ)) + rw [he] + simpa only [multLogs, Fin.coe_ofNat_eq_mod, Nat.reduceMod, Nat.cast_ofNat, Nat.cast_one] using logN1_sound + · have he : AllFieldParameters.multiplicity 0 * AllFieldParameters.multiplicity 1 = 10 := by decide +kernel + change (multLogs (0,1)).Encloses (Real.log (AllFieldParameters.multiplicity 0 * AllFieldParameters.multiplicity 1 : ℕ)) + rw [he] + simpa only [multLogs, Fin.coe_ofNat_eq_mod, Nat.reduceMod, Nat.cast_ofNat, Nat.cast_one] using logN10_sound + · have he : AllFieldParameters.multiplicity 0 * AllFieldParameters.multiplicity 2 = 25 := by decide +kernel + change (multLogs (0,2)).Encloses (Real.log (AllFieldParameters.multiplicity 0 * AllFieldParameters.multiplicity 2 : ℕ)) + rw [he] + simpa only [multLogs, Fin.coe_ofNat_eq_mod, Nat.reduceMod, Nat.cast_ofNat, Nat.cast_one] using logN25_sound + · have he : AllFieldParameters.multiplicity 0 * AllFieldParameters.multiplicity 3 = 2 := by decide +kernel + change (multLogs (0,3)).Encloses (Real.log (AllFieldParameters.multiplicity 0 * AllFieldParameters.multiplicity 3 : ℕ)) + rw [he] + simpa only [multLogs, Fin.coe_ofNat_eq_mod, Nat.reduceMod, Nat.cast_ofNat, Nat.cast_one] using logN2_sound + · have he : AllFieldParameters.multiplicity 0 * AllFieldParameters.multiplicity 4 = 10 := by decide +kernel + change (multLogs (0,4)).Encloses (Real.log (AllFieldParameters.multiplicity 0 * AllFieldParameters.multiplicity 4 : ℕ)) + rw [he] + simpa only [multLogs, Fin.coe_ofNat_eq_mod, Nat.reduceMod, Nat.cast_ofNat, Nat.cast_one] using logN10_sound + · have he : AllFieldParameters.multiplicity 0 * AllFieldParameters.multiplicity 5 = 1 := by decide +kernel + change (multLogs (0,5)).Encloses (Real.log (AllFieldParameters.multiplicity 0 * AllFieldParameters.multiplicity 5 : ℕ)) + rw [he] + simpa only [multLogs, Fin.coe_ofNat_eq_mod, Nat.reduceMod, Nat.cast_ofNat, Nat.cast_one] using logN1_sound + · apply forall_fin6 + · have he : AllFieldParameters.multiplicity 1 * AllFieldParameters.multiplicity 0 = 10 := by decide +kernel + change (multLogs (1,0)).Encloses (Real.log (AllFieldParameters.multiplicity 1 * AllFieldParameters.multiplicity 0 : ℕ)) + rw [he] + simpa only [multLogs, Fin.coe_ofNat_eq_mod, Nat.reduceMod, Nat.cast_ofNat, Nat.cast_one] using logN10_sound + · have he : AllFieldParameters.multiplicity 1 * AllFieldParameters.multiplicity 1 = 100 := by decide +kernel + change (multLogs (1,1)).Encloses (Real.log (AllFieldParameters.multiplicity 1 * AllFieldParameters.multiplicity 1 : ℕ)) + rw [he] + simpa only [multLogs, Fin.coe_ofNat_eq_mod, Nat.reduceMod, Nat.cast_ofNat, Nat.cast_one] using logN100_sound + · have he : AllFieldParameters.multiplicity 1 * AllFieldParameters.multiplicity 2 = 250 := by decide +kernel + change (multLogs (1,2)).Encloses (Real.log (AllFieldParameters.multiplicity 1 * AllFieldParameters.multiplicity 2 : ℕ)) + rw [he] + simpa only [multLogs, Fin.coe_ofNat_eq_mod, Nat.reduceMod, Nat.cast_ofNat, Nat.cast_one] using logN250_sound + · have he : AllFieldParameters.multiplicity 1 * AllFieldParameters.multiplicity 3 = 20 := by decide +kernel + change (multLogs (1,3)).Encloses (Real.log (AllFieldParameters.multiplicity 1 * AllFieldParameters.multiplicity 3 : ℕ)) + rw [he] + simpa only [multLogs, Fin.coe_ofNat_eq_mod, Nat.reduceMod, Nat.cast_ofNat, Nat.cast_one] using logN20_sound + · have he : AllFieldParameters.multiplicity 1 * AllFieldParameters.multiplicity 4 = 100 := by decide +kernel + change (multLogs (1,4)).Encloses (Real.log (AllFieldParameters.multiplicity 1 * AllFieldParameters.multiplicity 4 : ℕ)) + rw [he] + simpa only [multLogs, Fin.coe_ofNat_eq_mod, Nat.reduceMod, Nat.cast_ofNat, Nat.cast_one] using logN100_sound + · have he : AllFieldParameters.multiplicity 1 * AllFieldParameters.multiplicity 5 = 10 := by decide +kernel + change (multLogs (1,5)).Encloses (Real.log (AllFieldParameters.multiplicity 1 * AllFieldParameters.multiplicity 5 : ℕ)) + rw [he] + simpa only [multLogs, Fin.coe_ofNat_eq_mod, Nat.reduceMod, Nat.cast_ofNat, Nat.cast_one] using logN10_sound + · apply forall_fin6 + · have he : AllFieldParameters.multiplicity 2 * AllFieldParameters.multiplicity 0 = 25 := by decide +kernel + change (multLogs (2,0)).Encloses (Real.log (AllFieldParameters.multiplicity 2 * AllFieldParameters.multiplicity 0 : ℕ)) + rw [he] + simpa only [multLogs, Fin.coe_ofNat_eq_mod, Nat.reduceMod, Nat.cast_ofNat, Nat.cast_one] using logN25_sound + · have he : AllFieldParameters.multiplicity 2 * AllFieldParameters.multiplicity 1 = 250 := by decide +kernel + change (multLogs (2,1)).Encloses (Real.log (AllFieldParameters.multiplicity 2 * AllFieldParameters.multiplicity 1 : ℕ)) + rw [he] + simpa only [multLogs, Fin.coe_ofNat_eq_mod, Nat.reduceMod, Nat.cast_ofNat, Nat.cast_one] using logN250_sound + · have he : AllFieldParameters.multiplicity 2 * AllFieldParameters.multiplicity 2 = 625 := by decide +kernel + change (multLogs (2,2)).Encloses (Real.log (AllFieldParameters.multiplicity 2 * AllFieldParameters.multiplicity 2 : ℕ)) + rw [he] + simpa only [multLogs, Fin.coe_ofNat_eq_mod, Nat.reduceMod, Nat.cast_ofNat, Nat.cast_one] using logN625_sound + · have he : AllFieldParameters.multiplicity 2 * AllFieldParameters.multiplicity 3 = 50 := by decide +kernel + change (multLogs (2,3)).Encloses (Real.log (AllFieldParameters.multiplicity 2 * AllFieldParameters.multiplicity 3 : ℕ)) + rw [he] + simpa only [multLogs, Fin.coe_ofNat_eq_mod, Nat.reduceMod, Nat.cast_ofNat, Nat.cast_one] using logN50_sound + · have he : AllFieldParameters.multiplicity 2 * AllFieldParameters.multiplicity 4 = 250 := by decide +kernel + change (multLogs (2,4)).Encloses (Real.log (AllFieldParameters.multiplicity 2 * AllFieldParameters.multiplicity 4 : ℕ)) + rw [he] + simpa only [multLogs, Fin.coe_ofNat_eq_mod, Nat.reduceMod, Nat.cast_ofNat, Nat.cast_one] using logN250_sound + · have he : AllFieldParameters.multiplicity 2 * AllFieldParameters.multiplicity 5 = 25 := by decide +kernel + change (multLogs (2,5)).Encloses (Real.log (AllFieldParameters.multiplicity 2 * AllFieldParameters.multiplicity 5 : ℕ)) + rw [he] + simpa only [multLogs, Fin.coe_ofNat_eq_mod, Nat.reduceMod, Nat.cast_ofNat, Nat.cast_one] using logN25_sound + · apply forall_fin6 + · have he : AllFieldParameters.multiplicity 3 * AllFieldParameters.multiplicity 0 = 2 := by decide +kernel + change (multLogs (3,0)).Encloses (Real.log (AllFieldParameters.multiplicity 3 * AllFieldParameters.multiplicity 0 : ℕ)) + rw [he] + simpa only [multLogs, Fin.coe_ofNat_eq_mod, Nat.reduceMod, Nat.cast_ofNat, Nat.cast_one] using logN2_sound + · have he : AllFieldParameters.multiplicity 3 * AllFieldParameters.multiplicity 1 = 20 := by decide +kernel + change (multLogs (3,1)).Encloses (Real.log (AllFieldParameters.multiplicity 3 * AllFieldParameters.multiplicity 1 : ℕ)) + rw [he] + simpa only [multLogs, Fin.coe_ofNat_eq_mod, Nat.reduceMod, Nat.cast_ofNat, Nat.cast_one] using logN20_sound + · have he : AllFieldParameters.multiplicity 3 * AllFieldParameters.multiplicity 2 = 50 := by decide +kernel + change (multLogs (3,2)).Encloses (Real.log (AllFieldParameters.multiplicity 3 * AllFieldParameters.multiplicity 2 : ℕ)) + rw [he] + simpa only [multLogs, Fin.coe_ofNat_eq_mod, Nat.reduceMod, Nat.cast_ofNat, Nat.cast_one] using logN50_sound + · have he : AllFieldParameters.multiplicity 3 * AllFieldParameters.multiplicity 3 = 4 := by decide +kernel + change (multLogs (3,3)).Encloses (Real.log (AllFieldParameters.multiplicity 3 * AllFieldParameters.multiplicity 3 : ℕ)) + rw [he] + simpa only [multLogs, Fin.coe_ofNat_eq_mod, Nat.reduceMod, Nat.cast_ofNat, Nat.cast_one] using logN4_sound + · have he : AllFieldParameters.multiplicity 3 * AllFieldParameters.multiplicity 4 = 20 := by decide +kernel + change (multLogs (3,4)).Encloses (Real.log (AllFieldParameters.multiplicity 3 * AllFieldParameters.multiplicity 4 : ℕ)) + rw [he] + simpa only [multLogs, Fin.coe_ofNat_eq_mod, Nat.reduceMod, Nat.cast_ofNat, Nat.cast_one] using logN20_sound + · have he : AllFieldParameters.multiplicity 3 * AllFieldParameters.multiplicity 5 = 2 := by decide +kernel + change (multLogs (3,5)).Encloses (Real.log (AllFieldParameters.multiplicity 3 * AllFieldParameters.multiplicity 5 : ℕ)) + rw [he] + simpa only [multLogs, Fin.coe_ofNat_eq_mod, Nat.reduceMod, Nat.cast_ofNat, Nat.cast_one] using logN2_sound + · apply forall_fin6 + · have he : AllFieldParameters.multiplicity 4 * AllFieldParameters.multiplicity 0 = 10 := by decide +kernel + change (multLogs (4,0)).Encloses (Real.log (AllFieldParameters.multiplicity 4 * AllFieldParameters.multiplicity 0 : ℕ)) + rw [he] + simpa only [multLogs, Fin.coe_ofNat_eq_mod, Nat.reduceMod, Nat.cast_ofNat, Nat.cast_one] using logN10_sound + · have he : AllFieldParameters.multiplicity 4 * AllFieldParameters.multiplicity 1 = 100 := by decide +kernel + change (multLogs (4,1)).Encloses (Real.log (AllFieldParameters.multiplicity 4 * AllFieldParameters.multiplicity 1 : ℕ)) + rw [he] + simpa only [multLogs, Fin.coe_ofNat_eq_mod, Nat.reduceMod, Nat.cast_ofNat, Nat.cast_one] using logN100_sound + · have he : AllFieldParameters.multiplicity 4 * AllFieldParameters.multiplicity 2 = 250 := by decide +kernel + change (multLogs (4,2)).Encloses (Real.log (AllFieldParameters.multiplicity 4 * AllFieldParameters.multiplicity 2 : ℕ)) + rw [he] + simpa only [multLogs, Fin.coe_ofNat_eq_mod, Nat.reduceMod, Nat.cast_ofNat, Nat.cast_one] using logN250_sound + · have he : AllFieldParameters.multiplicity 4 * AllFieldParameters.multiplicity 3 = 20 := by decide +kernel + change (multLogs (4,3)).Encloses (Real.log (AllFieldParameters.multiplicity 4 * AllFieldParameters.multiplicity 3 : ℕ)) + rw [he] + simpa only [multLogs, Fin.coe_ofNat_eq_mod, Nat.reduceMod, Nat.cast_ofNat, Nat.cast_one] using logN20_sound + · have he : AllFieldParameters.multiplicity 4 * AllFieldParameters.multiplicity 4 = 100 := by decide +kernel + change (multLogs (4,4)).Encloses (Real.log (AllFieldParameters.multiplicity 4 * AllFieldParameters.multiplicity 4 : ℕ)) + rw [he] + simpa only [multLogs, Fin.coe_ofNat_eq_mod, Nat.reduceMod, Nat.cast_ofNat, Nat.cast_one] using logN100_sound + · have he : AllFieldParameters.multiplicity 4 * AllFieldParameters.multiplicity 5 = 10 := by decide +kernel + change (multLogs (4,5)).Encloses (Real.log (AllFieldParameters.multiplicity 4 * AllFieldParameters.multiplicity 5 : ℕ)) + rw [he] + simpa only [multLogs, Fin.coe_ofNat_eq_mod, Nat.reduceMod, Nat.cast_ofNat, Nat.cast_one] using logN10_sound + · apply forall_fin6 + · have he : AllFieldParameters.multiplicity 5 * AllFieldParameters.multiplicity 0 = 1 := by decide +kernel + change (multLogs (5,0)).Encloses (Real.log (AllFieldParameters.multiplicity 5 * AllFieldParameters.multiplicity 0 : ℕ)) + rw [he] + simpa only [multLogs, Fin.coe_ofNat_eq_mod, Nat.reduceMod, Nat.cast_ofNat, Nat.cast_one] using logN1_sound + · have he : AllFieldParameters.multiplicity 5 * AllFieldParameters.multiplicity 1 = 10 := by decide +kernel + change (multLogs (5,1)).Encloses (Real.log (AllFieldParameters.multiplicity 5 * AllFieldParameters.multiplicity 1 : ℕ)) + rw [he] + simpa only [multLogs, Fin.coe_ofNat_eq_mod, Nat.reduceMod, Nat.cast_ofNat, Nat.cast_one] using logN10_sound + · have he : AllFieldParameters.multiplicity 5 * AllFieldParameters.multiplicity 2 = 25 := by decide +kernel + change (multLogs (5,2)).Encloses (Real.log (AllFieldParameters.multiplicity 5 * AllFieldParameters.multiplicity 2 : ℕ)) + rw [he] + simpa only [multLogs, Fin.coe_ofNat_eq_mod, Nat.reduceMod, Nat.cast_ofNat, Nat.cast_one] using logN25_sound + · have he : AllFieldParameters.multiplicity 5 * AllFieldParameters.multiplicity 3 = 2 := by decide +kernel + change (multLogs (5,3)).Encloses (Real.log (AllFieldParameters.multiplicity 5 * AllFieldParameters.multiplicity 3 : ℕ)) + rw [he] + simpa only [multLogs, Fin.coe_ofNat_eq_mod, Nat.reduceMod, Nat.cast_ofNat, Nat.cast_one] using logN2_sound + · have he : AllFieldParameters.multiplicity 5 * AllFieldParameters.multiplicity 4 = 10 := by decide +kernel + change (multLogs (5,4)).Encloses (Real.log (AllFieldParameters.multiplicity 5 * AllFieldParameters.multiplicity 4 : ℕ)) + rw [he] + simpa only [multLogs, Fin.coe_ofNat_eq_mod, Nat.reduceMod, Nat.cast_ofNat, Nat.cast_one] using logN10_sound + · have he : AllFieldParameters.multiplicity 5 * AllFieldParameters.multiplicity 5 = 1 := by decide +kernel + change (multLogs (5,5)).Encloses (Real.log (AllFieldParameters.multiplicity 5 * AllFieldParameters.multiplicity 5 : ℕ)) + rw [he] + simpa only [multLogs, Fin.coe_ofNat_eq_mod, Nat.reduceMod, Nat.cast_ofNat, Nat.cast_one] using logN1_sound + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators + +def sparseTripleBall (a b c : Ball) : Ball := + if b = .exact 0 ∨ c = .exact 0 then .exact 0 else .mul (.mul a b) c + +lemma sparseTripleBall_eq (a b c : Ball) : + sparseTripleBall a b c = .mul (.mul a b) c := by + unfold sparseTripleBall + split_ifs with h + · rcases h with h | h + · subst b + cases a + cases c + simp [Ball.mul, Ball.exact] + · subst c + cases a + cases b + simp [Ball.mul, Ball.exact] + · rfl + +def sparsePairLawBall {A : Type*} (support : List Shape) (s : Shape) (p : Shape → Ball) + (q : Shape → A → Ball) (ij : A × A) : Ball := + listSumBall support fun u => sparseTripleBall (p u) (q u ij.1) (q (complement s u) ij.2) + +lemma sparsePairLawBall_eq {A : Type*} (support : List Shape) (s : Shape) + (p : Shape → Ball) (q : Shape → A → Ball) (ij : A × A) : + sparsePairLawBall support s p q ij = pairLawBall support s p q ij := by + simp only [sparsePairLawBall, sparseTripleBall_eq, pairLawBall] + +lemma sparsePairLawBall_sound_on {A : Type*} [Fintype A] (support : List Shape) (s : Shape) + (bs : Shape → Ball) (p : Shape → ℝ) (bq : Shape → A → Ball) (q : Shape → A → ℝ) + (hp : ∀ u ∈ support, (bs u).Encloses (p u)) + (hq : ∀ u ∈ support, ∀ a, (bq u a).Encloses (q u a)) + (hcq : ∀ u ∈ support, ∀ a, (bq (complement s u) a).Encloses (q (complement s u) a)) + (ij : A × A) : + (sparsePairLawBall support s bs bq ij).Encloses (pairLaw support s p q ij) := by + rw [sparsePairLawBall_eq] + exact pairLawBall_sound_on support s bs p bq q hp hq hcq ij + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/Certificates/SplitA1_1_14.lean b/lean/OAI/LinearAlgebra/MatrixFields/Certificates/SplitA1_1_14.lean new file mode 100644 index 0000000000000000000000000000000000000000..aa18634265d78b98a54021a323541d2b13ae3da6 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/Certificates/SplitA1_1_14.lean @@ -0,0 +1,93 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Certificates.Zero0_1_7 + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate +open scoped BigOperators +lemma A1_1_14_below : below (shape 1 1 14) = [ + (shape 0 0 8), + (shape 0 1 7), + (shape 1 0 7), + (shape 1 1 6)] := by decide +kernel +def A1_1_14Raw (s : Shape) : Ball := + match s 0, s 1, s 2 with + | 0, 0, 8 => ⟨(36782530045362665672288806008641 / 50000000000000000000000000000000), (39 / 50000000000000000000000000000000)⟩ + | 0, 1, 7 => ⟨1, 0⟩ + | 1, 0, 7 => ⟨1, 0⟩ + | 1, 1, 6 => ⟨(36782530045362665672288806008641 / 50000000000000000000000000000000), (39 / 50000000000000000000000000000000)⟩ + | _, _, _ => (.exact 0) +lemma A1_1_14Raw_0_0_8 : (A1_1_14Raw (shape 0 0 8)).Encloses (splitWeight positiveInitial tableP (shape 1 1 14) (shape 0 0 8) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 1 1 14) (shape 0 0 8) + (0) (0) (-3070) w195 w195 w185 + (by decide +kernel) w195_sound w195_sound w185_sound) (by decide +kernel) +lemma A1_1_14Raw_0_1_7 : (A1_1_14Raw (shape 0 1 7)).Encloses (splitWeight positiveInitial tableP (shape 1 1 14) (shape 0 1 7) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 1 1 14) (shape 0 1 7) + (0) (0) (0) w195 w195 w195 + (by decide +kernel) w195_sound w195_sound w195_sound) (by decide +kernel) +lemma A1_1_14Raw_1_0_7 : (A1_1_14Raw (shape 1 0 7)).Encloses (splitWeight positiveInitial tableP (shape 1 1 14) (shape 1 0 7) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 1 1 14) (shape 1 0 7) + (0) (0) (0) w195 w195 w195 + (by decide +kernel) w195_sound w195_sound w195_sound) (by decide +kernel) +lemma A1_1_14Raw_1_1_6 : (A1_1_14Raw (shape 1 1 6)).Encloses (splitWeight positiveInitial tableP (shape 1 1 14) (shape 1 1 6) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 1 1 14) (shape 1 1 6) + (0) (0) (-3070) w195 w195 w185 + (by decide +kernel) w195_sound w195_sound w185_sound) (by decide +kernel) +lemma A1_1_14Raw_sound (u : Shape) (hu : u ∈ below (shape 1 1 14)) : + (A1_1_14Raw u).Encloses (splitWeight positiveInitial tableP (shape 1 1 14) u : ℝ) := by + rw [A1_1_14_below] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl + · exact A1_1_14Raw_0_0_8 + · exact A1_1_14Raw_0_1_7 + · exact A1_1_14Raw_1_0_7 + · exact A1_1_14Raw_1_1_6 +def A1_1_14Den : Ball := ⟨(86782530045362665672288806008641 / 25000000000000000000000000000000), (39 / 25000000000000000000000000000000)⟩ +lemma A1_1_14Den_sound : A1_1_14Den.Encloses (((below (shape 1 1 14)).map (splitWeight positiveInitial tableP (shape 1 1 14))).sum : ℝ) := by + exact contains_sound (list_cast_enclosed (below (shape 1 1 14)) A1_1_14Raw (splitWeight positiveInitial tableP (shape 1 1 14)) A1_1_14Raw_sound) (by decide +kernel) +lemma A1_1_14Den_positive : 0 < A1_1_14Den.lower := by decide +kernel +def A1_1_14Table (s : Shape) : Ball := + match s 0, s 1, s 2 with + | 0, 0, 8 => ⟨(211923586614355608536476757861 / 1000000000000000000000000000000), (33 / 100000000000000000000000000000000)⟩ + | 0, 1, 7 => ⟨(288076413385644391463523242139 / 1000000000000000000000000000000), (7 / 50000000000000000000000000000000)⟩ + | 1, 0, 7 => ⟨(288076413385644391463523242139 / 1000000000000000000000000000000), (7 / 50000000000000000000000000000000)⟩ + | 1, 1, 6 => ⟨(211923586614355608536476757861 / 1000000000000000000000000000000), (33 / 100000000000000000000000000000000)⟩ + | _, _, _ => (.exact 0) +def A1_1_14Law (u : Shape) : Ball := if u ∈ below (shape 1 1 14) then A1_1_14Table u else .exact 0 +lemma A1_1_14Law_check_0_0_8 : contains (.mul (A1_1_14Raw (shape 0 0 8)) (.inv A1_1_14Den)) (A1_1_14Table (shape 0 0 8)) = true := by decide +kernel +lemma A1_1_14Law_check_0_1_7 : contains (.mul (A1_1_14Raw (shape 0 1 7)) (.inv A1_1_14Den)) (A1_1_14Table (shape 0 1 7)) = true := by decide +kernel +lemma A1_1_14Law_check_1_0_7 : contains (.mul (A1_1_14Raw (shape 1 0 7)) (.inv A1_1_14Den)) (A1_1_14Table (shape 1 0 7)) = true := by decide +kernel +lemma A1_1_14Law_check_1_1_6 : contains (.mul (A1_1_14Raw (shape 1 1 6)) (.inv A1_1_14Den)) (A1_1_14Table (shape 1 1 6)) = true := by decide +kernel +lemma A1_1_14Law_check (u : Shape) (hu : u ∈ below (shape 1 1 14)) : + contains (.mul (A1_1_14Raw u) (.inv A1_1_14Den)) (A1_1_14Table u) = true := by + rw [A1_1_14_below] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl + · exact A1_1_14Law_check_0_0_8 + · exact A1_1_14Law_check_0_1_7 + · exact A1_1_14Law_check_1_0_7 + · exact A1_1_14Law_check_1_1_6 +lemma A1_1_14Law_sound (u : Shape) : + (A1_1_14Law u).Encloses (stageALaw (shape 1 1 14) u : ℝ) := by + by_cases hu : u ∈ below (shape 1 1 14) + · have h := contains_sound (Ball.mul_sound (A1_1_14Raw_sound u hu) + (Ball.inv_sound A1_1_14Den_sound A1_1_14Den_positive)) (A1_1_14Law_check u hu) + simpa only [A1_1_14Law, hu, ite_true, stageALaw, splitLaw, + Rat.cast_div, Rat.cast_mul, Rat.cast_inv, div_eq_mul_inv] using h + · simp only [A1_1_14Law, hu, ite_false, stageALaw, splitLaw, Rat.cast_zero] + simpa only [Rat.cast_zero] using Ball.exact_sound 0 + +end MatrixMultiplication.NativeNumerics + +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/Certificates/SplitA1_3_12.lean b/lean/OAI/LinearAlgebra/MatrixFields/Certificates/SplitA1_3_12.lean new file mode 100644 index 0000000000000000000000000000000000000000..7b348299192c5aeca6647f8781d27d2b7f11eda9 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/Certificates/SplitA1_3_12.lean @@ -0,0 +1,1403 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Certificates.SplitB1_1_6 + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate +open scoped BigOperators +def w125Trace : List Ball := [ + ⟨(98290253677927362218713350538661 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4957133487933714687068295982863 / 5000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(12428453258323185773439599061191 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(3319011664268268913556698438909 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4152336777041419161477907235493 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(415472019577711485041498412207 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(69273728090179961955937560417 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(9899290271746742107855918947 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(6188536417701484697570999 / 250000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(27509870164059246254651113 / 10000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(27514178085577978309297819 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(500323069331591912405189 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(208490967398376543148537 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(16039284895791052992743 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(143219650488803889823 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(76389213738014477929 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w125S0 : Ball := ⟨(96609739680713133557854615626679 / 100000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +def w125S1 : Ball := ⟨(11666802251468947246454152286789 / 12500000000000000000000000000000), (7 / 100000000000000000000000000000000)⟩ +def w125S2 : Ball := ⟨(17422627171184754762532226925513 / 20000000000000000000000000000000), (7 / 50000000000000000000000000000000)⟩ +def w125S3 : Ball := ⟨(1897174609663158062077283709459 / 2500000000000000000000000000000), (1 / 4000000000000000000000000000000)⟩ +def w125S4 : Ball := ⟨(449908937443819519461639439231 / 781250000000000000000000000000), (39 / 100000000000000000000000000000000)⟩ +def w125S5 : Ball := ⟨(33164173638340887451836381694943 / 100000000000000000000000000000000), (23 / 50000000000000000000000000000000)⟩ +abbrev w125 : Ball := w125S5 +lemma w125_sound : w125.Encloses (weight (-11037) : ℝ) := by + exact weight_enclosed_of_trace (-11037) w125Trace w125S0 w125S1 w125S2 w125S3 w125S4 w125S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def w126Trace : List Ball := [ + ⟨(98360464126535214071982895600879 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(24794493360526063183623506981043 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(9945122817642310962643140425893 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4149503391885749516586735282187 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(830585698282569077592142613761 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(33241709498849218797014376679 / 4000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(34640391109306062880512912791 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(19800344902208687596959559919 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2475610680447859229139352603 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(275118318994082697364453787 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(27515961937313219576221127 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(125088201656472064532907 / 5000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(208502406940224535172533 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(16040102137252453357613 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1145811694164763207797 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(19098156645886783949 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w126S0 : Ball := ⟨(48373904515937103764651472114873 / 50000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +def w126S1 : Ball := ⟨(93601385524680004851586914085753 / 100000000000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ +def w126S2 : Ball := ⟨(43806096860698877735598083518331 / 50000000000000000000000000000000), (3 / 25000000000000000000000000000000)⟩ +def w126S3 : Ball := ⟨(76758964886757282846332106534323 / 100000000000000000000000000000000), (11 / 50000000000000000000000000000000)⟩ +def w126S4 : Ball := ⟨(7364923363108046859771657595043 / 12500000000000000000000000000000), (7 / 20000000000000000000000000000000)⟩ +def w126S5 : Ball := ⟨(1735747076622551790485561787451 / 5000000000000000000000000000000), (21 / 50000000000000000000000000000000)⟩ +abbrev w126 : Ball := w126S5 +lemma w126_sound : w126.Encloses (weight (-10580) : ℝ) := by + exact weight_enclosed_of_trace (-10580) w126Trace w126S0 w126S1 w126S2 w126S3 w126S4 w126S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def w127Trace : List Ball := [ + ⟨(98384442411900865357167747832251 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(19838005686558829075453595306201 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(49729643420159915440185631250667 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(8299511276748566686550076725481 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1038282627314402050138345597927 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(415538216701718069479179584299 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(34641595240171824635060088033 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(19800947241847450415873323531 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2475677631459146828423411251 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(68781254022767924892516943 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(5503314183112288018485591 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(312726848998085649496271 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(104253156085546631927629 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(16040381125877263965803 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(572915147946297270583 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(76393791581146905221 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w127S0 : Ball := ⟨(96794985087006377646264820237291 / 100000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +def w127S1 : Ball := ⟨(9369269137993787045919186912917 / 10000000000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ +def w127S2 : Ball := ⟨(21945801045040710341537423042823 / 25000000000000000000000000000000), (3 / 25000000000000000000000000000000)⟩ +def w127S3 : Ball := ⟨(77058909361361589461873636539439 / 100000000000000000000000000000000), (11 / 50000000000000000000000000000000)⟩ +def w127S4 : Ball := ⟨(59380755119625408074579573935951 / 100000000000000000000000000000000), (7 / 20000000000000000000000000000000)⟩ +def w127S5 : Ball := ⟨(35260740785769191116135010727999 / 100000000000000000000000000000000), (21 / 50000000000000000000000000000000)⟩ +abbrev w127 : Ball := w127S5 +lemma w127_sound : w127.Encloses (weight (-10424) : ℝ) := by + exact weight_enclosed_of_trace (-10424) w127Trace w127S0 w127S1 w127S2 w127S3 w127S4 w127S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def w128Trace : List Ball := [ + ⟨(384504630963177627416749480319 / 390625000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(19842906163905758860982787069059 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(12434458184960216801599915380701 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4150268291823612048684491575279 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1038385267592258386127640099741 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(166228982496986211138973213213 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(27715233857276297390304760107 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1237635707954494656634365703 / 6250000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(77369177793463468272323327 / 3125000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(275138625848963230446210587 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(5503561693345853186743189 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1250958971219937669856511 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(52128562054758686727041 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(16040948072978672773309 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(229173619461418199141 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(19099039729003275837 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w128S0 : Ball := ⟨(96890920129088333700150965974897 / 100000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +def w128S1 : Ball := ⟨(18775700806922749687226120723749 / 20000000000000000000000000000000), (7 / 100000000000000000000000000000000)⟩ +def w128S2 : Ball := ⟨(88131735197769898432306728134893 / 100000000000000000000000000000000), (7 / 50000000000000000000000000000000)⟩ +def w128S3 : Ball := ⟨(38836013744849167991694383656639 / 50000000000000000000000000000000), (1 / 4000000000000000000000000000000)⟩ +def w128S4 : Ball := ⟨(7541179817950567485647685046759 / 12500000000000000000000000000000), (39 / 100000000000000000000000000000000)⟩ +def w128S5 : Ball := ⟨(18198205774932785332745311308657 / 50000000000000000000000000000000), (3 / 6250000000000000000000000000000)⟩ +abbrev w128 : Ball := w128S5 +lemma w128_sound : w128.Encloses (weight (-10107) : ℝ) := by + exact weight_enclosed_of_trace (-10107) w128Trace w128S0 w128S1 w128S2 w128S3 w128S4 w128S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def w129Trace : List Ball := [ + ⟨(49225437164389253910410663527061 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(99223421695531925007441021353277 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(49740804129260207689926574649977 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(3320363436218316221917378383 / 20000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(415369002882853848389269826527 / 10000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(831169757446160626034805533803 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(13857972055549766523796954557 / 10000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2475326928672727389266159481 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1237931525637218757790039829 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(34392945430685693755637083 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(859945545182859248351737 / 3125000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(62548884122329391996373 / 2500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(208517127365649168953801 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(3208230751408433477021 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(71617613208355541581 / 6250000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(38198508864173133353 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w129S0 : Ball := ⟨(48462873280504695014233486487611 / 50000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +def w129S1 : Ball := ⟨(9394600346409023597759780884083 / 10000000000000000000000000000000), (7 / 100000000000000000000000000000000)⟩ +def w129S2 : Ball := ⟨(17651703133749709236447940988101 / 20000000000000000000000000000000), (7 / 50000000000000000000000000000000)⟩ +def w129S3 : Ball := ⟨(15579131176101465272262818970067 / 20000000000000000000000000000000), (13 / 50000000000000000000000000000000)⟩ +def w129S4 : Ball := ⟨(15169333012636039034299519835369 / 25000000000000000000000000000000), (41 / 100000000000000000000000000000000)⟩ +def w129S5 : Ball := ⟨(9204346561929982719369806348879 / 25000000000000000000000000000000), (1 / 2000000000000000000000000000000)⟩ +abbrev w129 : Ball := w129S5 +lemma w129_sound : w129.Encloses (weight (-9992) : ℝ) := by + exact weight_enclosed_of_trace (-9992) w129Trace w129S0 w129S1 w129S2 w129S3 w129S4 w129S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def w130Trace : List Ball := [ + ⟨(98462258369249929686705629429999 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(99229143343420548548941032950259 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(12435679073675361178608058878661 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(16602295966028975878540962959071 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4153785885069782657839319707703 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(415592872656068040406435457581 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(17322750725527344387678307489 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(19802901208800728370231351631 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(495178963102082188956395531 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(55029348153343354039844489 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(13759273180629524544488719 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(100079177838994154834137 / 4000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(208518980072950620804901 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(8020643056434571073199 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(572945318087435466639 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(76397570355412823997 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w130S0 : Ball := ⟨(1938963264634585564586809656723 / 2000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +def w130S1 : Ball := ⟨(46994731770030123644996817068433 / 50000000000000000000000000000000), (7 / 100000000000000000000000000000000)⟩ +def w130S2 : Ball := ⟨(88340192565483145525324845948141 / 100000000000000000000000000000000), (7 / 50000000000000000000000000000000)⟩ +def w130S3 : Ball := ⟨(78039896225066436167134633800741 / 100000000000000000000000000000000), (1 / 4000000000000000000000000000000)⟩ +def w130S4 : Ball := ⟨(60902254028191385938025515685907 / 100000000000000000000000000000000), (1 / 2500000000000000000000000000000)⟩ +def w130S5 : Ball := ⟨(37090845457143538948140706706749 / 100000000000000000000000000000000), (49 / 100000000000000000000000000000000)⟩ +abbrev w130 : Ball := w130S5 +lemma w130_sound : w130.Encloses (weight (-9918) : ℝ) := by + exact weight_enclosed_of_trace (-9918) w130Trace w130S0 w130S1 w130S2 w130S3 w130S4 w130S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def w131Trace : List Ball := [ + ⟨(98464104553902280151231873580993 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(99230071219719432991278105003489 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(49743026385984543264891257598099 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(3320474721782602674532508322567 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4153801429672734520759139355177 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(415594168994375801575685410529 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(138582376391309036589542484997 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(19802947552100289883070713821 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2475899966536734053417711757 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(68786814003571254794217213 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(13759296606465167735250233 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2501983351055452908983039 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(52129820128713402336711 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(16041307576168330806023 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1145892067242239830043 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(76397659970612806261 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w131S0 : Ball := ⟨(96951798856017997441037978135213 / 100000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +def w131S1 : Ball := ⟨(93996513014177726773028738759521 / 100000000000000000000000000000000), (7 / 100000000000000000000000000000000)⟩ +def w131S2 : Ball := ⟨(17670688917648965516127791441633 / 20000000000000000000000000000000), (7 / 50000000000000000000000000000000)⟩ +def w131S3 : Ball := ⟨(78063311706080492099032563551957 / 100000000000000000000000000000000), (13 / 50000000000000000000000000000000)⟩ +def w131S4 : Ball := ⟨(30469403172603417950346524690897 / 50000000000000000000000000000000), (21 / 50000000000000000000000000000000)⟩ +def w131S5 : Ball := ⟨(37135381187786209248200975562191 / 100000000000000000000000000000000), (13 / 25000000000000000000000000000000)⟩ +abbrev w131 : Ball := w131S5 +lemma w131_sound : w131.Encloses (weight (-9906) : ℝ) := by + exact weight_enclosed_of_trace (-9906) w131Trace w131S0 w131S1 w131S2 w131S3 w131S4 w131S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def w132Trace : List Ball := [ + ⟨(49242822966387930759960108016993 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(19848179459828970453636324764463 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(6218330541512576136132510159203 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(16603279485522238685392994560791 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4153982790542075365057356928189 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(6493895210214674180478055743 / 781250000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(69293350017777210145965946493 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(19803488238179387881679027019 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2475960063269523696890785011 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(68788316841391961324984139 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(27519139826569648208831353 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2502028911160676222057971 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(52130696432449812774767 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(16041557985286991966123 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(572954381638259537793 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(76398705481279266001 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w132S0 : Ball := ⟨(96994224547960905945108534835223 / 100000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +def w132S1 : Ball := ⟨(94078795956602620092267323084229 / 100000000000000000000000000000000), (7 / 100000000000000000000000000000000)⟩ +def w132S2 : Ball := ⟨(44254099243220347496675849573353 / 50000000000000000000000000000000), (7 / 50000000000000000000000000000000)⟩ +def w132S3 : Ball := ⟨(19584252998287957330207278722603 / 25000000000000000000000000000000), (1 / 4000000000000000000000000000000)⟩ +def w132S4 : Ball := ⟨(30683437240076067713511909439451 / 50000000000000000000000000000000), (1 / 2500000000000000000000000000000)⟩ +def w132S5 : Ball := ⟨(18829466417313737108541434657059 / 50000000000000000000000000000000), (1 / 2000000000000000000000000000000)⟩ +abbrev w132 : Ball := w132S5 +lemma w132_sound : w132.Encloses (weight (-9766) : ℝ) := by + exact weight_enclosed_of_trace (-9766) w132Trace w132S0 w132S1 w132S2 w132S3 w132S4 w132S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def w133Trace : List Ball := [ + ⟨(19698237181233974226695784257421 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(99243681403009504067162423047577 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(49747574724965816753961896151159 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2075439054751763585102601018221 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4154029428328582830560067150571 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(415613182753014137113242050419 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(69293905933979333421557492131 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(9901813637992914146726565323 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(19343558727653122501613153 / 781250000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(55030962636043294042180751 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(27519280387580600348246631 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2502040626863904908411169 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(52130921772118710693391 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(16041622377382743254249 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1145913056616409135853 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(9549871790859901599 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w133S0 : Ball := ⟨(3031410531626160831128468628201 / 3125000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +def w133S1 : Ball := ⟨(4704998303362049554717277293211 / 5000000000000000000000000000000), (7 / 100000000000000000000000000000000)⟩ +def w133S2 : Ball := ⟨(88548036138559059560897881994989 / 100000000000000000000000000000000), (7 / 50000000000000000000000000000000)⟩ +def w133S3 : Ball := ⟨(3136301881598224482979069072333 / 4000000000000000000000000000000), (13 / 50000000000000000000000000000000)⟩ +def w133S4 : Ball := ⟨(61477434328228520648830538515059 / 100000000000000000000000000000000), (21 / 50000000000000000000000000000000)⟩ +def w133S5 : Ball := ⟨(18897374657908252689730974924039 / 50000000000000000000000000000000), (13 / 25000000000000000000000000000000)⟩ +abbrev w133 : Ball := w133S5 +lemma w133_sound : w133.Encloses (weight (-9730) : ℝ) := by + exact weight_enclosed_of_trace (-9730) w133Trace w133S0 w133S1 w133S2 w133S3 w133S4 w133S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def w134Trace : List Ball := [ + ⟨(2462572060724088118539873811751 / 2500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(49624779649023418550819889122341 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(49749538973485006727837365175439 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(3320800848758974397847240267641 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4154127888745451994561612825323 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(83124278740184277472907172777 / 10000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(27718031824196343623936763217 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(19803920805944612833151708589 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2476008142546737050064139399 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(137579038309280585573460337 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(27519577131815894172116389 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(625516340086952234363879 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(208525589980555379304401 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(8020879158918101933277 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(572961060216639165977 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(38199770944906216897 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w134S0 : Ball := ⟨(97028178468142111038605217486369 / 100000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +def w134S1 : Ball := ⟨(4707233708422818188728069977837 / 5000000000000000000000000000000), (7 / 100000000000000000000000000000000)⟩ +def w134S2 : Ball := ⟨(44316098371424074649702657023267 / 50000000000000000000000000000000), (7 / 50000000000000000000000000000000)⟩ +def w134S3 : Ball := ⟨(15711332598925884171415363747159 / 20000000000000000000000000000000), (13 / 50000000000000000000000000000000)⟩ +def w134S4 : Ball := ⟨(61711493008517794483379527494103 / 100000000000000000000000000000000), (21 / 50000000000000000000000000000000)⟩ +def w134S5 : Ball := ⟨(9520770923350851573363953693631 / 25000000000000000000000000000000), (53 / 100000000000000000000000000000000)⟩ +abbrev w134 : Ball := w134S5 +lemma w134_sound : w134.Encloses (weight (-9654) : ℝ) := by + exact weight_enclosed_of_trace (-9654) w134Trace w134S0 w134S1 w134S2 w134S3 w134S4 w134S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def w135Trace : List Ball := [ + ⟨(49252287730902365926521024861231 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(99250410084514322726650231009489 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(24874911641130014256136687437887 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4151018857035718970886655592261 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(830828427983534194686888944909 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(831245164301280065189468314619 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(138590498860737489585565900353 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(19803963291184854726403885017 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(619003216177314834593132001 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(27515854896415275628784243 / 10000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(27519620082125495400569129 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(625517235057890730904323 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(208525865401817949628543 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(8020888996803157973523 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1145923432312676293871 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(38199812018539542101 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w135S0 : Ball := ⟨(485157569345519145080467474597 / 500000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +def w135S1 : Ball := ⟨(18830229367460177444782343866819 / 20000000000000000000000000000000), (7 / 100000000000000000000000000000000)⟩ +def w135S2 : Ball := ⟨(17728876901557985717937739404441 / 20000000000000000000000000000000), (7 / 50000000000000000000000000000000)⟩ +def w135S3 : Ball := ⟨(78578269047649071003244981757131 / 100000000000000000000000000000000), (13 / 50000000000000000000000000000000)⟩ +def w135S4 : Ball := ⟨(61745443665247240400566020662961 / 100000000000000000000000000000000), (21 / 50000000000000000000000000000000)⟩ +def w135S5 : Ball := ⟨(19062499067091102843373918268659 / 50000000000000000000000000000000), (53 / 100000000000000000000000000000000)⟩ +abbrev w135 : Ball := w135S5 +lemma w135_sound : w135.Encloses (weight (-9643) : ℝ) := by + exact weight_enclosed_of_trace (-9643) w135Trace w135S0 w135S1 w135S2 w135S3 w135S4 w135S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def w136Trace : List Ball := [ + ⟨(98507653777886351512215597892381 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(49625978496972619358932627500577 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(49750340213555774765274529695703 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(16604204855482089808199209679923 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4154168051348767475753140550329 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(207812371491621172832191480199 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1385911165731197010207985061 / 1000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(154719066699151963052261659 / 781250000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2476021450500841676934177823 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2149682873266383558132031 / 781250000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(3439962271739050896171461 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(20016603593082763577931 / 800000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(208526366169480969433131 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2005226720981152313997 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(572962908777589937977 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(19099943348936430327 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w136S0 : Ball := ⟨(48518789264119635907549473128633 / 50000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +def w136S1 : Ball := ⟨(18832583293248406723756918876121 / 20000000000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ +def w136S2 : Ball := ⟨(44333274187142375560056067392449 / 50000000000000000000000000000000), (3 / 25000000000000000000000000000000)⟩ +def w136S3 : Ball := ⟨(15723513601218755683616055299239 / 20000000000000000000000000000000), (11 / 50000000000000000000000000000000)⟩ +def w136S4 : Ball := ⟨(12361443998385560156715702538411 / 20000000000000000000000000000000), (7 / 20000000000000000000000000000000)⟩ +def w136S5 : Ball := ⟨(38201324431305596143587794426509 / 100000000000000000000000000000000), (11 / 25000000000000000000000000000000)⟩ +abbrev w136 : Ball := w136S5 +lemma w136_sound : w136.Encloses (weight (-9623) : ℝ) := by + exact weight_enclosed_of_trace (-9623) w136Trace w136S0 w136S1 w136S2 w136S3 w136S4 w136S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def w137Trace : List Ball := [ + ⟨(3945992911094184385146488487171 / 4000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(19864676379150570980601935753199 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(24887102684952463337575033894429 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(16610179685154819299305358060997 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4155364157193369553015805474529 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(83144897274829341799438654809 / 10000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(138619629244315611140912937411 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(3961521207514891004703653933 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1238208871554436646363224857 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(68799761836448110413039371 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(27523302552015806780006103 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2502375869063641199169921 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(104274739513772076700317 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(16043464911215550636677 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1146035906652981165281 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(3820333314910551187 / 5000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w137S0 : Ball := ⟨(24329468835008680864435539425383 / 25000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +def w137S1 : Ball := ⟨(94707688606985385418638513278391 / 100000000000000000000000000000000), (7 / 100000000000000000000000000000000)⟩ +def w137S2 : Ball := ⟨(44847731406388546870037947562603 / 50000000000000000000000000000000), (7 / 50000000000000000000000000000000)⟩ +def w137S3 : Ball := ⟨(80452760491982785126734347652019 / 100000000000000000000000000000000), (13 / 50000000000000000000000000000000)⟩ +def w137S4 : Ball := ⟨(32363233353901730569562584859337 / 50000000000000000000000000000000), (43 / 100000000000000000000000000000000)⟩ +def w137S5 : Ball := ⟨(837903098495277965038710547121 / 2000000000000000000000000000000), (57 / 100000000000000000000000000000000)⟩ +abbrev w137 : Ball := w137S5 +lemma w137_sound : w137.Encloses (weight (-8700) : ℝ) := by + exact weight_enclosed_of_trace (-8700) w137Trace w137S0 w137S1 w137S2 w137S3 w137S4 w137S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def w138Trace : List Ball := [ + ⟨(6166808627015515156832554081011 / 6250000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(19866596533608320756404995579463 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(49777412832716135669777768857069 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(16610982633124203747927697233667 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(519440611403572003162028292909 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(831475778961988161973158462283 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(69311730274073558215480263067 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1980808512998301924838528021 / 10000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2476470991553882198208181469 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(275204373496116456863974739 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(550475736929029345669333 / 2000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2502416233912191723184243 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(208552584476130919475207 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4010921689366983524143 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4476760539202571951 / 390625000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(19101898080486043449 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w138S0 : Ball := ⟨(19471118664823287365124477809939 / 20000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +def w138S1 : Ball := ⟨(23695278878726862303656187951393 / 25000000000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ +def w138S2 : Ball := ⟨(89834598582502295818656978221721 / 100000000000000000000000000000000), (3 / 25000000000000000000000000000000)⟩ +def w138S3 : Ball := ⟨(80702551024793234972011857108923 / 100000000000000000000000000000000), (11 / 50000000000000000000000000000000)⟩ +def w138S4 : Ball := ⟨(2605160696763742248072898176901 / 4000000000000000000000000000000), (9 / 25000000000000000000000000000000)⟩ +def w138S5 : Ball := ⟨(10604472274941479671393272450057 / 25000000000000000000000000000000), (3 / 6250000000000000000000000000000)⟩ +abbrev w138 : Ball := w138S5 +lemma w138_sound : w138.Encloses (weight (-8576) : ℝ) := by + exact weight_enclosed_of_trace (-8576) w138Trace w138S0 w138S1 w138S2 w138S3 w138S4 w138S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def w139Trace : List Ball := [ + ⟨(98786948763039870536244696392459 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(99392240641977065267365805764431 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(49797207673112050811148932372867 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(16615937678695107011225615332849 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2078258372922684642316787456369 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(831641188788929010520896493981 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(34661775330263941875546574871 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2476380159601806546691480273 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2476799545698232446298002889 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(275237236553390853486075827 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(27526774976258346598170997 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2502665285575239381288737 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(208571744989988167781777 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(16045055532378195699337 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(286535489815263603741 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(76413305290943043093 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w139S0 : Ball := ⟨(97588612459114646074113179035643 / 100000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +def w139S1 : Ball := ⟨(38094149126781065317096667143 / 40000000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ +def w139S2 : Ball := ⟨(90697762355839662575616493377227 / 100000000000000000000000000000000), (3 / 25000000000000000000000000000000)⟩ +def w139S3 : Ball := ⟨(20565210240890915448772522252833 / 25000000000000000000000000000000), (11 / 50000000000000000000000000000000)⟩ +def w139S4 : Ball := ⟨(33834229780163566769674837637283 / 50000000000000000000000000000000), (37 / 100000000000000000000000000000000)⟩ +def w139S5 : Ball := ⟨(5723775524084535798695641695481 / 12500000000000000000000000000000), (51 / 100000000000000000000000000000000)⟩ +abbrev w139 : Ball := w139S5 +lemma w139_sound : w139.Encloses (weight (-7811) : ℝ) := by + exact weight_enclosed_of_trace (-7811) w139Trace w139S0 w139S1 w139S2 w139S3 w139S4 w139S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def w140Trace : List Ball := [ + ⟨(12351320980135496203127894302893 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(99404097898440773045858079026919 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(9960233611854407172912755883313 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1661692897178075825008894925543 / 10000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1039178791034910766836613449707 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(166334855505226000651246681037 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(13865183032255566066126325609 / 10000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(19811632600322024768922041187 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(247686526594444510163310767 / 10000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(275243810021211353109516679 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(13763686336800351676427829 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1251357550699913280821553 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(52143894371278471916531 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(641813172540848057587 / 4000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(35817506660781299863 / 3125000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(9551805985592852119 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w140S0 : Ball := ⟨(97635283170774575739408745135457 / 100000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +def w140S1 : Ball := ⟨(19065297039674674184416339773851 / 20000000000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ +def w140S2 : Ball := ⟨(90871387802756973745585087630589 / 100000000000000000000000000000000), (3 / 25000000000000000000000000000000)⟩ +def w140S3 : Ball := ⟨(82576091211990489007865629761863 / 100000000000000000000000000000000), (11 / 50000000000000000000000000000000)⟩ +def w140S4 : Ball := ⟨(34094054199254864339179956738849 / 50000000000000000000000000000000), (37 / 100000000000000000000000000000000)⟩ +def w140S5 : Ball := ⟨(46496181269669129951514099374759 / 100000000000000000000000000000000), (51 / 100000000000000000000000000000000)⟩ +abbrev w140 : Ball := w140S5 +lemma w140_sound : w140.Encloses (weight (-7658) : ℝ) := by + exact weight_enclosed_of_trace (-7658) w140Trace w140S0 w140S1 w140S2 w140S3 w140S4 w140S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def w141Trace : List Ball := [ + ⟨(98821684655275165061384461607367 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(99409678437107086832842680106093 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(49803031934018511334126645412663 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(16617395495406373076581457407793 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2078404271459787612347345483727 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(83168984947779104430061264121 / 10000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(69327027916363365472003886047 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4952977720266974845897533251 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(495379238841096947026827739 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(275246903516618916616507069 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(13763826975586181241913967 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2502738544774324807119257 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(208577381057490778672597 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(3209091630944769746439 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(286542200849266906361 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(76414985575942710533 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w141S0 : Ball := ⟨(48828626790533235094367468405857 / 50000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +def w141S1 : Ball := ⟨(95369391769967199157147337259171 / 100000000000000000000000000000000), (7 / 100000000000000000000000000000000)⟩ +def w141S2 : Ball := ⟨(90953208865734873400351974812597 / 100000000000000000000000000000000), (7 / 50000000000000000000000000000000)⟩ +def w141S3 : Ball := ⟨(82724862029739927759686318982053 / 100000000000000000000000000000000), (13 / 50000000000000000000000000000000)⟩ +def w141S4 : Ball := ⟨(1710850699459876710126125776327 / 2500000000000000000000000000000), (11 / 25000000000000000000000000000000)⟩ +def w141S5 : Ball := ⟨(23416080926738795065261535309587 / 50000000000000000000000000000000), (61 / 100000000000000000000000000000000)⟩ +abbrev w141 : Ball := w141S5 +lemma w141_sound : w141.Encloses (weight (-7586) : ℝ) := by + exact weight_enclosed_of_trace (-7586) w141Trace w141S0 w141S1 w141S2 w141S3 w141S4 w141S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def w142Trace : List Ball := [ + ⟨(49415165965497648626025178275289 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(49707009572577009209015392272913 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(49804481686776655041208219212643 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(8308879180806160267379794416249 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2078440586638879443594277149251 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(831701961341431456307027307469 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(13865578682831358523716554491 / 10000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(19812127326453431222170006133 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2476920250000322776840474503 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(275249309612313998592019347 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1720492045391277203473283 / 6250000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(156422298674397859148959 / 6250000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(8343151354241295713121 / 4000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(16045558365883407305289 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(229235096957574189281 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(76415403780209294429 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w142S0 : Ball := ⟨(97674345095907086404792978385569 / 100000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +def w142S1 : Ball := ⟨(23850694224785871750228218178689 / 25000000000000000000000000000000), (7 / 100000000000000000000000000000000)⟩ +def w142S2 : Ball := ⟨(18203379680135492345746030796811 / 20000000000000000000000000000000), (7 / 50000000000000000000000000000000)⟩ +def w142S3 : Ball := ⟨(82840757944792434906679005267601 / 100000000000000000000000000000000), (13 / 50000000000000000000000000000000)⟩ +def w142S4 : Ball := ⟨(34312955884338454618588856808207 / 50000000000000000000000000000000), (11 / 25000000000000000000000000000000)⟩ +def w142S5 : Ball := ⟨(23547578830411139564977310630337 / 50000000000000000000000000000000), (61 / 100000000000000000000000000000000)⟩ +abbrev w142 : Ball := w142S5 +lemma w142_sound : w142.Encloses (weight (-7530) : ℝ) := by + exact weight_enclosed_of_trace (-7530) w142Trace w142S0 w142S1 w142S2 w142S3 w142S4 w142S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def w143Trace : List Ball := [ + ⟨(19767734218411076979536138933993 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(49709102533744894695315369931931 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(49805879722650453450551964570403 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4154527070081253064698457562269 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(259809450731163230994309350403 / 6250000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(415856820462492060255411887353 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(138657456038455886357158576953 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(9906168022814447586102169551 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(619235861764496471630406411 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(275251629812243741768482487 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(13764041845485917906504221 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(156423397613990580785859 / 6250000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1629532316962670499911 / 781250000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(3209130999835904607683 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1146181927626885904997 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(15283161409721842923 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w143S0 : Ball := ⟨(24422707258108762029586638939331 / 25000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +def w143S1 : Ball := ⟨(95434980770444544797243626288949 / 100000000000000000000000000000000), (7 / 100000000000000000000000000000000)⟩ +def w143S2 : Ball := ⟨(45539177773275600206264478339293 / 50000000000000000000000000000000), (7 / 50000000000000000000000000000000)⟩ +def w143S3 : Ball := ⟨(82952668490639938124151322006801 / 100000000000000000000000000000000), (13 / 50000000000000000000000000000000)⟩ +def w143S4 : Ball := ⟨(8601431512147510037792604593567 / 12500000000000000000000000000000), (11 / 25000000000000000000000000000000)⟩ +def w143S5 : Ball := ⟨(47350159397225088716053119586929 / 100000000000000000000000000000000), (61 / 100000000000000000000000000000000)⟩ +abbrev w143 : Ball := w143S5 +lemma w143_sound : w143.Encloses (weight (-7476) : ℝ) := by + exact weight_enclosed_of_trace (-7476) w143Trace w143S0 w143S1 w143S2 w143S3 w143S4 w143S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def w144Trace : List Ball := [ + ⟨(98843149820809675677763590955863 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(99420453159904332782503261480827 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(49806630544007925231356606992157 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(8309148102251097887187560428321 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(519623603217090289153171049013 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(83171991341001560392519077747 / 10000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(138658352480642785176747113289 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(19812448137170186084428143377 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2476955904898525401423517829 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(275252875860218165200775723 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(27528196988058875771502629 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2502783804658187709816261 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(208580863036104111847467 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(8022853447643472845811 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1146185387698147035497 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(38208011809337919209 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w144S0 : Ball := ⟨(97699682664990278210462489014863 / 100000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +def w144S1 : Ball := ⟨(19090455985679603741438997227579 / 20000000000000000000000000000000), (7 / 100000000000000000000000000000000)⟩ +def w144S2 : Ball := ⟨(91111377435292552712956713879161 / 100000000000000000000000000000000), (7 / 50000000000000000000000000000000)⟩ +def w144S3 : Ball := ⟨(83012830981563369405247503332129 / 100000000000000000000000000000000), (13 / 50000000000000000000000000000000)⟩ +def w144S4 : Ball := ⟨(68911301075736072007966723622513 / 100000000000000000000000000000000), (11 / 25000000000000000000000000000000)⟩ +def w144S5 : Ball := ⟨(9497534831901487030266582364531 / 20000000000000000000000000000000), (61 / 100000000000000000000000000000000)⟩ +abbrev w144 : Ball := w144S5 +lemma w144_sound : w144.Encloses (weight (-7447) : ℝ) := by + exact weight_enclosed_of_trace (-7447) w144Trace w144S0 w144S1 w144S2 w144S3 w144S4 w144S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def w145Trace : List Ball := [ + ⟨(49430687853352556168317098843489 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(49714800635061270606775377291173 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(49809685785451442669875435570799 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(16619060896585713095882280623357 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4157141881813383176696284311351 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(831745436771924352714518679499 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(138662000177615990727436001387 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(990645212270806544752681137 / 5000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2477006596585433191989922847 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(68814486523061083154283169 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(13764328999408330017869443 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2502822227903887947031927 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(208583819045124232896907 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(8022959030994979732851 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1146199466811200103977 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(38208452417404498671 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w145S0 : Ball := ⟨(97735716066223037496903551134477 / 100000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +def w145S1 : Ball := ⟨(95522701949773679752949234014577 / 100000000000000000000000000000000), (7 / 100000000000000000000000000000000)⟩ +def w145S2 : Ball := ⟨(91245865877852963594914898493647 / 100000000000000000000000000000000), (7 / 50000000000000000000000000000000)⟩ +def w145S3 : Ball := ⟨(1665161607959826356537772944251 / 2000000000000000000000000000000), (13 / 50000000000000000000000000000000)⟩ +def w145S4 : Ball := ⟨(1732976987889596529067532836753 / 2500000000000000000000000000000), (11 / 25000000000000000000000000000000)⟩ +def w145S5 : Ball := ⟨(48051347848878380719513662951177 / 100000000000000000000000000000000), (31 / 50000000000000000000000000000000)⟩ +abbrev w145 : Ball := w145S5 +lemma w145_sound : w145.Encloses (weight (-7329) : ℝ) := by + exact weight_enclosed_of_trace (-7329) w145Trace w145S0 w145S1 w145S2 w145S3 w145S4 w145S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def w146Trace : List Ball := [ + ⟨(98876515013933829975835704073047 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(99437199707142693329435678778847 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(49812223403218955768381355488573 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(16619696022661915120444265981683 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2078634501662355800189215764719 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(831766635161283698585325380469 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(27733005949710032878580827921 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(19813283061372379675043499031 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(247704869788071092111372131 / 10000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(275262157092008307913144603 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2752904088291842234190253 / 10000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(19553547965335576445021 / 781250000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(104293137047405561278861 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4011523360417474415799 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1146211159880907089699 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1910440917306887979 / 2500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w146S0 : Ball := ⟨(97765652213006820974204888804239 / 100000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +def w146S1 : Ball := ⟨(2986913360198314222297730641439 / 3125000000000000000000000000000), (7 / 100000000000000000000000000000000)⟩ +def w146S2 : Ball := ⟨(18271542110886265651522624782247 / 20000000000000000000000000000000), (7 / 50000000000000000000000000000000)⟩ +def w146S3 : Ball := ⟨(16692462555494506622283495772909 / 20000000000000000000000000000000), (13 / 50000000000000000000000000000000)⟩ +def w146S4 : Ball := ⟨(69659576541646548644144525091763 / 100000000000000000000000000000000), (11 / 25000000000000000000000000000000)⟩ +def w146S5 : Ball := ⟨(379098172184493291735152239011 / 781250000000000000000000000000), (31 / 50000000000000000000000000000000)⟩ +abbrev w146 : Ball := w146S5 +lemma w146_sound : w146.Encloses (weight (-7231) : ℝ) := by + exact weight_enclosed_of_trace (-7231) w146Trace w146S0 w146S1 w146S2 w146S3 w146S4 w146S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def w147Trace : List Ball := [ + ⟨(49440111476385135576824748327097 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(99439060666994097636231738770073 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1992513795608588943036976201767 / 4000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(8309925784832587165837433864839 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(519662517013929068869698204401 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(831771826744808388207556560761 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(138665771701951558276277847439 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(19813375834590202868192941317 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(619264752149596817501396397 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(68815797093778575819578573 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(27529134651942011689426399 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2502861954777651783514457 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(8343475013586014453073 / 4000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(16046136392341087522777 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1146214023523980717931 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(76417815922675483687 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w147S0 : Ball := ⟨(97772984911895567611173062729087 / 100000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +def w147S1 : Ball := ⟨(764764526286540665199184831663 / 800000000000000000000000000000), (7 / 100000000000000000000000000000000)⟩ +def w147S2 : Ball := ⟨(45692560989552886569036259340553 / 50000000000000000000000000000000), (7 / 50000000000000000000000000000000)⟩ +def w147S3 : Ball := ⟨(4175620259568020529345364322599 / 5000000000000000000000000000000), (13 / 50000000000000000000000000000000)⟩ +def w147S4 : Ball := ⟨(69743218208459612564189847472473 / 100000000000000000000000000000000), (11 / 25000000000000000000000000000000)⟩ +def w147S5 : Ball := ⟨(4864116486072812449975073121731 / 10000000000000000000000000000000), (31 / 50000000000000000000000000000000)⟩ +abbrev w147 : Ball := w147S5 +lemma w147_sound : w147.Encloses (weight (-7207) : ℝ) := by + exact weight_enclosed_of_trace (-7207) w147Trace w147S0 w147S1 w147S2 w147S3 w147S4 w147S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def w148Trace : List Ball := [ + ⟨(9889011146948314339378418154309 / 10000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(49722011726920637545717752514509 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(9962900449155367254130667266649 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(3324053274613601757857055767129 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2078691579388285140983355162671 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(831785671239211284890390374907 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(27733550055665994777642262157 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(247670290420176397230942857 / 1250000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1238543252111638980410081187 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(137632969248873488898058811 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(13764692352767351732574913 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(500576559114092116499943 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(208588478674958533321787 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(16046250928513529469581 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(229244331994245641307 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(38209146935204361213 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w148S0 : Ball := ⟨(24448135366117003865237226941473 / 25000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +def w148S1 : Ball := ⟨(95633811660796961060374973094347 / 100000000000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ +def w148S2 : Ball := ⟨(18291651865545569606994286557393 / 20000000000000000000000000000000), (3 / 25000000000000000000000000000000)⟩ +def w148S3 : Ball := ⟨(522788324953619870099728693281 / 625000000000000000000000000000), (11 / 50000000000000000000000000000000)⟩ +def w148S4 : Ball := ⟨(69966753973199780903541916026673 / 100000000000000000000000000000000), (37 / 100000000000000000000000000000000)⟩ +def w148S5 : Ball := ⟨(48953466615462673273822816782719 / 100000000000000000000000000000000), (53 / 100000000000000000000000000000000)⟩ +abbrev w148 : Ball := w148S5 +lemma w148_sound : w148.Encloses (weight (-7143) : ℝ) := by + exact weight_enclosed_of_trace (-7143) w148Trace w148S0 w148S1 w148S2 w148S3 w148S4 w148S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def w149Trace : List Ball := [ + ⟨(98910818754290297702077778422709 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(19890883071884989889291534012451 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(24908986301043826099806759891327 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(3324226984274578177981091142857 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(519694624554438884419585702749 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(831814659429245033298311969157 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(69335946541340563733319522961 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(9907070621555664876580075541 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(495428814993504656182508379 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(68817924182208653277028623 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1376495413436637089267857 / 5000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1251463216009079398495837 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(26073979466549642043503 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(40116226858919319521 / 250000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(286559412273061286747 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(15283858914695038207 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w149S0 : Ball := ⟨(97833500666440652793059199343149 / 100000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +def w149S1 : Ball := ⟨(23928484631626109135506645132787 / 25000000000000000000000000000000), (7 / 100000000000000000000000000000000)⟩ +def w149S2 : Ball := ⟨(3664463211302188107609541898023 / 4000000000000000000000000000000), (7 / 50000000000000000000000000000000)⟩ +def w149S3 : Ball := ⟨(41963408209334827898015839150367 / 50000000000000000000000000000000), (13 / 50000000000000000000000000000000)⟩ +def w149S4 : Ball := ⟨(35218552570865392544190245371007 / 50000000000000000000000000000000), (11 / 25000000000000000000000000000000)⟩ +def w149S5 : Ball := ⟨(24806928903736187010464986272311 / 50000000000000000000000000000000), (63 / 100000000000000000000000000000000)⟩ +abbrev w149 : Ball := w149S5 +lemma w149_sound : w149.Encloses (weight (-7009) : ℝ) := by + exact weight_enclosed_of_trace (-7009) w149Trace w149S0 w149S1 w149S2 w149S3 w149S4 w149S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def Z0_2_6Raw (ij : PairSlot) : Ball := + match ij.1.val, ij.2.val with + | 0, 0 => w195 + | 0, 1 => w195 + | 0, 2 => w195 + | 0, 3 => w195 + | 0, 4 => w195 + | 0, 5 => w195 + | 1, 0 => w195 + | 1, 1 => w195 + | 1, 2 => w195 + | 1, 3 => w195 + | 1, 4 => w195 + | 1, 5 => w195 + | 2, 0 => w195 + | 2, 1 => w195 + | 2, 2 => w195 + | 2, 3 => w195 + | 2, 4 => w195 + | 2, 5 => w125 + | 3, 0 => w195 + | 3, 1 => w195 + | 3, 2 => w195 + | 3, 3 => w195 + | 3, 4 => w195 + | 3, 5 => w50 + | 4, 0 => w195 + | 4, 1 => w195 + | 4, 2 => w195 + | 4, 3 => w195 + | 4, 4 => w195 + | 4, 5 => w195 + | 5, 0 => w195 + | 5, 1 => w195 + | 5, 2 => w125 + | 5, 3 => w50 + | 5, 4 => w195 + | 5, 5 => w195 + | _, _ => (.exact 0) +lemma Z0_2_6Raw_sound_0 (j : Fin 6) : + (Z0_2_6Raw (0,j)).Encloses (weight (orderedPairInteger (shape 0 2 6) 0 j) : ℝ) := by + fin_cases j + · change (Z0_2_6Raw (0,0)).Encloses (weight (orderedPairInteger (shape 0 2 6) 0 0) : ℝ) + have he : orderedPairInteger (shape 0 2 6) 0 0 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_2_6Raw (0,1)).Encloses (weight (orderedPairInteger (shape 0 2 6) 0 1) : ℝ) + have he : orderedPairInteger (shape 0 2 6) 0 1 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_2_6Raw (0,2)).Encloses (weight (orderedPairInteger (shape 0 2 6) 0 2) : ℝ) + have he : orderedPairInteger (shape 0 2 6) 0 2 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_2_6Raw (0,3)).Encloses (weight (orderedPairInteger (shape 0 2 6) 0 3) : ℝ) + have he : orderedPairInteger (shape 0 2 6) 0 3 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_2_6Raw (0,4)).Encloses (weight (orderedPairInteger (shape 0 2 6) 0 4) : ℝ) + have he : orderedPairInteger (shape 0 2 6) 0 4 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_2_6Raw (0,5)).Encloses (weight (orderedPairInteger (shape 0 2 6) 0 5) : ℝ) + have he : orderedPairInteger (shape 0 2 6) 0 5 = (0) := by decide +kernel + rw [he] + exact w195_sound +lemma Z0_2_6Raw_sound_1 (j : Fin 6) : + (Z0_2_6Raw (1,j)).Encloses (weight (orderedPairInteger (shape 0 2 6) 1 j) : ℝ) := by + fin_cases j + · change (Z0_2_6Raw (1,0)).Encloses (weight (orderedPairInteger (shape 0 2 6) 1 0) : ℝ) + have he : orderedPairInteger (shape 0 2 6) 1 0 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_2_6Raw (1,1)).Encloses (weight (orderedPairInteger (shape 0 2 6) 1 1) : ℝ) + have he : orderedPairInteger (shape 0 2 6) 1 1 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_2_6Raw (1,2)).Encloses (weight (orderedPairInteger (shape 0 2 6) 1 2) : ℝ) + have he : orderedPairInteger (shape 0 2 6) 1 2 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_2_6Raw (1,3)).Encloses (weight (orderedPairInteger (shape 0 2 6) 1 3) : ℝ) + have he : orderedPairInteger (shape 0 2 6) 1 3 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_2_6Raw (1,4)).Encloses (weight (orderedPairInteger (shape 0 2 6) 1 4) : ℝ) + have he : orderedPairInteger (shape 0 2 6) 1 4 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_2_6Raw (1,5)).Encloses (weight (orderedPairInteger (shape 0 2 6) 1 5) : ℝ) + have he : orderedPairInteger (shape 0 2 6) 1 5 = (0) := by decide +kernel + rw [he] + exact w195_sound +lemma Z0_2_6Raw_sound_2 (j : Fin 6) : + (Z0_2_6Raw (2,j)).Encloses (weight (orderedPairInteger (shape 0 2 6) 2 j) : ℝ) := by + fin_cases j + · change (Z0_2_6Raw (2,0)).Encloses (weight (orderedPairInteger (shape 0 2 6) 2 0) : ℝ) + have he : orderedPairInteger (shape 0 2 6) 2 0 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_2_6Raw (2,1)).Encloses (weight (orderedPairInteger (shape 0 2 6) 2 1) : ℝ) + have he : orderedPairInteger (shape 0 2 6) 2 1 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_2_6Raw (2,2)).Encloses (weight (orderedPairInteger (shape 0 2 6) 2 2) : ℝ) + have he : orderedPairInteger (shape 0 2 6) 2 2 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_2_6Raw (2,3)).Encloses (weight (orderedPairInteger (shape 0 2 6) 2 3) : ℝ) + have he : orderedPairInteger (shape 0 2 6) 2 3 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_2_6Raw (2,4)).Encloses (weight (orderedPairInteger (shape 0 2 6) 2 4) : ℝ) + have he : orderedPairInteger (shape 0 2 6) 2 4 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_2_6Raw (2,5)).Encloses (weight (orderedPairInteger (shape 0 2 6) 2 5) : ℝ) + have he : orderedPairInteger (shape 0 2 6) 2 5 = (-11037) := by decide +kernel + rw [he] + exact w125_sound +lemma Z0_2_6Raw_sound_3 (j : Fin 6) : + (Z0_2_6Raw (3,j)).Encloses (weight (orderedPairInteger (shape 0 2 6) 3 j) : ℝ) := by + fin_cases j + · change (Z0_2_6Raw (3,0)).Encloses (weight (orderedPairInteger (shape 0 2 6) 3 0) : ℝ) + have he : orderedPairInteger (shape 0 2 6) 3 0 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_2_6Raw (3,1)).Encloses (weight (orderedPairInteger (shape 0 2 6) 3 1) : ℝ) + have he : orderedPairInteger (shape 0 2 6) 3 1 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_2_6Raw (3,2)).Encloses (weight (orderedPairInteger (shape 0 2 6) 3 2) : ℝ) + have he : orderedPairInteger (shape 0 2 6) 3 2 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_2_6Raw (3,3)).Encloses (weight (orderedPairInteger (shape 0 2 6) 3 3) : ℝ) + have he : orderedPairInteger (shape 0 2 6) 3 3 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_2_6Raw (3,4)).Encloses (weight (orderedPairInteger (shape 0 2 6) 3 4) : ℝ) + have he : orderedPairInteger (shape 0 2 6) 3 4 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_2_6Raw (3,5)).Encloses (weight (orderedPairInteger (shape 0 2 6) 3 5) : ℝ) + have he : orderedPairInteger (shape 0 2 6) 3 5 = (-36170) := by decide +kernel + rw [he] + exact w50_sound +lemma Z0_2_6Raw_sound_4 (j : Fin 6) : + (Z0_2_6Raw (4,j)).Encloses (weight (orderedPairInteger (shape 0 2 6) 4 j) : ℝ) := by + fin_cases j + · change (Z0_2_6Raw (4,0)).Encloses (weight (orderedPairInteger (shape 0 2 6) 4 0) : ℝ) + have he : orderedPairInteger (shape 0 2 6) 4 0 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_2_6Raw (4,1)).Encloses (weight (orderedPairInteger (shape 0 2 6) 4 1) : ℝ) + have he : orderedPairInteger (shape 0 2 6) 4 1 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_2_6Raw (4,2)).Encloses (weight (orderedPairInteger (shape 0 2 6) 4 2) : ℝ) + have he : orderedPairInteger (shape 0 2 6) 4 2 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_2_6Raw (4,3)).Encloses (weight (orderedPairInteger (shape 0 2 6) 4 3) : ℝ) + have he : orderedPairInteger (shape 0 2 6) 4 3 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_2_6Raw (4,4)).Encloses (weight (orderedPairInteger (shape 0 2 6) 4 4) : ℝ) + have he : orderedPairInteger (shape 0 2 6) 4 4 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_2_6Raw (4,5)).Encloses (weight (orderedPairInteger (shape 0 2 6) 4 5) : ℝ) + have he : orderedPairInteger (shape 0 2 6) 4 5 = (0) := by decide +kernel + rw [he] + exact w195_sound +lemma Z0_2_6Raw_sound_5 (j : Fin 6) : + (Z0_2_6Raw (5,j)).Encloses (weight (orderedPairInteger (shape 0 2 6) 5 j) : ℝ) := by + fin_cases j + · change (Z0_2_6Raw (5,0)).Encloses (weight (orderedPairInteger (shape 0 2 6) 5 0) : ℝ) + have he : orderedPairInteger (shape 0 2 6) 5 0 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_2_6Raw (5,1)).Encloses (weight (orderedPairInteger (shape 0 2 6) 5 1) : ℝ) + have he : orderedPairInteger (shape 0 2 6) 5 1 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_2_6Raw (5,2)).Encloses (weight (orderedPairInteger (shape 0 2 6) 5 2) : ℝ) + have he : orderedPairInteger (shape 0 2 6) 5 2 = (-11037) := by decide +kernel + rw [he] + exact w125_sound + · change (Z0_2_6Raw (5,3)).Encloses (weight (orderedPairInteger (shape 0 2 6) 5 3) : ℝ) + have he : orderedPairInteger (shape 0 2 6) 5 3 = (-36170) := by decide +kernel + rw [he] + exact w50_sound + · change (Z0_2_6Raw (5,4)).Encloses (weight (orderedPairInteger (shape 0 2 6) 5 4) : ℝ) + have he : orderedPairInteger (shape 0 2 6) 5 4 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_2_6Raw (5,5)).Encloses (weight (orderedPairInteger (shape 0 2 6) 5 5) : ℝ) + have he : orderedPairInteger (shape 0 2 6) 5 5 = (0) := by decide +kernel + rw [he] + exact w195_sound +lemma Z0_2_6Raw_sound (ij : PairSlot) : + (Z0_2_6Raw ij).Encloses (weight (orderedPairInteger (shape 0 2 6) ij.1 ij.2) : ℝ) := by + rcases ij with ⟨i,j⟩ + revert i + exact forall_fin6 (Z0_2_6Raw_sound_0 j) (Z0_2_6Raw_sound_1 j) (Z0_2_6Raw_sound_2 j) (Z0_2_6Raw_sound_3 j) (Z0_2_6Raw_sound_4 j) (Z0_2_6Raw_sound_5 j) +def Z0_2_6Den : Ball := ⟨(4292524407740908366058292728641 / 2500000000000000000000000000000), (51 / 50000000000000000000000000000000)⟩ +lemma Z0_2_6Den_sound : Z0_2_6Den.Encloses + (((orderedPairs (shape 0 2 6)).map (fun ij => weight (orderedPairInteger (shape 0 2 6) ij.1 ij.2))).sum : ℝ) := by + exact contains_sound (list_cast_enclosed (orderedPairs (shape 0 2 6)) Z0_2_6Raw + (fun ij => weight (orderedPairInteger (shape 0 2 6) ij.1 ij.2)) + (fun ij _ => Z0_2_6Raw_sound ij)) (by decide +kernel) +lemma Z0_2_6Den_pos : 0 < Z0_2_6Den.lower := by decide +kernel +def Z0_2_6Probs (ij : PairSlot) : Ball := + match ij.1.val, ij.2.val with + | 2, 5 => ⟨(9657537875187848339599195720457 / 50000000000000000000000000000000), (39 / 100000000000000000000000000000000)⟩ + | 3, 5 => ⟨(312906143484347380943417643667 / 20000000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ + | 4, 4 => ⟨(58240787064405132832169040681501 / 100000000000000000000000000000000), (9 / 25000000000000000000000000000000)⟩ + | 5, 2 => ⟨(9657537875187848339599195720457 / 50000000000000000000000000000000), (39 / 100000000000000000000000000000000)⟩ + | 5, 3 => ⟨(312906143484347380943417643667 / 20000000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ + | _, _ => (.exact 0) +lemma Z0_2_6Contains : ∀ i j : Fin 6, + statisticWeight i + statisticWeight j = shapeMax (shape 0 2 6) → + contains (.mul (Z0_2_6Raw (i,j)) (.inv Z0_2_6Den)) (Z0_2_6Probs (i,j)) = true := by + decide +kernel +lemma Z0_2_6Zero : ∀ i j : Fin 6, + statisticWeight i + statisticWeight j ≠ shapeMax (shape 0 2 6) → Z0_2_6Probs (i,j) = .exact 0 := by + decide +kernel +lemma Z0_2_6Probs_sound (ij : PairSlot) : + (Z0_2_6Probs ij).Encloses (zeroPairLaw (shape 0 2 6) ij.1 ij.2 : ℝ) := by + by_cases h : statisticWeight ij.1 + statisticWeight ij.2 = shapeMax (shape 0 2 6) + · have hb := contains_sound (Ball.mul_sound (Z0_2_6Raw_sound ij) + (Ball.inv_sound Z0_2_6Den_sound Z0_2_6Den_pos)) (Z0_2_6Contains ij.1 ij.2 h) + simpa only [zeroPairLaw, h, ite_true, Rat.cast_div, Rat.cast_mul, + Rat.cast_inv, div_eq_mul_inv] using hb + · rw [Z0_2_6Zero ij.1 ij.2 h] + simpa only [zeroPairLaw, h, ite_false] using Ball.exact_sound 0 + +def Z0_2_6Half (w : Fin 3) (ij : PairSlot) : Ball := + if (shape 0 2 6) w = 0 then if ij = (0,0) then .exact 1 else .exact 0 + else if w = halfMaxAxis (shape 0 2 6) then Z0_2_6Probs ij + else Z0_2_6Probs (kappa ij.1, kappa ij.2) +lemma Z0_2_6Half_sound (w : Fin 3) (ij : PairSlot) : + (Z0_2_6Half w ij).Encloses (halfLaw (shape 0 2 6) w ij : ℝ) := by + have hp : positive (shape 0 2 6) = false := by decide +kernel + simp only [Z0_2_6Half, halfLaw, hp, Bool.false_eq_true, ite_false] + split_ifs + · exact Ball.exact_sound 1 + · exact Ball.exact_sound 0 + · exact Z0_2_6Probs_sound _ + · exact Z0_2_6Probs_sound _ + +def Z0_2_6Value (a : PairSlot) : ℝ := (zeroPairLaw (shape 0 2 6) a.1 a.2 : ℝ) +def Z0_2_6E_2_5LogWitness : LogWitness := ⟨-3, 9657537875187848339599195720457, 6250000000000000000000000000000⟩ +def Z0_2_6E_2_5Log : Ball := ⟨(-32885685360713365998269732360853 / 20000000000000000000000000000000), (42351647467 / 50000000000000000000000000000000)⟩ +lemma Z0_2_6E_2_5Log_sound : Z0_2_6E_2_5Log.Encloses (Real.log (Z0_2_6Value ((2,5) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound (Z0_2_6Probs_sound ((2,5) : PairSlot)) (w := Z0_2_6E_2_5LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z0_2_6E_2_5 : Ball := ⟨(1984967199516249315866366927071 / 6250000000000000000000000000000), (4090126411 / 25000000000000000000000000000000)⟩ +lemma Z0_2_6E_2_5_sound : Z0_2_6E_2_5.Encloses (Foundation.entropyTerm (Z0_2_6Value ((2,5) : PairSlot))) := by + exact contains_sound (entropyTerm_ball (Z0_2_6Probs_sound ((2,5) : PairSlot)) Z0_2_6E_2_5Log_sound) (by decide +kernel) +def Z0_2_6E_3_5LogWitness : LogWitness := ⟨-6, 312906143484347380943417643667, 312500000000000000000000000000⟩ +def Z0_2_6E_3_5Log : Ball := ⟨(-83151685360713365998269720903561 / 20000000000000000000000000000000), (37057691509 / 25000000000000000000000000000000)⟩ +lemma Z0_2_6E_3_5Log_sound : Z0_2_6E_3_5Log.Encloses (Real.log (Z0_2_6Value ((3,5) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound (Z0_2_6Probs_sound ((3,5) : PairSlot)) (w := Z0_2_6E_3_5LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z0_2_6E_3_5 : Ball := ⟨(101635442150174547299056890093 / 1562500000000000000000000000000), (463823177 / 20000000000000000000000000000000)⟩ +lemma Z0_2_6E_3_5_sound : Z0_2_6E_3_5.Encloses (Foundation.entropyTerm (Z0_2_6Value ((3,5) : PairSlot))) := by + exact contains_sound (entropyTerm_ball (Z0_2_6Probs_sound ((3,5) : PairSlot)) Z0_2_6E_3_5Log_sound) (by decide +kernel) +def Z0_2_6E_4_4LogWitness : LogWitness := ⟨-1, 58240787064405132832169040681501, 50000000000000000000000000000000⟩ +def Z0_2_6E_4_4Log : Ball := ⟨(-54058426803566829991348699995259 / 100000000000000000000000000000000), (42351647427 / 100000000000000000000000000000000)⟩ +lemma Z0_2_6E_4_4Log_sound : Z0_2_6E_4_4Log.Encloses (Real.log (Z0_2_6Value ((4,4) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound (Z0_2_6Probs_sound ((4,4) : PairSlot)) (w := Z0_2_6E_4_4LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z0_2_6E_4_4 : Ball := ⟨(6296810649006533489546320818881 / 20000000000000000000000000000000), (1541620801 / 6250000000000000000000000000000)⟩ +lemma Z0_2_6E_4_4_sound : Z0_2_6E_4_4.Encloses (Foundation.entropyTerm (Z0_2_6Value ((4,4) : PairSlot))) := by + exact contains_sound (entropyTerm_ball (Z0_2_6Probs_sound ((4,4) : PairSlot)) Z0_2_6E_4_4Log_sound) (by decide +kernel) +def Z0_2_6E_5_2LogWitness : LogWitness := ⟨-3, 9657537875187848339599195720457, 6250000000000000000000000000000⟩ +def Z0_2_6E_5_2Log : Ball := ⟨(-32885685360713365998269732360853 / 20000000000000000000000000000000), (42351647467 / 50000000000000000000000000000000)⟩ +lemma Z0_2_6E_5_2Log_sound : Z0_2_6E_5_2Log.Encloses (Real.log (Z0_2_6Value ((5,2) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound (Z0_2_6Probs_sound ((5,2) : PairSlot)) (w := Z0_2_6E_5_2LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z0_2_6E_5_2 : Ball := ⟨(1984967199516249315866366927071 / 6250000000000000000000000000000), (4090126411 / 25000000000000000000000000000000)⟩ +lemma Z0_2_6E_5_2_sound : Z0_2_6E_5_2.Encloses (Foundation.entropyTerm (Z0_2_6Value ((5,2) : PairSlot))) := by + exact contains_sound (entropyTerm_ball (Z0_2_6Probs_sound ((5,2) : PairSlot)) Z0_2_6E_5_2Log_sound) (by decide +kernel) +def Z0_2_6E_5_3LogWitness : LogWitness := ⟨-6, 312906143484347380943417643667, 312500000000000000000000000000⟩ +def Z0_2_6E_5_3Log : Ball := ⟨(-83151685360713365998269720903561 / 20000000000000000000000000000000), (37057691509 / 25000000000000000000000000000000)⟩ +lemma Z0_2_6E_5_3Log_sound : Z0_2_6E_5_3Log.Encloses (Real.log (Z0_2_6Value ((5,3) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound (Z0_2_6Probs_sound ((5,3) : PairSlot)) (w := Z0_2_6E_5_3LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z0_2_6E_5_3 : Ball := ⟨(101635442150174547299056890093 / 1562500000000000000000000000000), (463823177 / 20000000000000000000000000000000)⟩ +lemma Z0_2_6E_5_3_sound : Z0_2_6E_5_3.Encloses (Foundation.entropyTerm (Z0_2_6Value ((5,3) : PairSlot))) := by + exact contains_sound (entropyTerm_ball (Z0_2_6Probs_sound ((5,3) : PairSlot)) Z0_2_6E_5_3Log_sound) (by decide +kernel) +def Z0_2_6Terms (a : PairSlot) : Ball := + match a.1.val, a.2.val with + | 2, 5 => ⟨(1984967199516249315866366927071 / 6250000000000000000000000000000), (4090126411 / 25000000000000000000000000000000)⟩ + | 3, 5 => ⟨(101635442150174547299056890093 / 1562500000000000000000000000000), (463823177 / 20000000000000000000000000000000)⟩ + | 4, 4 => ⟨(6296810649006533489546320818881 / 20000000000000000000000000000000), (1541620801 / 6250000000000000000000000000000)⟩ + | 5, 2 => ⟨(1984967199516249315866366927071 / 6250000000000000000000000000000), (4090126411 / 25000000000000000000000000000000)⟩ + | 5, 3 => ⟨(101635442150174547299056890093 / 1562500000000000000000000000000), (463823177 / 20000000000000000000000000000000)⟩ + | _, _ => (.exact 0) +lemma Z0_2_6Terms_sound (a : PairSlot) : + (Z0_2_6Terms a).Encloses (Foundation.entropyTerm (Z0_2_6Value a)) := by + rcases a with ⟨i,j⟩ + revert j i + apply forall_fin6 + · exact forall_fin6 (entropyTerm_zero_ball (Z0_2_6Probs_sound ((0,0) : PairSlot))) (entropyTerm_zero_ball (Z0_2_6Probs_sound ((0,1) : PairSlot))) (entropyTerm_zero_ball (Z0_2_6Probs_sound ((0,2) : PairSlot))) (entropyTerm_zero_ball (Z0_2_6Probs_sound ((0,3) : PairSlot))) (entropyTerm_zero_ball (Z0_2_6Probs_sound ((0,4) : PairSlot))) (entropyTerm_zero_ball (Z0_2_6Probs_sound ((0,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball (Z0_2_6Probs_sound ((1,0) : PairSlot))) (entropyTerm_zero_ball (Z0_2_6Probs_sound ((1,1) : PairSlot))) (entropyTerm_zero_ball (Z0_2_6Probs_sound ((1,2) : PairSlot))) (entropyTerm_zero_ball (Z0_2_6Probs_sound ((1,3) : PairSlot))) (entropyTerm_zero_ball (Z0_2_6Probs_sound ((1,4) : PairSlot))) (entropyTerm_zero_ball (Z0_2_6Probs_sound ((1,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball (Z0_2_6Probs_sound ((2,0) : PairSlot))) (entropyTerm_zero_ball (Z0_2_6Probs_sound ((2,1) : PairSlot))) (entropyTerm_zero_ball (Z0_2_6Probs_sound ((2,2) : PairSlot))) (entropyTerm_zero_ball (Z0_2_6Probs_sound ((2,3) : PairSlot))) (entropyTerm_zero_ball (Z0_2_6Probs_sound ((2,4) : PairSlot))) Z0_2_6E_2_5_sound + · exact forall_fin6 (entropyTerm_zero_ball (Z0_2_6Probs_sound ((3,0) : PairSlot))) (entropyTerm_zero_ball (Z0_2_6Probs_sound ((3,1) : PairSlot))) (entropyTerm_zero_ball (Z0_2_6Probs_sound ((3,2) : PairSlot))) (entropyTerm_zero_ball (Z0_2_6Probs_sound ((3,3) : PairSlot))) (entropyTerm_zero_ball (Z0_2_6Probs_sound ((3,4) : PairSlot))) Z0_2_6E_3_5_sound + · exact forall_fin6 (entropyTerm_zero_ball (Z0_2_6Probs_sound ((4,0) : PairSlot))) (entropyTerm_zero_ball (Z0_2_6Probs_sound ((4,1) : PairSlot))) (entropyTerm_zero_ball (Z0_2_6Probs_sound ((4,2) : PairSlot))) (entropyTerm_zero_ball (Z0_2_6Probs_sound ((4,3) : PairSlot))) Z0_2_6E_4_4_sound (entropyTerm_zero_ball (Z0_2_6Probs_sound ((4,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball (Z0_2_6Probs_sound ((5,0) : PairSlot))) (entropyTerm_zero_ball (Z0_2_6Probs_sound ((5,1) : PairSlot))) Z0_2_6E_5_2_sound Z0_2_6E_5_3_sound (entropyTerm_zero_ball (Z0_2_6Probs_sound ((5,4) : PairSlot))) (entropyTerm_zero_ball (Z0_2_6Probs_sound ((5,5) : PairSlot))) +def Z0_2_6Entropy : Ball := ⟨(108012340224774987609734627692581 / 100000000000000000000000000000000), (31012587937 / 50000000000000000000000000000000)⟩ +lemma Z0_2_6Entropy_sound : Z0_2_6Entropy.Encloses (Foundation.finiteEntropy Z0_2_6Value) := by + exact contains_sound (entropyPair_enclosed Z0_2_6Value Z0_2_6Terms Z0_2_6Terms_sound) (by decide +kernel) +def Z0_2_6Labels : Ball := ⟨(394723297085604726721740039214937 / 100000000000000000000000000000000), (128557238001 / 100000000000000000000000000000000)⟩ +lemma Z0_2_6Labels_sound : Z0_2_6Labels.Encloses + (∑ a : PairSlot, (zeroPairLaw (shape 0 2 6) a.1 a.2 : ℝ) * + Real.log (AllFieldParameters.multiplicity a.1 * AllFieldParameters.multiplicity a.2 : ℕ)) := by + exact contains_sound (pairSumBall_sound (fun a => .mul (Z0_2_6Probs a) (multLogs a)) + _ (fun a => Ball.mul_sound (Z0_2_6Probs_sound a) (multLogs_sound a))) (by decide +kernel) +def Z0_2_6Four : Ball := ⟨(251367818655189857165737333453759 / 50000000000000000000000000000000), (1524659311 / 800000000000000000000000000000)⟩ +lemma Z0_2_6Four_sound : Z0_2_6Four.Encloses (AllFieldZeroLeafRates.fourRate (shape 0 2 6)) := by + exact contains_sound (Ball.add_sound Z0_2_6Entropy_sound Z0_2_6Labels_sound) (by decide +kernel) +def Z0_2_6H0Value (a : PairSlot) : ℝ := (halfLaw (shape 0 2 6) 0 a : ℝ) +def Z0_2_6H0E_0_0Log : Ball := .exact 0 +lemma Z0_2_6H0E_0_0Log_sound : Z0_2_6H0E_0_0Log.Encloses (Real.log (Z0_2_6H0Value ((0,0) : PairSlot))) := by + exact log_exact_one_ball ((Z0_2_6Half_sound 0) ((0,0) : PairSlot)) +def Z0_2_6H0E_0_0 : Ball := ⟨0, 0⟩ +lemma Z0_2_6H0E_0_0_sound : Z0_2_6H0E_0_0.Encloses (Foundation.entropyTerm (Z0_2_6H0Value ((0,0) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z0_2_6Half_sound 0) ((0,0) : PairSlot)) Z0_2_6H0E_0_0Log_sound) (by decide +kernel) +def Z0_2_6H0Terms (a : PairSlot) : Ball := + match a.1.val, a.2.val with + | 0, 0 => ⟨0, 0⟩ + | _, _ => (.exact 0) +lemma Z0_2_6H0Terms_sound (a : PairSlot) : + (Z0_2_6H0Terms a).Encloses (Foundation.entropyTerm (Z0_2_6H0Value a)) := by + rcases a with ⟨i,j⟩ + revert j i + apply forall_fin6 + · exact forall_fin6 Z0_2_6H0E_0_0_sound (entropyTerm_zero_ball ((Z0_2_6Half_sound 0) ((0,1) : PairSlot))) (entropyTerm_zero_ball ((Z0_2_6Half_sound 0) ((0,2) : PairSlot))) (entropyTerm_zero_ball ((Z0_2_6Half_sound 0) ((0,3) : PairSlot))) (entropyTerm_zero_ball ((Z0_2_6Half_sound 0) ((0,4) : PairSlot))) (entropyTerm_zero_ball ((Z0_2_6Half_sound 0) ((0,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z0_2_6Half_sound 0) ((1,0) : PairSlot))) (entropyTerm_zero_ball ((Z0_2_6Half_sound 0) ((1,1) : PairSlot))) (entropyTerm_zero_ball ((Z0_2_6Half_sound 0) ((1,2) : PairSlot))) (entropyTerm_zero_ball ((Z0_2_6Half_sound 0) ((1,3) : PairSlot))) (entropyTerm_zero_ball ((Z0_2_6Half_sound 0) ((1,4) : PairSlot))) (entropyTerm_zero_ball ((Z0_2_6Half_sound 0) ((1,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z0_2_6Half_sound 0) ((2,0) : PairSlot))) (entropyTerm_zero_ball ((Z0_2_6Half_sound 0) ((2,1) : PairSlot))) (entropyTerm_zero_ball ((Z0_2_6Half_sound 0) ((2,2) : PairSlot))) (entropyTerm_zero_ball ((Z0_2_6Half_sound 0) ((2,3) : PairSlot))) (entropyTerm_zero_ball ((Z0_2_6Half_sound 0) ((2,4) : PairSlot))) (entropyTerm_zero_ball ((Z0_2_6Half_sound 0) ((2,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z0_2_6Half_sound 0) ((3,0) : PairSlot))) (entropyTerm_zero_ball ((Z0_2_6Half_sound 0) ((3,1) : PairSlot))) (entropyTerm_zero_ball ((Z0_2_6Half_sound 0) ((3,2) : PairSlot))) (entropyTerm_zero_ball ((Z0_2_6Half_sound 0) ((3,3) : PairSlot))) (entropyTerm_zero_ball ((Z0_2_6Half_sound 0) ((3,4) : PairSlot))) (entropyTerm_zero_ball ((Z0_2_6Half_sound 0) ((3,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z0_2_6Half_sound 0) ((4,0) : PairSlot))) (entropyTerm_zero_ball ((Z0_2_6Half_sound 0) ((4,1) : PairSlot))) (entropyTerm_zero_ball ((Z0_2_6Half_sound 0) ((4,2) : PairSlot))) (entropyTerm_zero_ball ((Z0_2_6Half_sound 0) ((4,3) : PairSlot))) (entropyTerm_zero_ball ((Z0_2_6Half_sound 0) ((4,4) : PairSlot))) (entropyTerm_zero_ball ((Z0_2_6Half_sound 0) ((4,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z0_2_6Half_sound 0) ((5,0) : PairSlot))) (entropyTerm_zero_ball ((Z0_2_6Half_sound 0) ((5,1) : PairSlot))) (entropyTerm_zero_ball ((Z0_2_6Half_sound 0) ((5,2) : PairSlot))) (entropyTerm_zero_ball ((Z0_2_6Half_sound 0) ((5,3) : PairSlot))) (entropyTerm_zero_ball ((Z0_2_6Half_sound 0) ((5,4) : PairSlot))) (entropyTerm_zero_ball ((Z0_2_6Half_sound 0) ((5,5) : PairSlot))) +def Z0_2_6H0Entropy : Ball := ⟨0, 0⟩ +lemma Z0_2_6H0Entropy_sound : Z0_2_6H0Entropy.Encloses (Foundation.finiteEntropy Z0_2_6H0Value) := by + exact contains_sound (entropyPair_enclosed Z0_2_6H0Value Z0_2_6H0Terms Z0_2_6H0Terms_sound) (by decide +kernel) +def Z0_2_6H0Mass : Ball := ⟨1, 0⟩ +lemma Z0_2_6H0Mass_sound : Z0_2_6H0Mass.Encloses (∑ a, Z0_2_6H0Value a) := by + exact contains_sound (pairSumBall_sound (Z0_2_6Half 0) Z0_2_6H0Value (Z0_2_6Half_sound 0)) (by decide +kernel) +def Z0_2_6H0MassTermLog : Ball := .exact 0 +lemma Z0_2_6H0MassTermLog_sound : Z0_2_6H0MassTermLog.Encloses (Real.log ((∑ a, Z0_2_6H0Value a))) := by + exact log_exact_one_ball (Z0_2_6H0Mass_sound) +def Z0_2_6H0MassTerm : Ball := ⟨0, 0⟩ +lemma Z0_2_6H0MassTerm_sound : Z0_2_6H0MassTerm.Encloses (Foundation.entropyTerm ((∑ a, Z0_2_6H0Value a))) := by + exact contains_sound (entropyTerm_ball (Z0_2_6H0Mass_sound) Z0_2_6H0MassTermLog_sound) (by decide +kernel) +def Z0_2_6H0H : Ball := ⟨0, 0⟩ +lemma Z0_2_6H0H_sound : Z0_2_6H0H.Encloses (homogeneousEntropy Z0_2_6H0Value) := by + exact contains_sound (homogeneous_enclosed Z0_2_6H0Value Z0_2_6H0MassTerm_sound Z0_2_6H0Entropy_sound) (by decide +kernel) +def Z0_2_6H1Value (a : PairSlot) : ℝ := (halfLaw (shape 0 2 6) 1 a : ℝ) +def Z0_2_6H1E_2_0LogWitness : LogWitness := ⟨-3, 9657537875187848339599195720457, 6250000000000000000000000000000⟩ +def Z0_2_6H1E_2_0Log : Ball := ⟨(-32885685360713365998269732360853 / 20000000000000000000000000000000), (42351647467 / 50000000000000000000000000000000)⟩ +lemma Z0_2_6H1E_2_0Log_sound : Z0_2_6H1E_2_0Log.Encloses (Real.log (Z0_2_6H1Value ((2,0) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound ((Z0_2_6Half_sound 1) ((2,0) : PairSlot)) (w := Z0_2_6H1E_2_0LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z0_2_6H1E_2_0 : Ball := ⟨(1984967199516249315866366927071 / 6250000000000000000000000000000), (4090126411 / 25000000000000000000000000000000)⟩ +lemma Z0_2_6H1E_2_0_sound : Z0_2_6H1E_2_0.Encloses (Foundation.entropyTerm (Z0_2_6H1Value ((2,0) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z0_2_6Half_sound 1) ((2,0) : PairSlot)) Z0_2_6H1E_2_0Log_sound) (by decide +kernel) +def Z0_2_6H1E_3_0LogWitness : LogWitness := ⟨-6, 312906143484347380943417643667, 312500000000000000000000000000⟩ +def Z0_2_6H1E_3_0Log : Ball := ⟨(-83151685360713365998269720903561 / 20000000000000000000000000000000), (37057691509 / 25000000000000000000000000000000)⟩ +lemma Z0_2_6H1E_3_0Log_sound : Z0_2_6H1E_3_0Log.Encloses (Real.log (Z0_2_6H1Value ((3,0) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound ((Z0_2_6Half_sound 1) ((3,0) : PairSlot)) (w := Z0_2_6H1E_3_0LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z0_2_6H1E_3_0 : Ball := ⟨(101635442150174547299056890093 / 1562500000000000000000000000000), (463823177 / 20000000000000000000000000000000)⟩ +lemma Z0_2_6H1E_3_0_sound : Z0_2_6H1E_3_0.Encloses (Foundation.entropyTerm (Z0_2_6H1Value ((3,0) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z0_2_6Half_sound 1) ((3,0) : PairSlot)) Z0_2_6H1E_3_0Log_sound) (by decide +kernel) +def Z0_2_6H1E_1_1LogWitness : LogWitness := ⟨-1, 58240787064405132832169040681501, 50000000000000000000000000000000⟩ +def Z0_2_6H1E_1_1Log : Ball := ⟨(-54058426803566829991348699995259 / 100000000000000000000000000000000), (42351647427 / 100000000000000000000000000000000)⟩ +lemma Z0_2_6H1E_1_1Log_sound : Z0_2_6H1E_1_1Log.Encloses (Real.log (Z0_2_6H1Value ((1,1) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound ((Z0_2_6Half_sound 1) ((1,1) : PairSlot)) (w := Z0_2_6H1E_1_1LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z0_2_6H1E_1_1 : Ball := ⟨(6296810649006533489546320818881 / 20000000000000000000000000000000), (1541620801 / 6250000000000000000000000000000)⟩ +lemma Z0_2_6H1E_1_1_sound : Z0_2_6H1E_1_1.Encloses (Foundation.entropyTerm (Z0_2_6H1Value ((1,1) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z0_2_6Half_sound 1) ((1,1) : PairSlot)) Z0_2_6H1E_1_1Log_sound) (by decide +kernel) +def Z0_2_6H1E_0_2LogWitness : LogWitness := ⟨-3, 9657537875187848339599195720457, 6250000000000000000000000000000⟩ +def Z0_2_6H1E_0_2Log : Ball := ⟨(-32885685360713365998269732360853 / 20000000000000000000000000000000), (42351647467 / 50000000000000000000000000000000)⟩ +lemma Z0_2_6H1E_0_2Log_sound : Z0_2_6H1E_0_2Log.Encloses (Real.log (Z0_2_6H1Value ((0,2) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound ((Z0_2_6Half_sound 1) ((0,2) : PairSlot)) (w := Z0_2_6H1E_0_2LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z0_2_6H1E_0_2 : Ball := ⟨(1984967199516249315866366927071 / 6250000000000000000000000000000), (4090126411 / 25000000000000000000000000000000)⟩ +lemma Z0_2_6H1E_0_2_sound : Z0_2_6H1E_0_2.Encloses (Foundation.entropyTerm (Z0_2_6H1Value ((0,2) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z0_2_6Half_sound 1) ((0,2) : PairSlot)) Z0_2_6H1E_0_2Log_sound) (by decide +kernel) +def Z0_2_6H1E_0_3LogWitness : LogWitness := ⟨-6, 312906143484347380943417643667, 312500000000000000000000000000⟩ +def Z0_2_6H1E_0_3Log : Ball := ⟨(-83151685360713365998269720903561 / 20000000000000000000000000000000), (37057691509 / 25000000000000000000000000000000)⟩ +lemma Z0_2_6H1E_0_3Log_sound : Z0_2_6H1E_0_3Log.Encloses (Real.log (Z0_2_6H1Value ((0,3) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound ((Z0_2_6Half_sound 1) ((0,3) : PairSlot)) (w := Z0_2_6H1E_0_3LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z0_2_6H1E_0_3 : Ball := ⟨(101635442150174547299056890093 / 1562500000000000000000000000000), (463823177 / 20000000000000000000000000000000)⟩ +lemma Z0_2_6H1E_0_3_sound : Z0_2_6H1E_0_3.Encloses (Foundation.entropyTerm (Z0_2_6H1Value ((0,3) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z0_2_6Half_sound 1) ((0,3) : PairSlot)) Z0_2_6H1E_0_3Log_sound) (by decide +kernel) +def Z0_2_6H1Terms (a : PairSlot) : Ball := + match a.1.val, a.2.val with + | 2, 0 => ⟨(1984967199516249315866366927071 / 6250000000000000000000000000000), (4090126411 / 25000000000000000000000000000000)⟩ + | 3, 0 => ⟨(101635442150174547299056890093 / 1562500000000000000000000000000), (463823177 / 20000000000000000000000000000000)⟩ + | 1, 1 => ⟨(6296810649006533489546320818881 / 20000000000000000000000000000000), (1541620801 / 6250000000000000000000000000000)⟩ + | 0, 2 => ⟨(1984967199516249315866366927071 / 6250000000000000000000000000000), (4090126411 / 25000000000000000000000000000000)⟩ + | 0, 3 => ⟨(101635442150174547299056890093 / 1562500000000000000000000000000), (463823177 / 20000000000000000000000000000000)⟩ + | _, _ => (.exact 0) +lemma Z0_2_6H1Terms_sound (a : PairSlot) : + (Z0_2_6H1Terms a).Encloses (Foundation.entropyTerm (Z0_2_6H1Value a)) := by + rcases a with ⟨i,j⟩ + revert j i + apply forall_fin6 + · exact forall_fin6 (entropyTerm_zero_ball ((Z0_2_6Half_sound 1) ((0,0) : PairSlot))) (entropyTerm_zero_ball ((Z0_2_6Half_sound 1) ((0,1) : PairSlot))) Z0_2_6H1E_0_2_sound Z0_2_6H1E_0_3_sound (entropyTerm_zero_ball ((Z0_2_6Half_sound 1) ((0,4) : PairSlot))) (entropyTerm_zero_ball ((Z0_2_6Half_sound 1) ((0,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z0_2_6Half_sound 1) ((1,0) : PairSlot))) Z0_2_6H1E_1_1_sound (entropyTerm_zero_ball ((Z0_2_6Half_sound 1) ((1,2) : PairSlot))) (entropyTerm_zero_ball ((Z0_2_6Half_sound 1) ((1,3) : PairSlot))) (entropyTerm_zero_ball ((Z0_2_6Half_sound 1) ((1,4) : PairSlot))) (entropyTerm_zero_ball ((Z0_2_6Half_sound 1) ((1,5) : PairSlot))) + · exact forall_fin6 Z0_2_6H1E_2_0_sound (entropyTerm_zero_ball ((Z0_2_6Half_sound 1) ((2,1) : PairSlot))) (entropyTerm_zero_ball ((Z0_2_6Half_sound 1) ((2,2) : PairSlot))) (entropyTerm_zero_ball ((Z0_2_6Half_sound 1) ((2,3) : PairSlot))) (entropyTerm_zero_ball ((Z0_2_6Half_sound 1) ((2,4) : PairSlot))) (entropyTerm_zero_ball ((Z0_2_6Half_sound 1) ((2,5) : PairSlot))) + · exact forall_fin6 Z0_2_6H1E_3_0_sound (entropyTerm_zero_ball ((Z0_2_6Half_sound 1) ((3,1) : PairSlot))) (entropyTerm_zero_ball ((Z0_2_6Half_sound 1) ((3,2) : PairSlot))) (entropyTerm_zero_ball ((Z0_2_6Half_sound 1) ((3,3) : PairSlot))) (entropyTerm_zero_ball ((Z0_2_6Half_sound 1) ((3,4) : PairSlot))) (entropyTerm_zero_ball ((Z0_2_6Half_sound 1) ((3,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z0_2_6Half_sound 1) ((4,0) : PairSlot))) (entropyTerm_zero_ball ((Z0_2_6Half_sound 1) ((4,1) : PairSlot))) (entropyTerm_zero_ball ((Z0_2_6Half_sound 1) ((4,2) : PairSlot))) (entropyTerm_zero_ball ((Z0_2_6Half_sound 1) ((4,3) : PairSlot))) (entropyTerm_zero_ball ((Z0_2_6Half_sound 1) ((4,4) : PairSlot))) (entropyTerm_zero_ball ((Z0_2_6Half_sound 1) ((4,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z0_2_6Half_sound 1) ((5,0) : PairSlot))) (entropyTerm_zero_ball ((Z0_2_6Half_sound 1) ((5,1) : PairSlot))) (entropyTerm_zero_ball ((Z0_2_6Half_sound 1) ((5,2) : PairSlot))) (entropyTerm_zero_ball ((Z0_2_6Half_sound 1) ((5,3) : PairSlot))) (entropyTerm_zero_ball ((Z0_2_6Half_sound 1) ((5,4) : PairSlot))) (entropyTerm_zero_ball ((Z0_2_6Half_sound 1) ((5,5) : PairSlot))) +def Z0_2_6H1Entropy : Ball := ⟨(108012340224774987609734627692581 / 100000000000000000000000000000000), (31012587937 / 50000000000000000000000000000000)⟩ +lemma Z0_2_6H1Entropy_sound : Z0_2_6H1Entropy.Encloses (Foundation.finiteEntropy Z0_2_6H1Value) := by + exact contains_sound (entropyPair_enclosed Z0_2_6H1Value Z0_2_6H1Terms Z0_2_6H1Terms_sound) (by decide +kernel) +def Z0_2_6H1Mass : Ball := ⟨(99999999999999999999999999999999 / 100000000000000000000000000000000), (61 / 50000000000000000000000000000000)⟩ +lemma Z0_2_6H1Mass_sound : Z0_2_6H1Mass.Encloses (∑ a, Z0_2_6H1Value a) := by + exact contains_sound (pairSumBall_sound (Z0_2_6Half 1) Z0_2_6H1Value (Z0_2_6Half_sound 1)) (by decide +kernel) +def Z0_2_6H1MassTermLogWitness : LogWitness := ⟨-1, 99999999999999999999999999999999, 50000000000000000000000000000000⟩ +def Z0_2_6H1MassTermLog : Ball := ⟨0, (165436123 / 390625000000000000000000000000)⟩ +lemma Z0_2_6H1MassTermLog_sound : Z0_2_6H1MassTermLog.Encloses (Real.log ((∑ a, Z0_2_6H1Value a))) := by + exact checkLog_sound logTwoBall_sound (Z0_2_6H1Mass_sound) (w := Z0_2_6H1MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z0_2_6H1MassTerm : Ball := ⟨0, (42351647489 / 100000000000000000000000000000000)⟩ +lemma Z0_2_6H1MassTerm_sound : Z0_2_6H1MassTerm.Encloses (Foundation.entropyTerm ((∑ a, Z0_2_6H1Value a))) := by + exact contains_sound (entropyTerm_ball (Z0_2_6H1Mass_sound) Z0_2_6H1MassTermLog_sound) (by decide +kernel) +def Z0_2_6H1H : Ball := ⟨(108012340224774987609734627692581 / 100000000000000000000000000000000), (104376823363 / 100000000000000000000000000000000)⟩ +lemma Z0_2_6H1H_sound : Z0_2_6H1H.Encloses (homogeneousEntropy Z0_2_6H1Value) := by + exact contains_sound (homogeneous_enclosed Z0_2_6H1Value Z0_2_6H1MassTerm_sound Z0_2_6H1Entropy_sound) (by decide +kernel) +def Z0_2_6H2Value (a : PairSlot) : ℝ := (halfLaw (shape 0 2 6) 2 a : ℝ) +def Z0_2_6H2E_2_5LogWitness : LogWitness := ⟨-3, 9657537875187848339599195720457, 6250000000000000000000000000000⟩ +def Z0_2_6H2E_2_5Log : Ball := ⟨(-32885685360713365998269732360853 / 20000000000000000000000000000000), (42351647467 / 50000000000000000000000000000000)⟩ +lemma Z0_2_6H2E_2_5Log_sound : Z0_2_6H2E_2_5Log.Encloses (Real.log (Z0_2_6H2Value ((2,5) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound ((Z0_2_6Half_sound 2) ((2,5) : PairSlot)) (w := Z0_2_6H2E_2_5LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z0_2_6H2E_2_5 : Ball := ⟨(1984967199516249315866366927071 / 6250000000000000000000000000000), (4090126411 / 25000000000000000000000000000000)⟩ +lemma Z0_2_6H2E_2_5_sound : Z0_2_6H2E_2_5.Encloses (Foundation.entropyTerm (Z0_2_6H2Value ((2,5) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z0_2_6Half_sound 2) ((2,5) : PairSlot)) Z0_2_6H2E_2_5Log_sound) (by decide +kernel) +def Z0_2_6H2E_3_5LogWitness : LogWitness := ⟨-6, 312906143484347380943417643667, 312500000000000000000000000000⟩ +def Z0_2_6H2E_3_5Log : Ball := ⟨(-83151685360713365998269720903561 / 20000000000000000000000000000000), (37057691509 / 25000000000000000000000000000000)⟩ +lemma Z0_2_6H2E_3_5Log_sound : Z0_2_6H2E_3_5Log.Encloses (Real.log (Z0_2_6H2Value ((3,5) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound ((Z0_2_6Half_sound 2) ((3,5) : PairSlot)) (w := Z0_2_6H2E_3_5LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z0_2_6H2E_3_5 : Ball := ⟨(101635442150174547299056890093 / 1562500000000000000000000000000), (463823177 / 20000000000000000000000000000000)⟩ +lemma Z0_2_6H2E_3_5_sound : Z0_2_6H2E_3_5.Encloses (Foundation.entropyTerm (Z0_2_6H2Value ((3,5) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z0_2_6Half_sound 2) ((3,5) : PairSlot)) Z0_2_6H2E_3_5Log_sound) (by decide +kernel) +def Z0_2_6H2E_4_4LogWitness : LogWitness := ⟨-1, 58240787064405132832169040681501, 50000000000000000000000000000000⟩ +def Z0_2_6H2E_4_4Log : Ball := ⟨(-54058426803566829991348699995259 / 100000000000000000000000000000000), (42351647427 / 100000000000000000000000000000000)⟩ +lemma Z0_2_6H2E_4_4Log_sound : Z0_2_6H2E_4_4Log.Encloses (Real.log (Z0_2_6H2Value ((4,4) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound ((Z0_2_6Half_sound 2) ((4,4) : PairSlot)) (w := Z0_2_6H2E_4_4LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z0_2_6H2E_4_4 : Ball := ⟨(6296810649006533489546320818881 / 20000000000000000000000000000000), (1541620801 / 6250000000000000000000000000000)⟩ +lemma Z0_2_6H2E_4_4_sound : Z0_2_6H2E_4_4.Encloses (Foundation.entropyTerm (Z0_2_6H2Value ((4,4) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z0_2_6Half_sound 2) ((4,4) : PairSlot)) Z0_2_6H2E_4_4Log_sound) (by decide +kernel) +def Z0_2_6H2E_5_2LogWitness : LogWitness := ⟨-3, 9657537875187848339599195720457, 6250000000000000000000000000000⟩ +def Z0_2_6H2E_5_2Log : Ball := ⟨(-32885685360713365998269732360853 / 20000000000000000000000000000000), (42351647467 / 50000000000000000000000000000000)⟩ +lemma Z0_2_6H2E_5_2Log_sound : Z0_2_6H2E_5_2Log.Encloses (Real.log (Z0_2_6H2Value ((5,2) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound ((Z0_2_6Half_sound 2) ((5,2) : PairSlot)) (w := Z0_2_6H2E_5_2LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z0_2_6H2E_5_2 : Ball := ⟨(1984967199516249315866366927071 / 6250000000000000000000000000000), (4090126411 / 25000000000000000000000000000000)⟩ +lemma Z0_2_6H2E_5_2_sound : Z0_2_6H2E_5_2.Encloses (Foundation.entropyTerm (Z0_2_6H2Value ((5,2) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z0_2_6Half_sound 2) ((5,2) : PairSlot)) Z0_2_6H2E_5_2Log_sound) (by decide +kernel) +def Z0_2_6H2E_5_3LogWitness : LogWitness := ⟨-6, 312906143484347380943417643667, 312500000000000000000000000000⟩ +def Z0_2_6H2E_5_3Log : Ball := ⟨(-83151685360713365998269720903561 / 20000000000000000000000000000000), (37057691509 / 25000000000000000000000000000000)⟩ +lemma Z0_2_6H2E_5_3Log_sound : Z0_2_6H2E_5_3Log.Encloses (Real.log (Z0_2_6H2Value ((5,3) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound ((Z0_2_6Half_sound 2) ((5,3) : PairSlot)) (w := Z0_2_6H2E_5_3LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z0_2_6H2E_5_3 : Ball := ⟨(101635442150174547299056890093 / 1562500000000000000000000000000), (463823177 / 20000000000000000000000000000000)⟩ +lemma Z0_2_6H2E_5_3_sound : Z0_2_6H2E_5_3.Encloses (Foundation.entropyTerm (Z0_2_6H2Value ((5,3) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z0_2_6Half_sound 2) ((5,3) : PairSlot)) Z0_2_6H2E_5_3Log_sound) (by decide +kernel) +def Z0_2_6H2Terms (a : PairSlot) : Ball := + match a.1.val, a.2.val with + | 2, 5 => ⟨(1984967199516249315866366927071 / 6250000000000000000000000000000), (4090126411 / 25000000000000000000000000000000)⟩ + | 3, 5 => ⟨(101635442150174547299056890093 / 1562500000000000000000000000000), (463823177 / 20000000000000000000000000000000)⟩ + | 4, 4 => ⟨(6296810649006533489546320818881 / 20000000000000000000000000000000), (1541620801 / 6250000000000000000000000000000)⟩ + | 5, 2 => ⟨(1984967199516249315866366927071 / 6250000000000000000000000000000), (4090126411 / 25000000000000000000000000000000)⟩ + | 5, 3 => ⟨(101635442150174547299056890093 / 1562500000000000000000000000000), (463823177 / 20000000000000000000000000000000)⟩ + | _, _ => (.exact 0) +lemma Z0_2_6H2Terms_sound (a : PairSlot) : + (Z0_2_6H2Terms a).Encloses (Foundation.entropyTerm (Z0_2_6H2Value a)) := by + rcases a with ⟨i,j⟩ + revert j i + apply forall_fin6 + · exact forall_fin6 (entropyTerm_zero_ball ((Z0_2_6Half_sound 2) ((0,0) : PairSlot))) (entropyTerm_zero_ball ((Z0_2_6Half_sound 2) ((0,1) : PairSlot))) (entropyTerm_zero_ball ((Z0_2_6Half_sound 2) ((0,2) : PairSlot))) (entropyTerm_zero_ball ((Z0_2_6Half_sound 2) ((0,3) : PairSlot))) (entropyTerm_zero_ball ((Z0_2_6Half_sound 2) ((0,4) : PairSlot))) (entropyTerm_zero_ball ((Z0_2_6Half_sound 2) ((0,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z0_2_6Half_sound 2) ((1,0) : PairSlot))) (entropyTerm_zero_ball ((Z0_2_6Half_sound 2) ((1,1) : PairSlot))) (entropyTerm_zero_ball ((Z0_2_6Half_sound 2) ((1,2) : PairSlot))) (entropyTerm_zero_ball ((Z0_2_6Half_sound 2) ((1,3) : PairSlot))) (entropyTerm_zero_ball ((Z0_2_6Half_sound 2) ((1,4) : PairSlot))) (entropyTerm_zero_ball ((Z0_2_6Half_sound 2) ((1,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z0_2_6Half_sound 2) ((2,0) : PairSlot))) (entropyTerm_zero_ball ((Z0_2_6Half_sound 2) ((2,1) : PairSlot))) (entropyTerm_zero_ball ((Z0_2_6Half_sound 2) ((2,2) : PairSlot))) (entropyTerm_zero_ball ((Z0_2_6Half_sound 2) ((2,3) : PairSlot))) (entropyTerm_zero_ball ((Z0_2_6Half_sound 2) ((2,4) : PairSlot))) Z0_2_6H2E_2_5_sound + · exact forall_fin6 (entropyTerm_zero_ball ((Z0_2_6Half_sound 2) ((3,0) : PairSlot))) (entropyTerm_zero_ball ((Z0_2_6Half_sound 2) ((3,1) : PairSlot))) (entropyTerm_zero_ball ((Z0_2_6Half_sound 2) ((3,2) : PairSlot))) (entropyTerm_zero_ball ((Z0_2_6Half_sound 2) ((3,3) : PairSlot))) (entropyTerm_zero_ball ((Z0_2_6Half_sound 2) ((3,4) : PairSlot))) Z0_2_6H2E_3_5_sound + · exact forall_fin6 (entropyTerm_zero_ball ((Z0_2_6Half_sound 2) ((4,0) : PairSlot))) (entropyTerm_zero_ball ((Z0_2_6Half_sound 2) ((4,1) : PairSlot))) (entropyTerm_zero_ball ((Z0_2_6Half_sound 2) ((4,2) : PairSlot))) (entropyTerm_zero_ball ((Z0_2_6Half_sound 2) ((4,3) : PairSlot))) Z0_2_6H2E_4_4_sound (entropyTerm_zero_ball ((Z0_2_6Half_sound 2) ((4,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z0_2_6Half_sound 2) ((5,0) : PairSlot))) (entropyTerm_zero_ball ((Z0_2_6Half_sound 2) ((5,1) : PairSlot))) Z0_2_6H2E_5_2_sound Z0_2_6H2E_5_3_sound (entropyTerm_zero_ball ((Z0_2_6Half_sound 2) ((5,4) : PairSlot))) (entropyTerm_zero_ball ((Z0_2_6Half_sound 2) ((5,5) : PairSlot))) +def Z0_2_6H2Entropy : Ball := ⟨(108012340224774987609734627692581 / 100000000000000000000000000000000), (31012587937 / 50000000000000000000000000000000)⟩ +lemma Z0_2_6H2Entropy_sound : Z0_2_6H2Entropy.Encloses (Foundation.finiteEntropy Z0_2_6H2Value) := by + exact contains_sound (entropyPair_enclosed Z0_2_6H2Value Z0_2_6H2Terms Z0_2_6H2Terms_sound) (by decide +kernel) +def Z0_2_6H2Mass : Ball := ⟨(99999999999999999999999999999999 / 100000000000000000000000000000000), (61 / 50000000000000000000000000000000)⟩ +lemma Z0_2_6H2Mass_sound : Z0_2_6H2Mass.Encloses (∑ a, Z0_2_6H2Value a) := by + exact contains_sound (pairSumBall_sound (Z0_2_6Half 2) Z0_2_6H2Value (Z0_2_6Half_sound 2)) (by decide +kernel) +def Z0_2_6H2MassTermLogWitness : LogWitness := ⟨-1, 99999999999999999999999999999999, 50000000000000000000000000000000⟩ +def Z0_2_6H2MassTermLog : Ball := ⟨0, (165436123 / 390625000000000000000000000000)⟩ +lemma Z0_2_6H2MassTermLog_sound : Z0_2_6H2MassTermLog.Encloses (Real.log ((∑ a, Z0_2_6H2Value a))) := by + exact checkLog_sound logTwoBall_sound (Z0_2_6H2Mass_sound) (w := Z0_2_6H2MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z0_2_6H2MassTerm : Ball := ⟨0, (42351647489 / 100000000000000000000000000000000)⟩ +lemma Z0_2_6H2MassTerm_sound : Z0_2_6H2MassTerm.Encloses (Foundation.entropyTerm ((∑ a, Z0_2_6H2Value a))) := by + exact contains_sound (entropyTerm_ball (Z0_2_6H2Mass_sound) Z0_2_6H2MassTermLog_sound) (by decide +kernel) +def Z0_2_6H2H : Ball := ⟨(108012340224774987609734627692581 / 100000000000000000000000000000000), (104376823363 / 100000000000000000000000000000000)⟩ +lemma Z0_2_6H2H_sound : Z0_2_6H2H.Encloses (homogeneousEntropy Z0_2_6H2Value) := by + exact contains_sound (homogeneous_enclosed Z0_2_6H2Value Z0_2_6H2MassTerm_sound Z0_2_6H2Entropy_sound) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate +open scoped BigOperators +lemma A1_3_12_below : below (shape 1 3 12) = [ + (shape 0 0 8), + (shape 0 1 7), + (shape 0 2 6), + (shape 0 3 5), + (shape 1 0 7), + (shape 1 1 6), + (shape 1 2 5), + (shape 1 3 4)] := by decide +kernel +def A1_3_12Raw (s : Shape) : Ball := + match s 0, s 1, s 2 with + | 0, 0, 8 => ⟨(941315424133664770623714468493 / 50000000000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ + | 0, 1, 7 => ⟨(9520770923350851573363953693631 / 25000000000000000000000000000000), (53 / 100000000000000000000000000000000)⟩ + | 0, 2, 6 => ⟨1, 0⟩ + | 0, 3, 5 => ⟨(1309302249206923385346751762939 / 4000000000000000000000000000000), (43 / 50000000000000000000000000000000)⟩ + | 1, 0, 7 => ⟨(1309302249206923385346751762939 / 4000000000000000000000000000000), (43 / 50000000000000000000000000000000)⟩ + | 1, 1, 6 => ⟨1, 0⟩ + | 1, 2, 5 => ⟨(9520770923350851573363953693631 / 25000000000000000000000000000000), (53 / 100000000000000000000000000000000)⟩ + | 1, 3, 4 => ⟨(941315424133664770623714468493 / 50000000000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ + | _, _, _ => (.exact 0) +lemma A1_3_12Raw_0_0_8 : (A1_3_12Raw (shape 0 0 8)).Encloses (splitWeight positiveInitial tableP (shape 1 3 12) (shape 0 0 8) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 1 3 12) (shape 0 0 8) + (0) (-1514) (-38211) w195 w191 w47 + (by decide +kernel) w195_sound w191_sound w47_sound) (by decide +kernel) +lemma A1_3_12Raw_0_1_7 : (A1_3_12Raw (shape 0 1 7)).Encloses (splitWeight positiveInitial tableP (shape 1 3 12) (shape 0 1 7) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 1 3 12) (shape 0 1 7) + (0) (0) (-9654) w195 w195 w134 + (by decide +kernel) w195_sound w195_sound w134_sound) (by decide +kernel) +lemma A1_3_12Raw_0_2_6 : (A1_3_12Raw (shape 0 2 6)).Encloses (splitWeight positiveInitial tableP (shape 1 3 12) (shape 0 2 6) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 1 3 12) (shape 0 2 6) + (0) (0) (0) w195 w195 w195 + (by decide +kernel) w195_sound w195_sound w195_sound) (by decide +kernel) +lemma A1_3_12Raw_0_3_5 : (A1_3_12Raw (shape 0 3 5)).Encloses (splitWeight positiveInitial tableP (shape 1 3 12) (shape 0 3 5) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 1 3 12) (shape 0 3 5) + (0) (-1514) (-9654) w195 w191 w134 + (by decide +kernel) w195_sound w191_sound w134_sound) (by decide +kernel) +lemma A1_3_12Raw_1_0_7 : (A1_3_12Raw (shape 1 0 7)).Encloses (splitWeight positiveInitial tableP (shape 1 3 12) (shape 1 0 7) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 1 3 12) (shape 1 0 7) + (0) (-1514) (-9654) w195 w191 w134 + (by decide +kernel) w195_sound w191_sound w134_sound) (by decide +kernel) +lemma A1_3_12Raw_1_1_6 : (A1_3_12Raw (shape 1 1 6)).Encloses (splitWeight positiveInitial tableP (shape 1 3 12) (shape 1 1 6) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 1 3 12) (shape 1 1 6) + (0) (0) (0) w195 w195 w195 + (by decide +kernel) w195_sound w195_sound w195_sound) (by decide +kernel) +lemma A1_3_12Raw_1_2_5 : (A1_3_12Raw (shape 1 2 5)).Encloses (splitWeight positiveInitial tableP (shape 1 3 12) (shape 1 2 5) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 1 3 12) (shape 1 2 5) + (0) (0) (-9654) w195 w195 w134 + (by decide +kernel) w195_sound w195_sound w134_sound) (by decide +kernel) +lemma A1_3_12Raw_1_3_4 : (A1_3_12Raw (shape 1 3 4)).Encloses (splitWeight positiveInitial tableP (shape 1 3 12) (shape 1 3 4) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 1 3 12) (shape 1 3 4) + (0) (-1514) (-38211) w195 w191 w47 + (by decide +kernel) w195_sound w191_sound w47_sound) (by decide +kernel) +lemma A1_3_12Raw_sound (u : Shape) (hu : u ∈ below (shape 1 3 12)) : + (A1_3_12Raw u).Encloses (splitWeight positiveInitial tableP (shape 1 3 12) u : ℝ) := by + rw [A1_3_12_below] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl + · exact A1_3_12Raw_0_0_8 + · exact A1_3_12Raw_0_1_7 + · exact A1_3_12Raw_0_2_6 + · exact A1_3_12Raw_0_3_5 + · exact A1_3_12Raw_1_0_7 + · exact A1_3_12Raw_1_1_6 + · exact A1_3_12Raw_1_2_5 + · exact A1_3_12Raw_1_3_4 +def A1_3_12Den : Ball := ⟨(34539654154368764093674407556997 / 10000000000000000000000000000000), (29 / 10000000000000000000000000000000)⟩ +lemma A1_3_12Den_sound : A1_3_12Den.Encloses (((below (shape 1 3 12)).map (splitWeight positiveInitial tableP (shape 1 3 12))).sum : ℝ) := by + exact contains_sound (list_cast_enclosed (below (shape 1 3 12)) A1_3_12Raw (splitWeight positiveInitial tableP (shape 1 3 12)) A1_3_12Raw_sound) (by decide +kernel) +lemma A1_3_12Den_positive : 0 < A1_3_12Den.lower := by decide +kernel +def A1_3_12Table (s : Shape) : Ball := + match s 0, s 1, s 2 with + | 0, 0, 8 => ⟨(272531803568913863847155720223 / 50000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ + | 0, 1, 7 => ⟨(1102590185854146714999994489443 / 10000000000000000000000000000000), (1 / 4000000000000000000000000000000)⟩ + | 0, 2, 6 => ⟨(5790445935160092149101894313999 / 20000000000000000000000000000000), (1 / 4000000000000000000000000000000)⟩ + | 0, 3, 5 => ⟨(9476804858520244376796272095129 / 100000000000000000000000000000000), (17 / 50000000000000000000000000000000)⟩ + | 1, 0, 7 => ⟨(9476804858520244376796272095129 / 100000000000000000000000000000000), (17 / 50000000000000000000000000000000)⟩ + | 1, 1, 6 => ⟨(5790445935160092149101894313999 / 20000000000000000000000000000000), (1 / 4000000000000000000000000000000)⟩ + | 1, 2, 5 => ⟨(1102590185854146714999994489443 / 10000000000000000000000000000000), (1 / 4000000000000000000000000000000)⟩ + | 1, 3, 4 => ⟨(272531803568913863847155720223 / 50000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ + | _, _, _ => (.exact 0) +def A1_3_12Law (u : Shape) : Ball := if u ∈ below (shape 1 3 12) then A1_3_12Table u else .exact 0 +lemma A1_3_12Law_check_0_0_8 : contains (.mul (A1_3_12Raw (shape 0 0 8)) (.inv A1_3_12Den)) (A1_3_12Table (shape 0 0 8)) = true := by decide +kernel +lemma A1_3_12Law_check_0_1_7 : contains (.mul (A1_3_12Raw (shape 0 1 7)) (.inv A1_3_12Den)) (A1_3_12Table (shape 0 1 7)) = true := by decide +kernel +lemma A1_3_12Law_check_0_2_6 : contains (.mul (A1_3_12Raw (shape 0 2 6)) (.inv A1_3_12Den)) (A1_3_12Table (shape 0 2 6)) = true := by decide +kernel +lemma A1_3_12Law_check_0_3_5 : contains (.mul (A1_3_12Raw (shape 0 3 5)) (.inv A1_3_12Den)) (A1_3_12Table (shape 0 3 5)) = true := by decide +kernel +lemma A1_3_12Law_check_1_0_7 : contains (.mul (A1_3_12Raw (shape 1 0 7)) (.inv A1_3_12Den)) (A1_3_12Table (shape 1 0 7)) = true := by decide +kernel +lemma A1_3_12Law_check_1_1_6 : contains (.mul (A1_3_12Raw (shape 1 1 6)) (.inv A1_3_12Den)) (A1_3_12Table (shape 1 1 6)) = true := by decide +kernel +lemma A1_3_12Law_check_1_2_5 : contains (.mul (A1_3_12Raw (shape 1 2 5)) (.inv A1_3_12Den)) (A1_3_12Table (shape 1 2 5)) = true := by decide +kernel +lemma A1_3_12Law_check_1_3_4 : contains (.mul (A1_3_12Raw (shape 1 3 4)) (.inv A1_3_12Den)) (A1_3_12Table (shape 1 3 4)) = true := by decide +kernel +lemma A1_3_12Law_check (u : Shape) (hu : u ∈ below (shape 1 3 12)) : + contains (.mul (A1_3_12Raw u) (.inv A1_3_12Den)) (A1_3_12Table u) = true := by + rw [A1_3_12_below] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl + · exact A1_3_12Law_check_0_0_8 + · exact A1_3_12Law_check_0_1_7 + · exact A1_3_12Law_check_0_2_6 + · exact A1_3_12Law_check_0_3_5 + · exact A1_3_12Law_check_1_0_7 + · exact A1_3_12Law_check_1_1_6 + · exact A1_3_12Law_check_1_2_5 + · exact A1_3_12Law_check_1_3_4 +lemma A1_3_12Law_sound (u : Shape) : + (A1_3_12Law u).Encloses (stageALaw (shape 1 3 12) u : ℝ) := by + by_cases hu : u ∈ below (shape 1 3 12) + · have h := contains_sound (Ball.mul_sound (A1_3_12Raw_sound u hu) + (Ball.inv_sound A1_3_12Den_sound A1_3_12Den_positive)) (A1_3_12Law_check u hu) + simpa only [A1_3_12Law, hu, ite_true, stageALaw, splitLaw, + Rat.cast_div, Rat.cast_mul, Rat.cast_inv, div_eq_mul_inv] using h + · simp only [A1_3_12Law, hu, ite_false, stageALaw, splitLaw, Rat.cast_zero] + simpa only [Rat.cast_zero] using Ball.exact_sound 0 + +end MatrixMultiplication.NativeNumerics + +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/Certificates/SplitA1_4_11.lean b/lean/OAI/LinearAlgebra/MatrixFields/Certificates/SplitA1_4_11.lean new file mode 100644 index 0000000000000000000000000000000000000000..b3ea09be38b42ff13eaf93639f3bc1e53a760e30 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/Certificates/SplitA1_4_11.lean @@ -0,0 +1,155 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Certificates.SplitA1_3_12 + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate +open scoped BigOperators +lemma A1_4_11_below : below (shape 1 4 11) = [ + (shape 0 0 8), + (shape 0 1 7), + (shape 0 2 6), + (shape 0 3 5), + (shape 0 4 4), + (shape 1 0 7), + (shape 1 1 6), + (shape 1 2 5), + (shape 1 3 4), + (shape 1 4 3)] := by decide +kernel +def A1_4_11Raw (s : Shape) : Ball := + match s 0, s 1, s 2 with + | 0, 0, 8 => ⟨(188090920380700586676163797639 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 0, 1, 7 => ⟨(7347227310806514247293732489647 / 50000000000000000000000000000000), (19 / 50000000000000000000000000000000)⟩ + | 0, 2, 6 => ⟨1, 0⟩ + | 0, 3, 5 => ⟨(1185052529893235166451447015261 / 1562500000000000000000000000000), (1 / 1000000000000000000000000000000)⟩ + | 0, 4, 4 => ⟨(9124564624877481324080557406303 / 100000000000000000000000000000000), (3 / 12500000000000000000000000000000)⟩ + | 1, 0, 7 => ⟨(9124564624877481324080557406303 / 100000000000000000000000000000000), (3 / 12500000000000000000000000000000)⟩ + | 1, 1, 6 => ⟨(1185052529893235166451447015261 / 1562500000000000000000000000000), (1 / 1000000000000000000000000000000)⟩ + | 1, 2, 5 => ⟨1, 0⟩ + | 1, 3, 4 => ⟨(7347227310806514247293732489647 / 50000000000000000000000000000000), (19 / 50000000000000000000000000000000)⟩ + | 1, 4, 3 => ⟨(188090920380700586676163797639 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | _, _, _ => (.exact 0) +lemma A1_4_11Raw_0_0_8 : (A1_4_11Raw (shape 0 0 8)).Encloses (splitWeight positiveInitial tableP (shape 1 4 11) (shape 0 0 8) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 1 4 11) (shape 0 0 8) + (0) (-7530) (-55230) w195 w142 w28 + (by decide +kernel) w195_sound w142_sound w28_sound) (by decide +kernel) +lemma A1_4_11Raw_0_1_7 : (A1_4_11Raw (shape 0 1 7)).Encloses (splitWeight positiveInitial tableP (shape 1 4 11) (shape 0 1 7) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 1 4 11) (shape 0 1 7) + (0) (-2765) (-16412) w195 w186 w104 + (by decide +kernel) w195_sound w186_sound w104_sound) (by decide +kernel) +lemma A1_4_11Raw_0_2_6 : (A1_4_11Raw (shape 0 2 6)).Encloses (splitWeight positiveInitial tableP (shape 1 4 11) (shape 0 2 6) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 1 4 11) (shape 0 2 6) + (0) (0) (0) w195 w195 w195 + (by decide +kernel) w195_sound w195_sound w195_sound) (by decide +kernel) +lemma A1_4_11Raw_0_3_5 : (A1_4_11Raw (shape 0 3 5)).Encloses (splitWeight positiveInitial tableP (shape 1 4 11) (shape 0 3 5) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 1 4 11) (shape 0 3 5) + (0) (-2765) (0) w195 w186 w195 + (by decide +kernel) w195_sound w186_sound w195_sound) (by decide +kernel) +lemma A1_4_11Raw_0_4_4 : (A1_4_11Raw (shape 0 4 4)).Encloses (splitWeight positiveInitial tableP (shape 1 4 11) (shape 0 4 4) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 1 4 11) (shape 0 4 4) + (0) (-7530) (-16412) w195 w142 w104 + (by decide +kernel) w195_sound w142_sound w104_sound) (by decide +kernel) +lemma A1_4_11Raw_1_0_7 : (A1_4_11Raw (shape 1 0 7)).Encloses (splitWeight positiveInitial tableP (shape 1 4 11) (shape 1 0 7) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 1 4 11) (shape 1 0 7) + (0) (-7530) (-16412) w195 w142 w104 + (by decide +kernel) w195_sound w142_sound w104_sound) (by decide +kernel) +lemma A1_4_11Raw_1_1_6 : (A1_4_11Raw (shape 1 1 6)).Encloses (splitWeight positiveInitial tableP (shape 1 4 11) (shape 1 1 6) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 1 4 11) (shape 1 1 6) + (0) (-2765) (0) w195 w186 w195 + (by decide +kernel) w195_sound w186_sound w195_sound) (by decide +kernel) +lemma A1_4_11Raw_1_2_5 : (A1_4_11Raw (shape 1 2 5)).Encloses (splitWeight positiveInitial tableP (shape 1 4 11) (shape 1 2 5) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 1 4 11) (shape 1 2 5) + (0) (0) (0) w195 w195 w195 + (by decide +kernel) w195_sound w195_sound w195_sound) (by decide +kernel) +lemma A1_4_11Raw_1_3_4 : (A1_4_11Raw (shape 1 3 4)).Encloses (splitWeight positiveInitial tableP (shape 1 4 11) (shape 1 3 4) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 1 4 11) (shape 1 3 4) + (0) (-2765) (-16412) w195 w186 w104 + (by decide +kernel) w195_sound w186_sound w104_sound) (by decide +kernel) +lemma A1_4_11Raw_1_4_3 : (A1_4_11Raw (shape 1 4 3)).Encloses (splitWeight positiveInitial tableP (shape 1 4 11) (shape 1 4 3) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 1 4 11) (shape 1 4 3) + (0) (-7530) (-55230) w195 w142 w28 + (by decide +kernel) w195_sound w142_sound w28_sound) (by decide +kernel) +lemma A1_4_11Raw_sound (u : Shape) (hu : u ∈ below (shape 1 4 11)) : + (A1_4_11Raw u).Encloses (splitWeight positiveInitial tableP (shape 1 4 11) u : ℝ) := by + rw [A1_4_11_below] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl + · exact A1_4_11Raw_0_0_8 + · exact A1_4_11Raw_0_1_7 + · exact A1_4_11Raw_0_2_6 + · exact A1_4_11Raw_0_3_5 + · exact A1_4_11Raw_0_4_4 + · exact A1_4_11Raw_1_0_7 + · exact A1_4_11Raw_1_1_6 + · exact A1_4_11Raw_1_2_5 + · exact A1_4_11Raw_1_3_4 + · exact A1_4_11Raw_1_4_3 +def A1_4_11Den : Ball := ⟨(9992523604001913052911839757997 / 2500000000000000000000000000000), (163 / 50000000000000000000000000000000)⟩ +lemma A1_4_11Den_sound : A1_4_11Den.Encloses (((below (shape 1 4 11)).map (splitWeight positiveInitial tableP (shape 1 4 11))).sum : ℝ) := by + exact contains_sound (list_cast_enclosed (below (shape 1 4 11)) A1_4_11Raw (splitWeight positiveInitial tableP (shape 1 4 11)) A1_4_11Raw_sound) (by decide +kernel) +lemma A1_4_11Den_positive : 0 < A1_4_11Den.lower := by decide +kernel +def A1_4_11Table (s : Shape) : Ball := + match s 0, s 1, s 2 with + | 0, 0, 8 => ⟨(47057912454010095367492939241 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 0, 1, 7 => ⟨(4595452811755191797013350101 / 125000000000000000000000000000), (13 / 100000000000000000000000000000000)⟩ + | 0, 2, 6 => ⟨(5003740994914984598991554798533 / 20000000000000000000000000000000), (21 / 100000000000000000000000000000000)⟩ + | 0, 3, 5 => ⟨(3795005391970877478082437264067 / 20000000000000000000000000000000), (41 / 100000000000000000000000000000000)⟩ + | 0, 4, 4 => ⟨(2282847903712526081651866666959 / 100000000000000000000000000000000), (9 / 100000000000000000000000000000000)⟩ + | 1, 0, 7 => ⟨(2282847903712526081651866666959 / 100000000000000000000000000000000), (9 / 100000000000000000000000000000000)⟩ + | 1, 1, 6 => ⟨(3795005391970877478082437264067 / 20000000000000000000000000000000), (41 / 100000000000000000000000000000000)⟩ + | 1, 2, 5 => ⟨(5003740994914984598991554798533 / 20000000000000000000000000000000), (21 / 100000000000000000000000000000000)⟩ + | 1, 3, 4 => ⟨(4595452811755191797013350101 / 125000000000000000000000000000), (13 / 100000000000000000000000000000000)⟩ + | 1, 4, 3 => ⟨(47057912454010095367492939241 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | _, _, _ => (.exact 0) +def A1_4_11Law (u : Shape) : Ball := if u ∈ below (shape 1 4 11) then A1_4_11Table u else .exact 0 +lemma A1_4_11Law_check_0_0_8 : contains (.mul (A1_4_11Raw (shape 0 0 8)) (.inv A1_4_11Den)) (A1_4_11Table (shape 0 0 8)) = true := by decide +kernel +lemma A1_4_11Law_check_0_1_7 : contains (.mul (A1_4_11Raw (shape 0 1 7)) (.inv A1_4_11Den)) (A1_4_11Table (shape 0 1 7)) = true := by decide +kernel +lemma A1_4_11Law_check_0_2_6 : contains (.mul (A1_4_11Raw (shape 0 2 6)) (.inv A1_4_11Den)) (A1_4_11Table (shape 0 2 6)) = true := by decide +kernel +lemma A1_4_11Law_check_0_3_5 : contains (.mul (A1_4_11Raw (shape 0 3 5)) (.inv A1_4_11Den)) (A1_4_11Table (shape 0 3 5)) = true := by decide +kernel +lemma A1_4_11Law_check_0_4_4 : contains (.mul (A1_4_11Raw (shape 0 4 4)) (.inv A1_4_11Den)) (A1_4_11Table (shape 0 4 4)) = true := by decide +kernel +lemma A1_4_11Law_check_1_0_7 : contains (.mul (A1_4_11Raw (shape 1 0 7)) (.inv A1_4_11Den)) (A1_4_11Table (shape 1 0 7)) = true := by decide +kernel +lemma A1_4_11Law_check_1_1_6 : contains (.mul (A1_4_11Raw (shape 1 1 6)) (.inv A1_4_11Den)) (A1_4_11Table (shape 1 1 6)) = true := by decide +kernel +lemma A1_4_11Law_check_1_2_5 : contains (.mul (A1_4_11Raw (shape 1 2 5)) (.inv A1_4_11Den)) (A1_4_11Table (shape 1 2 5)) = true := by decide +kernel +lemma A1_4_11Law_check_1_3_4 : contains (.mul (A1_4_11Raw (shape 1 3 4)) (.inv A1_4_11Den)) (A1_4_11Table (shape 1 3 4)) = true := by decide +kernel +lemma A1_4_11Law_check_1_4_3 : contains (.mul (A1_4_11Raw (shape 1 4 3)) (.inv A1_4_11Den)) (A1_4_11Table (shape 1 4 3)) = true := by decide +kernel +lemma A1_4_11Law_check (u : Shape) (hu : u ∈ below (shape 1 4 11)) : + contains (.mul (A1_4_11Raw u) (.inv A1_4_11Den)) (A1_4_11Table u) = true := by + rw [A1_4_11_below] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl + · exact A1_4_11Law_check_0_0_8 + · exact A1_4_11Law_check_0_1_7 + · exact A1_4_11Law_check_0_2_6 + · exact A1_4_11Law_check_0_3_5 + · exact A1_4_11Law_check_0_4_4 + · exact A1_4_11Law_check_1_0_7 + · exact A1_4_11Law_check_1_1_6 + · exact A1_4_11Law_check_1_2_5 + · exact A1_4_11Law_check_1_3_4 + · exact A1_4_11Law_check_1_4_3 +lemma A1_4_11Law_sound (u : Shape) : + (A1_4_11Law u).Encloses (stageALaw (shape 1 4 11) u : ℝ) := by + by_cases hu : u ∈ below (shape 1 4 11) + · have h := contains_sound (Ball.mul_sound (A1_4_11Raw_sound u hu) + (Ball.inv_sound A1_4_11Den_sound A1_4_11Den_positive)) (A1_4_11Law_check u hu) + simpa only [A1_4_11Law, hu, ite_true, stageALaw, splitLaw, + Rat.cast_div, Rat.cast_mul, Rat.cast_inv, div_eq_mul_inv] using h + · simp only [A1_4_11Law, hu, ite_false, stageALaw, splitLaw, Rat.cast_zero] + simpa only [Rat.cast_zero] using Ball.exact_sound 0 + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/Certificates/SplitA1_7_8.lean b/lean/OAI/LinearAlgebra/MatrixFields/Certificates/SplitA1_7_8.lean new file mode 100644 index 0000000000000000000000000000000000000000..9a32f1789f623f0cb38e6401bfd581fdfb808cbc --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/Certificates/SplitA1_7_8.lean @@ -0,0 +1,215 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Certificates.SplitB1_3_4 + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate +open scoped BigOperators +lemma A1_7_8_below : below (shape 1 7 8) = [ + (shape 0 0 8), + (shape 0 1 7), + (shape 0 2 6), + (shape 0 3 5), + (shape 0 4 4), + (shape 0 5 3), + (shape 0 6 2), + (shape 0 7 1), + (shape 1 0 7), + (shape 1 1 6), + (shape 1 2 5), + (shape 1 3 4), + (shape 1 4 3), + (shape 1 5 2), + (shape 1 6 1), + (shape 1 7 0)] := by decide +kernel +def A1_7_8Raw (s : Shape) : Ball := + match s 0, s 1, s 2 with + | 0, 0, 8 => ⟨(64668921862685299795581911 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 0, 1, 7 => ⟨(8061327816168650758772421803 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 0, 2, 6 => ⟨(53906227585276956042284318339 / 2500000000000000000000000000000), (7 / 100000000000000000000000000000000)⟩ + | 0, 3, 5 => ⟨(10604472274941479671393272450057 / 25000000000000000000000000000000), (3 / 6250000000000000000000000000000)⟩ + | 0, 4, 4 => ⟨1, 0⟩ + | 0, 5, 3 => ⟨(5174982216910474785081875841 / 32000000000000000000000000000), (21 / 50000000000000000000000000000000)⟩ + | 0, 6, 2 => ⟨(230783094467553527628691159093 / 50000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ + | 0, 7, 1 => ⟨(1820161921466848777911127321 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 1, 0, 7 => ⟨(1820161921466848777911127321 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 1, 1, 6 => ⟨(230783094467553527628691159093 / 50000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ + | 1, 2, 5 => ⟨(5174982216910474785081875841 / 32000000000000000000000000000), (21 / 50000000000000000000000000000000)⟩ + | 1, 3, 4 => ⟨1, 0⟩ + | 1, 4, 3 => ⟨(10604472274941479671393272450057 / 25000000000000000000000000000000), (3 / 6250000000000000000000000000000)⟩ + | 1, 5, 2 => ⟨(53906227585276956042284318339 / 2500000000000000000000000000000), (7 / 100000000000000000000000000000000)⟩ + | 1, 6, 1 => ⟨(8061327816168650758772421803 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 1, 7, 0 => ⟨(64668921862685299795581911 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | _, _, _ => (.exact 0) +lemma A1_7_8Raw_0_0_8 : (A1_7_8Raw (shape 0 0 8)).Encloses (splitWeight positiveInitial tableP (shape 1 7 8) (shape 0 0 8) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 1 7 8) (shape 0 0 8) + (0) (-46871) (-95643) w195 w38 w5 + (by decide +kernel) w195_sound w38_sound w5_sound) (by decide +kernel) +lemma A1_7_8Raw_0_1_7 : (A1_7_8Raw (shape 0 1 7)).Encloses (splitWeight positiveInitial tableP (shape 1 7 8) (shape 0 1 7) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 1 7 8) (shape 0 1 7) + (0) (-25058) (-62269) w195 w80 w19 + (by decide +kernel) w195_sound w80_sound w19_sound) (by decide +kernel) +lemma A1_7_8Raw_0_2_6 : (A1_7_8Raw (shape 0 2 6)).Encloses (splitWeight positiveInitial tableP (shape 1 7 8) (shape 0 2 6) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 1 7 8) (shape 0 2 6) + (0) (-9643) (-28725) w195 w135 w69 + (by decide +kernel) w195_sound w135_sound w69_sound) (by decide +kernel) +lemma A1_7_8Raw_0_3_5 : (A1_7_8Raw (shape 0 3 5)).Encloses (splitWeight positiveInitial tableP (shape 1 7 8) (shape 0 3 5) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 1 7 8) (shape 0 3 5) + (0) (0) (-8576) w195 w195 w138 + (by decide +kernel) w195_sound w195_sound w138_sound) (by decide +kernel) +lemma A1_7_8Raw_0_4_4 : (A1_7_8Raw (shape 0 4 4)).Encloses (splitWeight positiveInitial tableP (shape 1 7 8) (shape 0 4 4) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 1 7 8) (shape 0 4 4) + (0) (0) (0) w195 w195 w195 + (by decide +kernel) w195_sound w195_sound w195_sound) (by decide +kernel) +lemma A1_7_8Raw_0_5_3 : (A1_7_8Raw (shape 0 5 3)).Encloses (splitWeight positiveInitial tableP (shape 1 7 8) (shape 0 5 3) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 1 7 8) (shape 0 5 3) + (0) (-9643) (-8576) w195 w135 w138 + (by decide +kernel) w195_sound w135_sound w138_sound) (by decide +kernel) +lemma A1_7_8Raw_0_6_2 : (A1_7_8Raw (shape 0 6 2)).Encloses (splitWeight positiveInitial tableP (shape 1 7 8) (shape 0 6 2) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 1 7 8) (shape 0 6 2) + (0) (-25058) (-28725) w195 w80 w69 + (by decide +kernel) w195_sound w80_sound w69_sound) (by decide +kernel) +lemma A1_7_8Raw_0_7_1 : (A1_7_8Raw (shape 0 7 1)).Encloses (splitWeight positiveInitial tableP (shape 1 7 8) (shape 0 7 1) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 1 7 8) (shape 0 7 1) + (0) (-46871) (-62269) w195 w38 w19 + (by decide +kernel) w195_sound w38_sound w19_sound) (by decide +kernel) +lemma A1_7_8Raw_1_0_7 : (A1_7_8Raw (shape 1 0 7)).Encloses (splitWeight positiveInitial tableP (shape 1 7 8) (shape 1 0 7) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 1 7 8) (shape 1 0 7) + (0) (-46871) (-62269) w195 w38 w19 + (by decide +kernel) w195_sound w38_sound w19_sound) (by decide +kernel) +lemma A1_7_8Raw_1_1_6 : (A1_7_8Raw (shape 1 1 6)).Encloses (splitWeight positiveInitial tableP (shape 1 7 8) (shape 1 1 6) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 1 7 8) (shape 1 1 6) + (0) (-25058) (-28725) w195 w80 w69 + (by decide +kernel) w195_sound w80_sound w69_sound) (by decide +kernel) +lemma A1_7_8Raw_1_2_5 : (A1_7_8Raw (shape 1 2 5)).Encloses (splitWeight positiveInitial tableP (shape 1 7 8) (shape 1 2 5) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 1 7 8) (shape 1 2 5) + (0) (-9643) (-8576) w195 w135 w138 + (by decide +kernel) w195_sound w135_sound w138_sound) (by decide +kernel) +lemma A1_7_8Raw_1_3_4 : (A1_7_8Raw (shape 1 3 4)).Encloses (splitWeight positiveInitial tableP (shape 1 7 8) (shape 1 3 4) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 1 7 8) (shape 1 3 4) + (0) (0) (0) w195 w195 w195 + (by decide +kernel) w195_sound w195_sound w195_sound) (by decide +kernel) +lemma A1_7_8Raw_1_4_3 : (A1_7_8Raw (shape 1 4 3)).Encloses (splitWeight positiveInitial tableP (shape 1 7 8) (shape 1 4 3) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 1 7 8) (shape 1 4 3) + (0) (0) (-8576) w195 w195 w138 + (by decide +kernel) w195_sound w195_sound w138_sound) (by decide +kernel) +lemma A1_7_8Raw_1_5_2 : (A1_7_8Raw (shape 1 5 2)).Encloses (splitWeight positiveInitial tableP (shape 1 7 8) (shape 1 5 2) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 1 7 8) (shape 1 5 2) + (0) (-9643) (-28725) w195 w135 w69 + (by decide +kernel) w195_sound w135_sound w69_sound) (by decide +kernel) +lemma A1_7_8Raw_1_6_1 : (A1_7_8Raw (shape 1 6 1)).Encloses (splitWeight positiveInitial tableP (shape 1 7 8) (shape 1 6 1) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 1 7 8) (shape 1 6 1) + (0) (-25058) (-62269) w195 w80 w19 + (by decide +kernel) w195_sound w80_sound w19_sound) (by decide +kernel) +lemma A1_7_8Raw_1_7_0 : (A1_7_8Raw (shape 1 7 0)).Encloses (splitWeight positiveInitial tableP (shape 1 7 8) (shape 1 7 0) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 1 7 8) (shape 1 7 0) + (0) (-46871) (-95643) w195 w38 w5 + (by decide +kernel) w195_sound w38_sound w5_sound) (by decide +kernel) +lemma A1_7_8Raw_sound (u : Shape) (hu : u ∈ below (shape 1 7 8)) : + (A1_7_8Raw u).Encloses (splitWeight positiveInitial tableP (shape 1 7 8) u : ℝ) := by + rw [A1_7_8_below] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl + · exact A1_7_8Raw_0_0_8 + · exact A1_7_8Raw_0_1_7 + · exact A1_7_8Raw_0_2_6 + · exact A1_7_8Raw_0_3_5 + · exact A1_7_8Raw_0_4_4 + · exact A1_7_8Raw_0_5_3 + · exact A1_7_8Raw_0_6_2 + · exact A1_7_8Raw_0_7_1 + · exact A1_7_8Raw_1_0_7 + · exact A1_7_8Raw_1_1_6 + · exact A1_7_8Raw_1_2_5 + · exact A1_7_8Raw_1_3_4 + · exact A1_7_8Raw_1_4_3 + · exact A1_7_8Raw_1_5_2 + · exact A1_7_8Raw_1_6_1 + · exact A1_7_8Raw_1_7_0 +def A1_7_8Den : Ball := ⟨(161225531306433004521497958407937 / 50000000000000000000000000000000), (51 / 25000000000000000000000000000000)⟩ +lemma A1_7_8Den_sound : A1_7_8Den.Encloses (((below (shape 1 7 8)).map (splitWeight positiveInitial tableP (shape 1 7 8))).sum : ℝ) := by + exact contains_sound (list_cast_enclosed (below (shape 1 7 8)) A1_7_8Raw (splitWeight positiveInitial tableP (shape 1 7 8)) A1_7_8Raw_sound) (by decide +kernel) +lemma A1_7_8Den_positive : 0 < A1_7_8Den.lower := by decide +kernel +def A1_7_8Table (s : Shape) : Ball := + match s 0, s 1, s 2 with + | 0, 0, 8 => ⟨(20055422158842954722213457 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 0, 1, 7 => ⟨(500003178829468586018862723 / 10000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 0, 2, 6 => ⟨(167176461285217244558128668051 / 25000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ + | 0, 3, 5 => ⟨(13154829993750939206545618238241 / 100000000000000000000000000000000), (3 / 12500000000000000000000000000000)⟩ + | 0, 4, 4 => ⟨(49619932619696659353487069911 / 160000000000000000000000000000), (1 / 5000000000000000000000000000000)⟩ + | 0, 5, 3 => ⟨(626909836209048342179201955027 / 12500000000000000000000000000000), (17 / 100000000000000000000000000000000)⟩ + | 0, 6, 2 => ⟨(71571509982781843275618258667 / 50000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ + | 0, 7, 1 => ⟨(35279809335985405792837309 / 6250000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 1, 0, 7 => ⟨(35279809335985405792837309 / 6250000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 1, 1, 6 => ⟨(71571509982781843275618258667 / 50000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ + | 1, 2, 5 => ⟨(626909836209048342179201955027 / 12500000000000000000000000000000), (17 / 100000000000000000000000000000000)⟩ + | 1, 3, 4 => ⟨(49619932619696659353487069911 / 160000000000000000000000000000), (1 / 5000000000000000000000000000000)⟩ + | 1, 4, 3 => ⟨(13154829993750939206545618238241 / 100000000000000000000000000000000), (3 / 12500000000000000000000000000000)⟩ + | 1, 5, 2 => ⟨(167176461285217244558128668051 / 25000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ + | 1, 6, 1 => ⟨(500003178829468586018862723 / 10000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 1, 7, 0 => ⟨(20055422158842954722213457 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | _, _, _ => (.exact 0) +def A1_7_8Law (u : Shape) : Ball := if u ∈ below (shape 1 7 8) then A1_7_8Table u else .exact 0 +lemma A1_7_8Law_check_0_0_8 : contains (.mul (A1_7_8Raw (shape 0 0 8)) (.inv A1_7_8Den)) (A1_7_8Table (shape 0 0 8)) = true := by decide +kernel +lemma A1_7_8Law_check_0_1_7 : contains (.mul (A1_7_8Raw (shape 0 1 7)) (.inv A1_7_8Den)) (A1_7_8Table (shape 0 1 7)) = true := by decide +kernel +lemma A1_7_8Law_check_0_2_6 : contains (.mul (A1_7_8Raw (shape 0 2 6)) (.inv A1_7_8Den)) (A1_7_8Table (shape 0 2 6)) = true := by decide +kernel +lemma A1_7_8Law_check_0_3_5 : contains (.mul (A1_7_8Raw (shape 0 3 5)) (.inv A1_7_8Den)) (A1_7_8Table (shape 0 3 5)) = true := by decide +kernel +lemma A1_7_8Law_check_0_4_4 : contains (.mul (A1_7_8Raw (shape 0 4 4)) (.inv A1_7_8Den)) (A1_7_8Table (shape 0 4 4)) = true := by decide +kernel +lemma A1_7_8Law_check_0_5_3 : contains (.mul (A1_7_8Raw (shape 0 5 3)) (.inv A1_7_8Den)) (A1_7_8Table (shape 0 5 3)) = true := by decide +kernel +lemma A1_7_8Law_check_0_6_2 : contains (.mul (A1_7_8Raw (shape 0 6 2)) (.inv A1_7_8Den)) (A1_7_8Table (shape 0 6 2)) = true := by decide +kernel +lemma A1_7_8Law_check_0_7_1 : contains (.mul (A1_7_8Raw (shape 0 7 1)) (.inv A1_7_8Den)) (A1_7_8Table (shape 0 7 1)) = true := by decide +kernel +lemma A1_7_8Law_check_1_0_7 : contains (.mul (A1_7_8Raw (shape 1 0 7)) (.inv A1_7_8Den)) (A1_7_8Table (shape 1 0 7)) = true := by decide +kernel +lemma A1_7_8Law_check_1_1_6 : contains (.mul (A1_7_8Raw (shape 1 1 6)) (.inv A1_7_8Den)) (A1_7_8Table (shape 1 1 6)) = true := by decide +kernel +lemma A1_7_8Law_check_1_2_5 : contains (.mul (A1_7_8Raw (shape 1 2 5)) (.inv A1_7_8Den)) (A1_7_8Table (shape 1 2 5)) = true := by decide +kernel +lemma A1_7_8Law_check_1_3_4 : contains (.mul (A1_7_8Raw (shape 1 3 4)) (.inv A1_7_8Den)) (A1_7_8Table (shape 1 3 4)) = true := by decide +kernel +lemma A1_7_8Law_check_1_4_3 : contains (.mul (A1_7_8Raw (shape 1 4 3)) (.inv A1_7_8Den)) (A1_7_8Table (shape 1 4 3)) = true := by decide +kernel +lemma A1_7_8Law_check_1_5_2 : contains (.mul (A1_7_8Raw (shape 1 5 2)) (.inv A1_7_8Den)) (A1_7_8Table (shape 1 5 2)) = true := by decide +kernel +lemma A1_7_8Law_check_1_6_1 : contains (.mul (A1_7_8Raw (shape 1 6 1)) (.inv A1_7_8Den)) (A1_7_8Table (shape 1 6 1)) = true := by decide +kernel +lemma A1_7_8Law_check_1_7_0 : contains (.mul (A1_7_8Raw (shape 1 7 0)) (.inv A1_7_8Den)) (A1_7_8Table (shape 1 7 0)) = true := by decide +kernel +lemma A1_7_8Law_check (u : Shape) (hu : u ∈ below (shape 1 7 8)) : + contains (.mul (A1_7_8Raw u) (.inv A1_7_8Den)) (A1_7_8Table u) = true := by + rw [A1_7_8_below] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl + · exact A1_7_8Law_check_0_0_8 + · exact A1_7_8Law_check_0_1_7 + · exact A1_7_8Law_check_0_2_6 + · exact A1_7_8Law_check_0_3_5 + · exact A1_7_8Law_check_0_4_4 + · exact A1_7_8Law_check_0_5_3 + · exact A1_7_8Law_check_0_6_2 + · exact A1_7_8Law_check_0_7_1 + · exact A1_7_8Law_check_1_0_7 + · exact A1_7_8Law_check_1_1_6 + · exact A1_7_8Law_check_1_2_5 + · exact A1_7_8Law_check_1_3_4 + · exact A1_7_8Law_check_1_4_3 + · exact A1_7_8Law_check_1_5_2 + · exact A1_7_8Law_check_1_6_1 + · exact A1_7_8Law_check_1_7_0 +lemma A1_7_8Law_sound (u : Shape) : + (A1_7_8Law u).Encloses (stageALaw (shape 1 7 8) u : ℝ) := by + by_cases hu : u ∈ below (shape 1 7 8) + · have h := contains_sound (Ball.mul_sound (A1_7_8Raw_sound u hu) + (Ball.inv_sound A1_7_8Den_sound A1_7_8Den_positive)) (A1_7_8Law_check u hu) + simpa only [A1_7_8Law, hu, ite_true, stageALaw, splitLaw, + Rat.cast_div, Rat.cast_mul, Rat.cast_inv, div_eq_mul_inv] using h + · simp only [A1_7_8Law, hu, ite_false, stageALaw, splitLaw, Rat.cast_zero] + simpa only [Rat.cast_zero] using Ball.exact_sound 0 + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/Certificates/SplitA2_2_12.lean b/lean/OAI/LinearAlgebra/MatrixFields/Certificates/SplitA2_2_12.lean new file mode 100644 index 0000000000000000000000000000000000000000..d02eb07e6e06d353d089e37da26151c27d48fab6 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/Certificates/SplitA2_2_12.lean @@ -0,0 +1,145 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Certificates.SplitA1_3_12 + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate +open scoped BigOperators +lemma A2_2_12_below : below (shape 2 2 12) = [ + (shape 0 0 8), + (shape 0 1 7), + (shape 0 2 6), + (shape 1 0 7), + (shape 1 1 6), + (shape 1 2 5), + (shape 2 0 6), + (shape 2 1 5), + (shape 2 2 4)] := by decide +kernel +def A2_2_12Raw (s : Shape) : Ball := + match s 0, s 1, s 2 with + | 0, 0, 8 => ⟨(1869311508851834494291415094233 / 100000000000000000000000000000000), (9 / 100000000000000000000000000000000)⟩ + | 0, 1, 7 => ⟨(7549884563595081968144199084631 / 20000000000000000000000000000000), (49 / 50000000000000000000000000000000)⟩ + | 0, 2, 6 => ⟨(30069849903795798682001150038067 / 50000000000000000000000000000000), (19 / 12500000000000000000000000000000)⟩ + | 1, 0, 7 => ⟨(3769284113062302699382690041033 / 10000000000000000000000000000000), (47 / 50000000000000000000000000000000)⟩ + | 1, 1, 6 => ⟨1, 0⟩ + | 1, 2, 5 => ⟨(3769284113062302699382690041033 / 10000000000000000000000000000000), (47 / 50000000000000000000000000000000)⟩ + | 2, 0, 6 => ⟨(30069849903795798682001150038067 / 50000000000000000000000000000000), (19 / 12500000000000000000000000000000)⟩ + | 2, 1, 5 => ⟨(7549884563595081968144199084631 / 20000000000000000000000000000000), (49 / 50000000000000000000000000000000)⟩ + | 2, 2, 4 => ⟨(1869311508851834494291415094233 / 100000000000000000000000000000000), (9 / 100000000000000000000000000000000)⟩ + | _, _, _ => (.exact 0) +lemma A2_2_12Raw_0_0_8 : (A2_2_12Raw (shape 0 0 8)).Encloses (splitWeight positiveInitial tableP (shape 2 2 12) (shape 0 0 8) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 2 2 12) (shape 0 0 8) + (-2535) (-2550) (-34711) w188 w187 w53 + (by decide +kernel) w188_sound w187_sound w53_sound) (by decide +kernel) +lemma A2_2_12Raw_0_1_7 : (A2_2_12Raw (shape 0 1 7)).Encloses (splitWeight positiveInitial tableP (shape 2 2 12) (shape 0 1 7) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 2 2 12) (shape 0 1 7) + (-2535) (0) (-7207) w188 w195 w147 + (by decide +kernel) w188_sound w195_sound w147_sound) (by decide +kernel) +lemma A2_2_12Raw_0_2_6 : (A2_2_12Raw (shape 0 2 6)).Encloses (splitWeight positiveInitial tableP (shape 2 2 12) (shape 0 2 6) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 2 2 12) (shape 0 2 6) + (-2535) (-2550) (0) w188 w187 w195 + (by decide +kernel) w188_sound w187_sound w195_sound) (by decide +kernel) +lemma A2_2_12Raw_1_0_7 : (A2_2_12Raw (shape 1 0 7)).Encloses (splitWeight positiveInitial tableP (shape 2 2 12) (shape 1 0 7) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 2 2 12) (shape 1 0 7) + (0) (-2550) (-7207) w195 w187 w147 + (by decide +kernel) w195_sound w187_sound w147_sound) (by decide +kernel) +lemma A2_2_12Raw_1_1_6 : (A2_2_12Raw (shape 1 1 6)).Encloses (splitWeight positiveInitial tableP (shape 2 2 12) (shape 1 1 6) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 2 2 12) (shape 1 1 6) + (0) (0) (0) w195 w195 w195 + (by decide +kernel) w195_sound w195_sound w195_sound) (by decide +kernel) +lemma A2_2_12Raw_1_2_5 : (A2_2_12Raw (shape 1 2 5)).Encloses (splitWeight positiveInitial tableP (shape 2 2 12) (shape 1 2 5) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 2 2 12) (shape 1 2 5) + (0) (-2550) (-7207) w195 w187 w147 + (by decide +kernel) w195_sound w187_sound w147_sound) (by decide +kernel) +lemma A2_2_12Raw_2_0_6 : (A2_2_12Raw (shape 2 0 6)).Encloses (splitWeight positiveInitial tableP (shape 2 2 12) (shape 2 0 6) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 2 2 12) (shape 2 0 6) + (-2535) (-2550) (0) w188 w187 w195 + (by decide +kernel) w188_sound w187_sound w195_sound) (by decide +kernel) +lemma A2_2_12Raw_2_1_5 : (A2_2_12Raw (shape 2 1 5)).Encloses (splitWeight positiveInitial tableP (shape 2 2 12) (shape 2 1 5) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 2 2 12) (shape 2 1 5) + (-2535) (0) (-7207) w188 w195 w147 + (by decide +kernel) w188_sound w195_sound w147_sound) (by decide +kernel) +lemma A2_2_12Raw_2_2_4 : (A2_2_12Raw (shape 2 2 4)).Encloses (splitWeight positiveInitial tableP (shape 2 2 12) (shape 2 2 4) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 2 2 12) (shape 2 2 4) + (-2535) (-2550) (-34711) w188 w187 w53 + (by decide +kernel) w188_sound w187_sound w53_sound) (by decide +kernel) +lemma A2_2_12Raw_sound (u : Shape) (hu : u ∈ below (shape 2 2 12)) : + (A2_2_12Raw u).Encloses (splitWeight positiveInitial tableP (shape 2 2 12) u : ℝ) := by + rw [A2_2_12_below] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl + · exact A2_2_12Raw_0_0_8 + · exact A2_2_12Raw_0_1_7 + · exact A2_2_12Raw_0_2_6 + · exact A2_2_12Raw_1_0_7 + · exact A2_2_12Raw_1_1_6 + · exact A2_2_12Raw_1_2_5 + · exact A2_2_12Raw_2_0_6 + · exact A2_2_12Raw_2_1_5 + · exact A2_2_12Raw_2_2_4 +def A2_2_12Den : Ball := ⟨(46862818816260467173210402750963 / 12500000000000000000000000000000), (353 / 50000000000000000000000000000000)⟩ +lemma A2_2_12Den_sound : A2_2_12Den.Encloses (((below (shape 2 2 12)).map (splitWeight positiveInitial tableP (shape 2 2 12))).sum : ℝ) := by + exact contains_sound (list_cast_enclosed (below (shape 2 2 12)) A2_2_12Raw (splitWeight positiveInitial tableP (shape 2 2 12)) A2_2_12Raw_sound) (by decide +kernel) +lemma A2_2_12Den_positive : 0 < A2_2_12Den.lower := by decide +kernel +def A2_2_12Table (s : Shape) : Ball := + match s 0, s 1, s 2 with + | 0, 0, 8 => ⟨(498612641127346285354984562323 / 100000000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ + | 0, 1, 7 => ⟨(629320585519500210170837921791 / 6250000000000000000000000000000), (23 / 50000000000000000000000000000000)⟩ + | 0, 2, 6 => ⟨(16041421890184163505612052300387 / 100000000000000000000000000000000), (71 / 100000000000000000000000000000000)⟩ + | 1, 0, 7 => ⟨(5027018498184156379482942970689 / 50000000000000000000000000000000), (9 / 20000000000000000000000000000000)⟩ + | 1, 1, 6 => ⟨(13336799104008174087333670447257 / 50000000000000000000000000000000), (51 / 100000000000000000000000000000000)⟩ + | 1, 2, 5 => ⟨(5027018498184156379482942970689 / 50000000000000000000000000000000), (9 / 20000000000000000000000000000000)⟩ + | 2, 0, 6 => ⟨(16041421890184163505612052300387 / 100000000000000000000000000000000), (71 / 100000000000000000000000000000000)⟩ + | 2, 1, 5 => ⟨(629320585519500210170837921791 / 6250000000000000000000000000000), (23 / 50000000000000000000000000000000)⟩ + | 2, 2, 4 => ⟨(498612641127346285354984562323 / 100000000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ + | _, _, _ => (.exact 0) +def A2_2_12Law (u : Shape) : Ball := if u ∈ below (shape 2 2 12) then A2_2_12Table u else .exact 0 +lemma A2_2_12Law_check_0_0_8 : contains (.mul (A2_2_12Raw (shape 0 0 8)) (.inv A2_2_12Den)) (A2_2_12Table (shape 0 0 8)) = true := by decide +kernel +lemma A2_2_12Law_check_0_1_7 : contains (.mul (A2_2_12Raw (shape 0 1 7)) (.inv A2_2_12Den)) (A2_2_12Table (shape 0 1 7)) = true := by decide +kernel +lemma A2_2_12Law_check_0_2_6 : contains (.mul (A2_2_12Raw (shape 0 2 6)) (.inv A2_2_12Den)) (A2_2_12Table (shape 0 2 6)) = true := by decide +kernel +lemma A2_2_12Law_check_1_0_7 : contains (.mul (A2_2_12Raw (shape 1 0 7)) (.inv A2_2_12Den)) (A2_2_12Table (shape 1 0 7)) = true := by decide +kernel +lemma A2_2_12Law_check_1_1_6 : contains (.mul (A2_2_12Raw (shape 1 1 6)) (.inv A2_2_12Den)) (A2_2_12Table (shape 1 1 6)) = true := by decide +kernel +lemma A2_2_12Law_check_1_2_5 : contains (.mul (A2_2_12Raw (shape 1 2 5)) (.inv A2_2_12Den)) (A2_2_12Table (shape 1 2 5)) = true := by decide +kernel +lemma A2_2_12Law_check_2_0_6 : contains (.mul (A2_2_12Raw (shape 2 0 6)) (.inv A2_2_12Den)) (A2_2_12Table (shape 2 0 6)) = true := by decide +kernel +lemma A2_2_12Law_check_2_1_5 : contains (.mul (A2_2_12Raw (shape 2 1 5)) (.inv A2_2_12Den)) (A2_2_12Table (shape 2 1 5)) = true := by decide +kernel +lemma A2_2_12Law_check_2_2_4 : contains (.mul (A2_2_12Raw (shape 2 2 4)) (.inv A2_2_12Den)) (A2_2_12Table (shape 2 2 4)) = true := by decide +kernel +lemma A2_2_12Law_check (u : Shape) (hu : u ∈ below (shape 2 2 12)) : + contains (.mul (A2_2_12Raw u) (.inv A2_2_12Den)) (A2_2_12Table u) = true := by + rw [A2_2_12_below] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl + · exact A2_2_12Law_check_0_0_8 + · exact A2_2_12Law_check_0_1_7 + · exact A2_2_12Law_check_0_2_6 + · exact A2_2_12Law_check_1_0_7 + · exact A2_2_12Law_check_1_1_6 + · exact A2_2_12Law_check_1_2_5 + · exact A2_2_12Law_check_2_0_6 + · exact A2_2_12Law_check_2_1_5 + · exact A2_2_12Law_check_2_2_4 +lemma A2_2_12Law_sound (u : Shape) : + (A2_2_12Law u).Encloses (stageALaw (shape 2 2 12) u : ℝ) := by + by_cases hu : u ∈ below (shape 2 2 12) + · have h := contains_sound (Ball.mul_sound (A2_2_12Raw_sound u hu) + (Ball.inv_sound A2_2_12Den_sound A2_2_12Den_positive)) (A2_2_12Law_check u hu) + simpa only [A2_2_12Law, hu, ite_true, stageALaw, splitLaw, + Rat.cast_div, Rat.cast_mul, Rat.cast_inv, div_eq_mul_inv] using h + · simp only [A2_2_12Law, hu, ite_false, stageALaw, splitLaw, Rat.cast_zero] + simpa only [Rat.cast_zero] using Ball.exact_sound 0 + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/Certificates/SplitA2_3_11.lean b/lean/OAI/LinearAlgebra/MatrixFields/Certificates/SplitA2_3_11.lean new file mode 100644 index 0000000000000000000000000000000000000000..028afaa49b92cf6c379bdea6a23c9be9bbf06382 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/Certificates/SplitA2_3_11.lean @@ -0,0 +1,175 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Certificates.SplitB1_1_6 + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate +open scoped BigOperators +lemma A2_3_11_below : below (shape 2 3 11) = [ + (shape 0 0 8), + (shape 0 1 7), + (shape 0 2 6), + (shape 0 3 5), + (shape 1 0 7), + (shape 1 1 6), + (shape 1 2 5), + (shape 1 3 4), + (shape 2 0 6), + (shape 2 1 5), + (shape 2 2 4), + (shape 2 3 3)] := by decide +kernel +def A2_3_11Raw (s : Shape) : Ball := + match s 0, s 1, s 2 with + | 0, 0, 8 => ⟨(186089076496629284671636655033 / 100000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ + | 0, 1, 7 => ⟨(3883263175820951434259740591633 / 25000000000000000000000000000000), (43 / 100000000000000000000000000000000)⟩ + | 0, 2, 6 => ⟨(72108374302660701632463080306707 / 100000000000000000000000000000000), (11 / 12500000000000000000000000000000)⟩ + | 0, 3, 5 => ⟨(7622712470039063487610425167721 / 20000000000000000000000000000000), (97 / 100000000000000000000000000000000)⟩ + | 1, 0, 7 => ⟨(1423229584278735571932633776199 / 12500000000000000000000000000000), (33 / 100000000000000000000000000000000)⟩ + | 1, 1, 6 => ⟨1, 0⟩ + | 1, 2, 5 => ⟨1, 0⟩ + | 1, 3, 4 => ⟨(1423229584278735571932633776199 / 12500000000000000000000000000000), (33 / 100000000000000000000000000000000)⟩ + | 2, 0, 6 => ⟨(7622712470039063487610425167721 / 20000000000000000000000000000000), (97 / 100000000000000000000000000000000)⟩ + | 2, 1, 5 => ⟨(72108374302660701632463080306707 / 100000000000000000000000000000000), (11 / 12500000000000000000000000000000)⟩ + | 2, 2, 4 => ⟨(3883263175820951434259740591633 / 25000000000000000000000000000000), (43 / 100000000000000000000000000000000)⟩ + | 2, 3, 3 => ⟨(186089076496629284671636655033 / 100000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ + | _, _, _ => (.exact 0) +lemma A2_3_11Raw_0_0_8 : (A2_3_11Raw (shape 0 0 8)).Encloses (splitWeight positiveInitial tableP (shape 2 3 11) (shape 0 0 8) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 2 3 11) (shape 0 0 8) + (-3270) (-6376) (-53221) w184 w157 w33 + (by decide +kernel) w184_sound w157_sound w33_sound) (by decide +kernel) +lemma A2_3_11Raw_0_1_7 : (A2_3_11Raw (shape 0 1 7)).Encloses (splitWeight positiveInitial tableP (shape 2 3 11) (shape 0 1 7) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 2 3 11) (shape 0 1 7) + (-3270) (0) (-15352) w184 w195 w112 + (by decide +kernel) w184_sound w195_sound w112_sound) (by decide +kernel) +lemma A2_3_11Raw_0_2_6 : (A2_3_11Raw (shape 0 2 6)).Encloses (splitWeight positiveInitial tableP (shape 2 3 11) (shape 0 2 6) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 2 3 11) (shape 0 2 6) + (-3270) (0) (0) w184 w195 w195 + (by decide +kernel) w184_sound w195_sound w195_sound) (by decide +kernel) +lemma A2_3_11Raw_0_3_5 : (A2_3_11Raw (shape 0 3 5)).Encloses (splitWeight positiveInitial tableP (shape 2 3 11) (shape 0 3 5) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 2 3 11) (shape 0 3 5) + (-3270) (-6376) (0) w184 w157 w195 + (by decide +kernel) w184_sound w157_sound w195_sound) (by decide +kernel) +lemma A2_3_11Raw_1_0_7 : (A2_3_11Raw (shape 1 0 7)).Encloses (splitWeight positiveInitial tableP (shape 2 3 11) (shape 1 0 7) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 2 3 11) (shape 1 0 7) + (0) (-6376) (-15352) w195 w157 w112 + (by decide +kernel) w195_sound w157_sound w112_sound) (by decide +kernel) +lemma A2_3_11Raw_1_1_6 : (A2_3_11Raw (shape 1 1 6)).Encloses (splitWeight positiveInitial tableP (shape 2 3 11) (shape 1 1 6) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 2 3 11) (shape 1 1 6) + (0) (0) (0) w195 w195 w195 + (by decide +kernel) w195_sound w195_sound w195_sound) (by decide +kernel) +lemma A2_3_11Raw_1_2_5 : (A2_3_11Raw (shape 1 2 5)).Encloses (splitWeight positiveInitial tableP (shape 2 3 11) (shape 1 2 5) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 2 3 11) (shape 1 2 5) + (0) (0) (0) w195 w195 w195 + (by decide +kernel) w195_sound w195_sound w195_sound) (by decide +kernel) +lemma A2_3_11Raw_1_3_4 : (A2_3_11Raw (shape 1 3 4)).Encloses (splitWeight positiveInitial tableP (shape 2 3 11) (shape 1 3 4) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 2 3 11) (shape 1 3 4) + (0) (-6376) (-15352) w195 w157 w112 + (by decide +kernel) w195_sound w157_sound w112_sound) (by decide +kernel) +lemma A2_3_11Raw_2_0_6 : (A2_3_11Raw (shape 2 0 6)).Encloses (splitWeight positiveInitial tableP (shape 2 3 11) (shape 2 0 6) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 2 3 11) (shape 2 0 6) + (-3270) (-6376) (0) w184 w157 w195 + (by decide +kernel) w184_sound w157_sound w195_sound) (by decide +kernel) +lemma A2_3_11Raw_2_1_5 : (A2_3_11Raw (shape 2 1 5)).Encloses (splitWeight positiveInitial tableP (shape 2 3 11) (shape 2 1 5) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 2 3 11) (shape 2 1 5) + (-3270) (0) (0) w184 w195 w195 + (by decide +kernel) w184_sound w195_sound w195_sound) (by decide +kernel) +lemma A2_3_11Raw_2_2_4 : (A2_3_11Raw (shape 2 2 4)).Encloses (splitWeight positiveInitial tableP (shape 2 3 11) (shape 2 2 4) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 2 3 11) (shape 2 2 4) + (-3270) (0) (-15352) w184 w195 w112 + (by decide +kernel) w184_sound w195_sound w112_sound) (by decide +kernel) +lemma A2_3_11Raw_2_3_3 : (A2_3_11Raw (shape 2 3 3)).Encloses (splitWeight positiveInitial tableP (shape 2 3 11) (shape 2 3 3) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 2 3 11) (shape 2 3 3) + (-3270) (-6376) (-53221) w184 w157 w33 + (by decide +kernel) w184_sound w157_sound w33_sound) (by decide +kernel) +lemma A2_3_11Raw_sound (u : Shape) (hu : u ∈ below (shape 2 3 11)) : + (A2_3_11Raw u).Encloses (splitWeight positiveInitial tableP (shape 2 3 11) u : ℝ) := by + rw [A2_3_11_below] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl + · exact A2_3_11Raw_0_0_8 + · exact A2_3_11Raw_0_1_7 + · exact A2_3_11Raw_0_2_6 + · exact A2_3_11Raw_0_3_5 + · exact A2_3_11Raw_1_0_7 + · exact A2_3_11Raw_1_1_6 + · exact A2_3_11Raw_1_2_5 + · exact A2_3_11Raw_1_3_4 + · exact A2_3_11Raw_2_0_6 + · exact A2_3_11Raw_2_1_5 + · exact A2_3_11Raw_2_2_4 + · exact A2_3_11Raw_2_3_3 +def A2_3_11Den : Ball := ⟨(237326915106866338667686875376469 / 50000000000000000000000000000000), (263 / 50000000000000000000000000000000)⟩ +lemma A2_3_11Den_sound : A2_3_11Den.Encloses (((below (shape 2 3 11)).map (splitWeight positiveInitial tableP (shape 2 3 11))).sum : ℝ) := by + exact contains_sound (list_cast_enclosed (below (shape 2 3 11)) A2_3_11Raw (splitWeight positiveInitial tableP (shape 2 3 11)) A2_3_11Raw_sound) (by decide +kernel) +lemma A2_3_11Den_positive : 0 < A2_3_11Den.lower := by decide +kernel +def A2_3_11Table (s : Shape) : Ball := + match s 0, s 1, s 2 with + | 0, 0, 8 => ⟨(3920521960453472358068863817 / 10000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 0, 1, 7 => ⟨(1636250643578437060137490917283 / 50000000000000000000000000000000), (13 / 100000000000000000000000000000000)⟩ + | 0, 2, 6 => ⟨(3038356364687540796048396518993 / 20000000000000000000000000000000), (9 / 25000000000000000000000000000000)⟩ + | 0, 3, 5 => ⟨(2007439944866403842027423610433 / 25000000000000000000000000000000), (3 / 10000000000000000000000000000000)⟩ + | 1, 0, 7 => ⟨(1199383208295499995255418131323 / 50000000000000000000000000000000), (11 / 100000000000000000000000000000000)⟩ + | 1, 1, 6 => ⟨(21067985473744271817281816227921 / 100000000000000000000000000000000), (3 / 12500000000000000000000000000000)⟩ + | 1, 2, 5 => ⟨(21067985473744271817281816227921 / 100000000000000000000000000000000), (3 / 12500000000000000000000000000000)⟩ + | 1, 3, 4 => ⟨(1199383208295499995255418131323 / 50000000000000000000000000000000), (11 / 100000000000000000000000000000000)⟩ + | 2, 0, 6 => ⟨(2007439944866403842027423610433 / 25000000000000000000000000000000), (3 / 10000000000000000000000000000000)⟩ + | 2, 1, 5 => ⟨(3038356364687540796048396518993 / 20000000000000000000000000000000), (9 / 25000000000000000000000000000000)⟩ + | 2, 2, 4 => ⟨(1636250643578437060137490917283 / 50000000000000000000000000000000), (13 / 100000000000000000000000000000000)⟩ + | 2, 3, 3 => ⟨(3920521960453472358068863817 / 10000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | _, _, _ => (.exact 0) +def A2_3_11Law (u : Shape) : Ball := if u ∈ below (shape 2 3 11) then A2_3_11Table u else .exact 0 +lemma A2_3_11Law_check_0_0_8 : contains (.mul (A2_3_11Raw (shape 0 0 8)) (.inv A2_3_11Den)) (A2_3_11Table (shape 0 0 8)) = true := by decide +kernel +lemma A2_3_11Law_check_0_1_7 : contains (.mul (A2_3_11Raw (shape 0 1 7)) (.inv A2_3_11Den)) (A2_3_11Table (shape 0 1 7)) = true := by decide +kernel +lemma A2_3_11Law_check_0_2_6 : contains (.mul (A2_3_11Raw (shape 0 2 6)) (.inv A2_3_11Den)) (A2_3_11Table (shape 0 2 6)) = true := by decide +kernel +lemma A2_3_11Law_check_0_3_5 : contains (.mul (A2_3_11Raw (shape 0 3 5)) (.inv A2_3_11Den)) (A2_3_11Table (shape 0 3 5)) = true := by decide +kernel +lemma A2_3_11Law_check_1_0_7 : contains (.mul (A2_3_11Raw (shape 1 0 7)) (.inv A2_3_11Den)) (A2_3_11Table (shape 1 0 7)) = true := by decide +kernel +lemma A2_3_11Law_check_1_1_6 : contains (.mul (A2_3_11Raw (shape 1 1 6)) (.inv A2_3_11Den)) (A2_3_11Table (shape 1 1 6)) = true := by decide +kernel +lemma A2_3_11Law_check_1_2_5 : contains (.mul (A2_3_11Raw (shape 1 2 5)) (.inv A2_3_11Den)) (A2_3_11Table (shape 1 2 5)) = true := by decide +kernel +lemma A2_3_11Law_check_1_3_4 : contains (.mul (A2_3_11Raw (shape 1 3 4)) (.inv A2_3_11Den)) (A2_3_11Table (shape 1 3 4)) = true := by decide +kernel +lemma A2_3_11Law_check_2_0_6 : contains (.mul (A2_3_11Raw (shape 2 0 6)) (.inv A2_3_11Den)) (A2_3_11Table (shape 2 0 6)) = true := by decide +kernel +lemma A2_3_11Law_check_2_1_5 : contains (.mul (A2_3_11Raw (shape 2 1 5)) (.inv A2_3_11Den)) (A2_3_11Table (shape 2 1 5)) = true := by decide +kernel +lemma A2_3_11Law_check_2_2_4 : contains (.mul (A2_3_11Raw (shape 2 2 4)) (.inv A2_3_11Den)) (A2_3_11Table (shape 2 2 4)) = true := by decide +kernel +lemma A2_3_11Law_check_2_3_3 : contains (.mul (A2_3_11Raw (shape 2 3 3)) (.inv A2_3_11Den)) (A2_3_11Table (shape 2 3 3)) = true := by decide +kernel +lemma A2_3_11Law_check (u : Shape) (hu : u ∈ below (shape 2 3 11)) : + contains (.mul (A2_3_11Raw u) (.inv A2_3_11Den)) (A2_3_11Table u) = true := by + rw [A2_3_11_below] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl + · exact A2_3_11Law_check_0_0_8 + · exact A2_3_11Law_check_0_1_7 + · exact A2_3_11Law_check_0_2_6 + · exact A2_3_11Law_check_0_3_5 + · exact A2_3_11Law_check_1_0_7 + · exact A2_3_11Law_check_1_1_6 + · exact A2_3_11Law_check_1_2_5 + · exact A2_3_11Law_check_1_3_4 + · exact A2_3_11Law_check_2_0_6 + · exact A2_3_11Law_check_2_1_5 + · exact A2_3_11Law_check_2_2_4 + · exact A2_3_11Law_check_2_3_3 +lemma A2_3_11Law_sound (u : Shape) : + (A2_3_11Law u).Encloses (stageALaw (shape 2 3 11) u : ℝ) := by + by_cases hu : u ∈ below (shape 2 3 11) + · have h := contains_sound (Ball.mul_sound (A2_3_11Raw_sound u hu) + (Ball.inv_sound A2_3_11Den_sound A2_3_11Den_positive)) (A2_3_11Law_check u hu) + simpa only [A2_3_11Law, hu, ite_true, stageALaw, splitLaw, + Rat.cast_div, Rat.cast_mul, Rat.cast_inv, div_eq_mul_inv] using h + · simp only [A2_3_11Law, hu, ite_false, stageALaw, splitLaw, Rat.cast_zero] + simpa only [Rat.cast_zero] using Ball.exact_sound 0 + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/Certificates/SplitA2_4_10.lean b/lean/OAI/LinearAlgebra/MatrixFields/Certificates/SplitA2_4_10.lean new file mode 100644 index 0000000000000000000000000000000000000000..227b93df9556de004546f27e8571b8f9ed0305ae --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/Certificates/SplitA2_4_10.lean @@ -0,0 +1,205 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Certificates.SplitB1_3_4 + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate +open scoped BigOperators +lemma A2_4_10_below : below (shape 2 4 10) = [ + (shape 0 0 8), + (shape 0 1 7), + (shape 0 2 6), + (shape 0 3 5), + (shape 0 4 4), + (shape 1 0 7), + (shape 1 1 6), + (shape 1 2 5), + (shape 1 3 4), + (shape 1 4 3), + (shape 2 0 6), + (shape 2 1 5), + (shape 2 2 4), + (shape 2 3 3), + (shape 2 4 2)] := by decide +kernel +def A2_4_10Raw (s : Shape) : Ball := + match s 0, s 1, s 2 with + | 0, 0, 8 => ⟨(446772032626590449174459001 / 5000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 0, 1, 7 => ⟨(906397801707561174643203706603 / 50000000000000000000000000000000), (1 / 12500000000000000000000000000000)⟩ + | 0, 2, 6 => ⟨(6854684406764661394145666352671 / 20000000000000000000000000000000), (89 / 100000000000000000000000000000000)⟩ + | 0, 3, 5 => ⟨(46468291928546345537530836954281 / 100000000000000000000000000000000), (59 / 50000000000000000000000000000000)⟩ + | 0, 4, 4 => ⟨(3890053868306385356771126651001 / 50000000000000000000000000000000), (31 / 100000000000000000000000000000000)⟩ + | 1, 0, 7 => ⟨(221391162680060686462957026073 / 25000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ + | 1, 1, 6 => ⟨(7981096634328140896953939436857 / 25000000000000000000000000000000), (81 / 100000000000000000000000000000000)⟩ + | 1, 2, 5 => ⟨1, 0⟩ + | 1, 3, 4 => ⟨(7981096634328140896953939436857 / 25000000000000000000000000000000), (81 / 100000000000000000000000000000000)⟩ + | 1, 4, 3 => ⟨(221391162680060686462957026073 / 25000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ + | 2, 0, 6 => ⟨(3890053868306385356771126651001 / 50000000000000000000000000000000), (31 / 100000000000000000000000000000000)⟩ + | 2, 1, 5 => ⟨(46468291928546345537530836954281 / 100000000000000000000000000000000), (59 / 50000000000000000000000000000000)⟩ + | 2, 2, 4 => ⟨(6854684406764661394145666352671 / 20000000000000000000000000000000), (89 / 100000000000000000000000000000000)⟩ + | 2, 3, 3 => ⟨(906397801707561174643203706603 / 50000000000000000000000000000000), (1 / 12500000000000000000000000000000)⟩ + | 2, 4, 2 => ⟨(446772032626590449174459001 / 5000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | _, _, _ => (.exact 0) +lemma A2_4_10Raw_0_0_8 : (A2_4_10Raw (shape 0 0 8)).Encloses (splitWeight positiveInitial tableP (shape 2 4 10) (shape 0 0 8) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 2 4 10) (shape 0 0 8) + (-3477) (-14828) (-74924) w183 w114 w11 + (by decide +kernel) w183_sound w114_sound w11_sound) (by decide +kernel) +lemma A2_4_10Raw_0_1_7 : (A2_4_10Raw (shape 0 1 7)).Encloses (splitWeight positiveInitial tableP (shape 2 4 10) (shape 0 1 7) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 2 4 10) (shape 0 1 7) + (-3477) (-4187) (-32439) w183 w178 w62 + (by decide +kernel) w183_sound w178_sound w62_sound) (by decide +kernel) +lemma A2_4_10Raw_0_2_6 : (A2_4_10Raw (shape 0 2 6)).Encloses (splitWeight positiveInitial tableP (shape 2 4 10) (shape 0 2 6) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 2 4 10) (shape 0 2 6) + (-3477) (0) (-7231) w183 w195 w146 + (by decide +kernel) w183_sound w195_sound w146_sound) (by decide +kernel) +lemma A2_4_10Raw_0_3_5 : (A2_4_10Raw (shape 0 3 5)).Encloses (splitWeight positiveInitial tableP (shape 2 4 10) (shape 0 3 5) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 2 4 10) (shape 0 3 5) + (-3477) (-4187) (0) w183 w178 w195 + (by decide +kernel) w183_sound w178_sound w195_sound) (by decide +kernel) +lemma A2_4_10Raw_0_4_4 : (A2_4_10Raw (shape 0 4 4)).Encloses (splitWeight positiveInitial tableP (shape 2 4 10) (shape 0 4 4) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 2 4 10) (shape 0 4 4) + (-3477) (-14828) (-7231) w183 w114 w146 + (by decide +kernel) w183_sound w114_sound w146_sound) (by decide +kernel) +lemma A2_4_10Raw_1_0_7 : (A2_4_10Raw (shape 1 0 7)).Encloses (splitWeight positiveInitial tableP (shape 2 4 10) (shape 1 0 7) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 2 4 10) (shape 1 0 7) + (0) (-14828) (-32439) w195 w114 w62 + (by decide +kernel) w195_sound w114_sound w62_sound) (by decide +kernel) +lemma A2_4_10Raw_1_1_6 : (A2_4_10Raw (shape 1 1 6)).Encloses (splitWeight positiveInitial tableP (shape 2 4 10) (shape 1 1 6) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 2 4 10) (shape 1 1 6) + (0) (-4187) (-7231) w195 w178 w146 + (by decide +kernel) w195_sound w178_sound w146_sound) (by decide +kernel) +lemma A2_4_10Raw_1_2_5 : (A2_4_10Raw (shape 1 2 5)).Encloses (splitWeight positiveInitial tableP (shape 2 4 10) (shape 1 2 5) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 2 4 10) (shape 1 2 5) + (0) (0) (0) w195 w195 w195 + (by decide +kernel) w195_sound w195_sound w195_sound) (by decide +kernel) +lemma A2_4_10Raw_1_3_4 : (A2_4_10Raw (shape 1 3 4)).Encloses (splitWeight positiveInitial tableP (shape 2 4 10) (shape 1 3 4) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 2 4 10) (shape 1 3 4) + (0) (-4187) (-7231) w195 w178 w146 + (by decide +kernel) w195_sound w178_sound w146_sound) (by decide +kernel) +lemma A2_4_10Raw_1_4_3 : (A2_4_10Raw (shape 1 4 3)).Encloses (splitWeight positiveInitial tableP (shape 2 4 10) (shape 1 4 3) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 2 4 10) (shape 1 4 3) + (0) (-14828) (-32439) w195 w114 w62 + (by decide +kernel) w195_sound w114_sound w62_sound) (by decide +kernel) +lemma A2_4_10Raw_2_0_6 : (A2_4_10Raw (shape 2 0 6)).Encloses (splitWeight positiveInitial tableP (shape 2 4 10) (shape 2 0 6) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 2 4 10) (shape 2 0 6) + (-3477) (-14828) (-7231) w183 w114 w146 + (by decide +kernel) w183_sound w114_sound w146_sound) (by decide +kernel) +lemma A2_4_10Raw_2_1_5 : (A2_4_10Raw (shape 2 1 5)).Encloses (splitWeight positiveInitial tableP (shape 2 4 10) (shape 2 1 5) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 2 4 10) (shape 2 1 5) + (-3477) (-4187) (0) w183 w178 w195 + (by decide +kernel) w183_sound w178_sound w195_sound) (by decide +kernel) +lemma A2_4_10Raw_2_2_4 : (A2_4_10Raw (shape 2 2 4)).Encloses (splitWeight positiveInitial tableP (shape 2 4 10) (shape 2 2 4) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 2 4 10) (shape 2 2 4) + (-3477) (0) (-7231) w183 w195 w146 + (by decide +kernel) w183_sound w195_sound w146_sound) (by decide +kernel) +lemma A2_4_10Raw_2_3_3 : (A2_4_10Raw (shape 2 3 3)).Encloses (splitWeight positiveInitial tableP (shape 2 4 10) (shape 2 3 3) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 2 4 10) (shape 2 3 3) + (-3477) (-4187) (-32439) w183 w178 w62 + (by decide +kernel) w183_sound w178_sound w62_sound) (by decide +kernel) +lemma A2_4_10Raw_2_4_2 : (A2_4_10Raw (shape 2 4 2)).Encloses (splitWeight positiveInitial tableP (shape 2 4 10) (shape 2 4 2) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 2 4 10) (shape 2 4 2) + (-3477) (-14828) (-74924) w183 w114 w11 + (by decide +kernel) w183_sound w114_sound w11_sound) (by decide +kernel) +lemma A2_4_10Raw_sound (u : Shape) (hu : u ∈ below (shape 2 4 10)) : + (A2_4_10Raw u).Encloses (splitWeight positiveInitial tableP (shape 2 4 10) u : ℝ) := by + rw [A2_4_10_below] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl + · exact A2_4_10Raw_0_0_8 + · exact A2_4_10Raw_0_1_7 + · exact A2_4_10Raw_0_2_6 + · exact A2_4_10Raw_0_3_5 + · exact A2_4_10Raw_0_4_4 + · exact A2_4_10Raw_1_0_7 + · exact A2_4_10Raw_1_1_6 + · exact A2_4_10Raw_1_2_5 + · exact A2_4_10Raw_1_3_4 + · exact A2_4_10Raw_1_4_3 + · exact A2_4_10Raw_2_0_6 + · exact A2_4_10Raw_2_1_5 + · exact A2_4_10Raw_2_2_4 + · exact A2_4_10Raw_2_3_3 + · exact A2_4_10Raw_2_4_2 +def A2_4_10Den : Ball := ⟨(21644187991385360464217363058073 / 6250000000000000000000000000000), (331 / 50000000000000000000000000000000)⟩ +lemma A2_4_10Den_sound : A2_4_10Den.Encloses (((below (shape 2 4 10)).map (splitWeight positiveInitial tableP (shape 2 4 10))).sum : ℝ) := by + exact contains_sound (list_cast_enclosed (below (shape 2 4 10)) A2_4_10Raw (splitWeight positiveInitial tableP (shape 2 4 10)) A2_4_10Raw_sound) (by decide +kernel) +lemma A2_4_10Den_positive : 0 < A2_4_10Den.lower := by decide +kernel +def A2_4_10Table (s : Shape) : Ball := + match s 0, s 1, s 2 with + | 0, 0, 8 => ⟨(1290103932301626811496829007 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 0, 1, 7 => ⟨(52346489163067591327869821847 / 10000000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ + | 0, 2, 6 => ⟨(1237103973342943767145037824953 / 12500000000000000000000000000000), (9 / 20000000000000000000000000000000)⟩ + | 0, 3, 5 => ⟨(3354559023755106067899108779113 / 25000000000000000000000000000000), (3 / 5000000000000000000000000000000)⟩ + | 0, 4, 4 => ⟨(2246592636008493490381620329021 / 100000000000000000000000000000000), (7 / 50000000000000000000000000000000)⟩ + | 1, 0, 7 => ⟨(63929160442568044753234425373 / 25000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ + | 1, 1, 6 => ⟨(288078801942145166747625960087 / 3125000000000000000000000000000), (21 / 50000000000000000000000000000000)⟩ + | 1, 2, 5 => ⟨(14438056078813335419022981654143 / 50000000000000000000000000000000), (7 / 12500000000000000000000000000000)⟩ + | 1, 3, 4 => ⟨(288078801942145166747625960087 / 3125000000000000000000000000000), (21 / 50000000000000000000000000000000)⟩ + | 1, 4, 3 => ⟨(63929160442568044753234425373 / 25000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ + | 2, 0, 6 => ⟨(2246592636008493490381620329021 / 100000000000000000000000000000000), (7 / 50000000000000000000000000000000)⟩ + | 2, 1, 5 => ⟨(3354559023755106067899108779113 / 25000000000000000000000000000000), (3 / 5000000000000000000000000000000)⟩ + | 2, 2, 4 => ⟨(1237103973342943767145037824953 / 12500000000000000000000000000000), (9 / 20000000000000000000000000000000)⟩ + | 2, 3, 3 => ⟨(52346489163067591327869821847 / 10000000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ + | 2, 4, 2 => ⟨(1290103932301626811496829007 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | _, _, _ => (.exact 0) +def A2_4_10Law (u : Shape) : Ball := if u ∈ below (shape 2 4 10) then A2_4_10Table u else .exact 0 +lemma A2_4_10Law_check_0_0_8 : contains (.mul (A2_4_10Raw (shape 0 0 8)) (.inv A2_4_10Den)) (A2_4_10Table (shape 0 0 8)) = true := by decide +kernel +lemma A2_4_10Law_check_0_1_7 : contains (.mul (A2_4_10Raw (shape 0 1 7)) (.inv A2_4_10Den)) (A2_4_10Table (shape 0 1 7)) = true := by decide +kernel +lemma A2_4_10Law_check_0_2_6 : contains (.mul (A2_4_10Raw (shape 0 2 6)) (.inv A2_4_10Den)) (A2_4_10Table (shape 0 2 6)) = true := by decide +kernel +lemma A2_4_10Law_check_0_3_5 : contains (.mul (A2_4_10Raw (shape 0 3 5)) (.inv A2_4_10Den)) (A2_4_10Table (shape 0 3 5)) = true := by decide +kernel +lemma A2_4_10Law_check_0_4_4 : contains (.mul (A2_4_10Raw (shape 0 4 4)) (.inv A2_4_10Den)) (A2_4_10Table (shape 0 4 4)) = true := by decide +kernel +lemma A2_4_10Law_check_1_0_7 : contains (.mul (A2_4_10Raw (shape 1 0 7)) (.inv A2_4_10Den)) (A2_4_10Table (shape 1 0 7)) = true := by decide +kernel +lemma A2_4_10Law_check_1_1_6 : contains (.mul (A2_4_10Raw (shape 1 1 6)) (.inv A2_4_10Den)) (A2_4_10Table (shape 1 1 6)) = true := by decide +kernel +lemma A2_4_10Law_check_1_2_5 : contains (.mul (A2_4_10Raw (shape 1 2 5)) (.inv A2_4_10Den)) (A2_4_10Table (shape 1 2 5)) = true := by decide +kernel +lemma A2_4_10Law_check_1_3_4 : contains (.mul (A2_4_10Raw (shape 1 3 4)) (.inv A2_4_10Den)) (A2_4_10Table (shape 1 3 4)) = true := by decide +kernel +lemma A2_4_10Law_check_1_4_3 : contains (.mul (A2_4_10Raw (shape 1 4 3)) (.inv A2_4_10Den)) (A2_4_10Table (shape 1 4 3)) = true := by decide +kernel +lemma A2_4_10Law_check_2_0_6 : contains (.mul (A2_4_10Raw (shape 2 0 6)) (.inv A2_4_10Den)) (A2_4_10Table (shape 2 0 6)) = true := by decide +kernel +lemma A2_4_10Law_check_2_1_5 : contains (.mul (A2_4_10Raw (shape 2 1 5)) (.inv A2_4_10Den)) (A2_4_10Table (shape 2 1 5)) = true := by decide +kernel +lemma A2_4_10Law_check_2_2_4 : contains (.mul (A2_4_10Raw (shape 2 2 4)) (.inv A2_4_10Den)) (A2_4_10Table (shape 2 2 4)) = true := by decide +kernel +lemma A2_4_10Law_check_2_3_3 : contains (.mul (A2_4_10Raw (shape 2 3 3)) (.inv A2_4_10Den)) (A2_4_10Table (shape 2 3 3)) = true := by decide +kernel +lemma A2_4_10Law_check_2_4_2 : contains (.mul (A2_4_10Raw (shape 2 4 2)) (.inv A2_4_10Den)) (A2_4_10Table (shape 2 4 2)) = true := by decide +kernel +lemma A2_4_10Law_check (u : Shape) (hu : u ∈ below (shape 2 4 10)) : + contains (.mul (A2_4_10Raw u) (.inv A2_4_10Den)) (A2_4_10Table u) = true := by + rw [A2_4_10_below] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl + · exact A2_4_10Law_check_0_0_8 + · exact A2_4_10Law_check_0_1_7 + · exact A2_4_10Law_check_0_2_6 + · exact A2_4_10Law_check_0_3_5 + · exact A2_4_10Law_check_0_4_4 + · exact A2_4_10Law_check_1_0_7 + · exact A2_4_10Law_check_1_1_6 + · exact A2_4_10Law_check_1_2_5 + · exact A2_4_10Law_check_1_3_4 + · exact A2_4_10Law_check_1_4_3 + · exact A2_4_10Law_check_2_0_6 + · exact A2_4_10Law_check_2_1_5 + · exact A2_4_10Law_check_2_2_4 + · exact A2_4_10Law_check_2_3_3 + · exact A2_4_10Law_check_2_4_2 +lemma A2_4_10Law_sound (u : Shape) : + (A2_4_10Law u).Encloses (stageALaw (shape 2 4 10) u : ℝ) := by + by_cases hu : u ∈ below (shape 2 4 10) + · have h := contains_sound (Ball.mul_sound (A2_4_10Raw_sound u hu) + (Ball.inv_sound A2_4_10Den_sound A2_4_10Den_positive)) (A2_4_10Law_check u hu) + simpa only [A2_4_10Law, hu, ite_true, stageALaw, splitLaw, + Rat.cast_div, Rat.cast_mul, Rat.cast_inv, div_eq_mul_inv] using h + · simp only [A2_4_10Law, hu, ite_false, stageALaw, splitLaw, Rat.cast_zero] + simpa only [Rat.cast_zero] using Ball.exact_sound 0 + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/Certificates/SplitA2_5_9.lean b/lean/OAI/LinearAlgebra/MatrixFields/Certificates/SplitA2_5_9.lean new file mode 100644 index 0000000000000000000000000000000000000000..507c0d5cad033ea95ed350bf645dcd4655133b8a --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/Certificates/SplitA2_5_9.lean @@ -0,0 +1,235 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Certificates.SplitB1_3_4 + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate +open scoped BigOperators +lemma A2_5_9_below : below (shape 2 5 9) = [ + (shape 0 0 8), + (shape 0 1 7), + (shape 0 2 6), + (shape 0 3 5), + (shape 0 4 4), + (shape 0 5 3), + (shape 1 0 7), + (shape 1 1 6), + (shape 1 2 5), + (shape 1 3 4), + (shape 1 4 3), + (shape 1 5 2), + (shape 2 0 6), + (shape 2 1 5), + (shape 2 2 4), + (shape 2 3 3), + (shape 2 4 2), + (shape 2 5 1)] := by decide +kernel +def A2_5_9Raw (s : Shape) : Ball := + match s 0, s 1, s 2 with + | 0, 0, 8 => ⟨(273399354531404847951902717 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 0, 1, 7 => ⟨(68946518086100053614010604923 / 25000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ + | 0, 2, 6 => ⟨(5026696090772982390642513919 / 39062500000000000000000000000), (31 / 100000000000000000000000000000000)⟩ + | 0, 3, 5 => ⟨(34960645180196030788867851759237 / 50000000000000000000000000000000), (21 / 25000000000000000000000000000000)⟩ + | 0, 4, 4 => ⟨(14646816460940129823291825517243 / 50000000000000000000000000000000), (19 / 25000000000000000000000000000000)⟩ + | 0, 5, 3 => ⟨(549758056631767773116973570093 / 50000000000000000000000000000000), (1 / 20000000000000000000000000000000)⟩ + | 1, 0, 7 => ⟨(20110279532265531872236546511 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 1, 1, 6 => ⟨(481900057386660180442774113293 / 6250000000000000000000000000000), (1 / 5000000000000000000000000000000)⟩ + | 1, 2, 5 => ⟨1, 0⟩ + | 1, 3, 4 => ⟨1, 0⟩ + | 1, 4, 3 => ⟨(481900057386660180442774113293 / 6250000000000000000000000000000), (1 / 5000000000000000000000000000000)⟩ + | 1, 5, 2 => ⟨(20110279532265531872236546511 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 2, 0, 6 => ⟨(549758056631767773116973570093 / 50000000000000000000000000000000), (1 / 20000000000000000000000000000000)⟩ + | 2, 1, 5 => ⟨(14646816460940129823291825517243 / 50000000000000000000000000000000), (19 / 25000000000000000000000000000000)⟩ + | 2, 2, 4 => ⟨(34960645180196030788867851759237 / 50000000000000000000000000000000), (21 / 25000000000000000000000000000000)⟩ + | 2, 3, 3 => ⟨(5026696090772982390642513919 / 39062500000000000000000000000), (31 / 100000000000000000000000000000000)⟩ + | 2, 4, 2 => ⟨(68946518086100053614010604923 / 25000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ + | 2, 5, 1 => ⟨(273399354531404847951902717 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | _, _, _ => (.exact 0) +lemma A2_5_9Raw_0_0_8 : (A2_5_9Raw (shape 0 0 8)).Encloses (splitWeight positiveInitial tableP (shape 2 5 9) (shape 0 0 8) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 2 5 9) (shape 0 0 8) + (-3578) (-24599) (-92989) w181 w82 w6 + (by decide +kernel) w181_sound w82_sound w6_sound) (by decide +kernel) +lemma A2_5_9Raw_0_1_7 : (A2_5_9Raw (shape 0 1 7)).Encloses (splitWeight positiveInitial tableP (shape 2 5 9) (shape 0 1 7) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 2 5 9) (shape 0 1 7) + (-3578) (-8700) (-46655) w181 w137 w39 + (by decide +kernel) w181_sound w137_sound w39_sound) (by decide +kernel) +lemma A2_5_9Raw_0_2_6 : (A2_5_9Raw (shape 0 2 6)).Encloses (splitWeight positiveInitial tableP (shape 2 5 9) (shape 0 2 6) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 2 5 9) (shape 0 2 6) + (-3578) (0) (-16926) w181 w195 w101 + (by decide +kernel) w181_sound w195_sound w101_sound) (by decide +kernel) +lemma A2_5_9Raw_0_3_5 : (A2_5_9Raw (shape 0 3 5)).Encloses (splitWeight positiveInitial tableP (shape 2 5 9) (shape 0 3 5) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 2 5 9) (shape 0 3 5) + (-3578) (0) (0) w181 w195 w195 + (by decide +kernel) w181_sound w195_sound w195_sound) (by decide +kernel) +lemma A2_5_9Raw_0_4_4 : (A2_5_9Raw (shape 0 4 4)).Encloses (splitWeight positiveInitial tableP (shape 2 5 9) (shape 0 4 4) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 2 5 9) (shape 0 4 4) + (-3578) (-8700) (0) w181 w137 w195 + (by decide +kernel) w181_sound w137_sound w195_sound) (by decide +kernel) +lemma A2_5_9Raw_0_5_3 : (A2_5_9Raw (shape 0 5 3)).Encloses (splitWeight positiveInitial tableP (shape 2 5 9) (shape 0 5 3) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 2 5 9) (shape 0 5 3) + (-3578) (-24599) (-16926) w181 w82 w101 + (by decide +kernel) w181_sound w82_sound w101_sound) (by decide +kernel) +lemma A2_5_9Raw_1_0_7 : (A2_5_9Raw (shape 1 0 7)).Encloses (splitWeight positiveInitial tableP (shape 2 5 9) (shape 1 0 7) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 2 5 9) (shape 1 0 7) + (0) (-24599) (-46655) w195 w82 w39 + (by decide +kernel) w195_sound w82_sound w39_sound) (by decide +kernel) +lemma A2_5_9Raw_1_1_6 : (A2_5_9Raw (shape 1 1 6)).Encloses (splitWeight positiveInitial tableP (shape 2 5 9) (shape 1 1 6) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 2 5 9) (shape 1 1 6) + (0) (-8700) (-16926) w195 w137 w101 + (by decide +kernel) w195_sound w137_sound w101_sound) (by decide +kernel) +lemma A2_5_9Raw_1_2_5 : (A2_5_9Raw (shape 1 2 5)).Encloses (splitWeight positiveInitial tableP (shape 2 5 9) (shape 1 2 5) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 2 5 9) (shape 1 2 5) + (0) (0) (0) w195 w195 w195 + (by decide +kernel) w195_sound w195_sound w195_sound) (by decide +kernel) +lemma A2_5_9Raw_1_3_4 : (A2_5_9Raw (shape 1 3 4)).Encloses (splitWeight positiveInitial tableP (shape 2 5 9) (shape 1 3 4) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 2 5 9) (shape 1 3 4) + (0) (0) (0) w195 w195 w195 + (by decide +kernel) w195_sound w195_sound w195_sound) (by decide +kernel) +lemma A2_5_9Raw_1_4_3 : (A2_5_9Raw (shape 1 4 3)).Encloses (splitWeight positiveInitial tableP (shape 2 5 9) (shape 1 4 3) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 2 5 9) (shape 1 4 3) + (0) (-8700) (-16926) w195 w137 w101 + (by decide +kernel) w195_sound w137_sound w101_sound) (by decide +kernel) +lemma A2_5_9Raw_1_5_2 : (A2_5_9Raw (shape 1 5 2)).Encloses (splitWeight positiveInitial tableP (shape 2 5 9) (shape 1 5 2) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 2 5 9) (shape 1 5 2) + (0) (-24599) (-46655) w195 w82 w39 + (by decide +kernel) w195_sound w82_sound w39_sound) (by decide +kernel) +lemma A2_5_9Raw_2_0_6 : (A2_5_9Raw (shape 2 0 6)).Encloses (splitWeight positiveInitial tableP (shape 2 5 9) (shape 2 0 6) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 2 5 9) (shape 2 0 6) + (-3578) (-24599) (-16926) w181 w82 w101 + (by decide +kernel) w181_sound w82_sound w101_sound) (by decide +kernel) +lemma A2_5_9Raw_2_1_5 : (A2_5_9Raw (shape 2 1 5)).Encloses (splitWeight positiveInitial tableP (shape 2 5 9) (shape 2 1 5) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 2 5 9) (shape 2 1 5) + (-3578) (-8700) (0) w181 w137 w195 + (by decide +kernel) w181_sound w137_sound w195_sound) (by decide +kernel) +lemma A2_5_9Raw_2_2_4 : (A2_5_9Raw (shape 2 2 4)).Encloses (splitWeight positiveInitial tableP (shape 2 5 9) (shape 2 2 4) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 2 5 9) (shape 2 2 4) + (-3578) (0) (0) w181 w195 w195 + (by decide +kernel) w181_sound w195_sound w195_sound) (by decide +kernel) +lemma A2_5_9Raw_2_3_3 : (A2_5_9Raw (shape 2 3 3)).Encloses (splitWeight positiveInitial tableP (shape 2 5 9) (shape 2 3 3) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 2 5 9) (shape 2 3 3) + (-3578) (0) (-16926) w181 w195 w101 + (by decide +kernel) w181_sound w195_sound w101_sound) (by decide +kernel) +lemma A2_5_9Raw_2_4_2 : (A2_5_9Raw (shape 2 4 2)).Encloses (splitWeight positiveInitial tableP (shape 2 5 9) (shape 2 4 2) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 2 5 9) (shape 2 4 2) + (-3578) (-8700) (-46655) w181 w137 w39 + (by decide +kernel) w181_sound w137_sound w39_sound) (by decide +kernel) +lemma A2_5_9Raw_2_5_1 : (A2_5_9Raw (shape 2 5 1)).Encloses (splitWeight positiveInitial tableP (shape 2 5 9) (shape 2 5 1) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 2 5 9) (shape 2 5 1) + (-3578) (-24599) (-92989) w181 w82 w6 + (by decide +kernel) w181_sound w82_sound w6_sound) (by decide +kernel) +lemma A2_5_9Raw_sound (u : Shape) (hu : u ∈ below (shape 2 5 9)) : + (A2_5_9Raw u).Encloses (splitWeight positiveInitial tableP (shape 2 5 9) u : ℝ) := by + rw [A2_5_9_below] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl + · exact A2_5_9Raw_0_0_8 + · exact A2_5_9Raw_0_1_7 + · exact A2_5_9Raw_0_2_6 + · exact A2_5_9Raw_0_3_5 + · exact A2_5_9Raw_0_4_4 + · exact A2_5_9Raw_0_5_3 + · exact A2_5_9Raw_1_0_7 + · exact A2_5_9Raw_1_1_6 + · exact A2_5_9Raw_1_2_5 + · exact A2_5_9Raw_1_3_4 + · exact A2_5_9Raw_1_4_3 + · exact A2_5_9Raw_1_5_2 + · exact A2_5_9Raw_2_0_6 + · exact A2_5_9Raw_2_1_5 + · exact A2_5_9Raw_2_2_4 + · exact A2_5_9Raw_2_3_3 + · exact A2_5_9Raw_2_4_2 + · exact A2_5_9Raw_2_5_1 +def A2_5_9Den : Ball := ⟨(55312489073820944932330853887411 / 12500000000000000000000000000000), (11 / 2500000000000000000000000000000)⟩ +lemma A2_5_9Den_sound : A2_5_9Den.Encloses (((below (shape 2 5 9)).map (splitWeight positiveInitial tableP (shape 2 5 9))).sum : ℝ) := by + exact contains_sound (list_cast_enclosed (below (shape 2 5 9)) A2_5_9Raw (splitWeight positiveInitial tableP (shape 2 5 9)) A2_5_9Raw_sound) (by decide +kernel) +lemma A2_5_9Den_positive : 0 < A2_5_9Den.lower := by decide +kernel +def A2_5_9Table (s : Shape) : Ball := + match s 0, s 1, s 2 with + | 0, 0, 8 => ⟨(4942814165649309970823409 / 4000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 0, 1, 7 => ⟨(62324548434335428709365572507 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 0, 2, 6 => ⟨(116324018389450319333620372957 / 4000000000000000000000000000000), (11 / 100000000000000000000000000000000)⟩ + | 0, 3, 5 => ⟨(1580142467171247110537433641061 / 10000000000000000000000000000000), (7 / 20000000000000000000000000000000)⟩ + | 0, 4, 4 => ⟨(3310015673266902490136717119167 / 50000000000000000000000000000000), (1 / 4000000000000000000000000000000)⟩ + | 0, 5, 3 => ⟨(248478266769938591622945895033 / 100000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ + | 1, 0, 7 => ⟨(9089393674467454662811780111 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 1, 1, 6 => ⟨(54451994641697075498935578049 / 3125000000000000000000000000000), (7 / 100000000000000000000000000000000)⟩ + | 1, 2, 5 => ⟨(706214828767994042269955497393 / 3125000000000000000000000000000), (23 / 100000000000000000000000000000000)⟩ + | 1, 3, 4 => ⟨(706214828767994042269955497393 / 3125000000000000000000000000000), (23 / 100000000000000000000000000000000)⟩ + | 1, 4, 3 => ⟨(54451994641697075498935578049 / 3125000000000000000000000000000), (7 / 100000000000000000000000000000000)⟩ + | 1, 5, 2 => ⟨(9089393674467454662811780111 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 2, 0, 6 => ⟨(248478266769938591622945895033 / 100000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ + | 2, 1, 5 => ⟨(3310015673266902490136717119167 / 50000000000000000000000000000000), (1 / 4000000000000000000000000000000)⟩ + | 2, 2, 4 => ⟨(1580142467171247110537433641061 / 10000000000000000000000000000000), (7 / 20000000000000000000000000000000)⟩ + | 2, 3, 3 => ⟨(116324018389450319333620372957 / 4000000000000000000000000000000), (11 / 100000000000000000000000000000000)⟩ + | 2, 4, 2 => ⟨(62324548434335428709365572507 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 2, 5, 1 => ⟨(4942814165649309970823409 / 4000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | _, _, _ => (.exact 0) +def A2_5_9Law (u : Shape) : Ball := if u ∈ below (shape 2 5 9) then A2_5_9Table u else .exact 0 +lemma A2_5_9Law_check_0_0_8 : contains (.mul (A2_5_9Raw (shape 0 0 8)) (.inv A2_5_9Den)) (A2_5_9Table (shape 0 0 8)) = true := by decide +kernel +lemma A2_5_9Law_check_0_1_7 : contains (.mul (A2_5_9Raw (shape 0 1 7)) (.inv A2_5_9Den)) (A2_5_9Table (shape 0 1 7)) = true := by decide +kernel +lemma A2_5_9Law_check_0_2_6 : contains (.mul (A2_5_9Raw (shape 0 2 6)) (.inv A2_5_9Den)) (A2_5_9Table (shape 0 2 6)) = true := by decide +kernel +lemma A2_5_9Law_check_0_3_5 : contains (.mul (A2_5_9Raw (shape 0 3 5)) (.inv A2_5_9Den)) (A2_5_9Table (shape 0 3 5)) = true := by decide +kernel +lemma A2_5_9Law_check_0_4_4 : contains (.mul (A2_5_9Raw (shape 0 4 4)) (.inv A2_5_9Den)) (A2_5_9Table (shape 0 4 4)) = true := by decide +kernel +lemma A2_5_9Law_check_0_5_3 : contains (.mul (A2_5_9Raw (shape 0 5 3)) (.inv A2_5_9Den)) (A2_5_9Table (shape 0 5 3)) = true := by decide +kernel +lemma A2_5_9Law_check_1_0_7 : contains (.mul (A2_5_9Raw (shape 1 0 7)) (.inv A2_5_9Den)) (A2_5_9Table (shape 1 0 7)) = true := by decide +kernel +lemma A2_5_9Law_check_1_1_6 : contains (.mul (A2_5_9Raw (shape 1 1 6)) (.inv A2_5_9Den)) (A2_5_9Table (shape 1 1 6)) = true := by decide +kernel +lemma A2_5_9Law_check_1_2_5 : contains (.mul (A2_5_9Raw (shape 1 2 5)) (.inv A2_5_9Den)) (A2_5_9Table (shape 1 2 5)) = true := by decide +kernel +lemma A2_5_9Law_check_1_3_4 : contains (.mul (A2_5_9Raw (shape 1 3 4)) (.inv A2_5_9Den)) (A2_5_9Table (shape 1 3 4)) = true := by decide +kernel +lemma A2_5_9Law_check_1_4_3 : contains (.mul (A2_5_9Raw (shape 1 4 3)) (.inv A2_5_9Den)) (A2_5_9Table (shape 1 4 3)) = true := by decide +kernel +lemma A2_5_9Law_check_1_5_2 : contains (.mul (A2_5_9Raw (shape 1 5 2)) (.inv A2_5_9Den)) (A2_5_9Table (shape 1 5 2)) = true := by decide +kernel +lemma A2_5_9Law_check_2_0_6 : contains (.mul (A2_5_9Raw (shape 2 0 6)) (.inv A2_5_9Den)) (A2_5_9Table (shape 2 0 6)) = true := by decide +kernel +lemma A2_5_9Law_check_2_1_5 : contains (.mul (A2_5_9Raw (shape 2 1 5)) (.inv A2_5_9Den)) (A2_5_9Table (shape 2 1 5)) = true := by decide +kernel +lemma A2_5_9Law_check_2_2_4 : contains (.mul (A2_5_9Raw (shape 2 2 4)) (.inv A2_5_9Den)) (A2_5_9Table (shape 2 2 4)) = true := by decide +kernel +lemma A2_5_9Law_check_2_3_3 : contains (.mul (A2_5_9Raw (shape 2 3 3)) (.inv A2_5_9Den)) (A2_5_9Table (shape 2 3 3)) = true := by decide +kernel +lemma A2_5_9Law_check_2_4_2 : contains (.mul (A2_5_9Raw (shape 2 4 2)) (.inv A2_5_9Den)) (A2_5_9Table (shape 2 4 2)) = true := by decide +kernel +lemma A2_5_9Law_check_2_5_1 : contains (.mul (A2_5_9Raw (shape 2 5 1)) (.inv A2_5_9Den)) (A2_5_9Table (shape 2 5 1)) = true := by decide +kernel +lemma A2_5_9Law_check (u : Shape) (hu : u ∈ below (shape 2 5 9)) : + contains (.mul (A2_5_9Raw u) (.inv A2_5_9Den)) (A2_5_9Table u) = true := by + rw [A2_5_9_below] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl + · exact A2_5_9Law_check_0_0_8 + · exact A2_5_9Law_check_0_1_7 + · exact A2_5_9Law_check_0_2_6 + · exact A2_5_9Law_check_0_3_5 + · exact A2_5_9Law_check_0_4_4 + · exact A2_5_9Law_check_0_5_3 + · exact A2_5_9Law_check_1_0_7 + · exact A2_5_9Law_check_1_1_6 + · exact A2_5_9Law_check_1_2_5 + · exact A2_5_9Law_check_1_3_4 + · exact A2_5_9Law_check_1_4_3 + · exact A2_5_9Law_check_1_5_2 + · exact A2_5_9Law_check_2_0_6 + · exact A2_5_9Law_check_2_1_5 + · exact A2_5_9Law_check_2_2_4 + · exact A2_5_9Law_check_2_3_3 + · exact A2_5_9Law_check_2_4_2 + · exact A2_5_9Law_check_2_5_1 +lemma A2_5_9Law_sound (u : Shape) : + (A2_5_9Law u).Encloses (stageALaw (shape 2 5 9) u : ℝ) := by + by_cases hu : u ∈ below (shape 2 5 9) + · have h := contains_sound (Ball.mul_sound (A2_5_9Raw_sound u hu) + (Ball.inv_sound A2_5_9Den_sound A2_5_9Den_positive)) (A2_5_9Law_check u hu) + simpa only [A2_5_9Law, hu, ite_true, stageALaw, splitLaw, + Rat.cast_div, Rat.cast_mul, Rat.cast_inv, div_eq_mul_inv] using h + · simp only [A2_5_9Law, hu, ite_false, stageALaw, splitLaw, Rat.cast_zero] + simpa only [Rat.cast_zero] using Ball.exact_sound 0 + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/Certificates/SplitA2_6_8.lean b/lean/OAI/LinearAlgebra/MatrixFields/Certificates/SplitA2_6_8.lean new file mode 100644 index 0000000000000000000000000000000000000000..2b8126bf25b74a6e1b13dd03145ef15feac677d2 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/Certificates/SplitA2_6_8.lean @@ -0,0 +1,265 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Certificates.SplitB1_3_4 + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate +open scoped BigOperators +lemma A2_6_8_below : below (shape 2 6 8) = [ + (shape 0 0 8), + (shape 0 1 7), + (shape 0 2 6), + (shape 0 3 5), + (shape 0 4 4), + (shape 0 5 3), + (shape 0 6 2), + (shape 1 0 7), + (shape 1 1 6), + (shape 1 2 5), + (shape 1 3 4), + (shape 1 4 3), + (shape 1 5 2), + (shape 1 6 1), + (shape 2 0 6), + (shape 2 1 5), + (shape 2 2 4), + (shape 2 3 3), + (shape 2 4 2), + (shape 2 5 1), + (shape 2 6 0)] := by decide +kernel +def A2_6_8Raw (s : Shape) : Ball := + match s 0, s 1, s 2 with + | 0, 0, 8 => ⟨(21466224447373239265811841 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 0, 1, 7 => ⟨(4164228830985898487035268579 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 0, 2, 6 => ⟨(236816107750252950992530912187 / 12500000000000000000000000000000), (1 / 12500000000000000000000000000000)⟩ + | 0, 3, 5 => ⟨(26588271193898263795134550700049 / 100000000000000000000000000000000), (71 / 100000000000000000000000000000000)⟩ + | 0, 4, 4 => ⟨(42109365988791183706790041939433 / 100000000000000000000000000000000), (103 / 100000000000000000000000000000000)⟩ + | 0, 5, 3 => ⟨(3497925876037468983918864089217 / 100000000000000000000000000000000), (3 / 20000000000000000000000000000000)⟩ + | 0, 6, 2 => ⟨(43048417256949502222394857087 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 1, 0, 7 => ⟨(152992977510149012892744533 / 6250000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 1, 1, 6 => ⟨(591892757125928317262835160377 / 100000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ + | 1, 2, 5 => ⟨(11311535044206459420578689801861 / 50000000000000000000000000000000), (59 / 100000000000000000000000000000000)⟩ + | 1, 3, 4 => ⟨1, 0⟩ + | 1, 4, 3 => ⟨(11311535044206459420578689801861 / 50000000000000000000000000000000), (59 / 100000000000000000000000000000000)⟩ + | 1, 5, 2 => ⟨(591892757125928317262835160377 / 100000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ + | 1, 6, 1 => ⟨(152992977510149012892744533 / 6250000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 2, 0, 6 => ⟨(43048417256949502222394857087 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 2, 1, 5 => ⟨(3497925876037468983918864089217 / 100000000000000000000000000000000), (3 / 20000000000000000000000000000000)⟩ + | 2, 2, 4 => ⟨(42109365988791183706790041939433 / 100000000000000000000000000000000), (103 / 100000000000000000000000000000000)⟩ + | 2, 3, 3 => ⟨(26588271193898263795134550700049 / 100000000000000000000000000000000), (71 / 100000000000000000000000000000000)⟩ + | 2, 4, 2 => ⟨(236816107750252950992530912187 / 12500000000000000000000000000000), (1 / 12500000000000000000000000000000)⟩ + | 2, 5, 1 => ⟨(4164228830985898487035268579 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 2, 6, 0 => ⟨(21466224447373239265811841 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | _, _, _ => (.exact 0) +lemma A2_6_8Raw_0_0_8 : (A2_6_8Raw (shape 0 0 8)).Encloses (splitWeight positiveInitial tableP (shape 2 6 8) (shape 0 0 8) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 2 6 8) (shape 0 0 8) + (-3517) (-42976) (-107049) w182 w41 w2 + (by decide +kernel) w182_sound w41_sound w2_sound) (by decide +kernel) +lemma A2_6_8Raw_0_1_7 : (A2_6_8Raw (shape 0 1 7)).Encloses (splitWeight positiveInitial tableP (shape 2 6 8) (shape 0 1 7) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 2 6 8) (shape 0 1 7) + (-3517) (-20283) (-63201) w182 w86 w17 + (by decide +kernel) w182_sound w86_sound w17_sound) (by decide +kernel) +lemma A2_6_8Raw_0_2_6 : (A2_6_8Raw (shape 0 2 6)).Encloses (splitWeight positiveInitial tableP (shape 2 6 8) (shape 0 2 6) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 2 6 8) (shape 0 2 6) + (-3517) (-5132) (-31013) w182 w171 w67 + (by decide +kernel) w182_sound w171_sound w67_sound) (by decide +kernel) +lemma A2_6_8Raw_0_3_5 : (A2_6_8Raw (shape 0 3 5)).Encloses (splitWeight positiveInitial tableP (shape 2 6 8) (shape 0 3 5) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 2 6 8) (shape 0 3 5) + (-3517) (0) (-9730) w182 w195 w133 + (by decide +kernel) w182_sound w195_sound w133_sound) (by decide +kernel) +lemma A2_6_8Raw_0_4_4 : (A2_6_8Raw (shape 0 4 4)).Encloses (splitWeight positiveInitial tableP (shape 2 6 8) (shape 0 4 4) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 2 6 8) (shape 0 4 4) + (-3517) (-5132) (0) w182 w171 w195 + (by decide +kernel) w182_sound w171_sound w195_sound) (by decide +kernel) +lemma A2_6_8Raw_0_5_3 : (A2_6_8Raw (shape 0 5 3)).Encloses (splitWeight positiveInitial tableP (shape 2 6 8) (shape 0 5 3) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 2 6 8) (shape 0 5 3) + (-3517) (-20283) (-9730) w182 w86 w133 + (by decide +kernel) w182_sound w86_sound w133_sound) (by decide +kernel) +lemma A2_6_8Raw_0_6_2 : (A2_6_8Raw (shape 0 6 2)).Encloses (splitWeight positiveInitial tableP (shape 2 6 8) (shape 0 6 2) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 2 6 8) (shape 0 6 2) + (-3517) (-42976) (-31013) w182 w41 w67 + (by decide +kernel) w182_sound w41_sound w67_sound) (by decide +kernel) +lemma A2_6_8Raw_1_0_7 : (A2_6_8Raw (shape 1 0 7)).Encloses (splitWeight positiveInitial tableP (shape 2 6 8) (shape 1 0 7) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 2 6 8) (shape 1 0 7) + (0) (-42976) (-63201) w195 w41 w17 + (by decide +kernel) w195_sound w41_sound w17_sound) (by decide +kernel) +lemma A2_6_8Raw_1_1_6 : (A2_6_8Raw (shape 1 1 6)).Encloses (splitWeight positiveInitial tableP (shape 2 6 8) (shape 1 1 6) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 2 6 8) (shape 1 1 6) + (0) (-20283) (-31013) w195 w86 w67 + (by decide +kernel) w195_sound w86_sound w67_sound) (by decide +kernel) +lemma A2_6_8Raw_1_2_5 : (A2_6_8Raw (shape 1 2 5)).Encloses (splitWeight positiveInitial tableP (shape 2 6 8) (shape 1 2 5) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 2 6 8) (shape 1 2 5) + (0) (-5132) (-9730) w195 w171 w133 + (by decide +kernel) w195_sound w171_sound w133_sound) (by decide +kernel) +lemma A2_6_8Raw_1_3_4 : (A2_6_8Raw (shape 1 3 4)).Encloses (splitWeight positiveInitial tableP (shape 2 6 8) (shape 1 3 4) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 2 6 8) (shape 1 3 4) + (0) (0) (0) w195 w195 w195 + (by decide +kernel) w195_sound w195_sound w195_sound) (by decide +kernel) +lemma A2_6_8Raw_1_4_3 : (A2_6_8Raw (shape 1 4 3)).Encloses (splitWeight positiveInitial tableP (shape 2 6 8) (shape 1 4 3) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 2 6 8) (shape 1 4 3) + (0) (-5132) (-9730) w195 w171 w133 + (by decide +kernel) w195_sound w171_sound w133_sound) (by decide +kernel) +lemma A2_6_8Raw_1_5_2 : (A2_6_8Raw (shape 1 5 2)).Encloses (splitWeight positiveInitial tableP (shape 2 6 8) (shape 1 5 2) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 2 6 8) (shape 1 5 2) + (0) (-20283) (-31013) w195 w86 w67 + (by decide +kernel) w195_sound w86_sound w67_sound) (by decide +kernel) +lemma A2_6_8Raw_1_6_1 : (A2_6_8Raw (shape 1 6 1)).Encloses (splitWeight positiveInitial tableP (shape 2 6 8) (shape 1 6 1) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 2 6 8) (shape 1 6 1) + (0) (-42976) (-63201) w195 w41 w17 + (by decide +kernel) w195_sound w41_sound w17_sound) (by decide +kernel) +lemma A2_6_8Raw_2_0_6 : (A2_6_8Raw (shape 2 0 6)).Encloses (splitWeight positiveInitial tableP (shape 2 6 8) (shape 2 0 6) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 2 6 8) (shape 2 0 6) + (-3517) (-42976) (-31013) w182 w41 w67 + (by decide +kernel) w182_sound w41_sound w67_sound) (by decide +kernel) +lemma A2_6_8Raw_2_1_5 : (A2_6_8Raw (shape 2 1 5)).Encloses (splitWeight positiveInitial tableP (shape 2 6 8) (shape 2 1 5) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 2 6 8) (shape 2 1 5) + (-3517) (-20283) (-9730) w182 w86 w133 + (by decide +kernel) w182_sound w86_sound w133_sound) (by decide +kernel) +lemma A2_6_8Raw_2_2_4 : (A2_6_8Raw (shape 2 2 4)).Encloses (splitWeight positiveInitial tableP (shape 2 6 8) (shape 2 2 4) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 2 6 8) (shape 2 2 4) + (-3517) (-5132) (0) w182 w171 w195 + (by decide +kernel) w182_sound w171_sound w195_sound) (by decide +kernel) +lemma A2_6_8Raw_2_3_3 : (A2_6_8Raw (shape 2 3 3)).Encloses (splitWeight positiveInitial tableP (shape 2 6 8) (shape 2 3 3) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 2 6 8) (shape 2 3 3) + (-3517) (0) (-9730) w182 w195 w133 + (by decide +kernel) w182_sound w195_sound w133_sound) (by decide +kernel) +lemma A2_6_8Raw_2_4_2 : (A2_6_8Raw (shape 2 4 2)).Encloses (splitWeight positiveInitial tableP (shape 2 6 8) (shape 2 4 2) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 2 6 8) (shape 2 4 2) + (-3517) (-5132) (-31013) w182 w171 w67 + (by decide +kernel) w182_sound w171_sound w67_sound) (by decide +kernel) +lemma A2_6_8Raw_2_5_1 : (A2_6_8Raw (shape 2 5 1)).Encloses (splitWeight positiveInitial tableP (shape 2 6 8) (shape 2 5 1) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 2 6 8) (shape 2 5 1) + (-3517) (-20283) (-63201) w182 w86 w17 + (by decide +kernel) w182_sound w86_sound w17_sound) (by decide +kernel) +lemma A2_6_8Raw_2_6_0 : (A2_6_8Raw (shape 2 6 0)).Encloses (splitWeight positiveInitial tableP (shape 2 6 8) (shape 2 6 0) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 2 6 8) (shape 2 6 0) + (-3517) (-42976) (-107049) w182 w41 w2 + (by decide +kernel) w182_sound w41_sound w2_sound) (by decide +kernel) +lemma A2_6_8Raw_sound (u : Shape) (hu : u ∈ below (shape 2 6 8)) : + (A2_6_8Raw u).Encloses (splitWeight positiveInitial tableP (shape 2 6 8) u : ℝ) := by + rw [A2_6_8_below] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl + · exact A2_6_8Raw_0_0_8 + · exact A2_6_8Raw_0_1_7 + · exact A2_6_8Raw_0_2_6 + · exact A2_6_8Raw_0_3_5 + · exact A2_6_8Raw_0_4_4 + · exact A2_6_8Raw_0_5_3 + · exact A2_6_8Raw_0_6_2 + · exact A2_6_8Raw_1_0_7 + · exact A2_6_8Raw_1_1_6 + · exact A2_6_8Raw_1_2_5 + · exact A2_6_8Raw_1_3_4 + · exact A2_6_8Raw_1_4_3 + · exact A2_6_8Raw_1_5_2 + · exact A2_6_8Raw_1_6_1 + · exact A2_6_8Raw_2_0_6 + · exact A2_6_8Raw_2_1_5 + · exact A2_6_8Raw_2_2_4 + · exact A2_6_8Raw_2_3_3 + · exact A2_6_8Raw_2_4_2 + · exact A2_6_8Raw_2_5_1 + · exact A2_6_8Raw_2_6_0 +def A2_6_8Den : Ball := ⟨(73683614726356645052910002223033 / 25000000000000000000000000000000), (263 / 50000000000000000000000000000000)⟩ +lemma A2_6_8Den_sound : A2_6_8Den.Encloses (((below (shape 2 6 8)).map (splitWeight positiveInitial tableP (shape 2 6 8))).sum : ℝ) := by + exact contains_sound (list_cast_enclosed (below (shape 2 6 8)) A2_6_8Raw (splitWeight positiveInitial tableP (shape 2 6 8)) A2_6_8Raw_sound) (by decide +kernel) +lemma A2_6_8Den_positive : 0 < A2_6_8Den.lower := by decide +kernel +def A2_6_8Table (s : Shape) : Ball := + match s 0, s 1, s 2 with + | 0, 0, 8 => ⟨(7283242185896305552952829 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 0, 1, 7 => ⟨(5651499110692180694905247591 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 0, 2, 6 => ⟨(642791775701372526766325518709 / 100000000000000000000000000000000), (1 / 20000000000000000000000000000000)⟩ + | 0, 3, 5 => ⟨(9021093526912582843203331566559 / 100000000000000000000000000000000), (41 / 100000000000000000000000000000000)⟩ + | 0, 4, 4 => ⟨(14287221842052441515014217084377 / 100000000000000000000000000000000), (61 / 100000000000000000000000000000000)⟩ + | 0, 5, 3 => ⟨(29670146892799120299239106787 / 2500000000000000000000000000000), (1 / 12500000000000000000000000000000)⟩ + | 0, 6, 2 => ⟨(182572888731864977572933803 / 1250000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 1, 0, 7 => ⟨(830540022111175778026502387 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 1, 1, 6 => ⟨(200822380702981496437118097259 / 100000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ + | 1, 2, 5 => ⟨(1918936639817210417915987511527 / 25000000000000000000000000000000), (7 / 20000000000000000000000000000000)⟩ + | 1, 3, 4 => ⟨(33928845772352553367922348016919 / 100000000000000000000000000000000), (61 / 100000000000000000000000000000000)⟩ + | 1, 4, 3 => ⟨(1918936639817210417915987511527 / 25000000000000000000000000000000), (7 / 20000000000000000000000000000000)⟩ + | 1, 5, 2 => ⟨(200822380702981496437118097259 / 100000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ + | 1, 6, 1 => ⟨(830540022111175778026502387 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 2, 0, 6 => ⟨(182572888731864977572933803 / 1250000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 2, 1, 5 => ⟨(29670146892799120299239106787 / 2500000000000000000000000000000), (1 / 12500000000000000000000000000000)⟩ + | 2, 2, 4 => ⟨(14287221842052441515014217084377 / 100000000000000000000000000000000), (61 / 100000000000000000000000000000000)⟩ + | 2, 3, 3 => ⟨(9021093526912582843203331566559 / 100000000000000000000000000000000), (41 / 100000000000000000000000000000000)⟩ + | 2, 4, 2 => ⟨(642791775701372526766325518709 / 100000000000000000000000000000000), (1 / 20000000000000000000000000000000)⟩ + | 2, 5, 1 => ⟨(5651499110692180694905247591 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 2, 6, 0 => ⟨(7283242185896305552952829 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | _, _, _ => (.exact 0) +def A2_6_8Law (u : Shape) : Ball := if u ∈ below (shape 2 6 8) then A2_6_8Table u else .exact 0 +lemma A2_6_8Law_check_0_0_8 : contains (.mul (A2_6_8Raw (shape 0 0 8)) (.inv A2_6_8Den)) (A2_6_8Table (shape 0 0 8)) = true := by decide +kernel +lemma A2_6_8Law_check_0_1_7 : contains (.mul (A2_6_8Raw (shape 0 1 7)) (.inv A2_6_8Den)) (A2_6_8Table (shape 0 1 7)) = true := by decide +kernel +lemma A2_6_8Law_check_0_2_6 : contains (.mul (A2_6_8Raw (shape 0 2 6)) (.inv A2_6_8Den)) (A2_6_8Table (shape 0 2 6)) = true := by decide +kernel +lemma A2_6_8Law_check_0_3_5 : contains (.mul (A2_6_8Raw (shape 0 3 5)) (.inv A2_6_8Den)) (A2_6_8Table (shape 0 3 5)) = true := by decide +kernel +lemma A2_6_8Law_check_0_4_4 : contains (.mul (A2_6_8Raw (shape 0 4 4)) (.inv A2_6_8Den)) (A2_6_8Table (shape 0 4 4)) = true := by decide +kernel +lemma A2_6_8Law_check_0_5_3 : contains (.mul (A2_6_8Raw (shape 0 5 3)) (.inv A2_6_8Den)) (A2_6_8Table (shape 0 5 3)) = true := by decide +kernel +lemma A2_6_8Law_check_0_6_2 : contains (.mul (A2_6_8Raw (shape 0 6 2)) (.inv A2_6_8Den)) (A2_6_8Table (shape 0 6 2)) = true := by decide +kernel +lemma A2_6_8Law_check_1_0_7 : contains (.mul (A2_6_8Raw (shape 1 0 7)) (.inv A2_6_8Den)) (A2_6_8Table (shape 1 0 7)) = true := by decide +kernel +lemma A2_6_8Law_check_1_1_6 : contains (.mul (A2_6_8Raw (shape 1 1 6)) (.inv A2_6_8Den)) (A2_6_8Table (shape 1 1 6)) = true := by decide +kernel +lemma A2_6_8Law_check_1_2_5 : contains (.mul (A2_6_8Raw (shape 1 2 5)) (.inv A2_6_8Den)) (A2_6_8Table (shape 1 2 5)) = true := by decide +kernel +lemma A2_6_8Law_check_1_3_4 : contains (.mul (A2_6_8Raw (shape 1 3 4)) (.inv A2_6_8Den)) (A2_6_8Table (shape 1 3 4)) = true := by decide +kernel +lemma A2_6_8Law_check_1_4_3 : contains (.mul (A2_6_8Raw (shape 1 4 3)) (.inv A2_6_8Den)) (A2_6_8Table (shape 1 4 3)) = true := by decide +kernel +lemma A2_6_8Law_check_1_5_2 : contains (.mul (A2_6_8Raw (shape 1 5 2)) (.inv A2_6_8Den)) (A2_6_8Table (shape 1 5 2)) = true := by decide +kernel +lemma A2_6_8Law_check_1_6_1 : contains (.mul (A2_6_8Raw (shape 1 6 1)) (.inv A2_6_8Den)) (A2_6_8Table (shape 1 6 1)) = true := by decide +kernel +lemma A2_6_8Law_check_2_0_6 : contains (.mul (A2_6_8Raw (shape 2 0 6)) (.inv A2_6_8Den)) (A2_6_8Table (shape 2 0 6)) = true := by decide +kernel +lemma A2_6_8Law_check_2_1_5 : contains (.mul (A2_6_8Raw (shape 2 1 5)) (.inv A2_6_8Den)) (A2_6_8Table (shape 2 1 5)) = true := by decide +kernel +lemma A2_6_8Law_check_2_2_4 : contains (.mul (A2_6_8Raw (shape 2 2 4)) (.inv A2_6_8Den)) (A2_6_8Table (shape 2 2 4)) = true := by decide +kernel +lemma A2_6_8Law_check_2_3_3 : contains (.mul (A2_6_8Raw (shape 2 3 3)) (.inv A2_6_8Den)) (A2_6_8Table (shape 2 3 3)) = true := by decide +kernel +lemma A2_6_8Law_check_2_4_2 : contains (.mul (A2_6_8Raw (shape 2 4 2)) (.inv A2_6_8Den)) (A2_6_8Table (shape 2 4 2)) = true := by decide +kernel +lemma A2_6_8Law_check_2_5_1 : contains (.mul (A2_6_8Raw (shape 2 5 1)) (.inv A2_6_8Den)) (A2_6_8Table (shape 2 5 1)) = true := by decide +kernel +lemma A2_6_8Law_check_2_6_0 : contains (.mul (A2_6_8Raw (shape 2 6 0)) (.inv A2_6_8Den)) (A2_6_8Table (shape 2 6 0)) = true := by decide +kernel +lemma A2_6_8Law_check (u : Shape) (hu : u ∈ below (shape 2 6 8)) : + contains (.mul (A2_6_8Raw u) (.inv A2_6_8Den)) (A2_6_8Table u) = true := by + rw [A2_6_8_below] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl + · exact A2_6_8Law_check_0_0_8 + · exact A2_6_8Law_check_0_1_7 + · exact A2_6_8Law_check_0_2_6 + · exact A2_6_8Law_check_0_3_5 + · exact A2_6_8Law_check_0_4_4 + · exact A2_6_8Law_check_0_5_3 + · exact A2_6_8Law_check_0_6_2 + · exact A2_6_8Law_check_1_0_7 + · exact A2_6_8Law_check_1_1_6 + · exact A2_6_8Law_check_1_2_5 + · exact A2_6_8Law_check_1_3_4 + · exact A2_6_8Law_check_1_4_3 + · exact A2_6_8Law_check_1_5_2 + · exact A2_6_8Law_check_1_6_1 + · exact A2_6_8Law_check_2_0_6 + · exact A2_6_8Law_check_2_1_5 + · exact A2_6_8Law_check_2_2_4 + · exact A2_6_8Law_check_2_3_3 + · exact A2_6_8Law_check_2_4_2 + · exact A2_6_8Law_check_2_5_1 + · exact A2_6_8Law_check_2_6_0 +lemma A2_6_8Law_sound (u : Shape) : + (A2_6_8Law u).Encloses (stageALaw (shape 2 6 8) u : ℝ) := by + by_cases hu : u ∈ below (shape 2 6 8) + · have h := contains_sound (Ball.mul_sound (A2_6_8Raw_sound u hu) + (Ball.inv_sound A2_6_8Den_sound A2_6_8Den_positive)) (A2_6_8Law_check u hu) + simpa only [A2_6_8Law, hu, ite_true, stageALaw, splitLaw, + Rat.cast_div, Rat.cast_mul, Rat.cast_inv, div_eq_mul_inv] using h + · simp only [A2_6_8Law, hu, ite_false, stageALaw, splitLaw, Rat.cast_zero] + simpa only [Rat.cast_zero] using Ball.exact_sound 0 + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/Certificates/SplitA2_7_7.lean b/lean/OAI/LinearAlgebra/MatrixFields/Certificates/SplitA2_7_7.lean new file mode 100644 index 0000000000000000000000000000000000000000..10e29e750d7484d96bc32f506ba8ae8bf4b33765 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/Certificates/SplitA2_7_7.lean @@ -0,0 +1,275 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Certificates.SplitB1_3_4 + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate +open scoped BigOperators +lemma A2_7_7_below : below (shape 2 7 7) = [ + (shape 0 1 7), + (shape 0 2 6), + (shape 0 3 5), + (shape 0 4 4), + (shape 0 5 3), + (shape 0 6 2), + (shape 0 7 1), + (shape 1 0 7), + (shape 1 1 6), + (shape 1 2 5), + (shape 1 3 4), + (shape 1 4 3), + (shape 1 5 2), + (shape 1 6 1), + (shape 1 7 0), + (shape 2 0 6), + (shape 2 1 5), + (shape 2 2 4), + (shape 2 3 3), + (shape 2 4 2), + (shape 2 5 1), + (shape 2 6 0)] := by decide +kernel +def A2_7_7Raw (s : Shape) : Ball := + match s 0, s 1, s 2 with + | 0, 1, 7 => ⟨(997980326700703990907442669 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 0, 2, 6 => ⟨(110767244555364068131295527073 / 25000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ + | 0, 3, 5 => ⟨(17036705883006141337553720298693 / 100000000000000000000000000000000), (43 / 100000000000000000000000000000000)⟩ + | 0, 4, 4 => ⟨(69038904979943881194700567488221 / 100000000000000000000000000000000), (87 / 100000000000000000000000000000000)⟩ + | 0, 5, 3 => ⟨(17481972130738693443717668197977 / 100000000000000000000000000000000), (11 / 25000000000000000000000000000000)⟩ + | 0, 6, 2 => ⟨(60056388144364868734784399473 / 12500000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ + | 0, 7, 1 => ⟨(2064990167644092904399448839 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 1, 0, 7 => ⟨(756166967065100758247607 / 625000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 1, 1, 6 => ⟨(71473408038032577228923343497 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 1, 2, 5 => ⟨(3124339826741735799459034189257 / 50000000000000000000000000000000), (1 / 6250000000000000000000000000000)⟩ + | 1, 3, 4 => ⟨1, 0⟩ + | 1, 4, 3 => ⟨1, 0⟩ + | 1, 5, 2 => ⟨(3124339826741735799459034189257 / 50000000000000000000000000000000), (1 / 6250000000000000000000000000000)⟩ + | 1, 6, 1 => ⟨(71473408038032577228923343497 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 1, 7, 0 => ⟨(756166967065100758247607 / 625000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 2, 0, 6 => ⟨(2064990167644092904399448839 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 2, 1, 5 => ⟨(60056388144364868734784399473 / 12500000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ + | 2, 2, 4 => ⟨(17481972130738693443717668197977 / 100000000000000000000000000000000), (11 / 25000000000000000000000000000000)⟩ + | 2, 3, 3 => ⟨(69038904979943881194700567488221 / 100000000000000000000000000000000), (87 / 100000000000000000000000000000000)⟩ + | 2, 4, 2 => ⟨(17036705883006141337553720298693 / 100000000000000000000000000000000), (43 / 100000000000000000000000000000000)⟩ + | 2, 5, 1 => ⟨(110767244555364068131295527073 / 25000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ + | 2, 6, 0 => ⟨(997980326700703990907442669 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | _, _, _ => (.exact 0) +lemma A2_7_7Raw_0_1_7 : (A2_7_7Raw (shape 0 1 7)).Encloses (splitWeight positiveInitial tableP (shape 2 7 7) (shape 0 1 7) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 2 7 7) (shape 0 1 7) + (-3705) (-35684) (-68829) w179 w52 w13 + (by decide +kernel) w179_sound w52_sound w13_sound) (by decide +kernel) +lemma A2_7_7Raw_0_2_6 : (A2_7_7Raw (shape 0 2 6)).Encloses (splitWeight positiveInitial tableP (shape 2 7 7) (shape 0 2 6) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 2 7 7) (shape 0 2 6) + (-3705) (-13735) (-36752) w179 w119 w48 + (by decide +kernel) w179_sound w119_sound w48_sound) (by decide +kernel) +lemma A2_7_7Raw_0_3_5 : (A2_7_7Raw (shape 0 3 5)).Encloses (splitWeight positiveInitial tableP (shape 2 7 7) (shape 0 3 5) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 2 7 7) (shape 0 3 5) + (-3705) (0) (-13993) w179 w195 w118 + (by decide +kernel) w179_sound w195_sound w118_sound) (by decide +kernel) +lemma A2_7_7Raw_0_4_4 : (A2_7_7Raw (shape 0 4 4)).Encloses (splitWeight positiveInitial tableP (shape 2 7 7) (shape 0 4 4) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 2 7 7) (shape 0 4 4) + (-3705) (0) (0) w179 w195 w195 + (by decide +kernel) w179_sound w195_sound w195_sound) (by decide +kernel) +lemma A2_7_7Raw_0_5_3 : (A2_7_7Raw (shape 0 5 3)).Encloses (splitWeight positiveInitial tableP (shape 2 7 7) (shape 0 5 3) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 2 7 7) (shape 0 5 3) + (-3705) (-13735) (0) w179 w119 w195 + (by decide +kernel) w179_sound w119_sound w195_sound) (by decide +kernel) +lemma A2_7_7Raw_0_6_2 : (A2_7_7Raw (shape 0 6 2)).Encloses (splitWeight positiveInitial tableP (shape 2 7 7) (shape 0 6 2) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 2 7 7) (shape 0 6 2) + (-3705) (-35684) (-13993) w179 w52 w118 + (by decide +kernel) w179_sound w52_sound w118_sound) (by decide +kernel) +lemma A2_7_7Raw_0_7_1 : (A2_7_7Raw (shape 0 7 1)).Encloses (splitWeight positiveInitial tableP (shape 2 7 7) (shape 0 7 1) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 2 7 7) (shape 0 7 1) + (-3705) (-67421) (-36752) w179 w15 w48 + (by decide +kernel) w179_sound w15_sound w48_sound) (by decide +kernel) +lemma A2_7_7Raw_1_0_7 : (A2_7_7Raw (shape 1 0 7)).Encloses (splitWeight positiveInitial tableP (shape 2 7 7) (shape 1 0 7) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 2 7 7) (shape 1 0 7) + (0) (-67421) (-68829) w195 w15 w13 + (by decide +kernel) w195_sound w15_sound w13_sound) (by decide +kernel) +lemma A2_7_7Raw_1_1_6 : (A2_7_7Raw (shape 1 1 6)).Encloses (splitWeight positiveInitial tableP (shape 2 7 7) (shape 1 1 6) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 2 7 7) (shape 1 1 6) + (0) (-35684) (-36752) w195 w52 w48 + (by decide +kernel) w195_sound w52_sound w48_sound) (by decide +kernel) +lemma A2_7_7Raw_1_2_5 : (A2_7_7Raw (shape 1 2 5)).Encloses (splitWeight positiveInitial tableP (shape 2 7 7) (shape 1 2 5) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 2 7 7) (shape 1 2 5) + (0) (-13735) (-13993) w195 w119 w118 + (by decide +kernel) w195_sound w119_sound w118_sound) (by decide +kernel) +lemma A2_7_7Raw_1_3_4 : (A2_7_7Raw (shape 1 3 4)).Encloses (splitWeight positiveInitial tableP (shape 2 7 7) (shape 1 3 4) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 2 7 7) (shape 1 3 4) + (0) (0) (0) w195 w195 w195 + (by decide +kernel) w195_sound w195_sound w195_sound) (by decide +kernel) +lemma A2_7_7Raw_1_4_3 : (A2_7_7Raw (shape 1 4 3)).Encloses (splitWeight positiveInitial tableP (shape 2 7 7) (shape 1 4 3) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 2 7 7) (shape 1 4 3) + (0) (0) (0) w195 w195 w195 + (by decide +kernel) w195_sound w195_sound w195_sound) (by decide +kernel) +lemma A2_7_7Raw_1_5_2 : (A2_7_7Raw (shape 1 5 2)).Encloses (splitWeight positiveInitial tableP (shape 2 7 7) (shape 1 5 2) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 2 7 7) (shape 1 5 2) + (0) (-13735) (-13993) w195 w119 w118 + (by decide +kernel) w195_sound w119_sound w118_sound) (by decide +kernel) +lemma A2_7_7Raw_1_6_1 : (A2_7_7Raw (shape 1 6 1)).Encloses (splitWeight positiveInitial tableP (shape 2 7 7) (shape 1 6 1) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 2 7 7) (shape 1 6 1) + (0) (-35684) (-36752) w195 w52 w48 + (by decide +kernel) w195_sound w52_sound w48_sound) (by decide +kernel) +lemma A2_7_7Raw_1_7_0 : (A2_7_7Raw (shape 1 7 0)).Encloses (splitWeight positiveInitial tableP (shape 2 7 7) (shape 1 7 0) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 2 7 7) (shape 1 7 0) + (0) (-67421) (-68829) w195 w15 w13 + (by decide +kernel) w195_sound w15_sound w13_sound) (by decide +kernel) +lemma A2_7_7Raw_2_0_6 : (A2_7_7Raw (shape 2 0 6)).Encloses (splitWeight positiveInitial tableP (shape 2 7 7) (shape 2 0 6) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 2 7 7) (shape 2 0 6) + (-3705) (-67421) (-36752) w179 w15 w48 + (by decide +kernel) w179_sound w15_sound w48_sound) (by decide +kernel) +lemma A2_7_7Raw_2_1_5 : (A2_7_7Raw (shape 2 1 5)).Encloses (splitWeight positiveInitial tableP (shape 2 7 7) (shape 2 1 5) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 2 7 7) (shape 2 1 5) + (-3705) (-35684) (-13993) w179 w52 w118 + (by decide +kernel) w179_sound w52_sound w118_sound) (by decide +kernel) +lemma A2_7_7Raw_2_2_4 : (A2_7_7Raw (shape 2 2 4)).Encloses (splitWeight positiveInitial tableP (shape 2 7 7) (shape 2 2 4) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 2 7 7) (shape 2 2 4) + (-3705) (-13735) (0) w179 w119 w195 + (by decide +kernel) w179_sound w119_sound w195_sound) (by decide +kernel) +lemma A2_7_7Raw_2_3_3 : (A2_7_7Raw (shape 2 3 3)).Encloses (splitWeight positiveInitial tableP (shape 2 7 7) (shape 2 3 3) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 2 7 7) (shape 2 3 3) + (-3705) (0) (0) w179 w195 w195 + (by decide +kernel) w179_sound w195_sound w195_sound) (by decide +kernel) +lemma A2_7_7Raw_2_4_2 : (A2_7_7Raw (shape 2 4 2)).Encloses (splitWeight positiveInitial tableP (shape 2 7 7) (shape 2 4 2) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 2 7 7) (shape 2 4 2) + (-3705) (0) (-13993) w179 w195 w118 + (by decide +kernel) w179_sound w195_sound w118_sound) (by decide +kernel) +lemma A2_7_7Raw_2_5_1 : (A2_7_7Raw (shape 2 5 1)).Encloses (splitWeight positiveInitial tableP (shape 2 7 7) (shape 2 5 1) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 2 7 7) (shape 2 5 1) + (-3705) (-13735) (-36752) w179 w119 w48 + (by decide +kernel) w179_sound w119_sound w48_sound) (by decide +kernel) +lemma A2_7_7Raw_2_6_0 : (A2_7_7Raw (shape 2 6 0)).Encloses (splitWeight positiveInitial tableP (shape 2 7 7) (shape 2 6 0) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 2 7 7) (shape 2 6 0) + (-3705) (-35684) (-68829) w179 w52 w13 + (by decide +kernel) w179_sound w52_sound w13_sound) (by decide +kernel) +lemma A2_7_7Raw_sound (u : Shape) (hu : u ∈ below (shape 2 7 7)) : + (A2_7_7Raw u).Encloses (splitWeight positiveInitial tableP (shape 2 7 7) u : ℝ) := by + rw [A2_7_7_below] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl + · exact A2_7_7Raw_0_1_7 + · exact A2_7_7Raw_0_2_6 + · exact A2_7_7Raw_0_3_5 + · exact A2_7_7Raw_0_4_4 + · exact A2_7_7Raw_0_5_3 + · exact A2_7_7Raw_0_6_2 + · exact A2_7_7Raw_0_7_1 + · exact A2_7_7Raw_1_0_7 + · exact A2_7_7Raw_1_1_6 + · exact A2_7_7Raw_1_2_5 + · exact A2_7_7Raw_1_3_4 + · exact A2_7_7Raw_1_4_3 + · exact A2_7_7Raw_1_5_2 + · exact A2_7_7Raw_1_6_1 + · exact A2_7_7Raw_1_7_0 + · exact A2_7_7Raw_2_0_6 + · exact A2_7_7Raw_2_1_5 + · exact A2_7_7Raw_2_2_4 + · exact A2_7_7Raw_2_3_3 + · exact A2_7_7Raw_2_4_2 + · exact A2_7_7Raw_2_5_1 + · exact A2_7_7Raw_2_6_0 +def A2_7_7Den : Ball := ⟨(8432217523044894851661197558491 / 2000000000000000000000000000000), (199 / 50000000000000000000000000000000)⟩ +lemma A2_7_7Den_sound : A2_7_7Den.Encloses (((below (shape 2 7 7)).map (splitWeight positiveInitial tableP (shape 2 7 7))).sum : ℝ) := by + exact contains_sound (list_cast_enclosed (below (shape 2 7 7)) A2_7_7Raw (splitWeight positiveInitial tableP (shape 2 7 7)) A2_7_7Raw_sound) (by decide +kernel) +lemma A2_7_7Den_positive : 0 < A2_7_7Den.lower := by decide +kernel +def A2_7_7Table (s : Shape) : Ball := + match s 0, s 1, s 2 with + | 0, 1, 7 => ⟨(236706494815454143359971229 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 0, 2, 6 => ⟨(6568096959823549410460354727 / 6250000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ + | 0, 3, 5 => ⟨(4040860150119596109248067465019 / 100000000000000000000000000000000), (3 / 20000000000000000000000000000000)⟩ + | 0, 4, 4 => ⟨(4093757353345277543101032118639 / 25000000000000000000000000000000), (37 / 100000000000000000000000000000000)⟩ + | 0, 5, 3 => ⟨(2073235431007466414784974589209 / 50000000000000000000000000000000), (3 / 20000000000000000000000000000000)⟩ + | 0, 6, 2 => ⟨(113956051024980402388261306291 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 0, 7, 1 => ⟨(61223223962159475536795967 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 1, 0, 7 => ⟨(28696298310560545365494143 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 1, 1, 6 => ⟨(8476229158308448226948659597 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 1, 2, 5 => ⟨(1482096408544038066251740184659 / 100000000000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ + | 1, 3, 4 => ⟨(23718553210161909988480210591893 / 100000000000000000000000000000000), (23 / 100000000000000000000000000000000)⟩ + | 1, 4, 3 => ⟨(23718553210161909988480210591893 / 100000000000000000000000000000000), (23 / 100000000000000000000000000000000)⟩ + | 1, 5, 2 => ⟨(1482096408544038066251740184659 / 100000000000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ + | 1, 6, 1 => ⟨(8476229158308448226948659597 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 1, 7, 0 => ⟨(28696298310560545365494143 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 2, 0, 6 => ⟨(61223223962159475536795967 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 2, 1, 5 => ⟨(113956051024980402388261306291 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 2, 2, 4 => ⟨(2073235431007466414784974589209 / 50000000000000000000000000000000), (3 / 20000000000000000000000000000000)⟩ + | 2, 3, 3 => ⟨(4093757353345277543101032118639 / 25000000000000000000000000000000), (37 / 100000000000000000000000000000000)⟩ + | 2, 4, 2 => ⟨(4040860150119596109248067465019 / 100000000000000000000000000000000), (3 / 20000000000000000000000000000000)⟩ + | 2, 5, 1 => ⟨(6568096959823549410460354727 / 6250000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ + | 2, 6, 0 => ⟨(236706494815454143359971229 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | _, _, _ => (.exact 0) +def A2_7_7Law (u : Shape) : Ball := if u ∈ below (shape 2 7 7) then A2_7_7Table u else .exact 0 +lemma A2_7_7Law_check_0_1_7 : contains (.mul (A2_7_7Raw (shape 0 1 7)) (.inv A2_7_7Den)) (A2_7_7Table (shape 0 1 7)) = true := by decide +kernel +lemma A2_7_7Law_check_0_2_6 : contains (.mul (A2_7_7Raw (shape 0 2 6)) (.inv A2_7_7Den)) (A2_7_7Table (shape 0 2 6)) = true := by decide +kernel +lemma A2_7_7Law_check_0_3_5 : contains (.mul (A2_7_7Raw (shape 0 3 5)) (.inv A2_7_7Den)) (A2_7_7Table (shape 0 3 5)) = true := by decide +kernel +lemma A2_7_7Law_check_0_4_4 : contains (.mul (A2_7_7Raw (shape 0 4 4)) (.inv A2_7_7Den)) (A2_7_7Table (shape 0 4 4)) = true := by decide +kernel +lemma A2_7_7Law_check_0_5_3 : contains (.mul (A2_7_7Raw (shape 0 5 3)) (.inv A2_7_7Den)) (A2_7_7Table (shape 0 5 3)) = true := by decide +kernel +lemma A2_7_7Law_check_0_6_2 : contains (.mul (A2_7_7Raw (shape 0 6 2)) (.inv A2_7_7Den)) (A2_7_7Table (shape 0 6 2)) = true := by decide +kernel +lemma A2_7_7Law_check_0_7_1 : contains (.mul (A2_7_7Raw (shape 0 7 1)) (.inv A2_7_7Den)) (A2_7_7Table (shape 0 7 1)) = true := by decide +kernel +lemma A2_7_7Law_check_1_0_7 : contains (.mul (A2_7_7Raw (shape 1 0 7)) (.inv A2_7_7Den)) (A2_7_7Table (shape 1 0 7)) = true := by decide +kernel +lemma A2_7_7Law_check_1_1_6 : contains (.mul (A2_7_7Raw (shape 1 1 6)) (.inv A2_7_7Den)) (A2_7_7Table (shape 1 1 6)) = true := by decide +kernel +lemma A2_7_7Law_check_1_2_5 : contains (.mul (A2_7_7Raw (shape 1 2 5)) (.inv A2_7_7Den)) (A2_7_7Table (shape 1 2 5)) = true := by decide +kernel +lemma A2_7_7Law_check_1_3_4 : contains (.mul (A2_7_7Raw (shape 1 3 4)) (.inv A2_7_7Den)) (A2_7_7Table (shape 1 3 4)) = true := by decide +kernel +lemma A2_7_7Law_check_1_4_3 : contains (.mul (A2_7_7Raw (shape 1 4 3)) (.inv A2_7_7Den)) (A2_7_7Table (shape 1 4 3)) = true := by decide +kernel +lemma A2_7_7Law_check_1_5_2 : contains (.mul (A2_7_7Raw (shape 1 5 2)) (.inv A2_7_7Den)) (A2_7_7Table (shape 1 5 2)) = true := by decide +kernel +lemma A2_7_7Law_check_1_6_1 : contains (.mul (A2_7_7Raw (shape 1 6 1)) (.inv A2_7_7Den)) (A2_7_7Table (shape 1 6 1)) = true := by decide +kernel +lemma A2_7_7Law_check_1_7_0 : contains (.mul (A2_7_7Raw (shape 1 7 0)) (.inv A2_7_7Den)) (A2_7_7Table (shape 1 7 0)) = true := by decide +kernel +lemma A2_7_7Law_check_2_0_6 : contains (.mul (A2_7_7Raw (shape 2 0 6)) (.inv A2_7_7Den)) (A2_7_7Table (shape 2 0 6)) = true := by decide +kernel +lemma A2_7_7Law_check_2_1_5 : contains (.mul (A2_7_7Raw (shape 2 1 5)) (.inv A2_7_7Den)) (A2_7_7Table (shape 2 1 5)) = true := by decide +kernel +lemma A2_7_7Law_check_2_2_4 : contains (.mul (A2_7_7Raw (shape 2 2 4)) (.inv A2_7_7Den)) (A2_7_7Table (shape 2 2 4)) = true := by decide +kernel +lemma A2_7_7Law_check_2_3_3 : contains (.mul (A2_7_7Raw (shape 2 3 3)) (.inv A2_7_7Den)) (A2_7_7Table (shape 2 3 3)) = true := by decide +kernel +lemma A2_7_7Law_check_2_4_2 : contains (.mul (A2_7_7Raw (shape 2 4 2)) (.inv A2_7_7Den)) (A2_7_7Table (shape 2 4 2)) = true := by decide +kernel +lemma A2_7_7Law_check_2_5_1 : contains (.mul (A2_7_7Raw (shape 2 5 1)) (.inv A2_7_7Den)) (A2_7_7Table (shape 2 5 1)) = true := by decide +kernel +lemma A2_7_7Law_check_2_6_0 : contains (.mul (A2_7_7Raw (shape 2 6 0)) (.inv A2_7_7Den)) (A2_7_7Table (shape 2 6 0)) = true := by decide +kernel +lemma A2_7_7Law_check (u : Shape) (hu : u ∈ below (shape 2 7 7)) : + contains (.mul (A2_7_7Raw u) (.inv A2_7_7Den)) (A2_7_7Table u) = true := by + rw [A2_7_7_below] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl + · exact A2_7_7Law_check_0_1_7 + · exact A2_7_7Law_check_0_2_6 + · exact A2_7_7Law_check_0_3_5 + · exact A2_7_7Law_check_0_4_4 + · exact A2_7_7Law_check_0_5_3 + · exact A2_7_7Law_check_0_6_2 + · exact A2_7_7Law_check_0_7_1 + · exact A2_7_7Law_check_1_0_7 + · exact A2_7_7Law_check_1_1_6 + · exact A2_7_7Law_check_1_2_5 + · exact A2_7_7Law_check_1_3_4 + · exact A2_7_7Law_check_1_4_3 + · exact A2_7_7Law_check_1_5_2 + · exact A2_7_7Law_check_1_6_1 + · exact A2_7_7Law_check_1_7_0 + · exact A2_7_7Law_check_2_0_6 + · exact A2_7_7Law_check_2_1_5 + · exact A2_7_7Law_check_2_2_4 + · exact A2_7_7Law_check_2_3_3 + · exact A2_7_7Law_check_2_4_2 + · exact A2_7_7Law_check_2_5_1 + · exact A2_7_7Law_check_2_6_0 +lemma A2_7_7Law_sound (u : Shape) : + (A2_7_7Law u).Encloses (stageALaw (shape 2 7 7) u : ℝ) := by + by_cases hu : u ∈ below (shape 2 7 7) + · have h := contains_sound (Ball.mul_sound (A2_7_7Raw_sound u hu) + (Ball.inv_sound A2_7_7Den_sound A2_7_7Den_positive)) (A2_7_7Law_check u hu) + simpa only [A2_7_7Law, hu, ite_true, stageALaw, splitLaw, + Rat.cast_div, Rat.cast_mul, Rat.cast_inv, div_eq_mul_inv] using h + · simp only [A2_7_7Law, hu, ite_false, stageALaw, splitLaw, Rat.cast_zero] + simpa only [Rat.cast_zero] using Ball.exact_sound 0 + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/Certificates/SplitA3_3_10.lean b/lean/OAI/LinearAlgebra/MatrixFields/Certificates/SplitA3_3_10.lean new file mode 100644 index 0000000000000000000000000000000000000000..74fc80de9bd6b01071ef651d451096de3c4c073c --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/Certificates/SplitA3_3_10.lean @@ -0,0 +1,215 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Certificates.SplitB1_3_4 + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate +open scoped BigOperators +lemma A3_3_10_below : below (shape 3 3 10) = [ + (shape 0 0 8), + (shape 0 1 7), + (shape 0 2 6), + (shape 0 3 5), + (shape 1 0 7), + (shape 1 1 6), + (shape 1 2 5), + (shape 1 3 4), + (shape 2 0 6), + (shape 2 1 5), + (shape 2 2 4), + (shape 2 3 3), + (shape 3 0 5), + (shape 3 1 4), + (shape 3 2 3), + (shape 3 3 2)] := by decide +kernel +def A3_3_10Raw (s : Shape) : Ball := + match s 0, s 1, s 2 with + | 0, 0, 8 => ⟨(10114049177547547375147291033 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 0, 1, 7 => ⟨(1631941133917831872522312559669 / 100000000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ + | 0, 2, 6 => ⟨(22342041798333750043260090322813 / 100000000000000000000000000000000), (27 / 50000000000000000000000000000000)⟩ + | 0, 3, 5 => ⟨(21775166867897778509284039754867 / 100000000000000000000000000000000), (53 / 100000000000000000000000000000000)⟩ + | 1, 0, 7 => ⟨(328746702339804911134262473157 / 20000000000000000000000000000000), (1 / 20000000000000000000000000000000)⟩ + | 1, 1, 6 => ⟨(48051347848878380719513662951177 / 100000000000000000000000000000000), (31 / 50000000000000000000000000000000)⟩ + | 1, 2, 5 => ⟨1, 0⟩ + | 1, 3, 4 => ⟨(22503484997364245598597737532479 / 100000000000000000000000000000000), (59 / 100000000000000000000000000000000)⟩ + | 2, 0, 6 => ⟨(22503484997364245598597737532479 / 100000000000000000000000000000000), (59 / 100000000000000000000000000000000)⟩ + | 2, 1, 5 => ⟨1, 0⟩ + | 2, 2, 4 => ⟨(48051347848878380719513662951177 / 100000000000000000000000000000000), (31 / 50000000000000000000000000000000)⟩ + | 2, 3, 3 => ⟨(328746702339804911134262473157 / 20000000000000000000000000000000), (1 / 20000000000000000000000000000000)⟩ + | 3, 0, 5 => ⟨(21775166867897778509284039754867 / 100000000000000000000000000000000), (53 / 100000000000000000000000000000000)⟩ + | 3, 1, 4 => ⟨(22342041798333750043260090322813 / 100000000000000000000000000000000), (27 / 50000000000000000000000000000000)⟩ + | 3, 2, 3 => ⟨(1631941133917831872522312559669 / 100000000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ + | 3, 3, 2 => ⟨(10114049177547547375147291033 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | _, _, _ => (.exact 0) +lemma A3_3_10Raw_0_0_8 : (A3_3_10Raw (shape 0 0 8)).Encloses (splitWeight positiveInitial tableP (shape 3 3 10) (shape 0 0 8) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 3 3 10) (shape 0 0 8) + (-7658) (-7586) (-76746) w140 w141 w9 + (by decide +kernel) w140_sound w141_sound w9_sound) (by decide +kernel) +lemma A3_3_10Raw_0_1_7 : (A3_3_10Raw (shape 0 1 7)).Encloses (splitWeight positiveInitial tableP (shape 3 3 10) (shape 0 1 7) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 3 3 10) (shape 0 1 7) + (-7658) (0) (-33496) w140 w195 w56 + (by decide +kernel) w140_sound w195_sound w56_sound) (by decide +kernel) +lemma A3_3_10Raw_0_2_6 : (A3_3_10Raw (shape 0 2 6)).Encloses (splitWeight positiveInitial tableP (shape 3 3 10) (shape 0 2 6) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 3 3 10) (shape 0 2 6) + (-7658) (0) (-7329) w140 w195 w145 + (by decide +kernel) w140_sound w195_sound w145_sound) (by decide +kernel) +lemma A3_3_10Raw_0_3_5 : (A3_3_10Raw (shape 0 3 5)).Encloses (splitWeight positiveInitial tableP (shape 3 3 10) (shape 0 3 5) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 3 3 10) (shape 0 3 5) + (-7658) (-7586) (0) w140 w141 w195 + (by decide +kernel) w140_sound w141_sound w195_sound) (by decide +kernel) +lemma A3_3_10Raw_1_0_7 : (A3_3_10Raw (shape 1 0 7)).Encloses (splitWeight positiveInitial tableP (shape 3 3 10) (shape 1 0 7) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 3 3 10) (shape 1 0 7) + (0) (-7586) (-33496) w195 w141 w56 + (by decide +kernel) w195_sound w141_sound w56_sound) (by decide +kernel) +lemma A3_3_10Raw_1_1_6 : (A3_3_10Raw (shape 1 1 6)).Encloses (splitWeight positiveInitial tableP (shape 3 3 10) (shape 1 1 6) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 3 3 10) (shape 1 1 6) + (0) (0) (-7329) w195 w195 w145 + (by decide +kernel) w195_sound w195_sound w145_sound) (by decide +kernel) +lemma A3_3_10Raw_1_2_5 : (A3_3_10Raw (shape 1 2 5)).Encloses (splitWeight positiveInitial tableP (shape 3 3 10) (shape 1 2 5) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 3 3 10) (shape 1 2 5) + (0) (0) (0) w195 w195 w195 + (by decide +kernel) w195_sound w195_sound w195_sound) (by decide +kernel) +lemma A3_3_10Raw_1_3_4 : (A3_3_10Raw (shape 1 3 4)).Encloses (splitWeight positiveInitial tableP (shape 3 3 10) (shape 1 3 4) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 3 3 10) (shape 1 3 4) + (0) (-7586) (-7329) w195 w141 w145 + (by decide +kernel) w195_sound w141_sound w145_sound) (by decide +kernel) +lemma A3_3_10Raw_2_0_6 : (A3_3_10Raw (shape 2 0 6)).Encloses (splitWeight positiveInitial tableP (shape 3 3 10) (shape 2 0 6) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 3 3 10) (shape 2 0 6) + (0) (-7586) (-7329) w195 w141 w145 + (by decide +kernel) w195_sound w141_sound w145_sound) (by decide +kernel) +lemma A3_3_10Raw_2_1_5 : (A3_3_10Raw (shape 2 1 5)).Encloses (splitWeight positiveInitial tableP (shape 3 3 10) (shape 2 1 5) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 3 3 10) (shape 2 1 5) + (0) (0) (0) w195 w195 w195 + (by decide +kernel) w195_sound w195_sound w195_sound) (by decide +kernel) +lemma A3_3_10Raw_2_2_4 : (A3_3_10Raw (shape 2 2 4)).Encloses (splitWeight positiveInitial tableP (shape 3 3 10) (shape 2 2 4) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 3 3 10) (shape 2 2 4) + (0) (0) (-7329) w195 w195 w145 + (by decide +kernel) w195_sound w195_sound w145_sound) (by decide +kernel) +lemma A3_3_10Raw_2_3_3 : (A3_3_10Raw (shape 2 3 3)).Encloses (splitWeight positiveInitial tableP (shape 3 3 10) (shape 2 3 3) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 3 3 10) (shape 2 3 3) + (0) (-7586) (-33496) w195 w141 w56 + (by decide +kernel) w195_sound w141_sound w56_sound) (by decide +kernel) +lemma A3_3_10Raw_3_0_5 : (A3_3_10Raw (shape 3 0 5)).Encloses (splitWeight positiveInitial tableP (shape 3 3 10) (shape 3 0 5) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 3 3 10) (shape 3 0 5) + (-7658) (-7586) (0) w140 w141 w195 + (by decide +kernel) w140_sound w141_sound w195_sound) (by decide +kernel) +lemma A3_3_10Raw_3_1_4 : (A3_3_10Raw (shape 3 1 4)).Encloses (splitWeight positiveInitial tableP (shape 3 3 10) (shape 3 1 4) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 3 3 10) (shape 3 1 4) + (-7658) (0) (-7329) w140 w195 w145 + (by decide +kernel) w140_sound w195_sound w145_sound) (by decide +kernel) +lemma A3_3_10Raw_3_2_3 : (A3_3_10Raw (shape 3 2 3)).Encloses (splitWeight positiveInitial tableP (shape 3 3 10) (shape 3 2 3) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 3 3 10) (shape 3 2 3) + (-7658) (0) (-33496) w140 w195 w56 + (by decide +kernel) w140_sound w195_sound w56_sound) (by decide +kernel) +lemma A3_3_10Raw_3_3_2 : (A3_3_10Raw (shape 3 3 2)).Encloses (splitWeight positiveInitial tableP (shape 3 3 10) (shape 3 3 2) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 3 3 10) (shape 3 3 2) + (-7658) (-7586) (-76746) w140 w141 w9 + (by decide +kernel) w140_sound w141_sound w9_sound) (by decide +kernel) +lemma A3_3_10Raw_sound (u : Shape) (hu : u ∈ below (shape 3 3 10)) : + (A3_3_10Raw u).Encloses (splitWeight positiveInitial tableP (shape 3 3 10) u : ℝ) := by + rw [A3_3_10_below] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl + · exact A3_3_10Raw_0_0_8 + · exact A3_3_10Raw_0_1_7 + · exact A3_3_10Raw_0_2_6 + · exact A3_3_10Raw_0_3_5 + · exact A3_3_10Raw_1_0_7 + · exact A3_3_10Raw_1_1_6 + · exact A3_3_10Raw_1_2_5 + · exact A3_3_10Raw_1_3_4 + · exact A3_3_10Raw_2_0_6 + · exact A3_3_10Raw_2_1_5 + · exact A3_3_10Raw_2_2_4 + · exact A3_3_10Raw_2_3_3 + · exact A3_3_10Raw_3_0_5 + · exact A3_3_10Raw_3_1_4 + · exact A3_3_10Raw_3_2_3 + · exact A3_3_10Raw_3_3_2 +def A3_3_10Den : Ball := ⟨(217957830207268558846224302777823 / 50000000000000000000000000000000), (119 / 25000000000000000000000000000000)⟩ +lemma A3_3_10Den_sound : A3_3_10Den.Encloses (((below (shape 3 3 10)).map (splitWeight positiveInitial tableP (shape 3 3 10))).sum : ℝ) := by + exact contains_sound (list_cast_enclosed (below (shape 3 3 10)) A3_3_10Raw (splitWeight positiveInitial tableP (shape 3 3 10)) A3_3_10Raw_sound) (by decide +kernel) +lemma A3_3_10Den_positive : 0 < A3_3_10Den.lower := by decide +kernel +def A3_3_10Table (s : Shape) : Ball := + match s 0, s 1, s 2 with + | 0, 0, 8 => ⟨(92807394604080247176410297 / 4000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 0, 1, 7 => ⟨(374370843287879533686819841787 / 100000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ + | 0, 2, 6 => ⟨(5125312950924365842644983492711 / 100000000000000000000000000000000), (19 / 100000000000000000000000000000000)⟩ + | 0, 3, 5 => ⟨(2497635304864997016024994299279 / 50000000000000000000000000000000), (9 / 50000000000000000000000000000000)⟩ + | 1, 0, 7 => ⟨(377076040382652095214990170031 / 100000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ + | 1, 1, 6 => ⟨(11023083640349972174887924565559 / 100000000000000000000000000000000), (27 / 100000000000000000000000000000000)⟩ + | 1, 2, 5 => ⟨(22940217358767125771206291343619 / 100000000000000000000000000000000), (13 / 50000000000000000000000000000000)⟩ + | 1, 3, 4 => ⟨(516234837169290854412959173031 / 10000000000000000000000000000000), (1 / 5000000000000000000000000000000)⟩ + | 2, 0, 6 => ⟨(516234837169290854412959173031 / 10000000000000000000000000000000), (1 / 5000000000000000000000000000000)⟩ + | 2, 1, 5 => ⟨(22940217358767125771206291343619 / 100000000000000000000000000000000), (13 / 50000000000000000000000000000000)⟩ + | 2, 2, 4 => ⟨(11023083640349972174887924565559 / 100000000000000000000000000000000), (27 / 100000000000000000000000000000000)⟩ + | 2, 3, 3 => ⟨(377076040382652095214990170031 / 100000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ + | 3, 0, 5 => ⟨(2497635304864997016024994299279 / 50000000000000000000000000000000), (9 / 50000000000000000000000000000000)⟩ + | 3, 1, 4 => ⟨(5125312950924365842644983492711 / 100000000000000000000000000000000), (19 / 100000000000000000000000000000000)⟩ + | 3, 2, 3 => ⟨(374370843287879533686819841787 / 100000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ + | 3, 3, 2 => ⟨(92807394604080247176410297 / 4000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | _, _, _ => (.exact 0) +def A3_3_10Law (u : Shape) : Ball := if u ∈ below (shape 3 3 10) then A3_3_10Table u else .exact 0 +lemma A3_3_10Law_check_0_0_8 : contains (.mul (A3_3_10Raw (shape 0 0 8)) (.inv A3_3_10Den)) (A3_3_10Table (shape 0 0 8)) = true := by decide +kernel +lemma A3_3_10Law_check_0_1_7 : contains (.mul (A3_3_10Raw (shape 0 1 7)) (.inv A3_3_10Den)) (A3_3_10Table (shape 0 1 7)) = true := by decide +kernel +lemma A3_3_10Law_check_0_2_6 : contains (.mul (A3_3_10Raw (shape 0 2 6)) (.inv A3_3_10Den)) (A3_3_10Table (shape 0 2 6)) = true := by decide +kernel +lemma A3_3_10Law_check_0_3_5 : contains (.mul (A3_3_10Raw (shape 0 3 5)) (.inv A3_3_10Den)) (A3_3_10Table (shape 0 3 5)) = true := by decide +kernel +lemma A3_3_10Law_check_1_0_7 : contains (.mul (A3_3_10Raw (shape 1 0 7)) (.inv A3_3_10Den)) (A3_3_10Table (shape 1 0 7)) = true := by decide +kernel +lemma A3_3_10Law_check_1_1_6 : contains (.mul (A3_3_10Raw (shape 1 1 6)) (.inv A3_3_10Den)) (A3_3_10Table (shape 1 1 6)) = true := by decide +kernel +lemma A3_3_10Law_check_1_2_5 : contains (.mul (A3_3_10Raw (shape 1 2 5)) (.inv A3_3_10Den)) (A3_3_10Table (shape 1 2 5)) = true := by decide +kernel +lemma A3_3_10Law_check_1_3_4 : contains (.mul (A3_3_10Raw (shape 1 3 4)) (.inv A3_3_10Den)) (A3_3_10Table (shape 1 3 4)) = true := by decide +kernel +lemma A3_3_10Law_check_2_0_6 : contains (.mul (A3_3_10Raw (shape 2 0 6)) (.inv A3_3_10Den)) (A3_3_10Table (shape 2 0 6)) = true := by decide +kernel +lemma A3_3_10Law_check_2_1_5 : contains (.mul (A3_3_10Raw (shape 2 1 5)) (.inv A3_3_10Den)) (A3_3_10Table (shape 2 1 5)) = true := by decide +kernel +lemma A3_3_10Law_check_2_2_4 : contains (.mul (A3_3_10Raw (shape 2 2 4)) (.inv A3_3_10Den)) (A3_3_10Table (shape 2 2 4)) = true := by decide +kernel +lemma A3_3_10Law_check_2_3_3 : contains (.mul (A3_3_10Raw (shape 2 3 3)) (.inv A3_3_10Den)) (A3_3_10Table (shape 2 3 3)) = true := by decide +kernel +lemma A3_3_10Law_check_3_0_5 : contains (.mul (A3_3_10Raw (shape 3 0 5)) (.inv A3_3_10Den)) (A3_3_10Table (shape 3 0 5)) = true := by decide +kernel +lemma A3_3_10Law_check_3_1_4 : contains (.mul (A3_3_10Raw (shape 3 1 4)) (.inv A3_3_10Den)) (A3_3_10Table (shape 3 1 4)) = true := by decide +kernel +lemma A3_3_10Law_check_3_2_3 : contains (.mul (A3_3_10Raw (shape 3 2 3)) (.inv A3_3_10Den)) (A3_3_10Table (shape 3 2 3)) = true := by decide +kernel +lemma A3_3_10Law_check_3_3_2 : contains (.mul (A3_3_10Raw (shape 3 3 2)) (.inv A3_3_10Den)) (A3_3_10Table (shape 3 3 2)) = true := by decide +kernel +lemma A3_3_10Law_check (u : Shape) (hu : u ∈ below (shape 3 3 10)) : + contains (.mul (A3_3_10Raw u) (.inv A3_3_10Den)) (A3_3_10Table u) = true := by + rw [A3_3_10_below] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl + · exact A3_3_10Law_check_0_0_8 + · exact A3_3_10Law_check_0_1_7 + · exact A3_3_10Law_check_0_2_6 + · exact A3_3_10Law_check_0_3_5 + · exact A3_3_10Law_check_1_0_7 + · exact A3_3_10Law_check_1_1_6 + · exact A3_3_10Law_check_1_2_5 + · exact A3_3_10Law_check_1_3_4 + · exact A3_3_10Law_check_2_0_6 + · exact A3_3_10Law_check_2_1_5 + · exact A3_3_10Law_check_2_2_4 + · exact A3_3_10Law_check_2_3_3 + · exact A3_3_10Law_check_3_0_5 + · exact A3_3_10Law_check_3_1_4 + · exact A3_3_10Law_check_3_2_3 + · exact A3_3_10Law_check_3_3_2 +lemma A3_3_10Law_sound (u : Shape) : + (A3_3_10Law u).Encloses (stageALaw (shape 3 3 10) u : ℝ) := by + by_cases hu : u ∈ below (shape 3 3 10) + · have h := contains_sound (Ball.mul_sound (A3_3_10Raw_sound u hu) + (Ball.inv_sound A3_3_10Den_sound A3_3_10Den_positive)) (A3_3_10Law_check u hu) + simpa only [A3_3_10Law, hu, ite_true, stageALaw, splitLaw, + Rat.cast_div, Rat.cast_mul, Rat.cast_inv, div_eq_mul_inv] using h + · simp only [A3_3_10Law, hu, ite_false, stageALaw, splitLaw, Rat.cast_zero] + simpa only [Rat.cast_zero] using Ball.exact_sound 0 + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/Certificates/SplitA3_4_9.lean b/lean/OAI/LinearAlgebra/MatrixFields/Certificates/SplitA3_4_9.lean new file mode 100644 index 0000000000000000000000000000000000000000..1bf40db78653bba6b133af72c4bbc5ec3b105418 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/Certificates/SplitA3_4_9.lean @@ -0,0 +1,255 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Certificates.SplitB1_3_4 + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate +open scoped BigOperators +lemma A3_4_9_below : below (shape 3 4 9) = [ + (shape 0 0 8), + (shape 0 1 7), + (shape 0 2 6), + (shape 0 3 5), + (shape 0 4 4), + (shape 1 0 7), + (shape 1 1 6), + (shape 1 2 5), + (shape 1 3 4), + (shape 1 4 3), + (shape 2 0 6), + (shape 2 1 5), + (shape 2 2 4), + (shape 2 3 3), + (shape 2 4 2), + (shape 3 0 5), + (shape 3 1 4), + (shape 3 2 3), + (shape 3 3 2), + (shape 3 4 1)] := by decide +kernel +def A3_4_9Raw (s : Shape) : Ball := + match s 0, s 1, s 2 with + | 0, 0, 8 => ⟨(52604183508248426299746893 / 10000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 0, 1, 7 => ⟨(107048101953376826039075703437 / 50000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ + | 0, 2, 6 => ⟨(7949191186854819609435816255409 / 100000000000000000000000000000000), (23 / 100000000000000000000000000000000)⟩ + | 0, 3, 5 => ⟨(29617641665026676343636152910233 / 100000000000000000000000000000000), (19 / 25000000000000000000000000000000)⟩ + | 0, 4, 4 => ⟨(2097142753831614220150564409891 / 25000000000000000000000000000000), (21 / 100000000000000000000000000000000)⟩ + | 1, 0, 7 => ⟨(25538511110736612768307319049 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 1, 1, 6 => ⟨(1305033413039090422171216880161 / 12500000000000000000000000000000), (3 / 10000000000000000000000000000000)⟩ + | 1, 2, 5 => ⟨1, 0⟩ + | 1, 3, 4 => ⟨(31184557034256196846304679690331 / 50000000000000000000000000000000), (39 / 50000000000000000000000000000000)⟩ + | 1, 4, 3 => ⟨(1478492526375484315026102985421 / 50000000000000000000000000000000), (9 / 100000000000000000000000000000000)⟩ + | 2, 0, 6 => ⟨(1478492526375484315026102985421 / 50000000000000000000000000000000), (9 / 100000000000000000000000000000000)⟩ + | 2, 1, 5 => ⟨(31184557034256196846304679690331 / 50000000000000000000000000000000), (39 / 50000000000000000000000000000000)⟩ + | 2, 2, 4 => ⟨1, 0⟩ + | 2, 3, 3 => ⟨(1305033413039090422171216880161 / 12500000000000000000000000000000), (3 / 10000000000000000000000000000000)⟩ + | 2, 4, 2 => ⟨(25538511110736612768307319049 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 3, 0, 5 => ⟨(2097142753831614220150564409891 / 25000000000000000000000000000000), (21 / 100000000000000000000000000000000)⟩ + | 3, 1, 4 => ⟨(29617641665026676343636152910233 / 100000000000000000000000000000000), (19 / 25000000000000000000000000000000)⟩ + | 3, 2, 3 => ⟨(7949191186854819609435816255409 / 100000000000000000000000000000000), (23 / 100000000000000000000000000000000)⟩ + | 3, 3, 2 => ⟨(107048101953376826039075703437 / 50000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ + | 3, 4, 1 => ⟨(52604183508248426299746893 / 10000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | _, _, _ => (.exact 0) +lemma A3_4_9Raw_0_0_8 : (A3_4_9Raw (shape 0 0 8)).Encloses (splitWeight positiveInitial tableP (shape 3 4 9) (shape 0 0 8) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 3 4 9) (shape 0 0 8) + (-7447) (-17336) (-96770) w144 w97 w3 + (by decide +kernel) w144_sound w97_sound w3_sound) (by decide +kernel) +lemma A3_4_9Raw_0_1_7 : (A3_4_9Raw (shape 0 1 7)).Encloses (splitWeight positiveInitial tableP (shape 3 4 9) (shape 0 1 7) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 3 4 9) (shape 0 1 7) + (-7447) (-4721) (-49297) w144 w173 w36 + (by decide +kernel) w144_sound w173_sound w36_sound) (by decide +kernel) +lemma A3_4_9Raw_0_2_6 : (A3_4_9Raw (shape 0 2 6)).Encloses (splitWeight positiveInitial tableP (shape 3 4 9) (shape 0 2 6) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 3 4 9) (shape 0 2 6) + (-7447) (0) (-17874) w144 w195 w95 + (by decide +kernel) w144_sound w195_sound w95_sound) (by decide +kernel) +lemma A3_4_9Raw_0_3_5 : (A3_4_9Raw (shape 0 3 5)).Encloses (splitWeight positiveInitial tableP (shape 3 4 9) (shape 0 3 5) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 3 4 9) (shape 0 3 5) + (-7447) (-4721) (0) w144 w173 w195 + (by decide +kernel) w144_sound w173_sound w195_sound) (by decide +kernel) +lemma A3_4_9Raw_0_4_4 : (A3_4_9Raw (shape 0 4 4)).Encloses (splitWeight positiveInitial tableP (shape 3 4 9) (shape 0 4 4) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 3 4 9) (shape 0 4 4) + (-7447) (-17336) (0) w144 w97 w195 + (by decide +kernel) w144_sound w97_sound w195_sound) (by decide +kernel) +lemma A3_4_9Raw_1_0_7 : (A3_4_9Raw (shape 1 0 7)).Encloses (splitWeight positiveInitial tableP (shape 3 4 9) (shape 1 0 7) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 3 4 9) (shape 1 0 7) + (0) (-17336) (-49297) w195 w97 w36 + (by decide +kernel) w195_sound w97_sound w36_sound) (by decide +kernel) +lemma A3_4_9Raw_1_1_6 : (A3_4_9Raw (shape 1 1 6)).Encloses (splitWeight positiveInitial tableP (shape 3 4 9) (shape 1 1 6) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 3 4 9) (shape 1 1 6) + (0) (-4721) (-17874) w195 w173 w95 + (by decide +kernel) w195_sound w173_sound w95_sound) (by decide +kernel) +lemma A3_4_9Raw_1_2_5 : (A3_4_9Raw (shape 1 2 5)).Encloses (splitWeight positiveInitial tableP (shape 3 4 9) (shape 1 2 5) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 3 4 9) (shape 1 2 5) + (0) (0) (0) w195 w195 w195 + (by decide +kernel) w195_sound w195_sound w195_sound) (by decide +kernel) +lemma A3_4_9Raw_1_3_4 : (A3_4_9Raw (shape 1 3 4)).Encloses (splitWeight positiveInitial tableP (shape 3 4 9) (shape 1 3 4) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 3 4 9) (shape 1 3 4) + (0) (-4721) (0) w195 w173 w195 + (by decide +kernel) w195_sound w173_sound w195_sound) (by decide +kernel) +lemma A3_4_9Raw_1_4_3 : (A3_4_9Raw (shape 1 4 3)).Encloses (splitWeight positiveInitial tableP (shape 3 4 9) (shape 1 4 3) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 3 4 9) (shape 1 4 3) + (0) (-17336) (-17874) w195 w97 w95 + (by decide +kernel) w195_sound w97_sound w95_sound) (by decide +kernel) +lemma A3_4_9Raw_2_0_6 : (A3_4_9Raw (shape 2 0 6)).Encloses (splitWeight positiveInitial tableP (shape 3 4 9) (shape 2 0 6) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 3 4 9) (shape 2 0 6) + (0) (-17336) (-17874) w195 w97 w95 + (by decide +kernel) w195_sound w97_sound w95_sound) (by decide +kernel) +lemma A3_4_9Raw_2_1_5 : (A3_4_9Raw (shape 2 1 5)).Encloses (splitWeight positiveInitial tableP (shape 3 4 9) (shape 2 1 5) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 3 4 9) (shape 2 1 5) + (0) (-4721) (0) w195 w173 w195 + (by decide +kernel) w195_sound w173_sound w195_sound) (by decide +kernel) +lemma A3_4_9Raw_2_2_4 : (A3_4_9Raw (shape 2 2 4)).Encloses (splitWeight positiveInitial tableP (shape 3 4 9) (shape 2 2 4) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 3 4 9) (shape 2 2 4) + (0) (0) (0) w195 w195 w195 + (by decide +kernel) w195_sound w195_sound w195_sound) (by decide +kernel) +lemma A3_4_9Raw_2_3_3 : (A3_4_9Raw (shape 2 3 3)).Encloses (splitWeight positiveInitial tableP (shape 3 4 9) (shape 2 3 3) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 3 4 9) (shape 2 3 3) + (0) (-4721) (-17874) w195 w173 w95 + (by decide +kernel) w195_sound w173_sound w95_sound) (by decide +kernel) +lemma A3_4_9Raw_2_4_2 : (A3_4_9Raw (shape 2 4 2)).Encloses (splitWeight positiveInitial tableP (shape 3 4 9) (shape 2 4 2) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 3 4 9) (shape 2 4 2) + (0) (-17336) (-49297) w195 w97 w36 + (by decide +kernel) w195_sound w97_sound w36_sound) (by decide +kernel) +lemma A3_4_9Raw_3_0_5 : (A3_4_9Raw (shape 3 0 5)).Encloses (splitWeight positiveInitial tableP (shape 3 4 9) (shape 3 0 5) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 3 4 9) (shape 3 0 5) + (-7447) (-17336) (0) w144 w97 w195 + (by decide +kernel) w144_sound w97_sound w195_sound) (by decide +kernel) +lemma A3_4_9Raw_3_1_4 : (A3_4_9Raw (shape 3 1 4)).Encloses (splitWeight positiveInitial tableP (shape 3 4 9) (shape 3 1 4) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 3 4 9) (shape 3 1 4) + (-7447) (-4721) (0) w144 w173 w195 + (by decide +kernel) w144_sound w173_sound w195_sound) (by decide +kernel) +lemma A3_4_9Raw_3_2_3 : (A3_4_9Raw (shape 3 2 3)).Encloses (splitWeight positiveInitial tableP (shape 3 4 9) (shape 3 2 3) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 3 4 9) (shape 3 2 3) + (-7447) (0) (-17874) w144 w195 w95 + (by decide +kernel) w144_sound w195_sound w95_sound) (by decide +kernel) +lemma A3_4_9Raw_3_3_2 : (A3_4_9Raw (shape 3 3 2)).Encloses (splitWeight positiveInitial tableP (shape 3 4 9) (shape 3 3 2) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 3 4 9) (shape 3 3 2) + (-7447) (-4721) (-49297) w144 w173 w36 + (by decide +kernel) w144_sound w173_sound w36_sound) (by decide +kernel) +lemma A3_4_9Raw_3_4_1 : (A3_4_9Raw (shape 3 4 1)).Encloses (splitWeight positiveInitial tableP (shape 3 4 9) (shape 3 4 1) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 3 4 9) (shape 3 4 1) + (-7447) (-17336) (-96770) w144 w97 w3 + (by decide +kernel) w144_sound w97_sound w3_sound) (by decide +kernel) +lemma A3_4_9Raw_sound (u : Shape) (hu : u ∈ below (shape 3 4 9)) : + (A3_4_9Raw u).Encloses (splitWeight positiveInitial tableP (shape 3 4 9) u : ℝ) := by + rw [A3_4_9_below] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl + · exact A3_4_9Raw_0_0_8 + · exact A3_4_9Raw_0_1_7 + · exact A3_4_9Raw_0_2_6 + · exact A3_4_9Raw_0_3_5 + · exact A3_4_9Raw_0_4_4 + · exact A3_4_9Raw_1_0_7 + · exact A3_4_9Raw_1_1_6 + · exact A3_4_9Raw_1_2_5 + · exact A3_4_9Raw_1_3_4 + · exact A3_4_9Raw_1_4_3 + · exact A3_4_9Raw_2_0_6 + · exact A3_4_9Raw_2_1_5 + · exact A3_4_9Raw_2_2_4 + · exact A3_4_9Raw_2_3_3 + · exact A3_4_9Raw_2_4_2 + · exact A3_4_9Raw_3_0_5 + · exact A3_4_9Raw_3_1_4 + · exact A3_4_9Raw_3_2_3 + · exact A3_4_9Raw_3_3_2 + · exact A3_4_9Raw_3_4_1 +def A3_4_9Den : Ball := ⟨(222064085094079557733888212669047 / 50000000000000000000000000000000), (241 / 50000000000000000000000000000000)⟩ +lemma A3_4_9Den_sound : A3_4_9Den.Encloses (((below (shape 3 4 9)).map (splitWeight positiveInitial tableP (shape 3 4 9))).sum : ℝ) := by + exact contains_sound (list_cast_enclosed (below (shape 3 4 9)) A3_4_9Raw (splitWeight positiveInitial tableP (shape 3 4 9)) A3_4_9Raw_sound) (by decide +kernel) +lemma A3_4_9Den_positive : 0 < A3_4_9Den.lower := by decide +kernel +def A3_4_9Table (s : Shape) : Ball := + match s 0, s 1, s 2 with + | 0, 0, 8 => ⟨(2961092486317753981806299 / 2500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 0, 1, 7 => ⟨(12051487514068842044483780559 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 0, 2, 6 => ⟨(1789841698959800118150495751873 / 100000000000000000000000000000000), (1 / 12500000000000000000000000000000)⟩ + | 0, 3, 5 => ⟨(6668714946065880326404692767049 / 100000000000000000000000000000000), (1 / 4000000000000000000000000000000)⟩ + | 0, 4, 4 => ⟨(944386280628468031665627187853 / 50000000000000000000000000000000), (1 / 12500000000000000000000000000000)⟩ + | 1, 0, 7 => ⟨(28751284904892409882235281843 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 1, 1, 6 => ⟨(1175366482595508974701704124553 / 50000000000000000000000000000000), (1 / 10000000000000000000000000000000)⟩ + | 1, 2, 5 => ⟨(22516022786312800353724657277333 / 100000000000000000000000000000000), (1 / 4000000000000000000000000000000)⟩ + | 1, 3, 4 => ⟨(14043043935287673024483191909343 / 100000000000000000000000000000000), (17 / 50000000000000000000000000000000)⟩ + | 1, 4, 3 => ⟨(665795428265271676282857013551 / 100000000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ + | 2, 0, 6 => ⟨(665795428265271676282857013551 / 100000000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ + | 2, 1, 5 => ⟨(14043043935287673024483191909343 / 100000000000000000000000000000000), (17 / 50000000000000000000000000000000)⟩ + | 2, 2, 4 => ⟨(22516022786312800353724657277333 / 100000000000000000000000000000000), (1 / 4000000000000000000000000000000)⟩ + | 2, 3, 3 => ⟨(1175366482595508974701704124553 / 50000000000000000000000000000000), (1 / 10000000000000000000000000000000)⟩ + | 2, 4, 2 => ⟨(28751284904892409882235281843 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 3, 0, 5 => ⟨(944386280628468031665627187853 / 50000000000000000000000000000000), (1 / 12500000000000000000000000000000)⟩ + | 3, 1, 4 => ⟨(6668714946065880326404692767049 / 100000000000000000000000000000000), (1 / 4000000000000000000000000000000)⟩ + | 3, 2, 3 => ⟨(1789841698959800118150495751873 / 100000000000000000000000000000000), (1 / 12500000000000000000000000000000)⟩ + | 3, 3, 2 => ⟨(12051487514068842044483780559 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 3, 4, 1 => ⟨(2961092486317753981806299 / 2500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | _, _, _ => (.exact 0) +def A3_4_9Law (u : Shape) : Ball := if u ∈ below (shape 3 4 9) then A3_4_9Table u else .exact 0 +lemma A3_4_9Law_check_0_0_8 : contains (.mul (A3_4_9Raw (shape 0 0 8)) (.inv A3_4_9Den)) (A3_4_9Table (shape 0 0 8)) = true := by decide +kernel +lemma A3_4_9Law_check_0_1_7 : contains (.mul (A3_4_9Raw (shape 0 1 7)) (.inv A3_4_9Den)) (A3_4_9Table (shape 0 1 7)) = true := by decide +kernel +lemma A3_4_9Law_check_0_2_6 : contains (.mul (A3_4_9Raw (shape 0 2 6)) (.inv A3_4_9Den)) (A3_4_9Table (shape 0 2 6)) = true := by decide +kernel +lemma A3_4_9Law_check_0_3_5 : contains (.mul (A3_4_9Raw (shape 0 3 5)) (.inv A3_4_9Den)) (A3_4_9Table (shape 0 3 5)) = true := by decide +kernel +lemma A3_4_9Law_check_0_4_4 : contains (.mul (A3_4_9Raw (shape 0 4 4)) (.inv A3_4_9Den)) (A3_4_9Table (shape 0 4 4)) = true := by decide +kernel +lemma A3_4_9Law_check_1_0_7 : contains (.mul (A3_4_9Raw (shape 1 0 7)) (.inv A3_4_9Den)) (A3_4_9Table (shape 1 0 7)) = true := by decide +kernel +lemma A3_4_9Law_check_1_1_6 : contains (.mul (A3_4_9Raw (shape 1 1 6)) (.inv A3_4_9Den)) (A3_4_9Table (shape 1 1 6)) = true := by decide +kernel +lemma A3_4_9Law_check_1_2_5 : contains (.mul (A3_4_9Raw (shape 1 2 5)) (.inv A3_4_9Den)) (A3_4_9Table (shape 1 2 5)) = true := by decide +kernel +lemma A3_4_9Law_check_1_3_4 : contains (.mul (A3_4_9Raw (shape 1 3 4)) (.inv A3_4_9Den)) (A3_4_9Table (shape 1 3 4)) = true := by decide +kernel +lemma A3_4_9Law_check_1_4_3 : contains (.mul (A3_4_9Raw (shape 1 4 3)) (.inv A3_4_9Den)) (A3_4_9Table (shape 1 4 3)) = true := by decide +kernel +lemma A3_4_9Law_check_2_0_6 : contains (.mul (A3_4_9Raw (shape 2 0 6)) (.inv A3_4_9Den)) (A3_4_9Table (shape 2 0 6)) = true := by decide +kernel +lemma A3_4_9Law_check_2_1_5 : contains (.mul (A3_4_9Raw (shape 2 1 5)) (.inv A3_4_9Den)) (A3_4_9Table (shape 2 1 5)) = true := by decide +kernel +lemma A3_4_9Law_check_2_2_4 : contains (.mul (A3_4_9Raw (shape 2 2 4)) (.inv A3_4_9Den)) (A3_4_9Table (shape 2 2 4)) = true := by decide +kernel +lemma A3_4_9Law_check_2_3_3 : contains (.mul (A3_4_9Raw (shape 2 3 3)) (.inv A3_4_9Den)) (A3_4_9Table (shape 2 3 3)) = true := by decide +kernel +lemma A3_4_9Law_check_2_4_2 : contains (.mul (A3_4_9Raw (shape 2 4 2)) (.inv A3_4_9Den)) (A3_4_9Table (shape 2 4 2)) = true := by decide +kernel +lemma A3_4_9Law_check_3_0_5 : contains (.mul (A3_4_9Raw (shape 3 0 5)) (.inv A3_4_9Den)) (A3_4_9Table (shape 3 0 5)) = true := by decide +kernel +lemma A3_4_9Law_check_3_1_4 : contains (.mul (A3_4_9Raw (shape 3 1 4)) (.inv A3_4_9Den)) (A3_4_9Table (shape 3 1 4)) = true := by decide +kernel +lemma A3_4_9Law_check_3_2_3 : contains (.mul (A3_4_9Raw (shape 3 2 3)) (.inv A3_4_9Den)) (A3_4_9Table (shape 3 2 3)) = true := by decide +kernel +lemma A3_4_9Law_check_3_3_2 : contains (.mul (A3_4_9Raw (shape 3 3 2)) (.inv A3_4_9Den)) (A3_4_9Table (shape 3 3 2)) = true := by decide +kernel +lemma A3_4_9Law_check_3_4_1 : contains (.mul (A3_4_9Raw (shape 3 4 1)) (.inv A3_4_9Den)) (A3_4_9Table (shape 3 4 1)) = true := by decide +kernel +lemma A3_4_9Law_check (u : Shape) (hu : u ∈ below (shape 3 4 9)) : + contains (.mul (A3_4_9Raw u) (.inv A3_4_9Den)) (A3_4_9Table u) = true := by + rw [A3_4_9_below] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl + · exact A3_4_9Law_check_0_0_8 + · exact A3_4_9Law_check_0_1_7 + · exact A3_4_9Law_check_0_2_6 + · exact A3_4_9Law_check_0_3_5 + · exact A3_4_9Law_check_0_4_4 + · exact A3_4_9Law_check_1_0_7 + · exact A3_4_9Law_check_1_1_6 + · exact A3_4_9Law_check_1_2_5 + · exact A3_4_9Law_check_1_3_4 + · exact A3_4_9Law_check_1_4_3 + · exact A3_4_9Law_check_2_0_6 + · exact A3_4_9Law_check_2_1_5 + · exact A3_4_9Law_check_2_2_4 + · exact A3_4_9Law_check_2_3_3 + · exact A3_4_9Law_check_2_4_2 + · exact A3_4_9Law_check_3_0_5 + · exact A3_4_9Law_check_3_1_4 + · exact A3_4_9Law_check_3_2_3 + · exact A3_4_9Law_check_3_3_2 + · exact A3_4_9Law_check_3_4_1 +lemma A3_4_9Law_sound (u : Shape) : + (A3_4_9Law u).Encloses (stageALaw (shape 3 4 9) u : ℝ) := by + by_cases hu : u ∈ below (shape 3 4 9) + · have h := contains_sound (Ball.mul_sound (A3_4_9Raw_sound u hu) + (Ball.inv_sound A3_4_9Den_sound A3_4_9Den_positive)) (A3_4_9Law_check u hu) + simpa only [A3_4_9Law, hu, ite_true, stageALaw, splitLaw, + Rat.cast_div, Rat.cast_mul, Rat.cast_inv, div_eq_mul_inv] using h + · simp only [A3_4_9Law, hu, ite_false, stageALaw, splitLaw, Rat.cast_zero] + simpa only [Rat.cast_zero] using Ball.exact_sound 0 + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/Certificates/SplitA3_5_8.lean b/lean/OAI/LinearAlgebra/MatrixFields/Certificates/SplitA3_5_8.lean new file mode 100644 index 0000000000000000000000000000000000000000..df7662fb8bfc322d1e5889bf37e8953362624368 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/Certificates/SplitA3_5_8.lean @@ -0,0 +1,295 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Certificates.SplitB1_3_4 + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate +open scoped BigOperators +lemma A3_5_8_below : below (shape 3 5 8) = [ + (shape 0 0 8), + (shape 0 1 7), + (shape 0 2 6), + (shape 0 3 5), + (shape 0 4 4), + (shape 0 5 3), + (shape 1 0 7), + (shape 1 1 6), + (shape 1 2 5), + (shape 1 3 4), + (shape 1 4 3), + (shape 1 5 2), + (shape 2 0 6), + (shape 2 1 5), + (shape 2 2 4), + (shape 2 3 3), + (shape 2 4 2), + (shape 2 5 1), + (shape 3 0 5), + (shape 3 1 4), + (shape 3 2 3), + (shape 3 3 2), + (shape 3 4 1), + (shape 3 5 0)] := by decide +kernel +def A3_5_8Raw (s : Shape) : Ball := + match s 0, s 1, s 2 with + | 0, 0, 8 => ⟨(328669583149386781185709 / 1562500000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 0, 1, 7 => ⟨(19209894118417149770024794673 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 0, 2, 6 => ⟨(1723177871786636609721592861297 / 100000000000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ + | 0, 3, 5 => ⟨(17261354968926351667760393882717 / 100000000000000000000000000000000), (1 / 2500000000000000000000000000000)⟩ + | 0, 4, 4 => ⟨(445432629432246067049549352859 / 2500000000000000000000000000000), (11 / 25000000000000000000000000000000)⟩ + | 0, 5, 3 => ⟨(855619240745488096141205264161 / 100000000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ + | 1, 0, 7 => ⟨(66803408806529843382445509 / 1250000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 1, 1, 6 => ⟨(640582734291565687942242590477 / 50000000000000000000000000000000), (1 / 20000000000000000000000000000000)⟩ + | 1, 2, 5 => ⟨(35260740785769191116135010727999 / 100000000000000000000000000000000), (21 / 50000000000000000000000000000000)⟩ + | 1, 3, 4 => ⟨1, 0⟩ + | 1, 4, 3 => ⟨(6416822165959928926276575414637 / 50000000000000000000000000000000), (33 / 100000000000000000000000000000000)⟩ + | 1, 5, 2 => ⟨(174482677080586900029834379827 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 2, 0, 6 => ⟨(174482677080586900029834379827 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 2, 1, 5 => ⟨(6416822165959928926276575414637 / 50000000000000000000000000000000), (33 / 100000000000000000000000000000000)⟩ + | 2, 2, 4 => ⟨1, 0⟩ + | 2, 3, 3 => ⟨(35260740785769191116135010727999 / 100000000000000000000000000000000), (21 / 50000000000000000000000000000000)⟩ + | 2, 4, 2 => ⟨(640582734291565687942242590477 / 50000000000000000000000000000000), (1 / 20000000000000000000000000000000)⟩ + | 2, 5, 1 => ⟨(66803408806529843382445509 / 1250000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 3, 0, 5 => ⟨(855619240745488096141205264161 / 100000000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ + | 3, 1, 4 => ⟨(445432629432246067049549352859 / 2500000000000000000000000000000), (11 / 25000000000000000000000000000000)⟩ + | 3, 2, 3 => ⟨(17261354968926351667760393882717 / 100000000000000000000000000000000), (1 / 2500000000000000000000000000000)⟩ + | 3, 3, 2 => ⟨(1723177871786636609721592861297 / 100000000000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ + | 3, 4, 1 => ⟨(19209894118417149770024794673 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 3, 5, 0 => ⟨(328669583149386781185709 / 1562500000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | _, _, _ => (.exact 0) +lemma A3_5_8Raw_0_0_8 : (A3_5_8Raw (shape 0 0 8)).Encloses (splitWeight positiveInitial tableP (shape 3 5 8) (shape 0 0 8) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 3 5 8) (shape 0 0 8) + (-7143) (-30044) (-116558) w148 w68 w1 + (by decide +kernel) w148_sound w68_sound w1_sound) (by decide +kernel) +lemma A3_5_8Raw_0_1_7 : (A3_5_8Raw (shape 0 1 7)).Encloses (splitWeight positiveInitial tableP (shape 3 5 8) (shape 0 1 7) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 3 5 8) (shape 0 1 7) + (-7143) (-10107) (-68325) w148 w128 w14 + (by decide +kernel) w148_sound w128_sound w14_sound) (by decide +kernel) +lemma A3_5_8Raw_0_2_6 : (A3_5_8Raw (shape 0 2 6)).Encloses (splitWeight positiveInitial tableP (shape 3 5 8) (shape 0 2 6) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 3 5 8) (shape 0 2 6) + (-7143) (0) (-33467) w148 w195 w57 + (by decide +kernel) w148_sound w195_sound w57_sound) (by decide +kernel) +lemma A3_5_8Raw_0_3_5 : (A3_5_8Raw (shape 0 3 5)).Encloses (splitWeight positiveInitial tableP (shape 3 5 8) (shape 0 3 5) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 3 5 8) (shape 0 3 5) + (-7143) (0) (-10424) w148 w195 w127 + (by decide +kernel) w148_sound w195_sound w127_sound) (by decide +kernel) +lemma A3_5_8Raw_0_4_4 : (A3_5_8Raw (shape 0 4 4)).Encloses (splitWeight positiveInitial tableP (shape 3 5 8) (shape 0 4 4) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 3 5 8) (shape 0 4 4) + (-7143) (-10107) (0) w148 w128 w195 + (by decide +kernel) w148_sound w128_sound w195_sound) (by decide +kernel) +lemma A3_5_8Raw_0_5_3 : (A3_5_8Raw (shape 0 5 3)).Encloses (splitWeight positiveInitial tableP (shape 3 5 8) (shape 0 5 3) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 3 5 8) (shape 0 5 3) + (-7143) (-30044) (-10424) w148 w68 w127 + (by decide +kernel) w148_sound w68_sound w127_sound) (by decide +kernel) +lemma A3_5_8Raw_1_0_7 : (A3_5_8Raw (shape 1 0 7)).Encloses (splitWeight positiveInitial tableP (shape 3 5 8) (shape 1 0 7) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 3 5 8) (shape 1 0 7) + (0) (-30044) (-68325) w195 w68 w14 + (by decide +kernel) w195_sound w68_sound w14_sound) (by decide +kernel) +lemma A3_5_8Raw_1_1_6 : (A3_5_8Raw (shape 1 1 6)).Encloses (splitWeight positiveInitial tableP (shape 3 5 8) (shape 1 1 6) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 3 5 8) (shape 1 1 6) + (0) (-10107) (-33467) w195 w128 w57 + (by decide +kernel) w195_sound w128_sound w57_sound) (by decide +kernel) +lemma A3_5_8Raw_1_2_5 : (A3_5_8Raw (shape 1 2 5)).Encloses (splitWeight positiveInitial tableP (shape 3 5 8) (shape 1 2 5) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 3 5 8) (shape 1 2 5) + (0) (0) (-10424) w195 w195 w127 + (by decide +kernel) w195_sound w195_sound w127_sound) (by decide +kernel) +lemma A3_5_8Raw_1_3_4 : (A3_5_8Raw (shape 1 3 4)).Encloses (splitWeight positiveInitial tableP (shape 3 5 8) (shape 1 3 4) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 3 5 8) (shape 1 3 4) + (0) (0) (0) w195 w195 w195 + (by decide +kernel) w195_sound w195_sound w195_sound) (by decide +kernel) +lemma A3_5_8Raw_1_4_3 : (A3_5_8Raw (shape 1 4 3)).Encloses (splitWeight positiveInitial tableP (shape 3 5 8) (shape 1 4 3) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 3 5 8) (shape 1 4 3) + (0) (-10107) (-10424) w195 w128 w127 + (by decide +kernel) w195_sound w128_sound w127_sound) (by decide +kernel) +lemma A3_5_8Raw_1_5_2 : (A3_5_8Raw (shape 1 5 2)).Encloses (splitWeight positiveInitial tableP (shape 3 5 8) (shape 1 5 2) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 3 5 8) (shape 1 5 2) + (0) (-30044) (-33467) w195 w68 w57 + (by decide +kernel) w195_sound w68_sound w57_sound) (by decide +kernel) +lemma A3_5_8Raw_2_0_6 : (A3_5_8Raw (shape 2 0 6)).Encloses (splitWeight positiveInitial tableP (shape 3 5 8) (shape 2 0 6) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 3 5 8) (shape 2 0 6) + (0) (-30044) (-33467) w195 w68 w57 + (by decide +kernel) w195_sound w68_sound w57_sound) (by decide +kernel) +lemma A3_5_8Raw_2_1_5 : (A3_5_8Raw (shape 2 1 5)).Encloses (splitWeight positiveInitial tableP (shape 3 5 8) (shape 2 1 5) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 3 5 8) (shape 2 1 5) + (0) (-10107) (-10424) w195 w128 w127 + (by decide +kernel) w195_sound w128_sound w127_sound) (by decide +kernel) +lemma A3_5_8Raw_2_2_4 : (A3_5_8Raw (shape 2 2 4)).Encloses (splitWeight positiveInitial tableP (shape 3 5 8) (shape 2 2 4) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 3 5 8) (shape 2 2 4) + (0) (0) (0) w195 w195 w195 + (by decide +kernel) w195_sound w195_sound w195_sound) (by decide +kernel) +lemma A3_5_8Raw_2_3_3 : (A3_5_8Raw (shape 2 3 3)).Encloses (splitWeight positiveInitial tableP (shape 3 5 8) (shape 2 3 3) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 3 5 8) (shape 2 3 3) + (0) (0) (-10424) w195 w195 w127 + (by decide +kernel) w195_sound w195_sound w127_sound) (by decide +kernel) +lemma A3_5_8Raw_2_4_2 : (A3_5_8Raw (shape 2 4 2)).Encloses (splitWeight positiveInitial tableP (shape 3 5 8) (shape 2 4 2) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 3 5 8) (shape 2 4 2) + (0) (-10107) (-33467) w195 w128 w57 + (by decide +kernel) w195_sound w128_sound w57_sound) (by decide +kernel) +lemma A3_5_8Raw_2_5_1 : (A3_5_8Raw (shape 2 5 1)).Encloses (splitWeight positiveInitial tableP (shape 3 5 8) (shape 2 5 1) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 3 5 8) (shape 2 5 1) + (0) (-30044) (-68325) w195 w68 w14 + (by decide +kernel) w195_sound w68_sound w14_sound) (by decide +kernel) +lemma A3_5_8Raw_3_0_5 : (A3_5_8Raw (shape 3 0 5)).Encloses (splitWeight positiveInitial tableP (shape 3 5 8) (shape 3 0 5) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 3 5 8) (shape 3 0 5) + (-7143) (-30044) (-10424) w148 w68 w127 + (by decide +kernel) w148_sound w68_sound w127_sound) (by decide +kernel) +lemma A3_5_8Raw_3_1_4 : (A3_5_8Raw (shape 3 1 4)).Encloses (splitWeight positiveInitial tableP (shape 3 5 8) (shape 3 1 4) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 3 5 8) (shape 3 1 4) + (-7143) (-10107) (0) w148 w128 w195 + (by decide +kernel) w148_sound w128_sound w195_sound) (by decide +kernel) +lemma A3_5_8Raw_3_2_3 : (A3_5_8Raw (shape 3 2 3)).Encloses (splitWeight positiveInitial tableP (shape 3 5 8) (shape 3 2 3) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 3 5 8) (shape 3 2 3) + (-7143) (0) (-10424) w148 w195 w127 + (by decide +kernel) w148_sound w195_sound w127_sound) (by decide +kernel) +lemma A3_5_8Raw_3_3_2 : (A3_5_8Raw (shape 3 3 2)).Encloses (splitWeight positiveInitial tableP (shape 3 5 8) (shape 3 3 2) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 3 5 8) (shape 3 3 2) + (-7143) (0) (-33467) w148 w195 w57 + (by decide +kernel) w148_sound w195_sound w57_sound) (by decide +kernel) +lemma A3_5_8Raw_3_4_1 : (A3_5_8Raw (shape 3 4 1)).Encloses (splitWeight positiveInitial tableP (shape 3 5 8) (shape 3 4 1) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 3 5 8) (shape 3 4 1) + (-7143) (-10107) (-68325) w148 w128 w14 + (by decide +kernel) w148_sound w128_sound w14_sound) (by decide +kernel) +lemma A3_5_8Raw_3_5_0 : (A3_5_8Raw (shape 3 5 0)).Encloses (splitWeight positiveInitial tableP (shape 3 5 8) (shape 3 5 0) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 3 5 8) (shape 3 5 0) + (-7143) (-30044) (-116558) w148 w68 w1 + (by decide +kernel) w148_sound w68_sound w1_sound) (by decide +kernel) +lemma A3_5_8Raw_sound (u : Shape) (hu : u ∈ below (shape 3 5 8)) : + (A3_5_8Raw u).Encloses (splitWeight positiveInitial tableP (shape 3 5 8) u : ℝ) := by + rw [A3_5_8_below] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl + · exact A3_5_8Raw_0_0_8 + · exact A3_5_8Raw_0_1_7 + · exact A3_5_8Raw_0_2_6 + · exact A3_5_8Raw_0_3_5 + · exact A3_5_8Raw_0_4_4 + · exact A3_5_8Raw_0_5_3 + · exact A3_5_8Raw_1_0_7 + · exact A3_5_8Raw_1_1_6 + · exact A3_5_8Raw_1_2_5 + · exact A3_5_8Raw_1_3_4 + · exact A3_5_8Raw_1_4_3 + · exact A3_5_8Raw_1_5_2 + · exact A3_5_8Raw_2_0_6 + · exact A3_5_8Raw_2_1_5 + · exact A3_5_8Raw_2_2_4 + · exact A3_5_8Raw_2_3_3 + · exact A3_5_8Raw_2_4_2 + · exact A3_5_8Raw_2_5_1 + · exact A3_5_8Raw_3_0_5 + · exact A3_5_8Raw_3_1_4 + · exact A3_5_8Raw_3_2_3 + · exact A3_5_8Raw_3_3_2 + · exact A3_5_8Raw_3_4_1 + · exact A3_5_8Raw_3_5_0 +def A3_5_8Den : Ball := ⟨(93616032861888673699101131780679 / 25000000000000000000000000000000), (89 / 25000000000000000000000000000000)⟩ +lemma A3_5_8Den_sound : A3_5_8Den.Encloses (((below (shape 3 5 8)).map (splitWeight positiveInitial tableP (shape 3 5 8))).sum : ℝ) := by + exact contains_sound (list_cast_enclosed (below (shape 3 5 8)) A3_5_8Raw (splitWeight positiveInitial tableP (shape 3 5 8)) A3_5_8Raw_sound) (by decide +kernel) +lemma A3_5_8Den_positive : 0 < A3_5_8Den.lower := by decide +kernel +def A3_5_8Table (s : Shape) : Ball := + match s 0, s 1, s 2 with + | 0, 0, 8 => ⟨(5617321274602978972531421 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 0, 1, 7 => ⟨(2564984534587871162395170351 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 0, 2, 6 => ⟨(14380364892404713617013575761 / 3125000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ + | 0, 3, 5 => ⟨(2304807526184103743816886449421 / 50000000000000000000000000000000), (1 / 6250000000000000000000000000000)⟩ + | 0, 4, 4 => ⟨(951616119194862462941861582207 / 20000000000000000000000000000000), (17 / 100000000000000000000000000000000)⟩ + | 0, 5, 3 => ⟨(228491641492590121381678806719 / 100000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ + | 1, 0, 7 => ⟨(1427178801842300281575260073 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 1, 1, 6 => ⟨(342133027168868932426842786183 / 100000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ + | 1, 2, 5 => ⟨(9416319968874671475112547173063 / 100000000000000000000000000000000), (21 / 100000000000000000000000000000000)⟩ + | 1, 3, 4 => ⟨(26704827405880776123709349345923 / 100000000000000000000000000000000), (13 / 50000000000000000000000000000000)⟩ + | 1, 4, 3 => ⟨(1713601284361899518761493331217 / 50000000000000000000000000000000), (13 / 100000000000000000000000000000000)⟩ + | 1, 5, 2 => ⟨(46595297767531026173741859253 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 2, 0, 6 => ⟨(46595297767531026173741859253 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 2, 1, 5 => ⟨(1713601284361899518761493331217 / 50000000000000000000000000000000), (13 / 100000000000000000000000000000000)⟩ + | 2, 2, 4 => ⟨(26704827405880776123709349345923 / 100000000000000000000000000000000), (13 / 50000000000000000000000000000000)⟩ + | 2, 3, 3 => ⟨(9416319968874671475112547173063 / 100000000000000000000000000000000), (21 / 100000000000000000000000000000000)⟩ + | 2, 4, 2 => ⟨(342133027168868932426842786183 / 100000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ + | 2, 5, 1 => ⟨(1427178801842300281575260073 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 3, 0, 5 => ⟨(228491641492590121381678806719 / 100000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ + | 3, 1, 4 => ⟨(951616119194862462941861582207 / 20000000000000000000000000000000), (17 / 100000000000000000000000000000000)⟩ + | 3, 2, 3 => ⟨(2304807526184103743816886449421 / 50000000000000000000000000000000), (1 / 6250000000000000000000000000000)⟩ + | 3, 3, 2 => ⟨(14380364892404713617013575761 / 3125000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ + | 3, 4, 1 => ⟨(2564984534587871162395170351 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 3, 5, 0 => ⟨(5617321274602978972531421 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | _, _, _ => (.exact 0) +def A3_5_8Law (u : Shape) : Ball := if u ∈ below (shape 3 5 8) then A3_5_8Table u else .exact 0 +lemma A3_5_8Law_check_0_0_8 : contains (.mul (A3_5_8Raw (shape 0 0 8)) (.inv A3_5_8Den)) (A3_5_8Table (shape 0 0 8)) = true := by decide +kernel +lemma A3_5_8Law_check_0_1_7 : contains (.mul (A3_5_8Raw (shape 0 1 7)) (.inv A3_5_8Den)) (A3_5_8Table (shape 0 1 7)) = true := by decide +kernel +lemma A3_5_8Law_check_0_2_6 : contains (.mul (A3_5_8Raw (shape 0 2 6)) (.inv A3_5_8Den)) (A3_5_8Table (shape 0 2 6)) = true := by decide +kernel +lemma A3_5_8Law_check_0_3_5 : contains (.mul (A3_5_8Raw (shape 0 3 5)) (.inv A3_5_8Den)) (A3_5_8Table (shape 0 3 5)) = true := by decide +kernel +lemma A3_5_8Law_check_0_4_4 : contains (.mul (A3_5_8Raw (shape 0 4 4)) (.inv A3_5_8Den)) (A3_5_8Table (shape 0 4 4)) = true := by decide +kernel +lemma A3_5_8Law_check_0_5_3 : contains (.mul (A3_5_8Raw (shape 0 5 3)) (.inv A3_5_8Den)) (A3_5_8Table (shape 0 5 3)) = true := by decide +kernel +lemma A3_5_8Law_check_1_0_7 : contains (.mul (A3_5_8Raw (shape 1 0 7)) (.inv A3_5_8Den)) (A3_5_8Table (shape 1 0 7)) = true := by decide +kernel +lemma A3_5_8Law_check_1_1_6 : contains (.mul (A3_5_8Raw (shape 1 1 6)) (.inv A3_5_8Den)) (A3_5_8Table (shape 1 1 6)) = true := by decide +kernel +lemma A3_5_8Law_check_1_2_5 : contains (.mul (A3_5_8Raw (shape 1 2 5)) (.inv A3_5_8Den)) (A3_5_8Table (shape 1 2 5)) = true := by decide +kernel +lemma A3_5_8Law_check_1_3_4 : contains (.mul (A3_5_8Raw (shape 1 3 4)) (.inv A3_5_8Den)) (A3_5_8Table (shape 1 3 4)) = true := by decide +kernel +lemma A3_5_8Law_check_1_4_3 : contains (.mul (A3_5_8Raw (shape 1 4 3)) (.inv A3_5_8Den)) (A3_5_8Table (shape 1 4 3)) = true := by decide +kernel +lemma A3_5_8Law_check_1_5_2 : contains (.mul (A3_5_8Raw (shape 1 5 2)) (.inv A3_5_8Den)) (A3_5_8Table (shape 1 5 2)) = true := by decide +kernel +lemma A3_5_8Law_check_2_0_6 : contains (.mul (A3_5_8Raw (shape 2 0 6)) (.inv A3_5_8Den)) (A3_5_8Table (shape 2 0 6)) = true := by decide +kernel +lemma A3_5_8Law_check_2_1_5 : contains (.mul (A3_5_8Raw (shape 2 1 5)) (.inv A3_5_8Den)) (A3_5_8Table (shape 2 1 5)) = true := by decide +kernel +lemma A3_5_8Law_check_2_2_4 : contains (.mul (A3_5_8Raw (shape 2 2 4)) (.inv A3_5_8Den)) (A3_5_8Table (shape 2 2 4)) = true := by decide +kernel +lemma A3_5_8Law_check_2_3_3 : contains (.mul (A3_5_8Raw (shape 2 3 3)) (.inv A3_5_8Den)) (A3_5_8Table (shape 2 3 3)) = true := by decide +kernel +lemma A3_5_8Law_check_2_4_2 : contains (.mul (A3_5_8Raw (shape 2 4 2)) (.inv A3_5_8Den)) (A3_5_8Table (shape 2 4 2)) = true := by decide +kernel +lemma A3_5_8Law_check_2_5_1 : contains (.mul (A3_5_8Raw (shape 2 5 1)) (.inv A3_5_8Den)) (A3_5_8Table (shape 2 5 1)) = true := by decide +kernel +lemma A3_5_8Law_check_3_0_5 : contains (.mul (A3_5_8Raw (shape 3 0 5)) (.inv A3_5_8Den)) (A3_5_8Table (shape 3 0 5)) = true := by decide +kernel +lemma A3_5_8Law_check_3_1_4 : contains (.mul (A3_5_8Raw (shape 3 1 4)) (.inv A3_5_8Den)) (A3_5_8Table (shape 3 1 4)) = true := by decide +kernel +lemma A3_5_8Law_check_3_2_3 : contains (.mul (A3_5_8Raw (shape 3 2 3)) (.inv A3_5_8Den)) (A3_5_8Table (shape 3 2 3)) = true := by decide +kernel +lemma A3_5_8Law_check_3_3_2 : contains (.mul (A3_5_8Raw (shape 3 3 2)) (.inv A3_5_8Den)) (A3_5_8Table (shape 3 3 2)) = true := by decide +kernel +lemma A3_5_8Law_check_3_4_1 : contains (.mul (A3_5_8Raw (shape 3 4 1)) (.inv A3_5_8Den)) (A3_5_8Table (shape 3 4 1)) = true := by decide +kernel +lemma A3_5_8Law_check_3_5_0 : contains (.mul (A3_5_8Raw (shape 3 5 0)) (.inv A3_5_8Den)) (A3_5_8Table (shape 3 5 0)) = true := by decide +kernel +lemma A3_5_8Law_check (u : Shape) (hu : u ∈ below (shape 3 5 8)) : + contains (.mul (A3_5_8Raw u) (.inv A3_5_8Den)) (A3_5_8Table u) = true := by + rw [A3_5_8_below] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl + · exact A3_5_8Law_check_0_0_8 + · exact A3_5_8Law_check_0_1_7 + · exact A3_5_8Law_check_0_2_6 + · exact A3_5_8Law_check_0_3_5 + · exact A3_5_8Law_check_0_4_4 + · exact A3_5_8Law_check_0_5_3 + · exact A3_5_8Law_check_1_0_7 + · exact A3_5_8Law_check_1_1_6 + · exact A3_5_8Law_check_1_2_5 + · exact A3_5_8Law_check_1_3_4 + · exact A3_5_8Law_check_1_4_3 + · exact A3_5_8Law_check_1_5_2 + · exact A3_5_8Law_check_2_0_6 + · exact A3_5_8Law_check_2_1_5 + · exact A3_5_8Law_check_2_2_4 + · exact A3_5_8Law_check_2_3_3 + · exact A3_5_8Law_check_2_4_2 + · exact A3_5_8Law_check_2_5_1 + · exact A3_5_8Law_check_3_0_5 + · exact A3_5_8Law_check_3_1_4 + · exact A3_5_8Law_check_3_2_3 + · exact A3_5_8Law_check_3_3_2 + · exact A3_5_8Law_check_3_4_1 + · exact A3_5_8Law_check_3_5_0 +lemma A3_5_8Law_sound (u : Shape) : + (A3_5_8Law u).Encloses (stageALaw (shape 3 5 8) u : ℝ) := by + by_cases hu : u ∈ below (shape 3 5 8) + · have h := contains_sound (Ball.mul_sound (A3_5_8Raw_sound u hu) + (Ball.inv_sound A3_5_8Den_sound A3_5_8Den_positive)) (A3_5_8Law_check u hu) + simpa only [A3_5_8Law, hu, ite_true, stageALaw, splitLaw, + Rat.cast_div, Rat.cast_mul, Rat.cast_inv, div_eq_mul_inv] using h + · simp only [A3_5_8Law, hu, ite_false, stageALaw, splitLaw, Rat.cast_zero] + simpa only [Rat.cast_zero] using Ball.exact_sound 0 + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/Certificates/SplitA3_6_7.lean b/lean/OAI/LinearAlgebra/MatrixFields/Certificates/SplitA3_6_7.lean new file mode 100644 index 0000000000000000000000000000000000000000..4b709cd32dc5a79ac1ca693c421fb78153cb6dca --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/Certificates/SplitA3_6_7.lean @@ -0,0 +1,315 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Certificates.SplitB1_3_4 + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate +open scoped BigOperators +lemma A3_6_7_below : below (shape 3 6 7) = [ + (shape 0 1 7), + (shape 0 2 6), + (shape 0 3 5), + (shape 0 4 4), + (shape 0 5 3), + (shape 0 6 2), + (shape 1 0 7), + (shape 1 1 6), + (shape 1 2 5), + (shape 1 3 4), + (shape 1 4 3), + (shape 1 5 2), + (shape 1 6 1), + (shape 2 0 6), + (shape 2 1 5), + (shape 2 2 4), + (shape 2 3 3), + (shape 2 4 2), + (shape 2 5 1), + (shape 2 6 0), + (shape 3 0 5), + (shape 3 1 4), + (shape 3 2 3), + (shape 3 3 2), + (shape 3 4 1), + (shape 3 5 0)] := by decide +kernel +def A3_6_7Raw (s : Shape) : Ball := + match s 0, s 1, s 2 with + | 0, 1, 7 => ⟨(947695798775862187054385307 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 0, 2, 6 => ⟨(102230605927328755004795179633 / 25000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ + | 0, 3, 5 => ⟨(2485504917108313710539576690779 / 25000000000000000000000000000000), (13 / 50000000000000000000000000000000)⟩ + | 0, 4, 4 => ⟨(425575504693914482232192681717 / 1562500000000000000000000000000), (71 / 100000000000000000000000000000000)⟩ + | 0, 5, 3 => ⟨(500087920163149423759661626633 / 12500000000000000000000000000000), (3 / 25000000000000000000000000000000)⟩ + | 0, 6, 2 => ⟨(14645470457248380324013395549 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 1, 0, 7 => ⟨(279158785601762653275431827 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 1, 1, 6 => ⟨(63426279861227231827349959449 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 1, 2, 5 => ⟨(3019453409783584311945978178983 / 25000000000000000000000000000000), (1 / 3125000000000000000000000000000)⟩ + | 1, 3, 4 => ⟨1, 0⟩ + | 1, 4, 3 => ⟨(11504431092583276771638604143613 / 20000000000000000000000000000000), (37 / 50000000000000000000000000000000)⟩ + | 1, 5, 2 => ⟨(221757384863796084201755173273 / 12500000000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ + | 1, 6, 1 => ⟨(2211632883128668798193442523 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 2, 0, 6 => ⟨(2211632883128668798193442523 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 2, 1, 5 => ⟨(221757384863796084201755173273 / 12500000000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ + | 2, 2, 4 => ⟨(11504431092583276771638604143613 / 20000000000000000000000000000000), (37 / 50000000000000000000000000000000)⟩ + | 2, 3, 3 => ⟨1, 0⟩ + | 2, 4, 2 => ⟨(3019453409783584311945978178983 / 25000000000000000000000000000000), (1 / 3125000000000000000000000000000)⟩ + | 2, 5, 1 => ⟨(63426279861227231827349959449 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 2, 6, 0 => ⟨(279158785601762653275431827 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 3, 0, 5 => ⟨(14645470457248380324013395549 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 3, 1, 4 => ⟨(500087920163149423759661626633 / 12500000000000000000000000000000), (3 / 25000000000000000000000000000000)⟩ + | 3, 2, 3 => ⟨(425575504693914482232192681717 / 1562500000000000000000000000000), (71 / 100000000000000000000000000000000)⟩ + | 3, 3, 2 => ⟨(2485504917108313710539576690779 / 25000000000000000000000000000000), (13 / 50000000000000000000000000000000)⟩ + | 3, 4, 1 => ⟨(102230605927328755004795179633 / 25000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ + | 3, 5, 0 => ⟨(947695798775862187054385307 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | _, _, _ => (.exact 0) +lemma A3_6_7Raw_0_1_7 : (A3_6_7Raw (shape 0 1 7)).Encloses (splitWeight positiveInitial tableP (shape 3 6 7) (shape 0 1 7) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 3 6 7) (shape 0 1 7) + (-7476) (-24711) (-76548) w143 w81 w10 + (by decide +kernel) w143_sound w81_sound w10_sound) (by decide +kernel) +lemma A3_6_7Raw_0_2_6 : (A3_6_7Raw (shape 0 2 6)).Encloses (splitWeight positiveInitial tableP (shape 3 6 7) (shape 0 2 6) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 3 6 7) (shape 0 2 6) + (-7476) (-5530) (-41988) w143 w169 w42 + (by decide +kernel) w143_sound w169_sound w42_sound) (by decide +kernel) +lemma A3_6_7Raw_0_3_5 : (A3_6_7Raw (shape 0 3 5)).Encloses (splitWeight positiveInitial tableP (shape 3 6 7) (shape 0 3 5) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 3 6 7) (shape 0 3 5) + (-7476) (0) (-15608) w143 w195 w111 + (by decide +kernel) w143_sound w195_sound w111_sound) (by decide +kernel) +lemma A3_6_7Raw_0_4_4 : (A3_6_7Raw (shape 0 4 4)).Encloses (splitWeight positiveInitial tableP (shape 3 6 7) (shape 0 4 4) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 3 6 7) (shape 0 4 4) + (-7476) (-5530) (0) w143 w169 w195 + (by decide +kernel) w143_sound w169_sound w195_sound) (by decide +kernel) +lemma A3_6_7Raw_0_5_3 : (A3_6_7Raw (shape 0 5 3)).Encloses (splitWeight positiveInitial tableP (shape 3 6 7) (shape 0 5 3) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 3 6 7) (shape 0 5 3) + (-7476) (-24711) (0) w143 w81 w195 + (by decide +kernel) w143_sound w81_sound w195_sound) (by decide +kernel) +lemma A3_6_7Raw_0_6_2 : (A3_6_7Raw (shape 0 6 2)).Encloses (splitWeight positiveInitial tableP (shape 3 6 7) (shape 0 6 2) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 3 6 7) (shape 0 6 2) + (-7476) (-51341) (-15608) w143 w35 w111 + (by decide +kernel) w143_sound w35_sound w111_sound) (by decide +kernel) +lemma A3_6_7Raw_1_0_7 : (A3_6_7Raw (shape 1 0 7)).Encloses (splitWeight positiveInitial tableP (shape 3 6 7) (shape 1 0 7) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 3 6 7) (shape 1 0 7) + (0) (-51341) (-76548) w195 w35 w10 + (by decide +kernel) w195_sound w35_sound w10_sound) (by decide +kernel) +lemma A3_6_7Raw_1_1_6 : (A3_6_7Raw (shape 1 1 6)).Encloses (splitWeight positiveInitial tableP (shape 3 6 7) (shape 1 1 6) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 3 6 7) (shape 1 1 6) + (0) (-24711) (-41988) w195 w81 w42 + (by decide +kernel) w195_sound w81_sound w42_sound) (by decide +kernel) +lemma A3_6_7Raw_1_2_5 : (A3_6_7Raw (shape 1 2 5)).Encloses (splitWeight positiveInitial tableP (shape 3 6 7) (shape 1 2 5) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 3 6 7) (shape 1 2 5) + (0) (-5530) (-15608) w195 w169 w111 + (by decide +kernel) w195_sound w169_sound w111_sound) (by decide +kernel) +lemma A3_6_7Raw_1_3_4 : (A3_6_7Raw (shape 1 3 4)).Encloses (splitWeight positiveInitial tableP (shape 3 6 7) (shape 1 3 4) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 3 6 7) (shape 1 3 4) + (0) (0) (0) w195 w195 w195 + (by decide +kernel) w195_sound w195_sound w195_sound) (by decide +kernel) +lemma A3_6_7Raw_1_4_3 : (A3_6_7Raw (shape 1 4 3)).Encloses (splitWeight positiveInitial tableP (shape 3 6 7) (shape 1 4 3) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 3 6 7) (shape 1 4 3) + (0) (-5530) (0) w195 w169 w195 + (by decide +kernel) w195_sound w169_sound w195_sound) (by decide +kernel) +lemma A3_6_7Raw_1_5_2 : (A3_6_7Raw (shape 1 5 2)).Encloses (splitWeight positiveInitial tableP (shape 3 6 7) (shape 1 5 2) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 3 6 7) (shape 1 5 2) + (0) (-24711) (-15608) w195 w81 w111 + (by decide +kernel) w195_sound w81_sound w111_sound) (by decide +kernel) +lemma A3_6_7Raw_1_6_1 : (A3_6_7Raw (shape 1 6 1)).Encloses (splitWeight positiveInitial tableP (shape 3 6 7) (shape 1 6 1) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 3 6 7) (shape 1 6 1) + (0) (-51341) (-41988) w195 w35 w42 + (by decide +kernel) w195_sound w35_sound w42_sound) (by decide +kernel) +lemma A3_6_7Raw_2_0_6 : (A3_6_7Raw (shape 2 0 6)).Encloses (splitWeight positiveInitial tableP (shape 3 6 7) (shape 2 0 6) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 3 6 7) (shape 2 0 6) + (0) (-51341) (-41988) w195 w35 w42 + (by decide +kernel) w195_sound w35_sound w42_sound) (by decide +kernel) +lemma A3_6_7Raw_2_1_5 : (A3_6_7Raw (shape 2 1 5)).Encloses (splitWeight positiveInitial tableP (shape 3 6 7) (shape 2 1 5) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 3 6 7) (shape 2 1 5) + (0) (-24711) (-15608) w195 w81 w111 + (by decide +kernel) w195_sound w81_sound w111_sound) (by decide +kernel) +lemma A3_6_7Raw_2_2_4 : (A3_6_7Raw (shape 2 2 4)).Encloses (splitWeight positiveInitial tableP (shape 3 6 7) (shape 2 2 4) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 3 6 7) (shape 2 2 4) + (0) (-5530) (0) w195 w169 w195 + (by decide +kernel) w195_sound w169_sound w195_sound) (by decide +kernel) +lemma A3_6_7Raw_2_3_3 : (A3_6_7Raw (shape 2 3 3)).Encloses (splitWeight positiveInitial tableP (shape 3 6 7) (shape 2 3 3) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 3 6 7) (shape 2 3 3) + (0) (0) (0) w195 w195 w195 + (by decide +kernel) w195_sound w195_sound w195_sound) (by decide +kernel) +lemma A3_6_7Raw_2_4_2 : (A3_6_7Raw (shape 2 4 2)).Encloses (splitWeight positiveInitial tableP (shape 3 6 7) (shape 2 4 2) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 3 6 7) (shape 2 4 2) + (0) (-5530) (-15608) w195 w169 w111 + (by decide +kernel) w195_sound w169_sound w111_sound) (by decide +kernel) +lemma A3_6_7Raw_2_5_1 : (A3_6_7Raw (shape 2 5 1)).Encloses (splitWeight positiveInitial tableP (shape 3 6 7) (shape 2 5 1) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 3 6 7) (shape 2 5 1) + (0) (-24711) (-41988) w195 w81 w42 + (by decide +kernel) w195_sound w81_sound w42_sound) (by decide +kernel) +lemma A3_6_7Raw_2_6_0 : (A3_6_7Raw (shape 2 6 0)).Encloses (splitWeight positiveInitial tableP (shape 3 6 7) (shape 2 6 0) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 3 6 7) (shape 2 6 0) + (0) (-51341) (-76548) w195 w35 w10 + (by decide +kernel) w195_sound w35_sound w10_sound) (by decide +kernel) +lemma A3_6_7Raw_3_0_5 : (A3_6_7Raw (shape 3 0 5)).Encloses (splitWeight positiveInitial tableP (shape 3 6 7) (shape 3 0 5) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 3 6 7) (shape 3 0 5) + (-7476) (-51341) (-15608) w143 w35 w111 + (by decide +kernel) w143_sound w35_sound w111_sound) (by decide +kernel) +lemma A3_6_7Raw_3_1_4 : (A3_6_7Raw (shape 3 1 4)).Encloses (splitWeight positiveInitial tableP (shape 3 6 7) (shape 3 1 4) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 3 6 7) (shape 3 1 4) + (-7476) (-24711) (0) w143 w81 w195 + (by decide +kernel) w143_sound w81_sound w195_sound) (by decide +kernel) +lemma A3_6_7Raw_3_2_3 : (A3_6_7Raw (shape 3 2 3)).Encloses (splitWeight positiveInitial tableP (shape 3 6 7) (shape 3 2 3) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 3 6 7) (shape 3 2 3) + (-7476) (-5530) (0) w143 w169 w195 + (by decide +kernel) w143_sound w169_sound w195_sound) (by decide +kernel) +lemma A3_6_7Raw_3_3_2 : (A3_6_7Raw (shape 3 3 2)).Encloses (splitWeight positiveInitial tableP (shape 3 6 7) (shape 3 3 2) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 3 6 7) (shape 3 3 2) + (-7476) (0) (-15608) w143 w195 w111 + (by decide +kernel) w143_sound w195_sound w111_sound) (by decide +kernel) +lemma A3_6_7Raw_3_4_1 : (A3_6_7Raw (shape 3 4 1)).Encloses (splitWeight positiveInitial tableP (shape 3 6 7) (shape 3 4 1) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 3 6 7) (shape 3 4 1) + (-7476) (-5530) (-41988) w143 w169 w42 + (by decide +kernel) w143_sound w169_sound w42_sound) (by decide +kernel) +lemma A3_6_7Raw_3_5_0 : (A3_6_7Raw (shape 3 5 0)).Encloses (splitWeight positiveInitial tableP (shape 3 6 7) (shape 3 5 0) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 3 6 7) (shape 3 5 0) + (-7476) (-24711) (-76548) w143 w81 w10 + (by decide +kernel) w143_sound w81_sound w10_sound) (by decide +kernel) +lemma A3_6_7Raw_sound (u : Shape) (hu : u ∈ below (shape 3 6 7)) : + (A3_6_7Raw u).Encloses (splitWeight positiveInitial tableP (shape 3 6 7) u : ℝ) := by + rw [A3_6_7_below] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl + · exact A3_6_7Raw_0_1_7 + · exact A3_6_7Raw_0_2_6 + · exact A3_6_7Raw_0_3_5 + · exact A3_6_7Raw_0_4_4 + · exact A3_6_7Raw_0_5_3 + · exact A3_6_7Raw_0_6_2 + · exact A3_6_7Raw_1_0_7 + · exact A3_6_7Raw_1_1_6 + · exact A3_6_7Raw_1_2_5 + · exact A3_6_7Raw_1_3_4 + · exact A3_6_7Raw_1_4_3 + · exact A3_6_7Raw_1_5_2 + · exact A3_6_7Raw_1_6_1 + · exact A3_6_7Raw_2_0_6 + · exact A3_6_7Raw_2_1_5 + · exact A3_6_7Raw_2_2_4 + · exact A3_6_7Raw_2_3_3 + · exact A3_6_7Raw_2_4_2 + · exact A3_6_7Raw_2_5_1 + · exact A3_6_7Raw_2_6_0 + · exact A3_6_7Raw_3_0_5 + · exact A3_6_7Raw_3_1_4 + · exact A3_6_7Raw_3_2_3 + · exact A3_6_7Raw_3_3_2 + · exact A3_6_7Raw_3_4_1 + · exact A3_6_7Raw_3_5_0 +def A3_6_7Den : Ball := ⟨(26644870182285812255234624802301 / 6250000000000000000000000000000), (57 / 12500000000000000000000000000000)⟩ +lemma A3_6_7Den_sound : A3_6_7Den.Encloses (((below (shape 3 6 7)).map (splitWeight positiveInitial tableP (shape 3 6 7))).sum : ℝ) := by + exact contains_sound (list_cast_enclosed (below (shape 3 6 7)) A3_6_7Raw (splitWeight positiveInitial tableP (shape 3 6 7)) A3_6_7Raw_sound) (by decide +kernel) +lemma A3_6_7Den_positive : 0 < A3_6_7Den.lower := by decide +kernel +def A3_6_7Table (s : Shape) : Ball := + match s 0, s 1, s 2 with + | 0, 1, 7 => ⟨(444595804132456643872751423 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 0, 2, 6 => ⟨(95919594679892889239193974057 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 0, 3, 5 => ⟨(466413403425162984942828299979 / 20000000000000000000000000000000), (9 / 100000000000000000000000000000000)⟩ + | 0, 4, 4 => ⟨(159721365419467461928662332981 / 2500000000000000000000000000000), (3 / 12500000000000000000000000000000)⟩ + | 0, 5, 3 => ⟨(938431894660947905675404500739 / 100000000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ + | 0, 6, 2 => ⟨(6870680152058435330563692671 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 1, 0, 7 => ⟨(32740681378342119614199523 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 1, 1, 6 => ⟨(29755389793283097286725257379 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 1, 2, 5 => ⟨(177065826198824108960514164357 / 6250000000000000000000000000000), (11 / 100000000000000000000000000000000)⟩ + | 1, 3, 4 => ⟨(23456672737535644093331931145797 / 100000000000000000000000000000000), (13 / 50000000000000000000000000000000)⟩ + | 1, 4, 3 => ⟨(52706186556690537444005286707 / 390625000000000000000000000000), (1 / 3125000000000000000000000000000)⟩ + | 1, 5, 2 => ⟨(416135232310544407998215611629 / 100000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ + | 1, 6, 1 => ⟨(2075101950204864030086128749 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 2, 0, 6 => ⟨(2075101950204864030086128749 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 2, 1, 5 => ⟨(416135232310544407998215611629 / 100000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ + | 2, 2, 4 => ⟨(52706186556690537444005286707 / 390625000000000000000000000000), (1 / 3125000000000000000000000000000)⟩ + | 2, 3, 3 => ⟨(23456672737535644093331931145797 / 100000000000000000000000000000000), (13 / 50000000000000000000000000000000)⟩ + | 2, 4, 2 => ⟨(177065826198824108960514164357 / 6250000000000000000000000000000), (11 / 100000000000000000000000000000000)⟩ + | 2, 5, 1 => ⟨(29755389793283097286725257379 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 2, 6, 0 => ⟨(32740681378342119614199523 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 3, 0, 5 => ⟨(6870680152058435330563692671 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 3, 1, 4 => ⟨(938431894660947905675404500739 / 100000000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ + | 3, 2, 3 => ⟨(159721365419467461928662332981 / 2500000000000000000000000000000), (3 / 12500000000000000000000000000000)⟩ + | 3, 3, 2 => ⟨(466413403425162984942828299979 / 20000000000000000000000000000000), (9 / 100000000000000000000000000000000)⟩ + | 3, 4, 1 => ⟨(95919594679892889239193974057 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 3, 5, 0 => ⟨(444595804132456643872751423 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | _, _, _ => (.exact 0) +def A3_6_7Law (u : Shape) : Ball := if u ∈ below (shape 3 6 7) then A3_6_7Table u else .exact 0 +lemma A3_6_7Law_check_0_1_7 : contains (.mul (A3_6_7Raw (shape 0 1 7)) (.inv A3_6_7Den)) (A3_6_7Table (shape 0 1 7)) = true := by decide +kernel +lemma A3_6_7Law_check_0_2_6 : contains (.mul (A3_6_7Raw (shape 0 2 6)) (.inv A3_6_7Den)) (A3_6_7Table (shape 0 2 6)) = true := by decide +kernel +lemma A3_6_7Law_check_0_3_5 : contains (.mul (A3_6_7Raw (shape 0 3 5)) (.inv A3_6_7Den)) (A3_6_7Table (shape 0 3 5)) = true := by decide +kernel +lemma A3_6_7Law_check_0_4_4 : contains (.mul (A3_6_7Raw (shape 0 4 4)) (.inv A3_6_7Den)) (A3_6_7Table (shape 0 4 4)) = true := by decide +kernel +lemma A3_6_7Law_check_0_5_3 : contains (.mul (A3_6_7Raw (shape 0 5 3)) (.inv A3_6_7Den)) (A3_6_7Table (shape 0 5 3)) = true := by decide +kernel +lemma A3_6_7Law_check_0_6_2 : contains (.mul (A3_6_7Raw (shape 0 6 2)) (.inv A3_6_7Den)) (A3_6_7Table (shape 0 6 2)) = true := by decide +kernel +lemma A3_6_7Law_check_1_0_7 : contains (.mul (A3_6_7Raw (shape 1 0 7)) (.inv A3_6_7Den)) (A3_6_7Table (shape 1 0 7)) = true := by decide +kernel +lemma A3_6_7Law_check_1_1_6 : contains (.mul (A3_6_7Raw (shape 1 1 6)) (.inv A3_6_7Den)) (A3_6_7Table (shape 1 1 6)) = true := by decide +kernel +lemma A3_6_7Law_check_1_2_5 : contains (.mul (A3_6_7Raw (shape 1 2 5)) (.inv A3_6_7Den)) (A3_6_7Table (shape 1 2 5)) = true := by decide +kernel +lemma A3_6_7Law_check_1_3_4 : contains (.mul (A3_6_7Raw (shape 1 3 4)) (.inv A3_6_7Den)) (A3_6_7Table (shape 1 3 4)) = true := by decide +kernel +lemma A3_6_7Law_check_1_4_3 : contains (.mul (A3_6_7Raw (shape 1 4 3)) (.inv A3_6_7Den)) (A3_6_7Table (shape 1 4 3)) = true := by decide +kernel +lemma A3_6_7Law_check_1_5_2 : contains (.mul (A3_6_7Raw (shape 1 5 2)) (.inv A3_6_7Den)) (A3_6_7Table (shape 1 5 2)) = true := by decide +kernel +lemma A3_6_7Law_check_1_6_1 : contains (.mul (A3_6_7Raw (shape 1 6 1)) (.inv A3_6_7Den)) (A3_6_7Table (shape 1 6 1)) = true := by decide +kernel +lemma A3_6_7Law_check_2_0_6 : contains (.mul (A3_6_7Raw (shape 2 0 6)) (.inv A3_6_7Den)) (A3_6_7Table (shape 2 0 6)) = true := by decide +kernel +lemma A3_6_7Law_check_2_1_5 : contains (.mul (A3_6_7Raw (shape 2 1 5)) (.inv A3_6_7Den)) (A3_6_7Table (shape 2 1 5)) = true := by decide +kernel +lemma A3_6_7Law_check_2_2_4 : contains (.mul (A3_6_7Raw (shape 2 2 4)) (.inv A3_6_7Den)) (A3_6_7Table (shape 2 2 4)) = true := by decide +kernel +lemma A3_6_7Law_check_2_3_3 : contains (.mul (A3_6_7Raw (shape 2 3 3)) (.inv A3_6_7Den)) (A3_6_7Table (shape 2 3 3)) = true := by decide +kernel +lemma A3_6_7Law_check_2_4_2 : contains (.mul (A3_6_7Raw (shape 2 4 2)) (.inv A3_6_7Den)) (A3_6_7Table (shape 2 4 2)) = true := by decide +kernel +lemma A3_6_7Law_check_2_5_1 : contains (.mul (A3_6_7Raw (shape 2 5 1)) (.inv A3_6_7Den)) (A3_6_7Table (shape 2 5 1)) = true := by decide +kernel +lemma A3_6_7Law_check_2_6_0 : contains (.mul (A3_6_7Raw (shape 2 6 0)) (.inv A3_6_7Den)) (A3_6_7Table (shape 2 6 0)) = true := by decide +kernel +lemma A3_6_7Law_check_3_0_5 : contains (.mul (A3_6_7Raw (shape 3 0 5)) (.inv A3_6_7Den)) (A3_6_7Table (shape 3 0 5)) = true := by decide +kernel +lemma A3_6_7Law_check_3_1_4 : contains (.mul (A3_6_7Raw (shape 3 1 4)) (.inv A3_6_7Den)) (A3_6_7Table (shape 3 1 4)) = true := by decide +kernel +lemma A3_6_7Law_check_3_2_3 : contains (.mul (A3_6_7Raw (shape 3 2 3)) (.inv A3_6_7Den)) (A3_6_7Table (shape 3 2 3)) = true := by decide +kernel +lemma A3_6_7Law_check_3_3_2 : contains (.mul (A3_6_7Raw (shape 3 3 2)) (.inv A3_6_7Den)) (A3_6_7Table (shape 3 3 2)) = true := by decide +kernel +lemma A3_6_7Law_check_3_4_1 : contains (.mul (A3_6_7Raw (shape 3 4 1)) (.inv A3_6_7Den)) (A3_6_7Table (shape 3 4 1)) = true := by decide +kernel +lemma A3_6_7Law_check_3_5_0 : contains (.mul (A3_6_7Raw (shape 3 5 0)) (.inv A3_6_7Den)) (A3_6_7Table (shape 3 5 0)) = true := by decide +kernel +lemma A3_6_7Law_check (u : Shape) (hu : u ∈ below (shape 3 6 7)) : + contains (.mul (A3_6_7Raw u) (.inv A3_6_7Den)) (A3_6_7Table u) = true := by + rw [A3_6_7_below] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl + · exact A3_6_7Law_check_0_1_7 + · exact A3_6_7Law_check_0_2_6 + · exact A3_6_7Law_check_0_3_5 + · exact A3_6_7Law_check_0_4_4 + · exact A3_6_7Law_check_0_5_3 + · exact A3_6_7Law_check_0_6_2 + · exact A3_6_7Law_check_1_0_7 + · exact A3_6_7Law_check_1_1_6 + · exact A3_6_7Law_check_1_2_5 + · exact A3_6_7Law_check_1_3_4 + · exact A3_6_7Law_check_1_4_3 + · exact A3_6_7Law_check_1_5_2 + · exact A3_6_7Law_check_1_6_1 + · exact A3_6_7Law_check_2_0_6 + · exact A3_6_7Law_check_2_1_5 + · exact A3_6_7Law_check_2_2_4 + · exact A3_6_7Law_check_2_3_3 + · exact A3_6_7Law_check_2_4_2 + · exact A3_6_7Law_check_2_5_1 + · exact A3_6_7Law_check_2_6_0 + · exact A3_6_7Law_check_3_0_5 + · exact A3_6_7Law_check_3_1_4 + · exact A3_6_7Law_check_3_2_3 + · exact A3_6_7Law_check_3_3_2 + · exact A3_6_7Law_check_3_4_1 + · exact A3_6_7Law_check_3_5_0 +lemma A3_6_7Law_sound (u : Shape) : + (A3_6_7Law u).Encloses (stageALaw (shape 3 6 7) u : ℝ) := by + by_cases hu : u ∈ below (shape 3 6 7) + · have h := contains_sound (Ball.mul_sound (A3_6_7Raw_sound u hu) + (Ball.inv_sound A3_6_7Den_sound A3_6_7Den_positive)) (A3_6_7Law_check u hu) + simpa only [A3_6_7Law, hu, ite_true, stageALaw, splitLaw, + Rat.cast_div, Rat.cast_mul, Rat.cast_inv, div_eq_mul_inv] using h + · simp only [A3_6_7Law, hu, ite_false, stageALaw, splitLaw, Rat.cast_zero] + simpa only [Rat.cast_zero] using Ball.exact_sound 0 + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/Certificates/SplitA4_5_7.lean b/lean/OAI/LinearAlgebra/MatrixFields/Certificates/SplitA4_5_7.lean new file mode 100644 index 0000000000000000000000000000000000000000..5fcd924e793ecdc0e5db000717c9c6028f553478 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/Certificates/SplitA4_5_7.lean @@ -0,0 +1,335 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Certificates.SplitB1_3_4 + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate +open scoped BigOperators +lemma A4_5_7_below : below (shape 4 5 7) = [ + (shape 0 1 7), + (shape 0 2 6), + (shape 0 3 5), + (shape 0 4 4), + (shape 0 5 3), + (shape 1 0 7), + (shape 1 1 6), + (shape 1 2 5), + (shape 1 3 4), + (shape 1 4 3), + (shape 1 5 2), + (shape 2 0 6), + (shape 2 1 5), + (shape 2 2 4), + (shape 2 3 3), + (shape 2 4 2), + (shape 2 5 1), + (shape 3 0 5), + (shape 3 1 4), + (shape 3 2 3), + (shape 3 3 2), + (shape 3 4 1), + (shape 3 5 0), + (shape 4 0 4), + (shape 4 1 3), + (shape 4 2 2), + (shape 4 3 1), + (shape 4 4 0)] := by decide +kernel +def A4_5_7Raw (s : Shape) : Ball := + match s 0, s 1, s 2 with + | 0, 1, 7 => ⟨(320070995306194163489326983 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 0, 2, 6 => ⟨(111908131966907707297208391469 / 50000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ + | 0, 3, 5 => ⟨(924572162836136938580133522067 / 25000000000000000000000000000000), (3 / 25000000000000000000000000000000)⟩ + | 0, 4, 4 => ⟨(1712194403755276647553732402859 / 25000000000000000000000000000000), (21 / 100000000000000000000000000000000)⟩ + | 0, 5, 3 => ⟨(86252921110897044875603592223 / 12500000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ + | 1, 0, 7 => ⟨(563000628202886554057056869 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 1, 1, 6 => ⟨(17983177592845578600362644283 / 6250000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ + | 1, 2, 5 => ⟨(258269201999648166411752129327 / 2000000000000000000000000000000), (9 / 25000000000000000000000000000000)⟩ + | 1, 3, 4 => ⟨(32476703126909447167938135835733 / 50000000000000000000000000000000), (1 / 1250000000000000000000000000000)⟩ + | 1, 4, 3 => ⟨(1494634153844948446443758553957 / 6250000000000000000000000000000), (63 / 100000000000000000000000000000000)⟩ + | 1, 5, 2 => ⟨(47901191170901796701943780139 / 10000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ + | 2, 0, 6 => ⟨(2789428518380002493238768961 / 6250000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 2, 1, 5 => ⟨(7319706166566425133179750241413 / 100000000000000000000000000000000), (11 / 50000000000000000000000000000000)⟩ + | 2, 2, 4 => ⟨1, 0⟩ + | 2, 3, 3 => ⟨1, 0⟩ + | 2, 4, 2 => ⟨(7319706166566425133179750241413 / 100000000000000000000000000000000), (11 / 50000000000000000000000000000000)⟩ + | 2, 5, 1 => ⟨(2789428518380002493238768961 / 6250000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 3, 0, 5 => ⟨(47901191170901796701943780139 / 10000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ + | 3, 1, 4 => ⟨(1494634153844948446443758553957 / 6250000000000000000000000000000), (63 / 100000000000000000000000000000000)⟩ + | 3, 2, 3 => ⟨(32476703126909447167938135835733 / 50000000000000000000000000000000), (1 / 1250000000000000000000000000000)⟩ + | 3, 3, 2 => ⟨(258269201999648166411752129327 / 2000000000000000000000000000000), (9 / 25000000000000000000000000000000)⟩ + | 3, 4, 1 => ⟨(17983177592845578600362644283 / 6250000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ + | 3, 5, 0 => ⟨(563000628202886554057056869 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 4, 0, 4 => ⟨(86252921110897044875603592223 / 12500000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ + | 4, 1, 3 => ⟨(1712194403755276647553732402859 / 25000000000000000000000000000000), (21 / 100000000000000000000000000000000)⟩ + | 4, 2, 2 => ⟨(924572162836136938580133522067 / 25000000000000000000000000000000), (3 / 25000000000000000000000000000000)⟩ + | 4, 3, 1 => ⟨(111908131966907707297208391469 / 50000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ + | 4, 4, 0 => ⟨(320070995306194163489326983 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | _, _, _ => (.exact 0) +lemma A4_5_7Raw_0_1_7 : (A4_5_7Raw (shape 0 1 7)).Encloses (splitWeight positiveInitial tableP (shape 4 5 7) (shape 0 1 7) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 4 5 7) (shape 0 1 7) + (-16819) (-9992) (-83616) w102 w129 w7 + (by decide +kernel) w102_sound w129_sound w7_sound) (by decide +kernel) +lemma A4_5_7Raw_0_2_6 : (A4_5_7Raw (shape 0 2 6)).Encloses (splitWeight positiveInitial tableP (shape 4 5 7) (shape 0 2 6) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 4 5 7) (shape 0 2 6) + (-16819) (0) (-44202) w102 w195 w40 + (by decide +kernel) w102_sound w195_sound w40_sound) (by decide +kernel) +lemma A4_5_7Raw_0_3_5 : (A4_5_7Raw (shape 0 3 5)).Encloses (splitWeight positiveInitial tableP (shape 4 5 7) (shape 0 3 5) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 4 5 7) (shape 0 3 5) + (-16819) (0) (-16154) w102 w195 w109 + (by decide +kernel) w102_sound w195_sound w109_sound) (by decide +kernel) +lemma A4_5_7Raw_0_4_4 : (A4_5_7Raw (shape 0 4 4)).Encloses (splitWeight positiveInitial tableP (shape 4 5 7) (shape 0 4 4) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 4 5 7) (shape 0 4 4) + (-16819) (-9992) (0) w102 w129 w195 + (by decide +kernel) w102_sound w129_sound w195_sound) (by decide +kernel) +lemma A4_5_7Raw_0_5_3 : (A4_5_7Raw (shape 0 5 3)).Encloses (splitWeight positiveInitial tableP (shape 4 5 7) (shape 0 5 3) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 4 5 7) (shape 0 5 3) + (-16819) (-32943) (0) w102 w60 w195 + (by decide +kernel) w102_sound w60_sound w195_sound) (by decide +kernel) +lemma A4_5_7Raw_1_0_7 : (A4_5_7Raw (shape 1 0 7)).Encloses (splitWeight positiveInitial tableP (shape 4 5 7) (shape 1 0 7) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 4 5 7) (shape 1 0 7) + (-4315) (-32943) (-83616) w177 w60 w7 + (by decide +kernel) w177_sound w60_sound w7_sound) (by decide +kernel) +lemma A4_5_7Raw_1_1_6 : (A4_5_7Raw (shape 1 1 6)).Encloses (splitWeight positiveInitial tableP (shape 4 5 7) (shape 1 1 6) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 4 5 7) (shape 1 1 6) + (-4315) (-9992) (-44202) w177 w129 w40 + (by decide +kernel) w177_sound w129_sound w40_sound) (by decide +kernel) +lemma A4_5_7Raw_1_2_5 : (A4_5_7Raw (shape 1 2 5)).Encloses (splitWeight positiveInitial tableP (shape 4 5 7) (shape 1 2 5) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 4 5 7) (shape 1 2 5) + (-4315) (0) (-16154) w177 w195 w109 + (by decide +kernel) w177_sound w195_sound w109_sound) (by decide +kernel) +lemma A4_5_7Raw_1_3_4 : (A4_5_7Raw (shape 1 3 4)).Encloses (splitWeight positiveInitial tableP (shape 4 5 7) (shape 1 3 4) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 4 5 7) (shape 1 3 4) + (-4315) (0) (0) w177 w195 w195 + (by decide +kernel) w177_sound w195_sound w195_sound) (by decide +kernel) +lemma A4_5_7Raw_1_4_3 : (A4_5_7Raw (shape 1 4 3)).Encloses (splitWeight positiveInitial tableP (shape 4 5 7) (shape 1 4 3) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 4 5 7) (shape 1 4 3) + (-4315) (-9992) (0) w177 w129 w195 + (by decide +kernel) w177_sound w129_sound w195_sound) (by decide +kernel) +lemma A4_5_7Raw_1_5_2 : (A4_5_7Raw (shape 1 5 2)).Encloses (splitWeight positiveInitial tableP (shape 4 5 7) (shape 1 5 2) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 4 5 7) (shape 1 5 2) + (-4315) (-32943) (-16154) w177 w60 w109 + (by decide +kernel) w177_sound w60_sound w109_sound) (by decide +kernel) +lemma A4_5_7Raw_2_0_6 : (A4_5_7Raw (shape 2 0 6)).Encloses (splitWeight positiveInitial tableP (shape 4 5 7) (shape 2 0 6) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 4 5 7) (shape 2 0 6) + (0) (-32943) (-44202) w195 w60 w40 + (by decide +kernel) w195_sound w60_sound w40_sound) (by decide +kernel) +lemma A4_5_7Raw_2_1_5 : (A4_5_7Raw (shape 2 1 5)).Encloses (splitWeight positiveInitial tableP (shape 4 5 7) (shape 2 1 5) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 4 5 7) (shape 2 1 5) + (0) (-9992) (-16154) w195 w129 w109 + (by decide +kernel) w195_sound w129_sound w109_sound) (by decide +kernel) +lemma A4_5_7Raw_2_2_4 : (A4_5_7Raw (shape 2 2 4)).Encloses (splitWeight positiveInitial tableP (shape 4 5 7) (shape 2 2 4) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 4 5 7) (shape 2 2 4) + (0) (0) (0) w195 w195 w195 + (by decide +kernel) w195_sound w195_sound w195_sound) (by decide +kernel) +lemma A4_5_7Raw_2_3_3 : (A4_5_7Raw (shape 2 3 3)).Encloses (splitWeight positiveInitial tableP (shape 4 5 7) (shape 2 3 3) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 4 5 7) (shape 2 3 3) + (0) (0) (0) w195 w195 w195 + (by decide +kernel) w195_sound w195_sound w195_sound) (by decide +kernel) +lemma A4_5_7Raw_2_4_2 : (A4_5_7Raw (shape 2 4 2)).Encloses (splitWeight positiveInitial tableP (shape 4 5 7) (shape 2 4 2) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 4 5 7) (shape 2 4 2) + (0) (-9992) (-16154) w195 w129 w109 + (by decide +kernel) w195_sound w129_sound w109_sound) (by decide +kernel) +lemma A4_5_7Raw_2_5_1 : (A4_5_7Raw (shape 2 5 1)).Encloses (splitWeight positiveInitial tableP (shape 4 5 7) (shape 2 5 1) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 4 5 7) (shape 2 5 1) + (0) (-32943) (-44202) w195 w60 w40 + (by decide +kernel) w195_sound w60_sound w40_sound) (by decide +kernel) +lemma A4_5_7Raw_3_0_5 : (A4_5_7Raw (shape 3 0 5)).Encloses (splitWeight positiveInitial tableP (shape 4 5 7) (shape 3 0 5) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 4 5 7) (shape 3 0 5) + (-4315) (-32943) (-16154) w177 w60 w109 + (by decide +kernel) w177_sound w60_sound w109_sound) (by decide +kernel) +lemma A4_5_7Raw_3_1_4 : (A4_5_7Raw (shape 3 1 4)).Encloses (splitWeight positiveInitial tableP (shape 4 5 7) (shape 3 1 4) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 4 5 7) (shape 3 1 4) + (-4315) (-9992) (0) w177 w129 w195 + (by decide +kernel) w177_sound w129_sound w195_sound) (by decide +kernel) +lemma A4_5_7Raw_3_2_3 : (A4_5_7Raw (shape 3 2 3)).Encloses (splitWeight positiveInitial tableP (shape 4 5 7) (shape 3 2 3) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 4 5 7) (shape 3 2 3) + (-4315) (0) (0) w177 w195 w195 + (by decide +kernel) w177_sound w195_sound w195_sound) (by decide +kernel) +lemma A4_5_7Raw_3_3_2 : (A4_5_7Raw (shape 3 3 2)).Encloses (splitWeight positiveInitial tableP (shape 4 5 7) (shape 3 3 2) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 4 5 7) (shape 3 3 2) + (-4315) (0) (-16154) w177 w195 w109 + (by decide +kernel) w177_sound w195_sound w109_sound) (by decide +kernel) +lemma A4_5_7Raw_3_4_1 : (A4_5_7Raw (shape 3 4 1)).Encloses (splitWeight positiveInitial tableP (shape 4 5 7) (shape 3 4 1) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 4 5 7) (shape 3 4 1) + (-4315) (-9992) (-44202) w177 w129 w40 + (by decide +kernel) w177_sound w129_sound w40_sound) (by decide +kernel) +lemma A4_5_7Raw_3_5_0 : (A4_5_7Raw (shape 3 5 0)).Encloses (splitWeight positiveInitial tableP (shape 4 5 7) (shape 3 5 0) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 4 5 7) (shape 3 5 0) + (-4315) (-32943) (-83616) w177 w60 w7 + (by decide +kernel) w177_sound w60_sound w7_sound) (by decide +kernel) +lemma A4_5_7Raw_4_0_4 : (A4_5_7Raw (shape 4 0 4)).Encloses (splitWeight positiveInitial tableP (shape 4 5 7) (shape 4 0 4) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 4 5 7) (shape 4 0 4) + (-16819) (-32943) (0) w102 w60 w195 + (by decide +kernel) w102_sound w60_sound w195_sound) (by decide +kernel) +lemma A4_5_7Raw_4_1_3 : (A4_5_7Raw (shape 4 1 3)).Encloses (splitWeight positiveInitial tableP (shape 4 5 7) (shape 4 1 3) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 4 5 7) (shape 4 1 3) + (-16819) (-9992) (0) w102 w129 w195 + (by decide +kernel) w102_sound w129_sound w195_sound) (by decide +kernel) +lemma A4_5_7Raw_4_2_2 : (A4_5_7Raw (shape 4 2 2)).Encloses (splitWeight positiveInitial tableP (shape 4 5 7) (shape 4 2 2) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 4 5 7) (shape 4 2 2) + (-16819) (0) (-16154) w102 w195 w109 + (by decide +kernel) w102_sound w195_sound w109_sound) (by decide +kernel) +lemma A4_5_7Raw_4_3_1 : (A4_5_7Raw (shape 4 3 1)).Encloses (splitWeight positiveInitial tableP (shape 4 5 7) (shape 4 3 1) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 4 5 7) (shape 4 3 1) + (-16819) (0) (-44202) w102 w195 w40 + (by decide +kernel) w102_sound w195_sound w40_sound) (by decide +kernel) +lemma A4_5_7Raw_4_4_0 : (A4_5_7Raw (shape 4 4 0)).Encloses (splitWeight positiveInitial tableP (shape 4 5 7) (shape 4 4 0) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 4 5 7) (shape 4 4 0) + (-16819) (-9992) (-83616) w102 w129 w7 + (by decide +kernel) w102_sound w129_sound w7_sound) (by decide +kernel) +lemma A4_5_7Raw_sound (u : Shape) (hu : u ∈ below (shape 4 5 7)) : + (A4_5_7Raw u).Encloses (splitWeight positiveInitial tableP (shape 4 5 7) u : ℝ) := by + rw [A4_5_7_below] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl + · exact A4_5_7Raw_0_1_7 + · exact A4_5_7Raw_0_2_6 + · exact A4_5_7Raw_0_3_5 + · exact A4_5_7Raw_0_4_4 + · exact A4_5_7Raw_0_5_3 + · exact A4_5_7Raw_1_0_7 + · exact A4_5_7Raw_1_1_6 + · exact A4_5_7Raw_1_2_5 + · exact A4_5_7Raw_1_3_4 + · exact A4_5_7Raw_1_4_3 + · exact A4_5_7Raw_1_5_2 + · exact A4_5_7Raw_2_0_6 + · exact A4_5_7Raw_2_1_5 + · exact A4_5_7Raw_2_2_4 + · exact A4_5_7Raw_2_3_3 + · exact A4_5_7Raw_2_4_2 + · exact A4_5_7Raw_2_5_1 + · exact A4_5_7Raw_3_0_5 + · exact A4_5_7Raw_3_1_4 + · exact A4_5_7Raw_3_2_3 + · exact A4_5_7Raw_3_3_2 + · exact A4_5_7Raw_3_4_1 + · exact A4_5_7Raw_3_5_0 + · exact A4_5_7Raw_4_0_4 + · exact A4_5_7Raw_4_1_3 + · exact A4_5_7Raw_4_2_2 + · exact A4_5_7Raw_4_3_1 + · exact A4_5_7Raw_4_4_0 +def A4_5_7Den : Ball := ⟨(44275032369233382034553407713609 / 10000000000000000000000000000000), (247 / 50000000000000000000000000000000)⟩ +lemma A4_5_7Den_sound : A4_5_7Den.Encloses (((below (shape 4 5 7)).map (splitWeight positiveInitial tableP (shape 4 5 7))).sum : ℝ) := by + exact contains_sound (list_cast_enclosed (below (shape 4 5 7)) A4_5_7Raw (splitWeight positiveInitial tableP (shape 4 5 7)) A4_5_7Raw_sound) (by decide +kernel) +lemma A4_5_7Den_positive : 0 < A4_5_7Den.lower := by decide +kernel +def A4_5_7Table (s : Shape) : Ball := + match s 0, s 1, s 2 with + | 0, 1, 7 => ⟨(72291532762065411961625181 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 0, 2, 6 => ⟨(50551349588474794800387489967 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 0, 3, 5 => ⟨(835298915312477561452360781693 / 100000000000000000000000000000000), (1 / 20000000000000000000000000000000)⟩ + | 0, 4, 4 => ⟨(1546871283549937362097791005049 / 100000000000000000000000000000000), (7 / 100000000000000000000000000000000)⟩ + | 0, 5, 3 => ⟨(155849320025945821317144591277 / 100000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ + | 1, 0, 7 => ⟨(127159845645672388759135689 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 1, 1, 6 => ⟨(16246788883517155613847561503 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 1, 2, 5 => ⟨(2916646111580472154804741948879 / 100000000000000000000000000000000), (3 / 25000000000000000000000000000000)⟩ + | 1, 3, 4 => ⟨(14670436762674140168945445265753 / 100000000000000000000000000000000), (7 / 20000000000000000000000000000000)⟩ + | 1, 4, 3 => ⟨(5401271367141237916102377734777 / 100000000000000000000000000000000), (21 / 100000000000000000000000000000000)⟩ + | 1, 5, 2 => ⟨(108190076003621906016955145267 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 2, 0, 6 => ⟨(1008036672268904292945876487 / 10000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 2, 1, 5 => ⟨(413308911076758019532532898899 / 25000000000000000000000000000000), (1 / 12500000000000000000000000000000)⟩ + | 2, 2, 4 => ⟨(11293046515025223285749624084633 / 50000000000000000000000000000000), (13 / 50000000000000000000000000000000)⟩ + | 2, 3, 3 => ⟨(11293046515025223285749624084633 / 50000000000000000000000000000000), (13 / 50000000000000000000000000000000)⟩ + | 2, 4, 2 => ⟨(413308911076758019532532898899 / 25000000000000000000000000000000), (1 / 12500000000000000000000000000000)⟩ + | 2, 5, 1 => ⟨(1008036672268904292945876487 / 10000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 3, 0, 5 => ⟨(108190076003621906016955145267 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 3, 1, 4 => ⟨(5401271367141237916102377734777 / 100000000000000000000000000000000), (21 / 100000000000000000000000000000000)⟩ + | 3, 2, 3 => ⟨(14670436762674140168945445265753 / 100000000000000000000000000000000), (7 / 20000000000000000000000000000000)⟩ + | 3, 3, 2 => ⟨(2916646111580472154804741948879 / 100000000000000000000000000000000), (3 / 25000000000000000000000000000000)⟩ + | 3, 4, 1 => ⟨(16246788883517155613847561503 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 3, 5, 0 => ⟨(127159845645672388759135689 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 4, 0, 4 => ⟨(155849320025945821317144591277 / 100000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ + | 4, 1, 3 => ⟨(1546871283549937362097791005049 / 100000000000000000000000000000000), (7 / 100000000000000000000000000000000)⟩ + | 4, 2, 2 => ⟨(835298915312477561452360781693 / 100000000000000000000000000000000), (1 / 20000000000000000000000000000000)⟩ + | 4, 3, 1 => ⟨(50551349588474794800387489967 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 4, 4, 0 => ⟨(72291532762065411961625181 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | _, _, _ => (.exact 0) +def A4_5_7Law (u : Shape) : Ball := if u ∈ below (shape 4 5 7) then A4_5_7Table u else .exact 0 +lemma A4_5_7Law_check_0_1_7 : contains (.mul (A4_5_7Raw (shape 0 1 7)) (.inv A4_5_7Den)) (A4_5_7Table (shape 0 1 7)) = true := by decide +kernel +lemma A4_5_7Law_check_0_2_6 : contains (.mul (A4_5_7Raw (shape 0 2 6)) (.inv A4_5_7Den)) (A4_5_7Table (shape 0 2 6)) = true := by decide +kernel +lemma A4_5_7Law_check_0_3_5 : contains (.mul (A4_5_7Raw (shape 0 3 5)) (.inv A4_5_7Den)) (A4_5_7Table (shape 0 3 5)) = true := by decide +kernel +lemma A4_5_7Law_check_0_4_4 : contains (.mul (A4_5_7Raw (shape 0 4 4)) (.inv A4_5_7Den)) (A4_5_7Table (shape 0 4 4)) = true := by decide +kernel +lemma A4_5_7Law_check_0_5_3 : contains (.mul (A4_5_7Raw (shape 0 5 3)) (.inv A4_5_7Den)) (A4_5_7Table (shape 0 5 3)) = true := by decide +kernel +lemma A4_5_7Law_check_1_0_7 : contains (.mul (A4_5_7Raw (shape 1 0 7)) (.inv A4_5_7Den)) (A4_5_7Table (shape 1 0 7)) = true := by decide +kernel +lemma A4_5_7Law_check_1_1_6 : contains (.mul (A4_5_7Raw (shape 1 1 6)) (.inv A4_5_7Den)) (A4_5_7Table (shape 1 1 6)) = true := by decide +kernel +lemma A4_5_7Law_check_1_2_5 : contains (.mul (A4_5_7Raw (shape 1 2 5)) (.inv A4_5_7Den)) (A4_5_7Table (shape 1 2 5)) = true := by decide +kernel +lemma A4_5_7Law_check_1_3_4 : contains (.mul (A4_5_7Raw (shape 1 3 4)) (.inv A4_5_7Den)) (A4_5_7Table (shape 1 3 4)) = true := by decide +kernel +lemma A4_5_7Law_check_1_4_3 : contains (.mul (A4_5_7Raw (shape 1 4 3)) (.inv A4_5_7Den)) (A4_5_7Table (shape 1 4 3)) = true := by decide +kernel +lemma A4_5_7Law_check_1_5_2 : contains (.mul (A4_5_7Raw (shape 1 5 2)) (.inv A4_5_7Den)) (A4_5_7Table (shape 1 5 2)) = true := by decide +kernel +lemma A4_5_7Law_check_2_0_6 : contains (.mul (A4_5_7Raw (shape 2 0 6)) (.inv A4_5_7Den)) (A4_5_7Table (shape 2 0 6)) = true := by decide +kernel +lemma A4_5_7Law_check_2_1_5 : contains (.mul (A4_5_7Raw (shape 2 1 5)) (.inv A4_5_7Den)) (A4_5_7Table (shape 2 1 5)) = true := by decide +kernel +lemma A4_5_7Law_check_2_2_4 : contains (.mul (A4_5_7Raw (shape 2 2 4)) (.inv A4_5_7Den)) (A4_5_7Table (shape 2 2 4)) = true := by decide +kernel +lemma A4_5_7Law_check_2_3_3 : contains (.mul (A4_5_7Raw (shape 2 3 3)) (.inv A4_5_7Den)) (A4_5_7Table (shape 2 3 3)) = true := by decide +kernel +lemma A4_5_7Law_check_2_4_2 : contains (.mul (A4_5_7Raw (shape 2 4 2)) (.inv A4_5_7Den)) (A4_5_7Table (shape 2 4 2)) = true := by decide +kernel +lemma A4_5_7Law_check_2_5_1 : contains (.mul (A4_5_7Raw (shape 2 5 1)) (.inv A4_5_7Den)) (A4_5_7Table (shape 2 5 1)) = true := by decide +kernel +lemma A4_5_7Law_check_3_0_5 : contains (.mul (A4_5_7Raw (shape 3 0 5)) (.inv A4_5_7Den)) (A4_5_7Table (shape 3 0 5)) = true := by decide +kernel +lemma A4_5_7Law_check_3_1_4 : contains (.mul (A4_5_7Raw (shape 3 1 4)) (.inv A4_5_7Den)) (A4_5_7Table (shape 3 1 4)) = true := by decide +kernel +lemma A4_5_7Law_check_3_2_3 : contains (.mul (A4_5_7Raw (shape 3 2 3)) (.inv A4_5_7Den)) (A4_5_7Table (shape 3 2 3)) = true := by decide +kernel +lemma A4_5_7Law_check_3_3_2 : contains (.mul (A4_5_7Raw (shape 3 3 2)) (.inv A4_5_7Den)) (A4_5_7Table (shape 3 3 2)) = true := by decide +kernel +lemma A4_5_7Law_check_3_4_1 : contains (.mul (A4_5_7Raw (shape 3 4 1)) (.inv A4_5_7Den)) (A4_5_7Table (shape 3 4 1)) = true := by decide +kernel +lemma A4_5_7Law_check_3_5_0 : contains (.mul (A4_5_7Raw (shape 3 5 0)) (.inv A4_5_7Den)) (A4_5_7Table (shape 3 5 0)) = true := by decide +kernel +lemma A4_5_7Law_check_4_0_4 : contains (.mul (A4_5_7Raw (shape 4 0 4)) (.inv A4_5_7Den)) (A4_5_7Table (shape 4 0 4)) = true := by decide +kernel +lemma A4_5_7Law_check_4_1_3 : contains (.mul (A4_5_7Raw (shape 4 1 3)) (.inv A4_5_7Den)) (A4_5_7Table (shape 4 1 3)) = true := by decide +kernel +lemma A4_5_7Law_check_4_2_2 : contains (.mul (A4_5_7Raw (shape 4 2 2)) (.inv A4_5_7Den)) (A4_5_7Table (shape 4 2 2)) = true := by decide +kernel +lemma A4_5_7Law_check_4_3_1 : contains (.mul (A4_5_7Raw (shape 4 3 1)) (.inv A4_5_7Den)) (A4_5_7Table (shape 4 3 1)) = true := by decide +kernel +lemma A4_5_7Law_check_4_4_0 : contains (.mul (A4_5_7Raw (shape 4 4 0)) (.inv A4_5_7Den)) (A4_5_7Table (shape 4 4 0)) = true := by decide +kernel +lemma A4_5_7Law_check (u : Shape) (hu : u ∈ below (shape 4 5 7)) : + contains (.mul (A4_5_7Raw u) (.inv A4_5_7Den)) (A4_5_7Table u) = true := by + rw [A4_5_7_below] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl + · exact A4_5_7Law_check_0_1_7 + · exact A4_5_7Law_check_0_2_6 + · exact A4_5_7Law_check_0_3_5 + · exact A4_5_7Law_check_0_4_4 + · exact A4_5_7Law_check_0_5_3 + · exact A4_5_7Law_check_1_0_7 + · exact A4_5_7Law_check_1_1_6 + · exact A4_5_7Law_check_1_2_5 + · exact A4_5_7Law_check_1_3_4 + · exact A4_5_7Law_check_1_4_3 + · exact A4_5_7Law_check_1_5_2 + · exact A4_5_7Law_check_2_0_6 + · exact A4_5_7Law_check_2_1_5 + · exact A4_5_7Law_check_2_2_4 + · exact A4_5_7Law_check_2_3_3 + · exact A4_5_7Law_check_2_4_2 + · exact A4_5_7Law_check_2_5_1 + · exact A4_5_7Law_check_3_0_5 + · exact A4_5_7Law_check_3_1_4 + · exact A4_5_7Law_check_3_2_3 + · exact A4_5_7Law_check_3_3_2 + · exact A4_5_7Law_check_3_4_1 + · exact A4_5_7Law_check_3_5_0 + · exact A4_5_7Law_check_4_0_4 + · exact A4_5_7Law_check_4_1_3 + · exact A4_5_7Law_check_4_2_2 + · exact A4_5_7Law_check_4_3_1 + · exact A4_5_7Law_check_4_4_0 +lemma A4_5_7Law_sound (u : Shape) : + (A4_5_7Law u).Encloses (stageALaw (shape 4 5 7) u : ℝ) := by + by_cases hu : u ∈ below (shape 4 5 7) + · have h := contains_sound (Ball.mul_sound (A4_5_7Raw_sound u hu) + (Ball.inv_sound A4_5_7Den_sound A4_5_7Den_positive)) (A4_5_7Law_check u hu) + simpa only [A4_5_7Law, hu, ite_true, stageALaw, splitLaw, + Rat.cast_div, Rat.cast_mul, Rat.cast_inv, div_eq_mul_inv] using h + · simp only [A4_5_7Law, hu, ite_false, stageALaw, splitLaw, Rat.cast_zero] + simpa only [Rat.cast_zero] using Ball.exact_sound 0 + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/Certificates/SplitA4_6_6.lean b/lean/OAI/LinearAlgebra/MatrixFields/Certificates/SplitA4_6_6.lean new file mode 100644 index 0000000000000000000000000000000000000000..ffd7127fb6862406e4b67871f3785e245a9065b9 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/Certificates/SplitA4_6_6.lean @@ -0,0 +1,345 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Certificates.SplitB1_3_4 + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate +open scoped BigOperators +lemma A4_6_6_below : below (shape 4 6 6) = [ + (shape 0 2 6), + (shape 0 3 5), + (shape 0 4 4), + (shape 0 5 3), + (shape 0 6 2), + (shape 1 1 6), + (shape 1 2 5), + (shape 1 3 4), + (shape 1 4 3), + (shape 1 5 2), + (shape 1 6 1), + (shape 2 0 6), + (shape 2 1 5), + (shape 2 2 4), + (shape 2 3 3), + (shape 2 4 2), + (shape 2 5 1), + (shape 2 6 0), + (shape 3 0 5), + (shape 3 1 4), + (shape 3 2 3), + (shape 3 3 2), + (shape 3 4 1), + (shape 3 5 0), + (shape 4 0 4), + (shape 4 1 3), + (shape 4 2 2), + (shape 4 3 1), + (shape 4 4 0)] := by decide +kernel +def A4_6_6Raw (s : Shape) : Ball := + match s 0, s 1, s 2 with + | 0, 2, 6 => ⟨(37007680233059694261632513727 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 0, 3, 5 => ⟨(271425459907852890084474170757 / 20000000000000000000000000000000), (1 / 20000000000000000000000000000000)⟩ + | 0, 4, 4 => ⟨(2973450328881290536063908848299 / 50000000000000000000000000000000), (3 / 12500000000000000000000000000000)⟩ + | 0, 5, 3 => ⟨(1344967952978413384079961640011 / 100000000000000000000000000000000), (1 / 20000000000000000000000000000000)⟩ + | 0, 6, 2 => ⟨(7218791470495623248351293593 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 1, 1, 6 => ⟨(17136753165425385847386480203 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 1, 2, 5 => ⟨(2777830385098454704554116818579 / 100000000000000000000000000000000), (3 / 25000000000000000000000000000000)⟩ + | 1, 3, 4 => ⟨(37038954605575141351236241889301 / 100000000000000000000000000000000), (47 / 50000000000000000000000000000000)⟩ + | 1, 4, 3 => ⟨(2314240286611235203992770108591 / 6250000000000000000000000000000), (47 / 50000000000000000000000000000000)⟩ + | 1, 5, 2 => ⟨(172110505220792807003863412141 / 6250000000000000000000000000000), (3 / 25000000000000000000000000000000)⟩ + | 1, 6, 1 => ⟨(16859688301886595155585889253 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 2, 0, 6 => ⟨(9933044295486291664832751 / 800000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 2, 1, 5 => ⟨(557758160866722243028058363771 / 100000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ + | 2, 2, 4 => ⟨(8218402317164102891027245622431 / 25000000000000000000000000000000), (43 / 50000000000000000000000000000000)⟩ + | 2, 3, 3 => ⟨1, 0⟩ + | 2, 4, 2 => ⟨(8218402317164102891027245622431 / 25000000000000000000000000000000), (43 / 50000000000000000000000000000000)⟩ + | 2, 5, 1 => ⟨(557758160866722243028058363771 / 100000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ + | 2, 6, 0 => ⟨(9933044295486291664832751 / 800000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 3, 0, 5 => ⟨(16859688301886595155585889253 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 3, 1, 4 => ⟨(172110505220792807003863412141 / 6250000000000000000000000000000), (3 / 25000000000000000000000000000000)⟩ + | 3, 2, 3 => ⟨(2314240286611235203992770108591 / 6250000000000000000000000000000), (47 / 50000000000000000000000000000000)⟩ + | 3, 3, 2 => ⟨(37038954605575141351236241889301 / 100000000000000000000000000000000), (47 / 50000000000000000000000000000000)⟩ + | 3, 4, 1 => ⟨(2777830385098454704554116818579 / 100000000000000000000000000000000), (3 / 25000000000000000000000000000000)⟩ + | 3, 5, 0 => ⟨(17136753165425385847386480203 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 4, 0, 4 => ⟨(7218791470495623248351293593 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 4, 1, 3 => ⟨(1344967952978413384079961640011 / 100000000000000000000000000000000), (1 / 20000000000000000000000000000000)⟩ + | 4, 2, 2 => ⟨(2973450328881290536063908848299 / 50000000000000000000000000000000), (3 / 12500000000000000000000000000000)⟩ + | 4, 3, 1 => ⟨(271425459907852890084474170757 / 20000000000000000000000000000000), (1 / 20000000000000000000000000000000)⟩ + | 4, 4, 0 => ⟨(37007680233059694261632513727 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | _, _, _ => (.exact 0) +lemma A4_6_6Raw_0_2_6 : (A4_6_6Raw (shape 0 2 6)).Encloses (splitWeight positiveInitial tableP (shape 4 6 6) (shape 0 2 6) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 4 6 6) (shape 0 2 6) + (-17098) (-5564) (-56356) w100 w166 w25 + (by decide +kernel) w100_sound w166_sound w25_sound) (by decide +kernel) +lemma A4_6_6Raw_0_3_5 : (A4_6_6Raw (shape 0 3 5)).Encloses (splitWeight positiveInitial tableP (shape 4 6 6) (shape 0 3 5) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 4 6 6) (shape 0 3 5) + (-17098) (0) (-25900) w100 w195 w79 + (by decide +kernel) w100_sound w195_sound w79_sound) (by decide +kernel) +lemma A4_6_6Raw_0_4_4 : (A4_6_6Raw (shape 0 4 4)).Encloses (splitWeight positiveInitial tableP (shape 4 6 6) (shape 0 4 4) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 4 6 6) (shape 0 4 4) + (-17098) (-5564) (-5561) w100 w166 w167 + (by decide +kernel) w100_sound w166_sound w167_sound) (by decide +kernel) +lemma A4_6_6Raw_0_5_3 : (A4_6_6Raw (shape 0 5 3)).Encloses (splitWeight positiveInitial tableP (shape 4 6 6) (shape 0 5 3) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 4 6 6) (shape 0 5 3) + (-17098) (-25990) (0) w100 w78 w195 + (by decide +kernel) w100_sound w78_sound w195_sound) (by decide +kernel) +lemma A4_6_6Raw_0_6_2 : (A4_6_6Raw (shape 0 6 2)).Encloses (splitWeight positiveInitial tableP (shape 4 6 6) (shape 0 6 2) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 4 6 6) (shape 0 6 2) + (-17098) (-56609) (-5561) w100 w24 w167 + (by decide +kernel) w100_sound w24_sound w167_sound) (by decide +kernel) +lemma A4_6_6Raw_1_1_6 : (A4_6_6Raw (shape 1 1 6)).Encloses (splitWeight positiveInitial tableP (shape 4 6 6) (shape 1 1 6) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 4 6 6) (shape 1 1 6) + (-4371) (-25990) (-56356) w174 w78 w25 + (by decide +kernel) w174_sound w78_sound w25_sound) (by decide +kernel) +lemma A4_6_6Raw_1_2_5 : (A4_6_6Raw (shape 1 2 5)).Encloses (splitWeight positiveInitial tableP (shape 4 6 6) (shape 1 2 5) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 4 6 6) (shape 1 2 5) + (-4371) (-5564) (-25900) w174 w166 w79 + (by decide +kernel) w174_sound w166_sound w79_sound) (by decide +kernel) +lemma A4_6_6Raw_1_3_4 : (A4_6_6Raw (shape 1 3 4)).Encloses (splitWeight positiveInitial tableP (shape 4 6 6) (shape 1 3 4) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 4 6 6) (shape 1 3 4) + (-4371) (0) (-5561) w174 w195 w167 + (by decide +kernel) w174_sound w195_sound w167_sound) (by decide +kernel) +lemma A4_6_6Raw_1_4_3 : (A4_6_6Raw (shape 1 4 3)).Encloses (splitWeight positiveInitial tableP (shape 4 6 6) (shape 1 4 3) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 4 6 6) (shape 1 4 3) + (-4371) (-5564) (0) w174 w166 w195 + (by decide +kernel) w174_sound w166_sound w195_sound) (by decide +kernel) +lemma A4_6_6Raw_1_5_2 : (A4_6_6Raw (shape 1 5 2)).Encloses (splitWeight positiveInitial tableP (shape 4 6 6) (shape 1 5 2) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 4 6 6) (shape 1 5 2) + (-4371) (-25990) (-5561) w174 w78 w167 + (by decide +kernel) w174_sound w78_sound w167_sound) (by decide +kernel) +lemma A4_6_6Raw_1_6_1 : (A4_6_6Raw (shape 1 6 1)).Encloses (splitWeight positiveInitial tableP (shape 4 6 6) (shape 1 6 1) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 4 6 6) (shape 1 6 1) + (-4371) (-56609) (-25900) w174 w24 w79 + (by decide +kernel) w174_sound w24_sound w79_sound) (by decide +kernel) +lemma A4_6_6Raw_2_0_6 : (A4_6_6Raw (shape 2 0 6)).Encloses (splitWeight positiveInitial tableP (shape 4 6 6) (shape 2 0 6) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 4 6 6) (shape 2 0 6) + (0) (-56609) (-56356) w195 w24 w25 + (by decide +kernel) w195_sound w24_sound w25_sound) (by decide +kernel) +lemma A4_6_6Raw_2_1_5 : (A4_6_6Raw (shape 2 1 5)).Encloses (splitWeight positiveInitial tableP (shape 4 6 6) (shape 2 1 5) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 4 6 6) (shape 2 1 5) + (0) (-25990) (-25900) w195 w78 w79 + (by decide +kernel) w195_sound w78_sound w79_sound) (by decide +kernel) +lemma A4_6_6Raw_2_2_4 : (A4_6_6Raw (shape 2 2 4)).Encloses (splitWeight positiveInitial tableP (shape 4 6 6) (shape 2 2 4) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 4 6 6) (shape 2 2 4) + (0) (-5564) (-5561) w195 w166 w167 + (by decide +kernel) w195_sound w166_sound w167_sound) (by decide +kernel) +lemma A4_6_6Raw_2_3_3 : (A4_6_6Raw (shape 2 3 3)).Encloses (splitWeight positiveInitial tableP (shape 4 6 6) (shape 2 3 3) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 4 6 6) (shape 2 3 3) + (0) (0) (0) w195 w195 w195 + (by decide +kernel) w195_sound w195_sound w195_sound) (by decide +kernel) +lemma A4_6_6Raw_2_4_2 : (A4_6_6Raw (shape 2 4 2)).Encloses (splitWeight positiveInitial tableP (shape 4 6 6) (shape 2 4 2) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 4 6 6) (shape 2 4 2) + (0) (-5564) (-5561) w195 w166 w167 + (by decide +kernel) w195_sound w166_sound w167_sound) (by decide +kernel) +lemma A4_6_6Raw_2_5_1 : (A4_6_6Raw (shape 2 5 1)).Encloses (splitWeight positiveInitial tableP (shape 4 6 6) (shape 2 5 1) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 4 6 6) (shape 2 5 1) + (0) (-25990) (-25900) w195 w78 w79 + (by decide +kernel) w195_sound w78_sound w79_sound) (by decide +kernel) +lemma A4_6_6Raw_2_6_0 : (A4_6_6Raw (shape 2 6 0)).Encloses (splitWeight positiveInitial tableP (shape 4 6 6) (shape 2 6 0) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 4 6 6) (shape 2 6 0) + (0) (-56609) (-56356) w195 w24 w25 + (by decide +kernel) w195_sound w24_sound w25_sound) (by decide +kernel) +lemma A4_6_6Raw_3_0_5 : (A4_6_6Raw (shape 3 0 5)).Encloses (splitWeight positiveInitial tableP (shape 4 6 6) (shape 3 0 5) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 4 6 6) (shape 3 0 5) + (-4371) (-56609) (-25900) w174 w24 w79 + (by decide +kernel) w174_sound w24_sound w79_sound) (by decide +kernel) +lemma A4_6_6Raw_3_1_4 : (A4_6_6Raw (shape 3 1 4)).Encloses (splitWeight positiveInitial tableP (shape 4 6 6) (shape 3 1 4) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 4 6 6) (shape 3 1 4) + (-4371) (-25990) (-5561) w174 w78 w167 + (by decide +kernel) w174_sound w78_sound w167_sound) (by decide +kernel) +lemma A4_6_6Raw_3_2_3 : (A4_6_6Raw (shape 3 2 3)).Encloses (splitWeight positiveInitial tableP (shape 4 6 6) (shape 3 2 3) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 4 6 6) (shape 3 2 3) + (-4371) (-5564) (0) w174 w166 w195 + (by decide +kernel) w174_sound w166_sound w195_sound) (by decide +kernel) +lemma A4_6_6Raw_3_3_2 : (A4_6_6Raw (shape 3 3 2)).Encloses (splitWeight positiveInitial tableP (shape 4 6 6) (shape 3 3 2) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 4 6 6) (shape 3 3 2) + (-4371) (0) (-5561) w174 w195 w167 + (by decide +kernel) w174_sound w195_sound w167_sound) (by decide +kernel) +lemma A4_6_6Raw_3_4_1 : (A4_6_6Raw (shape 3 4 1)).Encloses (splitWeight positiveInitial tableP (shape 4 6 6) (shape 3 4 1) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 4 6 6) (shape 3 4 1) + (-4371) (-5564) (-25900) w174 w166 w79 + (by decide +kernel) w174_sound w166_sound w79_sound) (by decide +kernel) +lemma A4_6_6Raw_3_5_0 : (A4_6_6Raw (shape 3 5 0)).Encloses (splitWeight positiveInitial tableP (shape 4 6 6) (shape 3 5 0) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 4 6 6) (shape 3 5 0) + (-4371) (-25990) (-56356) w174 w78 w25 + (by decide +kernel) w174_sound w78_sound w25_sound) (by decide +kernel) +lemma A4_6_6Raw_4_0_4 : (A4_6_6Raw (shape 4 0 4)).Encloses (splitWeight positiveInitial tableP (shape 4 6 6) (shape 4 0 4) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 4 6 6) (shape 4 0 4) + (-17098) (-56609) (-5561) w100 w24 w167 + (by decide +kernel) w100_sound w24_sound w167_sound) (by decide +kernel) +lemma A4_6_6Raw_4_1_3 : (A4_6_6Raw (shape 4 1 3)).Encloses (splitWeight positiveInitial tableP (shape 4 6 6) (shape 4 1 3) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 4 6 6) (shape 4 1 3) + (-17098) (-25990) (0) w100 w78 w195 + (by decide +kernel) w100_sound w78_sound w195_sound) (by decide +kernel) +lemma A4_6_6Raw_4_2_2 : (A4_6_6Raw (shape 4 2 2)).Encloses (splitWeight positiveInitial tableP (shape 4 6 6) (shape 4 2 2) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 4 6 6) (shape 4 2 2) + (-17098) (-5564) (-5561) w100 w166 w167 + (by decide +kernel) w100_sound w166_sound w167_sound) (by decide +kernel) +lemma A4_6_6Raw_4_3_1 : (A4_6_6Raw (shape 4 3 1)).Encloses (splitWeight positiveInitial tableP (shape 4 6 6) (shape 4 3 1) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 4 6 6) (shape 4 3 1) + (-17098) (0) (-25900) w100 w195 w79 + (by decide +kernel) w100_sound w195_sound w79_sound) (by decide +kernel) +lemma A4_6_6Raw_4_4_0 : (A4_6_6Raw (shape 4 4 0)).Encloses (splitWeight positiveInitial tableP (shape 4 6 6) (shape 4 4 0) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 4 6 6) (shape 4 4 0) + (-17098) (-5564) (-56356) w100 w166 w25 + (by decide +kernel) w100_sound w166_sound w25_sound) (by decide +kernel) +lemma A4_6_6Raw_sound (u : Shape) (hu : u ∈ below (shape 4 6 6)) : + (A4_6_6Raw u).Encloses (splitWeight positiveInitial tableP (shape 4 6 6) u : ℝ) := by + rw [A4_6_6_below] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl + · exact A4_6_6Raw_0_2_6 + · exact A4_6_6Raw_0_3_5 + · exact A4_6_6Raw_0_4_4 + · exact A4_6_6Raw_0_5_3 + · exact A4_6_6Raw_0_6_2 + · exact A4_6_6Raw_1_1_6 + · exact A4_6_6Raw_1_2_5 + · exact A4_6_6Raw_1_3_4 + · exact A4_6_6Raw_1_4_3 + · exact A4_6_6Raw_1_5_2 + · exact A4_6_6Raw_1_6_1 + · exact A4_6_6Raw_2_0_6 + · exact A4_6_6Raw_2_1_5 + · exact A4_6_6Raw_2_2_4 + · exact A4_6_6Raw_2_3_3 + · exact A4_6_6Raw_2_4_2 + · exact A4_6_6Raw_2_5_1 + · exact A4_6_6Raw_2_6_0 + · exact A4_6_6Raw_3_0_5 + · exact A4_6_6Raw_3_1_4 + · exact A4_6_6Raw_3_2_3 + · exact A4_6_6Raw_3_3_2 + · exact A4_6_6Raw_3_4_1 + · exact A4_6_6Raw_3_5_0 + · exact A4_6_6Raw_4_0_4 + · exact A4_6_6Raw_4_1_3 + · exact A4_6_6Raw_4_2_2 + · exact A4_6_6Raw_4_3_1 + · exact A4_6_6Raw_4_4_0 +def A4_6_6Den : Ball := ⟨(21473387588672402815433518941063 / 6250000000000000000000000000000), (339 / 50000000000000000000000000000000)⟩ +lemma A4_6_6Den_sound : A4_6_6Den.Encloses (((below (shape 4 6 6)).map (splitWeight positiveInitial tableP (shape 4 6 6))).sum : ℝ) := by + exact contains_sound (list_cast_enclosed (below (shape 4 6 6)) A4_6_6Raw (splitWeight positiveInitial tableP (shape 4 6 6)) A4_6_6Raw_sound) (by decide +kernel) +lemma A4_6_6Den_positive : 0 < A4_6_6Den.lower := by decide +kernel +def A4_6_6Table (s : Shape) : Ball := + match s 0, s 1, s 2 with + | 0, 2, 6 => ⟨(10771379247987724786312094607 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 0, 3, 5 => ⟨(395002678878428760271589624507 / 100000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ + | 0, 4, 4 => ⟨(346178533382622745572856101671 / 20000000000000000000000000000000), (11 / 100000000000000000000000000000000)⟩ + | 0, 5, 3 => ⟨(97865901122995442910500291001 / 25000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ + | 0, 6, 2 => ⟨(420217317871148638292284089 / 4000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 1, 1, 6 => ⟨(4987788109427518371238771367 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 1, 2, 5 => ⟨(202127398799710262270548863881 / 25000000000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ + | 1, 3, 4 => ⟨(5390240951245195934807849697209 / 50000000000000000000000000000000), (49 / 100000000000000000000000000000000)⟩ + | 1, 4, 3 => ⟨(5388624121496410916877795150321 / 50000000000000000000000000000000), (49 / 100000000000000000000000000000000)⟩ + | 1, 5, 2 => ⟨(40075303561228547414201969063 / 5000000000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ + | 1, 6, 1 => ⟨(4907146180436727877076230291 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 2, 0, 6 => ⟨(361386428843779882083529413 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 2, 1, 5 => ⟨(81169971226522625940938278493 / 50000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ + | 2, 2, 4 => ⟨(9568125060877047586886196521351 / 100000000000000000000000000000000), (9 / 20000000000000000000000000000000)⟩ + | 2, 3, 3 => ⟨(14552897101566282733842513365051 / 50000000000000000000000000000000), (29 / 50000000000000000000000000000000)⟩ + | 2, 4, 2 => ⟨(9568125060877047586886196521351 / 100000000000000000000000000000000), (9 / 20000000000000000000000000000000)⟩ + | 2, 5, 1 => ⟨(81169971226522625940938278493 / 50000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ + | 2, 6, 0 => ⟨(361386428843779882083529413 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 3, 0, 5 => ⟨(4907146180436727877076230291 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 3, 1, 4 => ⟨(40075303561228547414201969063 / 5000000000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ + | 3, 2, 3 => ⟨(5388624121496410916877795150321 / 50000000000000000000000000000000), (49 / 100000000000000000000000000000000)⟩ + | 3, 3, 2 => ⟨(5390240951245195934807849697209 / 50000000000000000000000000000000), (49 / 100000000000000000000000000000000)⟩ + | 3, 4, 1 => ⟨(202127398799710262270548863881 / 25000000000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ + | 3, 5, 0 => ⟨(4987788109427518371238771367 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 4, 0, 4 => ⟨(420217317871148638292284089 / 4000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 4, 1, 3 => ⟨(97865901122995442910500291001 / 25000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ + | 4, 2, 2 => ⟨(346178533382622745572856101671 / 20000000000000000000000000000000), (11 / 100000000000000000000000000000000)⟩ + | 4, 3, 1 => ⟨(395002678878428760271589624507 / 100000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ + | 4, 4, 0 => ⟨(10771379247987724786312094607 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | _, _, _ => (.exact 0) +def A4_6_6Law (u : Shape) : Ball := if u ∈ below (shape 4 6 6) then A4_6_6Table u else .exact 0 +lemma A4_6_6Law_check_0_2_6 : contains (.mul (A4_6_6Raw (shape 0 2 6)) (.inv A4_6_6Den)) (A4_6_6Table (shape 0 2 6)) = true := by decide +kernel +lemma A4_6_6Law_check_0_3_5 : contains (.mul (A4_6_6Raw (shape 0 3 5)) (.inv A4_6_6Den)) (A4_6_6Table (shape 0 3 5)) = true := by decide +kernel +lemma A4_6_6Law_check_0_4_4 : contains (.mul (A4_6_6Raw (shape 0 4 4)) (.inv A4_6_6Den)) (A4_6_6Table (shape 0 4 4)) = true := by decide +kernel +lemma A4_6_6Law_check_0_5_3 : contains (.mul (A4_6_6Raw (shape 0 5 3)) (.inv A4_6_6Den)) (A4_6_6Table (shape 0 5 3)) = true := by decide +kernel +lemma A4_6_6Law_check_0_6_2 : contains (.mul (A4_6_6Raw (shape 0 6 2)) (.inv A4_6_6Den)) (A4_6_6Table (shape 0 6 2)) = true := by decide +kernel +lemma A4_6_6Law_check_1_1_6 : contains (.mul (A4_6_6Raw (shape 1 1 6)) (.inv A4_6_6Den)) (A4_6_6Table (shape 1 1 6)) = true := by decide +kernel +lemma A4_6_6Law_check_1_2_5 : contains (.mul (A4_6_6Raw (shape 1 2 5)) (.inv A4_6_6Den)) (A4_6_6Table (shape 1 2 5)) = true := by decide +kernel +lemma A4_6_6Law_check_1_3_4 : contains (.mul (A4_6_6Raw (shape 1 3 4)) (.inv A4_6_6Den)) (A4_6_6Table (shape 1 3 4)) = true := by decide +kernel +lemma A4_6_6Law_check_1_4_3 : contains (.mul (A4_6_6Raw (shape 1 4 3)) (.inv A4_6_6Den)) (A4_6_6Table (shape 1 4 3)) = true := by decide +kernel +lemma A4_6_6Law_check_1_5_2 : contains (.mul (A4_6_6Raw (shape 1 5 2)) (.inv A4_6_6Den)) (A4_6_6Table (shape 1 5 2)) = true := by decide +kernel +lemma A4_6_6Law_check_1_6_1 : contains (.mul (A4_6_6Raw (shape 1 6 1)) (.inv A4_6_6Den)) (A4_6_6Table (shape 1 6 1)) = true := by decide +kernel +lemma A4_6_6Law_check_2_0_6 : contains (.mul (A4_6_6Raw (shape 2 0 6)) (.inv A4_6_6Den)) (A4_6_6Table (shape 2 0 6)) = true := by decide +kernel +lemma A4_6_6Law_check_2_1_5 : contains (.mul (A4_6_6Raw (shape 2 1 5)) (.inv A4_6_6Den)) (A4_6_6Table (shape 2 1 5)) = true := by decide +kernel +lemma A4_6_6Law_check_2_2_4 : contains (.mul (A4_6_6Raw (shape 2 2 4)) (.inv A4_6_6Den)) (A4_6_6Table (shape 2 2 4)) = true := by decide +kernel +lemma A4_6_6Law_check_2_3_3 : contains (.mul (A4_6_6Raw (shape 2 3 3)) (.inv A4_6_6Den)) (A4_6_6Table (shape 2 3 3)) = true := by decide +kernel +lemma A4_6_6Law_check_2_4_2 : contains (.mul (A4_6_6Raw (shape 2 4 2)) (.inv A4_6_6Den)) (A4_6_6Table (shape 2 4 2)) = true := by decide +kernel +lemma A4_6_6Law_check_2_5_1 : contains (.mul (A4_6_6Raw (shape 2 5 1)) (.inv A4_6_6Den)) (A4_6_6Table (shape 2 5 1)) = true := by decide +kernel +lemma A4_6_6Law_check_2_6_0 : contains (.mul (A4_6_6Raw (shape 2 6 0)) (.inv A4_6_6Den)) (A4_6_6Table (shape 2 6 0)) = true := by decide +kernel +lemma A4_6_6Law_check_3_0_5 : contains (.mul (A4_6_6Raw (shape 3 0 5)) (.inv A4_6_6Den)) (A4_6_6Table (shape 3 0 5)) = true := by decide +kernel +lemma A4_6_6Law_check_3_1_4 : contains (.mul (A4_6_6Raw (shape 3 1 4)) (.inv A4_6_6Den)) (A4_6_6Table (shape 3 1 4)) = true := by decide +kernel +lemma A4_6_6Law_check_3_2_3 : contains (.mul (A4_6_6Raw (shape 3 2 3)) (.inv A4_6_6Den)) (A4_6_6Table (shape 3 2 3)) = true := by decide +kernel +lemma A4_6_6Law_check_3_3_2 : contains (.mul (A4_6_6Raw (shape 3 3 2)) (.inv A4_6_6Den)) (A4_6_6Table (shape 3 3 2)) = true := by decide +kernel +lemma A4_6_6Law_check_3_4_1 : contains (.mul (A4_6_6Raw (shape 3 4 1)) (.inv A4_6_6Den)) (A4_6_6Table (shape 3 4 1)) = true := by decide +kernel +lemma A4_6_6Law_check_3_5_0 : contains (.mul (A4_6_6Raw (shape 3 5 0)) (.inv A4_6_6Den)) (A4_6_6Table (shape 3 5 0)) = true := by decide +kernel +lemma A4_6_6Law_check_4_0_4 : contains (.mul (A4_6_6Raw (shape 4 0 4)) (.inv A4_6_6Den)) (A4_6_6Table (shape 4 0 4)) = true := by decide +kernel +lemma A4_6_6Law_check_4_1_3 : contains (.mul (A4_6_6Raw (shape 4 1 3)) (.inv A4_6_6Den)) (A4_6_6Table (shape 4 1 3)) = true := by decide +kernel +lemma A4_6_6Law_check_4_2_2 : contains (.mul (A4_6_6Raw (shape 4 2 2)) (.inv A4_6_6Den)) (A4_6_6Table (shape 4 2 2)) = true := by decide +kernel +lemma A4_6_6Law_check_4_3_1 : contains (.mul (A4_6_6Raw (shape 4 3 1)) (.inv A4_6_6Den)) (A4_6_6Table (shape 4 3 1)) = true := by decide +kernel +lemma A4_6_6Law_check_4_4_0 : contains (.mul (A4_6_6Raw (shape 4 4 0)) (.inv A4_6_6Den)) (A4_6_6Table (shape 4 4 0)) = true := by decide +kernel +lemma A4_6_6Law_check (u : Shape) (hu : u ∈ below (shape 4 6 6)) : + contains (.mul (A4_6_6Raw u) (.inv A4_6_6Den)) (A4_6_6Table u) = true := by + rw [A4_6_6_below] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl + · exact A4_6_6Law_check_0_2_6 + · exact A4_6_6Law_check_0_3_5 + · exact A4_6_6Law_check_0_4_4 + · exact A4_6_6Law_check_0_5_3 + · exact A4_6_6Law_check_0_6_2 + · exact A4_6_6Law_check_1_1_6 + · exact A4_6_6Law_check_1_2_5 + · exact A4_6_6Law_check_1_3_4 + · exact A4_6_6Law_check_1_4_3 + · exact A4_6_6Law_check_1_5_2 + · exact A4_6_6Law_check_1_6_1 + · exact A4_6_6Law_check_2_0_6 + · exact A4_6_6Law_check_2_1_5 + · exact A4_6_6Law_check_2_2_4 + · exact A4_6_6Law_check_2_3_3 + · exact A4_6_6Law_check_2_4_2 + · exact A4_6_6Law_check_2_5_1 + · exact A4_6_6Law_check_2_6_0 + · exact A4_6_6Law_check_3_0_5 + · exact A4_6_6Law_check_3_1_4 + · exact A4_6_6Law_check_3_2_3 + · exact A4_6_6Law_check_3_3_2 + · exact A4_6_6Law_check_3_4_1 + · exact A4_6_6Law_check_3_5_0 + · exact A4_6_6Law_check_4_0_4 + · exact A4_6_6Law_check_4_1_3 + · exact A4_6_6Law_check_4_2_2 + · exact A4_6_6Law_check_4_3_1 + · exact A4_6_6Law_check_4_4_0 +lemma A4_6_6Law_sound (u : Shape) : + (A4_6_6Law u).Encloses (stageALaw (shape 4 6 6) u : ℝ) := by + by_cases hu : u ∈ below (shape 4 6 6) + · have h := contains_sound (Ball.mul_sound (A4_6_6Raw_sound u hu) + (Ball.inv_sound A4_6_6Den_sound A4_6_6Den_positive)) (A4_6_6Law_check u hu) + simpa only [A4_6_6Law, hu, ite_true, stageALaw, splitLaw, + Rat.cast_div, Rat.cast_mul, Rat.cast_inv, div_eq_mul_inv] using h + · simp only [A4_6_6Law, hu, ite_false, stageALaw, splitLaw, Rat.cast_zero] + simpa only [Rat.cast_zero] using Ball.exact_sound 0 + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/Certificates/SplitB1_1_6.lean b/lean/OAI/LinearAlgebra/MatrixFields/Certificates/SplitB1_1_6.lean new file mode 100644 index 0000000000000000000000000000000000000000..55e0b03e86de36da87fe6b9907b81c79cb2f7d46 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/Certificates/SplitB1_1_6.lean @@ -0,0 +1,1363 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Certificates.Four0_4_4 + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate +open scoped BigOperators +def w25Trace : List Ball := [ + ⟨(45785468331137255202533763683031 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(47861811840303724011256853624459 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(48564143026673881496047046644407 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(16306133560378945321348040094747 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(127948437180680440527584133693 / 3125000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(82125546891779481619958138679 / 10000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(13716078546995263974734271041 / 10000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(9812497232940587076704824921 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(245610476699458716935617857 / 10000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(273165881628424891747947021 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(3417290952422478213679 / 12500000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(621737822715778105260329 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(41472462615792647231503 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(15958626442958377566447 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(142547226720472755973 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(38025387233674064031 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w25S0 : Ball := ⟨(83852364412062900520750723805037 / 100000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +def w25S1 : Ball := ⟨(7031219017493392820519392477101 / 10000000000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ +def w25S2 : Ball := ⟨(49438040871960752254217876879899 / 100000000000000000000000000000000), (9 / 100000000000000000000000000000000)⟩ +def w25S3 : Ball := ⟨(12220599426288309285318903017743 / 50000000000000000000000000000000), (1 / 10000000000000000000000000000000)⟩ +def w25S4 : Ball := ⟨(2986861006755963080988808702703 / 50000000000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ +def w25S5 : Ball := ⟨(1393959167762382083395885227 / 390625000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ +abbrev w25 : Ball := w25S5 +lemma w25_sound : w25.Encloses (weight (-56356) : ℝ) := by + exact weight_enclosed_of_trace (-56356) w25Trace w25S0 w25S1 w25S2 w25S3 w25S4 w25S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def w26Trace : List Ball := [ + ⟨(91644938695406461833674056892123 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(9576172988305421706063152257457 / 10000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(48577031731322213528104470930273 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(3261876795622354777174156430543 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2047501931223082251735938044457 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(205341225223953618638702205277 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(137176467343829037379890181127 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(19626959451965561090978938867 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(491264704435033988688521727 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(136593895928280751661312533 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(27340322092271316640462777 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2487117682933565567802199 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(207375124747721811098467 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(15959542323714148962659 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(285109727917665106419 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(76054635388880697247 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w26S0 : Ball := ⟨(83987947884848086426829976722033 / 100000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +def w26S1 : Ball := ⟨(14107950779815916309384333958211 / 20000000000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ +def w26S2 : Ball := ⟨(49758568801427130276705189494049 / 100000000000000000000000000000000), (9 / 100000000000000000000000000000000)⟩ +def w26S3 : Ball := ⟨(123795758458317868006101655917 / 500000000000000000000000000000), (1 / 10000000000000000000000000000000)⟩ +def w26S4 : Ball := ⟨(766269490613508997978693718613 / 12500000000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ +def w26S5 : Ball := ⟨(93947029159213848697517219817 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ +abbrev w26 : Ball := w26S5 +lemma w26_sound : w26.Encloses (weight (-55839) : ℝ) := by + exact weight_enclosed_of_trace (-55839) w26Trace w26S0 w26S1 w26S2 w26S3 w26S4 w26S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def w27Trace : List Ball := [ + ⟨(18345749238798680348872437662081 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(95804872694180021059257238957191 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(24295810943323438321889519920711 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2039132896591194637450262654039 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(102393598707672803290857620257 / 2500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(164297751294903183192932957207 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(137194215615939970245554534893 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(19629183311385744592861811947 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2456571092153000203910179393 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(68303146938082179954332607 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1708911201020875743470347 / 6250000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2487305985036420974053119 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(103694811642239278688771 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(997536174179196014449 / 6250000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1140508053188296877213 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4753687758117489537 / 6250000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w27S0 : Ball := ⟨(84141628783220589862025521274081 / 100000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +def w27S1 : Ball := ⟨(17699534235733239104141844647297 / 25000000000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ +def w27S2 : Ball := ⟨(25061880972951441318234900707649 / 50000000000000000000000000000000), (9 / 100000000000000000000000000000000)⟩ +def w27S3 : Ball := ⟨(25123915116095419316951877996989 / 100000000000000000000000000000000), (1 / 10000000000000000000000000000000)⟩ +def w27S4 : Ball := ⟨(6312111107607679070950604701523 / 100000000000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ +def w27S5 : Ball := ⟨(39842746634784241075846779823 / 10000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ +abbrev w27 : Ball := w27S5 +lemma w27_sound : w27.Encloses (weight (-55254) : ℝ) := by + exact weight_enclosed_of_trace (-55254) w27Trace w27S0 w27S1 w27S2 w27S3 w27S4 w27S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def w28Trace : List Ball := [ + ⟨(45866093043236628690910415303721 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(47903321606528293279328882955251 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(6074027574786765803139212876333 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(16313214142526871047025711989409 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2047887157789871415627475950069 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(102686729801808923283309457221 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(68597471918084791986138985711 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(19629274556225876274325315563 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(614145312457620845239049149 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(273213605107331844565195833 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(27342671823598038287914353 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2487313710813425916558001 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(103695109068236601540959 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(3192124262223369525681 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(142563861241741040721 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(38029591680139898559 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w28S0 : Ball := ⟨(42073969821016789339138735730677 / 50000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +def w28S1 : Ball := ⟨(17702189364998315603374756844111 / 25000000000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ +def w28S2 : Ball := ⟨(50138801330281514913431737642841 / 100000000000000000000000000000000), (9 / 100000000000000000000000000000000)⟩ +def w28S3 : Ball := ⟨(25138993988374394095320513350287 / 100000000000000000000000000000000), (1 / 10000000000000000000000000000000)⟩ +def w28S4 : Ball := ⟨(1263938037495047851933900678061 / 20000000000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ +def w28S5 : Ball := ⟨(399384840656708247408468632317 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ +abbrev w28 : Ball := w28S5 +lemma w28_sound : w28.Encloses (weight (-55230) : ℝ) := by + exact weight_enclosed_of_trace (-55230) w28Trace w28S0 w28S1 w28S2 w28S3 w28S4 w28S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def w29Trace : List Ball := [ + ⟨(91739926316210653627319546008753 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(19162125408239748000998588351451 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(48593567740191503494354742557579 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(8156776916389714401306408249503 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4095842643320143413702771264727 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(205376318244231558543991306191 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(137196582356469179728787688201 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(19629479859877734204450638683 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1228302052440812326464440527 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(273215894181302082659448183 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(6835720048011668453313061 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(248733109397380703848137 / 10000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(51847889141263851018821 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(15960716991452349912337 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1140517272660747421257 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(9507448328584964663 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w29S0 : Ball := ⟨(42081070402518800141765154629049 / 50000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +def w29S1 : Ball := ⟨(35416329724434875443692865171559 / 50000000000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ +def w29S2 : Ball := ⟨(25086328222997786007631674697119 / 50000000000000000000000000000000), (9 / 100000000000000000000000000000000)⟩ +def w29S3 : Ball := ⟨(12586477274239505117010599071759 / 50000000000000000000000000000000), (1 / 10000000000000000000000000000000)⟩ +def w29S4 : Ball := ⟨(6336776406997900900023143790749 / 100000000000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ +def w29S5 : Ball := ⟨(200773676161426132972907255303 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ +abbrev w29 : Ball := w29S5 +lemma w29_sound : w29.Encloses (weight (-55176) : ℝ) := by + exact weight_enclosed_of_trace (-55176) w29Trace w29S0 w29S1 w29S2 w29S3 w29S4 w29S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def w30Trace : List Ball := [ + ⟨(9174609029957902154437624677593 / 10000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(95813799507906811013353201592599 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(48594640504591459769175466249557 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(16313824334998381146095833716349 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4095897053809927505583463410353 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(821514378472295414601964051309 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(68598943564328695954114055969 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2453705418143757068413874741 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(614155576137078620877577969 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(273217716987394702640922623 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(27343046117154707456085543 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2487344936280580518780713 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(103696311181129900274599 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(15960793182115268812837 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(285130588812785914949 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(38029953874906493541 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w30S0 : Ball := ⟨(5260840678286567396995096506637 / 6250000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ +def w30S1 : Ball := ⟨(70851698284325556537044168218429 / 100000000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ +def w30S2 : Ball := ⟨(25099815748865505058650902693233 / 50000000000000000000000000000000), (7 / 100000000000000000000000000000000)⟩ +def w30S3 : Ball := ⟨(3150003753134984172534741405573 / 12500000000000000000000000000000), (1 / 12500000000000000000000000000000)⟩ +def w30S4 : Ball := ⟨(6350415132649271237874106001737 / 100000000000000000000000000000000), (1 / 20000000000000000000000000000000)⟩ +def w30S5 : Ball := ⟨(403277723569808612119577416691 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ +abbrev w30 : Ball := w30S5 +lemma w30_sound : w30.Encloses (weight (-55133) : ℝ) := by + exact weight_enclosed_of_trace (-55133) w30Trace w30S0 w30S1 w30S2 w30S3 w30S4 w30S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def w31Trace : List Ball := [ + ⟨(9174981756020691082646111016973 / 10000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(23953929453007680834852602624769 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(24297644585082993655772744665753 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(16313987897976085081947607887131 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2047964976881087831130324812663 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(821519884204805974192950196127 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(68599338035617161611457780427 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(19629742197886330706134065403 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2456633309115843010372744673 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(136609409579978722746157443 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(13671573222430317938604133 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1243676653058259896414193 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(41478653360543430755323 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(7980419625608861396111 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1140525428466270284883 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(76060101916079615319 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w31S0 : Ball := ⟨(84180290223312524147580341691057 / 100000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +def w31S1 : Ball := ⟨(35431606310405630683095576824341 / 50000000000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ +def w31S2 : Ball := ⟨(12553987257355761094415622365359 / 25000000000000000000000000000000), (9 / 100000000000000000000000000000000)⟩ +def w31S3 : Ball := ⟨(25216415369256131926525881604669 / 100000000000000000000000000000000), (1 / 10000000000000000000000000000000)⟩ +def w31S4 : Ball := ⟨(6358676040748568642581432429083 / 100000000000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ +def w31S5 : Ball := ⟨(10108190247797473146079027821 / 2500000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ +abbrev w31 : Ball := w31S5 +lemma w31_sound : w31.Encloses (weight (-55107) : ℝ) := by + exact weight_enclosed_of_trace (-55107) w31Trace w31S0 w31S1 w31S2 w31S3 w31S4 w31S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def w32Trace : List Ball := [ + ⟨(91777059830869566146310164777577 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(95829737754128551566208906938669 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(24300014907567119449590286789627 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(8157591622940866257483410503829 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(102404259747599949509214460807 / 2500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(821560120329004847875456962459 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(137204441662330984814190093407 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4907616152544105685886105889 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2456713729806578233151512699 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(34153359217949888855758371 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(13671939814686428928054917 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(248741447188194893614711 / 10000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(207397976288265609359303 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(498786747424433393229 / 3125000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(570273943527846115787 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4753845051463291739 / 6250000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w32S0 : Ball := ⟨(16846057422398024154745714396681 / 20000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ +def w32S1 : Ball := ⟨(7094741266968289040413426507439 / 10000000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ +def w32S2 : Ball := ⟨(12583838411305700795452735287839 / 25000000000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ +def w32S3 : Ball := ⟨(12668239132948222699622097750127 / 50000000000000000000000000000000), (7 / 100000000000000000000000000000000)⟩ +def w32S4 : Ball := ⟨(641937130918242948973223227793 / 10000000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ +def w32S5 : Ball := ⟨(412083280051545387456384844737 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ +abbrev w32 : Ball := w32S5 +lemma w32_sound : w32.Encloses (weight (-54917) : ℝ) := by + exact weight_enclosed_of_trace (-54917) w32Trace w32S0 w32S1 w32S2 w32S3 w32S4 w32S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def w33Trace : List Ball := [ + ⟨(92020591576467497480895303966263 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(47977503157219909549116001781171 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(9728475446754160113983268710099 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(16325859536398933414508185259267 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4098317644752058048165725949081 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(821919430776376164307360990109 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(34313981494394074597538094283 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1963691518836658310049355563 / 10000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2457431800569046586545481959 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(273298790654017891399882257 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2735042586456943087206551 / 10000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(621990144992269308706891 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(51860005862632096887009 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(3192836339105486316309 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(285187099210260665067 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(15214837287668698879 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w33S0 : Ball := ⟨(2646184148150950297900240566277 / 3125000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +def w33S1 : Ball := ⟨(35851727595137896831497085625209 / 50000000000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ +def w33S2 : Ball := ⟨(12853463715559721633031132752789 / 25000000000000000000000000000000), (9 / 100000000000000000000000000000000)⟩ +def w33S3 : Ball := ⟨(264338447179536519402633134261 / 1000000000000000000000000000000), (1 / 10000000000000000000000000000000)⟩ +def w33S4 : Ball := ⟨(349374073286443092347940913209 / 5000000000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ +def w33S5 : Ball := ⟨(97649794467808727035744116141 / 20000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ +abbrev w33 : Ball := w33S5 +lemma w33_sound : w33.Encloses (weight (-53221) : ℝ) := by + exact weight_enclosed_of_trace (-53221) w33Trace w33S0 w33S1 w33S2 w33S3 w33S4 w33S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def w34Trace : List Ball := [ + ⟨(46025539223268144597868685783973 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(95970680341390611306157109104387 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(24323837287158867023141826606731 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(16327194861941372415598519937827 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2049293091967291598441905209091 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(41098218178548379200728177319 / 5000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(137262363898848866494607776981 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4909430444007688941217112287 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1228760793006986768120557299 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(10932311307622659090334279 / 4000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(13675622173094707795076111 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(497605771811368031614489 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(207445280459776649945677 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(3991139373025229214431 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(14259668316051650349 / 1250000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(19018942410052461929 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w34S0 : Ball := ⟨(2647937825990743053927941776291 / 3125000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +def w34S1 : Ball := ⟨(71798525238400846240616401987417 / 100000000000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ +def w34S2 : Ball := ⟨(12887570566023208236227672488123 / 25000000000000000000000000000000), (1 / 10000000000000000000000000000000)⟩ +def w34S3 : Ball := ⟨(6643579003769110236807743691499 / 25000000000000000000000000000000), (11 / 100000000000000000000000000000000)⟩ +def w34S4 : Ball := ⟨(3530971358345741060007047842373 / 50000000000000000000000000000000), (7 / 100000000000000000000000000000000)⟩ +def w34S5 : Ball := ⟨(498710349338318708978337091987 / 100000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ +abbrev w34 : Ball := w34S5 +lemma w34_sound : w34.Encloses (weight (-53009) : ℝ) := by + exact weight_enclosed_of_trace (-53009) w34Trace w34S0 w34S1 w34S2 w34S3 w34S4 w34S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def w35Trace : List Ball := [ + ⟨(18458259894357045168789359147261 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(96094122398423393776398019687287 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(24344692010372100106204275336829 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(16337707226655341034621989615683 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(820140011325250402246131990531 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(25697438709964611299354011029 / 3125000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(17164129431784767346183331693 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(19644070005470872722195333573 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(614557054358796432156557193 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(273378550146441153590993037 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(13678842833090141194477119 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(99542647782933163519193 / 4000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(207486650850964829205643 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(7983757403813158833417 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1140970738493407546359 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(76088226153007382339 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w35S0 : Ball := ⟨(5323552473869214941796088409629 / 6250000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +def w35S1 : Ball := ⟨(72550940011619938395365810290319 / 100000000000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ +def w35S2 : Ball := ⟨(52636388965696749067867853291607 / 100000000000000000000000000000000), (9 / 100000000000000000000000000000000)⟩ +def w35S3 : Ball := ⟨(27705894433481224811200724774167 / 100000000000000000000000000000000), (1 / 10000000000000000000000000000000)⟩ +def w35S4 : Ball := ⟨(119940091618625924863213570383 / 1562500000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ +def w35S5 : Ball := ⟨(294617611826880119373906560639 / 50000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ +abbrev w35 : Ball := w35S5 +lemma w35_sound : w35.Encloses (weight (-51341) : ℝ) := by + exact weight_enclosed_of_trace (-51341) w35Trace w35S0 w35S1 w35S2 w35S3 w35S4 w35S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def w36Trace : List Ball := [ + ⟨(92586525998389445044635539543647 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(96245681502540827462791948639183 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(48740569170007716976959102398173 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(8175302058898727455485876069223 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4103292924037883109413256345447 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(411375897949383092705262040091 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(137375174110452454928249630137 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(9825927117261879372062454119 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(614773659236326837629426871 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(273465315467281929041702281 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(13682791391456534775720459 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1244612474254067232432973 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(103768683926648113365213 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(3194228031102291658609 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(114121256949713037431 / 10000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(76103490608737694551 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w36S0 : Ball := ⟨(85722647964504446235040329722281 / 100000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +def w36S1 : Ball := ⟨(9185465467557947849178136547819 / 12500000000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ +def w36S2 : Ball := ⟨(13499644136911927918613872157633 / 25000000000000000000000000000000), (1 / 10000000000000000000000000000000)⟩ +def w36S3 : Ball := ⟨(14579231345860847300381800125667 / 50000000000000000000000000000000), (3 / 25000000000000000000000000000000)⟩ +def w36S4 : Ball := ⟨(1700431893089051943325687998351 / 20000000000000000000000000000000), (1 / 12500000000000000000000000000000)⟩ +def w36S5 : Ball := ⟨(361433577879302122267148370717 / 50000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ +abbrev w36 : Ball := w36S5 +lemma w36_sound : w36.Encloses (weight (-49297) : ℝ) := by + exact weight_enclosed_of_trace (-49297) w36Trace w36S0 w36S1 w36S2 w36S3 w36S4 w36S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def w37Trace : List Ball := [ + ⟨(92855706800378760617807057200151 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(96383727476498096599917439067083 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(48787166994270920045802799322649 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(3272468322125724280386215702291 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4105652224211070415286503074173 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(205786605807361036717177318219 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(17178962632246356735384911921 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4914733720080220934874996591 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(614970672902742571609969779 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(27354422881102717733887631 / 10000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(27372764907614129292059377 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(311228004589913548764421 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(20758348970072370685511 / 10000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1996804617225966714291 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(35669764967170844691 / 3125000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(76117366028868281679 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w37S0 : Ball := ⟨(86221822853979064097491013843017 / 100000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ +def w37S1 : Ball := ⟨(7434202736262946441961163601171 / 10000000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ +def w37S2 : Ball := ⟨(27633685161929740006283718065239 / 50000000000000000000000000000000), (7 / 100000000000000000000000000000000)⟩ +def w37S3 : Ball := ⟨(7636205556286558811523252697899 / 25000000000000000000000000000000), (9 / 100000000000000000000000000000000)⟩ +def w37S4 : Ball := ⟨(4664930823828937049074508328179 / 50000000000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ +def w37S5 : Ball := ⟨(870463183644373012431832467149 / 100000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ +abbrev w37 : Ball := w37S5 +lemma w37_sound : w37.Encloses (weight (-47439) : ℝ) := by + exact weight_enclosed_of_trace (-47439) w37Trace w37S0 w37S1 w37S2 w37S3 w37S4 w37S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def w38Trace : List Ball := [ + ⟨(3717526112806951492682521512867 / 4000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(96425981845678055025061462186169 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(48801425588659187641839606597939 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(16365932522415137488482255068569 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2053186963377980777431924033867 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(205816781927264574864009213143 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(137448989770562217180554024599 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(614409386753716246009201549 / 3125000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1230061847374599373066128043 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(5471367225832648786097029 / 2000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(27374961209808602787692069 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(498001446836910812714729 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(207597593184600305438383 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(399386125862280507339 / 2500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1141499722460633563029 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(19030401953750193871 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w38S0 : Ball := ⟨(86375002496259768968627950073201 / 100000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ +def w38S1 : Ball := ⟨(74606410562288813206433125464533 / 100000000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ +def w38S2 : Ball := ⟨(27830582484943998945769191245379 / 50000000000000000000000000000000), (7 / 100000000000000000000000000000000)⟩ +def w38S3 : Ball := ⟨(3872706607256358456534840867853 / 12500000000000000000000000000000), (1 / 12500000000000000000000000000000)⟩ +def w38S4 : Ball := ⟨(1919725627633542992106409058239 / 20000000000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ +def w38S5 : Ball := ⟨(184267324269650028245362054147 / 20000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ +abbrev w38 : Ball := w38S5 +lemma w38_sound : w38.Encloses (weight (-46871) : ℝ) := by + exact weight_enclosed_of_trace (-46871) w38Trace w38S0 w38S1 w38S2 w38S3 w38S4 w38S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def w39Trace : List Ball := [ + ⟨(92969524740464356854824235453609 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(48221028465360750325929582142219 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(48806849519627898034725856991957 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(16367298412563396372852888761067 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4106648432667302283588422668181 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(411656518696744241454036641633 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(137455565352067394109236567211 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(19661923985976994083752778351 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(15376345968736228579015453 / 625000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(273577539449094311351820811 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1368789825409217566393231 / 5000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2490076907362237012181489 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(5190073923715739903109 / 2500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(15975828426382851727671 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(228305059182545227313 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(38061610444300228113 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w39S0 : Ball := ⟨(21608331326169535349514390800001 / 25000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ +def w39S1 : Ball := ⟨(74707197232243147245372973033227 / 100000000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ +def w39S2 : Ball := ⟨(55811653182972781602570515121739 / 100000000000000000000000000000000), (7 / 100000000000000000000000000000000)⟩ +def w39S3 : Ball := ⟨(6229881262032871647947875606787 / 20000000000000000000000000000000), (9 / 100000000000000000000000000000000)⟩ +def w39S4 : Ball := ⟨(1212856891844633924100129454253 / 12500000000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ +def w39S5 : Ball := ⟨(47072698883040833028730637789 / 5000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ +abbrev w39 : Ball := w39S5 +lemma w39_sound : w39.Encloses (weight (-46655) : ℝ) := by + exact weight_enclosed_of_trace (-46655) w39Trace w39S0 w39S1 w39S2 w39S3 w39S4 w39S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def w40Trace : List Ball := [ + ⟨(93326543252452916137773690035279 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(96624865807658786295299723483579 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(48868510092266792701872697400777 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1638282297066315259041386506273 / 10000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4109768006928397104243994084417 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(823834718621160127381350451101 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(68765139765065515239910463651 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4917820401820219570401200261 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2461256724875261582537894903 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(5473636207148947451721121 / 2000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(5477057168197736397859693 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(124543420114716013399469 / 5000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(12978993031855218782707 / 6250000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(15980183615184677888437 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1141815796743122370283 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(76141539729063497251 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w40S0 : Ball := ⟨(87098436754519649305471352811581 / 100000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +def w40S1 : Ball := ⟨(75861376850810593408499833334373 / 100000000000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ +def w40S2 : Ball := ⟨(1438737124425175346642330190289 / 2500000000000000000000000000000), (1 / 10000000000000000000000000000000)⟩ +def w40S3 : Ball := ⟨(33119432211187559792456839434591 / 100000000000000000000000000000000), (3 / 25000000000000000000000000000000)⟩ +def w40S4 : Ball := ⟨(5484483949957240480923011121351 / 50000000000000000000000000000000), (9 / 100000000000000000000000000000000)⟩ +def w40S5 : Ball := ⟨(1203182567893542988313075989517 / 100000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +abbrev w40 : Ball := w40S5 +lemma w40_sound : w40.Encloses (weight (-44202) : ℝ) := by + exact weight_enclosed_of_trace (-44202) w40Trace w40S0 w40S1 w40S2 w40S3 w40S4 w40S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def w41Trace : List Ball := [ + ⟨(93505493257699602905292027424193 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(48358203591216657443841940251731 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(6112421477227634237371778660719 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(16390590948308653775514083607563 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4111328642710541938236531036543 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(206023916441268534736171370527 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(137567648075341688587458692853 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4918990370615042075317185539 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2461777495304139517089019891 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(136866975834628753843178251 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(13695015417731934767063961 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2491264162651096328062507 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(103847177163630301137033 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(3196472230589389480371 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1141961040575833172559 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(19037673853832087959 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w41S0 : Ball := ⟨(43716386346828529487681060020413 / 50000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +def w41S1 : Ball := ⟨(76444897409007034483268951842813 / 100000000000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ +def w41S2 : Ball := ⟨(3652388962421006508740400469151 / 6250000000000000000000000000000), (1 / 10000000000000000000000000000000)⟩ +def w41S3 : Ball := ⟨(34150259540005879027416158398401 / 100000000000000000000000000000000), (13 / 100000000000000000000000000000000)⟩ +def w41S4 : Ball := ⟨(11662402266497625522242092043533 / 100000000000000000000000000000000), (1 / 10000000000000000000000000000000)⟩ +def w41S5 : Ball := ⟨(272023253251217905585357692917 / 20000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +abbrev w41 : Ball := w41S5 +lemma w41_sound : w41.Encloses (weight (-42976) : ℝ) := by + exact weight_enclosed_of_trace (-42976) w41Trace w41S0 w41S1 w41S2 w41S3 w41S4 w41S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def w42Trace : List Ball := [ + ⟨(93649953839738500117011901122889 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(96790262517084879611136117017981 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(9784852763006940310912094448377 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(8198427626676562411656875359551 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4112587037264617980038730266771 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(824306059286252249258819089577 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(137597775319898394962587310759 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2459966788588156475757984433 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(307774664312831216113926603 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(68443996022026978446207131 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(27393855795004176290287403 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(311447897459682504086723 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(207718911943783478120247 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(15984116374545286033777 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(285519528537024161627 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(38079036866730112431 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w42S0 : Ball := ⟨(10962892317731439802072583324959 / 12500000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ +def w42S1 : Ball := ⟨(76918405100912012840008993922001 / 100000000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ +def w42S2 : Ball := ⟨(29582205216340035780846291658461 / 50000000000000000000000000000000), (7 / 100000000000000000000000000000000)⟩ +def w42S3 : Ball := ⟨(7000854923693244985245369826549 / 20000000000000000000000000000000), (9 / 100000000000000000000000000000000)⟩ +def w42S4 : Ball := ⟨(1531624051956248470783775251121 / 12500000000000000000000000000000), (7 / 100000000000000000000000000000000)⟩ +def w42S5 : Ball := ⟨(1501358231379761225653256402091 / 100000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ +abbrev w42 : Ball := w42S5 +lemma w42_sound : w42.Encloses (weight (-41988) : ℝ) := by + exact weight_enclosed_of_trace (-41988) w42Trace w42S0 w42S1 w42S2 w42S3 w42S4 w42S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def w43Trace : List Ball := [ + ⟨(18768602587146882807725460765333 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(48444451944061654970230213313679 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(24478749835272702705991233814737 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(8202608935959436148650365344681 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1028566686984192257156374634097 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(41229343480617762904287685491 / 5000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(68818991657560464205199889949 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(19684769294602771237596010681 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1231378778791797647368648421 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(273832073963273001117079139 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1712434990495112277840229 / 6250000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2492008868478492563381839 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(103875840202050172595989 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(15986458414841714877769 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(228446865341213778407 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(38083958234795805067 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w43S0 : Ball := ⟨(88065110768564165664786346892799 / 100000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +def w43S1 : Ball := ⟨(38777318673397380866730711376171 / 50000000000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ +def w43S2 : Ball := ⟨(60147217739928528397467895558911 / 100000000000000000000000000000000), (1 / 10000000000000000000000000000000)⟩ +def w43S3 : Ball := ⟨(4522109752317966339400693332341 / 12500000000000000000000000000000), (13 / 100000000000000000000000000000000)⟩ +def w43S4 : Ball := ⟨(13087665031685925678415575616303 / 100000000000000000000000000000000), (1 / 10000000000000000000000000000000)⟩ +def w43S5 : Ball := ⟨(428217439954036404979998637487 / 25000000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ +abbrev w43 : Ball := w43S5 +lemma w43_sound : w43.Encloses (weight (-40670) : ℝ) := by + exact weight_enclosed_of_trace (-40670) w43Trace w43S0 w43S1 w43S2 w43S3 w43S4 w43S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def w44Trace : List Ball := [ + ⟨(93974191493122407656718784062291 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(96955889088939538910397682022679 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(23916046352232353441792145211 / 48828125000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(8205447068609333477149530232273 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(514425843620272953273544252053 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(412388718459236045682322206297 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(137665268139360289118084002237 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(19688185833123085612307106233 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(492627540295271625210502361 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(68467532913805441181202433 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(27402422922560608218237489 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1246148844933889254383187 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(207773912733602071421357 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1598804738662780966603 / 10000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1142340308830328774939 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(76174592801990288763 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w44S0 : Ball := ⟨(88311486667860398901944158266741 / 100000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +def w44S1 : Ball := ⟨(77989186774876849812044262325741 / 100000000000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ +def w44S2 : Ball := ⟨(30411566269033130673026512020737 / 50000000000000000000000000000000), (1 / 10000000000000000000000000000000)⟩ +def w44S3 : Ball := ⟨(7398906903486349533420526238933 / 20000000000000000000000000000000), (13 / 100000000000000000000000000000000)⟩ +def w44S4 : Ball := ⟨(3421488960403622578089278590683 / 25000000000000000000000000000000), (11 / 100000000000000000000000000000000)⟩ +def w44S5 : Ball := ⟨(1873053872986217918406611259251 / 100000000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ +abbrev w44 : Ball := w44S5 +lemma w44_sound : w44.Encloses (weight (-39776) : ℝ) := by + exact weight_enclosed_of_trace (-39776) w44Trace w44S0 w44S1 w44S2 w44S3 w44S4 w44S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def w45Trace : List Ball := [ + ⟨(47000459601997266693962241397303 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(757574480477530258634580644213 / 781250000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(48984658263391453570115513109833 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(16412050094192799796082022773821 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4115638894359620073096229009981 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(824816241766677271432037689513 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(137670823929380199445098046299 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4922220374839377456345274901 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1231607551950953736102805371 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(273877880597224816277989409 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(3425391003958357827112761 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2492356495534119887340207 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(207778439319929123240953 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(15988370904712698710273 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1142361886894634768819 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(3047038078634267457 / 4000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w45S0 : Ball := ⟨(88361728111959082604959394227423 / 100000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +def w45S1 : Ball := ⟨(9759743743664725026340928831601 / 12500000000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ +def w45S2 : Ball := ⟨(30480831341440877402475084818783 / 50000000000000000000000000000000), (1 / 10000000000000000000000000000000)⟩ +def w45S3 : Ball := ⟨(232270269816341119443749211379 / 625000000000000000000000000000), (13 / 100000000000000000000000000000000)⟩ +def w45S4 : Ball := ⟨(215797912962223617937337370743 / 1562500000000000000000000000000), (1 / 10000000000000000000000000000000)⟩ +def w45S5 : Ball := ⟨(381491111844670997969310464477 / 20000000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ +abbrev w45 : Ball := w45S5 +lemma w45_sound : w45.Encloses (weight (-39594) : ℝ) := by + exact weight_enclosed_of_trace (-39594) w45Trace w45S0 w45S1 w45S2 w45S3 w45S4 w45S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def w46Trace : List Ball := [ + ⟨(23536830506163163707208377622791 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(24261062129011224088984878009581 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(49009817859248311627512106727623 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1641837841548993622447410991039 / 10000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2058454851975587893197009223493 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(206257164476878098440948109979 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(68850617551756584855512873557 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(9846344663460027382667634801 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2463638768430057590648224087 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(273920293962133881870515871 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(27406987350225809089504263 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2492678356558686987770239 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(20780321443365794679471 / 10000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(15990141582847492572937 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1142479987135035414571 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(38091695013727607147 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w46S0 : Ball := ⟨(5539823902758529290786150114571 / 6250000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ +def w46S1 : Ball := ⟨(19641375279087835517122439830721 / 25000000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ +def w46S2 : Ball := ⟨(61725379656634039768041833102823 / 100000000000000000000000000000000), (7 / 100000000000000000000000000000000)⟩ +def w46S3 : Ball := ⟨(38100224937556113691351706543513 / 100000000000000000000000000000000), (9 / 100000000000000000000000000000000)⟩ +def w46S4 : Ball := ⟨(1451627140292372767431400084211 / 10000000000000000000000000000000), (1 / 12500000000000000000000000000000)⟩ +def w46S5 : Ball := ⟨(2107221354433412088486138736013 / 100000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +abbrev w46 : Ball := w46S5 +lemma w46_sound : w46.Encloses (weight (-38598) : ℝ) := by + exact weight_enclosed_of_trace (-38598) w46Trace w46S0 w46S1 w46S2 w46S3 w46S4 w46S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def w47Trace : List Ball := [ + ⟨(23551067237312741282554264861991 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(97073300161717367162887177862469 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(49019598976757609477695066028629 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4105209591970440019072765314159 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2058701829608492552411445165259 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(412555609219808426631295374831 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(68856527334779870263474569491 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(492354230699703587737457761 / 2500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1231901710244256452585564589 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(273936777078303166045874577 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2740848717373724600264619 / 10000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(498560687546165114459831 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(207812842389407116586209 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1599082968609245640707 / 10000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(571262940863380218867 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(76186280117654642291 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w47S0 : Ball := ⟨(22186110720657023844621600833661 / 25000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +def w47S1 : Ball := ⟨(78755761425480404148054640884943 / 100000000000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ +def w47S2 : Ball := ⟨(62024699577071872195687741389427 / 100000000000000000000000000000000), (1 / 10000000000000000000000000000000)⟩ +def w47S3 : Ball := ⟨(38470633576260196816199481947743 / 100000000000000000000000000000000), (13 / 100000000000000000000000000000000)⟩ +def w47S4 : Ball := ⟨(2959979295517756841046743768497 / 20000000000000000000000000000000), (11 / 100000000000000000000000000000000)⟩ +def w47S5 : Ball := ⟨(2190369357473449020988501877573 / 100000000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ +abbrev w47 : Ball := w47S5 +lemma w47_sound : w47.Encloses (weight (-38211) : ℝ) := by + exact weight_enclosed_of_trace (-38211) w47Trace w47S0 w47S1 w47S2 w47S3 w47S4 w47S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def w48Trace : List Ball := [ + ⟨(94419270218361035809552428430393 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(6073933153721119057953386558127 / 6250000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(12264125121733108718963060818321 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4107529443045559965815223015743 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2059633386890960412762512875007 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(825422601388695535770847481979 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(17219703841179359082468113527 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(19699750273470025757840325167 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2464424341311545703107438829 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(273998935083751948153589919 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(6853535725324154862791787 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2493275101249825013324713 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(51962286871340288117099 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(15993424350367215040567 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(28567473423769942893 / 2500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(38098587916192909579 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w48S0 : Ball := ⟨(17829997177135758485690281196141 / 20000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +def w48S1 : Ball := ⟨(39738599917083639520280180951687 / 50000000000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ +def w48S2 : Ball := ⟨(1263325058696031873405067866189 / 2000000000000000000000000000000), (1 / 10000000000000000000000000000000)⟩ +def w48S3 : Ball := ⟨(9974938774558327363519202549313 / 25000000000000000000000000000000), (13 / 100000000000000000000000000000000)⟩ +def w48S4 : Ball := ⟨(15919904568989949697634800424041 / 100000000000000000000000000000000), (11 / 100000000000000000000000000000000)⟩ +def w48S5 : Ball := ⟨(316804201857183845064891195671 / 12500000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ +abbrev w48 : Ball := w48S5 +lemma w48_sound : w48.Encloses (weight (-36752) : ℝ) := by + exact weight_enclosed_of_trace (-36752) w48Trace w48S0 w48S1 w48S2 w48S3 w48S4 w48S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def w49Trace : List Ball := [ + ⟨(18888044363634577489035029389757 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(97193609297168861925373011548139 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2453004711570511291670680974039 / 5000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4107755339370769370494970857013 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(823889636042049047798641205753 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(825452918112802887490161383703 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(27552394106197680085386767351 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2462536701230239742048734519 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(77015149646502777083525643 / 3125000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(274004986102442690977777081 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(27414693470264352651994297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2493321015618255131393993 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(41570536315688159034031 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(7996838461536800847379 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(571357891269164968123 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(76198236278918942609 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w49S0 : Ball := ⟨(89189554970656982824678062734767 / 100000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ +def w49S1 : Ball := ⟨(79547767158638437124123715241031 / 100000000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ +def w49S2 : Ball := ⟨(63278472599249558923540404915203 / 100000000000000000000000000000000), (7 / 100000000000000000000000000000000)⟩ +def w49S3 : Ball := ⟨(10010412736234943074528092941621 / 25000000000000000000000000000000), (9 / 100000000000000000000000000000000)⟩ +def w49S4 : Ball := ⟨(16033338103963961597925957726953 / 100000000000000000000000000000000), (1 / 12500000000000000000000000000000)⟩ +def w49S5 : Ball := ⟨(2570679307560226830456392695549 / 100000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +abbrev w49 : Ball := w49S5 +lemma w49_sound : w49.Encloses (weight (-36610) : ℝ) := by + exact weight_enclosed_of_trace (-36610) w49Trace w49S0 w49S1 w49S2 w49S3 w49S4 w49S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def Z0_6_2Raw (ij : PairSlot) : Ball := + match ij.1.val, ij.2.val with + | 0, 0 => w195 + | 0, 1 => w195 + | 0, 2 => w195 + | 0, 3 => w195 + | 0, 4 => w195 + | 0, 5 => w195 + | 1, 0 => w195 + | 1, 1 => w195 + | 1, 2 => w195 + | 1, 3 => w195 + | 1, 4 => w195 + | 1, 5 => w195 + | 2, 0 => w195 + | 2, 1 => w195 + | 2, 2 => w195 + | 2, 3 => w195 + | 2, 4 => w195 + | 2, 5 => w116 + | 3, 0 => w195 + | 3, 1 => w195 + | 3, 2 => w195 + | 3, 3 => w195 + | 3, 4 => w195 + | 3, 5 => w43 + | 4, 0 => w195 + | 4, 1 => w195 + | 4, 2 => w195 + | 4, 3 => w195 + | 4, 4 => w195 + | 4, 5 => w195 + | 5, 0 => w195 + | 5, 1 => w195 + | 5, 2 => w116 + | 5, 3 => w43 + | 5, 4 => w195 + | 5, 5 => w195 + | _, _ => (.exact 0) +lemma Z0_6_2Raw_sound_0 (j : Fin 6) : + (Z0_6_2Raw (0,j)).Encloses (weight (orderedPairInteger (shape 0 6 2) 0 j) : ℝ) := by + fin_cases j + · change (Z0_6_2Raw (0,0)).Encloses (weight (orderedPairInteger (shape 0 6 2) 0 0) : ℝ) + have he : orderedPairInteger (shape 0 6 2) 0 0 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_6_2Raw (0,1)).Encloses (weight (orderedPairInteger (shape 0 6 2) 0 1) : ℝ) + have he : orderedPairInteger (shape 0 6 2) 0 1 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_6_2Raw (0,2)).Encloses (weight (orderedPairInteger (shape 0 6 2) 0 2) : ℝ) + have he : orderedPairInteger (shape 0 6 2) 0 2 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_6_2Raw (0,3)).Encloses (weight (orderedPairInteger (shape 0 6 2) 0 3) : ℝ) + have he : orderedPairInteger (shape 0 6 2) 0 3 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_6_2Raw (0,4)).Encloses (weight (orderedPairInteger (shape 0 6 2) 0 4) : ℝ) + have he : orderedPairInteger (shape 0 6 2) 0 4 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_6_2Raw (0,5)).Encloses (weight (orderedPairInteger (shape 0 6 2) 0 5) : ℝ) + have he : orderedPairInteger (shape 0 6 2) 0 5 = (0) := by decide +kernel + rw [he] + exact w195_sound +lemma Z0_6_2Raw_sound_1 (j : Fin 6) : + (Z0_6_2Raw (1,j)).Encloses (weight (orderedPairInteger (shape 0 6 2) 1 j) : ℝ) := by + fin_cases j + · change (Z0_6_2Raw (1,0)).Encloses (weight (orderedPairInteger (shape 0 6 2) 1 0) : ℝ) + have he : orderedPairInteger (shape 0 6 2) 1 0 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_6_2Raw (1,1)).Encloses (weight (orderedPairInteger (shape 0 6 2) 1 1) : ℝ) + have he : orderedPairInteger (shape 0 6 2) 1 1 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_6_2Raw (1,2)).Encloses (weight (orderedPairInteger (shape 0 6 2) 1 2) : ℝ) + have he : orderedPairInteger (shape 0 6 2) 1 2 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_6_2Raw (1,3)).Encloses (weight (orderedPairInteger (shape 0 6 2) 1 3) : ℝ) + have he : orderedPairInteger (shape 0 6 2) 1 3 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_6_2Raw (1,4)).Encloses (weight (orderedPairInteger (shape 0 6 2) 1 4) : ℝ) + have he : orderedPairInteger (shape 0 6 2) 1 4 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_6_2Raw (1,5)).Encloses (weight (orderedPairInteger (shape 0 6 2) 1 5) : ℝ) + have he : orderedPairInteger (shape 0 6 2) 1 5 = (0) := by decide +kernel + rw [he] + exact w195_sound +lemma Z0_6_2Raw_sound_2 (j : Fin 6) : + (Z0_6_2Raw (2,j)).Encloses (weight (orderedPairInteger (shape 0 6 2) 2 j) : ℝ) := by + fin_cases j + · change (Z0_6_2Raw (2,0)).Encloses (weight (orderedPairInteger (shape 0 6 2) 2 0) : ℝ) + have he : orderedPairInteger (shape 0 6 2) 2 0 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_6_2Raw (2,1)).Encloses (weight (orderedPairInteger (shape 0 6 2) 2 1) : ℝ) + have he : orderedPairInteger (shape 0 6 2) 2 1 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_6_2Raw (2,2)).Encloses (weight (orderedPairInteger (shape 0 6 2) 2 2) : ℝ) + have he : orderedPairInteger (shape 0 6 2) 2 2 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_6_2Raw (2,3)).Encloses (weight (orderedPairInteger (shape 0 6 2) 2 3) : ℝ) + have he : orderedPairInteger (shape 0 6 2) 2 3 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_6_2Raw (2,4)).Encloses (weight (orderedPairInteger (shape 0 6 2) 2 4) : ℝ) + have he : orderedPairInteger (shape 0 6 2) 2 4 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_6_2Raw (2,5)).Encloses (weight (orderedPairInteger (shape 0 6 2) 2 5) : ℝ) + have he : orderedPairInteger (shape 0 6 2) 2 5 = (-14326) := by decide +kernel + rw [he] + exact w116_sound +lemma Z0_6_2Raw_sound_3 (j : Fin 6) : + (Z0_6_2Raw (3,j)).Encloses (weight (orderedPairInteger (shape 0 6 2) 3 j) : ℝ) := by + fin_cases j + · change (Z0_6_2Raw (3,0)).Encloses (weight (orderedPairInteger (shape 0 6 2) 3 0) : ℝ) + have he : orderedPairInteger (shape 0 6 2) 3 0 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_6_2Raw (3,1)).Encloses (weight (orderedPairInteger (shape 0 6 2) 3 1) : ℝ) + have he : orderedPairInteger (shape 0 6 2) 3 1 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_6_2Raw (3,2)).Encloses (weight (orderedPairInteger (shape 0 6 2) 3 2) : ℝ) + have he : orderedPairInteger (shape 0 6 2) 3 2 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_6_2Raw (3,3)).Encloses (weight (orderedPairInteger (shape 0 6 2) 3 3) : ℝ) + have he : orderedPairInteger (shape 0 6 2) 3 3 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_6_2Raw (3,4)).Encloses (weight (orderedPairInteger (shape 0 6 2) 3 4) : ℝ) + have he : orderedPairInteger (shape 0 6 2) 3 4 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_6_2Raw (3,5)).Encloses (weight (orderedPairInteger (shape 0 6 2) 3 5) : ℝ) + have he : orderedPairInteger (shape 0 6 2) 3 5 = (-40670) := by decide +kernel + rw [he] + exact w43_sound +lemma Z0_6_2Raw_sound_4 (j : Fin 6) : + (Z0_6_2Raw (4,j)).Encloses (weight (orderedPairInteger (shape 0 6 2) 4 j) : ℝ) := by + fin_cases j + · change (Z0_6_2Raw (4,0)).Encloses (weight (orderedPairInteger (shape 0 6 2) 4 0) : ℝ) + have he : orderedPairInteger (shape 0 6 2) 4 0 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_6_2Raw (4,1)).Encloses (weight (orderedPairInteger (shape 0 6 2) 4 1) : ℝ) + have he : orderedPairInteger (shape 0 6 2) 4 1 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_6_2Raw (4,2)).Encloses (weight (orderedPairInteger (shape 0 6 2) 4 2) : ℝ) + have he : orderedPairInteger (shape 0 6 2) 4 2 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_6_2Raw (4,3)).Encloses (weight (orderedPairInteger (shape 0 6 2) 4 3) : ℝ) + have he : orderedPairInteger (shape 0 6 2) 4 3 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_6_2Raw (4,4)).Encloses (weight (orderedPairInteger (shape 0 6 2) 4 4) : ℝ) + have he : orderedPairInteger (shape 0 6 2) 4 4 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_6_2Raw (4,5)).Encloses (weight (orderedPairInteger (shape 0 6 2) 4 5) : ℝ) + have he : orderedPairInteger (shape 0 6 2) 4 5 = (0) := by decide +kernel + rw [he] + exact w195_sound +lemma Z0_6_2Raw_sound_5 (j : Fin 6) : + (Z0_6_2Raw (5,j)).Encloses (weight (orderedPairInteger (shape 0 6 2) 5 j) : ℝ) := by + fin_cases j + · change (Z0_6_2Raw (5,0)).Encloses (weight (orderedPairInteger (shape 0 6 2) 5 0) : ℝ) + have he : orderedPairInteger (shape 0 6 2) 5 0 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_6_2Raw (5,1)).Encloses (weight (orderedPairInteger (shape 0 6 2) 5 1) : ℝ) + have he : orderedPairInteger (shape 0 6 2) 5 1 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_6_2Raw (5,2)).Encloses (weight (orderedPairInteger (shape 0 6 2) 5 2) : ℝ) + have he : orderedPairInteger (shape 0 6 2) 5 2 = (-14326) := by decide +kernel + rw [he] + exact w116_sound + · change (Z0_6_2Raw (5,3)).Encloses (weight (orderedPairInteger (shape 0 6 2) 5 3) : ℝ) + have he : orderedPairInteger (shape 0 6 2) 5 3 = (-40670) := by decide +kernel + rw [he] + exact w43_sound + · change (Z0_6_2Raw (5,4)).Encloses (weight (orderedPairInteger (shape 0 6 2) 5 4) : ℝ) + have he : orderedPairInteger (shape 0 6 2) 5 4 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_6_2Raw (5,5)).Encloses (weight (orderedPairInteger (shape 0 6 2) 5 5) : ℝ) + have he : orderedPairInteger (shape 0 6 2) 5 5 = (0) := by decide +kernel + rw [he] + exact w195_sound +lemma Z0_6_2Raw_sound (ij : PairSlot) : + (Z0_6_2Raw ij).Encloses (weight (orderedPairInteger (shape 0 6 2) ij.1 ij.2) : ℝ) := by + rcases ij with ⟨i,j⟩ + revert i + exact forall_fin6 (Z0_6_2Raw_sound_0 j) (Z0_6_2Raw_sound_1 j) (Z0_6_2Raw_sound_2 j) (Z0_6_2Raw_sound_3 j) (Z0_6_2Raw_sound_4 j) (Z0_6_2Raw_sound_5 j) +def Z0_6_2Den : Ball := ⟨(37790811240383961412008118251139 / 25000000000000000000000000000000), (3 / 5000000000000000000000000000000)⟩ +lemma Z0_6_2Den_sound : Z0_6_2Den.Encloses + (((orderedPairs (shape 0 6 2)).map (fun ij => weight (orderedPairInteger (shape 0 6 2) ij.1 ij.2))).sum : ℝ) := by + exact contains_sound (list_cast_enclosed (orderedPairs (shape 0 6 2)) Z0_6_2Raw + (fun ij => weight (orderedPairInteger (shape 0 6 2) ij.1 ij.2)) + (fun ij _ => Z0_6_2Raw_sound ij)) (by decide +kernel) +lemma Z0_6_2Den_pos : 0 < Z0_6_2Den.lower := by decide +kernel +def Z0_6_2Probs (ij : PairSlot) : Ball := + match ij.1.val, ij.2.val with + | 2, 5 => ⟨(15790050502703409550191718781019 / 100000000000000000000000000000000), (3 / 12500000000000000000000000000000)⟩ + | 3, 5 => ⟨(1133125820533948503508356844879 / 100000000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ + | 4, 4 => ⟨(16538411838381320973149962187051 / 25000000000000000000000000000000), (27 / 100000000000000000000000000000000)⟩ + | 5, 2 => ⟨(15790050502703409550191718781019 / 100000000000000000000000000000000), (3 / 12500000000000000000000000000000)⟩ + | 5, 3 => ⟨(1133125820533948503508356844879 / 100000000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ + | _, _ => (.exact 0) +lemma Z0_6_2Contains : ∀ i j : Fin 6, + statisticWeight i + statisticWeight j = shapeMax (shape 0 6 2) → + contains (.mul (Z0_6_2Raw (i,j)) (.inv Z0_6_2Den)) (Z0_6_2Probs (i,j)) = true := by + decide +kernel +lemma Z0_6_2Zero : ∀ i j : Fin 6, + statisticWeight i + statisticWeight j ≠ shapeMax (shape 0 6 2) → Z0_6_2Probs (i,j) = .exact 0 := by + decide +kernel +lemma Z0_6_2Probs_sound (ij : PairSlot) : + (Z0_6_2Probs ij).Encloses (zeroPairLaw (shape 0 6 2) ij.1 ij.2 : ℝ) := by + by_cases h : statisticWeight ij.1 + statisticWeight ij.2 = shapeMax (shape 0 6 2) + · have hb := contains_sound (Ball.mul_sound (Z0_6_2Raw_sound ij) + (Ball.inv_sound Z0_6_2Den_sound Z0_6_2Den_pos)) (Z0_6_2Contains ij.1 ij.2 h) + simpa only [zeroPairLaw, h, ite_true, Rat.cast_div, Rat.cast_mul, + Rat.cast_inv, div_eq_mul_inv] using hb + · rw [Z0_6_2Zero ij.1 ij.2 h] + simpa only [zeroPairLaw, h, ite_false] using Ball.exact_sound 0 + +def Z0_6_2Half (w : Fin 3) (ij : PairSlot) : Ball := + if (shape 0 6 2) w = 0 then if ij = (0,0) then .exact 1 else .exact 0 + else if w = halfMaxAxis (shape 0 6 2) then Z0_6_2Probs ij + else Z0_6_2Probs (kappa ij.1, kappa ij.2) +lemma Z0_6_2Half_sound (w : Fin 3) (ij : PairSlot) : + (Z0_6_2Half w ij).Encloses (halfLaw (shape 0 6 2) w ij : ℝ) := by + have hp : positive (shape 0 6 2) = false := by decide +kernel + simp only [Z0_6_2Half, halfLaw, hp, Bool.false_eq_true, ite_false] + split_ifs + · exact Ball.exact_sound 1 + · exact Ball.exact_sound 0 + · exact Z0_6_2Probs_sound _ + · exact Z0_6_2Probs_sound _ + +def Z0_6_2Value (a : PairSlot) : ℝ := (zeroPairLaw (shape 0 6 2) a.1 a.2 : ℝ) +def Z0_6_2E_2_5LogWitness : LogWitness := ⟨-3, 15790050502703409550191718781019, 12500000000000000000000000000000⟩ +def Z0_6_2E_2_5Log : Ball := ⟨(-184579015932771950225933227583663 / 100000000000000000000000000000000), (84703294883 / 100000000000000000000000000000000)⟩ +lemma Z0_6_2E_2_5Log_sound : Z0_6_2E_2_5Log.Encloses (Real.log (Z0_6_2Value ((2,5) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound (Z0_6_2Probs_sound ((2,5) : PairSlot)) (w := Z0_6_2E_2_5LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z0_6_2E_2_5 : Ball := ⟨(29145119833177663734886171853233 / 100000000000000000000000000000000), (2674938617 / 20000000000000000000000000000000)⟩ +lemma Z0_6_2E_2_5_sound : Z0_6_2E_2_5.Encloses (Foundation.entropyTerm (Z0_6_2Value ((2,5) : PairSlot))) := by + exact contains_sound (entropyTerm_ball (Z0_6_2Probs_sound ((2,5) : PairSlot)) Z0_6_2E_2_5Log_sound) (by decide +kernel) +def Z0_6_2E_3_5LogWitness : LogWitness := ⟨-7, 1133125820533948503508356844879, 781250000000000000000000000000⟩ +def Z0_6_2E_3_5Log : Ball := ⟨(-448019015932771950225933151201643 / 100000000000000000000000000000000), (21175823727 / 12500000000000000000000000000000)⟩ +lemma Z0_6_2E_3_5Log_sound : Z0_6_2E_3_5Log.Encloses (Real.log (Z0_6_2Value ((3,5) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound (Z0_6_2Probs_sound ((3,5) : PairSlot)) (w := Z0_6_2E_3_5LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z0_6_2E_3_5 : Ball := ⟨(1015323830087268728146699904139 / 20000000000000000000000000000000), (191958983 / 10000000000000000000000000000000)⟩ +lemma Z0_6_2E_3_5_sound : Z0_6_2E_3_5.Encloses (Foundation.entropyTerm (Z0_6_2Value ((3,5) : PairSlot))) := by + exact contains_sound (entropyTerm_ball (Z0_6_2Probs_sound ((3,5) : PairSlot)) Z0_6_2E_3_5Log_sound) (by decide +kernel) +def Z0_6_2E_4_4LogWitness : LogWitness := ⟨-1, 16538411838381320973149962187051, 12500000000000000000000000000000⟩ +def Z0_6_2E_4_4Log : Ball := ⟨(-10329753983192987556483316443661 / 25000000000000000000000000000000), (21175823703 / 50000000000000000000000000000000)⟩ +lemma Z0_6_2E_4_4Log_sound : Z0_6_2E_4_4Log.Encloses (Real.log (Z0_6_2Value ((4,4) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound (Z0_6_2Probs_sound ((4,4) : PairSlot)) (w := Z0_6_2E_4_4LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z0_6_2E_4_4 : Ball := ⟨(6833509022528220411360048899287 / 25000000000000000000000000000000), (5603431897 / 20000000000000000000000000000000)⟩ +lemma Z0_6_2E_4_4_sound : Z0_6_2E_4_4.Encloses (Foundation.entropyTerm (Z0_6_2Value ((4,4) : PairSlot))) := by + exact contains_sound (entropyTerm_ball (Z0_6_2Probs_sound ((4,4) : PairSlot)) Z0_6_2E_4_4Log_sound) (by decide +kernel) +def Z0_6_2E_5_2LogWitness : LogWitness := ⟨-3, 15790050502703409550191718781019, 12500000000000000000000000000000⟩ +def Z0_6_2E_5_2Log : Ball := ⟨(-184579015932771950225933227583663 / 100000000000000000000000000000000), (84703294883 / 100000000000000000000000000000000)⟩ +lemma Z0_6_2E_5_2Log_sound : Z0_6_2E_5_2Log.Encloses (Real.log (Z0_6_2Value ((5,2) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound (Z0_6_2Probs_sound ((5,2) : PairSlot)) (w := Z0_6_2E_5_2LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z0_6_2E_5_2 : Ball := ⟨(29145119833177663734886171853233 / 100000000000000000000000000000000), (2674938617 / 20000000000000000000000000000000)⟩ +lemma Z0_6_2E_5_2_sound : Z0_6_2E_5_2.Encloses (Foundation.entropyTerm (Z0_6_2Value ((5,2) : PairSlot))) := by + exact contains_sound (entropyTerm_ball (Z0_6_2Probs_sound ((5,2) : PairSlot)) Z0_6_2E_5_2Log_sound) (by decide +kernel) +def Z0_6_2E_5_3LogWitness : LogWitness := ⟨-7, 1133125820533948503508356844879, 781250000000000000000000000000⟩ +def Z0_6_2E_5_3Log : Ball := ⟨(-448019015932771950225933151201643 / 100000000000000000000000000000000), (21175823727 / 12500000000000000000000000000000)⟩ +lemma Z0_6_2E_5_3Log_sound : Z0_6_2E_5_3Log.Encloses (Real.log (Z0_6_2Value ((5,3) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound (Z0_6_2Probs_sound ((5,3) : PairSlot)) (w := Z0_6_2E_5_3LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z0_6_2E_5_3 : Ball := ⟨(1015323830087268728146699904139 / 20000000000000000000000000000000), (191958983 / 10000000000000000000000000000000)⟩ +lemma Z0_6_2E_5_3_sound : Z0_6_2E_5_3.Encloses (Foundation.entropyTerm (Z0_6_2Value ((5,3) : PairSlot))) := by + exact contains_sound (entropyTerm_ball (Z0_6_2Probs_sound ((5,3) : PairSlot)) Z0_6_2E_5_3Log_sound) (by decide +kernel) +def Z0_6_2Terms (a : PairSlot) : Ball := + match a.1.val, a.2.val with + | 2, 5 => ⟨(29145119833177663734886171853233 / 100000000000000000000000000000000), (2674938617 / 20000000000000000000000000000000)⟩ + | 3, 5 => ⟨(1015323830087268728146699904139 / 20000000000000000000000000000000), (191958983 / 10000000000000000000000000000000)⟩ + | 4, 4 => ⟨(6833509022528220411360048899287 / 25000000000000000000000000000000), (5603431897 / 20000000000000000000000000000000)⟩ + | 5, 2 => ⟨(29145119833177663734886171853233 / 100000000000000000000000000000000), (2674938617 / 20000000000000000000000000000000)⟩ + | 5, 3 => ⟨(1015323830087268728146699904139 / 20000000000000000000000000000000), (191958983 / 10000000000000000000000000000000)⟩ + | _, _ => (.exact 0) +lemma Z0_6_2Terms_sound (a : PairSlot) : + (Z0_6_2Terms a).Encloses (Foundation.entropyTerm (Z0_6_2Value a)) := by + rcases a with ⟨i,j⟩ + revert j i + apply forall_fin6 + · exact forall_fin6 (entropyTerm_zero_ball (Z0_6_2Probs_sound ((0,0) : PairSlot))) (entropyTerm_zero_ball (Z0_6_2Probs_sound ((0,1) : PairSlot))) (entropyTerm_zero_ball (Z0_6_2Probs_sound ((0,2) : PairSlot))) (entropyTerm_zero_ball (Z0_6_2Probs_sound ((0,3) : PairSlot))) (entropyTerm_zero_ball (Z0_6_2Probs_sound ((0,4) : PairSlot))) (entropyTerm_zero_ball (Z0_6_2Probs_sound ((0,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball (Z0_6_2Probs_sound ((1,0) : PairSlot))) (entropyTerm_zero_ball (Z0_6_2Probs_sound ((1,1) : PairSlot))) (entropyTerm_zero_ball (Z0_6_2Probs_sound ((1,2) : PairSlot))) (entropyTerm_zero_ball (Z0_6_2Probs_sound ((1,3) : PairSlot))) (entropyTerm_zero_ball (Z0_6_2Probs_sound ((1,4) : PairSlot))) (entropyTerm_zero_ball (Z0_6_2Probs_sound ((1,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball (Z0_6_2Probs_sound ((2,0) : PairSlot))) (entropyTerm_zero_ball (Z0_6_2Probs_sound ((2,1) : PairSlot))) (entropyTerm_zero_ball (Z0_6_2Probs_sound ((2,2) : PairSlot))) (entropyTerm_zero_ball (Z0_6_2Probs_sound ((2,3) : PairSlot))) (entropyTerm_zero_ball (Z0_6_2Probs_sound ((2,4) : PairSlot))) Z0_6_2E_2_5_sound + · exact forall_fin6 (entropyTerm_zero_ball (Z0_6_2Probs_sound ((3,0) : PairSlot))) (entropyTerm_zero_ball (Z0_6_2Probs_sound ((3,1) : PairSlot))) (entropyTerm_zero_ball (Z0_6_2Probs_sound ((3,2) : PairSlot))) (entropyTerm_zero_ball (Z0_6_2Probs_sound ((3,3) : PairSlot))) (entropyTerm_zero_ball (Z0_6_2Probs_sound ((3,4) : PairSlot))) Z0_6_2E_3_5_sound + · exact forall_fin6 (entropyTerm_zero_ball (Z0_6_2Probs_sound ((4,0) : PairSlot))) (entropyTerm_zero_ball (Z0_6_2Probs_sound ((4,1) : PairSlot))) (entropyTerm_zero_ball (Z0_6_2Probs_sound ((4,2) : PairSlot))) (entropyTerm_zero_ball (Z0_6_2Probs_sound ((4,3) : PairSlot))) Z0_6_2E_4_4_sound (entropyTerm_zero_ball (Z0_6_2Probs_sound ((4,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball (Z0_6_2Probs_sound ((5,0) : PairSlot))) (entropyTerm_zero_ball (Z0_6_2Probs_sound ((5,1) : PairSlot))) Z0_6_2E_5_2_sound Z0_6_2E_5_3_sound (entropyTerm_zero_ball (Z0_6_2Probs_sound ((5,4) : PairSlot))) (entropyTerm_zero_ball (Z0_6_2Probs_sound ((5,5) : PairSlot))) +def Z0_6_2Entropy : Ball := ⟨(23944378514335224099169884586251 / 25000000000000000000000000000000), (11721145063 / 20000000000000000000000000000000)⟩ +lemma Z0_6_2Entropy_sound : Z0_6_2Entropy.Encloses (Foundation.finiteEntropy Z0_6_2Value) := by + exact contains_sound (entropyPair_enclosed Z0_6_2Value Z0_6_2Terms Z0_6_2Terms_sound) (by decide +kernel) +def Z0_6_2Labels : Ball := ⟨(203936037047735086277507450911049 / 50000000000000000000000000000000), (132456585791 / 100000000000000000000000000000000)⟩ +lemma Z0_6_2Labels_sound : Z0_6_2Labels.Encloses + (∑ a : PairSlot, (zeroPairLaw (shape 0 6 2) a.1 a.2 : ℝ) * + Real.log (AllFieldParameters.multiplicity a.1 * AllFieldParameters.multiplicity a.2 : ℕ)) := by + exact contains_sound (pairSumBall_sound (fun a => .mul (Z0_6_2Probs a) (multLogs a)) + _ (fun a => Ball.mul_sound (Z0_6_2Probs_sound a) (multLogs_sound a))) (by decide +kernel) +def Z0_6_2Four : Ball := ⟨(251824794076405534475847220083551 / 50000000000000000000000000000000), (95531155553 / 50000000000000000000000000000000)⟩ +lemma Z0_6_2Four_sound : Z0_6_2Four.Encloses (AllFieldZeroLeafRates.fourRate (shape 0 6 2)) := by + exact contains_sound (Ball.add_sound Z0_6_2Entropy_sound Z0_6_2Labels_sound) (by decide +kernel) +def Z0_6_2H0Value (a : PairSlot) : ℝ := (halfLaw (shape 0 6 2) 0 a : ℝ) +def Z0_6_2H0E_0_0Log : Ball := .exact 0 +lemma Z0_6_2H0E_0_0Log_sound : Z0_6_2H0E_0_0Log.Encloses (Real.log (Z0_6_2H0Value ((0,0) : PairSlot))) := by + exact log_exact_one_ball ((Z0_6_2Half_sound 0) ((0,0) : PairSlot)) +def Z0_6_2H0E_0_0 : Ball := ⟨0, 0⟩ +lemma Z0_6_2H0E_0_0_sound : Z0_6_2H0E_0_0.Encloses (Foundation.entropyTerm (Z0_6_2H0Value ((0,0) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z0_6_2Half_sound 0) ((0,0) : PairSlot)) Z0_6_2H0E_0_0Log_sound) (by decide +kernel) +def Z0_6_2H0Terms (a : PairSlot) : Ball := + match a.1.val, a.2.val with + | 0, 0 => ⟨0, 0⟩ + | _, _ => (.exact 0) +lemma Z0_6_2H0Terms_sound (a : PairSlot) : + (Z0_6_2H0Terms a).Encloses (Foundation.entropyTerm (Z0_6_2H0Value a)) := by + rcases a with ⟨i,j⟩ + revert j i + apply forall_fin6 + · exact forall_fin6 Z0_6_2H0E_0_0_sound (entropyTerm_zero_ball ((Z0_6_2Half_sound 0) ((0,1) : PairSlot))) (entropyTerm_zero_ball ((Z0_6_2Half_sound 0) ((0,2) : PairSlot))) (entropyTerm_zero_ball ((Z0_6_2Half_sound 0) ((0,3) : PairSlot))) (entropyTerm_zero_ball ((Z0_6_2Half_sound 0) ((0,4) : PairSlot))) (entropyTerm_zero_ball ((Z0_6_2Half_sound 0) ((0,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z0_6_2Half_sound 0) ((1,0) : PairSlot))) (entropyTerm_zero_ball ((Z0_6_2Half_sound 0) ((1,1) : PairSlot))) (entropyTerm_zero_ball ((Z0_6_2Half_sound 0) ((1,2) : PairSlot))) (entropyTerm_zero_ball ((Z0_6_2Half_sound 0) ((1,3) : PairSlot))) (entropyTerm_zero_ball ((Z0_6_2Half_sound 0) ((1,4) : PairSlot))) (entropyTerm_zero_ball ((Z0_6_2Half_sound 0) ((1,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z0_6_2Half_sound 0) ((2,0) : PairSlot))) (entropyTerm_zero_ball ((Z0_6_2Half_sound 0) ((2,1) : PairSlot))) (entropyTerm_zero_ball ((Z0_6_2Half_sound 0) ((2,2) : PairSlot))) (entropyTerm_zero_ball ((Z0_6_2Half_sound 0) ((2,3) : PairSlot))) (entropyTerm_zero_ball ((Z0_6_2Half_sound 0) ((2,4) : PairSlot))) (entropyTerm_zero_ball ((Z0_6_2Half_sound 0) ((2,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z0_6_2Half_sound 0) ((3,0) : PairSlot))) (entropyTerm_zero_ball ((Z0_6_2Half_sound 0) ((3,1) : PairSlot))) (entropyTerm_zero_ball ((Z0_6_2Half_sound 0) ((3,2) : PairSlot))) (entropyTerm_zero_ball ((Z0_6_2Half_sound 0) ((3,3) : PairSlot))) (entropyTerm_zero_ball ((Z0_6_2Half_sound 0) ((3,4) : PairSlot))) (entropyTerm_zero_ball ((Z0_6_2Half_sound 0) ((3,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z0_6_2Half_sound 0) ((4,0) : PairSlot))) (entropyTerm_zero_ball ((Z0_6_2Half_sound 0) ((4,1) : PairSlot))) (entropyTerm_zero_ball ((Z0_6_2Half_sound 0) ((4,2) : PairSlot))) (entropyTerm_zero_ball ((Z0_6_2Half_sound 0) ((4,3) : PairSlot))) (entropyTerm_zero_ball ((Z0_6_2Half_sound 0) ((4,4) : PairSlot))) (entropyTerm_zero_ball ((Z0_6_2Half_sound 0) ((4,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z0_6_2Half_sound 0) ((5,0) : PairSlot))) (entropyTerm_zero_ball ((Z0_6_2Half_sound 0) ((5,1) : PairSlot))) (entropyTerm_zero_ball ((Z0_6_2Half_sound 0) ((5,2) : PairSlot))) (entropyTerm_zero_ball ((Z0_6_2Half_sound 0) ((5,3) : PairSlot))) (entropyTerm_zero_ball ((Z0_6_2Half_sound 0) ((5,4) : PairSlot))) (entropyTerm_zero_ball ((Z0_6_2Half_sound 0) ((5,5) : PairSlot))) +def Z0_6_2H0Entropy : Ball := ⟨0, 0⟩ +lemma Z0_6_2H0Entropy_sound : Z0_6_2H0Entropy.Encloses (Foundation.finiteEntropy Z0_6_2H0Value) := by + exact contains_sound (entropyPair_enclosed Z0_6_2H0Value Z0_6_2H0Terms Z0_6_2H0Terms_sound) (by decide +kernel) +def Z0_6_2H0Mass : Ball := ⟨1, 0⟩ +lemma Z0_6_2H0Mass_sound : Z0_6_2H0Mass.Encloses (∑ a, Z0_6_2H0Value a) := by + exact contains_sound (pairSumBall_sound (Z0_6_2Half 0) Z0_6_2H0Value (Z0_6_2Half_sound 0)) (by decide +kernel) +def Z0_6_2H0MassTermLog : Ball := .exact 0 +lemma Z0_6_2H0MassTermLog_sound : Z0_6_2H0MassTermLog.Encloses (Real.log ((∑ a, Z0_6_2H0Value a))) := by + exact log_exact_one_ball (Z0_6_2H0Mass_sound) +def Z0_6_2H0MassTerm : Ball := ⟨0, 0⟩ +lemma Z0_6_2H0MassTerm_sound : Z0_6_2H0MassTerm.Encloses (Foundation.entropyTerm ((∑ a, Z0_6_2H0Value a))) := by + exact contains_sound (entropyTerm_ball (Z0_6_2H0Mass_sound) Z0_6_2H0MassTermLog_sound) (by decide +kernel) +def Z0_6_2H0H : Ball := ⟨0, 0⟩ +lemma Z0_6_2H0H_sound : Z0_6_2H0H.Encloses (homogeneousEntropy Z0_6_2H0Value) := by + exact contains_sound (homogeneous_enclosed Z0_6_2H0Value Z0_6_2H0MassTerm_sound Z0_6_2H0Entropy_sound) (by decide +kernel) +def Z0_6_2H1Value (a : PairSlot) : ℝ := (halfLaw (shape 0 6 2) 1 a : ℝ) +def Z0_6_2H1E_2_5LogWitness : LogWitness := ⟨-3, 15790050502703409550191718781019, 12500000000000000000000000000000⟩ +def Z0_6_2H1E_2_5Log : Ball := ⟨(-184579015932771950225933227583663 / 100000000000000000000000000000000), (84703294883 / 100000000000000000000000000000000)⟩ +lemma Z0_6_2H1E_2_5Log_sound : Z0_6_2H1E_2_5Log.Encloses (Real.log (Z0_6_2H1Value ((2,5) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound ((Z0_6_2Half_sound 1) ((2,5) : PairSlot)) (w := Z0_6_2H1E_2_5LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z0_6_2H1E_2_5 : Ball := ⟨(29145119833177663734886171853233 / 100000000000000000000000000000000), (2674938617 / 20000000000000000000000000000000)⟩ +lemma Z0_6_2H1E_2_5_sound : Z0_6_2H1E_2_5.Encloses (Foundation.entropyTerm (Z0_6_2H1Value ((2,5) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z0_6_2Half_sound 1) ((2,5) : PairSlot)) Z0_6_2H1E_2_5Log_sound) (by decide +kernel) +def Z0_6_2H1E_3_5LogWitness : LogWitness := ⟨-7, 1133125820533948503508356844879, 781250000000000000000000000000⟩ +def Z0_6_2H1E_3_5Log : Ball := ⟨(-448019015932771950225933151201643 / 100000000000000000000000000000000), (21175823727 / 12500000000000000000000000000000)⟩ +lemma Z0_6_2H1E_3_5Log_sound : Z0_6_2H1E_3_5Log.Encloses (Real.log (Z0_6_2H1Value ((3,5) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound ((Z0_6_2Half_sound 1) ((3,5) : PairSlot)) (w := Z0_6_2H1E_3_5LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z0_6_2H1E_3_5 : Ball := ⟨(1015323830087268728146699904139 / 20000000000000000000000000000000), (191958983 / 10000000000000000000000000000000)⟩ +lemma Z0_6_2H1E_3_5_sound : Z0_6_2H1E_3_5.Encloses (Foundation.entropyTerm (Z0_6_2H1Value ((3,5) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z0_6_2Half_sound 1) ((3,5) : PairSlot)) Z0_6_2H1E_3_5Log_sound) (by decide +kernel) +def Z0_6_2H1E_4_4LogWitness : LogWitness := ⟨-1, 16538411838381320973149962187051, 12500000000000000000000000000000⟩ +def Z0_6_2H1E_4_4Log : Ball := ⟨(-10329753983192987556483316443661 / 25000000000000000000000000000000), (21175823703 / 50000000000000000000000000000000)⟩ +lemma Z0_6_2H1E_4_4Log_sound : Z0_6_2H1E_4_4Log.Encloses (Real.log (Z0_6_2H1Value ((4,4) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound ((Z0_6_2Half_sound 1) ((4,4) : PairSlot)) (w := Z0_6_2H1E_4_4LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z0_6_2H1E_4_4 : Ball := ⟨(6833509022528220411360048899287 / 25000000000000000000000000000000), (5603431897 / 20000000000000000000000000000000)⟩ +lemma Z0_6_2H1E_4_4_sound : Z0_6_2H1E_4_4.Encloses (Foundation.entropyTerm (Z0_6_2H1Value ((4,4) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z0_6_2Half_sound 1) ((4,4) : PairSlot)) Z0_6_2H1E_4_4Log_sound) (by decide +kernel) +def Z0_6_2H1E_5_2LogWitness : LogWitness := ⟨-3, 15790050502703409550191718781019, 12500000000000000000000000000000⟩ +def Z0_6_2H1E_5_2Log : Ball := ⟨(-184579015932771950225933227583663 / 100000000000000000000000000000000), (84703294883 / 100000000000000000000000000000000)⟩ +lemma Z0_6_2H1E_5_2Log_sound : Z0_6_2H1E_5_2Log.Encloses (Real.log (Z0_6_2H1Value ((5,2) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound ((Z0_6_2Half_sound 1) ((5,2) : PairSlot)) (w := Z0_6_2H1E_5_2LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z0_6_2H1E_5_2 : Ball := ⟨(29145119833177663734886171853233 / 100000000000000000000000000000000), (2674938617 / 20000000000000000000000000000000)⟩ +lemma Z0_6_2H1E_5_2_sound : Z0_6_2H1E_5_2.Encloses (Foundation.entropyTerm (Z0_6_2H1Value ((5,2) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z0_6_2Half_sound 1) ((5,2) : PairSlot)) Z0_6_2H1E_5_2Log_sound) (by decide +kernel) +def Z0_6_2H1E_5_3LogWitness : LogWitness := ⟨-7, 1133125820533948503508356844879, 781250000000000000000000000000⟩ +def Z0_6_2H1E_5_3Log : Ball := ⟨(-448019015932771950225933151201643 / 100000000000000000000000000000000), (21175823727 / 12500000000000000000000000000000)⟩ +lemma Z0_6_2H1E_5_3Log_sound : Z0_6_2H1E_5_3Log.Encloses (Real.log (Z0_6_2H1Value ((5,3) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound ((Z0_6_2Half_sound 1) ((5,3) : PairSlot)) (w := Z0_6_2H1E_5_3LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z0_6_2H1E_5_3 : Ball := ⟨(1015323830087268728146699904139 / 20000000000000000000000000000000), (191958983 / 10000000000000000000000000000000)⟩ +lemma Z0_6_2H1E_5_3_sound : Z0_6_2H1E_5_3.Encloses (Foundation.entropyTerm (Z0_6_2H1Value ((5,3) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z0_6_2Half_sound 1) ((5,3) : PairSlot)) Z0_6_2H1E_5_3Log_sound) (by decide +kernel) +def Z0_6_2H1Terms (a : PairSlot) : Ball := + match a.1.val, a.2.val with + | 2, 5 => ⟨(29145119833177663734886171853233 / 100000000000000000000000000000000), (2674938617 / 20000000000000000000000000000000)⟩ + | 3, 5 => ⟨(1015323830087268728146699904139 / 20000000000000000000000000000000), (191958983 / 10000000000000000000000000000000)⟩ + | 4, 4 => ⟨(6833509022528220411360048899287 / 25000000000000000000000000000000), (5603431897 / 20000000000000000000000000000000)⟩ + | 5, 2 => ⟨(29145119833177663734886171853233 / 100000000000000000000000000000000), (2674938617 / 20000000000000000000000000000000)⟩ + | 5, 3 => ⟨(1015323830087268728146699904139 / 20000000000000000000000000000000), (191958983 / 10000000000000000000000000000000)⟩ + | _, _ => (.exact 0) +lemma Z0_6_2H1Terms_sound (a : PairSlot) : + (Z0_6_2H1Terms a).Encloses (Foundation.entropyTerm (Z0_6_2H1Value a)) := by + rcases a with ⟨i,j⟩ + revert j i + apply forall_fin6 + · exact forall_fin6 (entropyTerm_zero_ball ((Z0_6_2Half_sound 1) ((0,0) : PairSlot))) (entropyTerm_zero_ball ((Z0_6_2Half_sound 1) ((0,1) : PairSlot))) (entropyTerm_zero_ball ((Z0_6_2Half_sound 1) ((0,2) : PairSlot))) (entropyTerm_zero_ball ((Z0_6_2Half_sound 1) ((0,3) : PairSlot))) (entropyTerm_zero_ball ((Z0_6_2Half_sound 1) ((0,4) : PairSlot))) (entropyTerm_zero_ball ((Z0_6_2Half_sound 1) ((0,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z0_6_2Half_sound 1) ((1,0) : PairSlot))) (entropyTerm_zero_ball ((Z0_6_2Half_sound 1) ((1,1) : PairSlot))) (entropyTerm_zero_ball ((Z0_6_2Half_sound 1) ((1,2) : PairSlot))) (entropyTerm_zero_ball ((Z0_6_2Half_sound 1) ((1,3) : PairSlot))) (entropyTerm_zero_ball ((Z0_6_2Half_sound 1) ((1,4) : PairSlot))) (entropyTerm_zero_ball ((Z0_6_2Half_sound 1) ((1,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z0_6_2Half_sound 1) ((2,0) : PairSlot))) (entropyTerm_zero_ball ((Z0_6_2Half_sound 1) ((2,1) : PairSlot))) (entropyTerm_zero_ball ((Z0_6_2Half_sound 1) ((2,2) : PairSlot))) (entropyTerm_zero_ball ((Z0_6_2Half_sound 1) ((2,3) : PairSlot))) (entropyTerm_zero_ball ((Z0_6_2Half_sound 1) ((2,4) : PairSlot))) Z0_6_2H1E_2_5_sound + · exact forall_fin6 (entropyTerm_zero_ball ((Z0_6_2Half_sound 1) ((3,0) : PairSlot))) (entropyTerm_zero_ball ((Z0_6_2Half_sound 1) ((3,1) : PairSlot))) (entropyTerm_zero_ball ((Z0_6_2Half_sound 1) ((3,2) : PairSlot))) (entropyTerm_zero_ball ((Z0_6_2Half_sound 1) ((3,3) : PairSlot))) (entropyTerm_zero_ball ((Z0_6_2Half_sound 1) ((3,4) : PairSlot))) Z0_6_2H1E_3_5_sound + · exact forall_fin6 (entropyTerm_zero_ball ((Z0_6_2Half_sound 1) ((4,0) : PairSlot))) (entropyTerm_zero_ball ((Z0_6_2Half_sound 1) ((4,1) : PairSlot))) (entropyTerm_zero_ball ((Z0_6_2Half_sound 1) ((4,2) : PairSlot))) (entropyTerm_zero_ball ((Z0_6_2Half_sound 1) ((4,3) : PairSlot))) Z0_6_2H1E_4_4_sound (entropyTerm_zero_ball ((Z0_6_2Half_sound 1) ((4,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z0_6_2Half_sound 1) ((5,0) : PairSlot))) (entropyTerm_zero_ball ((Z0_6_2Half_sound 1) ((5,1) : PairSlot))) Z0_6_2H1E_5_2_sound Z0_6_2H1E_5_3_sound (entropyTerm_zero_ball ((Z0_6_2Half_sound 1) ((5,4) : PairSlot))) (entropyTerm_zero_ball ((Z0_6_2Half_sound 1) ((5,5) : PairSlot))) +def Z0_6_2H1Entropy : Ball := ⟨(23944378514335224099169884586251 / 25000000000000000000000000000000), (11721145063 / 20000000000000000000000000000000)⟩ +lemma Z0_6_2H1Entropy_sound : Z0_6_2H1Entropy.Encloses (Foundation.finiteEntropy Z0_6_2H1Value) := by + exact contains_sound (entropyPair_enclosed Z0_6_2H1Value Z0_6_2H1Terms Z0_6_2H1Terms_sound) (by decide +kernel) +def Z0_6_2H1Mass : Ball := ⟨1, (83 / 100000000000000000000000000000000)⟩ +lemma Z0_6_2H1Mass_sound : Z0_6_2H1Mass.Encloses (∑ a, Z0_6_2H1Value a) := by + exact contains_sound (pairSumBall_sound (Z0_6_2Half 1) Z0_6_2H1Value (Z0_6_2Half_sound 1)) (by decide +kernel) +def Z0_6_2H1MassTermLogWitness : LogWitness := ⟨0, 1, 1⟩ +def Z0_6_2H1MassTermLog : Ball := ⟨0, (4235164753 / 20000000000000000000000000000000)⟩ +lemma Z0_6_2H1MassTermLog_sound : Z0_6_2H1MassTermLog.Encloses (Real.log ((∑ a, Z0_6_2H1Value a))) := by + exact checkLog_sound logTwoBall_sound (Z0_6_2H1Mass_sound) (w := Z0_6_2H1MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z0_6_2H1MassTerm : Ball := ⟨0, (10587911883 / 50000000000000000000000000000000)⟩ +lemma Z0_6_2H1MassTerm_sound : Z0_6_2H1MassTerm.Encloses (Foundation.entropyTerm ((∑ a, Z0_6_2H1Value a))) := by + exact contains_sound (entropyTerm_ball (Z0_6_2H1Mass_sound) Z0_6_2H1MassTermLog_sound) (by decide +kernel) +def Z0_6_2H1H : Ball := ⟨(23944378514335224099169884586251 / 25000000000000000000000000000000), (79781549081 / 100000000000000000000000000000000)⟩ +lemma Z0_6_2H1H_sound : Z0_6_2H1H.Encloses (homogeneousEntropy Z0_6_2H1Value) := by + exact contains_sound (homogeneous_enclosed Z0_6_2H1Value Z0_6_2H1MassTerm_sound Z0_6_2H1Entropy_sound) (by decide +kernel) +def Z0_6_2H2Value (a : PairSlot) : ℝ := (halfLaw (shape 0 6 2) 2 a : ℝ) +def Z0_6_2H2E_2_0LogWitness : LogWitness := ⟨-3, 15790050502703409550191718781019, 12500000000000000000000000000000⟩ +def Z0_6_2H2E_2_0Log : Ball := ⟨(-184579015932771950225933227583663 / 100000000000000000000000000000000), (84703294883 / 100000000000000000000000000000000)⟩ +lemma Z0_6_2H2E_2_0Log_sound : Z0_6_2H2E_2_0Log.Encloses (Real.log (Z0_6_2H2Value ((2,0) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound ((Z0_6_2Half_sound 2) ((2,0) : PairSlot)) (w := Z0_6_2H2E_2_0LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z0_6_2H2E_2_0 : Ball := ⟨(29145119833177663734886171853233 / 100000000000000000000000000000000), (2674938617 / 20000000000000000000000000000000)⟩ +lemma Z0_6_2H2E_2_0_sound : Z0_6_2H2E_2_0.Encloses (Foundation.entropyTerm (Z0_6_2H2Value ((2,0) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z0_6_2Half_sound 2) ((2,0) : PairSlot)) Z0_6_2H2E_2_0Log_sound) (by decide +kernel) +def Z0_6_2H2E_3_0LogWitness : LogWitness := ⟨-7, 1133125820533948503508356844879, 781250000000000000000000000000⟩ +def Z0_6_2H2E_3_0Log : Ball := ⟨(-448019015932771950225933151201643 / 100000000000000000000000000000000), (21175823727 / 12500000000000000000000000000000)⟩ +lemma Z0_6_2H2E_3_0Log_sound : Z0_6_2H2E_3_0Log.Encloses (Real.log (Z0_6_2H2Value ((3,0) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound ((Z0_6_2Half_sound 2) ((3,0) : PairSlot)) (w := Z0_6_2H2E_3_0LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z0_6_2H2E_3_0 : Ball := ⟨(1015323830087268728146699904139 / 20000000000000000000000000000000), (191958983 / 10000000000000000000000000000000)⟩ +lemma Z0_6_2H2E_3_0_sound : Z0_6_2H2E_3_0.Encloses (Foundation.entropyTerm (Z0_6_2H2Value ((3,0) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z0_6_2Half_sound 2) ((3,0) : PairSlot)) Z0_6_2H2E_3_0Log_sound) (by decide +kernel) +def Z0_6_2H2E_1_1LogWitness : LogWitness := ⟨-1, 16538411838381320973149962187051, 12500000000000000000000000000000⟩ +def Z0_6_2H2E_1_1Log : Ball := ⟨(-10329753983192987556483316443661 / 25000000000000000000000000000000), (21175823703 / 50000000000000000000000000000000)⟩ +lemma Z0_6_2H2E_1_1Log_sound : Z0_6_2H2E_1_1Log.Encloses (Real.log (Z0_6_2H2Value ((1,1) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound ((Z0_6_2Half_sound 2) ((1,1) : PairSlot)) (w := Z0_6_2H2E_1_1LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z0_6_2H2E_1_1 : Ball := ⟨(6833509022528220411360048899287 / 25000000000000000000000000000000), (5603431897 / 20000000000000000000000000000000)⟩ +lemma Z0_6_2H2E_1_1_sound : Z0_6_2H2E_1_1.Encloses (Foundation.entropyTerm (Z0_6_2H2Value ((1,1) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z0_6_2Half_sound 2) ((1,1) : PairSlot)) Z0_6_2H2E_1_1Log_sound) (by decide +kernel) +def Z0_6_2H2E_0_2LogWitness : LogWitness := ⟨-3, 15790050502703409550191718781019, 12500000000000000000000000000000⟩ +def Z0_6_2H2E_0_2Log : Ball := ⟨(-184579015932771950225933227583663 / 100000000000000000000000000000000), (84703294883 / 100000000000000000000000000000000)⟩ +lemma Z0_6_2H2E_0_2Log_sound : Z0_6_2H2E_0_2Log.Encloses (Real.log (Z0_6_2H2Value ((0,2) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound ((Z0_6_2Half_sound 2) ((0,2) : PairSlot)) (w := Z0_6_2H2E_0_2LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z0_6_2H2E_0_2 : Ball := ⟨(29145119833177663734886171853233 / 100000000000000000000000000000000), (2674938617 / 20000000000000000000000000000000)⟩ +lemma Z0_6_2H2E_0_2_sound : Z0_6_2H2E_0_2.Encloses (Foundation.entropyTerm (Z0_6_2H2Value ((0,2) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z0_6_2Half_sound 2) ((0,2) : PairSlot)) Z0_6_2H2E_0_2Log_sound) (by decide +kernel) +def Z0_6_2H2E_0_3LogWitness : LogWitness := ⟨-7, 1133125820533948503508356844879, 781250000000000000000000000000⟩ +def Z0_6_2H2E_0_3Log : Ball := ⟨(-448019015932771950225933151201643 / 100000000000000000000000000000000), (21175823727 / 12500000000000000000000000000000)⟩ +lemma Z0_6_2H2E_0_3Log_sound : Z0_6_2H2E_0_3Log.Encloses (Real.log (Z0_6_2H2Value ((0,3) : PairSlot))) := by + exact checkLog_sound logTwoBall_sound ((Z0_6_2Half_sound 2) ((0,3) : PairSlot)) (w := Z0_6_2H2E_0_3LogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z0_6_2H2E_0_3 : Ball := ⟨(1015323830087268728146699904139 / 20000000000000000000000000000000), (191958983 / 10000000000000000000000000000000)⟩ +lemma Z0_6_2H2E_0_3_sound : Z0_6_2H2E_0_3.Encloses (Foundation.entropyTerm (Z0_6_2H2Value ((0,3) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z0_6_2Half_sound 2) ((0,3) : PairSlot)) Z0_6_2H2E_0_3Log_sound) (by decide +kernel) +def Z0_6_2H2Terms (a : PairSlot) : Ball := + match a.1.val, a.2.val with + | 2, 0 => ⟨(29145119833177663734886171853233 / 100000000000000000000000000000000), (2674938617 / 20000000000000000000000000000000)⟩ + | 3, 0 => ⟨(1015323830087268728146699904139 / 20000000000000000000000000000000), (191958983 / 10000000000000000000000000000000)⟩ + | 1, 1 => ⟨(6833509022528220411360048899287 / 25000000000000000000000000000000), (5603431897 / 20000000000000000000000000000000)⟩ + | 0, 2 => ⟨(29145119833177663734886171853233 / 100000000000000000000000000000000), (2674938617 / 20000000000000000000000000000000)⟩ + | 0, 3 => ⟨(1015323830087268728146699904139 / 20000000000000000000000000000000), (191958983 / 10000000000000000000000000000000)⟩ + | _, _ => (.exact 0) +lemma Z0_6_2H2Terms_sound (a : PairSlot) : + (Z0_6_2H2Terms a).Encloses (Foundation.entropyTerm (Z0_6_2H2Value a)) := by + rcases a with ⟨i,j⟩ + revert j i + apply forall_fin6 + · exact forall_fin6 (entropyTerm_zero_ball ((Z0_6_2Half_sound 2) ((0,0) : PairSlot))) (entropyTerm_zero_ball ((Z0_6_2Half_sound 2) ((0,1) : PairSlot))) Z0_6_2H2E_0_2_sound Z0_6_2H2E_0_3_sound (entropyTerm_zero_ball ((Z0_6_2Half_sound 2) ((0,4) : PairSlot))) (entropyTerm_zero_ball ((Z0_6_2Half_sound 2) ((0,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z0_6_2Half_sound 2) ((1,0) : PairSlot))) Z0_6_2H2E_1_1_sound (entropyTerm_zero_ball ((Z0_6_2Half_sound 2) ((1,2) : PairSlot))) (entropyTerm_zero_ball ((Z0_6_2Half_sound 2) ((1,3) : PairSlot))) (entropyTerm_zero_ball ((Z0_6_2Half_sound 2) ((1,4) : PairSlot))) (entropyTerm_zero_ball ((Z0_6_2Half_sound 2) ((1,5) : PairSlot))) + · exact forall_fin6 Z0_6_2H2E_2_0_sound (entropyTerm_zero_ball ((Z0_6_2Half_sound 2) ((2,1) : PairSlot))) (entropyTerm_zero_ball ((Z0_6_2Half_sound 2) ((2,2) : PairSlot))) (entropyTerm_zero_ball ((Z0_6_2Half_sound 2) ((2,3) : PairSlot))) (entropyTerm_zero_ball ((Z0_6_2Half_sound 2) ((2,4) : PairSlot))) (entropyTerm_zero_ball ((Z0_6_2Half_sound 2) ((2,5) : PairSlot))) + · exact forall_fin6 Z0_6_2H2E_3_0_sound (entropyTerm_zero_ball ((Z0_6_2Half_sound 2) ((3,1) : PairSlot))) (entropyTerm_zero_ball ((Z0_6_2Half_sound 2) ((3,2) : PairSlot))) (entropyTerm_zero_ball ((Z0_6_2Half_sound 2) ((3,3) : PairSlot))) (entropyTerm_zero_ball ((Z0_6_2Half_sound 2) ((3,4) : PairSlot))) (entropyTerm_zero_ball ((Z0_6_2Half_sound 2) ((3,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z0_6_2Half_sound 2) ((4,0) : PairSlot))) (entropyTerm_zero_ball ((Z0_6_2Half_sound 2) ((4,1) : PairSlot))) (entropyTerm_zero_ball ((Z0_6_2Half_sound 2) ((4,2) : PairSlot))) (entropyTerm_zero_ball ((Z0_6_2Half_sound 2) ((4,3) : PairSlot))) (entropyTerm_zero_ball ((Z0_6_2Half_sound 2) ((4,4) : PairSlot))) (entropyTerm_zero_ball ((Z0_6_2Half_sound 2) ((4,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z0_6_2Half_sound 2) ((5,0) : PairSlot))) (entropyTerm_zero_ball ((Z0_6_2Half_sound 2) ((5,1) : PairSlot))) (entropyTerm_zero_ball ((Z0_6_2Half_sound 2) ((5,2) : PairSlot))) (entropyTerm_zero_ball ((Z0_6_2Half_sound 2) ((5,3) : PairSlot))) (entropyTerm_zero_ball ((Z0_6_2Half_sound 2) ((5,4) : PairSlot))) (entropyTerm_zero_ball ((Z0_6_2Half_sound 2) ((5,5) : PairSlot))) +def Z0_6_2H2Entropy : Ball := ⟨(23944378514335224099169884586251 / 25000000000000000000000000000000), (11721145063 / 20000000000000000000000000000000)⟩ +lemma Z0_6_2H2Entropy_sound : Z0_6_2H2Entropy.Encloses (Foundation.finiteEntropy Z0_6_2H2Value) := by + exact contains_sound (entropyPair_enclosed Z0_6_2H2Value Z0_6_2H2Terms Z0_6_2H2Terms_sound) (by decide +kernel) +def Z0_6_2H2Mass : Ball := ⟨1, (83 / 100000000000000000000000000000000)⟩ +lemma Z0_6_2H2Mass_sound : Z0_6_2H2Mass.Encloses (∑ a, Z0_6_2H2Value a) := by + exact contains_sound (pairSumBall_sound (Z0_6_2Half 2) Z0_6_2H2Value (Z0_6_2Half_sound 2)) (by decide +kernel) +def Z0_6_2H2MassTermLogWitness : LogWitness := ⟨0, 1, 1⟩ +def Z0_6_2H2MassTermLog : Ball := ⟨0, (4235164753 / 20000000000000000000000000000000)⟩ +lemma Z0_6_2H2MassTermLog_sound : Z0_6_2H2MassTermLog.Encloses (Real.log ((∑ a, Z0_6_2H2Value a))) := by + exact checkLog_sound logTwoBall_sound (Z0_6_2H2Mass_sound) (w := Z0_6_2H2MassTermLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def Z0_6_2H2MassTerm : Ball := ⟨0, (10587911883 / 50000000000000000000000000000000)⟩ +lemma Z0_6_2H2MassTerm_sound : Z0_6_2H2MassTerm.Encloses (Foundation.entropyTerm ((∑ a, Z0_6_2H2Value a))) := by + exact contains_sound (entropyTerm_ball (Z0_6_2H2Mass_sound) Z0_6_2H2MassTermLog_sound) (by decide +kernel) +def Z0_6_2H2H : Ball := ⟨(23944378514335224099169884586251 / 25000000000000000000000000000000), (79781549081 / 100000000000000000000000000000000)⟩ +lemma Z0_6_2H2H_sound : Z0_6_2H2H.Encloses (homogeneousEntropy Z0_6_2H2Value) := by + exact contains_sound (homogeneous_enclosed Z0_6_2H2Value Z0_6_2H2MassTerm_sound Z0_6_2H2Entropy_sound) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate +open scoped BigOperators +lemma B1_1_6_below : below (shape 1 1 6) = [ + (shape 0 0 4), + (shape 0 1 3), + (shape 1 0 3), + (shape 1 1 2)] := by decide +kernel +def B1_1_6Raw (s : Shape) : Ball := + match s 0, s 1, s 2 with + | 0, 0, 4 => ⟨(381491111844670997969310464477 / 20000000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ + | 0, 1, 3 => ⟨1, 0⟩ + | 1, 0, 3 => ⟨1, 0⟩ + | 1, 1, 2 => ⟨(381491111844670997969310464477 / 20000000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ + | _, _, _ => (.exact 0) +lemma B1_1_6Raw_0_0_4 : (B1_1_6Raw (shape 0 0 4)).Encloses (splitWeight positiveSecond tablep (shape 1 1 6) (shape 0 0 4) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveSecond tablep (shape 1 1 6) (shape 0 0 4) + (0) (0) (-39594) w195 w195 w45 + (by decide +kernel) w195_sound w195_sound w45_sound) (by decide +kernel) +lemma B1_1_6Raw_0_1_3 : (B1_1_6Raw (shape 0 1 3)).Encloses (splitWeight positiveSecond tablep (shape 1 1 6) (shape 0 1 3) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveSecond tablep (shape 1 1 6) (shape 0 1 3) + (0) (0) (0) w195 w195 w195 + (by decide +kernel) w195_sound w195_sound w195_sound) (by decide +kernel) +lemma B1_1_6Raw_1_0_3 : (B1_1_6Raw (shape 1 0 3)).Encloses (splitWeight positiveSecond tablep (shape 1 1 6) (shape 1 0 3) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveSecond tablep (shape 1 1 6) (shape 1 0 3) + (0) (0) (0) w195 w195 w195 + (by decide +kernel) w195_sound w195_sound w195_sound) (by decide +kernel) +lemma B1_1_6Raw_1_1_2 : (B1_1_6Raw (shape 1 1 2)).Encloses (splitWeight positiveSecond tablep (shape 1 1 6) (shape 1 1 2) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveSecond tablep (shape 1 1 6) (shape 1 1 2) + (0) (0) (-39594) w195 w195 w45 + (by decide +kernel) w195_sound w195_sound w45_sound) (by decide +kernel) +lemma B1_1_6Raw_sound (u : Shape) (hu : u ∈ below (shape 1 1 6)) : + (B1_1_6Raw u).Encloses (splitWeight positiveSecond tablep (shape 1 1 6) u : ℝ) := by + rw [B1_1_6_below] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl + · exact B1_1_6Raw_0_0_4 + · exact B1_1_6Raw_0_1_3 + · exact B1_1_6Raw_1_0_3 + · exact B1_1_6Raw_1_1_2 +def B1_1_6Den : Ball := ⟨(20381491111844670997969310464477 / 10000000000000000000000000000000), (1 / 12500000000000000000000000000000)⟩ +lemma B1_1_6Den_sound : B1_1_6Den.Encloses (((below (shape 1 1 6)).map (splitWeight positiveSecond tablep (shape 1 1 6))).sum : ℝ) := by + exact contains_sound (list_cast_enclosed (below (shape 1 1 6)) B1_1_6Raw (splitWeight positiveSecond tablep (shape 1 1 6)) B1_1_6Raw_sound) (by decide +kernel) +lemma B1_1_6Den_positive : 0 < B1_1_6Den.lower := by decide +kernel +def B1_1_6Table (s : Shape) : Ball := + match s 0, s 1, s 2 with + | 0, 0, 4 => ⟨(935876354068540274256216050051 / 100000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ + | 0, 1, 3 => ⟨(49064123645931459725743783949949 / 100000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ + | 1, 0, 3 => ⟨(49064123645931459725743783949949 / 100000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ + | 1, 1, 2 => ⟨(935876354068540274256216050051 / 100000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ + | _, _, _ => (.exact 0) +def B1_1_6Law (u : Shape) : Ball := if u ∈ below (shape 1 1 6) then B1_1_6Table u else .exact 0 +lemma B1_1_6Law_check_0_0_4 : contains (.mul (B1_1_6Raw (shape 0 0 4)) (.inv B1_1_6Den)) (B1_1_6Table (shape 0 0 4)) = true := by decide +kernel +lemma B1_1_6Law_check_0_1_3 : contains (.mul (B1_1_6Raw (shape 0 1 3)) (.inv B1_1_6Den)) (B1_1_6Table (shape 0 1 3)) = true := by decide +kernel +lemma B1_1_6Law_check_1_0_3 : contains (.mul (B1_1_6Raw (shape 1 0 3)) (.inv B1_1_6Den)) (B1_1_6Table (shape 1 0 3)) = true := by decide +kernel +lemma B1_1_6Law_check_1_1_2 : contains (.mul (B1_1_6Raw (shape 1 1 2)) (.inv B1_1_6Den)) (B1_1_6Table (shape 1 1 2)) = true := by decide +kernel +lemma B1_1_6Law_check (u : Shape) (hu : u ∈ below (shape 1 1 6)) : + contains (.mul (B1_1_6Raw u) (.inv B1_1_6Den)) (B1_1_6Table u) = true := by + rw [B1_1_6_below] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl + · exact B1_1_6Law_check_0_0_4 + · exact B1_1_6Law_check_0_1_3 + · exact B1_1_6Law_check_1_0_3 + · exact B1_1_6Law_check_1_1_2 +lemma B1_1_6Law_sound (u : Shape) : + (B1_1_6Law u).Encloses (stageBLaw (shape 1 1 6) u : ℝ) := by + by_cases hu : u ∈ below (shape 1 1 6) + · have h := contains_sound (Ball.mul_sound (B1_1_6Raw_sound u hu) + (Ball.inv_sound B1_1_6Den_sound B1_1_6Den_positive)) (B1_1_6Law_check u hu) + simpa only [B1_1_6Law, hu, ite_true, stageBLaw, splitLaw, + Rat.cast_div, Rat.cast_mul, Rat.cast_inv, div_eq_mul_inv] using h + · simp only [B1_1_6Law, hu, ite_false, stageBLaw, splitLaw, Rat.cast_zero] + simpa only [Rat.cast_zero] using Ball.exact_sound 0 + +end MatrixMultiplication.NativeNumerics + +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/Certificates/SplitB1_3_4.lean b/lean/OAI/LinearAlgebra/MatrixFields/Certificates/SplitB1_3_4.lean new file mode 100644 index 0000000000000000000000000000000000000000..c56fd2850418c312e89268c25efbde835054f3ca --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/Certificates/SplitB1_3_4.lean @@ -0,0 +1,1183 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Certificates.SplitA1_3_12 +import OAI.LinearAlgebra.MatrixFields.Certificates.SplitB2_3_3 + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate +open scoped BigOperators +def w0Trace : List Ball := [ + ⟨(82803229229590362204618185520663 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(91131351271525777834266467390707 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(46997890090448805051498392563943 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(7954584508208846431402785290537 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2007114747699524859116922641299 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(807814768661711078885531885437 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(135231277551032895972451160501 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(19382886944007911455826332437 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2429121919745260254778172879 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(270460864988165426258764137 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(27091905614671088604436493 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(308297497269058241696333 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(205777516359127300804089 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(3169055647121571503399 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1132814314621218288769 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(75569735009710001443 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w0S0 : Ball := ⟨(68563747708480877283556233637117 / 100000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +def w0S1 : Ball := ⟨(23504937499161083753803736016069 / 50000000000000000000000000000000), (1 / 20000000000000000000000000000000)⟩ +def w0S2 : Ball := ⟨(22099283473578756085261927404661 / 100000000000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ +def w0S3 : Ball := ⟨(4883783300455911313091891409461 / 100000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +def w0S4 : Ball := ⟨(238513393258120341145263563873 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ +def w0S5 : Ball := ⟨(22755455505401106321749899 / 4000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ +abbrev w0 : Ball := w0S5 +lemma w0_sound : w0.Encloses (weight (-120770) : ℝ) := by + exact weight_enclosed_of_trace (-120770) w0Trace w0S0 w0S1 w0S2 w0S3 w0S4 w0S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def w1Trace : List Ball := [ + ⟨(20837493786076897713733962490031 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(91422432674232072040023473511219 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(47097951993783986464978611101937 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(15934648192129657873450890498811 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2009693987987463870597027863499 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(808682047072812782498592987079 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(13535598763476683311513428167 / 10000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(19398555248358033727439975123 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(24308699485539973844509053 / 1000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(270636251711842821073819 / 100000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(5421578849894978790169157 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2467715503758110889817791 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(25735057077891513366681 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(15852644036027428658163 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(56665296465398772451 / 5000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(37800594972451887961 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w1S0 : Ball := ⟨(69472183565566932009629442199157 / 100000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +def w1S1 : Ball := ⟨(48263842893678281185090233240803 / 100000000000000000000000000000000), (1 / 20000000000000000000000000000000)⟩ +def w1S2 : Ball := ⟨(23293985308656595225584058076917 / 100000000000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ +def w1S3 : Ball := ⟨(5426097515599092939405471064157 / 100000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +def w1S4 : Ball := ⟨(294425342487906486448830565873 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ +def w1S5 : Ball := ⟨(216715705747802581278708373 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ +abbrev w1 : Ball := w1S5 +lemma w1_sound : w1.Encloses (weight (-116558) : ℝ) := by + exact weight_enclosed_of_trace (-116558) w1Trace w1S0 w1S1 w1S2 w1S3 w1S4 w1S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def w2Trace : List Ball := [ + ⟨(84597619125205089736172006311063 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(287763190217468827617782392903 / 312500000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(47325044077594224176574894987021 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(15992412730055362749694693162069 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(503884342020049821649505183307 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(202661481013394753386767106967 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(6781913861429235519813141411 / 5000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(9717005589004447660794023429 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(608706163735778491349902169 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(54206593500162287796340059 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(27144053965850958234814469 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2470735506229453309749967 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(8244528274498550519241 / 4000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(495915518354627658563 / 3125000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(28360432994016500911 / 2500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(7567220252295638787 / 10000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w2S0 : Ball := ⟨(71567571616532659723992943125807 / 100000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ +def w2S1 : Ball := ⟨(1600599158464853492919978508641 / 3125000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ +def w2S2 : Ball := ⟨(3279254612580348394160949624957 / 12500000000000000000000000000000), (1 / 20000000000000000000000000000000)⟩ +def w2S3 : Ball := ⟨(688224692104287413796798727327 / 10000000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ +def w2S4 : Ball := ⟨(236826613411020605245216287039 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ +def w2S5 : Ball := ⟨(1121736896394660095916143067 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ +abbrev w2 : Ball := w2S5 +lemma w2_sound : w2.Encloses (weight (-107049) : ℝ) := by + exact weight_enclosed_of_trace (-107049) w2Trace w2S0 w2S1 w2S2 w2S3 w2S4 w2S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def w3Trace : List Ball := [ + ⟨(17193461196655432197407653245491 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(92806904729798666614606898981387 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(11893099547713272105641171468203 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(16055235691371534665274372650617 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4043772080075276231177722127437 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(162555617274960997649942141381 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(135944590818002902278789717 / 100000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2434058547802820386565399929 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2439112676059295582138731649 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(271463001174311553358616637 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(27183241520619055769889379 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(494801550387050376991799 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(103182677636193010383271 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(15887334380787229268963 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1135621079487512777459 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(9468620676209316049 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w3S0 : Ball := ⟨(18475944245056002907619036694059 / 25000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ +def w3S1 : Ball := ⟨(1365442062985672132889830206583 / 2500000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ +def w3S2 : Ball := ⟨(298309124379290915863936816923 / 1000000000000000000000000000000), (1 / 20000000000000000000000000000000)⟩ +def w3S3 : Ball := ⟨(444941668439696289244594944761 / 5000000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ +def w3S4 : Ball := ⟨(49493272078475156223283474047 / 6250000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ +def w3S5 : Ball := ⟨(3135467495723479693518430173 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ +abbrev w3 : Ball := w3S5 +lemma w3_sound : w3.Encloses (weight (-96770) : ℝ) := by + exact weight_enclosed_of_trace (-96770) w3Trace w3S0 w3S1 w3S2 w3S3 w3S4 w3S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def w4Trace : List Ball := [ + ⟨(43004612630968991983903177598447 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(9282896008998414087586237195451 / 10000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(23789968392513580208215399184691 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(8028574392909957357006619687303 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4044158532645516698440704419737 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(50802684700553595648245763723 / 6250000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(67976953698316956060133492347 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(97368189006779382317589971 / 500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2439243044070346431057003157 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(271476073488622879500088817 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(5436886522198381256733501 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(77315850006009738723551 / 3125000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(206373017740265737886027 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(15887882483420361399649 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(567828827970733624147 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(37875647702437033621 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w4S0 : Ball := ⟨(73975868301587910668784065662379 / 100000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +def w4S1 : Ball := ⟨(27362145454869395155073956927247 / 50000000000000000000000000000000), (1 / 20000000000000000000000000000000)⟩ +def w4S2 : Ball := ⟨(748687003893429899497028839077 / 2500000000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ +def w4S3 : Ball := ⟨(1121064459597841434976520886363 / 12500000000000000000000000000000), (1 / 20000000000000000000000000000000)⟩ +def w4S4 : Ball := ⟨(804342734446976160702008647501 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ +def w4S5 : Ball := ⟨(6469672344576388104635416779 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ +abbrev w4 : Ball := w4S5 +lemma w4_sound : w4.Encloses (weight (-96458) : ℝ) := by + exact weight_enclosed_of_trace (-96458) w4Trace w4S0 w4S1 w4S2 w4S3 w4S4 w4S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def w5Trace : List Ball := [ + ⟨(1102320926751695236176977521 / 1280000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(92886606049739533380917829323629 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(47599637486974463747609226319519 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(3212429573175963116025417762947 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1011292077056304944913192353953 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(406506223155515864668058512107 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(135978249263124604604816221119 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4869173281079488153358079977 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2439583648037062201120081527 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(135755113065605914026376263 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(27187544405070211333868931 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2474367011762855242522383 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(206393035977987373765041 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(3972328598130323853597 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1135753210921910421071 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(75757381770539529303 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w5S0 : Ball := ⟨(37082257859946174749445643608123 / 50000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ +def w5S1 : Ball := ⟨(5500375391966159423836525575271 / 10000000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ +def w5S2 : Ball := ⟨(15127064726273440959619896097297 / 50000000000000000000000000000000), (1 / 20000000000000000000000000000000)⟩ +def w5S3 : Ball := ⟨(286035109041082716582367764001 / 3125000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ +def w5S4 : Ball := ⟨(167559339221287075088374028923 / 20000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ +def w5S5 : Ball := ⟨(1754758260017147069441912959 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ +abbrev w5 : Ball := w5S5 +lemma w5_sound : w5.Encloses (weight (-95643) : ℝ) := by + exact weight_enclosed_of_trace (-95643) w5Trace w5S0 w5S1 w5S2 w5S3 w5S4 w5S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def w6Trace : List Ball := [ + ⟨(86476687893016333469851031210019 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(93074662040343982398943316151241 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2978992336580033165667631160141 / 6250000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(8039222238224200623533197045651 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4048459513917666267452864835983 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(406782403076494292318624631071 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(68028785100499194342845957921 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1948664853100818516218114777 / 10000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2440693399944723665191346563 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(271621496488446545987587637 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(13598841158114996097983393 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2475213422703491942250599 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(20645824923415843339483 / 10000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(15893978992079021112747 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(568032243788296634297 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(75777201665602273241 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w6S0 : Ball := ⟨(74782175489461577081980349690883 / 100000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +def w6S1 : Ball := ⟨(5592373770936627865813923153869 / 10000000000000000000000000000000), (1 / 20000000000000000000000000000000)⟩ +def w6S2 : Ball := ⟨(7818661098464989779733749713001 / 25000000000000000000000000000000), (7 / 100000000000000000000000000000000)⟩ +def w6S3 : Ball := ⟨(2445258454905990424310397234107 / 25000000000000000000000000000000), (1 / 20000000000000000000000000000000)⟩ +def w6S4 : Ball := ⟨(478343112903138528431752845003 / 50000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ +def w6S5 : Ball := ⟨(9152485346474589333197978901 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ +abbrev w6 : Ball := w6S5 +lemma w6_sound : w6.Encloses (weight (-92989) : ℝ) := by + exact weight_enclosed_of_trace (-92989) w6Trace w6S0 w6S1 w6S2 w6S3 w6S4 w6S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def w7Trace : List Ball := [ + ⟨(87752485434793811143629090557047 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(93742935822473699627791117052839 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(47891803884625337713041583981333 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4034053033629281069572169955353 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(50751486045689091884614126029 / 1250000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(815520727221885311117769493659 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(6816917761748190668030554793 / 5000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(3904376048871145087298573331 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2444619953418414338678937513 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(136007565022257252396560341 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(27233541487519339704956071 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2478206938128977784931097 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(206688866553341695936579 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(15910473213465701152101 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1137165123275265574373 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(7584719860472175287 / 10000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w7S0 : Ball := ⟨(19251246749959249924984868595359 / 25000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ +def w7S1 : Ball := ⟨(14824420057112663320064282050391 / 25000000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ +def w7S2 : Ball := ⟨(35162148804755875201969759958069 / 100000000000000000000000000000000), (1 / 20000000000000000000000000000000)⟩ +def w7S3 : Ball := ⟨(2472753417135590046148799708857 / 20000000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ +def w7S4 : Ball := ⟨(95539210343058396701088265651 / 6250000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ +def w7S5 : Ball := ⟨(2920877028152050088661190921 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ +abbrev w7 : Ball := w7S5 +lemma w7_sound : w7.Encloses (weight (-83616) : ℝ) := by + exact weight_enclosed_of_trace (-83616) w7Trace w7S0 w7S1 w7S2 w7S3 w7S4 w7S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def w8Trace : List Ball := [ + ⟨(44255620504028353535093839376707 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(11767351027519824781514681327003 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(12006640780152923970773153169233 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(16170327539606619655605560222823 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2033499611543479931625663355311 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(816674312997879217804234909849 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(34125973083663975682479550323 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(9771322271714792344642153367 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(611733383535721364416486533 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(136123508118074211207180389 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(6813665539058170406805959 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(99198793107855363845763 / 4000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(206824660622540906858971 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(15920184415149323703729 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1137813098484958559199 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(15177669383476055103 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w8S0 : Ball := ⟨(19585599461965748205941204068907 / 25000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +def w8S1 : Ball := ⟨(61375313005528480896867231426661 / 100000000000000000000000000000000), (1 / 20000000000000000000000000000000)⟩ +def w8S2 : Ball := ⟨(7533858093053186981900116395073 / 20000000000000000000000000000000), (7 / 100000000000000000000000000000000)⟩ +def w8S3 : Ball := ⟨(3547438610391437687316481356023 / 25000000000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ +def w8S4 : Ball := ⟨(2013491311119349508951105594633 / 100000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +def w8S5 : Ball := ⟨(20270736299765585597522899913 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ +abbrev w8 : Ball := w8S5 +lemma w8_sound : w8.Encloses (weight (-78106) : ℝ) := by + exact weight_enclosed_of_trace (-78106) w8Trace w8S0 w8S1 w8S2 w8S3 w8S4 w8S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def w9Trace : List Ball := [ + ⟨(88699527378614997584418606311283 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(47118432737122465965471112245453 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(48059913174409657365816802515053 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(404469147700798506071080704651 / 2500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2034350230150267839672430013299 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(408479738841919004807783139473 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(68272402572622724176966322727 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(9773887863418301555598961499 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1223752594514843910638612953 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(272304306707673311571639007 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1362993993562388118284913 / 5000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2480405307799782445857741 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(51714550844373766236613 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(7961291538054047775879 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1137973143312383583331 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(75898503306711598709 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w9S0 : Ball := ⟨(78676061571896715450374622954693 / 100000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +def w9S1 : Ball := ⟨(7737403330581103835015607199747 / 12500000000000000000000000000000), (1 / 20000000000000000000000000000000)⟩ +def w9S2 : Ball := ⟨(19157571296028018686908397173011 / 50000000000000000000000000000000), (7 / 100000000000000000000000000000000)⟩ +def w9S3 : Ball := ⟨(3670125379623966596001366263729 / 25000000000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ +def w9S4 : Ball := ⟨(134698203021599649206550427993 / 6250000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +def w9S5 : Ball := ⟨(46447631096955076780984273421 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ +abbrev w9 : Ball := w9S5 +lemma w9_sound : w9.Encloses (weight (-76746) : ℝ) := by + exact weight_enclosed_of_trace (-76746) w9Trace w9S0 w9S1 w9S2 w9S3 w9S4 w9S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def w10Trace : List Ball := [ + ⟨(88726973040179621243745661716269 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(94251152927379453467141878319327 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(24032385734945065717126494981129 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1011249689141385047680937470733 / 6250000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4068948239782669415450004786023 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(817001008592755405479746088881 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(68275381681885051381458930667 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(19548522966975271994323269517 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(244758843534154172978419041 / 10000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(10892505974290951834362609 / 4000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(27260639662100522894982223 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1240234360183384052150687 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(206863087651387558792599 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(3184586469843224747037 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(227599289511193376947 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(9487497744688913257 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w10S0 : Ball := ⟨(78724757448727613401024974552239 / 100000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +def w10S1 : Ball := ⟨(61975874353609938497277403736921 / 100000000000000000000000000000000), (1 / 20000000000000000000000000000000)⟩ +def w10S2 : Ball := ⟨(19205045009472230559750080190707 / 50000000000000000000000000000000), (7 / 100000000000000000000000000000000)⟩ +def w10S3 : Ball := ⟨(14753350152634169135618964376373 / 100000000000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ +def w10S4 : Ball := ⟨(2176613407262306617311576838851 / 100000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +def w10S5 : Ball := ⟨(4737645924674027849039197649 / 10000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ +abbrev w10 : Ball := w10S5 +lemma w10_sound : w10.Encloses (weight (-76548) : ℝ) := by + exact weight_enclosed_of_trace (-76548) w10Trace w10S0 w10S1 w10S2 w10S3 w10S4 w10S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def w11Trace : List Ball := [ + ⟨(88952403628367317885077802409629 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(94368449066319424397392110109409 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(12026161835845551444360450356289 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(16190081952850732775042003735789 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(407098148580158147776125508197 / 10000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(408670891527778287994924284649 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(136599650015710916393014908209 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(9777326883467930151615955069 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1224135708009101346898124833 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(136190546753627526277973687 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(13633436474737510948164299 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2480988944623298328791599 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(10345157832843328690881 / 5000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(7962898817209613899869 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1138187623959312794013 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(75912109881242239047 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w11S0 : Ball := ⟨(39562650556319875899652914593389 / 50000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ +def w11S1 : Ball := ⟨(3130406638082954772029222168163 / 5000000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ +def w11S2 : Ball := ⟨(39197782879015309528139956418363 / 100000000000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ +def w11S3 : Ball := ⟨(15364661826304257277610201392047 / 100000000000000000000000000000000), (1 / 20000000000000000000000000000000)⟩ +def w11S4 : Ball := ⟨(2360728330366912746332528641641 / 100000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ +def w11S5 : Ball := ⟨(55730382497969515299452328931 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ +abbrev w11 : Ball := w11S5 +lemma w11_sound : w11.Encloses (weight (-74924) : ℝ) := by + exact weight_enclosed_of_trace (-74924) w11Trace w11S0 w11S1 w11S2 w11S3 w11S4 w11S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def w12Trace : List Ball := [ + ⟨(89524643700483357732777803369781 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(23666436146888771007562149969429 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(48205640553018161827744931915587 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1013476106739247767441439189163 / 6250000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4076127275582738323444357097393 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(818204042554562830588507827383 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(136723328133480962393226825867 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(3914032429994557913650721079 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2449998904689538110930602167 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(34069274746333858005712017 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(13641318358375792058184949 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2482304499152162992939139 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(25875559889306845033687 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(15933042771883463632687 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1138671018927091481099 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(15188551655927234631 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w12S0 : Ball := ⟨(10018327287123118184516723688243 / 12500000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +def w12S1 : Ball := ⟨(8029350530553252552316379660391 / 12500000000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ +def w12S2 : Ball := ⟨(4126110076319731087912757753237 / 10000000000000000000000000000000), (1 / 12500000000000000000000000000000)⟩ +def w12S3 : Ball := ⟨(8512392180953608551498385558867 / 50000000000000000000000000000000), (1 / 12500000000000000000000000000000)⟩ +def w12S4 : Ball := ⟨(1449216412847202647080426765947 / 50000000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ +def w12S5 : Ball := ⟨(84009128450628548223813961263 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ +abbrev w12 : Ball := w12S5 +lemma w12_sound : w12.Encloses (weight (-70820) : ℝ) := by + exact weight_enclosed_of_trace (-70820) w12Trace w12S0 w12S1 w12S2 w12S3 w12S4 w12S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def w13Trace : List Ball := [ + ⟨(44901791464017030681414471508929 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(18962085533883103714392120962301 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4825475150843493460525669297297 / 10000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(405700734647329560445348798217 / 2500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4078627608929810389018254403109 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(409311459933952387038776160319 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(8548962481180060297712308879 / 6250000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(9788846864004063986944790479 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(245083776442337545815108291 / 10000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(272638249438855836502179679 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(27290290323002874006187047 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1241471593580690215439527 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(41410733513450800798327 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(15936559870305698358221 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(569452836523750122401 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(18989406733724974259 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w13S0 : Ball := ⟨(4032341753356145359013450261071 / 5000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +def w13S1 : Ball := ⟨(6503912006343725044680424107743 / 10000000000000000000000000000000), (1 / 20000000000000000000000000000000)⟩ +def w13S2 : Ball := ⟨(5287608923282757365729742560173 / 12500000000000000000000000000000), (7 / 100000000000000000000000000000000)⟩ +def w13S3 : Ball := ⟨(17893637200370842028309167400449 / 100000000000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ +def w13S4 : Ball := ⟨(1600911261292476327131451328027 / 50000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +def w13S5 : Ball := ⟨(51258337330661348248937258371 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ +abbrev w13 : Ball := w13S5 +lemma w13_sound : w13.Encloses (weight (-68829) : ℝ) := by + exact weight_enclosed_of_trace (-68829) w13Trace w13S0 w13S1 w13S2 w13S3 w13S4 w13S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def w14Trace : List Ball := [ + ⟨(44937165551513774167289640393557 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4742354990166387900379992898827 / 5000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(6033399425302295783271296917333 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(8115586845607358870479032442409 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4079260948250966885525139266497 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2046822531505593118572174757 / 250000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(136798613507522795153407911329 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4894900271036589794027902079 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2451050194790026198126357499 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(136329766820128318964016009 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(27292228375345069922083449 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2483104912259425795876721 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(51766530633873004911209 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(159374504155278579473 / 1000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1138965087859557370499 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(37980695386649576051 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w14S0 : Ball := ⟨(80773953912166249728956297702401 / 100000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ +def w14S1 : Ball := ⟨(32622158153023786998166123019621 / 50000000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ +def w14S2 : Ball := ⟨(21284104051217926756826426760943 / 50000000000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ +def w14S3 : Ball := ⟨(18120523410522854485465151020969 / 100000000000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ +def w14S4 : Ball := ⟨(3283533686713068219880629244423 / 100000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +def w14S5 : Ball := ⟨(107815934717795136372966683321 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ +abbrev w14 : Ball := w14S5 +lemma w14_sound : w14.Encloses (weight (-68325) : ℝ) := by + exact weight_enclosed_of_trace (-68325) w14Trace w14S0 w14S1 w14S2 w14S3 w14S4 w14S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def w15Trace : List Ball := [ + ⟨(9000136829460554017574762996961 / 10000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2372823115740071449370936658997 / 2500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(965790551031331750079061873801 / 2000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(16236815932682457950342178822143 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2040198675115272529684165323083 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(163783873033974069417347868233 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(136825909206572302366030687583 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(19583023044490817024803085623 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2451431303875283914869816517 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(68174429411480088068328179 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(27295705197500403753232741 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2483395039389976647746697 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(207088465888743077756911 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1593904797556048860921 / 10000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(569535836068292028571 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(18992035446257787321 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w15S0 : Ball := ⟨(40501231474506136795924592711447 / 50000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +def w15S1 : Ball := ⟨(65613990038061061589390297318687 / 100000000000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ +def w15S2 : Ball := ⟨(43051956887147762304799225580421 / 100000000000000000000000000000000), (9 / 100000000000000000000000000000000)⟩ +def w15S3 : Ball := ⟨(18534709918128296435205018594573 / 100000000000000000000000000000000), (9 / 100000000000000000000000000000000)⟩ +def w15S4 : Ball := ⟨(3435354717491634411440934649917 / 100000000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ +def w15S5 : Ball := ⟨(4720664813996810911203188651 / 4000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ +abbrev w15 : Ball := w15S5 +lemma w15_sound : w15.Encloses (weight (-67421) : ℝ) := by + exact weight_enclosed_of_trace (-67421) w15Trace w15S0 w15S1 w15S2 w15S3 w15S4 w15S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def w16Trace : List Ball := [ + ⟨(90351223704156172151854589729257 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(47547020460593564806531326598257 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(48350947217965398497642396658833 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(16252329614434459969645910535381 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1020880352908205850554698035137 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2560758108775855876308926241 / 312500000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(136900930980905630990563909833 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(19592427563357126103791102221 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2452478639073234566388051329 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(272802647058997491437197581 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(27305259104858567503778853 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(310524031078657363982219 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(103574929513877067467227 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(15943437503359929608153 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1139364523321913123181 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4749167791468384123 / 6250000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w16S0 : Ball := ⟨(16326687249676944339346245159911 / 20000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ +def w16S1 : Ball := ⟨(66640179137190926257108098333817 / 100000000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ +def w16S2 : Ball := ⟨(173473182634253780653137407731 / 390625000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ +def w16S3 : Ball := ⟨(493042812407925431552203605237 / 2500000000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ +def w16S4 : Ball := ⟨(972364859468466991536108553409 / 25000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +def w16S5 : Ball := ⟨(18909868398582631231235721921 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ +abbrev w16 : Ball := w16S5 +lemma w16_sound : w16.Encloses (weight (-64938) : ℝ) := by + exact weight_enclosed_of_trace (-64938) w16Trace w16S0 w16S1 w16S2 w16S3 w16S4 w16S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def w17Trace : List Ball := [ + ⟨(45298387821582375935784030576739 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(380884073883296707469593257181 / 400000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(48393983934946073715053224648977 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(101644978089202783813343165521 / 625000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2042854625182367400676623133467 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(819808965573905378088781124177 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(68476727947610728916578961251 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(3919802268784215046179074659 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(245321178942121588147930871 / 10000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(272876094872061161066185861 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(27311946257030064302904893 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2484750223125090802005549 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(41438565428432741000249 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(7973254785296611336431 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(28489236873692992587 / 2500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(37999828231845789303 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w17S0 : Ball := ⟨(16415551513875860080278918234063 / 20000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ +def w17S1 : Ball := ⟨(13473516575235602085088246311929 / 20000000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ +def w17S2 : Ball := ⟨(45383912225787126955534400596353 / 100000000000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ +def w17S3 : Ball := ⟨(20596994889179502519454289981099 / 100000000000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ +def w17S4 : Ball := ⟨(4242361984648865472725574887741 / 100000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +def w17S5 : Ball := ⟨(179976352087938606848633619383 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ +abbrev w17 : Ball := w17S5 +lemma w17_sound : w17.Encloses (weight (-63201) : ℝ) := by + exact weight_enclosed_of_trace (-63201) w17Trace w17S0 w17S1 w17S2 w17S3 w17S4 w17S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def w18Trace : List Ball := [ + ⟨(45360007189952907876077061392377 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(95284702585555789552892804828379 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4841556120139729325935096356287 / 10000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(8134321855142162920660532638359 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(255425362264260689124577747797 / 6250000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(81999257320815019863295196973 / 10000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(136979776998880271586274449413 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4900577600253144798227371873 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(613394786561453086090150581 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(54582579147670986175469991 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(27315296737779666856987241 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2485029779274890971825417 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(207214354532091248898109 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(7974024336344950122371 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1139672154213748968831 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(19001538391422573177 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w18S0 : Ball := ⟨(82301210090903179917621139406909 / 100000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +def w18S1 : Ball := ⟨(677348918242698340839922830867 / 1000000000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ +def w18S2 : Ball := ⟨(45880155704455364119553636602897 / 100000000000000000000000000000000), (9 / 100000000000000000000000000000000)⟩ +def w18S3 : Ball := ⟨(21049886874650680890304787931221 / 100000000000000000000000000000000), (9 / 100000000000000000000000000000000)⟩ +def w18S4 : Ball := ⟨(886195474871182020280804328573 / 20000000000000000000000000000000), (1 / 20000000000000000000000000000000)⟩ +def w18S5 : Ball := ⟨(98167802460269975445626015323 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ +abbrev w18 : Ball := w18S5 +lemma w18_sound : w18.Encloses (weight (-62331) : ℝ) := by + exact weight_enclosed_of_trace (-62331) w18Trace w18S0 w18S1 w18S2 w18S3 w18S4 w18S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def w19Trace : List Ball := [ + ⟨(90728803307005652024631704752233 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(11911155397381487385849517734689 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(48417099446061195529885965703519 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1016814500916221214481706336367 / 6250000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4086883959667915501678102784189 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(820005660588747941876068104281 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(136981653094391278688428376781 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(9801272771993050541157941743 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2453605329483269685015774579 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(136457759336866684684239803 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(13657767768234143639209679 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(497009940777164108780597 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(207215888826620846736333 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(3987039591604536590003 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(284919868065247848863 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(15201323315511373547 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w19S0 : Ball := ⟨(82317157495213197391111925511083 / 100000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +def w19S1 : Ball := ⟨(33880572090458671407342062120323 / 50000000000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ +def w19S2 : Ball := ⟨(9183145321414136539714874890989 / 20000000000000000000000000000000), (9 / 100000000000000000000000000000000)⟩ +def w19S3 : Ball := ⟨(843301579942103450950470771321 / 4000000000000000000000000000000), (9 / 100000000000000000000000000000000)⟩ +def w19S4 : Ball := ⟨(2222367358540149679447878177467 / 50000000000000000000000000000000), (1 / 20000000000000000000000000000000)⟩ +def w19S5 : Ball := ⟨(39511333410437777570960140193 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ +abbrev w19 : Ball := w19S5 +lemma w19_sound : w19.Encloses (weight (-62269) : ℝ) := by + exact weight_enclosed_of_trace (-62269) w19Trace w19S0 w19S1 w19S2 w19S3 w19S4 w19S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def w20Trace : List Ball := [ + ⟨(22731197607144101774011092514723 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(95390456669805207241683142200581 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(48451381739007150264794195763177 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(254338828832093308239029732759 / 1562500000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2044312817830481878169826672397 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(820297264545556802806604355509 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(17127931661774445574469817139 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(19607784466622775384368432819 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2454188670577489270506761501 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(272973954342303384295332849 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(13660427789018642650060929 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1242746792529787688532183 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(6476564671067041269493 / 3125000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(638024082842483423813 / 4000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(569921249557372245787 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(7601692979348815989 / 10000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w20S0 : Ball := ⟨(20668293786201349530006062689821 / 25000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +def w20S1 : Ball := ⟨(68348538885236690604114750992311 / 100000000000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ +def w20S2 : Ball := ⟨(23357613838733559785715792104211 / 50000000000000000000000000000000), (9 / 100000000000000000000000000000000)⟩ +def w20S3 : Ball := ⟨(4364624993915180021185672885889 / 20000000000000000000000000000000), (9 / 100000000000000000000000000000000)⟩ +def w20S4 : Ball := ⟨(4762487834377271309240017303431 / 100000000000000000000000000000000), (1 / 20000000000000000000000000000000)⟩ +def w20S5 : Ball := ⟨(226812903725915115968880020279 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ +abbrev w20 : Ball := w20S5 +lemma w20_sound : w20.Encloses (weight (-60888) : ℝ) := by + exact weight_enclosed_of_trace (-60888) w20Trace w20S0 w20S1 w20S2 w20S3 w20S4 w20S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def w21Trace : List Ball := [ + ⟨(4546381593633731645311586412483 / 5000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(95391923531054658277119240326901 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(48451878493215132789703722658597 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(8138905207517209490944482310063 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2044325434092121625958872558539 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(820301488939196054401488331089 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(137024058819870186573910781299 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2450982544547154255080643477 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2454197120511083437693337979 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(272974800790134413214912279 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(27320932638228226963642379 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2485500014538094908746171 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(103625282282063317389969 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1595063746656350147507 / 10000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1139844860438857849223 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(19004269788038699249 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w21S0 : Ball := ⟨(8267834237972635769477607291581 / 10000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +def w21S1 : Ball := ⟨(2136158843331017337499425708763 / 3125000000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ +def w21S2 : Ball := ⟨(46726907944359013114685439468713 / 100000000000000000000000000000000), (9 / 100000000000000000000000000000000)⟩ +def w21S3 : Ball := ⟨(54585098151015036316432984489 / 250000000000000000000000000000), (9 / 100000000000000000000000000000000)⟩ +def w21S4 : Ball := ⟨(1191813176062378054567059252473 / 25000000000000000000000000000000), (1 / 20000000000000000000000000000000)⟩ +def w21S5 : Ball := ⟨(1818135867693942976840227081 / 800000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ +abbrev w21 : Ball := w21S5 +lemma w21_sound : w21.Encloses (weight (-60868) : ℝ) := by + exact weight_enclosed_of_trace (-60868) w21Trace w21S0 w21S1 w21S2 w21S3 w21S4 w21S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def w22Trace : List Ball := [ + ⟨(45633983581107315219871538302979 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(95567505449709056869614223920287 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(9702264179715798017842559266091 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(16292809564605679889594376395993 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4091669294235879701870235703463 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(410403392408157544587750880261 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(68548241623986150631976731017 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(9808468373776151991027867257 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2455207688137624436663006131 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(273076028070996496451214379 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(3416268507430148707161877 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(310783610027465150759859 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(207309768415760550521693 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(15954870056074715410523 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1140127224002864047001 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(76034934980751262993 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w22S0 : Ball := ⟨(16659683659846176204193839074009 / 20000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ +def w22S1 : Ball := ⟨(1084160389242756578300787149797 / 1562500000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ +def w22S2 : Ball := ⟨(48144537583739103387021781687031 / 100000000000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ +def w22S3 : Ball := ⟨(4635792998304134126955863599117 / 20000000000000000000000000000000), (7 / 100000000000000000000000000000000)⟩ +def w22S4 : Ball := ⟨(537264418078140842912054215571 / 10000000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ +def w22S5 : Ball := ⟨(288653054932843312984454457957 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ +abbrev w22 : Ball := w22S5 +lemma w22_sound : w22.Encloses (weight (-58477) : ℝ) := by + exact weight_enclosed_of_trace (-58477) w22Trace w22S0 w22S1 w22S2 w22S3 w22S4 w22S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def w23Trace : List Ball := [ + ⟨(91442398411354295784312056220971 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(11957176265682583831194402276173 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2427087171168606046882071736961 / 5000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(127347530925498127880409157347 / 781250000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1023303350143481052761979289147 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(821065239705792884394370560659 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(34283381021857860976928541227 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(19621578428657144143774750641 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2455724462005521975068942239 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(136563895014000851831093829 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1708428756864695040353181 / 6250000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1243331002152587585539351 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(5183500966272767493217 / 2500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(15957034071661612795207 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(5701357934014597387 / 500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(76044060795282790157 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w23S0 : Ball := ⟨(83617122272208506374499270625201 / 100000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ +def w23S1 : Ball := ⟨(69918231370854678480060373441927 / 100000000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ +def w23S2 : Ball := ⟨(12221397695070918230830931797667 / 25000000000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ +def w23S3 : Ball := ⟨(23898009859373560452900205601421 / 100000000000000000000000000000000), (7 / 100000000000000000000000000000000)⟩ +def w23S4 : Ball := ⟨(5711148752387159026538227846237 / 100000000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ +def w23S5 : Ball := ⟨(65234440143786806173257123601 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ +abbrev w23 : Ball := w23S5 +lemma w23_sound : w23.Encloses (weight (-57255) : ℝ) := by + exact weight_enclosed_of_trace (-57255) w23Trace w23S0 w23S1 w23S2 w23S3 w23S4 w23S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def w24Trace : List Ball := [ + ⟨(18306948936083586976691286324209 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(47852491693304259698880776577323 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(48557837668401624925941210426369 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(16304543309773358430596289055167 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1023507518290895754584260768429 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(102650240778792981087280952429 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(137153112507079619255857847633 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(19624033004609383051102587991 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(613999432345975286583212847 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(273155160767555829183993693 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(27337351698033342730146787 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2486869872451918782220861 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(103678022037502702591321 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(15958178281763927115007 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(28508697926531112547 / 2500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(38024442540107584337 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w24S0 : Ball := ⟨(83786094837092994281002747182393 / 100000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +def w24S1 : Ball := ⟨(70201096880503413118637982536993 / 100000000000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ +def w24S2 : Ball := ⟨(3080121252016141275390368322639 / 6250000000000000000000000000000), (9 / 100000000000000000000000000000000)⟩ +def w24S3 : Ball := ⟨(12143548066715496543652834142857 / 50000000000000000000000000000000), (1 / 10000000000000000000000000000000)⟩ +def w24S4 : Ball := ⟨(737328798243148368471610262829 / 12500000000000000000000000000000), (1 / 20000000000000000000000000000000)⟩ +def w24S5 : Ball := ⟨(69587680859991730250340878531 / 20000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ +abbrev w24 : Ball := w24S5 +lemma w24_sound : w24.Encloses (weight (-56609) : ℝ) := by + exact weight_enclosed_of_trace (-56609) w24Trace w24S0 w24S1 w24S2 w24S3 w24S4 w24S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +lemma A1_5_10_below : below (shape 1 5 10) = [ + (shape 0 0 8), + (shape 0 1 7), + (shape 0 2 6), + (shape 0 3 5), + (shape 0 4 4), + (shape 0 5 3), + (shape 1 0 7), + (shape 1 1 6), + (shape 1 2 5), + (shape 1 3 4), + (shape 1 4 3), + (shape 1 5 2)] := by decide +kernel +def A1_5_10Raw (s : Shape) : Ball := + match s 0, s 1, s 2 with + | 0, 0, 8 => ⟨(4877234139087099097455979049 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 0, 1, 7 => ⟨(1040730640497417669371234343317 / 50000000000000000000000000000000), (7 / 100000000000000000000000000000000)⟩ + | 0, 2, 6 => ⟨(24806928903736187010464986272311 / 50000000000000000000000000000000), (63 / 100000000000000000000000000000000)⟩ + | 0, 3, 5 => ⟨1, 0⟩ + | 0, 4, 4 => ⟨(1373466604963415429908322697947 / 5000000000000000000000000000000), (71 / 100000000000000000000000000000000)⟩ + | 0, 5, 3 => ⟨(180907807836891972602388433389 / 20000000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ + | 1, 0, 7 => ⟨(180907807836891972602388433389 / 20000000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ + | 1, 1, 6 => ⟨(1373466604963415429908322697947 / 5000000000000000000000000000000), (71 / 100000000000000000000000000000000)⟩ + | 1, 2, 5 => ⟨1, 0⟩ + | 1, 3, 4 => ⟨(24806928903736187010464986272311 / 50000000000000000000000000000000), (63 / 100000000000000000000000000000000)⟩ + | 1, 4, 3 => ⟨(1040730640497417669371234343317 / 50000000000000000000000000000000), (7 / 100000000000000000000000000000000)⟩ + | 1, 5, 2 => ⟨(4877234139087099097455979049 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | _, _, _ => (.exact 0) +lemma A1_5_10Raw_0_0_8 : (A1_5_10Raw (shape 0 0 8)).Encloses (splitWeight positiveInitial tableP (shape 1 5 10) (shape 0 0 8) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 1 5 10) (shape 0 0 8) + (0) (-14246) (-78106) w195 w117 w8 + (by decide +kernel) w195_sound w117_sound w8_sound) (by decide +kernel) +lemma A1_5_10Raw_0_1_7 : (A1_5_10Raw (shape 0 1 7)).Encloses (splitWeight positiveInitial tableP (shape 1 5 10) (shape 0 1 7) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 1 5 10) (shape 0 1 7) + (0) (-5912) (-32809) w195 w160 w61 + (by decide +kernel) w195_sound w160_sound w61_sound) (by decide +kernel) +lemma A1_5_10Raw_0_2_6 : (A1_5_10Raw (shape 0 2 6)).Encloses (splitWeight positiveInitial tableP (shape 1 5 10) (shape 0 2 6) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 1 5 10) (shape 0 2 6) + (0) (0) (-7009) w195 w195 w149 + (by decide +kernel) w195_sound w195_sound w149_sound) (by decide +kernel) +lemma A1_5_10Raw_0_3_5 : (A1_5_10Raw (shape 0 3 5)).Encloses (splitWeight positiveInitial tableP (shape 1 5 10) (shape 0 3 5) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 1 5 10) (shape 0 3 5) + (0) (0) (0) w195 w195 w195 + (by decide +kernel) w195_sound w195_sound w195_sound) (by decide +kernel) +lemma A1_5_10Raw_0_4_4 : (A1_5_10Raw (shape 0 4 4)).Encloses (splitWeight positiveInitial tableP (shape 1 5 10) (shape 0 4 4) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 1 5 10) (shape 0 4 4) + (0) (-5912) (-7009) w195 w160 w149 + (by decide +kernel) w195_sound w160_sound w149_sound) (by decide +kernel) +lemma A1_5_10Raw_0_5_3 : (A1_5_10Raw (shape 0 5 3)).Encloses (splitWeight positiveInitial tableP (shape 1 5 10) (shape 0 5 3) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 1 5 10) (shape 0 5 3) + (0) (-14246) (-32809) w195 w117 w61 + (by decide +kernel) w195_sound w117_sound w61_sound) (by decide +kernel) +lemma A1_5_10Raw_1_0_7 : (A1_5_10Raw (shape 1 0 7)).Encloses (splitWeight positiveInitial tableP (shape 1 5 10) (shape 1 0 7) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 1 5 10) (shape 1 0 7) + (0) (-14246) (-32809) w195 w117 w61 + (by decide +kernel) w195_sound w117_sound w61_sound) (by decide +kernel) +lemma A1_5_10Raw_1_1_6 : (A1_5_10Raw (shape 1 1 6)).Encloses (splitWeight positiveInitial tableP (shape 1 5 10) (shape 1 1 6) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 1 5 10) (shape 1 1 6) + (0) (-5912) (-7009) w195 w160 w149 + (by decide +kernel) w195_sound w160_sound w149_sound) (by decide +kernel) +lemma A1_5_10Raw_1_2_5 : (A1_5_10Raw (shape 1 2 5)).Encloses (splitWeight positiveInitial tableP (shape 1 5 10) (shape 1 2 5) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 1 5 10) (shape 1 2 5) + (0) (0) (0) w195 w195 w195 + (by decide +kernel) w195_sound w195_sound w195_sound) (by decide +kernel) +lemma A1_5_10Raw_1_3_4 : (A1_5_10Raw (shape 1 3 4)).Encloses (splitWeight positiveInitial tableP (shape 1 5 10) (shape 1 3 4) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 1 5 10) (shape 1 3 4) + (0) (0) (-7009) w195 w195 w149 + (by decide +kernel) w195_sound w195_sound w149_sound) (by decide +kernel) +lemma A1_5_10Raw_1_4_3 : (A1_5_10Raw (shape 1 4 3)).Encloses (splitWeight positiveInitial tableP (shape 1 5 10) (shape 1 4 3) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 1 5 10) (shape 1 4 3) + (0) (-5912) (-32809) w195 w160 w61 + (by decide +kernel) w195_sound w160_sound w61_sound) (by decide +kernel) +lemma A1_5_10Raw_1_5_2 : (A1_5_10Raw (shape 1 5 2)).Encloses (splitWeight positiveInitial tableP (shape 1 5 10) (shape 1 5 2) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 1 5 10) (shape 1 5 2) + (0) (-14246) (-78106) w195 w117 w8 + (by decide +kernel) w195_sound w117_sound w8_sound) (by decide +kernel) +lemma A1_5_10Raw_sound (u : Shape) (hu : u ∈ below (shape 1 5 10)) : + (A1_5_10Raw u).Encloses (splitWeight positiveInitial tableP (shape 1 5 10) u : ℝ) := by + rw [A1_5_10_below] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl + · exact A1_5_10Raw_0_0_8 + · exact A1_5_10Raw_0_1_7 + · exact A1_5_10Raw_0_2_6 + · exact A1_5_10Raw_0_3_5 + · exact A1_5_10Raw_0_4_4 + · exact A1_5_10Raw_0_5_3 + · exact A1_5_10Raw_1_0_7 + · exact A1_5_10Raw_1_1_6 + · exact A1_5_10Raw_1_2_5 + · exact A1_5_10Raw_1_3_4 + · exact A1_5_10Raw_1_4_3 + · exact A1_5_10Raw_1_5_2 +def A1_5_10Den : Ball := ⟨(180078944695198152019045749315239 / 50000000000000000000000000000000), (73 / 25000000000000000000000000000000)⟩ +lemma A1_5_10Den_sound : A1_5_10Den.Encloses (((below (shape 1 5 10)).map (splitWeight positiveInitial tableP (shape 1 5 10))).sum : ℝ) := by + exact contains_sound (list_cast_enclosed (below (shape 1 5 10)) A1_5_10Raw (splitWeight positiveInitial tableP (shape 1 5 10)) A1_5_10Raw_sound) (by decide +kernel) +lemma A1_5_10Den_positive : 0 < A1_5_10Den.lower := by decide +kernel +def A1_5_10Table (s : Shape) : Ball := + match s 0, s 1, s 2 with + | 0, 0, 8 => ⟨(1354193336523132042830125793 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 0, 1, 7 => ⟨(288965109790864128701089625269 / 50000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ + | 0, 2, 6 => ⟨(13775585449883897327311949605707 / 100000000000000000000000000000000), (29 / 100000000000000000000000000000000)⟩ + | 0, 3, 5 => ⟨(13882800147632490517692935191451 / 50000000000000000000000000000000), (23 / 100000000000000000000000000000000)⟩ + | 0, 4, 4 => ⟨(7627024954461759705584239713517 / 100000000000000000000000000000000), (13 / 50000000000000000000000000000000)⟩ + | 0, 5, 3 => ⟨(251150694134587410230100795749 / 100000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ + | 1, 0, 7 => ⟨(251150694134587410230100795749 / 100000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ + | 1, 1, 6 => ⟨(7627024954461759705584239713517 / 100000000000000000000000000000000), (13 / 50000000000000000000000000000000)⟩ + | 1, 2, 5 => ⟨(13882800147632490517692935191451 / 50000000000000000000000000000000), (23 / 100000000000000000000000000000000)⟩ + | 1, 3, 4 => ⟨(13775585449883897327311949605707 / 100000000000000000000000000000000), (29 / 100000000000000000000000000000000)⟩ + | 1, 4, 3 => ⟨(288965109790864128701089625269 / 50000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ + | 1, 5, 2 => ⟨(1354193336523132042830125793 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | _, _, _ => (.exact 0) +def A1_5_10Law (u : Shape) : Ball := if u ∈ below (shape 1 5 10) then A1_5_10Table u else .exact 0 +lemma A1_5_10Law_check_0_0_8 : contains (.mul (A1_5_10Raw (shape 0 0 8)) (.inv A1_5_10Den)) (A1_5_10Table (shape 0 0 8)) = true := by decide +kernel +lemma A1_5_10Law_check_0_1_7 : contains (.mul (A1_5_10Raw (shape 0 1 7)) (.inv A1_5_10Den)) (A1_5_10Table (shape 0 1 7)) = true := by decide +kernel +lemma A1_5_10Law_check_0_2_6 : contains (.mul (A1_5_10Raw (shape 0 2 6)) (.inv A1_5_10Den)) (A1_5_10Table (shape 0 2 6)) = true := by decide +kernel +lemma A1_5_10Law_check_0_3_5 : contains (.mul (A1_5_10Raw (shape 0 3 5)) (.inv A1_5_10Den)) (A1_5_10Table (shape 0 3 5)) = true := by decide +kernel +lemma A1_5_10Law_check_0_4_4 : contains (.mul (A1_5_10Raw (shape 0 4 4)) (.inv A1_5_10Den)) (A1_5_10Table (shape 0 4 4)) = true := by decide +kernel +lemma A1_5_10Law_check_0_5_3 : contains (.mul (A1_5_10Raw (shape 0 5 3)) (.inv A1_5_10Den)) (A1_5_10Table (shape 0 5 3)) = true := by decide +kernel +lemma A1_5_10Law_check_1_0_7 : contains (.mul (A1_5_10Raw (shape 1 0 7)) (.inv A1_5_10Den)) (A1_5_10Table (shape 1 0 7)) = true := by decide +kernel +lemma A1_5_10Law_check_1_1_6 : contains (.mul (A1_5_10Raw (shape 1 1 6)) (.inv A1_5_10Den)) (A1_5_10Table (shape 1 1 6)) = true := by decide +kernel +lemma A1_5_10Law_check_1_2_5 : contains (.mul (A1_5_10Raw (shape 1 2 5)) (.inv A1_5_10Den)) (A1_5_10Table (shape 1 2 5)) = true := by decide +kernel +lemma A1_5_10Law_check_1_3_4 : contains (.mul (A1_5_10Raw (shape 1 3 4)) (.inv A1_5_10Den)) (A1_5_10Table (shape 1 3 4)) = true := by decide +kernel +lemma A1_5_10Law_check_1_4_3 : contains (.mul (A1_5_10Raw (shape 1 4 3)) (.inv A1_5_10Den)) (A1_5_10Table (shape 1 4 3)) = true := by decide +kernel +lemma A1_5_10Law_check_1_5_2 : contains (.mul (A1_5_10Raw (shape 1 5 2)) (.inv A1_5_10Den)) (A1_5_10Table (shape 1 5 2)) = true := by decide +kernel +lemma A1_5_10Law_check (u : Shape) (hu : u ∈ below (shape 1 5 10)) : + contains (.mul (A1_5_10Raw u) (.inv A1_5_10Den)) (A1_5_10Table u) = true := by + rw [A1_5_10_below] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl + · exact A1_5_10Law_check_0_0_8 + · exact A1_5_10Law_check_0_1_7 + · exact A1_5_10Law_check_0_2_6 + · exact A1_5_10Law_check_0_3_5 + · exact A1_5_10Law_check_0_4_4 + · exact A1_5_10Law_check_0_5_3 + · exact A1_5_10Law_check_1_0_7 + · exact A1_5_10Law_check_1_1_6 + · exact A1_5_10Law_check_1_2_5 + · exact A1_5_10Law_check_1_3_4 + · exact A1_5_10Law_check_1_4_3 + · exact A1_5_10Law_check_1_5_2 +lemma A1_5_10Law_sound (u : Shape) : + (A1_5_10Law u).Encloses (stageALaw (shape 1 5 10) u : ℝ) := by + by_cases hu : u ∈ below (shape 1 5 10) + · have h := contains_sound (Ball.mul_sound (A1_5_10Raw_sound u hu) + (Ball.inv_sound A1_5_10Den_sound A1_5_10Den_positive)) (A1_5_10Law_check u hu) + simpa only [A1_5_10Law, hu, ite_true, stageALaw, splitLaw, + Rat.cast_div, Rat.cast_mul, Rat.cast_inv, div_eq_mul_inv] using h + · simp only [A1_5_10Law, hu, ite_false, stageALaw, splitLaw, Rat.cast_zero] + simpa only [Rat.cast_zero] using Ball.exact_sound 0 + +lemma A1_6_9_below : below (shape 1 6 9) = [ + (shape 0 0 8), + (shape 0 1 7), + (shape 0 2 6), + (shape 0 3 5), + (shape 0 4 4), + (shape 0 5 3), + (shape 0 6 2), + (shape 1 0 7), + (shape 1 1 6), + (shape 1 2 5), + (shape 1 3 4), + (shape 1 4 3), + (shape 1 5 2), + (shape 1 6 1)] := by decide +kernel +def A1_6_9Raw (s : Shape) : Ball := + match s 0, s 1, s 2 with + | 0, 0, 8 => ⟨(465206198044103796714339601 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 0, 1, 7 => ⟨(3519230583945255359012162411 / 1562500000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ + | 0, 2, 6 => ⟨(2758900617971649586297424581857 / 20000000000000000000000000000000), (7 / 20000000000000000000000000000000)⟩ + | 0, 3, 5 => ⟨1, 0⟩ + | 0, 4, 4 => ⟨(69823469044785918019090333627239 / 100000000000000000000000000000000), (19 / 25000000000000000000000000000000)⟩ + | 0, 5, 3 => ⟨(159746720192498137638592631477 / 3125000000000000000000000000000), (3 / 20000000000000000000000000000000)⟩ + | 0, 6, 2 => ⟨(62591248309512292903546658869 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 1, 0, 7 => ⟨(62591248309512292903546658869 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 1, 1, 6 => ⟨(159746720192498137638592631477 / 3125000000000000000000000000000), (3 / 20000000000000000000000000000000)⟩ + | 1, 2, 5 => ⟨(69823469044785918019090333627239 / 100000000000000000000000000000000), (19 / 25000000000000000000000000000000)⟩ + | 1, 3, 4 => ⟨1, 0⟩ + | 1, 4, 3 => ⟨(2758900617971649586297424581857 / 20000000000000000000000000000000), (7 / 20000000000000000000000000000000)⟩ + | 1, 5, 2 => ⟨(3519230583945255359012162411 / 1562500000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ + | 1, 6, 1 => ⟨(465206198044103796714339601 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | _, _, _ => (.exact 0) +lemma A1_6_9Raw_0_0_8 : (A1_6_9Raw (shape 0 0 8)).Encloses (splitWeight positiveInitial tableP (shape 1 6 9) (shape 0 0 8) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 1 6 9) (shape 0 0 8) + (0) (-26324) (-96458) w195 w76 w4 + (by decide +kernel) w195_sound w76_sound w4_sound) (by decide +kernel) +lemma A1_6_9Raw_0_1_7 : (A1_6_9Raw (shape 0 1 7)).Encloses (splitWeight positiveInitial tableP (shape 1 6 9) (shape 0 1 7) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 1 6 9) (shape 0 1 7) + (0) (-13519) (-47439) w195 w120 w37 + (by decide +kernel) w195_sound w120_sound w37_sound) (by decide +kernel) +lemma A1_6_9Raw_0_2_6 : (A1_6_9Raw (shape 0 2 6)).Encloses (splitWeight positiveInitial tableP (shape 1 6 9) (shape 0 2 6) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 1 6 9) (shape 0 2 6) + (0) (-3592) (-16217) w195 w180 w108 + (by decide +kernel) w195_sound w180_sound w108_sound) (by decide +kernel) +lemma A1_6_9Raw_0_3_5 : (A1_6_9Raw (shape 0 3 5)).Encloses (splitWeight positiveInitial tableP (shape 1 6 9) (shape 0 3 5) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 1 6 9) (shape 0 3 5) + (0) (0) (0) w195 w195 w195 + (by decide +kernel) w195_sound w195_sound w195_sound) (by decide +kernel) +lemma A1_6_9Raw_0_4_4 : (A1_6_9Raw (shape 0 4 4)).Encloses (splitWeight positiveInitial tableP (shape 1 6 9) (shape 0 4 4) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 1 6 9) (shape 0 4 4) + (0) (-3592) (0) w195 w180 w195 + (by decide +kernel) w195_sound w180_sound w195_sound) (by decide +kernel) +lemma A1_6_9Raw_0_5_3 : (A1_6_9Raw (shape 0 5 3)).Encloses (splitWeight positiveInitial tableP (shape 1 6 9) (shape 0 5 3) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 1 6 9) (shape 0 5 3) + (0) (-13519) (-16217) w195 w120 w108 + (by decide +kernel) w195_sound w120_sound w108_sound) (by decide +kernel) +lemma A1_6_9Raw_0_6_2 : (A1_6_9Raw (shape 0 6 2)).Encloses (splitWeight positiveInitial tableP (shape 1 6 9) (shape 0 6 2) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 1 6 9) (shape 0 6 2) + (0) (-26324) (-47439) w195 w76 w37 + (by decide +kernel) w195_sound w76_sound w37_sound) (by decide +kernel) +lemma A1_6_9Raw_1_0_7 : (A1_6_9Raw (shape 1 0 7)).Encloses (splitWeight positiveInitial tableP (shape 1 6 9) (shape 1 0 7) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 1 6 9) (shape 1 0 7) + (0) (-26324) (-47439) w195 w76 w37 + (by decide +kernel) w195_sound w76_sound w37_sound) (by decide +kernel) +lemma A1_6_9Raw_1_1_6 : (A1_6_9Raw (shape 1 1 6)).Encloses (splitWeight positiveInitial tableP (shape 1 6 9) (shape 1 1 6) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 1 6 9) (shape 1 1 6) + (0) (-13519) (-16217) w195 w120 w108 + (by decide +kernel) w195_sound w120_sound w108_sound) (by decide +kernel) +lemma A1_6_9Raw_1_2_5 : (A1_6_9Raw (shape 1 2 5)).Encloses (splitWeight positiveInitial tableP (shape 1 6 9) (shape 1 2 5) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 1 6 9) (shape 1 2 5) + (0) (-3592) (0) w195 w180 w195 + (by decide +kernel) w195_sound w180_sound w195_sound) (by decide +kernel) +lemma A1_6_9Raw_1_3_4 : (A1_6_9Raw (shape 1 3 4)).Encloses (splitWeight positiveInitial tableP (shape 1 6 9) (shape 1 3 4) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 1 6 9) (shape 1 3 4) + (0) (0) (0) w195 w195 w195 + (by decide +kernel) w195_sound w195_sound w195_sound) (by decide +kernel) +lemma A1_6_9Raw_1_4_3 : (A1_6_9Raw (shape 1 4 3)).Encloses (splitWeight positiveInitial tableP (shape 1 6 9) (shape 1 4 3) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 1 6 9) (shape 1 4 3) + (0) (-3592) (-16217) w195 w180 w108 + (by decide +kernel) w195_sound w180_sound w108_sound) (by decide +kernel) +lemma A1_6_9Raw_1_5_2 : (A1_6_9Raw (shape 1 5 2)).Encloses (splitWeight positiveInitial tableP (shape 1 6 9) (shape 1 5 2) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 1 6 9) (shape 1 5 2) + (0) (-13519) (-47439) w195 w120 w37 + (by decide +kernel) w195_sound w120_sound w37_sound) (by decide +kernel) +lemma A1_6_9Raw_1_6_1 : (A1_6_9Raw (shape 1 6 1)).Encloses (splitWeight positiveInitial tableP (shape 1 6 9) (shape 1 6 1) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 1 6 9) (shape 1 6 1) + (0) (-26324) (-96458) w195 w76 w4 + (by decide +kernel) w195_sound w76_sound w4_sound) (by decide +kernel) +lemma A1_6_9Raw_sound (u : Shape) (hu : u ∈ below (shape 1 6 9)) : + (A1_6_9Raw u).Encloses (splitWeight positiveInitial tableP (shape 1 6 9) u : ℝ) := by + rw [A1_6_9_below] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl + · exact A1_6_9Raw_0_0_8 + · exact A1_6_9Raw_0_1_7 + · exact A1_6_9Raw_0_2_6 + · exact A1_6_9Raw_0_3_5 + · exact A1_6_9Raw_0_4_4 + · exact A1_6_9Raw_0_5_3 + · exact A1_6_9Raw_0_6_2 + · exact A1_6_9Raw_1_0_7 + · exact A1_6_9Raw_1_1_6 + · exact A1_6_9Raw_1_2_5 + · exact A1_6_9Raw_1_3_4 + · exact A1_6_9Raw_1_4_3 + · exact A1_6_9Raw_1_5_2 + · exact A1_6_9Raw_1_6_1 +def A1_6_9Den : Ball := ⟨(94509077196342079547344730068281 / 25000000000000000000000000000000), (13 / 5000000000000000000000000000000)⟩ +lemma A1_6_9Den_sound : A1_6_9Den.Encloses (((below (shape 1 6 9)).map (splitWeight positiveInitial tableP (shape 1 6 9))).sum : ℝ) := by + exact contains_sound (list_cast_enclosed (below (shape 1 6 9)) A1_6_9Raw (splitWeight positiveInitial tableP (shape 1 6 9)) A1_6_9Raw_sound) (by decide +kernel) +lemma A1_6_9Den_positive : 0 < A1_6_9Den.lower := by decide +kernel +def A1_6_9Table (s : Shape) : Ball := + match s 0, s 1, s 2 with + | 0, 0, 8 => ⟨(15382325296305947711052937 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 0, 1, 7 => ⟨(5957913357480485806366775989 / 10000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 0, 2, 6 => ⟨(36489889381736965002937990111 / 1000000000000000000000000000000), (3 / 25000000000000000000000000000000)⟩ + | 0, 3, 5 => ⟨(6613121390462484295530342757863 / 25000000000000000000000000000000), (19 / 100000000000000000000000000000000)⟩ + | 0, 4, 4 => ⟨(18470043067854755212619808940411 / 100000000000000000000000000000000), (17 / 50000000000000000000000000000000)⟩ + | 0, 5, 3 => ⟨(1352223299022380417157697666993 / 100000000000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ + | 0, 6, 2 => ⟨(8278470461027691080983583329 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 1, 0, 7 => ⟨(8278470461027691080983583329 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 1, 1, 6 => ⟨(1352223299022380417157697666993 / 100000000000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ + | 1, 2, 5 => ⟨(18470043067854755212619808940411 / 100000000000000000000000000000000), (17 / 50000000000000000000000000000000)⟩ + | 1, 3, 4 => ⟨(6613121390462484295530342757863 / 25000000000000000000000000000000), (19 / 100000000000000000000000000000000)⟩ + | 1, 4, 3 => ⟨(36489889381736965002937990111 / 1000000000000000000000000000000), (3 / 25000000000000000000000000000000)⟩ + | 1, 5, 2 => ⟨(5957913357480485806366775989 / 10000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 1, 6, 1 => ⟨(15382325296305947711052937 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | _, _, _ => (.exact 0) +def A1_6_9Law (u : Shape) : Ball := if u ∈ below (shape 1 6 9) then A1_6_9Table u else .exact 0 +lemma A1_6_9Law_check_0_0_8 : contains (.mul (A1_6_9Raw (shape 0 0 8)) (.inv A1_6_9Den)) (A1_6_9Table (shape 0 0 8)) = true := by decide +kernel +lemma A1_6_9Law_check_0_1_7 : contains (.mul (A1_6_9Raw (shape 0 1 7)) (.inv A1_6_9Den)) (A1_6_9Table (shape 0 1 7)) = true := by decide +kernel +lemma A1_6_9Law_check_0_2_6 : contains (.mul (A1_6_9Raw (shape 0 2 6)) (.inv A1_6_9Den)) (A1_6_9Table (shape 0 2 6)) = true := by decide +kernel +lemma A1_6_9Law_check_0_3_5 : contains (.mul (A1_6_9Raw (shape 0 3 5)) (.inv A1_6_9Den)) (A1_6_9Table (shape 0 3 5)) = true := by decide +kernel +lemma A1_6_9Law_check_0_4_4 : contains (.mul (A1_6_9Raw (shape 0 4 4)) (.inv A1_6_9Den)) (A1_6_9Table (shape 0 4 4)) = true := by decide +kernel +lemma A1_6_9Law_check_0_5_3 : contains (.mul (A1_6_9Raw (shape 0 5 3)) (.inv A1_6_9Den)) (A1_6_9Table (shape 0 5 3)) = true := by decide +kernel +lemma A1_6_9Law_check_0_6_2 : contains (.mul (A1_6_9Raw (shape 0 6 2)) (.inv A1_6_9Den)) (A1_6_9Table (shape 0 6 2)) = true := by decide +kernel +lemma A1_6_9Law_check_1_0_7 : contains (.mul (A1_6_9Raw (shape 1 0 7)) (.inv A1_6_9Den)) (A1_6_9Table (shape 1 0 7)) = true := by decide +kernel +lemma A1_6_9Law_check_1_1_6 : contains (.mul (A1_6_9Raw (shape 1 1 6)) (.inv A1_6_9Den)) (A1_6_9Table (shape 1 1 6)) = true := by decide +kernel +lemma A1_6_9Law_check_1_2_5 : contains (.mul (A1_6_9Raw (shape 1 2 5)) (.inv A1_6_9Den)) (A1_6_9Table (shape 1 2 5)) = true := by decide +kernel +lemma A1_6_9Law_check_1_3_4 : contains (.mul (A1_6_9Raw (shape 1 3 4)) (.inv A1_6_9Den)) (A1_6_9Table (shape 1 3 4)) = true := by decide +kernel +lemma A1_6_9Law_check_1_4_3 : contains (.mul (A1_6_9Raw (shape 1 4 3)) (.inv A1_6_9Den)) (A1_6_9Table (shape 1 4 3)) = true := by decide +kernel +lemma A1_6_9Law_check_1_5_2 : contains (.mul (A1_6_9Raw (shape 1 5 2)) (.inv A1_6_9Den)) (A1_6_9Table (shape 1 5 2)) = true := by decide +kernel +lemma A1_6_9Law_check_1_6_1 : contains (.mul (A1_6_9Raw (shape 1 6 1)) (.inv A1_6_9Den)) (A1_6_9Table (shape 1 6 1)) = true := by decide +kernel +lemma A1_6_9Law_check (u : Shape) (hu : u ∈ below (shape 1 6 9)) : + contains (.mul (A1_6_9Raw u) (.inv A1_6_9Den)) (A1_6_9Table u) = true := by + rw [A1_6_9_below] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl + · exact A1_6_9Law_check_0_0_8 + · exact A1_6_9Law_check_0_1_7 + · exact A1_6_9Law_check_0_2_6 + · exact A1_6_9Law_check_0_3_5 + · exact A1_6_9Law_check_0_4_4 + · exact A1_6_9Law_check_0_5_3 + · exact A1_6_9Law_check_0_6_2 + · exact A1_6_9Law_check_1_0_7 + · exact A1_6_9Law_check_1_1_6 + · exact A1_6_9Law_check_1_2_5 + · exact A1_6_9Law_check_1_3_4 + · exact A1_6_9Law_check_1_4_3 + · exact A1_6_9Law_check_1_5_2 + · exact A1_6_9Law_check_1_6_1 +lemma A1_6_9Law_sound (u : Shape) : + (A1_6_9Law u).Encloses (stageALaw (shape 1 6 9) u : ℝ) := by + by_cases hu : u ∈ below (shape 1 6 9) + · have h := contains_sound (Ball.mul_sound (A1_6_9Raw_sound u hu) + (Ball.inv_sound A1_6_9Den_sound A1_6_9Den_positive)) (A1_6_9Law_check u hu) + simpa only [A1_6_9Law, hu, ite_true, stageALaw, splitLaw, + Rat.cast_div, Rat.cast_mul, Rat.cast_inv, div_eq_mul_inv] using h + · simp only [A1_6_9Law, hu, ite_false, stageALaw, splitLaw, Rat.cast_zero] + simpa only [Rat.cast_zero] using Ball.exact_sound 0 + +lemma B1_3_4_below : below (shape 1 3 4) = [ + (shape 0 0 4), + (shape 0 1 3), + (shape 0 2 2), + (shape 0 3 1), + (shape 1 0 3), + (shape 1 1 2), + (shape 1 2 1), + (shape 1 3 0)] := by decide +kernel +def B1_3_4Raw (s : Shape) : Ball := + match s 0, s 1, s 2 with + | 0, 0, 4 => ⟨(21517752334378745292384301617 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 0, 1, 3 => ⟨(6992394129695647447331751196051 / 50000000000000000000000000000000), (9 / 50000000000000000000000000000000)⟩ + | 0, 2, 2 => ⟨1, 0⟩ + | 0, 3, 1 => ⟨(766343960730141034186800786921 / 25000000000000000000000000000000), (9 / 100000000000000000000000000000000)⟩ + | 1, 0, 3 => ⟨(766343960730141034186800786921 / 25000000000000000000000000000000), (9 / 100000000000000000000000000000000)⟩ + | 1, 1, 2 => ⟨1, 0⟩ + | 1, 2, 1 => ⟨(6992394129695647447331751196051 / 50000000000000000000000000000000), (9 / 50000000000000000000000000000000)⟩ + | 1, 3, 0 => ⟨(21517752334378745292384301617 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | _, _, _ => (.exact 0) +lemma B1_3_4Raw_0_0_4 : (B1_3_4Raw (shape 0 0 4)).Encloses (splitWeight positiveSecond tablep (shape 1 3 4) (shape 0 0 4) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveSecond tablep (shape 1 3 4) (shape 0 0 4) + (0) (-15178) (-62331) w195 w113 w18 + (by decide +kernel) w195_sound w113_sound w18_sound) (by decide +kernel) +lemma B1_3_4Raw_0_1_3 : (B1_3_4Raw (shape 0 1 3)).Encloses (splitWeight positiveSecond tablep (shape 1 3 4) (shape 0 1 3) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveSecond tablep (shape 1 3 4) (shape 0 1 3) + (0) (0) (-19672) w195 w195 w89 + (by decide +kernel) w195_sound w195_sound w89_sound) (by decide +kernel) +lemma B1_3_4Raw_0_2_2 : (B1_3_4Raw (shape 0 2 2)).Encloses (splitWeight positiveSecond tablep (shape 1 3 4) (shape 0 2 2) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveSecond tablep (shape 1 3 4) (shape 0 2 2) + (0) (0) (0) w195 w195 w195 + (by decide +kernel) w195_sound w195_sound w195_sound) (by decide +kernel) +lemma B1_3_4Raw_0_3_1 : (B1_3_4Raw (shape 0 3 1)).Encloses (splitWeight positiveSecond tablep (shape 1 3 4) (shape 0 3 1) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveSecond tablep (shape 1 3 4) (shape 0 3 1) + (0) (-15178) (-19672) w195 w113 w89 + (by decide +kernel) w195_sound w113_sound w89_sound) (by decide +kernel) +lemma B1_3_4Raw_1_0_3 : (B1_3_4Raw (shape 1 0 3)).Encloses (splitWeight positiveSecond tablep (shape 1 3 4) (shape 1 0 3) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveSecond tablep (shape 1 3 4) (shape 1 0 3) + (0) (-15178) (-19672) w195 w113 w89 + (by decide +kernel) w195_sound w113_sound w89_sound) (by decide +kernel) +lemma B1_3_4Raw_1_1_2 : (B1_3_4Raw (shape 1 1 2)).Encloses (splitWeight positiveSecond tablep (shape 1 3 4) (shape 1 1 2) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveSecond tablep (shape 1 3 4) (shape 1 1 2) + (0) (0) (0) w195 w195 w195 + (by decide +kernel) w195_sound w195_sound w195_sound) (by decide +kernel) +lemma B1_3_4Raw_1_2_1 : (B1_3_4Raw (shape 1 2 1)).Encloses (splitWeight positiveSecond tablep (shape 1 3 4) (shape 1 2 1) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveSecond tablep (shape 1 3 4) (shape 1 2 1) + (0) (0) (-19672) w195 w195 w89 + (by decide +kernel) w195_sound w195_sound w89_sound) (by decide +kernel) +lemma B1_3_4Raw_1_3_0 : (B1_3_4Raw (shape 1 3 0)).Encloses (splitWeight positiveSecond tablep (shape 1 3 4) (shape 1 3 0) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveSecond tablep (shape 1 3 4) (shape 1 3 0) + (0) (-15178) (-62331) w195 w113 w18 + (by decide +kernel) w195_sound w113_sound w18_sound) (by decide +kernel) +lemma B1_3_4Raw_sound (u : Shape) (hu : u ∈ below (shape 1 3 4)) : + (B1_3_4Raw u).Encloses (splitWeight positiveSecond tablep (shape 1 3 4) u : ℝ) := by + rw [B1_3_4_below] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl + · exact B1_3_4Raw_0_0_4 + · exact B1_3_4Raw_0_1_3 + · exact B1_3_4Raw_0_2_2 + · exact B1_3_4Raw_0_3_1 + · exact B1_3_4Raw_1_0_3 + · exact B1_3_4Raw_1_1_2 + · exact B1_3_4Raw_1_2_1 + · exact B1_3_4Raw_1_3_0 +def B1_3_4Den : Ball := ⟨(5854659980349030826099773707151 / 2500000000000000000000000000000), (7 / 12500000000000000000000000000000)⟩ +lemma B1_3_4Den_sound : B1_3_4Den.Encloses (((below (shape 1 3 4)).map (splitWeight positiveSecond tablep (shape 1 3 4))).sum : ℝ) := by + exact contains_sound (list_cast_enclosed (below (shape 1 3 4)) B1_3_4Raw (splitWeight positiveSecond tablep (shape 1 3 4)) B1_3_4Raw_sound) (by decide +kernel) +lemma B1_3_4Den_positive : 0 < B1_3_4Den.lower := by decide +kernel +def B1_3_4Table (s : Shape) : Ball := + match s 0, s 1, s 2 with + | 0, 0, 4 => ⟨(18376602916823826473515371739 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 0, 1, 3 => ⟨(1492912089080617619303408645301 / 25000000000000000000000000000000), (1 / 10000000000000000000000000000000)⟩ + | 0, 2, 2 => ⟨(21350514021234075570262898364063 / 50000000000000000000000000000000), (11 / 100000000000000000000000000000000)⟩ + | 0, 3, 1 => ⟨(1308946998292554555787053318931 / 100000000000000000000000000000000), (1 / 20000000000000000000000000000000)⟩ + | 1, 0, 3 => ⟨(1308946998292554555787053318931 / 100000000000000000000000000000000), (1 / 20000000000000000000000000000000)⟩ + | 1, 1, 2 => ⟨(21350514021234075570262898364063 / 50000000000000000000000000000000), (11 / 100000000000000000000000000000000)⟩ + | 1, 2, 1 => ⟨(1492912089080617619303408645301 / 25000000000000000000000000000000), (1 / 10000000000000000000000000000000)⟩ + | 1, 3, 0 => ⟨(18376602916823826473515371739 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | _, _, _ => (.exact 0) +def B1_3_4Law (u : Shape) : Ball := if u ∈ below (shape 1 3 4) then B1_3_4Table u else .exact 0 +lemma B1_3_4Law_check_0_0_4 : contains (.mul (B1_3_4Raw (shape 0 0 4)) (.inv B1_3_4Den)) (B1_3_4Table (shape 0 0 4)) = true := by decide +kernel +lemma B1_3_4Law_check_0_1_3 : contains (.mul (B1_3_4Raw (shape 0 1 3)) (.inv B1_3_4Den)) (B1_3_4Table (shape 0 1 3)) = true := by decide +kernel +lemma B1_3_4Law_check_0_2_2 : contains (.mul (B1_3_4Raw (shape 0 2 2)) (.inv B1_3_4Den)) (B1_3_4Table (shape 0 2 2)) = true := by decide +kernel +lemma B1_3_4Law_check_0_3_1 : contains (.mul (B1_3_4Raw (shape 0 3 1)) (.inv B1_3_4Den)) (B1_3_4Table (shape 0 3 1)) = true := by decide +kernel +lemma B1_3_4Law_check_1_0_3 : contains (.mul (B1_3_4Raw (shape 1 0 3)) (.inv B1_3_4Den)) (B1_3_4Table (shape 1 0 3)) = true := by decide +kernel +lemma B1_3_4Law_check_1_1_2 : contains (.mul (B1_3_4Raw (shape 1 1 2)) (.inv B1_3_4Den)) (B1_3_4Table (shape 1 1 2)) = true := by decide +kernel +lemma B1_3_4Law_check_1_2_1 : contains (.mul (B1_3_4Raw (shape 1 2 1)) (.inv B1_3_4Den)) (B1_3_4Table (shape 1 2 1)) = true := by decide +kernel +lemma B1_3_4Law_check_1_3_0 : contains (.mul (B1_3_4Raw (shape 1 3 0)) (.inv B1_3_4Den)) (B1_3_4Table (shape 1 3 0)) = true := by decide +kernel +lemma B1_3_4Law_check (u : Shape) (hu : u ∈ below (shape 1 3 4)) : + contains (.mul (B1_3_4Raw u) (.inv B1_3_4Den)) (B1_3_4Table u) = true := by + rw [B1_3_4_below] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl + · exact B1_3_4Law_check_0_0_4 + · exact B1_3_4Law_check_0_1_3 + · exact B1_3_4Law_check_0_2_2 + · exact B1_3_4Law_check_0_3_1 + · exact B1_3_4Law_check_1_0_3 + · exact B1_3_4Law_check_1_1_2 + · exact B1_3_4Law_check_1_2_1 + · exact B1_3_4Law_check_1_3_0 +lemma B1_3_4Law_sound (u : Shape) : + (B1_3_4Law u).Encloses (stageBLaw (shape 1 3 4) u : ℝ) := by + by_cases hu : u ∈ below (shape 1 3 4) + · have h := contains_sound (Ball.mul_sound (B1_3_4Raw_sound u hu) + (Ball.inv_sound B1_3_4Den_sound B1_3_4Den_positive)) (B1_3_4Law_check u hu) + simpa only [B1_3_4Law, hu, ite_true, stageBLaw, splitLaw, + Rat.cast_div, Rat.cast_mul, Rat.cast_inv, div_eq_mul_inv] using h + · simp only [B1_3_4Law, hu, ite_false, stageBLaw, splitLaw, Rat.cast_zero] + simpa only [Rat.cast_zero] using Ball.exact_sound 0 + +end MatrixMultiplication.NativeNumerics + +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/Certificates/SplitB2_3_3.lean b/lean/OAI/LinearAlgebra/MatrixFields/Certificates/SplitB2_3_3.lean new file mode 100644 index 0000000000000000000000000000000000000000..92ff8a339a155c7d2c5bc013f78514a9907d6e05 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/Certificates/SplitB2_3_3.lean @@ -0,0 +1,1082 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Certificates.SplitB1_1_6 + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate +open scoped BigOperators +def w75Trace : List Ball := [ + ⟨(47984258318792228626159664919199 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(19594086816114424047050644770849 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(24660582253072658137870913071147 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(16496609814208595972252098607689 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1033152202053892432652296834613 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(827651481193121167860980029509 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(69038300610111366614256425569 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(19739676030769274857254866359 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(123443269137990780785423429 / 5000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(54888687236522687833244959 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(857955693533921141667981 / 3125000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(249664716647421917817563 / 10000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(208108677277100834254701 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(8005985438398001669499 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(285983961273458447111 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(38137480912985211927 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w75S0 : Ball := ⟨(46049780928091623904274937075729 / 50000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +def w75S1 : Ball := ⟨(42411646470504621252465323699529 / 50000000000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ +def w75S2 : Ball := ⟨(71949910253562683888874819678621 / 100000000000000000000000000000000), (11 / 100000000000000000000000000000000)⟩ +def w75S3 : Ball := ⟨(10353579170991449269240042430431 / 20000000000000000000000000000000), (17 / 100000000000000000000000000000000)⟩ +def w75S4 : Ball := ⟨(13399575206248498238151727716091 / 50000000000000000000000000000000), (19 / 100000000000000000000000000000000)⟩ +def w75S5 : Ball := ⟨(3590972314158189681948137986311 / 50000000000000000000000000000000), (11 / 100000000000000000000000000000000)⟩ +abbrev w75 : Ball := w75S5 +lemma w75_sound : w75.Encloses (weight (-26336) : ℝ) := by + exact weight_enclosed_of_trace (-26336) w75Trace w75S0 w75S1 w75S2 w75S3 w75S4 w75S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def w76Trace : List Ball := [ + ⟨(95970316064140983210748773189317 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(24492836565014537542934063581113 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(49321470656540947047895351479673 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(8248343333342081168268026382941 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(826524844163522042877928099851 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(827654054983897943218992065923 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(138076969443802221287737849221 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(123373263195056617710232437 / 625000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2468870507479895121205407599 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(27444394903716851602494773 / 10000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(6863657211307646258170261 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2496651056199498431880271 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(208108976621752210908723 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(400299806673015580233 / 2500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1143937271563382831119 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(38137525720585203059 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w76S0 : Ball := ⟨(92103015654511168586865744464237 / 100000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +def w76S1 : Ball := ⟨(42414827463275646922160593678481 / 50000000000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ +def w76S2 : Ball := ⟨(71960703549577681986294925013061 / 100000000000000000000000000000000), (11 / 100000000000000000000000000000000)⟩ +def w76S3 : Ball := ⟨(25891714276751009998620334379867 / 50000000000000000000000000000000), (17 / 100000000000000000000000000000000)⟩ +def w76S4 : Ball := ⟨(26815234727556483071278308798089 / 100000000000000000000000000000000), (9 / 50000000000000000000000000000000)⟩ +def w76S5 : Ball := ⟨(7190568134939512128851691181373 / 100000000000000000000000000000000), (1 / 10000000000000000000000000000000)⟩ +abbrev w76 : Ball := w76S5 +lemma w76_sound : w76.Encloses (weight (-26324) : ℝ) := by + exact weight_enclosed_of_trace (-26324) w76Trace w76S0 w76S1 w76S2 w76S3 w76S4 w76S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def w77Trace : List Ball := [ + ⟨(599998196714862947566973881793 / 625000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(97986246800292183448479581460381 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(49326471517644006160941054246641 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(16497942005045776829367930272113 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(516609496695927242188415170097 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(827696095511297713639811534369 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(13808298400577145605687198933 / 10000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1974047478548518878179790713 / 10000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2468954213953520833885185813 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(274452325908372929454327427 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(27455390850850632486117941 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(3994743343941532548757 / 160000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(52028466507740566638613 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(8006170823254418097359 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1143960571041724548049 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(38138257578051724877 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w77S0 : Ball := ⟨(46079723015819183918833007400189 / 50000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ +def w77S1 : Ball := ⟨(84933634928584649055280220334927 / 100000000000000000000000000000000), (1 / 20000000000000000000000000000000)⟩ +def w77S2 : Ball := ⟨(144274446843641886080573649277 / 200000000000000000000000000000), (9 / 100000000000000000000000000000000)⟩ +def w77S3 : Ball := ⟨(13009447507524280115669613233039 / 25000000000000000000000000000000), (7 / 50000000000000000000000000000000)⟩ +def w77S4 : Ball := ⟨(13539657956082376346944825012809 / 50000000000000000000000000000000), (3 / 20000000000000000000000000000000)⟩ +def w77S5 : Ball := ⟨(3666446751354095861172044368359 / 50000000000000000000000000000000), (9 / 100000000000000000000000000000000)⟩ +abbrev w77 : Ball := w77S5 +lemma w77_sound : w77.Encloses (weight (-26128) : ℝ) := by + exact weight_enclosed_of_trace (-26128) w77Trace w77S0 w77S1 w77S2 w77S3 w77S4 w77S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def w78Trace : List Ball := [ + ⟨(96020413644037189957217964757881 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(97996739815936838298595712002941 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(6166249123703460412171721422267 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(3299765191521990686269998599407 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1033263310853178824573597042751 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(827725697673292641718285387623 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(8630451188981441500650936069 / 6250000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(19741004760251170535717719993 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1234506576605411116565446387 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(274458224188575312948449869 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(137279636941419755551929 / 500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2496759324711092996913137 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(20811730870221175755781 / 10000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(16012587646799100805929 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(285994244078576643097 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(9534693216362905723 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w78S0 : Ball := ⟨(2304979959093000837221736165533 / 2500000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +def w78S1 : Ball := ⟨(85006921789125949007060725715233 / 100000000000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ +def w78S2 : Ball := ⟨(18065441880156440088265606256123 / 25000000000000000000000000000000), (11 / 100000000000000000000000000000000)⟩ +def w78S3 : Ball := ⟨(2610881522602482024356425865177 / 5000000000000000000000000000000), (1 / 6250000000000000000000000000000)⟩ +def w78S4 : Ball := ⟨(13633404650134109707643354112759 / 50000000000000000000000000000000), (9 / 50000000000000000000000000000000)⟩ +def w78S5 : Ball := ⟨(3717394447085967326472161488373 / 50000000000000000000000000000000), (1 / 10000000000000000000000000000000)⟩ +abbrev w78 : Ball := w78S5 +lemma w78_sound : w78.Encloses (weight (-25990) : ℝ) := by + exact weight_enclosed_of_trace (-25990) w78Trace w78S0 w78S1 w78S2 w78S3 w78S4 w78S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def w79Trace : List Ball := [ + ⟨(96033917464170982234492905488421 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(98003583896933257526044034262951 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(49332289805510238738680234429009 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(8249701244661142997000964583671 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4133168861019445193259922763239 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(827745004410105906575911127179 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(138089981114500120646726329691 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(3948270081921325675552416113 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2469051593222249070682669387 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(274462071017293295381976047 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(219650218514900735722679 / 800000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(249678850034406022480171 / 10000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(104059776989796481278781 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(640509923422914949969 / 4000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1143987675644561548541 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1906955446122577819 / 2500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w79S0 : Ball := ⟨(92225133035152043788862331940617 / 100000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +def w79S1 : Ball := ⟨(21263687908378732071337427865903 / 25000000000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ +def w79S2 : Ball := ⟨(14468621550877820723055435346621 / 20000000000000000000000000000000), (11 / 100000000000000000000000000000000)⟩ +def w79S3 : Ball := ⟨(52335252395631528540510869155833 / 100000000000000000000000000000000), (17 / 100000000000000000000000000000000)⟩ +def w79S4 : Ball := ⟨(13694893216572278235749817336601 / 50000000000000000000000000000000), (19 / 100000000000000000000000000000000)⟩ +def w79S5 : Ball := ⟨(1500400801706539210505573972893 / 20000000000000000000000000000000), (11 / 100000000000000000000000000000000)⟩ +abbrev w79 : Ball := w79S5 +lemma w79_sound : w79.Encloses (weight (-25900) : ℝ) := by + exact weight_enclosed_of_trace (-25900) w79Trace w79S0 w79S1 w79S2 w79S3 w79S4 w79S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def w80Trace : List Ball := [ + ⟨(96160345234366537310172583727337 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(49033822531834466467586128472029 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(6169223198439036043827098909543 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(16504797828722781371428429369449 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(258390674345734368645921138507 / 6250000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(827925667106182924911573483711 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4316119584284786033809441793 / 3125000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(19744584673017436206860921403 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(493882254621591829415140877 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(10979922599558540121080343 / 4000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(27459551463526947046107233 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2497061485103516167613351 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(13008785123562470894501 / 6250000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(16014249224843623084609 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(572043891490034509171 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(38142252922384267457 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w80S0 : Ball := ⟨(92468119955925592233308091322847 / 100000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +def w80S1 : Ball := ⟨(42751766040917223746718772954043 / 50000000000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ +def w80S2 : Ball := ⟨(9138567498086615758264738487079 / 12500000000000000000000000000000), (11 / 100000000000000000000000000000000)⟩ +def w80S3 : Ball := ⟨(26724293093467221731389769703859 / 50000000000000000000000000000000), (17 / 100000000000000000000000000000000)⟩ +def w80S4 : Ball := ⟨(28567513653821593905095061748867 / 100000000000000000000000000000000), (19 / 100000000000000000000000000000000)⟩ +def w80S5 : Ball := ⟨(4080514181806415973058622710461 / 50000000000000000000000000000000), (3 / 25000000000000000000000000000000)⟩ +abbrev w80 : Ball := w80S5 +lemma w80_sound : w80.Encloses (weight (-25058) : ℝ) := by + exact weight_enclosed_of_trace (-25058) w80Trace w80S0 w80S1 w80S2 w80S3 w80S4 w80S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def w81Trace : List Ball := [ + ⟨(24053124077025220365733558709167 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(24523515466952327543625204408287 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(771291381243450214681389812979 / 1562500000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(16507022146747570177260056670303 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4134696804994607794918473460099 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(828000140428055437612547132979 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(138126480489573601282957720321 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4936479458154102098214842413 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1234779764845555446327872631 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(5490258022157201479199239 / 2000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(3432612624333560165468793 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2497174001988667817428023 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(41629844162701618302781 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(16014867941833794587233 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(572064521715122977261 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(762870972176346887 / 1000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w81S0 : Ball := ⟨(9256844445836325745624221593209 / 10000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +def w81S1 : Ball := ⟨(17137833818882166538176711635577 / 20000000000000000000000000000000), (7 / 100000000000000000000000000000000)⟩ +def w81S2 : Ball := ⟨(36713168500452663023365486407191 / 50000000000000000000000000000000), (13 / 100000000000000000000000000000000)⟩ +def w81S3 : Ball := ⟨(26957134826852592754025559658321 / 50000000000000000000000000000000), (1 / 5000000000000000000000000000000)⟩ +def w81S4 : Ball := ⟨(14533742361462179318412044926463 / 50000000000000000000000000000000), (11 / 50000000000000000000000000000000)⟩ +def w81S5 : Ball := ⟨(2112296670293602445979800989231 / 25000000000000000000000000000000), (7 / 50000000000000000000000000000000)⟩ +abbrev w81 : Ball := w81S5 +lemma w81_sound : w81.Encloses (weight (-24711) : ℝ) := by + exact weight_enclosed_of_trace (-24711) w81Trace w81S0 w81S1 w81S2 w81S3 w81S4 w81S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def w82Trace : List Ball := [ + ⟨(96229334968294592402883395225639 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(98102590361049671212432499515887 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4936550952998944770288224358031 / 10000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(16507740184834890449016793715247 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4134840781021048794500536156301 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(828024180381130866552442238883 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(69064959742460643517425514209 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(19746348166155745623164791301 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(246960738538238196158161981 / 10000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(54903538004494867068294717 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(686533415104400136005273 / 2500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2497210320676715960067309 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(104076007869665172573223 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(16015067652522971389869 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1144142361524112935289 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(19071983406541964123 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w82S0 : Ball := ⟨(92600849084402444230562752811101 / 100000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +def w82S1 : Ball := ⟨(42874586255761384969871489541317 / 50000000000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ +def w82S2 : Ball := ⟨(9191150733013615280768056081407 / 12500000000000000000000000000000), (11 / 100000000000000000000000000000000)⟩ +def w82S3 : Ball := ⟨(54065441150065099190158607543737 / 100000000000000000000000000000000), (17 / 100000000000000000000000000000000)⟩ +def w82S4 : Ball := ⟨(29230719267511525553688699485483 / 100000000000000000000000000000000), (19 / 100000000000000000000000000000000)⟩ +def w82S5 : Ball := ⟨(854434948896069537004803880333 / 10000000000000000000000000000000), (3 / 25000000000000000000000000000000)⟩ +abbrev w82 : Ball := w82S5 +lemma w82_sound : w82.Encloses (weight (-24599) : ℝ) := by + exact weight_enclosed_of_trace (-24599) w82Trace w82S0 w82S1 w82S2 w82S3 w82S4 w82S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def w83Trace : List Ball := [ + ⟨(96363397544038665735902571610653 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(3926818916509623635941208316487 / 4000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(24694139865151464166961931335581 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(3302690843648775656223451075217 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(165439458394777402989072424451 / 4000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(828215469471411289079967751411 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(138157283264303539824277561599 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(19749772217589986559441937981 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2469988154003164107287514353 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(274555792962808879841926837 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1373240124245016613661353 / 5000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(249749928356493009833667 / 10000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(208174252856197851689973 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(8008328294019073421673 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(572124161072620294193 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(15258917510953307911 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w83S0 : Ball := ⟨(92859043862304371552962231385777 / 100000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ +def w83S1 : Ball := ⟨(1347312816722088621534034756657 / 1562500000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ +def w83S2 : Ball := ⟨(2974108591888151944695921365837 / 4000000000000000000000000000000), (1 / 12500000000000000000000000000000)⟩ +def w83S3 : Ball := ⟨(55283261977143287121598794440373 / 100000000000000000000000000000000), (13 / 100000000000000000000000000000000)⟩ +def w83S4 : Ball := ⟨(15281195274167283537457866737341 / 50000000000000000000000000000000), (3 / 20000000000000000000000000000000)⟩ +def w83S5 : Ball := ⟨(4670298580144650397601325882069 / 50000000000000000000000000000000), (1 / 10000000000000000000000000000000)⟩ +abbrev w83 : Ball := w83S5 +lemma w83_sound : w83.Encloses (weight (-23708) : ℝ) := by + exact weight_enclosed_of_trace (-23708) w83Trace w83S0 w83S1 w83S2 w83S3 w83S4 w83S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def w84Trace : List Ball := [ + ⟨(24210167749691597416637228086919 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(49205941808369283885152732830901 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(12367303675743656027992090631347 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(16533757913766210860520197787981 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4140056549026171319660278514497 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(207223733207400735959413236017 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(69127234556299262076205809641 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4940483023773890676353700819 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(308917535965262589025470907 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(274691091182850470986593179 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(3434638594406446175333449 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2498525259902930007272721 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(3253956313268699616709 / 1562500000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(16022297813194644531479 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(572312253510679535303 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(3815910057998093299 / 5000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w84S0 : Ball := ⟨(93781155594913136951136476465931 / 100000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +def w84S1 : Ball := ⟨(87949051447173075698231551682523 / 100000000000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ +def w84S2 : Ball := ⟨(7735035650457496480785014326887 / 10000000000000000000000000000000), (11 / 100000000000000000000000000000000)⟩ +def w84S3 : Ball := ⟨(29915388256924212838726277319197 / 50000000000000000000000000000000), (9 / 50000000000000000000000000000000)⟩ +def w84S4 : Ball := ⟨(7159443636500152746721657331183 / 20000000000000000000000000000000), (11 / 50000000000000000000000000000000)⟩ +def w84S5 : Ball := ⟨(12814408296055632823834682914069 / 100000000000000000000000000000000), (17 / 100000000000000000000000000000000)⟩ +abbrev w84 : Ball := w84S5 +lemma w84_sound : w84.Encloses (weight (-20546) : ℝ) := by + exact weight_enclosed_of_trace (-20546) w84Trace w84S0 w84S1 w84S2 w84S3 w84S4 w84S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def w85Trace : List Ball := [ + ⟨(48440010256844336590814135237133 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(98431769261522683809420629817117 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(9895175713551043694871309445383 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(16535429194353750192832977165253 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4140391515343909260256397560133 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(207237711310321651663366708339 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(27652493137236567831160011689 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(9881466275556340066470755307 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2471451528176236203088134939 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(68675555417481657434871667 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(27478121106016816676297721 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1249304828458230918025801 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(208259698399606947170941 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(320455236722258974211 / 2000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(228931089949188295959 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(19080035705657037089 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w85S0 : Ball := ⟨(93857383747327381270952739073263 / 100000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ +def w85S1 : Ball := ⟨(44046042419465370295839454047483 / 50000000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ +def w85S2 : Ball := ⟨(77602154112693712445735636555629 / 100000000000000000000000000000000), (1 / 12500000000000000000000000000000)⟩ +def w85S3 : Ball := ⟨(60220943229302656687912598473581 / 100000000000000000000000000000000), (13 / 100000000000000000000000000000000)⟩ +def w85S4 : Ball := ⟨(7253124006853786977764830254907 / 20000000000000000000000000000000), (1 / 6250000000000000000000000000000)⟩ +def w85S5 : Ball := ⟨(13151951964699683421400377323041 / 100000000000000000000000000000000), (3 / 25000000000000000000000000000000)⟩ +abbrev w85 : Ball := w85S5 +lemma w85_sound : w85.Encloses (weight (-20286) : ℝ) := by + exact weight_enclosed_of_trace (-20286) w85Trace w85S0 w85S1 w85S2 w85S3 w85S4 w85S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def w86Trace : List Ball := [ + ⟨(48440237319924594227230822566221 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(19686399748523585161411498449313 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(24737977733188568838022111181733 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(8267724239970218590240538563861 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(414039538060379979089766331039 / 10000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(414475745211132487604450722699 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(138262557959066666648740732559 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(19762944095361743020993938333 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(61786320294314055196830061 / 2500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(137351175051705579757728777 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(13739066393693193474190419 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2498610630758880376322443 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(208259773336614936497137 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(16022767190369970358269 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1144655806786585530693 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(38160082613214071961 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w86S0 : Ball := ⟨(93858263664424617413741271563347 / 100000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +def w86S1 : Ball := ⟨(17618747316201300822493376772181 / 20000000000000000000000000000000), (7 / 100000000000000000000000000000000)⟩ +def w86S2 : Ball := ⟨(19401266062009408781754254430401 / 25000000000000000000000000000000), (13 / 100000000000000000000000000000000)⟩ +def w86S3 : Ball := ⟨(60225459969420491584042760181517 / 100000000000000000000000000000000), (21 / 100000000000000000000000000000000)⟩ +def w86S4 : Ball := ⟨(36271060285282700790853141181647 / 100000000000000000000000000000000), (13 / 50000000000000000000000000000000)⟩ +def w86S5 : Ball := ⟨(6577949071093059980401914202497 / 50000000000000000000000000000000), (1 / 5000000000000000000000000000000)⟩ +abbrev w86 : Ball := w86S5 +lemma w86_sound : w86.Encloses (weight (-20283) : ℝ) := by + exact weight_enclosed_of_trace (-20283) w86Trace w86S0 w86S1 w86S2 w86S3 w86S4 w86S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def w87Trace : List Ball := [ + ⟨(19391935301940079203102230297813 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(98472015880149116906521409261053 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(49489364205696618412262048225019 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(8269405575763264578752255465279 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1035267329069939345442556567683 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(165812796028562169369654386621 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(69139322923441076681156279 / 50000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(3952991365225817176202953127 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2471676603749162391141836633 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(274724742010292067637962653 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(13740084689341520447134237 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2498780414667198649031423 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(208272838120590395912151 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(801185033345091303563 / 5000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(572359027041109767321 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(38162035477780352119 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w87S0 : Ball := ⟨(47005894344328733846328990719511 / 50000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +def w87S1 : Ball := ⟨(22095541031101960472317826059927 / 25000000000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ +def w87S2 : Ball := ⟨(15622813870627529169929207254323 / 20000000000000000000000000000000), (11 / 100000000000000000000000000000000)⟩ +def w87S3 : Ball := ⟨(61018078309067979934998251220249 / 100000000000000000000000000000000), (9 / 50000000000000000000000000000000)⟩ +def w87S4 : Ball := ⟨(1861602940265776154737666333371 / 5000000000000000000000000000000), (23 / 100000000000000000000000000000000)⟩ +def w87S5 : Ball := ⟨(433195688400772867769213264289 / 3125000000000000000000000000000), (9 / 50000000000000000000000000000000)⟩ +abbrev w87 : Ball := w87S5 +lemma w87_sound : w87.Encloses (weight (-19760) : ℝ) := by + exact weight_enclosed_of_trace (-19760) w87Trace w87S0 w87S1 w87S2 w87S3 w87S4 w87S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def w88Trace : List Ball := [ + ⟨(96960434010132110258392349835097 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(49236199279054655394302609606119 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(49489492422679883335492771661221 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1653884330472663453731339594121 / 10000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4141075760142777159508644104883 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(207266263924187352330225759829 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(138278799666601435988630127619 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(19764976070056687226808768043 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2471678743427921414366041553 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(274724956098081315769931321 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(27480188850299067760607327 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2498782037943135957883823 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(41654592606054047660727 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(250370462369400905323 / 1562500000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1144718649211453383 / 100000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(38162054147613681757 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w88S0 : Ball := ⟨(94013257634331836160818084228699 / 100000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +def w88S1 : Ball := ⟨(22096231527548133187286615332089 / 25000000000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ +def w88S2 : Ball := ⟨(78118951635041937177141673690089 / 100000000000000000000000000000000), (11 / 100000000000000000000000000000000)⟩ +def w88S3 : Ball := ⟨(61025706045580213498506794278049 / 100000000000000000000000000000000), (9 / 50000000000000000000000000000000)⟩ +def w88S4 : Ball := ⟨(37241367983615654188317699957989 / 100000000000000000000000000000000), (23 / 100000000000000000000000000000000)⟩ +def w88S5 : Ball := ⟨(13869194892910730966442083177749 / 100000000000000000000000000000000), (9 / 50000000000000000000000000000000)⟩ +abbrev w88 : Ball := w88S5 +lemma w88_sound : w88.Encloses (weight (-19755) : ℝ) := by + exact weight_enclosed_of_trace (-19755) w88Trace w88S0 w88S1 w88S2 w88S3 w88S4 w88S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def w89Trace : List Ball := [ + ⟨(9697300938183443281718467403369 / 10000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(3077460978208181357071295207717 / 3125000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(49491620897541978811502345768401 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(16539377062481372541607295049991 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4141182730713106955977929782043 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(414541455120938766795231958089 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(138281353117716136408927764313 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(988264776206185408639486907 / 5000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(308964282822826746854541281 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(27472850999971318076709173 / 10000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(27480512082821496819242353 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(624702246152044191256333 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(208275036551284667909853 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2002982217959828719999 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1144728528441963054903 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(76324728133693907503 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w89S0 : Ball := ⟨(94037645485693489259790235842833 / 100000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +def w89S1 : Ball := ⟨(2763462115154052837357843579581 / 3125000000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ +def w89S2 : Ball := ⟨(39100021052885563312727281342639 / 50000000000000000000000000000000), (11 / 100000000000000000000000000000000)⟩ +def w89S3 : Ball := ⟨(61152465853443771001832613697787 / 100000000000000000000000000000000), (9 / 50000000000000000000000000000000)⟩ +def w89S4 : Ball := ⟨(18698120399783031998407189759267 / 50000000000000000000000000000000), (23 / 100000000000000000000000000000000)⟩ +def w89S5 : Ball := ⟨(6992394129695647447331751196051 / 50000000000000000000000000000000), (9 / 50000000000000000000000000000000)⟩ +abbrev w89 : Ball := w89S5 +lemma w89_sound : w89.Encloses (weight (-19672) : ℝ) := by + exact weight_enclosed_of_trace (-19672) w89Trace w89S0 w89S1 w89S2 w89S3 w89S4 w89S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def w90Trace : List Ball := [ + ⟨(3033651761574679389787877273637 / 3125000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(98531201503690214206787456465689 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(49509192481079839240323793224789 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(8271891612916808505629439514799 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(517758217024488988919945803207 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(414615144606389724457369627821 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(69151214966937536943703842699 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(988396616655716018717991873 / 5000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2472007437695969511145348087 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(137378921792985054360320521 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(27483179990984915740062999 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2499031396251326907692907 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(41658430161908470847153 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(3205016108376539274821 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1144810067989027449513 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(76329843668026228377 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w90S0 : Ball := ⟨(47119580213786395683896601683397 / 50000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +def w90S1 : Ball := ⟨(88810193580938015775306569960381 / 100000000000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ +def w90S2 : Ball := ⟨(19718126209709209853932550994123 / 25000000000000000000000000000000), (11 / 100000000000000000000000000000000)⟩ +def w90S3 : Ball := ⟨(62208720195523406479763195130849 / 100000000000000000000000000000000), (9 / 50000000000000000000000000000000)⟩ +def w90S4 : Ball := ⟨(19349624341824608662604755129257 / 50000000000000000000000000000000), (23 / 100000000000000000000000000000000)⟩ +def w90S5 : Ball := ⟨(14976318486789256799246113282771 / 100000000000000000000000000000000), (9 / 50000000000000000000000000000000)⟩ +abbrev w90 : Ball := w90S5 +lemma w90_sound : w90.Encloses (weight (-18987) : ℝ) := by + exact weight_enclosed_of_trace (-18987) w90Trace w90S0 w90S1 w90S2 w90S3 w90S4 w90S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def w91Trace : List Ball := [ + ⟨(9713754836989542857582642394109 / 10000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(49280923313792589214803052609417 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(49519457596464507723252416201987 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(16546357037860604568701438141087 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2071290752565764854407549802839 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(829316370715427612040830636059 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4322335630177781559695160353 / 3125000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(19769472364982113645666587387 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1236089331902557687410468901 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(274774975322185489960800229 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(27484738113250476217501279 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2499161288570788101138749 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(208302145745177644296317 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4006448666300924265639 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1144857687387271941409 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(76332830841358970493 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w91S0 : Ball := ⟨(94357033033137740333524498717863 / 100000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +def w91S1 : Ball := ⟨(44516248414083233587448570490359 / 50000000000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ +def w91S2 : Ball := ⟨(19816963728643680095065048406261 / 25000000000000000000000000000000), (11 / 100000000000000000000000000000000)⟩ +def w91S3 : Ball := ⟨(31416964113790338254167490895973 / 50000000000000000000000000000000), (9 / 50000000000000000000000000000000)⟩ +def w91S4 : Ball := ⟨(39481025365087597356249876115843 / 100000000000000000000000000000000), (23 / 100000000000000000000000000000000)⟩ +def w91S5 : Ball := ⟨(7793756819393451250565121368561 / 50000000000000000000000000000000), (19 / 100000000000000000000000000000000)⟩ +abbrev w91 : Ball := w91S5 +lemma w91_sound : w91.Encloses (weight (-18587) : ℝ) := by + exact weight_enclosed_of_trace (-18587) w91Trace w91S0 w91S1 w91S2 w91S3 w91S4 w91S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def w92Trace : List Ball := [ + ⟨(48569305408820487411955351992481 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(98562383030666098638167354662233 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(49519637264461618491544295811141 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(16546402085283324295567851499991 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2071295266020966563596386078371 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(103664734659778426152398320449 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(34578738902957365891468415427 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(19769499317439838898264014857 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1236090830226090360856921151 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(13738763757243379145431953 / 5000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(5496953076366492086521471 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2499163561797381096231273 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(104151160332241658108731 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(16025807162890801279287 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(114485852075998519199 / 10000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1908322077922307337 / 2500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w92S0 : Ball := ⟨(94359097115811162154161248094363 / 100000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +def w92S1 : Ball := ⟨(22259098021277705950466714011629 / 25000000000000000000000000000000), (7 / 100000000000000000000000000000000)⟩ +def w92S2 : Ball := ⟨(19818697788833963375439369454407 / 25000000000000000000000000000000), (13 / 100000000000000000000000000000000)⟩ +def w92S3 : Ball := ⟨(62844925127221156664461117564787 / 100000000000000000000000000000000), (11 / 50000000000000000000000000000000)⟩ +def w92S4 : Ball := ⟨(19747423071230165570839204502969 / 50000000000000000000000000000000), (7 / 25000000000000000000000000000000)⟩ +def w92S5 : Ball := ⟨(15598428718166136993941318394257 / 100000000000000000000000000000000), (23 / 100000000000000000000000000000000)⟩ +abbrev w92 : Ball := w92S5 +lemma w92_sound : w92.Encloses (weight (-18580) : ℝ) := by + exact weight_enclosed_of_trace (-18580) w92Trace w92S0 w92S1 w92S2 w92S3 w92S4 w92S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def w93Trace : List Ball := [ + ⟨(48569988419480206395539855162043 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2464076817437585231959756330549 / 2500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(49519868267611763600788214848167 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(8273230001843500497968404964011 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(82852042762356393589045622457 / 2000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(829319814294441431113389049751 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(69157616307436794485066541717 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(19769533970695813257429082497 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(618046378323433416937697223 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(68693915158011876404026391 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(27484800441510773897974389 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(499833296904579429573803 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(208302545561134401333541 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(3205164646274477556173 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(143107449030108528467 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(76332950328292280177 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w93S0 : Ball := ⟨(47180875501368827154028631902581 / 50000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ +def w93S1 : Ball := ⟨(5565087532689162942680905245599 / 6250000000000000000000000000000), (1 / 20000000000000000000000000000000)⟩ +def w93S2 : Ball := ⟨(39641855035510214686892567596899 / 50000000000000000000000000000000), (1 / 10000000000000000000000000000000)⟩ +def w93S3 : Ball := ⟨(31429533413128131290686129552343 / 50000000000000000000000000000000), (17 / 100000000000000000000000000000000)⟩ +def w93S4 : Ball := ⟨(39512622822677505677310298661987 / 100000000000000000000000000000000), (11 / 50000000000000000000000000000000)⟩ +def w93S5 : Ball := ⟨(15612473623271752962591099629173 / 100000000000000000000000000000000), (9 / 50000000000000000000000000000000)⟩ +abbrev w93 : Ball := w93S5 +lemma w93_sound : w93.Encloses (weight (-18571) : ℝ) := by + exact weight_enclosed_of_trace (-18571) w93Trace w93S0 w93S1 w93S2 w93S3 w93S4 w93S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def w94Trace : List Ball := [ + ⟨(48572416979614677817617190289831 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(19713104979699146593127961907507 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(49520689625261929013998699820783 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4136666484604960233033498499099 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2071321702302402235851731726993 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(414663350763034812461569019783 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(69158108761226964305652624489 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(19769657183147665874833030001 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(61804980309337414107116751 / 2500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(68694257815274562343070847 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(13742462549404514216124779 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(124958843824348187596329 / 5000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(20830334519732457901309 / 10000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(8012940181997489038433 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1144863401965983840387 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(38166594651079449773 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w94S0 : Ball := ⟨(5898199228103900652428663966829 / 6250000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +def w94S1 : Ball := ⟨(8905921058407795066853805981189 / 10000000000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ +def w94S2 : Ball := ⟨(15863085979718284142129990761437 / 20000000000000000000000000000000), (11 / 100000000000000000000000000000000)⟩ +def w94S3 : Ball := ⟨(3931835887498981166397445803049 / 6250000000000000000000000000000), (9 / 50000000000000000000000000000000)⟩ +def w94S4 : Ball := ⟨(39575893622335746261007805520769 / 100000000000000000000000000000000), (3 / 12500000000000000000000000000000)⟩ +def w94S5 : Ball := ⟨(313250271201287039100674208231 / 2000000000000000000000000000000), (1 / 5000000000000000000000000000000)⟩ +abbrev w94 : Ball := w94S5 +lemma w94_sound : w94.Encloses (weight (-18539) : ℝ) := by + exact weight_enclosed_of_trace (-18539) w94Trace w94S0 w94S1 w94S2 w94S3 w94S4 w94S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def w95Trace : List Ball := [ + ⟨(24311456493171441392247102581529 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(12327062894994895069985855091793 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2476888154934925706815547527189 / 5000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(16550946449197211187254764013699 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(517937641129933890173000572753 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(414734924510606159250971639573 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(138336687913027273810542390043 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(9886109000543629018176101081 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1236241963658198205018555289 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(10992220698430343881729479 / 4000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(27487515867975722764640197 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(624848213137902096158637 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(52079990981881999513601 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(16027067737379137972801 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(572471289112259175847 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(38169077738912291657 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w95S0 : Ball := ⟨(23641876672774713557858358239331 / 25000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +def w95S1 : Ball := ⟨(89430133217710265658660394395847 / 100000000000000000000000000000000), (7 / 100000000000000000000000000000000)⟩ +def w95S2 : Ball := ⟨(39988743636687025370182115592353 / 50000000000000000000000000000000), (13 / 100000000000000000000000000000000)⟩ +def w95S3 : Ball := ⟨(63963984705627082531830129678749 / 100000000000000000000000000000000), (11 / 50000000000000000000000000000000)⟩ +def w95S4 : Ball := ⟨(40913913394216953319749034133611 / 100000000000000000000000000000000), (29 / 100000000000000000000000000000000)⟩ +def w95S5 : Ball := ⟨(2092435386536856772381940766823 / 12500000000000000000000000000000), (1 / 4000000000000000000000000000000)⟩ +abbrev w95 : Ball := w95S5 +lemma w95_sound : w95.Encloses (weight (-17874) : ℝ) := by + exact weight_enclosed_of_trace (-17874) w95Trace w95S0 w95S1 w95S2 w95S3 w95S4 w95S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def w96Trace : List Ball := [ + ⟨(19462084945085296406442948535709 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(98649101709384577877389230656831 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(49548679350900920308951365672987 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1655368304334981960405329642321 / 10000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4144049453996339049375721004777 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(103695169558496726647696312179 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(138349773272399157380263337543 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(3954770984622937308961577869 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1236332959461832311919408497 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(137411862870134171885457943 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(27489171857296129461899017 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2499530900421064933309269 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(208330586210581940821979 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(16027826671063748116097 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1144993184998254874729 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(19085332337372655453 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w96S0 : Ball := ⟨(47346593801214468105049886859177 / 50000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ +def w96S1 : Ball := ⟨(2241699944577200296107180376493 / 2500000000000000000000000000000), (1 / 20000000000000000000000000000000)⟩ +def w96S2 : Ball := ⟨(20100874566069691517014638071163 / 25000000000000000000000000000000), (1 / 10000000000000000000000000000000)⟩ +def w96S3 : Ball := ⟨(32323612665669392739172467697297 / 50000000000000000000000000000000), (17 / 100000000000000000000000000000000)⟩ +def w96S4 : Ball := ⟨(20896318715204455709379930471971 / 50000000000000000000000000000000), (23 / 100000000000000000000000000000000)⟩ +def w96S5 : Ball := ⟨(1091640339618509986394126716177 / 6250000000000000000000000000000), (1 / 5000000000000000000000000000000)⟩ +abbrev w96 : Ball := w96S5 +lemma w96_sound : w96.Encloses (weight (-17449) : ℝ) := by + exact weight_enclosed_of_trace (-17449) w96Trace w96S0 w96S1 w96S2 w96S3 w96S4 w96S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def w97Trace : List Ball := [ + ⟨(97327607614174323681650812201511 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(24664442877948097077519038287853 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(9910316479613191988362505573333 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(16554410777444949079371375480773 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1036048816074920048872092163297 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(829585689598023855220969579261 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(138353252803303299025888475217 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(19774290192361416262128792671 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2472714311340101807567223623 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(274828567369759156915001631 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(5497922437284722551520529 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(39055743863796662987237 / 1562500000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(104166705328757661689753 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4007007117357327296681 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(572503320577857178929 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(3817108661297856073 / 5000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w97S0 : Ball := ⟨(94726632038986837867671065921721 / 100000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +def w97S1 : Ball := ⟨(89731348174496076885890570441493 / 100000000000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ +def w97S2 : Ball := ⟨(80517148452126404298140869809749 / 100000000000000000000000000000000), (11 / 100000000000000000000000000000000)⟩ +def w97S3 : Ball := ⟨(12966022389723522847161549084413 / 20000000000000000000000000000000), (9 / 50000000000000000000000000000000)⟩ +def w97S4 : Ball := ⟨(21014717076351461774002853295901 / 50000000000000000000000000000000), (3 / 12500000000000000000000000000000)⟩ +def w97S5 : Ball := ⟨(17664733351963909170540862137551 / 100000000000000000000000000000000), (21 / 100000000000000000000000000000000)⟩ +abbrev w97 : Ball := w97S5 +lemma w97_sound : w97.Encloses (weight (-17336) : ℝ) := by + exact weight_enclosed_of_trace (-17336) w97Trace w97S0 w97S1 w97S2 w97S3 w97S4 w97S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def w98Trace : List Ball := [ + ⟨(97338253403438111493986638144823 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(49331571348303273596911606258353 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(19821352349630714605656063693 / 40000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(16554861611887908661548597891817 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2072142796779946810945326534917 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(414800381916331190103344780863 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(138355408341793698659331276997 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(123590998979541348212119053 / 625000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(618186072449675022839998719 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(274831566687086940629263661 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1718117810197998138096909 / 6250000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2499590346546338672786751 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(52083790087646979900011 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(8014076739822915641043 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(572507488488976111313 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(7634269598129035133 / 10000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w98S0 : Ball := ⟨(94747355756319310956500685305549 / 100000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +def w98S1 : Ball := ⟨(44885307114072670345604100512461 / 50000000000000000000000000000000), (7 / 100000000000000000000000000000000)⟩ +def w98S2 : Ball := ⟨(10073453973623113352785232118491 / 12500000000000000000000000000000), (13 / 100000000000000000000000000000000)⟩ +def w98S3 : Ball := ⟨(1014744749587032920878757644499 / 1562500000000000000000000000000), (21 / 100000000000000000000000000000000)⟩ +def w98S4 : Ball := ⟨(42176794903119878113210827611889 / 100000000000000000000000000000000), (7 / 25000000000000000000000000000000)⟩ +def w98S5 : Ball := ⟨(17788820282998389285975177527331 / 100000000000000000000000000000000), (3 / 12500000000000000000000000000000)⟩ +abbrev w98 : Ball := w98S5 +lemma w98_sound : w98.Encloses (weight (-17266) : ℝ) := by + exact weight_enclosed_of_trace (-17266) w98Trace w98S0 w98S1 w98S2 w98S3 w98S4 w98S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def w99Trace : List Ball := [ + ⟨(6085161938053930672363297564401 / 6250000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(98675421157941652928787147231029 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(12389373011185287699874689760043 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(16555892164484010775213037196897 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(259030754548476304112310229789 / 6250000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(829635220990840205577570070561 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(138360335507751769185577468387 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1235948511953980365512499713 / 6250000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(154550800902970704176954129 / 6250000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(68709605623279709097557969 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(27490508471509697569182873 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2499642323439937645249957 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(104169579875771911708247 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(8014219612059700701161 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(572517015357665325767 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4771493178163965511 / 6250000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w99S0 : Ball := ⟨(5924671329974443134962349153847 / 6250000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +def w99S1 : Ball := ⟨(44930214871323055166533317729081 / 50000000000000000000000000000000), (7 / 100000000000000000000000000000000)⟩ +def w99S2 : Ball := ⟨(3229958733413215076377858675419 / 4000000000000000000000000000000), (13 / 100000000000000000000000000000000)⟩ +def w99S3 : Ball := ⟨(815049485902523482678015622841 / 1250000000000000000000000000000), (11 / 50000000000000000000000000000000)⟩ +def w99S4 : Ball := ⟨(21257781263038970410521431847113 / 50000000000000000000000000000000), (29 / 100000000000000000000000000000000)⟩ +def w99S5 : Ball := ⟨(723029222763537158550702948243 / 4000000000000000000000000000000), (1 / 4000000000000000000000000000000)⟩ +abbrev w99 : Ball := w99S5 +lemma w99_sound : w99.Encloses (weight (-17106) : ℝ) := by + exact weight_enclosed_of_trace (-17106) w99Trace w99S0 w99S1 w99S2 w99S3 w99S4 w99S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +lemma A1_2_13_below : below (shape 1 2 13) = [ + (shape 0 0 8), + (shape 0 1 7), + (shape 0 2 6), + (shape 1 0 7), + (shape 1 1 6), + (shape 1 2 5)] := by decide +kernel +def A1_2_13Raw (s : Shape) : Ball := + match s 0, s 1, s 2 with + | 0, 0, 8 => ⟨(13198064446345864393700754481767 / 100000000000000000000000000000000), (7 / 20000000000000000000000000000000)⟩ + | 0, 1, 7 => ⟨1, 0⟩ + | 0, 2, 6 => ⟨(102993943547189172179056608068133 / 100000000000000000000000000000000), (1 / 781250000000000000000000000000)⟩ + | 1, 0, 7 => ⟨(102993943547189172179056608068133 / 100000000000000000000000000000000), (1 / 781250000000000000000000000000)⟩ + | 1, 1, 6 => ⟨1, 0⟩ + | 1, 2, 5 => ⟨(13198064446345864393700754481767 / 100000000000000000000000000000000), (7 / 20000000000000000000000000000000)⟩ + | _, _, _ => (.exact 0) +lemma A1_2_13Raw_0_0_8 : (A1_2_13Raw (shape 0 0 8)).Encloses (splitWeight positiveInitial tableP (shape 1 2 13) (shape 0 0 8) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 1 2 13) (shape 0 0 8) + (0) (295) (-20546) w195 w198 w84 + (by decide +kernel) w195_sound w198_sound w84_sound) (by decide +kernel) +lemma A1_2_13Raw_0_1_7 : (A1_2_13Raw (shape 0 1 7)).Encloses (splitWeight positiveInitial tableP (shape 1 2 13) (shape 0 1 7) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 1 2 13) (shape 0 1 7) + (0) (0) (0) w195 w195 w195 + (by decide +kernel) w195_sound w195_sound w195_sound) (by decide +kernel) +lemma A1_2_13Raw_0_2_6 : (A1_2_13Raw (shape 0 2 6)).Encloses (splitWeight positiveInitial tableP (shape 1 2 13) (shape 0 2 6) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 1 2 13) (shape 0 2 6) + (0) (295) (0) w195 w198 w195 + (by decide +kernel) w195_sound w198_sound w195_sound) (by decide +kernel) +lemma A1_2_13Raw_1_0_7 : (A1_2_13Raw (shape 1 0 7)).Encloses (splitWeight positiveInitial tableP (shape 1 2 13) (shape 1 0 7) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 1 2 13) (shape 1 0 7) + (0) (295) (0) w195 w198 w195 + (by decide +kernel) w195_sound w198_sound w195_sound) (by decide +kernel) +lemma A1_2_13Raw_1_1_6 : (A1_2_13Raw (shape 1 1 6)).Encloses (splitWeight positiveInitial tableP (shape 1 2 13) (shape 1 1 6) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 1 2 13) (shape 1 1 6) + (0) (0) (0) w195 w195 w195 + (by decide +kernel) w195_sound w195_sound w195_sound) (by decide +kernel) +lemma A1_2_13Raw_1_2_5 : (A1_2_13Raw (shape 1 2 5)).Encloses (splitWeight positiveInitial tableP (shape 1 2 13) (shape 1 2 5) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 1 2 13) (shape 1 2 5) + (0) (295) (-20546) w195 w198 w84 + (by decide +kernel) w195_sound w198_sound w84_sound) (by decide +kernel) +lemma A1_2_13Raw_sound (u : Shape) (hu : u ∈ below (shape 1 2 13)) : + (A1_2_13Raw u).Encloses (splitWeight positiveInitial tableP (shape 1 2 13) u : ℝ) := by + rw [A1_2_13_below] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl | rfl | rfl + · exact A1_2_13Raw_0_0_8 + · exact A1_2_13Raw_0_1_7 + · exact A1_2_13Raw_0_2_6 + · exact A1_2_13Raw_1_0_7 + · exact A1_2_13Raw_1_1_6 + · exact A1_2_13Raw_1_2_5 +def A1_2_13Den : Ball := ⟨(2161920079935350365727573625499 / 500000000000000000000000000000), (163 / 50000000000000000000000000000000)⟩ +lemma A1_2_13Den_sound : A1_2_13Den.Encloses (((below (shape 1 2 13)).map (splitWeight positiveInitial tableP (shape 1 2 13))).sum : ℝ) := by + exact contains_sound (list_cast_enclosed (below (shape 1 2 13)) A1_2_13Raw (splitWeight positiveInitial tableP (shape 1 2 13)) A1_2_13Raw_sound) (by decide +kernel) +lemma A1_2_13Den_positive : 0 < A1_2_13Den.lower := by decide +kernel +def A1_2_13Table (s : Shape) : Ball := + match s 0, s 1, s 2 with + | 0, 0, 8 => ⟨(1526197079257959517831418186343 / 50000000000000000000000000000000), (11 / 100000000000000000000000000000000)⟩ + | 0, 1, 7 => ⟨(11563794717493717482510909886597 / 50000000000000000000000000000000), (9 / 50000000000000000000000000000000)⟩ + | 0, 2, 6 => ⟨(595500410162416149982883596353 / 2500000000000000000000000000000), (3 / 6250000000000000000000000000000)⟩ + | 1, 0, 7 => ⟨(595500410162416149982883596353 / 2500000000000000000000000000000), (3 / 6250000000000000000000000000000)⟩ + | 1, 1, 6 => ⟨(11563794717493717482510909886597 / 50000000000000000000000000000000), (9 / 50000000000000000000000000000000)⟩ + | 1, 2, 5 => ⟨(1526197079257959517831418186343 / 50000000000000000000000000000000), (11 / 100000000000000000000000000000000)⟩ + | _, _, _ => (.exact 0) +def A1_2_13Law (u : Shape) : Ball := if u ∈ below (shape 1 2 13) then A1_2_13Table u else .exact 0 +lemma A1_2_13Law_check_0_0_8 : contains (.mul (A1_2_13Raw (shape 0 0 8)) (.inv A1_2_13Den)) (A1_2_13Table (shape 0 0 8)) = true := by decide +kernel +lemma A1_2_13Law_check_0_1_7 : contains (.mul (A1_2_13Raw (shape 0 1 7)) (.inv A1_2_13Den)) (A1_2_13Table (shape 0 1 7)) = true := by decide +kernel +lemma A1_2_13Law_check_0_2_6 : contains (.mul (A1_2_13Raw (shape 0 2 6)) (.inv A1_2_13Den)) (A1_2_13Table (shape 0 2 6)) = true := by decide +kernel +lemma A1_2_13Law_check_1_0_7 : contains (.mul (A1_2_13Raw (shape 1 0 7)) (.inv A1_2_13Den)) (A1_2_13Table (shape 1 0 7)) = true := by decide +kernel +lemma A1_2_13Law_check_1_1_6 : contains (.mul (A1_2_13Raw (shape 1 1 6)) (.inv A1_2_13Den)) (A1_2_13Table (shape 1 1 6)) = true := by decide +kernel +lemma A1_2_13Law_check_1_2_5 : contains (.mul (A1_2_13Raw (shape 1 2 5)) (.inv A1_2_13Den)) (A1_2_13Table (shape 1 2 5)) = true := by decide +kernel +lemma A1_2_13Law_check (u : Shape) (hu : u ∈ below (shape 1 2 13)) : + contains (.mul (A1_2_13Raw u) (.inv A1_2_13Den)) (A1_2_13Table u) = true := by + rw [A1_2_13_below] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl | rfl | rfl + · exact A1_2_13Law_check_0_0_8 + · exact A1_2_13Law_check_0_1_7 + · exact A1_2_13Law_check_0_2_6 + · exact A1_2_13Law_check_1_0_7 + · exact A1_2_13Law_check_1_1_6 + · exact A1_2_13Law_check_1_2_5 +lemma A1_2_13Law_sound (u : Shape) : + (A1_2_13Law u).Encloses (stageALaw (shape 1 2 13) u : ℝ) := by + by_cases hu : u ∈ below (shape 1 2 13) + · have h := contains_sound (Ball.mul_sound (A1_2_13Raw_sound u hu) + (Ball.inv_sound A1_2_13Den_sound A1_2_13Den_positive)) (A1_2_13Law_check u hu) + simpa only [A1_2_13Law, hu, ite_true, stageALaw, splitLaw, + Rat.cast_div, Rat.cast_mul, Rat.cast_inv, div_eq_mul_inv] using h + · simp only [A1_2_13Law, hu, ite_false, stageALaw, splitLaw, Rat.cast_zero] + simpa only [Rat.cast_zero] using Ball.exact_sound 0 + +lemma B1_4_3_below : below (shape 1 4 3) = [ + (shape 0 1 3), + (shape 0 2 2), + (shape 0 3 1), + (shape 0 4 0), + (shape 1 0 3), + (shape 1 1 2), + (shape 1 2 1), + (shape 1 3 0)] := by decide +kernel +def B1_4_3Raw (s : Shape) : Ball := + match s 0, s 1, s 2 with + | 0, 1, 3 => ⟨(604310145779763534924082105259 / 20000000000000000000000000000000), (1 / 12500000000000000000000000000000)⟩ + | 0, 2, 2 => ⟨1, 0⟩ + | 0, 3, 1 => ⟨(313250271201287039100674208231 / 2000000000000000000000000000000), (1 / 5000000000000000000000000000000)⟩ + | 0, 4, 0 => ⟨(19874372820681005040666098619 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 1, 0, 3 => ⟨(19874372820681005040666098619 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 1, 1, 2 => ⟨(313250271201287039100674208231 / 2000000000000000000000000000000), (1 / 5000000000000000000000000000000)⟩ + | 1, 2, 1 => ⟨1, 0⟩ + | 1, 3, 0 => ⟨(604310145779763534924082105259 / 20000000000000000000000000000000), (1 / 12500000000000000000000000000000)⟩ + | _, _, _ => (.exact 0) +lemma B1_4_3Raw_0_1_3 : (B1_4_3Raw (shape 0 1 3)).Encloses (splitWeight positiveSecond tablep (shape 1 4 3) (shape 0 1 3) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveSecond tablep (shape 1 4 3) (shape 0 1 3) + (0) (-18539) (-16455) w195 w94 w103 + (by decide +kernel) w195_sound w94_sound w103_sound) (by decide +kernel) +lemma B1_4_3Raw_0_2_2 : (B1_4_3Raw (shape 0 2 2)).Encloses (splitWeight positiveSecond tablep (shape 1 4 3) (shape 0 2 2) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveSecond tablep (shape 1 4 3) (shape 0 2 2) + (0) (0) (0) w195 w195 w195 + (by decide +kernel) w195_sound w195_sound w195_sound) (by decide +kernel) +lemma B1_4_3Raw_0_3_1 : (B1_4_3Raw (shape 0 3 1)).Encloses (splitWeight positiveSecond tablep (shape 1 4 3) (shape 0 3 1) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveSecond tablep (shape 1 4 3) (shape 0 3 1) + (0) (-18539) (0) w195 w94 w195 + (by decide +kernel) w195_sound w94_sound w195_sound) (by decide +kernel) +lemma B1_4_3Raw_0_4_0 : (B1_4_3Raw (shape 0 4 0)).Encloses (splitWeight positiveSecond tablep (shape 1 4 3) (shape 0 4 0) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveSecond tablep (shape 1 4 3) (shape 0 4 0) + (0) (-54917) (-16455) w195 w32 w103 + (by decide +kernel) w195_sound w32_sound w103_sound) (by decide +kernel) +lemma B1_4_3Raw_1_0_3 : (B1_4_3Raw (shape 1 0 3)).Encloses (splitWeight positiveSecond tablep (shape 1 4 3) (shape 1 0 3) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveSecond tablep (shape 1 4 3) (shape 1 0 3) + (0) (-54917) (-16455) w195 w32 w103 + (by decide +kernel) w195_sound w32_sound w103_sound) (by decide +kernel) +lemma B1_4_3Raw_1_1_2 : (B1_4_3Raw (shape 1 1 2)).Encloses (splitWeight positiveSecond tablep (shape 1 4 3) (shape 1 1 2) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveSecond tablep (shape 1 4 3) (shape 1 1 2) + (0) (-18539) (0) w195 w94 w195 + (by decide +kernel) w195_sound w94_sound w195_sound) (by decide +kernel) +lemma B1_4_3Raw_1_2_1 : (B1_4_3Raw (shape 1 2 1)).Encloses (splitWeight positiveSecond tablep (shape 1 4 3) (shape 1 2 1) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveSecond tablep (shape 1 4 3) (shape 1 2 1) + (0) (0) (0) w195 w195 w195 + (by decide +kernel) w195_sound w195_sound w195_sound) (by decide +kernel) +lemma B1_4_3Raw_1_3_0 : (B1_4_3Raw (shape 1 3 0)).Encloses (splitWeight positiveSecond tablep (shape 1 4 3) (shape 1 3 0) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveSecond tablep (shape 1 4 3) (shape 1 3 0) + (0) (-18539) (-16455) w195 w94 w103 + (by decide +kernel) w195_sound w94_sound w103_sound) (by decide +kernel) +lemma B1_4_3Raw_sound (u : Shape) (hu : u ∈ below (shape 1 4 3)) : + (B1_4_3Raw u).Encloses (splitWeight positiveSecond tablep (shape 1 4 3) u : ℝ) := by + rw [B1_4_3_below] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl + · exact B1_4_3Raw_0_1_3 + · exact B1_4_3Raw_0_2_2 + · exact B1_4_3Raw_0_3_1 + · exact B1_4_3Raw_0_4_0 + · exact B1_4_3Raw_1_0_3 + · exact B1_4_3Raw_1_1_2 + · exact B1_4_3Raw_1_2_1 + · exact B1_4_3Raw_1_3_0 +def B1_4_3Den : Ball := ⟨(118763561780245893649816785332321 / 50000000000000000000000000000000), (29 / 50000000000000000000000000000000)⟩ +lemma B1_4_3Den_sound : B1_4_3Den.Encloses (((below (shape 1 4 3)).map (splitWeight positiveSecond tablep (shape 1 4 3))).sum : ℝ) := by + exact contains_sound (list_cast_enclosed (below (shape 1 4 3)) B1_4_3Raw (splitWeight positiveSecond tablep (shape 1 4 3)) B1_4_3Raw_sound) (by decide +kernel) +lemma B1_4_3Den_positive : 0 < B1_4_3Den.lower := by decide +kernel +def B1_4_3Table (s : Shape) : Ball := + match s 0, s 1, s 2 with + | 0, 1, 3 => ⟨(636043303940678115759208606101 / 50000000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ + | 0, 2, 2 => ⟨(42100455097934397479443978531991 / 100000000000000000000000000000000), (11 / 100000000000000000000000000000000)⟩ + | 0, 3, 1 => ⟨(5275191590850223000844657229 / 80000000000000000000000000000), (11 / 100000000000000000000000000000000)⟩ + | 0, 4, 0 => ⟨(33468805621467537981782719557 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 1, 0, 3 => ⟨(33468805621467537981782719557 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 1, 1, 2 => ⟨(5275191590850223000844657229 / 80000000000000000000000000000), (11 / 100000000000000000000000000000000)⟩ + | 1, 2, 1 => ⟨(42100455097934397479443978531991 / 100000000000000000000000000000000), (11 / 100000000000000000000000000000000)⟩ + | 1, 3, 0 => ⟨(636043303940678115759208606101 / 50000000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ + | _, _, _ => (.exact 0) +def B1_4_3Law (u : Shape) : Ball := if u ∈ below (shape 1 4 3) then B1_4_3Table u else .exact 0 +lemma B1_4_3Law_check_0_1_3 : contains (.mul (B1_4_3Raw (shape 0 1 3)) (.inv B1_4_3Den)) (B1_4_3Table (shape 0 1 3)) = true := by decide +kernel +lemma B1_4_3Law_check_0_2_2 : contains (.mul (B1_4_3Raw (shape 0 2 2)) (.inv B1_4_3Den)) (B1_4_3Table (shape 0 2 2)) = true := by decide +kernel +lemma B1_4_3Law_check_0_3_1 : contains (.mul (B1_4_3Raw (shape 0 3 1)) (.inv B1_4_3Den)) (B1_4_3Table (shape 0 3 1)) = true := by decide +kernel +lemma B1_4_3Law_check_0_4_0 : contains (.mul (B1_4_3Raw (shape 0 4 0)) (.inv B1_4_3Den)) (B1_4_3Table (shape 0 4 0)) = true := by decide +kernel +lemma B1_4_3Law_check_1_0_3 : contains (.mul (B1_4_3Raw (shape 1 0 3)) (.inv B1_4_3Den)) (B1_4_3Table (shape 1 0 3)) = true := by decide +kernel +lemma B1_4_3Law_check_1_1_2 : contains (.mul (B1_4_3Raw (shape 1 1 2)) (.inv B1_4_3Den)) (B1_4_3Table (shape 1 1 2)) = true := by decide +kernel +lemma B1_4_3Law_check_1_2_1 : contains (.mul (B1_4_3Raw (shape 1 2 1)) (.inv B1_4_3Den)) (B1_4_3Table (shape 1 2 1)) = true := by decide +kernel +lemma B1_4_3Law_check_1_3_0 : contains (.mul (B1_4_3Raw (shape 1 3 0)) (.inv B1_4_3Den)) (B1_4_3Table (shape 1 3 0)) = true := by decide +kernel +lemma B1_4_3Law_check (u : Shape) (hu : u ∈ below (shape 1 4 3)) : + contains (.mul (B1_4_3Raw u) (.inv B1_4_3Den)) (B1_4_3Table u) = true := by + rw [B1_4_3_below] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl + · exact B1_4_3Law_check_0_1_3 + · exact B1_4_3Law_check_0_2_2 + · exact B1_4_3Law_check_0_3_1 + · exact B1_4_3Law_check_0_4_0 + · exact B1_4_3Law_check_1_0_3 + · exact B1_4_3Law_check_1_1_2 + · exact B1_4_3Law_check_1_2_1 + · exact B1_4_3Law_check_1_3_0 +lemma B1_4_3Law_sound (u : Shape) : + (B1_4_3Law u).Encloses (stageBLaw (shape 1 4 3) u : ℝ) := by + by_cases hu : u ∈ below (shape 1 4 3) + · have h := contains_sound (Ball.mul_sound (B1_4_3Raw_sound u hu) + (Ball.inv_sound B1_4_3Den_sound B1_4_3Den_positive)) (B1_4_3Law_check u hu) + simpa only [B1_4_3Law, hu, ite_true, stageBLaw, splitLaw, + Rat.cast_div, Rat.cast_mul, Rat.cast_inv, div_eq_mul_inv] using h + · simp only [B1_4_3Law, hu, ite_false, stageBLaw, splitLaw, Rat.cast_zero] + simpa only [Rat.cast_zero] using Ball.exact_sound 0 + +lemma B2_3_3_below : below (shape 2 3 3) = [ + (shape 0 1 3), + (shape 0 2 2), + (shape 0 3 1), + (shape 1 0 3), + (shape 1 1 2), + (shape 1 2 1), + (shape 1 3 0), + (shape 2 0 2), + (shape 2 1 1), + (shape 2 2 0)] := by decide +kernel +def B2_3_3Raw (s : Shape) : Ball := + match s 0, s 1, s 2 with + | 0, 1, 3 => ⟨(458969575380885935284968818789 / 12500000000000000000000000000000), (9 / 100000000000000000000000000000000)⟩ + | 0, 2, 2 => ⟨(25801251678676229010804343740993 / 50000000000000000000000000000000), (41 / 100000000000000000000000000000000)⟩ + | 0, 3, 1 => ⟨(3706063217950154173785426369011 / 100000000000000000000000000000000), (9 / 100000000000000000000000000000000)⟩ + | 1, 0, 3 => ⟨(511028552803376939474174188057 / 100000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ + | 1, 1, 2 => ⟨1, 0⟩ + | 1, 2, 1 => ⟨1, 0⟩ + | 1, 3, 0 => ⟨(511028552803376939474174188057 / 100000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ + | 2, 0, 2 => ⟨(3706063217950154173785426369011 / 100000000000000000000000000000000), (9 / 100000000000000000000000000000000)⟩ + | 2, 1, 1 => ⟨(25801251678676229010804343740993 / 50000000000000000000000000000000), (41 / 100000000000000000000000000000000)⟩ + | 2, 2, 0 => ⟨(458969575380885935284968818789 / 12500000000000000000000000000000), (9 / 100000000000000000000000000000000)⟩ + | _, _, _ => (.exact 0) +lemma B2_3_3Raw_0_1_3 : (B2_3_3Raw (shape 0 1 3)).Encloses (splitWeight positiveSecond tablep (shape 2 3 3) (shape 0 1 3) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveSecond tablep (shape 2 3 3) (shape 0 1 3) + (-6616) (0) (-26429) w156 w195 w70 + (by decide +kernel) w156_sound w195_sound w70_sound) (by decide +kernel) +lemma B2_3_3Raw_0_2_2 : (B2_3_3Raw (shape 0 2 2)).Encloses (splitWeight positiveSecond tablep (shape 2 3 3) (shape 0 2 2) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveSecond tablep (shape 2 3 3) (shape 0 2 2) + (-6616) (0) (0) w156 w195 w195 + (by decide +kernel) w156_sound w195_sound w195_sound) (by decide +kernel) +lemma B2_3_3Raw_0_3_1 : (B2_3_3Raw (shape 0 3 1)).Encloses (splitWeight positiveSecond tablep (shape 2 3 3) (shape 0 3 1) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveSecond tablep (shape 2 3 3) (shape 0 3 1) + (-6616) (-26336) (0) w156 w75 w195 + (by decide +kernel) w156_sound w75_sound w195_sound) (by decide +kernel) +lemma B2_3_3Raw_1_0_3 : (B2_3_3Raw (shape 1 0 3)).Encloses (splitWeight positiveSecond tablep (shape 2 3 3) (shape 1 0 3) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveSecond tablep (shape 2 3 3) (shape 1 0 3) + (0) (-26336) (-26429) w195 w75 w70 + (by decide +kernel) w195_sound w75_sound w70_sound) (by decide +kernel) +lemma B2_3_3Raw_1_1_2 : (B2_3_3Raw (shape 1 1 2)).Encloses (splitWeight positiveSecond tablep (shape 2 3 3) (shape 1 1 2) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveSecond tablep (shape 2 3 3) (shape 1 1 2) + (0) (0) (0) w195 w195 w195 + (by decide +kernel) w195_sound w195_sound w195_sound) (by decide +kernel) +lemma B2_3_3Raw_1_2_1 : (B2_3_3Raw (shape 1 2 1)).Encloses (splitWeight positiveSecond tablep (shape 2 3 3) (shape 1 2 1) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveSecond tablep (shape 2 3 3) (shape 1 2 1) + (0) (0) (0) w195 w195 w195 + (by decide +kernel) w195_sound w195_sound w195_sound) (by decide +kernel) +lemma B2_3_3Raw_1_3_0 : (B2_3_3Raw (shape 1 3 0)).Encloses (splitWeight positiveSecond tablep (shape 2 3 3) (shape 1 3 0) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveSecond tablep (shape 2 3 3) (shape 1 3 0) + (0) (-26336) (-26429) w195 w75 w70 + (by decide +kernel) w195_sound w75_sound w70_sound) (by decide +kernel) +lemma B2_3_3Raw_2_0_2 : (B2_3_3Raw (shape 2 0 2)).Encloses (splitWeight positiveSecond tablep (shape 2 3 3) (shape 2 0 2) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveSecond tablep (shape 2 3 3) (shape 2 0 2) + (-6616) (-26336) (0) w156 w75 w195 + (by decide +kernel) w156_sound w75_sound w195_sound) (by decide +kernel) +lemma B2_3_3Raw_2_1_1 : (B2_3_3Raw (shape 2 1 1)).Encloses (splitWeight positiveSecond tablep (shape 2 3 3) (shape 2 1 1) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveSecond tablep (shape 2 3 3) (shape 2 1 1) + (-6616) (0) (0) w156 w195 w195 + (by decide +kernel) w156_sound w195_sound w195_sound) (by decide +kernel) +lemma B2_3_3Raw_2_2_0 : (B2_3_3Raw (shape 2 2 0)).Encloses (splitWeight positiveSecond tablep (shape 2 3 3) (shape 2 2 0) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveSecond tablep (shape 2 3 3) (shape 2 2 0) + (-6616) (0) (-26429) w156 w195 w70 + (by decide +kernel) w156_sound w195_sound w70_sound) (by decide +kernel) +lemma B2_3_3Raw_sound (u : Shape) (hu : u ∈ below (shape 2 3 3)) : + (B2_3_3Raw u).Encloses (splitWeight positiveSecond tablep (shape 2 3 3) u : ℝ) := by + rw [B2_3_3_below] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl + · exact B2_3_3Raw_0_1_3 + · exact B2_3_3Raw_0_2_2 + · exact B2_3_3Raw_0_3_1 + · exact B2_3_3Raw_1_0_3 + · exact B2_3_3Raw_1_1_2 + · exact B2_3_3Raw_1_2_1 + · exact B2_3_3Raw_1_3_0 + · exact B2_3_3Raw_2_0_2 + · exact B2_3_3Raw_2_1_1 + · exact B2_3_3Raw_2_2_0 +def B2_3_3Den : Ball := ⟨(79745675865576538308574019294683 / 25000000000000000000000000000000), (61 / 50000000000000000000000000000000)⟩ +lemma B2_3_3Den_sound : B2_3_3Den.Encloses (((below (shape 2 3 3)).map (splitWeight positiveSecond tablep (shape 2 3 3))).sum : ℝ) := by + exact contains_sound (list_cast_enclosed (below (shape 2 3 3)) B2_3_3Raw (splitWeight positiveSecond tablep (shape 2 3 3)) B2_3_3Raw_sound) (by decide +kernel) +lemma B2_3_3Den_positive : 0 < B2_3_3Den.lower := by decide +kernel +def B2_3_3Table (s : Shape) : Ball := + match s 0, s 1, s 2 with + | 0, 1, 3 => ⟨(575541645862465244045460683071 / 50000000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ + | 0, 2, 2 => ⟨(16177210487354926739367120056171 / 100000000000000000000000000000000), (1 / 5000000000000000000000000000000)⟩ + | 0, 3, 1 => ⟨(580919149804010567943683801739 / 50000000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ + | 1, 0, 3 => ⟨(80102862515202903466679710933 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 1, 1, 2 => ⟨(31349662196281715829721231552343 / 100000000000000000000000000000000), (13 / 100000000000000000000000000000000)⟩ + | 1, 2, 1 => ⟨(31349662196281715829721231552343 / 100000000000000000000000000000000), (13 / 100000000000000000000000000000000)⟩ + | 1, 3, 0 => ⟨(80102862515202903466679710933 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 2, 0, 2 => ⟨(580919149804010567943683801739 / 50000000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ + | 2, 1, 1 => ⟨(16177210487354926739367120056171 / 100000000000000000000000000000000), (1 / 5000000000000000000000000000000)⟩ + | 2, 2, 0 => ⟨(575541645862465244045460683071 / 50000000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ + | _, _, _ => (.exact 0) +def B2_3_3Law (u : Shape) : Ball := if u ∈ below (shape 2 3 3) then B2_3_3Table u else .exact 0 +lemma B2_3_3Law_check_0_1_3 : contains (.mul (B2_3_3Raw (shape 0 1 3)) (.inv B2_3_3Den)) (B2_3_3Table (shape 0 1 3)) = true := by decide +kernel +lemma B2_3_3Law_check_0_2_2 : contains (.mul (B2_3_3Raw (shape 0 2 2)) (.inv B2_3_3Den)) (B2_3_3Table (shape 0 2 2)) = true := by decide +kernel +lemma B2_3_3Law_check_0_3_1 : contains (.mul (B2_3_3Raw (shape 0 3 1)) (.inv B2_3_3Den)) (B2_3_3Table (shape 0 3 1)) = true := by decide +kernel +lemma B2_3_3Law_check_1_0_3 : contains (.mul (B2_3_3Raw (shape 1 0 3)) (.inv B2_3_3Den)) (B2_3_3Table (shape 1 0 3)) = true := by decide +kernel +lemma B2_3_3Law_check_1_1_2 : contains (.mul (B2_3_3Raw (shape 1 1 2)) (.inv B2_3_3Den)) (B2_3_3Table (shape 1 1 2)) = true := by decide +kernel +lemma B2_3_3Law_check_1_2_1 : contains (.mul (B2_3_3Raw (shape 1 2 1)) (.inv B2_3_3Den)) (B2_3_3Table (shape 1 2 1)) = true := by decide +kernel +lemma B2_3_3Law_check_1_3_0 : contains (.mul (B2_3_3Raw (shape 1 3 0)) (.inv B2_3_3Den)) (B2_3_3Table (shape 1 3 0)) = true := by decide +kernel +lemma B2_3_3Law_check_2_0_2 : contains (.mul (B2_3_3Raw (shape 2 0 2)) (.inv B2_3_3Den)) (B2_3_3Table (shape 2 0 2)) = true := by decide +kernel +lemma B2_3_3Law_check_2_1_1 : contains (.mul (B2_3_3Raw (shape 2 1 1)) (.inv B2_3_3Den)) (B2_3_3Table (shape 2 1 1)) = true := by decide +kernel +lemma B2_3_3Law_check_2_2_0 : contains (.mul (B2_3_3Raw (shape 2 2 0)) (.inv B2_3_3Den)) (B2_3_3Table (shape 2 2 0)) = true := by decide +kernel +lemma B2_3_3Law_check (u : Shape) (hu : u ∈ below (shape 2 3 3)) : + contains (.mul (B2_3_3Raw u) (.inv B2_3_3Den)) (B2_3_3Table u) = true := by + rw [B2_3_3_below] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl + · exact B2_3_3Law_check_0_1_3 + · exact B2_3_3Law_check_0_2_2 + · exact B2_3_3Law_check_0_3_1 + · exact B2_3_3Law_check_1_0_3 + · exact B2_3_3Law_check_1_1_2 + · exact B2_3_3Law_check_1_2_1 + · exact B2_3_3Law_check_1_3_0 + · exact B2_3_3Law_check_2_0_2 + · exact B2_3_3Law_check_2_1_1 + · exact B2_3_3Law_check_2_2_0 +lemma B2_3_3Law_sound (u : Shape) : + (B2_3_3Law u).Encloses (stageBLaw (shape 2 3 3) u : ℝ) := by + by_cases hu : u ∈ below (shape 2 3 3) + · have h := contains_sound (Ball.mul_sound (B2_3_3Raw_sound u hu) + (Ball.inv_sound B2_3_3Den_sound B2_3_3Den_positive)) (B2_3_3Law_check u hu) + simpa only [B2_3_3Law, hu, ite_true, stageBLaw, splitLaw, + Rat.cast_div, Rat.cast_mul, Rat.cast_inv, div_eq_mul_inv] using h + · simp only [B2_3_3Law, hu, ite_false, stageBLaw, splitLaw, Rat.cast_zero] + simpa only [Rat.cast_zero] using Ball.exact_sound 0 + +end MatrixMultiplication.NativeNumerics + +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/Certificates/SplitB5_1_2.lean b/lean/OAI/LinearAlgebra/MatrixFields/Certificates/SplitB5_1_2.lean new file mode 100644 index 0000000000000000000000000000000000000000..e794bbb141fdcf997dbb3aaabcc5b9bc46cf2003 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/Certificates/SplitB5_1_2.lean @@ -0,0 +1,1155 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Certificates.Weights2 +import OAI.LinearAlgebra.MatrixFields.Certificates.Zero0_1_7 + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate +open scoped BigOperators +def w150Trace : List Ball := [ + ⟨(98959204157366003351153005275457 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(9947869463646324003316556506979 / 10000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(12456520036720668263666306576111 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(26597062364417979692773038269 / 160000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2078981548646564333740394195517 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(831882377399091917407720490597 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(27736314155152514707055536169 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(19815351314343164024966121289 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2477278559300095089619933339 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(137642573889370088899660261 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2753113128972317574696971 / 10000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(625757091104298819297701 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(52149919402069302614269 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4011762733662588650543 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1146274998447789459539 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(3821081601830403087 / 5000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w150S0 : Ball := ⟨(97929240874592448813469267792491 / 100000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +def w150S1 : Ball := ⟨(95901362182739484089958458380911 / 100000000000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ +def w150S2 : Ball := ⟨(18394142537009949728404824819527 / 20000000000000000000000000000000), (3 / 25000000000000000000000000000000)⟩ +def w150S3 : Ball := ⟨(84586119917959707453491417433721 / 100000000000000000000000000000000), (23 / 100000000000000000000000000000000)⟩ +def w150S4 : Ball := ⟨(71548116827754599463824485091543 / 100000000000000000000000000000000), (1 / 2500000000000000000000000000000)⟩ +def w150S5 : Ball := ⟨(10238266043196041778240362118913 / 20000000000000000000000000000000), (29 / 50000000000000000000000000000000)⟩ +abbrev w150 : Ball := w150S5 +lemma w150_sound : w150.Encloses (weight (-6696) : ℝ) := by + exact weight_enclosed_of_trace (-6696) w150Trace w150S0 w150S1 w150S2 w150S3 w150S4 w150S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def w151Trace : List Ball := [ + ⟨(98959822654324787871539121812971 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(12434875620743719407780970556231 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(24913091885247805750256332344387 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(3324637982152081281287943789147 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(831593657501690572183100460147 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(166376648573127187111332761389 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(138681694460002178282799893639 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(19815366779362640151966072889 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(495456055606955034074299139 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(275285319684876352292938213 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(3441393365003636971129463 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2503029667117263217847199 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(104299888913743438518221 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1002941130867380488099 / 6250000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(229255095154128675347 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(76421661908341389161 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w151S0 : Ball := ⟨(19586092999550827008102937488861 / 20000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +def w151S1 : Ball := ⟨(95903759746763478003858382709171 / 100000000000000000000000000000000), (7 / 100000000000000000000000000000000)⟩ +def w151S2 : Ball := ⟨(91975311335649308066233628913593 / 100000000000000000000000000000000), (7 / 50000000000000000000000000000000)⟩ +def w151S3 : Ball := ⟨(4229728947644810052656875620657 / 5000000000000000000000000000000), (13 / 50000000000000000000000000000000)⟩ +def w151S4 : Ball := ⟨(71562427882177889197978168586201 / 100000000000000000000000000000000), (9 / 20000000000000000000000000000000)⟩ +def w151S5 : Ball := ⟨(51211810843919113717266306638877 / 100000000000000000000000000000000), (13 / 20000000000000000000000000000000)⟩ +abbrev w151 : Ball := w151S5 +lemma w151_sound : w151.Encloses (weight (-6692) : ℝ) := by + exact weight_enclosed_of_trace (-6692) w151Trace w151S0 w151S1 w151S2 w151S3 w151S4 w151S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def w152Trace : List Ball := [ + ⟨(49480065952126892699445810186087 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(49739580065588740262284227339971 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(12456558895605846946045926937113 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(16623202877284277746252173541207 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1039492720655041444890717499779 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(831883675599486957612835161809 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(69340878151097194403499983237 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(309615226748131662016326479 / 1562500000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1238640568701460127778783137 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(137642702819008821409504633 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(13765577367594078639829061 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1251515159233883307584931 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(208599827937125245833071 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(16047061673494190400483 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(573137857216105179541 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(9552709605526006609 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w152S0 : Ball := ⟨(979310770650730793831531242189 / 1000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +def w152S1 : Ball := ⟨(19180991710250564999263735763499 / 20000000000000000000000000000000), (7 / 100000000000000000000000000000000)⟩ +def w152S2 : Ball := ⟨(45988805373587611805931315798183 / 50000000000000000000000000000000), (7 / 50000000000000000000000000000000)⟩ +def w152S3 : Ball := ⟨(42299404393794415981700998922627 / 50000000000000000000000000000000), (13 / 50000000000000000000000000000000)⟩ +def w152S4 : Ball := ⟨(715695844827901737672838551853 / 1000000000000000000000000000000), (9 / 20000000000000000000000000000000)⟩ +def w152S5 : Ball := ⟨(10244410846078480049421577074601 / 20000000000000000000000000000000), (13 / 20000000000000000000000000000000)⟩ +abbrev w152 : Ball := w152S5 +lemma w152_sound : w152.Encloses (weight (-6690) : ℝ) := by + exact weight_enclosed_of_trace (-6690) w152Trace w152S0 w152S1 w152S2 w152S3 w152S4 w152S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def w153Trace : List Ball := [ + ⟨(1979267581737113838921540428197 / 2000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(49740394692784312079075295973587 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(24913389806273844563174475469239 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(16623339026762477003549467592479 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(129937441608006187186082093829 / 3125000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(415944109664114042263111789553 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(138682405648127041018180042841 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2476931962955140149453843733 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1238645080400423413910090399 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(275286308148947635685391553 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1376561839730194464809187 / 5000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(625759289416736695122603 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(13037522130604870384161 / 6250000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(8023549629776633163579 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(114627822038429962967 / 10000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(76421833670808021833 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w153S0 : Ball := ⟨(489687520014435326413882344469 / 500000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +def w153S1 : Ball := ⟨(47958773451577599676843491263659 / 50000000000000000000000000000000), (7 / 100000000000000000000000000000000)⟩ +def w153S2 : Ball := ⟨(18400351607837955147964393903857 / 20000000000000000000000000000000), (7 / 50000000000000000000000000000000)⟩ +def w153S3 : Ball := ⟨(21160808705754051322286455320327 / 25000000000000000000000000000000), (13 / 50000000000000000000000000000000)⟩ +def w153S4 : Ball := ⟨(71644772013042631775180889902173 / 100000000000000000000000000000000), (9 / 20000000000000000000000000000000)⟩ +def w153S5 : Ball := ⟨(10265946713601713519591380950439 / 20000000000000000000000000000000), (13 / 20000000000000000000000000000000)⟩ +abbrev w153 : Ball := w153S5 +lemma w153_sound : w153.Encloses (weight (-6669) : ℝ) := by + exact weight_enclosed_of_trace (-6669) w153Trace w153S0 w153S1 w153S2 w153S3 w153S4 w153S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def w154Trace : List Ball := [ + ⟨(49485478130313505717427853518031 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(49742295558815157227518693120877 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(24914024525422866221757764749047 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(16623656715820428421459383870093 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4158061713231491983785648007137 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(415949410763730894550750913829 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(34670980202333395331275061639 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4953911288345802145949059409 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(309663901953265088157488883 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(275288414028708492591919431 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(13765714134158981687190871 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1251526557966273265284723 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(10430079089427658903997 / 5000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(8023593480498451343117 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(573142033822932358121 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(38211099799770641371 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w154S0 : Ball := ⟨(765253920558042580483409467523 / 781250000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +def w154S1 : Ball := ⟨(95946926150361898155229298951251 / 100000000000000000000000000000000), (7 / 100000000000000000000000000000000)⟩ +def w154S2 : Ball := ⟨(92058126377029998536473445358587 / 100000000000000000000000000000000), (7 / 50000000000000000000000000000000)⟩ +def w154S3 : Ball := ⟨(8474698632049226364252595853363 / 10000000000000000000000000000000), (13 / 50000000000000000000000000000000)⟩ +def w154S4 : Ball := ⟨(35910258452028514313791019398413 / 50000000000000000000000000000000), (9 / 20000000000000000000000000000000)⟩ +def w154S5 : Ball := ⟨(3223866655228713372649086705233 / 6250000000000000000000000000000), (13 / 20000000000000000000000000000000)⟩ +abbrev w154 : Ball := w154S5 +lemma w154_sound : w154.Encloses (weight (-6620) : ℝ) := by + exact weight_enclosed_of_trace (-6620) w154Trace w154S0 w154S1 w154S2 w154S3 w154S4 w154S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def w155Trace : List Ball := [ + ⟨(395884443611467931532306894623 / 400000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(24871167176504417390500712355337 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(49828074958255247064235741099479 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(8311831599685895066409253386727 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(415806301083562194633967844933 / 10000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(831899037901287355986169979633 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(138683951731292567183040696223 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(19815649019738010536764361099 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(495462329063957370274107729 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1101153828024605958698809 / 400000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1720714510998137790427207 / 6250000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(312881680201674038036047 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(41720321368754399721233 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(16047188750831599788367 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(114628418697831682377 / 10000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(38211103533737307299 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w155S0 : Ball := ⟨(24488201983368989429367489727839 / 25000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +def w155S1 : Ball := ⟨(95947525820524305222563544636317 / 100000000000000000000000000000000), (7 / 100000000000000000000000000000000)⟩ +def w155S2 : Ball := ⟨(92059277110801782501592279871339 / 100000000000000000000000000000000), (7 / 50000000000000000000000000000000)⟩ +def w155S3 : Ball := ⟨(21187276255408482467731770682511 / 25000000000000000000000000000000), (13 / 50000000000000000000000000000000)⟩ +def w155S4 : Ball := ⟨(35912054009839686944278492424623 / 50000000000000000000000000000000), (9 / 20000000000000000000000000000000)⟩ +def w155S5 : Ball := ⟨(12896756232056427378688678611447 / 25000000000000000000000000000000), (13 / 20000000000000000000000000000000)⟩ +abbrev w155 : Ball := w155S5 +lemma w155_sound : w155.Encloses (weight (-6619) : ℝ) := by + exact weight_enclosed_of_trace (-6619) w155Trace w155S0 w155S1 w155S2 w155S3 w155S4 w155S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def w156Trace : List Ball := [ + ⟨(24742893707759167717571839583161 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(99484901471664244712226521630567 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(6228519085075638304395143523973 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(8311841325025081733439023372001 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(259879181478253928588995904867 / 6250000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(415949843511671547411472251249 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(69342022248620967854356993233 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(19815660618810464829494793027 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1238656467200795179998878581 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(275288585938553686326632931 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(27531443898933030127232013 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1251527209328199532058349 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(208601682009461996470387 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(8023597060168963565373 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1146284544975813170103 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(19105557367818652541 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w156S0 : Ball := ⟨(97953726245354914261265277041379 / 100000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ +def w156S1 : Ball := ⟨(19189864970699864297603953346807 / 20000000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ +def w156S2 : Ball := ⟨(23015682349605856477323583035117 / 25000000000000000000000000000000), (1 / 12500000000000000000000000000000)⟩ +def w156S3 : Ball := ⟨(84755461442873369322191116754667 / 100000000000000000000000000000000), (1 / 6250000000000000000000000000000)⟩ +def w156S4 : Ball := ⟨(71834882443943943591879525160831 / 100000000000000000000000000000000), (7 / 25000000000000000000000000000000)⟩ +def w156S5 : Ball := ⟨(25801251678676229010804343740993 / 50000000000000000000000000000000), (41 / 100000000000000000000000000000000)⟩ +abbrev w156 : Ball := w156S5 +lemma w156_sound : w156.Encloses (weight (-6616) : ℝ) := by + exact weight_enclosed_of_trace (-6616) w156Trace w156S0 w156S1 w156S2 w156S3 w156S4 w156S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def w157Trace : List Ball := [ + ⟨(99008696131407113842224392670897 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(49751762539166181067784558549699 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(9966874211646431406391626611839 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(3325047764473635493939612362469 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4158378348656381126083297798903 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(415975809801030895024786336923 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2773829322502470833145615031 / 2000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(3963317716744737397403008067 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(495483212971729642684657597 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(275298900886518976850263033 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(27532381765614020106414963 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(19555723315456827276001 / 781250000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(41721539085530462777061 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(8023811845855754418869 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(229262637091207260323 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(76424021775274255433 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w157S0 : Ball := ⟨(98027219096413099905522032838183 / 100000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +def w157S1 : Ball := ⟨(96093356837761771271104610780997 / 100000000000000000000000000000000), (7 / 100000000000000000000000000000000)⟩ +def w157S2 : Ball := ⟨(46169666141747084808672205786691 / 50000000000000000000000000000000), (7 / 50000000000000000000000000000000)⟩ +def w157S3 : Ball := ⟨(4263276143280774288544750682133 / 5000000000000000000000000000000), (27 / 100000000000000000000000000000000)⟩ +def w157S4 : Ball := ⟨(18175523473866993100920101743149 / 25000000000000000000000000000000), (47 / 100000000000000000000000000000000)⟩ +def w157S5 : Ball := ⟨(6606993070981801772863128225947 / 12500000000000000000000000000000), (69 / 100000000000000000000000000000000)⟩ +abbrev w157 : Ball := w157S5 +lemma w157_sound : w157.Encloses (weight (-6376) : ℝ) := by + exact weight_enclosed_of_trace (-6376) w157Trace w157S0 w157S1 w157S2 w157S3 w157S4 w157S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def w158Trace : List Ball := [ + ⟨(49516725699859785494417600037017 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(9951594340081637180589960627711 / 10000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(24919258645231824664112932967329 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1039142275008691581558134268613 / 6250000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4158586000267836472228403486109 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(831986244409801229164806235013 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(138696414263279708471258514269 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1981720726992848572770909857 / 10000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2477484822790789408717762799 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(275305777908957530233815321 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(27533007042612745612136031 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(500636939472742145097313 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(208611704551984763824557 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4011977521138377542947 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(286583069964077930619 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(76425216644607352279 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w158S0 : Ball := ⟨(784609959691249460344272007897 / 800000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +def w158S1 : Ball := ⟨(48094749128648758043500670970943 / 50000000000000000000000000000000), (7 / 100000000000000000000000000000000)⟩ +def w158S2 : Ball := ⟨(46262097874953209421565892989867 / 50000000000000000000000000000000), (7 / 50000000000000000000000000000000)⟩ +def w158S3 : Ball := ⟨(85607267991670010199468365755049 / 100000000000000000000000000000000), (27 / 100000000000000000000000000000000)⟩ +def w158S4 : Ball := ⟨(3664302166498804330743316209753 / 5000000000000000000000000000000), (47 / 100000000000000000000000000000000)⟩ +def w158S5 : Ball := ⟨(1342711036740783113535463371521 / 2500000000000000000000000000000), (7 / 10000000000000000000000000000000)⟩ +abbrev w158 : Ball := w158S5 +lemma w158_sound : w158.Encloses (weight (-6216) : ℝ) := by + exact weight_enclosed_of_trace (-6216) w158Trace w158S0 w158S1 w158S2 w158S3 w158S4 w158S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def w159Trace : List Ball := [ + ⟨(1547791831157559854570273448021 / 1562500000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(99528596693597944292350829185461 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(9968548359402466641185174997691 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(8313666769544585181516603947513 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2079398781562665977648572100617 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(832021520973767598958264972273 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(138701455496790021484181575849 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1981783759181812968985302253 / 10000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(247755487346694386130485369 / 10000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4301762253074999876598447 / 1562500000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(6883411017582406694798197 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(625809447381830454043447 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(208615788994554642674793 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(16048201857072882054709 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(286587933222733710459 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(19106608479435111173 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w159S0 : Ball := ⟨(49063107637208520143250629106451 / 50000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +def w159S1 : Ball := ⟨(96287541240812360649384801219427 / 100000000000000000000000000000000), (7 / 100000000000000000000000000000000)⟩ +def w159S2 : Ball := ⟨(46356452991005705783297221929571 / 50000000000000000000000000000000), (7 / 50000000000000000000000000000000)⟩ +def w159S3 : Ball := ⟨(85956829356292873833255561410963 / 100000000000000000000000000000000), (27 / 100000000000000000000000000000000)⟩ +def w159S4 : Ball := ⟨(591086121038948190956164604429 / 800000000000000000000000000000), (47 / 100000000000000000000000000000000)⟩ +def w159S5 : Ball := ⟨(682388286103261935988301163511 / 1250000000000000000000000000000), (7 / 10000000000000000000000000000000)⟩ +abbrev w159 : Ball := w159S5 +lemma w159_sound : w159.Encloses (weight (-6053) : ℝ) := by + exact weight_enclosed_of_trace (-6053) w159Trace w159S0 w159S1 w159S2 w159S3 w159S4 w159S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def w160Trace : List Ball := [ + ⟨(99080503463114817342427923617713 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(6221221494487027453126362532391 / 6250000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4984639655832863328586733225921 / 10000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(16628248083503839148326683712017 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2079490292981191791068089561563 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1300081309926096842098704929 / 156250000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(34676454144285639787880345683 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(19818382868344220553992547457 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1238807736163502887616908509 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(137659422556123599260715117 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(13767097570322490075396953 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(250328371755458747100547 / 10000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(41723864456495945867181 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4012113564310161196087 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(286592140215691882113 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(76427486896340236287 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w160S0 : Ball := ⟨(157071138664068917000913565899 / 160000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +def w160S1 : Ball := ⟨(376454812640795371223596316491 / 390625000000000000000000000000), (7 / 100000000000000000000000000000000)⟩ +def w160S2 : Ball := ⟨(92876456565418456789494681015819 / 100000000000000000000000000000000), (7 / 50000000000000000000000000000000)⟩ +def w160S3 : Ball := ⟨(21565090460370152917232098213533 / 25000000000000000000000000000000), (27 / 100000000000000000000000000000000)⟩ +def w160S4 : Ball := ⟨(18602125062557910955536927790521 / 25000000000000000000000000000000), (47 / 100000000000000000000000000000000)⟩ +def w160S5 : Ball := ⟨(2768312454744361300648215750971 / 5000000000000000000000000000000), (71 / 100000000000000000000000000000000)⟩ +abbrev w160 : Ball := w160S5 +lemma w160_sound : w160.Encloses (weight (-5912) : ℝ) := by + exact weight_enclosed_of_trace (-5912) w160Trace w160S0 w160S1 w160S2 w160S3 w160S4 w160S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def w161Trace : List Ball := [ + ⟨(24777287015246801295851993805269 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(9955390972030534007663625956193 / 10000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(24925596211330744801186823848833 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(8314724069901052425429149074019 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4159220742678463788607622127133 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(208023020449181157577636864919 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(69355769463032122802772755443 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(19819098342547878704341177249 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1238847492758515969971997491 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(275326797745217395345695601 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(27534918206839035292763847 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(50066879601841907692761 / 2000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(52155989581323355813813 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(8024392715910824479099 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1146390640820326587061 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(19107217116001657379 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w161S0 : Ball := ⟨(1964524645874936778595387103443 / 2000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +def w161S1 : Ball := ⟨(96483927106251143862515181564919 / 100000000000000000000000000000000), (7 / 100000000000000000000000000000000)⟩ +def w161S2 : Ball := ⟨(93091481898443842274841312010957 / 100000000000000000000000000000000), (7 / 50000000000000000000000000000000)⟩ +def w161S3 : Ball := ⟨(86660240020482975525921112717461 / 100000000000000000000000000000000), (27 / 100000000000000000000000000000000)⟩ +def w161S4 : Ball := ⟨(75099972004077191504004519847199 / 100000000000000000000000000000000), (3 / 6250000000000000000000000000000)⟩ +def w161S5 : Ball := ⟨(11280011590026355871190756294713 / 20000000000000000000000000000000), (73 / 100000000000000000000000000000000)⟩ +abbrev w161 : Ball := w161S5 +lemma w161_sound : w161.Encloses (weight (-5727) : ℝ) := by + exact weight_enclosed_of_trace (-5727) w161Trace w161S0 w161S1 w161S2 w161S3 w161S4 w161S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def w162Trace : List Ball := [ + ⟨(619434111109742672872101881827 / 625000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(99554065041458567318212628980773 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(49851244273627408968369860664707 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(8314730557070590414261063282771 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2079611669546806673581280761549 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(832092514716877638886863211217 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(138711600791553614976572603437 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(19819106077655074913960295067 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2477695845144186508964865621 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(137663441860955096051317891 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(13767463011980544164187139 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1251672315796811133375203 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(104312004222860339133223 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1003049313259818519859 / 6250000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1146390879526934542317 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(38214441699936646613 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w162S0 : Ball := ⟨(24556711552404289985960444543423 / 25000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +def w162S1 : Ball := ⟨(9648513316287781021461583728989 / 10000000000000000000000000000000), (7 / 100000000000000000000000000000000)⟩ +def w162S2 : Ball := ⟨(11636726151822829236426395337439 / 12500000000000000000000000000000), (7 / 50000000000000000000000000000000)⟩ +def w162S3 : Ball := ⟨(33853348883129337947084460193 / 39062500000000000000000000000), (27 / 100000000000000000000000000000000)⟩ +def w162S4 : Ball := ⟨(75107482376789976218464365803423 / 100000000000000000000000000000000), (3 / 6250000000000000000000000000000)⟩ +def w162S5 : Ball := ⟨(1128226781795963371037633404631 / 2000000000000000000000000000000), (73 / 100000000000000000000000000000000)⟩ +abbrev w162 : Ball := w162S5 +lemma w162_sound : w162.Encloses (weight (-5725) : ℝ) := by + exact weight_enclosed_of_trace (-5725) w162Trace w162S0 w162S1 w162S2 w162S3 w162S4 w162S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def w163Trace : List Ball := [ + ⟨(99109612636207588383042761611299 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(19910828540431287031887930425179 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(24925635099570361456902746281183 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1662946760131679510211124390033 / 10000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1039806159325550371919574181313 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(166418546235419795686819095227 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(138711631724316410816252377121 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(9909554972605342984570888507 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1238848137478982568804630471 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(13766346335513744910679457 / 5000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2753492993252364075293387 / 10000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(500668991468900620510401 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(208624033505942692182301 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(3209758160465075830609 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(573195499440136762941 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(38214445433903312541 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w163S0 : Ball := ⟨(49113576584495594384791232407879 / 50000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +def w163S1 : Ball := ⟨(48242868098422278692006694584529 / 50000000000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ +def w163S2 : Ball := ⟨(93094972894470800323293127473701 / 100000000000000000000000000000000), (3 / 25000000000000000000000000000000)⟩ +def w163S3 : Ball := ⟨(43333369891111265109535709654529 / 50000000000000000000000000000000), (23 / 100000000000000000000000000000000)⟩ +def w163S4 : Ball := ⟨(15022247568958946689407675643123 / 20000000000000000000000000000000), (41 / 100000000000000000000000000000000)⟩ +def w163S5 : Ball := ⟨(112833961011546491885255896167 / 200000000000000000000000000000), (31 / 50000000000000000000000000000000)⟩ +abbrev w163 : Ball := w163S5 +lemma w163_sound : w163.Encloses (weight (-5724) : ℝ) := by + exact weight_enclosed_of_trace (-5724) w163Trace w163S0 w163S1 w163S2 w163S3 w163S4 w163S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def w164Trace : List Ball := [ + ⟨(99110851514108511727445783934003 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(12444345498831186459821078600371 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(24925738801987869639265007531539 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2078689937358442567809446283023 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4159235022995227341200436946933 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(416047231431172874246590328011 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2774237583737068921265617493 / 2000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1981914088570388530250684267 / 10000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2477699713473026433525785411 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(55065454123526386661963749 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(6883740300265170489977517 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(156459222709647954144517 / 6250000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(104312116993960038792921 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(8024402561842530791283 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(143298994213478192113 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(19107237652818319981 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w164S0 : Ball := ⟨(24557402219629163679022063086829 / 25000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +def w164S1 : Ball := ⟨(19298112120852716000513826513021 / 20000000000000000000000000000000), (7 / 100000000000000000000000000000000)⟩ +def w164S2 : Ball := ⟨(93104282857250628092398681973637 / 100000000000000000000000000000000), (7 / 50000000000000000000000000000000)⟩ +def w164S3 : Ball := ⟨(86684074863629331800622572506157 / 100000000000000000000000000000000), (27 / 100000000000000000000000000000000)⟩ +def w164S4 : Ball := ⟨(3757064417481647279303531694389 / 5000000000000000000000000000000), (47 / 100000000000000000000000000000000)⟩ +def w164S5 : Ball := ⟨(56462132148426838393857212178007 / 100000000000000000000000000000000), (71 / 100000000000000000000000000000000)⟩ +abbrev w164 : Ball := w164S5 +lemma w164_sound : w164.Encloses (weight (-5716) : ℝ) := by + exact weight_enclosed_of_trace (-5716) w164Trace w164S0 w164S1 w164S2 w164S3 w164S4 w164S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def w165Trace : List Ball := [ + ⟨(12391353819820282077942459534297 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(49782391490975099421389581564271 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(49854822185765659678062573426323 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(8315178191335046182204493212229 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4159402498265178708594121176563 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(104015298392524905280765922373 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(34678967406739676741176426683 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(3963927962603058223634744251 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2477755160714533214109736021 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(6883320405790426691742141 / 2500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(27535465415209749018799647 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2503389585955010847487097 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(41725493361842105301341 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4012259014725993496217 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1146407350508321692401 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(9553739246834136157 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w165S0 : Ball := ⟨(49134607836151902617603829092007 / 50000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +def w165S1 : Ball := ⟨(24142096872124399539864750993007 / 25000000000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ +def w165S2 : Ball := ⟨(9325453462128619453896153019971 / 10000000000000000000000000000000), (3 / 25000000000000000000000000000000)⟩ +def w165S3 : Ball := ⟨(86964082274326654907249402101061 / 100000000000000000000000000000000), (23 / 100000000000000000000000000000000)⟩ +def w165S4 : Ball := ⟨(18906879014539638748836480975341 / 25000000000000000000000000000000), (41 / 100000000000000000000000000000000)⟩ +def w165S5 : Ball := ⟨(57195211851270301002772250899171 / 100000000000000000000000000000000), (63 / 100000000000000000000000000000000)⟩ +abbrev w165 : Ball := w165S5 +lemma w165_sound : w165.Encloses (weight (-5587) : ℝ) := by + exact weight_enclosed_of_trace (-5587) w165Trace w165S0 w165S1 w165S2 w165S3 w165S4 w165S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def w166Trace : List Ball := [ + ⟨(49567196568400074621563777287201 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(99566569455051129474903859162923 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(6231927317740769591605188167889 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(519703300049760126378485466887 / 3125000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2079716179689007767369186270759 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(832127366056204966590266012787 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(138716581121882587268706892411 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1981972877139342863344316069 / 10000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2477765046891460692809104417 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(137666902502916803511391127 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1101422212625389516795113 / 4000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2503397078493484707921743 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(208628043213477450291081 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(3209815446810398298077 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(8956328872774181351 / 781250000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(9553760717142465241 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w166S0 : Ball := ⟨(49138139513008242668839999607787 / 50000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +def w166S1 : Ball := ⟨(12072783773999309679959193925731 / 12500000000000000000000000000000), (7 / 100000000000000000000000000000000)⟩ +def w166S2 : Ball := ⟨(93281349154394249540367986748103 / 100000000000000000000000000000000), (7 / 50000000000000000000000000000000)⟩ +def w166S3 : Ball := ⟨(43507050500320043868869479058439 / 50000000000000000000000000000000), (27 / 100000000000000000000000000000000)⟩ +def w166S4 : Ball := ⟨(1183039652023374112206463771679 / 1562500000000000000000000000000), (3 / 6250000000000000000000000000000)⟩ +def w166S5 : Ball := ⟨(2866345611795632347426066543241 / 5000000000000000000000000000000), (37 / 50000000000000000000000000000000)⟩ +abbrev w166 : Ball := w166S5 +lemma w166_sound : w166.Encloses (weight (-5564) : ℝ) := by + exact weight_enclosed_of_trace (-5564) w166Trace w166S0 w166S1 w166S2 w166S3 w166S4 w166S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def w167Trace : List Ball := [ + ⟨(49567428915178551333528701680047 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(99566802476434866585733114464997 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(49855496328301633722497166409301 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(831526253254400445979261805857 / 5000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(519929531791515872417630635167 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(3250500060483585382854515973 / 390625000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(34679168481509809676741427653 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(619366886709765085140004591 / 3125000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(309720792049754293992057971 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(275333933976859620205857911 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(6883891760454200890926997 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(312924756973020519321437 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(208628118396860758420671 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(8024541302369005369087 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1146410453786454087371 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(38215054070469858747 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w167S0 : Ball := ⟨(49138600185225574765795132677093 / 50000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +def w167S1 : Ball := ⟨(19316816225307607125452119683619 / 20000000000000000000000000000000), (7 / 100000000000000000000000000000000)⟩ +def w167S2 : Ball := ⟨(46642423635288403906101606759247 / 50000000000000000000000000000000), (7 / 50000000000000000000000000000000)⟩ +def w167S3 : Ball := ⟨(2175515682573710327557842984451 / 2500000000000000000000000000000), (27 / 100000000000000000000000000000000)⟩ +def w167S4 : Ball := ⟨(75725895761986508054144510231683 / 100000000000000000000000000000000), (3 / 6250000000000000000000000000000)⟩ +def w167S5 : Ball := ⟨(11468822577910492362546082899621 / 20000000000000000000000000000000), (37 / 50000000000000000000000000000000)⟩ +abbrev w167 : Ball := w167S5 +lemma w167_sound : w167.Encloses (weight (-5561) : ℝ) := by + exact weight_enclosed_of_trace (-5561) w167Trace w167S0 w167S1 w167S2 w167S3 w167S4 w167S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def w168Trace : List Ball := [ + ⟨(99135012728693476893808538075059 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(19913376030078229782825022732461 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(49855522257133937942432959734661 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(16630531552928006626421901046179 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(259964847040719713991119571851 / 6250000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(832128231959855287338534336791 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(138716704860782272782618307009 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(9909872121244092447227734071 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2477766766233827382538325107 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(68833494241806509117514343 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(27535570950546193440669937 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2503398381547880505022421 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(52157035864499927562303 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(8024542197483714698641 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1146410573143620386769 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(76430115608873049349 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w168S0 : Ball := ⟨(98277507487182176833730475631343 / 100000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +def w168S1 : Ball := ⟨(3863387391157259530180337093759 / 4000000000000000000000000000000), (7 / 100000000000000000000000000000000)⟩ +def w168S2 : Ball := ⟨(9328601333845559908157079455093 / 10000000000000000000000000000000), (7 / 50000000000000000000000000000000)⟩ +def w168S3 : Ball := ⟨(43511401422912579731222974757309 / 50000000000000000000000000000000), (27 / 100000000000000000000000000000000)⟩ +def w168S4 : Ball := ⟨(75729682151433554724579209802973 / 100000000000000000000000000000000), (3 / 6250000000000000000000000000000)⟩ +def w168S5 : Ball := ⟨(5734984758757153909776083780903 / 10000000000000000000000000000000), (73 / 100000000000000000000000000000000)⟩ +abbrev w168 : Ball := w168S5 +lemma w168_sound : w168.Encloses (weight (-5560) : ℝ) := by + exact weight_enclosed_of_trace (-5560) w168Trace w168S0 w168S1 w168S2 w168S3 w168S4 w168S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def w169Trace : List Ball := [ + ⟨(9913965979132981403710742545553 / 10000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(388942228151078645068975833847 / 390625000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(49856300131514428914828098102571 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(3326145238002368698373136143019 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(41594765025473475357379763121 / 1000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(832134726286481698799607038491 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(138717632908688264301054014297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(3963972055276663154224945337 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(154861228835627477154019213 / 6250000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(275335266683894309248615899 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(27535688212900950678601777 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(9778938103499084066701 / 390625000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(52157223823692048600501 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(16049138102023336286131 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(573207076934730604663 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4776896227929562813 / 6250000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w169S0 : Ball := ⟨(98286721435406174665473615960613 / 100000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +def w169S1 : Ball := ⟨(12075349513151414514529855232981 / 12500000000000000000000000000000), (7 / 100000000000000000000000000000000)⟩ +def w169S2 : Ball := ⟨(93321002153450306264064872946103 / 100000000000000000000000000000000), (7 / 50000000000000000000000000000000)⟩ +def w169S3 : Ball := ⟨(43544047214621383495429087826007 / 50000000000000000000000000000000), (27 / 100000000000000000000000000000000)⟩ +def w169S4 : Ball := ⟨(1185052529893235166451447015261 / 1562500000000000000000000000000), (3 / 6250000000000000000000000000000)⟩ +def w169S5 : Ball := ⟨(11504431092583276771638604143613 / 20000000000000000000000000000000), (37 / 50000000000000000000000000000000)⟩ +abbrev w169 : Ball := w169S5 +lemma w169_sound : w169.Encloses (weight (-5530) : ℝ) := by + exact weight_enclosed_of_trace (-5530) w169Trace w169S0 w169S1 w169S2 w169S3 w169S4 w169S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def w170Trace : List Ball := [ + ⟨(99140124509574268430126188159637 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(9956944343630689428609364534693 / 10000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(49856377919954343567951325848481 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(8315372826960386874538760355739 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4159480397570375838077331521707 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(208033843930981106259023555911 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2167464464282446711125582937 / 1562500000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(19819871879839262020085360847 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(309722618861288217925225173 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(137667697828082667826008839 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(27535699939186784706989133 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(625852282948607072717539 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(208628970478721810464127 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1003071467046711257277 / 6250000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1146414511943200487519 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(38215181025336500287 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w170S0 : Ball := ⟨(49143821438869442892049631528429 / 50000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +def w170S1 : Ball := ⟨(48302303712309677606392134685523 / 50000000000000000000000000000000), (7 / 100000000000000000000000000000000)⟩ +def w170S2 : Ball := ⟨(93324501756648210501504482580647 / 100000000000000000000000000000000), (7 / 50000000000000000000000000000000)⟩ +def w170S3 : Ball := ⟨(21773656570316587319270614068333 / 25000000000000000000000000000000), (27 / 100000000000000000000000000000000)⟩ +def w170S4 : Ball := ⟨(37927369635367255362282465181161 / 50000000000000000000000000000000), (3 / 6250000000000000000000000000000)⟩ +def w170S5 : Ball := ⟨(28769707349155561859531613298219 / 50000000000000000000000000000000), (73 / 100000000000000000000000000000000)⟩ +abbrev w170 : Ball := w170S5 +lemma w170_sound : w170.Encloses (weight (-5527) : ℝ) := by + exact weight_enclosed_of_trace (-5527) w170Trace w170S0 w170S1 w170S2 w170S3 w170S4 w170S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def w171Trace : List Ball := [ + ⟨(99201331441303695560929899221503 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(12450016503449796400157455627393 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(49866621655698057520231330426331 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1663330872042930379032512220349 / 10000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1039998323846075645878237355477 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(416110446289264732889617755811 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(138729946039453475179775116017 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(3964279954741417530507195553 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1238975374138962887313613479 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(55070475592938652606248421 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(13768621990063507051042087 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(100141512624169854269779 / 4000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(41727774027760455450923 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(20062313309230325407 / 125000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(3582692687979062273 / 312500000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(76433311884339083413 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w171S0 : Ball := ⟨(49204520798636945722375134583359 / 50000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +def w171S1 : Ball := ⟨(3873735787237593239827223339173 / 4000000000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ +def w171S2 : Ball := ⟨(2930825966665089109529771101407 / 3125000000000000000000000000000), (13 / 100000000000000000000000000000000)⟩ +def w171S3 : Ball := ⟨(87958946272034345167561583735759 / 100000000000000000000000000000000), (1 / 4000000000000000000000000000000)⟩ +def w171S4 : Ball := ⟨(38683881146433123137402527708601 / 50000000000000000000000000000000), (9 / 20000000000000000000000000000000)⟩ +def w171S5 : Ball := ⟨(29928853211027280825078232274623 / 50000000000000000000000000000000), (71 / 100000000000000000000000000000000)⟩ +abbrev w171 : Ball := w171S5 +lemma w171_sound : w171.Encloses (weight (-5132) : ℝ) := by + exact weight_enclosed_of_trace (-5132) w171Trace w171S0 w171S1 w171S2 w171S3 w171S4 w171S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def w172Trace : List Ball := [ + ⟨(99256062268025073283179041298053 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(99627568207564992417956386115501 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(49875778857167786672507404494561 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(8317799896695598409213342067489 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4160451746453379969363636802819 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(832297329253711293981818971017 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(34685217145747289441786560093 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(3964553077038205395074076199 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2478102508985383649585449243 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(275367556171116520739500293 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(6884655994723106459858533 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(312956603364131627925287 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(104323858957529464936743 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(16050482677990865853451 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(573251899108516154297 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(7643594806480522833 / 10000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w172S0 : Ball := ⟨(98517658969540706545369648688137 / 100000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +def w172S1 : Ball := ⟨(48528645644193622145196793572853 / 50000000000000000000000000000000), (7 / 100000000000000000000000000000000)⟩ +def w172S2 : Ball := ⟨(23550294480597126156822101134191 / 25000000000000000000000000000000), (3 / 20000000000000000000000000000000)⟩ +def w172S3 : Ball := ⟨(88738619219654954251215815201959 / 100000000000000000000000000000000), (29 / 100000000000000000000000000000000)⟩ +def w172S4 : Ball := ⟨(39372712705054578208852199755329 / 50000000000000000000000000000000), (13 / 25000000000000000000000000000000)⟩ +def w172S5 : Ball := ⟨(31004210115095324025983705526571 / 50000000000000000000000000000000), (83 / 100000000000000000000000000000000)⟩ +abbrev w172 : Ball := w172S5 +lemma w172_sound : w172.Encloses (weight (-4779) : ℝ) := by + exact weight_enclosed_of_trace (-4779) w172Trace w172S0 w172S1 w172S2 w172S3 w172S4 w172S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def w173Trace : List Ball := [ + ⟨(99265057756270017574394851114287 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(19926415419919032085884146869581 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(9975456736246444616425757989447 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(8317988139311292886843299488397 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4160527080748098179886321016463 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(166461977881119743250210384667 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(6937133168292257282991976263 / 5000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(19822989779283132088877933221 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2478127445772903159613521919 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(275370050186248556375250827 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1721178170814235546048427 / 6250000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1251835862444188318236803 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(208649171723989464144729 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(3210117305764728418469 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1146510722029740417409 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(76436381204938475937 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w173S0 : Ball := ⟨(98535516913556223757709527547079 / 100000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +def w173S1 : Ball := ⟨(19418496186843449281079417032763 / 20000000000000000000000000000000), (7 / 100000000000000000000000000000000)⟩ +def w173S2 : Ball := ⟨(5891843658725837185815025154959 / 6250000000000000000000000000000), (7 / 50000000000000000000000000000000)⟩ +def w173S3 : Ball := ⟨(88867383549101720075511005852219 / 100000000000000000000000000000000), (27 / 100000000000000000000000000000000)⟩ +def w173S4 : Ball := ⟨(9871764823578943786663937431817 / 12500000000000000000000000000000), (49 / 100000000000000000000000000000000)⟩ +def w173S5 : Ball := ⟨(31184557034256196846304679690331 / 50000000000000000000000000000000), (39 / 50000000000000000000000000000000)⟩ +abbrev w173 : Ball := w173S5 +lemma w173_sound : w173.Encloses (weight (-4721) : ℝ) := by + exact weight_enclosed_of_trace (-4721) w173Trace w173S0 w173S1 w173S2 w173S3 w173S4 w173S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def w174Trace : List Ball := [ + ⟨(24829839545287398291214359318369 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(99659291709965768586419616786887 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(49886365962458957833778370256761 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(16638248461740330904105018456463 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(832196346504456098808275201567 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(832385690324216536304283150789 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(17344186851828817735990529287 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(9912171988714491033788485387 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(309784741996965495571705651 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(275385101149385554831538297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2754021914960994833729881 / 10000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(625946442496172601546883 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(208657945108245628761047 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(16051213241507906628761 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(573276252662217021773 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(9554874372700578161 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w174S0 : Ball := ⟨(12330418636894358278756040958559 / 12500000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +def w174S1 : Ball := ⟨(97305103207085903662123915133933 / 100000000000000000000000000000000), (7 / 100000000000000000000000000000000)⟩ +def w174S2 : Ball := ⟨(94682831101416394142666610172997 / 100000000000000000000000000000000), (7 / 50000000000000000000000000000000)⟩ +def w174S3 : Ball := ⟨(44824192526896718123821350408031 / 50000000000000000000000000000000), (27 / 100000000000000000000000000000000)⟩ +def w174S4 : Ball := ⟨(16073665885506428738593980307451 / 20000000000000000000000000000000), (49 / 100000000000000000000000000000000)⟩ +def w174S5 : Ball := ⟨(64590683749723291475674939583937 / 100000000000000000000000000000000), (79 / 100000000000000000000000000000000)⟩ +abbrev w174 : Ball := w174S5 +lemma w174_sound : w174.Encloses (weight (-4371) : ℝ) := by + exact weight_enclosed_of_trace (-4371) w174Trace w174S0 w174S1 w174S2 w174S3 w174S4 w174S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +lemma B1_5_2_below : below (shape 1 5 2) = [ + (shape 0 2 2), + (shape 0 3 1), + (shape 0 4 0), + (shape 1 1 2), + (shape 1 2 1), + (shape 1 3 0)] := by decide +kernel +def B1_5_2Raw (s : Shape) : Ball := + match s 0, s 1, s 2 with + | 0, 2, 2 => ⟨(56462132148426838393857212178007 / 100000000000000000000000000000000), (71 / 100000000000000000000000000000000)⟩ + | 0, 3, 1 => ⟨1, 0⟩ + | 0, 4, 0 => ⟨(2259560185112186440866498136737 / 100000000000000000000000000000000), (7 / 100000000000000000000000000000000)⟩ + | 1, 1, 2 => ⟨(2259560185112186440866498136737 / 100000000000000000000000000000000), (7 / 100000000000000000000000000000000)⟩ + | 1, 2, 1 => ⟨1, 0⟩ + | 1, 3, 0 => ⟨(56462132148426838393857212178007 / 100000000000000000000000000000000), (71 / 100000000000000000000000000000000)⟩ + | _, _, _ => (.exact 0) +lemma B1_5_2Raw_0_2_2 : (B1_5_2Raw (shape 0 2 2)).Encloses (splitWeight positiveSecond tablep (shape 1 5 2) (shape 0 2 2) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveSecond tablep (shape 1 5 2) (shape 0 2 2) + (0) (0) (-5716) w195 w195 w164 + (by decide +kernel) w195_sound w195_sound w164_sound) (by decide +kernel) +lemma B1_5_2Raw_0_3_1 : (B1_5_2Raw (shape 0 3 1)).Encloses (splitWeight positiveSecond tablep (shape 1 5 2) (shape 0 3 1) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveSecond tablep (shape 1 5 2) (shape 0 3 1) + (0) (0) (0) w195 w195 w195 + (by decide +kernel) w195_sound w195_sound w195_sound) (by decide +kernel) +lemma B1_5_2Raw_0_4_0 : (B1_5_2Raw (shape 0 4 0)).Encloses (splitWeight positiveSecond tablep (shape 1 5 2) (shape 0 4 0) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveSecond tablep (shape 1 5 2) (shape 0 4 0) + (0) (-32184) (-5716) w195 w64 w164 + (by decide +kernel) w195_sound w64_sound w164_sound) (by decide +kernel) +lemma B1_5_2Raw_1_1_2 : (B1_5_2Raw (shape 1 1 2)).Encloses (splitWeight positiveSecond tablep (shape 1 5 2) (shape 1 1 2) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveSecond tablep (shape 1 5 2) (shape 1 1 2) + (0) (-32184) (-5716) w195 w64 w164 + (by decide +kernel) w195_sound w64_sound w164_sound) (by decide +kernel) +lemma B1_5_2Raw_1_2_1 : (B1_5_2Raw (shape 1 2 1)).Encloses (splitWeight positiveSecond tablep (shape 1 5 2) (shape 1 2 1) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveSecond tablep (shape 1 5 2) (shape 1 2 1) + (0) (0) (0) w195 w195 w195 + (by decide +kernel) w195_sound w195_sound w195_sound) (by decide +kernel) +lemma B1_5_2Raw_1_3_0 : (B1_5_2Raw (shape 1 3 0)).Encloses (splitWeight positiveSecond tablep (shape 1 5 2) (shape 1 3 0) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveSecond tablep (shape 1 5 2) (shape 1 3 0) + (0) (0) (-5716) w195 w195 w164 + (by decide +kernel) w195_sound w195_sound w164_sound) (by decide +kernel) +lemma B1_5_2Raw_sound (u : Shape) (hu : u ∈ below (shape 1 5 2)) : + (B1_5_2Raw u).Encloses (splitWeight positiveSecond tablep (shape 1 5 2) u : ℝ) := by + rw [B1_5_2_below] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl | rfl | rfl + · exact B1_5_2Raw_0_2_2 + · exact B1_5_2Raw_0_3_1 + · exact B1_5_2Raw_0_4_0 + · exact B1_5_2Raw_1_1_2 + · exact B1_5_2Raw_1_2_1 + · exact B1_5_2Raw_1_3_0 +def B1_5_2Den : Ball := ⟨(19840211541692378104340463789343 / 6250000000000000000000000000000), (39 / 25000000000000000000000000000000)⟩ +lemma B1_5_2Den_sound : B1_5_2Den.Encloses (((below (shape 1 5 2)).map (splitWeight positiveSecond tablep (shape 1 5 2))).sum : ℝ) := by + exact contains_sound (list_cast_enclosed (below (shape 1 5 2)) B1_5_2Raw (splitWeight positiveSecond tablep (shape 1 5 2)) B1_5_2Raw_sound) (by decide +kernel) +lemma B1_5_2Den_positive : 0 < B1_5_2Den.lower := by decide +kernel +def B1_5_2Table (s : Shape) : Ball := + match s 0, s 1, s 2 with + | 0, 2, 2 => ⟨(17786520329488695683714185635709 / 100000000000000000000000000000000), (1 / 3125000000000000000000000000000)⟩ + | 0, 3, 1 => ⟨(31501680246030645200554309297569 / 100000000000000000000000000000000), (1 / 6250000000000000000000000000000)⟩ + | 0, 4, 0 => ⟨(355899712240329557865752533361 / 50000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ + | 1, 1, 2 => ⟨(355899712240329557865752533361 / 50000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ + | 1, 2, 1 => ⟨(31501680246030645200554309297569 / 100000000000000000000000000000000), (1 / 6250000000000000000000000000000)⟩ + | 1, 3, 0 => ⟨(17786520329488695683714185635709 / 100000000000000000000000000000000), (1 / 3125000000000000000000000000000)⟩ + | _, _, _ => (.exact 0) +def B1_5_2Law (u : Shape) : Ball := if u ∈ below (shape 1 5 2) then B1_5_2Table u else .exact 0 +lemma B1_5_2Law_check_0_2_2 : contains (.mul (B1_5_2Raw (shape 0 2 2)) (.inv B1_5_2Den)) (B1_5_2Table (shape 0 2 2)) = true := by decide +kernel +lemma B1_5_2Law_check_0_3_1 : contains (.mul (B1_5_2Raw (shape 0 3 1)) (.inv B1_5_2Den)) (B1_5_2Table (shape 0 3 1)) = true := by decide +kernel +lemma B1_5_2Law_check_0_4_0 : contains (.mul (B1_5_2Raw (shape 0 4 0)) (.inv B1_5_2Den)) (B1_5_2Table (shape 0 4 0)) = true := by decide +kernel +lemma B1_5_2Law_check_1_1_2 : contains (.mul (B1_5_2Raw (shape 1 1 2)) (.inv B1_5_2Den)) (B1_5_2Table (shape 1 1 2)) = true := by decide +kernel +lemma B1_5_2Law_check_1_2_1 : contains (.mul (B1_5_2Raw (shape 1 2 1)) (.inv B1_5_2Den)) (B1_5_2Table (shape 1 2 1)) = true := by decide +kernel +lemma B1_5_2Law_check_1_3_0 : contains (.mul (B1_5_2Raw (shape 1 3 0)) (.inv B1_5_2Den)) (B1_5_2Table (shape 1 3 0)) = true := by decide +kernel +lemma B1_5_2Law_check (u : Shape) (hu : u ∈ below (shape 1 5 2)) : + contains (.mul (B1_5_2Raw u) (.inv B1_5_2Den)) (B1_5_2Table u) = true := by + rw [B1_5_2_below] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl | rfl | rfl + · exact B1_5_2Law_check_0_2_2 + · exact B1_5_2Law_check_0_3_1 + · exact B1_5_2Law_check_0_4_0 + · exact B1_5_2Law_check_1_1_2 + · exact B1_5_2Law_check_1_2_1 + · exact B1_5_2Law_check_1_3_0 +lemma B1_5_2Law_sound (u : Shape) : + (B1_5_2Law u).Encloses (stageBLaw (shape 1 5 2) u : ℝ) := by + by_cases hu : u ∈ below (shape 1 5 2) + · have h := contains_sound (Ball.mul_sound (B1_5_2Raw_sound u hu) + (Ball.inv_sound B1_5_2Den_sound B1_5_2Den_positive)) (B1_5_2Law_check u hu) + simpa only [B1_5_2Law, hu, ite_true, stageBLaw, splitLaw, + Rat.cast_div, Rat.cast_mul, Rat.cast_inv, div_eq_mul_inv] using h + · simp only [B1_5_2Law, hu, ite_false, stageBLaw, splitLaw, Rat.cast_zero] + simpa only [Rat.cast_zero] using Ball.exact_sound 0 + +lemma B2_5_1_below : below (shape 2 5 1) = [ + (shape 0 3 1), + (shape 0 4 0), + (shape 1 2 1), + (shape 1 3 0), + (shape 2 1 1), + (shape 2 2 0)] := by decide +kernel +def B2_5_1Raw (s : Shape) : Ball := + match s 0, s 1, s 2 with + | 0, 3, 1 => ⟨(112833961011546491885255896167 / 200000000000000000000000000000), (31 / 50000000000000000000000000000000)⟩ + | 0, 4, 0 => ⟨(2250539996775325991305899209651 / 100000000000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ + | 1, 2, 1 => ⟨1, 0⟩ + | 1, 3, 0 => ⟨1, 0⟩ + | 2, 1, 1 => ⟨(2250539996775325991305899209651 / 100000000000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ + | 2, 2, 0 => ⟨(112833961011546491885255896167 / 200000000000000000000000000000), (31 / 50000000000000000000000000000000)⟩ + | _, _, _ => (.exact 0) +lemma B2_5_1Raw_0_3_1 : (B2_5_1Raw (shape 0 3 1)).Encloses (splitWeight positiveSecond tablep (shape 2 5 1) (shape 0 3 1) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveSecond tablep (shape 2 5 1) (shape 0 3 1) + (-5724) (0) (0) w163 w195 w195 + (by decide +kernel) w163_sound w195_sound w195_sound) (by decide +kernel) +lemma B2_5_1Raw_0_4_0 : (B2_5_1Raw (shape 0 4 0)).Encloses (splitWeight positiveSecond tablep (shape 2 5 1) (shape 0 4 0) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveSecond tablep (shape 2 5 1) (shape 0 4 0) + (-5724) (-32216) (0) w163 w63 w195 + (by decide +kernel) w163_sound w63_sound w195_sound) (by decide +kernel) +lemma B2_5_1Raw_1_2_1 : (B2_5_1Raw (shape 1 2 1)).Encloses (splitWeight positiveSecond tablep (shape 2 5 1) (shape 1 2 1) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveSecond tablep (shape 2 5 1) (shape 1 2 1) + (0) (0) (0) w195 w195 w195 + (by decide +kernel) w195_sound w195_sound w195_sound) (by decide +kernel) +lemma B2_5_1Raw_1_3_0 : (B2_5_1Raw (shape 1 3 0)).Encloses (splitWeight positiveSecond tablep (shape 2 5 1) (shape 1 3 0) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveSecond tablep (shape 2 5 1) (shape 1 3 0) + (0) (0) (0) w195 w195 w195 + (by decide +kernel) w195_sound w195_sound w195_sound) (by decide +kernel) +lemma B2_5_1Raw_2_1_1 : (B2_5_1Raw (shape 2 1 1)).Encloses (splitWeight positiveSecond tablep (shape 2 5 1) (shape 2 1 1) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveSecond tablep (shape 2 5 1) (shape 2 1 1) + (-5724) (-32216) (0) w163 w63 w195 + (by decide +kernel) w163_sound w63_sound w195_sound) (by decide +kernel) +lemma B2_5_1Raw_2_2_0 : (B2_5_1Raw (shape 2 2 0)).Encloses (splitWeight positiveSecond tablep (shape 2 5 1) (shape 2 2 0) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveSecond tablep (shape 2 5 1) (shape 2 2 0) + (-5724) (0) (0) w163 w195 w195 + (by decide +kernel) w163_sound w195_sound w195_sound) (by decide +kernel) +lemma B2_5_1Raw_sound (u : Shape) (hu : u ∈ below (shape 2 5 1)) : + (B2_5_1Raw u).Encloses (splitWeight positiveSecond tablep (shape 2 5 1) u : ℝ) := by + rw [B2_5_1_below] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl | rfl | rfl + · exact B2_5_1Raw_0_3_1 + · exact B2_5_1Raw_0_4_0 + · exact B2_5_1Raw_1_2_1 + · exact B2_5_1Raw_1_3_0 + · exact B2_5_1Raw_2_1_1 + · exact B2_5_1Raw_2_2_0 +def B2_5_1Den : Ball := ⟨(158667520502548571933933847293151 / 50000000000000000000000000000000), (17 / 12500000000000000000000000000000)⟩ +lemma B2_5_1Den_sound : B2_5_1Den.Encloses (((below (shape 2 5 1)).map (splitWeight positiveSecond tablep (shape 2 5 1))).sum : ℝ) := by + exact contains_sound (list_cast_enclosed (below (shape 2 5 1)) B2_5_1Raw (splitWeight positiveSecond tablep (shape 2 5 1)) B2_5_1Raw_sound) (by decide +kernel) +lemma B2_5_1Den_positive : 0 < B2_5_1Den.lower := by decide +kernel +def B2_5_1Table (s : Shape) : Ball := + match s 0, s 1, s 2 with + | 0, 3, 1 => ⟨(3555672914474456486072088812043 / 20000000000000000000000000000000), (7 / 25000000000000000000000000000000)⟩ + | 0, 4, 0 => ⟨(354599982032740129828053827979 / 50000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ + | 1, 2, 1 => ⟨(31512435463562237309983448283827 / 100000000000000000000000000000000), (7 / 50000000000000000000000000000000)⟩ + | 1, 3, 0 => ⟨(31512435463562237309983448283827 / 100000000000000000000000000000000), (7 / 50000000000000000000000000000000)⟩ + | 2, 1, 1 => ⟨(354599982032740129828053827979 / 50000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ + | 2, 2, 0 => ⟨(3555672914474456486072088812043 / 20000000000000000000000000000000), (7 / 25000000000000000000000000000000)⟩ + | _, _, _ => (.exact 0) +def B2_5_1Law (u : Shape) : Ball := if u ∈ below (shape 2 5 1) then B2_5_1Table u else .exact 0 +lemma B2_5_1Law_check_0_3_1 : contains (.mul (B2_5_1Raw (shape 0 3 1)) (.inv B2_5_1Den)) (B2_5_1Table (shape 0 3 1)) = true := by decide +kernel +lemma B2_5_1Law_check_0_4_0 : contains (.mul (B2_5_1Raw (shape 0 4 0)) (.inv B2_5_1Den)) (B2_5_1Table (shape 0 4 0)) = true := by decide +kernel +lemma B2_5_1Law_check_1_2_1 : contains (.mul (B2_5_1Raw (shape 1 2 1)) (.inv B2_5_1Den)) (B2_5_1Table (shape 1 2 1)) = true := by decide +kernel +lemma B2_5_1Law_check_1_3_0 : contains (.mul (B2_5_1Raw (shape 1 3 0)) (.inv B2_5_1Den)) (B2_5_1Table (shape 1 3 0)) = true := by decide +kernel +lemma B2_5_1Law_check_2_1_1 : contains (.mul (B2_5_1Raw (shape 2 1 1)) (.inv B2_5_1Den)) (B2_5_1Table (shape 2 1 1)) = true := by decide +kernel +lemma B2_5_1Law_check_2_2_0 : contains (.mul (B2_5_1Raw (shape 2 2 0)) (.inv B2_5_1Den)) (B2_5_1Table (shape 2 2 0)) = true := by decide +kernel +lemma B2_5_1Law_check (u : Shape) (hu : u ∈ below (shape 2 5 1)) : + contains (.mul (B2_5_1Raw u) (.inv B2_5_1Den)) (B2_5_1Table u) = true := by + rw [B2_5_1_below] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl | rfl | rfl + · exact B2_5_1Law_check_0_3_1 + · exact B2_5_1Law_check_0_4_0 + · exact B2_5_1Law_check_1_2_1 + · exact B2_5_1Law_check_1_3_0 + · exact B2_5_1Law_check_2_1_1 + · exact B2_5_1Law_check_2_2_0 +lemma B2_5_1Law_sound (u : Shape) : + (B2_5_1Law u).Encloses (stageBLaw (shape 2 5 1) u : ℝ) := by + by_cases hu : u ∈ below (shape 2 5 1) + · have h := contains_sound (Ball.mul_sound (B2_5_1Raw_sound u hu) + (Ball.inv_sound B2_5_1Den_sound B2_5_1Den_positive)) (B2_5_1Law_check u hu) + simpa only [B2_5_1Law, hu, ite_true, stageBLaw, splitLaw, + Rat.cast_div, Rat.cast_mul, Rat.cast_inv, div_eq_mul_inv] using h + · simp only [B2_5_1Law, hu, ite_false, stageBLaw, splitLaw, Rat.cast_zero] + simpa only [Rat.cast_zero] using Ball.exact_sound 0 + +lemma B3_2_3_below : below (shape 3 2 3) = [ + (shape 0 1 3), + (shape 0 2 2), + (shape 1 0 3), + (shape 1 1 2), + (shape 1 2 1), + (shape 2 0 2), + (shape 2 1 1), + (shape 2 2 0), + (shape 3 0 1), + (shape 3 1 0)] := by decide +kernel +def B3_2_3Raw (s : Shape) : Ball := + match s 0, s 1, s 2 with + | 0, 1, 3 => ⟨(512717732641430446854909688781 / 100000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ + | 0, 2, 2 => ⟨(231490015436085315425174308889 / 6250000000000000000000000000000), (1 / 10000000000000000000000000000000)⟩ + | 1, 0, 3 => ⟨(147355736582479520245291292481 / 4000000000000000000000000000000), (11 / 100000000000000000000000000000000)⟩ + | 1, 1, 2 => ⟨1, 0⟩ + | 1, 2, 1 => ⟨(12896756232056427378688678611447 / 25000000000000000000000000000000), (13 / 20000000000000000000000000000000)⟩ + | 2, 0, 2 => ⟨(12896756232056427378688678611447 / 25000000000000000000000000000000), (13 / 20000000000000000000000000000000)⟩ + | 2, 1, 1 => ⟨1, 0⟩ + | 2, 2, 0 => ⟨(147355736582479520245291292481 / 4000000000000000000000000000000), (11 / 100000000000000000000000000000000)⟩ + | 3, 0, 1 => ⟨(231490015436085315425174308889 / 6250000000000000000000000000000), (1 / 10000000000000000000000000000000)⟩ + | 3, 1, 0 => ⟨(512717732641430446854909688781 / 100000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ + | _, _, _ => (.exact 0) +lemma B3_2_3Raw_0_1_3 : (B3_2_3Raw (shape 0 1 3)).Encloses (splitWeight positiveSecond tablep (shape 3 2 3) (shape 0 1 3) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveSecond tablep (shape 3 2 3) (shape 0 1 3) + (-26339) (0) (-26393) w74 w195 w71 + (by decide +kernel) w74_sound w195_sound w71_sound) (by decide +kernel) +lemma B3_2_3Raw_0_2_2 : (B3_2_3Raw (shape 0 2 2)).Encloses (splitWeight positiveSecond tablep (shape 3 2 3) (shape 0 2 2) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveSecond tablep (shape 3 2 3) (shape 0 2 2) + (-26339) (-6619) (0) w74 w155 w195 + (by decide +kernel) w74_sound w155_sound w195_sound) (by decide +kernel) +lemma B3_2_3Raw_1_0_3 : (B3_2_3Raw (shape 1 0 3)).Encloses (splitWeight positiveSecond tablep (shape 3 2 3) (shape 1 0 3) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveSecond tablep (shape 3 2 3) (shape 1 0 3) + (0) (-6619) (-26393) w195 w155 w71 + (by decide +kernel) w195_sound w155_sound w71_sound) (by decide +kernel) +lemma B3_2_3Raw_1_1_2 : (B3_2_3Raw (shape 1 1 2)).Encloses (splitWeight positiveSecond tablep (shape 3 2 3) (shape 1 1 2) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveSecond tablep (shape 3 2 3) (shape 1 1 2) + (0) (0) (0) w195 w195 w195 + (by decide +kernel) w195_sound w195_sound w195_sound) (by decide +kernel) +lemma B3_2_3Raw_1_2_1 : (B3_2_3Raw (shape 1 2 1)).Encloses (splitWeight positiveSecond tablep (shape 3 2 3) (shape 1 2 1) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveSecond tablep (shape 3 2 3) (shape 1 2 1) + (0) (-6619) (0) w195 w155 w195 + (by decide +kernel) w195_sound w155_sound w195_sound) (by decide +kernel) +lemma B3_2_3Raw_2_0_2 : (B3_2_3Raw (shape 2 0 2)).Encloses (splitWeight positiveSecond tablep (shape 3 2 3) (shape 2 0 2) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveSecond tablep (shape 3 2 3) (shape 2 0 2) + (0) (-6619) (0) w195 w155 w195 + (by decide +kernel) w195_sound w155_sound w195_sound) (by decide +kernel) +lemma B3_2_3Raw_2_1_1 : (B3_2_3Raw (shape 2 1 1)).Encloses (splitWeight positiveSecond tablep (shape 3 2 3) (shape 2 1 1) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveSecond tablep (shape 3 2 3) (shape 2 1 1) + (0) (0) (0) w195 w195 w195 + (by decide +kernel) w195_sound w195_sound w195_sound) (by decide +kernel) +lemma B3_2_3Raw_2_2_0 : (B3_2_3Raw (shape 2 2 0)).Encloses (splitWeight positiveSecond tablep (shape 3 2 3) (shape 2 2 0) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveSecond tablep (shape 3 2 3) (shape 2 2 0) + (0) (-6619) (-26393) w195 w155 w71 + (by decide +kernel) w195_sound w155_sound w71_sound) (by decide +kernel) +lemma B3_2_3Raw_3_0_1 : (B3_2_3Raw (shape 3 0 1)).Encloses (splitWeight positiveSecond tablep (shape 3 2 3) (shape 3 0 1) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveSecond tablep (shape 3 2 3) (shape 3 0 1) + (-26339) (-6619) (0) w74 w155 w195 + (by decide +kernel) w74_sound w155_sound w195_sound) (by decide +kernel) +lemma B3_2_3Raw_3_1_0 : (B3_2_3Raw (shape 3 1 0)).Encloses (splitWeight positiveSecond tablep (shape 3 2 3) (shape 3 1 0) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveSecond tablep (shape 3 2 3) (shape 3 1 0) + (-26339) (0) (-26393) w74 w195 w71 + (by decide +kernel) w74_sound w195_sound w71_sound) (by decide +kernel) +lemma B3_2_3Raw_sound (u : Shape) (hu : u ∈ below (shape 3 2 3)) : + (B3_2_3Raw u).Encloses (splitWeight positiveSecond tablep (shape 3 2 3) u : ℝ) := by + rw [B3_2_3_below] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl + · exact B3_2_3Raw_0_1_3 + · exact B3_2_3Raw_0_2_2 + · exact B3_2_3Raw_1_0_3 + · exact B3_2_3Raw_1_1_2 + · exact B3_2_3Raw_1_2_1 + · exact B3_2_3Raw_2_0_2 + · exact B3_2_3Raw_2_1_1 + · exact B3_2_3Raw_2_2_0 + · exact B3_2_3Raw_3_0_1 + · exact B3_2_3Raw_3_1_0 +def B3_2_3Den : Ball := ⟨(79743738161203246507272347694409 / 25000000000000000000000000000000), (11 / 6250000000000000000000000000000)⟩ +lemma B3_2_3Den_sound : B3_2_3Den.Encloses (((below (shape 3 2 3)).map (splitWeight positiveSecond tablep (shape 3 2 3))).sum : ℝ) := by + exact contains_sound (list_cast_enclosed (below (shape 3 2 3)) B3_2_3Raw (splitWeight positiveSecond tablep (shape 3 2 3)) B3_2_3Raw_sound) (by decide +kernel) +lemma B3_2_3Den_positive : 0 < B3_2_3Den.lower := by decide +kernel +def B3_2_3Table (s : Shape) : Ball := + match s 0, s 1, s 2 with + | 0, 1, 3 => ⟨(160739182932759974729119067149 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 0, 2, 2 => ⟨(232233924091318151167807188021 / 20000000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ + | 1, 0, 3 => ⟨(230983240785310211157876817529 / 20000000000000000000000000000000), (1 / 20000000000000000000000000000000)⟩ + | 1, 1, 2 => ⟨(6270084793231563529856005696979 / 20000000000000000000000000000000), (9 / 50000000000000000000000000000000)⟩ + | 1, 2, 1 => ⟨(8086375513263140282181216210103 / 50000000000000000000000000000000), (3 / 10000000000000000000000000000000)⟩ + | 2, 0, 2 => ⟨(8086375513263140282181216210103 / 50000000000000000000000000000000), (3 / 10000000000000000000000000000000)⟩ + | 2, 1, 1 => ⟨(6270084793231563529856005696979 / 20000000000000000000000000000000), (9 / 50000000000000000000000000000000)⟩ + | 2, 2, 0 => ⟨(230983240785310211157876817529 / 20000000000000000000000000000000), (1 / 20000000000000000000000000000000)⟩ + | 3, 0, 1 => ⟨(232233924091318151167807188021 / 20000000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ + | 3, 1, 0 => ⟨(160739182932759974729119067149 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | _, _, _ => (.exact 0) +def B3_2_3Law (u : Shape) : Ball := if u ∈ below (shape 3 2 3) then B3_2_3Table u else .exact 0 +lemma B3_2_3Law_check_0_1_3 : contains (.mul (B3_2_3Raw (shape 0 1 3)) (.inv B3_2_3Den)) (B3_2_3Table (shape 0 1 3)) = true := by decide +kernel +lemma B3_2_3Law_check_0_2_2 : contains (.mul (B3_2_3Raw (shape 0 2 2)) (.inv B3_2_3Den)) (B3_2_3Table (shape 0 2 2)) = true := by decide +kernel +lemma B3_2_3Law_check_1_0_3 : contains (.mul (B3_2_3Raw (shape 1 0 3)) (.inv B3_2_3Den)) (B3_2_3Table (shape 1 0 3)) = true := by decide +kernel +lemma B3_2_3Law_check_1_1_2 : contains (.mul (B3_2_3Raw (shape 1 1 2)) (.inv B3_2_3Den)) (B3_2_3Table (shape 1 1 2)) = true := by decide +kernel +lemma B3_2_3Law_check_1_2_1 : contains (.mul (B3_2_3Raw (shape 1 2 1)) (.inv B3_2_3Den)) (B3_2_3Table (shape 1 2 1)) = true := by decide +kernel +lemma B3_2_3Law_check_2_0_2 : contains (.mul (B3_2_3Raw (shape 2 0 2)) (.inv B3_2_3Den)) (B3_2_3Table (shape 2 0 2)) = true := by decide +kernel +lemma B3_2_3Law_check_2_1_1 : contains (.mul (B3_2_3Raw (shape 2 1 1)) (.inv B3_2_3Den)) (B3_2_3Table (shape 2 1 1)) = true := by decide +kernel +lemma B3_2_3Law_check_2_2_0 : contains (.mul (B3_2_3Raw (shape 2 2 0)) (.inv B3_2_3Den)) (B3_2_3Table (shape 2 2 0)) = true := by decide +kernel +lemma B3_2_3Law_check_3_0_1 : contains (.mul (B3_2_3Raw (shape 3 0 1)) (.inv B3_2_3Den)) (B3_2_3Table (shape 3 0 1)) = true := by decide +kernel +lemma B3_2_3Law_check_3_1_0 : contains (.mul (B3_2_3Raw (shape 3 1 0)) (.inv B3_2_3Den)) (B3_2_3Table (shape 3 1 0)) = true := by decide +kernel +lemma B3_2_3Law_check (u : Shape) (hu : u ∈ below (shape 3 2 3)) : + contains (.mul (B3_2_3Raw u) (.inv B3_2_3Den)) (B3_2_3Table u) = true := by + rw [B3_2_3_below] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl + · exact B3_2_3Law_check_0_1_3 + · exact B3_2_3Law_check_0_2_2 + · exact B3_2_3Law_check_1_0_3 + · exact B3_2_3Law_check_1_1_2 + · exact B3_2_3Law_check_1_2_1 + · exact B3_2_3Law_check_2_0_2 + · exact B3_2_3Law_check_2_1_1 + · exact B3_2_3Law_check_2_2_0 + · exact B3_2_3Law_check_3_0_1 + · exact B3_2_3Law_check_3_1_0 +lemma B3_2_3Law_sound (u : Shape) : + (B3_2_3Law u).Encloses (stageBLaw (shape 3 2 3) u : ℝ) := by + by_cases hu : u ∈ below (shape 3 2 3) + · have h := contains_sound (Ball.mul_sound (B3_2_3Raw_sound u hu) + (Ball.inv_sound B3_2_3Den_sound B3_2_3Den_positive)) (B3_2_3Law_check u hu) + simpa only [B3_2_3Law, hu, ite_true, stageBLaw, splitLaw, + Rat.cast_div, Rat.cast_mul, Rat.cast_inv, div_eq_mul_inv] using h + · simp only [B3_2_3Law, hu, ite_false, stageBLaw, splitLaw, Rat.cast_zero] + simpa only [Rat.cast_zero] using Ball.exact_sound 0 + +lemma B5_1_2_below : below (shape 5 1 2) = [ + (shape 1 1 2), + (shape 2 0 2), + (shape 2 1 1), + (shape 3 0 1), + (shape 3 1 0), + (shape 4 0 0)] := by decide +kernel +def B5_1_2Raw (s : Shape) : Ball := + match s 0, s 1, s 2 with + | 1, 1, 2 => ⟨(1134875559173888664169867750871 / 50000000000000000000000000000000), (7 / 100000000000000000000000000000000)⟩ + | 2, 0, 2 => ⟨(11280011590026355871190756294713 / 20000000000000000000000000000000), (73 / 100000000000000000000000000000000)⟩ + | 2, 1, 1 => ⟨1, 0⟩ + | 3, 0, 1 => ⟨1, 0⟩ + | 3, 1, 0 => ⟨(11280011590026355871190756294713 / 20000000000000000000000000000000), (73 / 100000000000000000000000000000000)⟩ + | 4, 0, 0 => ⟨(1134875559173888664169867750871 / 50000000000000000000000000000000), (7 / 100000000000000000000000000000000)⟩ + | _, _, _ => (.exact 0) +lemma B5_1_2Raw_1_1_2 : (B5_1_2Raw (shape 1 1 2)).Encloses (splitWeight positiveSecond tablep (shape 5 1 2) (shape 1 1 2) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveSecond tablep (shape 5 1 2) (shape 1 1 2) + (-32128) (0) (-5727) w66 w195 w161 + (by decide +kernel) w66_sound w195_sound w161_sound) (by decide +kernel) +lemma B5_1_2Raw_2_0_2 : (B5_1_2Raw (shape 2 0 2)).Encloses (splitWeight positiveSecond tablep (shape 5 1 2) (shape 2 0 2) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveSecond tablep (shape 5 1 2) (shape 2 0 2) + (0) (0) (-5727) w195 w195 w161 + (by decide +kernel) w195_sound w195_sound w161_sound) (by decide +kernel) +lemma B5_1_2Raw_2_1_1 : (B5_1_2Raw (shape 2 1 1)).Encloses (splitWeight positiveSecond tablep (shape 5 1 2) (shape 2 1 1) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveSecond tablep (shape 5 1 2) (shape 2 1 1) + (0) (0) (0) w195 w195 w195 + (by decide +kernel) w195_sound w195_sound w195_sound) (by decide +kernel) +lemma B5_1_2Raw_3_0_1 : (B5_1_2Raw (shape 3 0 1)).Encloses (splitWeight positiveSecond tablep (shape 5 1 2) (shape 3 0 1) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveSecond tablep (shape 5 1 2) (shape 3 0 1) + (0) (0) (0) w195 w195 w195 + (by decide +kernel) w195_sound w195_sound w195_sound) (by decide +kernel) +lemma B5_1_2Raw_3_1_0 : (B5_1_2Raw (shape 3 1 0)).Encloses (splitWeight positiveSecond tablep (shape 5 1 2) (shape 3 1 0) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveSecond tablep (shape 5 1 2) (shape 3 1 0) + (0) (0) (-5727) w195 w195 w161 + (by decide +kernel) w195_sound w195_sound w161_sound) (by decide +kernel) +lemma B5_1_2Raw_4_0_0 : (B5_1_2Raw (shape 4 0 0)).Encloses (splitWeight positiveSecond tablep (shape 5 1 2) (shape 4 0 0) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveSecond tablep (shape 5 1 2) (shape 4 0 0) + (-32128) (0) (-5727) w66 w195 w161 + (by decide +kernel) w66_sound w195_sound w161_sound) (by decide +kernel) +lemma B5_1_2Raw_sound (u : Shape) (hu : u ∈ below (shape 5 1 2)) : + (B5_1_2Raw u).Encloses (splitWeight positiveSecond tablep (shape 5 1 2) u : ℝ) := by + rw [B5_1_2_below] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl | rfl | rfl + · exact B5_1_2Raw_1_1_2 + · exact B5_1_2Raw_2_0_2 + · exact B5_1_2Raw_2_1_1 + · exact B5_1_2Raw_3_0_1 + · exact B5_1_2Raw_3_1_0 + · exact B5_1_2Raw_4_0_0 +def B5_1_2Den : Ball := ⟨(158669809068479556684293516975307 / 50000000000000000000000000000000), (1 / 625000000000000000000000000000)⟩ +lemma B5_1_2Den_sound : B5_1_2Den.Encloses (((below (shape 5 1 2)).map (splitWeight positiveSecond tablep (shape 5 1 2))).sum : ℝ) := by + exact contains_sound (list_cast_enclosed (below (shape 5 1 2)) B5_1_2Raw (splitWeight positiveSecond tablep (shape 5 1 2)) B5_1_2Raw_sound) (by decide +kernel) +lemma B5_1_2Den_positive : 0 < B5_1_2Den.lower := by decide +kernel +def B5_1_2Table (s : Shape) : Ball := + match s 0, s 1, s 2 with + | 1, 1, 2 => ⟨(715243539925161855344559597823 / 100000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ + | 2, 0, 2 => ⟨(4443193878631184933728583933647 / 25000000000000000000000000000000), (33 / 100000000000000000000000000000000)⟩ + | 2, 1, 1 => ⟨(31511980945550098409741104667589 / 100000000000000000000000000000000), (17 / 100000000000000000000000000000000)⟩ + | 3, 0, 1 => ⟨(31511980945550098409741104667589 / 100000000000000000000000000000000), (17 / 100000000000000000000000000000000)⟩ + | 3, 1, 0 => ⟨(4443193878631184933728583933647 / 25000000000000000000000000000000), (33 / 100000000000000000000000000000000)⟩ + | 4, 0, 0 => ⟨(715243539925161855344559597823 / 100000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ + | _, _, _ => (.exact 0) +def B5_1_2Law (u : Shape) : Ball := if u ∈ below (shape 5 1 2) then B5_1_2Table u else .exact 0 +lemma B5_1_2Law_check_1_1_2 : contains (.mul (B5_1_2Raw (shape 1 1 2)) (.inv B5_1_2Den)) (B5_1_2Table (shape 1 1 2)) = true := by decide +kernel +lemma B5_1_2Law_check_2_0_2 : contains (.mul (B5_1_2Raw (shape 2 0 2)) (.inv B5_1_2Den)) (B5_1_2Table (shape 2 0 2)) = true := by decide +kernel +lemma B5_1_2Law_check_2_1_1 : contains (.mul (B5_1_2Raw (shape 2 1 1)) (.inv B5_1_2Den)) (B5_1_2Table (shape 2 1 1)) = true := by decide +kernel +lemma B5_1_2Law_check_3_0_1 : contains (.mul (B5_1_2Raw (shape 3 0 1)) (.inv B5_1_2Den)) (B5_1_2Table (shape 3 0 1)) = true := by decide +kernel +lemma B5_1_2Law_check_3_1_0 : contains (.mul (B5_1_2Raw (shape 3 1 0)) (.inv B5_1_2Den)) (B5_1_2Table (shape 3 1 0)) = true := by decide +kernel +lemma B5_1_2Law_check_4_0_0 : contains (.mul (B5_1_2Raw (shape 4 0 0)) (.inv B5_1_2Den)) (B5_1_2Table (shape 4 0 0)) = true := by decide +kernel +lemma B5_1_2Law_check (u : Shape) (hu : u ∈ below (shape 5 1 2)) : + contains (.mul (B5_1_2Raw u) (.inv B5_1_2Den)) (B5_1_2Table u) = true := by + rw [B5_1_2_below] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl | rfl | rfl + · exact B5_1_2Law_check_1_1_2 + · exact B5_1_2Law_check_2_0_2 + · exact B5_1_2Law_check_2_1_1 + · exact B5_1_2Law_check_3_0_1 + · exact B5_1_2Law_check_3_1_0 + · exact B5_1_2Law_check_4_0_0 +lemma B5_1_2Law_sound (u : Shape) : + (B5_1_2Law u).Encloses (stageBLaw (shape 5 1 2) u : ℝ) := by + by_cases hu : u ∈ below (shape 5 1 2) + · have h := contains_sound (Ball.mul_sound (B5_1_2Raw_sound u hu) + (Ball.inv_sound B5_1_2Den_sound B5_1_2Den_positive)) (B5_1_2Law_check u hu) + simpa only [B5_1_2Law, hu, ite_true, stageBLaw, splitLaw, + Rat.cast_div, Rat.cast_mul, Rat.cast_inv, div_eq_mul_inv] using h + · simp only [B5_1_2Law, hu, ite_false, stageBLaw, splitLaw, Rat.cast_zero] + simpa only [Rat.cast_zero] using Ball.exact_sound 0 + +end MatrixMultiplication.NativeNumerics + +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/Certificates/SupportedContraction.lean b/lean/OAI/LinearAlgebra/MatrixFields/Certificates/SupportedContraction.lean new file mode 100644 index 0000000000000000000000000000000000000000..916f73fd2259c597432e89ee14e57e236591bfd4 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/Certificates/SupportedContraction.lean @@ -0,0 +1,564 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Certificates.LittleB1_4_3 +import OAI.LinearAlgebra.MatrixFields.Certificates.LittleB1_5_2 +import OAI.LinearAlgebra.MatrixFields.Certificates.LittleB2_3_3 +import OAI.LinearAlgebra.MatrixFields.Certificates.LittleB2_5_1 +import OAI.LinearAlgebra.MatrixFields.Certificates.NativeInterior + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def B3_2_3Binary (u : Shape) : ℚ := + match u 0, u 1, u 2 with + | 0, 2, 2 => (20837 / 200000) + | 1, 1, 2 => (947 / 200000) + | 1, 2, 1 => (38889 / 1000000) + | 2, 0, 2 => (22013 / 200000) + | 2, 1, 1 => (21083 / 500000) + | 2, 2, 0 => (25593 / 250000) + | _, _, _ => 0 +lemma B3_2_3Binary_eq (u : Shape) (hu : u ∈ shapes 4) : + binaryParameter (shape 3 2 3) u = B3_2_3Binary u := by + rw [shapes4_list] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel +def B3_2_3LittleRat (u : Shape) (w : Fin 3) (i : Fin 6) : ℚ := + if u w = 2 then + if i = 2 then 1 - B3_2_3Binary u else if i = 3 then B3_2_3Binary u else 0 + else if i = singletonSlot (u w) then 1 else 0 + +def B3_2_3Little (u : Shape) (w : Fin 3) (i : Fin 6) : Ball := + if u ∈ shapes 4 then .exact (B3_2_3LittleRat u w i) + else .exact (littleLaw (shape 3 2 3) u w i) + +lemma B3_2_3Little_sound (u : Shape) (w : Fin 3) (i : Fin 6) : + (B3_2_3Little u w i).Encloses (littleLaw (shape 3 2 3) u w i : ℝ) := by + by_cases hu : u ∈ shapes 4 + · simp only [B3_2_3Little, hu, ite_true] + apply exact_rat_enclosed + simp only [B3_2_3LittleRat, littleLaw, B3_2_3Binary_eq u hu] + · simp only [B3_2_3Little, hu, ite_false] + exact Ball.exact_sound _ +def B3_2_3Half (w : Fin 3) (ij : PairSlot) : Ball := + match w.val, ij.1.val, ij.2.val with + | 0, 0, 4 => ⟨(660954401694675365284077503627 / 50000000000000000000000000000000), (1 / 20000000000000000000000000000000)⟩ + | 0, 1, 2 => ⟨(22728942148145327387716240679751 / 50000000000000000000000000000000), (49 / 100000000000000000000000000000000)⟩ + | 0, 1, 3 => ⟨(805051725079998623499840908311 / 25000000000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ + | 0, 2, 1 => ⟨(22728942148145327387716240679751 / 50000000000000000000000000000000), (49 / 100000000000000000000000000000000)⟩ + | 0, 3, 1 => ⟨(805051725079998623499840908311 / 25000000000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ + | 0, 4, 0 => ⟨(660954401694675365284077503627 / 50000000000000000000000000000000), (1 / 20000000000000000000000000000000)⟩ + | 1, 1, 1 => ⟨(7877790787272644406002286888011 / 12500000000000000000000000000000), (19 / 50000000000000000000000000000000)⟩ + | 1, 2, 0 => ⟨(8810343598851601529271500513163 / 50000000000000000000000000000000), (19 / 50000000000000000000000000000000)⟩ + | 1, 3, 0 => ⟨(86814965320621931744785142163 / 10000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ + | 1, 0, 2 => ⟨(8810343598851601529271500513163 / 50000000000000000000000000000000), (19 / 50000000000000000000000000000000)⟩ + | 1, 0, 3 => ⟨(86814965320621931744785142163 / 10000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ + | 2, 4, 0 => ⟨(657827693429655515259251577397 / 50000000000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ + | 2, 2, 1 => ⟨(2331743502850952336234925741329 / 5000000000000000000000000000000), (49 / 100000000000000000000000000000000)⟩ + | 2, 3, 1 => ⟨(1024737278060821122391491009313 / 50000000000000000000000000000000), (1 / 20000000000000000000000000000000)⟩ + | 2, 1, 2 => ⟨(2331743502850952336234925741329 / 5000000000000000000000000000000), (49 / 100000000000000000000000000000000)⟩ + | 2, 1, 3 => ⟨(1024737278060821122391491009313 / 50000000000000000000000000000000), (1 / 20000000000000000000000000000000)⟩ + | 2, 0, 4 => ⟨(657827693429655515259251577397 / 50000000000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ + | _, _, _ => (.exact 0) +lemma B3_2_3Half_check_0_0 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 3 2 3)) (shape 3 2 3) B3_2_3Law + (fun u => B3_2_3Little u 0) ((0 : Fin 6),j)) (B3_2_3Half 0 (0,j)) = true := by + decide +kernel +lemma B3_2_3Half_check_0_1 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 3 2 3)) (shape 3 2 3) B3_2_3Law + (fun u => B3_2_3Little u 0) ((1 : Fin 6),j)) (B3_2_3Half 0 (1,j)) = true := by + decide +kernel +lemma B3_2_3Half_check_0_2 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 3 2 3)) (shape 3 2 3) B3_2_3Law + (fun u => B3_2_3Little u 0) ((2 : Fin 6),j)) (B3_2_3Half 0 (2,j)) = true := by + decide +kernel +lemma B3_2_3Half_check_0_3 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 3 2 3)) (shape 3 2 3) B3_2_3Law + (fun u => B3_2_3Little u 0) ((3 : Fin 6),j)) (B3_2_3Half 0 (3,j)) = true := by + decide +kernel +lemma B3_2_3Half_check_0_4 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 3 2 3)) (shape 3 2 3) B3_2_3Law + (fun u => B3_2_3Little u 0) ((4 : Fin 6),j)) (B3_2_3Half 0 (4,j)) = true := by + decide +kernel +lemma B3_2_3Half_check_0_5 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 3 2 3)) (shape 3 2 3) B3_2_3Law + (fun u => B3_2_3Little u 0) ((5 : Fin 6),j)) (B3_2_3Half 0 (5,j)) = true := by + decide +kernel +lemma B3_2_3Half_check_1_0 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 3 2 3)) (shape 3 2 3) B3_2_3Law + (fun u => B3_2_3Little u 1) ((0 : Fin 6),j)) (B3_2_3Half 1 (0,j)) = true := by + decide +kernel +lemma B3_2_3Half_check_1_1 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 3 2 3)) (shape 3 2 3) B3_2_3Law + (fun u => B3_2_3Little u 1) ((1 : Fin 6),j)) (B3_2_3Half 1 (1,j)) = true := by + decide +kernel +lemma B3_2_3Half_check_1_2 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 3 2 3)) (shape 3 2 3) B3_2_3Law + (fun u => B3_2_3Little u 1) ((2 : Fin 6),j)) (B3_2_3Half 1 (2,j)) = true := by + decide +kernel +lemma B3_2_3Half_check_1_3 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 3 2 3)) (shape 3 2 3) B3_2_3Law + (fun u => B3_2_3Little u 1) ((3 : Fin 6),j)) (B3_2_3Half 1 (3,j)) = true := by + decide +kernel +lemma B3_2_3Half_check_1_4 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 3 2 3)) (shape 3 2 3) B3_2_3Law + (fun u => B3_2_3Little u 1) ((4 : Fin 6),j)) (B3_2_3Half 1 (4,j)) = true := by + decide +kernel +lemma B3_2_3Half_check_1_5 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 3 2 3)) (shape 3 2 3) B3_2_3Law + (fun u => B3_2_3Little u 1) ((5 : Fin 6),j)) (B3_2_3Half 1 (5,j)) = true := by + decide +kernel +lemma B3_2_3Half_check_2_0 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 3 2 3)) (shape 3 2 3) B3_2_3Law + (fun u => B3_2_3Little u 2) ((0 : Fin 6),j)) (B3_2_3Half 2 (0,j)) = true := by + decide +kernel +lemma B3_2_3Half_check_2_1 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 3 2 3)) (shape 3 2 3) B3_2_3Law + (fun u => B3_2_3Little u 2) ((1 : Fin 6),j)) (B3_2_3Half 2 (1,j)) = true := by + decide +kernel +lemma B3_2_3Half_check_2_2 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 3 2 3)) (shape 3 2 3) B3_2_3Law + (fun u => B3_2_3Little u 2) ((2 : Fin 6),j)) (B3_2_3Half 2 (2,j)) = true := by + decide +kernel +lemma B3_2_3Half_check_2_3 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 3 2 3)) (shape 3 2 3) B3_2_3Law + (fun u => B3_2_3Little u 2) ((3 : Fin 6),j)) (B3_2_3Half 2 (3,j)) = true := by + decide +kernel +lemma B3_2_3Half_check_2_4 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 3 2 3)) (shape 3 2 3) B3_2_3Law + (fun u => B3_2_3Little u 2) ((4 : Fin 6),j)) (B3_2_3Half 2 (4,j)) = true := by + decide +kernel +lemma B3_2_3Half_check_2_5 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 3 2 3)) (shape 3 2 3) B3_2_3Law + (fun u => B3_2_3Little u 2) ((5 : Fin 6),j)) (B3_2_3Half 2 (5,j)) = true := by + decide +kernel +lemma B3_2_3Half_sound (w : Fin 3) (ij : PairSlot) : + (B3_2_3Half w ij).Encloses (halfLaw (shape 3 2 3) w ij : ℝ) := by + have hcheck : contains (pairLawBall (below (shape 3 2 3)) (shape 3 2 3) B3_2_3Law + (fun u => B3_2_3Little u w) ij) (B3_2_3Half w ij) = true := by + rcases ij with ⟨i,j⟩ + revert i w + apply forall_fin3 + · exact forall_fin6 (B3_2_3Half_check_0_0 j) (B3_2_3Half_check_0_1 j) (B3_2_3Half_check_0_2 j) (B3_2_3Half_check_0_3 j) (B3_2_3Half_check_0_4 j) (B3_2_3Half_check_0_5 j) + · exact forall_fin6 (B3_2_3Half_check_1_0 j) (B3_2_3Half_check_1_1 j) (B3_2_3Half_check_1_2 j) (B3_2_3Half_check_1_3 j) (B3_2_3Half_check_1_4 j) (B3_2_3Half_check_1_5 j) + · exact forall_fin6 (B3_2_3Half_check_2_0 j) (B3_2_3Half_check_2_1 j) (B3_2_3Half_check_2_2 j) (B3_2_3Half_check_2_3 j) (B3_2_3Half_check_2_4 j) (B3_2_3Half_check_2_5 j) + have h := contains_sound (pairLawBall_sound (below (shape 3 2 3)) (shape 3 2 3) + B3_2_3Law (fun u => (stageBLaw (shape 3 2 3) u : ℝ)) + (fun u => B3_2_3Little u w) (fun u i => (littleLaw (shape 3 2 3) u w i : ℝ)) + (fun u _ => B3_2_3Law_sound u) (fun u i => B3_2_3Little_sound u w i) ij) hcheck + have hp : positive (shape 3 2 3) = true := by decide +kernel + simpa only [halfLaw, hp, ite_true, pairLaw, positiveHalfLaw, Rat.cast_list_sum, + List.map_map, Function.comp_def, Rat.cast_mul] using h + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def B5_1_2Binary (u : Shape) : ℚ := + match u 0, u 1, u 2 with + | 1, 1, 2 => (42047 / 1000000) + | 2, 0, 2 => (6867 / 62500) + | 2, 1, 1 => (1993 / 500000) + | _, _, _ => 0 +lemma B5_1_2Binary_eq (u : Shape) (hu : u ∈ shapes 4) : + binaryParameter (shape 5 1 2) u = B5_1_2Binary u := by + rw [shapes4_list] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel +def B5_1_2LittleRat (u : Shape) (w : Fin 3) (i : Fin 6) : ℚ := + if u w = 2 then + if i = 2 then 1 - B5_1_2Binary u else if i = 3 then B5_1_2Binary u else 0 + else if i = singletonSlot (u w) then 1 else 0 + +def B5_1_2Little (u : Shape) (w : Fin 3) (i : Fin 6) : Ball := + if u ∈ shapes 4 then .exact (B5_1_2LittleRat u w i) + else .exact (littleLaw (shape 5 1 2) u w i) + +lemma B5_1_2Little_sound (u : Shape) (w : Fin 3) (i : Fin 6) : + (B5_1_2Little u w i).Encloses (littleLaw (shape 5 1 2) u w i : ℝ) := by + by_cases hu : u ∈ shapes 4 + · simp only [B5_1_2Little, hu, ite_true] + apply exact_rat_enclosed + simp only [B5_1_2LittleRat, littleLaw, B5_1_2Binary_eq u hu] + · simp only [B5_1_2Little, hu, ite_false] + exact Ball.exact_sound _ +def B5_1_2Half (w : Fin 3) (ij : PairSlot) : Ball := + match w.val, ij.1.val, ij.2.val with + | 0, 1, 5 => ⟨(715243539925161855344559597823 / 100000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ + | 0, 2, 4 => ⟨(47206419312694013248239704463141 / 100000000000000000000000000000000), (47 / 100000000000000000000000000000000)⟩ + | 0, 3, 4 => ⟨(519584286845206224103933984759 / 25000000000000000000000000000000), (1 / 20000000000000000000000000000000)⟩ + | 0, 4, 2 => ⟨(47206419312694013248239704463141 / 100000000000000000000000000000000), (47 / 100000000000000000000000000000000)⟩ + | 0, 4, 3 => ⟨(519584286845206224103933984759 / 25000000000000000000000000000000), (1 / 20000000000000000000000000000000)⟩ + | 0, 5, 1 => ⟨(715243539925161855344559597823 / 100000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ + | 1, 1, 0 => ⟨(1 / 2), (53 / 100000000000000000000000000000000)⟩ + | 1, 0, 1 => ⟨(1 / 2), (53 / 100000000000000000000000000000000)⟩ + | 2, 2, 0 => ⟨(16505214817994806105572714739171 / 100000000000000000000000000000000), (33 / 100000000000000000000000000000000)⟩ + | 2, 3, 0 => ⟨(49570105911377387117154514831 / 2500000000000000000000000000000), (1 / 20000000000000000000000000000000)⟩ + | 2, 1, 1 => ⟨(31511980945550098409741104667589 / 50000000000000000000000000000000), (17 / 50000000000000000000000000000000)⟩ + | 2, 0, 2 => ⟨(16505214817994806105572714739171 / 100000000000000000000000000000000), (33 / 100000000000000000000000000000000)⟩ + | 2, 0, 3 => ⟨(49570105911377387117154514831 / 2500000000000000000000000000000), (1 / 20000000000000000000000000000000)⟩ + | _, _, _ => (.exact 0) +lemma B5_1_2Half_check_0_0 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 5 1 2)) (shape 5 1 2) B5_1_2Law + (fun u => B5_1_2Little u 0) ((0 : Fin 6),j)) (B5_1_2Half 0 (0,j)) = true := by + decide +kernel +lemma B5_1_2Half_check_0_1 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 5 1 2)) (shape 5 1 2) B5_1_2Law + (fun u => B5_1_2Little u 0) ((1 : Fin 6),j)) (B5_1_2Half 0 (1,j)) = true := by + decide +kernel +lemma B5_1_2Half_check_0_2 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 5 1 2)) (shape 5 1 2) B5_1_2Law + (fun u => B5_1_2Little u 0) ((2 : Fin 6),j)) (B5_1_2Half 0 (2,j)) = true := by + decide +kernel +lemma B5_1_2Half_check_0_3 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 5 1 2)) (shape 5 1 2) B5_1_2Law + (fun u => B5_1_2Little u 0) ((3 : Fin 6),j)) (B5_1_2Half 0 (3,j)) = true := by + decide +kernel +lemma B5_1_2Half_check_0_4 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 5 1 2)) (shape 5 1 2) B5_1_2Law + (fun u => B5_1_2Little u 0) ((4 : Fin 6),j)) (B5_1_2Half 0 (4,j)) = true := by + decide +kernel +lemma B5_1_2Half_check_0_5 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 5 1 2)) (shape 5 1 2) B5_1_2Law + (fun u => B5_1_2Little u 0) ((5 : Fin 6),j)) (B5_1_2Half 0 (5,j)) = true := by + decide +kernel +lemma B5_1_2Half_check_1_0 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 5 1 2)) (shape 5 1 2) B5_1_2Law + (fun u => B5_1_2Little u 1) ((0 : Fin 6),j)) (B5_1_2Half 1 (0,j)) = true := by + decide +kernel +lemma B5_1_2Half_check_1_1 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 5 1 2)) (shape 5 1 2) B5_1_2Law + (fun u => B5_1_2Little u 1) ((1 : Fin 6),j)) (B5_1_2Half 1 (1,j)) = true := by + decide +kernel +lemma B5_1_2Half_check_1_2 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 5 1 2)) (shape 5 1 2) B5_1_2Law + (fun u => B5_1_2Little u 1) ((2 : Fin 6),j)) (B5_1_2Half 1 (2,j)) = true := by + decide +kernel +lemma B5_1_2Half_check_1_3 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 5 1 2)) (shape 5 1 2) B5_1_2Law + (fun u => B5_1_2Little u 1) ((3 : Fin 6),j)) (B5_1_2Half 1 (3,j)) = true := by + decide +kernel +lemma B5_1_2Half_check_1_4 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 5 1 2)) (shape 5 1 2) B5_1_2Law + (fun u => B5_1_2Little u 1) ((4 : Fin 6),j)) (B5_1_2Half 1 (4,j)) = true := by + decide +kernel +lemma B5_1_2Half_check_1_5 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 5 1 2)) (shape 5 1 2) B5_1_2Law + (fun u => B5_1_2Little u 1) ((5 : Fin 6),j)) (B5_1_2Half 1 (5,j)) = true := by + decide +kernel +lemma B5_1_2Half_check_2_0 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 5 1 2)) (shape 5 1 2) B5_1_2Law + (fun u => B5_1_2Little u 2) ((0 : Fin 6),j)) (B5_1_2Half 2 (0,j)) = true := by + decide +kernel +lemma B5_1_2Half_check_2_1 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 5 1 2)) (shape 5 1 2) B5_1_2Law + (fun u => B5_1_2Little u 2) ((1 : Fin 6),j)) (B5_1_2Half 2 (1,j)) = true := by + decide +kernel +lemma B5_1_2Half_check_2_2 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 5 1 2)) (shape 5 1 2) B5_1_2Law + (fun u => B5_1_2Little u 2) ((2 : Fin 6),j)) (B5_1_2Half 2 (2,j)) = true := by + decide +kernel +lemma B5_1_2Half_check_2_3 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 5 1 2)) (shape 5 1 2) B5_1_2Law + (fun u => B5_1_2Little u 2) ((3 : Fin 6),j)) (B5_1_2Half 2 (3,j)) = true := by + decide +kernel +lemma B5_1_2Half_check_2_4 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 5 1 2)) (shape 5 1 2) B5_1_2Law + (fun u => B5_1_2Little u 2) ((4 : Fin 6),j)) (B5_1_2Half 2 (4,j)) = true := by + decide +kernel +lemma B5_1_2Half_check_2_5 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 5 1 2)) (shape 5 1 2) B5_1_2Law + (fun u => B5_1_2Little u 2) ((5 : Fin 6),j)) (B5_1_2Half 2 (5,j)) = true := by + decide +kernel +lemma B5_1_2Half_sound (w : Fin 3) (ij : PairSlot) : + (B5_1_2Half w ij).Encloses (halfLaw (shape 5 1 2) w ij : ℝ) := by + have hcheck : contains (pairLawBall (below (shape 5 1 2)) (shape 5 1 2) B5_1_2Law + (fun u => B5_1_2Little u w) ij) (B5_1_2Half w ij) = true := by + rcases ij with ⟨i,j⟩ + revert i w + apply forall_fin3 + · exact forall_fin6 (B5_1_2Half_check_0_0 j) (B5_1_2Half_check_0_1 j) (B5_1_2Half_check_0_2 j) (B5_1_2Half_check_0_3 j) (B5_1_2Half_check_0_4 j) (B5_1_2Half_check_0_5 j) + · exact forall_fin6 (B5_1_2Half_check_1_0 j) (B5_1_2Half_check_1_1 j) (B5_1_2Half_check_1_2 j) (B5_1_2Half_check_1_3 j) (B5_1_2Half_check_1_4 j) (B5_1_2Half_check_1_5 j) + · exact forall_fin6 (B5_1_2Half_check_2_0 j) (B5_1_2Half_check_2_1 j) (B5_1_2Half_check_2_2 j) (B5_1_2Half_check_2_3 j) (B5_1_2Half_check_2_4 j) (B5_1_2Half_check_2_5 j) + have h := contains_sound (pairLawBall_sound (below (shape 5 1 2)) (shape 5 1 2) + B5_1_2Law (fun u => (stageBLaw (shape 5 1 2) u : ℝ)) + (fun u => B5_1_2Little u w) (fun u i => (littleLaw (shape 5 1 2) u w i : ℝ)) + (fun u _ => B5_1_2Law_sound u) (fun u i => B5_1_2Little_sound u w i) ij) hcheck + have hp : positive (shape 5 1 2) = true := by decide +kernel + simpa only [halfLaw, hp, ite_true, pairLaw, positiveHalfLaw, Rat.cast_list_sum, + List.map_map, Function.comp_def, Rat.cast_mul] using h + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def halfTable (s : Shape) (w : Fin 3) (ij : PairSlot) : Ball := + match s 0, s 1, s 2 with + | 0, 0, 8 => Z0_0_8Half w ij + | 0, 1, 7 => Z0_1_7Half w ij + | 0, 2, 6 => Z0_2_6Half w ij + | 0, 3, 5 => Z0_3_5Half w ij + | 0, 4, 4 => Z0_4_4Half w ij + | 0, 5, 3 => Z0_5_3Half w ij + | 0, 6, 2 => Z0_6_2Half w ij + | 0, 7, 1 => Z0_7_1Half w ij + | 0, 8, 0 => Z0_8_0Half w ij + | 1, 0, 7 => Z1_0_7Half w ij + | 1, 1, 6 => B1_1_6Half w ij + | 1, 2, 5 => B1_2_5Half w ij + | 1, 3, 4 => B1_3_4Half w ij + | 1, 4, 3 => B1_4_3Half w ij + | 1, 5, 2 => B1_5_2Half w ij + | 1, 6, 1 => B1_6_1Half w ij + | 1, 7, 0 => Z1_7_0Half w ij + | 2, 0, 6 => Z2_0_6Half w ij + | 2, 1, 5 => B2_1_5Half w ij + | 2, 2, 4 => B2_2_4Half w ij + | 2, 3, 3 => B2_3_3Half w ij + | 2, 4, 2 => B2_4_2Half w ij + | 2, 5, 1 => B2_5_1Half w ij + | 2, 6, 0 => Z2_6_0Half w ij + | 3, 0, 5 => Z3_0_5Half w ij + | 3, 1, 4 => B3_1_4Half w ij + | 3, 2, 3 => B3_2_3Half w ij + | 3, 3, 2 => B3_3_2Half w ij + | 3, 4, 1 => B3_4_1Half w ij + | 3, 5, 0 => Z3_5_0Half w ij + | 4, 0, 4 => Z4_0_4Half w ij + | 4, 1, 3 => B4_1_3Half w ij + | 4, 2, 2 => B4_2_2Half w ij + | 4, 3, 1 => B4_3_1Half w ij + | 4, 4, 0 => Z4_4_0Half w ij + | 5, 0, 3 => Z5_0_3Half w ij + | 5, 1, 2 => B5_1_2Half w ij + | 5, 2, 1 => B5_2_1Half w ij + | 5, 3, 0 => Z5_3_0Half w ij + | 6, 0, 2 => Z6_0_2Half w ij + | 6, 1, 1 => B6_1_1Half w ij + | 6, 2, 0 => Z6_2_0Half w ij + | 7, 0, 1 => Z7_0_1Half w ij + | 7, 1, 0 => Z7_1_0Half w ij + | 8, 0, 0 => Z8_0_0Half w ij + | _, _, _ => (.exact 0) +lemma halfTable_sound (t : Shape) (ht : t ∈ shapes 8) (w : Fin 3) (ij : PairSlot) : + (halfTable t w ij).Encloses (halfLaw t w ij : ℝ) := by + rw [allSecond_list] at ht + simp only [List.mem_cons, List.not_mem_nil, or_false] at ht + rcases ht with rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl + · exact Z0_0_8Half_sound w ij + · exact Z0_1_7Half_sound w ij + · exact Z0_2_6Half_sound w ij + · exact Z0_3_5Half_sound w ij + · exact Z0_4_4Half_sound w ij + · exact Z0_5_3Half_sound w ij + · exact Z0_6_2Half_sound w ij + · exact Z0_7_1Half_sound w ij + · exact Z0_8_0Half_sound w ij + · exact Z1_0_7Half_sound w ij + · exact B1_1_6Half_sound w ij + · exact B1_2_5Half_sound w ij + · exact B1_3_4Half_sound w ij + · exact B1_4_3Half_sound w ij + · exact B1_5_2Half_sound w ij + · exact B1_6_1Half_sound w ij + · exact Z1_7_0Half_sound w ij + · exact Z2_0_6Half_sound w ij + · exact B2_1_5Half_sound w ij + · exact B2_2_4Half_sound w ij + · exact B2_3_3Half_sound w ij + · exact B2_4_2Half_sound w ij + · exact B2_5_1Half_sound w ij + · exact Z2_6_0Half_sound w ij + · exact Z3_0_5Half_sound w ij + · exact B3_1_4Half_sound w ij + · exact B3_2_3Half_sound w ij + · exact B3_3_2Half_sound w ij + · exact B3_4_1Half_sound w ij + · exact Z3_5_0Half_sound w ij + · exact Z4_0_4Half_sound w ij + · exact B4_1_3Half_sound w ij + · exact B4_2_2Half_sound w ij + · exact B4_3_1Half_sound w ij + · exact Z4_4_0Half_sound w ij + · exact Z5_0_3Half_sound w ij + · exact B5_1_2Half_sound w ij + · exact B5_2_1Half_sound w ij + · exact Z5_3_0Half_sound w ij + · exact Z6_0_2Half_sound w ij + · exact B6_1_1Half_sound w ij + · exact Z6_2_0Half_sound w ij + · exact Z7_0_1Half_sound w ij + · exact Z7_1_0Half_sound w ij + · exact Z8_0_0Half_sound w ij +def halfProbs (t : Shape) (w : Fin 3) (ij : PairSlot) : Ball := + if t ∈ shapes 8 then halfTable t w ij else .exact (halfLaw t w ij) +lemma halfProbs_sound (t : Shape) (w : Fin 3) (ij : PairSlot) : + (halfProbs t w ij).Encloses (halfLaw t w ij : ℝ) := by + by_cases ht : t ∈ shapes 8 + · simpa only [halfProbs, ht, ite_true] using halfTable_sound t ht w ij + · simp only [halfProbs, ht, ite_false] + exact Ball.exact_sound _ + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators + +def pairDegree (ij : PairSlot) : ℕ := statisticWeight ij.1 + statisticWeight ij.2 + +lemma halfTable_degree_zero_0 : ∀ t ∈ shapes 8, ∀ ij : PairSlot, + pairDegree ij ≠ t 0 → halfTable t 0 ij = .exact 0 := by + decide +kernel +lemma halfTable_degree_zero_1 : ∀ t ∈ shapes 8, ∀ ij : PairSlot, + pairDegree ij ≠ t 1 → halfTable t 1 ij = .exact 0 := by + decide +kernel +lemma halfTable_degree_zero_2 : ∀ t ∈ shapes 8, ∀ ij : PairSlot, + pairDegree ij ≠ t 2 → halfTable t 2 ij = .exact 0 := by + decide +kernel + +lemma halfTable_degree_zero (t : Shape) (ht : t ∈ shapes 8) (w : Fin 3) + (ij : PairSlot) (h : pairDegree ij ≠ t w) : halfTable t w ij = .exact 0 := by + fin_cases w + · exact halfTable_degree_zero_0 t ht ij h + · exact halfTable_degree_zero_1 t ht ij h + · exact halfTable_degree_zero_2 t ht ij h + +lemma listSumBall_eq_zero {A : Type*} (xs : List A) (b : A → Ball) + (h : ∀ x ∈ xs, b x = .exact 0) : listSumBall xs b = .exact 0 := by + induction xs with + | nil => rfl + | cons x xs ih => + change Ball.add (b x) (listSumBall xs b) = .exact 0 + rw [h x (by simp), ih (fun y hy => h y (by simp [hy]))] + decide +kernel + +lemma stageAPairBall_zero (s : Shape) (hs : s ∈ positiveInitial) (bs : Shape → Ball) + (w : Fin 3) (ij : PairSlot × PairSlot) + (h : pairDegree ij.1 + pairDegree ij.2 ≠ s w) : + sparsePairLawBall (below s) s bs (fun u => halfTable u w) ij = .exact 0 := by + apply listSumBall_eq_zero + intro u hu + have hc := stageA_support_complement s hs u hu + by_cases hl : pairDegree ij.1 = u w + · have hr : pairDegree ij.2 ≠ (complement s u) w := by + simp only [complement] + have hu_le := hc.2 w + omega + have hz := halfTable_degree_zero (complement s u) + (stageA_children_size s hs _ hc.1) w ij.2 hr + simp only [sparseTripleBall, hz, or_true, ite_true] + · have hz := halfTable_degree_zero u (stageA_children_size s hs u hu) w ij.1 hl + simp only [sparseTripleBall, hz, true_or, ite_true] + +def stageAPairBall (s : Shape) (bs : Shape → Ball) (w : Fin 3) + (ij : PairSlot × PairSlot) : Ball := + if pairDegree ij.1 + pairDegree ij.2 = s w then + sparsePairLawBall (below s) s bs (fun u => halfTable u w) ij + else .exact 0 + +lemma stageAPairBall_eq (s : Shape) (hs : s ∈ positiveInitial) (bs : Shape → Ball) + (w : Fin 3) (ij : PairSlot × PairSlot) : + stageAPairBall s bs w ij = + sparsePairLawBall (below s) s bs (fun u => halfTable u w) ij := by + unfold stageAPairBall + split_ifs with h + · rfl + · exact (stageAPairBall_zero s hs bs w ij h).symm + +lemma stageAPairBall_sound (s : Shape) (hs : s ∈ positiveInitial) + (bs : Shape → Ball) (p : Shape → ℝ) + (hp : ∀ u ∈ below s, (bs u).Encloses (p u)) (w : Fin 3) (ij : PairSlot × PairSlot) : + (stageAPairBall s bs w ij).Encloses + (pairLaw (below s) s p (fun u a => (halfLaw u w a : ℝ)) ij) := by + rw [stageAPairBall_eq s hs] + exact sparsePairLawBall_sound_on (below s) s bs p (fun u => halfTable u w) + (fun u a => (halfLaw u w a : ℝ)) hp + (fun u hu a => halfTable_sound u (stageA_children_size s hs u hu) w a) + (fun u hu a => halfTable_sound (complement s u) + (stageA_children_size s hs _ (stageA_support_complement s hs u hu).1) w a) ij + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/Certificates/Terminal1_1_6.lean b/lean/OAI/LinearAlgebra/MatrixFields/Certificates/Terminal1_1_6.lean new file mode 100644 index 0000000000000000000000000000000000000000..3cc57763119e7564354f0f91b2202d57ba56578d --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/Certificates/Terminal1_1_6.lean @@ -0,0 +1,1300 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Certificates.InitialProbabilities +import OAI.LinearAlgebra.MatrixFields.Certificates.SplitA1_1_14 +import OAI.LinearAlgebra.MatrixFields.Certificates.SplitA1_4_11 +import OAI.LinearAlgebra.MatrixFields.Certificates.SplitA1_7_8 +import OAI.LinearAlgebra.MatrixFields.Certificates.SplitA2_2_12 +import OAI.LinearAlgebra.MatrixFields.Certificates.SplitA2_3_11 +import OAI.LinearAlgebra.MatrixFields.Certificates.SplitA2_4_10 +import OAI.LinearAlgebra.MatrixFields.Certificates.SplitA2_5_9 +import OAI.LinearAlgebra.MatrixFields.Certificates.SplitA2_6_8 +import OAI.LinearAlgebra.MatrixFields.Certificates.SplitA2_7_7 +import OAI.LinearAlgebra.MatrixFields.Certificates.SplitA3_3_10 +import OAI.LinearAlgebra.MatrixFields.Certificates.SplitA3_4_9 +import OAI.LinearAlgebra.MatrixFields.Certificates.SplitA3_5_8 +import OAI.LinearAlgebra.MatrixFields.Certificates.SplitA3_6_7 +import OAI.LinearAlgebra.MatrixFields.Certificates.SplitA4_5_7 +import OAI.LinearAlgebra.MatrixFields.Certificates.SplitA4_6_6 + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate +open scoped BigOperators +lemma A4_4_8_below : below (shape 4 4 8) = [ + (shape 0 0 8), + (shape 0 1 7), + (shape 0 2 6), + (shape 0 3 5), + (shape 0 4 4), + (shape 1 0 7), + (shape 1 1 6), + (shape 1 2 5), + (shape 1 3 4), + (shape 1 4 3), + (shape 2 0 6), + (shape 2 1 5), + (shape 2 2 4), + (shape 2 3 3), + (shape 2 4 2), + (shape 3 0 5), + (shape 3 1 4), + (shape 3 2 3), + (shape 3 3 2), + (shape 3 4 1), + (shape 4 0 4), + (shape 4 1 3), + (shape 4 2 2), + (shape 4 3 1), + (shape 4 4 0)] := by decide +kernel +def A4_4_8Raw (s : Shape) : Ball := + match s 0, s 1, s 2 with + | 0, 0, 8 => ⟨(18292309835383748212700097 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 0, 1, 7 => ⟨(9679647302864801584009674223 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 0, 2, 6 => ⟨(115294249586007915494116430803 / 20000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ + | 0, 3, 5 => ⟨(49998791258020844658220845781 / 1250000000000000000000000000000), (1 / 6250000000000000000000000000000)⟩ + | 0, 4, 4 => ⟨(25723673806193141051082939537 / 800000000000000000000000000000), (1 / 10000000000000000000000000000000)⟩ + | 1, 0, 7 => ⟨(9822006849405278656185245843 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 1, 1, 6 => ⟨(678835129521870795795191707909 / 50000000000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ + | 1, 2, 5 => ⟨(22454031748889508411675041798339 / 100000000000000000000000000000000), (13 / 25000000000000000000000000000000)⟩ + | 1, 3, 4 => ⟨(41895154924763898251935527356047 / 100000000000000000000000000000000), (19 / 20000000000000000000000000000000)⟩ + | 1, 4, 3 => ⟨(253670642551677628600159805953 / 6250000000000000000000000000000), (1 / 6250000000000000000000000000000)⟩ + | 2, 0, 6 => ⟨(146442242833390519127469727577 / 25000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ + | 2, 1, 5 => ⟨(1124274470428081998513583312611 / 5000000000000000000000000000000), (27 / 50000000000000000000000000000000)⟩ + | 2, 2, 4 => ⟨1, 0⟩ + | 2, 3, 3 => ⟨(1124274470428081998513583312611 / 5000000000000000000000000000000), (27 / 50000000000000000000000000000000)⟩ + | 2, 4, 2 => ⟨(146442242833390519127469727577 / 25000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ + | 3, 0, 5 => ⟨(253670642551677628600159805953 / 6250000000000000000000000000000), (1 / 6250000000000000000000000000000)⟩ + | 3, 1, 4 => ⟨(41895154924763898251935527356047 / 100000000000000000000000000000000), (19 / 20000000000000000000000000000000)⟩ + | 3, 2, 3 => ⟨(22454031748889508411675041798339 / 100000000000000000000000000000000), (13 / 25000000000000000000000000000000)⟩ + | 3, 3, 2 => ⟨(678835129521870795795191707909 / 50000000000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ + | 3, 4, 1 => ⟨(9822006849405278656185245843 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 4, 0, 4 => ⟨(25723673806193141051082939537 / 800000000000000000000000000000), (1 / 10000000000000000000000000000000)⟩ + | 4, 1, 3 => ⟨(49998791258020844658220845781 / 1250000000000000000000000000000), (1 / 6250000000000000000000000000000)⟩ + | 4, 2, 2 => ⟨(115294249586007915494116430803 / 20000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ + | 4, 3, 1 => ⟨(9679647302864801584009674223 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 4, 4, 0 => ⟨(18292309835383748212700097 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | _, _, _ => (.exact 0) +lemma A4_4_8Raw_0_0_8 : (A4_4_8Raw (shape 0 0 8)).Encloses (splitWeight positiveInitial tableP (shape 4 4 8) (shape 0 0 8) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 4 4 8) (shape 0 0 8) + (-17266) (-17106) (-120770) w98 w99 w0 + (by decide +kernel) w98_sound w99_sound w0_sound) (by decide +kernel) +lemma A4_4_8Raw_0_1_7 : (A4_4_8Raw (shape 0 1 7)).Encloses (splitWeight positiveInitial tableP (shape 4 4 8) (shape 0 1 7) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 4 4 8) (shape 0 1 7) + (-17266) (-4343) (-70820) w98 w176 w12 + (by decide +kernel) w98_sound w176_sound w12_sound) (by decide +kernel) +lemma A4_4_8Raw_0_2_6 : (A4_4_8Raw (shape 0 2 6)).Encloses (splitWeight positiveInitial tableP (shape 4 4 8) (shape 0 2 6) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 4 4 8) (shape 0 2 6) + (-17266) (0) (-34294) w98 w195 w55 + (by decide +kernel) w98_sound w195_sound w55_sound) (by decide +kernel) +lemma A4_4_8Raw_0_3_5 : (A4_4_8Raw (shape 0 3 5)).Encloses (splitWeight positiveInitial tableP (shape 4 4 8) (shape 0 3 5) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 4 4 8) (shape 0 3 5) + (-17266) (-4343) (-10580) w98 w176 w126 + (by decide +kernel) w98_sound w176_sound w126_sound) (by decide +kernel) +lemma A4_4_8Raw_0_4_4 : (A4_4_8Raw (shape 0 4 4)).Encloses (splitWeight positiveInitial tableP (shape 4 4 8) (shape 0 4 4) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 4 4 8) (shape 0 4 4) + (-17266) (-17106) (0) w98 w99 w195 + (by decide +kernel) w98_sound w99_sound w195_sound) (by decide +kernel) +lemma A4_4_8Raw_1_0_7 : (A4_4_8Raw (shape 1 0 7)).Encloses (splitWeight positiveInitial tableP (shape 4 4 8) (shape 1 0 7) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 4 4 8) (shape 1 0 7) + (-4357) (-17106) (-70820) w175 w99 w12 + (by decide +kernel) w175_sound w99_sound w12_sound) (by decide +kernel) +lemma A4_4_8Raw_1_1_6 : (A4_4_8Raw (shape 1 1 6)).Encloses (splitWeight positiveInitial tableP (shape 4 4 8) (shape 1 1 6) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 4 4 8) (shape 1 1 6) + (-4357) (-4343) (-34294) w175 w176 w55 + (by decide +kernel) w175_sound w176_sound w55_sound) (by decide +kernel) +lemma A4_4_8Raw_1_2_5 : (A4_4_8Raw (shape 1 2 5)).Encloses (splitWeight positiveInitial tableP (shape 4 4 8) (shape 1 2 5) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 4 4 8) (shape 1 2 5) + (-4357) (0) (-10580) w175 w195 w126 + (by decide +kernel) w175_sound w195_sound w126_sound) (by decide +kernel) +lemma A4_4_8Raw_1_3_4 : (A4_4_8Raw (shape 1 3 4)).Encloses (splitWeight positiveInitial tableP (shape 4 4 8) (shape 1 3 4) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 4 4 8) (shape 1 3 4) + (-4357) (-4343) (0) w175 w176 w195 + (by decide +kernel) w175_sound w176_sound w195_sound) (by decide +kernel) +lemma A4_4_8Raw_1_4_3 : (A4_4_8Raw (shape 1 4 3)).Encloses (splitWeight positiveInitial tableP (shape 4 4 8) (shape 1 4 3) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 4 4 8) (shape 1 4 3) + (-4357) (-17106) (-10580) w175 w99 w126 + (by decide +kernel) w175_sound w99_sound w126_sound) (by decide +kernel) +lemma A4_4_8Raw_2_0_6 : (A4_4_8Raw (shape 2 0 6)).Encloses (splitWeight positiveInitial tableP (shape 4 4 8) (shape 2 0 6) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 4 4 8) (shape 2 0 6) + (0) (-17106) (-34294) w195 w99 w55 + (by decide +kernel) w195_sound w99_sound w55_sound) (by decide +kernel) +lemma A4_4_8Raw_2_1_5 : (A4_4_8Raw (shape 2 1 5)).Encloses (splitWeight positiveInitial tableP (shape 4 4 8) (shape 2 1 5) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 4 4 8) (shape 2 1 5) + (0) (-4343) (-10580) w195 w176 w126 + (by decide +kernel) w195_sound w176_sound w126_sound) (by decide +kernel) +lemma A4_4_8Raw_2_2_4 : (A4_4_8Raw (shape 2 2 4)).Encloses (splitWeight positiveInitial tableP (shape 4 4 8) (shape 2 2 4) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 4 4 8) (shape 2 2 4) + (0) (0) (0) w195 w195 w195 + (by decide +kernel) w195_sound w195_sound w195_sound) (by decide +kernel) +lemma A4_4_8Raw_2_3_3 : (A4_4_8Raw (shape 2 3 3)).Encloses (splitWeight positiveInitial tableP (shape 4 4 8) (shape 2 3 3) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 4 4 8) (shape 2 3 3) + (0) (-4343) (-10580) w195 w176 w126 + (by decide +kernel) w195_sound w176_sound w126_sound) (by decide +kernel) +lemma A4_4_8Raw_2_4_2 : (A4_4_8Raw (shape 2 4 2)).Encloses (splitWeight positiveInitial tableP (shape 4 4 8) (shape 2 4 2) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 4 4 8) (shape 2 4 2) + (0) (-17106) (-34294) w195 w99 w55 + (by decide +kernel) w195_sound w99_sound w55_sound) (by decide +kernel) +lemma A4_4_8Raw_3_0_5 : (A4_4_8Raw (shape 3 0 5)).Encloses (splitWeight positiveInitial tableP (shape 4 4 8) (shape 3 0 5) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 4 4 8) (shape 3 0 5) + (-4357) (-17106) (-10580) w175 w99 w126 + (by decide +kernel) w175_sound w99_sound w126_sound) (by decide +kernel) +lemma A4_4_8Raw_3_1_4 : (A4_4_8Raw (shape 3 1 4)).Encloses (splitWeight positiveInitial tableP (shape 4 4 8) (shape 3 1 4) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 4 4 8) (shape 3 1 4) + (-4357) (-4343) (0) w175 w176 w195 + (by decide +kernel) w175_sound w176_sound w195_sound) (by decide +kernel) +lemma A4_4_8Raw_3_2_3 : (A4_4_8Raw (shape 3 2 3)).Encloses (splitWeight positiveInitial tableP (shape 4 4 8) (shape 3 2 3) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 4 4 8) (shape 3 2 3) + (-4357) (0) (-10580) w175 w195 w126 + (by decide +kernel) w175_sound w195_sound w126_sound) (by decide +kernel) +lemma A4_4_8Raw_3_3_2 : (A4_4_8Raw (shape 3 3 2)).Encloses (splitWeight positiveInitial tableP (shape 4 4 8) (shape 3 3 2) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 4 4 8) (shape 3 3 2) + (-4357) (-4343) (-34294) w175 w176 w55 + (by decide +kernel) w175_sound w176_sound w55_sound) (by decide +kernel) +lemma A4_4_8Raw_3_4_1 : (A4_4_8Raw (shape 3 4 1)).Encloses (splitWeight positiveInitial tableP (shape 4 4 8) (shape 3 4 1) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 4 4 8) (shape 3 4 1) + (-4357) (-17106) (-70820) w175 w99 w12 + (by decide +kernel) w175_sound w99_sound w12_sound) (by decide +kernel) +lemma A4_4_8Raw_4_0_4 : (A4_4_8Raw (shape 4 0 4)).Encloses (splitWeight positiveInitial tableP (shape 4 4 8) (shape 4 0 4) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 4 4 8) (shape 4 0 4) + (-17266) (-17106) (0) w98 w99 w195 + (by decide +kernel) w98_sound w99_sound w195_sound) (by decide +kernel) +lemma A4_4_8Raw_4_1_3 : (A4_4_8Raw (shape 4 1 3)).Encloses (splitWeight positiveInitial tableP (shape 4 4 8) (shape 4 1 3) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 4 4 8) (shape 4 1 3) + (-17266) (-4343) (-10580) w98 w176 w126 + (by decide +kernel) w98_sound w176_sound w126_sound) (by decide +kernel) +lemma A4_4_8Raw_4_2_2 : (A4_4_8Raw (shape 4 2 2)).Encloses (splitWeight positiveInitial tableP (shape 4 4 8) (shape 4 2 2) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 4 4 8) (shape 4 2 2) + (-17266) (0) (-34294) w98 w195 w55 + (by decide +kernel) w98_sound w195_sound w55_sound) (by decide +kernel) +lemma A4_4_8Raw_4_3_1 : (A4_4_8Raw (shape 4 3 1)).Encloses (splitWeight positiveInitial tableP (shape 4 4 8) (shape 4 3 1) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 4 4 8) (shape 4 3 1) + (-17266) (-4343) (-70820) w98 w176 w12 + (by decide +kernel) w98_sound w176_sound w12_sound) (by decide +kernel) +lemma A4_4_8Raw_4_4_0 : (A4_4_8Raw (shape 4 4 0)).Encloses (splitWeight positiveInitial tableP (shape 4 4 8) (shape 4 4 0) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 4 4 8) (shape 4 4 0) + (-17266) (-17106) (-120770) w98 w99 w0 + (by decide +kernel) w98_sound w99_sound w0_sound) (by decide +kernel) +lemma A4_4_8Raw_sound (u : Shape) (hu : u ∈ below (shape 4 4 8)) : + (A4_4_8Raw u).Encloses (splitWeight positiveInitial tableP (shape 4 4 8) u : ℝ) := by + rw [A4_4_8_below] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl + · exact A4_4_8Raw_0_0_8 + · exact A4_4_8Raw_0_1_7 + · exact A4_4_8Raw_0_2_6 + · exact A4_4_8Raw_0_3_5 + · exact A4_4_8Raw_0_4_4 + · exact A4_4_8Raw_1_0_7 + · exact A4_4_8Raw_1_1_6 + · exact A4_4_8Raw_1_2_5 + · exact A4_4_8Raw_1_3_4 + · exact A4_4_8Raw_1_4_3 + · exact A4_4_8Raw_2_0_6 + · exact A4_4_8Raw_2_1_5 + · exact A4_4_8Raw_2_2_4 + · exact A4_4_8Raw_2_3_3 + · exact A4_4_8Raw_2_4_2 + · exact A4_4_8Raw_3_0_5 + · exact A4_4_8Raw_3_1_4 + · exact A4_4_8Raw_3_2_3 + · exact A4_4_8Raw_3_3_2 + · exact A4_4_8Raw_3_4_1 + · exact A4_4_8Raw_4_0_4 + · exact A4_4_8Raw_4_1_3 + · exact A4_4_8Raw_4_2_2 + · exact A4_4_8Raw_4_3_1 + · exact A4_4_8Raw_4_4_0 +def A4_4_8Den : Ball := ⟨(150648199314227147605087079506763 / 50000000000000000000000000000000), (129 / 25000000000000000000000000000000)⟩ +lemma A4_4_8Den_sound : A4_4_8Den.Encloses (((below (shape 4 4 8)).map (splitWeight positiveInitial tableP (shape 4 4 8))).sum : ℝ) := by + exact contains_sound (list_cast_enclosed (below (shape 4 4 8)) A4_4_8Raw (splitWeight positiveInitial tableP (shape 4 4 8)) A4_4_8Raw_sound) (by decide +kernel) +lemma A4_4_8Den_positive : 0 < A4_4_8Den.lower := by decide +kernel +def A4_4_8Table (s : Shape) : Ball := + match s 0, s 1, s 2 with + | 0, 0, 8 => ⟨(3035600478242196747209827 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 0, 1, 7 => ⟨(100395816077291183265741961 / 3125000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 0, 2, 6 => ⟨(95665140797271696018077340381 / 50000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ + | 0, 3, 5 => ⟨(1327564258600440675632668642677 / 100000000000000000000000000000000), (1 / 12500000000000000000000000000000)⟩ + | 0, 4, 4 => ⟨(266801996340761781073908742717 / 25000000000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ + | 1, 0, 7 => ⟨(407489389771853581693404047 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 1, 1, 6 => ⟨(225304760565353108107595575157 / 50000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ + | 1, 2, 5 => ⟨(1863118166289372952288716397111 / 25000000000000000000000000000000), (31 / 100000000000000000000000000000000)⟩ + | 1, 3, 4 => ⟨(869060232620536432990705106057 / 6250000000000000000000000000000), (7 / 12500000000000000000000000000000)⟩ + | 1, 4, 3 => ⟨(53883555187553276131757505307 / 4000000000000000000000000000000), (1 / 12500000000000000000000000000000)⟩ + | 2, 0, 6 => ⟨(194416187515041316719536553259 / 100000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ + | 2, 1, 5 => ⟨(7462913433721381544107457287859 / 100000000000000000000000000000000), (31 / 100000000000000000000000000000000)⟩ + | 2, 2, 4 => ⟨(16594954412866328459781726401447 / 50000000000000000000000000000000), (29 / 50000000000000000000000000000000)⟩ + | 2, 3, 3 => ⟨(7462913433721381544107457287859 / 100000000000000000000000000000000), (31 / 100000000000000000000000000000000)⟩ + | 2, 4, 2 => ⟨(194416187515041316719536553259 / 100000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ + | 3, 0, 5 => ⟨(53883555187553276131757505307 / 4000000000000000000000000000000), (1 / 12500000000000000000000000000000)⟩ + | 3, 1, 4 => ⟨(869060232620536432990705106057 / 6250000000000000000000000000000), (7 / 12500000000000000000000000000000)⟩ + | 3, 2, 3 => ⟨(1863118166289372952288716397111 / 25000000000000000000000000000000), (31 / 100000000000000000000000000000000)⟩ + | 3, 3, 2 => ⟨(225304760565353108107595575157 / 50000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ + | 3, 4, 1 => ⟨(407489389771853581693404047 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 4, 0, 4 => ⟨(266801996340761781073908742717 / 25000000000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ + | 4, 1, 3 => ⟨(1327564258600440675632668642677 / 100000000000000000000000000000000), (1 / 12500000000000000000000000000000)⟩ + | 4, 2, 2 => ⟨(95665140797271696018077340381 / 50000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ + | 4, 3, 1 => ⟨(100395816077291183265741961 / 3125000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 4, 4, 0 => ⟨(3035600478242196747209827 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | _, _, _ => (.exact 0) +def A4_4_8Law (u : Shape) : Ball := if u ∈ below (shape 4 4 8) then A4_4_8Table u else .exact 0 +lemma A4_4_8Law_check_0_0_8 : contains (.mul (A4_4_8Raw (shape 0 0 8)) (.inv A4_4_8Den)) (A4_4_8Table (shape 0 0 8)) = true := by decide +kernel +lemma A4_4_8Law_check_0_1_7 : contains (.mul (A4_4_8Raw (shape 0 1 7)) (.inv A4_4_8Den)) (A4_4_8Table (shape 0 1 7)) = true := by decide +kernel +lemma A4_4_8Law_check_0_2_6 : contains (.mul (A4_4_8Raw (shape 0 2 6)) (.inv A4_4_8Den)) (A4_4_8Table (shape 0 2 6)) = true := by decide +kernel +lemma A4_4_8Law_check_0_3_5 : contains (.mul (A4_4_8Raw (shape 0 3 5)) (.inv A4_4_8Den)) (A4_4_8Table (shape 0 3 5)) = true := by decide +kernel +lemma A4_4_8Law_check_0_4_4 : contains (.mul (A4_4_8Raw (shape 0 4 4)) (.inv A4_4_8Den)) (A4_4_8Table (shape 0 4 4)) = true := by decide +kernel +lemma A4_4_8Law_check_1_0_7 : contains (.mul (A4_4_8Raw (shape 1 0 7)) (.inv A4_4_8Den)) (A4_4_8Table (shape 1 0 7)) = true := by decide +kernel +lemma A4_4_8Law_check_1_1_6 : contains (.mul (A4_4_8Raw (shape 1 1 6)) (.inv A4_4_8Den)) (A4_4_8Table (shape 1 1 6)) = true := by decide +kernel +lemma A4_4_8Law_check_1_2_5 : contains (.mul (A4_4_8Raw (shape 1 2 5)) (.inv A4_4_8Den)) (A4_4_8Table (shape 1 2 5)) = true := by decide +kernel +lemma A4_4_8Law_check_1_3_4 : contains (.mul (A4_4_8Raw (shape 1 3 4)) (.inv A4_4_8Den)) (A4_4_8Table (shape 1 3 4)) = true := by decide +kernel +lemma A4_4_8Law_check_1_4_3 : contains (.mul (A4_4_8Raw (shape 1 4 3)) (.inv A4_4_8Den)) (A4_4_8Table (shape 1 4 3)) = true := by decide +kernel +lemma A4_4_8Law_check_2_0_6 : contains (.mul (A4_4_8Raw (shape 2 0 6)) (.inv A4_4_8Den)) (A4_4_8Table (shape 2 0 6)) = true := by decide +kernel +lemma A4_4_8Law_check_2_1_5 : contains (.mul (A4_4_8Raw (shape 2 1 5)) (.inv A4_4_8Den)) (A4_4_8Table (shape 2 1 5)) = true := by decide +kernel +lemma A4_4_8Law_check_2_2_4 : contains (.mul (A4_4_8Raw (shape 2 2 4)) (.inv A4_4_8Den)) (A4_4_8Table (shape 2 2 4)) = true := by decide +kernel +lemma A4_4_8Law_check_2_3_3 : contains (.mul (A4_4_8Raw (shape 2 3 3)) (.inv A4_4_8Den)) (A4_4_8Table (shape 2 3 3)) = true := by decide +kernel +lemma A4_4_8Law_check_2_4_2 : contains (.mul (A4_4_8Raw (shape 2 4 2)) (.inv A4_4_8Den)) (A4_4_8Table (shape 2 4 2)) = true := by decide +kernel +lemma A4_4_8Law_check_3_0_5 : contains (.mul (A4_4_8Raw (shape 3 0 5)) (.inv A4_4_8Den)) (A4_4_8Table (shape 3 0 5)) = true := by decide +kernel +lemma A4_4_8Law_check_3_1_4 : contains (.mul (A4_4_8Raw (shape 3 1 4)) (.inv A4_4_8Den)) (A4_4_8Table (shape 3 1 4)) = true := by decide +kernel +lemma A4_4_8Law_check_3_2_3 : contains (.mul (A4_4_8Raw (shape 3 2 3)) (.inv A4_4_8Den)) (A4_4_8Table (shape 3 2 3)) = true := by decide +kernel +lemma A4_4_8Law_check_3_3_2 : contains (.mul (A4_4_8Raw (shape 3 3 2)) (.inv A4_4_8Den)) (A4_4_8Table (shape 3 3 2)) = true := by decide +kernel +lemma A4_4_8Law_check_3_4_1 : contains (.mul (A4_4_8Raw (shape 3 4 1)) (.inv A4_4_8Den)) (A4_4_8Table (shape 3 4 1)) = true := by decide +kernel +lemma A4_4_8Law_check_4_0_4 : contains (.mul (A4_4_8Raw (shape 4 0 4)) (.inv A4_4_8Den)) (A4_4_8Table (shape 4 0 4)) = true := by decide +kernel +lemma A4_4_8Law_check_4_1_3 : contains (.mul (A4_4_8Raw (shape 4 1 3)) (.inv A4_4_8Den)) (A4_4_8Table (shape 4 1 3)) = true := by decide +kernel +lemma A4_4_8Law_check_4_2_2 : contains (.mul (A4_4_8Raw (shape 4 2 2)) (.inv A4_4_8Den)) (A4_4_8Table (shape 4 2 2)) = true := by decide +kernel +lemma A4_4_8Law_check_4_3_1 : contains (.mul (A4_4_8Raw (shape 4 3 1)) (.inv A4_4_8Den)) (A4_4_8Table (shape 4 3 1)) = true := by decide +kernel +lemma A4_4_8Law_check_4_4_0 : contains (.mul (A4_4_8Raw (shape 4 4 0)) (.inv A4_4_8Den)) (A4_4_8Table (shape 4 4 0)) = true := by decide +kernel +lemma A4_4_8Law_check (u : Shape) (hu : u ∈ below (shape 4 4 8)) : + contains (.mul (A4_4_8Raw u) (.inv A4_4_8Den)) (A4_4_8Table u) = true := by + rw [A4_4_8_below] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl + · exact A4_4_8Law_check_0_0_8 + · exact A4_4_8Law_check_0_1_7 + · exact A4_4_8Law_check_0_2_6 + · exact A4_4_8Law_check_0_3_5 + · exact A4_4_8Law_check_0_4_4 + · exact A4_4_8Law_check_1_0_7 + · exact A4_4_8Law_check_1_1_6 + · exact A4_4_8Law_check_1_2_5 + · exact A4_4_8Law_check_1_3_4 + · exact A4_4_8Law_check_1_4_3 + · exact A4_4_8Law_check_2_0_6 + · exact A4_4_8Law_check_2_1_5 + · exact A4_4_8Law_check_2_2_4 + · exact A4_4_8Law_check_2_3_3 + · exact A4_4_8Law_check_2_4_2 + · exact A4_4_8Law_check_3_0_5 + · exact A4_4_8Law_check_3_1_4 + · exact A4_4_8Law_check_3_2_3 + · exact A4_4_8Law_check_3_3_2 + · exact A4_4_8Law_check_3_4_1 + · exact A4_4_8Law_check_4_0_4 + · exact A4_4_8Law_check_4_1_3 + · exact A4_4_8Law_check_4_2_2 + · exact A4_4_8Law_check_4_3_1 + · exact A4_4_8Law_check_4_4_0 +lemma A4_4_8Law_sound (u : Shape) : + (A4_4_8Law u).Encloses (stageALaw (shape 4 4 8) u : ℝ) := by + by_cases hu : u ∈ below (shape 4 4 8) + · have h := contains_sound (Ball.mul_sound (A4_4_8Raw_sound u hu) + (Ball.inv_sound A4_4_8Den_sound A4_4_8Den_positive)) (A4_4_8Law_check u hu) + simpa only [A4_4_8Law, hu, ite_true, stageALaw, splitLaw, + Rat.cast_div, Rat.cast_mul, Rat.cast_inv, div_eq_mul_inv] using h + · simp only [A4_4_8Law, hu, ite_false, stageALaw, splitLaw, Rat.cast_zero] + simpa only [Rat.cast_zero] using Ball.exact_sound 0 + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate +open scoped BigOperators +lemma A5_5_6_below : below (shape 5 5 6) = [ + (shape 0 2 6), + (shape 0 3 5), + (shape 0 4 4), + (shape 0 5 3), + (shape 1 1 6), + (shape 1 2 5), + (shape 1 3 4), + (shape 1 4 3), + (shape 1 5 2), + (shape 2 0 6), + (shape 2 1 5), + (shape 2 2 4), + (shape 2 3 3), + (shape 2 4 2), + (shape 2 5 1), + (shape 3 0 5), + (shape 3 1 4), + (shape 3 2 3), + (shape 3 3 2), + (shape 3 4 1), + (shape 3 5 0), + (shape 4 0 4), + (shape 4 1 3), + (shape 4 2 2), + (shape 4 3 1), + (shape 4 4 0), + (shape 5 0 3), + (shape 5 1 2), + (shape 5 2 1), + (shape 5 3 0)] := by decide +kernel +def A5_5_6Raw (s : Shape) : Ball := + match s 0, s 1, s 2 with + | 0, 2, 6 => ⟨(598393443808798963104497811 / 5000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 0, 3, 5 => ⟨(269057595129013954010741499 / 100000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 0, 4, 4 => ⟨(195357478600075867932284843153 / 25000000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ + | 0, 5, 3 => ⟨(67997999417353477070680589579 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 1, 1, 6 => ⟨(11231598536934101059647265467 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 1, 2, 5 => ⟨(339979024578301882451997256747 / 12500000000000000000000000000000), (1 / 12500000000000000000000000000000)⟩ + | 1, 3, 4 => ⟨(425430866772270433481086062941 / 2000000000000000000000000000000), (7 / 12500000000000000000000000000000)⟩ + | 1, 4, 3 => ⟨(13773826846282937567353855599691 / 100000000000000000000000000000000), (19 / 50000000000000000000000000000000)⟩ + | 1, 5, 2 => ⟨(394207840594426910088570909701 / 50000000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ + | 2, 0, 6 => ⟨(6044678416630759639672068403 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 2, 1, 5 => ⟨(1361548977162547525623139130929 / 50000000000000000000000000000000), (1 / 12500000000000000000000000000000)⟩ + | 2, 2, 4 => ⟨(5734984758757153909776083780903 / 10000000000000000000000000000000), (73 / 100000000000000000000000000000000)⟩ + | 2, 3, 3 => ⟨1, 0⟩ + | 2, 4, 2 => ⟨(4259416902451820897167775843919 / 20000000000000000000000000000000), (29 / 50000000000000000000000000000000)⟩ + | 2, 5, 1 => ⟨(6794721161026753944048082769 / 2500000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ + | 3, 0, 5 => ⟨(6794721161026753944048082769 / 2500000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ + | 3, 1, 4 => ⟨(4259416902451820897167775843919 / 20000000000000000000000000000000), (29 / 50000000000000000000000000000000)⟩ + | 3, 2, 3 => ⟨1, 0⟩ + | 3, 3, 2 => ⟨(5734984758757153909776083780903 / 10000000000000000000000000000000), (73 / 100000000000000000000000000000000)⟩ + | 3, 4, 1 => ⟨(1361548977162547525623139130929 / 50000000000000000000000000000000), (1 / 12500000000000000000000000000000)⟩ + | 3, 5, 0 => ⟨(6044678416630759639672068403 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 4, 0, 4 => ⟨(394207840594426910088570909701 / 50000000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ + | 4, 1, 3 => ⟨(13773826846282937567353855599691 / 100000000000000000000000000000000), (19 / 50000000000000000000000000000000)⟩ + | 4, 2, 2 => ⟨(425430866772270433481086062941 / 2000000000000000000000000000000), (7 / 12500000000000000000000000000000)⟩ + | 4, 3, 1 => ⟨(339979024578301882451997256747 / 12500000000000000000000000000000), (1 / 12500000000000000000000000000000)⟩ + | 4, 4, 0 => ⟨(11231598536934101059647265467 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 5, 0, 3 => ⟨(67997999417353477070680589579 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 5, 1, 2 => ⟨(195357478600075867932284843153 / 25000000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ + | 5, 2, 1 => ⟨(269057595129013954010741499 / 100000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 5, 3, 0 => ⟨(598393443808798963104497811 / 5000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | _, _, _ => (.exact 0) +lemma A5_5_6Raw_0_2_6 : (A5_5_6Raw (shape 0 2 6)).Encloses (splitWeight positiveInitial tableP (shape 5 5 6) (shape 0 2 6) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 5 5 6) (shape 0 2 6) + (-33052) (0) (-57255) w58 w195 w23 + (by decide +kernel) w58_sound w195_sound w23_sound) (by decide +kernel) +lemma A5_5_6Raw_0_3_5 : (A5_5_6Raw (shape 0 3 5)).Encloses (splitWeight positiveInitial tableP (shape 5 5 6) (shape 0 3 5) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 5 5 6) (shape 0 3 5) + (-33052) (0) (-26128) w58 w195 w77 + (by decide +kernel) w58_sound w195_sound w77_sound) (by decide +kernel) +lemma A5_5_6Raw_0_4_4 : (A5_5_6Raw (shape 0 4 4)).Encloses (splitWeight positiveInitial tableP (shape 5 5 6) (shape 0 4 4) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 5 5 6) (shape 0 4 4) + (-33052) (-9906) (-5560) w58 w131 w168 + (by decide +kernel) w58_sound w131_sound w168_sound) (by decide +kernel) +lemma A5_5_6Raw_0_5_3 : (A5_5_6Raw (shape 0 5 3)).Encloses (splitWeight positiveInitial tableP (shape 5 5 6) (shape 0 5 3) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 5 5 6) (shape 0 5 3) + (-33052) (-32951) (0) w58 w59 w195 + (by decide +kernel) w58_sound w59_sound w195_sound) (by decide +kernel) +lemma A5_5_6Raw_1_1_6 : (A5_5_6Raw (shape 1 1 6)).Encloses (splitWeight positiveInitial tableP (shape 5 5 6) (shape 1 1 6) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 5 5 6) (shape 1 1 6) + (-9918) (-9906) (-57255) w130 w131 w23 + (by decide +kernel) w130_sound w131_sound w23_sound) (by decide +kernel) +lemma A5_5_6Raw_1_2_5 : (A5_5_6Raw (shape 1 2 5)).Encloses (splitWeight positiveInitial tableP (shape 5 5 6) (shape 1 2 5) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 5 5 6) (shape 1 2 5) + (-9918) (0) (-26128) w130 w195 w77 + (by decide +kernel) w130_sound w195_sound w77_sound) (by decide +kernel) +lemma A5_5_6Raw_1_3_4 : (A5_5_6Raw (shape 1 3 4)).Encloses (splitWeight positiveInitial tableP (shape 5 5 6) (shape 1 3 4) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 5 5 6) (shape 1 3 4) + (-9918) (0) (-5560) w130 w195 w168 + (by decide +kernel) w130_sound w195_sound w168_sound) (by decide +kernel) +lemma A5_5_6Raw_1_4_3 : (A5_5_6Raw (shape 1 4 3)).Encloses (splitWeight positiveInitial tableP (shape 5 5 6) (shape 1 4 3) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 5 5 6) (shape 1 4 3) + (-9918) (-9906) (0) w130 w131 w195 + (by decide +kernel) w130_sound w131_sound w195_sound) (by decide +kernel) +lemma A5_5_6Raw_1_5_2 : (A5_5_6Raw (shape 1 5 2)).Encloses (splitWeight positiveInitial tableP (shape 5 5 6) (shape 1 5 2) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 5 5 6) (shape 1 5 2) + (-9918) (-32951) (-5560) w130 w59 w168 + (by decide +kernel) w130_sound w59_sound w168_sound) (by decide +kernel) +lemma A5_5_6Raw_2_0_6 : (A5_5_6Raw (shape 2 0 6)).Encloses (splitWeight positiveInitial tableP (shape 5 5 6) (shape 2 0 6) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 5 5 6) (shape 2 0 6) + (0) (-32951) (-57255) w195 w59 w23 + (by decide +kernel) w195_sound w59_sound w23_sound) (by decide +kernel) +lemma A5_5_6Raw_2_1_5 : (A5_5_6Raw (shape 2 1 5)).Encloses (splitWeight positiveInitial tableP (shape 5 5 6) (shape 2 1 5) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 5 5 6) (shape 2 1 5) + (0) (-9906) (-26128) w195 w131 w77 + (by decide +kernel) w195_sound w131_sound w77_sound) (by decide +kernel) +lemma A5_5_6Raw_2_2_4 : (A5_5_6Raw (shape 2 2 4)).Encloses (splitWeight positiveInitial tableP (shape 5 5 6) (shape 2 2 4) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 5 5 6) (shape 2 2 4) + (0) (0) (-5560) w195 w195 w168 + (by decide +kernel) w195_sound w195_sound w168_sound) (by decide +kernel) +lemma A5_5_6Raw_2_3_3 : (A5_5_6Raw (shape 2 3 3)).Encloses (splitWeight positiveInitial tableP (shape 5 5 6) (shape 2 3 3) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 5 5 6) (shape 2 3 3) + (0) (0) (0) w195 w195 w195 + (by decide +kernel) w195_sound w195_sound w195_sound) (by decide +kernel) +lemma A5_5_6Raw_2_4_2 : (A5_5_6Raw (shape 2 4 2)).Encloses (splitWeight positiveInitial tableP (shape 5 5 6) (shape 2 4 2) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 5 5 6) (shape 2 4 2) + (0) (-9906) (-5560) w195 w131 w168 + (by decide +kernel) w195_sound w131_sound w168_sound) (by decide +kernel) +lemma A5_5_6Raw_2_5_1 : (A5_5_6Raw (shape 2 5 1)).Encloses (splitWeight positiveInitial tableP (shape 5 5 6) (shape 2 5 1) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 5 5 6) (shape 2 5 1) + (0) (-32951) (-26128) w195 w59 w77 + (by decide +kernel) w195_sound w59_sound w77_sound) (by decide +kernel) +lemma A5_5_6Raw_3_0_5 : (A5_5_6Raw (shape 3 0 5)).Encloses (splitWeight positiveInitial tableP (shape 5 5 6) (shape 3 0 5) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 5 5 6) (shape 3 0 5) + (0) (-32951) (-26128) w195 w59 w77 + (by decide +kernel) w195_sound w59_sound w77_sound) (by decide +kernel) +lemma A5_5_6Raw_3_1_4 : (A5_5_6Raw (shape 3 1 4)).Encloses (splitWeight positiveInitial tableP (shape 5 5 6) (shape 3 1 4) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 5 5 6) (shape 3 1 4) + (0) (-9906) (-5560) w195 w131 w168 + (by decide +kernel) w195_sound w131_sound w168_sound) (by decide +kernel) +lemma A5_5_6Raw_3_2_3 : (A5_5_6Raw (shape 3 2 3)).Encloses (splitWeight positiveInitial tableP (shape 5 5 6) (shape 3 2 3) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 5 5 6) (shape 3 2 3) + (0) (0) (0) w195 w195 w195 + (by decide +kernel) w195_sound w195_sound w195_sound) (by decide +kernel) +lemma A5_5_6Raw_3_3_2 : (A5_5_6Raw (shape 3 3 2)).Encloses (splitWeight positiveInitial tableP (shape 5 5 6) (shape 3 3 2) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 5 5 6) (shape 3 3 2) + (0) (0) (-5560) w195 w195 w168 + (by decide +kernel) w195_sound w195_sound w168_sound) (by decide +kernel) +lemma A5_5_6Raw_3_4_1 : (A5_5_6Raw (shape 3 4 1)).Encloses (splitWeight positiveInitial tableP (shape 5 5 6) (shape 3 4 1) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 5 5 6) (shape 3 4 1) + (0) (-9906) (-26128) w195 w131 w77 + (by decide +kernel) w195_sound w131_sound w77_sound) (by decide +kernel) +lemma A5_5_6Raw_3_5_0 : (A5_5_6Raw (shape 3 5 0)).Encloses (splitWeight positiveInitial tableP (shape 5 5 6) (shape 3 5 0) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 5 5 6) (shape 3 5 0) + (0) (-32951) (-57255) w195 w59 w23 + (by decide +kernel) w195_sound w59_sound w23_sound) (by decide +kernel) +lemma A5_5_6Raw_4_0_4 : (A5_5_6Raw (shape 4 0 4)).Encloses (splitWeight positiveInitial tableP (shape 5 5 6) (shape 4 0 4) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 5 5 6) (shape 4 0 4) + (-9918) (-32951) (-5560) w130 w59 w168 + (by decide +kernel) w130_sound w59_sound w168_sound) (by decide +kernel) +lemma A5_5_6Raw_4_1_3 : (A5_5_6Raw (shape 4 1 3)).Encloses (splitWeight positiveInitial tableP (shape 5 5 6) (shape 4 1 3) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 5 5 6) (shape 4 1 3) + (-9918) (-9906) (0) w130 w131 w195 + (by decide +kernel) w130_sound w131_sound w195_sound) (by decide +kernel) +lemma A5_5_6Raw_4_2_2 : (A5_5_6Raw (shape 4 2 2)).Encloses (splitWeight positiveInitial tableP (shape 5 5 6) (shape 4 2 2) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 5 5 6) (shape 4 2 2) + (-9918) (0) (-5560) w130 w195 w168 + (by decide +kernel) w130_sound w195_sound w168_sound) (by decide +kernel) +lemma A5_5_6Raw_4_3_1 : (A5_5_6Raw (shape 4 3 1)).Encloses (splitWeight positiveInitial tableP (shape 5 5 6) (shape 4 3 1) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 5 5 6) (shape 4 3 1) + (-9918) (0) (-26128) w130 w195 w77 + (by decide +kernel) w130_sound w195_sound w77_sound) (by decide +kernel) +lemma A5_5_6Raw_4_4_0 : (A5_5_6Raw (shape 4 4 0)).Encloses (splitWeight positiveInitial tableP (shape 5 5 6) (shape 4 4 0) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 5 5 6) (shape 4 4 0) + (-9918) (-9906) (-57255) w130 w131 w23 + (by decide +kernel) w130_sound w131_sound w23_sound) (by decide +kernel) +lemma A5_5_6Raw_5_0_3 : (A5_5_6Raw (shape 5 0 3)).Encloses (splitWeight positiveInitial tableP (shape 5 5 6) (shape 5 0 3) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 5 5 6) (shape 5 0 3) + (-33052) (-32951) (0) w58 w59 w195 + (by decide +kernel) w58_sound w59_sound w195_sound) (by decide +kernel) +lemma A5_5_6Raw_5_1_2 : (A5_5_6Raw (shape 5 1 2)).Encloses (splitWeight positiveInitial tableP (shape 5 5 6) (shape 5 1 2) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 5 5 6) (shape 5 1 2) + (-33052) (-9906) (-5560) w58 w131 w168 + (by decide +kernel) w58_sound w131_sound w168_sound) (by decide +kernel) +lemma A5_5_6Raw_5_2_1 : (A5_5_6Raw (shape 5 2 1)).Encloses (splitWeight positiveInitial tableP (shape 5 5 6) (shape 5 2 1) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 5 5 6) (shape 5 2 1) + (-33052) (0) (-26128) w58 w195 w77 + (by decide +kernel) w58_sound w195_sound w77_sound) (by decide +kernel) +lemma A5_5_6Raw_5_3_0 : (A5_5_6Raw (shape 5 3 0)).Encloses (splitWeight positiveInitial tableP (shape 5 5 6) (shape 5 3 0) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveInitial tableP (shape 5 5 6) (shape 5 3 0) + (-33052) (0) (-57255) w58 w195 w23 + (by decide +kernel) w58_sound w195_sound w23_sound) (by decide +kernel) +lemma A5_5_6Raw_sound (u : Shape) (hu : u ∈ below (shape 5 5 6)) : + (A5_5_6Raw u).Encloses (splitWeight positiveInitial tableP (shape 5 5 6) u : ℝ) := by + rw [A5_5_6_below] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl + · exact A5_5_6Raw_0_2_6 + · exact A5_5_6Raw_0_3_5 + · exact A5_5_6Raw_0_4_4 + · exact A5_5_6Raw_0_5_3 + · exact A5_5_6Raw_1_1_6 + · exact A5_5_6Raw_1_2_5 + · exact A5_5_6Raw_1_3_4 + · exact A5_5_6Raw_1_4_3 + · exact A5_5_6Raw_1_5_2 + · exact A5_5_6Raw_2_0_6 + · exact A5_5_6Raw_2_1_5 + · exact A5_5_6Raw_2_2_4 + · exact A5_5_6Raw_2_3_3 + · exact A5_5_6Raw_2_4_2 + · exact A5_5_6Raw_2_5_1 + · exact A5_5_6Raw_3_0_5 + · exact A5_5_6Raw_3_1_4 + · exact A5_5_6Raw_3_2_3 + · exact A5_5_6Raw_3_3_2 + · exact A5_5_6Raw_3_4_1 + · exact A5_5_6Raw_3_5_0 + · exact A5_5_6Raw_4_0_4 + · exact A5_5_6Raw_4_1_3 + · exact A5_5_6Raw_4_2_2 + · exact A5_5_6Raw_4_3_1 + · exact A5_5_6Raw_4_4_0 + · exact A5_5_6Raw_5_0_3 + · exact A5_5_6Raw_5_1_2 + · exact A5_5_6Raw_5_2_1 + · exact A5_5_6Raw_5_3_0 +def A5_5_6Den : Ball := ⟨(110725452045764867598235231213513 / 25000000000000000000000000000000), (1 / 195312500000000000000000000000)⟩ +lemma A5_5_6Den_sound : A5_5_6Den.Encloses (((below (shape 5 5 6)).map (splitWeight positiveInitial tableP (shape 5 5 6))).sum : ℝ) := by + exact contains_sound (list_cast_enclosed (below (shape 5 5 6)) A5_5_6Raw (splitWeight positiveInitial tableP (shape 5 5 6)) A5_5_6Raw_sound) (by decide +kernel) +lemma A5_5_6Den_positive : 0 < A5_5_6Den.lower := by decide +kernel +def A5_5_6Table (s : Shape) : Ball := + match s 0, s 1, s 2 with + | 0, 2, 6 => ⟨(675537368275398796035425779 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 0, 3, 5 => ⟨(12149762776213706359494656353 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 0, 4, 4 => ⟨(176434121505623680657566151503 / 100000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ + | 0, 5, 3 => ⟨(30705677042189293652050887643 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 1, 1, 6 => ⟨(10143646586596796759663111597 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 1, 2, 5 => ⟨(614093721537090303603790920153 / 100000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ + | 1, 3, 4 => ⟨(4802767328017229778204193388411 / 100000000000000000000000000000000), (19 / 100000000000000000000000000000000)⟩ + | 1, 4, 3 => ⟨(621981061797334608261562972731 / 20000000000000000000000000000000), (13 / 100000000000000000000000000000000)⟩ + | 1, 5, 2 => ⟨(89005696818355176566211545587 / 50000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ + | 2, 0, 6 => ⟨(272957947109232969209465951 / 10000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 2, 1, 5 => ⟨(614831076327326380909751491957 / 100000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ + | 2, 2, 4 => ⟨(6474329809449298000655312889227 / 50000000000000000000000000000000), (1 / 3125000000000000000000000000000)⟩ + | 2, 3, 3 => ⟨(22578367970597256891228418236613 / 100000000000000000000000000000000), (27 / 100000000000000000000000000000000)⟩ + | 2, 4, 2 => ⟨(2404267054093469337759843178867 / 50000000000000000000000000000000), (1 / 5000000000000000000000000000000)⟩ + | 2, 5, 1 => ⟨(30682742926253173520153038357 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 3, 0, 5 => ⟨(30682742926253173520153038357 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 3, 1, 4 => ⟨(2404267054093469337759843178867 / 50000000000000000000000000000000), (1 / 5000000000000000000000000000000)⟩ + | 3, 2, 3 => ⟨(22578367970597256891228418236613 / 100000000000000000000000000000000), (27 / 100000000000000000000000000000000)⟩ + | 3, 3, 2 => ⟨(6474329809449298000655312889227 / 50000000000000000000000000000000), (1 / 3125000000000000000000000000000)⟩ + | 3, 4, 1 => ⟨(614831076327326380909751491957 / 100000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ + | 3, 5, 0 => ⟨(272957947109232969209465951 / 10000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 4, 0, 4 => ⟨(89005696818355176566211545587 / 50000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ + | 4, 1, 3 => ⟨(621981061797334608261562972731 / 20000000000000000000000000000000), (13 / 100000000000000000000000000000000)⟩ + | 4, 2, 2 => ⟨(4802767328017229778204193388411 / 100000000000000000000000000000000), (19 / 100000000000000000000000000000000)⟩ + | 4, 3, 1 => ⟨(614093721537090303603790920153 / 100000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ + | 4, 4, 0 => ⟨(10143646586596796759663111597 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 5, 0, 3 => ⟨(30705677042189293652050887643 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 5, 1, 2 => ⟨(176434121505623680657566151503 / 100000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ + | 5, 2, 1 => ⟨(12149762776213706359494656353 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 5, 3, 0 => ⟨(675537368275398796035425779 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | _, _, _ => (.exact 0) +def A5_5_6Law (u : Shape) : Ball := if u ∈ below (shape 5 5 6) then A5_5_6Table u else .exact 0 +lemma A5_5_6Law_check_0_2_6 : contains (.mul (A5_5_6Raw (shape 0 2 6)) (.inv A5_5_6Den)) (A5_5_6Table (shape 0 2 6)) = true := by decide +kernel +lemma A5_5_6Law_check_0_3_5 : contains (.mul (A5_5_6Raw (shape 0 3 5)) (.inv A5_5_6Den)) (A5_5_6Table (shape 0 3 5)) = true := by decide +kernel +lemma A5_5_6Law_check_0_4_4 : contains (.mul (A5_5_6Raw (shape 0 4 4)) (.inv A5_5_6Den)) (A5_5_6Table (shape 0 4 4)) = true := by decide +kernel +lemma A5_5_6Law_check_0_5_3 : contains (.mul (A5_5_6Raw (shape 0 5 3)) (.inv A5_5_6Den)) (A5_5_6Table (shape 0 5 3)) = true := by decide +kernel +lemma A5_5_6Law_check_1_1_6 : contains (.mul (A5_5_6Raw (shape 1 1 6)) (.inv A5_5_6Den)) (A5_5_6Table (shape 1 1 6)) = true := by decide +kernel +lemma A5_5_6Law_check_1_2_5 : contains (.mul (A5_5_6Raw (shape 1 2 5)) (.inv A5_5_6Den)) (A5_5_6Table (shape 1 2 5)) = true := by decide +kernel +lemma A5_5_6Law_check_1_3_4 : contains (.mul (A5_5_6Raw (shape 1 3 4)) (.inv A5_5_6Den)) (A5_5_6Table (shape 1 3 4)) = true := by decide +kernel +lemma A5_5_6Law_check_1_4_3 : contains (.mul (A5_5_6Raw (shape 1 4 3)) (.inv A5_5_6Den)) (A5_5_6Table (shape 1 4 3)) = true := by decide +kernel +lemma A5_5_6Law_check_1_5_2 : contains (.mul (A5_5_6Raw (shape 1 5 2)) (.inv A5_5_6Den)) (A5_5_6Table (shape 1 5 2)) = true := by decide +kernel +lemma A5_5_6Law_check_2_0_6 : contains (.mul (A5_5_6Raw (shape 2 0 6)) (.inv A5_5_6Den)) (A5_5_6Table (shape 2 0 6)) = true := by decide +kernel +lemma A5_5_6Law_check_2_1_5 : contains (.mul (A5_5_6Raw (shape 2 1 5)) (.inv A5_5_6Den)) (A5_5_6Table (shape 2 1 5)) = true := by decide +kernel +lemma A5_5_6Law_check_2_2_4 : contains (.mul (A5_5_6Raw (shape 2 2 4)) (.inv A5_5_6Den)) (A5_5_6Table (shape 2 2 4)) = true := by decide +kernel +lemma A5_5_6Law_check_2_3_3 : contains (.mul (A5_5_6Raw (shape 2 3 3)) (.inv A5_5_6Den)) (A5_5_6Table (shape 2 3 3)) = true := by decide +kernel +lemma A5_5_6Law_check_2_4_2 : contains (.mul (A5_5_6Raw (shape 2 4 2)) (.inv A5_5_6Den)) (A5_5_6Table (shape 2 4 2)) = true := by decide +kernel +lemma A5_5_6Law_check_2_5_1 : contains (.mul (A5_5_6Raw (shape 2 5 1)) (.inv A5_5_6Den)) (A5_5_6Table (shape 2 5 1)) = true := by decide +kernel +lemma A5_5_6Law_check_3_0_5 : contains (.mul (A5_5_6Raw (shape 3 0 5)) (.inv A5_5_6Den)) (A5_5_6Table (shape 3 0 5)) = true := by decide +kernel +lemma A5_5_6Law_check_3_1_4 : contains (.mul (A5_5_6Raw (shape 3 1 4)) (.inv A5_5_6Den)) (A5_5_6Table (shape 3 1 4)) = true := by decide +kernel +lemma A5_5_6Law_check_3_2_3 : contains (.mul (A5_5_6Raw (shape 3 2 3)) (.inv A5_5_6Den)) (A5_5_6Table (shape 3 2 3)) = true := by decide +kernel +lemma A5_5_6Law_check_3_3_2 : contains (.mul (A5_5_6Raw (shape 3 3 2)) (.inv A5_5_6Den)) (A5_5_6Table (shape 3 3 2)) = true := by decide +kernel +lemma A5_5_6Law_check_3_4_1 : contains (.mul (A5_5_6Raw (shape 3 4 1)) (.inv A5_5_6Den)) (A5_5_6Table (shape 3 4 1)) = true := by decide +kernel +lemma A5_5_6Law_check_3_5_0 : contains (.mul (A5_5_6Raw (shape 3 5 0)) (.inv A5_5_6Den)) (A5_5_6Table (shape 3 5 0)) = true := by decide +kernel +lemma A5_5_6Law_check_4_0_4 : contains (.mul (A5_5_6Raw (shape 4 0 4)) (.inv A5_5_6Den)) (A5_5_6Table (shape 4 0 4)) = true := by decide +kernel +lemma A5_5_6Law_check_4_1_3 : contains (.mul (A5_5_6Raw (shape 4 1 3)) (.inv A5_5_6Den)) (A5_5_6Table (shape 4 1 3)) = true := by decide +kernel +lemma A5_5_6Law_check_4_2_2 : contains (.mul (A5_5_6Raw (shape 4 2 2)) (.inv A5_5_6Den)) (A5_5_6Table (shape 4 2 2)) = true := by decide +kernel +lemma A5_5_6Law_check_4_3_1 : contains (.mul (A5_5_6Raw (shape 4 3 1)) (.inv A5_5_6Den)) (A5_5_6Table (shape 4 3 1)) = true := by decide +kernel +lemma A5_5_6Law_check_4_4_0 : contains (.mul (A5_5_6Raw (shape 4 4 0)) (.inv A5_5_6Den)) (A5_5_6Table (shape 4 4 0)) = true := by decide +kernel +lemma A5_5_6Law_check_5_0_3 : contains (.mul (A5_5_6Raw (shape 5 0 3)) (.inv A5_5_6Den)) (A5_5_6Table (shape 5 0 3)) = true := by decide +kernel +lemma A5_5_6Law_check_5_1_2 : contains (.mul (A5_5_6Raw (shape 5 1 2)) (.inv A5_5_6Den)) (A5_5_6Table (shape 5 1 2)) = true := by decide +kernel +lemma A5_5_6Law_check_5_2_1 : contains (.mul (A5_5_6Raw (shape 5 2 1)) (.inv A5_5_6Den)) (A5_5_6Table (shape 5 2 1)) = true := by decide +kernel +lemma A5_5_6Law_check_5_3_0 : contains (.mul (A5_5_6Raw (shape 5 3 0)) (.inv A5_5_6Den)) (A5_5_6Table (shape 5 3 0)) = true := by decide +kernel +lemma A5_5_6Law_check (u : Shape) (hu : u ∈ below (shape 5 5 6)) : + contains (.mul (A5_5_6Raw u) (.inv A5_5_6Den)) (A5_5_6Table u) = true := by + rw [A5_5_6_below] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl + · exact A5_5_6Law_check_0_2_6 + · exact A5_5_6Law_check_0_3_5 + · exact A5_5_6Law_check_0_4_4 + · exact A5_5_6Law_check_0_5_3 + · exact A5_5_6Law_check_1_1_6 + · exact A5_5_6Law_check_1_2_5 + · exact A5_5_6Law_check_1_3_4 + · exact A5_5_6Law_check_1_4_3 + · exact A5_5_6Law_check_1_5_2 + · exact A5_5_6Law_check_2_0_6 + · exact A5_5_6Law_check_2_1_5 + · exact A5_5_6Law_check_2_2_4 + · exact A5_5_6Law_check_2_3_3 + · exact A5_5_6Law_check_2_4_2 + · exact A5_5_6Law_check_2_5_1 + · exact A5_5_6Law_check_3_0_5 + · exact A5_5_6Law_check_3_1_4 + · exact A5_5_6Law_check_3_2_3 + · exact A5_5_6Law_check_3_3_2 + · exact A5_5_6Law_check_3_4_1 + · exact A5_5_6Law_check_3_5_0 + · exact A5_5_6Law_check_4_0_4 + · exact A5_5_6Law_check_4_1_3 + · exact A5_5_6Law_check_4_2_2 + · exact A5_5_6Law_check_4_3_1 + · exact A5_5_6Law_check_4_4_0 + · exact A5_5_6Law_check_5_0_3 + · exact A5_5_6Law_check_5_1_2 + · exact A5_5_6Law_check_5_2_1 + · exact A5_5_6Law_check_5_3_0 +lemma A5_5_6Law_sound (u : Shape) : + (A5_5_6Law u).Encloses (stageALaw (shape 5 5 6) u : ℝ) := by + by_cases hu : u ∈ below (shape 5 5 6) + · have h := contains_sound (Ball.mul_sound (A5_5_6Raw_sound u hu) + (Ball.inv_sound A5_5_6Den_sound A5_5_6Den_positive)) (A5_5_6Law_check u hu) + simpa only [A5_5_6Law, hu, ite_true, stageALaw, splitLaw, + Rat.cast_div, Rat.cast_mul, Rat.cast_inv, div_eq_mul_inv] using h + · simp only [A5_5_6Law, hu, ite_false, stageALaw, splitLaw, Rat.cast_zero] + simpa only [Rat.cast_zero] using Ball.exact_sound 0 + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def AProbsTable (s u : Shape) : Ball := + match s 0, s 1, s 2 with + | 1, 1, 14 => A1_1_14Law u + | 1, 2, 13 => A1_2_13Law u + | 1, 3, 12 => A1_3_12Law u + | 1, 4, 11 => A1_4_11Law u + | 1, 5, 10 => A1_5_10Law u + | 1, 6, 9 => A1_6_9Law u + | 1, 7, 8 => A1_7_8Law u + | 2, 2, 12 => A2_2_12Law u + | 2, 3, 11 => A2_3_11Law u + | 2, 4, 10 => A2_4_10Law u + | 2, 5, 9 => A2_5_9Law u + | 2, 6, 8 => A2_6_8Law u + | 2, 7, 7 => A2_7_7Law u + | 3, 3, 10 => A3_3_10Law u + | 3, 4, 9 => A3_4_9Law u + | 3, 5, 8 => A3_5_8Law u + | 3, 6, 7 => A3_6_7Law u + | 4, 4, 8 => A4_4_8Law u + | 4, 5, 7 => A4_5_7Law u + | 4, 6, 6 => A4_6_6Law u + | 5, 5, 6 => A5_5_6Law u + | _, _, _ => (.exact 0) +lemma AProbsTable_sound (g : Shape) (hg : g ∈ positiveInitial) (u : Shape) : + (AProbsTable g u).Encloses (stageALaw g u : ℝ) := by + rw [positiveInitial_list] at hg + simp only [List.mem_cons, List.not_mem_nil, or_false] at hg + rcases hg with rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl + · exact A1_1_14Law_sound u + · exact A1_2_13Law_sound u + · exact A1_3_12Law_sound u + · exact A1_4_11Law_sound u + · exact A1_5_10Law_sound u + · exact A1_6_9Law_sound u + · exact A1_7_8Law_sound u + · exact A2_2_12Law_sound u + · exact A2_3_11Law_sound u + · exact A2_4_10Law_sound u + · exact A2_5_9Law_sound u + · exact A2_6_8Law_sound u + · exact A2_7_7Law_sound u + · exact A3_3_10Law_sound u + · exact A3_4_9Law_sound u + · exact A3_5_8Law_sound u + · exact A3_6_7Law_sound u + · exact A4_4_8Law_sound u + · exact A4_5_7Law_sound u + · exact A4_6_6Law_sound u + · exact A5_5_6Law_sound u +def secondProbs (s : Shape) : Ball := + match s 0, s 1, s 2 with + | 0, 0, 8 => ⟨(69961933900937038973810717 / 100000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ + | 0, 1, 7 => ⟨(12225475568090238873041151441 / 100000000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ + | 0, 2, 6 => ⟨(237411073357556581276502992929 / 50000000000000000000000000000000), (11 / 100000000000000000000000000000000)⟩ + | 0, 3, 5 => ⟨(4230776649784552867243147046861 / 100000000000000000000000000000000), (51 / 100000000000000000000000000000000)⟩ + | 0, 4, 4 => ⟨(3547397943227606492584968866981 / 50000000000000000000000000000000), (81 / 100000000000000000000000000000000)⟩ + | 0, 5, 3 => ⟨(479798427065252805047798804001 / 50000000000000000000000000000000), (7 / 50000000000000000000000000000000)⟩ + | 0, 6, 2 => ⟨(8873532193375516366129001309 / 50000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ + | 0, 7, 1 => ⟨(37761738676306841647289119 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 0, 8, 0 => ⟨0, 0⟩ + | 1, 0, 7 => ⟨(6438692289104433119668731959 / 100000000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ + | 1, 1, 6 => ⟨(396449683591614668262742331113 / 100000000000000000000000000000000), (1 / 10000000000000000000000000000000)⟩ + | 1, 2, 5 => ⟨(7475754434060585075518103043991 / 100000000000000000000000000000000), (83 / 100000000000000000000000000000000)⟩ + | 1, 3, 4 => ⟨(30737266894969885701115253765617 / 100000000000000000000000000000000), (59 / 20000000000000000000000000000000)⟩ + | 1, 4, 3 => ⟨(14261596080166754120520730143589 / 100000000000000000000000000000000), (31 / 20000000000000000000000000000000)⟩ + | 1, 5, 2 => ⟨(626067956486069015200470969959 / 100000000000000000000000000000000), (11 / 100000000000000000000000000000000)⟩ + | 1, 6, 1 => ⟨(3285158323719550978069819523 / 100000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ + | 1, 7, 0 => ⟨(975621486089752789548109 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 2, 0, 6 => ⟨(90413820613809065387009577181 / 100000000000000000000000000000000), (1 / 20000000000000000000000000000000)⟩ + | 2, 1, 5 => ⟨(168682821311829360842363366021 / 5000000000000000000000000000000), (41 / 100000000000000000000000000000000)⟩ + | 2, 2, 4 => ⟨(16597878638086061586510503770607 / 50000000000000000000000000000000), (311 / 100000000000000000000000000000000)⟩ + | 2, 3, 3 => ⟨(40531425822231342208196361227163 / 100000000000000000000000000000000), (363 / 100000000000000000000000000000000)⟩ + | 2, 4, 2 => ⟨(7081993762541297835979778514079 / 100000000000000000000000000000000), (17 / 20000000000000000000000000000000)⟩ + | 2, 5, 1 => ⟨(9821070435865618341900223303 / 10000000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ + | 2, 6, 0 => ⟨(40664393453437432199665563 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 3, 0, 5 => ⟨(66372901003719256392546735253 / 20000000000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ + | 3, 1, 4 => ⟨(7458452229072232749356247455867 / 100000000000000000000000000000000), (43 / 50000000000000000000000000000000)⟩ + | 3, 2, 3 => ⟨(5834298510241192163399383030477 / 25000000000000000000000000000000), (229 / 100000000000000000000000000000000)⟩ + | 3, 3, 2 => ⟨(11105258047046141314482148827847 / 100000000000000000000000000000000), (61 / 50000000000000000000000000000000)⟩ + | 3, 4, 1 => ⟨(115877797524955486474569484493 / 20000000000000000000000000000000), (1 / 10000000000000000000000000000000)⟩ + | 3, 5, 0 => ⟨(1474745044110606848348633769 / 50000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ + | 4, 0, 4 => ⟨(127180720981131837029517845441 / 50000000000000000000000000000000), (1 / 20000000000000000000000000000000)⟩ + | 4, 1, 3 => ⟨(229386345126997321904071678101 / 10000000000000000000000000000000), (7 / 25000000000000000000000000000000)⟩ + | 4, 2, 2 => ⟨(596904226304951333077005521279 / 20000000000000000000000000000000), (37 / 100000000000000000000000000000000)⟩ + | 4, 3, 1 => ⟨(204433827117624377981263345963 / 50000000000000000000000000000000), (7 / 100000000000000000000000000000000)⟩ + | 4, 4, 0 => ⟨(157961720646067031611604423 / 2000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ + | 5, 0, 3 => ⟨(1281566078537013099196608213 / 10000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 5, 1, 2 => ⟨(9204811902836787308641159891 / 12500000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ + | 5, 2, 1 => ⟨(3169349558485787912791048423 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 5, 3, 0 => ⟨(45111958926755639262102049 / 4000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 6, 0, 2 => ⟨0, 0⟩ + | 6, 1, 1 => ⟨0, 0⟩ + | 6, 2, 0 => ⟨0, 0⟩ + | 7, 0, 1 => ⟨0, 0⟩ + | 7, 1, 0 => ⟨0, 0⟩ + | 8, 0, 0 => ⟨0, 0⟩ + | _, _, _ => (.exact 0) +lemma second_0_0_8 : (secondProbs (shape 0 0 8)).Encloses (secondMass (shape 0 0 8) : ℝ) := by + rw [secondMass_cast] + apply contains_sound (a := (Ball.mul (.exact 2) (listSumBall positiveInitial (fun g => .mul (initialProbs g) (AProbsTable g (shape 0 0 8)))))) + · exact Ball.mul_sound (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) + (listSumBall_sound _ _ _ (fun g hg => Ball.mul_sound + (initialProbs_sound g (List.mem_filter.mp hg).1) (AProbsTable_sound g hg (shape 0 0 8)))) + · decide +kernel +lemma second_0_1_7 : (secondProbs (shape 0 1 7)).Encloses (secondMass (shape 0 1 7) : ℝ) := by + rw [secondMass_cast] + apply contains_sound (a := (Ball.mul (.exact 2) (listSumBall positiveInitial (fun g => .mul (initialProbs g) (AProbsTable g (shape 0 1 7)))))) + · exact Ball.mul_sound (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) + (listSumBall_sound _ _ _ (fun g hg => Ball.mul_sound + (initialProbs_sound g (List.mem_filter.mp hg).1) (AProbsTable_sound g hg (shape 0 1 7)))) + · decide +kernel +lemma second_0_2_6 : (secondProbs (shape 0 2 6)).Encloses (secondMass (shape 0 2 6) : ℝ) := by + rw [secondMass_cast] + apply contains_sound (a := (Ball.mul (.exact 2) (listSumBall positiveInitial (fun g => .mul (initialProbs g) (AProbsTable g (shape 0 2 6)))))) + · exact Ball.mul_sound (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) + (listSumBall_sound _ _ _ (fun g hg => Ball.mul_sound + (initialProbs_sound g (List.mem_filter.mp hg).1) (AProbsTable_sound g hg (shape 0 2 6)))) + · decide +kernel +lemma second_0_3_5 : (secondProbs (shape 0 3 5)).Encloses (secondMass (shape 0 3 5) : ℝ) := by + rw [secondMass_cast] + apply contains_sound (a := (Ball.mul (.exact 2) (listSumBall positiveInitial (fun g => .mul (initialProbs g) (AProbsTable g (shape 0 3 5)))))) + · exact Ball.mul_sound (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) + (listSumBall_sound _ _ _ (fun g hg => Ball.mul_sound + (initialProbs_sound g (List.mem_filter.mp hg).1) (AProbsTable_sound g hg (shape 0 3 5)))) + · decide +kernel +lemma second_0_4_4 : (secondProbs (shape 0 4 4)).Encloses (secondMass (shape 0 4 4) : ℝ) := by + rw [secondMass_cast] + apply contains_sound (a := (Ball.mul (.exact 2) (listSumBall positiveInitial (fun g => .mul (initialProbs g) (AProbsTable g (shape 0 4 4)))))) + · exact Ball.mul_sound (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) + (listSumBall_sound _ _ _ (fun g hg => Ball.mul_sound + (initialProbs_sound g (List.mem_filter.mp hg).1) (AProbsTable_sound g hg (shape 0 4 4)))) + · decide +kernel +lemma second_0_5_3 : (secondProbs (shape 0 5 3)).Encloses (secondMass (shape 0 5 3) : ℝ) := by + rw [secondMass_cast] + apply contains_sound (a := (Ball.mul (.exact 2) (listSumBall positiveInitial (fun g => .mul (initialProbs g) (AProbsTable g (shape 0 5 3)))))) + · exact Ball.mul_sound (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) + (listSumBall_sound _ _ _ (fun g hg => Ball.mul_sound + (initialProbs_sound g (List.mem_filter.mp hg).1) (AProbsTable_sound g hg (shape 0 5 3)))) + · decide +kernel +lemma second_0_6_2 : (secondProbs (shape 0 6 2)).Encloses (secondMass (shape 0 6 2) : ℝ) := by + rw [secondMass_cast] + apply contains_sound (a := (Ball.mul (.exact 2) (listSumBall positiveInitial (fun g => .mul (initialProbs g) (AProbsTable g (shape 0 6 2)))))) + · exact Ball.mul_sound (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) + (listSumBall_sound _ _ _ (fun g hg => Ball.mul_sound + (initialProbs_sound g (List.mem_filter.mp hg).1) (AProbsTable_sound g hg (shape 0 6 2)))) + · decide +kernel +lemma second_0_7_1 : (secondProbs (shape 0 7 1)).Encloses (secondMass (shape 0 7 1) : ℝ) := by + rw [secondMass_cast] + apply contains_sound (a := (Ball.mul (.exact 2) (listSumBall positiveInitial (fun g => .mul (initialProbs g) (AProbsTable g (shape 0 7 1)))))) + · exact Ball.mul_sound (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) + (listSumBall_sound _ _ _ (fun g hg => Ball.mul_sound + (initialProbs_sound g (List.mem_filter.mp hg).1) (AProbsTable_sound g hg (shape 0 7 1)))) + · decide +kernel +lemma second_0_8_0 : (secondProbs (shape 0 8 0)).Encloses (secondMass (shape 0 8 0) : ℝ) := by + rw [secondMass_cast] + apply contains_sound (a := (Ball.mul (.exact 2) (listSumBall positiveInitial (fun g => .mul (initialProbs g) (AProbsTable g (shape 0 8 0)))))) + · exact Ball.mul_sound (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) + (listSumBall_sound _ _ _ (fun g hg => Ball.mul_sound + (initialProbs_sound g (List.mem_filter.mp hg).1) (AProbsTable_sound g hg (shape 0 8 0)))) + · decide +kernel +lemma second_1_0_7 : (secondProbs (shape 1 0 7)).Encloses (secondMass (shape 1 0 7) : ℝ) := by + rw [secondMass_cast] + apply contains_sound (a := (Ball.mul (.exact 2) (listSumBall positiveInitial (fun g => .mul (initialProbs g) (AProbsTable g (shape 1 0 7)))))) + · exact Ball.mul_sound (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) + (listSumBall_sound _ _ _ (fun g hg => Ball.mul_sound + (initialProbs_sound g (List.mem_filter.mp hg).1) (AProbsTable_sound g hg (shape 1 0 7)))) + · decide +kernel +lemma second_1_1_6 : (secondProbs (shape 1 1 6)).Encloses (secondMass (shape 1 1 6) : ℝ) := by + rw [secondMass_cast] + apply contains_sound (a := (Ball.mul (.exact 2) (listSumBall positiveInitial (fun g => .mul (initialProbs g) (AProbsTable g (shape 1 1 6)))))) + · exact Ball.mul_sound (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) + (listSumBall_sound _ _ _ (fun g hg => Ball.mul_sound + (initialProbs_sound g (List.mem_filter.mp hg).1) (AProbsTable_sound g hg (shape 1 1 6)))) + · decide +kernel +lemma second_1_2_5 : (secondProbs (shape 1 2 5)).Encloses (secondMass (shape 1 2 5) : ℝ) := by + rw [secondMass_cast] + apply contains_sound (a := (Ball.mul (.exact 2) (listSumBall positiveInitial (fun g => .mul (initialProbs g) (AProbsTable g (shape 1 2 5)))))) + · exact Ball.mul_sound (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) + (listSumBall_sound _ _ _ (fun g hg => Ball.mul_sound + (initialProbs_sound g (List.mem_filter.mp hg).1) (AProbsTable_sound g hg (shape 1 2 5)))) + · decide +kernel +lemma second_1_3_4 : (secondProbs (shape 1 3 4)).Encloses (secondMass (shape 1 3 4) : ℝ) := by + rw [secondMass_cast] + apply contains_sound (a := (Ball.mul (.exact 2) (listSumBall positiveInitial (fun g => .mul (initialProbs g) (AProbsTable g (shape 1 3 4)))))) + · exact Ball.mul_sound (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) + (listSumBall_sound _ _ _ (fun g hg => Ball.mul_sound + (initialProbs_sound g (List.mem_filter.mp hg).1) (AProbsTable_sound g hg (shape 1 3 4)))) + · decide +kernel +lemma second_1_4_3 : (secondProbs (shape 1 4 3)).Encloses (secondMass (shape 1 4 3) : ℝ) := by + rw [secondMass_cast] + apply contains_sound (a := (Ball.mul (.exact 2) (listSumBall positiveInitial (fun g => .mul (initialProbs g) (AProbsTable g (shape 1 4 3)))))) + · exact Ball.mul_sound (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) + (listSumBall_sound _ _ _ (fun g hg => Ball.mul_sound + (initialProbs_sound g (List.mem_filter.mp hg).1) (AProbsTable_sound g hg (shape 1 4 3)))) + · decide +kernel +lemma second_1_5_2 : (secondProbs (shape 1 5 2)).Encloses (secondMass (shape 1 5 2) : ℝ) := by + rw [secondMass_cast] + apply contains_sound (a := (Ball.mul (.exact 2) (listSumBall positiveInitial (fun g => .mul (initialProbs g) (AProbsTable g (shape 1 5 2)))))) + · exact Ball.mul_sound (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) + (listSumBall_sound _ _ _ (fun g hg => Ball.mul_sound + (initialProbs_sound g (List.mem_filter.mp hg).1) (AProbsTable_sound g hg (shape 1 5 2)))) + · decide +kernel +lemma second_1_6_1 : (secondProbs (shape 1 6 1)).Encloses (secondMass (shape 1 6 1) : ℝ) := by + rw [secondMass_cast] + apply contains_sound (a := (Ball.mul (.exact 2) (listSumBall positiveInitial (fun g => .mul (initialProbs g) (AProbsTable g (shape 1 6 1)))))) + · exact Ball.mul_sound (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) + (listSumBall_sound _ _ _ (fun g hg => Ball.mul_sound + (initialProbs_sound g (List.mem_filter.mp hg).1) (AProbsTable_sound g hg (shape 1 6 1)))) + · decide +kernel +lemma second_1_7_0 : (secondProbs (shape 1 7 0)).Encloses (secondMass (shape 1 7 0) : ℝ) := by + rw [secondMass_cast] + apply contains_sound (a := (Ball.mul (.exact 2) (listSumBall positiveInitial (fun g => .mul (initialProbs g) (AProbsTable g (shape 1 7 0)))))) + · exact Ball.mul_sound (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) + (listSumBall_sound _ _ _ (fun g hg => Ball.mul_sound + (initialProbs_sound g (List.mem_filter.mp hg).1) (AProbsTable_sound g hg (shape 1 7 0)))) + · decide +kernel +lemma second_2_0_6 : (secondProbs (shape 2 0 6)).Encloses (secondMass (shape 2 0 6) : ℝ) := by + rw [secondMass_cast] + apply contains_sound (a := (Ball.mul (.exact 2) (listSumBall positiveInitial (fun g => .mul (initialProbs g) (AProbsTable g (shape 2 0 6)))))) + · exact Ball.mul_sound (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) + (listSumBall_sound _ _ _ (fun g hg => Ball.mul_sound + (initialProbs_sound g (List.mem_filter.mp hg).1) (AProbsTable_sound g hg (shape 2 0 6)))) + · decide +kernel +lemma second_2_1_5 : (secondProbs (shape 2 1 5)).Encloses (secondMass (shape 2 1 5) : ℝ) := by + rw [secondMass_cast] + apply contains_sound (a := (Ball.mul (.exact 2) (listSumBall positiveInitial (fun g => .mul (initialProbs g) (AProbsTable g (shape 2 1 5)))))) + · exact Ball.mul_sound (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) + (listSumBall_sound _ _ _ (fun g hg => Ball.mul_sound + (initialProbs_sound g (List.mem_filter.mp hg).1) (AProbsTable_sound g hg (shape 2 1 5)))) + · decide +kernel +lemma second_2_2_4 : (secondProbs (shape 2 2 4)).Encloses (secondMass (shape 2 2 4) : ℝ) := by + rw [secondMass_cast] + apply contains_sound (a := (Ball.mul (.exact 2) (listSumBall positiveInitial (fun g => .mul (initialProbs g) (AProbsTable g (shape 2 2 4)))))) + · exact Ball.mul_sound (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) + (listSumBall_sound _ _ _ (fun g hg => Ball.mul_sound + (initialProbs_sound g (List.mem_filter.mp hg).1) (AProbsTable_sound g hg (shape 2 2 4)))) + · decide +kernel +lemma second_2_3_3 : (secondProbs (shape 2 3 3)).Encloses (secondMass (shape 2 3 3) : ℝ) := by + rw [secondMass_cast] + apply contains_sound (a := (Ball.mul (.exact 2) (listSumBall positiveInitial (fun g => .mul (initialProbs g) (AProbsTable g (shape 2 3 3)))))) + · exact Ball.mul_sound (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) + (listSumBall_sound _ _ _ (fun g hg => Ball.mul_sound + (initialProbs_sound g (List.mem_filter.mp hg).1) (AProbsTable_sound g hg (shape 2 3 3)))) + · decide +kernel +lemma second_2_4_2 : (secondProbs (shape 2 4 2)).Encloses (secondMass (shape 2 4 2) : ℝ) := by + rw [secondMass_cast] + apply contains_sound (a := (Ball.mul (.exact 2) (listSumBall positiveInitial (fun g => .mul (initialProbs g) (AProbsTable g (shape 2 4 2)))))) + · exact Ball.mul_sound (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) + (listSumBall_sound _ _ _ (fun g hg => Ball.mul_sound + (initialProbs_sound g (List.mem_filter.mp hg).1) (AProbsTable_sound g hg (shape 2 4 2)))) + · decide +kernel +lemma second_2_5_1 : (secondProbs (shape 2 5 1)).Encloses (secondMass (shape 2 5 1) : ℝ) := by + rw [secondMass_cast] + apply contains_sound (a := (Ball.mul (.exact 2) (listSumBall positiveInitial (fun g => .mul (initialProbs g) (AProbsTable g (shape 2 5 1)))))) + · exact Ball.mul_sound (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) + (listSumBall_sound _ _ _ (fun g hg => Ball.mul_sound + (initialProbs_sound g (List.mem_filter.mp hg).1) (AProbsTable_sound g hg (shape 2 5 1)))) + · decide +kernel +lemma second_2_6_0 : (secondProbs (shape 2 6 0)).Encloses (secondMass (shape 2 6 0) : ℝ) := by + rw [secondMass_cast] + apply contains_sound (a := (Ball.mul (.exact 2) (listSumBall positiveInitial (fun g => .mul (initialProbs g) (AProbsTable g (shape 2 6 0)))))) + · exact Ball.mul_sound (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) + (listSumBall_sound _ _ _ (fun g hg => Ball.mul_sound + (initialProbs_sound g (List.mem_filter.mp hg).1) (AProbsTable_sound g hg (shape 2 6 0)))) + · decide +kernel +lemma second_3_0_5 : (secondProbs (shape 3 0 5)).Encloses (secondMass (shape 3 0 5) : ℝ) := by + rw [secondMass_cast] + apply contains_sound (a := (Ball.mul (.exact 2) (listSumBall positiveInitial (fun g => .mul (initialProbs g) (AProbsTable g (shape 3 0 5)))))) + · exact Ball.mul_sound (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) + (listSumBall_sound _ _ _ (fun g hg => Ball.mul_sound + (initialProbs_sound g (List.mem_filter.mp hg).1) (AProbsTable_sound g hg (shape 3 0 5)))) + · decide +kernel +lemma second_3_1_4 : (secondProbs (shape 3 1 4)).Encloses (secondMass (shape 3 1 4) : ℝ) := by + rw [secondMass_cast] + apply contains_sound (a := (Ball.mul (.exact 2) (listSumBall positiveInitial (fun g => .mul (initialProbs g) (AProbsTable g (shape 3 1 4)))))) + · exact Ball.mul_sound (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) + (listSumBall_sound _ _ _ (fun g hg => Ball.mul_sound + (initialProbs_sound g (List.mem_filter.mp hg).1) (AProbsTable_sound g hg (shape 3 1 4)))) + · decide +kernel +lemma second_3_2_3 : (secondProbs (shape 3 2 3)).Encloses (secondMass (shape 3 2 3) : ℝ) := by + rw [secondMass_cast] + apply contains_sound (a := (Ball.mul (.exact 2) (listSumBall positiveInitial (fun g => .mul (initialProbs g) (AProbsTable g (shape 3 2 3)))))) + · exact Ball.mul_sound (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) + (listSumBall_sound _ _ _ (fun g hg => Ball.mul_sound + (initialProbs_sound g (List.mem_filter.mp hg).1) (AProbsTable_sound g hg (shape 3 2 3)))) + · decide +kernel +lemma second_3_3_2 : (secondProbs (shape 3 3 2)).Encloses (secondMass (shape 3 3 2) : ℝ) := by + rw [secondMass_cast] + apply contains_sound (a := (Ball.mul (.exact 2) (listSumBall positiveInitial (fun g => .mul (initialProbs g) (AProbsTable g (shape 3 3 2)))))) + · exact Ball.mul_sound (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) + (listSumBall_sound _ _ _ (fun g hg => Ball.mul_sound + (initialProbs_sound g (List.mem_filter.mp hg).1) (AProbsTable_sound g hg (shape 3 3 2)))) + · decide +kernel +lemma second_3_4_1 : (secondProbs (shape 3 4 1)).Encloses (secondMass (shape 3 4 1) : ℝ) := by + rw [secondMass_cast] + apply contains_sound (a := (Ball.mul (.exact 2) (listSumBall positiveInitial (fun g => .mul (initialProbs g) (AProbsTable g (shape 3 4 1)))))) + · exact Ball.mul_sound (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) + (listSumBall_sound _ _ _ (fun g hg => Ball.mul_sound + (initialProbs_sound g (List.mem_filter.mp hg).1) (AProbsTable_sound g hg (shape 3 4 1)))) + · decide +kernel +lemma second_3_5_0 : (secondProbs (shape 3 5 0)).Encloses (secondMass (shape 3 5 0) : ℝ) := by + rw [secondMass_cast] + apply contains_sound (a := (Ball.mul (.exact 2) (listSumBall positiveInitial (fun g => .mul (initialProbs g) (AProbsTable g (shape 3 5 0)))))) + · exact Ball.mul_sound (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) + (listSumBall_sound _ _ _ (fun g hg => Ball.mul_sound + (initialProbs_sound g (List.mem_filter.mp hg).1) (AProbsTable_sound g hg (shape 3 5 0)))) + · decide +kernel +lemma second_4_0_4 : (secondProbs (shape 4 0 4)).Encloses (secondMass (shape 4 0 4) : ℝ) := by + rw [secondMass_cast] + apply contains_sound (a := (Ball.mul (.exact 2) (listSumBall positiveInitial (fun g => .mul (initialProbs g) (AProbsTable g (shape 4 0 4)))))) + · exact Ball.mul_sound (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) + (listSumBall_sound _ _ _ (fun g hg => Ball.mul_sound + (initialProbs_sound g (List.mem_filter.mp hg).1) (AProbsTable_sound g hg (shape 4 0 4)))) + · decide +kernel +lemma second_4_1_3 : (secondProbs (shape 4 1 3)).Encloses (secondMass (shape 4 1 3) : ℝ) := by + rw [secondMass_cast] + apply contains_sound (a := (Ball.mul (.exact 2) (listSumBall positiveInitial (fun g => .mul (initialProbs g) (AProbsTable g (shape 4 1 3)))))) + · exact Ball.mul_sound (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) + (listSumBall_sound _ _ _ (fun g hg => Ball.mul_sound + (initialProbs_sound g (List.mem_filter.mp hg).1) (AProbsTable_sound g hg (shape 4 1 3)))) + · decide +kernel +lemma second_4_2_2 : (secondProbs (shape 4 2 2)).Encloses (secondMass (shape 4 2 2) : ℝ) := by + rw [secondMass_cast] + apply contains_sound (a := (Ball.mul (.exact 2) (listSumBall positiveInitial (fun g => .mul (initialProbs g) (AProbsTable g (shape 4 2 2)))))) + · exact Ball.mul_sound (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) + (listSumBall_sound _ _ _ (fun g hg => Ball.mul_sound + (initialProbs_sound g (List.mem_filter.mp hg).1) (AProbsTable_sound g hg (shape 4 2 2)))) + · decide +kernel +lemma second_4_3_1 : (secondProbs (shape 4 3 1)).Encloses (secondMass (shape 4 3 1) : ℝ) := by + rw [secondMass_cast] + apply contains_sound (a := (Ball.mul (.exact 2) (listSumBall positiveInitial (fun g => .mul (initialProbs g) (AProbsTable g (shape 4 3 1)))))) + · exact Ball.mul_sound (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) + (listSumBall_sound _ _ _ (fun g hg => Ball.mul_sound + (initialProbs_sound g (List.mem_filter.mp hg).1) (AProbsTable_sound g hg (shape 4 3 1)))) + · decide +kernel +lemma second_4_4_0 : (secondProbs (shape 4 4 0)).Encloses (secondMass (shape 4 4 0) : ℝ) := by + rw [secondMass_cast] + apply contains_sound (a := (Ball.mul (.exact 2) (listSumBall positiveInitial (fun g => .mul (initialProbs g) (AProbsTable g (shape 4 4 0)))))) + · exact Ball.mul_sound (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) + (listSumBall_sound _ _ _ (fun g hg => Ball.mul_sound + (initialProbs_sound g (List.mem_filter.mp hg).1) (AProbsTable_sound g hg (shape 4 4 0)))) + · decide +kernel +lemma second_5_0_3 : (secondProbs (shape 5 0 3)).Encloses (secondMass (shape 5 0 3) : ℝ) := by + rw [secondMass_cast] + apply contains_sound (a := (Ball.mul (.exact 2) (listSumBall positiveInitial (fun g => .mul (initialProbs g) (AProbsTable g (shape 5 0 3)))))) + · exact Ball.mul_sound (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) + (listSumBall_sound _ _ _ (fun g hg => Ball.mul_sound + (initialProbs_sound g (List.mem_filter.mp hg).1) (AProbsTable_sound g hg (shape 5 0 3)))) + · decide +kernel +lemma second_5_1_2 : (secondProbs (shape 5 1 2)).Encloses (secondMass (shape 5 1 2) : ℝ) := by + rw [secondMass_cast] + apply contains_sound (a := (Ball.mul (.exact 2) (listSumBall positiveInitial (fun g => .mul (initialProbs g) (AProbsTable g (shape 5 1 2)))))) + · exact Ball.mul_sound (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) + (listSumBall_sound _ _ _ (fun g hg => Ball.mul_sound + (initialProbs_sound g (List.mem_filter.mp hg).1) (AProbsTable_sound g hg (shape 5 1 2)))) + · decide +kernel +lemma second_5_2_1 : (secondProbs (shape 5 2 1)).Encloses (secondMass (shape 5 2 1) : ℝ) := by + rw [secondMass_cast] + apply contains_sound (a := (Ball.mul (.exact 2) (listSumBall positiveInitial (fun g => .mul (initialProbs g) (AProbsTable g (shape 5 2 1)))))) + · exact Ball.mul_sound (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) + (listSumBall_sound _ _ _ (fun g hg => Ball.mul_sound + (initialProbs_sound g (List.mem_filter.mp hg).1) (AProbsTable_sound g hg (shape 5 2 1)))) + · decide +kernel +lemma second_5_3_0 : (secondProbs (shape 5 3 0)).Encloses (secondMass (shape 5 3 0) : ℝ) := by + rw [secondMass_cast] + apply contains_sound (a := (Ball.mul (.exact 2) (listSumBall positiveInitial (fun g => .mul (initialProbs g) (AProbsTable g (shape 5 3 0)))))) + · exact Ball.mul_sound (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) + (listSumBall_sound _ _ _ (fun g hg => Ball.mul_sound + (initialProbs_sound g (List.mem_filter.mp hg).1) (AProbsTable_sound g hg (shape 5 3 0)))) + · decide +kernel +lemma second_6_0_2 : (secondProbs (shape 6 0 2)).Encloses (secondMass (shape 6 0 2) : ℝ) := by + rw [secondMass_cast] + apply contains_sound (a := (Ball.mul (.exact 2) (listSumBall positiveInitial (fun g => .mul (initialProbs g) (AProbsTable g (shape 6 0 2)))))) + · exact Ball.mul_sound (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) + (listSumBall_sound _ _ _ (fun g hg => Ball.mul_sound + (initialProbs_sound g (List.mem_filter.mp hg).1) (AProbsTable_sound g hg (shape 6 0 2)))) + · decide +kernel +lemma second_6_1_1 : (secondProbs (shape 6 1 1)).Encloses (secondMass (shape 6 1 1) : ℝ) := by + rw [secondMass_cast] + apply contains_sound (a := (Ball.mul (.exact 2) (listSumBall positiveInitial (fun g => .mul (initialProbs g) (AProbsTable g (shape 6 1 1)))))) + · exact Ball.mul_sound (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) + (listSumBall_sound _ _ _ (fun g hg => Ball.mul_sound + (initialProbs_sound g (List.mem_filter.mp hg).1) (AProbsTable_sound g hg (shape 6 1 1)))) + · decide +kernel +lemma second_6_2_0 : (secondProbs (shape 6 2 0)).Encloses (secondMass (shape 6 2 0) : ℝ) := by + rw [secondMass_cast] + apply contains_sound (a := (Ball.mul (.exact 2) (listSumBall positiveInitial (fun g => .mul (initialProbs g) (AProbsTable g (shape 6 2 0)))))) + · exact Ball.mul_sound (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) + (listSumBall_sound _ _ _ (fun g hg => Ball.mul_sound + (initialProbs_sound g (List.mem_filter.mp hg).1) (AProbsTable_sound g hg (shape 6 2 0)))) + · decide +kernel +lemma second_7_0_1 : (secondProbs (shape 7 0 1)).Encloses (secondMass (shape 7 0 1) : ℝ) := by + rw [secondMass_cast] + apply contains_sound (a := (Ball.mul (.exact 2) (listSumBall positiveInitial (fun g => .mul (initialProbs g) (AProbsTable g (shape 7 0 1)))))) + · exact Ball.mul_sound (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) + (listSumBall_sound _ _ _ (fun g hg => Ball.mul_sound + (initialProbs_sound g (List.mem_filter.mp hg).1) (AProbsTable_sound g hg (shape 7 0 1)))) + · decide +kernel +lemma second_7_1_0 : (secondProbs (shape 7 1 0)).Encloses (secondMass (shape 7 1 0) : ℝ) := by + rw [secondMass_cast] + apply contains_sound (a := (Ball.mul (.exact 2) (listSumBall positiveInitial (fun g => .mul (initialProbs g) (AProbsTable g (shape 7 1 0)))))) + · exact Ball.mul_sound (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) + (listSumBall_sound _ _ _ (fun g hg => Ball.mul_sound + (initialProbs_sound g (List.mem_filter.mp hg).1) (AProbsTable_sound g hg (shape 7 1 0)))) + · decide +kernel +lemma second_8_0_0 : (secondProbs (shape 8 0 0)).Encloses (secondMass (shape 8 0 0) : ℝ) := by + rw [secondMass_cast] + apply contains_sound (a := (Ball.mul (.exact 2) (listSumBall positiveInitial (fun g => .mul (initialProbs g) (AProbsTable g (shape 8 0 0)))))) + · exact Ball.mul_sound (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) + (listSumBall_sound _ _ _ (fun g hg => Ball.mul_sound + (initialProbs_sound g (List.mem_filter.mp hg).1) (AProbsTable_sound g hg (shape 8 0 0)))) + · decide +kernel +lemma secondProbs_sound (t : Shape) (ht : t ∈ shapes 8) : + (secondProbs t).Encloses (secondMass t : ℝ) := by + rw [allSecond_list] at ht + simp only [List.mem_cons, List.not_mem_nil, or_false] at ht + rcases ht with rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl + · exact second_0_0_8 + · exact second_0_1_7 + · exact second_0_2_6 + · exact second_0_3_5 + · exact second_0_4_4 + · exact second_0_5_3 + · exact second_0_6_2 + · exact second_0_7_1 + · exact second_0_8_0 + · exact second_1_0_7 + · exact second_1_1_6 + · exact second_1_2_5 + · exact second_1_3_4 + · exact second_1_4_3 + · exact second_1_5_2 + · exact second_1_6_1 + · exact second_1_7_0 + · exact second_2_0_6 + · exact second_2_1_5 + · exact second_2_2_4 + · exact second_2_3_3 + · exact second_2_4_2 + · exact second_2_5_1 + · exact second_2_6_0 + · exact second_3_0_5 + · exact second_3_1_4 + · exact second_3_2_3 + · exact second_3_3_2 + · exact second_3_4_1 + · exact second_3_5_0 + · exact second_4_0_4 + · exact second_4_1_3 + · exact second_4_2_2 + · exact second_4_3_1 + · exact second_4_4_0 + · exact second_5_0_3 + · exact second_5_1_2 + · exact second_5_2_1 + · exact second_5_3_0 + · exact second_6_0_2 + · exact second_6_1_1 + · exact second_6_2_0 + · exact second_7_0_1 + · exact second_7_1_0 + · exact second_8_0_0 + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def B1_1_6U0_0_4Leaf : Ball := ⟨0, 0⟩ +lemma B1_1_6U0_0_4Leaf_sound : B1_1_6U0_0_4Leaf.Encloses (AllFieldTerminalRates.secondLeafRate (shape 1 1 6) (shape 0 0 4)) := by + have hh : shapeMax (shape 0 0 4) = 4 := by decide +kernel + simp only [AllFieldTerminalRates.secondLeafRate, hh, ite_true] + simpa only [B1_1_6U0_0_4Leaf, Ball.exact, Rat.cast_zero] using Ball.exact_sound 0 +def B1_1_6U0_0_4Mass : Ball := ⟨(3710278844513467307488141523 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ +lemma B1_1_6U0_0_4Mass_sound : B1_1_6U0_0_4Mass.Encloses (littleMass (shape 1 1 6) (shape 0 0 4) : ℝ) := by + rw [littleMass_cast] + exact contains_sound (Ball.mul_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) (second_1_1_6)) + (B1_1_6Law_sound (shape 0 0 4))) (by decide +kernel) +def B1_1_6U0_1_3Leaf : Ball := ⟨(115129254649702284200899544090987 / 50000000000000000000000000000000), (21175823683 / 25000000000000000000000000000000)⟩ +lemma B1_1_6U0_1_3Leaf_sound : B1_1_6U0_1_3Leaf.Encloses (AllFieldTerminalRates.secondLeafRate (shape 1 1 6) (shape 0 1 3)) := by + have hh : shapeMax (shape 0 1 3) = 3 := by decide +kernel + simp only [AllFieldTerminalRates.secondLeafRate, hh, show (3 : ℕ) ≠ 4 by decide, ite_false, ite_true] + exact logN10_sound +def B1_1_6U0_1_3Mass : Ball := ⟨(389029125902587733647766048067 / 100000000000000000000000000000000), (11 / 100000000000000000000000000000000)⟩ +lemma B1_1_6U0_1_3Mass_sound : B1_1_6U0_1_3Mass.Encloses (littleMass (shape 1 1 6) (shape 0 1 3) : ℝ) := by + rw [littleMass_cast] + exact contains_sound (Ball.mul_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) (second_1_1_6)) + (B1_1_6Law_sound (shape 0 1 3))) (by decide +kernel) +def B1_1_6U1_0_3Leaf : Ball := ⟨(115129254649702284200899544090987 / 50000000000000000000000000000000), (21175823683 / 25000000000000000000000000000000)⟩ +lemma B1_1_6U1_0_3Leaf_sound : B1_1_6U1_0_3Leaf.Encloses (AllFieldTerminalRates.secondLeafRate (shape 1 1 6) (shape 1 0 3)) := by + have hh : shapeMax (shape 1 0 3) = 3 := by decide +kernel + simp only [AllFieldTerminalRates.secondLeafRate, hh, show (3 : ℕ) ≠ 4 by decide, ite_false, ite_true] + exact logN10_sound +def B1_1_6U1_0_3Mass : Ball := ⟨(389029125902587733647766048067 / 100000000000000000000000000000000), (11 / 100000000000000000000000000000000)⟩ +lemma B1_1_6U1_0_3Mass_sound : B1_1_6U1_0_3Mass.Encloses (littleMass (shape 1 1 6) (shape 1 0 3) : ℝ) := by + rw [littleMass_cast] + exact contains_sound (Ball.mul_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) (second_1_1_6)) + (B1_1_6Law_sound (shape 1 0 3))) (by decide +kernel) +def B1_1_6U1_1_2D : Ball := .exact (63 / 1000000) +lemma B1_1_6U1_1_2D_sound : B1_1_6U1_1_2D.Encloses (binaryParameter (shape 1 1 6) (shape 1 1 2) : ℝ) := by + apply exact_rat_enclosed + decide +kernel +def B1_1_6U1_1_2OneD : Ball := .exact (999937 / 1000000) +lemma B1_1_6U1_1_2OneD_sound : B1_1_6U1_1_2OneD.Encloses (1 - (binaryParameter (shape 1 1 6) (shape 1 1 2) : ℝ)) := by + have he : binaryParameter (shape 1 1 6) (shape 1 1 2) = (63 / 1000000) := by decide +kernel + rw [he] + convert Ball.exact_sound ((999937 / 1000000) : ℚ) using 1 <;> norm_num [B1_1_6U1_1_2OneD, Ball.exact] +def B1_1_6U1_1_2EDLogWitness : LogWitness := ⟨-14, 16128, 15625⟩ +def B1_1_6U1_1_2EDLog : Ball := ⟨(-120904697894659267702651285468121 / 12500000000000000000000000000000), (79409338811 / 25000000000000000000000000000000)⟩ +lemma B1_1_6U1_1_2EDLog_sound : B1_1_6U1_1_2EDLog.Encloses (Real.log ((binaryParameter (shape 1 1 6) (shape 1 1 2) : ℝ))) := by + exact checkLog_sound logTwoBall_sound (B1_1_6U1_1_2D_sound) (w := B1_1_6U1_1_2EDLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def B1_1_6U1_1_2ED : Ball := ⟨(15233991934727067730534061969 / 25000000000000000000000000000000), (10005577 / 50000000000000000000000000000000)⟩ +lemma B1_1_6U1_1_2ED_sound : B1_1_6U1_1_2ED.Encloses (Foundation.entropyTerm ((binaryParameter (shape 1 1 6) (shape 1 1 2) : ℝ))) := by + exact contains_sound (entropyTerm_ball (B1_1_6U1_1_2D_sound) B1_1_6U1_1_2EDLog_sound) (by decide +kernel) +def B1_1_6U1_1_2EOneDLogWitness : LogWitness := ⟨-1, 999937, 500000⟩ +def B1_1_6U1_1_2EOneDLog : Ball := ⟨(-126003969166705876877493883 / 2000000000000000000000000000000), (21175823683 / 50000000000000000000000000000000)⟩ +lemma B1_1_6U1_1_2EOneDLog_sound : B1_1_6U1_1_2EOneDLog.Encloses (Real.log ((1 - (binaryParameter (shape 1 1 6) (shape 1 1 2) : ℝ)))) := by + exact checkLog_sound logTwoBall_sound (B1_1_6U1_1_2OneD_sound) (w := B1_1_6U1_1_2EOneDLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def B1_1_6U1_1_2EOneD : Ball := ⟨(1574950386458104680090632511 / 25000000000000000000000000000000), (42348979213 / 100000000000000000000000000000000)⟩ +lemma B1_1_6U1_1_2EOneD_sound : B1_1_6U1_1_2EOneD.Encloses (Foundation.entropyTerm ((1 - (binaryParameter (shape 1 1 6) (shape 1 1 2) : ℝ)))) := by + exact contains_sound (entropyTerm_ball (B1_1_6U1_1_2OneD_sound) B1_1_6U1_1_2EOneDLog_sound) (by decide +kernel) +def B1_1_6U1_1_2BinaryEntropy : Ball := ⟨(35801298261134172545913669541 / 50000000000000000000000000000000), (42371658521 / 100000000000000000000000000000000)⟩ +lemma B1_1_6U1_1_2BinaryEntropy_sound : B1_1_6U1_1_2BinaryEntropy.Encloses + (binaryEntropyRate (binaryParameter (shape 1 1 6) (shape 1 1 2))) := by + exact contains_sound (Ball.add_sound (Ball.add_sound B1_1_6U1_1_2EOneD_sound B1_1_6U1_1_2ED_sound) + (Ball.mul_sound B1_1_6U1_1_2D_sound logN2_sound)) (by decide +kernel) +def B1_1_6U1_1_2Leaf : Ball := ⟨(64375488605594348017558361096379 / 20000000000000000000000000000000), (31762734967 / 25000000000000000000000000000000)⟩ +lemma B1_1_6U1_1_2Leaf_sound : B1_1_6U1_1_2Leaf.Encloses (AllFieldTerminalRates.secondLeafRate (shape 1 1 6) (shape 1 1 2)) := by + have hh : shapeMax (shape 1 1 2) = 2 := by decide +kernel + have hp : positive (shape 1 1 2) = true := by decide +kernel + simp only [AllFieldTerminalRates.secondLeafRate, hh, hp, Bool.not_true, Bool.false_eq_true, + show (2 : ℕ) ≠ 4 by decide, show (2 : ℕ) ≠ 3 by decide, ite_false] + have ht : (Ball.exact (1999937 / 1000000)).Encloses (2 - (binaryParameter (shape 1 1 6) (shape 1 1 2) : ℝ)) := by + have he : binaryParameter (shape 1 1 6) (shape 1 1 2) = (63 / 1000000) := by decide +kernel + rw [he] + convert Ball.exact_sound ((1999937 / 1000000) : ℚ) using 1 + norm_num [Ball.exact] + exact contains_sound (Ball.mul_sound ht logN5_sound) (by decide +kernel) +def B1_1_6U1_1_2Mass : Ball := ⟨(3710278844513467307488141523 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ +lemma B1_1_6U1_1_2Mass_sound : B1_1_6U1_1_2Mass.Encloses (littleMass (shape 1 1 6) (shape 1 1 2) : ℝ) := by + rw [littleMass_cast] + exact contains_sound (Ball.mul_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) (second_1_1_6)) + (B1_1_6Law_sound (shape 1 1 2))) (by decide +kernel) +def B1_1_6Leaves (s : Shape) : Ball := + match s 0, s 1, s 2 with + | 0, 0, 4 => B1_1_6U0_0_4Leaf + | 0, 1, 3 => B1_1_6U0_1_3Leaf + | 1, 0, 3 => B1_1_6U1_0_3Leaf + | 1, 1, 2 => B1_1_6U1_1_2Leaf + | _, _, _ => (.exact 0) +lemma B1_1_6Leaves_sound (u : Shape) (hu : u ∈ below (shape 1 1 6)) : + (B1_1_6Leaves u).Encloses (AllFieldTerminalRates.secondLeafRate (shape 1 1 6) u) := by + rw [B1_1_6_below] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl + · exact B1_1_6U0_0_4Leaf_sound + · exact B1_1_6U0_1_3Leaf_sound + · exact B1_1_6U1_0_3Leaf_sound + · exact B1_1_6U1_1_2Leaf_sound +def B1_1_6Masses (s : Shape) : Ball := + match s 0, s 1, s 2 with + | 0, 0, 4 => B1_1_6U0_0_4Mass + | 0, 1, 3 => B1_1_6U0_1_3Mass + | 1, 0, 3 => B1_1_6U1_0_3Mass + | 1, 1, 2 => B1_1_6U1_1_2Mass + | _, _, _ => (.exact 0) +lemma B1_1_6Masses_sound (u : Shape) (hu : u ∈ below (shape 1 1 6)) : + (B1_1_6Masses u).Encloses ((fun u => (littleMass (shape 1 1 6) u : ℝ)) u) := by + rw [B1_1_6_below] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl + · exact B1_1_6U0_0_4Mass_sound + · exact B1_1_6U0_1_3Mass_sound + · exact B1_1_6U1_0_3Mass_sound + · exact B1_1_6U1_1_2Mass_sound +def B1_1_6Binaries (s : Shape) : Ball := + match s 0, s 1, s 2 with + | 1, 1, 2 => B1_1_6U1_1_2BinaryEntropy + | _, _, _ => (.exact 0) +lemma B1_1_6Binaries_sound (u : Shape) (hu : u ∈ (below (shape 1 1 6)).filter positive) : + (B1_1_6Binaries u).Encloses ((fun u => binaryEntropyRate (binaryParameter (shape 1 1 6) u)) u) := by + have hl : (below (shape 1 1 6)).filter positive = [(shape 1 1 2)] := by decide +kernel + rw [hl] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl + · exact B1_1_6U1_1_2BinaryEntropy_sound +def B1_1_6S2 : Ball := ⟨(113464402089716250899384401133 / 6250000000000000000000000000000), (668468917 / 100000000000000000000000000000000)⟩ +lemma B1_1_6S2_sound : B1_1_6S2.Encloses + (((below (shape 1 1 6)).map fun u => (littleMass (shape 1 1 6) u : ℝ) * AllFieldTerminalRates.secondLeafRate (shape 1 1 6) u).sum) := by + exact contains_sound (listSumBall_sound (below (shape 1 1 6)) + (fun u => .mul (B1_1_6Masses u) (B1_1_6Leaves u)) _ + (fun u hu => Ball.mul_sound (B1_1_6Masses_sound u hu) (B1_1_6Leaves_sound u hu))) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/Certificates/Terminal1_2_5.lean b/lean/OAI/LinearAlgebra/MatrixFields/Certificates/Terminal1_2_5.lean new file mode 100644 index 0000000000000000000000000000000000000000..5f6efa4a915e23a6e9688dfa69fc779b6410d386 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/Certificates/Terminal1_2_5.lean @@ -0,0 +1,259 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Certificates.LittleB1_3_4 +import OAI.LinearAlgebra.MatrixFields.Certificates.Terminal1_1_6 + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def B1_2_5U0_0_4Leaf : Ball := ⟨0, 0⟩ +lemma B1_2_5U0_0_4Leaf_sound : B1_2_5U0_0_4Leaf.Encloses (AllFieldTerminalRates.secondLeafRate (shape 1 2 5) (shape 0 0 4)) := by + have hh : shapeMax (shape 0 0 4) = 4 := by decide +kernel + simp only [AllFieldTerminalRates.secondLeafRate, hh, ite_true] + change (Ball.exact 0).Encloses 0 + simpa only [Rat.cast_zero] using Ball.exact_sound 0 +def B1_2_5U0_0_4Mass : Ball := ⟨(10839580338829366322698124931 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ +lemma B1_2_5U0_0_4Mass_sound : B1_2_5U0_0_4Mass.Encloses (littleMass (shape 1 2 5) (shape 0 0 4) : ℝ) := by + rw [littleMass_cast] + exact contains_sound (Ball.mul_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) (second_1_2_5)) + (B1_2_5Law_sound (shape 0 0 4))) (by decide +kernel) +def B1_2_5U0_1_3Leaf : Ball := ⟨(115129254649702284200899544090987 / 50000000000000000000000000000000), (21175823683 / 25000000000000000000000000000000)⟩ +lemma B1_2_5U0_1_3Leaf_sound : B1_2_5U0_1_3Leaf.Encloses (AllFieldTerminalRates.secondLeafRate (shape 1 2 5) (shape 0 1 3)) := by + have hh : shapeMax (shape 0 1 3) = 3 := by decide +kernel + simp only [AllFieldTerminalRates.secondLeafRate, hh, show (3 : ℕ) ≠ 4 by decide, ite_false, ite_true] + change logN10.Encloses (Real.log 10) + exact logN10_sound +def B1_2_5U0_1_3Mass : Ball := ⟨(1186081054548533539957298951707 / 25000000000000000000000000000000), (7 / 12500000000000000000000000000000)⟩ +lemma B1_2_5U0_1_3Mass_sound : B1_2_5U0_1_3Mass.Encloses (littleMass (shape 1 2 5) (shape 0 1 3) : ℝ) := by + rw [littleMass_cast] + exact contains_sound (Ball.mul_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) (second_1_2_5)) + (B1_2_5Law_sound (shape 0 1 3))) (by decide +kernel) +def B1_2_5U0_2_2D : Ball := .exact (19531 / 200000) +lemma B1_2_5U0_2_2D_sound : B1_2_5U0_2_2D.Encloses (binaryParameter (shape 1 2 5) (shape 0 2 2) : ℝ) := by + apply exact_rat_enclosed + decide +kernel +def B1_2_5U0_2_2OneD : Ball := .exact (180469 / 200000) +lemma B1_2_5U0_2_2OneD_sound : B1_2_5U0_2_2OneD.Encloses (1 - (binaryParameter (shape 1 2 5) (shape 0 2 2) : ℝ)) := by + have he : binaryParameter (shape 1 2 5) (shape 0 2 2) = (19531 / 200000) := by decide +kernel + rw [he] + convert Ball.exact_sound ((180469 / 200000) : ℚ) using 1 <;> norm_num [B1_2_5U0_2_2OneD, Ball.exact] +def B1_2_5U0_2_2EDLogWitness : LogWitness := ⟨-4, 19531, 12500⟩ +def B1_2_5U0_2_2EDLog : Ball := ⟨(-232631441969328242519371516318041 / 100000000000000000000000000000000), (21175823683 / 20000000000000000000000000000000)⟩ +lemma B1_2_5U0_2_2EDLog_sound : B1_2_5U0_2_2EDLog.Encloses (Real.log ((binaryParameter (shape 1 2 5) (shape 0 2 2) : ℝ))) := by + exact checkLog_sound logTwoBall_sound (B1_2_5U0_2_2D_sound) (w := B1_2_5U0_2_2EDLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def B1_2_5U0_2_2ED : Ball := ⟨(11358811732757374761614612713019 / 50000000000000000000000000000000), (1033962531 / 10000000000000000000000000000000)⟩ +lemma B1_2_5U0_2_2ED_sound : B1_2_5U0_2_2ED.Encloses (Foundation.entropyTerm ((binaryParameter (shape 1 2 5) (shape 0 2 2) : ℝ))) := by + exact contains_sound (entropyTerm_ball (B1_2_5U0_2_2D_sound) B1_2_5U0_2_2EDLog_sound) (by decide +kernel) +def B1_2_5U0_2_2EOneDLogWitness : LogWitness := ⟨-1, 180469, 100000⟩ +def B1_2_5U0_2_2EOneDLog : Ball := ⟨(-2568958716933578869052947578733 / 25000000000000000000000000000000), (21175823683 / 50000000000000000000000000000000)⟩ +lemma B1_2_5U0_2_2EOneDLog_sound : B1_2_5U0_2_2EOneDLog.Encloses (Real.log ((1 - (binaryParameter (shape 1 2 5) (shape 0 2 2) : ℝ)))) := by + exact checkLog_sound logTwoBall_sound (B1_2_5U0_2_2OneD_sound) (w := B1_2_5U0_2_2EOneDLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def B1_2_5U0_2_2EOneD : Ball := ⟨(9272348213725720898382327931727 / 100000000000000000000000000000000), (38215797243 / 100000000000000000000000000000000)⟩ +lemma B1_2_5U0_2_2EOneD_sound : B1_2_5U0_2_2EOneD.Encloses (Foundation.entropyTerm ((1 - (binaryParameter (shape 1 2 5) (shape 0 2 2) : ℝ)))) := by + exact contains_sound (entropyTerm_ball (B1_2_5U0_2_2OneD_sound) B1_2_5U0_2_2EOneDLog_sound) (by decide +kernel) +def B1_2_5U0_2_2BinaryEntropy : Ball := ⟨(7751780094199723268145106355019 / 20000000000000000000000000000000), (52691272677 / 100000000000000000000000000000000)⟩ +lemma B1_2_5U0_2_2BinaryEntropy_sound : B1_2_5U0_2_2BinaryEntropy.Encloses + (binaryEntropyRate (binaryParameter (shape 1 2 5) (shape 0 2 2))) := by + exact contains_sound (Ball.add_sound (Ball.add_sound B1_2_5U0_2_2EOneD_sound B1_2_5U0_2_2ED_sound) + (Ball.mul_sound B1_2_5U0_2_2D_sound logN2_sound)) (by decide +kernel) +def B1_2_5U0_2_2Leaf : Ball := ⟨(164606275545034138422274949480111 / 50000000000000000000000000000000), (33467732881 / 20000000000000000000000000000000)⟩ +lemma B1_2_5U0_2_2Leaf_sound : B1_2_5U0_2_2Leaf.Encloses (AllFieldTerminalRates.secondLeafRate (shape 1 2 5) (shape 0 2 2)) := by + have hh : shapeMax (shape 0 2 2) = 2 := by decide +kernel + have hp : positive (shape 0 2 2) = false := by decide +kernel + simp only [AllFieldTerminalRates.secondLeafRate, hh, hp, Bool.not_false, + show (2 : ℕ) ≠ 4 by decide, show (2 : ℕ) ≠ 3 by decide, ite_false, ite_true] + exact contains_sound (Ball.add_sound B1_2_5U0_2_2BinaryEntropy_sound + (Ball.mul_sound (Ball.mul_sound (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) + B1_2_5U0_2_2OneD_sound) logN5_sound)) (by decide +kernel) +def B1_2_5U0_2_2Mass : Ball := ⟨(340073829440952693670776139029 / 12500000000000000000000000000000), (9 / 25000000000000000000000000000000)⟩ +lemma B1_2_5U0_2_2Mass_sound : B1_2_5U0_2_2Mass.Encloses (littleMass (shape 1 2 5) (shape 0 2 2) : ℝ) := by + rw [littleMass_cast] + exact contains_sound (Ball.mul_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) (second_1_2_5)) + (B1_2_5Law_sound (shape 0 2 2))) (by decide +kernel) +def B1_2_5U1_0_3Leaf : Ball := ⟨(115129254649702284200899544090987 / 50000000000000000000000000000000), (21175823683 / 25000000000000000000000000000000)⟩ +lemma B1_2_5U1_0_3Leaf_sound : B1_2_5U1_0_3Leaf.Encloses (AllFieldTerminalRates.secondLeafRate (shape 1 2 5) (shape 1 0 3)) := by + have hh : shapeMax (shape 1 0 3) = 3 := by decide +kernel + simp only [AllFieldTerminalRates.secondLeafRate, hh, show (3 : ℕ) ≠ 4 by decide, ite_false, ite_true] + change logN10.Encloses (Real.log 10) + exact logN10_sound +def B1_2_5U1_0_3Mass : Ball := ⟨(340073829440952693670776139029 / 12500000000000000000000000000000), (9 / 25000000000000000000000000000000)⟩ +lemma B1_2_5U1_0_3Mass_sound : B1_2_5U1_0_3Mass.Encloses (littleMass (shape 1 2 5) (shape 1 0 3) : ℝ) := by + rw [littleMass_cast] + exact contains_sound (Ball.mul_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) (second_1_2_5)) + (B1_2_5Law_sound (shape 1 0 3))) (by decide +kernel) +def B1_2_5U1_1_2D : Ball := .exact 0 +lemma B1_2_5U1_1_2D_sound : B1_2_5U1_1_2D.Encloses (binaryParameter (shape 1 2 5) (shape 1 1 2) : ℝ) := by + apply exact_rat_enclosed + decide +kernel +def B1_2_5U1_1_2OneD : Ball := .exact 1 +lemma B1_2_5U1_1_2OneD_sound : B1_2_5U1_1_2OneD.Encloses (1 - (binaryParameter (shape 1 2 5) (shape 1 1 2) : ℝ)) := by + have he : binaryParameter (shape 1 2 5) (shape 1 1 2) = 0 := by decide +kernel + rw [he] + convert Ball.exact_sound (1 : ℚ) using 1 <;> norm_num [B1_2_5U1_1_2OneD, Ball.exact] +def B1_2_5U1_1_2ED : Ball := .exact 0 +lemma B1_2_5U1_1_2ED_sound : B1_2_5U1_1_2ED.Encloses (Foundation.entropyTerm ((binaryParameter (shape 1 2 5) (shape 1 1 2) : ℝ))) := + entropyTerm_zero_ball (B1_2_5U1_1_2D_sound) +def B1_2_5U1_1_2EOneDLog : Ball := .exact 0 +lemma B1_2_5U1_1_2EOneDLog_sound : B1_2_5U1_1_2EOneDLog.Encloses (Real.log ((1 - (binaryParameter (shape 1 2 5) (shape 1 1 2) : ℝ)))) := by + exact log_exact_one_ball (B1_2_5U1_1_2OneD_sound) +def B1_2_5U1_1_2EOneD : Ball := ⟨0, 0⟩ +lemma B1_2_5U1_1_2EOneD_sound : B1_2_5U1_1_2EOneD.Encloses (Foundation.entropyTerm ((1 - (binaryParameter (shape 1 2 5) (shape 1 1 2) : ℝ)))) := by + exact contains_sound (entropyTerm_ball (B1_2_5U1_1_2OneD_sound) B1_2_5U1_1_2EOneDLog_sound) (by decide +kernel) +def B1_2_5U1_1_2BinaryEntropy : Ball := ⟨0, 0⟩ +lemma B1_2_5U1_1_2BinaryEntropy_sound : B1_2_5U1_1_2BinaryEntropy.Encloses + (binaryEntropyRate (binaryParameter (shape 1 2 5) (shape 1 1 2))) := by + exact contains_sound (Ball.add_sound (Ball.add_sound B1_2_5U1_1_2EOneD_sound B1_2_5U1_1_2ED_sound) + (Ball.mul_sound B1_2_5U1_1_2D_sound logN2_sound)) (by decide +kernel) +def B1_2_5U1_1_2Leaf : Ball := ⟨(40235947810852509365018973782911 / 12500000000000000000000000000000), (63527471049 / 50000000000000000000000000000000)⟩ +lemma B1_2_5U1_1_2Leaf_sound : B1_2_5U1_1_2Leaf.Encloses (AllFieldTerminalRates.secondLeafRate (shape 1 2 5) (shape 1 1 2)) := by + have hh : shapeMax (shape 1 1 2) = 2 := by decide +kernel + have hp : positive (shape 1 1 2) = true := by decide +kernel + simp only [AllFieldTerminalRates.secondLeafRate, hh, hp, Bool.not_true, Bool.false_eq_true, + show (2 : ℕ) ≠ 4 by decide, show (2 : ℕ) ≠ 3 by decide, ite_false] + have ht : (Ball.exact 2).Encloses (2 - (binaryParameter (shape 1 2 5) (shape 1 1 2) : ℝ)) := by + have he : binaryParameter (shape 1 2 5) (shape 1 1 2) = 0 := by decide +kernel + rw [he] + convert Ball.exact_sound (2 : ℚ) using 1 + norm_num [Ball.exact] + exact contains_sound (Ball.mul_sound ht logN5_sound) (by decide +kernel) +def B1_2_5U1_1_2Mass : Ball := ⟨(1186081054548533539957298951707 / 25000000000000000000000000000000), (7 / 12500000000000000000000000000000)⟩ +lemma B1_2_5U1_1_2Mass_sound : B1_2_5U1_1_2Mass.Encloses (littleMass (shape 1 2 5) (shape 1 1 2) : ℝ) := by + rw [littleMass_cast] + exact contains_sound (Ball.mul_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) (second_1_2_5)) + (B1_2_5Law_sound (shape 1 1 2))) (by decide +kernel) +def B1_2_5U1_2_1D : Ball := .exact (10533 / 250000) +lemma B1_2_5U1_2_1D_sound : B1_2_5U1_2_1D.Encloses (binaryParameter (shape 1 2 5) (shape 1 2 1) : ℝ) := by + apply exact_rat_enclosed + decide +kernel +def B1_2_5U1_2_1OneD : Ball := .exact (239467 / 250000) +lemma B1_2_5U1_2_1OneD_sound : B1_2_5U1_2_1OneD.Encloses (1 - (binaryParameter (shape 1 2 5) (shape 1 2 1) : ℝ)) := by + have he : binaryParameter (shape 1 2 5) (shape 1 2 1) = (10533 / 250000) := by decide +kernel + rw [he] + convert Ball.exact_sound ((239467 / 250000) : ℚ) using 1 <;> norm_num [B1_2_5U1_2_1OneD, Ball.exact] +def B1_2_5U1_2_1EDLogWitness : LogWitness := ⟨-5, 21066, 15625⟩ +def B1_2_5U1_2_1EDLog : Ball := ⟨(-316694773200784155107075107979101 / 100000000000000000000000000000000), (127054942097 / 100000000000000000000000000000000)⟩ +lemma B1_2_5U1_2_1EDLog_sound : B1_2_5U1_2_1EDLog.Encloses (Real.log ((binaryParameter (shape 1 2 5) (shape 1 2 1) : ℝ))) := by + exact checkLog_sound logTwoBall_sound (B1_2_5U1_2_1D_sound) (w := B1_2_5U1_2_1EDLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def B1_2_5U1_2_1ED : Ball := ⟨(21348774695192700836754061519 / 160000000000000000000000000000), (5353078821 / 100000000000000000000000000000000)⟩ +lemma B1_2_5U1_2_1ED_sound : B1_2_5U1_2_1ED.Encloses (Foundation.entropyTerm ((binaryParameter (shape 1 2 5) (shape 1 2 1) : ℝ))) := by + exact contains_sound (entropyTerm_ball (B1_2_5U1_2_1D_sound) B1_2_5U1_2_1EDLog_sound) (by decide +kernel) +def B1_2_5U1_2_1EOneDLogWitness : LogWitness := ⟨-1, 239467, 125000⟩ +def B1_2_5U1_2_1EOneDLog : Ball := ⟨(-4304529756115245594727191194021 / 100000000000000000000000000000000), (21175823683 / 50000000000000000000000000000000)⟩ +lemma B1_2_5U1_2_1EOneDLog_sound : B1_2_5U1_2_1EOneDLog.Encloses (Real.log ((1 - (binaryParameter (shape 1 2 5) (shape 1 2 1) : ℝ)))) := by + exact checkLog_sound logTwoBall_sound (B1_2_5U1_2_1OneD_sound) (w := B1_2_5U1_2_1EOneDLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def B1_2_5U1_2_1EOneD : Ball := ⟨(824634261686119613466029034927 / 20000000000000000000000000000000), (507091097 / 1250000000000000000000000000000)⟩ +lemma B1_2_5U1_2_1EOneD_sound : B1_2_5U1_2_1EOneD.Encloses (Foundation.entropyTerm ((1 - (binaryParameter (shape 1 2 5) (shape 1 2 1) : ℝ)))) := by + exact contains_sound (entropyTerm_ball (B1_2_5U1_2_1OneD_sound) B1_2_5U1_2_1EOneDLog_sound) (by decide +kernel) +def B1_2_5U1_2_1BinaryEntropy : Ball := ⟨(20386523194061197667938115193607 / 100000000000000000000000000000000), (47704726189 / 100000000000000000000000000000000)⟩ +lemma B1_2_5U1_2_1BinaryEntropy_sound : B1_2_5U1_2_1BinaryEntropy.Encloses + (binaryEntropyRate (binaryParameter (shape 1 2 5) (shape 1 2 1))) := by + exact contains_sound (Ball.add_sound (Ball.add_sound B1_2_5U1_2_1EOneD_sound B1_2_5U1_2_1ED_sound) + (Ball.mul_sound B1_2_5U1_2_1D_sound logN2_sound)) (by decide +kernel) +def B1_2_5U1_2_1Leaf : Ball := ⟨(157553349337076361610941936324801 / 50000000000000000000000000000000), (124378402689 / 100000000000000000000000000000000)⟩ +lemma B1_2_5U1_2_1Leaf_sound : B1_2_5U1_2_1Leaf.Encloses (AllFieldTerminalRates.secondLeafRate (shape 1 2 5) (shape 1 2 1)) := by + have hh : shapeMax (shape 1 2 1) = 2 := by decide +kernel + have hp : positive (shape 1 2 1) = true := by decide +kernel + simp only [AllFieldTerminalRates.secondLeafRate, hh, hp, Bool.not_true, Bool.false_eq_true, + show (2 : ℕ) ≠ 4 by decide, show (2 : ℕ) ≠ 3 by decide, ite_false] + have ht : (Ball.exact (489467 / 250000)).Encloses (2 - (binaryParameter (shape 1 2 5) (shape 1 2 1) : ℝ)) := by + have he : binaryParameter (shape 1 2 5) (shape 1 2 1) = (10533 / 250000) := by decide +kernel + rw [he] + convert Ball.exact_sound ((489467 / 250000) : ℚ) using 1 + norm_num [Ball.exact] + exact contains_sound (Ball.mul_sound ht logN5_sound) (by decide +kernel) +def B1_2_5U1_2_1Mass : Ball := ⟨(10839580338829366322698124931 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ +lemma B1_2_5U1_2_1Mass_sound : B1_2_5U1_2_1Mass.Encloses (littleMass (shape 1 2 5) (shape 1 2 1) : ℝ) := by + rw [littleMass_cast] + exact contains_sound (Ball.mul_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) (second_1_2_5)) + (B1_2_5Law_sound (shape 1 2 1))) (by decide +kernel) +def B1_2_5Leaves (s : Shape) : Ball := + match s 0, s 1, s 2 with + | 0, 0, 4 => B1_2_5U0_0_4Leaf + | 0, 1, 3 => B1_2_5U0_1_3Leaf + | 0, 2, 2 => B1_2_5U0_2_2Leaf + | 1, 0, 3 => B1_2_5U1_0_3Leaf + | 1, 1, 2 => B1_2_5U1_1_2Leaf + | 1, 2, 1 => B1_2_5U1_2_1Leaf + | _, _, _ => (.exact 0) +lemma B1_2_5Leaves_sound (u : Shape) (hu : u ∈ below (shape 1 2 5)) : + (B1_2_5Leaves u).Encloses (AllFieldTerminalRates.secondLeafRate (shape 1 2 5) u) := by + rw [B1_2_5_below] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl | rfl | rfl + · exact B1_2_5U0_0_4Leaf_sound + · exact B1_2_5U0_1_3Leaf_sound + · exact B1_2_5U0_2_2Leaf_sound + · exact B1_2_5U1_0_3Leaf_sound + · exact B1_2_5U1_1_2Leaf_sound + · exact B1_2_5U1_2_1Leaf_sound +def B1_2_5Masses (s : Shape) : Ball := + match s 0, s 1, s 2 with + | 0, 0, 4 => B1_2_5U0_0_4Mass + | 0, 1, 3 => B1_2_5U0_1_3Mass + | 0, 2, 2 => B1_2_5U0_2_2Mass + | 1, 0, 3 => B1_2_5U1_0_3Mass + | 1, 1, 2 => B1_2_5U1_1_2Mass + | 1, 2, 1 => B1_2_5U1_2_1Mass + | _, _, _ => (.exact 0) +lemma B1_2_5Masses_sound (u : Shape) (hu : u ∈ below (shape 1 2 5)) : + (B1_2_5Masses u).Encloses ((fun u => (littleMass (shape 1 2 5) u : ℝ)) u) := by + rw [B1_2_5_below] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl | rfl | rfl + · exact B1_2_5U0_0_4Mass_sound + · exact B1_2_5U0_1_3Mass_sound + · exact B1_2_5U0_2_2Mass_sound + · exact B1_2_5U1_0_3Mass_sound + · exact B1_2_5U1_1_2Mass_sound + · exact B1_2_5U1_2_1Mass_sound +def B1_2_5Binaries (s : Shape) : Ball := + match s 0, s 1, s 2 with + | 0, 2, 2 => B1_2_5U0_2_2BinaryEntropy + | 1, 1, 2 => B1_2_5U1_1_2BinaryEntropy + | 1, 2, 1 => B1_2_5U1_2_1BinaryEntropy + | _, _, _ => (.exact 0) +lemma B1_2_5Binaries_sound (u : Shape) (hu : u ∈ (below (shape 1 2 5)).filter positive) : + (B1_2_5Binaries u).Encloses ((fun u => binaryEntropyRate (binaryParameter (shape 1 2 5) u)) u) := by + have hl : (below (shape 1 2 5)).filter positive = [(shape 1 1 2), (shape 1 2 1)] := by decide +kernel + rw [hl] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl + · exact B1_2_5U1_1_2BinaryEntropy_sound + · exact B1_2_5U1_2_1BinaryEntropy_sound +def B1_2_5S2 : Ball := ⟨(41450674273625169102162892218041 / 100000000000000000000000000000000), (16917009863 / 100000000000000000000000000000000)⟩ +lemma B1_2_5S2_sound : B1_2_5S2.Encloses + (((below (shape 1 2 5)).map fun u => (littleMass (shape 1 2 5) u : ℝ) * AllFieldTerminalRates.secondLeafRate (shape 1 2 5) u).sum) := by + exact contains_sound (listSumBall_sound (below (shape 1 2 5)) + (fun u => .mul (B1_2_5Masses u) (B1_2_5Leaves u)) _ + (fun u hu => Ball.mul_sound (B1_2_5Masses_sound u hu) (B1_2_5Leaves_sound u hu))) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/Certificates/Terminal1_3_4.lean b/lean/OAI/LinearAlgebra/MatrixFields/Certificates/Terminal1_3_4.lean new file mode 100644 index 0000000000000000000000000000000000000000..d00266cf0b42daae75bb16111deb5092f54bfd93 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/Certificates/Terminal1_3_4.lean @@ -0,0 +1,288 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Certificates.Terminal1_1_6 + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def B1_3_4U0_0_4Leaf : Ball := ⟨0, 0⟩ +lemma B1_3_4U0_0_4Leaf_sound : B1_3_4U0_0_4Leaf.Encloses (AllFieldTerminalRates.secondLeafRate (shape 1 3 4) (shape 0 0 4)) := by + have hh : shapeMax (shape 0 0 4) = 4 := by decide +kernel + simp only [AllFieldTerminalRates.secondLeafRate, hh, ite_true] + simpa only [B1_3_4U0_0_4Leaf, Ball.exact, Rat.cast_zero] using Ball.exact_sound 0 +def B1_3_4U0_0_4Mass : Ball := ⟨(11296930969545920829977701957 / 100000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ +lemma B1_3_4U0_0_4Mass_sound : B1_3_4U0_0_4Mass.Encloses (littleMass (shape 1 3 4) (shape 0 0 4) : ℝ) := by + rw [littleMass_cast] + exact contains_sound (Ball.mul_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) (second_1_3_4)) + (B1_3_4Law_sound (shape 0 0 4))) (by decide +kernel) +def B1_3_4U0_1_3Leaf : Ball := ⟨(115129254649702284200899544090987 / 50000000000000000000000000000000), (21175823683 / 25000000000000000000000000000000)⟩ +lemma B1_3_4U0_1_3Leaf_sound : B1_3_4U0_1_3Leaf.Encloses (AllFieldTerminalRates.secondLeafRate (shape 1 3 4) (shape 0 1 3)) := by + have hh : shapeMax (shape 0 1 3) = 3 := by decide +kernel + simpa only [B1_3_4U0_1_3Leaf, logN10, AllFieldTerminalRates.secondLeafRate, hh, show (3 : ℕ) ≠ 4 by decide, ite_false, ite_true] using logN10_sound +def B1_3_4U0_1_3Mass : Ball := ⟨(1835521493311920037404366035991 / 50000000000000000000000000000000), (21 / 50000000000000000000000000000000)⟩ +lemma B1_3_4U0_1_3Mass_sound : B1_3_4U0_1_3Mass.Encloses (littleMass (shape 1 3 4) (shape 0 1 3) : ℝ) := by + rw [littleMass_cast] + exact contains_sound (Ball.mul_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) (second_1_3_4)) + (B1_3_4Law_sound (shape 0 1 3))) (by decide +kernel) +def B1_3_4U0_2_2D : Ball := .exact (46483 / 500000) +lemma B1_3_4U0_2_2D_sound : B1_3_4U0_2_2D.Encloses (binaryParameter (shape 1 3 4) (shape 0 2 2) : ℝ) := by + apply exact_rat_enclosed + decide +kernel +def B1_3_4U0_2_2OneD : Ball := .exact (453517 / 500000) +lemma B1_3_4U0_2_2OneD_sound : B1_3_4U0_2_2OneD.Encloses (1 - (binaryParameter (shape 1 3 4) (shape 0 2 2) : ℝ)) := by + have he : binaryParameter (shape 1 3 4) (shape 0 2 2) = (46483 / 500000) := by decide +kernel + rw [he] + convert Ball.exact_sound ((453517 / 500000) : ℚ) using 1 <;> norm_num [B1_3_4U0_2_2OneD, Ball.exact] +def B1_3_4U0_2_2EDLogWitness : LogWitness := ⟨-4, 46483, 31250⟩ +def B1_3_4U0_2_2EDLog : Ball := ⟨(-59388036101788952339754245697507 / 25000000000000000000000000000000), (21175823683 / 20000000000000000000000000000000)⟩ +lemma B1_3_4U0_2_2EDLog_sound : B1_3_4U0_2_2EDLog.Encloses (Real.log ((binaryParameter (shape 1 3 4) (shape 0 2 2) : ℝ))) := by + exact checkLog_sound logTwoBall_sound (B1_3_4U0_2_2D_sound) (w := B1_3_4U0_2_2EDLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def B1_3_4U0_2_2ED : Ball := ⟨(11042136328477823486435186411029 / 50000000000000000000000000000000), (9843158123 / 100000000000000000000000000000000)⟩ +lemma B1_3_4U0_2_2ED_sound : B1_3_4U0_2_2ED.Encloses (Foundation.entropyTerm ((binaryParameter (shape 1 3 4) (shape 0 2 2) : ℝ))) := by + exact contains_sound (entropyTerm_ball (B1_3_4U0_2_2D_sound) B1_3_4U0_2_2EDLog_sound) (by decide +kernel) +def B1_3_4U0_2_2EOneDLogWitness : LogWitness := ⟨-1, 453517, 250000⟩ +def B1_3_4U0_2_2EOneDLog : Ball := ⟨(-609845895945556733363202867553 / 6250000000000000000000000000000), (21175823683 / 50000000000000000000000000000000)⟩ +lemma B1_3_4U0_2_2EOneDLog_sound : B1_3_4U0_2_2EOneDLog.Encloses (Real.log ((1 - (binaryParameter (shape 1 3 4) (shape 0 2 2) : ℝ)))) := by + exact checkLog_sound logTwoBall_sound (B1_3_4U0_2_2OneD_sound) (w := B1_3_4U0_2_2EOneDLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def B1_3_4U0_2_2EOneD : Ball := ⟨(8850415398129313697429749596289 / 100000000000000000000000000000000), (19207192059 / 50000000000000000000000000000000)⟩ +lemma B1_3_4U0_2_2EOneD_sound : B1_3_4U0_2_2EOneD.Encloses (Foundation.entropyTerm ((1 - (binaryParameter (shape 1 3 4) (shape 0 2 2) : ℝ)))) := by + exact contains_sound (entropyTerm_ball (B1_3_4U0_2_2OneD_sound) B1_3_4U0_2_2EOneDLog_sound) (by decide +kernel) +def B1_3_4U0_2_2BinaryEntropy : Ball := ⟨(4672325016734818529228545097933 / 12500000000000000000000000000000), (5219480549 / 10000000000000000000000000000000)⟩ +lemma B1_3_4U0_2_2BinaryEntropy_sound : B1_3_4U0_2_2BinaryEntropy.Encloses + (binaryEntropyRate (binaryParameter (shape 1 3 4) (shape 0 2 2))) := by + exact contains_sound (Ball.add_sound (Ball.add_sound B1_3_4U0_2_2EOneD_sound B1_3_4U0_2_2ED_sound) + (Ball.mul_sound B1_3_4U0_2_2D_sound logN2_sound)) (by decide +kernel) +def B1_3_4U0_2_2Leaf : Ball := ⟨(65868316325445781613790663942627 / 20000000000000000000000000000000), (83718978921 / 50000000000000000000000000000000)⟩ +lemma B1_3_4U0_2_2Leaf_sound : B1_3_4U0_2_2Leaf.Encloses (AllFieldTerminalRates.secondLeafRate (shape 1 3 4) (shape 0 2 2)) := by + have hh : shapeMax (shape 0 2 2) = 2 := by decide +kernel + have hp : positive (shape 0 2 2) = false := by decide +kernel + simp only [AllFieldTerminalRates.secondLeafRate, hh, hp, Bool.not_false, + show (2 : ℕ) ≠ 4 by decide, show (2 : ℕ) ≠ 3 by decide, ite_false, ite_true] + exact contains_sound (Ball.add_sound B1_3_4U0_2_2BinaryEntropy_sound + (Ball.mul_sound (Ball.mul_sound (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) + B1_3_4U0_2_2OneD_sound) logN5_sound)) (by decide +kernel) +def B1_3_4U0_2_2Mass : Ball := ⟨(13125128956309370446223832483411 / 50000000000000000000000000000000), (13 / 5000000000000000000000000000000)⟩ +lemma B1_3_4U0_2_2Mass_sound : B1_3_4U0_2_2Mass.Encloses (littleMass (shape 1 3 4) (shape 0 2 2) : ℝ) := by + rw [littleMass_cast] + exact contains_sound (Ball.mul_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) (second_1_3_4)) + (B1_3_4Law_sound (shape 0 2 2))) (by decide +kernel) +def B1_3_4U0_3_1Leaf : Ball := ⟨(115129254649702284200899544090987 / 50000000000000000000000000000000), (21175823683 / 25000000000000000000000000000000)⟩ +lemma B1_3_4U0_3_1Leaf_sound : B1_3_4U0_3_1Leaf.Encloses (AllFieldTerminalRates.secondLeafRate (shape 1 3 4) (shape 0 3 1)) := by + have hh : shapeMax (shape 0 3 1) = 3 := by decide +kernel + simpa only [B1_3_4U0_3_1Leaf, logN10, AllFieldTerminalRates.secondLeafRate, hh, show (3 : ℕ) ≠ 4 by decide, ite_false, ite_true] using logN10_sound +def B1_3_4U0_3_1Mass : Ball := ⟨(160933812951551762605775804971 / 20000000000000000000000000000000), (11 / 100000000000000000000000000000000)⟩ +lemma B1_3_4U0_3_1Mass_sound : B1_3_4U0_3_1Mass.Encloses (littleMass (shape 1 3 4) (shape 0 3 1) : ℝ) := by + rw [littleMass_cast] + exact contains_sound (Ball.mul_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) (second_1_3_4)) + (B1_3_4Law_sound (shape 0 3 1))) (by decide +kernel) +def B1_3_4U1_0_3Leaf : Ball := ⟨(115129254649702284200899544090987 / 50000000000000000000000000000000), (21175823683 / 25000000000000000000000000000000)⟩ +lemma B1_3_4U1_0_3Leaf_sound : B1_3_4U1_0_3Leaf.Encloses (AllFieldTerminalRates.secondLeafRate (shape 1 3 4) (shape 1 0 3)) := by + have hh : shapeMax (shape 1 0 3) = 3 := by decide +kernel + simpa only [B1_3_4U1_0_3Leaf, logN10, AllFieldTerminalRates.secondLeafRate, hh, show (3 : ℕ) ≠ 4 by decide, ite_false, ite_true] using logN10_sound +def B1_3_4U1_0_3Mass : Ball := ⟨(160933812951551762605775804971 / 20000000000000000000000000000000), (11 / 100000000000000000000000000000000)⟩ +lemma B1_3_4U1_0_3Mass_sound : B1_3_4U1_0_3Mass.Encloses (littleMass (shape 1 3 4) (shape 1 0 3) : ℝ) := by + rw [littleMass_cast] + exact contains_sound (Ball.mul_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) (second_1_3_4)) + (B1_3_4Law_sound (shape 1 0 3))) (by decide +kernel) +def B1_3_4U1_1_2D : Ball := .exact (301 / 250000) +lemma B1_3_4U1_1_2D_sound : B1_3_4U1_1_2D.Encloses (binaryParameter (shape 1 3 4) (shape 1 1 2) : ℝ) := by + apply exact_rat_enclosed + decide +kernel +def B1_3_4U1_1_2OneD : Ball := .exact (249699 / 250000) +lemma B1_3_4U1_1_2OneD_sound : B1_3_4U1_1_2OneD.Encloses (1 - (binaryParameter (shape 1 3 4) (shape 1 1 2) : ℝ)) := by + have he : binaryParameter (shape 1 3 4) (shape 1 1 2) = (301 / 250000) := by decide +kernel + rw [he] + convert Ball.exact_sound ((249699 / 250000) : ℚ) using 1 <;> norm_num [B1_3_4U1_1_2OneD, Ball.exact] +def B1_3_4U1_1_2EDLogWitness : LogWitness := ⟨-10, 19264, 15625⟩ +def B1_3_4U1_1_2EDLog : Ball := ⟨(-168052648302387693917382182971301 / 25000000000000000000000000000000), (7279189391 / 3125000000000000000000000000000)⟩ +lemma B1_3_4U1_1_2EDLog_sound : B1_3_4U1_1_2EDLog.Encloses (Real.log ((binaryParameter (shape 1 3 4) (shape 1 1 2) : ℝ))) := by + exact checkLog_sound logTwoBall_sound (B1_3_4U1_1_2D_sound) (w := B1_3_4U1_1_2EDLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def B1_3_4U1_1_2ED : Ball := ⟨(80934155422429913390611259319 / 10000000000000000000000000000000), (28045261 / 10000000000000000000000000000000)⟩ +lemma B1_3_4U1_1_2ED_sound : B1_3_4U1_1_2ED.Encloses (Foundation.entropyTerm ((binaryParameter (shape 1 3 4) (shape 1 1 2) : ℝ))) := by + exact contains_sound (entropyTerm_ball (B1_3_4U1_1_2D_sound) B1_3_4U1_1_2EDLog_sound) (by decide +kernel) +def B1_3_4U1_1_2EOneDLogWitness : LogWitness := ⟨-1, 249699, 125000⟩ +def B1_3_4U1_1_2EOneDLog : Ball := ⟨(-1882383422351678894223498981 / 1562500000000000000000000000000), (21175823683 / 50000000000000000000000000000000)⟩ +lemma B1_3_4U1_1_2EOneDLog_sound : B1_3_4U1_1_2EOneDLog.Encloses (Real.log ((1 - (binaryParameter (shape 1 3 4) (shape 1 1 2) : ℝ)))) := by + exact checkLog_sound logTwoBall_sound (B1_3_4U1_1_2OneD_sound) (w := B1_3_4U1_1_2EOneDLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def B1_3_4U1_1_2EOneD : Ball := ⟨(120327490093514718261430648847 / 100000000000000000000000000000000), (2643790999 / 6250000000000000000000000000000)⟩ +lemma B1_3_4U1_1_2EOneD_sound : B1_3_4U1_1_2EOneD.Encloses (Foundation.entropyTerm ((1 - (binaryParameter (shape 1 3 4) (shape 1 1 2) : ℝ)))) := by + exact contains_sound (entropyTerm_ball (B1_3_4U1_1_2OneD_sound) B1_3_4U1_1_2EOneDLog_sound) (by decide +kernel) +def B1_3_4U1_1_2BinaryEntropy : Ball := ⟨(101312396485723126742137796647 / 10000000000000000000000000000000), (21316049989 / 50000000000000000000000000000000)⟩ +lemma B1_3_4U1_1_2BinaryEntropy_sound : B1_3_4U1_1_2BinaryEntropy.Encloses + (binaryEntropyRate (binaryParameter (shape 1 3 4) (shape 1 1 2))) := by + exact contains_sound (Ball.add_sound (Ball.add_sound B1_3_4U1_1_2EOneD_sound B1_3_4U1_1_2ED_sound) + (Ball.mul_sound B1_3_4U1_1_2D_sound logN2_sound)) (by decide +kernel) +def B1_3_4U1_1_2Leaf : Ball := ⟨(6433876123243260184700997177711 / 2000000000000000000000000000000), (7936153439 / 6250000000000000000000000000000)⟩ +lemma B1_3_4U1_1_2Leaf_sound : B1_3_4U1_1_2Leaf.Encloses (AllFieldTerminalRates.secondLeafRate (shape 1 3 4) (shape 1 1 2)) := by + have hh : shapeMax (shape 1 1 2) = 2 := by decide +kernel + have hp : positive (shape 1 1 2) = true := by decide +kernel + simp only [AllFieldTerminalRates.secondLeafRate, hh, hp, Bool.not_true, Bool.false_eq_true, + show (2 : ℕ) ≠ 4 by decide, show (2 : ℕ) ≠ 3 by decide, ite_false] + have ht : (Ball.exact (499699 / 250000)).Encloses (2 - (binaryParameter (shape 1 3 4) (shape 1 1 2) : ℝ)) := by + have he : binaryParameter (shape 1 3 4) (shape 1 1 2) = (301 / 250000) := by decide +kernel + rw [he] + convert Ball.exact_sound ((499699 / 250000) : ℚ) using 1; norm_num [Ball.exact] + exact contains_sound (Ball.mul_sound ht logN5_sound) (by decide +kernel) +def B1_3_4U1_1_2Mass : Ball := ⟨(13125128956309370446223832483411 / 50000000000000000000000000000000), (13 / 5000000000000000000000000000000)⟩ +lemma B1_3_4U1_1_2Mass_sound : B1_3_4U1_1_2Mass.Encloses (littleMass (shape 1 3 4) (shape 1 1 2) : ℝ) := by + rw [littleMass_cast] + exact contains_sound (Ball.mul_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) (second_1_3_4)) + (B1_3_4Law_sound (shape 1 1 2))) (by decide +kernel) +def B1_3_4U1_2_1D : Ball := .exact (10537 / 250000) +lemma B1_3_4U1_2_1D_sound : B1_3_4U1_2_1D.Encloses (binaryParameter (shape 1 3 4) (shape 1 2 1) : ℝ) := by + apply exact_rat_enclosed + decide +kernel +def B1_3_4U1_2_1OneD : Ball := .exact (239463 / 250000) +lemma B1_3_4U1_2_1OneD_sound : B1_3_4U1_2_1OneD.Encloses (1 - (binaryParameter (shape 1 3 4) (shape 1 2 1) : ℝ)) := by + have he : binaryParameter (shape 1 3 4) (shape 1 2 1) = (10537 / 250000) := by decide +kernel + rw [he] + convert Ball.exact_sound ((239463 / 250000) : ℚ) using 1 <;> norm_num [B1_3_4U1_2_1OneD, Ball.exact] +def B1_3_4U1_2_1EDLogWitness : LogWitness := ⟨-5, 21074, 15625⟩ +def B1_3_4U1_2_1EDLog : Ball := ⟨(-316656804524485588305492584261679 / 100000000000000000000000000000000), (63527471049 / 50000000000000000000000000000000)⟩ +lemma B1_3_4U1_2_1EDLog_sound : B1_3_4U1_2_1EDLog.Encloses (Real.log ((binaryParameter (shape 1 3 4) (shape 1 2 1) : ℝ))) := by + exact checkLog_sound logTwoBall_sound (B1_3_4U1_2_1D_sound) (w := B1_3_4U1_2_1EDLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def B1_3_4U1_2_1ED : Ball := ⟨(13346450997098018575899901441461 / 100000000000000000000000000000000), (53551117 / 1000000000000000000000000000000)⟩ +lemma B1_3_4U1_2_1ED_sound : B1_3_4U1_2_1ED.Encloses (Foundation.entropyTerm ((binaryParameter (shape 1 3 4) (shape 1 2 1) : ℝ))) := by + exact contains_sound (entropyTerm_ball (B1_3_4U1_2_1D_sound) B1_3_4U1_2_1EDLog_sound) (by decide +kernel) +def B1_3_4U1_2_1EOneDLogWitness : LogWitness := ⟨-1, 239463, 125000⟩ +def B1_3_4U1_2_1EOneDLog : Ball := ⟨(-4306200146360205403795606812577 / 100000000000000000000000000000000), (21175823683 / 50000000000000000000000000000000)⟩ +lemma B1_3_4U1_2_1EOneDLog_sound : B1_3_4U1_2_1EOneDLog.Encloses (Real.log ((1 - (binaryParameter (shape 1 3 4) (shape 1 2 1) : ℝ)))) := by + exact checkLog_sound logTwoBall_sound (B1_3_4U1_2_1OneD_sound) (w := B1_3_4U1_2_1EOneDLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def B1_3_4U1_2_1EOneD : Ball := ⟨(4124702422591415466436429576641 / 100000000000000000000000000000000), (20283305067 / 50000000000000000000000000000000)⟩ +lemma B1_3_4U1_2_1EOneD_sound : B1_3_4U1_2_1EOneD.Encloses (Foundation.entropyTerm ((1 - (binaryParameter (shape 1 3 4) (shape 1 2 1) : ℝ)))) := by + exact contains_sound (entropyTerm_ball (B1_3_4U1_2_1OneD_sound) B1_3_4U1_2_1EOneDLog_sound) (by decide +kernel) +def B1_3_4U1_2_1BinaryEntropy : Ball := ⟨(20392630156313491532468080158787 / 100000000000000000000000000000000), (11926689767 / 25000000000000000000000000000000)⟩ +lemma B1_3_4U1_2_1BinaryEntropy_sound : B1_3_4U1_2_1BinaryEntropy.Encloses + (binaryEntropyRate (binaryParameter (shape 1 3 4) (shape 1 2 1))) := by + exact contains_sound (Ball.add_sound (Ball.add_sound B1_3_4U1_2_1EOneD_sound B1_3_4U1_2_1ED_sound) + (Ball.mul_sound B1_3_4U1_2_1D_sound logN2_sound)) (by decide +kernel) +def B1_3_4U1_2_1Leaf : Ball := ⟨(315104123573492828661284511435279 / 100000000000000000000000000000000), (124377386249 / 100000000000000000000000000000000)⟩ +lemma B1_3_4U1_2_1Leaf_sound : B1_3_4U1_2_1Leaf.Encloses (AllFieldTerminalRates.secondLeafRate (shape 1 3 4) (shape 1 2 1)) := by + have hh : shapeMax (shape 1 2 1) = 2 := by decide +kernel + have hp : positive (shape 1 2 1) = true := by decide +kernel + simp only [AllFieldTerminalRates.secondLeafRate, hh, hp, Bool.not_true, Bool.false_eq_true, + show (2 : ℕ) ≠ 4 by decide, show (2 : ℕ) ≠ 3 by decide, ite_false] + have ht : (Ball.exact (489463 / 250000)).Encloses (2 - (binaryParameter (shape 1 3 4) (shape 1 2 1) : ℝ)) := by + have he : binaryParameter (shape 1 3 4) (shape 1 2 1) = (10537 / 250000) := by decide +kernel + rw [he] + convert Ball.exact_sound ((489463 / 250000) : ℚ) using 1; norm_num [Ball.exact] + exact contains_sound (Ball.mul_sound ht logN5_sound) (by decide +kernel) +def B1_3_4U1_2_1Mass : Ball := ⟨(1835521493311920037404366035991 / 50000000000000000000000000000000), (21 / 50000000000000000000000000000000)⟩ +lemma B1_3_4U1_2_1Mass_sound : B1_3_4U1_2_1Mass.Encloses (littleMass (shape 1 3 4) (shape 1 2 1) : ℝ) := by + rw [littleMass_cast] + exact contains_sound (Ball.mul_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) (second_1_3_4)) + (B1_3_4Law_sound (shape 1 2 1))) (by decide +kernel) +def B1_3_4U1_3_0Leaf : Ball := ⟨(115129254649702284200899544090987 / 50000000000000000000000000000000), (21175823683 / 25000000000000000000000000000000)⟩ +lemma B1_3_4U1_3_0Leaf_sound : B1_3_4U1_3_0Leaf.Encloses (AllFieldTerminalRates.secondLeafRate (shape 1 3 4) (shape 1 3 0)) := by + have hh : shapeMax (shape 1 3 0) = 3 := by decide +kernel + simpa only [B1_3_4U1_3_0Leaf, logN10, AllFieldTerminalRates.secondLeafRate, hh, show (3 : ℕ) ≠ 4 by decide, ite_false, ite_true] using logN10_sound +def B1_3_4U1_3_0Mass : Ball := ⟨(11296930969545920829977701957 / 100000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ +lemma B1_3_4U1_3_0Mass_sound : B1_3_4U1_3_0Mass.Encloses (littleMass (shape 1 3 4) (shape 1 3 0) : ℝ) := by + rw [littleMass_cast] + exact contains_sound (Ball.mul_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) (second_1_3_4)) + (B1_3_4Law_sound (shape 1 3 0))) (by decide +kernel) +def B1_3_4Leaves (s : Shape) : Ball := + match s 0, s 1, s 2 with + | 0, 0, 4 => B1_3_4U0_0_4Leaf + | 0, 1, 3 => B1_3_4U0_1_3Leaf + | 0, 2, 2 => B1_3_4U0_2_2Leaf + | 0, 3, 1 => B1_3_4U0_3_1Leaf + | 1, 0, 3 => B1_3_4U1_0_3Leaf + | 1, 1, 2 => B1_3_4U1_1_2Leaf + | 1, 2, 1 => B1_3_4U1_2_1Leaf + | 1, 3, 0 => B1_3_4U1_3_0Leaf + | _, _, _ => (.exact 0) +lemma B1_3_4Leaves_sound (u : Shape) (hu : u ∈ below (shape 1 3 4)) : + (B1_3_4Leaves u).Encloses (AllFieldTerminalRates.secondLeafRate (shape 1 3 4) u) := by + rw [B1_3_4_below] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl + · exact B1_3_4U0_0_4Leaf_sound + · exact B1_3_4U0_1_3Leaf_sound + · exact B1_3_4U0_2_2Leaf_sound + · exact B1_3_4U0_3_1Leaf_sound + · exact B1_3_4U1_0_3Leaf_sound + · exact B1_3_4U1_1_2Leaf_sound + · exact B1_3_4U1_2_1Leaf_sound + · exact B1_3_4U1_3_0Leaf_sound +def B1_3_4Masses (s : Shape) : Ball := + match s 0, s 1, s 2 with + | 0, 0, 4 => B1_3_4U0_0_4Mass + | 0, 1, 3 => B1_3_4U0_1_3Mass + | 0, 2, 2 => B1_3_4U0_2_2Mass + | 0, 3, 1 => B1_3_4U0_3_1Mass + | 1, 0, 3 => B1_3_4U1_0_3Mass + | 1, 1, 2 => B1_3_4U1_1_2Mass + | 1, 2, 1 => B1_3_4U1_2_1Mass + | 1, 3, 0 => B1_3_4U1_3_0Mass + | _, _, _ => (.exact 0) +lemma B1_3_4Masses_sound (u : Shape) (hu : u ∈ below (shape 1 3 4)) : + (B1_3_4Masses u).Encloses ((fun u => (littleMass (shape 1 3 4) u : ℝ)) u) := by + rw [B1_3_4_below] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl + · exact B1_3_4U0_0_4Mass_sound + · exact B1_3_4U0_1_3Mass_sound + · exact B1_3_4U0_2_2Mass_sound + · exact B1_3_4U0_3_1Mass_sound + · exact B1_3_4U1_0_3Mass_sound + · exact B1_3_4U1_1_2Mass_sound + · exact B1_3_4U1_2_1Mass_sound + · exact B1_3_4U1_3_0Mass_sound +def B1_3_4Binaries (s : Shape) : Ball := + match s 0, s 1, s 2 with + | 0, 2, 2 => B1_3_4U0_2_2BinaryEntropy + | 1, 1, 2 => B1_3_4U1_1_2BinaryEntropy + | 1, 2, 1 => B1_3_4U1_2_1BinaryEntropy + | _, _, _ => (.exact 0) +lemma B1_3_4Binaries_sound (u : Shape) (hu : u ∈ (below (shape 1 3 4)).filter positive) : + (B1_3_4Binaries u).Encloses ((fun u => binaryEntropyRate (binaryParameter (shape 1 3 4) u)) u) := by + have hl : (below (shape 1 3 4)).filter positive = [(shape 1 1 2), (shape 1 2 1)] := by decide +kernel + rw [hl] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl + · exact B1_3_4U1_1_2BinaryEntropy_sound + · exact B1_3_4U1_2_1BinaryEntropy_sound +def B1_3_4S2 : Ball := ⟨(97325307607168493791537301136049 / 50000000000000000000000000000000), (4316662133 / 5000000000000000000000000000000)⟩ +lemma B1_3_4S2_sound : B1_3_4S2.Encloses + (((below (shape 1 3 4)).map fun u => (littleMass (shape 1 3 4) u : ℝ) * AllFieldTerminalRates.secondLeafRate (shape 1 3 4) u).sum) := by + exact contains_sound (listSumBall_sound (below (shape 1 3 4)) + (fun u => .mul (B1_3_4Masses u) (B1_3_4Leaves u)) _ + (fun u hu => Ball.mul_sound (B1_3_4Masses_sound u hu) (B1_3_4Leaves_sound u hu))) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/Certificates/Terminal1_4_3.lean b/lean/OAI/LinearAlgebra/MatrixFields/Certificates/Terminal1_4_3.lean new file mode 100644 index 0000000000000000000000000000000000000000..d0b022f7a925dff753dc714ed608a641c6ebc6b8 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/Certificates/Terminal1_4_3.lean @@ -0,0 +1,294 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Certificates.Terminal1_1_6 + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def B1_4_3U0_1_3Leaf : Ball := ⟨(115129254649702284200899544090987 / 50000000000000000000000000000000), (21175823683 / 25000000000000000000000000000000)⟩ +lemma B1_4_3U0_1_3Leaf_sound : B1_4_3U0_1_3Leaf.Encloses (AllFieldTerminalRates.secondLeafRate (shape 1 4 3) (shape 0 1 3)) := by + have hh : shapeMax (shape 0 1 3) = 3 := by decide +kernel + simp only [AllFieldTerminalRates.secondLeafRate, hh, show (3 : ℕ) ≠ 4 by decide, ite_false, ite_true] + exact logN10_sound +def B1_4_3U0_1_3Mass : Ball := ⟨(181419853805933728200300858261 / 50000000000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ +lemma B1_4_3U0_1_3Mass_sound : B1_4_3U0_1_3Mass.Encloses (littleMass (shape 1 4 3) (shape 0 1 3) : ℝ) := by + rw [littleMass_cast] + exact contains_sound (Ball.mul_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) (second_1_4_3)) + (B1_4_3Law_sound (shape 0 1 3))) (by decide +kernel) +def B1_4_3U0_2_2D : Ball := .exact (23901 / 250000) +lemma B1_4_3U0_2_2D_sound : B1_4_3U0_2_2D.Encloses (binaryParameter (shape 1 4 3) (shape 0 2 2) : ℝ) := by + apply exact_rat_enclosed + decide +kernel +def B1_4_3U0_2_2OneD : Ball := .exact (226099 / 250000) +lemma B1_4_3U0_2_2OneD_sound : B1_4_3U0_2_2OneD.Encloses (1 - (binaryParameter (shape 1 4 3) (shape 0 2 2) : ℝ)) := by + have he : binaryParameter (shape 1 4 3) (shape 0 2 2) = (23901 / 250000) := by decide +kernel + rw [he] + convert Ball.exact_sound ((226099 / 250000) : ℚ) using 1 <;> norm_num [B1_4_3U0_2_2OneD, Ball.exact] +def B1_4_3U0_2_2EDLogWitness : LogWitness := ⟨-4, 23901, 15625⟩ +def B1_4_3U0_2_2EDLog : Ball := ⟨(-234754061879590774959727984514419 / 100000000000000000000000000000000), (52939559207 / 50000000000000000000000000000000)⟩ +lemma B1_4_3U0_2_2EDLog_sound : B1_4_3U0_2_2EDLog.Encloses (Real.log ((binaryParameter (shape 1 4 3) (shape 0 2 2) : ℝ))) := by + exact checkLog_sound logTwoBall_sound (B1_4_3U0_2_2D_sound) (w := B1_4_3U0_2_2EDLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def B1_4_3U0_2_2ED : Ball := ⟨(22443427331936396449249834231517 / 100000000000000000000000000000000), (5061233619 / 50000000000000000000000000000000)⟩ +lemma B1_4_3U0_2_2ED_sound : B1_4_3U0_2_2ED.Encloses (Foundation.entropyTerm ((binaryParameter (shape 1 4 3) (shape 0 2 2) : ℝ))) := by + exact contains_sound (entropyTerm_ball (B1_4_3U0_2_2D_sound) B1_4_3U0_2_2EDLog_sound) (by decide +kernel) +def B1_4_3U0_2_2EOneDLogWitness : LogWitness := ⟨-1, 226099, 125000⟩ +def B1_4_3U0_2_2EOneDLog : Ball := ⟨(-2512199035246581498367078978841 / 25000000000000000000000000000000), (21175823683 / 50000000000000000000000000000000)⟩ +lemma B1_4_3U0_2_2EOneDLog_sound : B1_4_3U0_2_2EOneDLog.Encloses (Real.log ((1 - (binaryParameter (shape 1 4 3) (shape 0 2 2) : ℝ)))) := by + exact checkLog_sound logTwoBall_sound (B1_4_3U0_2_2OneD_sound) (w := B1_4_3U0_2_2EOneDLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def B1_4_3U0_2_2EOneD : Ball := ⟨(568005689670216830199298190037 / 6250000000000000000000000000000), (4787832559 / 12500000000000000000000000000000)⟩ +lemma B1_4_3U0_2_2EOneD_sound : B1_4_3U0_2_2EOneD.Encloses (Foundation.entropyTerm ((1 - (binaryParameter (shape 1 4 3) (shape 0 2 2) : ℝ)))) := by + exact contains_sound (entropyTerm_ball (B1_4_3U0_2_2OneD_sound) B1_4_3U0_2_2EOneDLog_sound) (by decide +kernel) +def B1_4_3U0_2_2BinaryEntropy : Ball := ⟨(38158282671685166868591109420493 / 100000000000000000000000000000000), (10494822921 / 20000000000000000000000000000000)⟩ +lemma B1_4_3U0_2_2BinaryEntropy_sound : B1_4_3U0_2_2BinaryEntropy.Encloses + (binaryEntropyRate (binaryParameter (shape 1 4 3) (shape 0 2 2))) := by + exact contains_sound (Ball.add_sound (Ball.add_sound B1_4_3U0_2_2EOneD_sound B1_4_3U0_2_2ED_sound) + (Ball.mul_sound B1_4_3U0_2_2D_sound logN2_sound)) (by decide +kernel) +def B1_4_3U0_2_2Leaf : Ball := ⟨(6585442494448705906921534158549 / 2000000000000000000000000000000), (8369104801 / 5000000000000000000000000000000)⟩ +lemma B1_4_3U0_2_2Leaf_sound : B1_4_3U0_2_2Leaf.Encloses (AllFieldTerminalRates.secondLeafRate (shape 1 4 3) (shape 0 2 2)) := by + have hh : shapeMax (shape 0 2 2) = 2 := by decide +kernel + have hp : positive (shape 0 2 2) = false := by decide +kernel + simp only [AllFieldTerminalRates.secondLeafRate, hh, hp, Bool.not_false, + show (2 : ℕ) ≠ 4 by decide, show (2 : ℕ) ≠ 3 by decide, ite_false, ite_true] + exact contains_sound (Ball.add_sound B1_4_3U0_2_2BinaryEntropy_sound + (Ball.mul_sound (Ball.mul_sound (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) + B1_4_3U0_2_2OneD_sound) logN5_sound)) (by decide +kernel) +def B1_4_3U0_2_2Mass : Ball := ⟨(12008393707958752871067573302183 / 100000000000000000000000000000000), (27 / 20000000000000000000000000000000)⟩ +lemma B1_4_3U0_2_2Mass_sound : B1_4_3U0_2_2Mass.Encloses (littleMass (shape 1 4 3) (shape 0 2 2) : ℝ) := by + rw [littleMass_cast] + exact contains_sound (Ball.mul_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) (second_1_4_3)) + (B1_4_3Law_sound (shape 0 2 2))) (by decide +kernel) +def B1_4_3U0_3_1Leaf : Ball := ⟨(115129254649702284200899544090987 / 50000000000000000000000000000000), (21175823683 / 25000000000000000000000000000000)⟩ +lemma B1_4_3U0_3_1Leaf_sound : B1_4_3U0_3_1Leaf.Encloses (AllFieldTerminalRates.secondLeafRate (shape 1 4 3) (shape 0 3 1)) := by + have hh : shapeMax (shape 0 3 1) = 3 := by decide +kernel + simp only [AllFieldTerminalRates.secondLeafRate, hh, show (3 : ℕ) ≠ 4 by decide, ite_false, ite_true] + exact logN10_sound +def B1_4_3U0_3_1Mass : Ball := ⟨(1880816292854954103757064512223 / 100000000000000000000000000000000), (3 / 12500000000000000000000000000000)⟩ +lemma B1_4_3U0_3_1Mass_sound : B1_4_3U0_3_1Mass.Encloses (littleMass (shape 1 4 3) (shape 0 3 1) : ℝ) := by + rw [littleMass_cast] + exact contains_sound (Ball.mul_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) (second_1_4_3)) + (B1_4_3Law_sound (shape 0 3 1))) (by decide +kernel) +def B1_4_3U0_4_0Leaf : Ball := ⟨0, 0⟩ +lemma B1_4_3U0_4_0Leaf_sound : B1_4_3U0_4_0Leaf.Encloses (AllFieldTerminalRates.secondLeafRate (shape 1 4 3) (shape 0 4 0)) := by + have hh : shapeMax (shape 0 4 0) = 4 := by decide +kernel + simp only [AllFieldTerminalRates.secondLeafRate, hh, ite_true] + simpa only [B1_4_3U0_4_0Leaf, Ball.exact, Rat.cast_zero] using Ball.exact_sound 0 +def B1_4_3U0_4_0Mass : Ball := ⟨(477318587058984464774530633 / 5000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ +lemma B1_4_3U0_4_0Mass_sound : B1_4_3U0_4_0Mass.Encloses (littleMass (shape 1 4 3) (shape 0 4 0) : ℝ) := by + rw [littleMass_cast] + exact contains_sound (Ball.mul_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) (second_1_4_3)) + (B1_4_3Law_sound (shape 0 4 0))) (by decide +kernel) +def B1_4_3U1_0_3Leaf : Ball := ⟨(115129254649702284200899544090987 / 50000000000000000000000000000000), (21175823683 / 25000000000000000000000000000000)⟩ +lemma B1_4_3U1_0_3Leaf_sound : B1_4_3U1_0_3Leaf.Encloses (AllFieldTerminalRates.secondLeafRate (shape 1 4 3) (shape 1 0 3)) := by + have hh : shapeMax (shape 1 0 3) = 3 := by decide +kernel + simp only [AllFieldTerminalRates.secondLeafRate, hh, show (3 : ℕ) ≠ 4 by decide, ite_false, ite_true] + exact logN10_sound +def B1_4_3U1_0_3Mass : Ball := ⟨(477318587058984464774530633 / 5000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ +lemma B1_4_3U1_0_3Mass_sound : B1_4_3U1_0_3Mass.Encloses (littleMass (shape 1 4 3) (shape 1 0 3) : ℝ) := by + rw [littleMass_cast] + exact contains_sound (Ball.mul_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) (second_1_4_3)) + (B1_4_3Law_sound (shape 1 0 3))) (by decide +kernel) +def B1_4_3U1_1_2D : Ball := .exact (41743 / 1000000) +lemma B1_4_3U1_1_2D_sound : B1_4_3U1_1_2D.Encloses (binaryParameter (shape 1 4 3) (shape 1 1 2) : ℝ) := by + apply exact_rat_enclosed + decide +kernel +def B1_4_3U1_1_2OneD : Ball := .exact (958257 / 1000000) +lemma B1_4_3U1_1_2OneD_sound : B1_4_3U1_1_2OneD.Encloses (1 - (binaryParameter (shape 1 4 3) (shape 1 1 2) : ℝ)) := by + have he : binaryParameter (shape 1 4 3) (shape 1 1 2) = (41743 / 1000000) := by decide +kernel + rw [he] + convert Ball.exact_sound ((958257 / 1000000) : ℚ) using 1 <;> norm_num [B1_4_3U1_1_2OneD, Ball.exact] +def B1_4_3U1_1_2EDLogWitness : LogWitness := ⟨-5, 41743, 31250⟩ +def B1_4_3U1_1_2EDLog : Ball := ⟨(-317622350641322343593845801674799 / 100000000000000000000000000000000), (127054942097 / 100000000000000000000000000000000)⟩ +lemma B1_4_3U1_1_2EDLog_sound : B1_4_3U1_1_2EDLog.Encloses (Real.log ((binaryParameter (shape 1 4 3) (shape 1 1 2) : ℝ))) := by + exact checkLog_sound logTwoBall_sound (B1_4_3U1_1_2D_sound) (w := B1_4_3U1_1_2EDLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def B1_4_3U1_1_2ED : Ball := ⟨(13258509782820718588637905299311 / 100000000000000000000000000000000), (5303654449 / 100000000000000000000000000000000)⟩ +lemma B1_4_3U1_1_2ED_sound : B1_4_3U1_1_2ED.Encloses (Foundation.entropyTerm ((binaryParameter (shape 1 4 3) (shape 1 1 2) : ℝ))) := by + exact contains_sound (entropyTerm_ball (B1_4_3U1_1_2D_sound) B1_4_3U1_1_2EDLog_sound) (by decide +kernel) +def B1_4_3U1_1_2EOneDLogWitness : LogWitness := ⟨-1, 958257, 500000⟩ +def B1_4_3U1_1_2EOneDLog : Ball := ⟨(-4263926976511183716334593201789 / 100000000000000000000000000000000), (21175823683 / 50000000000000000000000000000000)⟩ +lemma B1_4_3U1_1_2EOneDLog_sound : B1_4_3U1_1_2EOneDLog.Encloses (Real.log ((1 - (binaryParameter (shape 1 4 3) (shape 1 1 2) : ℝ)))) := by + exact checkLog_sound logTwoBall_sound (B1_4_3U1_1_2OneD_sound) (w := B1_4_3U1_1_2EOneDLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def B1_4_3U1_1_2EOneD : Ball := ⟨(4085937872730677374463638277767 / 100000000000000000000000000000000), (40583762551 / 100000000000000000000000000000000)⟩ +lemma B1_4_3U1_1_2EOneD_sound : B1_4_3U1_1_2EOneD.Encloses (Foundation.entropyTerm ((1 - (binaryParameter (shape 1 4 3) (shape 1 1 2) : ℝ)))) := by + exact contains_sound (entropyTerm_ball (B1_4_3U1_1_2OneD_sound) B1_4_3U1_1_2EOneDLog_sound) (by decide +kernel) +def B1_4_3U1_1_2BinaryEntropy : Ball := ⟨(10118925965681387834100947412289 / 50000000000000000000000000000000), (47655301817 / 100000000000000000000000000000000)⟩ +lemma B1_4_3U1_1_2BinaryEntropy_sound : B1_4_3U1_1_2BinaryEntropy.Encloses + (binaryEntropyRate (binaryParameter (shape 1 4 3) (shape 1 1 2))) := by + exact contains_sound (Ball.add_sound (Ball.add_sound B1_4_3U1_1_2EOneD_sound B1_4_3U1_1_2ED_sound) + (Ball.mul_sound B1_4_3U1_1_2D_sound logN2_sound)) (by decide +kernel) +def B1_4_3U1_1_2Leaf : Ball := ⟨(39396163226118301215806980271601 / 12500000000000000000000000000000), (995224919 / 800000000000000000000000000000)⟩ +lemma B1_4_3U1_1_2Leaf_sound : B1_4_3U1_1_2Leaf.Encloses (AllFieldTerminalRates.secondLeafRate (shape 1 4 3) (shape 1 1 2)) := by + have hh : shapeMax (shape 1 1 2) = 2 := by decide +kernel + have hp : positive (shape 1 1 2) = true := by decide +kernel + simp only [AllFieldTerminalRates.secondLeafRate, hh, hp, Bool.not_true, Bool.false_eq_true, + show (2 : ℕ) ≠ 4 by decide, show (2 : ℕ) ≠ 3 by decide, ite_false] + have ht : (Ball.exact (1958257 / 1000000)).Encloses (2 - (binaryParameter (shape 1 4 3) (shape 1 1 2) : ℝ)) := by + have he : binaryParameter (shape 1 4 3) (shape 1 1 2) = (41743 / 1000000) := by decide +kernel + rw [he] + convert Ball.exact_sound ((1958257 / 1000000) : ℚ) using 1 + norm_num [Ball.exact] + exact contains_sound (Ball.mul_sound ht logN5_sound) (by decide +kernel) +def B1_4_3U1_1_2Mass : Ball := ⟨(1880816292854954103757064512223 / 100000000000000000000000000000000), (3 / 12500000000000000000000000000000)⟩ +lemma B1_4_3U1_1_2Mass_sound : B1_4_3U1_1_2Mass.Encloses (littleMass (shape 1 4 3) (shape 1 1 2) : ℝ) := by + rw [littleMass_cast] + exact contains_sound (Ball.mul_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) (second_1_4_3)) + (B1_4_3Law_sound (shape 1 1 2))) (by decide +kernel) +def B1_4_3U1_2_1D : Ball := .exact (3057 / 1000000) +lemma B1_4_3U1_2_1D_sound : B1_4_3U1_2_1D.Encloses (binaryParameter (shape 1 4 3) (shape 1 2 1) : ℝ) := by + apply exact_rat_enclosed + decide +kernel +def B1_4_3U1_2_1OneD : Ball := .exact (996943 / 1000000) +lemma B1_4_3U1_2_1OneD_sound : B1_4_3U1_2_1OneD.Encloses (1 - (binaryParameter (shape 1 4 3) (shape 1 2 1) : ℝ)) := by + have he : binaryParameter (shape 1 4 3) (shape 1 2 1) = (3057 / 1000000) := by decide +kernel + rw [he] + convert Ball.exact_sound ((996943 / 1000000) : ℚ) using 1 <;> norm_num [B1_4_3U1_2_1OneD, Ball.exact] +def B1_4_3U1_2_1EDLogWitness : LogWitness := ⟨-9, 24456, 15625⟩ +def B1_4_3U1_2_1EDLog : Ball := ⟨(-579032123607343959922323580543109 / 100000000000000000000000000000000), (21175823683 / 10000000000000000000000000000000)⟩ +lemma B1_4_3U1_2_1EDLog_sound : B1_4_3U1_2_1EDLog.Encloses (Real.log ((binaryParameter (shape 1 4 3) (shape 1 2 1) : ℝ))) := by + exact checkLog_sound logTwoBall_sound (B1_4_3U1_2_1D_sound) (w := B1_4_3U1_2_1EDLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def B1_4_3U1_2_1ED : Ball := ⟨(44252530046691262137063579643 / 2500000000000000000000000000000), (647344931 / 100000000000000000000000000000000)⟩ +lemma B1_4_3U1_2_1ED_sound : B1_4_3U1_2_1ED.Encloses (Foundation.entropyTerm ((binaryParameter (shape 1 4 3) (shape 1 2 1) : ℝ))) := by + exact contains_sound (entropyTerm_ball (B1_4_3U1_2_1D_sound) B1_4_3U1_2_1EDLog_sound) (by decide +kernel) +def B1_4_3U1_2_1EOneDLogWitness : LogWitness := ⟨-1, 996943, 500000⟩ +def B1_4_3U1_2_1EOneDLog : Ball := ⟨(-76542054229892072811856966359 / 25000000000000000000000000000000), (21175823683 / 50000000000000000000000000000000)⟩ +lemma B1_4_3U1_2_1EOneDLog_sound : B1_4_3U1_2_1EOneDLog.Encloses (Real.log ((1 - (binaryParameter (shape 1 4 3) (shape 1 2 1) : ℝ)))) := by + exact checkLog_sound logTwoBall_sound (B1_4_3U1_2_1OneD_sound) (w := B1_4_3U1_2_1EOneDLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def B1_4_3U1_2_1EOneD : Ball := ⟨(305232260680445170981084478451 / 100000000000000000000000000000000), (42222178381 / 100000000000000000000000000000000)⟩ +lemma B1_4_3U1_2_1EOneD_sound : B1_4_3U1_2_1EOneD.Encloses (Foundation.entropyTerm ((1 - (binaryParameter (shape 1 4 3) (shape 1 2 1) : ℝ)))) := by + exact contains_sound (entropyTerm_ball (B1_4_3U1_2_1OneD_sound) B1_4_3U1_2_1EOneDLog_sound) (by decide +kernel) +def B1_4_3U1_2_1BinaryEntropy : Ball := ⟨(1143614277822635468776237732663 / 50000000000000000000000000000000), (42998992299 / 100000000000000000000000000000000)⟩ +lemma B1_4_3U1_2_1BinaryEntropy_sound : B1_4_3U1_2_1BinaryEntropy.Encloses + (binaryEntropyRate (binaryParameter (shape 1 4 3) (shape 1 2 1))) := by + exact contains_sound (Ball.add_sound (Ball.add_sound B1_4_3U1_2_1EOneD_sound B1_4_3U1_2_1ED_sound) + (Ball.mul_sound B1_4_3U1_2_1D_sound logN2_sound)) (by decide +kernel) +def B1_4_3U1_2_1Leaf : Ball := ⟨(321395577316988970435636338251871 / 100000000000000000000000000000000), (6343036931 / 5000000000000000000000000000000)⟩ +lemma B1_4_3U1_2_1Leaf_sound : B1_4_3U1_2_1Leaf.Encloses (AllFieldTerminalRates.secondLeafRate (shape 1 4 3) (shape 1 2 1)) := by + have hh : shapeMax (shape 1 2 1) = 2 := by decide +kernel + have hp : positive (shape 1 2 1) = true := by decide +kernel + simp only [AllFieldTerminalRates.secondLeafRate, hh, hp, Bool.not_true, Bool.false_eq_true, + show (2 : ℕ) ≠ 4 by decide, show (2 : ℕ) ≠ 3 by decide, ite_false] + have ht : (Ball.exact (1996943 / 1000000)).Encloses (2 - (binaryParameter (shape 1 4 3) (shape 1 2 1) : ℝ)) := by + have he : binaryParameter (shape 1 4 3) (shape 1 2 1) = (3057 / 1000000) := by decide +kernel + rw [he] + convert Ball.exact_sound ((1996943 / 1000000) : ℚ) using 1 + norm_num [Ball.exact] + exact contains_sound (Ball.mul_sound ht logN5_sound) (by decide +kernel) +def B1_4_3U1_2_1Mass : Ball := ⟨(12008393707958752871067573302183 / 100000000000000000000000000000000), (27 / 20000000000000000000000000000000)⟩ +lemma B1_4_3U1_2_1Mass_sound : B1_4_3U1_2_1Mass.Encloses (littleMass (shape 1 4 3) (shape 1 2 1) : ℝ) := by + rw [littleMass_cast] + exact contains_sound (Ball.mul_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) (second_1_4_3)) + (B1_4_3Law_sound (shape 1 2 1))) (by decide +kernel) +def B1_4_3U1_3_0Leaf : Ball := ⟨(115129254649702284200899544090987 / 50000000000000000000000000000000), (21175823683 / 25000000000000000000000000000000)⟩ +lemma B1_4_3U1_3_0Leaf_sound : B1_4_3U1_3_0Leaf.Encloses (AllFieldTerminalRates.secondLeafRate (shape 1 4 3) (shape 1 3 0)) := by + have hh : shapeMax (shape 1 3 0) = 3 := by decide +kernel + simp only [AllFieldTerminalRates.secondLeafRate, hh, show (3 : ℕ) ≠ 4 by decide, ite_false, ite_true] + exact logN10_sound +def B1_4_3U1_3_0Mass : Ball := ⟨(181419853805933728200300858261 / 50000000000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ +lemma B1_4_3U1_3_0Mass_sound : B1_4_3U1_3_0Mass.Encloses (littleMass (shape 1 4 3) (shape 1 3 0) : ℝ) := by + rw [littleMass_cast] + exact contains_sound (Ball.mul_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) (second_1_4_3)) + (B1_4_3Law_sound (shape 1 3 0))) (by decide +kernel) +def B1_4_3Leaves (s : Shape) : Ball := + match s 0, s 1, s 2 with + | 0, 1, 3 => B1_4_3U0_1_3Leaf + | 0, 2, 2 => B1_4_3U0_2_2Leaf + | 0, 3, 1 => B1_4_3U0_3_1Leaf + | 0, 4, 0 => B1_4_3U0_4_0Leaf + | 1, 0, 3 => B1_4_3U1_0_3Leaf + | 1, 1, 2 => B1_4_3U1_1_2Leaf + | 1, 2, 1 => B1_4_3U1_2_1Leaf + | 1, 3, 0 => B1_4_3U1_3_0Leaf + | _, _, _ => (.exact 0) +lemma B1_4_3Leaves_sound (u : Shape) (hu : u ∈ below (shape 1 4 3)) : + (B1_4_3Leaves u).Encloses (AllFieldTerminalRates.secondLeafRate (shape 1 4 3) u) := by + rw [B1_4_3_below] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl + · exact B1_4_3U0_1_3Leaf_sound + · exact B1_4_3U0_2_2Leaf_sound + · exact B1_4_3U0_3_1Leaf_sound + · exact B1_4_3U0_4_0Leaf_sound + · exact B1_4_3U1_0_3Leaf_sound + · exact B1_4_3U1_1_2Leaf_sound + · exact B1_4_3U1_2_1Leaf_sound + · exact B1_4_3U1_3_0Leaf_sound +def B1_4_3Masses (s : Shape) : Ball := + match s 0, s 1, s 2 with + | 0, 1, 3 => B1_4_3U0_1_3Mass + | 0, 2, 2 => B1_4_3U0_2_2Mass + | 0, 3, 1 => B1_4_3U0_3_1Mass + | 0, 4, 0 => B1_4_3U0_4_0Mass + | 1, 0, 3 => B1_4_3U1_0_3Mass + | 1, 1, 2 => B1_4_3U1_1_2Mass + | 1, 2, 1 => B1_4_3U1_2_1Mass + | 1, 3, 0 => B1_4_3U1_3_0Mass + | _, _, _ => (.exact 0) +lemma B1_4_3Masses_sound (u : Shape) (hu : u ∈ below (shape 1 4 3)) : + (B1_4_3Masses u).Encloses ((fun u => (littleMass (shape 1 4 3) u : ℝ)) u) := by + rw [B1_4_3_below] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl + · exact B1_4_3U0_1_3Mass_sound + · exact B1_4_3U0_2_2Mass_sound + · exact B1_4_3U0_3_1Mass_sound + · exact B1_4_3U0_4_0Mass_sound + · exact B1_4_3U1_0_3Mass_sound + · exact B1_4_3U1_1_2Mass_sound + · exact B1_4_3U1_2_1Mass_sound + · exact B1_4_3U1_3_0Mass_sound +def B1_4_3Binaries (s : Shape) : Ball := + match s 0, s 1, s 2 with + | 0, 2, 2 => B1_4_3U0_2_2BinaryEntropy + | 1, 1, 2 => B1_4_3U1_1_2BinaryEntropy + | 1, 2, 1 => B1_4_3U1_2_1BinaryEntropy + | _, _, _ => (.exact 0) +lemma B1_4_3Binaries_sound (u : Shape) (hu : u ∈ (below (shape 1 4 3)).filter positive) : + (B1_4_3Binaries u).Encloses ((fun u => binaryEntropyRate (binaryParameter (shape 1 4 3) u)) u) := by + have hl : (below (shape 1 4 3)).filter positive = [(shape 1 1 2), (shape 1 2 1)] := by decide +kernel + rw [hl] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl + · exact B1_4_3U1_1_2BinaryEntropy_sound + · exact B1_4_3U1_2_1BinaryEntropy_sound +def B1_4_3S2 : Ball := ⟨(45043077270396458956602823687649 / 50000000000000000000000000000000), (4986188371 / 12500000000000000000000000000000)⟩ +lemma B1_4_3S2_sound : B1_4_3S2.Encloses + (((below (shape 1 4 3)).map fun u => (littleMass (shape 1 4 3) u : ℝ) * AllFieldTerminalRates.secondLeafRate (shape 1 4 3) u).sum) := by + exact contains_sound (listSumBall_sound (below (shape 1 4 3)) + (fun u => .mul (B1_4_3Masses u) (B1_4_3Leaves u)) _ + (fun u hu => Ball.mul_sound (B1_4_3Masses_sound u hu) (B1_4_3Leaves_sound u hu))) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/Certificates/Terminal1_5_2.lean b/lean/OAI/LinearAlgebra/MatrixFields/Certificates/Terminal1_5_2.lean new file mode 100644 index 0000000000000000000000000000000000000000..06ebbb12b4622dc74e312022310ea5fec10cf1da --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/Certificates/Terminal1_5_2.lean @@ -0,0 +1,264 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Certificates.Terminal1_1_6 + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def B1_5_2U0_2_2D : Ball := .exact (109933 / 1000000) +lemma B1_5_2U0_2_2D_sound : B1_5_2U0_2_2D.Encloses (binaryParameter (shape 1 5 2) (shape 0 2 2) : ℝ) := by + apply exact_rat_enclosed + decide +kernel +def B1_5_2U0_2_2OneD : Ball := .exact (890067 / 1000000) +lemma B1_5_2U0_2_2OneD_sound : B1_5_2U0_2_2OneD.Encloses (1 - (binaryParameter (shape 1 5 2) (shape 0 2 2) : ℝ)) := by + have he : binaryParameter (shape 1 5 2) (shape 0 2 2) = (109933 / 1000000) := by decide +kernel + rw [he] + convert Ball.exact_sound ((890067 / 1000000) : ℚ) using 1 <;> norm_num [B1_5_2U0_2_2OneD, Ball.exact] +def B1_5_2U0_2_2EDLogWitness : LogWitness := ⟨-4, 109933, 62500⟩ +def B1_5_2U0_2_2EDLog : Ball := ⟨(-220788418967003649163974598210309 / 100000000000000000000000000000000), (21175823683 / 20000000000000000000000000000000)⟩ +lemma B1_5_2U0_2_2EDLog_sound : B1_5_2U0_2_2EDLog.Encloses (Real.log ((binaryParameter (shape 1 5 2) (shape 0 2 2) : ℝ))) := by + exact checkLog_sound logTwoBall_sound (B1_5_2U0_2_2D_sound) (w := B1_5_2U0_2_2EDLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def B1_5_2U0_2_2ED : Ball := ⟨(12135966631149806081771609752527 / 50000000000000000000000000000000), (93116873 / 800000000000000000000000000000)⟩ +lemma B1_5_2U0_2_2ED_sound : B1_5_2U0_2_2ED.Encloses (Foundation.entropyTerm ((binaryParameter (shape 1 5 2) (shape 0 2 2) : ℝ))) := by + exact contains_sound (entropyTerm_ball (B1_5_2U0_2_2D_sound) B1_5_2U0_2_2EDLog_sound) (by decide +kernel) +def B1_5_2U0_2_2EOneDLogWitness : LogWitness := ⟨-1, 890067, 500000⟩ +def B1_5_2U0_2_2EOneDLog : Ball := ⟨(-11645853819053979009096802094341 / 100000000000000000000000000000000), (8470329473 / 20000000000000000000000000000000)⟩ +lemma B1_5_2U0_2_2EOneDLog_sound : B1_5_2U0_2_2EOneDLog.Encloses (Real.log ((1 - (binaryParameter (shape 1 5 2) (shape 0 2 2) : ℝ)))) := by + exact checkLog_sound logTwoBall_sound (B1_5_2U0_2_2OneD_sound) (w := B1_5_2U0_2_2EOneDLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def B1_5_2U0_2_2EOneD : Ball := ⟨(1295698771395489741836220418713 / 12500000000000000000000000000000), (9423950929 / 25000000000000000000000000000000)⟩ +lemma B1_5_2U0_2_2EOneD_sound : B1_5_2U0_2_2EOneD.Encloses (Foundation.entropyTerm ((1 - (binaryParameter (shape 1 5 2) (shape 0 2 2) : ℝ)))) := by + exact contains_sound (entropyTerm_ball (B1_5_2U0_2_2OneD_sound) B1_5_2U0_2_2EOneDLog_sound) (by decide +kernel) +def B1_5_2U0_2_2BinaryEntropy : Ball := ⟨(1056437458337829421706235965909 / 2500000000000000000000000000000), (53991256491 / 100000000000000000000000000000000)⟩ +lemma B1_5_2U0_2_2BinaryEntropy_sound : B1_5_2U0_2_2BinaryEntropy.Encloses + (binaryEntropyRate (binaryParameter (shape 1 5 2) (shape 0 2 2))) := by + exact contains_sound (Ball.add_sound (Ball.add_sound B1_5_2U0_2_2EOneD_sound B1_5_2U0_2_2ED_sound) + (Ball.mul_sound B1_5_2U0_2_2D_sound logN2_sound)) (by decide +kernel) +def B1_5_2U0_2_2Leaf : Ball := ⟨(164379506607404830246102091070317 / 50000000000000000000000000000000), (4176966691 / 2500000000000000000000000000000)⟩ +lemma B1_5_2U0_2_2Leaf_sound : B1_5_2U0_2_2Leaf.Encloses (AllFieldTerminalRates.secondLeafRate (shape 1 5 2) (shape 0 2 2)) := by + have hh : shapeMax (shape 0 2 2) = 2 := by decide +kernel + have hp : positive (shape 0 2 2) = false := by decide +kernel + simp only [AllFieldTerminalRates.secondLeafRate, hh, hp, Bool.not_false, + show (2 : ℕ) ≠ 4 by decide, show (2 : ℕ) ≠ 3 by decide, ite_false, ite_true] + exact contains_sound (Ball.add_sound B1_5_2U0_2_2BinaryEntropy_sound + (Ball.mul_sound (Ball.mul_sound (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) + B1_5_2U0_2_2OneD_sound) logN5_sound)) (by decide +kernel) +def B1_5_2U0_2_2Mass : Ball := ⟨(27838926089202276630516723591 / 12500000000000000000000000000000), (1 / 20000000000000000000000000000000)⟩ +lemma B1_5_2U0_2_2Mass_sound : B1_5_2U0_2_2Mass.Encloses (littleMass (shape 1 5 2) (shape 0 2 2) : ℝ) := by + rw [littleMass_cast] + exact contains_sound (Ball.mul_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) (second_1_5_2)) + (B1_5_2Law_sound (shape 0 2 2))) (by decide +kernel) +def B1_5_2U0_3_1Leaf : Ball := ⟨(115129254649702284200899544090987 / 50000000000000000000000000000000), (21175823683 / 25000000000000000000000000000000)⟩ +lemma B1_5_2U0_3_1Leaf_sound : B1_5_2U0_3_1Leaf.Encloses (AllFieldTerminalRates.secondLeafRate (shape 1 5 2) (shape 0 3 1)) := by + have hh : shapeMax (shape 0 3 1) = 3 := by decide +kernel + simp only [AllFieldTerminalRates.secondLeafRate, hh, show (3 : ℕ) ≠ 4 by decide, ite_false, ite_true] + exact logN10_sound +def B1_5_2U0_3_1Mass : Ball := ⟨(394443851550199476968409845113 / 100000000000000000000000000000000), (1 / 12500000000000000000000000000000)⟩ +lemma B1_5_2U0_3_1Mass_sound : B1_5_2U0_3_1Mass.Encloses (littleMass (shape 1 5 2) (shape 0 3 1) : ℝ) := by + rw [littleMass_cast] + exact contains_sound (Ball.mul_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) (second_1_5_2)) + (B1_5_2Law_sound (shape 0 3 1))) (by decide +kernel) +def B1_5_2U0_4_0Leaf : Ball := ⟨0, 0⟩ +lemma B1_5_2U0_4_0Leaf_sound : B1_5_2U0_4_0Leaf.Encloses (AllFieldTerminalRates.secondLeafRate (shape 1 5 2) (shape 0 4 0)) := by + have hh : shapeMax (shape 0 4 0) = 4 := by decide +kernel + simp only [AllFieldTerminalRates.secondLeafRate, hh, ite_true] + simpa only [B1_5_2U0_4_0Leaf, Ball.exact, Rat.cast_zero] using Ball.exact_sound 0 +def B1_5_2U0_4_0Mass : Ball := ⟨(4456348111125662593963668059 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ +lemma B1_5_2U0_4_0Mass_sound : B1_5_2U0_4_0Mass.Encloses (littleMass (shape 1 5 2) (shape 0 4 0) : ℝ) := by + rw [littleMass_cast] + exact contains_sound (Ball.mul_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) (second_1_5_2)) + (B1_5_2Law_sound (shape 0 4 0))) (by decide +kernel) +def B1_5_2U1_1_2D : Ball := .exact (10523 / 250000) +lemma B1_5_2U1_1_2D_sound : B1_5_2U1_1_2D.Encloses (binaryParameter (shape 1 5 2) (shape 1 1 2) : ℝ) := by + apply exact_rat_enclosed + decide +kernel +def B1_5_2U1_1_2OneD : Ball := .exact (239477 / 250000) +lemma B1_5_2U1_1_2OneD_sound : B1_5_2U1_1_2OneD.Encloses (1 - (binaryParameter (shape 1 5 2) (shape 1 1 2) : ℝ)) := by + have he : binaryParameter (shape 1 5 2) (shape 1 1 2) = (10523 / 250000) := by decide +kernel + rw [he] + convert Ball.exact_sound ((239477 / 250000) : ℚ) using 1 <;> norm_num [B1_5_2U1_1_2OneD, Ball.exact] +def B1_5_2U1_1_2EDLogWitness : LogWitness := ⟨-5, 21046, 15625⟩ +def B1_5_2U1_1_2EDLog : Ball := ⟨(-15839487900517856513979567611963 / 5000000000000000000000000000000), (127054942097 / 100000000000000000000000000000000)⟩ +lemma B1_5_2U1_1_2EDLog_sound : B1_5_2U1_1_2EDLog.Encloses (Real.log ((binaryParameter (shape 1 5 2) (shape 1 1 2) : ℝ))) := by + exact checkLog_sound logTwoBall_sound (B1_5_2U1_1_2D_sound) (w := B1_5_2U1_1_2EDLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def B1_5_2U1_1_2ED : Ball := ⟨(2666862898834390465545711839691 / 20000000000000000000000000000000), (5347996623 / 100000000000000000000000000000000)⟩ +lemma B1_5_2U1_1_2ED_sound : B1_5_2U1_1_2ED.Encloses (Foundation.entropyTerm ((binaryParameter (shape 1 5 2) (shape 1 1 2) : ℝ))) := by + exact contains_sound (entropyTerm_ball (B1_5_2U1_1_2D_sound) B1_5_2U1_1_2EDLog_sound) (by decide +kernel) +def B1_5_2U1_1_2EOneDLogWitness : LogWitness := ⟨-1, 239477, 125000⟩ +def B1_5_2U1_1_2EOneDLog : Ball := ⟨(-537544237821271786708674943729 / 12500000000000000000000000000000), (21175823683 / 50000000000000000000000000000000)⟩ +lemma B1_5_2U1_1_2EOneDLog_sound : B1_5_2U1_1_2EOneDLog.Encloses (Real.log ((1 - (binaryParameter (shape 1 5 2) (shape 1 1 2) : ℝ)))) := by + exact checkLog_sound logTwoBall_sound (B1_5_2U1_1_2OneD_sound) (w := B1_5_2U1_1_2EOneDLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def B1_5_2U1_1_2EOneD : Ball := ⟨(205967170305159525865013359199 / 5000000000000000000000000000000), (20284490913 / 50000000000000000000000000000000)⟩ +lemma B1_5_2U1_1_2EOneD_sound : B1_5_2U1_1_2EOneD.Encloses (Foundation.entropyTerm ((1 - (binaryParameter (shape 1 5 2) (shape 1 1 2) : ℝ)))) := by + exact contains_sound (entropyTerm_ball (B1_5_2U1_1_2OneD_sound) B1_5_2U1_1_2EOneDLog_sound) (by decide +kernel) +def B1_5_2U1_1_2BinaryEntropy : Ball := ⟨(20371253012688064641427839024309 / 100000000000000000000000000000000), (47699643991 / 100000000000000000000000000000000)⟩ +lemma B1_5_2U1_1_2BinaryEntropy_sound : B1_5_2U1_1_2BinaryEntropy.Encloses + (binaryEntropyRate (binaryParameter (shape 1 5 2) (shape 1 1 2))) := by + exact contains_sound (Ball.add_sound (Ball.add_sound B1_5_2U1_1_2EOneD_sound B1_5_2U1_1_2ED_sound) + (Ball.mul_sound B1_5_2U1_1_2D_sound logN2_sound)) (by decide +kernel) +def B1_5_2U1_1_2Leaf : Ball := ⟨(315113136425802459623382275685407 / 100000000000000000000000000000000), (124380943787 / 100000000000000000000000000000000)⟩ +lemma B1_5_2U1_1_2Leaf_sound : B1_5_2U1_1_2Leaf.Encloses (AllFieldTerminalRates.secondLeafRate (shape 1 5 2) (shape 1 1 2)) := by + have hh : shapeMax (shape 1 1 2) = 2 := by decide +kernel + have hp : positive (shape 1 1 2) = true := by decide +kernel + simp only [AllFieldTerminalRates.secondLeafRate, hh, hp, Bool.not_true, Bool.false_eq_true, + show (2 : ℕ) ≠ 4 by decide, show (2 : ℕ) ≠ 3 by decide, ite_false] + have ht : (Ball.exact (489477 / 250000)).Encloses (2 - (binaryParameter (shape 1 5 2) (shape 1 1 2) : ℝ)) := by + have he : binaryParameter (shape 1 5 2) (shape 1 1 2) = (10523 / 250000) := by decide +kernel + rw [he] + convert Ball.exact_sound ((489477 / 250000) : ℚ) using 1 + norm_num [Ball.exact] + exact contains_sound (Ball.mul_sound ht logN5_sound) (by decide +kernel) +def B1_5_2U1_1_2Mass : Ball := ⟨(4456348111125662593963668059 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ +lemma B1_5_2U1_1_2Mass_sound : B1_5_2U1_1_2Mass.Encloses (littleMass (shape 1 5 2) (shape 1 1 2) : ℝ) := by + rw [littleMass_cast] + exact contains_sound (Ball.mul_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) (second_1_5_2)) + (B1_5_2Law_sound (shape 1 1 2))) (by decide +kernel) +def B1_5_2U1_2_1D : Ball := .exact (3747 / 1000000) +lemma B1_5_2U1_2_1D_sound : B1_5_2U1_2_1D.Encloses (binaryParameter (shape 1 5 2) (shape 1 2 1) : ℝ) := by + apply exact_rat_enclosed + decide +kernel +def B1_5_2U1_2_1OneD : Ball := .exact (996253 / 1000000) +lemma B1_5_2U1_2_1OneD_sound : B1_5_2U1_2_1OneD.Encloses (1 - (binaryParameter (shape 1 5 2) (shape 1 2 1) : ℝ)) := by + have he : binaryParameter (shape 1 5 2) (shape 1 2 1) = (3747 / 1000000) := by decide +kernel + rw [he] + convert Ball.exact_sound ((996253 / 1000000) : ℚ) using 1 <;> norm_num [B1_5_2U1_2_1OneD, Ball.exact] +def B1_5_2U1_2_1EDLogWitness : LogWitness := ⟨-9, 29976, 15625⟩ +def B1_5_2U1_2_1EDLog : Ball := ⟨(-1745874924740808355355881138477 / 312500000000000000000000000000), (21175823683 / 10000000000000000000000000000000)⟩ +lemma B1_5_2U1_2_1EDLog_sound : B1_5_2U1_2_1EDLog.Encloses (Real.log ((binaryParameter (shape 1 5 2) (shape 1 2 1) : ℝ))) := by + exact checkLog_sound logTwoBall_sound (B1_5_2U1_2_1D_sound) (w := B1_5_2U1_2_1EDLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def B1_5_2U1_2_1ED : Ball := ⟨(2093373869761218850405915720279 / 100000000000000000000000000000000), (396729057 / 50000000000000000000000000000000)⟩ +lemma B1_5_2U1_2_1ED_sound : B1_5_2U1_2_1ED.Encloses (Foundation.entropyTerm ((binaryParameter (shape 1 5 2) (shape 1 2 1) : ℝ))) := by + exact contains_sound (entropyTerm_ball (B1_5_2U1_2_1D_sound) B1_5_2U1_2_1EDLog_sound) (by decide +kernel) +def B1_5_2U1_2_1EOneDLogWitness : LogWitness := ⟨-1, 996253, 500000⟩ +def B1_5_2U1_2_1EOneDLog : Ball := ⟨(-750807517979978009641163873 / 200000000000000000000000000000), (21175823683 / 50000000000000000000000000000000)⟩ +lemma B1_5_2U1_2_1EOneDLog_sound : B1_5_2U1_2_1EOneDLog.Encloses (Real.log ((1 - (binaryParameter (shape 1 5 2) (shape 1 2 1) : ℝ)))) := by + exact checkLog_sound logTwoBall_sound (B1_5_2U1_2_1OneD_sound) (w := B1_5_2U1_2_1EOneDLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def B1_5_2U1_2_1EOneD : Ball := ⟨(23374820069065844751219950999 / 6250000000000000000000000000000), (1318529867 / 3125000000000000000000000000000)⟩ +lemma B1_5_2U1_2_1EOneD_sound : B1_5_2U1_2_1EOneD.Encloses (Foundation.entropyTerm ((1 - (binaryParameter (shape 1 5 2) (shape 1 2 1) : ℝ)))) := by + exact contains_sound (entropyTerm_ball (B1_5_2U1_2_1OneD_sound) B1_5_2U1_2_1EOneDLog_sound) (by decide +kernel) +def B1_5_2U1_2_1BinaryEntropy : Ball := ⟨(2727093239422083873864071740623 / 100000000000000000000000000000000), (21572552741 / 50000000000000000000000000000000)⟩ +lemma B1_5_2U1_2_1BinaryEntropy_sound : B1_5_2U1_2_1BinaryEntropy.Encloses + (binaryEntropyRate (binaryParameter (shape 1 5 2) (shape 1 2 1))) := by + exact contains_sound (Ball.add_sound (Ball.add_sound B1_5_2U1_2_1EOneD_sound B1_5_2U1_2_1ED_sound) + (Ball.mul_sound B1_5_2U1_2_1D_sound logN2_sound)) (by decide +kernel) +def B1_5_2U1_2_1Leaf : Ball := ⟨(32128452610103101750978888588423 / 10000000000000000000000000000000), (25363380933 / 20000000000000000000000000000000)⟩ +lemma B1_5_2U1_2_1Leaf_sound : B1_5_2U1_2_1Leaf.Encloses (AllFieldTerminalRates.secondLeafRate (shape 1 5 2) (shape 1 2 1)) := by + have hh : shapeMax (shape 1 2 1) = 2 := by decide +kernel + have hp : positive (shape 1 2 1) = true := by decide +kernel + simp only [AllFieldTerminalRates.secondLeafRate, hh, hp, Bool.not_true, Bool.false_eq_true, + show (2 : ℕ) ≠ 4 by decide, show (2 : ℕ) ≠ 3 by decide, ite_false] + have ht : (Ball.exact (1996253 / 1000000)).Encloses (2 - (binaryParameter (shape 1 5 2) (shape 1 2 1) : ℝ)) := by + have he : binaryParameter (shape 1 5 2) (shape 1 2 1) = (3747 / 1000000) := by decide +kernel + rw [he] + convert Ball.exact_sound ((1996253 / 1000000) : ℚ) using 1 + norm_num [Ball.exact] + exact contains_sound (Ball.mul_sound ht logN5_sound) (by decide +kernel) +def B1_5_2U1_2_1Mass : Ball := ⟨(394443851550199476968409845113 / 100000000000000000000000000000000), (1 / 12500000000000000000000000000000)⟩ +lemma B1_5_2U1_2_1Mass_sound : B1_5_2U1_2_1Mass.Encloses (littleMass (shape 1 5 2) (shape 1 2 1) : ℝ) := by + rw [littleMass_cast] + exact contains_sound (Ball.mul_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) (second_1_5_2)) + (B1_5_2Law_sound (shape 1 2 1))) (by decide +kernel) +def B1_5_2U1_3_0Leaf : Ball := ⟨(115129254649702284200899544090987 / 50000000000000000000000000000000), (21175823683 / 25000000000000000000000000000000)⟩ +lemma B1_5_2U1_3_0Leaf_sound : B1_5_2U1_3_0Leaf.Encloses (AllFieldTerminalRates.secondLeafRate (shape 1 5 2) (shape 1 3 0)) := by + have hh : shapeMax (shape 1 3 0) = 3 := by decide +kernel + simp only [AllFieldTerminalRates.secondLeafRate, hh, show (3 : ℕ) ≠ 4 by decide, ite_false, ite_true] + exact logN10_sound +def B1_5_2U1_3_0Mass : Ball := ⟨(27838926089202276630516723591 / 12500000000000000000000000000000), (1 / 20000000000000000000000000000000)⟩ +lemma B1_5_2U1_3_0Mass_sound : B1_5_2U1_3_0Mass.Encloses (littleMass (shape 1 5 2) (shape 1 3 0) : ℝ) := by + rw [littleMass_cast] + exact contains_sound (Ball.mul_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) (second_1_5_2)) + (B1_5_2Law_sound (shape 1 3 0))) (by decide +kernel) +def B1_5_2Leaves (s : Shape) : Ball := + match s 0, s 1, s 2 with + | 0, 2, 2 => B1_5_2U0_2_2Leaf + | 0, 3, 1 => B1_5_2U0_3_1Leaf + | 0, 4, 0 => B1_5_2U0_4_0Leaf + | 1, 1, 2 => B1_5_2U1_1_2Leaf + | 1, 2, 1 => B1_5_2U1_2_1Leaf + | 1, 3, 0 => B1_5_2U1_3_0Leaf + | _, _, _ => (.exact 0) +lemma B1_5_2Leaves_sound (u : Shape) (hu : u ∈ below (shape 1 5 2)) : + (B1_5_2Leaves u).Encloses (AllFieldTerminalRates.secondLeafRate (shape 1 5 2) u) := by + rw [B1_5_2_below] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl | rfl | rfl + · exact B1_5_2U0_2_2Leaf_sound + · exact B1_5_2U0_3_1Leaf_sound + · exact B1_5_2U0_4_0Leaf_sound + · exact B1_5_2U1_1_2Leaf_sound + · exact B1_5_2U1_2_1Leaf_sound + · exact B1_5_2U1_3_0Leaf_sound +def B1_5_2Masses (s : Shape) : Ball := + match s 0, s 1, s 2 with + | 0, 2, 2 => B1_5_2U0_2_2Mass + | 0, 3, 1 => B1_5_2U0_3_1Mass + | 0, 4, 0 => B1_5_2U0_4_0Mass + | 1, 1, 2 => B1_5_2U1_1_2Mass + | 1, 2, 1 => B1_5_2U1_2_1Mass + | 1, 3, 0 => B1_5_2U1_3_0Mass + | _, _, _ => (.exact 0) +lemma B1_5_2Masses_sound (u : Shape) (hu : u ∈ below (shape 1 5 2)) : + (B1_5_2Masses u).Encloses ((fun u => (littleMass (shape 1 5 2) u : ℝ)) u) := by + rw [B1_5_2_below] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl | rfl | rfl + · exact B1_5_2U0_2_2Mass_sound + · exact B1_5_2U0_3_1Mass_sound + · exact B1_5_2U0_4_0Mass_sound + · exact B1_5_2U1_1_2Mass_sound + · exact B1_5_2U1_2_1Mass_sound + · exact B1_5_2U1_3_0Mass_sound +def B1_5_2Binaries (s : Shape) : Ball := + match s 0, s 1, s 2 with + | 0, 2, 2 => B1_5_2U0_2_2BinaryEntropy + | 1, 1, 2 => B1_5_2U1_1_2BinaryEntropy + | 1, 2, 1 => B1_5_2U1_2_1BinaryEntropy + | _, _, _ => (.exact 0) +lemma B1_5_2Binaries_sound (u : Shape) (hu : u ∈ (below (shape 1 5 2)).filter positive) : + (B1_5_2Binaries u).Encloses ((fun u => binaryEntropyRate (binaryParameter (shape 1 5 2) u)) u) := by + have hl : (below (shape 1 5 2)).filter positive = [(shape 1 1 2), (shape 1 2 1)] := by decide +kernel + rw [hl] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl + · exact B1_5_2U1_1_2BinaryEntropy_sound + · exact B1_5_2U1_2_1BinaryEntropy_sound +def B1_5_2S2 : Ball := ⟨(3448608467743772816283012723469 / 100000000000000000000000000000000), (351540337 / 25000000000000000000000000000000)⟩ +lemma B1_5_2S2_sound : B1_5_2S2.Encloses + (((below (shape 1 5 2)).map fun u => (littleMass (shape 1 5 2) u : ℝ) * AllFieldTerminalRates.secondLeafRate (shape 1 5 2) u).sum) := by + exact contains_sound (listSumBall_sound (below (shape 1 5 2)) + (fun u => .mul (B1_5_2Masses u) (B1_5_2Leaves u)) _ + (fun u hu => Ball.mul_sound (B1_5_2Masses_sound u hu) (B1_5_2Leaves_sound u hu))) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/Certificates/Terminal1_6_1.lean b/lean/OAI/LinearAlgebra/MatrixFields/Certificates/Terminal1_6_1.lean new file mode 100644 index 0000000000000000000000000000000000000000..eebf124ce7ad618231de0d80e67ad4dd5dee7c0d --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/Certificates/Terminal1_6_1.lean @@ -0,0 +1,406 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Certificates.LittleB1_3_4 +import OAI.LinearAlgebra.MatrixFields.Certificates.Terminal1_1_6 + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate +open scoped BigOperators +lemma B1_6_1_below : below (shape 1 6 1) = [ + (shape 0 3 1), + (shape 0 4 0), + (shape 1 2 1), + (shape 1 3 0)] := by decide +kernel +def B1_6_1Raw (s : Shape) : Ball := + match s 0, s 1, s 2 with + | 0, 3, 1 => ⟨1, 0⟩ + | 0, 4, 0 => ⟨(7768490128715345018830058107081 / 25000000000000000000000000000000), (43 / 100000000000000000000000000000000)⟩ + | 1, 2, 1 => ⟨(7768490128715345018830058107081 / 25000000000000000000000000000000), (43 / 100000000000000000000000000000000)⟩ + | 1, 3, 0 => ⟨1, 0⟩ + | _, _, _ => (.exact 0) +lemma B1_6_1Raw_0_3_1 : (B1_6_1Raw (shape 0 3 1)).Encloses (splitWeight positiveSecond tablep (shape 1 6 1) (shape 0 3 1) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveSecond tablep (shape 1 6 1) (shape 0 3 1) + (0) (0) (0) w195 w195 w195 + (by decide +kernel) w195_sound w195_sound w195_sound) (by decide +kernel) +lemma B1_6_1Raw_0_4_0 : (B1_6_1Raw (shape 0 4 0)).Encloses (splitWeight positiveSecond tablep (shape 1 6 1) (shape 0 4 0) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveSecond tablep (shape 1 6 1) (shape 0 4 0) + (0) (-11688) (0) w195 w124 w195 + (by decide +kernel) w195_sound w124_sound w195_sound) (by decide +kernel) +lemma B1_6_1Raw_1_2_1 : (B1_6_1Raw (shape 1 2 1)).Encloses (splitWeight positiveSecond tablep (shape 1 6 1) (shape 1 2 1) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveSecond tablep (shape 1 6 1) (shape 1 2 1) + (0) (-11688) (0) w195 w124 w195 + (by decide +kernel) w195_sound w124_sound w195_sound) (by decide +kernel) +lemma B1_6_1Raw_1_3_0 : (B1_6_1Raw (shape 1 3 0)).Encloses (splitWeight positiveSecond tablep (shape 1 6 1) (shape 1 3 0) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveSecond tablep (shape 1 6 1) (shape 1 3 0) + (0) (0) (0) w195 w195 w195 + (by decide +kernel) w195_sound w195_sound w195_sound) (by decide +kernel) +lemma B1_6_1Raw_sound (u : Shape) (hu : u ∈ below (shape 1 6 1)) : + (B1_6_1Raw u).Encloses (splitWeight positiveSecond tablep (shape 1 6 1) u : ℝ) := by + rw [B1_6_1_below] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl + · exact B1_6_1Raw_0_3_1 + · exact B1_6_1Raw_0_4_0 + · exact B1_6_1Raw_1_2_1 + · exact B1_6_1Raw_1_3_0 +def B1_6_1Den : Ball := ⟨(32768490128715345018830058107081 / 12500000000000000000000000000000), (43 / 50000000000000000000000000000000)⟩ +lemma B1_6_1Den_sound : B1_6_1Den.Encloses (((below (shape 1 6 1)).map (splitWeight positiveSecond tablep (shape 1 6 1))).sum : ℝ) := by + exact contains_sound (list_cast_enclosed (below (shape 1 6 1)) B1_6_1Raw (splitWeight positiveSecond tablep (shape 1 6 1)) B1_6_1Raw_sound) (by decide +kernel) +lemma B1_6_1Den_positive : 0 < B1_6_1Den.lower := by decide +kernel +def B1_6_1Table (s : Shape) : Ball := + match s 0, s 1, s 2 with + | 0, 3, 1 => ⟨(476830025998288559780831570863 / 1250000000000000000000000000000), (13 / 100000000000000000000000000000000)⟩ + | 0, 4, 0 => ⟨(148169974001711440219168429137 / 1250000000000000000000000000000), (21 / 100000000000000000000000000000000)⟩ + | 1, 2, 1 => ⟨(148169974001711440219168429137 / 1250000000000000000000000000000), (21 / 100000000000000000000000000000000)⟩ + | 1, 3, 0 => ⟨(476830025998288559780831570863 / 1250000000000000000000000000000), (13 / 100000000000000000000000000000000)⟩ + | _, _, _ => (.exact 0) +def B1_6_1Law (u : Shape) : Ball := if u ∈ below (shape 1 6 1) then B1_6_1Table u else .exact 0 +lemma B1_6_1Law_check_0_3_1 : contains (.mul (B1_6_1Raw (shape 0 3 1)) (.inv B1_6_1Den)) (B1_6_1Table (shape 0 3 1)) = true := by decide +kernel +lemma B1_6_1Law_check_0_4_0 : contains (.mul (B1_6_1Raw (shape 0 4 0)) (.inv B1_6_1Den)) (B1_6_1Table (shape 0 4 0)) = true := by decide +kernel +lemma B1_6_1Law_check_1_2_1 : contains (.mul (B1_6_1Raw (shape 1 2 1)) (.inv B1_6_1Den)) (B1_6_1Table (shape 1 2 1)) = true := by decide +kernel +lemma B1_6_1Law_check_1_3_0 : contains (.mul (B1_6_1Raw (shape 1 3 0)) (.inv B1_6_1Den)) (B1_6_1Table (shape 1 3 0)) = true := by decide +kernel +lemma B1_6_1Law_check (u : Shape) (hu : u ∈ below (shape 1 6 1)) : + contains (.mul (B1_6_1Raw u) (.inv B1_6_1Den)) (B1_6_1Table u) = true := by + rw [B1_6_1_below] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl + · exact B1_6_1Law_check_0_3_1 + · exact B1_6_1Law_check_0_4_0 + · exact B1_6_1Law_check_1_2_1 + · exact B1_6_1Law_check_1_3_0 +lemma B1_6_1Law_sound (u : Shape) : + (B1_6_1Law u).Encloses (stageBLaw (shape 1 6 1) u : ℝ) := by + by_cases hu : u ∈ below (shape 1 6 1) + · have h := contains_sound (Ball.mul_sound (B1_6_1Raw_sound u hu) + (Ball.inv_sound B1_6_1Den_sound B1_6_1Den_positive)) (B1_6_1Law_check u hu) + simpa only [B1_6_1Law, hu, ite_true, stageBLaw, splitLaw, + Rat.cast_div, Rat.cast_mul, Rat.cast_inv, div_eq_mul_inv] using h + · simp only [B1_6_1Law, hu, ite_false, stageBLaw, splitLaw, Rat.cast_zero] + simpa only [Rat.cast_zero] using Ball.exact_sound 0 + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def B1_6_1Binary (u : Shape) : ℚ := + match u 0, u 1, u 2 with + | 1, 2, 1 => (41991 / 1000000) + | _, _, _ => 0 +lemma B1_6_1Binary_eq (u : Shape) (hu : u ∈ shapes 4) : + binaryParameter (shape 1 6 1) u = B1_6_1Binary u := by + rw [shapes4_list] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel +def B1_6_1LittleRat (u : Shape) (w : Fin 3) (i : Fin 6) : ℚ := + if u w = 2 then + if i = 2 then 1 - B1_6_1Binary u else if i = 3 then B1_6_1Binary u else 0 + else if i = singletonSlot (u w) then 1 else 0 + +def B1_6_1Little (u : Shape) (w : Fin 3) (i : Fin 6) : Ball := + if u ∈ shapes 4 then .exact (B1_6_1LittleRat u w i) + else .exact (littleLaw (shape 1 6 1) u w i) + +lemma B1_6_1Little_sound (u : Shape) (w : Fin 3) (i : Fin 6) : + (B1_6_1Little u w i).Encloses (littleLaw (shape 1 6 1) u w i : ℝ) := by + by_cases hu : u ∈ shapes 4 + · simp only [B1_6_1Little, hu, ite_true] + apply exact_rat_enclosed + simp only [B1_6_1LittleRat, littleLaw, B1_6_1Binary_eq u hu] + · simp only [B1_6_1Little, hu, ite_false] + exact Ball.exact_sound _ +def B1_6_1Half (w : Fin 3) (ij : PairSlot) : Ball := + match w.val, ij.1.val, ij.2.val with + | 0, 0, 1 => ⟨(1 / 2), (17 / 50000000000000000000000000000000)⟩ + | 0, 1, 0 => ⟨(1 / 2), (17 / 50000000000000000000000000000000)⟩ + | 1, 4, 4 => ⟨(476830025998288559780831570863 / 625000000000000000000000000000), (13 / 50000000000000000000000000000000)⟩ + | 1, 5, 2 => ⟨(11355853489872446010634026210329 / 100000000000000000000000000000000), (21 / 100000000000000000000000000000000)⟩ + | 1, 5, 3 => ⟨(497744430264469206899448120631 / 100000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ + | 1, 2, 5 => ⟨(11355853489872446010634026210329 / 100000000000000000000000000000000), (21 / 100000000000000000000000000000000)⟩ + | 1, 3, 5 => ⟨(497744430264469206899448120631 / 100000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ + | 2, 1, 0 => ⟨(1 / 2), (17 / 50000000000000000000000000000000)⟩ + | 2, 0, 1 => ⟨(1 / 2), (17 / 50000000000000000000000000000000)⟩ + | _, _, _ => (.exact 0) +lemma B1_6_1Half_check_0_0 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 1 6 1)) (shape 1 6 1) B1_6_1Law + (fun u => B1_6_1Little u 0) ((0 : Fin 6),j)) (B1_6_1Half 0 (0,j)) = true := by + decide +kernel +lemma B1_6_1Half_check_0_1 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 1 6 1)) (shape 1 6 1) B1_6_1Law + (fun u => B1_6_1Little u 0) ((1 : Fin 6),j)) (B1_6_1Half 0 (1,j)) = true := by + decide +kernel +lemma B1_6_1Half_check_0_2 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 1 6 1)) (shape 1 6 1) B1_6_1Law + (fun u => B1_6_1Little u 0) ((2 : Fin 6),j)) (B1_6_1Half 0 (2,j)) = true := by + decide +kernel +lemma B1_6_1Half_check_0_3 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 1 6 1)) (shape 1 6 1) B1_6_1Law + (fun u => B1_6_1Little u 0) ((3 : Fin 6),j)) (B1_6_1Half 0 (3,j)) = true := by + decide +kernel +lemma B1_6_1Half_check_0_4 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 1 6 1)) (shape 1 6 1) B1_6_1Law + (fun u => B1_6_1Little u 0) ((4 : Fin 6),j)) (B1_6_1Half 0 (4,j)) = true := by + decide +kernel +lemma B1_6_1Half_check_0_5 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 1 6 1)) (shape 1 6 1) B1_6_1Law + (fun u => B1_6_1Little u 0) ((5 : Fin 6),j)) (B1_6_1Half 0 (5,j)) = true := by + decide +kernel +lemma B1_6_1Half_check_1_0 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 1 6 1)) (shape 1 6 1) B1_6_1Law + (fun u => B1_6_1Little u 1) ((0 : Fin 6),j)) (B1_6_1Half 1 (0,j)) = true := by + decide +kernel +lemma B1_6_1Half_check_1_1 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 1 6 1)) (shape 1 6 1) B1_6_1Law + (fun u => B1_6_1Little u 1) ((1 : Fin 6),j)) (B1_6_1Half 1 (1,j)) = true := by + decide +kernel +lemma B1_6_1Half_check_1_2 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 1 6 1)) (shape 1 6 1) B1_6_1Law + (fun u => B1_6_1Little u 1) ((2 : Fin 6),j)) (B1_6_1Half 1 (2,j)) = true := by + decide +kernel +lemma B1_6_1Half_check_1_3 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 1 6 1)) (shape 1 6 1) B1_6_1Law + (fun u => B1_6_1Little u 1) ((3 : Fin 6),j)) (B1_6_1Half 1 (3,j)) = true := by + decide +kernel +lemma B1_6_1Half_check_1_4 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 1 6 1)) (shape 1 6 1) B1_6_1Law + (fun u => B1_6_1Little u 1) ((4 : Fin 6),j)) (B1_6_1Half 1 (4,j)) = true := by + decide +kernel +lemma B1_6_1Half_check_1_5 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 1 6 1)) (shape 1 6 1) B1_6_1Law + (fun u => B1_6_1Little u 1) ((5 : Fin 6),j)) (B1_6_1Half 1 (5,j)) = true := by + decide +kernel +lemma B1_6_1Half_check_2_0 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 1 6 1)) (shape 1 6 1) B1_6_1Law + (fun u => B1_6_1Little u 2) ((0 : Fin 6),j)) (B1_6_1Half 2 (0,j)) = true := by + decide +kernel +lemma B1_6_1Half_check_2_1 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 1 6 1)) (shape 1 6 1) B1_6_1Law + (fun u => B1_6_1Little u 2) ((1 : Fin 6),j)) (B1_6_1Half 2 (1,j)) = true := by + decide +kernel +lemma B1_6_1Half_check_2_2 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 1 6 1)) (shape 1 6 1) B1_6_1Law + (fun u => B1_6_1Little u 2) ((2 : Fin 6),j)) (B1_6_1Half 2 (2,j)) = true := by + decide +kernel +lemma B1_6_1Half_check_2_3 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 1 6 1)) (shape 1 6 1) B1_6_1Law + (fun u => B1_6_1Little u 2) ((3 : Fin 6),j)) (B1_6_1Half 2 (3,j)) = true := by + decide +kernel +lemma B1_6_1Half_check_2_4 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 1 6 1)) (shape 1 6 1) B1_6_1Law + (fun u => B1_6_1Little u 2) ((4 : Fin 6),j)) (B1_6_1Half 2 (4,j)) = true := by + decide +kernel +lemma B1_6_1Half_check_2_5 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 1 6 1)) (shape 1 6 1) B1_6_1Law + (fun u => B1_6_1Little u 2) ((5 : Fin 6),j)) (B1_6_1Half 2 (5,j)) = true := by + decide +kernel +lemma B1_6_1Half_sound (w : Fin 3) (ij : PairSlot) : + (B1_6_1Half w ij).Encloses (halfLaw (shape 1 6 1) w ij : ℝ) := by + have hcheck : contains (pairLawBall (below (shape 1 6 1)) (shape 1 6 1) B1_6_1Law + (fun u => B1_6_1Little u w) ij) (B1_6_1Half w ij) = true := by + rcases ij with ⟨i,j⟩ + revert i w + apply forall_fin3 + · exact forall_fin6 (B1_6_1Half_check_0_0 j) (B1_6_1Half_check_0_1 j) (B1_6_1Half_check_0_2 j) (B1_6_1Half_check_0_3 j) (B1_6_1Half_check_0_4 j) (B1_6_1Half_check_0_5 j) + · exact forall_fin6 (B1_6_1Half_check_1_0 j) (B1_6_1Half_check_1_1 j) (B1_6_1Half_check_1_2 j) (B1_6_1Half_check_1_3 j) (B1_6_1Half_check_1_4 j) (B1_6_1Half_check_1_5 j) + · exact forall_fin6 (B1_6_1Half_check_2_0 j) (B1_6_1Half_check_2_1 j) (B1_6_1Half_check_2_2 j) (B1_6_1Half_check_2_3 j) (B1_6_1Half_check_2_4 j) (B1_6_1Half_check_2_5 j) + have h := contains_sound (pairLawBall_sound (below (shape 1 6 1)) (shape 1 6 1) + B1_6_1Law (fun u => (stageBLaw (shape 1 6 1) u : ℝ)) + (fun u => B1_6_1Little u w) (fun u i => (littleLaw (shape 1 6 1) u w i : ℝ)) + (fun u _ => B1_6_1Law_sound u) (fun u i => B1_6_1Little_sound u w i) ij) hcheck + have hp : positive (shape 1 6 1) = true := by decide +kernel + simpa only [halfLaw, hp, ite_true, pairLaw, positiveHalfLaw, Rat.cast_list_sum, + List.map_map, Function.comp_def, Rat.cast_mul] using h + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def B1_6_1U0_3_1Leaf : Ball := ⟨(115129254649702284200899544090987 / 50000000000000000000000000000000), (21175823683 / 25000000000000000000000000000000)⟩ +lemma B1_6_1U0_3_1Leaf_sound : B1_6_1U0_3_1Leaf.Encloses (AllFieldTerminalRates.secondLeafRate (shape 1 6 1) (shape 0 3 1)) := by + have hh : shapeMax (shape 0 3 1) = 3 := by decide +kernel + simp only [AllFieldTerminalRates.secondLeafRate, hh, show (3 : ℕ) ≠ 4 by decide, ite_false, ite_true] + exact logN10_sound +def B1_6_1U0_3_1Mass : Ball := ⟨(2506339406252300091999692633 / 100000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ +lemma B1_6_1U0_3_1Mass_sound : B1_6_1U0_3_1Mass.Encloses (littleMass (shape 1 6 1) (shape 0 3 1) : ℝ) := by + rw [littleMass_cast] + exact contains_sound (Ball.mul_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) (second_1_6_1)) + (B1_6_1Law_sound (shape 0 3 1))) (by decide +kernel) +def B1_6_1U0_4_0Leaf : Ball := ⟨0, 0⟩ +lemma B1_6_1U0_4_0Leaf_sound : B1_6_1U0_4_0Leaf.Encloses (AllFieldTerminalRates.secondLeafRate (shape 1 6 1) (shape 0 4 0)) := by + have hh : shapeMax (shape 0 4 0) = 4 := by decide +kernel + simp only [AllFieldTerminalRates.secondLeafRate, hh, ite_true] + simpa only [B1_6_1U0_4_0Leaf, Ball.exact, Rat.cast_zero] using Ball.exact_sound 0 +def B1_6_1U0_4_0Mass : Ball := ⟨(77881891746725088607012689 / 10000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ +lemma B1_6_1U0_4_0Mass_sound : B1_6_1U0_4_0Mass.Encloses (littleMass (shape 1 6 1) (shape 0 4 0) : ℝ) := by + rw [littleMass_cast] + exact contains_sound (Ball.mul_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) (second_1_6_1)) + (B1_6_1Law_sound (shape 0 4 0))) (by decide +kernel) +def B1_6_1U1_2_1D : Ball := .exact (41991 / 1000000) +lemma B1_6_1U1_2_1D_sound : B1_6_1U1_2_1D.Encloses (binaryParameter (shape 1 6 1) (shape 1 2 1) : ℝ) := by + apply exact_rat_enclosed + decide +kernel +def B1_6_1U1_2_1OneD : Ball := .exact (958009 / 1000000) +lemma B1_6_1U1_2_1OneD_sound : B1_6_1U1_2_1OneD.Encloses (1 - (binaryParameter (shape 1 6 1) (shape 1 2 1) : ℝ)) := by + have he : binaryParameter (shape 1 6 1) (shape 1 2 1) = (41991 / 1000000) := by decide +kernel + rw [he] + convert Ball.exact_sound ((958009 / 1000000) : ℚ) using 1 <;> norm_num [B1_6_1U1_2_1OneD, Ball.exact] +def B1_6_1U1_2_1EDLogWitness : LogWitness := ⟨-5, 41991, 31250⟩ +def B1_6_1U1_2_1EDLog : Ball := ⟨(-63405999387510370889753295440677 / 20000000000000000000000000000000), (63527471049 / 50000000000000000000000000000000)⟩ +lemma B1_6_1U1_2_1EDLog_sound : B1_6_1U1_2_1EDLog.Encloses (Real.log ((binaryParameter (shape 1 6 1) (shape 1 2 1) : ℝ))) := by + exact checkLog_sound logTwoBall_sound (B1_6_1U1_2_1D_sound) (w := B1_6_1U1_2_1EDLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def B1_6_1U1_2_1ED : Ball := ⟨(13312406601404739920158153144247 / 100000000000000000000000000000000), (2667582037 / 50000000000000000000000000000000)⟩ +lemma B1_6_1U1_2_1ED_sound : B1_6_1U1_2_1ED.Encloses (Foundation.entropyTerm ((binaryParameter (shape 1 6 1) (shape 1 2 1) : ℝ))) := by + exact contains_sound (entropyTerm_ball (B1_6_1U1_2_1D_sound) B1_6_1U1_2_1EDLog_sound) (by decide +kernel) +def B1_6_1U1_2_1EOneDLogWitness : LogWitness := ⟨-1, 958009, 500000⟩ +def B1_6_1U1_2_1EOneDLog : Ball := ⟨(-857962129667603414297940708059 / 20000000000000000000000000000000), (8470329473 / 20000000000000000000000000000000)⟩ +lemma B1_6_1U1_2_1EOneDLog_sound : B1_6_1U1_2_1EOneDLog.Encloses (Real.log ((1 - (binaryParameter (shape 1 6 1) (shape 1 2 1) : ℝ)))) := by + exact checkLog_sound logTwoBall_sound (B1_6_1U1_2_1OneD_sound) (w := B1_6_1U1_2_1EOneDLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def B1_6_1U1_2_1EOneD : Ball := ⟨(2054838604701827698320389699467 / 50000000000000000000000000000000), (40573259341 / 100000000000000000000000000000000)⟩ +lemma B1_6_1U1_2_1EOneD_sound : B1_6_1U1_2_1EOneD.Encloses (Foundation.entropyTerm ((1 - (binaryParameter (shape 1 6 1) (shape 1 2 1) : ℝ)))) := by + exact contains_sound (entropyTerm_ball (B1_6_1U1_2_1OneD_sound) B1_6_1U1_2_1EOneDLog_sound) (by decide +kernel) +def B1_6_1U1_2_1BinaryEntropy : Ball := ⟨(20332678136697661665572831142557 / 100000000000000000000000000000000), (596085143 / 1250000000000000000000000000000)⟩ +lemma B1_6_1U1_2_1BinaryEntropy_sound : B1_6_1U1_2_1BinaryEntropy.Encloses + (binaryEntropyRate (binaryParameter (shape 1 6 1) (shape 1 2 1))) := by + exact contains_sound (Ball.add_sound (Ball.add_sound B1_6_1U1_2_1EOneD_sound B1_6_1U1_2_1ED_sound) + (Ball.mul_sound B1_6_1U1_2_1D_sound logN2_sound)) (by decide +kernel) +def B1_6_1U1_2_1Leaf : Ball := ⟨(63025878349743608807433148670163 / 20000000000000000000000000000000), (62193680031 / 50000000000000000000000000000000)⟩ +lemma B1_6_1U1_2_1Leaf_sound : B1_6_1U1_2_1Leaf.Encloses (AllFieldTerminalRates.secondLeafRate (shape 1 6 1) (shape 1 2 1)) := by + have hh : shapeMax (shape 1 2 1) = 2 := by decide +kernel + have hp : positive (shape 1 2 1) = true := by decide +kernel + simp only [AllFieldTerminalRates.secondLeafRate, hh, hp, Bool.not_true, Bool.false_eq_true, + show (2 : ℕ) ≠ 4 by decide, show (2 : ℕ) ≠ 3 by decide, ite_false] + have ht : (Ball.exact (1958009 / 1000000)).Encloses (2 - (binaryParameter (shape 1 6 1) (shape 1 2 1) : ℝ)) := by + have he : binaryParameter (shape 1 6 1) (shape 1 2 1) = (41991 / 1000000) := by decide +kernel + rw [he] + convert Ball.exact_sound ((1958009 / 1000000) : ℚ) using 1 + norm_num [Ball.exact] + exact contains_sound (Ball.mul_sound ht logN5_sound) (by decide +kernel) +def B1_6_1U1_2_1Mass : Ball := ⟨(77881891746725088607012689 / 10000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ +lemma B1_6_1U1_2_1Mass_sound : B1_6_1U1_2_1Mass.Encloses (littleMass (shape 1 6 1) (shape 1 2 1) : ℝ) := by + rw [littleMass_cast] + exact contains_sound (Ball.mul_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) (second_1_6_1)) + (B1_6_1Law_sound (shape 1 2 1))) (by decide +kernel) +def B1_6_1U1_3_0Leaf : Ball := ⟨(115129254649702284200899544090987 / 50000000000000000000000000000000), (21175823683 / 25000000000000000000000000000000)⟩ +lemma B1_6_1U1_3_0Leaf_sound : B1_6_1U1_3_0Leaf.Encloses (AllFieldTerminalRates.secondLeafRate (shape 1 6 1) (shape 1 3 0)) := by + have hh : shapeMax (shape 1 3 0) = 3 := by decide +kernel + simp only [AllFieldTerminalRates.secondLeafRate, hh, show (3 : ℕ) ≠ 4 by decide, ite_false, ite_true] + exact logN10_sound +def B1_6_1U1_3_0Mass : Ball := ⟨(2506339406252300091999692633 / 100000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ +lemma B1_6_1U1_3_0Mass_sound : B1_6_1U1_3_0Mass.Encloses (littleMass (shape 1 6 1) (shape 1 3 0) : ℝ) := by + rw [littleMass_cast] + exact contains_sound (Ball.mul_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) (second_1_6_1)) + (B1_6_1Law_sound (shape 1 3 0))) (by decide +kernel) +def B1_6_1Leaves (s : Shape) : Ball := + match s 0, s 1, s 2 with + | 0, 3, 1 => B1_6_1U0_3_1Leaf + | 0, 4, 0 => B1_6_1U0_4_0Leaf + | 1, 2, 1 => B1_6_1U1_2_1Leaf + | 1, 3, 0 => B1_6_1U1_3_0Leaf + | _, _, _ => (.exact 0) +lemma B1_6_1Leaves_sound (u : Shape) (hu : u ∈ below (shape 1 6 1)) : + (B1_6_1Leaves u).Encloses (AllFieldTerminalRates.secondLeafRate (shape 1 6 1) u) := by + rw [B1_6_1_below] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl + · exact B1_6_1U0_3_1Leaf_sound + · exact B1_6_1U0_4_0Leaf_sound + · exact B1_6_1U1_2_1Leaf_sound + · exact B1_6_1U1_3_0Leaf_sound +def B1_6_1Masses (s : Shape) : Ball := + match s 0, s 1, s 2 with + | 0, 3, 1 => B1_6_1U0_3_1Mass + | 0, 4, 0 => B1_6_1U0_4_0Mass + | 1, 2, 1 => B1_6_1U1_2_1Mass + | 1, 3, 0 => B1_6_1U1_3_0Mass + | _, _, _ => (.exact 0) +lemma B1_6_1Masses_sound (u : Shape) (hu : u ∈ below (shape 1 6 1)) : + (B1_6_1Masses u).Encloses ((fun u => (littleMass (shape 1 6 1) u : ℝ)) u) := by + rw [B1_6_1_below] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl + · exact B1_6_1U0_3_1Mass_sound + · exact B1_6_1U0_4_0Mass_sound + · exact B1_6_1U1_2_1Mass_sound + · exact B1_6_1U1_3_0Mass_sound +def B1_6_1Binaries (s : Shape) : Ball := + match s 0, s 1, s 2 with + | 1, 2, 1 => B1_6_1U1_2_1BinaryEntropy + | _, _, _ => (.exact 0) +lemma B1_6_1Binaries_sound (u : Shape) (hu : u ∈ (below (shape 1 6 1)).filter positive) : + (B1_6_1Binaries u).Encloses ((fun u => binaryEntropyRate (binaryParameter (shape 1 6 1) u)) u) := by + have hl : (below (shape 1 6 1)).filter positive = [(shape 1 2 1)] := by decide +kernel + rw [hl] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl + · exact B1_6_1U1_2_1BinaryEntropy_sound +def B1_6_1S2 : Ball := ⟨(6998203413539342705601595361 / 50000000000000000000000000000000), (5214669 / 100000000000000000000000000000000)⟩ +lemma B1_6_1S2_sound : B1_6_1S2.Encloses + (((below (shape 1 6 1)).map fun u => (littleMass (shape 1 6 1) u : ℝ) * AllFieldTerminalRates.secondLeafRate (shape 1 6 1) u).sum) := by + exact contains_sound (listSumBall_sound (below (shape 1 6 1)) + (fun u => .mul (B1_6_1Masses u) (B1_6_1Leaves u)) _ + (fun u hu => Ball.mul_sound (B1_6_1Masses_sound u hu) (B1_6_1Leaves_sound u hu))) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/Certificates/Terminal2_1_5.lean b/lean/OAI/LinearAlgebra/MatrixFields/Certificates/Terminal2_1_5.lean new file mode 100644 index 0000000000000000000000000000000000000000..1c2625e2010fb5ddfaf4d62a37ead5b191870c9b --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/Certificates/Terminal2_1_5.lean @@ -0,0 +1,538 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Certificates.LittleB1_3_4 +import OAI.LinearAlgebra.MatrixFields.Certificates.Terminal1_1_6 + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate +open scoped BigOperators +lemma B2_1_5_below : below (shape 2 1 5) = [ + (shape 0 0 4), + (shape 0 1 3), + (shape 1 0 3), + (shape 1 1 2), + (shape 2 0 2), + (shape 2 1 1)] := by decide +kernel +def B2_1_5Raw (s : Shape) : Ball := + match s 0, s 1, s 2 with + | 0, 0, 4 => ⟨(143477508024585653583089862491 / 50000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ + | 0, 1, 3 => ⟨(28769707349155561859531613298219 / 50000000000000000000000000000000), (73 / 100000000000000000000000000000000)⟩ + | 1, 0, 3 => ⟨1, 0⟩ + | 1, 1, 2 => ⟨1, 0⟩ + | 2, 0, 2 => ⟨(28769707349155561859531613298219 / 50000000000000000000000000000000), (73 / 100000000000000000000000000000000)⟩ + | 2, 1, 1 => ⟨(143477508024585653583089862491 / 50000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ + | _, _, _ => (.exact 0) +lemma B2_1_5Raw_0_0_4 : (B2_1_5Raw (shape 0 0 4)).Encloses (splitWeight positiveSecond tablep (shape 2 1 5) (shape 0 0 4) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveSecond tablep (shape 2 1 5) (shape 0 0 4) + (-5527) (0) (-53009) w170 w195 w34 + (by decide +kernel) w170_sound w195_sound w34_sound) (by decide +kernel) +lemma B2_1_5Raw_0_1_3 : (B2_1_5Raw (shape 0 1 3)).Encloses (splitWeight positiveSecond tablep (shape 2 1 5) (shape 0 1 3) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveSecond tablep (shape 2 1 5) (shape 0 1 3) + (-5527) (0) (0) w170 w195 w195 + (by decide +kernel) w170_sound w195_sound w195_sound) (by decide +kernel) +lemma B2_1_5Raw_1_0_3 : (B2_1_5Raw (shape 1 0 3)).Encloses (splitWeight positiveSecond tablep (shape 2 1 5) (shape 1 0 3) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveSecond tablep (shape 2 1 5) (shape 1 0 3) + (0) (0) (0) w195 w195 w195 + (by decide +kernel) w195_sound w195_sound w195_sound) (by decide +kernel) +lemma B2_1_5Raw_1_1_2 : (B2_1_5Raw (shape 1 1 2)).Encloses (splitWeight positiveSecond tablep (shape 2 1 5) (shape 1 1 2) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveSecond tablep (shape 2 1 5) (shape 1 1 2) + (0) (0) (0) w195 w195 w195 + (by decide +kernel) w195_sound w195_sound w195_sound) (by decide +kernel) +lemma B2_1_5Raw_2_0_2 : (B2_1_5Raw (shape 2 0 2)).Encloses (splitWeight positiveSecond tablep (shape 2 1 5) (shape 2 0 2) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveSecond tablep (shape 2 1 5) (shape 2 0 2) + (-5527) (0) (0) w170 w195 w195 + (by decide +kernel) w170_sound w195_sound w195_sound) (by decide +kernel) +lemma B2_1_5Raw_2_1_1 : (B2_1_5Raw (shape 2 1 1)).Encloses (splitWeight positiveSecond tablep (shape 2 1 5) (shape 2 1 1) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveSecond tablep (shape 2 1 5) (shape 2 1 1) + (-5527) (0) (-53009) w170 w195 w34 + (by decide +kernel) w170_sound w195_sound w34_sound) (by decide +kernel) +lemma B2_1_5Raw_sound (u : Shape) (hu : u ∈ below (shape 2 1 5)) : + (B2_1_5Raw u).Encloses (splitWeight positiveSecond tablep (shape 2 1 5) u : ℝ) := by + rw [B2_1_5_below] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl | rfl | rfl + · exact B2_1_5Raw_0_0_4 + · exact B2_1_5Raw_0_1_3 + · exact B2_1_5Raw_1_0_3 + · exact B2_1_5Raw_1_1_2 + · exact B2_1_5Raw_2_0_2 + · exact B2_1_5Raw_2_1_1 +def B2_1_5Den : Ball := ⟨(7891318485718014751311470316071 / 2500000000000000000000000000000), (3 / 2000000000000000000000000000000)⟩ +lemma B2_1_5Den_sound : B2_1_5Den.Encloses (((below (shape 2 1 5)).map (splitWeight positiveSecond tablep (shape 2 1 5))).sum : ℝ) := by + exact contains_sound (list_cast_enclosed (below (shape 2 1 5)) B2_1_5Raw (splitWeight positiveSecond tablep (shape 2 1 5)) B2_1_5Raw_sound) (by decide +kernel) +lemma B2_1_5Den_positive : 0 < B2_1_5Den.lower := by decide +kernel +def B2_1_5Table (s : Shape) : Ball := + match s 0, s 1, s 2 with + | 0, 0, 4 => ⟨(45454225515120282149964459091 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 0, 1, 3 => ⟨(9114353767758831519889785991183 / 50000000000000000000000000000000), (1 / 3125000000000000000000000000000)⟩ + | 1, 0, 3 => ⟨(7920096003363024098980124774863 / 25000000000000000000000000000000), (1 / 6250000000000000000000000000000)⟩ + | 1, 1, 2 => ⟨(7920096003363024098980124774863 / 25000000000000000000000000000000), (1 / 6250000000000000000000000000000)⟩ + | 2, 0, 2 => ⟨(9114353767758831519889785991183 / 50000000000000000000000000000000), (1 / 3125000000000000000000000000000)⟩ + | 2, 1, 1 => ⟨(45454225515120282149964459091 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | _, _, _ => (.exact 0) +def B2_1_5Law (u : Shape) : Ball := if u ∈ below (shape 2 1 5) then B2_1_5Table u else .exact 0 +lemma B2_1_5Law_check_0_0_4 : contains (.mul (B2_1_5Raw (shape 0 0 4)) (.inv B2_1_5Den)) (B2_1_5Table (shape 0 0 4)) = true := by decide +kernel +lemma B2_1_5Law_check_0_1_3 : contains (.mul (B2_1_5Raw (shape 0 1 3)) (.inv B2_1_5Den)) (B2_1_5Table (shape 0 1 3)) = true := by decide +kernel +lemma B2_1_5Law_check_1_0_3 : contains (.mul (B2_1_5Raw (shape 1 0 3)) (.inv B2_1_5Den)) (B2_1_5Table (shape 1 0 3)) = true := by decide +kernel +lemma B2_1_5Law_check_1_1_2 : contains (.mul (B2_1_5Raw (shape 1 1 2)) (.inv B2_1_5Den)) (B2_1_5Table (shape 1 1 2)) = true := by decide +kernel +lemma B2_1_5Law_check_2_0_2 : contains (.mul (B2_1_5Raw (shape 2 0 2)) (.inv B2_1_5Den)) (B2_1_5Table (shape 2 0 2)) = true := by decide +kernel +lemma B2_1_5Law_check_2_1_1 : contains (.mul (B2_1_5Raw (shape 2 1 1)) (.inv B2_1_5Den)) (B2_1_5Table (shape 2 1 1)) = true := by decide +kernel +lemma B2_1_5Law_check (u : Shape) (hu : u ∈ below (shape 2 1 5)) : + contains (.mul (B2_1_5Raw u) (.inv B2_1_5Den)) (B2_1_5Table u) = true := by + rw [B2_1_5_below] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl | rfl | rfl + · exact B2_1_5Law_check_0_0_4 + · exact B2_1_5Law_check_0_1_3 + · exact B2_1_5Law_check_1_0_3 + · exact B2_1_5Law_check_1_1_2 + · exact B2_1_5Law_check_2_0_2 + · exact B2_1_5Law_check_2_1_1 +lemma B2_1_5Law_sound (u : Shape) : + (B2_1_5Law u).Encloses (stageBLaw (shape 2 1 5) u : ℝ) := by + by_cases hu : u ∈ below (shape 2 1 5) + · have h := contains_sound (Ball.mul_sound (B2_1_5Raw_sound u hu) + (Ball.inv_sound B2_1_5Den_sound B2_1_5Den_positive)) (B2_1_5Law_check u hu) + simpa only [B2_1_5Law, hu, ite_true, stageBLaw, splitLaw, + Rat.cast_div, Rat.cast_mul, Rat.cast_inv, div_eq_mul_inv] using h + · simp only [B2_1_5Law, hu, ite_false, stageBLaw, splitLaw, Rat.cast_zero] + simpa only [Rat.cast_zero] using Ball.exact_sound 0 + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def B2_1_5Binary (u : Shape) : ℚ := + match u 0, u 1, u 2 with + | 1, 1, 2 => (1 / 1000000) + | 2, 0, 2 => (50311 / 500000) + | 2, 1, 1 => (21083 / 500000) + | _, _, _ => 0 +lemma B2_1_5Binary_eq (u : Shape) (hu : u ∈ shapes 4) : + binaryParameter (shape 2 1 5) u = B2_1_5Binary u := by + rw [shapes4_list] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel +def B2_1_5LittleRat (u : Shape) (w : Fin 3) (i : Fin 6) : ℚ := + if u w = 2 then + if i = 2 then 1 - B2_1_5Binary u else if i = 3 then B2_1_5Binary u else 0 + else if i = singletonSlot (u w) then 1 else 0 + +def B2_1_5Little (u : Shape) (w : Fin 3) (i : Fin 6) : Ball := + if u ∈ shapes 4 then .exact (B2_1_5LittleRat u w i) + else .exact (littleLaw (shape 2 1 5) u w i) + +lemma B2_1_5Little_sound (u : Shape) (w : Fin 3) (i : Fin 6) : + (B2_1_5Little u w i).Encloses (littleLaw (shape 2 1 5) u w i : ℝ) := by + by_cases hu : u ∈ shapes 4 + · simp only [B2_1_5Little, hu, ite_true] + apply exact_rat_enclosed + simp only [B2_1_5LittleRat, littleLaw, B2_1_5Binary_eq u hu] + · simp only [B2_1_5Little, hu, ite_false] + exact Ball.exact_sound _ +def B2_1_5Half (w : Fin 3) (ij : PairSlot) : Ball := + match w.val, ij.1.val, ij.2.val with + | 0, 0, 2 => ⟨(8240786865581452095028265002887 / 50000000000000000000000000000000), (31 / 100000000000000000000000000000000)⟩ + | 0, 0, 3 => ⟨(919021127692499707011485447387 / 50000000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ + | 0, 1, 1 => ⟨(7920096003363024098980124774863 / 12500000000000000000000000000000), (1 / 3125000000000000000000000000000)⟩ + | 0, 2, 0 => ⟨(8240786865581452095028265002887 / 50000000000000000000000000000000), (31 / 100000000000000000000000000000000)⟩ + | 0, 3, 0 => ⟨(919021127692499707011485447387 / 50000000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ + | 1, 0, 1 => ⟨(1 / 2), (49 / 100000000000000000000000000000000)⟩ + | 1, 1, 0 => ⟨(1 / 2), (49 / 100000000000000000000000000000000)⟩ + | 2, 5, 1 => ⟨(45454225515120282149964459091 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 2, 4, 2 => ⟨(48074850858946887693214975069309 / 100000000000000000000000000000000), (23 / 50000000000000000000000000000000)⟩ + | 2, 4, 3 => ⟨(1834240690022871742485096012509 / 100000000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ + | 2, 2, 4 => ⟨(48074850858946887693214975069309 / 100000000000000000000000000000000), (23 / 50000000000000000000000000000000)⟩ + | 2, 3, 4 => ⟨(1834240690022871742485096012509 / 100000000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ + | 2, 1, 5 => ⟨(45454225515120282149964459091 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | _, _, _ => (.exact 0) +lemma B2_1_5Half_check_0_0 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 2 1 5)) (shape 2 1 5) B2_1_5Law + (fun u => B2_1_5Little u 0) ((0 : Fin 6),j)) (B2_1_5Half 0 (0,j)) = true := by + decide +kernel +lemma B2_1_5Half_check_0_1 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 2 1 5)) (shape 2 1 5) B2_1_5Law + (fun u => B2_1_5Little u 0) ((1 : Fin 6),j)) (B2_1_5Half 0 (1,j)) = true := by + decide +kernel +lemma B2_1_5Half_check_0_2 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 2 1 5)) (shape 2 1 5) B2_1_5Law + (fun u => B2_1_5Little u 0) ((2 : Fin 6),j)) (B2_1_5Half 0 (2,j)) = true := by + decide +kernel +lemma B2_1_5Half_check_0_3 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 2 1 5)) (shape 2 1 5) B2_1_5Law + (fun u => B2_1_5Little u 0) ((3 : Fin 6),j)) (B2_1_5Half 0 (3,j)) = true := by + decide +kernel +lemma B2_1_5Half_check_0_4 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 2 1 5)) (shape 2 1 5) B2_1_5Law + (fun u => B2_1_5Little u 0) ((4 : Fin 6),j)) (B2_1_5Half 0 (4,j)) = true := by + decide +kernel +lemma B2_1_5Half_check_0_5 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 2 1 5)) (shape 2 1 5) B2_1_5Law + (fun u => B2_1_5Little u 0) ((5 : Fin 6),j)) (B2_1_5Half 0 (5,j)) = true := by + decide +kernel +lemma B2_1_5Half_check_1_0 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 2 1 5)) (shape 2 1 5) B2_1_5Law + (fun u => B2_1_5Little u 1) ((0 : Fin 6),j)) (B2_1_5Half 1 (0,j)) = true := by + decide +kernel +lemma B2_1_5Half_check_1_1 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 2 1 5)) (shape 2 1 5) B2_1_5Law + (fun u => B2_1_5Little u 1) ((1 : Fin 6),j)) (B2_1_5Half 1 (1,j)) = true := by + decide +kernel +lemma B2_1_5Half_check_1_2 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 2 1 5)) (shape 2 1 5) B2_1_5Law + (fun u => B2_1_5Little u 1) ((2 : Fin 6),j)) (B2_1_5Half 1 (2,j)) = true := by + decide +kernel +lemma B2_1_5Half_check_1_3 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 2 1 5)) (shape 2 1 5) B2_1_5Law + (fun u => B2_1_5Little u 1) ((3 : Fin 6),j)) (B2_1_5Half 1 (3,j)) = true := by + decide +kernel +lemma B2_1_5Half_check_1_4 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 2 1 5)) (shape 2 1 5) B2_1_5Law + (fun u => B2_1_5Little u 1) ((4 : Fin 6),j)) (B2_1_5Half 1 (4,j)) = true := by + decide +kernel +lemma B2_1_5Half_check_1_5 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 2 1 5)) (shape 2 1 5) B2_1_5Law + (fun u => B2_1_5Little u 1) ((5 : Fin 6),j)) (B2_1_5Half 1 (5,j)) = true := by + decide +kernel +lemma B2_1_5Half_check_2_0 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 2 1 5)) (shape 2 1 5) B2_1_5Law + (fun u => B2_1_5Little u 2) ((0 : Fin 6),j)) (B2_1_5Half 2 (0,j)) = true := by + decide +kernel +lemma B2_1_5Half_check_2_1 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 2 1 5)) (shape 2 1 5) B2_1_5Law + (fun u => B2_1_5Little u 2) ((1 : Fin 6),j)) (B2_1_5Half 2 (1,j)) = true := by + decide +kernel +lemma B2_1_5Half_check_2_2 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 2 1 5)) (shape 2 1 5) B2_1_5Law + (fun u => B2_1_5Little u 2) ((2 : Fin 6),j)) (B2_1_5Half 2 (2,j)) = true := by + decide +kernel +lemma B2_1_5Half_check_2_3 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 2 1 5)) (shape 2 1 5) B2_1_5Law + (fun u => B2_1_5Little u 2) ((3 : Fin 6),j)) (B2_1_5Half 2 (3,j)) = true := by + decide +kernel +lemma B2_1_5Half_check_2_4 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 2 1 5)) (shape 2 1 5) B2_1_5Law + (fun u => B2_1_5Little u 2) ((4 : Fin 6),j)) (B2_1_5Half 2 (4,j)) = true := by + decide +kernel +lemma B2_1_5Half_check_2_5 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 2 1 5)) (shape 2 1 5) B2_1_5Law + (fun u => B2_1_5Little u 2) ((5 : Fin 6),j)) (B2_1_5Half 2 (5,j)) = true := by + decide +kernel +lemma B2_1_5Half_sound (w : Fin 3) (ij : PairSlot) : + (B2_1_5Half w ij).Encloses (halfLaw (shape 2 1 5) w ij : ℝ) := by + have hcheck : contains (pairLawBall (below (shape 2 1 5)) (shape 2 1 5) B2_1_5Law + (fun u => B2_1_5Little u w) ij) (B2_1_5Half w ij) = true := by + rcases ij with ⟨i,j⟩ + revert i w + apply forall_fin3 + · exact forall_fin6 (B2_1_5Half_check_0_0 j) (B2_1_5Half_check_0_1 j) (B2_1_5Half_check_0_2 j) (B2_1_5Half_check_0_3 j) (B2_1_5Half_check_0_4 j) (B2_1_5Half_check_0_5 j) + · exact forall_fin6 (B2_1_5Half_check_1_0 j) (B2_1_5Half_check_1_1 j) (B2_1_5Half_check_1_2 j) (B2_1_5Half_check_1_3 j) (B2_1_5Half_check_1_4 j) (B2_1_5Half_check_1_5 j) + · exact forall_fin6 (B2_1_5Half_check_2_0 j) (B2_1_5Half_check_2_1 j) (B2_1_5Half_check_2_2 j) (B2_1_5Half_check_2_3 j) (B2_1_5Half_check_2_4 j) (B2_1_5Half_check_2_5 j) + have h := contains_sound (pairLawBall_sound (below (shape 2 1 5)) (shape 2 1 5) + B2_1_5Law (fun u => (stageBLaw (shape 2 1 5) u : ℝ)) + (fun u => B2_1_5Little u w) (fun u i => (littleLaw (shape 2 1 5) u w i : ℝ)) + (fun u _ => B2_1_5Law_sound u) (fun u i => B2_1_5Little_sound u w i) ij) hcheck + have hp : positive (shape 2 1 5) = true := by decide +kernel + simpa only [halfLaw, hp, ite_true, pairLaw, positiveHalfLaw, Rat.cast_list_sum, + List.map_map, Function.comp_def, Rat.cast_mul] using h + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def B2_1_5U0_0_4Leaf : Ball := ⟨0, 0⟩ +lemma B2_1_5U0_0_4Leaf_sound : B2_1_5U0_0_4Leaf.Encloses (AllFieldTerminalRates.secondLeafRate (shape 2 1 5) (shape 0 0 4)) := by + have hh : shapeMax (shape 0 0 4) = 4 := by decide +kernel + simp only [AllFieldTerminalRates.secondLeafRate, hh, ite_true] + simpa only [B2_1_5U0_0_4Leaf, Ball.exact, Rat.cast_zero] using Ball.exact_sound 0 +def B2_1_5U0_0_4Mass : Ball := ⟨(11980229688179108495838363 / 195312500000000000000000000000), (1 / 100000000000000000000000000000000)⟩ +lemma B2_1_5U0_0_4Mass_sound : B2_1_5U0_0_4Mass.Encloses (littleMass (shape 2 1 5) (shape 0 0 4) : ℝ) := by + rw [littleMass_cast] + exact contains_sound (Ball.mul_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) (second_2_1_5)) + (B2_1_5Law_sound (shape 0 0 4))) (by decide +kernel) +def B2_1_5U0_1_3Leaf : Ball := ⟨(115129254649702284200899544090987 / 50000000000000000000000000000000), (21175823683 / 25000000000000000000000000000000)⟩ +lemma B2_1_5U0_1_3Leaf_sound : B2_1_5U0_1_3Leaf.Encloses (AllFieldTerminalRates.secondLeafRate (shape 2 1 5) (shape 0 1 3)) := by + have hh : shapeMax (shape 0 1 3) = 3 := by decide +kernel + simp only [AllFieldTerminalRates.secondLeafRate, hh, show (3 : ℕ) ≠ 4 by decide, ite_false, ite_true] + exact logN10_sound +def B2_1_5U0_1_3Mass : Ball := ⟨(153743490797966165833014949619 / 12500000000000000000000000000000), (9 / 50000000000000000000000000000000)⟩ +lemma B2_1_5U0_1_3Mass_sound : B2_1_5U0_1_3Mass.Encloses (littleMass (shape 2 1 5) (shape 0 1 3) : ℝ) := by + rw [littleMass_cast] + exact contains_sound (Ball.mul_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) (second_2_1_5)) + (B2_1_5Law_sound (shape 0 1 3))) (by decide +kernel) +def B2_1_5U1_0_3Leaf : Ball := ⟨(115129254649702284200899544090987 / 50000000000000000000000000000000), (21175823683 / 25000000000000000000000000000000)⟩ +lemma B2_1_5U1_0_3Leaf_sound : B2_1_5U1_0_3Leaf.Encloses (AllFieldTerminalRates.secondLeafRate (shape 2 1 5) (shape 1 0 3)) := by + have hh : shapeMax (shape 1 0 3) = 3 := by decide +kernel + simp only [AllFieldTerminalRates.secondLeafRate, hh, show (3 : ℕ) ≠ 4 by decide, ite_false, ite_true] + exact logN10_sound +def B2_1_5U1_0_3Mass : Ball := ⟨(534393655563127546658319620403 / 25000000000000000000000000000000), (7 / 25000000000000000000000000000000)⟩ +lemma B2_1_5U1_0_3Mass_sound : B2_1_5U1_0_3Mass.Encloses (littleMass (shape 2 1 5) (shape 1 0 3) : ℝ) := by + rw [littleMass_cast] + exact contains_sound (Ball.mul_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) (second_2_1_5)) + (B2_1_5Law_sound (shape 1 0 3))) (by decide +kernel) +def B2_1_5U1_1_2D : Ball := .exact (1 / 1000000) +lemma B2_1_5U1_1_2D_sound : B2_1_5U1_1_2D.Encloses (binaryParameter (shape 2 1 5) (shape 1 1 2) : ℝ) := by + apply exact_rat_enclosed + decide +kernel +def B2_1_5U1_1_2OneD : Ball := .exact (999999 / 1000000) +lemma B2_1_5U1_1_2OneD_sound : B2_1_5U1_1_2OneD.Encloses (1 - (binaryParameter (shape 2 1 5) (shape 1 1 2) : ℝ)) := by + have he : binaryParameter (shape 2 1 5) (shape 1 1 2) = (1 / 1000000) := by decide +kernel + rw [he] + convert Ball.exact_sound ((999999 / 1000000) : ℚ) using 1 <;> norm_num [B2_1_5U1_1_2OneD, Ball.exact] +def B2_1_5U1_1_2EDLogWitness : LogWitness := ⟨-20, 16384, 15625⟩ +def B2_1_5U1_1_2EDLog : Ball := ⟨(-276310211159285482082158898180173 / 20000000000000000000000000000000), (222346148671 / 50000000000000000000000000000000)⟩ +lemma B2_1_5U1_1_2EDLog_sound : B2_1_5U1_1_2EDLog.Encloses (Real.log ((binaryParameter (shape 2 1 5) (shape 1 1 2) : ℝ))) := by + exact checkLog_sound logTwoBall_sound (B2_1_5U1_1_2D_sound) (w := B2_1_5U1_1_2EDLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def B2_1_5U1_1_2ED : Ball := ⟨(1381551055796427410410794491 / 100000000000000000000000000000000), (444693 / 100000000000000000000000000000000)⟩ +lemma B2_1_5U1_1_2ED_sound : B2_1_5U1_1_2ED.Encloses (Foundation.entropyTerm ((binaryParameter (shape 2 1 5) (shape 1 1 2) : ℝ))) := by + exact contains_sound (entropyTerm_ball (B2_1_5U1_1_2D_sound) B2_1_5U1_1_2EDLog_sound) (by decide +kernel) +def B2_1_5U1_1_2EOneDLogWitness : LogWitness := ⟨-1, 999999, 500000⟩ +def B2_1_5U1_1_2EOneDLog : Ball := ⟨(-100000050000033333358332099 / 100000000000000000000000000000000), (21175823683 / 50000000000000000000000000000000)⟩ +lemma B2_1_5U1_1_2EOneDLog_sound : B2_1_5U1_1_2EOneDLog.Encloses (Real.log ((1 - (binaryParameter (shape 2 1 5) (shape 1 1 2) : ℝ)))) := by + exact checkLog_sound logTwoBall_sound (B2_1_5U1_1_2OneD_sound) (w := B2_1_5U1_1_2EOneDLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def B2_1_5U1_1_2EOneD : Ball := ⟨(99999949999983333324998741 / 100000000000000000000000000000000), (8470321003 / 20000000000000000000000000000000)⟩ +lemma B2_1_5U1_1_2EOneD_sound : B2_1_5U1_1_2EOneD.Encloses (Foundation.entropyTerm ((1 - (binaryParameter (shape 2 1 5) (shape 1 1 2) : ℝ)))) := by + exact contains_sound (entropyTerm_ball (B2_1_5U1_1_2OneD_sound) B2_1_5U1_1_2EOneDLog_sound) (by decide +kernel) +def B2_1_5U1_1_2BinaryEntropy : Ball := ⟨(62034628954096210987100657 / 4000000000000000000000000000000), (2117604603 / 5000000000000000000000000000000)⟩ +lemma B2_1_5U1_1_2BinaryEntropy_sound : B2_1_5U1_1_2BinaryEntropy.Encloses + (binaryEntropyRate (binaryParameter (shape 2 1 5) (shape 1 1 2))) := by + exact contains_sound (Ball.add_sound (Ball.add_sound B2_1_5U1_1_2EOneD_sound B2_1_5U1_1_2ED_sound) + (Ball.mul_sound B2_1_5U1_1_2D_sound logN2_sound)) (by decide +kernel) +def B2_1_5U1_1_2Leaf : Ball := ⟨(321887421543028831510114330187393 / 100000000000000000000000000000000), (127054878571 / 100000000000000000000000000000000)⟩ +lemma B2_1_5U1_1_2Leaf_sound : B2_1_5U1_1_2Leaf.Encloses (AllFieldTerminalRates.secondLeafRate (shape 2 1 5) (shape 1 1 2)) := by + have hh : shapeMax (shape 1 1 2) = 2 := by decide +kernel + have hp : positive (shape 1 1 2) = true := by decide +kernel + simp only [AllFieldTerminalRates.secondLeafRate, hh, hp, Bool.not_true, Bool.false_eq_true, + show (2 : ℕ) ≠ 4 by decide, show (2 : ℕ) ≠ 3 by decide, ite_false] + have ht : (Ball.exact (1999999 / 1000000)).Encloses (2 - (binaryParameter (shape 2 1 5) (shape 1 1 2) : ℝ)) := by + have he : binaryParameter (shape 2 1 5) (shape 1 1 2) = (1 / 1000000) := by decide +kernel + rw [he] + convert Ball.exact_sound ((1999999 / 1000000) : ℚ) using 1; norm_num [Ball.exact] + exact contains_sound (Ball.mul_sound ht logN5_sound) (by decide +kernel) +def B2_1_5U1_1_2Mass : Ball := ⟨(534393655563127546658319620403 / 25000000000000000000000000000000), (7 / 25000000000000000000000000000000)⟩ +lemma B2_1_5U1_1_2Mass_sound : B2_1_5U1_1_2Mass.Encloses (littleMass (shape 2 1 5) (shape 1 1 2) : ℝ) := by + rw [littleMass_cast] + exact contains_sound (Ball.mul_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) (second_2_1_5)) + (B2_1_5Law_sound (shape 1 1 2))) (by decide +kernel) +def B2_1_5U2_0_2D : Ball := .exact (50311 / 500000) +lemma B2_1_5U2_0_2D_sound : B2_1_5U2_0_2D.Encloses (binaryParameter (shape 2 1 5) (shape 2 0 2) : ℝ) := by + apply exact_rat_enclosed + decide +kernel +def B2_1_5U2_0_2OneD : Ball := .exact (449689 / 500000) +lemma B2_1_5U2_0_2OneD_sound : B2_1_5U2_0_2OneD.Encloses (1 - (binaryParameter (shape 2 1 5) (shape 2 0 2) : ℝ)) := by + have he : binaryParameter (shape 2 1 5) (shape 2 0 2) = (50311 / 500000) := by decide +kernel + rw [he] + convert Ball.exact_sound ((449689 / 500000) : ℚ) using 1 <;> norm_num [B2_1_5U2_0_2OneD, Ball.exact] +def B2_1_5U2_0_2EDLogWitness : LogWitness := ⟨-4, 50311, 31250⟩ +def B2_1_5U2_0_2EDLog : Ball := ⟨(-229638435735244201494939716178541 / 100000000000000000000000000000000), (21175823683 / 20000000000000000000000000000000)⟩ +lemma B2_1_5U2_0_2EDLog_sound : B2_1_5U2_0_2EDLog.Encloses (Real.log ((binaryParameter (shape 2 1 5) (shape 2 0 2) : ℝ))) := by + exact checkLog_sound logTwoBall_sound (B2_1_5U2_0_2D_sound) (w := B2_1_5U2_0_2EDLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def B2_1_5U2_0_2ED : Ball := ⟨(23106678680551742042823824121317 / 100000000000000000000000000000000), (5326884327 / 50000000000000000000000000000000)⟩ +lemma B2_1_5U2_0_2ED_sound : B2_1_5U2_0_2ED.Encloses (Foundation.entropyTerm ((binaryParameter (shape 2 1 5) (shape 2 0 2) : ℝ))) := by + exact contains_sound (entropyTerm_ball (B2_1_5U2_0_2D_sound) B2_1_5U2_0_2EDLog_sound) (by decide +kernel) +def B2_1_5U2_0_2EOneDLogWitness : LogWitness := ⟨-1, 449689, 250000⟩ +def B2_1_5U2_0_2EOneDLog : Ball := ⟨(-2651296642407782012789413805853 / 25000000000000000000000000000000), (21175823683 / 50000000000000000000000000000000)⟩ +lemma B2_1_5U2_0_2EOneDLog_sound : B2_1_5U2_0_2EOneDLog.Encloses (Real.log ((1 - (binaryParameter (shape 2 1 5) (shape 2 0 2) : ℝ)))) := by + exact checkLog_sound logTwoBall_sound (B2_1_5U2_0_2OneD_sound) (w := B2_1_5U2_0_2EOneDLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def B2_1_5U2_0_2EOneD : Ball := ⟨(4769035743310852342197034819761 / 50000000000000000000000000000000), (7618027981 / 20000000000000000000000000000000)⟩ +lemma B2_1_5U2_0_2EOneD_sound : B2_1_5U2_0_2EOneD.Encloses (Foundation.entropyTerm ((1 - (binaryParameter (shape 2 1 5) (shape 2 0 2) : ℝ)))) := by + exact contains_sound (entropyTerm_ball (B2_1_5U2_0_2OneD_sound) B2_1_5U2_0_2EOneDLog_sound) (by decide +kernel) +def B2_1_5U2_0_2BinaryEntropy : Ball := ⟨(39619335727403728419635964891949 / 100000000000000000000000000000000), (53005416021 / 100000000000000000000000000000000)⟩ +lemma B2_1_5U2_0_2BinaryEntropy_sound : B2_1_5U2_0_2BinaryEntropy.Encloses + (binaryEntropyRate (binaryParameter (shape 2 1 5) (shape 2 0 2))) := by + exact contains_sound (Ball.add_sound (Ball.add_sound B2_1_5U2_0_2EOneD_sound B2_1_5U2_0_2ED_sound) + (Ball.mul_sound B2_1_5U2_0_2D_sound logN2_sound)) (by decide +kernel) +def B2_1_5U2_0_2Leaf : Ball := ⟨(82279486472308748440293060428841 / 25000000000000000000000000000000), (20909479467 / 12500000000000000000000000000000)⟩ +lemma B2_1_5U2_0_2Leaf_sound : B2_1_5U2_0_2Leaf.Encloses (AllFieldTerminalRates.secondLeafRate (shape 2 1 5) (shape 2 0 2)) := by + have hh : shapeMax (shape 2 0 2) = 2 := by decide +kernel + have hp : positive (shape 2 0 2) = false := by decide +kernel + simp only [AllFieldTerminalRates.secondLeafRate, hh, hp, Bool.not_false, + show (2 : ℕ) ≠ 4 by decide, show (2 : ℕ) ≠ 3 by decide, ite_false, ite_true] + exact contains_sound (Ball.add_sound B2_1_5U2_0_2BinaryEntropy_sound + (Ball.mul_sound (Ball.mul_sound (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) + B2_1_5U2_0_2OneD_sound) logN5_sound)) (by decide +kernel) +def B2_1_5U2_0_2Mass : Ball := ⟨(153743490797966165833014949619 / 12500000000000000000000000000000), (9 / 50000000000000000000000000000000)⟩ +lemma B2_1_5U2_0_2Mass_sound : B2_1_5U2_0_2Mass.Encloses (littleMass (shape 2 1 5) (shape 2 0 2) : ℝ) := by + rw [littleMass_cast] + exact contains_sound (Ball.mul_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) (second_2_1_5)) + (B2_1_5Law_sound (shape 2 0 2))) (by decide +kernel) +def B2_1_5U2_1_1D : Ball := .exact (21083 / 500000) +lemma B2_1_5U2_1_1D_sound : B2_1_5U2_1_1D.Encloses (binaryParameter (shape 2 1 5) (shape 2 1 1) : ℝ) := by + apply exact_rat_enclosed + decide +kernel +def B2_1_5U2_1_1OneD : Ball := .exact (478917 / 500000) +lemma B2_1_5U2_1_1OneD_sound : B2_1_5U2_1_1OneD.Encloses (1 - (binaryParameter (shape 2 1 5) (shape 2 1 1) : ℝ)) := by + have he : binaryParameter (shape 2 1 5) (shape 2 1 1) = (21083 / 500000) := by decide +kernel + rw [he] + convert Ball.exact_sound ((478917 / 500000) : ℚ) using 1 <;> norm_num [B2_1_5U2_1_1OneD, Ball.exact] +def B2_1_5U2_1_1EDLogWitness : LogWitness := ⟨-5, 21083, 15625⟩ +def B2_1_5U2_1_1EDLog : Ball := ⟨(-63322821397686708031899813013369 / 20000000000000000000000000000000), (63527471049 / 50000000000000000000000000000000)⟩ +lemma B2_1_5U2_1_1EDLog_sound : B2_1_5U2_1_1EDLog.Encloses (Real.log ((binaryParameter (shape 2 1 5) (shape 2 1 1) : ℝ))) := by + exact checkLog_sound logTwoBall_sound (B2_1_5U2_1_1D_sound) (w := B2_1_5U2_1_1EDLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def B2_1_5U2_1_1ED : Ball := ⟨(13350350435274288654365437577609 / 100000000000000000000000000000000), (5357398689 / 100000000000000000000000000000000)⟩ +lemma B2_1_5U2_1_1ED_sound : B2_1_5U2_1_1ED.Encloses (Foundation.entropyTerm ((binaryParameter (shape 2 1 5) (shape 2 1 1) : ℝ))) := by + exact contains_sound (entropyTerm_ball (B2_1_5U2_1_1D_sound) B2_1_5U2_1_1EDLog_sound) (by decide +kernel) +def B2_1_5U2_1_1EOneDLogWitness : LogWitness := ⟨-1, 478917, 250000⟩ +def B2_1_5U2_1_1EOneDLog : Ball := ⟨(-67313740136531887218517535329 / 1562500000000000000000000000000), (21175823683 / 50000000000000000000000000000000)⟩ +lemma B2_1_5U2_1_1EOneDLog_sound : B2_1_5U2_1_1EOneDLog.Encloses (Real.log ((1 - (binaryParameter (shape 2 1 5) (shape 2 1 1) : ℝ)))) := by + exact checkLog_sound logTwoBall_sound (B2_1_5U2_1_1OneD_sound) (w := B2_1_5U2_1_1EOneDLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def B2_1_5U2_1_1EOneD : Ball := ⟨(1031606223518958138592984398949 / 25000000000000000000000000000000), (10141461951 / 25000000000000000000000000000000)⟩ +lemma B2_1_5U2_1_1EOneD_sound : B2_1_5U2_1_1EOneD.Encloses (Foundation.entropyTerm ((1 - (binaryParameter (shape 2 1 5) (shape 2 1 1) : ℝ)))) := by + exact contains_sound (entropyTerm_ball (B2_1_5U2_1_1OneD_sound) B2_1_5U2_1_1EOneDLog_sound) (by decide +kernel) +def B2_1_5U2_1_1BinaryEntropy : Ball := ⟨(4079899946179837320085215066313 / 20000000000000000000000000000000), (47709046057 / 100000000000000000000000000000000)⟩ +lemma B2_1_5U2_1_1BinaryEntropy_sound : B2_1_5U2_1_1BinaryEntropy.Encloses + (binaryEntropyRate (binaryParameter (shape 2 1 5) (shape 2 1 1))) := by + exact contains_sound (Ball.add_sound (Ball.add_sound B2_1_5U2_1_1EOneD_sound B2_1_5U2_1_1ED_sound) + (Ball.mul_sound B2_1_5U2_1_1D_sound logN2_sound)) (by decide +kernel) +def B2_1_5U2_1_1Leaf : Ball := ⟨(315101226585250447280610230069167 / 100000000000000000000000000000000), (62188121377 / 50000000000000000000000000000000)⟩ +lemma B2_1_5U2_1_1Leaf_sound : B2_1_5U2_1_1Leaf.Encloses (AllFieldTerminalRates.secondLeafRate (shape 2 1 5) (shape 2 1 1)) := by + have hh : shapeMax (shape 2 1 1) = 2 := by decide +kernel + have hp : positive (shape 2 1 1) = true := by decide +kernel + simp only [AllFieldTerminalRates.secondLeafRate, hh, hp, Bool.not_true, Bool.false_eq_true, + show (2 : ℕ) ≠ 4 by decide, show (2 : ℕ) ≠ 3 by decide, ite_false] + have ht : (Ball.exact (978917 / 500000)).Encloses (2 - (binaryParameter (shape 2 1 5) (shape 2 1 1) : ℝ)) := by + have he : binaryParameter (shape 2 1 5) (shape 2 1 1) = (21083 / 500000) := by decide +kernel + rw [he] + convert Ball.exact_sound ((978917 / 500000) : ℚ) using 1; norm_num [Ball.exact] + exact contains_sound (Ball.mul_sound ht logN5_sound) (by decide +kernel) +def B2_1_5U2_1_1Mass : Ball := ⟨(11980229688179108495838363 / 195312500000000000000000000000), (1 / 100000000000000000000000000000000)⟩ +lemma B2_1_5U2_1_1Mass_sound : B2_1_5U2_1_1Mass.Encloses (littleMass (shape 2 1 5) (shape 2 1 1) : ℝ) := by + rw [littleMass_cast] + exact contains_sound (Ball.mul_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) (second_2_1_5)) + (B2_1_5Law_sound (shape 2 1 1))) (by decide +kernel) +def B2_1_5Leaves (s : Shape) : Ball := + match s 0, s 1, s 2 with + | 0, 0, 4 => B2_1_5U0_0_4Leaf + | 0, 1, 3 => B2_1_5U0_1_3Leaf + | 1, 0, 3 => B2_1_5U1_0_3Leaf + | 1, 1, 2 => B2_1_5U1_1_2Leaf + | 2, 0, 2 => B2_1_5U2_0_2Leaf + | 2, 1, 1 => B2_1_5U2_1_1Leaf + | _, _, _ => (.exact 0) +lemma B2_1_5Leaves_sound (u : Shape) (hu : u ∈ below (shape 2 1 5)) : + (B2_1_5Leaves u).Encloses (AllFieldTerminalRates.secondLeafRate (shape 2 1 5) u) := by + rw [B2_1_5_below] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl | rfl | rfl + · exact B2_1_5U0_0_4Leaf_sound + · exact B2_1_5U0_1_3Leaf_sound + · exact B2_1_5U1_0_3Leaf_sound + · exact B2_1_5U1_1_2Leaf_sound + · exact B2_1_5U2_0_2Leaf_sound + · exact B2_1_5U2_1_1Leaf_sound +def B2_1_5Masses (s : Shape) : Ball := + match s 0, s 1, s 2 with + | 0, 0, 4 => B2_1_5U0_0_4Mass + | 0, 1, 3 => B2_1_5U0_1_3Mass + | 1, 0, 3 => B2_1_5U1_0_3Mass + | 1, 1, 2 => B2_1_5U1_1_2Mass + | 2, 0, 2 => B2_1_5U2_0_2Mass + | 2, 1, 1 => B2_1_5U2_1_1Mass + | _, _, _ => (.exact 0) +lemma B2_1_5Masses_sound (u : Shape) (hu : u ∈ below (shape 2 1 5)) : + (B2_1_5Masses u).Encloses ((fun u => (littleMass (shape 2 1 5) u : ℝ)) u) := by + rw [B2_1_5_below] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl | rfl | rfl + · exact B2_1_5U0_0_4Mass_sound + · exact B2_1_5U0_1_3Mass_sound + · exact B2_1_5U1_0_3Mass_sound + · exact B2_1_5U1_1_2Mass_sound + · exact B2_1_5U2_0_2Mass_sound + · exact B2_1_5U2_1_1Mass_sound +def B2_1_5Binaries (s : Shape) : Ball := + match s 0, s 1, s 2 with + | 1, 1, 2 => B2_1_5U1_1_2BinaryEntropy + | 2, 0, 2 => B2_1_5U2_0_2BinaryEntropy + | 2, 1, 1 => B2_1_5U2_1_1BinaryEntropy + | _, _, _ => (.exact 0) +lemma B2_1_5Binaries_sound (u : Shape) (hu : u ∈ (below (shape 2 1 5)).filter positive) : + (B2_1_5Binaries u).Encloses ((fun u => binaryEntropyRate (binaryParameter (shape 2 1 5) u)) u) := by + have hl : (below (shape 2 1 5)).filter positive = [(shape 1 1 2), (shape 2 1 1)] := by decide +kernel + rw [hl] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl + · exact B2_1_5U1_1_2BinaryEntropy_sound + · exact B2_1_5U2_1_1BinaryEntropy_sound +def B2_1_5S2 : Ball := ⟨(187018983303151686119192103891 / 1000000000000000000000000000000), (7633330409 / 100000000000000000000000000000000)⟩ +lemma B2_1_5S2_sound : B2_1_5S2.Encloses + (((below (shape 2 1 5)).map fun u => (littleMass (shape 2 1 5) u : ℝ) * AllFieldTerminalRates.secondLeafRate (shape 2 1 5) u).sum) := by + exact contains_sound (listSumBall_sound (below (shape 2 1 5)) + (fun u => .mul (B2_1_5Masses u) (B2_1_5Leaves u)) _ + (fun u hu => Ball.mul_sound (B2_1_5Masses_sound u hu) (B2_1_5Leaves_sound u hu))) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/Certificates/Terminal2_2_4.lean b/lean/OAI/LinearAlgebra/MatrixFields/Certificates/Terminal2_2_4.lean new file mode 100644 index 0000000000000000000000000000000000000000..a723772a09301a4d5281348c8145bfcfb7017f0f --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/Certificates/Terminal2_2_4.lean @@ -0,0 +1,738 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Certificates.LittleB1_3_4 +import OAI.LinearAlgebra.MatrixFields.Certificates.Terminal1_1_6 + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate +open scoped BigOperators +lemma B2_2_4_below : below (shape 2 2 4) = [ + (shape 0 0 4), + (shape 0 1 3), + (shape 0 2 2), + (shape 1 0 3), + (shape 1 1 2), + (shape 1 2 1), + (shape 2 0 2), + (shape 2 1 1), + (shape 2 2 0)] := by decide +kernel +def B2_2_4Raw (s : Shape) : Ball := + match s 0, s 1, s 2 with + | 0, 0, 4 => ⟨(3985809275202830388494116183 / 10000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 0, 1, 3 => ⟨(1687715475618203929478025269739 / 25000000000000000000000000000000), (3 / 20000000000000000000000000000000)⟩ + | 0, 2, 2 => ⟨(658685387040686388916222849389 / 2500000000000000000000000000000), (67 / 100000000000000000000000000000000)⟩ + | 1, 0, 3 => ⟨(1687715475618203929478025269739 / 25000000000000000000000000000000), (3 / 20000000000000000000000000000000)⟩ + | 1, 1, 2 => ⟨1, 0⟩ + | 1, 2, 1 => ⟨(1687715475618203929478025269739 / 25000000000000000000000000000000), (3 / 20000000000000000000000000000000)⟩ + | 2, 0, 2 => ⟨(658685387040686388916222849389 / 2500000000000000000000000000000), (67 / 100000000000000000000000000000000)⟩ + | 2, 1, 1 => ⟨(1687715475618203929478025269739 / 25000000000000000000000000000000), (3 / 20000000000000000000000000000000)⟩ + | 2, 2, 0 => ⟨(3985809275202830388494116183 / 10000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | _, _, _ => (.exact 0) +lemma B2_2_4Raw_0_0_4 : (B2_2_4Raw (shape 0 0 4)).Encloses (splitWeight positiveSecond tablep (shape 2 2 4) (shape 0 0 4) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveSecond tablep (shape 2 2 4) (shape 0 0 4) + (-6669) (-6669) (-64938) w153 w153 w16 + (by decide +kernel) w153_sound w153_sound w16_sound) (by decide +kernel) +lemma B2_2_4Raw_0_1_3 : (B2_2_4Raw (shape 0 1 3)).Encloses (splitWeight positiveSecond tablep (shape 2 2 4) (shape 0 1 3) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveSecond tablep (shape 2 2 4) (shape 0 1 3) + (-6669) (0) (-20286) w153 w195 w85 + (by decide +kernel) w153_sound w195_sound w85_sound) (by decide +kernel) +lemma B2_2_4Raw_0_2_2 : (B2_2_4Raw (shape 0 2 2)).Encloses (splitWeight positiveSecond tablep (shape 2 2 4) (shape 0 2 2) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveSecond tablep (shape 2 2 4) (shape 0 2 2) + (-6669) (-6669) (0) w153 w153 w195 + (by decide +kernel) w153_sound w153_sound w195_sound) (by decide +kernel) +lemma B2_2_4Raw_1_0_3 : (B2_2_4Raw (shape 1 0 3)).Encloses (splitWeight positiveSecond tablep (shape 2 2 4) (shape 1 0 3) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveSecond tablep (shape 2 2 4) (shape 1 0 3) + (0) (-6669) (-20286) w195 w153 w85 + (by decide +kernel) w195_sound w153_sound w85_sound) (by decide +kernel) +lemma B2_2_4Raw_1_1_2 : (B2_2_4Raw (shape 1 1 2)).Encloses (splitWeight positiveSecond tablep (shape 2 2 4) (shape 1 1 2) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveSecond tablep (shape 2 2 4) (shape 1 1 2) + (0) (0) (0) w195 w195 w195 + (by decide +kernel) w195_sound w195_sound w195_sound) (by decide +kernel) +lemma B2_2_4Raw_1_2_1 : (B2_2_4Raw (shape 1 2 1)).Encloses (splitWeight positiveSecond tablep (shape 2 2 4) (shape 1 2 1) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveSecond tablep (shape 2 2 4) (shape 1 2 1) + (0) (-6669) (-20286) w195 w153 w85 + (by decide +kernel) w195_sound w153_sound w85_sound) (by decide +kernel) +lemma B2_2_4Raw_2_0_2 : (B2_2_4Raw (shape 2 0 2)).Encloses (splitWeight positiveSecond tablep (shape 2 2 4) (shape 2 0 2) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveSecond tablep (shape 2 2 4) (shape 2 0 2) + (-6669) (-6669) (0) w153 w153 w195 + (by decide +kernel) w153_sound w153_sound w195_sound) (by decide +kernel) +lemma B2_2_4Raw_2_1_1 : (B2_2_4Raw (shape 2 1 1)).Encloses (splitWeight positiveSecond tablep (shape 2 2 4) (shape 2 1 1) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveSecond tablep (shape 2 2 4) (shape 2 1 1) + (-6669) (0) (-20286) w153 w195 w85 + (by decide +kernel) w153_sound w195_sound w85_sound) (by decide +kernel) +lemma B2_2_4Raw_2_2_0 : (B2_2_4Raw (shape 2 2 0)).Encloses (splitWeight positiveSecond tablep (shape 2 2 4) (shape 2 2 0) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveSecond tablep (shape 2 2 4) (shape 2 2 0) + (-6669) (-6669) (-64938) w153 w153 w16 + (by decide +kernel) w153_sound w153_sound w16_sound) (by decide +kernel) +lemma B2_2_4Raw_sound (u : Shape) (hu : u ∈ below (shape 2 2 4)) : + (B2_2_4Raw u).Encloses (splitWeight positiveSecond tablep (shape 2 2 4) u : ℝ) := by + rw [B2_2_4_below] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl + · exact B2_2_4Raw_0_0_4 + · exact B2_2_4Raw_0_1_3 + · exact B2_2_4Raw_0_2_2 + · exact B2_2_4Raw_1_0_3 + · exact B2_2_4Raw_1_1_2 + · exact B2_2_4Raw_1_2_1 + · exact B2_2_4Raw_2_0_2 + · exact B2_2_4Raw_2_1_1 + · exact B2_2_4Raw_2_2_0 +def B2_2_4Den : Ball := ⟨(44944498689662557648179028647651 / 25000000000000000000000000000000), (49 / 25000000000000000000000000000000)⟩ +lemma B2_2_4Den_sound : B2_2_4Den.Encloses (((below (shape 2 2 4)).map (splitWeight positiveSecond tablep (shape 2 2 4))).sum : ℝ) := by + exact contains_sound (list_cast_enclosed (below (shape 2 2 4)) B2_2_4Raw (splitWeight positiveSecond tablep (shape 2 2 4)) B2_2_4Raw_sound) (by decide +kernel) +lemma B2_2_4Den_positive : 0 < B2_2_4Den.lower := by decide +kernel +def B2_2_4Table (s : Shape) : Ball := + match s 0, s 1, s 2 with + | 0, 0, 4 => ⟨(22170729407421252075742212347 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 0, 1, 3 => ⟨(1877555123344146106224953559491 / 50000000000000000000000000000000), (13 / 100000000000000000000000000000000)⟩ + | 0, 2, 2 => ⟨(7327764312033444386854140531431 / 50000000000000000000000000000000), (27 / 50000000000000000000000000000000)⟩ + | 1, 0, 3 => ⟨(1877555123344146106224953559491 / 50000000000000000000000000000000), (13 / 100000000000000000000000000000000)⟩ + | 1, 1, 2 => ⟨(6953020038287276387329040621707 / 12500000000000000000000000000000), (31 / 50000000000000000000000000000000)⟩ + | 1, 2, 1 => ⟨(1877555123344146106224953559491 / 50000000000000000000000000000000), (13 / 100000000000000000000000000000000)⟩ + | 2, 0, 2 => ⟨(7327764312033444386854140531431 / 50000000000000000000000000000000), (27 / 50000000000000000000000000000000)⟩ + | 2, 1, 1 => ⟨(1877555123344146106224953559491 / 50000000000000000000000000000000), (13 / 100000000000000000000000000000000)⟩ + | 2, 2, 0 => ⟨(22170729407421252075742212347 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | _, _, _ => (.exact 0) +def B2_2_4Law (u : Shape) : Ball := if u ∈ below (shape 2 2 4) then B2_2_4Table u else .exact 0 +lemma B2_2_4Law_check_0_0_4 : contains (.mul (B2_2_4Raw (shape 0 0 4)) (.inv B2_2_4Den)) (B2_2_4Table (shape 0 0 4)) = true := by decide +kernel +lemma B2_2_4Law_check_0_1_3 : contains (.mul (B2_2_4Raw (shape 0 1 3)) (.inv B2_2_4Den)) (B2_2_4Table (shape 0 1 3)) = true := by decide +kernel +lemma B2_2_4Law_check_0_2_2 : contains (.mul (B2_2_4Raw (shape 0 2 2)) (.inv B2_2_4Den)) (B2_2_4Table (shape 0 2 2)) = true := by decide +kernel +lemma B2_2_4Law_check_1_0_3 : contains (.mul (B2_2_4Raw (shape 1 0 3)) (.inv B2_2_4Den)) (B2_2_4Table (shape 1 0 3)) = true := by decide +kernel +lemma B2_2_4Law_check_1_1_2 : contains (.mul (B2_2_4Raw (shape 1 1 2)) (.inv B2_2_4Den)) (B2_2_4Table (shape 1 1 2)) = true := by decide +kernel +lemma B2_2_4Law_check_1_2_1 : contains (.mul (B2_2_4Raw (shape 1 2 1)) (.inv B2_2_4Den)) (B2_2_4Table (shape 1 2 1)) = true := by decide +kernel +lemma B2_2_4Law_check_2_0_2 : contains (.mul (B2_2_4Raw (shape 2 0 2)) (.inv B2_2_4Den)) (B2_2_4Table (shape 2 0 2)) = true := by decide +kernel +lemma B2_2_4Law_check_2_1_1 : contains (.mul (B2_2_4Raw (shape 2 1 1)) (.inv B2_2_4Den)) (B2_2_4Table (shape 2 1 1)) = true := by decide +kernel +lemma B2_2_4Law_check_2_2_0 : contains (.mul (B2_2_4Raw (shape 2 2 0)) (.inv B2_2_4Den)) (B2_2_4Table (shape 2 2 0)) = true := by decide +kernel +lemma B2_2_4Law_check (u : Shape) (hu : u ∈ below (shape 2 2 4)) : + contains (.mul (B2_2_4Raw u) (.inv B2_2_4Den)) (B2_2_4Table u) = true := by + rw [B2_2_4_below] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl + · exact B2_2_4Law_check_0_0_4 + · exact B2_2_4Law_check_0_1_3 + · exact B2_2_4Law_check_0_2_2 + · exact B2_2_4Law_check_1_0_3 + · exact B2_2_4Law_check_1_1_2 + · exact B2_2_4Law_check_1_2_1 + · exact B2_2_4Law_check_2_0_2 + · exact B2_2_4Law_check_2_1_1 + · exact B2_2_4Law_check_2_2_0 +lemma B2_2_4Law_sound (u : Shape) : + (B2_2_4Law u).Encloses (stageBLaw (shape 2 2 4) u : ℝ) := by + by_cases hu : u ∈ below (shape 2 2 4) + · have h := contains_sound (Ball.mul_sound (B2_2_4Raw_sound u hu) + (Ball.inv_sound B2_2_4Den_sound B2_2_4Den_positive)) (B2_2_4Law_check u hu) + simpa only [B2_2_4Law, hu, ite_true, stageBLaw, splitLaw, + Rat.cast_div, Rat.cast_mul, Rat.cast_inv, div_eq_mul_inv] using h + · simp only [B2_2_4Law, hu, ite_false, stageBLaw, splitLaw, Rat.cast_zero] + simpa only [Rat.cast_zero] using Ball.exact_sound 0 + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def B2_2_4Binary (u : Shape) : ℚ := + match u 0, u 1, u 2 with + | 0, 2, 2 => (51781 / 500000) + | 1, 1, 2 => (9039 / 1000000) + | 1, 2, 1 => (42157 / 1000000) + | 2, 0, 2 => (103577 / 1000000) + | 2, 1, 1 => (8433 / 200000) + | 2, 2, 0 => (31791 / 500000) + | _, _, _ => 0 +lemma B2_2_4Binary_eq (u : Shape) (hu : u ∈ shapes 4) : + binaryParameter (shape 2 2 4) u = B2_2_4Binary u := by + rw [shapes4_list] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel +def B2_2_4LittleRat (u : Shape) (w : Fin 3) (i : Fin 6) : ℚ := + if u w = 2 then + if i = 2 then 1 - B2_2_4Binary u else if i = 3 then B2_2_4Binary u else 0 + else if i = singletonSlot (u w) then 1 else 0 + +def B2_2_4Little (u : Shape) (w : Fin 3) (i : Fin 6) : Ball := + if u ∈ shapes 4 then .exact (B2_2_4LittleRat u w i) + else .exact (littleLaw (shape 2 2 4) u w i) + +lemma B2_2_4Little_sound (u : Shape) (w : Fin 3) (i : Fin 6) : + (B2_2_4Little u w i).Encloses (littleLaw (shape 2 2 4) u w i : ℝ) := by + by_cases hu : u ∈ shapes 4 + · simp only [B2_2_4Little, hu, ite_true] + apply exact_rat_enclosed + simp only [B2_2_4LittleRat, littleLaw, B2_2_4Binary_eq u hu] + · simp only [B2_2_4Little, hu, ite_false] + exact Ball.exact_sound _ +def B2_2_4Half (w : Fin 3) (ij : PairSlot) : Ball := + match w.val, ij.1.val, ij.2.val with + | 0, 0, 2 => ⟨(8377545014499415800266058795763 / 50000000000000000000000000000000), (63 / 100000000000000000000000000000000)⟩ + | 0, 0, 3 => ⟨(335543914232754127540362560533 / 20000000000000000000000000000000), (7 / 100000000000000000000000000000000)⟩ + | 0, 1, 1 => ⟨(3156719039983739776176606960581 / 5000000000000000000000000000000), (11 / 12500000000000000000000000000000)⟩ + | 0, 2, 0 => ⟨(8377545014499415800266058795763 / 50000000000000000000000000000000), (63 / 100000000000000000000000000000000)⟩ + | 0, 3, 0 => ⟨(335543914232754127540362560533 / 20000000000000000000000000000000), (7 / 100000000000000000000000000000000)⟩ + | 1, 0, 2 => ⟨(16755339902810166110201422814999 / 100000000000000000000000000000000), (63 / 100000000000000000000000000000000)⟩ + | 1, 0, 3 => ⟨(209683712169054516004063447399 / 12500000000000000000000000000000), (7 / 100000000000000000000000000000000)⟩ + | 1, 1, 1 => ⟨(3156719039983739776176606960581 / 5000000000000000000000000000000), (11 / 12500000000000000000000000000000)⟩ + | 1, 2, 0 => ⟨(16755339902810166110201422814999 / 100000000000000000000000000000000), (63 / 100000000000000000000000000000000)⟩ + | 1, 3, 0 => ⟨(209683712169054516004063447399 / 12500000000000000000000000000000), (7 / 100000000000000000000000000000000)⟩ + | 2, 5, 0 => ⟨(22170729407421252075742212347 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 2, 4, 1 => ⟨(1877555123344146106224953559491 / 25000000000000000000000000000000), (13 / 50000000000000000000000000000000)⟩ + | 2, 2, 2 => ⟨(1563542695666112973568998103859 / 2000000000000000000000000000000), (149 / 100000000000000000000000000000000)⟩ + | 2, 2, 3 => ⟨(3219564442457119163781284689913 / 100000000000000000000000000000000), (11 / 100000000000000000000000000000000)⟩ + | 2, 3, 2 => ⟨(3219564442457119163781284689913 / 100000000000000000000000000000000), (11 / 100000000000000000000000000000000)⟩ + | 2, 3, 3 => ⟨(79738471553025410009103131651 / 25000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ + | 2, 1, 4 => ⟨(1877555123344146106224953559491 / 25000000000000000000000000000000), (13 / 50000000000000000000000000000000)⟩ + | 2, 0, 5 => ⟨(22170729407421252075742212347 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | _, _, _ => (.exact 0) +lemma B2_2_4Half_check_0_0 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 2 2 4)) (shape 2 2 4) B2_2_4Law + (fun u => B2_2_4Little u 0) ((0 : Fin 6),j)) (B2_2_4Half 0 (0,j)) = true := by + decide +kernel +lemma B2_2_4Half_check_0_1 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 2 2 4)) (shape 2 2 4) B2_2_4Law + (fun u => B2_2_4Little u 0) ((1 : Fin 6),j)) (B2_2_4Half 0 (1,j)) = true := by + decide +kernel +lemma B2_2_4Half_check_0_2 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 2 2 4)) (shape 2 2 4) B2_2_4Law + (fun u => B2_2_4Little u 0) ((2 : Fin 6),j)) (B2_2_4Half 0 (2,j)) = true := by + decide +kernel +lemma B2_2_4Half_check_0_3 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 2 2 4)) (shape 2 2 4) B2_2_4Law + (fun u => B2_2_4Little u 0) ((3 : Fin 6),j)) (B2_2_4Half 0 (3,j)) = true := by + decide +kernel +lemma B2_2_4Half_check_0_4 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 2 2 4)) (shape 2 2 4) B2_2_4Law + (fun u => B2_2_4Little u 0) ((4 : Fin 6),j)) (B2_2_4Half 0 (4,j)) = true := by + decide +kernel +lemma B2_2_4Half_check_0_5 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 2 2 4)) (shape 2 2 4) B2_2_4Law + (fun u => B2_2_4Little u 0) ((5 : Fin 6),j)) (B2_2_4Half 0 (5,j)) = true := by + decide +kernel +lemma B2_2_4Half_check_1_0 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 2 2 4)) (shape 2 2 4) B2_2_4Law + (fun u => B2_2_4Little u 1) ((0 : Fin 6),j)) (B2_2_4Half 1 (0,j)) = true := by + decide +kernel +lemma B2_2_4Half_check_1_1 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 2 2 4)) (shape 2 2 4) B2_2_4Law + (fun u => B2_2_4Little u 1) ((1 : Fin 6),j)) (B2_2_4Half 1 (1,j)) = true := by + decide +kernel +lemma B2_2_4Half_check_1_2 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 2 2 4)) (shape 2 2 4) B2_2_4Law + (fun u => B2_2_4Little u 1) ((2 : Fin 6),j)) (B2_2_4Half 1 (2,j)) = true := by + decide +kernel +lemma B2_2_4Half_check_1_3 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 2 2 4)) (shape 2 2 4) B2_2_4Law + (fun u => B2_2_4Little u 1) ((3 : Fin 6),j)) (B2_2_4Half 1 (3,j)) = true := by + decide +kernel +lemma B2_2_4Half_check_1_4 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 2 2 4)) (shape 2 2 4) B2_2_4Law + (fun u => B2_2_4Little u 1) ((4 : Fin 6),j)) (B2_2_4Half 1 (4,j)) = true := by + decide +kernel +lemma B2_2_4Half_check_1_5 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 2 2 4)) (shape 2 2 4) B2_2_4Law + (fun u => B2_2_4Little u 1) ((5 : Fin 6),j)) (B2_2_4Half 1 (5,j)) = true := by + decide +kernel +lemma B2_2_4Half_check_2_0 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 2 2 4)) (shape 2 2 4) B2_2_4Law + (fun u => B2_2_4Little u 2) ((0 : Fin 6),j)) (B2_2_4Half 2 (0,j)) = true := by + decide +kernel +lemma B2_2_4Half_check_2_1 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 2 2 4)) (shape 2 2 4) B2_2_4Law + (fun u => B2_2_4Little u 2) ((1 : Fin 6),j)) (B2_2_4Half 2 (1,j)) = true := by + decide +kernel +lemma B2_2_4Half_check_2_2 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 2 2 4)) (shape 2 2 4) B2_2_4Law + (fun u => B2_2_4Little u 2) ((2 : Fin 6),j)) (B2_2_4Half 2 (2,j)) = true := by + decide +kernel +lemma B2_2_4Half_check_2_3 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 2 2 4)) (shape 2 2 4) B2_2_4Law + (fun u => B2_2_4Little u 2) ((3 : Fin 6),j)) (B2_2_4Half 2 (3,j)) = true := by + decide +kernel +lemma B2_2_4Half_check_2_4 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 2 2 4)) (shape 2 2 4) B2_2_4Law + (fun u => B2_2_4Little u 2) ((4 : Fin 6),j)) (B2_2_4Half 2 (4,j)) = true := by + decide +kernel +lemma B2_2_4Half_check_2_5 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 2 2 4)) (shape 2 2 4) B2_2_4Law + (fun u => B2_2_4Little u 2) ((5 : Fin 6),j)) (B2_2_4Half 2 (5,j)) = true := by + decide +kernel +lemma B2_2_4Half_sound (w : Fin 3) (ij : PairSlot) : + (B2_2_4Half w ij).Encloses (halfLaw (shape 2 2 4) w ij : ℝ) := by + have hcheck : contains (pairLawBall (below (shape 2 2 4)) (shape 2 2 4) B2_2_4Law + (fun u => B2_2_4Little u w) ij) (B2_2_4Half w ij) = true := by + rcases ij with ⟨i,j⟩ + revert i w + apply forall_fin3 + · exact forall_fin6 (B2_2_4Half_check_0_0 j) (B2_2_4Half_check_0_1 j) (B2_2_4Half_check_0_2 j) (B2_2_4Half_check_0_3 j) (B2_2_4Half_check_0_4 j) (B2_2_4Half_check_0_5 j) + · exact forall_fin6 (B2_2_4Half_check_1_0 j) (B2_2_4Half_check_1_1 j) (B2_2_4Half_check_1_2 j) (B2_2_4Half_check_1_3 j) (B2_2_4Half_check_1_4 j) (B2_2_4Half_check_1_5 j) + · exact forall_fin6 (B2_2_4Half_check_2_0 j) (B2_2_4Half_check_2_1 j) (B2_2_4Half_check_2_2 j) (B2_2_4Half_check_2_3 j) (B2_2_4Half_check_2_4 j) (B2_2_4Half_check_2_5 j) + have h := contains_sound (pairLawBall_sound (below (shape 2 2 4)) (shape 2 2 4) + B2_2_4Law (fun u => (stageBLaw (shape 2 2 4) u : ℝ)) + (fun u => B2_2_4Little u w) (fun u i => (littleLaw (shape 2 2 4) u w i : ℝ)) + (fun u _ => B2_2_4Law_sound u) (fun u i => B2_2_4Little_sound u w i) ij) hcheck + have hp : positive (shape 2 2 4) = true := by decide +kernel + simpa only [halfLaw, hp, ite_true, pairLaw, positiveHalfLaw, Rat.cast_list_sum, + List.map_map, Function.comp_def, Rat.cast_mul] using h + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def B2_2_4U0_0_4Leaf : Ball := ⟨0, 0⟩ +lemma B2_2_4U0_0_4Leaf_sound : B2_2_4U0_0_4Leaf.Encloses (AllFieldTerminalRates.secondLeafRate (shape 2 2 4) (shape 0 0 4)) := by + have hh : shapeMax (shape 0 0 4) = 4 := by decide +kernel + simp only [AllFieldTerminalRates.secondLeafRate, hh, ite_true] + simpa only [B2_2_4U0_0_4Leaf, Ball.exact, Rat.cast_zero] using Ball.exact_sound 0 +def B2_2_4U0_0_4Mass : Ball := ⟨(459983845027779558302590723 / 3125000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ +lemma B2_2_4U0_0_4Mass_sound : B2_2_4U0_0_4Mass.Encloses (littleMass (shape 2 2 4) (shape 0 0 4) : ℝ) := by + rw [littleMass_cast] + exact contains_sound (Ball.mul_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) (second_2_2_4)) + (B2_2_4Law_sound (shape 0 0 4))) (by decide +kernel) +def B2_2_4U0_1_3Leaf : Ball := ⟨(115129254649702284200899544090987 / 50000000000000000000000000000000), (21175823683 / 25000000000000000000000000000000)⟩ +lemma B2_2_4U0_1_3Leaf_sound : B2_2_4U0_1_3Leaf.Encloses (AllFieldTerminalRates.secondLeafRate (shape 2 2 4) (shape 0 1 3)) := by + have hh : shapeMax (shape 0 1 3) = 3 := by decide +kernel + simp only [AllFieldTerminalRates.secondLeafRate, hh, show (3 : ℕ) ≠ 4 by decide, ite_false, ite_true] + exact logN10_sound +def B2_2_4U0_1_3Mass : Ball := ⟨(1246537282943313726061518292613 / 50000000000000000000000000000000), (1 / 3125000000000000000000000000000)⟩ +lemma B2_2_4U0_1_3Mass_sound : B2_2_4U0_1_3Mass.Encloses (littleMass (shape 2 2 4) (shape 0 1 3) : ℝ) := by + rw [littleMass_cast] + exact contains_sound (Ball.mul_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) (second_2_2_4)) + (B2_2_4Law_sound (shape 0 1 3))) (by decide +kernel) +def B2_2_4U0_2_2D : Ball := .exact (51781 / 500000) +lemma B2_2_4U0_2_2D_sound : B2_2_4U0_2_2D.Encloses (binaryParameter (shape 2 2 4) (shape 0 2 2) : ℝ) := by + apply exact_rat_enclosed + decide +kernel +def B2_2_4U0_2_2OneD : Ball := .exact (448219 / 500000) +lemma B2_2_4U0_2_2OneD_sound : B2_2_4U0_2_2OneD.Encloses (1 - (binaryParameter (shape 2 2 4) (shape 0 2 2) : ℝ)) := by + have he : binaryParameter (shape 2 2 4) (shape 0 2 2) = (51781 / 500000) := by decide +kernel + rw [he] + convert Ball.exact_sound ((448219 / 500000) : ℚ) using 1 <;> norm_num [B2_2_4U0_2_2OneD, Ball.exact] +def B2_2_4U0_2_2EDLogWitness : LogWitness := ⟨-4, 51781, 31250⟩ +def B2_2_4U0_2_2EDLog : Ball := ⟨(-226758481180942422019326103547823 / 100000000000000000000000000000000), (21175823683 / 20000000000000000000000000000000)⟩ +lemma B2_2_4U0_2_2EDLog_sound : B2_2_4U0_2_2EDLog.Encloses (Real.log ((binaryParameter (shape 2 2 4) (shape 0 2 2) : ℝ))) := by + exact checkLog_sound logTwoBall_sound (B2_2_4U0_2_2D_sound) (w := B2_2_4U0_2_2EDLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def B2_2_4U0_2_2ED : Ball := ⟨(1174178091403037955458272496781 / 5000000000000000000000000000000), (5482526631 / 50000000000000000000000000000000)⟩ +lemma B2_2_4U0_2_2ED_sound : B2_2_4U0_2_2ED.Encloses (Foundation.entropyTerm ((binaryParameter (shape 2 2 4) (shape 0 2 2) : ℝ))) := by + exact contains_sound (entropyTerm_ball (B2_2_4U0_2_2D_sound) B2_2_4U0_2_2EDLog_sound) (by decide +kernel) +def B2_2_4U0_2_2EOneDLogWitness : LogWitness := ⟨-1, 448219, 250000⟩ +def B2_2_4U0_2_2EOneDLog : Ball := ⟨(-2186522923289837780427151140763 / 20000000000000000000000000000000), (21175823683 / 50000000000000000000000000000000)⟩ +lemma B2_2_4U0_2_2EOneDLog_sound : B2_2_4U0_2_2EOneDLog.Encloses (Real.log ((1 - (binaryParameter (shape 2 2 4) (shape 0 2 2) : ℝ)))) := by + exact checkLog_sound logTwoBall_sound (B2_2_4U0_2_2OneD_sound) (w := B2_2_4U0_2_2EOneDLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def B2_2_4U0_2_2EOneD : Ball := ⟨(9800411181540478001052772571617 / 100000000000000000000000000000000), (18982813031 / 50000000000000000000000000000000)⟩ +lemma B2_2_4U0_2_2EOneD_sound : B2_2_4U0_2_2EOneD.Encloses (Foundation.entropyTerm ((1 - (binaryParameter (shape 2 2 4) (shape 0 2 2) : ℝ)))) := by + exact contains_sound (entropyTerm_ball (B2_2_4U0_2_2OneD_sound) B2_2_4U0_2_2EOneDLog_sound) (by decide +kernel) +def B2_2_4U0_2_2BinaryEntropy : Ball := ⟨(8092468768183228544720991965183 / 20000000000000000000000000000000), (53316700629 / 100000000000000000000000000000000)⟩ +lemma B2_2_4U0_2_2BinaryEntropy_sound : B2_2_4U0_2_2BinaryEntropy.Encloses + (binaryEntropyRate (binaryParameter (shape 2 2 4) (shape 0 2 2))) := by + exact contains_sound (Ball.add_sound (Ball.add_sound B2_2_4U0_2_2EOneD_sound B2_2_4U0_2_2ED_sound) + (Ball.mul_sound B2_2_4U0_2_2D_sound logN2_sound)) (by decide +kernel) +def B2_2_4U0_2_2Leaf : Ball := ⟨(82253651127559039261218997596489 / 25000000000000000000000000000000), (83606789407 / 50000000000000000000000000000000)⟩ +lemma B2_2_4U0_2_2Leaf_sound : B2_2_4U0_2_2Leaf.Encloses (AllFieldTerminalRates.secondLeafRate (shape 2 2 4) (shape 0 2 2)) := by + have hh : shapeMax (shape 0 2 2) = 2 := by decide +kernel + have hp : positive (shape 0 2 2) = false := by decide +kernel + simp only [AllFieldTerminalRates.secondLeafRate, hh, hp, Bool.not_false, + show (2 : ℕ) ≠ 4 by decide, show (2 : ℕ) ≠ 3 by decide, ite_false, ite_true] + exact contains_sound (Ball.add_sound B2_2_4U0_2_2BinaryEntropy_sound + (Ball.mul_sound (Ball.mul_sound (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) + B2_2_4U0_2_2OneD_sound) logN5_sound)) (by decide +kernel) +def B2_2_4U0_2_2Mass : Ball := ⟨(973002741917034495619167964551 / 10000000000000000000000000000000), (1 / 781250000000000000000000000000)⟩ +lemma B2_2_4U0_2_2Mass_sound : B2_2_4U0_2_2Mass.Encloses (littleMass (shape 2 2 4) (shape 0 2 2) : ℝ) := by + rw [littleMass_cast] + exact contains_sound (Ball.mul_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) (second_2_2_4)) + (B2_2_4Law_sound (shape 0 2 2))) (by decide +kernel) +def B2_2_4U1_0_3Leaf : Ball := ⟨(115129254649702284200899544090987 / 50000000000000000000000000000000), (21175823683 / 25000000000000000000000000000000)⟩ +lemma B2_2_4U1_0_3Leaf_sound : B2_2_4U1_0_3Leaf.Encloses (AllFieldTerminalRates.secondLeafRate (shape 2 2 4) (shape 1 0 3)) := by + have hh : shapeMax (shape 1 0 3) = 3 := by decide +kernel + simp only [AllFieldTerminalRates.secondLeafRate, hh, show (3 : ℕ) ≠ 4 by decide, ite_false, ite_true] + exact logN10_sound +def B2_2_4U1_0_3Mass : Ball := ⟨(1246537282943313726061518292613 / 50000000000000000000000000000000), (1 / 3125000000000000000000000000000)⟩ +lemma B2_2_4U1_0_3Mass_sound : B2_2_4U1_0_3Mass.Encloses (littleMass (shape 2 2 4) (shape 1 0 3) : ℝ) := by + rw [littleMass_cast] + exact contains_sound (Ball.mul_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) (second_2_2_4)) + (B2_2_4Law_sound (shape 1 0 3))) (by decide +kernel) +def B2_2_4U1_1_2D : Ball := .exact (9039 / 1000000) +lemma B2_2_4U1_1_2D_sound : B2_2_4U1_1_2D.Encloses (binaryParameter (shape 2 2 4) (shape 1 1 2) : ℝ) := by + apply exact_rat_enclosed + decide +kernel +def B2_2_4U1_1_2OneD : Ball := .exact (990961 / 1000000) +lemma B2_2_4U1_1_2OneD_sound : B2_2_4U1_1_2OneD.Encloses (1 - (binaryParameter (shape 2 2 4) (shape 1 1 2) : ℝ)) := by + have he : binaryParameter (shape 2 2 4) (shape 1 1 2) = (9039 / 1000000) := by decide +kernel + rw [he] + convert Ball.exact_sound ((990961 / 1000000) : ℚ) using 1 <;> norm_num [B2_2_4U1_1_2OneD, Ball.exact] +def B2_2_4U1_1_2EDLogWitness : LogWitness := ⟨-7, 18078, 15625⟩ +def B2_2_4U1_1_2EDLog : Ball := ⟨(-23531033650829315888782626557599 / 5000000000000000000000000000000), (169406589463 / 100000000000000000000000000000000)⟩ +lemma B2_2_4U1_1_2EDLog_sound : B2_2_4U1_1_2EDLog.Encloses (Real.log ((binaryParameter (shape 2 2 4) (shape 1 1 2) : ℝ))) := by + exact checkLog_sound logTwoBall_sound (B2_2_4U1_1_2D_sound) (w := B2_2_4U1_1_2EDLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def B2_2_4U1_1_2ED : Ball := ⟨(4253940263396923726374123229083 / 100000000000000000000000000000000), (1531266163 / 100000000000000000000000000000000)⟩ +lemma B2_2_4U1_1_2ED_sound : B2_2_4U1_1_2ED.Encloses (Foundation.entropyTerm ((binaryParameter (shape 2 2 4) (shape 1 1 2) : ℝ))) := by + exact contains_sound (entropyTerm_ball (B2_2_4U1_1_2D_sound) B2_2_4U1_1_2EDLog_sound) (by decide +kernel) +def B2_2_4U1_1_2EOneDLogWitness : LogWitness := ⟨-1, 990961, 500000⟩ +def B2_2_4U1_1_2EOneDLog : Ball := ⟨(-56750622588966416224534897681 / 6250000000000000000000000000000), (21175823683 / 50000000000000000000000000000000)⟩ +lemma B2_2_4U1_1_2EOneDLog_sound : B2_2_4U1_1_2EOneDLog.Encloses (Real.log ((1 - (binaryParameter (shape 2 2 4) (shape 1 1 2) : ℝ)))) := by + exact checkLog_sound logTwoBall_sound (B2_2_4U1_1_2OneD_sound) (w := B2_2_4U1_1_2EOneDLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def B2_2_4U1_1_2EOneD : Ball := ⟨(449901229691077990306250613927 / 50000000000000000000000000000000), (20984415413 / 50000000000000000000000000000000)⟩ +lemma B2_2_4U1_1_2EOneD_sound : B2_2_4U1_1_2EOneD.Encloses (Foundation.entropyTerm ((1 - (binaryParameter (shape 2 2 4) (shape 1 1 2) : ℝ)))) := by + exact contains_sound (entropyTerm_ball (B2_2_4U1_1_2OneD_sound) B2_2_4U1_1_2EOneDLog_sound) (by decide +kernel) +def B2_2_4U1_1_2BinaryEntropy : Ball := ⟨(5780278459287214272168860398919 / 100000000000000000000000000000000), (4388291353 / 10000000000000000000000000000000)⟩ +lemma B2_2_4U1_1_2BinaryEntropy_sound : B2_2_4U1_1_2BinaryEntropy.Encloses + (binaryEntropyRate (binaryParameter (shape 2 2 4) (shape 1 1 2))) := by + exact contains_sound (Ball.add_sound (Ball.add_sound B2_2_4U1_1_2EOneD_sound B2_2_4U1_1_2ED_sound) + (Ball.mul_sound B2_2_4U1_1_2D_sound logN2_sound)) (by decide +kernel) +def B2_2_4U1_1_2Leaf : Ball := ⟨(320432811557770891591550164247193 / 100000000000000000000000000000000), (15810089661 / 12500000000000000000000000000000)⟩ +lemma B2_2_4U1_1_2Leaf_sound : B2_2_4U1_1_2Leaf.Encloses (AllFieldTerminalRates.secondLeafRate (shape 2 2 4) (shape 1 1 2)) := by + have hh : shapeMax (shape 1 1 2) = 2 := by decide +kernel + have hp : positive (shape 1 1 2) = true := by decide +kernel + simp only [AllFieldTerminalRates.secondLeafRate, hh, hp, Bool.not_true, Bool.false_eq_true, + show (2 : ℕ) ≠ 4 by decide, show (2 : ℕ) ≠ 3 by decide, ite_false] + have ht : (Ball.exact (1990961 / 1000000)).Encloses (2 - (binaryParameter (shape 2 2 4) (shape 1 1 2) : ℝ)) := by + have he : binaryParameter (shape 2 2 4) (shape 1 1 2) = (9039 / 1000000) := by decide +kernel + rw [he] + convert Ball.exact_sound ((1990961 / 1000000) : ℚ) using 1 + norm_num [Ball.exact] + exact contains_sound (Ball.mul_sound ht logN5_sound) (by decide +kernel) +def B2_2_4U1_1_2Mass : Ball := ⟨(18464861242187634366717571822117 / 50000000000000000000000000000000), (97 / 25000000000000000000000000000000)⟩ +lemma B2_2_4U1_1_2Mass_sound : B2_2_4U1_1_2Mass.Encloses (littleMass (shape 2 2 4) (shape 1 1 2) : ℝ) := by + rw [littleMass_cast] + exact contains_sound (Ball.mul_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) (second_2_2_4)) + (B2_2_4Law_sound (shape 1 1 2))) (by decide +kernel) +def B2_2_4U1_2_1D : Ball := .exact (42157 / 1000000) +lemma B2_2_4U1_2_1D_sound : B2_2_4U1_2_1D.Encloses (binaryParameter (shape 2 2 4) (shape 1 2 1) : ℝ) := by + apply exact_rat_enclosed + decide +kernel +def B2_2_4U1_2_1OneD : Ball := .exact (957843 / 1000000) +lemma B2_2_4U1_2_1OneD_sound : B2_2_4U1_2_1OneD.Encloses (1 - (binaryParameter (shape 2 2 4) (shape 1 2 1) : ℝ)) := by + have he : binaryParameter (shape 2 2 4) (shape 1 2 1) = (42157 / 1000000) := by decide +kernel + rw [he] + convert Ball.exact_sound ((957843 / 1000000) : ℚ) using 1 <;> norm_num [B2_2_4U1_2_1OneD, Ball.exact] +def B2_2_4U1_2_1EDLogWitness : LogWitness := ⟨-5, 42157, 31250⟩ +def B2_2_4U1_2_1EDLog : Ball := ⟨(-316635453477610100398073168374679 / 100000000000000000000000000000000), (127054942097 / 100000000000000000000000000000000)⟩ +lemma B2_2_4U1_2_1EDLog_sound : B2_2_4U1_2_1EDLog.Encloses (Real.log ((binaryParameter (shape 2 2 4) (shape 1 2 1) : ℝ))) := by + exact checkLog_sound logTwoBall_sound (B2_2_4U1_2_1D_sound) (w := B2_2_4U1_2_1EDLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def B2_2_4U1_2_1ED : Ball := ⟨(13348400812255609002481570559171 / 100000000000000000000000000000000), (1071251039 / 20000000000000000000000000000000)⟩ +lemma B2_2_4U1_2_1ED_sound : B2_2_4U1_2_1ED.Encloses (Foundation.entropyTerm ((binaryParameter (shape 2 2 4) (shape 1 2 1) : ℝ))) := by + exact contains_sound (entropyTerm_ball (B2_2_4U1_2_1D_sound) B2_2_4U1_2_1EDLog_sound) (by decide +kernel) +def B2_2_4U1_2_1EOneDLogWitness : LogWitness := ⟨-1, 957843, 500000⟩ +def B2_2_4U1_2_1EOneDLog : Ball := ⟨(-2153569876567388580629376620277 / 50000000000000000000000000000000), (21175823683 / 50000000000000000000000000000000)⟩ +lemma B2_2_4U1_2_1EOneDLog_sound : B2_2_4U1_2_1EOneDLog.Encloses (Real.log ((1 - (binaryParameter (shape 2 2 4) (shape 1 2 1) : ℝ)))) := by + exact checkLog_sound logTwoBall_sound (B2_2_4U1_2_1OneD_sound) (w := B2_2_4U1_2_1EOneDLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def B2_2_4U1_2_1EOneD : Ball := ⟨(128923864455058573764736499381 / 3125000000000000000000000000000), (40566228969 / 100000000000000000000000000000000)⟩ +lemma B2_2_4U1_2_1EOneD_sound : B2_2_4U1_2_1EOneD.Encloses (Foundation.entropyTerm ((1 - (binaryParameter (shape 2 2 4) (shape 1 2 1) : ℝ)))) := by + exact contains_sound (entropyTerm_ball (B2_2_4U1_2_1OneD_sound) B2_2_4U1_2_1EOneDLog_sound) (by decide +kernel) +def B2_2_4U1_2_1BinaryEntropy : Ball := ⟨(10198032521952022401931681594393 / 50000000000000000000000000000000), (47707902563 / 100000000000000000000000000000000)⟩ +lemma B2_2_4U1_2_1BinaryEntropy_sound : B2_2_4U1_2_1BinaryEntropy.Encloses + (binaryEntropyRate (binaryParameter (shape 2 2 4) (shape 1 2 1))) := by + exact contains_sound (Ball.add_sound (Ball.add_sound B2_2_4U1_2_1EOneD_sound B2_2_4U1_2_1ED_sound) + (Ball.mul_sound B2_2_4U1_2_1D_sound logN2_sound)) (by decide +kernel) +def B2_2_4U1_2_1Leaf : Ball := ⟨(315102675079371637970947370752223 / 100000000000000000000000000000000), (62188407251 / 50000000000000000000000000000000)⟩ +lemma B2_2_4U1_2_1Leaf_sound : B2_2_4U1_2_1Leaf.Encloses (AllFieldTerminalRates.secondLeafRate (shape 2 2 4) (shape 1 2 1)) := by + have hh : shapeMax (shape 1 2 1) = 2 := by decide +kernel + have hp : positive (shape 1 2 1) = true := by decide +kernel + simp only [AllFieldTerminalRates.secondLeafRate, hh, hp, Bool.not_true, Bool.false_eq_true, + show (2 : ℕ) ≠ 4 by decide, show (2 : ℕ) ≠ 3 by decide, ite_false] + have ht : (Ball.exact (1957843 / 1000000)).Encloses (2 - (binaryParameter (shape 2 2 4) (shape 1 2 1) : ℝ)) := by + have he : binaryParameter (shape 2 2 4) (shape 1 2 1) = (42157 / 1000000) := by decide +kernel + rw [he] + convert Ball.exact_sound ((1957843 / 1000000) : ℚ) using 1 + norm_num [Ball.exact] + exact contains_sound (Ball.mul_sound ht logN5_sound) (by decide +kernel) +def B2_2_4U1_2_1Mass : Ball := ⟨(1246537282943313726061518292613 / 50000000000000000000000000000000), (1 / 3125000000000000000000000000000)⟩ +lemma B2_2_4U1_2_1Mass_sound : B2_2_4U1_2_1Mass.Encloses (littleMass (shape 2 2 4) (shape 1 2 1) : ℝ) := by + rw [littleMass_cast] + exact contains_sound (Ball.mul_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) (second_2_2_4)) + (B2_2_4Law_sound (shape 1 2 1))) (by decide +kernel) +def B2_2_4U2_0_2D : Ball := .exact (103577 / 1000000) +lemma B2_2_4U2_0_2D_sound : B2_2_4U2_0_2D.Encloses (binaryParameter (shape 2 2 4) (shape 2 0 2) : ℝ) := by + apply exact_rat_enclosed + decide +kernel +def B2_2_4U2_0_2OneD : Ball := .exact (896423 / 1000000) +lemma B2_2_4U2_0_2OneD_sound : B2_2_4U2_0_2OneD.Encloses (1 - (binaryParameter (shape 2 2 4) (shape 2 0 2) : ℝ)) := by + have he : binaryParameter (shape 2 2 4) (shape 2 0 2) = (103577 / 1000000) := by decide +kernel + rw [he] + convert Ball.exact_sound ((896423 / 1000000) : ℚ) using 1 <;> norm_num [B2_2_4U2_0_2OneD, Ball.exact] +def B2_2_4U2_0_2EDLogWitness : LogWitness := ⟨-4, 103577, 62500⟩ +def B2_2_4U2_0_2EDLog : Ball := ⟨(-2834299976907655511632457381399 / 1250000000000000000000000000000), (52939559207 / 50000000000000000000000000000000)⟩ +lemma B2_2_4U2_0_2EDLog_sound : B2_2_4U2_0_2EDLog.Encloses (Real.log ((binaryParameter (shape 2 2 4) (shape 2 0 2) : ℝ))) := by + exact checkLog_sound logTwoBall_sound (B2_2_4U2_0_2D_sound) (w := B2_2_4U2_0_2EDLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def B2_2_4U2_0_2ED : Ball := ⟨(23485463096653138794268403055453 / 100000000000000000000000000000000), (10966641449 / 100000000000000000000000000000000)⟩ +lemma B2_2_4U2_0_2ED_sound : B2_2_4U2_0_2ED.Encloses (Foundation.entropyTerm ((binaryParameter (shape 2 2 4) (shape 2 0 2) : ℝ))) := by + exact contains_sound (entropyTerm_ball (B2_2_4U2_0_2D_sound) B2_2_4U2_0_2EDLog_sound) (by decide +kernel) +def B2_2_4U2_0_2EOneDLogWitness : LogWitness := ⟨-1, 896423, 500000⟩ +def B2_2_4U2_0_2EOneDLog : Ball := ⟨(-2733571979905550299613262420469 / 25000000000000000000000000000000), (8470329473 / 20000000000000000000000000000000)⟩ +lemma B2_2_4U2_0_2EOneDLog_sound : B2_2_4U2_0_2EOneDLog.Encloses (Real.log ((1 - (binaryParameter (shape 2 2 4) (shape 2 0 2) : ℝ)))) := by + exact checkLog_sound logTwoBall_sound (B2_2_4U2_0_2OneD_sound) (w := B2_2_4U2_0_2EOneDLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def B2_2_4U2_0_2EOneD : Ball := ⟨(306304599367859139528777442343 / 3125000000000000000000000000000), (37964990787 / 100000000000000000000000000000000)⟩ +lemma B2_2_4U2_0_2EOneD_sound : B2_2_4U2_0_2EOneD.Encloses (Foundation.entropyTerm ((1 - (binaryParameter (shape 2 2 4) (shape 2 0 2) : ℝ)))) := by + exact contains_sound (entropyTerm_ball (B2_2_4U2_0_2OneD_sound) B2_2_4U2_0_2EOneDLog_sound) (by decide +kernel) +def B2_2_4U2_0_2BinaryEntropy : Ball := ⟨(40466620828510376790540144377003 / 100000000000000000000000000000000), (3332393051 / 6250000000000000000000000000000)⟩ +lemma B2_2_4U2_0_2BinaryEntropy_sound : B2_2_4U2_0_2BinaryEntropy.Encloses + (binaryEntropyRate (binaryParameter (shape 2 2 4) (shape 2 0 2))) := by + exact contains_sound (Ball.add_sound (Ball.add_sound B2_2_4U2_0_2EOneD_sound B2_2_4U2_0_2ED_sound) + (Ball.mul_sound B2_2_4U2_0_2D_sound logN2_sound)) (by decide +kernel) +def B2_2_4U2_0_2Leaf : Ball := ⟨(32901405318409308881068737266019 / 10000000000000000000000000000000), (167213261177 / 100000000000000000000000000000000)⟩ +lemma B2_2_4U2_0_2Leaf_sound : B2_2_4U2_0_2Leaf.Encloses (AllFieldTerminalRates.secondLeafRate (shape 2 2 4) (shape 2 0 2)) := by + have hh : shapeMax (shape 2 0 2) = 2 := by decide +kernel + have hp : positive (shape 2 0 2) = false := by decide +kernel + simp only [AllFieldTerminalRates.secondLeafRate, hh, hp, Bool.not_false, + show (2 : ℕ) ≠ 4 by decide, show (2 : ℕ) ≠ 3 by decide, ite_false, ite_true] + exact contains_sound (Ball.add_sound B2_2_4U2_0_2BinaryEntropy_sound + (Ball.mul_sound (Ball.mul_sound (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) + B2_2_4U2_0_2OneD_sound) logN5_sound)) (by decide +kernel) +def B2_2_4U2_0_2Mass : Ball := ⟨(973002741917034495619167964551 / 10000000000000000000000000000000), (1 / 781250000000000000000000000000)⟩ +lemma B2_2_4U2_0_2Mass_sound : B2_2_4U2_0_2Mass.Encloses (littleMass (shape 2 2 4) (shape 2 0 2) : ℝ) := by + rw [littleMass_cast] + exact contains_sound (Ball.mul_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) (second_2_2_4)) + (B2_2_4Law_sound (shape 2 0 2))) (by decide +kernel) +def B2_2_4U2_1_1D : Ball := .exact (8433 / 200000) +lemma B2_2_4U2_1_1D_sound : B2_2_4U2_1_1D.Encloses (binaryParameter (shape 2 2 4) (shape 2 1 1) : ℝ) := by + apply exact_rat_enclosed + decide +kernel +def B2_2_4U2_1_1OneD : Ball := .exact (191567 / 200000) +lemma B2_2_4U2_1_1OneD_sound : B2_2_4U2_1_1OneD.Encloses (1 - (binaryParameter (shape 2 2 4) (shape 2 1 1) : ℝ)) := by + have he : binaryParameter (shape 2 2 4) (shape 2 1 1) = (8433 / 200000) := by decide +kernel + rw [he] + convert Ball.exact_sound ((191567 / 200000) : ℚ) using 1 <;> norm_num [B2_2_4U2_1_1OneD, Ball.exact] +def B2_2_4U2_1_1EDLogWitness : LogWitness := ⟨-5, 8433, 6250⟩ +def B2_2_4U2_1_1EDLog : Ball := ⟨(-316616478595553215892035736909523 / 100000000000000000000000000000000), (63527471049 / 50000000000000000000000000000000)⟩ +lemma B2_2_4U2_1_1EDLog_sound : B2_2_4U2_1_1EDLog.Encloses (Real.log ((binaryParameter (shape 2 2 4) (shape 2 1 1) : ℝ))) := by + exact checkLog_sound logTwoBall_sound (B2_2_4U2_1_1D_sound) (w := B2_2_4U2_1_1EDLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def B2_2_4U2_1_1ED : Ball := ⟨(1335013381998150134808768684679 / 10000000000000000000000000000000), (2678635817 / 50000000000000000000000000000000)⟩ +lemma B2_2_4U2_1_1ED_sound : B2_2_4U2_1_1ED.Encloses (Foundation.entropyTerm ((binaryParameter (shape 2 2 4) (shape 2 1 1) : ℝ))) := by + exact contains_sound (entropyTerm_ball (B2_2_4U2_1_1D_sound) B2_2_4U2_1_1EDLog_sound) (by decide +kernel) +def B2_2_4U2_1_1EOneDLogWitness : LogWitness := ⟨-1, 191567, 100000⟩ +def B2_2_4U2_1_1EOneDLog : Ball := ⟨(-4307974966568354882089913298341 / 100000000000000000000000000000000), (21175823683 / 50000000000000000000000000000000)⟩ +lemma B2_2_4U2_1_1EOneDLog_sound : B2_2_4U2_1_1EOneDLog.Encloses (Real.log ((1 - (binaryParameter (shape 2 2 4) (shape 2 1 1) : ℝ)))) := by + exact checkLog_sound logTwoBall_sound (B2_2_4U2_1_1OneD_sound) (w := B2_2_4U2_1_1EOneDLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def B2_2_4U2_1_1EOneD : Ball := ⟨(1031582300525750049621648026029 / 25000000000000000000000000000000), (10141472539 / 25000000000000000000000000000000)⟩ +lemma B2_2_4U2_1_1EOneD_sound : B2_2_4U2_1_1EOneD.Encloses (Foundation.entropyTerm ((1 - (binaryParameter (shape 2 2 4) (shape 2 1 1) : ℝ)))) := by + exact contains_sound (entropyTerm_ball (B2_2_4U2_1_1OneD_sound) B2_2_4U2_1_1EOneDLog_sound) (by decide +kernel) +def B2_2_4U2_1_1BinaryEntropy : Ball := ⟨(20399118108915510943732037385873 / 100000000000000000000000000000000), (23854459501 / 50000000000000000000000000000000)⟩ +lemma B2_2_4U2_1_1BinaryEntropy_sound : B2_2_4U2_1_1BinaryEntropy.Encloses + (binaryEntropyRate (binaryParameter (shape 2 2 4) (shape 2 1 1))) := by + exact contains_sound (Ball.add_sound (Ball.add_sound B2_2_4U2_1_1EOneD_sound B2_2_4U2_1_1ED_sound) + (Ball.mul_sound B2_2_4U2_1_1D_sound logN2_sound)) (by decide +kernel) +def B2_2_4U2_1_1Leaf : Ball := ⟨(157550693764520845345323845072531 / 50000000000000000000000000000000), (62188153141 / 50000000000000000000000000000000)⟩ +lemma B2_2_4U2_1_1Leaf_sound : B2_2_4U2_1_1Leaf.Encloses (AllFieldTerminalRates.secondLeafRate (shape 2 2 4) (shape 2 1 1)) := by + have hh : shapeMax (shape 2 1 1) = 2 := by decide +kernel + have hp : positive (shape 2 1 1) = true := by decide +kernel + simp only [AllFieldTerminalRates.secondLeafRate, hh, hp, Bool.not_true, Bool.false_eq_true, + show (2 : ℕ) ≠ 4 by decide, show (2 : ℕ) ≠ 3 by decide, ite_false] + have ht : (Ball.exact (391567 / 200000)).Encloses (2 - (binaryParameter (shape 2 2 4) (shape 2 1 1) : ℝ)) := by + have he : binaryParameter (shape 2 2 4) (shape 2 1 1) = (8433 / 200000) := by decide +kernel + rw [he] + convert Ball.exact_sound ((391567 / 200000) : ℚ) using 1 + norm_num [Ball.exact] + exact contains_sound (Ball.mul_sound ht logN5_sound) (by decide +kernel) +def B2_2_4U2_1_1Mass : Ball := ⟨(1246537282943313726061518292613 / 50000000000000000000000000000000), (1 / 3125000000000000000000000000000)⟩ +lemma B2_2_4U2_1_1Mass_sound : B2_2_4U2_1_1Mass.Encloses (littleMass (shape 2 2 4) (shape 2 1 1) : ℝ) := by + rw [littleMass_cast] + exact contains_sound (Ball.mul_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) (second_2_2_4)) + (B2_2_4Law_sound (shape 2 1 1))) (by decide +kernel) +def B2_2_4U2_2_0D : Ball := .exact (31791 / 500000) +lemma B2_2_4U2_2_0D_sound : B2_2_4U2_2_0D.Encloses (binaryParameter (shape 2 2 4) (shape 2 2 0) : ℝ) := by + apply exact_rat_enclosed + decide +kernel +def B2_2_4U2_2_0OneD : Ball := .exact (468209 / 500000) +lemma B2_2_4U2_2_0OneD_sound : B2_2_4U2_2_0OneD.Encloses (1 - (binaryParameter (shape 2 2 4) (shape 2 2 0) : ℝ)) := by + have he : binaryParameter (shape 2 2 4) (shape 2 2 0) = (31791 / 500000) := by decide +kernel + rw [he] + convert Ball.exact_sound ((468209 / 500000) : ℚ) using 1 <;> norm_num [B2_2_4U2_2_0OneD, Ball.exact] +def B2_2_4U2_2_0EDLogWitness : LogWitness := ⟨-4, 31791, 31250⟩ +def B2_2_4U2_2_0EDLog : Ball := ⟨(-8610702711129322182939633075951 / 3125000000000000000000000000000), (52939559207 / 50000000000000000000000000000000)⟩ +lemma B2_2_4U2_2_0EDLog_sound : B2_2_4U2_2_0EDLog.Encloses (Real.log ((binaryParameter (shape 2 2 4) (shape 2 2 0) : ℝ))) := by + exact checkLog_sound logTwoBall_sound (B2_2_4U2_2_0D_sound) (w := B2_2_4U2_2_0EDLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def B2_2_4U2_2_0ED : Ball := ⟨(4379885598232196504285342001881 / 25000000000000000000000000000000), (1683001527 / 25000000000000000000000000000000)⟩ +lemma B2_2_4U2_2_0ED_sound : B2_2_4U2_2_0ED.Encloses (Foundation.entropyTerm ((binaryParameter (shape 2 2 4) (shape 2 2 0) : ℝ))) := by + exact contains_sound (entropyTerm_ball (B2_2_4U2_2_0D_sound) B2_2_4U2_2_0EDLog_sound) (by decide +kernel) +def B2_2_4U2_2_0EOneDLogWitness : LogWitness := ⟨-1, 468209, 250000⟩ +def B2_2_4U2_2_0EOneDLog : Ball := ⟨(-1642333024891709491091130987267 / 25000000000000000000000000000000), (21175823683 / 50000000000000000000000000000000)⟩ +lemma B2_2_4U2_2_0EOneDLog_sound : B2_2_4U2_2_0EOneDLog.Encloses (Real.log ((1 - (binaryParameter (shape 2 2 4) (shape 2 2 0) : ℝ)))) := by + exact checkLog_sound logTwoBall_sound (B2_2_4U2_2_0OneD_sound) (w := B2_2_4U2_2_0EOneDLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def B2_2_4U2_2_0EOneD : Ball := ⟨(3075820413006089636457149393669 / 50000000000000000000000000000000), (9914711231 / 25000000000000000000000000000000)⟩ +lemma B2_2_4U2_2_0EOneD_sound : B2_2_4U2_2_0EOneD.Encloses (Foundation.entropyTerm ((1 - (binaryParameter (shape 2 2 4) (shape 2 2 0) : ℝ)))) := by + exact contains_sound (entropyTerm_ball (B2_2_4U2_2_0OneD_sound) B2_2_4U2_2_0EOneDLog_sound) (by decide +kernel) +def B2_2_4U2_2_0BinaryEntropy : Ball := ⟨(7019587905594302389098077713847 / 25000000000000000000000000000000), (1963346139 / 4000000000000000000000000000000)⟩ +lemma B2_2_4U2_2_0BinaryEntropy_sound : B2_2_4U2_2_0BinaryEntropy.Encloses + (binaryEntropyRate (binaryParameter (shape 2 2 4) (shape 2 2 0))) := by + exact contains_sound (Ball.add_sound (Ball.add_sound B2_2_4U2_2_0EOneD_sound B2_2_4U2_2_0ED_sound) + (Ball.mul_sound B2_2_4U2_2_0D_sound logN2_sound)) (by decide +kernel) +def B2_2_4U2_2_0Leaf : Ball := ⟨(82374919459880072618242752497539 / 25000000000000000000000000000000), (33612037649 / 20000000000000000000000000000000)⟩ +lemma B2_2_4U2_2_0Leaf_sound : B2_2_4U2_2_0Leaf.Encloses (AllFieldTerminalRates.secondLeafRate (shape 2 2 4) (shape 2 2 0)) := by + have hh : shapeMax (shape 2 2 0) = 2 := by decide +kernel + have hp : positive (shape 2 2 0) = false := by decide +kernel + simp only [AllFieldTerminalRates.secondLeafRate, hh, hp, Bool.not_false, + show (2 : ℕ) ≠ 4 by decide, show (2 : ℕ) ≠ 3 by decide, ite_false, ite_true] + exact contains_sound (Ball.add_sound B2_2_4U2_2_0BinaryEntropy_sound + (Ball.mul_sound (Ball.mul_sound (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) + B2_2_4U2_2_0OneD_sound) logN5_sound)) (by decide +kernel) +def B2_2_4U2_2_0Mass : Ball := ⟨(459983845027779558302590723 / 3125000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ +lemma B2_2_4U2_2_0Mass_sound : B2_2_4U2_2_0Mass.Encloses (littleMass (shape 2 2 4) (shape 2 2 0) : ℝ) := by + rw [littleMass_cast] + exact contains_sound (Ball.mul_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) (second_2_2_4)) + (B2_2_4Law_sound (shape 2 2 0))) (by decide +kernel) +def B2_2_4Leaves (s : Shape) : Ball := + match s 0, s 1, s 2 with + | 0, 0, 4 => B2_2_4U0_0_4Leaf + | 0, 1, 3 => B2_2_4U0_1_3Leaf + | 0, 2, 2 => B2_2_4U0_2_2Leaf + | 1, 0, 3 => B2_2_4U1_0_3Leaf + | 1, 1, 2 => B2_2_4U1_1_2Leaf + | 1, 2, 1 => B2_2_4U1_2_1Leaf + | 2, 0, 2 => B2_2_4U2_0_2Leaf + | 2, 1, 1 => B2_2_4U2_1_1Leaf + | 2, 2, 0 => B2_2_4U2_2_0Leaf + | _, _, _ => (.exact 0) +lemma B2_2_4Leaves_sound (u : Shape) (hu : u ∈ below (shape 2 2 4)) : + (B2_2_4Leaves u).Encloses (AllFieldTerminalRates.secondLeafRate (shape 2 2 4) u) := by + rw [B2_2_4_below] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl + · exact B2_2_4U0_0_4Leaf_sound + · exact B2_2_4U0_1_3Leaf_sound + · exact B2_2_4U0_2_2Leaf_sound + · exact B2_2_4U1_0_3Leaf_sound + · exact B2_2_4U1_1_2Leaf_sound + · exact B2_2_4U1_2_1Leaf_sound + · exact B2_2_4U2_0_2Leaf_sound + · exact B2_2_4U2_1_1Leaf_sound + · exact B2_2_4U2_2_0Leaf_sound +def B2_2_4Masses (s : Shape) : Ball := + match s 0, s 1, s 2 with + | 0, 0, 4 => B2_2_4U0_0_4Mass + | 0, 1, 3 => B2_2_4U0_1_3Mass + | 0, 2, 2 => B2_2_4U0_2_2Mass + | 1, 0, 3 => B2_2_4U1_0_3Mass + | 1, 1, 2 => B2_2_4U1_1_2Mass + | 1, 2, 1 => B2_2_4U1_2_1Mass + | 2, 0, 2 => B2_2_4U2_0_2Mass + | 2, 1, 1 => B2_2_4U2_1_1Mass + | 2, 2, 0 => B2_2_4U2_2_0Mass + | _, _, _ => (.exact 0) +lemma B2_2_4Masses_sound (u : Shape) (hu : u ∈ below (shape 2 2 4)) : + (B2_2_4Masses u).Encloses ((fun u => (littleMass (shape 2 2 4) u : ℝ)) u) := by + rw [B2_2_4_below] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl + · exact B2_2_4U0_0_4Mass_sound + · exact B2_2_4U0_1_3Mass_sound + · exact B2_2_4U0_2_2Mass_sound + · exact B2_2_4U1_0_3Mass_sound + · exact B2_2_4U1_1_2Mass_sound + · exact B2_2_4U1_2_1Mass_sound + · exact B2_2_4U2_0_2Mass_sound + · exact B2_2_4U2_1_1Mass_sound + · exact B2_2_4U2_2_0Mass_sound +def B2_2_4Binaries (s : Shape) : Ball := + match s 0, s 1, s 2 with + | 0, 2, 2 => B2_2_4U0_2_2BinaryEntropy + | 1, 1, 2 => B2_2_4U1_1_2BinaryEntropy + | 1, 2, 1 => B2_2_4U1_2_1BinaryEntropy + | 2, 0, 2 => B2_2_4U2_0_2BinaryEntropy + | 2, 1, 1 => B2_2_4U2_1_1BinaryEntropy + | 2, 2, 0 => B2_2_4U2_2_0BinaryEntropy + | _, _, _ => (.exact 0) +lemma B2_2_4Binaries_sound (u : Shape) (hu : u ∈ (below (shape 2 2 4)).filter positive) : + (B2_2_4Binaries u).Encloses ((fun u => binaryEntropyRate (binaryParameter (shape 2 2 4) u)) u) := by + have hl : (below (shape 2 2 4)).filter positive = [(shape 1 1 2), (shape 1 2 1), (shape 2 1 1)] := by decide +kernel + rw [hl] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl + · exact B2_2_4U1_1_2BinaryEntropy_sound + · exact B2_2_4U1_2_1BinaryEntropy_sound + · exact B2_2_4U2_1_1BinaryEntropy_sound +def B2_2_4S2 : Ball := ⟨(2096023073863630218761879684683 / 1000000000000000000000000000000), (89698574533 / 100000000000000000000000000000000)⟩ +lemma B2_2_4S2_sound : B2_2_4S2.Encloses + (((below (shape 2 2 4)).map fun u => (littleMass (shape 2 2 4) u : ℝ) * AllFieldTerminalRates.secondLeafRate (shape 2 2 4) u).sum) := by + exact contains_sound (listSumBall_sound (below (shape 2 2 4)) + (fun u => .mul (B2_2_4Masses u) (B2_2_4Leaves u)) _ + (fun u hu => Ball.mul_sound (B2_2_4Masses_sound u hu) (B2_2_4Leaves_sound u hu))) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/Certificates/Terminal2_3_3.lean b/lean/OAI/LinearAlgebra/MatrixFields/Certificates/Terminal2_3_3.lean new file mode 100644 index 0000000000000000000000000000000000000000..427c634e28d71ed44cd9a33f79794797804240ee --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/Certificates/Terminal2_3_3.lean @@ -0,0 +1,439 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Certificates.Terminal1_1_6 + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def B2_3_3U0_1_3Leaf : Ball := ⟨(115129254649702284200899544090987 / 50000000000000000000000000000000), (21175823683 / 25000000000000000000000000000000)⟩ +lemma B2_3_3U0_1_3Leaf_sound : B2_3_3U0_1_3Leaf.Encloses (AllFieldTerminalRates.secondLeafRate (shape 2 3 3) (shape 0 1 3)) := by + have hh : shapeMax (shape 0 1 3) = 3 := by decide +kernel + simp only [AllFieldTerminalRates.secondLeafRate, hh, show (3 : ℕ) ≠ 4 by decide, ite_false, ite_true] + exact logN10_sound +def B2_3_3U0_1_3Mass : Ball := ⟨(466550470537589006566890154189 / 50000000000000000000000000000000), (3 / 25000000000000000000000000000000)⟩ +lemma B2_3_3U0_1_3Mass_sound : B2_3_3U0_1_3Mass.Encloses (littleMass (shape 2 3 3) (shape 0 1 3) : ℝ) := by + rw [littleMass_cast] + exact contains_sound (Ball.mul_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) (second_2_3_3)) + (B2_3_3Law_sound (shape 0 1 3))) (by decide +kernel) +def B2_3_3U0_2_2D : Ball := .exact (55041 / 500000) +lemma B2_3_3U0_2_2D_sound : B2_3_3U0_2_2D.Encloses (binaryParameter (shape 2 3 3) (shape 0 2 2) : ℝ) := by + apply exact_rat_enclosed + decide +kernel +def B2_3_3U0_2_2OneD : Ball := .exact (444959 / 500000) +lemma B2_3_3U0_2_2OneD_sound : B2_3_3U0_2_2OneD.Encloses (1 - (binaryParameter (shape 2 3 3) (shape 0 2 2) : ℝ)) := by + have he : binaryParameter (shape 2 3 3) (shape 0 2 2) = (55041 / 500000) := by decide +kernel + rw [he] + convert Ball.exact_sound ((444959 / 500000) : ℚ) using 1 <;> norm_num [B2_3_3U0_2_2OneD, Ball.exact] +def B2_3_3U0_2_2EDLogWitness : LogWitness := ⟨-4, 55041, 31250⟩ +def B2_3_3U0_2_2EDLog : Ball := ⟨(-55163243408937486421493177388873 / 25000000000000000000000000000000), (21175823683 / 20000000000000000000000000000000)⟩ +lemma B2_3_3U0_2_2EDLog_sound : B2_3_3U0_2_2EDLog.Encloses (Real.log ((binaryParameter (shape 2 3 3) (shape 0 2 2) : ℝ))) := by + exact checkLog_sound logTwoBall_sound (B2_3_3U0_2_2D_sound) (w := B2_3_3U0_2_2EDLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def B2_3_3U0_2_2ED : Ball := ⟨(3036240080471328190125405976661 / 12500000000000000000000000000000), (5827692557 / 50000000000000000000000000000000)⟩ +lemma B2_3_3U0_2_2ED_sound : B2_3_3U0_2_2ED.Encloses (Foundation.entropyTerm ((binaryParameter (shape 2 3 3) (shape 0 2 2) : ℝ))) := by + exact contains_sound (entropyTerm_ball (B2_3_3U0_2_2D_sound) B2_3_3U0_2_2EDLog_sound) (by decide +kernel) +def B2_3_3U0_2_2EOneDLogWitness : LogWitness := ⟨-1, 444959, 250000⟩ +def B2_3_3U0_2_2EOneDLog : Ball := ⟨(-5831297766604325579437218806789 / 50000000000000000000000000000000), (21175823683 / 50000000000000000000000000000000)⟩ +lemma B2_3_3U0_2_2EOneDLog_sound : B2_3_3U0_2_2EOneDLog.Encloses (Real.log ((1 - (binaryParameter (shape 2 3 3) (shape 0 2 2) : ℝ)))) := by + exact checkLog_sound logTwoBall_sound (B2_3_3U0_2_2OneD_sound) (w := B2_3_3U0_2_2EOneDLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def B2_3_3U0_2_2EOneD : Ball := ⟨(51893768458609882110016108861 / 500000000000000000000000000000), (37689493321 / 100000000000000000000000000000000)⟩ +lemma B2_3_3U0_2_2EOneD_sound : B2_3_3U0_2_2EOneD.Encloses (Foundation.entropyTerm ((1 - (binaryParameter (shape 2 3 3) (shape 0 2 2) : ℝ)))) := by + exact contains_sound (entropyTerm_ball (B2_3_3U0_2_2OneD_sound) B2_3_3U0_2_2EOneDLog_sound) (by decide +kernel) +def B2_3_3U0_2_2BinaryEntropy : Ball := ⟨(21149488564266295949066621061427 / 50000000000000000000000000000000), (54007032481 / 100000000000000000000000000000000)⟩ +lemma B2_3_3U0_2_2BinaryEntropy_sound : B2_3_3U0_2_2BinaryEntropy.Encloses + (binaryEntropyRate (binaryParameter (shape 2 3 3) (shape 0 2 2))) := by + exact contains_sound (Ball.add_sound (Ball.add_sound B2_3_3U0_2_2EOneD_sound B2_3_3U0_2_2ED_sound) + (Ball.mul_sound B2_3_3U0_2_2D_sound logN2_sound)) (by decide +kernel) +def B2_3_3U0_2_2Leaf : Ball := ⟨(328752530760038539330924883010379 / 100000000000000000000000000000000), (41768878111 / 25000000000000000000000000000000)⟩ +lemma B2_3_3U0_2_2Leaf_sound : B2_3_3U0_2_2Leaf.Encloses (AllFieldTerminalRates.secondLeafRate (shape 2 3 3) (shape 0 2 2)) := by + have hh : shapeMax (shape 0 2 2) = 2 := by decide +kernel + have hp : positive (shape 0 2 2) = false := by decide +kernel + simp only [AllFieldTerminalRates.secondLeafRate, hh, hp, Bool.not_false, + show (2 : ℕ) ≠ 4 by decide, show (2 : ℕ) ≠ 3 by decide, ite_false, ite_true] + exact contains_sound (Ball.add_sound B2_3_3U0_2_2BinaryEntropy_sound + (Ball.mul_sound (Ball.mul_sound (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) + B2_3_3U0_2_2OneD_sound) logN5_sound)) (by decide +kernel) +def B2_3_3U0_2_2Mass : Ball := ⟨(3278427034394245768597523877587 / 25000000000000000000000000000000), (67 / 50000000000000000000000000000000)⟩ +lemma B2_3_3U0_2_2Mass_sound : B2_3_3U0_2_2Mass.Encloses (littleMass (shape 2 3 3) (shape 0 2 2) : ℝ) := by + rw [littleMass_cast] + exact contains_sound (Ball.mul_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) (second_2_3_3)) + (B2_3_3Law_sound (shape 0 2 2))) (by decide +kernel) +def B2_3_3U0_3_1Leaf : Ball := ⟨(115129254649702284200899544090987 / 50000000000000000000000000000000), (21175823683 / 25000000000000000000000000000000)⟩ +lemma B2_3_3U0_3_1Leaf_sound : B2_3_3U0_3_1Leaf.Encloses (AllFieldTerminalRates.secondLeafRate (shape 2 3 3) (shape 0 3 1)) := by + have hh : shapeMax (shape 0 3 1) = 3 := by decide +kernel + simp only [AllFieldTerminalRates.secondLeafRate, hh, show (3 : ℕ) ≠ 4 by decide, ite_false, ite_true] + exact logN10_sound +def B2_3_3U0_3_1Mass : Ball := ⟨(14715925893121844557257952283 / 1562500000000000000000000000000), (13 / 100000000000000000000000000000000)⟩ +lemma B2_3_3U0_3_1Mass_sound : B2_3_3U0_3_1Mass.Encloses (littleMass (shape 2 3 3) (shape 0 3 1) : ℝ) := by + rw [littleMass_cast] + exact contains_sound (Ball.mul_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) (second_2_3_3)) + (B2_3_3Law_sound (shape 0 3 1))) (by decide +kernel) +def B2_3_3U1_0_3Leaf : Ball := ⟨(115129254649702284200899544090987 / 50000000000000000000000000000000), (21175823683 / 25000000000000000000000000000000)⟩ +lemma B2_3_3U1_0_3Leaf_sound : B2_3_3U1_0_3Leaf.Encloses (AllFieldTerminalRates.secondLeafRate (shape 2 3 3) (shape 1 0 3)) := by + have hh : shapeMax (shape 1 0 3) = 3 := by decide +kernel + simp only [AllFieldTerminalRates.secondLeafRate, hh, show (3 : ℕ) ≠ 4 by decide, ite_false, ite_true] + exact logN10_sound +def B2_3_3U1_0_3Mass : Ball := ⟨(64933664603666840044717438439 / 50000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +lemma B2_3_3U1_0_3Mass_sound : B2_3_3U1_0_3Mass.Encloses (littleMass (shape 2 3 3) (shape 1 0 3) : ℝ) := by + rw [littleMass_cast] + exact contains_sound (Ball.mul_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) (second_2_3_3)) + (B2_3_3Law_sound (shape 1 0 3))) (by decide +kernel) +def B2_3_3U1_1_2D : Ball := .exact (573 / 125000) +lemma B2_3_3U1_1_2D_sound : B2_3_3U1_1_2D.Encloses (binaryParameter (shape 2 3 3) (shape 1 1 2) : ℝ) := by + apply exact_rat_enclosed + decide +kernel +def B2_3_3U1_1_2OneD : Ball := .exact (124427 / 125000) +lemma B2_3_3U1_1_2OneD_sound : B2_3_3U1_1_2OneD.Encloses (1 - (binaryParameter (shape 2 3 3) (shape 1 1 2) : ℝ)) := by + have he : binaryParameter (shape 2 3 3) (shape 1 1 2) = (573 / 125000) := by decide +kernel + rw [he] + convert Ball.exact_sound ((124427 / 125000) : ℚ) using 1 <;> norm_num [B2_3_3U1_1_2OneD, Ball.exact] +def B2_3_3U1_1_2EDLogWitness : LogWitness := ⟨-8, 18336, 15625⟩ +def B2_3_3U1_1_2EDLog : Ball := ⟨(-21540733198278794446444222587871 / 4000000000000000000000000000000), (95291206573 / 50000000000000000000000000000000)⟩ +lemma B2_3_3U1_1_2EDLog_sound : B2_3_3U1_1_2EDLog.Encloses (Real.log ((binaryParameter (shape 2 3 3) (shape 1 1 2) : ℝ))) := by + exact checkLog_sound logTwoBall_sound (B2_3_3U1_1_2D_sound) (w := B2_3_3U1_1_2EDLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def B2_3_3U1_1_2ED : Ball := ⟨(246856802452274984356250790857 / 10000000000000000000000000000000), (436814891 / 50000000000000000000000000000000)⟩ +lemma B2_3_3U1_1_2ED_sound : B2_3_3U1_1_2ED.Encloses (Foundation.entropyTerm ((binaryParameter (shape 2 3 3) (shape 1 1 2) : ℝ))) := by + exact contains_sound (entropyTerm_ball (B2_3_3U1_1_2D_sound) B2_3_3U1_1_2EDLog_sound) (by decide +kernel) +def B2_3_3U1_1_2EOneDLogWitness : LogWitness := ⟨-1, 124427, 62500⟩ +def B2_3_3U1_1_2EOneDLog : Ball := ⟨(-22972693733715313906167338253 / 5000000000000000000000000000000), (21175823683 / 50000000000000000000000000000000)⟩ +lemma B2_3_3U1_1_2EOneDLog_sound : B2_3_3U1_1_2EOneDLog.Encloses (Real.log ((1 - (binaryParameter (shape 2 3 3) (shape 1 1 2) : ℝ)))) := by + exact checkLog_sound logTwoBall_sound (B2_3_3U1_1_2OneD_sound) (w := B2_3_3U1_1_2EOneDLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def B2_3_3U1_1_2EOneD : Ball := ⟨(457347738112799258144429343489 / 100000000000000000000000000000000), (8431501483 / 20000000000000000000000000000000)⟩ +lemma B2_3_3U1_1_2EOneD_sound : B2_3_3U1_1_2EOneD.Encloses (Foundation.entropyTerm ((1 - (binaryParameter (shape 2 3 3) (shape 1 1 2) : ℝ)))) := by + exact contains_sound (entropyTerm_ball (B2_3_3U1_1_2OneD_sound) B2_3_3U1_1_2EOneDLog_sound) (by decide +kernel) +def B2_3_3U1_1_2BinaryEntropy : Ball := ⟨(1621827215102114015771898184501 / 50000000000000000000000000000000), (43225277149 / 100000000000000000000000000000000)⟩ +lemma B2_3_3U1_1_2BinaryEntropy_sound : B2_3_3U1_1_2BinaryEntropy.Encloses + (binaryEntropyRate (binaryParameter (shape 2 3 3) (shape 1 1 2))) := by + exact contains_sound (Ball.add_sound (Ball.add_sound B2_3_3U1_1_2EOneD_sound B2_3_3U1_1_2ED_sound) + (Ball.mul_sound B2_3_3U1_1_2D_sound logN2_sound)) (by decide +kernel) +def B2_3_3U1_1_2Leaf : Ball := ⟨(64229963229552056661686960472001 / 20000000000000000000000000000000), (31690933043 / 25000000000000000000000000000000)⟩ +lemma B2_3_3U1_1_2Leaf_sound : B2_3_3U1_1_2Leaf.Encloses (AllFieldTerminalRates.secondLeafRate (shape 2 3 3) (shape 1 1 2)) := by + have hh : shapeMax (shape 1 1 2) = 2 := by decide +kernel + have hp : positive (shape 1 1 2) = true := by decide +kernel + simp only [AllFieldTerminalRates.secondLeafRate, hh, hp, Bool.not_true, Bool.false_eq_true, + show (2 : ℕ) ≠ 4 by decide, show (2 : ℕ) ≠ 3 by decide, ite_false] + have ht : (Ball.exact (249427 / 125000)).Encloses (2 - (binaryParameter (shape 2 3 3) (shape 1 1 2) : ℝ)) := by + have he : binaryParameter (shape 2 3 3) (shape 1 1 2) = (573 / 125000) := by decide +kernel + rw [he] + convert Ball.exact_sound ((249427 / 125000) : ℚ) using 1 + norm_num [Ball.exact] + exact contains_sound (Ball.mul_sound ht logN5_sound) (by decide +kernel) +def B2_3_3U1_1_2Mass : Ball := ⟨(25412930157212049388918541585447 / 100000000000000000000000000000000), (239 / 100000000000000000000000000000000)⟩ +lemma B2_3_3U1_1_2Mass_sound : B2_3_3U1_1_2Mass.Encloses (littleMass (shape 2 3 3) (shape 1 1 2) : ℝ) := by + rw [littleMass_cast] + exact contains_sound (Ball.mul_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) (second_2_3_3)) + (B2_3_3Law_sound (shape 1 1 2))) (by decide +kernel) +def B2_3_3U1_2_1D : Ball := .exact (1687 / 40000) +lemma B2_3_3U1_2_1D_sound : B2_3_3U1_2_1D.Encloses (binaryParameter (shape 2 3 3) (shape 1 2 1) : ℝ) := by + apply exact_rat_enclosed + decide +kernel +def B2_3_3U1_2_1OneD : Ball := .exact (38313 / 40000) +lemma B2_3_3U1_2_1OneD_sound : B2_3_3U1_2_1OneD.Encloses (1 - (binaryParameter (shape 2 3 3) (shape 1 2 1) : ℝ)) := by + have he : binaryParameter (shape 2 3 3) (shape 1 2 1) = (1687 / 40000) := by decide +kernel + rw [he] + convert Ball.exact_sound ((38313 / 40000) : ℚ) using 1 <;> norm_num [B2_3_3U1_2_1OneD, Ball.exact] +def B2_3_3U1_2_1EDLogWitness : LogWitness := ⟨-5, 1687, 1250⟩ +def B2_3_3U1_2_1EDLog : Ball := ⟨(-316592765055010505433466504472543 / 100000000000000000000000000000000), (127054942097 / 100000000000000000000000000000000)⟩ +lemma B2_3_3U1_2_1EDLog_sound : B2_3_3U1_2_1EDLog.Encloses (Real.log ((binaryParameter (shape 2 3 3) (shape 1 2 1) : ℝ))) := by + exact checkLog_sound logTwoBall_sound (B2_3_3U1_2_1D_sound) (w := B2_3_3U1_2_1EDLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def B2_3_3U1_2_1ED : Ball := ⟨(1335229986619506806665644982613 / 10000000000000000000000000000000), (669817773 / 12500000000000000000000000000000)⟩ +lemma B2_3_3U1_2_1ED_sound : B2_3_3U1_2_1ED.Encloses (Foundation.entropyTerm ((binaryParameter (shape 2 3 3) (shape 1 2 1) : ℝ))) := by + exact contains_sound (entropyTerm_ball (B2_3_3U1_2_1D_sound) B2_3_3U1_2_1EDLog_sound) (by decide +kernel) +def B2_3_3U1_2_1EOneDLogWitness : LogWitness := ⟨-1, 38313, 20000⟩ +def B2_3_3U1_2_1EOneDLog : Ball := ⟨(-2154509496585081089533142092769 / 50000000000000000000000000000000), (21175823683 / 50000000000000000000000000000000)⟩ +lemma B2_3_3U1_2_1EOneDLog_sound : B2_3_3U1_2_1EOneDLog.Encloses (Real.log ((1 - (binaryParameter (shape 2 3 3) (shape 1 2 1) : ℝ)))) := by + exact checkLog_sound logTwoBall_sound (B2_3_3U1_2_1OneD_sound) (w := B2_3_3U1_2_1EOneDLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def B2_3_3U1_2_1EOneD : Ball := ⟨(4127286117133210589164163650013 / 100000000000000000000000000000000), (40565466639 / 100000000000000000000000000000000)⟩ +lemma B2_3_3U1_2_1EOneD_sound : B2_3_3U1_2_1EOneD.Encloses (Foundation.entropyTerm ((1 - (binaryParameter (shape 2 3 3) (shape 1 2 1) : ℝ)))) := by + exact contains_sound (entropyTerm_ball (B2_3_3U1_2_1OneD_sound) B2_3_3U1_2_1EOneDLog_sound) (by decide +kernel) +def B2_3_3U1_2_1BinaryEntropy : Ball := ⟨(20402934217339847998287789143041 / 100000000000000000000000000000000), (47710189551 / 100000000000000000000000000000000)⟩ +lemma B2_3_3U1_2_1BinaryEntropy_sound : B2_3_3U1_2_1BinaryEntropy.Encloses + (binaryEntropyRate (binaryParameter (shape 2 3 3) (shape 1 2 1))) := by + exact contains_sound (Ball.add_sound (Ball.add_sound B2_3_3U1_2_1EOneD_sound B2_3_3U1_2_1ED_sound) + (Ball.mul_sound B2_3_3U1_2_1D_sound logN2_sound)) (by decide +kernel) +def B2_3_3U1_2_1Leaf : Ball := ⟨(315099778091129256590273089386111 / 100000000000000000000000000000000), (124375671007 / 100000000000000000000000000000000)⟩ +lemma B2_3_3U1_2_1Leaf_sound : B2_3_3U1_2_1Leaf.Encloses (AllFieldTerminalRates.secondLeafRate (shape 2 3 3) (shape 1 2 1)) := by + have hh : shapeMax (shape 1 2 1) = 2 := by decide +kernel + have hp : positive (shape 1 2 1) = true := by decide +kernel + simp only [AllFieldTerminalRates.secondLeafRate, hh, hp, Bool.not_true, Bool.false_eq_true, + show (2 : ℕ) ≠ 4 by decide, show (2 : ℕ) ≠ 3 by decide, ite_false] + have ht : (Ball.exact (78313 / 40000)).Encloses (2 - (binaryParameter (shape 2 3 3) (shape 1 2 1) : ℝ)) := by + have he : binaryParameter (shape 2 3 3) (shape 1 2 1) = (1687 / 40000) := by decide +kernel + rw [he] + convert Ball.exact_sound ((78313 / 40000) : ℚ) using 1 + norm_num [Ball.exact] + exact contains_sound (Ball.mul_sound ht logN5_sound) (by decide +kernel) +def B2_3_3U1_2_1Mass : Ball := ⟨(25412930157212049388918541585447 / 100000000000000000000000000000000), (239 / 100000000000000000000000000000000)⟩ +lemma B2_3_3U1_2_1Mass_sound : B2_3_3U1_2_1Mass.Encloses (littleMass (shape 2 3 3) (shape 1 2 1) : ℝ) := by + rw [littleMass_cast] + exact contains_sound (Ball.mul_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) (second_2_3_3)) + (B2_3_3Law_sound (shape 1 2 1))) (by decide +kernel) +def B2_3_3U1_3_0Leaf : Ball := ⟨(115129254649702284200899544090987 / 50000000000000000000000000000000), (21175823683 / 25000000000000000000000000000000)⟩ +lemma B2_3_3U1_3_0Leaf_sound : B2_3_3U1_3_0Leaf.Encloses (AllFieldTerminalRates.secondLeafRate (shape 2 3 3) (shape 1 3 0)) := by + have hh : shapeMax (shape 1 3 0) = 3 := by decide +kernel + simp only [AllFieldTerminalRates.secondLeafRate, hh, show (3 : ℕ) ≠ 4 by decide, ite_false, ite_true] + exact logN10_sound +def B2_3_3U1_3_0Mass : Ball := ⟨(64933664603666840044717438439 / 50000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +lemma B2_3_3U1_3_0Mass_sound : B2_3_3U1_3_0Mass.Encloses (littleMass (shape 2 3 3) (shape 1 3 0) : ℝ) := by + rw [littleMass_cast] + exact contains_sound (Ball.mul_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) (second_2_3_3)) + (B2_3_3Law_sound (shape 1 3 0))) (by decide +kernel) +def B2_3_3U2_0_2D : Ball := .exact (104091 / 1000000) +lemma B2_3_3U2_0_2D_sound : B2_3_3U2_0_2D.Encloses (binaryParameter (shape 2 3 3) (shape 2 0 2) : ℝ) := by + apply exact_rat_enclosed + decide +kernel +def B2_3_3U2_0_2OneD : Ball := .exact (895909 / 1000000) +lemma B2_3_3U2_0_2OneD_sound : B2_3_3U2_0_2OneD.Encloses (1 - (binaryParameter (shape 2 3 3) (shape 2 0 2) : ℝ)) := by + have he : binaryParameter (shape 2 3 3) (shape 2 0 2) = (104091 / 1000000) := by decide +kernel + rw [he] + convert Ball.exact_sound ((895909 / 1000000) : ℚ) using 1 <;> norm_num [B2_3_3U2_0_2OneD, Ball.exact] +def B2_3_3U2_0_2EDLogWitness : LogWitness := ⟨-4, 104091, 62500⟩ +def B2_3_3U2_0_2EDLog : Ball := ⟨(-56562244060752588474630885788059 / 25000000000000000000000000000000), (52939559207 / 50000000000000000000000000000000)⟩ +lemma B2_3_3U2_0_2EDLog_sound : B2_3_3U2_0_2EDLog.Encloses (Real.log ((binaryParameter (shape 2 3 3) (shape 2 0 2) : ℝ))) := by + exact checkLog_sound logTwoBall_sound (B2_3_3U2_0_2D_sound) (w := B2_3_3U2_0_2EDLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def B2_3_3U2_0_2ED : Ball := ⟨(23550482186111190747651214130259 / 100000000000000000000000000000000), (2755265829 / 25000000000000000000000000000000)⟩ +lemma B2_3_3U2_0_2ED_sound : B2_3_3U2_0_2ED.Encloses (Foundation.entropyTerm ((binaryParameter (shape 2 3 3) (shape 2 0 2) : ℝ))) := by + exact contains_sound (entropyTerm_ball (B2_3_3U2_0_2D_sound) B2_3_3U2_0_2EDLog_sound) (by decide +kernel) +def B2_3_3U2_0_2EOneDLogWitness : LogWitness := ⟨-1, 895909, 500000⟩ +def B2_3_3U2_0_2EOneDLog : Ball := ⟨(-10991643366502651450018611428491 / 100000000000000000000000000000000), (21175823683 / 50000000000000000000000000000000)⟩ +lemma B2_3_3U2_0_2EOneDLog_sound : B2_3_3U2_0_2EOneDLog.Encloses (Real.log ((1 - (binaryParameter (shape 2 3 3) (shape 2 0 2) : ℝ)))) := by + exact checkLog_sound logTwoBall_sound (B2_3_3U2_0_2OneD_sound) (w := B2_3_3U2_0_2EOneDLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def B2_3_3U2_0_2EOneD : Ball := ⟨(615469513552501497370920259143 / 6250000000000000000000000000000), (37943222041 / 100000000000000000000000000000000)⟩ +lemma B2_3_3U2_0_2EOneD_sound : B2_3_3U2_0_2EOneD.Encloses (Foundation.entropyTerm ((1 - (binaryParameter (shape 2 3 3) (shape 2 0 2) : ℝ)))) := by + exact contains_sound (entropyTerm_ball (B2_3_3U2_0_2OneD_sound) B2_3_3U2_0_2EOneDLog_sound) (by decide +kernel) +def B2_3_3U2_0_2BinaryEntropy : Ball := ⟨(40613032720117741425840847164349 / 100000000000000000000000000000000), (53372710683 / 100000000000000000000000000000000)⟩ +lemma B2_3_3U2_0_2BinaryEntropy_sound : B2_3_3U2_0_2BinaryEntropy.Encloses + (binaryEntropyRate (binaryParameter (shape 2 3 3) (shape 2 0 2))) := by + exact contains_sound (Ball.add_sound (Ball.add_sound B2_3_3U2_0_2EOneD_sound B2_3_3U2_0_2ED_sound) + (Ball.mul_sound B2_3_3U2_0_2D_sound logN2_sound)) (by decide +kernel) +def B2_3_3U2_0_2Leaf : Ball := ⟨(328995014858302227927479117427341 / 100000000000000000000000000000000), (41800594201 / 25000000000000000000000000000000)⟩ +lemma B2_3_3U2_0_2Leaf_sound : B2_3_3U2_0_2Leaf.Encloses (AllFieldTerminalRates.secondLeafRate (shape 2 3 3) (shape 2 0 2)) := by + have hh : shapeMax (shape 2 0 2) = 2 := by decide +kernel + have hp : positive (shape 2 0 2) = false := by decide +kernel + simp only [AllFieldTerminalRates.secondLeafRate, hh, hp, Bool.not_false, + show (2 : ℕ) ≠ 4 by decide, show (2 : ℕ) ≠ 3 by decide, ite_false, ite_true] + exact contains_sound (Ball.add_sound B2_3_3U2_0_2BinaryEntropy_sound + (Ball.mul_sound (Ball.mul_sound (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) + B2_3_3U2_0_2OneD_sound) logN5_sound)) (by decide +kernel) +def B2_3_3U2_0_2Mass : Ball := ⟨(14715925893121844557257952283 / 1562500000000000000000000000000), (13 / 100000000000000000000000000000000)⟩ +lemma B2_3_3U2_0_2Mass_sound : B2_3_3U2_0_2Mass.Encloses (littleMass (shape 2 3 3) (shape 2 0 2) : ℝ) := by + rw [littleMass_cast] + exact contains_sound (Ball.mul_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) (second_2_3_3)) + (B2_3_3Law_sound (shape 2 0 2))) (by decide +kernel) +def B2_3_3U2_1_1D : Ball := .exact (19419 / 500000) +lemma B2_3_3U2_1_1D_sound : B2_3_3U2_1_1D.Encloses (binaryParameter (shape 2 3 3) (shape 2 1 1) : ℝ) := by + apply exact_rat_enclosed + decide +kernel +def B2_3_3U2_1_1OneD : Ball := .exact (480581 / 500000) +lemma B2_3_3U2_1_1OneD_sound : B2_3_3U2_1_1OneD.Encloses (1 - (binaryParameter (shape 2 3 3) (shape 2 1 1) : ℝ)) := by + have he : binaryParameter (shape 2 3 3) (shape 2 1 1) = (19419 / 500000) := by decide +kernel + rw [he] + convert Ball.exact_sound ((480581 / 500000) : ℚ) using 1 <;> norm_num [B2_3_3U2_1_1OneD, Ball.exact] +def B2_3_3U2_1_1EDLogWitness : LogWitness := ⟨-5, 19419, 15625⟩ +def B2_3_3U2_1_1EDLog : Ball := ⟨(-40604451627383861448565069676439 / 12500000000000000000000000000000), (127054942097 / 100000000000000000000000000000000)⟩ +lemma B2_3_3U2_1_1EDLog_sound : B2_3_3U2_1_1EDLog.Encloses (Real.log ((binaryParameter (shape 2 3 3) (shape 2 1 1) : ℝ))) := by + exact checkLog_sound logTwoBall_sound (B2_3_3U2_1_1D_sound) (w := B2_3_3U2_1_1EDLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def B2_3_3U2_1_1ED : Ball := ⟨(3153991384608668821878740352187 / 25000000000000000000000000000000), (2467279921 / 50000000000000000000000000000000)⟩ +lemma B2_3_3U2_1_1ED_sound : B2_3_3U2_1_1ED.Encloses (Foundation.entropyTerm ((binaryParameter (shape 2 3 3) (shape 2 1 1) : ℝ))) := by + exact contains_sound (entropyTerm_ball (B2_3_3U2_1_1D_sound) B2_3_3U2_1_1EDLog_sound) (by decide +kernel) +def B2_3_3U2_1_1EOneDLogWitness : LogWitness := ⟨-1, 480581, 250000⟩ +def B2_3_3U2_1_1EOneDLog : Ball := ⟨(-990307745431186665804901172341 / 25000000000000000000000000000000), (21175823683 / 50000000000000000000000000000000)⟩ +lemma B2_3_3U2_1_1EOneDLog_sound : B2_3_3U2_1_1EOneDLog.Encloses (Real.log ((1 - (binaryParameter (shape 2 3 3) (shape 2 1 1) : ℝ)))) := by + exact checkLog_sound logTwoBall_sound (B2_3_3U2_1_1OneD_sound) (w := B2_3_3U2_1_1EOneDLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def B2_3_3U2_1_1EOneD : Ball := ⟨(1903692346428260476156740841219 / 50000000000000000000000000000000), (40706794087 / 100000000000000000000000000000000)⟩ +lemma B2_3_3U2_1_1EOneD_sound : B2_3_3U2_1_1EOneD.Encloses (Foundation.entropyTerm ((1 - (binaryParameter (shape 2 3 3) (shape 2 1 1) : ℝ)))) := by + exact contains_sound (entropyTerm_ball (B2_3_3U2_1_1OneD_sound) B2_3_3U2_1_1EOneDLog_sound) (by decide +kernel) +def B2_3_3U2_1_1BinaryEntropy : Ball := ⟨(152923162009199294660344707703 / 800000000000000000000000000000), (4728620721 / 10000000000000000000000000000000)⟩ +lemma B2_3_3U2_1_1BinaryEntropy_sound : B2_3_3U2_1_1BinaryEntropy.Encloses + (binaryEntropyRate (binaryParameter (shape 2 3 3) (shape 2 1 1))) := by + exact contains_sound (Ball.add_sound (Ball.add_sound B2_3_3U2_1_1EOneD_sound B2_3_3U2_1_1ED_sound) + (Ball.mul_sound B2_3_3U2_1_1D_sound logN2_sound)) (by decide +kernel) +def B2_3_3U2_1_1Leaf : Ball := ⟨(63127369504501703177055472529633 / 20000000000000000000000000000000), (62293831089 / 50000000000000000000000000000000)⟩ +lemma B2_3_3U2_1_1Leaf_sound : B2_3_3U2_1_1Leaf.Encloses (AllFieldTerminalRates.secondLeafRate (shape 2 3 3) (shape 2 1 1)) := by + have hh : shapeMax (shape 2 1 1) = 2 := by decide +kernel + have hp : positive (shape 2 1 1) = true := by decide +kernel + simp only [AllFieldTerminalRates.secondLeafRate, hh, hp, Bool.not_true, Bool.false_eq_true, + show (2 : ℕ) ≠ 4 by decide, show (2 : ℕ) ≠ 3 by decide, ite_false] + have ht : (Ball.exact (980581 / 500000)).Encloses (2 - (binaryParameter (shape 2 3 3) (shape 2 1 1) : ℝ)) := by + have he : binaryParameter (shape 2 3 3) (shape 2 1 1) = (19419 / 500000) := by decide +kernel + rw [he] + convert Ball.exact_sound ((980581 / 500000) : ℚ) using 1 + norm_num [Ball.exact] + exact contains_sound (Ball.mul_sound ht logN5_sound) (by decide +kernel) +def B2_3_3U2_1_1Mass : Ball := ⟨(3278427034394245768597523877587 / 25000000000000000000000000000000), (67 / 50000000000000000000000000000000)⟩ +lemma B2_3_3U2_1_1Mass_sound : B2_3_3U2_1_1Mass.Encloses (littleMass (shape 2 3 3) (shape 2 1 1) : ℝ) := by + rw [littleMass_cast] + exact contains_sound (Ball.mul_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) (second_2_3_3)) + (B2_3_3Law_sound (shape 2 1 1))) (by decide +kernel) +def B2_3_3U2_2_0D : Ball := .exact (102383 / 1000000) +lemma B2_3_3U2_2_0D_sound : B2_3_3U2_2_0D.Encloses (binaryParameter (shape 2 3 3) (shape 2 2 0) : ℝ) := by + apply exact_rat_enclosed + decide +kernel +def B2_3_3U2_2_0OneD : Ball := .exact (897617 / 1000000) +lemma B2_3_3U2_2_0OneD_sound : B2_3_3U2_2_0OneD.Encloses (1 - (binaryParameter (shape 2 3 3) (shape 2 2 0) : ℝ)) := by + have he : binaryParameter (shape 2 3 3) (shape 2 2 0) = (102383 / 1000000) := by decide +kernel + rw [he] + convert Ball.exact_sound ((897617 / 1000000) : ℚ) using 1 <;> norm_num [B2_3_3U2_2_0OneD, Ball.exact] +def B2_3_3U2_2_0EDLogWitness : LogWitness := ⟨-4, 102383, 62500⟩ +def B2_3_3U2_2_0EDLog : Ball := ⟨(-56975864894596222495907774317173 / 25000000000000000000000000000000), (52939559207 / 50000000000000000000000000000000)⟩ +lemma B2_3_3U2_2_0EDLog_sound : B2_3_3U2_2_0EDLog.Encloses (Real.log ((binaryParameter (shape 2 3 3) (shape 2 2 0) : ℝ))) := by + exact checkLog_sound logTwoBall_sound (B2_3_3U2_2_0D_sound) (w := B2_3_3U2_2_0EDLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def B2_3_3U2_2_0ED : Ball := ⟨(1166671995100689009559705131583 / 5000000000000000000000000000000), (5420110891 / 50000000000000000000000000000000)⟩ +lemma B2_3_3U2_2_0ED_sound : B2_3_3U2_2_0ED.Encloses (Foundation.entropyTerm ((binaryParameter (shape 2 3 3) (shape 2 2 0) : ℝ))) := by + exact contains_sound (entropyTerm_ball (B2_3_3U2_2_0D_sound) B2_3_3U2_2_0EDLog_sound) (by decide +kernel) +def B2_3_3U2_2_0EOneDLogWitness : LogWitness := ⟨-1, 897617, 500000⟩ +def B2_3_3U2_2_0EOneDLog : Ball := ⟨(-2160236099982276913212034276979 / 20000000000000000000000000000000), (21175823683 / 50000000000000000000000000000000)⟩ +lemma B2_3_3U2_2_0EOneDLog_sound : B2_3_3U2_2_0EOneDLog.Encloses (Real.log ((1 - (binaryParameter (shape 2 3 3) (shape 2 2 0) : ℝ)))) := by + exact checkLog_sound logTwoBall_sound (B2_3_3U2_2_0OneD_sound) (w := B2_3_3U2_2_0EOneDLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def B2_3_3U2_2_0EOneD : Ball := ⟨(1939064647357791456006646571599 / 20000000000000000000000000000000), (7603111731 / 20000000000000000000000000000000)⟩ +lemma B2_3_3U2_2_0EOneD_sound : B2_3_3U2_2_0EOneD.Encloses (Foundation.entropyTerm ((1 - (binaryParameter (shape 2 3 3) (shape 2 2 0) : ℝ)))) := by + exact contains_sound (entropyTerm_ball (B2_3_3U2_2_0OneD_sound) B2_3_3U2_2_0EOneDLog_sound) (by decide +kernel) +def B2_3_3U2_2_0BinaryEntropy : Ball := ⟨(40125411917529625532633781163727 / 100000000000000000000000000000000), (1063837383 / 2000000000000000000000000000000)⟩ +lemma B2_3_3U2_2_0BinaryEntropy_sound : B2_3_3U2_2_0BinaryEntropy.Encloses + (binaryEntropyRate (binaryParameter (shape 2 3 3) (shape 2 2 0))) := by + exact contains_sound (Ball.add_sound (Ball.add_sound B2_3_3U2_2_0EOneD_sound B2_3_3U2_2_0ED_sound) + (Ball.mul_sound B2_3_3U2_2_0D_sound logN2_sound)) (by decide +kernel) +def B2_3_3U2_2_0Leaf : Ball := ⟨(329057178046601600722235670684489 / 100000000000000000000000000000000), (20904818139 / 12500000000000000000000000000000)⟩ +lemma B2_3_3U2_2_0Leaf_sound : B2_3_3U2_2_0Leaf.Encloses (AllFieldTerminalRates.secondLeafRate (shape 2 3 3) (shape 2 2 0)) := by + have hh : shapeMax (shape 2 2 0) = 2 := by decide +kernel + have hp : positive (shape 2 2 0) = false := by decide +kernel + simp only [AllFieldTerminalRates.secondLeafRate, hh, hp, Bool.not_false, + show (2 : ℕ) ≠ 4 by decide, show (2 : ℕ) ≠ 3 by decide, ite_false, ite_true] + exact contains_sound (Ball.add_sound B2_3_3U2_2_0BinaryEntropy_sound + (Ball.mul_sound (Ball.mul_sound (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) + B2_3_3U2_2_0OneD_sound) logN5_sound)) (by decide +kernel) +def B2_3_3U2_2_0Mass : Ball := ⟨(466550470537589006566890154189 / 50000000000000000000000000000000), (3 / 25000000000000000000000000000000)⟩ +lemma B2_3_3U2_2_0Mass_sound : B2_3_3U2_2_0Mass.Encloses (littleMass (shape 2 3 3) (shape 2 2 0) : ℝ) := by + rw [littleMass_cast] + exact contains_sound (Ball.mul_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) (second_2_3_3)) + (B2_3_3Law_sound (shape 2 2 0))) (by decide +kernel) +def B2_3_3Leaves (s : Shape) : Ball := + match s 0, s 1, s 2 with + | 0, 1, 3 => B2_3_3U0_1_3Leaf + | 0, 2, 2 => B2_3_3U0_2_2Leaf + | 0, 3, 1 => B2_3_3U0_3_1Leaf + | 1, 0, 3 => B2_3_3U1_0_3Leaf + | 1, 1, 2 => B2_3_3U1_1_2Leaf + | 1, 2, 1 => B2_3_3U1_2_1Leaf + | 1, 3, 0 => B2_3_3U1_3_0Leaf + | 2, 0, 2 => B2_3_3U2_0_2Leaf + | 2, 1, 1 => B2_3_3U2_1_1Leaf + | 2, 2, 0 => B2_3_3U2_2_0Leaf + | _, _, _ => (.exact 0) +lemma B2_3_3Leaves_sound (u : Shape) (hu : u ∈ below (shape 2 3 3)) : + (B2_3_3Leaves u).Encloses (AllFieldTerminalRates.secondLeafRate (shape 2 3 3) u) := by + rw [B2_3_3_below] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl + · exact B2_3_3U0_1_3Leaf_sound + · exact B2_3_3U0_2_2Leaf_sound + · exact B2_3_3U0_3_1Leaf_sound + · exact B2_3_3U1_0_3Leaf_sound + · exact B2_3_3U1_1_2Leaf_sound + · exact B2_3_3U1_2_1Leaf_sound + · exact B2_3_3U1_3_0Leaf_sound + · exact B2_3_3U2_0_2Leaf_sound + · exact B2_3_3U2_1_1Leaf_sound + · exact B2_3_3U2_2_0Leaf_sound +def B2_3_3Masses (s : Shape) : Ball := + match s 0, s 1, s 2 with + | 0, 1, 3 => B2_3_3U0_1_3Mass + | 0, 2, 2 => B2_3_3U0_2_2Mass + | 0, 3, 1 => B2_3_3U0_3_1Mass + | 1, 0, 3 => B2_3_3U1_0_3Mass + | 1, 1, 2 => B2_3_3U1_1_2Mass + | 1, 2, 1 => B2_3_3U1_2_1Mass + | 1, 3, 0 => B2_3_3U1_3_0Mass + | 2, 0, 2 => B2_3_3U2_0_2Mass + | 2, 1, 1 => B2_3_3U2_1_1Mass + | 2, 2, 0 => B2_3_3U2_2_0Mass + | _, _, _ => (.exact 0) +lemma B2_3_3Masses_sound (u : Shape) (hu : u ∈ below (shape 2 3 3)) : + (B2_3_3Masses u).Encloses ((fun u => (littleMass (shape 2 3 3) u : ℝ)) u) := by + rw [B2_3_3_below] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl + · exact B2_3_3U0_1_3Mass_sound + · exact B2_3_3U0_2_2Mass_sound + · exact B2_3_3U0_3_1Mass_sound + · exact B2_3_3U1_0_3Mass_sound + · exact B2_3_3U1_1_2Mass_sound + · exact B2_3_3U1_2_1Mass_sound + · exact B2_3_3U1_3_0Mass_sound + · exact B2_3_3U2_0_2Mass_sound + · exact B2_3_3U2_1_1Mass_sound + · exact B2_3_3U2_2_0Mass_sound +def B2_3_3Binaries (s : Shape) : Ball := + match s 0, s 1, s 2 with + | 0, 2, 2 => B2_3_3U0_2_2BinaryEntropy + | 1, 1, 2 => B2_3_3U1_1_2BinaryEntropy + | 1, 2, 1 => B2_3_3U1_2_1BinaryEntropy + | 2, 0, 2 => B2_3_3U2_0_2BinaryEntropy + | 2, 1, 1 => B2_3_3U2_1_1BinaryEntropy + | 2, 2, 0 => B2_3_3U2_2_0BinaryEntropy + | _, _, _ => (.exact 0) +lemma B2_3_3Binaries_sound (u : Shape) (hu : u ∈ (below (shape 2 3 3)).filter positive) : + (B2_3_3Binaries u).Encloses ((fun u => binaryEntropyRate (binaryParameter (shape 2 3 3) u)) u) := by + have hl : (below (shape 2 3 3)).filter positive = [(shape 1 1 2), (shape 1 2 1), (shape 2 1 1)] := by decide +kernel + rw [hl] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl + · exact B2_3_3U1_1_2BinaryEntropy_sound + · exact B2_3_3U1_2_1BinaryEntropy_sound + · exact B2_3_3U2_1_1BinaryEntropy_sound +def B2_3_3S2 : Ball := ⟨(257277205828662462897692981670147 / 100000000000000000000000000000000), (53506556373 / 50000000000000000000000000000000)⟩ +lemma B2_3_3S2_sound : B2_3_3S2.Encloses + (((below (shape 2 3 3)).map fun u => (littleMass (shape 2 3 3) u : ℝ) * AllFieldTerminalRates.secondLeafRate (shape 2 3 3) u).sum) := by + exact contains_sound (listSumBall_sound (below (shape 2 3 3)) + (fun u => .mul (B2_3_3Masses u) (B2_3_3Leaves u)) _ + (fun u hu => Ball.mul_sound (B2_3_3Masses_sound u hu) (B2_3_3Leaves_sound u hu))) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/Certificates/Terminal2_4_2.lean b/lean/OAI/LinearAlgebra/MatrixFields/Certificates/Terminal2_4_2.lean new file mode 100644 index 0000000000000000000000000000000000000000..f6473edc41f3cab80a235cbc5cdf73692d076283 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/Certificates/Terminal2_4_2.lean @@ -0,0 +1,738 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Certificates.LittleB1_3_4 +import OAI.LinearAlgebra.MatrixFields.Certificates.Terminal1_1_6 + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate +open scoped BigOperators +lemma B2_4_2_below : below (shape 2 4 2) = [ + (shape 0 2 2), + (shape 0 3 1), + (shape 0 4 0), + (shape 1 1 2), + (shape 1 2 1), + (shape 1 3 0), + (shape 2 0 2), + (shape 2 1 1), + (shape 2 2 0)] := by decide +kernel +def B2_4_2Raw (s : Shape) : Ball := + match s 0, s 1, s 2 with + | 0, 2, 2 => ⟨(131106254622443168152919965261 / 500000000000000000000000000000), (1 / 1562500000000000000000000000000)⟩ + | 0, 3, 1 => ⟨(887034541322513256023482129547 / 12500000000000000000000000000000), (9 / 50000000000000000000000000000000)⟩ + | 0, 4, 0 => ⟨(59473180615091031899554539751 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 1, 1, 2 => ⟨(1420107074792739577725554863013 / 20000000000000000000000000000000), (19 / 100000000000000000000000000000000)⟩ + | 1, 2, 1 => ⟨1, 0⟩ + | 1, 3, 0 => ⟨(1420107074792739577725554863013 / 20000000000000000000000000000000), (19 / 100000000000000000000000000000000)⟩ + | 2, 0, 2 => ⟨(59473180615091031899554539751 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 2, 1, 1 => ⟨(887034541322513256023482129547 / 12500000000000000000000000000000), (9 / 50000000000000000000000000000000)⟩ + | 2, 2, 0 => ⟨(131106254622443168152919965261 / 500000000000000000000000000000), (1 / 1562500000000000000000000000000)⟩ + | _, _, _ => (.exact 0) +lemma B2_4_2Raw_0_2_2 : (B2_4_2Raw (shape 0 2 2)).Encloses (splitWeight positiveSecond tablep (shape 2 4 2) (shape 0 2 2) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveSecond tablep (shape 2 4 2) (shape 0 2 2) + (-6696) (0) (-6690) w150 w195 w152 + (by decide +kernel) w150_sound w195_sound w152_sound) (by decide +kernel) +lemma B2_4_2Raw_0_3_1 : (B2_4_2Raw (shape 0 3 1)).Encloses (splitWeight positiveSecond tablep (shape 2 4 2) (shape 0 3 1) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveSecond tablep (shape 2 4 2) (shape 0 3 1) + (-6696) (-19760) (0) w150 w87 w195 + (by decide +kernel) w150_sound w87_sound w195_sound) (by decide +kernel) +lemma B2_4_2Raw_0_4_0 : (B2_4_2Raw (shape 0 4 0)).Encloses (splitWeight positiveSecond tablep (shape 2 4 2) (shape 0 4 0) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveSecond tablep (shape 2 4 2) (shape 0 4 0) + (-6696) (-60888) (-6690) w150 w20 w152 + (by decide +kernel) w150_sound w20_sound w152_sound) (by decide +kernel) +lemma B2_4_2Raw_1_1_2 : (B2_4_2Raw (shape 1 1 2)).Encloses (splitWeight positiveSecond tablep (shape 2 4 2) (shape 1 1 2) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveSecond tablep (shape 2 4 2) (shape 1 1 2) + (0) (-19760) (-6690) w195 w87 w152 + (by decide +kernel) w195_sound w87_sound w152_sound) (by decide +kernel) +lemma B2_4_2Raw_1_2_1 : (B2_4_2Raw (shape 1 2 1)).Encloses (splitWeight positiveSecond tablep (shape 2 4 2) (shape 1 2 1) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveSecond tablep (shape 2 4 2) (shape 1 2 1) + (0) (0) (0) w195 w195 w195 + (by decide +kernel) w195_sound w195_sound w195_sound) (by decide +kernel) +lemma B2_4_2Raw_1_3_0 : (B2_4_2Raw (shape 1 3 0)).Encloses (splitWeight positiveSecond tablep (shape 2 4 2) (shape 1 3 0) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveSecond tablep (shape 2 4 2) (shape 1 3 0) + (0) (-19760) (-6690) w195 w87 w152 + (by decide +kernel) w195_sound w87_sound w152_sound) (by decide +kernel) +lemma B2_4_2Raw_2_0_2 : (B2_4_2Raw (shape 2 0 2)).Encloses (splitWeight positiveSecond tablep (shape 2 4 2) (shape 2 0 2) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveSecond tablep (shape 2 4 2) (shape 2 0 2) + (-6696) (-60888) (-6690) w150 w20 w152 + (by decide +kernel) w150_sound w20_sound w152_sound) (by decide +kernel) +lemma B2_4_2Raw_2_1_1 : (B2_4_2Raw (shape 2 1 1)).Encloses (splitWeight positiveSecond tablep (shape 2 4 2) (shape 2 1 1) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveSecond tablep (shape 2 4 2) (shape 2 1 1) + (-6696) (-19760) (0) w150 w87 w195 + (by decide +kernel) w150_sound w87_sound w195_sound) (by decide +kernel) +lemma B2_4_2Raw_2_2_0 : (B2_4_2Raw (shape 2 2 0)).Encloses (splitWeight positiveSecond tablep (shape 2 4 2) (shape 2 2 0) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveSecond tablep (shape 2 4 2) (shape 2 2 0) + (-6696) (0) (-6690) w150 w195 w152 + (by decide +kernel) w150_sound w195_sound w152_sound) (by decide +kernel) +lemma B2_4_2Raw_sound (u : Shape) (hu : u ∈ below (shape 2 4 2)) : + (B2_4_2Raw u).Encloses (splitWeight positiveSecond tablep (shape 2 4 2) u : ℝ) := by + rw [B2_4_2_below] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl + · exact B2_4_2Raw_0_2_2 + · exact B2_4_2Raw_0_3_1 + · exact B2_4_2Raw_0_4_0 + · exact B2_4_2Raw_1_1_2 + · exact B2_4_2Raw_1_2_1 + · exact B2_4_2Raw_1_3_0 + · exact B2_4_2Raw_2_0_2 + · exact B2_4_2Raw_2_1_1 + · exact B2_4_2Raw_2_2_0 +def B2_4_2Den : Ball := ⟨(2827422994051485268728099341981 / 1562500000000000000000000000000), (51 / 25000000000000000000000000000000)⟩ +lemma B2_4_2Den_sound : B2_4_2Den.Encloses (((below (shape 2 4 2)).map (splitWeight positiveSecond tablep (shape 2 4 2))).sum : ℝ) := by + exact contains_sound (list_cast_enclosed (below (shape 2 4 2)) B2_4_2Raw (splitWeight positiveSecond tablep (shape 2 4 2)) B2_4_2Raw_sound) (by decide +kernel) +lemma B2_4_2Den_positive : 0 < B2_4_2Den.lower := by decide +kernel +def B2_4_2Table (s : Shape) : Ball := + match s 0, s 1, s 2 with + | 0, 2, 2 => ⟨(14490475834606388578250612343089 / 100000000000000000000000000000000), (13 / 25000000000000000000000000000000)⟩ + | 0, 3, 1 => ⟨(3921568081556569782136761397233 / 100000000000000000000000000000000), (3 / 20000000000000000000000000000000)⟩ + | 0, 4, 0 => ⟨(32866269004172783017016141121 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 1, 1, 2 => ⟨(3923921728428956034133711412569 / 100000000000000000000000000000000), (1 / 6250000000000000000000000000000)⟩ + | 1, 2, 1 => ⟨(6907792021600978205615474676497 / 12500000000000000000000000000000), (63 / 100000000000000000000000000000000)⟩ + | 1, 3, 0 => ⟨(3923921728428956034133711412569 / 100000000000000000000000000000000), (1 / 6250000000000000000000000000000)⟩ + | 2, 0, 2 => ⟨(32866269004172783017016141121 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 2, 1, 1 => ⟨(3921568081556569782136761397233 / 100000000000000000000000000000000), (3 / 20000000000000000000000000000000)⟩ + | 2, 2, 0 => ⟨(14490475834606388578250612343089 / 100000000000000000000000000000000), (13 / 25000000000000000000000000000000)⟩ + | _, _, _ => (.exact 0) +def B2_4_2Law (u : Shape) : Ball := if u ∈ below (shape 2 4 2) then B2_4_2Table u else .exact 0 +lemma B2_4_2Law_check_0_2_2 : contains (.mul (B2_4_2Raw (shape 0 2 2)) (.inv B2_4_2Den)) (B2_4_2Table (shape 0 2 2)) = true := by decide +kernel +lemma B2_4_2Law_check_0_3_1 : contains (.mul (B2_4_2Raw (shape 0 3 1)) (.inv B2_4_2Den)) (B2_4_2Table (shape 0 3 1)) = true := by decide +kernel +lemma B2_4_2Law_check_0_4_0 : contains (.mul (B2_4_2Raw (shape 0 4 0)) (.inv B2_4_2Den)) (B2_4_2Table (shape 0 4 0)) = true := by decide +kernel +lemma B2_4_2Law_check_1_1_2 : contains (.mul (B2_4_2Raw (shape 1 1 2)) (.inv B2_4_2Den)) (B2_4_2Table (shape 1 1 2)) = true := by decide +kernel +lemma B2_4_2Law_check_1_2_1 : contains (.mul (B2_4_2Raw (shape 1 2 1)) (.inv B2_4_2Den)) (B2_4_2Table (shape 1 2 1)) = true := by decide +kernel +lemma B2_4_2Law_check_1_3_0 : contains (.mul (B2_4_2Raw (shape 1 3 0)) (.inv B2_4_2Den)) (B2_4_2Table (shape 1 3 0)) = true := by decide +kernel +lemma B2_4_2Law_check_2_0_2 : contains (.mul (B2_4_2Raw (shape 2 0 2)) (.inv B2_4_2Den)) (B2_4_2Table (shape 2 0 2)) = true := by decide +kernel +lemma B2_4_2Law_check_2_1_1 : contains (.mul (B2_4_2Raw (shape 2 1 1)) (.inv B2_4_2Den)) (B2_4_2Table (shape 2 1 1)) = true := by decide +kernel +lemma B2_4_2Law_check_2_2_0 : contains (.mul (B2_4_2Raw (shape 2 2 0)) (.inv B2_4_2Den)) (B2_4_2Table (shape 2 2 0)) = true := by decide +kernel +lemma B2_4_2Law_check (u : Shape) (hu : u ∈ below (shape 2 4 2)) : + contains (.mul (B2_4_2Raw u) (.inv B2_4_2Den)) (B2_4_2Table u) = true := by + rw [B2_4_2_below] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl + · exact B2_4_2Law_check_0_2_2 + · exact B2_4_2Law_check_0_3_1 + · exact B2_4_2Law_check_0_4_0 + · exact B2_4_2Law_check_1_1_2 + · exact B2_4_2Law_check_1_2_1 + · exact B2_4_2Law_check_1_3_0 + · exact B2_4_2Law_check_2_0_2 + · exact B2_4_2Law_check_2_1_1 + · exact B2_4_2Law_check_2_2_0 +lemma B2_4_2Law_sound (u : Shape) : + (B2_4_2Law u).Encloses (stageBLaw (shape 2 4 2) u : ℝ) := by + by_cases hu : u ∈ below (shape 2 4 2) + · have h := contains_sound (Ball.mul_sound (B2_4_2Raw_sound u hu) + (Ball.inv_sound B2_4_2Den_sound B2_4_2Den_positive)) (B2_4_2Law_check u hu) + simpa only [B2_4_2Law, hu, ite_true, stageBLaw, splitLaw, + Rat.cast_div, Rat.cast_mul, Rat.cast_inv, div_eq_mul_inv] using h + · simp only [B2_4_2Law, hu, ite_false, stageBLaw, splitLaw, Rat.cast_zero] + simpa only [Rat.cast_zero] using Ball.exact_sound 0 + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def B2_4_2Binary (u : Shape) : ℚ := + match u 0, u 1, u 2 with + | 0, 2, 2 => (104793 / 1000000) + | 1, 1, 2 => (21063 / 500000) + | 1, 2, 1 => (5907 / 500000) + | 2, 0, 2 => (31669 / 500000) + | 2, 1, 1 => (8433 / 200000) + | 2, 2, 0 => (3277 / 31250) + | _, _, _ => 0 +lemma B2_4_2Binary_eq (u : Shape) (hu : u ∈ shapes 4) : + binaryParameter (shape 2 4 2) u = B2_4_2Binary u := by + rw [shapes4_list] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel +def B2_4_2LittleRat (u : Shape) (w : Fin 3) (i : Fin 6) : ℚ := + if u w = 2 then + if i = 2 then 1 - B2_4_2Binary u else if i = 3 then B2_4_2Binary u else 0 + else if i = singletonSlot (u w) then 1 else 0 + +def B2_4_2Little (u : Shape) (w : Fin 3) (i : Fin 6) : Ball := + if u ∈ shapes 4 then .exact (B2_4_2LittleRat u w i) + else .exact (littleLaw (shape 2 4 2) u w i) + +lemma B2_4_2Little_sound (u : Shape) (w : Fin 3) (i : Fin 6) : + (B2_4_2Little u w i).Encloses (littleLaw (shape 2 4 2) u w i : ℝ) := by + by_cases hu : u ∈ shapes 4 + · simp only [B2_4_2Little, hu, ite_true] + apply exact_rat_enclosed + simp only [B2_4_2LittleRat, littleLaw, B2_4_2Binary_eq u hu] + · simp only [B2_4_2Little, hu, ite_false] + exact Ball.exact_sound _ +def B2_4_2Half (w : Fin 3) (ij : PairSlot) : Ball := + match w.val, ij.1.val, ij.2.val with + | 0, 0, 2 => ⟨(16757946325341947750940189356037 / 100000000000000000000000000000000), (63 / 100000000000000000000000000000000)⟩ + | 0, 0, 3 => ⟨(843481929912591696232100262703 / 50000000000000000000000000000000), (7 / 100000000000000000000000000000000)⟩ + | 0, 1, 1 => ⟨(31555089814832868856595610118557 / 50000000000000000000000000000000), (19 / 20000000000000000000000000000000)⟩ + | 0, 2, 0 => ⟨(16757946325341947750940189356037 / 100000000000000000000000000000000), (63 / 100000000000000000000000000000000)⟩ + | 0, 3, 0 => ⟨(843481929912591696232100262703 / 50000000000000000000000000000000), (7 / 100000000000000000000000000000000)⟩ + | 1, 2, 2 => ⟨(38593837517531901492832074284017 / 50000000000000000000000000000000), (73 / 50000000000000000000000000000000)⟩ + | 1, 2, 3 => ⟨(84117846883879413836036378887 / 2500000000000000000000000000000), (11 / 100000000000000000000000000000000)⟩ + | 1, 3, 2 => ⟨(84117846883879413836036378887 / 2500000000000000000000000000000), (11 / 100000000000000000000000000000000)⟩ + | 1, 3, 3 => ⟨(8154626406161167721949080479 / 2500000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ + | 1, 4, 1 => ⟨(3922744904992762908135236404901 / 50000000000000000000000000000000), (31 / 100000000000000000000000000000000)⟩ + | 1, 5, 0 => ⟨(32866269004172783017016141121 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 1, 1, 4 => ⟨(3922744904992762908135236404901 / 50000000000000000000000000000000), (31 / 100000000000000000000000000000000)⟩ + | 1, 0, 5 => ⟨(32866269004172783017016141121 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 2, 2, 0 => ⟨(16761382587425625619496074982197 / 100000000000000000000000000000000), (1 / 1562500000000000000000000000000)⟩ + | 2, 3, 0 => ⟨(842940622306945887952632457291 / 50000000000000000000000000000000), (7 / 100000000000000000000000000000000)⟩ + | 2, 1, 1 => ⟨(31552736167960482604598660103221 / 50000000000000000000000000000000), (93 / 100000000000000000000000000000000)⟩ + | 2, 0, 2 => ⟨(16761382587425625619496074982197 / 100000000000000000000000000000000), (1 / 1562500000000000000000000000000)⟩ + | 2, 0, 3 => ⟨(842940622306945887952632457291 / 50000000000000000000000000000000), (7 / 100000000000000000000000000000000)⟩ + | _, _, _ => (.exact 0) +lemma B2_4_2Half_check_0_0 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 2 4 2)) (shape 2 4 2) B2_4_2Law + (fun u => B2_4_2Little u 0) ((0 : Fin 6),j)) (B2_4_2Half 0 (0,j)) = true := by + decide +kernel +lemma B2_4_2Half_check_0_1 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 2 4 2)) (shape 2 4 2) B2_4_2Law + (fun u => B2_4_2Little u 0) ((1 : Fin 6),j)) (B2_4_2Half 0 (1,j)) = true := by + decide +kernel +lemma B2_4_2Half_check_0_2 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 2 4 2)) (shape 2 4 2) B2_4_2Law + (fun u => B2_4_2Little u 0) ((2 : Fin 6),j)) (B2_4_2Half 0 (2,j)) = true := by + decide +kernel +lemma B2_4_2Half_check_0_3 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 2 4 2)) (shape 2 4 2) B2_4_2Law + (fun u => B2_4_2Little u 0) ((3 : Fin 6),j)) (B2_4_2Half 0 (3,j)) = true := by + decide +kernel +lemma B2_4_2Half_check_0_4 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 2 4 2)) (shape 2 4 2) B2_4_2Law + (fun u => B2_4_2Little u 0) ((4 : Fin 6),j)) (B2_4_2Half 0 (4,j)) = true := by + decide +kernel +lemma B2_4_2Half_check_0_5 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 2 4 2)) (shape 2 4 2) B2_4_2Law + (fun u => B2_4_2Little u 0) ((5 : Fin 6),j)) (B2_4_2Half 0 (5,j)) = true := by + decide +kernel +lemma B2_4_2Half_check_1_0 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 2 4 2)) (shape 2 4 2) B2_4_2Law + (fun u => B2_4_2Little u 1) ((0 : Fin 6),j)) (B2_4_2Half 1 (0,j)) = true := by + decide +kernel +lemma B2_4_2Half_check_1_1 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 2 4 2)) (shape 2 4 2) B2_4_2Law + (fun u => B2_4_2Little u 1) ((1 : Fin 6),j)) (B2_4_2Half 1 (1,j)) = true := by + decide +kernel +lemma B2_4_2Half_check_1_2 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 2 4 2)) (shape 2 4 2) B2_4_2Law + (fun u => B2_4_2Little u 1) ((2 : Fin 6),j)) (B2_4_2Half 1 (2,j)) = true := by + decide +kernel +lemma B2_4_2Half_check_1_3 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 2 4 2)) (shape 2 4 2) B2_4_2Law + (fun u => B2_4_2Little u 1) ((3 : Fin 6),j)) (B2_4_2Half 1 (3,j)) = true := by + decide +kernel +lemma B2_4_2Half_check_1_4 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 2 4 2)) (shape 2 4 2) B2_4_2Law + (fun u => B2_4_2Little u 1) ((4 : Fin 6),j)) (B2_4_2Half 1 (4,j)) = true := by + decide +kernel +lemma B2_4_2Half_check_1_5 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 2 4 2)) (shape 2 4 2) B2_4_2Law + (fun u => B2_4_2Little u 1) ((5 : Fin 6),j)) (B2_4_2Half 1 (5,j)) = true := by + decide +kernel +lemma B2_4_2Half_check_2_0 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 2 4 2)) (shape 2 4 2) B2_4_2Law + (fun u => B2_4_2Little u 2) ((0 : Fin 6),j)) (B2_4_2Half 2 (0,j)) = true := by + decide +kernel +lemma B2_4_2Half_check_2_1 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 2 4 2)) (shape 2 4 2) B2_4_2Law + (fun u => B2_4_2Little u 2) ((1 : Fin 6),j)) (B2_4_2Half 2 (1,j)) = true := by + decide +kernel +lemma B2_4_2Half_check_2_2 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 2 4 2)) (shape 2 4 2) B2_4_2Law + (fun u => B2_4_2Little u 2) ((2 : Fin 6),j)) (B2_4_2Half 2 (2,j)) = true := by + decide +kernel +lemma B2_4_2Half_check_2_3 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 2 4 2)) (shape 2 4 2) B2_4_2Law + (fun u => B2_4_2Little u 2) ((3 : Fin 6),j)) (B2_4_2Half 2 (3,j)) = true := by + decide +kernel +lemma B2_4_2Half_check_2_4 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 2 4 2)) (shape 2 4 2) B2_4_2Law + (fun u => B2_4_2Little u 2) ((4 : Fin 6),j)) (B2_4_2Half 2 (4,j)) = true := by + decide +kernel +lemma B2_4_2Half_check_2_5 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 2 4 2)) (shape 2 4 2) B2_4_2Law + (fun u => B2_4_2Little u 2) ((5 : Fin 6),j)) (B2_4_2Half 2 (5,j)) = true := by + decide +kernel +lemma B2_4_2Half_sound (w : Fin 3) (ij : PairSlot) : + (B2_4_2Half w ij).Encloses (halfLaw (shape 2 4 2) w ij : ℝ) := by + have hcheck : contains (pairLawBall (below (shape 2 4 2)) (shape 2 4 2) B2_4_2Law + (fun u => B2_4_2Little u w) ij) (B2_4_2Half w ij) = true := by + rcases ij with ⟨i,j⟩ + revert i w + apply forall_fin3 + · exact forall_fin6 (B2_4_2Half_check_0_0 j) (B2_4_2Half_check_0_1 j) (B2_4_2Half_check_0_2 j) (B2_4_2Half_check_0_3 j) (B2_4_2Half_check_0_4 j) (B2_4_2Half_check_0_5 j) + · exact forall_fin6 (B2_4_2Half_check_1_0 j) (B2_4_2Half_check_1_1 j) (B2_4_2Half_check_1_2 j) (B2_4_2Half_check_1_3 j) (B2_4_2Half_check_1_4 j) (B2_4_2Half_check_1_5 j) + · exact forall_fin6 (B2_4_2Half_check_2_0 j) (B2_4_2Half_check_2_1 j) (B2_4_2Half_check_2_2 j) (B2_4_2Half_check_2_3 j) (B2_4_2Half_check_2_4 j) (B2_4_2Half_check_2_5 j) + have h := contains_sound (pairLawBall_sound (below (shape 2 4 2)) (shape 2 4 2) + B2_4_2Law (fun u => (stageBLaw (shape 2 4 2) u : ℝ)) + (fun u => B2_4_2Little u w) (fun u i => (littleLaw (shape 2 4 2) u w i : ℝ)) + (fun u _ => B2_4_2Law_sound u) (fun u i => B2_4_2Little_sound u w i) ij) hcheck + have hp : positive (shape 2 4 2) = true := by decide +kernel + simpa only [halfLaw, hp, ite_true, pairLaw, positiveHalfLaw, Rat.cast_list_sum, + List.map_map, Function.comp_def, Rat.cast_mul] using h + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def B2_4_2U0_2_2D : Ball := .exact (104793 / 1000000) +lemma B2_4_2U0_2_2D_sound : B2_4_2U0_2_2D.Encloses (binaryParameter (shape 2 4 2) (shape 0 2 2) : ℝ) := by + apply exact_rat_enclosed + decide +kernel +def B2_4_2U0_2_2OneD : Ball := .exact (895207 / 1000000) +lemma B2_4_2U0_2_2OneD_sound : B2_4_2U0_2_2OneD.Encloses (1 - (binaryParameter (shape 2 4 2) (shape 0 2 2) : ℝ)) := by + have he : binaryParameter (shape 2 4 2) (shape 0 2 2) = (104793 / 1000000) := by decide +kernel + rw [he] + convert Ball.exact_sound ((895207 / 1000000) : ℚ) using 1 <;> norm_num [B2_4_2U0_2_2OneD, Ball.exact] +def B2_4_2U0_2_2EDLogWitness : LogWitness := ⟨-4, 104793, 62500⟩ +def B2_4_2U0_2_2EDLog : Ball := ⟨(-22557683032191364513180248834139 / 10000000000000000000000000000000), (21175823683 / 20000000000000000000000000000000)⟩ +lemma B2_4_2U0_2_2EDLog_sound : B2_4_2U0_2_2EDLog.Encloses (Real.log ((binaryParameter (shape 2 4 2) (shape 0 2 2) : ℝ))) := by + exact checkLog_sound logTwoBall_sound (B2_4_2U0_2_2D_sound) (w := B2_4_2U0_2_2EDLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def B2_4_2U0_2_2ED : Ball := ⟨(23638872779924296614296978160759 / 100000000000000000000000000000000), (11095390457 / 100000000000000000000000000000000)⟩ +lemma B2_4_2U0_2_2ED_sound : B2_4_2U0_2_2ED.Encloses (Foundation.entropyTerm ((binaryParameter (shape 2 4 2) (shape 0 2 2) : ℝ))) := by + exact contains_sound (entropyTerm_ball (B2_4_2U0_2_2D_sound) B2_4_2U0_2_2EDLog_sound) (by decide +kernel) +def B2_4_2U0_2_2EOneDLogWitness : LogWitness := ⟨-1, 895207, 500000⟩ +def B2_4_2U0_2_2EOneDLog : Ball := ⟨(-22140060506662698219615744903 / 200000000000000000000000000000), (21175823683 / 50000000000000000000000000000000)⟩ +lemma B2_4_2U0_2_2EOneDLog_sound : B2_4_2U0_2_2EOneDLog.Encloses (Real.log ((1 - (binaryParameter (shape 2 4 2) (shape 0 2 2) : ℝ)))) := by + exact checkLog_sound logTwoBall_sound (B2_4_2U0_2_2OneD_sound) (w := B2_4_2U0_2_2EOneDLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def B2_4_2U0_2_2EOneD : Ball := ⟨(990996857299399704254377607369 / 10000000000000000000000000000000), (2369593199 / 6250000000000000000000000000000)⟩ +lemma B2_4_2U0_2_2EOneD_sound : B2_4_2U0_2_2EOneD.Encloses (Foundation.entropyTerm ((1 - (binaryParameter (shape 2 4 2) (shape 0 2 2) : ℝ)))) := by + exact contains_sound (entropyTerm_ball (B2_4_2U0_2_2OneD_sound) B2_4_2U0_2_2EOneDLog_sound) (by decide +kernel) +def B2_4_2U0_2_2BinaryEntropy : Ball := ⟨(10203134650540032134454188200943 / 25000000000000000000000000000000), (417554983 / 781250000000000000000000000000)⟩ +lemma B2_4_2U0_2_2BinaryEntropy_sound : B2_4_2U0_2_2BinaryEntropy.Encloses + (binaryEntropyRate (binaryParameter (shape 2 4 2) (shape 0 2 2))) := by + exact contains_sound (Ball.add_sound (Ball.add_sound B2_4_2U0_2_2EOneD_sound B2_4_2U0_2_2ED_sound) + (Ball.mul_sound B2_4_2U0_2_2D_sound logN2_sound)) (by decide +kernel) +def B2_4_2U0_2_2Leaf : Ball := ⟨(328968555657438867346861076509999 / 100000000000000000000000000000000), (1337500091 / 800000000000000000000000000000)⟩ +lemma B2_4_2U0_2_2Leaf_sound : B2_4_2U0_2_2Leaf.Encloses (AllFieldTerminalRates.secondLeafRate (shape 2 4 2) (shape 0 2 2)) := by + have hh : shapeMax (shape 0 2 2) = 2 := by decide +kernel + have hp : positive (shape 0 2 2) = false := by decide +kernel + simp only [AllFieldTerminalRates.secondLeafRate, hh, hp, Bool.not_false, + show (2 : ℕ) ≠ 4 by decide, show (2 : ℕ) ≠ 3 by decide, ite_false, ite_true] + exact contains_sound (Ball.add_sound B2_4_2U0_2_2BinaryEntropy_sound + (Ball.mul_sound (Ball.mul_sound (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) + B2_4_2U0_2_2OneD_sound) logN5_sound)) (by decide +kernel) +def B2_4_2U0_2_2Mass : Ball := ⟨(2052429189538757016962171971651 / 100000000000000000000000000000000), (33 / 100000000000000000000000000000000)⟩ +lemma B2_4_2U0_2_2Mass_sound : B2_4_2U0_2_2Mass.Encloses (littleMass (shape 2 4 2) (shape 0 2 2) : ℝ) := by + rw [littleMass_cast] + exact contains_sound (Ball.mul_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) (second_2_4_2)) + (B2_4_2Law_sound (shape 0 2 2))) (by decide +kernel) +def B2_4_2U0_3_1Leaf : Ball := ⟨(115129254649702284200899544090987 / 50000000000000000000000000000000), (21175823683 / 25000000000000000000000000000000)⟩ +lemma B2_4_2U0_3_1Leaf_sound : B2_4_2U0_3_1Leaf.Encloses (AllFieldTerminalRates.secondLeafRate (shape 2 4 2) (shape 0 3 1)) := by + have hh : shapeMax (shape 0 3 1) = 3 := by decide +kernel + simp only [AllFieldTerminalRates.secondLeafRate, hh, show (3 : ℕ) ≠ 4 by decide, ite_false, ite_true] + exact logN10_sound +def B2_4_2U0_3_1Mass : Ball := ⟨(27772520692964670763404186047 / 5000000000000000000000000000000), (9 / 100000000000000000000000000000000)⟩ +lemma B2_4_2U0_3_1Mass_sound : B2_4_2U0_3_1Mass.Encloses (littleMass (shape 2 4 2) (shape 0 3 1) : ℝ) := by + rw [littleMass_cast] + exact contains_sound (Ball.mul_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) (second_2_4_2)) + (B2_4_2Law_sound (shape 0 3 1))) (by decide +kernel) +def B2_4_2U0_4_0Leaf : Ball := ⟨0, 0⟩ +lemma B2_4_2U0_4_0Leaf_sound : B2_4_2U0_4_0Leaf.Encloses (AllFieldTerminalRates.secondLeafRate (shape 2 4 2) (shape 0 4 0)) := by + have hh : shapeMax (shape 0 4 0) = 4 := by decide +kernel + simp only [AllFieldTerminalRates.secondLeafRate, hh, ite_true] + simpa only [B2_4_2U0_4_0Leaf, Ball.exact, Rat.cast_zero] using Ball.exact_sound 0 +def B2_4_2U0_4_0Mass : Ball := ⟨(2327587120855560415853758489 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ +lemma B2_4_2U0_4_0Mass_sound : B2_4_2U0_4_0Mass.Encloses (littleMass (shape 2 4 2) (shape 0 4 0) : ℝ) := by + rw [littleMass_cast] + exact contains_sound (Ball.mul_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) (second_2_4_2)) + (B2_4_2Law_sound (shape 0 4 0))) (by decide +kernel) +def B2_4_2U1_1_2D : Ball := .exact (21063 / 500000) +lemma B2_4_2U1_1_2D_sound : B2_4_2U1_1_2D.Encloses (binaryParameter (shape 2 4 2) (shape 1 1 2) : ℝ) := by + apply exact_rat_enclosed + decide +kernel +def B2_4_2U1_1_2OneD : Ball := .exact (478937 / 500000) +lemma B2_4_2U1_1_2OneD_sound : B2_4_2U1_1_2OneD.Encloses (1 - (binaryParameter (shape 2 4 2) (shape 1 1 2) : ℝ)) := by + have he : binaryParameter (shape 2 4 2) (shape 1 1 2) = (21063 / 500000) := by decide +kernel + rw [he] + convert Ball.exact_sound ((478937 / 500000) : ℚ) using 1 <;> norm_num [B2_4_2U1_1_2OneD, Ball.exact] +def B2_4_2U1_1_2EDLogWitness : LogWitness := ⟨-5, 21063, 15625⟩ +def B2_4_2U1_1_2EDLog : Ball := ⟨(-316709015171897026732453267991509 / 100000000000000000000000000000000), (63527471049 / 50000000000000000000000000000000)⟩ +lemma B2_4_2U1_1_2EDLog_sound : B2_4_2U1_1_2EDLog.Encloses (Real.log ((binaryParameter (shape 2 4 2) (shape 1 1 2) : ℝ))) := by + exact checkLog_sound logTwoBall_sound (B2_4_2U1_1_2D_sound) (w := B2_4_2U1_1_2EDLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def B2_4_2U1_1_2ED : Ball := ⟨(1334168397313133414813132636741 / 10000000000000000000000000000000), (1338079123 / 25000000000000000000000000000000)⟩ +lemma B2_4_2U1_1_2ED_sound : B2_4_2U1_1_2ED.Encloses (Foundation.entropyTerm ((binaryParameter (shape 2 4 2) (shape 1 1 2) : ℝ))) := by + exact contains_sound (entropyTerm_ball (B2_4_2U1_1_2D_sound) B2_4_2U1_1_2EDLog_sound) (by decide +kernel) +def B2_4_2U1_1_2EOneDLogWitness : LogWitness := ⟨-1, 478937, 250000⟩ +def B2_4_2U1_1_2EOneDLog : Ball := ⟨(-2151951683483404577051660903857 / 50000000000000000000000000000000), (21175823683 / 50000000000000000000000000000000)⟩ +lemma B2_4_2U1_1_2EOneDLog_sound : B2_4_2U1_1_2EOneDLog.Encloses (Real.log ((1 - (binaryParameter (shape 2 4 2) (shape 1 1 2) : ℝ)))) := by + exact checkLog_sound logTwoBall_sound (B2_4_2U1_1_2OneD_sound) (w := B2_4_2U1_1_2EOneDLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def B2_4_2U1_1_2EOneD : Ball := ⟨(2061298566864982675838782636621 / 50000000000000000000000000000000), (4056754187 / 10000000000000000000000000000000)⟩ +lemma B2_4_2U1_1_2EOneD_sound : B2_4_2U1_1_2EOneD.Encloses (Foundation.entropyTerm ((1 - (binaryParameter (shape 2 4 2) (shape 1 1 2) : ℝ)))) := by + exact contains_sound (entropyTerm_ball (B2_4_2U1_1_2OneD_sound) B2_4_2U1_1_2EOneDLog_sound) (by decide +kernel) +def B2_4_2U1_1_2BinaryEntropy : Ball := ⟨(2038423291968812511025992287109 / 10000000000000000000000000000000), (2385198193 / 5000000000000000000000000000000)⟩ +lemma B2_4_2U1_1_2BinaryEntropy_sound : B2_4_2U1_1_2BinaryEntropy.Encloses + (binaryEntropyRate (binaryParameter (shape 2 4 2) (shape 1 1 2))) := by + exact contains_sound (Ball.add_sound (Ball.add_sound B2_4_2U1_1_2EOneD_sound B2_4_2U1_1_2ED_sound) + (Ball.mul_sound B2_4_2U1_1_2D_sound logN2_sound)) (by decide +kernel) +def B2_4_2U1_1_2Leaf : Ball := ⟨(78776916084225045920527158276243 / 25000000000000000000000000000000), (124378783853 / 100000000000000000000000000000000)⟩ +lemma B2_4_2U1_1_2Leaf_sound : B2_4_2U1_1_2Leaf.Encloses (AllFieldTerminalRates.secondLeafRate (shape 2 4 2) (shape 1 1 2)) := by + have hh : shapeMax (shape 1 1 2) = 2 := by decide +kernel + have hp : positive (shape 1 1 2) = true := by decide +kernel + simp only [AllFieldTerminalRates.secondLeafRate, hh, hp, Bool.not_true, Bool.false_eq_true, + show (2 : ℕ) ≠ 4 by decide, show (2 : ℕ) ≠ 3 by decide, ite_false] + have ht : (Ball.exact (978937 / 500000)).Encloses (2 - (binaryParameter (shape 2 4 2) (shape 1 1 2) : ℝ)) := by + have he : binaryParameter (shape 2 4 2) (shape 1 1 2) = (21063 / 500000) := by decide +kernel + rw [he] + convert Ball.exact_sound ((978937 / 500000) : ℚ) using 1 + norm_num [Ball.exact] + exact contains_sound (Ball.mul_sound ht logN5_sound) (by decide +kernel) +def B2_4_2U1_1_2Mass : Ball := ⟨(111156756821736540136239317403 / 20000000000000000000000000000000), (9 / 100000000000000000000000000000000)⟩ +lemma B2_4_2U1_1_2Mass_sound : B2_4_2U1_1_2Mass.Encloses (littleMass (shape 2 4 2) (shape 1 1 2) : ℝ) := by + rw [littleMass_cast] + exact contains_sound (Ball.mul_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) (second_2_4_2)) + (B2_4_2Law_sound (shape 1 1 2))) (by decide +kernel) +def B2_4_2U1_2_1D : Ball := .exact (5907 / 500000) +lemma B2_4_2U1_2_1D_sound : B2_4_2U1_2_1D.Encloses (binaryParameter (shape 2 4 2) (shape 1 2 1) : ℝ) := by + apply exact_rat_enclosed + decide +kernel +def B2_4_2U1_2_1OneD : Ball := .exact (494093 / 500000) +lemma B2_4_2U1_2_1OneD_sound : B2_4_2U1_2_1OneD.Encloses (1 - (binaryParameter (shape 2 4 2) (shape 1 2 1) : ℝ)) := by + have he : binaryParameter (shape 2 4 2) (shape 1 2 1) = (5907 / 500000) := by decide +kernel + rw [he] + convert Ball.exact_sound ((494093 / 500000) : ℚ) using 1 <;> norm_num [B2_4_2U1_2_1OneD, Ball.exact] +def B2_4_2U1_2_1EDLogWitness : LogWitness := ⟨-7, 23628, 15625⟩ +def B2_4_2U1_2_1EDLog : Ball := ⟨(-443847001009709356305572202505481 / 100000000000000000000000000000000), (21175823683 / 12500000000000000000000000000000)⟩ +lemma B2_4_2U1_2_1EDLog_sound : B2_4_2U1_2_1EDLog.Encloses (Real.log ((binaryParameter (shape 2 4 2) (shape 1 2 1) : ℝ))) := by + exact checkLog_sound logTwoBall_sound (B2_4_2U1_2_1D_sound) (w := B2_4_2U1_2_1EDLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def B2_4_2U1_2_1ED : Ball := ⟨(13109021174821765838485075001 / 250000000000000000000000000000), (2001369449 / 100000000000000000000000000000000)⟩ +lemma B2_4_2U1_2_1ED_sound : B2_4_2U1_2_1ED.Encloses (Foundation.entropyTerm ((binaryParameter (shape 2 4 2) (shape 1 2 1) : ℝ))) := by + exact contains_sound (entropyTerm_ball (B2_4_2U1_2_1D_sound) B2_4_2U1_2_1EDLog_sound) (by decide +kernel) +def B2_4_2U1_2_1EOneDLogWitness : LogWitness := ⟨-1, 494093, 250000⟩ +def B2_4_2U1_2_1EOneDLog : Ball := ⟨(-594216992173993420750540540271 / 50000000000000000000000000000000), (21175823683 / 50000000000000000000000000000000)⟩ +lemma B2_4_2U1_2_1EOneDLog_sound : B2_4_2U1_2_1EOneDLog.Encloses (Real.log ((1 - (binaryParameter (shape 2 4 2) (shape 1 2 1) : ℝ)))) := by + exact checkLog_sound logTwoBall_sound (B2_4_2U1_2_1OneD_sound) (w := B2_4_2U1_2_1EOneDLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def B2_4_2U1_2_1EOneD : Ball := ⟨(73399614078556232809724206791 / 6250000000000000000000000000000), (8370261001 / 20000000000000000000000000000000)⟩ +lemma B2_4_2U1_2_1EOneD_sound : B2_4_2U1_2_1EOneD.Encloses (Foundation.entropyTerm ((1 - (binaryParameter (shape 2 4 2) (shape 1 2 1) : ℝ)))) := by + exact contains_sound (entropyTerm_ball (B2_4_2U1_2_1OneD_sound) B2_4_2U1_2_1EOneDLog_sound) (by decide +kernel) +def B2_4_2U1_2_1BinaryEntropy : Ball := ⟨(7236886374299125448895135111753 / 100000000000000000000000000000000), (44353016817 / 100000000000000000000000000000000)⟩ +lemma B2_4_2U1_2_1BinaryEntropy_sound : B2_4_2U1_2_1BinaryEntropy.Encloses + (binaryEntropyRate (binaryParameter (shape 2 4 2) (shape 1 2 1))) := by + exact contains_sound (Ball.add_sound (Ball.add_sound B2_4_2U1_2_1EOneD_sound B2_4_2U1_2_1ED_sound) + (Ball.mul_sound B2_4_2U1_2_1D_sound logN2_sound)) (by decide +kernel) +def B2_4_2U1_2_1Leaf : Ball := ⟨(319986192537070428737598453638203 / 100000000000000000000000000000000), (31576107139 / 25000000000000000000000000000000)⟩ +lemma B2_4_2U1_2_1Leaf_sound : B2_4_2U1_2_1Leaf.Encloses (AllFieldTerminalRates.secondLeafRate (shape 2 4 2) (shape 1 2 1)) := by + have hh : shapeMax (shape 1 2 1) = 2 := by decide +kernel + have hp : positive (shape 1 2 1) = true := by decide +kernel + simp only [AllFieldTerminalRates.secondLeafRate, hh, hp, Bool.not_true, Bool.false_eq_true, + show (2 : ℕ) ≠ 4 by decide, show (2 : ℕ) ≠ 3 by decide, ite_false] + have ht : (Ball.exact (994093 / 500000)).Encloses (2 - (binaryParameter (shape 2 4 2) (shape 1 2 1) : ℝ)) := by + have he : binaryParameter (shape 2 4 2) (shape 1 2 1) = (5907 / 500000) := by decide +kernel + rw [he] + convert Ball.exact_sound ((994093 / 500000) : ℚ) using 1 + norm_num [Ball.exact] + exact contains_sound (Ball.mul_sound ht logN5_sound) (by decide +kernel) +def B2_4_2U1_2_1Mass : Ball := ⟨(7827350401585707164473237434991 / 100000000000000000000000000000000), (103 / 100000000000000000000000000000000)⟩ +lemma B2_4_2U1_2_1Mass_sound : B2_4_2U1_2_1Mass.Encloses (littleMass (shape 2 4 2) (shape 1 2 1) : ℝ) := by + rw [littleMass_cast] + exact contains_sound (Ball.mul_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) (second_2_4_2)) + (B2_4_2Law_sound (shape 1 2 1))) (by decide +kernel) +def B2_4_2U1_3_0Leaf : Ball := ⟨(115129254649702284200899544090987 / 50000000000000000000000000000000), (21175823683 / 25000000000000000000000000000000)⟩ +lemma B2_4_2U1_3_0Leaf_sound : B2_4_2U1_3_0Leaf.Encloses (AllFieldTerminalRates.secondLeafRate (shape 2 4 2) (shape 1 3 0)) := by + have hh : shapeMax (shape 1 3 0) = 3 := by decide +kernel + simp only [AllFieldTerminalRates.secondLeafRate, hh, show (3 : ℕ) ≠ 4 by decide, ite_false, ite_true] + exact logN10_sound +def B2_4_2U1_3_0Mass : Ball := ⟨(111156756821736540136239317403 / 20000000000000000000000000000000), (9 / 100000000000000000000000000000000)⟩ +lemma B2_4_2U1_3_0Mass_sound : B2_4_2U1_3_0Mass.Encloses (littleMass (shape 2 4 2) (shape 1 3 0) : ℝ) := by + rw [littleMass_cast] + exact contains_sound (Ball.mul_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) (second_2_4_2)) + (B2_4_2Law_sound (shape 1 3 0))) (by decide +kernel) +def B2_4_2U2_0_2D : Ball := .exact (31669 / 500000) +lemma B2_4_2U2_0_2D_sound : B2_4_2U2_0_2D.Encloses (binaryParameter (shape 2 4 2) (shape 2 0 2) : ℝ) := by + apply exact_rat_enclosed + decide +kernel +def B2_4_2U2_0_2OneD : Ball := .exact (468331 / 500000) +lemma B2_4_2U2_0_2OneD_sound : B2_4_2U2_0_2OneD.Encloses (1 - (binaryParameter (shape 2 4 2) (shape 2 0 2) : ℝ)) := by + have he : binaryParameter (shape 2 4 2) (shape 2 0 2) = (31669 / 500000) := by decide +kernel + rw [he] + convert Ball.exact_sound ((468331 / 500000) : ℚ) using 1 <;> norm_num [B2_4_2U2_0_2OneD, Ball.exact] +def B2_4_2U2_0_2EDLogWitness : LogWitness := ⟨-4, 31669, 31250⟩ +def B2_4_2U2_0_2EDLog : Ball := ⟨(-275926981399378237867248750022457 / 100000000000000000000000000000000), (52939559207 / 50000000000000000000000000000000)⟩ +lemma B2_4_2U2_0_2EDLog_sound : B2_4_2U2_0_2EDLog.Encloses (Real.log ((binaryParameter (shape 2 4 2) (shape 2 0 2) : ℝ))) := by + exact checkLog_sound logTwoBall_sound (B2_4_2U2_0_2D_sound) (w := B2_4_2U2_0_2EDLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def B2_4_2U2_0_2ED : Ball := ⟨(8738331573936909415017900664461 / 50000000000000000000000000000000), (6706171603 / 100000000000000000000000000000000)⟩ +lemma B2_4_2U2_0_2ED_sound : B2_4_2U2_0_2ED.Encloses (Foundation.entropyTerm ((binaryParameter (shape 2 4 2) (shape 2 0 2) : ℝ))) := by + exact contains_sound (entropyTerm_ball (B2_4_2U2_0_2D_sound) B2_4_2U2_0_2EDLog_sound) (by decide +kernel) +def B2_4_2U2_0_2EOneDLogWitness : LogWitness := ⟨-1, 468331, 250000⟩ +def B2_4_2U2_0_2EOneDLog : Ball := ⟨(-817909844265902747909981412881 / 12500000000000000000000000000000), (21175823683 / 50000000000000000000000000000000)⟩ +lemma B2_4_2U2_0_2EOneDLog_sound : B2_4_2U2_0_2EOneDLog.Encloses (Real.log ((1 - (binaryParameter (shape 2 4 2) (shape 2 0 2) : ℝ)))) := by + exact checkLog_sound logTwoBall_sound (B2_4_2U2_0_2OneD_sound) (w := B2_4_2U2_0_2EOneDLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def B2_4_2U2_0_2EOneD : Ball := ⟨(95763133818723624957857376269 / 1562500000000000000000000000000), (19834589363 / 50000000000000000000000000000000)⟩ +lemma B2_4_2U2_0_2EOneD_sound : B2_4_2U2_0_2EOneD.Encloses (Foundation.entropyTerm ((1 - (binaryParameter (shape 2 4 2) (shape 2 0 2) : ℝ)))) := by + exact contains_sound (entropyTerm_ball (B2_4_2U2_0_2OneD_sound) B2_4_2U2_0_2EOneDLog_sound) (by decide +kernel) +def B2_4_2U2_0_2BinaryEntropy : Ball := ⟨(699893983112567810703138425289 / 2500000000000000000000000000000), (49057818971 / 100000000000000000000000000000000)⟩ +lemma B2_4_2U2_0_2BinaryEntropy_sound : B2_4_2U2_0_2BinaryEntropy.Encloses + (binaryEntropyRate (binaryParameter (shape 2 4 2) (shape 2 0 2))) := by + exact contains_sound (Ball.add_sound (Ball.add_sound B2_4_2U2_0_2EOneD_sound B2_4_2U2_0_2ED_sound) + (Ball.mul_sound B2_4_2U2_0_2D_sound logN2_sound)) (by decide +kernel) +def B2_4_2U2_0_2Leaf : Ball := ⟨(20593476631985786090186547073947 / 6250000000000000000000000000000), (168065355147 / 100000000000000000000000000000000)⟩ +lemma B2_4_2U2_0_2Leaf_sound : B2_4_2U2_0_2Leaf.Encloses (AllFieldTerminalRates.secondLeafRate (shape 2 4 2) (shape 2 0 2)) := by + have hh : shapeMax (shape 2 0 2) = 2 := by decide +kernel + have hp : positive (shape 2 0 2) = false := by decide +kernel + simp only [AllFieldTerminalRates.secondLeafRate, hh, hp, Bool.not_false, + show (2 : ℕ) ≠ 4 by decide, show (2 : ℕ) ≠ 3 by decide, ite_false, ite_true] + exact contains_sound (Ball.add_sound B2_4_2U2_0_2BinaryEntropy_sound + (Ball.mul_sound (Ball.mul_sound (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) + B2_4_2U2_0_2OneD_sound) logN5_sound)) (by decide +kernel) +def B2_4_2U2_0_2Mass : Ball := ⟨(2327587120855560415853758489 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ +lemma B2_4_2U2_0_2Mass_sound : B2_4_2U2_0_2Mass.Encloses (littleMass (shape 2 4 2) (shape 2 0 2) : ℝ) := by + rw [littleMass_cast] + exact contains_sound (Ball.mul_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) (second_2_4_2)) + (B2_4_2Law_sound (shape 2 0 2))) (by decide +kernel) +def B2_4_2U2_1_1D : Ball := .exact (8433 / 200000) +lemma B2_4_2U2_1_1D_sound : B2_4_2U2_1_1D.Encloses (binaryParameter (shape 2 4 2) (shape 2 1 1) : ℝ) := by + apply exact_rat_enclosed + decide +kernel +def B2_4_2U2_1_1OneD : Ball := .exact (191567 / 200000) +lemma B2_4_2U2_1_1OneD_sound : B2_4_2U2_1_1OneD.Encloses (1 - (binaryParameter (shape 2 4 2) (shape 2 1 1) : ℝ)) := by + have he : binaryParameter (shape 2 4 2) (shape 2 1 1) = (8433 / 200000) := by decide +kernel + rw [he] + convert Ball.exact_sound ((191567 / 200000) : ℚ) using 1 <;> norm_num [B2_4_2U2_1_1OneD, Ball.exact] +def B2_4_2U2_1_1EDLogWitness : LogWitness := ⟨-5, 8433, 6250⟩ +def B2_4_2U2_1_1EDLog : Ball := ⟨(-316616478595553215892035736909523 / 100000000000000000000000000000000), (63527471049 / 50000000000000000000000000000000)⟩ +lemma B2_4_2U2_1_1EDLog_sound : B2_4_2U2_1_1EDLog.Encloses (Real.log ((binaryParameter (shape 2 4 2) (shape 2 1 1) : ℝ))) := by + exact checkLog_sound logTwoBall_sound (B2_4_2U2_1_1D_sound) (w := B2_4_2U2_1_1EDLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def B2_4_2U2_1_1ED : Ball := ⟨(1335013381998150134808768684679 / 10000000000000000000000000000000), (2678635817 / 50000000000000000000000000000000)⟩ +lemma B2_4_2U2_1_1ED_sound : B2_4_2U2_1_1ED.Encloses (Foundation.entropyTerm ((binaryParameter (shape 2 4 2) (shape 2 1 1) : ℝ))) := by + exact contains_sound (entropyTerm_ball (B2_4_2U2_1_1D_sound) B2_4_2U2_1_1EDLog_sound) (by decide +kernel) +def B2_4_2U2_1_1EOneDLogWitness : LogWitness := ⟨-1, 191567, 100000⟩ +def B2_4_2U2_1_1EOneDLog : Ball := ⟨(-4307974966568354882089913298341 / 100000000000000000000000000000000), (21175823683 / 50000000000000000000000000000000)⟩ +lemma B2_4_2U2_1_1EOneDLog_sound : B2_4_2U2_1_1EOneDLog.Encloses (Real.log ((1 - (binaryParameter (shape 2 4 2) (shape 2 1 1) : ℝ)))) := by + exact checkLog_sound logTwoBall_sound (B2_4_2U2_1_1OneD_sound) (w := B2_4_2U2_1_1EOneDLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def B2_4_2U2_1_1EOneD : Ball := ⟨(1031582300525750049621648026029 / 25000000000000000000000000000000), (10141472539 / 25000000000000000000000000000000)⟩ +lemma B2_4_2U2_1_1EOneD_sound : B2_4_2U2_1_1EOneD.Encloses (Foundation.entropyTerm ((1 - (binaryParameter (shape 2 4 2) (shape 2 1 1) : ℝ)))) := by + exact contains_sound (entropyTerm_ball (B2_4_2U2_1_1OneD_sound) B2_4_2U2_1_1EOneDLog_sound) (by decide +kernel) +def B2_4_2U2_1_1BinaryEntropy : Ball := ⟨(20399118108915510943732037385873 / 100000000000000000000000000000000), (23854459501 / 50000000000000000000000000000000)⟩ +lemma B2_4_2U2_1_1BinaryEntropy_sound : B2_4_2U2_1_1BinaryEntropy.Encloses + (binaryEntropyRate (binaryParameter (shape 2 4 2) (shape 2 1 1))) := by + exact contains_sound (Ball.add_sound (Ball.add_sound B2_4_2U2_1_1EOneD_sound B2_4_2U2_1_1ED_sound) + (Ball.mul_sound B2_4_2U2_1_1D_sound logN2_sound)) (by decide +kernel) +def B2_4_2U2_1_1Leaf : Ball := ⟨(157550693764520845345323845072531 / 50000000000000000000000000000000), (62188153141 / 50000000000000000000000000000000)⟩ +lemma B2_4_2U2_1_1Leaf_sound : B2_4_2U2_1_1Leaf.Encloses (AllFieldTerminalRates.secondLeafRate (shape 2 4 2) (shape 2 1 1)) := by + have hh : shapeMax (shape 2 1 1) = 2 := by decide +kernel + have hp : positive (shape 2 1 1) = true := by decide +kernel + simp only [AllFieldTerminalRates.secondLeafRate, hh, hp, Bool.not_true, Bool.false_eq_true, + show (2 : ℕ) ≠ 4 by decide, show (2 : ℕ) ≠ 3 by decide, ite_false] + have ht : (Ball.exact (391567 / 200000)).Encloses (2 - (binaryParameter (shape 2 4 2) (shape 2 1 1) : ℝ)) := by + have he : binaryParameter (shape 2 4 2) (shape 2 1 1) = (8433 / 200000) := by decide +kernel + rw [he] + convert Ball.exact_sound ((391567 / 200000) : ℚ) using 1 + norm_num [Ball.exact] + exact contains_sound (Ball.mul_sound ht logN5_sound) (by decide +kernel) +def B2_4_2U2_1_1Mass : Ball := ⟨(27772520692964670763404186047 / 5000000000000000000000000000000), (9 / 100000000000000000000000000000000)⟩ +lemma B2_4_2U2_1_1Mass_sound : B2_4_2U2_1_1Mass.Encloses (littleMass (shape 2 4 2) (shape 2 1 1) : ℝ) := by + rw [littleMass_cast] + exact contains_sound (Ball.mul_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) (second_2_4_2)) + (B2_4_2Law_sound (shape 2 1 1))) (by decide +kernel) +def B2_4_2U2_2_0D : Ball := .exact (3277 / 31250) +lemma B2_4_2U2_2_0D_sound : B2_4_2U2_2_0D.Encloses (binaryParameter (shape 2 4 2) (shape 2 2 0) : ℝ) := by + apply exact_rat_enclosed + decide +kernel +def B2_4_2U2_2_0OneD : Ball := .exact (27973 / 31250) +lemma B2_4_2U2_2_0OneD_sound : B2_4_2U2_2_0OneD.Encloses (1 - (binaryParameter (shape 2 4 2) (shape 2 2 0) : ℝ)) := by + have he : binaryParameter (shape 2 4 2) (shape 2 2 0) = (3277 / 31250) := by decide +kernel + rw [he] + convert Ball.exact_sound ((27973 / 31250) : ℚ) using 1 <;> norm_num [B2_4_2U2_2_0OneD, Ball.exact] +def B2_4_2U2_2_0EDLogWitness : LogWitness := ⟨-4, 26216, 15625⟩ +def B2_4_2U2_2_0EDLog : Ball := ⟨(-56377275161643324031409595775453 / 25000000000000000000000000000000), (21175823683 / 20000000000000000000000000000000)⟩ +lemma B2_4_2U2_2_0EDLog_sound : B2_4_2U2_2_0EDLog.Encloses (Real.log ((binaryParameter (shape 2 4 2) (shape 2 2 0) : ℝ))) := by + exact checkLog_sound logTwoBall_sound (B2_4_2U2_2_0D_sound) (w := B2_4_2U2_2_0EDLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def B2_4_2U2_2_0ED : Ball := ⟨(5911946582550565531229735851397 / 25000000000000000000000000000000), (5551453937 / 50000000000000000000000000000000)⟩ +lemma B2_4_2U2_2_0ED_sound : B2_4_2U2_2_0ED.Encloses (Foundation.entropyTerm ((binaryParameter (shape 2 4 2) (shape 2 2 0) : ℝ))) := by + exact contains_sound (entropyTerm_ball (B2_4_2U2_2_0D_sound) B2_4_2U2_2_0EDLog_sound) (by decide +kernel) +def B2_4_2U2_2_0EOneDLogWitness : LogWitness := ⟨-1, 27973, 15625⟩ +def B2_4_2U2_2_0EOneDLog : Ball := ⟨(-2769490423601434424009732717579 / 25000000000000000000000000000000), (21175823683 / 50000000000000000000000000000000)⟩ +lemma B2_4_2U2_2_0EOneDLog_sound : B2_4_2U2_2_0EOneDLog.Encloses (Real.log ((1 - (binaryParameter (shape 2 4 2) (shape 2 2 0) : ℝ)))) := by + exact checkLog_sound logTwoBall_sound (B2_4_2U2_2_0OneD_sound) (w := B2_4_2U2_2_0EOneDLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def B2_4_2U2_2_0EOneD : Ball := ⟨(9916282319283574418281504423531 / 100000000000000000000000000000000), (37910484217 / 100000000000000000000000000000000)⟩ +lemma B2_4_2U2_2_0EOneD_sound : B2_4_2U2_2_0EOneD.Encloses (Foundation.entropyTerm ((1 - (binaryParameter (shape 2 4 2) (shape 2 2 0) : ℝ)))) := by + exact contains_sound (entropyTerm_ball (B2_4_2U2_2_0OneD_sound) B2_4_2U2_2_0EOneDLog_sound) (by decide +kernel) +def B2_4_2U2_2_0BinaryEntropy : Ball := ⟨(40832687243709647035873308745149 / 100000000000000000000000000000000), (53454555241 / 100000000000000000000000000000000)⟩ +lemma B2_4_2U2_2_0BinaryEntropy_sound : B2_4_2U2_2_0BinaryEntropy.Encloses + (binaryEntropyRate (binaryParameter (shape 2 4 2) (shape 2 2 0))) := by + exact contains_sound (Ball.add_sound (Ball.add_sound B2_4_2U2_2_0EOneD_sound B2_4_2U2_2_0ED_sound) + (Ball.mul_sound B2_4_2U2_2_0D_sound logN2_sound)) (by decide +kernel) +def B2_4_2U2_2_0Leaf : Ball := ⟨(82241462570157955404899575418567 / 25000000000000000000000000000000), (41796501973 / 25000000000000000000000000000000)⟩ +lemma B2_4_2U2_2_0Leaf_sound : B2_4_2U2_2_0Leaf.Encloses (AllFieldTerminalRates.secondLeafRate (shape 2 4 2) (shape 2 2 0)) := by + have hh : shapeMax (shape 2 2 0) = 2 := by decide +kernel + have hp : positive (shape 2 2 0) = false := by decide +kernel + simp only [AllFieldTerminalRates.secondLeafRate, hh, hp, Bool.not_false, + show (2 : ℕ) ≠ 4 by decide, show (2 : ℕ) ≠ 3 by decide, ite_false, ite_true] + exact contains_sound (Ball.add_sound B2_4_2U2_2_0BinaryEntropy_sound + (Ball.mul_sound (Ball.mul_sound (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) + B2_4_2U2_2_0OneD_sound) logN5_sound)) (by decide +kernel) +def B2_4_2U2_2_0Mass : Ball := ⟨(2052429189538757016962171971651 / 100000000000000000000000000000000), (33 / 100000000000000000000000000000000)⟩ +lemma B2_4_2U2_2_0Mass_sound : B2_4_2U2_2_0Mass.Encloses (littleMass (shape 2 4 2) (shape 2 2 0) : ℝ) := by + rw [littleMass_cast] + exact contains_sound (Ball.mul_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) (second_2_4_2)) + (B2_4_2Law_sound (shape 2 2 0))) (by decide +kernel) +def B2_4_2Leaves (s : Shape) : Ball := + match s 0, s 1, s 2 with + | 0, 2, 2 => B2_4_2U0_2_2Leaf + | 0, 3, 1 => B2_4_2U0_3_1Leaf + | 0, 4, 0 => B2_4_2U0_4_0Leaf + | 1, 1, 2 => B2_4_2U1_1_2Leaf + | 1, 2, 1 => B2_4_2U1_2_1Leaf + | 1, 3, 0 => B2_4_2U1_3_0Leaf + | 2, 0, 2 => B2_4_2U2_0_2Leaf + | 2, 1, 1 => B2_4_2U2_1_1Leaf + | 2, 2, 0 => B2_4_2U2_2_0Leaf + | _, _, _ => (.exact 0) +lemma B2_4_2Leaves_sound (u : Shape) (hu : u ∈ below (shape 2 4 2)) : + (B2_4_2Leaves u).Encloses (AllFieldTerminalRates.secondLeafRate (shape 2 4 2) u) := by + rw [B2_4_2_below] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl + · exact B2_4_2U0_2_2Leaf_sound + · exact B2_4_2U0_3_1Leaf_sound + · exact B2_4_2U0_4_0Leaf_sound + · exact B2_4_2U1_1_2Leaf_sound + · exact B2_4_2U1_2_1Leaf_sound + · exact B2_4_2U1_3_0Leaf_sound + · exact B2_4_2U2_0_2Leaf_sound + · exact B2_4_2U2_1_1Leaf_sound + · exact B2_4_2U2_2_0Leaf_sound +def B2_4_2Masses (s : Shape) : Ball := + match s 0, s 1, s 2 with + | 0, 2, 2 => B2_4_2U0_2_2Mass + | 0, 3, 1 => B2_4_2U0_3_1Mass + | 0, 4, 0 => B2_4_2U0_4_0Mass + | 1, 1, 2 => B2_4_2U1_1_2Mass + | 1, 2, 1 => B2_4_2U1_2_1Mass + | 1, 3, 0 => B2_4_2U1_3_0Mass + | 2, 0, 2 => B2_4_2U2_0_2Mass + | 2, 1, 1 => B2_4_2U2_1_1Mass + | 2, 2, 0 => B2_4_2U2_2_0Mass + | _, _, _ => (.exact 0) +lemma B2_4_2Masses_sound (u : Shape) (hu : u ∈ below (shape 2 4 2)) : + (B2_4_2Masses u).Encloses ((fun u => (littleMass (shape 2 4 2) u : ℝ)) u) := by + rw [B2_4_2_below] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl + · exact B2_4_2U0_2_2Mass_sound + · exact B2_4_2U0_3_1Mass_sound + · exact B2_4_2U0_4_0Mass_sound + · exact B2_4_2U1_1_2Mass_sound + · exact B2_4_2U1_2_1Mass_sound + · exact B2_4_2U1_3_0Mass_sound + · exact B2_4_2U2_0_2Mass_sound + · exact B2_4_2U2_1_1Mass_sound + · exact B2_4_2U2_2_0Mass_sound +def B2_4_2Binaries (s : Shape) : Ball := + match s 0, s 1, s 2 with + | 0, 2, 2 => B2_4_2U0_2_2BinaryEntropy + | 1, 1, 2 => B2_4_2U1_1_2BinaryEntropy + | 1, 2, 1 => B2_4_2U1_2_1BinaryEntropy + | 2, 0, 2 => B2_4_2U2_0_2BinaryEntropy + | 2, 1, 1 => B2_4_2U2_1_1BinaryEntropy + | 2, 2, 0 => B2_4_2U2_2_0BinaryEntropy + | _, _, _ => (.exact 0) +lemma B2_4_2Binaries_sound (u : Shape) (hu : u ∈ (below (shape 2 4 2)).filter positive) : + (B2_4_2Binaries u).Encloses ((fun u => binaryEntropyRate (binaryParameter (shape 2 4 2) u)) u) := by + have hl : (below (shape 2 4 2)).filter positive = [(shape 1 1 2), (shape 1 2 1), (shape 2 1 1)] := by decide +kernel + rw [hl] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl + · exact B2_4_2U1_1_2BinaryEntropy_sound + · exact B2_4_2U1_2_1BinaryEntropy_sound + · exact B2_4_2U2_1_1BinaryEntropy_sound +def B2_4_2S2 : Ball := ⟨(44625677478615700179775906702917 / 100000000000000000000000000000000), (19080272089 / 100000000000000000000000000000000)⟩ +lemma B2_4_2S2_sound : B2_4_2S2.Encloses + (((below (shape 2 4 2)).map fun u => (littleMass (shape 2 4 2) u : ℝ) * AllFieldTerminalRates.secondLeafRate (shape 2 4 2) u).sum) := by + exact contains_sound (listSumBall_sound (below (shape 2 4 2)) + (fun u => .mul (B2_4_2Masses u) (B2_4_2Leaves u)) _ + (fun u hu => Ball.mul_sound (B2_4_2Masses_sound u hu) (B2_4_2Leaves_sound u hu))) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/Certificates/Terminal2_5_1.lean b/lean/OAI/LinearAlgebra/MatrixFields/Certificates/Terminal2_5_1.lean new file mode 100644 index 0000000000000000000000000000000000000000..e2f81b57f7bb5a628c0235834d37ee22b81937e8 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/Certificates/Terminal2_5_1.lean @@ -0,0 +1,262 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Certificates.Terminal1_1_6 + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def B2_5_1U0_3_1Leaf : Ball := ⟨(115129254649702284200899544090987 / 50000000000000000000000000000000), (21175823683 / 25000000000000000000000000000000)⟩ +lemma B2_5_1U0_3_1Leaf_sound : B2_5_1U0_3_1Leaf.Encloses (AllFieldTerminalRates.secondLeafRate (shape 2 5 1) (shape 0 3 1)) := by + have hh : shapeMax (shape 0 3 1) = 3 := by decide +kernel + simp only [AllFieldTerminalRates.secondLeafRate, hh, show (3 : ℕ) ≠ 4 by decide, ite_false, ite_true] + exact logN10_sound +def B2_5_1U0_3_1Mass : Ball := ⟨(8730128534988305962655873559 / 25000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ +lemma B2_5_1U0_3_1Mass_sound : B2_5_1U0_3_1Mass.Encloses (littleMass (shape 2 5 1) (shape 0 3 1) : ℝ) := by + rw [littleMass_cast] + exact contains_sound (Ball.mul_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) (second_2_5_1)) + (B2_5_1Law_sound (shape 0 3 1))) (by decide +kernel) +def B2_5_1U0_4_0Leaf : Ball := ⟨0, 0⟩ +lemma B2_5_1U0_4_0Leaf_sound : B2_5_1U0_4_0Leaf.Encloses (AllFieldTerminalRates.secondLeafRate (shape 2 5 1) (shape 0 4 0)) := by + have hh : shapeMax (shape 0 4 0) = 4 := by decide +kernel + simp only [AllFieldTerminalRates.secondLeafRate, hh, ite_true] + simpa only [B2_5_1U0_4_0Leaf, Ball.exact, Rat.cast_zero] using Ball.exact_sound 0 +def B2_5_1U0_4_0Mass : Ball := ⟨(348255140010022353957739057 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ +lemma B2_5_1U0_4_0Mass_sound : B2_5_1U0_4_0Mass.Encloses (littleMass (shape 2 5 1) (shape 0 4 0) : ℝ) := by + rw [littleMass_cast] + exact contains_sound (Ball.mul_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) (second_2_5_1)) + (B2_5_1Law_sound (shape 0 4 0))) (by decide +kernel) +def B2_5_1U1_2_1D : Ball := .exact (3587 / 1000000) +lemma B2_5_1U1_2_1D_sound : B2_5_1U1_2_1D.Encloses (binaryParameter (shape 2 5 1) (shape 1 2 1) : ℝ) := by + apply exact_rat_enclosed + decide +kernel +def B2_5_1U1_2_1OneD : Ball := .exact (996413 / 1000000) +lemma B2_5_1U1_2_1OneD_sound : B2_5_1U1_2_1OneD.Encloses (1 - (binaryParameter (shape 2 5 1) (shape 1 2 1) : ℝ)) := by + have he : binaryParameter (shape 2 5 1) (shape 1 2 1) = (3587 / 1000000) := by decide +kernel + rw [he] + convert Ball.exact_sound ((996413 / 1000000) : ℚ) using 1 <;> norm_num [B2_5_1U1_2_1OneD, Ball.exact] +def B2_5_1U1_2_1EDLogWitness : LogWitness := ⟨-9, 28696, 15625⟩ +def B2_5_1U1_2_1EDLog : Ball := ⟨(-563043908043199152811645612664621 / 100000000000000000000000000000000), (21175823683 / 10000000000000000000000000000000)⟩ +lemma B2_5_1U1_2_1EDLog_sound : B2_5_1U1_2_1EDLog.Encloses (Real.log ((binaryParameter (shape 2 5 1) (shape 1 2 1) : ℝ))) := by + exact checkLog_sound logTwoBall_sound (B2_5_1U1_2_1D_sound) (w := B2_5_1U1_2_1EDLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def B2_5_1U1_2_1ED : Ball := ⟨(504909624537738840283843203157 / 25000000000000000000000000000000), (189894199 / 25000000000000000000000000000000)⟩ +lemma B2_5_1U1_2_1ED_sound : B2_5_1U1_2_1ED.Encloses (Foundation.entropyTerm ((binaryParameter (shape 2 5 1) (shape 1 2 1) : ℝ))) := by + exact contains_sound (entropyTerm_ball (B2_5_1U1_2_1D_sound) B2_5_1U1_2_1EDLog_sound) (by decide +kernel) +def B2_5_1U1_2_1EOneDLogWitness : LogWitness := ⟨-1, 996413, 500000⟩ +def B2_5_1U1_2_1EOneDLog : Ball := ⟨(-17967243550669688953494441141 / 5000000000000000000000000000000), (21175823683 / 50000000000000000000000000000000)⟩ +lemma B2_5_1U1_2_1EOneDLog_sound : B2_5_1U1_2_1EOneDLog.Encloses (Real.log ((1 - (binaryParameter (shape 2 5 1) (shape 1 2 1) : ℝ)))) := by + exact checkLog_sound logTwoBall_sound (B2_5_1U1_2_1OneD_sound) (w := B2_5_1U1_2_1EOneDLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def B2_5_1U1_2_1EOneD : Ball := ⟨(358055900961068735584365131613 / 100000000000000000000000000000000), (5274966501 / 12500000000000000000000000000000)⟩ +lemma B2_5_1U1_2_1EOneD_sound : B2_5_1U1_2_1EOneD.Encloses (Foundation.entropyTerm ((1 - (binaryParameter (shape 2 5 1) (shape 1 2 1) : ℝ)))) := by + exact contains_sound (entropyTerm_ball (B2_5_1U1_2_1OneD_sound) B2_5_1U1_2_1EOneDLog_sound) (by decide +kernel) +def B2_5_1U1_2_1BinaryEntropy : Ball := ⟨(2626326292778876479207699037713 / 100000000000000000000000000000000), (10777806041 / 25000000000000000000000000000000)⟩ +lemma B2_5_1U1_2_1BinaryEntropy_sound : B2_5_1U1_2_1BinaryEntropy.Encloses + (binaryEntropyRate (binaryParameter (shape 2 5 1) (shape 1 2 1))) := by + exact contains_sound (Ball.add_sound (Ball.add_sound B2_5_1U1_2_1EOneD_sound B2_5_1U1_2_1ED_sound) + (Ball.mul_sound B2_5_1U1_2_1D_sound logN2_sound)) (by decide +kernel) +def B2_5_1U1_2_1Leaf : Ball := ⟨(321310277107629963115782498027451 / 100000000000000000000000000000000), (6341353453 / 5000000000000000000000000000000)⟩ +lemma B2_5_1U1_2_1Leaf_sound : B2_5_1U1_2_1Leaf.Encloses (AllFieldTerminalRates.secondLeafRate (shape 2 5 1) (shape 1 2 1)) := by + have hh : shapeMax (shape 1 2 1) = 2 := by decide +kernel + have hp : positive (shape 1 2 1) = true := by decide +kernel + simp only [AllFieldTerminalRates.secondLeafRate, hh, hp, Bool.not_true, Bool.false_eq_true, + show (2 : ℕ) ≠ 4 by decide, show (2 : ℕ) ≠ 3 by decide, ite_false] + have ht : (Ball.exact (1996413 / 1000000)).Encloses (2 - (binaryParameter (shape 2 5 1) (shape 1 2 1) : ℝ)) := by + have he : binaryParameter (shape 2 5 1) (shape 1 2 1) = (3587 / 1000000) := by decide +kernel + rw [he] + convert Ball.exact_sound ((1996413 / 1000000) : ℚ) using 1; norm_num [Ball.exact] + exact contains_sound (Ball.mul_sound ht logN5_sound) (by decide +kernel) +def B2_5_1U1_2_1Mass : Ball := ⟨(30948584829331435076273891283 / 50000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +lemma B2_5_1U1_2_1Mass_sound : B2_5_1U1_2_1Mass.Encloses (littleMass (shape 2 5 1) (shape 1 2 1) : ℝ) := by + rw [littleMass_cast] + exact contains_sound (Ball.mul_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) (second_2_5_1)) + (B2_5_1Law_sound (shape 1 2 1))) (by decide +kernel) +def B2_5_1U1_3_0Leaf : Ball := ⟨(115129254649702284200899544090987 / 50000000000000000000000000000000), (21175823683 / 25000000000000000000000000000000)⟩ +lemma B2_5_1U1_3_0Leaf_sound : B2_5_1U1_3_0Leaf.Encloses (AllFieldTerminalRates.secondLeafRate (shape 2 5 1) (shape 1 3 0)) := by + have hh : shapeMax (shape 1 3 0) = 3 := by decide +kernel + simp only [AllFieldTerminalRates.secondLeafRate, hh, show (3 : ℕ) ≠ 4 by decide, ite_false, ite_true] + exact logN10_sound +def B2_5_1U1_3_0Mass : Ball := ⟨(30948584829331435076273891283 / 50000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +lemma B2_5_1U1_3_0Mass_sound : B2_5_1U1_3_0Mass.Encloses (littleMass (shape 2 5 1) (shape 1 3 0) : ℝ) := by + rw [littleMass_cast] + exact contains_sound (Ball.mul_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) (second_2_5_1)) + (B2_5_1Law_sound (shape 1 3 0))) (by decide +kernel) +def B2_5_1U2_1_1D : Ball := .exact (21083 / 500000) +lemma B2_5_1U2_1_1D_sound : B2_5_1U2_1_1D.Encloses (binaryParameter (shape 2 5 1) (shape 2 1 1) : ℝ) := by + apply exact_rat_enclosed + decide +kernel +def B2_5_1U2_1_1OneD : Ball := .exact (478917 / 500000) +lemma B2_5_1U2_1_1OneD_sound : B2_5_1U2_1_1OneD.Encloses (1 - (binaryParameter (shape 2 5 1) (shape 2 1 1) : ℝ)) := by + have he : binaryParameter (shape 2 5 1) (shape 2 1 1) = (21083 / 500000) := by decide +kernel + rw [he] + convert Ball.exact_sound ((478917 / 500000) : ℚ) using 1 <;> norm_num [B2_5_1U2_1_1OneD, Ball.exact] +def B2_5_1U2_1_1EDLogWitness : LogWitness := ⟨-5, 21083, 15625⟩ +def B2_5_1U2_1_1EDLog : Ball := ⟨(-63322821397686708031899813013369 / 20000000000000000000000000000000), (63527471049 / 50000000000000000000000000000000)⟩ +lemma B2_5_1U2_1_1EDLog_sound : B2_5_1U2_1_1EDLog.Encloses (Real.log ((binaryParameter (shape 2 5 1) (shape 2 1 1) : ℝ))) := by + exact checkLog_sound logTwoBall_sound (B2_5_1U2_1_1D_sound) (w := B2_5_1U2_1_1EDLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def B2_5_1U2_1_1ED : Ball := ⟨(13350350435274288654365437577609 / 100000000000000000000000000000000), (5357398689 / 100000000000000000000000000000000)⟩ +lemma B2_5_1U2_1_1ED_sound : B2_5_1U2_1_1ED.Encloses (Foundation.entropyTerm ((binaryParameter (shape 2 5 1) (shape 2 1 1) : ℝ))) := by + exact contains_sound (entropyTerm_ball (B2_5_1U2_1_1D_sound) B2_5_1U2_1_1EDLog_sound) (by decide +kernel) +def B2_5_1U2_1_1EOneDLogWitness : LogWitness := ⟨-1, 478917, 250000⟩ +def B2_5_1U2_1_1EOneDLog : Ball := ⟨(-67313740136531887218517535329 / 1562500000000000000000000000000), (21175823683 / 50000000000000000000000000000000)⟩ +lemma B2_5_1U2_1_1EOneDLog_sound : B2_5_1U2_1_1EOneDLog.Encloses (Real.log ((1 - (binaryParameter (shape 2 5 1) (shape 2 1 1) : ℝ)))) := by + exact checkLog_sound logTwoBall_sound (B2_5_1U2_1_1OneD_sound) (w := B2_5_1U2_1_1EOneDLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def B2_5_1U2_1_1EOneD : Ball := ⟨(1031606223518958138592984398949 / 25000000000000000000000000000000), (10141461951 / 25000000000000000000000000000000)⟩ +lemma B2_5_1U2_1_1EOneD_sound : B2_5_1U2_1_1EOneD.Encloses (Foundation.entropyTerm ((1 - (binaryParameter (shape 2 5 1) (shape 2 1 1) : ℝ)))) := by + exact contains_sound (entropyTerm_ball (B2_5_1U2_1_1OneD_sound) B2_5_1U2_1_1EOneDLog_sound) (by decide +kernel) +def B2_5_1U2_1_1BinaryEntropy : Ball := ⟨(4079899946179837320085215066313 / 20000000000000000000000000000000), (47709046057 / 100000000000000000000000000000000)⟩ +lemma B2_5_1U2_1_1BinaryEntropy_sound : B2_5_1U2_1_1BinaryEntropy.Encloses + (binaryEntropyRate (binaryParameter (shape 2 5 1) (shape 2 1 1))) := by + exact contains_sound (Ball.add_sound (Ball.add_sound B2_5_1U2_1_1EOneD_sound B2_5_1U2_1_1ED_sound) + (Ball.mul_sound B2_5_1U2_1_1D_sound logN2_sound)) (by decide +kernel) +def B2_5_1U2_1_1Leaf : Ball := ⟨(315101226585250447280610230069167 / 100000000000000000000000000000000), (62188121377 / 50000000000000000000000000000000)⟩ +lemma B2_5_1U2_1_1Leaf_sound : B2_5_1U2_1_1Leaf.Encloses (AllFieldTerminalRates.secondLeafRate (shape 2 5 1) (shape 2 1 1)) := by + have hh : shapeMax (shape 2 1 1) = 2 := by decide +kernel + have hp : positive (shape 2 1 1) = true := by decide +kernel + simp only [AllFieldTerminalRates.secondLeafRate, hh, hp, Bool.not_true, Bool.false_eq_true, + show (2 : ℕ) ≠ 4 by decide, show (2 : ℕ) ≠ 3 by decide, ite_false] + have ht : (Ball.exact (978917 / 500000)).Encloses (2 - (binaryParameter (shape 2 5 1) (shape 2 1 1) : ℝ)) := by + have he : binaryParameter (shape 2 5 1) (shape 2 1 1) = (21083 / 500000) := by decide +kernel + rw [he] + convert Ball.exact_sound ((978917 / 500000) : ℚ) using 1; norm_num [Ball.exact] + exact contains_sound (Ball.mul_sound ht logN5_sound) (by decide +kernel) +def B2_5_1U2_1_1Mass : Ball := ⟨(348255140010022353957739057 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ +lemma B2_5_1U2_1_1Mass_sound : B2_5_1U2_1_1Mass.Encloses (littleMass (shape 2 5 1) (shape 2 1 1) : ℝ) := by + rw [littleMass_cast] + exact contains_sound (Ball.mul_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) (second_2_5_1)) + (B2_5_1Law_sound (shape 2 1 1))) (by decide +kernel) +def B2_5_1U2_2_0D : Ball := .exact (55043 / 500000) +lemma B2_5_1U2_2_0D_sound : B2_5_1U2_2_0D.Encloses (binaryParameter (shape 2 5 1) (shape 2 2 0) : ℝ) := by + apply exact_rat_enclosed + decide +kernel +def B2_5_1U2_2_0OneD : Ball := .exact (444957 / 500000) +lemma B2_5_1U2_2_0OneD_sound : B2_5_1U2_2_0OneD.Encloses (1 - (binaryParameter (shape 2 5 1) (shape 2 2 0) : ℝ)) := by + have he : binaryParameter (shape 2 5 1) (shape 2 2 0) = (55043 / 500000) := by decide +kernel + rw [he] + convert Ball.exact_sound ((444957 / 500000) : ℚ) using 1 <;> norm_num [B2_5_1U2_2_0OneD, Ball.exact] +def B2_5_1U2_2_0EDLogWitness : LogWitness := ⟨-4, 55043, 31250⟩ +def B2_5_1U2_2_0EDLog : Ball := ⟨(-22064934004685379356673449299827 / 10000000000000000000000000000000), (21175823683 / 20000000000000000000000000000000)⟩ +lemma B2_5_1U2_2_0EDLog_sound : B2_5_1U2_2_0EDLog.Encloses (Real.log ((binaryParameter (shape 2 5 1) (shape 2 2 0) : ℝ))) := by + exact checkLog_sound logTwoBall_sound (B2_5_1U2_2_0D_sound) (w := B2_5_1U2_2_0EDLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def B2_5_1U2_2_0ED : Ball := ⟨(1518150203024871669911720837263 / 6250000000000000000000000000000), (11655808631 / 100000000000000000000000000000000)⟩ +lemma B2_5_1U2_2_0ED_sound : B2_5_1U2_2_0ED.Encloses (Foundation.entropyTerm ((binaryParameter (shape 2 5 1) (shape 2 2 0) : ℝ))) := by + exact contains_sound (entropyTerm_ball (B2_5_1U2_2_0D_sound) B2_5_1U2_2_0EDLog_sound) (by decide +kernel) +def B2_5_1U2_2_0EOneDLogWitness : LogWitness := ⟨-1, 444957, 250000⟩ +def B2_5_1U2_2_0EOneDLog : Ball := ⟨(-583152250691689478453229215219 / 5000000000000000000000000000000), (21175823683 / 50000000000000000000000000000000)⟩ +lemma B2_5_1U2_2_0EOneDLog_sound : B2_5_1U2_2_0EOneDLog.Encloses (Real.log ((1 - (binaryParameter (shape 2 5 1) (shape 2 2 0) : ℝ)))) := by + exact checkLog_sound logTwoBall_sound (B2_5_1U2_2_0OneD_sound) (w := B2_5_1U2_2_0EOneDLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def B2_5_1U2_2_0EOneD : Ball := ⟨(1297388380055110376320567559581 / 12500000000000000000000000000000), (7537864783 / 20000000000000000000000000000000)⟩ +lemma B2_5_1U2_2_0EOneD_sound : B2_5_1U2_2_0EOneD.Encloses (Foundation.entropyTerm ((1 - (binaryParameter (shape 2 5 1) (shape 2 2 0) : ℝ)))) := by + exact contains_sound (entropyTerm_ball (B2_5_1U2_2_0OneD_sound) B2_5_1U2_2_0EOneDLog_sound) (by decide +kernel) +def B2_5_1U2_2_0BinaryEntropy : Ball := ⟨(8460018068150208732480522660599 / 20000000000000000000000000000000), (54007455999 / 100000000000000000000000000000000)⟩ +lemma B2_5_1U2_2_0BinaryEntropy_sound : B2_5_1U2_2_0BinaryEntropy.Encloses + (binaryEntropyRate (binaryParameter (shape 2 5 1) (shape 2 2 0))) := by + exact contains_sound (Ball.add_sound (Ball.add_sound B2_5_1U2_2_0EOneD_sound B2_5_1U2_2_0ED_sound) + (Ball.mul_sound B2_5_1U2_2_0D_sound logN2_sound)) (by decide +kernel) +def B2_5_1U2_2_0Leaf : Ball := ⟨(328752356421927043814894573583359 / 100000000000000000000000000000000), (83537713871 / 50000000000000000000000000000000)⟩ +lemma B2_5_1U2_2_0Leaf_sound : B2_5_1U2_2_0Leaf.Encloses (AllFieldTerminalRates.secondLeafRate (shape 2 5 1) (shape 2 2 0)) := by + have hh : shapeMax (shape 2 2 0) = 2 := by decide +kernel + have hp : positive (shape 2 2 0) = false := by decide +kernel + simp only [AllFieldTerminalRates.secondLeafRate, hh, hp, Bool.not_false, + show (2 : ℕ) ≠ 4 by decide, show (2 : ℕ) ≠ 3 by decide, ite_false, ite_true] + exact contains_sound (Ball.add_sound B2_5_1U2_2_0BinaryEntropy_sound + (Ball.mul_sound (Ball.mul_sound (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) + B2_5_1U2_2_0OneD_sound) logN5_sound)) (by decide +kernel) +def B2_5_1U2_2_0Mass : Ball := ⟨(8730128534988305962655873559 / 25000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ +lemma B2_5_1U2_2_0Mass_sound : B2_5_1U2_2_0Mass.Encloses (littleMass (shape 2 5 1) (shape 2 2 0) : ℝ) := by + rw [littleMass_cast] + exact contains_sound (Ball.mul_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) (second_2_5_1)) + (B2_5_1Law_sound (shape 2 2 0))) (by decide +kernel) +def B2_5_1Leaves (s : Shape) : Ball := + match s 0, s 1, s 2 with + | 0, 3, 1 => B2_5_1U0_3_1Leaf + | 0, 4, 0 => B2_5_1U0_4_0Leaf + | 1, 2, 1 => B2_5_1U1_2_1Leaf + | 1, 3, 0 => B2_5_1U1_3_0Leaf + | 2, 1, 1 => B2_5_1U2_1_1Leaf + | 2, 2, 0 => B2_5_1U2_2_0Leaf + | _, _, _ => (.exact 0) +lemma B2_5_1Leaves_sound (u : Shape) (hu : u ∈ below (shape 2 5 1)) : + (B2_5_1Leaves u).Encloses (AllFieldTerminalRates.secondLeafRate (shape 2 5 1) u) := by + rw [B2_5_1_below] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl | rfl | rfl + · exact B2_5_1U0_3_1Leaf_sound + · exact B2_5_1U0_4_0Leaf_sound + · exact B2_5_1U1_2_1Leaf_sound + · exact B2_5_1U1_3_0Leaf_sound + · exact B2_5_1U2_1_1Leaf_sound + · exact B2_5_1U2_2_0Leaf_sound +def B2_5_1Masses (s : Shape) : Ball := + match s 0, s 1, s 2 with + | 0, 3, 1 => B2_5_1U0_3_1Mass + | 0, 4, 0 => B2_5_1U0_4_0Mass + | 1, 2, 1 => B2_5_1U1_2_1Mass + | 1, 3, 0 => B2_5_1U1_3_0Mass + | 2, 1, 1 => B2_5_1U2_1_1Mass + | 2, 2, 0 => B2_5_1U2_2_0Mass + | _, _, _ => (.exact 0) +lemma B2_5_1Masses_sound (u : Shape) (hu : u ∈ below (shape 2 5 1)) : + (B2_5_1Masses u).Encloses ((fun u => (littleMass (shape 2 5 1) u : ℝ)) u) := by + rw [B2_5_1_below] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl | rfl | rfl + · exact B2_5_1U0_3_1Mass_sound + · exact B2_5_1U0_4_0Mass_sound + · exact B2_5_1U1_2_1Mass_sound + · exact B2_5_1U1_3_0Mass_sound + · exact B2_5_1U2_1_1Mass_sound + · exact B2_5_1U2_2_0Mass_sound +def B2_5_1Binaries (s : Shape) : Ball := + match s 0, s 1, s 2 with + | 1, 2, 1 => B2_5_1U1_2_1BinaryEntropy + | 2, 1, 1 => B2_5_1U2_1_1BinaryEntropy + | 2, 2, 0 => B2_5_1U2_2_0BinaryEntropy + | _, _, _ => (.exact 0) +lemma B2_5_1Binaries_sound (u : Shape) (hu : u ∈ (below (shape 2 5 1)).filter positive) : + (B2_5_1Binaries u).Encloses ((fun u => binaryEntropyRate (binaryParameter (shape 2 5 1) u)) u) := by + have hl : (below (shape 2 5 1)).filter positive = [(shape 1 2 1), (shape 2 1 1)] := by decide +kernel + rw [hl] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl + · exact B2_5_1U1_2_1BinaryEntropy_sound + · exact B2_5_1U2_1_1BinaryEntropy_sound +def B2_5_1S2 : Ball := ⟨(16906386274561049158059689213 / 3125000000000000000000000000000), (220586351 / 100000000000000000000000000000000)⟩ +lemma B2_5_1S2_sound : B2_5_1S2.Encloses + (((below (shape 2 5 1)).map fun u => (littleMass (shape 2 5 1) u : ℝ) * AllFieldTerminalRates.secondLeafRate (shape 2 5 1) u).sum) := by + exact contains_sound (listSumBall_sound (below (shape 2 5 1)) + (fun u => .mul (B2_5_1Masses u) (B2_5_1Leaves u)) _ + (fun u hu => Ball.mul_sound (B2_5_1Masses_sound u hu) (B2_5_1Leaves_sound u hu))) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/Certificates/Terminal3_1_4.lean b/lean/OAI/LinearAlgebra/MatrixFields/Certificates/Terminal3_1_4.lean new file mode 100644 index 0000000000000000000000000000000000000000..681f74ea9d6aa95e6982aafd601d437867487d4f --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/Certificates/Terminal3_1_4.lean @@ -0,0 +1,593 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Certificates.LittleB1_3_4 +import OAI.LinearAlgebra.MatrixFields.Certificates.Terminal1_1_6 + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate +open scoped BigOperators +lemma B3_1_4_below : below (shape 3 1 4) = [ + (shape 0 0 4), + (shape 0 1 3), + (shape 1 0 3), + (shape 1 1 2), + (shape 2 0 2), + (shape 2 1 1), + (shape 3 0 1), + (shape 3 1 0)] := by decide +kernel +def B3_1_4Raw (s : Shape) : Ball := + match s 0, s 1, s 2 with + | 0, 0, 4 => ⟨(59283170615264302211580917627 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 0, 1, 3 => ⟨(768953964689050330179336197851 / 25000000000000000000000000000000), (9 / 100000000000000000000000000000000)⟩ + | 1, 0, 3 => ⟨(14976318486789256799246113282771 / 100000000000000000000000000000000), (9 / 50000000000000000000000000000000)⟩ + | 1, 1, 2 => ⟨1, 0⟩ + | 2, 0, 2 => ⟨1, 0⟩ + | 2, 1, 1 => ⟨(14976318486789256799246113282771 / 100000000000000000000000000000000), (9 / 50000000000000000000000000000000)⟩ + | 3, 0, 1 => ⟨(768953964689050330179336197851 / 25000000000000000000000000000000), (9 / 100000000000000000000000000000000)⟩ + | 3, 1, 0 => ⟨(59283170615264302211580917627 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | _, _, _ => (.exact 0) +lemma B3_1_4Raw_0_0_4 : (B3_1_4Raw (shape 0 0 4)).Encloses (splitWeight positiveSecond tablep (shape 3 1 4) (shape 0 0 4) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveSecond tablep (shape 3 1 4) (shape 0 0 4) + (-15829) (0) (-58477) w110 w195 w22 + (by decide +kernel) w110_sound w195_sound w22_sound) (by decide +kernel) +lemma B3_1_4Raw_0_1_3 : (B3_1_4Raw (shape 0 1 3)).Encloses (splitWeight positiveSecond tablep (shape 3 1 4) (shape 0 1 3) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveSecond tablep (shape 3 1 4) (shape 0 1 3) + (-15829) (0) (-18987) w110 w195 w90 + (by decide +kernel) w110_sound w195_sound w90_sound) (by decide +kernel) +lemma B3_1_4Raw_1_0_3 : (B3_1_4Raw (shape 1 0 3)).Encloses (splitWeight positiveSecond tablep (shape 3 1 4) (shape 1 0 3) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveSecond tablep (shape 3 1 4) (shape 1 0 3) + (0) (0) (-18987) w195 w195 w90 + (by decide +kernel) w195_sound w195_sound w90_sound) (by decide +kernel) +lemma B3_1_4Raw_1_1_2 : (B3_1_4Raw (shape 1 1 2)).Encloses (splitWeight positiveSecond tablep (shape 3 1 4) (shape 1 1 2) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveSecond tablep (shape 3 1 4) (shape 1 1 2) + (0) (0) (0) w195 w195 w195 + (by decide +kernel) w195_sound w195_sound w195_sound) (by decide +kernel) +lemma B3_1_4Raw_2_0_2 : (B3_1_4Raw (shape 2 0 2)).Encloses (splitWeight positiveSecond tablep (shape 3 1 4) (shape 2 0 2) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveSecond tablep (shape 3 1 4) (shape 2 0 2) + (0) (0) (0) w195 w195 w195 + (by decide +kernel) w195_sound w195_sound w195_sound) (by decide +kernel) +lemma B3_1_4Raw_2_1_1 : (B3_1_4Raw (shape 2 1 1)).Encloses (splitWeight positiveSecond tablep (shape 3 1 4) (shape 2 1 1) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveSecond tablep (shape 3 1 4) (shape 2 1 1) + (0) (0) (-18987) w195 w195 w90 + (by decide +kernel) w195_sound w195_sound w90_sound) (by decide +kernel) +lemma B3_1_4Raw_3_0_1 : (B3_1_4Raw (shape 3 0 1)).Encloses (splitWeight positiveSecond tablep (shape 3 1 4) (shape 3 0 1) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveSecond tablep (shape 3 1 4) (shape 3 0 1) + (-15829) (0) (-18987) w110 w195 w90 + (by decide +kernel) w110_sound w195_sound w90_sound) (by decide +kernel) +lemma B3_1_4Raw_3_1_0 : (B3_1_4Raw (shape 3 1 0)).Encloses (splitWeight positiveSecond tablep (shape 3 1 4) (shape 3 1 0) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveSecond tablep (shape 3 1 4) (shape 3 1 0) + (-15829) (0) (-58477) w110 w195 w22 + (by decide +kernel) w110_sound w195_sound w22_sound) (by decide +kernel) +lemma B3_1_4Raw_sound (u : Shape) (hu : u ∈ below (shape 3 1 4)) : + (B3_1_4Raw u).Encloses (splitWeight positiveSecond tablep (shape 3 1 4) u : ℝ) := by + rw [B3_1_4_below] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl + · exact B3_1_4Raw_0_0_4 + · exact B3_1_4Raw_0_1_3 + · exact B3_1_4Raw_1_0_3 + · exact B3_1_4Raw_1_1_2 + · exact B3_1_4Raw_2_0_2 + · exact B3_1_4Raw_2_1_1 + · exact B3_1_4Raw_3_0_1 + · exact B3_1_4Raw_3_1_0 +def B3_1_4Den : Ball := ⟨(59055708758080361211087519495901 / 25000000000000000000000000000000), (7 / 12500000000000000000000000000000)⟩ +lemma B3_1_4Den_sound : B3_1_4Den.Encloses (((below (shape 3 1 4)).map (splitWeight positiveSecond tablep (shape 3 1 4))).sum : ℝ) := by + exact contains_sound (list_cast_enclosed (below (shape 3 1 4)) B3_1_4Raw (splitWeight positiveSecond tablep (shape 3 1 4)) B3_1_4Raw_sound) (by decide +kernel) +lemma B3_1_4Den_positive : 0 < B3_1_4Den.lower := by decide +kernel +def B3_1_4Table (s : Shape) : Ball := + match s 0, s 1, s 2 with + | 0, 0, 4 => ⟨(6274072805784506214853963141 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 0, 1, 3 => ⟨(8138014732824595179881072909 / 625000000000000000000000000000), (1 / 20000000000000000000000000000000)⟩ + | 1, 0, 3 => ⟨(3169955708291305924669541513661 / 50000000000000000000000000000000), (1 / 10000000000000000000000000000000)⟩ + | 1, 1, 2 => ⟨(21166454967471157448510264727337 / 50000000000000000000000000000000), (11 / 100000000000000000000000000000000)⟩ + | 2, 0, 2 => ⟨(21166454967471157448510264727337 / 50000000000000000000000000000000), (11 / 100000000000000000000000000000000)⟩ + | 2, 1, 1 => ⟨(3169955708291305924669541513661 / 50000000000000000000000000000000), (1 / 10000000000000000000000000000000)⟩ + | 3, 0, 1 => ⟨(8138014732824595179881072909 / 625000000000000000000000000000), (1 / 20000000000000000000000000000000)⟩ + | 3, 1, 0 => ⟨(6274072805784506214853963141 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | _, _, _ => (.exact 0) +def B3_1_4Law (u : Shape) : Ball := if u ∈ below (shape 3 1 4) then B3_1_4Table u else .exact 0 +lemma B3_1_4Law_check_0_0_4 : contains (.mul (B3_1_4Raw (shape 0 0 4)) (.inv B3_1_4Den)) (B3_1_4Table (shape 0 0 4)) = true := by decide +kernel +lemma B3_1_4Law_check_0_1_3 : contains (.mul (B3_1_4Raw (shape 0 1 3)) (.inv B3_1_4Den)) (B3_1_4Table (shape 0 1 3)) = true := by decide +kernel +lemma B3_1_4Law_check_1_0_3 : contains (.mul (B3_1_4Raw (shape 1 0 3)) (.inv B3_1_4Den)) (B3_1_4Table (shape 1 0 3)) = true := by decide +kernel +lemma B3_1_4Law_check_1_1_2 : contains (.mul (B3_1_4Raw (shape 1 1 2)) (.inv B3_1_4Den)) (B3_1_4Table (shape 1 1 2)) = true := by decide +kernel +lemma B3_1_4Law_check_2_0_2 : contains (.mul (B3_1_4Raw (shape 2 0 2)) (.inv B3_1_4Den)) (B3_1_4Table (shape 2 0 2)) = true := by decide +kernel +lemma B3_1_4Law_check_2_1_1 : contains (.mul (B3_1_4Raw (shape 2 1 1)) (.inv B3_1_4Den)) (B3_1_4Table (shape 2 1 1)) = true := by decide +kernel +lemma B3_1_4Law_check_3_0_1 : contains (.mul (B3_1_4Raw (shape 3 0 1)) (.inv B3_1_4Den)) (B3_1_4Table (shape 3 0 1)) = true := by decide +kernel +lemma B3_1_4Law_check_3_1_0 : contains (.mul (B3_1_4Raw (shape 3 1 0)) (.inv B3_1_4Den)) (B3_1_4Table (shape 3 1 0)) = true := by decide +kernel +lemma B3_1_4Law_check (u : Shape) (hu : u ∈ below (shape 3 1 4)) : + contains (.mul (B3_1_4Raw u) (.inv B3_1_4Den)) (B3_1_4Table u) = true := by + rw [B3_1_4_below] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl + · exact B3_1_4Law_check_0_0_4 + · exact B3_1_4Law_check_0_1_3 + · exact B3_1_4Law_check_1_0_3 + · exact B3_1_4Law_check_1_1_2 + · exact B3_1_4Law_check_2_0_2 + · exact B3_1_4Law_check_2_1_1 + · exact B3_1_4Law_check_3_0_1 + · exact B3_1_4Law_check_3_1_0 +lemma B3_1_4Law_sound (u : Shape) : + (B3_1_4Law u).Encloses (stageBLaw (shape 3 1 4) u : ℝ) := by + by_cases hu : u ∈ below (shape 3 1 4) + · have h := contains_sound (Ball.mul_sound (B3_1_4Raw_sound u hu) + (Ball.inv_sound B3_1_4Den_sound B3_1_4Den_positive)) (B3_1_4Law_check u hu) + simpa only [B3_1_4Law, hu, ite_true, stageBLaw, splitLaw, + Rat.cast_div, Rat.cast_mul, Rat.cast_inv, div_eq_mul_inv] using h + · simp only [B3_1_4Law, hu, ite_false, stageBLaw, splitLaw, Rat.cast_zero] + simpa only [Rat.cast_zero] using Ball.exact_sound 0 + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def B3_1_4Binary (u : Shape) : ℚ := + match u 0, u 1, u 2 with + | 1, 1, 2 => (2207 / 1000000) + | 2, 0, 2 => (5923 / 62500) + | 2, 1, 1 => (21083 / 500000) + | _, _, _ => 0 +lemma B3_1_4Binary_eq (u : Shape) (hu : u ∈ shapes 4) : + binaryParameter (shape 3 1 4) u = B3_1_4Binary u := by + rw [shapes4_list] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel +def B3_1_4LittleRat (u : Shape) (w : Fin 3) (i : Fin 6) : ℚ := + if u w = 2 then + if i = 2 then 1 - B3_1_4Binary u else if i = 3 then B3_1_4Binary u else 0 + else if i = singletonSlot (u w) then 1 else 0 + +def B3_1_4Little (u : Shape) (w : Fin 3) (i : Fin 6) : Ball := + if u ∈ shapes 4 then .exact (B3_1_4LittleRat u w i) + else .exact (littleLaw (shape 3 1 4) u w i) + +lemma B3_1_4Little_sound (u : Shape) (w : Fin 3) (i : Fin 6) : + (B3_1_4Little u w i).Encloses (littleLaw (shape 3 1 4) u w i : ℝ) := by + by_cases hu : u ∈ shapes 4 + · simp only [B3_1_4Little, hu, ite_true] + apply exact_rat_enclosed + simp only [B3_1_4LittleRat, littleLaw, B3_1_4Binary_eq u hu] + · simp only [B3_1_4Little, hu, ite_false] + exact Ball.exact_sound _ +def B3_1_4Half (w : Fin 3) (ij : PairSlot) : Ball := + match w.val, ij.1.val, ij.2.val with + | 0, 0, 4 => ⟨(331794662118768313410096879501 / 25000000000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ + | 0, 1, 2 => ⟨(8878737487603738207391907834341 / 20000000000000000000000000000000), (1 / 5000000000000000000000000000000)⟩ + | 0, 1, 3 => ⟨(4279133913506235709400073310291 / 100000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ + | 0, 2, 1 => ⟨(8878737487603738207391907834341 / 20000000000000000000000000000000), (1 / 5000000000000000000000000000000)⟩ + | 0, 3, 1 => ⟨(4279133913506235709400073310291 / 100000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ + | 0, 4, 0 => ⟨(331794662118768313410096879501 / 25000000000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ + | 1, 0, 1 => ⟨(1 / 2), (27 / 100000000000000000000000000000000)⟩ + | 1, 1, 0 => ⟨(1 / 2), (27 / 100000000000000000000000000000000)⟩ + | 2, 5, 0 => ⟨(6274072805784506214853963141 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 2, 4, 1 => ⟨(3820996886917273539060027346381 / 50000000000000000000000000000000), (3 / 20000000000000000000000000000000)⟩ + | 2, 2, 2 => ⟨(76473060096193834122862009176151 / 100000000000000000000000000000000), (1 / 5000000000000000000000000000000)⟩ + | 2, 2, 3 => ⟨(408752583274976468404048388933 / 10000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ + | 2, 3, 2 => ⟨(408752583274976468404048388933 / 10000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ + | 2, 3, 3 => ⟨(17708108191266303098081954537 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 2, 1, 4 => ⟨(3820996886917273539060027346381 / 50000000000000000000000000000000), (3 / 20000000000000000000000000000000)⟩ + | 2, 0, 5 => ⟨(6274072805784506214853963141 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | _, _, _ => (.exact 0) +lemma B3_1_4Half_check_0_0 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 3 1 4)) (shape 3 1 4) B3_1_4Law + (fun u => B3_1_4Little u 0) ((0 : Fin 6),j)) (B3_1_4Half 0 (0,j)) = true := by + decide +kernel +lemma B3_1_4Half_check_0_1 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 3 1 4)) (shape 3 1 4) B3_1_4Law + (fun u => B3_1_4Little u 0) ((1 : Fin 6),j)) (B3_1_4Half 0 (1,j)) = true := by + decide +kernel +lemma B3_1_4Half_check_0_2 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 3 1 4)) (shape 3 1 4) B3_1_4Law + (fun u => B3_1_4Little u 0) ((2 : Fin 6),j)) (B3_1_4Half 0 (2,j)) = true := by + decide +kernel +lemma B3_1_4Half_check_0_3 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 3 1 4)) (shape 3 1 4) B3_1_4Law + (fun u => B3_1_4Little u 0) ((3 : Fin 6),j)) (B3_1_4Half 0 (3,j)) = true := by + decide +kernel +lemma B3_1_4Half_check_0_4 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 3 1 4)) (shape 3 1 4) B3_1_4Law + (fun u => B3_1_4Little u 0) ((4 : Fin 6),j)) (B3_1_4Half 0 (4,j)) = true := by + decide +kernel +lemma B3_1_4Half_check_0_5 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 3 1 4)) (shape 3 1 4) B3_1_4Law + (fun u => B3_1_4Little u 0) ((5 : Fin 6),j)) (B3_1_4Half 0 (5,j)) = true := by + decide +kernel +lemma B3_1_4Half_check_1_0 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 3 1 4)) (shape 3 1 4) B3_1_4Law + (fun u => B3_1_4Little u 1) ((0 : Fin 6),j)) (B3_1_4Half 1 (0,j)) = true := by + decide +kernel +lemma B3_1_4Half_check_1_1 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 3 1 4)) (shape 3 1 4) B3_1_4Law + (fun u => B3_1_4Little u 1) ((1 : Fin 6),j)) (B3_1_4Half 1 (1,j)) = true := by + decide +kernel +lemma B3_1_4Half_check_1_2 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 3 1 4)) (shape 3 1 4) B3_1_4Law + (fun u => B3_1_4Little u 1) ((2 : Fin 6),j)) (B3_1_4Half 1 (2,j)) = true := by + decide +kernel +lemma B3_1_4Half_check_1_3 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 3 1 4)) (shape 3 1 4) B3_1_4Law + (fun u => B3_1_4Little u 1) ((3 : Fin 6),j)) (B3_1_4Half 1 (3,j)) = true := by + decide +kernel +lemma B3_1_4Half_check_1_4 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 3 1 4)) (shape 3 1 4) B3_1_4Law + (fun u => B3_1_4Little u 1) ((4 : Fin 6),j)) (B3_1_4Half 1 (4,j)) = true := by + decide +kernel +lemma B3_1_4Half_check_1_5 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 3 1 4)) (shape 3 1 4) B3_1_4Law + (fun u => B3_1_4Little u 1) ((5 : Fin 6),j)) (B3_1_4Half 1 (5,j)) = true := by + decide +kernel +lemma B3_1_4Half_check_2_0 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 3 1 4)) (shape 3 1 4) B3_1_4Law + (fun u => B3_1_4Little u 2) ((0 : Fin 6),j)) (B3_1_4Half 2 (0,j)) = true := by + decide +kernel +lemma B3_1_4Half_check_2_1 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 3 1 4)) (shape 3 1 4) B3_1_4Law + (fun u => B3_1_4Little u 2) ((1 : Fin 6),j)) (B3_1_4Half 2 (1,j)) = true := by + decide +kernel +lemma B3_1_4Half_check_2_2 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 3 1 4)) (shape 3 1 4) B3_1_4Law + (fun u => B3_1_4Little u 2) ((2 : Fin 6),j)) (B3_1_4Half 2 (2,j)) = true := by + decide +kernel +lemma B3_1_4Half_check_2_3 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 3 1 4)) (shape 3 1 4) B3_1_4Law + (fun u => B3_1_4Little u 2) ((3 : Fin 6),j)) (B3_1_4Half 2 (3,j)) = true := by + decide +kernel +lemma B3_1_4Half_check_2_4 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 3 1 4)) (shape 3 1 4) B3_1_4Law + (fun u => B3_1_4Little u 2) ((4 : Fin 6),j)) (B3_1_4Half 2 (4,j)) = true := by + decide +kernel +lemma B3_1_4Half_check_2_5 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 3 1 4)) (shape 3 1 4) B3_1_4Law + (fun u => B3_1_4Little u 2) ((5 : Fin 6),j)) (B3_1_4Half 2 (5,j)) = true := by + decide +kernel +lemma B3_1_4Half_sound (w : Fin 3) (ij : PairSlot) : + (B3_1_4Half w ij).Encloses (halfLaw (shape 3 1 4) w ij : ℝ) := by + have hcheck : contains (pairLawBall (below (shape 3 1 4)) (shape 3 1 4) B3_1_4Law + (fun u => B3_1_4Little u w) ij) (B3_1_4Half w ij) = true := by + rcases ij with ⟨i,j⟩ + revert i w + apply forall_fin3 + · exact forall_fin6 (B3_1_4Half_check_0_0 j) (B3_1_4Half_check_0_1 j) (B3_1_4Half_check_0_2 j) (B3_1_4Half_check_0_3 j) (B3_1_4Half_check_0_4 j) (B3_1_4Half_check_0_5 j) + · exact forall_fin6 (B3_1_4Half_check_1_0 j) (B3_1_4Half_check_1_1 j) (B3_1_4Half_check_1_2 j) (B3_1_4Half_check_1_3 j) (B3_1_4Half_check_1_4 j) (B3_1_4Half_check_1_5 j) + · exact forall_fin6 (B3_1_4Half_check_2_0 j) (B3_1_4Half_check_2_1 j) (B3_1_4Half_check_2_2 j) (B3_1_4Half_check_2_3 j) (B3_1_4Half_check_2_4 j) (B3_1_4Half_check_2_5 j) + have h := contains_sound (pairLawBall_sound (below (shape 3 1 4)) (shape 3 1 4) + B3_1_4Law (fun u => (stageBLaw (shape 3 1 4) u : ℝ)) + (fun u => B3_1_4Little u w) (fun u i => (littleLaw (shape 3 1 4) u w i : ℝ)) + (fun u _ => B3_1_4Law_sound u) (fun u i => B3_1_4Little_sound u w i) ij) hcheck + have hp : positive (shape 3 1 4) = true := by decide +kernel + simpa only [halfLaw, hp, ite_true, pairLaw, positiveHalfLaw, Rat.cast_list_sum, + List.map_map, Function.comp_def, Rat.cast_mul] using h + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def B3_1_4U0_0_4Leaf : Ball := ⟨0, 0⟩ +lemma B3_1_4U0_0_4Leaf_sound : B3_1_4U0_0_4Leaf.Encloses (AllFieldTerminalRates.secondLeafRate (shape 3 1 4) (shape 0 0 4)) := by + have hh : shapeMax (shape 0 0 4) = 4 := by decide +kernel + simp only [AllFieldTerminalRates.secondLeafRate, hh, ite_true] + simpa only [B3_1_4U0_0_4Leaf, Ball.exact, Rat.cast_zero] using Ball.exact_sound 0 +def B3_1_4U0_0_4Mass : Ball := ⟨(3743589784293194240021197981 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ +lemma B3_1_4U0_0_4Mass_sound : B3_1_4U0_0_4Mass.Encloses (littleMass (shape 3 1 4) (shape 0 0 4) : ℝ) := by + rw [littleMass_cast] + exact contains_sound (Ball.mul_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) (second_3_1_4)) + (B3_1_4Law_sound (shape 0 0 4))) (by decide +kernel) +def B3_1_4U0_1_3Leaf : Ball := ⟨(115129254649702284200899544090987 / 50000000000000000000000000000000), (21175823683 / 25000000000000000000000000000000)⟩ +lemma B3_1_4U0_1_3Leaf_sound : B3_1_4U0_1_3Leaf.Encloses (AllFieldTerminalRates.secondLeafRate (shape 3 1 4) (shape 0 1 3)) := by + have hh : shapeMax (shape 0 1 3) = 3 := by decide +kernel + simp only [AllFieldTerminalRates.secondLeafRate, hh, show (3 : ℕ) ≠ 4 by decide, ite_false, ite_true] + exact logN10_sound +def B3_1_4U0_1_3Mass : Ball := ⟨(194230381197626472204352679303 / 100000000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ +lemma B3_1_4U0_1_3Mass_sound : B3_1_4U0_1_3Mass.Encloses (littleMass (shape 3 1 4) (shape 0 1 3) : ℝ) := by + rw [littleMass_cast] + exact contains_sound (Ball.mul_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) (second_3_1_4)) + (B3_1_4Law_sound (shape 0 1 3))) (by decide +kernel) +def B3_1_4U1_0_3Leaf : Ball := ⟨(115129254649702284200899544090987 / 50000000000000000000000000000000), (21175823683 / 25000000000000000000000000000000)⟩ +lemma B3_1_4U1_0_3Leaf_sound : B3_1_4U1_0_3Leaf.Encloses (AllFieldTerminalRates.secondLeafRate (shape 3 1 4) (shape 1 0 3)) := by + have hh : shapeMax (shape 1 0 3) = 3 := by decide +kernel + simp only [AllFieldTerminalRates.secondLeafRate, hh, show (3 : ℕ) ≠ 4 by decide, ite_false, ite_true] + exact logN10_sound +def B3_1_4U1_0_3Mass : Ball := ⟨(23642963218565539071319859767 / 2500000000000000000000000000000), (13 / 100000000000000000000000000000000)⟩ +lemma B3_1_4U1_0_3Mass_sound : B3_1_4U1_0_3Mass.Encloses (littleMass (shape 3 1 4) (shape 1 0 3) : ℝ) := by + rw [littleMass_cast] + exact contains_sound (Ball.mul_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) (second_3_1_4)) + (B3_1_4Law_sound (shape 1 0 3))) (by decide +kernel) +def B3_1_4U1_1_2D : Ball := .exact (2207 / 1000000) +lemma B3_1_4U1_1_2D_sound : B3_1_4U1_1_2D.Encloses (binaryParameter (shape 3 1 4) (shape 1 1 2) : ℝ) := by + apply exact_rat_enclosed + decide +kernel +def B3_1_4U1_1_2OneD : Ball := .exact (997793 / 1000000) +lemma B3_1_4U1_1_2OneD_sound : B3_1_4U1_1_2OneD.Encloses (1 - (binaryParameter (shape 3 1 4) (shape 1 1 2) : ℝ)) := by + have he : binaryParameter (shape 3 1 4) (shape 1 1 2) = (2207 / 1000000) := by decide +kernel + rw [he] + convert Ball.exact_sound ((997793 / 1000000) : ℚ) using 1 <;> norm_num [B3_1_4U1_1_2OneD, Ball.exact] +def B3_1_4U1_1_2EDLogWitness : LogWitness := ⟨-9, 17656, 15625⟩ +def B3_1_4U1_1_2EDLog : Ball := ⟨(-305806057585376885208270506013229 / 50000000000000000000000000000000), (211758236829 / 100000000000000000000000000000000)⟩ +lemma B3_1_4U1_1_2EDLog_sound : B3_1_4U1_1_2EDLog.Encloses (Real.log ((binaryParameter (shape 3 1 4) (shape 1 1 2) : ℝ))) := by + exact checkLog_sound logTwoBall_sound (B3_1_4U1_1_2D_sound) (w := B3_1_4U1_1_2EDLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def B3_1_4U1_1_2ED : Ball := ⟨(674913969090926785654653006771 / 50000000000000000000000000000000), (46735043 / 10000000000000000000000000000000)⟩ +lemma B3_1_4U1_1_2ED_sound : B3_1_4U1_1_2ED.Encloses (Foundation.entropyTerm ((binaryParameter (shape 3 1 4) (shape 1 1 2) : ℝ))) := by + exact contains_sound (entropyTerm_ball (B3_1_4U1_1_2D_sound) B3_1_4U1_1_2EDLog_sound) (by decide +kernel) +def B3_1_4U1_1_2EOneDLogWitness : LogWitness := ⟨-1, 997793, 500000⟩ +def B3_1_4U1_1_2EOneDLog : Ball := ⟨(-55235975344075793717215518041 / 25000000000000000000000000000000), (21175823683 / 50000000000000000000000000000000)⟩ +lemma B3_1_4U1_1_2EOneDLog_sound : B3_1_4U1_1_2EOneDLog.Encloses (Real.log ((1 - (binaryParameter (shape 3 1 4) (shape 1 1 2) : ℝ)))) := by + exact checkLog_sound logTwoBall_sound (B3_1_4U1_1_2OneD_sound) (w := B3_1_4U1_1_2EOneDLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def B3_1_4U1_1_2EOneD : Ball := ⟨(220456278185965673761926493571 / 100000000000000000000000000000000), (42258177281 / 100000000000000000000000000000000)⟩ +lemma B3_1_4U1_1_2EOneD_sound : B3_1_4U1_1_2EOneD.Encloses (Foundation.entropyTerm ((1 - (binaryParameter (shape 3 1 4) (shape 1 1 2) : ℝ)))) := by + exact contains_sound (entropyTerm_ball (B3_1_4U1_1_2OneD_sound) B3_1_4U1_1_2EOneDLog_sound) (by decide +kernel) +def B3_1_4U1_1_2BinaryEntropy : Ball := ⟨(68930471964695966994384623767 / 4000000000000000000000000000000), (42818997797 / 100000000000000000000000000000000)⟩ +lemma B3_1_4U1_1_2BinaryEntropy_sound : B3_1_4U1_1_2BinaryEntropy.Encloses + (binaryEntropyRate (binaryParameter (shape 3 1 4) (shape 1 1 2))) := by + exact contains_sound (Ball.add_sound (Ball.add_sound B3_1_4U1_1_2EOneD_sound B3_1_4U1_1_2ED_sound) + (Ball.mul_sound B3_1_4U1_1_2D_sound logN2_sound)) (by decide +kernel) +def B3_1_4U1_1_2Leaf : Ball := ⟨(80383094884886467241869350690683 / 25000000000000000000000000000000), (12691473697 / 10000000000000000000000000000000)⟩ +lemma B3_1_4U1_1_2Leaf_sound : B3_1_4U1_1_2Leaf.Encloses (AllFieldTerminalRates.secondLeafRate (shape 3 1 4) (shape 1 1 2)) := by + have hh : shapeMax (shape 1 1 2) = 2 := by decide +kernel + have hp : positive (shape 1 1 2) = true := by decide +kernel + simp only [AllFieldTerminalRates.secondLeafRate, hh, hp, Bool.not_true, Bool.false_eq_true, + show (2 : ℕ) ≠ 4 by decide, show (2 : ℕ) ≠ 3 by decide, ite_false] + have ht : (Ball.exact (1997793 / 1000000)).Encloses (2 - (binaryParameter (shape 3 1 4) (shape 1 1 2) : ℝ)) := by + have he : binaryParameter (shape 3 1 4) (shape 1 1 2) = (2207 / 1000000) := by decide +kernel + rw [he] + convert Ball.exact_sound ((1997793 / 1000000) : ℚ) using 1 + norm_num [Ball.exact] + exact contains_sound (Ball.mul_sound ht logN5_sound) (by decide +kernel) +def B3_1_4U1_1_2Mass : Ball := ⟨(98668120771057680000923112311 / 1562500000000000000000000000000), (3 / 4000000000000000000000000000000)⟩ +lemma B3_1_4U1_1_2Mass_sound : B3_1_4U1_1_2Mass.Encloses (littleMass (shape 3 1 4) (shape 1 1 2) : ℝ) := by + rw [littleMass_cast] + exact contains_sound (Ball.mul_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) (second_3_1_4)) + (B3_1_4Law_sound (shape 1 1 2))) (by decide +kernel) +def B3_1_4U2_0_2D : Ball := .exact (5923 / 62500) +lemma B3_1_4U2_0_2D_sound : B3_1_4U2_0_2D.Encloses (binaryParameter (shape 3 1 4) (shape 2 0 2) : ℝ) := by + apply exact_rat_enclosed + decide +kernel +def B3_1_4U2_0_2OneD : Ball := .exact (56577 / 62500) +lemma B3_1_4U2_0_2OneD_sound : B3_1_4U2_0_2OneD.Encloses (1 - (binaryParameter (shape 3 1 4) (shape 2 0 2) : ℝ)) := by + have he : binaryParameter (shape 3 1 4) (shape 2 0 2) = (5923 / 62500) := by decide +kernel + rw [he] + convert Ball.exact_sound ((56577 / 62500) : ℚ) using 1 <;> norm_num [B3_1_4U2_0_2OneD, Ball.exact] +def B3_1_4U2_0_2EDLogWitness : LogWitness := ⟨-4, 23692, 15625⟩ +def B3_1_4U2_0_2EDLog : Ball := ⟨(-235632347944752769756850307028051 / 100000000000000000000000000000000), (21175823683 / 20000000000000000000000000000000)⟩ +lemma B3_1_4U2_0_2EDLog_sound : B3_1_4U2_0_2EDLog.Encloses (Real.log ((binaryParameter (shape 3 1 4) (shape 2 0 2) : ℝ))) := by + exact checkLog_sound logTwoBall_sound (B3_1_4U2_0_2D_sound) (w := B3_1_4U2_0_2EDLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def B3_1_4U2_0_2ED : Ball := ⟨(11165203175014165242158594948217 / 50000000000000000000000000000000), (2006790459 / 20000000000000000000000000000000)⟩ +lemma B3_1_4U2_0_2ED_sound : B3_1_4U2_0_2ED.Encloses (Foundation.entropyTerm ((binaryParameter (shape 3 1 4) (shape 2 0 2) : ℝ))) := by + exact contains_sound (entropyTerm_ball (B3_1_4U2_0_2D_sound) B3_1_4U2_0_2EDLog_sound) (by decide +kernel) +def B3_1_4U2_0_2EOneDLogWitness : LogWitness := ⟨-1, 56577, 31250⟩ +def B3_1_4U2_0_2EOneDLog : Ball := ⟨(-9956401454401802915036069658881 / 100000000000000000000000000000000), (21175823683 / 50000000000000000000000000000000)⟩ +lemma B3_1_4U2_0_2EOneDLog_sound : B3_1_4U2_0_2EOneDLog.Encloses (Real.log ((1 - (binaryParameter (shape 3 1 4) (shape 2 0 2) : ℝ)))) := by + exact checkLog_sound logTwoBall_sound (B3_1_4U2_0_2OneD_sound) (w := B3_1_4U2_0_2EOneDLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def B3_1_4U2_0_2EOneD : Ball := ⟨(1126606650171381607047991426181 / 12500000000000000000000000000000), (38338066449 / 100000000000000000000000000000000)⟩ +lemma B3_1_4U2_0_2EOneD_sound : B3_1_4U2_0_2EOneD.Encloses (Foundation.entropyTerm ((1 - (binaryParameter (shape 3 1 4) (shape 2 0 2) : ℝ)))) := by + exact contains_sound (entropyTerm_ball (B3_1_4U2_0_2OneD_sound) B3_1_4U2_0_2EOneDLog_sound) (by decide +kernel) +def B3_1_4U2_0_2BinaryEntropy : Ball := ⟨(9478019188032468262246586216219 / 25000000000000000000000000000000), (26192799831 / 50000000000000000000000000000000)⟩ +lemma B3_1_4U2_0_2BinaryEntropy_sound : B3_1_4U2_0_2BinaryEntropy.Encloses + (binaryEntropyRate (binaryParameter (shape 3 1 4) (shape 2 0 2))) := by + exact contains_sound (Ball.add_sound (Ball.add_sound B3_1_4U2_0_2EOneD_sound B3_1_4U2_0_2ED_sound) + (Ball.mul_sound B3_1_4U2_0_2D_sound logN2_sound)) (by decide +kernel) +def B3_1_4U2_0_2Leaf : Ball := ⟨(329295016821838983109105190268493 / 100000000000000000000000000000000), (5231243719 / 3125000000000000000000000000000)⟩ +lemma B3_1_4U2_0_2Leaf_sound : B3_1_4U2_0_2Leaf.Encloses (AllFieldTerminalRates.secondLeafRate (shape 3 1 4) (shape 2 0 2)) := by + have hh : shapeMax (shape 2 0 2) = 2 := by decide +kernel + have hp : positive (shape 2 0 2) = false := by decide +kernel + simp only [AllFieldTerminalRates.secondLeafRate, hh, hp, Bool.not_false, + show (2 : ℕ) ≠ 4 by decide, show (2 : ℕ) ≠ 3 by decide, ite_false, ite_true] + exact contains_sound (Ball.add_sound B3_1_4U2_0_2BinaryEntropy_sound + (Ball.mul_sound (Ball.mul_sound (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) + B3_1_4U2_0_2OneD_sound) logN5_sound)) (by decide +kernel) +def B3_1_4U2_0_2Mass : Ball := ⟨(98668120771057680000923112311 / 1562500000000000000000000000000), (3 / 4000000000000000000000000000000)⟩ +lemma B3_1_4U2_0_2Mass_sound : B3_1_4U2_0_2Mass.Encloses (littleMass (shape 3 1 4) (shape 2 0 2) : ℝ) := by + rw [littleMass_cast] + exact contains_sound (Ball.mul_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) (second_3_1_4)) + (B3_1_4Law_sound (shape 2 0 2))) (by decide +kernel) +def B3_1_4U2_1_1D : Ball := .exact (21083 / 500000) +lemma B3_1_4U2_1_1D_sound : B3_1_4U2_1_1D.Encloses (binaryParameter (shape 3 1 4) (shape 2 1 1) : ℝ) := by + apply exact_rat_enclosed + decide +kernel +def B3_1_4U2_1_1OneD : Ball := .exact (478917 / 500000) +lemma B3_1_4U2_1_1OneD_sound : B3_1_4U2_1_1OneD.Encloses (1 - (binaryParameter (shape 3 1 4) (shape 2 1 1) : ℝ)) := by + have he : binaryParameter (shape 3 1 4) (shape 2 1 1) = (21083 / 500000) := by decide +kernel + rw [he] + convert Ball.exact_sound ((478917 / 500000) : ℚ) using 1 <;> norm_num [B3_1_4U2_1_1OneD, Ball.exact] +def B3_1_4U2_1_1EDLogWitness : LogWitness := ⟨-5, 21083, 15625⟩ +def B3_1_4U2_1_1EDLog : Ball := ⟨(-63322821397686708031899813013369 / 20000000000000000000000000000000), (63527471049 / 50000000000000000000000000000000)⟩ +lemma B3_1_4U2_1_1EDLog_sound : B3_1_4U2_1_1EDLog.Encloses (Real.log ((binaryParameter (shape 3 1 4) (shape 2 1 1) : ℝ))) := by + exact checkLog_sound logTwoBall_sound (B3_1_4U2_1_1D_sound) (w := B3_1_4U2_1_1EDLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def B3_1_4U2_1_1ED : Ball := ⟨(13350350435274288654365437577609 / 100000000000000000000000000000000), (5357398689 / 100000000000000000000000000000000)⟩ +lemma B3_1_4U2_1_1ED_sound : B3_1_4U2_1_1ED.Encloses (Foundation.entropyTerm ((binaryParameter (shape 3 1 4) (shape 2 1 1) : ℝ))) := by + exact contains_sound (entropyTerm_ball (B3_1_4U2_1_1D_sound) B3_1_4U2_1_1EDLog_sound) (by decide +kernel) +def B3_1_4U2_1_1EOneDLogWitness : LogWitness := ⟨-1, 478917, 250000⟩ +def B3_1_4U2_1_1EOneDLog : Ball := ⟨(-67313740136531887218517535329 / 1562500000000000000000000000000), (21175823683 / 50000000000000000000000000000000)⟩ +lemma B3_1_4U2_1_1EOneDLog_sound : B3_1_4U2_1_1EOneDLog.Encloses (Real.log ((1 - (binaryParameter (shape 3 1 4) (shape 2 1 1) : ℝ)))) := by + exact checkLog_sound logTwoBall_sound (B3_1_4U2_1_1OneD_sound) (w := B3_1_4U2_1_1EOneDLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def B3_1_4U2_1_1EOneD : Ball := ⟨(1031606223518958138592984398949 / 25000000000000000000000000000000), (10141461951 / 25000000000000000000000000000000)⟩ +lemma B3_1_4U2_1_1EOneD_sound : B3_1_4U2_1_1EOneD.Encloses (Foundation.entropyTerm ((1 - (binaryParameter (shape 3 1 4) (shape 2 1 1) : ℝ)))) := by + exact contains_sound (entropyTerm_ball (B3_1_4U2_1_1OneD_sound) B3_1_4U2_1_1EOneDLog_sound) (by decide +kernel) +def B3_1_4U2_1_1BinaryEntropy : Ball := ⟨(4079899946179837320085215066313 / 20000000000000000000000000000000), (47709046057 / 100000000000000000000000000000000)⟩ +lemma B3_1_4U2_1_1BinaryEntropy_sound : B3_1_4U2_1_1BinaryEntropy.Encloses + (binaryEntropyRate (binaryParameter (shape 3 1 4) (shape 2 1 1))) := by + exact contains_sound (Ball.add_sound (Ball.add_sound B3_1_4U2_1_1EOneD_sound B3_1_4U2_1_1ED_sound) + (Ball.mul_sound B3_1_4U2_1_1D_sound logN2_sound)) (by decide +kernel) +def B3_1_4U2_1_1Leaf : Ball := ⟨(315101226585250447280610230069167 / 100000000000000000000000000000000), (62188121377 / 50000000000000000000000000000000)⟩ +lemma B3_1_4U2_1_1Leaf_sound : B3_1_4U2_1_1Leaf.Encloses (AllFieldTerminalRates.secondLeafRate (shape 3 1 4) (shape 2 1 1)) := by + have hh : shapeMax (shape 2 1 1) = 2 := by decide +kernel + have hp : positive (shape 2 1 1) = true := by decide +kernel + simp only [AllFieldTerminalRates.secondLeafRate, hh, hp, Bool.not_true, Bool.false_eq_true, + show (2 : ℕ) ≠ 4 by decide, show (2 : ℕ) ≠ 3 by decide, ite_false] + have ht : (Ball.exact (978917 / 500000)).Encloses (2 - (binaryParameter (shape 3 1 4) (shape 2 1 1) : ℝ)) := by + have he : binaryParameter (shape 3 1 4) (shape 2 1 1) = (21083 / 500000) := by decide +kernel + rw [he] + convert Ball.exact_sound ((978917 / 500000) : ℚ) using 1 + norm_num [Ball.exact] + exact contains_sound (Ball.mul_sound ht logN5_sound) (by decide +kernel) +def B3_1_4U2_1_1Mass : Ball := ⟨(23642963218565539071319859767 / 2500000000000000000000000000000), (13 / 100000000000000000000000000000000)⟩ +lemma B3_1_4U2_1_1Mass_sound : B3_1_4U2_1_1Mass.Encloses (littleMass (shape 3 1 4) (shape 2 1 1) : ℝ) := by + rw [littleMass_cast] + exact contains_sound (Ball.mul_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) (second_3_1_4)) + (B3_1_4Law_sound (shape 2 1 1))) (by decide +kernel) +def B3_1_4U3_0_1Leaf : Ball := ⟨(115129254649702284200899544090987 / 50000000000000000000000000000000), (21175823683 / 25000000000000000000000000000000)⟩ +lemma B3_1_4U3_0_1Leaf_sound : B3_1_4U3_0_1Leaf.Encloses (AllFieldTerminalRates.secondLeafRate (shape 3 1 4) (shape 3 0 1)) := by + have hh : shapeMax (shape 3 0 1) = 3 := by decide +kernel + simp only [AllFieldTerminalRates.secondLeafRate, hh, show (3 : ℕ) ≠ 4 by decide, ite_false, ite_true] + exact logN10_sound +def B3_1_4U3_0_1Mass : Ball := ⟨(194230381197626472204352679303 / 100000000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ +lemma B3_1_4U3_0_1Mass_sound : B3_1_4U3_0_1Mass.Encloses (littleMass (shape 3 1 4) (shape 3 0 1) : ℝ) := by + rw [littleMass_cast] + exact contains_sound (Ball.mul_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) (second_3_1_4)) + (B3_1_4Law_sound (shape 3 0 1))) (by decide +kernel) +def B3_1_4U3_1_0Leaf : Ball := ⟨(115129254649702284200899544090987 / 50000000000000000000000000000000), (21175823683 / 25000000000000000000000000000000)⟩ +lemma B3_1_4U3_1_0Leaf_sound : B3_1_4U3_1_0Leaf.Encloses (AllFieldTerminalRates.secondLeafRate (shape 3 1 4) (shape 3 1 0)) := by + have hh : shapeMax (shape 3 1 0) = 3 := by decide +kernel + simp only [AllFieldTerminalRates.secondLeafRate, hh, show (3 : ℕ) ≠ 4 by decide, ite_false, ite_true] + exact logN10_sound +def B3_1_4U3_1_0Mass : Ball := ⟨(3743589784293194240021197981 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ +lemma B3_1_4U3_1_0Mass_sound : B3_1_4U3_1_0Mass.Encloses (littleMass (shape 3 1 4) (shape 3 1 0) : ℝ) := by + rw [littleMass_cast] + exact contains_sound (Ball.mul_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) (second_3_1_4)) + (B3_1_4Law_sound (shape 3 1 0))) (by decide +kernel) +def B3_1_4Leaves (s : Shape) : Ball := + match s 0, s 1, s 2 with + | 0, 0, 4 => B3_1_4U0_0_4Leaf + | 0, 1, 3 => B3_1_4U0_1_3Leaf + | 1, 0, 3 => B3_1_4U1_0_3Leaf + | 1, 1, 2 => B3_1_4U1_1_2Leaf + | 2, 0, 2 => B3_1_4U2_0_2Leaf + | 2, 1, 1 => B3_1_4U2_1_1Leaf + | 3, 0, 1 => B3_1_4U3_0_1Leaf + | 3, 1, 0 => B3_1_4U3_1_0Leaf + | _, _, _ => (.exact 0) +lemma B3_1_4Leaves_sound (u : Shape) (hu : u ∈ below (shape 3 1 4)) : + (B3_1_4Leaves u).Encloses (AllFieldTerminalRates.secondLeafRate (shape 3 1 4) u) := by + rw [B3_1_4_below] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl + · exact B3_1_4U0_0_4Leaf_sound + · exact B3_1_4U0_1_3Leaf_sound + · exact B3_1_4U1_0_3Leaf_sound + · exact B3_1_4U1_1_2Leaf_sound + · exact B3_1_4U2_0_2Leaf_sound + · exact B3_1_4U2_1_1Leaf_sound + · exact B3_1_4U3_0_1Leaf_sound + · exact B3_1_4U3_1_0Leaf_sound +def B3_1_4Masses (s : Shape) : Ball := + match s 0, s 1, s 2 with + | 0, 0, 4 => B3_1_4U0_0_4Mass + | 0, 1, 3 => B3_1_4U0_1_3Mass + | 1, 0, 3 => B3_1_4U1_0_3Mass + | 1, 1, 2 => B3_1_4U1_1_2Mass + | 2, 0, 2 => B3_1_4U2_0_2Mass + | 2, 1, 1 => B3_1_4U2_1_1Mass + | 3, 0, 1 => B3_1_4U3_0_1Mass + | 3, 1, 0 => B3_1_4U3_1_0Mass + | _, _, _ => (.exact 0) +lemma B3_1_4Masses_sound (u : Shape) (hu : u ∈ below (shape 3 1 4)) : + (B3_1_4Masses u).Encloses ((fun u => (littleMass (shape 3 1 4) u : ℝ)) u) := by + rw [B3_1_4_below] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl + · exact B3_1_4U0_0_4Mass_sound + · exact B3_1_4U0_1_3Mass_sound + · exact B3_1_4U1_0_3Mass_sound + · exact B3_1_4U1_1_2Mass_sound + · exact B3_1_4U2_0_2Mass_sound + · exact B3_1_4U2_1_1Mass_sound + · exact B3_1_4U3_0_1Mass_sound + · exact B3_1_4U3_1_0Mass_sound +def B3_1_4Binaries (s : Shape) : Ball := + match s 0, s 1, s 2 with + | 1, 1, 2 => B3_1_4U1_1_2BinaryEntropy + | 2, 0, 2 => B3_1_4U2_0_2BinaryEntropy + | 2, 1, 1 => B3_1_4U2_1_1BinaryEntropy + | _, _, _ => (.exact 0) +lemma B3_1_4Binaries_sound (u : Shape) (hu : u ∈ (below (shape 3 1 4)).filter positive) : + (B3_1_4Binaries u).Encloses ((fun u => binaryEntropyRate (binaryParameter (shape 3 1 4) u)) u) := by + have hl : (below (shape 3 1 4)).filter positive = [(shape 1 1 2), (shape 2 1 1)] := by decide +kernel + rw [hl] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl + · exact B3_1_4U1_1_2BinaryEntropy_sound + · exact B3_1_4U2_1_1BinaryEntropy_sound +def B3_1_4S2 : Ball := ⟨(23579419149144914744355152585039 / 50000000000000000000000000000000), (2089477031 / 10000000000000000000000000000000)⟩ +lemma B3_1_4S2_sound : B3_1_4S2.Encloses + (((below (shape 3 1 4)).map fun u => (littleMass (shape 3 1 4) u : ℝ) * AllFieldTerminalRates.secondLeafRate (shape 3 1 4) u).sum) := by + exact contains_sound (listSumBall_sound (below (shape 3 1 4)) + (fun u => .mul (B3_1_4Masses u) (B3_1_4Leaves u)) _ + (fun u hu => Ball.mul_sound (B3_1_4Masses_sound u hu) (B3_1_4Leaves_sound u hu))) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/Certificates/Terminal3_2_3.lean b/lean/OAI/LinearAlgebra/MatrixFields/Certificates/Terminal3_2_3.lean new file mode 100644 index 0000000000000000000000000000000000000000..d330fd7f5dcf724c4834bb8c3eb8870f538683e8 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/Certificates/Terminal3_2_3.lean @@ -0,0 +1,439 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Certificates.Terminal1_1_6 + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def B3_2_3U0_1_3Leaf : Ball := ⟨(115129254649702284200899544090987 / 50000000000000000000000000000000), (21175823683 / 25000000000000000000000000000000)⟩ +lemma B3_2_3U0_1_3Leaf_sound : B3_2_3U0_1_3Leaf.Encloses (AllFieldTerminalRates.secondLeafRate (shape 3 2 3) (shape 0 1 3)) := by + have hh : shapeMax (shape 0 1 3) = 3 := by decide +kernel + simp only [AllFieldTerminalRates.secondLeafRate, hh, show (3 : ℕ) ≠ 4 by decide, ite_false, ite_true] + exact logN10_sound +def B3_2_3U0_1_3Mass : Ball := ⟨(3000961201670361542477883491 / 4000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ +lemma B3_2_3U0_1_3Mass_sound : B3_2_3U0_1_3Mass.Encloses (littleMass (shape 3 2 3) (shape 0 1 3) : ℝ) := by + rw [littleMass_cast] + exact contains_sound (Ball.mul_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) (second_3_2_3)) + (B3_2_3Law_sound (shape 0 1 3))) (by decide +kernel) +def B3_2_3U0_2_2D : Ball := .exact (20837 / 200000) +lemma B3_2_3U0_2_2D_sound : B3_2_3U0_2_2D.Encloses (binaryParameter (shape 3 2 3) (shape 0 2 2) : ℝ) := by + apply exact_rat_enclosed + decide +kernel +def B3_2_3U0_2_2OneD : Ball := .exact (179163 / 200000) +lemma B3_2_3U0_2_2OneD_sound : B3_2_3U0_2_2OneD.Encloses (1 - (binaryParameter (shape 3 2 3) (shape 0 2 2) : ℝ)) := by + have he : binaryParameter (shape 3 2 3) (shape 0 2 2) = (20837 / 200000) := by decide +kernel + rw [he] + convert Ball.exact_sound ((179163 / 200000) : ℚ) using 1 <;> norm_num [B3_2_3U0_2_2OneD, Ball.exact] +def B3_2_3U0_2_2EDLogWitness : LogWitness := ⟨-4, 20837, 12500⟩ +def B3_2_3U0_2_2EDLog : Ball := ⟨(-226158711395997353564112106926423 / 100000000000000000000000000000000), (21175823683 / 20000000000000000000000000000000)⟩ +lemma B3_2_3U0_2_2EDLog_sound : B3_2_3U0_2_2EDLog.Encloses (Real.log ((binaryParameter (shape 3 2 3) (shape 0 2 2) : ℝ))) := by + exact checkLog_sound logTwoBall_sound (B3_2_3U0_2_2D_sound) (w := B3_2_3U0_2_2EDLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def B3_2_3U0_2_2ED : Ball := ⟨(23562345346791984281077019860129 / 100000000000000000000000000000000), (11031015953 / 100000000000000000000000000000000)⟩ +lemma B3_2_3U0_2_2ED_sound : B3_2_3U0_2_2ED.Encloses (Foundation.entropyTerm ((binaryParameter (shape 3 2 3) (shape 0 2 2) : ℝ))) := by + exact contains_sound (entropyTerm_ball (B3_2_3U0_2_2D_sound) B3_2_3U0_2_2EDLog_sound) (by decide +kernel) +def B3_2_3U0_2_2EOneDLogWitness : LogWitness := ⟨-1, 179163, 100000⟩ +def B3_2_3U0_2_2EOneDLog : Ball := ⟨(-11002136054002092463393093233409 / 100000000000000000000000000000000), (21175823683 / 50000000000000000000000000000000)⟩ +lemma B3_2_3U0_2_2EOneDLog_sound : B3_2_3U0_2_2EOneDLog.Encloses (Real.log ((1 - (binaryParameter (shape 3 2 3) (shape 0 2 2) : ℝ)))) := by + exact checkLog_sound logTwoBall_sound (B3_2_3U0_2_2OneD_sound) (w := B3_2_3U0_2_2EOneDLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def B3_2_3U0_2_2EOneD : Ball := ⟨(4927939254607942230047241907443 / 50000000000000000000000000000000), (18969620493 / 50000000000000000000000000000000)⟩ +lemma B3_2_3U0_2_2EOneD_sound : B3_2_3U0_2_2EOneD.Encloses (Foundation.entropyTerm ((1 - (binaryParameter (shape 3 2 3) (shape 0 2 2) : ℝ)))) := by + exact contains_sound (entropyTerm_ball (B3_2_3U0_2_2OneD_sound) B3_2_3U0_2_2EOneDLog_sound) (by decide +kernel) +def B3_2_3U0_2_2BinaryEntropy : Ball := ⟨(10159944439167914736833733635741 / 25000000000000000000000000000000), (53382663321 / 100000000000000000000000000000000)⟩ +lemma B3_2_3U0_2_2BinaryEntropy_sound : B3_2_3U0_2_2BinaryEntropy.Encloses + (binaryEntropyRate (binaryParameter (shape 3 2 3) (shape 0 2 2))) := by + exact contains_sound (Ball.add_sound (Ball.add_sound B3_2_3U0_2_2EOneD_sound B3_2_3U0_2_2ED_sound) + (Ball.mul_sound B3_2_3U0_2_2D_sound logN2_sound)) (by decide +kernel) +def B3_2_3U0_2_2Leaf : Ball := ⟨(328991502462102384361930710537671 / 100000000000000000000000000000000), (167200386277 / 100000000000000000000000000000000)⟩ +lemma B3_2_3U0_2_2Leaf_sound : B3_2_3U0_2_2Leaf.Encloses (AllFieldTerminalRates.secondLeafRate (shape 3 2 3) (shape 0 2 2)) := by + have hh : shapeMax (shape 0 2 2) = 2 := by decide +kernel + have hp : positive (shape 0 2 2) = false := by decide +kernel + simp only [AllFieldTerminalRates.secondLeafRate, hh, hp, Bool.not_false, + show (2 : ℕ) ≠ 4 by decide, show (2 : ℕ) ≠ 3 by decide, ite_false, ite_true] + exact contains_sound (Ball.add_sound B3_2_3U0_2_2BinaryEntropy_sound + (Ball.mul_sound (Ball.mul_sound (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) + B3_2_3U0_2_2OneD_sound) logN5_sound)) (by decide +kernel) +def B3_2_3U0_2_2Mass : Ball := ⟨(541968814941377438344242143929 / 100000000000000000000000000000000), (1 / 12500000000000000000000000000000)⟩ +lemma B3_2_3U0_2_2Mass_sound : B3_2_3U0_2_2Mass.Encloses (littleMass (shape 3 2 3) (shape 0 2 2) : ℝ) := by + rw [littleMass_cast] + exact contains_sound (Ball.mul_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) (second_3_2_3)) + (B3_2_3Law_sound (shape 0 2 2))) (by decide +kernel) +def B3_2_3U1_0_3Leaf : Ball := ⟨(115129254649702284200899544090987 / 50000000000000000000000000000000), (21175823683 / 25000000000000000000000000000000)⟩ +lemma B3_2_3U1_0_3Leaf_sound : B3_2_3U1_0_3Leaf.Encloses (AllFieldTerminalRates.secondLeafRate (shape 3 2 3) (shape 1 0 3)) := by + have hh : shapeMax (shape 1 0 3) = 3 := by decide +kernel + simp only [AllFieldTerminalRates.secondLeafRate, hh, show (3 : ℕ) ≠ 4 by decide, ite_false, ite_true] + exact logN10_sound +def B3_2_3U1_0_3Mass : Ball := ⟨(539050071041767176960078266569 / 100000000000000000000000000000000), (1 / 12500000000000000000000000000000)⟩ +lemma B3_2_3U1_0_3Mass_sound : B3_2_3U1_0_3Mass.Encloses (littleMass (shape 3 2 3) (shape 1 0 3) : ℝ) := by + rw [littleMass_cast] + exact contains_sound (Ball.mul_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) (second_3_2_3)) + (B3_2_3Law_sound (shape 1 0 3))) (by decide +kernel) +def B3_2_3U1_1_2D : Ball := .exact (947 / 200000) +lemma B3_2_3U1_1_2D_sound : B3_2_3U1_1_2D.Encloses (binaryParameter (shape 3 2 3) (shape 1 1 2) : ℝ) := by + apply exact_rat_enclosed + decide +kernel +def B3_2_3U1_1_2OneD : Ball := .exact (199053 / 200000) +lemma B3_2_3U1_1_2OneD_sound : B3_2_3U1_1_2OneD.Encloses (1 - (binaryParameter (shape 3 2 3) (shape 1 1 2) : ℝ)) := by + have he : binaryParameter (shape 3 2 3) (shape 1 1 2) = (947 / 200000) := by decide +kernel + rw [he] + convert Ball.exact_sound ((199053 / 200000) : ℚ) using 1 <;> norm_num [B3_2_3U1_1_2OneD, Ball.exact] +def B3_2_3U1_1_2EDLogWitness : LogWitness := ⟨-8, 3788, 3125⟩ +def B3_2_3U1_1_2EDLog : Ball := ⟨(-267638677617204774276902959196961 / 50000000000000000000000000000000), (95291206573 / 50000000000000000000000000000000)⟩ +lemma B3_2_3U1_1_2EDLog_sound : B3_2_3U1_1_2EDLog.Encloses (Real.log ((binaryParameter (shape 3 2 3) (shape 1 1 2) : ℝ))) := by + exact checkLog_sound logTwoBall_sound (B3_2_3U1_1_2D_sound) (w := B3_2_3U1_1_2EDLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def B3_2_3U1_1_2ED : Ball := ⟨(506907655406985842480454204719 / 20000000000000000000000000000000), (902407727 / 100000000000000000000000000000000)⟩ +lemma B3_2_3U1_1_2ED_sound : B3_2_3U1_1_2ED.Encloses (Foundation.entropyTerm ((binaryParameter (shape 3 2 3) (shape 1 1 2) : ℝ))) := by + exact contains_sound (entropyTerm_ball (B3_2_3U1_1_2D_sound) B3_2_3U1_1_2EDLog_sound) (by decide +kernel) +def B3_2_3U1_1_2EOneDLogWitness : LogWitness := ⟨-1, 199053, 100000⟩ +def B3_2_3U1_1_2EOneDLog : Ball := ⟨(-474624562523299173208176196821 / 100000000000000000000000000000000), (21175823683 / 50000000000000000000000000000000)⟩ +lemma B3_2_3U1_1_2EOneDLog_sound : B3_2_3U1_1_2EOneDLog.Encloses (Real.log ((1 - (binaryParameter (shape 3 2 3) (shape 1 1 2) : ℝ)))) := by + exact checkLog_sound logTwoBall_sound (B3_2_3U1_1_2OneD_sound) (w := B3_2_3U1_1_2EOneDLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def B3_2_3U1_1_2EOneD : Ball := ⟨(472377215219751351623035482529 / 100000000000000000000000000000000), (10537778079 / 25000000000000000000000000000000)⟩ +lemma B3_2_3U1_1_2EOneD_sound : B3_2_3U1_1_2EOneD.Encloses (Foundation.entropyTerm ((1 - (binaryParameter (shape 3 2 3) (shape 1 1 2) : ℝ)))) := by + exact contains_sound (entropyTerm_ball (B3_2_3U1_1_2OneD_sound) B3_2_3U1_1_2EOneDLog_sound) (by decide +kernel) +def B3_2_3U1_1_2BinaryEntropy : Ball := ⟨(3335120682249814668034365825217 / 100000000000000000000000000000000), (21627027547 / 50000000000000000000000000000000)⟩ +lemma B3_2_3U1_1_2BinaryEntropy_sound : B3_2_3U1_1_2BinaryEntropy.Encloses + (binaryEntropyRate (binaryParameter (shape 3 2 3) (shape 1 1 2))) := by + exact contains_sound (Ball.add_sound (Ball.add_sound B3_2_3U1_1_2EOneD_sound B3_2_3U1_1_2ED_sound) + (Ball.mul_sound B3_2_3U1_1_2D_sound logN2_sound)) (by decide +kernel) +def B3_2_3U1_1_2Leaf : Ball := ⟨(501758615055128950613716142031 / 156250000000000000000000000000), (126754139523 / 100000000000000000000000000000000)⟩ +lemma B3_2_3U1_1_2Leaf_sound : B3_2_3U1_1_2Leaf.Encloses (AllFieldTerminalRates.secondLeafRate (shape 3 2 3) (shape 1 1 2)) := by + have hh : shapeMax (shape 1 1 2) = 2 := by decide +kernel + have hp : positive (shape 1 1 2) = true := by decide +kernel + simp only [AllFieldTerminalRates.secondLeafRate, hh, hp, Bool.not_true, Bool.false_eq_true, + show (2 : ℕ) ≠ 4 by decide, show (2 : ℕ) ≠ 3 by decide, ite_false] + have ht : (Ball.exact (399053 / 200000)).Encloses (2 - (binaryParameter (shape 3 2 3) (shape 1 1 2) : ℝ)) := by + have he : binaryParameter (shape 3 2 3) (shape 1 1 2) = (947 / 200000) := by decide +kernel + rw [he] + convert Ball.exact_sound ((399053 / 200000) : ℚ) using 1 + norm_num [Ball.exact] + exact contains_sound (Ball.mul_sound ht logN5_sound) (by decide +kernel) +def B3_2_3U1_1_2Mass : Ball := ⟨(14632618547294745801274531434457 / 100000000000000000000000000000000), (153 / 100000000000000000000000000000000)⟩ +lemma B3_2_3U1_1_2Mass_sound : B3_2_3U1_1_2Mass.Encloses (littleMass (shape 3 2 3) (shape 1 1 2) : ℝ) := by + rw [littleMass_cast] + exact contains_sound (Ball.mul_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) (second_3_2_3)) + (B3_2_3Law_sound (shape 1 1 2))) (by decide +kernel) +def B3_2_3U1_2_1D : Ball := .exact (38889 / 1000000) +lemma B3_2_3U1_2_1D_sound : B3_2_3U1_2_1D.Encloses (binaryParameter (shape 3 2 3) (shape 1 2 1) : ℝ) := by + apply exact_rat_enclosed + decide +kernel +def B3_2_3U1_2_1OneD : Ball := .exact (961111 / 1000000) +lemma B3_2_3U1_2_1OneD_sound : B3_2_3U1_2_1OneD.Encloses (1 - (binaryParameter (shape 3 2 3) (shape 1 2 1) : ℝ)) := by + have he : binaryParameter (shape 3 2 3) (shape 1 2 1) = (38889 / 1000000) := by decide +kernel + rw [he] + convert Ball.exact_sound ((961111 / 1000000) : ℚ) using 1 <;> norm_num [B3_2_3U1_2_1OneD, Ball.exact] +def B3_2_3U1_2_1EDLogWitness : LogWitness := ⟨-5, 38889, 31250⟩ +def B3_2_3U1_2_1EDLog : Ball := ⟨(-40588048058701519414271962400259 / 12500000000000000000000000000000), (127054942097 / 100000000000000000000000000000000)⟩ +lemma B3_2_3U1_2_1EDLog_sound : B3_2_3U1_2_1EDLog.Encloses (Real.log ((binaryParameter (shape 3 2 3) (shape 1 2 1) : ℝ))) := by + exact checkLog_sound logTwoBall_sound (B3_2_3U1_2_1D_sound) (w := B3_2_3U1_2_1EDLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def B3_2_3U1_2_1ED : Ball := ⟨(12627428807638747108012978766269 / 100000000000000000000000000000000), (1235259911 / 25000000000000000000000000000000)⟩ +lemma B3_2_3U1_2_1ED_sound : B3_2_3U1_2_1ED.Encloses (Foundation.entropyTerm ((binaryParameter (shape 3 2 3) (shape 1 2 1) : ℝ))) := by + exact contains_sound (entropyTerm_ball (B3_2_3U1_2_1D_sound) B3_2_3U1_2_1EDLog_sound) (by decide +kernel) +def B3_2_3U1_2_1EOneDLogWitness : LogWitness := ⟨-1, 961111, 500000⟩ +def B3_2_3U1_2_1EOneDLog : Ball := ⟨(-1983268599968726397978668862597 / 50000000000000000000000000000000), (21175823683 / 50000000000000000000000000000000)⟩ +lemma B3_2_3U1_2_1EOneDLog_sound : B3_2_3U1_2_1EOneDLog.Encloses (Real.log ((1 - (binaryParameter (shape 3 2 3) (shape 1 2 1) : ℝ)))) := by + exact checkLog_sound logTwoBall_sound (B3_2_3U1_2_1OneD_sound) (w := B3_2_3U1_2_1EOneDLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def B3_2_3U1_2_1EOneD : Ball := ⟨(3812282534769085194175352818399 / 100000000000000000000000000000000), (5088079269 / 12500000000000000000000000000000)⟩ +lemma B3_2_3U1_2_1EOneD_sound : B3_2_3U1_2_1EOneD.Encloses (Foundation.entropyTerm ((1 - (binaryParameter (shape 3 2 3) (shape 1 2 1) : ℝ)))) := by + exact contains_sound (entropyTerm_ball (B3_2_3U1_2_1OneD_sound) B3_2_3U1_2_1EOneDLog_sound) (by decide +kernel) +def B3_2_3U1_2_1BinaryEntropy : Ball := ⟨(9567645706443701807990502419601 / 50000000000000000000000000000000), (47292687011 / 100000000000000000000000000000000)⟩ +lemma B3_2_3U1_2_1BinaryEntropy_sound : B3_2_3U1_2_1BinaryEntropy.Encloses + (binaryEntropyRate (binaryParameter (shape 3 2 3) (shape 1 2 1))) := by + exact contains_sound (Ball.add_sound (Ball.add_sound B3_2_3U1_2_1EOneD_sound B3_2_3U1_2_1ED_sound) + (Ball.mul_sound B3_2_3U1_2_1D_sound logN2_sound)) (by decide +kernel) +def B3_2_3U1_2_1Leaf : Ball := ⟨(315628639389155101973366898777513 / 100000000000000000000000000000000), (124584422277 / 100000000000000000000000000000000)⟩ +lemma B3_2_3U1_2_1Leaf_sound : B3_2_3U1_2_1Leaf.Encloses (AllFieldTerminalRates.secondLeafRate (shape 3 2 3) (shape 1 2 1)) := by + have hh : shapeMax (shape 1 2 1) = 2 := by decide +kernel + have hp : positive (shape 1 2 1) = true := by decide +kernel + simp only [AllFieldTerminalRates.secondLeafRate, hh, hp, Bool.not_true, Bool.false_eq_true, + show (2 : ℕ) ≠ 4 by decide, show (2 : ℕ) ≠ 3 by decide, ite_false] + have ht : (Ball.exact (1961111 / 1000000)).Encloses (2 - (binaryParameter (shape 3 2 3) (shape 1 2 1) : ℝ)) := by + have he : binaryParameter (shape 3 2 3) (shape 1 2 1) = (38889 / 1000000) := by decide +kernel + rw [he] + convert Ball.exact_sound ((1961111 / 1000000) : ℚ) using 1 + norm_num [Ball.exact] + exact contains_sound (Ball.mul_sound ht logN5_sound) (by decide +kernel) +def B3_2_3U1_2_1Mass : Ball := ⟨(3774266288822559599228366594839 / 50000000000000000000000000000000), (89 / 100000000000000000000000000000000)⟩ +lemma B3_2_3U1_2_1Mass_sound : B3_2_3U1_2_1Mass.Encloses (littleMass (shape 3 2 3) (shape 1 2 1) : ℝ) := by + rw [littleMass_cast] + exact contains_sound (Ball.mul_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) (second_3_2_3)) + (B3_2_3Law_sound (shape 1 2 1))) (by decide +kernel) +def B3_2_3U2_0_2D : Ball := .exact (22013 / 200000) +lemma B3_2_3U2_0_2D_sound : B3_2_3U2_0_2D.Encloses (binaryParameter (shape 3 2 3) (shape 2 0 2) : ℝ) := by + apply exact_rat_enclosed + decide +kernel +def B3_2_3U2_0_2OneD : Ball := .exact (177987 / 200000) +lemma B3_2_3U2_0_2OneD_sound : B3_2_3U2_0_2OneD.Encloses (1 - (binaryParameter (shape 3 2 3) (shape 2 0 2) : ℝ)) := by + have he : binaryParameter (shape 3 2 3) (shape 2 0 2) = (22013 / 200000) := by decide +kernel + rw [he] + convert Ball.exact_sound ((177987 / 200000) : ℚ) using 1 <;> norm_num [B3_2_3U2_0_2OneD, Ball.exact] +def B3_2_3U2_0_2EDLogWitness : LogWitness := ⟨-4, 22013, 12500⟩ +def B3_2_3U2_0_2EDLog : Ball := ⟨(-27583552232710530620549709460953 / 12500000000000000000000000000000), (21175823683 / 20000000000000000000000000000000)⟩ +lemma B3_2_3U2_0_2EDLog_sound : B3_2_3U2_0_2EDLog.Encloses (Real.log ((binaryParameter (shape 3 2 3) (shape 2 0 2) : ℝ))) := by + exact checkLog_sound logTwoBall_sound (B3_2_3U2_0_2D_sound) (w := B3_2_3U2_0_2EDLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def B3_2_3U2_0_2ED : Ball := ⟨(12143934705973138211003215087279 / 50000000000000000000000000000000), (11653585169 / 100000000000000000000000000000000)⟩ +lemma B3_2_3U2_0_2ED_sound : B3_2_3U2_0_2ED.Encloses (Foundation.entropyTerm ((binaryParameter (shape 3 2 3) (shape 2 0 2) : ℝ))) := by + exact contains_sound (entropyTerm_ball (B3_2_3U2_0_2D_sound) B3_2_3U2_0_2EDLog_sound) (by decide +kernel) +def B3_2_3U2_0_2EOneDLogWitness : LogWitness := ⟨-1, 177987, 100000⟩ +def B3_2_3U2_0_2EOneDLog : Ball := ⟨(-11660685263090779968348502269377 / 100000000000000000000000000000000), (21175823683 / 50000000000000000000000000000000)⟩ +lemma B3_2_3U2_0_2EOneDLog_sound : B3_2_3U2_0_2EOneDLog.Encloses (Real.log ((1 - (binaryParameter (shape 3 2 3) (shape 2 0 2) : ℝ)))) := by + exact checkLog_sound logTwoBall_sound (B3_2_3U2_0_2OneD_sound) (w := B3_2_3U2_0_2EOneDLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def B3_2_3U2_0_2EOneD : Ball := ⟨(5188625969804346635566112183549 / 50000000000000000000000000000000), (37690213299 / 100000000000000000000000000000000)⟩ +lemma B3_2_3U2_0_2EOneD_sound : B3_2_3U2_0_2EOneD.Encloses (Foundation.entropyTerm ((1 - (binaryParameter (shape 3 2 3) (shape 2 0 2) : ℝ)))) := by + exact contains_sound (entropyTerm_ball (B3_2_3U2_0_2OneD_sound) B3_2_3U2_0_2EOneDLog_sound) (by decide +kernel) +def B3_2_3U2_0_2BinaryEntropy : Ball := ⟨(42294245794388007741239417784741 / 100000000000000000000000000000000), (6750654067 / 12500000000000000000000000000000)⟩ +lemma B3_2_3U2_0_2BinaryEntropy_sound : B3_2_3U2_0_2BinaryEntropy.Encloses + (binaryEntropyRate (binaryParameter (shape 3 2 3) (shape 2 0 2))) := by + exact contains_sound (Ball.add_sound (Ball.add_sound B3_2_3U2_0_2EOneD_sound B3_2_3U2_0_2ED_sound) + (Ball.mul_sound B3_2_3U2_0_2D_sound logN2_sound)) (by decide +kernel) +def B3_2_3U2_0_2Leaf : Ball := ⟨(3287532715147962311153047012527 / 1000000000000000000000000000000), (167075872433 / 100000000000000000000000000000000)⟩ +lemma B3_2_3U2_0_2Leaf_sound : B3_2_3U2_0_2Leaf.Encloses (AllFieldTerminalRates.secondLeafRate (shape 3 2 3) (shape 2 0 2)) := by + have hh : shapeMax (shape 2 0 2) = 2 := by decide +kernel + have hp : positive (shape 2 0 2) = false := by decide +kernel + simp only [AllFieldTerminalRates.secondLeafRate, hh, hp, Bool.not_false, + show (2 : ℕ) ≠ 4 by decide, show (2 : ℕ) ≠ 3 by decide, ite_false, ite_true] + exact contains_sound (Ball.add_sound B3_2_3U2_0_2BinaryEntropy_sound + (Ball.mul_sound (Ball.mul_sound (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) + B3_2_3U2_0_2OneD_sound) logN5_sound)) (by decide +kernel) +def B3_2_3U2_0_2Mass : Ball := ⟨(3774266288822559599228366594839 / 50000000000000000000000000000000), (89 / 100000000000000000000000000000000)⟩ +lemma B3_2_3U2_0_2Mass_sound : B3_2_3U2_0_2Mass.Encloses (littleMass (shape 3 2 3) (shape 2 0 2) : ℝ) := by + rw [littleMass_cast] + exact contains_sound (Ball.mul_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) (second_3_2_3)) + (B3_2_3Law_sound (shape 2 0 2))) (by decide +kernel) +def B3_2_3U2_1_1D : Ball := .exact (21083 / 500000) +lemma B3_2_3U2_1_1D_sound : B3_2_3U2_1_1D.Encloses (binaryParameter (shape 3 2 3) (shape 2 1 1) : ℝ) := by + apply exact_rat_enclosed + decide +kernel +def B3_2_3U2_1_1OneD : Ball := .exact (478917 / 500000) +lemma B3_2_3U2_1_1OneD_sound : B3_2_3U2_1_1OneD.Encloses (1 - (binaryParameter (shape 3 2 3) (shape 2 1 1) : ℝ)) := by + have he : binaryParameter (shape 3 2 3) (shape 2 1 1) = (21083 / 500000) := by decide +kernel + rw [he] + convert Ball.exact_sound ((478917 / 500000) : ℚ) using 1 <;> norm_num [B3_2_3U2_1_1OneD, Ball.exact] +def B3_2_3U2_1_1EDLogWitness : LogWitness := ⟨-5, 21083, 15625⟩ +def B3_2_3U2_1_1EDLog : Ball := ⟨(-63322821397686708031899813013369 / 20000000000000000000000000000000), (63527471049 / 50000000000000000000000000000000)⟩ +lemma B3_2_3U2_1_1EDLog_sound : B3_2_3U2_1_1EDLog.Encloses (Real.log ((binaryParameter (shape 3 2 3) (shape 2 1 1) : ℝ))) := by + exact checkLog_sound logTwoBall_sound (B3_2_3U2_1_1D_sound) (w := B3_2_3U2_1_1EDLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def B3_2_3U2_1_1ED : Ball := ⟨(13350350435274288654365437577609 / 100000000000000000000000000000000), (5357398689 / 100000000000000000000000000000000)⟩ +lemma B3_2_3U2_1_1ED_sound : B3_2_3U2_1_1ED.Encloses (Foundation.entropyTerm ((binaryParameter (shape 3 2 3) (shape 2 1 1) : ℝ))) := by + exact contains_sound (entropyTerm_ball (B3_2_3U2_1_1D_sound) B3_2_3U2_1_1EDLog_sound) (by decide +kernel) +def B3_2_3U2_1_1EOneDLogWitness : LogWitness := ⟨-1, 478917, 250000⟩ +def B3_2_3U2_1_1EOneDLog : Ball := ⟨(-67313740136531887218517535329 / 1562500000000000000000000000000), (21175823683 / 50000000000000000000000000000000)⟩ +lemma B3_2_3U2_1_1EOneDLog_sound : B3_2_3U2_1_1EOneDLog.Encloses (Real.log ((1 - (binaryParameter (shape 3 2 3) (shape 2 1 1) : ℝ)))) := by + exact checkLog_sound logTwoBall_sound (B3_2_3U2_1_1OneD_sound) (w := B3_2_3U2_1_1EOneDLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def B3_2_3U2_1_1EOneD : Ball := ⟨(1031606223518958138592984398949 / 25000000000000000000000000000000), (10141461951 / 25000000000000000000000000000000)⟩ +lemma B3_2_3U2_1_1EOneD_sound : B3_2_3U2_1_1EOneD.Encloses (Foundation.entropyTerm ((1 - (binaryParameter (shape 3 2 3) (shape 2 1 1) : ℝ)))) := by + exact contains_sound (entropyTerm_ball (B3_2_3U2_1_1OneD_sound) B3_2_3U2_1_1EOneDLog_sound) (by decide +kernel) +def B3_2_3U2_1_1BinaryEntropy : Ball := ⟨(4079899946179837320085215066313 / 20000000000000000000000000000000), (47709046057 / 100000000000000000000000000000000)⟩ +lemma B3_2_3U2_1_1BinaryEntropy_sound : B3_2_3U2_1_1BinaryEntropy.Encloses + (binaryEntropyRate (binaryParameter (shape 3 2 3) (shape 2 1 1))) := by + exact contains_sound (Ball.add_sound (Ball.add_sound B3_2_3U2_1_1EOneD_sound B3_2_3U2_1_1ED_sound) + (Ball.mul_sound B3_2_3U2_1_1D_sound logN2_sound)) (by decide +kernel) +def B3_2_3U2_1_1Leaf : Ball := ⟨(315101226585250447280610230069167 / 100000000000000000000000000000000), (62188121377 / 50000000000000000000000000000000)⟩ +lemma B3_2_3U2_1_1Leaf_sound : B3_2_3U2_1_1Leaf.Encloses (AllFieldTerminalRates.secondLeafRate (shape 3 2 3) (shape 2 1 1)) := by + have hh : shapeMax (shape 2 1 1) = 2 := by decide +kernel + have hp : positive (shape 2 1 1) = true := by decide +kernel + simp only [AllFieldTerminalRates.secondLeafRate, hh, hp, Bool.not_true, Bool.false_eq_true, + show (2 : ℕ) ≠ 4 by decide, show (2 : ℕ) ≠ 3 by decide, ite_false] + have ht : (Ball.exact (978917 / 500000)).Encloses (2 - (binaryParameter (shape 3 2 3) (shape 2 1 1) : ℝ)) := by + have he : binaryParameter (shape 3 2 3) (shape 2 1 1) = (21083 / 500000) := by decide +kernel + rw [he] + convert Ball.exact_sound ((978917 / 500000) : ℚ) using 1 + norm_num [Ball.exact] + exact contains_sound (Ball.mul_sound ht logN5_sound) (by decide +kernel) +def B3_2_3U2_1_1Mass : Ball := ⟨(14632618547294745801274531434457 / 100000000000000000000000000000000), (153 / 100000000000000000000000000000000)⟩ +lemma B3_2_3U2_1_1Mass_sound : B3_2_3U2_1_1Mass.Encloses (littleMass (shape 3 2 3) (shape 2 1 1) : ℝ) := by + rw [littleMass_cast] + exact contains_sound (Ball.mul_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) (second_3_2_3)) + (B3_2_3Law_sound (shape 2 1 1))) (by decide +kernel) +def B3_2_3U2_2_0D : Ball := .exact (25593 / 250000) +lemma B3_2_3U2_2_0D_sound : B3_2_3U2_2_0D.Encloses (binaryParameter (shape 3 2 3) (shape 2 2 0) : ℝ) := by + apply exact_rat_enclosed + decide +kernel +def B3_2_3U2_2_0OneD : Ball := .exact (224407 / 250000) +lemma B3_2_3U2_2_0OneD_sound : B3_2_3U2_2_0OneD.Encloses (1 - (binaryParameter (shape 3 2 3) (shape 2 2 0) : ℝ)) := by + have he : binaryParameter (shape 3 2 3) (shape 2 2 0) = (25593 / 250000) := by decide +kernel + rw [he] + convert Ball.exact_sound ((224407 / 250000) : ℚ) using 1 <;> norm_num [B3_2_3U2_2_0OneD, Ball.exact] +def B3_2_3U2_2_0EDLogWitness : LogWitness := ⟨-4, 25593, 15625⟩ +def B3_2_3U2_2_0EDLog : Ball := ⟨(-113957102063378952030784463086693 / 50000000000000000000000000000000), (21175823683 / 20000000000000000000000000000000)⟩ +lemma B3_2_3U2_2_0EDLog_sound : B3_2_3U2_2_0EDLog.Encloses (Real.log ((binaryParameter (shape 3 2 3) (shape 2 2 0) : ℝ))) := by + exact checkLog_sound logTwoBall_sound (B3_2_3U2_2_0D_sound) (w := B3_2_3U2_2_0EDLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def B3_2_3U2_2_0ED : Ball := ⟨(11666016452432230077295467055111 / 50000000000000000000000000000000), (10839057111 / 100000000000000000000000000000000)⟩ +lemma B3_2_3U2_2_0ED_sound : B3_2_3U2_2_0ED.Encloses (Foundation.entropyTerm ((binaryParameter (shape 3 2 3) (shape 2 2 0) : ℝ))) := by + exact contains_sound (entropyTerm_ball (B3_2_3U2_2_0D_sound) B3_2_3U2_2_0EDLog_sound) (by decide +kernel) +def B3_2_3U2_2_0EOneDLogWitness : LogWitness := ⟨-1, 224407, 125000⟩ +def B3_2_3U2_2_0EOneDLog : Ball := ⟨(-5399977520216846740471713413351 / 50000000000000000000000000000000), (8470329473 / 20000000000000000000000000000000)⟩ +lemma B3_2_3U2_2_0EOneDLog_sound : B3_2_3U2_2_0EOneDLog.Encloses (Real.log ((1 - (binaryParameter (shape 3 2 3) (shape 2 2 0) : ℝ)))) := by + exact checkLog_sound logTwoBall_sound (B3_2_3U2_2_0OneD_sound) (w := B3_2_3U2_2_0EOneDLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def B3_2_3U2_2_0EOneD : Ball := ⟨(9694342043034415411912286335599 / 100000000000000000000000000000000), (19008012261 / 50000000000000000000000000000000)⟩ +lemma B3_2_3U2_2_0EOneD_sound : B3_2_3U2_2_0EOneD.Encloses (Foundation.entropyTerm ((1 - (binaryParameter (shape 3 2 3) (shape 2 2 0) : ℝ)))) := by + exact contains_sound (entropyTerm_ball (B3_2_3U2_2_0OneD_sound) B3_2_3U2_2_0EOneDLog_sound) (by decide +kernel) +def B3_2_3U2_2_0BinaryEntropy : Ball := ⟨(40122261264727147688069307164769 / 100000000000000000000000000000000), (26595352239 / 50000000000000000000000000000000)⟩ +lemma B3_2_3U2_2_0BinaryEntropy_sound : B3_2_3U2_2_0BinaryEntropy.Encloses + (binaryEntropyRate (binaryParameter (shape 3 2 3) (shape 2 2 0))) := by + exact contains_sound (Ball.add_sound (Ball.add_sound B3_2_3U2_2_0EOneD_sound B3_2_3U2_2_0ED_sound) + (Ball.mul_sound B3_2_3U2_2_0D_sound logN2_sound)) (by decide +kernel) +def B3_2_3U2_2_0Leaf : Ball := ⟨(41132196019650809737311914794403 / 12500000000000000000000000000000), (41809694511 / 25000000000000000000000000000000)⟩ +lemma B3_2_3U2_2_0Leaf_sound : B3_2_3U2_2_0Leaf.Encloses (AllFieldTerminalRates.secondLeafRate (shape 3 2 3) (shape 2 2 0)) := by + have hh : shapeMax (shape 2 2 0) = 2 := by decide +kernel + have hp : positive (shape 2 2 0) = false := by decide +kernel + simp only [AllFieldTerminalRates.secondLeafRate, hh, hp, Bool.not_false, + show (2 : ℕ) ≠ 4 by decide, show (2 : ℕ) ≠ 3 by decide, ite_false, ite_true] + exact contains_sound (Ball.add_sound B3_2_3U2_2_0BinaryEntropy_sound + (Ball.mul_sound (Ball.mul_sound (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) + B3_2_3U2_2_0OneD_sound) logN5_sound)) (by decide +kernel) +def B3_2_3U2_2_0Mass : Ball := ⟨(539050071041767176960078266569 / 100000000000000000000000000000000), (1 / 12500000000000000000000000000000)⟩ +lemma B3_2_3U2_2_0Mass_sound : B3_2_3U2_2_0Mass.Encloses (littleMass (shape 3 2 3) (shape 2 2 0) : ℝ) := by + rw [littleMass_cast] + exact contains_sound (Ball.mul_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) (second_3_2_3)) + (B3_2_3Law_sound (shape 2 2 0))) (by decide +kernel) +def B3_2_3U3_0_1Leaf : Ball := ⟨(115129254649702284200899544090987 / 50000000000000000000000000000000), (21175823683 / 25000000000000000000000000000000)⟩ +lemma B3_2_3U3_0_1Leaf_sound : B3_2_3U3_0_1Leaf.Encloses (AllFieldTerminalRates.secondLeafRate (shape 3 2 3) (shape 3 0 1)) := by + have hh : shapeMax (shape 3 0 1) = 3 := by decide +kernel + simp only [AllFieldTerminalRates.secondLeafRate, hh, show (3 : ℕ) ≠ 4 by decide, ite_false, ite_true] + exact logN10_sound +def B3_2_3U3_0_1Mass : Ball := ⟨(541968814941377438344242143929 / 100000000000000000000000000000000), (1 / 12500000000000000000000000000000)⟩ +lemma B3_2_3U3_0_1Mass_sound : B3_2_3U3_0_1Mass.Encloses (littleMass (shape 3 2 3) (shape 3 0 1) : ℝ) := by + rw [littleMass_cast] + exact contains_sound (Ball.mul_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) (second_3_2_3)) + (B3_2_3Law_sound (shape 3 0 1))) (by decide +kernel) +def B3_2_3U3_1_0Leaf : Ball := ⟨(115129254649702284200899544090987 / 50000000000000000000000000000000), (21175823683 / 25000000000000000000000000000000)⟩ +lemma B3_2_3U3_1_0Leaf_sound : B3_2_3U3_1_0Leaf.Encloses (AllFieldTerminalRates.secondLeafRate (shape 3 2 3) (shape 3 1 0)) := by + have hh : shapeMax (shape 3 1 0) = 3 := by decide +kernel + simp only [AllFieldTerminalRates.secondLeafRate, hh, show (3 : ℕ) ≠ 4 by decide, ite_false, ite_true] + exact logN10_sound +def B3_2_3U3_1_0Mass : Ball := ⟨(3000961201670361542477883491 / 4000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ +lemma B3_2_3U3_1_0Mass_sound : B3_2_3U3_1_0Mass.Encloses (littleMass (shape 3 2 3) (shape 3 1 0) : ℝ) := by + rw [littleMass_cast] + exact contains_sound (Ball.mul_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) (second_3_2_3)) + (B3_2_3Law_sound (shape 3 1 0))) (by decide +kernel) +def B3_2_3Leaves (s : Shape) : Ball := + match s 0, s 1, s 2 with + | 0, 1, 3 => B3_2_3U0_1_3Leaf + | 0, 2, 2 => B3_2_3U0_2_2Leaf + | 1, 0, 3 => B3_2_3U1_0_3Leaf + | 1, 1, 2 => B3_2_3U1_1_2Leaf + | 1, 2, 1 => B3_2_3U1_2_1Leaf + | 2, 0, 2 => B3_2_3U2_0_2Leaf + | 2, 1, 1 => B3_2_3U2_1_1Leaf + | 2, 2, 0 => B3_2_3U2_2_0Leaf + | 3, 0, 1 => B3_2_3U3_0_1Leaf + | 3, 1, 0 => B3_2_3U3_1_0Leaf + | _, _, _ => (.exact 0) +lemma B3_2_3Leaves_sound (u : Shape) (hu : u ∈ below (shape 3 2 3)) : + (B3_2_3Leaves u).Encloses (AllFieldTerminalRates.secondLeafRate (shape 3 2 3) u) := by + rw [B3_2_3_below] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl + · exact B3_2_3U0_1_3Leaf_sound + · exact B3_2_3U0_2_2Leaf_sound + · exact B3_2_3U1_0_3Leaf_sound + · exact B3_2_3U1_1_2Leaf_sound + · exact B3_2_3U1_2_1Leaf_sound + · exact B3_2_3U2_0_2Leaf_sound + · exact B3_2_3U2_1_1Leaf_sound + · exact B3_2_3U2_2_0Leaf_sound + · exact B3_2_3U3_0_1Leaf_sound + · exact B3_2_3U3_1_0Leaf_sound +def B3_2_3Masses (s : Shape) : Ball := + match s 0, s 1, s 2 with + | 0, 1, 3 => B3_2_3U0_1_3Mass + | 0, 2, 2 => B3_2_3U0_2_2Mass + | 1, 0, 3 => B3_2_3U1_0_3Mass + | 1, 1, 2 => B3_2_3U1_1_2Mass + | 1, 2, 1 => B3_2_3U1_2_1Mass + | 2, 0, 2 => B3_2_3U2_0_2Mass + | 2, 1, 1 => B3_2_3U2_1_1Mass + | 2, 2, 0 => B3_2_3U2_2_0Mass + | 3, 0, 1 => B3_2_3U3_0_1Mass + | 3, 1, 0 => B3_2_3U3_1_0Mass + | _, _, _ => (.exact 0) +lemma B3_2_3Masses_sound (u : Shape) (hu : u ∈ below (shape 3 2 3)) : + (B3_2_3Masses u).Encloses ((fun u => (littleMass (shape 3 2 3) u : ℝ)) u) := by + rw [B3_2_3_below] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl + · exact B3_2_3U0_1_3Mass_sound + · exact B3_2_3U0_2_2Mass_sound + · exact B3_2_3U1_0_3Mass_sound + · exact B3_2_3U1_1_2Mass_sound + · exact B3_2_3U1_2_1Mass_sound + · exact B3_2_3U2_0_2Mass_sound + · exact B3_2_3U2_1_1Mass_sound + · exact B3_2_3U2_2_0Mass_sound + · exact B3_2_3U3_0_1Mass_sound + · exact B3_2_3U3_1_0Mass_sound +def B3_2_3Binaries (s : Shape) : Ball := + match s 0, s 1, s 2 with + | 0, 2, 2 => B3_2_3U0_2_2BinaryEntropy + | 1, 1, 2 => B3_2_3U1_1_2BinaryEntropy + | 1, 2, 1 => B3_2_3U1_2_1BinaryEntropy + | 2, 0, 2 => B3_2_3U2_0_2BinaryEntropy + | 2, 1, 1 => B3_2_3U2_1_1BinaryEntropy + | 2, 2, 0 => B3_2_3U2_2_0BinaryEntropy + | _, _, _ => (.exact 0) +lemma B3_2_3Binaries_sound (u : Shape) (hu : u ∈ (below (shape 3 2 3)).filter positive) : + (B3_2_3Binaries u).Encloses ((fun u => binaryEntropyRate (binaryParameter (shape 3 2 3) u)) u) := by + have hl : (below (shape 3 2 3)).filter positive = [(shape 1 1 2), (shape 1 2 1), (shape 2 1 1)] := by decide +kernel + rw [hl] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl + · exact B3_2_3U1_1_2BinaryEntropy_sound + · exact B3_2_3U1_2_1BinaryEntropy_sound + · exact B3_2_3U2_1_1BinaryEntropy_sound +def B3_2_3S2 : Ball := ⟨(148129463261957605657082804649427 / 100000000000000000000000000000000), (61613453871 / 100000000000000000000000000000000)⟩ +lemma B3_2_3S2_sound : B3_2_3S2.Encloses + (((below (shape 3 2 3)).map fun u => (littleMass (shape 3 2 3) u : ℝ) * AllFieldTerminalRates.secondLeafRate (shape 3 2 3) u).sum) := by + exact contains_sound (listSumBall_sound (below (shape 3 2 3)) + (fun u => .mul (B3_2_3Masses u) (B3_2_3Leaves u)) _ + (fun u hu => Ball.mul_sound (B3_2_3Masses_sound u hu) (B3_2_3Leaves_sound u hu))) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/Certificates/Terminal3_3_2.lean b/lean/OAI/LinearAlgebra/MatrixFields/Certificates/Terminal3_3_2.lean new file mode 100644 index 0000000000000000000000000000000000000000..f040d5b5a96004e8a958ec8a3a5dad0ab8115c56 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/Certificates/Terminal3_3_2.lean @@ -0,0 +1,762 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Certificates.LittleB1_3_4 +import OAI.LinearAlgebra.MatrixFields.Certificates.Terminal1_1_6 + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate +open scoped BigOperators +lemma B3_3_2_below : below (shape 3 3 2) = [ + (shape 0 2 2), + (shape 0 3 1), + (shape 1 1 2), + (shape 1 2 1), + (shape 1 3 0), + (shape 2 0 2), + (shape 2 1 1), + (shape 2 2 0), + (shape 3 0 1), + (shape 3 1 0)] := by decide +kernel +def B3_3_2Raw (s : Shape) : Ball := + match s 0, s 1, s 2 with + | 0, 2, 2 => ⟨(3703099552999836306590899387483 / 100000000000000000000000000000000), (11 / 100000000000000000000000000000000)⟩ + | 0, 3, 1 => ⟨(514412495980659443970973192587 / 100000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ + | 1, 1, 2 => ⟨(3223866655228713372649086705233 / 6250000000000000000000000000000), (13 / 20000000000000000000000000000000)⟩ + | 1, 2, 1 => ⟨1, 0⟩ + | 1, 3, 0 => ⟨(115502198241018120143768739669 / 3125000000000000000000000000000), (1 / 10000000000000000000000000000000)⟩ + | 2, 0, 2 => ⟨(115502198241018120143768739669 / 3125000000000000000000000000000), (1 / 10000000000000000000000000000000)⟩ + | 2, 1, 1 => ⟨1, 0⟩ + | 2, 2, 0 => ⟨(3223866655228713372649086705233 / 6250000000000000000000000000000), (13 / 20000000000000000000000000000000)⟩ + | 3, 0, 1 => ⟨(514412495980659443970973192587 / 100000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ + | 3, 1, 0 => ⟨(3703099552999836306590899387483 / 100000000000000000000000000000000), (11 / 100000000000000000000000000000000)⟩ + | _, _, _ => (.exact 0) +lemma B3_3_2Raw_0_2_2 : (B3_3_2Raw (shape 0 2 2)).Encloses (splitWeight positiveSecond tablep (shape 3 3 2) (shape 0 2 2) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveSecond tablep (shape 3 3 2) (shape 0 2 2) + (-26340) (0) (-6620) w73 w195 w154 + (by decide +kernel) w73_sound w195_sound w154_sound) (by decide +kernel) +lemma B3_3_2Raw_0_3_1 : (B3_3_2Raw (shape 0 3 1)).Encloses (splitWeight positiveSecond tablep (shape 3 3 2) (shape 0 3 1) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveSecond tablep (shape 3 3 2) (shape 0 3 1) + (-26340) (-26359) (0) w73 w72 w195 + (by decide +kernel) w73_sound w72_sound w195_sound) (by decide +kernel) +lemma B3_3_2Raw_1_1_2 : (B3_3_2Raw (shape 1 1 2)).Encloses (splitWeight positiveSecond tablep (shape 3 3 2) (shape 1 1 2) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveSecond tablep (shape 3 3 2) (shape 1 1 2) + (0) (0) (-6620) w195 w195 w154 + (by decide +kernel) w195_sound w195_sound w154_sound) (by decide +kernel) +lemma B3_3_2Raw_1_2_1 : (B3_3_2Raw (shape 1 2 1)).Encloses (splitWeight positiveSecond tablep (shape 3 3 2) (shape 1 2 1) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveSecond tablep (shape 3 3 2) (shape 1 2 1) + (0) (0) (0) w195 w195 w195 + (by decide +kernel) w195_sound w195_sound w195_sound) (by decide +kernel) +lemma B3_3_2Raw_1_3_0 : (B3_3_2Raw (shape 1 3 0)).Encloses (splitWeight positiveSecond tablep (shape 3 3 2) (shape 1 3 0) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveSecond tablep (shape 3 3 2) (shape 1 3 0) + (0) (-26359) (-6620) w195 w72 w154 + (by decide +kernel) w195_sound w72_sound w154_sound) (by decide +kernel) +lemma B3_3_2Raw_2_0_2 : (B3_3_2Raw (shape 2 0 2)).Encloses (splitWeight positiveSecond tablep (shape 3 3 2) (shape 2 0 2) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveSecond tablep (shape 3 3 2) (shape 2 0 2) + (0) (-26359) (-6620) w195 w72 w154 + (by decide +kernel) w195_sound w72_sound w154_sound) (by decide +kernel) +lemma B3_3_2Raw_2_1_1 : (B3_3_2Raw (shape 2 1 1)).Encloses (splitWeight positiveSecond tablep (shape 3 3 2) (shape 2 1 1) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveSecond tablep (shape 3 3 2) (shape 2 1 1) + (0) (0) (0) w195 w195 w195 + (by decide +kernel) w195_sound w195_sound w195_sound) (by decide +kernel) +lemma B3_3_2Raw_2_2_0 : (B3_3_2Raw (shape 2 2 0)).Encloses (splitWeight positiveSecond tablep (shape 3 3 2) (shape 2 2 0) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveSecond tablep (shape 3 3 2) (shape 2 2 0) + (0) (0) (-6620) w195 w195 w154 + (by decide +kernel) w195_sound w195_sound w154_sound) (by decide +kernel) +lemma B3_3_2Raw_3_0_1 : (B3_3_2Raw (shape 3 0 1)).Encloses (splitWeight positiveSecond tablep (shape 3 3 2) (shape 3 0 1) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveSecond tablep (shape 3 3 2) (shape 3 0 1) + (-26340) (-26359) (0) w73 w72 w195 + (by decide +kernel) w73_sound w72_sound w195_sound) (by decide +kernel) +lemma B3_3_2Raw_3_1_0 : (B3_3_2Raw (shape 3 1 0)).Encloses (splitWeight positiveSecond tablep (shape 3 3 2) (shape 3 1 0) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveSecond tablep (shape 3 3 2) (shape 3 1 0) + (-26340) (0) (-6620) w73 w195 w154 + (by decide +kernel) w73_sound w195_sound w154_sound) (by decide +kernel) +lemma B3_3_2Raw_sound (u : Shape) (hu : u ∈ below (shape 3 3 2)) : + (B3_3_2Raw u).Encloses (splitWeight positiveSecond tablep (shape 3 3 2) u : ℝ) := by + rw [B3_3_2_below] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl + · exact B3_3_2Raw_0_2_2 + · exact B3_3_2Raw_0_3_1 + · exact B3_3_2Raw_1_1_2 + · exact B3_3_2Raw_1_2_1 + · exact B3_3_2Raw_1_3_0 + · exact B3_3_2Raw_2_0_2 + · exact B3_3_2Raw_2_1_1 + · exact B3_3_2Raw_2_2_0 + · exact B3_3_2Raw_3_0_1 + · exact B3_3_2Raw_3_1_0 +def B3_3_2Den : Ball := ⟨(79747724438176244778773929766603 / 25000000000000000000000000000000), (11 / 6250000000000000000000000000000)⟩ +lemma B3_3_2Den_sound : B3_3_2Den.Encloses (((below (shape 3 3 2)).map (splitWeight positiveSecond tablep (shape 3 3 2))).sum : ℝ) := by + exact contains_sound (list_cast_enclosed (below (shape 3 3 2)) B3_3_2Raw (splitWeight positiveSecond tablep (shape 3 3 2)) B3_3_2Raw_sound) (by decide +kernel) +lemma B3_3_2Den_positive : 0 < B3_3_2Den.lower := by decide +kernel +def B3_3_2Table (s : Shape) : Ball := + match s 0, s 1, s 2 with + | 0, 2, 2 => ⟨(580439689515942428146703134263 / 50000000000000000000000000000000), (1 / 20000000000000000000000000000000)⟩ + | 0, 3, 1 => ⟨(16126243714309786405990264147 / 10000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 1, 1, 2 => ⟨(1617032550052504124618182388813 / 10000000000000000000000000000000), (3 / 10000000000000000000000000000000)⟩ + | 1, 2, 1 => ⟨(15674428440513710546549123442641 / 50000000000000000000000000000000), (9 / 50000000000000000000000000000000)⟩ + | 1, 3, 0 => ⟨(1158675802272554940366620316593 / 100000000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ + | 2, 0, 2 => ⟨(1158675802272554940366620316593 / 100000000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ + | 2, 1, 1 => ⟨(15674428440513710546549123442641 / 50000000000000000000000000000000), (9 / 50000000000000000000000000000000)⟩ + | 2, 2, 0 => ⟨(1617032550052504124618182388813 / 10000000000000000000000000000000), (3 / 10000000000000000000000000000000)⟩ + | 3, 0, 1 => ⟨(16126243714309786405990264147 / 10000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 3, 1, 0 => ⟨(580439689515942428146703134263 / 50000000000000000000000000000000), (1 / 20000000000000000000000000000000)⟩ + | _, _, _ => (.exact 0) +def B3_3_2Law (u : Shape) : Ball := if u ∈ below (shape 3 3 2) then B3_3_2Table u else .exact 0 +lemma B3_3_2Law_check_0_2_2 : contains (.mul (B3_3_2Raw (shape 0 2 2)) (.inv B3_3_2Den)) (B3_3_2Table (shape 0 2 2)) = true := by decide +kernel +lemma B3_3_2Law_check_0_3_1 : contains (.mul (B3_3_2Raw (shape 0 3 1)) (.inv B3_3_2Den)) (B3_3_2Table (shape 0 3 1)) = true := by decide +kernel +lemma B3_3_2Law_check_1_1_2 : contains (.mul (B3_3_2Raw (shape 1 1 2)) (.inv B3_3_2Den)) (B3_3_2Table (shape 1 1 2)) = true := by decide +kernel +lemma B3_3_2Law_check_1_2_1 : contains (.mul (B3_3_2Raw (shape 1 2 1)) (.inv B3_3_2Den)) (B3_3_2Table (shape 1 2 1)) = true := by decide +kernel +lemma B3_3_2Law_check_1_3_0 : contains (.mul (B3_3_2Raw (shape 1 3 0)) (.inv B3_3_2Den)) (B3_3_2Table (shape 1 3 0)) = true := by decide +kernel +lemma B3_3_2Law_check_2_0_2 : contains (.mul (B3_3_2Raw (shape 2 0 2)) (.inv B3_3_2Den)) (B3_3_2Table (shape 2 0 2)) = true := by decide +kernel +lemma B3_3_2Law_check_2_1_1 : contains (.mul (B3_3_2Raw (shape 2 1 1)) (.inv B3_3_2Den)) (B3_3_2Table (shape 2 1 1)) = true := by decide +kernel +lemma B3_3_2Law_check_2_2_0 : contains (.mul (B3_3_2Raw (shape 2 2 0)) (.inv B3_3_2Den)) (B3_3_2Table (shape 2 2 0)) = true := by decide +kernel +lemma B3_3_2Law_check_3_0_1 : contains (.mul (B3_3_2Raw (shape 3 0 1)) (.inv B3_3_2Den)) (B3_3_2Table (shape 3 0 1)) = true := by decide +kernel +lemma B3_3_2Law_check_3_1_0 : contains (.mul (B3_3_2Raw (shape 3 1 0)) (.inv B3_3_2Den)) (B3_3_2Table (shape 3 1 0)) = true := by decide +kernel +lemma B3_3_2Law_check (u : Shape) (hu : u ∈ below (shape 3 3 2)) : + contains (.mul (B3_3_2Raw u) (.inv B3_3_2Den)) (B3_3_2Table u) = true := by + rw [B3_3_2_below] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl + · exact B3_3_2Law_check_0_2_2 + · exact B3_3_2Law_check_0_3_1 + · exact B3_3_2Law_check_1_1_2 + · exact B3_3_2Law_check_1_2_1 + · exact B3_3_2Law_check_1_3_0 + · exact B3_3_2Law_check_2_0_2 + · exact B3_3_2Law_check_2_1_1 + · exact B3_3_2Law_check_2_2_0 + · exact B3_3_2Law_check_3_0_1 + · exact B3_3_2Law_check_3_1_0 +lemma B3_3_2Law_sound (u : Shape) : + (B3_3_2Law u).Encloses (stageBLaw (shape 3 3 2) u : ℝ) := by + by_cases hu : u ∈ below (shape 3 3 2) + · have h := contains_sound (Ball.mul_sound (B3_3_2Raw_sound u hu) + (Ball.inv_sound B3_3_2Den_sound B3_3_2Den_positive)) (B3_3_2Law_check u hu) + simpa only [B3_3_2Law, hu, ite_true, stageBLaw, splitLaw, + Rat.cast_div, Rat.cast_mul, Rat.cast_inv, div_eq_mul_inv] using h + · simp only [B3_3_2Law, hu, ite_false, stageBLaw, splitLaw, Rat.cast_zero] + simpa only [Rat.cast_zero] using Ball.exact_sound 0 + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def B3_3_2Binary (u : Shape) : ℚ := + match u 0, u 1, u 2 with + | 0, 2, 2 => (52157 / 500000) + | 1, 1, 2 => (9739 / 250000) + | 1, 2, 1 => (1219 / 250000) + | 2, 0, 2 => (20479 / 200000) + | 2, 1, 1 => (21083 / 500000) + | 2, 2, 0 => (27517 / 250000) + | _, _, _ => 0 +lemma B3_3_2Binary_eq (u : Shape) (hu : u ∈ shapes 4) : + binaryParameter (shape 3 3 2) u = B3_3_2Binary u := by + rw [shapes4_list] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel +def B3_3_2LittleRat (u : Shape) (w : Fin 3) (i : Fin 6) : ℚ := + if u w = 2 then + if i = 2 then 1 - B3_3_2Binary u else if i = 3 then B3_3_2Binary u else 0 + else if i = singletonSlot (u w) then 1 else 0 + +def B3_3_2Little (u : Shape) (w : Fin 3) (i : Fin 6) : Ball := + if u ∈ shapes 4 then .exact (B3_3_2LittleRat u w i) + else .exact (littleLaw (shape 3 3 2) u w i) + +lemma B3_3_2Little_sound (u : Shape) (w : Fin 3) (i : Fin 6) : + (B3_3_2Little u w i).Encloses (littleLaw (shape 3 3 2) u w i : ℝ) := by + by_cases hu : u ∈ shapes 4 + · simp only [B3_3_2Little, hu, ite_true] + apply exact_rat_enclosed + simp only [B3_3_2LittleRat, littleLaw, B3_3_2Binary_eq u hu] + · simp only [B3_3_2Little, hu, ite_false] + exact Ball.exact_sound _ +def B3_3_2Half (w : Fin 3) (ij : PairSlot) : Ball := + match w.val, ij.1.val, ij.2.val with + | 0, 0, 4 => ⟨(330535454043745680088327227499 / 25000000000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ + | 0, 1, 2 => ⟨(11364381072153531634707882333201 / 25000000000000000000000000000000), (3 / 6250000000000000000000000000000)⟩ + | 0, 1, 3 => ⟨(3220333895210890740815161757201 / 100000000000000000000000000000000), (1 / 20000000000000000000000000000000)⟩ + | 0, 2, 1 => ⟨(11364381072153531634707882333201 / 25000000000000000000000000000000), (3 / 6250000000000000000000000000000)⟩ + | 0, 3, 1 => ⟨(3220333895210890740815161757201 / 100000000000000000000000000000000), (1 / 20000000000000000000000000000000)⟩ + | 0, 4, 0 => ⟨(330535454043745680088327227499 / 25000000000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ + | 1, 2, 1 => ⟨(2914142085981020950846212413557 / 6250000000000000000000000000000), (1 / 2000000000000000000000000000000)⟩ + | 1, 3, 1 => ⟨(1026894192444005991017039212513 / 50000000000000000000000000000000), (1 / 20000000000000000000000000000000)⟩ + | 1, 4, 0 => ⟨(1319938239415652804426522958063 / 100000000000000000000000000000000), (1 / 20000000000000000000000000000000)⟩ + | 1, 1, 2 => ⟨(2914142085981020950846212413557 / 6250000000000000000000000000000), (1 / 2000000000000000000000000000000)⟩ + | 1, 1, 3 => ⟨(1026894192444005991017039212513 / 50000000000000000000000000000000), (1 / 20000000000000000000000000000000)⟩ + | 1, 0, 4 => ⟨(1319938239415652804426522958063 / 100000000000000000000000000000000), (1 / 20000000000000000000000000000000)⟩ + | 2, 2, 0 => ⟨(352404218026259944720747217461 / 2000000000000000000000000000000), (19 / 50000000000000000000000000000000)⟩ + | 2, 3, 0 => ⟨(869669780516483806804489600199 / 100000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ + | 2, 1, 1 => ⟨(984691228692828717411192172711 / 1562500000000000000000000000000), (19 / 50000000000000000000000000000000)⟩ + | 2, 0, 2 => ⟨(352404218026259944720747217461 / 2000000000000000000000000000000), (19 / 50000000000000000000000000000000)⟩ + | 2, 0, 3 => ⟨(869669780516483806804489600199 / 100000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ + | _, _, _ => (.exact 0) +lemma B3_3_2Half_check_0_0 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 3 3 2)) (shape 3 3 2) B3_3_2Law + (fun u => B3_3_2Little u 0) ((0 : Fin 6),j)) (B3_3_2Half 0 (0,j)) = true := by + decide +kernel +lemma B3_3_2Half_check_0_1 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 3 3 2)) (shape 3 3 2) B3_3_2Law + (fun u => B3_3_2Little u 0) ((1 : Fin 6),j)) (B3_3_2Half 0 (1,j)) = true := by + decide +kernel +lemma B3_3_2Half_check_0_2 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 3 3 2)) (shape 3 3 2) B3_3_2Law + (fun u => B3_3_2Little u 0) ((2 : Fin 6),j)) (B3_3_2Half 0 (2,j)) = true := by + decide +kernel +lemma B3_3_2Half_check_0_3 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 3 3 2)) (shape 3 3 2) B3_3_2Law + (fun u => B3_3_2Little u 0) ((3 : Fin 6),j)) (B3_3_2Half 0 (3,j)) = true := by + decide +kernel +lemma B3_3_2Half_check_0_4 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 3 3 2)) (shape 3 3 2) B3_3_2Law + (fun u => B3_3_2Little u 0) ((4 : Fin 6),j)) (B3_3_2Half 0 (4,j)) = true := by + decide +kernel +lemma B3_3_2Half_check_0_5 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 3 3 2)) (shape 3 3 2) B3_3_2Law + (fun u => B3_3_2Little u 0) ((5 : Fin 6),j)) (B3_3_2Half 0 (5,j)) = true := by + decide +kernel +lemma B3_3_2Half_check_1_0 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 3 3 2)) (shape 3 3 2) B3_3_2Law + (fun u => B3_3_2Little u 1) ((0 : Fin 6),j)) (B3_3_2Half 1 (0,j)) = true := by + decide +kernel +lemma B3_3_2Half_check_1_1 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 3 3 2)) (shape 3 3 2) B3_3_2Law + (fun u => B3_3_2Little u 1) ((1 : Fin 6),j)) (B3_3_2Half 1 (1,j)) = true := by + decide +kernel +lemma B3_3_2Half_check_1_2 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 3 3 2)) (shape 3 3 2) B3_3_2Law + (fun u => B3_3_2Little u 1) ((2 : Fin 6),j)) (B3_3_2Half 1 (2,j)) = true := by + decide +kernel +lemma B3_3_2Half_check_1_3 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 3 3 2)) (shape 3 3 2) B3_3_2Law + (fun u => B3_3_2Little u 1) ((3 : Fin 6),j)) (B3_3_2Half 1 (3,j)) = true := by + decide +kernel +lemma B3_3_2Half_check_1_4 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 3 3 2)) (shape 3 3 2) B3_3_2Law + (fun u => B3_3_2Little u 1) ((4 : Fin 6),j)) (B3_3_2Half 1 (4,j)) = true := by + decide +kernel +lemma B3_3_2Half_check_1_5 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 3 3 2)) (shape 3 3 2) B3_3_2Law + (fun u => B3_3_2Little u 1) ((5 : Fin 6),j)) (B3_3_2Half 1 (5,j)) = true := by + decide +kernel +lemma B3_3_2Half_check_2_0 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 3 3 2)) (shape 3 3 2) B3_3_2Law + (fun u => B3_3_2Little u 2) ((0 : Fin 6),j)) (B3_3_2Half 2 (0,j)) = true := by + decide +kernel +lemma B3_3_2Half_check_2_1 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 3 3 2)) (shape 3 3 2) B3_3_2Law + (fun u => B3_3_2Little u 2) ((1 : Fin 6),j)) (B3_3_2Half 2 (1,j)) = true := by + decide +kernel +lemma B3_3_2Half_check_2_2 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 3 3 2)) (shape 3 3 2) B3_3_2Law + (fun u => B3_3_2Little u 2) ((2 : Fin 6),j)) (B3_3_2Half 2 (2,j)) = true := by + decide +kernel +lemma B3_3_2Half_check_2_3 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 3 3 2)) (shape 3 3 2) B3_3_2Law + (fun u => B3_3_2Little u 2) ((3 : Fin 6),j)) (B3_3_2Half 2 (3,j)) = true := by + decide +kernel +lemma B3_3_2Half_check_2_4 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 3 3 2)) (shape 3 3 2) B3_3_2Law + (fun u => B3_3_2Little u 2) ((4 : Fin 6),j)) (B3_3_2Half 2 (4,j)) = true := by + decide +kernel +lemma B3_3_2Half_check_2_5 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 3 3 2)) (shape 3 3 2) B3_3_2Law + (fun u => B3_3_2Little u 2) ((5 : Fin 6),j)) (B3_3_2Half 2 (5,j)) = true := by + decide +kernel +lemma B3_3_2Half_sound (w : Fin 3) (ij : PairSlot) : + (B3_3_2Half w ij).Encloses (halfLaw (shape 3 3 2) w ij : ℝ) := by + have hcheck : contains (pairLawBall (below (shape 3 3 2)) (shape 3 3 2) B3_3_2Law + (fun u => B3_3_2Little u w) ij) (B3_3_2Half w ij) = true := by + rcases ij with ⟨i,j⟩ + revert i w + apply forall_fin3 + · exact forall_fin6 (B3_3_2Half_check_0_0 j) (B3_3_2Half_check_0_1 j) (B3_3_2Half_check_0_2 j) (B3_3_2Half_check_0_3 j) (B3_3_2Half_check_0_4 j) (B3_3_2Half_check_0_5 j) + · exact forall_fin6 (B3_3_2Half_check_1_0 j) (B3_3_2Half_check_1_1 j) (B3_3_2Half_check_1_2 j) (B3_3_2Half_check_1_3 j) (B3_3_2Half_check_1_4 j) (B3_3_2Half_check_1_5 j) + · exact forall_fin6 (B3_3_2Half_check_2_0 j) (B3_3_2Half_check_2_1 j) (B3_3_2Half_check_2_2 j) (B3_3_2Half_check_2_3 j) (B3_3_2Half_check_2_4 j) (B3_3_2Half_check_2_5 j) + have h := contains_sound (pairLawBall_sound (below (shape 3 3 2)) (shape 3 3 2) + B3_3_2Law (fun u => (stageBLaw (shape 3 3 2) u : ℝ)) + (fun u => B3_3_2Little u w) (fun u i => (littleLaw (shape 3 3 2) u w i : ℝ)) + (fun u _ => B3_3_2Law_sound u) (fun u i => B3_3_2Little_sound u w i) ij) hcheck + have hp : positive (shape 3 3 2) = true := by decide +kernel + simpa only [halfLaw, hp, ite_true, pairLaw, positiveHalfLaw, Rat.cast_list_sum, + List.map_map, Function.comp_def, Rat.cast_mul] using h + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def B3_3_2U0_2_2D : Ball := .exact (52157 / 500000) +lemma B3_3_2U0_2_2D_sound : B3_3_2U0_2_2D.Encloses (binaryParameter (shape 3 3 2) (shape 0 2 2) : ℝ) := by + apply exact_rat_enclosed + decide +kernel +def B3_3_2U0_2_2OneD : Ball := .exact (447843 / 500000) +lemma B3_3_2U0_2_2OneD_sound : B3_3_2U0_2_2OneD.Encloses (1 - (binaryParameter (shape 3 3 2) (shape 0 2 2) : ℝ)) := by + have he : binaryParameter (shape 3 3 2) (shape 0 2 2) = (52157 / 500000) := by decide +kernel + rw [he] + convert Ball.exact_sound ((447843 / 500000) : ℚ) using 1 <;> norm_num [B3_3_2U0_2_2OneD, Ball.exact] +def B3_3_2U0_2_2EDLogWitness : LogWitness := ⟨-4, 52157, 31250⟩ +def B3_3_2U0_2_2EDLog : Ball := ⟨(-226034969779528798511424963779123 / 100000000000000000000000000000000), (52939559207 / 50000000000000000000000000000000)⟩ +lemma B3_3_2U0_2_2EDLog_sound : B3_3_2U0_2_2EDLog.Encloses (Real.log ((binaryParameter (shape 3 3 2) (shape 0 2 2) : ℝ))) := by + exact checkLog_sound logTwoBall_sound (B3_3_2U0_2_2D_sound) (w := B3_3_2U0_2_2EDLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def B3_3_2U0_2_2ED : Ball := ⟨(4715722367516353417584156734331 / 20000000000000000000000000000000), (11044674359 / 100000000000000000000000000000000)⟩ +lemma B3_3_2U0_2_2ED_sound : B3_3_2U0_2_2ED.Encloses (Foundation.entropyTerm ((binaryParameter (shape 3 3 2) (shape 0 2 2) : ℝ))) := by + exact contains_sound (entropyTerm_ball (B3_3_2U0_2_2D_sound) B3_3_2U0_2_2EDLog_sound) (by decide +kernel) +def B3_3_2U0_2_2EOneDLogWitness : LogWitness := ⟨-1, 447843, 250000⟩ +def B3_3_2U0_2_2EOneDLog : Ball := ⟨(-1101653738564778545821473882577 / 10000000000000000000000000000000), (21175823683 / 50000000000000000000000000000000)⟩ +lemma B3_3_2U0_2_2EOneDLog_sound : B3_3_2U0_2_2EOneDLog.Encloses (Real.log ((1 - (binaryParameter (shape 3 3 2) (shape 0 2 2) : ℝ)))) := by + exact checkLog_sound logTwoBall_sound (B3_3_2U0_2_2OneD_sound) (w := B3_3_2U0_2_2EOneDLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def B3_3_2U0_2_2EOneD : Ball := ⟨(9867358304801322365926526559899 / 100000000000000000000000000000000), (4741722203 / 12500000000000000000000000000000)⟩ +lemma B3_3_2U0_2_2EOneD_sound : B3_3_2U0_2_2EOneD.Encloses (Foundation.entropyTerm ((1 - (binaryParameter (shape 3 3 2) (shape 0 2 2) : ℝ)))) := by + exact contains_sound (entropyTerm_ball (B3_3_2U0_2_2OneD_sound) B3_3_2U0_2_2EOneDLog_sound) (by decide +kernel) +def B3_3_2U0_2_2BinaryEntropy : Ball := ⟨(20338232820838051477251111695703 / 50000000000000000000000000000000), (53396321727 / 100000000000000000000000000000000)⟩ +lemma B3_3_2U0_2_2BinaryEntropy_sound : B3_3_2U0_2_2BinaryEntropy.Encloses + (binaryEntropyRate (binaryParameter (shape 3 3 2) (shape 0 2 2))) := by + exact contains_sound (Ball.add_sound (Ball.add_sound B3_3_2U0_2_2EOneD_sound B3_3_2U0_2_2ED_sound) + (Ball.mul_sound B3_3_2U0_2_2D_sound logN2_sound)) (by decide +kernel) +def B3_3_2U0_2_2Leaf : Ball := ⟨(328986666848966028579433299805169 / 100000000000000000000000000000000), (41799413649 / 25000000000000000000000000000000)⟩ +lemma B3_3_2U0_2_2Leaf_sound : B3_3_2U0_2_2Leaf.Encloses (AllFieldTerminalRates.secondLeafRate (shape 3 3 2) (shape 0 2 2)) := by + have hh : shapeMax (shape 0 2 2) = 2 := by decide +kernel + have hp : positive (shape 0 2 2) = false := by decide +kernel + simp only [AllFieldTerminalRates.secondLeafRate, hh, hp, Bool.not_false, + show (2 : ℕ) ≠ 4 by decide, show (2 : ℕ) ≠ 3 by decide, ite_false, ite_true] + exact contains_sound (Ball.add_sound B3_3_2U0_2_2BinaryEntropy_sound + (Ball.mul_sound (Ball.mul_sound (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) + B3_3_2U0_2_2OneD_sound) logN5_sound)) (by decide +kernel) +def B3_3_2U0_2_2Mass : Ball := ⟨(257837301312875337408670808073 / 100000000000000000000000000000000), (1 / 20000000000000000000000000000000)⟩ +lemma B3_3_2U0_2_2Mass_sound : B3_3_2U0_2_2Mass.Encloses (littleMass (shape 3 3 2) (shape 0 2 2) : ℝ) := by + rw [littleMass_cast] + exact contains_sound (Ball.mul_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) (second_3_3_2)) + (B3_3_2Law_sound (shape 0 2 2))) (by decide +kernel) +def B3_3_2U0_3_1Leaf : Ball := ⟨(115129254649702284200899544090987 / 50000000000000000000000000000000), (21175823683 / 25000000000000000000000000000000)⟩ +lemma B3_3_2U0_3_1Leaf_sound : B3_3_2U0_3_1Leaf.Encloses (AllFieldTerminalRates.secondLeafRate (shape 3 3 2) (shape 0 3 1)) := by + have hh : shapeMax (shape 0 3 1) = 3 := by decide +kernel + simp only [AllFieldTerminalRates.secondLeafRate, hh, show (3 : ℕ) ≠ 4 by decide, ite_false, ite_true] + exact logN10_sound +def B3_3_2U0_3_1Mass : Ball := ⟨(7163443911078640424744493343 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ +lemma B3_3_2U0_3_1Mass_sound : B3_3_2U0_3_1Mass.Encloses (littleMass (shape 3 3 2) (shape 0 3 1) : ℝ) := by + rw [littleMass_cast] + exact contains_sound (Ball.mul_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) (second_3_3_2)) + (B3_3_2Law_sound (shape 0 3 1))) (by decide +kernel) +def B3_3_2U1_1_2D : Ball := .exact (9739 / 250000) +lemma B3_3_2U1_1_2D_sound : B3_3_2U1_1_2D.Encloses (binaryParameter (shape 3 3 2) (shape 1 1 2) : ℝ) := by + apply exact_rat_enclosed + decide +kernel +def B3_3_2U1_1_2OneD : Ball := .exact (240261 / 250000) +lemma B3_3_2U1_1_2OneD_sound : B3_3_2U1_1_2OneD.Encloses (1 - (binaryParameter (shape 3 3 2) (shape 1 1 2) : ℝ)) := by + have he : binaryParameter (shape 3 3 2) (shape 1 1 2) = (9739 / 250000) := by decide +kernel + rw [he] + convert Ball.exact_sound ((240261 / 250000) : ℚ) using 1 <;> norm_num [B3_3_2U1_1_2OneD, Ball.exact] +def B3_3_2U1_1_2EDLogWitness : LogWitness := ⟨-5, 19478, 15625⟩ +def B3_3_2U1_1_2EDLog : Ball := ⟨(-324532247488318424096291773816019 / 100000000000000000000000000000000), (127054942097 / 100000000000000000000000000000000)⟩ +lemma B3_3_2U1_1_2EDLog_sound : B3_3_2U1_1_2EDLog.Encloses (Real.log ((binaryParameter (shape 3 3 2) (shape 1 1 2) : ℝ))) := by + exact checkLog_sound logTwoBall_sound (B3_3_2U1_1_2D_sound) (w := B3_3_2U1_1_2EDLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def B3_3_2U1_1_2ED : Ball := ⟨(12642478233154932529095142340777 / 100000000000000000000000000000000), (197982093 / 4000000000000000000000000000000)⟩ +lemma B3_3_2U1_1_2ED_sound : B3_3_2U1_1_2ED.Encloses (Foundation.entropyTerm ((binaryParameter (shape 3 3 2) (shape 1 1 2) : ℝ))) := by + exact contains_sound (entropyTerm_ball (B3_3_2U1_1_2D_sound) B3_3_2U1_1_2EDLog_sound) (by decide +kernel) +def B3_3_2U1_1_2EOneDLogWitness : LogWitness := ⟨-1, 240261, 125000⟩ +def B3_3_2U1_1_2EOneDLog : Ball := ⟨(-198675427100083019722202722521 / 5000000000000000000000000000000), (21175823683 / 50000000000000000000000000000000)⟩ +lemma B3_3_2U1_1_2EOneDLog_sound : B3_3_2U1_1_2EOneDLog.Encloses (Real.log ((1 - (binaryParameter (shape 3 3 2) (shape 1 1 2) : ℝ)))) := by + exact checkLog_sound logTwoBall_sound (B3_3_2U1_1_2OneD_sound) (w := B3_3_2U1_1_2EOneDLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def B3_3_2U1_1_2EOneD : Ball := ⟨(3818716543239443712118091865249 / 100000000000000000000000000000000), (2543862287 / 6250000000000000000000000000000)⟩ +lemma B3_3_2U1_1_2EOneD_sound : B3_3_2U1_1_2EOneD.Encloses (Foundation.entropyTerm ((1 - (binaryParameter (shape 3 3 2) (shape 1 1 2) : ℝ)))) := by + exact contains_sound (entropyTerm_ball (B3_3_2U1_1_2OneD_sound) B3_3_2U1_1_2EOneDLog_sound) (by decide +kernel) +def B3_3_2U1_1_2BinaryEntropy : Ball := ⟨(3832283786596739837715800582899 / 20000000000000000000000000000000), (47301199693 / 100000000000000000000000000000000)⟩ +lemma B3_3_2U1_1_2BinaryEntropy_sound : B3_3_2U1_1_2BinaryEntropy.Encloses + (binaryEntropyRate (binaryParameter (shape 3 3 2) (shape 1 1 2))) := by + exact contains_sound (Ball.add_sound (Ball.add_sound B3_3_2U1_1_2EOneD_sound B3_3_2U1_1_2ED_sound) + (Ball.mul_sound B3_3_2U1_1_2D_sound logN2_sound)) (by decide +kernel) +def B3_3_2U1_1_2Leaf : Ball := ⟨(15780892807757089675042853684627 / 5000000000000000000000000000000), (124580165937 / 100000000000000000000000000000000)⟩ +lemma B3_3_2U1_1_2Leaf_sound : B3_3_2U1_1_2Leaf.Encloses (AllFieldTerminalRates.secondLeafRate (shape 3 3 2) (shape 1 1 2)) := by + have hh : shapeMax (shape 1 1 2) = 2 := by decide +kernel + have hp : positive (shape 1 1 2) = true := by decide +kernel + simp only [AllFieldTerminalRates.secondLeafRate, hh, hp, Bool.not_true, Bool.false_eq_true, + show (2 : ℕ) ≠ 4 by decide, show (2 : ℕ) ≠ 3 by decide, ite_false] + have ht : (Ball.exact (490261 / 250000)).Encloses (2 - (binaryParameter (shape 3 3 2) (shape 1 1 2) : ℝ)) := by + have he : binaryParameter (shape 3 3 2) (shape 1 1 2) = (9739 / 250000) := by decide +kernel + rw [he] + convert Ball.exact_sound ((490261 / 250000) : ℚ) using 1 + norm_num [Ball.exact] + exact contains_sound (Ball.mul_sound ht logN5_sound) (by decide +kernel) +def B3_3_2U1_1_2Mass : Ball := ⟨(897878186940305685491830221689 / 25000000000000000000000000000000), (47 / 100000000000000000000000000000000)⟩ +lemma B3_3_2U1_1_2Mass_sound : B3_3_2U1_1_2Mass.Encloses (littleMass (shape 3 3 2) (shape 1 1 2) : ℝ) := by + rw [littleMass_cast] + exact contains_sound (Ball.mul_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) (second_3_3_2)) + (B3_3_2Law_sound (shape 1 1 2))) (by decide +kernel) +def B3_3_2U1_2_1D : Ball := .exact (1219 / 250000) +lemma B3_3_2U1_2_1D_sound : B3_3_2U1_2_1D.Encloses (binaryParameter (shape 3 3 2) (shape 1 2 1) : ℝ) := by + apply exact_rat_enclosed + decide +kernel +def B3_3_2U1_2_1OneD : Ball := .exact (248781 / 250000) +lemma B3_3_2U1_2_1OneD_sound : B3_3_2U1_2_1OneD.Encloses (1 - (binaryParameter (shape 3 3 2) (shape 1 2 1) : ℝ)) := by + have he : binaryParameter (shape 3 3 2) (shape 1 2 1) = (1219 / 250000) := by decide +kernel + rw [he] + convert Ball.exact_sound ((248781 / 250000) : ℚ) using 1 <;> norm_num [B3_3_2U1_2_1OneD, Ball.exact] +def B3_3_2U1_2_1EDLogWitness : LogWitness := ⟨-8, 19504, 15625⟩ +def B3_3_2U1_2_1EDLog : Ball := ⟨(-133085751684077799008056524667789 / 25000000000000000000000000000000), (190582413147 / 100000000000000000000000000000000)⟩ +lemma B3_3_2U1_2_1EDLog_sound : B3_3_2U1_2_1EDLog.Encloses (Real.log ((binaryParameter (shape 3 3 2) (shape 1 2 1) : ℝ))) := by + exact checkLog_sound logTwoBall_sound (B3_3_2U1_2_1D_sound) (w := B3_3_2U1_2_1EDLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def B3_3_2U1_2_1ED : Ball := ⟨(2595704500846253391853134457121 / 100000000000000000000000000000000), (929279847 / 100000000000000000000000000000000)⟩ +lemma B3_3_2U1_2_1ED_sound : B3_3_2U1_2_1ED.Encloses (Foundation.entropyTerm ((binaryParameter (shape 3 3 2) (shape 1 2 1) : ℝ))) := by + exact contains_sound (entropyTerm_ball (B3_3_2U1_2_1D_sound) B3_3_2U1_2_1EDLog_sound) (by decide +kernel) +def B3_3_2U1_2_1EOneDLogWitness : LogWitness := ⟨-1, 248781, 125000⟩ +def B3_3_2U1_2_1EOneDLog : Ball := ⟨(-244396323639087523862893819551 / 50000000000000000000000000000000), (21175823683 / 50000000000000000000000000000000)⟩ +lemma B3_3_2U1_2_1EOneDLog_sound : B3_3_2U1_2_1EOneDLog.Encloses (Real.log ((1 - (binaryParameter (shape 3 3 2) (shape 1 2 1) : ℝ)))) := by + exact checkLog_sound logTwoBall_sound (B3_3_2U1_2_1OneD_sound) (w := B3_3_2U1_2_1EOneDLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def B3_3_2U1_2_1EOneD : Ball := ⟨(243204647165023333096538349287 / 50000000000000000000000000000000), (21072570367 / 50000000000000000000000000000000)⟩ +lemma B3_3_2U1_2_1EOneD_sound : B3_3_2U1_2_1EOneD.Encloses (Foundation.entropyTerm ((1 - (binaryParameter (shape 3 3 2) (shape 1 2 1) : ℝ)))) := by + exact contains_sound (entropyTerm_ball (B3_3_2U1_2_1OneD_sound) B3_3_2U1_2_1EOneDLog_sound) (by decide +kernel) +def B3_3_2U1_2_1BinaryEntropy : Ball := ⟨(213755772526083086932378340313 / 6250000000000000000000000000000), (21640463607 / 50000000000000000000000000000000)⟩ +lemma B3_3_2U1_2_1BinaryEntropy_sound : B3_3_2U1_2_1BinaryEntropy.Encloses + (binaryEntropyRate (binaryParameter (shape 3 3 2) (shape 1 2 1))) := by + exact contains_sound (Ball.add_sound (Ball.add_sound B3_3_2U1_2_1EOneD_sound B3_3_2U1_2_1ED_sound) + (Ball.mul_sound B3_3_2U1_2_1D_sound logN2_sound)) (by decide +kernel) +def B3_3_2U1_2_1Leaf : Ball := ⟨(160551410280358603788748230099313 / 50000000000000000000000000000000), (2534903643 / 2000000000000000000000000000000)⟩ +lemma B3_3_2U1_2_1Leaf_sound : B3_3_2U1_2_1Leaf.Encloses (AllFieldTerminalRates.secondLeafRate (shape 3 3 2) (shape 1 2 1)) := by + have hh : shapeMax (shape 1 2 1) = 2 := by decide +kernel + have hp : positive (shape 1 2 1) = true := by decide +kernel + simp only [AllFieldTerminalRates.secondLeafRate, hh, hp, Bool.not_true, Bool.false_eq_true, + show (2 : ℕ) ≠ 4 by decide, show (2 : ℕ) ≠ 3 by decide, ite_false] + have ht : (Ball.exact (498781 / 250000)).Encloses (2 - (binaryParameter (shape 3 3 2) (shape 1 2 1) : ℝ)) := by + have he : binaryParameter (shape 3 3 2) (shape 1 2 1) = (1219 / 250000) := by decide +kernel + rw [he] + convert Ball.exact_sound ((498781 / 250000) : ℚ) using 1 + norm_num [Ball.exact] + exact contains_sound (Ball.mul_sound ht logN5_sound) (by decide +kernel) +def B3_3_2U1_2_1Mass : Ball := ⟨(6962742902874551343715804077263 / 100000000000000000000000000000000), (81 / 100000000000000000000000000000000)⟩ +lemma B3_3_2U1_2_1Mass_sound : B3_3_2U1_2_1Mass.Encloses (littleMass (shape 3 3 2) (shape 1 2 1) : ℝ) := by + rw [littleMass_cast] + exact contains_sound (Ball.mul_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) (second_3_3_2)) + (B3_3_2Law_sound (shape 1 2 1))) (by decide +kernel) +def B3_3_2U1_3_0Leaf : Ball := ⟨(115129254649702284200899544090987 / 50000000000000000000000000000000), (21175823683 / 25000000000000000000000000000000)⟩ +lemma B3_3_2U1_3_0Leaf_sound : B3_3_2U1_3_0Leaf.Encloses (AllFieldTerminalRates.secondLeafRate (shape 3 3 2) (shape 1 3 0)) := by + have hh : shapeMax (shape 1 3 0) = 3 := by decide +kernel + simp only [AllFieldTerminalRates.secondLeafRate, hh, show (3 : ℕ) ≠ 4 by decide, ite_false, ite_true] + exact logN10_sound +def B3_3_2U1_3_0Mass : Ball := ⟨(257347875542098689266630589041 / 100000000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ +lemma B3_3_2U1_3_0Mass_sound : B3_3_2U1_3_0Mass.Encloses (littleMass (shape 3 3 2) (shape 1 3 0) : ℝ) := by + rw [littleMass_cast] + exact contains_sound (Ball.mul_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) (second_3_3_2)) + (B3_3_2Law_sound (shape 1 3 0))) (by decide +kernel) +def B3_3_2U2_0_2D : Ball := .exact (20479 / 200000) +lemma B3_3_2U2_0_2D_sound : B3_3_2U2_0_2D.Encloses (binaryParameter (shape 3 3 2) (shape 2 0 2) : ℝ) := by + apply exact_rat_enclosed + decide +kernel +def B3_3_2U2_0_2OneD : Ball := .exact (179521 / 200000) +lemma B3_3_2U2_0_2OneD_sound : B3_3_2U2_0_2OneD.Encloses (1 - (binaryParameter (shape 3 3 2) (shape 2 0 2) : ℝ)) := by + have he : binaryParameter (shape 3 3 2) (shape 2 0 2) = (20479 / 200000) := by decide +kernel + rw [he] + convert Ball.exact_sound ((179521 / 200000) : ℚ) using 1 <;> norm_num [B3_3_2U2_0_2OneD, Ball.exact] +def B3_3_2U2_0_2EDLogWitness : LogWitness := ⟨-4, 20479, 12500⟩ +def B3_3_2U2_0_2EDLog : Ball := ⟨(-45578347913877226878717459404093 / 20000000000000000000000000000000), (21175823683 / 20000000000000000000000000000000)⟩ +lemma B3_3_2U2_0_2EDLog_sound : B3_3_2U2_0_2EDLog.Encloses (Real.log ((binaryParameter (shape 3 3 2) (shape 2 0 2) : ℝ))) := by + exact checkLog_sound logTwoBall_sound (B3_3_2U2_0_2D_sound) (w := B3_3_2U2_0_2EDLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def B3_3_2U2_0_2ED : Ball := ⟨(23334974673207293231231371278411 / 100000000000000000000000000000000), (10841492331 / 100000000000000000000000000000000)⟩ +lemma B3_3_2U2_0_2ED_sound : B3_3_2U2_0_2ED.Encloses (Foundation.entropyTerm ((binaryParameter (shape 3 3 2) (shape 2 0 2) : ℝ))) := by + exact contains_sound (entropyTerm_ball (B3_3_2U2_0_2D_sound) B3_3_2U2_0_2EDLog_sound) (by decide +kernel) +def B3_3_2U2_0_2EOneDLogWitness : LogWitness := ⟨-1, 179521, 100000⟩ +def B3_3_2U2_0_2EOneDLog : Ball := ⟨(-10802517381923768407763481952009 / 100000000000000000000000000000000), (21175823683 / 50000000000000000000000000000000)⟩ +lemma B3_3_2U2_0_2EOneDLog_sound : B3_3_2U2_0_2EOneDLog.Encloses (Real.log ((1 - (binaryParameter (shape 3 3 2) (shape 2 0 2) : ℝ)))) := by + exact checkLog_sound logTwoBall_sound (B3_3_2U2_0_2OneD_sound) (w := B3_3_2U2_0_2EOneDLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def B3_3_2U2_0_2EOneD : Ball := ⟨(9696393614601684141650540217533 / 100000000000000000000000000000000), (19007525217 / 50000000000000000000000000000000)⟩ +lemma B3_3_2U2_0_2EOneD_sound : B3_3_2U2_0_2EOneD.Encloses (Foundation.entropyTerm ((1 - (binaryParameter (shape 3 3 2) (shape 2 0 2) : ℝ)))) := by + exact contains_sound (entropyTerm_ball (B3_3_2U2_0_2OneD_sound) B3_3_2U2_0_2EOneDLog_sound) (by decide +kernel) +def B3_3_2U2_0_2BinaryEntropy : Ball := ⟨(40128848843152537368659657848333 / 100000000000000000000000000000000), (26596569849 / 50000000000000000000000000000000)⟩ +lemma B3_3_2U2_0_2BinaryEntropy_sound : B3_3_2U2_0_2BinaryEntropy.Encloses + (binaryEntropyRate (binaryParameter (shape 3 3 2) (shape 2 0 2))) := by + exact contains_sound (Ball.add_sound (Ball.add_sound B3_3_2U2_0_2EOneD_sound B3_3_2U2_0_2ED_sound) + (Ball.mul_sound B3_3_2U2_0_2D_sound logN2_sound)) (by decide +kernel) +def B3_3_2U2_0_2Leaf : Ball := ⟨(82264188080308667679340626386903 / 25000000000000000000000000000000), (167238291001 / 100000000000000000000000000000000)⟩ +lemma B3_3_2U2_0_2Leaf_sound : B3_3_2U2_0_2Leaf.Encloses (AllFieldTerminalRates.secondLeafRate (shape 3 3 2) (shape 2 0 2)) := by + have hh : shapeMax (shape 2 0 2) = 2 := by decide +kernel + have hp : positive (shape 2 0 2) = false := by decide +kernel + simp only [AllFieldTerminalRates.secondLeafRate, hh, hp, Bool.not_false, + show (2 : ℕ) ≠ 4 by decide, show (2 : ℕ) ≠ 3 by decide, ite_false, ite_true] + exact contains_sound (Ball.add_sound B3_3_2U2_0_2BinaryEntropy_sound + (Ball.mul_sound (Ball.mul_sound (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) + B3_3_2U2_0_2OneD_sound) logN5_sound)) (by decide +kernel) +def B3_3_2U2_0_2Mass : Ball := ⟨(257347875542098689266630589041 / 100000000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ +lemma B3_3_2U2_0_2Mass_sound : B3_3_2U2_0_2Mass.Encloses (littleMass (shape 3 3 2) (shape 2 0 2) : ℝ) := by + rw [littleMass_cast] + exact contains_sound (Ball.mul_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) (second_3_3_2)) + (B3_3_2Law_sound (shape 2 0 2))) (by decide +kernel) +def B3_3_2U2_1_1D : Ball := .exact (21083 / 500000) +lemma B3_3_2U2_1_1D_sound : B3_3_2U2_1_1D.Encloses (binaryParameter (shape 3 3 2) (shape 2 1 1) : ℝ) := by + apply exact_rat_enclosed + decide +kernel +def B3_3_2U2_1_1OneD : Ball := .exact (478917 / 500000) +lemma B3_3_2U2_1_1OneD_sound : B3_3_2U2_1_1OneD.Encloses (1 - (binaryParameter (shape 3 3 2) (shape 2 1 1) : ℝ)) := by + have he : binaryParameter (shape 3 3 2) (shape 2 1 1) = (21083 / 500000) := by decide +kernel + rw [he] + convert Ball.exact_sound ((478917 / 500000) : ℚ) using 1 <;> norm_num [B3_3_2U2_1_1OneD, Ball.exact] +def B3_3_2U2_1_1EDLogWitness : LogWitness := ⟨-5, 21083, 15625⟩ +def B3_3_2U2_1_1EDLog : Ball := ⟨(-63322821397686708031899813013369 / 20000000000000000000000000000000), (63527471049 / 50000000000000000000000000000000)⟩ +lemma B3_3_2U2_1_1EDLog_sound : B3_3_2U2_1_1EDLog.Encloses (Real.log ((binaryParameter (shape 3 3 2) (shape 2 1 1) : ℝ))) := by + exact checkLog_sound logTwoBall_sound (B3_3_2U2_1_1D_sound) (w := B3_3_2U2_1_1EDLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def B3_3_2U2_1_1ED : Ball := ⟨(13350350435274288654365437577609 / 100000000000000000000000000000000), (5357398689 / 100000000000000000000000000000000)⟩ +lemma B3_3_2U2_1_1ED_sound : B3_3_2U2_1_1ED.Encloses (Foundation.entropyTerm ((binaryParameter (shape 3 3 2) (shape 2 1 1) : ℝ))) := by + exact contains_sound (entropyTerm_ball (B3_3_2U2_1_1D_sound) B3_3_2U2_1_1EDLog_sound) (by decide +kernel) +def B3_3_2U2_1_1EOneDLogWitness : LogWitness := ⟨-1, 478917, 250000⟩ +def B3_3_2U2_1_1EOneDLog : Ball := ⟨(-67313740136531887218517535329 / 1562500000000000000000000000000), (21175823683 / 50000000000000000000000000000000)⟩ +lemma B3_3_2U2_1_1EOneDLog_sound : B3_3_2U2_1_1EOneDLog.Encloses (Real.log ((1 - (binaryParameter (shape 3 3 2) (shape 2 1 1) : ℝ)))) := by + exact checkLog_sound logTwoBall_sound (B3_3_2U2_1_1OneD_sound) (w := B3_3_2U2_1_1EOneDLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def B3_3_2U2_1_1EOneD : Ball := ⟨(1031606223518958138592984398949 / 25000000000000000000000000000000), (10141461951 / 25000000000000000000000000000000)⟩ +lemma B3_3_2U2_1_1EOneD_sound : B3_3_2U2_1_1EOneD.Encloses (Foundation.entropyTerm ((1 - (binaryParameter (shape 3 3 2) (shape 2 1 1) : ℝ)))) := by + exact contains_sound (entropyTerm_ball (B3_3_2U2_1_1OneD_sound) B3_3_2U2_1_1EOneDLog_sound) (by decide +kernel) +def B3_3_2U2_1_1BinaryEntropy : Ball := ⟨(4079899946179837320085215066313 / 20000000000000000000000000000000), (47709046057 / 100000000000000000000000000000000)⟩ +lemma B3_3_2U2_1_1BinaryEntropy_sound : B3_3_2U2_1_1BinaryEntropy.Encloses + (binaryEntropyRate (binaryParameter (shape 3 3 2) (shape 2 1 1))) := by + exact contains_sound (Ball.add_sound (Ball.add_sound B3_3_2U2_1_1EOneD_sound B3_3_2U2_1_1ED_sound) + (Ball.mul_sound B3_3_2U2_1_1D_sound logN2_sound)) (by decide +kernel) +def B3_3_2U2_1_1Leaf : Ball := ⟨(315101226585250447280610230069167 / 100000000000000000000000000000000), (62188121377 / 50000000000000000000000000000000)⟩ +lemma B3_3_2U2_1_1Leaf_sound : B3_3_2U2_1_1Leaf.Encloses (AllFieldTerminalRates.secondLeafRate (shape 3 3 2) (shape 2 1 1)) := by + have hh : shapeMax (shape 2 1 1) = 2 := by decide +kernel + have hp : positive (shape 2 1 1) = true := by decide +kernel + simp only [AllFieldTerminalRates.secondLeafRate, hh, hp, Bool.not_true, Bool.false_eq_true, + show (2 : ℕ) ≠ 4 by decide, show (2 : ℕ) ≠ 3 by decide, ite_false] + have ht : (Ball.exact (978917 / 500000)).Encloses (2 - (binaryParameter (shape 3 3 2) (shape 2 1 1) : ℝ)) := by + have he : binaryParameter (shape 3 3 2) (shape 2 1 1) = (21083 / 500000) := by decide +kernel + rw [he] + convert Ball.exact_sound ((978917 / 500000) : ℚ) using 1 + norm_num [Ball.exact] + exact contains_sound (Ball.mul_sound ht logN5_sound) (by decide +kernel) +def B3_3_2U2_1_1Mass : Ball := ⟨(6962742902874551343715804077263 / 100000000000000000000000000000000), (81 / 100000000000000000000000000000000)⟩ +lemma B3_3_2U2_1_1Mass_sound : B3_3_2U2_1_1Mass.Encloses (littleMass (shape 3 3 2) (shape 2 1 1) : ℝ) := by + rw [littleMass_cast] + exact contains_sound (Ball.mul_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) (second_3_3_2)) + (B3_3_2Law_sound (shape 2 1 1))) (by decide +kernel) +def B3_3_2U2_2_0D : Ball := .exact (27517 / 250000) +lemma B3_3_2U2_2_0D_sound : B3_3_2U2_2_0D.Encloses (binaryParameter (shape 3 3 2) (shape 2 2 0) : ℝ) := by + apply exact_rat_enclosed + decide +kernel +def B3_3_2U2_2_0OneD : Ball := .exact (222483 / 250000) +lemma B3_3_2U2_2_0OneD_sound : B3_3_2U2_2_0OneD.Encloses (1 - (binaryParameter (shape 3 3 2) (shape 2 2 0) : ℝ)) := by + have he : binaryParameter (shape 3 3 2) (shape 2 2 0) = (27517 / 250000) := by decide +kernel + rw [he] + convert Ball.exact_sound ((222483 / 250000) : ℚ) using 1 <;> norm_num [B3_3_2U2_2_0OneD, Ball.exact] +def B3_3_2U2_2_0EDLogWitness : LogWitness := ⟨-4, 27517, 15625⟩ +def B3_3_2U2_2_0EDLog : Ball := ⟨(-220665692236720985729493316733689 / 100000000000000000000000000000000), (21175823683 / 20000000000000000000000000000000)⟩ +lemma B3_3_2U2_2_0EDLog_sound : B3_3_2U2_2_0EDLog.Encloses (Real.log ((binaryParameter (shape 3 3 2) (shape 2 2 0) : ℝ))) := by + exact checkLog_sound logTwoBall_sound (B3_3_2U2_2_0D_sound) (w := B3_3_2U2_2_0EDLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def B3_3_2U2_2_0ED : Ball := ⟨(6072057853277851364318467596561 / 25000000000000000000000000000000), (11653902807 / 100000000000000000000000000000000)⟩ +lemma B3_3_2U2_2_0ED_sound : B3_3_2U2_2_0ED.Encloses (Foundation.entropyTerm ((binaryParameter (shape 3 3 2) (shape 2 2 0) : ℝ))) := by + exact contains_sound (entropyTerm_ball (B3_3_2U2_2_0D_sound) B3_3_2U2_2_0EDLog_sound) (by decide +kernel) +def B3_3_2U2_2_0EOneDLogWitness : LogWitness := ⟨-1, 222483, 125000⟩ +def B3_3_2U2_2_0EOneDLog : Ball := ⟨(-5830511183465280787305887930417 / 50000000000000000000000000000000), (8470329473 / 20000000000000000000000000000000)⟩ +lemma B3_3_2U2_2_0EOneDLog_sound : B3_3_2U2_2_0EOneDLog.Encloses (Real.log ((1 - (binaryParameter (shape 3 3 2) (shape 2 2 0) : ℝ)))) := by + exact checkLog_sound logTwoBall_sound (B3_3_2U2_2_0OneD_sound) (w := B3_3_2U2_2_0EOneDLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def B3_3_2U2_2_0EOneD : Ball := ⟨(1297189619630906065402175864423 / 12500000000000000000000000000000), (9422521561 / 25000000000000000000000000000000)⟩ +lemma B3_3_2U2_2_0EOneD_sound : B3_3_2U2_2_0EOneD.Encloses (Foundation.entropyTerm ((1 - (binaryParameter (shape 3 3 2) (shape 2 2 0) : ℝ)))) := by + exact contains_sound (entropyTerm_ball (B3_3_2U2_2_0OneD_sound) B3_3_2U2_2_0EOneDLog_sound) (by decide +kernel) +def B3_3_2U2_2_0BinaryEntropy : Ball := ⟨(10573770189286465003046216428573 / 25000000000000000000000000000000), (27002775087 / 50000000000000000000000000000000)⟩ +lemma B3_3_2U2_2_0BinaryEntropy_sound : B3_3_2U2_2_0BinaryEntropy.Encloses + (binaryEntropyRate (binaryParameter (shape 3 3 2) (shape 2 2 0))) := by + exact contains_sound (Ball.add_sound (Ball.add_sound B3_3_2U2_2_0EOneD_sound B3_3_2U2_2_0ED_sound) + (Ball.mul_sound B3_3_2U2_2_0D_sound logN2_sound)) (by decide +kernel) +def B3_3_2U2_2_0Leaf : Ball := ⟨(2054707130092541393287658679543 / 625000000000000000000000000000), (83537904453 / 50000000000000000000000000000000)⟩ +lemma B3_3_2U2_2_0Leaf_sound : B3_3_2U2_2_0Leaf.Encloses (AllFieldTerminalRates.secondLeafRate (shape 3 3 2) (shape 2 2 0)) := by + have hh : shapeMax (shape 2 2 0) = 2 := by decide +kernel + have hp : positive (shape 2 2 0) = false := by decide +kernel + simp only [AllFieldTerminalRates.secondLeafRate, hh, hp, Bool.not_false, + show (2 : ℕ) ≠ 4 by decide, show (2 : ℕ) ≠ 3 by decide, ite_false, ite_true] + exact contains_sound (Ball.add_sound B3_3_2U2_2_0BinaryEntropy_sound + (Ball.mul_sound (Ball.mul_sound (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) + B3_3_2U2_2_0OneD_sound) logN5_sound)) (by decide +kernel) +def B3_3_2U2_2_0Mass : Ball := ⟨(897878186940305685491830221689 / 25000000000000000000000000000000), (47 / 100000000000000000000000000000000)⟩ +lemma B3_3_2U2_2_0Mass_sound : B3_3_2U2_2_0Mass.Encloses (littleMass (shape 3 3 2) (shape 2 2 0) : ℝ) := by + rw [littleMass_cast] + exact contains_sound (Ball.mul_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) (second_3_3_2)) + (B3_3_2Law_sound (shape 2 2 0))) (by decide +kernel) +def B3_3_2U3_0_1Leaf : Ball := ⟨(115129254649702284200899544090987 / 50000000000000000000000000000000), (21175823683 / 25000000000000000000000000000000)⟩ +lemma B3_3_2U3_0_1Leaf_sound : B3_3_2U3_0_1Leaf.Encloses (AllFieldTerminalRates.secondLeafRate (shape 3 3 2) (shape 3 0 1)) := by + have hh : shapeMax (shape 3 0 1) = 3 := by decide +kernel + simp only [AllFieldTerminalRates.secondLeafRate, hh, show (3 : ℕ) ≠ 4 by decide, ite_false, ite_true] + exact logN10_sound +def B3_3_2U3_0_1Mass : Ball := ⟨(7163443911078640424744493343 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ +lemma B3_3_2U3_0_1Mass_sound : B3_3_2U3_0_1Mass.Encloses (littleMass (shape 3 3 2) (shape 3 0 1) : ℝ) := by + rw [littleMass_cast] + exact contains_sound (Ball.mul_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) (second_3_3_2)) + (B3_3_2Law_sound (shape 3 0 1))) (by decide +kernel) +def B3_3_2U3_1_0Leaf : Ball := ⟨(115129254649702284200899544090987 / 50000000000000000000000000000000), (21175823683 / 25000000000000000000000000000000)⟩ +lemma B3_3_2U3_1_0Leaf_sound : B3_3_2U3_1_0Leaf.Encloses (AllFieldTerminalRates.secondLeafRate (shape 3 3 2) (shape 3 1 0)) := by + have hh : shapeMax (shape 3 1 0) = 3 := by decide +kernel + simp only [AllFieldTerminalRates.secondLeafRate, hh, show (3 : ℕ) ≠ 4 by decide, ite_false, ite_true] + exact logN10_sound +def B3_3_2U3_1_0Mass : Ball := ⟨(257837301312875337408670808073 / 100000000000000000000000000000000), (1 / 20000000000000000000000000000000)⟩ +lemma B3_3_2U3_1_0Mass_sound : B3_3_2U3_1_0Mass.Encloses (littleMass (shape 3 3 2) (shape 3 1 0) : ℝ) := by + rw [littleMass_cast] + exact contains_sound (Ball.mul_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) (second_3_3_2)) + (B3_3_2Law_sound (shape 3 1 0))) (by decide +kernel) +def B3_3_2Leaves (s : Shape) : Ball := + match s 0, s 1, s 2 with + | 0, 2, 2 => B3_3_2U0_2_2Leaf + | 0, 3, 1 => B3_3_2U0_3_1Leaf + | 1, 1, 2 => B3_3_2U1_1_2Leaf + | 1, 2, 1 => B3_3_2U1_2_1Leaf + | 1, 3, 0 => B3_3_2U1_3_0Leaf + | 2, 0, 2 => B3_3_2U2_0_2Leaf + | 2, 1, 1 => B3_3_2U2_1_1Leaf + | 2, 2, 0 => B3_3_2U2_2_0Leaf + | 3, 0, 1 => B3_3_2U3_0_1Leaf + | 3, 1, 0 => B3_3_2U3_1_0Leaf + | _, _, _ => (.exact 0) +lemma B3_3_2Leaves_sound (u : Shape) (hu : u ∈ below (shape 3 3 2)) : + (B3_3_2Leaves u).Encloses (AllFieldTerminalRates.secondLeafRate (shape 3 3 2) u) := by + rw [B3_3_2_below] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl + · exact B3_3_2U0_2_2Leaf_sound + · exact B3_3_2U0_3_1Leaf_sound + · exact B3_3_2U1_1_2Leaf_sound + · exact B3_3_2U1_2_1Leaf_sound + · exact B3_3_2U1_3_0Leaf_sound + · exact B3_3_2U2_0_2Leaf_sound + · exact B3_3_2U2_1_1Leaf_sound + · exact B3_3_2U2_2_0Leaf_sound + · exact B3_3_2U3_0_1Leaf_sound + · exact B3_3_2U3_1_0Leaf_sound +def B3_3_2Masses (s : Shape) : Ball := + match s 0, s 1, s 2 with + | 0, 2, 2 => B3_3_2U0_2_2Mass + | 0, 3, 1 => B3_3_2U0_3_1Mass + | 1, 1, 2 => B3_3_2U1_1_2Mass + | 1, 2, 1 => B3_3_2U1_2_1Mass + | 1, 3, 0 => B3_3_2U1_3_0Mass + | 2, 0, 2 => B3_3_2U2_0_2Mass + | 2, 1, 1 => B3_3_2U2_1_1Mass + | 2, 2, 0 => B3_3_2U2_2_0Mass + | 3, 0, 1 => B3_3_2U3_0_1Mass + | 3, 1, 0 => B3_3_2U3_1_0Mass + | _, _, _ => (.exact 0) +lemma B3_3_2Masses_sound (u : Shape) (hu : u ∈ below (shape 3 3 2)) : + (B3_3_2Masses u).Encloses ((fun u => (littleMass (shape 3 3 2) u : ℝ)) u) := by + rw [B3_3_2_below] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl + · exact B3_3_2U0_2_2Mass_sound + · exact B3_3_2U0_3_1Mass_sound + · exact B3_3_2U1_1_2Mass_sound + · exact B3_3_2U1_2_1Mass_sound + · exact B3_3_2U1_3_0Mass_sound + · exact B3_3_2U2_0_2Mass_sound + · exact B3_3_2U2_1_1Mass_sound + · exact B3_3_2U2_2_0Mass_sound + · exact B3_3_2U3_0_1Mass_sound + · exact B3_3_2U3_1_0Mass_sound +def B3_3_2Binaries (s : Shape) : Ball := + match s 0, s 1, s 2 with + | 0, 2, 2 => B3_3_2U0_2_2BinaryEntropy + | 1, 1, 2 => B3_3_2U1_1_2BinaryEntropy + | 1, 2, 1 => B3_3_2U1_2_1BinaryEntropy + | 2, 0, 2 => B3_3_2U2_0_2BinaryEntropy + | 2, 1, 1 => B3_3_2U2_1_1BinaryEntropy + | 2, 2, 0 => B3_3_2U2_2_0BinaryEntropy + | _, _, _ => (.exact 0) +lemma B3_3_2Binaries_sound (u : Shape) (hu : u ∈ (below (shape 3 3 2)).filter positive) : + (B3_3_2Binaries u).Encloses ((fun u => binaryEntropyRate (binaryParameter (shape 3 3 2) u)) u) := by + have hl : (below (shape 3 3 2)).filter positive = [(shape 1 1 2), (shape 1 2 1), (shape 2 1 1)] := by decide +kernel + rw [hl] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl + · exact B3_3_2U1_1_2BinaryEntropy_sound + · exact B3_3_2U1_2_1BinaryEntropy_sound + · exact B3_3_2U2_1_1BinaryEntropy_sound +def B3_3_2S2 : Ball := ⟨(70486191644416634713605546718153 / 100000000000000000000000000000000), (14659169619 / 50000000000000000000000000000000)⟩ +lemma B3_3_2S2_sound : B3_3_2S2.Encloses + (((below (shape 3 3 2)).map fun u => (littleMass (shape 3 3 2) u : ℝ) * AllFieldTerminalRates.secondLeafRate (shape 3 3 2) u).sum) := by + exact contains_sound (listSumBall_sound (below (shape 3 3 2)) + (fun u => .mul (B3_3_2Masses u) (B3_3_2Leaves u)) _ + (fun u hu => Ball.mul_sound (B3_3_2Masses_sound u hu) (B3_3_2Leaves_sound u hu))) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/Certificates/Terminal3_4_1.lean b/lean/OAI/LinearAlgebra/MatrixFields/Certificates/Terminal3_4_1.lean new file mode 100644 index 0000000000000000000000000000000000000000..44b88a3f1de86fb80877412de72d228adc697d1c --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/Certificates/Terminal3_4_1.lean @@ -0,0 +1,598 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Certificates.LittleB1_3_4 +import OAI.LinearAlgebra.MatrixFields.Certificates.Terminal1_1_6 + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate +open scoped BigOperators +lemma B3_4_1_below : below (shape 3 4 1) = [ + (shape 0 3 1), + (shape 0 4 0), + (shape 1 2 1), + (shape 1 3 0), + (shape 2 1 1), + (shape 2 2 0), + (shape 3 0 1), + (shape 3 1 0)] := by decide +kernel +def B3_4_1Raw (s : Shape) : Ball := + match s 0, s 1, s 2 with + | 0, 3, 1 => ⟨(38409269753660833180056353669 / 1250000000000000000000000000000), (9 / 100000000000000000000000000000000)⟩ + | 0, 4, 0 => ⟨(15831277194442435596433763391 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 1, 2, 1 => ⟨1, 0⟩ + | 1, 3, 0 => ⟨(7793756819393451250565121368561 / 50000000000000000000000000000000), (19 / 100000000000000000000000000000000)⟩ + | 2, 1, 1 => ⟨(7793756819393451250565121368561 / 50000000000000000000000000000000), (19 / 100000000000000000000000000000000)⟩ + | 2, 2, 0 => ⟨1, 0⟩ + | 3, 0, 1 => ⟨(15831277194442435596433763391 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 3, 1, 0 => ⟨(38409269753660833180056353669 / 1250000000000000000000000000000), (9 / 100000000000000000000000000000000)⟩ + | _, _, _ => (.exact 0) +lemma B3_4_1Raw_0_3_1 : (B3_4_1Raw (shape 0 3 1)).Encloses (splitWeight positiveSecond tablep (shape 3 4 1) (shape 0 3 1) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveSecond tablep (shape 3 4 1) (shape 0 3 1) + (-16239) (-18587) (0) w107 w91 w195 + (by decide +kernel) w107_sound w91_sound w195_sound) (by decide +kernel) +lemma B3_4_1Raw_0_4_0 : (B3_4_1Raw (shape 0 4 0)).Encloses (splitWeight positiveSecond tablep (shape 3 4 1) (shape 0 4 0) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveSecond tablep (shape 3 4 1) (shape 0 4 0) + (-16239) (-55176) (0) w107 w29 w195 + (by decide +kernel) w107_sound w29_sound w195_sound) (by decide +kernel) +lemma B3_4_1Raw_1_2_1 : (B3_4_1Raw (shape 1 2 1)).Encloses (splitWeight positiveSecond tablep (shape 3 4 1) (shape 1 2 1) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveSecond tablep (shape 3 4 1) (shape 1 2 1) + (0) (0) (0) w195 w195 w195 + (by decide +kernel) w195_sound w195_sound w195_sound) (by decide +kernel) +lemma B3_4_1Raw_1_3_0 : (B3_4_1Raw (shape 1 3 0)).Encloses (splitWeight positiveSecond tablep (shape 3 4 1) (shape 1 3 0) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveSecond tablep (shape 3 4 1) (shape 1 3 0) + (0) (-18587) (0) w195 w91 w195 + (by decide +kernel) w195_sound w91_sound w195_sound) (by decide +kernel) +lemma B3_4_1Raw_2_1_1 : (B3_4_1Raw (shape 2 1 1)).Encloses (splitWeight positiveSecond tablep (shape 3 4 1) (shape 2 1 1) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveSecond tablep (shape 3 4 1) (shape 2 1 1) + (0) (-18587) (0) w195 w91 w195 + (by decide +kernel) w195_sound w91_sound w195_sound) (by decide +kernel) +lemma B3_4_1Raw_2_2_0 : (B3_4_1Raw (shape 2 2 0)).Encloses (splitWeight positiveSecond tablep (shape 3 4 1) (shape 2 2 0) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveSecond tablep (shape 3 4 1) (shape 2 2 0) + (0) (0) (0) w195 w195 w195 + (by decide +kernel) w195_sound w195_sound w195_sound) (by decide +kernel) +lemma B3_4_1Raw_3_0_1 : (B3_4_1Raw (shape 3 0 1)).Encloses (splitWeight positiveSecond tablep (shape 3 4 1) (shape 3 0 1) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveSecond tablep (shape 3 4 1) (shape 3 0 1) + (-16239) (-55176) (0) w107 w29 w195 + (by decide +kernel) w107_sound w29_sound w195_sound) (by decide +kernel) +lemma B3_4_1Raw_3_1_0 : (B3_4_1Raw (shape 3 1 0)).Encloses (splitWeight positiveSecond tablep (shape 3 4 1) (shape 3 1 0) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveSecond tablep (shape 3 4 1) (shape 3 1 0) + (-16239) (-18587) (0) w107 w91 w195 + (by decide +kernel) w107_sound w91_sound w195_sound) (by decide +kernel) +lemma B3_4_1Raw_sound (u : Shape) (hu : u ∈ below (shape 3 4 1)) : + (B3_4_1Raw u).Encloses (splitWeight positiveSecond tablep (shape 3 4 1) u : ℝ) := by + rw [B3_4_1_below] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl + · exact B3_4_1Raw_0_3_1 + · exact B3_4_1Raw_0_4_0 + · exact B3_4_1Raw_1_2_1 + · exact B3_4_1Raw_1_3_0 + · exact B3_4_1Raw_2_1_1 + · exact B3_4_1Raw_2_2_0 + · exact B3_4_1Raw_3_0_1 + · exact B3_4_1Raw_3_1_0 +def B3_4_1Den : Ball := ⟨(118739411605051981333516919847597 / 50000000000000000000000000000000), (29 / 50000000000000000000000000000000)⟩ +lemma B3_4_1Den_sound : B3_4_1Den.Encloses (((below (shape 3 4 1)).map (splitWeight positiveSecond tablep (shape 3 4 1))).sum : ℝ) := by + exact contains_sound (list_cast_enclosed (below (shape 3 4 1)) B3_4_1Raw (splitWeight positiveSecond tablep (shape 3 4 1)) B3_4_1Raw_sound) (by decide +kernel) +lemma B3_4_1Den_positive : 0 < B3_4_1Den.lower := by decide +kernel +def B3_4_1Table (s : Shape) : Ball := + match s 0, s 1, s 2 with + | 0, 3, 1 => ⟨(80868831238226048857523902691 / 6250000000000000000000000000000), (1 / 20000000000000000000000000000000)⟩ + | 0, 4, 0 => ⟨(520812135624222942175390833 / 1562500000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 1, 2, 1 => ⟨(21054508913312090338702518135663 / 50000000000000000000000000000000), (11 / 100000000000000000000000000000000)⟩ + | 1, 3, 0 => ⟨(3281874448442126136287678136153 / 50000000000000000000000000000000), (1 / 10000000000000000000000000000000)⟩ + | 2, 1, 1 => ⟨(3281874448442126136287678136153 / 50000000000000000000000000000000), (1 / 10000000000000000000000000000000)⟩ + | 2, 2, 0 => ⟨(21054508913312090338702518135663 / 50000000000000000000000000000000), (11 / 100000000000000000000000000000000)⟩ + | 3, 0, 1 => ⟨(520812135624222942175390833 / 1562500000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 3, 1, 0 => ⟨(80868831238226048857523902691 / 6250000000000000000000000000000), (1 / 20000000000000000000000000000000)⟩ + | _, _, _ => (.exact 0) +def B3_4_1Law (u : Shape) : Ball := if u ∈ below (shape 3 4 1) then B3_4_1Table u else .exact 0 +lemma B3_4_1Law_check_0_3_1 : contains (.mul (B3_4_1Raw (shape 0 3 1)) (.inv B3_4_1Den)) (B3_4_1Table (shape 0 3 1)) = true := by decide +kernel +lemma B3_4_1Law_check_0_4_0 : contains (.mul (B3_4_1Raw (shape 0 4 0)) (.inv B3_4_1Den)) (B3_4_1Table (shape 0 4 0)) = true := by decide +kernel +lemma B3_4_1Law_check_1_2_1 : contains (.mul (B3_4_1Raw (shape 1 2 1)) (.inv B3_4_1Den)) (B3_4_1Table (shape 1 2 1)) = true := by decide +kernel +lemma B3_4_1Law_check_1_3_0 : contains (.mul (B3_4_1Raw (shape 1 3 0)) (.inv B3_4_1Den)) (B3_4_1Table (shape 1 3 0)) = true := by decide +kernel +lemma B3_4_1Law_check_2_1_1 : contains (.mul (B3_4_1Raw (shape 2 1 1)) (.inv B3_4_1Den)) (B3_4_1Table (shape 2 1 1)) = true := by decide +kernel +lemma B3_4_1Law_check_2_2_0 : contains (.mul (B3_4_1Raw (shape 2 2 0)) (.inv B3_4_1Den)) (B3_4_1Table (shape 2 2 0)) = true := by decide +kernel +lemma B3_4_1Law_check_3_0_1 : contains (.mul (B3_4_1Raw (shape 3 0 1)) (.inv B3_4_1Den)) (B3_4_1Table (shape 3 0 1)) = true := by decide +kernel +lemma B3_4_1Law_check_3_1_0 : contains (.mul (B3_4_1Raw (shape 3 1 0)) (.inv B3_4_1Den)) (B3_4_1Table (shape 3 1 0)) = true := by decide +kernel +lemma B3_4_1Law_check (u : Shape) (hu : u ∈ below (shape 3 4 1)) : + contains (.mul (B3_4_1Raw u) (.inv B3_4_1Den)) (B3_4_1Table u) = true := by + rw [B3_4_1_below] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl + · exact B3_4_1Law_check_0_3_1 + · exact B3_4_1Law_check_0_4_0 + · exact B3_4_1Law_check_1_2_1 + · exact B3_4_1Law_check_1_3_0 + · exact B3_4_1Law_check_2_1_1 + · exact B3_4_1Law_check_2_2_0 + · exact B3_4_1Law_check_3_0_1 + · exact B3_4_1Law_check_3_1_0 +lemma B3_4_1Law_sound (u : Shape) : + (B3_4_1Law u).Encloses (stageBLaw (shape 3 4 1) u : ℝ) := by + by_cases hu : u ∈ below (shape 3 4 1) + · have h := contains_sound (Ball.mul_sound (B3_4_1Raw_sound u hu) + (Ball.inv_sound B3_4_1Den_sound B3_4_1Den_positive)) (B3_4_1Law_check u hu) + simpa only [B3_4_1Law, hu, ite_true, stageBLaw, splitLaw, + Rat.cast_div, Rat.cast_mul, Rat.cast_inv, div_eq_mul_inv] using h + · simp only [B3_4_1Law, hu, ite_false, stageBLaw, splitLaw, Rat.cast_zero] + simpa only [Rat.cast_zero] using Ball.exact_sound 0 + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def B3_4_1Binary (u : Shape) : ℚ := + match u 0, u 1, u 2 with + | 1, 2, 1 => (2953 / 1000000) + | 2, 1, 1 => (21083 / 500000) + | 2, 2, 0 => (12 / 125) + | _, _, _ => 0 +lemma B3_4_1Binary_eq (u : Shape) (hu : u ∈ shapes 4) : + binaryParameter (shape 3 4 1) u = B3_4_1Binary u := by + rw [shapes4_list] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel +def B3_4_1LittleRat (u : Shape) (w : Fin 3) (i : Fin 6) : ℚ := + if u w = 2 then + if i = 2 then 1 - B3_4_1Binary u else if i = 3 then B3_4_1Binary u else 0 + else if i = singletonSlot (u w) then 1 else 0 + +def B3_4_1Little (u : Shape) (w : Fin 3) (i : Fin 6) : Ball := + if u ∈ shapes 4 then .exact (B3_4_1LittleRat u w i) + else .exact (littleLaw (shape 3 4 1) u w i) + +lemma B3_4_1Little_sound (u : Shape) (w : Fin 3) (i : Fin 6) : + (B3_4_1Little u w i).Encloses (littleLaw (shape 3 4 1) u w i : ℝ) := by + by_cases hu : u ∈ shapes 4 + · simp only [B3_4_1Little, hu, ite_true] + apply exact_rat_enclosed + simp only [B3_4_1LittleRat, littleLaw, B3_4_1Binary_eq u hu] + · simp only [B3_4_1Little, hu, ite_false] + exact Ball.exact_sound _ +def B3_4_1Half (w : Fin 3) (ij : PairSlot) : Ball := + match w.val, ij.1.val, ij.2.val with + | 0, 0, 4 => ⟨(82952079780722940626225466023 / 6250000000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ + | 0, 1, 2 => ⟨(44353533976166490223624096589007 / 100000000000000000000000000000000), (1 / 5000000000000000000000000000000)⟩ + | 0, 1, 3 => ⟨(34553861978735541810850367637 / 800000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ + | 0, 2, 1 => ⟨(44353533976166490223624096589007 / 100000000000000000000000000000000), (1 / 5000000000000000000000000000000)⟩ + | 0, 3, 1 => ⟨(34553861978735541810850367637 / 800000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ + | 0, 4, 0 => ⟨(82952079780722940626225466023 / 6250000000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ + | 1, 4, 1 => ⟨(3928825098347934527147869357681 / 50000000000000000000000000000000), (3 / 20000000000000000000000000000000)⟩ + | 1, 5, 0 => ⟨(520812135624222942175390833 / 1562500000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 1, 2, 2 => ⟨(9488535396717968040641412979023 / 12500000000000000000000000000000), (1 / 5000000000000000000000000000000)⟩ + | 1, 2, 3 => ⟨(517867354813334309888438519539 / 12500000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ + | 1, 3, 2 => ⟨(517867354813334309888438519539 / 12500000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ + | 1, 3, 3 => ⟨(4774960498253614292750479569 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 1, 1, 4 => ⟨(3928825098347934527147869357681 / 50000000000000000000000000000000), (3 / 20000000000000000000000000000000)⟩ + | 1, 0, 5 => ⟨(520812135624222942175390833 / 1562500000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 2, 1, 0 => ⟨(1 / 2), (27 / 100000000000000000000000000000000)⟩ + | 2, 0, 1 => ⟨(1 / 2), (27 / 100000000000000000000000000000000)⟩ + | _, _, _ => (.exact 0) +lemma B3_4_1Half_check_0_0 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 3 4 1)) (shape 3 4 1) B3_4_1Law + (fun u => B3_4_1Little u 0) ((0 : Fin 6),j)) (B3_4_1Half 0 (0,j)) = true := by + decide +kernel +lemma B3_4_1Half_check_0_1 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 3 4 1)) (shape 3 4 1) B3_4_1Law + (fun u => B3_4_1Little u 0) ((1 : Fin 6),j)) (B3_4_1Half 0 (1,j)) = true := by + decide +kernel +lemma B3_4_1Half_check_0_2 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 3 4 1)) (shape 3 4 1) B3_4_1Law + (fun u => B3_4_1Little u 0) ((2 : Fin 6),j)) (B3_4_1Half 0 (2,j)) = true := by + decide +kernel +lemma B3_4_1Half_check_0_3 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 3 4 1)) (shape 3 4 1) B3_4_1Law + (fun u => B3_4_1Little u 0) ((3 : Fin 6),j)) (B3_4_1Half 0 (3,j)) = true := by + decide +kernel +lemma B3_4_1Half_check_0_4 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 3 4 1)) (shape 3 4 1) B3_4_1Law + (fun u => B3_4_1Little u 0) ((4 : Fin 6),j)) (B3_4_1Half 0 (4,j)) = true := by + decide +kernel +lemma B3_4_1Half_check_0_5 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 3 4 1)) (shape 3 4 1) B3_4_1Law + (fun u => B3_4_1Little u 0) ((5 : Fin 6),j)) (B3_4_1Half 0 (5,j)) = true := by + decide +kernel +lemma B3_4_1Half_check_1_0 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 3 4 1)) (shape 3 4 1) B3_4_1Law + (fun u => B3_4_1Little u 1) ((0 : Fin 6),j)) (B3_4_1Half 1 (0,j)) = true := by + decide +kernel +lemma B3_4_1Half_check_1_1 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 3 4 1)) (shape 3 4 1) B3_4_1Law + (fun u => B3_4_1Little u 1) ((1 : Fin 6),j)) (B3_4_1Half 1 (1,j)) = true := by + decide +kernel +lemma B3_4_1Half_check_1_2 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 3 4 1)) (shape 3 4 1) B3_4_1Law + (fun u => B3_4_1Little u 1) ((2 : Fin 6),j)) (B3_4_1Half 1 (2,j)) = true := by + decide +kernel +lemma B3_4_1Half_check_1_3 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 3 4 1)) (shape 3 4 1) B3_4_1Law + (fun u => B3_4_1Little u 1) ((3 : Fin 6),j)) (B3_4_1Half 1 (3,j)) = true := by + decide +kernel +lemma B3_4_1Half_check_1_4 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 3 4 1)) (shape 3 4 1) B3_4_1Law + (fun u => B3_4_1Little u 1) ((4 : Fin 6),j)) (B3_4_1Half 1 (4,j)) = true := by + decide +kernel +lemma B3_4_1Half_check_1_5 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 3 4 1)) (shape 3 4 1) B3_4_1Law + (fun u => B3_4_1Little u 1) ((5 : Fin 6),j)) (B3_4_1Half 1 (5,j)) = true := by + decide +kernel +lemma B3_4_1Half_check_2_0 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 3 4 1)) (shape 3 4 1) B3_4_1Law + (fun u => B3_4_1Little u 2) ((0 : Fin 6),j)) (B3_4_1Half 2 (0,j)) = true := by + decide +kernel +lemma B3_4_1Half_check_2_1 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 3 4 1)) (shape 3 4 1) B3_4_1Law + (fun u => B3_4_1Little u 2) ((1 : Fin 6),j)) (B3_4_1Half 2 (1,j)) = true := by + decide +kernel +lemma B3_4_1Half_check_2_2 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 3 4 1)) (shape 3 4 1) B3_4_1Law + (fun u => B3_4_1Little u 2) ((2 : Fin 6),j)) (B3_4_1Half 2 (2,j)) = true := by + decide +kernel +lemma B3_4_1Half_check_2_3 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 3 4 1)) (shape 3 4 1) B3_4_1Law + (fun u => B3_4_1Little u 2) ((3 : Fin 6),j)) (B3_4_1Half 2 (3,j)) = true := by + decide +kernel +lemma B3_4_1Half_check_2_4 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 3 4 1)) (shape 3 4 1) B3_4_1Law + (fun u => B3_4_1Little u 2) ((4 : Fin 6),j)) (B3_4_1Half 2 (4,j)) = true := by + decide +kernel +lemma B3_4_1Half_check_2_5 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 3 4 1)) (shape 3 4 1) B3_4_1Law + (fun u => B3_4_1Little u 2) ((5 : Fin 6),j)) (B3_4_1Half 2 (5,j)) = true := by + decide +kernel +lemma B3_4_1Half_sound (w : Fin 3) (ij : PairSlot) : + (B3_4_1Half w ij).Encloses (halfLaw (shape 3 4 1) w ij : ℝ) := by + have hcheck : contains (pairLawBall (below (shape 3 4 1)) (shape 3 4 1) B3_4_1Law + (fun u => B3_4_1Little u w) ij) (B3_4_1Half w ij) = true := by + rcases ij with ⟨i,j⟩ + revert i w + apply forall_fin3 + · exact forall_fin6 (B3_4_1Half_check_0_0 j) (B3_4_1Half_check_0_1 j) (B3_4_1Half_check_0_2 j) (B3_4_1Half_check_0_3 j) (B3_4_1Half_check_0_4 j) (B3_4_1Half_check_0_5 j) + · exact forall_fin6 (B3_4_1Half_check_1_0 j) (B3_4_1Half_check_1_1 j) (B3_4_1Half_check_1_2 j) (B3_4_1Half_check_1_3 j) (B3_4_1Half_check_1_4 j) (B3_4_1Half_check_1_5 j) + · exact forall_fin6 (B3_4_1Half_check_2_0 j) (B3_4_1Half_check_2_1 j) (B3_4_1Half_check_2_2 j) (B3_4_1Half_check_2_3 j) (B3_4_1Half_check_2_4 j) (B3_4_1Half_check_2_5 j) + have h := contains_sound (pairLawBall_sound (below (shape 3 4 1)) (shape 3 4 1) + B3_4_1Law (fun u => (stageBLaw (shape 3 4 1) u : ℝ)) + (fun u => B3_4_1Little u w) (fun u i => (littleLaw (shape 3 4 1) u w i : ℝ)) + (fun u _ => B3_4_1Law_sound u) (fun u i => B3_4_1Little_sound u w i) ij) hcheck + have hp : positive (shape 3 4 1) = true := by decide +kernel + simpa only [halfLaw, hp, ite_true, pairLaw, positiveHalfLaw, Rat.cast_list_sum, + List.map_map, Function.comp_def, Rat.cast_mul] using h + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def B3_4_1U0_3_1Leaf : Ball := ⟨(115129254649702284200899544090987 / 50000000000000000000000000000000), (21175823683 / 25000000000000000000000000000000)⟩ +lemma B3_4_1U0_3_1Leaf_sound : B3_4_1U0_3_1Leaf.Encloses (AllFieldTerminalRates.secondLeafRate (shape 3 4 1) (shape 0 3 1)) := by + have hh : shapeMax (shape 0 3 1) = 3 := by decide +kernel + simp only [AllFieldTerminalRates.secondLeafRate, hh, show (3 : ℕ) ≠ 4 by decide, ite_false, ite_true] + change logN10.Encloses (Real.log 10) + exact logN10_sound +def B3_4_1U0_3_1Mass : Ball := ⟨(14993443283684725396667285643 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ +lemma B3_4_1U0_3_1Mass_sound : B3_4_1U0_3_1Mass.Encloses (littleMass (shape 3 4 1) (shape 0 3 1) : ℝ) := by + rw [littleMass_cast] + exact contains_sound (Ball.mul_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) (second_3_4_1)) + (B3_4_1Law_sound (shape 0 3 1))) (by decide +kernel) +def B3_4_1U0_4_0Leaf : Ball := ⟨0, 0⟩ +lemma B3_4_1U0_4_0Leaf_sound : B3_4_1U0_4_0Leaf.Encloses (AllFieldTerminalRates.secondLeafRate (shape 3 4 1) (shape 0 4 0)) := by + have hh : shapeMax (shape 0 4 0) = 4 := by decide +kernel + simp only [AllFieldTerminalRates.secondLeafRate, hh, ite_true] + change (Ball.exact 0).Encloses 0 + simpa only [Rat.cast_zero] using Ball.exact_sound 0 +def B3_4_1U0_4_0Mass : Ball := ⟨(386243604482581519325542989 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ +lemma B3_4_1U0_4_0Mass_sound : B3_4_1U0_4_0Mass.Encloses (littleMass (shape 3 4 1) (shape 0 4 0) : ℝ) := by + rw [littleMass_cast] + exact contains_sound (Ball.mul_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) (second_3_4_1)) + (B3_4_1Law_sound (shape 0 4 0))) (by decide +kernel) +def B3_4_1U1_2_1D : Ball := .exact (2953 / 1000000) +lemma B3_4_1U1_2_1D_sound : B3_4_1U1_2_1D.Encloses (binaryParameter (shape 3 4 1) (shape 1 2 1) : ℝ) := by + apply exact_rat_enclosed + decide +kernel +def B3_4_1U1_2_1OneD : Ball := .exact (997047 / 1000000) +lemma B3_4_1U1_2_1OneD_sound : B3_4_1U1_2_1OneD.Encloses (1 - (binaryParameter (shape 3 4 1) (shape 1 2 1) : ℝ)) := by + have he : binaryParameter (shape 3 4 1) (shape 1 2 1) = (2953 / 1000000) := by decide +kernel + rw [he] + convert Ball.exact_sound ((997047 / 1000000) : ℚ) using 1 <;> norm_num [B3_4_1U1_2_1OneD, Ball.exact] +def B3_4_1U1_2_1EDLogWitness : LogWitness := ⟨-9, 23624, 15625⟩ +def B3_4_1U1_2_1EDLog : Ball := ⟨(-582493367622035143525726017920939 / 100000000000000000000000000000000), (21175823683 / 10000000000000000000000000000000)⟩ +lemma B3_4_1U1_2_1EDLog_sound : B3_4_1U1_2_1EDLog.Encloses (Real.log ((binaryParameter (shape 3 4 1) (shape 1 2 1) : ℝ))) := by + exact checkLog_sound logTwoBall_sound (B3_4_1U1_2_1D_sound) (w := B3_4_1U1_2_1EDLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def B3_4_1U1_2_1ED : Ball := ⟨(1720102914587869778831468930921 / 100000000000000000000000000000000), (312661037 / 50000000000000000000000000000000)⟩ +lemma B3_4_1U1_2_1ED_sound : B3_4_1U1_2_1ED.Encloses (Foundation.entropyTerm ((binaryParameter (shape 3 4 1) (shape 1 2 1) : ℝ))) := by + exact contains_sound (entropyTerm_ball (B3_4_1U1_2_1D_sound) B3_4_1U1_2_1EDLog_sound) (by decide +kernel) +def B3_4_1U1_2_1EOneDLogWitness : LogWitness := ⟨-1, 997047, 500000⟩ +def B3_4_1U1_2_1EOneDLog : Ball := ⟨(-295736870714792481357949825269 / 100000000000000000000000000000000), (21175823683 / 50000000000000000000000000000000)⟩ +lemma B3_4_1U1_2_1EOneDLog_sound : B3_4_1U1_2_1EOneDLog.Encloses (Real.log ((1 - (binaryParameter (shape 3 4 1) (shape 1 2 1) : ℝ)))) := by + exact checkLog_sound logTwoBall_sound (B3_4_1U1_2_1OneD_sound) (w := B3_4_1U1_2_1EOneDLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def B3_4_1U1_2_1EOneD : Ball := ⟨(58972711947114339832099959887 / 20000000000000000000000000000000), (5278322869 / 12500000000000000000000000000000)⟩ +lemma B3_4_1U1_2_1EOneD_sound : B3_4_1U1_2_1EOneD.Encloses (Foundation.entropyTerm ((1 - (binaryParameter (shape 3 4 1) (shape 1 2 1) : ℝ)))) := by + exact contains_sound (entropyTerm_ball (B3_4_1U1_2_1OneD_sound) B3_4_1U1_2_1EOneDLog_sound) (by decide +kernel) +def B3_4_1U1_2_1BinaryEntropy : Ball := ⟨(1109826418371396663931438659717 / 50000000000000000000000000000000), (21488484721 / 50000000000000000000000000000000)⟩ +lemma B3_4_1U1_2_1BinaryEntropy_sound : B3_4_1U1_2_1BinaryEntropy.Encloses + (binaryEntropyRate (binaryParameter (shape 3 4 1) (shape 1 2 1))) := by + exact contains_sound (Ball.add_sound (Ball.add_sound B3_4_1U1_2_1EOneD_sound B3_4_1U1_2_1ED_sound) + (Ball.mul_sound B3_4_1U1_2_1D_sound logN2_sound)) (by decide +kernel) +def B3_4_1U1_2_1Leaf : Ball := ⟨(80353078867819571269883046536241 / 25000000000000000000000000000000), (126867345477 / 100000000000000000000000000000000)⟩ +lemma B3_4_1U1_2_1Leaf_sound : B3_4_1U1_2_1Leaf.Encloses (AllFieldTerminalRates.secondLeafRate (shape 3 4 1) (shape 1 2 1)) := by + have hh : shapeMax (shape 1 2 1) = 2 := by decide +kernel + have hp : positive (shape 1 2 1) = true := by decide +kernel + simp only [AllFieldTerminalRates.secondLeafRate, hh, hp, Bool.not_true, Bool.false_eq_true, + show (2 : ℕ) ≠ 4 by decide, show (2 : ℕ) ≠ 3 by decide, ite_false] + have ht : (Ball.exact (1997047 / 1000000)).Encloses (2 - (binaryParameter (shape 3 4 1) (shape 1 2 1) : ℝ)) := by + have he : binaryParameter (shape 3 4 1) (shape 1 2 1) = (2953 / 1000000) := by decide +kernel + rw [he] + convert Ball.exact_sound ((1997047 / 1000000) : ℚ) using 1 + norm_num [Ball.exact] + exact contains_sound (Ball.mul_sound ht logN5_sound) (by decide +kernel) +def B3_4_1U1_2_1Mass : Ball := ⟨(487950024168829794196947866917 / 100000000000000000000000000000000), (9 / 100000000000000000000000000000000)⟩ +lemma B3_4_1U1_2_1Mass_sound : B3_4_1U1_2_1Mass.Encloses (littleMass (shape 3 4 1) (shape 1 2 1) : ℝ) := by + rw [littleMass_cast] + exact contains_sound (Ball.mul_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) (second_3_4_1)) + (B3_4_1Law_sound (shape 1 2 1))) (by decide +kernel) +def B3_4_1U1_3_0Leaf : Ball := ⟨(115129254649702284200899544090987 / 50000000000000000000000000000000), (21175823683 / 25000000000000000000000000000000)⟩ +lemma B3_4_1U1_3_0Leaf_sound : B3_4_1U1_3_0Leaf.Encloses (AllFieldTerminalRates.secondLeafRate (shape 3 4 1) (shape 1 3 0)) := by + have hh : shapeMax (shape 1 3 0) = 3 := by decide +kernel + simp only [AllFieldTerminalRates.secondLeafRate, hh, show (3 : ℕ) ≠ 4 by decide, ite_false, ite_true] + change logN10.Encloses (Real.log 10) + exact logN10_sound +def B3_4_1U1_3_0Mass : Ball := ⟨(19014819141945082814976681729 / 25000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ +lemma B3_4_1U1_3_0Mass_sound : B3_4_1U1_3_0Mass.Encloses (littleMass (shape 3 4 1) (shape 1 3 0) : ℝ) := by + rw [littleMass_cast] + exact contains_sound (Ball.mul_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) (second_3_4_1)) + (B3_4_1Law_sound (shape 1 3 0))) (by decide +kernel) +def B3_4_1U2_1_1D : Ball := .exact (21083 / 500000) +lemma B3_4_1U2_1_1D_sound : B3_4_1U2_1_1D.Encloses (binaryParameter (shape 3 4 1) (shape 2 1 1) : ℝ) := by + apply exact_rat_enclosed + decide +kernel +def B3_4_1U2_1_1OneD : Ball := .exact (478917 / 500000) +lemma B3_4_1U2_1_1OneD_sound : B3_4_1U2_1_1OneD.Encloses (1 - (binaryParameter (shape 3 4 1) (shape 2 1 1) : ℝ)) := by + have he : binaryParameter (shape 3 4 1) (shape 2 1 1) = (21083 / 500000) := by decide +kernel + rw [he] + convert Ball.exact_sound ((478917 / 500000) : ℚ) using 1 <;> norm_num [B3_4_1U2_1_1OneD, Ball.exact] +def B3_4_1U2_1_1EDLogWitness : LogWitness := ⟨-5, 21083, 15625⟩ +def B3_4_1U2_1_1EDLog : Ball := ⟨(-63322821397686708031899813013369 / 20000000000000000000000000000000), (63527471049 / 50000000000000000000000000000000)⟩ +lemma B3_4_1U2_1_1EDLog_sound : B3_4_1U2_1_1EDLog.Encloses (Real.log ((binaryParameter (shape 3 4 1) (shape 2 1 1) : ℝ))) := by + exact checkLog_sound logTwoBall_sound (B3_4_1U2_1_1D_sound) (w := B3_4_1U2_1_1EDLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def B3_4_1U2_1_1ED : Ball := ⟨(13350350435274288654365437577609 / 100000000000000000000000000000000), (5357398689 / 100000000000000000000000000000000)⟩ +lemma B3_4_1U2_1_1ED_sound : B3_4_1U2_1_1ED.Encloses (Foundation.entropyTerm ((binaryParameter (shape 3 4 1) (shape 2 1 1) : ℝ))) := by + exact contains_sound (entropyTerm_ball (B3_4_1U2_1_1D_sound) B3_4_1U2_1_1EDLog_sound) (by decide +kernel) +def B3_4_1U2_1_1EOneDLogWitness : LogWitness := ⟨-1, 478917, 250000⟩ +def B3_4_1U2_1_1EOneDLog : Ball := ⟨(-67313740136531887218517535329 / 1562500000000000000000000000000), (21175823683 / 50000000000000000000000000000000)⟩ +lemma B3_4_1U2_1_1EOneDLog_sound : B3_4_1U2_1_1EOneDLog.Encloses (Real.log ((1 - (binaryParameter (shape 3 4 1) (shape 2 1 1) : ℝ)))) := by + exact checkLog_sound logTwoBall_sound (B3_4_1U2_1_1OneD_sound) (w := B3_4_1U2_1_1EOneDLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def B3_4_1U2_1_1EOneD : Ball := ⟨(1031606223518958138592984398949 / 25000000000000000000000000000000), (10141461951 / 25000000000000000000000000000000)⟩ +lemma B3_4_1U2_1_1EOneD_sound : B3_4_1U2_1_1EOneD.Encloses (Foundation.entropyTerm ((1 - (binaryParameter (shape 3 4 1) (shape 2 1 1) : ℝ)))) := by + exact contains_sound (entropyTerm_ball (B3_4_1U2_1_1OneD_sound) B3_4_1U2_1_1EOneDLog_sound) (by decide +kernel) +def B3_4_1U2_1_1BinaryEntropy : Ball := ⟨(4079899946179837320085215066313 / 20000000000000000000000000000000), (47709046057 / 100000000000000000000000000000000)⟩ +lemma B3_4_1U2_1_1BinaryEntropy_sound : B3_4_1U2_1_1BinaryEntropy.Encloses + (binaryEntropyRate (binaryParameter (shape 3 4 1) (shape 2 1 1))) := by + exact contains_sound (Ball.add_sound (Ball.add_sound B3_4_1U2_1_1EOneD_sound B3_4_1U2_1_1ED_sound) + (Ball.mul_sound B3_4_1U2_1_1D_sound logN2_sound)) (by decide +kernel) +def B3_4_1U2_1_1Leaf : Ball := ⟨(315101226585250447280610230069167 / 100000000000000000000000000000000), (62188121377 / 50000000000000000000000000000000)⟩ +lemma B3_4_1U2_1_1Leaf_sound : B3_4_1U2_1_1Leaf.Encloses (AllFieldTerminalRates.secondLeafRate (shape 3 4 1) (shape 2 1 1)) := by + have hh : shapeMax (shape 2 1 1) = 2 := by decide +kernel + have hp : positive (shape 2 1 1) = true := by decide +kernel + simp only [AllFieldTerminalRates.secondLeafRate, hh, hp, Bool.not_true, Bool.false_eq_true, + show (2 : ℕ) ≠ 4 by decide, show (2 : ℕ) ≠ 3 by decide, ite_false] + have ht : (Ball.exact (978917 / 500000)).Encloses (2 - (binaryParameter (shape 3 4 1) (shape 2 1 1) : ℝ)) := by + have he : binaryParameter (shape 3 4 1) (shape 2 1 1) = (21083 / 500000) := by decide +kernel + rw [he] + convert Ball.exact_sound ((978917 / 500000) : ℚ) using 1 + norm_num [Ball.exact] + exact contains_sound (Ball.mul_sound ht logN5_sound) (by decide +kernel) +def B3_4_1U2_1_1Mass : Ball := ⟨(19014819141945082814976681729 / 25000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ +lemma B3_4_1U2_1_1Mass_sound : B3_4_1U2_1_1Mass.Encloses (littleMass (shape 3 4 1) (shape 2 1 1) : ℝ) := by + rw [littleMass_cast] + exact contains_sound (Ball.mul_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) (second_3_4_1)) + (B3_4_1Law_sound (shape 2 1 1))) (by decide +kernel) +def B3_4_1U2_2_0D : Ball := .exact (12 / 125) +lemma B3_4_1U2_2_0D_sound : B3_4_1U2_2_0D.Encloses (binaryParameter (shape 3 4 1) (shape 2 2 0) : ℝ) := by + apply exact_rat_enclosed + decide +kernel +def B3_4_1U2_2_0OneD : Ball := .exact (113 / 125) +lemma B3_4_1U2_2_0OneD_sound : B3_4_1U2_2_0OneD.Encloses (1 - (binaryParameter (shape 3 4 1) (shape 2 2 0) : ℝ)) := by + have he : binaryParameter (shape 3 4 1) (shape 2 2 0) = (12 / 125) := by decide +kernel + rw [he] + convert Ball.exact_sound ((113 / 125) : ℚ) using 1 <;> norm_num [B3_4_1U2_2_0OneD, Ball.exact] +def B3_4_1U2_2_0EDLogWitness : LogWitness := ⟨-4, 192, 125⟩ +def B3_4_1U2_2_0EDLog : Ball := ⟨(-117170354375715040678628387801009 / 50000000000000000000000000000000), (21175823683 / 20000000000000000000000000000000)⟩ +lemma B3_4_1U2_2_0EDLog_sound : B3_4_1U2_2_0EDLog.Encloses (Real.log ((binaryParameter (shape 3 4 1) (shape 2 2 0) : ℝ))) := by + exact checkLog_sound logTwoBall_sound (B3_4_1U2_2_0D_sound) (w := B3_4_1U2_2_0EDLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def B3_4_1U2_2_0ED : Ball := ⟨(11248354020068643905148325228897 / 50000000000000000000000000000000), (10164395369 / 100000000000000000000000000000000)⟩ +lemma B3_4_1U2_2_0ED_sound : B3_4_1U2_2_0ED.Encloses (Foundation.entropyTerm ((binaryParameter (shape 3 4 1) (shape 2 2 0) : ℝ))) := by + exact contains_sound (entropyTerm_ball (B3_4_1U2_2_0D_sound) B3_4_1U2_2_0EDLog_sound) (by decide +kernel) +def B3_4_1U2_2_0EOneDLogWitness : LogWitness := ⟨-1, 226, 125⟩ +def B3_4_1U2_2_0EOneDLog : Ball := ⟨(-2523147964749013880503657881131 / 25000000000000000000000000000000), (8470329473 / 20000000000000000000000000000000)⟩ +lemma B3_4_1U2_2_0EOneDLog_sound : B3_4_1U2_2_0EOneDLog.Encloses (Real.log ((1 - (binaryParameter (shape 3 4 1) (shape 2 2 0) : ℝ)))) := by + exact checkLog_sound logTwoBall_sound (B3_4_1U2_2_0OneD_sound) (w := B3_4_1U2_2_0EOneDLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def B3_4_1U2_2_0EOneD : Ball := ⟨(912370304053243419190122689817 / 10000000000000000000000000000000), (38285889219 / 100000000000000000000000000000000)⟩ +lemma B3_4_1U2_2_0EOneD_sound : B3_4_1U2_2_0EOneD.Encloses (Foundation.entropyTerm ((1 - (binaryParameter (shape 3 4 1) (shape 2 2 0) : ℝ)))) := by + exact contains_sound (entropyTerm_ball (B3_4_1U2_2_0OneD_sound) B3_4_1U2_2_0EOneDLog_sound) (by decide +kernel) +def B3_4_1U2_2_0BinaryEntropy : Ball := ⟨(9568656003511299243150825972199 / 25000000000000000000000000000000), (3282252671 / 6250000000000000000000000000000)⟩ +lemma B3_4_1U2_2_0BinaryEntropy_sound : B3_4_1U2_2_0BinaryEntropy.Encloses + (binaryEntropyRate (binaryParameter (shape 3 4 1) (shape 2 2 0))) := by + exact contains_sound (Ball.add_sound (Ball.add_sound B3_4_1U2_2_0EOneD_sound B3_4_1U2_2_0ED_sound) + (Ball.mul_sound B3_4_1U2_2_0D_sound logN2_sound)) (by decide +kernel) +def B3_4_1U2_2_0Leaf : Ball := ⟨(41157624822766318087552565285851 / 12500000000000000000000000000000), (167373710393 / 100000000000000000000000000000000)⟩ +lemma B3_4_1U2_2_0Leaf_sound : B3_4_1U2_2_0Leaf.Encloses (AllFieldTerminalRates.secondLeafRate (shape 3 4 1) (shape 2 2 0)) := by + have hh : shapeMax (shape 2 2 0) = 2 := by decide +kernel + have hp : positive (shape 2 2 0) = false := by decide +kernel + simp only [AllFieldTerminalRates.secondLeafRate, hh, hp, Bool.not_false, + show (2 : ℕ) ≠ 4 by decide, show (2 : ℕ) ≠ 3 by decide, ite_false, ite_true] + exact contains_sound (Ball.add_sound B3_4_1U2_2_0BinaryEntropy_sound + (Ball.mul_sound (Ball.mul_sound (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) + B3_4_1U2_2_0OneD_sound) logN5_sound)) (by decide +kernel) +def B3_4_1U2_2_0Mass : Ball := ⟨(487950024168829794196947866917 / 100000000000000000000000000000000), (9 / 100000000000000000000000000000000)⟩ +lemma B3_4_1U2_2_0Mass_sound : B3_4_1U2_2_0Mass.Encloses (littleMass (shape 3 4 1) (shape 2 2 0) : ℝ) := by + rw [littleMass_cast] + exact contains_sound (Ball.mul_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) (second_3_4_1)) + (B3_4_1Law_sound (shape 2 2 0))) (by decide +kernel) +def B3_4_1U3_0_1Leaf : Ball := ⟨(115129254649702284200899544090987 / 50000000000000000000000000000000), (21175823683 / 25000000000000000000000000000000)⟩ +lemma B3_4_1U3_0_1Leaf_sound : B3_4_1U3_0_1Leaf.Encloses (AllFieldTerminalRates.secondLeafRate (shape 3 4 1) (shape 3 0 1)) := by + have hh : shapeMax (shape 3 0 1) = 3 := by decide +kernel + simp only [AllFieldTerminalRates.secondLeafRate, hh, show (3 : ℕ) ≠ 4 by decide, ite_false, ite_true] + change logN10.Encloses (Real.log 10) + exact logN10_sound +def B3_4_1U3_0_1Mass : Ball := ⟨(386243604482581519325542989 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ +lemma B3_4_1U3_0_1Mass_sound : B3_4_1U3_0_1Mass.Encloses (littleMass (shape 3 4 1) (shape 3 0 1) : ℝ) := by + rw [littleMass_cast] + exact contains_sound (Ball.mul_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) (second_3_4_1)) + (B3_4_1Law_sound (shape 3 0 1))) (by decide +kernel) +def B3_4_1U3_1_0Leaf : Ball := ⟨(115129254649702284200899544090987 / 50000000000000000000000000000000), (21175823683 / 25000000000000000000000000000000)⟩ +lemma B3_4_1U3_1_0Leaf_sound : B3_4_1U3_1_0Leaf.Encloses (AllFieldTerminalRates.secondLeafRate (shape 3 4 1) (shape 3 1 0)) := by + have hh : shapeMax (shape 3 1 0) = 3 := by decide +kernel + simp only [AllFieldTerminalRates.secondLeafRate, hh, show (3 : ℕ) ≠ 4 by decide, ite_false, ite_true] + change logN10.Encloses (Real.log 10) + exact logN10_sound +def B3_4_1U3_1_0Mass : Ball := ⟨(14993443283684725396667285643 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ +lemma B3_4_1U3_1_0Mass_sound : B3_4_1U3_1_0Mass.Encloses (littleMass (shape 3 4 1) (shape 3 1 0) : ℝ) := by + rw [littleMass_cast] + exact contains_sound (Ball.mul_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) (second_3_4_1)) + (B3_4_1Law_sound (shape 3 1 0))) (by decide +kernel) +def B3_4_1Leaves (s : Shape) : Ball := + match s 0, s 1, s 2 with + | 0, 3, 1 => B3_4_1U0_3_1Leaf + | 0, 4, 0 => B3_4_1U0_4_0Leaf + | 1, 2, 1 => B3_4_1U1_2_1Leaf + | 1, 3, 0 => B3_4_1U1_3_0Leaf + | 2, 1, 1 => B3_4_1U2_1_1Leaf + | 2, 2, 0 => B3_4_1U2_2_0Leaf + | 3, 0, 1 => B3_4_1U3_0_1Leaf + | 3, 1, 0 => B3_4_1U3_1_0Leaf + | _, _, _ => (.exact 0) +lemma B3_4_1Leaves_sound (u : Shape) (hu : u ∈ below (shape 3 4 1)) : + (B3_4_1Leaves u).Encloses (AllFieldTerminalRates.secondLeafRate (shape 3 4 1) u) := by + rw [B3_4_1_below] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl + · exact B3_4_1U0_3_1Leaf_sound + · exact B3_4_1U0_4_0Leaf_sound + · exact B3_4_1U1_2_1Leaf_sound + · exact B3_4_1U1_3_0Leaf_sound + · exact B3_4_1U2_1_1Leaf_sound + · exact B3_4_1U2_2_0Leaf_sound + · exact B3_4_1U3_0_1Leaf_sound + · exact B3_4_1U3_1_0Leaf_sound +def B3_4_1Masses (s : Shape) : Ball := + match s 0, s 1, s 2 with + | 0, 3, 1 => B3_4_1U0_3_1Mass + | 0, 4, 0 => B3_4_1U0_4_0Mass + | 1, 2, 1 => B3_4_1U1_2_1Mass + | 1, 3, 0 => B3_4_1U1_3_0Mass + | 2, 1, 1 => B3_4_1U2_1_1Mass + | 2, 2, 0 => B3_4_1U2_2_0Mass + | 3, 0, 1 => B3_4_1U3_0_1Mass + | 3, 1, 0 => B3_4_1U3_1_0Mass + | _, _, _ => (.exact 0) +lemma B3_4_1Masses_sound (u : Shape) (hu : u ∈ below (shape 3 4 1)) : + (B3_4_1Masses u).Encloses ((fun u => (littleMass (shape 3 4 1) u : ℝ)) u) := by + rw [B3_4_1_below] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl + · exact B3_4_1U0_3_1Mass_sound + · exact B3_4_1U0_4_0Mass_sound + · exact B3_4_1U1_2_1Mass_sound + · exact B3_4_1U1_3_0Mass_sound + · exact B3_4_1U2_1_1Mass_sound + · exact B3_4_1U2_2_0Mass_sound + · exact B3_4_1U3_0_1Mass_sound + · exact B3_4_1U3_1_0Mass_sound +def B3_4_1Binaries (s : Shape) : Ball := + match s 0, s 1, s 2 with + | 1, 2, 1 => B3_4_1U1_2_1BinaryEntropy + | 2, 1, 1 => B3_4_1U2_1_1BinaryEntropy + | 2, 2, 0 => B3_4_1U2_2_0BinaryEntropy + | _, _, _ => (.exact 0) +lemma B3_4_1Binaries_sound (u : Shape) (hu : u ∈ (below (shape 3 4 1)).filter positive) : + (B3_4_1Binaries u).Encloses ((fun u => binaryEntropyRate (binaryParameter (shape 3 4 1) u)) u) := by + have hl : (below (shape 3 4 1)).filter positive = [(shape 1 2 1), (shape 2 1 1)] := by decide +kernel + rw [hl] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl + · exact B3_4_1U1_2_1BinaryEntropy_sound + · exact B3_4_1U2_1_1BinaryEntropy_sound +def B3_4_1S2 : Ball := ⟨(1829846989875417228160241011411 / 50000000000000000000000000000000), (810250403 / 50000000000000000000000000000000)⟩ +lemma B3_4_1S2_sound : B3_4_1S2.Encloses + (((below (shape 3 4 1)).map fun u => (littleMass (shape 3 4 1) u : ℝ) * AllFieldTerminalRates.secondLeafRate (shape 3 4 1) u).sum) := by + exact contains_sound (listSumBall_sound (below (shape 3 4 1)) + (fun u => .mul (B3_4_1Masses u) (B3_4_1Leaves u)) _ + (fun u hu => Ball.mul_sound (B3_4_1Masses_sound u hu) (B3_4_1Leaves_sound u hu))) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/Certificates/Terminal4_1_3.lean b/lean/OAI/LinearAlgebra/MatrixFields/Certificates/Terminal4_1_3.lean new file mode 100644 index 0000000000000000000000000000000000000000..44f8fcad481b647d347a45e1fae2a1baa4c4504a --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/Certificates/Terminal4_1_3.lean @@ -0,0 +1,593 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Certificates.LittleB1_3_4 +import OAI.LinearAlgebra.MatrixFields.Certificates.Terminal1_1_6 + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate +open scoped BigOperators +lemma B4_1_3_below : below (shape 4 1 3) = [ + (shape 0 1 3), + (shape 1 0 3), + (shape 1 1 2), + (shape 2 0 2), + (shape 2 1 1), + (shape 3 0 1), + (shape 3 1 0), + (shape 4 0 0)] := by decide +kernel +def B4_1_3Raw (s : Shape) : Ball := + match s 0, s 1, s 2 with + | 0, 1, 3 => ⟨(1986046562779191655644056193 / 2500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 1, 0, 3 => ⟨(3067522357202958037026075746671 / 100000000000000000000000000000000), (1 / 12500000000000000000000000000000)⟩ + | 1, 1, 2 => ⟨(15612473623271752962591099629173 / 100000000000000000000000000000000), (9 / 50000000000000000000000000000000)⟩ + | 2, 0, 2 => ⟨1, 0⟩ + | 2, 1, 1 => ⟨1, 0⟩ + | 3, 0, 1 => ⟨(15612473623271752962591099629173 / 100000000000000000000000000000000), (9 / 50000000000000000000000000000000)⟩ + | 3, 1, 0 => ⟨(3067522357202958037026075746671 / 100000000000000000000000000000000), (1 / 12500000000000000000000000000000)⟩ + | 4, 0, 0 => ⟨(1986046562779191655644056193 / 2500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | _, _, _ => (.exact 0) +lemma B4_1_3Raw_0_1_3 : (B4_1_3Raw (shape 0 1 3)).Encloses (splitWeight positiveSecond tablep (shape 4 1 3) (shape 0 1 3) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveSecond tablep (shape 4 1 3) (shape 0 1 3) + (-55107) (0) (-16272) w31 w195 w105 + (by decide +kernel) w31_sound w195_sound w105_sound) (by decide +kernel) +lemma B4_1_3Raw_1_0_3 : (B4_1_3Raw (shape 1 0 3)).Encloses (splitWeight positiveSecond tablep (shape 4 1 3) (shape 1 0 3) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveSecond tablep (shape 4 1 3) (shape 1 0 3) + (-18571) (0) (-16272) w93 w195 w105 + (by decide +kernel) w93_sound w195_sound w105_sound) (by decide +kernel) +lemma B4_1_3Raw_1_1_2 : (B4_1_3Raw (shape 1 1 2)).Encloses (splitWeight positiveSecond tablep (shape 4 1 3) (shape 1 1 2) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveSecond tablep (shape 4 1 3) (shape 1 1 2) + (-18571) (0) (0) w93 w195 w195 + (by decide +kernel) w93_sound w195_sound w195_sound) (by decide +kernel) +lemma B4_1_3Raw_2_0_2 : (B4_1_3Raw (shape 2 0 2)).Encloses (splitWeight positiveSecond tablep (shape 4 1 3) (shape 2 0 2) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveSecond tablep (shape 4 1 3) (shape 2 0 2) + (0) (0) (0) w195 w195 w195 + (by decide +kernel) w195_sound w195_sound w195_sound) (by decide +kernel) +lemma B4_1_3Raw_2_1_1 : (B4_1_3Raw (shape 2 1 1)).Encloses (splitWeight positiveSecond tablep (shape 4 1 3) (shape 2 1 1) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveSecond tablep (shape 4 1 3) (shape 2 1 1) + (0) (0) (0) w195 w195 w195 + (by decide +kernel) w195_sound w195_sound w195_sound) (by decide +kernel) +lemma B4_1_3Raw_3_0_1 : (B4_1_3Raw (shape 3 0 1)).Encloses (splitWeight positiveSecond tablep (shape 4 1 3) (shape 3 0 1) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveSecond tablep (shape 4 1 3) (shape 3 0 1) + (-18571) (0) (0) w93 w195 w195 + (by decide +kernel) w93_sound w195_sound w195_sound) (by decide +kernel) +lemma B4_1_3Raw_3_1_0 : (B4_1_3Raw (shape 3 1 0)).Encloses (splitWeight positiveSecond tablep (shape 4 1 3) (shape 3 1 0) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveSecond tablep (shape 4 1 3) (shape 3 1 0) + (-18571) (0) (-16272) w93 w195 w105 + (by decide +kernel) w93_sound w195_sound w105_sound) (by decide +kernel) +lemma B4_1_3Raw_4_0_0 : (B4_1_3Raw (shape 4 0 0)).Encloses (splitWeight positiveSecond tablep (shape 4 1 3) (shape 4 0 0) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveSecond tablep (shape 4 1 3) (shape 4 0 0) + (-55107) (0) (-16272) w31 w195 w105 + (by decide +kernel) w31_sound w195_sound w105_sound) (by decide +kernel) +lemma B4_1_3Raw_sound (u : Shape) (hu : u ∈ below (shape 4 1 3)) : + (B4_1_3Raw u).Encloses (splitWeight positiveSecond tablep (shape 4 1 3) u : ℝ) := by + rw [B4_1_3_below] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl + · exact B4_1_3Raw_0_1_3 + · exact B4_1_3Raw_1_0_3 + · exact B4_1_3Raw_1_1_2 + · exact B4_1_3Raw_2_0_2 + · exact B4_1_3Raw_2_1_1 + · exact B4_1_3Raw_3_0_1 + · exact B4_1_3Raw_3_1_0 + · exact B4_1_3Raw_4_0_0 +def B4_1_3Den : Ball := ⟨(29689859460746469666460734405891 / 12500000000000000000000000000000), (27 / 50000000000000000000000000000000)⟩ +lemma B4_1_3Den_sound : B4_1_3Den.Encloses (((below (shape 4 1 3)).map (splitWeight positiveSecond tablep (shape 4 1 3))).sum : ℝ) := by + exact contains_sound (list_cast_enclosed (below (shape 4 1 3)) B4_1_3Raw (splitWeight positiveSecond tablep (shape 4 1 3)) B4_1_3Raw_sound) (by decide +kernel) +lemma B4_1_3Den_positive : 0 < B4_1_3Den.lower := by decide +kernel +def B4_1_3Table (s : Shape) : Ball := + match s 0, s 1, s 2 with + | 0, 1, 3 => ⟨(33446547050938077933247687037 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 1, 0, 3 => ⟨(2066377148910784129369940729 / 160000000000000000000000000000), (1 / 20000000000000000000000000000000)⟩ + | 1, 1, 2 => ⟨(3286575346523891131058813407701 / 50000000000000000000000000000000), (1 / 10000000000000000000000000000000)⟩ + | 2, 0, 2 => ⟨(2631369815114502473693307033871 / 6250000000000000000000000000000), (1 / 10000000000000000000000000000000)⟩ + | 2, 1, 1 => ⟨(2631369815114502473693307033871 / 6250000000000000000000000000000), (1 / 10000000000000000000000000000000)⟩ + | 3, 0, 1 => ⟨(3286575346523891131058813407701 / 50000000000000000000000000000000), (1 / 10000000000000000000000000000000)⟩ + | 3, 1, 0 => ⟨(2066377148910784129369940729 / 160000000000000000000000000000), (1 / 20000000000000000000000000000000)⟩ + | 4, 0, 0 => ⟨(33446547050938077933247687037 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | _, _, _ => (.exact 0) +def B4_1_3Law (u : Shape) : Ball := if u ∈ below (shape 4 1 3) then B4_1_3Table u else .exact 0 +lemma B4_1_3Law_check_0_1_3 : contains (.mul (B4_1_3Raw (shape 0 1 3)) (.inv B4_1_3Den)) (B4_1_3Table (shape 0 1 3)) = true := by decide +kernel +lemma B4_1_3Law_check_1_0_3 : contains (.mul (B4_1_3Raw (shape 1 0 3)) (.inv B4_1_3Den)) (B4_1_3Table (shape 1 0 3)) = true := by decide +kernel +lemma B4_1_3Law_check_1_1_2 : contains (.mul (B4_1_3Raw (shape 1 1 2)) (.inv B4_1_3Den)) (B4_1_3Table (shape 1 1 2)) = true := by decide +kernel +lemma B4_1_3Law_check_2_0_2 : contains (.mul (B4_1_3Raw (shape 2 0 2)) (.inv B4_1_3Den)) (B4_1_3Table (shape 2 0 2)) = true := by decide +kernel +lemma B4_1_3Law_check_2_1_1 : contains (.mul (B4_1_3Raw (shape 2 1 1)) (.inv B4_1_3Den)) (B4_1_3Table (shape 2 1 1)) = true := by decide +kernel +lemma B4_1_3Law_check_3_0_1 : contains (.mul (B4_1_3Raw (shape 3 0 1)) (.inv B4_1_3Den)) (B4_1_3Table (shape 3 0 1)) = true := by decide +kernel +lemma B4_1_3Law_check_3_1_0 : contains (.mul (B4_1_3Raw (shape 3 1 0)) (.inv B4_1_3Den)) (B4_1_3Table (shape 3 1 0)) = true := by decide +kernel +lemma B4_1_3Law_check_4_0_0 : contains (.mul (B4_1_3Raw (shape 4 0 0)) (.inv B4_1_3Den)) (B4_1_3Table (shape 4 0 0)) = true := by decide +kernel +lemma B4_1_3Law_check (u : Shape) (hu : u ∈ below (shape 4 1 3)) : + contains (.mul (B4_1_3Raw u) (.inv B4_1_3Den)) (B4_1_3Table u) = true := by + rw [B4_1_3_below] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl + · exact B4_1_3Law_check_0_1_3 + · exact B4_1_3Law_check_1_0_3 + · exact B4_1_3Law_check_1_1_2 + · exact B4_1_3Law_check_2_0_2 + · exact B4_1_3Law_check_2_1_1 + · exact B4_1_3Law_check_3_0_1 + · exact B4_1_3Law_check_3_1_0 + · exact B4_1_3Law_check_4_0_0 +lemma B4_1_3Law_sound (u : Shape) : + (B4_1_3Law u).Encloses (stageBLaw (shape 4 1 3) u : ℝ) := by + by_cases hu : u ∈ below (shape 4 1 3) + · have h := contains_sound (Ball.mul_sound (B4_1_3Raw_sound u hu) + (Ball.inv_sound B4_1_3Den_sound B4_1_3Den_positive)) (B4_1_3Law_check u hu) + simpa only [B4_1_3Law, hu, ite_true, stageBLaw, splitLaw, + Rat.cast_div, Rat.cast_mul, Rat.cast_inv, div_eq_mul_inv] using h + · simp only [B4_1_3Law, hu, ite_false, stageBLaw, splitLaw, Rat.cast_zero] + simpa only [Rat.cast_zero] using Ball.exact_sound 0 + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def B4_1_3Binary (u : Shape) : ℚ := + match u 0, u 1, u 2 with + | 1, 1, 2 => (41863 / 1000000) + | 2, 0, 2 => (95723 / 1000000) + | 2, 1, 1 => (3031 / 1000000) + | _, _, _ => 0 +lemma B4_1_3Binary_eq (u : Shape) (hu : u ∈ shapes 4) : + binaryParameter (shape 4 1 3) u = B4_1_3Binary u := by + rw [shapes4_list] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel +def B4_1_3LittleRat (u : Shape) (w : Fin 3) (i : Fin 6) : ℚ := + if u w = 2 then + if i = 2 then 1 - B4_1_3Binary u else if i = 3 then B4_1_3Binary u else 0 + else if i = singletonSlot (u w) then 1 else 0 + +def B4_1_3Little (u : Shape) (w : Fin 3) (i : Fin 6) : Ball := + if u ∈ shapes 4 then .exact (B4_1_3LittleRat u w i) + else .exact (littleLaw (shape 4 1 3) u w i) + +lemma B4_1_3Little_sound (u : Shape) (w : Fin 3) (i : Fin 6) : + (B4_1_3Little u w i).Encloses (littleLaw (shape 4 1 3) u w i : ℝ) := by + by_cases hu : u ∈ shapes 4 + · simp only [B4_1_3Little, hu, ite_true] + apply exact_rat_enclosed + simp only [B4_1_3LittleRat, littleLaw, B4_1_3Binary_eq u hu] + · simp only [B4_1_3Little, hu, ite_false] + exact Ball.exact_sound _ +def B4_1_3Half (w : Fin 3) (ij : PairSlot) : Ball := + match w.val, ij.1.val, ij.2.val with + | 0, 0, 5 => ⟨(33446547050938077933247687037 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 0, 1, 4 => ⟨(7864636411117022342973839771027 / 100000000000000000000000000000000), (3 / 20000000000000000000000000000000)⟩ + | 0, 2, 2 => ⟨(75912799250947798122822246208417 / 100000000000000000000000000000000), (19 / 100000000000000000000000000000000)⟩ + | 0, 2, 3 => ⟨(4133302117167199798769837390289 / 100000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ + | 0, 3, 2 => ⟨(4133302117167199798769837390289 / 100000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ + | 0, 3, 3 => ⟨(24430598381881437823904094877 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 0, 4, 1 => ⟨(7864636411117022342973839771027 / 100000000000000000000000000000000), (3 / 20000000000000000000000000000000)⟩ + | 0, 5, 0 => ⟨(33446547050938077933247687037 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 1, 1, 0 => ⟨(1 / 2), (13 / 50000000000000000000000000000000)⟩ + | 1, 0, 1 => ⟨(1 / 2), (13 / 50000000000000000000000000000000)⟩ + | 2, 4, 0 => ⟨(662466132560089079394730321331 / 50000000000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ + | 2, 2, 1 => ⟨(44369774122421474207741998278713 / 100000000000000000000000000000000), (19 / 100000000000000000000000000000000)⟩ + | 2, 3, 1 => ⟨(34442348899666781067748328629 / 800000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ + | 2, 1, 2 => ⟨(44369774122421474207741998278713 / 100000000000000000000000000000000), (19 / 100000000000000000000000000000000)⟩ + | 2, 1, 3 => ⟨(34442348899666781067748328629 / 800000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ + | 2, 0, 4 => ⟨(662466132560089079394730321331 / 50000000000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ + | _, _, _ => (.exact 0) +lemma B4_1_3Half_check_0_0 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 4 1 3)) (shape 4 1 3) B4_1_3Law + (fun u => B4_1_3Little u 0) ((0 : Fin 6),j)) (B4_1_3Half 0 (0,j)) = true := by + decide +kernel +lemma B4_1_3Half_check_0_1 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 4 1 3)) (shape 4 1 3) B4_1_3Law + (fun u => B4_1_3Little u 0) ((1 : Fin 6),j)) (B4_1_3Half 0 (1,j)) = true := by + decide +kernel +lemma B4_1_3Half_check_0_2 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 4 1 3)) (shape 4 1 3) B4_1_3Law + (fun u => B4_1_3Little u 0) ((2 : Fin 6),j)) (B4_1_3Half 0 (2,j)) = true := by + decide +kernel +lemma B4_1_3Half_check_0_3 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 4 1 3)) (shape 4 1 3) B4_1_3Law + (fun u => B4_1_3Little u 0) ((3 : Fin 6),j)) (B4_1_3Half 0 (3,j)) = true := by + decide +kernel +lemma B4_1_3Half_check_0_4 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 4 1 3)) (shape 4 1 3) B4_1_3Law + (fun u => B4_1_3Little u 0) ((4 : Fin 6),j)) (B4_1_3Half 0 (4,j)) = true := by + decide +kernel +lemma B4_1_3Half_check_0_5 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 4 1 3)) (shape 4 1 3) B4_1_3Law + (fun u => B4_1_3Little u 0) ((5 : Fin 6),j)) (B4_1_3Half 0 (5,j)) = true := by + decide +kernel +lemma B4_1_3Half_check_1_0 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 4 1 3)) (shape 4 1 3) B4_1_3Law + (fun u => B4_1_3Little u 1) ((0 : Fin 6),j)) (B4_1_3Half 1 (0,j)) = true := by + decide +kernel +lemma B4_1_3Half_check_1_1 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 4 1 3)) (shape 4 1 3) B4_1_3Law + (fun u => B4_1_3Little u 1) ((1 : Fin 6),j)) (B4_1_3Half 1 (1,j)) = true := by + decide +kernel +lemma B4_1_3Half_check_1_2 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 4 1 3)) (shape 4 1 3) B4_1_3Law + (fun u => B4_1_3Little u 1) ((2 : Fin 6),j)) (B4_1_3Half 1 (2,j)) = true := by + decide +kernel +lemma B4_1_3Half_check_1_3 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 4 1 3)) (shape 4 1 3) B4_1_3Law + (fun u => B4_1_3Little u 1) ((3 : Fin 6),j)) (B4_1_3Half 1 (3,j)) = true := by + decide +kernel +lemma B4_1_3Half_check_1_4 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 4 1 3)) (shape 4 1 3) B4_1_3Law + (fun u => B4_1_3Little u 1) ((4 : Fin 6),j)) (B4_1_3Half 1 (4,j)) = true := by + decide +kernel +lemma B4_1_3Half_check_1_5 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 4 1 3)) (shape 4 1 3) B4_1_3Law + (fun u => B4_1_3Little u 1) ((5 : Fin 6),j)) (B4_1_3Half 1 (5,j)) = true := by + decide +kernel +lemma B4_1_3Half_check_2_0 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 4 1 3)) (shape 4 1 3) B4_1_3Law + (fun u => B4_1_3Little u 2) ((0 : Fin 6),j)) (B4_1_3Half 2 (0,j)) = true := by + decide +kernel +lemma B4_1_3Half_check_2_1 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 4 1 3)) (shape 4 1 3) B4_1_3Law + (fun u => B4_1_3Little u 2) ((1 : Fin 6),j)) (B4_1_3Half 2 (1,j)) = true := by + decide +kernel +lemma B4_1_3Half_check_2_2 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 4 1 3)) (shape 4 1 3) B4_1_3Law + (fun u => B4_1_3Little u 2) ((2 : Fin 6),j)) (B4_1_3Half 2 (2,j)) = true := by + decide +kernel +lemma B4_1_3Half_check_2_3 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 4 1 3)) (shape 4 1 3) B4_1_3Law + (fun u => B4_1_3Little u 2) ((3 : Fin 6),j)) (B4_1_3Half 2 (3,j)) = true := by + decide +kernel +lemma B4_1_3Half_check_2_4 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 4 1 3)) (shape 4 1 3) B4_1_3Law + (fun u => B4_1_3Little u 2) ((4 : Fin 6),j)) (B4_1_3Half 2 (4,j)) = true := by + decide +kernel +lemma B4_1_3Half_check_2_5 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 4 1 3)) (shape 4 1 3) B4_1_3Law + (fun u => B4_1_3Little u 2) ((5 : Fin 6),j)) (B4_1_3Half 2 (5,j)) = true := by + decide +kernel +lemma B4_1_3Half_sound (w : Fin 3) (ij : PairSlot) : + (B4_1_3Half w ij).Encloses (halfLaw (shape 4 1 3) w ij : ℝ) := by + have hcheck : contains (pairLawBall (below (shape 4 1 3)) (shape 4 1 3) B4_1_3Law + (fun u => B4_1_3Little u w) ij) (B4_1_3Half w ij) = true := by + rcases ij with ⟨i,j⟩ + revert i w + apply forall_fin3 + · exact forall_fin6 (B4_1_3Half_check_0_0 j) (B4_1_3Half_check_0_1 j) (B4_1_3Half_check_0_2 j) (B4_1_3Half_check_0_3 j) (B4_1_3Half_check_0_4 j) (B4_1_3Half_check_0_5 j) + · exact forall_fin6 (B4_1_3Half_check_1_0 j) (B4_1_3Half_check_1_1 j) (B4_1_3Half_check_1_2 j) (B4_1_3Half_check_1_3 j) (B4_1_3Half_check_1_4 j) (B4_1_3Half_check_1_5 j) + · exact forall_fin6 (B4_1_3Half_check_2_0 j) (B4_1_3Half_check_2_1 j) (B4_1_3Half_check_2_2 j) (B4_1_3Half_check_2_3 j) (B4_1_3Half_check_2_4 j) (B4_1_3Half_check_2_5 j) + have h := contains_sound (pairLawBall_sound (below (shape 4 1 3)) (shape 4 1 3) + B4_1_3Law (fun u => (stageBLaw (shape 4 1 3) u : ℝ)) + (fun u => B4_1_3Little u w) (fun u i => (littleLaw (shape 4 1 3) u w i : ℝ)) + (fun u _ => B4_1_3Law_sound u) (fun u i => B4_1_3Little_sound u w i) ij) hcheck + have hp : positive (shape 4 1 3) = true := by decide +kernel + simpa only [halfLaw, hp, ite_true, pairLaw, positiveHalfLaw, Rat.cast_list_sum, + List.map_map, Function.comp_def, Rat.cast_mul] using h + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def B4_1_3U0_1_3Leaf : Ball := ⟨(115129254649702284200899544090987 / 50000000000000000000000000000000), (21175823683 / 25000000000000000000000000000000)⟩ +lemma B4_1_3U0_1_3Leaf_sound : B4_1_3U0_1_3Leaf.Encloses (AllFieldTerminalRates.secondLeafRate (shape 4 1 3) (shape 0 1 3)) := by + have hh : shapeMax (shape 0 1 3) = 3 := by decide +kernel + simp only [AllFieldTerminalRates.secondLeafRate, hh, show (3 : ℕ) ≠ 4 by decide, ite_false, ite_true] + exact logN10_sound +def B4_1_3U0_1_3Mass : Ball := ⟨(1534436237026567284168100653 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ +lemma B4_1_3U0_1_3Mass_sound : B4_1_3U0_1_3Mass.Encloses (littleMass (shape 4 1 3) (shape 0 1 3) : ℝ) := by + rw [littleMass_cast] + exact contains_sound (Ball.mul_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) (second_4_1_3)) + (B4_1_3Law_sound (shape 0 1 3))) (by decide +kernel) +def B4_1_3U1_0_3Leaf : Ball := ⟨(115129254649702284200899544090987 / 50000000000000000000000000000000), (21175823683 / 25000000000000000000000000000000)⟩ +lemma B4_1_3U1_0_3Leaf_sound : B4_1_3U1_0_3Leaf.Encloses (AllFieldTerminalRates.secondLeafRate (shape 4 1 3) (shape 1 0 3)) := by + have hh : shapeMax (shape 1 0 3) = 3 := by decide +kernel + simp only [AllFieldTerminalRates.secondLeafRate, hh, show (3 : ℕ) ≠ 4 by decide, ite_false, ite_true] + exact logN10_sound +def B4_1_3U1_0_3Mass : Ball := ⟨(59249837730323733309452320717 / 100000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ +lemma B4_1_3U1_0_3Mass_sound : B4_1_3U1_0_3Mass.Encloses (littleMass (shape 4 1 3) (shape 1 0 3) : ℝ) := by + rw [littleMass_cast] + exact contains_sound (Ball.mul_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) (second_4_1_3)) + (B4_1_3Law_sound (shape 1 0 3))) (by decide +kernel) +def B4_1_3U1_1_2D : Ball := .exact (41863 / 1000000) +lemma B4_1_3U1_1_2D_sound : B4_1_3U1_1_2D.Encloses (binaryParameter (shape 4 1 3) (shape 1 1 2) : ℝ) := by + apply exact_rat_enclosed + decide +kernel +def B4_1_3U1_1_2OneD : Ball := .exact (958137 / 1000000) +lemma B4_1_3U1_1_2OneD_sound : B4_1_3U1_1_2OneD.Encloses (1 - (binaryParameter (shape 4 1 3) (shape 1 1 2) : ℝ)) := by + have he : binaryParameter (shape 4 1 3) (shape 1 1 2) = (41863 / 1000000) := by decide +kernel + rw [he] + convert Ball.exact_sound ((958137 / 1000000) : ℚ) using 1 <;> norm_num [B4_1_3U1_1_2OneD, Ball.exact] +def B4_1_3U1_1_2EDLogWitness : LogWitness := ⟨-5, 41863, 31250⟩ +def B4_1_3U1_1_2EDLog : Ball := ⟨(-317335289706930149883438220903761 / 100000000000000000000000000000000), (127054942097 / 100000000000000000000000000000000)⟩ +lemma B4_1_3U1_1_2EDLog_sound : B4_1_3U1_1_2EDLog.Encloses (Real.log ((binaryParameter (shape 4 1 3) (shape 1 1 2) : ℝ))) := by + exact checkLog_sound logTwoBall_sound (B4_1_3U1_1_2D_sound) (w := B4_1_3U1_1_2EDLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def B4_1_3U1_1_2ED : Ball := ⟨(6642303616500608432285187120847 / 50000000000000000000000000000000), (2659450521 / 50000000000000000000000000000000)⟩ +lemma B4_1_3U1_1_2ED_sound : B4_1_3U1_1_2ED.Encloses (Foundation.entropyTerm ((binaryParameter (shape 4 1 3) (shape 1 1 2) : ℝ))) := by + exact contains_sound (entropyTerm_ball (B4_1_3U1_1_2D_sound) B4_1_3U1_1_2EDLog_sound) (by decide +kernel) +def B4_1_3U1_1_2EOneDLogWitness : LogWitness := ⟨-1, 958137, 500000⟩ +def B4_1_3U1_1_2EOneDLog : Ball := ⟨(-855290099452987341985735013837 / 20000000000000000000000000000000), (21175823683 / 50000000000000000000000000000000)⟩ +lemma B4_1_3U1_1_2EOneDLog_sound : B4_1_3U1_1_2EOneDLog.Encloses (Real.log ((1 - (binaryParameter (shape 4 1 3) (shape 1 1 2) : ℝ)))) := by + exact checkLog_sound logTwoBall_sound (B4_1_3U1_1_2OneD_sound) (w := B4_1_3U1_1_2EOneDLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def B4_1_3U1_1_2EOneD : Ball := ⟨(1024356362524483666110232736191 / 25000000000000000000000000000000), (40578680353 / 100000000000000000000000000000000)⟩ +lemma B4_1_3U1_1_2EOneD_sound : B4_1_3U1_1_2EOneD.Encloses (Foundation.entropyTerm ((1 - (binaryParameter (shape 4 1 3) (shape 1 1 2) : ℝ)))) := by + exact contains_sound (entropyTerm_ball (B4_1_3U1_1_2OneD_sound) B4_1_3U1_1_2EOneDLog_sound) (by decide +kernel) +def B4_1_3U1_1_2BinaryEntropy : Ball := ⟨(5070938681269312644456165804281 / 25000000000000000000000000000000), (47670548409 / 100000000000000000000000000000000)⟩ +lemma B4_1_3U1_1_2BinaryEntropy_sound : B4_1_3U1_1_2BinaryEntropy.Encloses + (binaryEntropyRate (binaryParameter (shape 4 1 3) (shape 1 1 2))) := by + exact contains_sound (Ball.add_sound (Ball.add_sound B4_1_3U1_1_2EOneD_sound B4_1_3U1_1_2ED_sound) + (Ball.mul_sound B4_1_3U1_1_2D_sound logN2_sound)) (by decide +kernel) +def B4_1_3U1_1_2Leaf : Ball := ⟨(19696874534624825032622539566587 / 6250000000000000000000000000000), (62197745789 / 50000000000000000000000000000000)⟩ +lemma B4_1_3U1_1_2Leaf_sound : B4_1_3U1_1_2Leaf.Encloses (AllFieldTerminalRates.secondLeafRate (shape 4 1 3) (shape 1 1 2)) := by + have hh : shapeMax (shape 1 1 2) = 2 := by decide +kernel + have hp : positive (shape 1 1 2) = true := by decide +kernel + simp only [AllFieldTerminalRates.secondLeafRate, hh, hp, Bool.not_true, Bool.false_eq_true, + show (2 : ℕ) ≠ 4 by decide, show (2 : ℕ) ≠ 3 by decide, ite_false] + have ht : (Ball.exact (1958137 / 1000000)).Encloses (2 - (binaryParameter (shape 4 1 3) (shape 1 1 2) : ℝ)) := by + have he : binaryParameter (shape 4 1 3) (shape 1 1 2) = (41863 / 1000000) := by decide +kernel + rw [he] + convert Ball.exact_sound ((1958137 / 1000000) : ℚ) using 1 + norm_num [Ball.exact] + exact contains_sound (Ball.mul_sound ht logN5_sound) (by decide +kernel) +def B4_1_3U1_1_2Mass : Ball := ⟨(301558202689444043590391085003 / 100000000000000000000000000000000), (1 / 20000000000000000000000000000000)⟩ +lemma B4_1_3U1_1_2Mass_sound : B4_1_3U1_1_2Mass.Encloses (littleMass (shape 4 1 3) (shape 1 1 2) : ℝ) := by + rw [littleMass_cast] + exact contains_sound (Ball.mul_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) (second_4_1_3)) + (B4_1_3Law_sound (shape 1 1 2))) (by decide +kernel) +def B4_1_3U2_0_2D : Ball := .exact (95723 / 1000000) +lemma B4_1_3U2_0_2D_sound : B4_1_3U2_0_2D.Encloses (binaryParameter (shape 4 1 3) (shape 2 0 2) : ℝ) := by + apply exact_rat_enclosed + decide +kernel +def B4_1_3U2_0_2OneD : Ball := .exact (904277 / 1000000) +lemma B4_1_3U2_0_2OneD_sound : B4_1_3U2_0_2OneD.Encloses (1 - (binaryParameter (shape 4 1 3) (shape 2 0 2) : ℝ)) := by + have he : binaryParameter (shape 4 1 3) (shape 2 0 2) = (95723 / 1000000) := by decide +kernel + rw [he] + convert Ball.exact_sound ((904277 / 1000000) : ℚ) using 1 <;> norm_num [B4_1_3U2_0_2OneD, Ball.exact] +def B4_1_3U2_0_2EDLogWitness : LogWitness := ⟨-4, 95723, 62500⟩ +def B4_1_3U2_0_2EDLog : Ball := ⟨(-234629667502064329567169639454029 / 100000000000000000000000000000000), (21175823683 / 20000000000000000000000000000000)⟩ +lemma B4_1_3U2_0_2EDLog_sound : B4_1_3U2_0_2EDLog.Encloses (Real.log ((binaryParameter (shape 4 1 3) (shape 2 0 2) : ℝ))) := by + exact checkLog_sound logTwoBall_sound (B4_1_3U2_0_2D_sound) (w := B4_1_3U2_0_2EDLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def B4_1_3U2_0_2ED : Ball := ⟨(11229727831150051909579089698729 / 50000000000000000000000000000000), (10135066853 / 100000000000000000000000000000000)⟩ +lemma B4_1_3U2_0_2ED_sound : B4_1_3U2_0_2ED.Encloses (Foundation.entropyTerm ((binaryParameter (shape 4 1 3) (shape 2 0 2) : ℝ))) := by + exact contains_sound (entropyTerm_ball (B4_1_3U2_0_2D_sound) B4_1_3U2_0_2EDLog_sound) (by decide +kernel) +def B4_1_3U2_0_2EOneDLogWitness : LogWitness := ⟨-1, 904277, 500000⟩ +def B4_1_3U2_0_2EOneDLog : Ball := ⟨(-10061954959653018265030300181801 / 100000000000000000000000000000000), (21175823683 / 50000000000000000000000000000000)⟩ +lemma B4_1_3U2_0_2EOneDLog_sound : B4_1_3U2_0_2EOneDLog.Encloses (Real.log ((1 - (binaryParameter (shape 4 1 3) (shape 2 0 2) : ℝ)))) := by + exact checkLog_sound logTwoBall_sound (B4_1_3U2_0_2OneD_sound) (w := B4_1_3U2_0_2EOneDLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def B4_1_3U2_0_2EOneD : Ball := ⟨(4549397222525076198823402378749 / 50000000000000000000000000000000), (19148810313 / 50000000000000000000000000000000)⟩ +lemma B4_1_3U2_0_2EOneD_sound : B4_1_3U2_0_2EOneD.Encloses (Foundation.entropyTerm ((1 - (binaryParameter (shape 4 1 3) (shape 2 0 2) : ℝ)))) := by + exact contains_sound (entropyTerm_ball (B4_1_3U2_0_2OneD_sound) B4_1_3U2_0_2EOneDLog_sound) (by decide +kernel) +def B4_1_3U2_0_2BinaryEntropy : Ball := ⟨(38193262863824220702139553363313 / 100000000000000000000000000000000), (2624335711 / 5000000000000000000000000000000)⟩ +lemma B4_1_3U2_0_2BinaryEntropy_sound : B4_1_3U2_0_2BinaryEntropy.Encloses + (binaryEntropyRate (binaryParameter (shape 4 1 3) (shape 2 0 2))) := by + exact contains_sound (Ball.add_sound (Ball.add_sound B4_1_3U2_0_2EOneD_sound B4_1_3U2_0_2ED_sound) + (Ball.mul_sound B4_1_3U2_0_2D_sound logN2_sound)) (by decide +kernel) +def B4_1_3U2_0_2Leaf : Ball := ⟨(82317200073064604397677413451807 / 25000000000000000000000000000000), (5230611753 / 3125000000000000000000000000000)⟩ +lemma B4_1_3U2_0_2Leaf_sound : B4_1_3U2_0_2Leaf.Encloses (AllFieldTerminalRates.secondLeafRate (shape 4 1 3) (shape 2 0 2)) := by + have hh : shapeMax (shape 2 0 2) = 2 := by decide +kernel + have hp : positive (shape 2 0 2) = false := by decide +kernel + simp only [AllFieldTerminalRates.secondLeafRate, hh, hp, Bool.not_false, + show (2 : ℕ) ≠ 4 by decide, show (2 : ℕ) ≠ 3 by decide, ite_false, ite_true] + exact contains_sound (Ball.add_sound B4_1_3U2_0_2BinaryEntropy_sound + (Ball.mul_sound (Ball.mul_sound (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) + B4_1_3U2_0_2OneD_sound) logN5_sound)) (by decide +kernel) +def B4_1_3U2_0_2Mass : Ball := ⟨(965760487306589437428352637319 / 50000000000000000000000000000000), (1 / 4000000000000000000000000000000)⟩ +lemma B4_1_3U2_0_2Mass_sound : B4_1_3U2_0_2Mass.Encloses (littleMass (shape 4 1 3) (shape 2 0 2) : ℝ) := by + rw [littleMass_cast] + exact contains_sound (Ball.mul_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) (second_4_1_3)) + (B4_1_3Law_sound (shape 2 0 2))) (by decide +kernel) +def B4_1_3U2_1_1D : Ball := .exact (3031 / 1000000) +lemma B4_1_3U2_1_1D_sound : B4_1_3U2_1_1D.Encloses (binaryParameter (shape 4 1 3) (shape 2 1 1) : ℝ) := by + apply exact_rat_enclosed + decide +kernel +def B4_1_3U2_1_1OneD : Ball := .exact (996969 / 1000000) +lemma B4_1_3U2_1_1OneD_sound : B4_1_3U2_1_1OneD.Encloses (1 - (binaryParameter (shape 4 1 3) (shape 2 1 1) : ℝ)) := by + have he : binaryParameter (shape 4 1 3) (shape 2 1 1) = (3031 / 1000000) := by decide +kernel + rw [he] + convert Ball.exact_sound ((996969 / 1000000) : ℚ) using 1 <;> norm_num [B4_1_3U2_1_1OneD, Ball.exact] +def B4_1_3U2_1_1EDLogWitness : LogWitness := ⟨-9, 24248, 15625⟩ +def B4_1_3U2_1_1EDLog : Ball := ⟨(-579886268090647095228230969209657 / 100000000000000000000000000000000), (21175823683 / 10000000000000000000000000000000)⟩ +lemma B4_1_3U2_1_1EDLog_sound : B4_1_3U2_1_1EDLog.Encloses (Real.log ((binaryParameter (shape 4 1 3) (shape 2 1 1) : ℝ))) := by + exact checkLog_sound logTwoBall_sound (B4_1_3U2_1_1D_sound) (w := B4_1_3U2_1_1EDLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def B4_1_3U2_1_1ED : Ball := ⟨(878817639291375672818384033837 / 50000000000000000000000000000000), (641839217 / 100000000000000000000000000000000)⟩ +lemma B4_1_3U2_1_1ED_sound : B4_1_3U2_1_1ED.Encloses (Foundation.entropyTerm ((binaryParameter (shape 4 1 3) (shape 2 1 1) : ℝ))) := by + exact contains_sound (entropyTerm_ball (B4_1_3U2_1_1D_sound) B4_1_3U2_1_1EDLog_sound) (by decide +kernel) +def B4_1_3U2_1_1EOneDLogWitness : LogWitness := ⟨-1, 996969, 500000⟩ +def B4_1_3U2_1_1EOneDLog : Ball := ⟨(-2371564674643973779035589817 / 781250000000000000000000000000), (21175823683 / 50000000000000000000000000000000)⟩ +lemma B4_1_3U2_1_1EOneDLog_sound : B4_1_3U2_1_1EOneDLog.Encloses (Real.log ((1 - (binaryParameter (shape 4 1 3) (shape 2 1 1) : ℝ)))) := by + exact checkLog_sound logTwoBall_sound (B4_1_3U2_1_1OneD_sound) (w := B4_1_3U2_1_1EOneDLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def B4_1_3U2_1_1EOneD : Ball := ⟨(151320093575368185248725308433 / 50000000000000000000000000000000), (42223279523 / 100000000000000000000000000000000)⟩ +lemma B4_1_3U2_1_1EOneD_sound : B4_1_3U2_1_1EOneD.Encloses (Foundation.entropyTerm ((1 - (binaryParameter (shape 4 1 3) (shape 2 1 1) : ℝ)))) := by + exact contains_sound (entropyTerm_ball (B4_1_3U2_1_1OneD_sound) B4_1_3U2_1_1EOneDLog_sound) (by decide +kernel) +def B4_1_3U2_1_1BinaryEntropy : Ball := ⟨(567592094040301784854645420669 / 25000000000000000000000000000000), (5374185823 / 12500000000000000000000000000000)⟩ +lemma B4_1_3U2_1_1BinaryEntropy_sound : B4_1_3U2_1_1BinaryEntropy.Encloses + (binaryEntropyRate (binaryParameter (shape 4 1 3) (shape 2 1 1))) := by + exact contains_sound (Ball.add_sound (Ball.add_sound B4_1_3U2_1_1EOneD_sound B4_1_3U2_1_1ED_sound) + (Ball.mul_sound B4_1_3U2_1_1D_sound logN2_sound)) (by decide +kernel) +def B4_1_3U2_1_1Leaf : Ball := ⟨(40174970231945162387076287528143 / 12500000000000000000000000000000), (63431195167 / 50000000000000000000000000000000)⟩ +lemma B4_1_3U2_1_1Leaf_sound : B4_1_3U2_1_1Leaf.Encloses (AllFieldTerminalRates.secondLeafRate (shape 4 1 3) (shape 2 1 1)) := by + have hh : shapeMax (shape 2 1 1) = 2 := by decide +kernel + have hp : positive (shape 2 1 1) = true := by decide +kernel + simp only [AllFieldTerminalRates.secondLeafRate, hh, hp, Bool.not_true, Bool.false_eq_true, + show (2 : ℕ) ≠ 4 by decide, show (2 : ℕ) ≠ 3 by decide, ite_false] + have ht : (Ball.exact (1996969 / 1000000)).Encloses (2 - (binaryParameter (shape 4 1 3) (shape 2 1 1) : ℝ)) := by + have he : binaryParameter (shape 4 1 3) (shape 2 1 1) = (3031 / 1000000) := by decide +kernel + rw [he] + convert Ball.exact_sound ((1996969 / 1000000) : ℚ) using 1 + norm_num [Ball.exact] + exact contains_sound (Ball.mul_sound ht logN5_sound) (by decide +kernel) +def B4_1_3U2_1_1Mass : Ball := ⟨(965760487306589437428352637319 / 50000000000000000000000000000000), (1 / 4000000000000000000000000000000)⟩ +lemma B4_1_3U2_1_1Mass_sound : B4_1_3U2_1_1Mass.Encloses (littleMass (shape 4 1 3) (shape 2 1 1) : ℝ) := by + rw [littleMass_cast] + exact contains_sound (Ball.mul_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) (second_4_1_3)) + (B4_1_3Law_sound (shape 2 1 1))) (by decide +kernel) +def B4_1_3U3_0_1Leaf : Ball := ⟨(115129254649702284200899544090987 / 50000000000000000000000000000000), (21175823683 / 25000000000000000000000000000000)⟩ +lemma B4_1_3U3_0_1Leaf_sound : B4_1_3U3_0_1Leaf.Encloses (AllFieldTerminalRates.secondLeafRate (shape 4 1 3) (shape 3 0 1)) := by + have hh : shapeMax (shape 3 0 1) = 3 := by decide +kernel + simp only [AllFieldTerminalRates.secondLeafRate, hh, show (3 : ℕ) ≠ 4 by decide, ite_false, ite_true] + exact logN10_sound +def B4_1_3U3_0_1Mass : Ball := ⟨(301558202689444043590391085003 / 100000000000000000000000000000000), (1 / 20000000000000000000000000000000)⟩ +lemma B4_1_3U3_0_1Mass_sound : B4_1_3U3_0_1Mass.Encloses (littleMass (shape 4 1 3) (shape 3 0 1) : ℝ) := by + rw [littleMass_cast] + exact contains_sound (Ball.mul_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) (second_4_1_3)) + (B4_1_3Law_sound (shape 3 0 1))) (by decide +kernel) +def B4_1_3U3_1_0Leaf : Ball := ⟨(115129254649702284200899544090987 / 50000000000000000000000000000000), (21175823683 / 25000000000000000000000000000000)⟩ +lemma B4_1_3U3_1_0Leaf_sound : B4_1_3U3_1_0Leaf.Encloses (AllFieldTerminalRates.secondLeafRate (shape 4 1 3) (shape 3 1 0)) := by + have hh : shapeMax (shape 3 1 0) = 3 := by decide +kernel + simp only [AllFieldTerminalRates.secondLeafRate, hh, show (3 : ℕ) ≠ 4 by decide, ite_false, ite_true] + exact logN10_sound +def B4_1_3U3_1_0Mass : Ball := ⟨(59249837730323733309452320717 / 100000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ +lemma B4_1_3U3_1_0Mass_sound : B4_1_3U3_1_0Mass.Encloses (littleMass (shape 4 1 3) (shape 3 1 0) : ℝ) := by + rw [littleMass_cast] + exact contains_sound (Ball.mul_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) (second_4_1_3)) + (B4_1_3Law_sound (shape 3 1 0))) (by decide +kernel) +def B4_1_3U4_0_0Leaf : Ball := ⟨0, 0⟩ +lemma B4_1_3U4_0_0Leaf_sound : B4_1_3U4_0_0Leaf.Encloses (AllFieldTerminalRates.secondLeafRate (shape 4 1 3) (shape 4 0 0)) := by + have hh : shapeMax (shape 4 0 0) = 4 := by decide +kernel + simp only [AllFieldTerminalRates.secondLeafRate, hh, ite_true] + simpa only [Rat.cast_zero, B4_1_3U4_0_0Leaf, Ball.exact] using Ball.exact_sound 0 +def B4_1_3U4_0_0Mass : Ball := ⟨(1534436237026567284168100653 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ +lemma B4_1_3U4_0_0Mass_sound : B4_1_3U4_0_0Mass.Encloses (littleMass (shape 4 1 3) (shape 4 0 0) : ℝ) := by + rw [littleMass_cast] + exact contains_sound (Ball.mul_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) (second_4_1_3)) + (B4_1_3Law_sound (shape 4 0 0))) (by decide +kernel) +def B4_1_3Leaves (s : Shape) : Ball := + match s 0, s 1, s 2 with + | 0, 1, 3 => B4_1_3U0_1_3Leaf + | 1, 0, 3 => B4_1_3U1_0_3Leaf + | 1, 1, 2 => B4_1_3U1_1_2Leaf + | 2, 0, 2 => B4_1_3U2_0_2Leaf + | 2, 1, 1 => B4_1_3U2_1_1Leaf + | 3, 0, 1 => B4_1_3U3_0_1Leaf + | 3, 1, 0 => B4_1_3U3_1_0Leaf + | 4, 0, 0 => B4_1_3U4_0_0Leaf + | _, _, _ => (.exact 0) +lemma B4_1_3Leaves_sound (u : Shape) (hu : u ∈ below (shape 4 1 3)) : + (B4_1_3Leaves u).Encloses (AllFieldTerminalRates.secondLeafRate (shape 4 1 3) u) := by + rw [B4_1_3_below] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl + · exact B4_1_3U0_1_3Leaf_sound + · exact B4_1_3U1_0_3Leaf_sound + · exact B4_1_3U1_1_2Leaf_sound + · exact B4_1_3U2_0_2Leaf_sound + · exact B4_1_3U2_1_1Leaf_sound + · exact B4_1_3U3_0_1Leaf_sound + · exact B4_1_3U3_1_0Leaf_sound + · exact B4_1_3U4_0_0Leaf_sound +def B4_1_3Masses (s : Shape) : Ball := + match s 0, s 1, s 2 with + | 0, 1, 3 => B4_1_3U0_1_3Mass + | 1, 0, 3 => B4_1_3U1_0_3Mass + | 1, 1, 2 => B4_1_3U1_1_2Mass + | 2, 0, 2 => B4_1_3U2_0_2Mass + | 2, 1, 1 => B4_1_3U2_1_1Mass + | 3, 0, 1 => B4_1_3U3_0_1Mass + | 3, 1, 0 => B4_1_3U3_1_0Mass + | 4, 0, 0 => B4_1_3U4_0_0Mass + | _, _, _ => (.exact 0) +lemma B4_1_3Masses_sound (u : Shape) (hu : u ∈ below (shape 4 1 3)) : + (B4_1_3Masses u).Encloses ((fun u => (littleMass (shape 4 1 3) u : ℝ)) u) := by + rw [B4_1_3_below] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl + · exact B4_1_3U0_1_3Mass_sound + · exact B4_1_3U1_0_3Mass_sound + · exact B4_1_3U1_1_2Mass_sound + · exact B4_1_3U2_0_2Mass_sound + · exact B4_1_3U2_1_1Mass_sound + · exact B4_1_3U3_0_1Mass_sound + · exact B4_1_3U3_1_0Mass_sound + · exact B4_1_3U4_0_0Mass_sound +def B4_1_3Binaries (s : Shape) : Ball := + match s 0, s 1, s 2 with + | 1, 1, 2 => B4_1_3U1_1_2BinaryEntropy + | 2, 0, 2 => B4_1_3U2_0_2BinaryEntropy + | 2, 1, 1 => B4_1_3U2_1_1BinaryEntropy + | _, _, _ => (.exact 0) +lemma B4_1_3Binaries_sound (u : Shape) (hu : u ∈ (below (shape 4 1 3)).filter positive) : + (B4_1_3Binaries u).Encloses ((fun u => binaryEntropyRate (binaryParameter (shape 4 1 3) u)) u) := by + have hl : (below (shape 4 1 3)).filter positive = [(shape 1 1 2), (shape 2 1 1)] := by decide +kernel + rw [hl] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl + · exact B4_1_3U1_1_2BinaryEntropy_sound + · exact B4_1_3U2_1_1BinaryEntropy_sound +def B4_1_3S2 : Ball := ⟨(14488912584849512791622540958653 / 100000000000000000000000000000000), (6415572889 / 100000000000000000000000000000000)⟩ +lemma B4_1_3S2_sound : B4_1_3S2.Encloses + (((below (shape 4 1 3)).map fun u => (littleMass (shape 4 1 3) u : ℝ) * AllFieldTerminalRates.secondLeafRate (shape 4 1 3) u).sum) := by + exact contains_sound (listSumBall_sound (below (shape 4 1 3)) + (fun u => .mul (B4_1_3Masses u) (B4_1_3Leaves u)) _ + (fun u hu => Ball.mul_sound (B4_1_3Masses_sound u hu) (B4_1_3Leaves_sound u hu))) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/Certificates/Terminal4_2_2.lean b/lean/OAI/LinearAlgebra/MatrixFields/Certificates/Terminal4_2_2.lean new file mode 100644 index 0000000000000000000000000000000000000000..1fd3d04da8ae2f12364ab2dee8f30d8dd50a29f2 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/Certificates/Terminal4_2_2.lean @@ -0,0 +1,739 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Certificates.LittleB1_3_4 +import OAI.LinearAlgebra.MatrixFields.Certificates.Terminal1_1_6 + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate +open scoped BigOperators +lemma B4_2_2_below : below (shape 4 2 2) = [ + (shape 0 2 2), + (shape 1 1 2), + (shape 1 2 1), + (shape 2 0 2), + (shape 2 1 1), + (shape 2 2 0), + (shape 3 0 1), + (shape 3 1 0), + (shape 4 0 0)] := by decide +kernel +def B4_2_2Raw (s : Shape) : Ball := + match s 0, s 1, s 2 with + | 0, 2, 2 => ⟨(59580328744584746699210039469 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 1, 1, 2 => ⟨(3551332927065966816059043009887 / 50000000000000000000000000000000), (19 / 100000000000000000000000000000000)⟩ + | 1, 2, 1 => ⟨(7099825355927794995680046054547 / 100000000000000000000000000000000), (9 / 50000000000000000000000000000000)⟩ + | 2, 0, 2 => ⟨(26216007198693794473744704647899 / 100000000000000000000000000000000), (1 / 1562500000000000000000000000000)⟩ + | 2, 1, 1 => ⟨1, 0⟩ + | 2, 2, 0 => ⟨(26216007198693794473744704647899 / 100000000000000000000000000000000), (1 / 1562500000000000000000000000000)⟩ + | 3, 0, 1 => ⟨(7099825355927794995680046054547 / 100000000000000000000000000000000), (9 / 50000000000000000000000000000000)⟩ + | 3, 1, 0 => ⟨(3551332927065966816059043009887 / 50000000000000000000000000000000), (19 / 100000000000000000000000000000000)⟩ + | 4, 0, 0 => ⟨(59580328744584746699210039469 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | _, _, _ => (.exact 0) +lemma B4_2_2Raw_0_2_2 : (B4_2_2Raw (shape 0 2 2)).Encloses (splitWeight positiveSecond tablep (shape 4 2 2) (shape 0 2 2) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveSecond tablep (shape 4 2 2) (shape 0 2 2) + (-60868) (-6696) (-6692) w21 w150 w151 + (by decide +kernel) w21_sound w150_sound w151_sound) (by decide +kernel) +lemma B4_2_2Raw_1_1_2 : (B4_2_2Raw (shape 1 1 2)).Encloses (splitWeight positiveSecond tablep (shape 4 2 2) (shape 1 1 2) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveSecond tablep (shape 4 2 2) (shape 1 1 2) + (-19755) (0) (-6692) w88 w195 w151 + (by decide +kernel) w88_sound w195_sound w151_sound) (by decide +kernel) +lemma B4_2_2Raw_1_2_1 : (B4_2_2Raw (shape 1 2 1)).Encloses (splitWeight positiveSecond tablep (shape 4 2 2) (shape 1 2 1) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveSecond tablep (shape 4 2 2) (shape 1 2 1) + (-19755) (-6696) (0) w88 w150 w195 + (by decide +kernel) w88_sound w150_sound w195_sound) (by decide +kernel) +lemma B4_2_2Raw_2_0_2 : (B4_2_2Raw (shape 2 0 2)).Encloses (splitWeight positiveSecond tablep (shape 4 2 2) (shape 2 0 2) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveSecond tablep (shape 4 2 2) (shape 2 0 2) + (0) (-6696) (-6692) w195 w150 w151 + (by decide +kernel) w195_sound w150_sound w151_sound) (by decide +kernel) +lemma B4_2_2Raw_2_1_1 : (B4_2_2Raw (shape 2 1 1)).Encloses (splitWeight positiveSecond tablep (shape 4 2 2) (shape 2 1 1) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveSecond tablep (shape 4 2 2) (shape 2 1 1) + (0) (0) (0) w195 w195 w195 + (by decide +kernel) w195_sound w195_sound w195_sound) (by decide +kernel) +lemma B4_2_2Raw_2_2_0 : (B4_2_2Raw (shape 2 2 0)).Encloses (splitWeight positiveSecond tablep (shape 4 2 2) (shape 2 2 0) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveSecond tablep (shape 4 2 2) (shape 2 2 0) + (0) (-6696) (-6692) w195 w150 w151 + (by decide +kernel) w195_sound w150_sound w151_sound) (by decide +kernel) +lemma B4_2_2Raw_3_0_1 : (B4_2_2Raw (shape 3 0 1)).Encloses (splitWeight positiveSecond tablep (shape 4 2 2) (shape 3 0 1) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveSecond tablep (shape 4 2 2) (shape 3 0 1) + (-19755) (-6696) (0) w88 w150 w195 + (by decide +kernel) w88_sound w150_sound w195_sound) (by decide +kernel) +lemma B4_2_2Raw_3_1_0 : (B4_2_2Raw (shape 3 1 0)).Encloses (splitWeight positiveSecond tablep (shape 4 2 2) (shape 3 1 0) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveSecond tablep (shape 4 2 2) (shape 3 1 0) + (-19755) (0) (-6692) w88 w195 w151 + (by decide +kernel) w88_sound w195_sound w151_sound) (by decide +kernel) +lemma B4_2_2Raw_4_0_0 : (B4_2_2Raw (shape 4 0 0)).Encloses (splitWeight positiveSecond tablep (shape 4 2 2) (shape 4 0 0) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveSecond tablep (shape 4 2 2) (shape 4 0 0) + (-60868) (-6696) (-6692) w21 w150 w151 + (by decide +kernel) w21_sound w150_sound w151_sound) (by decide +kernel) +lemma B4_2_2Raw_sound (u : Shape) (hu : u ∈ below (shape 4 2 2)) : + (B4_2_2Raw u).Encloses (splitWeight positiveSecond tablep (shape 4 2 2) u : ℝ) := by + rw [B4_2_2_below] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl + · exact B4_2_2Raw_0_2_2 + · exact B4_2_2Raw_1_1_2 + · exact B4_2_2Raw_1_2_1 + · exact B4_2_2Raw_2_0_2 + · exact B4_2_2Raw_2_1_1 + · exact B4_2_2Raw_2_2_0 + · exact B4_2_2Raw_3_0_1 + · exact B4_2_2Raw_3_1_0 + · exact B4_2_2Raw_4_0_0 +def B4_2_2Den : Ball := ⟨(90478078737498107848242046761689 / 50000000000000000000000000000000), (51 / 25000000000000000000000000000000)⟩ +lemma B4_2_2Den_sound : B4_2_2Den.Encloses (((below (shape 4 2 2)).map (splitWeight positiveSecond tablep (shape 4 2 2))).sum : ℝ) := by + exact contains_sound (list_cast_enclosed (below (shape 4 2 2)) B4_2_2Raw (splitWeight positiveSecond tablep (shape 4 2 2)) B4_2_2Raw_sound) (by decide +kernel) +lemma B4_2_2Den_positive : 0 < B4_2_2Den.lower := by decide +kernel +def B4_2_2Table (s : Shape) : Ball := + match s 0, s 1, s 2 with + | 0, 2, 2 => ⟨(32925283989199048774667657891 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 1, 1, 2 => ⟨(1962537764185601435248786401077 / 50000000000000000000000000000000), (3 / 20000000000000000000000000000000)⟩ + | 1, 2, 1 => ⟨(980876453031008343288822515281 / 25000000000000000000000000000000), (3 / 20000000000000000000000000000000)⟩ + | 2, 0, 2 => ⟨(7243745547126854607846925140589 / 50000000000000000000000000000000), (53 / 100000000000000000000000000000000)⟩ + | 2, 1, 1 => ⟨(11052400912504742196751447679061 / 20000000000000000000000000000000), (63 / 100000000000000000000000000000000)⟩ + | 2, 2, 0 => ⟨(7243745547126854607846925140589 / 50000000000000000000000000000000), (53 / 100000000000000000000000000000000)⟩ + | 3, 0, 1 => ⟨(980876453031008343288822515281 / 25000000000000000000000000000000), (3 / 20000000000000000000000000000000)⟩ + | 3, 1, 0 => ⟨(1962537764185601435248786401077 / 50000000000000000000000000000000), (3 / 20000000000000000000000000000000)⟩ + | 4, 0, 0 => ⟨(32925283989199048774667657891 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | _, _, _ => (.exact 0) +def B4_2_2Law (u : Shape) : Ball := if u ∈ below (shape 4 2 2) then B4_2_2Table u else .exact 0 +lemma B4_2_2Law_check_0_2_2 : contains (.mul (B4_2_2Raw (shape 0 2 2)) (.inv B4_2_2Den)) (B4_2_2Table (shape 0 2 2)) = true := by decide +kernel +lemma B4_2_2Law_check_1_1_2 : contains (.mul (B4_2_2Raw (shape 1 1 2)) (.inv B4_2_2Den)) (B4_2_2Table (shape 1 1 2)) = true := by decide +kernel +lemma B4_2_2Law_check_1_2_1 : contains (.mul (B4_2_2Raw (shape 1 2 1)) (.inv B4_2_2Den)) (B4_2_2Table (shape 1 2 1)) = true := by decide +kernel +lemma B4_2_2Law_check_2_0_2 : contains (.mul (B4_2_2Raw (shape 2 0 2)) (.inv B4_2_2Den)) (B4_2_2Table (shape 2 0 2)) = true := by decide +kernel +lemma B4_2_2Law_check_2_1_1 : contains (.mul (B4_2_2Raw (shape 2 1 1)) (.inv B4_2_2Den)) (B4_2_2Table (shape 2 1 1)) = true := by decide +kernel +lemma B4_2_2Law_check_2_2_0 : contains (.mul (B4_2_2Raw (shape 2 2 0)) (.inv B4_2_2Den)) (B4_2_2Table (shape 2 2 0)) = true := by decide +kernel +lemma B4_2_2Law_check_3_0_1 : contains (.mul (B4_2_2Raw (shape 3 0 1)) (.inv B4_2_2Den)) (B4_2_2Table (shape 3 0 1)) = true := by decide +kernel +lemma B4_2_2Law_check_3_1_0 : contains (.mul (B4_2_2Raw (shape 3 1 0)) (.inv B4_2_2Den)) (B4_2_2Table (shape 3 1 0)) = true := by decide +kernel +lemma B4_2_2Law_check_4_0_0 : contains (.mul (B4_2_2Raw (shape 4 0 0)) (.inv B4_2_2Den)) (B4_2_2Table (shape 4 0 0)) = true := by decide +kernel +lemma B4_2_2Law_check (u : Shape) (hu : u ∈ below (shape 4 2 2)) : + contains (.mul (B4_2_2Raw u) (.inv B4_2_2Den)) (B4_2_2Table u) = true := by + rw [B4_2_2_below] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl + · exact B4_2_2Law_check_0_2_2 + · exact B4_2_2Law_check_1_1_2 + · exact B4_2_2Law_check_1_2_1 + · exact B4_2_2Law_check_2_0_2 + · exact B4_2_2Law_check_2_1_1 + · exact B4_2_2Law_check_2_2_0 + · exact B4_2_2Law_check_3_0_1 + · exact B4_2_2Law_check_3_1_0 + · exact B4_2_2Law_check_4_0_0 +lemma B4_2_2Law_sound (u : Shape) : + (B4_2_2Law u).Encloses (stageBLaw (shape 4 2 2) u : ℝ) := by + by_cases hu : u ∈ below (shape 4 2 2) + · have h := contains_sound (Ball.mul_sound (B4_2_2Raw_sound u hu) + (Ball.inv_sound B4_2_2Den_sound B4_2_2Den_positive)) (B4_2_2Law_check u hu) + simpa only [B4_2_2Law, hu, ite_true, stageBLaw, splitLaw, + Rat.cast_div, Rat.cast_mul, Rat.cast_inv, div_eq_mul_inv] using h + · simp only [B4_2_2Law, hu, ite_false, stageBLaw, splitLaw, Rat.cast_zero] + simpa only [Rat.cast_zero] using Ball.exact_sound 0 + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def B4_2_2Binary (u : Shape) : ℚ := + match u 0, u 1, u 2 with + | 0, 2, 2 => (63321 / 1000000) + | 1, 1, 2 => (1051 / 25000) + | 1, 2, 1 => (21087 / 500000) + | 2, 0, 2 => (52331 / 500000) + | 2, 1, 1 => (593 / 50000) + | 2, 2, 0 => (52451 / 500000) + | _, _, _ => 0 +lemma B4_2_2Binary_eq (u : Shape) (hu : u ∈ shapes 4) : + binaryParameter (shape 4 2 2) u = B4_2_2Binary u := by + rw [shapes4_list] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel +def B4_2_2LittleRat (u : Shape) (w : Fin 3) (i : Fin 6) : ℚ := + if u w = 2 then + if i = 2 then 1 - B4_2_2Binary u else if i = 3 then B4_2_2Binary u else 0 + else if i = singletonSlot (u w) then 1 else 0 + +def B4_2_2Little (u : Shape) (w : Fin 3) (i : Fin 6) : Ball := + if u ∈ shapes 4 then .exact (B4_2_2LittleRat u w i) + else .exact (littleLaw (shape 4 2 2) u w i) + +lemma B4_2_2Little_sound (u : Shape) (w : Fin 3) (i : Fin 6) : + (B4_2_2Little u w i).Encloses (littleLaw (shape 4 2 2) u w i : ℝ) := by + by_cases hu : u ∈ shapes 4 + · simp only [B4_2_2Little, hu, ite_true] + apply exact_rat_enclosed + simp only [B4_2_2LittleRat, littleLaw, B4_2_2Binary_eq u hu] + · simp only [B4_2_2Little, hu, ite_false] + exact Ball.exact_sound _ +def B4_2_2Half (w : Fin 3) (ij : PairSlot) : Ball := + match w.val, ij.1.val, ij.2.val with + | 0, 0, 5 => ⟨(32925283989199048774667657891 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 0, 1, 4 => ⟨(3924290670247618121826431431639 / 50000000000000000000000000000000), (3 / 10000000000000000000000000000000)⟩ + | 0, 2, 2 => ⟨(77179955630623675545342364672979 / 100000000000000000000000000000000), (147 / 100000000000000000000000000000000)⟩ + | 0, 2, 3 => ⟨(3365567162619738339457547396989 / 100000000000000000000000000000000), (11 / 100000000000000000000000000000000)⟩ + | 0, 3, 2 => ⟨(3365567162619738339457547396989 / 100000000000000000000000000000000), (11 / 100000000000000000000000000000000)⟩ + | 0, 3, 3 => ⟨(20368549697998574430467468169 / 6250000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ + | 0, 4, 1 => ⟨(3924290670247618121826431431639 / 50000000000000000000000000000000), (3 / 10000000000000000000000000000000)⟩ + | 0, 5, 0 => ⟨(32925283989199048774667657891 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 1, 2, 0 => ⟨(8378300301784769988516089892097 / 50000000000000000000000000000000), (1 / 1562500000000000000000000000000)⟩ + | 1, 3, 0 => ⟨(1687321586797401660591628215999 / 100000000000000000000000000000000), (7 / 100000000000000000000000000000000)⟩ + | 1, 1, 1 => ⟨(63112155619266116724752383999613 / 100000000000000000000000000000000), (93 / 100000000000000000000000000000000)⟩ + | 1, 0, 2 => ⟨(8378300301784769988516089892097 / 50000000000000000000000000000000), (1 / 1562500000000000000000000000000)⟩ + | 1, 0, 3 => ⟨(1687321586797401660591628215999 / 100000000000000000000000000000000), (7 / 100000000000000000000000000000000)⟩ + | 2, 2, 0 => ⟨(8381053538293561989694981145863 / 50000000000000000000000000000000), (1 / 1562500000000000000000000000000)⟩ + | 2, 3, 0 => ⟨(1683384830026987155576128449497 / 100000000000000000000000000000000), (7 / 100000000000000000000000000000000)⟩ + | 2, 1, 1 => ⟨(63109016186771777730067818517553 / 100000000000000000000000000000000), (93 / 100000000000000000000000000000000)⟩ + | 2, 0, 2 => ⟨(8381053538293561989694981145863 / 50000000000000000000000000000000), (1 / 1562500000000000000000000000000)⟩ + | 2, 0, 3 => ⟨(1683384830026987155576128449497 / 100000000000000000000000000000000), (7 / 100000000000000000000000000000000)⟩ + | _, _, _ => (.exact 0) +lemma B4_2_2Half_check_0_0 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 4 2 2)) (shape 4 2 2) B4_2_2Law + (fun u => B4_2_2Little u 0) ((0 : Fin 6),j)) (B4_2_2Half 0 (0,j)) = true := by + decide +kernel +lemma B4_2_2Half_check_0_1 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 4 2 2)) (shape 4 2 2) B4_2_2Law + (fun u => B4_2_2Little u 0) ((1 : Fin 6),j)) (B4_2_2Half 0 (1,j)) = true := by + decide +kernel +lemma B4_2_2Half_check_0_2 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 4 2 2)) (shape 4 2 2) B4_2_2Law + (fun u => B4_2_2Little u 0) ((2 : Fin 6),j)) (B4_2_2Half 0 (2,j)) = true := by + decide +kernel +lemma B4_2_2Half_check_0_3 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 4 2 2)) (shape 4 2 2) B4_2_2Law + (fun u => B4_2_2Little u 0) ((3 : Fin 6),j)) (B4_2_2Half 0 (3,j)) = true := by + decide +kernel +lemma B4_2_2Half_check_0_4 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 4 2 2)) (shape 4 2 2) B4_2_2Law + (fun u => B4_2_2Little u 0) ((4 : Fin 6),j)) (B4_2_2Half 0 (4,j)) = true := by + decide +kernel +lemma B4_2_2Half_check_0_5 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 4 2 2)) (shape 4 2 2) B4_2_2Law + (fun u => B4_2_2Little u 0) ((5 : Fin 6),j)) (B4_2_2Half 0 (5,j)) = true := by + decide +kernel +lemma B4_2_2Half_check_1_0 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 4 2 2)) (shape 4 2 2) B4_2_2Law + (fun u => B4_2_2Little u 1) ((0 : Fin 6),j)) (B4_2_2Half 1 (0,j)) = true := by + decide +kernel +lemma B4_2_2Half_check_1_1 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 4 2 2)) (shape 4 2 2) B4_2_2Law + (fun u => B4_2_2Little u 1) ((1 : Fin 6),j)) (B4_2_2Half 1 (1,j)) = true := by + decide +kernel +lemma B4_2_2Half_check_1_2 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 4 2 2)) (shape 4 2 2) B4_2_2Law + (fun u => B4_2_2Little u 1) ((2 : Fin 6),j)) (B4_2_2Half 1 (2,j)) = true := by + decide +kernel +lemma B4_2_2Half_check_1_3 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 4 2 2)) (shape 4 2 2) B4_2_2Law + (fun u => B4_2_2Little u 1) ((3 : Fin 6),j)) (B4_2_2Half 1 (3,j)) = true := by + decide +kernel +lemma B4_2_2Half_check_1_4 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 4 2 2)) (shape 4 2 2) B4_2_2Law + (fun u => B4_2_2Little u 1) ((4 : Fin 6),j)) (B4_2_2Half 1 (4,j)) = true := by + decide +kernel +lemma B4_2_2Half_check_1_5 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 4 2 2)) (shape 4 2 2) B4_2_2Law + (fun u => B4_2_2Little u 1) ((5 : Fin 6),j)) (B4_2_2Half 1 (5,j)) = true := by + decide +kernel +lemma B4_2_2Half_check_2_0 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 4 2 2)) (shape 4 2 2) B4_2_2Law + (fun u => B4_2_2Little u 2) ((0 : Fin 6),j)) (B4_2_2Half 2 (0,j)) = true := by + decide +kernel +lemma B4_2_2Half_check_2_1 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 4 2 2)) (shape 4 2 2) B4_2_2Law + (fun u => B4_2_2Little u 2) ((1 : Fin 6),j)) (B4_2_2Half 2 (1,j)) = true := by + decide +kernel +lemma B4_2_2Half_check_2_2 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 4 2 2)) (shape 4 2 2) B4_2_2Law + (fun u => B4_2_2Little u 2) ((2 : Fin 6),j)) (B4_2_2Half 2 (2,j)) = true := by + decide +kernel +lemma B4_2_2Half_check_2_3 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 4 2 2)) (shape 4 2 2) B4_2_2Law + (fun u => B4_2_2Little u 2) ((3 : Fin 6),j)) (B4_2_2Half 2 (3,j)) = true := by + decide +kernel +lemma B4_2_2Half_check_2_4 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 4 2 2)) (shape 4 2 2) B4_2_2Law + (fun u => B4_2_2Little u 2) ((4 : Fin 6),j)) (B4_2_2Half 2 (4,j)) = true := by + decide +kernel +lemma B4_2_2Half_check_2_5 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 4 2 2)) (shape 4 2 2) B4_2_2Law + (fun u => B4_2_2Little u 2) ((5 : Fin 6),j)) (B4_2_2Half 2 (5,j)) = true := by + decide +kernel +lemma B4_2_2Half_sound (w : Fin 3) (ij : PairSlot) : + (B4_2_2Half w ij).Encloses (halfLaw (shape 4 2 2) w ij : ℝ) := by + have hcheck : contains (pairLawBall (below (shape 4 2 2)) (shape 4 2 2) B4_2_2Law + (fun u => B4_2_2Little u w) ij) (B4_2_2Half w ij) = true := by + rcases ij with ⟨i,j⟩ + revert i w + apply forall_fin3 + · exact forall_fin6 (B4_2_2Half_check_0_0 j) (B4_2_2Half_check_0_1 j) (B4_2_2Half_check_0_2 j) (B4_2_2Half_check_0_3 j) (B4_2_2Half_check_0_4 j) (B4_2_2Half_check_0_5 j) + · exact forall_fin6 (B4_2_2Half_check_1_0 j) (B4_2_2Half_check_1_1 j) (B4_2_2Half_check_1_2 j) (B4_2_2Half_check_1_3 j) (B4_2_2Half_check_1_4 j) (B4_2_2Half_check_1_5 j) + · exact forall_fin6 (B4_2_2Half_check_2_0 j) (B4_2_2Half_check_2_1 j) (B4_2_2Half_check_2_2 j) (B4_2_2Half_check_2_3 j) (B4_2_2Half_check_2_4 j) (B4_2_2Half_check_2_5 j) + have h := contains_sound (pairLawBall_sound (below (shape 4 2 2)) (shape 4 2 2) + B4_2_2Law (fun u => (stageBLaw (shape 4 2 2) u : ℝ)) + (fun u => B4_2_2Little u w) (fun u i => (littleLaw (shape 4 2 2) u w i : ℝ)) + (fun u _ => B4_2_2Law_sound u) (fun u i => B4_2_2Little_sound u w i) ij) hcheck + have hp : positive (shape 4 2 2) = true := by decide +kernel + simpa only [halfLaw, hp, ite_true, pairLaw, positiveHalfLaw, Rat.cast_list_sum, + List.map_map, Function.comp_def, Rat.cast_mul] using h + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def B4_2_2U0_2_2D : Ball := .exact (63321 / 1000000) +lemma B4_2_2U0_2_2D_sound : B4_2_2U0_2_2D.Encloses (binaryParameter (shape 4 2 2) (shape 0 2 2) : ℝ) := by + apply exact_rat_enclosed + decide +kernel +def B4_2_2U0_2_2OneD : Ball := .exact (936679 / 1000000) +lemma B4_2_2U0_2_2OneD_sound : B4_2_2U0_2_2OneD.Encloses (1 - (binaryParameter (shape 4 2 2) (shape 0 2 2) : ℝ)) := by + have he : binaryParameter (shape 4 2 2) (shape 0 2 2) = (63321 / 1000000) := by decide +kernel + rw [he] + convert Ball.exact_sound ((936679 / 1000000) : ℚ) using 1 <;> norm_num [B4_2_2U0_2_2OneD, Ball.exact] +def B4_2_2U0_2_2EDLogWitness : LogWitness := ⟨-4, 63321, 62500⟩ +def B4_2_2U0_2_2EDLog : Ball := ⟨(-275953825129554669064816416181401 / 100000000000000000000000000000000), (52939559207 / 50000000000000000000000000000000)⟩ +lemma B4_2_2U0_2_2EDLog_sound : B4_2_2U0_2_2EDLog.Encloses (Real.log ((binaryParameter (shape 4 2 2) (shape 0 2 2) : ℝ))) := by + exact checkLog_sound logTwoBall_sound (B4_2_2U0_2_2D_sound) (w := B4_2_2U0_2_2EDLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def B4_2_2U0_2_2ED : Ball := ⟨(8736836080514265599926620144511 / 50000000000000000000000000000000), (3352185829 / 50000000000000000000000000000000)⟩ +lemma B4_2_2U0_2_2ED_sound : B4_2_2U0_2_2ED.Encloses (Foundation.entropyTerm ((binaryParameter (shape 4 2 2) (shape 0 2 2) : ℝ))) := by + exact contains_sound (entropyTerm_ball (B4_2_2U0_2_2D_sound) B4_2_2U0_2_2EDLog_sound) (by decide +kernel) +def B4_2_2U0_2_2EOneDLogWitness : LogWitness := ⟨-1, 936679, 500000⟩ +def B4_2_2U0_2_2EOneDLog : Ball := ⟨(-6541463814935642164057959379121 / 100000000000000000000000000000000), (21175823683 / 50000000000000000000000000000000)⟩ +lemma B4_2_2U0_2_2EOneDLog_sound : B4_2_2U0_2_2EOneDLog.Encloses (Real.log ((1 - (binaryParameter (shape 4 2 2) (shape 0 2 2) : ℝ)))) := by + exact checkLog_sound logTwoBall_sound (B4_2_2U0_2_2OneD_sound) (w := B4_2_2U0_2_2EOneDLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def B4_2_2U0_2_2EOneD : Ball := ⟨(1531812946177525591646911333319 / 25000000000000000000000000000000), (2479368669 / 6250000000000000000000000000000)⟩ +lemma B4_2_2U0_2_2EOneD_sound : B4_2_2U0_2_2EOneD.Encloses (Foundation.entropyTerm ((1 - (binaryParameter (shape 4 2 2) (shape 0 2 2) : ℝ)))) := by + exact contains_sound (entropyTerm_ball (B4_2_2U0_2_2OneD_sound) B4_2_2U0_2_2EOneDLog_sound) (by decide +kernel) +def B4_2_2U0_2_2BinaryEntropy : Ball := ⟨(13995000603881131630100869964719 / 50000000000000000000000000000000), (1962240761 / 4000000000000000000000000000000)⟩ +lemma B4_2_2U0_2_2BinaryEntropy_sound : B4_2_2U0_2_2BinaryEntropy.Encloses + (binaryEntropyRate (binaryParameter (shape 4 2 2) (shape 0 2 2))) := by + exact contains_sound (Ball.add_sound (Ball.add_sound B4_2_2U0_2_2EOneD_sound B4_2_2U0_2_2ED_sound) + (Ball.mul_sound B4_2_2U0_2_2D_sound logN2_sound)) (by decide +kernel) +def B4_2_2U0_2_2Leaf : Ball := ⟨(41186917510491800527041824835183 / 12500000000000000000000000000000), (33613143027 / 20000000000000000000000000000000)⟩ +lemma B4_2_2U0_2_2Leaf_sound : B4_2_2U0_2_2Leaf.Encloses (AllFieldTerminalRates.secondLeafRate (shape 4 2 2) (shape 0 2 2)) := by + have hh : shapeMax (shape 0 2 2) = 2 := by decide +kernel + have hp : positive (shape 0 2 2) = false := by decide +kernel + simp only [AllFieldTerminalRates.secondLeafRate, hh, hp, Bool.not_false, + show (2 : ℕ) ≠ 4 by decide, show (2 : ℕ) ≠ 3 by decide, ite_false, ite_true] + exact contains_sound (Ball.add_sound B4_2_2U0_2_2BinaryEntropy_sound + (Ball.mul_sound (Ball.mul_sound (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) + B4_2_2U0_2_2OneD_sound) logN5_sound)) (by decide +kernel) +def B4_2_2U0_2_2Mass : Ball := ⟨(491331029136091495330612073 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ +lemma B4_2_2U0_2_2Mass_sound : B4_2_2U0_2_2Mass.Encloses (littleMass (shape 4 2 2) (shape 0 2 2) : ℝ) := by + rw [littleMass_cast] + exact contains_sound (Ball.mul_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) (second_4_2_2)) + (B4_2_2Law_sound (shape 0 2 2))) (by decide +kernel) +def B4_2_2U1_1_2D : Ball := .exact (1051 / 25000) +lemma B4_2_2U1_1_2D_sound : B4_2_2U1_1_2D.Encloses (binaryParameter (shape 4 2 2) (shape 1 1 2) : ℝ) := by + apply exact_rat_enclosed + decide +kernel +def B4_2_2U1_1_2OneD : Ball := .exact (23949 / 25000) +lemma B4_2_2U1_1_2OneD_sound : B4_2_2U1_1_2OneD.Encloses (1 - (binaryParameter (shape 4 2 2) (shape 1 1 2) : ℝ)) := by + have he : binaryParameter (shape 4 2 2) (shape 1 1 2) = (1051 / 25000) := by decide +kernel + rw [he] + convert Ball.exact_sound ((23949 / 25000) : ℚ) using 1 <;> norm_num [B4_2_2U1_1_2OneD, Ball.exact] +def B4_2_2U1_1_2EDLogWitness : LogWitness := ⟨-5, 4204, 3125⟩ +def B4_2_2U1_1_2EDLog : Ball := ⟨(-7922834332433466689101770028001 / 2500000000000000000000000000000), (127054942097 / 100000000000000000000000000000000)⟩ +lemma B4_2_2U1_1_2EDLog_sound : B4_2_2U1_1_2EDLog.Encloses (Real.log ((binaryParameter (shape 4 2 2) (shape 1 1 2) : ℝ))) := by + exact checkLog_sound logTwoBall_sound (B4_2_2U1_1_2D_sound) (w := B4_2_2U1_1_2EDLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def B4_2_2U1_1_2ED : Ball := ⟨(6661519106710058792196768239543 / 50000000000000000000000000000000), (5341389767 / 100000000000000000000000000000000)⟩ +lemma B4_2_2U1_1_2ED_sound : B4_2_2U1_1_2ED.Encloses (Foundation.entropyTerm ((binaryParameter (shape 4 2 2) (shape 1 1 2) : ℝ))) := by + exact contains_sound (entropyTerm_ball (B4_2_2U1_1_2D_sound) B4_2_2U1_1_2EDLog_sound) (by decide +kernel) +def B4_2_2U1_1_2EOneDLogWitness : LogWitness := ⟨-1, 23949, 12500⟩ +def B4_2_2U1_1_2EOneDLog : Ball := ⟨(-4294925553642923666670848622939 / 100000000000000000000000000000000), (21175823683 / 50000000000000000000000000000000)⟩ +lemma B4_2_2U1_1_2EOneDLog_sound : B4_2_2U1_1_2EOneDLog.Encloses (Real.log ((1 - (binaryParameter (shape 4 2 2) (shape 1 1 2) : ℝ)))) := by + exact checkLog_sound logTwoBall_sound (B4_2_2U1_1_2OneD_sound) (w := B4_2_2U1_1_2EOneDLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def B4_2_2U1_1_2EOneD : Ball := ⟨(4114366883367775155724006146831 / 100000000000000000000000000000000), (2535699007 / 6250000000000000000000000000000)⟩ +lemma B4_2_2U1_1_2EOneD_sound : B4_2_2U1_1_2EOneD.Encloses (Foundation.entropyTerm ((1 - (binaryParameter (shape 4 2 2) (shape 1 1 2) : ℝ)))) := by + exact contains_sound (entropyTerm_ball (B4_2_2U1_1_2OneD_sound) B4_2_2U1_1_2EOneDLog_sound) (by decide +kernel) +def B4_2_2U1_1_2BinaryEntropy : Ball := ⟨(20351395843861902820907585661753 / 100000000000000000000000000000000), (9538607427 / 20000000000000000000000000000000)⟩ +lemma B4_2_2U1_1_2BinaryEntropy_sound : B4_2_2U1_1_2BinaryEntropy.Encloses + (binaryEntropyRate (binaryParameter (shape 4 2 2) (shape 1 1 2))) := by + exact contains_sound (Ball.add_sound (Ball.add_sound B4_2_2U1_1_2EOneD_sound B4_2_2U1_1_2ED_sound) + (Ball.mul_sound B4_2_2U1_1_2D_sound logN2_sound)) (by decide +kernel) +def B4_2_2U1_1_2Leaf : Ball := ⟨(157560752751473558472665099815977 / 50000000000000000000000000000000), (7774015451 / 6250000000000000000000000000000)⟩ +lemma B4_2_2U1_1_2Leaf_sound : B4_2_2U1_1_2Leaf.Encloses (AllFieldTerminalRates.secondLeafRate (shape 4 2 2) (shape 1 1 2)) := by + have hh : shapeMax (shape 1 1 2) = 2 := by decide +kernel + have hp : positive (shape 1 1 2) = true := by decide +kernel + simp only [AllFieldTerminalRates.secondLeafRate, hh, hp, Bool.not_true, Bool.false_eq_true, + show (2 : ℕ) ≠ 4 by decide, show (2 : ℕ) ≠ 3 by decide, ite_false] + have ht : (Ball.exact (48949 / 25000)).Encloses (2 - (binaryParameter (shape 4 2 2) (shape 1 1 2) : ℝ)) := by + have he : binaryParameter (shape 4 2 2) (shape 1 1 2) = (1051 / 25000) := by decide +kernel + rw [he] + convert Ball.exact_sound ((48949 / 25000) : ℚ) using 1 + norm_num [Ball.exact] + exact contains_sound (Ball.mul_sound ht logN5_sound) (by decide +kernel) +def B4_2_2U1_1_2Mass : Ball := ⟨(58572354286272772622701551241 / 25000000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ +lemma B4_2_2U1_1_2Mass_sound : B4_2_2U1_1_2Mass.Encloses (littleMass (shape 4 2 2) (shape 1 1 2) : ℝ) := by + rw [littleMass_cast] + exact contains_sound (Ball.mul_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) (second_4_2_2)) + (B4_2_2Law_sound (shape 1 1 2))) (by decide +kernel) +def B4_2_2U1_2_1D : Ball := .exact (21087 / 500000) +lemma B4_2_2U1_2_1D_sound : B4_2_2U1_2_1D.Encloses (binaryParameter (shape 4 2 2) (shape 1 2 1) : ℝ) := by + apply exact_rat_enclosed + decide +kernel +def B4_2_2U1_2_1OneD : Ball := .exact (478913 / 500000) +lemma B4_2_2U1_2_1OneD_sound : B4_2_2U1_2_1OneD.Encloses (1 - (binaryParameter (shape 4 2 2) (shape 1 2 1) : ℝ)) := by + have he : binaryParameter (shape 4 2 2) (shape 1 2 1) = (21087 / 500000) := by decide +kernel + rw [he] + convert Ball.exact_sound ((478913 / 500000) : ℚ) using 1 <;> norm_num [B4_2_2U1_2_1OneD, Ball.exact] +def B4_2_2U1_2_1EDLogWitness : LogWitness := ⟨-5, 21087, 15625⟩ +def B4_2_2U1_2_1EDLog : Ball := ⟨(-316595136156031375511358183062789 / 100000000000000000000000000000000), (63527471049 / 50000000000000000000000000000000)⟩ +lemma B4_2_2U1_2_1EDLog_sound : B4_2_2U1_2_1EDLog.Encloses (Real.log ((binaryParameter (shape 4 2 2) (shape 1 2 1) : ℝ))) := by + exact checkLog_sound logTwoBall_sound (B4_2_2U1_2_1D_sound) (w := B4_2_2U1_2_1EDLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def B4_2_2U1_2_1ED : Ball := ⟨(1335208327224446723081602001249 / 10000000000000000000000000000000), (5358415129 / 100000000000000000000000000000000)⟩ +lemma B4_2_2U1_2_1ED_sound : B4_2_2U1_2_1ED.Encloses (Foundation.entropyTerm ((binaryParameter (shape 4 2 2) (shape 1 2 1) : ℝ))) := by + exact contains_sound (entropyTerm_ball (B4_2_2U1_2_1D_sound) B4_2_2U1_2_1EDLog_sound) (by decide +kernel) +def B4_2_2U1_2_1EOneDLogWitness : LogWitness := ⟨-1, 478913, 250000⟩ +def B4_2_2U1_2_1EOneDLog : Ball := ⟨(-861782918003896777682762665419 / 20000000000000000000000000000000), (21175823683 / 50000000000000000000000000000000)⟩ +lemma B4_2_2U1_2_1EOneDLog_sound : B4_2_2U1_2_1EOneDLog.Encloses (Real.log ((1 - (binaryParameter (shape 4 2 2) (shape 1 2 1) : ℝ)))) := by + exact checkLog_sound logTwoBall_sound (B4_2_2U1_2_1OneD_sound) (w := B4_2_2U1_2_1EOneDLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def B4_2_2U1_2_1EOneD : Ball := ⟨(2063595213050001087451924581919 / 50000000000000000000000000000000), (40565508991 / 100000000000000000000000000000000)⟩ +lemma B4_2_2U1_2_1EOneD_sound : B4_2_2U1_2_1EOneD.Encloses (Foundation.entropyTerm ((1 - (binaryParameter (shape 4 2 2) (shape 1 2 1) : ℝ)))) := by + exact contains_sound (entropyTerm_ball (B4_2_2U1_2_1OneD_sound) B4_2_2U1_2_1EOneDLog_sound) (by decide +kernel) +def B4_2_2U1_2_1BinaryEntropy : Ball := ⟨(20402552617637982753656103120033 / 100000000000000000000000000000000), (47710062497 / 100000000000000000000000000000000)⟩ +lemma B4_2_2U1_2_1BinaryEntropy_sound : B4_2_2U1_2_1BinaryEntropy.Encloses + (binaryEntropyRate (binaryParameter (shape 4 2 2) (shape 1 2 1))) := by + exact contains_sound (Ball.add_sound (Ball.add_sound B4_2_2U1_2_1EOneD_sound B4_2_2U1_2_1ED_sound) + (Ball.mul_sound B4_2_2U1_2_1D_sound logN2_sound)) (by decide +kernel) +def B4_2_2U1_2_1Leaf : Ball := ⟨(157549969517460250000155274731003 / 50000000000000000000000000000000), (24875146907 / 20000000000000000000000000000000)⟩ +lemma B4_2_2U1_2_1Leaf_sound : B4_2_2U1_2_1Leaf.Encloses (AllFieldTerminalRates.secondLeafRate (shape 4 2 2) (shape 1 2 1)) := by + have hh : shapeMax (shape 1 2 1) = 2 := by decide +kernel + have hp : positive (shape 1 2 1) = true := by decide +kernel + simp only [AllFieldTerminalRates.secondLeafRate, hh, hp, Bool.not_true, Bool.false_eq_true, + show (2 : ℕ) ≠ 4 by decide, show (2 : ℕ) ≠ 3 by decide, ite_false] + have ht : (Ball.exact (978913 / 500000)).Encloses (2 - (binaryParameter (shape 4 2 2) (shape 1 2 1) : ℝ)) := by + have he : binaryParameter (shape 4 2 2) (shape 1 2 1) = (21087 / 500000) := by decide +kernel + rw [he] + convert Ball.exact_sound ((978913 / 500000) : ℚ) using 1 + norm_num [Ball.exact] + exact contains_sound (Ball.mul_sound ht logN5_sound) (by decide +kernel) +def B4_2_2U1_2_1Mass : Ball := ⟨(58548930029721897108600768513 / 25000000000000000000000000000000), (1 / 20000000000000000000000000000000)⟩ +lemma B4_2_2U1_2_1Mass_sound : B4_2_2U1_2_1Mass.Encloses (littleMass (shape 4 2 2) (shape 1 2 1) : ℝ) := by + rw [littleMass_cast] + exact contains_sound (Ball.mul_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) (second_4_2_2)) + (B4_2_2Law_sound (shape 1 2 1))) (by decide +kernel) +def B4_2_2U2_0_2D : Ball := .exact (52331 / 500000) +lemma B4_2_2U2_0_2D_sound : B4_2_2U2_0_2D.Encloses (binaryParameter (shape 4 2 2) (shape 2 0 2) : ℝ) := by + apply exact_rat_enclosed + decide +kernel +def B4_2_2U2_0_2OneD : Ball := .exact (447669 / 500000) +lemma B4_2_2U2_0_2OneD_sound : B4_2_2U2_0_2OneD.Encloses (1 - (binaryParameter (shape 4 2 2) (shape 2 0 2) : ℝ)) := by + have he : binaryParameter (shape 4 2 2) (shape 2 0 2) = (52331 / 500000) := by decide +kernel + rw [he] + convert Ball.exact_sound ((447669 / 500000) : ℚ) using 1 <;> norm_num [B4_2_2U2_0_2OneD, Ball.exact] +def B4_2_2U2_0_2EDLogWitness : LogWitness := ⟨-4, 52331, 31250⟩ +def B4_2_2U2_0_2EDLog : Ball := ⟨(-14106369804520244990198383124901 / 6250000000000000000000000000000), (21175823683 / 20000000000000000000000000000000)⟩ +lemma B4_2_2U2_0_2EDLog_sound : B4_2_2U2_0_2EDLog.Encloses (Real.log ((binaryParameter (shape 4 2 2) (shape 2 0 2) : ℝ))) := by + exact checkLog_sound logTwoBall_sound (B4_2_2U2_0_2D_sound) (w := B4_2_2U2_0_2EDLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def B4_2_2U2_0_2ED : Ball := ⟨(11811207011845583049313145396947 / 50000000000000000000000000000000), (2770380073 / 25000000000000000000000000000000)⟩ +lemma B4_2_2U2_0_2ED_sound : B4_2_2U2_0_2ED.Encloses (Foundation.entropyTerm ((binaryParameter (shape 4 2 2) (shape 2 0 2) : ℝ))) := by + exact contains_sound (entropyTerm_ball (B4_2_2U2_0_2D_sound) B4_2_2U2_0_2EDLog_sound) (by decide +kernel) +def B4_2_2U2_0_2EOneDLogWitness : LogWitness := ⟨-1, 447669, 250000⟩ +def B4_2_2U2_0_2EOneDLog : Ball := ⟨(-11055397836918052136994139561117 / 100000000000000000000000000000000), (21175823683 / 50000000000000000000000000000000)⟩ +lemma B4_2_2U2_0_2EOneDLog_sound : B4_2_2U2_0_2EOneDLog.Encloses (Real.log ((1 - (binaryParameter (shape 4 2 2) (shape 2 0 2) : ℝ)))) := by + exact checkLog_sound logTwoBall_sound (B4_2_2U2_0_2OneD_sound) (w := B4_2_2U2_0_2EOneDLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def B4_2_2U2_0_2EOneD : Ball := ⟨(9898317788510534964232058926371 / 100000000000000000000000000000000), (151676157 / 400000000000000000000000000000)⟩ +lemma B4_2_2U2_0_2EOneD_sound : B4_2_2U2_0_2EOneD.Encloses (Foundation.entropyTerm ((1 - (binaryParameter (shape 4 2 2) (shape 2 0 2) : ℝ)))) := by + exact contains_sound (entropyTerm_ball (B4_2_2U2_0_2OneD_sound) B4_2_2U2_0_2EOneDLog_sound) (by decide +kernel) +def B4_2_2U2_0_2BinaryEntropy : Ball := ⟨(40775348833378200660280982551299 / 100000000000000000000000000000000), (53433167659 / 100000000000000000000000000000000)⟩ +lemma B4_2_2U2_0_2BinaryEntropy_sound : B4_2_2U2_0_2BinaryEntropy.Encloses + (binaryEntropyRate (binaryParameter (shape 4 2 2) (shape 2 0 2))) := by + exact contains_sound (Ball.add_sound (Ball.add_sound B4_2_2U2_0_2EOneD_sound B4_2_2U2_0_2ED_sound) + (Ball.mul_sound B4_2_2U2_0_2D_sound logN2_sound)) (by decide +kernel) +def B4_2_2U2_0_2Leaf : Ball := ⟨(328973533161962712899139846142051 / 100000000000000000000000000000000), (5224696419 / 3125000000000000000000000000000)⟩ +lemma B4_2_2U2_0_2Leaf_sound : B4_2_2U2_0_2Leaf.Encloses (AllFieldTerminalRates.secondLeafRate (shape 4 2 2) (shape 2 0 2)) := by + have hh : shapeMax (shape 2 0 2) = 2 := by decide +kernel + have hp : positive (shape 2 0 2) = false := by decide +kernel + simp only [AllFieldTerminalRates.secondLeafRate, hh, hp, Bool.not_false, + show (2 : ℕ) ≠ 4 by decide, show (2 : ℕ) ≠ 3 by decide, ite_false, ite_true] + exact contains_sound (Ball.add_sound B4_2_2U2_0_2BinaryEntropy_sound + (Ball.mul_sound (Ball.mul_sound (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) + B4_2_2U2_0_2OneD_sound) logN5_sound)) (by decide +kernel) +def B4_2_2U2_0_2Mass : Ball := ⟨(86476446627153830691567188243 / 10000000000000000000000000000000), (3 / 20000000000000000000000000000000)⟩ +lemma B4_2_2U2_0_2Mass_sound : B4_2_2U2_0_2Mass.Encloses (littleMass (shape 4 2 2) (shape 2 0 2) : ℝ) := by + rw [littleMass_cast] + exact contains_sound (Ball.mul_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) (second_4_2_2)) + (B4_2_2Law_sound (shape 2 0 2))) (by decide +kernel) +def B4_2_2U2_1_1D : Ball := .exact (593 / 50000) +lemma B4_2_2U2_1_1D_sound : B4_2_2U2_1_1D.Encloses (binaryParameter (shape 4 2 2) (shape 2 1 1) : ℝ) := by + apply exact_rat_enclosed + decide +kernel +def B4_2_2U2_1_1OneD : Ball := .exact (49407 / 50000) +lemma B4_2_2U2_1_1OneD_sound : B4_2_2U2_1_1OneD.Encloses (1 - (binaryParameter (shape 4 2 2) (shape 2 1 1) : ℝ)) := by + have he : binaryParameter (shape 4 2 2) (shape 2 1 1) = (593 / 50000) := by decide +kernel + rw [he] + convert Ball.exact_sound ((49407 / 50000) : ℚ) using 1 <;> norm_num [B4_2_2U2_1_1OneD, Ball.exact] +def B4_2_2U2_1_1EDLogWitness : LogWitness := ⟨-7, 4744, 3125⟩ +def B4_2_2U2_1_1EDLog : Ball := ⟨(-55432298567656970726576300895367 / 12500000000000000000000000000000), (169406589463 / 100000000000000000000000000000000)⟩ +lemma B4_2_2U2_1_1EDLog_sound : B4_2_2U2_1_1EDLog.Encloses (Real.log ((binaryParameter (shape 4 2 2) (shape 2 1 1) : ℝ))) := by + exact checkLog_sound logTwoBall_sound (B4_2_2U2_1_1D_sound) (w := B4_2_2U2_1_1EDLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def B4_2_2U2_1_1ED : Ball := ⟨(657427061012411672817194928619 / 12500000000000000000000000000000), (251145269 / 12500000000000000000000000000000)⟩ +lemma B4_2_2U2_1_1ED_sound : B4_2_2U2_1_1ED.Encloses (Foundation.entropyTerm ((binaryParameter (shape 4 2 2) (shape 2 1 1) : ℝ))) := by + exact contains_sound (entropyTerm_ball (B4_2_2U2_1_1D_sound) B4_2_2U2_1_1EDLog_sound) (by decide +kernel) +def B4_2_2U2_1_1EOneDLogWitness : LogWitness := ⟨-1, 49407, 25000⟩ +def B4_2_2U2_1_1EOneDLog : Ball := ⟨(-149136135849562572644784501963 / 12500000000000000000000000000000), (21175823683 / 50000000000000000000000000000000)⟩ +lemma B4_2_2U2_1_1EOneDLog_sound : B4_2_2U2_1_1EOneDLog.Encloses (Real.log ((1 - (binaryParameter (shape 4 2 2) (shape 2 1 1) : ℝ)))) := by + exact checkLog_sound logTwoBall_sound (B4_2_2U2_1_1OneD_sound) (w := B4_2_2U2_1_1EOneDLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def B4_2_2U2_1_1EOneD : Ball := ⟨(589469525113547042132869431079 / 50000000000000000000000000000000), (41849356829 / 100000000000000000000000000000000)⟩ +lemma B4_2_2U2_1_1EOneD_sound : B4_2_2U2_1_1EOneD.Encloses (Foundation.entropyTerm ((1 - (binaryParameter (shape 4 2 2) (shape 2 1 1) : ℝ)))) := by + exact contains_sound (entropyTerm_ball (B4_2_2U2_1_1OneD_sound) B4_2_2U2_1_1EOneDLog_sound) (by decide +kernel) +def B4_2_2U2_1_1BinaryEntropy : Ball := ⟨(7260428094470482603772135360687 / 100000000000000000000000000000000), (44360809519 / 100000000000000000000000000000000)⟩ +lemma B4_2_2U2_1_1BinaryEntropy_sound : B4_2_2U2_1_1BinaryEntropy.Encloses + (binaryEntropyRate (binaryParameter (shape 4 2 2) (shape 2 1 1))) := by + exact contains_sound (Ball.add_sound (Ball.add_sound B4_2_2U2_1_1EOneD_sound B4_2_2U2_1_1ED_sound) + (Ball.mul_sound B4_2_2U2_1_1D_sound logN2_sound)) (by decide +kernel) +def B4_2_2U2_1_1Leaf : Ball := ⟨(319978789122673231875875290147027 / 100000000000000000000000000000000), (31575376573 / 25000000000000000000000000000000)⟩ +lemma B4_2_2U2_1_1Leaf_sound : B4_2_2U2_1_1Leaf.Encloses (AllFieldTerminalRates.secondLeafRate (shape 4 2 2) (shape 2 1 1)) := by + have hh : shapeMax (shape 2 1 1) = 2 := by decide +kernel + have hp : positive (shape 2 1 1) = true := by decide +kernel + simp only [AllFieldTerminalRates.secondLeafRate, hh, hp, Bool.not_true, Bool.false_eq_true, + show (2 : ℕ) ≠ 4 by decide, show (2 : ℕ) ≠ 3 by decide, ite_false] + have ht : (Ball.exact (99407 / 50000)).Encloses (2 - (binaryParameter (shape 4 2 2) (shape 2 1 1) : ℝ)) := by + have he : binaryParameter (shape 4 2 2) (shape 2 1 1) = (593 / 50000) := by decide +kernel + rw [he] + convert Ball.exact_sound ((99407 / 50000) : ℚ) using 1 + norm_num [Ball.exact] + exact contains_sound (Ball.mul_sound ht logN5_sound) (by decide +kernel) +def B4_2_2U2_1_1Mass : Ball := ⟨(3298612407745390627125647993311 / 100000000000000000000000000000000), (9 / 20000000000000000000000000000000)⟩ +lemma B4_2_2U2_1_1Mass_sound : B4_2_2U2_1_1Mass.Encloses (littleMass (shape 4 2 2) (shape 2 1 1) : ℝ) := by + rw [littleMass_cast] + exact contains_sound (Ball.mul_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) (second_4_2_2)) + (B4_2_2Law_sound (shape 2 1 1))) (by decide +kernel) +def B4_2_2U2_2_0D : Ball := .exact (52451 / 500000) +lemma B4_2_2U2_2_0D_sound : B4_2_2U2_2_0D.Encloses (binaryParameter (shape 4 2 2) (shape 2 2 0) : ℝ) := by + apply exact_rat_enclosed + decide +kernel +def B4_2_2U2_2_0OneD : Ball := .exact (447549 / 500000) +lemma B4_2_2U2_2_0OneD_sound : B4_2_2U2_2_0OneD.Encloses (1 - (binaryParameter (shape 4 2 2) (shape 2 2 0) : ℝ)) := by + have he : binaryParameter (shape 4 2 2) (shape 2 2 0) = (52451 / 500000) := by decide +kernel + rw [he] + convert Ball.exact_sound ((447549 / 500000) : ℚ) using 1 <;> norm_num [B4_2_2U2_2_0OneD, Ball.exact] +def B4_2_2U2_2_0EDLogWitness : LogWitness := ⟨-4, 52451, 31250⟩ +def B4_2_2U2_2_0EDLog : Ball := ⟨(-225472869798470476592187191794959 / 100000000000000000000000000000000), (52939559207 / 50000000000000000000000000000000)⟩ +lemma B4_2_2U2_2_0EDLog_sound : B4_2_2U2_2_0EDLog.Encloses (Real.log ((binaryParameter (shape 4 2 2) (shape 2 2 0) : ℝ))) := by + exact checkLog_sound logTwoBall_sound (B4_2_2U2_2_0D_sound) (w := B4_2_2U2_2_0EDLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def B4_2_2U2_2_0ED : Ball := ⟨(946102199503965997418944831747 / 4000000000000000000000000000000), (11106931281 / 100000000000000000000000000000000)⟩ +lemma B4_2_2U2_2_0ED_sound : B4_2_2U2_2_0ED.Encloses (Foundation.entropyTerm ((binaryParameter (shape 4 2 2) (shape 2 2 0) : ℝ))) := by + exact contains_sound (entropyTerm_ball (B4_2_2U2_2_0D_sound) B4_2_2U2_2_0EDLog_sound) (by decide +kernel) +def B4_2_2U2_2_0EOneDLogWitness : LogWitness := ⟨-1, 447549, 250000⟩ +def B4_2_2U2_2_0EOneDLog : Ball := ⟨(-692637934343495837134511622293 / 6250000000000000000000000000000), (21175823683 / 50000000000000000000000000000000)⟩ +lemma B4_2_2U2_2_0EOneDLog_sound : B4_2_2U2_2_0EOneDLog.Encloses (Real.log ((1 - (binaryParameter (shape 4 2 2) (shape 2 2 0) : ℝ)))) := by + exact checkLog_sound logTwoBall_sound (B4_2_2U2_2_0OneD_sound) (w := B4_2_2U2_2_0EOneDLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def B4_2_2U2_2_0EOneD : Ball := ⟨(495983063803995549461941667273 / 5000000000000000000000000000000), (7581774971 / 20000000000000000000000000000000)⟩ +lemma B4_2_2U2_2_0EOneD_sound : B4_2_2U2_2_0EOneD.Encloses (Foundation.entropyTerm ((1 - (binaryParameter (shape 4 2 2) (shape 2 2 0) : ℝ)))) := by + exact contains_sound (entropyTerm_ball (B4_2_2U2_2_0OneD_sound) B4_2_2U2_2_0EOneDLog_sound) (by decide +kernel) +def B4_2_2U2_2_0BinaryEntropy : Ball := ⟨(40843468817188999209561100536501 / 100000000000000000000000000000000), (53458578649 / 100000000000000000000000000000000)⟩ +lemma B4_2_2U2_2_0BinaryEntropy_sound : B4_2_2U2_2_0BinaryEntropy.Encloses + (binaryEntropyRate (binaryParameter (shape 4 2 2) (shape 2 2 0))) := by + exact contains_sound (Ball.add_sound (Ball.add_sound B4_2_2U2_2_0EOneD_sound B4_2_2U2_2_0ED_sound) + (Ball.mul_sound B4_2_2U2_2_0D_sound logN2_sound)) (by decide +kernel) +def B4_2_2U2_2_0Leaf : Ball := ⟨(32896440012597667463043912769759 / 10000000000000000000000000000000), (41796300803 / 25000000000000000000000000000000)⟩ +lemma B4_2_2U2_2_0Leaf_sound : B4_2_2U2_2_0Leaf.Encloses (AllFieldTerminalRates.secondLeafRate (shape 4 2 2) (shape 2 2 0)) := by + have hh : shapeMax (shape 2 2 0) = 2 := by decide +kernel + have hp : positive (shape 2 2 0) = false := by decide +kernel + simp only [AllFieldTerminalRates.secondLeafRate, hh, hp, Bool.not_false, + show (2 : ℕ) ≠ 4 by decide, show (2 : ℕ) ≠ 3 by decide, ite_false, ite_true] + exact contains_sound (Ball.add_sound B4_2_2U2_2_0BinaryEntropy_sound + (Ball.mul_sound (Ball.mul_sound (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) + B4_2_2U2_2_0OneD_sound) logN5_sound)) (by decide +kernel) +def B4_2_2U2_2_0Mass : Ball := ⟨(86476446627153830691567188243 / 10000000000000000000000000000000), (3 / 20000000000000000000000000000000)⟩ +lemma B4_2_2U2_2_0Mass_sound : B4_2_2U2_2_0Mass.Encloses (littleMass (shape 4 2 2) (shape 2 2 0) : ℝ) := by + rw [littleMass_cast] + exact contains_sound (Ball.mul_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) (second_4_2_2)) + (B4_2_2Law_sound (shape 2 2 0))) (by decide +kernel) +def B4_2_2U3_0_1Leaf : Ball := ⟨(115129254649702284200899544090987 / 50000000000000000000000000000000), (21175823683 / 25000000000000000000000000000000)⟩ +lemma B4_2_2U3_0_1Leaf_sound : B4_2_2U3_0_1Leaf.Encloses (AllFieldTerminalRates.secondLeafRate (shape 4 2 2) (shape 3 0 1)) := by + have hh : shapeMax (shape 3 0 1) = 3 := by decide +kernel + simp only [AllFieldTerminalRates.secondLeafRate, hh, show (3 : ℕ) ≠ 4 by decide, ite_false, ite_true] + exact logN10_sound +def B4_2_2U3_0_1Mass : Ball := ⟨(58548930029721897108600768513 / 25000000000000000000000000000000), (1 / 20000000000000000000000000000000)⟩ +lemma B4_2_2U3_0_1Mass_sound : B4_2_2U3_0_1Mass.Encloses (littleMass (shape 4 2 2) (shape 3 0 1) : ℝ) := by + rw [littleMass_cast] + exact contains_sound (Ball.mul_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) (second_4_2_2)) + (B4_2_2Law_sound (shape 3 0 1))) (by decide +kernel) +def B4_2_2U3_1_0Leaf : Ball := ⟨(115129254649702284200899544090987 / 50000000000000000000000000000000), (21175823683 / 25000000000000000000000000000000)⟩ +lemma B4_2_2U3_1_0Leaf_sound : B4_2_2U3_1_0Leaf.Encloses (AllFieldTerminalRates.secondLeafRate (shape 4 2 2) (shape 3 1 0)) := by + have hh : shapeMax (shape 3 1 0) = 3 := by decide +kernel + simp only [AllFieldTerminalRates.secondLeafRate, hh, show (3 : ℕ) ≠ 4 by decide, ite_false, ite_true] + exact logN10_sound +def B4_2_2U3_1_0Mass : Ball := ⟨(58572354286272772622701551241 / 25000000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ +lemma B4_2_2U3_1_0Mass_sound : B4_2_2U3_1_0Mass.Encloses (littleMass (shape 4 2 2) (shape 3 1 0) : ℝ) := by + rw [littleMass_cast] + exact contains_sound (Ball.mul_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) (second_4_2_2)) + (B4_2_2Law_sound (shape 3 1 0))) (by decide +kernel) +def B4_2_2U4_0_0Leaf : Ball := ⟨0, 0⟩ +lemma B4_2_2U4_0_0Leaf_sound : B4_2_2U4_0_0Leaf.Encloses (AllFieldTerminalRates.secondLeafRate (shape 4 2 2) (shape 4 0 0)) := by + have hh : shapeMax (shape 4 0 0) = 4 := by decide +kernel + simp only [AllFieldTerminalRates.secondLeafRate, hh, ite_true] + change (Ball.exact 0).Encloses 0 + simpa only [Rat.cast_zero] using Ball.exact_sound 0 +def B4_2_2U4_0_0Mass : Ball := ⟨(491331029136091495330612073 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ +lemma B4_2_2U4_0_0Mass_sound : B4_2_2U4_0_0Mass.Encloses (littleMass (shape 4 2 2) (shape 4 0 0) : ℝ) := by + rw [littleMass_cast] + exact contains_sound (Ball.mul_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) (second_4_2_2)) + (B4_2_2Law_sound (shape 4 0 0))) (by decide +kernel) +def B4_2_2Leaves (s : Shape) : Ball := + match s 0, s 1, s 2 with + | 0, 2, 2 => B4_2_2U0_2_2Leaf + | 1, 1, 2 => B4_2_2U1_1_2Leaf + | 1, 2, 1 => B4_2_2U1_2_1Leaf + | 2, 0, 2 => B4_2_2U2_0_2Leaf + | 2, 1, 1 => B4_2_2U2_1_1Leaf + | 2, 2, 0 => B4_2_2U2_2_0Leaf + | 3, 0, 1 => B4_2_2U3_0_1Leaf + | 3, 1, 0 => B4_2_2U3_1_0Leaf + | 4, 0, 0 => B4_2_2U4_0_0Leaf + | _, _, _ => (.exact 0) +lemma B4_2_2Leaves_sound (u : Shape) (hu : u ∈ below (shape 4 2 2)) : + (B4_2_2Leaves u).Encloses (AllFieldTerminalRates.secondLeafRate (shape 4 2 2) u) := by + rw [B4_2_2_below] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl + · exact B4_2_2U0_2_2Leaf_sound + · exact B4_2_2U1_1_2Leaf_sound + · exact B4_2_2U1_2_1Leaf_sound + · exact B4_2_2U2_0_2Leaf_sound + · exact B4_2_2U2_1_1Leaf_sound + · exact B4_2_2U2_2_0Leaf_sound + · exact B4_2_2U3_0_1Leaf_sound + · exact B4_2_2U3_1_0Leaf_sound + · exact B4_2_2U4_0_0Leaf_sound +def B4_2_2Masses (s : Shape) : Ball := + match s 0, s 1, s 2 with + | 0, 2, 2 => B4_2_2U0_2_2Mass + | 1, 1, 2 => B4_2_2U1_1_2Mass + | 1, 2, 1 => B4_2_2U1_2_1Mass + | 2, 0, 2 => B4_2_2U2_0_2Mass + | 2, 1, 1 => B4_2_2U2_1_1Mass + | 2, 2, 0 => B4_2_2U2_2_0Mass + | 3, 0, 1 => B4_2_2U3_0_1Mass + | 3, 1, 0 => B4_2_2U3_1_0Mass + | 4, 0, 0 => B4_2_2U4_0_0Mass + | _, _, _ => (.exact 0) +lemma B4_2_2Masses_sound (u : Shape) (hu : u ∈ below (shape 4 2 2)) : + (B4_2_2Masses u).Encloses ((fun u => (littleMass (shape 4 2 2) u : ℝ)) u) := by + rw [B4_2_2_below] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl + · exact B4_2_2U0_2_2Mass_sound + · exact B4_2_2U1_1_2Mass_sound + · exact B4_2_2U1_2_1Mass_sound + · exact B4_2_2U2_0_2Mass_sound + · exact B4_2_2U2_1_1Mass_sound + · exact B4_2_2U2_2_0Mass_sound + · exact B4_2_2U3_0_1Mass_sound + · exact B4_2_2U3_1_0Mass_sound + · exact B4_2_2U4_0_0Mass_sound +def B4_2_2Binaries (s : Shape) : Ball := + match s 0, s 1, s 2 with + | 0, 2, 2 => B4_2_2U0_2_2BinaryEntropy + | 1, 1, 2 => B4_2_2U1_1_2BinaryEntropy + | 1, 2, 1 => B4_2_2U1_2_1BinaryEntropy + | 2, 0, 2 => B4_2_2U2_0_2BinaryEntropy + | 2, 1, 1 => B4_2_2U2_1_1BinaryEntropy + | 2, 2, 0 => B4_2_2U2_2_0BinaryEntropy + | _, _, _ => (.exact 0) +lemma B4_2_2Binaries_sound (u : Shape) (hu : u ∈ (below (shape 4 2 2)).filter positive) : + (B4_2_2Binaries u).Encloses ((fun u => binaryEntropyRate (binaryParameter (shape 4 2 2) u)) u) := by + have hl : (below (shape 4 2 2)).filter positive = [(shape 1 1 2), (shape 1 2 1), (shape 2 1 1)] := by decide +kernel + rw [hl] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl + · exact B4_2_2U1_1_2BinaryEntropy_sound + · exact B4_2_2U1_2_1BinaryEntropy_sound + · exact B4_2_2U2_1_1BinaryEntropy_sound +def B4_2_2S2 : Ball := ⟨(18805922951942961214562949931267 / 100000000000000000000000000000000), (402029251 / 5000000000000000000000000000000)⟩ +lemma B4_2_2S2_sound : B4_2_2S2.Encloses + (((below (shape 4 2 2)).map fun u => (littleMass (shape 4 2 2) u : ℝ) * AllFieldTerminalRates.secondLeafRate (shape 4 2 2) u).sum) := by + exact contains_sound (listSumBall_sound (below (shape 4 2 2)) + (fun u => .mul (B4_2_2Masses u) (B4_2_2Leaves u)) _ + (fun u hu => Ball.mul_sound (B4_2_2Masses_sound u hu) (B4_2_2Leaves_sound u hu))) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/Certificates/Terminal4_3_1.lean b/lean/OAI/LinearAlgebra/MatrixFields/Certificates/Terminal4_3_1.lean new file mode 100644 index 0000000000000000000000000000000000000000..87504d3a8e759dcc0a762c3373cb0158777a455d --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/Certificates/Terminal4_3_1.lean @@ -0,0 +1,591 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Certificates.LittleB1_3_4 +import OAI.LinearAlgebra.MatrixFields.Certificates.Terminal1_1_6 + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate +open scoped BigOperators +lemma B4_3_1_below : below (shape 4 3 1) = [ + (shape 0 3 1), + (shape 1 2 1), + (shape 1 3 0), + (shape 2 1 1), + (shape 2 2 0), + (shape 3 0 1), + (shape 3 1 0), + (shape 4 0 0)] := by decide +kernel +def B4_3_1Raw (s : Shape) : Ball := + match s 0, s 1, s 2 with + | 0, 3, 1 => ⟨(39716959361056311017780307549 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 1, 2, 1 => ⟨(15598428718166136993941318394257 / 100000000000000000000000000000000), (23 / 100000000000000000000000000000000)⟩ + | 1, 3, 0 => ⟨(768108580374508289602379874323 / 25000000000000000000000000000000), (1 / 10000000000000000000000000000000)⟩ + | 2, 1, 1 => ⟨1, 0⟩ + | 2, 2, 0 => ⟨1, 0⟩ + | 3, 0, 1 => ⟨(768108580374508289602379874323 / 25000000000000000000000000000000), (1 / 10000000000000000000000000000000)⟩ + | 3, 1, 0 => ⟨(15598428718166136993941318394257 / 100000000000000000000000000000000), (23 / 100000000000000000000000000000000)⟩ + | 4, 0, 0 => ⟨(39716959361056311017780307549 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | _, _, _ => (.exact 0) +lemma B4_3_1Raw_0_3_1 : (B4_3_1Raw (shape 0 3 1)).Encloses (splitWeight positiveSecond tablep (shape 4 3 1) (shape 0 3 1) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveSecond tablep (shape 4 3 1) (shape 0 3 1) + (-55133) (-16247) (0) w30 w106 w195 + (by decide +kernel) w30_sound w106_sound w195_sound) (by decide +kernel) +lemma B4_3_1Raw_1_2_1 : (B4_3_1Raw (shape 1 2 1)).Encloses (splitWeight positiveSecond tablep (shape 4 3 1) (shape 1 2 1) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveSecond tablep (shape 4 3 1) (shape 1 2 1) + (-18580) (0) (0) w92 w195 w195 + (by decide +kernel) w92_sound w195_sound w195_sound) (by decide +kernel) +lemma B4_3_1Raw_1_3_0 : (B4_3_1Raw (shape 1 3 0)).Encloses (splitWeight positiveSecond tablep (shape 4 3 1) (shape 1 3 0) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveSecond tablep (shape 4 3 1) (shape 1 3 0) + (-18580) (-16247) (0) w92 w106 w195 + (by decide +kernel) w92_sound w106_sound w195_sound) (by decide +kernel) +lemma B4_3_1Raw_2_1_1 : (B4_3_1Raw (shape 2 1 1)).Encloses (splitWeight positiveSecond tablep (shape 4 3 1) (shape 2 1 1) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveSecond tablep (shape 4 3 1) (shape 2 1 1) + (0) (0) (0) w195 w195 w195 + (by decide +kernel) w195_sound w195_sound w195_sound) (by decide +kernel) +lemma B4_3_1Raw_2_2_0 : (B4_3_1Raw (shape 2 2 0)).Encloses (splitWeight positiveSecond tablep (shape 4 3 1) (shape 2 2 0) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveSecond tablep (shape 4 3 1) (shape 2 2 0) + (0) (0) (0) w195 w195 w195 + (by decide +kernel) w195_sound w195_sound w195_sound) (by decide +kernel) +lemma B4_3_1Raw_3_0_1 : (B4_3_1Raw (shape 3 0 1)).Encloses (splitWeight positiveSecond tablep (shape 4 3 1) (shape 3 0 1) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveSecond tablep (shape 4 3 1) (shape 3 0 1) + (-18580) (-16247) (0) w92 w106 w195 + (by decide +kernel) w92_sound w106_sound w195_sound) (by decide +kernel) +lemma B4_3_1Raw_3_1_0 : (B4_3_1Raw (shape 3 1 0)).Encloses (splitWeight positiveSecond tablep (shape 4 3 1) (shape 3 1 0) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveSecond tablep (shape 4 3 1) (shape 3 1 0) + (-18580) (0) (0) w92 w195 w195 + (by decide +kernel) w92_sound w195_sound w195_sound) (by decide +kernel) +lemma B4_3_1Raw_4_0_0 : (B4_3_1Raw (shape 4 0 0)).Encloses (splitWeight positiveSecond tablep (shape 4 3 1) (shape 4 0 0) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveSecond tablep (shape 4 3 1) (shape 4 0 0) + (-55133) (-16247) (0) w30 w106 w195 + (by decide +kernel) w30_sound w106_sound w195_sound) (by decide +kernel) +lemma B4_3_1Raw_sound (u : Shape) (hu : u ∈ below (shape 4 3 1)) : + (B4_3_1Raw u).Encloses (splitWeight positiveSecond tablep (shape 4 3 1) u : ℝ) := by + rw [B4_3_1_below] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl + · exact B4_3_1Raw_0_3_1 + · exact B4_3_1Raw_1_2_1 + · exact B4_3_1Raw_1_3_0 + · exact B4_3_1Raw_2_1_1 + · exact B4_3_1Raw_2_2_0 + · exact B4_3_1Raw_3_0_1 + · exact B4_3_1Raw_3_1_0 + · exact B4_3_1Raw_4_0_0 +def B4_3_1Den : Ball := ⟨(118750296958386282774386398506647 / 50000000000000000000000000000000), (17 / 25000000000000000000000000000000)⟩ +lemma B4_3_1Den_sound : B4_3_1Den.Encloses (((below (shape 4 3 1)).map (splitWeight positiveSecond tablep (shape 4 3 1))).sum : ℝ) := by + exact contains_sound (list_cast_enclosed (below (shape 4 3 1)) B4_3_1Raw (splitWeight positiveSecond tablep (shape 4 3 1)) B4_3_1Raw_sound) (by decide +kernel) +lemma B4_3_1Den_positive : 0 < B4_3_1Den.lower := by decide +kernel +def B4_3_1Table (s : Shape) : Ball := + match s 0, s 1, s 2 with + | 0, 3, 1 => ⟨(33445776876645910225502339149 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 1, 2, 1 => ⟨(205241969884719280749621373729 / 3125000000000000000000000000000), (3 / 25000000000000000000000000000000)⟩ + | 1, 3, 0 => ⟨(1293653321378517322144444232489 / 100000000000000000000000000000000), (1 / 20000000000000000000000000000000)⟩ + | 2, 1, 1 => ⟨(8421031573086763956728433893807 / 20000000000000000000000000000000), (13 / 100000000000000000000000000000000)⟩ + | 2, 2, 0 => ⟨(8421031573086763956728433893807 / 20000000000000000000000000000000), (13 / 100000000000000000000000000000000)⟩ + | 3, 0, 1 => ⟨(1293653321378517322144444232489 / 100000000000000000000000000000000), (1 / 20000000000000000000000000000000)⟩ + | 3, 1, 0 => ⟨(205241969884719280749621373729 / 3125000000000000000000000000000), (3 / 25000000000000000000000000000000)⟩ + | 4, 0, 0 => ⟨(33445776876645910225502339149 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | _, _, _ => (.exact 0) +def B4_3_1Law (u : Shape) : Ball := if u ∈ below (shape 4 3 1) then B4_3_1Table u else .exact 0 +lemma B4_3_1Law_check_0_3_1 : contains (.mul (B4_3_1Raw (shape 0 3 1)) (.inv B4_3_1Den)) (B4_3_1Table (shape 0 3 1)) = true := by decide +kernel +lemma B4_3_1Law_check_1_2_1 : contains (.mul (B4_3_1Raw (shape 1 2 1)) (.inv B4_3_1Den)) (B4_3_1Table (shape 1 2 1)) = true := by decide +kernel +lemma B4_3_1Law_check_1_3_0 : contains (.mul (B4_3_1Raw (shape 1 3 0)) (.inv B4_3_1Den)) (B4_3_1Table (shape 1 3 0)) = true := by decide +kernel +lemma B4_3_1Law_check_2_1_1 : contains (.mul (B4_3_1Raw (shape 2 1 1)) (.inv B4_3_1Den)) (B4_3_1Table (shape 2 1 1)) = true := by decide +kernel +lemma B4_3_1Law_check_2_2_0 : contains (.mul (B4_3_1Raw (shape 2 2 0)) (.inv B4_3_1Den)) (B4_3_1Table (shape 2 2 0)) = true := by decide +kernel +lemma B4_3_1Law_check_3_0_1 : contains (.mul (B4_3_1Raw (shape 3 0 1)) (.inv B4_3_1Den)) (B4_3_1Table (shape 3 0 1)) = true := by decide +kernel +lemma B4_3_1Law_check_3_1_0 : contains (.mul (B4_3_1Raw (shape 3 1 0)) (.inv B4_3_1Den)) (B4_3_1Table (shape 3 1 0)) = true := by decide +kernel +lemma B4_3_1Law_check_4_0_0 : contains (.mul (B4_3_1Raw (shape 4 0 0)) (.inv B4_3_1Den)) (B4_3_1Table (shape 4 0 0)) = true := by decide +kernel +lemma B4_3_1Law_check (u : Shape) (hu : u ∈ below (shape 4 3 1)) : + contains (.mul (B4_3_1Raw u) (.inv B4_3_1Den)) (B4_3_1Table u) = true := by + rw [B4_3_1_below] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl + · exact B4_3_1Law_check_0_3_1 + · exact B4_3_1Law_check_1_2_1 + · exact B4_3_1Law_check_1_3_0 + · exact B4_3_1Law_check_2_1_1 + · exact B4_3_1Law_check_2_2_0 + · exact B4_3_1Law_check_3_0_1 + · exact B4_3_1Law_check_3_1_0 + · exact B4_3_1Law_check_4_0_0 +lemma B4_3_1Law_sound (u : Shape) : + (B4_3_1Law u).Encloses (stageBLaw (shape 4 3 1) u : ℝ) := by + by_cases hu : u ∈ below (shape 4 3 1) + · have h := contains_sound (Ball.mul_sound (B4_3_1Raw_sound u hu) + (Ball.inv_sound B4_3_1Den_sound B4_3_1Den_positive)) (B4_3_1Law_check u hu) + simpa only [B4_3_1Law, hu, ite_true, stageBLaw, splitLaw, + Rat.cast_div, Rat.cast_mul, Rat.cast_inv, div_eq_mul_inv] using h + · simp only [B4_3_1Law, hu, ite_false, stageBLaw, splitLaw, Rat.cast_zero] + simpa only [Rat.cast_zero] using Ball.exact_sound 0 + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def B4_3_1Binary (u : Shape) : ℚ := + match u 0, u 1, u 2 with + | 1, 2, 1 => (42189 / 1000000) + | 2, 1, 1 => (2967 / 1000000) + | 2, 2, 0 => (48021 / 500000) + | _, _, _ => 0 +lemma B4_3_1Binary_eq (u : Shape) (hu : u ∈ shapes 4) : + binaryParameter (shape 4 3 1) u = B4_3_1Binary u := by + rw [shapes4_list] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel +def B4_3_1LittleRat (u : Shape) (w : Fin 3) (i : Fin 6) : ℚ := + if u w = 2 then + if i = 2 then 1 - B4_3_1Binary u else if i = 3 then B4_3_1Binary u else 0 + else if i = singletonSlot (u w) then 1 else 0 + +def B4_3_1Little (u : Shape) (w : Fin 3) (i : Fin 6) : Ball := + if u ∈ shapes 4 then .exact (B4_3_1LittleRat u w i) + else .exact (littleLaw (shape 4 3 1) u w i) + +lemma B4_3_1Little_sound (u : Shape) (w : Fin 3) (i : Fin 6) : + (B4_3_1Little u w i).Encloses (littleLaw (shape 4 3 1) u w i : ℝ) := by + by_cases hu : u ∈ shapes 4 + · simp only [B4_3_1Little, hu, ite_true] + apply exact_rat_enclosed + simp only [B4_3_1LittleRat, littleLaw, B4_3_1Binary_eq u hu] + · simp only [B4_3_1Little, hu, ite_false] + exact Ball.exact_sound _ +def B4_3_1Half (w : Fin 3) (ij : PairSlot) : Ball := + match w.val, ij.1.val, ij.2.val with + | 0, 0, 5 => ⟨(33445776876645910225502339149 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 0, 1, 4 => ⟨(7861396357689534306132328191817 / 100000000000000000000000000000000), (17 / 100000000000000000000000000000000)⟩ + | 0, 2, 2 => ⟨(1517934657342094088384406991891 / 2000000000000000000000000000000), (3 / 12500000000000000000000000000000)⟩ + | 0, 2, 3 => ⟨(4144793288664198085105361786561 / 100000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ + | 0, 3, 2 => ⟨(4144793288664198085105361786561 / 100000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ + | 0, 3, 3 => ⟨(23996286434538977853265770399 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 0, 4, 1 => ⟨(7861396357689534306132328191817 / 100000000000000000000000000000000), (17 / 100000000000000000000000000000000)⟩ + | 0, 5, 0 => ⟨(33445776876645910225502339149 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ + | 1, 4, 0 => ⟨(663549549127581616184973285819 / 50000000000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ + | 1, 2, 1 => ⟨(22175975409536958176216013675929 / 50000000000000000000000000000000), (3 / 12500000000000000000000000000000)⟩ + | 1, 3, 1 => ⟨(864190016534184083039605215301 / 20000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ + | 1, 1, 2 => ⟨(22175975409536958176216013675929 / 50000000000000000000000000000000), (3 / 12500000000000000000000000000000)⟩ + | 1, 1, 3 => ⟨(864190016534184083039605215301 / 20000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ + | 1, 0, 4 => ⟨(663549549127581616184973285819 / 50000000000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ + | 2, 1, 0 => ⟨(50000000000000000000000000000001 / 100000000000000000000000000000000), (31 / 100000000000000000000000000000000)⟩ + | 2, 0, 1 => ⟨(50000000000000000000000000000001 / 100000000000000000000000000000000), (31 / 100000000000000000000000000000000)⟩ + | _, _, _ => (.exact 0) +lemma B4_3_1Half_check_0_0 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 4 3 1)) (shape 4 3 1) B4_3_1Law + (fun u => B4_3_1Little u 0) ((0 : Fin 6),j)) (B4_3_1Half 0 (0,j)) = true := by + decide +kernel +lemma B4_3_1Half_check_0_1 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 4 3 1)) (shape 4 3 1) B4_3_1Law + (fun u => B4_3_1Little u 0) ((1 : Fin 6),j)) (B4_3_1Half 0 (1,j)) = true := by + decide +kernel +lemma B4_3_1Half_check_0_2 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 4 3 1)) (shape 4 3 1) B4_3_1Law + (fun u => B4_3_1Little u 0) ((2 : Fin 6),j)) (B4_3_1Half 0 (2,j)) = true := by + decide +kernel +lemma B4_3_1Half_check_0_3 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 4 3 1)) (shape 4 3 1) B4_3_1Law + (fun u => B4_3_1Little u 0) ((3 : Fin 6),j)) (B4_3_1Half 0 (3,j)) = true := by + decide +kernel +lemma B4_3_1Half_check_0_4 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 4 3 1)) (shape 4 3 1) B4_3_1Law + (fun u => B4_3_1Little u 0) ((4 : Fin 6),j)) (B4_3_1Half 0 (4,j)) = true := by + decide +kernel +lemma B4_3_1Half_check_0_5 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 4 3 1)) (shape 4 3 1) B4_3_1Law + (fun u => B4_3_1Little u 0) ((5 : Fin 6),j)) (B4_3_1Half 0 (5,j)) = true := by + decide +kernel +lemma B4_3_1Half_check_1_0 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 4 3 1)) (shape 4 3 1) B4_3_1Law + (fun u => B4_3_1Little u 1) ((0 : Fin 6),j)) (B4_3_1Half 1 (0,j)) = true := by + decide +kernel +lemma B4_3_1Half_check_1_1 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 4 3 1)) (shape 4 3 1) B4_3_1Law + (fun u => B4_3_1Little u 1) ((1 : Fin 6),j)) (B4_3_1Half 1 (1,j)) = true := by + decide +kernel +lemma B4_3_1Half_check_1_2 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 4 3 1)) (shape 4 3 1) B4_3_1Law + (fun u => B4_3_1Little u 1) ((2 : Fin 6),j)) (B4_3_1Half 1 (2,j)) = true := by + decide +kernel +lemma B4_3_1Half_check_1_3 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 4 3 1)) (shape 4 3 1) B4_3_1Law + (fun u => B4_3_1Little u 1) ((3 : Fin 6),j)) (B4_3_1Half 1 (3,j)) = true := by + decide +kernel +lemma B4_3_1Half_check_1_4 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 4 3 1)) (shape 4 3 1) B4_3_1Law + (fun u => B4_3_1Little u 1) ((4 : Fin 6),j)) (B4_3_1Half 1 (4,j)) = true := by + decide +kernel +lemma B4_3_1Half_check_1_5 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 4 3 1)) (shape 4 3 1) B4_3_1Law + (fun u => B4_3_1Little u 1) ((5 : Fin 6),j)) (B4_3_1Half 1 (5,j)) = true := by + decide +kernel +lemma B4_3_1Half_check_2_0 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 4 3 1)) (shape 4 3 1) B4_3_1Law + (fun u => B4_3_1Little u 2) ((0 : Fin 6),j)) (B4_3_1Half 2 (0,j)) = true := by + decide +kernel +lemma B4_3_1Half_check_2_1 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 4 3 1)) (shape 4 3 1) B4_3_1Law + (fun u => B4_3_1Little u 2) ((1 : Fin 6),j)) (B4_3_1Half 2 (1,j)) = true := by + decide +kernel +lemma B4_3_1Half_check_2_2 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 4 3 1)) (shape 4 3 1) B4_3_1Law + (fun u => B4_3_1Little u 2) ((2 : Fin 6),j)) (B4_3_1Half 2 (2,j)) = true := by + decide +kernel +lemma B4_3_1Half_check_2_3 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 4 3 1)) (shape 4 3 1) B4_3_1Law + (fun u => B4_3_1Little u 2) ((3 : Fin 6),j)) (B4_3_1Half 2 (3,j)) = true := by + decide +kernel +lemma B4_3_1Half_check_2_4 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 4 3 1)) (shape 4 3 1) B4_3_1Law + (fun u => B4_3_1Little u 2) ((4 : Fin 6),j)) (B4_3_1Half 2 (4,j)) = true := by + decide +kernel +lemma B4_3_1Half_check_2_5 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 4 3 1)) (shape 4 3 1) B4_3_1Law + (fun u => B4_3_1Little u 2) ((5 : Fin 6),j)) (B4_3_1Half 2 (5,j)) = true := by + decide +kernel +lemma B4_3_1Half_sound (w : Fin 3) (ij : PairSlot) : + (B4_3_1Half w ij).Encloses (halfLaw (shape 4 3 1) w ij : ℝ) := by + have hcheck : contains (pairLawBall (below (shape 4 3 1)) (shape 4 3 1) B4_3_1Law + (fun u => B4_3_1Little u w) ij) (B4_3_1Half w ij) = true := by + rcases ij with ⟨i,j⟩ + revert i w + apply forall_fin3 + · exact forall_fin6 (B4_3_1Half_check_0_0 j) (B4_3_1Half_check_0_1 j) (B4_3_1Half_check_0_2 j) (B4_3_1Half_check_0_3 j) (B4_3_1Half_check_0_4 j) (B4_3_1Half_check_0_5 j) + · exact forall_fin6 (B4_3_1Half_check_1_0 j) (B4_3_1Half_check_1_1 j) (B4_3_1Half_check_1_2 j) (B4_3_1Half_check_1_3 j) (B4_3_1Half_check_1_4 j) (B4_3_1Half_check_1_5 j) + · exact forall_fin6 (B4_3_1Half_check_2_0 j) (B4_3_1Half_check_2_1 j) (B4_3_1Half_check_2_2 j) (B4_3_1Half_check_2_3 j) (B4_3_1Half_check_2_4 j) (B4_3_1Half_check_2_5 j) + have h := contains_sound (pairLawBall_sound (below (shape 4 3 1)) (shape 4 3 1) + B4_3_1Law (fun u => (stageBLaw (shape 4 3 1) u : ℝ)) + (fun u => B4_3_1Little u w) (fun u i => (littleLaw (shape 4 3 1) u w i : ℝ)) + (fun u _ => B4_3_1Law_sound u) (fun u i => B4_3_1Little_sound u w i) ij) hcheck + have hp : positive (shape 4 3 1) = true := by decide +kernel + simpa only [halfLaw, hp, ite_true, pairLaw, positiveHalfLaw, Rat.cast_list_sum, + List.map_map, Function.comp_def, Rat.cast_mul] using h + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def B4_3_1U0_3_1Leaf : Ball := ⟨(115129254649702284200899544090987 / 50000000000000000000000000000000), (21175823683 / 25000000000000000000000000000000)⟩ +lemma B4_3_1U0_3_1Leaf_sound : B4_3_1U0_3_1Leaf.Encloses (AllFieldTerminalRates.secondLeafRate (shape 4 3 1) (shape 0 3 1)) := by + have hh : shapeMax (shape 0 3 1) = 3 := by decide +kernel + simp only [AllFieldTerminalRates.secondLeafRate, hh, show (3 : ℕ) ≠ 4 by decide, ite_false, ite_true] + exact logN10_sound +def B4_3_1U0_3_1Mass : Ball := ⟨(136748963356297381050269443 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ +lemma B4_3_1U0_3_1Mass_sound : B4_3_1U0_3_1Mass.Encloses (littleMass (shape 4 3 1) (shape 0 3 1) : ℝ) := by + rw [littleMass_cast] + exact contains_sound (Ball.mul_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) (second_4_3_1)) + (B4_3_1Law_sound (shape 0 3 1))) (by decide +kernel) +def B4_3_1U1_2_1D : Ball := .exact (42189 / 1000000) +lemma B4_3_1U1_2_1D_sound : B4_3_1U1_2_1D.Encloses (binaryParameter (shape 4 3 1) (shape 1 2 1) : ℝ) := by + apply exact_rat_enclosed + decide +kernel +def B4_3_1U1_2_1OneD : Ball := .exact (957811 / 1000000) +lemma B4_3_1U1_2_1OneD_sound : B4_3_1U1_2_1OneD.Encloses (1 - (binaryParameter (shape 4 3 1) (shape 1 2 1) : ℝ)) := by + have he : binaryParameter (shape 4 3 1) (shape 1 2 1) = (42189 / 1000000) := by decide +kernel + rw [he] + convert Ball.exact_sound ((957811 / 1000000) : ℚ) using 1 <;> norm_num [B4_3_1U1_2_1OneD, Ball.exact] +def B4_3_1U1_2_1EDLogWitness : LogWitness := ⟨-5, 42189, 31250⟩ +def B4_3_1U1_2_1EDLog : Ball := ⟨(-316559575542591669352988093304233 / 100000000000000000000000000000000), (127054942097 / 100000000000000000000000000000000)⟩ +lemma B4_3_1U1_2_1EDLog_sound : B4_3_1U1_2_1EDLog.Encloses (Real.log ((binaryParameter (shape 4 3 1) (shape 1 2 1) : ℝ))) := by + exact checkLog_sound logTwoBall_sound (B4_3_1U1_2_1D_sound) (w := B4_3_1U1_2_1EDLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def B4_3_1U1_2_1ED : Ball := ⟨(3338832983141599984583303667103 / 25000000000000000000000000000000), (5360320953 / 100000000000000000000000000000000)⟩ +lemma B4_3_1U1_2_1ED_sound : B4_3_1U1_2_1ED.Encloses (Foundation.entropyTerm ((binaryParameter (shape 4 3 1) (shape 1 2 1) : ℝ))) := by + exact contains_sound (entropyTerm_ball (B4_3_1U1_2_1D_sound) B4_3_1U1_2_1EDLog_sound) (by decide +kernel) +def B4_3_1U1_2_1EOneDLogWitness : LogWitness := ⟨-1, 957811, 500000⟩ +def B4_3_1U1_2_1EOneDLog : Ball := ⟨(-4310480648724792521258507583371 / 100000000000000000000000000000000), (21175823683 / 50000000000000000000000000000000)⟩ +lemma B4_3_1U1_2_1EOneDLog_sound : B4_3_1U1_2_1EOneDLog.Encloses (Real.log ((1 - (binaryParameter (shape 4 3 1) (shape 1 2 1) : ℝ)))) := by + exact checkLog_sound logTwoBall_sound (B4_3_1U1_2_1OneD_sound) (w := B4_3_1U1_2_1EOneDLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def B4_3_1U1_2_1EOneD : Ball := ⟨(516078222579467781197391550867 / 12500000000000000000000000000000), (10141218429 / 25000000000000000000000000000000)⟩ +lemma B4_3_1U1_2_1EOneD_sound : B4_3_1U1_2_1EOneD.Encloses (Foundation.entropyTerm ((1 - (binaryParameter (shape 4 3 1) (shape 1 2 1) : ℝ)))) := by + exact contains_sound (entropyTerm_ball (B4_3_1U1_2_1OneD_sound) B4_3_1U1_2_1EOneDLog_sound) (by decide +kernel) +def B4_3_1U1_2_1BinaryEntropy : Ball := ⟨(5102069088316623863453176716737 / 25000000000000000000000000000000), (47711968321 / 100000000000000000000000000000000)⟩ +lemma B4_3_1U1_2_1BinaryEntropy_sound : B4_3_1U1_2_1BinaryEntropy.Encloses + (binaryEntropyRate (binaryParameter (shape 4 3 1) (shape 1 2 1))) := by + exact contains_sound (Ball.add_sound (Ball.add_sound B4_3_1U1_2_1EOneD_sound B4_3_1U1_2_1ED_sound) + (Ball.mul_sound B4_3_1U1_2_1D_sound logN2_sound)) (by decide +kernel) +def B4_3_1U1_2_1Leaf : Ball := ⟨(315097524878051848849748648323579 / 100000000000000000000000000000000), (62187390811 / 50000000000000000000000000000000)⟩ +lemma B4_3_1U1_2_1Leaf_sound : B4_3_1U1_2_1Leaf.Encloses (AllFieldTerminalRates.secondLeafRate (shape 4 3 1) (shape 1 2 1)) := by + have hh : shapeMax (shape 1 2 1) = 2 := by decide +kernel + have hp : positive (shape 1 2 1) = true := by decide +kernel + simp only [AllFieldTerminalRates.secondLeafRate, hh, hp, Bool.not_true, Bool.false_eq_true, + show (2 : ℕ) ≠ 4 by decide, show (2 : ℕ) ≠ 3 by decide, ite_false] + have ht : (Ball.exact (1957811 / 1000000)).Encloses (2 - (binaryParameter (shape 4 3 1) (shape 1 2 1) : ℝ)) := by + have he : binaryParameter (shape 4 3 1) (shape 1 2 1) = (42189 / 1000000) := by decide +kernel + rw [he] + convert Ball.exact_sound ((1957811 / 1000000) : ℚ) using 1; norm_num [Ball.exact] + exact contains_sound (Ball.mul_sound ht logN5_sound) (by decide +kernel) +def B4_3_1U1_2_1Mass : Ball := ⟨(26853376888763757073709961953 / 50000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ +lemma B4_3_1U1_2_1Mass_sound : B4_3_1U1_2_1Mass.Encloses (littleMass (shape 4 3 1) (shape 1 2 1) : ℝ) := by + rw [littleMass_cast] + exact contains_sound (Ball.mul_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) (second_4_3_1)) + (B4_3_1Law_sound (shape 1 2 1))) (by decide +kernel) +def B4_3_1U1_3_0Leaf : Ball := ⟨(115129254649702284200899544090987 / 50000000000000000000000000000000), (21175823683 / 25000000000000000000000000000000)⟩ +lemma B4_3_1U1_3_0Leaf_sound : B4_3_1U1_3_0Leaf.Encloses (AllFieldTerminalRates.secondLeafRate (shape 4 3 1) (shape 1 3 0)) := by + have hh : shapeMax (shape 1 3 0) = 3 := by decide +kernel + simp only [AllFieldTerminalRates.secondLeafRate, hh, show (3 : ℕ) ≠ 4 by decide, ite_false, ite_true] + exact logN10_sound +def B4_3_1U1_3_0Mass : Ball := ⟨(2644664994528363790023240491 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ +lemma B4_3_1U1_3_0Mass_sound : B4_3_1U1_3_0Mass.Encloses (littleMass (shape 4 3 1) (shape 1 3 0) : ℝ) := by + rw [littleMass_cast] + exact contains_sound (Ball.mul_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) (second_4_3_1)) + (B4_3_1Law_sound (shape 1 3 0))) (by decide +kernel) +def B4_3_1U2_1_1D : Ball := .exact (2967 / 1000000) +lemma B4_3_1U2_1_1D_sound : B4_3_1U2_1_1D.Encloses (binaryParameter (shape 4 3 1) (shape 2 1 1) : ℝ) := by + apply exact_rat_enclosed + decide +kernel +def B4_3_1U2_1_1OneD : Ball := .exact (997033 / 1000000) +lemma B4_3_1U2_1_1OneD_sound : B4_3_1U2_1_1OneD.Encloses (1 - (binaryParameter (shape 4 3 1) (shape 2 1 1) : ℝ)) := by + have he : binaryParameter (shape 4 3 1) (shape 2 1 1) = (2967 / 1000000) := by decide +kernel + rw [he] + convert Ball.exact_sound ((997033 / 1000000) : ℚ) using 1 <;> norm_num [B4_3_1U2_1_1OneD, Ball.exact] +def B4_3_1U2_1_1EDLogWitness : LogWitness := ⟨-9, 23736, 15625⟩ +def B4_3_1U2_1_1EDLog : Ball := ⟨(-582020393767345229843310642743373 / 100000000000000000000000000000000), (21175823683 / 10000000000000000000000000000000)⟩ +lemma B4_3_1U2_1_1EDLog_sound : B4_3_1U2_1_1EDLog.Encloses (Real.log ((binaryParameter (shape 4 3 1) (shape 2 1 1) : ℝ))) := by + exact checkLog_sound logTwoBall_sound (B4_3_1U2_1_1D_sound) (w := B4_3_1U2_1_1EDLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def B4_3_1U2_1_1ED : Ball := ⟨(86342725415385664847255133851 / 5000000000000000000000000000000), (62828669 / 10000000000000000000000000000000)⟩ +lemma B4_3_1U2_1_1ED_sound : B4_3_1U2_1_1ED.Encloses (Foundation.entropyTerm ((binaryParameter (shape 4 3 1) (shape 2 1 1) : ℝ))) := by + exact contains_sound (entropyTerm_ball (B4_3_1U2_1_1D_sound) B4_3_1U2_1_1EDLog_sound) (by decide +kernel) +def B4_3_1U2_1_1EOneDLogWitness : LogWitness := ⟨-1, 997033, 500000⟩ +def B4_3_1U2_1_1EOneDLog : Ball := ⟨(-148570513508735706819130119317 / 50000000000000000000000000000000), (21175823683 / 50000000000000000000000000000000)⟩ +lemma B4_3_1U2_1_1EOneDLog_sound : B4_3_1U2_1_1EOneDLog.Encloses (Real.log ((1 - (binaryParameter (shape 4 3 1) (shape 2 1 1) : ℝ)))) := by + exact checkLog_sound logTwoBall_sound (B4_3_1U2_1_1OneD_sound) (w := B4_3_1U2_1_1EOneDLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def B4_3_1U2_1_1EOneD : Ball := ⟨(148129704795155287976997760253 / 50000000000000000000000000000000), (42225990029 / 100000000000000000000000000000000)⟩ +lemma B4_3_1U2_1_1EOneD_sound : B4_3_1U2_1_1EOneD.Encloses (Foundation.entropyTerm ((1 - (binaryParameter (shape 4 3 1) (shape 2 1 1) : ℝ)))) := by + exact contains_sound (entropyTerm_ball (B4_3_1U2_1_1OneD_sound) B4_3_1U2_1_1EOneDLog_sound) (by decide +kernel) +def B4_3_1U2_1_1BinaryEntropy : Ball := ⟨(1114385343185079823101595455653 / 50000000000000000000000000000000), (21489967029 / 50000000000000000000000000000000)⟩ +lemma B4_3_1U2_1_1BinaryEntropy_sound : B4_3_1U2_1_1BinaryEntropy.Encloses + (binaryEntropyRate (binaryParameter (shape 4 3 1) (shape 2 1 1))) := by + exact contains_sound (Ball.add_sound (Ball.add_sound B4_3_1U2_1_1EOneD_sound B4_3_1U2_1_1ED_sound) + (Ball.mul_sound B4_3_1U2_1_1D_sound logN2_sound)) (by decide +kernel) +def B4_3_1U2_1_1Leaf : Ball := ⟨(5022032222784388708421996016913 / 1562500000000000000000000000000), (31716614023 / 25000000000000000000000000000000)⟩ +lemma B4_3_1U2_1_1Leaf_sound : B4_3_1U2_1_1Leaf.Encloses (AllFieldTerminalRates.secondLeafRate (shape 4 3 1) (shape 2 1 1)) := by + have hh : shapeMax (shape 2 1 1) = 2 := by decide +kernel + have hp : positive (shape 2 1 1) = true := by decide +kernel + simp only [AllFieldTerminalRates.secondLeafRate, hh, hp, Bool.not_true, Bool.false_eq_true, + show (2 : ℕ) ≠ 4 by decide, show (2 : ℕ) ≠ 3 by decide, ite_false] + have ht : (Ball.exact (1997033 / 1000000)).Encloses (2 - (binaryParameter (shape 4 3 1) (shape 2 1 1) : ℝ)) := by + have he : binaryParameter (shape 4 3 1) (shape 2 1 1) = (2967 / 1000000) := by decide +kernel + rw [he] + convert Ball.exact_sound ((1997033 / 1000000) : ℚ) using 1; norm_num [Ball.exact] + exact contains_sound (Ball.mul_sound ht logN5_sound) (by decide +kernel) +def B4_3_1U2_1_1Mass : Ball := ⟨(34430874255289519189291326717 / 10000000000000000000000000000000), (7 / 100000000000000000000000000000000)⟩ +lemma B4_3_1U2_1_1Mass_sound : B4_3_1U2_1_1Mass.Encloses (littleMass (shape 4 3 1) (shape 2 1 1) : ℝ) := by + rw [littleMass_cast] + exact contains_sound (Ball.mul_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) (second_4_3_1)) + (B4_3_1Law_sound (shape 2 1 1))) (by decide +kernel) +def B4_3_1U2_2_0D : Ball := .exact (48021 / 500000) +lemma B4_3_1U2_2_0D_sound : B4_3_1U2_2_0D.Encloses (binaryParameter (shape 4 3 1) (shape 2 2 0) : ℝ) := by + apply exact_rat_enclosed + decide +kernel +def B4_3_1U2_2_0OneD : Ball := .exact (451979 / 500000) +lemma B4_3_1U2_2_0OneD_sound : B4_3_1U2_2_0OneD.Encloses (1 - (binaryParameter (shape 4 3 1) (shape 2 2 0) : ℝ)) := by + have he : binaryParameter (shape 4 3 1) (shape 2 2 0) = (48021 / 500000) := by decide +kernel + rw [he] + convert Ball.exact_sound ((451979 / 500000) : ℚ) using 1 <;> norm_num [B4_3_1U2_2_0OneD, Ball.exact] +def B4_3_1U2_2_0EDLogWitness : LogWitness := ⟨-4, 48021, 31250⟩ +def B4_3_1U2_2_0EDLog : Ball := ⟨(-234296968318952155799785664084377 / 100000000000000000000000000000000), (52939559207 / 50000000000000000000000000000000)⟩ +lemma B4_3_1U2_2_0EDLog_sound : B4_3_1U2_2_0EDLog.Encloses (Real.log ((binaryParameter (shape 4 3 1) (shape 2 2 0) : ℝ))) := by + exact checkLog_sound logTwoBall_sound (B4_3_1U2_2_0D_sound) (w := B4_3_1U2_2_0EDLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def B4_3_1U2_2_0ED : Ball := ⟨(2812793678911100368415376843749 / 12500000000000000000000000000000), (10168842291 / 100000000000000000000000000000000)⟩ +lemma B4_3_1U2_2_0ED_sound : B4_3_1U2_2_0ED.Encloses (Foundation.entropyTerm ((binaryParameter (shape 4 3 1) (shape 2 2 0) : ℝ))) := by + exact contains_sound (entropyTerm_ball (B4_3_1U2_2_0D_sound) B4_3_1U2_2_0EDLog_sound) (by decide +kernel) +def B4_3_1U2_2_0EOneDLogWitness : LogWitness := ⟨-1, 451979, 250000⟩ +def B4_3_1U2_2_0EOneDLog : Ball := ⟨(-1009723798462591586934335088673 / 10000000000000000000000000000000), (21175823683 / 50000000000000000000000000000000)⟩ +lemma B4_3_1U2_2_0EOneDLog_sound : B4_3_1U2_2_0EOneDLog.Encloses (Real.log ((1 - (binaryParameter (shape 4 3 1) (shape 2 2 0) : ℝ)))) := by + exact checkLog_sound logTwoBall_sound (B4_3_1U2_2_0OneD_sound) (w := B4_3_1U2_2_0EOneDLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def B4_3_1U2_2_0EOneD : Ball := ⟨(9127479054106473657419876780867 / 100000000000000000000000000000000), (765682209 / 2000000000000000000000000000000)⟩ +lemma B4_3_1U2_2_0EOneD_sound : B4_3_1U2_2_0EOneD.Encloses (Foundation.entropyTerm ((1 - (binaryParameter (shape 4 3 1) (shape 2 2 0) : ℝ)))) := by + exact contains_sound (entropyTerm_ball (B4_3_1U2_2_0OneD_sound) B4_3_1U2_2_0EOneDLog_sound) (by decide +kernel) +def B4_3_1U2_2_0BinaryEntropy : Ball := ⟨(38286952636929103345447870437799 / 100000000000000000000000000000000), (26260244829 / 50000000000000000000000000000000)⟩ +lemma B4_3_1U2_2_0BinaryEntropy_sound : B4_3_1U2_2_0BinaryEntropy.Encloses + (binaryEntropyRate (binaryParameter (shape 4 3 1) (shape 2 2 0))) := by + exact contains_sound (Ball.add_sound (Ball.add_sound B4_3_1U2_2_0EOneD_sound B4_3_1U2_2_0ED_sound) + (Ball.mul_sound B4_3_1U2_2_0D_sound logN2_sound)) (by decide +kernel) +def B4_3_1U2_2_0Leaf : Ball := ⟨(16462990396327500231505922123031 / 5000000000000000000000000000000), (10460801313 / 6250000000000000000000000000000)⟩ +lemma B4_3_1U2_2_0Leaf_sound : B4_3_1U2_2_0Leaf.Encloses (AllFieldTerminalRates.secondLeafRate (shape 4 3 1) (shape 2 2 0)) := by + have hh : shapeMax (shape 2 2 0) = 2 := by decide +kernel + have hp : positive (shape 2 2 0) = false := by decide +kernel + simp only [AllFieldTerminalRates.secondLeafRate, hh, hp, Bool.not_false, + show (2 : ℕ) ≠ 4 by decide, show (2 : ℕ) ≠ 3 by decide, ite_false, ite_true] + exact contains_sound (Ball.add_sound B4_3_1U2_2_0BinaryEntropy_sound + (Ball.mul_sound (Ball.mul_sound (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) + B4_3_1U2_2_0OneD_sound) logN5_sound)) (by decide +kernel) +def B4_3_1U2_2_0Mass : Ball := ⟨(34430874255289519189291326717 / 10000000000000000000000000000000), (7 / 100000000000000000000000000000000)⟩ +lemma B4_3_1U2_2_0Mass_sound : B4_3_1U2_2_0Mass.Encloses (littleMass (shape 4 3 1) (shape 2 2 0) : ℝ) := by + rw [littleMass_cast] + exact contains_sound (Ball.mul_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) (second_4_3_1)) + (B4_3_1Law_sound (shape 2 2 0))) (by decide +kernel) +def B4_3_1U3_0_1Leaf : Ball := ⟨(115129254649702284200899544090987 / 50000000000000000000000000000000), (21175823683 / 25000000000000000000000000000000)⟩ +lemma B4_3_1U3_0_1Leaf_sound : B4_3_1U3_0_1Leaf.Encloses (AllFieldTerminalRates.secondLeafRate (shape 4 3 1) (shape 3 0 1)) := by + have hh : shapeMax (shape 3 0 1) = 3 := by decide +kernel + simp only [AllFieldTerminalRates.secondLeafRate, hh, show (3 : ℕ) ≠ 4 by decide, ite_false, ite_true] + exact logN10_sound +def B4_3_1U3_0_1Mass : Ball := ⟨(2644664994528363790023240491 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ +lemma B4_3_1U3_0_1Mass_sound : B4_3_1U3_0_1Mass.Encloses (littleMass (shape 4 3 1) (shape 3 0 1) : ℝ) := by + rw [littleMass_cast] + exact contains_sound (Ball.mul_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) (second_4_3_1)) + (B4_3_1Law_sound (shape 3 0 1))) (by decide +kernel) +def B4_3_1U3_1_0Leaf : Ball := ⟨(115129254649702284200899544090987 / 50000000000000000000000000000000), (21175823683 / 25000000000000000000000000000000)⟩ +lemma B4_3_1U3_1_0Leaf_sound : B4_3_1U3_1_0Leaf.Encloses (AllFieldTerminalRates.secondLeafRate (shape 4 3 1) (shape 3 1 0)) := by + have hh : shapeMax (shape 3 1 0) = 3 := by decide +kernel + simp only [AllFieldTerminalRates.secondLeafRate, hh, show (3 : ℕ) ≠ 4 by decide, ite_false, ite_true] + exact logN10_sound +def B4_3_1U3_1_0Mass : Ball := ⟨(26853376888763757073709961953 / 50000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ +lemma B4_3_1U3_1_0Mass_sound : B4_3_1U3_1_0Mass.Encloses (littleMass (shape 4 3 1) (shape 3 1 0) : ℝ) := by + rw [littleMass_cast] + exact contains_sound (Ball.mul_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) (second_4_3_1)) + (B4_3_1Law_sound (shape 3 1 0))) (by decide +kernel) +def B4_3_1U4_0_0Leaf : Ball := ⟨0, 0⟩ +lemma B4_3_1U4_0_0Leaf_sound : B4_3_1U4_0_0Leaf.Encloses (AllFieldTerminalRates.secondLeafRate (shape 4 3 1) (shape 4 0 0)) := by + have hh : shapeMax (shape 4 0 0) = 4 := by decide +kernel + simp only [AllFieldTerminalRates.secondLeafRate, hh, ite_true] + simpa only [B4_3_1U4_0_0Leaf, Ball.exact, Rat.cast_zero] using Ball.exact_sound 0 +def B4_3_1U4_0_0Mass : Ball := ⟨(136748963356297381050269443 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ +lemma B4_3_1U4_0_0Mass_sound : B4_3_1U4_0_0Mass.Encloses (littleMass (shape 4 3 1) (shape 4 0 0) : ℝ) := by + rw [littleMass_cast] + exact contains_sound (Ball.mul_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) (second_4_3_1)) + (B4_3_1Law_sound (shape 4 0 0))) (by decide +kernel) +def B4_3_1Leaves (s : Shape) : Ball := + match s 0, s 1, s 2 with + | 0, 3, 1 => B4_3_1U0_3_1Leaf + | 1, 2, 1 => B4_3_1U1_2_1Leaf + | 1, 3, 0 => B4_3_1U1_3_0Leaf + | 2, 1, 1 => B4_3_1U2_1_1Leaf + | 2, 2, 0 => B4_3_1U2_2_0Leaf + | 3, 0, 1 => B4_3_1U3_0_1Leaf + | 3, 1, 0 => B4_3_1U3_1_0Leaf + | 4, 0, 0 => B4_3_1U4_0_0Leaf + | _, _, _ => (.exact 0) +lemma B4_3_1Leaves_sound (u : Shape) (hu : u ∈ below (shape 4 3 1)) : + (B4_3_1Leaves u).Encloses (AllFieldTerminalRates.secondLeafRate (shape 4 3 1) u) := by + rw [B4_3_1_below] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl + · exact B4_3_1U0_3_1Leaf_sound + · exact B4_3_1U1_2_1Leaf_sound + · exact B4_3_1U1_3_0Leaf_sound + · exact B4_3_1U2_1_1Leaf_sound + · exact B4_3_1U2_2_0Leaf_sound + · exact B4_3_1U3_0_1Leaf_sound + · exact B4_3_1U3_1_0Leaf_sound + · exact B4_3_1U4_0_0Leaf_sound +def B4_3_1Masses (s : Shape) : Ball := + match s 0, s 1, s 2 with + | 0, 3, 1 => B4_3_1U0_3_1Mass + | 1, 2, 1 => B4_3_1U1_2_1Mass + | 1, 3, 0 => B4_3_1U1_3_0Mass + | 2, 1, 1 => B4_3_1U2_1_1Mass + | 2, 2, 0 => B4_3_1U2_2_0Mass + | 3, 0, 1 => B4_3_1U3_0_1Mass + | 3, 1, 0 => B4_3_1U3_1_0Mass + | 4, 0, 0 => B4_3_1U4_0_0Mass + | _, _, _ => (.exact 0) +lemma B4_3_1Masses_sound (u : Shape) (hu : u ∈ below (shape 4 3 1)) : + (B4_3_1Masses u).Encloses ((fun u => (littleMass (shape 4 3 1) u : ℝ)) u) := by + rw [B4_3_1_below] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl + · exact B4_3_1U0_3_1Mass_sound + · exact B4_3_1U1_2_1Mass_sound + · exact B4_3_1U1_3_0Mass_sound + · exact B4_3_1U2_1_1Mass_sound + · exact B4_3_1U2_2_0Mass_sound + · exact B4_3_1U3_0_1Mass_sound + · exact B4_3_1U3_1_0Mass_sound + · exact B4_3_1U4_0_0Mass_sound +def B4_3_1Binaries (s : Shape) : Ball := + match s 0, s 1, s 2 with + | 1, 2, 1 => B4_3_1U1_2_1BinaryEntropy + | 2, 1, 1 => B4_3_1U2_1_1BinaryEntropy + | 2, 2, 0 => B4_3_1U2_2_0BinaryEntropy + | _, _, _ => (.exact 0) +lemma B4_3_1Binaries_sound (u : Shape) (hu : u ∈ (below (shape 4 3 1)).filter positive) : + (B4_3_1Binaries u).Encloses ((fun u => binaryEntropyRate (binaryParameter (shape 4 3 1) u)) u) := by + have hl : (below (shape 4 3 1)).filter positive = [(shape 1 2 1), (shape 2 1 1)] := by decide +kernel + rw [hl] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl + · exact B4_3_1U1_2_1BinaryEntropy_sound + · exact B4_3_1U2_1_1BinaryEntropy_sound +def B4_3_1S2 : Ball := ⟨(2582552552478173297939862688551 / 100000000000000000000000000000000), (285883319 / 25000000000000000000000000000000)⟩ +lemma B4_3_1S2_sound : B4_3_1S2.Encloses + (((below (shape 4 3 1)).map fun u => (littleMass (shape 4 3 1) u : ℝ) * AllFieldTerminalRates.secondLeafRate (shape 4 3 1) u).sum) := by + exact contains_sound (listSumBall_sound (below (shape 4 3 1)) + (fun u => .mul (B4_3_1Masses u) (B4_3_1Leaves u)) _ + (fun u hu => Ball.mul_sound (B4_3_1Masses_sound u hu) (B4_3_1Leaves_sound u hu))) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/Certificates/Terminal5_1_2.lean b/lean/OAI/LinearAlgebra/MatrixFields/Certificates/Terminal5_1_2.lean new file mode 100644 index 0000000000000000000000000000000000000000..2fc3c18955aa4079169b8d8ec2e0603f4c4f4f37 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/Certificates/Terminal5_1_2.lean @@ -0,0 +1,264 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Certificates.Terminal1_1_6 + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def B5_1_2U1_1_2D : Ball := .exact (42047 / 1000000) +lemma B5_1_2U1_1_2D_sound : B5_1_2U1_1_2D.Encloses (binaryParameter (shape 5 1 2) (shape 1 1 2) : ℝ) := by + apply exact_rat_enclosed + decide +kernel +def B5_1_2U1_1_2OneD : Ball := .exact (957953 / 1000000) +lemma B5_1_2U1_1_2OneD_sound : B5_1_2U1_1_2OneD.Encloses (1 - (binaryParameter (shape 5 1 2) (shape 1 1 2) : ℝ)) := by + have he : binaryParameter (shape 5 1 2) (shape 1 1 2) = (42047 / 1000000) := by decide +kernel + rw [he] + convert Ball.exact_sound ((957953 / 1000000) : ℚ) using 1 <;> norm_num [B5_1_2U1_1_2OneD, Ball.exact] +def B5_1_2U1_1_2EDLogWitness : LogWitness := ⟨-5, 42047, 31250⟩ +def B5_1_2U1_1_2EDLog : Ball := ⟨(-316896723874678398578307138430309 / 100000000000000000000000000000000), (127054942097 / 100000000000000000000000000000000)⟩ +lemma B5_1_2U1_1_2EDLog_sound : B5_1_2U1_1_2EDLog.Encloses (Real.log ((binaryParameter (shape 5 1 2) (shape 1 1 2) : ℝ))) := by + exact checkLog_sound logTwoBall_sound (B5_1_2U1_1_2D_sound) (w := B5_1_2U1_1_2EDLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def B5_1_2U1_1_2ED : Ball := ⟨(13324556548758602625022080249579 / 100000000000000000000000000000000), (5342279151 / 100000000000000000000000000000000)⟩ +lemma B5_1_2U1_1_2ED_sound : B5_1_2U1_1_2ED.Encloses (Foundation.entropyTerm ((binaryParameter (shape 5 1 2) (shape 1 1 2) : ℝ))) := by + exact contains_sound (entropyTerm_ball (B5_1_2U1_1_2D_sound) B5_1_2U1_1_2EDLog_sound) (by decide +kernel) +def B5_1_2U1_1_2EOneDLogWitness : LogWitness := ⟨-1, 957953, 500000⟩ +def B5_1_2U1_1_2EOneDLog : Ball := ⟨(-4295656275758179541792934076201 / 100000000000000000000000000000000), (21175823683 / 50000000000000000000000000000000)⟩ +lemma B5_1_2U1_1_2EOneDLog_sound : B5_1_2U1_1_2EOneDLog.Encloses (Real.log ((1 - (binaryParameter (shape 5 1 2) (shape 1 1 2) : ℝ)))) := by + exact checkLog_sound logTwoBall_sound (B5_1_2U1_1_2OneD_sound) (w := B5_1_2U1_1_2EOneDLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def B5_1_2U1_1_2EOneD : Ball := ⟨(4115036816331375366599166577099 / 100000000000000000000000000000000), (811417753 / 2000000000000000000000000000000)⟩ +lemma B5_1_2U1_1_2EOneD_sound : B5_1_2U1_1_2EOneD.Encloses (Foundation.entropyTerm ((1 - (binaryParameter (shape 5 1 2) (shape 1 1 2) : ℝ)))) := by + exact contains_sound (entropyTerm_ball (B5_1_2U1_1_2OneD_sound) B5_1_2U1_1_2EOneDLog_sound) (by decide +kernel) +def B5_1_2U1_1_2BinaryEntropy : Ball := ⟨(4070813863038076006825576384973 / 20000000000000000000000000000000), (23846963259 / 50000000000000000000000000000000)⟩ +lemma B5_1_2U1_1_2BinaryEntropy_sound : B5_1_2U1_1_2BinaryEntropy.Encloses + (binaryEntropyRate (binaryParameter (shape 5 1 2) (shape 1 1 2))) := by + exact contains_sound (Ball.add_sound (Ball.add_sound B5_1_2U1_1_2EOneD_sound B5_1_2U1_1_2ED_sound) + (Ball.mul_sound B5_1_2U1_1_2D_sound logN2_sound)) (by decide +kernel) +def B5_1_2U1_1_2Leaf : Ball := ⟨(19695023681025525817191748693793 / 6250000000000000000000000000000), (31095950631 / 25000000000000000000000000000000)⟩ +lemma B5_1_2U1_1_2Leaf_sound : B5_1_2U1_1_2Leaf.Encloses (AllFieldTerminalRates.secondLeafRate (shape 5 1 2) (shape 1 1 2)) := by + have hh : shapeMax (shape 1 1 2) = 2 := by decide +kernel + have hp : positive (shape 1 1 2) = true := by decide +kernel + simp only [AllFieldTerminalRates.secondLeafRate, hh, hp, Bool.not_true, Bool.false_eq_true, + show (2 : ℕ) ≠ 4 by decide, show (2 : ℕ) ≠ 3 by decide, ite_false] + have ht : (Ball.exact (1957953 / 1000000)).Encloses (2 - (binaryParameter (shape 5 1 2) (shape 1 1 2) : ℝ)) := by + have he : binaryParameter (shape 5 1 2) (shape 1 1 2) = (42047 / 1000000) := by decide +kernel + rw [he] + convert Ball.exact_sound ((1957953 / 1000000) : ℚ) using 1 + norm_num [Ball.exact] + exact contains_sound (Ball.mul_sound ht logN5_sound) (by decide +kernel) +def B5_1_2U1_1_2Mass : Ball := ⟨(263347289989209950085958267 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ +lemma B5_1_2U1_1_2Mass_sound : B5_1_2U1_1_2Mass.Encloses (littleMass (shape 5 1 2) (shape 1 1 2) : ℝ) := by + rw [littleMass_cast] + exact contains_sound (Ball.mul_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) (second_5_1_2)) + (B5_1_2Law_sound (shape 1 1 2))) (by decide +kernel) +def B5_1_2U2_0_2D : Ball := .exact (6867 / 62500) +lemma B5_1_2U2_0_2D_sound : B5_1_2U2_0_2D.Encloses (binaryParameter (shape 5 1 2) (shape 2 0 2) : ℝ) := by + apply exact_rat_enclosed + decide +kernel +def B5_1_2U2_0_2OneD : Ball := .exact (55633 / 62500) +lemma B5_1_2U2_0_2OneD_sound : B5_1_2U2_0_2OneD.Encloses (1 - (binaryParameter (shape 5 1 2) (shape 2 0 2) : ℝ)) := by + have he : binaryParameter (shape 5 1 2) (shape 2 0 2) = (6867 / 62500) := by decide +kernel + rw [he] + convert Ball.exact_sound ((55633 / 62500) : ℚ) using 1 <;> norm_num [B5_1_2U2_0_2OneD, Ball.exact] +def B5_1_2U2_0_2EDLogWitness : LogWitness := ⟨-4, 27468, 15625⟩ +def B5_1_2U2_0_2EDLog : Ball := ⟨(-22084392271038164781658598089709 / 10000000000000000000000000000000), (21175823683 / 20000000000000000000000000000000)⟩ +lemma B5_1_2U2_0_2EDLog_sound : B5_1_2U2_0_2EDLog.Encloses (Real.log ((binaryParameter (shape 5 1 2) (shape 2 0 2) : ℝ))) := by + exact checkLog_sound logTwoBall_sound (B5_1_2U2_0_2D_sound) (w := B5_1_2U2_0_2EDLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def B5_1_2U2_0_2ED : Ball := ⟨(38823301561656083854246295829 / 160000000000000000000000000000), (11633150499 / 100000000000000000000000000000000)⟩ +lemma B5_1_2U2_0_2ED_sound : B5_1_2U2_0_2ED.Encloses (Foundation.entropyTerm ((binaryParameter (shape 5 1 2) (shape 2 0 2) : ℝ))) := by + exact contains_sound (entropyTerm_ball (B5_1_2U2_0_2D_sound) B5_1_2U2_0_2EDLog_sound) (by decide +kernel) +def B5_1_2U2_0_2EOneDLogWitness : LogWitness := ⟨-1, 55633, 31250⟩ +def B5_1_2U2_0_2EOneDLog : Ball := ⟨(-2327800127447388996729312677817 / 20000000000000000000000000000000), (21175823683 / 50000000000000000000000000000000)⟩ +lemma B5_1_2U2_0_2EOneDLog_sound : B5_1_2U2_0_2EOneDLog.Encloses (Real.log ((1 - (binaryParameter (shape 5 1 2) (shape 2 0 2) : ℝ)))) := by + exact checkLog_sound logTwoBall_sound (B5_1_2U2_0_2OneD_sound) (w := B5_1_2U2_0_2EOneDLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def B5_1_2U2_0_2EOneD : Ball := ⟨(10360200359222447364403348176399 / 100000000000000000000000000000000), (1178074599 / 3125000000000000000000000000000)⟩ +lemma B5_1_2U2_0_2EOneD_sound : B5_1_2U2_0_2EOneD.Encloses (Foundation.entropyTerm ((1 - (binaryParameter (shape 5 1 2) (shape 2 0 2) : ℝ)))) := by + exact contains_sound (entropyTerm_ball (B5_1_2U2_0_2OneD_sound) B5_1_2U2_0_2EOneDLog_sound) (by decide +kernel) +def B5_1_2U2_0_2BinaryEntropy : Ball := ⟨(844810210750114617538725874727 / 2000000000000000000000000000000), (53984797867 / 100000000000000000000000000000000)⟩ +lemma B5_1_2U2_0_2BinaryEntropy_sound : B5_1_2U2_0_2BinaryEntropy.Encloses + (binaryEntropyRate (binaryParameter (shape 5 1 2) (shape 2 0 2))) := by + exact contains_sound (Ball.add_sound (Ball.add_sound B5_1_2U2_0_2EOneD_sound B5_1_2U2_0_2ED_sound) + (Ball.mul_sound B5_1_2U2_0_2D_sound logN2_sound)) (by decide +kernel) +def B5_1_2U2_0_2Leaf : Ball := ⟨(32876166056133391052546116649983 / 10000000000000000000000000000000), (167079959367 / 100000000000000000000000000000000)⟩ +lemma B5_1_2U2_0_2Leaf_sound : B5_1_2U2_0_2Leaf.Encloses (AllFieldTerminalRates.secondLeafRate (shape 5 1 2) (shape 2 0 2)) := by + have hh : shapeMax (shape 2 0 2) = 2 := by decide +kernel + have hp : positive (shape 2 0 2) = false := by decide +kernel + simp only [AllFieldTerminalRates.secondLeafRate, hh, hp, Bool.not_false, + show (2 : ℕ) ≠ 4 by decide, show (2 : ℕ) ≠ 3 by decide, ite_false, ite_true] + exact contains_sound (Ball.add_sound B5_1_2U2_0_2BinaryEntropy_sound + (Ball.mul_sound (Ball.mul_sound (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) + B5_1_2U2_0_2OneD_sound) logN5_sound)) (by decide +kernel) +def B5_1_2U2_0_2Mass : Ball := ⟨(26175208896406964988043914431 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ +lemma B5_1_2U2_0_2Mass_sound : B5_1_2U2_0_2Mass.Encloses (littleMass (shape 5 1 2) (shape 2 0 2) : ℝ) := by + rw [littleMass_cast] + exact contains_sound (Ball.mul_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) (second_5_1_2)) + (B5_1_2Law_sound (shape 2 0 2))) (by decide +kernel) +def B5_1_2U2_1_1D : Ball := .exact (1993 / 500000) +lemma B5_1_2U2_1_1D_sound : B5_1_2U2_1_1D.Encloses (binaryParameter (shape 5 1 2) (shape 2 1 1) : ℝ) := by + apply exact_rat_enclosed + decide +kernel +def B5_1_2U2_1_1OneD : Ball := .exact (498007 / 500000) +lemma B5_1_2U2_1_1OneD_sound : B5_1_2U2_1_1OneD.Encloses (1 - (binaryParameter (shape 5 1 2) (shape 2 1 1) : ℝ)) := by + have he : binaryParameter (shape 5 1 2) (shape 2 1 1) = (1993 / 500000) := by decide +kernel + rw [he] + convert Ball.exact_sound ((498007 / 500000) : ℚ) using 1 <;> norm_num [B5_1_2U2_1_1OneD, Ball.exact] +def B5_1_2U2_1_1EDLogWitness : LogWitness := ⟨-8, 15944, 15625⟩ +def B5_1_2U2_1_1EDLog : Ball := ⟨(-276248352859576703796786793426803 / 50000000000000000000000000000000), (95291206573 / 50000000000000000000000000000000)⟩ +lemma B5_1_2U2_1_1EDLog_sound : B5_1_2U2_1_1EDLog.Encloses (Real.log ((binaryParameter (shape 5 1 2) (shape 2 1 1) : ℝ))) := by + exact checkLog_sound logTwoBall_sound (B5_1_2U2_1_1D_sound) (w := B5_1_2U2_1_1EDLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def B5_1_2U2_1_1ED : Ball := ⟨(1101125934498272741333992158599 / 50000000000000000000000000000000), (1519323 / 200000000000000000000000000000)⟩ +lemma B5_1_2U2_1_1ED_sound : B5_1_2U2_1_1ED.Encloses (Foundation.entropyTerm ((binaryParameter (shape 5 1 2) (shape 2 1 1) : ℝ))) := by + exact contains_sound (entropyTerm_ball (B5_1_2U2_1_1D_sound) B5_1_2U2_1_1EDLog_sound) (by decide +kernel) +def B5_1_2U2_1_1EOneDLogWitness : LogWitness := ⟨-1, 498007, 250000⟩ +def B5_1_2U2_1_1EOneDLog : Ball := ⟨(-399396527142702344795877217257 / 100000000000000000000000000000000), (21175823683 / 50000000000000000000000000000000)⟩ +lemma B5_1_2U2_1_1EOneDLog_sound : B5_1_2U2_1_1EOneDLog.Encloses (Real.log ((1 - (binaryParameter (shape 5 1 2) (shape 2 1 1) : ℝ)))) := by + exact checkLog_sound logTwoBall_sound (B5_1_2U2_1_1OneD_sound) (w := B5_1_2U2_1_1EOneDLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def B5_1_2U2_1_1EOneD : Ball := ⟨(397804532585511533249520850669 / 100000000000000000000000000000000), (421828337 / 1000000000000000000000000000000)⟩ +lemma B5_1_2U2_1_1EOneD_sound : B5_1_2U2_1_1EOneD.Encloses (Foundation.entropyTerm ((1 - (binaryParameter (shape 5 1 2) (shape 2 1 1) : ℝ)))) := by + exact contains_sound (entropyTerm_ball (B5_1_2U2_1_1OneD_sound) B5_1_2U2_1_1EOneDLog_sound) (by decide +kernel) +def B5_1_2U2_1_1BinaryEntropy : Ball := ⟨(1438172433876625608125606907683 / 50000000000000000000000000000000), (43111308867 / 100000000000000000000000000000000)⟩ +lemma B5_1_2U2_1_1BinaryEntropy_sound : B5_1_2U2_1_1BinaryEntropy.Encloses + (binaryEntropyRate (binaryParameter (shape 5 1 2) (shape 2 1 1))) := by + exact contains_sound (Ball.add_sound (Ball.add_sound B5_1_2U2_1_1EOneD_sound B5_1_2U2_1_1ED_sound) + (Ball.mul_sound B5_1_2U2_1_1D_sound logN2_sound)) (by decide +kernel) +def B5_1_2U2_1_1Leaf : Ball := ⟨(321246060534923842510835927745293 / 100000000000000000000000000000000), (126801721599 / 100000000000000000000000000000000)⟩ +lemma B5_1_2U2_1_1Leaf_sound : B5_1_2U2_1_1Leaf.Encloses (AllFieldTerminalRates.secondLeafRate (shape 5 1 2) (shape 2 1 1)) := by + have hh : shapeMax (shape 2 1 1) = 2 := by decide +kernel + have hp : positive (shape 2 1 1) = true := by decide +kernel + simp only [AllFieldTerminalRates.secondLeafRate, hh, hp, Bool.not_true, Bool.false_eq_true, + show (2 : ℕ) ≠ 4 by decide, show (2 : ℕ) ≠ 3 by decide, ite_false] + have ht : (Ball.exact (998007 / 500000)).Encloses (2 - (binaryParameter (shape 5 1 2) (shape 2 1 1) : ℝ)) := by + have he : binaryParameter (shape 5 1 2) (shape 2 1 1) = (1993 / 500000) := by decide +kernel + rw [he] + convert Ball.exact_sound ((998007 / 500000) : ℚ) using 1 + norm_num [Ball.exact] + exact contains_sound (Ball.mul_sound ht logN5_sound) (by decide +kernel) +def B5_1_2U2_1_1Mass : Ball := ⟨(46409897166330493680741531629 / 100000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ +lemma B5_1_2U2_1_1Mass_sound : B5_1_2U2_1_1Mass.Encloses (littleMass (shape 5 1 2) (shape 2 1 1) : ℝ) := by + rw [littleMass_cast] + exact contains_sound (Ball.mul_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) (second_5_1_2)) + (B5_1_2Law_sound (shape 2 1 1))) (by decide +kernel) +def B5_1_2U3_0_1Leaf : Ball := ⟨(115129254649702284200899544090987 / 50000000000000000000000000000000), (21175823683 / 25000000000000000000000000000000)⟩ +lemma B5_1_2U3_0_1Leaf_sound : B5_1_2U3_0_1Leaf.Encloses (AllFieldTerminalRates.secondLeafRate (shape 5 1 2) (shape 3 0 1)) := by + have hh : shapeMax (shape 3 0 1) = 3 := by decide +kernel + simp only [AllFieldTerminalRates.secondLeafRate, hh, show (3 : ℕ) ≠ 4 by decide, ite_false, ite_true] + exact logN10_sound +def B5_1_2U3_0_1Mass : Ball := ⟨(46409897166330493680741531629 / 100000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ +lemma B5_1_2U3_0_1Mass_sound : B5_1_2U3_0_1Mass.Encloses (littleMass (shape 5 1 2) (shape 3 0 1) : ℝ) := by + rw [littleMass_cast] + exact contains_sound (Ball.mul_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) (second_5_1_2)) + (B5_1_2Law_sound (shape 3 0 1))) (by decide +kernel) +def B5_1_2U3_1_0Leaf : Ball := ⟨(115129254649702284200899544090987 / 50000000000000000000000000000000), (21175823683 / 25000000000000000000000000000000)⟩ +lemma B5_1_2U3_1_0Leaf_sound : B5_1_2U3_1_0Leaf.Encloses (AllFieldTerminalRates.secondLeafRate (shape 5 1 2) (shape 3 1 0)) := by + have hh : shapeMax (shape 3 1 0) = 3 := by decide +kernel + simp only [AllFieldTerminalRates.secondLeafRate, hh, show (3 : ℕ) ≠ 4 by decide, ite_false, ite_true] + exact logN10_sound +def B5_1_2U3_1_0Mass : Ball := ⟨(26175208896406964988043914431 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ +lemma B5_1_2U3_1_0Mass_sound : B5_1_2U3_1_0Mass.Encloses (littleMass (shape 5 1 2) (shape 3 1 0) : ℝ) := by + rw [littleMass_cast] + exact contains_sound (Ball.mul_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) (second_5_1_2)) + (B5_1_2Law_sound (shape 3 1 0))) (by decide +kernel) +def B5_1_2U4_0_0Leaf : Ball := ⟨0, 0⟩ +lemma B5_1_2U4_0_0Leaf_sound : B5_1_2U4_0_0Leaf.Encloses (AllFieldTerminalRates.secondLeafRate (shape 5 1 2) (shape 4 0 0)) := by + have hh : shapeMax (shape 4 0 0) = 4 := by decide +kernel + simp only [AllFieldTerminalRates.secondLeafRate, hh, ite_true] + simpa only [Rat.cast_zero, B5_1_2U4_0_0Leaf, Ball.exact] using Ball.exact_sound 0 +def B5_1_2U4_0_0Mass : Ball := ⟨(263347289989209950085958267 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ +lemma B5_1_2U4_0_0Mass_sound : B5_1_2U4_0_0Mass.Encloses (littleMass (shape 5 1 2) (shape 4 0 0) : ℝ) := by + rw [littleMass_cast] + exact contains_sound (Ball.mul_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) (second_5_1_2)) + (B5_1_2Law_sound (shape 4 0 0))) (by decide +kernel) +def B5_1_2Leaves (s : Shape) : Ball := + match s 0, s 1, s 2 with + | 1, 1, 2 => B5_1_2U1_1_2Leaf + | 2, 0, 2 => B5_1_2U2_0_2Leaf + | 2, 1, 1 => B5_1_2U2_1_1Leaf + | 3, 0, 1 => B5_1_2U3_0_1Leaf + | 3, 1, 0 => B5_1_2U3_1_0Leaf + | 4, 0, 0 => B5_1_2U4_0_0Leaf + | _, _, _ => (.exact 0) +lemma B5_1_2Leaves_sound (u : Shape) (hu : u ∈ below (shape 5 1 2)) : + (B5_1_2Leaves u).Encloses (AllFieldTerminalRates.secondLeafRate (shape 5 1 2) u) := by + rw [B5_1_2_below] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl | rfl | rfl + · exact B5_1_2U1_1_2Leaf_sound + · exact B5_1_2U2_0_2Leaf_sound + · exact B5_1_2U2_1_1Leaf_sound + · exact B5_1_2U3_0_1Leaf_sound + · exact B5_1_2U3_1_0Leaf_sound + · exact B5_1_2U4_0_0Leaf_sound +def B5_1_2Masses (s : Shape) : Ball := + match s 0, s 1, s 2 with + | 1, 1, 2 => B5_1_2U1_1_2Mass + | 2, 0, 2 => B5_1_2U2_0_2Mass + | 2, 1, 1 => B5_1_2U2_1_1Mass + | 3, 0, 1 => B5_1_2U3_0_1Mass + | 3, 1, 0 => B5_1_2U3_1_0Mass + | 4, 0, 0 => B5_1_2U4_0_0Mass + | _, _, _ => (.exact 0) +lemma B5_1_2Masses_sound (u : Shape) (hu : u ∈ below (shape 5 1 2)) : + (B5_1_2Masses u).Encloses ((fun u => (littleMass (shape 5 1 2) u : ℝ)) u) := by + rw [B5_1_2_below] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl | rfl | rfl + · exact B5_1_2U1_1_2Mass_sound + · exact B5_1_2U2_0_2Mass_sound + · exact B5_1_2U2_1_1Mass_sound + · exact B5_1_2U3_0_1Mass_sound + · exact B5_1_2U3_1_0Mass_sound + · exact B5_1_2U4_0_0Mass_sound +def B5_1_2Binaries (s : Shape) : Ball := + match s 0, s 1, s 2 with + | 1, 1, 2 => B5_1_2U1_1_2BinaryEntropy + | 2, 0, 2 => B5_1_2U2_0_2BinaryEntropy + | 2, 1, 1 => B5_1_2U2_1_1BinaryEntropy + | _, _, _ => (.exact 0) +lemma B5_1_2Binaries_sound (u : Shape) (hu : u ∈ (below (shape 5 1 2)).filter positive) : + (B5_1_2Binaries u).Encloses ((fun u => binaryEntropyRate (binaryParameter (shape 5 1 2) u)) u) := by + have hl : (below (shape 5 1 2)).filter positive = [(shape 1 1 2), (shape 2 1 1)] := by decide +kernel + rw [hl] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl + · exact B5_1_2U1_1_2BinaryEntropy_sound + · exact B5_1_2U2_1_1BinaryEntropy_sound +def B5_1_2S2 : Ball := ⟨(202798422436966096303225510443 / 50000000000000000000000000000000), (165374319 / 100000000000000000000000000000000)⟩ +lemma B5_1_2S2_sound : B5_1_2S2.Encloses + (((below (shape 5 1 2)).map fun u => (littleMass (shape 5 1 2) u : ℝ) * AllFieldTerminalRates.secondLeafRate (shape 5 1 2) u).sum) := by + exact contains_sound (listSumBall_sound (below (shape 5 1 2)) + (fun u => .mul (B5_1_2Masses u) (B5_1_2Leaves u)) _ + (fun u hu => Ball.mul_sound (B5_1_2Masses_sound u hu) (B5_1_2Leaves_sound u hu))) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/Certificates/Terminal5_2_1.lean b/lean/OAI/LinearAlgebra/MatrixFields/Certificates/Terminal5_2_1.lean new file mode 100644 index 0000000000000000000000000000000000000000..b1fdb52ebca14f05335f3e8b3992de924159b9c1 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/Certificates/Terminal5_2_1.lean @@ -0,0 +1,538 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Certificates.LittleB1_3_4 +import OAI.LinearAlgebra.MatrixFields.Certificates.Terminal1_1_6 + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate +open scoped BigOperators +lemma B5_2_1_below : below (shape 5 2 1) = [ + (shape 1 2 1), + (shape 2 1 1), + (shape 2 2 0), + (shape 3 0 1), + (shape 3 1 0), + (shape 4 0 0)] := by decide +kernel +def B5_2_1Raw (s : Shape) : Ball := + match s 0, s 1, s 2 with + | 1, 2, 1 => ⟨(453587208715962055977755498999 / 20000000000000000000000000000000), (7 / 100000000000000000000000000000000)⟩ + | 2, 1, 1 => ⟨1, 0⟩ + | 2, 2, 0 => ⟨(1128226781795963371037633404631 / 2000000000000000000000000000000), (73 / 100000000000000000000000000000000)⟩ + | 3, 0, 1 => ⟨(1128226781795963371037633404631 / 2000000000000000000000000000000), (73 / 100000000000000000000000000000000)⟩ + | 3, 1, 0 => ⟨1, 0⟩ + | 4, 0, 0 => ⟨(453587208715962055977755498999 / 20000000000000000000000000000000), (7 / 100000000000000000000000000000000)⟩ + | _, _, _ => (.exact 0) +lemma B5_2_1Raw_1_2_1 : (B5_2_1Raw (shape 1 2 1)).Encloses (splitWeight positiveSecond tablep (shape 5 2 1) (shape 1 2 1) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveSecond tablep (shape 5 2 1) (shape 1 2 1) + (-32138) (-5725) (0) w65 w162 w195 + (by decide +kernel) w65_sound w162_sound w195_sound) (by decide +kernel) +lemma B5_2_1Raw_2_1_1 : (B5_2_1Raw (shape 2 1 1)).Encloses (splitWeight positiveSecond tablep (shape 5 2 1) (shape 2 1 1) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveSecond tablep (shape 5 2 1) (shape 2 1 1) + (0) (0) (0) w195 w195 w195 + (by decide +kernel) w195_sound w195_sound w195_sound) (by decide +kernel) +lemma B5_2_1Raw_2_2_0 : (B5_2_1Raw (shape 2 2 0)).Encloses (splitWeight positiveSecond tablep (shape 5 2 1) (shape 2 2 0) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveSecond tablep (shape 5 2 1) (shape 2 2 0) + (0) (-5725) (0) w195 w162 w195 + (by decide +kernel) w195_sound w162_sound w195_sound) (by decide +kernel) +lemma B5_2_1Raw_3_0_1 : (B5_2_1Raw (shape 3 0 1)).Encloses (splitWeight positiveSecond tablep (shape 5 2 1) (shape 3 0 1) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveSecond tablep (shape 5 2 1) (shape 3 0 1) + (0) (-5725) (0) w195 w162 w195 + (by decide +kernel) w195_sound w162_sound w195_sound) (by decide +kernel) +lemma B5_2_1Raw_3_1_0 : (B5_2_1Raw (shape 3 1 0)).Encloses (splitWeight positiveSecond tablep (shape 5 2 1) (shape 3 1 0) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveSecond tablep (shape 5 2 1) (shape 3 1 0) + (0) (0) (0) w195 w195 w195 + (by decide +kernel) w195_sound w195_sound w195_sound) (by decide +kernel) +lemma B5_2_1Raw_4_0_0 : (B5_2_1Raw (shape 4 0 0)).Encloses (splitWeight positiveSecond tablep (shape 5 2 1) (shape 4 0 0) : ℝ) := by + exact contains_sound (splitWeight_three_enclosed positiveSecond tablep (shape 5 2 1) (shape 4 0 0) + (-32138) (-5725) (0) w65 w162 w195 + (by decide +kernel) w65_sound w162_sound w195_sound) (by decide +kernel) +lemma B5_2_1Raw_sound (u : Shape) (hu : u ∈ below (shape 5 2 1)) : + (B5_2_1Raw u).Encloses (splitWeight positiveSecond tablep (shape 5 2 1) u : ℝ) := by + rw [B5_2_1_below] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl | rfl | rfl + · exact B5_2_1Raw_1_2_1 + · exact B5_2_1Raw_2_1_1 + · exact B5_2_1Raw_2_2_0 + · exact B5_2_1Raw_3_0_1 + · exact B5_2_1Raw_3_1_0 + · exact B5_2_1Raw_4_0_0 +def B5_2_1Den : Ball := ⟨(31735855026675595766354089545309 / 10000000000000000000000000000000), (1 / 625000000000000000000000000000)⟩ +lemma B5_2_1Den_sound : B5_2_1Den.Encloses (((below (shape 5 2 1)).map (splitWeight positiveSecond tablep (shape 5 2 1))).sum : ℝ) := by + exact contains_sound (list_cast_enclosed (below (shape 5 2 1)) B5_2_1Raw (splitWeight positiveSecond tablep (shape 5 2 1)) B5_2_1Raw_sound) (by decide +kernel) +lemma B5_2_1Den_positive : 0 < B5_2_1Den.lower := by decide +kernel +def B5_2_1Table (s : Shape) : Ball := + match s 0, s 1, s 2 with + | 1, 2, 1 => ⟨(357314469969927548416673592027 / 50000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ + | 2, 1, 1 => ⟨(3151010108785313270505790947861 / 10000000000000000000000000000000), (17 / 100000000000000000000000000000000)⟩ + | 2, 2, 0 => ⟨(2221908746525876524763592917167 / 12500000000000000000000000000000), (33 / 100000000000000000000000000000000)⟩ + | 3, 0, 1 => ⟨(2221908746525876524763592917167 / 12500000000000000000000000000000), (33 / 100000000000000000000000000000000)⟩ + | 3, 1, 0 => ⟨(3151010108785313270505790947861 / 10000000000000000000000000000000), (17 / 100000000000000000000000000000000)⟩ + | 4, 0, 0 => ⟨(357314469969927548416673592027 / 50000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ + | _, _, _ => (.exact 0) +def B5_2_1Law (u : Shape) : Ball := if u ∈ below (shape 5 2 1) then B5_2_1Table u else .exact 0 +lemma B5_2_1Law_check_1_2_1 : contains (.mul (B5_2_1Raw (shape 1 2 1)) (.inv B5_2_1Den)) (B5_2_1Table (shape 1 2 1)) = true := by decide +kernel +lemma B5_2_1Law_check_2_1_1 : contains (.mul (B5_2_1Raw (shape 2 1 1)) (.inv B5_2_1Den)) (B5_2_1Table (shape 2 1 1)) = true := by decide +kernel +lemma B5_2_1Law_check_2_2_0 : contains (.mul (B5_2_1Raw (shape 2 2 0)) (.inv B5_2_1Den)) (B5_2_1Table (shape 2 2 0)) = true := by decide +kernel +lemma B5_2_1Law_check_3_0_1 : contains (.mul (B5_2_1Raw (shape 3 0 1)) (.inv B5_2_1Den)) (B5_2_1Table (shape 3 0 1)) = true := by decide +kernel +lemma B5_2_1Law_check_3_1_0 : contains (.mul (B5_2_1Raw (shape 3 1 0)) (.inv B5_2_1Den)) (B5_2_1Table (shape 3 1 0)) = true := by decide +kernel +lemma B5_2_1Law_check_4_0_0 : contains (.mul (B5_2_1Raw (shape 4 0 0)) (.inv B5_2_1Den)) (B5_2_1Table (shape 4 0 0)) = true := by decide +kernel +lemma B5_2_1Law_check (u : Shape) (hu : u ∈ below (shape 5 2 1)) : + contains (.mul (B5_2_1Raw u) (.inv B5_2_1Den)) (B5_2_1Table u) = true := by + rw [B5_2_1_below] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl | rfl | rfl + · exact B5_2_1Law_check_1_2_1 + · exact B5_2_1Law_check_2_1_1 + · exact B5_2_1Law_check_2_2_0 + · exact B5_2_1Law_check_3_0_1 + · exact B5_2_1Law_check_3_1_0 + · exact B5_2_1Law_check_4_0_0 +lemma B5_2_1Law_sound (u : Shape) : + (B5_2_1Law u).Encloses (stageBLaw (shape 5 2 1) u : ℝ) := by + by_cases hu : u ∈ below (shape 5 2 1) + · have h := contains_sound (Ball.mul_sound (B5_2_1Raw_sound u hu) + (Ball.inv_sound B5_2_1Den_sound B5_2_1Den_positive)) (B5_2_1Law_check u hu) + simpa only [B5_2_1Law, hu, ite_true, stageBLaw, splitLaw, + Rat.cast_div, Rat.cast_mul, Rat.cast_inv, div_eq_mul_inv] using h + · simp only [B5_2_1Law, hu, ite_false, stageBLaw, splitLaw, Rat.cast_zero] + simpa only [Rat.cast_zero] using Ball.exact_sound 0 + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def B5_2_1Binary (u : Shape) : ℚ := + match u 0, u 1, u 2 with + | 1, 2, 1 => (211 / 5000) + | 2, 1, 1 => (1917 / 500000) + | 2, 2, 0 => (55053 / 500000) + | _, _, _ => 0 +lemma B5_2_1Binary_eq (u : Shape) (hu : u ∈ shapes 4) : + binaryParameter (shape 5 2 1) u = B5_2_1Binary u := by + rw [shapes4_list] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel + · decide +kernel +def B5_2_1LittleRat (u : Shape) (w : Fin 3) (i : Fin 6) : ℚ := + if u w = 2 then + if i = 2 then 1 - B5_2_1Binary u else if i = 3 then B5_2_1Binary u else 0 + else if i = singletonSlot (u w) then 1 else 0 + +def B5_2_1Little (u : Shape) (w : Fin 3) (i : Fin 6) : Ball := + if u ∈ shapes 4 then .exact (B5_2_1LittleRat u w i) + else .exact (littleLaw (shape 5 2 1) u w i) + +lemma B5_2_1Little_sound (u : Shape) (w : Fin 3) (i : Fin 6) : + (B5_2_1Little u w i).Encloses (littleLaw (shape 5 2 1) u w i : ℝ) := by + by_cases hu : u ∈ shapes 4 + · simp only [B5_2_1Little, hu, ite_true] + apply exact_rat_enclosed + simp only [B5_2_1LittleRat, littleLaw, B5_2_1Binary_eq u hu] + · simp only [B5_2_1Little, hu, ite_false] + exact Ball.exact_sound _ +def B5_2_1Half (w : Fin 3) (ij : PairSlot) : Ball := + match w.val, ij.1.val, ij.2.val with + | 0, 1, 5 => ⟨(357314469969927548416673592027 / 50000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ + | 0, 2, 4 => ⟨(2950462341058093169205656218569 / 6250000000000000000000000000000), (47 / 100000000000000000000000000000000)⟩ + | 0, 3, 4 => ⟨(1038986801565327097938076659421 / 50000000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ + | 0, 4, 2 => ⟨(2950462341058093169205656218569 / 6250000000000000000000000000000), (47 / 100000000000000000000000000000000)⟩ + | 0, 4, 3 => ⟨(1038986801565327097938076659421 / 50000000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ + | 0, 5, 1 => ⟨(357314469969927548416673592027 / 50000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ + | 1, 2, 0 => ⟨(8251288847660790062385380988161 / 50000000000000000000000000000000), (33 / 100000000000000000000000000000000)⟩ + | 1, 3, 0 => ⟨(496830304206321792542832136267 / 25000000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ + | 1, 1, 1 => ⟨(3151010108785313270505790947861 / 5000000000000000000000000000000), (17 / 50000000000000000000000000000000)⟩ + | 1, 0, 2 => ⟨(8251288847660790062385380988161 / 50000000000000000000000000000000), (33 / 100000000000000000000000000000000)⟩ + | 1, 0, 3 => ⟨(496830304206321792542832136267 / 25000000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ + | 2, 1, 0 => ⟨(1 / 2), (53 / 100000000000000000000000000000000)⟩ + | 2, 0, 1 => ⟨(1 / 2), (53 / 100000000000000000000000000000000)⟩ + | _, _, _ => (.exact 0) +lemma B5_2_1Half_check_0_0 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 5 2 1)) (shape 5 2 1) B5_2_1Law + (fun u => B5_2_1Little u 0) ((0 : Fin 6),j)) (B5_2_1Half 0 (0,j)) = true := by + decide +kernel +lemma B5_2_1Half_check_0_1 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 5 2 1)) (shape 5 2 1) B5_2_1Law + (fun u => B5_2_1Little u 0) ((1 : Fin 6),j)) (B5_2_1Half 0 (1,j)) = true := by + decide +kernel +lemma B5_2_1Half_check_0_2 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 5 2 1)) (shape 5 2 1) B5_2_1Law + (fun u => B5_2_1Little u 0) ((2 : Fin 6),j)) (B5_2_1Half 0 (2,j)) = true := by + decide +kernel +lemma B5_2_1Half_check_0_3 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 5 2 1)) (shape 5 2 1) B5_2_1Law + (fun u => B5_2_1Little u 0) ((3 : Fin 6),j)) (B5_2_1Half 0 (3,j)) = true := by + decide +kernel +lemma B5_2_1Half_check_0_4 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 5 2 1)) (shape 5 2 1) B5_2_1Law + (fun u => B5_2_1Little u 0) ((4 : Fin 6),j)) (B5_2_1Half 0 (4,j)) = true := by + decide +kernel +lemma B5_2_1Half_check_0_5 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 5 2 1)) (shape 5 2 1) B5_2_1Law + (fun u => B5_2_1Little u 0) ((5 : Fin 6),j)) (B5_2_1Half 0 (5,j)) = true := by + decide +kernel +lemma B5_2_1Half_check_1_0 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 5 2 1)) (shape 5 2 1) B5_2_1Law + (fun u => B5_2_1Little u 1) ((0 : Fin 6),j)) (B5_2_1Half 1 (0,j)) = true := by + decide +kernel +lemma B5_2_1Half_check_1_1 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 5 2 1)) (shape 5 2 1) B5_2_1Law + (fun u => B5_2_1Little u 1) ((1 : Fin 6),j)) (B5_2_1Half 1 (1,j)) = true := by + decide +kernel +lemma B5_2_1Half_check_1_2 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 5 2 1)) (shape 5 2 1) B5_2_1Law + (fun u => B5_2_1Little u 1) ((2 : Fin 6),j)) (B5_2_1Half 1 (2,j)) = true := by + decide +kernel +lemma B5_2_1Half_check_1_3 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 5 2 1)) (shape 5 2 1) B5_2_1Law + (fun u => B5_2_1Little u 1) ((3 : Fin 6),j)) (B5_2_1Half 1 (3,j)) = true := by + decide +kernel +lemma B5_2_1Half_check_1_4 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 5 2 1)) (shape 5 2 1) B5_2_1Law + (fun u => B5_2_1Little u 1) ((4 : Fin 6),j)) (B5_2_1Half 1 (4,j)) = true := by + decide +kernel +lemma B5_2_1Half_check_1_5 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 5 2 1)) (shape 5 2 1) B5_2_1Law + (fun u => B5_2_1Little u 1) ((5 : Fin 6),j)) (B5_2_1Half 1 (5,j)) = true := by + decide +kernel +lemma B5_2_1Half_check_2_0 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 5 2 1)) (shape 5 2 1) B5_2_1Law + (fun u => B5_2_1Little u 2) ((0 : Fin 6),j)) (B5_2_1Half 2 (0,j)) = true := by + decide +kernel +lemma B5_2_1Half_check_2_1 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 5 2 1)) (shape 5 2 1) B5_2_1Law + (fun u => B5_2_1Little u 2) ((1 : Fin 6),j)) (B5_2_1Half 2 (1,j)) = true := by + decide +kernel +lemma B5_2_1Half_check_2_2 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 5 2 1)) (shape 5 2 1) B5_2_1Law + (fun u => B5_2_1Little u 2) ((2 : Fin 6),j)) (B5_2_1Half 2 (2,j)) = true := by + decide +kernel +lemma B5_2_1Half_check_2_3 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 5 2 1)) (shape 5 2 1) B5_2_1Law + (fun u => B5_2_1Little u 2) ((3 : Fin 6),j)) (B5_2_1Half 2 (3,j)) = true := by + decide +kernel +lemma B5_2_1Half_check_2_4 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 5 2 1)) (shape 5 2 1) B5_2_1Law + (fun u => B5_2_1Little u 2) ((4 : Fin 6),j)) (B5_2_1Half 2 (4,j)) = true := by + decide +kernel +lemma B5_2_1Half_check_2_5 : ∀ j : Fin 6, + contains (pairLawBall (below (shape 5 2 1)) (shape 5 2 1) B5_2_1Law + (fun u => B5_2_1Little u 2) ((5 : Fin 6),j)) (B5_2_1Half 2 (5,j)) = true := by + decide +kernel +lemma B5_2_1Half_sound (w : Fin 3) (ij : PairSlot) : + (B5_2_1Half w ij).Encloses (halfLaw (shape 5 2 1) w ij : ℝ) := by + have hcheck : contains (pairLawBall (below (shape 5 2 1)) (shape 5 2 1) B5_2_1Law + (fun u => B5_2_1Little u w) ij) (B5_2_1Half w ij) = true := by + rcases ij with ⟨i,j⟩ + revert i w + apply forall_fin3 + · exact forall_fin6 (B5_2_1Half_check_0_0 j) (B5_2_1Half_check_0_1 j) (B5_2_1Half_check_0_2 j) (B5_2_1Half_check_0_3 j) (B5_2_1Half_check_0_4 j) (B5_2_1Half_check_0_5 j) + · exact forall_fin6 (B5_2_1Half_check_1_0 j) (B5_2_1Half_check_1_1 j) (B5_2_1Half_check_1_2 j) (B5_2_1Half_check_1_3 j) (B5_2_1Half_check_1_4 j) (B5_2_1Half_check_1_5 j) + · exact forall_fin6 (B5_2_1Half_check_2_0 j) (B5_2_1Half_check_2_1 j) (B5_2_1Half_check_2_2 j) (B5_2_1Half_check_2_3 j) (B5_2_1Half_check_2_4 j) (B5_2_1Half_check_2_5 j) + have h := contains_sound (pairLawBall_sound (below (shape 5 2 1)) (shape 5 2 1) + B5_2_1Law (fun u => (stageBLaw (shape 5 2 1) u : ℝ)) + (fun u => B5_2_1Little u w) (fun u i => (littleLaw (shape 5 2 1) u w i : ℝ)) + (fun u _ => B5_2_1Law_sound u) (fun u i => B5_2_1Little_sound u w i) ij) hcheck + have hp : positive (shape 5 2 1) = true := by decide +kernel + simpa only [halfLaw, hp, ite_true, pairLaw, positiveHalfLaw, Rat.cast_list_sum, + List.map_map, Function.comp_def, Rat.cast_mul] using h + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def B5_2_1U1_2_1D : Ball := .exact (211 / 5000) +lemma B5_2_1U1_2_1D_sound : B5_2_1U1_2_1D.Encloses (binaryParameter (shape 5 2 1) (shape 1 2 1) : ℝ) := by + apply exact_rat_enclosed + decide +kernel +def B5_2_1U1_2_1OneD : Ball := .exact (4789 / 5000) +lemma B5_2_1U1_2_1OneD_sound : B5_2_1U1_2_1OneD.Encloses (1 - (binaryParameter (shape 5 2 1) (shape 1 2 1) : ℝ)) := by + have he : binaryParameter (shape 5 2 1) (shape 1 2 1) = (211 / 5000) := by decide +kernel + rw [he] + convert Ball.exact_sound ((4789 / 5000) : ℚ) using 1 <;> norm_num [B5_2_1U1_2_1OneD, Ball.exact] +def B5_2_1U1_2_1EDLogWitness : LogWitness := ⟨-5, 844, 625⟩ +def B5_2_1U1_2_1EDLog : Ball := ⟨(-158266752897008546545638823852531 / 50000000000000000000000000000000), (63527471049 / 50000000000000000000000000000000)⟩ +lemma B5_2_1U1_2_1EDLog_sound : B5_2_1U1_2_1EDLog.Encloses (Real.log ((binaryParameter (shape 5 2 1) (shape 1 2 1) : ℝ))) := by + exact checkLog_sound logTwoBall_sound (B5_2_1U1_2_1D_sound) (w := B5_2_1U1_2_1EDLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def B5_2_1U1_2_1ED : Ball := ⟨(6678856972253760664225958366577 / 50000000000000000000000000000000), (5361718557 / 100000000000000000000000000000000)⟩ +lemma B5_2_1U1_2_1ED_sound : B5_2_1U1_2_1ED.Encloses (Foundation.entropyTerm ((binaryParameter (shape 5 2 1) (shape 1 2 1) : ℝ))) := by + exact contains_sound (entropyTerm_ball (B5_2_1U1_2_1D_sound) B5_2_1U1_2_1EDLog_sound) (by decide +kernel) +def B5_2_1U1_2_1EOneDLogWitness : LogWitness := ⟨-1, 4789, 2500⟩ +def B5_2_1U1_2_1EOneDLog : Ball := ⟨(-431162910736280628338599195593 / 10000000000000000000000000000000), (21175823683 / 50000000000000000000000000000000)⟩ +lemma B5_2_1U1_2_1EOneDLog_sound : B5_2_1U1_2_1EOneDLog.Encloses (Real.log ((1 - (binaryParameter (shape 5 2 1) (shape 1 2 1) : ℝ)))) := by + exact checkLog_sound logTwoBall_sound (B5_2_1U1_2_1OneD_sound) (w := B5_2_1U1_2_1EOneDLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def B5_2_1U1_2_1EOneD : Ball := ⟨(412967835903209585822710309539 / 10000000000000000000000000000000), (5070550981 / 12500000000000000000000000000000)⟩ +lemma B5_2_1U1_2_1EOneD_sound : B5_2_1U1_2_1EOneD.Encloses (Foundation.entropyTerm ((1 - (binaryParameter (shape 5 2 1) (shape 1 2 1) : ℝ)))) := by + exact contains_sound (entropyTerm_ball (B5_2_1U1_2_1OneD_sound) B5_2_1U1_2_1EOneDLog_sound) (by decide +kernel) +def B5_2_1U1_2_1BinaryEntropy : Ball := ⟨(5103118351375646598104934643817 / 25000000000000000000000000000000), (11928341481 / 25000000000000000000000000000000)⟩ +lemma B5_2_1U1_2_1BinaryEntropy_sound : B5_2_1U1_2_1BinaryEntropy.Encloses + (binaryEntropyRate (binaryParameter (shape 5 2 1) (shape 1 2 1))) := by + exact contains_sound (Ball.add_sound (Ball.add_sound B5_2_1U1_2_1EOneD_sound B5_2_1U1_2_1ED_sound) + (Ball.mul_sound B5_2_1U1_2_1D_sound logN2_sound)) (by decide +kernel) +def B5_2_1U1_2_1Leaf : Ball := ⟨(315095754496348171339336587488733 / 100000000000000000000000000000000), (124374082821 / 100000000000000000000000000000000)⟩ +lemma B5_2_1U1_2_1Leaf_sound : B5_2_1U1_2_1Leaf.Encloses (AllFieldTerminalRates.secondLeafRate (shape 5 2 1) (shape 1 2 1)) := by + have hh : shapeMax (shape 1 2 1) = 2 := by decide +kernel + have hp : positive (shape 1 2 1) = true := by decide +kernel + simp only [AllFieldTerminalRates.secondLeafRate, hh, hp, Bool.not_true, Bool.false_eq_true, + show (2 : ℕ) ≠ 4 by decide, show (2 : ℕ) ≠ 3 by decide, ite_false] + have ht : (Ball.exact (9789 / 5000)).Encloses (2 - (binaryParameter (shape 5 2 1) (shape 1 2 1) : ℝ)) := by + have he : binaryParameter (shape 5 2 1) (shape 1 2 1) = (211 / 5000) := by decide +kernel + rw [he] + convert Ball.exact_sound ((9789 / 5000) : ℚ) using 1; norm_num [Ball.exact] + exact contains_sound (Ball.mul_sound ht logN5_sound) (by decide +kernel) +def B5_2_1U1_2_1Mass : Ball := ⟨(362385426444727423821804449 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ +lemma B5_2_1U1_2_1Mass_sound : B5_2_1U1_2_1Mass.Encloses (littleMass (shape 5 2 1) (shape 1 2 1) : ℝ) := by + rw [littleMass_cast] + exact contains_sound (Ball.mul_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) (second_5_2_1)) + (B5_2_1Law_sound (shape 1 2 1))) (by decide +kernel) +def B5_2_1U2_1_1D : Ball := .exact (1917 / 500000) +lemma B5_2_1U2_1_1D_sound : B5_2_1U2_1_1D.Encloses (binaryParameter (shape 5 2 1) (shape 2 1 1) : ℝ) := by + apply exact_rat_enclosed + decide +kernel +def B5_2_1U2_1_1OneD : Ball := .exact (498083 / 500000) +lemma B5_2_1U2_1_1OneD_sound : B5_2_1U2_1_1OneD.Encloses (1 - (binaryParameter (shape 5 2 1) (shape 2 1 1) : ℝ)) := by + have he : binaryParameter (shape 5 2 1) (shape 2 1 1) = (1917 / 500000) := by decide +kernel + rw [he] + convert Ball.exact_sound ((498083 / 500000) : ℚ) using 1 <;> norm_num [B5_2_1U2_1_1OneD, Ball.exact] +def B5_2_1U2_1_1EDLogWitness : LogWitness := ⟨-9, 30672, 15625⟩ +def B5_2_1U2_1_1EDLog : Ball := ⟨(-69548082929483553739694058747031 / 12500000000000000000000000000000), (21175823683 / 10000000000000000000000000000000)⟩ +lemma B5_2_1U2_1_1EDLog_sound : B5_2_1U2_1_1EDLog.Encloses (Real.log ((binaryParameter (shape 5 2 1) (shape 2 1 1) : ℝ))) := by + exact checkLog_sound logTwoBall_sound (B5_2_1U2_1_1D_sound) (w := B5_2_1U2_1_1EDLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def B5_2_1U2_1_1ED : Ball := ⟨(2133178799613119560303896169889 / 100000000000000000000000000000000), (811881081 / 100000000000000000000000000000000)⟩ +lemma B5_2_1U2_1_1ED_sound : B5_2_1U2_1_1ED.Encloses (Foundation.entropyTerm ((binaryParameter (shape 5 2 1) (shape 2 1 1) : ℝ))) := by + exact contains_sound (entropyTerm_ball (B5_2_1U2_1_1D_sound) B5_2_1U2_1_1EDLog_sound) (by decide +kernel) +def B5_2_1U2_1_1EOneDLogWitness : LogWitness := ⟨-1, 498083, 250000⟩ +def B5_2_1U2_1_1EOneDLog : Ball := ⟨(-19206843091090117849948028057 / 5000000000000000000000000000000), (21175823683 / 50000000000000000000000000000000)⟩ +lemma B5_2_1U2_1_1EOneDLog_sound : B5_2_1U2_1_1EOneDLog.Encloses (Real.log ((1 - (binaryParameter (shape 5 2 1) (shape 2 1 1) : ℝ)))) := by + exact checkLog_sound logTwoBall_sound (B5_2_1U2_1_1OneD_sound) (w := B5_2_1U2_1_1EOneDLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def B5_2_1U2_1_1EOneD : Ball := ⟨(382664081093577566762226546349 / 100000000000000000000000000000000), (42189271151 / 100000000000000000000000000000000)⟩ +lemma B5_2_1U2_1_1EOneD_sound : B5_2_1U2_1_1EOneD.Encloses (Foundation.entropyTerm ((1 - (binaryParameter (shape 5 2 1) (shape 2 1 1) : ℝ)))) := by + exact contains_sound (entropyTerm_ball (B5_2_1U2_1_1OneD_sound) B5_2_1U2_1_1EOneDLog_sound) (by decide +kernel) +def B5_2_1U2_1_1BinaryEntropy : Ball := ⟨(2781595509733380158696689438393 / 100000000000000000000000000000000), (43163528449 / 100000000000000000000000000000000)⟩ +lemma B5_2_1U2_1_1BinaryEntropy_sound : B5_2_1U2_1_1BinaryEntropy.Encloses + (binaryEntropyRate (binaryParameter (shape 5 2 1) (shape 2 1 1))) := by + exact contains_sound (Ball.add_sound (Ball.add_sound B5_2_1U2_1_1EOneD_sound B5_2_1U2_1_1ED_sound) + (Ball.mul_sound B5_2_1U2_1_1D_sound logN2_sound)) (by decide +kernel) +def B5_2_1U2_1_1Leaf : Ball := ⟨(321270523991192840836529859281353 / 100000000000000000000000000000000), (5072455111 / 4000000000000000000000000000000)⟩ +lemma B5_2_1U2_1_1Leaf_sound : B5_2_1U2_1_1Leaf.Encloses (AllFieldTerminalRates.secondLeafRate (shape 5 2 1) (shape 2 1 1)) := by + have hh : shapeMax (shape 2 1 1) = 2 := by decide +kernel + have hp : positive (shape 2 1 1) = true := by decide +kernel + simp only [AllFieldTerminalRates.secondLeafRate, hh, hp, Bool.not_true, Bool.false_eq_true, + show (2 : ℕ) ≠ 4 by decide, show (2 : ℕ) ≠ 3 by decide, ite_false] + have ht : (Ball.exact (998083 / 500000)).Encloses (2 - (binaryParameter (shape 5 2 1) (shape 2 1 1) : ℝ)) := by + have he : binaryParameter (shape 5 2 1) (shape 2 1 1) = (1917 / 500000) := by decide +kernel + rw [he] + convert Ball.exact_sound ((998083 / 500000) : ℚ) using 1; norm_num [Ball.exact] + exact contains_sound (Ball.mul_sound ht logN5_sound) (by decide +kernel) +def B5_2_1U2_1_1Mass : Ball := ⟨(15978643995300779447518999591 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ +lemma B5_2_1U2_1_1Mass_sound : B5_2_1U2_1_1Mass.Encloses (littleMass (shape 5 2 1) (shape 2 1 1) : ℝ) := by + rw [littleMass_cast] + exact contains_sound (Ball.mul_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) (second_5_2_1)) + (B5_2_1Law_sound (shape 2 1 1))) (by decide +kernel) +def B5_2_1U2_2_0D : Ball := .exact (55053 / 500000) +lemma B5_2_1U2_2_0D_sound : B5_2_1U2_2_0D.Encloses (binaryParameter (shape 5 2 1) (shape 2 2 0) : ℝ) := by + apply exact_rat_enclosed + decide +kernel +def B5_2_1U2_2_0OneD : Ball := .exact (444947 / 500000) +lemma B5_2_1U2_2_0OneD_sound : B5_2_1U2_2_0OneD.Encloses (1 - (binaryParameter (shape 5 2 1) (shape 2 2 0) : ℝ)) := by + have he : binaryParameter (shape 5 2 1) (shape 2 2 0) = (55053 / 500000) := by decide +kernel + rw [he] + convert Ball.exact_sound ((444947 / 500000) : ℚ) using 1 <;> norm_num [B5_2_1U2_2_0OneD, Ball.exact] +def B5_2_1U2_2_0EDLogWitness : LogWitness := ⟨-4, 55053, 31250⟩ +def B5_2_1U2_2_0EDLog : Ball := ⟨(-110315587041277227232948872211851 / 50000000000000000000000000000000), (21175823683 / 20000000000000000000000000000000)⟩ +lemma B5_2_1U2_2_0EDLog_sound : B5_2_1U2_2_0EDLog.Encloses (Real.log ((binaryParameter (shape 5 2 1) (shape 2 2 0) : ℝ))) := by + exact checkLog_sound logTwoBall_sound (B5_2_1U2_2_0D_sound) (w := B5_2_1U2_2_0EDLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def B5_2_1U2_2_0ED : Ball := ⟨(6073204013383435190855534261879 / 25000000000000000000000000000000), (11657926213 / 100000000000000000000000000000000)⟩ +lemma B5_2_1U2_2_0ED_sound : B5_2_1U2_2_0ED.Encloses (Foundation.entropyTerm ((binaryParameter (shape 5 2 1) (shape 2 2 0) : ℝ))) := by + exact contains_sound (entropyTerm_ball (B5_2_1U2_2_0D_sound) B5_2_1U2_2_0EDLog_sound) (by decide +kernel) +def B5_2_1U2_2_0EOneDLogWitness : LogWitness := ⟨-1, 444947, 250000⟩ +def B5_2_1U2_2_0EOneDLog : Ball := ⟨(-11665292447264905939613678307427 / 100000000000000000000000000000000), (8470329473 / 20000000000000000000000000000000)⟩ +lemma B5_2_1U2_2_0EOneDLog_sound : B5_2_1U2_2_0EOneDLog.Encloses (Real.log ((1 - (binaryParameter (shape 5 2 1) (shape 2 2 0) : ℝ)))) := by + exact checkLog_sound logTwoBall_sound (B5_2_1U2_2_0OneD_sound) (w := B5_2_1U2_2_0EOneDLogWitness) (by + simp only [checkLog, Bool.and_eq_true] + exact ⟨by decide +kernel, by decide +kernel⟩) +def B5_2_1U2_2_0EOneD : Ball := ⟨(10380873757066356206226574643709 / 100000000000000000000000000000000), (37688476881 / 100000000000000000000000000000000)⟩ +lemma B5_2_1U2_2_0EOneD_sound : B5_2_1U2_2_0EOneD.Encloses (Foundation.entropyTerm ((1 - (binaryParameter (shape 5 2 1) (shape 2 2 0) : ℝ)))) := by + exact contains_sound (entropyTerm_ball (B5_2_1U2_2_0OneD_sound) B5_2_1U2_2_0EOneDLog_sound) (by decide +kernel) +def B5_2_1U2_2_0BinaryEntropy : Ball := ⟨(1692226246274937231740723423409 / 4000000000000000000000000000000), (2700478679 / 5000000000000000000000000000000)⟩ +lemma B5_2_1U2_2_0BinaryEntropy_sound : B5_2_1U2_2_0BinaryEntropy.Encloses + (binaryEntropyRate (binaryParameter (shape 5 2 1) (shape 2 2 0))) := by + exact contains_sound (Ball.add_sound (Ball.add_sound B5_2_1U2_2_0EOneD_sound B5_2_1U2_2_0ED_sound) + (Ball.mul_sound B5_2_1U2_2_0D_sound logN2_sound)) (by decide +kernel) +def B5_2_1U2_2_0Leaf : Ball := ⟨(328751484486399694544511642829783 / 100000000000000000000000000000000), (2610546941 / 1562500000000000000000000000000)⟩ +lemma B5_2_1U2_2_0Leaf_sound : B5_2_1U2_2_0Leaf.Encloses (AllFieldTerminalRates.secondLeafRate (shape 5 2 1) (shape 2 2 0)) := by + have hh : shapeMax (shape 2 2 0) = 2 := by decide +kernel + have hp : positive (shape 2 2 0) = false := by decide +kernel + simp only [AllFieldTerminalRates.secondLeafRate, hh, hp, Bool.not_false, + show (2 : ℕ) ≠ 4 by decide, show (2 : ℕ) ≠ 3 by decide, ite_false, ite_true] + exact contains_sound (Ball.add_sound B5_2_1U2_2_0BinaryEntropy_sound + (Ball.mul_sound (Ball.mul_sound (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) + B5_2_1U2_2_0OneD_sound) logN5_sound)) (by decide +kernel) +def B5_2_1U2_2_0Mass : Ball := ⟨(563360440383799776936723959 / 6250000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ +lemma B5_2_1U2_2_0Mass_sound : B5_2_1U2_2_0Mass.Encloses (littleMass (shape 5 2 1) (shape 2 2 0) : ℝ) := by + rw [littleMass_cast] + exact contains_sound (Ball.mul_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) (second_5_2_1)) + (B5_2_1Law_sound (shape 2 2 0))) (by decide +kernel) +def B5_2_1U3_0_1Leaf : Ball := ⟨(115129254649702284200899544090987 / 50000000000000000000000000000000), (21175823683 / 25000000000000000000000000000000)⟩ +lemma B5_2_1U3_0_1Leaf_sound : B5_2_1U3_0_1Leaf.Encloses (AllFieldTerminalRates.secondLeafRate (shape 5 2 1) (shape 3 0 1)) := by + have hh : shapeMax (shape 3 0 1) = 3 := by decide +kernel + simp only [AllFieldTerminalRates.secondLeafRate, hh, show (3 : ℕ) ≠ 4 by decide, ite_false, ite_true] + exact logN10_sound +def B5_2_1U3_0_1Mass : Ball := ⟨(563360440383799776936723959 / 6250000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ +lemma B5_2_1U3_0_1Mass_sound : B5_2_1U3_0_1Mass.Encloses (littleMass (shape 5 2 1) (shape 3 0 1) : ℝ) := by + rw [littleMass_cast] + exact contains_sound (Ball.mul_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) (second_5_2_1)) + (B5_2_1Law_sound (shape 3 0 1))) (by decide +kernel) +def B5_2_1U3_1_0Leaf : Ball := ⟨(115129254649702284200899544090987 / 50000000000000000000000000000000), (21175823683 / 25000000000000000000000000000000)⟩ +lemma B5_2_1U3_1_0Leaf_sound : B5_2_1U3_1_0Leaf.Encloses (AllFieldTerminalRates.secondLeafRate (shape 5 2 1) (shape 3 1 0)) := by + have hh : shapeMax (shape 3 1 0) = 3 := by decide +kernel + simp only [AllFieldTerminalRates.secondLeafRate, hh, show (3 : ℕ) ≠ 4 by decide, ite_false, ite_true] + exact logN10_sound +def B5_2_1U3_1_0Mass : Ball := ⟨(15978643995300779447518999591 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ +lemma B5_2_1U3_1_0Mass_sound : B5_2_1U3_1_0Mass.Encloses (littleMass (shape 5 2 1) (shape 3 1 0) : ℝ) := by + rw [littleMass_cast] + exact contains_sound (Ball.mul_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) (second_5_2_1)) + (B5_2_1Law_sound (shape 3 1 0))) (by decide +kernel) +def B5_2_1U4_0_0Leaf : Ball := ⟨0, 0⟩ +lemma B5_2_1U4_0_0Leaf_sound : B5_2_1U4_0_0Leaf.Encloses (AllFieldTerminalRates.secondLeafRate (shape 5 2 1) (shape 4 0 0)) := by + have hh : shapeMax (shape 4 0 0) = 4 := by decide +kernel + simp only [AllFieldTerminalRates.secondLeafRate, hh, ite_true] + simpa only [B5_2_1U4_0_0Leaf, Ball.exact, Rat.cast_zero] using Ball.exact_sound 0 +def B5_2_1U4_0_0Mass : Ball := ⟨(362385426444727423821804449 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩ +lemma B5_2_1U4_0_0Mass_sound : B5_2_1U4_0_0Mass.Encloses (littleMass (shape 5 2 1) (shape 4 0 0) : ℝ) := by + rw [littleMass_cast] + exact contains_sound (Ball.mul_sound (Ball.mul_sound + (by simpa only [Rat.cast_ofNat] using Ball.exact_sound 2) (second_5_2_1)) + (B5_2_1Law_sound (shape 4 0 0))) (by decide +kernel) +def B5_2_1Leaves (s : Shape) : Ball := + match s 0, s 1, s 2 with + | 1, 2, 1 => B5_2_1U1_2_1Leaf + | 2, 1, 1 => B5_2_1U2_1_1Leaf + | 2, 2, 0 => B5_2_1U2_2_0Leaf + | 3, 0, 1 => B5_2_1U3_0_1Leaf + | 3, 1, 0 => B5_2_1U3_1_0Leaf + | 4, 0, 0 => B5_2_1U4_0_0Leaf + | _, _, _ => (.exact 0) +lemma B5_2_1Leaves_sound (u : Shape) (hu : u ∈ below (shape 5 2 1)) : + (B5_2_1Leaves u).Encloses (AllFieldTerminalRates.secondLeafRate (shape 5 2 1) u) := by + rw [B5_2_1_below] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl | rfl | rfl + · exact B5_2_1U1_2_1Leaf_sound + · exact B5_2_1U2_1_1Leaf_sound + · exact B5_2_1U2_2_0Leaf_sound + · exact B5_2_1U3_0_1Leaf_sound + · exact B5_2_1U3_1_0Leaf_sound + · exact B5_2_1U4_0_0Leaf_sound +def B5_2_1Masses (s : Shape) : Ball := + match s 0, s 1, s 2 with + | 1, 2, 1 => B5_2_1U1_2_1Mass + | 2, 1, 1 => B5_2_1U2_1_1Mass + | 2, 2, 0 => B5_2_1U2_2_0Mass + | 3, 0, 1 => B5_2_1U3_0_1Mass + | 3, 1, 0 => B5_2_1U3_1_0Mass + | 4, 0, 0 => B5_2_1U4_0_0Mass + | _, _, _ => (.exact 0) +lemma B5_2_1Masses_sound (u : Shape) (hu : u ∈ below (shape 5 2 1)) : + (B5_2_1Masses u).Encloses ((fun u => (littleMass (shape 5 2 1) u : ℝ)) u) := by + rw [B5_2_1_below] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl | rfl | rfl | rfl | rfl + · exact B5_2_1U1_2_1Mass_sound + · exact B5_2_1U2_1_1Mass_sound + · exact B5_2_1U2_2_0Mass_sound + · exact B5_2_1U3_0_1Mass_sound + · exact B5_2_1U3_1_0Mass_sound + · exact B5_2_1U4_0_0Mass_sound +def B5_2_1Binaries (s : Shape) : Ball := + match s 0, s 1, s 2 with + | 1, 2, 1 => B5_2_1U1_2_1BinaryEntropy + | 2, 1, 1 => B5_2_1U2_1_1BinaryEntropy + | 2, 2, 0 => B5_2_1U2_2_0BinaryEntropy + | _, _, _ => (.exact 0) +lemma B5_2_1Binaries_sound (u : Shape) (hu : u ∈ (below (shape 5 2 1)).filter positive) : + (B5_2_1Binaries u).Encloses ((fun u => binaryEntropyRate (binaryParameter (shape 5 2 1) u)) u) := by + have hl : (below (shape 5 2 1)).filter positive = [(shape 1 2 1), (shape 2 1 1)] := by decide +kernel + rw [hl] at hu + simp only [List.mem_cons, List.not_mem_nil, or_false] at hu + rcases hu with rfl | rfl + · exact B5_2_1U1_2_1BinaryEntropy_sound + · exact B5_2_1U2_1_1BinaryEntropy_sound +def B5_2_1S2 : Ball := ⟨(69828290229183920558225491291 / 50000000000000000000000000000000), (28471307 / 50000000000000000000000000000000)⟩ +lemma B5_2_1S2_sound : B5_2_1S2.Encloses + (((below (shape 5 2 1)).map fun u => (littleMass (shape 5 2 1) u : ℝ) * AllFieldTerminalRates.secondLeafRate (shape 5 2 1) u).sum) := by + exact contains_sound (listSumBall_sound (below (shape 5 2 1)) + (fun u => .mul (B5_2_1Masses u) (B5_2_1Leaves u)) _ + (fun u hu => Ball.mul_sound (B5_2_1Masses_sound u hu) (B5_2_1Leaves_sound u hu))) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/Certificates/Weights2.lean b/lean/OAI/LinearAlgebra/MatrixFields/Certificates/Weights2.lean new file mode 100644 index 0000000000000000000000000000000000000000..d170e9ef48d93bfe09df7ce9caa079c4dc5bb159 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/Certificates/Weights2.lean @@ -0,0 +1,746 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Certificates.SparseContraction + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate +open scoped BigOperators +def w50Trace : List Ball := [ + ⟨(47252585897334525427131536434317 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(24306677159329606395297438236621 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(24535616147583738291934726489499 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(16433821705634918062580870706137 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(824002073875140207989546114123 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(103193358675069121855540162681 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(17221927415604884686783592779 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(19701977356701113977243402277 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1232336053690703169237423847 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(17126483580120343107891663 / 6250000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(13708199793715603422120737 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2493463295410495917117529 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(103931816499206727234119 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(15994459590025507527571 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1785574973627510971 / 156250000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(76201522169584958937 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w50S0 : Ball := ⟨(22328068739849776775696389866217 / 25000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +def w50S1 : Ball := ⟨(39883412292116543891426534049807 / 50000000000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ +def w50S2 : Ball := ⟨(63627463042518121176310826622107 / 100000000000000000000000000000000), (11 / 100000000000000000000000000000000)⟩ +def w50S3 : Ball := ⟨(8096908106454018731516515646317 / 20000000000000000000000000000000), (3 / 20000000000000000000000000000000)⟩ +def w50S4 : Ball := ⟨(1024373763818137548924843116057 / 6250000000000000000000000000000), (13 / 100000000000000000000000000000000)⟩ +def w50S5 : Ball := ⟨(2686314516477279869329472877877 / 100000000000000000000000000000000), (1 / 20000000000000000000000000000000)⟩ +abbrev w50 : Ball := w50S5 +lemma w50_sound : w50.Encloses (weight (-36170) : ℝ) := by + exact weight_enclosed_of_trace (-36170) w50Trace w50S0 w50S1 w50S2 w50S3 w50S4 w50S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def w51Trace : List Ball := [ + ⟨(47255022421610958409873827160341 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(97229191696542968020629859555673 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(49072067803428631784511439365999 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(16434031762616588480302150310221 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(164802101549160184047696785151 / 4000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(825553916487359822440105826453 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(137776428077124469979954185547 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(9851051824020091619644825781 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(616171539329365605563796791 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(54805028742902572676103731 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(13708263777035553765322303 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(249347396699950737538081 / 10000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(103932227199065796269981 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(7997259146465039175483 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(571385949173744347803 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(76201768611384910161 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w51S0 : Ball := ⟨(89321485762678176318205827626583 / 100000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +def w51S1 : Ball := ⟨(79783278188523201533459547505851 / 100000000000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ +def w51S2 : Ball := ⟨(15913428696268205075822640693131 / 25000000000000000000000000000000), (1 / 10000000000000000000000000000000)⟩ +def w51S3 : Ball := ⟨(40517954059393981618574346622053 / 100000000000000000000000000000000), (7 / 50000000000000000000000000000000)⟩ +def w51S4 : Ball := ⟨(16417046011591612337241268965323 / 100000000000000000000000000000000), (3 / 25000000000000000000000000000000)⟩ +def w51S5 : Ball := ⟨(269519399746716066043680327981 / 10000000000000000000000000000000), (1 / 20000000000000000000000000000000)⟩ +abbrev w51 : Ball := w51S5 +lemma w51_sound : w51.Encloses (weight (-36137) : ℝ) := by + exact weight_enclosed_of_trace (-36137) w51Trace w51S0 w51S1 w51S2 w51S3 w51S4 w51S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def w52Trace : List Ball := [ + ⟨(94576963914621259217505189236641 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(97263285916444179486511570691339 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(49083539218577657455234692230219 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(8218457853804215175566037617137 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4120631481820178285566038469107 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(412825332106161919969763009167 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(8611892300201203221395936553 / 6250000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4925959357334995388651066207 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(616219759802083691231947149 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(274044451525979487543910047 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(13709142148901862855403159 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1246810233670350335173201 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(25984466323217592554217 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(3998831041095165826097 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(114282564628990104257 / 10000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2381410987037007519 / 3125000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w52S0 : Ball := ⟨(11181002629134464775733552852623 / 12500000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ +def w52S1 : Ball := ⟨(16001896933467112148862410300581 / 20000000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ +def w52S2 : Ball := ⟨(64015176367326041853428769853831 / 100000000000000000000000000000000), (7 / 100000000000000000000000000000000)⟩ +def w52S3 : Ball := ⟨(40979428053398585721896388350199 / 100000000000000000000000000000000), (1 / 10000000000000000000000000000000)⟩ +def w52S4 : Ball := ⟨(262392738059948593849370483877 / 1562500000000000000000000000000), (9 / 100000000000000000000000000000000)⟩ +def w52S5 : Ball := ⟨(2820093910491004738042527563213 / 100000000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ +abbrev w52 : Ball := w52S5 +lemma w52_sound : w52.Encloses (weight (-35684) : ℝ) := by + exact weight_enclosed_of_trace (-35684) w52Trace w52S0 w52S1 w52S2 w52S3 w52S4 w52S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def w53Trace : List Ball := [ + ⟨(9472085981072132827787397524319 / 10000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(19467314229715939628133190310611 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1964327694285953374980600969197 / 4000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(16443112887117801282313517122753 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1030468863697918858474372015391 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(412929267379136138000551802967 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4306875961545940671389316009 / 3125000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(19707562341275789773722941567 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1232646711362290880639135941 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(137042965599593419509774749 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2742205831091363555804109 / 10000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2493935189601084972786341 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(51974988646074868342001 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1599705535433063038869 / 10000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1142941107839874819213 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(19053104471079033951 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w53S0 : Ball := ⟨(89720412832823229054714993821997 / 100000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +def w53S1 : Ball := ⟨(80497524788922311615133304296963 / 100000000000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ +def w53S2 : Ball := ⟨(64798514971431620491477576158537 / 100000000000000000000000000000000), (11 / 100000000000000000000000000000000)⟩ +def w53S3 : Ball := ⟨(20994237712514239322993932447441 / 50000000000000000000000000000000), (3 / 20000000000000000000000000000000)⟩ +def w53S4 : Ball := ⟨(2203790085647775600599247863759 / 12500000000000000000000000000000), (13 / 100000000000000000000000000000000)⟩ +def w53S5 : Ball := ⟨(97133814831988602344613964599 / 3125000000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ +abbrev w53 : Ball := w53S5 +lemma w53_sound : w53.Encloses (weight (-34711) : ℝ) := by + exact weight_enclosed_of_trace (-34711) w53Trace w53S0 w53S1 w53S2 w53S3 w53S4 w53S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def w54Trace : List Ball := [ + ⟨(94726336018724247935001405650513 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(97339359405216626913511575926391 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(6138641275384145091973061253063 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(8221674309759144158417349949779 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(824384554276761515212889951833 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(412933220583575849129301793867 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(17227645304681629058613936897 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2463463001524730737676400099 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2465309182848158152945843913 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(137043754380314986761860231 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(27422201843067345018911793 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2493947158904920272628963 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1663207006776495846063 / 800000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(15997121192714015743917 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(571472749450067305539 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1524253883956988289 / 2000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w54S0 : Ball := ⟨(8973078735532254802827096084977 / 10000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ +def w54S1 : Ball := ⟨(1610322839881222574619643253979 / 2000000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ +def w54S2 : Ball := ⟨(12965698243215627990406698829243 / 20000000000000000000000000000000), (7 / 100000000000000000000000000000000)⟩ +def w54S3 : Ball := ⟨(8405466546706241098088100358087 / 20000000000000000000000000000000), (1 / 10000000000000000000000000000000)⟩ +def w54S4 : Ball := ⟨(17662966966949435490819610182453 / 100000000000000000000000000000000), (9 / 100000000000000000000000000000000)⟩ +def w54S5 : Ball := ⟨(1559902010377734702891454847933 / 50000000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ +abbrev w54 : Ball := w54S5 +lemma w54_sound : w54.Encloses (weight (-34674) : ℝ) := by + exact weight_enclosed_of_trace (-34674) w54Trace w54S0 w54S1 w54S2 w54S3 w54S4 w54S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def w55Trace : List Ball := [ + ⟨(94782596481407390293967837834647 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(24342000436659985798248846633711 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(12279690923707035899012601458711 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1027860623049928738496056645659 / 6250000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(257650548629855777371855527057 / 6250000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(825947649645521268410394518077 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(17229098239486942142506129949 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(19709159115756258215941667633 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2465471054082147153897049431 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(68525927924805527885271123 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(3427959504605575283113549 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2494070093031567274022077 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(207910337903625888762043 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(3199559479998044318173 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1142990598124789335097 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(3810776600625775973 / 5000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w55S0 : Ball := ⟨(350927367021769554806563478539 / 390625000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ +def w55S1 : Ball := ⟨(20176898772964434591503637741663 / 25000000000000000000000000000000), (1 / 20000000000000000000000000000000)⟩ +def w55S2 : Ball := ⟨(3256857952755629649879186192383 / 5000000000000000000000000000000), (9 / 100000000000000000000000000000000)⟩ +def w55S3 : Ball := ⟨(10607123724427591172522982947679 / 25000000000000000000000000000000), (13 / 100000000000000000000000000000000)⟩ +def w55S4 : Ball := ⟨(3600354358570068899733307293759 / 20000000000000000000000000000000), (3 / 25000000000000000000000000000000)⟩ +def w55S5 : Ball := ⟨(324063787681862306483878361403 / 10000000000000000000000000000000), (1 / 20000000000000000000000000000000)⟩ +abbrev w55 : Ball := w55S5 +lemma w55_sound : w55.Encloses (weight (-34294) : ℝ) := by + exact weight_enclosed_of_trace (-34294) w55Trace w55S0 w55S1 w55S2 w55S3 w55S4 w55S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def w56Trace : List Ball := [ + ⟨(14828258162679588668233433511 / 15625000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(3044630856729539361897555248149 / 3125000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4913900328931913865351291252413 / 10000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(16450856664549536116304513510777 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4123429703694875574151481364019 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(826118232085810222406215479293 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(17232150101559854136894803059 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(9856107727824750835734076111 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1232905523003005477650992301 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(274137743543715374791958499 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(27426772317048612058556363 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(311791036391876269407587 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(103965105413534485259281 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(15999217609018758510417 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(285771329366401189279 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(76221491423314339981 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w56S0 : Ball := ⟨(281442867378014528867241064857 / 312500000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ +def w56S1 : Ball := ⟨(81111129700309682879484067206857 / 100000000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ +def w56S2 : Ball := ⟨(16447538403151148866018747980209 / 25000000000000000000000000000000), (7 / 100000000000000000000000000000000)⟩ +def w56S3 : Ball := ⟨(43283443123701095034535898275941 / 100000000000000000000000000000000), (1 / 10000000000000000000000000000000)⟩ +def w56S4 : Ball := ⟨(18734564486426676072317960817043 / 100000000000000000000000000000000), (1 / 10000000000000000000000000000000)⟩ +def w56S5 : Ball := ⟨(701967812992159249958260250633 / 20000000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ +abbrev w56 : Ball := w56S5 +lemma w56_sound : w56.Encloses (weight (-33496) : ℝ) := by + exact weight_enclosed_of_trace (-33496) w56Trace w56S0 w56S1 w56S2 w56S3 w56S4 w56S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def w57Trace : List Ball := [ + ⟨(47452576266722153038239866652237 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(48715187775953089775793627829451 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(9827947809962321612239856445469 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(658041662677348840149949950099 / 4000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(515433351619077091864625844423 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(413062216168045482412261977783 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(34464522053329517477201435527 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4928081635382049087557996979 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1232911701596389705529931453 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(274138980434711163504028661 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(8776603152187461404139 / 32000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1247168837601924423442259 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(207930933092501257873229 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(15999269225058368783519 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(285772189981753086317 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(9527713499172620473 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w57S0 : Ball := ⟨(90069879773963301880084931137781 / 100000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +def w57S1 : Ball := ⟨(811258324249620350057863717173 / 1000000000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ +def w57S2 : Ball := ⟨(65814006866430214971078196359137 / 100000000000000000000000000000000), (11 / 100000000000000000000000000000000)⟩ +def w57S3 : Ball := ⟨(10828708749536308710192444745319 / 25000000000000000000000000000000), (3 / 20000000000000000000000000000000)⟩ +def w57S4 : Ball := ⟨(1172609331822842066457392908073 / 6250000000000000000000000000000), (7 / 50000000000000000000000000000000)⟩ +def w57S5 : Ball := ⟨(176001618569985552871883666203 / 5000000000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ +abbrev w57 : Ball := w57S5 +lemma w57_sound : w57.Encloses (weight (-33467) : ℝ) := by + exact weight_enclosed_of_trace (-33467) w57Trace w57S0 w57S1 w57S2 w57S3 w57S4 w57S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def w58Trace : List Ball := [ + ⟨(18993342510008965157996807914409 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(19492339150256029858466747391331 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(24575134926490143605627622348733 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(8226843974534312368338427230153 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(257749870020624385803960070629 / 6250000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(826213168808936101721999982621 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(137870788321863373812578496193 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(9856958170403147295755950101 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1233000125509347000647412697 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(274156681883793439386824853 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(13714247668551055439896789 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1247235985804475592532897 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(41588253894113779264351 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(320000158048977260693 / 2000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1143138024886875270331 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(7622480718571368373 / 10000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w58S0 : Ball := ⟨(90186764925628414183244839196039 / 100000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ +def w58S1 : Ball := ⟨(81336525677505595400650712769709 / 100000000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ +def w58S2 : Ball := ⟨(66156304092875270549036552301127 / 100000000000000000000000000000000), (7 / 100000000000000000000000000000000)⟩ +def w58S3 : Ball := ⟨(43766565712289852736744340018473 / 100000000000000000000000000000000), (1 / 10000000000000000000000000000000)⟩ +def w58S4 : Ball := ⟨(19155122742481857846431324033341 / 100000000000000000000000000000000), (1 / 10000000000000000000000000000000)⟩ +def w58S5 : Ball := ⟨(1834593636397728454747038920243 / 50000000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ +abbrev w58 : Ball := w58S5 +lemma w58_sound : w58.Encloses (weight (-33052) : ℝ) := by + exact weight_enclosed_of_trace (-33052) w58Trace w58S0 w58S1 w58S2 w58S3 w58S4 w58S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def w59Trace : List Ball := [ + ⟨(47490850333497063225222791199187 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(48734660148762694177943420003049 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(49152833285294875792310473008321 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(8227166055829557417397002741567 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(64439487423007444955437219973 / 1562500000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(6609878139123358026635461521 / 800000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(137873879501826688188413451901 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(19714303290334388889693170837 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2466043294549164617000496577 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(137080495130981559087490183 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(13714443656540082916746213 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2494504657815055209296589 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(207943785215461371537067 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(500005865205680103811 / 3125000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1143150015280410839187 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(38112780723490100557 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w59S0 : Ball := ⟨(90215234615944724854377390667683 / 100000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +def w59S1 : Ball := ⟨(16277577113619902693988897045447 / 20000000000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ +def w59S2 : Ball := ⟨(16559969793115152661081606612261 / 25000000000000000000000000000000), (11 / 100000000000000000000000000000000)⟩ +def w59S3 : Ball := ⟨(43877215927821809924352512727881 / 100000000000000000000000000000000), (3 / 20000000000000000000000000000000)⟩ +def w59S4 : Ball := ⟨(19252100775766999323332088448043 / 100000000000000000000000000000000), (7 / 50000000000000000000000000000000)⟩ +def w59S5 : Ball := ⟨(3706433842802882971598806391479 / 100000000000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ +abbrev w59 : Ball := w59S5 +lemma w59_sound : w59.Encloses (weight (-32951) : ℝ) := by + exact weight_enclosed_of_trace (-32951) w59Trace w59S0 w59S1 w59S2 w59S3 w59S4 w59S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def w60Trace : List Ball := [ + ⟨(23745721986418235040063525564537 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(9746992425611869888708904941217 / 10000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(49153036338039423011353197225847 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(8227191568083800393618580206081 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(412413743494527404410296581619 / 10000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(826236478210584295321268381899 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(17234265544119328566469238221 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(9857166970189822247008305211 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(493209340799113235150302207 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(137080665762452556026083311 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(13714459180560793840576223 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(623626811713823131614597 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(51985996121200138648321 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(400005048176758740281 / 2500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(285787741256181832387 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(19056405297611713989 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w60S0 : Ball := ⟨(45108745012501309613478321617419 / 50000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +def w60S1 : Ball := ⟨(81391955064114471007886683511533 / 100000000000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ +def w60S2 : Ball := ⟨(6624650349158829282356100571561 / 10000000000000000000000000000000), (1 / 10000000000000000000000000000000)⟩ +def w60S3 : Ball := ⟨(1755439689944407948904349965131 / 4000000000000000000000000000000), (7 / 50000000000000000000000000000000)⟩ +def w60S4 : Ball := ⟨(962990157822537223162333237821 / 5000000000000000000000000000000), (13 / 100000000000000000000000000000000)⟩ +def w60S5 : Ball := ⟨(741880035250460119215556900671 / 20000000000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ +abbrev w60 : Ball := w60S5 +lemma w60_sound : w60.Encloses (weight (-32943) : ℝ) := by + exact weight_enclosed_of_trace (-32943) w60Trace w60S0 w60S1 w60S2 w60S3 w60S4 w60S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def w61Trace : List Ball := [ + ⟨(47501388534953300269537814793721 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(97480041307561207442823525984863 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4915643765920409755228575603303 / 10000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(16455237834416701714075898042023 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2062154479563192563901550180923 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1291039273988281839238206127 / 156250000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(68939112861304702693835589537 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(19714847341243848967641021711 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(308262976685646748636650017 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(137083523897039662404424099 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(13714719212699751572800091 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1247275307008564790950161 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(207947322298974951602579 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(16000440458772423459837 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(114316687346405953597 / 10000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(15245324378702664913 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w61S0 : Ball := ⟨(45127638254971856842853482232953 / 50000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ +def w61S1 : Ball := ⟨(40730074689431987531897548967777 / 50000000000000000000000000000000), (1 / 20000000000000000000000000000000)⟩ +def w61S2 : Ball := ⟨(16589389842067082155989944919349 / 25000000000000000000000000000000), (9 / 100000000000000000000000000000000)⟩ +def w61S3 : Ball := ⟨(11008314213283139561532904136561 / 25000000000000000000000000000000), (13 / 100000000000000000000000000000000)⟩ +def w61S4 : Ball := ⟨(2423659636367431757761013627173 / 12500000000000000000000000000000), (3 / 25000000000000000000000000000000)⟩ +def w61S5 : Ball := ⟨(3759440661092295383471873933991 / 100000000000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ +abbrev w61 : Ball := w61S5 +lemma w61_sound : w61.Encloses (weight (-32809) : ℝ) := by + exact weight_enclosed_of_trace (-32809) w61Trace w61S0 w61S1 w61S2 w61S3 w61S4 w61S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def w62Trace : List Ball := [ + ⟨(47528858214889330796866284093103 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(975079837523245654924984235281 / 1000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(24582915603321281247896188877831 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(16457598191952896288198718714391 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2062391316267656867034845239623 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(165268854428717758636608773077 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(13788955151011146139477972461 / 10000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(9858132532099534452817058763 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1233130758119768073808956527 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(34272854081060479329808381 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(27430874517711581976877601 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1247335183198581220676033 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(103978269584235628996157 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(16001099125565780445249 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(228642160385547388341 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(38114692514423055511 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w62S0 : Ball := ⟨(90359694528442120979839736544901 / 100000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ +def w62S1 : Ball := ⟨(81648743952733729761496727521473 / 100000000000000000000000000000000), (1 / 25000000000000000000000000000000)⟩ +def w62S2 : Ball := ⟨(33332586945295364025786775133681 / 50000000000000000000000000000000), (7 / 100000000000000000000000000000000)⟩ +def w62S3 : Ball := ⟨(11110613524656749271650130482569 / 25000000000000000000000000000000), (1 / 10000000000000000000000000000000)⟩ +def w62S4 : Ball := ⟨(19751317263085675720860399788449 / 100000000000000000000000000000000), (1 / 10000000000000000000000000000000)⟩ +def w62S5 : Ball := ⟨(780229067254132455715814614877 / 20000000000000000000000000000000), (1 / 20000000000000000000000000000000)⟩ +abbrev w62 : Ball := w62S5 +lemma w62_sound : w62.Encloses (weight (-32439) : ℝ) := by + exact weight_enclosed_of_trace (-32439) w62Trace w62S0 w62S1 w62S2 w62S3 w62S4 w62S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def w63Trace : List Ball := [ + ⟨(47545421936966955357703772543871 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(19504965983873212950950901066831 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(49171494027989773930876477096503 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(16459021048129646270146966049099 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2062534080327990032477781152897 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(103298996798327791683894613541 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(68948189190076979013423640479 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2464639952160245497992569979 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2466356572890534609400745163 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(274192347021515755240398659 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(3428967515130745679599039 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(498948509321778855783489 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(12997630910451450940857 / 6250000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(16001496130276130884313 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(71452329954660684231 / 6250000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(297777540538980917 / 390625000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w63S0 : Ball := ⟨(90422685886568743561901534002337 / 100000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +def w63S1 : Ball := ⟨(81762621229410782458913378811489 / 100000000000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ +def w63S2 : Ball := ⟨(66851262303040947716324724355973 / 100000000000000000000000000000000), (1 / 10000000000000000000000000000000)⟩ +def w63S3 : Ball := ⟨(44690912715099836768584676428061 / 100000000000000000000000000000000), (7 / 50000000000000000000000000000000)⟩ +def w63S4 : Ball := ⟨(19972776793086722638461408240463 / 100000000000000000000000000000000), (13 / 100000000000000000000000000000000)⟩ +def w63S5 : Ball := ⟨(797823625652927097301574016557 / 20000000000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ +abbrev w63 : Ball := w63S5 +lemma w63_sound : w63.Encloses (weight (-32216) : ℝ) := by + exact weight_enclosed_of_trace (-32216) w63Trace w63S0 w63S1 w63S2 w63S3 w63S4 w63S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def w64Trace : List Ball := [ + ⟨(23773899633748285834342891427259 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4876362381314299440843583684777 / 5000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(24586153355346867344054947098783 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(3291845048197923189222394441697 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4125109136008962874565139610877 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(82639881993942415314992902391 / 10000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(68948679034642606844686148877 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4929310562285235891208506761 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(616592553462081556088703937 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(68548428090499300896559693 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(27431864337294614751865181 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2494752904623930413962481 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(25995361472138860409469 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(8000776550535486118313 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1143241078809691529031 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(76231289351845734121 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w64S0 : Ball := ⟨(18086345721457180138703585993191 / 20000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +def w64S1 : Ball := ⟨(81778975389018111482986147927459 / 100000000000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ +def w64S2 : Ball := ⟨(6687800815677629978363765295201 / 10000000000000000000000000000000), (1 / 10000000000000000000000000000000)⟩ +def w64S3 : Ball := ⟨(8945335950035674573719685240601 / 20000000000000000000000000000000), (7 / 50000000000000000000000000000000)⟩ +def w64S4 : Ball := ⟨(20004758814750161148398130971519 / 100000000000000000000000000000000), (13 / 100000000000000000000000000000000)⟩ +def w64S5 : Ball := ⟨(2000951876181621361436192434079 / 50000000000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ +abbrev w64 : Ball := w64S5 +lemma w64_sound : w64.Encloses (weight (-32184) : ℝ) := by + exact weight_enclosed_of_trace (-32184) w64Trace w64S0 w64S1 w64S2 w64S3 w64S4 w64S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def w65Trace : List Ball := [ + ⟨(9510243377677640497502654733287 / 10000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(48765361610291567863323942170687 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(49173474977496830386002676629551 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2057439846918089772847901849397 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4125168039269619443817574141333 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(41320433029607042478404406331 / 5000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(13789876639377651408790006523 / 10000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(788696741392644063268214751 / 4000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2466389822963264683769266371 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(548391350121221231873241 / 200000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(27432042899959735420054851 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(623691948602428190938919 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(207964037776272101552759 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(8000817498626057520363 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(57162327034164723297 / 5000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(9528954109597374933 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w65S0 : Ball := ⟨(2826397784458169257380700346193 / 3125000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +def w65S1 : Ball := ⟨(81802490224538089510148027126831 / 100000000000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ +def w65S2 : Ball := ⟨(66916474069356496939633314159919 / 100000000000000000000000000000000), (1 / 10000000000000000000000000000000)⟩ +def w65S3 : Ball := ⟨(8955629003749720906388856281539 / 20000000000000000000000000000000), (7 / 50000000000000000000000000000000)⟩ +def w65S4 : Ball := ⟨(5012705678300201162274066253711 / 25000000000000000000000000000000), (13 / 100000000000000000000000000000000)⟩ +def w65S5 : Ball := ⟨(4020354914762092772069910934733 / 100000000000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ +abbrev w65 : Ball := w65S5 +lemma w65_sound : w65.Encloses (weight (-32138) : ℝ) := by + exact weight_enclosed_of_trace (-32138) w65Trace w65S0 w65S1 w65S2 w65S3 w65S4 w65S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def w66Trace : List Ball := [ + ⟨(47551959881956705690865568533283 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(97531478806505749367905636124189 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4917372895406873769112278637073 / 10000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(164595825882721575473548531727 / 1000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(257823802782008365677058632927 / 6250000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(6611286399128735591032436627 / 800000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(137899072554609252077266035017 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(19717456858160095849060834097 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(154149630365718900374048487 / 6250000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(137098050868802318181104959 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(27432081718212553055045309 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1247385515670693202310859 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(207964286908077149073553 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(3200330560174664217323 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1143247728053655633021 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(76231707556112318017 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w66S0 : Ball := ⟨(2826486110769024994277303864871 / 3125000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +def w66S1 : Ball := ⟨(81807603039950940464400969384321 / 100000000000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ +def w66S2 : Ball := ⟨(13384967830284380711145555832811 / 20000000000000000000000000000000), (1 / 10000000000000000000000000000000)⟩ +def w66S3 : Ball := ⟨(1119733523860923514002452793301 / 2500000000000000000000000000000), (7 / 50000000000000000000000000000000)⟩ +def w66S4 : Ball := ⟨(20060850631328021895619230251689 / 100000000000000000000000000000000), (13 / 100000000000000000000000000000000)⟩ +def w66S5 : Ball := ⟨(4024377280524538946645373010247 / 100000000000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ +abbrev w66 : Ball := w66S5 +lemma w66_sound : w66.Encloses (weight (-32128) : ℝ) := by + exact weight_enclosed_of_trace (-32128) w66Trace w66S0 w66S1 w66S2 w66S3 w66S4 w66S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def w67Trace : List Ball := [ + ⟨(2977179782453473397812534840737 / 3125000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(9761577581507318907552595562203 / 10000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(49202059728280366029193834904747 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1029168763705070739117357360143 / 6250000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4126609045456495602003266333541 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(82664939136844166590062919423 / 10000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(137933216958393807659067133979 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(9860865371245155049268421987 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(308358685143729845689035869 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(34280460475004400007407933 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2743641058546971071609409 / 10000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2495131997883312138021689 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(12999504286408589280007 / 6250000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4000909534162119431151 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(285845033621445844197 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(15248006860355467333 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w67S0 : Ball := ⟨(11345407305023630319987560487103 / 12500000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ +def w67S1 : Ball := ⟨(10297461353350684338801061672883 / 12500000000000000000000000000000), (1 / 20000000000000000000000000000000)⟩ +def w67S2 : Ball := ⟨(67864134607200580774998759276317 / 100000000000000000000000000000000), (9 / 100000000000000000000000000000000)⟩ +def w67S3 : Ball := ⟨(2878462978740149703673265370137 / 6250000000000000000000000000000), (13 / 100000000000000000000000000000000)⟩ +def w67S4 : Ball := ⟨(21211005747142695743872387933351 / 100000000000000000000000000000000), (13 / 100000000000000000000000000000000)⟩ +def w67S5 : Ball := ⟨(1124766912013301171239299207633 / 25000000000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ +abbrev w67 : Ball := w67S5 +lemma w67_sound : w67.Encloses (weight (-31013) : ℝ) := by + exact weight_enclosed_of_trace (-31013) w67Trace w67S0 w67S1 w67S2 w67S3 w67S4 w67S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def w68Trace : List Ball := [ + ⟨(19082821330318199585320912915309 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(24422278516357353606153297422207 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1969068031054686151308159498269 / 4000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(16472889865697696014826522024229 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4127850906009227039598341471179 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(826856837330627124341902713097 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(137962902467446869741565602167 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(19725446336136741255721724877 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(308410345181999771320849327 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(68571261897121492016318007 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(13720086820641070007201857 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2495445777206777007665663 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(104008109038954811232033 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4001340970690280005509 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1143495226957679720021 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1906181768229397611 / 2500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w68S0 : Ball := ⟨(9103851748121181514200484868169 / 10000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +def w68S1 : Ball := ⟨(2072002916294227314594335673461 / 2500000000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ +def w68S2 : Ball := ⟨(68691137362108524219187127322263 / 100000000000000000000000000000000), (11 / 100000000000000000000000000000000)⟩ +def w68S3 : Ball := ⟨(47184723521000616231385852952577 / 100000000000000000000000000000000), (1 / 6250000000000000000000000000000)⟩ +def w68S4 : Ball := ⟨(278299766719158598857016608607 / 1250000000000000000000000000000), (1 / 6250000000000000000000000000000)⟩ +def w68S5 : Ball := ⟨(123921216249500953719648431323 / 2500000000000000000000000000000), (1 / 12500000000000000000000000000000)⟩ +abbrev w68 : Ball := w68S5 +lemma w68_sound : w68.Encloses (weight (-30044) : ℝ) := by + exact weight_enclosed_of_trace (-30044) w68Trace w68S0 w68S1 w68S2 w68S3 w68S4 w68S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def w69Trace : List Ball := [ + ⟨(47805475967628620661785892524933 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4889453022515866932835609343927 / 5000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(12315067987788540119270673609527 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(3296264238547170023791648804949 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4129542326047783830579303423151 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(827139355825413928491295939083 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(6900166414392374410624773403 / 5000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(3946101198722342439629516661 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2467845517883467567761858427 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(137170685050793006435373261 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(13722648711830320958904593 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2495873009857587127547621 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2600613733426562216213 / 1250000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(16007713521874603893429 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(22873038514246720151 / 2000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(76257120933240621567 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w69S0 : Ball := ⟨(91414541299660704198725016189483 / 100000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +def w69S1 : Ball := ⟨(83566183610273725499229779212341 / 100000000000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ +def w69S2 : Ball := ⟨(34916535215929905113774121060627 / 50000000000000000000000000000000), (11 / 100000000000000000000000000000000)⟩ +def w69S3 : Ball := ⟨(48766577259410929021170803306349 / 100000000000000000000000000000000), (1 / 6250000000000000000000000000000)⟩ +def w69S4 : Ball := ⟨(2972723821997618945998689143511 / 12500000000000000000000000000000), (1 / 6250000000000000000000000000000)⟩ +def w69S5 : Ball := ⟨(1413933907499541000335628042367 / 25000000000000000000000000000000), (1 / 12500000000000000000000000000000)⟩ +abbrev w69 : Ball := w69S5 +lemma w69_sound : w69.Encloses (weight (-28725) : ℝ) := by + exact weight_enclosed_of_trace (-28725) w69Trace w69S0 w69S1 w69S2 w69S3 w69S4 w69S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def w70Trace : List Ball := [ + ⟨(23988643056420943153627345028999 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(97963365074818779625184332580213 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(12329697984373047030553815398463 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4124003556746373318913244730551 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(516561170475382015251996653563 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(165526306956076647443670213961 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(138073747545804287471665543849 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(9869659456925061618353717987 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2468825666828844875161893181 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(13721973080946273948484527 / 5000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(13727110321945469669016939 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(249661702148279697661669 / 10000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(13006647336448448126711 / 6250000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(16011805105139227720451 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(285981197517193258563 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2383570853380330041 / 3125000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w70S0 : Ball := ⟨(9207279931013963668074302339549 / 10000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +def w70S1 : Ball := ⟨(42387001864026249781323766839769 / 50000000000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ +def w70S2 : Ball := ⟨(8983289635104823867779004419503 / 12500000000000000000000000000000), (11 / 100000000000000000000000000000000)⟩ +def w70S3 : Ball := ⟨(1291191882690908152877607516607 / 2500000000000000000000000000000), (17 / 100000000000000000000000000000000)⟩ +def w70S4 : Ball := ⟨(1667176477926891920883717605763 / 6250000000000000000000000000000), (9 / 50000000000000000000000000000000)⟩ +def w70S5 : Ball := ⟨(711546216589495384139900600903 / 10000000000000000000000000000000), (11 / 100000000000000000000000000000000)⟩ +abbrev w70 : Ball := w70S5 +lemma w70_sound : w70.Encloses (weight (-26429) : ℝ) := by + exact weight_enclosed_of_trace (-26429) w70Trace w70S0 w70S1 w70S2 w70S3 w70S4 w70S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def w71Trace : List Ball := [ + ⟨(95959969822177445516881420373721 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(19593220276637251310543636273393 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(6164963791349959299153013702223 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(16496244772788557130169736089797 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4132535599666203287160821778373 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(206909813968633377067221692379 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(138074852181710606647436852309 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(19739457151293927728159110799 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1234420520300546862360887113 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(274441000147285938141404273 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(13727180298690936344259997 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2496628690431989428404801 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(208107255400930831063619 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(3202373854886534961759 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1143929069409368619791 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(76274536153770508103 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w71S0 : Ball := ⟨(9208315808273206044574012068141 / 10000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +def w71S1 : Ball := ⟨(84793080024894227942258697448883 / 100000000000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ +def w71S2 : Ball := ⟨(7189866420108116523512076811799 / 10000000000000000000000000000000), (11 / 100000000000000000000000000000000)⟩ +def w71S3 : Ball := ⟨(10338835827799660624740986449977 / 20000000000000000000000000000000), (1 / 6250000000000000000000000000000)⟩ +def w71S4 : Ball := ⟨(13361440784274236720333260465431 / 50000000000000000000000000000000), (17 / 100000000000000000000000000000000)⟩ +def w71S5 : Ball := ⟨(892640499158334650275688313439 / 12500000000000000000000000000000), (1 / 10000000000000000000000000000000)⟩ +abbrev w71 : Ball := w71S5 +lemma w71_sound : w71.Encloses (weight (-26393) : ℝ) := by + exact weight_enclosed_of_trace (-26393) w71Trace w71S0 w71S1 w71S2 w71S3 w71S4 w71S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def w72Trace : List Ball := [ + ⟨(23991266957747227188395351906009 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(48984342884159080346521095652661 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(49320577725876442826093461989991 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(8248231257617447386095533335971 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4132579267663189516460563626239 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(413823274066265338819870743841 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(69037947731585030613808968791 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2467448463807663906129826797 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(308606945054152345089435761 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(274442453216256107188834579 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(27454492776880442183417903 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2496639711198718473736729 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(41621620707084323470757 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1601192987920628098647 / 10000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1143933111036591383211 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(38137395031751895591 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w72S0 : Ball := ⟨(92092942438063023001312190166579 / 100000000000000000000000000000000), (1 / 50000000000000000000000000000000)⟩ +def w72S1 : Ball := ⟨(21202775117250973327770577567139 / 25000000000000000000000000000000), (1 / 20000000000000000000000000000000)⟩ +def w72S2 : Ball := ⟨(71929227627634724119557177897881 / 100000000000000000000000000000000), (9 / 100000000000000000000000000000000)⟩ +def w72S3 : Ball := ⟨(6467267233885113103101692122031 / 12500000000000000000000000000000), (7 / 50000000000000000000000000000000)⟩ +def w72S4 : Ball := ⟨(3346043637958720178252837876849 / 12500000000000000000000000000000), (3 / 20000000000000000000000000000000)⟩ +def w72S5 : Ball := ⟨(7165445137359377199444462265751 / 100000000000000000000000000000000), (9 / 100000000000000000000000000000000)⟩ +abbrev w72 : Ball := w72S5 +lemma w72_sound : w72.Encloses (weight (-26359) : ℝ) := by + exact weight_enclosed_of_trace (-26359) w72Trace w72S0 w72S1 w72S2 w72S3 w72S4 w72S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def w73Trace : List Ball := [ + ⟨(95967916836229853535076487075841 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(97970130023268554956379964747981 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(49321062456648626724252944620047 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(8248292098422150654482069915909 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2066301835351439425391366254809 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(827650623265915040460055448399 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(27615295695882364760044391481 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(19739660670665210962294462777 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2468863674524046956338516371 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(54888653046296503649590813 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(5490913328480550475901607 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2496645869901613316307581 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(104054288747864069219497 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(16011963746766319893253 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(228787073920946180177 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(76274931954237096433 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w73S0 : Ball := ⟨(92098410618855293807734146738343 / 100000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +def w73S1 : Ball := ⟨(84821172385192775425321959084731 / 100000000000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ +def w73S2 : Ball := ⟨(17986578211996473658476720834171 / 25000000000000000000000000000000), (11 / 100000000000000000000000000000000)⟩ +def w73S3 : Ball := ⟨(3235169957762662633087786445653 / 6250000000000000000000000000000), (17 / 100000000000000000000000000000000)⟩ +def w73S4 : Ball := ⟨(83730597244880546602927167977 / 312500000000000000000000000000), (19 / 100000000000000000000000000000000)⟩ +def w73S5 : Ball := ⟨(448692026559001458013779811137 / 6250000000000000000000000000000), (11 / 100000000000000000000000000000000)⟩ +abbrev w73 : Ball := w73S5 +lemma w73_sound : w73.Encloses (weight (-26340) : ℝ) := by + exact weight_enclosed_of_trace (-26340) w73Trace w73S0 w73S1 w73S2 w73S3 w73S4 w73S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def w74Trace : List Ball := [ + ⟨(47984033393108529270609571842997 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(19594041207495216474579505987047 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(49321087968993024843220351624949 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(16496590601179395585974219219891 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4132604955080052076508841107719 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(827650837747573472835276879389 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(69038254582298316541177161709 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(19739664510689233311140206579 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2468864101582789535239777061 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(68610826992311771838758763 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(5490914106014383759022057 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(499329238808929638681057 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(41621720488212595952411 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(3202393105854636996311 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1143935488476971616837 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(595897964235706471 / 781250000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w74S0 : Ball := ⟨(92098698426838177469564281446487 / 100000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +def w74S1 : Ball := ⟨(84821702519176849854704396425933 / 100000000000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ +def w74S2 : Ball := ⟨(1438944243650346471378712129703 / 2000000000000000000000000000000), (11 / 100000000000000000000000000000000)⟩ +def w74S3 : Ball := ⟨(51764013408361691782861867910389 / 100000000000000000000000000000000), (17 / 100000000000000000000000000000000)⟩ +def w74S4 : Ball := ⟨(6698782710352622527648452827991 / 25000000000000000000000000000000), (9 / 50000000000000000000000000000000)⟩ +def w74S5 : Ball := ⟨(224368449002596137414301240859 / 3125000000000000000000000000000), (1 / 10000000000000000000000000000000)⟩ +abbrev w74 : Ball := w74S5 +lemma w74_sound : w74.Encloses (weight (-26339) : ℝ) := by + exact weight_enclosed_of_trace (-26339) w74Trace w74S0 w74S1 w74S2 w74S3 w74S4 w74S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/Certificates/Zero0_1_7.lean b/lean/OAI/LinearAlgebra/MatrixFields/Certificates/Zero0_1_7.lean new file mode 100644 index 0000000000000000000000000000000000000000..ff32ec7f1d7ad77534afc3e91c4965bc0dc71752 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/Certificates/Zero0_1_7.lean @@ -0,0 +1,1372 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Certificates.SparseContraction + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +noncomputable section +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate +open scoped BigOperators +def w175Trace : List Ball := [ + ⟨(12415191351984113932732906117773 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(99660380500651059079072911866491 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(49886729305329857561013634483801 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(8319169679698320054082388153217 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4160999920316042561673130720447 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(416194361303583566199564560551 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(69376964051683336916536129013 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(19824398148776138563838364003 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2478283955926034391062597277 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(275385703219024858214213941 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(27540273888866403321074269 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(15648689574925252681249 / 625000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(208658296057867120366611 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(16051238310965442348689 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(573277088357842603873 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(76439099532671271263 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w175S0 : Ball := ⟨(19729532967216784739084393457349 / 20000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +def w175S1 : Ball := ⟨(48656808888061743300257882980879 / 50000000000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ +def w175S2 : Ball := ⟨(94699402046774570418621129554693 / 100000000000000000000000000000000), (3 / 25000000000000000000000000000000)⟩ +def w175S3 : Ball := ⟨(17935953496033303394176963409269 / 20000000000000000000000000000000), (3 / 12500000000000000000000000000000)⟩ +def w175S4 : Ball := ⟨(80424606952967319568608763730587 / 100000000000000000000000000000000), (11 / 25000000000000000000000000000000)⟩ +def w175S5 : Ball := ⟨(3234058701769639661254805874069 / 5000000000000000000000000000000), (71 / 100000000000000000000000000000000)⟩ +abbrev w175 : Ball := w175S5 +lemma w175_sound : w175.Encloses (weight (-4357) : ℝ) := by + exact weight_enclosed_of_trace (-4357) w175Trace w175S0 w175S1 w175S2 w175S3 w175S4 w175S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def w176Trace : List Ball := [ + ⟨(99323703498123134155078443956379 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(49830734653602825322334315901173 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(49887092652172136175932683973821 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(8319215128923882961441659769091 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4161018108242338480622187941589 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(166478350981811608034371819 / 20000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(69377180697235508098493268879 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(309757067506038894548356277 / 1562500000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2478289975902669122205754733 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(137693152645528825192097429 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(27540328628322341810300231 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1251897447003368529189103 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(52164661752146226184849 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(16051263380496070396237 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(143319481013938810139 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(76439204083737917237 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w176S0 : Ball := ⟨(98651980765830777166229913989293 / 100000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +def w176S1 : Ball := ⟨(48661066545109228056357597777893 / 50000000000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ +def w176S2 : Ball := ⟨(94715975892301941778520323293643 / 100000000000000000000000000000000), (13 / 100000000000000000000000000000000)⟩ +def w176S3 : Ball := ⟨(89711160892311226160943282578631 / 100000000000000000000000000000000), (1 / 4000000000000000000000000000000)⟩ +def w176S4 : Ball := ⟨(20120230971615377890151153703799 / 25000000000000000000000000000000), (23 / 50000000000000000000000000000000)⟩ +def w176S5 : Ball := ⟨(506029617938938366762443058991 / 781250000000000000000000000000), (3 / 4000000000000000000000000000000)⟩ +abbrev w176 : Ball := w176S5 +lemma w176_sound : w176.Encloses (weight (-4343) : ℝ) := by + exact weight_enclosed_of_trace (-4343) w176Trace w176S0 w176S1 w176S2 w176S3 w176S4 w176S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def w177Trace : List Ball := [ + ⟨(99328049005208451402499580583609 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(99663646967923778076539612164563 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(49887819357771038473846631443669 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(8319306028567251070469974050063 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4161054484492536840115847644457 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(832397819569661411940712448203 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(138755227983784401223028153737 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(9912280332198390052244553533 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(619575503983728031598156193 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(34423438680287969177918121 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(6885109526958168332912129 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(156487751130635651530041 / 6250000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(208659348913309370965269 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(3210262703955320934979 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(573279595458441677671 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(15287882637174241837 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w177S0 : Ball := ⟨(19732122638362183264540644182777 / 20000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +def w177S1 : Ball := ⟨(97339165953841342057706388054317 / 100000000000000000000000000000000), (7 / 100000000000000000000000000000000)⟩ +def w177S2 : Ball := ⟨(11843641535736831833207936343991 / 12500000000000000000000000000000), (7 / 50000000000000000000000000000000)⟩ +def w177S3 : Ball := ⟨(44886990344649824138792427360347 / 50000000000000000000000000000000), (27 / 100000000000000000000000000000000)⟩ +def w177S4 : Ball := ⟨(10074209511003432690114849384499 / 12500000000000000000000000000000), (49 / 100000000000000000000000000000000)⟩ +def w177S5 : Ball := ⟨(32476703126909447167938135835733 / 50000000000000000000000000000000), (1 / 1250000000000000000000000000000)⟩ +abbrev w177 : Ball := w177S5 +lemma w177_sound : w177.Encloses (weight (-4315) : ℝ) := by + exact weight_enclosed_of_trace (-4315) w177Trace w177S0 w177S1 w177S2 w177S3 w177S4 w177S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def w178Trace : List Ball := [ + ⟨(99347916601702917217757537125577 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(99673602796783611329156016152539 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(49891141642820336599032639688333 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(16639443180077520090544685805351 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(260076298917091723161985778033 / 6250000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(416212772348629267725376117597 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(13875918965556977426603840671 / 10000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4956263991177057476970897693 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1239178528711639796144567009 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(275393014255639484656273141 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(5508187719151182056462029 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(500769145793524574071731 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(208662557676466341962129 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(3210308546327901178969 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(71660904534117072343 / 6250000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(38220184540668843331 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w178S0 : Ball := ⟨(9870008533098918115455859601797 / 10000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +def w178S1 : Ball := ⟨(48708534221722728688122505851369 / 50000000000000000000000000000000), (7 / 100000000000000000000000000000000)⟩ +def w178S2 : Ball := ⟨(14828258162679588668233433511 / 15625000000000000000000000000), (7 / 50000000000000000000000000000000)⟩ +def w178S3 : Ball := ⟨(281442867378014528867241064857 / 312500000000000000000000000000), (27 / 100000000000000000000000000000000)⟩ +def w178S4 : Ball := ⟨(81111129700309682879484067206857 / 100000000000000000000000000000000), (49 / 100000000000000000000000000000000)⟩ +def w178S5 : Ball := ⟨(16447538403151148866018747980209 / 25000000000000000000000000000000), (1 / 1250000000000000000000000000000)⟩ +abbrev w178 : Ball := w178S5 +lemma w178_sound : w178.Encloses (weight (-4187) : ℝ) := by + exact weight_enclosed_of_trace (-4187) w178Trace w178S0 w178S1 w178S2 w178S3 w178S4 w178S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def w179Trace : List Ball := [ + ⟨(24855691545850327472253337341129 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(49855552310818039275500189839387 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(3118978443874995400805617503113 / 6250000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(3328514694739384385990648751571 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2080923549343674965801708723317 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(416264980669731503438529125617 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(17346763700303945074765605393 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(19826921277379245907959318893 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(619641085693726828910162409 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(17213359069612341047331649 / 6250000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1101712935809207575608713 / 4000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2504002808002377300209539 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(208674641497578804110739 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(16052405912388349816829 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1146632020860853128433 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(76443968625203640911 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w179S0 : Ball := ⟨(1976977287111857413602752175699 / 2000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +def w179S1 : Ball := ⟨(19542195968780797505814619325357 / 20000000000000000000000000000000), (7 / 100000000000000000000000000000000)⟩ +def w179S2 : Ball := ⟨(19094871164111622638225973270799 / 20000000000000000000000000000000), (7 / 50000000000000000000000000000000)⟩ +def w179S3 : Ball := ⟨(22788381548376347167989621366387 / 25000000000000000000000000000000), (7 / 25000000000000000000000000000000)⟩ +def w179S4 : Ball := ⟨(41544826687550364961716409983473 / 50000000000000000000000000000000), (13 / 25000000000000000000000000000000)⟩ +def w179S5 : Ball := ⟨(69038904979943881194700567488221 / 100000000000000000000000000000000), (87 / 100000000000000000000000000000000)⟩ +abbrev w179 : Ball := w179S5 +lemma w179_sound : w179.Encloses (weight (-3705) : ℝ) := by + exact weight_enclosed_of_trace (-3705) w179Trace w179S0 w179S1 w179S2 w179S3 w179S4 w179S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def w180Trace : List Ball := [ + ⟨(24860080516341290896503129229441 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(99719899266785998037858901066621 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(49906589436793222653202482562019 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(665732299023802917042440537947 / 4000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(832398790969932850090092400599 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(832554444009339192196822035087 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(138777607838599757062146680857 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(9913679313062968974806951597 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2478612943234444583940605351 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(34427325707919260346400427 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(344290816269095221313533 / 1250000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2504039636217897100165593 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(8347098984586386384801 / 4000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(401315207221960677399 / 2500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1146645513262806847721 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(76444812501670140559 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w180S0 : Ball := ⟨(2472094413115887458356030841823 / 2500000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +def w180S1 : Ball := ⟨(9778001259774054473105372673371 / 10000000000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ +def w180S2 : Ball := ⟨(47804654318071498153358495803553 / 50000000000000000000000000000000), (3 / 25000000000000000000000000000000)⟩ +def w180S3 : Ball := ⟨(45705699489406238682707231944411 / 50000000000000000000000000000000), (3 / 12500000000000000000000000000000)⟩ +def w180S4 : Ball := ⟨(16712087726527277659411303666431 / 20000000000000000000000000000000), (9 / 20000000000000000000000000000000)⟩ +def w180S5 : Ball := ⟨(69823469044785918019090333627239 / 100000000000000000000000000000000), (19 / 25000000000000000000000000000000)⟩ +abbrev w180 : Ball := w180S5 +lemma w180_sound : w180.Encloses (weight (-3592) : ℝ) := by + exact weight_enclosed_of_trace (-3592) w180Trace w180S0 w180S1 w180S2 w180S3 w180S4 w180S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def w181Trace : List Ball := [ + ⟨(9944249734620239086398353308017 / 10000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(99720988940880337353420578169773 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(49906953000722217387040237938873 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(16643398417490461792690810263043 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(208100607500993842154109814411 / 5000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(416278738673209487711157379259 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(138778041259136127180516456603 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1239213300757537265203267591 / 6250000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1239309482324876609412041193 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(275419207866193834513376221 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(27543320051885435384589649 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2504044199075285494496699 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(104338912812644651404107 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4013158340600871274999 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(286661796227143628697 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(76444917052736786533 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w181S0 : Ball := ⟨(24722025696123673874062788081717 / 25000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +def w181S1 : Ball := ⟨(19557713744633575097632752799179 / 20000000000000000000000000000000), (7 / 100000000000000000000000000000000)⟩ +def w181S2 : Ball := ⟨(47813020864628632290757234996807 / 50000000000000000000000000000000), (7 / 50000000000000000000000000000000)⟩ +def w181S3 : Ball := ⟨(45721699284028258483278295221591 / 50000000000000000000000000000000), (27 / 100000000000000000000000000000000)⟩ +def w181S4 : Ball := ⟨(10452368927095550822026725558767 / 12500000000000000000000000000000), (1 / 2000000000000000000000000000000)⟩ +def w181S5 : Ball := ⟨(34960645180196030788867851759237 / 50000000000000000000000000000000), (21 / 25000000000000000000000000000000)⟩ +abbrev w181 : Ball := w181S5 +lemma w181_sound : w181.Encloses (weight (-3578) : ℝ) := by + exact weight_enclosed_of_trace (-3578) w181Trace w181S0 w181S1 w181S2 w181S3 w181S4 w181S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def w182Trace : List Ball := [ + ⟨(49725987955468187868242445671101 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(9972573699195892199308204179439 / 10000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(49908537147082719484644086320787 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(520118583550074013965957800471 / 3125000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(65032678601928404196807084431 / 1562500000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(832570694250563197454787709119 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(138779929761980938944896075307 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(19827648911313040703838695657 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1239322600561893978056223769 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(275421831777938491707467463 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(27543558609344749385176713 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2504064080275920137500161 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(208679355041544954003991 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(3210548522437469683851 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1146654468561374833113 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(38222686298335014853 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w182S0 : Ball := ⟨(12363369390736836453095105804009 / 12500000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +def w182S1 : Ball := ⟨(97825857722757462143876692269313 / 100000000000000000000000000000000), (7 / 100000000000000000000000000000000)⟩ +def w182S2 : Ball := ⟨(9569898439193185797117938531799 / 10000000000000000000000000000000), (7 / 50000000000000000000000000000000)⟩ +def w182S3 : Ball := ⟨(9158295613647217363758918206093 / 10000000000000000000000000000000), (7 / 25000000000000000000000000000000)⟩ +def w182S4 : Ball := ⟨(41937189273474930827880170954463 / 50000000000000000000000000000000), (13 / 25000000000000000000000000000000)⟩ +def w182S5 : Ball := ⟨(17587278441592607965700121886531 / 25000000000000000000000000000000), (11 / 12500000000000000000000000000000)⟩ +abbrev w182 : Ball := w182S5 +lemma w182_sound : w182.Encloses (weight (-3517) : ℝ) := by + exact weight_enclosed_of_trace (-3517) w182Trace w182S0 w182S1 w182S2 w182S3 w182S4 w182S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def w183Trace : List Ball := [ + ⟨(99458191853676996485506081143019 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(19945770126357333866902966262183 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(49909575972542889246622939607217 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(16644054521872557423445111124777 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(16648573676422106024498759631 / 400000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(416289680634124640043877726033 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(69390584074459890303400059103 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(19827803733169197738514016953 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1239331202820227214472511967 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(275423552400479454266974319 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(6885928760630532463566227 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(313009639660875428068141 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(52170089487187941792693 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(8026407126071682147023 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1146659244774286862811 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(76445671314003303917 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w183S0 : Ball := ⟨(3956772770721128506515199771393 / 4000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +def w183S1 : Ball := ⟨(24462579311125244026594135025039 / 25000000000000000000000000000000), (7 / 100000000000000000000000000000000)⟩ +def w183S2 : Ball := ⟨(95746845848494850974174676572979 / 100000000000000000000000000000000), (3 / 20000000000000000000000000000000)⟩ +def w183S3 : Ball := ⟨(2864830778104823649683848641001 / 3125000000000000000000000000000), (29 / 100000000000000000000000000000000)⟩ +def w183S4 : Ball := ⟨(84042295164689298634384866406393 / 100000000000000000000000000000000), (27 / 50000000000000000000000000000000)⟩ +def w183S5 : Ball := ⟨(70631073765487582654707052568089 / 100000000000000000000000000000000), (23 / 25000000000000000000000000000000)⟩ +abbrev w183 : Ball := w183S5 +lemma w183_sound : w183.Encloses (weight (-3477) : ℝ) := by + exact weight_enclosed_of_trace (-3477) w183Trace w183S0 w183S1 w183S2 w183S3 w183S4 w183S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def w184Trace : List Ball := [ + ⟨(99490365565416636332292790703719 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(99744965790016130682756559516713 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4991495241274506514856327501649 / 10000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(130042182346995185683065724021 / 781250000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2081206238657653747694580254813 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(416312107778267525627513838843 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(69393788555183567295966301847 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(3965720994123715599512081027 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1239375721224540406690124201 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(275432456934428447688871593 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(13772262305121354050309369 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(62603614645541538537401 / 2500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(208685548136579524730717 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(16053184998451877457383 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(143335495284089101149 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(38223608588101498981 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w184S0 : Ball := ⟨(791866627227219229699209176743 / 800000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +def w184S1 : Ball := ⟨(97976993018158090480395401414837 / 100000000000000000000000000000000), (7 / 100000000000000000000000000000000)⟩ +def w184S2 : Ball := ⟨(5999681975550124505069906258251 / 6250000000000000000000000000000), (7 / 50000000000000000000000000000000)⟩ +def w184S3 : Ball := ⟨(9215023054781707463539215963191 / 10000000000000000000000000000000), (27 / 100000000000000000000000000000000)⟩ +def w184S4 : Ball := ⟨(84916649900158391512606545626333 / 100000000000000000000000000000000), (51 / 100000000000000000000000000000000)⟩ +def w184S5 : Ball := ⟨(72108374302660701632463080306707 / 100000000000000000000000000000000), (11 / 12500000000000000000000000000000)⟩ +abbrev w184 : Ball := w184S5 +lemma w184_sound : w184.Encloses (weight (-3270) : ℝ) := by + exact weight_enclosed_of_trace (-3270) w184Trace w184S0 w184S1 w184S2 w184S3 w184S4 w184S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def w185Trace : List Ball := [ + ⟨(99521461163089908858700716103647 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(6235033705668939951782200603949 / 6250000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(49920147866467392101063783570821 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(16646698847188617367810591099223 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2081336232239666330274977714023 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(416333778484326370471529758463 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(867461061473084547588034407 / 625000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(19829379167762611033930166791 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2478837473819984033585000739 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(68860265211524437532664059 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(27545306842716642588551163 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(250420977599959640519217 / 10000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(104345281519267472369117 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(8026771611314142422567 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1146707844863531832381 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(3822435538143468451 / 5000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w185S0 : Ball := ⟨(99045212320364130345477940283017 / 100000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +def w185S1 : Ball := ⟨(98099540835860105171601676853239 / 100000000000000000000000000000000), (3 / 50000000000000000000000000000000)⟩ +def w185S2 : Ball := ⟨(48117599561032921710168032712719 / 50000000000000000000000000000000), (3 / 25000000000000000000000000000000)⟩ +def w185S3 : Ball := ⟨(92612135500636624802178339361061 / 100000000000000000000000000000000), (3 / 12500000000000000000000000000000)⟩ +def w185S4 : Ball := ⟨(85770076419882786148844074112819 / 100000000000000000000000000000000), (9 / 20000000000000000000000000000000)⟩ +def w185S5 : Ball := ⟨(36782530045362665672288806008641 / 50000000000000000000000000000000), (39 / 50000000000000000000000000000000)⟩ +abbrev w185 : Ball := w185S5 +lemma w185_sound : w185.Encloses (weight (-3070) : ℝ) := by + exact weight_enclosed_of_trace (-3070) w185Trace w185S0 w185S1 w185S2 w185S3 w185S4 w185S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def w186Trace : List Ball := [ + ⟨(99568900662470816514208552130991 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(3991371804971825401902736147063 / 4000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(24964036247883104802210062747163 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(26013563918188208166319893553 / 156250000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4163068997025895747572610255911 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(41636683003497074506258641661 / 5000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(138803214672976366445830044263 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(9915279960942922885652904213 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2478968682009807979274974929 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(17215886422020679279331659 / 6250000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(27546499825657994940562287 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1252154598526809344813827 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(104349105597475631398959 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(8027044771613974010277 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(573372133805897008433 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(76450988482535584883 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w186S0 : Ball := ⟨(9913965979132981403710742545553 / 10000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +def w186S1 : Ball := ⟨(98286721435406174665473615960613 / 100000000000000000000000000000000), (7 / 100000000000000000000000000000000)⟩ +def w186S2 : Ball := ⟨(12075349513151414514529855232981 / 12500000000000000000000000000000), (3 / 20000000000000000000000000000000)⟩ +def w186S3 : Ball := ⟨(93321002153450306264064872946103 / 100000000000000000000000000000000), (3 / 10000000000000000000000000000000)⟩ +def w186S4 : Ball := ⟨(43544047214621383495429087826007 / 50000000000000000000000000000000), (57 / 100000000000000000000000000000000)⟩ +def w186S5 : Ball := ⟨(1185052529893235166451447015261 / 1562500000000000000000000000000), (1 / 1000000000000000000000000000000)⟩ +abbrev w186 : Ball := w186S5 +lemma w186_sound : w186.Encloses (weight (-2765) : ℝ) := by + exact weight_enclosed_of_trace (-2765) w186Trace w186S0 w186S1 w186S2 w186S3 w186S4 w186S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def w187Trace : List Ball := [ + ⟨(99602355209040861197807880258721 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(99801045574058366040375150752489 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(49933659844174797709766085649909 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(666003132990266129407140142087 / 4000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1332271538498333634814041509 / 32000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(208195065686215395939573398707 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(138809873185066560009973585573 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(19831392331878620590507498949 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2479061180541660695534655279 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(275463433303708409851846541 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(13773670418885857095109159 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(78261852660207547756871 / 3125000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(208703602831146487300669 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(16054474675326115496511 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(229353988793680458361 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(76452594088201933771 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w187S0 : Ball := ⟨(6200393226992468235473533170609 / 6250000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +def w187S1 : Ball := ⟨(98418882993495228737242954611417 / 100000000000000000000000000000000), (7 / 100000000000000000000000000000000)⟩ +def w187S2 : Ball := ⟨(19372553059374608712680432468263 / 20000000000000000000000000000000), (7 / 50000000000000000000000000000000)⟩ +def w187S3 : Ball := ⟨(1876479060191422559033355299463 / 2000000000000000000000000000000), (7 / 25000000000000000000000000000000)⟩ +def w187S4 : Ball := ⟨(88029341583422111182801317951789 / 100000000000000000000000000000000), (53 / 100000000000000000000000000000000)⟩ +def w187S5 : Ball := ⟨(77491649796108092848828209234519 / 100000000000000000000000000000000), (47 / 50000000000000000000000000000000)⟩ +abbrev w187 : Ball := w187S5 +lemma w187_sound : w187.Encloses (weight (-2550) : ℝ) := by + exact weight_enclosed_of_trace (-2550) w187Trace w187S0 w187S1 w187S2 w187S3 w187S4 w187S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def w188Trace : List Ball := [ + ⟨(49802344833298945363222839682779 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(99802214350039422120222960963773 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(998680993883785744041853910733 / 2000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(8325087912989386718081825748297 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4163368063215647937644855560767 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(832783514261138687952310759689 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(69405168876641626006794306193 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(9915725204656331398851471713 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2479067634159456476737241001 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(137732039356046642104013173 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2754739951479222218145243 / 10000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(313048021890918220272639 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4174079580029300255807 / 2000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(16054501545650998469549 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1146771735382375976313 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(191131765268004779 / 250000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w188S0 : Ball := ⟨(99210942035792726320799598581467 / 100000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +def w188S1 : Ball := ⟨(98428110196294241913505639944541 / 100000000000000000000000000000000), (7 / 100000000000000000000000000000000)⟩ +def w188S2 : Ball := ⟨(24220232192034606273474291591403 / 25000000000000000000000000000000), (3 / 20000000000000000000000000000000)⟩ +def w188S3 : Ball := ⟨(11732392948721389376433911667343 / 12500000000000000000000000000000), (3 / 10000000000000000000000000000000)⟩ +def w188S4 : Ball := ⟨(88095388354052721900922296256263 / 100000000000000000000000000000000), (57 / 100000000000000000000000000000000)⟩ +def w188S5 : Ball := ⟨(77607974492513679419890243785447 / 100000000000000000000000000000000), (101 / 100000000000000000000000000000000)⟩ +abbrev w188 : Ball := w188S5 +lemma w188_sound : w188.Encloses (weight (-2535) : ℝ) := by + exact weight_enclosed_of_trace (-2535) w188Trace w188S0 w188S1 w188S2 w188S3 w188S4 w188S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def w189Trace : List Ball := [ + ⟨(99660888785280590661143702258429 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(99830348399458131034052693010717 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(49943433462187736065444559862473 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(416313065775631533066716743527 / 2500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4163837539328160146604430715531 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(166572354797072018383717454197 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(138821519182554970302428658273 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(3966569646155280159571995787 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(247922296035046093285472851 / 10000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2754796123699652991146921 / 1000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(27548811744208253433256087 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1252250933230869446363469 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(104356516273484419984907 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1605514825012690260507 / 10000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1146814850329197960663 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(238923131347295973 / 312500000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w189S0 : Ball := ⟨(124153659418400832569672287431 / 125000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +def w189S1 : Ball := ⟨(19730087868134745292034087073167 / 20000000000000000000000000000000), (7 / 100000000000000000000000000000000)⟩ +def w189S2 : Ball := ⟨(19463818364215892916364093655161 / 20000000000000000000000000000000), (3 / 20000000000000000000000000000000)⟩ +def w189S3 : Ball := ⟨(94710056328796959379104133535603 / 100000000000000000000000000000000), (3 / 10000000000000000000000000000000)⟩ +def w189S4 : Ball := ⟨(89699947698038929789567959309211 / 100000000000000000000000000000000), (29 / 50000000000000000000000000000000)⟩ +def w189S5 : Ball := ⟨(40230403085154597496901408538171 / 50000000000000000000000000000000), (21 / 20000000000000000000000000000000)⟩ +abbrev w189 : Ball := w189S5 +lemma w189_sound : w189.Encloses (weight (-2174) : ℝ) := by + exact weight_enclosed_of_trace (-2174) w189Trace w189S0 w189S1 w189S2 w189S3 w189S4 w189S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def w190Trace : List Ball := [ + ⟨(49861130704630763047535806109919 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(24965266583233609431765193722453 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(12488419511511215545098886309037 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(16655084568139440756657892621043 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(26027187701631258446683248593 / 625000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(832947202036967261967421765977 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(27766744907223109458809337961 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(19834374030864393651127760323 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2479392505329480885756231427 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(55099313563992663293648747 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(27550353220886312747669859 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(125231516396906155280183 / 5000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(208722914534389897186987 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(8027927063567209908089 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(286715477500654670939 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(9557293049608432793 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w190S0 : Ball := ⟨(99445294205770906125170809966219 / 100000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +def w190S1 : Ball := ⟨(49446832698361662774348449010957 / 50000000000000000000000000000000), (7 / 100000000000000000000000000000000)⟩ +def w190S2 : Ball := ⟨(4889978527799536233193470736727 / 5000000000000000000000000000000), (7 / 50000000000000000000000000000000)⟩ +def w190S3 : Ball := ⟨(4782378000468103950677666253317 / 5000000000000000000000000000000), (7 / 25000000000000000000000000000000)⟩ +def w190S4 : Ball := ⟨(18296911471489040056869626936841 / 20000000000000000000000000000000), (27 / 50000000000000000000000000000000)⟩ +def w190S5 : Ball := ⟨(41847121174438403636733987385197 / 50000000000000000000000000000000), (99 / 100000000000000000000000000000000)⟩ +abbrev w190 : Ball := w190S5 +lemma w190_sound : w190.Encloses (weight (-1780) : ℝ) := by + exact weight_enclosed_of_trace (-1780) w190Trace w190S0 w190S1 w190S2 w190S3 w190S4 w190S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def w191Trace : List Ball := [ + ⟨(49881858544285669090431918402831 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(49940905982279908932346249793997 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(49960596223062461424570847875897 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4164203639369994761337080486481 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2082348044742429869134947581029 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(416502442654040348062669402193 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(138841965760692082639695195677 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1983540425756671035928907259 / 10000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2479506981508443033953924069 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(275508015973421305673833101 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(27551394002684640101491511 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2504717062615820794000957 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(10436479331066494145389 / 5000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(16056330716452051496157 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1146893683302764908141 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(76460330867133735851 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w191S0 : Ball := ⟨(49763996236642504205094356041887 / 50000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +def w191S1 : Ball := ⟨(99058212857622772855370888953607 / 100000000000000000000000000000000), (7 / 100000000000000000000000000000000)⟩ +def w191S2 : Ball := ⟨(1533207739772828380404245348957 / 1562500000000000000000000000000), (7 / 50000000000000000000000000000000)⟩ +def w191S3 : Ball := ⟨(96285735866339533992202794619269 / 100000000000000000000000000000000), (7 / 25000000000000000000000000000000)⟩ +def w191S4 : Ball := ⟨(46354714656612516652688244278839 / 50000000000000000000000000000000), (11 / 20000000000000000000000000000000)⟩ +def w191S5 : Ball := ⟨(85950382835838690706047952575689 / 100000000000000000000000000000000), (103 / 100000000000000000000000000000000)⟩ +abbrev w191 : Ball := w191S5 +lemma w191_sound : w191.Encloses (weight (-1514) : ℝ) := by + exact weight_enclosed_of_trace (-1514) w191Trace w191S0 w191S1 w191S2 w191S3 w191S4 w191S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def w192Trace : List Ball := [ + ⟨(49987032931739362099937440160927 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(24996758092795951927826195803241 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(3124729835227057516919707719423 / 6250000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2083198249195050257675416497151 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(416645053017679137671205574393 / 10000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(833297310362563680427653924047 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(69441871363186324201270914239 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1984062656863801965131724839 / 10000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2480087255215878646829690667 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(68891511182180145029458271 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(5511333889793856570685729 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1252578345268046513107889 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(104381702320677184448087 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(16058746319502249357223 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(35845460164487008383 / 3125000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(76470397641265076781 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w192S0 : Ball := ⟨(99948138452751819441462357001721 / 100000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +def w192S1 : Ball := ⟨(99896303801704468635569351663811 / 100000000000000000000000000000000), (7 / 100000000000000000000000000000000)⟩ +def w192S2 : Ball := ⟨(49896357566212173366378600464419 / 50000000000000000000000000000000), (3 / 20000000000000000000000000000000)⟩ +def w192S3 : Ball := ⟨(155602906148456175041603885009 / 156250000000000000000000000000), (31 / 100000000000000000000000000000000)⟩ +def w192S4 : Ball := ⟨(99173434989958187099241294743813 / 100000000000000000000000000000000), (63 / 100000000000000000000000000000000)⟩ +def w192S5 : Ball := ⟨(49176851038537314210548640967583 / 50000000000000000000000000000000), (63 / 50000000000000000000000000000000)⟩ +abbrev w192 : Ball := w192S5 +lemma w192_sound : w192.Encloses (weight (-166) : ℝ) := by + exact weight_enclosed_of_trace (-166) w192Trace w192S0 w192S1 w192S2 w192S3 w192S4 w192S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def w193Trace : List Ball := [ + ⟨(24995234829194772061239991990961 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(99990469355602649390331992949819 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(49996823068068772028889443570563 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(16665872426113946809476351144877 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4166507817546791818048638896097 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(416653429179930801384316249029 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(138885106736947224660119474937 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(620024908469545699903926497 / 3125000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(620026550005079233602540067 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(55113587843382893113140779 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(27556841675755855052048577 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2505171042809707586844313 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(208764508665131335857699 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(16058825178512442762287 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1147059982540784814409 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(38235363115165839207 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w193S0 : Ball := ⟨(49980941133327312484694549890891 / 50000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +def w193S1 : Ball := ⟨(9992377906292520382993342626511 / 10000000000000000000000000000000), (7 / 100000000000000000000000000000000)⟩ +def w193S2 : Ball := ⟨(4992380811108144663012011909347 / 5000000000000000000000000000000), (3 / 20000000000000000000000000000000)⟩ +def w193S3 : Ball := ⟨(99695464652483265607512618822371 / 100000000000000000000000000000000), (31 / 100000000000000000000000000000000)⟩ +def w193S4 : Ball := ⟨(99391856722745402596868367365467 / 100000000000000000000000000000000), (63 / 100000000000000000000000000000000)⟩ +def w193S5 : Ball := ⟨(19757482365589500963001701230393 / 20000000000000000000000000000000), (63 / 50000000000000000000000000000000)⟩ +abbrev w193 : Ball := w193S5 +lemma w193_sound : w193.Encloses (weight (-122) : ℝ) := by + exact weight_enclosed_of_trace (-122) w193Trace w193S0 w193S1 w193S2 w193S3 w193S4 w193S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def w194Trace : List Ball := [ + ⟨(12498984416258648195712197534271 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(99995937610023806799012010244939 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4999864586083939677525852383333 / 10000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(8333164065250613793699487200691 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4166598959250206371597111195457 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(208330512185523290939911413439 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(27777455360417412154288189239 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(3968213666038442948782014569 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1240068170009390345827669767 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(17223184576513134476304453 / 6250000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(27557115676983442485468489 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2505193876285133400992783 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(208766265088941691417 / 100000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(16058950637518462775011 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1147068346483992386111 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(19117812246416227071 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w194S0 : Ball := ⟨(9998375132024098597819740729157 / 10000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +def w194S1 : Ball := ⟨(99967505280677911066314510992599 / 100000000000000000000000000000000), (7 / 100000000000000000000000000000000)⟩ +def w194S2 : Ball := ⟨(99935021120423660346027921790003 / 100000000000000000000000000000000), (3 / 20000000000000000000000000000000)⟩ +def w194S3 : Ball := ⟨(99870084463395230656561932324761 / 100000000000000000000000000000000), (31 / 100000000000000000000000000000000)⟩ +def w194S4 : Ball := ⟨(49870168853628487182377852301003 / 50000000000000000000000000000000), (63 / 100000000000000000000000000000000)⟩ +def w194S5 : Ball := ⟨(49740674829788337188473087934709 / 50000000000000000000000000000000), (127 / 100000000000000000000000000000000)⟩ +abbrev w194 : Ball := w194S5 +lemma w194_sound : w194.Encloses (weight (-52) : ℝ) := by + exact weight_enclosed_of_trace (-52) w194Trace w194S0 w194S1 w194S2 w194S3 w194S4 w194S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def w195 : Ball := .exact 1 +lemma w195_sound : w195.Encloses (weight 0 : ℝ) := by + have he : weight 0 = 1 := by decide +kernel + rw [he, Rat.cast_one] + simpa only [w195, Rat.cast_one] using Ball.exact_sound 1 + +def w196Trace : List Ball := [ + ⟨(800021250282229061397616355361 / 800000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4000053125470380727784538541189 / 4000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(50000442711273208977450530824507 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(16666777344337974608219275549919 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2083344401090664519696625934459 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(166667404516688764876816954333 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(27777883184873793893182729747 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2480166965085068351811042641 / 12500000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1240083025045546297812448833 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(137786962116459195085845847 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(6889346442199022291779133 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2505216383944077523314819 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(104383998223921122037141 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(16059074306043564476871 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1147076591054210974669 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(76471764273064806299 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w196S0 : Ball := ⟨(4000212505644631206568430064813 / 4000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +def w196S1 : Ball := ⟨(25002656391118279144800146186637 / 25000000000000000000000000000000), (7 / 100000000000000000000000000000000)⟩ +def w196S2 : Ball := ⟨(3125664133061638652561663844491 / 3125000000000000000000000000000), (3 / 20000000000000000000000000000000)⟩ +def w196S3 : Ball := ⟨(800340072260236504272132654903 / 800000000000000000000000000000), (31 / 100000000000000000000000000000000)⟩ +def w196S4 : Ball := ⟨(100085036135237592062515148655159 / 100000000000000000000000000000000), (63 / 100000000000000000000000000000000)⟩ +def w196S5 : Ball := ⟨(100170144581918145585494921142611 / 100000000000000000000000000000000), (127 / 100000000000000000000000000000000)⟩ +abbrev w196 : Ball := w196S5 +lemma w196_sound : w196.Encloses (weight (17) : ℝ) := by + exact weight_enclosed_of_trace (17) w196Trace w196S0 w196S1 w196S2 w196S3 w196S4 w196S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def w197Trace : List Ball := [ + ⟨(25003672144666522574407293810279 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(25001836027387740645404665729023 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(625030600081921839886205624879 / 1250000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(3333455732762132284527646393759 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(260424316593513179389490267511 / 6250000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(166670746613383578114197118947 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(69445901564450170731102645181 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1240102132533009921872967449 / 6250000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1240099602782911067946697043 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(275577239775163664581143607 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(27557687181331442181544571 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2505241501627431402564057 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(41753985715097952471767 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(8029606157523631435577 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(71692861977987983519 / 6250000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(19118084825982839789 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w197S0 : Ball := ⟨(10002937931487561289448862263219 / 10000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +def w197S1 : Ball := ⟨(20011753452238530278613660969213 / 20000000000000000000000000000000), (7 / 100000000000000000000000000000000)⟩ +def w197S2 : Ball := ⟨(100117569058295183639240950010957 / 100000000000000000000000000000000), (3 / 20000000000000000000000000000000)⟩ +def w197S3 : Ball := ⟨(100235276341425051441370822762279 / 100000000000000000000000000000000), (31 / 100000000000000000000000000000000)⟩ +def w197S4 : Ball := ⟨(100471106232418446456510702275909 / 100000000000000000000000000000000), (63 / 100000000000000000000000000000000)⟩ +def w197S5 : Ball := ⟨(4037777275026365117837262628101 / 4000000000000000000000000000000), (127 / 100000000000000000000000000000000)⟩ +abbrev w197 : Ball := w197S5 +lemma w197_sound : w197.Encloses (weight (94) : ℝ) := by + exact weight_enclosed_of_trace (94) w197Trace w197S0 w197S1 w197S2 w197S3 w197S4 w197S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def w198Trace : List Ball := [ + ⟨(100046104374801339061281256367671 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(25005762604116101033901758736749 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(100015366354024723989846549679 / 200000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1041786713540609481122012135647 / 6250000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4167050810760745839788482570801 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(833397356646341688007385241263 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(34724508750294060502729724659 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(19842413097986434234597417511 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2480285758032194725201724413 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(55117178994794943594601333 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(6889618503490954540188779 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2505307070757983886745053 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(104387486168959175421941 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(8029786291374700237201 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1147109809433762731797 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(76473840358531062069 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w198S0 : Ball := ⟨(100092230005736436346044576577509 / 100000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +def w198S1 : Ball := ⟨(20036909015042490824580426800099 / 20000000000000000000000000000000), (7 / 100000000000000000000000000000000)⟩ +def w198S2 : Ball := ⟨(100369430719272759949295620039269 / 100000000000000000000000000000000), (3 / 20000000000000000000000000000000)⟩ +def w198S3 : Ball := ⟨(100740226229108943786285637747531 / 100000000000000000000000000000000), (31 / 100000000000000000000000000000000)⟩ +def w198S4 : Ball := ⟨(50742965903460248018971649086741 / 50000000000000000000000000000000), (63 / 100000000000000000000000000000000)⟩ +def w198S5 : Ball := ⟨(102993943547189172179056608068133 / 100000000000000000000000000000000), (1 / 781250000000000000000000000000)⟩ +abbrev w198 : Ball := w198S5 +lemma w198_sound : w198.Encloses (weight (295) : ℝ) := by + exact weight_enclosed_of_trace (295) w198Trace w198S0 w198S1 w198S2 w198S3 w198S4 w198S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +def w199Trace : List Ball := [ + ⟨(50299565702744265076996558074139 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(50149633731710606664346630250871 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(10019941228855690837754994565271 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(8345792877087454985087968724461 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4171649491309368099904080733279 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(208540921483711566305584791517 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(69503749014945907528607500637 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(3971218950660358238488722301 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(1240902916616263466583660047 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(55147578719850151178826729 / 20000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(13786145698506878875057519 / 50000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(2506458471837547066947491 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4177270770390380554847 / 2000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(16065898544688539931839 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(286882882215028300157 / 25000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(76500187227325847531 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩, + ⟨(4779477332387385297 / 100000000000000000000000000000000), (1 / 100000000000000000000000000000000)⟩] +def w199S0 : Ball := ⟨(20240370479077497384677910830887 / 20000000000000000000000000000000), (3 / 100000000000000000000000000000000)⟩ +def w199S1 : Ball := ⟨(51209074641288980124384374056799 / 50000000000000000000000000000000), (7 / 100000000000000000000000000000000)⟩ +def w199S2 : Ball := ⟨(52447386512342121767996265200193 / 50000000000000000000000000000000), (3 / 20000000000000000000000000000000)⟩ +def w199S3 : Ball := ⟨(27507283519750063113446548727581 / 25000000000000000000000000000000), (1 / 3125000000000000000000000000000)⟩ +def w199S4 : Ball := ⟨(121064103461746147327839799820383 / 100000000000000000000000000000000), (71 / 100000000000000000000000000000000)⟩ +def w199S5 : Ball := ⟨(36641292867490938732777622895029 / 25000000000000000000000000000000), (43 / 25000000000000000000000000000000)⟩ +abbrev w199 : Ball := w199S5 +lemma w199_sound : w199.Encloses (weight (3823) : ℝ) := by + exact weight_enclosed_of_trace (3823) w199Trace w199S0 w199S1 w199S2 w199S3 w199S4 w199S5 + (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) (by decide +kernel) + +end MatrixMultiplication.NativeNumerics + +namespace MatrixMultiplication.NativeNumerics +open AllFieldParameters AllFieldHistory AllFieldCertificates AllFieldCertificates.Replay +open AllFieldInitialEntropyCertificate AllFieldNativeCapacity +open scoped BigOperators +def Z0_0_8Raw (ij : PairSlot) : Ball := + match ij.1.val, ij.2.val with + | 0, 0 => w195 + | 0, 1 => w195 + | 0, 2 => w195 + | 0, 3 => w195 + | 0, 4 => w195 + | 0, 5 => w195 + | 1, 0 => w195 + | 1, 1 => w195 + | 1, 2 => w195 + | 1, 3 => w195 + | 1, 4 => w195 + | 1, 5 => w195 + | 2, 0 => w195 + | 2, 1 => w195 + | 2, 2 => w195 + | 2, 3 => w195 + | 2, 4 => w195 + | 2, 5 => w195 + | 3, 0 => w195 + | 3, 1 => w195 + | 3, 2 => w195 + | 3, 3 => w195 + | 3, 4 => w195 + | 3, 5 => w195 + | 4, 0 => w195 + | 4, 1 => w195 + | 4, 2 => w195 + | 4, 3 => w195 + | 4, 4 => w195 + | 4, 5 => w195 + | 5, 0 => w195 + | 5, 1 => w195 + | 5, 2 => w195 + | 5, 3 => w195 + | 5, 4 => w195 + | 5, 5 => w195 + | _, _ => (.exact 0) +lemma Z0_0_8Raw_sound_0 (j : Fin 6) : + (Z0_0_8Raw (0,j)).Encloses (weight (orderedPairInteger (shape 0 0 8) 0 j) : ℝ) := by + fin_cases j + · change (Z0_0_8Raw (0,0)).Encloses (weight (orderedPairInteger (shape 0 0 8) 0 0) : ℝ) + have he : orderedPairInteger (shape 0 0 8) 0 0 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_0_8Raw (0,1)).Encloses (weight (orderedPairInteger (shape 0 0 8) 0 1) : ℝ) + have he : orderedPairInteger (shape 0 0 8) 0 1 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_0_8Raw (0,2)).Encloses (weight (orderedPairInteger (shape 0 0 8) 0 2) : ℝ) + have he : orderedPairInteger (shape 0 0 8) 0 2 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_0_8Raw (0,3)).Encloses (weight (orderedPairInteger (shape 0 0 8) 0 3) : ℝ) + have he : orderedPairInteger (shape 0 0 8) 0 3 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_0_8Raw (0,4)).Encloses (weight (orderedPairInteger (shape 0 0 8) 0 4) : ℝ) + have he : orderedPairInteger (shape 0 0 8) 0 4 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_0_8Raw (0,5)).Encloses (weight (orderedPairInteger (shape 0 0 8) 0 5) : ℝ) + have he : orderedPairInteger (shape 0 0 8) 0 5 = (0) := by decide +kernel + rw [he] + exact w195_sound +lemma Z0_0_8Raw_sound_1 (j : Fin 6) : + (Z0_0_8Raw (1,j)).Encloses (weight (orderedPairInteger (shape 0 0 8) 1 j) : ℝ) := by + fin_cases j + · change (Z0_0_8Raw (1,0)).Encloses (weight (orderedPairInteger (shape 0 0 8) 1 0) : ℝ) + have he : orderedPairInteger (shape 0 0 8) 1 0 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_0_8Raw (1,1)).Encloses (weight (orderedPairInteger (shape 0 0 8) 1 1) : ℝ) + have he : orderedPairInteger (shape 0 0 8) 1 1 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_0_8Raw (1,2)).Encloses (weight (orderedPairInteger (shape 0 0 8) 1 2) : ℝ) + have he : orderedPairInteger (shape 0 0 8) 1 2 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_0_8Raw (1,3)).Encloses (weight (orderedPairInteger (shape 0 0 8) 1 3) : ℝ) + have he : orderedPairInteger (shape 0 0 8) 1 3 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_0_8Raw (1,4)).Encloses (weight (orderedPairInteger (shape 0 0 8) 1 4) : ℝ) + have he : orderedPairInteger (shape 0 0 8) 1 4 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_0_8Raw (1,5)).Encloses (weight (orderedPairInteger (shape 0 0 8) 1 5) : ℝ) + have he : orderedPairInteger (shape 0 0 8) 1 5 = (0) := by decide +kernel + rw [he] + exact w195_sound +lemma Z0_0_8Raw_sound_2 (j : Fin 6) : + (Z0_0_8Raw (2,j)).Encloses (weight (orderedPairInteger (shape 0 0 8) 2 j) : ℝ) := by + fin_cases j + · change (Z0_0_8Raw (2,0)).Encloses (weight (orderedPairInteger (shape 0 0 8) 2 0) : ℝ) + have he : orderedPairInteger (shape 0 0 8) 2 0 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_0_8Raw (2,1)).Encloses (weight (orderedPairInteger (shape 0 0 8) 2 1) : ℝ) + have he : orderedPairInteger (shape 0 0 8) 2 1 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_0_8Raw (2,2)).Encloses (weight (orderedPairInteger (shape 0 0 8) 2 2) : ℝ) + have he : orderedPairInteger (shape 0 0 8) 2 2 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_0_8Raw (2,3)).Encloses (weight (orderedPairInteger (shape 0 0 8) 2 3) : ℝ) + have he : orderedPairInteger (shape 0 0 8) 2 3 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_0_8Raw (2,4)).Encloses (weight (orderedPairInteger (shape 0 0 8) 2 4) : ℝ) + have he : orderedPairInteger (shape 0 0 8) 2 4 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_0_8Raw (2,5)).Encloses (weight (orderedPairInteger (shape 0 0 8) 2 5) : ℝ) + have he : orderedPairInteger (shape 0 0 8) 2 5 = (0) := by decide +kernel + rw [he] + exact w195_sound +lemma Z0_0_8Raw_sound_3 (j : Fin 6) : + (Z0_0_8Raw (3,j)).Encloses (weight (orderedPairInteger (shape 0 0 8) 3 j) : ℝ) := by + fin_cases j + · change (Z0_0_8Raw (3,0)).Encloses (weight (orderedPairInteger (shape 0 0 8) 3 0) : ℝ) + have he : orderedPairInteger (shape 0 0 8) 3 0 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_0_8Raw (3,1)).Encloses (weight (orderedPairInteger (shape 0 0 8) 3 1) : ℝ) + have he : orderedPairInteger (shape 0 0 8) 3 1 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_0_8Raw (3,2)).Encloses (weight (orderedPairInteger (shape 0 0 8) 3 2) : ℝ) + have he : orderedPairInteger (shape 0 0 8) 3 2 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_0_8Raw (3,3)).Encloses (weight (orderedPairInteger (shape 0 0 8) 3 3) : ℝ) + have he : orderedPairInteger (shape 0 0 8) 3 3 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_0_8Raw (3,4)).Encloses (weight (orderedPairInteger (shape 0 0 8) 3 4) : ℝ) + have he : orderedPairInteger (shape 0 0 8) 3 4 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_0_8Raw (3,5)).Encloses (weight (orderedPairInteger (shape 0 0 8) 3 5) : ℝ) + have he : orderedPairInteger (shape 0 0 8) 3 5 = (0) := by decide +kernel + rw [he] + exact w195_sound +lemma Z0_0_8Raw_sound_4 (j : Fin 6) : + (Z0_0_8Raw (4,j)).Encloses (weight (orderedPairInteger (shape 0 0 8) 4 j) : ℝ) := by + fin_cases j + · change (Z0_0_8Raw (4,0)).Encloses (weight (orderedPairInteger (shape 0 0 8) 4 0) : ℝ) + have he : orderedPairInteger (shape 0 0 8) 4 0 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_0_8Raw (4,1)).Encloses (weight (orderedPairInteger (shape 0 0 8) 4 1) : ℝ) + have he : orderedPairInteger (shape 0 0 8) 4 1 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_0_8Raw (4,2)).Encloses (weight (orderedPairInteger (shape 0 0 8) 4 2) : ℝ) + have he : orderedPairInteger (shape 0 0 8) 4 2 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_0_8Raw (4,3)).Encloses (weight (orderedPairInteger (shape 0 0 8) 4 3) : ℝ) + have he : orderedPairInteger (shape 0 0 8) 4 3 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_0_8Raw (4,4)).Encloses (weight (orderedPairInteger (shape 0 0 8) 4 4) : ℝ) + have he : orderedPairInteger (shape 0 0 8) 4 4 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_0_8Raw (4,5)).Encloses (weight (orderedPairInteger (shape 0 0 8) 4 5) : ℝ) + have he : orderedPairInteger (shape 0 0 8) 4 5 = (0) := by decide +kernel + rw [he] + exact w195_sound +lemma Z0_0_8Raw_sound_5 (j : Fin 6) : + (Z0_0_8Raw (5,j)).Encloses (weight (orderedPairInteger (shape 0 0 8) 5 j) : ℝ) := by + fin_cases j + · change (Z0_0_8Raw (5,0)).Encloses (weight (orderedPairInteger (shape 0 0 8) 5 0) : ℝ) + have he : orderedPairInteger (shape 0 0 8) 5 0 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_0_8Raw (5,1)).Encloses (weight (orderedPairInteger (shape 0 0 8) 5 1) : ℝ) + have he : orderedPairInteger (shape 0 0 8) 5 1 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_0_8Raw (5,2)).Encloses (weight (orderedPairInteger (shape 0 0 8) 5 2) : ℝ) + have he : orderedPairInteger (shape 0 0 8) 5 2 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_0_8Raw (5,3)).Encloses (weight (orderedPairInteger (shape 0 0 8) 5 3) : ℝ) + have he : orderedPairInteger (shape 0 0 8) 5 3 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_0_8Raw (5,4)).Encloses (weight (orderedPairInteger (shape 0 0 8) 5 4) : ℝ) + have he : orderedPairInteger (shape 0 0 8) 5 4 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_0_8Raw (5,5)).Encloses (weight (orderedPairInteger (shape 0 0 8) 5 5) : ℝ) + have he : orderedPairInteger (shape 0 0 8) 5 5 = (0) := by decide +kernel + rw [he] + exact w195_sound +lemma Z0_0_8Raw_sound (ij : PairSlot) : + (Z0_0_8Raw ij).Encloses (weight (orderedPairInteger (shape 0 0 8) ij.1 ij.2) : ℝ) := by + rcases ij with ⟨i,j⟩ + revert i + exact forall_fin6 (Z0_0_8Raw_sound_0 j) (Z0_0_8Raw_sound_1 j) (Z0_0_8Raw_sound_2 j) (Z0_0_8Raw_sound_3 j) (Z0_0_8Raw_sound_4 j) (Z0_0_8Raw_sound_5 j) +def Z0_0_8Den : Ball := ⟨1, 0⟩ +lemma Z0_0_8Den_sound : Z0_0_8Den.Encloses + (((orderedPairs (shape 0 0 8)).map (fun ij => weight (orderedPairInteger (shape 0 0 8) ij.1 ij.2))).sum : ℝ) := by + exact contains_sound (list_cast_enclosed (orderedPairs (shape 0 0 8)) Z0_0_8Raw + (fun ij => weight (orderedPairInteger (shape 0 0 8) ij.1 ij.2)) + (fun ij _ => Z0_0_8Raw_sound ij)) (by decide +kernel) +lemma Z0_0_8Den_pos : 0 < Z0_0_8Den.lower := by decide +kernel +def Z0_0_8Probs (ij : PairSlot) : Ball := + match ij.1.val, ij.2.val with + | 5, 5 => ⟨1, 0⟩ + | _, _ => (.exact 0) +lemma Z0_0_8Contains : ∀ i j : Fin 6, + statisticWeight i + statisticWeight j = shapeMax (shape 0 0 8) → + contains (.mul (Z0_0_8Raw (i,j)) (.inv Z0_0_8Den)) (Z0_0_8Probs (i,j)) = true := by + decide +kernel +lemma Z0_0_8Zero : ∀ i j : Fin 6, + statisticWeight i + statisticWeight j ≠ shapeMax (shape 0 0 8) → Z0_0_8Probs (i,j) = .exact 0 := by + decide +kernel +lemma Z0_0_8Probs_sound (ij : PairSlot) : + (Z0_0_8Probs ij).Encloses (zeroPairLaw (shape 0 0 8) ij.1 ij.2 : ℝ) := by + by_cases h : statisticWeight ij.1 + statisticWeight ij.2 = shapeMax (shape 0 0 8) + · have hb := contains_sound (Ball.mul_sound (Z0_0_8Raw_sound ij) + (Ball.inv_sound Z0_0_8Den_sound Z0_0_8Den_pos)) (Z0_0_8Contains ij.1 ij.2 h) + simpa only [zeroPairLaw, h, ite_true, Rat.cast_div, Rat.cast_mul, + Rat.cast_inv, div_eq_mul_inv] using hb + · rw [Z0_0_8Zero ij.1 ij.2 h] + simpa only [zeroPairLaw, h, ite_false] using Ball.exact_sound 0 + +def Z0_0_8Half (w : Fin 3) (ij : PairSlot) : Ball := + if (shape 0 0 8) w = 0 then if ij = (0,0) then .exact 1 else .exact 0 + else if w = halfMaxAxis (shape 0 0 8) then Z0_0_8Probs ij + else Z0_0_8Probs (kappa ij.1, kappa ij.2) +lemma Z0_0_8Half_sound (w : Fin 3) (ij : PairSlot) : + (Z0_0_8Half w ij).Encloses (halfLaw (shape 0 0 8) w ij : ℝ) := by + have hp : positive (shape 0 0 8) = false := by decide +kernel + simp only [Z0_0_8Half, halfLaw, hp, Bool.false_eq_true, ite_false] + split_ifs + · exact Ball.exact_sound 1 + · exact Ball.exact_sound 0 + · exact Z0_0_8Probs_sound _ + · exact Z0_0_8Probs_sound _ + +def Z0_0_8Value (a : PairSlot) : ℝ := (zeroPairLaw (shape 0 0 8) a.1 a.2 : ℝ) +def Z0_0_8E_5_5Log : Ball := .exact 0 +lemma Z0_0_8E_5_5Log_sound : Z0_0_8E_5_5Log.Encloses (Real.log (Z0_0_8Value ((5,5) : PairSlot))) := by + exact log_exact_one_ball (Z0_0_8Probs_sound ((5,5) : PairSlot)) +def Z0_0_8E_5_5 : Ball := ⟨0, 0⟩ +lemma Z0_0_8E_5_5_sound : Z0_0_8E_5_5.Encloses (Foundation.entropyTerm (Z0_0_8Value ((5,5) : PairSlot))) := by + exact contains_sound (entropyTerm_ball (Z0_0_8Probs_sound ((5,5) : PairSlot)) Z0_0_8E_5_5Log_sound) (by decide +kernel) +def Z0_0_8Terms (a : PairSlot) : Ball := + match a.1.val, a.2.val with + | 5, 5 => ⟨0, 0⟩ + | _, _ => (.exact 0) +lemma Z0_0_8Terms_sound (a : PairSlot) : + (Z0_0_8Terms a).Encloses (Foundation.entropyTerm (Z0_0_8Value a)) := by + rcases a with ⟨i,j⟩ + revert j i + apply forall_fin6 + · exact forall_fin6 (entropyTerm_zero_ball (Z0_0_8Probs_sound ((0,0) : PairSlot))) (entropyTerm_zero_ball (Z0_0_8Probs_sound ((0,1) : PairSlot))) (entropyTerm_zero_ball (Z0_0_8Probs_sound ((0,2) : PairSlot))) (entropyTerm_zero_ball (Z0_0_8Probs_sound ((0,3) : PairSlot))) (entropyTerm_zero_ball (Z0_0_8Probs_sound ((0,4) : PairSlot))) (entropyTerm_zero_ball (Z0_0_8Probs_sound ((0,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball (Z0_0_8Probs_sound ((1,0) : PairSlot))) (entropyTerm_zero_ball (Z0_0_8Probs_sound ((1,1) : PairSlot))) (entropyTerm_zero_ball (Z0_0_8Probs_sound ((1,2) : PairSlot))) (entropyTerm_zero_ball (Z0_0_8Probs_sound ((1,3) : PairSlot))) (entropyTerm_zero_ball (Z0_0_8Probs_sound ((1,4) : PairSlot))) (entropyTerm_zero_ball (Z0_0_8Probs_sound ((1,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball (Z0_0_8Probs_sound ((2,0) : PairSlot))) (entropyTerm_zero_ball (Z0_0_8Probs_sound ((2,1) : PairSlot))) (entropyTerm_zero_ball (Z0_0_8Probs_sound ((2,2) : PairSlot))) (entropyTerm_zero_ball (Z0_0_8Probs_sound ((2,3) : PairSlot))) (entropyTerm_zero_ball (Z0_0_8Probs_sound ((2,4) : PairSlot))) (entropyTerm_zero_ball (Z0_0_8Probs_sound ((2,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball (Z0_0_8Probs_sound ((3,0) : PairSlot))) (entropyTerm_zero_ball (Z0_0_8Probs_sound ((3,1) : PairSlot))) (entropyTerm_zero_ball (Z0_0_8Probs_sound ((3,2) : PairSlot))) (entropyTerm_zero_ball (Z0_0_8Probs_sound ((3,3) : PairSlot))) (entropyTerm_zero_ball (Z0_0_8Probs_sound ((3,4) : PairSlot))) (entropyTerm_zero_ball (Z0_0_8Probs_sound ((3,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball (Z0_0_8Probs_sound ((4,0) : PairSlot))) (entropyTerm_zero_ball (Z0_0_8Probs_sound ((4,1) : PairSlot))) (entropyTerm_zero_ball (Z0_0_8Probs_sound ((4,2) : PairSlot))) (entropyTerm_zero_ball (Z0_0_8Probs_sound ((4,3) : PairSlot))) (entropyTerm_zero_ball (Z0_0_8Probs_sound ((4,4) : PairSlot))) (entropyTerm_zero_ball (Z0_0_8Probs_sound ((4,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball (Z0_0_8Probs_sound ((5,0) : PairSlot))) (entropyTerm_zero_ball (Z0_0_8Probs_sound ((5,1) : PairSlot))) (entropyTerm_zero_ball (Z0_0_8Probs_sound ((5,2) : PairSlot))) (entropyTerm_zero_ball (Z0_0_8Probs_sound ((5,3) : PairSlot))) (entropyTerm_zero_ball (Z0_0_8Probs_sound ((5,4) : PairSlot))) Z0_0_8E_5_5_sound +def Z0_0_8Entropy : Ball := ⟨0, 0⟩ +lemma Z0_0_8Entropy_sound : Z0_0_8Entropy.Encloses (Foundation.finiteEntropy Z0_0_8Value) := by + exact contains_sound (entropyPair_enclosed Z0_0_8Value Z0_0_8Terms Z0_0_8Terms_sound) (by decide +kernel) +def Z0_0_8Labels : Ball := ⟨0, 0⟩ +lemma Z0_0_8Labels_sound : Z0_0_8Labels.Encloses + (∑ a : PairSlot, (zeroPairLaw (shape 0 0 8) a.1 a.2 : ℝ) * + Real.log (AllFieldParameters.multiplicity a.1 * AllFieldParameters.multiplicity a.2 : ℕ)) := by + exact contains_sound (pairSumBall_sound (fun a => .mul (Z0_0_8Probs a) (multLogs a)) + _ (fun a => Ball.mul_sound (Z0_0_8Probs_sound a) (multLogs_sound a))) (by decide +kernel) +def Z0_0_8Four : Ball := ⟨0, 0⟩ +lemma Z0_0_8Four_sound : Z0_0_8Four.Encloses (AllFieldZeroLeafRates.fourRate (shape 0 0 8)) := by + exact contains_sound (Ball.add_sound Z0_0_8Entropy_sound Z0_0_8Labels_sound) (by decide +kernel) +def Z0_0_8H0Value (a : PairSlot) : ℝ := (halfLaw (shape 0 0 8) 0 a : ℝ) +def Z0_0_8H0E_0_0Log : Ball := .exact 0 +lemma Z0_0_8H0E_0_0Log_sound : Z0_0_8H0E_0_0Log.Encloses (Real.log (Z0_0_8H0Value ((0,0) : PairSlot))) := by + exact log_exact_one_ball ((Z0_0_8Half_sound 0) ((0,0) : PairSlot)) +def Z0_0_8H0E_0_0 : Ball := ⟨0, 0⟩ +lemma Z0_0_8H0E_0_0_sound : Z0_0_8H0E_0_0.Encloses (Foundation.entropyTerm (Z0_0_8H0Value ((0,0) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z0_0_8Half_sound 0) ((0,0) : PairSlot)) Z0_0_8H0E_0_0Log_sound) (by decide +kernel) +def Z0_0_8H0Terms (a : PairSlot) : Ball := + match a.1.val, a.2.val with + | 0, 0 => ⟨0, 0⟩ + | _, _ => (.exact 0) +lemma Z0_0_8H0Terms_sound (a : PairSlot) : + (Z0_0_8H0Terms a).Encloses (Foundation.entropyTerm (Z0_0_8H0Value a)) := by + rcases a with ⟨i,j⟩ + revert j i + apply forall_fin6 + · exact forall_fin6 Z0_0_8H0E_0_0_sound (entropyTerm_zero_ball ((Z0_0_8Half_sound 0) ((0,1) : PairSlot))) (entropyTerm_zero_ball ((Z0_0_8Half_sound 0) ((0,2) : PairSlot))) (entropyTerm_zero_ball ((Z0_0_8Half_sound 0) ((0,3) : PairSlot))) (entropyTerm_zero_ball ((Z0_0_8Half_sound 0) ((0,4) : PairSlot))) (entropyTerm_zero_ball ((Z0_0_8Half_sound 0) ((0,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z0_0_8Half_sound 0) ((1,0) : PairSlot))) (entropyTerm_zero_ball ((Z0_0_8Half_sound 0) ((1,1) : PairSlot))) (entropyTerm_zero_ball ((Z0_0_8Half_sound 0) ((1,2) : PairSlot))) (entropyTerm_zero_ball ((Z0_0_8Half_sound 0) ((1,3) : PairSlot))) (entropyTerm_zero_ball ((Z0_0_8Half_sound 0) ((1,4) : PairSlot))) (entropyTerm_zero_ball ((Z0_0_8Half_sound 0) ((1,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z0_0_8Half_sound 0) ((2,0) : PairSlot))) (entropyTerm_zero_ball ((Z0_0_8Half_sound 0) ((2,1) : PairSlot))) (entropyTerm_zero_ball ((Z0_0_8Half_sound 0) ((2,2) : PairSlot))) (entropyTerm_zero_ball ((Z0_0_8Half_sound 0) ((2,3) : PairSlot))) (entropyTerm_zero_ball ((Z0_0_8Half_sound 0) ((2,4) : PairSlot))) (entropyTerm_zero_ball ((Z0_0_8Half_sound 0) ((2,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z0_0_8Half_sound 0) ((3,0) : PairSlot))) (entropyTerm_zero_ball ((Z0_0_8Half_sound 0) ((3,1) : PairSlot))) (entropyTerm_zero_ball ((Z0_0_8Half_sound 0) ((3,2) : PairSlot))) (entropyTerm_zero_ball ((Z0_0_8Half_sound 0) ((3,3) : PairSlot))) (entropyTerm_zero_ball ((Z0_0_8Half_sound 0) ((3,4) : PairSlot))) (entropyTerm_zero_ball ((Z0_0_8Half_sound 0) ((3,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z0_0_8Half_sound 0) ((4,0) : PairSlot))) (entropyTerm_zero_ball ((Z0_0_8Half_sound 0) ((4,1) : PairSlot))) (entropyTerm_zero_ball ((Z0_0_8Half_sound 0) ((4,2) : PairSlot))) (entropyTerm_zero_ball ((Z0_0_8Half_sound 0) ((4,3) : PairSlot))) (entropyTerm_zero_ball ((Z0_0_8Half_sound 0) ((4,4) : PairSlot))) (entropyTerm_zero_ball ((Z0_0_8Half_sound 0) ((4,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z0_0_8Half_sound 0) ((5,0) : PairSlot))) (entropyTerm_zero_ball ((Z0_0_8Half_sound 0) ((5,1) : PairSlot))) (entropyTerm_zero_ball ((Z0_0_8Half_sound 0) ((5,2) : PairSlot))) (entropyTerm_zero_ball ((Z0_0_8Half_sound 0) ((5,3) : PairSlot))) (entropyTerm_zero_ball ((Z0_0_8Half_sound 0) ((5,4) : PairSlot))) (entropyTerm_zero_ball ((Z0_0_8Half_sound 0) ((5,5) : PairSlot))) +def Z0_0_8H0Entropy : Ball := ⟨0, 0⟩ +lemma Z0_0_8H0Entropy_sound : Z0_0_8H0Entropy.Encloses (Foundation.finiteEntropy Z0_0_8H0Value) := by + exact contains_sound (entropyPair_enclosed Z0_0_8H0Value Z0_0_8H0Terms Z0_0_8H0Terms_sound) (by decide +kernel) +def Z0_0_8H0Mass : Ball := ⟨1, 0⟩ +lemma Z0_0_8H0Mass_sound : Z0_0_8H0Mass.Encloses (∑ a, Z0_0_8H0Value a) := by + exact contains_sound (pairSumBall_sound (Z0_0_8Half 0) Z0_0_8H0Value (Z0_0_8Half_sound 0)) (by decide +kernel) +def Z0_0_8H0MassTermLog : Ball := .exact 0 +lemma Z0_0_8H0MassTermLog_sound : Z0_0_8H0MassTermLog.Encloses (Real.log ((∑ a, Z0_0_8H0Value a))) := by + exact log_exact_one_ball (Z0_0_8H0Mass_sound) +def Z0_0_8H0MassTerm : Ball := ⟨0, 0⟩ +lemma Z0_0_8H0MassTerm_sound : Z0_0_8H0MassTerm.Encloses (Foundation.entropyTerm ((∑ a, Z0_0_8H0Value a))) := by + exact contains_sound (entropyTerm_ball (Z0_0_8H0Mass_sound) Z0_0_8H0MassTermLog_sound) (by decide +kernel) +def Z0_0_8H0H : Ball := ⟨0, 0⟩ +lemma Z0_0_8H0H_sound : Z0_0_8H0H.Encloses (homogeneousEntropy Z0_0_8H0Value) := by + exact contains_sound (homogeneous_enclosed Z0_0_8H0Value Z0_0_8H0MassTerm_sound Z0_0_8H0Entropy_sound) (by decide +kernel) +def Z0_0_8H1Value (a : PairSlot) : ℝ := (halfLaw (shape 0 0 8) 1 a : ℝ) +def Z0_0_8H1E_0_0Log : Ball := .exact 0 +lemma Z0_0_8H1E_0_0Log_sound : Z0_0_8H1E_0_0Log.Encloses (Real.log (Z0_0_8H1Value ((0,0) : PairSlot))) := by + exact log_exact_one_ball ((Z0_0_8Half_sound 1) ((0,0) : PairSlot)) +def Z0_0_8H1E_0_0 : Ball := ⟨0, 0⟩ +lemma Z0_0_8H1E_0_0_sound : Z0_0_8H1E_0_0.Encloses (Foundation.entropyTerm (Z0_0_8H1Value ((0,0) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z0_0_8Half_sound 1) ((0,0) : PairSlot)) Z0_0_8H1E_0_0Log_sound) (by decide +kernel) +def Z0_0_8H1Terms (a : PairSlot) : Ball := + match a.1.val, a.2.val with + | 0, 0 => ⟨0, 0⟩ + | _, _ => (.exact 0) +lemma Z0_0_8H1Terms_sound (a : PairSlot) : + (Z0_0_8H1Terms a).Encloses (Foundation.entropyTerm (Z0_0_8H1Value a)) := by + rcases a with ⟨i,j⟩ + revert j i + apply forall_fin6 + · exact forall_fin6 Z0_0_8H1E_0_0_sound (entropyTerm_zero_ball ((Z0_0_8Half_sound 1) ((0,1) : PairSlot))) (entropyTerm_zero_ball ((Z0_0_8Half_sound 1) ((0,2) : PairSlot))) (entropyTerm_zero_ball ((Z0_0_8Half_sound 1) ((0,3) : PairSlot))) (entropyTerm_zero_ball ((Z0_0_8Half_sound 1) ((0,4) : PairSlot))) (entropyTerm_zero_ball ((Z0_0_8Half_sound 1) ((0,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z0_0_8Half_sound 1) ((1,0) : PairSlot))) (entropyTerm_zero_ball ((Z0_0_8Half_sound 1) ((1,1) : PairSlot))) (entropyTerm_zero_ball ((Z0_0_8Half_sound 1) ((1,2) : PairSlot))) (entropyTerm_zero_ball ((Z0_0_8Half_sound 1) ((1,3) : PairSlot))) (entropyTerm_zero_ball ((Z0_0_8Half_sound 1) ((1,4) : PairSlot))) (entropyTerm_zero_ball ((Z0_0_8Half_sound 1) ((1,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z0_0_8Half_sound 1) ((2,0) : PairSlot))) (entropyTerm_zero_ball ((Z0_0_8Half_sound 1) ((2,1) : PairSlot))) (entropyTerm_zero_ball ((Z0_0_8Half_sound 1) ((2,2) : PairSlot))) (entropyTerm_zero_ball ((Z0_0_8Half_sound 1) ((2,3) : PairSlot))) (entropyTerm_zero_ball ((Z0_0_8Half_sound 1) ((2,4) : PairSlot))) (entropyTerm_zero_ball ((Z0_0_8Half_sound 1) ((2,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z0_0_8Half_sound 1) ((3,0) : PairSlot))) (entropyTerm_zero_ball ((Z0_0_8Half_sound 1) ((3,1) : PairSlot))) (entropyTerm_zero_ball ((Z0_0_8Half_sound 1) ((3,2) : PairSlot))) (entropyTerm_zero_ball ((Z0_0_8Half_sound 1) ((3,3) : PairSlot))) (entropyTerm_zero_ball ((Z0_0_8Half_sound 1) ((3,4) : PairSlot))) (entropyTerm_zero_ball ((Z0_0_8Half_sound 1) ((3,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z0_0_8Half_sound 1) ((4,0) : PairSlot))) (entropyTerm_zero_ball ((Z0_0_8Half_sound 1) ((4,1) : PairSlot))) (entropyTerm_zero_ball ((Z0_0_8Half_sound 1) ((4,2) : PairSlot))) (entropyTerm_zero_ball ((Z0_0_8Half_sound 1) ((4,3) : PairSlot))) (entropyTerm_zero_ball ((Z0_0_8Half_sound 1) ((4,4) : PairSlot))) (entropyTerm_zero_ball ((Z0_0_8Half_sound 1) ((4,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z0_0_8Half_sound 1) ((5,0) : PairSlot))) (entropyTerm_zero_ball ((Z0_0_8Half_sound 1) ((5,1) : PairSlot))) (entropyTerm_zero_ball ((Z0_0_8Half_sound 1) ((5,2) : PairSlot))) (entropyTerm_zero_ball ((Z0_0_8Half_sound 1) ((5,3) : PairSlot))) (entropyTerm_zero_ball ((Z0_0_8Half_sound 1) ((5,4) : PairSlot))) (entropyTerm_zero_ball ((Z0_0_8Half_sound 1) ((5,5) : PairSlot))) +def Z0_0_8H1Entropy : Ball := ⟨0, 0⟩ +lemma Z0_0_8H1Entropy_sound : Z0_0_8H1Entropy.Encloses (Foundation.finiteEntropy Z0_0_8H1Value) := by + exact contains_sound (entropyPair_enclosed Z0_0_8H1Value Z0_0_8H1Terms Z0_0_8H1Terms_sound) (by decide +kernel) +def Z0_0_8H1Mass : Ball := ⟨1, 0⟩ +lemma Z0_0_8H1Mass_sound : Z0_0_8H1Mass.Encloses (∑ a, Z0_0_8H1Value a) := by + exact contains_sound (pairSumBall_sound (Z0_0_8Half 1) Z0_0_8H1Value (Z0_0_8Half_sound 1)) (by decide +kernel) +def Z0_0_8H1MassTermLog : Ball := .exact 0 +lemma Z0_0_8H1MassTermLog_sound : Z0_0_8H1MassTermLog.Encloses (Real.log ((∑ a, Z0_0_8H1Value a))) := by + exact log_exact_one_ball (Z0_0_8H1Mass_sound) +def Z0_0_8H1MassTerm : Ball := ⟨0, 0⟩ +lemma Z0_0_8H1MassTerm_sound : Z0_0_8H1MassTerm.Encloses (Foundation.entropyTerm ((∑ a, Z0_0_8H1Value a))) := by + exact contains_sound (entropyTerm_ball (Z0_0_8H1Mass_sound) Z0_0_8H1MassTermLog_sound) (by decide +kernel) +def Z0_0_8H1H : Ball := ⟨0, 0⟩ +lemma Z0_0_8H1H_sound : Z0_0_8H1H.Encloses (homogeneousEntropy Z0_0_8H1Value) := by + exact contains_sound (homogeneous_enclosed Z0_0_8H1Value Z0_0_8H1MassTerm_sound Z0_0_8H1Entropy_sound) (by decide +kernel) +def Z0_0_8H2Value (a : PairSlot) : ℝ := (halfLaw (shape 0 0 8) 2 a : ℝ) +def Z0_0_8H2E_5_5Log : Ball := .exact 0 +lemma Z0_0_8H2E_5_5Log_sound : Z0_0_8H2E_5_5Log.Encloses (Real.log (Z0_0_8H2Value ((5,5) : PairSlot))) := by + exact log_exact_one_ball ((Z0_0_8Half_sound 2) ((5,5) : PairSlot)) +def Z0_0_8H2E_5_5 : Ball := ⟨0, 0⟩ +lemma Z0_0_8H2E_5_5_sound : Z0_0_8H2E_5_5.Encloses (Foundation.entropyTerm (Z0_0_8H2Value ((5,5) : PairSlot))) := by + exact contains_sound (entropyTerm_ball ((Z0_0_8Half_sound 2) ((5,5) : PairSlot)) Z0_0_8H2E_5_5Log_sound) (by decide +kernel) +def Z0_0_8H2Terms (a : PairSlot) : Ball := + match a.1.val, a.2.val with + | 5, 5 => ⟨0, 0⟩ + | _, _ => (.exact 0) +lemma Z0_0_8H2Terms_sound (a : PairSlot) : + (Z0_0_8H2Terms a).Encloses (Foundation.entropyTerm (Z0_0_8H2Value a)) := by + rcases a with ⟨i,j⟩ + revert j i + apply forall_fin6 + · exact forall_fin6 (entropyTerm_zero_ball ((Z0_0_8Half_sound 2) ((0,0) : PairSlot))) (entropyTerm_zero_ball ((Z0_0_8Half_sound 2) ((0,1) : PairSlot))) (entropyTerm_zero_ball ((Z0_0_8Half_sound 2) ((0,2) : PairSlot))) (entropyTerm_zero_ball ((Z0_0_8Half_sound 2) ((0,3) : PairSlot))) (entropyTerm_zero_ball ((Z0_0_8Half_sound 2) ((0,4) : PairSlot))) (entropyTerm_zero_ball ((Z0_0_8Half_sound 2) ((0,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z0_0_8Half_sound 2) ((1,0) : PairSlot))) (entropyTerm_zero_ball ((Z0_0_8Half_sound 2) ((1,1) : PairSlot))) (entropyTerm_zero_ball ((Z0_0_8Half_sound 2) ((1,2) : PairSlot))) (entropyTerm_zero_ball ((Z0_0_8Half_sound 2) ((1,3) : PairSlot))) (entropyTerm_zero_ball ((Z0_0_8Half_sound 2) ((1,4) : PairSlot))) (entropyTerm_zero_ball ((Z0_0_8Half_sound 2) ((1,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z0_0_8Half_sound 2) ((2,0) : PairSlot))) (entropyTerm_zero_ball ((Z0_0_8Half_sound 2) ((2,1) : PairSlot))) (entropyTerm_zero_ball ((Z0_0_8Half_sound 2) ((2,2) : PairSlot))) (entropyTerm_zero_ball ((Z0_0_8Half_sound 2) ((2,3) : PairSlot))) (entropyTerm_zero_ball ((Z0_0_8Half_sound 2) ((2,4) : PairSlot))) (entropyTerm_zero_ball ((Z0_0_8Half_sound 2) ((2,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z0_0_8Half_sound 2) ((3,0) : PairSlot))) (entropyTerm_zero_ball ((Z0_0_8Half_sound 2) ((3,1) : PairSlot))) (entropyTerm_zero_ball ((Z0_0_8Half_sound 2) ((3,2) : PairSlot))) (entropyTerm_zero_ball ((Z0_0_8Half_sound 2) ((3,3) : PairSlot))) (entropyTerm_zero_ball ((Z0_0_8Half_sound 2) ((3,4) : PairSlot))) (entropyTerm_zero_ball ((Z0_0_8Half_sound 2) ((3,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z0_0_8Half_sound 2) ((4,0) : PairSlot))) (entropyTerm_zero_ball ((Z0_0_8Half_sound 2) ((4,1) : PairSlot))) (entropyTerm_zero_ball ((Z0_0_8Half_sound 2) ((4,2) : PairSlot))) (entropyTerm_zero_ball ((Z0_0_8Half_sound 2) ((4,3) : PairSlot))) (entropyTerm_zero_ball ((Z0_0_8Half_sound 2) ((4,4) : PairSlot))) (entropyTerm_zero_ball ((Z0_0_8Half_sound 2) ((4,5) : PairSlot))) + · exact forall_fin6 (entropyTerm_zero_ball ((Z0_0_8Half_sound 2) ((5,0) : PairSlot))) (entropyTerm_zero_ball ((Z0_0_8Half_sound 2) ((5,1) : PairSlot))) (entropyTerm_zero_ball ((Z0_0_8Half_sound 2) ((5,2) : PairSlot))) (entropyTerm_zero_ball ((Z0_0_8Half_sound 2) ((5,3) : PairSlot))) (entropyTerm_zero_ball ((Z0_0_8Half_sound 2) ((5,4) : PairSlot))) Z0_0_8H2E_5_5_sound +def Z0_0_8H2Entropy : Ball := ⟨0, 0⟩ +lemma Z0_0_8H2Entropy_sound : Z0_0_8H2Entropy.Encloses (Foundation.finiteEntropy Z0_0_8H2Value) := by + exact contains_sound (entropyPair_enclosed Z0_0_8H2Value Z0_0_8H2Terms Z0_0_8H2Terms_sound) (by decide +kernel) +def Z0_0_8H2Mass : Ball := ⟨1, 0⟩ +lemma Z0_0_8H2Mass_sound : Z0_0_8H2Mass.Encloses (∑ a, Z0_0_8H2Value a) := by + exact contains_sound (pairSumBall_sound (Z0_0_8Half 2) Z0_0_8H2Value (Z0_0_8Half_sound 2)) (by decide +kernel) +def Z0_0_8H2MassTermLog : Ball := .exact 0 +lemma Z0_0_8H2MassTermLog_sound : Z0_0_8H2MassTermLog.Encloses (Real.log ((∑ a, Z0_0_8H2Value a))) := by + exact log_exact_one_ball (Z0_0_8H2Mass_sound) +def Z0_0_8H2MassTerm : Ball := ⟨0, 0⟩ +lemma Z0_0_8H2MassTerm_sound : Z0_0_8H2MassTerm.Encloses (Foundation.entropyTerm ((∑ a, Z0_0_8H2Value a))) := by + exact contains_sound (entropyTerm_ball (Z0_0_8H2Mass_sound) Z0_0_8H2MassTermLog_sound) (by decide +kernel) +def Z0_0_8H2H : Ball := ⟨0, 0⟩ +lemma Z0_0_8H2H_sound : Z0_0_8H2H.Encloses (homogeneousEntropy Z0_0_8H2Value) := by + exact contains_sound (homogeneous_enclosed Z0_0_8H2Value Z0_0_8H2MassTerm_sound Z0_0_8H2Entropy_sound) (by decide +kernel) + +def Z0_1_7Raw (ij : PairSlot) : Ball := + match ij.1.val, ij.2.val with + | 0, 0 => w195 + | 0, 1 => w195 + | 0, 2 => w195 + | 0, 3 => w195 + | 0, 4 => w195 + | 0, 5 => w195 + | 1, 0 => w195 + | 1, 1 => w195 + | 1, 2 => w195 + | 1, 3 => w195 + | 1, 4 => w195 + | 1, 5 => w195 + | 2, 0 => w195 + | 2, 1 => w195 + | 2, 2 => w195 + | 2, 3 => w195 + | 2, 4 => w195 + | 2, 5 => w195 + | 3, 0 => w195 + | 3, 1 => w195 + | 3, 2 => w195 + | 3, 3 => w195 + | 3, 4 => w195 + | 3, 5 => w195 + | 4, 0 => w195 + | 4, 1 => w195 + | 4, 2 => w195 + | 4, 3 => w195 + | 4, 4 => w195 + | 4, 5 => w195 + | 5, 0 => w195 + | 5, 1 => w195 + | 5, 2 => w195 + | 5, 3 => w195 + | 5, 4 => w195 + | 5, 5 => w195 + | _, _ => (.exact 0) +lemma Z0_1_7Raw_sound_0 (j : Fin 6) : + (Z0_1_7Raw (0,j)).Encloses (weight (orderedPairInteger (shape 0 1 7) 0 j) : ℝ) := by + fin_cases j + · change (Z0_1_7Raw (0,0)).Encloses (weight (orderedPairInteger (shape 0 1 7) 0 0) : ℝ) + have he : orderedPairInteger (shape 0 1 7) 0 0 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_1_7Raw (0,1)).Encloses (weight (orderedPairInteger (shape 0 1 7) 0 1) : ℝ) + have he : orderedPairInteger (shape 0 1 7) 0 1 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_1_7Raw (0,2)).Encloses (weight (orderedPairInteger (shape 0 1 7) 0 2) : ℝ) + have he : orderedPairInteger (shape 0 1 7) 0 2 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_1_7Raw (0,3)).Encloses (weight (orderedPairInteger (shape 0 1 7) 0 3) : ℝ) + have he : orderedPairInteger (shape 0 1 7) 0 3 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_1_7Raw (0,4)).Encloses (weight (orderedPairInteger (shape 0 1 7) 0 4) : ℝ) + have he : orderedPairInteger (shape 0 1 7) 0 4 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_1_7Raw (0,5)).Encloses (weight (orderedPairInteger (shape 0 1 7) 0 5) : ℝ) + have he : orderedPairInteger (shape 0 1 7) 0 5 = (0) := by decide +kernel + rw [he] + exact w195_sound +lemma Z0_1_7Raw_sound_1 (j : Fin 6) : + (Z0_1_7Raw (1,j)).Encloses (weight (orderedPairInteger (shape 0 1 7) 1 j) : ℝ) := by + fin_cases j + · change (Z0_1_7Raw (1,0)).Encloses (weight (orderedPairInteger (shape 0 1 7) 1 0) : ℝ) + have he : orderedPairInteger (shape 0 1 7) 1 0 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_1_7Raw (1,1)).Encloses (weight (orderedPairInteger (shape 0 1 7) 1 1) : ℝ) + have he : orderedPairInteger (shape 0 1 7) 1 1 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_1_7Raw (1,2)).Encloses (weight (orderedPairInteger (shape 0 1 7) 1 2) : ℝ) + have he : orderedPairInteger (shape 0 1 7) 1 2 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_1_7Raw (1,3)).Encloses (weight (orderedPairInteger (shape 0 1 7) 1 3) : ℝ) + have he : orderedPairInteger (shape 0 1 7) 1 3 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_1_7Raw (1,4)).Encloses (weight (orderedPairInteger (shape 0 1 7) 1 4) : ℝ) + have he : orderedPairInteger (shape 0 1 7) 1 4 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_1_7Raw (1,5)).Encloses (weight (orderedPairInteger (shape 0 1 7) 1 5) : ℝ) + have he : orderedPairInteger (shape 0 1 7) 1 5 = (0) := by decide +kernel + rw [he] + exact w195_sound +lemma Z0_1_7Raw_sound_2 (j : Fin 6) : + (Z0_1_7Raw (2,j)).Encloses (weight (orderedPairInteger (shape 0 1 7) 2 j) : ℝ) := by + fin_cases j + · change (Z0_1_7Raw (2,0)).Encloses (weight (orderedPairInteger (shape 0 1 7) 2 0) : ℝ) + have he : orderedPairInteger (shape 0 1 7) 2 0 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_1_7Raw (2,1)).Encloses (weight (orderedPairInteger (shape 0 1 7) 2 1) : ℝ) + have he : orderedPairInteger (shape 0 1 7) 2 1 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_1_7Raw (2,2)).Encloses (weight (orderedPairInteger (shape 0 1 7) 2 2) : ℝ) + have he : orderedPairInteger (shape 0 1 7) 2 2 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_1_7Raw (2,3)).Encloses (weight (orderedPairInteger (shape 0 1 7) 2 3) : ℝ) + have he : orderedPairInteger (shape 0 1 7) 2 3 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_1_7Raw (2,4)).Encloses (weight (orderedPairInteger (shape 0 1 7) 2 4) : ℝ) + have he : orderedPairInteger (shape 0 1 7) 2 4 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_1_7Raw (2,5)).Encloses (weight (orderedPairInteger (shape 0 1 7) 2 5) : ℝ) + have he : orderedPairInteger (shape 0 1 7) 2 5 = (0) := by decide +kernel + rw [he] + exact w195_sound +lemma Z0_1_7Raw_sound_3 (j : Fin 6) : + (Z0_1_7Raw (3,j)).Encloses (weight (orderedPairInteger (shape 0 1 7) 3 j) : ℝ) := by + fin_cases j + · change (Z0_1_7Raw (3,0)).Encloses (weight (orderedPairInteger (shape 0 1 7) 3 0) : ℝ) + have he : orderedPairInteger (shape 0 1 7) 3 0 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_1_7Raw (3,1)).Encloses (weight (orderedPairInteger (shape 0 1 7) 3 1) : ℝ) + have he : orderedPairInteger (shape 0 1 7) 3 1 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_1_7Raw (3,2)).Encloses (weight (orderedPairInteger (shape 0 1 7) 3 2) : ℝ) + have he : orderedPairInteger (shape 0 1 7) 3 2 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_1_7Raw (3,3)).Encloses (weight (orderedPairInteger (shape 0 1 7) 3 3) : ℝ) + have he : orderedPairInteger (shape 0 1 7) 3 3 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_1_7Raw (3,4)).Encloses (weight (orderedPairInteger (shape 0 1 7) 3 4) : ℝ) + have he : orderedPairInteger (shape 0 1 7) 3 4 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_1_7Raw (3,5)).Encloses (weight (orderedPairInteger (shape 0 1 7) 3 5) : ℝ) + have he : orderedPairInteger (shape 0 1 7) 3 5 = (0) := by decide +kernel + rw [he] + exact w195_sound +lemma Z0_1_7Raw_sound_4 (j : Fin 6) : + (Z0_1_7Raw (4,j)).Encloses (weight (orderedPairInteger (shape 0 1 7) 4 j) : ℝ) := by + fin_cases j + · change (Z0_1_7Raw (4,0)).Encloses (weight (orderedPairInteger (shape 0 1 7) 4 0) : ℝ) + have he : orderedPairInteger (shape 0 1 7) 4 0 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_1_7Raw (4,1)).Encloses (weight (orderedPairInteger (shape 0 1 7) 4 1) : ℝ) + have he : orderedPairInteger (shape 0 1 7) 4 1 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_1_7Raw (4,2)).Encloses (weight (orderedPairInteger (shape 0 1 7) 4 2) : ℝ) + have he : orderedPairInteger (shape 0 1 7) 4 2 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_1_7Raw (4,3)).Encloses (weight (orderedPairInteger (shape 0 1 7) 4 3) : ℝ) + have he : orderedPairInteger (shape 0 1 7) 4 3 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_1_7Raw (4,4)).Encloses (weight (orderedPairInteger (shape 0 1 7) 4 4) : ℝ) + have he : orderedPairInteger (shape 0 1 7) 4 4 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_1_7Raw (4,5)).Encloses (weight (orderedPairInteger (shape 0 1 7) 4 5) : ℝ) + have he : orderedPairInteger (shape 0 1 7) 4 5 = (0) := by decide +kernel + rw [he] + exact w195_sound +lemma Z0_1_7Raw_sound_5 (j : Fin 6) : + (Z0_1_7Raw (5,j)).Encloses (weight (orderedPairInteger (shape 0 1 7) 5 j) : ℝ) := by + fin_cases j + · change (Z0_1_7Raw (5,0)).Encloses (weight (orderedPairInteger (shape 0 1 7) 5 0) : ℝ) + have he : orderedPairInteger (shape 0 1 7) 5 0 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_1_7Raw (5,1)).Encloses (weight (orderedPairInteger (shape 0 1 7) 5 1) : ℝ) + have he : orderedPairInteger (shape 0 1 7) 5 1 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_1_7Raw (5,2)).Encloses (weight (orderedPairInteger (shape 0 1 7) 5 2) : ℝ) + have he : orderedPairInteger (shape 0 1 7) 5 2 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_1_7Raw (5,3)).Encloses (weight (orderedPairInteger (shape 0 1 7) 5 3) : ℝ) + have he : orderedPairInteger (shape 0 1 7) 5 3 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_1_7Raw (5,4)).Encloses (weight (orderedPairInteger (shape 0 1 7) 5 4) : ℝ) + have he : orderedPairInteger (shape 0 1 7) 5 4 = (0) := by decide +kernel + rw [he] + exact w195_sound + · change (Z0_1_7Raw (5,5)).Encloses (weight (orderedPairInteger (shape 0 1 7) 5 5) : ℝ) + have he : orderedPairInteger (shape 0 1 7) 5 5 = (0) := by decide +kernel + rw [he] + exact w195_sound +lemma Z0_1_7Raw_sound (ij : PairSlot) : + (Z0_1_7Raw ij).Encloses (weight (orderedPairInteger (shape 0 1 7) ij.1 ij.2) : ℝ) := by + rcases ij with ⟨i,j⟩ + revert i + exact forall_fin6 (Z0_1_7Raw_sound_0 j) (Z0_1_7Raw_sound_1 j) (Z0_1_7Raw_sound_2 j) (Z0_1_7Raw_sound_3 j) (Z0_1_7Raw_sound_4 j) (Z0_1_7Raw_sound_5 j) +def Z0_1_7Den : Ball := ⟨2, 0⟩ +lemma Z0_1_7Den_sound : Z0_1_7Den.Encloses + (((orderedPairs (shape 0 1 7)).map (fun ij => weight (orderedPairInteger (shape 0 1 7) ij.1 ij.2))).sum : ℝ) := by + exact contains_sound (list_cast_enclosed (orderedPairs (shape 0 1 7)) Z0_1_7Raw + (fun ij => weight (orderedPairInteger (shape 0 1 7) ij.1 ij.2)) + (fun ij _ => Z0_1_7Raw_sound ij)) (by decide +kernel) +lemma Z0_1_7Den_pos : 0 < Z0_1_7Den.lower := by decide +kernel +def Z0_1_7Probs (ij : PairSlot) : Ball := + match ij.1.val, ij.2.val with + | 4, 5 => ⟨(1 / 2), 0⟩ + | 5, 4 => ⟨(1 / 2), 0⟩ + | _, _ => (.exact 0) +lemma Z0_1_7Contains : ∀ i j : Fin 6, + statisticWeight i + statisticWeight j = shapeMax (shape 0 1 7) → + contains (.mul (Z0_1_7Raw (i,j)) (.inv Z0_1_7Den)) (Z0_1_7Probs (i,j)) = true := by + decide +kernel +lemma Z0_1_7Zero : ∀ i j : Fin 6, + statisticWeight i + statisticWeight j ≠ shapeMax (shape 0 1 7) → Z0_1_7Probs (i,j) = .exact 0 := by + decide +kernel +lemma Z0_1_7Probs_sound (ij : PairSlot) : + (Z0_1_7Probs ij).Encloses (zeroPairLaw (shape 0 1 7) ij.1 ij.2 : ℝ) := by + by_cases h : statisticWeight ij.1 + statisticWeight ij.2 = shapeMax (shape 0 1 7) + · have hb := contains_sound (Ball.mul_sound (Z0_1_7Raw_sound ij) + (Ball.inv_sound Z0_1_7Den_sound Z0_1_7Den_pos)) (Z0_1_7Contains ij.1 ij.2 h) + simpa only [zeroPairLaw, h, ite_true, Rat.cast_div, Rat.cast_mul, + Rat.cast_inv, div_eq_mul_inv] using hb + · rw [Z0_1_7Zero ij.1 ij.2 h] + simpa only [zeroPairLaw, h, ite_false] using Ball.exact_sound 0 + +def Z0_1_7Half (w : Fin 3) (ij : PairSlot) : Ball := + if (shape 0 1 7) w = 0 then if ij = (0,0) then .exact 1 else .exact 0 + else if w = halfMaxAxis (shape 0 1 7) then Z0_1_7Probs ij + else Z0_1_7Probs (kappa ij.1, kappa ij.2) +lemma Z0_1_7Half_sound (w : Fin 3) (ij : PairSlot) : + (Z0_1_7Half w ij).Encloses (halfLaw (shape 0 1 7) w ij : ℝ) := by + have hp : positive (shape 0 1 7) = false := by decide +kernel + simp only [Z0_1_7Half, halfLaw, hp, Bool.false_eq_true, ite_false] + split_ifs + · exact Ball.exact_sound 1 + · exact Ball.exact_sound 0 + · exact Z0_1_7Probs_sound _ + · exact Z0_1_7Probs_sound _ + +end MatrixMultiplication.NativeNumerics + +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/Conclusions/AllFieldsBound.lean b/lean/OAI/LinearAlgebra/MatrixFields/Conclusions/AllFieldsBound.lean new file mode 100644 index 0000000000000000000000000000000000000000..16e2687447f1512b599c65e24f07b608b19d9155 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/Conclusions/AllFieldsBound.lean @@ -0,0 +1,34 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Certificates.NativeSharp +import OAI.LinearAlgebra.MatrixFields.Construction.OrderedLimits + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +namespace MatrixMultiplication.AllFieldMain +open AllFieldNativeCapacity AllFieldTerminalRates AllFieldInitialEntropy NativeNumerics + +universe u + +theorem omega_lt_source_constant (F : Type u) [Field F] : + Arithmetic.omega F < (2371054886006746 : ℝ) / 10 ^ 15 ∧ + (2371054886006746 : ℝ) / 10 ^ 15 < (2371056 : ℝ) / 10 ^ 6 := by + constructor + · have hbound := AllFieldOrderedLimits.omega_le_native_ratio F + native_denominator_gap native_stageC_feasible + native_stageA_positive native_stageB_positive + native_stageC_balanced_positive native_volume_positive + exact lt_of_le_of_lt hbound native_sharp_rate_bound + · norm_num + +end MatrixMultiplication.AllFieldMain + +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/Construction/ActiveSums.lean b/lean/OAI/LinearAlgebra/MatrixFields/Construction/ActiveSums.lean new file mode 100644 index 0000000000000000000000000000000000000000..d346a4aae4a2f318605f9c2ef88cc6e4a17c5332 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/Construction/ActiveSums.lean @@ -0,0 +1,209 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Histories.HistorySums + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +noncomputable section + +namespace MatrixMultiplication.AllFieldHistory + +open AllFieldParameters +open scoped BigOperators +attribute [local instance] Classical.propDecidable Classical.decEq + +private def aRelot {K L : ℕ} (lot : Fin L) (h : AfterA K) : AfterA L := + ⟨⟨(lot, h.1.val.2), h.1.property⟩, h.2⟩ + +private def bRelot {K L : ℕ} (lot : Fin L) (h : AfterB K) : AfterB L := + ⟨⟨aRelot lot h.1.val, h.1.property⟩, h.2⟩ + +private def partRelot {K L : ℕ} (lot : Fin L) (h : PartC K) : PartC L := + (⟨bRelot lot h.1.val, h.1.property⟩, h.2) + +def workRelot {K L : ℕ} (lot : Fin L) : Work K → Work L + | .stageA h => .stageA ⟨(lot, h.val.2), h.property⟩ + | .stageB h => .stageB ⟨aRelot lot h.val, h.property⟩ + | .stageC h => .stageC (partRelot lot h) + +@[simp] theorem workRelot_lot {K L : ℕ} (lot : Fin L) (w : Work K) : + (workRelot lot w).lot = lot := by cases w <;> rfl + +@[simp] theorem workRelot_stage {K L : ℕ} (lot : Fin L) (w : Work K) : + (workRelot lot w).stage = w.stage := by cases w <;> rfl + +@[simp] theorem workRelot_self {K : ℕ} (w : Work K) : workRelot w.lot w = w := by + cases w <;> rfl + +@[simp] theorem workRelot_relot {K L M : ℕ} (first : Fin L) (last : Fin M) + (w : Work K) : workRelot last (workRelot first w) = workRelot last w := by + cases w <;> rfl + +@[simp] theorem workAmount_relot {K L : ℕ} (allocation : Allocation) + (lot : Fin L) (w : Work K) : + workAmount allocation (workRelot lot w) = workAmount allocation w := by + cases w <;> rfl + +def workLotEquiv (K : ℕ) : Work K ≃ Fin K × Work 1 where + toFun w := (w.lot, workRelot 0 w) + invFun h := workRelot h.1 h.2 + left_inv w := by simp only [workRelot_relot, workRelot_self] + right_inv h := by + rcases h with ⟨lot, w⟩ + apply Prod.ext + · exact workRelot_lot lot w + · simp only [workRelot_relot] + have hzero : (0 : Fin 1) = w.lot := Subsingleton.elim _ _ + rw [hzero, workRelot_self] + +@[simp] theorem workLotEquiv_symm_apply (K : ℕ) (lot : Fin K) (w : Work 1) : + (workLotEquiv K).symm (lot, w) = workRelot lot w := rfl + +private def workStagesEquiv (K : ℕ) : + Work K ≃ InitialPositive K ⊕ APositive K ⊕ PartC K where + toFun + | .stageA h => .inl h + | .stageB h => .inr (.inl h) + | .stageC h => .inr (.inr h) + invFun + | .inl h => .stageA h + | .inr (.inl h) => .stageB h + | .inr (.inr h) => .stageC h + left_inv w := by cases w <;> rfl + right_inv h := by rcases h with h | h | h <;> rfl + +private theorem work_sum {K : ℕ} (f : Work K → ℝ) : + (∑ w, f w) = (∑ h : InitialPositive K, f (.stageA h)) + + (∑ h : APositive K, f (.stageB h)) + (∑ h : PartC K, f (.stageC h)) := by + calc + _ = ∑ h : InitialPositive K ⊕ APositive K ⊕ PartC K, + f ((workStagesEquiv K).symm h) := + ((workStagesEquiv K).symm.sum_comp f).symm + _ = _ := by + simp only [Fintype.sum_sum_type] + exact (add_assoc _ _ _).symm + +theorem sum_lot_tick (K tick : ℕ) (stage : Fin 3) (value : ℝ) : + (∑ lot : Fin K, if FiniteSchedule.lotTick lot stage = tick then value else 0) = + if FiniteSchedule.stageActive K tick stage then value else 0 := by + by_cases active : FiniteSchedule.stageActive K tick stage + · obtain ⟨lot, hlot, unique⟩ := + (FiniteSchedule.stageActive_iff_unique_lot K tick stage).mp active + have he (j : Fin K) : FiniteSchedule.lotTick j stage = tick ↔ j = lot := + ⟨unique j, fun h => by simpa only [h] using hlot⟩ + simp only [he, ite_eq_left active] + simp + · have hn (lot : Fin K) : FiniteSchedule.lotTick lot stage ≠ tick := by + intro h + exact active (h ▸ FiniteSchedule.lot_active_at_its_tick lot stage) + simp only [hn, ite_eq_right active, ite_false, Finset.sum_const_zero] + +def shapeValue {K : ℕ} (fA fB : Shape → ℝ) + (fC : Shape → Shape → Fin 3 → ℝ) : Work K → ℝ + | .stageA h => fA (initialShape h.val) + | .stageB h => fB (aShape h.val) + | .stageC h => fC (cParameterParent h) (cShapeParent h) h.2 + +@[simp] theorem shapeValue_relot {K L : ℕ} (fA fB : Shape → ℝ) + (fC : Shape → Shape → Fin 3 → ℝ) (lot : Fin L) (w : Work K) : + shapeValue fA fB fC (workRelot lot w) = shapeValue fA fB fC w := by + cases w <;> rfl + +def stageASourceSum (fA : Shape → ℝ) : ℝ := + (positiveInitial.map (fun g => (initialLaw g : ℝ) * fA g)).sum + +def stageBSourceSum (fB : Shape → ℝ) : ℝ := + (positiveSecond.map (fun t => (secondMass t : ℝ) * fB t)).sum + +def stageCSourceSum (allocation : Allocation) (fC : Shape → Shape → Fin 3 → ℝ) : ℝ := + (positiveSecond.map (fun t => (((below t).filter positive).map (fun u => + (littleMass t u : ℝ) * ∑ part : Fin 3, (allocation.mass part : ℝ) * fC t u part)).sum)).sum + +theorem stageA_one_lot_sum (fA : Shape → ℝ) : + (∑ h : InitialPositive 1, (initialAmount h.val : ℝ) * fA (initialShape h.val)) = + stageASourceSum fA := by + simpa only [Nat.cast_one, one_mul, initialAmount, stageASourceSum] using + initial_positive_sum 1 (fun g => (initialLaw g : ℝ) * fA g) + +theorem stageB_one_lot_sum (fB : Shape → ℝ) : + (∑ h : APositive 1, (aAmount h.val : ℝ) * fB (aShape h.val)) = + stageBSourceSum fB := by + simpa only [Nat.cast_one, one_mul, stageBSourceSum] using a_positive_history_sum 1 fB + +theorem stageC_one_lot_sum (allocation : Allocation) (fC : Shape → Shape → Fin 3 → ℝ) : + (∑ h : PartC 1, (partAmount allocation h : ℝ) * + fC (cParameterParent h) (cShapeParent h) h.2) = stageCSourceSum allocation fC := by + simp only [Fintype.sum_prod_type, partAmount, Rat.cast_mul, + cParameterParent, cShapeParent, mul_assoc, ← Finset.mul_sum] + simpa only [Nat.cast_one, one_mul, stageCSourceSum] using + b_positive_history_sum 1 (fun t u => ∑ part : Fin 3, + (allocation.mass part : ℝ) * fC t u part) + +private theorem subtype_sum_indicator_inline_MatrixMultiplication_AllFieldActiveSums {A : Type*} [Fintype A] + (P : A → Prop) [DecidablePred P] [Fintype {a // P a}] (f : A → ℝ) : + (∑ a : {a // P a}, f a.val) = ∑ a, if P a then f a else 0 := by + rw [← Finset.sum_filter] + exact (Finset.sum_subtype _ (by simp) f).symm + +theorem active_shape_sum (K tick : ℕ) (allocation : Allocation) + (fA fB : Shape → ℝ) (fC : Shape → Shape → Fin 3 → ℝ) : + (∑ w : CanonicalActive K tick, + workAmount allocation w.val * shapeValue fA fB fC w.val) = + (if FiniteSchedule.stageActive K tick 0 then stageASourceSum fA else 0) + + (if FiniteSchedule.stageActive K tick 1 then stageBSourceSum fB else 0) + + (if FiniteSchedule.stageActive K tick 2 then stageCSourceSum allocation fC else 0) := by + rw [subtype_sum_indicator_inline_MatrixMultiplication_AllFieldActiveSums + (fun w : Work K => FiniteSchedule.lotTick w.lot w.stage = tick) + (fun w => workAmount allocation w * shapeValue fA fB fC w)] + rw [← (workLotEquiv K).symm.sum_comp + (fun w => if FiniteSchedule.lotTick w.lot w.stage = tick then + workAmount allocation w * shapeValue fA fB fC w else 0)] + simp only [Fintype.sum_prod_type, workLotEquiv_symm_apply, workRelot_lot, + workRelot_stage, workAmount_relot, shapeValue_relot] + rw [Finset.sum_comm] + simp only [sum_lot_tick] + rw [work_sum] + change (∑ history : InitialPositive 1, if FiniteSchedule.stageActive K tick 0 then + (initialAmount history.val : ℝ) * fA (initialShape history.val) else 0) + + (∑ history : APositive 1, if FiniteSchedule.stageActive K tick 1 then + (aAmount history.val : ℝ) * fB (aShape history.val) else 0) + + (∑ history : PartC 1, if FiniteSchedule.stageActive K tick 2 then + (partAmount allocation history : ℝ) * + fC (cParameterParent history) (cShapeParent history) history.2 else 0) = _ + simp only [Finset.sum_ite_irrel, Finset.sum_const_zero, + stageA_one_lot_sum, stageB_one_lot_sum, stageC_one_lot_sum] + +def shapeCapacity {K : ℕ} (fA fB : Shape → Staggering.Capacity) + (fC : Shape → Shape → Fin 3 → Staggering.Capacity) (w : Work K) : Staggering.Capacity := + fun i => shapeValue (fun g => fA g i) (fun t => fB t i) (fun t u part => fC t u part i) w + +def stageASourceCapacity (fA : Shape → Staggering.Capacity) : Staggering.Capacity := + fun i => stageASourceSum (fun g => fA g i) + +def stageBSourceCapacity (fB : Shape → Staggering.Capacity) : Staggering.Capacity := + fun i => stageBSourceSum (fun t => fB t i) + +def stageCSourceCapacity (allocation : Allocation) + (fC : Shape → Shape → Fin 3 → Staggering.Capacity) : Staggering.Capacity := + fun i => stageCSourceSum allocation (fun t u part => fC t u part i) + +theorem activeAggregateCapacity_shapeCapacity (K tick : ℕ) (allocation : Allocation) + (fA fB : Shape → Staggering.Capacity) + (fC : Shape → Shape → Fin 3 → Staggering.Capacity) : + activeAggregateCapacity allocation tick (shapeCapacity (K := K) fA fB fC) = + FiniteSchedule.tickCapacity K (stageASourceCapacity fA) (stageBSourceCapacity fB) + (stageCSourceCapacity allocation fC) tick := by + funext i + exact active_shape_sum K tick allocation (fun g => fA g i) (fun t => fB t i) + (fun t u part => fC t u part i) + +end MatrixMultiplication.AllFieldHistory + +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/Construction/CompleteWordPair.lean b/lean/OAI/LinearAlgebra/MatrixFields/Construction/CompleteWordPair.lean new file mode 100644 index 0000000000000000000000000000000000000000..eb1756a4aaeb84a57818e53dcb90bfb664b7bbd1 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/Construction/CompleteWordPair.lean @@ -0,0 +1,40 @@ +import Mathlib + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +namespace MatrixMultiplication.PermutationMatching + +variable {C : Type*} {P X Y : C → Type*} + +structure CompleteWordPair (P X Y : C → Type*) where + left : ∀ c, P c → X c + right : ∀ c, P c → Y c + +abbrev HalfClassPermutations (P : C → Type*) := + (∀ c, Equiv.Perm (P c)) × (∀ c, Equiv.Perm (P c)) + +instance completeWordPairMulAction : + MulAction (HalfClassPermutations P) (CompleteWordPair P X Y) where + smul g w := + { left := fun c i => w.left c ((g.1 c).symm i) + right := fun c i => w.right c ((g.2 c).symm i) } + one_smul w := by cases w; rfl + mul_smul g h w := rfl + +@[simp] theorem smul_completeWordPair_left (g : HalfClassPermutations P) + (w : CompleteWordPair P X Y) (c : C) (i : P c) : + (g • w).left c i = w.left c ((g.1 c).symm i) := rfl + +@[simp] theorem smul_completeWordPair_right (g : HalfClassPermutations P) + (w : CompleteWordPair P X Y) (c : C) (i : P c) : + (g • w).right c i = w.right c ((g.2 c).symm i) := rfl + +end MatrixMultiplication.PermutationMatching + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/Construction/ComplexExpressionFamily.lean b/lean/OAI/LinearAlgebra/MatrixFields/Construction/ComplexExpressionFamily.lean new file mode 100644 index 0000000000000000000000000000000000000000..11526c2a8790e1d8c18180b909b3f7648ee793b0 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/Construction/ComplexExpressionFamily.lean @@ -0,0 +1,72 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Arithmetic.ComplexArithmeticLowerBound + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +noncomputable section + +open scoped BigOperators + +namespace MatrixMultiplication.Foundation.Arithmetic.Expression + +variable {Input Output : Type*} + +structure CompiledFamily [Fintype Output] (expressions : Output → Expression Input) where + registers : ℕ + program : Program Input registers + output : Output → Fin registers + correct : ∀ inputs i, program.eval inputs (output i) = (expressions i).eval inputs + cost_eq : program.cost = ∑ i, (expressions i).cost + +def compileFinFamily : (n : ℕ) → (expressions : Fin n → Expression Input) → + CompiledFamily expressions + | 0, _ => + { registers := 0 + program := Program.nil + output := Fin.elim0 + correct := by + intro inputs i + exact Fin.elim0 i + cost_eq := by simp [Program.cost] } + | n + 1, expressions => + let p := compile (expressions 0) + let q := compileFinFamily n (fun i => expressions i.succ) + { registers := p.registers + q.registers + program := p.program.append q.program + output := Fin.cases (Program.oldIndex _ _ p.output) + (fun i => Program.newIndex _ _ (q.output i)) + correct := by + intro inputs i + refine Fin.cases ?_ (fun j => ?_) i + · exact (Program.eval_append_old p.program q.program inputs p.output).trans + (p.correct inputs) + · exact (Program.eval_append_new p.program q.program inputs (q.output j)).trans + (q.correct inputs j) + cost_eq := by + rw [Program.cost_append, p.cost_eq, q.cost_eq, Fin.sum_univ_succ] } + +def compileFamily [Fintype Output] (expressions : Output → Expression Input) : + CompiledFamily expressions := + let e := Fintype.equivFin Output + let p := compileFinFamily (Fintype.card Output) (fun i => expressions (e.symm i)) + { registers := p.registers + program := p.program + output := fun i => p.output (e i) + correct := by + intro inputs i + simpa only [Equiv.symm_apply_apply] using p.correct inputs (e i) + cost_eq := by + rw [p.cost_eq] + exact e.symm.sum_comp (fun i => (expressions i).cost) } + +end MatrixMultiplication.Foundation.Arithmetic.Expression + +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/Construction/ComplexLocalMaps.lean b/lean/OAI/LinearAlgebra/MatrixFields/Construction/ComplexLocalMaps.lean new file mode 100644 index 0000000000000000000000000000000000000000..4ace8f63eb650e264a0a3ccf8e4f6a2b7ff1d434 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/Construction/ComplexLocalMaps.lean @@ -0,0 +1,206 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Tensors.ComplexDotPairing + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +namespace MatrixMultiplication.Foundation +namespace LocalMaps + +open scoped BigOperators + +variable {K X Y Z A B C A' B' C' : Type*} +variable [CommSemiring K] [Fintype A] [Fintype B] [Fintype C] + +def fiberMatrix [DecidableEq X] (M : X → A' → A → K) : + (X × A') → (X × A) → K := + fun output input => if output.1 = input.1 then M output.1 output.2 input.2 else 0 + +def fiberTransform (MX : X → A' → A → K) (MY : Y → B' → B → K) + (MZ : Z → C' → C → K) (T : Tensor K (X × A) (Y × B) (Z × C)) : + Tensor K (X × A') (Y × B') (Z × C') := + fun x y z => ∑ a, ∑ b, ∑ c, + MX x.1 x.2 a * MY y.1 y.2 b * MZ z.1 z.2 c * + T (x.1, a) (y.1, b) (z.1, c) + +def originalScale (coefficient : X → Y → Z → K) + (T : Tensor K (X × A) (Y × B) (Z × C)) : + Tensor K (X × A) (Y × B) (Z × C) := + fun x y z => coefficient x.1 y.1 z.1 * T x y z + +theorem fiberTransform_originalScale (MX : X → A' → A → K) + (MY : Y → B' → B → K) (MZ : Z → C' → C → K) + (coefficient : X → Y → Z → K) + (T : Tensor K (X × A) (Y × B) (Z × C)) : + fiberTransform MX MY MZ (originalScale coefficient T) = + originalScale coefficient (fiberTransform MX MY MZ T) := by + funext x y z + simp only [fiberTransform, originalScale, Finset.mul_sum] + apply Finset.sum_congr rfl + intro a _ + apply Finset.sum_congr rfl + intro b _ + apply Finset.sum_congr rfl + intro c _ + ac_rfl + +theorem fiberTransform_substitution + (MX : X → A' → A → K) (MY : Y → B' → B → K) + (MZ : Z → C' → C → K) + (T : Tensor K (X × A) (Y × B) (Z × C)) + (U : Tensor K (X × A') (Y × B') (Z × C')) + (identity : fiberTransform MX MY MZ T = U) + (coefficient : X → Y → Z → K) : + fiberTransform MX MY MZ (originalScale coefficient T) = + originalScale coefficient U := by + rw [fiberTransform_originalScale, identity] + +theorem fiberTransform_eq_restrict [Fintype X] [Fintype Y] [Fintype Z] + [DecidableEq X] [DecidableEq Y] [DecidableEq Z] + (MX : X → A' → A → K) (MY : Y → B' → B → K) + (MZ : Z → C' → C → K) (T : Tensor K (X × A) (Y × B) (Z × C)) : + fiberTransform MX MY MZ T = + Tensor.restrict (fiberMatrix MX) (fiberMatrix MY) (fiberMatrix MZ) T := by + funext x y z + simp [fiberTransform, Tensor.restrict, fiberMatrix, Fintype.sum_prod_type, + ite_mul, mul_ite] + +noncomputable def originalMask (P : X → Y → Z → Prop) + (T : Tensor K (X × A) (Y × B) (Z × C)) : + Tensor K (X × A) (Y × B) (Z × C) := by + classical + exact fun x y z => if P x.1 y.1 z.1 then T x y z else 0 + +theorem fiberTransform_originalMask (MX : X → A' → A → K) + (MY : Y → B' → B → K) (MZ : Z → C' → C → K) + (P : X → Y → Z → Prop) (T : Tensor K (X × A) (Y × B) (Z × C)) : + fiberTransform MX MY MZ (originalMask P T) = + originalMask P (fiberTransform MX MY MZ T) := by + classical + funext x y z + by_cases h : P x.1 y.1 z.1 <;> simp [fiberTransform, originalMask, h] + +def SupportedOn (P : X → Y → Z → Prop) + (T : Tensor K (X × A) (Y × B) (Z × C)) : Prop := + ∀ x y z, ¬ P x.1 y.1 z.1 → T x y z = 0 + +theorem fiberTransform_supportedOn (MX : X → A' → A → K) + (MY : Y → B' → B → K) (MZ : Z → C' → C → K) + (P : X → Y → Z → Prop) (T : Tensor K (X × A) (Y × B) (Z × C)) + (hT : SupportedOn P T) : SupportedOn P (fiberTransform MX MY MZ T) := by + intro x y z h + apply Finset.sum_eq_zero + intro a _ + apply Finset.sum_eq_zero + intro b _ + apply Finset.sum_eq_zero + intro c _ + simp [hT (x.1, a) (y.1, b) (z.1, c) h] + +omit [Fintype A] [Fintype B] [Fintype C] in +theorem originalMask_eq_self (P : X → Y → Z → Prop) + (T : Tensor K (X × A) (Y × B) (Z × C)) (hT : SupportedOn P T) : + originalMask P T = T := by + classical + funext x y z + by_cases h : P x.1 y.1 z.1 + · simp [originalMask, h] + · simp [originalMask, h, hT x y z h] + +noncomputable def localSelector (P : X → Prop) : (X × A) → (X × A) → K := by + classical + exact fun output input => + if output = input then (if P output.1 then 1 else 0) else 0 + +theorem factoredMask_eq_restrict [Fintype X] [Fintype Y] [Fintype Z] + (PX : X → Prop) (PY : Y → Prop) (PZ : Z → Prop) + (T : Tensor K (X × A) (Y × B) (Z × C)) : + originalMask (fun x y z => PX x ∧ PY y ∧ PZ z) T = + Tensor.restrict (localSelector PX) (localSelector PY) (localSelector PZ) T := by + classical + funext x y z + by_cases hx : PX x.1 <;> by_cases hy : PY y.1 <;> by_cases hz : PZ z.1 <;> + simp [originalMask, Tensor.restrict, localSelector, ite_mul, mul_ite, hx, hy, hz] + +variable {Label : Type*} + +def Synchronized (lx : X → Label) (ly : Y → Label) (lz : Z → Label) : + X → Y → Z → Prop := + fun x y z => lx x = ly y ∧ lx x = lz z + +def InBranch (lx : X → Label) (ly : Y → Label) (lz : Z → Label) + (label : Label) : X → Y → Z → Prop := + fun x y z => lx x = label ∧ ly y = label ∧ lz z = label + +omit [Fintype A] [Fintype B] [Fintype C] in +theorem factoredMask_synchronized + (lx : X → Label) (ly : Y → Label) (lz : Z → Label) + (PX : X → Prop) (PY : Y → Prop) (PZ : Z → Prop) + (support : X → Y → Z → Prop) + (T : Tensor K (X × A) (Y × B) (Z × C)) + (hT : SupportedOn support T) + (compatible : ∀ x y z, support x y z → PX x → PY y → PZ z → + Synchronized lx ly lz x y z) : + SupportedOn (Synchronized lx ly lz) + (originalMask (fun x y z => PX x ∧ PY y ∧ PZ z) T) := by + classical + intro x y z hn + by_cases hs : support x.1 y.1 z.1 + · by_cases hw : PX x.1 ∧ PY y.1 ∧ PZ z.1 + · exact (hn (compatible x.1 y.1 z.1 hs hw.1 hw.2.1 hw.2.2)).elim + · simp [originalMask, hw] + · simp [originalMask, hT x y z hs] + +theorem controlled_eq_sum_branches [Fintype Label] + (lx : X → Label) (ly : Y → Label) (lz : Z → Label) + (MX : Label → X → A' → A → K) (MY : Label → Y → B' → B → K) + (MZ : Label → Z → C' → C → K) + (T : Tensor K (X × A) (Y × B) (Z × C)) : + fiberTransform (fun x => MX (lx x) x) (fun y => MY (ly y) y) + (fun z => MZ (lz z) z) (originalMask (Synchronized lx ly lz) T) = + fun x y z => ∑ label, + fiberTransform (MX label) (MY label) (MZ label) + (originalMask (InBranch lx ly lz label) T) x y z := by + classical + funext x y z + by_cases h : Synchronized lx ly lz x.1 y.1 z.1 + · have hy : ly y.1 = lx x.1 := h.1.symm + have hz : lz z.1 = lx x.1 := h.2.symm + rw [Finset.sum_eq_single (lx x.1)] + · simp [fiberTransform, originalMask, InBranch, h, hy, hz] + · intro label _ hlabel + have hn : lx x.1 ≠ label := Ne.symm hlabel + simp [fiberTransform, originalMask, InBranch, hn] + · simp + · have hn (label : Label) : ¬ InBranch lx ly lz label x.1 y.1 z.1 := by + intro hb + exact h ⟨hb.1.trans hb.2.1.symm, hb.1.trans hb.2.2.symm⟩ + simp [fiberTransform, originalMask, h, hn] + +theorem controlled_eq_sum_branches_of_supported [Fintype Label] + (lx : X → Label) (ly : Y → Label) (lz : Z → Label) + (MX : Label → X → A' → A → K) (MY : Label → Y → B' → B → K) + (MZ : Label → Z → C' → C → K) + (T : Tensor K (X × A) (Y × B) (Z × C)) + (hT : SupportedOn (Synchronized lx ly lz) T) : + fiberTransform (fun x => MX (lx x) x) (fun y => MY (ly y) y) + (fun z => MZ (lz z) z) T = + fun x y z => ∑ label, + fiberTransform (MX label) (MY label) (MZ label) + (originalMask (InBranch lx ly lz label) T) x y z := by + have h := controlled_eq_sum_branches lx ly lz MX MY MZ T + rw [originalMask_eq_self _ _ hT] at h + exact h + +end LocalMaps +end MatrixMultiplication.Foundation + +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/Construction/ComplexPolynomialWitnessProduct.lean b/lean/OAI/LinearAlgebra/MatrixFields/Construction/ComplexPolynomialWitnessProduct.lean new file mode 100644 index 0000000000000000000000000000000000000000..ea5eb1e7a2fdc4d1a1f0f5a1f1cbff5d504a57f2 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/Construction/ComplexPolynomialWitnessProduct.lean @@ -0,0 +1,150 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Construction.ComplexRectangularASI + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +noncomputable section + +namespace MatrixMultiplication.Foundation +namespace Tensor +namespace PolynomialApproximation + +variable {F X Y Z U V W X' Y' Z' : Type*} [Field F] +variable {T : Tensor F X Y Z} {S : Tensor F U V W} +variable {r s d e D E : ℕ} + +theorem product_polynomial_eq (A : PolynomialApproximation T r d D) + (B : PolynomialApproximation S s e E) (x : X × U) (y : Y × V) (z : Z × W) : + Tensor.product A.polynomial B.polynomial x y z = + Polynomial.X ^ (d + e) * Tensor.product A.normalized B.normalized x y z := by + dsimp only [Tensor.product] + rw [A.polynomial_eq, B.polynomial_eq, pow_add] + ring + +def product (A : PolynomialApproximation T r d D) + (B : PolynomialApproximation S s e E) : + PolynomialApproximation (Tensor.product T S) (r * s) (d + e) (D + E) where + polynomial := Tensor.product A.polynomial B.polynomial + rank_bound := A.rank_bound.product B.rank_bound + vanishes := by + intro x y z k hk + rw [A.product_polynomial_eq B] + simp only [Polynomial.coeff_X_pow_mul', Nat.not_le_of_lt hk, ite_false] + leading := by + intro x y z + rw [A.product_polynomial_eq B] + simp only [Polynomial.coeff_X_pow_mul', le_refl, ite_true, Nat.sub_self, + Tensor.product, Polynomial.mul_coeff_zero, A.normalized_constant, B.normalized_constant] + degree_bound := by + intro x y z + apply Polynomial.degree_le_of_natDegree_le + exact Polynomial.natDegree_mul_le_of_le + (Polynomial.natDegree_le_of_degree_le (A.degree_bound x.1 y.1 z.1)) + (Polynomial.natDegree_le_of_degree_le (B.degree_bound x.2 y.2 z.2)) + +@[simp] theorem product_polynomial (A : PolynomialApproximation T r d D) + (B : PolynomialApproximation S s e E) : + (A.product B).polynomial = Tensor.product A.polynomial B.polynomial := rfl + +def productExact (A : PolynomialApproximation T r d D) + (S : Tensor F U V W) (s : ℕ) (hS : RankAtMost S s) : + PolynomialApproximation (Tensor.product T S) (r * s) d D := by + simpa only [Nat.add_zero] using A.product (ofRankAtMost S s hS) + +def pullback (A : PolynomialApproximation T r d D) + (fx : X' → X) (fy : Y' → Y) (fz : Z' → Z) : + PolynomialApproximation (Tensor.pullback fx fy fz T) r d D where + polynomial := Tensor.pullback fx fy fz A.polynomial + rank_bound := A.rank_bound.pullback fx fy fz + vanishes := fun x y z k hk => A.vanishes (fx x) (fy y) (fz z) k hk + leading := fun x y z => A.leading (fx x) (fy y) (fz z) + degree_bound := fun x y z => A.degree_bound (fx x) (fy y) (fz z) + +@[simp] theorem pullback_polynomial (A : PolynomialApproximation T r d D) + (fx : X' → X) (fy : Y' → Y) (fz : Z' → Z) : + (A.pullback fx fy fz).polynomial = Tensor.pullback fx fy fz A.polynomial := rfl + +def cyclic (A : PolynomialApproximation T r d D) : + PolynomialApproximation (Tensor.cyclic T) r d D where + polynomial := Tensor.cyclic A.polynomial + rank_bound := A.rank_bound.cyclic + vanishes := fun y z x k hk => A.vanishes x y z k hk + leading := fun y z x => A.leading x y z + degree_bound := fun y z x => A.degree_bound x y z + +@[simp] theorem cyclic_polynomial (A : PolynomialApproximation T r d D) : + A.cyclic.polynomial = Tensor.cyclic A.polynomial := rfl + +def directSum_product {ι κ : Type*} [DecidableEq ι] [DecidableEq κ] + {T : ι → Tensor F X Y Z} {S : κ → Tensor F U V W} + (A : PolynomialApproximation (Tensor.directSum T) r d D) + (B : PolynomialApproximation (Tensor.directSum S) s e E) : + PolynomialApproximation + (Tensor.directSum (fun i : ι × κ => Tensor.product (T i.1) (S i.2))) + (r * s) (d + e) (D + E) := by + have h := (A.product B).pullback (directSumProductEquiv ι κ X U) + (directSumProductEquiv ι κ Y V) (directSumProductEquiv ι κ Z W) + simpa only [Tensor.directSum_product] using h + +def directSum_pullback {ι : Type*} [DecidableEq ι] + {T : ι → Tensor F X Y Z} + (A : PolynomialApproximation (Tensor.directSum T) r d D) + (fx : X' → X) (fy : Y' → Y) (fz : Z' → Z) : + PolynomialApproximation + (Tensor.directSum (fun i => Tensor.pullback fx fy fz (T i))) r d D := + A.pullback (fun x : ι × X' => (x.1, fx x.2)) + (fun y : ι × Y' => (y.1, fy y.2)) (fun z : ι × Z' => (z.1, fz z.2)) + +def directSum_cyclic {ι : Type*} [DecidableEq ι] + {T : ι → Tensor F X Y Z} + (A : PolynomialApproximation (Tensor.directSum T) r d D) : + PolynomialApproximation (Tensor.directSum (fun i => Tensor.cyclic (T i))) r d D := by + simpa only [Tensor.cyclic_directSum] using A.cyclic + +variable {A B C : Type*} [DecidableEq A] [DecidableEq B] [DecidableEq C] + +def matrixCoefficients_symmetrized + (P : PolynomialApproximation (matrixCoefficients (K := F) A B C) r d D) : + PolynomialApproximation + (matrixCoefficients (K := F) (A × B × C) (A × B × C) (A × B × C)) + (r ^ 3) (3 * d) (3 * D) := by + have h := ((P.product P.cyclic).product P.cyclic.cyclic).pullback + (rectangularSquareX A B C) (rectangularSquareY A B C) (rectangularSquareZ A B C) + have hd : d + d + d = 3 * d := by ring + have hD : D + D + D = 3 * D := by ring + simpa only [Tensor.cyclic_matrixCoefficients, Tensor.matrixCoefficients_cyclic_product_square, + pow_succ, pow_zero, one_mul, hd, hD] using h + +def matrixCoefficients_directSum_symmetrized {ι : Type*} [DecidableEq ι] + (P : PolynomialApproximation + (Tensor.directSum (fun _ : ι => matrixCoefficients (K := F) A B C)) r d D) : + PolynomialApproximation + (Tensor.directSum (fun _ : (ι × ι) × ι => + matrixCoefficients (K := F) (A × B × C) (A × B × C) (A × B × C))) + (r ^ 3) (3 * d) (3 * D) := by + have P₁ : PolynomialApproximation + (Tensor.directSum (fun _ : ι => matrixCoefficients (K := F) B C A)) r d D := by + simpa only [Tensor.cyclic_matrixCoefficients] using P.directSum_cyclic + have P₂ : PolynomialApproximation + (Tensor.directSum (fun _ : ι => matrixCoefficients (K := F) C A B)) r d D := by + simpa only [Tensor.cyclic_matrixCoefficients] using P₁.directSum_cyclic + have h := ((P.directSum_product P₁).directSum_product P₂).directSum_pullback + (rectangularSquareX A B C) (rectangularSquareY A B C) (rectangularSquareZ A B C) + have hd : d + d + d = 3 * d := by ring + have hD : D + D + D = 3 * D := by ring + simpa only [Tensor.matrixCoefficients_cyclic_product_square, + pow_succ, pow_zero, one_mul, hd, hD] using h + +end PolynomialApproximation +end Tensor +end MatrixMultiplication.Foundation + +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/Construction/ComplexRectangularASI.lean b/lean/OAI/LinearAlgebra/MatrixFields/Construction/ComplexRectangularASI.lean new file mode 100644 index 0000000000000000000000000000000000000000..95f3b06b22924a45eeef2e237b0c71fae02e708e --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/Construction/ComplexRectangularASI.lean @@ -0,0 +1,970 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Arithmetic.ComplexArithmeticExponent +import OAI.LinearAlgebra.MatrixFields.Arithmetic.ComplexArithmeticGrowth +import OAI.LinearAlgebra.MatrixFields.Entropy.ComplexAsymptoticRecurrence +import OAI.LinearAlgebra.MatrixFields.Entropy.ComplexPolynomialPowerGrowth + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section + +open scoped BigOperators + +namespace MatrixMultiplication.Foundation +namespace Tensor + +variable {F X Y Z : Type*} [Field F] + +theorem coeff_eq_sum_eval {ι : Type*} [Fintype ι] [DecidableEq ι] + (nodes : ι → F) (hnodes : Function.Injective nodes) + (p : Polynomial F) (d : ℕ) (hdegree : p.degree < Fintype.card ι) : + p.coeff d = ∑ i, p.eval (nodes i) * + (Lagrange.basis Finset.univ nodes i).coeff d := by + have hinj : Set.InjOn nodes (↑(Finset.univ : Finset ι)) := hnodes.injOn + have hinterp := Lagrange.eq_interpolate hinj (by simpa using hdegree) + (f := p) + calc + p.coeff d = (Lagrange.interpolate Finset.univ nodes + (fun i => p.eval (nodes i))).coeff d := congrArg (fun q => q.coeff d) hinterp + _ = _ := by + simp only [Lagrange.interpolate_apply, Polynomial.finsetSum_coeff, + Polynomial.coeff_C_mul] + +theorem RankAtMost.coeff {ι : Type*} [Fintype ι] [DecidableEq ι] + (nodes : ι → F) (hnodes : Function.Injective nodes) + {P : Tensor (Polynomial F) X Y Z} {r : ℕ} (hP : RankAtMost P r) + (d : ℕ) (hdegree : ∀ x y z, (P x y z).degree < Fintype.card ι) : + RankAtMost (fun x y z => (P x y z).coeff d) (Fintype.card ι * r) := by + rcases hP with ⟨a, b, c, rfl⟩ + let w : ι → F := fun i => (Lagrange.basis Finset.univ nodes i).coeff d + let aa : (ι × Fin r) → X → F := fun i x => w i.1 * (a i.2 x).eval (nodes i.1) + let bb : (ι × Fin r) → Y → F := fun i y => (b i.2 y).eval (nodes i.1) + let cc : (ι × Fin r) → Z → F := fun i z => (c i.2 z).eval (nodes i.1) + have heq : (fun x y z => (∑ j, rankOne (a j) (b j) (c j) x y z).coeff d) = + fun x y z => ∑ i, rankOne (aa i) (bb i) (cc i) x y z := by + funext x y z + rw [coeff_eq_sum_eval nodes hnodes _ d (hdegree x y z)] + simp only [Fintype.sum_prod_type, rankOne, Polynomial.eval_finsetSum, + Polynomial.eval_mul, Finset.sum_mul] + apply Finset.sum_congr rfl + intro i hi + apply Finset.sum_congr rfl + intro j hj + dsimp [aa, bb, cc, w] + ring + rw [heq] + simpa only [Fintype.card_prod, Fintype.card_fin] using rankAtMost_sum_rankOne aa bb cc + +structure PolynomialApproximation (T : Tensor F X Y Z) (r d D : ℕ) where + polynomial : Tensor (Polynomial F) X Y Z + rank_bound : RankAtMost polynomial r + vanishes : ∀ x y z k, k < d → (polynomial x y z).coeff k = 0 + leading : ∀ x y z, (polynomial x y z).coeff d = T x y z + degree_bound : ∀ x y z, (polynomial x y z).degree ≤ D + +namespace PolynomialApproximation + +variable {T : Tensor F X Y Z} {r d D : ℕ} + +def normalized (A : PolynomialApproximation T r d D) : + Tensor (Polynomial F) X Y Z := + fun x y z => Classical.choose (Polynomial.X_pow_dvd_iff.mpr (A.vanishes x y z)) + +theorem polynomial_eq (A : PolynomialApproximation T r d D) (x : X) (y : Y) (z : Z) : + A.polynomial x y z = Polynomial.X ^ d * A.normalized x y z := + Classical.choose_spec (Polynomial.X_pow_dvd_iff.mpr (A.vanishes x y z)) + +theorem normalized_constant (A : PolynomialApproximation T r d D) + (x : X) (y : Y) (z : Z) : (A.normalized x y z).coeff 0 = T x y z := by + have h := A.leading x y z + rw [A.polynomial_eq] at h + simpa only [Polynomial.coeff_X_pow_mul', le_refl, ite_true, Nat.sub_self] using h + +theorem power_polynomial_eq (A : PolynomialApproximation T r d D) (n : ℕ) + (x : Fin n → X) (y : Fin n → Y) (z : Fin n → Z) : + Tensor.power A.polynomial n x y z = + Polynomial.X ^ (d * n) * Tensor.power A.normalized n x y z := by + simp [Tensor.power, A.polynomial_eq, Finset.prod_mul_distrib, ← pow_mul] + +def power (A : PolynomialApproximation T r d D) (n : ℕ) : + PolynomialApproximation (Tensor.power T n) (r ^ n) (d * n) (D * n) where + polynomial := Tensor.power A.polynomial n + rank_bound := A.rank_bound.power n + vanishes := by + intro x y z k hk + rw [A.power_polynomial_eq] + simp only [Polynomial.coeff_X_pow_mul', Nat.not_le_of_lt hk, ite_false] + leading := by + intro x y z + rw [A.power_polynomial_eq] + simp only [Polynomial.coeff_X_pow_mul', le_refl, ite_true, Nat.sub_self, + Tensor.power, Polynomial.coeff_zero_prod, A.normalized_constant] + degree_bound := by + intro x y z + apply Polynomial.degree_le_of_natDegree_le + calc + (Tensor.power A.polynomial n x y z).natDegree ≤ + ∑ i, (A.polynomial (x i) (y i) (z i)).natDegree := + Polynomial.natDegree_prod_le _ _ + _ ≤ ∑ _i : Fin n, D := by + apply Finset.sum_le_sum + intro i hi + exact Polynomial.natDegree_le_of_degree_le (A.degree_bound (x i) (y i) (z i)) + _ = D * n := by simp [Nat.mul_comm] + +theorem rank_power [CharZero F] (A : PolynomialApproximation T r d D) (n : ℕ) : + RankAtMost (Tensor.power T n) ((D * n + 1) * r ^ n) := by + let nodes : Fin (D * n + 1) → F := fun i => (i.val : F) + have hinj : Function.Injective nodes := by + intro i j h + apply Fin.ext + exact Nat.cast_injective h + have hdegree (x : Fin n → X) (y : Fin n → Y) (z : Fin n → Z) : + ((A.power n).polynomial x y z).degree < Fintype.card (Fin (D * n + 1)) := by + simp only [Fintype.card_fin] + exact lt_of_le_of_lt ((A.power n).degree_bound x y z) + (WithBot.coe_lt_coe.mpr (Nat.lt_succ_self (D * n))) + have h := (A.power n).rank_bound.coeff nodes hinj (d * n) hdegree + have heq : (fun x y z => ((A.power n).polynomial x y z).coeff (d * n)) = + Tensor.power T n := by + funext x y z + exact (A.power n).leading x y z + rw [heq, Fintype.card_fin] at h + exact h + +theorem rank_normalized_eval (A : PolynomialApproximation T r d D) + (t : F) (ht : t ≠ 0) : + RankAtMost (fun x y z => (A.normalized x y z).eval t) r := by + have h := (A.rank_bound.map (Polynomial.evalRingHom t)).scale ((t ^ d)⁻¹) + change RankAtMost (fun x y z => (t ^ d)⁻¹ * (A.polynomial x y z).eval t) r at h + have heq : (fun x y z => (t ^ d)⁻¹ * (A.polynomial x y z).eval t) = + fun x y z => (A.normalized x y z).eval t := by + funext x y z + rw [A.polynomial_eq, Polynomial.eval_mul, Polynomial.eval_pow, Polynomial.eval_X] + rw [← mul_assoc, inv_mul_cancel₀ (pow_ne_zero d ht), one_mul] + rw [heq] at h + exact h + +theorem borderRankAtMost [Fintype X] [Fintype Y] [Fintype Z] + {S : Tensor ℂ X Y Z} (A : PolynomialApproximation S r d D) : + BorderRankAtMost S r := by + let f : ℂ → Tensor ℂ X Y Z := fun t x y z => (A.normalized x y z).eval t + have hf : Continuous f := by + apply continuous_pi + intro x + apply continuous_pi + intro y + apply continuous_pi + intro z + exact (A.normalized x y z).continuous + have hclosed : IsClosed {t : ℂ | BorderRankAtMost (f t) r} := + isClosed_closure.preimage hf + have hsubset : ({0}ᶜ : Set ℂ) ⊆ {t : ℂ | BorderRankAtMost (f t) r} := by + intro t ht + exact (A.rank_normalized_eval t (by simpa using ht)).borderRankAtMost + have hz := closure_minimal hsubset hclosed ((dense_compl_singleton (0 : ℂ)) 0) + have heq : f 0 = S := by + funext x y z + simp only [f, ← Polynomial.coeff_zero_eq_eval_zero, A.normalized_constant] + change BorderRankAtMost (f 0) r at hz + rw [heq] at hz + exact hz + +end PolynomialApproximation + +end Tensor +end MatrixMultiplication.Foundation + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +namespace MatrixMultiplication.Foundation + +def batchCount (R k : ℕ) : ℕ := (R + k - 1) / k + +@[simp] theorem batchCount_zero (k : ℕ) : batchCount 0 k = 0 := by + unfold batchCount + by_cases hk : k = 0 + · simp [hk] + · apply Nat.div_eq_of_lt + omega + +theorem le_batchCount_mul (R : ℕ) {k : ℕ} (hk : 0 < k) : + R ≤ batchCount R k * k := by + have hdiv := Nat.div_add_mod (R + k - 1) k + have hmod := Nat.mod_lt (R + k - 1) hk + rw [Nat.mul_comm k ((R + k - 1) / k)] at hdiv + unfold batchCount + omega + +theorem batchCount_le_iff {R k B : ℕ} (hk : 0 < k) : + batchCount R k ≤ B ↔ R ≤ B * k := by + unfold batchCount + rw [Nat.div_le_iff_le_mul hk] + omega + +theorem batchCount_mul_lt (R : ℕ) {k : ℕ} (hk : 0 < k) : + batchCount R k * k < R + k := by + have hmul := Nat.div_mul_le_self (R + k - 1) k + unfold batchCount + omega + +theorem batchCount_pos_iff {R k : ℕ} (hk : 0 < k) : + 0 < batchCount R k ↔ 0 < R := by + have hzero := batchCount_le_iff (R := R) (B := 0) hk + simp only [Nat.zero_mul] at hzero + omega + +theorem batchCount_cast_lt (R : ℕ) {k : ℕ} (hk : 0 < k) : + (batchCount R k : ℝ) < (R : ℝ) / (k : ℝ) + 1 := by + have hkR : (0 : ℝ) < (k : ℝ) := Nat.cast_pos.mpr hk + have hmul : (batchCount R k : ℝ) * (k : ℝ) < (R : ℝ) + (k : ℝ) := by + simpa only [Nat.cast_mul, Nat.cast_add] using + (Nat.cast_lt (α := ℝ)).mpr (batchCount_mul_lt R hk) + calc + (batchCount R k : ℝ) < ((R : ℝ) + (k : ℝ)) / (k : ℝ) := + (lt_div_iff₀ hkR).mpr hmul + _ = (R : ℝ) / (k : ℝ) + 1 := by rw [add_div, div_self (ne_of_gt hkR)] + +theorem batchCount_cast_le (R : ℕ) {k : ℕ} (hk : 0 < k) : + (batchCount R k : ℝ) ≤ (R : ℝ) / (k : ℝ) + 1 := + (batchCount_cast_lt R hk).le + +theorem batchCount_mul_cast_le (R r : ℕ) {k : ℕ} (hk : 0 < k) : + ((batchCount R k * r : ℕ) : ℝ) ≤ + (r : ℝ) / (k : ℝ) * (R : ℝ) + (r : ℝ) := by + calc + ((batchCount R k * r : ℕ) : ℝ) = (batchCount R k : ℝ) * (r : ℝ) := by + rw [Nat.cast_mul] + _ ≤ ((R : ℝ) / (k : ℝ) + 1) * (r : ℝ) := + mul_le_mul_of_nonneg_right (batchCount_cast_le R hk) (Nat.cast_nonneg r) + _ = (r : ℝ) / (k : ℝ) * (R : ℝ) + (r : ℝ) := by + simp only [div_eq_mul_inv] + ring + +def batchRank (k r : ℕ) : ℕ → ℕ + | 0 => 1 + | t + 1 => batchCount (batchRank k r t) k * r + +@[simp] theorem batchRank_zero (k r : ℕ) : batchRank k r 0 = 1 := rfl + +@[simp] theorem batchRank_succ (k r t : ℕ) : + batchRank k r (t + 1) = batchCount (batchRank k r t) k * r := rfl + +theorem batchRank_succ_le_affine {k : ℕ} (hk : 0 < k) (r t : ℕ) : + (batchRank k r (t + 1) : ℝ) ≤ + (r : ℝ) / (k : ℝ) * (batchRank k r t : ℝ) + (r : ℝ) := by + rw [batchRank_succ] + exact batchCount_mul_cast_le (batchRank k r t) r hk + +theorem batchRank_pos {k r : ℕ} (hk : 0 < k) (hr : 0 < r) : + ∀ t, 0 < batchRank k r t := by + intro t + induction t with + | zero => simp + | succ t ih => + rw [batchRank_succ] + exact Nat.mul_pos ((batchCount_pos_iff hk).mpr ih) hr + +namespace Tensor + +variable {K X Y Z U V W A B : Type*} [CommSemiring K] + +theorem RankAtMost.repeat_batch_ceiling {S : Tensor K U V W} {k r R : ℕ} + (hbatch : RankAtMost (directSum (fun _ : Fin k => S)) r) (hk : 0 < k) : + RankAtMost (directSum (fun _ : Fin R => S)) (batchCount R k * r) := + hbatch.repeat_batch (le_batchCount_mul R hk) + +theorem RankAtMost.batch_product_ceiling [Fintype U] [Fintype V] [Fintype W] + {T : Tensor K X Y Z} {S : Tensor K U V W} {R k r : ℕ} + (hT : RankAtMost T R) + (hbatch : RankAtMost (directSum (fun _ : Fin k => S)) r) (hk : 0 < k) : + RankAtMost (Tensor.product T S) (batchCount R k * r) := + hT.batch_product hbatch (le_batchCount_mul R hk) + +theorem matrixCoefficients_batch_rank_ceiling [DecidableEq A] [DecidableEq B] [Fintype B] + {R k r : ℕ} + (houter : RankAtMost (matrixCoefficients (K := K) A A A) R) + (hbatch : RankAtMost (directSum (fun _ : Fin k => matrixCoefficients (K := K) B B B)) r) + (hk : 0 < k) : + RankAtMost (matrixCoefficients (K := K) (A × B) (A × B) (A × B)) + (batchCount R k * r) := + matrixCoefficients_batch_rank houter hbatch (le_batchCount_mul R hk) + +end Tensor +end MatrixMultiplication.Foundation + +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section + +namespace MatrixMultiplication.Foundation + +namespace Tensor + +theorem matrixCoefficients_rank_of_injective {K A B : Type*} [CommSemiring K] + [DecidableEq A] [DecidableEq B] {R : ℕ} + (h : RankAtMost (matrixCoefficients (K := K) A A A) R) + (f : B → A) (hf : Function.Injective f) : + RankAtMost (matrixCoefficients (K := K) B B B) R := by + have hp := h.pullback (fun x : B × B => (f x.1, f x.2)) + (fun y : B × B => (f y.1, f y.2)) + (fun z : B × B => (f z.1, f z.2)) + convert hp using 1 + funext x y z + simp only [pullback, matrixCoefficients, hf.eq_iff] + +theorem matrixCoefficients_directSum_rank_of_injective + {K ι κ A B : Type*} [CommSemiring K] + [DecidableEq ι] [DecidableEq κ] [DecidableEq A] [DecidableEq B] {R : ℕ} + (h : RankAtMost (directSum (fun _ : ι => matrixCoefficients (K := K) A A A)) R) + (f : κ → ι) (hf : Function.Injective f) (g : B → A) (hg : Function.Injective g) : + RankAtMost (directSum (fun _ : κ => matrixCoefficients (K := K) B B B)) R := by + have hp := h.pullback + (fun x : κ × (B × B) => (f x.1, (g x.2.1, g x.2.2))) + (fun y : κ × (B × B) => (f y.1, (g y.2.1, g y.2.2))) + (fun z : κ × (B × B) => (f z.1, (g z.2.1, g z.2.2))) + convert hp using 1 + funext x y z + simp only [pullback, directSum, matrixCoefficients, hf.eq_iff, hg.eq_iff] + +theorem matrixCoefficients_directSum_power_rank {K : Type*} [CommSemiring K] + {n k R t : ℕ} + (h : RankAtMost (power (directSum + (fun _ : Fin k => matrixCoefficients (K := K) (Fin n) (Fin n) (Fin n))) t) R) : + RankAtMost (directSum (fun _ : Fin (k ^ t) => + matrixCoefficients (K := K) (Fin (n ^ t)) (Fin (n ^ t)) (Fin (n ^ t)))) R := by + have hmatrix := matrixCoefficients_directSum_rank_of_power h + let tags : Fin (k ^ t) ≃ (Fin t → Fin k) := Fintype.equivOfCardEq (by simp) + let indices : Fin (n ^ t) ≃ (Fin t → Fin n) := Fintype.equivOfCardEq (by simp) + exact matrixCoefficients_directSum_rank_of_injective hmatrix + tags tags.injective indices indices.injective + +theorem PolynomialApproximation.square_directSum_power_rank + {n k r d D : ℕ} + (A : PolynomialApproximation + (directSum (fun _ : Fin k => matrixMultiplication n n n)) r d D) (t : ℕ) : + RankAtMost (directSum (fun _ : Fin (k ^ t) => + matrixMultiplication (n ^ t) (n ^ t) (n ^ t))) ((D * t + 1) * r ^ t) := + matrixCoefficients_directSum_power_rank (A.rank_power t) + +theorem matrixCoefficients_fin_one_rank {K : Type*} [CommSemiring K] : + RankAtMost (matrixCoefficients (K := K) (Fin 1) (Fin 1) (Fin 1)) 1 := by + have heq : matrixCoefficients (K := K) (Fin 1) (Fin 1) (Fin 1) = + rankOne (fun _ => 1) (fun _ => 1) (fun _ => 1) := by + funext x y z + have hxy : x.2 = y.1 := Subsingleton.elim _ _ + have hyz : y.2 = z.1 := Subsingleton.elim _ _ + have hzx : z.2 = x.1 := Subsingleton.elim _ _ + simp [matrixCoefficients, rankOne, hxy, hyz, hzx] + rw [heq] + exact rankOne_rankAtMost _ _ _ + +theorem matrixCoefficients_pow_batchRank {K : Type*} [CommSemiring K] + {n k r : ℕ} (hk : 0 < k) + (hbatch : RankAtMost + (directSum (fun _ : Fin k => matrixCoefficients (K := K) (Fin n) (Fin n) (Fin n))) r) : + ∀ t : ℕ, RankAtMost + (matrixCoefficients (K := K) (Fin (n ^ t)) (Fin (n ^ t)) (Fin (n ^ t))) + (batchRank k r t) := by + intro t + induction t with + | zero => + simp only [batchRank_zero] + exact matrixCoefficients_fin_one_rank + | succ t ih => + let e : Fin (n ^ (t + 1)) ≃ Fin (n ^ t) × Fin n := + Fintype.equivOfCardEq (by simp [pow_succ]) + have hp := matrixCoefficients_batch_rank_ceiling ih hbatch hk + have hr := matrixCoefficients_rank_of_injective hp e e.injective + simpa only [batchRank_succ] using hr + +end Tensor + +namespace Arithmetic + +theorem rpow_omega_le_of_rankAtMost {n R : ℕ} {B : ℝ} (hn : 2 ≤ n) + (hRank : Tensor.RankAtMost (Tensor.matrixMultiplication n n n) R) + (hquad : (n : ℝ) ^ 2 ≤ B) (hR : (R : ℝ) ≤ B) : + (n : ℝ) ^ omega ≤ B := by + have hn1 : 1 < (n : ℝ) := by exact_mod_cast (show 1 < n by omega) + have hn0 : 0 < (n : ℝ) := lt_trans zero_lt_one hn1 + have hB : 0 < B := (sq_pos_of_pos hn0).trans_le hquad + have hpow : (n : ℝ) ^ Real.logb n B = B := + Real.rpow_logb hn0 (ne_of_gt hn1) hB + have hτ : 2 ≤ Real.logb (n : ℝ) B := by + apply (Real.le_logb_iff_rpow_le hn1 hB).mpr + simpa only [Real.rpow_two] using hquad + have hadmissible := admissibleExponent_of_rankAtMost hn hRank hτ (hR.trans_eq hpow.symm) + exact (Real.rpow_le_rpow_of_exponent_le hn1.le + (omega_le_of_admissibleExponent hadmissible)).trans_eq hpow + +theorem rpow_omega_le_of_rank_growth {n : ℕ} {q C : ℝ} (hn : 2 ≤ n) + (hquad : (n : ℝ) ^ 2 ≤ q) (R : ℕ → ℕ) + (hRank : ∀ t : ℕ, Tensor.RankAtMost + (Tensor.matrixMultiplication (n ^ t) (n ^ t) (n ^ t)) (R t)) + (hcost : ∀ t : ℕ, (R t : ℝ) ≤ C * q ^ t) : + (n : ℝ) ^ omega ≤ q := by + have hn0 : 0 ≤ (n : ℝ) := Nat.cast_nonneg n + have hq0 : 0 ≤ q := (sq_nonneg (n : ℝ)).trans hquad + apply power_le_of_forall_pow_le_mul_pow hq0 (C := max 1 C) + intro t ht + have hnt : 2 ≤ n ^ t := hn.trans (le_self_pow (by omega) (Nat.ne_of_gt ht)) + have hbase : ((n ^ t : ℕ) : ℝ) ^ 2 ≤ max 1 C * q ^ t := by + calc + ((n ^ t : ℕ) : ℝ) ^ 2 = ((n : ℝ) ^ 2) ^ t := by + rw [Nat.cast_pow, ← pow_mul, ← pow_mul, Nat.mul_comm t 2] + _ ≤ q ^ t := by gcongr + _ ≤ max 1 C * q ^ t := by + simpa only [one_mul] using + mul_le_mul_of_nonneg_right (le_max_left (1 : ℝ) C) (pow_nonneg hq0 t) + have hcost' : (R t : ℝ) ≤ max 1 C * q ^ t := + (hcost t).trans (mul_le_mul_of_nonneg_right (le_max_right (1 : ℝ) C) + (pow_nonneg hq0 t)) + have h := rpow_omega_le_of_rankAtMost hnt (hRank t) hbase hcost' + simpa only [Nat.cast_pow, ← Real.rpow_pow_comm hn0] using h + +theorem equalSummand_inequality_of_quadratic_bound {n k r : ℕ} + (hn : 2 ≤ n) (hk : 0 < k) + (hbatch : Tensor.RankAtMost + (Tensor.directSum (fun _ : Fin k => Tensor.matrixMultiplication n n n)) r) + (hquad : (n : ℝ) ^ 2 ≤ (r : ℝ) / (k : ℝ)) : + (k : ℝ) * (n : ℝ) ^ omega ≤ (r : ℝ) := by + have hnreal : (2 : ℝ) ≤ n := by exact_mod_cast hn + have hq : 1 < (r : ℝ) / (k : ℝ) := by nlinarith + have hRank := Tensor.matrixCoefficients_pow_batchRank hk hbatch + have hcost := affine_recurrence_bound (fun t => (batchRank k r t : ℝ)) + ((r : ℝ) / (k : ℝ)) (r : ℝ) hq (Nat.cast_nonneg r) + (fun t => batchRank_succ_le_affine hk r t) + have hbound : (n : ℝ) ^ omega ≤ (r : ℝ) / (k : ℝ) := by + apply rpow_omega_le_of_rank_growth + (C := (batchRank k r 0 : ℝ) + (r : ℝ) / ((r : ℝ) / (k : ℝ) - 1)) + hn hquad (batchRank k r) + · exact hRank + · intro t + exact (hcost t).trans_eq (mul_comm _ _) + have hkreal : 0 < (k : ℝ) := by exact_mod_cast hk + simpa only [mul_comm] using (le_div_iff₀ hkreal).mp hbound + +theorem equalSummand_inequality {n k r : ℕ} (hn : 1 ≤ n) + (hbatch : Tensor.RankAtMost + (Tensor.directSum (fun _ : Fin k => Tensor.matrixMultiplication n n n)) r) : + (k : ℝ) * (n : ℝ) ^ omega ≤ (r : ℝ) := by + have hlower := Tensor.directSum_square_rank_lower k n r (by omega) hbatch + by_cases hn1 : n = 1 + · subst n + simpa only [Nat.cast_one, Real.one_rpow, mul_one, one_pow] using + (show (k : ℝ) ≤ (r : ℝ) by exact_mod_cast (by simpa using hlower : k ≤ r)) + by_cases hk0 : k = 0 + · subst k + simp + have hk : 0 < k := Nat.pos_of_ne_zero hk0 + apply equalSummand_inequality_of_quadratic_bound (by omega) hk hbatch + have hkreal : 0 < (k : ℝ) := by exact_mod_cast hk + apply (le_div_iff₀ hkreal).mpr + have hlower_real : (k : ℝ) * (n : ℝ) ^ 2 ≤ (r : ℝ) := by exact_mod_cast hlower + simpa only [mul_comm] using hlower_real + +theorem equalSummand_inequality_of_polynomialApproximation {n k r d D : ℕ} + (hn : 1 ≤ n) + (A : Tensor.PolynomialApproximation + (Tensor.directSum (fun _ : Fin k => Tensor.matrixMultiplication n n n)) r d D) : + (k : ℝ) * (n : ℝ) ^ omega ≤ (r : ℝ) := by + apply power_le_of_forall_pow_le_linear_mul_pow D (Nat.cast_nonneg r) + intro t ht + have hnt : 1 ≤ n ^ t := pow_pos (by omega : 0 < n) t + have h := equalSummand_inequality hnt (A.square_directSum_power_rank t) + simpa only [Nat.cast_pow, Nat.cast_mul, mul_pow, + ← Real.rpow_pow_comm (Nat.cast_nonneg n)] using h + +end Arithmetic + +end MatrixMultiplication.Foundation + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section + +namespace MatrixMultiplication + +open MatrixMultiplication.Foundation + +namespace Tensor + +open MatrixMultiplication.Foundation.Tensor + +theorem rectangular_rank_of_injective + {K A B C A' B' C' : Type*} [CommSemiring K] + [DecidableEq A] [DecidableEq B] [DecidableEq C] + [DecidableEq A'] [DecidableEq B'] [DecidableEq C'] {R : ℕ} + (h : RankAtMost (matrixCoefficients (K := K) A B C) R) + (f : A' → A) (hf : Function.Injective f) + (g : B' → B) (hg : Function.Injective g) + (j : C' → C) (hj : Function.Injective j) : + RankAtMost (matrixCoefficients (K := K) A' B' C') R := by + have hp := h.pullback (fun x : A' × B' => (f x.1, g x.2)) + (fun y : B' × C' => (g y.1, j y.2)) + (fun z : C' × A' => (j z.1, f z.2)) + convert hp using 1 + funext x y z + simp only [pullback, matrixCoefficients, hf.eq_iff, hg.eq_iff, hj.eq_iff] + +theorem rectangular_directSum_rank_of_injective + {K ι κ A B C A' B' C' : Type*} [CommSemiring K] + [DecidableEq ι] [DecidableEq κ] + [DecidableEq A] [DecidableEq B] [DecidableEq C] + [DecidableEq A'] [DecidableEq B'] [DecidableEq C'] {R : ℕ} + (h : RankAtMost (directSum (fun _ : ι => matrixCoefficients (K := K) A B C)) R) + (e : κ → ι) (he : Function.Injective e) + (f : A' → A) (hf : Function.Injective f) + (g : B' → B) (hg : Function.Injective g) + (j : C' → C) (hj : Function.Injective j) : + RankAtMost (directSum (fun _ : κ => matrixCoefficients (K := K) A' B' C')) R := by + have hp := h.pullback + (fun x : κ × (A' × B') => (e x.1, (f x.2.1, g x.2.2))) + (fun y : κ × (B' × C') => (e y.1, (g y.2.1, j y.2.2))) + (fun z : κ × (C' × A') => (e z.1, (j z.2.1, f z.2.2))) + convert hp using 1 + funext x y z + simp only [pullback, directSum, matrixCoefficients, + he.eq_iff, hf.eq_iff, hg.eq_iff, hj.eq_iff] + +theorem rectangular_directSum_power_rank {K : Type*} [CommSemiring K] + {a b c L R t : ℕ} + (h : RankAtMost (power (directSum (fun _ : Fin L => + matrixCoefficients (K := K) (Fin a) (Fin b) (Fin c))) t) R) : + RankAtMost (directSum (fun _ : Fin (L ^ t) => + matrixCoefficients (K := K) (Fin (a ^ t)) (Fin (b ^ t)) (Fin (c ^ t)))) R := by + have hmatrix := matrixCoefficients_directSum_rank_of_power h + let tags : Fin (L ^ t) ≃ (Fin t → Fin L) := Fintype.equivOfCardEq (by simp) + let rows : Fin (a ^ t) ≃ (Fin t → Fin a) := Fintype.equivOfCardEq (by simp) + let inner : Fin (b ^ t) ≃ (Fin t → Fin b) := Fintype.equivOfCardEq (by simp) + let cols : Fin (c ^ t) ≃ (Fin t → Fin c) := Fintype.equivOfCardEq (by simp) + exact rectangular_directSum_rank_of_injective hmatrix tags tags.injective + rows rows.injective inner inner.injective cols cols.injective + +theorem rectangular_pow_batchRank {K : Type*} [CommSemiring K] + {a b c L r : ℕ} (hL : 0 < L) + (hbatch : RankAtMost (directSum (fun _ : Fin L => + matrixCoefficients (K := K) (Fin a) (Fin b) (Fin c))) r) : + ∀ t : ℕ, RankAtMost + (matrixCoefficients (K := K) (Fin (a ^ t)) (Fin (b ^ t)) (Fin (c ^ t))) + (batchRank L r t) := by + intro t + induction t with + | zero => + simp only [batchRank_zero] + exact matrixCoefficients_fin_one_rank + | succ t ih => + let rows : Fin (a ^ (t + 1)) ≃ Fin (a ^ t) × Fin a := + Fintype.equivOfCardEq (by simp [pow_succ]) + let inner : Fin (b ^ (t + 1)) ≃ Fin (b ^ t) × Fin b := + Fintype.equivOfCardEq (by simp [pow_succ]) + let cols : Fin (c ^ (t + 1)) ≃ Fin (c ^ t) × Fin c := + Fintype.equivOfCardEq (by simp [pow_succ]) + have hp := matrixCoefficients_rank_of_product (ih.batch_product_ceiling hbatch hL) + have hr := rectangular_rank_of_injective hp + rows rows.injective inner inner.injective cols cols.injective + simpa only [batchRank_succ] using hr + +theorem rectangular_polynomial_power_rank {K : Type*} [Field K] [CharZero K] + {a b c L r d D : ℕ} + (P : PolynomialApproximation (directSum (fun _ : Fin L => + matrixCoefficients (K := K) (Fin a) (Fin b) (Fin c))) r d D) (t : ℕ) : + RankAtMost (directSum (fun _ : Fin (L ^ t) => + matrixCoefficients (K := K) (Fin (a ^ t)) (Fin (b ^ t)) (Fin (c ^ t)))) + ((D * t + 1) * r ^ t) := + rectangular_directSum_power_rank (P.rank_power t) + +theorem rectangular_directSum_cyclic_rank + {K ι A B C : Type*} [CommSemiring K] + [DecidableEq ι] [DecidableEq A] [DecidableEq B] [DecidableEq C] {r : ℕ} + (h : RankAtMost (directSum (fun _ : ι => matrixCoefficients (K := K) A B C)) r) : + RankAtMost (directSum (fun _ : ι => matrixCoefficients (K := K) B C A)) r := by + rcases h with ⟨a, b, c, heq⟩ + refine ⟨b, c, a, ?_⟩ + funext x y z + have hcyc : directSum (fun _ : ι => matrixCoefficients (K := K) B C A) x y z = + directSum (fun _ : ι => matrixCoefficients (K := K) A B C) z x y := by + have htags : (x.1 = y.1 ∧ x.1 = z.1) ↔ (z.1 = x.1 ∧ z.1 = y.1) := by + constructor + · rintro ⟨hxy, hxz⟩ + exact ⟨hxz.symm, hxz.symm.trans hxy⟩ + · rintro ⟨hzx, hzy⟩ + exact ⟨hzx.symm.trans hzy, hzx.symm⟩ + simp only [directSum, htags] + split_ifs + · exact (matrixCoefficients_cyclic (K := K) x.2 y.2 z.2).symm + · rfl + rw [hcyc, congrFun (congrFun (congrFun heq z) x) y] + apply Finset.sum_congr rfl + intro i hi + simp only [rankOne] + ring + +theorem rectangular_directSum_rank_lower {K : Type*} [Field K] + {a b L r : ℕ} (ha : 0 < a) (hb : 0 < b) + (h : RankAtMost (directSum (fun _ : Fin L => + matrixCoefficients (K := K) (Fin a) (Fin b) (Fin a))) r) : + L * a ^ 2 ≤ r ∧ L * (a * b) ≤ r := by + let : Nonempty (Fin a) := ⟨⟨0, ha⟩⟩ + let : Nonempty (Fin b) := ⟨⟨0, hb⟩⟩ + constructor + · simpa only [Fintype.card_fin, pow_two] using + directSum_matrixCoefficients_rank_lower h + · simpa only [Fintype.card_fin] using + directSum_matrixCoefficients_rank_lower (rectangular_directSum_cyclic_rank h) + +end Tensor +end MatrixMultiplication + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section + +open scoped BigOperators + +namespace MatrixMultiplication.Foundation +namespace Tensor + +section ConstantRestriction + +variable {F X Y Z X' Y' Z' : Type*} [CommSemiring F] +variable [Fintype X] [Fintype Y] [Fintype Z] + +def restrictPolynomial (A : X' → X → F) (B : Y' → Y → F) + (C : Z' → Z → F) (P : Tensor (Polynomial F) X Y Z) : + Tensor (Polynomial F) X' Y' Z' := + restrict (fun x' x => Polynomial.C (A x' x)) + (fun y' y => Polynomial.C (B y' y)) + (fun z' z => Polynomial.C (C z' z)) P + +@[simp] theorem restrictPolynomial_coeff (A : X' → X → F) (B : Y' → Y → F) + (C : Z' → Z → F) (P : Tensor (Polynomial F) X Y Z) (k : ℕ) + (x' : X') (y' : Y') (z' : Z') : + (restrictPolynomial A B C P x' y' z').coeff k = + restrict A B C (fun x y z => (P x y z).coeff k) x' y' z' := by + simp only [restrictPolynomial, restrict, Polynomial.finsetSum_coeff, + mul_assoc, Polynomial.coeff_C_mul] + +theorem RankAtMost.restrictPolynomial {P : Tensor (Polynomial F) X Y Z} {r : ℕ} + (hP : RankAtMost P r) (A : X' → X → F) (B : Y' → Y → F) + (C : Z' → Z → F) : RankAtMost (restrictPolynomial A B C P) r := + hP.restrict (fun x' x => Polynomial.C (A x' x)) + (fun y' y => Polynomial.C (B y' y)) + (fun z' z => Polynomial.C (C z' z)) + +theorem restrictPolynomial_degree_le (A : X' → X → F) (B : Y' → Y → F) + (C : Z' → Z → F) (P : Tensor (Polynomial F) X Y Z) (D : ℕ) + (hdegree : ∀ x y z, (P x y z).degree ≤ D) + (x' : X') (y' : Y') (z' : Z') : + (restrictPolynomial A B C P x' y' z').degree ≤ D := by + apply (Polynomial.degree_le_iff_coeff_zero _ _).2 + intro k hk + rw [restrictPolynomial_coeff] + have hzero (x : X) (y : Y) (z : Z) : (P x y z).coeff k = 0 := + (Polynomial.degree_le_iff_coeff_zero _ _).1 (hdegree x y z) k hk + simp only [restrict, hzero, mul_zero, Finset.sum_const_zero] + +end ConstantRestriction + +namespace PolynomialApproximation + +variable {F X Y Z X' Y' Z' : Type*} [Field F] + +def ofRankAtMost (T : Tensor F X Y Z) (r : ℕ) (hT : RankAtMost T r) : + PolynomialApproximation T r 0 0 where + polynomial := fun x y z => Polynomial.C (T x y z) + rank_bound := hT.map Polynomial.C + vanishes := by + intro x y z k hk + exact (Nat.not_lt_zero k hk).elim + leading := by + intro x y z + exact Polynomial.coeff_C_zero + degree_bound := by + intro x y z + simpa only [Nat.cast_zero] using (Polynomial.degree_C_le (a := T x y z)) + +@[simp] theorem ofRankAtMost_polynomial (T : Tensor F X Y Z) (r : ℕ) + (hT : RankAtMost T r) : + (ofRankAtMost T r hT).polynomial = (fun x y z => Polynomial.C (T x y z)) := rfl + +variable [Fintype X] [Fintype Y] [Fintype Z] +variable {T : Tensor F X Y Z} {r d D : ℕ} + +def restrict (W : PolynomialApproximation T r d D) + (A : X' → X → F) (B : Y' → Y → F) (C : Z' → Z → F) : + PolynomialApproximation (Tensor.restrict A B C T) r d D where + polynomial := restrictPolynomial A B C W.polynomial + rank_bound := W.rank_bound.restrictPolynomial A B C + vanishes := by + intro x' y' z' k hk + rw [restrictPolynomial_coeff] + have hzero (x : X) (y : Y) (z : Z) : (W.polynomial x y z).coeff k = 0 := + W.vanishes x y z k hk + simp only [Tensor.restrict, hzero, mul_zero, Finset.sum_const_zero] + leading := by + intro x' y' z' + rw [restrictPolynomial_coeff] + simp only [W.leading] + degree_bound := restrictPolynomial_degree_le A B C W.polynomial D W.degree_bound + +@[simp] theorem restrict_polynomial (W : PolynomialApproximation T r d D) + (A : X' → X → F) (B : Y' → Y → F) (C : Z' → Z → F) : + (W.restrict A B C).polynomial = restrictPolynomial A B C W.polynomial := rfl + +end PolynomialApproximation + +end Tensor +end MatrixMultiplication.Foundation + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section + +namespace MatrixMultiplication.Foundation + +namespace Tensor + +private def rectangularTagEquiv (L : ℕ) : + Fin (L ^ 3) ≃ (Fin L × Fin L) × Fin L := + Fintype.equivOfCardEq (by simp [pow_succ]) + +private def rectangularIndexEquiv (a b c : ℕ) : + Fin (a * b * c) ≃ Fin a × Fin b × Fin c := + Fintype.equivOfCardEq (by simp [mul_assoc]) + +theorem matrixMultiplication_directSum_symmetrized_rank {a b c L r : ℕ} + (h : RankAtMost (directSum (fun _ : Fin L => matrixMultiplication a b c)) r) : + RankAtMost (directSum (fun _ : Fin (L ^ 3) => + matrixMultiplication (a * b * c) (a * b * c) (a * b * c))) (r ^ 3) := by + have hs := matrixCoefficients_directSum_symmetrized_rank h + exact matrixCoefficients_directSum_rank_of_injective hs + (rectangularTagEquiv L) (rectangularTagEquiv L).injective + (rectangularIndexEquiv a b c) (rectangularIndexEquiv a b c).injective + +private def rectangularPullback + {FieldType SourceX SourceY SourceZ TargetX TargetY TargetZ : Type*} [Field FieldType] + {tensor : Tensor FieldType SourceX SourceY SourceZ} {rank shift degree : ℕ} + (witness : PolynomialApproximation tensor rank shift degree) + (mapX : TargetX → SourceX) (mapY : TargetY → SourceY) (mapZ : TargetZ → SourceZ) : + PolynomialApproximation (pullback mapX mapY mapZ tensor) rank shift degree where + polynomial := pullback mapX mapY mapZ witness.polynomial + rank_bound := witness.rank_bound.pullback mapX mapY mapZ + vanishes := fun coordX coordY coordZ coeff bound => + witness.vanishes (mapX coordX) (mapY coordY) (mapZ coordZ) coeff bound + leading := fun coordX coordY coordZ => + witness.leading (mapX coordX) (mapY coordY) (mapZ coordZ) + degree_bound := fun coordX coordY coordZ => + witness.degree_bound (mapX coordX) (mapY coordY) (mapZ coordZ) + +private def rectangularProduct + {FieldType LeftX LeftY LeftZ RightX RightY RightZ : Type*} [Field FieldType] + {leftTensor : Tensor FieldType LeftX LeftY LeftZ} + {rightTensor : Tensor FieldType RightX RightY RightZ} + {leftRank rightRank leftShift rightShift leftDegree rightDegree : ℕ} + (left : PolynomialApproximation leftTensor leftRank leftShift leftDegree) + (right : PolynomialApproximation rightTensor rightRank rightShift rightDegree) : + PolynomialApproximation (product leftTensor rightTensor) (leftRank * rightRank) + (leftShift + rightShift) (leftDegree + rightDegree) := by + have factorization (coordX : LeftX × RightX) (coordY : LeftY × RightY) + (coordZ : LeftZ × RightZ) : + product left.polynomial right.polynomial coordX coordY coordZ = + Polynomial.X ^ (leftShift + rightShift) * + product left.normalized right.normalized coordX coordY coordZ := by + dsimp only [product] + rw [left.polynomial_eq, right.polynomial_eq, pow_add] + ring + exact { + polynomial := product left.polynomial right.polynomial + rank_bound := left.rank_bound.product right.rank_bound + vanishes := by + intro coordX coordY coordZ coeff bound + rw [factorization] + simp only [Polynomial.coeff_X_pow_mul', Nat.not_le_of_lt bound, ite_false] + leading := by + intro coordX coordY coordZ + rw [factorization] + simp only [Polynomial.coeff_X_pow_mul', le_refl, ite_true, Nat.sub_self, + product, Polynomial.mul_coeff_zero, left.normalized_constant, right.normalized_constant] + degree_bound := by + intro coordX coordY coordZ + apply Polynomial.degree_le_of_natDegree_le + exact Polynomial.natDegree_mul_le_of_le + (Polynomial.natDegree_le_of_degree_le (left.degree_bound coordX.1 coordY.1 coordZ.1)) + (Polynomial.natDegree_le_of_degree_le (right.degree_bound coordX.2 coordY.2 coordZ.2)) } + +private def rectangularCyclic + {FieldType CoordX CoordY CoordZ : Type*} [Field FieldType] + {tensor : Tensor FieldType CoordX CoordY CoordZ} {rank shift degree : ℕ} + (witness : PolynomialApproximation tensor rank shift degree) : + PolynomialApproximation (cyclic tensor) rank shift degree where + polynomial := cyclic witness.polynomial + rank_bound := witness.rank_bound.cyclic + vanishes := fun coordY coordZ coordX coeff bound => + witness.vanishes coordX coordY coordZ coeff bound + leading := fun coordY coordZ coordX => witness.leading coordX coordY coordZ + degree_bound := fun coordY coordZ coordX => witness.degree_bound coordX coordY coordZ + +def PolynomialApproximation.matrixCoefficients_directSum_of_injective + {F ι κ A B : Type*} [Field F] + [DecidableEq ι] [DecidableEq κ] [DecidableEq A] [DecidableEq B] {r d D : ℕ} + (P : PolynomialApproximation + (directSum (fun _ : ι => matrixCoefficients (K := F) A A A)) r d D) + (f : κ → ι) (hf : Function.Injective f) (g : B → A) (hg : Function.Injective g) : + PolynomialApproximation + (directSum (fun _ : κ => matrixCoefficients (K := F) B B B)) r d D := by + let coord : κ × (B × B) → ι × (A × A) := + fun x => (f x.1, (g x.2.1, g x.2.2)) + have heq : Tensor.pullback coord coord coord + (directSum (fun _ : ι => matrixCoefficients (K := F) A A A)) = + directSum (fun _ : κ => matrixCoefficients (K := F) B B B) := by + funext x y z + simp only [Tensor.pullback, coord, directSum, matrixCoefficients, hf.eq_iff, hg.eq_iff] + rw [← heq] + exact rectangularPullback P coord coord coord + +def PolynomialApproximation.matrixMultiplication_directSum_symmetrized + {a b c L r d D : ℕ} + (P : PolynomialApproximation + (directSum (fun _ : Fin L => matrixMultiplication a b c)) r d D) : + PolynomialApproximation (directSum (fun _ : Fin (L ^ 3) => + matrixMultiplication (a * b * c) (a * b * c) (a * b * c))) + (r ^ 3) (3 * d) (3 * D) := by + have combine {LeftTag RightTag LeftX LeftY LeftZ RightX RightY RightZ : Type} + [DecidableEq LeftTag] [DecidableEq RightTag] + {leftTensor : LeftTag → Tensor ℂ LeftX LeftY LeftZ} + {rightTensor : RightTag → Tensor ℂ RightX RightY RightZ} + {leftRank rightRank leftShift rightShift leftDegree rightDegree : ℕ} + (left : PolynomialApproximation (directSum leftTensor) leftRank leftShift leftDegree) + (right : PolynomialApproximation (directSum rightTensor) rightRank rightShift rightDegree) : + PolynomialApproximation + (directSum (fun tag : LeftTag × RightTag => product (leftTensor tag.1) (rightTensor tag.2))) + (leftRank * rightRank) (leftShift + rightShift) (leftDegree + rightDegree) := by + have combined := rectangularPullback (rectangularProduct left right) + (directSumProductEquiv LeftTag RightTag LeftX RightX) + (directSumProductEquiv LeftTag RightTag LeftY RightY) + (directSumProductEquiv LeftTag RightTag LeftZ RightZ) + simpa only [directSum_product] using combined + have base : PolynomialApproximation + (directSum (fun _ : Fin L => matrixCoefficients (K := ℂ) (Fin a) (Fin b) (Fin c))) + r d D := P + have rotated : PolynomialApproximation + (directSum (fun _ : Fin L => matrixCoefficients (K := ℂ) (Fin b) (Fin c) (Fin a))) + r d D := by + simpa only [cyclic_directSum, cyclic_matrixCoefficients] using rectangularCyclic base + have twiceRotated : PolynomialApproximation + (directSum (fun _ : Fin L => matrixCoefficients (K := ℂ) (Fin c) (Fin a) (Fin b))) + r d D := by + simpa only [cyclic_directSum, cyclic_matrixCoefficients] using rectangularCyclic rotated + let squareIndex := Fin a × Fin b × Fin c + let tagIndex := (Fin L × Fin L) × Fin L + have symmetrized := rectangularPullback (combine (combine base rotated) twiceRotated) + (fun coord : tagIndex × (squareIndex × squareIndex) => + (coord.1, rectangularSquareX (Fin a) (Fin b) (Fin c) coord.2)) + (fun coord : tagIndex × (squareIndex × squareIndex) => + (coord.1, rectangularSquareY (Fin a) (Fin b) (Fin c) coord.2)) + (fun coord : tagIndex × (squareIndex × squareIndex) => + (coord.1, rectangularSquareZ (Fin a) (Fin b) (Fin c) coord.2)) + have shift_eq : d + d + d = 3 * d := by ring + have degree_eq : D + D + D = 3 * D := by ring + have squared : PolynomialApproximation + (directSum (fun _ : tagIndex => matrixCoefficients (K := ℂ) squareIndex squareIndex squareIndex)) + (r ^ 3) (3 * d) (3 * D) := by + simp only [directSum_pullback] at symmetrized + simp_rw [matrixCoefficients_cyclic_product_square + (K := ℂ) (A := Fin a) (B := Fin b) (C := Fin c)] at symmetrized + simpa only [pow_succ, pow_zero, one_mul, shift_eq, degree_eq] using symmetrized + exact squared.matrixCoefficients_directSum_of_injective + (rectangularTagEquiv L) (rectangularTagEquiv L).injective + (rectangularIndexEquiv a b c) (rectangularIndexEquiv a b c).injective + +end Tensor + +theorem mul_rpow_third_le_of_cube {u v w r : ℝ} (hv : 0 ≤ v) (hr : 0 ≤ r) + (h : u ^ 3 * v ^ w ≤ r ^ 3) : u * v ^ (w / 3) ≤ r := by + have hpow : (v ^ (w / 3)) ^ (3 : ℕ) = v ^ w := by + rw [← Real.rpow_mul_natCast hv] + congr 1 + norm_num + apply le_of_pow_le_pow_left₀ (by decide : (3 : ℕ) ≠ 0) hr + simpa only [mul_pow, hpow] using h + +namespace Arithmetic + +theorem equalRectangular_inequality {a b c L r : ℕ} + (ha : 1 ≤ a) (hb : 1 ≤ b) (hc : 1 ≤ c) + (h : Tensor.RankAtMost + (Tensor.directSum (fun _ : Fin L => Tensor.matrixMultiplication a b c)) r) : + (L : ℝ) * ((a * b * c : ℕ) : ℝ) ^ (omega / 3) ≤ (r : ℝ) := by + have hv : 1 ≤ a * b * c := Nat.mul_pos (Nat.mul_pos ha hb) hc + have hs := equalSummand_inequality hv + (Tensor.matrixMultiplication_directSum_symmetrized_rank h) + apply mul_rpow_third_le_of_cube (Nat.cast_nonneg (a * b * c)) (Nat.cast_nonneg r) + simpa only [Nat.cast_pow] using hs + +theorem equalRectangular_inequality_of_polynomialApproximation + {a b c L r d D : ℕ} (ha : 1 ≤ a) (hb : 1 ≤ b) (hc : 1 ≤ c) + (P : Tensor.PolynomialApproximation + (Tensor.directSum (fun _ : Fin L => Tensor.matrixMultiplication a b c)) r d D) : + (L : ℝ) * ((a * b * c : ℕ) : ℝ) ^ (omega / 3) ≤ (r : ℝ) := by + have hv : 1 ≤ a * b * c := Nat.mul_pos (Nat.mul_pos ha hb) hc + have hs := equalSummand_inequality_of_polynomialApproximation hv + P.matrixMultiplication_directSum_symmetrized + apply mul_rpow_third_le_of_cube (Nat.cast_nonneg (a * b * c)) (Nat.cast_nonneg r) + simpa only [Nat.cast_pow] using hs + +end Arithmetic + +end MatrixMultiplication.Foundation + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/Construction/ComplexSharedAuxiliaryBank.lean b/lean/OAI/LinearAlgebra/MatrixFields/Construction/ComplexSharedAuxiliaryBank.lean new file mode 100644 index 0000000000000000000000000000000000000000..5c8f4063f0057c1f3a465beb46bf89bb615d36a4 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/Construction/ComplexSharedAuxiliaryBank.lean @@ -0,0 +1,77 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Tensors.ComplexDotPairing + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +open scoped BigOperators + +namespace MatrixMultiplication.Foundation.LabelHierarchySeparation + +variable {K I : Type*} [CommSemiring K] [Fintype I] +variable {X Y Z : I → Type*} + +def bankTensor (T : ∀ i, Tensor K (X i) (Y i) (Z i)) : + Tensor K (∀ i, X i) (∀ i, Y i) (∀ i, Z i) := + fun x y z => ∏ i, T i (x i) (y i) (z i) + +theorem bankTensor_rankAtMost (T : ∀ i, Tensor K (X i) (Y i) (Z i)) + (r : I → ℕ) (h : ∀ i, Tensor.RankAtMost (T i) (r i)) : + Tensor.RankAtMost (bankTensor T) (∏ i, r i) := by + classical + choose a b c hc using h + let aa : (∀ i, Fin (r i)) → (∀ i, X i) → K := + fun f x => ∏ i, a i (f i) (x i) + let bb : (∀ i, Fin (r i)) → (∀ i, Y i) → K := + fun f y => ∏ i, b i (f i) (y i) + let cc : (∀ i, Fin (r i)) → (∀ i, Z i) → K := + fun f z => ∏ i, c i (f i) (z i) + have heq : bankTensor T = + fun x y z => ∑ f, Tensor.rankOne (aa f) (bb f) (cc f) x y z := by + funext x y z + simp only [bankTensor, hc, Fintype.prod_sum] + apply Finset.sum_congr rfl + intro f hf + simp only [Tensor.rankOne, aa, bb, cc, Finset.prod_mul_distrib] + rw [heq] + simpa only [Fintype.card_pi, Fintype.card_fin] using + Tensor.rankAtMost_sum_rankOne aa bb cc + +theorem bankTensor_reindex {J : Type*} [Fintype J] + {X' Y' Z' : J → Type*} (e : I ≃ J) + (ex : ∀ i, X i ≃ X' (e i)) (ey : ∀ i, Y i ≃ Y' (e i)) + (ez : ∀ i, Z i ≃ Z' (e i)) + (T : ∀ i, Tensor K (X i) (Y i) (Z i)) + (S : ∀ j, Tensor K (X' j) (Y' j) (Z' j)) + (compatible : ∀ i x y z, S (e i) (ex i x) (ey i y) (ez i z) = T i x y z) : + Tensor.pullback (e.piCongr ex) (e.piCongr ey) (e.piCongr ez) + (bankTensor S) = bankTensor T := by + funext x y z + change (∏ j, S j ((e.piCongr ex) x j) ((e.piCongr ey) y j) + ((e.piCongr ez) z j)) = ∏ i, T i (x i) (y i) (z i) + rw [← e.prod_comp (fun j => S j ((e.piCongr ex) x j) + ((e.piCongr ey) y j) ((e.piCongr ez) z j))] + apply Finset.prod_congr rfl + intro i hi + simpa only [Equiv.piCongr_apply_apply] using compatible i (x i) (y i) (z i) + +theorem bankTensor_reindex_rankAtMost {J : Type*} [Fintype J] + {X' Y' Z' : J → Type*} (e : I ≃ J) + (ex : ∀ i, X i ≃ X' (e i)) (ey : ∀ i, Y i ≃ Y' (e i)) + (ez : ∀ i, Z i ≃ Z' (e i)) + (T : ∀ i, Tensor K (X i) (Y i) (Z i)) + (S : ∀ j, Tensor K (X' j) (Y' j) (Z' j)) + (compatible : ∀ i x y z, S (e i) (ex i x) (ey i y) (ez i z) = T i x y z) + {r : ℕ} (hS : Tensor.RankAtMost (bankTensor S) r) : + Tensor.RankAtMost (bankTensor T) r := by + rw [← bankTensor_reindex e ex ey ez T S compatible] + exact hS.pullback _ _ _ + +end MatrixMultiplication.Foundation.LabelHierarchySeparation + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/Construction/ExactStatisticWords.lean b/lean/OAI/LinearAlgebra/MatrixFields/Construction/ExactStatisticWords.lean new file mode 100644 index 0000000000000000000000000000000000000000..b89a7f96785b4aa21f756e4aad07b1d6192d4b8c --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/Construction/ExactStatisticWords.lean @@ -0,0 +1,327 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Histories.InheritedMaskMargins +import OAI.LinearAlgebra.MatrixFields.Tensors.TerminalRelabel + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +namespace MatrixMultiplication.LeafVolumes + +open MatrixMultiplication.Foundation +open scoped BigOperators + +variable {F U : Type*} [CommSemiring F] [DecidableEq U] + +def zeroXMatching : Tensor F Unit U U := fun _ y z => if y = z then 1 else 0 +def zeroYMatching : Tensor F U Unit U := fun x _ z => if x = z then 1 else 0 +def zeroZMatching : Tensor F U U Unit := fun x y _ => if x = y then 1 else 0 + +theorem zeroXMatching_matrixCoefficients : + Tensor.pullback (fun _ : Unit × Unit => ()) + (fun y : Unit × U => y.2) (fun z : U × Unit => z.1) + (zeroXMatching (F := F) (U := U)) = + Tensor.matrixCoefficients Unit Unit U := by + funext x y z + simp [Tensor.pullback, zeroXMatching, Tensor.matrixCoefficients] + +theorem zeroYMatching_matrixCoefficients : + Tensor.pullback (fun x : U × Unit => x.1) + (fun _ : Unit × Unit => ()) (fun z : Unit × U => z.2) + (zeroYMatching (F := F) (U := U)) = + Tensor.matrixCoefficients U Unit Unit := by + funext x y z + simp [Tensor.pullback, zeroYMatching, Tensor.matrixCoefficients, eq_comm] + +theorem zeroZMatching_matrixCoefficients : + Tensor.pullback (fun x : Unit × U => x.2) + (fun y : U × Unit => y.1) (fun _ : Unit × Unit => ()) + (zeroZMatching (F := F) (U := U)) = + Tensor.matrixCoefficients Unit U Unit := by + funext x y z + simp [Tensor.pullback, zeroZMatching, Tensor.matrixCoefficients] + +def complementaryMatching {V : Type*} [DecidableEq V] (e : U ≃ V) : + Tensor F Unit U V := fun _ y z => if e y = z then 1 else 0 + +theorem complementaryMatching_pullback {V : Type*} [DecidableEq V] (e : U ≃ V) : + Tensor.pullback id id e (complementaryMatching (F := F) e) = + zeroXMatching (F := F) (U := U) := by + funext x y z + simp [Tensor.pullback, complementaryMatching, zeroXMatching] + +theorem zeroXMatching_subtype (p : U → Prop) [DecidablePred p] : + Tensor.pullback id (Subtype.val : {u // p u} → U) Subtype.val + (zeroXMatching (F := F) (U := U)) = + zeroXMatching (F := F) (U := {u // p u}) := by + funext x y z + simp [Tensor.pullback, zeroXMatching, Subtype.ext_iff] + +theorem matchingPower_leaf {X Y Z : Type*} [DecidableEq Y] + (T : Tensor F X Y Z) (x₀ : X) (e : Y ≃ Z) + (hmatch : ∀ y z, T x₀ y (e z) = if y = z then 1 else 0) + (n : ℕ) (p : (Fin n → Y) → Prop) [DecidablePred p] : + Tensor.pullback (fun _ : Unit => fun _ : Fin n => x₀) + (Subtype.val : {w // p w} → (Fin n → Y)) + (fun w : {w // p w} => fun i => e (w.val i)) (Tensor.power T n) = + zeroXMatching (F := F) (U := {w // p w}) := by + funext x y z + simp only [Tensor.pullback, Tensor.power, hmatch, zeroXMatching, + Fintype.prod_boole, ← funext_iff, Subtype.ext_iff] + +theorem matchingPower_matrixCoefficients {X Y Z : Type*} [DecidableEq Y] + (T : Tensor F X Y Z) (x₀ : X) (e : Y ≃ Z) + (hmatch : ∀ y z, T x₀ y (e z) = if y = z then 1 else 0) + (n : ℕ) (p : (Fin n → Y) → Prop) [DecidablePred p] : + Tensor.pullback (fun _ : Unit × Unit => fun _ : Fin n => x₀) + (fun y : Unit × {w // p w} => y.2.val) + (fun z : {w // p w} × Unit => fun i => e (z.1.val i)) + (Tensor.power T n) = + Tensor.matrixCoefficients Unit Unit {w // p w} := by + have h := matchingPower_leaf T x₀ e hmatch n p + have hp := congrArg (Tensor.pullback (fun _ : Unit × Unit => ()) + (fun y : Unit × {w // p w} => y.2) + (fun z : {w // p w} × Unit => z.1)) h + rw [zeroXMatching_matrixCoefficients] at hp + exact hp + +theorem rankAtMost_matchingPower_leaf {X Y Z : Type*} [DecidableEq Y] + (T : Tensor F X Y Z) (x₀ : X) (e : Y ≃ Z) + (hmatch : ∀ y z, T x₀ y (e z) = if y = z then 1 else 0) + (n : ℕ) (p : (Fin n → Y) → Prop) [DecidablePred p] + {r : ℕ} (hT : Tensor.RankAtMost (Tensor.power T n) r) : + Tensor.RankAtMost (Tensor.matrixCoefficients (K := F) Unit Unit {w // p w}) r := by + rw [← matchingPower_matrixCoefficients T x₀ e hmatch n p] + exact hT.pullback _ _ _ + +section ExactLabeledWords + +variable {A : Type*} [Fintype A] [DecidableEq A] + +abbrev LabeledExactWords (counts b : A → ℕ) := + Σ w : ExactWords counts, ∀ i : Fin (∑ a, counts a), Fin (b (w.val i)) + +theorem labelings_card {I : Type*} [Fintype I] [DecidableEq I] + (w : I → A) (b : A → ℕ) : + Fintype.card (∀ i, Fin (b (w i))) = + ∏ a, b a ^ wordPopulation w a := by + classical + simp only [Fintype.card_pi, Fintype.card_fin] + calc + (∏ i, b (w i)) = ∏ s : Σ a, {i // w i = a}, b s.1 := by + rw [← (Equiv.sigmaFiberEquiv w).prod_comp (fun i => b (w i))] + apply Finset.prod_congr rfl + intro s _ + exact congrArg b s.2.property + _ = ∏ a, b a ^ wordPopulation w a := by + simp [Fintype.prod_sigma, wordPopulation] + +theorem labeledExactWords_card (counts b : A → ℕ) : + Fintype.card (LabeledExactWords counts b) = + Nat.multinomial Finset.univ counts * ∏ a, b a ^ counts a := by + classical + rw [Fintype.card_sigma] + have hcard : ∀ w : ExactWords counts, + Fintype.card (∀ i : Fin (∑ a, counts a), Fin (b (w.val i))) = + ∏ a, b a ^ counts a := by + intro w + rw [labelings_card] + simp only [w.property] + simp only [hcard, Finset.sum_const, Finset.card_univ, smul_eq_mul, + exactWords_card] + +theorem labeledExactWords_card_pos (counts b : A → ℕ) + (hb : ∀ a, counts a ≠ 0 → 0 < b a) : + 0 < Fintype.card (LabeledExactWords counts b) := by + classical + rw [labeledExactWords_card] + apply Nat.mul_pos (Nat.multinomial_pos Finset.univ counts) + apply Finset.prod_pos + intro a _ + by_cases h : counts a = 0 + · simp [h] + · exact pow_pos (hb a h) _ + +end ExactLabeledWords + +structure Dimensions where + rows : ℕ + inner : ℕ + cols : ℕ + deriving DecidableEq + +def Dimensions.volume (d : Dimensions) : ℕ := d.rows * d.inner * d.cols + +def Dimensions.product (d e : Dimensions) : Dimensions := + ⟨d.rows * e.rows, d.inner * e.inner, d.cols * e.cols⟩ + +theorem Dimensions.volume_product (d e : Dimensions) : + (d.product e).volume = d.volume * e.volume := by + simp only [Dimensions.product, Dimensions.volume] + ring + +def historyDimensions {C : Type*} [Fintype C] (d : C → Dimensions) : Dimensions := + ⟨∏ c, (d c).rows, ∏ c, (d c).inner, ∏ c, (d c).cols⟩ + +theorem historyDimensions_volume {C : Type*} [Fintype C] (d : C → Dimensions) : + (historyDimensions d).volume = ∏ c, (d c).volume := by + simp [historyDimensions, Dimensions.volume, Finset.prod_mul_distrib] + +end MatrixMultiplication.LeafVolumes + + + + + +noncomputable section + +namespace MatrixMultiplication.ExactStatisticWords + +open MatrixMultiplication.Foundation +open scoped BigOperators + +variable {A U : Type*} [Fintype A] [DecidableEq A] [Fintype U] [DecidableEq U] + +abbrev Words (statistic : U → A) (counts : A → ℕ) := + {w : Fin (∑ a, counts a) → U // + ∀ a, wordPopulation (statistic ∘ w) a = counts a} + +def statisticWord (statistic : U → A) (counts : A → ℕ) + (w : Words statistic counts) : ExactWords counts := + ⟨statistic ∘ w.val, w.property⟩ + +omit [Fintype U] [DecidableEq U] in +theorem empiricalLaw_eq (statistic : U → A) (counts : A → ℕ) + (w : Words statistic counts) : + InheritedMasks.empiricalLaw (statistic ∘ w.val) = + fun a => (counts a : ℝ) / (∑ a, counts a : ℕ) := by + funext a + simp only [InheritedMasks.empiricalLaw, w.property, Fintype.card_fin] + +omit [Fintype U] [DecidableEq U] in +theorem typeWindow_of_counts (statistic : U → A) (counts : A → ℕ) + (w : Words statistic counts) (ν : A → ℝ) (η : ℝ) + (happrox : ∀ a, |(counts a : ℝ) / (∑ a, counts a : ℕ) - ν a| ≤ η) : + InheritedMasks.typeWindow ν η (statistic ∘ w.val) := by + intro a + rw [empiricalLaw_eq] + exact happrox a + +omit [Fintype U] [DecidableEq U] in +theorem sum_statistic_weight (statistic : U → A) (counts q : A → ℕ) + (w : Words statistic counts) : + (∑ i, q (statistic (w.val i))) = ∑ a, counts a * q a := by + let e := Equiv.sigmaFiberEquiv (statistic ∘ w.val) + calc + (∑ i, q (statistic (w.val i))) = + ∑ p : (Σ a, {i // (statistic ∘ w.val) i = a}), q p.1 := by + rw [← Equiv.sum_comp e (fun i => q (statistic (w.val i)))] + apply Finset.sum_congr rfl + intro p _ + exact congrArg q p.2.property + _ = ∑ a, counts a * q a := by + rw [Fintype.sum_sigma] + apply Finset.sum_congr rfl + intro a _ + simp only [Finset.sum_const, Finset.card_univ, smul_eq_mul] + change wordPopulation (statistic ∘ w.val) a * q a = counts a * q a + rw [w.property] + +def fiberEquiv (statistic : U → A) (counts : A → ℕ) (w : ExactWords counts) : + {v : Words statistic counts // statisticWord statistic counts v = w} ≃ + {v : Fin (∑ a, counts a) → U // ∀ i, statistic (v i) = w.val i} where + toFun v := ⟨v.val.val, fun i => congrFun (congrArg Subtype.val v.property) i⟩ + invFun v := by + have heq : statistic ∘ v.val = w.val := funext v.property + let v' : Words statistic counts := ⟨v.val, fun a => by + rw [heq] + exact w.property a⟩ + exact ⟨v', Subtype.ext heq⟩ + left_inv v := by + apply Subtype.ext + apply Subtype.ext + rfl + right_inv v := by + apply Subtype.ext + rfl + +omit [DecidableEq U] in +theorem card (statistic : U → A) (counts b : A → ℕ) + (hb : ∀ a, Fintype.card {u : U // statistic u = a} = b a) : + Fintype.card (Words statistic counts) = + Nat.multinomial Finset.univ counts * ∏ a, b a ^ counts a := by + classical + have hfiber (w : ExactWords counts) : + Fintype.card {v : Words statistic counts // statisticWord statistic counts v = w} = + ∏ a, b a ^ counts a := by + let e : {v : Fin (∑ a, counts a) → U // ∀ i, statistic (v i) = w.val i} ≃ + (∀ i : Fin (∑ a, counts a), {u : U // statistic u = w.val i}) := + { toFun := fun v i => ⟨v.val i, v.property i⟩ + invFun := fun v => ⟨fun i => (v i).val, fun i => (v i).property⟩ + left_inv := by intro v; rfl + right_inv := by intro v; rfl } + rw [Fintype.card_congr (fiberEquiv statistic counts w), + Fintype.card_congr e, Fintype.card_pi] + simp only [hb] + have h := LeafVolumes.labelings_card w.val b + simpa only [Fintype.card_pi, Fintype.card_fin, w.property] using h + calc + Fintype.card (Words statistic counts) = + Fintype.card (Σ w : ExactWords counts, + {v : Words statistic counts // statisticWord statistic counts v = w}) := + (Fintype.card_congr (Equiv.sigmaFiberEquiv (statisticWord statistic counts))).symm + _ = Nat.multinomial Finset.univ counts * ∏ a, b a ^ counts a := by + simp only [Fintype.card_sigma, hfiber, Finset.sum_const, Finset.card_univ, + smul_eq_mul, exactWords_card] + +omit [DecidableEq U] in +theorem card_of_supported (statistic : U → A) (counts b : A → ℕ) + (hb : ∀ a, 0 < counts a → Fintype.card {u : U // statistic u = a} = b a) : + Fintype.card (Words statistic counts) = + Nat.multinomial Finset.univ counts * ∏ a, b a ^ counts a := by + rw [card statistic counts (fun a => Fintype.card {u : U // statistic u = a}) + (fun _ => rfl)] + congr 1 + apply Finset.prod_congr rfl + intro a _ + by_cases ha : counts a = 0 + · simp [ha] + · rw [hb a (Nat.pos_of_ne_zero ha)] + +omit [Fintype A] [DecidableEq U] in +theorem card_fixedWeight_fiber (statistic : U → A) (weight : U → ℕ) + (statisticWeight : A → ℕ) (hweight : ∀ u, weight u = statisticWeight (statistic u)) + (a : ℕ) (s : A) (hs : statisticWeight s = a) : + Fintype.card {u : {u : U // weight u = a} // statistic u.val = s} = + Fintype.card {u : U // statistic u = s} := by + apply Fintype.card_congr + exact + { toFun := fun u => ⟨u.val.val, u.property⟩ + invFun := fun u => ⟨⟨u.val, by rw [hweight, u.property, hs]⟩, u.property⟩ + left_inv := by intro u; rfl + right_inv := by intro u; rfl } + +omit [DecidableEq U] in +theorem card_pos_of_supported (statistic : U → A) (counts b : A → ℕ) + (hb : ∀ a, 0 < counts a → Fintype.card {u : U // statistic u = a} = b a) + (hpos : ∀ a, 0 < counts a → 0 < b a) : + 0 < Fintype.card (Words statistic counts) := by + rw [card_of_supported statistic counts b hb] + apply Nat.mul_pos (Nat.multinomial_pos Finset.univ counts) + apply Finset.prod_pos + intro a _ + by_cases ha : counts a = 0 + · simp [ha] + · exact pow_pos (hpos a (Nat.pos_of_ne_zero ha)) _ + +end MatrixMultiplication.ExactStatisticWords + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/Construction/ExpressionFamily.lean b/lean/OAI/LinearAlgebra/MatrixFields/Construction/ExpressionFamily.lean new file mode 100644 index 0000000000000000000000000000000000000000..261524c14a6496d6ec04b87366abc53bbe23db48 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/Construction/ExpressionFamily.lean @@ -0,0 +1,74 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Arithmetic.ArithmeticPrograms + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +noncomputable section + +open scoped BigOperators + +namespace MatrixMultiplication.Arithmetic.Expression + +variable {F : Type*} [Field F] + +variable {Input Output : Type*} + +structure CompiledFamily [Fintype Output] (expressions : Output → Expression F Input) where + registers : ℕ + program : Program F Input registers + output : Output → Fin registers + correct : ∀ inputs i, program.eval inputs (output i) = (expressions i).eval inputs + cost_eq : program.cost = ∑ i, (expressions i).cost + +def compileFinFamily : (n : ℕ) → (expressions : Fin n → Expression F Input) → + CompiledFamily expressions + | 0, _ => + { registers := 0 + program := Program.nil + output := Fin.elim0 + correct := by + intro inputs i + exact Fin.elim0 i + cost_eq := by simp [Program.cost] } + | n + 1, expressions => + let p := compile (expressions 0) + let q := compileFinFamily n (fun i => expressions i.succ) + { registers := p.registers + q.registers + program := p.program.append q.program + output := Fin.cases (Program.oldIndex _ _ p.output) + (fun i => Program.newIndex _ _ (q.output i)) + correct := by + intro inputs i + refine Fin.cases ?_ (fun j => ?_) i + · exact (Program.eval_append_old p.program q.program inputs p.output).trans + (p.correct inputs) + · exact (Program.eval_append_new p.program q.program inputs (q.output j)).trans + (q.correct inputs j) + cost_eq := by + rw [Program.cost_append, p.cost_eq, q.cost_eq, Fin.sum_univ_succ] } + +def compileFamily [Fintype Output] (expressions : Output → Expression F Input) : + CompiledFamily expressions := + let e := Fintype.equivFin Output + let p := compileFinFamily (Fintype.card Output) (fun i => expressions (e.symm i)) + { registers := p.registers + program := p.program + output := fun i => p.output (e i) + correct := by + intro inputs i + simpa only [Equiv.symm_apply_apply] using p.correct inputs (e i) + cost_eq := by + rw [p.cost_eq] + exact e.symm.sum_comp (fun i => (expressions i).cost) } + +end MatrixMultiplication.Arithmetic.Expression + +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/Construction/FinalState.lean b/lean/OAI/LinearAlgebra/MatrixFields/Construction/FinalState.lean new file mode 100644 index 0000000000000000000000000000000000000000..85209345e62794c8df0b91163644f38835e06e92 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/Construction/FinalState.lean @@ -0,0 +1,203 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Construction.InitialState +import OAI.LinearAlgebra.MatrixFields.Entropy.InitialLeafRates +import OAI.LinearAlgebra.MatrixFields.Entropy.TerminalStatisticLaws + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +noncomputable section + +namespace MatrixMultiplication.AllFieldFinalState + +open MatrixMultiplication.Foundation AllFieldHistory AllFieldFiniteFamily +open AllFieldTerminalStatisticLaws +open scoped BigOperators Classical +attribute [local instance] Classical.propDecidable Classical.decEq + +abbrev InitialIndex (K : ℕ) := AllFieldInitialLeafRates.PopulationHistory K +abbrev CIndex (K : ℕ) := AfterC K × Placement +abbrev Index (K : ℕ) := InitialIndex K ⊕ (TerminalZero K ⊕ CIndex K) + +def history {K : ℕ} : Index K → History K + | .inl h => (.initial h.1.val, h.2) + | .inr (.inl h) => AllFieldTerminalStatisticLaws.history h + | .inr (.inr h) => (.afterC h.1, h.2) + +theorem history_terminal {K : ℕ} (h : Index K) : terminal (history h).1 := by + rcases h with h | h | h + · exact h.1.property + · rcases h with h | h + · exact h.1.property + · exact h.1.property + · trivial + +theorem terminal_resident_final {K : ℕ} (h : CanonicalHistory K) (ht : terminal h) : + resident (K + 2) h := by + have hlot := (initialAncestor h).1.isLt + cases h with + | initial h => exact fun hp => False.elim (ht hp) + | afterA h => + refine ⟨?_, fun hp => False.elim (ht hp)⟩ + change h.1.val.1.val < K at hlot + omega + | afterB h => + refine ⟨?_, ht⟩ + change h.1.val.1.val.1.val < K at hlot + omega + | partC h => exact False.elim ht + | afterC h => + change h.1.1.val.1.val.1.val.1.val < K at hlot + change h.1.1.val.1.val.1.val.1.val + 3 ≤ K + 2 + omega + +def toState {K : ℕ} (h : Index K) : State K (K + 2) := + ⟨history h, terminal_resident_final _ (history_terminal h)⟩ + +def fromState {K : ℕ} (h : State K (K + 2)) : Index K := by + have ht := final_state_terminal h + rcases h with ⟨⟨h, phi⟩, hr⟩ + cases h with + | initial h => exact .inl (⟨h, ht⟩, phi) + | afterA h => exact .inr (.inl (.inl (⟨h, ht⟩, phi))) + | afterB h => exact .inr (.inl (.inr (⟨h, ht⟩, phi))) + | partC h => exact False.elim ht + | afterC h => exact .inr (.inr (h, phi)) + +def indexEquiv (K : ℕ) : Index K ≃ State K (K + 2) where + toFun := toState + invFun := fromState + left_inv h := by + rcases h with h | h | h + · rfl + · cases h <;> rfl + · rfl + right_inv h := by + have ht := final_state_terminal h + rcases h with ⟨⟨h, phi⟩, hr⟩ + cases h with + | initial h => rfl + | afterA h => rfl + | afterB h => rfl + | partC h => exact False.elim ht + | afterC h => rfl + +variable {K : ℕ} (allocation : Allocation) (dilation : ℕ) + +abbrev Words := ∀ h : Index K, HistoryWord allocation dilation (history h) +abbrev InitialWords := ∀ h : InitialIndex K, + HistoryWord allocation dilation (.initial h.1.val, h.2) +abbrev ZeroWords := ∀ h : TerminalZero K, + HistoryWord allocation dilation (AllFieldTerminalStatisticLaws.history h) +abbrev CWords := ∀ h : CIndex K, HistoryWord allocation dilation (.afterC h.1, h.2) +abbrev Parts := InitialWords (K := K) allocation dilation × + (ZeroWords (K := K) allocation dilation × CWords (K := K) allocation dilation) + +instance wordsFintype : Fintype (Words (K := K) allocation dilation) := + Fintype.ofFinite _ + +def grouped (F : Type*) [Field F] (ε : ℝ) : + Tensor F (Words (K := K) allocation dilation) (Words (K := K) allocation dilation) + (Words (K := K) allocation dilation) := + CommonDimensions.familyProduct (fun h : Index K => + historyTensor F allocation dilation ε (history h)) + +def stateWord (w : Words (K := K) allocation dilation) : + ∀ h : State K (K + 2), HistoryWord allocation dilation h.val := + Equiv.piCongrLeft (fun h : State K (K + 2) => HistoryWord allocation dilation h.val) + (indexEquiv K) w + +theorem grouped_coefficient (F : Type*) [Field F] (ε : ℝ) + (x y z : Words (K := K) allocation dilation) : + stateTensor F allocation dilation ε (K + 2) (stateWord allocation dilation x) + (stateWord allocation dilation y) (stateWord allocation dilation z) = + grouped allocation dilation F ε x y z := by + change (∏ h : State K (K + 2), historyTensor F allocation dilation ε h.val + (stateWord allocation dilation x h) (stateWord allocation dilation y h) + (stateWord allocation dilation z h)) = _ + rw [← (indexEquiv K).prod_comp] + unfold grouped CommonDimensions.familyProduct + apply Finset.prod_congr rfl + intro h _ + have hstate (w : Words (K := K) allocation dilation) : + stateWord allocation dilation w ((indexEquiv K) h) = w h := + Equiv.piCongrLeft_apply_apply + (fun state : State K (K + 2) => HistoryWord allocation dilation state.val) + (indexEquiv K) w h + rw [hstate, hstate, hstate] + rfl + +def groupedMap (F : Type*) [Field F] (ε : ℝ) : + LocalMap (stateTensor F (K := K) allocation dilation ε (K + 2)) + (grouped (K := K) allocation dilation F ε) := by + apply LocalMap.ofExists + refine ⟨_, _, _, (Tensor.pullback_eq_restrict + (stateWord (K := K) allocation dilation) (stateWord (K := K) allocation dilation) + (stateWord (K := K) allocation dilation) _).symm.trans ?_⟩ + funext x y z + exact grouped_coefficient allocation dilation F ε x y z + +def initialTensor (F : Type*) [Field F] (ε : ℝ) : + Tensor F (InitialWords (K := K) allocation dilation) (InitialWords (K := K) allocation dilation) + (InitialWords (K := K) allocation dilation) := + CommonDimensions.familyProduct (fun h : InitialIndex K => + historyTensor F allocation dilation ε (.initial h.1.val, h.2)) + +def zeroTensor (F : Type*) [Field F] (ε : ℝ) : + Tensor F (ZeroWords (K := K) allocation dilation) (ZeroWords (K := K) allocation dilation) + (ZeroWords (K := K) allocation dilation) := + CommonDimensions.familyProduct (fun h : TerminalZero K => + historyTensor F allocation dilation ε (AllFieldTerminalStatisticLaws.history h)) + +def cTensor (F : Type*) [Field F] (ε : ℝ) : + Tensor F (CWords (K := K) allocation dilation) (CWords (K := K) allocation dilation) + (CWords (K := K) allocation dilation) := + CommonDimensions.familyProduct (fun h : CIndex K => + historyTensor F allocation dilation ε (.afterC h.1, h.2)) + +def partsTensor (F : Type*) [Field F] (ε : ℝ) : + Tensor F (Parts (K := K) allocation dilation) (Parts (K := K) allocation dilation) + (Parts (K := K) allocation dilation) := + Tensor.product (initialTensor (K := K) allocation dilation F ε) + (Tensor.product (zeroTensor (K := K) allocation dilation F ε) + (cTensor (K := K) allocation dilation F ε)) + +def joinParts (w : Parts (K := K) allocation dilation) : Words (K := K) allocation dilation + | .inl h => w.1 h + | .inr (.inl h) => w.2.1 h + | .inr (.inr h) => w.2.2 h + +theorem parts_coefficient (F : Type*) [Field F] (ε : ℝ) + (x y z : Parts (K := K) allocation dilation) : + grouped allocation dilation F ε (joinParts allocation dilation x) + (joinParts allocation dilation y) (joinParts allocation dilation z) = + partsTensor allocation dilation F ε x y z := by + unfold grouped CommonDimensions.familyProduct + rw [Fintype.prod_sum_type, Fintype.prod_sum_type] + rfl + +def partsMap (F : Type*) [Field F] (ε : ℝ) : + LocalMap (grouped (K := K) allocation dilation F ε) + (partsTensor (K := K) allocation dilation F ε) := by + apply LocalMap.ofExists + refine ⟨_, _, _, (Tensor.pullback_eq_restrict + (joinParts (K := K) allocation dilation) (joinParts (K := K) allocation dilation) + (joinParts (K := K) allocation dilation) _).symm.trans ?_⟩ + funext x y z + exact parts_coefficient allocation dilation F ε x y z + +def map (F : Type*) [Field F] (ε : ℝ) : + LocalMap (stateTensor F (K := K) allocation dilation ε (K + 2)) + (partsTensor (K := K) allocation dilation F ε) := + (groupedMap allocation dilation F ε).comp (partsMap allocation dilation F ε) + +end MatrixMultiplication.AllFieldFinalState + +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/Construction/FiniteCover.lean b/lean/OAI/LinearAlgebra/MatrixFields/Construction/FiniteCover.lean new file mode 100644 index 0000000000000000000000000000000000000000..1fbb5a8528b1cf3858650a7327f42b838a0da0bb --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/Construction/FiniteCover.lean @@ -0,0 +1,81 @@ +import Mathlib + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +open scoped BigOperators + +namespace MatrixMultiplication.FiniteCover + +variable {Ω M G : Type*} + +theorem exists_avoiding [Fintype Ω] [DecidableEq Ω] [DecidableEq M] + (s : Finset M) (bad : M → Finset Ω) (t : ℕ) + (hbad : ∀ m ∈ s, (bad m).card ≤ t) + (hbudget : s.card * t < Fintype.card Ω) : + ∃ ω : Ω, ∀ m ∈ s, ω ∉ bad m := by + classical + have hcard : (s.biUnion bad).card ≤ s.card * t := by + calc + (s.biUnion bad).card ≤ ∑ m ∈ s, (bad m).card := Finset.card_biUnion_le + _ ≤ ∑ _m ∈ s, t := Finset.sum_le_sum fun m hm => hbad m hm + _ = s.card * t := by simp + by_contra hn + have hsub : (Finset.univ : Finset Ω) ⊆ s.biUnion bad := by + intro ω hω + by_contra hout + apply hn + refine ⟨ω, ?_⟩ + intro m hm hmem + exact hout (Finset.mem_biUnion.mpr ⟨m, hm, hmem⟩) + have := Finset.card_le_card hsub + simp only [Finset.card_univ] at this + exact (not_lt_of_ge (this.trans hcard)) hbudget + +def avoidingWords [Fintype G] [DecidableEq G] (bad : Finset G) (L : ℕ) : + Finset (Fin L → G) := Finset.univ.filter fun f => ∀ i, f i ∈ bad + +theorem card_avoidingWords [Fintype G] [DecidableEq G] (bad : Finset G) (L : ℕ) : + (avoidingWords bad L).card = bad.card ^ L := by + classical + let e : {f : Fin L → G // f ∈ avoidingWords bad L} ≃ (Fin L → {g // g ∈ bad}) := + { toFun := fun f i => ⟨f.1 i, (Finset.mem_filter.mp f.2).2 i⟩ + invFun := fun f => ⟨fun i => (f i).1, by simp [avoidingWords]⟩ + left_inv := by intro f; rfl + right_inv := by intro f; rfl } + calc + (avoidingWords bad L).card = Fintype.card {f : Fin L → G // f ∈ avoidingWords bad L} := by simp + _ = Fintype.card (Fin L → {g // g ∈ bad}) := Fintype.card_congr e + _ = bad.card ^ L := by simp + +theorem exists_cover [Fintype G] [DecidableEq G] [DecidableEq M] + (s : Finset M) (good : G → M → Prop) [∀ g, DecidablePred (good g)] + (t L : ℕ) + (hbad : ∀ m ∈ s, (Finset.univ.filter fun g => ¬good g m).card ≤ t) + (hbudget : s.card * t ^ L < Fintype.card G ^ L) : + ∃ f : Fin L → G, ∀ m ∈ s, ∃ i, good (f i) m := by + classical + let bad : M → Finset G := fun m => Finset.univ.filter fun g => ¬good g m + have hb : ∀ m ∈ s, (avoidingWords (bad m) L).card ≤ t ^ L := by + intro m hm + rw [card_avoidingWords] + exact Nat.pow_le_pow_left (hbad m hm) L + obtain ⟨f, hf⟩ := exists_avoiding s (fun m => avoidingWords (bad m) L) (t ^ L) hb + (by simpa using hbudget) + refine ⟨f, ?_⟩ + intro m hm + by_contra hn + apply hf m hm + simp only [avoidingWords, Finset.mem_filter, Finset.mem_univ, true_and] + intro i + simp only [bad, Finset.mem_filter, Finset.mem_univ, true_and] + exact fun hi => hn ⟨i, hi⟩ + +end MatrixMultiplication.FiniteCover + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/Construction/GroupAmbientDegree.lean b/lean/OAI/LinearAlgebra/MatrixFields/Construction/GroupAmbientDegree.lean new file mode 100644 index 0000000000000000000000000000000000000000..ae0656070dc39a8829cbcbb32f5148995c397fd3 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/Construction/GroupAmbientDegree.lean @@ -0,0 +1,534 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Parameters.GroupSelectionParameters + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +noncomputable section + +namespace MatrixMultiplication.AllFieldActiveGibbs + +open AllFieldParameters AllFieldHistory AllFieldActiveLaws MatrixMultiplication.Foundation +open scoped BigOperators +attribute [local instance] Classical.propDecidable Classical.decEq + +def splitCoordinateWeight (parents : List Shape) (data : List ℤ) + (s : Shape) (i : Fin 3) (k : ℕ) : ℝ := + (weight (assigned (splitKeys parents) data (s, i, min k (s i - k))) : ℝ) + +def splitPotential (parents : List Shape) (data : List ℤ) + (s : Shape) (i : Fin 3) (k : ℕ) : ℝ := + Real.log (splitCoordinateWeight parents data s i k) + +def splitNormalizer (parents : List Shape) (data : List ℤ) (s : Shape) : ℝ := + (((below s).map (splitWeight parents data s)).sum : ℚ) + +def splitLogNormalizer (parents : List Shape) (data : List ℤ) (s : Shape) : ℝ := + Real.log (splitNormalizer parents data s) + +theorem splitCoordinateWeight_pos (parents : List Shape) (data : List ℤ) + (hd : ∀ n ∈ data, |n| ≤ 160000) (s : Shape) (i : Fin 3) (k : ℕ) : + 0 < splitCoordinateWeight parents data s i k := by + apply Rat.cast_pos.mpr + exact weight_positive_of_argument_bound _ (assigned_argument_bound _ data hd _) + +theorem splitNormalizer_pos (parents : List Shape) (data : List ℤ) + (hd : ∀ n ∈ data, |n| ≤ 160000) (s : Shape) (hne : below s ≠ []) : + 0 < splitNormalizer parents data s := by + apply Rat.cast_pos.mpr + exact list_sum_map_positive _ _ hne (fun u _ => splitWeight_positive parents data hd s u) + +theorem splitWeight_log (parents : List Shape) (data : List ℤ) + (hd : ∀ n ∈ data, |n| ≤ 160000) (s u : Shape) : + Real.log (splitWeight parents data s u : ℝ) = + ∑ i : Fin 3, splitPotential parents data s i (u i) := by + have hweight (i : Fin 3) : (weight (splitSignature parents data s u i) : ℝ) ≠ 0 := + ne_of_gt (splitCoordinateWeight_pos parents data hd s i (u i)) + rw [splitWeight, Rat.cast_prod, Real.log_prod (fun index _ => hweight index)] + rfl + +theorem splitLaw_log (parents : List Shape) (data : List ℤ) + (hd : ∀ n ∈ data, |n| ≤ 160000) (s u : Shape) (hu : u ∈ below s) : + Real.log (splitLaw parents data s u : ℝ) = + (∑ i : Fin 3, splitPotential parents data s i (u i)) - + splitLogNormalizer parents data s := by + have hweight : (splitWeight parents data s u : ℝ) ≠ 0 := by + exact_mod_cast ne_of_gt (splitWeight_positive parents data hd s u) + have hne : below s ≠ [] := by + intro he + simp only [he, List.not_mem_nil] at hu + have hnormal := ne_of_gt (splitNormalizer_pos parents data hd s hne) + rw [splitLaw, ite_eq_left hu, Rat.cast_div] + change Real.log ((splitWeight parents data s u : ℝ) / splitNormalizer parents data s) = _ + rw [Real.log_div hweight hnormal, splitWeight_log parents data hd] + rfl + +theorem splitLaw_positive_iff (parents : List Shape) (data : List ℤ) + (hd : ∀ n ∈ data, |n| ≤ 160000) (s u : Shape) : + 0 < (splitLaw parents data s u : ℝ) ↔ u ∈ below s := by + constructor + · intro hp + by_contra hu + rw [splitLaw_outside_support parents data s u hu] at hp + norm_num at hp + · intro hu + exact_mod_cast splitLaw_positive parents data hd s u hu + +def physicalPotential (parents : List Shape) (data : List ℤ) (s : Shape) + (phi : Placement) (i : Fin 3) (k : Fin 17) : ℝ := + splitPotential parents data s (phi.symm i) k.val + +theorem splitLaw_log_physical (parents : List Shape) (data : List ℤ) + (hd : ∀ n ∈ data, |n| ≤ 160000) (s u : Shape) (hu : u ∈ below s) + (hb : ShapeBounded u) (phi : Placement) : + Real.log (splitLaw parents data s u : ℝ) = + physicalPotential parents data s phi 0 (JointPopulation.shapeSide 0 (encodePhysicalShape phi u hb)) + + physicalPotential parents data s phi 1 (JointPopulation.shapeSide 1 (encodePhysicalShape phi u hb)) + + physicalPotential parents data s phi 2 (JointPopulation.shapeSide 2 (encodePhysicalShape phi u hb)) - + splitLogNormalizer parents data s := by + rw [splitLaw_log parents data hd s u hu] + have hsum : (∑ i : Fin 3, splitPotential parents data s i (u i)) = + ∑ i : Fin 3, physicalPotential parents data s phi i + (JointPopulation.shapeSide i (encodePhysicalShape phi u hb)) := by + simp only [physicalPotential, encodePhysicalShape_side] + exact (phi.symm.sum_comp (fun i => splitPotential parents data s i (u i))).symm + rw [hsum, Fin.sum_univ_three] + +theorem placedLaw_positive_has_branch {K : ℕ} (w : PlacedWork K) + (u : JointPopulation.Shape) (hu : 0 < (placedLaw w).mass u) : + ∃ b : w.1.Branch, branchShape w b = u := by + by_contra hn + have hz : (placedLaw w).mass u = 0 := by + rw [placedLaw_mass] + apply Finset.sum_eq_zero + intro b _ + exact ite_eq_right (fun hb => hn ⟨b, hb⟩) + rw [hz] at hu + exact lt_irrefl 0 hu + +theorem placedLaw_stageA_branch_log {K : ℕ} (h : InitialPositive K) + (phi : Placement) (b : ASplit h) : + Real.log ((placedLaw (Work.stageA h, phi)).mass (branchShape (Work.stageA h, phi) b)) = + physicalPotential positiveInitial tableP (initialShape h.val) phi 0 + (JointPopulation.shapeSide 0 (branchShape (Work.stageA h, phi) b)) + + physicalPotential positiveInitial tableP (initialShape h.val) phi 1 + (JointPopulation.shapeSide 1 (branchShape (Work.stageA h, phi) b)) + + physicalPotential positiveInitial tableP (initialShape h.val) phi 2 + (JointPopulation.shapeSide 2 (branchShape (Work.stageA h, phi) b)) - + splitLogNormalizer positiveInitial tableP (initialShape h.val) := by + refine (congrArg Real.log (placedLaw_mass_branch (Work.stageA h, phi) b)).trans ?_ + exact splitLaw_log_physical positiveInitial tableP stageA_table_arguments_bounded + (initialShape h.val) (aSplit ⟨h, b, false⟩) (aSplit_mem ⟨h, b, false⟩) + ((Work.stageA h).splitShape_spec b).1 phi + +theorem placedLaw_stageB_branch_log {K : ℕ} (h : APositive K) + (phi : Placement) (b : BSplit h) : + Real.log ((placedLaw (Work.stageB h, phi)).mass (branchShape (Work.stageB h, phi) b)) = + physicalPotential positiveSecond tablep (aShape h.val) phi 0 + (JointPopulation.shapeSide 0 (branchShape (Work.stageB h, phi) b)) + + physicalPotential positiveSecond tablep (aShape h.val) phi 1 + (JointPopulation.shapeSide 1 (branchShape (Work.stageB h, phi) b)) + + physicalPotential positiveSecond tablep (aShape h.val) phi 2 + (JointPopulation.shapeSide 2 (branchShape (Work.stageB h, phi) b)) - + splitLogNormalizer positiveSecond tablep (aShape h.val) := by + refine (congrArg Real.log (placedLaw_mass_branch (Work.stageB h, phi) b)).trans ?_ + exact splitLaw_log_physical positiveSecond tablep stageB_table_arguments_bounded + (aShape h.val) (bSplit ⟨h, b, false⟩) (bSplit_mem ⟨h, b, false⟩) + ((Work.stageB h).splitShape_spec b).1 phi + +theorem placedLaw_stageA_log {K : ℕ} (h : InitialPositive K) (phi : Placement) + (u : JointPopulation.Shape) (hu : 0 < (placedLaw (Work.stageA h, phi)).mass u) : + Real.log ((placedLaw (Work.stageA h, phi)).mass u) = + physicalPotential positiveInitial tableP (initialShape h.val) phi 0 (JointPopulation.shapeSide 0 u) + + physicalPotential positiveInitial tableP (initialShape h.val) phi 1 (JointPopulation.shapeSide 1 u) + + physicalPotential positiveInitial tableP (initialShape h.val) phi 2 (JointPopulation.shapeSide 2 u) - + splitLogNormalizer positiveInitial tableP (initialShape h.val) := by + obtain ⟨b, rfl⟩ := placedLaw_positive_has_branch (Work.stageA h, phi) u hu + exact placedLaw_stageA_branch_log h phi b + +theorem placedLaw_stageB_log {K : ℕ} (h : APositive K) (phi : Placement) + (u : JointPopulation.Shape) (hu : 0 < (placedLaw (Work.stageB h, phi)).mass u) : + Real.log ((placedLaw (Work.stageB h, phi)).mass u) = + physicalPotential positiveSecond tablep (aShape h.val) phi 0 (JointPopulation.shapeSide 0 u) + + physicalPotential positiveSecond tablep (aShape h.val) phi 1 (JointPopulation.shapeSide 1 u) + + physicalPotential positiveSecond tablep (aShape h.val) phi 2 (JointPopulation.shapeSide 2 u) - + splitLogNormalizer positiveSecond tablep (aShape h.val) := by + obtain ⟨b, rfl⟩ := placedLaw_positive_has_branch (Work.stageB h, phi) u hu + exact placedLaw_stageB_branch_log h phi b + +theorem mem_shapes_of_total (u : Shape) (n : ℕ) + (h : shapeTotal u = n) : u ∈ shapes n := by + dsimp [shapeTotal] at h + simp only [shapes, List.mem_flatMap, List.mem_map, List.mem_range] + refine ⟨u 0, by omega, u 1, by omega, ?_⟩ + funext i + fin_cases i + · rfl + · rfl + · change n - u 0 - u 1 = u 2 + omega + +theorem mem_below_iff (s u : Shape) : + u ∈ below s ↔ shapeTotal u = shapeTotal s / 2 ∧ ∀ i, u i ≤ s i := by + constructor + · intro hu + exact ⟨below_total hu, below_le hu⟩ + · rintro ⟨ht, hle⟩ + apply List.mem_filter.mpr + refine ⟨mem_shapes_of_total u _ ht, ?_⟩ + simpa only [Bool.and_eq_true, decide_eq_true_eq, and_assoc] using + And.intro (hle 0) (And.intro (hle 1) (hle 2)) + +theorem splitShape_exhaustive {K : ℕ} (w : Work K) + (u : Shape) (hu : u ∈ below w.parentShape) : + ∃ b : w.Branch, w.splitShape b = u := by + cases w with + | stageA h => + change u ∈ below (initialShape h.val) at hu + obtain ⟨b, hb⟩ := List.mem_iff_get.mp hu + exact ⟨b, hb⟩ + | stageB h => + change u ∈ below (aShape h.val) at hu + obtain ⟨b, hb⟩ := List.mem_iff_get.mp hu + exact ⟨b, hb⟩ + | stageC h => + exact stageCAtom_exhaustive _ (bShape_size h.1.val) h.1.property u hu + +theorem branchShape_exhaustive {K : ℕ} (w : PlacedWork K) + (u : JointPopulation.Shape) + (ht : u.1.val + u.2.1.val + u.2.2.val = 2 * w.1.halfLength) + (hle : ∀ i, (JointPopulation.shapeSide i u).val ≤ + physicalShape w.2 w.1.parentShape i) : + ∃ b : w.1.Branch, branchShape w b = u := by + let v : Shape := physicalShape w.2.symm (decodeShape u) + have hvt : shapeTotal v = 2 * w.1.halfLength := by + dsimp [v] + rw [physicalShape_total] + exact ht + have hvl : ∀ i, v i ≤ w.1.parentShape i := by + intro i + simpa only [v, physicalShape, decodeShape, Equiv.symm_symm, + Equiv.symm_apply_apply] using hle (w.2 i) + have hv : v ∈ below w.1.parentShape := by + apply (mem_below_iff _ _).2 + refine ⟨?_, hvl⟩ + rw [hvt, (w.1.parentShape_spec).2] + omega + obtain ⟨b, hb⟩ := splitShape_exhaustive w.1 v hv + refine ⟨b, ?_⟩ + have hd : decodeShape (branchShape w b) = decodeShape u := by + rw [branchShape, decode_encodePhysicalShape, hb] + funext i + simp only [v, physicalShape, Equiv.symm_symm, Equiv.apply_symm_apply] + apply Prod.ext + · exact Fin.ext (congrFun hd 0) + · apply Prod.ext + · exact Fin.ext (congrFun hd 1) + · exact Fin.ext (congrFun hd 2) + +theorem placedLaw_stageA_positive {K : ℕ} (h : InitialPositive K) (phi : Placement) + (u : JointPopulation.Shape) (ht : u.1.val + u.2.1.val + u.2.2.val = 8) + (hle : ∀ i, (JointPopulation.shapeSide i u).val ≤ + physicalShape phi (initialShape h.val) i) : + 0 < (placedLaw (Work.stageA h, phi)).mass u := by + obtain ⟨b, rfl⟩ := branchShape_exhaustive (Work.stageA h, phi) u ht hle + rw [placedLaw_mass_branch] + exact_mod_cast stageALaw_positive (initialShape h.val) (aSplit ⟨h, b, false⟩) + (aSplit_mem ⟨h, b, false⟩) + +theorem placedLaw_stageB_positive {K : ℕ} (h : APositive K) (phi : Placement) + (u : JointPopulation.Shape) (ht : u.1.val + u.2.1.val + u.2.2.val = 4) + (hle : ∀ i, (JointPopulation.shapeSide i u).val ≤ + physicalShape phi (aShape h.val) i) : + 0 < (placedLaw (Work.stageB h, phi)).mass u := by + obtain ⟨b, rfl⟩ := branchShape_exhaustive (Work.stageB h, phi) u ht hle + rw [placedLaw_mass_branch] + exact_mod_cast stageBLaw_positive (aShape h.val) (bSplit ⟨h, b, false⟩) + (bSplit_mem ⟨h, b, false⟩) + +end MatrixMultiplication.AllFieldActiveGibbs + +namespace MatrixMultiplication.AllFieldStageCGibbs + +open AllFieldParameters AllFieldHistory AllFieldActiveLaws AllFieldActiveGibbs +open MatrixMultiplication.Foundation JointPopulation JointAmbientDegree +open scoped BigOperators +attribute [local instance] Classical.propDecidable Classical.decEq + +def distinguishedSide {K : ℕ} (h : PartC K) (phi : Placement) : Fin 3 := + phi (stageCDistinguished (cShapeParent h)) + +def coordinateMass {K : ℕ} (h : PartC K) (k : Fin 17) : ℝ := + if k.val = 1 then + (((1 - binaryParameter (cParameterParent h) (cShapeParent h)) / 2 : ℚ) : ℝ) + else ((binaryParameter (cParameterParent h) (cShapeParent h) / 2 : ℚ) : ℝ) + +def physicalPotential {K : ℕ} (h : PartC K) (phi : Placement) + (side : Fin 3) (k : Fin 17) : ℝ := + if side = distinguishedSide h phi then Real.log (coordinateMass h k) else 0 + +theorem distinguishedSide_branch {K : ℕ} (h : PartC K) (phi : Placement) + (b : Fin 4) : + (shapeSide (distinguishedSide h phi) (branchShape (Work.stageC h, phi) b)).val = + stageCAtom (cShapeParent h) b (stageCDistinguished (cShapeParent h)) := by + simp only [distinguishedSide, branchShape, encodePhysicalShape_side, + Equiv.symm_apply_apply, Work.splitShape, cSplit] + +theorem placedLaw_stageC_branch_mass {K : ℕ} (h : PartC K) (phi : Placement) + (b : Fin 4) : + (placedLaw (Work.stageC h, phi)).mass (branchShape (Work.stageC h, phi) b) = + coordinateMass h + (shapeSide (distinguishedSide h phi) (branchShape (Work.stageC h, phi) b)) := by + refine (placedLaw_mass_branch (Work.stageC h, phi) b).trans ?_ + change (stageCWeight (cParameterParent h) (cShapeParent h) b : ℝ) = _ + simp only [coordinateMass, distinguishedSide_branch] + unfold stageCWeight + have hm := stageCAtom_middle (cShapeParent h) (bShape_size h.1.val) h.1.property b + by_cases hb : b.val < 2 + · have hn : ¬stageCAtom (cShapeParent h) b (stageCDistinguished (cShapeParent h)) = 1 := + fun hmiddle => (hm.mp hmiddle) hb + simp only [hb, ite_true, hn, ite_false] + · have hx := hm.mpr hb + simp only [hb, ite_false, hx, ite_true] + +theorem placedLaw_stageC_mass_of_positive {K : ℕ} (h : PartC K) (phi : Placement) + (u : JointPopulation.Shape) (hu : 0 < (placedLaw (Work.stageC h, phi)).mass u) : + (placedLaw (Work.stageC h, phi)).mass u = + coordinateMass h (shapeSide (distinguishedSide h phi) u) := by + obtain ⟨b, rfl⟩ := placedLaw_positive_has_branch (Work.stageC h, phi) u hu + exact placedLaw_stageC_branch_mass h phi b + +theorem placedLaw_stageC_mass_on_feasible {K : ℕ} (h : PartC K) (phi : Placement) + (u : JointPopulation.Shape) (ht : u.1.val + u.2.1.val + u.2.2.val = 2) + (hle : ∀ s, (shapeSide s u).val ≤ physicalShape phi (cShapeParent h) s) : + (placedLaw (Work.stageC h, phi)).mass u = + coordinateMass h (shapeSide (distinguishedSide h phi) u) := by + obtain ⟨b, rfl⟩ := branchShape_exhaustive (Work.stageC h, phi) u ht hle + exact placedLaw_stageC_branch_mass h phi b + +theorem sum_physicalPotential {K : ℕ} (h : PartC K) (phi : Placement) + (u : JointPopulation.Shape) : + (∑ s : Fin 3, physicalPotential h phi s (shapeSide s u)) = + Real.log (coordinateMass h (shapeSide (distinguishedSide h phi) u)) := by + simp only [physicalPotential, Finset.sum_ite_eq', Finset.mem_univ, ite_true] + +theorem placedLaw_stageC_log {K : ℕ} (h : PartC K) (phi : Placement) + (u : JointPopulation.Shape) (hu : 0 < (placedLaw (Work.stageC h, phi)).mass u) : + Real.log ((placedLaw (Work.stageC h, phi)).mass u) = + physicalPotential h phi 0 (shapeSide 0 u) + + physicalPotential h phi 1 (shapeSide 1 u) + + physicalPotential h phi 2 (shapeSide 2 u) - 0 := by + rw [placedLaw_stageC_mass_of_positive h phi u hu, ← sum_physicalPotential h phi u, + Fin.sum_univ_three, sub_zero] + +theorem placedLaw_positive_parent_bounds {K : ℕ} (w : PlacedWork K) + (u : JointPopulation.Shape) (hu : 0 < (placedLaw w).mass u) : + ∀ s, (shapeSide s u).val ≤ physicalShape w.2 w.1.parentShape s := by + obtain ⟨b, rfl⟩ := placedLaw_positive_has_branch w u hu + intro s + rw [branchShape, encodePhysicalShape_side] + exact w.1.splitShape_le b (w.2.symm s) + +theorem jointCounts_positive_reference {K : ℕ} (allocation : Allocation) (dilation : ℕ) + (w : PlacedWork K) (u : JointPopulation.Shape) + (hu : 0 < jointCounts allocation dilation w u) : 0 < (placedLaw w).mass u := by + have hc : (0 : ℝ) < (jointCounts allocation dilation w u : ℝ) := by exact_mod_cast hu + rw [jointCounts_cast] at hc + rcases mul_pos_iff.mp hc with hpos | hneg + · exact hpos.2 + · exact False.elim (not_lt_of_ge (Nat.cast_nonneg _) hneg.1) + +theorem localAllowed_positive_reference {Hist : Type*} [Fintype Hist] [DecidableEq Hist] + (counts : Hist → JointPopulation.Shape → ℕ) (total : Hist → ℕ) + (hist : Hist) (word : Positions counts hist → JointPopulation.Shape) + (hw : localAllowed counts total hist word) + {K : ℕ} (h : PartC K) (phi : Placement) (htotal : total hist = 2) + (hcounts : ∀ u, 0 < counts hist u → 0 < (placedLaw (Work.stageC h, phi)).mass u) : + ∀ i, 0 < (placedLaw (Work.stageC h, phi)).mass (word i) := by + intro i + have hbounds := JointMarginalSupport.localAllowed_parent_bounds counts total hist word hw + (physicalShape phi (cShapeParent h)) + (fun u hu => placedLaw_positive_parent_bounds (Work.stageC h, phi) u (hcounts u hu)) + obtain ⟨j, hj⟩ := JointMarginalSupport.localAllowed_coordinate_witness + counts total hist word hw (distinguishedSide h phi) i + have hp : 0 < (placedLaw (Work.stageC h, phi)).mass ((canonicalTarget counts hist).val j) := + hcounts _ (symbol_count_pos counts (canonicalTarget counts) hist j) + have ht : (word i).1.val + (word i).2.1.val + (word i).2.2.val = 2 := + (hw.1 i).trans htotal + calc + 0 < (placedLaw (Work.stageC h, phi)).mass ((canonicalTarget counts hist).val j) := hp + _ = coordinateMass h + (shapeSide (distinguishedSide h phi) ((canonicalTarget counts hist).val j)) := + placedLaw_stageC_mass_of_positive h phi _ hp + _ = coordinateMass h (shapeSide (distinguishedSide h phi) (word i)) := congrArg _ hj + _ = (placedLaw (Work.stageC h, phi)).mass (word i) := + (placedLaw_stageC_mass_on_feasible h phi (word i) ht (hbounds i)).symm + +end MatrixMultiplication.AllFieldStageCGibbs + +namespace MatrixMultiplication.AllFieldGroupAmbientDegree + +open MatrixMultiplication.Foundation AllFieldParameters AllFieldHistory AllFieldActiveLaws +open AllFieldActiveCapacity AllFieldGroupTargetRate JointPopulation JointAmbientDegree +open JointAmbientEntropy JointGibbsApproximation Filter +open scoped BigOperators Topology +attribute [local instance] Classical.propDecidable Classical.decEq + +def potential {K : ℕ} (w : PlacedWork K) (s : Fin 3) (k : Fin 17) : ℝ := + match w.1 with + | .stageA h => AllFieldActiveGibbs.physicalPotential positiveInitial tableP + (initialShape h.val) w.2 s k + | .stageB h => AllFieldActiveGibbs.physicalPotential positiveSecond tablep + (aShape h.val) w.2 s k + | .stageC h => AllFieldStageCGibbs.physicalPotential h w.2 s k + +def logNormalizer {K : ℕ} (w : PlacedWork K) : ℝ := + match w.1 with + | .stageA h => AllFieldActiveGibbs.splitLogNormalizer positiveInitial tableP + (initialShape h.val) + | .stageB h => AllFieldActiveGibbs.splitLogNormalizer positiveSecond tablep + (aShape h.val) + | .stageC _ => 0 + +theorem placedLaw_log {K : ℕ} (w : PlacedWork K) (a : JointPopulation.Shape) + (ha : 0 < (placedLaw w).mass a) : + Real.log ((placedLaw w).mass a) = potential w 0 (shapeSide 0 a) + + potential w 1 (shapeSide 1 a) + potential w 2 (shapeSide 2 a) - + logNormalizer w := by + rcases w with ⟨w, phi⟩ + cases w with + | stageA h => exact AllFieldActiveGibbs.placedLaw_stageA_log h phi a ha + | stageB h => exact AllFieldActiveGibbs.placedLaw_stageB_log h phi a ha + | stageC h => exact AllFieldStageCGibbs.placedLaw_stageC_log h phi a ha + +theorem localAllowed_positive {H : Type*} [Fintype H] [DecidableEq H] + (counts : H → JointPopulation.Shape → ℕ) (total : H → ℕ) (h : H) + (word : Positions counts h → JointPopulation.Shape) + (hw : localAllowed counts total h word) {K : ℕ} (w : PlacedWork K) + (htotal : total h = 2 * w.1.halfLength) + (hcounts : ∀ a, 0 < counts h a → 0 < (placedLaw w).mass a) : + ∀ i, 0 < (placedLaw w).mass (word i) := by + have hb := fun a ha => + AllFieldStageCGibbs.placedLaw_positive_parent_bounds w a (hcounts a ha) + rcases w with ⟨w, phi⟩ + cases w with + | stageA a => + apply JointMarginalSupport.localAllowed_positive_reference counts total h word hw + (physicalShape phi (initialShape a.val)) _ hb + intro u hu hle + exact AllFieldActiveGibbs.placedLaw_stageA_positive a phi u + (hu.trans htotal) hle + | stageB a => + apply JointMarginalSupport.localAllowed_positive_reference counts total h word hw + (physicalShape phi (aShape a.val)) _ hb + intro u hu hle + exact AllFieldActiveGibbs.placedLaw_stageB_positive a phi u + (hu.trans htotal) hle + | stageC a => + exact AllFieldStageCGibbs.localAllowed_positive_reference counts total h word hw + a phi htotal hcounts + +variable {K tick : ℕ} {sigma : Placement} + +def orderTotal (h : ActiveOrder K tick sigma) : ℕ := 2 * h.val.val.1.halfLength + +theorem canonicalLaw_mass_eq (allocation : Allocation) (m : ℕ) + (h : ActiveOrder K tick sigma) + (hpos : 0 < Fintype.card (Positions (orderCounts allocation m) h)) : + (canonicalLaw (orderCounts allocation m) h).mass = (orderLaw h).mass := by + have hcard : Fintype.card (Positions (orderCounts allocation m) h) = + population allocation m (h.val.val.1.source, h.val.val.2) := by + simpa only [Positions, Fintype.card_fin] using orderCounts_sum allocation m h + funext a + rw [canonicalLaw_mass_of_pos _ h hpos, hcard] + change (jointCounts allocation m h.val.val a : ℝ) / + population allocation m (h.val.val.1.source, h.val.val.2) = _ + rw [jointCounts_cast] + exact mul_div_cancel_left₀ _ (by exact_mod_cast (hcard ▸ hpos).ne') + +theorem localAllowed_entropy_le (allocation : Allocation) (m : ℕ) + (h : ActiveOrder K tick sigma) + (word : Positions (orderCounts allocation m) h → JointPopulation.Shape) + (hw : localAllowed (orderCounts allocation m) orderTotal h word) : + finiteEntropy (fun a => (wordPopulation word a : ℝ) / + Fintype.card (Positions (orderCounts allocation m) h)) ≤ + finiteEntropy (orderLaw h).mass := by + by_cases hpos : 0 < Fintype.card (Positions (orderCounts allocation m) h) + · have hs := localAllowed_positive (orderCounts allocation m) orderTotal h word hw + h.val.val rfl (fun a ha => + AllFieldStageCGibbs.jointCounts_positive_reference allocation m h.val.val a ha) + have he := localAllowed_entropy_le_of_word_support (orderCounts allocation m) + orderTotal h word (orderLaw h) (potential h.val.val 0) (potential h.val.val 1) + (potential h.val.val 2) (logNormalizer h.val.val) hs + (placedLaw_log h.val.val) hw + have hc := canonicalLaw_mass_eq allocation m h hpos + simpa only [gibbsCap, marginalError, FiniteLaw.map_mass, hc, sub_self, abs_zero, + zero_mul, Finset.sum_const_zero, add_zero] using he + · have hz := Nat.eq_zero_of_not_pos hpos + simpa only [hz, Nat.cast_zero, div_zero, finiteEntropy, entropyTerm_zero, + Finset.sum_const_zero] using (orderLaw h).entropy_nonneg + +theorem tendsto_firstExponent (allocation : Allocation) (sigma : Placement) : + Tendsto (fun m : ℕ => (∑ h : ActiveOrder K tick sigma, + classExponent (orderCounts allocation m) (sigma 0) + (triple (orderCounts allocation m) (canonicalTarget (orderCounts allocation m))) h + (finiteEntropy (orderLaw h).mass)) / (m : ℝ)) atTop + (𝓝 (orderNativeDegree (K := K) (tick := tick) allocation sigma 0)) := by + have hsize (h : ActiveOrder K tick sigma) := + JointPopulationRates.tendsto_total_div_of_coordinate_rates + (fun m => orderCounts allocation m h) + ((populationLength (K := K) allocation 1 : ℝ) * orderMass allocation h) + (orderLaw h).mass (orderLaw h).total (orderCounts_dilation_rate allocation h) + have hside (h : ActiveOrder K tick sigma) := + JointPopulationRates.tendsto_weighted_target_side_entropy + (fun m => orderCounts allocation m) + (fun m => canonicalTarget (orderCounts allocation m)) + (fun h => (populationLength (K := K) allocation 1 : ℝ) * orderMass allocation h) + (fun h => (orderLaw h).mass) (fun h => (orderLaw h).total) + (orderCounts_dilation_rate allocation) h (sigma 0) + have hr := JointAmbientRateLimit.tendsto_sum_classExponent_div_nat + (fun m => orderCounts allocation m) (sigma 0) + (fun _ h => finiteEntropy (orderLaw h).mass) + (fun h => (populationLength (K := K) allocation 1 : ℝ) * orderMass allocation h) + (fun h => ((populationLength (K := K) allocation 1 : ℝ) * orderMass allocation h) * + finiteEntropy (orderLaw h).mass) + (fun h => ((populationLength (K := K) allocation 1 : ℝ) * orderMass allocation h) * + finiteEntropy (JointPopulationRates.sideMass (orderLaw h).mass (sigma 0))) + hsize (fun h => (hsize h).mul_const (finiteEntropy (orderLaw h).mass)) + (fun h => by simpa only [Positions, Fintype.card_fin] using hside h) + simpa only [orderNativeDegree, order_first_capacity, mul_sub] using hr + +theorem eventually_sharedAmbient_first_card_le (allocation : Allocation) + (sigma : Placement) {ε : ℝ} (hε : 0 < ε) : + ∀ᶠ m in atTop, ∀ e : Target + (orderCounts (K := K) (tick := tick) (sigma := sigma) allocation m), + ((sharedAmbient (orderCounts allocation m) orderTotal (sigma 0) + (triple (orderCounts allocation m) e)).card : ℝ) ≤ + Real.exp ((m : ℝ) * + (orderNativeDegree (K := K) (tick := tick) allocation sigma 0 + ε)) := by + filter_upwards [(tendsto_order.1 + (tendsto_firstExponent (K := K) (tick := tick) allocation sigma)).2 + (orderNativeDegree (K := K) (tick := tick) allocation sigma 0 + ε) + (lt_add_of_pos_right _ hε), eventually_gt_atTop (0 : ℕ)] with m hm hmp + intro e + have hmr : (0 : ℝ) < m := by exact_mod_cast hmp + have hb := sharedAmbient_card_le (orderCounts allocation m) orderTotal (sigma 0) + (triple (orderCounts allocation m) e) (fun h => finiteEntropy (orderLaw h).mass) + (fun h word hw => localAllowed_entropy_le allocation m h word hw) + apply hb.trans + simp_rw [classBound_eq_exp] + rw [← Real.exp_sum] + apply Real.exp_le_exp.mpr + simp_rw [classExponent_target_eq] + simpa only [mul_comm] using (div_le_iff₀ hmr).mp hm.le + +end MatrixMultiplication.AllFieldGroupAmbientDegree + +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/Construction/GroupAssignmentRetention.lean b/lean/OAI/LinearAlgebra/MatrixFields/Construction/GroupAssignmentRetention.lean new file mode 100644 index 0000000000000000000000000000000000000000..7266620fce714f51cbe0ddf33c1aadbc27360375 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/Construction/GroupAssignmentRetention.lean @@ -0,0 +1,449 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Entropy.GroupBranchLaws +import OAI.LinearAlgebra.MatrixFields.Extraction.JointMaskedGoodSelection +import OAI.LinearAlgebra.MatrixFields.Histories.JointScalarOrbitAdmissibility + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section + +namespace MatrixMultiplication.AllFieldGroupAdmissible + +open AllFieldHistory AllFieldHistorySupport AllFieldHistoryChildLaws +open AllFieldHistoryGroupMasks AllFieldHistoryGroupedRecovery AllFieldGroupOrbitData +open JointPopulation JointCanonicalization PermutationMatching +attribute [local instance] Classical.propDecidable Classical.decEq + +variable {K tick : ℕ} + +abbrev Symmetries (allocation : Allocation) (m : ℕ) (sigma : Placement) := + HalfClassPermutations (ClassPositions (Counts (K := K) (tick := tick) allocation m sigma)) + +@[instance_reducible] +def rawAction (allocation : Allocation) (m : ℕ) (sigma : Placement) + (e : Targets (K := K) (tick := tick) allocation m sigma) : + MulAction (Symmetries (K := K) (tick := tick) allocation m sigma) (Raw (K := K) (tick := tick) allocation m sigma) := + EquivOrbitTransport.action (groupCoordinates (K := K) (tick := tick) allocation m sigma e) + +theorem admissible_smul (allocation : Allocation) (m : ℕ) (ε : ℝ) (sigma : Placement) + (side : Fin 3) (e : Targets (K := K) (tick := tick) allocation m sigma) : + letI : MulAction (Symmetries (K := K) (tick := tick) allocation m sigma) (Raw (K := K) (tick := tick) allocation m sigma) := + rawAction (K := K) (tick := tick) allocation m sigma e + ∀ (g : Symmetries (K := K) (tick := tick) allocation m sigma) (w : Raw (K := K) (tick := tick) allocation m sigma), + Admissible (K := K) (tick := tick) allocation m ε sigma side e w → + Admissible (K := K) (tick := tick) allocation m ε sigma side e ((rawAction (K := K) (tick := tick) allocation m sigma e).smul g w) := by + let : MulAction (Symmetries (K := K) (tick := tick) allocation m sigma) (Raw (K := K) (tick := tick) allocation m sigma) := + rawAction (K := K) (tick := tick) allocation m sigma e + intro g w hw + have hweights : ∀ h j, + CWStrands.weight (((rawAction (K := K) (tick := tick) allocation m sigma e).smul g w) h j).1 = (shapeSide (sigma side) ((e h).val j)).val ∧ + CWStrands.weight (((rawAction (K := K) (tick := tick) allocation m sigma e).smul g w) h j).2 = activeParentShape h.val (sigma side) - + (shapeSide (sigma side) ((e h).val j)).val := by + exact JointScalarOrbitAdmissibility.classWeights_smul + (Counts (K := K) (tick := tick) allocation m sigma) + (fun h => Fin (activeHalfLength h.val) → Fin 7) + (fun h => Fin (activeHalfLength h.val) → Fin 7) + (fun _ => CWStrands.weight) (fun _ => CWStrands.weight) + (fun _ u => (shapeSide (sigma side) u).val) + (fun h u => activeParentShape h.val (sigma side) - (shapeSide (sigma side) u).val) + e g w hw.2 + refine ⟨⟨?_, ?_⟩, hweights⟩ + · intro h j + apply Fin.ext + exact (hweights h j).1 + · exact (JointScalarOrbitAdmissibility.rawWindows_smul + (SL := fun h : ActiveOrder K tick sigma => Statistic h.val) + (SR := fun h : ActiveOrder K tick sigma => Statistic h.val) + (Counts (K := K) (tick := tick) allocation m sigma) + (fun h => Fin (activeHalfLength h.val) → Fin 7) + (fun h => Fin (activeHalfLength h.val) → Fin 7) + (fun c => statistic c.1.val) (fun c => statistic c.1.val) + (fun c => leftLaw c.1.val c.2 (sigma side)) + (fun c => rightLaw c.1.val c.2 (sigma side)) + (fun c => AllFieldHistoryMasks.childWidth ε c.1.val) + (fun c => AllFieldHistoryMasks.childWidth ε c.1.val) e g w).mpr hw.1.2 + +theorem admissible_of_orbitOf_eq (allocation : Allocation) (m : ℕ) (ε : ℝ) + (sigma : Placement) (side : Fin 3) + (e : Targets (K := K) (tick := tick) allocation m sigma) + (w v : Raw (K := K) (tick := tick) allocation m sigma) (hw : Admissible (K := K) (tick := tick) allocation m ε sigma side e w) + (hv : orbitOf (K := K) (tick := tick) allocation m sigma e v = orbitOf (K := K) (tick := tick) allocation m sigma e w) : + Admissible (K := K) (tick := tick) allocation m ε sigma side e v := by + let : MulAction (Symmetries (K := K) (tick := tick) allocation m sigma) (Raw (K := K) (tick := tick) allocation m sigma) := + rawAction (K := K) (tick := tick) allocation m sigma e + have hrel : MulAction.orbitRel + (Symmetries (K := K) (tick := tick) allocation m sigma) + (CanonicalPairs (Counts (K := K) (tick := tick) allocation m sigma) + (fun h => Fin (activeHalfLength h.val) → Fin 7) + (fun h => Fin (activeHalfLength h.val) → Fin 7)) + (groupCoordinates (K := K) (tick := tick) allocation m sigma e v) + (groupCoordinates (K := K) (tick := tick) allocation m sigma e w) := Quotient.exact hv + obtain ⟨g, hg⟩ := hrel + have hgv : ((rawAction (K := K) (tick := tick) allocation m sigma e).smul g w) = v := by + apply (groupCoordinates (K := K) (tick := tick) allocation m sigma e).injective + exact (EquivOrbitTransport.equiv_smul + (groupCoordinates (K := K) (tick := tick) allocation m sigma e) g w).trans hg + rw [← hgv] + exact admissible_smul allocation m ε sigma side e g w hw + +theorem full_admissible (allocation : Allocation) (m : ℕ) (ε : ℝ) (sigma : Placement) + (e : Targets (K := K) (tick := tick) allocation m sigma) + (o : Orbit (K := K) (tick := tick) allocation m sigma) (ho : o ∈ (data (K := K) (tick := tick) allocation m ε sigma).orbits e) + (v : Variable (K := K) (tick := tick) allocation m sigma) (hv : v ∈ (data (K := K) (tick := tick) allocation m ε sigma).full e o) : + Admissible (K := K) (tick := tick) allocation m ε sigma v.1 e v.2 := by + obtain ⟨w, hw, hwo⟩ := (Finset.mem_filter.mp ho).2 + obtain ⟨hside, hvo⟩ := (Finset.mem_filter.mp hv).2 + rw [hside] + exact admissible_of_orbitOf_eq allocation m ε sigma o.1 e w v.2 hw (hvo.trans hwo.symm) + +end MatrixMultiplication.AllFieldGroupAdmissible + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section + +namespace MatrixMultiplication.AllFieldGroupAdmissible + +open AllFieldHistory AllFieldHistorySupport AllFieldHistoryChildLaws +open AllFieldHistoryGroupMasks AllFieldHistoryGroupedRecovery AllFieldGroupOrbitData +open JointPopulation JointCanonicalization PermutationMatching +attribute [local instance] Classical.propDecidable Classical.decEq + +variable {K tick : ℕ} + +theorem used_project_admissible (F : Type*) [CommRing F] + (allocation : Allocation) (m : ℕ) (ε : ℝ) (sigma : Placement) + (e : AllFieldHistoryRecovery.Targets (K := K) (tick := tick) allocation m) + (side : Fin 3) (w : AllFieldHistoryRecovery.Raw (K := K) (tick := tick) allocation m) + (hw : AllFieldHistoryRecovery.Used F allocation m ε e (sigma side) w) : + Admissible (K := K) (tick := tick) allocation m ε sigma side + (projectTarget (K := K) (tick := tick) allocation m sigma e) (projectRaw (K := K) (tick := tick) allocation m sigma w) := by + obtain ⟨x, y, z, hq, rfl⟩ := hw + have hi : + AllFieldHistoryRecovery.idealSide allocation m ε 0 e x ∧ + AllFieldHistoryRecovery.idealSide allocation m ε 1 e y ∧ + AllFieldHistoryRecovery.idealSide allocation m ε 2 e z := by + by_contra hn + apply hq + rw [AllFieldHistoryRecovery.ideal_eq_delete_source F allocation m ε e] + exact ite_eq_right hn + have ht := AllFieldHistoryRecovery.ideal_support_weights F allocation m ε e x y z hq + have hs (s : Fin 3) : + AllFieldHistoryRecovery.idealSide allocation m ε s e + (AllFieldHistoryRecovery.sideVariable s x y z) ∧ + AllFieldHistoryRecovery.sideWeights allocation m s e + (AllFieldHistoryRecovery.sideVariable s x y z) := by + fin_cases s + · exact ⟨hi.1, ht.1⟩ + · exact ⟨hi.2.1, ht.2.1⟩ + · exact ⟨hi.2.2, ht.2.2⟩ + refine ⟨?_, ?_⟩ + · exact (idealSide_iff_all_groups allocation m ε + (sigma side) e _).mp (hs (sigma side)).1 sigma + · intro h j + exact (hs (sigma side)).2 h.val j + +theorem used_project_covered (F : Type*) [CommRing F] + (allocation : Allocation) (m : ℕ) (ε : ℝ) (sigma : Placement) + (e : AllFieldHistoryRecovery.Targets (K := K) (tick := tick) allocation m) + (side : Fin 3) (w : AllFieldHistoryRecovery.Raw (K := K) (tick := tick) allocation m) + (hw : AllFieldHistoryRecovery.Used F allocation m ε e (sigma side) w) : + ∃ o ∈ (data (K := K) (tick := tick) allocation m ε sigma).orbits (projectTarget (K := K) (tick := tick) allocation m sigma e), + (side, projectRaw (K := K) (tick := tick) allocation m sigma w) ∈ + (data (K := K) (tick := tick) allocation m ε sigma).full (projectTarget (K := K) (tick := tick) allocation m sigma e) o := + admissible_covered allocation m ε sigma side _ _ + (used_project_admissible F allocation m ε sigma e side w hw) + +end MatrixMultiplication.AllFieldGroupAdmissible + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section + +namespace MatrixMultiplication.AllFieldGroupAssignmentRetention +open AllFieldHistory AllFieldHistoryGroupMasks AllFieldHistoryGroupedRecovery +open AllFieldGroupOrbitData JointCoarseHashing +attribute [local instance] Classical.propDecidable Classical.decEq +variable {K tick : ℕ} + +def assigned (allocation : Allocation) (m : ℕ) (ε : ℝ) (sigma : Placement) + (k : ℕ) (U : Finset (ZMod (37 ^ k))) + (s : Sample (Pos (K := K) (tick := tick) allocation m sigma) k) + (v : Variable (K := K) (tick := tick) allocation m sigma) : Option (Triple (Pos (K := K) (tick := tick) allocation m sigma)) := + (data allocation m ε sigma).actualAssignment k U + (actualCompatible allocation m ε sigma) (actualUseful allocation m ε sigma) + (actualKeep allocation m ε sigma) s v + +def physicalAssignment (allocation : Allocation) (m : ℕ) (ε : ℝ) (sigma : Placement) + (k : ℕ) (U : Finset (ZMod (37 ^ k))) + (s : Sample (Pos (K := K) (tick := tick) allocation m sigma) k) : + JointExtraction.Assignment (Raw (K := K) (tick := tick) allocation m sigma) (Raw (K := K) (tick := tick) allocation m sigma) + (Raw (K := K) (tick := tick) allocation m sigma) (Triple (Pos (K := K) (tick := tick) allocation m sigma)) where + x w := assigned allocation m ε sigma k U s (sigma.symm 0, w) + y w := assigned allocation m ε sigma k U s (sigma.symm 1, w) + z w := assigned allocation m ε sigma k U s (sigma.symm 2, w) + +theorem assigned_spec (allocation : Allocation) (m : ℕ) (ε : ℝ) (sigma : Placement) + (k : ℕ) (U : Finset (ZMod (37 ^ k))) + (s : Sample (Pos (K := K) (tick := tick) allocation m sigma) k) + (v : Variable (K := K) (tick := tick) allocation m sigma) (t : Triple (Pos (K := K) (tick := tick) allocation m sigma)) + (h : assigned allocation m ε sigma k U s v = some t) : + t ∈ (data allocation m ε sigma).actualEligible k U s ∧ + actualCompatible allocation m ε sigma t v ∧ actualUseful allocation m ε sigma t v ∧ + ∀ f, f ∈ (data allocation m ε sigma).actualEligible k U s → + actualCompatible allocation m ε sigma f v → f = t := by + have hh := JointExtraction.retainAssignment_some _ _ v t h + exact JointCoarseAssignment.assignUseful_spec _ _ _ v t hh + +theorem assigned_some_idealSide (allocation : Allocation) (m : ℕ) (ε : ℝ) + (sigma : Placement) (k : ℕ) (U : Finset (ZMod (37 ^ k))) + (s : Sample (Pos (K := K) (tick := tick) allocation m sigma) k) + (e : Targets (K := K) (tick := tick) allocation m sigma) (v : Variable (K := K) (tick := tick) allocation m sigma) + (h : assigned allocation m ε sigma k U s v = some (coarse allocation m sigma e)) : + groupIdealSide allocation m ε (sigma v.1) sigma e v.2 := by + exact (actualUseful_coarse allocation m ε sigma e v).mp + (assigned_spec allocation m ε sigma k U s v _ h).2.2.1 + +end MatrixMultiplication.AllFieldGroupAssignmentRetention + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section + +namespace MatrixMultiplication.AllFieldGroupCompatibility + +open AllFieldHistory AllFieldHistoryChildLaws AllFieldHistoryGroupMasks +open AllFieldHistoryGroupedRecovery AllFieldGroupOrbitData +open JointPopulation JointCanonicalization + +attribute [local instance] Classical.propDecidable + +variable {K tick : ℕ} + +theorem groupIdealSide_ownWord (allocation : Allocation) (m : ℕ) (ε : ℝ) + (sigma : Placement) (side : Fin 3) + (e : Targets (K := K) (tick := tick) allocation m sigma) + (w : Raw (K := K) (tick := tick) allocation m sigma) + (hw : groupIdealSide allocation m ε (sigma side) sigma e w) : + tripleSide side (AllFieldGroupOrbitData.coarse allocation m sigma e) = + ownWord allocation m sigma w := by + change tripleSide side + (reorder sigma (triple (Counts (K := K) (tick := tick) allocation m sigma) e)) = _ + rw [tripleSide_reorder] + funext p + have hs : tripleSide (sigma side) + (triple (Counts (K := K) (tick := tick) allocation m sigma) e) p = + shapeSide (sigma side) ((e p.1).val p.2) := by + generalize sigma side = s + fin_cases s <;> rfl + rw [hs] + exact (hw.1 p.1 p.2).symm + +theorem groupIdealSide_fineCompatible (allocation : Allocation) (m : ℕ) (ε : ℝ) + (sigma : Placement) (side : Fin 3) + (e : Targets (K := K) (tick := tick) allocation m sigma) + (w : Raw (K := K) (tick := tick) allocation m sigma) + (hw : groupIdealSide allocation m ε (sigma side) sigma e w) : + fineCompatible allocation m ε sigma side e w := by + intro right h u hd + apply JointPopulationCompatibility.shape_count_window_of_typeWindow + (Counts (K := K) (tick := tick) allocation m sigma) e h u + (fun i => statistic h.val (if right then (w h i).2 else (w h i).1)) + (compatibilityLaw right side sigma h u) (AllFieldHistoryMasks.childWidth ε h.val) + intro hu + rw [AllFieldGroupNativeLaws.compatibilityLaw_eq allocation m sigma right side h u hu hd] + cases right + · exact (hw.2 h u hu).1 + · exact (hw.2 h u hu).2 + +theorem groupIdealSide_compatible (allocation : Allocation) (m : ℕ) (ε : ℝ) + (sigma : Placement) (side : Fin 3) + (e : Targets (K := K) (tick := tick) allocation m sigma) + (w : Raw (K := K) (tick := tick) allocation m sigma) + (hw : groupIdealSide allocation m ε (sigma side) sigma e w) : + Compatible allocation m ε sigma side e w := + ⟨groupIdealSide_ownWord allocation m ε sigma side e w hw, + groupIdealSide_fineCompatible allocation m ε sigma side e w hw⟩ + +theorem admissible_compatible (allocation : Allocation) (m : ℕ) (ε : ℝ) + (sigma : Placement) (side : Fin 3) + (e : Targets (K := K) (tick := tick) allocation m sigma) + (w : Raw (K := K) (tick := tick) allocation m sigma) + (hw : Admissible allocation m ε sigma side e w) : + Compatible allocation m ε sigma side e w := + groupIdealSide_compatible allocation m ε sigma side e w hw.1 + +end MatrixMultiplication.AllFieldGroupCompatibility + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section + +namespace MatrixMultiplication.AllFieldGroupAssignmentRetention +open AllFieldHistory AllFieldHistoryGroupMasks AllFieldHistoryGroupedRecovery +open AllFieldGroupOrbitData JointCoarseHashing +attribute [local instance] Classical.propDecidable Classical.decEq +variable {K tick : ℕ} + +theorem good_failure_fraction_le (allocation : Allocation) (m : ℕ) (ε : ℝ) + (sigma : Placement) (k : ℕ) (U : Finset (ZMod (37 ^ k))) + (hAP : ∀ x ∈ U, ∀ y ∈ U, ∀ z ∈ U, x + y = 2 * z → x = z ∧ y = z) + (N : ℝ) (s : Sample (Pos (K := K) (tick := tick) allocation m sigma) k) + (e : Targets (K := K) (tick := tick) allocation m sigma) + (hg : (data (K := K) (tick := tick) allocation m ε sigma).Good k U N e s) + (o : Orbit (K := K) (tick := tick) allocation m sigma) (ho : o ∈ (data (K := K) (tick := tick) allocation m ε sigma).orbits e) : + ((((data (K := K) (tick := tick) allocation m ε sigma).passing e o).filter + (fun v => assigned (K := K) (tick := tick) allocation m ε sigma k U s v ≠ some (coarse (K := K) (tick := tick) allocation m sigma e))).card : ℝ) / + (((data (K := K) (tick := tick) allocation m ε sigma).full e o).card : ℝ) ≤ 1 / N := by + have ha (v : Variable (K := K) (tick := tick) allocation m sigma) + (hv : v ∈ (data (K := K) (tick := tick) allocation m ε sigma).passing e o) : + Admissible (K := K) (tick := tick) allocation m ε sigma v.1 e v.2 := + AllFieldGroupAdmissible.full_admissible (K := K) (tick := tick) allocation m ε sigma e o ho v + ((mem_passing (K := K) (tick := tick) allocation m ε sigma e o v).mp hv).1 + have hc (v : Variable (K := K) (tick := tick) allocation m sigma) + (hv : v ∈ (data (K := K) (tick := tick) allocation m ε sigma).passing e o) : + Compatible (K := K) (tick := tick) allocation m ε sigma v.1 e v.2 := + AllFieldGroupCompatibility.admissible_compatible (K := K) (tick := tick) allocation m ε sigma v.1 e v.2 (ha v hv) + have hh := (data (K := K) (tick := tick) allocation m ε sigma).good_passing_actual_failure_fraction_le k U hAP N e o ho s hg + (actualCompatible (K := K) (tick := tick) allocation m ε sigma) (actualUseful (K := K) (tick := tick) allocation m ε sigma) + (actualKeep (K := K) (tick := tick) allocation m ε sigma) + (fun v hv => (actualCompatible_coarse (K := K) (tick := tick) allocation m ε sigma e v).mpr (hc v hv)) + (fun v hv => (actualUseful_coarse (K := K) (tick := tick) allocation m ε sigma e v).mpr (ha v hv).1) + (fun v hv => ((mem_passing (K := K) (tick := tick) allocation m ε sigma e o v).mp hv).2) + (fun v hv f hf hn hcomp => competitor_coverage (K := K) (tick := tick) allocation m ε sigma e o v (hc v hv) f hn hcomp) + + rw [Finset.filter_congr_decidable] at hh + exact hh + +end MatrixMultiplication.AllFieldGroupAssignmentRetention + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section + +namespace MatrixMultiplication.AllFieldGroupAssignmentRetention + +open AllFieldHistory AllFieldHistoryGroupMasks AllFieldHistoryGroupedRecovery +open AllFieldGroupOrbitData JointCoarseHashing +attribute [local instance] Classical.propDecidable Classical.decEq + +variable {K tick : ℕ} + +theorem good_local_failure_le (allocation : Allocation) (m : ℕ) (ε : ℝ) + (sigma : Placement) (k : ℕ) (U : Finset (ZMod (37 ^ k))) + (hAP : ∀ x ∈ U, ∀ y ∈ U, ∀ z ∈ U, x + y = 2 * z → x = z ∧ y = z) + (N : ℝ) (s : Sample (Pos (K := K) (tick := tick) allocation m sigma) k) + (e : Targets (K := K) (tick := tick) allocation m sigma) (hg : (data allocation m ε sigma).Good k U N e s) + (side : Fin 3) (w : Raw (K := K) (tick := tick) allocation m sigma) + (hw : Admissible allocation m ε sigma side e w) : + (((localOrbit allocation m sigma e w).filter (fun v => + completeKeep allocation m ε (sigma side) sigma v ∧ + assigned allocation m ε sigma k U s (side, v) ≠ some (coarse allocation m sigma e))).card : ℝ) / + ((localOrbit allocation m sigma e w).card : ℝ) ≤ 1 / N := by + have ho : (side, orbitOf allocation m sigma e w) ∈ (data allocation m ε sigma).orbits e := + Finset.mem_filter.mpr ⟨Finset.mem_univ _, w, hw, rfl⟩ + have hh := good_failure_fraction_le allocation m ε sigma k U hAP N s e hg _ ho + change (((passing allocation m sigma ε e (side, orbitOf allocation m sigma e w)).filter + (fun v => assigned allocation m ε sigma k U s v ≠ some (coarse allocation m sigma e))).card : ℝ) / + ((full allocation m sigma e (side, orbitOf allocation m sigma e w)).card : ℝ) ≤ 1 / N at hh + rw [passing, Finset.filter_filter] at hh + simp only [full_eq_tagged_localOrbit, Finset.filter_map, Finset.card_map] at hh + rw [Finset.filter_congr_decidable] at hh + exact hh + +theorem localAssigned_iff (allocation : Allocation) (m : ℕ) (ε : ℝ) + (sigma : Placement) (k : ℕ) (U : Finset (ZMod (37 ^ k))) + (s : Sample (Pos (K := K) (tick := tick) allocation m sigma) k) + (t : Triple (Pos (K := K) (tick := tick) allocation m sigma)) (side : Fin 3) (w : Raw (K := K) (tick := tick) allocation m sigma) : + localAssigned allocation m sigma (physicalAssignment allocation m ε sigma k U s) t side w ↔ + assigned allocation m ε sigma k U s (sigma.symm side, w) = some t := by + fin_cases side <;> rfl + +theorem good_physical_local_failure_le (allocation : Allocation) (m : ℕ) (ε : ℝ) + (sigma : Placement) (k : ℕ) (U : Finset (ZMod (37 ^ k))) + (hAP : ∀ x ∈ U, ∀ y ∈ U, ∀ z ∈ U, x + y = 2 * z → x = z ∧ y = z) + (N : ℝ) (s : Sample (Pos (K := K) (tick := tick) allocation m sigma) k) + (e : Targets (K := K) (tick := tick) allocation m sigma) (hg : (data allocation m ε sigma).Good k U N e s) + (side : Fin 3) (w : Raw (K := K) (tick := tick) allocation m sigma) + (hw : Admissible allocation m ε sigma (sigma.symm side) e w) : + (((localOrbit allocation m sigma e w).filter (fun v => + completeKeep allocation m ε side sigma v ∧ + ¬localAssigned allocation m sigma (physicalAssignment allocation m ε sigma k U s) + (coarse allocation m sigma e) side v)).card : ℝ) / + ((localOrbit allocation m sigma e w).card : ℝ) ≤ 1 / N := by + simpa only [sigma.apply_symm_apply, localAssigned_iff] using + good_local_failure_le allocation m ε sigma k U hAP N s e hg (sigma.symm side) w hw + +theorem good_projected_failure_le (F : Type*) [CommRing F] + (allocation : Allocation) (m : ℕ) (ε : ℝ) (sigma : Placement) + (k : ℕ) (U : Finset (ZMod (37 ^ k))) + (hAP : ∀ x ∈ U, ∀ y ∈ U, ∀ z ∈ U, x + y = 2 * z → x = z ∧ y = z) + (N : ℝ) (s : Sample (Pos (K := K) (tick := tick) allocation m sigma) k) + (e : AllFieldHistoryRecovery.Targets (K := K) (tick := tick) allocation m) + (hg : (data allocation m ε sigma).Good k U N (projectTarget allocation m sigma e) s) + (side : Fin 3) (w : AllFieldHistoryRecovery.Raw (K := K) (tick := tick) allocation m) + (hw : AllFieldHistoryRecovery.Used F allocation m ε e side w) : + (((localOrbit allocation m sigma (projectTarget allocation m sigma e) + (projectRaw allocation m sigma w)).filter (fun v => + completeKeep allocation m ε side sigma v ∧ + ¬localAssigned allocation m sigma (physicalAssignment allocation m ε sigma k U s) + (coarse allocation m sigma (projectTarget allocation m sigma e)) side v)).card : ℝ) / + ((localOrbit allocation m sigma (projectTarget allocation m sigma e) + (projectRaw allocation m sigma w)).card : ℝ) ≤ 1 / N := by + apply good_physical_local_failure_le allocation m ε sigma k U hAP N s _ hg + exact AllFieldGroupAdmissible.used_project_admissible F allocation m ε sigma e + (sigma.symm side) w (by simpa only [sigma.apply_symm_apply] using hw) + +end MatrixMultiplication.AllFieldGroupAssignmentRetention + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/Construction/GroupAssignments.lean b/lean/OAI/LinearAlgebra/MatrixFields/Construction/GroupAssignments.lean new file mode 100644 index 0000000000000000000000000000000000000000..80d3b469de438ea4fb5ed58fd753ad787e4fb650 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/Construction/GroupAssignments.lean @@ -0,0 +1,430 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Construction.GroupAssignmentRetention +import OAI.LinearAlgebra.MatrixFields.Histories.CWShapePhysicalPermutation +import OAI.LinearAlgebra.MatrixFields.Parameters.GroupStatisticComplement +import OAI.LinearAlgebra.MatrixFields.Tensors.JointPopulationCWNonzero + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section + +namespace MatrixMultiplication.AllFieldGroupSourceSupport + +open MatrixMultiplication.Foundation AllFieldHistory AllFieldHistorySupport +open AllFieldHistoryChildLaws AllFieldHistoryGroupMasks AllFieldHistoryGroupedRecovery +open AllFieldGroupOrbitData JointPopulation JointCanonicalization JointCanonicalCW +open scoped BigOperators +attribute [local instance] Classical.propDecidable + +variable {K tick : ℕ} + +theorem masks_of_prepared (F : Type*) [CommRing F] (allocation : Allocation) + (m : ℕ) (ε : ℝ) (sigma : Placement) + (x y z : GroupRaw (K := K) (tick := tick) allocation m sigma) + (hT : groupPreparedSource F allocation m ε sigma x y z ≠ 0) : + completeKeep allocation m ε 0 sigma x ∧ + completeKeep allocation m ε 1 sigma y ∧ + completeKeep allocation m ε 2 sigma z := by + by_contra hn + apply hT + exact ite_eq_right hn + +theorem raw_nonzero (F : Type*) [CommRing F] (allocation : Allocation) + (m : ℕ) (ε : ℝ) (sigma : Placement) + (x y z : GroupRaw (K := K) (tick := tick) allocation m sigma) + (hT : groupPreparedSource F allocation m ε sigma x y z ≠ 0) : + groupRawSource F allocation m sigma x y z ≠ 0 := by + have hm := masks_of_prepared F allocation m ε sigma x y z hT + simpa only [groupPreparedSource, ExactRecovery.delete, ite_eq_left hm] using hT + +theorem marginal_sideMask (allocation : Allocation) (m : ℕ) (side : Fin 3) + (sigma : Placement) (w : GroupRaw (K := K) (tick := tick) allocation m sigma) + (hm : marginal allocation m side sigma w) : + JointCanonicalMixed.sideMask (groupCounts allocation m sigma) + (fun h => activeHalfLength h.val) (fun h => activeHalfLength h.val) + (fun h => AllFieldHistoryRecovery.halfLength_le_eight h.val) side w := by + intro h a + exact (hm h a).trans + (marginal_population_eq (groupCounts allocation m sigma) + (projectTarget allocation m sigma (canonicalTarget (activeCounts allocation m))) + (canonicalTarget (groupCounts allocation m sigma)) h side a) + +theorem marginal_source_nonzero (F : Type*) [CommRing F] (allocation : Allocation) + (m : ℕ) (ε : ℝ) (sigma : Placement) + (x y z : GroupRaw (K := K) (tick := tick) allocation m sigma) + (hT : groupPreparedSource F allocation m ε sigma x y z ≠ 0) : + JointCanonicalMixed.maskedSource (F := F) (groupCounts allocation m sigma) + (fun h => activeHalfLength h.val) (fun h => activeHalfLength h.val) + (fun h => activeParentShape h.val) (fun _ => true) + (fun h => AllFieldHistoryRecovery.halfLength_le_eight h.val) x y z ≠ 0 := by + have hm := masks_of_prepared F allocation m ε sigma x y z hT + have hx := marginal_sideMask allocation m 0 sigma x hm.1.1 + have hy := marginal_sideMask allocation m 1 sigma y hm.2.1.1 + have hz := marginal_sideMask allocation m 2 sigma z hm.2.2.1 + rw [JointCanonicalMixed.maskedSource, ExactRecovery.delete, + ite_eq_left (And.intro hx (And.intro hy hz))] + exact raw_nonzero F allocation m ε sigma x y z hT + +theorem prepared_source_support (F : Type*) [CommRing F] (allocation : Allocation) + (m : ℕ) (ε : ℝ) (sigma : Placement) + (x y z : GroupRaw (K := K) (tick := tick) allocation m sigma) + (hT : groupPreparedSource F allocation m ε sigma x y z ≠ 0) : + reorder sigma + (ownWord allocation m sigma x, ownWord allocation m sigma y, + ownWord allocation m sigma z) ∈ ambient allocation m sigma := by + apply Finset.mem_image.mpr + refine ⟨(ownWord allocation m sigma x, ownWord allocation m sigma y, + ownWord allocation m sigma z), ?_, rfl⟩ + exact JointCanonicalMixed.maskedSource_support (groupCounts allocation m sigma) + (fun h => activeHalfLength h.val) (fun h => activeHalfLength h.val) + (fun h => activeParentShape h.val) (fun _ => true) + (fun h => AllFieldHistoryRecovery.halfLength_le_eight h.val) x y z + (marginal_source_nonzero F allocation m ε sigma x y z hT) + +end MatrixMultiplication.AllFieldGroupSourceSupport + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section + +namespace MatrixMultiplication.AllFieldGroupCompatibilityTransfer + +open MatrixMultiplication.Foundation AllFieldHistory AllFieldHistoryChildLaws +open AllFieldHistoryGroupMasks AllFieldHistoryGroupedRecovery AllFieldGroupOrbitData +open JointPopulation JointCanonicalization JointCanonicalCW CWStrands InheritedMasks +open scoped BigOperators + +attribute [local instance] Classical.propDecidable + +variable {K tick : ℕ} + +theorem physical_coarseMask (allocation : Allocation) (m : ℕ) (sigma : Placement) + (e : Targets (K := K) (tick := tick) allocation m sigma) + (a : Fin 3 → Raw (K := K) (tick := tick) allocation m sigma) + (hcoarse : reorder sigma (ownWord allocation m sigma (a 0), + ownWord allocation m sigma (a 1), ownWord allocation m sigma (a 2)) = + AllFieldGroupOrbitData.coarse allocation m sigma e) + (s : Fin 3) : + coarseMask (Counts allocation m sigma) + (fun h => Fin (activeHalfLength h.val) → Fin 7) + (fun h => Fin (activeHalfLength h.val) → Fin 7) + groupCoarse s e (a s) := by + have ht := reorder_injective sigma hcoarse + intro h i + have he := congrArg (fun t => tripleSide s t ⟨h, i⟩) ht + fin_cases s <;> exact he + +def halfShape {sigma : Placement} (right : Bool) (h : ActiveOrder K tick sigma) + (u : JointPopulation.Shape) : Fin 3 → ℕ := + if right then activeParentShape h.val - shapeNat u else shapeNat u + +def halfLaw {sigma : Placement} (right : Bool) (side : Fin 3) (h : ActiveOrder K tick sigma) + (u : JointPopulation.Shape) : Statistic h.val → ℝ := + if right then rightLaw h.val u side else leftLaw h.val u side + +theorem physical_half_product_nonzero (F : Type*) [Field F] + (allocation : Allocation) (m : ℕ) (sigma : Placement) + (e : Targets (K := K) (tick := tick) allocation m sigma) + (a : Fin 3 → Raw (K := K) (tick := tick) allocation m sigma) + (hraw : groupRawSource F allocation m sigma (a 0) (a 1) (a 2) ≠ 0) + (hcoarse : reorder sigma (ownWord allocation m sigma (a 0), + ownWord allocation m sigma (a 1), ownWord allocation m sigma (a 2)) = + AllFieldGroupOrbitData.coarse allocation m sigma e) + (right : Bool) (h : ActiveOrder K tick sigma) (u : JointPopulation.Shape) + (hu : 0 < Counts allocation m sigma h u) : + (∏ i : Class (Counts allocation m sigma) e h u, + shapeTensor (F := F) (Fin (activeHalfLength h.val)) (halfShape right h u) + (if right then (a 0 h i.val).2 else (a 0 h i.val).1) + (if right then (a 1 h i.val).2 else (a 1 h i.val).1) + (if right then (a 2 h i.val).2 else (a 2 h i.val).1)) ≠ 0 := by + have hsupp : ∀ (h : ActiveOrder K tick sigma) (u : JointPopulation.Shape), + 0 < Counts allocation m sigma h u → + ∀ s, shapeNat u s ≤ activeParentShape h.val s := by + intro h u hu s + exact jointCounts_support_le allocation m h.val.val u hu s + have hsource : sourceTensor (F := F) (Counts (K := K) (tick := tick) allocation m sigma) + (Left (fun h => activeHalfLength h.val)) (Right (fun h => activeHalfLength h.val)) + (parentTensor (F := F) (fun h : ActiveOrder K tick sigma => activeHalfLength h.val) + (fun h : ActiveOrder K tick sigma => activeHalfLength h.val) + (fun h : ActiveOrder K tick sigma => activeParentShape h.val)) + (a 0) (a 1) (a 2) ≠ 0 := by + exact hraw + have hp := JointPopulationCWNonzero.class_half_products_nonzero + (Counts allocation m sigma) (fun h => activeHalfLength h.val) + (fun h => activeHalfLength h.val) (fun h => activeParentShape h.val) + (fun h => AllFieldHistoryRecovery.halfLength_le_eight h.val) hsupp e + (a 0) (a 1) (a 2) hsource + (physical_coarseMask allocation m sigma e a hcoarse 0) + (physical_coarseMask allocation m sigma e a hcoarse 1) + (physical_coarseMask allocation m sigma e a hcoarse 2) h u hu + cases right + · exact hp.1 + · exact hp.2 + +theorem priority_half_product_nonzero (F : Type*) [Field F] + (allocation : Allocation) (m : ℕ) (sigma : Placement) + (e : Targets (K := K) (tick := tick) allocation m sigma) + (a : Fin 3 → Raw (K := K) (tick := tick) allocation m sigma) + (hraw : groupRawSource F allocation m sigma (a 0) (a 1) (a 2) ≠ 0) + (hcoarse : reorder sigma (ownWord allocation m sigma (a 0), + ownWord allocation m sigma (a 1), ownWord allocation m sigma (a 2)) = + AllFieldGroupOrbitData.coarse allocation m sigma e) + (right : Bool) (h : ActiveOrder K tick sigma) (u : JointPopulation.Shape) + (hu : 0 < Counts allocation m sigma h u) : + (∏ i : Class (Counts allocation m sigma) e h u, + shapeTensor (F := F) (Fin (activeHalfLength h.val)) (halfShape right h u ∘ sigma) + (if right then (a (sigma 0) h i.val).2 else (a (sigma 0) h i.val).1) + (if right then (a (sigma 1) h i.val).2 else (a (sigma 1) h i.val).1) + (if right then (a (sigma 2) h i.val).2 else (a (sigma 2) h i.val).1)) ≠ 0 := by + have he := fun i : Class (Counts allocation m sigma) e h u => + CWShapePhysicalPermutation.shapeTensor_permute (F := F) sigma (halfShape right h u) + (fun s => if right then (a s h i.val).2 else (a s h i.val).1) + simp_rw [he] + exact physical_half_product_nonzero F allocation m sigma e a hraw hcoarse right h u hu + +theorem useful_half_window (allocation : Allocation) (m : ℕ) (ε : ℝ) + (sigma : Placement) (s : Fin 3) + (e : Targets (K := K) (tick := tick) allocation m sigma) + (w : Raw (K := K) (tick := tick) allocation m sigma) + (hw : groupIdealSide allocation m ε s sigma e w) + (right : Bool) (h : ActiveOrder K tick sigma) (u : JointPopulation.Shape) + (hu : 0 < Counts allocation m sigma h u) : + typeWindow (halfLaw right s h u) (AllFieldHistoryMasks.childWidth ε h.val) + (fun i : Class (Counts allocation m sigma) e h u => + statistic h.val (if right then (w h i.val).2 else (w h i.val).1)) := by + cases right + · exact (hw.2 h u hu).1 + · exact (hw.2 h u hu).2 + +theorem own_coarse_guard (allocation : Allocation) (m : ℕ) (sigma : Placement) + (e : Targets (K := K) (tick := tick) allocation m sigma) + (a : Fin 3 → Raw (K := K) (tick := tick) allocation m sigma) + (hcoarse : reorder sigma (ownWord allocation m sigma (a 0), + ownWord allocation m sigma (a 1), ownWord allocation m sigma (a 2)) = + AllFieldGroupOrbitData.coarse allocation m sigma e) + (side : Fin 3) : + tripleSide side (AllFieldGroupOrbitData.coarse allocation m sigma e) = + ownWord allocation m sigma (a (sigma side)) := by + rw [← hcoarse, tripleSide_reorder] + generalize sigma side = s + fin_cases s <;> rfl + +theorem transferY (F : Type*) [Field F] (allocation : Allocation) (m : ℕ) (ε : ℝ) + (sigma : Placement) (e : Targets (K := K) (tick := tick) allocation m sigma) + (a : Fin 3 → Raw (K := K) (tick := tick) allocation m sigma) + (hraw : groupRawSource F allocation m sigma (a 0) (a 1) (a 2) ≠ 0) + (hcoarse : reorder sigma (ownWord allocation m sigma (a 0), + ownWord allocation m sigma (a 1), ownWord allocation m sigma (a 2)) = + AllFieldGroupOrbitData.coarse allocation m sigma e) + (huseX : groupIdealSide allocation m ε (sigma 0) sigma e (a (sigma 0))) : + Compatible allocation m ε sigma 1 e (a (sigma 1)) := by + refine ⟨own_coarse_guard allocation m sigma e a hcoarse 1, ?_⟩ + intro right h u hd + apply JointPopulationCompatibility.shape_count_window_of_typeWindow + (Counts allocation m sigma) e h u _ _ _ + intro hu + have hz : halfShape right h u (sigma 2) = 0 := by + cases right <;> simpa [designated, halfShape, shapeNat] using hd.2 + have hw := CWStrandCompatibility.zeroZ_transfer + (fun _ : Class (Counts allocation m sigma) e h u => halfShape right h u ∘ sigma) + (fun i => if right then (a (sigma 0) h i.val).2 else (a (sigma 0) h i.val).1) + (fun i => if right then (a (sigma 1) h i.val).2 else (a (sigma 1) h i.val).1) + (fun i => if right then (a (sigma 2) h i.val).2 else (a (sigma 2) h i.val).1) + (priority_half_product_nonzero F allocation m sigma e a hraw hcoarse right h u hu) + (statistic h.val) (complement h) + (AllFieldGroupStatisticComplement.statistic_wordComplement h) + (halfLaw right (sigma 0) h u) (AllFieldHistoryMasks.childWidth ε h.val) + (fun _ => hz) (useful_half_window allocation m ε sigma (sigma 0) e _ huseX right h u hu) + simpa [compatibilityLaw, halfLaw] using hw + +theorem transferZ (F : Type*) [Field F] (allocation : Allocation) (m : ℕ) (ε : ℝ) + (sigma : Placement) (e : Targets (K := K) (tick := tick) allocation m sigma) + (a : Fin 3 → Raw (K := K) (tick := tick) allocation m sigma) + (hraw : groupRawSource F allocation m sigma (a 0) (a 1) (a 2) ≠ 0) + (hcoarse : reorder sigma (ownWord allocation m sigma (a 0), + ownWord allocation m sigma (a 1), ownWord allocation m sigma (a 2)) = + AllFieldGroupOrbitData.coarse allocation m sigma e) + (huseX : groupIdealSide allocation m ε (sigma 0) sigma e (a (sigma 0))) + (huseY : groupIdealSide allocation m ε (sigma 1) sigma e (a (sigma 1))) : + Compatible allocation m ε sigma 2 e (a (sigma 2)) := by + refine ⟨own_coarse_guard allocation m sigma e a hcoarse 2, ?_⟩ + intro right h u hd + apply JointPopulationCompatibility.shape_count_window_of_typeWindow + (Counts allocation m sigma) e h u _ _ _ + intro hu + have hz : halfShape right h u (sigma 0) * halfShape right h u (sigma 1) = 0 := by + cases right <;> simpa [designated, halfShape, shapeNat] using hd.2 + have hp := priority_half_product_nonzero F allocation m sigma e a hraw hcoarse right h u hu + by_cases hy : halfShape right h u (sigma 1) = 0 + · have hw := CWStrandCompatibility.zeroY_transfer + (fun _ : Class (Counts allocation m sigma) e h u => halfShape right h u ∘ sigma) + (fun i => if right then (a (sigma 0) h i.val).2 else (a (sigma 0) h i.val).1) + (fun i => if right then (a (sigma 1) h i.val).2 else (a (sigma 1) h i.val).1) + (fun i => if right then (a (sigma 2) h i.val).2 else (a (sigma 2) h i.val).1) + hp (statistic h.val) (complement h) + (AllFieldGroupStatisticComplement.statistic_wordComplement h) + (halfLaw right (sigma 0) h u) (AllFieldHistoryMasks.childWidth ε h.val) + (fun _ => hy) (useful_half_window allocation m ε sigma (sigma 0) e _ huseX right h u hu) + have hy' : (if right then activeParentShape h.val (sigma 1) - + (shapeSide (sigma 1) u).val else (shapeSide (sigma 1) u).val) = 0 := by + cases right <;> simpa [halfShape, shapeNat] using hy + simpa [compatibilityLaw, halfLaw, hy'] using hw + · have hx : halfShape right h u (sigma 0) = 0 := (Nat.mul_eq_zero.mp hz).resolve_right hy + have hw := CWStrandCompatibility.zeroX_transfer + (fun _ : Class (Counts allocation m sigma) e h u => halfShape right h u ∘ sigma) + (fun i => if right then (a (sigma 0) h i.val).2 else (a (sigma 0) h i.val).1) + (fun i => if right then (a (sigma 1) h i.val).2 else (a (sigma 1) h i.val).1) + (fun i => if right then (a (sigma 2) h i.val).2 else (a (sigma 2) h i.val).1) + hp (statistic h.val) (complement h) + (AllFieldGroupStatisticComplement.statistic_wordComplement h) + (halfLaw right (sigma 1) h u) (AllFieldHistoryMasks.childWidth ε h.val) + (fun _ => hx) (useful_half_window allocation m ε sigma (sigma 1) e _ huseY right h u hu) + have hy' : (if right then activeParentShape h.val (sigma 1) - + (shapeSide (sigma 1) u).val else (shapeSide (sigma 1) u).val) ≠ 0 := by + cases right <;> simpa [halfShape, shapeNat] using hy + simpa [compatibilityLaw, halfLaw, hy'] using hw + +end MatrixMultiplication.AllFieldGroupCompatibilityTransfer + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section + +namespace MatrixMultiplication.AllFieldGroupAssignments + +open AllFieldHistory AllFieldHistoryGroupMasks AllFieldHistoryGroupedRecovery +open AllFieldGroupOrbitData AllFieldGroupAssignmentRetention JointCoarseHashing +attribute [local instance] Classical.propDecidable + +variable {K tick : ℕ} + +theorem actualCompatible_own (allocation : Allocation) (m : ℕ) (ε : ℝ) + (sigma : Placement) (t : Triple (Pos (K := K) (tick := tick) allocation m sigma)) + (v : Variable (K := K) (tick := tick) allocation m sigma) + (hc : actualCompatible allocation m ε sigma t v) : + tripleSide v.1 t = ownWord allocation m sigma v.2 := by + obtain ⟨e, he, hc⟩ := hc + rw [← he] + exact hc.1 + +theorem physicalAssignment_coherent (F : Type*) [Field F] + (allocation : Allocation) (m : ℕ) (ε : ℝ) (sigma : Placement) + (k : ℕ) (U : Finset (ZMod (37 ^ k))) + (sample : Sample (Pos (K := K) (tick := tick) allocation m sigma) k) : + JointExtraction.Coherent (groupPreparedSource F allocation m ε sigma) + (physicalAssignment allocation m ε sigma k U sample) := by + intro x y z tx ty tz hT htx hty htz + let a : Fin 3 → Raw (K := K) (tick := tick) allocation m sigma := (Matrix.vecCons (x) (Matrix.vecCons (y) (Matrix.vecCons (z) Matrix.vecEmpty))) + let physicalTag : Fin 3 → Triple (Pos (K := K) (tick := tick) allocation m sigma) := + (Matrix.vecCons (tx) (Matrix.vecCons (ty) (Matrix.vecCons (tz) Matrix.vecEmpty))) + let b : Fin 3 → Raw (K := K) (tick := tick) allocation m sigma := fun r => a (sigma r) + let tag : Fin 3 → Triple (Pos (K := K) (tick := tick) allocation m sigma) := + fun r => physicalTag (sigma r) + have hphysical (r : Fin 3) : + assigned allocation m ε sigma k U sample (sigma.symm r, a r) = + some (physicalTag r) := by + fin_cases r + · exact htx + · exact hty + · exact htz + have hassign (r : Fin 3) : + assigned allocation m ε sigma k U sample (r, b r) = some (tag r) := by + simpa only [b, tag, sigma.symm_apply_apply] using hphysical (sigma r) + have hspec (r : Fin 3) := + assigned_spec allocation m ε sigma k U sample (r, b r) (tag r) (hassign r) + let d := data (K := K) (tick := tick) allocation m ε sigma + let hx := JointMaskedSelection.OrbitData.xFlag k U sample + let hy := JointMaskedSelection.OrbitData.yFlag k U sample + let hz := d.zFlag k U sample + have heligible (r : Fin 3) := + (JointCoarseAssignment.mem_eligible_iff d.ambient d.actualTargets hx hy hz (tag r)).mp + (hspec r).1 + let observed : Triple (Pos (K := K) (tick := tick) allocation m sigma) := + reorder sigma (ownWord allocation m sigma x, + ownWord allocation m sigma y, ownWord allocation m sigma z) + have hword (r : Fin 3) : + ownWord allocation m sigma (a r) = + tripleSide r (ownWord allocation m sigma x, + ownWord allocation m sigma y, ownWord allocation m sigma z) := by + fin_cases r <;> rfl + have hobserved (r : Fin 3) : tripleSide r observed = tripleSide r (tag r) := by + calc + tripleSide r observed = ownWord allocation m sigma (b r) := by + rw [show observed = reorder sigma (ownWord allocation m sigma x, + ownWord allocation m sigma y, ownWord allocation m sigma z) from rfl, + tripleSide_reorder] + exact (hword (sigma r)).symm + _ = tripleSide r (tag r) := + (actualCompatible_own allocation m ε sigma (tag r) (r, b r) (hspec r).2.1).symm + have hobsX : observed.1 = (tag 0).1 := hobserved 0 + have hobsY : observed.2.1 = (tag 1).2.1 := hobserved 1 + have hobsZ : observed.2.2 = (tag 2).2.2 := hobserved 2 + have hsurvives : JointCoarseAssignment.survives hx hy hz observed := by + refine ⟨?_, ?_, ?_⟩ + · rw [hobsX] + exact (heligible 0).2.2.1.1 + · rw [hobsY] + exact (heligible 1).2.2.1.2.1 + · rw [hobsZ] + exact (heligible 2).2.2.1.2.2 + have hsupport : observed ∈ d.ambient := + AllFieldGroupSourceSupport.prepared_source_support F allocation m ε sigma x y z hT + have hobs : observed = tag 0 := + (heligible 0).2.2.2 observed hsupport hsurvives hobsX + obtain ⟨e, he, huseX⟩ := (hspec 0).2.2.1 + have hcoarse : reorder sigma (ownWord allocation m sigma (a 0), + ownWord allocation m sigma (a 1), ownWord allocation m sigma (a 2)) = + coarse allocation m sigma e := hobs.trans he.symm + have hraw : groupRawSource F allocation m sigma (a 0) (a 1) (a 2) ≠ 0 := + AllFieldGroupSourceSupport.raw_nonzero F allocation m ε sigma x y z hT + have hcompY : actualCompatible allocation m ε sigma (tag 0) (1, b 1) := + ⟨e, he, AllFieldGroupCompatibilityTransfer.transferY F allocation m ε sigma e a + hraw hcoarse huseX⟩ + have h01 : tag 0 = tag 1 := (hspec 1).2.2.2 (tag 0) (hspec 0).1 hcompY + have huseY : groupIdealSide allocation m ε (sigma 1) sigma e (b 1) := by + apply (actualUseful_coarse allocation m ε sigma e (1, b 1)).mp + rw [he, h01] + exact (hspec 1).2.2.1 + have hcompZ : actualCompatible allocation m ε sigma (tag 0) (2, b 2) := + ⟨e, he, AllFieldGroupCompatibilityTransfer.transferZ F allocation m ε sigma e a + hraw hcoarse huseX huseY⟩ + have h02 : tag 0 = tag 2 := (hspec 2).2.2.2 (tag 0) (hspec 0).1 hcompZ + have htag (r : Fin 3) : tag r = tag 0 := by + fin_cases r + · rfl + · exact h01.symm + · exact h02.symm + have hphysicalTag (r : Fin 3) : physicalTag r = tag 0 := by + simpa only [tag, sigma.apply_symm_apply] using htag (sigma.symm r) + exact ⟨(hphysicalTag 0).trans (hphysicalTag 1).symm, + (hphysicalTag 0).trans (hphysicalTag 2).symm⟩ + +end MatrixMultiplication.AllFieldGroupAssignments + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/Construction/GroupBranchDesignation.lean b/lean/OAI/LinearAlgebra/MatrixFields/Construction/GroupBranchDesignation.lean new file mode 100644 index 0000000000000000000000000000000000000000..8b5b8c661554c1b094a6e8c405377d458201a6bd --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/Construction/GroupBranchDesignation.lean @@ -0,0 +1,63 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Entropy.GroupBranchLaws + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +noncomputable section + +namespace MatrixMultiplication.AllFieldGroupBranchDesignation + +open AllFieldHistory AllFieldHistoryChildLaws AllFieldGroupOrbitData +open AllFieldGroupNativeLaws +attribute [local instance] Classical.propDecidable Classical.decEq + +def nativeBranchDesignated {K : ℕ} (w : Work K) (right : Bool) + (side : Fin 3) (b : w.Branch) : Prop := + w.stage ≠ 2 ∧ AllFieldNativeCapacity.designated w.priority side + (halfShape w.parentShape (w.splitShape b) right) + +theorem sharing_iff_stage_ne_two {K tick : ℕ} {sigma : Placement} + (h : ActiveOrder K tick sigma) : + sharing h = true ↔ h.val.val.1.stage ≠ 2 := by + rcases h with ⟨⟨⟨w, phi⟩, ht⟩, ho⟩ + cases w <;> simp [sharing, Work.stage] + +theorem order_branch_childWeight {K tick : ℕ} {sigma : Placement} + (right : Bool) (h : ActiveOrder K tick sigma) (side : Fin 3) + (b : h.val.val.1.Branch) : + childWeight right h.val (branchShape h.val.val b) (sigma side) = + (halfShape h.val.val.1.parentShape (h.val.val.1.splitShape b) right) + (h.val.val.1.priority side) := by + rw [← halfShape_childWeight, canonicalChildShape_branchShape, + placement_symm_order_side] + +theorem designated_branchShape {K tick : ℕ} {sigma : Placement} + (right : Bool) (side : Fin 3) (h : ActiveOrder K tick sigma) + (hside : side ≠ 0) (b : h.val.val.1.Branch) : + AllFieldGroupOrbitData.designated right side sigma h (branchShape h.val.val b) ↔ + nativeBranchDesignated h.val.val.1 right side b := by + change (sharing h = true ∧ + (if side = 1 then childWeight right h.val (branchShape h.val.val b) (sigma 2) = 0 + else if side = 2 then + childWeight right h.val (branchShape h.val.val b) (sigma 0) * + childWeight right h.val (branchShape h.val.val b) (sigma 1) = 0 + else False)) ↔ _ + rw [sharing_iff_stage_ne_two] + simp only [order_branch_childWeight, nativeBranchDesignated, + AllFieldNativeCapacity.designated] + fin_cases side + · exact False.elim (hside rfl) + · simp + · simp + +end MatrixMultiplication.AllFieldGroupBranchDesignation + +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/Construction/GroupDegreeEnvelope.lean b/lean/OAI/LinearAlgebra/MatrixFields/Construction/GroupDegreeEnvelope.lean new file mode 100644 index 0000000000000000000000000000000000000000..1458f22baf4e3c5ed35160f396829295ea1ef863 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/Construction/GroupDegreeEnvelope.lean @@ -0,0 +1,126 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Histories.GroupOrbitTransport + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +noncomputable section + +namespace MatrixMultiplication.AllFieldGroupDegreeEnvelope + +open AllFieldHistory AllFieldGroupOrbitData Filter +open scoped Topology +attribute [local instance] Classical.propDecidable + +variable {K tick : ℕ} + +def variableDegree (allocation : Allocation) (m : ℕ) (width : ℝ) + (sigma : Placement) (e : Targets (K := K) (tick := tick) allocation m sigma) : ℕ := + ((data (K := K) (tick := tick) allocation m width sigma).orbits e).sup fun o => + ((data (K := K) (tick := tick) allocation m width sigma).passing e o).sup fun v => + ((data (K := K) (tick := tick) allocation m width sigma).competitors e o v).card + +def uniformDegree (allocation : Allocation) (m : ℕ) (width : ℝ) + (sigma : Placement) : ℕ := + Finset.univ.sup fun e : Targets (K := K) (tick := tick) allocation m sigma => + max ((data (K := K) (tick := tick) allocation m width sigma).eligibilityCompetitors e).card + (variableDegree (K := K) (tick := tick) allocation m width sigma e) + +theorem eligibility_card_le (allocation : Allocation) (m : ℕ) (width : ℝ) + (sigma : Placement) (e : Targets (K := K) (tick := tick) allocation m sigma) : + ((data (K := K) (tick := tick) allocation m width sigma).eligibilityCompetitors e).card ≤ + uniformDegree (K := K) (tick := tick) allocation m width sigma := + (le_max_left _ _).trans (Finset.le_sup (f := fun e => + max ((data (K := K) (tick := tick) allocation m width sigma).eligibilityCompetitors e).card + (variableDegree (K := K) (tick := tick) allocation m width sigma e)) (Finset.mem_univ e)) + +theorem competitors_card_le (allocation : Allocation) (m : ℕ) (width : ℝ) + (sigma : Placement) (e : Targets (K := K) (tick := tick) allocation m sigma) + (o : Orbit (K := K) (tick := tick) allocation m sigma) (ho : o ∈ (data (K := K) (tick := tick) allocation m width sigma).orbits e) + (v : Variable (K := K) (tick := tick) allocation m sigma) (hv : v ∈ (data (K := K) (tick := tick) allocation m width sigma).passing e o) : + ((data (K := K) (tick := tick) allocation m width sigma).competitors e o v).card ≤ + uniformDegree (K := K) (tick := tick) allocation m width sigma := by + have hvle := Finset.le_sup (f := fun v => + ((data (K := K) (tick := tick) allocation m width sigma).competitors e o v).card) hv + have hole := Finset.le_sup (f := fun o => + ((data (K := K) (tick := tick) allocation m width sigma).passing e o).sup fun v => + ((data (K := K) (tick := tick) allocation m width sigma).competitors e o v).card) ho + have hel := Finset.le_sup (f := fun e => + max ((data (K := K) (tick := tick) allocation m width sigma).eligibilityCompetitors e).card + (variableDegree (K := K) (tick := tick) allocation m width sigma e)) (Finset.mem_univ e) + exact hvle.trans (hole.trans ((le_max_right _ _).trans hel)) + +private theorem cast_max_le {a b : ℕ} {R : ℝ} + (ha : (a : ℝ) ≤ R) (hb : (b : ℝ) ≤ R) : ((max a b : ℕ) : ℝ) ≤ R := by + rcases le_total a b with hab | hba + · simpa only [max_eq_right hab] using hb + · simpa only [max_eq_left hba] using ha + +private theorem cast_sup_le {I : Type*} (s : Finset I) (f : I → ℕ) + {R : ℝ} (hR : 0 ≤ R) (hs : ∀ i ∈ s, (f i : ℝ) ≤ R) : + ((s.sup f : ℕ) : ℝ) ≤ R := by + classical + revert hs + induction s using Finset.induction_on with + | empty => + intro _ + simpa using hR + | @insert a s ha ih => + intro hs + rw [Finset.sup_insert] + exact cast_max_le (hs a (Finset.mem_insert_self a s)) + (ih (fun i hi => hs i (Finset.mem_insert_of_mem hi))) + +theorem uniformDegree_real_le (allocation : Allocation) (m : ℕ) (width : ℝ) + (sigma : Placement) {R : ℝ} (hR : 0 ≤ R) + (heligibility : ∀ e : Targets (K := K) (tick := tick) allocation m sigma, + (((data (K := K) (tick := tick) allocation m width sigma).eligibilityCompetitors e).card : ℝ) ≤ R) + (hcompetitors : ∀ e : Targets (K := K) (tick := tick) allocation m sigma, + ∀ o ∈ (data (K := K) (tick := tick) allocation m width sigma).orbits e, + ∀ v ∈ (data (K := K) (tick := tick) allocation m width sigma).passing e o, + (((data (K := K) (tick := tick) allocation m width sigma).competitors e o v).card : ℝ) ≤ R) : + (uniformDegree (K := K) (tick := tick) allocation m width sigma : ℝ) ≤ R := by + apply cast_sup_le _ _ hR + intro e _ + apply cast_max_le (heligibility e) + apply cast_sup_le _ _ hR + intro o ho + apply cast_sup_le _ _ hR + exact hcompetitors e o ho + +theorem eventually_log_uniformDegree_le (allocation : Allocation) (width : ℝ) + (sigma : Placement) {D : ℝ} (hD : 0 ≤ D) + (hcounts : ∀ᶠ m : ℕ in atTop, + (∀ e : Targets (K := K) (tick := tick) allocation m sigma, + (((data (K := K) (tick := tick) allocation m width sigma).eligibilityCompetitors e).card : ℝ) ≤ + Real.exp ((m : ℝ) * D)) ∧ + (∀ e : Targets (K := K) (tick := tick) allocation m sigma, + ∀ o ∈ (data (K := K) (tick := tick) allocation m width sigma).orbits e, + ∀ v ∈ (data (K := K) (tick := tick) allocation m width sigma).passing e o, + (((data (K := K) (tick := tick) allocation m width sigma).competitors e o v).card : ℝ) ≤ + Real.exp ((m : ℝ) * D))) : + ∀ᶠ m : ℕ in atTop, + Real.log (uniformDegree (K := K) (tick := tick) allocation m width sigma : ℝ) / + (m : ℝ) ≤ D := by + filter_upwards [hcounts, eventually_gt_atTop (0 : ℕ)] with m hm hmp + by_cases hz : uniformDegree (K := K) (tick := tick) allocation m width sigma = 0 + · simpa only [hz, Nat.cast_zero, Real.log_zero, zero_div] using hD + have hd : (0 : ℝ) < uniformDegree (K := K) (tick := tick) allocation m width sigma := by + exact_mod_cast Nat.pos_of_ne_zero hz + have hb := uniformDegree_real_le (K := K) (tick := tick) allocation m width sigma + (Real.exp_pos _).le hm.1 hm.2 + have hl := Real.log_le_log hd hb + rw [Real.log_exp] at hl + have hmpos : (0 : ℝ) < m := by exact_mod_cast hmp + exact (div_le_iff₀ hmpos).mpr (by simpa only [mul_comm] using hl) + +end MatrixMultiplication.AllFieldGroupDegreeEnvelope + +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/Construction/GroupNativeDegreeBound.lean b/lean/OAI/LinearAlgebra/MatrixFields/Construction/GroupNativeDegreeBound.lean new file mode 100644 index 0000000000000000000000000000000000000000..01323b1a3e226f75e678be2ecf6c2fbfccb48af5 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/Construction/GroupNativeDegreeBound.lean @@ -0,0 +1,108 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Entropy.GroupProjectedEntropy + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section + +namespace MatrixMultiplication.AllFieldGroupNativeDegreeBound + +open AllFieldHistory AllFieldActiveLaws AllFieldActiveCapacity +open AllFieldGroupOrbitData AllFieldGroupDegrees AllFieldGroupDegreeLaws +open AllFieldGroupCountRate AllFieldGroupPairWindows AllFieldGroupPairEntropy +open AllFieldGroupProjectedEntropy JointCompatibilityRateLimit +open MatrixMultiplication.Foundation Filter +open scoped BigOperators Topology +attribute [local instance] Classical.propDecidable Classical.decEq + +variable {K tick : ℕ} + +def maxNativeDegree (allocation : Allocation) (sigma : Placement) : ℝ := + max (orderNativeDegree (K := K) (tick := tick) allocation sigma 0) + (max (orderNativeDegree (K := K) (tick := tick) allocation sigma 1) + (orderNativeDegree (K := K) (tick := tick) allocation sigma 2)) + +theorem orderNativeDegree_le_max (allocation : Allocation) (sigma : Placement) (side : Fin 3) : + orderNativeDegree (K := K) (tick := tick) allocation sigma side ≤ + maxNativeDegree (K := K) (tick := tick) allocation sigma := by + fin_cases side + · exact le_max_left _ _ + · exact (le_max_left _ _).trans (le_max_right _ _) + · exact (le_max_right _ _).trans (le_max_right _ _) + +theorem nativeCompatibilityRate_eq (allocation : Allocation) (sigma : Placement) + (side : Fin 3) (hside : side ≠ 0) : + nativeCompatibilityRate (K := K) (tick := tick) allocation sigma side = + orderNativeDegree (K := K) (tick := tick) allocation sigma side := by + have hp := projected_native_entropy_eq (K := K) (tick := tick) allocation sigma side hside + have hb := baseEntropy_sub_pairReferenceEntropy (K := K) (tick := tick) allocation sigma side + unfold nativeCompatibilityRate compatibilityRate + rw [show ∀ a b c d : ℝ, a - b + c + d = (a - b) + (c + d) by intros; ring, + hb, hp, ← Finset.sum_add_distrib] + unfold orderNativeDegree + apply Finset.sum_congr rfl + intro h _ + have hs : (parentBase allocation h : ℝ) = + (populationLength (K := K) allocation 1 : ℝ) * orderMass allocation h := + population_cast_real allocation 1 (h.val.val.1.source, h.val.val.2) + rw [hs] + ring + +theorem exists_threshold_eventually_counts_le (allocation : Allocation) (sigma : Placement) + {δ widthMax : ℝ} (hδ : 0 < δ) (hwidthMax : 0 < widthMax) : + ∃ threshold : ℝ, 0 < threshold ∧ threshold ≤ widthMax ∧ + ∀ width : ℝ, 0 < width → width ≤ threshold → + ∀ᶠ m : ℕ in atTop, + (∀ e : Targets (K := K) (tick := tick) allocation m sigma, + (((data allocation m width sigma).eligibilityCompetitors e).card : ℝ) ≤ + Real.exp ((m : ℝ) * (maxNativeDegree (K := K) (tick := tick) allocation sigma + δ))) ∧ + (∀ (e : Targets (K := K) (tick := tick) allocation m sigma) (o : Orbit (K := K) (tick := tick) allocation m sigma), + o ∈ (data allocation m width sigma).orbits e → + ∀ v : Variable (K := K) (tick := tick) allocation m sigma, + v ∈ (data allocation m width sigma).passing e o → + (((data allocation m width sigma).competitors e o v).card : ℝ) ≤ + Real.exp ((m : ℝ) * (maxNativeDegree (K := K) (tick := tick) allocation sigma + δ))) := by + obtain ⟨t₁, ht₁, ht₁Max, h₁⟩ := + exists_threshold_eventually_competitors_le (K := K) (tick := tick) + allocation sigma 1 hδ hwidthMax + obtain ⟨t₂, ht₂, _, h₂⟩ := + exists_threshold_eventually_competitors_le (K := K) (tick := tick) + allocation sigma 2 hδ hwidthMax + refine ⟨min t₁ t₂, lt_min ht₁ ht₂, (min_le_left _ _).trans ht₁Max, ?_⟩ + intro width hw hwt + filter_upwards [eventually_eligibility_card_le (K := K) (tick := tick) + allocation sigma width hδ, + h₁ width hw (hwt.trans (min_le_left _ _)), + h₂ width hw (hwt.trans (min_le_right _ _))] with m hm₀ hm₁ hm₂ + have hm (side : Fin 3) : + Real.exp ((m : ℝ) * (orderNativeDegree (K := K) (tick := tick) allocation sigma side + δ)) ≤ + Real.exp ((m : ℝ) * (maxNativeDegree (K := K) (tick := tick) allocation sigma + δ)) := + Real.exp_le_exp.mpr (mul_le_mul_of_nonneg_left + (add_le_add (orderNativeDegree_le_max (K := K) (tick := tick) allocation sigma side) le_rfl) (Nat.cast_nonneg m)) + refine ⟨fun e => (hm₀ e).trans (hm 0), ?_⟩ + intro e o ho v hv + rcases v with ⟨side, w⟩ + fin_cases side + · exact (Nat.cast_le.mpr (Finset.card_le_card + (competitors_subset_eligibility_of_first allocation m width sigma e o (0, w) rfl))).trans + ((hm₀ e).trans (hm 0)) + · have hh := hm₁ e o ho w hv + rw [nativeCompatibilityRate_eq (K := K) (tick := tick) allocation sigma 1 (by decide)] at hh + exact hh.trans (hm 1) + · have hh := hm₂ e o ho w hv + rw [nativeCompatibilityRate_eq (K := K) (tick := tick) allocation sigma 2 (by decide)] at hh + exact hh.trans (hm 2) + +end MatrixMultiplication.AllFieldGroupNativeDegreeBound + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/Construction/InitialFamily.lean b/lean/OAI/LinearAlgebra/MatrixFields/Construction/InitialFamily.lean new file mode 100644 index 0000000000000000000000000000000000000000..7e135646fa362d86cd24bd36ee84480896e33bc0 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/Construction/InitialFamily.lean @@ -0,0 +1,314 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Extraction.InitialHash +import OAI.LinearAlgebra.MatrixFields.Histories.InitialOrbit + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +noncomputable section + +namespace MatrixMultiplication.AllFieldInitialGibbs + +open AllFieldParameters AllFieldHistory AllFieldInitialEntropy AllFieldInitialOrbit +open MatrixMultiplication.Foundation +open scoped BigOperators + +def coordinateWeight (k : Fin 17) : ℝ := + (weight (initialInteger k.val) : ℝ) + +def orderedWeight (u : JointPopulation.Shape) : ℝ := + ∏ s : Fin 3, coordinateWeight (JointPopulation.shapeSide s u) + +def initialNormalizer : ℝ := ((sortedInitial.map initialWeight).sum : ℚ) + +def initialPotential (k : Fin 17) : ℝ := Real.log (coordinateWeight k) + +def initialLogNormalizer : ℝ := Real.log initialNormalizer + +theorem coordinateWeight_pos (k : Fin 17) : 0 < coordinateWeight k := by + apply Rat.cast_pos.mpr + apply weight_positive_of_argument_bound + exact assigned_argument_bound _ tablea initial_table_arguments_bounded _ + +theorem orderedWeight_pos (u : JointPopulation.Shape) : 0 < orderedWeight u := + Finset.prod_pos (fun _ _ => coordinateWeight_pos _) + +theorem initialNormalizer_pos : 0 < initialNormalizer := by + apply Rat.cast_pos.mpr + exact list_sum_map_positive _ _ (by decide +kernel) + (fun s _ => initialWeight_positive s) + +theorem orderedWeight_source (p : PlacedInitial) : + orderedWeight (initialShapeCode p) = + ∏ s : Fin 3, (weight (initialInteger (sortedInitial.get p.1 s)) : ℝ) := by + simp only [orderedWeight, coordinateWeight, initialShapeCode_side] + exact p.2.symm.prod_comp + (fun s : Fin 3 => (weight (initialInteger (sortedInitial.get p.1 s)) : ℝ)) + +theorem initialWeight_source (p : PlacedInitial) : + (initialWeight (sortedInitial.get p.1) : ℝ) = + (initialMultiplicity (sortedInitial.get p.1) : ℝ) * + orderedWeight (initialShapeCode p) := by + rw [orderedWeight_source] + simp only [initialWeight] + push_cast + rfl + +theorem placedInitialLaw_mass (p : PlacedInitial) : + placedInitialLaw.mass p = + (initialMultiplicity (sortedInitial.get p.1) : ℝ) * + orderedWeight (initialShapeCode p) / initialNormalizer / 6 := by + change (initialLaw (sortedInitial.get p.1) : ℝ) / 6 = _ + rw [initialLaw, ite_eq_left (List.get_mem _ _), Rat.cast_div, initialWeight_source p] + rfl + +theorem orderedInitialLaw_mass (u : JointPopulation.Shape) + (hu : u.1.val + u.2.1.val + u.2.2.val = 16) : + orderedInitialLaw.mass u = orderedWeight u / initialNormalizer := by + classical + have hcount : (∑ p : PlacedInitial, + if initialShapeCode p = u then + (initialMultiplicity (sortedInitial.get p.1) : ℝ) else 0) = 6 := by + exact_mod_cast weighted_fiber_count u hu + simp only [orderedInitialLaw, FiniteLaw.map_mass, placedInitialLaw_mass] + calc + _ = (∑ p : PlacedInitial, if initialShapeCode p = u then + (initialMultiplicity (sortedInitial.get p.1) : ℝ) else 0) * + (orderedWeight u / initialNormalizer / 6) := by + rw [Finset.sum_mul] + apply Finset.sum_congr rfl + intro p _ + by_cases hp : initialShapeCode p = u + · simp only [hp, ite_true] + ring + · simp only [hp, ite_false, zero_mul] + _ = _ := by rw [hcount]; ring + +theorem orderedInitialLaw_zero (u : JointPopulation.Shape) + (hu : u.1.val + u.2.1.val + u.2.2.val ≠ 16) : + orderedInitialLaw.mass u = 0 := by + classical + simp only [orderedInitialLaw, FiniteLaw.map_mass] + apply Finset.sum_eq_zero + intro p _ + apply ite_eq_right + intro hp + have ht := source_total p + rw [hp] at ht + exact hu ht + +theorem orderedInitialLaw_mass_eq (u : JointPopulation.Shape) : + orderedInitialLaw.mass u = + if u.1.val + u.2.1.val + u.2.2.val = 16 + then orderedWeight u / initialNormalizer else 0 := by + split_ifs with hu + · exact orderedInitialLaw_mass u hu + · exact orderedInitialLaw_zero u hu + +theorem orderedInitialLaw_positive (u : JointPopulation.Shape) + (hu : u.1.val + u.2.1.val + u.2.2.val = 16) : + 0 < orderedInitialLaw.mass u := by + rw [orderedInitialLaw_mass u hu] + exact div_pos (orderedWeight_pos u) initialNormalizer_pos + +theorem orderedInitialLaw_support (u : JointPopulation.Shape) + (hu : 0 < orderedInitialLaw.mass u) : + u.1.val + u.2.1.val + u.2.2.val = 16 := by + by_contra hn + rw [orderedInitialLaw_zero u hn] at hu + exact lt_irrefl _ hu + +theorem log_orderedWeight (u : JointPopulation.Shape) : + Real.log (orderedWeight u) = + initialPotential (JointPopulation.shapeSide 0 u) + + initialPotential (JointPopulation.shapeSide 1 u) + + initialPotential (JointPopulation.shapeSide 2 u) := by + rw [orderedWeight, Real.log_prod + (fun s _ => ne_of_gt (coordinateWeight_pos (JointPopulation.shapeSide s u)))] + simp only [Fin.sum_univ_three, initialPotential] + +theorem orderedInitialLaw_log (u : JointPopulation.Shape) + (hu : 0 < orderedInitialLaw.mass u) : + Real.log (orderedInitialLaw.mass u) = + initialPotential (JointPopulation.shapeSide 0 u) + + initialPotential (JointPopulation.shapeSide 1 u) + + initialPotential (JointPopulation.shapeSide 2 u) - initialLogNormalizer := by + rw [orderedInitialLaw_mass u (orderedInitialLaw_support u hu), + Real.log_div (ne_of_gt (orderedWeight_pos u)) (ne_of_gt initialNormalizer_pos), + log_orderedWeight] + rfl + +end MatrixMultiplication.AllFieldInitialGibbs + +namespace MatrixMultiplication.AllFieldInitialFamily + +open MatrixMultiplication.Foundation AllFieldParameters AllFieldHistory AllFieldFiniteFamily +open AllFieldInitialEntropy JointOrdinaryPopulationSelection Filter +open scoped BigOperators Topology + +attribute [local instance] Classical.propDecidable + +variable {K : ℕ} (allocation : Allocation) + +def grid : ℕ := populationLength (K := K) allocation 1 + +theorem grid_pos : 0 < grid (K := K) allocation := + AllFieldPopulationCounts.blockLength_pos (amount (K := K) allocation) (by decide) + +theorem populationLength_eq_mul_grid (dilation : ℕ) : + populationLength (K := K) allocation dilation = dilation * grid (K := K) allocation := by + simp only [grid, populationLength, AllFieldPopulationCounts.blockLength, one_mul] + +theorem initialJointCounts_dilation_ratio {dilation : ℕ} (hd : 0 < dilation) + (j : Fin K) (u : JointPopulation.Shape) : + (initialJointCounts allocation dilation j u : ℝ) / (dilation : ℝ) = + (grid (K := K) allocation : ℝ) * orderedInitialLaw.mass u := by + rw [initialJointCounts_cast, populationLength_eq_mul_grid, Nat.cast_mul, mul_assoc] + have hd' : (dilation : ℝ) ≠ 0 := Nat.cast_ne_zero.mpr (Nat.ne_of_gt hd) + exact mul_div_cancel_left₀ _ hd' + +theorem initialJointCounts_dilation_rate (j : Fin K) (u : JointPopulation.Shape) : + Tendsto (fun dilation : ℕ => + (initialJointCounts allocation dilation j u : ℝ) / (dilation : ℝ)) atTop + (𝓝 ((grid (K := K) allocation : ℝ) * orderedInitialLaw.mass u)) := by + apply tendsto_const_nhds.congr' + filter_upwards [eventually_gt_atTop (0 : ℕ)] with dilation hd + exact (initialJointCounts_dilation_ratio allocation hd j u).symm + +theorem native_dilation_capacity : + entropyRate (fun _ : Fin K => (grid (K := K) allocation : ℝ)) + (fun _ => orderedInitialLaw) - + degreeRate (fun _ : Fin K => (grid (K := K) allocation : ℝ)) + (fun _ => orderedInitialLaw) = + (grid (K := K) allocation : ℝ) * ((K : ℝ) * nativeH0) := by + simp only [entropyRate, degreeRate, sideDegreeRate, orderedInitialLaw_side_entropy, + Finset.sum_const, Finset.card_univ, Fintype.card_fin, nsmul_eq_mul, max_self] + ring + +def hashRate (ε : ℝ) : ℝ := + selectionHashRate (fun _ : Fin K => (grid (K := K) allocation : ℝ)) + (fun _ => orderedInitialLaw) ((grid (K := K) allocation : ℝ) * ε) + +theorem selection_exponent (ε : ℝ) (dilation : ℕ) : + (dilation : ℝ) * + (entropyRate (fun _ : Fin K => (grid (K := K) allocation : ℝ)) + (fun _ => orderedInitialLaw) - + degreeRate (fun _ : Fin K => (grid (K := K) allocation : ℝ)) + (fun _ => orderedInitialLaw) - (grid (K := K) allocation : ℝ) * ε) = + (populationLength (K := K) allocation dilation : ℝ) * ((K : ℝ) * nativeH0 - ε) := by + rw [native_dilation_capacity, populationLength_eq_mul_grid, Nat.cast_mul] + ring + +abbrev Sample (ε : ℝ) (dilation : ℕ) := + JointCoarseHashing.Sample (JointPopulation.Position + (initialJointCounts (K := K) allocation dilation)) + (JointOrdinarySelection.hashLevel (hashRate (K := K) allocation ε) dilation) + +def Good (ε : ℝ) (dilation : ℕ) + (s : Sample (K := K) allocation ε dilation) + (e : JointPopulation.Target (initialJointCounts (K := K) allocation dilation)) : Prop := + JointOrdinarySelection.Good + (JointOrdinarySelection.hashLevel (hashRate (K := K) allocation ε) dilation) + (JointOrdinarySelection.hashSet (hashRate (K := K) allocation ε) dilation) + (JointPopulation.ambientSet (initialJointCounts allocation dilation) (fun _ => 16)) + (JointPopulation.triple (initialJointCounts allocation dilation) e) s + +def executionWithWidth (F : Type*) [Field F] (ε residentWidth : ℝ) (dilation : ℕ) + (s : Sample (K := K) allocation ε dilation) + (G : Finset (JointPopulation.Target (initialJointCounts (K := K) allocation dilation))) + (hgood : ∀ e ∈ G, Good allocation ε dilation s e) : + Execution (cwSource F K (populationLength (K := K) allocation dilation)) + (Tensor.directSum (fun _ : AllFieldInitialHash.SelectedTargets + (initialJointCounts (K := K) allocation dilation) G => + stateTensor F (K := K) allocation dilation residentWidth 0)) := + AllFieldInitialState.execution allocation dilation F residentWidth + (AllFieldInitialHash.selectedExecution (F := F) + (initialJointCounts allocation dilation) (initialJointCounts_sum allocation dilation) + (initialJointCounts_support allocation dilation) + (JointOrdinarySelection.hashLevel (hashRate (K := K) allocation ε) dilation) + (JointOrdinarySelection.hashSet (hashRate (K := K) allocation ε) dilation) + (JointOrdinarySelection.hashSet_AP (hashRate (K := K) allocation ε) dilation) + s G hgood) + +@[simp] theorem executionWithWidth_copies (F : Type*) [Field F] + (ε residentWidth : ℝ) (dilation : ℕ) + (s : Sample (K := K) allocation ε dilation) + (G : Finset (JointPopulation.Target (initialJointCounts (K := K) allocation dilation))) + (hgood : ∀ e ∈ G, Good allocation ε dilation s e) : + Fintype.card + (executionWithWidth allocation F ε residentWidth dilation s G hgood).Copies = 1 := rfl + +def execution (F : Type*) [Field F] (ε : ℝ) (dilation : ℕ) + (s : Sample (K := K) allocation ε dilation) + (G : Finset (JointPopulation.Target (initialJointCounts (K := K) allocation dilation))) + (hgood : ∀ e ∈ G, Good allocation ε dilation s e) : + Execution (cwSource F K (populationLength (K := K) allocation dilation)) + (Tensor.directSum (fun _ : AllFieldInitialHash.SelectedTargets + (initialJointCounts (K := K) allocation dilation) G => + stateTensor F (K := K) allocation dilation ε 0)) := + executionWithWidth allocation F ε ε dilation s G hgood + +@[simp] theorem execution_copies (F : Type*) [Field F] (ε : ℝ) (dilation : ℕ) + (s : Sample (K := K) allocation ε dilation) + (G : Finset (JointPopulation.Target (initialJointCounts (K := K) allocation dilation))) + (hgood : ∀ e ∈ G, Good allocation ε dilation s e) : + Fintype.card (execution allocation F ε dilation s G hgood).Copies = 1 := rfl + +theorem eventually_exists_execution_with_width (F : Type*) [Field F] + (residentWidth : ℝ) {ε : ℝ} (hε : 0 < ε) : + ∀ᶠ dilation in atTop, + ∃ (s : Sample (K := K) allocation ε dilation) + (G : Finset (JointPopulation.Target (initialJointCounts (K := K) allocation dilation))), + G.card = ⌊Real.exp ((populationLength (K := K) allocation dilation : ℝ) * + ((K : ℝ) * nativeH0 - ε))⌋₊ ∧ + (∀ e ∈ G, Good allocation ε dilation s e) ∧ + ∃ E : Execution (cwSource F K (populationLength (K := K) allocation dilation)) + (Tensor.directSum (fun _ : AllFieldInitialHash.SelectedTargets + (initialJointCounts (K := K) allocation dilation) G => + stateTensor F (K := K) allocation dilation residentWidth 0)), + Fintype.card E.Copies = 1 := by + have hslack : 0 < (grid (K := K) allocation : ℝ) * ε := + mul_pos (by exact_mod_cast grid_pos (K := K) allocation) hε + have hselection := JointOrdinaryPopulationSelection.eventually_exists_selection + (fun dilation => initialJointCounts (K := K) allocation dilation) (fun _ => 16) + (fun _ : Fin K => (grid (K := K) allocation : ℝ)) (fun _ => orderedInitialLaw) + (fun _ => AllFieldInitialGibbs.initialPotential) + (fun _ => AllFieldInitialGibbs.initialPotential) + (fun _ => AllFieldInitialGibbs.initialPotential) + (fun _ => AllFieldInitialGibbs.initialLogNormalizer) + (fun _ => Nat.cast_nonneg _) + (fun dilation => initialJointCounts_support allocation dilation) + (fun _ => AllFieldInitialGibbs.orderedInitialLaw_positive) + (fun _ => AllFieldInitialGibbs.orderedInitialLaw_log) + (initialJointCounts_dilation_rate allocation) hslack + filter_upwards [hselection] with dilation hd + obtain ⟨s, G, hcard, hgood, _hpairwise⟩ := hd + rw [selection_exponent allocation ε dilation] at hcard + exact ⟨s, G, hcard, hgood, + executionWithWidth allocation F ε residentWidth dilation s G hgood, + executionWithWidth_copies allocation F ε residentWidth dilation s G hgood⟩ + +theorem eventually_exists_execution (F : Type*) [Field F] {ε : ℝ} (hε : 0 < ε) : + ∀ᶠ dilation in atTop, + ∃ (s : Sample (K := K) allocation ε dilation) + (G : Finset (JointPopulation.Target (initialJointCounts (K := K) allocation dilation))), + G.card = ⌊Real.exp ((populationLength (K := K) allocation dilation : ℝ) * + ((K : ℝ) * nativeH0 - ε))⌋₊ ∧ + (∀ e ∈ G, Good allocation ε dilation s e) ∧ + ∃ E : Execution (cwSource F K (populationLength (K := K) allocation dilation)) + (Tensor.directSum (fun _ : AllFieldInitialHash.SelectedTargets + (initialJointCounts (K := K) allocation dilation) G => + stateTensor F (K := K) allocation dilation ε 0)), + Fintype.card E.Copies = 1 := + eventually_exists_execution_with_width allocation F ε hε + +end MatrixMultiplication.AllFieldInitialFamily + +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/Construction/InitialHistories.lean b/lean/OAI/LinearAlgebra/MatrixFields/Construction/InitialHistories.lean new file mode 100644 index 0000000000000000000000000000000000000000..9b26710f642a51b1177a3707c64f1e18e8bc81c1 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/Construction/InitialHistories.lean @@ -0,0 +1,76 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Histories.HistoryChildLaws + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +noncomputable section +namespace MatrixMultiplication.AllFieldHistory + +open AllFieldParameters +open scoped BigOperators +attribute [local instance] Classical.propDecidable Classical.decEq + +theorem shapeCounts_fiber {I : Type*} [Fintype I] (code : I → JointPopulation.Shape) + (weight : I → ℕ) (u : JointPopulation.Shape) : + shapeCounts code weight u = ∑ i : {i : I // code i = u}, weight i.val := by + unfold shapeCounts + rw [← Finset.sum_filter] + exact Finset.sum_subtype _ (by intro i; simp) weight + +def shapeCountFiberEquiv {I : Type*} [Fintype I] (code : I → JointPopulation.Shape) + (weight : I → ℕ) (u : JointPopulation.Shape) : + Fin (shapeCounts code weight u) ≃ + (Σ i : {i : I // code i = u}, Fin (weight i.val)) := + Fintype.equivOfCardEq (by + simp only [Fintype.card_fin, Fintype.card_sigma, shapeCounts_fiber]) + +abbrev InitialPlacement (K : ℕ) := Initial K × Placement + +abbrev InitialShapeFiber {K : ℕ} (j : Fin K) (u : JointPopulation.Shape) := + {p : Fin sortedInitial.length × Placement // rootShape (j, p.1) p.2 = u} + +def initialClassPositionEquiv {K : ℕ} (allocation : Allocation) (dilation : ℕ) + (j : Fin K) (u : JointPopulation.Shape) : + Fin (initialJointCounts allocation dilation j u) ≃ + (Σ p : InitialShapeFiber j u, + Fin (population allocation dilation (.initial (j, p.val.1), p.val.2))) := + shapeCountFiberEquiv _ _ u + +theorem initialClassPosition_shape {K : ℕ} (allocation : Allocation) (dilation : ℕ) + (j : Fin K) (u : JointPopulation.Shape) + (i : Fin (initialJointCounts allocation dilation j u)) : + rootShape (j, (initialClassPositionEquiv allocation dilation j u i).1.val.1) + (initialClassPositionEquiv allocation dilation j u i).1.val.2 = u := + (initialClassPositionEquiv allocation dilation j u i).1.property + +def initialStateEquiv (K : ℕ) : State K 0 ≃ InitialPlacement K where + toFun h := by + rcases h with ⟨⟨h, phi⟩, hr⟩ + cases h with + | initial g => exact (g, phi) + | afterA a => have := hr.1; dsimp [resident] at hr; omega + | afterB b => have := hr.1; dsimp [resident] at hr; omega + | partC c => dsimp [resident] at hr; omega + | afterC c => dsimp [resident] at hr; omega + invFun h := ⟨(.initial h.1, h.2), fun _ => Nat.zero_le _⟩ + left_inv h := by + rcases h with ⟨⟨h, phi⟩, hr⟩ + cases h with + | initial g => rfl + | afterA a => have := hr.1; dsimp [resident] at hr; omega + | afterB b => have := hr.1; dsimp [resident] at hr; omega + | partC c => dsimp [resident] at hr; omega + | afterC c => dsimp [resident] at hr; omega + right_inv h := rfl + +end MatrixMultiplication.AllFieldHistory + +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/Construction/InitialState.lean b/lean/OAI/LinearAlgebra/MatrixFields/Construction/InitialState.lean new file mode 100644 index 0000000000000000000000000000000000000000..22ca53a4ef5dae2e1eaed09ec92fce66fcd1d33d --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/Construction/InitialState.lean @@ -0,0 +1,1496 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Arithmetic.ArithmeticExponent +import OAI.LinearAlgebra.MatrixFields.Construction.ComplexPolynomialWitnessProduct +import OAI.LinearAlgebra.MatrixFields.Construction.InitialHistories +import OAI.LinearAlgebra.MatrixFields.Entropy.RectangularGrowth +import OAI.LinearAlgebra.MatrixFields.Histories.HistoryPositions + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section + +namespace MatrixMultiplication + +open MatrixMultiplication.Foundation + +namespace Arithmetic + +variable {F : Type*} [Field F] + +theorem rectangularAdmissibleExponent_of_rankAtMost + {a b R : ℕ} (ha : 2 ≤ a) {k τ : ℝ} (hk : 0 ≤ k) + (hab : (a : ℝ) ^ k ≤ (b : ℝ)) + (hRank : MatrixMultiplication.Foundation.Tensor.RankAtMost + (MatrixMultiplication.Foundation.Tensor.matrixCoefficients (K := F) (Fin a) (Fin b) (Fin a)) R) + (hτ : 0 ≤ τ) (hR : (R : ℝ) ≤ (a : ℝ) ^ τ) + (hin : (a * b : ℕ) ≤ (a : ℝ) ^ τ) + (hout : (a : ℝ) ^ (2 : ℕ) ≤ (a : ℝ) ^ τ) : + RectangularAdmissibleExponent F k τ := by + apply rectangularAdmissibleExponent_of_block_step + (K := 2 * R * (2 * (a * b) + a ^ 2)) ha hk hab hτ hR hin hout + · exact ⟨scalarAlgorithm F, scalarAlgorithm_correct F, (scalarAlgorithm_cost F).le⟩ + · intro m p P hP + obtain ⟨Q, hQ, hcost⟩ := RecursiveBlock.rank_block_step hRank P hP + refine ⟨Q, hQ, ?_⟩ + rw [hcost] + nlinarith [Nat.zero_le (2 * R * (2 * (a * b) * m ^ 2 + a ^ 2 * (m * p)))] + +theorem rectangular_rpow_omega_le_of_rankAtMost + {a b R : ℕ} {B k : ℝ} (ha : 2 ≤ a) (hk : 0 ≤ k) + (hab : (a : ℝ) ^ k ≤ (b : ℝ)) + (hRank : MatrixMultiplication.Foundation.Tensor.RankAtMost + (MatrixMultiplication.Foundation.Tensor.matrixCoefficients (K := F) (Fin a) (Fin b) (Fin a)) R) + (hout : (a : ℝ) ^ (2 : ℕ) ≤ B) (hin : (a * b : ℕ) ≤ B) + (hR : (R : ℝ) ≤ B) : + (a : ℝ) ^ rectangularOmega F k ≤ B := by + have ha1 : 1 < (a : ℝ) := by exact_mod_cast (by omega : 1 < a) + have ha0 : 0 < (a : ℝ) := lt_trans zero_lt_one ha1 + have hB : 0 < B := (sq_pos_of_pos ha0).trans_le hout + have hpow : (a : ℝ) ^ Real.logb a B = B := + Real.rpow_logb ha0 (ne_of_gt ha1) hB + have hτ : 2 ≤ Real.logb (a : ℝ) B := by + apply (Real.le_logb_iff_rpow_le ha1 hB).mpr + simpa only [Real.rpow_two] using hout + have hadm := rectangularAdmissibleExponent_of_rankAtMost ha hk hab hRank + (by linarith : 0 ≤ Real.logb (a : ℝ) B) + (hR.trans_eq hpow.symm) (hin.trans_eq hpow.symm) (hout.trans_eq hpow.symm) + exact (Real.rpow_le_rpow_of_exponent_le ha1.le + (rectangularOmega_le_of_admissibleExponent hadm)).trans_eq hpow + +theorem rectangular_rpow_omega_le_of_rank_growth + {a b : ℕ} {q C k : ℝ} (ha : 2 ≤ a) (hk : 0 ≤ k) + (hab : (a : ℝ) ^ k ≤ (b : ℝ)) + (hout : (a : ℝ) ^ (2 : ℕ) ≤ q) (hin : (a * b : ℕ) ≤ q) + (R : ℕ → ℕ) + (hRank : ∀ t, MatrixMultiplication.Foundation.Tensor.RankAtMost + (MatrixMultiplication.Foundation.Tensor.matrixCoefficients (K := F) + (Fin (a ^ t)) (Fin (b ^ t)) (Fin (a ^ t))) (R t)) + (hcost : ∀ t, (R t : ℝ) ≤ C * q ^ t) : + (a : ℝ) ^ rectangularOmega F k ≤ q := by + have ha0 : 0 ≤ (a : ℝ) := Nat.cast_nonneg a + have hq0 : 0 ≤ q := (sq_nonneg (a : ℝ)).trans hout + apply power_le_of_forall_pow_le_mul_pow hq0 (C := max 1 C) + intro t ht + have hat : 2 ≤ a ^ t := ha.trans (le_self_pow (by omega) (Nat.ne_of_gt ht)) + have habt : ((a ^ t : ℕ) : ℝ) ^ k ≤ ((b ^ t : ℕ) : ℝ) := by + rw [Nat.cast_pow, Nat.cast_pow, ← Real.rpow_pow_comm ha0] + exact pow_le_pow_left₀ (Real.rpow_nonneg (Nat.cast_nonneg a) k) hab t + have hbase : ((a ^ t : ℕ) : ℝ) ^ (2 : ℕ) ≤ max 1 C * q ^ t := by + calc + ((a ^ t : ℕ) : ℝ) ^ (2 : ℕ) = ((a : ℝ) ^ (2 : ℕ)) ^ t := by + rw [Nat.cast_pow, ← pow_mul, ← pow_mul, Nat.mul_comm t 2] + _ ≤ q ^ t := by gcongr + _ ≤ max 1 C * q ^ t := by + simpa only [one_mul] using + mul_le_mul_of_nonneg_right (le_max_left (1 : ℝ) C) (pow_nonneg hq0 t) + have hinput : ((a ^ t * b ^ t : ℕ) : ℝ) ≤ max 1 C * q ^ t := by + calc + ((a ^ t * b ^ t : ℕ) : ℝ) = (((a * b : ℕ) : ℝ)) ^ t := by + simp only [Nat.cast_mul, Nat.cast_pow, mul_pow] + _ ≤ q ^ t := pow_le_pow_left₀ (Nat.cast_nonneg _) hin t + _ ≤ max 1 C * q ^ t := by + simpa only [one_mul] using + mul_le_mul_of_nonneg_right (le_max_left (1 : ℝ) C) (pow_nonneg hq0 t) + have hcost' : (R t : ℝ) ≤ max 1 C * q ^ t := + (hcost t).trans (mul_le_mul_of_nonneg_right (le_max_right (1 : ℝ) C) + (pow_nonneg hq0 t)) + have h := rectangular_rpow_omega_le_of_rankAtMost hat hk habt + (hRank t) hbase hinput hcost' + simpa only [Nat.cast_pow, ← Real.rpow_pow_comm ha0] using h + +theorem equalRectangular_inequality {a b L r : ℕ} {k : ℝ} + (ha : 2 ≤ a) (hk : 0 ≤ k) (hab : (a : ℝ) ^ k ≤ (b : ℝ)) + (hbatch : MatrixMultiplication.Foundation.Tensor.RankAtMost + (MatrixMultiplication.Foundation.Tensor.directSum (fun _ : Fin L => + MatrixMultiplication.Foundation.Tensor.matrixCoefficients (K := F) + (Fin a) (Fin b) (Fin a))) r) : + (L : ℝ) * (a : ℝ) ^ rectangularOmega F k ≤ (r : ℝ) := by + by_cases hL0 : L = 0 + · subst L + simp + have hL : 0 < L := Nat.pos_of_ne_zero hL0 + have ha0 : 0 < a := by omega + have hb0 : 0 < b := by + have hbR : (0 : ℝ) < (b : ℝ) := + (Real.rpow_pos_of_pos (by exact_mod_cast ha0) k).trans_le hab + exact_mod_cast hbR + have hlower := Tensor.rectangular_directSum_rank_lower ha0 hb0 hbatch + have hLR : 0 < (L : ℝ) := by exact_mod_cast hL + have hout : (a : ℝ) ^ (2 : ℕ) ≤ (r : ℝ) / (L : ℝ) := by + apply (le_div_iff₀ hLR).mpr + have hh : (L : ℝ) * (a : ℝ) ^ (2 : ℕ) ≤ (r : ℝ) := by exact_mod_cast hlower.1 + simpa only [mul_comm] using hh + have hin : ((a * b : ℕ) : ℝ) ≤ (r : ℝ) / (L : ℝ) := by + apply (le_div_iff₀ hLR).mpr + have hh : (L : ℝ) * ((a * b : ℕ) : ℝ) ≤ (r : ℝ) := by exact_mod_cast hlower.2 + simpa only [mul_comm] using hh + have haR : (2 : ℝ) ≤ a := by exact_mod_cast ha + have hq : 1 < (r : ℝ) / (L : ℝ) := by nlinarith + have hcost := affine_recurrence_bound (fun t => (batchRank L r t : ℝ)) + ((r : ℝ) / (L : ℝ)) (r : ℝ) hq (Nat.cast_nonneg r) + (fun t => batchRank_succ_le_affine hL r t) + have hbound : (a : ℝ) ^ rectangularOmega F k ≤ (r : ℝ) / (L : ℝ) := by + apply rectangular_rpow_omega_le_of_rank_growth + (C := (batchRank L r 0 : ℝ) + (r : ℝ) / ((r : ℝ) / (L : ℝ) - 1)) + ha hk hab hout hin (batchRank L r) + · exact Tensor.rectangular_pow_batchRank hL hbatch + · intro t + exact (hcost t).trans_eq (mul_comm _ _) + simpa only [mul_comm] using (le_div_iff₀ hLR).mp hbound + +theorem power_le_of_forall_pow_le_square_linear_mul_pow (d : ℕ) {x r : ℝ} + (hr : 0 ≤ r) + (h : ∀ n : ℕ, 0 < n → x ^ n ≤ ((d * n + 1 : ℕ) : ℝ) ^ 2 * r ^ n) : + x ≤ r := by + apply power_le_of_forall_pow_le_linear_mul_pow (2 * d) hr + intro n hn + apply le_of_pow_le_pow_left₀ (by decide : (2 : ℕ) ≠ 0) + (mul_nonneg (Nat.cast_nonneg _) (pow_nonneg hr n)) + have he := h (n * 2) (Nat.mul_pos hn (by decide)) + have hcount : d * (n * 2) + 1 = 2 * d * n + 1 := by ring + simpa only [pow_mul, hcount, mul_pow] using he + +theorem equalRectangular_inequality_of_polynomialApproximation + {a b L r d D : ℕ} {k : ℝ} + (ha : 2 ≤ a) (hk : 0 ≤ k) (hab : (a : ℝ) ^ k ≤ (b : ℝ)) + (P : MatrixMultiplication.Foundation.Tensor.PolynomialApproximation + (MatrixMultiplication.Foundation.Tensor.directSum (fun _ : Fin L => + MatrixMultiplication.Foundation.Tensor.matrixCoefficients (K := F) + (Fin a) (Fin b) (Fin a))) r d D) : + (L : ℝ) * (a : ℝ) ^ rectangularOmega F k ≤ (r : ℝ) := by + apply power_le_of_forall_pow_le_square_linear_mul_pow d (Nat.cast_nonneg r) + intro t ht + have hat : 2 ≤ a ^ t := ha.trans (le_self_pow (by omega) (Nat.ne_of_gt ht)) + have habt : ((a ^ t : ℕ) : ℝ) ^ k ≤ ((b ^ t : ℕ) : ℝ) := by + rw [Nat.cast_pow, Nat.cast_pow, ← Real.rpow_pow_comm (Nat.cast_nonneg a)] + exact pow_le_pow_left₀ (Real.rpow_nonneg (Nat.cast_nonneg a) k) hab t + have h := equalRectangular_inequality hat hk habt + (Tensor.rectangular_directSum_power_rank (FieldCoefficientExtraction.rank_power P t)) + simpa only [Nat.cast_pow, Nat.cast_mul, mul_pow, + ← Real.rpow_pow_comm (Nat.cast_nonneg a)] using h + +theorem equalRectangular_log_inequality_of_polynomialApproximation + {a b L r d D : ℕ} {k : ℝ} + (ha : 2 ≤ a) (hL : 0 < L) (hk : 0 ≤ k) + (hab : (a : ℝ) ^ k ≤ (b : ℝ)) + (P : MatrixMultiplication.Foundation.Tensor.PolynomialApproximation + (MatrixMultiplication.Foundation.Tensor.directSum (fun _ : Fin L => + MatrixMultiplication.Foundation.Tensor.matrixCoefficients (K := F) + (Fin a) (Fin b) (Fin a))) r d D) : + rectangularOmega F k * Real.log (a : ℝ) ≤ Real.log (r : ℝ) - Real.log (L : ℝ) := by + have ha0 : (0 : ℝ) < a := by exact_mod_cast (by omega : 0 < a) + have hL0 : (0 : ℝ) < L := by exact_mod_cast hL + have hpow := Real.rpow_pos_of_pos ha0 (rectangularOmega F k) + have hbound := equalRectangular_inequality_of_polynomialApproximation ha hk hab P + have hlog := Real.log_le_log (mul_pos hL0 hpow) hbound + rw [Real.log_mul (ne_of_gt hL0) (ne_of_gt hpow), Real.log_rpow ha0] at hlog + linarith + +theorem equalSquare_inequality_of_polynomialApproximation + {n L r d D : ℕ} (hn : 1 ≤ n) + (P : MatrixMultiplication.Foundation.Tensor.PolynomialApproximation + (MatrixMultiplication.Foundation.Tensor.directSum (fun _ : Fin L => + MatrixMultiplication.Foundation.Tensor.matrixCoefficients (K := F) + (Fin n) (Fin n) (Fin n))) r d D) : + (L : ℝ) * (n : ℝ) ^ omega F ≤ (r : ℝ) := by + by_cases hn1 : n = 1 + · subst n + simp only [Nat.cast_one, Real.one_rpow, mul_one] + apply power_le_of_forall_pow_le_square_linear_mul_pow d (Nat.cast_nonneg r) + intro t ht + have hrank := Tensor.rectangular_directSum_power_rank + (FieldCoefficientExtraction.rank_power P t) + have hlower := MatrixMultiplication.Foundation.Tensor.directSum_square_rank_lower + (L ^ t) (1 ^ t) ((d * t + 1) ^ 2 * r ^ t) (by simp) hrank + have hcast := (Nat.cast_le (α := ℝ)).mpr hlower + simpa only [one_pow, mul_one, Nat.cast_mul, Nat.cast_pow] using hcast + · have h := equalRectangular_inequality_of_polynomialApproximation + (by omega : 2 ≤ n) (by norm_num : (0 : ℝ) ≤ 1) + (by simp : (n : ℝ) ^ (1 : ℝ) ≤ (n : ℝ)) P + simpa only [rectangularOmega_one] using h + +theorem equalVolume_inequality_of_polynomialApproximation + {a b c L r d D : ℕ} (ha : 1 ≤ a) (hb : 1 ≤ b) (hc : 1 ≤ c) + (P : MatrixMultiplication.Foundation.Tensor.PolynomialApproximation + (MatrixMultiplication.Foundation.Tensor.directSum (fun _ : Fin L => + MatrixMultiplication.Foundation.Tensor.matrixCoefficients (K := F) + (Fin a) (Fin b) (Fin c))) r d D) : + (L : ℝ) * ((a * b * c : ℕ) : ℝ) ^ (omega F / 3) ≤ (r : ℝ) := by + let tags : Fin (L ^ 3) ≃ (Fin L × Fin L) × Fin L := + Fintype.equivOfCardEq (by simp [pow_succ]) + let indices : Fin (a * b * c) ≃ Fin a × Fin b × Fin c := + Fintype.equivOfCardEq (by simp [mul_assoc]) + have Q := P.matrixCoefficients_directSum_symmetrized.matrixCoefficients_directSum_of_injective + tags tags.injective indices indices.injective + have h := equalSquare_inequality_of_polynomialApproximation + (Nat.mul_pos (Nat.mul_pos ha hb) hc) Q + apply mul_rpow_third_le_of_cube (Nat.cast_nonneg (a * b * c)) (Nat.cast_nonneg r) + simpa only [Nat.cast_pow] using h + +end Arithmetic +end MatrixMultiplication + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section + +namespace MatrixMultiplication + +open MatrixMultiplication.Foundation + +structure AllFieldWitness (F : Type*) [Field F] where + rows : ℕ + inner : ℕ + columns : ℕ + multiplicity : ℕ + rankBound : ℕ + order : ℕ + degree : ℕ + rows_pos : 0 < rows + inner_pos : 0 < inner + columns_pos : 0 < columns + multiplicity_pos : 0 < multiplicity + rankBound_pos : 0 < rankBound + approximation : Tensor.PolynomialApproximation + (Tensor.directSum (fun _ : Fin multiplicity => + Tensor.matrixCoefficients (K := F) (Fin rows) (Fin inner) (Fin columns))) + rankBound order degree + +namespace AllFieldWitness + +variable {F : Type*} [Field F] + +def volume (W : AllFieldWitness F) : ℕ := W.rows * W.inner * W.columns + +theorem volume_pos (W : AllFieldWitness F) : 0 < W.volume := + Nat.mul_pos (Nat.mul_pos W.rows_pos W.inner_pos) W.columns_pos + +theorem finite_inequality (W : AllFieldWitness F) : + (W.multiplicity : ℝ) * (W.volume : ℝ) ^ (Arithmetic.omega F / 3) ≤ W.rankBound := + Arithmetic.equalVolume_inequality_of_polynomialApproximation + W.rows_pos W.inner_pos W.columns_pos W.approximation + +theorem log_inequality (W : AllFieldWitness F) : + Real.log (W.multiplicity : ℝ) + + (Arithmetic.omega F / 3) * Real.log (W.volume : ℝ) ≤ + Real.log (W.rankBound : ℝ) := by + have hm : (0 : ℝ) < W.multiplicity := Nat.cast_pos.mpr W.multiplicity_pos + have hv : (0 : ℝ) < W.volume := Nat.cast_pos.mpr W.volume_pos + have hp := Real.rpow_pos_of_pos hv (Arithmetic.omega F / 3) + have h := Real.log_le_log (mul_pos hm hp) W.finite_inequality + rw [Real.log_mul hm.ne' hp.ne', Real.log_rpow hv] at h + exact h + +end AllFieldWitness +end MatrixMultiplication + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section + +open scoped BigOperators +open MatrixMultiplication.Foundation + +namespace MatrixMultiplication.AllFieldSource + +abbrev Word (K N : ℕ) := Fin (8 * K * N) → Fin 7 + +abbrev Index (Copies : Type*) (K N : ℕ) := Copies × Word K N + +def tensor (F Copies : Type*) [CommRing F] [DecidableEq Copies] (K N : ℕ) : + Tensor F (Index Copies K N) (Index Copies K N) (Index Copies K N) := + Tensor.directSum (fun _ : Copies => Tensor.power (FieldCW.tensor F 5) (8 * K * N)) + +def rankBudget (Copies : Type*) [Fintype Copies] (K N : ℕ) : ℕ := + Fintype.card Copies * ((3 * (8 * K * N) + 1) ^ 2 * 7 ^ (8 * K * N)) + +theorem rank_bound (F Copies : Type*) [Field F] + [Fintype Copies] [DecidableEq Copies] (K N : ℕ) : + Tensor.RankAtMost (tensor F Copies K N) (rankBudget Copies K N) := by + have h := (Tensor.diagonal_rankAtMost (K := F) Copies).product + (FieldCW.rank_power F 5 (8 * K * N)) + convert h using 1 + · funext x y z + simp [tensor, Tensor.directSum, Tensor.product, Tensor.diagonal, ite_mul] + · rfl + +theorem rankBudget_pos (Copies : Type*) [Fintype Copies] (K N : ℕ) + (hcopies : 0 < Fintype.card Copies) : 0 < rankBudget Copies K N := by + unfold rankBudget + exact Nat.mul_pos hcopies + (Nat.mul_pos (pow_pos (Nat.succ_pos _) _) (pow_pos (by decide) _)) + +theorem rankBudget_prod (Slots Copies : Type*) [Fintype Slots] [Fintype Copies] + (K N : ℕ) : + rankBudget (Slots × Copies) K N = Fintype.card Slots * rankBudget Copies K N := by + simp only [rankBudget, Fintype.card_prod, Nat.mul_assoc] + +def matrixTarget (F : Type*) [CommSemiring F] (a b c L : ℕ) := + Tensor.directSum (fun _ : Fin L => + Tensor.matrixCoefficients (K := F) (Fin a) (Fin b) (Fin c)) + +section Consumer + +variable {F Copies : Type*} [Field F] [Fintype Copies] [DecidableEq Copies] +variable {K N a b c L : ℕ} + +theorem restricted_rank_bound + (A : (Fin L × (Fin a × Fin b)) → Index Copies K N → F) + (B : (Fin L × (Fin b × Fin c)) → Index Copies K N → F) + (C : (Fin L × (Fin c × Fin a)) → Index Copies K N → F) + (hcoeff : ∀ x y z, + Tensor.restrict A B C (tensor F Copies K N) x y z = matrixTarget F a b c L x y z) : + Tensor.RankAtMost (matrixTarget F a b c L) (rankBudget Copies K N) := by + have heq : Tensor.restrict A B C (tensor F Copies K N) = matrixTarget F a b c L := + funext fun x => funext fun y => funext fun z => hcoeff x y z + rw [← heq] + exact (rank_bound F Copies K N).restrict A B C + +def restrictedApproximation + (A : (Fin L × (Fin a × Fin b)) → Index Copies K N → F) + (B : (Fin L × (Fin b × Fin c)) → Index Copies K N → F) + (C : (Fin L × (Fin c × Fin a)) → Index Copies K N → F) + (hcoeff : ∀ x y z, + Tensor.restrict A B C (tensor F Copies K N) x y z = matrixTarget F a b c L x y z) : + Tensor.PolynomialApproximation (matrixTarget F a b c L) (rankBudget Copies K N) 0 0 := + Tensor.PolynomialApproximation.ofRankAtMost _ _ (restricted_rank_bound A B C hcoeff) + +def ofRestriction + (A : (Fin L × (Fin a × Fin b)) → Index Copies K N → F) + (B : (Fin L × (Fin b × Fin c)) → Index Copies K N → F) + (C : (Fin L × (Fin c × Fin a)) → Index Copies K N → F) + (hcoeff : ∀ x y z, + Tensor.restrict A B C (tensor F Copies K N) x y z = matrixTarget F a b c L x y z) + (hcopies : 0 < Fintype.card Copies) (ha : 0 < a) (hb : 0 < b) + (hc : 0 < c) (hL : 0 < L) : AllFieldWitness F where + rows := a + inner := b + columns := c + multiplicity := L + rankBound := rankBudget Copies K N + order := 0 + degree := 0 + rows_pos := ha + inner_pos := hb + columns_pos := hc + multiplicity_pos := hL + rankBound_pos := rankBudget_pos Copies K N hcopies + approximation := restrictedApproximation A B C hcoeff + +theorem ofRestriction_polynomial + (A : (Fin L × (Fin a × Fin b)) → Index Copies K N → F) + (B : (Fin L × (Fin b × Fin c)) → Index Copies K N → F) + (C : (Fin L × (Fin c × Fin a)) → Index Copies K N → F) + (hcoeff : ∀ x y z, + Tensor.restrict A B C (tensor F Copies K N) x y z = matrixTarget F a b c L x y z) + (hcopies : 0 < Fintype.card Copies) (ha : 0 < a) (hb : 0 < b) + (hc : 0 < c) (hL : 0 < L) : + (ofRestriction A B C hcoeff hcopies ha hb hc hL).approximation.polynomial = + fun x y z => Polynomial.C (matrixTarget F a b c L x y z) := rfl + +end Consumer + +end MatrixMultiplication.AllFieldSource + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section + +namespace MatrixMultiplication.AllFieldFiniteFamily + +open MatrixMultiplication.Foundation +open scoped BigOperators Classical + +variable {F : Type*} [Field F] + +structure LocalMap {X Y Z X' Y' Z' : Type} + [Fintype X] [Fintype Y] [Fintype Z] + (source : Tensor F X Y Z) (target : Tensor F X' Y' Z') where + x : X' → X → F + y : Y' → Y → F + z : Z' → Z → F + coefficient : Tensor.restrict x y z source = target + +namespace LocalMap + +variable {X Y Z X' Y' Z' X'' Y'' Z'' : Type} + [Fintype X] [Fintype Y] [Fintype Z] + [Fintype X'] [Fintype Y'] [Fintype Z'] + {source : Tensor F X Y Z} {middle : Tensor F X' Y' Z'} + {target : Tensor F X'' Y'' Z''} + +def identity (source : Tensor F X Y Z) : LocalMap source source where + x := fun x s => if s = x then 1 else 0 + y := fun y s => if s = y then 1 else 0 + z := fun z s => if s = z then 1 else 0 + coefficient := by + rw [← Tensor.pullback_eq_restrict] + rfl + +def delete (source : Tensor F X Y Z) (px : X → Prop) (py : Y → Prop) (pz : Z → Prop) : + LocalMap source (ExactRecovery.delete source px py pz) where + x := fun x s => if s = x ∧ px x then 1 else 0 + y := fun y s => if s = y ∧ py y then 1 else 0 + z := fun z s => if s = z ∧ pz z then 1 else 0 + coefficient := by + funext x y z + by_cases hx : px x <;> by_cases hy : py y <;> by_cases hz : pz z <;> + simp [Tensor.restrict, ExactRecovery.delete, hx, hy, hz, ite_mul, mul_ite] + +def product {U V W U' V' W' : Type} + [Fintype U] [Fintype V] [Fintype W] + {other : Tensor F U V W} {otherTarget : Tensor F U' V' W'} + (first : LocalMap source middle) (second : LocalMap other otherTarget) : + LocalMap (Tensor.product source other) (Tensor.product middle otherTarget) where + x := fun x s => first.x x.1 s.1 * second.x x.2 s.2 + y := fun y s => first.y y.1 s.1 * second.y y.2 s.2 + z := fun z s => first.z z.1 s.1 * second.z z.2 s.2 + coefficient := by + rw [Tensor.restrict_product, first.coefficient, second.coefficient] + +def comp (first : LocalMap source middle) (second : LocalMap middle target) : + LocalMap source target where + x := Tensor.composeRestrictionMatrix second.x first.x + y := Tensor.composeRestrictionMatrix second.y first.y + z := Tensor.composeRestrictionMatrix second.z first.z + coefficient := by + rw [← Tensor.restrict_restrict, first.coefficient, second.coefficient] + +def withSource (map : LocalMap source middle) (newSource : Tensor F X Y Z) + (same : newSource = source) : LocalMap newSource middle where + x := map.x + y := map.y + z := map.z + coefficient := by rw [same]; exact map.coefficient + +def ofExists + (h : ∃ (a : X' → X → F) (b : Y' → Y → F) (c : Z' → Z → F), + Tensor.restrict a b c source = middle) : LocalMap source middle := by + choose a b c habc using h + exact ⟨a, b, c, habc⟩ + +def parallelCopies (map : LocalMap source middle) (R : Type) [Fintype R] : + LocalMap (Tensor.directSum (fun _ : R => source)) + (Tensor.directSum (fun _ : R => middle)) where + x := fun x s => if x.1 = s.1 then map.x x.2 s.2 else 0 + y := fun y s => if y.1 = s.1 then map.y y.2 s.2 else 0 + z := fun z s => if z.1 = s.1 then map.z z.2 s.2 else 0 + coefficient := by + have h := Replication.restrict_directSum (fun _ : R => source) + (fun _ => map.x) (fun _ => map.y) (fun _ => map.z) + simpa only [map.coefficient] using h + +def directSum {I : Type} [Fintype I] + (T : I → Tensor F X Y Z) (Q : I → Tensor F X' Y' Z') + (maps : ∀ i, LocalMap (T i) (Q i)) : + LocalMap (Tensor.directSum T) (Tensor.directSum Q) where + x := fun x s => if x.1 = s.1 then (maps x.1).x x.2 s.2 else 0 + y := fun y s => if y.1 = s.1 then (maps y.1).y y.2 s.2 else 0 + z := fun z s => if z.1 = s.1 then (maps z.1).z z.2 s.2 else 0 + coefficient := by + have h := Replication.restrict_directSum T + (fun i => (maps i).x) (fun i => (maps i).y) (fun i => (maps i).z) + simpa only [fun i => (maps i).coefficient] using h + +def selectBranches {I J : Type} [Fintype I] [Fintype J] + (T : I → Tensor F X Y Z) (select : J → I) (injective : Function.Injective select) : + LocalMap (Tensor.directSum T) (Tensor.directSum (fun j => T (select j))) where + x := fun x s => if s = (select x.1, x.2) then 1 else 0 + y := fun y s => if s = (select y.1, y.2) then 1 else 0 + z := fun z s => if s = (select z.1, z.2) then 1 else 0 + coefficient := by + rw [← Tensor.pullback_eq_restrict] + funext x y z + simp only [Tensor.pullback, Tensor.directSum, injective.eq_iff] + +def unflatten (source : Tensor F X Y Z) (R I : Type) [Fintype R] [Fintype I] : + LocalMap (Tensor.directSum (fun _ : R × I => source)) + (Tensor.directSum (fun _ : R => Tensor.directSum (fun _ : I => source))) where + x := fun x s => if s = ((x.1, x.2.1), x.2.2) then 1 else 0 + y := fun y s => if s = ((y.1, y.2.1), y.2.2) then 1 else 0 + z := fun z s => if s = ((z.1, z.2.1), z.2.2) then 1 else 0 + coefficient := by + rw [← Tensor.pullback_eq_restrict] + funext x y z + simp only [Tensor.pullback, Tensor.directSum, Prod.ext_iff] + split_ifs <;> aesop + +def flatten (source : Tensor F X Y Z) (I J : Type) [Fintype I] [Fintype J] : + LocalMap (Tensor.directSum (fun _ : I => Tensor.directSum (fun _ : J => source))) + (Tensor.directSum (fun _ : I × J => source)) where + x := fun x s => if s = (x.1.1, (x.1.2, x.2)) then 1 else 0 + y := fun y s => if s = (y.1.1, (y.1.2, y.2)) then 1 else 0 + z := fun z s => if s = (z.1.1, (z.1.2, z.2)) then 1 else 0 + coefficient := by + rw [← Tensor.pullback_eq_restrict] + funext x y z + simp only [Tensor.pullback, Tensor.directSum, Prod.ext_iff] + split_ifs <;> aesop + +def replicationProduct {U V W : Type} [Fintype U] [Fintype V] [Fintype W] + (active : Tensor F X Y Z) (finished : Tensor F U V W) + (R : Type) [Fintype R] : + LocalMap (Tensor.directSum (fun _ : R => Tensor.product active finished)) + (Tensor.product (Tensor.directSum (fun _ : R => active)) finished) where + x := fun x s => if s = (x.1.1, (x.1.2, x.2)) then 1 else 0 + y := fun y s => if s = (y.1.1, (y.1.2, y.2)) then 1 else 0 + z := fun z s => if s = (z.1.1, (z.1.2, z.2)) then 1 else 0 + coefficient := by + rw [← Tensor.pullback_eq_restrict] + funext x y z + simp [Tensor.pullback, Tensor.directSum, Tensor.product, ite_mul] + +def extract (T : Tensor F X Y Z) {I : Type} [Fintype I] + (assignment : JointExtraction.Assignment X Y Z I) + (coherent : JointExtraction.Coherent T assignment) : + LocalMap T (Tensor.directSum (JointExtraction.branch T assignment)) where + x := JointExtraction.assignmentMatrix assignment.x + y := JointExtraction.assignmentMatrix assignment.y + z := JointExtraction.assignmentMatrix assignment.z + coefficient := JointExtraction.restrict_assignments_eq_directSum T assignment coherent + +def repairBranches {I : Type} [Fintype I] + (T Q : I → Tensor F X Y Z) (L : ℕ) + (repair : ∀ i, InverseLinearRecovery.RecoveredBy (Q i) (T i) L) : + LocalMap + (Tensor.directSum (fun _ : InverseLinearRecovery.MaskRectangles L => Tensor.directSum T)) + (Tensor.directSum Q) := by + choose a b c h using repair + exact ofExists (Replication.repair_branches T Q a b c h) + +end LocalMap + +structure Execution {SX SY SZ X Y Z : Type} + [Fintype SX] [Fintype SY] [Fintype SZ] + (source : Tensor F SX SY SZ) (target : Tensor F X Y Z) where + Copies : Type + [copies_finite : Fintype Copies] + copies_positive : 0 < Fintype.card Copies + map : LocalMap (Tensor.directSum (fun _ : Copies => source)) target + +attribute [instance] Execution.copies_finite + +namespace Execution + +variable {SX SY SZ X Y Z X' Y' Z' : Type} + [Fintype SX] [Fintype SY] [Fintype SZ] + [Fintype X] [Fintype Y] [Fintype Z] + {source : Tensor F SX SY SZ} {current : Tensor F X Y Z} + +def initial (source : Tensor F SX SY SZ) : Execution source source where + Copies := PUnit + copies_positive := by simp + map := { + x := fun x s => if s = (PUnit.unit, x) then 1 else 0 + y := fun y s => if s = (PUnit.unit, y) then 1 else 0 + z := fun z s => if s = (PUnit.unit, z) then 1 else 0 + coefficient := by + rw [← Tensor.pullback_eq_restrict] + funext x y z + simp [Tensor.pullback, Tensor.directSum] + } + +def restrict (E : Execution source current) (target : Tensor F X' Y' Z') + (map : LocalMap current target) : Execution source target where + Copies := E.Copies + copies_positive := E.copies_positive + map := E.map.comp map + +def replicate (E : Execution source current) (R : Type) [Fintype R] + (positive : 0 < Fintype.card R) : + Execution source (Tensor.directSum (fun _ : R => current)) where + Copies := R × E.Copies + copies_positive := by simpa using Nat.mul_pos positive E.copies_positive + map := ((LocalMap.unflatten source R E.Copies).comp (E.map.parallelCopies R)).withSource _ + (by funext x y z; simp only [Tensor.directSum]) + +def step (E : Execution source current) (R : Type) [Fintype R] + (positive : 0 < Fintype.card R) (target : Tensor F X' Y' Z') + (map : LocalMap (Tensor.directSum (fun _ : R => current)) target) : + Execution source target := + (E.replicate R positive).restrict target map + +def stepOnLeft {U V W : Type} [Fintype U] [Fintype V] [Fintype W] + (active : Tensor F X Y Z) (finished : Tensor F U V W) + (E : Execution source (Tensor.product active finished)) + (R : Type) [Fintype R] (positive : 0 < Fintype.card R) + (target : Tensor F X' Y' Z') + (map : LocalMap (Tensor.directSum (fun _ : R => active)) target) : + Execution source (Tensor.product target finished) := + E.step R positive _ ((LocalMap.replicationProduct active finished R).comp + (map.product (LocalMap.identity finished))) + +def branchOperation {I J R : Type} [Fintype I] [Fintype J] [Fintype R] + (current : Tensor F X Y Z) (next : Tensor F X' Y' Z') + [Fintype X'] [Fintype Y'] [Fintype Z'] + (E : Execution source (Tensor.directSum (fun _ : I => current))) + (positive : 0 < Fintype.card R) + (map : LocalMap (Tensor.directSum (fun _ : R => current)) + (Tensor.directSum (fun _ : J => next))) : + Execution source (Tensor.directSum (fun _ : I × J => next)) := + E.step R positive _ ((LocalMap.ofExists + (Replication.repair_branches (fun _ : I => current) + (fun _ : I => Tensor.directSum (fun _ : J => next)) + (fun _ => map.x) (fun _ => map.y) (fun _ => map.z) + (fun _ => map.coefficient))).comp (LocalMap.flatten next I J)) + +@[simp] theorem branchOperation_copies {I J R : Type} + [Fintype I] [Fintype J] [Fintype R] + (current : Tensor F X Y Z) (next : Tensor F X' Y' Z') + [Fintype X'] [Fintype Y'] [Fintype Z'] + (E : Execution source (Tensor.directSum (fun _ : I => current))) + (positive : 0 < Fintype.card R) + (map : LocalMap (Tensor.directSum (fun _ : R => current)) + (Tensor.directSum (fun _ : J => next))) : + Fintype.card (branchOperation current next E positive map).Copies = + Fintype.card R * Fintype.card E.Copies := by + exact Fintype.card_prod R E.Copies + +@[simp] theorem step_copies (E : Execution source current) (R : Type) [Fintype R] + (positive : 0 < Fintype.card R) (target : Tensor F X' Y' Z') + (map : LocalMap (Tensor.directSum (fun _ : R => current)) target) : + Fintype.card (E.step R positive target map).Copies = + Fintype.card R * Fintype.card E.Copies := by + exact Fintype.card_prod R E.Copies + +def extractAndRepair (E : Execution source current) {I : Type} [Fintype I] + (assignment : JointExtraction.Assignment X Y Z I) + (coherent : JointExtraction.Coherent current assignment) + (ideal : I → Tensor F X Y Z) (L : ℕ) + (repair : ∀ i, InverseLinearRecovery.RecoveredBy (ideal i) + (JointExtraction.branch current assignment i) L) : + Execution source (Tensor.directSum ideal) := by + let extracted := E.restrict _ (LocalMap.extract current assignment coherent) + exact extracted.step (InverseLinearRecovery.MaskRectangles L) + (by simp [InverseLinearRecovery.MaskRectangles]) _ + ((LocalMap.repairBranches (JointExtraction.branch current assignment) ideal L repair).withSource _ + (by + funext first second third + simp only [Tensor.directSum] + split_ifs <;> rfl)) + +@[simp] theorem extractAndRepair_copies (E : Execution source current) + {I : Type} [Fintype I] + (assignment : JointExtraction.Assignment X Y Z I) + (coherent : JointExtraction.Coherent current assignment) + (ideal : I → Tensor F X Y Z) (L : ℕ) + (repair : ∀ i, InverseLinearRecovery.RecoveredBy (ideal i) + (JointExtraction.branch current assignment i) L) : + Fintype.card (E.extractAndRepair assignment coherent ideal L repair).Copies = + 2 ^ (3 * L) * Fintype.card E.Copies := by + change Fintype.card (InverseLinearRecovery.MaskRectangles L × E.Copies) = _ + rw [Fintype.card_prod, ExactRecovery.card_mask_rectangles, Fintype.card_fin] + +def extractSelectedAndRepair (E : Execution source current) + {I J : Type} [Fintype I] [Fintype J] + (assignment : JointExtraction.Assignment X Y Z I) + (coherent : JointExtraction.Coherent current assignment) + (select : J → I) (injective : Function.Injective select) + (ideal : J → Tensor F X Y Z) (L : ℕ) + (repair : ∀ j, InverseLinearRecovery.RecoveredBy (ideal j) + (JointExtraction.branch current assignment (select j)) L) : + Execution source (Tensor.directSum ideal) := by + let extracted := E.restrict _ (LocalMap.extract current assignment coherent) + let selected := extracted.restrict _ + (LocalMap.selectBranches (JointExtraction.branch current assignment) select injective) + exact selected.step (InverseLinearRecovery.MaskRectangles L) + (by simp [InverseLinearRecovery.MaskRectangles]) _ + ((LocalMap.repairBranches (fun j => JointExtraction.branch current assignment (select j)) + ideal L repair).withSource _ + (by + funext first second third + simp only [Tensor.directSum] + split_ifs <;> rfl)) + +@[simp] theorem extractSelectedAndRepair_copies (E : Execution source current) + {I J : Type} [Fintype I] [Fintype J] + (assignment : JointExtraction.Assignment X Y Z I) + (coherent : JointExtraction.Coherent current assignment) + (select : J → I) (injective : Function.Injective select) + (ideal : J → Tensor F X Y Z) (L : ℕ) + (repair : ∀ j, InverseLinearRecovery.RecoveredBy (ideal j) + (JointExtraction.branch current assignment (select j)) L) : + Fintype.card + (E.extractSelectedAndRepair assignment coherent select injective ideal L repair).Copies = + 2 ^ (3 * L) * Fintype.card E.Copies := by + change Fintype.card (InverseLinearRecovery.MaskRectangles L × E.Copies) = _ + rw [Fintype.card_prod, ExactRecovery.card_mask_rectangles, Fintype.card_fin] + +end Execution + +section Schedule + +variable {SX SY SZ : Type} [Fintype SX] [Fintype SY] [Fintype SZ] + {X Y Z : ℕ → Type} [∀ n, Fintype (X n)] [∀ n, Fintype (Y n)] [∀ n, Fintype (Z n)] + (source : Tensor F SX SY SZ) (tensor : ∀ n, Tensor F (X n) (Y n) (Z n)) + (start : Execution source (tensor 0)) + (Copies : ℕ → Type) [∀ n, Fintype (Copies n)] + (positive : ∀ n, 0 < Fintype.card (Copies n)) + (maps : ∀ n, LocalMap (Tensor.directSum (fun _ : Copies n => tensor n)) (tensor (n + 1))) + +def run : (n : ℕ) → Execution source (tensor n) + | 0 => start + | n + 1 => (run n).step (Copies n) (positive n) (tensor (n + 1)) (maps n) + +theorem run_copies (n : ℕ) : + Fintype.card (run source tensor start Copies positive maps n).Copies = + Fintype.card start.Copies * ∏ j ∈ Finset.range n, Fintype.card (Copies j) := by + induction n with + | zero => + change Fintype.card start.Copies = + Fintype.card start.Copies * ∏ j ∈ Finset.range 0, Fintype.card (Copies j) + rw [Finset.prod_range_zero, Nat.mul_one] + | succ n ih => + rw [run, Execution.step_copies, ih, Finset.prod_range_succ] + ring + +end Schedule + +section CWSource + +variable {K N a b c L : ℕ} + +abbrev cwSource (F : Type*) [Field F] (K N : ℕ) := + Tensor.power (FieldCW.tensor F 5) (8 * K * N) + +def startCW (F : Type*) [Field F] (K N : ℕ) : + Execution (cwSource F K N) (cwSource F K N) := + Execution.initial _ + +def Execution.toWitness + (E : Execution (cwSource F K N) (AllFieldSource.matrixTarget F a b c L)) + (ha : 0 < a) (hb : 0 < b) (hc : 0 < c) (hL : 0 < L) : AllFieldWitness F := + AllFieldSource.ofRestriction E.map.x E.map.y E.map.z + (fun x y z => congrFun (congrFun (congrFun E.map.coefficient x) y) z) + E.copies_positive ha hb hc hL + +@[simp] theorem Execution.toWitness_rankBound + (E : Execution (cwSource F K N) (AllFieldSource.matrixTarget F a b c L)) + (ha : 0 < a) (hb : 0 < b) (hc : 0 < c) (hL : 0 < L) : + (E.toWitness ha hb hc hL).rankBound = + Fintype.card E.Copies * ((3 * (8 * K * N) + 1) ^ 2 * 7 ^ (8 * K * N)) := rfl + +end CWSource + +end MatrixMultiplication.AllFieldFiniteFamily + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section + +namespace MatrixMultiplication.AllFieldInitialSource + +open MatrixMultiplication.Foundation AllFieldFiniteFamily CommonDimensions +open scoped BigOperators Classical + +abbrev Sites (K N : ℕ) := Fin K × (Fin N × Fin 8) +abbrev Words (K N : ℕ) := Fin K → Fin N → Fin 8 → Fin 7 + +def sitesEquiv (K N : ℕ) : Sites K N ≃ Fin (8 * K * N) := + Fintype.equivOfCardEq (by simp only [Sites, Fintype.card_prod, Fintype.card_fin]; ring) + +def flatten (K N : ℕ) (w : Words K N) : AllFieldSource.Word K N := + fun i => let p := (sitesEquiv K N).symm i; w p.1 p.2.1 p.2.2 + +def groupedSource (F : Type*) [Field F] (K N : ℕ) : + Tensor F (Words K N) (Words K N) (Words K N) := + fun x y z => ∏ p : Sites K N, + FieldCW.tensor F 5 (x p.1 p.2.1 p.2.2) (y p.1 p.2.1 p.2.2) (z p.1 p.2.1 p.2.2) + +theorem groupedSource_eq_lots (F : Type*) [Field F] (K N : ℕ) : + groupedSource F K N = + familyProduct (fun _ : Fin K => Tensor.power (Tensor.power (FieldCW.tensor F 5) 8) N) := by + funext x y z + simp only [groupedSource, Sites, familyProduct, Tensor.power, Fintype.prod_prod_type] + +def groupingMap (F : Type*) [Field F] (K N : ℕ) : + LocalMap (cwSource F K N) (groupedSource F K N) where + x := fun x s => if s = flatten K N x then 1 else 0 + y := fun y s => if s = flatten K N y then 1 else 0 + z := fun z s => if s = flatten K N z then 1 else 0 + coefficient := by + rw [← Tensor.pullback_eq_restrict] + funext x y z + simp only [Tensor.pullback, cwSource, Tensor.power, groupedSource, flatten] + apply Fintype.prod_equiv (sitesEquiv K N).symm + intro i + rfl + +def initialExecution (F : Type*) [Field F] (K N : ℕ) : + Execution (cwSource F K N) (groupedSource F K N) := + (startCW F K N).restrict _ (groupingMap F K N) + +@[simp] theorem initialExecution_copies (F : Type*) [Field F] (K N : ℕ) : + Fintype.card (initialExecution F K N).Copies = 1 := rfl + +end MatrixMultiplication.AllFieldInitialSource + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section + +namespace MatrixMultiplication.JointCanonicalInitial + +open MatrixMultiplication.Foundation JointPopulation JointCanonicalization JointCanonicalCW +open InheritedMasks CWStrands +open scoped BigOperators + +attribute [local instance] Classical.propDecidable + +variable {H F : Type*} [Fintype H] [DecidableEq H] [CommRing F] + (counts : H → Shape → ℕ) + +abbrev Word := Fin 8 → Fin 7 +abbrev RawWords := ∀ h, Positions counts h → Word +abbrev CanonicalWords := ∀ c : ClassKey (H := H), ClassPositions counts c → Word + +def wholeEquiv (e : Target counts) : RawWords counts ≃ CanonicalWords counts where + toFun w := fun c j => w c.1 ((positionEquiv counts e c.1).symm ⟨c.2, j⟩) + invFun w := fun h i => w (h, (e h).val i) (positionEquiv counts e h i).2 + left_inv w := by + funext h i + change w h ((positionEquiv counts e h).symm (positionEquiv counts e h i)) = w h i + simp + right_inv w := by + funext c j + exact congrArg (fun p : Σ u, Fin (counts c.1 u) => w (c.1, p.1) p.2) + ((positionEquiv counts e c.1).apply_symm_apply ⟨c.2, j⟩) + +def rawSource : Tensor F (RawWords counts) (RawWords counts) (RawWords counts) := + classProduct (fun _ : H => strand (Fin 8)) + +def coarseWord (w : RawWords counts) : Position counts → Fin 17 := + fun i => CWCoarseIndices.coarseIndex (by simp) (w i.1 i.2) + +def ideal (e : Target counts) : Tensor F (RawWords counts) (RawWords counts) + (RawWords counts) := + JointIdealBranches.ideal (rawSource counts) (coarseWord counts) (coarseWord counts) + (coarseWord counts) (fun _ _ => True) (fun _ _ => True) (fun _ _ => True) + (triple counts e) + +def canonical : Tensor F (CanonicalWords counts) (CanonicalWords counts) + (CanonicalWords counts) := + classProduct (fun c : ClassKey (H := H) => shapeTensor (Fin 8) (shapeNat c.2)) + +omit [DecidableEq H] in +theorem canonical_pack (e : Target counts) (x y z : RawWords counts) : + canonical counts (wholeEquiv counts e x) (wholeEquiv counts e y) + (wholeEquiv counts e z) = + ∏ h, ∏ i, shapeTensor (F := F) (Fin 8) (shapeNat ((e h).val i)) + (x h i) (y h i) (z h i) := by + unfold canonical classProduct + rw [Fintype.prod_prod_type] + apply Finset.prod_congr rfl + intro h _ + rw [← Fintype.prod_sigma'] + apply Fintype.prod_equiv (positionEquiv counts e h).symm + intro i + simp only [wholeEquiv, Equiv.coe_fn_mk, positionEquiv_symm_shape] + +omit [DecidableEq H] in +theorem ideal_eq_canonical (e : Target counts) (x y z : RawWords counts) : + ideal (F := F) counts e x y z = canonical counts (wholeEquiv counts e x) + (wholeEquiv counts e y) (wholeEquiv counts e z) := by + rw [canonical_pack] + simp only [ideal, JointIdealBranches.ideal, ExactRecovery.delete, and_true, + rawSource, classProduct, shapeTensor, Fintype.prod_ite_zero, forall_and] + congr 1 + simp [coarseWord, triple, shapeNat, shapeSide, CWCoarseIndices.coarseIndex, + funext_iff, Fin.ext_iff, Sigma.forall] + +def coordinateMatrix (e : Target counts) : CanonicalWords counts → RawWords counts → F := + fun x v => if v = (wholeEquiv counts e).symm x then 1 else 0 + +theorem ideal_restrict (e : Target counts) : + Tensor.restrict (coordinateMatrix (F := F) counts e) (coordinateMatrix counts e) + (coordinateMatrix counts e) (ideal counts e) = canonical counts := by + funext x y z + simp only [Tensor.restrict, coordinateMatrix] + simp only [ite_mul, mul_ite, zero_mul, mul_zero, one_mul, Finset.sum_ite_eq', + Finset.mem_univ, ↓reduceIte] + rw [ideal_eq_canonical] + simp + +omit [DecidableEq H] in +theorem coarse_support (x y z : RawWords counts) + (hT : rawSource (F := F) counts x y z ≠ 0) (i : Position counts) : + (coarseWord counts x i).val + (coarseWord counts y i).val + + (coarseWord counts z i).val = 16 := by + have hh : strand (F := F) (Fin 8) (x i.1 i.2) (y i.1 i.2) (z i.1 i.2) ≠ 0 := by + intro hz + apply hT + unfold rawSource classProduct + apply Finset.prod_eq_zero (Finset.mem_univ i.1) + exact Finset.prod_eq_zero (Finset.mem_univ i.2) hz + simpa [coarseWord] using + CWCoarseIndices.strand_coarse_support (F := F) (by simp) + (x i.1 i.2) (y i.1 i.2) (z i.1 i.2) hh + +def sideMask (s : Fin 3) (w : RawWords counts) : Prop := + ∀ h a, wordPopulation (fun i => coarseWord counts w ⟨h, i⟩) a = + wordPopulation (sideWord counts s (triple counts (canonicalTarget counts)) h) a + +def maskedSource : Tensor F (RawWords counts) (RawWords counts) (RawWords counts) := + ExactRecovery.delete (rawSource counts) (sideMask counts 0) (sideMask counts 1) + (sideMask counts 2) + +omit [Fintype H] [DecidableEq H] in +theorem sideMask_of_target (s : Fin 3) (e : Target counts) (w : RawWords counts) + (he : coarseWord counts w = + fun i => sideWord counts s (triple counts e) i.1 i.2) : + sideMask counts s w := by + intro h a + rw [he] + exact marginal_population_eq counts e (canonicalTarget counts) h s a + +theorem maskedSource_support (x y z : RawWords counts) + (hT : maskedSource (F := F) counts x y z ≠ 0) : + (coarseWord counts x, coarseWord counts y, coarseWord counts z) ∈ + ambientSet counts (fun _ => 16) := by + have hm : sideMask counts 0 x ∧ sideMask counts 1 y ∧ sideMask counts 2 z := by + by_contra hn + simp [maskedSource, ExactRecovery.delete, hn] at hT + have hr : rawSource (F := F) counts x y z ≠ 0 := by + simpa [maskedSource, ExactRecovery.delete, hm] using hT + apply Finset.mem_filter.mpr + refine ⟨Finset.mem_univ _, ?_, ?_⟩ + · intro i + exact coarse_support counts x y z hr i + · intro h s a + fin_cases s + · exact hm.1 h a + · exact hm.2.1 h a + · exact hm.2.2 h a + +omit [DecidableEq H] in +theorem ideal_support_masks (e : Target counts) (x y z : RawWords counts) + (hT : ideal (F := F) counts e x y z ≠ 0) : + sideMask counts 0 x ∧ sideMask counts 1 y ∧ sideMask counts 2 z := by + have hc : coarseWord counts x = (triple counts e).1 ∧ + coarseWord counts y = (triple counts e).2.1 ∧ + coarseWord counts z = (triple counts e).2.2 := by + by_contra hn + simp [ideal, JointIdealBranches.ideal, ExactRecovery.delete, hn] at hT + constructor + · apply sideMask_of_target counts 0 e x + simpa [sideWord, shapeSide] using hc.1 + constructor + · apply sideMask_of_target counts 1 e y + simpa [sideWord, shapeSide] using hc.2.1 + · apply sideMask_of_target counts 2 e z + simpa [sideWord, shapeSide] using hc.2.2 + +omit [DecidableEq H] in +theorem delete_ideal_eq (e : Target counts) : + ExactRecovery.delete (ideal (F := F) counts e) (sideMask counts 0) + (sideMask counts 1) (sideMask counts 2) = ideal counts e := by + funext x y z + by_cases h : ideal (F := F) counts e x y z = 0 + · rw [ExactRecovery.delete, h] + simp + · rw [ExactRecovery.delete, ite_eq_left (ideal_support_masks counts e x y z h)] + +end MatrixMultiplication.JointCanonicalInitial + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section + +namespace MatrixMultiplication.AllFieldInitialStep + +open MatrixMultiplication.Foundation AllFieldFiniteFamily AllFieldInitialSource +open JointPopulation +open scoped BigOperators Classical + +variable {F : Type*} [Field F] {K N : ℕ} + (counts : Fin K → Shape → ℕ) (total : ∀ h, ∑ u, counts h u = N) + +def toLots (w : JointCanonicalInitial.RawWords counts) : Words K N := + fun h i => w h ((finCongr (total h)).symm i) + +def positionMap : + LocalMap (groupedSource F K N) (JointCanonicalInitial.rawSource counts) where + x := fun x s => if s = toLots counts total x then 1 else 0 + y := fun y s => if s = toLots counts total y then 1 else 0 + z := fun z s => if s = toLots counts total z then 1 else 0 + coefficient := by + rw [← Tensor.pullback_eq_restrict, groupedSource_eq_lots] + funext x y z + change (∏ h : Fin K, ∏ i : Fin N, CWStrands.strand (F := F) (Fin 8) + (x h ((finCongr (total h)).symm i)) + (y h ((finCongr (total h)).symm i)) + (z h ((finCongr (total h)).symm i))) = + ∏ h : Fin K, ∏ i : Positions counts h, CWStrands.strand (F := F) (Fin 8) + (x h i) (y h i) (z h i) + apply Finset.prod_congr rfl + intro h _ + apply Fintype.prod_equiv (finCongr (total h)).symm + intro i + rfl + +def initialExecution : + Execution (cwSource F K N) (JointCanonicalInitial.rawSource counts) := + (AllFieldInitialSource.initialExecution F K N).restrict _ (positionMap counts total) + +@[simp] theorem initialExecution_copies : + Fintype.card (initialExecution (F := F) counts total).Copies = 1 := rfl + +def maskedInitialExecution : + Execution (cwSource F K N) (JointCanonicalInitial.maskedSource counts) := + (initialExecution counts total).restrict _ + (LocalMap.delete (JointCanonicalInitial.rawSource counts) + (JointCanonicalInitial.sideMask counts 0) (JointCanonicalInitial.sideMask counts 1) + (JointCanonicalInitial.sideMask counts 2)) + +abbrev CoarseWord := Position counts → Fin 17 + +def ordinaryAssignments (hx hy hz : CoarseWord counts → Prop) : + JointExtraction.Assignment (JointCanonicalInitial.RawWords counts) + (JointCanonicalInitial.RawWords counts) (JointCanonicalInitial.RawWords counts) + (JointCoarseHashing.Triple (Position counts)) := + JointCoarseAssignment.assignments (ambientSet counts (fun _ => 16)) (targetSet counts) + hx hy hz (JointCanonicalInitial.coarseWord counts) (JointCanonicalInitial.coarseWord counts) + (JointCanonicalInitial.coarseWord counts) (fun _ _ => True) (fun _ _ => True) + (fun _ _ => True) (fun _ _ => True) (fun _ _ => True) + +theorem ordinaryAssignments_coherent (hx hy hz : CoarseWord counts → Prop) : + JointExtraction.Coherent (JointCanonicalInitial.maskedSource (F := F) counts) + (ordinaryAssignments counts hx hy hz) := by + apply JointCoarseAssignment.assignments_coherent + · exact JointCanonicalInitial.maskedSource_support counts + · intro _ _ _ _ _ _ _ + trivial + · intro _ _ _ _ _ _ _ _ + trivial + +def initialCanonicalMap (e : Target counts) : + LocalMap (JointCanonicalInitial.ideal (F := F) counts e) + (JointCanonicalInitial.canonical counts) where + x := JointCanonicalInitial.coordinateMatrix counts e + y := JointCanonicalInitial.coordinateMatrix counts e + z := JointCanonicalInitial.coordinateMatrix counts e + coefficient := JointCanonicalInitial.ideal_restrict counts e + +def canonicalize {I : Type} [Fintype I] (target : I → Target counts) + (E : Execution (cwSource F K N) + (Tensor.directSum (fun i => JointCanonicalInitial.ideal counts (target i)))) : + Execution (cwSource F K N) + (Tensor.directSum (fun _ : I => JointCanonicalInitial.canonical counts)) := + E.restrict _ (LocalMap.directSum _ _ (fun i => initialCanonicalMap counts (target i))) + +@[simp] theorem canonicalize_copies {I : Type} [Fintype I] (target : I → Target counts) + (E : Execution (cwSource F K N) + (Tensor.directSum (fun i => JointCanonicalInitial.ideal counts (target i)))) : + Fintype.card (canonicalize counts target E).Copies = Fintype.card E.Copies := rfl + +def repairedInitialExecution {I : Type} [Fintype I] + (hx hy hz : CoarseWord counts → Prop) (target : I → Target counts) + (injective : Function.Injective target) (shifts : ℕ) + (repair : ∀ i, InverseLinearRecovery.RecoveredBy + (JointCanonicalInitial.ideal (F := F) counts (target i)) + (JointExtraction.branch (JointCanonicalInitial.maskedSource counts) + (ordinaryAssignments counts hx hy hz) (triple counts (target i))) shifts) : + Execution (cwSource F K N) + (Tensor.directSum (fun _ : I => JointCanonicalInitial.canonical counts)) := + canonicalize counts target + ((maskedInitialExecution counts total).extractSelectedAndRepair + (ordinaryAssignments counts hx hy hz) (ordinaryAssignments_coherent counts hx hy hz) + (fun i => triple counts (target i)) ((triple_injective counts).comp injective) + (fun i => JointCanonicalInitial.ideal counts (target i)) shifts repair) + +@[simp] theorem repairedInitialExecution_copies {I : Type} [Fintype I] + (hx hy hz : CoarseWord counts → Prop) (target : I → Target counts) + (injective : Function.Injective target) (shifts : ℕ) + (repair : ∀ i, InverseLinearRecovery.RecoveredBy + (JointCanonicalInitial.ideal (F := F) counts (target i)) + (JointExtraction.branch (JointCanonicalInitial.maskedSource counts) + (ordinaryAssignments counts hx hy hz) (triple counts (target i))) shifts) : + Fintype.card + (repairedInitialExecution counts total hx hy hz target injective shifts repair).Copies = + 2 ^ (3 * shifts) := by + change Fintype.card (InverseLinearRecovery.MaskRectangles shifts × PUnit) = _ + rw [Fintype.card_prod, ExactRecovery.card_mask_rectangles, + Fintype.card_fin, Fintype.card_punit, mul_one] + +end MatrixMultiplication.AllFieldInitialStep + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section + +namespace MatrixMultiplication.AllFieldInitialExact + +open MatrixMultiplication.Foundation AllFieldFiniteFamily AllFieldInitialStep +open JointPopulation JointCoarseAssignment JointExtraction JointAssignmentLoss +open scoped BigOperators Classical + +attribute [local instance] Classical.propDecidable + +private def assignedDeletion {F X Y Z A B C : Type*} [CommSemiring F] + (T : Tensor F X Y Z) (a : Assignment X Y Z (Triple A B C)) (e : Triple A B C) + (px : X → Prop) (py : Y → Prop) (pz : Z → Prop) : Tensor F X Y Z := + ExactRecovery.delete T (fun x => a.x x = some e ∧ px x) + (fun y => a.y y = some e ∧ py y) (fun z => a.z z = some e ∧ pz z) + +private theorem assignedDeletion_eq_self_of_support {F X Y Z A B C : Type*} + [CommSemiring F] (T : Tensor F X Y Z) + (a : Assignment X Y Z (Triple A B C)) (e : Triple A B C) + (px : X → Prop) (py : Y → Prop) (pz : Z → Prop) + (support : ∀ x y z, T x y z ≠ 0 → + (a.x x = some e ∧ px x) ∧ (a.y y = some e ∧ py y) ∧ (a.z z = some e ∧ pz z)) : + assignedDeletion T a e px py pz = T := by + funext x y z + unfold assignedDeletion ExactRecovery.delete + by_cases ht : T x y z = 0 + · simp only [ht, ite_self] + · exact ite_eq_left (support x y z ht) + +variable {K N : ℕ} + (counts : Fin K → Shape → ℕ) + (hx hy hz : CoarseWord counts → Prop) + +def Isolated (e : Target counts) : Prop := + survives hx hy hz (triple counts e) ∧ + ∀ f ∈ ambientSet counts (fun _ => 16), survives hx hy hz f → + JointCoarseHashing.SharesSide (triple counts e) f → f = triple counts e + +section Coefficients + +variable {F : Type*} [CommRing F] + +theorem assignments_on_ideal (e : Target counts) + (ha : triple counts e ∈ ambientSet counts (fun _ => 16)) + (isolated : Isolated counts hx hy hz e) + (x y z : JointCanonicalInitial.RawWords counts) + (nonzero : JointCanonicalInitial.ideal (F := F) counts e x y z ≠ 0) : + (ordinaryAssignments counts hx hy hz).x x = some (triple counts e) ∧ + (ordinaryAssignments counts hx hy hz).y y = some (triple counts e) ∧ + (ordinaryAssignments counts hx hy hz).z z = some (triple counts e) := by + have hc : JointCanonicalInitial.coarseWord counts x = (triple counts e).1 ∧ + JointCanonicalInitial.coarseWord counts y = (triple counts e).2.1 ∧ + JointCanonicalInitial.coarseWord counts z = (triple counts e).2.2 := by + by_contra hn + simp [JointCanonicalInitial.ideal, JointIdealBranches.ideal, ExactRecovery.delete, hn] + at nonzero + have ht : triple counts e ∈ targetSet counts := + Finset.mem_image.mpr ⟨e, Finset.mem_univ _, rfl⟩ + have he : triple counts e ∈ eligible (ambientSet counts (fun _ => 16)) + (targetSet counts) hx hy hz := by + apply (mem_eligible_iff _ _ _ _ _ _).2 + exact ⟨ha, ht, isolated.1, fun f hf hs hfx => isolated.2 f hf hs (Or.inl hfx)⟩ + constructor + · apply assignUseful_of_unique _ _ _ _ _ he hc.1 trivial + intro f hf hfx + have hm := (mem_eligible_iff _ _ _ _ _ _).1 hf + exact isolated.2 f hm.1 hm.2.2.1 (Or.inl (hfx.symm.trans hc.1)) + constructor + · apply assignUseful_of_unique _ _ _ _ _ he ⟨hc.2.1, trivial⟩ trivial + intro f hf hfy + have hm := (mem_eligible_iff _ _ _ _ _ _).1 hf + exact isolated.2 f hm.1 hm.2.2.1 (Or.inr (Or.inl (hfy.1.symm.trans hc.2.1))) + · apply assignUseful_of_unique _ _ _ _ _ he ⟨hc.2.2, trivial⟩ trivial + intro f hf hfz + have hm := (mem_eligible_iff _ _ _ _ _ _).1 hf + exact isolated.2 f hm.1 hm.2.2.1 (Or.inr (Or.inr (hfz.1.symm.trans hc.2.2))) + +private theorem branch_eq_masked_ideal (e : Target counts) : + branch (JointCanonicalInitial.maskedSource (F := F) counts) + (ordinaryAssignments counts hx hy hz) (triple counts e) = + assignedDeletion (JointCanonicalInitial.ideal counts e) + (ordinaryAssignments counts hx hy hz) (triple counts e) + (JointCanonicalInitial.sideMask counts 0) (JointCanonicalInitial.sideMask counts 1) + (JointCanonicalInitial.sideMask counts 2) := + JointIdealBranches.branch_masked_eq_delete_ideal + (JointCanonicalInitial.rawSource (F := F) counts) + (JointCanonicalInitial.sideMask counts 0) (JointCanonicalInitial.sideMask counts 1) + (JointCanonicalInitial.sideMask counts 2) (ambientSet counts (fun _ => 16)) (targetSet counts) + hx hy hz (JointCanonicalInitial.coarseWord counts) (JointCanonicalInitial.coarseWord counts) + (JointCanonicalInitial.coarseWord counts) (fun _ _ => True) (fun _ _ => True) + (fun _ _ => True) (fun _ _ => True) (fun _ _ => True) (triple counts e) + +theorem branch_eq_ideal (e : Target counts) + (ha : triple counts e ∈ ambientSet counts (fun _ => 16)) + (isolated : Isolated counts hx hy hz e) : + branch (JointCanonicalInitial.maskedSource (F := F) counts) + (ordinaryAssignments counts hx hy hz) (triple counts e) = + JointCanonicalInitial.ideal counts e := by + have hdelete : assignedDeletion (JointCanonicalInitial.ideal (F := F) counts e) + (ordinaryAssignments counts hx hy hz) (triple counts e) + (JointCanonicalInitial.sideMask counts 0) (JointCanonicalInitial.sideMask counts 1) + (JointCanonicalInitial.sideMask counts 2) = + JointCanonicalInitial.ideal counts e := by + apply assignedDeletion_eq_self_of_support + intro x y z hh + have hm := JointCanonicalInitial.ideal_support_masks counts e x y z hh + have ha := assignments_on_ideal counts hx hy hz e ha isolated x y z hh + exact ⟨⟨ha.1, hm.1⟩, ⟨ha.2.1, hm.2.1⟩, ⟨ha.2.2, hm.2.2⟩⟩ + exact (branch_eq_masked_ideal counts hx hy hz e).trans hdelete + +end Coefficients + +section Execution + +variable {F : Type*} [Field F] + +def selectedExecution (total : ∀ h, ∑ u, counts h u = N) + {I : Type} [Fintype I] (target : I → Target counts) + (injective : Function.Injective target) + (ambient : ∀ i, triple counts (target i) ∈ ambientSet counts (fun _ => 16)) + (isolated : ∀ i, Isolated counts hx hy hz (target i)) : + Execution (cwSource F K N) + (Tensor.directSum (fun _ : I => JointCanonicalInitial.canonical counts)) := by + let input := maskedInitialExecution (F := F) counts total + let extracted := input.restrict _ + (LocalMap.extract (JointCanonicalInitial.maskedSource counts) + (ordinaryAssignments counts hx hy hz) (ordinaryAssignments_coherent counts hx hy hz)) + let selected := extracted.restrict _ + (LocalMap.selectBranches + (branch (JointCanonicalInitial.maskedSource counts) (ordinaryAssignments counts hx hy hz)) + (fun i => triple counts (target i)) ((triple_injective counts).comp injective)) + have heq : Tensor.directSum (fun i => branch (JointCanonicalInitial.maskedSource (F := F) counts) + (ordinaryAssignments counts hx hy hz) (triple counts (target i))) = + Tensor.directSum (fun i => JointCanonicalInitial.ideal counts (target i)) := by + apply congrArg Tensor.directSum + funext i + exact branch_eq_ideal counts hx hy hz (target i) (ambient i) (isolated i) + let idMap := LocalMap.identity (Tensor.directSum (fun i => + branch (JointCanonicalInitial.maskedSource (F := F) counts) + (ordinaryAssignments counts hx hy hz) (triple counts (target i)))) + let sameCoordinates : LocalMap + (Tensor.directSum (fun i => branch (JointCanonicalInitial.maskedSource (F := F) counts) + (ordinaryAssignments counts hx hy hz) (triple counts (target i)))) + (Tensor.directSum (fun i => JointCanonicalInitial.ideal counts (target i))) := + { x := idMap.x + y := idMap.y + z := idMap.z + coefficient := idMap.coefficient.trans heq } + exact AllFieldInitialStep.canonicalize counts target (selected.restrict _ sameCoordinates) + +@[simp] theorem selectedExecution_copies (total : ∀ h, ∑ u, counts h u = N) + {I : Type} [Fintype I] (target : I → Target counts) + (injective : Function.Injective target) + (ambient : ∀ i, triple counts (target i) ∈ ambientSet counts (fun _ => 16)) + (isolated : ∀ i, Isolated counts hx hy hz (target i)) : + Fintype.card (selectedExecution (F := F) counts hx hy hz total target + injective ambient isolated).Copies = 1 := rfl + +end Execution + +end MatrixMultiplication.AllFieldInitialExact + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section + +namespace MatrixMultiplication.AllFieldInitialState + +open MatrixMultiplication.Foundation AllFieldHistory AllFieldParameters AllFieldFiniteFamily +open scoped BigOperators Classical + +variable {K : ℕ} (allocation : Allocation) (dilation : ℕ) + +abbrev CanonicalKey := JointCanonicalization.ClassKey (H := Fin K) + +abbrev PlacementPositions (p : InitialPlacement K) := + Fin (population allocation dilation (.initial p.1, p.2)) + +def classPosition (c : CanonicalKey (K := K)) + (i : Fin (initialJointCounts allocation dilation c.1 c.2)) : + Σ p : InitialPlacement K, PlacementPositions allocation dilation p := + let q := initialClassPositionEquiv allocation dilation c.1 c.2 i + ⟨((c.1, q.1.val.1), q.1.val.2), q.2⟩ + +theorem classPosition_shape (c : CanonicalKey (K := K)) + (i : Fin (initialJointCounts allocation dilation c.1 c.2)) : + JointCanonicalCW.shapeNat c.2 = + physicalShape (classPosition allocation dilation c i).1.2 + (initialShape (classPosition allocation dilation c i).1.1) := by + have h := congrArg decodeShape (initialClassPosition_shape allocation dilation c.1 c.2 i) + change decodeShape c.2 = _ + simpa only [rootShape, decode_encodePhysicalShape, classPosition] using h.symm + +theorem prod_classPosition {F : Type*} [CommMonoid F] + (f : ∀ p : InitialPlacement K, PlacementPositions allocation dilation p → F) : + (∏ c : CanonicalKey (K := K), + ∏ i : Fin (initialJointCounts allocation dilation c.1 c.2), + f (classPosition allocation dilation c i).1 + (classPosition allocation dilation c i).2) = + ∏ p : InitialPlacement K, ∏ i : PlacementPositions allocation dilation p, f p i := by + conv_lhs => rw [Fintype.prod_prod_type] + conv_rhs => + rw [Fintype.prod_prod_type] + rw [Fintype.prod_prod_type] + apply Finset.prod_congr rfl + intro j _ + calc + (∏ u : JointPopulation.Shape, ∏ i : Fin (initialJointCounts allocation dilation j u), + f (classPosition allocation dilation (j, u) i).1 + (classPosition allocation dilation (j, u) i).2) = + ∏ u : JointPopulation.Shape, ∏ p : InitialShapeFiber j u, + ∏ i : Fin (population allocation dilation (.initial (j, p.val.1), p.val.2)), + f ((j, p.val.1), p.val.2) i := by + apply Finset.prod_congr rfl + intro u _ + rw [← Fintype.prod_sigma'] + apply Fintype.prod_equiv (initialClassPositionEquiv allocation dilation j u) + intro i + rfl + _ = ∏ p : Fin sortedInitial.length × Placement, + ∏ i : Fin (population allocation dilation (.initial (j, p.1), p.2)), + f ((j, p.1), p.2) i := + Fintype.prod_fiberwise (fun p : Fin sortedInitial.length × Placement => + rootShape (j, p.1) p.2) + (fun p => ∏ i : Fin (population allocation dilation (.initial (j, p.1), p.2)), + f ((j, p.1), p.2) i) + _ = _ := by rw [Fintype.prod_prod_type] + +abbrev StateWords := ∀ h : State K 0, HistoryWord allocation dilation h.val + +def toCanonical (w : StateWords (K := K) allocation dilation) : + JointCanonicalInitial.CanonicalWords (initialJointCounts (K := K) allocation dilation) := + fun c i => + let q := classPosition allocation dilation c i + w ((initialStateEquiv K).symm q.1) q.2 + +theorem coefficient (F : Type*) [Field F] (ε : ℝ) + (x y z : StateWords (K := K) allocation dilation) : + JointCanonicalInitial.canonical (F := F) (initialJointCounts allocation dilation) + (toCanonical allocation dilation x) (toCanonical allocation dilation y) + (toCanonical allocation dilation z) = + stateTensor F allocation dilation ε 0 x y z := by + let f : ∀ p : InitialPlacement K, PlacementPositions allocation dilation p → F := + fun p i => CWStrands.shapeTensor (Fin 8) (physicalShape p.2 (initialShape p.1)) + (x ((initialStateEquiv K).symm p) i) + (y ((initialStateEquiv K).symm p) i) + (z ((initialStateEquiv K).symm p) i) + have hcanonical : + JointCanonicalInitial.canonical (F := F) (initialJointCounts allocation dilation) + (toCanonical allocation dilation x) (toCanonical allocation dilation y) + (toCanonical allocation dilation z) = + ∏ p : InitialPlacement K, ∏ i : PlacementPositions allocation dilation p, f p i := by + rw [← prod_classPosition allocation dilation f] + unfold JointCanonicalInitial.canonical InheritedMasks.classProduct + apply Finset.prod_congr rfl + intro c _ + apply Finset.prod_congr rfl + intro i _ + dsimp only [toCanonical, f] + rw [classPosition_shape allocation dilation c i] + have hstate : stateTensor F allocation dilation ε 0 x y z = + ∏ p : InitialPlacement K, ∏ i : PlacementPositions allocation dilation p, f p i := by + change (∏ h : State K 0, historyTensor F allocation dilation ε h.val (x h) (y h) (z h)) = _ + rw [← (initialStateEquiv K).symm.prod_comp + (fun h : State K 0 => historyTensor F allocation dilation ε h.val (x h) (y h) (z h))] + apply Finset.prod_congr rfl + intro p _ + change historyTensor F allocation dilation ε (.initial p.1, p.2) + (x ((initialStateEquiv K).symm p)) (y ((initialStateEquiv K).symm p)) + (z ((initialStateEquiv K).symm p)) = _ + rw [historyTensor_initial] + rfl + exact hcanonical.trans hstate.symm + +def map (F : Type*) [Field F] (ε : ℝ) : + LocalMap + (JointCanonicalInitial.canonical (F := F) (initialJointCounts (K := K) allocation dilation)) + (stateTensor F (K := K) allocation dilation ε 0) where + x := fun x s => if s = toCanonical allocation dilation x then 1 else 0 + y := fun y s => if s = toCanonical allocation dilation y then 1 else 0 + z := fun z s => if s = toCanonical allocation dilation z then 1 else 0 + coefficient := by + rw [← Tensor.pullback_eq_restrict] + funext x y z + exact coefficient allocation dilation F ε x y z + +def execution (F : Type*) [Field F] (ε : ℝ) {I : Type} [Fintype I] {N : ℕ} + (E : Execution (cwSource F K N) + (Tensor.directSum (fun _ : I => JointCanonicalInitial.canonical + (initialJointCounts (K := K) allocation dilation)))) : + Execution (cwSource F K N) + (Tensor.directSum (fun _ : I => stateTensor F (K := K) allocation dilation ε 0)) := + E.restrict _ ((map (K := K) allocation dilation F ε).parallelCopies I) + +@[simp] theorem execution_copies (F : Type*) [Field F] (ε : ℝ) + {I : Type} [Fintype I] {N : ℕ} + (E : Execution (cwSource F K N) + (Tensor.directSum (fun _ : I => JointCanonicalInitial.canonical + (initialJointCounts (K := K) allocation dilation)))) : + Fintype.card (execution allocation dilation F ε E).Copies = Fintype.card E.Copies := rfl + +end MatrixMultiplication.AllFieldInitialState + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/Construction/JointAPFree.lean b/lean/OAI/LinearAlgebra/MatrixFields/Construction/JointAPFree.lean new file mode 100644 index 0000000000000000000000000000000000000000..c129e5c704984dd82fa34d3a0eeeda6c0b51489b --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/Construction/JointAPFree.lean @@ -0,0 +1,137 @@ +import Mathlib + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +noncomputable section + +namespace MatrixMultiplication.JointAPFree + +def natSet (N : ℕ) : Finset ℕ := (rothNumberNat_spec N).choose + +theorem natSet_subset (N : ℕ) : natSet N ⊆ Finset.range N := + (rothNumberNat_spec N).choose_spec.1 + +theorem natSet_card (N : ℕ) : (natSet N).card = rothNumberNat N := + (rothNumberNat_spec N).choose_spec.2.1 + +theorem natSet_threeAPFree (N : ℕ) : ThreeAPFree (natSet N : Set ℕ) := + (rothNumberNat_spec N).choose_spec.2.2 + +theorem mem_natSet_lt {N a : ℕ} (ha : a ∈ natSet N) : a < N := + Finset.mem_range.mp (natSet_subset N ha) + +theorem natCast_injective_below {M a b : ℕ} (ha : a < M) (hb : b < M) + (hab : (a : ZMod M) = (b : ZMod M)) : a = b := by + have h := congrArg ZMod.val hab + simpa only [ZMod.val_natCast_of_lt ha, ZMod.val_natCast_of_lt hb] using h + +theorem add_lt_modulus {M a b : ℕ} (ha : a < M / 2) (hb : b < M / 2) : + a + b < M := by + have h := Nat.div_mul_le_self M 2 + omega + +def modularSet (M : ℕ) : Finset (ZMod M) := + (natSet (M / 2)).image (fun a : ℕ => (a : ZMod M)) + +theorem modularSet_card (M : ℕ) : + (modularSet M).card = rothNumberNat (M / 2) := by + rw [modularSet, Finset.card_image_iff.mpr, natSet_card] + intro a ha b hb hab + exact natCast_injective_below + ((mem_natSet_lt ha).trans_le (Nat.div_le_self M 2)) + ((mem_natSet_lt hb).trans_le (Nat.div_le_self M 2)) hab + +theorem modularSet_threeAPFree (M : ℕ) : + ThreeAPFree (modularSet M : Set (ZMod M)) := by + intro a ha b hb c hc habc + change a ∈ (natSet (M / 2)).image (fun n : ℕ => (n : ZMod M)) at ha + change b ∈ (natSet (M / 2)).image (fun n : ℕ => (n : ZMod M)) at hb + change c ∈ (natSet (M / 2)).image (fun n : ℕ => (n : ZMod M)) at hc + obtain ⟨a', ha', rfl⟩ := Finset.mem_image.mp ha + obtain ⟨b', hb', rfl⟩ := Finset.mem_image.mp hb + obtain ⟨c', hc', rfl⟩ := Finset.mem_image.mp hc + have hac := add_lt_modulus (mem_natSet_lt ha') (mem_natSet_lt hc') + have hbb := add_lt_modulus (mem_natSet_lt hb') (mem_natSet_lt hb') + have hnat : a' + c' = b' + b' := natCast_injective_below hac hbb (by + simpa only [Nat.cast_add] using habc) + exact congrArg (fun n : ℕ => (n : ZMod M)) (natSet_threeAPFree (M / 2) ha' hb' hc' hnat) + +theorem modularSet_hashAP (M : ℕ) : + ∀ x ∈ modularSet M, ∀ y ∈ modularSet M, ∀ z ∈ modularSet M, + x + y = 2 * z → x = z ∧ y = z := by + intro x hx y hy z hz h + have h' : x + y = z + z := by simpa only [two_mul] using h + exact ⟨modularSet_threeAPFree M hx hz hy h', + ((modularSet_threeAPFree M).eq_right hx hz hy h').symm⟩ + +theorem modularSet_card_lower (M : ℕ) : + ((M / 2 : ℕ) : ℝ) * Real.exp (-4 * Real.sqrt (Real.log ((M / 2 : ℕ) : ℝ))) ≤ + ((modularSet M).card : ℝ) := by + rw [modularSet_card] + exact Behrend.roth_lower_bound + +theorem modularSet_card_le_half (M : ℕ) : (modularSet M).card ≤ M / 2 := by + rw [modularSet_card] + exact rothNumberNat_le _ + +theorem modularSet_card_pos {M : ℕ} (hM : 2 ≤ M) : 0 < (modularSet M).card := by + have hhalf : 0 < M / 2 := Nat.div_pos hM (by decide) + have hpos : (0 : ℝ) < ((M / 2 : ℕ) : ℝ) * + Real.exp (-4 * Real.sqrt (Real.log ((M / 2 : ℕ) : ℝ))) := by + exact mul_pos (by exact_mod_cast hhalf) (Real.exp_pos _) + exact_mod_cast hpos.trans_le (modularSet_card_lower M) + +theorem modularSet_nonempty {M : ℕ} (hM : 2 ≤ M) : (modularSet M).Nonempty := + Finset.card_pos.mp (modularSet_card_pos hM) + +theorem modularSet_log_card_lower {M : ℕ} (hM : 2 ≤ M) : + Real.log ((M / 2 : ℕ) : ℝ) - 4 * Real.sqrt (Real.log ((M / 2 : ℕ) : ℝ)) ≤ + Real.log ((modularSet M).card : ℝ) := by + have hhalf : (0 : ℝ) < ((M / 2 : ℕ) : ℝ) := by + exact_mod_cast (Nat.div_pos hM (by decide) : 0 < M / 2) + have h := Real.log_le_log (mul_pos hhalf (Real.exp_pos _)) (modularSet_card_lower M) + rw [Real.log_mul hhalf.ne' (Real.exp_pos _).ne', Real.log_exp] at h + linarith + +theorem modularSet_log_card_le_half {M : ℕ} (hM : 2 ≤ M) : + Real.log ((modularSet M).card : ℝ) ≤ Real.log ((M / 2 : ℕ) : ℝ) := by + apply Real.log_le_log + · exact_mod_cast modularSet_card_pos hM + · exact_mod_cast modularSet_card_le_half M + +theorem modularSet_log_card_lower_modulus {M : ℕ} (hM : 2 ≤ M) : + Real.log (M : ℝ) - Real.log 3 - 4 * Real.sqrt (Real.log (M : ℝ)) ≤ + Real.log ((modularSet M).card : ℝ) := by + have hMr : (0 : ℝ) < M := by exact_mod_cast (by omega : 0 < M) + have hhalf : (0 : ℝ) < ((M / 2 : ℕ) : ℝ) := by + exact_mod_cast (Nat.div_pos hM (by decide) : 0 < M / 2) + have hround : (M : ℝ) / 3 ≤ ((M / 2 : ℕ) : ℝ) := by + have hn : M ≤ 3 * (M / 2) := by omega + have hr : (M : ℝ) ≤ 3 * ((M / 2 : ℕ) : ℝ) := by exact_mod_cast hn + linarith + have hlog := Real.log_le_log (div_pos hMr (by norm_num)) hround + rw [Real.log_div hMr.ne' (by norm_num)] at hlog + have hlogUpper : Real.log ((M / 2 : ℕ) : ℝ) ≤ Real.log (M : ℝ) := by + apply Real.log_le_log hhalf + exact_mod_cast Nat.div_le_self M 2 + have hsqrt := Real.sqrt_le_sqrt hlogUpper + have hcard := modularSet_log_card_lower hM + linarith + +theorem modularSet_log_card_le_modulus {M : ℕ} (hM : 2 ≤ M) : + Real.log ((modularSet M).card : ℝ) ≤ Real.log (M : ℝ) := by + apply Real.log_le_log + · exact_mod_cast modularSet_card_pos hM + · exact_mod_cast (modularSet_card_le_half M).trans (Nat.div_le_self M 2) + +end MatrixMultiplication.JointAPFree + +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/Construction/JointCanonicalMixed.lean b/lean/OAI/LinearAlgebra/MatrixFields/Construction/JointCanonicalMixed.lean new file mode 100644 index 0000000000000000000000000000000000000000..3c2a76894e03cb3286e39325b098ed12753cc288 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/Construction/JointCanonicalMixed.lean @@ -0,0 +1,278 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Tensors.CWCompleteStatistics + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section + +namespace MatrixMultiplication.JointCanonicalMixed + +open MatrixMultiplication.Foundation JointPopulation JointCanonicalization JointCanonicalCW +open CWStrands HistorySymmetry InheritedMasks +open scoped BigOperators + +attribute [local instance] Classical.propDecidable + +variable {H F : Type*} [Fintype H] [DecidableEq H] [CommRing F] + (counts : H → Shape → ℕ) (leftLength rightLength : H → ℕ) + (parentShape : H → Fin 3 → ℕ) (sharing : H → Bool) + (hleft : ∀ h, leftLength h ≤ 8) + +def inputTensor (h : H) : Tensor F + (Left leftLength h × Right rightLength h) + (Left leftLength h × Right rightLength h) + (Left leftLength h × Right rightLength h) := + if sharing h then parentTensor leftLength rightLength parentShape h + else Tensor.product (strand (Fin (leftLength h))) (strand (Fin (rightLength h))) + +def childRight (c : ClassKey (H := H)) : + Tensor F (Right rightLength c.1) (Right rightLength c.1) (Right rightLength c.1) := + if sharing c.1 then rightTensor rightLength parentShape c + else strand (Fin (rightLength c.1)) + +omit [Fintype H] [DecidableEq H] in +theorem block_eq_children (h : H) (u : Shape) + (hu : sharing h = true → ∀ s, shapeNat u s ≤ parentShape h s) : + block (Left leftLength) (Right rightLength) + (inputTensor leftLength rightLength parentShape sharing) + (coarse leftLength rightLength hleft) (h, u) = + Tensor.product (leftTensor (F := F) leftLength (h, u)) + (childRight rightLength parentShape sharing (h, u)) := by + by_cases hs : sharing h = true + · funext x y z + have hh := congrFun (congrFun (congrFun + (block_eq_product (F := F) leftLength rightLength parentShape hleft h u (hu hs)) x) y) z + simpa only [block, inputTensor, childRight, hs, ↓reduceIte] using hh + · funext x y z + simp [block, inputTensor, childRight, hs, leftTensor, shapeTensor, + coarse, CWCoarseIndices.coarseIndex, Fin.ext_iff, shapeNat, shapeSide, + Tensor.product, ite_mul] + +omit [DecidableEq H] in +theorem canonicalBase_eq_children + (hsupport : ∀ h u, 0 < counts h u → sharing h = true → + ∀ s, shapeNat u s ≤ parentShape h s) : + canonicalBase counts (Left leftLength) (Right rightLength) + (inputTensor leftLength rightLength parentShape sharing) + (coarse leftLength rightLength hleft) = + pairClassProduct (leftTensor (F := F) leftLength) + (childRight rightLength parentShape sharing) := by + funext x y z + unfold canonicalBase + have hf : (∏ c : ClassKey (H := H), ∏ j : ClassPositions counts c, + block (Left leftLength) (Right rightLength) + (inputTensor leftLength rightLength parentShape sharing) + (coarse leftLength rightLength hleft) c + (x.left c j, x.right c j) (y.left c j, y.right c j) (z.left c j, z.right c j)) = + ∏ c : ClassKey (H := H), ∏ j : ClassPositions counts c, + (leftTensor (F := F) leftLength c (x.left c j) (y.left c j) (z.left c j) * + childRight rightLength parentShape sharing c + (x.right c j) (y.right c j) (z.right c j)) := by + apply Finset.prod_congr rfl + intro c _ + apply Finset.prod_congr rfl + intro j _ + have hc : 0 < counts c.1 c.2 := lt_of_le_of_lt (Nat.zero_le j.val) j.isLt + rw [block_eq_children leftLength rightLength parentShape sharing hleft c.1 c.2 + (hsupport c.1 c.2 hc)] + rfl + rw [hf] + simp only [pairClassProduct, classProduct, Finset.prod_mul_distrib] + +def rawSource : Tensor F (RawStrands counts leftLength rightLength) + (RawStrands counts leftLength rightLength) (RawStrands counts leftLength rightLength) := + classProduct (fun h => if sharing h then + shapeTensor (Fin (leftLength h) ⊕ Fin (rightLength h)) (parentShape h) + else strand (Fin (leftLength h) ⊕ Fin (rightLength h))) + +theorem inputTensor_restrict : + Tensor.restrict (joinMatrix (F := F) counts leftLength rightLength) + (joinMatrix counts leftLength rightLength) (joinMatrix counts leftLength rightLength) + (rawSource counts leftLength rightLength parentShape sharing) = + sourceTensor counts (Left leftLength) (Right rightLength) + (inputTensor leftLength rightLength parentShape sharing) := by + classical + funext x y z + simp only [Tensor.restrict, joinMatrix] + simp only [ite_mul, mul_ite, zero_mul, mul_zero, one_mul, Finset.sum_ite_eq', + Finset.mem_univ, ↓reduceIte] + unfold rawSource sourceTensor classProduct inputTensor + apply Finset.prod_congr rfl + intro h _ + apply Finset.prod_congr rfl + intro i _ + by_cases hs : sharing h = true + · simp [hs, joinWords, parentTensor] + · simp [hs, joinWords, strand_sum_elim] + +omit [Fintype H] [DecidableEq H] in +theorem coarse_support (h : H) + (x y z : Left leftLength h × Right rightLength h) + (hT : inputTensor (F := F) leftLength rightLength parentShape sharing h x y z ≠ 0) : + (coarse leftLength rightLength hleft 0 h x).val + + (coarse leftLength rightLength hleft 1 h y).val + + (coarse leftLength rightLength hleft 2 h z).val = 2 * leftLength h := by + by_cases hs : sharing h = true + · have hp : parentTensor (F := F) leftLength rightLength parentShape h x y z ≠ 0 := by + simpa [inputTensor, hs] using hT + have hh := CWCoarseIndices.split_coarse_support + (F := F) (by simpa using hleft h) (parentShape h) x y z hp + simpa only [coarse, Fintype.card_fin] using hh.1 + · have ht : strand (F := F) (Fin (leftLength h)) x.1 y.1 z.1 ≠ 0 := by + intro hz + apply hT + simp [inputTensor, hs, Tensor.product, hz] + simpa only [coarse, Fintype.card_fin] using + CWCoarseIndices.strand_coarse_support (F := F) (by simpa using hleft h) x.1 y.1 z.1 ht + +theorem typeWindow_zero_one {P A : Type*} [Fintype P] [DecidableEq P] + [Fintype A] [DecidableEq A] (w : P → A) : typeWindow (fun _ => 0) 1 w := by + intro a + dsimp [empiricalLaw] + have h0 : (0 : ℝ) ≤ (wordPopulation w a : ℝ) / Fintype.card P := by positivity + rw [sub_zero, abs_of_nonneg h0] + by_cases hp : Fintype.card P = 0 + · simp [hp] + · apply (div_le_one (by exact_mod_cast Nat.pos_of_ne_zero hp)).2 + exact_mod_cast (Fintype.card_subtype_le (fun i : P => w i = a)) + +abbrev MixedWords := RawPairs counts (Left leftLength) (Right rightLength) + +def coarseWord (w : MixedWords counts leftLength rightLength) : Position counts → Fin 17 := + JointCanonicalization.coarseWord counts (Left leftLength) (Right rightLength) + (coarse leftLength rightLength hleft) 0 w + +def sideMask (s : Fin 3) (w : MixedWords counts leftLength rightLength) : Prop := + ∀ h a, wordPopulation (fun i => coarseWord counts leftLength rightLength hleft w ⟨h, i⟩) a = + wordPopulation (sideWord counts s (triple counts (canonicalTarget counts)) h) a + +def maskedSource : Tensor F (MixedWords counts leftLength rightLength) + (MixedWords counts leftLength rightLength) (MixedWords counts leftLength rightLength) := + ExactRecovery.delete + (sourceTensor counts (Left leftLength) (Right rightLength) + (inputTensor leftLength rightLength parentShape sharing)) + (sideMask counts leftLength rightLength hleft 0) + (sideMask counts leftLength rightLength hleft 1) + (sideMask counts leftLength rightLength hleft 2) + +omit [Fintype H] [DecidableEq H] in +theorem sideMask_of_target (s : Fin 3) (e : Target counts) + (w : MixedWords counts leftLength rightLength) + (he : coarseWord counts leftLength rightLength hleft w = + fun i => sideWord counts s (triple counts e) i.1 i.2) : + sideMask counts leftLength rightLength hleft s w := by + intro h a + rw [he] + exact marginal_population_eq counts e (canonicalTarget counts) h s a + +theorem maskedSource_support (x y z : MixedWords counts leftLength rightLength) + (hT : maskedSource (F := F) counts leftLength rightLength parentShape sharing hleft x y z ≠ 0) : + (coarseWord counts leftLength rightLength hleft x, + coarseWord counts leftLength rightLength hleft y, + coarseWord counts leftLength rightLength hleft z) ∈ + ambientSet counts (fun h => 2 * leftLength h) := by + have hm : sideMask counts leftLength rightLength hleft 0 x ∧ + sideMask counts leftLength rightLength hleft 1 y ∧ + sideMask counts leftLength rightLength hleft 2 z := by + by_contra hn + simp [maskedSource, ExactRecovery.delete, hn] at hT + have hr : sourceTensor counts (Left leftLength) (Right rightLength) + (inputTensor (F := F) leftLength rightLength parentShape sharing) x y z ≠ 0 := by + simpa [maskedSource, ExactRecovery.delete, hm] using hT + apply Finset.mem_filter.mpr + refine ⟨Finset.mem_univ _, ?_, ?_⟩ + · intro i + have hi : inputTensor (F := F) leftLength rightLength parentShape sharing i.1 + (x i.1 i.2) (y i.1 i.2) (z i.1 i.2) ≠ 0 := by + intro hz + apply hr + unfold sourceTensor classProduct + apply Finset.prod_eq_zero (Finset.mem_univ i.1) + exact Finset.prod_eq_zero (Finset.mem_univ i.2) hz + exact coarse_support leftLength rightLength parentShape sharing hleft i.1 + (x i.1 i.2) (y i.1 i.2) (z i.1 i.2) hi + · intro h s a + fin_cases s + · exact hm.1 h a + · exact hm.2.1 h a + · exact hm.2.2 h a + +omit [DecidableEq H] in +theorem coarseIdeal_support_masks (e : Target counts) + (x y z : MixedWords counts leftLength rightLength) + (hT : coarseIdeal counts (Left leftLength) (Right rightLength) + (inputTensor (F := F) leftLength rightLength parentShape sharing) + (coarse leftLength rightLength hleft) e x y z ≠ 0) : + sideMask counts leftLength rightLength hleft 0 x ∧ + sideMask counts leftLength rightLength hleft 1 y ∧ + sideMask counts leftLength rightLength hleft 2 z := by + have hc : coarseMask counts (Left leftLength) (Right rightLength) + (coarse leftLength rightLength hleft) 0 e x ∧ + coarseMask counts (Left leftLength) (Right rightLength) + (coarse leftLength rightLength hleft) 1 e y ∧ + coarseMask counts (Left leftLength) (Right rightLength) + (coarse leftLength rightLength hleft) 2 e z := by + by_contra hn + simp [coarseIdeal, ExactRecovery.delete, hn] at hT + constructor + · apply sideMask_of_target counts leftLength rightLength hleft 0 e x + funext i + exact hc.1 i.1 i.2 + constructor + · apply sideMask_of_target counts leftLength rightLength hleft 1 e y + funext i + exact hc.2.1 i.1 i.2 + · apply sideMask_of_target counts leftLength rightLength hleft 2 e z + funext i + exact hc.2.2 i.1 i.2 + +omit [DecidableEq H] in +theorem ideal_support_masks (e : Target counts) + (px py pz : MixedWords counts leftLength rightLength → Prop) + (x y z : MixedWords counts leftLength rightLength) + (hT : ExactRecovery.delete + (coarseIdeal counts (Left leftLength) (Right rightLength) + (inputTensor (F := F) leftLength rightLength parentShape sharing) + (coarse leftLength rightLength hleft) e) px py pz x y z ≠ 0) : + sideMask counts leftLength rightLength hleft 0 x ∧ + sideMask counts leftLength rightLength hleft 1 y ∧ + sideMask counts leftLength rightLength hleft 2 z := by + apply coarseIdeal_support_masks (F := F) counts leftLength rightLength parentShape sharing hleft e x y z + intro hz + simp [ExactRecovery.delete, hz] at hT + +omit [DecidableEq H] in +theorem delete_ideal_eq (e : Target counts) + (px py pz : MixedWords counts leftLength rightLength → Prop) : + let Q := ExactRecovery.delete + (coarseIdeal counts (Left leftLength) (Right rightLength) + (inputTensor (F := F) leftLength rightLength parentShape sharing) + (coarse leftLength rightLength hleft) e) px py pz + ExactRecovery.delete Q (sideMask counts leftLength rightLength hleft 0) + (sideMask counts leftLength rightLength hleft 1) + (sideMask counts leftLength rightLength hleft 2) = Q := by + dsimp only + funext x y z + by_cases h : ExactRecovery.delete + (coarseIdeal counts (Left leftLength) (Right rightLength) + (inputTensor (F := F) leftLength rightLength parentShape sharing) + (coarse leftLength rightLength hleft) e) px py pz x y z = 0 + · rw [ExactRecovery.delete, h] + simp + · have hm := ideal_support_masks (F := F) counts leftLength rightLength parentShape sharing hleft + e px py pz x y z h + rw [ExactRecovery.delete, ite_eq_left hm] + +end MatrixMultiplication.JointCanonicalMixed + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/Construction/JointCanonicalSymmetry.lean b/lean/OAI/LinearAlgebra/MatrixFields/Construction/JointCanonicalSymmetry.lean new file mode 100644 index 0000000000000000000000000000000000000000..3f50afaf3ca08060b0fc93bb5f6552518dabc9e9 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/Construction/JointCanonicalSymmetry.lean @@ -0,0 +1,93 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Histories.HistoryRecoveryBudget + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section + +namespace MatrixMultiplication.JointCanonicalSymmetry + +open MatrixMultiplication.Foundation JointPopulation JointCanonicalization JointCanonicalCW +open JointCanonicalMixed HistorySymmetry PermutationMatching + +attribute [local instance] Classical.propDecidable + +variable {H F : Type*} [Fintype H] [DecidableEq H] [CommRing F] + (counts : H → Shape → ℕ) (leftLength rightLength : H → ℕ) + (parentShape : H → Fin 3 → ℕ) (sharing : H → Bool) + (hleft : ∀ h, leftLength h ≤ 8) + {SL SR : H → Type*} + [∀ h, Fintype (SL h)] [∀ h, Fintype (SR h)] + [∀ h, DecidableEq (SL h)] [∀ h, DecidableEq (SR h)] + (sl : Fin 3 → ∀ c : ClassKey (H := H), Left leftLength c.1 → SL c.1) + (sr : Fin 3 → ∀ c : ClassKey (H := H), Right rightLength c.1 → SR c.1) + (νl : Fin 3 → ∀ c : ClassKey (H := H), SL c.1 → ℝ) + (νr : Fin 3 → ∀ c : ClassKey (H := H), SR c.1 → ℝ) + (ηl ηr : Fin 3 → ClassKey (H := H) → ℝ) + (hsupport : ∀ h u, 0 < counts h u → sharing h = true → + ∀ s, shapeNat u s ≤ parentShape h s) + +include hsupport + +omit [DecidableEq H] [∀ h, Fintype (SL h)] [∀ h, Fintype (SR h)] in +theorem canonicalIdeal_smul + (g : HalfClassPermutations (ClassPositions counts)) + (x y z : CanonicalPairs counts (Left leftLength) (Right rightLength)) : + canonicalIdeal counts (Left leftLength) (Right rightLength) + (inputTensor (F := F) leftLength rightLength parentShape sharing) + (coarse leftLength rightLength hleft) sl sr νl νr ηl ηr + (g • x) (g • y) (g • z) = + canonicalIdeal counts (Left leftLength) (Right rightLength) + (inputTensor leftLength rightLength parentShape sharing) + (coarse leftLength rightLength hleft) sl sr νl νr ηl ηr x y z := by + simp only [canonicalIdeal, + JointCanonicalMixed.canonicalBase_eq_children counts leftLength rightLength + parentShape sharing hleft hsupport, + ExactRecovery.delete, childWindows_smul, pairClassProduct_smul] + +omit [DecidableEq H] in +theorem rawIdeal_smul (e : Target counts) : + letI rawInst : MulAction (HalfClassPermutations (ClassPositions counts)) + (RawPairs counts (Left leftLength) (Right rightLength)) := + EquivOrbitTransport.action (pairEquiv counts (Left leftLength) (Right rightLength) e) + ∀ (g : HalfClassPermutations (ClassPositions counts)) + (x y z : RawPairs counts (Left leftLength) (Right rightLength)), + JointCanonicalization.ideal counts (Left leftLength) (Right rightLength) + (inputTensor (F := F) leftLength rightLength parentShape sharing) + (coarse leftLength rightLength hleft) sl sr νl νr ηl ηr e + (@SMul.smul _ _ rawInst.toSMul g x) + (@SMul.smul _ _ rawInst.toSMul g y) + (@SMul.smul _ _ rawInst.toSMul g z) = + JointCanonicalization.ideal counts (Left leftLength) (Right rightLength) + (inputTensor leftLength rightLength parentShape sharing) + (coarse leftLength rightLength hleft) sl sr νl νr ηl ηr e x y z := by + refine EquivOrbitTransport.coefficients_preserved + (G := HalfClassPermutations (ClassPositions counts)) + (pairEquiv counts (Left leftLength) (Right rightLength) e) + (pairEquiv counts (Left leftLength) (Right rightLength) e) + (pairEquiv counts (Left leftLength) (Right rightLength) e) + (JointCanonicalization.ideal counts (Left leftLength) (Right rightLength) + (inputTensor (F := F) leftLength rightLength parentShape sharing) + (coarse leftLength rightLength hleft) sl sr νl νr ηl ηr e) + (canonicalIdeal counts (Left leftLength) (Right rightLength) + (inputTensor (F := F) leftLength rightLength parentShape sharing) + (coarse leftLength rightLength hleft) sl sr νl νr ηl ηr) ?_ ?_ + · exact ideal_eq_canonicalIdeal counts (Left leftLength) (Right rightLength) + (inputTensor leftLength rightLength parentShape sharing) + (coarse leftLength rightLength hleft) sl sr νl νr ηl ηr e + · exact canonicalIdeal_smul counts leftLength rightLength parentShape sharing hleft + sl sr νl νr ηl ηr hsupport + +end MatrixMultiplication.JointCanonicalSymmetry + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/Construction/JointCoarseReorder.lean b/lean/OAI/LinearAlgebra/MatrixFields/Construction/JointCoarseReorder.lean new file mode 100644 index 0000000000000000000000000000000000000000..d5312f4a961fbb6e04a47178108845e093624460 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/Construction/JointCoarseReorder.lean @@ -0,0 +1,50 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Extraction.JointMaskedSelection + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +noncomputable section +namespace MatrixMultiplication.JointCoarseReorder +open JointCoarseHashing +open scoped BigOperators +attribute [local instance] Classical.propDecidable + +def tripleSide {P : Type*} (s : Fin 3) (t : Triple P) : Word P := + (Matrix.vecCons (t.1) (Matrix.vecCons (t.2.1) (Matrix.vecCons (t.2.2) Matrix.vecEmpty))) s + +def reorder {P : Type*} (sigma : Equiv.Perm (Fin 3)) (t : Triple P) : Triple P := + (tripleSide (sigma 0) t, tripleSide (sigma 1) t, tripleSide (sigma 2) t) + +@[simp] theorem tripleSide_reorder {P : Type*} (sigma : Equiv.Perm (Fin 3)) + (t : Triple P) (s : Fin 3) : + tripleSide s (reorder sigma t) = tripleSide (sigma s) t := by + fin_cases s <;> rfl + +theorem reorder_injective {P : Type*} (sigma : Equiv.Perm (Fin 3)) : + Function.Injective (reorder (P := P) sigma) := by + intro t u h + have hs (s : Fin 3) : tripleSide s t = tripleSide s u := by + have hh := congrArg (tripleSide (sigma.symm s)) h + simpa only [tripleSide_reorder, sigma.apply_symm_apply] using hh + exact Prod.ext (hs 0) (Prod.ext (hs 1) (hs 2)) + +theorem reorder_support {P : Type*} (sigma : Equiv.Perm (Fin 3)) (S : P → ℕ) + (t : Triple P) (ht : HasSupportSum S t) : HasSupportSum S (reorder sigma t) := by + intro p + have hsum : (∑ i : Fin 3, (tripleSide (sigma i) t p).val) = + ∑ i : Fin 3, (tripleSide i t p).val := + Equiv.sum_comp sigma (fun i : Fin 3 => (tripleSide i t p).val) + simpa [reorder, tripleSide, Fin.sum_univ_succ, Nat.add_assoc] using hsum.trans (by + simpa [tripleSide, Fin.sum_univ_succ, Nat.add_assoc] using ht p) + +end MatrixMultiplication.JointCoarseReorder + +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/Construction/JointCompatibilityCountProducer.lean b/lean/OAI/LinearAlgebra/MatrixFields/Construction/JointCompatibilityCountProducer.lean new file mode 100644 index 0000000000000000000000000000000000000000..74c153b6a636c73bddfef1c97520f1d358ef419f --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/Construction/JointCompatibilityCountProducer.lean @@ -0,0 +1,371 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Extraction.GroupPairWindows + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section + +namespace MatrixMultiplication.JointCompatibilityCountProducer + +open MatrixMultiplication.Foundation JointTypeCounts JointCompatibilityIncidence +open JointCompatibilityControls JointCompatibilityScaling JointCompatibilityRateLimit Filter +open scoped BigOperators Topology + +attribute [local instance] Classical.propDecidable + +private theorem exists_pos_le_family_inline_MatrixMultiplication_JointCompatibilityCountProducer {K : Type*} [Fintype K] + (δ : K → ℝ) (hδ : ∀ k, 0 < δ k) : + ∃ ε : ℝ, 0 < ε ∧ ∀ k, ε ≤ δ k := by + classical + have aux : ∀ s : Finset K, ∃ ε : ℝ, 0 < ε ∧ ∀ k ∈ s, ε ≤ δ k := by + intro s + induction s using Finset.induction_on with + | empty => exact ⟨1, zero_lt_one, by simp⟩ + | @insert k s hk ih => + obtain ⟨ε, hε, hb⟩ := ih + refine ⟨min (δ k) ε, lt_min (hδ k) hε, ?_⟩ + intro j hj + rcases Finset.mem_insert.mp hj with rfl | hj + · exact min_le_left _ _ + · exact (min_le_right _ _).trans (hb j hj) + obtain ⟨ε, hε, hb⟩ := aux Finset.univ + exact ⟨ε, hε, fun k => hb k (Finset.mem_univ k)⟩ + +variable {C : Type*} [Fintype C] [DecidableEq C] + {Shape A : C → Type*} + [∀ c, Fintype (Shape c)] [∀ c, DecidableEq (Shape c)] + [∀ c, Fintype (A c)] [∀ c, DecidableEq (A c)] + +omit [DecidableEq C] [∀ c, DecidableEq (Shape c)] [∀ c, DecidableEq (A c)] in +private theorem exists_group_entropy_window_inline_MatrixMultiplication_JointCompatibilityCountProducer (base : ∀ c, Shape c → ℕ) + (d : ∀ c, Shape c → Prop) (law : ∀ c, Shape c → A c → ℝ) + {ε : ℝ} (hε : 0 < ε) : + ∃ δ : ℝ, 0 < δ ∧ ∀ (g : Σ c, Option (Shape c)) (q : A g.1 → ℝ), + (∀ a, |q a - groupCenter base d law g a| ≤ δ) → + finiteEntropy q ≤ groupCap base d law ε g := by + have hex : ∀ g : Σ c, Option (Shape c), ∃ δ : ℝ, 0 < δ ∧ + ∀ q : A g.1 → ℝ, (∀ a, |q a - groupCenter base d law g a| ≤ δ) → + |finiteEntropy q - finiteEntropy (groupCenter base d law g)| < ε := + fun g => exists_entropy_window (groupCenter base d law g) hε + choose δ hδ hw using hex + obtain ⟨δ₀, hδ₀, hsmall⟩ := exists_pos_le_family_inline_MatrixMultiplication_JointCompatibilityCountProducer δ hδ + refine ⟨δ₀, hδ₀, ?_⟩ + intro g q hq + have hh := (abs_lt.mp (hw g q (fun a => (hq a).trans (hsmall g)))).2 + change finiteEntropy q ≤ finiteEntropy (groupCenter base d law g) + ε + linarith + +omit [Fintype C] [DecidableEq C] in +private theorem repeated_residual_width_le_inline_MatrixMultiplication_JointCompatibilityCountProducer + {Pos : C → Type*} [∀ c, Fintype (Pos c)] [∀ c, DecidableEq (Pos c)] + (base : ∀ c, Shape c → ℕ) (d : ∀ c, Shape c → Prop) + (t : ℕ) (w : FixedClassWords Pos Shape (fun c u => t * base c u)) + (χ η δ : ℝ) (hδ : 0 ≤ δ) + (hnum : ∀ c, η + (designatedBase base d c : ℝ) * χ ≤ δ) (c : C) : + ((t : ℝ) * η + (∑ u : {u : Shape c // d c u}, ((t * base c u.val : ℕ) : ℝ)) * χ) / + Fintype.card {i : Pos c // ¬d c ((w c).val i)} ≤ δ := by + have hsum : (∑ u : {u : Shape c // d c u}, ((t * base c u.val : ℕ) : ℝ)) = + (t : ℝ) * designatedBase base d c := by + simp only [Nat.cast_mul, designatedBase, Nat.cast_sum, Finset.mul_sum] + rw [residual_card_repeated, hsum, Nat.cast_mul] + by_cases ht : t = 0 + · simpa only [ht, Nat.cast_zero, zero_mul, add_zero, zero_add, zero_div] using hδ + by_cases hr : residualBase base d c = 0 + · simpa only [hr, Nat.cast_zero, mul_zero, div_zero] using hδ + have htpos : (0 : ℝ) < t := Nat.cast_pos.mpr (Nat.pos_of_ne_zero ht) + have hrpos : (0 : ℝ) < residualBase base d c := Nat.cast_pos.mpr (Nat.pos_of_ne_zero hr) + have hrone : (1 : ℝ) ≤ residualBase base d c := by exact_mod_cast Nat.one_le_iff_ne_zero.mpr hr + have hres : η + (designatedBase base d c : ℝ) * χ ≤ δ * residualBase base d c := + (hnum c).trans (by simpa only [mul_one] using mul_le_mul_of_nonneg_left hrone hδ) + apply (div_le_iff₀ (mul_pos htpos hrpos)).mpr + calc + (t : ℝ) * η + ((t : ℝ) * designatedBase base d c) * χ = + (t : ℝ) * (η + (designatedBase base d c : ℝ) * χ) := by ring + _ ≤ (t : ℝ) * (δ * residualBase base d c) := + mul_le_mul_of_nonneg_left hres htpos.le + _ = δ * ((t : ℝ) * residualBase base d c) := by ring + +omit [DecidableEq C] in +theorem exists_uniform_sideEntropyControl_all_positions + (Pair : C → Type*) [∀ c, Fintype (Pair c)] [∀ c, DecidableEq (Pair c)] + (base : ∀ c, Shape c → ℕ) (d : ∀ c, Shape c → Prop) + (law : ∀ c, Shape c → A c → ℝ) (part : ∀ c, Pair c → A c) + (h0 : ∀ c u a, 0 ≤ law c u a) (h1 : ∀ c u a, law c u a ≤ 1) + {ε χMax ηMax : ℝ} (hε : 0 < ε) (hχMax : 0 < χMax) (hηMax : 0 < ηMax) : + ∃ χ η : ℝ, 0 < χ ∧ χ ≤ χMax ∧ 0 < η ∧ η ≤ ηMax ∧ + ∀ (t : ℕ) (Pos : C → Type*) [∀ c, Fintype (Pos c)] [∀ c, DecidableEq (Pos c)] + (pairCounts : ∀ c, Pair c → ℕ) + (w : FixedClassWords Pos Shape (fun c u => t * base c u)), + (∀ c a, |((∑ s : {s : Pair c // part c s = a}, pairCounts c s.val : ℕ) : ℝ) - + (t : ℝ) * totalCenterCount base law c a| ≤ (t : ℝ) * η) → + Nonempty (SideEntropyControl Pos Shape Pair A (fun c u => t * base c u) + pairCounts part d law χ (groupCap base d law ε) w) := by + obtain ⟨δ, hδ, hwindow⟩ := exists_group_entropy_window_inline_MatrixMultiplication_JointCompatibilityCountProducer base d law hε + let D : ℕ := ∑ c, designatedBase base d c + have hD : (0 : ℝ) ≤ D := Nat.cast_nonneg _ + have hden : 0 < 2 * ((D : ℝ) + 1) := by positivity + let χ₀ : ℝ := δ / (2 * ((D : ℝ) + 1)) + have hχ₀ : 0 < χ₀ := div_pos hδ hden + have heq : (2 * ((D : ℝ) + 1)) * χ₀ = δ := mul_div_cancel₀ _ hden.ne' + have hχδ : χ₀ ≤ δ := by nlinarith [mul_nonneg hD hχ₀.le] + have hDχ : (D : ℝ) * χ₀ ≤ δ / 2 := by nlinarith + let χ := min χMax χ₀ + let η := min ηMax (δ / 2) + have hχ : 0 < χ := lt_min hχMax hχ₀ + have hη : 0 < η := lt_min hηMax (half_pos hδ) + have hχδ' : χ ≤ δ := (min_le_right _ _).trans hχδ + have hnum (c : C) : η + (designatedBase base d c : ℝ) * χ ≤ δ := by + have hc : (designatedBase base d c : ℝ) ≤ D := by + exact_mod_cast (Finset.single_le_sum (fun _ _ => Nat.zero_le _) + (Finset.mem_univ c) : designatedBase base d c ≤ ∑ c, designatedBase base d c) + have hm : (designatedBase base d c : ℝ) * χ ≤ (D : ℝ) * χ₀ := + mul_le_mul hc (min_le_right _ _) hχ.le hD + have he : η ≤ δ / 2 := min_le_right _ _ + linarith + refine ⟨χ, η, hχ, min_le_left _ _, hη, min_le_left _ _, ?_⟩ + intro t Pos _ _ pairCounts w haggr + refine ⟨{ + residualLaw := residualCenter base d law + totalTarget := fun c a => (t : ℝ) * totalCenterCount base law c a + totalError := fun _ => (t : ℝ) * η + aggregate_window := haggr + mixture_balance := repeated_mixture_balance base d law t w + nonneg := groupCap_nonneg base d law h0 h1 hε.le + designated_entropy := ?_ + residual_entropy := ?_ }⟩ + · intro c u _ q hq + exact hwindow ⟨c, some u⟩ q (fun a => (hq a).trans hχδ') + · intro c q hq + exact hwindow ⟨c, none⟩ q (fun a => (hq a).trans + (repeated_residual_width_le_inline_MatrixMultiplication_JointCompatibilityCountProducer base d t w χ η δ hδ.le hnum c)) + +section PairMarginals + +variable {Pair : C → Type*} + [∀ c, Fintype (Pair c)] [∀ c, DecidableEq (Pair c)] + +def aggregateCoefficient (base : ∀ c, Shape c → ℕ) + (Pair : C → Type*) [∀ c, Fintype (Pair c)] : ℕ := + ∑ c, baseSize base c * Fintype.card (Pair c) + +omit [DecidableEq C] [∀ c, Fintype (A c)] in +theorem aggregate_error_of_pairWindow + (base : ∀ c, Shape c → ℕ) (q : ∀ c, Pair c → ℝ) + (law : ∀ c, Shape c → A c → ℝ) (part : ∀ c, Pair c → A c) + (hbalance : ∀ c a, (baseSize base c : ℝ) * + (∑ b : {b : Pair c // part c b = a}, q c b.val) = totalCenterCount base law c a) + (t : ℕ) (ht : 0 < t) (Pos : C → Type*) + [∀ c, Fintype (Pos c)] [∀ c, DecidableEq (Pos c)] + (pairCounts : ∀ c, Pair c → ℕ) + (w : FixedClassWords Pos Shape (fun c u => t * base c u)) + (z : FixedClassWords Pos Pair pairCounts) {η : ℝ} (hη : 0 ≤ η) + (hp : PairWindow base q Pos pairCounts η) (c : C) (a : A c) : + |((∑ b : {b : Pair c // part c b = a}, pairCounts c b.val : ℕ) : ℝ) - + (t : ℝ) * totalCenterCount base law c a| ≤ + (t : ℝ) * (aggregateCoefficient base Pair : ℝ) * η := by + by_cases hz : baseSize base c = 0 + · have hsum : (∑ b, pairCounts c b) = 0 := by + rw [← JointCompatibilityEntropyBound.fixedClassWords_size Pos Pair pairCounts z c, + repeated_positions_card Pos base t w c, hz, Nat.mul_zero] + have hcount (b : Pair c) : pairCounts c b = 0 := + Nat.eq_zero_of_le_zero ((Finset.single_le_sum (fun _ _ => Nat.zero_le _) + (Finset.mem_univ b)).trans_eq hsum) + have hcenter : totalCenterCount base law c a = 0 := by + rw [← hbalance c a, hz, Nat.cast_zero, zero_mul] + simpa only [hcount, Finset.sum_const_zero, Nat.cast_zero, hcenter, mul_zero, + sub_self, abs_zero] using + mul_nonneg (mul_nonneg (Nat.cast_nonneg t) + (Nat.cast_nonneg (aggregateCoefficient base Pair))) hη + have hb : 0 < baseSize base c := Nat.pos_of_ne_zero hz + have hn : (0 : ℝ) < Fintype.card (Pos c) := by + rw [repeated_positions_card Pos base t w c, Nat.cast_mul] + exact mul_pos (Nat.cast_pos.mpr ht) (Nat.cast_pos.mpr hb) + have hcoord (b : Pair c) : + |(pairCounts c b : ℝ) - (t : ℝ) * (baseSize base c : ℝ) * q c b| ≤ + (t : ℝ) * (baseSize base c : ℝ) * η := by + have heq : (Fintype.card (Pos c) : ℝ) * + ((pairCounts c b : ℝ) / Fintype.card (Pos c) - q c b) = + (pairCounts c b : ℝ) - (Fintype.card (Pos c) : ℝ) * q c b := by + rw [mul_sub, mul_div_cancel₀ _ hn.ne'] + have h := calc + |(pairCounts c b : ℝ) - (Fintype.card (Pos c) : ℝ) * q c b| = + |(Fintype.card (Pos c) : ℝ) * + ((pairCounts c b : ℝ) / Fintype.card (Pos c) - q c b)| := + congrArg abs heq.symm + _ = (Fintype.card (Pos c) : ℝ) * + |(pairCounts c b : ℝ) / Fintype.card (Pos c) - q c b| := by + rw [abs_mul, abs_of_pos hn] + _ ≤ (Fintype.card (Pos c) : ℝ) * η := + mul_le_mul_of_nonneg_left (hp c hb b) hn.le + simpa only [repeated_positions_card Pos base t w c, Nat.cast_mul] using h + have hm := marginal_coordinate_error + (fun b : {b : Pair c // part c b = a} => (pairCounts c b.val : ℝ)) + (fun b => (t : ℝ) * (baseSize base c : ℝ) * q c b.val) + ((t : ℝ) * (baseSize base c : ℝ) * η) (fun b => hcoord b.val) + have hsum : (∑ b : {b : Pair c // part c b = a}, + (t : ℝ) * (baseSize base c : ℝ) * q c b.val) = + (t : ℝ) * totalCenterCount base law c a := by + rw [← Finset.mul_sum, mul_assoc, hbalance c a] + have hm' : + |((∑ b : {b : Pair c // part c b = a}, pairCounts c b.val : ℕ) : ℝ) - + (t : ℝ) * totalCenterCount base law c a| ≤ + (Fintype.card {b : Pair c // part c b = a} : ℝ) * + ((t : ℝ) * (baseSize base c : ℝ) * η) := by + simpa only [Nat.cast_sum, hsum] using hm + have hKnat : baseSize base c * Fintype.card {b : Pair c // part c b = a} ≤ + aggregateCoefficient base Pair := + (Nat.mul_le_mul_left _ (Fintype.card_subtype_le _)).trans + (Finset.single_le_sum + (f := fun d => baseSize base d * Fintype.card (Pair d)) + (fun _ _ => Nat.zero_le _) (Finset.mem_univ c)) + have hK : (baseSize base c : ℝ) * + (Fintype.card {b : Pair c // part c b = a} : ℝ) ≤ + (aggregateCoefficient base Pair : ℝ) := by exact_mod_cast hKnat + have hmul := mul_le_mul_of_nonneg_left hK (mul_nonneg (Nat.cast_nonneg t) hη) + nlinarith + +end PairMarginals + +section CountProducer + +variable {Pair Left Right : C → Type*} + [∀ c, Fintype (Pair c)] [∀ c, DecidableEq (Pair c)] + [∀ c, Fintype (Left c)] [∀ c, DecidableEq (Left c)] + [∀ c, Fintype (Right c)] [∀ c, DecidableEq (Right c)] + +theorem exists_widths_eventually_count_le + (base : ∀ c, Shape c → ℕ) (q : ∀ c, Pair c → ℝ) + (leftPart : ∀ c, Pair c → Left c) (rightPart : ∀ c, Pair c → Right c) + (designatedLeft designatedRight : ∀ c, Shape c → Prop) + (leftLaw : ∀ c, Shape c → Left c → ℝ) + (rightLaw : ∀ c, Shape c → Right c → ℝ) + (hparts : ∀ c, Function.Injective (fun a : Pair c => (leftPart c a, rightPart c a))) + (hL0 : ∀ c u a, 0 ≤ leftLaw c u a) (hL1 : ∀ c u a, leftLaw c u a ≤ 1) + (hR0 : ∀ c u a, 0 ≤ rightLaw c u a) (hR1 : ∀ c u a, rightLaw c u a ≤ 1) + (hleft : ∀ c a, (baseSize base c : ℝ) * + (∑ b : {b : Pair c // leftPart c b = a}, q c b.val) = + totalCenterCount base leftLaw c a) + (hright : ∀ c a, (baseSize base c : ℝ) * + (∑ b : {b : Pair c // rightPart c b = a}, q c b.val) = + totalCenterCount base rightLaw c a) + {ε χMax ηMax : ℝ} (hε : 0 < ε) (hχMax : 0 < χMax) (hηMax : 0 < ηMax) : + ∃ χ η : ℝ, 0 < χ ∧ χ ≤ χMax ∧ 0 < η ∧ η ≤ ηMax ∧ + ∀ᶠ t : ℕ in atTop, + ∀ (Pos : C → Type*) [∀ c, Fintype (Pos c)] [∀ c, DecidableEq (Pos c)] + (pairCounts : ∀ c, Pair c → ℕ) + (_ : FixedClassWords Pos Shape (fun c u => t * base c u)) + (z : FixedClassWords Pos Pair pairCounts), + PairWindow base q Pos pairCounts η → + (compatibleCandidateCount Pos Shape Pair Left Right (fun c u => t * base c u) + pairCounts leftPart rightPart designatedLeft designatedRight leftLaw rightLaw χ z : ℝ) ≤ + Real.exp ((t : ℝ) * + (compatibilityRate base q designatedLeft designatedRight + (groupCap base designatedLeft leftLaw 0) + (groupCap base designatedRight rightLaw 0) + ε)) ∧ + (0 < compatibleCandidateCount Pos Shape Pair Left Right (fun c u => t * base c u) + pairCounts leftPart rightPart designatedLeft designatedRight leftLaw rightLaw χ z → + Real.log (compatibleCandidateCount Pos Shape Pair Left Right (fun c u => t * base c u) + pairCounts leftPart rightPart designatedLeft designatedRight leftLaw rightLaw χ z : ℝ) / + (t : ℝ) ≤ compatibilityRate base q designatedLeft designatedRight + (groupCap base designatedLeft leftLaw 0) + (groupCap base designatedRight rightLaw 0) + ε) := by + let δ : ℝ := ε / (4 * ((totalBase base : ℝ) + 1)) + have hden : 0 < 4 * ((totalBase base : ℝ) + 1) := by positivity + have hδ : 0 < δ := div_pos hε hden + have hδeq : (4 * ((totalBase base : ℝ) + 1)) * δ = ε := + mul_div_cancel₀ _ hden.ne' + have hδbound : 2 * (totalBase base : ℝ) * δ ≤ ε / 2 := by nlinarith + obtain ⟨χL, ηL, hχL, hχLMax, hηL, _, hCL⟩ := + exists_uniform_sideEntropyControl_all_positions Pair base designatedLeft leftLaw leftPart + hL0 hL1 (ηMax := 1) hδ hχMax zero_lt_one + obtain ⟨χR, ηR, hχR, hχRMax, hηR, _, hCR⟩ := + exists_uniform_sideEntropyControl_all_positions Pair base designatedRight rightLaw rightPart + hR0 hR1 (ηMax := 1) hδ hχMax zero_lt_one + let χ := min χL χR + have hχ : 0 < χ := lt_min hχL hχR + have hχMax' : χ ≤ χMax := (min_le_left _ _).trans hχLMax + let K : ℕ := aggregateCoefficient base Pair + have hKden : (0 : ℝ) < (K : ℝ) + 1 := by positivity + let ηUpper : ℝ := min ηMax (min ηL ηR / ((K : ℝ) + 1)) + have hηUpper : 0 < ηUpper := lt_min hηMax (div_pos (lt_min hηL hηR) hKden) + obtain ⟨η, hη, hηUpper', hbound⟩ := exists_window_eventually_count_le + base q leftPart rightPart designatedLeft designatedRight leftLaw rightLaw hparts + (groupCap base designatedLeft leftLaw δ) (groupCap base designatedRight rightLaw δ) + (half_pos hε) hηUpper + have hηMax' : η ≤ ηMax := hηUpper'.trans (min_le_left _ _) + have hηscale : (K : ℝ) * η ≤ min ηL ηR := by + have hle : η ≤ min ηL ηR / ((K : ℝ) + 1) := + hηUpper'.trans (min_le_right _ _) + have hmul := (le_div_iff₀ hKden).mp hle + nlinarith + have hrate : + compatibilityRate base q designatedLeft designatedRight + (groupCap base designatedLeft leftLaw δ) (groupCap base designatedRight rightLaw δ) + + ε / 2 ≤ + compatibilityRate base q designatedLeft designatedRight + (groupCap base designatedLeft leftLaw 0) (groupCap base designatedRight rightLaw 0) + ε := by + have heq := compatibilityRate_add_caps base q designatedLeft designatedRight + (groupCap base designatedLeft leftLaw 0) (groupCap base designatedRight rightLaw 0) δ + have hcapL : (fun g => groupCap base designatedLeft leftLaw 0 g + δ) = + groupCap base designatedLeft leftLaw δ := by + funext g + simp only [groupCap, add_zero] + have hcapR : (fun g => groupCap base designatedRight rightLaw 0 g + δ) = + groupCap base designatedRight rightLaw δ := by + funext g + simp only [groupCap, add_zero] + rw [hcapL, hcapR] at heq + linarith only [heq, hδbound] + refine ⟨χ, η, hχ, hχMax', hη, hηMax', ?_⟩ + filter_upwards [hbound, eventually_ge_atTop (1 : ℕ)] with t hb ht + intro Pos _ _ pairCounts w z hp + have htpos : 0 < t := lt_of_lt_of_le Nat.zero_lt_one ht + have haggrL : ∀ c a, + |((∑ b : {b : Pair c // leftPart c b = a}, pairCounts c b.val : ℕ) : ℝ) - + (t : ℝ) * totalCenterCount base leftLaw c a| ≤ (t : ℝ) * ηL := by + intro c a + have h := aggregate_error_of_pairWindow base q leftLaw leftPart hleft + t htpos Pos pairCounts w z hη.le hp c a + have hscale := mul_le_mul_of_nonneg_left + (hηscale.trans (min_le_left _ _)) (Nat.cast_nonneg t) + change _ ≤ (t : ℝ) * (K : ℝ) * η at h + nlinarith + have haggrR : ∀ c a, + |((∑ b : {b : Pair c // rightPart c b = a}, pairCounts c b.val : ℕ) : ℝ) - + (t : ℝ) * totalCenterCount base rightLaw c a| ≤ (t : ℝ) * ηR := by + intro c a + have h := aggregate_error_of_pairWindow base q rightLaw rightPart hright + t htpos Pos pairCounts w z hη.le hp c a + have hscale := mul_le_mul_of_nonneg_left + (hηscale.trans (min_le_right _ _)) (Nat.cast_nonneg t) + change _ ≤ (t : ℝ) * (K : ℝ) * η at h + nlinarith + obtain ⟨controlL⟩ := hCL t Pos pairCounts w haggrL + obtain ⟨controlR⟩ := hCR t Pos pairCounts w haggrR + have controlL' := control_mono_width (fun c u => t * base c u) pairCounts + leftPart designatedLeft leftLaw (groupCap base designatedLeft leftLaw δ) w + controlL (show χ ≤ χL from min_le_left _ _) + have controlR' := control_mono_width (fun c u => t * base c u) pairCounts + rightPart designatedRight rightLaw (groupCap base designatedRight rightLaw δ) w + controlR (show χ ≤ χR from min_le_right _ _) + have hcount := hb Pos pairCounts w z χ hp controlL' controlR' + refine ⟨hcount.1.trans (Real.exp_le_exp.mpr + (mul_le_mul_of_nonneg_left hrate (Nat.cast_nonneg t))), ?_⟩ + intro hpos + exact (hcount.2 hpos).trans hrate + +end CountProducer + +end MatrixMultiplication.JointCompatibilityCountProducer + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/Construction/JointCompatibilityIncidence.lean b/lean/OAI/LinearAlgebra/MatrixFields/Construction/JointCompatibilityIncidence.lean new file mode 100644 index 0000000000000000000000000000000000000000..19872b2498fe7891ac6bdb9d5931b91c4ba840b4 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/Construction/JointCompatibilityIncidence.lean @@ -0,0 +1,704 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Extraction.JointTypeCounts + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section + +namespace MatrixMultiplication.JointCompatibilityIncidence + +open MatrixMultiplication.Foundation JointTypeCounts +open scoped BigOperators + +attribute [local instance] Classical.propDecidable + +section Actions + +variable {C : Type*} [Fintype C] [DecidableEq C] +variable (Pos A : C → Type*) + [∀ c, Fintype (Pos c)] [∀ c, DecidableEq (Pos c)] + [∀ c, Fintype (A c)] [∀ c, DecidableEq (A c)] + +abbrev ClassPerm := ∀ c, Equiv.Perm (Pos c) + +def permuteFixedWords (counts : ∀ c, A c → ℕ) + (g : ClassPerm Pos) (w : FixedClassWords Pos A counts) : + FixedClassWords Pos A counts := + fun c => ⟨(w c).val ∘ ((g c)⁻¹ : Equiv.Perm (Pos c)), fun a => + (wordPopulation_reindex (w c).val (g c)⁻¹ a).trans ((w c).property a)⟩ + +@[instance_reducible] +def fixedWordsMulAction (counts : ∀ c, A c → ℕ) : + MulAction (ClassPerm Pos) (FixedClassWords Pos A counts) where + smul := permuteFixedWords Pos A counts + one_smul w := by + funext c + apply Subtype.ext + funext i + rfl + mul_smul g h w := by + funext c + apply Subtype.ext + funext i + change (w c).val (((g * h) c)⁻¹ i) = + (w c).val ((h c)⁻¹ ((g c)⁻¹ i)) + simp only [Pi.mul_apply, mul_inv_rev, Equiv.Perm.mul_apply] + +attribute [local instance] fixedWordsMulAction + +omit [Fintype C] [DecidableEq C] [∀ c, DecidableEq (Pos c)] + [∀ c, Fintype (A c)] in +theorem fixedWordsPretransitive (counts : ∀ c, A c → ℕ) : + MulAction.IsPretransitive (ClassPerm Pos) (FixedClassWords Pos A counts) := by + constructor + intro w v + obtain ⟨e, he⟩ := fixedClassWords_transitive Pos A counts w v + refine ⟨fun c => (e c)⁻¹, ?_⟩ + funext c + apply Subtype.ext + change (w c).val ∘ (((e c)⁻¹)⁻¹ : Equiv.Perm (Pos c)) = (v c).val + simpa only [inv_inv] using he c + +attribute [local instance] fixedWordsPretransitive + +end Actions + +attribute [local instance] fixedWordsMulAction fixedWordsPretransitive + +section Counts + +variable {P U Z A : Type*} [Fintype P] [DecidableEq U] [DecidableEq A] + +def jointCount (w : P → U) (z : P → Z) (part : Z → A) (u : U) (a : A) : ℕ := + Fintype.card {i : P // w i = u ∧ part (z i) = a} + +theorem jointCount_reindex (w : P → U) (z : P → Z) (part : Z → A) + (e : Equiv.Perm P) (u : U) (a : A) : + jointCount (w ∘ e) (z ∘ e) part u a = jointCount w z part u a := by + exact Fintype.card_congr (Equiv.subtypeEquiv e fun _ => Iff.rfl) + +variable [DecidableEq P] [Fintype U] [Fintype A] + +omit [DecidableEq P] [Fintype A] in +theorem jointCount_sum_shapes (w : P → U) (z : P → Z) (part : Z → A) (a : A) : + (∑ u, jointCount w z part u a) = wordPopulation (part ∘ z) a := by + calc + (∑ u, jointCount w z part u a) = + ∑ u, wordPopulation (fun i : {i : P // part (z i) = a} => w i.val) u := by + apply Finset.sum_congr rfl + intro u _ + rw [wordPopulation_fiber] + exact Fintype.card_congr (Equiv.subtypeEquivRight fun _ => and_comm) + _ = wordPopulation (part ∘ z) a := wordPopulation_sum _ + +omit [DecidableEq P] [Fintype A] in +theorem projected_restrict_population (w : P → U) (z : P → Z) (part : Z → A) + (d : U → Prop) (a : A) : + wordPopulation (fun i : {i : P // d (w i)} => part (z i.val)) a = + ∑ u : {u : U // d u}, jointCount w z part u.val a := by + let e : {i : {i : P // d (w i)} // part (z i.val) = a} ≃ + Σ u : {u : U // d u}, {i : P // w i = u.val ∧ part (z i) = a} := + { toFun := fun i => ⟨⟨w i.val.val, i.val.property⟩, + ⟨i.val.val, rfl, i.property⟩⟩ + invFun := fun i => ⟨⟨i.2.val, by + rw [i.2.property.1] + exact i.1.property⟩, i.2.property.2⟩ + left_inv := by intro i; rfl + right_inv := by + rintro ⟨⟨u, hu⟩, i, hi, ha⟩ + cases hi + rfl } + simpa only [wordPopulation, Fintype.card_sigma, jointCount] using Fintype.card_congr e + +omit [DecidableEq P] [Fintype A] in +theorem residual_population_add_designated (w : P → U) (z : P → Z) + (part : Z → A) (d : U → Prop) (a : A) : + wordPopulation (fun i : {i : P // ¬d (w i)} => part (z i.val)) a + + ∑ u : {u : U // d u}, jointCount w z part u.val a = + wordPopulation (part ∘ z) a := by + have hres : + wordPopulation (fun i : {i : P // ¬d (w i)} => part (z i.val)) a = + ∑ u : {u : U // ¬d u}, jointCount w z part u.val a := by + convert projected_restrict_population w z part (fun u => ¬d u) a using 1 <;> congr 1 + · exact Subsingleton.elim _ _ + · ext u + simp + rw [hres, add_comm] + exact (Fintype.sum_subtype_add_sum_subtype d + (fun u => jointCount w z part u a)).trans (jointCount_sum_shapes w z part a) + +omit [DecidableEq P] [Fintype A] in +theorem projected_population_fixed [Fintype Z] [DecidableEq Z] + (z : P → Z) (counts : Z → ℕ) (hz : ∀ s, wordPopulation z s = counts s) + (part : Z → A) (a : A) : + wordPopulation (part ∘ z) a = ∑ s : {s : Z // part s = a}, counts s.val := by + have h := (Fintype.card_congr + (Equiv.sigmaSubtypeFiberEquivSubtype z + (p := fun i => part (z i) = a) (q := fun s => part s = a) + (fun _ => Iff.rfl))).symm + simp only [Fintype.card_sigma] at h + change wordPopulation (part ∘ z) a = + ∑ s : {s : Z // part s = a}, wordPopulation z s.val at h + simpa only [hz] using h + +omit [DecidableEq P] [Fintype A] in +theorem residual_projected_window (w : P → U) (z : P → Z) (part : Z → A) + (d : U → Prop) (counts : U → ℕ) (law : U → A → ℝ) + (residualLaw totalTarget : A → ℝ) (χ η : ℝ) (a : A) + (hmass : 0 < Fintype.card {i : P // ¬d (w i)}) + (htotal : |(wordPopulation (part ∘ z) a : ℝ) - totalTarget a| ≤ η) + (hdesignated : ∀ u, d u → + |(jointCount w z part u a : ℝ) - (counts u : ℝ) * law u a| ≤ + (counts u : ℝ) * χ) + (hbalance : (Fintype.card {i : P // ¬d (w i)} : ℝ) * residualLaw a = + totalTarget a - ∑ u : {u : U // d u}, (counts u.val : ℝ) * law u.val a) : + |(wordPopulation (fun i : {i : P // ¬d (w i)} => part (z i.val)) a : ℝ) / + Fintype.card {i : P // ¬d (w i)} - residualLaw a| ≤ + (η + (∑ u : {u : U // d u}, (counts u.val : ℝ)) * χ) / + Fintype.card {i : P // ¬d (w i)} := by + have hm : (0 : ℝ) < Fintype.card {i : P // ¬d (w i)} := Nat.cast_pos.mpr hmass + have hsplit : + (wordPopulation (fun i : {i : P // ¬d (w i)} => part (z i.val)) a : ℝ) = + wordPopulation (part ∘ z) a - + ∑ u : {u : U // d u}, (jointCount w z part u.val a : ℝ) := by + have h := residual_population_add_designated w z part d a + have h' : + (wordPopulation (fun i : {i : P // ¬d (w i)} => part (z i.val)) a : ℝ) + + ∑ u : {u : U // d u}, (jointCount w z part u.val a : ℝ) = + wordPopulation (part ∘ z) a := by exact_mod_cast h + exact eq_sub_of_add_eq h' + have hd : |(∑ u : {u : U // d u}, (jointCount w z part u.val a : ℝ)) - + ∑ u : {u : U // d u}, (counts u.val : ℝ) * law u.val a| ≤ + (∑ u : {u : U // d u}, (counts u.val : ℝ)) * χ := by + rw [← Finset.sum_sub_distrib, Finset.sum_mul] + exact (Finset.abs_sum_le_sum_abs _ _).trans + (Finset.sum_le_sum fun u _ => hdesignated u.val u.property) + exact residual_window_error hm (by rwa [mul_div_cancel₀ _ hm.ne']) + hbalance htotal hd + +end Counts + +section Groups + +variable {P U Z A : Type*} [Fintype P] [DecidableEq P] + [Fintype U] [DecidableEq U] [Fintype A] [DecidableEq A] + +def designatedGroup (d : U → Prop) (u : U) : Option U := + if d u then some u else none + +omit [Fintype U] [DecidableEq U] in +theorem designatedGroup_eq_some (d : U → Prop) (u v : U) : + designatedGroup d v = some u ↔ d u ∧ v = u := by + constructor + · intro h + by_cases hv : d v + · have he : v = u := Option.some.inj (by simpa [designatedGroup, hv] using h) + exact ⟨he ▸ hv, he⟩ + · simp [designatedGroup, hv] at h + · rintro ⟨hu, rfl⟩ + simp [designatedGroup, hu] + +omit [Fintype U] [DecidableEq U] in +theorem designatedGroup_eq_none (d : U → Prop) (v : U) : + designatedGroup d v = none ↔ ¬d v := by + simp [designatedGroup] + +abbrev GroupPos (w : P → U) (d : U → Prop) (k : Option U) := + {i : P // designatedGroup d (w i) = k} + +def groupProjection (w : P → U) (d : U → Prop) (k : Option U) + (z : P → Z) (part : Z → A) : GroupPos w d k → A := + fun i => part (z i.val) + +omit [DecidableEq P] [Fintype U] in +theorem groupPos_card_some (w : P → U) (d : U → Prop) (u : U) (hu : d u) : + Fintype.card (GroupPos w d (some u)) = wordPopulation w u := by + apply Fintype.card_congr + exact Equiv.subtypeEquivRight fun i => by simp [designatedGroup_eq_some, hu] + +omit [DecidableEq P] [Fintype U] [DecidableEq U] in +theorem groupPos_card_none (w : P → U) (d : U → Prop) : + Fintype.card (GroupPos w d none) = Fintype.card {i : P // ¬d (w i)} := by + apply Fintype.card_congr + exact Equiv.subtypeEquivRight fun i => designatedGroup_eq_none d (w i) + +omit [DecidableEq P] in +theorem restrict_card_eq_sum_population (w : P → U) (d : U → Prop) : + Fintype.card {i : P // d (w i)} = + ∑ u : {u : U // d u}, wordPopulation w u.val := by + simpa only [Fintype.card_sigma, wordPopulation] using + (Fintype.card_congr (Equiv.sigmaSubtypeFiberEquivSubtype w + (p := fun i => d (w i)) (q := d) (fun _ => Iff.rfl))).symm + +omit [DecidableEq P] [Fintype A] [Fintype U] in +theorem groupProjection_population_some (w : P → U) (d : U → Prop) + (u : U) (hu : d u) (z : P → Z) (part : Z → A) (a : A) : + wordPopulation (groupProjection w d (some u) z part) a = + jointCount w z part u a := by + apply Fintype.card_congr + refine (Equiv.subtypeSubtypeEquivSubtypeInter + (fun i : P => designatedGroup d (w i) = some u) + (fun i : P => part (z i) = a)).trans ?_ + exact Equiv.subtypeEquivRight fun i => by simp [designatedGroup_eq_some, hu] + +omit [DecidableEq P] [Fintype A] [Fintype U] [DecidableEq U] in +theorem groupProjection_population_none (w : P → U) (d : U → Prop) + (z : P → Z) (part : Z → A) (a : A) : + wordPopulation (groupProjection w d none z part) a = + wordPopulation (fun i : {i : P // ¬d (w i)} => part (z i.val)) a := by + apply Fintype.card_congr + exact (Equiv.subtypeEquiv + (Equiv.subtypeEquivRight fun i => designatedGroup_eq_none d (w i)) fun _ => Iff.rfl) + +theorem normalized_count_window {x n p χ : ℝ} (hn : 0 < n) + (h : |x - n * p| ≤ n * χ) : |x / n - p| ≤ χ := by + apply (mul_le_mul_iff_left₀ hn).mp + calc + |x / n - p| * n = |(x / n - p) * n| := by rw [abs_mul, abs_of_pos hn] + _ = |x - n * p| := by rw [sub_mul, div_mul_cancel₀ _ hn.ne', mul_comm p n] + _ ≤ n * χ := h + _ = χ * n := mul_comm _ _ + +omit [DecidableEq P] in +theorem group_entropy_of_designated_windows + (w : P → U) (z : P → Z) (part : Z → A) (d : U → Prop) + (counts : U → ℕ) (hcounts : ∀ u, wordPopulation w u = counts u) + (law : U → A → ℝ) (residualLaw totalTarget : A → ℝ) + (χ η : ℝ) (H : Option U → ℝ) (hH : ∀ k, 0 ≤ H k) + (htotal : ∀ a, |(wordPopulation (part ∘ z) a : ℝ) - totalTarget a| ≤ η) + (hdesignated : ∀ u, d u → ∀ a, + |(jointCount w z part u a : ℝ) - (counts u : ℝ) * law u a| ≤ + (counts u : ℝ) * χ) + (hbalance : ∀ a, (Fintype.card {i : P // ¬d (w i)} : ℝ) * residualLaw a = + totalTarget a - ∑ u : {u : U // d u}, (counts u.val : ℝ) * law u.val a) + (hcapDesignated : ∀ u, d u → ∀ q : A → ℝ, + (∀ a, |q a - law u a| ≤ χ) → finiteEntropy q ≤ H (some u)) + (hcapResidual : ∀ q : A → ℝ, + (∀ a, |q a - residualLaw a| ≤ + (η + (∑ u : {u : U // d u}, (counts u.val : ℝ)) * χ) / + Fintype.card {i : P // ¬d (w i)}) → finiteEntropy q ≤ H none) + (k : Option U) : + finiteEntropy (fun a => (wordPopulation (groupProjection w d k z part) a : ℝ) / + Fintype.card (GroupPos w d k)) ≤ H k := by + by_cases hzero : Fintype.card (GroupPos w d k) = 0 + · simpa only [hzero, Nat.cast_zero, div_zero, finiteEntropy, entropyTerm_zero, + Finset.sum_const_zero] using hH k + have hpos : 0 < Fintype.card (GroupPos w d k) := Nat.pos_of_ne_zero hzero + cases k with + | some u => + obtain ⟨i⟩ := Fintype.card_pos_iff.mp hpos + have hu : d u := ((designatedGroup_eq_some d u (w i.val)).mp i.property).1 + have hm : 0 < counts u := by + simpa only [groupPos_card_some w d u hu, hcounts u] using hpos + apply hcapDesignated u hu + intro a + simp only [groupProjection_population_some w d u hu, + groupPos_card_some w d u hu, hcounts u] + exact normalized_count_window (Nat.cast_pos.mpr hm) (hdesignated u hu a) + | none => + apply hcapResidual + intro a + simp only [groupProjection_population_none, groupPos_card_none] + exact residual_projected_window w z part d counts law residualLaw totalTarget χ η a + (by simpa only [groupPos_card_none] using hpos) (htotal a) + (fun u hu => hdesignated u hu a) (hbalance a) + +end Groups + +section GroupEntropy + +variable {U K A : Type*} [Fintype U] [Fintype K] [Fintype A] + +def groupMass (p : U → ℝ) (group : U → K) (k : K) : ℝ := + ∑ u, if group u = k then p u else 0 + +def groupLaw (p : U → ℝ) (group : U → K) (law : U → A → ℝ) + (k : K) (a : A) : ℝ := + (∑ u, if group u = k then p u * law u a else 0) / groupMass p group k + +def groupedEntropy (p : U → ℝ) (group : U → K) (law : U → A → ℝ) : ℝ := + ∑ k, groupMass p group k * finiteEntropy (groupLaw p group law k) + +omit [Fintype K] in +theorem groupMass_relabel {L : Type*} (e : K ≃ L) (p : U → ℝ) + (group : U → K) (k : K) : + groupMass p (e ∘ group) (e k) = groupMass p group k := by + simp only [groupMass, Function.comp_apply, e.injective.eq_iff] + +omit [Fintype A] [Fintype K] in +theorem groupLaw_relabel {L : Type*} (e : K ≃ L) (p : U → ℝ) + (group : U → K) (law : U → A → ℝ) (k : K) : + groupLaw p (e ∘ group) law (e k) = groupLaw p group law k := by + funext a + simp only [groupLaw, groupMass_relabel, Function.comp_apply, e.injective.eq_iff] + +theorem groupedEntropy_relabel {L : Type*} [Fintype L] (e : K ≃ L) + (p : U → ℝ) (group : U → K) (law : U → A → ℝ) : + groupedEntropy p (e ∘ group) law = groupedEntropy p group law := by + unfold groupedEntropy + calc + (∑ l, groupMass p (e ∘ group) l * finiteEntropy (groupLaw p (e ∘ group) law l)) = + ∑ k, groupMass p (e ∘ group) (e k) * + finiteEntropy (groupLaw p (e ∘ group) law (e k)) := (e.sum_comp _).symm + _ = ∑ k, groupMass p group k * finiteEntropy (groupLaw p group law k) := by + simp only [groupMass_relabel, groupLaw_relabel] + +omit [Fintype K] in +theorem groupMass_reindex (e : U ≃ U) (p : U → ℝ) (group : U → K) + (hp : ∀ u, p (e u) = p u) (k : K) : + groupMass p (group ∘ e) k = groupMass p group k := by + unfold groupMass + calc + (∑ u, if (group ∘ e) u = k then p u else 0) = + ∑ u, if group (e u) = k then p (e u) else 0 := by + apply Finset.sum_congr rfl + intro u _ + simp only [Function.comp_apply, hp u] + _ = ∑ u, if group u = k then p u else 0 := + e.sum_comp (fun u => if group u = k then p u else 0) + +omit [Fintype A] [Fintype K] in +theorem groupLaw_reindex (e : U ≃ U) (p : U → ℝ) (group : U → K) + (law : U → A → ℝ) (hp : ∀ u, p (e u) = p u) (k : K) : + groupLaw p (group ∘ e) (law ∘ e) k = groupLaw p group law k := by + funext a + unfold groupLaw + rw [groupMass_reindex e p group hp] + congr 1 + calc + (∑ u, if (group ∘ e) u = k then p u * (law ∘ e) u a else 0) = + ∑ u, if group (e u) = k then p (e u) * law (e u) a else 0 := by + apply Finset.sum_congr rfl + intro u _ + simp only [Function.comp_apply, hp u] + _ = ∑ u, if group u = k then p u * law u a else 0 := + e.sum_comp (fun u => if group u = k then p u * law u a else 0) + +theorem groupedEntropy_reindex (e : U ≃ U) (p : U → ℝ) (group : U → K) + (law : U → A → ℝ) (hp : ∀ u, p (e u) = p u) : + groupedEntropy p (group ∘ e) (law ∘ e) = groupedEntropy p group law := by + simp only [groupedEntropy, groupMass_reindex e p group hp, + groupLaw_reindex e p group law hp] + +theorem groupedEntropy_add_reindex (e : U ≃ U) (p : U → ℝ) (group : U → K) + (law : U → A → ℝ) (hp : ∀ u, p (e u) = p u) : + groupedEntropy p group law + groupedEntropy p (group ∘ e) (law ∘ e) = + 2 * groupedEntropy p group law := by + rw [groupedEntropy_reindex e p group law hp] + ring + +omit [Fintype U] in +theorem designatedGroup_transport (e : U ≃ U) (d : U → Prop) : + e.optionCongr ∘ designatedGroup (d ∘ e) = designatedGroup d ∘ e := by + funext u + by_cases h : d (e u) <;> + simp [designatedGroup, Function.comp_apply, Equiv.optionCongr_apply, h] + +theorem designated_groupedEntropy_reindex (e : U ≃ U) (p : U → ℝ) + (d : U → Prop) (law : U → A → ℝ) (hp : ∀ u, p (e u) = p u) : + groupedEntropy p (designatedGroup (d ∘ e)) (law ∘ e) = + groupedEntropy p (designatedGroup d) law := by + calc + groupedEntropy p (designatedGroup (d ∘ e)) (law ∘ e) = + groupedEntropy p (e.optionCongr ∘ designatedGroup (d ∘ e)) (law ∘ e) := + (groupedEntropy_relabel e.optionCongr p (designatedGroup (d ∘ e)) (law ∘ e)).symm + _ = groupedEntropy p (designatedGroup d ∘ e) (law ∘ e) := by + rw [designatedGroup_transport] + _ = groupedEntropy p (designatedGroup d) law := + groupedEntropy_reindex e p (designatedGroup d) law hp + +end GroupEntropy + +section SideControls + +variable {C : Type*} [Fintype C] [DecidableEq C] +variable (Pos Shape Pair A : C → Type*) + [∀ c, Fintype (Pos c)] [∀ c, DecidableEq (Pos c)] + [∀ c, Fintype (Shape c)] [∀ c, DecidableEq (Shape c)] + [∀ c, Fintype (Pair c)] [∀ c, DecidableEq (Pair c)] + [∀ c, Fintype (A c)] [∀ c, DecidableEq (A c)] +variable (shapeCounts : ∀ c, Shape c → ℕ) (pairCounts : ∀ c, Pair c → ℕ) + (part : ∀ c, Pair c → A c) (designated : ∀ c, Shape c → Prop) + (law : ∀ c, Shape c → A c → ℝ) (χ : ℝ) + (H : (Σ c, Option (Shape c)) → ℝ) (w : FixedClassWords Pos Shape shapeCounts) + +structure SideEntropyControl where + residualLaw : ∀ c, A c → ℝ + totalTarget : ∀ c, A c → ℝ + totalError : C → ℝ + aggregate_window : ∀ c a, + |((∑ s : {s : Pair c // part c s = a}, pairCounts c s.val : ℕ) : ℝ) - + totalTarget c a| ≤ totalError c + mixture_balance : ∀ c a, + (Fintype.card {i : Pos c // ¬designated c ((w c).val i)} : ℝ) * residualLaw c a = + totalTarget c a - ∑ u : {u : Shape c // designated c u}, + (shapeCounts c u.val : ℝ) * law c u.val a + nonneg : ∀ g, 0 ≤ H g + designated_entropy : ∀ c u, designated c u → ∀ q : A c → ℝ, + (∀ a, |q a - law c u a| ≤ χ) → finiteEntropy q ≤ H ⟨c, some u⟩ + residual_entropy : ∀ c, ∀ q : A c → ℝ, + (∀ a, |q a - residualLaw c a| ≤ + (totalError c + (∑ u : {u : Shape c // designated c u}, + (shapeCounts c u.val : ℝ)) * χ) / + Fintype.card {i : Pos c // ¬designated c ((w c).val i)}) → + finiteEntropy q ≤ H ⟨c, none⟩ + +omit [Fintype C] [DecidableEq C] [∀ c, DecidableEq (Pos c)] in +theorem SideEntropyControl.group_entropy + (control : SideEntropyControl Pos Shape Pair A shapeCounts pairCounts + part designated law χ H w) + (z : FixedClassWords Pos Pair pairCounts) + (hdesignated : ∀ c u, designated c u → ∀ a, + |(jointCount (w c).val (z c).val (part c) u a : ℝ) - + (shapeCounts c u : ℝ) * law c u a| ≤ (shapeCounts c u : ℝ) * χ) + (g : Σ c, Option (Shape c)) : + finiteEntropy (fun a => + (wordPopulation (groupProjection (w g.1).val (designated g.1) g.2 + (z g.1).val (part g.1)) a : ℝ) / + Fintype.card (GroupPos (w g.1).val (designated g.1) g.2)) ≤ H g := by + apply group_entropy_of_designated_windows (w g.1).val (z g.1).val (part g.1) + (designated g.1) (shapeCounts g.1) (w g.1).property (law g.1) + (control.residualLaw g.1) (control.totalTarget g.1) χ (control.totalError g.1) + (fun k => H ⟨g.1, k⟩) (fun k => control.nonneg ⟨g.1, k⟩) + · intro a + rw [projected_population_fixed (z g.1).val (pairCounts g.1) (z g.1).property] + exact control.aggregate_window g.1 a + · exact hdesignated g.1 + · exact control.mixture_balance g.1 + · exact control.designated_entropy g.1 + · exact control.residual_entropy g.1 + +end SideControls + +section Compatibility + +variable {C : Type*} [Fintype C] [DecidableEq C] +variable (Pos Shape Pair Left Right : C → Type*) + [∀ c, Fintype (Pos c)] [∀ c, DecidableEq (Pos c)] + [∀ c, Fintype (Shape c)] [∀ c, DecidableEq (Shape c)] + [∀ c, Fintype (Pair c)] [∀ c, DecidableEq (Pair c)] + [∀ c, Fintype (Left c)] [∀ c, DecidableEq (Left c)] + [∀ c, Fintype (Right c)] [∀ c, DecidableEq (Right c)] +variable (shapeCounts : ∀ c, Shape c → ℕ) (pairCounts : ∀ c, Pair c → ℕ) + (leftPart : ∀ c, Pair c → Left c) (rightPart : ∀ c, Pair c → Right c) + (designatedLeft designatedRight : ∀ c, Shape c → Prop) + (leftLaw : ∀ c, Shape c → Left c → ℝ) + (rightLaw : ∀ c, Shape c → Right c → ℝ) (χ : ℝ) + +def DesignatedCompatibility (w : FixedClassWords Pos Shape shapeCounts) + (z : FixedClassWords Pos Pair pairCounts) : Prop := + (∀ c u, designatedLeft c u → ∀ a, + |(jointCount (w c).val (z c).val (leftPart c) u a : ℝ) - + (shapeCounts c u : ℝ) * leftLaw c u a| ≤ (shapeCounts c u : ℝ) * χ) ∧ + (∀ c u, designatedRight c u → ∀ a, + |(jointCount (w c).val (z c).val (rightPart c) u a : ℝ) - + (shapeCounts c u : ℝ) * rightLaw c u a| ≤ (shapeCounts c u : ℝ) * χ) + +omit [Fintype C] [DecidableEq C] [∀ c, DecidableEq (Pos c)] + [∀ c, Fintype (Shape c)] [∀ c, Fintype (Pair c)] + [∀ c, Fintype (Left c)] [∀ c, Fintype (Right c)] in +theorem designatedCompatibility_permute (g : ClassPerm Pos) + (w : FixedClassWords Pos Shape shapeCounts) + (z : FixedClassWords Pos Pair pairCounts) : + DesignatedCompatibility Pos Shape Pair Left Right shapeCounts pairCounts + leftPart rightPart designatedLeft designatedRight leftLaw rightLaw χ + (permuteFixedWords Pos Shape shapeCounts g w) + (permuteFixedWords Pos Pair pairCounts g z) ↔ + DesignatedCompatibility Pos Shape Pair Left Right shapeCounts pairCounts + leftPart rightPart designatedLeft designatedRight leftLaw rightLaw χ w z := by + simp only [DesignatedCompatibility, permuteFixedWords, jointCount_reindex] + +def compatibleStatisticCount (w : FixedClassWords Pos Shape shapeCounts) : ℕ := + Fintype.card {z : FixedClassWords Pos Pair pairCounts // + DesignatedCompatibility Pos Shape Pair Left Right shapeCounts pairCounts + leftPart rightPart designatedLeft designatedRight leftLaw rightLaw χ w z} + +def compatibleCandidateCount (z : FixedClassWords Pos Pair pairCounts) : ℕ := + Fintype.card {w : FixedClassWords Pos Shape shapeCounts // + DesignatedCompatibility Pos Shape Pair Left Right shapeCounts pairCounts + leftPart rightPart designatedLeft designatedRight leftLaw rightLaw χ w z} + +omit [∀ c, Fintype (Left c)] [∀ c, Fintype (Right c)] in +theorem designated_incidence_count + (w : FixedClassWords Pos Shape shapeCounts) + (z : FixedClassWords Pos Pair pairCounts) : + Fintype.card (FixedClassWords Pos Shape shapeCounts) * + compatibleStatisticCount Pos Shape Pair Left Right shapeCounts pairCounts + leftPart rightPart designatedLeft designatedRight leftLaw rightLaw χ w = + Fintype.card (FixedClassWords Pos Pair pairCounts) * + compatibleCandidateCount Pos Shape Pair Left Right shapeCounts pairCounts + leftPart rightPart designatedLeft designatedRight leftLaw rightLaw χ z := by + exact invariant_incidence_count (G := ClassPerm Pos) + (DesignatedCompatibility Pos Shape Pair Left Right shapeCounts pairCounts + leftPart rightPart designatedLeft designatedRight leftLaw rightLaw χ) + (designatedCompatibility_permute Pos Shape Pair Left Right shapeCounts pairCounts + leftPart rightPart designatedLeft designatedRight leftLaw rightLaw χ) w z + +omit [∀ c, Fintype (Left c)] [∀ c, Fintype (Right c)] in +theorem designated_incidence_multinomial + (hshape : ∀ c, Fintype.card (Pos c) = ∑ u, shapeCounts c u) + (hpair : ∀ c, Fintype.card (Pos c) = ∑ a, pairCounts c a) + (w : FixedClassWords Pos Shape shapeCounts) + (z : FixedClassWords Pos Pair pairCounts) : + (∏ c, Nat.multinomial Finset.univ (shapeCounts c)) * + compatibleStatisticCount Pos Shape Pair Left Right shapeCounts pairCounts + leftPart rightPart designatedLeft designatedRight leftLaw rightLaw χ w = + (∏ c, Nat.multinomial Finset.univ (pairCounts c)) * + compatibleCandidateCount Pos Shape Pair Left Right shapeCounts pairCounts + leftPart rightPart designatedLeft designatedRight leftLaw rightLaw χ z := by + simpa only [fixedClassWords_card Pos Shape shapeCounts hshape, + fixedClassWords_card Pos Pair pairCounts hpair] using + designated_incidence_count Pos Shape Pair Left Right shapeCounts pairCounts + leftPart rightPart designatedLeft designatedRight leftLaw rightLaw χ w z + +omit [∀ c, Fintype (Left c)] [∀ c, Fintype (Right c)] in +theorem compatibleCandidateCount_eq + (w : FixedClassWords Pos Shape shapeCounts) + (z : FixedClassWords Pos Pair pairCounts) : + (compatibleCandidateCount Pos Shape Pair Left Right shapeCounts pairCounts + leftPart rightPart designatedLeft designatedRight leftLaw rightLaw χ z : ℝ) = + (Fintype.card (FixedClassWords Pos Shape shapeCounts) : ℝ) * + compatibleStatisticCount Pos Shape Pair Left Right shapeCounts pairCounts + leftPart rightPart designatedLeft designatedRight leftLaw rightLaw χ w / + Fintype.card (FixedClassWords Pos Pair pairCounts) := by + exact invariant_incidence_degree_eq (G := ClassPerm Pos) + (DesignatedCompatibility Pos Shape Pair Left Right shapeCounts pairCounts + leftPart rightPart designatedLeft designatedRight leftLaw rightLaw χ) + (designatedCompatibility_permute Pos Shape Pair Left Right shapeCounts pairCounts + leftPart rightPart designatedLeft designatedRight leftLaw rightLaw χ) w z + +def wordEntropyBound (I A : Type*) [Fintype I] [Fintype A] (H : ℝ) : ℝ := + ((Fintype.card I : ℝ) + 1) ^ Fintype.card A * + Real.exp ((Fintype.card I : ℝ) * H + + ((Fintype.card A : ℝ) + 1) * (1 + Real.log (Fintype.card I + 1 : ℕ))) + +theorem compatibleStatisticCount_le_grouped_entropy + (w : FixedClassWords Pos Shape shapeCounts) + (hpair : ∀ c, Function.Injective (fun s : Pair c => (leftPart c s, rightPart c s))) + (HL HR : (Σ c, Option (Shape c)) → ℝ) + (hL : ∀ z : FixedClassWords Pos Pair pairCounts, + DesignatedCompatibility Pos Shape Pair Left Right shapeCounts pairCounts + leftPart rightPart designatedLeft designatedRight leftLaw rightLaw χ w z → + ∀ g : Σ c, Option (Shape c), + finiteEntropy (fun a => + (wordPopulation (groupProjection (w g.1).val (designatedLeft g.1) g.2 + (z g.1).val (leftPart g.1)) a : ℝ) / + Fintype.card (GroupPos (w g.1).val (designatedLeft g.1) g.2)) ≤ HL g) + (hR : ∀ z : FixedClassWords Pos Pair pairCounts, + DesignatedCompatibility Pos Shape Pair Left Right shapeCounts pairCounts + leftPart rightPart designatedLeft designatedRight leftLaw rightLaw χ w z → + ∀ g : Σ c, Option (Shape c), + finiteEntropy (fun a => + (wordPopulation (groupProjection (w g.1).val (designatedRight g.1) g.2 + (z g.1).val (rightPart g.1)) a : ℝ) / + Fintype.card (GroupPos (w g.1).val (designatedRight g.1) g.2)) ≤ HR g) : + (compatibleStatisticCount Pos Shape Pair Left Right shapeCounts pairCounts + leftPart rightPart designatedLeft designatedRight leftLaw rightLaw χ w : ℝ) ≤ + (∏ g : Σ c, Option (Shape c), wordEntropyBound + (GroupPos (w g.1).val (designatedLeft g.1) g.2) (Left g.1) (HL g)) * + (∏ g : Σ c, Option (Shape c), wordEntropyBound + (GroupPos (w g.1).val (designatedRight g.1) g.2) (Right g.1) (HR g)) := by + let J := Σ c, Option (Shape c) + let PL : J → Type _ := fun g => GroupPos (w g.1).val (designatedLeft g.1) g.2 + let PR : J → Type _ := fun g => GroupPos (w g.1).val (designatedRight g.1) g.2 + let EL := ∀ g : J, {v : PL g → Left g.1 // + finiteEntropy (fun a => (wordPopulation v a : ℝ) / Fintype.card (PL g)) ≤ HL g} + let ER := ∀ g : J, {v : PR g → Right g.1 // + finiteEntropy (fun a => (wordPopulation v a : ℝ) / Fintype.card (PR g)) ≤ HR g} + let Row := {z : FixedClassWords Pos Pair pairCounts // + DesignatedCompatibility Pos Shape Pair Left Right shapeCounts pairCounts + leftPart rightPart designatedLeft designatedRight leftLaw rightLaw χ w z} + let encode : Row → EL × ER := fun z => + (fun g => ⟨groupProjection (w g.1).val (designatedLeft g.1) g.2 + (z.val g.1).val (leftPart g.1), hL z.val z.property g⟩, + fun g => ⟨groupProjection (w g.1).val (designatedRight g.1) g.2 + (z.val g.1).val (rightPart g.1), hR z.val z.property g⟩) + have hinj : Function.Injective encode := by + intro x y h + apply Subtype.ext + funext c + apply Subtype.ext + funext i + apply hpair c + apply Prod.ext + · exact congrArg (fun v : EL × ER => + ((v.1 ⟨c, designatedGroup (designatedLeft c) ((w c).val i)⟩).val ⟨i, rfl⟩)) h + · exact congrArg (fun v : EL × ER => + ((v.2 ⟨c, designatedGroup (designatedRight c) ((w c).val i)⟩).val ⟨i, rfl⟩)) h + have hleft : (Fintype.card EL : ℝ) ≤ + ∏ g : J, wordEntropyBound (PL g) (Left g.1) (HL g) := + card_class_entropy_bounded_words_le PL (fun g => Left g.1) HL + have hright : (Fintype.card ER : ℝ) ≤ + ∏ g : J, wordEntropyBound (PR g) (Right g.1) (HR g) := + card_class_entropy_bounded_words_le PR (fun g => Right g.1) HR + have hcard : (Fintype.card Row : ℝ) ≤ (Fintype.card EL : ℝ) * Fintype.card ER := by + simpa only [Fintype.card_prod, Nat.cast_mul] using + (Nat.cast_le.mpr (Fintype.card_le_of_injective encode hinj) : + (Fintype.card Row : ℝ) ≤ Fintype.card (EL × ER)) + exact hcard.trans (mul_le_mul hleft hright (Nat.cast_nonneg _) + ((Nat.cast_nonneg _).trans hleft)) + +theorem compatibleStatisticCount_le_of_controls + (w : FixedClassWords Pos Shape shapeCounts) + (hpair : ∀ c, Function.Injective (fun s : Pair c => (leftPart c s, rightPart c s))) + (HL HR : (Σ c, Option (Shape c)) → ℝ) + (controlLeft : SideEntropyControl Pos Shape Pair Left shapeCounts pairCounts + leftPart designatedLeft leftLaw χ HL w) + (controlRight : SideEntropyControl Pos Shape Pair Right shapeCounts pairCounts + rightPart designatedRight rightLaw χ HR w) : + (compatibleStatisticCount Pos Shape Pair Left Right shapeCounts pairCounts + leftPart rightPart designatedLeft designatedRight leftLaw rightLaw χ w : ℝ) ≤ + (∏ g : Σ c, Option (Shape c), wordEntropyBound + (GroupPos (w g.1).val (designatedLeft g.1) g.2) (Left g.1) (HL g)) * + (∏ g : Σ c, Option (Shape c), wordEntropyBound + (GroupPos (w g.1).val (designatedRight g.1) g.2) (Right g.1) (HR g)) := by + apply compatibleStatisticCount_le_grouped_entropy Pos Shape Pair Left Right + shapeCounts pairCounts leftPart rightPart designatedLeft designatedRight + leftLaw rightLaw χ w hpair HL HR + · intro z hz g + exact SideEntropyControl.group_entropy Pos Shape Pair Left shapeCounts pairCounts + leftPart designatedLeft leftLaw χ HL w controlLeft z hz.1 g + · intro z hz g + exact SideEntropyControl.group_entropy Pos Shape Pair Right shapeCounts pairCounts + rightPart designatedRight rightLaw χ HR w controlRight z hz.2 g + +theorem compatibleCandidateCount_le_of_controls + (w : FixedClassWords Pos Shape shapeCounts) + (z : FixedClassWords Pos Pair pairCounts) + (hpair : ∀ c, Function.Injective (fun s : Pair c => (leftPart c s, rightPart c s))) + (HL HR : (Σ c, Option (Shape c)) → ℝ) + (controlLeft : SideEntropyControl Pos Shape Pair Left shapeCounts pairCounts + leftPart designatedLeft leftLaw χ HL w) + (controlRight : SideEntropyControl Pos Shape Pair Right shapeCounts pairCounts + rightPart designatedRight rightLaw χ HR w) : + (compatibleCandidateCount Pos Shape Pair Left Right shapeCounts pairCounts + leftPart rightPart designatedLeft designatedRight leftLaw rightLaw χ z : ℝ) ≤ + (Fintype.card (FixedClassWords Pos Shape shapeCounts) : ℝ) * + ((∏ g : Σ c, Option (Shape c), wordEntropyBound + (GroupPos (w g.1).val (designatedLeft g.1) g.2) (Left g.1) (HL g)) * + (∏ g : Σ c, Option (Shape c), wordEntropyBound + (GroupPos (w g.1).val (designatedRight g.1) g.2) (Right g.1) (HR g))) / + Fintype.card (FixedClassWords Pos Pair pairCounts) := by + rw [compatibleCandidateCount_eq Pos Shape Pair Left Right shapeCounts pairCounts + leftPart rightPart designatedLeft designatedRight leftLaw rightLaw χ w z] + apply div_le_div_of_nonneg_right _ (Nat.cast_nonneg _) + exact mul_le_mul_of_nonneg_left + (compatibleStatisticCount_le_of_controls Pos Shape Pair Left Right shapeCounts pairCounts + leftPart rightPart designatedLeft designatedRight leftLaw rightLaw χ w hpair HL HR + controlLeft controlRight) (Nat.cast_nonneg _) + +end Compatibility + +end MatrixMultiplication.JointCompatibilityIncidence + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/Construction/JointCompatibilityScaling.lean b/lean/OAI/LinearAlgebra/MatrixFields/Construction/JointCompatibilityScaling.lean new file mode 100644 index 0000000000000000000000000000000000000000..ca8d217d2628de2b1ab1b06162e404d22a1919ec --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/Construction/JointCompatibilityScaling.lean @@ -0,0 +1,187 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Entropy.JointAmbientRateLimit +import OAI.LinearAlgebra.MatrixFields.Entropy.JointCompatibilityEntropyBound + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section + +namespace MatrixMultiplication.JointCompatibilityScaling + +open MatrixMultiplication.Foundation JointTypeCounts JointCompatibilityIncidence +open JointCompatibilityEntropyBound Filter +open scoped BigOperators Topology + +attribute [local instance] Classical.propDecidable + +variable {C : Type*} [Fintype C] [DecidableEq C] +variable {Shape : C → Type*} + [∀ c, Fintype (Shape c)] [∀ c, DecidableEq (Shape c)] + +def baseSize (base : ∀ c, Shape c → ℕ) (c : C) : ℕ := ∑ a, base c a + +def baseTotal (base : ∀ c, Shape c → ℕ) : ℕ := ∑ c, baseSize base c + +def baseEntropy (base : ∀ c, Shape c → ℕ) : ℝ := + ∑ c, (baseSize base c : ℝ) * + finiteEntropy (fun a => (base c a : ℝ) / baseSize base c) + +def baseGroupSize (base : ∀ c, Shape c → ℕ) (d : ∀ c, Shape c → Prop) + (g : Σ c, Option (Shape c)) : ℕ := + ∑ a : {a : Shape g.1 // designatedGroup (d g.1) a = g.2}, base g.1 a.val + +def baseGroupedEntropy (base : ∀ c, Shape c → ℕ) (d : ∀ c, Shape c → Prop) + (H : (Σ c, Option (Shape c)) → ℝ) : ℝ := + ∑ g, (baseGroupSize base d g : ℝ) * H g + +omit [DecidableEq C] [∀ c, DecidableEq (Shape c)] in +theorem baseSize_le_baseTotal (base : ∀ c, Shape c → ℕ) (c : C) : + baseSize base c ≤ baseTotal base := + Finset.single_le_sum (fun _ _ => Nat.zero_le _) (Finset.mem_univ c) + +omit [DecidableEq C] in +theorem sum_baseGroupSize (base : ∀ c, Shape c → ℕ) + (d : ∀ c, Shape c → Prop) : + (∑ g, baseGroupSize base d g) = baseTotal base := by + simp only [baseGroupSize, baseTotal, Fintype.sum_sigma] + apply Finset.sum_congr rfl + intro c _ + exact Fintype.sum_fiberwise (designatedGroup (d c)) (base c) + +section Repeated + +variable (Pos : C → Type*) + [∀ c, Fintype (Pos c)] [∀ c, DecidableEq (Pos c)] + +omit [DecidableEq C] [∀ c, DecidableEq (Shape c)] [∀ c, DecidableEq (Pos c)] in +theorem classEntropy_repeated (base : ∀ c, Shape c → ℕ) (t : ℕ) (ht : 0 < t) + (hsize : ∀ c, Fintype.card (Pos c) = t * baseSize base c) : + classEntropy Pos Shape (fun c a => t * base c a) = (t : ℝ) * baseEntropy base := by + simp only [classEntropy, baseEntropy, hsize, Nat.cast_mul, Finset.mul_sum] + apply Finset.sum_congr rfl + intro c _ + rw [show (fun a => (t : ℝ) * base c a / ((t : ℝ) * baseSize base c)) = + (fun a => (base c a : ℝ) / baseSize base c) by + funext a + exact mul_div_mul_left _ _ (Nat.cast_ne_zero.mpr (Nat.ne_of_gt ht))] + ring + +omit [Fintype C] [DecidableEq C] [∀ c, DecidableEq (Pos c)] in +theorem groupPos_card_repeated (base : ∀ c, Shape c → ℕ) + (d : ∀ c, Shape c → Prop) (t : ℕ) + (w : FixedClassWords Pos Shape (fun c a => t * base c a)) + (g : Σ c, Option (Shape c)) : + Fintype.card (GroupPos (w g.1).val (d g.1) g.2) = + t * baseGroupSize base d g := by + calc + Fintype.card (GroupPos (w g.1).val (d g.1) g.2) = + Fintype.card (Σ a : {a : Shape g.1 // designatedGroup (d g.1) a = g.2}, + {i : Pos g.1 // (w g.1).val i = a.val}) := + Fintype.card_congr (Equiv.sigmaSubtypeFiberEquivSubtype (w g.1).val + (p := fun i => designatedGroup (d g.1) ((w g.1).val i) = g.2) + (q := fun a => designatedGroup (d g.1) a = g.2) (fun _ => Iff.rfl)).symm + _ = t * baseGroupSize base d g := by + simp only [Fintype.card_sigma] + change (∑ a : {a : Shape g.1 // designatedGroup (d g.1) a = g.2}, + wordPopulation (w g.1).val a.val) = _ + simp only [(w g.1).property, baseGroupSize, Finset.mul_sum] + +omit [DecidableEq C] [∀ c, DecidableEq (Pos c)] in +theorem groupedEntropy_repeated (base : ∀ c, Shape c → ℕ) + (d : ∀ c, Shape c → Prop) (t : ℕ) + (H : (Σ c, Option (Shape c)) → ℝ) + (w : FixedClassWords Pos Shape (fun c a => t * base c a)) : + groupedEntropy Pos Shape (fun c a => t * base c a) d H w = + (t : ℝ) * baseGroupedEntropy base d H := by + simp only [JointCompatibilityEntropyBound.groupedEntropy, groupPos_card_repeated, Nat.cast_mul, + baseGroupedEntropy, Finset.mul_sum, mul_assoc] + +end Repeated + +def typeErrorFactor (B t : ℕ) : ℝ := 1 + Real.log (t * B + 1 : ℕ) + +theorem typeErrorFactor_nonneg (B t : ℕ) : 0 ≤ typeErrorFactor B t := by + unfold typeErrorFactor + have hlog : 0 ≤ Real.log (t * B + 1 : ℕ) := + Real.log_nonneg (by exact_mod_cast Nat.succ_le_succ (Nat.zero_le (t * B))) + linarith + +def classErrorCoefficient (A : C → Type*) [∀ c, Fintype (A c)] : ℝ := + ∑ c, ((Fintype.card (A c) : ℝ) + 1) + +def groupErrorCoefficient (Shape A : C → Type*) + [∀ c, Fintype (Shape c)] [∀ c, Fintype (A c)] : ℝ := + ∑ g : Σ c, Option (Shape c), (2 * (Fintype.card (A g.1) : ℝ) + 1) + +omit [DecidableEq C] in +theorem classTypeError_le (Pos A : C → Type*) + [∀ c, Fintype (Pos c)] [∀ c, DecidableEq (Pos c)] + [∀ c, Fintype (A c)] [∀ c, DecidableEq (A c)] + (B t : ℕ) (hsize : ∀ c, Fintype.card (Pos c) ≤ t * B) : + classTypeError Pos A ≤ classErrorCoefficient A * typeErrorFactor B t := by + simp only [classTypeError, classErrorCoefficient, Finset.sum_mul] + apply Finset.sum_le_sum + intro c _ + apply mul_le_mul_of_nonneg_left _ (by positivity) + unfold typeErrorFactor + apply add_le_add le_rfl + apply Real.log_le_log (by positivity) + exact_mod_cast Nat.succ_le_succ (hsize c) + +theorem wordTypeError_le (I A : Type*) [Fintype I] [Fintype A] + (B t : ℕ) (hsize : Fintype.card I ≤ t * B) : + wordTypeError I A ≤ (2 * (Fintype.card A : ℝ) + 1) * typeErrorFactor B t := by + have hlog : Real.log (Fintype.card I + 1 : ℕ) ≤ Real.log (t * B + 1 : ℕ) := + Real.log_le_log (by positivity) (by exact_mod_cast Nat.succ_le_succ hsize) + have h₁ := mul_le_mul_of_nonneg_left (add_le_add_left hlog 1) + (by positivity : (0 : ℝ) ≤ (Fintype.card A : ℝ) + 1) + have h₂ := mul_le_mul_of_nonneg_left hlog (Nat.cast_nonneg (Fintype.card A) : + (0 : ℝ) ≤ Fintype.card A) + unfold wordTypeError typeErrorFactor + nlinarith [show (0 : ℝ) ≤ Fintype.card A from Nat.cast_nonneg _] + +omit [DecidableEq C] in +theorem groupedTypeError_le (Pos A : C → Type*) + [∀ c, Fintype (Pos c)] [∀ c, DecidableEq (Pos c)] + [∀ c, Fintype (A c)] [∀ c, DecidableEq (A c)] + (counts : ∀ c, Shape c → ℕ) (d : ∀ c, Shape c → Prop) + (w : FixedClassWords Pos Shape counts) + (B t : ℕ) (hsize : ∀ c, Fintype.card (Pos c) ≤ t * B) : + groupedTypeError Pos Shape A counts d w ≤ + groupErrorCoefficient Shape A * typeErrorFactor B t := by + simp only [groupedTypeError, groupErrorCoefficient, Finset.sum_mul] + apply Finset.sum_le_sum + intro g _ + apply wordTypeError_le + exact (Fintype.card_subtype_le _).trans (hsize g.1) + +theorem tendsto_typeErrorFactor_div (B : ℕ) : + Tendsto (fun t : ℕ => typeErrorFactor B t / (t : ℝ)) atTop (𝓝 0) := by + have hratio : Tendsto (fun t : ℕ => ((t * B : ℕ) : ℝ) / (t : ℝ)) + atTop (𝓝 (B : ℝ)) := by + apply tendsto_const_nhds.congr' + filter_upwards [eventually_ne_atTop (0 : ℕ)] with t ht + simp only [Nat.cast_mul] + exact (mul_div_cancel_left₀ (B : ℝ) (Nat.cast_ne_zero.mpr ht)).symm + have hlog := JointAmbientRateLimit.tendsto_log_succ_div_nat_of_ratio hratio + have hinv : Tendsto (fun t : ℕ => (1 : ℝ) / t) atTop (𝓝 0) := + tendsto_const_nhds.div_atTop tendsto_natCast_atTop_atTop + simpa only [typeErrorFactor, add_div, add_zero] using hinv.add hlog + +theorem tendsto_mul_typeErrorFactor_div (K : ℝ) (B : ℕ) : + Tendsto (fun t : ℕ => K * typeErrorFactor B t / (t : ℝ)) atTop (𝓝 0) := by + simpa only [mul_div_assoc, mul_zero] using (tendsto_typeErrorFactor_div B).const_mul K + +end MatrixMultiplication.JointCompatibilityScaling + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/Construction/JointGibbsApproximation.lean b/lean/OAI/LinearAlgebra/MatrixFields/Construction/JointGibbsApproximation.lean new file mode 100644 index 0000000000000000000000000000000000000000..b7e6dcfe746e9efdcb782b8a7ddac0962e72daa5 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/Construction/JointGibbsApproximation.lean @@ -0,0 +1,199 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Entropy.ZeroLeafRateFormula + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +noncomputable section + +open scoped BigOperators Topology +open Filter MatrixMultiplication.Foundation +open MatrixMultiplication.JointEntropyMax + +namespace MatrixMultiplication.JointGibbsApproximation + +def marginalError {A B : Type*} [Fintype A] [Fintype B] + (p q : FiniteLaw A) (f : A → B) (v : B → ℝ) : ℝ := + ∑ b, |(q.map f).mass b - (p.map f).mass b| * |v b| + +theorem marginalError_nonneg {A B : Type*} [Fintype A] [Fintype B] + (p q : FiniteLaw A) (f : A → B) (v : B → ℝ) : + 0 ≤ marginalError p q f v := + Finset.sum_nonneg fun _ _ => mul_nonneg (abs_nonneg _) (abs_nonneg _) + +theorem entropy_le_crossEntropy_of_support {A : Type*} [Fintype A] + (p q : FiniteLaw A) (hsupport : ∀ a, p.mass a = 0 → q.mass a = 0) : + finiteEntropy q.mass ≤ ∑ a, -q.mass a * Real.log (p.mass a) := by + have hterm (a : A) : + entropyTerm (q.mass a) ≤ -q.mass a * Real.log (p.mass a) + p.mass a - q.mass a := by + by_cases hp : p.mass a = 0 + · simp [hp, hsupport a hp] + · exact entropyTerm_le_crossEntropyTerm + (lt_of_le_of_ne (p.nonneg a) (Ne.symm hp)) (q.nonneg a) + calc + finiteEntropy q.mass ≤ + ∑ a, (-q.mass a * Real.log (p.mass a) + p.mass a - q.mass a) := + Finset.sum_le_sum fun a _ => hterm a + _ = ∑ a, -q.mass a * Real.log (p.mass a) := by + rw [Finset.sum_sub_distrib, Finset.sum_add_distrib, p.total, q.total] + ring + +private theorem potential_difference_le {A B : Type*} [Fintype A] [Fintype B] + (p q : FiniteLaw A) (f : A → B) (v : B → ℝ) : + (∑ a, p.mass a * v (f a)) - (∑ a, q.mass a * v (f a)) ≤ + marginalError p q f v := by + rw [sum_mass_mul_coordinate p f v, sum_mass_mul_coordinate q f v, + ← Finset.sum_sub_distrib] + apply Finset.sum_le_sum + intro b _ + calc + (p.map f).mass b * v b - (q.map f).mass b * v b = + ((p.map f).mass b - (q.map f).mass b) * v b := by ring + _ ≤ |((p.map f).mass b - (q.map f).mass b) * v b| := le_abs_self _ + _ = |(q.map f).mass b - (p.map f).mass b| * |v b| := by + rw [abs_mul, abs_sub_comm] + +theorem entropy_le_of_marginal_errors_of_support + {A X Y Z : Type*} [Fintype A] [Fintype X] [Fintype Y] [Fintype Z] + (p q : FiniteLaw A) (fX : A → X) (fY : A → Y) (fZ : A → Z) + (u : X → ℝ) (v : Y → ℝ) (w : Z → ℝ) (c : ℝ) + (hsupport : ∀ a, p.mass a = 0 → q.mass a = 0) + (hlog : ∀ a, 0 < p.mass a → + Real.log (p.mass a) = u (fX a) + v (fY a) + w (fZ a) - c) : + finiteEntropy q.mass ≤ finiteEntropy p.mass + + marginalError p q fX u + marginalError p q fY v + marginalError p q fZ w := by + have hexpand (r : FiniteLaw A) (hr : ∀ a, p.mass a = 0 → r.mass a = 0) : + (∑ a, r.mass a * Real.log (p.mass a)) = + (∑ a, r.mass a * u (fX a)) + (∑ a, r.mass a * v (fY a)) + + (∑ a, r.mass a * w (fZ a)) - c := by + have hterm (a : A) : r.mass a * Real.log (p.mass a) = + r.mass a * (u (fX a) + v (fY a) + w (fZ a) - c) := by + by_cases hp : p.mass a = 0 + · simp [hr a hp] + · rw [hlog a (lt_of_le_of_ne (p.nonneg a) (Ne.symm hp))] + simp_rw [hterm, mul_sub, mul_add] + rw [Finset.sum_sub_distrib, Finset.sum_add_distrib, Finset.sum_add_distrib, + ← Finset.sum_mul, r.total, one_mul] + have hcross : (∑ a, -q.mass a * Real.log (p.mass a)) = + finiteEntropy p.mass + + ((∑ a, p.mass a * u (fX a)) - (∑ a, q.mass a * u (fX a))) + + ((∑ a, p.mass a * v (fY a)) - (∑ a, q.mass a * v (fY a))) + + ((∑ a, p.mass a * w (fZ a)) - (∑ a, q.mass a * w (fZ a))) := by + have hp : finiteEntropy p.mass = -(∑ a, p.mass a * Real.log (p.mass a)) := by + simp only [finiteEntropy, entropyTerm, neg_mul, Finset.sum_neg_distrib] + simp only [neg_mul, Finset.sum_neg_distrib] + rw [hp, hexpand p (fun _ h => h), hexpand q hsupport] + ring + calc + finiteEntropy q.mass ≤ ∑ a, -q.mass a * Real.log (p.mass a) := + entropy_le_crossEntropy_of_support p q hsupport + _ = _ := hcross + _ ≤ _ := add_le_add + (add_le_add (add_le_add le_rfl (potential_difference_le p q fX u)) + (potential_difference_le p q fY v)) (potential_difference_le p q fZ w) + +theorem entropy_le_of_marginal_errors + {A X Y Z : Type*} [Fintype A] [Fintype X] [Fintype Y] [Fintype Z] + (p q : FiniteLaw A) (fX : A → X) (fY : A → Y) (fZ : A → Z) + (u : X → ℝ) (v : Y → ℝ) (w : Z → ℝ) (c : ℝ) + (hp : ∀ a, 0 < p.mass a) + (hlog : ∀ a, Real.log (p.mass a) = u (fX a) + v (fY a) + w (fZ a) - c) : + finiteEntropy q.mass ≤ finiteEntropy p.mass + + marginalError p q fX u + marginalError p q fY v + marginalError p q fZ w := + entropy_le_of_marginal_errors_of_support p q fX fY fZ u v w c + (fun a h => ((hp a).ne' h).elim) (fun a _ => hlog a) + +theorem tendsto_map_mass {I A B : Type*} [Fintype A] [Fintype B] + {l : Filter I} {pN : I → FiniteLaw A} {p : FiniteLaw A} + (h : ∀ a, Tendsto (fun n => (pN n).mass a) l (𝓝 (p.mass a))) + (f : A → B) (b : B) : + Tendsto (fun n => ((pN n).map f).mass b) l (𝓝 ((p.map f).mass b)) := by + classical + simp_rw [FiniteLaw.map_mass] + apply tendsto_finsetSum + intro a _ + by_cases hab : f a = b + · simpa only [hab, ite_true] using h a + · simp only [hab, ite_false] + exact tendsto_const_nhds + +theorem tendsto_marginalError {I A B : Type*} [Fintype A] [Fintype B] + {l : Filter I} {pN : I → FiniteLaw A} {p : FiniteLaw A} + (h : ∀ a, Tendsto (fun n => (pN n).mass a) l (𝓝 (p.mass a))) + (f : A → B) (v : B → ℝ) : + Tendsto (fun n => marginalError p (pN n) f v) l (𝓝 0) := by + have hterm (b : B) : + Tendsto (fun n => |((pN n).map f).mass b - (p.map f).mass b| * |v b|) + l (𝓝 0) := by + have hconst : Tendsto (fun _ : I => (p.map f).mass b) l + (𝓝 ((p.map f).mass b)) := tendsto_const_nhds + simpa only [sub_self, abs_zero, zero_mul] using + ((tendsto_map_mass h f b).sub hconst).abs.mul_const |v b| + simpa only [marginalError, Finset.sum_const_zero] using + tendsto_finsetSum Finset.univ (fun b _ => hterm b) + +theorem eventually_entropy_le_of_tendsto_of_support + {I A X Y Z : Type*} [Fintype A] [Fintype X] [Fintype Y] [Fintype Z] + {l : Filter I} (p : FiniteLaw A) (pN : I → FiniteLaw A) + (fX : A → X) (fY : A → Y) (fZ : A → Z) + (u : X → ℝ) (v : Y → ℝ) (w : Z → ℝ) (c : ℝ) + (hlog : ∀ a, 0 < p.mass a → + Real.log (p.mass a) = u (fX a) + v (fY a) + w (fZ a) - c) + (hN : ∀ a, Tendsto (fun n => (pN n).mass a) l (𝓝 (p.mass a))) + {η : ℝ} (hη : 0 < η) : + ∀ᶠ n in l, ∀ q : FiniteLaw A, + (∀ a, p.mass a = 0 → q.mass a = 0) → + (q.map fX).mass = ((pN n).map fX).mass → + (q.map fY).mass = ((pN n).map fY).mass → + (q.map fZ).mass = ((pN n).map fZ).mass → + finiteEntropy q.mass ≤ finiteEntropy p.mass + η := by + have herror : Tendsto (fun n => marginalError p (pN n) fX u + + marginalError p (pN n) fY v + marginalError p (pN n) fZ w) l (𝓝 0) := by + simpa only [add_zero] using + ((tendsto_marginalError hN fX u).add (tendsto_marginalError hN fY v)).add + (tendsto_marginalError hN fZ w) + have hsmall := herror.eventually (gt_mem_nhds hη) + filter_upwards [hsmall] with n hn + intro q hs hX hY hZ + have hbound := entropy_le_of_marginal_errors_of_support p q fX fY fZ u v w c hs hlog + have hx : marginalError p q fX u = marginalError p (pN n) fX u := by + unfold marginalError + rw [hX] + have hy : marginalError p q fY v = marginalError p (pN n) fY v := by + unfold marginalError + rw [hY] + have hz : marginalError p q fZ w = marginalError p (pN n) fZ w := by + unfold marginalError + rw [hZ] + rw [hx, hy, hz] at hbound + linarith + +theorem eventually_entropy_le_of_tendsto + {I A X Y Z : Type*} [Fintype A] [Fintype X] [Fintype Y] [Fintype Z] + {l : Filter I} (p : FiniteLaw A) (pN : I → FiniteLaw A) + (fX : A → X) (fY : A → Y) (fZ : A → Z) + (u : X → ℝ) (v : Y → ℝ) (w : Z → ℝ) (c : ℝ) + (hp : ∀ a, 0 < p.mass a) + (hlog : ∀ a, Real.log (p.mass a) = u (fX a) + v (fY a) + w (fZ a) - c) + (hN : ∀ a, Tendsto (fun n => (pN n).mass a) l (𝓝 (p.mass a))) + {η : ℝ} (hη : 0 < η) : + ∀ᶠ n in l, ∀ q : FiniteLaw A, + (q.map fX).mass = ((pN n).map fX).mass → + (q.map fY).mass = ((pN n).map fY).mass → + (q.map fZ).mass = ((pN n).map fZ).mass → + finiteEntropy q.mass ≤ finiteEntropy p.mass + η := by + filter_upwards [eventually_entropy_le_of_tendsto_of_support p pN fX fY fZ u v w c + (fun a _ => hlog a) hN hη] with n hn + intro q hX hY hZ + exact hn q (fun a h => ((hp a).ne' h).elim) hX hY hZ + +end MatrixMultiplication.JointGibbsApproximation + +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/Construction/JointLossCounts.lean b/lean/OAI/LinearAlgebra/MatrixFields/Construction/JointLossCounts.lean new file mode 100644 index 0000000000000000000000000000000000000000..05985e26acaf934717153f4fc956435b1ba84f35 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/Construction/JointLossCounts.lean @@ -0,0 +1,267 @@ +import Mathlib + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +noncomputable section + +namespace MatrixMultiplication.JointLossCounts + +open scoped BigOperators + +attribute [local instance] Classical.propDecidable + +variable {Ω V I : Type*} + +theorem card_filter_exists_le (samples : Finset Ω) (indices : Finset I) + (event : I → Ω → Prop) : + (samples.filter (fun ω => ∃ i ∈ indices, event i ω)).card ≤ + ∑ i ∈ indices, (samples.filter (event i)).card := by + classical + have heq : samples.filter (fun ω => ∃ i ∈ indices, event i ω) = + indices.biUnion (fun i => samples.filter (event i)) := by + ext ω + simp only [Finset.mem_filter, Finset.mem_biUnion] + constructor + · rintro ⟨hω, i, hi, he⟩ + exact ⟨i, hi, hω, he⟩ + · rintro ⟨i, hi, hω, he⟩ + exact ⟨hω, i, hi, he⟩ + rw [heq] + exact Finset.card_biUnion_le + +theorem competitor_union_card_mul_le (ownSurvival : Finset Ω) + (competitors : Finset I) (collision : I → Ω → Prop) (M : ℕ) + (hcollision : ∀ i ∈ competitors, + M * (ownSurvival.filter (collision i)).card ≤ ownSurvival.card) : + M * (ownSurvival.filter (fun ω => ∃ i ∈ competitors, collision i ω)).card ≤ + competitors.card * ownSurvival.card := by + classical + calc + _ ≤ M * ∑ i ∈ competitors, (ownSurvival.filter (collision i)).card := + Nat.mul_le_mul_left M (card_filter_exists_le ownSurvival competitors collision) + _ = ∑ i ∈ competitors, M * (ownSurvival.filter (collision i)).card := + by rw [Finset.mul_sum] + _ ≤ ∑ _i ∈ competitors, ownSurvival.card := + Finset.sum_le_sum hcollision + _ = _ := by simp + +def randomLossCount (passing : Finset V) (bad : V → Ω → Prop) (ω : Ω) : ℕ := by + classical + exact (passing.filter (fun v => bad v ω)).card + +def randomLossFraction (full passing : Finset V) (bad : V → Ω → Prop) (ω : Ω) : ℝ := + (randomLossCount passing bad ω : ℝ) / (full.card : ℝ) + +theorem randomLossFraction_nonneg (full passing : Finset V) + (bad : V → Ω → Prop) (ω : Ω) : 0 ≤ randomLossFraction full passing bad ω := + div_nonneg (Nat.cast_nonneg _) (Nat.cast_nonneg _) + +theorem sum_randomLossCount (ownSurvival : Finset Ω) (passing : Finset V) + (bad : V → Ω → Prop) : + (∑ ω ∈ ownSurvival, randomLossCount passing bad ω) = + ∑ v ∈ passing, (ownSurvival.filter (bad v)).card := by + classical + simp only [randomLossCount, Finset.card_filter] + exact Finset.sum_comm + +theorem sum_randomLossCount_le (ownSurvival : Finset Ω) (full passing : Finset V) + (bad : V → Ω → Prop) (ε : ℝ) (hε : 0 ≤ ε) (hpassing : passing ⊆ full) + (hbad : ∀ v ∈ passing, + ((ownSurvival.filter (bad v)).card : ℝ) ≤ ε * (ownSurvival.card : ℝ)) : + (∑ ω ∈ ownSurvival, (randomLossCount passing bad ω : ℝ)) ≤ + (full.card : ℝ) * (ε * (ownSurvival.card : ℝ)) := by + classical + have hdouble : (∑ ω ∈ ownSurvival, (randomLossCount passing bad ω : ℝ)) = + ∑ v ∈ passing, ((ownSurvival.filter (bad v)).card : ℝ) := by + exact_mod_cast sum_randomLossCount ownSurvival passing bad + rw [hdouble] + calc + _ ≤ ∑ _v ∈ passing, ε * (ownSurvival.card : ℝ) := Finset.sum_le_sum hbad + _ = (passing.card : ℝ) * (ε * (ownSurvival.card : ℝ)) := by simp + _ ≤ _ := mul_le_mul_of_nonneg_right + (by exact_mod_cast Finset.card_le_card hpassing) + (mul_nonneg hε (Nat.cast_nonneg _)) + +theorem sum_randomLossFraction_le (ownSurvival : Finset Ω) (full passing : Finset V) + (bad : V → Ω → Prop) (ε : ℝ) (hε : 0 ≤ ε) (hfull : 0 < full.card) + (hpassing : passing ⊆ full) + (hbad : ∀ v ∈ passing, + ((ownSurvival.filter (bad v)).card : ℝ) ≤ ε * (ownSurvival.card : ℝ)) : + (∑ ω ∈ ownSurvival, randomLossFraction full passing bad ω) ≤ + ε * (ownSurvival.card : ℝ) := by + have hcard : (0 : ℝ) < full.card := by exact_mod_cast hfull + simp only [randomLossFraction, ← Finset.sum_div] + apply (div_le_iff₀ hcard).2 + simpa only [mul_comm] using + sum_randomLossCount_le ownSurvival full passing bad ε hε hpassing hbad + +theorem conditional_mean_randomLossFraction_le + (ownSurvival : Finset Ω) (full passing : Finset V) (bad : V → Ω → Prop) + (ε : ℝ) (hε : 0 ≤ ε) (hs : 0 < ownSurvival.card) (hfull : 0 < full.card) + (hpassing : passing ⊆ full) + (hbad : ∀ v ∈ passing, + ((ownSurvival.filter (bad v)).card : ℝ) ≤ ε * (ownSurvival.card : ℝ)) : + (∑ ω ∈ ownSurvival, randomLossFraction full passing bad ω) / + (ownSurvival.card : ℝ) ≤ ε := by + apply (div_le_iff₀ (by exact_mod_cast hs : (0 : ℝ) < ownSurvival.card)).2 + exact sum_randomLossFraction_le ownSurvival full passing bad ε hε hfull hpassing hbad + +theorem card_filter_mul_le_sum (samples : Finset Ω) (f : Ω → ℝ) (t : ℝ) + (hf : ∀ ω ∈ samples, 0 ≤ f ω) : + ((samples.filter (fun ω => t < f ω)).card : ℝ) * t ≤ + ∑ ω ∈ samples, f ω := by + classical + calc + _ = ∑ _ω ∈ samples.filter (fun ω => t < f ω), t := by simp + _ ≤ ∑ ω ∈ samples.filter (fun ω => t < f ω), f ω := by + apply Finset.sum_le_sum + intro ω hω + exact (Finset.mem_filter.mp hω).2.le + _ ≤ _ := Finset.sum_le_sum_of_subset_of_nonneg (Finset.filter_subset _ _) + (fun ω hω _ => hf ω hω) + +theorem bad_orbit_card_le (ownSurvival : Finset Ω) (full passing : Finset V) + (bad : V → Ω → Prop) (ε N : ℝ) (hε : 0 ≤ ε) (hN : 0 < N) + (hfull : 0 < full.card) (hpassing : passing ⊆ full) + (hbad : ∀ v ∈ passing, + ((ownSurvival.filter (bad v)).card : ℝ) ≤ ε * (ownSurvival.card : ℝ)) : + ((ownSurvival.filter (fun ω => 1 / N < randomLossFraction full passing bad ω)).card : ℝ) + ≤ N * ε * (ownSurvival.card : ℝ) := by + classical + have hm := card_filter_mul_le_sum ownSurvival + (randomLossFraction full passing bad) (1 / N) + (fun ω _ => randomLossFraction_nonneg full passing bad ω) + have he := sum_randomLossFraction_le ownSurvival full passing bad ε hε hfull hpassing hbad + have hdiv : + ((ownSurvival.filter (fun ω => 1 / N < randomLossFraction full passing bad ω)).card : ℝ) / N + ≤ ε * (ownSurvival.card : ℝ) := by + simpa only [one_div, ← div_eq_mul_inv] using hm.trans he + have hmul := (div_le_iff₀ hN).1 hdiv + simpa only [mul_assoc, mul_comm, mul_left_comm] using hmul + +def targetBad (orbits : Finset I) (full passing : I → Finset V) + (bad : I → V → Ω → Prop) (eligible : Ω → Prop) (N : ℝ) (ω : Ω) : Prop := + ¬ eligible ω ∨ ∃ i ∈ orbits, 1 / N < randomLossFraction (full i) (passing i) (bad i) ω + +theorem targetBad_card_le (ownSurvival : Finset Ω) (orbits : Finset I) + (full passing : I → Finset V) (bad : I → V → Ω → Prop) + (eligible : Ω → Prop) (ε eligibilityError N : ℝ) + (hε : 0 ≤ ε) (hN : 0 < N) + (hfull : ∀ i ∈ orbits, 0 < (full i).card) + (hpassing : ∀ i ∈ orbits, passing i ⊆ full i) + (hbad : ∀ i ∈ orbits, ∀ v ∈ passing i, + ((ownSurvival.filter (bad i v)).card : ℝ) ≤ ε * (ownSurvival.card : ℝ)) + (heligible : ((ownSurvival.filter (fun ω => ¬ eligible ω)).card : ℝ) ≤ + eligibilityError * (ownSurvival.card : ℝ)) : + ((ownSurvival.filter (targetBad orbits full passing bad eligible N)).card : ℝ) ≤ + (eligibilityError + (orbits.card : ℝ) * N * ε) * (ownSurvival.card : ℝ) := by + classical + let excess := fun i ω => 1 / N < randomLossFraction (full i) (passing i) (bad i) ω + have hunion : ownSurvival.filter (targetBad orbits full passing bad eligible N) = + (ownSurvival.filter (fun ω => ¬ eligible ω)) ∪ + (ownSurvival.filter (fun ω => ∃ i ∈ orbits, excess i ω)) := by + ext ω + simp only [Finset.mem_filter, Finset.mem_union, targetBad, excess] + constructor + · rintro ⟨hω, he | ho⟩ + · exact Or.inl ⟨hω, he⟩ + · exact Or.inr ⟨hω, ho⟩ + · rintro (⟨hω, he⟩ | ⟨hω, ho⟩) + · exact ⟨hω, Or.inl he⟩ + · exact ⟨hω, Or.inr ho⟩ + have hu : ((ownSurvival.filter (targetBad orbits full passing bad eligible N)).card : ℝ) ≤ + ((ownSurvival.filter (fun ω => ¬ eligible ω)).card : ℝ) + + ((ownSurvival.filter (fun ω => ∃ i ∈ orbits, excess i ω)).card : ℝ) := by + rw [hunion] + exact_mod_cast Finset.card_union_le + (ownSurvival.filter (fun ω => ¬ eligible ω)) + (ownSurvival.filter (fun ω => ∃ i ∈ orbits, excess i ω)) + have horbits : ((ownSurvival.filter (fun ω => ∃ i ∈ orbits, excess i ω)).card : ℝ) ≤ + ∑ i ∈ orbits, ((ownSurvival.filter (excess i)).card : ℝ) := by + exact_mod_cast card_filter_exists_le ownSurvival orbits excess + have hsum : (∑ i ∈ orbits, ((ownSurvival.filter (excess i)).card : ℝ)) ≤ + (orbits.card : ℝ) * (N * ε * (ownSurvival.card : ℝ)) := by + calc + _ ≤ ∑ _i ∈ orbits, N * ε * (ownSurvival.card : ℝ) := by + apply Finset.sum_le_sum + intro i hi + exact bad_orbit_card_le ownSurvival (full i) (passing i) (bad i) + ε N hε hN (hfull i hi) (hpassing i hi) (hbad i hi) + _ = _ := by simp + calc + _ ≤ eligibilityError * (ownSurvival.card : ℝ) + + (orbits.card : ℝ) * (N * ε * (ownSurvival.card : ℝ)) := + hu.trans (add_le_add heligible (horbits.trans hsum)) + _ = _ := by ring + +theorem good_card_lower (ownSurvival : Finset Ω) (failure : Ω → Prop) (error : ℝ) + (hbad : ((ownSurvival.filter failure).card : ℝ) ≤ error * (ownSurvival.card : ℝ)) : + (1 - error) * (ownSurvival.card : ℝ) ≤ + ((ownSurvival.filter (fun ω => ¬ failure ω)).card : ℝ) := by + classical + have hsplit := Finset.card_filter_add_card_filter_not + (s := ownSurvival) failure + have hsplitR : ((ownSurvival.filter failure).card : ℝ) + + ((ownSurvival.filter (fun ω => ¬ failure ω)).card : ℝ) = + (ownSurvival.card : ℝ) := by exact_mod_cast hsplit + nlinarith + +variable [DecidableEq V] + +def retained (passing : Finset V) (bad : V → Ω → Prop) (ω : Ω) : Finset V := + passing.filter (fun v => ¬ bad v ω) + +def deterministicLossFraction (full passing : Finset V) : ℝ := + ((full \ passing).card : ℝ) / (full.card : ℝ) + +def missingFraction (full passing : Finset V) (bad : V → Ω → Prop) (ω : Ω) : ℝ := + ((full \ retained passing bad ω).card : ℝ) / (full.card : ℝ) + +theorem missing_card_eq (full passing : Finset V) (bad : V → Ω → Prop) (ω : Ω) + (hpassing : passing ⊆ full) : + (full \ retained passing bad ω).card = + (full \ passing).card + randomLossCount passing bad ω := by + classical + have hkeep : retained passing bad ω ⊆ full := + (Finset.filter_subset _ _).trans hpassing + have h₁ := Finset.card_sdiff_add_card_eq_card hpassing + have h₂ := Finset.card_sdiff_add_card_eq_card hkeep + have h₃ := Finset.card_filter_add_card_filter_not + (s := passing) (fun v => bad v ω) + simp only [retained, randomLossCount] at * + omega + +theorem missingFraction_eq (full passing : Finset V) (bad : V → Ω → Prop) (ω : Ω) + (hpassing : passing ⊆ full) : + missingFraction full passing bad ω = deterministicLossFraction full passing + + randomLossFraction full passing bad ω := by + unfold missingFraction deterministicLossFraction randomLossFraction + rw [missing_card_eq full passing bad ω hpassing, Nat.cast_add, add_div] + +theorem good_missingFraction_le (orbits : Finset I) (full passing : I → Finset V) + (bad : I → V → Ω → Prop) (eligible : Ω → Prop) (C₀ N : ℝ) (ω : Ω) + (hgood : ¬ targetBad orbits full passing bad eligible N ω) + (hpassing : ∀ i ∈ orbits, passing i ⊆ full i) + (hdet : ∀ i ∈ orbits, deterministicLossFraction (full i) (passing i) ≤ C₀ / N) + (i : I) (hi : i ∈ orbits) : + missingFraction (full i) (passing i) (bad i) ω ≤ (C₀ + 1) / N := by + have hr : randomLossFraction (full i) (passing i) (bad i) ω ≤ 1 / N := by + apply le_of_not_gt + intro h + exact hgood (Or.inr ⟨i, hi, h⟩) + rw [missingFraction_eq (full i) (passing i) (bad i) ω (hpassing i hi)] + calc + _ ≤ C₀ / N + 1 / N := add_le_add (hdet i hi) hr + _ = _ := (add_div C₀ 1 N).symm + +end MatrixMultiplication.JointLossCounts + +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/Construction/JointMarginalSupport.lean b/lean/OAI/LinearAlgebra/MatrixFields/Construction/JointMarginalSupport.lean new file mode 100644 index 0000000000000000000000000000000000000000..5ba040d0e44c1f2e712e1f1caea2c17b0f07dad3 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/Construction/JointMarginalSupport.lean @@ -0,0 +1,469 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Histories.GroupOrbitTransport + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section + +namespace MatrixMultiplication.JointAmbientDegree + +open MatrixMultiplication.Foundation JointPopulation +open scoped BigOperators + +attribute [local instance] Classical.propDecidable + +variable {H : Type*} [Fintype H] [DecidableEq H] + (counts : H → Shape → ℕ) + +def localWord (t : JointCoarseHashing.Triple (Position counts)) (h : H) : + Positions counts h → Shape := + fun i => (t.1 ⟨h, i⟩, t.2.1 ⟨h, i⟩, t.2.2 ⟨h, i⟩) + +omit [Fintype H] [DecidableEq H] in +theorem localWord_injective : Function.Injective (localWord counts) := by + intro t u he + apply Prod.ext + · funext p + exact congrArg (fun w => (w p.1 p.2).1) he + · apply Prod.ext + · funext p + exact congrArg (fun w => (w p.1 p.2).2.1) he + · funext p + exact congrArg (fun w => (w p.1 p.2).2.2) he + +def localAllowed (sum : H → ℕ) (h : H) (w : Positions counts h → Shape) : Prop := + (∀ i, (w i).1.val + (w i).2.1.val + (w i).2.2.val = sum h) ∧ + ∀ s a, wordPopulation (shapeSide s ∘ w) a = + wordPopulation (sideWord counts s (triple counts (canonicalTarget counts)) h) a + +theorem localAllowed_of_mem_ambient (sum : H → ℕ) + (t : JointCoarseHashing.Triple (Position counts)) + (ht : t ∈ ambientSet counts sum) (h : H) : + localAllowed counts sum h (localWord counts t h) := by + obtain ⟨hs, hm⟩ := (Finset.mem_filter.mp ht).2 + exact ⟨fun i => hs ⟨h, i⟩, fun s a => hm h s a⟩ + +def sameSide (s : Fin 3) (t e : JointCoarseHashing.Triple (Position counts)) : Prop := + ∀ h, sideWord counts s t h = sideWord counts s e h + +def sharedAmbient (sum : H → ℕ) (s : Fin 3) + (e : JointCoarseHashing.Triple (Position counts)) : + Finset (JointCoarseHashing.Triple (Position counts)) := + (ambientSet counts sum).filter (sameSide counts s · e) + +def classBound (s : Fin 3) (e : JointCoarseHashing.Triple (Position counts)) + (h : H) (entropyCap : ℝ) : ℝ := + ((Fintype.card (Positions counts h) : ℝ) + 1) ^ Fintype.card Shape * + Real.exp ((Fintype.card (Positions counts h) : ℝ) * + (entropyCap - finiteEntropy (fun a => + (wordPopulation (sideWord counts s e h) a : ℝ) / + Fintype.card (Positions counts h))) + + ((Fintype.card Shape : ℝ) + (Fintype.card (Fin 17) : ℝ) + 2) * + (1 + Real.log (Fintype.card (Positions counts h) + 1 : ℕ))) + +def classExponent (s : Fin 3) (e : JointCoarseHashing.Triple (Position counts)) + (h : H) (entropyCap : ℝ) : ℝ := + (Fintype.card (Positions counts h) : ℝ) * + (entropyCap - finiteEntropy (fun a => + (wordPopulation (sideWord counts s e h) a : ℝ) / + Fintype.card (Positions counts h))) + + ((Fintype.card Shape : ℝ) + (Fintype.card (Fin 17) : ℝ) + 2) * + (1 + Real.log (Fintype.card (Positions counts h) + 1 : ℕ)) + + (Fintype.card Shape : ℝ) * Real.log (Fintype.card (Positions counts h) + 1 : ℕ) + +omit [Fintype H] [DecidableEq H] in +theorem classBound_eq_exp (s : Fin 3) + (e : JointCoarseHashing.Triple (Position counts)) (h : H) (entropyCap : ℝ) : + classBound counts s e h entropyCap = Real.exp (classExponent counts s e h entropyCap) := by + unfold classBound classExponent + conv_rhs => rw [Real.exp_add, Real.exp_nat_mul, Real.exp_log (by positivity)] + simp only [Nat.cast_add, Nat.cast_one] + exact mul_comm _ _ + +omit [Fintype H] [DecidableEq H] in +theorem classExponent_target_eq (s : Fin 3) (e : Target counts) (h : H) + (entropyCap : ℝ) : + classExponent counts s (triple counts e) h entropyCap = + classExponent counts s (triple counts (canonicalTarget counts)) h entropyCap := by + simp_rw [classExponent, marginal_population_eq counts e (canonicalTarget counts)] + +theorem sharedAmbient_card_le (sum : H → ℕ) (s : Fin 3) + (e : JointCoarseHashing.Triple (Position counts)) (entropyCap : H → ℝ) + (hentropy : ∀ h w, localAllowed counts sum h w → + finiteEntropy (fun a => (wordPopulation w a : ℝ) / + Fintype.card (Positions counts h)) ≤ entropyCap h) : + ((sharedAmbient counts sum s e).card : ℝ) ≤ + ∏ h, classBound counts s e h (entropyCap h) := by + classical + let Allowed := fun h (w : Positions counts h → Shape) => + localAllowed counts sum h w ∧ ∀ i, shapeSide s (w i) = sideWord counts s e h i + let Local := fun h => {w : Positions counts h → Shape // Allowed h w} + let encode : {t // t ∈ sharedAmbient counts sum s e} → ∀ h, Local h := fun t h => + ⟨localWord counts t.val h, localAllowed_of_mem_ambient counts sum t.val + (Finset.mem_filter.mp t.property).1 h, + fun i => congrFun ((Finset.mem_filter.mp t.property).2 h) i⟩ + have hinj : Function.Injective encode := by + intro t u he + apply Subtype.ext + apply localWord_injective counts + funext h + exact congrArg Subtype.val (congrFun he h) + have hcard : (sharedAmbient counts sum s e).card ≤ ∏ h, Fintype.card (Local h) := by + simpa only [Fintype.card_coe, Fintype.card_pi] using + Fintype.card_le_of_injective encode hinj + have hlocal (h : H) : (Fintype.card (Local h) : ℝ) ≤ + classBound counts s e h (entropyCap h) := by + exact JointTypeCounts.card_allowed_over_coarse_le (shapeSide s) + (sideWord counts s e h) (Allowed h) (entropyCap h) + (fun w hw => hw.2) (fun w hw => hentropy h w hw.1) + calc + ((sharedAmbient counts sum s e).card : ℝ) ≤ + ∏ h, (Fintype.card (Local h) : ℝ) := by exact_mod_cast hcard + _ ≤ _ := Finset.prod_le_prod₀ (fun _ _ => Nat.cast_nonneg _) (fun history _ => hlocal history) + +omit [Fintype H] [DecidableEq H] in +theorem sharesSide_iff (t e : JointCoarseHashing.Triple (Position counts)) : + JointCoarseHashing.SharesSide t e ↔ ∃ s : Fin 3, sameSide counts s t e := by + constructor + · rintro (hx | hy | hz) + · refine ⟨0, fun h => ?_⟩ + funext i + change t.1 ⟨h, i⟩ = e.1 ⟨h, i⟩ + exact congrFun hx.symm ⟨h, i⟩ + · refine ⟨1, fun h => ?_⟩ + funext i + change t.2.1 ⟨h, i⟩ = e.2.1 ⟨h, i⟩ + exact congrFun hy.symm ⟨h, i⟩ + · refine ⟨2, fun h => ?_⟩ + funext i + change t.2.2 ⟨h, i⟩ = e.2.2 ⟨h, i⟩ + exact congrFun hz.symm ⟨h, i⟩ + · rintro ⟨s, hs⟩ + fin_cases s + · apply Or.inl + funext p + simpa [sideWord, shapeSide] using (congrFun (hs p.1) p.2).symm + · apply Or.inr ∘ Or.inl + funext p + simpa [sideWord, shapeSide] using (congrFun (hs p.1) p.2).symm + · apply Or.inr ∘ Or.inr + funext p + simpa [sideWord, shapeSide] using (congrFun (hs p.1) p.2).symm + +def neighbors (sum : H → ℕ) (e : JointCoarseHashing.Triple (Position counts)) : + Finset (JointCoarseHashing.Triple (Position counts)) := + (ambientSet counts sum).filter (fun t => t ≠ e ∧ JointCoarseHashing.SharesSide t e) + +theorem neighbors_card_le_sum (sum : H → ℕ) + (e : JointCoarseHashing.Triple (Position counts)) : + (neighbors counts sum e).card ≤ ∑ s : Fin 3, (sharedAmbient counts sum s e).card := by + classical + have hsub : neighbors counts sum e ⊆ + (ambientSet counts sum).filter (fun t => ∃ s ∈ (Finset.univ : Finset (Fin 3)), + sameSide counts s t e) := by + intro t ht + obtain ⟨ha, _, hs⟩ := Finset.mem_filter.mp ht + obtain ⟨s, hs⟩ := (sharesSide_iff counts t e).mp hs + exact Finset.mem_filter.mpr ⟨ha, s, Finset.mem_univ _, hs⟩ + apply (Finset.card_le_card hsub).trans + convert JointLossCounts.card_filter_exists_le (ambientSet counts sum) Finset.univ + (fun side target => sameSide counts side target e) using 1 <;> + simp [sharedAmbient] + +theorem neighbors_card_le (sum : H → ℕ) + (e : JointCoarseHashing.Triple (Position counts)) (entropyCap : H → ℝ) + (hentropy : ∀ h w, localAllowed counts sum h w → + finiteEntropy (fun a => (wordPopulation w a : ℝ) / + Fintype.card (Positions counts h)) ≤ entropyCap h) : + ((neighbors counts sum e).card : ℝ) ≤ + ∑ s : Fin 3, ∏ h, classBound counts s e h (entropyCap h) := by + calc + ((neighbors counts sum e).card : ℝ) ≤ + ∑ s : Fin 3, ((sharedAmbient counts sum s e).card : ℝ) := by + exact_mod_cast neighbors_card_le_sum counts sum e + _ ≤ _ := Finset.sum_le_sum fun s _ => sharedAmbient_card_le counts sum s e entropyCap hentropy + +theorem neighbors_card_le_three_exp (sum : H → ℕ) + (e : JointCoarseHashing.Triple (Position counts)) (entropyCap : H → ℝ) + (hentropy : ∀ h w, localAllowed counts sum h w → + finiteEntropy (fun a => (wordPopulation w a : ℝ) / + Fintype.card (Positions counts h)) ≤ entropyCap h) + (exponent : ℝ) + (hupper : ∀ s : Fin 3, ∑ h, classExponent counts s e h (entropyCap h) ≤ exponent) : + ((neighbors counts sum e).card : ℝ) ≤ 3 * Real.exp exponent := by + have hprod (s : Fin 3) : (∏ h, classBound counts s e h (entropyCap h)) ≤ + Real.exp exponent := by + simp_rw [classBound_eq_exp] + rw [← Real.exp_sum] + exact Real.exp_le_exp.mpr (hupper s) + calc + ((neighbors counts sum e).card : ℝ) ≤ + ∑ s : Fin 3, ∏ h, classBound counts s e h (entropyCap h) := + neighbors_card_le counts sum e entropyCap hentropy + _ ≤ ∑ _s : Fin 3, Real.exp exponent := Finset.sum_le_sum fun s _ => hprod s + _ = _ := by simp + +theorem log_neighbors_card_le (sum : H → ℕ) + (e : JointCoarseHashing.Triple (Position counts)) (entropyCap : H → ℝ) + (hentropy : ∀ h w, localAllowed counts sum h w → + finiteEntropy (fun a => (wordPopulation w a : ℝ) / + Fintype.card (Positions counts h)) ≤ entropyCap h) + (exponent : ℝ) + (hupper : ∀ s : Fin 3, ∑ h, classExponent counts s e h (entropyCap h) ≤ exponent) + (hne : 0 < (neighbors counts sum e).card) : + Real.log ((neighbors counts sum e).card : ℝ) ≤ Real.log 3 + exponent := by + have hb := Real.log_le_log (by exact_mod_cast hne : + (0 : ℝ) < (neighbors counts sum e).card) + (neighbors_card_le_three_exp counts sum e entropyCap hentropy exponent hupper) + simpa only [Real.log_mul (by norm_num : (3 : ℝ) ≠ 0) (Real.exp_ne_zero _), + Real.log_exp] using hb + +end MatrixMultiplication.JointAmbientDegree + + + + + + +namespace MatrixMultiplication.AllFieldGroupDegrees + +open AllFieldHistory AllFieldHistorySupport AllFieldHistoryChildLaws +open AllFieldGroupOrbitData JointPopulation JointCanonicalization +open MatrixMultiplication.Foundation +open scoped BigOperators +attribute [local instance] Classical.propDecidable Classical.decEq + +variable {K tick : ℕ} + +abbrev Letter (sigma : Placement) (h : ActiveOrder K tick sigma) := + Fin (activeHalfLength h.val) → Fin 7 + +abbrev Class (sigma : Placement) := ActiveOrder K tick sigma × Fin 17 + +abbrev Symbol (sigma : Placement) (c : Class (K := K) (tick := tick) sigma) := + Statistic c.1.val + +def projectedStatistic (sigma : Placement) + (c : Class (K := K) (tick := tick) sigma) : Letter (K := K) (tick := tick) sigma c.1 → Symbol (K := K) (tick := tick) sigma c := + statistic c.1.val + +def classDesignated (right : Bool) (side : Fin 3) (sigma : Placement) + (c : Class (K := K) (tick := tick) sigma) (u : JointPopulation.Shape) : Prop := + designated right side sigma c.1 u + +def classLaw (right : Bool) (side : Fin 3) (sigma : Placement) + (c : Class (K := K) (tick := tick) sigma) (u : JointPopulation.Shape) : + Symbol (K := K) (tick := tick) sigma c → ℝ := compatibilityLaw right side sigma c.1 u + +theorem tripleSide_eq_sideWord (allocation : Allocation) (m : ℕ) (sigma : Placement) + (s : Fin 3) (t : JointCoarseHashing.Triple (Pos (K := K) (tick := tick) allocation m sigma)) + (h : ActiveOrder K tick sigma) (i : JointPopulation.Positions (Counts (K := K) (tick := tick) allocation m sigma) h) : + tripleSide s t ⟨h, i⟩ = sideWord (Counts (K := K) (tick := tick) allocation m sigma) s t h i := by + fin_cases s <;> rfl + +theorem tripleSide_triple (allocation : Allocation) (m : ℕ) (sigma : Placement) + (s : Fin 3) (e : Targets (K := K) (tick := tick) allocation m sigma) + (h : ActiveOrder K tick sigma) (i : JointPopulation.Positions (Counts (K := K) (tick := tick) allocation m sigma) h) : + tripleSide s (triple (Counts (K := K) (tick := tick) allocation m sigma) e) ⟨h, i⟩ = + shapeSide s ((e h).val i) := by + fin_cases s <;> rfl + +theorem childWidth_le {ε : ℝ} (hε : 0 ≤ ε) (h : Active K tick) : + AllFieldHistoryMasks.childWidth ε h ≤ ε := by + have hp : 0 ≤ AllFieldHistoryMasks.pairWidth ε h := by + unfold AllFieldHistoryMasks.pairWidth + positivity + calc + AllFieldHistoryMasks.childWidth ε h ≤ AllFieldHistoryMasks.pairWidth ε h := + div_le_self hp (by norm_num) + _ ≤ ε := div_le_self hε (one_le_pow₀ (by norm_num)) + +theorem fineCompatible_uniform (allocation : Allocation) (m : ℕ) + {ε χ : ℝ} (hε : 0 ≤ ε) (hχ : ε ≤ χ) (sigma : Placement) (side : Fin 3) + (e : Targets (K := K) (tick := tick) allocation m sigma) + (w : Raw (K := K) (tick := tick) allocation m sigma) + (hw : fineCompatible allocation m ε sigma side e w) : + JointPopulationCompatibility.Compatible (Counts (K := K) (tick := tick) allocation m sigma) + (Letter (K := K) (tick := tick) sigma) (Letter (K := K) (tick := tick) sigma) (Symbol (K := K) (tick := tick) sigma) (Symbol (K := K) (tick := tick) sigma) + (projectedStatistic sigma) (projectedStatistic sigma) + (classDesignated false side sigma) (classDesignated true side sigma) + (classLaw false side sigma) (classLaw true side sigma) χ (sigma side) e w := by + constructor + · intro h u hd a + exact (hw false h u hd a).trans + (mul_le_mul_of_nonneg_left ((childWidth_le hε h.val).trans hχ) (Nat.cast_nonneg _)) + · intro h u hd a + exact (hw true h u hd a).trans + (mul_le_mul_of_nonneg_left ((childWidth_le hε h.val).trans hχ) (Nat.cast_nonneg _)) + +def uniformCompatible (allocation : Allocation) (m : ℕ) (χ : ℝ) + (sigma : Placement) (side : Fin 3) + (e : Targets (K := K) (tick := tick) allocation m sigma) + (w : Raw (K := K) (tick := tick) allocation m sigma) : Prop := + JointPopulationCompatibility.compatibleWithCoarse (Counts (K := K) (tick := tick) allocation m sigma) + (Letter (K := K) (tick := tick) sigma) (Letter (K := K) (tick := tick) sigma) (Symbol (K := K) (tick := tick) sigma) (Symbol (K := K) (tick := tick) sigma) + (projectedStatistic sigma) (projectedStatistic sigma) + (classDesignated false side sigma) (classDesignated true side sigma) + (classLaw false side sigma) (classLaw true side sigma) χ + (ownWord allocation m sigma) (sigma side) (triple (Counts (K := K) (tick := tick) allocation m sigma) e) w + +theorem Compatible_uniform (allocation : Allocation) (m : ℕ) + {ε χ : ℝ} (hε : 0 ≤ ε) (hχ : ε ≤ χ) (sigma : Placement) (side : Fin 3) + (e : Targets (K := K) (tick := tick) allocation m sigma) + (w : Raw (K := K) (tick := tick) allocation m sigma) + (hw : Compatible allocation m ε sigma side e w) : + uniformCompatible allocation m χ sigma side e w := by + apply (JointPopulationCompatibility.compatibleWithCoarse_target + (Counts (K := K) (tick := tick) allocation m sigma) (Letter (K := K) (tick := tick) sigma) (Letter (K := K) (tick := tick) sigma) + (Symbol (K := K) (tick := tick) sigma) (Symbol (K := K) (tick := tick) sigma) (projectedStatistic sigma) (projectedStatistic sigma) + (classDesignated false side sigma) (classDesignated true side sigma) + (classLaw false side sigma) (classLaw true side sigma) χ + (ownWord allocation m sigma) (sigma side) e w).2 + refine ⟨?_, fineCompatible_uniform allocation m hε hχ sigma side e w hw.2⟩ + intro h i + have hh := congrFun hw.1 ⟨h, i⟩ + simpa only [coarse, tripleSide_reorder, tripleSide_triple] using hh + +def conditionalCount (allocation : Allocation) (m : ℕ) (χ : ℝ) + (sigma : Placement) (side : Fin 3) (w : Raw (K := K) (tick := tick) allocation m sigma) : ℕ := + JointPopulationCompatibility.compatibleTargetCount (Counts (K := K) (tick := tick) allocation m sigma) + (Letter (K := K) (tick := tick) sigma) (Letter (K := K) (tick := tick) sigma) (Symbol (K := K) (tick := tick) sigma) (Symbol (K := K) (tick := tick) sigma) + (projectedStatistic sigma) (projectedStatistic sigma) + (classDesignated false side sigma) (classDesignated true side sigma) + (classLaw false side sigma) (classLaw true side sigma) χ + (sigma side) (ownWord allocation m sigma w) w + +theorem uniformCompatible_count (allocation : Allocation) (m : ℕ) (χ : ℝ) + (sigma : Placement) (side : Fin 3) (w : Raw (K := K) (tick := tick) allocation m sigma) : + Fintype.card {e : Targets (K := K) (tick := tick) allocation m sigma // + uniformCompatible allocation m χ sigma side e w} = + conditionalCount allocation m χ sigma side w := + JointPopulationCompatibility.compatibleWithCoarse_target_count + (Counts (K := K) (tick := tick) allocation m sigma) (Letter (K := K) (tick := tick) sigma) (Letter (K := K) (tick := tick) sigma) + (Symbol (K := K) (tick := tick) sigma) (Symbol (K := K) (tick := tick) sigma) (projectedStatistic sigma) (projectedStatistic sigma) + (classDesignated false side sigma) (classDesignated true side sigma) + (classLaw false side sigma) (classLaw true side sigma) χ + (ownWord allocation m sigma) (sigma side) w + +theorem competitors_card_le_conditionalCount (allocation : Allocation) (m : ℕ) + {ε χ : ℝ} (hε : 0 ≤ ε) (hχ : ε ≤ χ) (sigma : Placement) + (e : Targets (K := K) (tick := tick) allocation m sigma) + (o : Orbit (K := K) (tick := tick) allocation m sigma) (v : Variable (K := K) (tick := tick) allocation m sigma) : + (competitors allocation m ε sigma e o v).card ≤ + conditionalCount allocation m χ sigma v.1 v.2 := by + classical + let candidates : Finset (Targets (K := K) (tick := tick) allocation m sigma) := + Finset.univ.filter fun f => uniformCompatible allocation m χ sigma v.1 f v.2 + have hsub : competitors allocation m ε sigma e o v ⊆ + candidates.image (coarse allocation m sigma) := by + intro t ht + obtain ⟨f, hf, hc⟩ := (Finset.mem_filter.mp ht).2.2.2 + exact Finset.mem_image.mpr ⟨f, Finset.mem_filter.mpr + ⟨Finset.mem_univ _, Compatible_uniform allocation m hε hχ sigma v.1 f v.2 hc⟩, hf⟩ + calc + (competitors allocation m ε sigma e o v).card ≤ + (candidates.image (coarse allocation m sigma)).card := Finset.card_le_card hsub + _ ≤ candidates.card := Finset.card_image_le + _ = Fintype.card {f : Targets (K := K) (tick := tick) allocation m sigma // + uniformCompatible allocation m χ sigma v.1 f v.2} := by + simp only [candidates, Fintype.card_subtype] + _ = conditionalCount allocation m χ sigma v.1 v.2 := + uniformCompatible_count allocation m χ sigma v.1 v.2 + +theorem eligibility_card_le_sharedAmbient (allocation : Allocation) (m : ℕ) + (ε : ℝ) (sigma : Placement) + (e : Targets (K := K) (tick := tick) allocation m sigma) : + ((data allocation m ε sigma).eligibilityCompetitors e).card ≤ + (JointAmbientDegree.sharedAmbient (Counts (K := K) (tick := tick) allocation m sigma) + (fun h => 2 * activeHalfLength h.val) (sigma 0) + (triple (Counts (K := K) (tick := tick) allocation m sigma) e)).card := by + let a := JointAmbientDegree.sharedAmbient (Counts (K := K) (tick := tick) allocation m sigma) + (fun h => 2 * activeHalfLength h.val) (sigma 0) + (triple (Counts (K := K) (tick := tick) allocation m sigma) e) + have hs : (data allocation m ε sigma).eligibilityCompetitors e ⊆ + a.image (reorder sigma) := by + intro f hf + obtain ⟨ha, _, hx⟩ := + ((data allocation m ε sigma).mem_eligibilityCompetitors e f).1 hf + obtain ⟨t, ht, rfl⟩ := Finset.mem_image.mp ha + apply Finset.mem_image.mpr + refine ⟨t, Finset.mem_filter.mpr ⟨ht, ?_⟩, rfl⟩ + intro h + funext i + have hh := congrFun hx ⟨h, i⟩ + change tripleSide (sigma 0) t ⟨h, i⟩ = + tripleSide (sigma 0) (triple (Counts (K := K) (tick := tick) allocation m sigma) e) ⟨h, i⟩ at hh + simpa only [tripleSide_eq_sideWord] using hh + exact (Finset.card_le_card hs).trans Finset.card_image_le + +end MatrixMultiplication.AllFieldGroupDegrees + + + + + + +namespace MatrixMultiplication.JointMarginalSupport + +open MatrixMultiplication.Foundation JointPopulation JointAmbientDegree +open scoped BigOperators + +attribute [local instance] Classical.propDecidable + +variable {H : Type*} [Fintype H] [DecidableEq H] + (counts : H → Shape → ℕ) (sum : H → ℕ) + +omit [Fintype H] [DecidableEq H] in +theorem localAllowed_coordinate_witness (h : H) (w : Positions counts h → Shape) + (hw : localAllowed counts sum h w) (s : Fin 3) (i : Positions counts h) : + ∃ j : Positions counts h, + shapeSide s ((canonicalTarget counts h).val j) = shapeSide s (w i) := by + have hp : 0 < wordPopulation (shapeSide s ∘ w) (shapeSide s (w i)) := by + unfold wordPopulation + exact Fintype.card_pos_iff.mpr ⟨⟨i, rfl⟩⟩ + rw [hw.2 s (shapeSide s (w i))] at hp + obtain ⟨⟨j, hj⟩⟩ := Fintype.card_pos_iff.mp hp + exact ⟨j, hj⟩ + +omit [Fintype H] [DecidableEq H] in +theorem localAllowed_coordinate_support (h : H) (w : Positions counts h → Shape) + (hw : localAllowed counts sum h w) (allowed : Fin 3 → Fin 17 → Prop) + (hallowed : ∀ u, 0 < counts h u → ∀ s, allowed s (shapeSide s u)) : + ∀ i s, allowed s (shapeSide s (w i)) := by + intro i s + obtain ⟨j, hj⟩ := localAllowed_coordinate_witness counts sum h w hw s i + rw [← hj] + exact hallowed ((canonicalTarget counts h).val j) + (symbol_count_pos counts (canonicalTarget counts) h j) s + +omit [Fintype H] [DecidableEq H] in +theorem localAllowed_parent_bounds (h : H) (w : Positions counts h → Shape) + (hw : localAllowed counts sum h w) (parent : Fin 3 → ℕ) + (hparent : ∀ u, 0 < counts h u → ∀ s, (shapeSide s u).val ≤ parent s) : + ∀ i s, (shapeSide s (w i)).val ≤ parent s := + localAllowed_coordinate_support counts sum h w hw + (fun s a => a.val ≤ parent s) hparent + +omit [Fintype H] [DecidableEq H] in +theorem localAllowed_positive_reference (h : H) (w : Positions counts h → Shape) + (hw : localAllowed counts sum h w) (parent : Fin 3 → ℕ) (p : Shape → ℝ) + (hparent : ∀ u, 0 < counts h u → ∀ s, (shapeSide s u).val ≤ parent s) + (hp : ∀ u : Shape, u.1.val + u.2.1.val + u.2.2.val = sum h → + (∀ s, (shapeSide s u).val ≤ parent s) → 0 < p u) : + ∀ i, 0 < p (w i) := by + intro i + exact hp (w i) (hw.1 i) (localAllowed_parent_bounds counts sum h w hw parent hparent i) + +end MatrixMultiplication.JointMarginalSupport + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/Construction/JointMaskedAssignment.lean b/lean/OAI/LinearAlgebra/MatrixFields/Construction/JointMaskedAssignment.lean new file mode 100644 index 0000000000000000000000000000000000000000..5f60e2122aa531413987634b5aa6ac371b5eac03 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/Construction/JointMaskedAssignment.lean @@ -0,0 +1,841 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Extraction.JointExtraction +import OAI.LinearAlgebra.MatrixFields.Histories.InheritedMaskMargins +import OAI.LinearAlgebra.MatrixFields.Parameters.JointPopulation + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section + +namespace MatrixMultiplication.JointCoarseAssignment + +open MatrixMultiplication.Foundation JointExtraction + +attribute [local instance] Classical.propDecidable + +variable {F X Y Z A B C I V : Type*} [CommSemiring F] + +abbrev Triple (A B C : Type*) := A × B × C + +def survives (hx : A → Prop) (hy : B → Prop) (hz : C → Prop) + (e : Triple A B C) : Prop := hx e.1 ∧ hy e.2.1 ∧ hz e.2.2 + +def eligible (ambient targets : Finset (Triple A B C)) + (hx : A → Prop) (hy : B → Prop) (hz : C → Prop) : Finset (Triple A B C) := + ambient.filter fun e => e ∈ targets ∧ survives hx hy hz e ∧ + ∀ f ∈ ambient, survives hx hy hz f → f.1 = e.1 → f = e + +theorem mem_eligible_iff (ambient targets : Finset (Triple A B C)) + (hx : A → Prop) (hy : B → Prop) (hz : C → Prop) (e : Triple A B C) : + e ∈ eligible ambient targets hx hy hz ↔ + e ∈ ambient ∧ e ∈ targets ∧ survives hx hy hz e ∧ + ∀ f ∈ ambient, survives hx hy hz f → f.1 = e.1 → f = e := by + simp [eligible] + +def assignUseful (eligible : Finset I) (compatible useful : I → V → Prop) + (v : V) : Option I := + retainAssignment (uniqueAssignment eligible compatible) + (fun v => ∃ i, uniqueAssignment eligible compatible v = some i ∧ useful i v) v + +theorem assignUseful_spec (eligible : Finset I) (compatible useful : I → V → Prop) + (v : V) (i : I) (h : assignUseful eligible compatible useful v = some i) : + i ∈ eligible ∧ compatible i v ∧ useful i v ∧ + ∀ j, j ∈ eligible → compatible j v → j = i := by + classical + have hu : uniqueAssignment eligible compatible v = some i := + retainAssignment_some _ _ v i h + have hh := uniqueAssignment_spec eligible compatible v i hu + have huse : useful i v := by + unfold assignUseful retainAssignment at h + split_ifs at h with hk + obtain ⟨j, hj, hju⟩ := hk + have hji : j = i := Option.some.inj (hj.symm.trans hu) + exact hji ▸ hju + exact ⟨hh.1, hh.2.1, huse, hh.2.2⟩ + +def assignments (ambient targets : Finset (Triple A B C)) + (hx : A → Prop) (hy : B → Prop) (hz : C → Prop) + (cx : X → A) (cy : Y → B) (cz : Z → C) + (compatibleY : Triple A B C → Y → Prop) + (compatibleZ : Triple A B C → Z → Prop) + (usefulX : Triple A B C → X → Prop) + (usefulY : Triple A B C → Y → Prop) + (usefulZ : Triple A B C → Z → Prop) : Assignment X Y Z (Triple A B C) where + x := assignUseful (eligible ambient targets hx hy hz) (fun e x => cx x = e.1) usefulX + y := assignUseful (eligible ambient targets hx hy hz) + (fun e y => cy y = e.2.1 ∧ compatibleY e y) usefulY + z := assignUseful (eligible ambient targets hx hy hz) + (fun e z => cz z = e.2.2 ∧ compatibleZ e z) usefulZ + +theorem assignments_coherent + (T : Tensor F X Y Z) (ambient targets : Finset (Triple A B C)) + (hx : A → Prop) (hy : B → Prop) (hz : C → Prop) + (cx : X → A) (cy : Y → B) (cz : Z → C) + (compatibleY : Triple A B C → Y → Prop) + (compatibleZ : Triple A B C → Z → Prop) + (usefulX : Triple A B C → X → Prop) + (usefulY : Triple A B C → Y → Prop) + (usefulZ : Triple A B C → Z → Prop) + (support : ∀ x y z, T x y z ≠ 0 → (cx x, cy y, cz z) ∈ ambient) + (transferY : ∀ x y z e, T x y z ≠ 0 → (cx x, cy y, cz z) = e → + usefulX e x → compatibleY e y) + (transferZ : ∀ x y z e, T x y z ≠ 0 → (cx x, cy y, cz z) = e → + usefulX e x → usefulY e y → compatibleZ e z) : + Coherent T (assignments ambient targets hx hy hz cx cy cz + compatibleY compatibleZ usefulX usefulY usefulZ) := by + intro x y z i j k hT hxi hyj hzk + have hi := assignUseful_spec (eligible ambient targets hx hy hz) + (fun e x => cx x = e.1) usefulX x i hxi + have hj := assignUseful_spec (eligible ambient targets hx hy hz) + (fun e y => cy y = e.2.1 ∧ compatibleY e y) usefulY y j hyj + have hk := assignUseful_spec (eligible ambient targets hx hy hz) + (fun e z => cz z = e.2.2 ∧ compatibleZ e z) usefulZ z k hzk + have hie := (mem_eligible_iff ambient targets hx hy hz i).mp hi.1 + have hje := (mem_eligible_iff ambient targets hx hy hz j).mp hj.1 + have hke := (mem_eligible_iff ambient targets hx hy hz k).mp hk.1 + have hs : survives hx hy hz (cx x, cy y, cz z) := + ⟨hi.2.1.symm ▸ hie.2.2.1.1, hj.2.1.1.symm ▸ hje.2.2.1.2.1, + hk.2.1.1.symm ▸ hke.2.2.1.2.2⟩ + have he : (cx x, cy y, cz z) = i := + hie.2.2.2 _ (support x y z hT) hs hi.2.1 + have hyi : cy y = i.2.1 := congrArg (fun e : Triple A B C => e.2.1) he + have hzi : cz z = i.2.2 := congrArg (fun e : Triple A B C => e.2.2) he + have hij : i = j := hj.2.2.2 i hi.1 + ⟨hyi, transferY x y z i hT he hi.2.2.1⟩ + have huy : usefulY i y := hij.symm ▸ hj.2.2.1 + have hik : i = k := hk.2.2.2 i hi.1 + ⟨hzi, transferZ x y z i hT he hi.2.2.1 huy⟩ + exact ⟨hij, hik⟩ + +end MatrixMultiplication.JointCoarseAssignment + + + + + + +namespace MatrixMultiplication.JointIdealBranches + +open MatrixMultiplication.Foundation JointExtraction JointCoarseAssignment + +attribute [local instance] Classical.propDecidable + +variable {F X Y Z A B C : Type*} [CommSemiring F] + +def ideal (T : Tensor F X Y Z) + (cx : X → A) (cy : Y → B) (cz : Z → C) + (usefulX : Triple A B C → X → Prop) + (usefulY : Triple A B C → Y → Prop) + (usefulZ : Triple A B C → Z → Prop) (e : Triple A B C) : Tensor F X Y Z := + ExactRecovery.delete T (fun x => cx x = e.1 ∧ usefulX e x) + (fun y => cy y = e.2.1 ∧ usefulY e y) + (fun z => cz z = e.2.2 ∧ usefulZ e z) + +theorem branch_eq_delete_ideal + (T : Tensor F X Y Z) (ambient targets : Finset (Triple A B C)) + (hx : A → Prop) (hy : B → Prop) (hz : C → Prop) + (cx : X → A) (cy : Y → B) (cz : Z → C) + (compatibleY : Triple A B C → Y → Prop) + (compatibleZ : Triple A B C → Z → Prop) + (usefulX : Triple A B C → X → Prop) + (usefulY : Triple A B C → Y → Prop) + (usefulZ : Triple A B C → Z → Prop) (e : Triple A B C) : + let a := assignments ambient targets hx hy hz cx cy cz + compatibleY compatibleZ usefulX usefulY usefulZ + branch T a e = ExactRecovery.delete (ideal T cx cy cz usefulX usefulY usefulZ e) + (fun x => a.x x = some e) (fun y => a.y y = some e) (fun z => a.z z = some e) := by + classical + dsimp only + funext x y z + by_cases h : + (assignments ambient targets hx hy hz cx cy cz compatibleY compatibleZ + usefulX usefulY usefulZ).x x = some e ∧ + (assignments ambient targets hx hy hz cx cy cz compatibleY compatibleZ + usefulX usefulY usefulZ).y y = some e ∧ + (assignments ambient targets hx hy hz cx cy cz compatibleY compatibleZ + usefulX usefulY usefulZ).z z = some e + · have hX := assignUseful_spec (eligible ambient targets hx hy hz) + (fun e x => cx x = e.1) usefulX x e h.1 + have hY := assignUseful_spec (eligible ambient targets hx hy hz) + (fun e y => cy y = e.2.1 ∧ compatibleY e y) usefulY y e h.2.1 + have hZ := assignUseful_spec (eligible ambient targets hx hy hz) + (fun e z => cz z = e.2.2 ∧ compatibleZ e z) usefulZ z e h.2.2 + simp [branch, ExactRecovery.delete, ideal, h, hX.2.1, hX.2.2.1, + hY.2.1.1, hY.2.2.1, hZ.2.1.1, hZ.2.2.1] + · simp [branch, ExactRecovery.delete, h] + +theorem ideal_delete (T : Tensor F X Y Z) + (px : X → Prop) (py : Y → Prop) (pz : Z → Prop) + (cx : X → A) (cy : Y → B) (cz : Z → C) + (usefulX : Triple A B C → X → Prop) + (usefulY : Triple A B C → Y → Prop) + (usefulZ : Triple A B C → Z → Prop) (e : Triple A B C) : + ideal (ExactRecovery.delete T px py pz) cx cy cz usefulX usefulY usefulZ e = + ExactRecovery.delete (ideal T cx cy cz usefulX usefulY usefulZ e) px py pz := by + funext x y z + simp only [ideal, ExactRecovery.delete] + split_ifs <;> simp_all + +theorem branch_masked_eq_delete_ideal + (T : Tensor F X Y Z) (px : X → Prop) (py : Y → Prop) (pz : Z → Prop) + (ambient targets : Finset (Triple A B C)) + (hx : A → Prop) (hy : B → Prop) (hz : C → Prop) + (cx : X → A) (cy : Y → B) (cz : Z → C) + (compatibleY : Triple A B C → Y → Prop) + (compatibleZ : Triple A B C → Z → Prop) + (usefulX : Triple A B C → X → Prop) + (usefulY : Triple A B C → Y → Prop) + (usefulZ : Triple A B C → Z → Prop) (e : Triple A B C) : + let a := assignments ambient targets hx hy hz cx cy cz + compatibleY compatibleZ usefulX usefulY usefulZ + branch (ExactRecovery.delete T px py pz) a e = + ExactRecovery.delete (ideal T cx cy cz usefulX usefulY usefulZ e) + (fun x => a.x x = some e ∧ px x) + (fun y => a.y y = some e ∧ py y) + (fun z => a.z z = some e ∧ pz z) := by + dsimp only + rw [branch_eq_delete_ideal, ideal_delete] + funext x y z + simp only [ExactRecovery.delete] + split_ifs <;> simp_all + +theorem masked_source_restriction [Fintype X] [Fintype Y] [Fintype Z] + [DecidableEq A] [DecidableEq B] [DecidableEq C] + (T : Tensor F X Y Z) (a : Assignment X Y Z (Triple A B C)) + (hcoherent : Coherent T a) (px : X → Prop) (py : Y → Prop) (pz : Z → Prop) : + Tensor.restrict (assignmentMatrix a.x) (assignmentMatrix a.y) (assignmentMatrix a.z) + (ExactRecovery.delete T px py pz) = + Tensor.directSum (branch (ExactRecovery.delete T px py pz) a) := by + apply restrict_assignments_eq_directSum + apply coherent_of_support_subset T _ a hcoherent + intro x y z h ht + exact h (by simp [ExactRecovery.delete, ht]) + +end MatrixMultiplication.JointIdealBranches + + + + + + +namespace MatrixMultiplication.JointCanonicalization + +open MatrixMultiplication.Foundation JointPopulation InheritedMasks +open PermutationMatching HistorySymmetry +open scoped BigOperators + +attribute [local instance] Classical.propDecidable + +variable {H : Type*} [Fintype H] [DecidableEq H] + (counts : H → Shape → ℕ) + +def fiberEquiv (e : Target counts) (h : H) (u : Shape) : + Class counts e h u ≃ Fin (counts h u) := + Fintype.equivOfCardEq (by rw [class_card, Fintype.card_fin]) + +def positionEquiv (e : Target counts) (h : H) : + Positions counts h ≃ (Σ u, Fin (counts h u)) := + (Equiv.sigmaFiberEquiv (e h).val).symm.trans + (Equiv.sigmaCongrRight (fiberEquiv counts e h)) + +omit [Fintype H] [DecidableEq H] in +@[simp] theorem positionEquiv_shape (e : Target counts) (h : H) (i : Positions counts h) : + (positionEquiv counts e h i).1 = (e h).val i := rfl + +omit [Fintype H] [DecidableEq H] in +@[simp] theorem positionEquiv_symm_shape (e : Target counts) (h : H) + (i : Σ u, Fin (counts h u)) : + (e h).val ((positionEquiv counts e h).symm i) = i.1 := by + have hh := congrArg Sigma.fst ((positionEquiv counts e h).apply_symm_apply i) + simpa only [positionEquiv_shape] using hh + +abbrev ClassKey := H × Shape +abbrev ClassPositions (c : ClassKey (H := H)) := Fin (counts c.1 c.2) + +variable (L R : H → Type*) + +abbrev RawPairs := ∀ h, Positions counts h → L h × R h +abbrev CanonicalPairs := CompleteWordPair (ClassPositions counts) + (fun c => L c.1) (fun c => R c.1) + +def pairEquiv (e : Target counts) : RawPairs counts L R ≃ CanonicalPairs counts L R where + toFun w := + { left := fun c j => (w c.1 ((positionEquiv counts e c.1).symm ⟨c.2, j⟩)).1 + right := fun c j => (w c.1 ((positionEquiv counts e c.1).symm ⟨c.2, j⟩)).2 } + invFun w := fun h i => + (w.left (h, (e h).val i) (positionEquiv counts e h i).2, + w.right (h, (e h).val i) (positionEquiv counts e h i).2) + left_inv w := by + funext h i + change ((w h ((positionEquiv counts e h).symm + (positionEquiv counts e h i))).1, + (w h ((positionEquiv counts e h).symm (positionEquiv counts e h i))).2) = w h i + simp + right_inv w := by + cases w with + | mk wl wr => + dsimp only + congr 1 <;> funext c j + · exact congrArg (β := L c.1) + (fun p : Σ u, Fin (counts c.1 u) => wl (c.1, p.1) p.2) + ((positionEquiv counts e c.1).apply_symm_apply ⟨c.2, j⟩) + · exact congrArg (β := R c.1) + (fun p : Σ u, Fin (counts c.1 u) => wr (c.1, p.1) p.2) + ((positionEquiv counts e c.1).apply_symm_apply ⟨c.2, j⟩) + +omit [Fintype H] [DecidableEq H] in +theorem pairEquiv_fiber_left (e : Target counts) (w : RawPairs counts L R) + (h : H) (u : Shape) (j : Fin (counts h u)) : + (pairEquiv counts L R e w).left (h, u) j = + (w h ((fiberEquiv counts e h u).symm j).val).1 := rfl + +omit [Fintype H] [DecidableEq H] in +theorem pairEquiv_fiber_right (e : Target counts) (w : RawPairs counts L R) + (h : H) (u : Shape) (j : Fin (counts h u)) : + (pairEquiv counts L R e w).right (h, u) j = + (w h ((fiberEquiv counts e h u).symm j).val).2 := rfl + +theorem typeWindow_reindex {P Q A : Type*} + [Fintype P] [Fintype Q] [DecidableEq P] [DecidableEq Q] + [Fintype A] [DecidableEq A] + (ν : A → ℝ) (η : ℝ) (w : P → A) (p : Q ≃ P) : + typeWindow ν η (w ∘ p) ↔ typeWindow ν η w := by + simp only [typeWindow, empiricalLaw, wordPopulation_reindex, Fintype.card_congr p] + +section Windows + +variable {SL SR : H → Type*} + [∀ h, Fintype (SL h)] [∀ h, Fintype (SR h)] + [∀ h, DecidableEq (SL h)] [∀ h, DecidableEq (SR h)] + (sl : ∀ c : ClassKey (H := H), L c.1 → SL c.1) + (sr : ∀ c : ClassKey (H := H), R c.1 → SR c.1) + (νl : ∀ c : ClassKey (H := H), SL c.1 → ℝ) + (νr : ∀ c : ClassKey (H := H), SR c.1 → ℝ) + (ηl ηr : ClassKey (H := H) → ℝ) + +def activeLaw {S : H → Type*} (ν : ∀ c : ClassKey (H := H), S c.1 → ℝ) + (c : ClassKey (H := H)) : S c.1 → ℝ := + fun a => if 0 < counts c.1 c.2 then ν c a else 0 + +def activeWidth (η : ClassKey (H := H) → ℝ) (c : ClassKey (H := H)) : ℝ := + if 0 < counts c.1 c.2 then η c else 0 + +omit [Fintype H] [DecidableEq H] in +theorem activeLaw_of_pos {S : H → Type*} + (ν : ∀ c : ClassKey (H := H), S c.1 → ℝ) (c : ClassKey (H := H)) + (hc : 0 < counts c.1 c.2) : activeLaw counts ν c = ν c := by + funext a + simp [activeLaw, hc] + +def rawWindows (e : Target counts) (w : RawPairs counts L R) : Prop := + ∀ h u, 0 < counts h u → + typeWindow (νl (h, u)) (ηl (h, u)) + (fun i : Class counts e h u => sl (h, u) (w h i.val).1) ∧ + typeWindow (νr (h, u)) (ηr (h, u)) + (fun i : Class counts e h u => sr (h, u) (w h i.val).2) + +omit [Fintype H] [DecidableEq H] in +theorem rawWindows_iff_childWindows (e : Target counts) (w : RawPairs counts L R) : + rawWindows counts L R sl sr νl νr ηl ηr e w ↔ + childWindows sl sr (activeLaw counts νl) (activeLaw counts νr) + (activeWidth counts ηl) (activeWidth counts ηr) (pairEquiv counts L R e w) := by + unfold rawWindows childWindows + conv_rhs => rw [Prod.forall] + apply forall_congr' + intro h + apply forall_congr' + intro u + by_cases hp : 0 < counts h u + · simp only [hp, true_implies, activeLaw_of_pos counts _ (h, u) hp, + activeWidth] + change (_ ∧ _) ↔ + (typeWindow (νl (h, u)) (ηl (h, u)) + ((fun i : Class counts e h u => sl (h, u) (w h i.val).1) ∘ + (fiberEquiv counts e h u).symm) ∧ + typeWindow (νr (h, u)) (ηr (h, u)) + ((fun i : Class counts e h u => sr (h, u) (w h i.val).2) ∘ + (fiberEquiv counts e h u).symm)) + rw [typeWindow_reindex, typeWindow_reindex] + · have hn : counts h u = 0 := Nat.eq_zero_of_not_pos hp + simp only [hp, false_implies, true_iff] + simp only [activeLaw, activeWidth, typeWindow, empiricalLaw, ClassPositions, + Fintype.card_fin, hn, Nat.cast_zero, div_zero] + simp + +end Windows + +section Coefficients + +variable {F : Type*} [CommSemiring F] + (T : ∀ h, Tensor F (L h × R h) (L h × R h) (L h × R h)) + (coarse : Fin 3 → ∀ h, L h × R h → Fin 17) + +def coarseMask (s : Fin 3) (e : Target counts) (w : RawPairs counts L R) : Prop := + ∀ h i, coarse s h (w h i) = shapeSide s ((e h).val i) + +def coarseWord (s : Fin 3) (w : RawPairs counts L R) : Position counts → Fin 17 := + fun p => coarse s p.1 (w p.1 p.2) + +def sourceTensor : Tensor F (RawPairs counts L R) (RawPairs counts L R) + (RawPairs counts L R) := classProduct T + +def coarseIdeal (e : Target counts) : Tensor F (RawPairs counts L R) + (RawPairs counts L R) (RawPairs counts L R) := + ExactRecovery.delete (sourceTensor counts L R T) + (coarseMask counts L R coarse 0 e) (coarseMask counts L R coarse 1 e) + (coarseMask counts L R coarse 2 e) + +def block (c : ClassKey (H := H)) : + Tensor F (L c.1 × R c.1) (L c.1 × R c.1) (L c.1 × R c.1) := + fun x y z => if coarse 0 c.1 x = c.2.1 ∧ coarse 1 c.1 y = c.2.2.1 ∧ + coarse 2 c.1 z = c.2.2.2 then T c.1 x y z else 0 + +def canonicalBase : Tensor F (CanonicalPairs counts L R) (CanonicalPairs counts L R) + (CanonicalPairs counts L R) := + fun x y z => ∏ c, ∏ j, block L R T coarse c + (x.left c j, x.right c j) (y.left c j, y.right c j) (z.left c j, z.right c j) + +omit [DecidableEq H] in +theorem product_pack (e : Target counts) + (f : ∀ h, Shape → (L h × R h) → (L h × R h) → (L h × R h) → F) + (x y z : RawPairs counts L R) : + (∏ c : ClassKey (H := H), ∏ j : ClassPositions counts c, + f c.1 c.2 + ((pairEquiv counts L R e x).left c j, (pairEquiv counts L R e x).right c j) + ((pairEquiv counts L R e y).left c j, (pairEquiv counts L R e y).right c j) + ((pairEquiv counts L R e z).left c j, (pairEquiv counts L R e z).right c j)) = + ∏ h, ∏ i, f h ((e h).val i) (x h i) (y h i) (z h i) := by + rw [Fintype.prod_prod_type] + apply Finset.prod_congr rfl + intro h _ + rw [← Fintype.prod_sigma'] + apply Fintype.prod_equiv (positionEquiv counts e h).symm + intro i + simp only [pairEquiv, Equiv.coe_fn_mk, Prod.mk.eta, positionEquiv_symm_shape] + +omit [DecidableEq H] in +theorem coarseIdeal_eq_canonicalBase (e : Target counts) (x y z : RawPairs counts L R) : + coarseIdeal counts L R T coarse e x y z = canonicalBase counts L R T coarse + (pairEquiv counts L R e x) (pairEquiv counts L R e y) (pairEquiv counts L R e z) := by + unfold canonicalBase + rw [product_pack counts L R e (fun h u => block L R T coarse (h, u))] + simp [block, Fintype.prod_ite_zero, coarseIdeal, ExactRecovery.delete, + sourceTensor, classProduct, coarseMask, shapeSide, Fin.isValue, ↓reduceIte, + forall_and] + +def coordinateMatrix (e : Target counts) : + CanonicalPairs counts L R → RawPairs counts L R → F := + fun w v => if v = (pairEquiv counts L R e).symm w then 1 else 0 + +theorem coordinateMatrix_restrict + [∀ h, Fintype (L h)] [∀ h, Fintype (R h)] + (e : Target counts) (Q : Tensor F (RawPairs counts L R) (RawPairs counts L R) + (RawPairs counts L R)) (x y z : CanonicalPairs counts L R) : + Tensor.restrict (coordinateMatrix counts L R e) (coordinateMatrix counts L R e) + (coordinateMatrix counts L R e) Q x y z = + Q ((pairEquiv counts L R e).symm x) ((pairEquiv counts L R e).symm y) + ((pairEquiv counts L R e).symm z) := by + classical + simp [Tensor.restrict, coordinateMatrix, ite_mul, mul_ite] + +theorem coarseIdeal_restrict + [∀ h, Fintype (L h)] [∀ h, Fintype (R h)] (e : Target counts) : + Tensor.restrict (coordinateMatrix counts L R e) (coordinateMatrix counts L R e) + (coordinateMatrix counts L R e) (coarseIdeal counts L R T coarse e) = + canonicalBase counts L R T coarse := by + funext x y z + rw [coordinateMatrix_restrict, coarseIdeal_eq_canonicalBase] + simp + +omit [DecidableEq H] in +theorem canonicalBase_eq_pairClassProduct + (TL : ∀ c : ClassKey (H := H), Tensor F (L c.1) (L c.1) (L c.1)) + (TR : ∀ c : ClassKey (H := H), Tensor F (R c.1) (R c.1) (R c.1)) + (hblock : ∀ c, block L R T coarse c = Tensor.product (TL c) (TR c)) : + canonicalBase counts L R T coarse = pairClassProduct TL TR := by + funext x y z + simp only [canonicalBase, hblock, Tensor.product, pairClassProduct, classProduct, + Finset.prod_mul_distrib] + +section ChildWindows + +variable {SL SR : H → Type*} + [∀ h, Fintype (SL h)] [∀ h, Fintype (SR h)] + [∀ h, DecidableEq (SL h)] [∀ h, DecidableEq (SR h)] + (sl : Fin 3 → ∀ c : ClassKey (H := H), L c.1 → SL c.1) + (sr : Fin 3 → ∀ c : ClassKey (H := H), R c.1 → SR c.1) + (νl : Fin 3 → ∀ c : ClassKey (H := H), SL c.1 → ℝ) + (νr : Fin 3 → ∀ c : ClassKey (H := H), SR c.1 → ℝ) + (ηl ηr : Fin 3 → ClassKey (H := H) → ℝ) + +def ideal (e : Target counts) : Tensor F (RawPairs counts L R) + (RawPairs counts L R) (RawPairs counts L R) := + ExactRecovery.delete (coarseIdeal counts L R T coarse e) + (rawWindows counts L R (sl 0) (sr 0) (νl 0) (νr 0) (ηl 0) (ηr 0) e) + (rawWindows counts L R (sl 1) (sr 1) (νl 1) (νr 1) (ηl 1) (ηr 1) e) + (rawWindows counts L R (sl 2) (sr 2) (νl 2) (νr 2) (ηl 2) (ηr 2) e) + +def canonicalIdeal : Tensor F (CanonicalPairs counts L R) (CanonicalPairs counts L R) + (CanonicalPairs counts L R) := + ExactRecovery.delete (canonicalBase counts L R T coarse) + (childWindows (sl 0) (sr 0) (activeLaw counts (νl 0)) (activeLaw counts (νr 0)) + (activeWidth counts (ηl 0)) (activeWidth counts (ηr 0))) + (childWindows (sl 1) (sr 1) (activeLaw counts (νl 1)) (activeLaw counts (νr 1)) + (activeWidth counts (ηl 1)) (activeWidth counts (ηr 1))) + (childWindows (sl 2) (sr 2) (activeLaw counts (νl 2)) (activeLaw counts (νr 2)) + (activeWidth counts (ηl 2)) (activeWidth counts (ηr 2))) + +def usefulByTriple (s : Fin 3) + (t : JointCoarseHashing.Triple (Position counts)) (w : RawPairs counts L R) : Prop := + ∃ e : Target counts, triple counts e = t ∧ + rawWindows counts L R (sl s) (sr s) (νl s) (νr s) (ηl s) (ηr s) e w + +omit [Fintype H] [DecidableEq H] [∀ h, Fintype (SL h)] [∀ h, Fintype (SR h)] in +theorem usefulByTriple_target (s : Fin 3) (e : Target counts) (w : RawPairs counts L R) : + usefulByTriple counts L R sl sr νl νr ηl ηr s (triple counts e) w ↔ + rawWindows counts L R (sl s) (sr s) (νl s) (νr s) (ηl s) (ηr s) e w := by + constructor + · rintro ⟨f, hf, hw⟩ + have he : f = e := triple_injective counts hf + subst f + exact hw + · intro hw + exact ⟨e, rfl, hw⟩ + +omit [DecidableEq H] [∀ h, Fintype (SL h)] [∀ h, Fintype (SR h)] in +theorem ideal_eq_jointIdeal (e : Target counts) : + ideal counts L R T coarse sl sr νl νr ηl ηr e = + JointIdealBranches.ideal (sourceTensor counts L R T) + (coarseWord counts L R coarse 0) (coarseWord counts L R coarse 1) + (coarseWord counts L R coarse 2) + (usefulByTriple counts L R sl sr νl νr ηl ηr 0) + (usefulByTriple counts L R sl sr νl νr ηl ηr 1) + (usefulByTriple counts L R sl sr νl νr ηl ηr 2) (triple counts e) := by + funext x y z + have hx : coarseWord counts L R coarse 0 x = (triple counts e).1 ↔ + coarseMask counts L R coarse 0 e x := by + simp [coarseWord, triple, coarseMask, shapeSide, funext_iff, Sigma.forall] + have hy : coarseWord counts L R coarse 1 y = (triple counts e).2.1 ↔ + coarseMask counts L R coarse 1 e y := by + simp [coarseWord, triple, coarseMask, shapeSide, funext_iff, Sigma.forall] + have hz : coarseWord counts L R coarse 2 z = (triple counts e).2.2 ↔ + coarseMask counts L R coarse 2 e z := by + simp [coarseWord, triple, coarseMask, shapeSide, funext_iff, Sigma.forall] + simp only [ideal, coarseIdeal, JointIdealBranches.ideal, ExactRecovery.delete, + usefulByTriple_target, hx, hy, hz] + split_ifs <;> simp_all + +omit [DecidableEq H] in +theorem ideal_eq_canonicalIdeal (e : Target counts) + (x y z : RawPairs counts L R) : + ideal counts L R T coarse sl sr νl νr ηl ηr e x y z = + canonicalIdeal counts L R T coarse sl sr νl νr ηl ηr + (pairEquiv counts L R e x) (pairEquiv counts L R e y) + (pairEquiv counts L R e z) := by + simp only [ideal, canonicalIdeal, ExactRecovery.delete, rawWindows_iff_childWindows, + coarseIdeal_eq_canonicalBase] + +theorem ideal_restrict + [∀ h, Fintype (L h)] [∀ h, Fintype (R h)] (e : Target counts) : + Tensor.restrict (coordinateMatrix counts L R e) (coordinateMatrix counts L R e) + (coordinateMatrix counts L R e) (ideal counts L R T coarse sl sr νl νr ηl ηr e) = + canonicalIdeal counts L R T coarse sl sr νl νr ηl ηr := by + funext x y z + rw [coordinateMatrix_restrict] + simp only [ideal, canonicalIdeal, ExactRecovery.delete, rawWindows_iff_childWindows, + coarseIdeal_eq_canonicalBase, Equiv.apply_symm_apply] + +end ChildWindows + +end Coefficients + +end MatrixMultiplication.JointCanonicalization + + + + + + +namespace MatrixMultiplication.JointAssignmentLoss + +open JointExtraction JointCoarseAssignment + +attribute [local instance] Classical.propDecidable + +variable {A B C I V Ω : Type*} + +theorem uniqueAssignment_of_unique (candidates : Finset I) + (compatible : I → V → Prop) (v : V) (i : I) + (hi : i ∈ candidates) (hc : compatible i v) + (hu : ∀ j, j ∈ candidates → compatible j v → j = i) : + uniqueAssignment candidates compatible v = some i := by + classical + have hex : ∃ j, j ∈ candidates ∧ compatible j v ∧ + ∀ k, k ∈ candidates → compatible k v → k = j := ⟨i, hi, hc, hu⟩ + unfold uniqueAssignment + rw [dite_eq_left hex] + exact congrArg some (hu _ (Classical.choose_spec hex).1 (Classical.choose_spec hex).2.1) + +theorem assignUseful_of_unique (candidates : Finset I) + (compatible useful : I → V → Prop) (v : V) (i : I) + (hi : i ∈ candidates) (hc : compatible i v) (huse : useful i v) + (hu : ∀ j, j ∈ candidates → compatible j v → j = i) : + assignUseful candidates compatible useful v = some i := by + have hassign := uniqueAssignment_of_unique candidates compatible v i hi hc hu + have hkeep : ∃ j, uniqueAssignment candidates compatible v = some j ∧ useful j v := + ⟨i, hassign, huse⟩ + simp only [assignUseful, retainAssignment, ite_eq_left hkeep] + exact hassign + +def ambientXCollision (ambient : Finset (Triple A B C)) + (hx : A → Prop) (hy : B → Prop) (hz : C → Prop) (e : Triple A B C) : Prop := + ∃ f ∈ ambient, f ≠ e ∧ survives hx hy hz f ∧ f.1 = e.1 + +def targetCompatibleCollision (targets : Finset (Triple A B C)) + (hx : A → Prop) (hy : B → Prop) (hz : C → Prop) + (compatible : Triple A B C → V → Prop) (e : Triple A B C) (v : V) : Prop := + ∃ f ∈ targets, f ≠ e ∧ survives hx hy hz f ∧ compatible f v + +theorem eligible_of_no_ambientXCollision + (ambient targets : Finset (Triple A B C)) + (hx : A → Prop) (hy : B → Prop) (hz : C → Prop) (e : Triple A B C) + (ha : e ∈ ambient) (ht : e ∈ targets) (hs : survives hx hy hz e) + (hno : ¬ ambientXCollision ambient hx hy hz e) : + e ∈ eligible ambient targets hx hy hz := by + apply (mem_eligible_iff ambient targets hx hy hz e).2 + refine ⟨ha, ht, hs, ?_⟩ + intro f hf hfs hfx + by_contra hne + exact hno ⟨f, hf, hne, hfs, hfx⟩ + +theorem not_eligible_iff_ambientXCollision + (ambient targets : Finset (Triple A B C)) + (hx : A → Prop) (hy : B → Prop) (hz : C → Prop) (e : Triple A B C) + (ha : e ∈ ambient) (ht : e ∈ targets) (hs : survives hx hy hz e) : + e ∉ eligible ambient targets hx hy hz ↔ ambientXCollision ambient hx hy hz e := by + constructor + · intro h + by_contra hno + exact h (eligible_of_no_ambientXCollision ambient targets hx hy hz e ha ht hs hno) + · rintro ⟨f, hf, hne, hfs, hfx⟩ he + exact hne (((mem_eligible_iff ambient targets hx hy hz e).1 he).2.2.2 f hf hfs hfx) + +theorem assignUseful_of_no_targetCollision + (ambient targets : Finset (Triple A B C)) + (hx : A → Prop) (hy : B → Prop) (hz : C → Prop) + (compatible useful : Triple A B C → V → Prop) (e : Triple A B C) (v : V) + (he : e ∈ eligible ambient targets hx hy hz) + (hc : compatible e v) (hu : useful e v) + (hno : ¬ targetCompatibleCollision targets hx hy hz compatible e v) : + assignUseful (eligible ambient targets hx hy hz) compatible useful v = some e := by + apply assignUseful_of_unique _ _ _ _ _ he hc hu + intro f hf hcf + have hfe := (mem_eligible_iff ambient targets hx hy hz f).1 hf + by_contra hne + exact hno ⟨f, hfe.2.1, hne, hfe.2.2.1, hcf⟩ + +theorem assignment_failure_implies_collision + (ambient targets : Finset (Triple A B C)) + (hx : A → Prop) (hy : B → Prop) (hz : C → Prop) + (compatible useful : Triple A B C → V → Prop) (e : Triple A B C) (v : V) + (ha : e ∈ ambient) (ht : e ∈ targets) (hs : survives hx hy hz e) + (hc : compatible e v) (hu : useful e v) + (hfail : assignUseful (eligible ambient targets hx hy hz) compatible useful v ≠ some e) : + ambientXCollision ambient hx hy hz e ∨ + targetCompatibleCollision targets hx hy hz compatible e v := by + by_cases hX : ambientXCollision ambient hx hy hz e + · exact Or.inl hX + apply Or.inr + by_contra hC + have he := eligible_of_no_ambientXCollision ambient targets hx hy hz e ha ht hs hX + exact hfail (assignUseful_of_no_targetCollision ambient targets hx hy hz + compatible useful e v he hc hu hC) + +theorem retained_assignment_of_no_collision + (ambient targets : Finset (Triple A B C)) + (hx : A → Prop) (hy : B → Prop) (hz : C → Prop) + (compatible useful : Triple A B C → V → Prop) (keep : V → Prop) + (e : Triple A B C) (v : V) + (ha : e ∈ ambient) (ht : e ∈ targets) (hs : survives hx hy hz e) + (hc : compatible e v) (hu : useful e v) (hk : keep v) + (hX : ¬ ambientXCollision ambient hx hy hz e) + (hC : ¬ targetCompatibleCollision targets hx hy hz compatible e v) : + retainAssignment (assignUseful (eligible ambient targets hx hy hz) compatible useful) + keep v = some e := by + have he := eligible_of_no_ambientXCollision ambient targets hx hy hz e ha ht hs hX + have hassign := assignUseful_of_no_targetCollision ambient targets hx hy hz + compatible useful e v he hc hu hC + simpa only [retainAssignment, ite_eq_left hk] using hassign + +theorem passing_assignment_failure_subset + (samples : Finset Ω) (ambient targets : Finset (Triple A B C)) + (hx : Ω → A → Prop) (hy : Ω → B → Prop) (hz : Ω → C → Prop) + (compatible useful : Triple A B C → V → Prop) (keep : V → Prop) + (e : Triple A B C) (v : V) (ha : e ∈ ambient) (ht : e ∈ targets) + (hc : compatible e v) (hu : useful e v) (hk : keep v) : + samples.filter (fun ω => survives (hx ω) (hy ω) (hz ω) e ∧ + retainAssignment + (assignUseful (eligible ambient targets (hx ω) (hy ω) (hz ω)) compatible useful) + keep v ≠ some e) ⊆ + samples.filter (fun ω => survives (hx ω) (hy ω) (hz ω) e ∧ + (ambientXCollision ambient (hx ω) (hy ω) (hz ω) e ∨ + targetCompatibleCollision targets (hx ω) (hy ω) (hz ω) compatible e v)) := by + intro ω hω + obtain ⟨hωs, hs, hfail⟩ := Finset.mem_filter.1 hω + apply Finset.mem_filter.2 + refine ⟨hωs, hs, ?_⟩ + have hfail' : assignUseful (eligible ambient targets (hx ω) (hy ω) (hz ω)) + compatible useful v ≠ some e := by + simpa only [retainAssignment, ite_eq_left hk] using hfail + exact assignment_failure_implies_collision ambient targets (hx ω) (hy ω) (hz ω) + compatible useful e v ha ht hs hc hu hfail' + +end MatrixMultiplication.JointAssignmentLoss + + + + + + +namespace MatrixMultiplication.JointMaskedSelection.OrbitData + +open JointCoarseHashing + +attribute [local instance] Classical.propDecidable + +variable {P E O V : Type*} [Fintype P] [Fintype E] + +def actualTargets (d : OrbitData P E O V) : Finset (Triple P) := + Finset.univ.image d.coarse + +theorem coarse_mem_actualTargets (d : OrbitData P E O V) (e : E) : + d.coarse e ∈ d.actualTargets := + Finset.mem_image.mpr ⟨e, Finset.mem_univ e, rfl⟩ + +def xFlag (k : ℕ) (U : Finset (ZMod (37 ^ k))) (s : Sample P k) (I : Word P) : Prop := + JointHashing.xHash s (castWord k I) ∈ U + +def yFlag (k : ℕ) (U : Finset (ZMod (37 ^ k))) (s : Sample P k) (J : Word P) : Prop := + JointHashing.yHash s (castWord k J) ∈ U + +def zFlag (d : OrbitData P E O V) (k : ℕ) (U : Finset (ZMod (37 ^ k))) + (s : Sample P k) (K : Word P) : Prop := + JointHashing.zHash (twoUnit k) s (fun p => (d.support p : ZMod (37 ^ k))) (castWord k K) ∈ U + +omit [Fintype E] in +theorem actual_survival_iff (d : OrbitData P E O V) (k : ℕ) + (U : Finset (ZMod (37 ^ k))) + (hAP : ∀ x ∈ U, ∀ y ∈ U, ∀ z ∈ U, x + y = 2 * z → x = z ∧ y = z) + (s : Sample P k) (f : Triple P) (hf : f ∈ d.ambient) : + JointCoarseAssignment.survives (xFlag k U s) (yFlag k U s) (d.zFlag k U s) f ↔ + Survives k U f s := + full_survival_iff k U hAP d.support f (d.support_ambient f hf) s + +def actualEligible (d : OrbitData P E O V) (k : ℕ) (U : Finset (ZMod (37 ^ k))) + (s : Sample P k) : Finset (Triple P) := + JointCoarseAssignment.eligible d.ambient d.actualTargets + (xFlag k U s) (yFlag k U s) (d.zFlag k U s) + +theorem good_mem_actualEligible (d : OrbitData P E O V) (k : ℕ) + (U : Finset (ZMod (37 ^ k))) + (hAP : ∀ x ∈ U, ∀ y ∈ U, ∀ z ∈ U, x + y = 2 * z → x = z ∧ y = z) + (N : ℝ) (e : E) (s : Sample P k) (hg : d.Good k U N e s) : + d.coarse e ∈ d.actualEligible k U s := by + apply JointAssignmentLoss.eligible_of_no_ambientXCollision d.ambient d.actualTargets + (xFlag k U s) (yFlag k U s) (d.zFlag k U s) (d.coarse e) + (d.target_mem e) (d.coarse_mem_actualTargets e) + ((d.actual_survival_iff k U hAP s _ (d.target_mem e)).2 hg.1) + rintro ⟨f, hf, hne, hs, hx⟩ + exact d.good_eligibility k U N e s hg + ⟨f, (d.mem_eligibilityCompetitors e f).2 ⟨hf, hne, hx⟩, + (d.actual_survival_iff k U hAP s f hf).1 hs⟩ + +def actualAssignment (d : OrbitData P E O V) (k : ℕ) (U : Finset (ZMod (37 ^ k))) + (compatible useful : Triple P → V → Prop) (keep : V → Prop) + (s : Sample P k) (v : V) : Option (Triple P) := + JointExtraction.retainAssignment + (JointCoarseAssignment.assignUseful (d.actualEligible k U s) compatible useful) keep v + +theorem model_retained_assigned (d : OrbitData P E O V) (k : ℕ) + (U : Finset (ZMod (37 ^ k))) + (hAP : ∀ x ∈ U, ∀ y ∈ U, ∀ z ∈ U, x + y = 2 * z → x = z ∧ y = z) + (N : ℝ) (e : E) (o : O) (ho : o ∈ d.orbits e) (s : Sample P k) + (hg : d.Good k U N e s) + (compatible useful : Triple P → V → Prop) (keep : V → Prop) + (v : V) (hv : v ∈ JointLossCounts.retained (d.passing e o) (d.variableBad k U e o) s) + (hc : compatible (d.coarse e) v) (hu : useful (d.coarse e) v) (hk : keep v) + (hcover : ∀ f ∈ d.actualTargets, f ≠ d.coarse e → compatible f v → + f ∈ d.competitors e o v) : + d.actualAssignment k U compatible useful keep s v = some (d.coarse e) := by + obtain ⟨hpass, hnotbad⟩ := Finset.mem_filter.1 hv + have hassign := JointAssignmentLoss.assignUseful_of_no_targetCollision + d.ambient d.actualTargets (xFlag k U s) (yFlag k U s) (d.zFlag k U s) + compatible useful (d.coarse e) v (d.good_mem_actualEligible k U hAP N e s hg) hc hu + (by + rintro ⟨f, hf, hne, hsurv, hcomp⟩ + have hfc := hcover f hf hne hcomp + have hfa := d.competitor_mem e o ho v hpass f hfc + exact hnotbad ⟨f, hfc, (d.actual_survival_iff k U hAP s f hfa).1 hsurv⟩) + simpa only [actualAssignment, actualEligible, JointExtraction.retainAssignment, + ite_eq_left hk] using hassign + +theorem actual_failure_subset_model_missing (d : OrbitData P E O V) (k : ℕ) + (U : Finset (ZMod (37 ^ k))) + (hAP : ∀ x ∈ U, ∀ y ∈ U, ∀ z ∈ U, x + y = 2 * z → x = z ∧ y = z) + (N : ℝ) (e : E) (o : O) (ho : o ∈ d.orbits e) (s : Sample P k) + (hg : d.Good k U N e s) + (compatible useful : Triple P → V → Prop) (keep : V → Prop) + (hc : ∀ v ∈ d.passing e o, compatible (d.coarse e) v) + (hu : ∀ v ∈ d.passing e o, useful (d.coarse e) v) + (hk : ∀ v ∈ d.passing e o, keep v) + (hcover : ∀ v ∈ d.passing e o, ∀ f ∈ d.actualTargets, + f ≠ d.coarse e → compatible f v → f ∈ d.competitors e o v) : + (d.full e o).filter (fun v => d.actualAssignment k U compatible useful keep s v ≠ + some (d.coarse e)) ⊆ + d.full e o \ JointLossCounts.retained (d.passing e o) (d.variableBad k U e o) s := by + intro v hv + obtain ⟨hvfull, hvfail⟩ := Finset.mem_filter.1 hv + apply Finset.mem_sdiff.2 + refine ⟨hvfull, ?_⟩ + intro hvmodel + have hpass := (Finset.mem_filter.1 hvmodel).1 + exact hvfail (d.model_retained_assigned k U hAP N e o ho s hg compatible useful keep v + hvmodel (hc v hpass) (hu v hpass) (hk v hpass) (hcover v hpass)) + +theorem good_actual_missingFraction_le (d : OrbitData P E O V) (k : ℕ) + (U : Finset (ZMod (37 ^ k))) + (hAP : ∀ x ∈ U, ∀ y ∈ U, ∀ z ∈ U, x + y = 2 * z → x = z ∧ y = z) + (C₀ N : ℝ) (e : E) (o : O) (ho : o ∈ d.orbits e) (s : Sample P k) + (hg : d.Good k U N e s) + (compatible useful : Triple P → V → Prop) (keep : V → Prop) + (hc : ∀ v ∈ d.passing e o, compatible (d.coarse e) v) + (hu : ∀ v ∈ d.passing e o, useful (d.coarse e) v) + (hk : ∀ v ∈ d.passing e o, keep v) + (hcover : ∀ v ∈ d.passing e o, ∀ f ∈ d.actualTargets, + f ≠ d.coarse e → compatible f v → f ∈ d.competitors e o v) + (hdet : ∀ o ∈ d.orbits e, + JointLossCounts.deterministicLossFraction (d.full e o) (d.passing e o) ≤ C₀ / N) : + (((d.full e o).filter (fun v => d.actualAssignment k U compatible useful keep s v ≠ + some (d.coarse e))).card : ℝ) / ((d.full e o).card : ℝ) ≤ (C₀ + 1) / N := by + have hcard := Finset.card_le_card + (d.actual_failure_subset_model_missing k U hAP N e o ho s hg compatible useful keep hc hu hk hcover) + have hR : (((d.full e o).filter (fun v => d.actualAssignment k U compatible useful keep s v ≠ + some (d.coarse e))).card : ℝ) ≤ + ((d.full e o \ JointLossCounts.retained (d.passing e o) (d.variableBad k U e o) s).card : ℝ) := by + exact_mod_cast hcard + exact (div_le_div_of_nonneg_right hR (Nat.cast_nonneg _)).trans + (d.good_missingFraction_le k U C₀ N e s hg hdet o ho) + +end MatrixMultiplication.JointMaskedSelection.OrbitData + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/Construction/OrderedLimits.lean b/lean/OAI/LinearAlgebra/MatrixFields/Construction/OrderedLimits.lean new file mode 100644 index 0000000000000000000000000000000000000000..ac256d024c2f4aa1dac610f867ba1ff7ce9cad76 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/Construction/OrderedLimits.lean @@ -0,0 +1,1283 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Arithmetic.MatrixMapDecidable +import OAI.LinearAlgebra.MatrixFields.Construction.FinalState +import OAI.LinearAlgebra.MatrixFields.Construction.ZeroFinish +import OAI.LinearAlgebra.MatrixFields.Entropy.ConstructionRates +import OAI.LinearAlgebra.MatrixFields.Entropy.RateLimit +import OAI.LinearAlgebra.MatrixFields.Histories.HistoryIteration + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section + +namespace MatrixMultiplication.AllFieldInitialChoice + +open MatrixMultiplication.Foundation AllFieldHistory AllFieldFiniteFamily Filter +open scoped BigOperators Topology Classical + +variable {K : ℕ} + +structure Choice (allocation : Allocation) (m : ℕ) (δ : ℝ) where + sample : AllFieldInitialFamily.Sample (K := K) allocation + (δ / (AllFieldInitialFamily.grid (K := K) allocation : ℝ)) m + selected : Finset (JointPopulation.Target (initialJointCounts (K := K) allocation m)) + card_selected : selected.card = AllFieldConstructionRates.initialCount (K := K) allocation δ m + good : ∀ e ∈ selected, AllFieldInitialFamily.Good allocation + (δ / (AllFieldInitialFamily.grid (K := K) allocation : ℝ)) m sample e + +theorem initial_count_eq (allocation : Allocation) (m : ℕ) (δ : ℝ) : + ⌊Real.exp ((populationLength (K := K) allocation m : ℝ) * + ((K : ℝ) * AllFieldInitialEntropy.nativeH0 - + δ / (AllFieldInitialFamily.grid (K := K) allocation : ℝ)))⌋₊ = + AllFieldConstructionRates.initialCount (K := K) allocation δ m := by + rw [AllFieldConstructionRates.initialCount_eq, + AllFieldInitialFamily.populationLength_eq_mul_grid, Nat.cast_mul] + congr 2 + change ((m : ℝ) * (AllFieldInitialFamily.grid (K := K) allocation : ℝ)) * + ((K : ℝ) * AllFieldInitialEntropy.nativeH0 - + δ / (AllFieldInitialFamily.grid (K := K) allocation : ℝ)) = + (m : ℝ) * ((AllFieldInitialFamily.grid (K := K) allocation : ℝ) * + ((K : ℝ) * AllFieldInitialEntropy.nativeH0) - δ) + have hD : (AllFieldInitialFamily.grid (K := K) allocation : ℝ) ≠ 0 := + Nat.cast_ne_zero.mpr (AllFieldInitialFamily.grid_pos allocation).ne' + field_simp [hD] + +theorem eventually_nonempty (allocation : Allocation) {δ : ℝ} (hδ : 0 < δ) : + ∀ᶠ m : ℕ in atTop, Nonempty (Choice (K := K) allocation m δ) := by + have hs : 0 < δ / (AllFieldInitialFamily.grid (K := K) allocation : ℝ) := + div_pos hδ (Nat.cast_pos.mpr (AllFieldInitialFamily.grid_pos allocation)) + have h := AllFieldInitialFamily.eventually_exists_execution_with_width + (K := K) allocation ℚ 0 hs + filter_upwards [h] with m hm + obtain ⟨sample, selected, hcard, hgood, _execution⟩ := hm + exact ⟨{ + sample := sample + selected := selected + card_selected := hcard.trans (initial_count_eq allocation m δ) + good := hgood }⟩ + +abbrev Tags (allocation : Allocation) (m : ℕ) (δ : ℝ) + (choice : Choice (K := K) allocation m δ) := + AllFieldInitialHash.SelectedTargets (initialJointCounts (K := K) allocation m) + choice.selected + +@[simp] theorem card_tags (allocation : Allocation) (m : ℕ) (δ : ℝ) + (choice : Choice (K := K) allocation m δ) : + Fintype.card (Tags allocation m δ choice) = + AllFieldConstructionRates.initialCount (K := K) allocation δ m := by + rw [AllFieldInitialHash.selectedTargets_card] + exact choice.card_selected + +def execution (allocation : Allocation) (m : ℕ) (δ : ℝ) + (choice : Choice (K := K) allocation m δ) (F : Type*) [Field F] (ε : ℝ) : + Execution (cwSource F K (populationLength (K := K) allocation m)) + (Tensor.directSum (fun _ : Tags allocation m δ choice => + stateTensor F (K := K) allocation m ε 0)) := + AllFieldInitialFamily.executionWithWidth allocation F + (δ / (AllFieldInitialFamily.grid (K := K) allocation : ℝ)) ε m + choice.sample choice.selected choice.good + +@[simp] theorem execution_copies (allocation : Allocation) (m : ℕ) (δ : ℝ) + (choice : Choice (K := K) allocation m δ) (F : Type*) [Field F] (ε : ℝ) : + Fintype.card (execution allocation m δ choice F ε).Copies = 1 := rfl + +end MatrixMultiplication.AllFieldInitialChoice + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section + +namespace MatrixMultiplication.AllFieldTerminal + +open MatrixMultiplication.Foundation AllFieldFiniteFamily CommonDimensions +open scoped BigOperators Classical + +variable {F : Type*} {H : Type} [Field F] [Fintype H] + {X Y Z : H → Type} [∀ h, Fintype (X h)] [∀ h, Fintype (Y h)] [∀ h, Fintype (Z h)] + (T : ∀ h, Tensor F (X h) (Y h) (Z h)) (A B C : H → Type) + [∀ h, Fintype (A h)] [∀ h, Fintype (B h)] [∀ h, Fintype (C h)] + (maps : ∀ h, LocalMap (T h) (Tensor.matrixCoefficients (A h) (B h) (C h))) + +def terminalProductMap : + LocalMap (familyProduct T) (Tensor.matrixCoefficients (∀ h, A h) (∀ h, B h) (∀ h, C h)) := + LocalMap.ofExists (TerminalProducts.matrix_restriction_of_history_restrictions + T A B C (fun h => (maps h).x) (fun h => (maps h).y) (fun h => (maps h).z) + (fun h => (maps h).coefficient)) + +variable {I : Type} [Fintype I] {K N : ℕ} + +def terminalExecution + (E : Execution (cwSource F K N) (Tensor.directSum (fun _ : I => familyProduct T))) : + Execution (cwSource F K N) + (AllFieldSource.matrixTarget F (Fintype.card (∀ h, A h)) + (Fintype.card (∀ h, B h)) (Fintype.card (∀ h, C h)) (Fintype.card I)) := + (E.restrict _ ((terminalProductMap T A B C maps).parallelCopies I)).restrict _ + (LocalMap.ofExists (TerminalRelabel.directSum_matrix_restrict_fin (K := F) + I (∀ h, A h) (∀ h, B h) (∀ h, C h))) + +@[simp] theorem terminalExecution_copies + (E : Execution (cwSource F K N) (Tensor.directSum (fun _ : I => familyProduct T))) : + Fintype.card (terminalExecution T A B C maps E).Copies = Fintype.card E.Copies := rfl + +def finish + (E : Execution (cwSource F K N) (Tensor.directSum (fun _ : I => familyProduct T))) + (hA : 0 < Fintype.card (∀ h, A h)) (hB : 0 < Fintype.card (∀ h, B h)) + (hC : 0 < Fintype.card (∀ h, C h)) (hI : 0 < Fintype.card I) : AllFieldWitness F := + (terminalExecution T A B C maps E).toWitness hA hB hC hI + +@[simp] theorem finish_multiplicity + (E : Execution (cwSource F K N) (Tensor.directSum (fun _ : I => familyProduct T))) + (hA : 0 < Fintype.card (∀ h, A h)) (hB : 0 < Fintype.card (∀ h, B h)) + (hC : 0 < Fintype.card (∀ h, C h)) (hI : 0 < Fintype.card I) : + (finish T A B C maps E hA hB hC hI).multiplicity = Fintype.card I := rfl + +theorem finish_volume + (E : Execution (cwSource F K N) (Tensor.directSum (fun _ : I => familyProduct T))) + (hA : 0 < Fintype.card (∀ h, A h)) (hB : 0 < Fintype.card (∀ h, B h)) + (hC : 0 < Fintype.card (∀ h, C h)) (hI : 0 < Fintype.card I) : + (finish T A B C maps E hA hB hC hI).volume = + ∏ h, Fintype.card (A h) * Fintype.card (B h) * Fintype.card (C h) := by + change Fintype.card (∀ h, A h) * Fintype.card (∀ h, B h) * + Fintype.card (∀ h, C h) = _ + simp only [Fintype.card_pi, Finset.prod_mul_distrib] + +@[simp] theorem finish_rankBound + (E : Execution (cwSource F K N) (Tensor.directSum (fun _ : I => familyProduct T))) + (hA : 0 < Fintype.card (∀ h, A h)) (hB : 0 < Fintype.card (∀ h, B h)) + (hC : 0 < Fintype.card (∀ h, C h)) (hI : 0 < Fintype.card I) : + (finish T A B C maps E hA hB hC hI).rankBound = + AllFieldSource.rankBudget E.Copies K N := rfl + +end MatrixMultiplication.AllFieldTerminal + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section + +namespace MatrixMultiplication.AllFieldInitialZeroFinish + +open MatrixMultiplication.Foundation AllFieldParameters AllFieldHistory AllFieldFiniteFamily +open AllFieldInitialLeafRates CWWindowedLeaves CWStrands CWZeroGeometry +open scoped BigOperators Classical + +variable {K : ℕ} + +abbrev Index (K : ℕ) := PopulationHistory K + +local instance : DecidableEq (Index K) := Classical.decEq _ + +theorem shape_total (h : InitialZero K) : shapeTotal (initialShape h.val) = 16 := + (root_shape_spec _ (initialShape_mem h.val)).2 + +theorem has_zero (h : InitialZero K) : ∃ i, initialShape h.val i = 0 := + terminal_has_zero (.initial h.val) h.property + +theorem canonical_axes_ne (h : InitialZero K) : + zeroAxis (initialShape h.val) ≠ maxAxis (initialShape h.val) := + zero_ne_selected _ _ _ (by rw [shape_total]; norm_num) + (zeroAxis_spec _ (has_zero h)) (maxAxis_spec _) + +def zero (h : Index K) : Fin 3 := h.2 (zeroAxis (initialShape h.1.val)) +def selected (h : Index K) : Fin 3 := h.2 (maxAxis (initialShape h.1.val)) + +theorem axes_ne (h : Index K) : zero h ≠ selected h := + fun he => canonical_axes_ne h.1 (h.2.injective he) + +theorem weights_sum (h : InitialZero K) : + shapeMax (initialShape h.val) + (16 - shapeMax (initialShape h.val)) = 2 * 8 := by + simpa only [shape_total h] using max_add_complement (initialShape h.val) + +theorem physical_shape_eq (h : Index K) : + physicalShape h.2 (initialShape h.1.val) = + CWOrientedZero.placedShape (zero h) (selected h) + (shapeMax (initialShape h.1.val)) (16 - shapeMax (initialShape h.1.val)) := by + simpa only [zero, selected, shape_total h.1] using + physicalShape_eq_placedShape (initialShape h.1.val) h.2 + (zeroAxis (initialShape h.1.val)) (maxAxis (initialShape h.1.val)) + (zeroAxis_spec _ (has_zero h.1)) (maxAxis_spec _) (canonical_axes_ne h.1) + +variable (allocation : Allocation) (dilation : ℕ) + +def embed (h : Index K) (side : Fin 3) (w : Words allocation dilation h) : + HistoryWord allocation dilation (.initial h.1.val, h.2) := + fun i => CWOrientedZero.sideWord (zero h) (selected h) side (w i) + +theorem coefficient (F : Type*) [Field F] (ε : ℝ) (h : Index K) + (x y z : Words allocation dilation h) : + historyTensor F allocation dilation ε (.initial h.1.val, h.2) + (embed allocation dilation h 0 x) (embed allocation dilation h 1 y) + (embed allocation dilation h 2 z) = + if CWOrientedZero.matched (zero h) x y z then 1 else 0 := by + rw [historyTensor_initial, physical_shape_eq] + exact CWOrientedZero.power_coefficient F 8 (shapeMax (initialShape h.1.val)) + (16 - shapeMax (initialShape h.1.val)) + (population allocation dilation (.initial h.1.val, h.2)) + (weights_sum h.1) (zero h) (selected h) (axes_ne h) + (fun w : Words allocation dilation h => w) Function.injective_id x y z + +abbrev RowIndex (h : Index K) := CWOrientedZero.Row (zero h) (Words allocation dilation h) +abbrev MiddleIndex (h : Index K) := CWOrientedZero.Middle (zero h) (Words allocation dilation h) +abbrev ColumnIndex (h : Index K) := CWOrientedZero.Column (zero h) (Words allocation dilation h) + +def factorMap (F : Type*) [Field F] (ε : ℝ) (h : Index K) : + LocalMap (historyTensor F allocation dilation ε (.initial h.1.val, h.2)) + (Tensor.matrixCoefficients (RowIndex allocation dilation h) + (MiddleIndex allocation dilation h) (ColumnIndex allocation dilation h)) := by + letI : Nonempty (Words allocation dilation h) := + Fintype.card_pos_iff.mp (card_words_pos allocation dilation h) + exact CWOrientedZero.ofMatching F _ (zero h) (embed allocation dilation h) + (coefficient allocation dilation F ε h) + +theorem factor_volume (h : Index K) : + Fintype.card (RowIndex allocation dilation h) * + Fintype.card (MiddleIndex allocation dilation h) * + Fintype.card (ColumnIndex allocation dilation h) = + Fintype.card (Words allocation dilation h) := + CWOrientedZero.volume (zero h) (Words allocation dilation h) + +abbrev RawWords := ∀ h : Index K, + HistoryWord allocation dilation (.initial h.1.val, h.2) +abbrev Rows := ∀ h : Index K, RowIndex allocation dilation h +abbrev Middles := ∀ h : Index K, MiddleIndex allocation dilation h +abbrev Columns := ∀ h : Index K, ColumnIndex allocation dilation h + +def source (F : Type*) [Field F] (ε : ℝ) : + Tensor F (RawWords (K := K) allocation dilation) + (RawWords (K := K) allocation dilation) (RawWords (K := K) allocation dilation) := + CommonDimensions.familyProduct (fun h : Index K => + historyTensor F allocation dilation ε (.initial h.1.val, h.2)) + +def finishMap (F : Type*) [Field F] (ε : ℝ) : + LocalMap (source (K := K) allocation dilation F ε) + (Tensor.matrixCoefficients (Rows (K := K) allocation dilation) + (Middles (K := K) allocation dilation) (Columns (K := K) allocation dilation)) := + AllFieldTerminal.terminalProductMap + (H := Index K) + (X := fun h => HistoryWord allocation dilation (.initial h.1.val, h.2)) + (Y := fun h => HistoryWord allocation dilation (.initial h.1.val, h.2)) + (Z := fun h => HistoryWord allocation dilation (.initial h.1.val, h.2)) + (fun h : Index K => historyTensor F allocation dilation ε (.initial h.1.val, h.2)) + (RowIndex allocation dilation) (MiddleIndex allocation dilation) + (ColumnIndex allocation dilation) (factorMap allocation dilation F ε) + +theorem volume_eq : + Fintype.card (Rows (K := K) allocation dilation) * + Fintype.card (Middles (K := K) allocation dilation) * + Fintype.card (Columns (K := K) allocation dilation) = + AllFieldInitialLeafRates.volume (K := K) allocation dilation := by + rw [AllFieldInitialLeafRates.volume_eq_prod] + simp only [Rows, Middles, Columns, Fintype.card_pi, + ← Finset.prod_mul_distrib] + apply Finset.prod_congr rfl + intro h _ + simpa only [Words, Fintype.card_pi] using factor_volume allocation dilation h + +theorem volume_pos : + 0 < Fintype.card (Rows (K := K) allocation dilation) * + Fintype.card (Middles (K := K) allocation dilation) * + Fintype.card (Columns (K := K) allocation dilation) := by + rw [volume_eq] + exact AllFieldInitialLeafRates.volume_pos allocation dilation + +theorem rows_pos : 0 < Fintype.card (Rows (K := K) allocation dilation) := + Nat.pos_of_mul_pos_right (Nat.pos_of_mul_pos_right (volume_pos allocation dilation)) + +theorem middles_pos : 0 < Fintype.card (Middles (K := K) allocation dilation) := + Nat.pos_of_mul_pos_left (Nat.pos_of_mul_pos_right (volume_pos allocation dilation)) + +theorem columns_pos : 0 < Fintype.card (Columns (K := K) allocation dilation) := + Nat.pos_of_mul_pos_left (volume_pos allocation dilation) + +end MatrixMultiplication.AllFieldInitialZeroFinish + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section + +open scoped BigOperators +open MatrixMultiplication.Foundation +open MatrixMultiplication.CommonDimensions + +namespace MatrixMultiplication.AllFieldStageCRegroup + +attribute [local instance] Classical.propDecidable Classical.decEq + +variable {H B W F : Type*} + +abbrev Positions (count : H → B → Bool → ℕ) (h : H) := + Σ b : B, Fin (count h b false) + +abbrev PairedWords (count : H → B → Bool → ℕ) (W : Type*) := + ∀ h, Positions count h → W × W + +abbrev SplitWords (count : H → B → Bool → ℕ) (W : Type*) := + ∀ h b r, Fin (count h b r) → W + +def unpair (count : H → B → Bool → ℕ) + (hc : ∀ h b r, count h b r = count h b false) + (x : PairedWords count W) : SplitWords count W := + fun h b r i => + if r then (x h ⟨b, Fin.cast (hc h b r) i⟩).2 + else (x h ⟨b, Fin.cast (hc h b r) i⟩).1 + +def pair (count : H → B → Bool → ℕ) + (hc : ∀ h b r, count h b r = count h b false) + (x : SplitWords count W) : PairedWords count W := + fun h p => (x h p.1 false p.2, x h p.1 true (Fin.cast (hc h p.1 true).symm p.2)) + +theorem pair_unpair (count : H → B → Bool → ℕ) + (hc : ∀ h b r, count h b r = count h b false) + (x : PairedWords count W) : pair count hc (unpair count hc x) = x := by + funext h p + rfl + +theorem unpair_pair (count : H → B → Bool → ℕ) + (hc : ∀ h b r, count h b r = count h b false) + (x : SplitWords count W) : unpair count hc (pair count hc x) = x := by + funext h b r i + cases r <;> rfl + +def unpairEquiv (count : H → B → Bool → ℕ) + (hc : ∀ h b r, count h b r = count h b false) : + PairedWords count W ≃ SplitWords count W where + toFun := unpair count hc + invFun := pair count hc + left_inv := pair_unpair count hc + right_inv := unpair_pair count hc + +variable [Fintype H] [Fintype B] [CommSemiring F] + +def splitTensor (count : H → B → Bool → ℕ) (T : H → B → Bool → Tensor F W W W) : + Tensor F (SplitWords count W) (SplitWords count W) (SplitWords count W) := + familyProduct fun h => familyProduct fun b => familyProduct fun r => + Tensor.power (T h b r) (count h b r) + +def pairedTensor (count : H → B → Bool → ℕ) (T : H → B → Bool → Tensor F W W W) : + Tensor F (PairedWords count W) (PairedWords count W) (PairedWords count W) := + familyProduct fun h => familyProduct fun p : Positions count h => + Tensor.product (T h p.1 false) (T h p.1 true) + +private theorem prod_fin_cast {m n : ℕ} (e : m = n) (f : Fin n → F) : + (∏ i : Fin m, f (Fin.cast e i)) = ∏ i : Fin n, f i := by + subst n + rfl + +theorem pullback_unpair (count : H → B → Bool → ℕ) + (hc : ∀ h b r, count h b r = count h b false) + (T : H → B → Bool → Tensor F W W W) : + Tensor.pullback (unpair count hc) (unpair count hc) (unpair count hc) + (splitTensor count T) = pairedTensor count T := by + funext x y z + simp only [Tensor.pullback, splitTensor, pairedTensor, familyProduct] + apply Finset.prod_congr rfl + intro h _ + rw [Fintype.prod_sigma] + apply Finset.prod_congr rfl + intro b _ + rw [Fintype.prod_bool] + change + (∏ j : Fin (count h b true), T h b true + (x h ⟨b, Fin.cast (hc h b true) j⟩).2 + (y h ⟨b, Fin.cast (hc h b true) j⟩).2 + (z h ⟨b, Fin.cast (hc h b true) j⟩).2) * + (∏ j : Fin (count h b false), T h b false + (x h ⟨b, j⟩).1 (y h ⟨b, j⟩).1 (z h ⟨b, j⟩).1) = + ∏ j : Fin (count h b false), + T h b false (x h ⟨b, j⟩).1 (y h ⟨b, j⟩).1 (z h ⟨b, j⟩).1 * + T h b true (x h ⟨b, j⟩).2 (y h ⟨b, j⟩).2 (z h ⟨b, j⟩).2 + rw [prod_fin_cast (hc h b true) (fun j => + T h b true (x h ⟨b, j⟩).2 (y h ⟨b, j⟩).2 (z h ⟨b, j⟩).2), + Finset.prod_mul_distrib] + exact mul_comm _ _ + +end MatrixMultiplication.AllFieldStageCRegroup + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section + +namespace MatrixMultiplication.AllFieldStageCFinish + +open MatrixMultiplication.Foundation AllFieldHistory AllFieldParameters AllFieldFiniteFamily +open CWStageCProducts +open scoped BigOperators Classical +attribute [local instance] Classical.propDecidable Classical.decEq + +private def localMapWithFintypes_inline_MatrixMultiplication_AllFieldStageCFinish {F : Type*} [Field F] + {X Y Z X' Y' Z' : Type} [newX : Fintype X] [newY : Fintype Y] [newZ : Fintype Z] + {oldX : Fintype X} {oldY : Fintype Y} {oldZ : Fintype Z} + {T : Tensor F X Y Z} {Q : Tensor F X' Y' Z'} + (M : @LocalMap F _ X Y Z X' Y' Z' oldX oldY oldZ T Q) : + @LocalMap F _ X Y Z X' Y' Z' newX newY newZ T Q := by + cases Subsingleton.elim oldX newX + cases Subsingleton.elim oldY newY + cases Subsingleton.elim oldZ newZ + exact M + +private def pairLocalMap {F : Type*} {H B W : Type} [Field F] [Fintype H] + [Fintype B] [Fintype W] [DecidableEq H] [DecidableEq B] (count : H → B → Bool → ℕ) + (hc : ∀ h b r, count h b r = count h b false) + (T : H → B → Bool → Tensor F W W W) : + LocalMap (AllFieldStageCRegroup.splitTensor count T) + (AllFieldStageCRegroup.pairedTensor count T) where + x := fun x s => if s = AllFieldStageCRegroup.unpair count hc x then 1 else 0 + y := fun y s => if s = AllFieldStageCRegroup.unpair count hc y then 1 else 0 + z := fun z s => if s = AllFieldStageCRegroup.unpair count hc z then 1 else 0 + coefficient := by + have hp := Tensor.pullback_eq_restrict + (AllFieldStageCRegroup.unpair (W := W) count hc) + (AllFieldStageCRegroup.unpair (W := W) count hc) + (AllFieldStageCRegroup.unpair (W := W) count hc) + (AllFieldStageCRegroup.splitTensor count T) + exact hp.symm.trans (AllFieldStageCRegroup.pullback_unpair count hc T) + +private def shapeFactorMap (F : Type*) [Field F] (side : Fin 3) + (placement : Equiv.Perm (Fin 3)) (count : Fin 4 → ℕ) : + LocalMap (placedShapeChildProducts F side placement count) + (Tensor.matrixCoefficients (RowWords (placement side) count) + (MiddleWords (placement side) count) (ColumnWords (placement side) count)) := + LocalMap.ofExists (placedShapeChildProducts_restriction F side placement count) + +private def shapeHistoryMap {F : Type*} {H : Type} [Field F] [Fintype H] [DecidableEq H] + (side : H → Fin 3) (placement : H → Equiv.Perm (Fin 3)) + (count : H → Fin 4 → ℕ) : + LocalMap (CommonDimensions.familyProduct (fun h => + placedShapeChildProducts F (side h) (placement h) (count h))) + (Tensor.matrixCoefficients + (HistoryRowWords (fun h => placement h (side h)) count) + (HistoryMiddleWords (fun h => placement h (side h)) count) + (HistoryColumnWords (fun h => placement h (side h)) count)) := by + let M := AllFieldTerminal.terminalProductMap + (F := F) (H := H) + (X := fun h => Positions (count h) → ChildWords) + (Y := fun h => Positions (count h) → ChildWords) + (Z := fun h => Positions (count h) → ChildWords) + (fun h => placedShapeChildProducts F (side h) (placement h) (count h)) + (fun h => RowWords (placement h (side h)) (count h)) + (fun h => MiddleWords (placement h (side h)) (count h)) + (fun h => ColumnWords (placement h (side h)) (count h)) + (fun h => LocalMap.redecideMatrix + (shapeFactorMap F (side h) (placement h) (count h)) _ _ _) + let N := localMapWithFintypes_inline_MatrixMultiplication_AllFieldStageCFinish (F := F) + (X := ∀ h, Positions (count h) → ChildWords) + (Y := ∀ h, Positions (count h) → ChildWords) + (Z := ∀ h, Positions (count h) → ChildWords) + (newX := inferInstance) (newY := inferInstance) (newZ := inferInstance) M + exact LocalMap.redecideMatrix N _ _ _ + +private theorem row_nonempty (s : Fin 3) (b : Fin 4) : Nonempty (Row s b) := by + fin_cases s <;> fin_cases b <;> + dsimp [Row, SmallRow, SmallInner] <;> infer_instance + +private theorem middle_nonempty (s : Fin 3) (b : Fin 4) : Nonempty (Middle s b) := by + fin_cases s <;> fin_cases b <;> + dsimp [Middle, SmallRow, SmallInner] <;> infer_instance + +private theorem column_nonempty (s : Fin 3) (b : Fin 4) : Nonempty (Column s b) := by + fin_cases s <;> fin_cases b <;> + dsimp [Column, SmallRow, SmallInner] <;> infer_instance + +variable {K : ℕ} (allocation : Allocation) (dilation : ℕ) + +abbrev Index (K : ℕ) := AfterC K × Placement + +abbrev RawWords := ∀ h : Index K, + HistoryWord allocation dilation (.afterC h.1, h.2) + +def source (F : Type*) [Field F] (ε : ℝ) : + Tensor F (RawWords (K := K) allocation dilation) + (RawWords (K := K) allocation dilation) (RawWords (K := K) allocation dilation) := + CommonDimensions.familyProduct (fun h : Index K => + historyTensor F allocation dilation ε (.afterC h.1, h.2)) + +def counts (h : PopulationHistory K) (b : Fin 4) (right : Bool) : ℕ := + population allocation dilation (.afterC (h.1, b, right), h.2) + +theorem counts_half (h : PopulationHistory K) (b : Fin 4) (right : Bool) : + counts allocation dilation h b right = counts allocation dilation h b false := + branchPopulation_half allocation dilation (.stageC h.1, h.2) b right + +@[simp] theorem counts_false (h : PopulationHistory K) (b : Fin 4) : + counts allocation dilation h b false = populationAtomCounts allocation dilation h b := rfl + +abbrev SingleWord := Fin 1 → Fin 7 + +def leaf (F : Type*) [Field F] (h : PopulationHistory K) (b : Fin 4) (right : Bool) : + Tensor F SingleWord SingleWord SingleWord := + CWStrands.shapeTensor (Fin 1) (physicalShape h.2 (cShape (h.1, b, right))) + +abbrev GroupedWords := AllFieldStageCRegroup.SplitWords + (counts (K := K) allocation dilation) SingleWord + +abbrev PairedWords := AllFieldStageCRegroup.PairedWords + (counts (K := K) allocation dilation) SingleWord + +def groupedSource (F : Type*) [Field F] := + AllFieldStageCRegroup.splitTensor (counts (K := K) allocation dilation) (leaf (K := K) F) + +def pairedSource (F : Type*) [Field F] : + Tensor F (PairedWords (K := K) allocation dilation) + (PairedWords (K := K) allocation dilation) (PairedWords (K := K) allocation dilation) := + CommonDimensions.familyProduct (fun h : PopulationHistory K => + placedShapeChildProducts F (stageCDistinguished (cShapeParent h.1)) h.2 + (populationAtomCounts allocation dilation h)) + +def indexEquiv : (PopulationHistory K × Fin 4 × Bool) ≃ Index K where + toFun h := ((h.1.1, h.2.1, h.2.2), h.1.2) + invFun h := ((h.1.1, h.2), h.1.2.1, h.1.2.2) + left_inv h := by rcases h with ⟨⟨h, phi⟩, b, r⟩; rfl + right_inv h := by rcases h with ⟨⟨h, b, r⟩, phi⟩; rfl + +def toRaw (x : GroupedWords (K := K) allocation dilation) : RawWords (K := K) allocation dilation := + fun h => x (h.1.1, h.2) h.1.2.1 h.1.2.2 + +theorem regroup_coefficient (F : Type*) [Field F] (ε : ℝ) + (x y z : GroupedWords (K := K) allocation dilation) : + source allocation dilation F ε (toRaw allocation dilation x) + (toRaw allocation dilation y) (toRaw allocation dilation z) = + groupedSource allocation dilation F x y z := by + change (∏ h : Index K, historyTensor F allocation dilation ε (.afterC h.1, h.2) + (toRaw allocation dilation x h) (toRaw allocation dilation y h) + (toRaw allocation dilation z h)) = _ + rw [← (indexEquiv (K := K)).prod_comp] + simp only [Fintype.prod_prod_type] + simp only [indexEquiv, Equiv.coe_fn_mk, toRaw, historyTensor_afterC, + groupedSource, AllFieldStageCRegroup.splitTensor, CommonDimensions.familyProduct, leaf, counts, + Fintype.prod_prod_type] + +def regroupMap (F : Type*) [Field F] (ε : ℝ) : + LocalMap (source (K := K) allocation dilation F ε) + (groupedSource (K := K) allocation dilation F) where + x := fun x s => if s = toRaw allocation dilation x then 1 else 0 + y := fun y s => if s = toRaw allocation dilation y then 1 else 0 + z := fun z s => if s = toRaw allocation dilation z then 1 else 0 + coefficient := by + rw [← Tensor.pullback_eq_restrict] + funext x y z + exact regroup_coefficient allocation dilation F ε x y z + +theorem leaf_pair (F : Type*) [Field F] (h : PopulationHistory K) (b : Fin 4) : + Tensor.product (leaf F h b false) (leaf F h b true) = + placedShapeChildProduct F (stageCDistinguished (cShapeParent h.1)) h.2 b := by + rw [placedShapeChildProduct_eq_stageC F (cShapeParent h.1) + (bShape_size h.1.1.val) h.1.1.property] + rfl + +theorem pairedSource_eq (F : Type*) [Field F] : + AllFieldStageCRegroup.pairedTensor (counts (K := K) allocation dilation) (leaf (K := K) F) = + pairedSource (K := K) allocation dilation F := by + funext x y z + dsimp only [AllFieldStageCRegroup.pairedTensor, pairedSource, placedShapeChildProducts, + CommonDimensions.familyProduct] + apply Finset.prod_congr rfl + intro h _ + apply Finset.prod_congr rfl + intro p _ + exact congrFun (congrFun (congrFun (leaf_pair F h p.1) (x h p)) (y h p)) (z h p) + +attribute [local irreducible] AllFieldHistory.population + +def pairMap (F : Type*) [Field F] : + LocalMap (groupedSource (K := K) allocation dilation F) + (pairedSource (K := K) allocation dilation F) := by + let M := pairLocalMap (F := F) (H := PopulationHistory K) (B := Fin 4) (W := SingleWord) + (counts (K := K) allocation dilation) + (counts_half (K := K) allocation dilation) (leaf (K := K) F) + let N : LocalMap (groupedSource (K := K) allocation dilation F) + (AllFieldStageCRegroup.pairedTensor (counts (K := K) allocation dilation) (leaf (K := K) F)) := + localMapWithFintypes_inline_MatrixMultiplication_AllFieldStageCFinish + (X := GroupedWords (K := K) allocation dilation) + (Y := GroupedWords (K := K) allocation dilation) + (Z := GroupedWords (K := K) allocation dilation) + (X' := PairedWords (K := K) allocation dilation) + (Y' := PairedWords (K := K) allocation dilation) + (Z' := PairedWords (K := K) allocation dilation) M + exact ⟨N.x, N.y, N.z, N.coefficient.trans (pairedSource_eq (K := K) allocation dilation F)⟩ + +abbrev Rows := HistoryRowWords (populationSide (K := K)) (populationAtomCounts allocation dilation) +abbrev Middles := HistoryMiddleWords (populationSide (K := K)) (populationAtomCounts allocation dilation) +abbrev Columns := HistoryColumnWords (populationSide (K := K)) (populationAtomCounts allocation dilation) + +def terminalMap (F : Type*) [Field F] : + LocalMap (pairedSource (K := K) allocation dilation F) + (Tensor.matrixCoefficients (Rows (K := K) allocation dilation) + (Middles (K := K) allocation dilation) (Columns (K := K) allocation dilation)) := by + let M := shapeHistoryMap (F := F) (H := PopulationHistory K) + (fun h : PopulationHistory K => stageCDistinguished (cShapeParent h.1)) + (fun h => h.2) (populationAtomCounts allocation dilation) + exact LocalMap.redecideMatrix (localMapWithFintypes_inline_MatrixMultiplication_AllFieldStageCFinish M) _ _ _ + +def finishMap (F : Type*) [Field F] (ε : ℝ) : + LocalMap (source (K := K) allocation dilation F ε) + (Tensor.matrixCoefficients (Rows (K := K) allocation dilation) + (Middles (K := K) allocation dilation) (Columns (K := K) allocation dilation)) := + (regroupMap allocation dilation F ε).comp + ((pairMap allocation dilation F).comp (terminalMap allocation dilation F)) + +theorem volume_eq_populationVolume : + Fintype.card (Rows (K := K) allocation dilation) * + Fintype.card (Middles (K := K) allocation dilation) * + Fintype.card (Columns (K := K) allocation dilation) = + populationVolume (K := K) allocation dilation := by + simp only [Rows, Middles, Columns, populationVolume, historyVolume, + HistoryRowWords, HistoryMiddleWords, HistoryColumnWords, Fintype.card_pi] + +theorem rows_pos : 0 < Fintype.card (Rows (K := K) allocation dilation) := by + apply Fintype.card_pos_iff.mpr + exact ⟨fun h p => Classical.choice (row_nonempty (populationSide h) p.1)⟩ + +theorem middles_pos : 0 < Fintype.card (Middles (K := K) allocation dilation) := by + apply Fintype.card_pos_iff.mpr + exact ⟨fun h p => Classical.choice (middle_nonempty (populationSide h) p.1)⟩ + +theorem columns_pos : 0 < Fintype.card (Columns (K := K) allocation dilation) := by + apply Fintype.card_pos_iff.mpr + exact ⟨fun h p => Classical.choice (column_nonempty (populationSide h) p.1)⟩ + +end MatrixMultiplication.AllFieldStageCFinish + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section + +namespace MatrixMultiplication.AllFieldFinishedWitness + +open MatrixMultiplication.Foundation AllFieldHistory AllFieldFiniteFamily +open AllFieldTerminalStatisticLaws AllFieldTerminalRates +open scoped BigOperators Classical +attribute [local instance] Classical.propDecidable Classical.decEq + +private def localMapWithFintypes_inline_MatrixMultiplication_AllFieldFinishedWitness {F : Type*} [Field F] + {X Y Z X' Y' Z' : Type} [newX : Fintype X] [newY : Fintype Y] [newZ : Fintype Z] + {oldX : Fintype X} {oldY : Fintype Y} {oldZ : Fintype Z} + {T : Tensor F X Y Z} {Q : Tensor F X' Y' Z'} + (M : @LocalMap F _ X Y Z X' Y' Z' oldX oldY oldZ T Q) : + @LocalMap F _ X Y Z X' Y' Z' newX newY newZ T Q := by + cases Subsingleton.elim oldX newX + cases Subsingleton.elim oldY newY + cases Subsingleton.elim oldZ newZ + exact M + +private def matrixProductMap (F : Type*) [Field F] + (A B C D E G : Type) [Fintype A] [Fintype B] [Fintype C] + [Fintype D] [Fintype E] [Fintype G] : + LocalMap (Tensor.product (Tensor.matrixCoefficients (K := F) A B C) + (Tensor.matrixCoefficients D E G)) + (Tensor.matrixCoefficients (A × D) (B × E) (C × G)) := by + apply LocalMap.ofExists + refine ⟨_, _, _, (Tensor.pullback_eq_restrict + (fun x : (A × D) × (B × E) => ((x.1.1, x.2.1), (x.1.2, x.2.2))) + (fun y : (B × E) × (C × G) => ((y.1.1, y.2.1), (y.1.2, y.2.2))) + (fun z : (C × G) × (A × D) => ((z.1.1, z.2.1), (z.1.2, z.2.2))) _).symm.trans ?_⟩ + funext x y z + exact Tensor.matrixCoefficients_product x y z + +private def combineMatrixMaps {F : Type*} [Field F] + {X Y Z U V W A B C D E G : Type} + [Fintype X] [Fintype Y] [Fintype Z] [Fintype U] [Fintype V] [Fintype W] + [Fintype A] [Fintype B] [Fintype C] [Fintype D] [Fintype E] [Fintype G] + {T : Tensor F X Y Z} {Q : Tensor F U V W} + (first : LocalMap T (Tensor.matrixCoefficients A B C)) + (second : LocalMap Q (Tensor.matrixCoefficients D E G)) : + LocalMap (Tensor.product T Q) + (Tensor.matrixCoefficients (A × D) (B × E) (C × G)) := + (first.product second).comp (matrixProductMap F A B C D E G) + +variable {K : ℕ} (allocation : Allocation) (m : ℕ) + +abbrev ZeroRows := ∀ h : TerminalZero K, AllFieldZeroFinish.Row allocation m h +abbrev ZeroMiddles := ∀ h : TerminalZero K, AllFieldZeroFinish.Middle allocation m h +abbrev ZeroColumns := ∀ h : TerminalZero K, AllFieldZeroFinish.Column allocation m h + +abbrev Rows := AllFieldInitialZeroFinish.Rows (K := K) allocation (terminalDilation K m) × + (ZeroRows (K := K) allocation m × + AllFieldStageCFinish.Rows (K := K) allocation (terminalDilation K m)) +abbrev Middles := AllFieldInitialZeroFinish.Middles (K := K) allocation (terminalDilation K m) × + (ZeroMiddles (K := K) allocation m × + AllFieldStageCFinish.Middles (K := K) allocation (terminalDilation K m)) +abbrev Columns := AllFieldInitialZeroFinish.Columns (K := K) allocation (terminalDilation K m) × + (ZeroColumns (K := K) allocation m × + AllFieldStageCFinish.Columns (K := K) allocation (terminalDilation K m)) + +local instance initialRowsFintype : + Fintype (AllFieldInitialZeroFinish.Rows (K := K) allocation (terminalDilation K m)) := by + letI : DecidableEq (AllFieldInitialZeroFinish.Index K) := Classical.decEq _ + exact inferInstanceAs (Fintype (∀ h : AllFieldInitialZeroFinish.Index K, + AllFieldInitialZeroFinish.RowIndex allocation (terminalDilation K m) h)) + +local instance initialMiddlesFintype : + Fintype (AllFieldInitialZeroFinish.Middles (K := K) allocation (terminalDilation K m)) := by + letI : DecidableEq (AllFieldInitialZeroFinish.Index K) := Classical.decEq _ + exact inferInstanceAs (Fintype (∀ h : AllFieldInitialZeroFinish.Index K, + AllFieldInitialZeroFinish.MiddleIndex allocation (terminalDilation K m) h)) + +local instance initialColumnsFintype : + Fintype (AllFieldInitialZeroFinish.Columns (K := K) allocation (terminalDilation K m)) := by + letI : DecidableEq (AllFieldInitialZeroFinish.Index K) := Classical.decEq _ + exact inferInstanceAs (Fintype (∀ h : AllFieldInitialZeroFinish.Index K, + AllFieldInitialZeroFinish.ColumnIndex allocation (terminalDilation K m) h)) + +local instance stageCRowsFintype : + Fintype (AllFieldStageCFinish.Rows (K := K) allocation (terminalDilation K m)) := by + exact inferInstanceAs (Fintype (∀ h : CWStageCProducts.PopulationHistory K, + CWStageCProducts.RowWords (CWStageCProducts.populationSide h) + (CWStageCProducts.populationAtomCounts allocation (terminalDilation K m) h))) + +local instance stageCMiddlesFintype : + Fintype (AllFieldStageCFinish.Middles (K := K) allocation (terminalDilation K m)) := by + exact inferInstanceAs (Fintype (∀ h : CWStageCProducts.PopulationHistory K, + CWStageCProducts.MiddleWords (CWStageCProducts.populationSide h) + (CWStageCProducts.populationAtomCounts allocation (terminalDilation K m) h))) + +local instance stageCColumnsFintype : + Fintype (AllFieldStageCFinish.Columns (K := K) allocation (terminalDilation K m)) := by + exact inferInstanceAs (Fintype (∀ h : CWStageCProducts.PopulationHistory K, + CWStageCProducts.ColumnWords (CWStageCProducts.populationSide h) + (CWStageCProducts.populationAtomCounts allocation (terminalDilation K m) h))) + +local instance rowsFintype : Fintype (Rows (K := K) allocation m) := + inferInstanceAs (Fintype + (AllFieldInitialZeroFinish.Rows (K := K) allocation (terminalDilation K m) × + (ZeroRows (K := K) allocation m × + AllFieldStageCFinish.Rows (K := K) allocation (terminalDilation K m)))) + +local instance middlesFintype : Fintype (Middles (K := K) allocation m) := + inferInstanceAs (Fintype + (AllFieldInitialZeroFinish.Middles (K := K) allocation (terminalDilation K m) × + (ZeroMiddles (K := K) allocation m × + AllFieldStageCFinish.Middles (K := K) allocation (terminalDilation K m)))) + +local instance columnsFintype : Fintype (Columns (K := K) allocation m) := + inferInstanceAs (Fintype + (AllFieldInitialZeroFinish.Columns (K := K) allocation (terminalDilation K m) × + (ZeroColumns (K := K) allocation m × + AllFieldStageCFinish.Columns (K := K) allocation (terminalDilation K m)))) + +local instance initialRawFintype : + Fintype (AllFieldFinalState.InitialWords (K := K) allocation (terminalDilation K m)) := + inferInstanceAs (Fintype (∀ h : AllFieldFinalState.InitialIndex K, + HistoryWord allocation (terminalDilation K m) (.initial h.1.val, h.2))) + +local instance zeroRawFintype : + Fintype (AllFieldFinalState.ZeroWords (K := K) allocation (terminalDilation K m)) := + inferInstanceAs (Fintype (∀ h : TerminalZero K, + HistoryWord allocation (terminalDilation K m) (AllFieldTerminalStatisticLaws.history h))) + +local instance stageCRawFintype : + Fintype (AllFieldFinalState.CWords (K := K) allocation (terminalDilation K m)) := + inferInstanceAs (Fintype (∀ h : AllFieldFinalState.CIndex K, + HistoryWord allocation (terminalDilation K m) (.afterC h.1, h.2))) + +theorem zero_volume : + Fintype.card (ZeroRows (K := K) allocation m) * + Fintype.card (ZeroMiddles (K := K) allocation m) * + Fintype.card (ZeroColumns (K := K) allocation m) = zeroVolume (K := K) allocation m := by + simp only [ZeroRows, ZeroMiddles, ZeroColumns, Fintype.card_pi, zeroVolume] + rw [← Finset.prod_mul_distrib, ← Finset.prod_mul_distrib] + exact Finset.prod_congr rfl fun h _ => AllFieldZeroFinish.volume allocation m h + +theorem volume_eq : + Fintype.card (Rows (K := K) allocation m) * + Fintype.card (Middles (K := K) allocation m) * + Fintype.card (Columns (K := K) allocation m) = terminalVolume (K := K) allocation m := by + simp only [Rows, Middles, Columns, Fintype.card_prod] + calc + _ = (Fintype.card (AllFieldInitialZeroFinish.Rows (K := K) allocation (terminalDilation K m)) * + Fintype.card (AllFieldInitialZeroFinish.Middles (K := K) allocation (terminalDilation K m)) * + Fintype.card (AllFieldInitialZeroFinish.Columns (K := K) allocation (terminalDilation K m))) * + (Fintype.card (ZeroRows (K := K) allocation m) * + Fintype.card (ZeroMiddles (K := K) allocation m) * + Fintype.card (ZeroColumns (K := K) allocation m)) * + (Fintype.card (AllFieldStageCFinish.Rows (K := K) allocation (terminalDilation K m)) * + Fintype.card (AllFieldStageCFinish.Middles (K := K) allocation (terminalDilation K m)) * + Fintype.card (AllFieldStageCFinish.Columns (K := K) allocation (terminalDilation K m))) := by ring + _ = _ := by rw [AllFieldInitialZeroFinish.volume_eq, zero_volume, + AllFieldStageCFinish.volume_eq_populationVolume]; rfl + +theorem dimensions_pos : + 0 < Fintype.card (Rows (K := K) allocation m) ∧ + 0 < Fintype.card (Middles (K := K) allocation m) ∧ + 0 < Fintype.card (Columns (K := K) allocation m) := by + have hp := terminalVolume_pos (K := K) allocation m + rw [← volume_eq allocation m] at hp + have hab := Nat.pos_of_mul_pos_right hp + exact ⟨Nat.pos_of_mul_pos_right hab, Nat.pos_of_mul_pos_left hab, + Nat.pos_of_mul_pos_left hp⟩ + +def zeroMap (F : Type*) [Field F] {ε : ℝ} (hm : 0 < m) (hε : 0 ≤ ε) : + LocalMap (AllFieldFinalState.zeroTensor (K := K) allocation (terminalDilation K m) F ε) + (Tensor.matrixCoefficients (ZeroRows (K := K) allocation m) + (ZeroMiddles (K := K) allocation m) (ZeroColumns (K := K) allocation m)) := by + let result := AllFieldTerminal.terminalProductMap + (fun h : TerminalZero K => historyTensor F allocation (terminalDilation K m) ε + (AllFieldTerminalStatisticLaws.history h)) + (fun h => AllFieldZeroFinish.Row allocation m h) + (fun h => AllFieldZeroFinish.Middle allocation m h) + (fun h => AllFieldZeroFinish.Column allocation m h) + (fun h => LocalMap.redecideMatrix + (AllFieldZeroFinish.localMap F allocation hm hε h) _ _ _) + let aligned := localMapWithFintypes_inline_MatrixMultiplication_AllFieldFinishedWitness (F := F) + (X := AllFieldFinalState.ZeroWords (K := K) allocation (terminalDilation K m)) + (Y := AllFieldFinalState.ZeroWords (K := K) allocation (terminalDilation K m)) + (Z := AllFieldFinalState.ZeroWords (K := K) allocation (terminalDilation K m)) + (newX := inferInstance) (newY := inferInstance) (newZ := inferInstance) result + exact LocalMap.redecideMatrix aligned _ _ _ + +def terminalMap (F : Type*) [Field F] {ε : ℝ} (hm : 0 < m) (hε : 0 ≤ ε) : + LocalMap (stateTensor F (K := K) allocation (terminalDilation K m) ε (K + 2)) + (Tensor.matrixCoefficients (Rows (K := K) allocation m) + (Middles (K := K) allocation m) (Columns (K := K) allocation m)) := by + let initialAligned := localMapWithFintypes_inline_MatrixMultiplication_AllFieldFinishedWitness (F := F) + (X := AllFieldInitialZeroFinish.RawWords (K := K) allocation (terminalDilation K m)) + (Y := AllFieldInitialZeroFinish.RawWords (K := K) allocation (terminalDilation K m)) + (Z := AllFieldInitialZeroFinish.RawWords (K := K) allocation (terminalDilation K m)) + (newX := inferInstance) (newY := inferInstance) (newZ := inferInstance) + (AllFieldInitialZeroFinish.finishMap (K := K) allocation (terminalDilation K m) F ε) + let initial := LocalMap.redecideMatrix initialAligned + (Classical.decEq _) (Classical.decEq _) (Classical.decEq _) + let zeros := LocalMap.redecideMatrix (zeroMap (K := K) allocation m F hm hε) + (Classical.decEq _) (Classical.decEq _) (Classical.decEq _) + let interior := LocalMap.redecideMatrix + (AllFieldStageCFinish.finishMap (K := K) allocation (terminalDilation K m) F ε) + (Classical.decEq _) (Classical.decEq _) (Classical.decEq _) + let second := LocalMap.redecideMatrix + (combineMatrixMaps zeros interior) + (Classical.decEq _) (Classical.decEq _) (Classical.decEq _) + let third := combineMatrixMaps initial second + exact LocalMap.redecideMatrix + ((AllFieldFinalState.map (K := K) allocation (terminalDilation K m) F ε).comp third) _ _ _ + +variable {F : Type*} [Field F] {ε : ℝ} {I : Type} [Fintype I] + +def execution (hm : 0 < m) (hε : 0 ≤ ε) + (E : Execution (cwSource F K (terminalLength allocation K m)) + (Tensor.directSum (fun _ : I => + stateTensor F (K := K) allocation (terminalDilation K m) ε (K + 2)))) : + Execution (cwSource F K (terminalLength allocation K m)) + (AllFieldSource.matrixTarget F (Fintype.card (Rows (K := K) allocation m)) + (Fintype.card (Middles (K := K) allocation m)) + (Fintype.card (Columns (K := K) allocation m)) (Fintype.card I)) := + (E.restrict _ ((terminalMap allocation m F hm hε).parallelCopies I)).restrict _ + (LocalMap.ofExists (TerminalRelabel.directSum_matrix_restrict_fin (K := F) + I (Rows (K := K) allocation m) (Middles (K := K) allocation m) + (Columns (K := K) allocation m))) + +def witness (hm : 0 < m) (hε : 0 ≤ ε) + (E : Execution (cwSource F K (terminalLength allocation K m)) + (Tensor.directSum (fun _ : I => + stateTensor F (K := K) allocation (terminalDilation K m) ε (K + 2)))) + (hI : 0 < Fintype.card I) : AllFieldWitness F := + (execution allocation m hm hε E).toWitness + (dimensions_pos allocation m).1 (dimensions_pos allocation m).2.1 + (dimensions_pos allocation m).2.2 hI + +@[simp] theorem witness_volume (hm : 0 < m) (hε : 0 ≤ ε) + (E : Execution (cwSource F K (terminalLength allocation K m)) + (Tensor.directSum (fun _ : I => + stateTensor F (K := K) allocation (terminalDilation K m) ε (K + 2)))) + (hI : 0 < Fintype.card I) : + (witness allocation m hm hε E hI).volume = terminalVolume (K := K) allocation m := + volume_eq allocation m + +@[simp] theorem witness_multiplicity (hm : 0 < m) (hε : 0 ≤ ε) + (E : Execution (cwSource F K (terminalLength allocation K m)) + (Tensor.directSum (fun _ : I => + stateTensor F (K := K) allocation (terminalDilation K m) ε (K + 2)))) + (hI : 0 < Fintype.card I) : + (witness allocation m hm hε E hI).multiplicity = Fintype.card I := rfl + +@[simp] theorem witness_rankBound (hm : 0 < m) (hε : 0 ≤ ε) + (E : Execution (cwSource F K (terminalLength allocation K m)) + (Tensor.directSum (fun _ : I => + stateTensor F (K := K) allocation (terminalDilation K m) ε (K + 2)))) + (hI : 0 < Fintype.card I) : + (witness allocation m hm hε E hI).rankBound = + AllFieldSource.rankBudget E.Copies K (terminalLength allocation K m) := rfl + +end MatrixMultiplication.AllFieldFinishedWitness + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section + +namespace MatrixMultiplication.AllFieldConstructionData + +open MatrixMultiplication.Foundation AllFieldHistory AllFieldFiniteFamily +open scoped BigOperators Classical +attribute [local instance] Classical.propDecidable Classical.decEq + +variable {K : ℕ} + +structure Data (allocation : Allocation) (dilation : ℕ) (width slack : ℝ) where + initial : AllFieldInitialChoice.Choice (K := K) allocation dilation slack + groups : AllFieldHistoryIteration.ScheduleChoices + (K := K) allocation dilation width slack + threshold : ∀ t : Fin (K + 2), + AllFieldHistoryRecovery.minimumDilation (K := K) (tick := t.val) allocation width ≤ dilation + +variable (allocation : Allocation) (dilation : ℕ) (width slack : ℝ) + +abbrev Tags (data : Data (K := K) allocation dilation width slack) := + AllFieldHistoryIteration.Tags allocation dilation width slack + (AllFieldInitialChoice.Tags allocation dilation slack data.initial) data.groups + +instance tagsFintype (data : Data (K := K) allocation dilation width slack) : + Fintype (Tags allocation dilation width slack data) := inferInstance + +def execution (F : Type*) [Field F] (hwidth : 0 < width) + (data : Data (K := K) allocation dilation width slack) : + Execution (cwSource F K (populationLength (K := K) allocation dilation)) + (Tensor.directSum (fun _ : Tags allocation dilation width slack data => + stateTensor F (K := K) allocation dilation width (K + 2))) := + AllFieldHistoryIteration.execution allocation dilation width slack F hwidth + data.threshold data.groups + (AllFieldInitialChoice.execution allocation dilation slack data.initial F width) + +theorem card_tags (data : Data (K := K) allocation dilation width slack) : + Fintype.card (Tags allocation dilation width slack data) = + Fintype.card (AllFieldConstructionRates.SelectedLabels + (K := K) allocation slack dilation) := by + rw [AllFieldHistoryIteration.card_tags, AllFieldInitialChoice.card_tags, + AllFieldConstructionRates.card_selected] + congr 1 + apply Finset.prod_congr rfl + intro t _ + apply Finset.prod_congr rfl + intro sigma _ + exact (AllFieldConstructionRates.groupCount_eq_native allocation slack dilation t sigma).symm + +theorem execution_copies (F : Type*) [Field F] (hwidth : 0 < width) + (data : Data (K := K) allocation dilation width slack) : + Fintype.card (execution allocation dilation width slack F hwidth data).Copies = + Fintype.card (AllFieldConstructionRates.Copies + (K := K) allocation width dilation) := by + rw [execution, AllFieldHistoryIteration.execution_copies, + AllFieldInitialChoice.execution_copies, one_mul] + simp only [AllFieldConstructionRates.Copies, Fintype.card_pi, + InverseLinearRecovery.MaskRectangles, ExactRecovery.card_mask_rectangles, Fintype.card_fin] + +theorem tags_pos + (hslack : ∀ slot : AllFieldConstructionRates.Slot K, + slack ≤ (AllFieldConstructionRates.denominator (K := K) allocation : ℝ) * + AllFieldConstructionRates.capacity allocation slot) + (data : Data (K := K) allocation dilation width slack) : + 0 < Fintype.card (Tags allocation dilation width slack data) := by + rw [card_tags] + exact AllFieldConstructionRates.selected_pos allocation slack hslack dilation + +variable {F : Type*} [Field F] (m : ℕ) + +def witness (hm : 0 < m) (hwidth : 0 < width) + (hslack : ∀ slot : AllFieldConstructionRates.Slot K, + slack ≤ (AllFieldConstructionRates.denominator (K := K) allocation : ℝ) * + AllFieldConstructionRates.capacity allocation slot) + (data : Data (K := K) allocation + (AllFieldTerminalRates.terminalDilation K m) width slack) : AllFieldWitness F := + AllFieldFinishedWitness.witness allocation m hm hwidth.le + (execution allocation (AllFieldTerminalRates.terminalDilation K m) width slack F hwidth data) + (tags_pos allocation (AllFieldTerminalRates.terminalDilation K m) width slack hslack data) + +@[simp] theorem witness_volume (hm : 0 < m) (hwidth : 0 < width) + (hslack : ∀ slot : AllFieldConstructionRates.Slot K, + slack ≤ (AllFieldConstructionRates.denominator (K := K) allocation : ℝ) * + AllFieldConstructionRates.capacity allocation slot) + (data : Data (K := K) allocation + (AllFieldTerminalRates.terminalDilation K m) width slack) : + (witness (F := F) allocation width slack m hm hwidth hslack data).volume = + AllFieldTerminalRates.terminalVolume (K := K) allocation m := + AllFieldFinishedWitness.witness_volume _ _ _ _ _ _ + +@[simp] theorem witness_multiplicity (hm : 0 < m) (hwidth : 0 < width) + (hslack : ∀ slot : AllFieldConstructionRates.Slot K, + slack ≤ (AllFieldConstructionRates.denominator (K := K) allocation : ℝ) * + AllFieldConstructionRates.capacity allocation slot) + (data : Data (K := K) allocation + (AllFieldTerminalRates.terminalDilation K m) width slack) : + (witness (F := F) allocation width slack m hm hwidth hslack data).multiplicity = + Fintype.card (AllFieldConstructionRates.SelectedLabels + (K := K) allocation slack (AllFieldTerminalRates.terminalDilation K m)) := by + change Fintype.card (Tags _ _ _ _ data) = _ + exact card_tags _ _ _ _ data + +@[simp] theorem witness_rankBound (hm : 0 < m) (hwidth : 0 < width) + (hslack : ∀ slot : AllFieldConstructionRates.Slot K, + slack ≤ (AllFieldConstructionRates.denominator (K := K) allocation : ℝ) * + AllFieldConstructionRates.capacity allocation slot) + (data : Data (K := K) allocation + (AllFieldTerminalRates.terminalDilation K m) width slack) : + (witness (F := F) allocation width slack m hm hwidth hslack data).rankBound = + AllFieldSource.rankBudget + (AllFieldConstructionRates.Copies (K := K) allocation width + (AllFieldTerminalRates.terminalDilation K m)) K + (AllFieldTerminalRates.terminalLength allocation K m) := by + change AllFieldSource.rankBudget + (execution allocation (AllFieldTerminalRates.terminalDilation K m) width slack F hwidth data).Copies + K (AllFieldTerminalRates.terminalLength allocation K m) = _ + unfold AllFieldSource.rankBudget + rw [execution_copies] + +end MatrixMultiplication.AllFieldConstructionData + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section + +namespace MatrixMultiplication.AllFieldConstructionFamily + +open MatrixMultiplication.Foundation AllFieldHistory AllFieldConstructionData +open AllFieldConstructionRates Filter +open scoped BigOperators Topology Classical +attribute [local instance] Classical.propDecidable Classical.decEq + +variable {K : ℕ} + +theorem exists_width_eventually_data (allocation : Allocation) + {slack widthMax : ℝ} (hslack : 0 < slack) (hmax : 0 < widthMax) : + ∃ width : ℝ, 0 < width ∧ width ≤ widthMax ∧ + ∀ᶠ m : ℕ in atTop, Nonempty (Data (K := K) allocation m width slack) := by + let Index := Fin (K + 2) × Placement + have hindex : (Finset.univ : Finset Index).Nonempty := + ⟨(⟨0, by omega⟩, Equiv.refl _), Finset.mem_univ _⟩ + have hb (i : Index) := + AllFieldGroupSelection.exists_threshold_eventually_selected + (K := K) (tick := i.1.val) allocation i.2 hslack hmax + choose threshold hpositive hmaximum hselected using hb + let width := Finset.univ.inf' hindex threshold + have hwidth : 0 < width := by + apply (Finset.lt_inf'_iff hindex).mpr + intro i _ + exact hpositive i + have hbound (i : Index) : width ≤ threshold i := + Finset.inf'_le _ (Finset.mem_univ i) + have hwidthMax : width ≤ widthMax := + (hbound hindex.choose).trans (hmaximum hindex.choose) + have hgroups : ∀ᶠ m : ℕ in atTop, ∀ i : Index, + Nonempty (AllFieldGroupSelection.Selected (K := K) (tick := i.1.val) + allocation m width i.2 slack) := + Filter.eventually_all.mpr (fun i => hselected i width hwidth (hbound i)) + have hthresholds : ∀ᶠ m : ℕ in atTop, ∀ t : Fin (K + 2), + AllFieldHistoryRecovery.minimumDilation (K := K) (tick := t.val) allocation width ≤ m := + Filter.eventually_all.mpr (fun _ => eventually_ge_atTop _) + refine ⟨width, hwidth, hwidthMax, ?_⟩ + filter_upwards [AllFieldInitialChoice.eventually_nonempty (K := K) allocation hslack, + hgroups, hthresholds] with m hinitial hgroup hthreshold + exact ⟨{ initial := Classical.choice hinitial + groups := fun t sigma => Classical.choice (hgroup (t, sigma)) + threshold := hthreshold }⟩ + +def yieldRate (allocation : Allocation) (slack : ℝ) : ℝ := + AllFieldInitialEntropy.nativeH0 + AllFieldScheduledYield.physicalYield K allocation / K - + (1 + 6 * (K + 2) : ℕ) * slack / + ((K : ℝ) * denominator (K := K) allocation) + +theorem exists_family (F : Type*) [Field F] (hK : 0 < K) + (allocation : Allocation) {slack : ℝ} (hslack : 0 < slack) + (hslots : ∀ slot : Slot K, slack ≤ (denominator (K := K) allocation : ℝ) * + capacity allocation slot) : + ∃ (W : ℕ → AllFieldWitness F) (scale : ℕ → ℝ), + AllFieldRateLimit.HasRates W scale (yieldRate (K := K) allocation slack) + AllFieldTerminalRates.S (8 * Real.log 7) := by + obtain ⟨width, hwidth, _hmax, hd⟩ := exists_width_eventually_data + (K := K) allocation hslack (show (0 : ℝ) < 1 by norm_num) + have hterminal := (terminalDilation_tendsto K).eventually hd + obtain ⟨M, hM⟩ := Filter.eventually_atTop.mp + (hterminal.and (eventually_gt_atTop (0 : ℕ))) + let data (n : ℕ) : Data (K := K) allocation + (AllFieldTerminalRates.terminalDilation K (n + M)) width slack := + Classical.choice (hM (n + M) (by omega)).1 + have hn (n : ℕ) : 0 < n + M := (hM (n + M) (by omega)).2 + let W (n : ℕ) := witness (F := F) allocation width slack (n + M) + (hn n) hwidth hslots (data n) + let scale (n : ℕ) : ℝ := (K : ℝ) * + AllFieldTerminalRates.terminalLength allocation K (n + M) + refine ⟨W, scale, ?_⟩ + refine { scale_positive := ?_, yield_limit := ?_, volume_limit := ?_, rank_limit := ?_ } + · apply Eventually.of_forall + intro n + exact mul_pos (Nat.cast_pos.mpr hK) + (Nat.cast_pos.mpr (AllFieldTerminalRates.terminalLength_pos allocation (hn n))) + · have h := (selected_terminal_rate hK allocation slack hslots).comp + (tendsto_add_atTop_nat M) + apply h.congr + intro n + simp only [Function.comp_def, W, scale, witness_multiplicity] + · have h := (AllFieldTerminalRates.tendsto_terminalVolume hK allocation).comp + (tendsto_add_atTop_nat M) + apply h.congr + intro n + simp only [Function.comp_def, W, scale, witness_volume] + · have h := (source_rank_terminal_rate hK allocation width).comp + (tendsto_add_atTop_nat M) + apply h.congr + intro n + simp only [Function.comp_def, W, scale, witness_rankBound] + +theorem fixed_prescription_constraint (F : Type*) [Field F] (hK : 0 < K) + (allocation : Allocation) {slack : ℝ} (hslack : 0 < slack) + (hslots : ∀ slot : Slot K, slack ≤ (denominator (K := K) allocation : ℝ) * + capacity allocation slot) : + yieldRate (K := K) allocation slack + (Arithmetic.omega F / 3) * + AllFieldTerminalRates.S ≤ 8 * Real.log 7 := by + obtain ⟨W, scale, h⟩ := exists_family F hK allocation hslack hslots + exact AllFieldRateLimit.inequality_of_rates h + +theorem fixed_allocation_constraint (F : Type*) [Field F] (hK : 0 < K) + (allocation : Allocation) (hcapacity : ∀ slot : Slot K, 0 < capacity allocation slot) : + AllFieldInitialEntropy.nativeH0 + AllFieldScheduledYield.physicalYield K allocation / K + + (Arithmetic.omega F / 3) * AllFieldTerminalRates.S ≤ 8 * Real.log 7 := by + apply le_of_forall_pos_le_add + intro η hη + obtain ⟨slack, hslack, hslots, hloss⟩ := + exists_slack_for_loss hK allocation hcapacity hη + have h := fixed_prescription_constraint F hK allocation hslack hslots + unfold yieldRate at h + linarith + +end MatrixMultiplication.AllFieldConstructionFamily + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section + +namespace MatrixMultiplication.AllFieldOrderedLimits + +open AllFieldHistory AllFieldNativeCapacity AllFieldScheduledYield +open AllFieldConstructionRates Filter +open scoped Topology + +variable (F : Type*) [Field F] + +theorem fixed_lot_constraint (K : ℕ) (hK : 2 ≤ K) + (hgap : nativeB < nativeHigh) + (hfeas : ∀ i, nativeCstar - (nativeLA i + nativeLB i) < nativeHigh) + (ha : ∀ i, 0 < nativeLA i) (hb : ∀ i, 0 < nativeLB i) + (hc : ∀ i, 0 < nativeLC nativeLambda i) : + AllFieldInitialEntropy.nativeH0 + nativeCstar - nativeBeta / (K : ℝ) + + (Arithmetic.omega F / 3) * AllFieldTerminalRates.S ≤ 8 * Real.log 7 := by + obtain ⟨allocation, halloc⟩ := exists_balanced_allocation_sequence hgap hfeas + have hcap := eventually_capacity_pos hK allocation halloc ha hb hc + have hy := (physicalYield_tendsto_balanced K hK hgap allocation halloc).div_const (K : ℝ) + have hH0 : Tendsto (fun _ : ℕ => AllFieldInitialEntropy.nativeH0) atTop + (𝓝 AllFieldInitialEntropy.nativeH0) := tendsto_const_nhds + have hlimit := (hH0.add hy).add + (tendsto_const_nhds : Tendsto (fun _ : ℕ => + (Arithmetic.omega F / 3) * AllFieldTerminalRates.S) atTop (𝓝 _)) + have hineq : AllFieldInitialEntropy.nativeH0 + + ((K : ℝ) * nativeCstar - nativeBeta) / (K : ℝ) + + (Arithmetic.omega F / 3) * AllFieldTerminalRates.S ≤ 8 * Real.log 7 := by + apply le_of_tendsto_of_tendsto hlimit tendsto_const_nhds + filter_upwards [hcap] with j hj + exact AllFieldConstructionFamily.fixed_allocation_constraint F (by omega) + (allocation j) hj + have hk : (K : ℝ) ≠ 0 := by exact_mod_cast (show K ≠ 0 by omega) + have heq : ((K : ℝ) * nativeCstar - nativeBeta) / (K : ℝ) = + nativeCstar - nativeBeta / (K : ℝ) := by + rw [sub_div, mul_div_cancel_left₀ _ hk] + rw [heq] at hineq + linarith + +theorem native_rank_constraint + (hgap : nativeB < nativeHigh) + (hfeas : ∀ i, nativeCstar - (nativeLA i + nativeLB i) < nativeHigh) + (ha : ∀ i, 0 < nativeLA i) (hb : ∀ i, 0 < nativeLB i) + (hc : ∀ i, 0 < nativeLC nativeLambda i) : + AllFieldInitialEntropy.nativeH0 + nativeCstar + + (Arithmetic.omega F / 3) * AllFieldTerminalRates.S ≤ 8 * Real.log 7 := by + have hfixed (K : ℕ) (hK : 2 ≤ K) : + (AllFieldInitialEntropy.nativeH0 + nativeCstar) - nativeBeta / (K : ℝ) + + Arithmetic.omega F * AllFieldTerminalRates.S / 3 ≤ 8 * Real.log 7 := by + have h := fixed_lot_constraint F K hK hgap hfeas ha hb hc + nlinarith + have h := FiniteSchedule.fixed_lot_boundary_limit hfixed + nlinarith + +theorem omega_le_native_ratio + (hgap : nativeB < nativeHigh) + (hfeas : ∀ i, nativeCstar - (nativeLA i + nativeLB i) < nativeHigh) + (ha : ∀ i, 0 < nativeLA i) (hb : ∀ i, 0 < nativeLB i) + (hc : ∀ i, 0 < nativeLC nativeLambda i) + (hS : 0 < AllFieldTerminalRates.S) : + Arithmetic.omega F ≤ + 3 * (8 * Real.log 7 - + (AllFieldInitialEntropy.nativeH0 + nativeCstar)) / AllFieldTerminalRates.S := by + apply (le_div_iff₀ hS).mpr + have h := native_rank_constraint F hgap hfeas ha hb hc + nlinarith + +end MatrixMultiplication.AllFieldOrderedLimits + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/Construction/PairMarginals.lean b/lean/OAI/LinearAlgebra/MatrixFields/Construction/PairMarginals.lean new file mode 100644 index 0000000000000000000000000000000000000000..7574bd6d44d885f00380064cd07bea4038d29036 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/Construction/PairMarginals.lean @@ -0,0 +1,170 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Entropy.NativeLaws + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +noncomputable section + +namespace MatrixMultiplication.AllFieldPairMarginals + +open MatrixMultiplication.Foundation AllFieldParameters AllFieldHistory AllFieldNativeCapacity +open scoped BigOperators +attribute [local instance] Classical.propDecidable Classical.decEq + +theorem statistic_weight_mass {A : Type*} [Fintype A] + (q : A → ℝ) (weight : A → Fin 17) (own : ℕ) + (hq : ∀ a, 0 ≤ q a) (htotal : ∑ a, q a = 1) + (hweight : ∀ a, 0 < q a → (weight a).val = own) (k : Fin 17) : + (∑ a, if weight a = k then q a else 0) = if own = k.val then 1 else 0 := by + have hterm (a : A) : (if weight a = k then q a else 0) = + if own = k.val then q a else 0 := by + by_cases ha : q a = 0 + · simp only [ha, ite_self] + · have hw := hweight a (lt_of_le_of_ne (hq a) (Ne.symm ha)) + have he : weight a = k ↔ own = k.val := by rw [Fin.ext_iff, hw] + simp only [he] + simp_rw [hterm] + split_ifs <;> simp_all + +theorem pairLaw_leftWeight_mass {A : Type*} [Fintype A] + (support : List Shape) (s : Shape) (p : Shape → ℝ) (q : Shape → A → ℝ) + (side : Fin 3) (weight : A → Fin 17) + (hq : ∀ u ∈ support, ∀ a, 0 ≤ q u a) + (hleft : ∀ u ∈ support, ∑ a, q u a = 1) + (hright : ∀ u ∈ support, ∑ a, q (complement s u) a = 1) + (hweight : ∀ u ∈ support, ∀ a, 0 < q u a → (weight a).val = u side) + (k : Fin 17) : + (∑ ij : A × A, if weight ij.1 = k then pairLaw support s p q ij else 0) = + marginal support p side k := by + unfold pairLaw marginal + induction support with + | nil => simp + | cons u us ih => + have hu : u ∈ u :: us := by simp + have hw := statistic_weight_mass (q u) weight (u side) + (hq u hu) (hleft u hu) (hweight u hu) k + have hr := hright u hu + have head : (∑ ij : A × A, if weight ij.1 = k then + p u * q u ij.1 * q (complement s u) ij.2 else 0) = + if u side = k.val then p u else 0 := by + rw [Fintype.sum_prod_type] + calc + _ = ∑ a, if weight a = k then p u * q u a else 0 := by + apply Finset.sum_congr rfl + intro a _ + by_cases ha : weight a = k + · simp only [ha, ite_true, ← Finset.mul_sum, hr, mul_one] + · simp [ha] + _ = p u * (∑ a, if weight a = k then q u a else 0) := by + rw [Finset.mul_sum] + apply Finset.sum_congr rfl + intro a _ + split_ifs <;> simp + _ = _ := by rw [hw]; split_ifs <;> simp + have tail := ih (fun v hv => hq v (by simp [hv])) + (fun v hv => hleft v (by simp [hv])) + (fun v hv => hright v (by simp [hv])) + (fun v hv => hweight v (by simp [hv])) + simpa only [List.map_cons, List.sum_cons, ite_add_zero, Finset.sum_add_distrib, + head] using congrArg (fun r : ℝ => (if u side = k.val then p u else 0) + r) tail + +def statisticWeightCode (a : Fin 6) : Fin 17 := + ⟨statisticWeight a, by have := statisticWeight_le_four a; omega⟩ + +def halfWeightCode (a : PairSlot) : Fin 17 := + ⟨statisticWeight a.1 + statisticWeight a.2, by + have := statisticWeight_le_four a.1 + have := statisticWeight_le_four a.2 + omega⟩ + +@[simp] theorem statisticWeightCode_val (a : Fin 6) : + (statisticWeightCode a).val = statisticWeight a := rfl + +@[simp] theorem halfWeightCode_val (a : PairSlot) : + (halfWeightCode a).val = statisticWeight a.1 + statisticWeight a.2 := rfl + +theorem littleLaw_positive_weight (t : Shape) (ht : t ∈ positiveSecond) + (u : Shape) (hu : u ∈ below t) (side : Fin 3) (a : Fin 6) + (ha : 0 < (littleLaw t u side a : ℝ)) : (statisticWeightCode a).val = u side := by + change statisticWeight a = u side + by_contra hne + have hz := littleLaw_outside_support t u side + (child_statistic_weight_bounded t ht u hu side) a hne + have hz' : (littleLaw t u side a : ℝ) = 0 := by exact_mod_cast hz + linarith + +theorem halfLaw_positive_weight (u : Shape) (hu : u ∈ shapes 8) + (side : Fin 3) (a : PairSlot) (ha : 0 < (halfLaw u side a : ℝ)) : + (halfWeightCode a).val = u side := by + change statisticWeight a.1 + statisticWeight a.2 = u side + by_contra hne + have hz := halfLaw_outside_support u hu side a hne + have hz' : (halfLaw u side a : ℝ) = 0 := by exact_mod_cast hz + linarith + +theorem stageBPairLaw_leftWeight_mass (t : Shape) (ht : t ∈ positiveSecond) + (side : Fin 3) (k : Fin 17) : + ((stageBPairLaw t ht side).map (fun ij => statisticWeightCode ij.1)).mass k = + (stageBMarginalLaw t ht side).mass k := by + rw [FiniteLaw.map_mass] + change (∑ ij : Fin 6 × Fin 6, if statisticWeightCode ij.1 = k then + pairLaw (below t) t (fun u => (stageBLaw t u : ℝ)) + (fun u a => (littleLaw t u side a : ℝ)) ij else 0) = _ + rw [pairLaw_leftWeight_mass (below t) t (fun u => (stageBLaw t u : ℝ)) + (fun u a => (littleLaw t u side a : ℝ)) side statisticWeightCode + (fun u _ a => Rat.cast_nonneg.mpr (littleLaw_nonnegative t u side a)) + (fun u _ => (littleFiniteLaw t u side).total) + (fun u _ => (littleFiniteLaw t (complement t u) side).total) + (fun u hu a => littleLaw_positive_weight t ht u hu side a)] + exact (indexedMarginalLaw_mass _ _ _ _ _ _ k).symm + +theorem stageAPairLaw_leftWeight_mass (g : Shape) (hg : g ∈ positiveInitial) + (side : Fin 3) (k : Fin 17) : + ((stageAPairLaw g hg side).map (fun ij => halfWeightCode ij.1)).mass k = + (stageAMarginalLaw g hg side).mass k := by + rw [FiniteLaw.map_mass] + change (∑ ij : PairSlot × PairSlot, if halfWeightCode ij.1 = k then + pairLaw (below g) g (fun u => (stageALaw g u : ℝ)) + (fun u a => (halfLaw u side a : ℝ)) ij else 0) = _ + rw [pairLaw_leftWeight_mass (below g) g (fun u => (stageALaw g u : ℝ)) + (fun u a => (halfLaw u side a : ℝ)) side halfWeightCode + (fun u _ a => Rat.cast_nonneg.mpr (halfLaw_nonnegative u side a)) + (fun u hu => (halfFiniteLaw u (stageA_children_size g hg u hu) side).total) + (fun u hu => (halfFiniteLaw (complement g u) + (stageA_children_size g hg _ (stageA_support_complement g hg u hu).1) side).total) + (fun u hu a => halfLaw_positive_weight u (stageA_children_size g hg u hu) side a)] + exact (indexedMarginalLaw_mass _ _ _ _ _ _ k).symm + +private theorem law_ext {A : Type*} [Fintype A] (p q : FiniteLaw A) + (h : ∀ a, p.mass a = q.mass a) : p = q := by + cases p with + | mk p hp htotal => + cases q with + | mk q hq hqtotal => + have heq : p = q := funext h + subst q + rfl + +theorem stageBPairLaw_leftWeight_marginal (t : Shape) (ht : t ∈ positiveSecond) + (side : Fin 3) : + (stageBPairLaw t ht side).map (fun ij => statisticWeightCode ij.1) = + stageBMarginalLaw t ht side := + law_ext _ _ (stageBPairLaw_leftWeight_mass t ht side) + +theorem stageAPairLaw_leftWeight_marginal (g : Shape) (hg : g ∈ positiveInitial) + (side : Fin 3) : + (stageAPairLaw g hg side).map (fun ij => halfWeightCode ij.1) = + stageAMarginalLaw g hg side := + law_ext _ _ (stageAPairLaw_leftWeight_mass g hg side) + +end MatrixMultiplication.AllFieldPairMarginals + +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/Construction/ShapeEncoding.lean b/lean/OAI/LinearAlgebra/MatrixFields/Construction/ShapeEncoding.lean new file mode 100644 index 0000000000000000000000000000000000000000..679052ca10171cc7b795e7327a400b74fcf5ba75 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/Construction/ShapeEncoding.lean @@ -0,0 +1,238 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Entropy.StageCLaw +import OAI.LinearAlgebra.MatrixFields.Parameters.JointPopulation + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +namespace MatrixMultiplication.AllFieldHistory + +open AllFieldParameters +open scoped BigOperators + +def shapeTotal (u : Shape) : ℕ := u 0 + u 1 + u 2 + +def ShapeBounded (u : Shape) : Prop := ∀ i, u i ≤ 16 + +def encodeShape (u : Shape) (h : ShapeBounded u) : JointPopulation.Shape := + (⟨u 0, Nat.lt_succ_of_le (h 0)⟩, + ⟨u 1, Nat.lt_succ_of_le (h 1)⟩, ⟨u 2, Nat.lt_succ_of_le (h 2)⟩) + +def decodeShape (u : JointPopulation.Shape) : Shape := + fun i => (JointPopulation.shapeSide i u).val + +@[simp] theorem decode_encodeShape (u : Shape) (h : ShapeBounded u) : + decodeShape (encodeShape u h) = u := by + funext i + fin_cases i <;> rfl + +@[simp] theorem encodeShape_side (u : Shape) (h : ShapeBounded u) (i : Fin 3) : + (JointPopulation.shapeSide i (encodeShape u h)).val = u i := + congrFun (decode_encodeShape u h) i + +theorem decodeShape_bounded (u : JointPopulation.Shape) : ShapeBounded (decodeShape u) := by + intro i + have h := (JointPopulation.shapeSide i u).isLt + change (JointPopulation.shapeSide i u).val ≤ 16 + omega + +@[simp] theorem encode_decodeShape (u : JointPopulation.Shape) : + encodeShape (decodeShape u) (decodeShape_bounded u) = u := by + apply Prod.ext + · apply Fin.ext + rfl + · apply Prod.ext <;> apply Fin.ext <;> rfl + +theorem encodeShape_inj {u v : Shape} {hu : ShapeBounded u} {hv : ShapeBounded v} + (h : encodeShape u hu = encodeShape v hv) : u = v := by + simpa only [decode_encodeShape] using congrArg decodeShape h + +theorem encodeShape_injective : + Function.Injective (fun u : {u : Shape // ShapeBounded u} => encodeShape u.val u.property) := by + intro u v h + apply Subtype.ext + exact encodeShape_inj h + +@[simp] theorem encodeShape_total (u : Shape) (h : ShapeBounded u) : + (encodeShape u h).1.val + (encodeShape u h).2.1.val + + (encodeShape u h).2.2.val = shapeTotal u := rfl + +def physicalShape (phi : Equiv.Perm (Fin 3)) (u : Shape) : Shape := + fun i => u (phi.symm i) + +@[simp] theorem physicalShape_source (phi : Equiv.Perm (Fin 3)) (u : Shape) (i : Fin 3) : + physicalShape phi u (phi i) = u i := by + simp only [physicalShape, Equiv.symm_apply_apply] + +theorem physicalShape_bounded (phi : Equiv.Perm (Fin 3)) (u : Shape) + (h : ShapeBounded u) : ShapeBounded (physicalShape phi u) := + fun i => h (phi.symm i) + +theorem physicalShape_le (phi : Equiv.Perm (Fin 3)) {u v : Shape} + (h : ∀ i, v i ≤ u i) : ∀ i, physicalShape phi v i ≤ physicalShape phi u i := + fun i => h (phi.symm i) + +@[simp] theorem physicalShape_complement (phi : Equiv.Perm (Fin 3)) (u v : Shape) : + physicalShape phi (complement u v) = + complement (physicalShape phi u) (physicalShape phi v) := rfl + +theorem physicalShape_total (phi : Equiv.Perm (Fin 3)) (u : Shape) : + shapeTotal (physicalShape phi u) = shapeTotal u := by + simpa [shapeTotal, physicalShape, Fin.sum_univ_succ, Nat.add_assoc] using + (Equiv.sum_comp phi.symm u) + +theorem physicalShape_injective (phi : Equiv.Perm (Fin 3)) : + Function.Injective (physicalShape phi) := by + intro u v h + funext i + simpa only [physicalShape_source] using congrFun h (phi i) + +def encodePhysicalShape (phi : Equiv.Perm (Fin 3)) (u : Shape) (h : ShapeBounded u) : + JointPopulation.Shape := encodeShape (physicalShape phi u) (physicalShape_bounded phi u h) + +@[simp] theorem decode_encodePhysicalShape (phi : Equiv.Perm (Fin 3)) + (u : Shape) (h : ShapeBounded u) : + decodeShape (encodePhysicalShape phi u h) = physicalShape phi u := + decode_encodeShape _ _ + +@[simp] theorem encodePhysicalShape_side (phi : Equiv.Perm (Fin 3)) + (u : Shape) (h : ShapeBounded u) (i : Fin 3) : + (JointPopulation.shapeSide i (encodePhysicalShape phi u h)).val = u (phi.symm i) := + encodeShape_side _ _ i + +theorem encodePhysicalShape_inj (phi : Equiv.Perm (Fin 3)) + {u v : Shape} {hu : ShapeBounded u} {hv : ShapeBounded v} + (h : encodePhysicalShape phi u hu = encodePhysicalShape phi v hv) : u = v := + physicalShape_injective phi (encodeShape_inj h) + +theorem encodePhysicalShape_total (phi : Equiv.Perm (Fin 3)) + (u : Shape) (h : ShapeBounded u) : + (encodePhysicalShape phi u h).1.val + (encodePhysicalShape phi u h).2.1.val + + (encodePhysicalShape phi u h).2.2.val = shapeTotal u := + physicalShape_total phi u + +theorem mem_shapes_total {n : ℕ} {u : Shape} (hu : u ∈ shapes n) : shapeTotal u = n := by + simp only [shapes, List.mem_flatMap, List.mem_map, List.mem_range] at hu + obtain ⟨a, ha, b, hb, rfl⟩ := hu + change a + b + (n - a - b) = n + omega + +theorem coordinate_le_total (u : Shape) (i : Fin 3) : u i ≤ shapeTotal u := by + fin_cases i + · change u 0 ≤ u 0 + u 1 + u 2 + omega + · change u 1 ≤ u 0 + u 1 + u 2 + omega + · change u 2 ≤ u 0 + u 1 + u 2 + omega + +theorem mem_shapes_bound {n : ℕ} {u : Shape} (hu : u ∈ shapes n) (i : Fin 3) : u i ≤ n := by + simpa only [mem_shapes_total hu] using coordinate_le_total u i + +theorem mem_shapes_bounded {n : ℕ} {u : Shape} (hu : u ∈ shapes n) (hn : n ≤ 16) : + ShapeBounded u := fun i => (mem_shapes_bound hu i).trans hn + +theorem below_mem_shapes {u v : Shape} (hv : v ∈ below u) : + v ∈ shapes (shapeTotal u / 2) := (List.mem_filter.mp hv).1 + +theorem below_total {u v : Shape} (hv : v ∈ below u) : + shapeTotal v = shapeTotal u / 2 := mem_shapes_total (below_mem_shapes hv) + +theorem below_le {u v : Shape} (hv : v ∈ below u) : ∀ i, v i ≤ u i := by + have h := (List.mem_filter.mp hv).2 + have hb : v 0 ≤ u 0 ∧ v 1 ≤ u 1 ∧ v 2 ≤ u 2 := by + simpa only [Bool.and_eq_true, decide_eq_true_eq, and_assoc] using h + intro i + fin_cases i + · exact hb.1 + · exact hb.2.1 + · exact hb.2.2 + +theorem below_bounded {u v : Shape} (hu : ShapeBounded u) (hv : v ∈ below u) : + ShapeBounded v := fun i => (below_le hv i).trans (hu i) + +theorem complement_bounded {u v : Shape} (hu : ShapeBounded u) : + ShapeBounded (complement u v) := fun i => (Nat.sub_le (u i) (v i)).trans (hu i) + +theorem complement_total {u v : Shape} (h : ∀ i, v i ≤ u i) : + shapeTotal (complement u v) = shapeTotal u - shapeTotal v := by + have h0 := h 0 + have h1 := h 1 + have h2 := h 2 + simp only [shapeTotal, complement] + omega + +theorem root_shape_spec (s : Shape) (hs : s ∈ sortedInitial) : + ShapeBounded s ∧ shapeTotal s = 16 := by + have hm : s ∈ shapes 16 := (List.mem_filter.mp hs).1 + exact ⟨mem_shapes_bounded hm (by omega), mem_shapes_total hm⟩ + +theorem root_shapes_nodup : sortedInitial.Nodup := by decide +kernel + +theorem stageA_below_nodup : ∀ s ∈ positiveInitial, (below s).Nodup := by + decide +kernel + +theorem stageB_below_nodup : ∀ t ∈ positiveSecond, (below t).Nodup := by + decide +kernel + +theorem stageA_get_injective (s : Shape) (hs : s ∈ positiveInitial) : + Function.Injective (below s).get := + List.nodup_iff_injective_get.mp (stageA_below_nodup s hs) + +theorem stageB_get_injective (t : Shape) (ht : t ∈ positiveSecond) : + Function.Injective (below t).get := + List.nodup_iff_injective_get.mp (stageB_below_nodup t ht) + +theorem positiveInitial_shape_spec (s : Shape) (hs : s ∈ positiveInitial) : + ShapeBounded s ∧ shapeTotal s = 16 := + root_shape_spec s (List.mem_filter.mp hs).1 + +theorem positiveSecond_shape_spec (t : Shape) (ht : t ∈ positiveSecond) : + ShapeBounded t ∧ shapeTotal t = 8 := by + have hm : t ∈ shapes 8 := (List.mem_filter.mp ht).1 + exact ⟨mem_shapes_bounded hm (by omega), mem_shapes_total hm⟩ + +theorem stageA_shape_spec (s t : Shape) (hs : s ∈ positiveInitial) (ht : t ∈ below s) : + ShapeBounded t ∧ shapeTotal t = 8 := by + obtain ⟨hb, hsum⟩ := positiveInitial_shape_spec s hs + exact ⟨below_bounded hb ht, by simpa only [hsum] using below_total ht⟩ + +theorem stageA_complement_spec (s t : Shape) (hs : s ∈ positiveInitial) + (ht : t ∈ below s) : ShapeBounded (complement s t) ∧ shapeTotal (complement s t) = 8 := by + obtain ⟨hb, hsum⟩ := positiveInitial_shape_spec s hs + obtain ⟨_, hchild⟩ := stageA_shape_spec s t hs ht + exact ⟨complement_bounded hb, by rw [complement_total (below_le ht), hsum, hchild]⟩ + +theorem stageB_shape_spec (t u : Shape) (ht : t ∈ positiveSecond) (hu : u ∈ below t) : + ShapeBounded u ∧ shapeTotal u = 4 := by + obtain ⟨hb, hsum⟩ := positiveSecond_shape_spec t ht + exact ⟨below_bounded hb hu, by simpa only [hsum] using below_total hu⟩ + +theorem stageB_complement_spec (t u : Shape) (ht : t ∈ positiveSecond) + (hu : u ∈ below t) : ShapeBounded (complement t u) ∧ shapeTotal (complement t u) = 4 := by + obtain ⟨hb, hsum⟩ := positiveSecond_shape_spec t ht + obtain ⟨_, hchild⟩ := stageB_shape_spec t u ht hu + exact ⟨complement_bounded hb, by rw [complement_total (below_le hu), hsum, hchild]⟩ + +theorem stageC_shape_spec (u : Shape) (hu : u ∈ shapes 4) (hpos : positive u = true) + (i : Fin 4) : ShapeBounded (stageCAtom u i) ∧ shapeTotal (stageCAtom u i) = 2 := by + have hi := stageCAtom_mem u hu hpos i + exact ⟨below_bounded (mem_shapes_bounded hu (by omega)) hi, + by simpa only [mem_shapes_total hu] using below_total hi⟩ + +theorem stageC_complement_spec (u : Shape) (hu : u ∈ shapes 4) (hpos : positive u = true) + (i : Fin 4) : ShapeBounded (complement u (stageCAtom u i)) ∧ + shapeTotal (complement u (stageCAtom u i)) = 2 := by + have hi := stageCAtom_mem u hu hpos i + obtain ⟨_, hchild⟩ := stageC_shape_spec u hu hpos i + exact ⟨complement_bounded (mem_shapes_bounded hu (by omega)), + by rw [complement_total (below_le hi), mem_shapes_total hu, hchild]⟩ + +end MatrixMultiplication.AllFieldHistory + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/Construction/Subdivision.lean b/lean/OAI/LinearAlgebra/MatrixFields/Construction/Subdivision.lean new file mode 100644 index 0000000000000000000000000000000000000000..2bffbfd9c1e6d45742d10531378088a218558de2 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/Construction/Subdivision.lean @@ -0,0 +1,251 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Histories.InheritedMaskMargins + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section + +namespace MatrixMultiplication.Subdivision + +open MatrixMultiplication.Foundation InheritedMasks +open scoped BigOperators + +attribute [local instance] Classical.propDecidable + +variable {I : Type*} [Fintype I] [DecidableEq I] + (P : I → Type*) [∀ i, Fintype (P i)] [∀ i, DecidableEq (P i)] + +def concatenate {X : Type*} (w : ∀ i, P i → X) : (Σ i, P i) → X := + fun p => w p.1 p.2 + +def concatenateEquiv (X : Type*) : (∀ i, P i → X) ≃ ((Σ i, P i) → X) where + toFun := concatenate P + invFun := fun w i p => w ⟨i, p⟩ + left_inv := by intro w; rfl + right_inv := by intro w; rfl + +section Windows + +variable {A : Type*} [Fintype A] [DecidableEq A] + +omit [DecidableEq I] [∀ index, DecidableEq (P index)] [Fintype A] in +theorem wordPopulation_concatenate (w : ∀ i, P i → A) (a : A) : + wordPopulation (concatenate P w) a = ∑ i, wordPopulation (w i) a := by + let e : {p : (Σ i, P i) // concatenate P w p = a} ≃ + (Σ i, {p : P i // w i p = a}) := + { toFun := fun p => ⟨p.val.1, ⟨p.val.2, p.property⟩⟩ + invFun := fun p => ⟨⟨p.1, p.2.val⟩, p.2.property⟩ + left_inv := by intro p; rfl + right_inv := by intro p; rfl } + exact (Fintype.card_congr e).trans Fintype.card_sigma + +omit [DecidableEq I] [∀ index, DecidableEq (P index)] [Fintype A] in +theorem empiricalLaw_concatenate (w : ∀ i, P i → A) (a : A) : + empiricalLaw (concatenate P w) a = + ∑ i, ((Fintype.card (P i) : ℝ) / Fintype.card (Σ i, P i)) * + empiricalLaw (w i) a := by + rw [empiricalLaw, wordPopulation_concatenate, Nat.cast_sum, Finset.sum_div] + apply Finset.sum_congr rfl + intro i _ + by_cases hi : Fintype.card (P i) = 0 + · have hp : wordPopulation (w i) a = 0 := by + have hle := Fintype.card_subtype_le (fun p : P i => w i p = a) + change wordPopulation (w i) a ≤ Fintype.card (P i) at hle + omega + simp [hi, hp] + · have hi' : (Fintype.card (P i) : ℝ) ≠ 0 := Nat.cast_ne_zero.mpr hi + simp only [empiricalLaw, div_eq_mul_inv] + calc + (wordPopulation (w i) a : ℝ) * (Fintype.card (Σ i, P i) : ℝ)⁻¹ = + (wordPopulation (w i) a : ℝ) * (Fintype.card (Σ i, P i) : ℝ)⁻¹ * + ((Fintype.card (P i) : ℝ) * (Fintype.card (P i) : ℝ)⁻¹) := by + rw [mul_inv_cancel₀ hi', mul_one] + _ = (Fintype.card (P i) : ℝ) * (Fintype.card (Σ i, P i) : ℝ)⁻¹ * + ((wordPopulation (w i) a : ℝ) * (Fintype.card (P i) : ℝ)⁻¹) := by ring + +def partWindows (ν : A → ℝ) (η : I → ℝ) (w : ∀ i, P i → A) : Prop := + ∀ i, 0 < Fintype.card (P i) → typeWindow ν (η i) (w i) + +omit [DecidableEq I] [∀ index, DecidableEq (P index)] [Fintype A] in +theorem typeWindow_concatenate (ν : A → ℝ) (η : ℝ) (ηpart : I → ℝ) + (hη : 0 ≤ η) (hwidth : ∀ i, ηpart i ≤ η) + (hsize : 0 < Fintype.card (Σ i, P i)) (w : ∀ i, P i → A) + (hw : partWindows P ν ηpart w) : typeWindow ν η (concatenate P w) := by + intro a + let mass : I → ℝ := fun i => (Fintype.card (P i) : ℝ) / Fintype.card (Σ i, P i) + let law : I → ℝ := fun i => + if Fintype.card (P i) = 0 then ν a else empiricalLaw (w i) a + have hm : ∀ i, 0 ≤ mass i := fun i => div_nonneg (Nat.cast_nonneg _) (Nat.cast_nonneg _) + have hsum : ∑ i, mass i = 1 := by + dsimp [mass] + rw [← Finset.sum_div, ← Nat.cast_sum, ← Fintype.card_sigma] + exact div_self (by exact_mod_cast (Nat.ne_of_gt hsize)) + have hl : ∀ i, |law i - ν a| ≤ η := by + intro i + by_cases hi : Fintype.card (P i) = 0 + · simpa [law, hi] using hη + · simpa only [law, ite_eq_right hi] using + (hw i (Nat.pos_of_ne_zero hi) a).trans (hwidth i) + have heq : empiricalLaw (concatenate P w) a = ∑ i, mass i * law i := by + rw [empiricalLaw_concatenate] + apply Finset.sum_congr rfl + intro i _ + by_cases hi : Fintype.card (P i) = 0 <;> simp [mass, law, hi] + rw [heq] + exact weighted_window mass law (ν a) η hm hsum hl + +omit [DecidableEq I] [∀ index, DecidableEq (P index)] [Fintype A] in +theorem statisticWindow_concatenate {X : Type*} (statistic : X → A) + (ν : A → ℝ) (η : ℝ) (ηpart : I → ℝ) + (hη : 0 ≤ η) (hwidth : ∀ i, ηpart i ≤ η) + (hsize : 0 < Fintype.card (Σ i, P i)) (w : ∀ i, P i → X) + (hw : partWindows P ν ηpart (fun i => statistic ∘ w i)) : + typeWindow ν η (statistic ∘ concatenate P w) := by + exact typeWindow_concatenate P ν η ηpart hη hwidth hsize + (fun index => statistic ∘ w index) hw + +end Windows + +def positionsOfCounts (count : I → ℕ) (n : ℕ) (hsum : ∑ i, count i = n) : + Fin n ≃ (Σ i, Fin (count i)) := + Fintype.equivOfCardEq (by simp only [Fintype.card_fin, Fintype.card_sigma, hsum]) + +theorem typeWindow_reindex {A Q R : Type*} + [Fintype A] [DecidableEq A] [Fintype Q] [DecidableEq Q] + [Fintype R] [DecidableEq R] + (ν : A → ℝ) (η : ℝ) (w : R → A) (e : Q ≃ R) : + typeWindow ν η (w ∘ e) ↔ typeWindow ν η w := by + simp only [typeWindow, empiricalLaw, wordPopulation_reindex, Fintype.card_congr e] + +omit [DecidableEq I] [∀ index, DecidableEq (P index)] in +theorem statisticWindow_concatenate_at {A X Q : Type*} + [Fintype A] [DecidableEq A] [Fintype Q] [DecidableEq Q] + (e : Q ≃ (Σ i, P i)) (statistic : X → A) + (ν : A → ℝ) (η : ℝ) (ηpart : I → ℝ) + (hη : 0 ≤ η) (hwidth : ∀ i, ηpart i ≤ η) + (hsize : 0 < Fintype.card (Σ i, P i)) (w : ∀ i, P i → X) + (hw : partWindows P ν ηpart (fun i => statistic ∘ w i)) : + typeWindow ν η (statistic ∘ (concatenate P w ∘ e)) := by + change typeWindow ν η ((statistic ∘ concatenate P w) ∘ e) + exact (typeWindow_reindex ν η _ e).mpr + (statisticWindow_concatenate P statistic ν η ηpart hη hwidth hsize w hw) + +section Coefficients + +variable {F X Y Z : Type*} [CommSemiring F] + [Fintype X] [Fintype Y] [Fintype Z] + +def repeated (Q : Type*) [Fintype Q] (T : Tensor F X Y Z) : + Tensor F (Q → X) (Q → Y) (Q → Z) := fun x y z => ∏ p, T (x p) (y p) (z p) + +def allParts {U : Type*} (keep : ∀ i, (P i → U) → Prop) (w : ∀ i, P i → U) : Prop := + ∀ i, keep i (w i) + +def subdivisionMatrix {U : Type*} (keep : ∀ i, (P i → U) → Prop) : + (∀ i, P i → U) → ((Σ i, P i) → U) → F := + fun w v => if v = concatenate P w ∧ allParts P keep w then 1 else 0 + +theorem subdivisionMatrix_apply (T : Tensor F ((Σ i, P i) → X) + ((Σ i, P i) → Y) ((Σ i, P i) → Z)) + (keepX : ∀ i, (P i → X) → Prop) (keepY : ∀ i, (P i → Y) → Prop) + (keepZ : ∀ i, (P i → Z) → Prop) + (x : ∀ i, P i → X) (y : ∀ i, P i → Y) (z : ∀ i, P i → Z) : + Tensor.restrict (subdivisionMatrix P keepX) (subdivisionMatrix P keepY) + (subdivisionMatrix P keepZ) T x y z = + if allParts P keepX x ∧ allParts P keepY y ∧ allParts P keepZ z then + T (concatenate P x) (concatenate P y) (concatenate P z) else 0 := by + by_cases hx : allParts P keepX x <;> + by_cases hy : allParts P keepY y <;> + by_cases hz : allParts P keepZ z <;> + simp [Tensor.restrict, subdivisionMatrix, hx, hy, hz, ite_mul, mul_ite] + +theorem restrict_received (T : Tensor F X Y Z) + (receivedX : ((Σ i, P i) → X) → Prop) + (receivedY : ((Σ i, P i) → Y) → Prop) + (receivedZ : ((Σ i, P i) → Z) → Prop) + (keepX : ∀ i, (P i → X) → Prop) (keepY : ∀ i, (P i → Y) → Prop) + (keepZ : ∀ i, (P i → Z) → Prop) + (hx : ∀ x, allParts P keepX x → receivedX (concatenate P x)) + (hy : ∀ y, allParts P keepY y → receivedY (concatenate P y)) + (hz : ∀ z, allParts P keepZ z → receivedZ (concatenate P z)) : + Tensor.restrict (subdivisionMatrix P keepX) (subdivisionMatrix P keepY) + (subdivisionMatrix P keepZ) + (ExactRecovery.delete (repeated (Σ i, P i) T) receivedX receivedY receivedZ) = + fun x y z => ∏ i, ExactRecovery.delete (repeated (P i) T) + (keepX i) (keepY i) (keepZ i) (x i) (y i) (z i) := by + funext x y z + rw [subdivisionMatrix_apply] + simp only [ExactRecovery.delete, Fintype.prod_ite_zero, forall_and] + by_cases h : allParts P keepX x ∧ allParts P keepY y ∧ allParts P keepZ z + · have hX := hx x h.1 + have hY := hy y h.2.1 + have hZ := hz z h.2.2 + have hp : (∀ i, keepX i (x i)) ∧ (∀ i, keepY i (y i)) ∧ + (∀ i, keepZ i (z i)) := h + simp only [ite_eq_left h, ite_eq_left hp, hX, hY, hZ, and_self, ite_true] + simp only [repeated, concatenate, Fintype.prod_sigma] + · simp only [allParts] at h + simp [allParts, h] + +def subdivisionMatrixAt {U Q : Type*} (e : Q ≃ (Σ i, P i)) + (keep : ∀ i, (P i → U) → Prop) : + (∀ i, P i → U) → (Q → U) → F := + fun w v => if v = concatenate P w ∘ e ∧ allParts P keep w then 1 else 0 + +omit [DecidableEq I] [∀ index, DecidableEq (P index)] in +theorem restrict_received_at {Q : Type*} [Fintype Q] [DecidableEq Q] + (e : Q ≃ (Σ i, P i)) (T : Tensor F X Y Z) + (receivedX : (Q → X) → Prop) (receivedY : (Q → Y) → Prop) + (receivedZ : (Q → Z) → Prop) + (keepX : ∀ i, (P i → X) → Prop) (keepY : ∀ i, (P i → Y) → Prop) + (keepZ : ∀ i, (P i → Z) → Prop) + (hx : ∀ x, allParts P keepX x → receivedX (concatenate P x ∘ e)) + (hy : ∀ y, allParts P keepY y → receivedY (concatenate P y ∘ e)) + (hz : ∀ z, allParts P keepZ z → receivedZ (concatenate P z ∘ e)) : + Tensor.restrict (subdivisionMatrixAt P e keepX) (subdivisionMatrixAt P e keepY) + (subdivisionMatrixAt P e keepZ) + (ExactRecovery.delete (repeated Q T) receivedX receivedY receivedZ) = + fun x y z => ∏ i, ExactRecovery.delete (repeated (P i) T) + (keepX i) (keepY i) (keepZ i) (x i) (y i) (z i) := by + funext x y z + have hcollapse : Tensor.restrict (subdivisionMatrixAt P e keepX) + (subdivisionMatrixAt P e keepY) (subdivisionMatrixAt P e keepZ) + (ExactRecovery.delete (repeated Q T) receivedX receivedY receivedZ) x y z = + if allParts P keepX x ∧ allParts P keepY y ∧ allParts P keepZ z then + ExactRecovery.delete (repeated Q T) receivedX receivedY receivedZ + (concatenate P x ∘ e) (concatenate P y ∘ e) (concatenate P z ∘ e) else 0 := by + by_cases hx : allParts P keepX x <;> + by_cases hy : allParts P keepY y <;> + by_cases hz : allParts P keepZ z <;> + simp [Tensor.restrict, subdivisionMatrixAt, hx, hy, hz, ite_mul, mul_ite] + rw [hcollapse] + simp only [ExactRecovery.delete, Fintype.prod_ite_zero, forall_and] + by_cases h : allParts P keepX x ∧ allParts P keepY y ∧ allParts P keepZ z + · have hX := hx x h.1 + have hY := hy y h.2.1 + have hZ := hz z h.2.2 + have hp : (∀ i, keepX i (x i)) ∧ (∀ i, keepY i (y i)) ∧ + (∀ i, keepZ i (z i)) := h + simp only [ite_eq_left h, ite_eq_left hp, hX, hY, hZ, and_self, ite_true, repeated, + Function.comp_apply] + have hprod := Equiv.prod_comp e (fun p => + T (concatenate P x p) (concatenate P y p) (concatenate P z p)) + simpa only [concatenate, Fintype.prod_sigma] using hprod + · simp only [allParts] at h + simp [allParts, h] + +end Coefficients + +end MatrixMultiplication.Subdivision + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/Construction/ZeroFinish.lean b/lean/OAI/LinearAlgebra/MatrixFields/Construction/ZeroFinish.lean new file mode 100644 index 0000000000000000000000000000000000000000..c7c731a9efdbafb57c03834c670bfae5f67ad3cc --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/Construction/ZeroFinish.lean @@ -0,0 +1,345 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Entropy.TerminalRates +import OAI.LinearAlgebra.MatrixFields.Parameters.ParametersHalfComplement +import OAI.LinearAlgebra.MatrixFields.Tensors.CWZeroGeometry + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +noncomputable section +namespace MatrixMultiplication.AllFieldZeroWords +open MatrixMultiplication.Foundation AllFieldParameters AllFieldHistory +open AllFieldTerminalStatisticLaws AllFieldTerminalRates CWWindowedLeaves +open CWCompleteStatistics InheritedMasks +open scoped BigOperators +attribute [local instance] Classical.propDecidable +variable {K : ℕ} + +def length (h : TerminalZero K) : ℕ := currentLength (history h).1 +def shape (h : TerminalZero K) : Shape := currentShape (history h).1 + +def statistic : (h : TerminalZero K) → Raw (length h) → Slot h + | .inl _, w => fourStatistic w + | .inr _, w => twoStatistic w + +def complement : (h : TerminalZero K) → Slot h ≃ Slot h + | .inl _ => orderedComplementStatistic + | .inr _ => complementStatistic + +theorem statistic_complement (h : TerminalZero K) (w : Raw (length h)) : + statistic h (complementWord w) = complement h (statistic h w) := by + cases h with + | inl h => exact four_complement w + | inr h => exact two_complement w + +def words (allocation : Allocation) (m : ℕ) (h : TerminalZero K) + (w : ZeroWords allocation m h) : + Fin (population allocation (terminalDilation K m) (history h)) → + Alphabet (length h) (shapeMax (shape h)) := by + cases h with + | inl h => + exact fun i => w.val ((finCongr (statisticCounts_repeat_sum allocation m (.inl h))).symm i) + | inr h => + exact fun i => w.val ((finCongr (statisticCounts_repeat_sum allocation m (.inr h))).symm i) + +theorem words_injective (allocation : Allocation) (m : ℕ) (h : TerminalZero K) : + Function.Injective (words allocation m h) := by + cases h with + | inl h => + intro x y he + apply Subtype.ext + exact (finCongr (statisticCounts_repeat_sum allocation m (.inl h))).symm.surjective.injective_comp_right he + | inr h => + intro x y he + apply Subtype.ext + exact (finCongr (statisticCounts_repeat_sum allocation m (.inr h))).symm.surjective.injective_comp_right he + +theorem repeat_ratio (allocation : Allocation) {m : ℕ} (hm : 0 < m) + (h : TerminalZero K) (s : Slot h) : + ((m * statisticCounts allocation h s : ℕ) : ℝ) / + (∑ s, m * statisticCounts allocation h s : ℕ) = (law h s : ℝ) := by + have hm' : (m : ℝ) ≠ 0 := by exact_mod_cast Nat.ne_of_gt hm + simp only [← Finset.mul_sum, Nat.cast_mul, mul_div_mul_left _ _ hm'] + exact statisticCounts_ratio allocation h s + +private theorem exact_window_reindex {Slots Letters : Type*} + [Fintype Slots] [DecidableEq Slots] (stat : Letters → Slots) (counts : Slots → ℕ) + (word : ExactStatisticWords.Words stat counts) (ν : Slots → ℝ) (η : ℝ) + (hη : 0 ≤ η) (hratio : ∀ slot, (counts slot : ℝ) / (∑ slot, counts slot : ℕ) = ν slot) + {positions : ℕ} (reindex : Fin positions ≃ Fin (∑ slot, counts slot)) : + typeWindow ν η ((stat ∘ word.val) ∘ reindex) := by + intro slot + simp only [empiricalLaw, wordPopulation_reindex, word.property, + Fintype.card_congr reindex, Fintype.card_fin, hratio slot, sub_self, abs_zero] + exact hη + +theorem selected_window (allocation : Allocation) {m : ℕ} (hm : 0 < m) + (h : TerminalZero K) (η : ℝ) (hη : 0 ≤ η) (w : ZeroWords allocation m h) : + typeWindow (fun s => (law h s : ℝ)) η + (fun i => statistic h (words allocation m h w i).val) := by + cases h with + | inl h => + change AllFieldZeroLeafRates.fourWords (aShape h.1.val) + (statisticCounts allocation (.inl h)) m at w + intro s + change PairSlot at s + have hsum := statisticCounts_repeat_sum allocation m (.inl h) + let reindex : Fin (population allocation (terminalDilation K m) (history (.inl h))) ≃ + Fin (∑ slot : PairSlot, m * statisticCounts allocation (.inl h) slot) := + (finCongr hsum).symm + have hwindow := exact_window_reindex _ _ w + (fun slot : PairSlot => (law (.inl h) slot : ℝ)) η hη + (fun slot => repeat_ratio allocation hm (.inl h) slot) reindex s + let : DecidableEq PairSlot := fun _ _ => Classical.propDecidable _ + change |empiricalLaw ((fun index => fourStatistic (w.val index).val) ∘ reindex) s - + (law (.inl h) s : ℝ)| ≤ η + simpa only [empiricalLaw, wordPopulation, Fintype.card_eq_nat_card, + Function.comp_def] using hwindow + | inr h => + change AllFieldZeroLeafRates.twoWords (bWeight h) + (statisticCounts allocation (.inr h)) m at w + intro s + change Fin 6 at s + have hsum := statisticCounts_repeat_sum allocation m (.inr h) + let reindex : Fin (population allocation (terminalDilation K m) (history (.inr h))) ≃ + Fin (∑ slot : Fin 6, m * statisticCounts allocation (.inr h) slot) := + (finCongr hsum).symm + have hwindow := exact_window_reindex _ _ w + (fun slot : Fin 6 => (law (.inr h) slot : ℝ)) η hη + (fun slot => repeat_ratio allocation hm (.inr h) slot) reindex s + let : DecidableEq (Fin 6) := fun _ _ => Classical.propDecidable _ + change |empiricalLaw ((fun index => twoStatistic (w.val index).val) ∘ reindex) s - + (law (.inr h) s : ℝ)| ≤ η + simpa only [empiricalLaw, wordPopulation, Fintype.card_eq_nat_card, + Function.comp_def] using hwindow + +theorem complementary_window (allocation : Allocation) {m : ℕ} (hm : 0 < m) + (h : TerminalZero K) (η : ℝ) (hη : 0 ≤ η) (w : ZeroWords allocation m h) : + typeWindow ((fun s => (law h s : ℝ)) ∘ (complement h).symm) η + (fun i => statistic h (complementWord (words allocation m h w i).val)) := by + have hs := selected_window allocation hm h η hη w + have he : (fun i => statistic h (complementWord (words allocation m h w i).val)) = + complement h ∘ (fun i => statistic h (words allocation m h w i).val) := by + funext i + exact statistic_complement h _ + rw [he] + exact (typeWindow_equiv _ η _ (complement h)).mpr hs + +end MatrixMultiplication.AllFieldZeroWords + +namespace MatrixMultiplication.AllFieldZeroFinish +open MatrixMultiplication.Foundation AllFieldParameters AllFieldHistory +open AllFieldTerminalStatisticLaws AllFieldTerminalRates AllFieldZeroWords +open CWWindowedLeaves CWCompleteStatistics CWZeroGeometry CWOrientedZero +open AllFieldFiniteFamily InheritedMasks +open scoped BigOperators +attribute [local instance] Classical.propDecidable +variable {K : ℕ} + +def canonicalZero (h : TerminalZero K) : Fin 3 := zeroAxis (shape h) +def canonicalSelected : TerminalZero K → Fin 3 + | .inl h => halfMaxAxis (aShape h.1.val) + | .inr h => maxAxis (bShape h.1.val) +def physicalZero (h : TerminalZero K) : Fin 3 := (history h).2 (canonicalZero h) +def physicalSelected (h : TerminalZero K) : Fin 3 := (history h).2 (canonicalSelected h) + +theorem shape_has_zero (h : TerminalZero K) : ∃ s, shape h s = 0 := by + cases h with + | inl h => exact not_positive_has_zero _ (aShape_not_positive h) + | inr h => exact not_positive_has_zero _ h.1.property + +theorem canonicalZero_spec (h : TerminalZero K) : shape h (canonicalZero h) = 0 := + zeroAxis_spec (shape h) (shape_has_zero h) + +theorem canonicalSelected_spec (h : TerminalZero K) : + shape h (canonicalSelected h) = shapeMax (shape h) := by + cases h with + | inl h => exact halfMaxAxis_spec _ (aShape_mem_shapes h) + | inr h => exact maxAxis_spec _ + +theorem shape_total (h : TerminalZero K) : shapeTotal (shape h) = 2 * length h := + (currentShape_spec (history h).1).2 + +theorem shape_total_pos (h : TerminalZero K) : 0 < shapeTotal (shape h) := by + rw [shape_total] + cases h <;> norm_num [length, history, currentLength] + +theorem axes_distinct (h : TerminalZero K) : canonicalZero h ≠ canonicalSelected h := + zero_ne_selected (shape h) _ _ (shape_total_pos h) + (canonicalZero_spec h) (canonicalSelected_spec h) + +theorem physical_axes_distinct (h : TerminalZero K) : physicalZero h ≠ physicalSelected h := + (history h).2.injective.ne (axes_distinct h) + +theorem physical_shape (h : TerminalZero K) : + currentPhysicalShape (history h) = placedShape (physicalZero h) (physicalSelected h) + (shapeMax (shape h)) (shapeTotal (shape h) - shapeMax (shape h)) := + physicalShape_eq_placedShape (shape h) (history h).2 _ _ + (canonicalZero_spec h) (canonicalSelected_spec h) (axes_distinct h) + +def nativeLaw : (h : TerminalZero K) → Fin 3 → Slot h → ℚ + | .inl h, side => halfLaw (aShape h.1.val) side + | .inr h, side => littleLaw (bParent h) (bShape h.1.val) side + +theorem selected_law (h : TerminalZero K) (s : Slot h) : + nativeLaw h (canonicalSelected h) s = law h s := by + cases h with + | inl h => exact halfLaw_at_maximum _ (aShape_mem_zeroSecond h) s + | inr h => + change Fin 6 at s + change littleLaw (bParent h) (bShape h.1.val) (maxAxis (bShape h.1.val)) s = _ + rw [littleLaw_eq_statisticLaw _ _ _ (child_statistic_weight_bounded _ + (bParent_mem_positiveSecond h) _ (bShape_mem_below h) _)] + congr 1 + apply Fin.ext + exact maxAxis_spec _ + +theorem zero_law (h : TerminalZero K) (s : Slot h) : + nativeLaw h (canonicalZero h) s = + if statistic h (zeroWord (length h)) = s then 1 else 0 := by + have hz := canonicalZero_spec h + cases h with + | inl h => + change PairSlot at s + let : DecidableEq PairSlot := fun _ _ => Classical.propDecidable _ + change halfLaw (aShape h.1.val) (canonicalZero (.inl h)) s = + if ((0, 0) : PairSlot) = s then 1 else 0 + rw [halfLaw_weight_zero _ (aShape_mem_shapes h) _ hz s] + by_cases hs : s = (0,0) + · rw [ite_eq_left hs, ite_eq_left hs.symm] + · rw [ite_eq_right hs, ite_eq_right (Ne.symm hs)] + | inr h => + change Fin 6 at s + let : DecidableEq (Fin 6) := fun _ _ => Classical.propDecidable _ + change bShape h.1.val (canonicalZero (.inr h)) = 0 at hz + change littleLaw (bParent h) (bShape h.1.val) (canonicalZero (.inr h)) s = + if (0 : Fin 6) = s then 1 else 0 + simp only [littleLaw, hz, show (0 : ℕ) ≠ 2 from by decide, ite_false, singletonSlot] + by_cases hs : s = 0 + · simp [hs] + · simp [hs, Ne.symm hs] + +theorem remaining_law (h : TerminalZero K) (side : Fin 3) + (hz : side ≠ canonicalZero h) (hs : side ≠ canonicalSelected h) (s : Slot h) : + nativeLaw h side s = law h ((AllFieldZeroWords.complement h).symm s) := by + have hsum := selected_add_remaining (shape h) (canonicalZero h) (canonicalSelected h) side + (canonicalZero_spec h) (canonicalSelected_spec h) (axes_distinct h) hz hs + have he : nativeLaw h (canonicalSelected h) ((AllFieldZeroWords.complement h).symm s) = + nativeLaw h side s := by + cases h with + | inl h => + exact halfLaw_complementary_sides _ (aShape_mem_shapes h) _ _ (Ne.symm hs) + (hsum.trans (shape_total (.inl h))) s + | inr h => + exact littleLaw_complement _ _ _ _ + (child_statistic_weight_bounded _ (bParent_mem_positiveSecond h) _ (bShape_mem_below h) _) + (child_statistic_weight_bounded _ (bParent_mem_positiveSecond h) _ (bShape_mem_below h) _) + (hsum.trans (shape_total (.inr h))) s + rw [selected_law] at he + exact he.symm + +def embed (allocation : Allocation) (m : ℕ) (h : TerminalZero K) + (side : Fin 3) (w : ZeroWords allocation m h) : + HistoryWord allocation (terminalDilation K m) (history h) := + fun i => sideWord (physicalZero h) (physicalSelected h) side (words allocation m h w i) + +theorem embed_window (allocation : Allocation) {m : ℕ} (hm : 0 < m) + (h : TerminalZero K) (side : Fin 3) (η : ℝ) (hη : 0 ≤ η) + (w : ZeroWords allocation m h) : + typeWindow (fun s => (nativeLaw h ((history h).2.symm side) s : ℝ)) η + (fun i => statistic h (embed allocation m h side w i)) := by + by_cases hz : side = physicalZero h + · have hc : (history h).2.symm side = canonicalZero h := by + simp only [hz, physicalZero, Equiv.symm_apply_apply] + simp only [embed, sideWord, ite_eq_left hz, hc] + have hpop : 0 < population allocation (terminalDilation K m) (history h) := by + rw [← statisticCounts_repeat_sum allocation m h, ← Finset.mul_sum] + exact Nat.mul_pos hm (statisticCounts_pos allocation h) + apply zero_window (length h) _ hpop (statistic h) _ η hη + intro s + rw [zero_law] + split_ifs <;> norm_num + · by_cases hs : side = physicalSelected h + · have hc : (history h).2.symm side = canonicalSelected h := by + simp only [hs, physicalSelected, Equiv.symm_apply_apply] + simpa only [embed, sideWord, ite_eq_right hz, ite_eq_left hs, hc, selected_law] using + selected_window allocation hm h η hη w + · have hcz : (history h).2.symm side ≠ canonicalZero h := by + intro hh + apply hz + exact ((history h).2.apply_symm_apply side).symm.trans (congrArg (history h).2 hh) + have hcs : (history h).2.symm side ≠ canonicalSelected h := by + intro hh + apply hs + exact ((history h).2.apply_symm_apply side).symm.trans (congrArg (history h).2 hh) + simp only [embed, sideWord, ite_eq_right hz, ite_eq_right hs, remaining_law h _ hcz hcs] + exact complementary_window allocation hm h η hη w + +theorem embed_mask (allocation : Allocation) {m : ℕ} (hm : 0 < m) + {ε : ℝ} (hε : 0 ≤ ε) (h : TerminalZero K) (side : Fin 3) + (w : ZeroWords allocation m h) : + residentMask allocation (terminalDilation K m) ε (history h) side + (embed allocation m h side w) := by + cases h with + | inl h => + intro _ + exact embed_window allocation hm (.inl h) side (ε/8) (by positivity) w + | inr h => + intro _ + exact embed_window allocation hm (.inr h) side (ε/128) (by positivity) w + +variable (F : Type*) [Field F] + +theorem coefficient (allocation : Allocation) {m : ℕ} (hm : 0 < m) + {ε : ℝ} (hε : 0 ≤ ε) (h : TerminalZero K) (x y z : ZeroWords allocation m h) : + historyTensor F allocation (terminalDilation K m) ε (history h) + (embed allocation m h 0 x) (embed allocation m h 1 y) (embed allocation m h 2 z) = + if matched (physicalZero h) x y z then 1 else 0 := by + simp only [historyTensor, ExactRecovery.delete, embed_mask allocation hm hε, + and_self, ite_true] + rw [physical_shape] + exact power_coefficient F (length h) _ _ _ + ((max_add_complement (shape h)).trans (shape_total h)) + (physicalZero h) (physicalSelected h) (physical_axes_distinct h) + (words allocation m h) (words_injective allocation m h) x y z + +abbrev Row (allocation : Allocation) (m : ℕ) (h : TerminalZero K) := + CWOrientedZero.Row (physicalZero h) (ZeroWords allocation m h) +abbrev Middle (allocation : Allocation) (m : ℕ) (h : TerminalZero K) := + CWOrientedZero.Middle (physicalZero h) (ZeroWords allocation m h) +abbrev Column (allocation : Allocation) (m : ℕ) (h : TerminalZero K) := + CWOrientedZero.Column (physicalZero h) (ZeroWords allocation m h) + +def localMap (allocation : Allocation) {m : ℕ} (hm : 0 < m) + {ε : ℝ} (hε : 0 ≤ ε) (h : TerminalZero K) : + LocalMap (historyTensor F allocation (terminalDilation K m) ε (history h)) + (Tensor.matrixCoefficients (Row allocation m h) (Middle allocation m h) (Column allocation m h)) := by + letI : Nonempty (ZeroWords allocation m h) := + Fintype.card_pos_iff.mp (zeroWords_card_pos allocation m h) + exact ofMatching F _ (physicalZero h) (embed allocation m h) + (coefficient F allocation hm hε h) + +theorem volume (allocation : Allocation) (m : ℕ) (h : TerminalZero K) : + Fintype.card (Row allocation m h) * Fintype.card (Middle allocation m h) * + Fintype.card (Column allocation m h) = Fintype.card (ZeroWords allocation m h) := + CWOrientedZero.volume (physicalZero h) (ZeroWords allocation m h) + +theorem dimensions_pos (allocation : Allocation) (m : ℕ) (h : TerminalZero K) : + 0 < Fintype.card (Row allocation m h) ∧ + 0 < Fintype.card (Middle allocation m h) ∧ 0 < Fintype.card (Column allocation m h) := by + have hp := zeroWords_card_pos allocation m h + rw [← volume allocation m h] at hp + have hab := Nat.pos_of_mul_pos_right hp + exact ⟨Nat.pos_of_mul_pos_right hab, Nat.pos_of_mul_pos_left hab, + Nat.pos_of_mul_pos_left hp⟩ + +end MatrixMultiplication.AllFieldZeroFinish + +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/Entropy/ComplexAsymptoticRecurrence.lean b/lean/OAI/LinearAlgebra/MatrixFields/Entropy/ComplexAsymptoticRecurrence.lean new file mode 100644 index 0000000000000000000000000000000000000000..9ca1d7743c71fbeea667eddd22cd98a20afc0053 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/Entropy/ComplexAsymptoticRecurrence.lean @@ -0,0 +1,43 @@ +import Mathlib + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +namespace MatrixMultiplication.Foundation + +theorem affine_recurrence_shifted (x : ℕ → ℝ) (a c : ℝ) (ha : 0 ≤ a) + (hstep : ∀ t, x (t + 1) ≤ a * x t + (a - 1) * c) : + ∀ t, x t + c ≤ a ^ t * (x 0 + c) := by + intro t + induction t with + | zero => simp + | succ t ih => + calc + x (t + 1) + c ≤ a * x t + (a - 1) * c + c := add_le_add (hstep t) (le_refl c) + _ = a * (x t + c) := by ring + _ ≤ a * (a ^ t * (x 0 + c)) := mul_le_mul_of_nonneg_left ih ha + _ = a ^ (t + 1) * (x 0 + c) := by rw [pow_succ]; ring + +theorem affine_recurrence_bound (x : ℕ → ℝ) (a b : ℝ) (ha : 1 < a) (hb : 0 ≤ b) + (hstep : ∀ t, x (t + 1) ≤ a * x t + b) : + ∀ t, x t ≤ a ^ t * (x 0 + b / (a - 1)) := by + have hpos : 0 < a - 1 := sub_pos.mpr ha + have hcancel : (a - 1) * (b / (a - 1)) = b := by + field_simp [ne_of_gt hpos] + have hshift := affine_recurrence_shifted x a (b / (a - 1)) (by linarith) + (fun t => by rw [hcancel]; exact hstep t) + intro t + have hc : 0 ≤ b / (a - 1) := div_nonneg hb hpos.le + exact (le_add_of_nonneg_right hc).trans (hshift t) + +end MatrixMultiplication.Foundation + +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/Entropy/ComplexPolynomialPowerGrowth.lean b/lean/OAI/LinearAlgebra/MatrixFields/Entropy/ComplexPolynomialPowerGrowth.lean new file mode 100644 index 0000000000000000000000000000000000000000..f632af8cb3c75d781356c0ce09f5be9d39b40ec5 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/Entropy/ComplexPolynomialPowerGrowth.lean @@ -0,0 +1,91 @@ +import Mathlib + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +noncomputable section + +open Filter +open scoped Topology + +namespace MatrixMultiplication.Foundation + +theorem tendsto_affine_mul_geometric_zero (D C : ℝ) {q : ℝ} + (hq : 0 ≤ q) (hq_one : q < 1) : + Tendsto (fun n : ℕ => (D * (n : ℝ) + C) * q ^ n) atTop (𝓝 0) := by + have hlinear := (tendsto_self_mul_const_pow_of_lt_one hq hq_one).const_mul D + have hconstant := (tendsto_pow_atTop_nhds_zero_of_lt_one hq hq_one).const_mul C + simpa only [mul_zero, add_zero, add_mul, mul_assoc] using hlinear.add hconstant + +theorem eventually_affine_mul_pow_le_pow (D C : ℝ) {r s : ℝ} + (hr : 0 ≤ r) (hrs : r < s) : + ∀ᶠ n : ℕ in atTop, (D * (n : ℝ) + C) * r ^ n ≤ s ^ n := by + have hs : 0 < s := hr.trans_lt hrs + have hratio : 0 ≤ r / s := div_nonneg hr hs.le + have hratio_one : r / s < 1 := (div_lt_one hs).2 hrs + have hsmall := + (tendsto_affine_mul_geometric_zero D C hratio hratio_one).eventually_lt_const + (show (0 : ℝ) < 1 from zero_lt_one) + filter_upwards [hsmall] with n hn + rw [div_pow, ← mul_div_assoc] at hn + exact ((div_lt_iff₀ (pow_pos hs n)).1 hn).le.trans_eq (one_mul _) + +theorem eventually_affine_mul_pow_le_add_pow (D C : ℝ) {r ε : ℝ} + (hr : 0 ≤ r) (hε : 0 < ε) : + ∀ᶠ n : ℕ in atTop, (D * (n : ℝ) + C) * r ^ n ≤ (r + ε) ^ n := + eventually_affine_mul_pow_le_pow D C hr (lt_add_of_pos_right r hε) + +theorem power_le_of_eventually_pow_le_affine_mul_pow {a r D C : ℝ} + (hr : 0 ≤ r) + (h : ∀ᶠ n : ℕ in atTop, a ^ n ≤ (D * (n : ℝ) + C) * r ^ n) : + a ≤ r := by + by_contra hnot + have hra : r < a := lt_of_not_ge hnot + have ha : 0 < a := hr.trans_lt hra + have hratio : 0 ≤ r / a := div_nonneg hr ha.le + have hratio_one : r / a < 1 := (div_lt_one ha).2 hra + have hsmall := + (tendsto_affine_mul_geometric_zero D C hratio hratio_one).eventually_lt_const + (show (0 : ℝ) < 1 from zero_lt_one) + rcases (h.and hsmall).exists with ⟨n, hbound, hlt⟩ + have hge : (1 : ℝ) ≤ (D * (n : ℝ) + C) * (r / a) ^ n := by + rw [div_pow, ← mul_div_assoc] + exact (le_div_iff₀ (pow_pos ha n)).2 (by simpa only [one_mul] using hbound) + exact (not_lt_of_ge hge) hlt + +theorem power_le_of_forall_pow_le_affine_mul_pow {a r D C : ℝ} + (hr : 0 ≤ r) + (h : ∀ n : ℕ, 0 < n → a ^ n ≤ (D * (n : ℝ) + C) * r ^ n) : + a ≤ r := by + apply power_le_of_eventually_pow_le_affine_mul_pow hr + exact eventually_atTop.2 ⟨1, fun n hn => h n (Nat.zero_lt_one.trans_le hn)⟩ + +theorem power_le_of_forall_pow_le_mul_pow {a r C : ℝ} + (hr : 0 ≤ r) (h : ∀ n : ℕ, 0 < n → a ^ n ≤ C * r ^ n) : + a ≤ r := by + apply power_le_of_forall_pow_le_affine_mul_pow (D := 0) (C := C) hr + simpa only [zero_mul, zero_add] using h + +theorem power_le_of_forall_pow_le_linear_mul_pow (D : ℕ) {a r : ℝ} + (hr : 0 ≤ r) + (h : ∀ n : ℕ, 0 < n → a ^ n ≤ ((D * n + 1 : ℕ) : ℝ) * r ^ n) : + a ≤ r := by + apply power_le_of_forall_pow_le_affine_mul_pow (D := (D : ℝ)) (C := 1) hr + simpa only [Nat.cast_add, Nat.cast_mul, Nat.cast_one] using h + +theorem eventually_linear_mul_pow_le_add_pow (D : ℕ) {r ε : ℝ} + (hr : 0 ≤ r) (hε : 0 < ε) : + ∀ᶠ n : ℕ in atTop, ((D * n + 1 : ℕ) : ℝ) * r ^ n ≤ (r + ε) ^ n := by + simpa only [Nat.cast_add, Nat.cast_mul, Nat.cast_one] using + eventually_affine_mul_pow_le_add_pow (D : ℝ) 1 hr hε + +end MatrixMultiplication.Foundation + +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/Entropy/ConditionalContinuity.lean b/lean/OAI/LinearAlgebra/MatrixFields/Entropy/ConditionalContinuity.lean new file mode 100644 index 0000000000000000000000000000000000000000..a3f22a3438ca92f8b203e315f0623f3bf4f8a032 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/Entropy/ConditionalContinuity.lean @@ -0,0 +1,114 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Extraction.ConditionalLabels + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +noncomputable section + +namespace MatrixMultiplication.ConditionalLabels + +open MatrixMultiplication.Foundation Filter +open scoped BigOperators Topology Classical + +universe u v w +variable {A : Type u} [Fintype A] {Label : ℕ → Type v} + [∀ n, Fintype (Label n)] + +theorem refinementEntropy_eq_prefix_difference (p : FiniteLaw A) + (labels : ∀ n, A → Label n) (depth n : ℕ) (hn : n < depth) : + (FiniteLabelHierarchy.ofLawLabels p labels depth).refinementEntropy n = + finiteEntropy (p.map (labelRecordOf labels (n + 1))).mass - + finiteEntropy (p.map (labelRecordOf labels n)).mass := by + have h := (FiniteLabelHierarchy.ofLawLabels p labels depth).prefixLaw_entropy_succ + n (Nat.succ_le_of_lt hn) + rw [FiniteLabelHierarchy.ofLawLabels_prefixLaw_mass, + FiniteLabelHierarchy.ofLawLabels_prefixLaw_mass] at h + linarith + +theorem tendsto_map_entropy {J : Type w} {filter : Filter J} + {p : J → FiniteLaw A} {q : FiniteLaw A} + (mass : ∀ a, Tendsto (fun j => (p j).mass a) filter (𝓝 (q.mass a))) + {B : Type*} [Fintype B] (label : A → B) : + Tendsto (fun j => finiteEntropy ((p j).map label).mass) filter + (𝓝 (finiteEntropy (q.map label).mass)) := by + apply FiniteLaw.entropy_tendsto + intro b + simp only [FiniteLaw.map_mass] + apply tendsto_finsetSum + intro a _ + by_cases h : label a = b + · simpa only [h, ite_true] using mass a + · simp only [h, ite_false] + exact tendsto_const_nhds + +theorem tendsto_lawPairingRate {J : Type w} {filter : Filter J} + {p : J → FiniteLaw A} {q : FiniteLaw A} + (mass : ∀ a, Tendsto (fun j => (p j).mass a) filter (𝓝 (q.mass a))) + (labels : ∀ n, A → Label n) (depth : ℕ) + (reader : Fin depth → ReaderPair) (pair : ReaderPair) : + Tendsto (fun j => lawPairingRate (p j) labels depth reader pair) filter + (𝓝 (lawPairingRate q labels depth reader pair)) := by + unfold lawPairingRate pairingRate + apply tendsto_finsetSum + intro n _ + by_cases h : reader n = pair + · simp only [h, ite_true, + refinementEntropy_eq_prefix_difference _ labels depth n.val n.isLt] + exact (tendsto_map_entropy mass (labelRecordOf labels (n.val + 1))).sub + (tendsto_map_entropy mass (labelRecordOf labels n.val)) + · simp only [h, ite_false] + exact tendsto_const_nhds + +theorem exists_rational_law_sequence (p : FiniteLaw A) : + ∃ q : ℕ → RationalLaw A, + ∀ a, Tendsto (fun n => (q n).toFiniteLaw.mass a) atTop (𝓝 (p.mass a)) := by + have hexists (n : ℕ) := p.exists_rational_approximation + (1 / ((n : ℝ) + 1)) (by positivity) + choose q _support close using hexists + refine ⟨q, fun a => ?_⟩ + have hdifference : Tendsto + (fun n => (q n).toFiniteLaw.mass a - p.mass a) atTop (𝓝 0) := by + apply squeeze_zero_norm _ tendsto_one_div_add_atTop_nhds_zero_nat + intro n + simpa only [Real.norm_eq_abs, RationalLaw.toFiniteLaw_mass] using (close n a).le + simpa only [sub_add_cancel, zero_add] using hdifference.add_const (p.mass a) + +theorem exists_rational_with_strict_margins (p : FiniteLaw A) + (labels : ∀ n, A → Label n) (depth : ℕ) (reader : Fin depth → ReaderPair) + {k C target : ℝ} + (positive : 0 < lawPairingRate p labels depth reader .xy + + lawPairingRate p labels depth reader .xz) + (aspect : k * (lawPairingRate p labels depth reader .xy + + lawPairingRate p labels depth reader .xz) < + 2 * lawPairingRate p labels depth reader .yz) + (cost : 2 * C < target * (lawPairingRate p labels depth reader .xy + + lawPairingRate p labels depth reader .xz)) : + ∃ q : RationalLaw A, + 0 < lawPairingRate q.toFiniteLaw labels depth reader .xy + + lawPairingRate q.toFiniteLaw labels depth reader .xz ∧ + k * (lawPairingRate q.toFiniteLaw labels depth reader .xy + + lawPairingRate q.toFiniteLaw labels depth reader .xz) < + 2 * lawPairingRate q.toFiniteLaw labels depth reader .yz ∧ + 2 * C < target * (lawPairingRate q.toFiniteLaw labels depth reader .xy + + lawPairingRate q.toFiniteLaw labels depth reader .xz) := by + obtain ⟨q, hq⟩ := exists_rational_law_sequence p + have hincident := (tendsto_lawPairingRate hq labels depth reader .xy).add + (tendsto_lawPairingRate hq labels depth reader .xz) + have hhidden := tendsto_lawPairingRate hq labels depth reader .yz + have hpos := hincident.eventually_const_lt positive + have haspect := (hincident.const_mul k).eventually_lt (hhidden.const_mul 2) aspect + have hcost := (hincident.const_mul target).eventually_const_lt cost + obtain ⟨n, hnpos, hnaspect, hncost⟩ := (hpos.and (haspect.and hcost)).exists + exact ⟨q n, hnpos, hnaspect, hncost⟩ + +end MatrixMultiplication.ConditionalLabels + +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/Entropy/ConditionalRateBridge.lean b/lean/OAI/LinearAlgebra/MatrixFields/Entropy/ConditionalRateBridge.lean new file mode 100644 index 0000000000000000000000000000000000000000..72990f49774c15d414d02f71fc0fb56f30612842 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/Entropy/ConditionalRateBridge.lean @@ -0,0 +1,165 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Extraction.ConditionalLabels + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +noncomputable section + +namespace MatrixMultiplication.ConditionalLabels + +open MatrixMultiplication.Foundation Filter StageHierarchyResources HierarchySeparationRates +open LabelHierarchyCounts +open scoped BigOperators Topology Classical + +universe u v +variable {A : Type u} [Fintype A] {Label : ℕ → Type v} + [∀ n, Fintype (Label n)] + +def normalizedCountLaw (counts : A → ℕ) (hD : 0 < ∑ a, counts a) : FiniteLaw A where + mass a := (counts a : ℝ) / (∑ b, counts b : ℕ) + nonneg a := div_nonneg (Nat.cast_nonneg _) (Nat.cast_nonneg _) + total := by + rw [← Finset.sum_div, ← Nat.cast_sum] + exact div_self (Nat.cast_ne_zero.mpr (Nat.ne_of_gt hD)) + +@[simp] theorem normalizedCountLaw_mass (counts : A → ℕ) + (hD : 0 < ∑ a, counts a) (a : A) : + (normalizedCountLaw counts hD).mass a = + (counts a : ℝ) / (∑ b, counts b : ℕ) := rfl + +theorem normalized_prefix_mass (counts : A → ℕ) (p : FiniteLaw A) + (mass : ∀ a, p.mass a = (counts a : ℝ) / (∑ b, counts b : ℕ)) + (labels : ∀ n, A → Label n) (n : ℕ) (r : LabelRecord Label n) : + (p.map (labelRecordOf labels n)).mass r = + (sourcePrefixCounts counts labels n r : ℝ) / (∑ a, counts a : ℕ) := by + simp only [FiniteLaw.map_mass, mass, sourcePrefixCounts, pushforwardCounts, + Nat.cast_sum, Finset.sum_div] + apply Finset.sum_congr rfl + intro a _ + by_cases h : labelRecordOf labels n a = r <;> simp [h] + +theorem zero_prefix_contribution_of_count_eq_zero (counts : A → ℕ) (p : FiniteLaw A) + (mass : ∀ a, p.mass a = (counts a : ℝ) / (∑ b, counts b : ℕ)) + (labels : ∀ n, A → Label n) (n : ℕ) (r : LabelRecord Label n) + (hzero : sourcePrefixCounts counts labels n r = 0) : + (p.map (labelRecordOf labels n)).mass r * + finiteEntropy ((p.conditional (labelRecordOf labels n) r).map (labels n)).mass = 0 := by + rw [normalized_prefix_mass counts p mass labels n r, hzero, + Nat.cast_zero, zero_div, zero_mul] + +theorem tendsto_log_prefix_multinomial (counts : A → ℕ) + (hD : 0 < ∑ a, counts a) (p : FiniteLaw A) + (mass : ∀ a, p.mass a = (counts a : ℝ) / (∑ b, counts b : ℕ)) + (labels : ∀ n, A → Label n) (n : ℕ) : + Tendsto (fun t : ℕ => Real.log + (Nat.multinomial Finset.univ + (sourcePrefixCounts (fun a => t * counts a) labels n) : ℝ) / + ((t : ℝ) * (∑ a, counts a : ℕ))) atTop + (𝓝 (finiteEntropy (p.map (labelRecordOf labels n)).mass)) := by + have hsum : (∑ r, sourcePrefixCounts counts labels n r) = ∑ a, counts a := + pushforwardCounts_sum counts (labelRecordOf labels n) + have hpositive : 0 < ∑ r, sourcePrefixCounts counts labels n r := by rwa [hsum] + have hmass : (fun r => (sourcePrefixCounts counts labels n r : ℝ) / + (∑ r, sourcePrefixCounts counts labels n r : ℕ)) = + (p.map (labelRecordOf labels n)).mass := by + funext r + rw [hsum] + exact (normalized_prefix_mass counts p mass labels n r).symm + have h := tendsto_log_multinomial_mul (sourcePrefixCounts counts labels n) hpositive + rw [hmass, hsum] at h + have hscale (t : ℕ) : sourcePrefixCounts (fun a => t * counts a) labels n = + (fun r => t * sourcePrefixCounts counts labels n r) := + funext (sourcePrefixCounts_mul counts labels t n) + simpa only [hscale] using h + +theorem stageEntropyRate_div_eq_refinementEntropy (counts : A → ℕ) + (hD : 0 < ∑ a, counts a) (p : FiniteLaw A) + (mass : ∀ a, p.mass a = (counts a : ℝ) / (∑ b, counts b : ℕ)) + (labels : ∀ n, A → Label n) (depth n : ℕ) (hn : n < depth) : + stageEntropyRate counts labels n / (∑ a, counts a : ℕ) = + (FiniteLabelHierarchy.ofLawLabels p labels depth).refinementEntropy n := by + have hstage := (tendsto_log_stageRefinementCount_div counts labels n).div_const + ((∑ a, counts a : ℕ) : ℝ) + simp only [div_div] at hstage + have hcoarse := tendsto_log_prefix_multinomial counts hD p mass labels n + have hfine := tendsto_log_prefix_multinomial counts hD p mass labels (n + 1) + have heq : finiteEntropy (p.map (labelRecordOf labels (n + 1))).mass = + finiteEntropy (p.map (labelRecordOf labels n)).mass + + stageEntropyRate counts labels n / (∑ a, counts a : ℕ) := by + apply tendsto_nhds_unique hfine + apply (hcoarse.add hstage).congr + intro t + rw [multinomial_succ (sourcePrefixCounts (fun a => t * counts a) labels) n + (sourcePrefixCounts_compatible (fun a => t * counts a) labels n)] + have hcoarse_pos : 0 < Nat.multinomial Finset.univ + (sourcePrefixCounts (fun a => t * counts a) labels n) := Nat.multinomial_pos _ _ + have hrefinement_pos : 0 < + refinementCount (sourcePrefixCounts (fun a => t * counts a) labels) n := + stageRefinementCount_pos counts labels n t + rw [Nat.cast_mul, Real.log_mul + (Nat.cast_ne_zero.mpr (Nat.ne_of_gt hcoarse_pos)) + (Nat.cast_ne_zero.mpr (Nat.ne_of_gt hrefinement_pos)), add_div] + rfl + have hchain := (FiniteLabelHierarchy.ofLawLabels p labels depth).prefixLaw_entropy_succ + n (Nat.succ_le_of_lt hn) + rw [FiniteLabelHierarchy.ofLawLabels_prefixLaw_mass, + FiniteLabelHierarchy.ofLawLabels_prefixLaw_mass] at hchain + linarith + +theorem stagePairingRate_div_eq_lawPairingRate (counts : A → ℕ) + (hD : 0 < ∑ a, counts a) (p : FiniteLaw A) + (mass : ∀ a, p.mass a = (counts a : ℝ) / (∑ b, counts b : ℕ)) + (labels : ∀ n, A → Label n) (depth : ℕ) + (reader : Fin depth → ReaderPair) (pair : ReaderPair) : + stagePairingRate counts labels depth reader pair / (∑ a, counts a : ℕ) = + lawPairingRate p labels depth reader pair := by + unfold stagePairingRate lawPairingRate pairingRate + rw [Finset.sum_div] + apply Finset.sum_congr rfl + intro n _ + by_cases h : reader n = pair + · simp only [h, ite_true] + exact stageEntropyRate_div_eq_refinementEntropy counts hD p mass labels depth n.val n.isLt + · simp [h] + +theorem tendsto_log_stagePairingSize_law (counts : A → ℕ) + (hD : 0 < ∑ a, counts a) (p : FiniteLaw A) + (mass : ∀ a, p.mass a = (counts a : ℝ) / (∑ b, counts b : ℕ)) + (labels : ∀ n, A → Label n) (depth : ℕ) + (reader : Fin depth → ReaderPair) (pair : ReaderPair) : + Tendsto (fun t => Real.log (stagePairingSize counts labels depth reader pair t : ℝ) / + ((t : ℝ) * (∑ a, counts a : ℕ))) atTop + (𝓝 (lawPairingRate p labels depth reader pair)) := by + rw [← stagePairingRate_div_eq_lawPairingRate counts hD p mass labels depth reader pair] + exact tendsto_log_stagePairingSize_normalized counts labels depth reader pair + +theorem stageEntropyRate_div_eq_normalizedCountLaw_refinementEntropy + (counts : A → ℕ) (hD : 0 < ∑ a, counts a) + (labels : ∀ n, A → Label n) (depth n : ℕ) (hn : n < depth) : + stageEntropyRate counts labels n / (∑ a, counts a : ℕ) = + (FiniteLabelHierarchy.ofLawLabels (normalizedCountLaw counts hD) + labels depth).refinementEntropy n := + stageEntropyRate_div_eq_refinementEntropy counts hD (normalizedCountLaw counts hD) + (fun _ => rfl) labels depth n hn + +theorem tendsto_log_stagePairingSize_normalizedCountLaw + (counts : A → ℕ) (hD : 0 < ∑ a, counts a) + (labels : ∀ n, A → Label n) (depth : ℕ) + (reader : Fin depth → ReaderPair) (pair : ReaderPair) : + Tendsto (fun t => Real.log (stagePairingSize counts labels depth reader pair t : ℝ) / + ((t : ℝ) * (∑ a, counts a : ℕ))) atTop + (𝓝 (lawPairingRate (normalizedCountLaw counts hD) labels depth reader pair)) := + tendsto_log_stagePairingSize_law counts hD (normalizedCountLaw counts hD) + (fun _ => rfl) labels depth reader pair + +end MatrixMultiplication.ConditionalLabels + +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/Entropy/ConstructionRates.lean b/lean/OAI/LinearAlgebra/MatrixFields/Entropy/ConstructionRates.lean new file mode 100644 index 0000000000000000000000000000000000000000..76defc305be2b1efd67214155e04440ab3984e18 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/Entropy/ConstructionRates.lean @@ -0,0 +1,220 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Extraction.ConstructionLabels + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +noncomputable section + +namespace MatrixMultiplication.AllFieldSourceRates + +open AllFieldSource Filter +open scoped Topology + +private theorem tendsto_log_linear_div_nat (a : ℝ) (ha : 0 < a) : + Tendsto (fun N : ℕ => Real.log (a * N + 1) / (N : ℝ)) atTop (𝓝 0) := by + have hnat : Tendsto (fun N : ℕ => (N : ℝ)) atTop atTop := + tendsto_natCast_atTop_atTop + have harg : Tendsto (fun N : ℕ => a * N + 1) atTop atTop := + (hnat.const_mul_atTop ha).atTop_add_nonneg (fun _ => zero_le_one) + have hlog : Tendsto (fun N : ℕ => Real.log (a * N + 1) / (a * N + 1)) + atTop (𝓝 0) := by + simpa only [Function.comp_def, id_eq] using + Real.isLittleO_log_id_atTop.tendsto_div_nhds_zero.comp harg + have hinv : Tendsto (fun N : ℕ => (1 : ℝ) / N) atTop (𝓝 0) := + tendsto_const_nhds.div_atTop hnat + have hratio : Tendsto (fun N : ℕ => (a * N + 1) / (N : ℝ)) atTop (𝓝 a) := by + have hsum : Tendsto (fun N : ℕ => a + 1 / (N : ℝ)) atTop (𝓝 a) := by + simpa only [add_zero] using hinv.const_add a + apply hsum.congr' + filter_upwards [eventually_ne_atTop (0 : ℕ)] with N hN + have hN' : (N : ℝ) ≠ 0 := Nat.cast_ne_zero.mpr hN + field_simp [hN'] + have hprod : Tendsto (fun N : ℕ => + (Real.log (a * N + 1) / (a * N + 1)) * ((a * N + 1) / (N : ℝ))) + atTop (𝓝 0) := by + simpa only [zero_mul] using hlog.mul hratio + apply hprod.congr + intro N + have harg' : a * (N : ℝ) + 1 ≠ 0 := by positivity + exact div_mul_div_cancel₀ harg' + +theorem tendsto_log_polynomial_overhead (K : ℕ) (hK : 0 < K) : + Tendsto (fun N : ℕ => + Real.log (((3 * (8 * K * N) + 1) ^ 2 : ℕ) : ℝ) / ((K : ℝ) * N)) + atTop (𝓝 0) := by + have hK' : (0 : ℝ) < K := Nat.cast_pos.mpr hK + have hbase := tendsto_log_linear_div_nat (3 * (8 * (K : ℝ))) (by positivity) + have hscaled : Tendsto (fun N : ℕ => + (2 * (Real.log (3 * (8 * (K : ℝ)) * N + 1) / (N : ℝ))) / (K : ℝ)) + atTop (𝓝 0) := by + simpa only [mul_zero, zero_div] using (hbase.const_mul 2).div_const (K : ℝ) + apply hscaled.congr + intro N + have harg : ((3 * (8 * K * N) + 1 : ℕ) : ℝ) = + 3 * (8 * (K : ℝ)) * N + 1 := by push_cast; ring + rw [Nat.cast_pow, Real.log_pow, harg] + norm_num only [Nat.cast_ofNat] + ring + +theorem tendsto_log_exponential_source (K : ℕ) (hK : 0 < K) : + Tendsto (fun N : ℕ => + Real.log ((7 ^ (8 * K * N) : ℕ) : ℝ) / ((K : ℝ) * N)) + atTop (𝓝 (8 * Real.log 7)) := by + have hK' : (K : ℝ) ≠ 0 := Nat.cast_ne_zero.mpr (Nat.ne_of_gt hK) + apply tendsto_const_nhds.congr' + filter_upwards [eventually_ne_atTop (0 : ℕ)] with N hN + have hN' : (N : ℝ) ≠ 0 := Nat.cast_ne_zero.mpr hN + rw [Nat.cast_pow, Real.log_pow] + push_cast + field_simp [hK', hN'] + +theorem log_rankBudget (Copies : Type*) [Fintype Copies] (K N : ℕ) + (hcopies : 0 < Fintype.card Copies) : + Real.log (rankBudget Copies K N : ℝ) = + Real.log (Fintype.card Copies : ℝ) + + Real.log (((3 * (8 * K * N) + 1) ^ 2 : ℕ) : ℝ) + + Real.log ((7 ^ (8 * K * N) : ℕ) : ℝ) := by + have hc : (Fintype.card Copies : ℝ) ≠ 0 := + Nat.cast_ne_zero.mpr (Nat.ne_of_gt hcopies) + have hp : (((3 * (8 * K * N) + 1) ^ 2 : ℕ) : ℝ) ≠ 0 := by positivity + have he : ((7 ^ (8 * K * N) : ℕ) : ℝ) ≠ 0 := by positivity + simp only [rankBudget, Nat.cast_mul] + rw [Real.log_mul hc (mul_ne_zero hp he), Real.log_mul hp he, ← add_assoc] + +theorem tendsto_log_rankBudget (Copies : ℕ → Type*) [∀ N, Fintype (Copies N)] + (K : ℕ) (hK : 0 < K) + (hcopies : ∀ N, 0 < Fintype.card (Copies N)) + (hcopyRate : Tendsto (fun N : ℕ => + Real.log (Fintype.card (Copies N) : ℝ) / (N : ℝ)) atTop (𝓝 0)) : + Tendsto (fun N : ℕ => + Real.log (rankBudget (Copies N) K N : ℝ) / ((K : ℝ) * N)) + atTop (𝓝 (8 * Real.log 7)) := by + have hc : Tendsto (fun N : ℕ => + Real.log (Fintype.card (Copies N) : ℝ) / ((K : ℝ) * N)) atTop (𝓝 0) := by + have h : Tendsto (fun N : ℕ => + (Real.log (Fintype.card (Copies N) : ℝ) / (N : ℝ)) / (K : ℝ)) + atTop (𝓝 0) := by + simpa only [zero_div] using hcopyRate.div_const (K : ℝ) + apply h.congr + intro N + ring + have hsum := (hc.add (tendsto_log_polynomial_overhead K hK)).add + (tendsto_log_exponential_source K hK) + simp only [zero_add] at hsum + apply hsum.congr + intro N + rw [log_rankBudget (Copies N) K N (hcopies N), add_div, add_div] + +end MatrixMultiplication.AllFieldSourceRates + +namespace MatrixMultiplication.AllFieldConstructionRates + +open MatrixMultiplication.Foundation AllFieldHistory Filter +open scoped BigOperators Topology Classical + +variable {K : ℕ} + +abbrev Copies (allocation : Allocation) (ε : ℝ) (m : ℕ) := + ∀ tick : Fin (K + 2), InverseLinearRecovery.MaskRectangles + (AllFieldHistoryRecovery.shiftCount (K := K) (tick := tick.val) allocation ε m) + +theorem card_copies (allocation : Allocation) (ε : ℝ) (m : ℕ) : + Fintype.card (Copies (K := K) allocation ε m) = + ∏ tick : Fin (K + 2), RecoveryGrowth.replicationCount + (AllFieldHistorySupport.supportRate (K := K) (tick := tick.val) allocation) + (AllFieldHistoryMasks.lossConstant (K := K) (tick := tick.val) allocation ε + 6) m := by + rw [Fintype.card_pi] + apply Finset.prod_congr rfl + intro tick _ + rw [Fintype.card_eq_nat_card, AllFieldHistoryRecovery.shiftCount] + simpa only [Fintype.card_eq_nat_card] using + InverseLinearRecovery.card_recovery_copies + (AllFieldHistorySupport.supportRate (K := K) (tick := tick.val) allocation) + (AllFieldHistoryMasks.lossConstant (K := K) (tick := tick.val) allocation ε + 6) m + +theorem card_copies_range (allocation : Allocation) (ε : ℝ) (m : ℕ) : + Fintype.card (Copies (K := K) allocation ε m) = + ∏ tick ∈ Finset.range (K + 2), Fintype.card + (InverseLinearRecovery.MaskRectangles + (AllFieldHistoryRecovery.shiftCount (K := K) (tick := tick) allocation ε m)) := by + rw [Fintype.card_pi] + exact Fin.prod_univ_eq_prod_range (fun tick : ℕ => Fintype.card + (InverseLinearRecovery.MaskRectangles + (AllFieldHistoryRecovery.shiftCount (K := K) (tick := tick) allocation ε m))) (K + 2) + +theorem card_copies_pos (allocation : Allocation) (ε : ℝ) (m : ℕ) : + 0 < Fintype.card (Copies (K := K) allocation ε m) := Fintype.card_pos + +theorem copies_subexponential (allocation : Allocation) (ε : ℝ) : + Tendsto (fun m : ℕ => Real.log (Fintype.card (Copies (K := K) allocation ε m) : ℝ) / + (m : ℝ)) atTop (𝓝 0) := by + have h := RecoveryGrowth.tendsto_log_prod_div_nat (Finset.univ : Finset (Fin (K + 2))) + (r := fun tick m => Fintype.card (InverseLinearRecovery.MaskRectangles + (AllFieldHistoryRecovery.shiftCount (K := K) (tick := tick.val) allocation ε m))) + (fun _ _ _ => Fintype.card_pos) + (fun tick _ => AllFieldHistoryRecovery.replication_subexponential + (K := K) (tick := tick.val) allocation ε) + simpa only [Copies, Fintype.card_pi] using h + +theorem copies_rate (_hK : 0 < K) (allocation : Allocation) (ε : ℝ) : + Tendsto (fun m : ℕ => Real.log (Fintype.card (Copies (K := K) allocation ε m) : ℝ) / + ((K : ℝ) * populationLength (K := K) allocation m)) atTop (𝓝 0) := by + have h := (copies_subexponential (K := K) allocation ε).div_const + ((K : ℝ) * denominator (K := K) allocation) + simp only [zero_div] at h + apply h.congr + intro m + rw [population_length, Nat.cast_mul] + ring + +theorem source_rank_rate (hK : 0 < K) (allocation : Allocation) (ε : ℝ) : + Tendsto (fun m : ℕ => Real.log + (AllFieldSource.rankBudget (Copies (K := K) allocation ε m) K + (populationLength (K := K) allocation m) : ℝ) / + ((K : ℝ) * populationLength (K := K) allocation m)) + atTop (𝓝 (8 * Real.log 7)) := by + have hp := (AllFieldSourceRates.tendsto_log_polynomial_overhead K hK).comp + (populationLength_tendsto (K := K) allocation) + have he := (AllFieldSourceRates.tendsto_log_exponential_source K hK).comp + (populationLength_tendsto (K := K) allocation) + have h := ((copies_rate hK allocation ε).add hp).add he + simp only [zero_add] at h + apply h.congr + intro m + rw [AllFieldSourceRates.log_rankBudget _ _ _ (card_copies_pos allocation ε m), + add_div, add_div] + rfl + +theorem source_rank_terminal_rate (hK : 0 < K) (allocation : Allocation) (ε : ℝ) : + Tendsto (fun m : ℕ => Real.log + (AllFieldSource.rankBudget + (Copies (K := K) allocation ε (AllFieldTerminalRates.terminalDilation K m)) K + (AllFieldTerminalRates.terminalLength allocation K m) : ℝ) / + ((K : ℝ) * AllFieldTerminalRates.terminalLength allocation K m)) + atTop (𝓝 (8 * Real.log 7)) := + (source_rank_rate hK allocation ε).comp (terminalDilation_tendsto K) + +theorem source_rank_terminal_rate_of_cardinality + (ActualCopies : ℕ → Type*) [∀ m, Fintype (ActualCopies m)] + (hK : 0 < K) (allocation : Allocation) (ε : ℝ) + (cards : ∀ᶠ m : ℕ in atTop, Fintype.card (ActualCopies m) = Fintype.card + (Copies (K := K) allocation ε (AllFieldTerminalRates.terminalDilation K m))) : + Tendsto (fun m : ℕ => Real.log (AllFieldSource.rankBudget (ActualCopies m) K + (AllFieldTerminalRates.terminalLength allocation K m) : ℝ) / + ((K : ℝ) * AllFieldTerminalRates.terminalLength allocation K m)) + atTop (𝓝 (8 * Real.log 7)) := by + apply (source_rank_terminal_rate hK allocation ε).congr' + filter_upwards [cards] with m hm + simp only [AllFieldSource.rankBudget, hm] + +end MatrixMultiplication.AllFieldConstructionRates + +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/Entropy/FiniteAverage.lean b/lean/OAI/LinearAlgebra/MatrixFields/Entropy/FiniteAverage.lean new file mode 100644 index 0000000000000000000000000000000000000000..8d393e19a8178a1c5fe18f78f37fb403c6f5cd4b --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/Entropy/FiniteAverage.lean @@ -0,0 +1,231 @@ +import Mathlib + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +namespace MatrixMultiplication.PermutationMatching + +open scoped BigOperators +open Classical + +noncomputable section + +variable {Ω Γ : Type*} [Fintype Ω] [Fintype Γ] + +def average (f : Ω → ℝ) : ℝ := (∑ ω, f ω) / Fintype.card Ω + +theorem average_congr {f g : Ω → ℝ} (h : ∀ ω, f ω = g ω) : + average f = average g := by + unfold average + congr 1 + exact Finset.sum_congr rfl (fun ω _ => h ω) + +@[simp] theorem average_const [Nonempty Ω] (c : ℝ) : + average (fun _ : Ω => c) = c := by + have hcard : (Fintype.card Ω : ℝ) ≠ 0 := by + exact_mod_cast Fintype.card_ne_zero + simp [average, hcard] + +@[simp] theorem average_zero : average (fun _ : Ω => (0 : ℝ)) = 0 := by + simp [average] + +theorem average_add (f g : Ω → ℝ) : + average (fun ω => f ω + g ω) = average f + average g := by + simp [average, Finset.sum_add_distrib, add_div] + +theorem average_sub (f g : Ω → ℝ) : + average (fun ω => f ω - g ω) = average f - average g := by + simp [average, Finset.sum_sub_distrib, sub_div] + +theorem average_mul_const (f : Ω → ℝ) (c : ℝ) : + average (fun ω => f ω * c) = average f * c := by + simp only [average, ← Finset.sum_mul] + ring + +theorem average_const_mul (c : ℝ) (f : Ω → ℝ) : + average (fun ω => c * f ω) = c * average f := by + simp only [average, ← Finset.mul_sum] + ring + +theorem average_finset_sum {I : Type*} (s : Finset I) (f : I → Ω → ℝ) : + average (fun ω => ∑ i ∈ s, f i ω) = ∑ i ∈ s, average (f i) := by + unfold average + rw [Finset.sum_comm] + simp only [div_eq_mul_inv, Finset.sum_mul] + +theorem average_sum {I : Type*} (s : Finset I) (f : Ω → I → ℝ) : + average (fun ω => ∑ i ∈ s, f ω i) = ∑ i ∈ s, average (fun ω => f ω i) := + average_finset_sum s (fun i ω => f ω i) + +theorem average_nonneg {f : Ω → ℝ} (h : ∀ ω, 0 ≤ f ω) : 0 ≤ average f := by + exact div_nonneg (Finset.sum_nonneg (fun ω _ => h ω)) (Nat.cast_nonneg _) + +theorem average_mono {f g : Ω → ℝ} (h : ∀ ω, f ω ≤ g ω) : + average f ≤ average g := by + exact div_le_div_of_nonneg_right (Finset.sum_le_sum (fun ω _ => h ω)) + (Nat.cast_nonneg _) + +theorem average_indicator_eq (P : Ω → Prop) [DecidablePred P] : + average (fun ω => if P ω then (1 : ℝ) else 0) = + ((Finset.univ.filter P).card : ℝ) / (Fintype.card Ω : ℝ) := by + simp [average] + +theorem average_equiv (e : Ω ≃ Γ) (f : Γ → ℝ) : + average (fun ω => f (e ω)) = average f := by + unfold average + rw [Fintype.card_congr e, e.sum_comp] + +theorem average_prod (f : Ω → ℝ) (g : Γ → ℝ) : + average (fun p : Ω × Γ => f p.1 * g p.2) = average f * average g := by + simp only [average, Fintype.sum_prod_type, Fintype.card_prod, Nat.cast_mul, + ← Finset.mul_sum, ← Finset.sum_mul] + exact mul_div_mul_comm _ _ _ _ + +theorem average_prod_average (f : Ω × Γ → ℝ) : + average f = average (fun ω => average (fun γ => f (ω, γ))) := by + simp only [average, Fintype.sum_prod_type, Fintype.card_prod, Nat.cast_mul, + div_eq_mul_inv, ← Finset.sum_mul, mul_inv_rev] + ring + +@[simp] theorem average_prod_fst [Nonempty Γ] (f : Ω → ℝ) : + average (fun p : Ω × Γ => f p.1) = average f := by + simpa using average_prod f (fun _ : Γ => (1 : ℝ)) + +@[simp] theorem average_prod_snd [Nonempty Ω] (g : Γ → ℝ) : + average (fun p : Ω × Γ => g p.2) = average g := by + simpa using average_prod (fun _ : Ω => (1 : ℝ)) g + +theorem average_centered_sq [Nonempty Ω] (f : Ω → ℝ) : + average (fun ω => (f ω - average f) ^ 2) = + average (fun ω => f ω ^ 2) - (average f) ^ 2 := by + calc + average (fun ω => (f ω - average f) ^ 2) = + average (fun ω => f ω ^ 2 - (2 * average f) * f ω + (average f) ^ 2) := by + apply average_congr + intro ω + ring + _ = _ := by rw [average_add, average_sub, average_const_mul, average_const]; ring + +section Coordinates + +variable {I : Type*} [Fintype I] [DecidableEq I] {X : I → Type*} + [∀ i, Fintype (X i)] [∀ i, Nonempty (X i)] + +theorem average_pi_eval (i : I) (f : X i → ℝ) : + average (fun ω : ∀ i, X i => f (ω i)) = average f := by + classical + change average (fun ω => (fun p : X i × (∀ j : {j // j ≠ i}, X j) => f p.1) + ((Equiv.piSplitAt i X) ω)) = average f + rw [average_equiv (Equiv.piSplitAt i X) + (fun p : X i × (∀ j : {j // j ≠ i}, X j) => f p.1), average_prod_fst] + +theorem average_pi_restrict (D : Finset I) (f : (∀ i : {i // i ∈ D}, X i) → ℝ) : + average (fun ω : ∀ i, X i => f (fun i => ω i)) = average f := by + classical + change average (fun ω => + (fun p : (∀ i : {i // i ∈ D}, X i) × (∀ i : {i // i ∉ D}, X i) => f p.1) + ((Equiv.piEquivPiSubtypeProd (fun i => i ∈ D) X) ω)) = average f + rw [average_equiv (Equiv.piEquivPiSubtypeProd (fun i => i ∈ D) X) + (fun p : (∀ i : {i // i ∈ D}, X i) × (∀ i : {i // i ∉ D}, X i) => f p.1), + average_prod_fst] + +theorem average_prod_pi_restrict (D : Finset I) + (f : ((∀ i : {i // i ∈ D}, X i) × (∀ i : {i // i ∈ D}, X i)) → ℝ) : + average (fun p : (∀ i, X i) × (∀ i, X i) => + f ((fun i => p.1 i), (fun i => p.2 i))) = average f := by + classical + rw [average_prod_average] + calc + _ = average (fun x : ∀ i, X i => + average (fun y : ∀ i : {i // i ∈ D}, X i => f ((fun i => x i), y))) := by + apply average_congr + intro x + exact average_pi_restrict D (fun y => f ((fun i => x i), y)) + _ = average (fun x : ∀ i : {i // i ∈ D}, X i => average (fun y => f (x, y))) := + average_pi_restrict D (fun x => average (fun y => f (x, y))) + _ = average f := (average_prod_average f).symm + +theorem average_pi_eval_mul (i j : I) (hij : i ≠ j) (f : X i → ℝ) (g : X j → ℝ) : + average (fun ω : ∀ i, X i => f (ω i) * g (ω j)) = average f * average g := by + classical + change average (fun ω => + (fun p : X i × (∀ k : {k // k ≠ i}, X k) => + f p.1 * g (p.2 ⟨j, Ne.symm hij⟩)) ((Equiv.piSplitAt i X) ω)) = _ + rw [average_equiv (Equiv.piSplitAt i X) + (fun p : X i × (∀ k : {k // k ≠ i}, X k) => + f p.1 * g (p.2 ⟨j, Ne.symm hij⟩)), + average_prod f (fun k : ∀ k : {k // k ≠ i}, X k => g (k ⟨j, Ne.symm hij⟩))] + exact congrArg (fun t => average f * t) + (average_pi_eval (X := fun k : {k // k ≠ i} => X k) ⟨j, Ne.symm hij⟩ g) + +theorem average_pi_sum_centered_sq (f : ∀ i, X i → ℝ) : + average (fun ω : ∀ i, X i => (∑ i, (f i (ω i) - average (f i))) ^ 2) = + ∑ i, average (fun x => (f i x - average (f i)) ^ 2) := by + classical + let c : ∀ i, X i → ℝ := fun i x => f i x - average (f i) + have hc (i : I) : average (c i) = 0 := by + simp [c, average_sub] + change average (fun ω : ∀ i, X i => (∑ i, c i (ω i)) ^ 2) = + ∑ i, average (fun x => (c i x) ^ 2) + calc + _ = ∑ i, ∑ j, average (fun ω : ∀ i, X i => c i (ω i) * c j (ω j)) := by + simp only [pow_two, Finset.sum_mul, Finset.mul_sum, average_finset_sum] + exact Finset.sum_comm + _ = _ := by + apply Finset.sum_congr rfl + intro i hi + calc + (∑ j, average (fun ω : ∀ i, X i => c i (ω i) * c j (ω j))) = + average (fun ω : ∀ i, X i => c i (ω i) * c i (ω i)) := by + apply Finset.sum_eq_single i + · intro j hj hji + rw [average_pi_eval_mul i j (Ne.symm hji), hc, hc, zero_mul] + · simp + _ = average (fun x => (c i x) ^ 2) := by + simp only [pow_two] + exact average_pi_eval i (fun x => c i x * c i x) + +end Coordinates + +theorem deviation_bound (f : Ω → ℝ) (μ δ : ℝ) (hδ : 0 < δ) : + average (fun ω => if δ ≤ |f ω - μ| then (1 : ℝ) else 0) * δ ^ 2 ≤ + average (fun ω => (f ω - μ) ^ 2) := by + rw [← average_mul_const] + apply average_mono + intro ω + split_ifs with h + · simp only [one_mul] + have hh := (sq_le_sq₀ (le_of_lt hδ) (abs_nonneg (f ω - μ))).2 h + simpa only [sq_abs] using hh + · simp only [zero_mul] + exact sq_nonneg _ + +theorem average_indicator_exists_le_sum {I : Type*} [Fintype I] + (P : I → Ω → Prop) [∀ i ω, Decidable (P i ω)] : + average (fun ω => if ∃ i, P i ω then (1 : ℝ) else 0) ≤ + ∑ i, average (fun ω => if P i ω then (1 : ℝ) else 0) := by + classical + rw [← average_finset_sum] + apply average_mono + intro ω + by_cases h : ∃ i, P i ω + · rw [ite_eq_left h] + obtain ⟨i, hi⟩ := h + calc + (1 : ℝ) = (if P i ω then (1 : ℝ) else 0) := by simp [hi] + _ ≤ ∑ j, if P j ω then (1 : ℝ) else 0 := + Finset.single_le_sum (f := fun j => if P j ω then (1 : ℝ) else 0) + (fun j _ => by split_ifs <;> norm_num) (Finset.mem_univ i) + · rw [ite_eq_right h] + exact Finset.sum_nonneg (fun i _ => by split_ifs <;> norm_num) + +end + +end MatrixMultiplication.PermutationMatching + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/Entropy/FloorExponentialRates.lean b/lean/OAI/LinearAlgebra/MatrixFields/Entropy/FloorExponentialRates.lean new file mode 100644 index 0000000000000000000000000000000000000000..54e135138da8f0e6d78fdb7c86ec1ecb3f0470de --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/Entropy/FloorExponentialRates.lean @@ -0,0 +1,90 @@ +import Mathlib + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +noncomputable section + +namespace MatrixMultiplication.FloorExponentialRates + +open Filter +open scoped BigOperators Topology Classical + +def count (rate : ℝ) (m : ℕ) : ℕ := ⌊Real.exp ((m : ℝ) * rate)⌋₊ + +theorem count_pos {rate : ℝ} (hr : 0 ≤ rate) (m : ℕ) : 0 < count rate m := by + have he : (1 : ℝ) ≤ Real.exp ((m : ℝ) * rate) := + Real.one_le_exp (mul_nonneg (Nat.cast_nonneg _) hr) + exact lt_of_lt_of_le Nat.zero_lt_one (Nat.le_floor (by simpa only [Nat.cast_one] using he)) + +theorem log_count_bounds {rate : ℝ} (hr : 0 ≤ rate) (m : ℕ) : + (m : ℝ) * rate - Real.log 2 ≤ Real.log (count rate m : ℝ) ∧ + Real.log (count rate m : ℝ) ≤ (m : ℝ) * rate := by + have hp : (0 : ℝ) < count rate m := Nat.cast_pos.mpr (count_pos hr m) + have hone : (1 : ℝ) ≤ count rate m := by exact_mod_cast count_pos hr m + have hround := Nat.lt_floor_add_one (Real.exp ((m : ℝ) * rate)) + have hhalf : Real.exp ((m : ℝ) * rate) / 2 ≤ (count rate m : ℝ) := by + change Real.exp ((m : ℝ) * rate) < (count rate m : ℝ) + 1 at hround + linarith + constructor + · have h := Real.log_le_log (by positivity : 0 < Real.exp ((m : ℝ) * rate) / 2) hhalf + simpa only [Real.log_div (Real.exp_ne_zero _) (by norm_num : (2 : ℝ) ≠ 0), + Real.log_exp] using h + · have h := Real.log_le_log hp (Nat.floor_le (Real.exp_pos _).le) + simpa only [Real.log_exp] using h + +theorem tendsto_log_count_div_nat {rate : ℝ} (hr : 0 ≤ rate) : + Tendsto (fun m : ℕ => Real.log (count rate m : ℝ) / (m : ℝ)) + atTop (𝓝 rate) := by + have hinv : Tendsto (fun m : ℕ => Real.log 2 / (m : ℝ)) atTop (𝓝 0) := + tendsto_const_nhds.div_atTop tendsto_natCast_atTop_atTop + have hlo : Tendsto (fun m : ℕ => rate - Real.log 2 / (m : ℝ)) atTop (𝓝 rate) := by + simpa only [sub_zero] using tendsto_const_nhds.sub hinv + apply tendsto_of_tendsto_of_tendsto_of_le_of_le' hlo tendsto_const_nhds + · filter_upwards [eventually_gt_atTop (0 : ℕ)] with m hm + have hm' : (0 : ℝ) < m := Nat.cast_pos.mpr hm + have h := div_le_div_of_nonneg_right (log_count_bounds hr m).1 hm'.le + simpa only [sub_div, mul_div_cancel_left₀ rate hm'.ne'] using h + · filter_upwards [eventually_gt_atTop (0 : ℕ)] with m hm + have hm' : (0 : ℝ) < m := Nat.cast_pos.mpr hm + have h := div_le_div_of_nonneg_right (log_count_bounds hr m).2 hm'.le + simpa only [mul_div_cancel_left₀ rate hm'.ne'] using h + +theorem tendsto_log_prod_count_div_nat {I : Type*} [Fintype I] (rate : I → ℝ) + (hr : ∀ i, 0 ≤ rate i) : + Tendsto (fun m : ℕ => Real.log ((∏ i, count (rate i) m : ℕ) : ℝ) / (m : ℝ)) + atTop (𝓝 (∑ i, rate i)) := by + have h := tendsto_finsetSum Finset.univ (fun i _ => tendsto_log_count_div_nat (hr i)) + apply h.congr + intro m + rw [Nat.cast_prod, Real.log_prod + (fun i _ => Nat.cast_ne_zero.mpr (Nat.ne_of_gt (count_pos (hr i) m)))] + simp only [div_eq_mul_inv, Finset.sum_mul] + +abbrev Labels {I : Type*} (rate : I → ℝ) (m : ℕ) := ∀ i, Fin (count (rate i) m) + +theorem card_labels {I : Type*} [Fintype I] (rate : I → ℝ) (m : ℕ) : + Fintype.card (Labels rate m) = ∏ i, count (rate i) m := by + simp only [Labels, Fintype.card_pi, Fintype.card_fin] + +theorem card_labels_pos {I : Type*} [Fintype I] (rate : I → ℝ) + (hr : ∀ i, 0 ≤ rate i) (m : ℕ) : 0 < Fintype.card (Labels rate m) := by + rw [card_labels] + exact Finset.prod_pos fun i _ => count_pos (hr i) m + +theorem tendsto_log_card_labels_div_nat {I : Type*} [Fintype I] (rate : I → ℝ) + (hr : ∀ i, 0 ≤ rate i) : + Tendsto (fun m : ℕ => Real.log (Fintype.card (Labels rate m) : ℝ) / (m : ℝ)) + atTop (𝓝 (∑ i, rate i)) := by + simpa only [card_labels] using tendsto_log_prod_count_div_nat rate hr + +end MatrixMultiplication.FloorExponentialRates + +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/Entropy/GroupBranchLaws.lean b/lean/OAI/LinearAlgebra/MatrixFields/Entropy/GroupBranchLaws.lean new file mode 100644 index 0000000000000000000000000000000000000000..5c690899f64460b72d108510957d647e6512475b --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/Entropy/GroupBranchLaws.lean @@ -0,0 +1,1317 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Construction.JointCompatibilityScaling +import OAI.LinearAlgebra.MatrixFields.Construction.PairMarginals +import OAI.LinearAlgebra.MatrixFields.Parameters.ParametersHalfComplement + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section + +namespace MatrixMultiplication.JointPopulationRates + +open MatrixMultiplication.Foundation Filter JointPopulation +open scoped BigOperators Topology + +theorem tendsto_log_multinomial_div_of_total_div_zero + {A : Type*} [Fintype A] [DecidableEq A] (counts : ℕ → A → ℕ) + (hratio : Tendsto + (fun n : ℕ => ((∑ a, counts n a : ℕ) : ℝ) / (n : ℝ)) + atTop (𝓝 0)) : + Tendsto (fun n : ℕ => + Real.log (Nat.multinomial Finset.univ (counts n) : ℝ) / (n : ℝ)) + atTop (𝓝 0) := by + have hupperlim : Tendsto + (fun n : ℕ => (((∑ a, counts n a : ℕ) : ℝ) / (n : ℝ)) * + Real.log (Fintype.card A : ℝ)) atTop (𝓝 0) := by + simpa using hratio.mul_const (Real.log (Fintype.card A : ℝ)) + refine squeeze_zero ?_ ?_ hupperlim + · intro n + apply div_nonneg + · apply Real.log_nonneg + exact_mod_cast (Nat.succ_le_of_lt (Nat.multinomial_pos Finset.univ (counts n))) + · exact Nat.cast_nonneg n + · intro n + have hcardNat : Nat.multinomial Finset.univ (counts n) ≤ + (Fintype.card A) ^ (∑ a, counts n a) := by + simpa only [exactWords_card] using exactWords_card_le (counts n) + have hcard : (Nat.multinomial Finset.univ (counts n) : ℝ) ≤ + (Fintype.card A : ℝ) ^ (∑ a, counts n a) := by + exact_mod_cast hcardNat + have hlog : Real.log (Nat.multinomial Finset.univ (counts n) : ℝ) ≤ + ((∑ a, counts n a : ℕ) : ℝ) * Real.log (Fintype.card A : ℝ) := by + simpa only [Real.log_pow] using + Real.log_le_log (Nat.cast_pos.mpr (Nat.multinomial_pos Finset.univ (counts n))) hcard + calc + Real.log (Nat.multinomial Finset.univ (counts n) : ℝ) / (n : ℝ) ≤ + (((∑ a, counts n a : ℕ) : ℝ) * Real.log (Fintype.card A : ℝ)) / (n : ℝ) := + div_le_div_of_nonneg_right hlog (Nat.cast_nonneg n) + _ = (((∑ a, counts n a : ℕ) : ℝ) / (n : ℝ)) * + Real.log (Fintype.card A : ℝ) := by ring + +theorem tendsto_log_multinomial_div_of_mass + {A : Type*} [Fintype A] [DecidableEq A] (counts : ℕ → A → ℕ) + (mass : ℝ) (p : A → ℝ) (hmass : 0 ≤ mass) + (htotal : Tendsto (fun n : ℕ => (∑ a, counts n a : ℕ) / (n : ℝ)) + atTop (𝓝 mass)) + (hempirical : 0 < mass → ∀ a, Tendsto + (fun n : ℕ => (counts n a : ℝ) / (∑ a, counts n a : ℕ)) atTop (𝓝 (p a))) : + Tendsto (fun n : ℕ => Real.log (Nat.multinomial Finset.univ (counts n) : ℝ) / + (n : ℝ)) atTop (𝓝 (mass * finiteEntropy p)) := by + by_cases hzero : mass = 0 + · subst mass + simpa only [zero_mul] using tendsto_log_multinomial_div_of_total_div_zero counts htotal + have hpos : 0 < mass := lt_of_le_of_ne hmass (Ne.symm hzero) + have htop : Tendsto (fun n => ∑ a, counts n a) atTop atTop := + (tendsto_natCast_atTop_iff (R := ℝ)).mp + (Tendsto.num (tendsto_natCast_atTop_atTop (R := ℝ)) hpos htotal) + have hlog := tendsto_log_multinomial_of_empirical_tendsto counts p htop (hempirical hpos) + apply (htotal.mul hlog).congr' + filter_upwards [htop.eventually (eventually_gt_atTop (0 : ℕ))] with n hn + have hn' : ((∑ a, counts n a : ℕ) : ℝ) ≠ 0 := Nat.cast_ne_zero.mpr (Nat.ne_of_gt hn) + rw [div_mul_div_comm, + mul_comm (n : ℝ) ((∑ a, counts n a : ℕ) : ℝ), mul_div_mul_left _ _ hn'] + +theorem tendsto_total_div_of_coordinate_rates + {A : Type*} [Fintype A] (counts : ℕ → A → ℕ) + (mass : ℝ) (p : A → ℝ) (hp : ∑ a, p a = 1) + (hcounts : ∀ a, Tendsto (fun n : ℕ => (counts n a : ℝ) / (n : ℝ)) + atTop (𝓝 (mass * p a))) : + Tendsto (fun n : ℕ => (∑ a, counts n a : ℕ) / (n : ℝ)) atTop (𝓝 mass) := by + have h := tendsto_finsetSum Finset.univ (fun a _ => hcounts a) + simpa only [← Finset.sum_div, ← Nat.cast_sum, ← Finset.mul_sum, hp, mul_one] using h + +theorem tendsto_empirical_of_coordinate_rates + {A : Type*} [Fintype A] (counts : ℕ → A → ℕ) + (mass : ℝ) (p : A → ℝ) (hmass : 0 < mass) (hp : ∑ a, p a = 1) + (hcounts : ∀ a, Tendsto (fun n : ℕ => (counts n a : ℝ) / (n : ℝ)) + atTop (𝓝 (mass * p a))) (a : A) : + Tendsto (fun n : ℕ => (counts n a : ℝ) / (∑ a, counts n a : ℕ)) + atTop (𝓝 (p a)) := by + have htotal := tendsto_total_div_of_coordinate_rates counts mass p hp hcounts + have h := (hcounts a).div htotal hmass.ne' + rw [mul_div_cancel_left₀ _ hmass.ne'] at h + apply h.congr' + filter_upwards [eventually_ne_atTop (0 : ℕ)] with n hn + exact div_div_div_cancel_right₀ (Nat.cast_ne_zero.mpr hn) _ _ + +theorem finiteEntropy_scalar {A : Type*} [Fintype A] + (p : A → ℝ) (mass : ℝ) (hp : ∑ a, p a = 1) : + finiteEntropy (fun a => mass * p a) = entropyTerm mass + mass * finiteEntropy p := by + simp only [finiteEntropy, entropyTerm_mul, Finset.sum_add_distrib, + ← Finset.sum_mul, ← Finset.mul_sum, hp, one_mul] + +theorem weighted_empirical_entropy_eq {A : Type*} [Fintype A] + (counts : A → ℕ) (scale : ℝ) : + ((∑ a, counts a : ℕ) / scale) * + finiteEntropy (fun a => (counts a : ℝ) / (∑ a, counts a : ℕ)) = + finiteEntropy (fun a => (counts a : ℝ) / scale) - + entropyTerm ((∑ a, counts a : ℕ) / scale) := by + by_cases hzero : (∑ a, counts a) = 0 + · have hc : ∀ a, counts a = 0 := by + intro a + have hle : counts a ≤ ∑ b, counts b := + Finset.single_le_sum (fun b _ => Nat.zero_le (counts b)) (Finset.mem_univ a) + rw [hzero] at hle + exact Nat.eq_zero_of_le_zero hle + simp [hc, finiteEntropy] + have hD : ((∑ a, counts a : ℕ) : ℝ) ≠ 0 := Nat.cast_ne_zero.mpr hzero + have hsum : (∑ a, (counts a : ℝ) / (∑ a, counts a : ℕ)) = 1 := by + rw [← Finset.sum_div, ← Nat.cast_sum, div_self hD] + have hfac (a : A) : (counts a : ℝ) / scale = + ((∑ a, counts a : ℕ) / scale) * ((counts a : ℝ) / (∑ a, counts a : ℕ)) := by + rw [div_mul_div_comm, + mul_comm ((∑ a, counts a : ℕ) : ℝ) (counts a : ℝ), mul_div_mul_right _ _ hD] + have h := finiteEntropy_scalar + (fun a => (counts a : ℝ) / (∑ a, counts a : ℕ)) + ((∑ a, counts a : ℕ) / scale) hsum + simp_rw [← hfac] at h + linarith + +theorem tendsto_weighted_empirical_entropy_of_coordinate_rates + {A : Type*} [Fintype A] (counts : ℕ → A → ℕ) + (mass : ℝ) (p : A → ℝ) (hp : ∑ a, p a = 1) + (hcounts : ∀ a, Tendsto (fun n : ℕ => (counts n a : ℝ) / (n : ℝ)) + atTop (𝓝 (mass * p a))) : + Tendsto (fun n : ℕ => ((∑ a, counts n a : ℕ) / (n : ℝ)) * + finiteEntropy (fun a => (counts n a : ℝ) / (∑ a, counts n a : ℕ))) + atTop (𝓝 (mass * finiteEntropy p)) := by + have htotal := tendsto_total_div_of_coordinate_rates counts mass p hp hcounts + have h := (tendsto_finiteEntropy_of_tendsto hcounts).sub (tendsto_entropyTerm htotal) + rw [finiteEntropy_scalar p mass hp, add_sub_cancel_left] at h + simpa only [weighted_empirical_entropy_eq] using h + +def sideCounts (counts : Shape → ℕ) (s : Fin 3) (a : Fin 17) : ℕ := + ∑ u, if shapeSide s u = a then counts u else 0 + +def sideMass (p : Shape → ℝ) (s : Fin 3) (a : Fin 17) : ℝ := + ∑ u, if shapeSide s u = a then p u else 0 + +theorem sideCounts_total (counts : Shape → ℕ) (s : Fin 3) : + (∑ a, sideCounts counts s a) = ∑ u, counts u := by + unfold sideCounts + rw [Finset.sum_comm] + simp + +theorem sideMass_total (p : Shape → ℝ) (s : Fin 3) : + (∑ a, sideMass p s a) = ∑ u, p u := by + unfold sideMass + rw [Finset.sum_comm] + simp + +theorem tendsto_sideCounts_div_of_coordinate_rates + (counts : ℕ → Shape → ℕ) (mass : ℝ) (p : Shape → ℝ) + (hcounts : ∀ u, Tendsto (fun n : ℕ => (counts n u : ℝ) / (n : ℝ)) + atTop (𝓝 (mass * p u))) (s : Fin 3) (a : Fin 17) : + Tendsto (fun n : ℕ => (sideCounts (counts n) s a : ℝ) / (n : ℝ)) + atTop (𝓝 (mass * sideMass p s a)) := by + have hfun (n : ℕ) : (sideCounts (counts n) s a : ℝ) / (n : ℝ) = + ∑ u, if shapeSide s u = a then (counts n u : ℝ) / (n : ℝ) else 0 := by + unfold sideCounts + rw [Nat.cast_sum, Finset.sum_div] + apply Finset.sum_congr rfl + intro u _ + by_cases h : shapeSide s u = a <;> simp [h] + simp_rw [hfun] + rw [sideMass, Finset.mul_sum] + apply tendsto_finsetSum + intro u _ + by_cases h : shapeSide s u = a + · simpa only [h, ite_true] using hcounts u + · simp only [h, ite_false, mul_zero] + exact tendsto_const_nhds + +variable {H : Type*} [Fintype H] [DecidableEq H] + +omit [Fintype H] [DecidableEq H] in +theorem target_side_population (counts : H → Shape → ℕ) + (e : Target counts) (h : H) (s : Fin 3) (a : Fin 17) : + wordPopulation (sideWord counts s (triple counts e) h) a = sideCounts (counts h) s a := by + let w : JointTypeCounts.FixedCoarseWords (counts h) (shapeSide s) + (sideWord counts s (triple counts e) h) := + ⟨(e h).val, (e h).property, fun _ => rfl⟩ + exact ((conditionalWords_nonempty_iff + (sideWord counts s (triple counts e) h) + (fun b u => if shapeSide s u = b then counts h u else 0)).mp + ⟨JointTypeCounts.fixedCoarseWordsEquiv _ _ _ w⟩) a + +omit [Fintype H] [DecidableEq H] in +theorem tendsto_weighted_target_side_entropy + (counts : ℕ → H → Shape → ℕ) (e : ∀ n, Target (counts n)) + (mass : H → ℝ) (p : H → Shape → ℝ) (hp : ∀ h, ∑ u, p h u = 1) + (hcounts : ∀ h u, Tendsto (fun n : ℕ => (counts n h u : ℝ) / (n : ℝ)) + atTop (𝓝 (mass h * p h u))) (h : H) (s : Fin 3) : + Tendsto (fun n : ℕ => ((∑ u, counts n h u : ℕ) / (n : ℝ)) * + finiteEntropy (fun a => + (wordPopulation (sideWord (counts n) s (triple (counts n) (e n)) h) a : ℝ) / + (∑ u, counts n h u : ℕ))) + atTop (𝓝 (mass h * finiteEntropy (sideMass (p h) s))) := by + have hside := tendsto_weighted_empirical_entropy_of_coordinate_rates + (fun n => sideCounts (counts n h) s) (mass h) (sideMass (p h) s) + ((sideMass_total (p h) s).trans (hp h)) + (tendsto_sideCounts_div_of_coordinate_rates (fun n => counts n h) + (mass h) (p h) (hcounts h) s) + simpa only [target_side_population, sideCounts_total] using hside + +theorem tendsto_log_target_card_div + (counts : ℕ → H → Shape → ℕ) (mass : H → ℝ) (p : H → Shape → ℝ) + (hmass : ∀ h, 0 ≤ mass h) + (htotal : ∀ h, Tendsto (fun n : ℕ => (∑ a, counts n h a : ℕ) / (n : ℝ)) + atTop (𝓝 (mass h))) + (hempirical : ∀ h, 0 < mass h → ∀ a, Tendsto + (fun n : ℕ => (counts n h a : ℝ) / (∑ a, counts n h a : ℕ)) + atTop (𝓝 (p h a))) : + Tendsto (fun n : ℕ => Real.log (Fintype.card (Target (counts n)) : ℝ) / (n : ℝ)) + atTop (𝓝 (∑ h, mass h * finiteEntropy (p h))) := by + simp_rw [target_card] + exact Separation.tendsto_log_nat_prod_div_nat Finset.univ + (fun h _ n => Nat.multinomial_pos _ _) + (fun h _ => tendsto_log_multinomial_div_of_mass + (fun n => counts n h) (mass h) (p h) (hmass h) (htotal h) (hempirical h)) + +theorem tendsto_log_target_card_div_of_coordinate_rates + (counts : ℕ → H → Shape → ℕ) (mass : H → ℝ) (p : H → Shape → ℝ) + (hmass : ∀ h, 0 ≤ mass h) (hp : ∀ h, ∑ a, p h a = 1) + (hcounts : ∀ h a, Tendsto (fun n : ℕ => (counts n h a : ℝ) / (n : ℝ)) + atTop (𝓝 (mass h * p h a))) : + Tendsto (fun n : ℕ => Real.log (Fintype.card (Target (counts n)) : ℝ) / (n : ℝ)) + atTop (𝓝 (∑ h, mass h * finiteEntropy (p h))) := by + apply tendsto_log_target_card_div counts mass p hmass + · intro h + exact tendsto_total_div_of_coordinate_rates (fun n => counts n h) + (mass h) (p h) (hp h) (hcounts h) + · intro h hpos a + exact tendsto_empirical_of_coordinate_rates (fun n => counts n h) + (mass h) (p h) hpos (hp h) (hcounts h) a + +theorem tendsto_log_targetSet_card_div_of_coordinate_rates + (counts : ℕ → H → Shape → ℕ) (mass : H → ℝ) (p : H → Shape → ℝ) + (hmass : ∀ h, 0 ≤ mass h) (hp : ∀ h, ∑ a, p h a = 1) + (hcounts : ∀ h a, Tendsto (fun n : ℕ => (counts n h a : ℝ) / (n : ℝ)) + atTop (𝓝 (mass h * p h a))) : + Tendsto (fun n : ℕ => Real.log ((targetSet (counts n)).card : ℝ) / (n : ℝ)) + atTop (𝓝 (∑ h, mass h * finiteEntropy (p h))) := by + simpa only [target_card, targetSet_card] using + tendsto_log_target_card_div_of_coordinate_rates counts mass p hmass hp hcounts + +end MatrixMultiplication.JointPopulationRates + + + + + + +namespace MatrixMultiplication.AllFieldActiveLaws + +open AllFieldParameters AllFieldHistory MatrixMultiplication.Foundation Filter +open scoped BigOperators Topology +attribute [local instance] Classical.propDecidable Classical.decEq + +def branchProbability {K : ℕ} (w : Work K) (b : w.Branch) : ℚ := + match w with + | .stageA h => stageALaw (initialShape h.val) (aSplit ⟨h, b, false⟩) + | .stageB h => stageBLaw (aShape h.val) (bSplit ⟨h, b, false⟩) + | .stageC h => stageCWeight (cParameterParent h) (cShapeParent h) b + +theorem branchProbability_nonneg {K : ℕ} (w : Work K) (b : w.Branch) : + 0 ≤ branchProbability w b := by + cases w with + | stageA h => exact (stageALaw_positive _ _ (aSplit_mem ⟨h, b, false⟩)).le + | stageB h => exact (stageBLaw_positive _ _ (bSplit_mem ⟨h, b, false⟩)).le + | stageC h => exact stageCWeight_nonnegative _ _ b + +theorem branchProbability_total {K : ℕ} (w : Work K) : + ∑ b : w.Branch, branchProbability w b = 1 := by + cases w with + | stageA h => + change (∑ b : ASplit h, + stageALaw (initialShape h.val) (below (initialShape h.val))[b.val]) = 1 + rw [Fin.sum_univ_fun_getElem] + exact stageALaw_normalized _ h.property + | stageB h => + change (∑ b : BSplit h, + stageBLaw (aShape h.val) (below (aShape h.val))[b.val]) = 1 + rw [Fin.sum_univ_fun_getElem] + exact stageBLaw_normalized _ h.property + | stageC h => exact stageCWeight_normalized _ _ + +def branchLaw {K : ℕ} (w : Work K) : FiniteLaw w.Branch where + mass b := (branchProbability w b : ℝ) + nonneg b := by exact_mod_cast branchProbability_nonneg w b + total := by exact_mod_cast branchProbability_total w + +@[simp] theorem branchLaw_mass {K : ℕ} (w : Work K) (b : w.Branch) : + (branchLaw w).mass b = (branchProbability w b : ℝ) := rfl + +def placedLaw {K : ℕ} (w : PlacedWork K) : FiniteLaw JointPopulation.Shape := + (branchLaw w.1).map (branchShape w) + +@[simp] theorem placedLaw_mass {K : ℕ} (w : PlacedWork K) + (u : JointPopulation.Shape) : + (placedLaw w).mass u = + ∑ b : w.1.Branch, if branchShape w b = u then + (branchProbability w.1 b : ℝ) else 0 := by + simp only [placedLaw, FiniteLaw.map_mass, branchLaw_mass] + +theorem placedLaw_mass_branch {K : ℕ} (w : PlacedWork K) (b : w.1.Branch) : + (placedLaw w).mass (branchShape w b) = (branchProbability w.1 b : ℝ) := + FiniteLaw.map_mass_apply _ _ (branchShape_injective w) b + +theorem placedLaw_entropy {K : ℕ} (w : PlacedWork K) : + finiteEntropy (placedLaw w).mass = finiteEntropy (branchLaw w.1).mass := + FiniteLaw.map_entropy_of_injective _ _ (branchShape_injective w) + +theorem placedLaw_sideMass {K : ℕ} (w : PlacedWork K) (s : Fin 3) + (k : Fin 17) : + JointPopulationRates.sideMass (placedLaw w).mass s k = + ∑ b : w.1.Branch, if JointPopulation.shapeSide s (branchShape w b) = k + then (branchProbability w.1 b : ℝ) else 0 := by + unfold JointPopulationRates.sideMass + simp only [placedLaw_mass] + calc + _ = ∑ u : JointPopulation.Shape, ∑ b : w.1.Branch, + if branchShape w b = u then + if JointPopulation.shapeSide s u = k then (branchProbability w.1 b : ℝ) else 0 + else 0 := by + apply Finset.sum_congr rfl + intro u _ + by_cases hu : JointPopulation.shapeSide s u = k <;> simp [hu] + _ = _ := by rw [Finset.sum_comm]; simp + +theorem branchPopulation_cast_rat {K : ℕ} (allocation : Allocation) (dilation : ℕ) + (w : PlacedWork K) (b : w.1.Branch) : + (branchPopulation allocation dilation w b : ℚ) = + (population allocation dilation (w.1.source, w.2) : ℚ) * + branchProbability w.1 b := by + rcases w with ⟨w, phi⟩ + cases w <;> + simp only [branchPopulation, Work.child, Work.source, population_cast, + amount, canonicalAmount, aAmount, bAmount, cAmount, branchProbability] <;> ring + +theorem branchPopulation_cast {K : ℕ} (allocation : Allocation) (dilation : ℕ) + (w : PlacedWork K) (b : w.1.Branch) : + (branchPopulation allocation dilation w b : ℝ) = + (population allocation dilation (w.1.source, w.2) : ℝ) * + (branchLaw w.1).mass b := by + rw [branchLaw_mass] + exact_mod_cast branchPopulation_cast_rat allocation dilation w b + +theorem jointCounts_cast {K : ℕ} (allocation : Allocation) (dilation : ℕ) + (w : PlacedWork K) (u : JointPopulation.Shape) : + (jointCounts allocation dilation w u : ℝ) = + (population allocation dilation (w.1.source, w.2) : ℝ) * + (placedLaw w).mass u := by + simp only [jointCounts, shapeCounts, Nat.cast_sum, placedLaw_mass, Finset.mul_sum] + apply Finset.sum_congr rfl + intro b _ + by_cases hb : branchShape w b = u + · simp only [hb, ite_true, branchPopulation_cast, branchLaw_mass] + · simp [hb] + +theorem jointCounts_ratio {K dilation : ℕ} (allocation : Allocation) + (hd : 0 < dilation) (w : PlacedWork K) (u : JointPopulation.Shape) : + (jointCounts allocation dilation w u : ℝ) / + population allocation dilation (w.1.source, w.2) = (placedLaw w).mass u := by + rw [jointCounts_cast] + have hp : (population allocation dilation (w.1.source, w.2) : ℝ) ≠ 0 := by + exact_mod_cast Nat.ne_of_gt (work_source_population_pos allocation hd w) + exact mul_div_cancel_left₀ _ hp + +theorem jointCounts_normalized {K dilation : ℕ} (allocation : Allocation) + (hd : 0 < dilation) (w : PlacedWork K) : + (∑ u, (jointCounts allocation dilation w u : ℝ) / + population allocation dilation (w.1.source, w.2)) = 1 := by + simp only [jointCounts_ratio allocation hd] + exact (placedLaw w).total + +theorem population_cast_real {K : ℕ} (allocation : Allocation) (dilation : ℕ) + (h : History K) : + (population allocation dilation h : ℝ) = + (populationLength (K := K) allocation dilation : ℝ) * (amount allocation h : ℝ) := by + exact_mod_cast population_cast allocation dilation h + +theorem jointCounts_source_cast {K : ℕ} (allocation : Allocation) (dilation : ℕ) + (w : PlacedWork K) (u : JointPopulation.Shape) : + (jointCounts allocation dilation w u : ℝ) = + (populationLength (K := K) allocation dilation : ℝ) * + ((amount allocation (w.1.source, w.2) : ℝ) * (placedLaw w).mass u) := by + rw [jointCounts_cast, population_cast_real, mul_assoc] + +theorem jointCounts_source_ratio {K dilation : ℕ} (allocation : Allocation) + (hd : 0 < dilation) (w : PlacedWork K) (u : JointPopulation.Shape) : + (jointCounts allocation dilation w u : ℝ) / + populationLength (K := K) allocation dilation = + (amount allocation (w.1.source, w.2) : ℝ) * (placedLaw w).mass u := by + rw [jointCounts_source_cast] + have hp : (populationLength (K := K) allocation dilation : ℝ) ≠ 0 := by + exact_mod_cast Nat.ne_of_gt + (AllFieldPopulationCounts.blockLength_pos (amount (K := K) allocation) hd) + exact mul_div_cancel_left₀ _ hp + +theorem jointCounts_source_rate {K : ℕ} (allocation : Allocation) + (w : PlacedWork K) (u : JointPopulation.Shape) : + Tendsto (fun dilation : ℕ => (jointCounts allocation dilation w u : ℝ) / + populationLength (K := K) allocation dilation) atTop + (𝓝 ((amount allocation (w.1.source, w.2) : ℝ) * (placedLaw w).mass u)) := by + apply tendsto_const_nhds.congr' + filter_upwards [eventually_gt_atTop (0 : ℕ)] with dilation hd + exact (jointCounts_source_ratio allocation hd w u).symm + +theorem populationLength_dilation {K : ℕ} (allocation : Allocation) (dilation : ℕ) : + populationLength (K := K) allocation dilation = + dilation * populationLength (K := K) allocation 1 := by + simp only [populationLength, AllFieldPopulationCounts.blockLength, one_mul] + +theorem jointCounts_dilation_ratio {K dilation : ℕ} (allocation : Allocation) + (hd : 0 < dilation) (w : PlacedWork K) (u : JointPopulation.Shape) : + (jointCounts allocation dilation w u : ℝ) / (dilation : ℝ) = + ((populationLength (K := K) allocation 1 : ℝ) * + (amount allocation (w.1.source, w.2) : ℝ)) * (placedLaw w).mass u := by + rw [jointCounts_source_cast, populationLength_dilation, Nat.cast_mul] + have hd' : (dilation : ℝ) ≠ 0 := Nat.cast_ne_zero.mpr (Nat.ne_of_gt hd) + field_simp [hd'] + +theorem jointCounts_dilation_rate {K : ℕ} (allocation : Allocation) + (w : PlacedWork K) (u : JointPopulation.Shape) : + Tendsto (fun dilation : ℕ => (jointCounts allocation dilation w u : ℝ) / + (dilation : ℝ)) atTop + (𝓝 (((populationLength (K := K) allocation 1 : ℝ) * + (amount allocation (w.1.source, w.2) : ℝ)) * (placedLaw w).mass u)) := by + apply tendsto_const_nhds.congr' + filter_upwards [eventually_gt_atTop (0 : ℕ)] with dilation hd + exact (jointCounts_dilation_ratio allocation hd w u).symm + +def orderLaw {K tick : ℕ} {sigma : Placement} (h : ActiveOrder K tick sigma) : + FiniteLaw JointPopulation.Shape := placedLaw h.val.val + +def orderMass {K tick : ℕ} {sigma : Placement} (allocation : Allocation) + (h : ActiveOrder K tick sigma) : ℝ := + amount allocation (h.val.val.1.source, h.val.val.2) + +def orderCounts {K tick : ℕ} {sigma : Placement} (allocation : Allocation) + (dilation : ℕ) (h : ActiveOrder K tick sigma) : JointPopulation.Shape → ℕ := + activeCounts allocation dilation h.val + +theorem orderMass_nonneg {K tick : ℕ} {sigma : Placement} (allocation : Allocation) + (h : ActiveOrder K tick sigma) : 0 ≤ orderMass allocation h := by + unfold orderMass + exact_mod_cast amount_nonneg allocation (h.val.val.1.source, h.val.val.2) + +theorem orderCounts_source_cast {K tick : ℕ} {sigma : Placement} + (allocation : Allocation) (dilation : ℕ) (h : ActiveOrder K tick sigma) + (u : JointPopulation.Shape) : + (orderCounts allocation dilation h u : ℝ) = + (populationLength (K := K) allocation dilation : ℝ) * + (orderMass allocation h * (orderLaw h).mass u) := + jointCounts_source_cast allocation dilation h.val.val u + +theorem orderCounts_source_rate {K tick : ℕ} {sigma : Placement} + (allocation : Allocation) (h : ActiveOrder K tick sigma) (u : JointPopulation.Shape) : + Tendsto (fun dilation : ℕ => (orderCounts allocation dilation h u : ℝ) / + populationLength (K := K) allocation dilation) atTop + (𝓝 (orderMass allocation h * (orderLaw h).mass u)) := + jointCounts_source_rate allocation h.val.val u + +theorem orderCounts_dilation_rate {K tick : ℕ} {sigma : Placement} + (allocation : Allocation) (h : ActiveOrder K tick sigma) (u : JointPopulation.Shape) : + Tendsto (fun dilation : ℕ => (orderCounts allocation dilation h u : ℝ) / + (dilation : ℝ)) atTop + (𝓝 (((populationLength (K := K) allocation 1 : ℝ) * orderMass allocation h) * + (orderLaw h).mass u)) := + jointCounts_dilation_rate allocation h.val.val u + +end MatrixMultiplication.AllFieldActiveLaws + + + + + + +namespace MatrixMultiplication.AllFieldGroupTargetRate + +open AllFieldHistory AllFieldActiveLaws MatrixMultiplication.Foundation Filter +open scoped BigOperators Topology +attribute [local instance] Classical.propDecidable Classical.decEq + +variable {K tick : ℕ} {sigma : Placement} + +theorem source_unit_pos (allocation : Allocation) : + 0 < populationLength (K := K) allocation 1 := + AllFieldPopulationCounts.blockLength_pos (amount (K := K) allocation) (by decide) + +theorem source_length_dilation (allocation : Allocation) (m : ℕ) : + populationLength (K := K) allocation m = + m * populationLength (K := K) allocation 1 := + populationLength_dilation allocation m + +theorem orderCounts_dilation (allocation : Allocation) (m : ℕ) + (h : ActiveOrder K tick sigma) (u : JointPopulation.Shape) : + orderCounts allocation m h u = m * orderCounts allocation 1 h u := by + apply Nat.cast_injective (R := ℝ) + rw [Nat.cast_mul, orderCounts_source_cast, orderCounts_source_cast, + populationLength_dilation, Nat.cast_mul] + ring + +theorem orderCounts_dilation_fun (allocation : Allocation) (m : ℕ) : + orderCounts (K := K) (tick := tick) (sigma := sigma) allocation m = + fun h u => m * orderCounts allocation 1 h u := by + funext h u + exact orderCounts_dilation allocation m h u + +theorem orderCounts_sum (allocation : Allocation) (m : ℕ) + (h : ActiveOrder K tick sigma) : + (∑ u, orderCounts allocation m h u) = + population allocation m (h.val.val.1.source, h.val.val.2) := + jointCounts_sum allocation m h.val.val + +theorem baseSize_eq_population (allocation : Allocation) (m : ℕ) + (h : ActiveOrder K tick sigma) : + JointCompatibilityScaling.baseSize (orderCounts allocation m) h = + population allocation m (h.val.val.1.source, h.val.val.2) := + orderCounts_sum allocation m h + +theorem baseSize_dilation (allocation : Allocation) (m : ℕ) + (h : ActiveOrder K tick sigma) : + JointCompatibilityScaling.baseSize (orderCounts allocation m) h = + m * JointCompatibilityScaling.baseSize (orderCounts allocation 1) h := by + simp only [JointCompatibilityScaling.baseSize] + simp_rw [orderCounts_dilation allocation m] + exact (Finset.mul_sum Finset.univ _ m).symm + +theorem baseSize_cast_real (allocation : Allocation) + (h : ActiveOrder K tick sigma) : + (JointCompatibilityScaling.baseSize (orderCounts allocation 1) h : ℝ) = + (populationLength (K := K) allocation 1 : ℝ) * orderMass allocation h := by + rw [baseSize_eq_population, population_cast_real] + rfl + +theorem baseSize_pos (allocation : Allocation) + (h : ActiveOrder K tick sigma) : + 0 < JointCompatibilityScaling.baseSize (orderCounts allocation 1) h := by + rw [baseSize_eq_population] + exact work_source_population_pos allocation (by decide) h.val.val + +theorem base_empirical_eq (allocation : Allocation) + (h : ActiveOrder K tick sigma) (u : JointPopulation.Shape) : + (orderCounts allocation 1 h u : ℝ) / + JointCompatibilityScaling.baseSize (orderCounts allocation 1) h = + (orderLaw h).mass u := by + rw [baseSize_eq_population] + exact jointCounts_ratio allocation (by decide) h.val.val u + +def groupEntropyRate (allocation : Allocation) : ℝ := + ∑ h : ActiveOrder K tick sigma, + ((populationLength (K := K) allocation 1 : ℝ) * orderMass allocation h) * + finiteEntropy (orderLaw h).mass + +theorem groupEntropyRate_nonneg (allocation : Allocation) : + 0 ≤ groupEntropyRate (K := K) (tick := tick) (sigma := sigma) allocation := by + apply Finset.sum_nonneg + intro h _ + exact mul_nonneg + (mul_nonneg (Nat.cast_nonneg _) (orderMass_nonneg allocation h)) + (FiniteLaw.entropy_nonneg (orderLaw h)) + +theorem baseEntropy_eq_groupEntropyRate (allocation : Allocation) : + JointCompatibilityScaling.baseEntropy + (orderCounts (K := K) (tick := tick) (sigma := sigma) allocation 1) = + groupEntropyRate (K := K) (tick := tick) (sigma := sigma) allocation := by + simp only [JointCompatibilityScaling.baseEntropy, groupEntropyRate] + simp only [base_empirical_eq] + simp only [baseSize_cast_real] + +theorem target_card_pos (allocation : Allocation) (m : ℕ) : + 0 < Fintype.card (JointPopulation.Target + (orderCounts (K := K) (tick := tick) (sigma := sigma) allocation m)) := + Fintype.card_pos_iff.mpr (JointPopulation.target_nonempty _) + +theorem tendsto_log_target_card_div (allocation : Allocation) : + Tendsto (fun m : ℕ => + Real.log (Fintype.card (JointPopulation.Target + (orderCounts (K := K) (tick := tick) (sigma := sigma) allocation m)) : ℝ) / + (m : ℝ)) atTop + (𝓝 (groupEntropyRate (K := K) (tick := tick) (sigma := sigma) allocation)) := by + apply JointPopulationRates.tendsto_log_target_card_div_of_coordinate_rates + (fun m => orderCounts allocation m) + (fun h => (populationLength (K := K) allocation 1 : ℝ) * orderMass allocation h) + (fun h => (orderLaw h).mass) + · intro h + exact mul_nonneg (Nat.cast_nonneg _) (orderMass_nonneg allocation h) + · intro h + exact (orderLaw h).total + · exact orderCounts_dilation_rate allocation + +theorem tendsto_log_targetSet_card_div (allocation : Allocation) : + Tendsto (fun m : ℕ => + Real.log ((JointPopulation.targetSet + (orderCounts (K := K) (tick := tick) (sigma := sigma) allocation m)).card : ℝ) / + (m : ℝ)) atTop + (𝓝 (groupEntropyRate (K := K) (tick := tick) (sigma := sigma) allocation)) := by + simpa only [JointPopulation.target_card, JointPopulation.targetSet_card] using + tendsto_log_target_card_div (K := K) (tick := tick) (sigma := sigma) allocation + +end MatrixMultiplication.AllFieldGroupTargetRate + + + + + + +namespace MatrixMultiplication.AllFieldPairConditionalEntropy + +open MatrixMultiplication.Foundation AllFieldParameters AllFieldHistory +open AllFieldNativeCapacity AllFieldPairMarginals +open scoped BigOperators + +theorem entropy_sub_eq_conditional_sum + {A B C : Type*} [Fintype A] [Fintype B] [Fintype C] + (p : FiniteLaw A) (q : FiniteLaw B) (m : FiniteLaw C) + (f : A → C) (g : B → C) (hp : p.map f = m) (hq : q.map g = m) : + finiteEntropy p.mass - finiteEntropy q.mass = + ∑ k, m.mass k * (finiteEntropy (p.conditional f k).mass - + finiteEntropy (q.conditional g k).mass) := by + rw [p.entropy_eq_map_add_conditional f, q.entropy_eq_map_add_conditional g, hp, hq] + simp only [mul_sub, Finset.sum_sub_distrib] + ring + +def stageASplitWeight (g : Shape) (hg : g ∈ positiveInitial) (side : Fin 3) : + Fin (below g).length → Fin 17 := + fun j => ⟨(below g).get j side, + Nat.lt_succ_of_le ((below_le (List.get_mem _ _) side).trans + ((positiveInitial_shape_spec g hg).1 side))⟩ + +def stageBSplitWeight (t : Shape) (ht : t ∈ positiveSecond) (side : Fin 3) : + Fin (below t).length → Fin 17 := + fun j => ⟨(below t).get j side, + Nat.lt_succ_of_le ((below_le (List.get_mem _ _) side).trans + ((positiveSecond_shape_spec t ht).1 side))⟩ + +theorem stageASplitLaw_ownWeight_marginal (g : Shape) (hg : g ∈ positiveInitial) + (side : Fin 3) : + (stageASplitLaw g hg).map (stageASplitWeight g hg side) = + stageAMarginalLaw g hg side := rfl + +theorem stageBSplitLaw_ownWeight_marginal (t : Shape) (ht : t ∈ positiveSecond) + (side : Fin 3) : + (stageBSplitLaw t ht).map (stageBSplitWeight t ht side) = + stageBMarginalLaw t ht side := rfl + +theorem stageA_entropy_sub_pair_eq_conditional_sum + (g : Shape) (hg : g ∈ positiveInitial) (side : Fin 3) : + finiteEntropy (stageASplitLaw g hg).mass - + finiteEntropy (stageAPairLaw g hg side).mass = + ∑ k, (stageAMarginalLaw g hg side).mass k * + (finiteEntropy ((stageASplitLaw g hg).conditional + (stageASplitWeight g hg side) k).mass - + finiteEntropy ((stageAPairLaw g hg side).conditional + (fun ij => halfWeightCode ij.1) k).mass) := + entropy_sub_eq_conditional_sum _ _ _ _ _ + (stageASplitLaw_ownWeight_marginal g hg side) + (stageAPairLaw_leftWeight_marginal g hg side) + +theorem stageB_entropy_sub_pair_eq_conditional_sum + (t : Shape) (ht : t ∈ positiveSecond) (side : Fin 3) : + finiteEntropy (stageBSplitLaw t ht).mass - + finiteEntropy (stageBPairLaw t ht side).mass = + ∑ k, (stageBMarginalLaw t ht side).mass k * + (finiteEntropy ((stageBSplitLaw t ht).conditional + (stageBSplitWeight t ht side) k).mass - + finiteEntropy ((stageBPairLaw t ht side).conditional + (fun ij => statisticWeightCode ij.1) k).mass) := + entropy_sub_eq_conditional_sum _ _ _ _ _ + (stageBSplitLaw_ownWeight_marginal t ht side) + (stageBPairLaw_leftWeight_marginal t ht side) + +end MatrixMultiplication.AllFieldPairConditionalEntropy + + + + + + +namespace MatrixMultiplication.AllFieldGroupNativeLaws + +open MatrixMultiplication.Foundation AllFieldParameters AllFieldHistory +open AllFieldHistoryChildLaws AllFieldGroupOrbitData AllFieldActiveLaws +open AllFieldNativeCapacity AllFieldPairMarginals AllFieldPairConditionalEntropy +open scoped BigOperators +attribute [local instance] Classical.propDecidable Classical.decEq + +def statisticComplement {K : ℕ} (w : Work K) : w.Statistic ≃ w.Statistic := + match w with + | .stageA _ => CWCompleteStatistics.orderedComplementStatistic + | .stageB _ => CWCompleteStatistics.complementStatistic + | .stageC _ => Equiv.refl _ + +theorem childLaw_complementary_sides {K : ℕ} (w : Work K) + (u : Shape) (hu : u ∈ shapes (2 * w.halfLength)) + (source target : Fin 3) (hne : source ≠ target) + (hsum : u source + u target = 2 * w.halfLength) (a : w.Statistic) : + w.childLaw u source ((statisticComplement w).symm a) = w.childLaw u target a := by + cases w with + | stageA h => exact halfLaw_complementary_sides u hu source target hne hsum a + | stageB h => + exact littleLaw_complement (aShape h.val) u source target + (lt_of_le_of_lt (mem_shapes_bound hu source) (by norm_num [Work.halfLength])) + (lt_of_le_of_lt (mem_shapes_bound hu target) (by norm_num [Work.halfLength])) + hsum a + | stageC h => rfl + +def halfLawAt {K tick : ℕ} (right : Bool) (h : Active K tick) + (u : JointPopulation.Shape) (side : Fin 3) : Statistic h → ℝ := + if right then rightLaw h u side else leftLaw h u side + +def childWeight {K tick : ℕ} (right : Bool) (h : Active K tick) + (u : JointPopulation.Shape) (side : Fin 3) : ℕ := + if right then activeParentShape h side - (JointPopulation.shapeSide side u).val + else (JointPopulation.shapeSide side u).val + +theorem halfLawAt_eq {K tick : ℕ} (right : Bool) (h : Active K tick) + (u : JointPopulation.Shape) (side : Fin 3) (a : Statistic h) : + halfLawAt right h u side a = + (h.val.1.childLaw + (halfShape h.val.1.parentShape (canonicalChildShape h.val u) right) + (h.val.2.symm side) a : ℝ) := by + cases right <;> rfl + +theorem halfLawAt_nonnegative {K tick : ℕ} (right : Bool) (h : Active K tick) + (u : JointPopulation.Shape) (side : Fin 3) (a : Statistic h) : + 0 ≤ halfLawAt right h u side a := by + cases right + · exact leftLaw_nonnegative h u side a + · exact rightLaw_nonnegative h u side a + +theorem halfLawAt_normalized {K tick : ℕ} (allocation : Allocation) (m : ℕ) + (right : Bool) (h : Active K tick) (u : JointPopulation.Shape) + (hu : 0 < activeCounts allocation m h u) (side : Fin 3) : + ∑ a, halfLawAt right h u side a = 1 := by + cases right + · exact leftLaw_normalized allocation m h u hu side + · exact rightLaw_normalized allocation m h u hu side + +theorem halfLawAt_le_one_of_counts_pos {K tick : ℕ} (allocation : Allocation) (m : ℕ) + (right : Bool) (h : Active K tick) (u : JointPopulation.Shape) + (hu : 0 < activeCounts allocation m h u) (side : Fin 3) (a : Statistic h) : + halfLawAt right h u side a ≤ 1 := by + have hle := Finset.single_le_sum + (fun b (_ : b ∈ Finset.univ) => halfLawAt_nonnegative right h u side b) + (Finset.mem_univ a) + rw [halfLawAt_normalized allocation m right h u hu side] at hle + exact hle + +def supportedHalfLaw {K tick : ℕ} (allocation : Allocation) (right : Bool) + (h : Active K tick) (u : JointPopulation.Shape) (side : Fin 3) : Statistic h → ℝ := + if 0 < activeCounts allocation 1 h u then halfLawAt right h u side else fun _ => 0 + +theorem supportedHalfLaw_bounds {K tick : ℕ} (allocation : Allocation) (right : Bool) + (h : Active K tick) (u : JointPopulation.Shape) (side : Fin 3) (a : Statistic h) : + 0 ≤ supportedHalfLaw allocation right h u side a ∧ + supportedHalfLaw allocation right h u side a ≤ 1 := by + unfold supportedHalfLaw + split_ifs with hu + · exact ⟨halfLawAt_nonnegative right h u side a, + halfLawAt_le_one_of_counts_pos allocation 1 right h u hu side a⟩ + · norm_num + +theorem supportedHalfLaw_eq_of_counts_pos {K tick : ℕ} (allocation : Allocation) + (m : ℕ) (right : Bool) (h : Active K tick) (u : JointPopulation.Shape) + (hu : 0 < activeCounts allocation m h u) (side : Fin 3) : + supportedHalfLaw allocation right h u side = halfLawAt right h u side := by + have hbase : 0 < activeCounts allocation 1 h u := by + rw [AllFieldHistorySupport.activeCounts_dilation] at hu + exact Nat.pos_of_mul_pos_left hu + simp only [supportedHalfLaw, hbase, ite_true] + +theorem placedLaw_mass_zero_of_count_zero {K : ℕ} (allocation : Allocation) + (w : PlacedWork K) (u : JointPopulation.Shape) + (hu : jointCounts allocation 1 w u = 0) : (placedLaw w).mass u = 0 := by + have hp : (population allocation 1 (w.1.source, w.2) : ℝ) ≠ 0 := by + exact_mod_cast Nat.ne_of_gt + (AllFieldHistory.work_source_population_pos allocation (by decide : 0 < (1 : ℕ)) w) + have he := jointCounts_cast allocation 1 w u + rw [hu, Nat.cast_zero] at he + exact (mul_eq_zero.mp he.symm).resolve_left hp + +theorem halfShape_childWeight {K tick : ℕ} (right : Bool) (h : Active K tick) + (u : JointPopulation.Shape) (side : Fin 3) : + (halfShape h.val.1.parentShape (canonicalChildShape h.val u) right) + (h.val.2.symm side) = childWeight right h u side := by + cases right <;> + simp [halfShape, canonicalChildShape, childWeight, activeParentShape, + physicalShape, decodeShape, AllFieldParameters.complement] + +theorem halfShape_mem_of_counts_pos {K tick : ℕ} (allocation : Allocation) (m : ℕ) + (right : Bool) (h : Active K tick) (u : JointPopulation.Shape) + (hu : 0 < activeCounts allocation m h u) : + halfShape h.val.1.parentShape (canonicalChildShape h.val u) right ∈ + shapes (2 * h.val.1.halfLength) := by + obtain ⟨b, rfl, _⟩ := shapeCounts_positive _ _ u hu + rw [canonicalChildShape_branchShape] + exact h.val.1.halfShape_mem b right + +theorem childWeight_sum {K tick : ℕ} (allocation : Allocation) (m : ℕ) + (right : Bool) (h : Active K tick) (u : JointPopulation.Shape) + (hu : 0 < activeCounts allocation m h u) (sigma : Placement) : + childWeight right h u (sigma 0) + childWeight right h u (sigma 1) + + childWeight right h u (sigma 2) = 2 * h.val.1.halfLength := by + let v := halfShape h.val.1.parentShape (canonicalChildShape h.val u) right + have ht := mem_shapes_total (halfShape_mem_of_counts_pos allocation m right h u hu) + have hp := Equiv.sum_comp (sigma.trans h.val.2.symm) v + have he : (∑ i : Fin 3, v (h.val.2.symm (sigma i))) = 2 * h.val.1.halfLength := by + calc + _ = ∑ i : Fin 3, v i := hp + _ = _ := by simpa [v, shapeTotal, Fin.sum_univ_succ, Nat.add_assoc] using ht + simpa [v, halfShape_childWeight, Fin.sum_univ_succ, Nat.add_assoc] using he + +theorem designated_source_geometry (weight : Fin 3 → ℕ) (total : ℕ) + (htotal : weight 0 + weight 1 + weight 2 = total) (side : Fin 3) + (hd : if side = 1 then weight 2 = 0 + else if side = 2 then weight 0 * weight 1 = 0 else False) : + let source : Fin 3 := if side = 2 ∧ weight 1 ≠ 0 then 1 else 0 + source ≠ side ∧ weight source + weight side = total := by + fin_cases side + · simp at hd + · simp at hd ⊢ + omega + · by_cases hzero : weight 1 = 0 + · simp [hzero] at hd ⊢ + omega + · have hz : weight 0 = 0 := by simpa [hzero] using hd + simp [hzero] + omega + +theorem compatibilityLaw_eq {K tick : ℕ} (allocation : Allocation) (m : ℕ) + (sigma : Placement) (right : Bool) (side : Fin 3) + (h : ActiveOrder K tick sigma) (u : JointPopulation.Shape) + (hu : 0 < Counts allocation m sigma h u) + (hd : designated right side sigma h u) : + compatibilityLaw right side sigma h u = + if right then rightLaw h.val u (sigma side) else leftLaw h.val u (sigma side) := by + let weight : Fin 3 → ℕ := fun i => childWeight right h.val u (sigma i) + let source : Fin 3 := if side = 2 ∧ weight 1 ≠ 0 then 1 else 0 + have hdesignated : if side = 1 then weight 2 = 0 + else if side = 2 then weight 0 * weight 1 = 0 else False := by + simpa only [AllFieldGroupOrbitData.designated, weight, childWeight] using hd.2 + have hgeom := designated_source_geometry weight (2 * h.val.val.1.halfLength) + (childWeight_sum allocation m right h.val u hu sigma) side hdesignated + have hsource : (if side = 2 ∧ weight 1 ≠ 0 then sigma 1 else sigma 0) = sigma source := by + dsimp only [source] + split_ifs <;> rfl + have hne : h.val.val.2.symm (sigma source) ≠ h.val.val.2.symm (sigma side) := by + intro heq + exact hgeom.1 (sigma.injective (h.val.val.2.symm.injective heq)) + have hsum : + (halfShape h.val.val.1.parentShape (canonicalChildShape h.val.val u) right) + (h.val.val.2.symm (sigma source)) + + (halfShape h.val.val.1.parentShape (canonicalChildShape h.val.val u) right) + (h.val.val.2.symm (sigma side)) = 2 * h.val.val.1.halfLength := by + simpa only [halfShape_childWeight] using hgeom.2 + funext a + have hlaw := childLaw_complementary_sides h.val.val.1 + (halfShape h.val.val.1.parentShape (canonicalChildShape h.val.val u) right) + (halfShape_mem_of_counts_pos allocation m right h.val u hu) + (h.val.val.2.symm (sigma source)) (h.val.val.2.symm (sigma side)) hne hsum a + have hre : halfLawAt right h.val u (sigma source) + ((statisticComplement h.val.val.1).symm a) = + halfLawAt right h.val u (sigma side) a := by + rw [halfLawAt_eq, halfLawAt_eq] + exact_mod_cast hlaw + change ((if right then rightLaw h.val u + (if side = 2 ∧ weight 1 ≠ 0 then sigma 1 else sigma 0) + else leftLaw h.val u + (if side = 2 ∧ weight 1 ≠ 0 then sigma 1 else sigma 0)) + ((statisticComplement h.val.val.1).symm a)) = _ + rw [hsource] + exact hre + +def nativePairLaw {K : ℕ} (w : Work K) (side : Fin 3) : + FiniteLaw (w.Statistic × w.Statistic) := + match w with + | .stageA h => stageAPairLaw (initialShape h.val) h.property side + | .stageB h => stageBPairLaw (aShape h.val) h.property side + | .stageC parent => + { mass := fun _ => 1 + nonneg := fun _ => zero_le_one + total := by + let : Unique (Work.stageC parent).Statistic := inferInstanceAs (Unique PUnit) + simp } + +theorem placedLaw_sum_mul {K : ℕ} (w : PlacedWork K) + (f : JointPopulation.Shape → ℝ) : + (∑ u, (placedLaw w).mass u * f u) = + ∑ b : w.1.Branch, (branchLaw w.1).mass b * f (branchShape w b) := by + exact (JointEntropyMax.sum_mass_mul_coordinate + (branchLaw w.1) (branchShape w) f).symm + +theorem childLaw_branchShape {K : ℕ} (w : PlacedWork K) + (b : w.1.Branch) (side : Fin 3) (a : w.1.Statistic) : + childLaw w (branchShape w b) side a = + (w.1.childLaw (w.1.splitShape b) (w.2.symm side) a : ℝ) := by + change (w.1.childLaw (canonicalChildShape w (branchShape w b)) + (w.2.symm side) a : ℝ) = _ + rw [canonicalChildShape_branchShape] + +theorem rightChildLaw_branchShape {K : ℕ} (w : PlacedWork K) + (b : w.1.Branch) (side : Fin 3) (a : w.1.Statistic) : + rightChildLaw w (branchShape w b) side a = + (w.1.childLaw (AllFieldParameters.complement w.1.parentShape (w.1.splitShape b)) + (w.2.symm side) a : ℝ) := by + change (w.1.childLaw + (AllFieldParameters.complement w.1.parentShape (canonicalChildShape w (branchShape w b))) + (w.2.symm side) a : ℝ) = _ + rw [canonicalChildShape_branchShape] + +theorem branchPairMixture_eq_native {K : ℕ} (w : Work K) (side : Fin 3) + (a : w.Statistic × w.Statistic) : + (∑ b : w.Branch, (branchLaw w).mass b * + (w.childLaw (w.splitShape b) side a.1 : ℝ) * + (w.childLaw (AllFieldParameters.complement w.parentShape (w.splitShape b)) side a.2 : ℝ)) = + (nativePairLaw w side).mass a := by + cases w with + | stageA h => + change (∑ b : Fin (below (initialShape h.val)).length, + (stageALaw (initialShape h.val) (below (initialShape h.val))[b.val] : ℝ) * + (halfLaw (below (initialShape h.val))[b.val] side a.1 : ℝ) * + (halfLaw (AllFieldParameters.complement (initialShape h.val) + (below (initialShape h.val))[b.val]) side a.2 : ℝ)) = _ + exact Fin.sum_univ_fun_getElem _ (fun u : Shape => + (stageALaw (initialShape h.val) u : ℝ) * (halfLaw u side a.1 : ℝ) * + (halfLaw (AllFieldParameters.complement (initialShape h.val) u) side a.2 : ℝ)) + | stageB h => + change (∑ b : Fin (below (aShape h.val)).length, + (stageBLaw (aShape h.val) (below (aShape h.val))[b.val] : ℝ) * + (littleLaw (aShape h.val) (below (aShape h.val))[b.val] side a.1 : ℝ) * + (littleLaw (aShape h.val) (AllFieldParameters.complement (aShape h.val) + (below (aShape h.val))[b.val]) side a.2 : ℝ)) = _ + exact Fin.sum_univ_fun_getElem _ (fun u : Shape => + (stageBLaw (aShape h.val) u : ℝ) * + (littleLaw (aShape h.val) u side a.1 : ℝ) * + (littleLaw (aShape h.val) (AllFieldParameters.complement (aShape h.val) u) side a.2 : ℝ)) + | stageC h => + simpa only [Work.childLaw, Rat.cast_one, mul_one, nativePairLaw] using + (branchLaw (Work.stageC h)).total + +def placedPairMixture {K : ℕ} (w : PlacedWork K) (side : Fin 3) + (a : w.1.Statistic × w.1.Statistic) : ℝ := + ∑ u, (placedLaw w).mass u * childLaw w u side a.1 * rightChildLaw w u side a.2 + +theorem placedPairMixture_eq_native {K : ℕ} (w : PlacedWork K) (side : Fin 3) + (a : w.1.Statistic × w.1.Statistic) : + placedPairMixture w side a = (nativePairLaw w.1 (w.2.symm side)).mass a := by + simp only [placedPairMixture, mul_assoc] + rw [placedLaw_sum_mul] + simpa only [childLaw_branchShape, rightChildLaw_branchShape, mul_assoc] using + branchPairMixture_eq_native w.1 (w.2.symm side) a + +theorem placement_symm_order_side {K tick : ℕ} {sigma : Placement} + (h : ActiveOrder K tick sigma) (side : Fin 3) : + h.val.val.2.symm (sigma side) = h.val.val.1.priority side := by + have hs : h.val.val.2 (h.val.val.1.priority side) = sigma side := + Equiv.congr_fun h.property side + rw [← hs, Equiv.symm_apply_apply] + +def orderPairMixture {K tick : ℕ} {sigma : Placement} + (h : ActiveOrder K tick sigma) (side : Fin 3) + (a : Statistic h.val × Statistic h.val) : ℝ := + ∑ u, (orderLaw h).mass u * leftLaw h.val u (sigma side) a.1 * + rightLaw h.val u (sigma side) a.2 + +theorem orderPairMixture_eq_native {K tick : ℕ} {sigma : Placement} + (h : ActiveOrder K tick sigma) (side : Fin 3) + (a : Statistic h.val × Statistic h.val) : + orderPairMixture h side a = + (nativePairLaw h.val.val.1 (h.val.val.1.priority side)).mass a := by + change placedPairMixture h.val.val (sigma side) a = _ + rw [placedPairMixture_eq_native, placement_symm_order_side] + +theorem orderPairMixture_supported {K tick : ℕ} {sigma : Placement} + (allocation : Allocation) (h : ActiveOrder K tick sigma) (side : Fin 3) + (a : Statistic h.val × Statistic h.val) : + (∑ u, (orderLaw h).mass u * + supportedHalfLaw allocation false h.val u (sigma side) a.1 * + supportedHalfLaw allocation true h.val u (sigma side) a.2) = + (nativePairLaw h.val.val.1 (h.val.val.1.priority side)).mass a := by + rw [← orderPairMixture_eq_native] + unfold orderPairMixture + apply Finset.sum_congr rfl + intro u _ + by_cases hu : 0 < activeCounts allocation 1 h.val u + · simp [supportedHalfLaw, hu, halfLawAt] + · have hz : (orderLaw h).mass u = 0 := + placedLaw_mass_zero_of_count_zero allocation h.val.val u (Nat.eq_zero_of_not_pos hu) + simp only [hz, zero_mul] + +theorem orderPairMixture_nonneg {K tick : ℕ} {sigma : Placement} + (h : ActiveOrder K tick sigma) (side : Fin 3) + (a : Statistic h.val × Statistic h.val) : 0 ≤ orderPairMixture h side a := by + rw [orderPairMixture_eq_native] + exact (nativePairLaw h.val.val.1 (h.val.val.1.priority side)).nonneg a + +theorem orderPairMixture_total {K tick : ℕ} {sigma : Placement} + (h : ActiveOrder K tick sigma) (side : Fin 3) : + ∑ a, orderPairMixture h side a = 1 := by + simp_rw [orderPairMixture_eq_native] + exact (nativePairLaw h.val.val.1 (h.val.val.1.priority side)).total + +theorem orderPairMixture_entropy {K tick : ℕ} {sigma : Placement} + (h : ActiveOrder K tick sigma) (side : Fin 3) : + finiteEntropy (orderPairMixture h side) = + finiteEntropy (nativePairLaw h.val.val.1 (h.val.val.1.priority side)).mass := by + have hm : orderPairMixture h side = + (nativePairLaw h.val.val.1 (h.val.val.1.priority side)).mass := + funext (orderPairMixture_eq_native h side) + rw [hm] + +def nativeStatisticWeightCode {K : ℕ} (w : Work K) : w.Statistic → Fin 17 := + match w with + | .stageA _ => halfWeightCode + | .stageB _ => statisticWeightCode + | .stageC _ => fun _ => 0 + +def nativeSplitWeightCode {K : ℕ} (w : Work K) (side : Fin 3) + (b : w.Branch) : Fin 17 := + ⟨w.splitShape b side, Nat.lt_succ_of_le ((w.splitShape_spec b).1 side)⟩ + +@[simp] theorem nativeSplitWeightCode_val {K : ℕ} (w : Work K) (side : Fin 3) + (b : w.Branch) : (nativeSplitWeightCode w side b).val = w.splitShape b side := rfl + +theorem nativePairLaw_weight_marginal {K : ℕ} (w : Work K) (side : Fin 3) + (hstage : w.stage ≠ 2) : + (nativePairLaw w side).map (fun a => nativeStatisticWeightCode w a.1) = + (branchLaw w).map (nativeSplitWeightCode w side) := by + cases w with + | stageA h => + change (stageAPairLaw (initialShape h.val) h.property side).map + (fun a => halfWeightCode a.1) = + (stageASplitLaw (initialShape h.val) h.property).map + (stageASplitWeight (initialShape h.val) h.property side) + rw [stageAPairLaw_leftWeight_marginal, stageASplitLaw_ownWeight_marginal] + | stageB h => + change (stageBPairLaw (aShape h.val) h.property side).map + (fun a => statisticWeightCode a.1) = + (stageBSplitLaw (aShape h.val) h.property).map + (stageBSplitWeight (aShape h.val) h.property side) + rw [stageBPairLaw_leftWeight_marginal, stageBSplitLaw_ownWeight_marginal] + | stageC h => exact False.elim (hstage rfl) + +private theorem commonWeight_law_ext {A : Type*} [Fintype A] + (p q : FiniteLaw A) (hmass : ∀ a, p.mass a = q.mass a) : p = q := by + cases p with + | mk p hp htotal => + cases q with + | mk q hq hqtotal => + have heq : p = q := funext hmass + subst q + rfl + +theorem order_branch_weight {K tick : ℕ} {sigma : Placement} + (h : ActiveOrder K tick sigma) (side : Fin 3) (b : h.val.val.1.Branch) : + JointPopulation.shapeSide (sigma side) (branchShape h.val.val b) = + nativeSplitWeightCode h.val.val.1 (h.val.val.1.priority side) b := by + apply Fin.ext + rw [branchShape, encodePhysicalShape_side, nativeSplitWeightCode_val, + placement_symm_order_side] + +theorem orderLaw_weight_marginal {K tick : ℕ} {sigma : Placement} + (h : ActiveOrder K tick sigma) (side : Fin 3) : + (orderLaw h).map (JointPopulation.shapeSide (sigma side)) = + (branchLaw h.val.val.1).map + (nativeSplitWeightCode h.val.val.1 (h.val.val.1.priority side)) := by + apply commonWeight_law_ext + intro k + have hm : ((orderLaw h).map (JointPopulation.shapeSide (sigma side))).mass k = + JointPopulationRates.sideMass (placedLaw h.val.val).mass (sigma side) k := by + rw [FiniteLaw.map_mass] + unfold JointPopulationRates.sideMass + apply Finset.sum_congr rfl + intro u _ + by_cases hu : JointPopulation.shapeSide (sigma side) u = k <;> simp [hu, orderLaw] + rw [hm, placedLaw_sideMass, FiniteLaw.map_mass] + apply Finset.sum_congr rfl + intro b _ + simp only [order_branch_weight, branchLaw_mass] + +theorem orderPairLaw_common_weight {K tick : ℕ} {sigma : Placement} + (h : ActiveOrder K tick sigma) (side : Fin 3) (hstage : h.val.val.1.stage ≠ 2) : + (nativePairLaw h.val.val.1 (h.val.val.1.priority side)).map + (fun a => nativeStatisticWeightCode h.val.val.1 a.1) = + (orderLaw h).map (JointPopulation.shapeSide (sigma side)) := by + rw [nativePairLaw_weight_marginal _ _ hstage, orderLaw_weight_marginal] + +theorem order_entropy_sub_pair_eq_conditional_sum + {K tick : ℕ} {sigma : Placement} (h : ActiveOrder K tick sigma) + (side : Fin 3) (hstage : h.val.val.1.stage ≠ 2) : + finiteEntropy (orderLaw h).mass - + finiteEntropy (nativePairLaw h.val.val.1 (h.val.val.1.priority side)).mass = + ∑ k, ((orderLaw h).map (JointPopulation.shapeSide (sigma side))).mass k * + (finiteEntropy ((orderLaw h).conditional + (JointPopulation.shapeSide (sigma side)) k).mass - + finiteEntropy ((nativePairLaw h.val.val.1 (h.val.val.1.priority side)).conditional + (fun a => nativeStatisticWeightCode h.val.val.1 a.1) k).mass) := + entropy_sub_eq_conditional_sum _ _ _ _ _ rfl (orderPairLaw_common_weight h side hstage) + +theorem order_entropy_sub_mixture_eq_conditional_sum + {K tick : ℕ} {sigma : Placement} (h : ActiveOrder K tick sigma) + (side : Fin 3) (hstage : h.val.val.1.stage ≠ 2) : + finiteEntropy (orderLaw h).mass - finiteEntropy (orderPairMixture h side) = + ∑ k, ((orderLaw h).map (JointPopulation.shapeSide (sigma side))).mass k * + (finiteEntropy ((orderLaw h).conditional + (JointPopulation.shapeSide (sigma side)) k).mass - + finiteEntropy ((nativePairLaw h.val.val.1 (h.val.val.1.priority side)).conditional + (fun a => nativeStatisticWeightCode h.val.val.1 a.1) k).mass) := by + rw [orderPairMixture_entropy] + exact order_entropy_sub_pair_eq_conditional_sum h side hstage + +end MatrixMultiplication.AllFieldGroupNativeLaws + + + + + + +namespace MatrixMultiplication.JointConditionalCountEntropy + +open MatrixMultiplication.Foundation JointPopulationRates +open scoped BigOperators + +variable {U A : Type*} [Fintype U] [Fintype A] + +attribute [local instance] Classical.propDecidable + +def classCounts (n : U → ℕ) (f : U → A) (a : A) (u : U) : ℕ := + if f u = a then n u else 0 + +def classSize (n : U → ℕ) (f : U → A) (a : A) : ℕ := + ∑ u, classCounts n f a u + +theorem classSize_total (n : U → ℕ) (f : U → A) : + (∑ a, classSize n f a) = ∑ u, n u := by + classical + unfold classSize classCounts + rw [Finset.sum_comm] + simp + +theorem sum_masked_entropy (p : U → ℝ) (f : U → A) : + (∑ a, finiteEntropy (fun u => if f u = a then p u else 0)) = + finiteEntropy p := by + classical + have ht (a : A) (u : U) : + entropyTerm (if f u = a then p u else 0) = + if f u = a then entropyTerm (p u) else 0 := by + by_cases h : f u = a <;> simp [h] + simp only [finiteEntropy, ht] + rw [Finset.sum_comm] + simp + +theorem sum_classCounts_entropy (n : U → ℕ) (f : U → A) (scale : ℝ) : + (∑ a, finiteEntropy (fun u => (classCounts n f a u : ℝ) / scale)) = + finiteEntropy (fun u => (n u : ℝ) / scale) := by + classical + have hm (a : A) : + (fun u => (classCounts n f a u : ℝ) / scale) = + (fun u => if f u = a then (n u : ℝ) / scale else 0) := by + funext u + by_cases h : f u = a <;> simp [classCounts, h] + simp_rw [hm] + exact sum_masked_entropy _ f + +theorem sum_scaled_class_empirical_entropy (n : U → ℕ) (f : U → A) + (scale : ℝ) : + (∑ a, ((classSize n f a : ℝ) / scale) * + finiteEntropy (fun u => + (classCounts n f a u : ℝ) / (classSize n f a : ℝ))) = + finiteEntropy (fun u => (n u : ℝ) / scale) - + finiteEntropy (fun a => (classSize n f a : ℝ) / scale) := by + calc + _ = ∑ a, (finiteEntropy (fun u => (classCounts n f a u : ℝ) / scale) - + entropyTerm ((classSize n f a : ℝ) / scale)) := by + apply Finset.sum_congr rfl + intro a _ + exact weighted_empirical_entropy_eq (classCounts n f a) scale + _ = _ := by + rw [Finset.sum_sub_distrib, sum_classCounts_entropy] + rfl + +theorem sum_classSize_mul_empirical_entropy (n : U → ℕ) (f : U → A) : + (∑ a, (classSize n f a : ℝ) * + finiteEntropy (fun u => + (classCounts n f a u : ℝ) / (classSize n f a : ℝ))) = + (∑ u, n u : ℕ) * + (finiteEntropy (fun u => (n u : ℝ) / (∑ v, n v : ℕ)) - + finiteEntropy (fun a => (classSize n f a : ℝ) / (∑ v, n v : ℕ))) := by + have hclasses := sum_scaled_class_empirical_entropy n f 1 + have hjoint := weighted_empirical_entropy_eq n 1 + have hmarginal := weighted_empirical_entropy_eq (classSize n f) 1 + simp only [div_one] at hclasses hjoint hmarginal + rw [classSize_total] at hmarginal + rw [hclasses, mul_sub, hjoint, hmarginal] + ring + +theorem sum_classSize_mul_entropy_of_law (n : U → ℕ) (f : U → A) + (p : FiniteLaw U) (scale : ℝ) + (hn : ∀ u, (n u : ℝ) = scale * p.mass u) : + (∑ a, (classSize n f a : ℝ) * + finiteEntropy (fun u => + (classCounts n f a u : ℝ) / (classSize n f a : ℝ))) = + scale * (finiteEntropy p.mass - finiteEntropy (p.map f).mass) := by + classical + have hclass (a : A) : (classSize n f a : ℝ) = scale * (p.map f).mass a := by + rw [classSize, Nat.cast_sum, FiniteLaw.map_mass, Finset.mul_sum] + apply Finset.sum_congr rfl + intro u _ + by_cases h : f u = a <;> simp [classCounts, h, hn] + have h := sum_scaled_class_empirical_entropy n f 1 + simp only [div_one] at h + rw [h] + simp_rw [hn, hclass] + rw [finiteEntropy_scalar p.mass scale p.total, + finiteEntropy_scalar (p.map f).mass scale (p.map f).total] + ring + +end MatrixMultiplication.JointConditionalCountEntropy + + + + + + +namespace MatrixMultiplication.AllFieldGroupBranchLaws + +open MatrixMultiplication.Foundation AllFieldParameters AllFieldHistory +open AllFieldHistoryChildLaws AllFieldGroupOrbitData AllFieldActiveLaws +open AllFieldGroupNativeLaws +attribute [local instance] Classical.propDecidable Classical.decEq + +theorem jointCounts_branch_pos {K dilation : ℕ} (allocation : Allocation) + (hd : 0 < dilation) (w : PlacedWork K) (b : w.1.Branch) + (hb : 0 < (branchLaw w.1).mass b) : + 0 < jointCounts allocation dilation w (branchShape w b) := by + have hp : 0 < (population allocation dilation (w.1.source, w.2) : ℝ) := by + exact_mod_cast work_source_population_pos allocation hd w + have hc : 0 < (jointCounts allocation dilation w (branchShape w b) : ℝ) := by + rw [jointCounts_cast, placedLaw_mass_branch] + exact mul_pos hp hb + exact_mod_cast hc + +theorem branchLaw_stageA_mass_pos {K : ℕ} (h : InitialPositive K) + (b : (Work.stageA h).Branch) : + 0 < (branchLaw (Work.stageA h)).mass b := by + change 0 < (stageALaw (initialShape h.val) (aSplit ⟨h, b, false⟩) : ℝ) + exact_mod_cast stageALaw_positive _ _ (aSplit_mem ⟨h, b, false⟩) + +theorem branchLaw_stageB_mass_pos {K : ℕ} (h : APositive K) + (b : (Work.stageB h).Branch) : + 0 < (branchLaw (Work.stageB h)).mass b := by + change 0 < (stageBLaw (aShape h.val) (bSplit ⟨h, b, false⟩) : ℝ) + exact_mod_cast stageBLaw_positive _ _ (bSplit_mem ⟨h, b, false⟩) + +theorem supportedHalfLaw_branchShape_of_mass_pos {K tick : ℕ} {sigma : Placement} + (allocation : Allocation) (right : Bool) (h : ActiveOrder K tick sigma) + (b : h.val.val.1.Branch) (hb : 0 < (branchLaw h.val.val.1).mass b) + (side : Fin 3) : + supportedHalfLaw allocation right h.val (branchShape h.val.val b) (sigma side) = + fun a => (h.val.val.1.childLaw + (halfShape h.val.val.1.parentShape (h.val.val.1.splitShape b) right) + (h.val.val.1.priority side) a : ℝ) := by + have hc : 0 < activeCounts allocation 1 h.val (branchShape h.val.val b) := + jointCounts_branch_pos allocation (by decide) h.val.val b hb + rw [supportedHalfLaw_eq_of_counts_pos allocation 1 right h.val _ hc] + funext a + rw [halfLawAt_eq, canonicalChildShape_branchShape, placement_symm_order_side] + +theorem supportedHalfLaw_branchShape_of_mass_ne_zero {K tick : ℕ} + {sigma : Placement} (allocation : Allocation) (right : Bool) + (h : ActiveOrder K tick sigma) (b : h.val.val.1.Branch) + (hb : (branchLaw h.val.val.1).mass b ≠ 0) (side : Fin 3) : + supportedHalfLaw allocation right h.val (branchShape h.val.val b) (sigma side) = + fun a => (h.val.val.1.childLaw + (halfShape h.val.val.1.parentShape (h.val.val.1.splitShape b) right) + (h.val.val.1.priority side) a : ℝ) := by + exact supportedHalfLaw_branchShape_of_mass_pos allocation right h b + (lt_of_le_of_ne ((branchLaw h.val.val.1).nonneg b) (Ne.symm hb)) side + +theorem weighted_supportedHalfLaw_branchShape {K tick : ℕ} {sigma : Placement} + (allocation : Allocation) (right : Bool) (h : ActiveOrder K tick sigma) + (b : h.val.val.1.Branch) (side : Fin 3) (a : Statistic h.val) : + (branchLaw h.val.val.1).mass b * + supportedHalfLaw allocation right h.val (branchShape h.val.val b) (sigma side) a = + (branchLaw h.val.val.1).mass b * + (h.val.val.1.childLaw + (halfShape h.val.val.1.parentShape (h.val.val.1.splitShape b) right) + (h.val.val.1.priority side) a : ℝ) := by + by_cases hb : (branchLaw h.val.val.1).mass b = 0 + · simp only [hb, zero_mul] + · rw [supportedHalfLaw_branchShape_of_mass_ne_zero allocation right h b hb side] + +end MatrixMultiplication.AllFieldGroupBranchLaws + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/Entropy/GroupCountRate.lean b/lean/OAI/LinearAlgebra/MatrixFields/Entropy/GroupCountRate.lean new file mode 100644 index 0000000000000000000000000000000000000000..aa3c8ce7e9d4d1de077676fea159404141485e57 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/Entropy/GroupCountRate.lean @@ -0,0 +1,328 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Construction.GroupAmbientDegree +import OAI.LinearAlgebra.MatrixFields.Construction.JointCompatibilityCountProducer + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section + +namespace MatrixMultiplication.AllFieldGroupDegreeLaws + +open AllFieldHistory AllFieldHistorySupport AllFieldHistoryChildLaws +open AllFieldGroupOrbitData AllFieldGroupDegrees AllFieldGroupNativeLaws +open JointPopulation JointCanonicalization MatrixMultiplication.Foundation Filter +open scoped BigOperators Topology +attribute [local instance] Classical.propDecidable Classical.decEq + +variable {K tick : ℕ} + +def nativeLaw (allocation : Allocation) (right : Bool) (side : Fin 3) + (sigma : Placement) (c : Class (K := K) (tick := tick) sigma) + (u : JointPopulation.Shape) : Symbol (K := K) (tick := tick) sigma c → ℝ := + supportedHalfLaw allocation right c.1.val u (sigma side) + +theorem nativeLaw_bounds (allocation : Allocation) (right : Bool) (side : Fin 3) + (sigma : Placement) (c : Class (K := K) (tick := tick) sigma) + (u : JointPopulation.Shape) (a : Symbol (K := K) (tick := tick) sigma c) : + 0 ≤ nativeLaw allocation right side sigma c u a ∧ + nativeLaw allocation right side sigma c u a ≤ 1 := + supportedHalfLaw_bounds allocation right c.1.val u (sigma side) a + +theorem weighted_classLaw_eq_native (allocation : Allocation) (m : ℕ) + (right : Bool) (side : Fin 3) (sigma : Placement) + (h : ActiveOrder K tick sigma) (u : JointPopulation.Shape) + (hd : designated right side sigma h u) (a : Statistic h.val) : + (Counts (K := K) (tick := tick) allocation m sigma h u : ℝ) * compatibilityLaw right side sigma h u a = + (Counts (K := K) (tick := tick) allocation m sigma h u : ℝ) * + supportedHalfLaw allocation right h.val u (sigma side) a := by + by_cases hp : 0 < Counts (K := K) (tick := tick) allocation m sigma h u + · rw [compatibilityLaw_eq allocation m sigma right side h u hp hd, + supportedHalfLaw_eq_of_counts_pos allocation m right h.val u hp (sigma side)] + rfl + · have hz : Counts (K := K) (tick := tick) allocation m sigma h u = 0 := Nat.eq_zero_of_not_pos hp + simp only [hz, Nat.cast_zero, zero_mul] + +theorem compatible_iff_native (allocation : Allocation) (m : ℕ) (χ : ℝ) + (sigma : Placement) (side : Fin 3) + (e : Targets (K := K) (tick := tick) allocation m sigma) + (w : Raw (K := K) (tick := tick) allocation m sigma) : + JointPopulationCompatibility.Compatible (Counts (K := K) (tick := tick) allocation m sigma) + (Letter (K := K) (tick := tick) sigma) (Letter (K := K) (tick := tick) sigma) (Symbol (K := K) (tick := tick) sigma) (Symbol (K := K) (tick := tick) sigma) + (projectedStatistic sigma) (projectedStatistic sigma) + (classDesignated false side sigma) (classDesignated true side sigma) + (classLaw false side sigma) (classLaw true side sigma) χ (sigma side) e w ↔ + JointPopulationCompatibility.Compatible (Counts (K := K) (tick := tick) allocation m sigma) + (Letter (K := K) (tick := tick) sigma) (Letter (K := K) (tick := tick) sigma) (Symbol (K := K) (tick := tick) sigma) (Symbol (K := K) (tick := tick) sigma) + (projectedStatistic sigma) (projectedStatistic sigma) + (classDesignated false side sigma) (classDesignated true side sigma) + (nativeLaw allocation false side sigma) (nativeLaw allocation true side sigma) + χ (sigma side) e w := by + constructor <;> rintro ⟨hL, hR⟩ <;> constructor + · intro h u hd a + have hh := hL h u hd a + change |_ - (Counts (K := K) (tick := tick) allocation m sigma h u : ℝ) * + supportedHalfLaw allocation false h.val u (sigma side) a| ≤ _ + rw [← weighted_classLaw_eq_native allocation m false side sigma h u hd a] + exact hh + · intro h u hd a + have hh := hR h u hd a + change |_ - (Counts (K := K) (tick := tick) allocation m sigma h u : ℝ) * + supportedHalfLaw allocation true h.val u (sigma side) a| ≤ _ + rw [← weighted_classLaw_eq_native allocation m true side sigma h u hd a] + exact hh + · intro h u hd a + have hh := hL h u hd a + change |_ - (Counts (K := K) (tick := tick) allocation m sigma h u : ℝ) * + compatibilityLaw false side sigma h u a| ≤ _ + rw [weighted_classLaw_eq_native allocation m false side sigma h u hd a] + exact hh + · intro h u hd a + have hh := hR h u hd a + change |_ - (Counts (K := K) (tick := tick) allocation m sigma h u : ℝ) * + compatibilityLaw true side sigma h u a| ≤ _ + rw [weighted_classLaw_eq_native allocation m true side sigma h u hd a] + exact hh + +def nativeCount (allocation : Allocation) (m : ℕ) (χ : ℝ) + (sigma : Placement) (side : Fin 3) (w : Raw (K := K) (tick := tick) allocation m sigma) : ℕ := + JointPopulationCompatibility.compatibleTargetCount (Counts (K := K) (tick := tick) allocation m sigma) + (Letter (K := K) (tick := tick) sigma) (Letter (K := K) (tick := tick) sigma) (Symbol (K := K) (tick := tick) sigma) (Symbol (K := K) (tick := tick) sigma) + (projectedStatistic sigma) (projectedStatistic sigma) + (classDesignated false side sigma) (classDesignated true side sigma) + (nativeLaw allocation false side sigma) (nativeLaw allocation true side sigma) χ + (sigma side) (ownWord allocation m sigma w) w + +theorem conditionalCount_eq_native (allocation : Allocation) (m : ℕ) (χ : ℝ) + (sigma : Placement) (side : Fin 3) (w : Raw (K := K) (tick := tick) allocation m sigma) : + conditionalCount allocation m χ sigma side w = nativeCount allocation m χ sigma side w := by + unfold conditionalCount nativeCount JointPopulationCompatibility.compatibleTargetCount + exact Fintype.card_congr (Equiv.subtypeEquivRight + (fun e : JointPopulationCompatibility.FixedSideTargets + (Counts (K := K) (tick := tick) allocation m sigma) (sigma side) + (ownWord allocation m sigma w) => + compatible_iff_native allocation m χ sigma side e.val w)) + +theorem competitors_card_le_nativeCount (allocation : Allocation) (m : ℕ) + {ε χ : ℝ} (hε : 0 ≤ ε) (hχ : ε ≤ χ) (sigma : Placement) + (e : Targets (K := K) (tick := tick) allocation m sigma) + (o : Orbit (K := K) (tick := tick) allocation m sigma) (v : Variable (K := K) (tick := tick) allocation m sigma) : + (competitors allocation m ε sigma e o v).card ≤ nativeCount allocation m χ sigma v.1 v.2 := by + rw [← conditionalCount_eq_native] + exact competitors_card_le_conditionalCount allocation m hε hχ sigma e o v + +theorem competitors_subset_eligibility_of_first (allocation : Allocation) (m : ℕ) + (width : ℝ) (sigma : Placement) + (e : Targets (K := K) (tick := tick) allocation m sigma) + (o : Orbit (K := K) (tick := tick) allocation m sigma) (v : Variable (K := K) (tick := tick) allocation m sigma) (hv : v.1 = 0) : + competitors allocation m width sigma e o v ⊆ + (data allocation m width sigma).eligibilityCompetitors e := by + intro t ht + apply ((data allocation m width sigma).mem_eligibilityCompetitors e t).2 + refine ⟨competitor_mem allocation m width sigma e o v t ht, + (Finset.mem_filter.mp ht).2.1, ?_⟩ + have hh := (Finset.mem_filter.mp ht).2.2.1 + simp only [hv, tripleSide, Matrix.cons_val_zero] at hh + exact hh + +theorem eventually_eligibility_card_le (allocation : Allocation) (sigma : Placement) + (width : ℝ) {δ : ℝ} (hδ : 0 < δ) : + ∀ᶠ m : ℕ in atTop, ∀ e : Targets (K := K) (tick := tick) allocation m sigma, + (((data allocation m width sigma).eligibilityCompetitors e).card : ℝ) ≤ + Real.exp ((m : ℝ) * + (AllFieldActiveCapacity.orderNativeDegree (K := K) (tick := tick) allocation sigma 0 + δ)) := by + filter_upwards [AllFieldGroupAmbientDegree.eventually_sharedAmbient_first_card_le + (K := K) (tick := tick) allocation sigma hδ] with m hm + intro e + exact (Nat.cast_le.mpr (eligibility_card_le_sharedAmbient allocation m width sigma e)).trans (hm e) + +theorem eventually_first_competitors_card_le (allocation : Allocation) (sigma : Placement) + (width : ℝ) {δ : ℝ} (hδ : 0 < δ) : + ∀ᶠ m : ℕ in atTop, ∀ (e : Targets (K := K) (tick := tick) allocation m sigma) + (o : Orbit (K := K) (tick := tick) allocation m sigma) (v : Variable (K := K) (tick := tick) allocation m sigma), v.1 = 0 → + ((competitors allocation m width sigma e o v).card : ℝ) ≤ + Real.exp ((m : ℝ) * + (AllFieldActiveCapacity.orderNativeDegree (K := K) (tick := tick) allocation sigma 0 + δ)) := by + filter_upwards [eventually_eligibility_card_le (K := K) (tick := tick) + allocation sigma width hδ] with m hm + intro e o v hv + exact (Nat.cast_le.mpr (Finset.card_le_card + (competitors_subset_eligibility_of_first allocation m width sigma e o v hv))).trans (hm e) + +end MatrixMultiplication.AllFieldGroupDegreeLaws + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section + +namespace MatrixMultiplication.AllFieldGroupCountRate + +open AllFieldHistory AllFieldHistorySupport AllFieldHistoryChildLaws +open AllFieldGroupOrbitData AllFieldGroupDegrees AllFieldGroupDegreeLaws +open AllFieldGroupNativeLaws AllFieldGroupPairWindows +open JointCompatibilityControls JointCompatibilityScaling JointCompatibilityRateLimit +open JointPopulationCompatibility JointTypeCounts MatrixMultiplication.Foundation Filter +open scoped BigOperators Topology +attribute [local instance] Classical.propDecidable Classical.decEq + +variable {K tick : ℕ} + +def nativeCompatibilityRate (allocation : Allocation) (sigma : Placement) (side : Fin 3) : ℝ := + compatibilityRate (base (K := K) (tick := tick) allocation sigma side) + (q allocation sigma side) + (classDesignated false side sigma) (classDesignated true side sigma) + (groupCap (base allocation sigma side) (classDesignated false side sigma) + (nativeLaw allocation false side sigma) 0) + (groupCap (base allocation sigma side) (classDesignated true side sigma) + (nativeLaw allocation true side sigma) 0) + +theorem base_positive_counts (allocation : Allocation) (sigma : Placement) (side : Fin 3) + (c : Class (K := K) (tick := tick) sigma) (u : JointPopulation.Shape) + (hu : 0 < base allocation sigma side c u) : + 0 < Counts (K := K) (tick := tick) allocation 1 sigma c.1 u := by + unfold base classCounts at hu + split_ifs at hu with hs + · exact hu + · exact (Nat.lt_irrefl 0 hu).elim + +theorem nativeLaw_normalized (allocation : Allocation) (right : Bool) + (sigma : Placement) (side : Fin 3) + (c : Class (K := K) (tick := tick) sigma) (u : JointPopulation.Shape) + (hu : 0 < base allocation sigma side c u) : + ∑ a, nativeLaw allocation right side sigma c u a = 1 := by + have hp := base_positive_counts allocation sigma side c u hu + simp only [nativeLaw, + supportedHalfLaw_eq_of_counts_pos allocation 1 right c.1.val u hp (sigma side)] + exact halfLawAt_normalized allocation 1 right c.1.val u hp (sigma side) + +theorem classCounts_dilation (allocation : Allocation) (m : ℕ) + (sigma : Placement) (side : Fin 3) : + classCounts (Counts (K := K) (tick := tick) allocation m sigma) (sigma side) = + fun c u => m * base allocation sigma side c u := by + funext c u + change (if JointPopulation.shapeSide (sigma side) u = c.2 then + activeCounts allocation m c.1.val u else 0) = + m * (if JointPopulation.shapeSide (sigma side) u = c.2 then + activeCounts allocation 1 c.1.val u else 0) + rw [activeCounts_dilation] + split_ifs <;> simp + +theorem exists_widths_eventually_nativeCount_le (allocation : Allocation) (sigma : Placement) + (side : Fin 3) {δ χMax ηMax : ℝ} + (hδ : 0 < δ) (hχMax : 0 < χMax) (hηMax : 0 < ηMax) : + ∃ χ η : ℝ, 0 < χ ∧ χ ≤ χMax ∧ 0 < η ∧ η ≤ ηMax ∧ + ∀ᶠ m : ℕ in atTop, + ∀ (e : Targets (K := K) (tick := tick) allocation m sigma) + (w : Raw (K := K) (tick := tick) allocation m sigma), + (∀ h j, JointPopulation.shapeSide (sigma side) ((e h).val j) = + ownWord allocation m sigma w ⟨h, j⟩) → + PairWindow (base allocation sigma side) (q allocation sigma side) + (Positions (K := K) (tick := tick) allocation m sigma w) (pairCounts allocation m sigma w) η → + (nativeCount allocation m χ sigma side w : ℝ) ≤ + Real.exp ((m : ℝ) * + (nativeCompatibilityRate (K := K) (tick := tick) allocation sigma side + δ)) := by + have hparts : ∀ c : Class (K := K) (tick := tick) sigma, + Function.Injective (fun a : Symbol (K := K) (tick := tick) sigma c × Symbol (K := K) (tick := tick) sigma c => (a.1, a.2)) := + fun _ => fun _ _ h => h + have hleft : ∀ (c : Class (K := K) (tick := tick) sigma) (a : Symbol (K := K) (tick := tick) sigma c), + (baseSize (base allocation sigma side) c : ℝ) * + (∑ b : {b : Symbol (K := K) (tick := tick) sigma c × Symbol (K := K) (tick := tick) sigma c // b.1 = a}, q allocation sigma side c b.val) = + totalCenterCount (base allocation sigma side) (nativeLaw allocation false side sigma) c a := by + intro c a + exact JointPairMixtureControls.pairMixture_left_balance + (base allocation sigma side) (nativeLaw allocation false side sigma) + (nativeLaw allocation true side sigma) + (nativeLaw_normalized allocation true sigma side) c a + have hright : ∀ (c : Class (K := K) (tick := tick) sigma) (a : Symbol (K := K) (tick := tick) sigma c), + (baseSize (base allocation sigma side) c : ℝ) * + (∑ b : {b : Symbol (K := K) (tick := tick) sigma c × Symbol (K := K) (tick := tick) sigma c // b.2 = a}, q allocation sigma side c b.val) = + totalCenterCount (base allocation sigma side) (nativeLaw allocation true side sigma) c a := by + intro c a + exact JointPairMixtureControls.pairMixture_right_balance + (base allocation sigma side) (nativeLaw allocation false side sigma) + (nativeLaw allocation true side sigma) + (nativeLaw_normalized allocation false sigma side) c a + obtain ⟨χ, η, hχ, hχMax', hη, hηMax', hbound⟩ := + JointCompatibilityCountProducer.exists_widths_eventually_count_le + (base allocation sigma side) (q allocation sigma side) + (fun _ p => p.1) (fun _ p => p.2) + (classDesignated false side sigma) (classDesignated true side sigma) + (nativeLaw allocation false side sigma) (nativeLaw allocation true side sigma) + hparts + (fun c u a => (nativeLaw_bounds allocation false side sigma c u a).1) + (fun c u a => (nativeLaw_bounds allocation false side sigma c u a).2) + (fun c u a => (nativeLaw_bounds allocation true side sigma c u a).1) + (fun c u a => (nativeLaw_bounds allocation true side sigma c u a).2) + hleft hright hδ hχMax hηMax + refine ⟨χ, η, hχ, hχMax', hη, hηMax', ?_⟩ + filter_upwards [hbound] with m hm + intro e w hown hwindow + rw [← classCounts_dilation allocation m sigma side] at hm + let target : FixedSideTargets (Counts (K := K) (tick := tick) allocation m sigma) (sigma side) + (ownWord allocation m sigma w) := ⟨e, hown⟩ + have hb := (hm (Positions (K := K) (tick := tick) allocation m sigma w) (pairCounts allocation m sigma w) + (candidateEquiv (Counts (K := K) (tick := tick) allocation m sigma) (sigma side) + (ownWord allocation m sigma w) target) + (statisticElement (Counts (K := K) (tick := tick) allocation m sigma) (Letter (K := K) (tick := tick) sigma) (Letter (K := K) (tick := tick) sigma) + (Symbol (K := K) (tick := tick) sigma) (Symbol (K := K) (tick := tick) sigma) (projectedStatistic sigma) (projectedStatistic sigma) + (ownWord allocation m sigma w) w) hwindow).1 + rw [nativeCount, compatibleTargetCount_eq_kernel] + exact hb + +theorem exists_threshold_eventually_competitors_le (allocation : Allocation) + (sigma : Placement) (side : Fin 3) {δ widthMax : ℝ} + (hδ : 0 < δ) (hwidthMax : 0 < widthMax) : + ∃ threshold : ℝ, 0 < threshold ∧ threshold ≤ widthMax ∧ + ∀ width : ℝ, 0 < width → width ≤ threshold → + ∀ᶠ m : ℕ in atTop, + ∀ (e : Targets (K := K) (tick := tick) allocation m sigma) + (o : Orbit (K := K) (tick := tick) allocation m sigma), o ∈ (data allocation m width sigma).orbits e → + ∀ w : Raw (K := K) (tick := tick) allocation m sigma, + (side, w) ∈ (data allocation m width sigma).passing e o → + ((competitors allocation m width sigma e o (side, w)).card : ℝ) ≤ + Real.exp ((m : ℝ) * + (nativeCompatibilityRate (K := K) (tick := tick) allocation sigma side + δ)) := by + obtain ⟨χ, η, hχ, hχMax, hη, _, hbound⟩ := + exists_widths_eventually_nativeCount_le (K := K) (tick := tick) + allocation sigma side (ηMax := 1) hδ hwidthMax zero_lt_one + let threshold := min χ (η / windowFactor (K := K) (tick := tick) allocation sigma) + have hf := windowFactor_pos (K := K) (tick := tick) allocation sigma + have ht : 0 < threshold := lt_min hχ (div_pos hη hf) + refine ⟨threshold, ht, (min_le_left _ _).trans hχMax, ?_⟩ + intro width hw hwt + have hwχ : width ≤ χ := hwt.trans (min_le_left _ _) + have hww : windowFactor (K := K) (tick := tick) allocation sigma * width ≤ η := by + have hh := (le_div_iff₀ hf).mp (hwt.trans (min_le_right _ _)) + simpa only [mul_comm] using hh + filter_upwards [hbound, eventually_gt_atTop (0 : ℕ)] with m hm hmpos + intro e o ho w hpass + have ha := AllFieldGroupAdmissible.full_admissible allocation m width sigma + e o ho (side, w) ((data allocation m width sigma).passing_subset e o ho hpass) + have hp := passing_pairWindow allocation hmpos hw.le sigma e o ho (side, w) hpass + have hpair : PairWindow (base allocation sigma side) (q allocation sigma side) + (Positions (K := K) (tick := tick) allocation m sigma w) (pairCounts allocation m sigma w) η := + fun c hc a => (hp c hc a).trans hww + have hc := hm e w (fun h j => (ha.1.1 h j).symm) hpair + exact (Nat.cast_le.mpr (competitors_card_le_nativeCount allocation m hw.le hwχ sigma + e o (side, w))).trans hc + +end MatrixMultiplication.AllFieldGroupCountRate + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/Entropy/GroupPairEntropy.lean b/lean/OAI/LinearAlgebra/MatrixFields/Entropy/GroupPairEntropy.lean new file mode 100644 index 0000000000000000000000000000000000000000..405de56a35467dbf240be3a985f5726be5c52bde --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/Entropy/GroupPairEntropy.lean @@ -0,0 +1,225 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Extraction.GroupPairWindows +import OAI.LinearAlgebra.MatrixFields.Parameters.GroupSelectionParameters + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section + +namespace MatrixMultiplication.AllFieldGroupPairEntropy + +open MatrixMultiplication.Foundation AllFieldParameters AllFieldHistory AllFieldActiveLaws +open AllFieldActiveCapacity AllFieldHistoryChildLaws AllFieldGroupOrbitData +open AllFieldGroupDegrees AllFieldGroupNativeLaws AllFieldGroupPairWindows +open JointCompatibilityScaling JointCompatibilityRateLimit JointPairClassWindows +open scoped BigOperators +attribute [local instance] Classical.propDecidable Classical.decEq + +theorem sum_conditionalCenter_entropy {A B : Type*} [Fintype A] [Fintype B] + [DecidableEq B] (p : FiniteLaw A) (f : A → B) : + (∑ b, (p.map f).mass b * finiteEntropy + (conditionalCenter f b p.mass ((p.map f).mass b))) = + finiteEntropy p.mass - finiteEntropy (p.map f).mass := by + have ht (b : B) : + (p.map f).mass b * finiteEntropy + (conditionalCenter f b p.mass ((p.map f).mass b)) = + (p.map f).mass b * finiteEntropy (p.conditional f b).mass := by + by_cases hz : (p.map f).mass b = 0 + · simp only [hz, zero_mul] + · congr 1 + congr 1 + funext a + simp only [conditionalCenter, FiniteLaw.conditional, dite_eq_right hz] + split_ifs <;> simp + simp_rw [ht] + have he := p.entropy_eq_map_add_conditional f + linarith + +variable {K tick : ℕ} {sigma : Placement} + +theorem baseSize_eq_parentBase_mul_sideMass (allocation : Allocation) + (sigma : Placement) (side : Fin 3) (h : ActiveOrder K tick sigma) (k : Fin 17) : + (baseSize (base allocation sigma side) (h, k) : ℝ) = + (parentBase allocation h : ℝ) * + JointPopulationRates.sideMass (orderLaw h).mass (sigma side) k := by + simp only [baseSize, base, JointPopulationCompatibility.classCounts, + Nat.cast_sum, Nat.cast_ite, Nat.cast_zero, JointPopulationRates.sideMass, + Finset.mul_sum] + apply Finset.sum_congr rfl + intro u _ + by_cases hu : JointPopulation.shapeSide (sigma side) u = k + · simp only [hu, ite_true] + exact jointCounts_cast allocation 1 h.val.val u + · simp only [hu, ite_false, mul_zero] + +theorem classMass_eq_sideMass (allocation : Allocation) (sigma : Placement) + (side : Fin 3) (c : Class (K := K) (tick := tick) sigma) : + classMass allocation sigma side c = + JointPopulationRates.sideMass (orderLaw c.1).mass (sigma side) c.2 := by + rcases c with ⟨h, k⟩ + unfold classMass + rw [baseSize_eq_parentBase_mul_sideMass] + exact mul_div_cancel_left₀ _ (by exact_mod_cast (parentBase_pos allocation h).ne') + +theorem nativePair_weight_marginal {K : ℕ} (w : Work K) (side : Fin 3) + (hs : w.stage ≠ 2) : + ((nativePairLaw w side).map (fun a => weightCode w a.1)).mass = + canonicalSideMass w side := by + cases w with + | stageA h => + rw [canonicalSideMass_stageA] + exact congrArg FiniteLaw.mass + (AllFieldPairMarginals.stageAPairLaw_leftWeight_marginal _ h.property side) + | stageB h => + rw [canonicalSideMass_stageB] + exact congrArg FiniteLaw.mass + (AllFieldPairMarginals.stageBPairLaw_leftWeight_marginal _ h.property side) + | stageC h => exact False.elim (hs rfl) + +theorem orderPair_weight_marginal (h : ActiveOrder K tick sigma) (side : Fin 3) + (hs : h.val.val.1.stage ≠ 2) : + ((nativePairLaw h.val.val.1 (h.val.val.1.priority side)).map + (fun a => weightCode h.val.val.1 a.1)).mass = + JointPopulationRates.sideMass (orderLaw h).mass (sigma side) := by + rw [nativePair_weight_marginal _ _ hs] + have hm := placedLaw_priority_sideMass h.val.val side + rw [h.property] at hm + exact hm.symm + +theorem q_eq_native_conditionalCenter (allocation : Allocation) (sigma : Placement) + (side : Fin 3) (c : Class (K := K) (tick := tick) sigma) + (hs : c.1.val.val.1.stage ≠ 2) : + q allocation sigma side c = conditionalCenter + (fun a => weightCode c.1.val.val.1 a.1) c.2 + (nativePairLaw c.1.val.val.1 (c.1.val.val.1.priority side)).mass + (((nativePairLaw c.1.val.val.1 (c.1.val.val.1.priority side)).map + (fun a => weightCode c.1.val.val.1 a.1)).mass c.2) := by + rw [q_eq_conditionalCenter allocation sigma side c hs, classMass_eq_sideMass, + orderPair_weight_marginal _ _ hs] + have hp : parentPair allocation sigma side c.1 = + (nativePairLaw c.1.val.val.1 (c.1.val.val.1.priority side)).mass := by + funext a + rw [parentPair_eq_native, orderPairMixture_eq_native] + rw [hp] + +theorem history_pair_entropy_of_sharing (allocation : Allocation) (sigma : Placement) + (side : Fin 3) (h : ActiveOrder K tick sigma) (hs : h.val.val.1.stage ≠ 2) : + (∑ k : Fin 17, (baseSize (base allocation sigma side) (h, k) : ℝ) * + finiteEntropy (q allocation sigma side (h, k))) = + (parentBase allocation h : ℝ) * + (finiteEntropy (nativePairLaw h.val.val.1 (h.val.val.1.priority side)).mass - + finiteEntropy (JointPopulationRates.sideMass (orderLaw h).mass (sigma side))) := by + have hq (k : Fin 17) := q_eq_native_conditionalCenter allocation sigma side (h, k) hs + simp_rw [baseSize_eq_parentBase_mul_sideMass, hq, mul_assoc] + rw [← Finset.mul_sum] + simpa only [orderPair_weight_marginal h side hs] using + congrArg (fun x : ℝ => (parentBase allocation h : ℝ) * x) + (sum_conditionalCenter_entropy + (nativePairLaw h.val.val.1 (h.val.val.1.priority side)) + (fun a => weightCode h.val.val.1 a.1)) + +theorem history_pair_entropy_of_ordinary (allocation : Allocation) (sigma : Placement) + (side : Fin 3) (h : ActiveOrder K tick sigma) (hs : h.val.val.1.stage = 2) : + (∑ k : Fin 17, (baseSize (base allocation sigma side) (h, k) : ℝ) * + finiteEntropy (q allocation sigma side (h, k))) = 0 := by + have : Subsingleton (Statistic h.val) := by + change Subsingleton h.val.val.1.Statistic + cases he : h.val.val.1 with + | stageA a => simp [he, Work.stage] at hs + | stageB a => simp [he, Work.stage] at hs + | stageC a => dsimp [Work.Statistic]; infer_instance + apply Finset.sum_eq_zero + intro k _ + by_cases hz : baseSize (base allocation sigma side) (h, k) = 0 + · simp only [hz, Nat.cast_zero, zero_mul] + · have hq : q allocation sigma side (h, k) = fun _ => 1 := by + funext a + exact q_eq_one_of_subsingleton allocation sigma side (h, k) + (Nat.pos_of_ne_zero hz) a + simp only [hq, finiteEntropy, entropyTerm, Real.log_one, mul_zero, + Finset.sum_const_zero] + +theorem pairReferenceEntropy_eq (allocation : Allocation) (sigma : Placement) + (side : Fin 3) : + pairReferenceEntropy (base (K := K) (tick := tick) allocation sigma side) + (q allocation sigma side) = + ∑ h : ActiveOrder K tick sigma, (parentBase allocation h : ℝ) * + (if h.val.val.1.stage ≠ 2 then + finiteEntropy (nativePairLaw h.val.val.1 (h.val.val.1.priority side)).mass - + finiteEntropy (JointPopulationRates.sideMass (orderLaw h).mass (sigma side)) + else 0) := by + unfold pairReferenceEntropy + rw [Fintype.sum_prod_type] + apply Finset.sum_congr rfl + intro h _ + by_cases hs : h.val.val.1.stage ≠ 2 + · rw [ite_eq_left hs] + exact history_pair_entropy_of_sharing allocation sigma side h hs + · rw [ite_eq_right hs, mul_zero] + exact history_pair_entropy_of_ordinary allocation sigma side h (not_not.mp hs) + +theorem baseEntropy_eq (allocation : Allocation) (sigma : Placement) (side : Fin 3) : + baseEntropy (base (K := K) (tick := tick) allocation sigma side) = + ∑ h : ActiveOrder K tick sigma, (parentBase allocation h : ℝ) * + (finiteEntropy (orderLaw h).mass - + finiteEntropy (JointPopulationRates.sideMass (orderLaw h).mass (sigma side))) := by + unfold baseEntropy + rw [Fintype.sum_prod_type] + apply Finset.sum_congr rfl + intro h _ + have hb (k : Fin 17) : base allocation sigma side (h, k) = + JointConditionalCountEntropy.classCounts (Counts allocation 1 sigma h) + (JointPopulation.shapeSide (sigma side)) k := by + funext u + by_cases hu : JointPopulation.shapeSide (sigma side) u = k + · simp only [base, JointPopulationCompatibility.classCounts, + JointConditionalCountEntropy.classCounts, hu, ite_true] + · simp only [base, JointPopulationCompatibility.classCounts, + JointConditionalCountEntropy.classCounts, hu, ite_false] + have hs (k : Fin 17) : baseSize (base allocation sigma side) (h, k) = + JointConditionalCountEntropy.classSize (Counts allocation 1 sigma h) + (JointPopulation.shapeSide (sigma side)) k := by + simp only [baseSize, JointConditionalCountEntropy.classSize, hb k] + have hm : ((orderLaw h).map (JointPopulation.shapeSide (sigma side))).mass = + JointPopulationRates.sideMass (orderLaw h).mass (sigma side) := by + funext k + rw [FiniteLaw.map_mass] + rfl + have he := JointConditionalCountEntropy.sum_classSize_mul_entropy_of_law + (Counts allocation 1 sigma h) (JointPopulation.shapeSide (sigma side)) + (orderLaw h) (parentBase allocation h : ℝ) + (fun u => jointCounts_cast allocation 1 h.val.val u) + rw [hm] at he + simpa only [hs, hb] using he + +def observedEntropy (h : ActiveOrder K tick sigma) (side : Fin 3) : ℝ := + if h.val.val.1.stage ≠ 2 then + finiteEntropy (nativePairLaw h.val.val.1 (h.val.val.1.priority side)).mass + else finiteEntropy (JointPopulationRates.sideMass (orderLaw h).mass (sigma side)) + +theorem baseEntropy_sub_pairReferenceEntropy (allocation : Allocation) + (sigma : Placement) (side : Fin 3) : + baseEntropy (base (K := K) (tick := tick) allocation sigma side) - + pairReferenceEntropy (base (K := K) (tick := tick) allocation sigma side) + (q allocation sigma side) = + ∑ h : ActiveOrder K tick sigma, (parentBase allocation h : ℝ) * + (finiteEntropy (orderLaw h).mass - observedEntropy h side) := by + rw [baseEntropy_eq, pairReferenceEntropy_eq, ← Finset.sum_sub_distrib] + apply Finset.sum_congr rfl + intro h _ + unfold observedEntropy + split_ifs <;> ring + +end MatrixMultiplication.AllFieldGroupPairEntropy + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/Entropy/GroupProjectedEntropy.lean b/lean/OAI/LinearAlgebra/MatrixFields/Entropy/GroupProjectedEntropy.lean new file mode 100644 index 0000000000000000000000000000000000000000..f7f0bd8e25e0df0b75b6373432122b8954a1c9bd --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/Entropy/GroupProjectedEntropy.lean @@ -0,0 +1,1330 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Construction.GroupBranchDesignation +import OAI.LinearAlgebra.MatrixFields.Entropy.GroupCountRate +import OAI.LinearAlgebra.MatrixFields.Entropy.GroupPairEntropy + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section + +namespace MatrixMultiplication.JointNativeGroupedEntropy + +open MatrixMultiplication.Foundation AllFieldParameters AllFieldHistory +open scoped BigOperators +attribute [local instance] Classical.propDecidable Classical.decEq + +section FiniteGroups + +variable {U K A : Type*} [Fintype U] [Fintype K] [Fintype A] + +def groupMeasure (p : U → ℝ) (group : U → K) (q : U → A → ℝ) + (k : K) (a : A) : ℝ := + ∑ u, if group u = k then p u * q u a else 0 + +omit [Fintype K] in +theorem groupMeasure_total (p : U → ℝ) (group : U → K) (q : U → A → ℝ) + (hq : ∀ u, ∑ a, q u a = 1) (k : K) : + ∑ a, groupMeasure p group q k a = + JointCompatibilityIncidence.groupMass p group k := by + unfold groupMeasure JointCompatibilityIncidence.groupMass + rw [Finset.sum_comm] + apply Finset.sum_congr rfl + intro u _ + by_cases hu : group u = k + · simp only [hu, ite_true, ← Finset.mul_sum, hq, mul_one] + · simp [hu] + +omit [Fintype K] [Fintype A] in +theorem groupMeasure_zero_of_mass_zero (p : U → ℝ) (group : U → K) + (q : U → A → ℝ) (hp : ∀ u, 0 ≤ p u) (k : K) + (hm : JointCompatibilityIncidence.groupMass p group k = 0) : + groupMeasure p group q k = fun _ => 0 := by + have ht : ∀ u, (if group u = k then p u else 0) = 0 := by + have hn : ∀ u ∈ (Finset.univ : Finset U), + 0 ≤ (if group u = k then p u else 0) := by + intro u _ + split_ifs + · exact hp u + · exact le_rfl + have hz := (Finset.sum_eq_zero_iff_of_nonneg hn).mp hm + exact fun u => hz u (Finset.mem_univ u) + funext a + apply Finset.sum_eq_zero + intro u _ + by_cases hu : group u = k + · have hpu : p u = 0 := by simpa only [hu, ite_true] using ht u + simp [hu, hpu] + · simp [hu] + +omit [Fintype K] in +theorem group_term_eq_homogeneous (p : U → ℝ) (group : U → K) + (q : U → A → ℝ) (hp : ∀ u, 0 ≤ p u) + (hq : ∀ u, ∑ a, q u a = 1) (k : K) : + JointCompatibilityIncidence.groupMass p group k * + finiteEntropy (JointCompatibilityIncidence.groupLaw p group q k) = + homogeneousEntropy (groupMeasure p group q k) := by + by_cases hm : JointCompatibilityIncidence.groupMass p group k = 0 + · rw [hm, zero_mul, groupMeasure_zero_of_mass_zero p group q hp k hm, + homogeneousEntropy_zero] + · have ht := groupMeasure_total p group q hq k + have hn : ∑ a, groupMeasure p group q k a ≠ 0 := by rwa [ht] + rw [homogeneousEntropy_eq_mass_mul _ hn, ht] + rfl + +theorem groupedEntropy_eq_sum_homogeneous (p : U → ℝ) (group : U → K) + (q : U → A → ℝ) (hp : ∀ u, 0 ≤ p u) + (hq : ∀ u, ∑ a, q u a = 1) : + JointCompatibilityIncidence.groupedEntropy p group q = + ∑ k, homogeneousEntropy (groupMeasure p group q k) := by + unfold JointCompatibilityIncidence.groupedEntropy + exact Finset.sum_congr rfl fun k _ => group_term_eq_homogeneous p group q hp hq k + +theorem homogeneousEntropy_mul_normalized (s : ℝ) (q : A → ℝ) + (hq : ∑ a, q a = 1) : + homogeneousEntropy (fun a => s * q a) = s * homogeneousEntropy q := by + have he : finiteEntropy (fun a => s * q a) = + entropyTerm s + s * finiteEntropy q := by + simp only [finiteEntropy, entropyTerm_mul, Finset.sum_add_distrib, + ← Finset.sum_mul, ← Finset.mul_sum, hq, one_mul] + rw [homogeneousEntropy, ← Finset.mul_sum, hq, mul_one, he, + homogeneousEntropy_normalized q hq] + unfold entropyTerm + ring + +def singletonResidualGroup (d : U → Prop) (weight : U → K) (u : U) : U ⊕ K := + if d u then Sum.inl u else Sum.inr (weight u) + +omit [Fintype U] [Fintype K] in +theorem singletonResidualGroup_eq_inl (d : U → Prop) (weight : U → K) + (u v : U) : + singletonResidualGroup d weight v = Sum.inl u ↔ d u ∧ v = u := by + constructor + · intro h + by_cases hv : d v + · have he : v = u := by simpa [singletonResidualGroup, hv] using h + exact ⟨he ▸ hv, he⟩ + · simp [singletonResidualGroup, hv] at h + · rintro ⟨hu, rfl⟩ + simp [singletonResidualGroup, hu] + +omit [Fintype U] [Fintype K] in +theorem singletonResidualGroup_eq_inr (d : U → Prop) (weight : U → K) + (u : U) (k : K) : + singletonResidualGroup d weight u = Sum.inr k ↔ ¬ d u ∧ weight u = k := by + by_cases hu : d u <;> simp [singletonResidualGroup, hu] + +omit [Fintype K] [Fintype A] in +theorem groupMeasure_singleton (p : U → ℝ) (d : U → Prop) + (weight : U → K) (q : U → A → ℝ) (u : U) : + groupMeasure p (singletonResidualGroup d weight) q (Sum.inl u) = + fun a => if d u then p u * q u a else 0 := by + funext a + simp only [groupMeasure, singletonResidualGroup_eq_inl] + by_cases hu : d u <;> simp [hu] + +omit [Fintype K] [Fintype A] in +theorem groupMeasure_residual (p : U → ℝ) (d : U → Prop) + (weight : U → K) (q : U → A → ℝ) (k : K) : + groupMeasure p (singletonResidualGroup d weight) q (Sum.inr k) = + fun a => ∑ u, if ¬ d u ∧ weight u = k then p u * q u a else 0 := by + funext a + simp only [groupMeasure, singletonResidualGroup_eq_inr] + +theorem groupedEntropy_singletons_residuals (p : U → ℝ) (d : U → Prop) + (weight : U → K) (q : U → A → ℝ) (hp : ∀ u, 0 ≤ p u) + (hq : ∀ u, ∑ a, q u a = 1) : + JointCompatibilityIncidence.groupedEntropy p (singletonResidualGroup d weight) q = + (∑ u, if d u then p u * homogeneousEntropy (q u) else 0) + + ∑ k, homogeneousEntropy (fun a => + ∑ u, if ¬ d u ∧ weight u = k then p u * q u a else 0) := by + rw [groupedEntropy_eq_sum_homogeneous p _ q hp hq, Fintype.sum_sum_type] + congr 1 + · apply Finset.sum_congr rfl + intro u _ + rw [groupMeasure_singleton] + by_cases hu : d u + · simp only [hu, ite_true] + exact homogeneousEntropy_mul_normalized (p u) (q u) (hq u) + · simp only [hu, ite_false, homogeneousEntropy_zero] + · apply Finset.sum_congr rfl + intro k _ + rw [groupMeasure_residual] + +end FiniteGroups + +section NativeSupport + +variable {A : Type*} [Fintype A] + +abbrev SupportIndex (support : List Shape) := Fin support.length + +def ownWeight (support : List Shape) (priority : Placement) (position : Fin 3) + (hbound : ∀ i : SupportIndex support, support[i.val] (priority position) < 17) + (i : SupportIndex support) : Fin 17 := + ⟨support[i.val] (priority position), hbound i⟩ + +def nativeGroup (support : List Shape) (priority : Placement) (position : Fin 3) + (hbound : ∀ i : SupportIndex support, support[i.val] (priority position) < 17) : + SupportIndex support → SupportIndex support ⊕ Fin 17 := + singletonResidualGroup + (fun i => AllFieldNativeCapacity.designated priority position support[i.val]) + (ownWeight support priority position hbound) + +theorem groupedEntropy_eq_native (support : List Shape) (p : Shape → ℝ) + (priority : Placement) (position : Fin 3) (q : Shape → A → ℝ) + (hbound : ∀ i : SupportIndex support, support[i.val] (priority position) < 17) + (hp : ∀ i : SupportIndex support, 0 ≤ p support[i.val]) + (hq : ∀ i : SupportIndex support, ∑ a, q support[i.val] a = 1) : + JointCompatibilityIncidence.groupedEntropy + (fun i : SupportIndex support => p support[i.val]) + (nativeGroup support priority position hbound) + (fun i : SupportIndex support => q support[i.val]) = + AllFieldNativeCapacity.groupedEntropy support p priority position q := by + rw [nativeGroup, groupedEntropy_singletons_residuals _ _ _ _ hp hq] + unfold AllFieldNativeCapacity.groupedEntropy AllFieldNativeCapacity.singletonEntropy + congr 1 + · exact Fin.sum_univ_fun_getElem support fun u => + if AllFieldNativeCapacity.designated priority position u + then p u * homogeneousEntropy (q u) else 0 + · apply Finset.sum_congr rfl + intro k _ + congr 1 + funext a + simp only [ownWeight, Fin.ext_iff] + exact Fin.sum_univ_fun_getElem support fun u => + if ¬ AllFieldNativeCapacity.designated priority position u ∧ + u (priority position) = k.val then p u * q u a else 0 + +end NativeSupport + +end MatrixMultiplication.JointNativeGroupedEntropy + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section + +namespace MatrixMultiplication.JointGroupedEntropyPartition + +open MatrixMultiplication.Foundation AllFieldParameters AllFieldHistory +open JointNativeGroupedEntropy +open scoped BigOperators +attribute [local instance] Classical.propDecidable Classical.decEq + +section FiniteGroups + +variable {U K A : Type*} [Fintype U] [Fintype K] [Fintype A] + +omit [Fintype K] in +theorem groupMass_mul (s : ℝ) (p : U → ℝ) (group : U → K) (k : K) : + JointCompatibilityIncidence.groupMass (fun u => s * p u) group k = + s * JointCompatibilityIncidence.groupMass p group k := by + unfold JointCompatibilityIncidence.groupMass + rw [Finset.mul_sum] + apply Finset.sum_congr rfl + intro u _ + by_cases hu : group u = k <;> simp [hu] + +omit [Fintype K] [Fintype A] in +theorem groupMeasure_mul (s : ℝ) (p : U → ℝ) (group : U → K) + (q : U → A → ℝ) (k : K) : + groupMeasure (fun u => s * p u) group q k = + fun a => s * groupMeasure p group q k a := by + funext a + unfold groupMeasure + rw [Finset.mul_sum] + apply Finset.sum_congr rfl + intro u _ + by_cases hu : group u = k <;> simp [hu, mul_assoc] + +omit [Fintype K] [Fintype A] in +theorem groupLaw_mul_of_ne_zero (s : ℝ) (hs : s ≠ 0) (p : U → ℝ) + (group : U → K) (q : U → A → ℝ) (k : K) : + JointCompatibilityIncidence.groupLaw (fun u => s * p u) group q k = + JointCompatibilityIncidence.groupLaw p group q k := by + funext a + change groupMeasure (fun u => s * p u) group q k a / + JointCompatibilityIncidence.groupMass (fun u => s * p u) group k = + groupMeasure p group q k a / JointCompatibilityIncidence.groupMass p group k + rw [groupMeasure_mul, groupMass_mul] + exact mul_div_mul_left _ _ hs + +theorem groupedEntropy_mul (s : ℝ) (p : U → ℝ) (group : U → K) + (q : U → A → ℝ) : + JointCompatibilityIncidence.groupedEntropy (fun u => s * p u) group q = + s * JointCompatibilityIncidence.groupedEntropy p group q := by + by_cases hs : s = 0 + · simp [hs, JointCompatibilityIncidence.groupedEntropy, + JointCompatibilityIncidence.groupMass] + · unfold JointCompatibilityIncidence.groupedEntropy + simp only [groupMass_mul, groupLaw_mul_of_ne_zero s hs, mul_assoc, Finset.mul_sum] + +omit [Fintype A] in +theorem groupMeasure_designated_some (p : U → ℝ) (d : U → Prop) + (q : U → A → ℝ) (u : U) : + groupMeasure p (JointCompatibilityIncidence.designatedGroup d) q (some u) = + fun a => if d u then p u * q u a else 0 := by + funext a + simp only [groupMeasure, JointCompatibilityIncidence.designatedGroup_eq_some] + by_cases hu : d u <;> simp [hu] + +omit [Fintype A] in +theorem groupMeasure_designated_none (p : U → ℝ) (d : U → Prop) + (q : U → A → ℝ) : + groupMeasure p (JointCompatibilityIncidence.designatedGroup d) q none = + fun a => ∑ u, if ¬ d u then p u * q u a else 0 := by + funext a + simp only [groupMeasure, JointCompatibilityIncidence.designatedGroup_eq_none] + +theorem groupedEntropy_designated (p : U → ℝ) (d : U → Prop) + (q : U → A → ℝ) (hp : ∀ u, 0 ≤ p u) (hq : ∀ u, ∑ a, q u a = 1) : + JointCompatibilityIncidence.groupedEntropy p + (JointCompatibilityIncidence.designatedGroup d) q = + (∑ u, if d u then p u * homogeneousEntropy (q u) else 0) + + homogeneousEntropy (fun a => ∑ u, if ¬ d u then p u * q u a else 0) := by + rw [groupedEntropy_eq_sum_homogeneous p _ q hp hq, Fintype.sum_option, + groupMeasure_designated_none, add_comm] + congr 1 + apply Finset.sum_congr rfl + intro u _ + rw [groupMeasure_designated_some] + by_cases hu : d u + · simp only [hu, ite_true] + exact homogeneousEntropy_mul_normalized (p u) (q u) (hq u) + · simp only [hu, ite_false, homogeneousEntropy_zero] + +theorem groupedEntropy_partition (p : U → ℝ) (d : U → Prop) (weight : U → K) + (q : U → A → ℝ) (hp : ∀ u, 0 ≤ p u) (hq : ∀ u, ∑ a, q u a = 1) : + JointCompatibilityIncidence.groupedEntropy p (singletonResidualGroup d weight) q = + ∑ k, JointCompatibilityIncidence.groupedEntropy + (fun u => if weight u = k then p u else 0) + (JointCompatibilityIncidence.designatedGroup d) q := by + have hclass (k : K) := groupedEntropy_designated + (fun u => if weight u = k then p u else 0) d q + (fun u => by split_ifs; exact hp u; exact le_rfl) hq + rw [groupedEntropy_singletons_residuals p d weight q hp hq] + simp_rw [hclass] + rw [Finset.sum_add_distrib, Finset.sum_comm] + congr 1 + · apply Finset.sum_congr rfl + intro u _ + by_cases hu : d u <;> simp [hu, ite_mul] + · apply Finset.sum_congr rfl + intro k _ + congr 1 + funext a + apply Finset.sum_congr rfl + intro u _ + by_cases hd : d u <;> by_cases hw : weight u = k <;> simp [hd, hw] + +theorem groupedEntropy_conditional_partition (p : FiniteLaw U) (d : U → Prop) + (weight : U → K) (q : U → A → ℝ) (hq : ∀ u, ∑ a, q u a = 1) : + JointCompatibilityIncidence.groupedEntropy p.mass (singletonResidualGroup d weight) q = + ∑ k, (p.map weight).mass k * + JointCompatibilityIncidence.groupedEntropy (p.conditional weight k).mass + (JointCompatibilityIncidence.designatedGroup d) q := by + rw [groupedEntropy_partition p.mass d weight q p.nonneg hq] + apply Finset.sum_congr rfl + intro k _ + have hm : (fun u => if weight u = k then p.mass u else 0) = + fun u => (p.map weight).mass k * (p.conditional weight k).mass u := by + funext u + exact (p.map_mass_mul_conditional weight k u).symm + rw [hm, groupedEntropy_mul] + +end FiniteGroups + +section NativeSupport + +variable {A : Type*} [Fintype A] + +theorem native_groupedEntropy_eq_sum_masked (support : List Shape) (p : Shape → ℝ) + (priority : Placement) (position : Fin 3) (q : Shape → A → ℝ) + (hbound : ∀ i : SupportIndex support, support[i.val] (priority position) < 17) + (hp : ∀ i : SupportIndex support, 0 ≤ p support[i.val]) + (hq : ∀ i : SupportIndex support, ∑ a, q support[i.val] a = 1) : + AllFieldNativeCapacity.groupedEntropy support p priority position q = + ∑ k : Fin 17, JointCompatibilityIncidence.groupedEntropy + (fun i : SupportIndex support => + if ownWeight support priority position hbound i = k then p support[i.val] else 0) + (JointCompatibilityIncidence.designatedGroup + (fun i => AllFieldNativeCapacity.designated priority position support[i.val])) + (fun i => q support[i.val]) := by + have hpart := groupedEntropy_partition (fun i : SupportIndex support => p support[i.val]) + (fun i => AllFieldNativeCapacity.designated priority position support[i.val]) + (ownWeight support priority position hbound) (fun i => q support[i.val]) hp hq + refine (groupedEntropy_eq_native support p priority position q hbound hp hq).symm.trans + (hpart.trans ?_) + apply Finset.sum_congr rfl + intro k _ + apply congrArg (fun weights : SupportIndex support → ℝ => + JointCompatibilityIncidence.groupedEntropy weights + (JointCompatibilityIncidence.designatedGroup + (fun i => AllFieldNativeCapacity.designated priority position support[i.val])) + (fun i => q support[i.val])) + funext i + by_cases hi : ownWeight support priority position hbound i = k <;> simp only [hi, ite_true, ite_false] + +theorem native_groupedEntropy_eq_sum_conditional (support : List Shape) (p : Shape → ℝ) + (priority : Placement) (position : Fin 3) (q : Shape → A → ℝ) + (hbound : ∀ i : SupportIndex support, support[i.val] (priority position) < 17) + (law : FiniteLaw (SupportIndex support)) + (hlaw : ∀ i : SupportIndex support, law.mass i = p support[i.val]) + (hq : ∀ i : SupportIndex support, ∑ a, q support[i.val] a = 1) : + AllFieldNativeCapacity.groupedEntropy support p priority position q = + ∑ k : Fin 17, (law.map (ownWeight support priority position hbound)).mass k * + JointCompatibilityIncidence.groupedEntropy + (law.conditional (ownWeight support priority position hbound) k).mass + (JointCompatibilityIncidence.designatedGroup + (fun i => AllFieldNativeCapacity.designated priority position support[i.val])) + (fun i => q support[i.val]) := by + have hp (i : SupportIndex support) : 0 ≤ p support[i.val] := by + rw [← hlaw i] + exact law.nonneg i + have hm : law.mass = fun i : SupportIndex support => p support[i.val] := funext hlaw + have hn : JointCompatibilityIncidence.groupedEntropy law.mass + (nativeGroup support priority position hbound) (fun i => q support[i.val]) = + AllFieldNativeCapacity.groupedEntropy support p priority position q := by + rw [hm] + exact groupedEntropy_eq_native support p priority position q hbound hp hq + exact hn.symm.trans (groupedEntropy_conditional_partition law _ _ _ hq) + +end NativeSupport + +end MatrixMultiplication.JointGroupedEntropyPartition + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section + +namespace MatrixMultiplication.JointGroupedEntropyEmbedding + +open MatrixMultiplication.Foundation JointCompatibilityIncidence JointNativeGroupedEntropy +open scoped BigOperators +attribute [local instance] Classical.propDecidable Classical.decEq + +variable {U V K L A : Type*} + [Fintype U] [Fintype V] [Fintype K] [Fintype L] [Fintype A] + +omit [Fintype K] [Fintype L] in +theorem groupMass_label_injective (j : K → L) (hj : Function.Injective j) + (p : U → ℝ) (group : U → K) (k : K) : + groupMass p (j ∘ group) (j k) = groupMass p group k := by + simp only [groupMass, Function.comp_apply, hj.eq_iff] + +omit [Fintype K] [Fintype L] [Fintype A] in +theorem groupLaw_label_injective (j : K → L) (hj : Function.Injective j) + (p : U → ℝ) (group : U → K) (q : U → A → ℝ) (k : K) : + groupLaw p (j ∘ group) q (j k) = groupLaw p group q k := by + funext a + simp only [groupLaw, groupMass_label_injective j hj, + Function.comp_apply, hj.eq_iff] + +omit [Fintype K] [Fintype L] in +theorem groupMass_label_not_mem_range (j : K → L) (p : U → ℝ) + (group : U → K) (l : L) (hl : l ∉ Set.range j) : + groupMass p (j ∘ group) l = 0 := by + apply Finset.sum_eq_zero + intro u _ + exact ite_eq_right (fun h => hl ⟨group u, h⟩) + +theorem groupedEntropy_label_injective (j : K → L) (hj : Function.Injective j) + (p : U → ℝ) (group : U → K) (q : U → A → ℝ) : + groupedEntropy p (j ∘ group) q = groupedEntropy p group q := by + unfold groupedEntropy + symm + apply Fintype.sum_of_injective j hj + · intro l hl + rw [groupMass_label_not_mem_range j p group l hl, zero_mul] + · intro k + rw [groupMass_label_injective j hj, groupLaw_label_injective j hj] + +def pushforwardWeight (p : U → ℝ) (f : U → V) (v : V) : ℝ := + ∑ u, if f u = v then p u else 0 + +theorem sum_pushforwardWeight_mul (p : U → ℝ) (f : U → V) (test : V → ℝ) : + (∑ v, pushforwardWeight p f v * test v) = ∑ u, p u * test (f u) := by + simp only [pushforwardWeight, Finset.sum_mul] + rw [Finset.sum_comm] + apply Finset.sum_congr rfl + intro u _ + simp only [ite_mul, zero_mul] + simp + +omit [Fintype K] in +theorem groupMass_pushforward (p : U → ℝ) (f : U → V) + (group : V → K) (k : K) : + groupMass (pushforwardWeight p f) group k = groupMass p (group ∘ f) k := by + simpa only [groupMass, mul_ite, mul_one, mul_zero, Function.comp_apply] using + (sum_pushforwardWeight_mul p f (fun v => if group v = k then 1 else 0)) + +omit [Fintype K] [Fintype A] in +theorem groupMeasure_pushforward (p : U → ℝ) (f : U → V) + (group : V → K) (q : V → A → ℝ) (k : K) : + groupMeasure (pushforwardWeight p f) group q k = + groupMeasure p (group ∘ f) (q ∘ f) k := by + funext a + simpa only [groupMeasure, mul_ite, mul_zero, Function.comp_apply] using + (sum_pushforwardWeight_mul p f (fun v => if group v = k then q v a else 0)) + +omit [Fintype K] [Fintype A] in +theorem groupLaw_pushforward (p : U → ℝ) (f : U → V) + (group : V → K) (q : V → A → ℝ) (k : K) : + groupLaw (pushforwardWeight p f) group q k = + groupLaw p (group ∘ f) (q ∘ f) k := by + funext a + change groupMeasure (pushforwardWeight p f) group q k a / + groupMass (pushforwardWeight p f) group k = + groupMeasure p (group ∘ f) (q ∘ f) k a / groupMass p (group ∘ f) k + rw [groupMeasure_pushforward, groupMass_pushforward] + +theorem groupedEntropy_pushforward (p : U → ℝ) (f : U → V) + (group : V → K) (q : V → A → ℝ) : + groupedEntropy (pushforwardWeight p f) group q = + groupedEntropy p (group ∘ f) (q ∘ f) := by + simp only [groupedEntropy, groupMass_pushforward, groupLaw_pushforward] + +theorem groupedEntropy_pushforward_of_agree (p : U → ℝ) (f : U → V) + (group : V → K) (qU : U → A → ℝ) (qV : V → A → ℝ) + (hq : ∀ u, qV (f u) = qU u) : + groupedEntropy (pushforwardWeight p f) group qV = + groupedEntropy p (group ∘ f) qU := by + rw [groupedEntropy_pushforward] + have he : qV ∘ f = qU := funext hq + rw [he] + +theorem groupedEntropy_pushforward_embedding (p : U → ℝ) (f : U → V) + (groupU : U → K) (groupV : V → L) (j : K → L) (hj : Function.Injective j) + (hgroup : ∀ u, groupV (f u) = j (groupU u)) + (qU : U → A → ℝ) (qV : V → A → ℝ) (hq : ∀ u, qV (f u) = qU u) : + groupedEntropy (pushforwardWeight p f) groupV qV = groupedEntropy p groupU qU := by + rw [groupedEntropy_pushforward_of_agree p f groupV qU qV hq] + have hg : groupV ∘ f = j ∘ groupU := funext hgroup + rw [hg, groupedEntropy_label_injective j hj] + +theorem sum_map_mass_mul (p : FiniteLaw U) (f : U → V) (test : V → ℝ) : + (∑ v, (p.map f).mass v * test v) = ∑ u, p.mass u * test (f u) := by + simpa only [FiniteLaw.map_mass, pushforwardWeight] using + (sum_pushforwardWeight_mul p.mass f test) + +omit [Fintype K] in +theorem groupMass_map (p : FiniteLaw U) (f : U → V) + (group : V → K) (k : K) : + groupMass (p.map f).mass group k = groupMass p.mass (group ∘ f) k := by + simpa only [groupMass, mul_ite, mul_one, mul_zero, Function.comp_apply] using + (sum_map_mass_mul p f (fun v => if group v = k then 1 else 0)) + +omit [Fintype K] [Fintype A] in +theorem groupMeasure_map (p : FiniteLaw U) (f : U → V) + (group : V → K) (q : V → A → ℝ) (k : K) : + groupMeasure (p.map f).mass group q k = + groupMeasure p.mass (group ∘ f) (q ∘ f) k := by + funext a + simpa only [groupMeasure, mul_ite, mul_zero, Function.comp_apply] using + (sum_map_mass_mul p f (fun v => if group v = k then q v a else 0)) + +omit [Fintype K] [Fintype A] in +theorem groupLaw_map (p : FiniteLaw U) (f : U → V) + (group : V → K) (q : V → A → ℝ) (k : K) : + groupLaw (p.map f).mass group q k = groupLaw p.mass (group ∘ f) (q ∘ f) k := by + funext a + change groupMeasure (p.map f).mass group q k a / groupMass (p.map f).mass group k = + groupMeasure p.mass (group ∘ f) (q ∘ f) k a / groupMass p.mass (group ∘ f) k + rw [groupMeasure_map, groupMass_map] + +theorem groupedEntropy_map (p : FiniteLaw U) (f : U → V) + (group : V → K) (q : V → A → ℝ) : + groupedEntropy (p.map f).mass group q = + groupedEntropy p.mass (group ∘ f) (q ∘ f) := by + simp only [groupedEntropy, groupMass_map, groupLaw_map] + +theorem groupedEntropy_map_of_agree (p : FiniteLaw U) (f : U → V) + (group : V → K) (qU : U → A → ℝ) (qV : V → A → ℝ) + (hq : ∀ u, qV (f u) = qU u) : + groupedEntropy (p.map f).mass group qV = + groupedEntropy p.mass (group ∘ f) qU := by + rw [groupedEntropy_map] + have he : qV ∘ f = qU := funext hq + rw [he] + +theorem groupedEntropy_map_embedding (p : FiniteLaw U) (f : U → V) + (groupU : U → K) (groupV : V → L) (j : K → L) (hj : Function.Injective j) + (hgroup : ∀ u, groupV (f u) = j (groupU u)) + (qU : U → A → ℝ) (qV : V → A → ℝ) (hq : ∀ u, qV (f u) = qU u) : + groupedEntropy (p.map f).mass groupV qV = groupedEntropy p.mass groupU qU := by + rw [groupedEntropy_map_of_agree p f groupV qU qV hq] + have hg : groupV ∘ f = j ∘ groupU := funext hgroup + rw [hg, groupedEntropy_label_injective j hj] + +end MatrixMultiplication.JointGroupedEntropyEmbedding + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section + +namespace MatrixMultiplication.JointProjectedGroupEntropy + +open MatrixMultiplication.Foundation JointCompatibilityIncidence +open JointCompatibilityScaling JointCompatibilityControls JointCompatibilityRateLimit +open JointGroupedEntropyPartition +open scoped BigOperators + +attribute [local instance] Classical.propDecidable Classical.decEq + +section FiniteGroups + +variable {U K A : Type*} [Fintype U] [Fintype K] [Fintype A] + +theorem groupMass_designated_some (p : U → ℝ) (d : U → Prop) (u : U) : + groupMass p (designatedGroup d) (some u) = if d u then p u else 0 := by + simp only [groupMass, designatedGroup_eq_some] + by_cases hd : d u <;> simp [hd] + +theorem weighted_groupLaw_designated_some (p : U → ℝ) (d : U → Prop) + (law : U → A → ℝ) (u : U) : + groupMass p (designatedGroup d) (some u) * + finiteEntropy (groupLaw p (designatedGroup d) law (some u)) = + (if d u then p u else 0) * finiteEntropy (law u) := by + by_cases hd : d u + · rw [groupMass_designated_some, ite_eq_left hd] + by_cases hp : p u = 0 + · simp [hp] + · have hl : groupLaw p (designatedGroup d) law (some u) = law u := by + funext a + simp [groupLaw, groupMass_designated_some, designatedGroup_eq_some, hd, hp] + rw [hl] + · rw [groupMass_designated_some, ite_eq_right hd] + simp + +theorem groupedEntropy_counts_eq_total_mul (n : U → ℕ) (group : U → K) + (law : U → A → ℝ) : + groupedEntropy (fun u => (n u : ℝ)) group law = + (∑ u, n u : ℕ) * + groupedEntropy (fun u => (n u : ℝ) / (∑ v, n v : ℕ)) group law := by + by_cases hz : (∑ u, n u) = 0 + · have hn (u : U) : n u = 0 := by + have hle : n u ≤ ∑ v, n v := + Finset.single_le_sum (fun _ _ => Nat.zero_le _) (Finset.mem_univ u) + rw [hz] at hle + exact Nat.eq_zero_of_le_zero hle + simp [hn, groupedEntropy, groupMass] + · have hN : ((∑ u, n u : ℕ) : ℝ) ≠ 0 := Nat.cast_ne_zero.mpr hz + have hf : (fun u => (n u : ℝ)) = + fun u => ((∑ v, n v : ℕ) : ℝ) * ((n u : ℝ) / (∑ v, n v : ℕ)) := by + funext u + exact (mul_div_cancel₀ _ hN).symm + calc + _ = groupedEntropy + (fun u => ((∑ v, n v : ℕ) : ℝ) * ((n u : ℝ) / (∑ v, n v : ℕ))) + group law := congrArg (fun p => groupedEntropy p group law) hf + _ = _ := groupedEntropy_mul _ _ _ _ + +end FiniteGroups + +variable {C : Type*} [Fintype C] [DecidableEq C] + {Shape A : C → Type*} + [∀ c, Fintype (Shape c)] [∀ c, DecidableEq (Shape c)] + [∀ c, Fintype (A c)] [∀ c, DecidableEq (A c)] + +omit [Fintype C] [DecidableEq C] in +theorem baseGroupSize_eq_groupMass (base : ∀ c, Shape c → ℕ) + (d : ∀ c, Shape c → Prop) (g : Σ c, Option (Shape c)) : + (baseGroupSize base d g : ℝ) = + groupMass (fun u => (base g.1 u : ℝ)) (designatedGroup (d g.1)) g.2 := by + calc + (baseGroupSize base d g : ℝ) = + ∑ u ∈ Finset.univ.filter (fun u => designatedGroup (d g.1) u = g.2), + (base g.1 u : ℝ) := by + rw [baseGroupSize, Nat.cast_sum] + exact (Finset.sum_subtype + (Finset.univ.filter (fun u => designatedGroup (d g.1) u = g.2)) + (by simp) (fun u => (base g.1 u : ℝ))).symm + _ = ∑ u, if designatedGroup (d g.1) u = g.2 then (base g.1 u : ℝ) else 0 := by + rw [Finset.sum_filter] + _ = _ := by + unfold groupMass + apply Finset.sum_congr rfl + intro u _ + by_cases hu : designatedGroup (d g.1) u = g.2 <;> simp only [hu, ite_true, ite_false] + +omit [Fintype C] [DecidableEq C] [∀ c, DecidableEq (Shape c)] + [∀ c, Fintype (A c)] [∀ c, DecidableEq (A c)] in +theorem residualCenter_eq_groupLaw (base : ∀ c, Shape c → ℕ) + (d : ∀ c, Shape c → Prop) (law : ∀ c, Shape c → A c → ℝ) (c : C) : + residualCenter base d law c = + groupLaw (fun u => (base c u : ℝ)) (designatedGroup (d c)) (law c) none := by + funext a + simp only [residualCenter, residualBase, Nat.cast_sum, groupLaw, groupMass, + designatedGroup_eq_none] + congr 1 + · rw [← Finset.sum_filter] + exact (Finset.sum_subtype (Finset.univ.filter (fun u => ¬ d c u)) + (by simp) (fun u => (base c u : ℝ) * law c u a)).symm + · rw [← Finset.sum_filter] + exact (Finset.sum_subtype (Finset.univ.filter (fun u => ¬ d c u)) + (by simp) (fun u => (base c u : ℝ))).symm + +omit [DecidableEq C] [∀ c, DecidableEq (A c)] in +theorem projectedReferenceEntropy_eq_sum_counts_groupedEntropy + (base : ∀ c, Shape c → ℕ) (d : ∀ c, Shape c → Prop) + (law : ∀ c, Shape c → A c → ℝ) : + projectedReferenceEntropy base d (groupCap base d law 0) = + ∑ c, groupedEntropy (fun u => (base c u : ℝ)) + (designatedGroup (d c)) (law c) := by + simp only [projectedReferenceEntropy, Fintype.sum_sigma, groupCap, add_zero, + groupedEntropy] + apply Finset.sum_congr rfl + intro c _ + apply Finset.sum_congr rfl + intro k _ + rw [baseGroupSize_eq_groupMass] + cases k with + | none => + change _ * finiteEntropy (residualCenter base d law c) = _ + rw [residualCenter_eq_groupLaw] + | some u => + change _ * finiteEntropy (law c u) = _ + rw [weighted_groupLaw_designated_some, groupMass_designated_some] + +omit [DecidableEq C] [∀ c, DecidableEq (A c)] in +theorem projectedReferenceEntropy_eq_sum_weighted_groupedEntropy + (base : ∀ c, Shape c → ℕ) (d : ∀ c, Shape c → Prop) + (law : ∀ c, Shape c → A c → ℝ) : + projectedReferenceEntropy base d (groupCap base d law 0) = + ∑ c, (baseSize base c : ℝ) * + groupedEntropy (fun u => (base c u : ℝ) / (baseSize base c : ℝ)) + (designatedGroup (d c)) (law c) := by + rw [projectedReferenceEntropy_eq_sum_counts_groupedEntropy] + apply Finset.sum_congr rfl + intro c _ + exact groupedEntropy_counts_eq_total_mul (base c) _ _ + +end MatrixMultiplication.JointProjectedGroupEntropy + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section + +namespace MatrixMultiplication.AllFieldNativeGroupedRates + +open MatrixMultiplication.Foundation AllFieldParameters AllFieldHistory +open JointNativeGroupedEntropy JointGroupedEntropyPartition +open AllFieldNativeCapacity AllFieldPairConditionalEntropy +open scoped BigOperators +attribute [local instance] Classical.propDecidable Classical.decEq + +section Reindex + +variable {U K A : Type*} [Fintype U] [Fintype K] [Fintype A] + +omit [Fintype U] [Fintype K] in +theorem singletonResidualGroup_transport (e : U ≃ U) (c : K ≃ K) + (d : U → Prop) (weight : U → K) + (hw : ∀ u, c (weight u) = weight (e u)) : + (Equiv.sumCongr e c) ∘ singletonResidualGroup (d ∘ e) weight = + singletonResidualGroup d weight ∘ e := by + funext u + by_cases hu : d (e u) <;> + simp [singletonResidualGroup, Function.comp_apply, hu, hw] + +theorem singletonResidual_groupedEntropy_reindex (e : U ≃ U) (c : K ≃ K) + (p : U → ℝ) (d : U → Prop) (weight : U → K) (q : U → A → ℝ) + (hp : ∀ u, p (e u) = p u) (hw : ∀ u, c (weight u) = weight (e u)) : + JointCompatibilityIncidence.groupedEntropy p + (singletonResidualGroup (d ∘ e) weight) (q ∘ e) = + JointCompatibilityIncidence.groupedEntropy p (singletonResidualGroup d weight) q := by + calc + _ = JointCompatibilityIncidence.groupedEntropy p + ((Equiv.sumCongr e c) ∘ singletonResidualGroup (d ∘ e) weight) (q ∘ e) := + (JointCompatibilityIncidence.groupedEntropy_relabel (Equiv.sumCongr e c) p _ _).symm + _ = JointCompatibilityIncidence.groupedEntropy p + (singletonResidualGroup d weight ∘ e) (q ∘ e) := by + rw [singletonResidualGroup_transport e c d weight hw] + _ = _ := JointCompatibilityIncidence.groupedEntropy_reindex e p _ q hp + +theorem right_conditional_sum_eq (e : U ≃ U) (c : K ≃ K) + (p : FiniteLaw U) (d : U → Prop) (weight : U → K) (q : U → A → ℝ) + (hp : ∀ u, p.mass (e u) = p.mass u) + (hw : ∀ u, c (weight u) = weight (e u)) (hq : ∀ u, ∑ a, q u a = 1) : + (∑ k, (p.map weight).mass k * + JointCompatibilityIncidence.groupedEntropy (p.conditional weight k).mass + (JointCompatibilityIncidence.designatedGroup (d ∘ e)) (q ∘ e)) = + JointCompatibilityIncidence.groupedEntropy p.mass (singletonResidualGroup d weight) q := by + rw [← groupedEntropy_conditional_partition p (d ∘ e) weight (q ∘ e) + (fun u => hq (e u))] + exact singletonResidual_groupedEntropy_reindex e c p.mass d weight q hp hw + +end Reindex + +def supportSubtypeEquiv {α : Type*} (xs : List α) (f : α → α) + (hm : ∀ x ∈ xs, f x ∈ xs) (hi : ∀ x ∈ xs, f (f x) = x) : + Equiv.Perm {x // x ∈ xs} where + toFun x := ⟨f x.val, hm x.val x.property⟩ + invFun x := ⟨f x.val, hm x.val x.property⟩ + left_inv x := Subtype.ext (hi x.val x.property) + right_inv x := Subtype.ext (hi x.val x.property) + +def supportIndexEquiv {α : Type*} [DecidableEq α] (xs : List α) (hn : xs.Nodup) + (f : α → α) (hm : ∀ x ∈ xs, f x ∈ xs) (hi : ∀ x ∈ xs, f (f x) = x) : + Equiv.Perm (Fin xs.length) := + ((hn.getEquiv xs).trans (supportSubtypeEquiv xs f hm hi)).trans (hn.getEquiv xs).symm + +theorem supportIndexEquiv_get {α : Type*} [DecidableEq α] (xs : List α) + (hn : xs.Nodup) (f : α → α) (hm : ∀ x ∈ xs, f x ∈ xs) + (hi : ∀ x ∈ xs, f (f x) = x) (i : Fin xs.length) : + xs.get (supportIndexEquiv xs hn f hm hi i) = f (xs.get i) := by + exact congrArg Subtype.val ((hn.getEquiv xs).apply_symm_apply + ((supportSubtypeEquiv xs f hm hi) ((hn.getEquiv xs) i))) + +def boundedComplement (s : ℕ) (hs : s < 17) (k : Fin 17) : Fin 17 := + ⟨if k.val ≤ s then s - k.val else k.val, by + split_ifs + · exact lt_of_le_of_lt (Nat.sub_le _ _) hs + · exact k.isLt⟩ + +theorem boundedComplement_involutive (s : ℕ) (hs : s < 17) : + Function.Involutive (boundedComplement s hs) := by + intro k + apply Fin.ext + dsimp only [boundedComplement] + split_ifs <;> omega + +def boundedComplementEquiv (s : ℕ) (hs : s < 17) : Equiv.Perm (Fin 17) where + toFun := boundedComplement s hs + invFun := boundedComplement s hs + left_inv := boundedComplement_involutive s hs + right_inv := boundedComplement_involutive s hs + +section NativeSupport + +variable {A : Type*} [Fintype A] + +theorem native_right_conditional_sum_eq (support : List Shape) (s : Shape) + (p : Shape → ℝ) (priority : Placement) (position : Fin 3) (q : Shape → A → ℝ) + (hn : support.Nodup) (hm : ∀ u ∈ support, complement s u ∈ support) + (hsupp : ∀ u ∈ support, ∀ side, u side ≤ s side) + (hs : s (priority position) < 17) + (hbound : ∀ i : SupportIndex support, support[i.val] (priority position) < 17) + (law : FiniteLaw (SupportIndex support)) + (hlaw : ∀ i : SupportIndex support, law.mass i = p support[i.val]) + (hp : ∀ u ∈ support, p (complement s u) = p u) + (hq : ∀ i : SupportIndex support, ∑ a, q support[i.val] a = 1) : + (∑ k : Fin 17, (law.map (ownWeight support priority position hbound)).mass k * + JointCompatibilityIncidence.groupedEntropy + (law.conditional (ownWeight support priority position hbound) k).mass + (JointCompatibilityIncidence.designatedGroup (fun i => + AllFieldNativeCapacity.designated priority position (complement s support[i.val]))) + (fun i => q (complement s support[i.val]))) = + AllFieldNativeCapacity.groupedEntropy support p priority position q := by + let hi : ∀ u ∈ support, complement s (complement s u) = u := + fun u hu => complement_involution_of_le s u (hsupp u hu) + let e := supportIndexEquiv support hn (complement s) hm hi + let c := boundedComplementEquiv (s (priority position)) hs + let weight := ownWeight support priority position hbound + let d : SupportIndex support → Prop := + fun i => AllFieldNativeCapacity.designated priority position support[i.val] + let q₀ : SupportIndex support → A → ℝ := fun i => q support[i.val] + have he (i : SupportIndex support) : + support[(e i).val] = complement s support[i.val] := by + simpa only [List.get_eq_getElem] using + supportIndexEquiv_get support hn (complement s) hm hi i + have hmass (i : SupportIndex support) : law.mass (e i) = law.mass i := by + simp only [hlaw, he] + exact hp _ (List.getElem_mem i.isLt) + have hw (i : SupportIndex support) : c (weight i) = weight (e i) := by + apply Fin.ext + change (if support[i.val] (priority position) ≤ s (priority position) + then s (priority position) - support[i.val] (priority position) + else support[i.val] (priority position)) = support[(e i).val] (priority position) + rw [ite_eq_left (hsupp _ (List.getElem_mem i.isLt) _), he] + rfl + have hright := right_conditional_sum_eq e c law d weight q₀ hmass hw hq + have hd : d ∘ e = fun i => + AllFieldNativeCapacity.designated priority position (complement s support[i.val]) := by + funext i + dsimp only [d, Function.comp_apply] + rw [he] + have hqr : q₀ ∘ e = fun i => q (complement s support[i.val]) := by + funext i + dsimp only [q₀, Function.comp_apply] + rw [he] + rw [hd, hqr] at hright + have hnonneg (i : SupportIndex support) : 0 ≤ p support[i.val] := by + rw [← hlaw i] + exact law.nonneg i + have hmassfun : law.mass = fun i : SupportIndex support => p support[i.val] := funext hlaw + calc + _ = JointCompatibilityIncidence.groupedEntropy law.mass + (nativeGroup support priority position hbound) (fun i => q support[i.val]) := by + simpa only [d, q₀, weight, nativeGroup] using hright + _ = _ := by + rw [hmassfun] + exact groupedEntropy_eq_native support p priority position q hbound hnonneg hq + +theorem native_two_conditional_sums_eq (support : List Shape) (s : Shape) + (p : Shape → ℝ) (priority : Placement) (position : Fin 3) (q : Shape → A → ℝ) + (hn : support.Nodup) (hm : ∀ u ∈ support, complement s u ∈ support) + (hsupp : ∀ u ∈ support, ∀ side, u side ≤ s side) + (hs : s (priority position) < 17) + (hbound : ∀ i : SupportIndex support, support[i.val] (priority position) < 17) + (law : FiniteLaw (SupportIndex support)) + (hlaw : ∀ i : SupportIndex support, law.mass i = p support[i.val]) + (hp : ∀ u ∈ support, p (complement s u) = p u) + (hq : ∀ i : SupportIndex support, ∑ a, q support[i.val] a = 1) : + (∑ k : Fin 17, (law.map (ownWeight support priority position hbound)).mass k * + (JointCompatibilityIncidence.groupedEntropy + (law.conditional (ownWeight support priority position hbound) k).mass + (JointCompatibilityIncidence.designatedGroup (fun i => + AllFieldNativeCapacity.designated priority position support[i.val])) + (fun i => q support[i.val]) + + JointCompatibilityIncidence.groupedEntropy + (law.conditional (ownWeight support priority position hbound) k).mass + (JointCompatibilityIncidence.designatedGroup (fun i => + AllFieldNativeCapacity.designated priority position (complement s support[i.val]))) + (fun i => q (complement s support[i.val])))) = + 2 * AllFieldNativeCapacity.groupedEntropy support p priority position q := by + simp only [mul_add, Finset.sum_add_distrib] + rw [← native_groupedEntropy_eq_sum_conditional support p priority position q hbound law hlaw hq, + native_right_conditional_sum_eq support s p priority position q hn hm hsupp hs + hbound law hlaw hp hq] + ring + +end NativeSupport + +def twoHalfConditionalCost {A : Type*} [Fintype A] + (support : List Shape) (s : Shape) (priority : Placement) (position : Fin 3) + (q : Shape → A → ℝ) (law : FiniteLaw (SupportIndex support)) + (weight : SupportIndex support → Fin 17) : ℝ := + ∑ k : Fin 17, (law.map weight).mass k * + (JointCompatibilityIncidence.groupedEntropy (law.conditional weight k).mass + (JointCompatibilityIncidence.designatedGroup (fun i => + AllFieldNativeCapacity.designated priority position support[i.val])) + (fun i => q support[i.val]) + + JointCompatibilityIncidence.groupedEntropy (law.conditional weight k).mass + (JointCompatibilityIncidence.designatedGroup (fun i => + AllFieldNativeCapacity.designated priority position (complement s support[i.val]))) + (fun i => q (complement s support[i.val]))) + +theorem stageA_twoHalfConditionalCost_eq (g : Shape) (hg : g ∈ positiveInitial) + (priority : Placement) (position : Fin 3) : + twoHalfConditionalCost (below g) g priority position + (fun u a => (halfLaw u (priority position) a : ℝ)) (stageASplitLaw g hg) + (stageASplitWeight g hg (priority position)) = + 2 * AllFieldNativeCapacity.groupedEntropy (below g) + (fun u => (stageALaw g u : ℝ)) priority position + (fun u a => (halfLaw u (priority position) a : ℝ)) := by + have hs : g (priority position) < 17 := + Nat.lt_succ_of_le ((positiveInitial_shape_spec g hg).1 (priority position)) + let hb : ∀ i : SupportIndex (below g), (below g)[i.val] (priority position) < 17 := + fun i => lt_of_le_of_lt (below_le (List.getElem_mem i.isLt) _) hs + have hq (i : SupportIndex (below g)) : + ∑ a, (halfLaw (below g)[i.val] (priority position) a : ℝ) = 1 := + (halfFiniteLaw _ (stageA_children_size g hg _ (List.getElem_mem i.isLt)) + (priority position)).total + have hh := native_two_conditional_sums_eq (below g) g + (fun u => (stageALaw g u : ℝ)) priority position + (fun u a => (halfLaw u (priority position) a : ℝ)) + (stageA_below_nodup g hg) (fun u hu => (stageA_support_complement g hg u hu).1) + (fun _ hu => below_le hu) hs hb (stageASplitLaw g hg) (fun _ => rfl) + (fun u hu => by rw [stageALaw_complement g u hg hu]) hq + exact hh + +theorem stageB_twoHalfConditionalCost_eq (t : Shape) (ht : t ∈ positiveSecond) + (priority : Placement) (position : Fin 3) : + twoHalfConditionalCost (below t) t priority position + (fun u a => (littleLaw t u (priority position) a : ℝ)) (stageBSplitLaw t ht) + (stageBSplitWeight t ht (priority position)) = + 2 * AllFieldNativeCapacity.groupedEntropy (below t) + (fun u => (stageBLaw t u : ℝ)) priority position + (fun u a => (littleLaw t u (priority position) a : ℝ)) := by + have hs : t (priority position) < 17 := + Nat.lt_succ_of_le ((positiveSecond_shape_spec t ht).1 (priority position)) + let hb : ∀ i : SupportIndex (below t), (below t)[i.val] (priority position) < 17 := + fun i => lt_of_le_of_lt (below_le (List.getElem_mem i.isLt) _) hs + have hq (i : SupportIndex (below t)) : + ∑ a, (littleLaw t (below t)[i.val] (priority position) a : ℝ) = 1 := + (littleFiniteLaw t _ (priority position)).total + have hh := native_two_conditional_sums_eq (below t) t + (fun u => (stageBLaw t u : ℝ)) priority position + (fun u a => (littleLaw t u (priority position) a : ℝ)) + (stageB_below_nodup t ht) (fun u hu => (stageB_support_complement t ht u hu).1) + (fun _ hu => below_le hu) hs hb (stageBSplitLaw t ht) (fun _ => rfl) + (fun u hu => by rw [stageBLaw_complement t u ht hu]) hq + exact hh + +theorem stageA_twoHalfConditionalCost_eq_entropy_sub_capacity + (g : Shape) (hg : g ∈ positiveInitial) (side : Fin 3) (hside : side ≠ 0) : + twoHalfConditionalCost (below g) g (Equiv.refl (Fin 3)) side + (fun u a => (halfLaw u side a : ℝ)) (stageASplitLaw g hg) + (stageASplitWeight g hg side) = + finiteEntropy (stageAPairLaw g hg side).mass - stageACapacity g side := by + rw [stageACapacity_sharing g hg side hside] + have hh := stageA_twoHalfConditionalCost_eq g hg (Equiv.refl (Fin 3)) side + simpa only [Equiv.refl_apply, sub_sub_cancel] using hh + +theorem stageB_twoHalfConditionalCost_eq_entropy_sub_capacity + (t : Shape) (ht : t ∈ positiveSecond) (side : Fin 3) (hside : side ≠ 0) : + twoHalfConditionalCost (below t) t (stageBPriority t) side + (fun u a => (littleLaw t u (stageBPriority t side) a : ℝ)) (stageBSplitLaw t ht) + (stageBSplitWeight t ht (stageBPriority t side)) = + finiteEntropy (stageBPairLaw t ht (stageBPriority t side)).mass - + stageBCapacity t side := by + rw [stageBCapacity_sharing t ht side hside] + have hh := stageB_twoHalfConditionalCost_eq t ht (stageBPriority t) side + simpa only [sub_sub_cancel] using hh + +end MatrixMultiplication.AllFieldNativeGroupedRates + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section + +namespace MatrixMultiplication.AllFieldGroupProjectedEntropy + +open MatrixMultiplication.Foundation AllFieldParameters AllFieldHistory AllFieldActiveLaws +open AllFieldHistoryChildLaws AllFieldGroupOrbitData AllFieldGroupDegrees +open AllFieldGroupNativeLaws AllFieldGroupPairWindows AllFieldGroupDegreeLaws +open JointCompatibilityScaling JointCompatibilityRateLimit JointCompatibilityControls +open JointCompatibilityIncidence JointGroupedEntropyEmbedding JointGroupedEntropyPartition +open AllFieldGroupBranchDesignation AllFieldGroupBranchLaws AllFieldNativeGroupedRates +open AllFieldScheduledYield AllFieldGroupPairEntropy +open scoped BigOperators +attribute [local instance] Classical.propDecidable Classical.decEq + +section Kernel + +variable {U V G A : Type*} [Fintype U] [Fintype V] [Fintype G] [Fintype A] + +theorem groupedEntropy_congr_law_on_support (p : U → ℝ) (group : U → G) + (q q' : U → A → ℝ) (hq : ∀ u, p u ≠ 0 → q u = q' u) : + groupedEntropy p group q = groupedEntropy p group q' := by + have he (g : G) : groupLaw p group q g = groupLaw p group q' g := by + funext a + unfold groupLaw + congr 1 + apply Finset.sum_congr rfl + intro u _ + by_cases hp : p u = 0 + · simp only [hp, zero_mul] + · rw [hq u hp] + simp only [groupedEntropy, he] + +theorem groupedEntropy_designated_pushforward (p : U → ℝ) (f : U → V) + (hf : Function.Injective f) (d : V → Prop) (d' : U → Prop) + (hd : ∀ u, d (f u) ↔ d' u) (q : V → A → ℝ) (q' : U → A → ℝ) + (hq : ∀ u, p u ≠ 0 → q (f u) = q' u) : + groupedEntropy (pushforwardWeight p f) (designatedGroup d) q = + groupedEntropy p (designatedGroup d') q' := by + rw [groupedEntropy_pushforward] + have hg : designatedGroup d ∘ f = Option.map f ∘ designatedGroup d' := by + funext u + by_cases hu : d' u + · simp [designatedGroup, (hd u).mpr hu, hu] + · simp [designatedGroup, mt (hd u).mp hu, hu] + rw [hg, groupedEntropy_label_injective (Option.map f) (Option.map_injective hf)] + exact groupedEntropy_congr_law_on_support p _ _ q' hq + +theorem groupedEntropy_const_one (p : U → ℝ) (group : U → G) : + groupedEntropy p group (fun _ (_ : A) => 1) = 0 := by + unfold groupedEntropy + apply Finset.sum_eq_zero + intro g _ + by_cases hg : groupMass p group g = 0 + · rw [hg, zero_mul] + · have he : groupLaw p group (fun _ (_ : A) => 1) g = fun _ => 1 := by + funext a + simp only [groupLaw, mul_one] + exact div_self hg + rw [he] + simp [finiteEntropy, entropyTerm] + +omit [Fintype V] [Fintype G] in +theorem pushforwardWeight_mask (p : U → ℝ) (f : U → V) + (weight : V → G) (k : G) : + (fun v => if weight v = k then pushforwardWeight p f v else 0) = + pushforwardWeight (fun u => if weight (f u) = k then p u else 0) f := by + funext v + unfold pushforwardWeight + by_cases hv : weight v = k + · simp only [hv, ite_true] + apply Finset.sum_congr rfl + intro u _ + by_cases hu : f u = v <;> simp [hu, hv] + · simp only [hv, ite_false] + symm + apply Finset.sum_eq_zero + intro u _ + by_cases hu : f u = v <;> simp [hu, hv] + +end Kernel + +variable {K tick : ℕ} {sigma : Placement} + +def maskedBranchMass (h : ActiveOrder K tick sigma) (side : Fin 3) (k : Fin 17) + (b : h.val.val.1.Branch) : ℝ := + if nativeSplitWeightCode h.val.val.1 (h.val.val.1.priority side) b = k + then (branchLaw h.val.val.1).mass b else 0 + +theorem classCounts_cast_eq_pushforward (allocation : Allocation) (side : Fin 3) + (h : ActiveOrder K tick sigma) (k : Fin 17) : + (fun u => (base allocation sigma side (h, k) u : ℝ)) = + fun u => (parentBase allocation h : ℝ) * + pushforwardWeight (maskedBranchMass h side k) (branchShape h.val.val) u := by + have hpmap : (placedLaw h.val.val).mass = + pushforwardWeight (branchLaw h.val.val.1).mass (branchShape h.val.val) := by + funext u + simp only [placedLaw, FiniteLaw.map_mass, pushforwardWeight] + apply Finset.sum_congr rfl + intro b _ + by_cases hb : branchShape h.val.val b = u <;> simp only [hb, ite_true, ite_false] + have hm : (fun u => if JointPopulation.shapeSide (sigma side) u = k + then (placedLaw h.val.val).mass u else 0) = + pushforwardWeight (maskedBranchMass h side k) (branchShape h.val.val) := by + rw [hpmap] + funext u + unfold pushforwardWeight maskedBranchMass + by_cases hu : JointPopulation.shapeSide (sigma side) u = k + · simp only [hu, ite_true] + apply Finset.sum_congr rfl + intro b _ + by_cases hb : branchShape h.val.val b = u + · have hk : nativeSplitWeightCode h.val.val.1 (h.val.val.1.priority side) b = k := by + rw [← order_branch_weight h side b, hb] + exact hu + simp only [hb, hk, ite_true] + · simp only [hb, ite_false] + · simp only [hu, ite_false] + symm + apply Finset.sum_eq_zero + intro b _ + by_cases hb : branchShape h.val.val b = u + · have hk : nativeSplitWeightCode h.val.val.1 (h.val.val.1.priority side) b ≠ k := by + rw [← order_branch_weight h side b, hb] + exact hu + simp only [hb, hk, ite_true, ite_false] + · simp only [hb, ite_false] + funext u + change ((if JointPopulation.shapeSide (sigma side) u = k + then Counts allocation 1 sigma h u else 0 : ℕ) : ℝ) = _ + rw [Nat.cast_ite, Nat.cast_zero] + rw [← hm] + by_cases hu : JointPopulation.shapeSide (sigma side) u = k + · simp only [hu, ite_true] + exact jointCounts_cast allocation 1 h.val.val u + · simp only [hu, ite_false, mul_zero] + +def branchHalfLaw (w : Work K) (right : Bool) (side : Fin 3) + (b : w.Branch) (a : w.Statistic) : ℝ := + (w.childLaw (halfShape w.parentShape (w.splitShape b) right) (w.priority side) a : ℝ) + +theorem class_groupedEntropy_eq_masked (allocation : Allocation) (right : Bool) + (side : Fin 3) (hside : side ≠ 0) (h : ActiveOrder K tick sigma) (k : Fin 17) : + groupedEntropy (fun u => (base allocation sigma side (h, k) u : ℝ)) + (designatedGroup (classDesignated right side sigma (h, k))) + (nativeLaw allocation right side sigma (h, k)) = + (parentBase allocation h : ℝ) * + groupedEntropy (maskedBranchMass h side k) + (designatedGroup (nativeBranchDesignated h.val.val.1 right side)) + (branchHalfLaw h.val.val.1 right side) := by + rw [classCounts_cast_eq_pushforward, groupedEntropy_mul] + congr 1 + apply groupedEntropy_designated_pushforward _ _ (branchShape_injective h.val.val) + _ _ (fun b => designated_branchShape right side h hside b) + intro b hb + have hp : (branchLaw h.val.val.1).mass b ≠ 0 := by + intro hp + apply hb + simp only [maskedBranchMass, hp, ite_self] + exact supportedHalfLaw_branchShape_of_mass_ne_zero allocation right h b hp side + +theorem maskedBranchMass_eq_conditional (h : ActiveOrder K tick sigma) + (side : Fin 3) (k : Fin 17) : + maskedBranchMass h side k = fun b => + ((branchLaw h.val.val.1).map + (nativeSplitWeightCode h.val.val.1 (h.val.val.1.priority side))).mass k * + ((branchLaw h.val.val.1).conditional + (nativeSplitWeightCode h.val.val.1 (h.val.val.1.priority side)) k).mass b := by + funext b + exact ((branchLaw h.val.val.1).map_mass_mul_conditional + (nativeSplitWeightCode h.val.val.1 (h.val.val.1.priority side)) k b).symm + +def branchConditionalCost (w : Work K) (side : Fin 3) : ℝ := + ∑ k : Fin 17, + ((branchLaw w).map (nativeSplitWeightCode w (w.priority side))).mass k * + (groupedEntropy ((branchLaw w).conditional + (nativeSplitWeightCode w (w.priority side)) k).mass + (designatedGroup (nativeBranchDesignated w false side)) (branchHalfLaw w false side) + + groupedEntropy ((branchLaw w).conditional + (nativeSplitWeightCode w (w.priority side)) k).mass + (designatedGroup (nativeBranchDesignated w true side)) (branchHalfLaw w true side)) + +theorem history_projected_entropy_eq (allocation : Allocation) + (side : Fin 3) (hside : side ≠ 0) (h : ActiveOrder K tick sigma) : + (∑ k : Fin 17, + (groupedEntropy (fun u => (base allocation sigma side (h, k) u : ℝ)) + (designatedGroup (classDesignated false side sigma (h, k))) + (nativeLaw allocation false side sigma (h, k)) + + groupedEntropy (fun u => (base allocation sigma side (h, k) u : ℝ)) + (designatedGroup (classDesignated true side sigma (h, k))) + (nativeLaw allocation true side sigma (h, k)))) = + (parentBase allocation h : ℝ) * branchConditionalCost h.val.val.1 side := by + simp_rw [class_groupedEntropy_eq_masked allocation _ side hside, + maskedBranchMass_eq_conditional, groupedEntropy_mul] + simp only [branchConditionalCost, Finset.mul_sum, mul_add] + +theorem branchConditionalCost_eq (w : Work K) (side : Fin 3) (hside : side ≠ 0) : + branchConditionalCost w side = + if w.stage ≠ 2 then + finiteEntropy (nativePairLaw w (w.priority side)).mass - workCapacity w side + else 0 := by + cases w with + | stageA h => + have hs : (Work.stageA h).stage ≠ 2 := by change (0 : Fin 3) ≠ 2; decide + have hl : branchLaw (Work.stageA h) = + AllFieldNativeCapacity.stageASplitLaw (initialShape h.val) h.property := rfl + have hw : nativeSplitWeightCode (Work.stageA h) ((Work.stageA h).priority side) = + AllFieldPairConditionalEntropy.stageASplitWeight (initialShape h.val) h.property side := by + funext b + apply Fin.ext + rfl + have hd (right : Bool) : nativeBranchDesignated (Work.stageA h) right side = + fun b => AllFieldNativeCapacity.designated (Equiv.refl (Fin 3)) side + (halfShape (initialShape h.val) (below (initialShape h.val))[b.val] right) := by + funext b + apply propext + change (_ ∧ _) ↔ _ + exact ⟨fun hh => hh.2, fun hh => ⟨hs, hh⟩⟩ + have hq (right : Bool) : branchHalfLaw (Work.stageA h) right side = + fun b a => (halfLaw + (halfShape (initialShape h.val) (below (initialShape h.val))[b.val] right) + side a : ℝ) := rfl + rw [ite_eq_left hs] + rw [branchConditionalCost, hl, hw] + simp_rw [hd, hq] + exact stageA_twoHalfConditionalCost_eq_entropy_sub_capacity _ h.property side hside + | stageB h => + have hs : (Work.stageB h).stage ≠ 2 := by change (1 : Fin 3) ≠ 2; decide + have hl : branchLaw (Work.stageB h) = + AllFieldNativeCapacity.stageBSplitLaw (aShape h.val) h.property := rfl + have hw : nativeSplitWeightCode (Work.stageB h) ((Work.stageB h).priority side) = + AllFieldPairConditionalEntropy.stageBSplitWeight (aShape h.val) h.property + (stageBPriority (aShape h.val) side) := by + funext b + apply Fin.ext + rfl + have hd (right : Bool) : nativeBranchDesignated (Work.stageB h) right side = + fun b => AllFieldNativeCapacity.designated (stageBPriority (aShape h.val)) side + (halfShape (aShape h.val) (below (aShape h.val))[b.val] right) := by + funext b + apply propext + change (_ ∧ _) ↔ _ + exact ⟨fun hh => hh.2, fun hh => ⟨hs, hh⟩⟩ + have hq (right : Bool) : branchHalfLaw (Work.stageB h) right side = + fun b a => (littleLaw (aShape h.val) + (halfShape (aShape h.val) (below (aShape h.val))[b.val] right) + (stageBPriority (aShape h.val) side) a : ℝ) := rfl + rw [ite_eq_left hs] + rw [branchConditionalCost, hl, hw] + simp_rw [hd, hq] + exact stageB_twoHalfConditionalCost_eq_entropy_sub_capacity _ h.property side hside + | stageC h => + rw [ite_eq_right (show ¬ (Work.stageC h).stage ≠ 2 by simp [Work.stage])] + unfold branchConditionalCost + have hq (right : Bool) : branchHalfLaw (Work.stageC h) right side = + fun _ _ => 1 := by + funext b a + simp only [branchHalfLaw, Work.childLaw, Rat.cast_one] + simp only [hq, groupedEntropy_const_one, zero_add, mul_zero, Finset.sum_const_zero] + +theorem branchConditionalCost_eq_observed (h : ActiveOrder K tick sigma) + (side : Fin 3) (hside : side ≠ 0) : + branchConditionalCost h.val.val.1 side = + observedEntropy h side - workCapacity h.val.val.1 side := by + rw [branchConditionalCost_eq _ side hside] + unfold observedEntropy + by_cases hs : h.val.val.1.stage ≠ 2 + · rw [ite_eq_left hs, ite_eq_left hs] + · rw [ite_eq_right hs, ite_eq_right hs] + have hc : workCapacity h.val.val.1 side = finiteEntropy + (JointPopulationRates.sideMass (orderLaw h).mass (sigma side)) := by + rcases h with ⟨⟨⟨w, phi⟩, ht⟩, ho⟩ + cases w with + | stageA a => exact False.elim (hs (by change (0 : Fin 3) ≠ 2; decide)) + | stageB a => exact False.elim (hs (by change (1 : Fin 3) ≠ 2; decide)) + | stageC a => + have hh := AllFieldActiveCapacity.workCapacity_stageC_physical a phi side + simpa only [ho, orderLaw] using hh + rw [hc, sub_self] + +theorem projected_native_entropy_eq (allocation : Allocation) (sigma : Placement) + (side : Fin 3) (hside : side ≠ 0) : + projectedReferenceEntropy (base (K := K) (tick := tick) allocation sigma side) + (classDesignated false side sigma) + (groupCap (base allocation sigma side) (classDesignated false side sigma) + (nativeLaw allocation false side sigma) 0) + + projectedReferenceEntropy (base (K := K) (tick := tick) allocation sigma side) + (classDesignated true side sigma) + (groupCap (base allocation sigma side) (classDesignated true side sigma) + (nativeLaw allocation true side sigma) 0) = + ∑ h : ActiveOrder K tick sigma, (parentBase allocation h : ℝ) * + (observedEntropy h side - workCapacity h.val.val.1 side) := by + rw [JointProjectedGroupEntropy.projectedReferenceEntropy_eq_sum_counts_groupedEntropy, + JointProjectedGroupEntropy.projectedReferenceEntropy_eq_sum_counts_groupedEntropy, + ← Finset.sum_add_distrib, Fintype.sum_prod_type] + apply Finset.sum_congr rfl + intro h _ + rw [history_projected_entropy_eq allocation side hside, + branchConditionalCost_eq_observed h side hside] + +end MatrixMultiplication.AllFieldGroupProjectedEntropy + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/Entropy/InitialEntropy.lean b/lean/OAI/LinearAlgebra/MatrixFields/Entropy/InitialEntropy.lean new file mode 100644 index 0000000000000000000000000000000000000000..1c6a011bbedc8c22eb994150d7baff2a5166f378 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/Entropy/InitialEntropy.lean @@ -0,0 +1,207 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Parameters.JointOrdinaryPopulationSelection + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +noncomputable section + +namespace MatrixMultiplication.AllFieldInitialEntropy + +open AllFieldParameters AllFieldHistory MatrixMultiplication.Foundation +open JointPopulationRates JointOrdinaryPopulationSelection +open scoped BigOperators + +abbrev PlacedInitial := Fin sortedInitial.length × Placement + +theorem placement_read_card : ∀ s w : Fin 3, + Fintype.card {phi : Placement // phi.symm s = w} = 2 := by + decide +kernel + +theorem sum_placement_read (s : Fin 3) (f : Fin 3 → ℝ) : + (∑ phi : Placement, f (phi.symm s)) = 2 * ∑ w, f w := by + classical + rw [← Fintype.sum_fiberwise' (fun phi : Placement => phi.symm s) f] + simp only [Finset.sum_const, Finset.card_univ, placement_read_card, + nsmul_eq_mul, Nat.cast_ofNat, ← Finset.mul_sum] + +def initialShapeCode (p : PlacedInitial) : JointPopulation.Shape := + rootShape ((0 : Fin 1), p.1) p.2 + +@[simp] theorem initialShapeCode_side (p : PlacedInitial) (s : Fin 3) : + (JointPopulation.shapeSide s (initialShapeCode p)).val = + sortedInitial.get p.1 (p.2.symm s) := by + simp only [initialShapeCode, rootShape, encodePhysicalShape_side, initialShape] + +@[simp] theorem rootShape_eq_initialShapeCode {K : ℕ} (j : Fin K) + (g : Fin sortedInitial.length) (phi : Placement) : + rootShape (j, g) phi = initialShapeCode (g, phi) := rfl + +def placedInitialLaw : FiniteLaw PlacedInitial where + mass p := (initialLaw (sortedInitial.get p.1) : ℝ) / 6 + nonneg p := div_nonneg (by + exact_mod_cast (initialLaw_positive _ (List.get_mem _ _)).le) (by norm_num) + total := by + have hsum : (∑ g : Fin sortedInitial.length, + (initialLaw (sortedInitial.get g) : ℝ)) = 1 := by + exact_mod_cast initial_amount_sum 1 (0 : Fin 1) + rw [Fintype.sum_prod_type] + simp only [Finset.sum_const, Finset.card_univ, + PhysicalOrders.card_physical_orders, nsmul_eq_mul] + calc + _ = ∑ g : Fin sortedInitial.length, + (initialLaw (sortedInitial.get g) : ℝ) := by + apply Finset.sum_congr rfl + intro g _ + ring + _ = 1 := hsum + +def orderedInitialLaw : FiniteLaw JointPopulation.Shape := + placedInitialLaw.map initialShapeCode + +def nativeInitialMarginal (k : Fin 17) : ℝ := + ∑ g : Fin sortedInitial.length, + (initialLaw (sortedInitial.get g) : ℝ) * + (∑ w : Fin 3, if sortedInitial.get g w = k.val then 1 else 0) / 3 + +def nativeH0 : ℝ := homogeneousEntropy nativeInitialMarginal + +theorem nativeInitialMarginal_eq_list (k : Fin 17) : + nativeInitialMarginal k = + (sortedInitial.map (fun g => (initialLaw g : ℝ) * + (∑ w : Fin 3, if g w = k.val then 1 else 0) / 3)).sum := by + unfold nativeInitialMarginal + simpa only [List.get_eq_getElem] using + (Fin.sum_univ_fun_getElem sortedInitial (fun g => (initialLaw g : ℝ) * + (∑ w : Fin 3, if g w = k.val then 1 else 0) / 3)) + +theorem sideMass_orderedInitialLaw (s : Fin 3) (k : Fin 17) : + sideMass orderedInitialLaw.mass s k = + ∑ p : PlacedInitial, + if JointPopulation.shapeSide s (initialShapeCode p) = k + then placedInitialLaw.mass p else 0 := by + classical + unfold sideMass orderedInitialLaw + simp only [FiniteLaw.map_mass] + calc + _ = ∑ u : JointPopulation.Shape, ∑ p : PlacedInitial, + if initialShapeCode p = u then + if JointPopulation.shapeSide s u = k then placedInitialLaw.mass p else 0 + else 0 := by + apply Finset.sum_congr rfl + intro u _ + by_cases hu : JointPopulation.shapeSide s u = k <;> simp [hu] + _ = _ := by rw [Finset.sum_comm]; simp + +theorem orderedInitialLaw_sideMass (s : Fin 3) : + sideMass orderedInitialLaw.mass s = nativeInitialMarginal := by + classical + funext k + rw [sideMass_orderedInitialLaw, Fintype.sum_prod_type] + unfold nativeInitialMarginal + apply Finset.sum_congr rfl + intro g _ + have hside (phi : Placement) : + JointPopulation.shapeSide s (initialShapeCode (g, phi)) = k ↔ + sortedInitial.get g (phi.symm s) = k.val := by + rw [← Fin.val_inj, initialShapeCode_side] + simp only [hside, placedInitialLaw] + calc + _ = ∑ phi : Placement, ((initialLaw (sortedInitial.get g) : ℝ) / 6) * + (if sortedInitial.get g (phi.symm s) = k.val then 1 else 0) := by + apply Finset.sum_congr rfl + intro phi _ + split_ifs <;> ring + _ = ((initialLaw (sortedInitial.get g) : ℝ) / 6) * + (2 * ∑ w : Fin 3, if sortedInitial.get g w = k.val then 1 else 0) := by + rw [← Finset.mul_sum, + sum_placement_read s (fun w : Fin 3 => + if sortedInitial.get g w = k.val then 1 else 0)] + _ = _ := by ring + +theorem nativeInitialMarginal_total : ∑ k, nativeInitialMarginal k = 1 := by + rw [← orderedInitialLaw_sideMass 0, sideMass_total, orderedInitialLaw.total] + +theorem nativeInitialMarginal_nonneg (k : Fin 17) : 0 ≤ nativeInitialMarginal k := by + rw [← orderedInitialLaw_sideMass 0] + simpa only [FiniteLaw.map_mass, sideMass] using + (orderedInitialLaw.map (JointPopulation.shapeSide 0)).nonneg k + +theorem nativeH0_eq_finiteEntropy : nativeH0 = finiteEntropy nativeInitialMarginal := + homogeneousEntropy_normalized _ nativeInitialMarginal_total + +theorem orderedInitialLaw_side_entropy (s : Fin 3) : + finiteEntropy (sideMass orderedInitialLaw.mass s) = nativeH0 := by + rw [orderedInitialLaw_sideMass, nativeH0_eq_finiteEntropy] + +theorem ordinary_capacity_per_lot : + finiteEntropy orderedInitialLaw.mass - + max (finiteEntropy orderedInitialLaw.mass - + finiteEntropy (sideMass orderedInitialLaw.mass 0)) + (max (finiteEntropy orderedInitialLaw.mass - + finiteEntropy (sideMass orderedInitialLaw.mass 1)) + (finiteEntropy orderedInitialLaw.mass - + finiteEntropy (sideMass orderedInitialLaw.mass 2))) = nativeH0 := by + simp only [orderedInitialLaw_side_entropy, max_self] + ring + +theorem ordinary_capacity_all_lots (K : ℕ) : + entropyRate (fun _ : Fin K => 1) (fun _ => orderedInitialLaw) - + degreeRate (fun _ : Fin K => 1) (fun _ => orderedInitialLaw) = + (K : ℝ) * nativeH0 := by + simp only [entropyRate, degreeRate, sideDegreeRate, one_mul, + orderedInitialLaw_side_entropy, Finset.sum_const, Finset.card_univ, + Fintype.card_fin, nsmul_eq_mul, max_self] + ring + +theorem population_cast_real {K : ℕ} (allocation : Allocation) (dilation : ℕ) + (h : History K) : + (population allocation dilation h : ℝ) = + (populationLength (K := K) allocation dilation : ℝ) * + (amount allocation h : ℝ) := by + exact_mod_cast population_cast allocation dilation h + +theorem initialJointCounts_cast {K : ℕ} (allocation : Allocation) (dilation : ℕ) + (j : Fin K) (u : JointPopulation.Shape) : + (initialJointCounts allocation dilation j u : ℝ) = + (populationLength (K := K) allocation dilation : ℝ) * orderedInitialLaw.mass u := by + classical + unfold initialJointCounts shapeCounts orderedInitialLaw + simp only [FiniteLaw.map_mass, Nat.cast_sum, Finset.mul_sum, + rootShape_eq_initialShapeCode] + apply Finset.sum_congr rfl + intro p _ + by_cases hp : initialShapeCode p = u + · simp only [hp, ite_true, population_cast_real, placedInitialLaw] + congr 1 + simp only [amount, canonicalAmount, initialAmount, initialShape, + Rat.cast_div, Rat.cast_ofNat] + · simp [hp] + +theorem initialJointCounts_ratio {K : ℕ} (allocation : Allocation) {dilation : ℕ} + (hd : 0 < dilation) (j : Fin K) (u : JointPopulation.Shape) : + (initialJointCounts allocation dilation j u : ℝ) / + populationLength (K := K) allocation dilation = orderedInitialLaw.mass u := by + classical + rw [initialJointCounts_cast] + have hp : (populationLength (K := K) allocation dilation : ℝ) ≠ 0 := by + exact_mod_cast (ne_of_gt + (AllFieldPopulationCounts.blockLength_pos (amount (K := K) allocation) hd)) + exact mul_div_cancel_left₀ _ hp + +theorem initialJointCounts_sideMass {K : ℕ} (allocation : Allocation) {dilation : ℕ} + (hd : 0 < dilation) (j : Fin K) (s : Fin 3) : + sideMass (fun u => (initialJointCounts allocation dilation j u : ℝ) / + populationLength (K := K) allocation dilation) s = nativeInitialMarginal := by + simp only [initialJointCounts_ratio allocation hd, orderedInitialLaw_sideMass] + +end MatrixMultiplication.AllFieldInitialEntropy + +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/Entropy/InitialLeafRates.lean b/lean/OAI/LinearAlgebra/MatrixFields/Entropy/InitialLeafRates.lean new file mode 100644 index 0000000000000000000000000000000000000000..2a19173b647f0143879db45c5b5f3645977e724f --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/Entropy/InitialLeafRates.lean @@ -0,0 +1,376 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Histories.HistorySums +import OAI.LinearAlgebra.MatrixFields.Tensors.CWWordDimensionParameters + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +namespace MatrixMultiplication.AllFieldParameters + +open MatrixMultiplication.Foundation +open scoped BigOperators + +noncomputable section + +theorem entropy_two_points {A : Type*} [Fintype A] [DecidableEq A] + (a b : A) (hab : a ≠ b) (p q : ℝ) : + finiteEntropy (fun i => if i = a then p else if i = b then q else 0) = + entropyTerm p + entropyTerm q := by + unfold finiteEntropy + calc + _ = ∑ i : A, ((if i = a then entropyTerm p else 0) + + (if i = b then entropyTerm q else 0)) := by + apply Finset.sum_congr rfl + intro i _ + by_cases hi : i = a + · subst i + simp [hab] + · by_cases hj : i = b + · subst i + simp [hab.symm] + · simp [hi, hj] + _ = _ := by simp [Finset.sum_add_distrib] + +theorem weighted_two_points {A : Type*} [Fintype A] [DecidableEq A] + (a b : A) (hab : a ≠ b) (p q : ℝ) (f : A → ℝ) : + (∑ i : A, (if i = a then p else if i = b then q else 0) * f i) = + p * f a + q * f b := by + calc + _ = ∑ i : A, ((if i = a then p * f a else 0) + + (if i = b then q * f b else 0)) := by + apply Finset.sum_congr rfl + intro i _ + by_cases hi : i = a + · subst i + simp [hab] + · by_cases hj : i = b + · subst i + simp [hi] + · simp [hi, hj] + _ = _ := by simp [Finset.sum_add_distrib] + +def statisticRate (d : ℚ) (k : Fin 5) : ℝ := + finiteEntropy (fun i : Fin 6 => (statisticLaw d k i : ℝ)) + + ∑ i : Fin 6, (statisticLaw d k i : ℝ) * Real.log (multiplicity i : ℝ) + +def binaryEntropyRate (d : ℚ) : ℝ := + entropyTerm (1 - (d : ℝ)) + entropyTerm (d : ℝ) + (d : ℝ) * Real.log 2 + +theorem statisticLaw_two_real (d : ℚ) (i : Fin 6) : + (statisticLaw d 2 i : ℝ) = + if i = 2 then 1 - (d : ℝ) else if i = 3 then (d : ℝ) else 0 := by + by_cases hi : i = 2 + · simp [statisticLaw, hi] + · by_cases hj : i = 3 <;> simp [statisticLaw, hi, hj] + +theorem statisticRate_two (d : ℚ) : + statisticRate d 2 = binaryEntropyRate d + 2 * (1 - (d : ℝ)) * Real.log 5 := by + unfold statisticRate + simp_rw [statisticLaw_two_real] + rw [entropy_two_points (2 : Fin 6) 3 (by decide), + weighted_two_points (2 : Fin 6) 3 (by decide)] + have h25 : Real.log (25 : ℝ) = 2 * Real.log 5 := by + have hp : (5 : ℝ) ^ 2 = 25 := by norm_num + rw [← hp, Real.log_pow] + norm_num + change entropyTerm (1 - (d : ℝ)) + entropyTerm (d : ℝ) + + ((1 - (d : ℝ)) * Real.log 25 + (d : ℝ) * Real.log 2) = _ + rw [h25] + unfold binaryEntropyRate + ring + +theorem statisticRate_deterministic (d : ℚ) (k : Fin 5) (hk : k.val ≠ 2) : + statisticRate d k = Real.log (multiplicity (singletonSlot k.val) : ℝ) := by + have hmass (i : Fin 6) : (statisticLaw d k i : ℝ) = + if i = singletonSlot k.val then 1 else 0 := by + by_cases hi : i = singletonSlot k.val <;> simp [statisticLaw, hk, hi] + unfold statisticRate finiteEntropy + simp_rw [hmass] + simp [entropyTerm, apply_ite] + +theorem statisticRate_zero (d : ℚ) : statisticRate d 0 = 0 := by + rw [statisticRate_deterministic d 0 (by decide)] + norm_num [singletonSlot, multiplicity] + +theorem statisticRate_one (d : ℚ) : statisticRate d 1 = Real.log 10 := by + rw [statisticRate_deterministic d 1 (by decide)] + norm_num [singletonSlot, multiplicity] + +theorem statisticRate_three (d : ℚ) : statisticRate d 3 = Real.log 10 := by + rw [statisticRate_deterministic d 3 (by decide)] + change Real.log (10 : ℝ) = Real.log 10 + rfl + +theorem statisticRate_four (d : ℚ) : statisticRate d 4 = 0 := by + rw [statisticRate_deterministic d 4 (by decide)] + have hv : multiplicity (singletonSlot (4 : Fin 5).val) = 1 := by decide +kernel + rw [hv] + norm_num + +end + +end MatrixMultiplication.AllFieldParameters + +noncomputable section + +namespace MatrixMultiplication.AllFieldTerminalRates + +open AllFieldParameters AllFieldHistory +open scoped BigOperators +attribute [local instance] Classical.propDecidable Classical.decEq + +def initialRate (g : Shape) : ℝ := + Real.log (Contractions.coefficients[shapeMax g]?.getD 0 : ℝ) + +def S0 : ℝ := + ((sortedInitial.filter (fun g => !positive g)).map + (fun g => (initialLaw g : ℝ) * initialRate g)).sum + +def S1 : ℝ := + (zeroSecond.map (fun t => (secondMass t : ℝ) * AllFieldZeroLeafRates.fourRate t)).sum + +def secondLeafRate (t u : Shape) : ℝ := + if shapeMax u = 4 then 0 + else if shapeMax u = 3 then Real.log 10 + else if !positive u then + binaryEntropyRate (binaryParameter t u) + + 2 * (1 - (binaryParameter t u : ℝ)) * Real.log 5 + else (2 - (binaryParameter t u : ℝ)) * Real.log 5 + +def S2 : ℝ := + (positiveSecond.map (fun t => + ((below t).map (fun u => (littleMass t u : ℝ) * secondLeafRate t u)).sum)).sum + +def S : ℝ := (S0 + S1) + S2 + +private theorem four_shape_max_lt_five : ∀ u ∈ shapes 4, shapeMax u < 5 := by + decide +kernel + +private theorem four_zero_max : ∀ u ∈ shapes 4, positive u = false → + shapeMax u = 2 ∨ shapeMax u = 3 ∨ shapeMax u = 4 := by + decide +kernel + +private theorem four_positive_max : ∀ u ∈ shapes 4, positive u = true → + shapeMax u = 2 := by + decide +kernel + +theorem second_shapeMax_lt_five (t : Shape) (ht : t ∈ positiveSecond) + (u : Shape) (hu : u ∈ below t) : shapeMax u < 5 := + four_shape_max_lt_five u (stageB_children_size t ht u hu) + +theorem secondLeafRate_zero (t : Shape) (ht : t ∈ positiveSecond) + (u : Shape) (hu : u ∈ below t) (hz : positive u = false) : + secondLeafRate t u = statisticRate (binaryParameter t u) + ⟨shapeMax u, second_shapeMax_lt_five t ht u hu⟩ := by + rcases four_zero_max u (stageB_children_size t ht u hu) hz with h2 | h3 | h4 + · have hk : (⟨shapeMax u, second_shapeMax_lt_five t ht u hu⟩ : Fin 5) = 2 := + Fin.ext h2 + rw [hk, statisticRate_two] + simp [secondLeafRate, h2, hz] + · have hk : (⟨shapeMax u, second_shapeMax_lt_five t ht u hu⟩ : Fin 5) = 3 := + Fin.ext h3 + rw [hk, statisticRate_three] + simp [secondLeafRate, h3] + · have hk : (⟨shapeMax u, second_shapeMax_lt_five t ht u hu⟩ : Fin 5) = 4 := + Fin.ext h4 + rw [hk, statisticRate_four] + simp [secondLeafRate, h4] + +theorem secondLeafRate_positive (t : Shape) (ht : t ∈ positiveSecond) + (u : Shape) (hu : u ∈ below t) (hp : positive u = true) : + secondLeafRate t u = (2 - (binaryParameter t u : ℝ)) * Real.log 5 := by + have hm := four_positive_max u (stageB_children_size t ht u hu) hp + simp [secondLeafRate, hm, hp] + +theorem secondLeafRate_builder_expression (t u : Shape) : + secondLeafRate t u = + if shapeMax u = 4 then 0 + else if shapeMax u = 3 then Real.log 10 + else if !positive u then + (MatrixMultiplication.Foundation.entropyTerm (1 - (binaryParameter t u : ℝ)) + + MatrixMultiplication.Foundation.entropyTerm (binaryParameter t u : ℝ) + + (binaryParameter t u : ℝ) * Real.log 2) + + ((1 - (binaryParameter t u : ℝ)) * 2) * Real.log 5 + else (2 - (binaryParameter t u : ℝ)) * Real.log 5 := by + unfold secondLeafRate + split_ifs <;> try rfl + unfold binaryEntropyRate + ring + +private theorem list_filter_sum_inline_MatrixMultiplication_AllFieldTerminalRateFormulas {A : Type*} (xs : List A) (p : A → Bool) + (f : A → ℝ) : + ((xs.filter p).map f).sum = (xs.map (fun a => if p a then f a else 0)).sum := by + induction xs with + | nil => simp + | cons a xs ih => cases hp : p a <;> simp [hp, ih] + +theorem initial_zero_history_rate (K : ℕ) : + (∑ h : {h : Initial K // initialShape h ∉ positiveInitial}, + (initialAmount h.val : ℝ) * initialRate (initialShape h.val)) = (K : ℝ) * S0 := by + calc + _ = ∑ h : Initial K, if initialShape h ∉ positiveInitial then + (initialAmount h : ℝ) * initialRate (initialShape h) else 0 := by + rw [← Finset.sum_filter] + exact (Finset.sum_subtype + (p := fun h : Initial K => initialShape h ∉ positiveInitial) + (Finset.univ.filter (fun h : Initial K => initialShape h ∉ positiveInitial)) + (by simp) + (fun h : Initial K => (initialAmount h : ℝ) * initialRate (initialShape h))).symm + _ = ∑ h : Initial K, (initialAmount h : ℝ) * + (if initialShape h ∉ positiveInitial then initialRate (initialShape h) else 0) := by + apply Finset.sum_congr rfl + intro h _ + split_ifs <;> simp + _ = _ := by + rw [initial_history_sum K + (fun g => if g ∉ positiveInitial then initialRate g else 0), S0, list_filter_sum_inline_MatrixMultiplication_AllFieldTerminalRateFormulas] + apply congrArg (fun x : ℝ => (K : ℝ) * x) + apply congrArg List.sum + apply List.map_congr_left + intro g hg + cases hp : positive g <;> simp [positiveInitial, hg, hp] + +end MatrixMultiplication.AllFieldTerminalRates + +namespace MatrixMultiplication.AllFieldInitialLeafRates + +open AllFieldHistory AllFieldParameters AllFieldTerminalRates +open CWWindowedLeaves Filter +open scoped BigOperators Topology +attribute [local instance] Classical.propDecidable Classical.decEq + +abbrev InitialZero (K : ℕ) := + {h : Initial K // initialShape h ∉ positiveInitial} + +abbrev PopulationHistory (K : ℕ) := InitialZero K × Placement + +theorem shapeMax_lt {K : ℕ} (h : InitialZero K) : + shapeMax (initialShape h.val) < 17 := by + have hb := (root_shape_spec _ (initialShape_mem h.val)).1 + exact Nat.lt_succ_of_le (max_le (hb 0) (max_le (hb 1) (hb 2))) + +def shapeIndex {K : ℕ} (h : InitialZero K) : Fin 17 := + ⟨shapeMax (initialShape h.val), shapeMax_lt h⟩ + +theorem card_alphabet {K : ℕ} (h : InitialZero K) : + Fintype.card (Alphabet 8 (shapeMax (initialShape h.val))) = + Contractions.coefficients[shapeMax (initialShape h.val)]?.getD 0 := by + have hc := CWWordDimensionParameters.table_eq_card (shapeIndex h) + rw [Fintype.card_eq_nat_card] at hc ⊢ + exact hc.symm + +theorem card_alphabet_pos {K : ℕ} (h : InitialZero K) : + 0 < Fintype.card (Alphabet 8 (shapeMax (initialShape h.val))) := by + have hc := CWWordDimensionParameters.word_card_positive (shapeIndex h) + rw [Fintype.card_eq_nat_card] at hc ⊢ + exact hc + +abbrev Words {K : ℕ} (allocation : Allocation) (dilation : ℕ) + (h : PopulationHistory K) := + Fin (population allocation dilation (.initial h.1.val, h.2)) → + Alphabet 8 (shapeMax (initialShape h.1.val)) + +theorem card_words {K : ℕ} (allocation : Allocation) (dilation : ℕ) + (h : PopulationHistory K) : + Fintype.card (Words allocation dilation h) = + (Contractions.coefficients[shapeMax (initialShape h.1.val)]?.getD 0) ^ + population allocation dilation (.initial h.1.val, h.2) := by + simp only [Words, Fintype.card_fun, Fintype.card_fin, card_alphabet] + +theorem card_words_pos {K : ℕ} (allocation : Allocation) (dilation : ℕ) + (h : PopulationHistory K) : + 0 < Fintype.card (Words allocation dilation h) := by + simp only [Words, Fintype.card_fun, Fintype.card_fin] + exact pow_pos (card_alphabet_pos h.1) _ + +theorem log_card_words {K : ℕ} (allocation : Allocation) (dilation : ℕ) + (h : PopulationHistory K) : + Real.log (Fintype.card (Words allocation dilation h) : ℝ) = + (population allocation dilation (.initial h.1.val, h.2) : ℝ) * + initialRate (initialShape h.1.val) := by + simp only [card_words, Nat.cast_pow, Real.log_pow, initialRate] + +abbrev ProductWords {K : ℕ} (allocation : Allocation) (dilation : ℕ) := + ∀ h : PopulationHistory K, Words allocation dilation h + +def volume {K : ℕ} (allocation : Allocation) (dilation : ℕ) : ℕ := + Fintype.card (ProductWords (K := K) allocation dilation) + +theorem volume_eq_prod {K : ℕ} (allocation : Allocation) (dilation : ℕ) : + volume (K := K) allocation dilation = + ∏ h : PopulationHistory K, Fintype.card (Words allocation dilation h) := by + rw [volume, Fintype.card_pi] + +theorem volume_pos {K : ℕ} (allocation : Allocation) (dilation : ℕ) : + 0 < volume (K := K) allocation dilation := by + rw [volume_eq_prod] + exact Finset.prod_pos (fun h _ => card_words_pos allocation dilation h) + +theorem log_volume {K : ℕ} (allocation : Allocation) (dilation : ℕ) : + Real.log (volume (K := K) allocation dilation : ℝ) = + (populationLength (K := K) allocation dilation : ℝ) * + ∑ h : PopulationHistory K, + (amount allocation (.initial h.1.val, h.2) : ℝ) * + initialRate (initialShape h.1.val) := by + rw [volume_eq_prod, Nat.cast_prod, Real.log_prod + (fun h _ => Nat.cast_ne_zero.mpr + (Nat.ne_of_gt (card_words_pos allocation dilation h)))] + simp only [log_card_words] + rw [Finset.mul_sum] + apply Finset.sum_congr rfl + intro h _ + have hc : (population allocation dilation (.initial h.1.val, h.2) : ℝ) = + (populationLength (K := K) allocation dilation : ℝ) * + (amount allocation (.initial h.1.val, h.2) : ℝ) := by + exact_mod_cast population_cast allocation dilation (.initial h.1.val, h.2) + rw [hc, mul_assoc] + +theorem sum_populationHistory_rate {K : ℕ} (allocation : Allocation) : + (∑ h : PopulationHistory K, + (amount allocation (.initial h.1.val, h.2) : ℝ) * + initialRate (initialShape h.1.val)) = + ∑ h : InitialZero K, + (initialAmount h.val : ℝ) * initialRate (initialShape h.val) := by + rw [Fintype.sum_prod_type] + apply Finset.sum_congr rfl + intro h _ + dsimp only + rw [← Finset.sum_mul] + have hm : (∑ phi : Placement, (amount allocation (.initial h.val, phi) : ℝ)) = + (initialAmount h.val : ℝ) := by + exact_mod_cast sum_placement_amount allocation (.initial h.val) + rw [hm] + +theorem log_volume_eq_S0 {K : ℕ} (allocation : Allocation) (dilation : ℕ) : + Real.log (volume (K := K) allocation dilation : ℝ) = + (populationLength (K := K) allocation dilation : ℝ) * ((K : ℝ) * S0) := by + rw [log_volume, sum_populationHistory_rate, initial_zero_history_rate] + +theorem normalized_log_volume_eq_S0 {K : ℕ} (allocation : Allocation) + (dilation : ℕ) (hd : 0 < dilation) : + Real.log (volume (K := K) allocation dilation : ℝ) / + populationLength (K := K) allocation dilation = (K : ℝ) * S0 := by + rw [log_volume_eq_S0] + have hn : (populationLength (K := K) allocation dilation : ℝ) ≠ 0 := + Nat.cast_ne_zero.mpr + (Nat.ne_of_gt (AllFieldPopulationCounts.blockLength_pos _ hd)) + exact mul_div_cancel_left₀ _ hn + +theorem tendsto_normalized_log_volume {K : ℕ} (allocation : Allocation) : + Tendsto (fun dilation : ℕ => + Real.log (volume (K := K) allocation dilation : ℝ) / + populationLength (K := K) allocation dilation) atTop (𝓝 ((K : ℝ) * S0)) := by + apply tendsto_const_nhds.congr' + filter_upwards [eventually_gt_atTop (0 : ℕ)] with dilation hd + exact (normalized_log_volume_eq_S0 allocation dilation hd).symm + +end MatrixMultiplication.AllFieldInitialLeafRates + +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/Entropy/JointAmbientEntropy.lean b/lean/OAI/LinearAlgebra/MatrixFields/Entropy/JointAmbientEntropy.lean new file mode 100644 index 0000000000000000000000000000000000000000..ccd776d7550674c8b9f3c5d97d85de3fdee694f9 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/Entropy/JointAmbientEntropy.lean @@ -0,0 +1,295 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Construction.JointGibbsApproximation +import OAI.LinearAlgebra.MatrixFields.Construction.JointMarginalSupport + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +noncomputable section + +open scoped BigOperators Topology +open Filter MatrixMultiplication.Foundation +open MatrixMultiplication.JointPopulation MatrixMultiplication.JointAmbientDegree +open MatrixMultiplication.JointGibbsApproximation + +namespace MatrixMultiplication.JointAmbientEntropy + +section Empirical + +variable {I A B : Type*} [Fintype I] + [Fintype A] [DecidableEq A] [Fintype B] [DecidableEq B] + +def empiricalFiniteLaw (w : I → A) (hpos : 0 < Fintype.card I) : FiniteLaw A where + mass a := (wordPopulation w a : ℝ) / Fintype.card I + nonneg a := div_nonneg (Nat.cast_nonneg _) (Nat.cast_nonneg _) + total := by + rw [← Finset.sum_div, ← Nat.cast_sum, wordPopulation_sum] + exact div_self (Nat.cast_ne_zero.mpr (Nat.ne_of_gt hpos)) + +@[simp] theorem empiricalFiniteLaw_mass (w : I → A) (hpos : 0 < Fintype.card I) (a : A) : + (empiricalFiniteLaw w hpos).mass a = + (wordPopulation w a : ℝ) / Fintype.card I := rfl + +theorem empiricalFiniteLaw_map_mass (w : I → A) (hpos : 0 < Fintype.card I) + (f : A → B) (b : B) : + ((empiricalFiniteLaw w hpos).map f).mass b = + (wordPopulation (f ∘ w) b : ℝ) / Fintype.card I := by + rw [FiniteLaw.map_mass, InheritedMasks.wordPopulation_statistic, + Nat.cast_sum, Finset.sum_div, Finset.sum_filter] + simp only [empiricalFiniteLaw_mass] + +theorem empiricalFiniteLaw_supported (w : I → A) (hpos : 0 < Fintype.card I) + (p : FiniteLaw A) (hsupport : ∀ i, 0 < p.mass (w i)) : + ∀ a, p.mass a = 0 → (empiricalFiniteLaw w hpos).mass a = 0 := by + intro a ha + have : IsEmpty {i : I // w i = a} := ⟨fun i => by + have hp := hsupport i.val + rw [i.property, ha] at hp + exact lt_irrefl 0 hp⟩ + simp only [empiricalFiniteLaw_mass, wordPopulation, Fintype.card_of_isEmpty, + Nat.cast_zero, zero_div] + +end Empirical + +variable {H : Type*} + +def canonicalLaw (counts : H → Shape → ℕ) (h : H) : FiniteLaw Shape := + if hpos : 0 < Fintype.card (Positions counts h) then + empiricalFiniteLaw ((canonicalTarget counts) h).val hpos + else FiniteLaw.pure (0, 0, 0) + +theorem canonicalLaw_mass_of_pos (counts : H → Shape → ℕ) (h : H) + (hpos : 0 < Fintype.card (Positions counts h)) (a : Shape) : + (canonicalLaw counts h).mass a = + (counts h a : ℝ) / Fintype.card (Positions counts h) := by + rw [canonicalLaw, dite_eq_left hpos, empiricalFiniteLaw_mass, + ((canonicalTarget counts) h).property] + +theorem total_mul_canonicalLaw_mass (counts : H → Shape → ℕ) (h : H) (a : Shape) : + (Fintype.card (Positions counts h) : ℝ) * (canonicalLaw counts h).mass a = + counts h a := by + by_cases hpos : 0 < Fintype.card (Positions counts h) + · rw [canonicalLaw_mass_of_pos counts h hpos] + exact mul_div_cancel₀ _ (Nat.cast_ne_zero.mpr (Nat.ne_of_gt hpos)) + · have hzero : Fintype.card (Positions counts h) = 0 := Nat.eq_zero_of_not_pos hpos + have hsum : ∑ a, counts h a = 0 := by simpa only [Positions, Fintype.card_fin] using hzero + have ha : counts h a = 0 := by + have hle : counts h a ≤ ∑ b, counts h b := + Finset.single_le_sum (fun _ _ => Nat.zero_le _) (Finset.mem_univ a) + rw [hsum] at hle + exact Nat.eq_zero_of_le_zero hle + simp only [hzero, ha, Nat.cast_zero, zero_mul] + +theorem localAllowed_marginal_eq (counts : H → Shape → ℕ) (sum : H → ℕ) + (h : H) (w : Positions counts h → Shape) + (hpos : 0 < Fintype.card (Positions counts h)) + (hw : localAllowed counts sum h w) (s : Fin 3) : + ((empiricalFiniteLaw w hpos).map (shapeSide s)).mass = + ((canonicalLaw counts h).map (shapeSide s)).mass := by + rw [canonicalLaw, dite_eq_left hpos] + funext a + rw [empiricalFiniteLaw_map_mass, empiricalFiniteLaw_map_mass] + exact congrArg (fun n : ℕ => (n : ℝ) / Fintype.card (Positions counts h)) (hw.2 s a) + +def gibbsCap (counts : H → Shape → ℕ) (h : H) (p : FiniteLaw Shape) + (u v w : Fin 17 → ℝ) : ℝ := + finiteEntropy p.mass + marginalError p (canonicalLaw counts h) (shapeSide 0) u + + marginalError p (canonicalLaw counts h) (shapeSide 1) v + + marginalError p (canonicalLaw counts h) (shapeSide 2) w + +theorem gibbsCap_nonneg (counts : H → Shape → ℕ) (h : H) (p : FiniteLaw Shape) + (u v w : Fin 17 → ℝ) : 0 ≤ gibbsCap counts h p u v w := by + exact add_nonneg + (add_nonneg (add_nonneg p.entropy_nonneg (marginalError_nonneg _ _ _ _)) + (marginalError_nonneg _ _ _ _)) (marginalError_nonneg _ _ _ _) + +theorem localAllowed_entropy_le_of_word_support (counts : H → Shape → ℕ) (sum : H → ℕ) + (h : H) (w : Positions counts h → Shape) (p : FiniteLaw Shape) + (u v z : Fin 17 → ℝ) (c : ℝ) + (hsupport : ∀ i, 0 < p.mass (w i)) + (hlog : ∀ a, 0 < p.mass a → Real.log (p.mass a) = + u (shapeSide 0 a) + v (shapeSide 1 a) + z (shapeSide 2 a) - c) + (hw : localAllowed counts sum h w) : + finiteEntropy (fun a => (wordPopulation w a : ℝ) / + Fintype.card (Positions counts h)) ≤ gibbsCap counts h p u v z := by + by_cases hpos : 0 < Fintype.card (Positions counts h) + · have hs := empiricalFiniteLaw_supported w hpos p hsupport + have hg := entropy_le_of_marginal_errors_of_support p (empiricalFiniteLaw w hpos) + (shapeSide 0) (shapeSide 1) (shapeSide 2) u v z c hs hlog + have hx := localAllowed_marginal_eq counts sum h w hpos hw (0 : Fin 3) + have hy := localAllowed_marginal_eq counts sum h w hpos hw (1 : Fin 3) + have hz := localAllowed_marginal_eq counts sum h w hpos hw (2 : Fin 3) + change finiteEntropy (fun a => (wordPopulation w a : ℝ) / + Fintype.card (Positions counts h)) ≤ _ at hg + simpa only [gibbsCap, marginalError, hx, hy, hz] using hg + · have hzero : Fintype.card (Positions counts h) = 0 := Nat.eq_zero_of_not_pos hpos + simpa only [hzero, Nat.cast_zero, div_zero, finiteEntropy, entropyTerm_zero, + Finset.sum_const_zero] using gibbsCap_nonneg counts h p u v z + +theorem localAllowed_entropy_le (counts : H → Shape → ℕ) (sum : H → ℕ) + (h : H) (w : Positions counts h → Shape) (p : FiniteLaw Shape) + (u v z : Fin 17 → ℝ) (c : ℝ) + (hsupport : ∀ a : Shape, a.1.val + a.2.1.val + a.2.2.val = sum h → 0 < p.mass a) + (hlog : ∀ a, 0 < p.mass a → Real.log (p.mass a) = + u (shapeSide 0 a) + v (shapeSide 1 a) + z (shapeSide 2 a) - c) + (hw : localAllowed counts sum h w) : + finiteEntropy (fun a => (wordPopulation w a : ℝ) / + Fintype.card (Positions counts h)) ≤ gibbsCap counts h p u v z := + localAllowed_entropy_le_of_word_support counts sum h w p u v z c + (fun i => hsupport (w i) (hw.1 i)) hlog hw + +section + +variable [Fintype H] [DecidableEq H] + +theorem sharedAmbient_card_le_of_supported_gibbs (counts : H → Shape → ℕ) (sum : H → ℕ) + (s : Fin 3) (e : JointCoarseHashing.Triple (Position counts)) + (p : H → FiniteLaw Shape) (u v w : H → Fin 17 → ℝ) (c : H → ℝ) + (hsupport : ∀ h word, localAllowed counts sum h word → ∀ i, 0 < (p h).mass (word i)) + (hlog : ∀ h a, 0 < (p h).mass a → Real.log ((p h).mass a) = + u h (shapeSide 0 a) + v h (shapeSide 1 a) + w h (shapeSide 2 a) - c h) : + ((sharedAmbient counts sum s e).card : ℝ) ≤ + ∏ h, classBound counts s e h (gibbsCap counts h (p h) (u h) (v h) (w h)) := + sharedAmbient_card_le counts sum s e _ + (fun h word hw => localAllowed_entropy_le_of_word_support counts sum h word (p h) + (u h) (v h) (w h) (c h) (hsupport h word hw) (hlog h) hw) + +theorem neighbors_card_le_of_supported_gibbs (counts : H → Shape → ℕ) (sum : H → ℕ) + (e : JointCoarseHashing.Triple (Position counts)) + (p : H → FiniteLaw Shape) (u v w : H → Fin 17 → ℝ) (c : H → ℝ) + (hsupport : ∀ h word, localAllowed counts sum h word → ∀ i, 0 < (p h).mass (word i)) + (hlog : ∀ h a, 0 < (p h).mass a → Real.log ((p h).mass a) = + u h (shapeSide 0 a) + v h (shapeSide 1 a) + w h (shapeSide 2 a) - c h) : + ((neighbors counts sum e).card : ℝ) ≤ + ∑ s : Fin 3, ∏ h, classBound counts s e h + (gibbsCap counts h (p h) (u h) (v h) (w h)) := + neighbors_card_le counts sum e _ + (fun h word hw => localAllowed_entropy_le_of_word_support counts sum h word (p h) + (u h) (v h) (w h) (c h) (hsupport h word hw) (hlog h) hw) + +theorem sharedAmbient_card_le_of_gibbs (counts : H → Shape → ℕ) (sum : H → ℕ) + (s : Fin 3) (e : JointCoarseHashing.Triple (Position counts)) + (p : H → FiniteLaw Shape) (u v w : H → Fin 17 → ℝ) (c : H → ℝ) + (hsupport : ∀ h (a : Shape), a.1.val + a.2.1.val + a.2.2.val = sum h → 0 < (p h).mass a) + (hlog : ∀ h a, 0 < (p h).mass a → Real.log ((p h).mass a) = + u h (shapeSide 0 a) + v h (shapeSide 1 a) + w h (shapeSide 2 a) - c h) : + ((sharedAmbient counts sum s e).card : ℝ) ≤ + ∏ h, classBound counts s e h (gibbsCap counts h (p h) (u h) (v h) (w h)) := + sharedAmbient_card_le counts sum s e _ + (fun h word hw => localAllowed_entropy_le counts sum h word (p h) + (u h) (v h) (w h) (c h) (hsupport h) (hlog h) hw) + +theorem neighbors_card_le_of_gibbs (counts : H → Shape → ℕ) (sum : H → ℕ) + (e : JointCoarseHashing.Triple (Position counts)) + (p : H → FiniteLaw Shape) (u v w : H → Fin 17 → ℝ) (c : H → ℝ) + (hsupport : ∀ h (a : Shape), a.1.val + a.2.1.val + a.2.2.val = sum h → 0 < (p h).mass a) + (hlog : ∀ h a, 0 < (p h).mass a → Real.log ((p h).mass a) = + u h (shapeSide 0 a) + v h (shapeSide 1 a) + w h (shapeSide 2 a) - c h) : + ((neighbors counts sum e).card : ℝ) ≤ + ∑ s : Fin 3, ∏ h, classBound counts s e h + (gibbsCap counts h (p h) (u h) (v h) (w h)) := + neighbors_card_le counts sum e _ + (fun h word hw => localAllowed_entropy_le counts sum h word (p h) + (u h) (v h) (w h) (c h) (hsupport h) (hlog h) hw) + +end + +def classScale (counts : H → Shape → ℕ) (h : H) (N : ℕ) : ℝ := + (Fintype.card (Positions counts h) : ℝ) / N + +theorem classScale_nonneg (counts : H → Shape → ℕ) (h : H) (N : ℕ) : + 0 ≤ classScale counts h N := div_nonneg (Nat.cast_nonneg _) (Nat.cast_nonneg _) + +theorem classScale_mul_canonicalLaw_mass (counts : H → Shape → ℕ) (h : H) + (N : ℕ) (a : Shape) : + classScale counts h N * (canonicalLaw counts h).mass a = (counts h a : ℝ) / N := by + unfold classScale + calc + _ = ((Fintype.card (Positions counts h) : ℝ) * (canonicalLaw counts h).mass a) / N := by ring + _ = _ := by rw [total_mul_canonicalLaw_mass] + +theorem classScale_mul_canonicalLaw_map_mass {B : Type*} [Fintype B] [DecidableEq B] + (counts : H → Shape → ℕ) (h : H) (N : ℕ) (f : Shape → B) (b : B) : + classScale counts h N * ((canonicalLaw counts h).map f).mass b = + ∑ a, if f a = b then (counts h a : ℝ) / N else 0 := by + rw [FiniteLaw.map_mass, Finset.mul_sum] + apply Finset.sum_congr rfl + intro a _ + by_cases ha : f a = b + · simp only [ha, ite_true] + exact classScale_mul_canonicalLaw_mass counts h N a + · simp only [ha, ite_false, mul_zero] + +theorem classScale_mul_marginalError {B : Type*} [Fintype B] [DecidableEq B] + (counts : H → Shape → ℕ) (h : H) (N : ℕ) (p : FiniteLaw Shape) + (f : Shape → B) (v : B → ℝ) : + classScale counts h N * marginalError p (canonicalLaw counts h) f v = + ∑ b, |(∑ a, if f a = b then (counts h a : ℝ) / N else 0) - + classScale counts h N * (p.map f).mass b| * |v b| := by + unfold marginalError + rw [Finset.mul_sum] + apply Finset.sum_congr rfl + intro b _ + have habs : classScale counts h N * + |((canonicalLaw counts h).map f).mass b - (p.map f).mass b| = + |classScale counts h N * ((canonicalLaw counts h).map f).mass b - + classScale counts h N * (p.map f).mass b| := by + rw [← mul_sub, abs_mul, abs_of_nonneg (classScale_nonneg counts h N)] + rw [← mul_assoc, habs, classScale_mul_canonicalLaw_map_mass] + +theorem tendsto_classScale (counts : ℕ → H → Shape → ℕ) (h : H) + (p : FiniteLaw Shape) (mass : ℝ) + (hcounts : ∀ a, Tendsto (fun N => (counts N h a : ℝ) / N) atTop (𝓝 (mass * p.mass a))) : + Tendsto (fun N => classScale (counts N) h N) atTop (𝓝 mass) := by + have hsum := tendsto_finsetSum Finset.univ (fun a _ => hcounts a) + simpa only [classScale, Positions, Fintype.card_fin, Nat.cast_sum, + Finset.sum_div, ← Finset.mul_sum, p.total, mul_one] using hsum + +theorem tendsto_classScale_mul_marginalError {B : Type*} [Fintype B] [DecidableEq B] + (counts : ℕ → H → Shape → ℕ) (h : H) (p : FiniteLaw Shape) + (mass : ℝ) (f : Shape → B) (v : B → ℝ) + (hcounts : ∀ a, Tendsto (fun N => (counts N h a : ℝ) / N) atTop (𝓝 (mass * p.mass a))) : + Tendsto (fun N => classScale (counts N) h N * + marginalError p (canonicalLaw (counts N) h) f v) atTop (𝓝 0) := by + have htotal := tendsto_classScale counts h p mass hcounts + have hside (b : B) : + Tendsto (fun N => ∑ a, if f a = b then (counts N h a : ℝ) / N else 0) + atTop (𝓝 (mass * (p.map f).mass b)) := by + have hterm (a : Shape) : + Tendsto (fun N => if f a = b then (counts N h a : ℝ) / N else 0) + atTop (𝓝 (if f a = b then mass * p.mass a else 0)) := by + by_cases ha : f a = b + · simpa only [ha, ite_true] using hcounts a + · simp only [ha, ite_false] + exact tendsto_const_nhds + simpa only [FiniteLaw.map_mass, Finset.mul_sum, mul_ite, mul_zero] using + tendsto_finsetSum Finset.univ (fun a _ => hterm a) + have hterm (b : B) : + Tendsto (fun N => |(∑ a, if f a = b then (counts N h a : ℝ) / N else 0) - + classScale (counts N) h N * (p.map f).mass b| * |v b|) atTop (𝓝 0) := by + simpa only [sub_self, abs_zero, zero_mul] using + ((hside b).sub (htotal.mul_const ((p.map f).mass b))).abs.mul_const |v b| + simpa only [classScale_mul_marginalError, Finset.sum_const_zero] using + tendsto_finsetSum Finset.univ (fun b _ => hterm b) + +theorem tendsto_classScale_mul_gibbsCap (counts : ℕ → H → Shape → ℕ) (h : H) + (p : FiniteLaw Shape) (mass : ℝ) (u v w : Fin 17 → ℝ) + (hcounts : ∀ a, Tendsto (fun N => (counts N h a : ℝ) / N) atTop (𝓝 (mass * p.mass a))) : + Tendsto (fun N => classScale (counts N) h N * + gibbsCap (counts N) h p u v w) atTop (𝓝 (mass * finiteEntropy p.mass)) := by + have hm := (tendsto_classScale counts h p mass hcounts).mul_const (finiteEntropy p.mass) + have hx := tendsto_classScale_mul_marginalError counts h p mass (shapeSide 0) u hcounts + have hy := tendsto_classScale_mul_marginalError counts h p mass (shapeSide 1) v hcounts + have hz := tendsto_classScale_mul_marginalError counts h p mass (shapeSide 2) w hcounts + simpa only [gibbsCap, mul_add, add_zero] using ((hm.add hx).add hy).add hz + +end MatrixMultiplication.JointAmbientEntropy + +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/Entropy/JointAmbientRateLimit.lean b/lean/OAI/LinearAlgebra/MatrixFields/Entropy/JointAmbientRateLimit.lean new file mode 100644 index 0000000000000000000000000000000000000000..afdb7458354c1d9b181031c069a45bebc08fd191 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/Entropy/JointAmbientRateLimit.lean @@ -0,0 +1,151 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Construction.JointMarginalSupport + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section + +namespace MatrixMultiplication.JointAmbientRateLimit + +open MatrixMultiplication.Foundation JointPopulation JointAmbientDegree Filter +open scoped BigOperators Topology + +attribute [local instance] Classical.propDecidable + +theorem tendsto_log_succ_div_nat_of_ratio {n : ℕ → ℕ} {mass : ℝ} + (hsize : Tendsto (fun N => (n N : ℝ) / (N : ℝ)) atTop (𝓝 mass)) : + Tendsto (fun N => Real.log (n N + 1 : ℕ) / (N : ℝ)) atTop (𝓝 0) := by + let C : ℝ := |mass| + 2 + have hC : 0 < C := by dsimp [C]; positivity + have hmC : mass < C := by dsimp [C]; linarith [le_abs_self mass] + have hlog : Tendsto (fun N : ℕ => Real.log (N : ℝ) / (N : ℝ)) atTop (𝓝 0) := by + simpa only [Function.comp_def, id_eq] using + Real.isLittleO_log_id_atTop.tendsto_div_nhds_zero.comp tendsto_natCast_atTop_atTop + have hc : Tendsto (fun N : ℕ => Real.log (C + 1) / (N : ℝ)) atTop (𝓝 0) := + tendsto_const_nhds.div_atTop tendsto_natCast_atTop_atTop + have hu : Tendsto (fun N : ℕ => + (Real.log (C + 1) + Real.log (N : ℝ)) / (N : ℝ)) atTop (𝓝 0) := by + simpa only [add_div, add_zero] using hc.add hlog + apply tendsto_of_tendsto_of_tendsto_of_le_of_le' tendsto_const_nhds hu + · exact Eventually.of_forall fun N => + div_nonneg (Real.log_nonneg (by exact_mod_cast Nat.succ_le_succ (Nat.zero_le (n N)))) + (Nat.cast_nonneg _) + · filter_upwards [(tendsto_order.1 hsize).2 C hmC, + eventually_ge_atTop (1 : ℕ)] with N hn hN + have hNr : (1 : ℝ) ≤ N := by exact_mod_cast hN + have hNp : (0 : ℝ) < N := lt_of_lt_of_le zero_lt_one hNr + have hsizeN := (div_lt_iff₀ hNp).mp hn + have hbound : (n N + 1 : ℕ) ≤ (C + 1) * (N : ℝ) := by + push_cast + nlinarith + have hl := Real.log_le_log (by positivity : (0 : ℝ) < (n N + 1 : ℕ)) hbound + rw [Real.log_mul (by positivity : C + 1 ≠ 0) hNp.ne'] at hl + exact div_le_div_of_nonneg_right hl hNp.le + +variable {H : Type*} [Fintype H] [DecidableEq H] + +omit [Fintype H] [DecidableEq H] in +theorem tendsto_classExponent_div_nat + (counts : ℕ → H → Shape → ℕ) (s : Fin 3) (h : H) + (cap : ℕ → ℝ) (mass capRate marginalRate : ℝ) + (hsize : Tendsto (fun N => (∑ a, counts N h a : ℕ) / (N : ℝ)) + atTop (𝓝 mass)) + (hcap : Tendsto (fun N => ((∑ a, counts N h a : ℕ) / (N : ℝ)) * cap N) + atTop (𝓝 capRate)) + (hmarginal : Tendsto (fun N => + ((∑ a, counts N h a : ℕ) / (N : ℝ)) * + finiteEntropy (fun a => (wordPopulation + (sideWord (counts N) s (triple (counts N) (canonicalTarget (counts N))) h) a : ℝ) / + Fintype.card (Positions (counts N) h))) atTop (𝓝 marginalRate)) : + Tendsto (fun N => + classExponent (counts N) s (triple (counts N) (canonicalTarget (counts N))) h (cap N) / + (N : ℝ)) atTop (𝓝 (capRate - marginalRate)) := by + let A : ℝ := (Fintype.card Shape : ℝ) + (Fintype.card (Fin 17) : ℝ) + 2 + have hlog := tendsto_log_succ_div_nat_of_ratio hsize + have hinv : Tendsto (fun N : ℕ => (1 : ℝ) / N) atTop (𝓝 0) := + tendsto_const_nhds.div_atTop tendsto_natCast_atTop_atTop + have htotal := (hcap.sub hmarginal).add + (((hinv.add hlog).const_mul A).add (hlog.const_mul (Fintype.card Shape : ℝ))) + simp only [add_zero, mul_zero] at htotal + convert htotal using 1 + ext N + dsimp only [classExponent, A, Positions] + simp only [Fintype.card_fin, div_eq_mul_inv] + ring + +omit [DecidableEq H] in +theorem tendsto_sum_classExponent_div_nat + (counts : ℕ → H → Shape → ℕ) (s : Fin 3) + (cap : ℕ → H → ℝ) (mass capRate marginalRate : H → ℝ) + (hsize : ∀ h, Tendsto (fun N => (∑ a, counts N h a : ℕ) / (N : ℝ)) + atTop (𝓝 (mass h))) + (hcap : ∀ h, Tendsto (fun N => ((∑ a, counts N h a : ℕ) / (N : ℝ)) * cap N h) + atTop (𝓝 (capRate h))) + (hmarginal : ∀ h, Tendsto (fun N => + ((∑ a, counts N h a : ℕ) / (N : ℝ)) * + finiteEntropy (fun a => (wordPopulation + (sideWord (counts N) s (triple (counts N) (canonicalTarget (counts N))) h) a : ℝ) / + Fintype.card (Positions (counts N) h))) atTop (𝓝 (marginalRate h))) : + Tendsto (fun N => (∑ h, + classExponent (counts N) s (triple (counts N) (canonicalTarget (counts N))) h (cap N h)) / + (N : ℝ)) atTop (𝓝 (∑ h, (capRate h - marginalRate h))) := by + have hs := tendsto_finsetSum Finset.univ (fun h _ => + tendsto_classExponent_div_nat counts s h (fun N => cap N h) + (mass h) (capRate h) (marginalRate h) (hsize h) (hcap h) (hmarginal h)) + simpa only [Finset.sum_div] using hs + +theorem eventually_all_target_degree_upper + (counts : ℕ → H → Shape → ℕ) (sum : H → ℕ) + (cap : ℕ → H → ℝ) (sideRate : Fin 3 → ℝ) (D : ℝ) (hD : 0 ≤ D) + (hentropy : ∀ᶠ N in atTop, ∀ h w, localAllowed (counts N) sum h w → + finiteEntropy (fun a => (wordPopulation w a : ℝ) / + Fintype.card (Positions (counts N) h)) ≤ cap N h) + (hrate : ∀ s, Tendsto (fun N => (∑ h, + classExponent (counts N) s (triple (counts N) (canonicalTarget (counts N))) h (cap N h)) / + (N : ℝ)) atTop (𝓝 (sideRate s))) + (hside : ∀ s, sideRate s ≤ D) (η : ℝ) (hη : 0 < η) : + ∀ᶠ N in atTop, ∀ e : Target (counts N), + Real.log ((neighbors (counts N) sum (triple (counts N) e)).card : ℝ) / (N : ℝ) ≤ + D + η := by + have hs : ∀ᶠ N in atTop, ∀ s : Fin 3, + (∑ h, classExponent (counts N) s + (triple (counts N) (canonicalTarget (counts N))) h (cap N h)) / (N : ℝ) ≤ + D + η / 2 := by + rw [Filter.eventually_all] + intro s + filter_upwards [(tendsto_order.1 (hrate s)).2 (sideRate s + η / 2) (by linarith)] + with N hN + linarith [hside s] + have hc : Tendsto (fun N : ℕ => Real.log 3 / (N : ℝ)) atTop (𝓝 0) := + tendsto_const_nhds.div_atTop tendsto_natCast_atTop_atTop + filter_upwards [hentropy, hs, (tendsto_order.1 hc).2 (η / 2) (by linarith), + eventually_ge_atTop (1 : ℕ)] with N he hs hc hN + intro e + by_cases hz : (neighbors (counts N) sum (triple (counts N) e)).card = 0 + · simp only [hz, Nat.cast_zero, Real.log_zero, zero_div] + linarith + have hNp : (0 : ℝ) < N := by exact_mod_cast hN + have hupper (s : Fin 3) : + (∑ h, classExponent (counts N) s (triple (counts N) e) h (cap N h)) ≤ + (N : ℝ) * (D + η / 2) := by + simp_rw [classExponent_target_eq] + simpa only [mul_comm] using (div_le_iff₀ hNp).mp (hs s) + have hb := div_le_div_of_nonneg_right + (log_neighbors_card_le (counts N) sum (triple (counts N) e) (cap N) he + ((N : ℝ) * (D + η / 2)) hupper (Nat.pos_of_ne_zero hz)) hNp.le + rw [add_div, mul_div_cancel_left₀ _ hNp.ne'] at hb + linarith + +end MatrixMultiplication.JointAmbientRateLimit + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/Entropy/JointCompatibilityEntropyBound.lean b/lean/OAI/LinearAlgebra/MatrixFields/Entropy/JointCompatibilityEntropyBound.lean new file mode 100644 index 0000000000000000000000000000000000000000..3aedfc9b41cf31ae580ae207fa4069e8849e2297 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/Entropy/JointCompatibilityEntropyBound.lean @@ -0,0 +1,227 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Construction.JointCompatibilityIncidence + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section + +open MatrixMultiplication.Foundation +open MatrixMultiplication.JointTypeCounts MatrixMultiplication.JointCompatibilityIncidence +open scoped BigOperators + +namespace MatrixMultiplication.JointCompatibilityEntropyBound + +attribute [local instance] Classical.propDecidable + +section ClassCounts + +variable {C : Type*} [Fintype C] [DecidableEq C] +variable (Pos A : C → Type*) + [∀ c, Fintype (Pos c)] [∀ c, DecidableEq (Pos c)] + [∀ c, Fintype (A c)] [∀ c, DecidableEq (A c)] + +def classEntropy (counts : ∀ c, A c → ℕ) : ℝ := + ∑ c, (Fintype.card (Pos c) : ℝ) * + finiteEntropy (fun a => (counts c a : ℝ) / Fintype.card (Pos c)) + +def classTypeError : ℝ := + ∑ c, ((Fintype.card (A c) : ℝ) + 1) * + (1 + Real.log (Fintype.card (Pos c) + 1 : ℕ)) + +omit [Fintype C] [DecidableEq C] [∀ c, DecidableEq (Pos c)] in +theorem fixedClassWords_size (counts : ∀ c, A c → ℕ) + (w : FixedClassWords Pos A counts) (c : C) : + Fintype.card (Pos c) = ∑ a, counts c a := by + calc + Fintype.card (Pos c) = ∑ a, wordPopulation (w c).val a := + (wordPopulation_sum (w c).val).symm + _ = ∑ a, counts c a := Finset.sum_congr rfl fun a _ => (w c).property a + +theorem abs_log_card_sub_classEntropy_le (counts : ∀ c, A c → ℕ) + (w : FixedClassWords Pos A counts) : + |Real.log (Fintype.card (FixedClassWords Pos A counts) : ℝ) - + classEntropy Pos A counts| ≤ classTypeError Pos A := by + have hsize := fixedClassWords_size Pos A counts w + simpa only [classEntropy, classTypeError, ← hsize] using + abs_log_fixedClassWords_card_sub_entropy_le Pos A counts hsize + +theorem fixedClassWords_card_le_exp (counts : ∀ c, A c → ℕ) + (w : FixedClassWords Pos A counts) : + (Fintype.card (FixedClassWords Pos A counts) : ℝ) ≤ + Real.exp (classEntropy Pos A counts + classTypeError Pos A) := by + have hpos : 0 < (Fintype.card (FixedClassWords Pos A counts) : ℝ) := by + exact_mod_cast (Fintype.card_pos_iff.mpr ⟨w⟩) + have h := (abs_le.mp (abs_log_card_sub_classEntropy_le Pos A counts w)).2 + calc + (Fintype.card (FixedClassWords Pos A counts) : ℝ) = + Real.exp (Real.log (Fintype.card (FixedClassWords Pos A counts) : ℝ)) := + (Real.exp_log hpos).symm + _ ≤ Real.exp (classEntropy Pos A counts + classTypeError Pos A) := + Real.exp_le_exp.mpr (by linarith) + +theorem exp_le_fixedClassWords_card (counts : ∀ c, A c → ℕ) + (w : FixedClassWords Pos A counts) : + Real.exp (classEntropy Pos A counts - classTypeError Pos A) ≤ + (Fintype.card (FixedClassWords Pos A counts) : ℝ) := by + have hpos : 0 < (Fintype.card (FixedClassWords Pos A counts) : ℝ) := by + exact_mod_cast (Fintype.card_pos_iff.mpr ⟨w⟩) + have h := (abs_le.mp (abs_log_card_sub_classEntropy_le Pos A counts w)).1 + calc + Real.exp (classEntropy Pos A counts - classTypeError Pos A) ≤ + Real.exp (Real.log (Fintype.card (FixedClassWords Pos A counts) : ℝ)) := + Real.exp_le_exp.mpr (by linarith) + _ = (Fintype.card (FixedClassWords Pos A counts) : ℝ) := Real.exp_log hpos + +end ClassCounts + +section GroupCounts + +def wordTypeError (I A : Type*) [Fintype I] [Fintype A] : ℝ := + ((Fintype.card A : ℝ) + 1) * (1 + Real.log (Fintype.card I + 1 : ℕ)) + + (Fintype.card A : ℝ) * Real.log (Fintype.card I + 1 : ℕ) + +theorem wordEntropyBound_eq_exp (I A : Type*) [Fintype I] [Fintype A] (H : ℝ) : + wordEntropyBound I A H = + Real.exp ((Fintype.card I : ℝ) * H + wordTypeError I A) := by + unfold wordEntropyBound wordTypeError + rw [show (Fintype.card I : ℝ) * H + + (((Fintype.card A : ℝ) + 1) * (1 + Real.log (Fintype.card I + 1 : ℕ)) + + (Fintype.card A : ℝ) * Real.log (Fintype.card I + 1 : ℕ)) = + (Fintype.card A : ℝ) * Real.log (Fintype.card I + 1 : ℕ) + + ((Fintype.card I : ℝ) * H + ((Fintype.card A : ℝ) + 1) * + (1 + Real.log (Fintype.card I + 1 : ℕ))) by ring] + conv_rhs => rw [Real.exp_add, Real.exp_nat_mul, Real.exp_log (by positivity)] + simp only [Nat.cast_add, Nat.cast_one] + +variable {C : Type*} [Fintype C] [DecidableEq C] +variable (Pos Shape A : C → Type*) + [∀ c, Fintype (Pos c)] [∀ c, DecidableEq (Pos c)] + [∀ c, Fintype (Shape c)] [∀ c, DecidableEq (Shape c)] + [∀ c, Fintype (A c)] [∀ c, DecidableEq (A c)] +variable (counts : ∀ c, Shape c → ℕ) + (designated : ∀ c, Shape c → Prop) + (H : (Σ c, Option (Shape c)) → ℝ) + (w : FixedClassWords Pos Shape counts) + +def groupedEntropy : ℝ := + ∑ g : Σ c, Option (Shape c), + (Fintype.card (GroupPos (w g.1).val (designated g.1) g.2) : ℝ) * H g + +def groupedTypeError : ℝ := + ∑ g : Σ c, Option (Shape c), + wordTypeError (GroupPos (w g.1).val (designated g.1) g.2) (A g.1) + +omit [DecidableEq C] [∀ c, DecidableEq (Pos c)] [∀ c, DecidableEq (A c)] in +theorem prod_wordEntropyBound_eq_exp : + (∏ g : Σ c, Option (Shape c), wordEntropyBound + (GroupPos (w g.1).val (designated g.1) g.2) (A g.1) (H g)) = + Real.exp (groupedEntropy Pos Shape counts designated H w + + groupedTypeError Pos Shape A counts designated w) := by + simp only [wordEntropyBound_eq_exp, groupedEntropy, groupedTypeError, + ← Real.exp_sum, Finset.sum_add_distrib] + +end GroupCounts + +section Compatibility + +variable {C : Type*} [Fintype C] [DecidableEq C] +variable (Pos Shape Pair Left Right : C → Type*) + [∀ c, Fintype (Pos c)] [∀ c, DecidableEq (Pos c)] + [∀ c, Fintype (Shape c)] [∀ c, DecidableEq (Shape c)] + [∀ c, Fintype (Pair c)] [∀ c, DecidableEq (Pair c)] + [∀ c, Fintype (Left c)] [∀ c, DecidableEq (Left c)] + [∀ c, Fintype (Right c)] [∀ c, DecidableEq (Right c)] +variable (shapeCounts : ∀ c, Shape c → ℕ) (pairCounts : ∀ c, Pair c → ℕ) + (leftPart : ∀ c, Pair c → Left c) (rightPart : ∀ c, Pair c → Right c) + (designatedLeft designatedRight : ∀ c, Shape c → Prop) + (leftLaw : ∀ c, Shape c → Left c → ℝ) + (rightLaw : ∀ c, Shape c → Right c → ℝ) (χ : ℝ) + +def compatibilityExponent (HL HR : (Σ c, Option (Shape c)) → ℝ) + (w : FixedClassWords Pos Shape shapeCounts) : ℝ := + classEntropy Pos Shape shapeCounts - classEntropy Pos Pair pairCounts + + groupedEntropy Pos Shape shapeCounts designatedLeft HL w + + groupedEntropy Pos Shape shapeCounts designatedRight HR w + + classTypeError Pos Shape + classTypeError Pos Pair + + groupedTypeError Pos Shape Left shapeCounts designatedLeft w + + groupedTypeError Pos Shape Right shapeCounts designatedRight w + +theorem compatibleCandidateCount_le_exp + (w : FixedClassWords Pos Shape shapeCounts) + (z : FixedClassWords Pos Pair pairCounts) + (hpair : ∀ c, Function.Injective (fun s : Pair c => (leftPart c s, rightPart c s))) + (HL HR : (Σ c, Option (Shape c)) → ℝ) + (controlLeft : SideEntropyControl Pos Shape Pair Left shapeCounts pairCounts + leftPart designatedLeft leftLaw χ HL w) + (controlRight : SideEntropyControl Pos Shape Pair Right shapeCounts pairCounts + rightPart designatedRight rightLaw χ HR w) : + (compatibleCandidateCount Pos Shape Pair Left Right shapeCounts pairCounts + leftPart rightPart designatedLeft designatedRight leftLaw rightLaw χ z : ℝ) ≤ + Real.exp (compatibilityExponent Pos Shape Pair Left Right shapeCounts pairCounts + designatedLeft designatedRight HL HR w) := by + have h := compatibleCandidateCount_le_of_controls Pos Shape Pair Left Right + shapeCounts pairCounts leftPart rightPart designatedLeft designatedRight + leftLaw rightLaw χ w z hpair HL HR controlLeft controlRight + rw [prod_wordEntropyBound_eq_exp, prod_wordEntropyBound_eq_exp] at h + let E := groupedEntropy Pos Shape shapeCounts designatedLeft HL w + + groupedTypeError Pos Shape Left shapeCounts designatedLeft w + + (groupedEntropy Pos Shape shapeCounts designatedRight HR w + + groupedTypeError Pos Shape Right shapeCounts designatedRight w) + rw [← Real.exp_add] at h + have hnum : (Fintype.card (FixedClassWords Pos Shape shapeCounts) : ℝ) * Real.exp E ≤ + Real.exp (classEntropy Pos Shape shapeCounts + classTypeError Pos Shape + E) := by + conv_rhs => rw [Real.exp_add] + exact mul_le_mul_of_nonneg_right + (fixedClassWords_card_le_exp Pos Shape shapeCounts w) (Real.exp_pos E).le + calc + (compatibleCandidateCount Pos Shape Pair Left Right shapeCounts pairCounts + leftPart rightPart designatedLeft designatedRight leftLaw rightLaw χ z : ℝ) ≤ + (Fintype.card (FixedClassWords Pos Shape shapeCounts) : ℝ) * Real.exp E / + Fintype.card (FixedClassWords Pos Pair pairCounts) := h + _ ≤ Real.exp (classEntropy Pos Shape shapeCounts + classTypeError Pos Shape + E) / + Real.exp (classEntropy Pos Pair pairCounts - classTypeError Pos Pair) := + div_le_div₀ (Real.exp_pos _).le hnum (Real.exp_pos _) + (exp_le_fixedClassWords_card Pos Pair pairCounts z) + _ = Real.exp (compatibilityExponent Pos Shape Pair Left Right shapeCounts pairCounts + designatedLeft designatedRight HL HR w) := by + rw [← Real.exp_sub] + congr 1 + dsimp [E, compatibilityExponent] + ring + +theorem log_compatibleCandidateCount_le + (w : FixedClassWords Pos Shape shapeCounts) + (z : FixedClassWords Pos Pair pairCounts) + (hpair : ∀ c, Function.Injective (fun s : Pair c => (leftPart c s, rightPart c s))) + (HL HR : (Σ c, Option (Shape c)) → ℝ) + (controlLeft : SideEntropyControl Pos Shape Pair Left shapeCounts pairCounts + leftPart designatedLeft leftLaw χ HL w) + (controlRight : SideEntropyControl Pos Shape Pair Right shapeCounts pairCounts + rightPart designatedRight rightLaw χ HR w) + (hpos : 0 < compatibleCandidateCount Pos Shape Pair Left Right shapeCounts pairCounts + leftPart rightPart designatedLeft designatedRight leftLaw rightLaw χ z) : + Real.log (compatibleCandidateCount Pos Shape Pair Left Right shapeCounts pairCounts + leftPart rightPart designatedLeft designatedRight leftLaw rightLaw χ z : ℝ) ≤ + compatibilityExponent Pos Shape Pair Left Right shapeCounts pairCounts + designatedLeft designatedRight HL HR w := by + have h := Real.log_le_log (Nat.cast_pos.mpr hpos) + (compatibleCandidateCount_le_exp Pos Shape Pair Left Right shapeCounts pairCounts + leftPart rightPart designatedLeft designatedRight leftLaw rightLaw χ + w z hpair HL HR controlLeft controlRight) + simpa only [Real.log_exp] using h + +end Compatibility + +end MatrixMultiplication.JointCompatibilityEntropyBound + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/Entropy/JointCompatibilityRateLimit.lean b/lean/OAI/LinearAlgebra/MatrixFields/Entropy/JointCompatibilityRateLimit.lean new file mode 100644 index 0000000000000000000000000000000000000000..36b80262b42700e217727be263f47fdaf805c643 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/Entropy/JointCompatibilityRateLimit.lean @@ -0,0 +1,285 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Construction.JointCompatibilityScaling + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section + +namespace MatrixMultiplication.JointCompatibilityRateLimit + +open MatrixMultiplication.Foundation JointTypeCounts JointCompatibilityIncidence +open JointCompatibilityEntropyBound JointCompatibilityScaling Filter +open scoped BigOperators Topology + +attribute [local instance] Classical.propDecidable + +private theorem exists_pos_le_family_inline_MatrixMultiplication_JointCompatibilityRateLimit {K : Type*} [Fintype K] + (δ : K → ℝ) (hδ : ∀ k, 0 < δ k) : + ∃ ε : ℝ, 0 < ε ∧ ∀ k, ε ≤ δ k := by + classical + have aux : ∀ s : Finset K, ∃ ε : ℝ, 0 < ε ∧ ∀ k ∈ s, ε ≤ δ k := by + intro s + induction s using Finset.induction_on with + | empty => exact ⟨1, zero_lt_one, by simp⟩ + | @insert k s hk ih => + obtain ⟨ε, hε, hb⟩ := ih + refine ⟨min (δ k) ε, lt_min (hδ k) hε, ?_⟩ + intro j hj + rcases Finset.mem_insert.mp hj with rfl | hj + · exact min_le_left _ _ + · exact (min_le_right _ _).trans (hb j hj) + obtain ⟨ε, hε, hb⟩ := aux Finset.univ + exact ⟨ε, hε, fun k => hb k (Finset.mem_univ k)⟩ + +variable {C : Type*} [Fintype C] [DecidableEq C] + {Shape Pair Left Right : C → Type*} + [∀ c, Fintype (Shape c)] [∀ c, DecidableEq (Shape c)] + [∀ c, Fintype (Pair c)] [∀ c, DecidableEq (Pair c)] + [∀ c, Fintype (Left c)] [∀ c, DecidableEq (Left c)] + [∀ c, Fintype (Right c)] [∀ c, DecidableEq (Right c)] + +def totalBase (base : ∀ c, Shape c → ℕ) : ℕ := ∑ c, baseSize base c + +def pairReferenceEntropy (base : ∀ c, Shape c → ℕ) (q : ∀ c, Pair c → ℝ) : ℝ := + ∑ c, (baseSize base c : ℝ) * finiteEntropy (q c) + +def projectedReferenceEntropy (base : ∀ c, Shape c → ℕ) + (d : ∀ c, Shape c → Prop) (H : (Σ c, Option (Shape c)) → ℝ) : ℝ := + ∑ g : Σ c, Option (Shape c), (baseGroupSize base d g : ℝ) * H g + +def compatibilityRate (base : ∀ c, Shape c → ℕ) (q : ∀ c, Pair c → ℝ) + (designatedLeft designatedRight : ∀ c, Shape c → Prop) + (HL HR : (Σ c, Option (Shape c)) → ℝ) : ℝ := + baseEntropy base - pairReferenceEntropy base q + + projectedReferenceEntropy base designatedLeft HL + + projectedReferenceEntropy base designatedRight HR + +omit [DecidableEq C] in +theorem projectedReferenceEntropy_add_const (base : ∀ c, Shape c → ℕ) + (d : ∀ c, Shape c → Prop) (H : (Σ c, Option (Shape c)) → ℝ) (δ : ℝ) : + projectedReferenceEntropy base d (fun g => H g + δ) = + projectedReferenceEntropy base d H + (totalBase base : ℝ) * δ := by + simp only [projectedReferenceEntropy, mul_add, Finset.sum_add_distrib, + ← Finset.sum_mul, ← Nat.cast_sum, sum_baseGroupSize, totalBase, baseTotal] + +omit [DecidableEq C] [∀ c, DecidableEq (Pair c)] in +theorem compatibilityRate_add_caps (base : ∀ c, Shape c → ℕ) + (q : ∀ c, Pair c → ℝ) (designatedLeft designatedRight : ∀ c, Shape c → Prop) + (HL HR : (Σ c, Option (Shape c)) → ℝ) (δ : ℝ) : + compatibilityRate base q designatedLeft designatedRight + (fun g => HL g + δ) (fun g => HR g + δ) = + compatibilityRate base q designatedLeft designatedRight HL HR + + 2 * (totalBase base : ℝ) * δ := by + simp only [compatibilityRate, projectedReferenceEntropy_add_const] + ring + +def PairWindow (base : ∀ c, Shape c → ℕ) (q : ∀ c, Pair c → ℝ) + (Pos : C → Type*) [∀ c, Fintype (Pos c)] + (pairCounts : ∀ c, Pair c → ℕ) (η : ℝ) : Prop := + ∀ c, 0 < baseSize base c → ∀ a, + |(pairCounts c a : ℝ) / Fintype.card (Pos c) - q c a| ≤ η + +omit [DecidableEq C] [∀ c, DecidableEq (Pair c)] in +theorem exists_pair_entropy_window (q : ∀ c, Pair c → ℝ) + {κ ηMax : ℝ} (hκ : 0 < κ) (hηMax : 0 < ηMax) : + ∃ η : ℝ, 0 < η ∧ η ≤ ηMax ∧ ∀ c (r : Pair c → ℝ), + (∀ a, |r a - q c a| ≤ η) → finiteEntropy (q c) - κ ≤ finiteEntropy r := by + have hex : ∀ c, ∃ δ : ℝ, 0 < δ ∧ ∀ r : Pair c → ℝ, + (∀ a, |r a - q c a| ≤ δ) → |finiteEntropy r - finiteEntropy (q c)| < κ := + fun c => exists_entropy_window (q c) hκ + choose δ hδ hw using hex + obtain ⟨η₀, hη₀, hsmall⟩ := exists_pos_le_family_inline_MatrixMultiplication_JointCompatibilityRateLimit δ hδ + refine ⟨min ηMax η₀, lt_min hηMax hη₀, min_le_left _ _, ?_⟩ + intro c r hr + have h := (abs_lt.mp (hw c r (fun a => + (hr a).trans ((min_le_right _ _).trans (hsmall c))))).1 + linarith + +omit [Fintype C] [DecidableEq C] in +theorem repeated_positions_card + (Pos : C → Type*) [∀ c, Fintype (Pos c)] [∀ c, DecidableEq (Pos c)] + (base : ∀ c, Shape c → ℕ) (t : ℕ) + (w : FixedClassWords Pos Shape (fun c u => t * base c u)) (c : C) : + Fintype.card (Pos c) = t * baseSize base c := by + rw [fixedClassWords_size Pos Shape _ w c] + simp only [baseSize, Finset.mul_sum] + +omit [DecidableEq C] in +theorem repeated_positions_card_le + (Pos : C → Type*) [∀ c, Fintype (Pos c)] [∀ c, DecidableEq (Pos c)] + (base : ∀ c, Shape c → ℕ) (t : ℕ) + (w : FixedClassWords Pos Shape (fun c u => t * base c u)) (c : C) : + Fintype.card (Pos c) ≤ t * totalBase base := by + rw [repeated_positions_card Pos base t w c] + exact Nat.mul_le_mul_left _ + (Finset.single_le_sum (fun _ _ => Nat.zero_le _) (Finset.mem_univ c)) + +omit [DecidableEq C] [∀ c, DecidableEq (Pair c)] in +theorem pair_classEntropy_lower + (Pos : C → Type*) [∀ c, Fintype (Pos c)] [∀ c, DecidableEq (Pos c)] + (base : ∀ c, Shape c → ℕ) (q : ∀ c, Pair c → ℝ) (t : ℕ) + (pairCounts : ∀ c, Pair c → ℕ) + (w : FixedClassWords Pos Shape (fun c u => t * base c u)) + {η κ : ℝ} + (hwindow : ∀ c (r : Pair c → ℝ), (∀ a, |r a - q c a| ≤ η) → + finiteEntropy (q c) - κ ≤ finiteEntropy r) + (hpair : PairWindow base q Pos pairCounts η) : + (t : ℝ) * (pairReferenceEntropy base q - (totalBase base : ℝ) * κ) ≤ + classEntropy Pos Pair pairCounts := by + have hc (c : C) : + (t : ℝ) * (baseSize base c : ℝ) * (finiteEntropy (q c) - κ) ≤ + (Fintype.card (Pos c) : ℝ) * + finiteEntropy (fun a => (pairCounts c a : ℝ) / Fintype.card (Pos c)) := by + by_cases hz : baseSize base c = 0 + · simp only [repeated_positions_card Pos base t w c, hz, mul_zero, + Nat.cast_zero, zero_mul, le_refl] + · have he := hwindow c (fun a => (pairCounts c a : ℝ) / Fintype.card (Pos c)) + (hpair c (Nat.pos_of_ne_zero hz)) + have hh := mul_le_mul_of_nonneg_left he + (mul_nonneg (Nat.cast_nonneg t) (Nat.cast_nonneg (baseSize base c))) + simpa only [repeated_positions_card Pos base t w c, Nat.cast_mul] using hh + calc + (t : ℝ) * (pairReferenceEntropy base q - (totalBase base : ℝ) * κ) = + ∑ c, (t : ℝ) * (baseSize base c : ℝ) * (finiteEntropy (q c) - κ) := by + simp only [pairReferenceEntropy, totalBase, Nat.cast_sum, Finset.mul_sum, + Finset.sum_mul, mul_sub, Finset.sum_sub_distrib, mul_assoc] + _ ≤ classEntropy Pos Pair pairCounts := Finset.sum_le_sum fun c _ => hc c + +def errorCoefficient (Shape Pair Left Right : C → Type*) + [∀ c, Fintype (Shape c)] [∀ c, Fintype (Pair c)] + [∀ c, Fintype (Left c)] [∀ c, Fintype (Right c)] : ℝ := + classErrorCoefficient Shape + classErrorCoefficient Pair + + groupErrorCoefficient Shape Left + groupErrorCoefficient Shape Right + +omit [DecidableEq C] in +theorem compatibilityExponent_le_rate_add + (Pos : C → Type*) [∀ c, Fintype (Pos c)] [∀ c, DecidableEq (Pos c)] + (base : ∀ c, Shape c → ℕ) (q : ∀ c, Pair c → ℝ) + (designatedLeft designatedRight : ∀ c, Shape c → Prop) + (HL HR : (Σ c, Option (Shape c)) → ℝ) + (t : ℕ) (ht : 0 < t) (pairCounts : ∀ c, Pair c → ℕ) + (w : FixedClassWords Pos Shape (fun c u => t * base c u)) + {η κ : ℝ} + (hwindow : ∀ c (r : Pair c → ℝ), (∀ a, |r a - q c a| ≤ η) → + finiteEntropy (q c) - κ ≤ finiteEntropy r) + (hpair : PairWindow base q Pos pairCounts η) : + compatibilityExponent Pos Shape Pair Left Right (fun c u => t * base c u) + pairCounts designatedLeft designatedRight HL HR w ≤ + (t : ℝ) * (compatibilityRate base q designatedLeft designatedRight HL HR + + (totalBase base : ℝ) * κ) + + errorCoefficient Shape Pair Left Right * typeErrorFactor (totalBase base) t := by + have hsize := repeated_positions_card Pos base t w + have hsizele := repeated_positions_card_le Pos base t w + have hs := classEntropy_repeated Pos base t ht hsize + have hl := groupedEntropy_repeated Pos base designatedLeft t HL w + have hr := groupedEntropy_repeated Pos base designatedRight t HR w + have hp := pair_classEntropy_lower Pos base q t pairCounts w hwindow hpair + have e₁ := classTypeError_le Pos Shape (totalBase base) t hsizele + have e₂ := classTypeError_le Pos Pair (totalBase base) t hsizele + have e₃ := groupedTypeError_le Pos Left (fun c u => t * base c u) + designatedLeft w (totalBase base) t hsizele + have e₄ := groupedTypeError_le Pos Right (fun c u => t * base c u) + designatedRight w (totalBase base) t hsizele + unfold compatibilityExponent + rw [hs, hl, hr] + dsimp only [compatibilityRate, projectedReferenceEntropy, baseGroupedEntropy, + errorCoefficient] at * + nlinarith + +omit [DecidableEq C] in +theorem exists_window_eventually_exponent_le + (base : ∀ c, Shape c → ℕ) (q : ∀ c, Pair c → ℝ) + (designatedLeft designatedRight : ∀ c, Shape c → Prop) + (HL HR : (Σ c, Option (Shape c)) → ℝ) + {ε ηMax : ℝ} (hε : 0 < ε) (hηMax : 0 < ηMax) : + ∃ η : ℝ, 0 < η ∧ η ≤ ηMax ∧ + ∀ᶠ t : ℕ in atTop, + ∀ (Pos : C → Type*) [∀ c, Fintype (Pos c)] [∀ c, DecidableEq (Pos c)] + (pairCounts : ∀ c, Pair c → ℕ) + (w : FixedClassWords Pos Shape (fun c u => t * base c u)), + PairWindow base q Pos pairCounts η → + compatibilityExponent Pos Shape Pair Left Right (fun c u => t * base c u) + pairCounts designatedLeft designatedRight HL HR w ≤ + (t : ℝ) * (compatibilityRate base q designatedLeft designatedRight HL HR + ε) := by + let κ : ℝ := ε / (2 * ((totalBase base : ℝ) + 1)) + have hden : 0 < 2 * ((totalBase base : ℝ) + 1) := by positivity + have hκ : 0 < κ := div_pos hε hden + have hκeq : (2 * ((totalBase base : ℝ) + 1)) * κ = ε := + mul_div_cancel₀ _ hden.ne' + have hκbound : (totalBase base : ℝ) * κ ≤ ε / 2 := by + nlinarith [(Nat.cast_nonneg (totalBase base) : (0 : ℝ) ≤ totalBase base)] + obtain ⟨η, hη, hηMax', hwindow⟩ := exists_pair_entropy_window q hκ hηMax + refine ⟨η, hη, hηMax', ?_⟩ + have herr := tendsto_mul_typeErrorFactor_div + (errorCoefficient Shape Pair Left Right) (totalBase base) + filter_upwards [(tendsto_order.1 herr).2 (ε / 2) (half_pos hε), + eventually_ge_atTop (1 : ℕ)] with t he ht + intro Pos _ _ pairCounts w hp + have htpos : 0 < t := lt_of_lt_of_le Nat.zero_lt_one ht + have htr : (0 : ℝ) < t := Nat.cast_pos.mpr htpos + have he' := (div_lt_iff₀ htr).mp he + have hκ' := mul_le_mul_of_nonneg_left hκbound htr.le + have hb := compatibilityExponent_le_rate_add (Left := Left) (Right := Right) + Pos base q designatedLeft designatedRight HL HR t htpos pairCounts w hwindow hp + nlinarith + +theorem exists_window_eventually_count_le + (base : ∀ c, Shape c → ℕ) (q : ∀ c, Pair c → ℝ) + (leftPart : ∀ c, Pair c → Left c) (rightPart : ∀ c, Pair c → Right c) + (designatedLeft designatedRight : ∀ c, Shape c → Prop) + (leftLaw : ∀ c, Shape c → Left c → ℝ) + (rightLaw : ∀ c, Shape c → Right c → ℝ) + (hparts : ∀ c, Function.Injective (fun a : Pair c => (leftPart c a, rightPart c a))) + (HL HR : (Σ c, Option (Shape c)) → ℝ) + {ε ηMax : ℝ} (hε : 0 < ε) (hηMax : 0 < ηMax) : + ∃ η : ℝ, 0 < η ∧ η ≤ ηMax ∧ + ∀ᶠ t : ℕ in atTop, + ∀ (Pos : C → Type*) [∀ c, Fintype (Pos c)] [∀ c, DecidableEq (Pos c)] + (pairCounts : ∀ c, Pair c → ℕ) + (w : FixedClassWords Pos Shape (fun c u => t * base c u)) + (z : FixedClassWords Pos Pair pairCounts) (χ : ℝ), + PairWindow base q Pos pairCounts η → + SideEntropyControl Pos Shape Pair Left (fun c u => t * base c u) pairCounts + leftPart designatedLeft leftLaw χ HL w → + SideEntropyControl Pos Shape Pair Right (fun c u => t * base c u) pairCounts + rightPart designatedRight rightLaw χ HR w → + (compatibleCandidateCount Pos Shape Pair Left Right (fun c u => t * base c u) + pairCounts leftPart rightPart designatedLeft designatedRight leftLaw rightLaw χ z : ℝ) ≤ + Real.exp ((t : ℝ) * + (compatibilityRate base q designatedLeft designatedRight HL HR + ε)) ∧ + (0 < compatibleCandidateCount Pos Shape Pair Left Right (fun c u => t * base c u) + pairCounts leftPart rightPart designatedLeft designatedRight leftLaw rightLaw χ z → + Real.log (compatibleCandidateCount Pos Shape Pair Left Right (fun c u => t * base c u) + pairCounts leftPart rightPart designatedLeft designatedRight leftLaw rightLaw χ z : ℝ) / + (t : ℝ) ≤ compatibilityRate base q designatedLeft designatedRight HL HR + ε) := by + obtain ⟨η, hη, hηMax', hbound⟩ := exists_window_eventually_exponent_le + (Left := Left) (Right := Right) base q designatedLeft designatedRight HL HR hε hηMax + refine ⟨η, hη, hηMax', ?_⟩ + filter_upwards [hbound, eventually_ge_atTop (1 : ℕ)] with t hb ht + intro Pos _ _ pairCounts w z χ hp hL hR + have he := hb Pos pairCounts w hp + have hc := compatibleCandidateCount_le_exp Pos Shape Pair Left Right + (fun c u => t * base c u) pairCounts leftPart rightPart + designatedLeft designatedRight leftLaw rightLaw χ w z hparts HL HR hL hR + refine ⟨hc.trans (Real.exp_le_exp.mpr he), ?_⟩ + intro hpos + have hl := log_compatibleCandidateCount_le Pos Shape Pair Left Right + (fun c u => t * base c u) pairCounts leftPart rightPart + designatedLeft designatedRight leftLaw rightLaw χ w z hparts HL HR hL hR hpos + have htr : (0 : ℝ) < t := + Nat.cast_pos.mpr (lt_of_lt_of_le Nat.zero_lt_one ht) + exact (div_le_iff₀ htr).mpr (by simpa only [mul_comm] using hl.trans he) + +end MatrixMultiplication.JointCompatibilityRateLimit + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/Entropy/JointExtractionRates.lean b/lean/OAI/LinearAlgebra/MatrixFields/Entropy/JointExtractionRates.lean new file mode 100644 index 0000000000000000000000000000000000000000..61ead073d9bf21a2186af6a72e3c6043c2a28d28 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/Entropy/JointExtractionRates.lean @@ -0,0 +1,726 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Construction.JointAPFree +import OAI.LinearAlgebra.MatrixFields.Extraction.ComplexFiniteSeparation + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section + +namespace MatrixMultiplication.Foundation.Separation + +open Filter + +private theorem scale_exists (K : ℕ) : ∃ n : ℕ, K ≤ 2 ^ (n ^ 2) := by + refine ⟨K + 1, ?_⟩ + have hK : K < 2 ^ K := Nat.lt_pow_self (by decide : 1 < 2) + exact hK.le.trans (Nat.pow_le_pow_right (by decide) (by nlinarith)) + +noncomputable def gridScale (K : ℕ) : ℕ := Nat.find (scale_exists K) + +theorem population_le_scale (K : ℕ) : K ≤ 2 ^ ((gridScale K) ^ 2) := + Nat.find_spec (scale_exists K) + +theorem previous_scale_lt_population {K : ℕ} (hn : 0 < gridScale K) : + 2 ^ ((gridScale K - 1) ^ 2) < K := by + exact lt_of_not_ge (Nat.find_min (scale_exists K) (Nat.sub_lt hn (by decide))) + +theorem scale_pos {K : ℕ} (hK : 1 < K) : 0 < gridScale K := by + have h := population_le_scale K + by_contra hn + have hz : gridScale K = 0 := Nat.eq_zero_of_not_pos hn + simp only [hz, zero_pow (by decide : 2 ≠ 0), pow_zero] at h + exact (not_le_of_gt hK) h + +theorem scale_gt_of_population_gt {K n : ℕ} (hK : 2 ^ (n ^ 2) < K) : + n < gridScale K := by + by_contra hn + have hscale : gridScale K ≤ n := Nat.le_of_not_gt hn + have hp : 2 ^ ((gridScale K) ^ 2) ≤ 2 ^ (n ^ 2) := + Nat.pow_le_pow_right (by decide) (Nat.pow_le_pow_left hscale 2) + exact (not_le_of_gt hK) ((population_le_scale K).trans hp) + +theorem gridScale_monotone : Monotone gridScale := by + intro K L hKL + exact Nat.find_min' (scale_exists K) (hKL.trans (population_le_scale L)) + +def gridDimension (K : ℕ) : ℕ := gridScale K + 4 + +def gridWidth (K : ℕ) : ℕ := 2 ^ (gridScale K + 2) + +def gridGroupOrder (K : ℕ) : ℕ := (4 * gridWidth K) ^ gridDimension K + +theorem gridDimension_pos (K : ℕ) : 0 < gridDimension K := by + simp [gridDimension] + +theorem gridWidth_ge_two (K : ℕ) : 2 ≤ gridWidth K := by + simpa only [gridWidth, pow_one] using + (Nat.pow_le_pow_right (by decide : 0 < 2) (by omega : 1 ≤ gridScale K + 2)) + +private theorem dimension_le_power (n : ℕ) : n + 4 ≤ 2 ^ (n + 2) := by + induction n with + | zero => norm_num + | succ n ih => + have hp : 2 ^ (n + 2 + 1) = 2 ^ (n + 2) * 2 := pow_succ _ _ + have he : n + 1 + 2 = n + 2 + 1 := by omega + rw [he, hp] + omega + +theorem grid_population_bound (K : ℕ) : + (gridDimension K * gridWidth K ^ 2 + 1) * K ≤ + gridWidth K ^ gridDimension K := by + let n := gridScale K + have hd : n + 4 ≤ 2 ^ (n + 2) := dimension_le_power n + have hq : 0 < 2 ^ (n + 2) := by positivity + have hcolorpos : 0 < (n + 4) * (2 ^ (n + 2)) ^ 2 := by positivity + have hcolor : (n + 4) * (2 ^ (n + 2)) ^ 2 + 1 ≤ 2 ^ (3 * n + 7) := by + calc + (n + 4) * (2 ^ (n + 2)) ^ 2 + 1 ≤ + 2 * ((n + 4) * (2 ^ (n + 2)) ^ 2) := by nlinarith + _ ≤ 2 * (2 ^ (n + 2) * (2 ^ (n + 2)) ^ 2) := by gcongr + _ = 2 ^ (3 * n + 7) := by + rw [← pow_mul, ← pow_add, ← pow_succ'] + congr 1 + omega + calc + (gridDimension K * gridWidth K ^ 2 + 1) * K ≤ + 2 ^ (3 * n + 7) * 2 ^ (n ^ 2) := + Nat.mul_le_mul hcolor (population_le_scale K) + _ = 2 ^ (3 * n + 7 + n ^ 2) := (pow_add _ _ _).symm + _ ≤ 2 ^ ((n + 2) * (n + 4)) := + Nat.pow_le_pow_right (by decide) (by nlinarith) + _ = gridWidth K ^ gridDimension K := by + simp only [gridWidth, gridDimension, n, pow_mul] + +theorem gridGroupOrder_eq (K : ℕ) : + gridGroupOrder K = 2 ^ ((gridScale K + 4) ^ 2) := by + unfold gridGroupOrder gridWidth gridDimension + have hb : 4 * 2 ^ (gridScale K + 2) = 2 ^ (gridScale K + 4) := by + calc + 4 * 2 ^ (gridScale K + 2) = 2 ^ 2 * 2 ^ (gridScale K + 2) := by norm_num + _ = 2 ^ (2 + (gridScale K + 2)) := (pow_add _ _ _).symm + _ = 2 ^ (gridScale K + 4) := by congr 1; omega + rw [hb, ← pow_mul, pow_two] + +theorem gridGroupOrder_pos (K : ℕ) : 0 < gridGroupOrder K := by + rw [gridGroupOrder_eq] + positivity + +theorem population_le_gridGroupOrder (K : ℕ) : K ≤ gridGroupOrder K := by + rw [gridGroupOrder_eq] + exact (population_le_scale K).trans + (Nat.pow_le_pow_right (by decide) + (Nat.pow_le_pow_left (Nat.le_add_right (gridScale K) 4) 2)) + +theorem gridGroupOrder_monotone : Monotone gridGroupOrder := by + intro K L hKL + rw [gridGroupOrder_eq, gridGroupOrder_eq] + exact Nat.pow_le_pow_right (by decide) + (Nat.pow_le_pow_left (Nat.add_le_add_right (gridScale_monotone hKL) 4) 2) + +theorem asymptotic_grid_tags_slices (K : ℕ) : + ∃ tags : Finset (Grid (gridDimension K) (gridWidth K)), tags.card = K ∧ + (∃ radius : Fin (gridDimension K * gridWidth K ^ 2 + 1), + ∀ t ∈ tags, normColor t = radius) ∧ + ∀ t ∈ tags, ∃ slice : Finset (Grid (gridDimension K) (gridWidth K)), + slice.card = K ∧ ∃ level : Fin (gridDimension K * gridWidth K ^ 2 + 1), + ∀ u ∈ slice, dotColor t u = level := + grid_tags_slices (grid_population_bound K) (grid_population_bound K) + +theorem log_gridGroupOrder (K : ℕ) : + Real.log (gridGroupOrder K : ℝ) = ((gridScale K : ℝ) + 4) ^ 2 * Real.log 2 := by + rw [gridGroupOrder_eq, Nat.cast_pow, Real.log_pow] + norm_cast + +theorem log_population_le_log_gridGroupOrder {K : ℕ} (hK : 0 < K) : + Real.log (K : ℝ) ≤ Real.log (gridGroupOrder K : ℝ) := by + exact Real.log_le_log (by exact_mod_cast hK) + (by exact_mod_cast population_le_gridGroupOrder K) + +theorem previous_scale_log_lt {K : ℕ} (hK : 1 < K) : + ((gridScale K : ℝ) - 1) ^ 2 * Real.log 2 < Real.log (K : ℝ) := by + have hn : 1 ≤ gridScale K := scale_pos hK + have hp : (0 : ℝ) < (2 : ℝ) ^ ((gridScale K - 1) ^ 2) := by positivity + have hc : (2 : ℝ) ^ ((gridScale K - 1) ^ 2) < (K : ℝ) := by + exact_mod_cast previous_scale_lt_population (scale_pos hK) + have h := Real.log_lt_log hp hc + simpa only [Real.log_pow, Nat.cast_pow, Nat.cast_sub hn, Nat.cast_one] using h + +theorem log_gridGroupOrder_le_of_scale {K : ℕ} {ε : ℝ} + (hK : 1 < K) (hε : 0 ≤ ε) + (hscale : 10 * (gridScale K : ℝ) + 15 ≤ + ε * ((gridScale K : ℝ) - 1) ^ 2) : + Real.log (gridGroupOrder K : ℝ) ≤ (1 + ε) * Real.log (K : ℝ) := by + have hlog2 : 0 < Real.log 2 := Real.log_pos (by norm_num) + have hpoly : ((gridScale K : ℝ) + 4) ^ 2 ≤ + (1 + ε) * ((gridScale K : ℝ) - 1) ^ 2 := by nlinarith + calc + Real.log (gridGroupOrder K : ℝ) = + ((gridScale K : ℝ) + 4) ^ 2 * Real.log 2 := log_gridGroupOrder K + _ ≤ ((1 + ε) * ((gridScale K : ℝ) - 1) ^ 2) * Real.log 2 := + mul_le_mul_of_nonneg_right hpoly hlog2.le + _ = (1 + ε) * (((gridScale K : ℝ) - 1) ^ 2 * Real.log 2) := by ring + _ ≤ (1 + ε) * Real.log (K : ℝ) := + mul_le_mul_of_nonneg_left (previous_scale_log_lt hK).le (by positivity) + +private theorem scale_error_bound {n ε : ℝ} (hn : 2 ≤ n) (hε : 0 ≤ ε) + (hlarge : 72 ≤ ε * n) : 10 * n + 15 ≤ ε * (n - 1) ^ 2 := by + have hsq : n ^ 2 ≤ 4 * (n - 1) ^ 2 := by nlinarith + have hmul := mul_le_mul_of_nonneg_left hsq hε + have hlarge' := mul_le_mul_of_nonneg_right hlarge (by linarith : 0 ≤ n) + nlinarith + +theorem eventually_log_gridGroupOrder_le {ε : ℝ} (hε : 0 < ε) : + ∀ᶠ K : ℕ in atTop, + Real.log (gridGroupOrder K : ℝ) ≤ (1 + ε) * Real.log (K : ℝ) := by + obtain ⟨m : ℕ, hm⟩ := exists_nat_gt (max 2 (72 / ε)) + refine eventually_atTop.2 ⟨2 ^ (m ^ 2) + 1, ?_⟩ + intro K hK + have hKm : 2 ^ (m ^ 2) < K := by omega + have hn := scale_gt_of_population_gt hKm + have hnR : (m : ℝ) < (gridScale K : ℝ) := by exact_mod_cast hn + have hm2 : 2 < (m : ℝ) := (le_max_left _ _).trans_lt hm + have hmε : 72 / ε < (m : ℝ) := (le_max_right _ _).trans_lt hm + have hnε : 72 ≤ ε * (gridScale K : ℝ) := by + have hdiv : 72 / ε < (gridScale K : ℝ) := hmε.trans hnR + have hmul := (div_lt_iff₀ hε).1 hdiv + nlinarith + have hKone : 1 < K := by + have hp : 1 ≤ 2 ^ (m ^ 2) := Nat.one_le_pow _ _ (by decide) + omega + exact log_gridGroupOrder_le_of_scale hKone hε.le + (scale_error_bound (by linarith) hε.le hnε) + +theorem uniform_log_gridGroupOrder_le {ε : ℝ} (hε : 0 < ε) : + ∃ C : ℝ, 0 ≤ C ∧ ∀ K : ℕ, + Real.log (gridGroupOrder K : ℝ) ≤ (1 + ε) * Real.log (K : ℝ) + C := by + obtain ⟨K₀, hK₀⟩ := eventually_atTop.1 (eventually_log_gridGroupOrder_le hε) + refine ⟨Real.log (gridGroupOrder K₀ : ℝ), Real.log_natCast_nonneg _, ?_⟩ + intro K + by_cases hK : K₀ ≤ K + · exact (hK₀ K hK).trans (le_add_of_nonneg_right (Real.log_natCast_nonneg _)) + · have horder : gridGroupOrder K ≤ gridGroupOrder K₀ := + gridGroupOrder_monotone (Nat.le_of_lt (Nat.lt_of_not_ge hK)) + have hpos : (0 : ℝ) < (gridGroupOrder K : ℝ) := by + rw [gridGroupOrder_eq, Nat.cast_pow] + positivity + have hcast : (gridGroupOrder K : ℝ) ≤ (gridGroupOrder K₀ : ℝ) := by + exact_mod_cast horder + have hlog := Real.log_le_log hpos hcast + have hnonneg : 0 ≤ (1 + ε) * Real.log (K : ℝ) := + mul_nonneg (by linarith) (Real.log_natCast_nonneg K) + linarith + +theorem tendsto_log_gridGroupOrder_div_log_population : + Tendsto (fun K : ℕ => Real.log (gridGroupOrder K : ℝ) / Real.log (K : ℝ)) + atTop (nhds 1) := by + refine tendsto_order.2 ⟨?_, ?_⟩ + · intro a ha + refine eventually_atTop.2 ⟨2, ?_⟩ + intro K hK + have hKone : 1 < K := by omega + have hlog : 0 < Real.log (K : ℝ) := + Real.log_pos (by exact_mod_cast hKone) + have hle := log_population_le_log_gridGroupOrder (by omega : 0 < K) + exact ha.trans_le ((le_div_iff₀ hlog).2 (by simpa using hle)) + · intro b hb + have he : 0 < (b - 1) / 2 := by linarith + filter_upwards [eventually_log_gridGroupOrder_le he, + (eventually_atTop.2 ⟨2, fun K (hK : 2 ≤ K) => hK⟩)] with K hcost hK + have hlog : 0 < Real.log (K : ℝ) := + Real.log_pos (by exact_mod_cast (show 1 < K by omega)) + have hratio : Real.log (gridGroupOrder K : ℝ) / Real.log (K : ℝ) ≤ + 1 + (b - 1) / 2 := (div_le_iff₀ hlog).2 hcost + linarith + +theorem tendsto_log_gridGroupOrder_div_nat {K : ℕ → ℕ} {H : ℝ} + (hK : ∀ N, 0 < K N) (hH : 0 ≤ H) + (hpop : Tendsto (fun N => Real.log (K N : ℝ) / (N : ℝ)) atTop (nhds H)) : + Tendsto (fun N => Real.log (gridGroupOrder (K N) : ℝ) / (N : ℝ)) + atTop (nhds H) := by + refine tendsto_order.2 ⟨?_, ?_⟩ + · intro a ha + filter_upwards [(tendsto_order.1 hpop).1 a ha, + (eventually_atTop.2 ⟨1, fun N (hN : 1 ≤ N) => hN⟩)] with N haN hN + have hNpos : (0 : ℝ) < (N : ℝ) := by exact_mod_cast hN + exact haN.trans_le (div_le_div_of_nonneg_right + (log_population_le_log_gridGroupOrder (hK N)) hNpos.le) + · intro b hb + let ε := (b - H) / (2 * (H + 1)) + have hdenom : 0 < 2 * (H + 1) := by linarith + have hε : 0 < ε := div_pos (by linarith) hdenom + obtain ⟨C, hC, hbound⟩ := uniform_log_gridGroupOrder_le hε + have hεeq : ε * (2 * (H + 1)) = b - H := div_mul_cancel₀ _ hdenom.ne' + have hlimitlt : (1 + ε) * H < b := by nlinarith + have hconstant : Tendsto (fun N : ℕ => C / (N : ℝ)) atTop (nhds 0) := + tendsto_const_nhds.div_atTop tendsto_natCast_atTop_atTop + have hupper : Tendsto + (fun N : ℕ => (1 + ε) * (Real.log (K N : ℝ) / (N : ℝ)) + C / (N : ℝ)) + atTop (nhds ((1 + ε) * H)) := by + simpa using (hpop.const_mul (1 + ε)).add hconstant + filter_upwards [(tendsto_order.1 hupper).2 b hlimitlt, + (eventually_atTop.2 ⟨1, fun N (hN : 1 ≤ N) => hN⟩)] with N hbN hN + have hNpos : (0 : ℝ) < (N : ℝ) := by exact_mod_cast hN + have hle := div_le_div_of_nonneg_right (hbound (K N)) hNpos.le + have heq : ((1 + ε) * Real.log (K N : ℝ) + C) / (N : ℝ) = + (1 + ε) * (Real.log (K N : ℝ) / (N : ℝ)) + C / (N : ℝ) := by ring + rw [heq] at hle + exact hle.trans_lt hbN + +theorem log_nat_prod {I : Type*} (s : Finset I) (a : I → ℕ) + (ha : ∀ i ∈ s, 0 < a i) : + Real.log ((∏ i ∈ s, a i : ℕ) : ℝ) = ∑ i ∈ s, Real.log (a i : ℝ) := by + rw [Nat.cast_prod] + exact Real.log_prod fun i hi => + Nat.cast_ne_zero.mpr (Nat.ne_of_gt (ha i hi)) + +theorem tendsto_log_nat_prod_div_nat {I : Type*} (s : Finset I) + {K : I → ℕ → ℕ} {H : I → ℝ} + (hK : ∀ i ∈ s, ∀ N, 0 < K i N) + (hpop : ∀ i ∈ s, + Tendsto (fun N => Real.log (K i N : ℝ) / (N : ℝ)) atTop (nhds (H i))) : + Tendsto (fun N => Real.log ((∏ i ∈ s, K i N : ℕ) : ℝ) / (N : ℝ)) + atTop (nhds (∑ i ∈ s, H i)) := by + have hsum := tendsto_finsetSum s hpop + apply hsum.congr + intro N + rw [log_nat_prod s (fun i => K i N) (fun i hi => hK i hi N)] + simp only [div_eq_mul_inv, Finset.sum_mul] + +theorem tendsto_log_gridGroupOrder_prod_div_nat {I : Type*} (s : Finset I) + {K : I → ℕ → ℕ} {H : I → ℝ} + (hK : ∀ i ∈ s, ∀ N, 0 < K i N) (hH : ∀ i ∈ s, 0 ≤ H i) + (hpop : ∀ i ∈ s, + Tendsto (fun N => Real.log (K i N : ℝ) / (N : ℝ)) atTop (nhds (H i))) : + Tendsto (fun N => Real.log ((∏ i ∈ s, gridGroupOrder (K i N) : ℕ) : ℝ) / (N : ℝ)) + atTop (nhds (∑ i ∈ s, H i)) := by + exact tendsto_log_nat_prod_div_nat s (fun i hi N => gridGroupOrder_pos (K i N)) + (fun i hi => tendsto_log_gridGroupOrder_div_nat (hK i hi) (hH i hi) (hpop i hi)) + +theorem tendsto_log_nat_weighted_prod_div_nat {I : Type*} (s : Finset I) (w : I → ℕ) + {K : I → ℕ → ℕ} {H : I → ℝ} + (hK : ∀ i ∈ s, ∀ N, 0 < K i N) + (hpop : ∀ i ∈ s, + Tendsto (fun N => Real.log (K i N : ℝ) / (N : ℝ)) atTop (nhds (H i))) : + Tendsto (fun N => Real.log ((∏ i ∈ s, (K i N) ^ w i : ℕ) : ℝ) / (N : ℝ)) + atTop (nhds (∑ i ∈ s, (w i : ℝ) * H i)) := by + apply tendsto_log_nat_prod_div_nat s + · intro i hi N + exact pow_pos (hK i hi N) _ + · intro i hi + simpa only [Nat.cast_pow, Real.log_pow, mul_div_assoc] using + (hpop i hi).const_mul (w i : ℝ) + +theorem tendsto_log_gridGroupOrder_weighted_prod_div_nat {I : Type*} + (s : Finset I) (w : I → ℕ) {K : I → ℕ → ℕ} {H : I → ℝ} + (hK : ∀ i ∈ s, ∀ N, 0 < K i N) (hH : ∀ i ∈ s, 0 ≤ H i) + (hpop : ∀ i ∈ s, + Tendsto (fun N => Real.log (K i N : ℝ) / (N : ℝ)) atTop (nhds (H i))) : + Tendsto + (fun N => Real.log ((∏ i ∈ s, gridGroupOrder (K i N) ^ w i : ℕ) : ℝ) / (N : ℝ)) + atTop (nhds (∑ i ∈ s, (w i : ℝ) * H i)) := by + exact tendsto_log_nat_weighted_prod_div_nat s w + (fun i hi N => gridGroupOrder_pos (K i N)) + (fun i hi => tendsto_log_gridGroupOrder_div_nat (hK i hi) (hH i hi) (hpop i hi)) + +end MatrixMultiplication.Foundation.Separation + + + + + + +namespace MatrixMultiplication.JointExtractionRates + +open Filter +open scoped BigOperators Topology + +def goodCount {Ω E : Type*} [Fintype E] (good : Ω → E → Prop) (ω : Ω) : ℕ := by + classical + exact (Finset.univ.filter (good ω)).card + +def goodIncidence {Ω E : Type*} [Fintype Ω] (good : Ω → E → Prop) (e : E) : ℕ := by + classical + exact (Finset.univ.filter (fun ω => good ω e)).card + +theorem sum_goodCount_eq_sum_goodIncidence {Ω E : Type*} [Fintype Ω] [Fintype E] + (good : Ω → E → Prop) : + (∑ ω, goodCount good ω) = ∑ e, goodIncidence good e := by + classical + simp only [goodCount, goodIncidence, Finset.card_filter] + exact Finset.sum_comm + +theorem exists_goodCount_ge {Ω E : Type*} [Fintype Ω] [Nonempty Ω] [Fintype E] + (good : Ω → E → Prop) (q : ℝ) + (hinc : ∀ e, q * (Fintype.card Ω : ℝ) ≤ (goodIncidence good e : ℝ)) : + ∃ ω, (Fintype.card E : ℝ) * q ≤ (goodCount good ω : ℝ) := by + have hsum := Finset.sum_le_sum (fun e (_ : e ∈ Finset.univ) => hinc e) + have hdouble : (∑ ω, (goodCount good ω : ℝ)) = + ∑ e, (goodIncidence good e : ℝ) := by + exact_mod_cast sum_goodCount_eq_sum_goodIncidence good + have havg : (∑ _ω : Ω, (Fintype.card E : ℝ) * q) ≤ + ∑ ω, (goodCount good ω : ℝ) := by + rw [hdouble] + simpa only [Finset.sum_const, Finset.card_univ, nsmul_eq_mul, mul_assoc, + mul_comm, mul_left_comm] using hsum + obtain ⟨ω, _, hω⟩ := Finset.exists_le_of_sum_le Finset.univ_nonempty havg + exact ⟨ω, hω⟩ + +theorem exists_good_subfamily {Ω E : Type*} [Fintype E] + (good : Ω → E → Prop) (ω : Ω) (K : ℕ) (hK : K ≤ goodCount good ω) : + ∃ G : Finset E, G.card = K ∧ ∀ e ∈ G, good ω e := by + classical + obtain ⟨G, hG, hcard⟩ := Finset.exists_subset_card_eq + (s := Finset.univ.filter (good ω)) (by simpa only [goodCount] using hK) + exact ⟨G, hcard, fun e he => (Finset.mem_filter.mp (hG he)).2⟩ + +theorem eventually_exists_good_subfamily {Ω E : ℕ → Type*} + [∀ N, Fintype (E N)] + (good : ∀ N, Ω N → E N → Prop) (K : ℕ → ℕ) + (hK : ∀ᶠ N in atTop, ∃ ω : Ω N, K N ≤ goodCount (good N) ω) : + ∀ᶠ N in atTop, ∃ (ω : Ω N) (G : Finset (E N)), + G.card = K N ∧ ∀ e ∈ G, good N ω e := by + filter_upwards [hK] with N hN + obtain ⟨ω, hω⟩ := hN + obtain ⟨G, hcard, hgood⟩ := exists_good_subfamily (good N) ω (K N) hω + exact ⟨ω, G, hcard, hgood⟩ + +theorem incidence_lower_of_survival_and_loss {Ω E : Type*} [Fintype Ω] + (survives bad : Ω → E → Prop) (e : E) (s ε : ℝ) + (hs : s * (Fintype.card Ω : ℝ) ≤ (goodIncidence survives e : ℝ)) + (hb : (goodIncidence (fun ω e => survives ω e ∧ bad ω e) e : ℝ) ≤ + s * ε * (Fintype.card Ω : ℝ)) : + s * (1 - ε) * (Fintype.card Ω : ℝ) ≤ + (goodIncidence (fun ω e => survives ω e ∧ ¬ bad ω e) e : ℝ) := by + classical + have hsplit : goodIncidence (fun ω e => survives ω e ∧ bad ω e) e + + goodIncidence (fun ω e => survives ω e ∧ ¬ bad ω e) e = + goodIncidence survives e := by + simp only [goodIncidence, Finset.card_filter, ← Finset.sum_add_distrib] + apply Finset.sum_congr rfl + intro ω _ + by_cases hs : survives ω e <;> by_cases hb : bad ω e <;> simp [hs, hb] + have hsplitR : + (goodIncidence (fun ω e => survives ω e ∧ bad ω e) e : ℝ) + + (goodIncidence (fun ω e => survives ω e ∧ ¬ bad ω e) e : ℝ) = + (goodIncidence survives e : ℝ) := by + exact_mod_cast hsplit + nlinarith + +theorem exists_goodCount_ge_half_survival {Ω E : Type*} + [Fintype Ω] [Nonempty Ω] [Fintype E] + (survives bad : Ω → E → Prop) (s ε : ℝ) (hs₀ : 0 ≤ s) (hε : ε ≤ 1 / 2) + (hs : ∀ e, s * (Fintype.card Ω : ℝ) ≤ (goodIncidence survives e : ℝ)) + (hb : ∀ e, (goodIncidence (fun ω e => survives ω e ∧ bad ω e) e : ℝ) ≤ + s * ε * (Fintype.card Ω : ℝ)) : + ∃ ω, (Fintype.card E : ℝ) * (s / 2) ≤ + (goodCount (fun ω e => survives ω e ∧ ¬ bad ω e) ω : ℝ) := by + apply exists_goodCount_ge + intro e + have h := incidence_lower_of_survival_and_loss survives bad e s ε (hs e) (hb e) + have hc : (0 : ℝ) ≤ Fintype.card Ω := Nat.cast_nonneg _ + have hm := mul_le_mul_of_nonneg_right (mul_le_mul_of_nonneg_left hε hs₀) hc + nlinarith + +theorem tendsto_polynomial_mul_exp_neg (d : ℕ) {c : ℝ} (hc : 0 < c) : + Tendsto (fun N : ℕ => ((N : ℝ) + 1) ^ d * Real.exp (-c * (N : ℝ))) + atTop (𝓝 0) := by + have hbase := (Real.summable_pow_mul_exp_neg_nat_mul d hc).tendsto_atTop_zero + have hshift := (hbase.comp (tendsto_add_atTop_nat 1)).mul_const (Real.exp c) + simp only [zero_mul, Function.comp_apply, Nat.cast_add, Nat.cast_one] at hshift + convert hshift using 1 + ext N + rw [mul_assoc, ← Real.exp_add] + congr 2 + ring + +theorem eventually_error_le_half {error : ℕ → ℝ} (B : ℝ) (d : ℕ) + {c : ℝ} (hc : 0 < c) + (hbound : ∀ᶠ N in atTop, + error N ≤ B * (((N : ℝ) + 1) ^ d * Real.exp (-c * (N : ℝ)))) : + ∀ᶠ N in atTop, error N ≤ 1 / 2 := by + have hlim := (tendsto_polynomial_mul_exp_neg d hc).const_mul B + have hsmall : ∀ᶠ N : ℕ in atTop, + B * (((N : ℝ) + 1) ^ d * Real.exp (-c * (N : ℝ))) < 1 / 2 := by + simpa only [mul_zero] using (tendsto_order.1 hlim).2 (1 / 2) (by simp) + filter_upwards [hbound, hsmall] with N hb hs + exact hb.trans hs.le + +theorem tendsto_log_one_sub_error_div_nat {error : ℕ → ℝ} + (herror : Tendsto error atTop (𝓝 0)) : + Tendsto (fun N => Real.log (1 - error N) / (N : ℝ)) atTop (𝓝 0) := by + have hone : Tendsto (fun N => 1 - error N) atTop (𝓝 (1 : ℝ)) := by + simpa using (tendsto_const_nhds : + Tendsto (fun _ : ℕ => (1 : ℝ)) atTop (𝓝 1)).sub herror + exact (hone.log one_ne_zero).div_atTop tendsto_natCast_atTop_atTop + +def hashModulus (H : ℝ) (N : ℕ) : ℕ := + 37 ^ (⌊(N : ℝ) * H / Real.log 37⌋₊ + 1) + +theorem hashModulus_ge (H : ℝ) (N : ℕ) : 37 ≤ hashModulus H N := by + simpa only [hashModulus, pow_one] using + (Nat.pow_le_pow_right (by norm_num : 0 < 37) + (show 1 ≤ ⌊(N : ℝ) * H / Real.log 37⌋₊ + 1 by omega)) + +theorem hashModulus_log_bounds {H : ℝ} (hH : 0 ≤ H) (N : ℕ) : + (N : ℝ) * H ≤ Real.log (hashModulus H N : ℝ) ∧ + Real.log (hashModulus H N : ℝ) ≤ (N : ℝ) * H + Real.log 37 := by + have hl : 0 < Real.log (37 : ℝ) := Real.log_pos (by norm_num) + have harg : 0 ≤ (N : ℝ) * H / Real.log 37 := + div_nonneg (mul_nonneg (Nat.cast_nonneg N) hH) hl.le + have hfloor := mul_le_mul_of_nonneg_right (Nat.floor_le harg) hl.le + have hceil := mul_lt_mul_of_pos_right + (Nat.lt_floor_add_one ((N : ℝ) * H / Real.log 37)) hl + have hcancel : (N : ℝ) * H / Real.log 37 * Real.log 37 = (N : ℝ) * H := + div_mul_cancel₀ _ hl.ne' + simp only [hashModulus, Nat.cast_pow, Real.log_pow, Nat.cast_add, Nat.cast_one] + constructor <;> nlinarith + +theorem tendsto_log_hashModulus_div_nat {H : ℝ} (hH : 0 ≤ H) : + Tendsto (fun N => Real.log (hashModulus H N : ℝ) / (N : ℝ)) + atTop (𝓝 H) := by + have hc : Tendsto (fun N : ℕ => Real.log 37 / (N : ℝ)) atTop (𝓝 0) := + tendsto_const_nhds.div_atTop tendsto_natCast_atTop_atTop + have hu : Tendsto (fun N : ℕ => H + Real.log 37 / (N : ℝ)) atTop (𝓝 H) := by + simpa only [add_zero] using hc.const_add H + apply tendsto_of_tendsto_of_tendsto_of_le_of_le' tendsto_const_nhds hu + · filter_upwards [eventually_ge_atTop (1 : ℕ)] with N hN + have hNr : (0 : ℝ) < N := by exact_mod_cast hN + apply (le_div_iff₀ hNr).2 + nlinarith [(hashModulus_log_bounds hH N).1] + · filter_upwards [eventually_ge_atTop (1 : ℕ)] with N hN + have hNr : (0 : ℝ) < N := by exact_mod_cast hN + have hb := div_le_div_of_nonneg_right (hashModulus_log_bounds hH N).2 hNr.le + simpa only [add_div, mul_div_cancel_left₀ H hNr.ne'] using hb + +theorem eventual_log_upper_of_error {degree : ℕ → ℕ} {error : ℕ → ℝ} {D : ℝ} + (herror : Tendsto (fun N => error N / (N : ℝ)) atTop (𝓝 0)) + (hbound : ∀ᶠ N in atTop, + Real.log (degree N : ℝ) ≤ (N : ℝ) * D + error N) + {η : ℝ} (hη : 0 < η) : + ∀ᶠ N in atTop, Real.log (degree N : ℝ) / (N : ℝ) ≤ D + η := by + filter_upwards [hbound, (tendsto_order.1 herror).2 η hη, + eventually_ge_atTop (1 : ℕ)] with N hb he hN + have hNr : (0 : ℝ) < N := by exact_mod_cast hN + have hd := div_le_div_of_nonneg_right hb hNr.le + rw [add_div, mul_div_cancel_left₀ D hNr.ne'] at hd + linarith + +theorem eventually_ratio_le_exp_neg_of_log_bounds {degree M : ℕ → ℕ} {D H c : ℝ} + (hdegree : ∀ η : ℝ, 0 < η → + ∀ᶠ N in atTop, Real.log (degree N : ℝ) / (N : ℝ) ≤ D + η) + (hpos : ∀ᶠ N in atTop, 0 < M N) + (hM : Tendsto (fun N => Real.log (M N : ℝ) / (N : ℝ)) atTop (𝓝 H)) + (hc : c < H - D) : + ∀ᶠ N in atTop, (degree N : ℝ) / (M N : ℝ) ≤ Real.exp (-c * (N : ℝ)) := by + let η : ℝ := (H - D - c) / 3 + have hη : 0 < η := by dsimp [η]; linarith + filter_upwards [hdegree η hη, hpos, + (tendsto_order.1 hM).1 (H - η) (by linarith), + eventually_ge_atTop (1 : ℕ)] with N hd hp hm hN + by_cases hz : degree N = 0 + · simp only [hz, Nat.cast_zero, zero_div] + exact (Real.exp_pos _).le + have hdpos : (0 : ℝ) < degree N := by + exact_mod_cast Nat.pos_of_ne_zero hz + have hmpos : (0 : ℝ) < M N := by exact_mod_cast hp + have hNr : (0 : ℝ) < N := by exact_mod_cast hN + have hdu := (div_le_iff₀ hNr).mp hd + have hml := (lt_div_iff₀ hNr).mp hm + have hcoefficient : D - H + 2 * η ≤ -c := by dsimp [η]; linarith + have hscaled := mul_le_mul_of_nonneg_right hcoefficient hNr.le + have hdiff : Real.log (degree N : ℝ) - Real.log (M N : ℝ) ≤ + -c * (N : ℝ) := by nlinarith + calc + _ = Real.exp (Real.log (degree N : ℝ) - Real.log (M N : ℝ)) := by + rw [Real.exp_sub, Real.exp_log hdpos, Real.exp_log hmpos] + _ ≤ _ := Real.exp_le_exp.mpr hdiff + +theorem eventually_degree_div_hashModulus_le_exp {degree : ℕ → ℕ} {D H c : ℝ} + (hH : 0 ≤ H) + (hdegree : ∀ η : ℝ, 0 < η → + ∀ᶠ N in atTop, Real.log (degree N : ℝ) / (N : ℝ) ≤ D + η) + (hc : c < H - D) : + ∀ᶠ N in atTop, (degree N : ℝ) / (hashModulus H N : ℝ) ≤ + Real.exp (-c * (N : ℝ)) := by + apply eventually_ratio_le_exp_neg_of_log_bounds hdegree _ + (tendsto_log_hashModulus_div_nat hH) hc + exact Eventually.of_forall fun N => + lt_of_lt_of_le (by decide : 0 < 37) (hashModulus_ge H N) + +theorem tendsto_sqrt_div_nat_of_div_nat {a : ℕ → ℝ} {A : ℝ} + (ha : ∀ N, 0 ≤ a N) + (h : Tendsto (fun N => a N / (N : ℝ)) atTop (𝓝 A)) : + Tendsto (fun N => Real.sqrt (a N) / (N : ℝ)) atTop (𝓝 0) := by + have hinv : Tendsto (fun N : ℕ => 1 / (N : ℝ)) atTop (𝓝 0) := + tendsto_const_nhds.div_atTop tendsto_natCast_atTop_atTop + have hp := h.sqrt.mul hinv.sqrt + simp only [Real.sqrt_zero, mul_zero] at hp + convert hp using 1 + ext N + symm + rw [Real.sqrt_div (ha N), Real.sqrt_div (by norm_num : (0 : ℝ) ≤ 1), + Real.sqrt_one, div_mul_div_comm, mul_one, Real.mul_self_sqrt (Nat.cast_nonneg N)] + +theorem tendsto_log_modularSet_card_div_nat {M : ℕ → ℕ} {H : ℝ} + (hM : ∀ᶠ N in atTop, 2 ≤ M N) + (hlog : Tendsto (fun N => Real.log (M N : ℝ) / (N : ℝ)) atTop (𝓝 H)) : + Tendsto (fun N => Real.log ((JointAPFree.modularSet (M N)).card : ℝ) / (N : ℝ)) + atTop (𝓝 H) := by + have hsqrt := tendsto_sqrt_div_nat_of_div_nat + (fun N => Real.log_natCast_nonneg (M N)) hlog + have hconst : Tendsto (fun N : ℕ => Real.log 3 / (N : ℝ)) atTop (𝓝 0) := + tendsto_const_nhds.div_atTop tendsto_natCast_atTop_atTop + have hlower : Tendsto (fun N => + (Real.log (M N : ℝ) - Real.log 3 - + 4 * Real.sqrt (Real.log (M N : ℝ))) / (N : ℝ)) + atTop (𝓝 H) := by + have h := (hlog.sub hconst).sub (hsqrt.const_mul 4) + simp only [mul_zero, sub_zero] at h + apply h.congr + intro N + ring + apply tendsto_of_tendsto_of_tendsto_of_le_of_le' hlower hlog + · filter_upwards [hM] with N hN + exact div_le_div_of_nonneg_right + (JointAPFree.modularSet_log_card_lower_modulus hN) (Nat.cast_nonneg N) + · filter_upwards [hM] with N hN + exact div_le_div_of_nonneg_right + (JointAPFree.modularSet_log_card_le_modulus hN) (Nat.cast_nonneg N) + +theorem tendsto_log_yield_lower {T U M : ℕ → ℕ} {A B C : ℝ} + (hT : Tendsto (fun N => Real.log (T N : ℝ) / (N : ℝ)) atTop (𝓝 A)) + (hU : Tendsto (fun N => Real.log (U N : ℝ) / (N : ℝ)) atTop (𝓝 B)) + (hM : Tendsto (fun N => Real.log (M N : ℝ) / (N : ℝ)) atTop (𝓝 C)) : + Tendsto (fun N => + (Real.log (T N : ℝ) + Real.log (U N : ℝ) - + 2 * Real.log (M N : ℝ) - Real.log 2) / (N : ℝ)) + atTop (𝓝 (A + B - 2 * C)) := by + have hconst : Tendsto (fun N : ℕ => Real.log 2 / (N : ℝ)) atTop (𝓝 0) := + tendsto_const_nhds.div_atTop tendsto_natCast_atTop_atTop + have h := ((hT.add hU).sub (hM.const_mul 2)).sub hconst + simp only [sub_zero] at h + apply h.congr + intro N + ring + +theorem exp_log_yield_lower {T U M : ℕ} (hT : 0 < T) (hU : 0 < U) (hM : 0 < M) : + Real.exp (Real.log (T : ℝ) + Real.log (U : ℝ) - + 2 * Real.log (M : ℝ) - Real.log 2) = + (T : ℝ) * ((U : ℝ) / (M : ℝ) ^ 2 / 2) := by + have hTr : (0 : ℝ) < T := by exact_mod_cast hT + have hUr : (0 : ℝ) < U := by exact_mod_cast hU + have hMr : (0 : ℝ) < M := by exact_mod_cast hM + rw [Real.exp_sub, Real.exp_sub, Real.exp_add, Real.exp_log hTr, + Real.exp_log hUr, Real.exp_log (by norm_num : (0 : ℝ) < 2)] + rw [show 2 * Real.log (M : ℝ) = Real.log ((M : ℝ) ^ 2) by + rw [Real.log_pow]; norm_num, Real.exp_log (pow_pos hMr 2)] + ring + +theorem eventually_floor_exp_le_of_log_lower {Y : ℕ → ℕ} {L : ℕ → ℝ} {R : ℝ} + (hL : Tendsto (fun N => L N / (N : ℝ)) atTop (𝓝 R)) + (hY : ∀ᶠ N in atTop, Real.exp (L N) ≤ (Y N : ℝ)) + {ε : ℝ} (hε : 0 < ε) : + ∀ᶠ N : ℕ in atTop, ⌊Real.exp ((N : ℝ) * (R - ε))⌋₊ ≤ Y N := by + filter_upwards [(tendsto_order.1 hL).1 (R - ε) (by linarith), hY, + (eventually_atTop.2 ⟨1, fun N (hN : 1 ≤ N) => hN⟩)] with N hrate hy hN + have hNr : (0 : ℝ) < N := by exact_mod_cast hN + have hexp : Real.exp ((N : ℝ) * (R - ε)) ≤ (Y N : ℝ) := by + apply le_trans (Real.exp_le_exp.mpr ?_) hy + have hm := (lt_div_iff₀ hNr).mp hrate + nlinarith + simpa only [Nat.floor_natCast] using Nat.floor_le_floor hexp + +theorem eventually_exists_many_good + {Ω E : ℕ → Type*} [∀ N, Fintype (Ω N)] [∀ N, Nonempty (Ω N)] + [∀ N, Fintype (E N)] + (good : ∀ N, Ω N → E N → Prop) (U M : ℕ → ℕ) {A H : ℝ} + (hpos : ∀ᶠ N in atTop, 0 < Fintype.card (E N) ∧ 0 < U N ∧ 0 < M N) + (hinc : ∀ᶠ N in atTop, ∀ e, + ((U N : ℝ) / (M N : ℝ) ^ 2 / 2) * (Fintype.card (Ω N) : ℝ) ≤ + (goodIncidence (good N) e : ℝ)) + (hE : Tendsto (fun N => Real.log (Fintype.card (E N) : ℝ) / (N : ℝ)) + atTop (𝓝 A)) + (hU : Tendsto (fun N => Real.log (U N : ℝ) / (N : ℝ)) atTop (𝓝 H)) + (hM : Tendsto (fun N => Real.log (M N : ℝ) / (N : ℝ)) atTop (𝓝 H)) + {ε : ℝ} (hε : 0 < ε) : + ∀ᶠ N in atTop, ∃ ω : Ω N, + ⌊Real.exp ((N : ℝ) * (A - H - ε))⌋₊ ≤ goodCount (good N) ω := by + let L : ℕ → ℝ := fun N => Real.log (Fintype.card (E N) : ℝ) + + Real.log (U N : ℝ) - 2 * Real.log (M N : ℝ) - Real.log 2 + have hL : Tendsto (fun N => L N / (N : ℝ)) atTop (𝓝 (A - H)) := by + simpa only [L, show A + H - 2 * H = A - H by ring] using + tendsto_log_yield_lower hE hU hM + filter_upwards [hpos, hinc, (tendsto_order.1 hL).1 (A - H - ε) (by linarith), + (eventually_atTop.2 ⟨1, fun N (hN : 1 ≤ N) => hN⟩)] with N hp hi hr hN + obtain ⟨ω, hω⟩ := exists_goodCount_ge (good N) _ hi + refine ⟨ω, ?_⟩ + have heq := exp_log_yield_lower hp.1 hp.2.1 hp.2.2 + have hNr : (0 : ℝ) < N := by exact_mod_cast hN + have he : Real.exp ((N : ℝ) * (A - H - ε)) ≤ + (goodCount (good N) ω : ℝ) := by + calc + _ ≤ Real.exp (L N) := Real.exp_le_exp.mpr (by + have hm := (lt_div_iff₀ hNr).mp hr + nlinarith) + _ = _ := heq + _ ≤ _ := hω + simpa only [Nat.floor_natCast] using Nat.floor_le_floor he + +theorem eventually_exists_many_good_explicit + {Ω E : ℕ → Type*} [∀ N, Fintype (Ω N)] [∀ N, Nonempty (Ω N)] + [∀ N, Fintype (E N)] + (good : ∀ N, Ω N → E N → Prop) {A H : ℝ} (hH : 0 ≤ H) + (hpos : ∀ᶠ N in atTop, 0 < Fintype.card (E N)) + (hinc : ∀ᶠ N in atTop, ∀ e, + (((JointAPFree.modularSet (hashModulus H N)).card : ℝ) / + (hashModulus H N : ℝ) ^ 2 / 2) * (Fintype.card (Ω N) : ℝ) ≤ + (goodIncidence (good N) e : ℝ)) + (hE : Tendsto (fun N => Real.log (Fintype.card (E N) : ℝ) / (N : ℝ)) + atTop (𝓝 A)) + {ε : ℝ} (hε : 0 < ε) : + ∀ᶠ N in atTop, ∃ ω : Ω N, + ⌊Real.exp ((N : ℝ) * (A - H - ε))⌋₊ ≤ goodCount (good N) ω := by + have hM : ∀ N, 2 ≤ hashModulus H N := fun N => + (by norm_num : 2 ≤ 37).trans (hashModulus_ge H N) + have hr := tendsto_log_hashModulus_div_nat hH + apply eventually_exists_many_good good + (fun N => (JointAPFree.modularSet (hashModulus H N)).card) (hashModulus H) + _ hinc hE (tendsto_log_modularSet_card_div_nat (Eventually.of_forall hM) hr) hr hε + filter_upwards [hpos] with N hN + exact ⟨hN, JointAPFree.modularSet_card_pos (hM N), + lt_of_lt_of_le (by decide : 0 < 2) (hM N)⟩ + +theorem fixed_product_subexponential {I : Type*} (s : Finset I) (R : I → ℕ → ℕ) + (hpos : ∀ i ∈ s, ∀ N, 0 < R i N) + (hR : ∀ i ∈ s, + Tendsto (fun N => Real.log (R i N : ℝ) / (N : ℝ)) atTop (𝓝 0)) : + Tendsto (fun N => Real.log ((∏ i ∈ s, R i N : ℕ) : ℝ) / (N : ℝ)) + atTop (𝓝 0) := by + simpa only [Finset.sum_const_zero] using + MatrixMultiplication.Foundation.Separation.tendsto_log_nat_prod_div_nat s hpos hR + +theorem presence_replications_subexponential (L : ℕ → ℕ) + (hL : Tendsto (fun N => (L N : ℝ) / (N : ℝ)) atTop (𝓝 0)) : + Tendsto (fun N => Real.log ((2 ^ (3 * L N) : ℕ) : ℝ) / (N : ℝ)) + atTop (𝓝 0) := by + have h := hL.const_mul (3 * Real.log 2) + simp only [mul_zero] at h + apply h.congr + intro N + rw [Nat.cast_pow, Real.log_pow] + push_cast + ring + +end MatrixMultiplication.JointExtractionRates + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/Entropy/JointMaskedRates.lean b/lean/OAI/LinearAlgebra/MatrixFields/Entropy/JointMaskedRates.lean new file mode 100644 index 0000000000000000000000000000000000000000..c7d9b35ea6137483bd42a8c66da9b162ac926fe0 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/Entropy/JointMaskedRates.lean @@ -0,0 +1,155 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Extraction.JointMaskedSelection + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section + +namespace MatrixMultiplication.JointMaskedRates + +open Filter JointCoarseHashing JointExtractionRates JointMaskedSelection +open JointOrdinarySelection (hashLevel hashSet) +open scoped Topology + +attribute [local instance] Classical.propDecidable + +def errorBound (degree : ℕ → ℕ) (B p : ℕ) (H : ℝ) (N : ℕ) : ℝ := + (degree N : ℝ) / (hashModulus H N : ℝ) * + (1 + (B : ℝ) * ((N : ℝ) + 1) ^ p * (N : ℝ)) + +theorem polynomialFactor_le (B p N : ℕ) : + 1 + (B : ℝ) * ((N : ℝ) + 1) ^ p * (N : ℝ) ≤ + ((B : ℝ) + 1) * ((N : ℝ) + 1) ^ (p + 1) := by + have hN : (0 : ℝ) ≤ N := Nat.cast_nonneg _ + have hx : (0 : ℝ) ≤ (N : ℝ) + 1 := by linarith + have hpower : (1 : ℝ) ≤ ((N : ℝ) + 1) ^ (p + 1) := + one_le_pow₀ (by linarith : (1 : ℝ) ≤ (N : ℝ) + 1) + calc + _ ≤ 1 + (B : ℝ) * ((N : ℝ) + 1) ^ p * ((N : ℝ) + 1) := + add_le_add le_rfl (mul_le_mul_of_nonneg_left (by linarith) + (mul_nonneg (Nat.cast_nonneg _) (pow_nonneg hx _))) + _ = 1 + (B : ℝ) * ((N : ℝ) + 1) ^ (p + 1) := by rw [pow_succ]; ring + _ ≤ ((N : ℝ) + 1) ^ (p + 1) + (B : ℝ) * ((N : ℝ) + 1) ^ (p + 1) := + add_le_add hpower le_rfl + _ = _ := by ring + +theorem eventually_errorBound_le_half (degree : ℕ → ℕ) (B p : ℕ) + {D H : ℝ} (hH : 0 ≤ H) (hgap : D < H) + (hdegreeRate : ∀ η : ℝ, 0 < η → + ∀ᶠ N in atTop, Real.log (degree N : ℝ) / (N : ℝ) ≤ D + η) : + ∀ᶠ N in atTop, errorBound degree B p H N ≤ 1 / 2 := by + let c : ℝ := (H - D) / 2 + have hc : 0 < c := by dsimp [c]; linarith + have hclt : c < H - D := by dsimp [c]; linarith + have hratio := eventually_degree_div_hashModulus_le_exp hH hdegreeRate hclt + apply eventually_error_le_half ((B : ℝ) + 1) (p + 1) hc + filter_upwards [hratio] with N hN + have hx : (0 : ℝ) ≤ (N : ℝ) + 1 := add_nonneg (Nat.cast_nonneg N) zero_le_one + have hfactor : 0 ≤ 1 + (B : ℝ) * ((N : ℝ) + 1) ^ p * (N : ℝ) := + add_nonneg zero_le_one + (mul_nonneg (mul_nonneg (Nat.cast_nonneg _) (pow_nonneg hx _)) (Nat.cast_nonneg _)) + calc + errorBound degree B p H N ≤ Real.exp (-c * (N : ℝ)) * + (1 + (B : ℝ) * ((N : ℝ) + 1) ^ p * (N : ℝ)) := + mul_le_mul_of_nonneg_right hN hfactor + _ ≤ Real.exp (-c * (N : ℝ)) * (((B : ℝ) + 1) * ((N : ℝ) + 1) ^ (p + 1)) := + mul_le_mul_of_nonneg_left (polynomialFactor_le B p N) (Real.exp_pos _).le + _ = ((B : ℝ) + 1) * (((N : ℝ) + 1) ^ (p + 1) * Real.exp (-c * (N : ℝ))) := by ring + +theorem count_error_le_envelope {P E O V : Type*} (d : OrbitData P E O V) + (e : E) (degree B p N M : ℕ) + (heligibility : (d.eligibilityCompetitors e).card ≤ degree) + (horbits : (d.orbits e).card ≤ B * (N + 1) ^ p) : + ((d.eligibilityCompetitors e).card : ℝ) / (M : ℝ) + + ((d.orbits e).card : ℝ) * (N : ℝ) * ((degree : ℝ) / (M : ℝ)) ≤ + (degree : ℝ) / (M : ℝ) * (1 + (B : ℝ) * ((N : ℝ) + 1) ^ p * (N : ℝ)) := by + have hdegreeR : ((d.eligibilityCompetitors e).card : ℝ) ≤ (degree : ℝ) := by + exact_mod_cast heligibility + have horbitsR : ((d.orbits e).card : ℝ) ≤ (B : ℝ) * ((N : ℝ) + 1) ^ p := by + exact_mod_cast horbits + have hratio : (0 : ℝ) ≤ (degree : ℝ) / (M : ℝ) := + div_nonneg (Nat.cast_nonneg _) (Nat.cast_nonneg _) + calc + _ ≤ (degree : ℝ) / (M : ℝ) + + ((B : ℝ) * ((N : ℝ) + 1) ^ p) * (N : ℝ) * ((degree : ℝ) / (M : ℝ)) := + add_le_add (div_le_div_of_nonneg_right hdegreeR (Nat.cast_nonneg _)) + (mul_le_mul_of_nonneg_right + (mul_le_mul_of_nonneg_right horbitsR (Nat.cast_nonneg _)) hratio) + _ = _ := by ring + +theorem eventually_exists_selection + {P E O V : ℕ → Type*} [∀ N, Fintype (P N)] [∀ N, Fintype (E N)] + (d : ∀ N, OrbitData (P N) (E N) (O N) (V N)) + (hinj : ∀ N, Function.Injective (d N).coarse) + (degree : ℕ → ℕ) (B p : ℕ) + (heligibility : ∀ N e, ((d N).eligibilityCompetitors e).card ≤ degree N) + (hdegree : ∀ N e, ∀ o ∈ (d N).orbits e, ∀ v ∈ (d N).passing e o, + ((d N).competitors e o v).card ≤ degree N) + (horbits : ∀ N e, ((d N).orbits e).card ≤ B * (N + 1) ^ p) + {A D H C₀ : ℝ} (hH : 0 ≤ H) (hgap : D < H) + (hdegreeRate : ∀ η : ℝ, 0 < η → + ∀ᶠ N in atTop, Real.log (degree N : ℝ) / (N : ℝ) ≤ D + η) + (hdet : ∀ᶠ N in atTop, ∀ e, ∀ o ∈ (d N).orbits e, + JointLossCounts.deterministicLossFraction ((d N).full e o) ((d N).passing e o) ≤ + C₀ / (N : ℝ)) + (hpos : ∀ᶠ N in atTop, 0 < Fintype.card (E N)) + (hE : Tendsto (fun N => Real.log (Fintype.card (E N) : ℝ) / (N : ℝ)) atTop (𝓝 A)) + {ε : ℝ} (hε : 0 < ε) : + ∀ᶠ N in atTop, ∃ (s : Sample (P N) (hashLevel H N)) (G : Finset (E N)), + G.card = ⌊Real.exp ((N : ℝ) * (A - H - ε))⌋₊ ∧ + (∀ e ∈ G, (d N).Good (hashLevel H N) (hashSet H N) (N : ℝ) e s) ∧ + (∀ e ∈ G, ∀ f ∈ G, e ≠ f → ((d N).coarse e).1 ≠ ((d N).coarse f).1) ∧ + ∀ e ∈ G, ∀ o ∈ (d N).orbits e, + JointLossCounts.missingFraction ((d N).full e o) ((d N).passing e o) + ((d N).variableBad (hashLevel H N) (hashSet H N) e o) s ≤ (C₀ + 1) / (N : ℝ) := by + classical + have huniform := eventually_errorBound_le_half degree B p hH hgap hdegreeRate + have hsmall : ∀ᶠ N in atTop, ∀ e, + (((d N).eligibilityCompetitors e).card : ℝ) / (hashModulus H N : ℝ) + + (((d N).orbits e).card : ℝ) * (N : ℝ) * + ((degree N : ℝ) / (hashModulus H N : ℝ)) ≤ 1 / 2 := by + filter_upwards [huniform] with N hN e + exact (count_error_le_envelope (d N) e (degree N) B p N (hashModulus H N) + (heligibility N e) (horbits N e)).trans hN + have hpositive : ∀ᶠ N : ℕ in atTop, (0 : ℝ) < N := by + filter_upwards [eventually_gt_atTop (0 : ℕ)] with N hN + exact_mod_cast hN + let good := fun N (s : Sample (P N) (hashLevel H N)) (e : E N) => + (d N).Good (hashLevel H N) (hashSet H N) (N : ℝ) e s + have hinc : ∀ᶠ N in atTop, ∀ e, + (((JointAPFree.modularSet (hashModulus H N)).card : ℝ) / + (hashModulus H N : ℝ) ^ 2 / 2) * + (Fintype.card (Sample (P N) (hashLevel H N)) : ℝ) ≤ + (goodIncidence (good N) e : ℝ) := by + filter_upwards [hsmall, hpositive] with N hN hNpos e + rw [show goodIncidence (good N) e = + ((d N).goodEvent (hashLevel H N) (hashSet H N) (N : ℝ) e).card from + (d N).goodIncidence_eq _ _ _ _] + exact (d N).goodEvent_card_lower (hashLevel H N) (hashSet H N) (N : ℝ) hNpos e + (degree N) (hdegree N e) (hN e) + have hyield := eventually_exists_many_good_explicit good hH hpos hinc hE hε + have hselection := eventually_exists_good_subfamily good + (fun N => ⌊Real.exp ((N : ℝ) * (A - H - ε))⌋₊) hyield + filter_upwards [hselection, hdet] with N hN hdetN + obtain ⟨s, G, hcard, hgood⟩ := hN + refine ⟨s, G, hcard, hgood, ?_, ?_⟩ + · intro e he f hf hne + exact (d N).good_no_shared_x (hashLevel H N) (hashSet H N) (N : ℝ) f e s + (hgood f hf) (hgood e he) (fun h => hne ((hinj N) h)) + · intro e he o ho + exact (d N).good_missingFraction_le (hashLevel H N) (hashSet H N) C₀ (N : ℝ) e s + (hgood e he) (hdetN e) o ho + +end MatrixMultiplication.JointMaskedRates + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/Entropy/NativeLaws.lean b/lean/OAI/LinearAlgebra/MatrixFields/Entropy/NativeLaws.lean new file mode 100644 index 0000000000000000000000000000000000000000..130d85f10813de48cd67f143a412e4eec6c17910 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/Entropy/NativeLaws.lean @@ -0,0 +1,183 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Extraction.ComplexRationalTypes +import OAI.LinearAlgebra.MatrixFields.Parameters.NativeCapacity + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +noncomputable section + +namespace MatrixMultiplication.AllFieldNativeCapacity + +open MatrixMultiplication.Foundation AllFieldParameters AllFieldHistory +open scoped BigOperators + +def indexedRationalLaw (support : List Shape) (p : Shape → ℚ) + (hpos : ∀ u ∈ support, 0 ≤ p u) (htotal : (support.map p).sum = 1) : + RationalLaw (Fin support.length) where + mass j := p (support.get j) + nonneg j := hpos _ (List.get_mem _ _) + total := by + simp only [List.get_eq_getElem] + rw [Fin.sum_univ_fun_getElem] + exact htotal + +def stageASplitLaw (g : Shape) (hg : g ∈ positiveInitial) : + FiniteLaw (Fin (below g).length) := + (indexedRationalLaw (below g) (stageALaw g) + (fun u hu => (stageALaw_positive g u hu).le) (stageALaw_normalized g hg)).toFiniteLaw + +def stageBSplitLaw (t : Shape) (ht : t ∈ positiveSecond) : + FiniteLaw (Fin (below t).length) := + (indexedRationalLaw (below t) (stageBLaw t) + (fun u hu => (stageBLaw_positive t u hu).le) (stageBLaw_normalized t ht)).toFiniteLaw + +def indexedMarginalLaw (support : List Shape) (p : Shape → ℚ) + (hpos : ∀ u ∈ support, 0 ≤ p u) (htotal : (support.map p).sum = 1) + (side : Fin 3) (hbound : ∀ u ∈ support, u side < 17) : FiniteLaw (Fin 17) := + (indexedRationalLaw support p hpos htotal).toFiniteLaw.map + (fun j => ⟨support.get j side, hbound _ (List.get_mem _ _)⟩) + +theorem indexedMarginalLaw_mass (support : List Shape) (p : Shape → ℚ) + (hpos : ∀ u ∈ support, 0 ≤ p u) (htotal : (support.map p).sum = 1) + (side : Fin 3) (hbound : ∀ u ∈ support, u side < 17) (k : Fin 17) : + (indexedMarginalLaw support p hpos htotal side hbound).mass k = + marginal support (fun u => (p u : ℝ)) side k := by + simp only [indexedMarginalLaw, FiniteLaw.map_mass, RationalLaw.toFiniteLaw_mass, + indexedRationalLaw, Fin.ext_iff, marginal, List.get_eq_getElem] + exact Fin.sum_univ_fun_getElem support (fun u : Shape => if u side = k.val then (p u : ℝ) else 0) + +def stageAMarginalLaw (g : Shape) (hg : g ∈ positiveInitial) (side : Fin 3) : + FiniteLaw (Fin 17) := + indexedMarginalLaw (below g) (stageALaw g) + (fun u hu => (stageALaw_positive g u hu).le) (stageALaw_normalized g hg) side + (fun _ hu => Nat.lt_succ_of_le ((below_le hu side).trans + ((positiveInitial_shape_spec g hg).1 side))) + +def stageBMarginalLaw (t : Shape) (ht : t ∈ positiveSecond) (side : Fin 3) : + FiniteLaw (Fin 17) := + indexedMarginalLaw (below t) (stageBLaw t) + (fun u hu => (stageBLaw_positive t u hu).le) (stageBLaw_normalized t ht) side + (fun _ hu => Nat.lt_succ_of_le ((below_le hu side).trans + ((positiveSecond_shape_spec t ht).1 side))) + +theorem stageACapacity_first_entropy (g : Shape) (hg : g ∈ positiveInitial) : + stageACapacity g 0 = finiteEntropy (stageAMarginalLaw g hg 0).mass := by + rw [stageACapacity, nativeCapacity_first] + simp only [Equiv.refl_apply] + have hm : (stageAMarginalLaw g hg 0).mass = + marginal (below g) (fun u => (stageALaw g u : ℝ)) 0 := by + funext k + exact indexedMarginalLaw_mass _ _ _ _ _ _ k + rw [← hm] + exact homogeneousEntropy_normalized _ (stageAMarginalLaw g hg 0).total + +theorem stageBCapacity_first_entropy (t : Shape) (ht : t ∈ positiveSecond) : + stageBCapacity t 0 = + finiteEntropy (stageBMarginalLaw t ht (stageBPriority t 0)).mass := by + rw [stageBCapacity, nativeCapacity_first] + have hm : (stageBMarginalLaw t ht (stageBPriority t 0)).mass = + marginal (below t) (fun u => (stageBLaw t u : ℝ)) (stageBPriority t 0) := by + funext k + exact indexedMarginalLaw_mass _ _ _ _ _ _ k + rw [← hm] + exact homogeneousEntropy_normalized _ (stageBMarginalLaw t ht (stageBPriority t 0)).total + +def halfFiniteLaw (t : Shape) (ht : t ∈ shapes 8) (side : Fin 3) : FiniteLaw PairSlot where + mass a := (halfLaw t side a : ℝ) + nonneg a := by exact_mod_cast halfLaw_nonnegative t side a + total := by exact_mod_cast halfLaw_normalized t ht side + +def littleFiniteLaw (t u : Shape) (side : Fin 3) : FiniteLaw (Fin 6) where + mass a := (littleLaw t u side a : ℝ) + nonneg a := by exact_mod_cast littleLaw_nonnegative t u side a + total := by exact_mod_cast littleLaw_normalized t u side + +private theorem list_rat_cast_inline_MatrixMultiplication_AllFieldNativeLaws {I : Type*} (xs : List I) (f : I → ℚ) : + ((xs.map f).sum : ℝ) = (xs.map fun i => (f i : ℝ)).sum := by + induction xs with + | nil => simp + | cons i xs ih => simp [ih] + +theorem pairLaw_total {A : Type*} [Fintype A] (support : List Shape) (s : Shape) + (p : Shape → ℝ) (q : Shape → A → ℝ) + (hleft : ∀ u ∈ support, ∑ a, q u a = 1) + (hright : ∀ u ∈ support, ∑ a, q (complement s u) a = 1) : + (∑ ij : A × A, pairLaw support s p q ij) = (support.map p).sum := by + unfold pairLaw + induction support with + | nil => simp + | cons u us ih => + have hl := hleft u (by simp) + have hr := hright u (by simp) + have hh : (∑ ij : A × A, p u * q u ij.1 * q (complement s u) ij.2) = p u := by + simp [Fintype.sum_prod_type, ← Finset.mul_sum, hl, hr] + have ht := ih (fun v hv => hleft v (by simp [hv])) + (fun v hv => hright v (by simp [hv])) + simpa only [List.map_cons, List.sum_cons, Finset.sum_add_distrib, hh] using + congrArg (fun x => p u + x) ht + +def pairFiniteLaw {A : Type*} [Fintype A] (support : List Shape) (s : Shape) + (p : Shape → ℝ) (q : Shape → A → ℝ) + (hpos : ∀ u ∈ support, 0 ≤ p u) (htotal : (support.map p).sum = 1) + (hqpos : ∀ u a, 0 ≤ q u a) + (hleft : ∀ u ∈ support, ∑ a, q u a = 1) + (hright : ∀ u ∈ support, ∑ a, q (complement s u) a = 1) : FiniteLaw (A × A) where + mass := pairLaw support s p q + nonneg ij := by + apply List.sum_nonneg + intro x hx + obtain ⟨u, hu, rfl⟩ := List.mem_map.mp hx + exact mul_nonneg (mul_nonneg (hpos u hu) (hqpos u ij.1)) + (hqpos (complement s u) ij.2) + total := (pairLaw_total support s p q hleft hright).trans htotal + +def stageAPairLaw (g : Shape) (hg : g ∈ positiveInitial) (side : Fin 3) : + FiniteLaw (PairSlot × PairSlot) := + pairFiniteLaw (below g) g (fun u => (stageALaw g u : ℝ)) + (fun u a => (halfLaw u side a : ℝ)) + (fun u hu => Rat.cast_nonneg.mpr (stageALaw_positive g u hu).le) + (by rw [← list_rat_cast_inline_MatrixMultiplication_AllFieldNativeLaws, stageALaw_normalized g hg]; norm_num) + (fun u a => Rat.cast_nonneg.mpr (halfLaw_nonnegative u side a)) + (fun u hu => (halfFiniteLaw u (stageA_children_size g hg u hu) side).total) + (fun u hu => (halfFiniteLaw (complement g u) + (stageA_children_size g hg _ (stageA_support_complement g hg u hu).1) side).total) + +def stageBPairLaw (t : Shape) (ht : t ∈ positiveSecond) (side : Fin 3) : + FiniteLaw (Fin 6 × Fin 6) := + pairFiniteLaw (below t) t (fun u => (stageBLaw t u : ℝ)) + (fun u a => (littleLaw t u side a : ℝ)) + (fun u hu => Rat.cast_nonneg.mpr (stageBLaw_positive t u hu).le) + (by rw [← list_rat_cast_inline_MatrixMultiplication_AllFieldNativeLaws, stageBLaw_normalized t ht]; norm_num) + (fun u a => Rat.cast_nonneg.mpr (littleLaw_nonnegative t u side a)) + (fun u _ => (littleFiniteLaw t u side).total) + (fun u _ => (littleFiniteLaw t (complement t u) side).total) + +theorem stageACapacity_sharing (g : Shape) (hg : g ∈ positiveInitial) + (i : Fin 3) (hi : i ≠ 0) : + stageACapacity g i = finiteEntropy (stageAPairLaw g hg i).mass - + 2 * groupedEntropy (below g) (fun u => (stageALaw g u : ℝ)) + (Equiv.refl (Fin 3)) i (fun u a => (halfLaw u i a : ℝ)) := by + rw [stageACapacity, nativeCapacity_sharing _ _ _ _ _ i hi] + congr 1 + exact homogeneousEntropy_normalized _ (stageAPairLaw g hg i).total + +theorem stageBCapacity_sharing (t : Shape) (ht : t ∈ positiveSecond) + (i : Fin 3) (hi : i ≠ 0) : + stageBCapacity t i = finiteEntropy (stageBPairLaw t ht (stageBPriority t i)).mass - + 2 * groupedEntropy (below t) (fun u => (stageBLaw t u : ℝ)) + (stageBPriority t) i (fun u a => (littleLaw t u (stageBPriority t i) a : ℝ)) := by + rw [stageBCapacity, nativeCapacity_sharing _ _ _ _ _ i hi] + congr 1 + exact homogeneousEntropy_normalized _ (stageBPairLaw t ht (stageBPriority t i)).total + +end MatrixMultiplication.AllFieldNativeCapacity + +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/Entropy/ParametersHalfLaws.lean b/lean/OAI/LinearAlgebra/MatrixFields/Entropy/ParametersHalfLaws.lean new file mode 100644 index 0000000000000000000000000000000000000000..0d349d17fb3a92a7830440e6ea5bf5960b96153b --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/Entropy/ParametersHalfLaws.lean @@ -0,0 +1,265 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Parameters.ComplementSums +import OAI.LinearAlgebra.MatrixFields.Parameters.ParametersCompatibility + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +namespace MatrixMultiplication.AllFieldParameters + +open scoped BigOperators + +theorem stageBLaw_nonnegative (t u : Shape) : 0 ≤ stageBLaw t u := by + by_cases hu : u ∈ below t + · exact (stageBLaw_positive t u hu).le + · simp [stageBLaw, splitLaw, hu] + +theorem orderedPairs_mem_iff (t : Shape) (i j : Fin 6) : + (i,j) ∈ orderedPairs t ↔ statisticWeight i + statisticWeight j = shapeMax t := by + constructor + · exact orderedPairs_support t (i,j) + · intro h + apply List.mem_flatMap.mpr + refine ⟨i, by simp, ?_⟩ + apply List.mem_filterMap.mpr + exact ⟨j, by simp, by simp [h]⟩ + +theorem zeroPairLaw_nonnegative (t : Shape) (i j : Fin 6) : 0 ≤ zeroPairLaw t i j := by + unfold zeroPairLaw + split_ifs + · exact div_nonneg (orderedPairWeight_positive t i j).le + (list_sum_map_nonnegative _ _ (fun ij _ => (orderedPairWeight_positive t ij.1 ij.2).le)) + · exact le_rfl + +theorem zeroPairLaw_full_normalized (t : Shape) (ht : t ∈ zeroSecond) : + ∑ ij : PairSlot, zeroPairLaw t ij.1 ij.2 = 1 := by + calc + _ = ∑ ij ∈ (orderedPairs t).toFinset, zeroPairLaw t ij.1 ij.2 := by + symm + apply Finset.sum_subset (Finset.subset_univ _) + intro ij _ hij + have hs : statisticWeight ij.1 + statisticWeight ij.2 ≠ shapeMax t := by + intro h + exact hij (List.mem_toFinset.mpr ((orderedPairs_mem_iff t ij.1 ij.2).mpr h)) + simp [zeroPairLaw, hs] + _ = ((orderedPairs t).map (fun ij => zeroPairLaw t ij.1 ij.2)).sum := + List.sum_toFinset _ (ordered_pairs_nodup t ht) + _ = 1 := zeroPairLaw_normalized t ht + +def positiveHalfLaw (t : Shape) (w : Fin 3) (ij : PairSlot) : ℚ := + ((below t).map fun u => stageBLaw t u * littleLaw t u w ij.1 * + littleLaw t (complement t u) w ij.2).sum + +theorem positiveHalfLaw_nonnegative (t : Shape) (w : Fin 3) (ij : PairSlot) : + 0 ≤ positiveHalfLaw t w ij := by + apply list_sum_map_nonnegative + intro u _ + exact mul_nonneg (mul_nonneg (stageBLaw_nonnegative t u) + (littleLaw_nonnegative t u w ij.1)) + (littleLaw_nonnegative t (complement t u) w ij.2) + +theorem sum_pair_mixture {A : Type*} (xs : List A) (mass : A → ℚ) + (left right : A → Fin 6 → ℚ) + (hl : ∀ x ∈ xs, ∑ i, left x i = 1) + (hr : ∀ x ∈ xs, ∑ i, right x i = 1) : + (∑ ij : PairSlot, (xs.map fun x => mass x * left x ij.1 * right x ij.2).sum) = + (xs.map mass).sum := by + induction xs with + | nil => simp + | cons x xs ih => + have hleft := hl x (by simp) + have hright := hr x (by simp) + have hhead : (∑ ij : PairSlot, mass x * left x ij.1 * right x ij.2) = mass x := by + simp [Fintype.sum_prod_type, ← Finset.mul_sum, hleft, hright] + have htail := ih (fun y hy => hl y (by simp [hy])) (fun y hy => hr y (by simp [hy])) + simpa only [List.map_cons, List.sum_cons, Finset.sum_add_distrib, hhead] using + congrArg (fun q : ℚ => mass x + q) htail + +theorem positiveHalfLaw_normalized (t : Shape) (ht : t ∈ positiveSecond) (w : Fin 3) : + ∑ ij : PairSlot, positiveHalfLaw t w ij = 1 := by + unfold positiveHalfLaw + rw [sum_pair_mixture _ _ _ _ (fun u _ => littleLaw_normalized t u w) + (fun u _ => littleLaw_normalized t (complement t u) w)] + exact stageBLaw_normalized t ht + +theorem stageB_complement_permutation : ∀ t ∈ positiveSecond, + ((below t).map (complement t)).Perm (below t) := by decide +kernel + +theorem stageB_complement_involution (t : Shape) (ht : t ∈ positiveSecond) + (u : Shape) (hu : u ∈ below t) : complement t (complement t u) = u := by + funext w + exact Nat.sub_sub_self ((stageB_support_complement t ht u hu).2 w) + +theorem positiveHalfLaw_swap (t : Shape) (ht : t ∈ positiveSecond) + (w : Fin 3) (i j : Fin 6) : positiveHalfLaw t w (i,j) = positiveHalfLaw t w (j,i) := by + let f := fun u => stageBLaw t u * littleLaw t u w i * littleLaw t (complement t u) w j + let g := fun u => stageBLaw t u * littleLaw t u w j * littleLaw t (complement t u) w i + have hp := (stageB_complement_permutation t ht).map f + have hm : ((below t).map (complement t)).map f = (below t).map g := by + rw [List.map_map] + apply List.map_congr_left + intro u hu + dsimp only [Function.comp_def, f, g] + rw [stageBLaw_complement t u ht hu, stageB_complement_involution t ht u hu] + ring + change ((below t).map f).sum = ((below t).map g).sum + rw [← hp.sum_eq, hm] + +def halfMaxAxis (t : Shape) : Fin 3 := + (([0,1,2] : List (Fin 3)).find? (fun w => t w == shapeMax t)).getD 0 + +def halfLaw (t : Shape) (w : Fin 3) (ij : PairSlot) : ℚ := + if positive t then positiveHalfLaw t w ij + else if t w = 0 then if ij = (0,0) then 1 else 0 + else if w = halfMaxAxis t then zeroPairLaw t ij.1 ij.2 + else zeroPairLaw t (kappa ij.1) (kappa ij.2) + +theorem halfLaw_positive_parent (t : Shape) (ht : t ∈ positiveSecond) + (w : Fin 3) (ij : PairSlot) : halfLaw t w ij = positiveHalfLaw t w ij := by + have hp : positive t = true := (List.mem_filter.mp ht).2 + simp [halfLaw, hp] + +theorem halfLaw_swap (t : Shape) (ht : t ∈ shapes 8) (w : Fin 3) (i j : Fin 6) : + halfLaw t w (i,j) = halfLaw t w (j,i) := by + by_cases hp : positive t = true + · simp only [halfLaw, hp, ite_true] + exact positiveHalfLaw_swap t (List.mem_filter.mpr ⟨ht, hp⟩) w i j + · unfold halfLaw + simp only [hp, Bool.false_eq_true, ite_false] + by_cases hw : t w = 0 + · simp [hw, Prod.mk.injEq, and_comm] + · simp only [hw, ite_false] + by_cases hm : w = halfMaxAxis t + · simpa only [hm, ite_true] using zeroPairLaw_swap t i j + · simpa only [hm, ite_false] using zeroPairLaw_swap t (kappa i) (kappa j) + +theorem halfLaw_nonnegative (t : Shape) (w : Fin 3) (ij : PairSlot) : + 0 ≤ halfLaw t w ij := by + unfold halfLaw + split_ifs + · exact positiveHalfLaw_nonnegative t w ij + · norm_num + · exact le_rfl + · exact zeroPairLaw_nonnegative t ij.1 ij.2 + · exact zeroPairLaw_nonnegative t (kappa ij.1) (kappa ij.2) + +def kappaEquiv : Fin 6 ≃ Fin 6 where + toFun := kappa + invFun := kappa + left_inv := kappa_involution + right_inv := kappa_involution + +theorem sum_pair_kappa (f : PairSlot → ℚ) : + (∑ ij : PairSlot, f (kappa ij.1, kappa ij.2)) = ∑ ij, f ij := + (Equiv.prodCongr kappaEquiv kappaEquiv).sum_comp f + +theorem halfLaw_normalized (t : Shape) (ht : t ∈ shapes 8) (w : Fin 3) : + ∑ ij : PairSlot, halfLaw t w ij = 1 := by + by_cases hp : positive t = true + · simp only [halfLaw, hp, ite_true] + exact positiveHalfLaw_normalized t (List.mem_filter.mpr ⟨ht, hp⟩) w + · have hz : t ∈ zeroSecond := by simp [zeroSecond, ht, hp] + simp only [halfLaw, hp, Bool.false_eq_true, ite_false] + by_cases hw : t w = 0 + · simp [hw] + · simp only [hw, ite_false] + by_cases hm : w = halfMaxAxis t + · simpa only [hm, ite_true] using zeroPairLaw_full_normalized t hz + · simp only [hm, ite_false] + rw [sum_pair_kappa (fun ij => zeroPairLaw t ij.1 ij.2)] + exact zeroPairLaw_full_normalized t hz + +theorem positiveHalfLaw_outside_support (t : Shape) (ht : t ∈ positiveSecond) + (w : Fin 3) (ij : PairSlot) + (h : statisticWeight ij.1 + statisticWeight ij.2 ≠ t w) : + positiveHalfLaw t w ij = 0 := by + unfold positiveHalfLaw + have he : (below t).map (fun u => stageBLaw t u * littleLaw t u w ij.1 * + littleLaw t (complement t u) w ij.2) = (below t).map (fun _ => (0 : ℚ)) := by + apply List.map_congr_left + intro u hu + obtain ⟨hc, hb⟩ := stageB_support_complement t ht u hu + by_cases hi : statisticWeight ij.1 = u w + · have hj : statisticWeight ij.2 ≠ complement t u w := by + intro hj + apply h + rw [hi, hj] + change u w + (t w - u w) = t w + have hw := hb w + omega + rw [littleLaw_outside_support t (complement t u) w + (child_statistic_weight_bounded t ht (complement t u) hc w) ij.2 hj, mul_zero] + · rw [littleLaw_outside_support t u w + (child_statistic_weight_bounded t ht u hu w) ij.1 hi, mul_zero, zero_mul] + rw [he] + simp + +theorem halfMaxAxis_spec : ∀ t ∈ shapes 8, t (halfMaxAxis t) = shapeMax t := by + decide +kernel + +theorem zero_other_axis_spec : ∀ t ∈ zeroSecond, ∀ w : Fin 3, + t w ≠ 0 → w ≠ halfMaxAxis t → t w + shapeMax t = 8 := by decide +kernel + +theorem statisticWeight_le_four (i : Fin 6) : statisticWeight i ≤ 4 := by + revert i + decide +kernel + +theorem halfLaw_outside_support (t : Shape) (ht : t ∈ shapes 8) + (w : Fin 3) (ij : PairSlot) + (h : statisticWeight ij.1 + statisticWeight ij.2 ≠ t w) : + halfLaw t w ij = 0 := by + by_cases hp : positive t = true + · simp only [halfLaw, hp, ite_true] + exact positiveHalfLaw_outside_support t (List.mem_filter.mpr ⟨ht, hp⟩) w ij h + · have hz : t ∈ zeroSecond := by simp [zeroSecond, ht, hp] + simp only [halfLaw, hp, Bool.false_eq_true, ite_false] + by_cases hw : t w = 0 + · have hij : ij ≠ (0,0) := by + intro hij + apply h + rw [hij, hw] + rfl + rw [ite_eq_left hw, ite_eq_right hij] + · simp only [hw, ite_false] + by_cases hm : w = halfMaxAxis t + · have hs : statisticWeight ij.1 + statisticWeight ij.2 ≠ shapeMax t := by + simpa only [hm, halfMaxAxis_spec t ht] using h + simp [hm, zeroPairLaw, hs] + · have hs : statisticWeight (kappa ij.1) + statisticWeight (kappa ij.2) ≠ + shapeMax t := by + have htotal := zero_other_axis_spec t hz w hw hm + have hi := statisticWeight_le_four ij.1 + have hj := statisticWeight_le_four ij.2 + simp only [statisticWeight_kappa] + omega + simp [hm, zeroPairLaw, hs] + +theorem zero_nonzero_axes_distinguished : ∀ t ∈ zeroSecond, ∀ w v : Fin 3, + t w ≠ 0 → t v ≠ 0 → w ≠ v → + (w = halfMaxAxis t ↔ v ≠ halfMaxAxis t) := by decide +kernel + +theorem halfLaw_zero_complement (t : Shape) (ht : t ∈ zeroSecond) + (w v : Fin 3) (hw : t w ≠ 0) (hv : t v ≠ 0) (hwv : w ≠ v) (ij : PairSlot) : + halfLaw t w (kappa ij.1, kappa ij.2) = halfLaw t v ij := by + have hp : positive t ≠ true := by + have h := (List.mem_filter.mp ht).2 + simpa using h + have hm := zero_nonzero_axes_distinguished t ht w v hw hv hwv + by_cases ha : w = halfMaxAxis t + · have hb : v ≠ halfMaxAxis t := hm.mp ha + have hmax : t (halfMaxAxis t) ≠ 0 := by simpa only [ha] using hw + simp [halfLaw, hp, hv, ha, hb, hmax] + · have hb : v = halfMaxAxis t := by + by_contra hne + exact ha (hm.mpr hne) + have hmax : t (halfMaxAxis t) ≠ 0 := by simpa only [hb] using hv + simp [halfLaw, hp, hw, ha, hb, hmax, kappa_involution] + +end MatrixMultiplication.AllFieldParameters + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/Entropy/RateLimit.lean b/lean/OAI/LinearAlgebra/MatrixFields/Entropy/RateLimit.lean new file mode 100644 index 0000000000000000000000000000000000000000..59cdd5f2ce81675f07a29e53a92e867135b31a08 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/Entropy/RateLimit.lean @@ -0,0 +1,180 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Construction.InitialState + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +noncomputable section + +namespace MatrixMultiplication.AllFieldRateLimit + +open Filter +open scoped Topology + +variable {F : Type*} [Field F] + +structure HasRates (W : ℕ → AllFieldWitness F) (scale : ℕ → ℝ) + (Y S R : ℝ) : Prop where + scale_positive : ∀ᶠ n in atTop, 0 < scale n + yield_limit : Tendsto (fun n => Real.log ((W n).multiplicity : ℝ) / scale n) atTop (𝓝 Y) + volume_limit : Tendsto (fun n => Real.log ((W n).volume : ℝ) / scale n) atTop (𝓝 S) + rank_limit : Tendsto (fun n => Real.log ((W n).rankBound : ℝ) / scale n) atTop (𝓝 R) + +structure HasRateBounds (W : ℕ → AllFieldWitness F) (scale : ℕ → ℝ) + (Y S R : ℝ) : Prop where + scale_positive : ∀ᶠ n in atTop, 0 < scale n + yield_lower : ∀ ε : ℝ, 0 < ε → ∀ᶠ n in atTop, + Y - ε ≤ Real.log ((W n).multiplicity : ℝ) / scale n + volume_lower : ∀ ε : ℝ, 0 < ε → ∀ᶠ n in atTop, + S - ε ≤ Real.log ((W n).volume : ℝ) / scale n + rank_upper : ∀ ε : ℝ, 0 < ε → ∀ᶠ n in atTop, + Real.log ((W n).rankBound : ℝ) / scale n ≤ R + ε + +theorem HasRates.toBounds {W : ℕ → AllFieldWitness F} {scale : ℕ → ℝ} + {Y S R : ℝ} (h : HasRates W scale Y S R) : HasRateBounds W scale Y S R where + scale_positive := h.scale_positive + yield_lower ε hε := (h.yield_limit.eventually_const_lt (by linarith : Y - ε < Y)).mono + (fun _ hn => hn.le) + volume_lower ε hε := (h.volume_limit.eventually_const_lt (by linarith : S - ε < S)).mono + (fun _ hn => hn.le) + rank_upper ε hε := (h.rank_limit.eventually_lt_const (by linarith : R < R + ε)).mono + (fun _ hn => hn.le) + +theorem inequality_of_rates {W : ℕ → AllFieldWitness F} {scale : ℕ → ℝ} + {Y S R : ℝ} (h : HasRates W scale Y S R) : + Y + (Arithmetic.omega F / 3) * S ≤ R := by + apply le_of_tendsto_of_tendsto + (h.yield_limit.add (h.volume_limit.const_mul (Arithmetic.omega F / 3))) h.rank_limit + filter_upwards [h.scale_positive] with n hn + have hb := div_le_div_of_nonneg_right (W n).log_inequality hn.le + simpa only [add_div, mul_div_assoc] using hb + +theorem inequality_of_rateBounds {W : ℕ → AllFieldWitness F} {scale : ℕ → ℝ} + {Y S R : ℝ} (h : HasRateBounds W scale Y S R) : + Y + (Arithmetic.omega F / 3) * S ≤ R := by + apply le_of_forall_pos_le_add + intro ε hε + have hδ : 0 < ε / 3 := by positivity + obtain ⟨n, hnscale, hnyield, hnvolume, hnrank⟩ := + (h.scale_positive.and ((h.yield_lower (ε / 3) hδ).and + ((h.volume_lower (ε / 3) hδ).and (h.rank_upper (ε / 3) hδ)))).exists + have hfinite := div_le_div_of_nonneg_right (W n).log_inequality hnscale.le + simp only [add_div, mul_div_assoc] at hfinite + have hω : 0 ≤ Arithmetic.omega F / 3 := div_nonneg Arithmetic.omega_nonneg (by norm_num) + have hvolume := mul_le_mul_of_nonneg_left hnvolume hω + have hωupper := mul_le_mul_of_nonneg_right + (Arithmetic.omega_le_three (F := F)) hδ.le + nlinarith + +theorem omega_le_of_rates {W : ℕ → AllFieldWitness F} {scale : ℕ → ℝ} + {Y S R : ℝ} (h : HasRates W scale Y S R) (positive : 0 < S) : + Arithmetic.omega F ≤ 3 * (R - Y) / S := by + apply (le_div_iff₀ positive).mpr + have hb := inequality_of_rates h + nlinarith + +theorem omega_le_of_rateBounds {W : ℕ → AllFieldWitness F} {scale : ℕ → ℝ} + {Y S R : ℝ} (h : HasRateBounds W scale Y S R) (positive : 0 < S) : + Arithmetic.omega F ≤ 3 * (R - Y) / S := by + apply (le_div_iff₀ positive).mpr + have hb := inequality_of_rateBounds h + nlinarith + +structure FixedLotFamily (F : Type*) [Field F] where + witness : ℕ → ℕ → AllFieldWitness F + scale : ℕ → ℕ → ℝ + yieldRate : ℕ → ℝ + volumeRate : ℕ → ℝ + rankRate : ℕ → ℝ + bounds : ∀ j, HasRateBounds (witness j) (scale j) + (yieldRate j) (volumeRate j) (rankRate j) + +theorem inequality_of_fixedLotFamily (family : FixedLotFamily F) {Y S R : ℝ} + (yield_limit : Tendsto family.yieldRate atTop (𝓝 Y)) + (volume_limit : Tendsto family.volumeRate atTop (𝓝 S)) + (rank_limit : Tendsto family.rankRate atTop (𝓝 R)) : + Y + (Arithmetic.omega F / 3) * S ≤ R := by + apply le_of_tendsto_of_tendsto' + (yield_limit.add (volume_limit.const_mul (Arithmetic.omega F / 3))) rank_limit + intro j + exact inequality_of_rateBounds (family.bounds j) + +theorem inequality_of_outer_families + (family : ℕ → FixedLotFamily F) {Y S R : ℕ → ℝ} {Yfinal Sfinal Rfinal : ℝ} + (yield_limit : ∀ K, Tendsto (family K).yieldRate atTop (𝓝 (Y K))) + (volume_limit : ∀ K, Tendsto (family K).volumeRate atTop (𝓝 (S K))) + (rank_limit : ∀ K, Tendsto (family K).rankRate atTop (𝓝 (R K))) + (outer_yield : Tendsto Y atTop (𝓝 Yfinal)) + (outer_volume : Tendsto S atTop (𝓝 Sfinal)) + (outer_rank : Tendsto R atTop (𝓝 Rfinal)) : + Yfinal + (Arithmetic.omega F / 3) * Sfinal ≤ Rfinal := by + apply le_of_tendsto_of_tendsto' + (outer_yield.add (outer_volume.const_mul (Arithmetic.omega F / 3))) outer_rank + intro K + exact inequality_of_fixedLotFamily (family K) + (yield_limit K) (volume_limit K) (rank_limit K) + +theorem omega_le_of_outer_families + (family : ℕ → FixedLotFamily F) {Y S R : ℕ → ℝ} {Yfinal Sfinal Rfinal : ℝ} + (yield_limit : ∀ K, Tendsto (family K).yieldRate atTop (𝓝 (Y K))) + (volume_limit : ∀ K, Tendsto (family K).volumeRate atTop (𝓝 (S K))) + (rank_limit : ∀ K, Tendsto (family K).rankRate atTop (𝓝 (R K))) + (outer_yield : Tendsto Y atTop (𝓝 Yfinal)) + (outer_volume : Tendsto S atTop (𝓝 Sfinal)) + (outer_rank : Tendsto R atTop (𝓝 Rfinal)) (positive : 0 < Sfinal) : + Arithmetic.omega F ≤ 3 * (Rfinal - Yfinal) / Sfinal := by + apply (le_div_iff₀ positive).mpr + have hb := inequality_of_outer_families family yield_limit volume_limit rank_limit + outer_yield outer_volume outer_rank + nlinarith + +theorem staggered_rank_constraint + (family : ∀ K : ℕ, 2 ≤ K → FixedLotFamily F) {H0 Cstar Sstar beta : ℝ} + (yield_limit : ∀ K hK, Tendsto (family K hK).yieldRate atTop + (𝓝 (H0 + Cstar - beta / (K : ℝ)))) + (volume_limit : ∀ K hK, Tendsto (family K hK).volumeRate atTop (𝓝 Sstar)) + (rank_limit : ∀ K hK, Tendsto (family K hK).rankRate atTop (𝓝 (8 * Real.log 7))) : + H0 + Cstar + (Arithmetic.omega F / 3) * Sstar ≤ 8 * Real.log 7 := by + have hfixed (K : ℕ) (hK : 2 ≤ K) : + H0 + Cstar - beta / (K : ℝ) + Arithmetic.omega F * Sstar / 3 ≤ + 8 * Real.log 7 := by + have hb := inequality_of_fixedLotFamily (family K hK) + (yield_limit K hK) (volume_limit K hK) (rank_limit K hK) + convert hb using 1; ring + have hb := FiniteSchedule.fixed_lot_boundary_limit hfixed + convert hb using 1; ring + +theorem omega_le_of_staggered_families + (family : ∀ K : ℕ, 2 ≤ K → FixedLotFamily F) {H0 Cstar Sstar beta : ℝ} + (yield_limit : ∀ K hK, Tendsto (family K hK).yieldRate atTop + (𝓝 (H0 + Cstar - beta / (K : ℝ)))) + (volume_limit : ∀ K hK, Tendsto (family K hK).volumeRate atTop (𝓝 Sstar)) + (rank_limit : ∀ K hK, Tendsto (family K hK).rankRate atTop (𝓝 (8 * Real.log 7))) + (positive : 0 < Sstar) : + Arithmetic.omega F ≤ 3 * (8 * Real.log 7 - (H0 + Cstar)) / Sstar := by + apply (le_div_iff₀ positive).mpr + have hb := staggered_rank_constraint family yield_limit volume_limit rank_limit + nlinarith + +theorem omega_lt_of_staggered_families + (family : ∀ K : ℕ, 2 ≤ K → FixedLotFamily F) {H0 Cstar Sstar beta target : ℝ} + (yield_limit : ∀ K hK, Tendsto (family K hK).yieldRate atTop + (𝓝 (H0 + Cstar - beta / (K : ℝ)))) + (volume_limit : ∀ K hK, Tendsto (family K hK).volumeRate atTop (𝓝 Sstar)) + (rank_limit : ∀ K hK, Tendsto (family K hK).rankRate atTop (𝓝 (8 * Real.log 7))) + (positive : 0 < Sstar) + (gap : 3 * (8 * Real.log 7 - (H0 + Cstar)) / Sstar < target) : + Arithmetic.omega F < target := + lt_of_le_of_lt (omega_le_of_staggered_families family yield_limit volume_limit + rank_limit positive) gap + +end MatrixMultiplication.AllFieldRateLimit + +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/Entropy/RectangularGrowth.lean b/lean/OAI/LinearAlgebra/MatrixFields/Entropy/RectangularGrowth.lean new file mode 100644 index 0000000000000000000000000000000000000000..bef06afbae09ca3bf41d49bd05e2047217ec1f36 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/Entropy/RectangularGrowth.lean @@ -0,0 +1,146 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Arithmetic.ComplexArithmeticGrowth +import OAI.LinearAlgebra.MatrixFields.Arithmetic.RecursiveBlockPrograms + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +noncomputable section + +namespace MatrixMultiplication.Arithmetic + +variable {F : Type*} [Field F] + +theorem rectangular_power_cost_padding_bound + {a b : ℕ} (ha : 2 ≤ a) {k s C : ℝ} (hk : 0 ≤ k) + (hab : (a : ℝ) ^ k ≤ (b : ℝ)) (hs : 0 ≤ s) (hC : 0 < C) + (hpower : ∀ t : ℕ, ∃ P : MatrixAlgorithm F (a ^ t) (b ^ t) (a ^ t), + P.Correct ∧ (P.cost : ℝ) ≤ C * ((a : ℝ) ^ s) ^ t) : + ∃ D : ℝ, 0 < D ∧ ∀ n : ℕ, 1 ≤ n → + ∃ P : MatrixAlgorithm F n (innerSize n k) n, + P.Correct ∧ (P.cost : ℝ) ≤ D * (n : ℝ) ^ s := by + have hapos : 0 < (a : ℝ) := by exact_mod_cast (by omega : 0 < a) + refine ⟨C * (a : ℝ) ^ s, mul_pos hC (Real.rpow_pos_of_pos hapos s), ?_⟩ + intro n hn + obtain ⟨t, hnt, htn⟩ := MatrixMultiplication.Foundation.Arithmetic.exists_power_cover ha hn + obtain ⟨P, hP, hcost⟩ := hpower t + obtain ⟨Q, hQ, hQP⟩ := MatrixAlgorithm.exists_restrict + hnt (innerSize_le_pow hk hnt hab) hnt P hP + refine ⟨Q, hQ, ?_⟩ + calc + (Q.cost : ℝ) ≤ (P.cost : ℝ) := by exact_mod_cast hQP + _ ≤ C * ((a : ℝ) ^ s) ^ t := hcost + _ = C * ((a ^ t : ℕ) : ℝ) ^ s := by + rw [Real.rpow_pow_comm hapos.le, Nat.cast_pow] + _ ≤ C * ((a : ℝ) * (n : ℝ)) ^ s := + mul_le_mul_of_nonneg_left + (Real.rpow_le_rpow (Nat.cast_nonneg _) (by exact_mod_cast htn) hs) hC.le + _ = (C * (a : ℝ) ^ s) * (n : ℝ) ^ s := by + rw [Real.mul_rpow hapos.le (Nat.cast_nonneg n)] + ring + +theorem rectangularAdmissibleExponent_of_power_costs + {a b : ℕ} (ha : 2 ≤ a) {k τ : ℝ} (hk : 0 ≤ k) + (hab : (a : ℝ) ^ k ≤ (b : ℝ)) (hτ : 0 ≤ τ) + (hpower : ∀ ε : ℝ, 0 < ε → ∃ C : ℝ, 0 < C ∧ + ∀ t : ℕ, ∃ P : MatrixAlgorithm F (a ^ t) (b ^ t) (a ^ t), + P.Correct ∧ (P.cost : ℝ) ≤ C * ((a : ℝ) ^ (τ + ε)) ^ t) : + RectangularAdmissibleExponent F k τ := by + intro ε hε + obtain ⟨C, hC, hcost⟩ := hpower ε hε + exact rectangular_power_cost_padding_bound ha hk hab (by linarith) hC hcost + +def rectangularBlockCost (a b R K : ℕ) : ℕ → ℕ + | 0 => 1 + | t + 1 => R * rectangularBlockCost a b R K t + K * ((a * b) ^ t + (a ^ 2) ^ t) + +@[simp] theorem rectangularBlockCost_zero (a b R K : ℕ) : + rectangularBlockCost a b R K 0 = 1 := rfl + +@[simp] theorem rectangularBlockCost_succ (a b R K t : ℕ) : + rectangularBlockCost a b R K (t + 1) = + R * rectangularBlockCost a b R K t + K * ((a * b) ^ t + (a ^ 2) ^ t) := rfl + +theorem rectangularBlockCost_bound {a b R K : ℕ} (ha : 2 ≤ a) + {τ ε : ℝ} (hε : 0 < ε) + (hR : (R : ℝ) ≤ (a : ℝ) ^ τ) + (hin : (a * b : ℕ) ≤ (a : ℝ) ^ τ) + (hout : (a : ℝ) ^ (2 : ℕ) ≤ (a : ℝ) ^ τ) : + ∃ C : ℝ, 0 < C ∧ ∀ t, + (rectangularBlockCost a b R K t : ℝ) ≤ C * ((a : ℝ) ^ (τ + ε)) ^ t := by + have haone : 1 < (a : ℝ) := by exact_mod_cast (by omega : 1 < a) + have hrate : (R : ℝ) < (a : ℝ) ^ (τ + ε) := + hR.trans_lt (Real.rpow_lt_rpow_of_exponent_lt haone (by linarith)) + have hlarge : (a : ℝ) ^ τ ≤ (a : ℝ) ^ (τ + ε) := + Real.rpow_le_rpow_of_exponent_le haone.le (by linarith) + have hin0 : (0 : ℝ) ≤ (a * b : ℕ) := Nat.cast_nonneg _ + have hd : 0 ≤ max ((a * b : ℕ) : ℝ) ((a : ℝ) ^ (2 : ℕ)) := + hin0.trans (le_max_left _ _) + apply MatrixMultiplication.Foundation.Arithmetic.geometric_cost_recurrence_bound + (fun t => (rectangularBlockCost a b R K t : ℝ)) + (R : ℝ) (2 * K) (max ((a * b : ℕ) : ℝ) ((a : ℝ) ^ (2 : ℕ))) + ((a : ℝ) ^ (τ + ε)) (Nat.cast_nonneg _) (Nat.cast_nonneg _) + (by positivity) hd hrate (max_le (hin.trans hlarge) (hout.trans hlarge)) + intro t + simp only [rectangularBlockCost_succ, Nat.cast_add, Nat.cast_mul, Nat.cast_pow] + have h1 : ((a : ℝ) * (b : ℝ)) ^ t ≤ + max ((a * b : ℕ) : ℝ) ((a : ℝ) ^ (2 : ℕ)) ^ t := by + apply pow_le_pow_left₀ (by positivity) + simpa only [Nat.cast_mul] using le_max_left ((a * b : ℕ) : ℝ) ((a : ℝ) ^ (2 : ℕ)) + have h2 : ((a : ℝ) ^ (2 : ℕ)) ^ t ≤ + max ((a * b : ℕ) : ℝ) ((a : ℝ) ^ (2 : ℕ)) ^ t := + pow_le_pow_left₀ (sq_nonneg _) (le_max_right _ _) t + simp only [Nat.cast_mul] at h1 h2 + nlinarith [mul_le_mul_of_nonneg_left (add_le_add h1 h2) (Nat.cast_nonneg K)] + +theorem rectangular_power_programs_of_block_step {a b R K : ℕ} + (hscalar : ∃ P : MatrixAlgorithm F 1 1 1, P.Correct ∧ P.cost ≤ 1) + (hstep : ∀ m p : ℕ, ∀ P : MatrixAlgorithm F m p m, P.Correct → + ∃ Q : MatrixAlgorithm F (a * m) (b * p) (a * m), Q.Correct ∧ + Q.cost ≤ R * P.cost + K * (m * p + m ^ 2)) : + ∀ t : ℕ, ∃ P : MatrixAlgorithm F (a ^ t) (b ^ t) (a ^ t), + P.Correct ∧ P.cost ≤ rectangularBlockCost a b R K t := by + intro t + induction t with + | zero => simpa using hscalar + | succ t ih => + obtain ⟨P, hP, hcost⟩ := ih + obtain ⟨Q, hQ, hQcost⟩ := hstep (a ^ t) (b ^ t) P hP + have hbound : Q.cost ≤ rectangularBlockCost a b R K (t + 1) := by + apply hQcost.trans + simp only [rectangularBlockCost_succ, mul_pow, ← pow_mul, Nat.mul_comm t 2] + exact Nat.add_le_add_right (Nat.mul_le_mul_left R hcost) _ + have hresult : ∃ Q : MatrixAlgorithm F (a * a ^ t) (b * b ^ t) (a * a ^ t), + Q.Correct ∧ Q.cost ≤ rectangularBlockCost a b R K (t + 1) := ⟨Q, hQ, hbound⟩ + exact (pow_succ' a t).symm ▸ ((pow_succ' b t).symm ▸ hresult) + +theorem rectangularAdmissibleExponent_of_block_step + {a b R K : ℕ} (ha : 2 ≤ a) {k τ : ℝ} (hk : 0 ≤ k) + (hab : (a : ℝ) ^ k ≤ (b : ℝ)) (hτ : 0 ≤ τ) + (hR : (R : ℝ) ≤ (a : ℝ) ^ τ) + (hin : (a * b : ℕ) ≤ (a : ℝ) ^ τ) + (hout : (a : ℝ) ^ (2 : ℕ) ≤ (a : ℝ) ^ τ) + (hscalar : ∃ P : MatrixAlgorithm F 1 1 1, P.Correct ∧ P.cost ≤ 1) + (hstep : ∀ m p : ℕ, ∀ P : MatrixAlgorithm F m p m, P.Correct → + ∃ Q : MatrixAlgorithm F (a * m) (b * p) (a * m), Q.Correct ∧ + Q.cost ≤ R * P.cost + K * (m * p + m ^ 2)) : + RectangularAdmissibleExponent F k τ := by + apply rectangularAdmissibleExponent_of_power_costs ha hk hab hτ + intro ε hε + obtain ⟨C, hC, hbound⟩ := rectangularBlockCost_bound (K := K) ha hε hR hin hout + refine ⟨C, hC, ?_⟩ + intro t + obtain ⟨P, hP, hcost⟩ := rectangular_power_programs_of_block_step hscalar hstep t + exact ⟨P, hP, (by exact_mod_cast hcost : (P.cost : ℝ) ≤ + (rectangularBlockCost a b R K t : ℝ)).trans (hbound t)⟩ + +end MatrixMultiplication.Arithmetic + +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/Entropy/StageCLaw.lean b/lean/OAI/LinearAlgebra/MatrixFields/Entropy/StageCLaw.lean new file mode 100644 index 0000000000000000000000000000000000000000..3b075973d0a8544526249851f2875339ac9f6cd1 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/Entropy/StageCLaw.lean @@ -0,0 +1,410 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Parameters.ParametersWeights + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +namespace MatrixMultiplication.AllFieldParameters + +open scoped BigOperators + +theorem assigned_mem_or_zero {α : Type} [BEq α] (keys : List α) (data : List ℤ) (key : α) : + assigned keys data key = 0 ∨ assigned keys data key ∈ data := by + unfold assigned + cases h : (keys.zip data).find? (fun e => e.1 == key) with + | none => simp + | some pair => + right + exact (List.of_mem_zip (List.mem_of_find?_eq_some h)).2 + +theorem assigned_argument_bound {α : Type} [BEq α] (keys : List α) (data : List ℤ) + (hd : ∀ n ∈ data, |n| ≤ 160000) (key : α) : |assigned keys data key| ≤ 160000 := by + rcases assigned_mem_or_zero keys data key with h | h + · rw [h]; norm_num + · exact hd _ h + +theorem splitWeight_positive (parents : List Shape) (data : List ℤ) + (hd : ∀ n ∈ data, |n| ≤ 160000) (s u : Shape) : + 0 < splitWeight parents data s u := by + apply Finset.prod_pos + intro i _ + apply weight_positive_of_argument_bound + exact assigned_argument_bound _ data hd _ + +theorem list_sum_map_nonnegative {α : Type} (xs : List α) (f : α → ℚ) + (hf : ∀ x ∈ xs, 0 ≤ f x) : 0 ≤ (xs.map f).sum := by + induction xs with + | nil => simp + | cons x xs ih => + simp only [List.map_cons, List.sum_cons] + exact add_nonneg (hf x (by simp)) (ih (fun y hy => hf y (by simp [hy]))) + +theorem list_sum_map_positive {α : Type} (xs : List α) (f : α → ℚ) + (hne : xs ≠ []) (hf : ∀ x ∈ xs, 0 < f x) : 0 < (xs.map f).sum := by + cases xs with + | nil => contradiction + | cons x xs => + simp only [List.map_cons, List.sum_cons] + exact add_pos_of_pos_of_nonneg (hf x (by simp)) + (list_sum_map_nonnegative xs f (fun y hy => (hf y (by simp [hy])).le)) + +theorem list_sum_map_div {α : Type} (xs : List α) (f : α → ℚ) (d : ℚ) : + (xs.map (fun x => f x / d)).sum = (xs.map f).sum / d := by + induction xs with + | nil => simp + | cons x xs ih => simp [ih, add_div] + +theorem splitLaw_positive (parents : List Shape) (data : List ℤ) + (hd : ∀ n ∈ data, |n| ≤ 160000) (s u : Shape) (hu : u ∈ below s) : + 0 < splitLaw parents data s u := by + rw [splitLaw, ite_eq_left hu] + apply div_pos (splitWeight_positive parents data hd s u) + apply list_sum_map_positive + · intro he + simp only [he, List.not_mem_nil] at hu + · intro v _ + exact splitWeight_positive parents data hd s v + +theorem splitLaw_normalized (parents : List Shape) (data : List ℤ) + (hd : ∀ n ∈ data, |n| ≤ 160000) (s : Shape) (hne : below s ≠ []) : + ((below s).map (splitLaw parents data s)).sum = 1 := by + have he : (below s).map (splitLaw parents data s) = + (below s).map (fun u => splitWeight parents data s u / + ((below s).map (splitWeight parents data s)).sum) := by + apply List.map_congr_left + intro u hu + simp only [splitLaw, hu, ite_true] + rw [he, list_sum_map_div, div_self] + exact ne_of_gt (list_sum_map_positive (below s) _ hne + (fun u _ => splitWeight_positive parents data hd s u)) + +theorem stageA_table_arguments_bounded : ∀ n ∈ tableP, |n| ≤ 160000 := by decide +kernel + +theorem stageB_table_arguments_bounded : ∀ n ∈ tablep, |n| ≤ 160000 := by decide +kernel + +theorem zero_table_arguments_bounded : ∀ n ∈ tablez, |n| ≤ 160000 := by decide +kernel + +theorem stageA_support_nonempty : ∀ s ∈ positiveInitial, below s ≠ [] := by decide +kernel + +theorem stageB_support_nonempty : ∀ s ∈ positiveSecond, below s ≠ [] := by decide +kernel + +theorem stageA_support_complement : ∀ s ∈ positiveInitial, ∀ u ∈ below s, + complement s u ∈ below s ∧ ∀ i, u i ≤ s i := by decide +kernel + +theorem stageB_support_complement : ∀ s ∈ positiveSecond, ∀ u ∈ below s, + complement s u ∈ below s ∧ ∀ i, u i ≤ s i := by decide +kernel + +theorem stageALaw_positive (s u : Shape) (hu : u ∈ below s) : 0 < stageALaw s u := + splitLaw_positive _ _ stageA_table_arguments_bounded s u hu + +theorem stageBLaw_positive (s u : Shape) (hu : u ∈ below s) : 0 < stageBLaw s u := + splitLaw_positive _ _ stageB_table_arguments_bounded s u hu + +theorem stageALaw_normalized (s : Shape) (hs : s ∈ positiveInitial) : + ((below s).map (stageALaw s)).sum = 1 := + splitLaw_normalized _ _ stageA_table_arguments_bounded s (stageA_support_nonempty s hs) + +theorem stageBLaw_normalized (s : Shape) (hs : s ∈ positiveSecond) : + ((below s).map (stageBLaw s)).sum = 1 := + splitLaw_normalized _ _ stageB_table_arguments_bounded s (stageB_support_nonempty s hs) + +theorem stageALaw_complement (s u : Shape) (hs : s ∈ positiveInitial) (hu : u ∈ below s) : + stageALaw s (complement s u) = stageALaw s u := by + obtain ⟨hc, hb⟩ := stageA_support_complement s hs u hu + exact splitLaw_complement _ _ s u hb hu hc + +theorem stageBLaw_complement (s u : Shape) (hs : s ∈ positiveSecond) (hu : u ∈ below s) : + stageBLaw s (complement s u) = stageBLaw s u := by + obtain ⟨hc, hb⟩ := stageB_support_complement s hs u hu + exact splitLaw_complement _ _ s u hb hu hc + +def initialMultiplicity (s : Shape) : ℕ := + if s 0 = s 1 ∧ s 1 = s 2 then 1 else if s 0 = s 1 ∨ s 1 = s 2 ∨ s 0 = s 2 then 3 else 6 + +def initialInteger (i : ℕ) : ℤ := assigned (List.range 17) tablea i + +def initialWeight (s : Shape) : ℚ := + initialMultiplicity s * ∏ i : Fin 3, weight (initialInteger (s i)) + +def initialLaw (s : Shape) : ℚ := + if s ∈ sortedInitial then initialWeight s / (sortedInitial.map initialWeight).sum else 0 + +theorem initial_table_arguments_bounded : ∀ n ∈ tablea, |n| ≤ 160000 := by decide +kernel + +theorem initialWeight_positive (s : Shape) : 0 < initialWeight s := by + apply mul_pos + · unfold initialMultiplicity + split_ifs <;> norm_num + · apply Finset.prod_pos + intro i _ + apply weight_positive_of_argument_bound + exact assigned_argument_bound _ tablea initial_table_arguments_bounded _ + +theorem initialLaw_positive (s : Shape) (hs : s ∈ sortedInitial) : 0 < initialLaw s := by + rw [initialLaw, ite_eq_left hs] + apply div_pos (initialWeight_positive s) + exact list_sum_map_positive _ _ (by decide +kernel) (fun t _ => initialWeight_positive t) + +theorem initialLaw_normalized : (sortedInitial.map initialLaw).sum = 1 := by + have he : sortedInitial.map initialLaw = sortedInitial.map + (fun s => initialWeight s / (sortedInitial.map initialWeight).sum) := by + apply List.map_congr_left + intro s hs + simp only [initialLaw, hs, ite_true] + rw [he, list_sum_map_div, div_self] + exact ne_of_gt (list_sum_map_positive _ _ (by decide +kernel) + (fun s _ => initialWeight_positive s)) + +theorem binary_table_bounds : ∀ n ∈ tabled, 0 ≤ n ∧ n ≤ 110106 := by decide +kernel + +theorem binaryInteger_bounds (t u : Shape) : + 0 ≤ binaryInteger t u ∧ binaryInteger t u ≤ 110106 := by + rcases assigned_mem_or_zero binaryKeys tabled (t, u) with h | h + · change 0 ≤ assigned binaryKeys tabled (t, u) ∧ assigned binaryKeys tabled (t, u) ≤ 110106 + rw [h] + norm_num + · exact binary_table_bounds _ h + +theorem binaryParameter_bounds (t u : Shape) : + 0 ≤ binaryParameter t u ∧ binaryParameter t u ≤ (110106 : ℚ) / 1000000 := by + obtain ⟨hlo, hhi⟩ := binaryInteger_bounds t u + have hl : (0 : ℚ) ≤ binaryInteger t u := by exact_mod_cast hlo + have hh : (binaryInteger t u : ℚ) ≤ 110106 := by exact_mod_cast hhi + unfold binaryParameter + constructor + · exact div_nonneg hl (by norm_num) + · exact div_le_div_of_nonneg_right hh (by norm_num) + +def singletonSlot (k : ℕ) : Fin 6 := + match k with + | 0 => 0 + | 1 => 1 + | 3 => 4 + | 4 => 5 + | _ => 0 + +def littleLaw (t u : Shape) (w : Fin 3) (i : Fin 6) : ℚ := + if u w = 2 then + if i = 2 then 1 - binaryParameter t u else if i = 3 then binaryParameter t u else 0 + else if i = singletonSlot (u w) then 1 else 0 + +theorem littleLaw_nonnegative (t u : Shape) (w : Fin 3) (i : Fin 6) : + 0 ≤ littleLaw t u w i := by + obtain ⟨hl, hh⟩ := binaryParameter_bounds t u + unfold littleLaw + split_ifs <;> linarith + +theorem littleLaw_normalized (t u : Shape) (w : Fin 3) : + ∑ i : Fin 6, littleLaw t u w i = 1 := by + by_cases h : u w = 2 + · simp only [littleLaw, h, ite_true] + calc + _ = ∑ i : Fin 6, ((if i = 2 then 1 - binaryParameter t u else 0) + + (if i = 3 then binaryParameter t u else 0)) := by + apply Finset.sum_congr rfl + intro i _ + by_cases hi : i = 2 + · subst i + simp [show (2 : Fin 6) ≠ 3 by decide] + · simp [hi] + _ = 1 := by simp [Finset.sum_add_distrib] + · simp [littleLaw, h] + +theorem orderedPairWeight_positive (t : Shape) (i j : Fin 6) : + 0 < weight (orderedPairInteger t i j) := by + apply weight_positive_of_argument_bound + exact assigned_argument_bound _ tablez zero_table_arguments_bounded _ + +theorem orderedPairs_nonempty : ∀ t ∈ zeroSecond, orderedPairs t ≠ [] := by decide +kernel + +theorem orderedPairs_support (t : Shape) (ij : PairSlot) (h : ij ∈ orderedPairs t) : + statisticWeight ij.1 + statisticWeight ij.2 = shapeMax t := by + simp only [orderedPairs, List.mem_flatMap, List.mem_filterMap] at h + obtain ⟨i, _, j, _, he⟩ := h + split_ifs at he with hs + · cases Option.some.inj he + exact hs + +theorem zeroPairLaw_positive (t : Shape) (ht : t ∈ zeroSecond) (ij : PairSlot) + (hij : ij ∈ orderedPairs t) : 0 < zeroPairLaw t ij.1 ij.2 := by + rw [zeroPairLaw, ite_eq_left (orderedPairs_support t ij hij)] + exact div_pos (orderedPairWeight_positive _ _ _) + (list_sum_map_positive _ _ (orderedPairs_nonempty t ht) + (fun p _ => orderedPairWeight_positive t p.1 p.2)) + +theorem zeroPairLaw_normalized (t : Shape) (ht : t ∈ zeroSecond) : + ((orderedPairs t).map (fun ij => zeroPairLaw t ij.1 ij.2)).sum = 1 := by + have he : (orderedPairs t).map (fun ij => zeroPairLaw t ij.1 ij.2) = + (orderedPairs t).map (fun ij => weight (orderedPairInteger t ij.1 ij.2) / + ((orderedPairs t).map (fun p => weight (orderedPairInteger t p.1 p.2))).sum) := by + apply List.map_congr_left + intro ij hij + simp only [zeroPairLaw, orderedPairs_support t ij hij, ite_true] + rw [he, list_sum_map_div, div_self] + exact ne_of_gt (list_sum_map_positive _ _ (orderedPairs_nonempty t ht) + (fun p _ => orderedPairWeight_positive t p.1 p.2)) + +end MatrixMultiplication.AllFieldParameters + +namespace MatrixMultiplication.AllFieldHistory + +open AllFieldParameters +open scoped BigOperators + +def stageCDistinguished (u : Shape) : Fin 3 := + if u 0 = 2 then 0 else if u 1 = 2 then 1 else 2 + +def stageCCanonicalAtom : Fin 4 → Shape := + (Matrix.vecCons (shape 1 1 0) (Matrix.vecCons (shape 0 0 2) (Matrix.vecCons (shape 1 0 1) (Matrix.vecCons (shape 0 1 1) Matrix.vecEmpty)))) + +def stageCAtom (u : Shape) (i : Fin 4) : Shape := + if stageCDistinguished u = 0 then + shape (stageCCanonicalAtom i 2) (stageCCanonicalAtom i 1) (stageCCanonicalAtom i 0) + else if stageCDistinguished u = 1 then + shape (stageCCanonicalAtom i 0) (stageCCanonicalAtom i 2) (stageCCanonicalAtom i 1) + else stageCCanonicalAtom i + +def stageCWeight (t u : Shape) (i : Fin 4) : ℚ := + if i.val < 2 then binaryParameter t u / 2 else (1 - binaryParameter t u) / 2 + +theorem positive_four_shapes : ∀ u ∈ shapes 4, positive u = true → + u = shape 1 1 2 ∨ u = shape 1 2 1 ∨ u = shape 2 1 1 := by + decide +kernel + +theorem stageCDistinguished_spec : ∀ u ∈ shapes 4, positive u = true → + u (stageCDistinguished u) = 2 ∧ + ∀ i, u i = 2 → i = stageCDistinguished u := by + decide +kernel + +theorem stageC_children_length : ∀ u ∈ shapes 4, positive u = true → + (below u).length = 4 := by + decide +kernel + +theorem stageC_children_geometry : ∀ u ∈ shapes 4, positive u = true → + ∀ v ∈ below u, + complement u v ∈ below u ∧ + (∀ i, v i ≤ u i) ∧ + (∃ i, v i = 0) ∧ (∃ i, complement u v i = 0) := by + decide +kernel + +theorem stageC_middle_complement : ∀ u ∈ shapes 4, positive u = true → + ∀ v ∈ below u, + (complement u v (stageCDistinguished u) = 1 ↔ + v (stageCDistinguished u) = 1) := by + decide +kernel + +theorem stageCAtom_injective : ∀ u ∈ shapes 4, positive u = true → + Function.Injective (stageCAtom u) := by + decide +kernel + +theorem stageCAtom_mem : ∀ u ∈ shapes 4, positive u = true → + ∀ i, stageCAtom u i ∈ below u := by + decide +kernel + +theorem stageCAtom_exhaustive : ∀ u ∈ shapes 4, positive u = true → + ∀ v ∈ below u, ∃ i, stageCAtom u i = v := by + decide +kernel + +theorem stageCAtom_middle : ∀ u ∈ shapes 4, positive u = true → + ∀ i, stageCAtom u i (stageCDistinguished u) = 1 ↔ ¬i.val < 2 := by + decide +kernel + +def stageCShapeWeight (d : ℚ) (u v : Shape) : ℚ := + if v ∈ below u then + if v (stageCDistinguished u) = 1 then (1 - d) / 2 else d / 2 + else 0 + +def stageCLaw (t u v : Shape) : ℚ := stageCShapeWeight (binaryParameter t u) u v + +theorem stageCLaw_source (t u v : Shape) : + stageCLaw t u v = + if v ∈ below u then + if v (stageCDistinguished u) = 1 then + (1 - binaryParameter t u) / 2 else binaryParameter t u / 2 + else 0 := rfl + +theorem stageCLaw_nonnegative (t u v : Shape) : 0 ≤ stageCLaw t u v := by + obtain ⟨hlo, hhi⟩ := binaryParameter_bounds t u + unfold stageCLaw stageCShapeWeight + split_ifs <;> linarith + +theorem stageCWeight_nonnegative (t u : Shape) (i : Fin 4) : + 0 ≤ stageCWeight t u i := by + obtain ⟨hlo, hhi⟩ := binaryParameter_bounds t u + unfold stageCWeight + split_ifs <;> linarith + +theorem stageCWeight_normalized (t u : Shape) : ∑ i, stageCWeight t u i = 1 := by + norm_num [stageCWeight, Fin.sum_univ_succ]; ring + +theorem stageCWeight_single (t u : Shape) : + stageCWeight t u 0 + stageCWeight t u 1 = binaryParameter t u := by + change binaryParameter t u / 2 + binaryParameter t u / 2 = binaryParameter t u + ring + +theorem stageCWeight_cross (t u : Shape) : + stageCWeight t u 2 + stageCWeight t u 3 = 1 - binaryParameter t u := by + change (1 - binaryParameter t u) / 2 + (1 - binaryParameter t u) / 2 = + 1 - binaryParameter t u + ring + +theorem stageCLaw_atom (t u : Shape) (hu : u ∈ shapes 4) + (hpos : positive u = true) (i : Fin 4) : + stageCLaw t u (stageCAtom u i) = stageCWeight t u i := by + simp only [stageCLaw, stageCShapeWeight, stageCAtom_mem u hu hpos i, ite_true, + stageCAtom_middle u hu hpos i, ite_not, stageCWeight] + +private theorem stageCShapeWeight_normalized (d : ℚ) (u : Shape) + (hu : u ∈ shapes 4) (hpos : positive u = true) : + ((shapes 2).map (stageCShapeWeight d u)).sum = 1 := by + rcases positive_four_shapes u hu hpos with rfl | rfl | rfl <;> + norm_num [stageCShapeWeight, stageCDistinguished, below, shapes, shape, List.range_succ, + Matrix.cons_val_two, funext_iff, Fin.forall_fin_succ] <;> ring + +private theorem stageCShapeWeight_normalized_below (d : ℚ) (u : Shape) + (hu : u ∈ shapes 4) (hpos : positive u = true) : + ((below u).map (stageCShapeWeight d u)).sum = 1 := by + rcases positive_four_shapes u hu hpos with rfl | rfl | rfl <;> + norm_num [stageCShapeWeight, stageCDistinguished, below, shapes, shape, List.range_succ, + Matrix.cons_val_two, funext_iff, Fin.forall_fin_succ] <;> ring + +theorem stageCLaw_normalized (t u : Shape) + (hu : u ∈ shapes 4) (hpos : positive u = true) : + ((shapes 2).map (stageCLaw t u)).sum = 1 := + stageCShapeWeight_normalized (binaryParameter t u) u hu hpos + +theorem stageCLaw_normalized_below (t u : Shape) + (hu : u ∈ shapes 4) (hpos : positive u = true) : + ((below u).map (stageCLaw t u)).sum = 1 := + stageCShapeWeight_normalized_below (binaryParameter t u) u hu hpos + +theorem stageCLaw_outside_support (t u v : Shape) (hv : v ∉ below u) : + stageCLaw t u v = 0 := by + simp only [stageCLaw, stageCShapeWeight, ite_eq_right hv] + +theorem stageCLaw_support (t u v : Shape) (h : stageCLaw t u v ≠ 0) : + v ∈ below u := by + by_contra hv + exact h (stageCLaw_outside_support t u v hv) + +theorem stageCLaw_children_zero (t u v : Shape) + (hu : u ∈ shapes 4) (hpos : positive u = true) + (h : stageCLaw t u v ≠ 0) : + (∃ i, v i = 0) ∧ (∃ i, complement u v i = 0) := + (stageC_children_geometry u hu hpos v (stageCLaw_support t u v h)).2.2 + +theorem stageCLaw_complement (t u v : Shape) + (hu : u ∈ shapes 4) (hpos : positive u = true) (hv : v ∈ below u) : + stageCLaw t u (complement u v) = stageCLaw t u v := by + have hc := (stageC_children_geometry u hu hpos v hv).1 + have hm := stageC_middle_complement u hu hpos v hv + simp only [stageCLaw, stageCShapeWeight, hv, hc, ite_true, hm] + +end MatrixMultiplication.AllFieldHistory + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/Entropy/StageCTerminalRates.lean b/lean/OAI/LinearAlgebra/MatrixFields/Entropy/StageCTerminalRates.lean new file mode 100644 index 0000000000000000000000000000000000000000..ff884e604bb2ff038d487376cb61784d8cc1402f --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/Entropy/StageCTerminalRates.lean @@ -0,0 +1,128 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Histories.HistorySums +import OAI.LinearAlgebra.MatrixFields.Tensors.CWStageCPlacements + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +noncomputable section + +namespace MatrixMultiplication.AllFieldStageCTerminalRates + +open AllFieldHistory AllFieldParameters CWStageCProducts +open scoped BigOperators Topology +attribute [local instance] Classical.propDecidable Classical.decEq + +theorem sum_populationHistory_rate {K : ℕ} (allocation : Allocation) : + (∑ h : PopulationHistory K, + (amount allocation (.partC h.1, h.2) : ℝ) * + (2 - (binaryParameter (cParameterParent h.1) (cShapeParent h.1) : ℝ)) * + Real.log 5) = + ∑ h : BPositive K, (bAmount h.val : ℝ) * + (2 - (binaryParameter (aShape h.val.1.val) (bShape h.val) : ℝ)) * + Real.log 5 := by + calc + _ = ∑ h : PartC K, (partAmount allocation h : ℝ) * + (2 - (binaryParameter (cParameterParent h) (cShapeParent h) : ℝ)) * + Real.log 5 := by + rw [Fintype.sum_prod_type] + apply Finset.sum_congr rfl + intro h _ + dsimp only + rw [← Finset.sum_mul, ← Finset.sum_mul] + have hm : (∑ phi : Placement, (amount allocation (.partC h, phi) : ℝ)) = + (partAmount allocation h : ℝ) := by + exact_mod_cast sum_placement_amount allocation (.partC h) + rw [hm] + _ = _ := by + rw [Fintype.sum_prod_type] + apply Finset.sum_congr rfl + intro h _ + simp only [cParameterParent, cShapeParent] + rw [← Finset.sum_mul, ← Finset.sum_mul] + have hm : (∑ i : Fin 3, (partAmount allocation (h, i) : ℝ)) = + (bAmount h.val : ℝ) := by + exact_mod_cast part_transition allocation h + rw [hm] + +theorem log_populationVolume_eq_bPositive {K : ℕ} (allocation : Allocation) + (dilation : ℕ) : + Real.log (populationVolume (K := K) allocation dilation : ℝ) = + (populationLength (K := K) allocation dilation : ℝ) * + ∑ h : BPositive K, (bAmount h.val : ℝ) * + (2 - (binaryParameter (aShape h.val.1.val) (bShape h.val) : ℝ)) * + Real.log 5 := by + rw [log_populationVolume, sum_populationHistory_rate] + +theorem normalized_log_populationVolume_eq_bPositive {K : ℕ} + (allocation : Allocation) (dilation : ℕ) (hd : 0 < dilation) : + Real.log (populationVolume (K := K) allocation dilation : ℝ) / + populationLength (K := K) allocation dilation = + ∑ h : BPositive K, (bAmount h.val : ℝ) * + (2 - (binaryParameter (aShape h.val.1.val) (bShape h.val) : ℝ)) * + Real.log 5 := by + rw [normalized_log_populationVolume allocation dilation hd, + sum_populationHistory_rate] + +theorem normalized_log_populationVolume_allocation_independent {K : ℕ} + (allocation₁ allocation₂ : Allocation) (dilation₁ dilation₂ : ℕ) + (hd₁ : 0 < dilation₁) (hd₂ : 0 < dilation₂) : + Real.log (populationVolume (K := K) allocation₁ dilation₁ : ℝ) / + populationLength (K := K) allocation₁ dilation₁ = + Real.log (populationVolume (K := K) allocation₂ dilation₂ : ℝ) / + populationLength (K := K) allocation₂ dilation₂ := by + rw [normalized_log_populationVolume_eq_bPositive allocation₁ dilation₁ hd₁, + normalized_log_populationVolume_eq_bPositive allocation₂ dilation₂ hd₂] + +theorem tendsto_normalized_log_populationVolume {K : ℕ} (allocation : Allocation) : + Filter.Tendsto (fun dilation : ℕ => + Real.log (populationVolume (K := K) allocation dilation : ℝ) / + populationLength (K := K) allocation dilation) Filter.atTop + (𝓝 (∑ h : BPositive K, (bAmount h.val : ℝ) * + (2 - (binaryParameter (aShape h.val.1.val) (bShape h.val) : ℝ)) * + Real.log 5)) := by + apply tendsto_const_nhds.congr' + filter_upwards [Filter.eventually_gt_atTop (0 : ℕ)] with dilation hd + exact (normalized_log_populationVolume_eq_bPositive allocation dilation hd).symm + +def interiorS2 : ℝ := + (positiveSecond.map (fun t => + (((below t).filter positive).map (fun u => + 2 * (secondMass t : ℝ) * (stageBLaw t u : ℝ) * + (2 - (binaryParameter t u : ℝ)) * Real.log 5)).sum)).sum + +theorem bPositive_rate_eq_interior (K : ℕ) : + (∑ h : BPositive K, (bAmount h.val : ℝ) * + (2 - (binaryParameter (aShape h.val.1.val) (bShape h.val) : ℝ)) * + Real.log 5) = (K : ℝ) * interiorS2 := by + simpa only [interiorS2, littleMass_cast, mul_assoc] using + b_positive_history_sum K + (fun t u => (2 - (binaryParameter t u : ℝ)) * Real.log 5) + +theorem log_populationVolume_eq_interior {K : ℕ} (allocation : Allocation) + (dilation : ℕ) : + Real.log (populationVolume (K := K) allocation dilation : ℝ) = + (K : ℝ) * populationLength (K := K) allocation dilation * interiorS2 := by + rw [log_populationVolume_eq_bPositive, bPositive_rate_eq_interior] + ring + +theorem normalized_log_populationVolume_eq_interior {K : ℕ} (hK : 0 < K) + (allocation : Allocation) (dilation : ℕ) (hd : 0 < dilation) : + Real.log (populationVolume (K := K) allocation dilation : ℝ) / + ((K : ℝ) * populationLength (K := K) allocation dilation) = interiorS2 := by + have hk : (K : ℝ) ≠ 0 := Nat.cast_ne_zero.mpr (Nat.ne_of_gt hK) + have hn : (populationLength (K := K) allocation dilation : ℝ) ≠ 0 := + Nat.cast_ne_zero.mpr (Nat.ne_of_gt (AllFieldPopulationCounts.blockLength_pos _ hd)) + rw [log_populationVolume_eq_interior] + exact mul_div_cancel_left₀ _ (mul_ne_zero hk hn) + +end MatrixMultiplication.AllFieldStageCTerminalRates + +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/Entropy/TerminalRates.lean b/lean/OAI/LinearAlgebra/MatrixFields/Entropy/TerminalRates.lean new file mode 100644 index 0000000000000000000000000000000000000000..5b4d0efc0725b1de99001b25881d315b441ad42b --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/Entropy/TerminalRates.lean @@ -0,0 +1,295 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Histories.ZeroHistorySums +import OAI.LinearAlgebra.MatrixFields.Parameters.TerminalPopulations + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section + +namespace MatrixMultiplication.AllFieldTerminalRates + +open AllFieldHistory AllFieldParameters AllFieldTerminalStatisticLaws +open AllFieldZeroLeafRates AllFieldZeroHistorySums Filter +open scoped BigOperators Topology +attribute [local instance] Classical.propDecidable + +variable {K : ℕ} + +def statisticCounts (allocation : Allocation) (h : TerminalZero K) : Slot h → ℕ := + AllFieldTerminalPopulations.count allocation history law 1 h + +def terminalDilation (K : ℕ) (m : ℕ) : ℕ := + AllFieldTerminalPopulations.dilation (law (K := K)) m + +def terminalLength (allocation : Allocation) (K : ℕ) (m : ℕ) : ℕ := + populationLength (K := K) allocation (terminalDilation K m) + +theorem terminalDilation_pos {m : ℕ} (hm : 0 < m) : + 0 < terminalDilation K m := + AllFieldTerminalPopulations.dilation_pos law hm + +theorem terminalLength_pos (allocation : Allocation) {m : ℕ} (hm : 0 < m) : + 0 < terminalLength allocation K m := + AllFieldPopulationCounts.blockLength_pos _ (terminalDilation_pos hm) + +theorem terminalLength_mul_one (allocation : Allocation) (m : ℕ) : + terminalLength allocation K m = m * terminalLength allocation K 1 := by + simp only [terminalLength, terminalDilation, AllFieldTerminalPopulations.dilation, + populationLength, AllFieldPopulationCounts.blockLength, one_mul, mul_assoc] + +theorem statisticCounts_pos (allocation : Allocation) (h : TerminalZero K) : + 0 < ∑ s, statisticCounts allocation h s := + AllFieldTerminalPopulations.sum_count_pos allocation history law law_nonneg law_total + (by decide) h (history_amount_pos allocation h) + +theorem statisticCounts_ratio (allocation : Allocation) (h : TerminalZero K) (s : Slot h) : + (statisticCounts allocation h s : ℝ) / + (∑ s, statisticCounts allocation h s : ℕ) = (law h s : ℝ) := + AllFieldTerminalPopulations.count_ratio_real allocation history law law_nonneg law_total + (by decide) h (history_amount_pos allocation h) s + +theorem statisticCounts_sum_inl (allocation : Allocation) (h : AZero K) : + (∑ s : Slot (.inl h), statisticCounts allocation (.inl h) s) = + ∑ s : PairSlot, statisticCounts allocation (.inl h) s := by + exact Fintype.sum_equiv (Equiv.refl _) _ _ (fun _ => rfl) + +theorem statisticCounts_sum_inr (allocation : Allocation) (h : BZero K) : + (∑ s : Slot (.inr h), statisticCounts allocation (.inr h) s) = + ∑ s : Fin 6, statisticCounts allocation (.inr h) s := by + exact Fintype.sum_equiv (Equiv.refl _) _ _ (fun _ => rfl) + +theorem statisticCounts_sum (allocation : Allocation) (h : TerminalZero K) : + (∑ s, statisticCounts allocation h s) = + population allocation (terminalDilation K 1) (history h) := + AllFieldTerminalPopulations.sum_count allocation history law law_nonneg law_total 1 h + +theorem statisticCounts_repeat (allocation : Allocation) (m : ℕ) + (h : TerminalZero K) (s : Slot h) : + m * statisticCounts allocation h s = + AllFieldTerminalPopulations.count allocation history law m h s := + (AllFieldTerminalPopulations.count_mul_one allocation history law m h s).symm + +theorem statisticCounts_repeat_sum (allocation : Allocation) (m : ℕ) + (h : TerminalZero K) : + (∑ s, m * statisticCounts allocation h s) = + population allocation (terminalDilation K m) (history h) := by + simp only [statisticCounts_repeat] + exact AllFieldTerminalPopulations.sum_count allocation history law law_nonneg law_total m h + +theorem statisticCounts_sum_cast (allocation : Allocation) (h : TerminalZero K) : + ((∑ s, statisticCounts allocation h s : ℕ) : ℝ) = + (terminalLength allocation K 1 : ℝ) * (amount allocation (history h) : ℝ) := by + rw [statisticCounts_sum] + exact_mod_cast population_cast allocation (terminalDilation K 1) (history h) + +def ZeroWords (allocation : Allocation) (m : ℕ) : TerminalZero K → Type + | .inl h => fourWords (aShape h.1.val) (statisticCounts allocation (.inl h)) m + | .inr h => twoWords (bWeight h) (statisticCounts allocation (.inr h)) m + +local instance terminalTwoWordsFintype (allocation : Allocation) (m : ℕ) (h : BZero K) : + Fintype (twoWords (bWeight h) (statisticCounts allocation (.inr h)) m) := + twoWordsFintype _ _ _ + +instance zeroWordsFintype (allocation : Allocation) (m : ℕ) (h : TerminalZero K) : + Fintype (ZeroWords allocation m h) := by + cases h <;> dsimp [ZeroWords] <;> infer_instance + +theorem zeroWords_card_inl (allocation : Allocation) (m : ℕ) (h : AZero K) : + Fintype.card (ZeroWords allocation m (.inl h)) = + Fintype.card (fourWords (aShape h.1.val) (statisticCounts allocation (.inl h)) m) := by + exact Fintype.card_congr (Equiv.refl _) + +theorem zeroWords_card_inr (allocation : Allocation) (m : ℕ) (h : BZero K) : + Fintype.card (ZeroWords allocation m (.inr h)) = + Fintype.card (twoWords (bWeight h) (statisticCounts allocation (.inr h)) m) := by + exact Fintype.card_congr (Equiv.refl _) + +theorem zeroWords_card_pos (allocation : Allocation) (m : ℕ) (h : TerminalZero K) : + 0 < Fintype.card (ZeroWords allocation m h) := by + cases h with + | inl h => + rw [zeroWords_card_inl] + exact four_card_pos (aShape h.1.val) (statisticCounts allocation (.inl h)) + (by simpa only [statisticCounts_sum_inl] using statisticCounts_pos allocation (.inl h)) + (by + intro slot + simpa only [statisticCounts_sum_inl, law_inl] using + statisticCounts_ratio allocation (.inl h) slot) m + | inr h => + rw [zeroWords_card_inr] + exact two_card_pos (binaryParameter (bParent h) (bShape h.1.val)) + (bWeight h) (statisticCounts allocation (.inr h)) + (by simpa only [statisticCounts_sum_inr] using statisticCounts_pos allocation (.inr h)) + (by + intro slot + simpa only [statisticCounts_sum_inr, law_inr] using + statisticCounts_ratio allocation (.inr h) slot) m + +theorem tendsto_zeroWords_local (allocation : Allocation) (h : TerminalZero K) : + Tendsto (fun m : ℕ => Real.log (Fintype.card (ZeroWords allocation m h) : ℝ) / + ((m : ℝ) * (∑ s, statisticCounts allocation h s : ℕ))) atTop + (𝓝 (zeroRate h)) := by + cases h with + | inl h => + simp only [zeroWords_card_inl, zeroRate, statisticCounts_sum_inl] + simpa only [Fintype.card_eq_nat_card] using + four_tendsto_log_card (aShape h.1.val) (statisticCounts allocation (.inl h)) + (by simpa only [statisticCounts_sum_inl] using statisticCounts_pos allocation (.inl h)) + (by + intro slot + simpa only [statisticCounts_sum_inl, law_inl] using + statisticCounts_ratio allocation (.inl h) slot) + | inr h => + simp only [zeroWords_card_inr, zeroRate, statisticCounts_sum_inr] + simpa only [Fintype.card_eq_nat_card] using + two_tendsto_log_card (binaryParameter (bParent h) (bShape h.1.val)) + (bWeight h) (statisticCounts allocation (.inr h)) + (by simpa only [statisticCounts_sum_inr] using statisticCounts_pos allocation (.inr h)) + (by + intro slot + simpa only [statisticCounts_sum_inr, law_inr] using + statisticCounts_ratio allocation (.inr h) slot) + +theorem tendsto_zeroWords (hK : 0 < K) (allocation : Allocation) (h : TerminalZero K) : + Tendsto (fun m : ℕ => Real.log (Fintype.card (ZeroWords allocation m h) : ℝ) / + ((K : ℝ) * terminalLength allocation K m)) atTop + (𝓝 ((amount allocation (history h) : ℝ) * zeroRate h / K)) := by + have ht := (tendsto_zeroWords_local allocation h).mul_const + ((amount allocation (history h) : ℝ) / K) + have hr : zeroRate h * ((amount allocation (history h) : ℝ) / K) = + (amount allocation (history h) : ℝ) * zeroRate h / K := by ring + rw [hr] at ht + apply ht.congr' + filter_upwards [eventually_gt_atTop (0 : ℕ)] with m hm + have hm' : (m : ℝ) ≠ 0 := by exact_mod_cast Nat.ne_of_gt hm + have hk' : (K : ℝ) ≠ 0 := by exact_mod_cast Nat.ne_of_gt hK + have hn' : (terminalLength allocation K 1 : ℝ) ≠ 0 := by + exact_mod_cast Nat.ne_of_gt (terminalLength_pos allocation (K := K) (m := 1) (by decide)) + have ha' : (amount allocation (history h) : ℝ) ≠ 0 := by + exact_mod_cast ne_of_gt (history_amount_pos allocation h) + rw [terminalLength_mul_one, Nat.cast_mul, statisticCounts_sum_cast] + field_simp [hm', hk', hn', ha'] + +def zeroVolume (allocation : Allocation) (m : ℕ) : ℕ := + Fintype.card (∀ h : TerminalZero K, ZeroWords allocation m h) + +theorem zeroVolume_pos (allocation : Allocation) (m : ℕ) : + 0 < zeroVolume (K := K) allocation m := by + simp only [zeroVolume, Fintype.card_pi] + exact Finset.prod_pos fun h _ => zeroWords_card_pos allocation m h + +theorem log_zeroVolume (allocation : Allocation) (m : ℕ) : + Real.log (zeroVolume (K := K) allocation m : ℝ) = + ∑ h : TerminalZero K, Real.log (Fintype.card (ZeroWords allocation m h) : ℝ) := by + rw [zeroVolume, Fintype.card_pi, Nat.cast_prod] + exact Real.log_prod (fun h _ => by + exact_mod_cast Nat.ne_of_gt (zeroWords_card_pos allocation m h)) + +theorem tendsto_zeroVolume (hK : 0 < K) (allocation : Allocation) : + Tendsto (fun m : ℕ => Real.log (zeroVolume (K := K) allocation m : ℝ) / + ((K : ℝ) * terminalLength allocation K m)) atTop + (𝓝 (S1 + S2 - AllFieldStageCTerminalRates.interiorS2)) := by + have ht := tendsto_finsetSum Finset.univ + (fun h _ => tendsto_zeroWords hK allocation h) + have hr : (∑ h : TerminalZero K, (amount allocation (history h) : ℝ) * zeroRate h / K) = + S1 + S2 - AllFieldStageCTerminalRates.interiorS2 := by + rw [← Finset.sum_div, zero_history_sum K allocation] + exact mul_div_cancel_left₀ _ (by exact_mod_cast Nat.ne_of_gt hK) + rw [hr] at ht + convert ht using 1 + ext m + rw [log_zeroVolume, Finset.sum_div] + +def terminalVolume (allocation : Allocation) (m : ℕ) : ℕ := + AllFieldInitialLeafRates.volume (K := K) allocation (terminalDilation K m) * + zeroVolume (K := K) allocation m * + CWStageCProducts.populationVolume (K := K) allocation (terminalDilation K m) + +theorem stageCVolume_pos (allocation : Allocation) (dilation : ℕ) : + 0 < CWStageCProducts.populationVolume (K := K) allocation dilation := by + unfold CWStageCProducts.populationVolume + rw [CWStageCProducts.historyVolume_eq_prod] + exact Finset.prod_pos fun h _ => CWStageCProducts.volume_pos _ _ + +theorem terminalVolume_pos (allocation : Allocation) (m : ℕ) : + 0 < terminalVolume (K := K) allocation m := by + exact Nat.mul_pos + (Nat.mul_pos (AllFieldInitialLeafRates.volume_pos allocation _) + (zeroVolume_pos allocation m)) (stageCVolume_pos allocation _) + +theorem log_terminalVolume (allocation : Allocation) (m : ℕ) : + Real.log (terminalVolume (K := K) allocation m : ℝ) = + Real.log (AllFieldInitialLeafRates.volume (K := K) allocation + (terminalDilation K m) : ℝ) + + Real.log (zeroVolume (K := K) allocation m : ℝ) + + Real.log (CWStageCProducts.populationVolume (K := K) allocation + (terminalDilation K m) : ℝ) := by + have hI : (AllFieldInitialLeafRates.volume (K := K) allocation + (terminalDilation K m) : ℝ) ≠ 0 := by + exact_mod_cast Nat.ne_of_gt (AllFieldInitialLeafRates.volume_pos allocation _) + have hZ : (zeroVolume (K := K) allocation m : ℝ) ≠ 0 := by + exact_mod_cast Nat.ne_of_gt (zeroVolume_pos allocation m) + have hC : (CWStageCProducts.populationVolume (K := K) allocation + (terminalDilation K m) : ℝ) ≠ 0 := by + exact_mod_cast Nat.ne_of_gt (stageCVolume_pos allocation _) + simp only [terminalVolume, Nat.cast_mul, Real.log_mul (mul_ne_zero hI hZ) hC, + Real.log_mul hI hZ] + +theorem normalized_log_initialVolume (hK : 0 < K) (allocation : Allocation) + {m : ℕ} (hm : 0 < m) : + Real.log (AllFieldInitialLeafRates.volume (K := K) allocation + (terminalDilation K m) : ℝ) / ((K : ℝ) * terminalLength allocation K m) = S0 := by + rw [AllFieldInitialLeafRates.log_volume_eq_S0] + change (terminalLength allocation K m : ℝ) * ((K : ℝ) * S0) / + ((K : ℝ) * terminalLength allocation K m) = S0 + have hk : (K : ℝ) ≠ 0 := by exact_mod_cast Nat.ne_of_gt hK + have hn : (terminalLength allocation K m : ℝ) ≠ 0 := by + exact_mod_cast Nat.ne_of_gt (terminalLength_pos allocation hm) + field_simp [hk, hn] + +theorem normalized_log_stageCVolume (hK : 0 < K) (allocation : Allocation) + {m : ℕ} (hm : 0 < m) : + Real.log (CWStageCProducts.populationVolume (K := K) allocation + (terminalDilation K m) : ℝ) / ((K : ℝ) * terminalLength allocation K m) = + AllFieldStageCTerminalRates.interiorS2 := + AllFieldStageCTerminalRates.normalized_log_populationVolume_eq_interior + hK allocation _ (terminalDilation_pos hm) + +theorem tendsto_terminalVolume (hK : 0 < K) (allocation : Allocation) : + Tendsto (fun m : ℕ => Real.log (terminalVolume (K := K) allocation m : ℝ) / + ((K : ℝ) * terminalLength allocation K m)) atTop (𝓝 S) := by + have hI : Tendsto (fun m : ℕ => + Real.log (AllFieldInitialLeafRates.volume (K := K) allocation + (terminalDilation K m) : ℝ) / ((K : ℝ) * terminalLength allocation K m)) + atTop (𝓝 S0) := by + apply tendsto_const_nhds.congr' + filter_upwards [eventually_gt_atTop (0 : ℕ)] with m hm + exact (normalized_log_initialVolume hK allocation hm).symm + have hC : Tendsto (fun m : ℕ => + Real.log (CWStageCProducts.populationVolume (K := K) allocation + (terminalDilation K m) : ℝ) / ((K : ℝ) * terminalLength allocation K m)) + atTop (𝓝 AllFieldStageCTerminalRates.interiorS2) := by + apply tendsto_const_nhds.congr' + filter_upwards [eventually_gt_atTop (0 : ℕ)] with m hm + exact (normalized_log_stageCVolume hK allocation hm).symm + have ht := (hI.add (tendsto_zeroVolume hK allocation)).add hC + have hr : S0 + (S1 + S2 - AllFieldStageCTerminalRates.interiorS2) + + AllFieldStageCTerminalRates.interiorS2 = S := by unfold S; ring + rw [hr] at ht + convert ht using 1 + ext m + rw [log_terminalVolume, add_div, add_div] + +end MatrixMultiplication.AllFieldTerminalRates + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/Entropy/TerminalStatisticLaws.lean b/lean/OAI/LinearAlgebra/MatrixFields/Entropy/TerminalStatisticLaws.lean new file mode 100644 index 0000000000000000000000000000000000000000..6c8aad42a92bda1f2f3b0373cd247bf3b7a07265 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/Entropy/TerminalStatisticLaws.lean @@ -0,0 +1,126 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Histories.HistoryChildLaws + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section + +namespace MatrixMultiplication.AllFieldTerminalStatisticLaws + +open AllFieldParameters AllFieldHistory +open scoped BigOperators +attribute [local instance] Classical.propDecidable Classical.decEq + +abbrev AZero (K : ℕ) := + {h : AfterA K // aShape h ∉ positiveSecond} × Placement + +abbrev BZero (K : ℕ) := + {h : AfterB K // positive (bShape h) ≠ true} × Placement + +abbrev TerminalZero (K : ℕ) := AZero K ⊕ BZero K + +variable {K : ℕ} + +theorem aShape_mem_shapes (h : AZero K) : aShape h.1.val ∈ shapes 8 := + aShape_size h.1.val + +theorem aShape_not_positive (h : AZero K) : positive (aShape h.1.val) ≠ true := by + intro hp + exact h.1.property (List.mem_filter.mpr ⟨aShape_mem_shapes h, hp⟩) + +theorem aShape_mem_zeroSecond (h : AZero K) : aShape h.1.val ∈ zeroSecond := by + simp [zeroSecond, aShape_mem_shapes h, aShape_not_positive h] + +def bParent (h : BZero K) : Shape := aShape h.1.val.1.val + +theorem bParent_mem_positiveSecond (h : BZero K) : bParent h ∈ positiveSecond := + h.1.val.1.property + +theorem bShape_mem_shapes (h : BZero K) : bShape h.1.val ∈ shapes 4 := + bShape_size h.1.val + +theorem bShape_mem_below (h : BZero K) : bShape h.1.val ∈ below (bParent h) := + bShape_mem h.1.val + +theorem bShape_max_lt_five (h : BZero K) : shapeMax (bShape h.1.val) < 5 := by + have hb := child_statistic_weight_bounded (bParent h) + (bParent_mem_positiveSecond h) (bShape h.1.val) (bShape_mem_below h) + exact max_lt_iff.mpr ⟨hb 0, max_lt_iff.mpr ⟨hb 1, hb 2⟩⟩ + +def bWeight (h : BZero K) : Fin 5 := + ⟨shapeMax (bShape h.1.val), bShape_max_lt_five h⟩ + +@[simp] theorem bWeight_val (h : BZero K) : (bWeight h).val = shapeMax (bShape h.1.val) := + rfl + +def Slot : TerminalZero K → Type + | .inl _ => PairSlot + | .inr _ => Fin 6 + +instance (h : TerminalZero K) : Fintype (Slot h) := by + cases h <;> dsimp [Slot] <;> infer_instance + +def history : TerminalZero K → History K + | .inl h => (.afterA h.1.val, h.2) + | .inr h => (.afterB h.1.val, h.2) + +@[simp] theorem history_inl (h : AZero K) : + history (.inl h) = (.afterA h.1.val, h.2) := rfl + +@[simp] theorem history_inr (h : BZero K) : + history (.inr h) = (.afterB h.1.val, h.2) := rfl + +def law : (h : TerminalZero K) → Slot h → ℚ + | .inl h, s => zeroPairLaw (aShape h.1.val) s.1 s.2 + | .inr h, s => statisticLaw (binaryParameter (bParent h) (bShape h.1.val)) (bWeight h) s + +@[simp] theorem law_inl (h : AZero K) (s : PairSlot) : + law (.inl h) s = zeroPairLaw (aShape h.1.val) s.1 s.2 := rfl + +@[simp] theorem law_inr (h : BZero K) (s : Fin 6) : + law (.inr h) s = + statisticLaw (binaryParameter (bParent h) (bShape h.1.val)) (bWeight h) s := rfl + +theorem statisticLaw_nonnegative (t u : Shape) (k : Fin 5) (s : Fin 6) : + 0 ≤ statisticLaw (binaryParameter t u) k s := by + obtain ⟨hl, hh⟩ := binaryParameter_bounds t u + unfold statisticLaw + split_ifs <;> linarith + +theorem statisticLaw_total (d : ℚ) (k : Fin 5) : + ∑ s : Fin 6, statisticLaw d k s = 1 := by + fin_cases k <;> simp [statisticLaw, Fin.sum_univ_succ, singletonSlot] + +theorem law_nonneg (h : TerminalZero K) (s : Slot h) : 0 ≤ law h s := by + cases h with + | inl h => exact zeroPairLaw_nonnegative (aShape h.1.val) s.1 s.2 + | inr h => exact statisticLaw_nonnegative (bParent h) (bShape h.1.val) (bWeight h) s + +theorem law_total (h : TerminalZero K) : ∑ s : Slot h, law h s = 1 := by + cases h with + | inl h => exact zeroPairLaw_full_normalized (aShape h.1.val) (aShape_mem_zeroSecond h) + | inr h => exact statisticLaw_total _ (bWeight h) + +theorem history_amount_pos (allocation : Allocation) (h : TerminalZero K) : + 0 < amount allocation (history h) := by + cases h with + | inl h => + change 0 < aAmount h.1.val / 6 + exact div_pos (aAmount_pos h.1.val) (by norm_num) + | inr h => + change 0 < bAmount h.1.val / 6 + exact div_pos (bAmount_pos h.1.val) (by norm_num) + +end MatrixMultiplication.AllFieldTerminalStatisticLaws + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/Entropy/ZeroLeafRateFormula.lean b/lean/OAI/LinearAlgebra/MatrixFields/Entropy/ZeroLeafRateFormula.lean new file mode 100644 index 0000000000000000000000000000000000000000..2666cb1e7e031cc9ac8e0abd9a3053638e6a5992 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/Entropy/ZeroLeafRateFormula.lean @@ -0,0 +1,879 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Certificates.CertificatesReplay +import OAI.LinearAlgebra.MatrixFields.Parameters.ParametersWeights + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section + +namespace MatrixMultiplication.Foundation + +open scoped BigOperators + +def entropyTerm (p : ℝ) : ℝ := -p * Real.log p + +def finiteEntropy {A : Type*} [Fintype A] (p : A → ℝ) : ℝ := ∑ a, entropyTerm (p a) + +theorem finiteEntropy_equiv {A B : Type*} [Fintype A] [Fintype B] + (e : A ≃ B) (p : B → ℝ) : finiteEntropy (fun a => p (e a)) = finiteEntropy p := + e.sum_comp (fun b => entropyTerm (p b)) + +@[simp] theorem entropyTerm_zero : entropyTerm 0 = 0 := by simp [entropyTerm] + +theorem entropyTerm_mul (p q : ℝ) : + entropyTerm (p * q) = q * entropyTerm p + p * entropyTerm q := by + by_cases hp : p = 0 + · simp [hp] + by_cases hq : q = 0 + · simp [hq] + rw [entropyTerm, Real.log_mul hp hq] + unfold entropyTerm + ring + +theorem finiteEntropy_chain {A B : Type*} [Fintype A] [Fintype B] + (p : A → ℝ) (q : A → B → ℝ) (hq : ∀ a, ∑ b, q a b = 1) : + finiteEntropy (fun ab : A × B => p ab.1 * q ab.1 ab.2) = + finiteEntropy p + ∑ a, p a * finiteEntropy (q a) := by + simp only [finiteEntropy, Fintype.sum_prod_type, entropyTerm_mul, + Finset.sum_add_distrib, ← Finset.sum_mul, ← Finset.mul_sum, hq, one_mul] + +structure FiniteLaw (A : Type*) [Fintype A] where + mass : A → ℝ + nonneg : ∀ a, 0 ≤ mass a + total : ∑ a, mass a = 1 + +namespace FiniteLaw + +variable {A B : Type*} [Fintype A] [Fintype B] + +def map (p : FiniteLaw A) (f : A → B) : FiniteLaw B := by + classical + exact + { mass := fun b => ∑ a, if f a = b then p.mass a else 0 + nonneg := fun b => Finset.sum_nonneg fun a _ => by + split_ifs + · exact p.nonneg a + · exact le_rfl + total := by + rw [Finset.sum_comm] + simpa using p.total } + +@[simp] theorem map_mass [DecidableEq B] (p : FiniteLaw A) (f : A → B) (b : B) : + (p.map f).mass b = ∑ a, if f a = b then p.mass a else 0 := by + classical + dsimp only [map] + apply Finset.sum_congr rfl + intro a _ + by_cases h : f a = b <;> simp only [h, ite_true, ite_false] + +theorem map_mass_apply (p : FiniteLaw A) (f : A → B) + (hf : Function.Injective f) (a : A) : (p.map f).mass (f a) = p.mass a := by + classical + simp [map_mass, hf.eq_iff] + +theorem map_entropy_of_injective (p : FiniteLaw A) (f : A → B) + (hf : Function.Injective f) : finiteEntropy (p.map f).mass = finiteEntropy p.mass := by + classical + have hterm (b : B) : entropyTerm ((p.map f).mass b) = + ∑ a, if f a = b then entropyTerm (p.mass a) else 0 := by + by_cases hb : ∃ a, f a = b + · obtain ⟨a, rfl⟩ := hb + rw [map_mass_apply p f hf] + simp [hf.eq_iff] + · simp [map_mass, not_exists.mp hb] + unfold finiteEntropy + simp_rw [hterm] + rw [Finset.sum_comm] + simp + +def joint (p : FiniteLaw A) (q : A → FiniteLaw B) : FiniteLaw (A × B) where + mass ab := p.mass ab.1 * (q ab.1).mass ab.2 + nonneg ab := mul_nonneg (p.nonneg ab.1) ((q ab.1).nonneg ab.2) + total := by simp [Fintype.sum_prod_type, ← Finset.mul_sum, (q _).total, p.total] + +theorem joint_entropy (p : FiniteLaw A) (q : A → FiniteLaw B) : + finiteEntropy (p.joint q).mass = + finiteEntropy p.mass + ∑ a, p.mass a * finiteEntropy (q a).mass := + finiteEntropy_chain p.mass (fun a => (q a).mass) (fun a => (q a).total) + +theorem mass_le_map_mass (p : FiniteLaw A) (f : A → B) (a : A) : + p.mass a ≤ (p.map f).mass (f a) := by + classical + rw [map_mass] + have h := Finset.single_le_sum + (s := (Finset.univ : Finset A)) + (f := fun a' => if f a' = f a then p.mass a' else 0) + (fun a' _ => by + split_ifs + · exact p.nonneg a' + · exact le_rfl) + (Finset.mem_univ a) + simpa using h + +def conditional (p : FiniteLaw A) (f : A → B) (b : B) : FiniteLaw A := by + classical + exact if hzero : (p.map f).mass b = 0 then p else + { mass := fun a => (if f a = b then p.mass a else 0) / (p.map f).mass b + nonneg := fun a => div_nonneg + (by split_ifs; exact p.nonneg a; exact le_rfl) ((p.map f).nonneg b) + total := by + rw [← Finset.sum_div, ← map_mass p f b, div_self hzero] } + +theorem map_mass_mul_conditional [DecidableEq B] + (p : FiniteLaw A) (f : A → B) (b : B) (a : A) : + (p.map f).mass b * (p.conditional f b).mass a = + if f a = b then p.mass a else 0 := by + classical + by_cases hzero : (p.map f).mass b = 0 + · have ha : f a = b → p.mass a = 0 := by + intro hab + have hle := p.mass_le_map_mass f a + rw [hab, hzero] at hle + exact le_antisymm hle (p.nonneg a) + rw [hzero, zero_mul] + by_cases hab : f a = b + · rw [ite_eq_left hab, ha hab] + · rw [ite_eq_right hab] + · simp only [conditional, hzero, ↓reduceDIte] + by_cases hab : f a = b + · simpa only [hab, ite_true] using (mul_div_cancel₀ (p.mass a) hzero) + · simp only [hab, ite_false, zero_div, mul_zero] + +theorem entropy_eq_map_add_conditional (p : FiniteLaw A) (f : A → B) : + finiteEntropy p.mass = finiteEntropy (p.map f).mass + + ∑ b, (p.map f).mass b * finiteEntropy (p.conditional f b).mass := by + classical + let graph : A → B × A := fun a => (f a, a) + have hinj : Function.Injective graph := fun _ _ h => congrArg Prod.snd h + have hmass : ((p.map f).joint (p.conditional f)).mass = (p.map graph).mass := by + funext ba + rcases ba with ⟨b, a⟩ + change (p.map f).mass b * (p.conditional f b).mass a = (p.map graph).mass (b, a) + rw [map_mass_mul_conditional, map_mass, Finset.sum_eq_single a] + · simp only [graph, Prod.mk.injEq, and_true] + · intro x _ hxa + simp only [graph, Prod.mk.injEq, hxa, and_false, ite_false] + · intro ha + exact (ha (Finset.mem_univ a)).elim + calc + finiteEntropy p.mass = finiteEntropy (p.map graph).mass := + (p.map_entropy_of_injective graph hinj).symm + _ = finiteEntropy ((p.map f).joint (p.conditional f)).mass := by rw [hmass] + _ = _ := (p.map f).joint_entropy (p.conditional f) + +end FiniteLaw +end MatrixMultiplication.Foundation + +end +end +namespace MatrixMultiplication.CompactCertificate +open AllFieldCertificates AllFieldCertificates.Replay + +inductive EntropyDatum where + | zero + | log (input output logarithm : Ball) (witness : LogData) + +def EntropyDatum.input : EntropyDatum → Ball + | .zero => .exact 0 + | .log p _ _ _ => p + +def EntropyDatum.output : EntropyDatum → Ball + | .zero => .exact 0 + | .log _ e _ _ => e + +def EntropyDatum.check (two : Ball) : EntropyDatum → Bool + | .zero => true + | .log p e l w => checkLog two p l w && contains (Ball.mul (Ball.neg p) l) e + +lemma EntropyDatum.sound {two : Ball} (htwo : two.Encloses (Real.log 2)) + {c : EntropyDatum} (hc : c.check two = true) {x : ℝ} + (hx : c.input.Encloses x) : c.output.Encloses (Foundation.entropyTerm x) := by + cases c with + | zero => + have hb := Ball.bounds hx + have h : x = 0 := by + norm_num [EntropyDatum.input, Ball.lower, Ball.upper, Ball.exact] at hb + linarith + simp only [h, Foundation.entropyTerm, neg_zero, zero_mul] + simpa only [EntropyDatum.output, Rat.cast_zero] using Ball.exact_sound 0 + | log p e l w => + simp only [EntropyDatum.check, Bool.and_eq_true] at hc + obtain ⟨hl, he⟩ := hc + exact contains_sound (Ball.mul_sound (Ball.neg_sound hx) + (checkLog_sound htwo hx hl)) he + +def entropyLookup (cs : List EntropyDatum) (i : ℕ) : EntropyDatum := + (cs[i]?).getD .zero + +lemma entropyLookup_check {two : Ball} {cs : List EntropyDatum} + (h : cs.all (fun c => c.check two) = true) (i : ℕ) : + (entropyLookup cs i).check two = true := by + induction cs generalizing i with + | nil => simp [entropyLookup, EntropyDatum.check] + | cons c cs ih => + simp only [List.all_cons, Bool.and_eq_true] at h + cases i with + | zero => simpa [entropyLookup] using h.1 + | succ i => simpa [entropyLookup] using ih h.2 i + +lemma entropyLookup_sound {two : Ball} (htwo : two.Encloses (Real.log 2)) + {cs : List EntropyDatum} (h : cs.all (fun c => c.check two) = true) + (i : ℕ) {x : ℝ} (hx : (entropyLookup cs i).input.Encloses x) : + (entropyLookup cs i).output.Encloses (Foundation.entropyTerm x) := + EntropyDatum.sound htwo (entropyLookup_check h i) hx + +end MatrixMultiplication.CompactCertificate + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +namespace MatrixMultiplication.AllFieldParameters + +open MatrixMultiplication.Foundation +open scoped BigOperators + +noncomputable section + +def homogeneousEntropy {A : Type*} [Fintype A] (p : A → ℝ) : ℝ := + (∑ a, p a) * Real.log (∑ a, p a) + finiteEntropy p + +theorem homogeneousEntropy_normalized {A : Type*} [Fintype A] + (p : A → ℝ) (hp : ∑ a, p a = 1) : + homogeneousEntropy p = finiteEntropy p := by + simp [homogeneousEntropy, hp] + +theorem entropyTerm_divide (x m : ℝ) : + entropyTerm (x / m) = entropyTerm x / m + (x / m) * Real.log m := by + by_cases hx : x = 0 + · simp [hx] + by_cases hm : m = 0 + · simp [hm] + rw [entropyTerm, Real.log_div hx hm] + unfold entropyTerm + ring + +theorem homogeneousEntropy_eq_mass_mul {A : Type*} [Fintype A] + (p : A → ℝ) (hm : ∑ a, p a ≠ 0) : + homogeneousEntropy p = + (∑ a, p a) * finiteEntropy (fun a => p a / ∑ b, p b) := by + simp only [finiteEntropy, entropyTerm_divide, Finset.sum_add_distrib, + ← Finset.sum_div, ← Finset.sum_mul] + unfold homogeneousEntropy finiteEntropy + rw [div_self hm] + field_simp + ring + +theorem homogeneousEntropy_zero {A : Type*} [Fintype A] : + homogeneousEntropy (fun _ : A => 0) = 0 := by + simp [homogeneousEntropy, finiteEntropy] + +theorem homogeneousEntropy_expansion {A : Type*} [Fintype A] (p : A → ℝ) : + homogeneousEntropy p = + (∑ a, p a) * Real.log (∑ a, p a) - ∑ a, p a * Real.log (p a) := by + simp only [homogeneousEntropy, finiteEntropy, entropyTerm, neg_mul, + Finset.sum_neg_distrib, sub_eq_add_neg] + +end + +end MatrixMultiplication.AllFieldParameters + +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section + +open scoped Topology +open Filter + +namespace MatrixMultiplication.Foundation + +theorem entropyTerm_eq_negMulLog (p : ℝ) : entropyTerm p = Real.negMulLog p := rfl + +@[simp] theorem entropyTerm_one : entropyTerm 1 = 0 := by simp [entropyTerm] + +theorem mul_entropyTerm_inv (x : ℝ) : x * entropyTerm x⁻¹ = Real.log x := by + by_cases hx : x = 0 + · simp [hx] + · simp only [entropyTerm, Real.log_inv] + calc + _ = (x * x⁻¹) * Real.log x := by ring + _ = Real.log x := by rw [mul_inv_cancel₀ hx, one_mul] + +theorem finiteEntropy_uniform {A : Type*} [Fintype A] : + finiteEntropy (fun _a : A => (Fintype.card A : ℝ)⁻¹) = + Real.log (Fintype.card A) := by + simp only [finiteEntropy, Finset.sum_const, Finset.card_univ, nsmul_eq_mul] + exact mul_entropyTerm_inv (Fintype.card A) + +theorem finiteEntropy_deterministic {A : Type*} [Fintype A] [DecidableEq A] + (a : A) : finiteEntropy (fun b => if b = a then 1 else 0) = 0 := by + apply Finset.sum_eq_zero + intro b hb + change entropyTerm (if b = a then 1 else 0) = 0 + split_ifs <;> simp + +@[fun_prop] theorem continuous_entropyTerm : Continuous entropyTerm := + Real.continuous_negMulLog + +theorem entropyTerm_nonneg {p : ℝ} (hp₀ : 0 ≤ p) (hp₁ : p ≤ 1) : + 0 ≤ entropyTerm p := + Real.negMulLog_nonneg hp₀ hp₁ + +theorem concaveOn_entropyTerm : ConcaveOn ℝ (Set.Ici 0) entropyTerm := + Real.concaveOn_negMulLog + +@[fun_prop] theorem continuous_finiteEntropy {A : Type*} [Fintype A] : + Continuous (finiteEntropy : (A → ℝ) → ℝ) := by + unfold finiteEntropy + exact continuous_finsetSum _ fun a _ => continuous_entropyTerm.comp (continuous_apply a) + +theorem tendsto_entropyTerm {I : Type*} {l : Filter I} {p : I → ℝ} {q : ℝ} + (h : Tendsto p l (𝓝 q)) : + Tendsto (fun i => entropyTerm (p i)) l (𝓝 (entropyTerm q)) := + continuous_entropyTerm.continuousAt.tendsto.comp h + +theorem tendsto_entropyTerm_zero {I : Type*} {l : Filter I} {p : I → ℝ} + (h : Tendsto p l (𝓝 0)) : + Tendsto (fun i => entropyTerm (p i)) l (𝓝 0) := by + simpa only [entropyTerm_zero] using tendsto_entropyTerm h + +theorem tendsto_finiteEntropy_of_tendsto {I A : Type*} [Fintype A] + {l : Filter I} {p : I → A → ℝ} {q : A → ℝ} + (h : ∀ a, Tendsto (fun i => p i a) l (𝓝 (q a))) : + Tendsto (fun i => finiteEntropy (p i)) l (𝓝 (finiteEntropy q)) := + continuous_finiteEntropy.continuousAt.tendsto.comp (tendsto_pi_nhds.mpr h) + +theorem finiteEntropy_nonneg {A : Type*} [Fintype A] (p : A → ℝ) + (hp₀ : ∀ a, 0 ≤ p a) (hp₁ : ∀ a, p a ≤ 1) : 0 ≤ finiteEntropy p := by + exact Finset.sum_nonneg fun a _ => entropyTerm_nonneg (hp₀ a) (hp₁ a) + +theorem finiteEntropy_mix_le {A : Type*} [Fintype A] (p q : A → ℝ) + (hp : ∀ i, 0 ≤ p i) (hq : ∀ i, 0 ≤ q i) + {a b : ℝ} (ha : 0 ≤ a) (hb : 0 ≤ b) (hab : a + b = 1) : + a * finiteEntropy p + b * finiteEntropy q ≤ + finiteEntropy (fun i => a * p i + b * q i) := by + calc + a * finiteEntropy p + b * finiteEntropy q = + ∑ i, (a * entropyTerm (p i) + b * entropyTerm (q i)) := by + simp only [finiteEntropy, Finset.sum_add_distrib, ← Finset.mul_sum] + _ ≤ finiteEntropy (fun i => a * p i + b * q i) := by + apply Finset.sum_le_sum + intro i hi + exact concaveOn_entropyTerm.2 (hp i) (hq i) ha hb hab + +theorem finiteEntropy_le_log_card {A : Type*} [Fintype A] (p : A → ℝ) + (hp : ∀ a, 0 ≤ p a) (htotal : ∑ a, p a = 1) : + finiteEntropy p ≤ Real.log (Fintype.card A) := by + classical + have hcard : 0 < Fintype.card A := by + by_contra h + have : IsEmpty A := Fintype.card_eq_zero_iff.mp (Nat.eq_zero_of_not_pos h) + simp at htotal + have hn : (0 : ℝ) < Fintype.card A := Nat.cast_pos.mpr hcard + have hw : ∑ _a : A, (Fintype.card A : ℝ)⁻¹ = 1 := by + simp [Finset.sum_const, nsmul_eq_mul, hn.ne'] + have hJ := concaveOn_entropyTerm.le_map_sum + (t := (Finset.univ : Finset A)) + (w := fun _a : A => (Fintype.card A : ℝ)⁻¹) (p := p) + (fun _a _ha => (inv_pos.mpr hn).le) hw (fun a _ha => hp a) + have hJ' : (Fintype.card A : ℝ)⁻¹ * finiteEntropy p ≤ + entropyTerm (Fintype.card A : ℝ)⁻¹ := by + simpa only [smul_eq_mul, ← Finset.mul_sum, htotal, mul_one, finiteEntropy] using hJ + calc + finiteEntropy p = (Fintype.card A : ℝ) * + ((Fintype.card A : ℝ)⁻¹ * finiteEntropy p) := by + rw [← mul_assoc, mul_inv_cancel₀ hn.ne', one_mul] + _ ≤ (Fintype.card A : ℝ) * entropyTerm (Fintype.card A : ℝ)⁻¹ := + mul_le_mul_of_nonneg_left hJ' hn.le + _ = Real.log (Fintype.card A) := mul_entropyTerm_inv (Fintype.card A) + +namespace FiniteLaw + +variable {A : Type*} [Fintype A] + +def uniform (A : Type*) [Fintype A] [Nonempty A] : FiniteLaw A where + mass _a := (Fintype.card A : ℝ)⁻¹ + nonneg _a := inv_nonneg.mpr (Nat.cast_nonneg _) + total := by + have hn : (Fintype.card A : ℝ) ≠ 0 := + (Nat.cast_pos.mpr (Fintype.card_pos : 0 < Fintype.card A)).ne' + simp [Finset.sum_const, nsmul_eq_mul, hn] + +@[simp] theorem uniform_mass [Nonempty A] (a : A) : + (uniform A).mass a = (Fintype.card A : ℝ)⁻¹ := rfl + +@[simp] theorem uniform_entropy [Nonempty A] : + finiteEntropy (uniform A).mass = Real.log (Fintype.card A) := + finiteEntropy_uniform + +def pure (a : A) : FiniteLaw A := by + classical + exact + { mass := fun b => if b = a then 1 else 0 + nonneg := fun b => by split_ifs <;> norm_num + total := by simp } + +@[simp] theorem pure_entropy (a : A) : finiteEntropy (pure a).mass = 0 := by + classical + exact finiteEntropy_deterministic a + +theorem mass_le_one (p : FiniteLaw A) (a : A) : p.mass a ≤ 1 := by + calc + p.mass a ≤ ∑ b, p.mass b := + Finset.single_le_sum (fun b _hb => p.nonneg b) (Finset.mem_univ a) + _ = 1 := p.total + +theorem entropy_nonneg (p : FiniteLaw A) : 0 ≤ finiteEntropy p.mass := + finiteEntropy_nonneg p.mass p.nonneg p.mass_le_one + +theorem entropy_le_log_card (p : FiniteLaw A) : + finiteEntropy p.mass ≤ Real.log (Fintype.card A) := + finiteEntropy_le_log_card p.mass p.nonneg p.total + +theorem map_entropy_le {B : Type*} [Fintype B] (p : FiniteLaw A) (f : A → B) : + finiteEntropy (p.map f).mass ≤ finiteEntropy p.mass := by + calc + finiteEntropy (p.map f).mass ≤ finiteEntropy (p.map f).mass + + ∑ b, (p.map f).mass b * finiteEntropy (p.conditional f b).mass := + le_add_of_nonneg_right (Finset.sum_nonneg fun b _ => + mul_nonneg ((p.map f).nonneg b) ((p.conditional f b).entropy_nonneg)) + _ = finiteEntropy p.mass := (p.entropy_eq_map_add_conditional f).symm + +theorem entropy_tendsto {I : Type*} {l : Filter I} + {p : I → FiniteLaw A} {q : FiniteLaw A} + (h : ∀ a, Tendsto (fun i => (p i).mass a) l (𝓝 (q.mass a))) : + Tendsto (fun i => finiteEntropy (p i).mass) l (𝓝 (finiteEntropy q.mass)) := + tendsto_finiteEntropy_of_tendsto h + +end FiniteLaw +end MatrixMultiplication.Foundation + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +namespace MatrixMultiplication.Foundation + +open scoped BigOperators + +universe u v + +noncomputable section + +namespace FiniteLaw + +theorem map_mass_mul_conditional_map {A B C : Type*} + [Fintype A] [Fintype B] [Fintype C] + (p : FiniteLaw A) (f : A → B) (g : A → C) (b : B) (c : C) : + (p.map f).mass b * ((p.conditional f b).map g).mass c = + (p.map (fun a => (f a, g a))).mass (b, c) := by + classical + rw [map_mass (p.conditional f b) g c, Finset.mul_sum, + map_mass p (fun a => (f a, g a)) (b, c)] + apply Finset.sum_congr rfl + intro a _ + by_cases hgc : g a = c + · rw [ite_eq_left hgc, map_mass_mul_conditional] + simp only [Prod.mk.injEq, hgc, and_true] + · rw [ite_eq_right hgc, mul_zero] + have hpair : (f a, g a) ≠ (b, c) := + fun he => hgc (congrArg Prod.snd he) + rw [ite_eq_right hpair] + +end FiniteLaw + +def LabelRecord (Label : ℕ → Type u) : ℕ → Type u + | 0 => PUnit + | n + 1 => LabelRecord Label n × Label n + +instance labelRecordFintype (Label : ℕ → Type u) [∀ n, Fintype (Label n)] : + (n : ℕ) → Fintype (LabelRecord Label n) + | 0 => by + change Fintype PUnit + infer_instance + | n + 1 => by + letI := labelRecordFintype Label n + change Fintype (LabelRecord Label n × Label n) + infer_instance + +def labelRecordOf {A : Type v} {Label : ℕ → Type u} + (labels : ∀ n, A → Label n) : (n : ℕ) → A → LabelRecord Label n + | 0, _ => PUnit.unit + | n + 1, a => (labelRecordOf labels n a, labels n a) + +structure FiniteLabelHierarchy (Label : ℕ → Type u) [∀ n, Fintype (Label n)] + (depth : ℕ) where + conditional : ∀ n, n < depth → LabelRecord Label n → FiniteLaw (Label n) + +namespace FiniteLabelHierarchy + +variable {Label : ℕ → Type u} [∀ n, Fintype (Label n)] {depth : ℕ} + +def prefixLaw (h : FiniteLabelHierarchy Label depth) : + (n : ℕ) → n ≤ depth → FiniteLaw (LabelRecord Label n) + | 0, _ => + { mass := fun _ => 1 + nonneg := fun _ => zero_le_one + total := by + change (∑ _ : PUnit, (1 : ℝ)) = 1 + simp } + | n + 1, hn => + (h.prefixLaw n (Nat.le_of_succ_le hn)).joint + (h.conditional n (Nat.lt_of_succ_le hn)) + +@[simp] theorem prefixLaw_zero_mass (h : FiniteLabelHierarchy Label depth) + (hn : 0 ≤ depth) (r : LabelRecord Label 0) : + (h.prefixLaw 0 hn).mass r = 1 := rfl + +@[simp] theorem prefixLaw_succ (h : FiniteLabelHierarchy Label depth) + (n : ℕ) (hn : n + 1 ≤ depth) : + h.prefixLaw (n + 1) hn = + (h.prefixLaw n (Nat.le_of_succ_le hn)).joint + (h.conditional n (Nat.lt_of_succ_le hn)) := rfl + +@[simp] theorem prefixLaw_succ_mass (h : FiniteLabelHierarchy Label depth) + (n : ℕ) (hn : n + 1 ≤ depth) (r : LabelRecord Label n) (s : Label n) : + (h.prefixLaw (n + 1) hn).mass (r, s) = + (h.prefixLaw n (Nat.le_of_succ_le hn)).mass r * + (h.conditional n (Nat.lt_of_succ_le hn) r).mass s := rfl + +def refinementEntropy (h : FiniteLabelHierarchy Label depth) (n : ℕ) : ℝ := + if hn : n < depth then + ∑ r, (h.prefixLaw n (Nat.le_of_lt hn)).mass r * + finiteEntropy (h.conditional n hn r).mass + else 0 + +theorem refinementEntropy_eq (h : FiniteLabelHierarchy Label depth) + (n : ℕ) (hn : n < depth) : + h.refinementEntropy n = + ∑ r, (h.prefixLaw n (Nat.le_of_lt hn)).mass r * + finiteEntropy (h.conditional n hn r).mass := by + simp only [refinementEntropy, dite_eq_left hn] + +@[simp] theorem refinementEntropy_eq_zero_of_le + (h : FiniteLabelHierarchy Label depth) {n : ℕ} (hn : depth ≤ n) : + h.refinementEntropy n = 0 := by + simp only [refinementEntropy, dite_eq_right (Nat.not_lt.mpr hn)] + +theorem zero_prefix_contribution (h : FiniteLabelHierarchy Label depth) + (n : ℕ) (hn : n < depth) (r : LabelRecord Label n) + (hr : (h.prefixLaw n (Nat.le_of_lt hn)).mass r = 0) : + (h.prefixLaw n (Nat.le_of_lt hn)).mass r * + finiteEntropy (h.conditional n hn r).mass = 0 := by + rw [hr, zero_mul] + +theorem prefixLaw_entropy_succ (h : FiniteLabelHierarchy Label depth) + (n : ℕ) (hn : n + 1 ≤ depth) : + finiteEntropy (h.prefixLaw (n + 1) hn).mass = + finiteEntropy (h.prefixLaw n (Nat.le_of_succ_le hn)).mass + + h.refinementEntropy n := by + change finiteEntropy ((h.prefixLaw n (Nat.le_of_succ_le hn)).joint + (h.conditional n (Nat.lt_of_succ_le hn))).mass = _ + rw [FiniteLaw.joint_entropy] + rw [refinementEntropy_eq h n (Nat.lt_of_succ_le hn)] + +theorem prefixLaw_entropy (h : FiniteLabelHierarchy Label depth) + (n : ℕ) (hn : n ≤ depth) : + finiteEntropy (h.prefixLaw n hn).mass = + ∑ j ∈ Finset.range n, h.refinementEntropy j := by + induction n with + | zero => + simp [prefixLaw, finiteEntropy, entropyTerm, LabelRecord] + | succ n ih => + rw [prefixLaw_entropy_succ h n hn, + ih (Nat.le_of_succ_le hn), Finset.sum_range_succ] + +def recordLaw (h : FiniteLabelHierarchy Label depth) : + FiniteLaw (LabelRecord Label depth) := h.prefixLaw depth le_rfl + +theorem recordLaw_entropy (h : FiniteLabelHierarchy Label depth) : + finiteEntropy h.recordLaw.mass = + ∑ j ∈ Finset.range depth, h.refinementEntropy j := + h.prefixLaw_entropy depth le_rfl + +theorem refinementEntropy_sum_of_injective_record + {A : Type v} [Fintype A] (h : FiniteLabelHierarchy Label depth) + (p : FiniteLaw A) (record : A → LabelRecord Label depth) + (hinjective : Function.Injective record) + (hmass : h.recordLaw.mass = (p.map record).mass) : + (∑ j ∈ Finset.range depth, h.refinementEntropy j) = finiteEntropy p.mass := by + calc + (∑ j ∈ Finset.range depth, h.refinementEntropy j) = + finiteEntropy h.recordLaw.mass := h.recordLaw_entropy.symm + _ = finiteEntropy (p.map record).mass := congrArg finiteEntropy hmass + _ = finiteEntropy p.mass := p.map_entropy_of_injective record hinjective + +def ofLawLabels {A : Type v} [Fintype A] (p : FiniteLaw A) + (labels : ∀ n, A → Label n) (depth : ℕ) : FiniteLabelHierarchy Label depth where + conditional n _ r := (p.conditional (labelRecordOf labels n) r).map (labels n) + +theorem ofLawLabels_prefixLaw_mass {A : Type v} [Fintype A] + (p : FiniteLaw A) (labels : ∀ n, A → Label n) + (depth n : ℕ) (hn : n ≤ depth) : + ((ofLawLabels p labels depth).prefixLaw n hn).mass = + (p.map (labelRecordOf labels n)).mass := by + classical + induction n with + | zero => + funext r + cases r + change 1 = (p.map (fun _ : A => (PUnit.unit : PUnit))).mass PUnit.unit + simp [FiniteLaw.map_mass, p.total] + | succ n ih => + funext rs + rcases rs with ⟨r, s⟩ + rw [prefixLaw_succ_mass] + change ((ofLawLabels p labels depth).prefixLaw n + (Nat.le_of_succ_le hn)).mass r * + ((p.conditional (labelRecordOf labels n) r).map (labels n)).mass s = + (p.map (labelRecordOf labels (n + 1))).mass (r, s) + rw [ih (Nat.le_of_succ_le hn)] + exact p.map_mass_mul_conditional_map + (labelRecordOf labels n) (labels n) r s + +theorem ofLawLabels_refinementEntropy_eq {A : Type v} [Fintype A] + (p : FiniteLaw A) (labels : ∀ n, A → Label n) + (depth n : ℕ) (hn : n < depth) : + (ofLawLabels p labels depth).refinementEntropy n = + ∑ r : LabelRecord Label n, (p.map (labelRecordOf labels n)).mass r * + finiteEntropy ((p.conditional (labelRecordOf labels n) r).map (labels n)).mass := by + rw [refinementEntropy_eq _ n hn, + ofLawLabels_prefixLaw_mass p labels depth n (Nat.le_of_lt hn)] + rfl + +theorem ofLawLabels_refinementEntropy_sum {A : Type v} [Fintype A] + (p : FiniteLaw A) (labels : ∀ n, A → Label n) (depth : ℕ) + (hinjective : Function.Injective (labelRecordOf labels depth)) : + (∑ j ∈ Finset.range depth, + (ofLawLabels p labels depth).refinementEntropy j) = finiteEntropy p.mass := by + apply (ofLawLabels p labels depth).refinementEntropy_sum_of_injective_record + p (labelRecordOf labels depth) hinjective + exact ofLawLabels_prefixLaw_mass p labels depth depth le_rfl + +theorem entropy_eq_sum_conditional_labels {A : Type v} [Fintype A] + (p : FiniteLaw A) (labels : ∀ n, A → Label n) (depth : ℕ) + (hinjective : Function.Injective (labelRecordOf labels depth)) : + finiteEntropy p.mass = + ∑ j ∈ Finset.range depth, ∑ r : LabelRecord Label j, + (p.map (labelRecordOf labels j)).mass r * + finiteEntropy ((p.conditional (labelRecordOf labels j) r).map (labels j)).mass := by + rw [← ofLawLabels_refinementEntropy_sum p labels depth hinjective] + apply Finset.sum_congr rfl + intro j hj + exact ofLawLabels_refinementEntropy_eq p labels depth j (Finset.mem_range.mp hj) + +end FiniteLabelHierarchy + +end +end MatrixMultiplication.Foundation + +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section + +open scoped BigOperators +open MatrixMultiplication.Foundation + +namespace MatrixMultiplication.JointEntropyMax + +theorem entropy_nonneg {A : Type*} [Fintype A] (p : FiniteLaw A) : + 0 ≤ finiteEntropy p.mass := + FiniteLaw.entropy_nonneg p + +theorem map_entropy_le {A B : Type*} [Fintype A] [Fintype B] + (p : FiniteLaw A) (f : A → B) : + finiteEntropy (p.map f).mass ≤ finiteEntropy p.mass := + FiniteLaw.map_entropy_le p f + +theorem entropy_sub_map_nonneg {A B : Type*} [Fintype A] [Fintype B] + (p : FiniteLaw A) (f : A → B) : + 0 ≤ finiteEntropy p.mass - finiteEntropy (p.map f).mass := + sub_nonneg.mpr (map_entropy_le p f) + +theorem entropyTerm_le_crossEntropyTerm {p q : ℝ} (hp : 0 < p) (hq : 0 ≤ q) : + entropyTerm q ≤ -q * Real.log p + p - q := by + by_cases hzero : q = 0 + · simpa [hzero] using hp.le + have hqpos : 0 < q := lt_of_le_of_ne hq (Ne.symm hzero) + have hlog := Real.log_le_sub_one_of_pos (div_pos hp hqpos) + rw [Real.log_div hp.ne' hqpos.ne'] at hlog + have hmul := mul_le_mul_of_nonneg_left hlog hq + have hcancel : q * (p / q - 1) = p - q := by + field_simp + rw [hcancel] at hmul + unfold entropyTerm + linarith + +theorem entropy_le_crossEntropy {A : Type*} [Fintype A] + (p q : FiniteLaw A) (hp : ∀ a, 0 < p.mass a) : + finiteEntropy q.mass ≤ ∑ a, -q.mass a * Real.log (p.mass a) := by + calc + finiteEntropy q.mass ≤ + ∑ a, (-q.mass a * Real.log (p.mass a) + p.mass a - q.mass a) := + Finset.sum_le_sum fun a _ => entropyTerm_le_crossEntropyTerm (hp a) (q.nonneg a) + _ = ∑ a, -q.mass a * Real.log (p.mass a) := by + rw [Finset.sum_sub_distrib, Finset.sum_add_distrib, p.total, q.total] + ring + +theorem sum_mass_mul_coordinate {A B : Type*} [Fintype A] [Fintype B] + (p : FiniteLaw A) (f : A → B) (v : B → ℝ) : + (∑ a, p.mass a * v (f a)) = ∑ b, (p.map f).mass b * v b := by + classical + simp_rw [FiniteLaw.map_mass, Finset.sum_mul, ite_mul, zero_mul] + rw [Finset.sum_comm] + simp + +theorem sum_mass_mul_coordinate_eq {A B : Type*} [Fintype A] [Fintype B] + (p q : FiniteLaw A) (f : A → B) (v : B → ℝ) + (hmarginal : (q.map f).mass = (p.map f).mass) : + (∑ a, q.mass a * v (f a)) = ∑ a, p.mass a * v (f a) := by + rw [sum_mass_mul_coordinate q f v, sum_mass_mul_coordinate p f v, hmarginal] + +theorem entropy_le_of_three_marginals + {A X Y Z : Type*} [Fintype A] [Fintype X] [Fintype Y] [Fintype Z] + (p q : FiniteLaw A) (fX : A → X) (fY : A → Y) (fZ : A → Z) + (u : X → ℝ) (v : Y → ℝ) (w : Z → ℝ) (c : ℝ) + (hp : ∀ a, 0 < p.mass a) + (hlog : ∀ a, Real.log (p.mass a) = u (fX a) + v (fY a) + w (fZ a) - c) + (hX : (q.map fX).mass = (p.map fX).mass) + (hY : (q.map fY).mass = (p.map fY).mass) + (hZ : (q.map fZ).mass = (p.map fZ).mass) : + finiteEntropy q.mass ≤ finiteEntropy p.mass := by + have hx := sum_mass_mul_coordinate_eq p q fX u hX + have hy := sum_mass_mul_coordinate_eq p q fY v hY + have hz := sum_mass_mul_coordinate_eq p q fZ w hZ + have hexpand (r : FiniteLaw A) : + (∑ a, r.mass a * (u (fX a) + v (fY a) + w (fZ a) - c)) = + (∑ a, r.mass a * u (fX a)) + (∑ a, r.mass a * v (fY a)) + + (∑ a, r.mass a * w (fZ a)) - c := by + simp_rw [mul_sub, mul_add] + rw [Finset.sum_sub_distrib, Finset.sum_add_distrib, Finset.sum_add_distrib, + ← Finset.sum_mul, r.total, one_mul] + have hexpect : (∑ a, q.mass a * Real.log (p.mass a)) = + ∑ a, p.mass a * Real.log (p.mass a) := by + simp_rw [hlog] + rw [hexpand q, hexpand p, hx, hy, hz] + calc + finiteEntropy q.mass ≤ ∑ a, -q.mass a * Real.log (p.mass a) := + entropy_le_crossEntropy p q hp + _ = -(∑ a, q.mass a * Real.log (p.mass a)) := by + simp only [neg_mul, Finset.sum_neg_distrib] + _ = -(∑ a, p.mass a * Real.log (p.mass a)) := by rw [hexpect] + _ = finiteEntropy p.mass := by + simp only [finiteEntropy, entropyTerm, neg_mul, Finset.sum_neg_distrib] + +def normalizedPositiveLaw {A : Type*} [Fintype A] [Nonempty A] + (weight : A → ℝ) (hweight : ∀ a, 0 < weight a) : FiniteLaw A where + mass a := weight a / ∑ b, weight b + nonneg a := div_nonneg (hweight a).le + (Finset.sum_nonneg fun b _ => (hweight b).le) + total := by + have htotal : 0 < ∑ b, weight b := + Finset.sum_pos (fun b _ => hweight b) Finset.univ_nonempty + rw [← Finset.sum_div, div_self htotal.ne'] + +theorem normalizedPositiveLaw_mass_pos {A : Type*} [Fintype A] [Nonempty A] + (weight : A → ℝ) (hweight : ∀ a, 0 < weight a) (a : A) : + 0 < (normalizedPositiveLaw weight hweight).mass a := by + exact div_pos (hweight a) + (Finset.sum_pos (fun b _ => hweight b) Finset.univ_nonempty) + +theorem entropy_le_normalized_product + {A X Y Z : Type*} [Fintype A] [Nonempty A] + [Fintype X] [Fintype Y] [Fintype Z] + (fX : A → X) (fY : A → Y) (fZ : A → Z) + (wx : X → ℝ) (wy : Y → ℝ) (wz : Z → ℝ) + (hx : ∀ x, 0 < wx x) (hy : ∀ y, 0 < wy y) (hz : ∀ z, 0 < wz z) + (q : FiniteLaw A) + (hX : (q.map fX).mass = + ((normalizedPositiveLaw (fun a => wx (fX a) * wy (fY a) * wz (fZ a)) + (fun _ => mul_pos (mul_pos (hx _) (hy _)) (hz _))).map fX).mass) + (hY : (q.map fY).mass = + ((normalizedPositiveLaw (fun a => wx (fX a) * wy (fY a) * wz (fZ a)) + (fun _ => mul_pos (mul_pos (hx _) (hy _)) (hz _))).map fY).mass) + (hZ : (q.map fZ).mass = + ((normalizedPositiveLaw (fun a => wx (fX a) * wy (fY a) * wz (fZ a)) + (fun _ => mul_pos (mul_pos (hx _) (hy _)) (hz _))).map fZ).mass) : + finiteEntropy q.mass ≤ + finiteEntropy (normalizedPositiveLaw + (fun a => wx (fX a) * wy (fY a) * wz (fZ a)) + (fun _ => mul_pos (mul_pos (hx _) (hy _)) (hz _))).mass := by + let weight : A → ℝ := fun a => wx (fX a) * wy (fY a) * wz (fZ a) + have hweight : ∀ a, 0 < weight a := fun a => mul_pos (mul_pos (hx _) (hy _)) (hz _) + let p := normalizedPositiveLaw weight hweight + have htotal : 0 < ∑ a, weight a := + Finset.sum_pos (fun a _ => hweight a) Finset.univ_nonempty + apply entropy_le_of_three_marginals p q fX fY fZ + (fun x => Real.log (wx x)) (fun y => Real.log (wy y)) + (fun z => Real.log (wz z)) (Real.log (∑ a, weight a)) + (normalizedPositiveLaw_mass_pos weight hweight) + · intro a + change Real.log (weight a / ∑ b, weight b) = _ + rw [Real.log_div (hweight a).ne' htotal.ne'] + dsimp only [weight] + rw [Real.log_mul (mul_pos (hx _) (hy _)).ne' (hz _).ne', + Real.log_mul (hx _).ne' (hy _).ne'] + · exact hX + · exact hY + · exact hZ + +end MatrixMultiplication.JointEntropyMax + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section + +namespace MatrixMultiplication.AllFieldZeroLeafRates + +open MatrixMultiplication.Foundation AllFieldParameters +open scoped BigOperators + +def fourRate (t : Shape) : ℝ := + finiteEntropy (fun s : PairSlot => (zeroPairLaw t s.1 s.2 : ℝ)) + + ∑ s : PairSlot, (zeroPairLaw t s.1 s.2 : ℝ) * + Real.log (AllFieldParameters.multiplicity s.1 * AllFieldParameters.multiplicity s.2 : ℕ) + +end MatrixMultiplication.AllFieldZeroLeafRates + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/Entropy/ZeroLeafRates.lean b/lean/OAI/LinearAlgebra/MatrixFields/Entropy/ZeroLeafRates.lean new file mode 100644 index 0000000000000000000000000000000000000000..baca60d4eeeb15743205d4b895c1fbe24f424ade --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/Entropy/ZeroLeafRates.lean @@ -0,0 +1,1039 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Entropy.InitialLeafRates +import OAI.LinearAlgebra.MatrixFields.Extraction.ComplexLabelHierarchySeparation +import OAI.LinearAlgebra.MatrixFields.Extraction.ComplexRationalTypes + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +namespace MatrixMultiplication.Foundation + +open Filter +open scoped Topology + +noncomputable def factorialLogRemainder (n : ℕ) : ℝ := + Real.log (Nat.factorial n : ℝ) - ((n : ℝ) * Real.log n - n) + +theorem factorialLogRemainder_eq (n : ℕ) : + factorialLogRemainder n = + Real.log (Nat.factorial n : ℝ) - ((n : ℝ) * Real.log n - n) := rfl + +@[simp] theorem factorialLogRemainder_zero : factorialLogRemainder 0 = 0 := by + simp [factorialLogRemainder] + +theorem factorialLogRemainder_stirling (n : ℕ) : + factorialLogRemainder n = + Real.log (Stirling.stirlingSeq n) + (1 / 2 : ℝ) * Real.log (2 * n) := by + cases n with + | zero => simp + | succ n => + have h := Stirling.log_stirlingSeq_formula (n + 1) + rw [Real.log_div (by positivity) (Real.exp_ne_zero _), Real.log_exp] at h + unfold factorialLogRemainder + linarith + +theorem tendsto_factorialLogRemainder_div : + Tendsto (fun n : ℕ => factorialLogRemainder n / (n : ℝ)) atTop (𝓝 0) := by + have hnat : Tendsto (fun n : ℕ => (n : ℝ)) atTop atTop := + tendsto_natCast_atTop_atTop + have hstirling : + Tendsto (fun n : ℕ => Real.log (Stirling.stirlingSeq n) / (n : ℝ)) + atTop (𝓝 0) := + (Stirling.tendsto_stirlingSeq_sqrt_pi.log (by positivity)).div_atTop hnat + have hlog : Tendsto (fun n : ℕ => Real.log (n : ℝ) / (n : ℝ)) + atTop (𝓝 0) := by + simpa only [Function.comp_def, id_eq] using + Real.isLittleO_log_id_atTop.tendsto_div_nhds_zero.comp hnat + have hconstant : Tendsto (fun n : ℕ => Real.log 2 / (n : ℝ)) + atTop (𝓝 0) := tendsto_const_nhds.div_atTop hnat + have hsum : Tendsto + (fun n : ℕ => Real.log (Stirling.stirlingSeq n) / (n : ℝ) + + (1 / 2 : ℝ) * (Real.log 2 / (n : ℝ) + Real.log (n : ℝ) / (n : ℝ))) + atTop (𝓝 0) := by + simpa using hstirling.add ((hconstant.add hlog).const_mul (1 / 2 : ℝ)) + apply hsum.congr' + filter_upwards [eventually_ne_atTop (0 : ℕ)] with n hn + rw [factorialLogRemainder_stirling, + Real.log_mul (by norm_num) (Nat.cast_ne_zero.mpr hn)] + ring + +theorem tendsto_factorialLogRemainder_mul_div (c : ℕ) : + Tendsto (fun t : ℕ => factorialLogRemainder (t * c) / (t : ℝ)) + atTop (𝓝 0) := by + by_cases hc : c = 0 + · subst c + simp + have hmul : Tendsto (fun t : ℕ => t * c) atTop atTop := + tendsto_id.atTop_mul_const' (Nat.pos_of_ne_zero hc) + have hscaled : Tendsto + (fun t : ℕ => factorialLogRemainder (t * c) / (t * c : ℕ) * (c : ℝ)) + atTop (𝓝 0) := by + simpa using (tendsto_factorialLogRemainder_div.comp hmul).mul_const (c : ℝ) + apply hscaled.congr + intro t + by_cases ht : t = 0 + · simp [ht] + rw [Nat.cast_mul] + field_simp [Nat.cast_ne_zero.mpr hc, Nat.cast_ne_zero.mpr ht] + +theorem factorialLogRemainder_succ (n : ℕ) : + factorialLogRemainder (n + 1) = factorialLogRemainder n + 1 - + (n : ℝ) * (Real.log ((n : ℝ) + 1) - Real.log n) := by + unfold factorialLogRemainder + rw [Nat.factorial_succ, Nat.cast_mul, + Real.log_mul (by positivity) (by positivity)] + push_cast + ring + +private theorem nat_mul_log_increment_le_one (n : ℕ) : + (n : ℝ) * (Real.log ((n : ℝ) + 1) - Real.log n) ≤ 1 := by + by_cases hn : n = 0 + · simp [hn] + have hpos : 0 < (n : ℝ) := Nat.cast_pos.mpr (Nat.pos_of_ne_zero hn) + have hsucc : 0 < (n : ℝ) + 1 := by positivity + have hlog := Real.log_le_sub_one_of_pos (div_pos hsucc hpos) + rw [Real.log_div hsucc.ne' hpos.ne'] at hlog + have hmul := mul_le_mul_of_nonneg_left hlog hpos.le + have heq : (n : ℝ) * (((n : ℝ) + 1) / (n : ℝ) - 1) = 1 := by + field_simp [hpos.ne'] + ring + rwa [heq] at hmul + +private theorem one_le_succ_mul_log_increment (n : ℕ) (hn : 0 < n) : + 1 ≤ ((n : ℝ) + 1) * (Real.log ((n : ℝ) + 1) - Real.log n) := by + have hpos : 0 < (n : ℝ) := Nat.cast_pos.mpr hn + have hsucc : 0 < (n : ℝ) + 1 := by positivity + have hlog := Real.one_sub_inv_le_log_of_pos (div_pos hsucc hpos) + rw [Real.log_div hsucc.ne' hpos.ne'] at hlog + have hmul := mul_le_mul_of_nonneg_left hlog hsucc.le + have heq : ((n : ℝ) + 1) * (1 - (((n : ℝ) + 1) / (n : ℝ))⁻¹) = 1 := by + rw [inv_div] + field_simp [hsucc.ne'] + ring + rwa [heq] at hmul + +theorem factorialLogRemainder_nonneg (n : ℕ) : 0 ≤ factorialLogRemainder n := by + induction n with + | zero => simp + | succ n ih => + have hlog := nat_mul_log_increment_le_one n + rw [factorialLogRemainder_succ] + linarith + +theorem factorialLogRemainder_le_one_add_log_pos (n : ℕ) : + factorialLogRemainder (n + 1) ≤ 1 + Real.log (n + 1 : ℕ) := by + induction n with + | zero => norm_num [factorialLogRemainder] + | succ n ih => + have hlog := one_le_succ_mul_log_increment (n + 1) (Nat.succ_pos n) + have hstep := factorialLogRemainder_succ (n + 1) + push_cast at ih hlog hstep ⊢ + nlinarith + +theorem factorialLogRemainder_le_one_add_log (n : ℕ) : + factorialLogRemainder n ≤ 1 + Real.log (n + 1 : ℕ) := by + cases n with + | zero => norm_num + | succ n => + refine (factorialLogRemainder_le_one_add_log_pos n).trans ?_ + apply add_le_add le_rfl + apply Real.log_le_log + · positivity + · exact_mod_cast Nat.le_succ (n + 1) + +theorem abs_factorialLogRemainder_le (n : ℕ) : + |factorialLogRemainder n| ≤ 1 + Real.log (n + 1 : ℕ) := by + rw [abs_of_nonneg (factorialLogRemainder_nonneg n)] + exact factorialLogRemainder_le_one_add_log n + +end MatrixMultiplication.Foundation + + + + + +namespace MatrixMultiplication.Foundation + +open Filter +open scoped BigOperators Topology + +variable {A : Type*} [Fintype A] + +theorem log_multinomial (counts : A → ℕ) : + Real.log (Nat.multinomial Finset.univ counts : ℝ) = + Real.log (Nat.factorial (∑ a, counts a) : ℝ) - + ∑ a, Real.log (Nat.factorial (counts a) : ℝ) := by + have hspec : + (∏ a, (Nat.factorial (counts a) : ℝ)) * + (Nat.multinomial Finset.univ counts : ℝ) = + (Nat.factorial (∑ a, counts a) : ℝ) := by + exact_mod_cast Nat.multinomial_spec Finset.univ counts + have hprod : (∏ a, (Nat.factorial (counts a) : ℝ)) ≠ 0 := by + exact Finset.prod_ne_zero_iff.mpr (fun a _ => by positivity) + have hmulti : (Nat.multinomial Finset.univ counts : ℝ) ≠ 0 := by + exact_mod_cast (Nat.ne_of_gt (Nat.multinomial_pos Finset.univ counts)) + have hlog := congrArg Real.log hspec + rw [Real.log_mul hprod hmulti, + Real.log_prod (fun a _ => by positivity)] at hlog + linarith + +private theorem entropyTerm_div_scalar (x y : ℝ) : + entropyTerm (x / y) = entropyTerm x / y + (x / y) * Real.log y := by + by_cases hx : x = 0 + · simp [hx] + by_cases hy : y = 0 + · simp [hy] + rw [entropyTerm, Real.log_div hx hy] + unfold entropyTerm + ring + +theorem finiteEntropy_nat_normalize (counts : A → ℕ) + (hD : 0 < ∑ a, counts a) : + finiteEntropy (fun a => (counts a : ℝ) / (∑ a, counts a : ℕ)) = + Real.log (∑ a, counts a : ℕ) - + (∑ a, (counts a : ℝ) * Real.log (counts a : ℝ)) / + (∑ a, counts a : ℕ) := by + have hD' : ((∑ a, counts a : ℕ) : ℝ) ≠ 0 := by + exact_mod_cast (Nat.ne_of_gt hD) + unfold finiteEntropy + simp only [entropyTerm_div_scalar] + simp only [entropyTerm, neg_mul, + Finset.sum_add_distrib, ← Finset.sum_div, ← Finset.sum_mul, + Finset.sum_neg_distrib] + rw [← Nat.cast_sum, div_self hD'] + ring + +theorem log_multinomial_eq_main_add_remainder (counts : A → ℕ) : + Real.log (Nat.multinomial Finset.univ counts : ℝ) = + (∑ a, counts a : ℕ) * Real.log (∑ a, counts a : ℕ) - + (∑ a, (counts a : ℝ) * Real.log (counts a : ℝ)) + + factorialLogRemainder (∑ a, counts a) - + ∑ a, factorialLogRemainder (counts a) := by + rw [log_multinomial] + unfold factorialLogRemainder + simp only [Finset.sum_sub_distrib, ← Nat.cast_sum] + ring + +theorem log_multinomial_eq_entropy_add_remainder (counts : A → ℕ) + (hD : 0 < ∑ a, counts a) : + Real.log (Nat.multinomial Finset.univ counts : ℝ) = + (∑ a, counts a : ℕ) * + finiteEntropy (fun a => (counts a : ℝ) / (∑ a, counts a : ℕ)) + + factorialLogRemainder (∑ a, counts a) - + ∑ a, factorialLogRemainder (counts a) := by + have hD' : ((∑ a, counts a : ℕ) : ℝ) ≠ 0 := by + exact_mod_cast (Nat.ne_of_gt hD) + rw [log_multinomial_eq_main_add_remainder, finiteEntropy_nat_normalize counts hD, + mul_sub, mul_div_cancel₀ _ hD'] + +theorem log_multinomial_sub_entropy_eq_remainder (counts : A → ℕ) : + Real.log (Nat.multinomial Finset.univ counts : ℝ) - + (∑ a, counts a : ℕ) * + finiteEntropy (fun a => (counts a : ℝ) / (∑ a, counts a : ℕ)) = + factorialLogRemainder (∑ a, counts a) - + ∑ a, factorialLogRemainder (counts a) := by + by_cases hD : 0 < ∑ a, counts a + · rw [log_multinomial_eq_entropy_add_remainder counts hD] + ring + · have hzero : (∑ a, counts a) = 0 := Nat.eq_zero_of_not_pos hD + have hc : ∀ a, counts a = 0 := by + intro a + have hle : counts a ≤ ∑ b, counts b := + Finset.single_le_sum (fun b _ => Nat.zero_le (counts b)) (Finset.mem_univ a) + rw [hzero] at hle + exact Nat.eq_zero_of_le_zero hle + simp [hc, Nat.multinomial] + +theorem abs_log_multinomial_sub_entropy_le (counts : A → ℕ) : + |Real.log (Nat.multinomial Finset.univ counts : ℝ) - + (∑ a, counts a : ℕ) * + finiteEntropy (fun a => (counts a : ℝ) / (∑ a, counts a : ℕ))| ≤ + ((Fintype.card A : ℝ) + 1) * + (1 + Real.log ((∑ a, counts a) + 1 : ℕ)) := by + rw [log_multinomial_sub_entropy_eq_remainder] + have hsum_nonneg : 0 ≤ ∑ a, factorialLogRemainder (counts a) := + Finset.sum_nonneg (fun a _ => factorialLogRemainder_nonneg (counts a)) + have heach (a : A) : factorialLogRemainder (counts a) ≤ + 1 + Real.log ((∑ b, counts b) + 1 : ℕ) := by + refine (factorialLogRemainder_le_one_add_log (counts a)).trans ?_ + apply add_le_add le_rfl + apply Real.log_le_log + · positivity + · have hle : counts a ≤ ∑ b, counts b := + Finset.single_le_sum (fun b _ => Nat.zero_le (counts b)) (Finset.mem_univ a) + exact_mod_cast Nat.add_le_add_right hle 1 + calc + |factorialLogRemainder (∑ a, counts a) - ∑ a, factorialLogRemainder (counts a)| ≤ + |factorialLogRemainder (∑ a, counts a)| + + |∑ a, factorialLogRemainder (counts a)| := by + simpa only [sub_eq_add_neg, abs_neg] using + abs_add_le (factorialLogRemainder (∑ a, counts a)) + (-(∑ a, factorialLogRemainder (counts a))) + _ = factorialLogRemainder (∑ a, counts a) + + ∑ a, factorialLogRemainder (counts a) := by + rw [abs_of_nonneg (factorialLogRemainder_nonneg _), abs_of_nonneg hsum_nonneg] + _ ≤ (1 + Real.log ((∑ a, counts a) + 1 : ℕ)) + + ∑ _a : A, (1 + Real.log ((∑ a, counts a) + 1 : ℕ)) := + add_le_add (factorialLogRemainder_le_one_add_log _) + (Finset.sum_le_sum (fun a _ => heach a)) + _ = ((Fintype.card A : ℝ) + 1) * + (1 + Real.log ((∑ a, counts a) + 1 : ℕ)) := by + simp only [Finset.sum_const, Finset.card_univ, nsmul_eq_mul] + ring + +theorem abs_log_multinomial_div_sub_entropy_le (counts : A → ℕ) + (hD : 0 < ∑ a, counts a) : + |Real.log (Nat.multinomial Finset.univ counts : ℝ) / (∑ a, counts a : ℕ) - + finiteEntropy (fun a => (counts a : ℝ) / (∑ a, counts a : ℕ))| ≤ + ((Fintype.card A : ℝ) + 1) * + ((1 + Real.log ((∑ a, counts a) + 1 : ℕ)) / (∑ a, counts a : ℕ)) := by + have hD' : (0 : ℝ) < (∑ a, counts a : ℕ) := Nat.cast_pos.mpr hD + calc + |Real.log (Nat.multinomial Finset.univ counts : ℝ) / (∑ a, counts a : ℕ) - + finiteEntropy (fun a => (counts a : ℝ) / (∑ a, counts a : ℕ))| = + |(Real.log (Nat.multinomial Finset.univ counts : ℝ) - + (∑ a, counts a : ℕ) * + finiteEntropy (fun a => (counts a : ℝ) / (∑ a, counts a : ℕ))) / + (∑ a, counts a : ℕ)| := by + rw [sub_div, mul_div_cancel_left₀ _ hD'.ne'] + _ = |Real.log (Nat.multinomial Finset.univ counts : ℝ) - + (∑ a, counts a : ℕ) * + finiteEntropy (fun a => (counts a : ℝ) / (∑ a, counts a : ℕ))| / + (∑ a, counts a : ℕ) := by + rw [abs_div, abs_of_pos hD'] + _ ≤ ((Fintype.card A : ℝ) + 1) * + ((1 + Real.log ((∑ a, counts a) + 1 : ℕ)) / (∑ a, counts a : ℕ)) := by + simpa only [mul_div_assoc] using + div_le_div_of_nonneg_right (abs_log_multinomial_sub_entropy_le counts) hD'.le + +private theorem tendsto_one_add_log_succ_div : + Tendsto (fun n : ℕ => (1 + Real.log (n + 1 : ℕ)) / (n : ℝ)) + atTop (𝓝 0) := by + have hnat : Tendsto (fun n : ℕ => (n : ℝ)) atTop atTop := + tendsto_natCast_atTop_atTop + have hconstant : Tendsto (fun n : ℕ => (1 : ℝ) / n) atTop (𝓝 0) := + tendsto_const_nhds.div_atTop hnat + have hlog : Tendsto (fun n : ℕ => Real.log (n : ℝ) / n) atTop (𝓝 0) := by + simpa only [Function.comp_def, id_eq] using + Real.isLittleO_log_id_atTop.tendsto_div_nhds_zero.comp hnat + have hshift := Real.tendsto_log_nat_add_one_sub_log.div_atTop hnat + have hsum : Tendsto + (fun n : ℕ => (1 : ℝ) / n + + ((Real.log ((n : ℝ) + 1) - Real.log n) / n + Real.log n / n)) + atTop (𝓝 0) := by + simpa using hconstant.add (hshift.add hlog) + apply hsum.congr + intro n + push_cast + ring + +theorem tendsto_log_multinomial_div_sub_entropy {I : Type*} {l : Filter I} + (counts : I → A → ℕ) + (htotal : Tendsto (fun i => ∑ a, counts i a) l atTop) : + Tendsto + (fun i => Real.log (Nat.multinomial Finset.univ (counts i) : ℝ) / + (∑ a, counts i a : ℕ) - + finiteEntropy (fun a => (counts i a : ℝ) / (∑ a, counts i a : ℕ))) + l (𝓝 0) := by + have hbound : Tendsto + (fun i => ((Fintype.card A : ℝ) + 1) * + ((1 + Real.log ((∑ a, counts i a) + 1 : ℕ)) / (∑ a, counts i a : ℕ))) + l (𝓝 0) := by + simpa using (tendsto_one_add_log_succ_div.comp htotal).const_mul + ((Fintype.card A : ℝ) + 1) + refine squeeze_zero_norm' ?_ hbound + filter_upwards [htotal.eventually (eventually_gt_atTop (0 : ℕ))] with i hi + simpa only [Real.norm_eq_abs] using + abs_log_multinomial_div_sub_entropy_le (counts i) hi + +theorem tendsto_log_multinomial_of_empirical_tendsto {I : Type*} {l : Filter I} + (counts : I → A → ℕ) (p : A → ℝ) + (htotal : Tendsto (fun i => ∑ a, counts i a) l atTop) + (hmass : ∀ a, Tendsto + (fun i => (counts i a : ℝ) / (∑ b, counts i b : ℕ)) l (𝓝 (p a))) : + Tendsto + (fun i => Real.log (Nat.multinomial Finset.univ (counts i) : ℝ) / + (∑ a, counts i a : ℕ)) + l (𝓝 (finiteEntropy p)) := by + have herror := tendsto_log_multinomial_div_sub_entropy counts htotal + have hentropy := tendsto_finiteEntropy_of_tendsto hmass + simpa only [zero_add, sub_add_cancel] using herror.add hentropy + +private theorem mul_log_mul (x y : ℝ) : + (x * y) * Real.log (x * y) = + (x * Real.log x) * y + x * (y * Real.log y) := by + calc + (x * y) * Real.log (x * y) = -entropyTerm (x * y) := by + simp [entropyTerm] + _ = -(y * entropyTerm x + x * entropyTerm y) := by + rw [entropyTerm_mul] + _ = (x * Real.log x) * y + x * (y * Real.log y) := by + unfold entropyTerm + ring + +theorem log_multinomial_mul_eq (counts : A → ℕ) (t : ℕ) : + Real.log (Nat.multinomial Finset.univ (fun a => t * counts a) : ℝ) = + (t : ℝ) * + ((∑ a, counts a : ℕ) * Real.log (∑ a, counts a : ℕ) - + ∑ a, (counts a : ℝ) * Real.log (counts a : ℝ)) + + factorialLogRemainder (t * ∑ a, counts a) - + ∑ a, factorialLogRemainder (t * counts a) := by + have hsum : (∑ a, t * counts a) = t * ∑ a, counts a := + (Finset.mul_sum Finset.univ counts t).symm + have hlogs : + (∑ a, ((t : ℝ) * counts a) * Real.log ((t : ℝ) * counts a)) = + ((t : ℝ) * Real.log t) * (∑ a, counts a : ℕ) + + (t : ℝ) * ∑ a, (counts a : ℝ) * Real.log (counts a : ℝ) := by + simp only [mul_log_mul, Finset.sum_add_distrib, ← Finset.mul_sum, + ← Nat.cast_sum] + rw [log_multinomial_eq_main_add_remainder, hsum] + simp only [Nat.cast_mul] + rw [mul_log_mul, hlogs] + ring + +theorem tendsto_log_multinomial_mul (counts : A → ℕ) + (hD : 0 < ∑ a, counts a) : + Tendsto + (fun t : ℕ => + Real.log (Nat.multinomial Finset.univ (fun a => t * counts a) : ℝ) / + ((t : ℝ) * (∑ a, counts a : ℕ))) + atTop + (𝓝 (finiteEntropy (fun a => (counts a : ℝ) / (∑ a, counts a : ℕ)))) := by + have hD' : ((∑ a, counts a : ℕ) : ℝ) ≠ 0 := by + exact_mod_cast (Nat.ne_of_gt hD) + have hsum : + Tendsto (fun t : ℕ => ∑ a, factorialLogRemainder (t * counts a) / (t : ℝ)) + atTop (𝓝 0) := by + simpa using tendsto_finsetSum Finset.univ + (fun a _ => tendsto_factorialLogRemainder_mul_div (counts a)) + have herror : Tendsto + (fun t : ℕ => + (factorialLogRemainder (t * ∑ a, counts a) / (t : ℝ) - + ∑ a, factorialLogRemainder (t * counts a) / (t : ℝ)) / + (∑ a, counts a : ℕ)) atTop (𝓝 0) := by + simpa using ((tendsto_factorialLogRemainder_mul_div (∑ a, counts a)).sub + hsum).div_const (∑ a, counts a : ℕ) + have hlimit : Tendsto + (fun t : ℕ => + finiteEntropy (fun a => (counts a : ℝ) / (∑ a, counts a : ℕ)) + + (factorialLogRemainder (t * ∑ a, counts a) / (t : ℝ) - + ∑ a, factorialLogRemainder (t * counts a) / (t : ℝ)) / + (∑ a, counts a : ℕ)) + atTop + (𝓝 (finiteEntropy (fun a => (counts a : ℝ) / (∑ a, counts a : ℕ)))) := by + simpa only [add_zero] using tendsto_const_nhds.add herror + apply hlimit.congr' + filter_upwards [eventually_ne_atTop (0 : ℕ)] with t ht + rw [log_multinomial_mul_eq, finiteEntropy_nat_normalize counts hD, + ← Finset.sum_div] + have ht' : (t : ℝ) ≠ 0 := Nat.cast_ne_zero.mpr ht + field_simp [ht', hD'] + ring + +theorem tendsto_log_multinomial_repetitions {I : Type*} {l : Filter I} + (counts : A → ℕ) (hD : 0 < ∑ a, counts a) + (repetitions : I → ℕ) (hrep : Tendsto repetitions l atTop) : + Tendsto + (fun i => + Real.log (Nat.multinomial Finset.univ + (fun a => repetitions i * counts a) : ℝ) / + ((repetitions i : ℝ) * (∑ a, counts a : ℕ))) + l (𝓝 (finiteEntropy (fun a => (counts a : ℝ) / (∑ a, counts a : ℕ)))) := by + exact (tendsto_log_multinomial_mul counts hD).comp hrep + +theorem tendsto_log_exactWords_card_mul [DecidableEq A] (counts : A → ℕ) + (hD : 0 < ∑ a, counts a) : + Tendsto + (fun t : ℕ => Real.log (Fintype.card (ExactWords (fun a => t * counts a)) : ℝ) / + ((t : ℝ) * (∑ a, counts a : ℕ))) + atTop + (𝓝 (finiteEntropy (fun a => (counts a : ℝ) / (∑ a, counts a : ℕ)))) := by + simpa only [exactWords_card] using tendsto_log_multinomial_mul counts hD + +theorem abs_log_exactWords_card_sub_entropy_le [DecidableEq A] (counts : A → ℕ) : + |Real.log (Fintype.card (ExactWords counts) : ℝ) - + (∑ a, counts a : ℕ) * + finiteEntropy (fun a => (counts a : ℝ) / (∑ a, counts a : ℕ))| ≤ + ((Fintype.card A : ℝ) + 1) * + (1 + Real.log ((∑ a, counts a) + 1 : ℕ)) := by + simpa only [exactWords_card] using abs_log_multinomial_sub_entropy_le counts + +theorem log_card_le_entropy_of_injective_exactWords [DecidableEq A] + {O : Type*} [Fintype O] [Nonempty O] (counts : A → ℕ) + (label : O → ExactWords counts) (hinj : Function.Injective label) : + Real.log (Fintype.card O : ℝ) ≤ + (∑ a, counts a : ℕ) * + finiteEntropy (fun a => (counts a : ℝ) / (∑ a, counts a : ℕ)) + + ((Fintype.card A : ℝ) + 1) * + (1 + Real.log ((∑ a, counts a) + 1 : ℕ)) := by + have hcard := Fintype.card_le_of_injective label hinj + have hlog : Real.log (Fintype.card O : ℝ) ≤ + Real.log (Fintype.card (ExactWords counts) : ℝ) := + Real.log_le_log (Nat.cast_pos.mpr Fintype.card_pos) (by exact_mod_cast hcard) + have herror := (abs_le.mp (abs_log_exactWords_card_sub_entropy_le counts)).2 + linarith + +theorem log_card_div_le_entropy_of_injective_exactWords [DecidableEq A] + {O : Type*} [Fintype O] [Nonempty O] (counts : A → ℕ) + (hD : 0 < ∑ a, counts a) + (label : O → ExactWords counts) (hinj : Function.Injective label) : + Real.log (Fintype.card O : ℝ) / (∑ a, counts a : ℕ) ≤ + finiteEntropy (fun a => (counts a : ℝ) / (∑ a, counts a : ℕ)) + + ((Fintype.card A : ℝ) + 1) * + ((1 + Real.log ((∑ a, counts a) + 1 : ℕ)) / (∑ a, counts a : ℕ)) := by + have hD' : (0 : ℝ) < (∑ a, counts a : ℕ) := Nat.cast_pos.mpr hD + have h := div_le_div_of_nonneg_right + (log_card_le_entropy_of_injective_exactWords counts label hinj) hD'.le + rw [add_div, mul_div_cancel_left₀ _ hD'.ne', mul_div_assoc] at h + exact h + +theorem tendsto_log_exactWords_card_of_empirical_tendsto [DecidableEq A] + {I : Type*} {l : Filter I} (counts : I → A → ℕ) (p : A → ℝ) + (htotal : Tendsto (fun i => ∑ a, counts i a) l atTop) + (hmass : ∀ a, Tendsto + (fun i => (counts i a : ℝ) / (∑ b, counts i b : ℕ)) l (𝓝 (p a))) : + Tendsto + (fun i => Real.log (Fintype.card (ExactWords (counts i)) : ℝ) / + (∑ a, counts i a : ℕ)) + l (𝓝 (finiteEntropy p)) := by + simpa only [exactWords_card] using + tendsto_log_multinomial_of_empirical_tendsto counts p htotal hmass + +namespace RationalLaw + +theorem exists_exactWords_entropy_limit [DecidableEq A] (p : RationalLaw A) : + ∃ counts : A → ℕ, 0 < ∑ a, counts a ∧ + (∀ a, (counts a : ℝ) / (∑ a, counts a : ℕ) = p.toFiniteLaw.mass a) ∧ + Tendsto + (fun t : ℕ => Real.log (Fintype.card (ExactWords (fun a => t * counts a)) : ℝ) / + ((t : ℝ) * (∑ a, counts a : ℕ))) + atTop (𝓝 (finiteEntropy p.toFiniteLaw.mass)) := by + obtain ⟨counts, hD, hmass⟩ := p.exists_type_representation + refine ⟨counts, hD, hmass, ?_⟩ + have hfun : (fun a => (counts a : ℝ) / (∑ a, counts a : ℕ)) = + p.toFiniteLaw.mass := funext hmass + rw [← hfun] + exact tendsto_log_exactWords_card_mul counts hD + +end RationalLaw + +end MatrixMultiplication.Foundation + + + + + +noncomputable section + +namespace MatrixMultiplication.Foundation + +open Filter +open scoped BigOperators Topology + +namespace LabelHierarchySeparation + +theorem poolAuxiliaryCost_pos (k : ℕ) : 0 < poolAuxiliaryCost k := by + unfold poolAuxiliaryCost + split_ifs + · exact Nat.zero_lt_one + · exact Separation.gridGroupOrder_pos k + +theorem population_le_poolAuxiliaryCost (k : ℕ) : k ≤ poolAuxiliaryCost k := by + unfold poolAuxiliaryCost + split_ifs with hk + · simp [hk] + · exact Separation.population_le_gridGroupOrder k + +theorem poolAuxiliaryCost_le_gridGroupOrder (k : ℕ) : + poolAuxiliaryCost k ≤ Separation.gridGroupOrder k := by + unfold poolAuxiliaryCost + split_ifs with hk + · simpa only [hk] using Separation.population_le_gridGroupOrder k + · exact le_rfl + +theorem tendsto_log_poolAuxiliaryCost_div_nat {K : ℕ → ℕ} {H : ℝ} + (hK : ∀ n, 0 < K n) (hH : 0 ≤ H) + (hpop : Tendsto (fun n => Real.log (K n : ℝ) / (n : ℝ)) atTop (𝓝 H)) : + Tendsto (fun n => Real.log (poolAuxiliaryCost (K n) : ℝ) / (n : ℝ)) + atTop (𝓝 H) := by + refine tendsto_of_tendsto_of_tendsto_of_le_of_le hpop + (Separation.tendsto_log_gridGroupOrder_div_nat hK hH hpop) ?_ ?_ + · intro n + apply div_le_div_of_nonneg_right _ (Nat.cast_nonneg n) + exact Real.log_le_log (Nat.cast_pos.mpr (hK n)) + (by exact_mod_cast population_le_poolAuxiliaryCost (K n)) + · intro n + apply div_le_div_of_nonneg_right _ (Nat.cast_nonneg n) + exact Real.log_le_log (Nat.cast_pos.mpr (poolAuxiliaryCost_pos (K n))) + (by exact_mod_cast poolAuxiliaryCost_le_gridGroupOrder (K n)) + +end LabelHierarchySeparation + +namespace HierarchySeparationRates + +universe u v w + +def populationEntropyRate {B : Type*} [Fintype B] (counts : B → ℕ) : ℝ := + (∑ b, counts b : ℕ) * + finiteEntropy (fun b => (counts b : ℝ) / (∑ b, counts b : ℕ)) + +theorem tendsto_log_multinomial_mul_div_repetition {B : Type*} [Fintype B] + (counts : B → ℕ) : + Tendsto + (fun t : ℕ => + Real.log (Nat.multinomial Finset.univ (fun b => t * counts b) : ℝ) / (t : ℝ)) + atTop (𝓝 (populationEntropyRate counts)) := by + by_cases hD : 0 < ∑ b, counts b + · have hD' : ((∑ b, counts b : ℕ) : ℝ) ≠ 0 := + Nat.cast_ne_zero.mpr (Nat.ne_of_gt hD) + have h := (tendsto_log_multinomial_mul counts hD).const_mul + ((∑ b, counts b : ℕ) : ℝ) + apply h.congr + intro t + by_cases ht : t = 0 + · simp [ht] + have ht' : (t : ℝ) ≠ 0 := Nat.cast_ne_zero.mpr ht + change ((∑ b, counts b : ℕ) : ℝ) * + (Real.log (Nat.multinomial Finset.univ (fun b => t * counts b) : ℝ) / + ((t : ℝ) * (∑ b, counts b : ℕ))) = _ + field_simp [hD', ht'] + · have hz : (∑ b, counts b) = 0 := Nat.eq_zero_of_not_pos hD + have hc (b : B) : counts b = 0 := by + apply Nat.eq_zero_of_le_zero + calc + counts b ≤ ∑ c, counts c := + Finset.single_le_sum (fun c _ => Nat.zero_le _) (Finset.mem_univ b) + _ = 0 := hz + simp only [populationEntropyRate, hz, Nat.cast_zero, zero_mul] + simp [Nat.multinomial, hc] + +theorem populationEntropyRate_nonneg {B : Type*} [Fintype B] (counts : B → ℕ) : + 0 ≤ populationEntropyRate counts := by + apply ge_of_tendsto' (tendsto_log_multinomial_mul_div_repetition counts) + intro t + apply div_nonneg _ (Nat.cast_nonneg t) + apply Real.log_nonneg + exact_mod_cast Nat.one_le_iff_ne_zero.mpr + (Nat.ne_of_gt (Nat.multinomial_pos Finset.univ (fun b => t * counts b))) + +section FinitePools + +variable {I : Type u} [Fintype I] {Alphabet : I → Type v} + [∀ i, Fintype (Alphabet i)] + +def poolTypeCount (counts : ∀ i, Alphabet i → ℕ) (i : I) (t : ℕ) : ℕ := + Nat.multinomial Finset.univ (fun b => t * counts i b) + +def poolEntropyTotal (counts : ∀ i, Alphabet i → ℕ) : ℝ := + ∑ i, populationEntropyRate (counts i) + +def pairingProduct (counts : ∀ i, Alphabet i → ℕ) (t : ℕ) : ℕ := + ∏ i, poolTypeCount counts i t + +def gridProduct (counts : ∀ i, Alphabet i → ℕ) (t : ℕ) : ℕ := + ∏ i, Separation.gridGroupOrder (poolTypeCount counts i t) + +def auxiliaryProduct (counts : ∀ i, Alphabet i → ℕ) (t : ℕ) : ℕ := + ∏ i, LabelHierarchySeparation.poolAuxiliaryCost (poolTypeCount counts i t) + +omit [Fintype I] in +theorem poolTypeCount_pos (counts : ∀ i, Alphabet i → ℕ) (i : I) (t : ℕ) : + 0 < poolTypeCount counts i t := Nat.multinomial_pos _ _ + +theorem pairingProduct_le_auxiliaryProduct (counts : ∀ i, Alphabet i → ℕ) (t : ℕ) : + pairingProduct counts t ≤ auxiliaryProduct counts t := by + exact Finset.prod_le_prod (fun i _ => + LabelHierarchySeparation.population_le_poolAuxiliaryCost (poolTypeCount counts i t)) + +theorem auxiliaryProduct_le_gridProduct (counts : ∀ i, Alphabet i → ℕ) (t : ℕ) : + auxiliaryProduct counts t ≤ gridProduct counts t := by + exact Finset.prod_le_prod (fun i _ => + LabelHierarchySeparation.poolAuxiliaryCost_le_gridGroupOrder (poolTypeCount counts i t)) + +omit [Fintype I] in +theorem tendsto_log_poolTypeCount_div (counts : ∀ i, Alphabet i → ℕ) (i : I) : + Tendsto (fun t : ℕ => Real.log (poolTypeCount counts i t : ℝ) / (t : ℝ)) + atTop (𝓝 (populationEntropyRate (counts i))) := + tendsto_log_multinomial_mul_div_repetition (counts i) + +theorem tendsto_log_pairingProduct_div (counts : ∀ i, Alphabet i → ℕ) : + Tendsto (fun t : ℕ => Real.log (pairingProduct counts t : ℝ) / (t : ℝ)) + atTop (𝓝 (poolEntropyTotal counts)) := by + exact Separation.tendsto_log_nat_prod_div_nat Finset.univ + (fun i _ t => poolTypeCount_pos counts i t) + (fun i _ => tendsto_log_poolTypeCount_div counts i) + +theorem tendsto_log_gridProduct_div (counts : ∀ i, Alphabet i → ℕ) : + Tendsto (fun t : ℕ => Real.log (gridProduct counts t : ℝ) / (t : ℝ)) + atTop (𝓝 (poolEntropyTotal counts)) := by + exact Separation.tendsto_log_gridGroupOrder_prod_div_nat Finset.univ + (fun i _ t => poolTypeCount_pos counts i t) + (fun i _ => populationEntropyRate_nonneg (counts i)) + (fun i _ => tendsto_log_poolTypeCount_div counts i) + +theorem tendsto_log_auxiliaryProduct_div (counts : ∀ i, Alphabet i → ℕ) : + Tendsto (fun t : ℕ => Real.log (auxiliaryProduct counts t : ℝ) / (t : ℝ)) + atTop (𝓝 (poolEntropyTotal counts)) := by + exact Separation.tendsto_log_nat_prod_div_nat Finset.univ + (fun i _ t => LabelHierarchySeparation.poolAuxiliaryCost_pos (poolTypeCount counts i t)) + (fun i _ => LabelHierarchySeparation.tendsto_log_poolAuxiliaryCost_div_nat + (poolTypeCount_pos counts i) (populationEntropyRate_nonneg (counts i)) + (tendsto_log_poolTypeCount_div counts i)) + +end FinitePools + +section SourceHierarchy + +variable {A : Type u} [Fintype A] {Label : ℕ → Type v} + [∀ n, Fintype (Label n)] + +theorem pushforwardCounts_mul {B : Type*} (counts : A → ℕ) (label : A → B) + (t : ℕ) (b : B) : + pushforwardCounts (fun a => t * counts a) label b = + t * pushforwardCounts counts label b := by + classical + unfold pushforwardCounts + rw [Finset.mul_sum] + apply Finset.sum_congr rfl + intro a _ + by_cases h : label a = b <;> simp [h] + +omit [∀ n, Fintype (Label n)] in +theorem sourcePrefixCounts_mul (counts : A → ℕ) (labels : ∀ n, A → Label n) + (t n : ℕ) (r : LabelRecord Label n) : + LabelHierarchyCounts.sourcePrefixCounts (fun a => t * counts a) labels n r = + t * LabelHierarchyCounts.sourcePrefixCounts counts labels n r := + pushforwardCounts_mul counts (labelRecordOf labels n) t r + +abbrev PrefixPool (Label : ℕ → Type v) (depth : ℕ) := + Σ n : Fin depth, LabelRecord Label n.val + +def sourcePoolCounts (counts : A → ℕ) (labels : ∀ n, A → Label n) (depth : ℕ) + (j : PrefixPool Label depth) (s : Label j.1.val) : ℕ := + LabelHierarchyCounts.sourcePrefixCounts counts labels (j.1.val + 1) (j.2, s) + +theorem pairingProduct_source_eq (counts : A → ℕ) (labels : ∀ n, A → Label n) + (depth : ℕ) (hinjective : Function.Injective (labelRecordOf labels depth)) (t : ℕ) : + pairingProduct (sourcePoolCounts counts labels depth) t = + Nat.multinomial Finset.univ (fun a => t * counts a) := by + classical + unfold pairingProduct + rw [Fintype.prod_sigma] + have hpool (n : Fin depth) : + (∏ r : LabelRecord Label n.val, + poolTypeCount (sourcePoolCounts counts labels depth) ⟨n, r⟩ t) = + LabelHierarchyCounts.refinementCount + (LabelHierarchyCounts.sourcePrefixCounts (fun a => t * counts a) labels) n.val := by + apply Finset.prod_congr rfl + intro r _ + change Nat.multinomial Finset.univ + (fun s : Label n.val => t * + LabelHierarchyCounts.sourcePrefixCounts counts labels (n.val + 1) (r, s)) = + Nat.multinomial Finset.univ + (fun s : Label n.val => + LabelHierarchyCounts.sourcePrefixCounts (fun a => t * counts a) + labels (n.val + 1) (r, s)) + apply Nat.multinomial_congr + intro s _ + exact (sourcePrefixCounts_mul counts labels t (n.val + 1) (r, s)).symm + simp_rw [hpool] + rw [Fin.prod_univ_eq_prod_range] + exact LabelHierarchyCounts.source_refinementCount_product + (fun a => t * counts a) labels depth hinjective + +theorem pairingProduct_source_eq_exactWords_card [DecidableEq A] + (counts : A → ℕ) (labels : ∀ n, A → Label n) (depth : ℕ) + (hinjective : Function.Injective (labelRecordOf labels depth)) (t : ℕ) : + pairingProduct (sourcePoolCounts counts labels depth) t = + Fintype.card (ExactWords (fun a => t * counts a)) := by + rw [pairingProduct_source_eq counts labels depth hinjective, exactWords_card] + +theorem source_poolEntropyTotal_eq (counts : A → ℕ) (labels : ∀ n, A → Label n) + (depth : ℕ) (hinjective : Function.Injective (labelRecordOf labels depth)) : + poolEntropyTotal (sourcePoolCounts counts labels depth) = populationEntropyRate counts := by + have hsource : Tendsto + (fun t : ℕ => Real.log (pairingProduct (sourcePoolCounts counts labels depth) t : ℝ) / + (t : ℝ)) atTop (𝓝 (populationEntropyRate counts)) := by + simpa only [pairingProduct_source_eq counts labels depth hinjective] using + tendsto_log_multinomial_mul_div_repetition counts + exact tendsto_nhds_unique + (tendsto_log_pairingProduct_div (sourcePoolCounts counts labels depth)) hsource + +private theorem normalized_of_per_repetition (counts : A → ℕ) + (hD : 0 < ∑ a, counts a) (K : ℕ → ℕ) + (h : Tendsto (fun t : ℕ => Real.log (K t : ℝ) / (t : ℝ)) + atTop (𝓝 (populationEntropyRate counts))) : + Tendsto (fun t : ℕ => Real.log (K t : ℝ) / ((t : ℝ) * (∑ a, counts a : ℕ))) + atTop (𝓝 (finiteEntropy (fun a => (counts a : ℝ) / (∑ a, counts a : ℕ)))) := by + have hD' : ((∑ a, counts a : ℕ) : ℝ) ≠ 0 := + Nat.cast_ne_zero.mpr (Nat.ne_of_gt hD) + have hmain : populationEntropyRate counts / (∑ a, counts a : ℕ) = + finiteEntropy (fun a => (counts a : ℝ) / (∑ a, counts a : ℕ)) := by + unfold populationEntropyRate + exact mul_div_cancel_left₀ _ hD' + simpa only [div_div, hmain] using h.div_const ((∑ a, counts a : ℕ) : ℝ) + +theorem tendsto_log_source_pairingProduct (counts : A → ℕ) + (hD : 0 < ∑ a, counts a) (labels : ∀ n, A → Label n) (depth : ℕ) + (hinjective : Function.Injective (labelRecordOf labels depth)) : + Tendsto + (fun t : ℕ => Real.log (pairingProduct (sourcePoolCounts counts labels depth) t : ℝ) / + ((t : ℝ) * (∑ a, counts a : ℕ))) + atTop (𝓝 (finiteEntropy (fun a => (counts a : ℝ) / (∑ a, counts a : ℕ)))) := by + simpa only [pairingProduct_source_eq counts labels depth hinjective] using + tendsto_log_multinomial_mul counts hD + +theorem tendsto_log_source_gridProduct (counts : A → ℕ) + (hD : 0 < ∑ a, counts a) (labels : ∀ n, A → Label n) (depth : ℕ) + (hinjective : Function.Injective (labelRecordOf labels depth)) : + Tendsto + (fun t : ℕ => Real.log (gridProduct (sourcePoolCounts counts labels depth) t : ℝ) / + ((t : ℝ) * (∑ a, counts a : ℕ))) + atTop (𝓝 (finiteEntropy (fun a => (counts a : ℝ) / (∑ a, counts a : ℕ)))) := by + apply normalized_of_per_repetition counts hD + simpa only [source_poolEntropyTotal_eq counts labels depth hinjective] using + tendsto_log_gridProduct_div (sourcePoolCounts counts labels depth) + +theorem tendsto_log_source_auxiliaryProduct (counts : A → ℕ) + (hD : 0 < ∑ a, counts a) (labels : ∀ n, A → Label n) (depth : ℕ) + (hinjective : Function.Injective (labelRecordOf labels depth)) : + Tendsto + (fun t : ℕ => Real.log (auxiliaryProduct (sourcePoolCounts counts labels depth) t : ℝ) / + ((t : ℝ) * (∑ a, counts a : ℕ))) + atTop (𝓝 (finiteEntropy (fun a => (counts a : ℝ) / (∑ a, counts a : ℕ)))) := by + apply normalized_of_per_repetition counts hD + simpa only [source_poolEntropyTotal_eq counts labels depth hinjective] using + tendsto_log_auxiliaryProduct_div (sourcePoolCounts counts labels depth) + +theorem rationalLaw_exists_source_rates [DecidableEq A] (p : RationalLaw A) + (labels : ∀ n, A → Label n) (depth : ℕ) + (hinjective : Function.Injective (labelRecordOf labels depth)) : + ∃ counts : A → ℕ, 0 < ∑ a, counts a ∧ + (∀ a, (counts a : ℝ) / (∑ a, counts a : ℕ) = p.toFiniteLaw.mass a) ∧ + Tendsto + (fun t : ℕ => Real.log (Fintype.card (ExactWords (fun a => t * counts a)) : ℝ) / + ((t : ℝ) * (∑ a, counts a : ℕ))) + atTop (𝓝 (finiteEntropy p.toFiniteLaw.mass)) ∧ + Tendsto + (fun t : ℕ => Real.log (pairingProduct (sourcePoolCounts counts labels depth) t : ℝ) / + ((t : ℝ) * (∑ a, counts a : ℕ))) + atTop (𝓝 (finiteEntropy p.toFiniteLaw.mass)) ∧ + Tendsto + (fun t : ℕ => Real.log (gridProduct (sourcePoolCounts counts labels depth) t : ℝ) / + ((t : ℝ) * (∑ a, counts a : ℕ))) + atTop (𝓝 (finiteEntropy p.toFiniteLaw.mass)) ∧ + Tendsto + (fun t : ℕ => Real.log (auxiliaryProduct (sourcePoolCounts counts labels depth) t : ℝ) / + ((t : ℝ) * (∑ a, counts a : ℕ))) + atTop (𝓝 (finiteEntropy p.toFiniteLaw.mass)) := by + obtain ⟨counts, hD, hmass⟩ := p.exists_type_representation + have hfun : (fun a => (counts a : ℝ) / (∑ a, counts a : ℕ)) = + p.toFiniteLaw.mass := funext hmass + refine ⟨counts, hD, hmass, ?_, ?_, ?_, ?_⟩ + · simpa only [hfun] using tendsto_log_exactWords_card_mul counts hD + · simpa only [hfun] using tendsto_log_source_pairingProduct counts hD labels depth hinjective + · simpa only [hfun] using tendsto_log_source_gridProduct counts hD labels depth hinjective + · simpa only [hfun] using tendsto_log_source_auxiliaryProduct counts hD labels depth hinjective + +end SourceHierarchy + +end HierarchySeparationRates +end MatrixMultiplication.Foundation + + + + + + +namespace MatrixMultiplication.LeafRates + +open MatrixMultiplication.Foundation Filter +open scoped BigOperators Topology + +variable {A U : Type*} [Fintype A] [DecidableEq A] [Fintype U] [DecidableEq U] + +omit [DecidableEq U] in +theorem log_card_supported (statistic : U → A) (counts b : A → ℕ) + (hb : ∀ a, 0 < counts a → Fintype.card {u : U // statistic u = a} = b a) + (hbpos : ∀ a, 0 < b a) : + Real.log (Fintype.card (ExactStatisticWords.Words statistic counts) : ℝ) = + Real.log (Nat.multinomial Finset.univ counts : ℝ) + + ∑ a, (counts a : ℝ) * Real.log (b a : ℝ) := by + rw [ExactStatisticWords.card_of_supported statistic counts b hb, Nat.cast_mul, Nat.cast_prod] + have hm : (Nat.multinomial Finset.univ counts : ℝ) ≠ 0 := by + exact_mod_cast (Nat.ne_of_gt (Nat.multinomial_pos Finset.univ counts)) + have hp : (∏ a, (b a ^ counts a : ℕ) : ℝ) ≠ 0 := by + apply Finset.prod_ne_zero_iff.mpr + intro a _ + exact_mod_cast (Nat.ne_of_gt (pow_pos (hbpos a) _)) + rw [Real.log_mul hm hp, Real.log_prod + (fun a _ => by exact_mod_cast (Nat.ne_of_gt (pow_pos (hbpos a) (counts a))))] + simp only [Nat.cast_pow, Real.log_pow] + +omit [DecidableEq U] in +theorem log_card (statistic : U → A) (counts b : A → ℕ) + (hb : ∀ a, Fintype.card {u : U // statistic u = a} = b a) + (hbpos : ∀ a, 0 < b a) : + Real.log (Fintype.card (ExactStatisticWords.Words statistic counts) : ℝ) = + Real.log (Nat.multinomial Finset.univ counts : ℝ) + + ∑ a, (counts a : ℝ) * Real.log (b a : ℝ) := + log_card_supported statistic counts b (fun a _ => hb a) hbpos + +omit [DecidableEq U] in +theorem tendsto_log_card_supported (statistic : U → A) (counts b : A → ℕ) + (hb : ∀ a, 0 < counts a → Fintype.card {u : U // statistic u = a} = b a) + (hbpos : ∀ a, 0 < b a) (hD : 0 < ∑ a, counts a) : + Tendsto (fun t : ℕ => + Real.log (Fintype.card (ExactStatisticWords.Words statistic (fun a => t * counts a)) : ℝ) / + ((t : ℝ) * (∑ a, counts a : ℕ))) atTop + (𝓝 (finiteEntropy (fun a => (counts a : ℝ) / (∑ a, counts a : ℕ)) + + ∑ a, ((counts a : ℝ) / (∑ a, counts a : ℕ)) * Real.log (b a : ℝ))) := by + have hl := (tendsto_log_multinomial_mul counts hD).add_const + (∑ a, ((counts a : ℝ) / (∑ a, counts a : ℕ)) * Real.log (b a : ℝ)) + apply hl.congr' + filter_upwards [eventually_ne_atTop (0 : ℕ)] with t ht + have hbt : ∀ a, 0 < t * counts a → Fintype.card {u : U // statistic u = a} = b a := + fun a ha => hb a (by nlinarith) + rw [log_card_supported statistic (fun a => t * counts a) b hbt hbpos, add_div] + congr 1 + rw [Finset.sum_div] + apply Finset.sum_congr rfl + intro a _ + have ht' : (t : ℝ) ≠ 0 := Nat.cast_ne_zero.mpr ht + have hD' : ((∑ a, counts a : ℕ) : ℝ) ≠ 0 := by exact_mod_cast (Nat.ne_of_gt hD) + have hDsum : (∑ a, (counts a : ℝ)) ≠ 0 := by + simpa only [Nat.cast_sum] using hD' + simp only [Nat.cast_mul] + field_simp [ht', hD', hDsum] + +omit [DecidableEq U] in +theorem tendsto_log_card (statistic : U → A) (counts b : A → ℕ) + (hb : ∀ a, Fintype.card {u : U // statistic u = a} = b a) + (hbpos : ∀ a, 0 < b a) (hD : 0 < ∑ a, counts a) : + Tendsto (fun t : ℕ => + Real.log (Fintype.card (ExactStatisticWords.Words statistic (fun a => t * counts a)) : ℝ) / + ((t : ℝ) * (∑ a, counts a : ℕ))) atTop + (𝓝 (finiteEntropy (fun a => (counts a : ℝ) / (∑ a, counts a : ℕ)) + + ∑ a, ((counts a : ℝ) / (∑ a, counts a : ℕ)) * Real.log (b a : ℝ))) := + tendsto_log_card_supported statistic counts b (fun a _ => hb a) hbpos hD + +end MatrixMultiplication.LeafRates + + + + + + +namespace MatrixMultiplication.AllFieldZeroLeafRates + +open MatrixMultiplication.Foundation Filter AllFieldParameters CWWindowedLeaves CWCompleteStatistics +open scoped BigOperators Topology +attribute [local instance] Classical.propDecidable + +abbrev fourWords (t : Shape) (counts : PairSlot → ℕ) (m : ℕ) := + ExactStatisticWords.Words + (fun w : Alphabet 4 (shapeMax t) => fourStatistic w.val) (fun s => m * counts s) + +def twoWords (k : Fin 5) (counts : Fin 6 → ℕ) (m : ℕ) := + ExactStatisticWords.Words + (fun w : Alphabet 2 k.val => twoStatistic w.val) (fun s => m * counts s) + +instance twoWordsFintype (k : Fin 5) (counts : Fin 6 → ℕ) (m : ℕ) : + Fintype (twoWords k counts m) := by + unfold twoWords + infer_instance + +theorem multiplicity_pos (s : Fin 6) : 0 < AllFieldParameters.multiplicity s := by + fin_cases s <;> decide + +theorem four_supported (t : Shape) (counts : PairSlot → ℕ) + (hD : 0 < ∑ s, counts s) + (hlaw : ∀ s, (counts s : ℝ) / (∑ s, counts s : ℕ) = + (zeroPairLaw t s.1 s.2 : ℝ)) (s : PairSlot) (hs : 0 < counts s) : + Fintype.card {w : Alphabet 4 (shapeMax t) // fourStatistic w.val = s} = + AllFieldParameters.multiplicity s.1 * AllFieldParameters.multiplicity s.2 := by + apply four_fixedWeight_multiplicity + by_contra hweight + have hzero := zeroPairLaw_outside_support t s.1 s.2 hweight + have hpos : (0 : ℝ) < (counts s : ℝ) / (∑ s, counts s : ℕ) := + div_pos (by exact_mod_cast hs) (by exact_mod_cast hD) + rw [hlaw s, hzero, Rat.cast_zero] at hpos + exact (lt_irrefl 0) hpos + +theorem two_supported (d : ℚ) (k : Fin 5) (counts : Fin 6 → ℕ) + (hD : 0 < ∑ s, counts s) + (hlaw : ∀ s, (counts s : ℝ) / (∑ s, counts s : ℕ) = + (statisticLaw d k s : ℝ)) (s : Fin 6) (hs : 0 < counts s) : + Fintype.card {w : Alphabet 2 k.val // twoStatistic w.val = s} = + AllFieldParameters.multiplicity s := by + apply two_fixedWeight_multiplicity + by_contra hweight + have hzero := statisticLaw_outside_support d k s hweight + have hpos : (0 : ℝ) < (counts s : ℝ) / (∑ s, counts s : ℕ) := + div_pos (by exact_mod_cast hs) (by exact_mod_cast hD) + rw [hlaw s, hzero, Rat.cast_zero] at hpos + exact (lt_irrefl 0) hpos + +theorem four_card_pos (t : Shape) (counts : PairSlot → ℕ) + (hD : 0 < ∑ s, counts s) + (hlaw : ∀ s, (counts s : ℝ) / (∑ s, counts s : ℕ) = + (zeroPairLaw t s.1 s.2 : ℝ)) (m : ℕ) : + 0 < Fintype.card (fourWords t counts m) := by + apply ExactStatisticWords.card_pos_of_supported + (fun w : Alphabet 4 (shapeMax t) => fourStatistic w.val) (fun s => m * counts s) + (fun s => AllFieldParameters.multiplicity s.1 * AllFieldParameters.multiplicity s.2) + · intro s hs + exact four_supported t counts hD hlaw s (Nat.pos_of_mul_pos_left hs) + · intro s _ + exact Nat.mul_pos (multiplicity_pos s.1) (multiplicity_pos s.2) + +theorem two_card_pos (d : ℚ) (k : Fin 5) (counts : Fin 6 → ℕ) + (hD : 0 < ∑ s, counts s) + (hlaw : ∀ s, (counts s : ℝ) / (∑ s, counts s : ℕ) = + (statisticLaw d k s : ℝ)) (m : ℕ) : + 0 < Fintype.card (twoWords k counts m) := by + have h := ExactStatisticWords.card_pos_of_supported + (fun w : Alphabet 2 k.val => twoStatistic w.val) (fun s => m * counts s) + AllFieldParameters.multiplicity + (fun s hs => two_supported d k counts hD hlaw s (Nat.pos_of_mul_pos_left hs)) + (fun s _ => multiplicity_pos s) + rw [Fintype.card_eq_nat_card] at h ⊢ + exact h + +theorem four_tendsto_log_card (t : Shape) (counts : PairSlot → ℕ) + (hD : 0 < ∑ s, counts s) + (hlaw : ∀ s, (counts s : ℝ) / (∑ s, counts s : ℕ) = + (zeroPairLaw t s.1 s.2 : ℝ)) : + Tendsto (fun m : ℕ => Real.log (Fintype.card (fourWords t counts m) : ℝ) / + ((m : ℝ) * (∑ s, counts s : ℕ))) atTop (𝓝 (fourRate t)) := by + have h := LeafRates.tendsto_log_card_supported + (fun w : Alphabet 4 (shapeMax t) => fourStatistic w.val) counts + (fun s => AllFieldParameters.multiplicity s.1 * AllFieldParameters.multiplicity s.2) + (four_supported t counts hD hlaw) + (fun s => Nat.mul_pos (multiplicity_pos s.1) (multiplicity_pos s.2)) hD + simpa only [fourWords, hlaw, fourRate] using h + +theorem two_tendsto_log_card (d : ℚ) (k : Fin 5) (counts : Fin 6 → ℕ) + (hD : 0 < ∑ s, counts s) + (hlaw : ∀ s, (counts s : ℝ) / (∑ s, counts s : ℕ) = + (statisticLaw d k s : ℝ)) : + Tendsto (fun m : ℕ => Real.log (Fintype.card (twoWords k counts m) : ℝ) / + ((m : ℝ) * (∑ s, counts s : ℕ))) atTop (𝓝 (statisticRate d k)) := by + have h := LeafRates.tendsto_log_card_supported + (fun w : Alphabet 2 k.val => twoStatistic w.val) counts AllFieldParameters.multiplicity + (two_supported d k counts hD hlaw) multiplicity_pos hD + simp only [Fintype.card_eq_nat_card] at h ⊢ + simpa only [twoWords, hlaw, statisticRate] using h + +end MatrixMultiplication.AllFieldZeroLeafRates + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/Extraction/AuxiliarySeparation.lean b/lean/OAI/LinearAlgebra/MatrixFields/Extraction/AuxiliarySeparation.lean new file mode 100644 index 0000000000000000000000000000000000000000..bcde8fcef43d128074e33837c4be02000635c166 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/Extraction/AuxiliarySeparation.lean @@ -0,0 +1,147 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Entropy.ZeroLeafRates +import OAI.LinearAlgebra.MatrixFields.Tensors.ComplexSeparatedTensorDecomposition + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +namespace MatrixMultiplication.Foundation + +instance auxiliarySeparation_modulus_neZero (K : ℕ) : + NeZero (4 * Separation.gridWidth K) := + ⟨Nat.mul_ne_zero (by decide) + (Nat.ne_of_gt (lt_of_lt_of_le (by decide : 0 < 2) + (Separation.gridWidth_ge_two K)))⟩ + +section AuxiliarySeparation + +variable {X Y Z S : Type*} [Fintype S] [DecidableEq S] + +theorem auxiliary_separation_mem_restrictionOrbit + [Fintype X] [Fintype Y] [Fintype Z] + (T : Tensor ℂ X Y Z) (lx : X → S) (ly : Y → S) + (hlabels : ∀ x y z, T x y z ≠ 0 → lx x = ly y) : + separatedTensor (U := Fin (Fintype.card S)) lx T ∈ Tensor.restrictionOrbit + (Tensor.product T (groupTensor (Separation.AuxiliaryGroup + (Separation.gridDimension (Fintype.card S)) + (Separation.gridWidth (Fintype.card S))))) := by + exact finite_grid_separation_mem_restrictionOrbit T lx ly + (Separation.grid_population_bound (Fintype.card S)) + (Separation.grid_population_bound (Fintype.card S)) hlabels + +theorem auxiliary_separation_rankAtMost + (T : Tensor ℂ X Y Z) (lx : X → S) (ly : Y → S) {r : ℕ} + (hT : Tensor.RankAtMost T r) + (hlabels : ∀ x y z, T x y z ≠ 0 → lx x = ly y) : + Tensor.RankAtMost (separatedTensor (U := Fin (Fintype.card S)) lx T) + (r * Separation.gridGroupOrder (Fintype.card S)) := by + exact finite_grid_separation_rankAtMost T lx ly + (lt_of_lt_of_le (by decide : 0 < 2) + (Separation.gridWidth_ge_two (Fintype.card S))) + (Separation.grid_population_bound (Fintype.card S)) + (Separation.grid_population_bound (Fintype.card S)) hT hlabels + +theorem auxiliary_separation_borderRankAtMost + [Fintype X] [Fintype Y] [Fintype Z] + (T : Tensor ℂ X Y Z) (lx : X → S) (ly : Y → S) {r : ℕ} + (hT : Tensor.BorderRankAtMost T r) + (hlabels : ∀ x y z, T x y z ≠ 0 → lx x = ly y) : + Tensor.BorderRankAtMost (separatedTensor (U := Fin (Fintype.card S)) lx T) + (r * Separation.gridGroupOrder (Fintype.card S)) := by + exact finite_grid_separation_borderRankAtMost T lx ly + (lt_of_lt_of_le (by decide : 0 < 2) + (Separation.gridWidth_ge_two (Fintype.card S))) + (Separation.grid_population_bound (Fintype.card S)) + (Separation.grid_population_bound (Fintype.card S)) hT hlabels + +theorem auxiliary_separation_directSum_rankAtMost + (T : Tensor ℂ X Y Z) (lx : X → S) (ly : Y → S) {r : ℕ} + (hT : Tensor.RankAtMost T r) + (hlabels : ∀ x y z, T x y z ≠ 0 → lx x = ly y) : + Tensor.RankAtMost (Tensor.dependentDirectSum (fun s => + Tensor.product (labelFiberTensor lx ly T s) + (Tensor.dotPairing (Fin (Fintype.card S))))) + (r * Separation.gridGroupOrder (Fintype.card S)) := by + exact separatedTensor_fiber_directSum_rankAtMost T lx ly hlabels + (auxiliary_separation_rankAtMost T lx ly hT hlabels) + +theorem auxiliary_separation_directSum_borderRankAtMost + [Fintype X] [Fintype Y] [Fintype Z] + (T : Tensor ℂ X Y Z) (lx : X → S) (ly : Y → S) {r : ℕ} + (hT : Tensor.BorderRankAtMost T r) + (hlabels : ∀ x y z, T x y z ≠ 0 → lx x = ly y) : + Tensor.BorderRankAtMost (Tensor.dependentDirectSum (fun s => + Tensor.product (labelFiberTensor lx ly T s) + (Tensor.dotPairing (Fin (Fintype.card S))))) + (r * Separation.gridGroupOrder (Fintype.card S)) := by + exact separatedTensor_fiber_directSum_borderRankAtMost T lx ly hlabels + (auxiliary_separation_borderRankAtMost T lx ly hT hlabels) + +end AuxiliarySeparation + +theorem auxiliary_separation_logarithmic_cost : + Filter.Tendsto + (fun K : ℕ => Real.log (Separation.gridGroupOrder K : ℝ) / Real.log (K : ℝ)) + Filter.atTop (nhds 1) := + Separation.tendsto_log_gridGroupOrder_div_log_population + +end MatrixMultiplication.Foundation + +noncomputable section + +namespace MatrixMultiplication + +open MatrixMultiplication.Foundation Filter +open scoped Topology BigOperators + +namespace AuxiliarySeparation + +variable {X Y Z Label : Type*} [Fintype Label] [DecidableEq Label] + +theorem directSum_rankAtMost (T : Tensor ℂ X Y Z) + (readX : X → Label) (readY : Y → Label) {R : ℕ} + (hT : Tensor.RankAtMost T R) + (readable : ∀ x y z, T x y z ≠ 0 → readX x = readY y) : + Tensor.RankAtMost (Tensor.dependentDirectSum (fun label => + Tensor.product (labelFiberTensor readX readY T label) + (Tensor.dotPairing (Fin (Fintype.card Label))))) + (R * Separation.gridGroupOrder (Fintype.card Label)) := + auxiliary_separation_directSum_rankAtMost T readX readY hT readable + +theorem directSum_borderRankAtMost [Fintype X] [Fintype Y] [Fintype Z] + (T : Tensor ℂ X Y Z) (readX : X → Label) (readY : Y → Label) {R : ℕ} + (hT : Tensor.BorderRankAtMost T R) + (readable : ∀ x y z, T x y z ≠ 0 → readX x = readY y) : + Tensor.BorderRankAtMost (Tensor.dependentDirectSum (fun label => + Tensor.product (labelFiberTensor readX readY T label) + (Tensor.dotPairing (Fin (Fintype.card Label))))) + (R * Separation.gridGroupOrder (Fintype.card Label)) := + auxiliary_separation_directSum_borderRankAtMost T readX readY hT readable + +theorem logarithmic_cost : + Tendsto (fun K : ℕ => Real.log (Separation.gridGroupOrder K : ℝ) / + Real.log (K : ℝ)) atTop (𝓝 1) := + auxiliary_separation_logarithmic_cost + +theorem cost_minus_population_tendsto_zero {population : ℕ → ℕ} {rate : ℝ} + (positive : ∀ n, 0 < population n) (rate_nonneg : 0 ≤ rate) + (population_rate : Tendsto + (fun n => Real.log (population n : ℝ) / (n : ℝ)) atTop (𝓝 rate)) : + Tendsto (fun n => + (Real.log (LabelHierarchySeparation.poolAuxiliaryCost (population n) : ℝ) - + Real.log (population n : ℝ)) / (n : ℝ)) atTop (𝓝 0) := by + have h := (LabelHierarchySeparation.tendsto_log_poolAuxiliaryCost_div_nat + positive rate_nonneg population_rate).sub population_rate + simpa only [sub_self, sub_div] using h + +end AuxiliarySeparation +end MatrixMultiplication + +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/Extraction/ComplexFiniteSeparation.lean b/lean/OAI/LinearAlgebra/MatrixFields/Extraction/ComplexFiniteSeparation.lean new file mode 100644 index 0000000000000000000000000000000000000000..b9c3ed805fb30d67a80b419f600eceea923cb831 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/Extraction/ComplexFiniteSeparation.lean @@ -0,0 +1,447 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Tensors.ComplexDotPairing + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +namespace MatrixMultiplication.Foundation.Separation + +theorem grid_modular_collision (Q c t u v : ℤ) + (hc : 0 ≤ c ∧ c < Q) (ht : 0 ≤ t ∧ t < Q) + (hu : 0 ≤ u ∧ u < Q) (hv : 0 ≤ v ∧ v < Q) + (hmod : Int.ModEq (4 * Q) c (t + u - v)) : c = t + u - v := by + have hdvd : 4 * Q ∣ t + u - v - c := hmod.dvd + have hz : t + u - v - c = 0 := by + rcases le_total 0 (t + u - v - c) with h | h + · exact Int.eq_zero_of_dvd_of_nonneg_of_lt h (by omega) hdvd + · have hn : -(t + u - v - c) = 0 := + Int.eq_zero_of_dvd_of_nonneg_of_lt (by omega) (by omega) (Int.dvd_neg.mpr hdvd) + omega + omega + +variable {ι : Type*} [Fintype ι] + +def squaredNorm (t : ι → ℝ) : ℝ := ∑ i, (t i) ^ 2 + +def dot (t u : ι → ℝ) : ℝ := ∑ i, t i * u i + +theorem squaredNorm_displacement (t u v : ι → ℝ) : + squaredNorm (fun i => t i + u i - v i) = + squaredNorm t + 2 * (dot t u - dot t v) + + squaredNorm (fun i => u i - v i) := by + calc + squaredNorm (fun i => t i + u i - v i) = + ∑ i, ((t i) ^ 2 + 2 * (t i * u i - t i * v i) + + (u i - v i) ^ 2) := by + apply Finset.sum_congr rfl + intro i hi + ring + _ = _ := by + simp only [squaredNorm, dot, Finset.sum_add_distrib, + mul_sub, Finset.mul_sum, Finset.sum_sub_distrib] + +theorem sphere_slice_collision (t c u v : ι → ℝ) + (hsphere : squaredNorm c = squaredNorm t) + (hslice : dot t u = dot t v) + (hcollision : ∀ i, c i = t i + u i - v i) : u = v ∧ c = t := by + have hc : c = fun i => t i + u i - v i := funext hcollision + have hzero : squaredNorm (fun i => u i - v i) = 0 := by + have hid := squaredNorm_displacement t u v + rw [← hc, hsphere, hslice] at hid + linarith + have huv : u = v := by + funext i + have hle : (u i - v i) ^ 2 ≤ squaredNorm (fun j => u j - v j) := + Finset.single_le_sum (fun j _ => sq_nonneg (u j - v j)) (Finset.mem_univ i) + rw [hzero] at hle + nlinarith [sq_nonneg (u i - v i)] + refine ⟨huv, ?_⟩ + funext i + rw [hcollision, huv] + ring + +end MatrixMultiplication.Foundation.Separation + + + + + +namespace MatrixMultiplication.Foundation.Separation + +abbrev Grid (d Q : ℕ) := Fin d → Fin Q + +def gridSquaredNorm {d Q : ℕ} (x : Grid d Q) : ℕ := ∑ i, (x i : ℕ) ^ 2 + +def gridDot {d Q : ℕ} (t u : Grid d Q) : ℕ := ∑ i, (t i : ℕ) * (u i : ℕ) + +theorem gridSquaredNorm_le {d Q : ℕ} (x : Grid d Q) : gridSquaredNorm x ≤ d * Q ^ 2 := by + calc + gridSquaredNorm x ≤ ∑ _i : Fin d, Q ^ 2 := by + apply Finset.sum_le_sum + intro i hi + exact Nat.pow_le_pow_left (Nat.le_of_lt (x i).isLt) 2 + _ = d * Q ^ 2 := by simp + +theorem gridDot_le {d Q : ℕ} (t u : Grid d Q) : gridDot t u ≤ d * Q ^ 2 := by + calc + gridDot t u ≤ ∑ _i : Fin d, Q ^ 2 := by + apply Finset.sum_le_sum + intro i hi + simpa only [pow_two] using + Nat.mul_le_mul (Nat.le_of_lt (t i).isLt) (Nat.le_of_lt (u i).isLt) + _ = d * Q ^ 2 := by simp + +def normColor {d Q : ℕ} (x : Grid d Q) : Fin (d * Q ^ 2 + 1) := + ⟨gridSquaredNorm x, Nat.lt_succ_of_le (gridSquaredNorm_le x)⟩ + +def dotColor {d Q : ℕ} (t u : Grid d Q) : Fin (d * Q ^ 2 + 1) := + ⟨gridDot t u, Nat.lt_succ_of_le (gridDot_le t u)⟩ + +theorem two_stage_pigeonhole {A : Type*} [Fintype A] [DecidableEq A] + {M K m : ℕ} (hM : 0 < M) (f : A → Fin M) (g : A → A → Fin M) + (hK : M * K ≤ Fintype.card A) (hm : M * m ≤ Fintype.card A) : + ∃ tags : Finset A, tags.card = K ∧ + (∃ radius : Fin M, ∀ t ∈ tags, f t = radius) ∧ + ∀ t ∈ tags, ∃ slice : Finset A, slice.card = m ∧ + ∃ level : Fin M, ∀ u ∈ slice, g t u = level := by + let : Nonempty (Fin M) := ⟨⟨0, hM⟩⟩ + obtain ⟨radius, hr⟩ := Fintype.exists_le_card_fiber_of_mul_le_card f + (by simpa only [Fintype.card_fin] using hK) + obtain ⟨tags, htags, hcard⟩ := Finset.exists_subset_card_eq hr + refine ⟨tags, hcard, ⟨radius, ?_⟩, ?_⟩ + · intro t ht + exact (Finset.mem_filter.mp (htags ht)).2 + · intro t ht + obtain ⟨level, hl⟩ := Fintype.exists_le_card_fiber_of_mul_le_card (g t) + (by simpa only [Fintype.card_fin] using hm) + obtain ⟨slice, hslice, hsize⟩ := Finset.exists_subset_card_eq hl + refine ⟨slice, hsize, level, ?_⟩ + intro u hu + exact (Finset.mem_filter.mp (hslice hu)).2 + +theorem grid_tags_slices {d Q K m : ℕ} + (hK : (d * Q ^ 2 + 1) * K ≤ Q ^ d) + (hm : (d * Q ^ 2 + 1) * m ≤ Q ^ d) : + ∃ tags : Finset (Grid d Q), tags.card = K ∧ + (∃ radius : Fin (d * Q ^ 2 + 1), ∀ t ∈ tags, normColor t = radius) ∧ + ∀ t ∈ tags, ∃ slice : Finset (Grid d Q), slice.card = m ∧ + ∃ level : Fin (d * Q ^ 2 + 1), ∀ u ∈ slice, dotColor t u = level := by + exact two_stage_pigeonhole (Nat.succ_pos _) normColor dotColor + (by simpa only [Grid, Fintype.card_fun, Fintype.card_fin] using hK) + (by simpa only [Grid, Fintype.card_fun, Fintype.card_fin] using hm) + + + + + + + +abbrev AuxiliaryGroup (d Q : ℕ) := Fin d → ZMod (4 * Q) + +def gridToGroup {d Q : ℕ} (x : Grid d Q) : AuxiliaryGroup d Q := + fun i => (x i : ℕ) + +def gridToReal {d Q : ℕ} (x : Grid d Q) : Fin d → ℝ := + fun i => (x i : ℕ) + +theorem gridToReal_injective {d Q : ℕ} : + Function.Injective (gridToReal : Grid d Q → Fin d → ℝ) := by + intro x y h + funext i + apply Fin.ext + have hi := congrFun h i + change ((x i : ℕ) : ℝ) = ((y i : ℕ) : ℝ) at hi + exact_mod_cast hi + +theorem squaredNorm_gridToReal {d Q : ℕ} (x : Grid d Q) : + squaredNorm (gridToReal x) = (gridSquaredNorm x : ℝ) := by + simp [squaredNorm, gridToReal, gridSquaredNorm, Nat.cast_sum] + +theorem dot_gridToReal {d Q : ℕ} (x y : Grid d Q) : + dot (gridToReal x) (gridToReal y) = (gridDot x y : ℝ) := by + simp [dot, gridToReal, gridDot, Nat.cast_sum] + +theorem grid_group_collision_lift {d Q : ℕ} (t c u v : Grid d Q) + (h : gridToGroup u + (gridToGroup t - gridToGroup v) = gridToGroup c) : + ∀ i, ((c i : ℕ) : ℤ) = + ((t i : ℕ) : ℤ) + ((u i : ℕ) : ℤ) - ((v i : ℕ) : ℤ) := by + intro i + have hcast : (((c i : ℕ) : ℤ) : ZMod (4 * Q)) = + ((((t i : ℕ) : ℤ) + ((u i : ℕ) : ℤ) - ((v i : ℕ) : ℤ)) : + ZMod (4 * Q)) := by + simpa [gridToGroup, sub_eq_add_neg, add_comm, add_left_comm, add_assoc] + using (congrFun h i).symm + have hmod : Int.ModEq (4 * (Q : ℤ)) ((c i : ℕ) : ℤ) + (((t i : ℕ) : ℤ) + ((u i : ℕ) : ℤ) - ((v i : ℕ) : ℤ)) := by + simpa only [Nat.cast_mul, Nat.cast_ofNat] using + (ZMod.intCast_eq_intCast_iff _ _ (4 * Q)).mp + (by simpa only [Int.cast_add, Int.cast_sub] using hcast) + have hbound (x : Fin Q) : 0 ≤ ((x : ℕ) : ℤ) ∧ ((x : ℕ) : ℤ) < (Q : ℤ) := by + refine ⟨Int.natCast_nonneg _, ?_⟩ + exact_mod_cast x.isLt + exact grid_modular_collision (Q : ℤ) _ _ _ _ + (hbound (c i)) (hbound (t i)) (hbound (u i)) (hbound (v i)) hmod + +theorem grid_sphere_slice_collision {d Q : ℕ} (t c u v : Grid d Q) + (hsphere : gridSquaredNorm c = gridSquaredNorm t) + (hslice : gridDot t u = gridDot t v) : + gridToGroup u + (gridToGroup t - gridToGroup v) = gridToGroup c ↔ + u = v ∧ c = t := by + constructor + · intro h + have hnorm : squaredNorm (gridToReal c) = squaredNorm (gridToReal t) := by + simp only [squaredNorm_gridToReal, hsphere] + have hdot : dot (gridToReal t) (gridToReal u) = + dot (gridToReal t) (gridToReal v) := by + simp only [dot_gridToReal, hslice] + have hlift := grid_group_collision_lift t c u v h + have hreal : ∀ i, gridToReal c i = + gridToReal t i + gridToReal u i - gridToReal v i := by + intro i + dsimp [gridToReal] + exact_mod_cast hlift i + obtain ⟨huv, hct⟩ := sphere_slice_collision + (gridToReal t) (gridToReal c) (gridToReal u) (gridToReal v) hnorm hdot hreal + exact ⟨gridToReal_injective huv, gridToReal_injective hct⟩ + · rintro ⟨rfl, rfl⟩ + simp [sub_eq_add_neg, add_left_comm] + +theorem indexed_grid_collision {S U : Type*} {d Q : ℕ} + (tag : S → Grid d Q) (point : S → U → Grid d Q) + (htag : Function.Injective tag) + (hpoint : ∀ s, Function.Injective (point s)) + (hsphere : ∀ s s', gridSquaredNorm (tag s') = gridSquaredNorm (tag s)) + (hslice : ∀ s i j, gridDot (tag s) (point s i) = gridDot (tag s) (point s j)) : + ∀ s s' i j, + gridToGroup (point s i) + (gridToGroup (tag s) - gridToGroup (point s j)) = + gridToGroup (tag s') ↔ s = s' ∧ i = j := by + intro s s' i j + rw [grid_sphere_slice_collision (tag s) (tag s') (point s i) (point s j) + (hsphere s s') (hslice s i j)] + constructor + · rintro ⟨hij, hss⟩ + exact ⟨(htag hss).symm, hpoint s hij⟩ + · rintro ⟨rfl, rfl⟩ + exact ⟨rfl, rfl⟩ + +theorem exists_modular_separation {d Q K m : ℕ} + (hK : (d * Q ^ 2 + 1) * K ≤ Q ^ d) + (hm : (d * Q ^ 2 + 1) * m ≤ Q ^ d) : + ∃ (tag : Fin K → AuxiliaryGroup d Q) + (point : Fin K → Fin m → AuxiliaryGroup d Q), + ∀ s s' i j, + point s i + (tag s - point s j) = tag s' ↔ s = s' ∧ i = j := by + classical + obtain ⟨tags, htags, ⟨radius, hradius⟩, hslices⟩ := grid_tags_slices hK hm + choose slice hsliceCard level hlevel using + (fun t : ↥tags => hslices t.val t.property) + let tagEnum : Fin K ≃ ↥tags := (Finset.equivFinOfCardEq htags).symm + let sliceEnum (t : ↥tags) : Fin m ≃ ↥(slice t) := + (Finset.equivFinOfCardEq (hsliceCard t)).symm + let tagGrid (s : Fin K) : Grid d Q := (tagEnum s).val + let pointGrid (s : Fin K) (i : Fin m) : Grid d Q := + (sliceEnum (tagEnum s) i).val + have htag : Function.Injective tagGrid := by + intro s s' h + apply tagEnum.injective + exact Subtype.ext h + have hpoint : ∀ s, Function.Injective (pointGrid s) := by + intro s i j h + apply (sliceEnum (tagEnum s)).injective + exact Subtype.ext h + have hsphere : ∀ s s', gridSquaredNorm (tagGrid s') = gridSquaredNorm (tagGrid s) := by + intro s s' + have hc := (hradius (tagEnum s').val (tagEnum s').property).trans + (hradius (tagEnum s).val (tagEnum s).property).symm + exact congrArg Fin.val hc + have hslice : ∀ s i j, + gridDot (tagGrid s) (pointGrid s i) = gridDot (tagGrid s) (pointGrid s j) := by + intro s i j + have hc := (hlevel (tagEnum s) (sliceEnum (tagEnum s) i).val + (sliceEnum (tagEnum s) i).property).trans + (hlevel (tagEnum s) (sliceEnum (tagEnum s) j).val + (sliceEnum (tagEnum s) j).property).symm + exact congrArg Fin.val hc + exact ⟨fun s => gridToGroup (tagGrid s), fun s i => gridToGroup (pointGrid s i), + indexed_grid_collision tagGrid pointGrid htag hpoint hsphere hslice⟩ + +theorem card_auxiliaryGroup (d Q : ℕ) [NeZero (4 * Q)] : + Fintype.card (AuxiliaryGroup d Q) = (4 * Q) ^ d := by + simp [AuxiliaryGroup, ZMod.card] + +end MatrixMultiplication.Foundation.Separation + + + + + +namespace MatrixMultiplication.Foundation + +section Separation + +variable {X Y Z S U G : Type*} +variable [AddCommGroup G] [Fintype G] [DecidableEq G] +variable [DecidableEq S] [DecidableEq U] + +def separatedTensor (lx : X → S) (T : Tensor ℂ X Y Z) : + Tensor ℂ (X × U) (Y × U) (Z × S) := + fun x y z => if lx x.1 = z.2 ∧ x.2 = y.2 then T x.1 y.1 z.1 else 0 + +omit [Fintype G] in +theorem finite_separation_identity + (T : Tensor ℂ X Y Z) (lx : X → S) (ly : Y → S) + (tag : S → G) (point : S → U → G) + (hlabels : ∀ x y z, T x y z ≠ 0 → lx x = ly y) + (hcollision : ∀ s s' i j, + point s i + (tag s - point s j) = tag s' ↔ s = s' ∧ i = j) : + Tensor.pullback + (fun x : X × U => (x.1, point (lx x.1) x.2)) + (fun y : Y × U => (y.1, tag (ly y.1) - point (ly y.1) y.2)) + (fun z : Z × S => (z.1, tag z.2)) + (Tensor.product T (groupTensor G)) = separatedTensor lx T := by + funext x y z + by_cases hzero : T x.1 y.1 z.1 = 0 + · simp [Tensor.pullback, Tensor.product, separatedTensor, hzero] + · have hxy := hlabels x.1 y.1 z.1 hzero + simp only [Tensor.pullback, Tensor.product, groupTensor, separatedTensor] + simp only [← hxy, hcollision, mul_ite, mul_one, mul_zero] + +theorem finite_separation_mem_restrictionOrbit + [Fintype X] [Fintype Y] [Fintype Z] + (T : Tensor ℂ X Y Z) (lx : X → S) (ly : Y → S) + (tag : S → G) (point : S → U → G) + (hlabels : ∀ x y z, T x y z ≠ 0 → lx x = ly y) + (hcollision : ∀ s s' i j, + point s i + (tag s - point s j) = tag s' ↔ s = s' ∧ i = j) : + separatedTensor (U := U) lx T ∈ + Tensor.restrictionOrbit (Tensor.product T (groupTensor G)) := by + classical + rw [← finite_separation_identity T lx ly tag point hlabels hcollision] + refine ⟨(fun (x : X × U) (original : X × G) => + if original = (x.1, point (lx x.1) x.2) then 1 else 0), + (fun (y : Y × U) (original : Y × G) => + if original = (y.1, tag (ly y.1) - point (ly y.1) y.2) then 1 else 0), + (fun (z : Z × S) (original : Z × G) => + if original = (z.1, tag z.2) then 1 else 0), ?_⟩ + exact Tensor.pullback_eq_restrict _ _ _ _ + +theorem finite_separation_degeneratesTo + [Fintype X] [Fintype Y] [Fintype Z] [Fintype S] [Fintype U] + (T : Tensor ℂ X Y Z) (lx : X → S) (ly : Y → S) + (tag : S → G) (point : S → U → G) + (hlabels : ∀ x y z, T x y z ≠ 0 → lx x = ly y) + (hcollision : ∀ s s' i j, + point s i + (tag s - point s j) = tag s' ↔ s = s' ∧ i = j) : + Tensor.DegeneratesTo (Tensor.product T (groupTensor G)) + (separatedTensor (U := U) lx T) := by + exact subset_closure + (finite_separation_mem_restrictionOrbit T lx ly tag point hlabels hcollision) + +theorem finite_separation_rankAtMost + (T : Tensor ℂ X Y Z) (lx : X → S) (ly : Y → S) + (tag : S → G) (point : S → U → G) {r : ℕ} + (hT : Tensor.RankAtMost T r) + (hlabels : ∀ x y z, T x y z ≠ 0 → lx x = ly y) + (hcollision : ∀ s s' i j, + point s i + (tag s - point s j) = tag s' ↔ s = s' ∧ i = j) : + Tensor.RankAtMost (separatedTensor (U := U) lx T) (r * Fintype.card G) := by + rw [← finite_separation_identity T lx ly tag point hlabels hcollision] + exact (hT.product (groupTensor_rankAtMost G)).pullback _ _ _ + +theorem finite_separation_borderRankAtMost + [Fintype X] [Fintype Y] [Fintype Z] [Fintype S] [Fintype U] + (T : Tensor ℂ X Y Z) (lx : X → S) (ly : Y → S) + (tag : S → G) (point : S → U → G) {r : ℕ} + (hT : Tensor.BorderRankAtMost T r) + (hlabels : ∀ x y z, T x y z ≠ 0 → lx x = ly y) + (hcollision : ∀ s s' i j, + point s i + (tag s - point s j) = tag s' ↔ s = s' ∧ i = j) : + Tensor.BorderRankAtMost (separatedTensor (U := U) lx T) + (r * Fintype.card G) := by + classical + rw [← finite_separation_identity T lx ly tag point hlabels hcollision] + rw [Tensor.pullback_eq_restrict] + exact (hT.product (groupTensor_rankAtMost G).borderRankAtMost).restrict _ _ _ + +end Separation + +section FiniteGrid + +variable {X Y Z S : Type*} [Fintype S] [DecidableEq S] + +theorem finite_grid_separation_mem_restrictionOrbit + [Fintype X] [Fintype Y] [Fintype Z] + (T : Tensor ℂ X Y Z) (lx : X → S) (ly : Y → S) + {d Q m : ℕ} [NeZero (4 * Q)] + (hK : (d * Q ^ 2 + 1) * Fintype.card S ≤ Q ^ d) + (hm : (d * Q ^ 2 + 1) * m ≤ Q ^ d) + (hlabels : ∀ x y z, T x y z ≠ 0 → lx x = ly y) : + separatedTensor (U := Fin m) lx T ∈ Tensor.restrictionOrbit + (Tensor.product T (groupTensor (Separation.AuxiliaryGroup d Q))) := by + classical + obtain ⟨tag, point, hcollision⟩ := Separation.exists_modular_separation hK hm + let e : S ≃ Fin (Fintype.card S) := Fintype.equivFin S + have hc : ∀ s s' i j, + point (e s) i + (tag (e s) - point (e s) j) = tag (e s') ↔ + s = s' ∧ i = j := by + intro s s' i j + rw [hcollision, e.injective.eq_iff] + exact finite_separation_mem_restrictionOrbit T lx ly + (fun s => tag (e s)) (fun s => point (e s)) hlabels hc + +theorem finite_grid_separation_rankAtMost + (T : Tensor ℂ X Y Z) (lx : X → S) (ly : Y → S) + {d Q m r : ℕ} (hQ : 0 < Q) + (hK : (d * Q ^ 2 + 1) * Fintype.card S ≤ Q ^ d) + (hm : (d * Q ^ 2 + 1) * m ≤ Q ^ d) + (hT : Tensor.RankAtMost T r) + (hlabels : ∀ x y z, T x y z ≠ 0 → lx x = ly y) : + Tensor.RankAtMost (separatedTensor (U := Fin m) lx T) (r * (4 * Q) ^ d) := by + classical + let : NeZero (4 * Q) := ⟨Nat.ne_of_gt (Nat.mul_pos (by decide) hQ)⟩ + obtain ⟨tag, point, hcollision⟩ := Separation.exists_modular_separation hK hm + let e : S ≃ Fin (Fintype.card S) := Fintype.equivFin S + have hc : ∀ s s' i j, + point (e s) i + (tag (e s) - point (e s) j) = tag (e s') ↔ + s = s' ∧ i = j := by + intro s s' i j + rw [hcollision, e.injective.eq_iff] + have hr := finite_separation_rankAtMost T lx ly + (fun s => tag (e s)) (fun s => point (e s)) hT hlabels hc + simpa only [Separation.card_auxiliaryGroup] using hr + +theorem finite_grid_separation_borderRankAtMost + [Fintype X] [Fintype Y] [Fintype Z] + (T : Tensor ℂ X Y Z) (lx : X → S) (ly : Y → S) + {d Q m r : ℕ} (hQ : 0 < Q) + (hK : (d * Q ^ 2 + 1) * Fintype.card S ≤ Q ^ d) + (hm : (d * Q ^ 2 + 1) * m ≤ Q ^ d) + (hT : Tensor.BorderRankAtMost T r) + (hlabels : ∀ x y z, T x y z ≠ 0 → lx x = ly y) : + Tensor.BorderRankAtMost (separatedTensor (U := Fin m) lx T) + (r * (4 * Q) ^ d) := by + classical + let : NeZero (4 * Q) := ⟨Nat.ne_of_gt (Nat.mul_pos (by decide) hQ)⟩ + obtain ⟨tag, point, hcollision⟩ := Separation.exists_modular_separation hK hm + let e : S ≃ Fin (Fintype.card S) := Fintype.equivFin S + have hc : ∀ s s' i j, + point (e s) i + (tag (e s) - point (e s) j) = tag (e s') ↔ + s = s' ∧ i = j := by + intro s s' i j + rw [hcollision, e.injective.eq_iff] + have hr := finite_separation_borderRankAtMost T lx ly + (fun s => tag (e s)) (fun s => point (e s)) hT hlabels hc + simpa only [Separation.card_auxiliaryGroup] using hr + +end FiniteGrid +end MatrixMultiplication.Foundation + +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/Extraction/ComplexLabelHierarchySeparation.lean b/lean/OAI/LinearAlgebra/MatrixFields/Extraction/ComplexLabelHierarchySeparation.lean new file mode 100644 index 0000000000000000000000000000000000000000..c56abac23b0a58a4fabe91fa330d5ab7dba39793 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/Extraction/ComplexLabelHierarchySeparation.lean @@ -0,0 +1,610 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Construction.ComplexLocalMaps +import OAI.LinearAlgebra.MatrixFields.Construction.ComplexSharedAuxiliaryBank +import OAI.LinearAlgebra.MatrixFields.Entropy.JointExtractionRates + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +open scoped BigOperators + +namespace MatrixMultiplication.Foundation +namespace LabelHierarchySeparation + +section Bank + +variable {K I : Type*} [CommSemiring K] [Fintype I] +variable {X Y Z : I → Type*} + +variable {Node : Type*} [Fintype Node] + +def populationCoordinateEquiv {J : Type*} (D : Node → Type*) + (pool : I → Node) (reference : J → Node) (e : I ≃ J) + (same : ∀ i, reference (e i) = pool i) : + (∀ i, D (pool i)) ≃ (∀ j, D (reference j)) := + e.piCongr (fun i => Equiv.cast (congrArg D (same i).symm)) + +omit [CommSemiring K] [Fintype Node] in +theorem tensor_transport {AX AY AZ : Node → Type*} + (T : ∀ node, Tensor K (AX node) (AY node) (AZ node)) + {node node' : Node} (h : node = node') (x : AX node) (y : AY node) (z : AZ node) : + T node' (Equiv.cast (congrArg AX h) x) (Equiv.cast (congrArg AY h) y) + (Equiv.cast (congrArg AZ h) z) = T node x y z := by + cases h + rfl + +omit [Fintype Node] in +theorem bankTensor_population_reindex {J : Type*} [Fintype J] + {AX AY AZ : Node → Type*} + (T : ∀ node, Tensor K (AX node) (AY node) (AZ node)) + (pool : I → Node) (reference : J → Node) (e : I ≃ J) + (same : ∀ i, reference (e i) = pool i) : + Tensor.pullback (populationCoordinateEquiv AX pool reference e same) + (populationCoordinateEquiv AY pool reference e same) + (populationCoordinateEquiv AZ pool reference e same) + (bankTensor (fun j => T (reference j))) = bankTensor (fun i => T (pool i)) := by + unfold populationCoordinateEquiv + apply bankTensor_reindex e + intro i x y z + exact tensor_transport T (same i).symm x y z + +omit [Fintype Node] in +theorem bankTensor_population_rankAtMost {J : Type*} [Fintype J] + {AX AY AZ : Node → Type*} + (T : ∀ node, Tensor K (AX node) (AY node) (AZ node)) + (pool : I → Node) (reference : J → Node) (e : I ≃ J) + (same : ∀ i, reference (e i) = pool i) + {r : ℕ} (hT : Tensor.RankAtMost (bankTensor (fun j => T (reference j))) r) : + Tensor.RankAtMost (bankTensor (fun i => T (pool i))) r := by + rw [← bankTensor_population_reindex T pool reference e same] + exact hT.pullback _ _ _ + +abbrev BankOccurrences (population : Node → ℕ) := + (node : Node) × Fin (population node) + +theorem canonical_bank_product {M : Type*} [CommMonoid M] + (population : Node → ℕ) (cost : Node → M) : + (∏ i : BankOccurrences population, cost i.1) = + ∏ node, cost node ^ population node := by + simp [BankOccurrences, Fintype.prod_sigma] + +theorem canonical_pairing_card [DecidableEq Node] (population dimension : Node → ℕ) : + Fintype.card (∀ i : BankOccurrences population, Fin (dimension i.1)) = + ∏ node, dimension node ^ population node := by + classical + simp only [Fintype.card_pi, Fintype.card_fin, canonical_bank_product] + +theorem canonical_bank_rankAtMost + {AX AY AZ : Node → Type*} + (E : ∀ node, Tensor K (AX node) (AY node) (AZ node)) + (population rank : Node → ℕ) + (hE : ∀ node, Tensor.RankAtMost (E node) (rank node)) : + Tensor.RankAtMost + (bankTensor (fun i : BankOccurrences population => E i.1)) + (∏ node, rank node ^ population node) := by + simpa only [canonical_bank_product] using + bankTensor_rankAtMost + (fun i : BankOccurrences population => E i.1) + (fun i => rank i.1) (fun i => hE i.1) + +theorem occurrence_product {M : Type*} [CommMonoid M] [DecidableEq Node] + (pool : I → Node) (cost : Node → M) : + (∏ i, cost (pool i)) = + ∏ node, cost node ^ Fintype.card {i // pool i = node} := by + rw [← Fintype.prod_fiberwise' pool cost] + simp + +theorem exact_population_product {M : Type*} [CommMonoid M] [DecidableEq Node] + (pool : I → Node) (population : Node → ℕ) + (exactPopulation : ∀ node, + Fintype.card {i // pool i = node} = population node) (cost : Node → M) : + (∏ i, cost (pool i)) = ∏ node, cost node ^ population node := by + rw [occurrence_product] + simp only [exactPopulation] + +omit [Fintype Node] in +theorem exact_population_bank_equiv [DecidableEq Node] + (pool : I → Node) (population : Node → ℕ) + (exactPopulation : ∀ node, + Fintype.card {i // pool i = node} = population node) : + ∃ e : I ≃ BankOccurrences population, ∀ i, (e i).1 = pool i := by + classical + let ef : ∀ node, {i // pool i = node} ≃ Fin (population node) := + fun node => Fintype.equivOfCardEq (by simp [exactPopulation node]) + refine ⟨(Equiv.sigmaFiberEquiv pool).symm.trans + (Equiv.sigmaCongrRight ef), ?_⟩ + intro i + rfl + +end Bank + +section PrefixSeparation + +variable {X Y Z Prefix Label Pairing G : Type*} +variable [AddCommGroup G] [Fintype G] [DecidableEq G] +variable [DecidableEq Label] [DecidableEq Pairing] + +omit [Fintype G] in +theorem prefix_separation_identity + (T : Tensor ℂ X Y Z) + (px : X → Prefix) (py : Y → Prefix) (pz : Z → Prefix) + (lx : X → Label) (ly : Y → Label) + (tag : Prefix → Label → G) (point : Prefix → Label → Pairing → G) + (prefixes : ∀ x y z, T x y z ≠ 0 → px x = py y ∧ px x = pz z) + (labels : ∀ x y z, T x y z ≠ 0 → lx x = ly y) + (collision : ∀ p s s' i j, + point p s i + (tag p s - point p s j) = tag p s' ↔ + s = s' ∧ i = j) : + Tensor.pullback + (fun x : X × Pairing => (x.1, point (px x.1) (lx x.1) x.2)) + (fun y : Y × Pairing => + (y.1, tag (py y.1) (ly y.1) - point (py y.1) (ly y.1) y.2)) + (fun z : Z × Label => (z.1, tag (pz z.1) z.2)) + (Tensor.product T (groupTensor G)) = separatedTensor lx T := by + funext x y z + by_cases hzero : T x.1 y.1 z.1 = 0 + · simp [Tensor.pullback, Tensor.product, separatedTensor, hzero] + · obtain ⟨hxy, hxz⟩ := prefixes x.1 y.1 z.1 hzero + have hl := labels x.1 y.1 z.1 hzero + simp only [Tensor.pullback, Tensor.product, groupTensor, separatedTensor] + simp only [← hxy, ← hxz, ← hl, collision, mul_ite, mul_one, mul_zero] + +theorem prefix_separation_rankAtMost + (T : Tensor ℂ X Y Z) + (px : X → Prefix) (py : Y → Prefix) (pz : Z → Prefix) + (lx : X → Label) (ly : Y → Label) + (tag : Prefix → Label → G) (point : Prefix → Label → Pairing → G) + {r : ℕ} (hT : Tensor.RankAtMost T r) + (prefixes : ∀ x y z, T x y z ≠ 0 → px x = py y ∧ px x = pz z) + (labels : ∀ x y z, T x y z ≠ 0 → lx x = ly y) + (collision : ∀ p s s' i j, + point p s i + (tag p s - point p s j) = tag p s' ↔ + s = s' ∧ i = j) : + Tensor.RankAtMost (separatedTensor (U := Pairing) lx T) + (r * Fintype.card G) := by + rw [← prefix_separation_identity T px py pz lx ly tag point + prefixes labels collision] + exact (hT.product (groupTensor_rankAtMost G)).pullback _ _ _ + +@[simp] theorem separated_coefficient + (T : Tensor ℂ X Y Z) (lx : X → Label) + (x : X) (y : Y) (z : Z) (u : Pairing) : + separatedTensor lx T (x, u) (y, u) (z, lx x) = T x y z := by + simp [separatedTensor] + +theorem deterministic_separation_identity + [Subsingleton Label] [Subsingleton Pairing] [Nonempty Pairing] + (T : Tensor ℂ X Y Z) (lx : X → Label) : + separatedTensor (U := Pairing) lx T = + Tensor.pullback Prod.fst Prod.fst Prod.fst T := by + funext x y z + simp [separatedTensor, Tensor.pullback, Subsingleton.elim (lx x.1) z.2, + Subsingleton.elim x.2 y.2] + +theorem separated_prefix_synchronized + (T : Tensor ℂ X Y Z) + (px : X → Prefix) (py : Y → Prefix) (pz : Z → Prefix) + (lx : X → Label) (ly : Y → Label) + (prefixes : ∀ x y z, T x y z ≠ 0 → px x = py y ∧ px x = pz z) + (labels : ∀ x y z, T x y z ≠ 0 → lx x = ly y) + (x : X × Pairing) (y : Y × Pairing) (z : Z × Label) + (h : separatedTensor lx T x y z ≠ 0) : + (px x.1, lx x.1) = (py y.1, ly y.1) ∧ + (px x.1, lx x.1) = (pz z.1, z.2) := by + have hguard : lx x.1 = z.2 ∧ x.2 = y.2 := by + by_contra hn + exact h (by simp [separatedTensor, hn]) + have hT : T x.1 y.1 z.1 ≠ 0 := by + simpa [separatedTensor, hguard] using h + obtain ⟨hxy, hxz⟩ := prefixes x.1 y.1 z.1 hT + exact ⟨Prod.ext hxy (labels x.1 y.1 z.1 hT), Prod.ext hxz hguard.1⟩ + +end PrefixSeparation + +section ExactPools + +variable {X Y Z Prefix Label : Type*} [DecidableEq Label] + +noncomputable def poolEnumeration (pool : Prefix → Finset Label) (k : ℕ) + (counts : ∀ p, (pool p).card = k) : ∀ p, ↥(pool p) ≃ Fin k := + fun p => Finset.equivFinOfCardEq (counts p) + +def poolCode (pool : Prefix → Finset Label) {k : ℕ} + (enumerate : ∀ p, ↥(pool p) ≃ Fin k) + (prior : X → Prefix) (label : X → Label) + (allowed : ∀ x, label x ∈ pool (prior x)) : X → Fin k := + fun x => enumerate (prior x) ⟨label x, allowed x⟩ + +omit [DecidableEq Label] in +@[simp] theorem poolCode_decode (pool : Prefix → Finset Label) {k : ℕ} + (enumerate : ∀ p, ↥(pool p) ≃ Fin k) + (prior : X → Prefix) (label : X → Label) + (allowed : ∀ x, label x ∈ pool (prior x)) (x : X) : + ((enumerate (prior x)).symm (poolCode pool enumerate prior label allowed x)).val = + label x := by + simp [poolCode] + +omit [DecidableEq Label] in +theorem poolCode_agree (pool : Prefix → Finset Label) {k : ℕ} + (enumerate : ∀ p, ↥(pool p) ≃ Fin k) + (px : X → Prefix) (py : Y → Prefix) (lx : X → Label) (ly : Y → Label) + (ax : ∀ x, lx x ∈ pool (px x)) (ay : ∀ y, ly y ∈ pool (py y)) + (x : X) (y : Y) (hp : px x = py y) (hl : lx x = ly y) : + poolCode pool enumerate px lx ax x = poolCode pool enumerate py ly ay y := by + have congr_code : ∀ (p q : Prefix) (a : ↥(pool p)) (b : ↥(pool q)), + p = q → a.val = b.val → enumerate p a = enumerate q b := by + intro p q a b hp hl + cases hp + exact congrArg (enumerate p) (Subtype.ext hl) + exact congr_code _ _ ⟨lx x, ax x⟩ ⟨ly y, ay y⟩ hp hl + +noncomputable def poolAuxiliaryCost (k : ℕ) : ℕ := + if k = 1 then 1 else Separation.gridGroupOrder k + +abbrev PoolAuxiliaryGroup (k : ℕ) := + Separation.AuxiliaryGroup (Separation.gridDimension k) (Separation.gridWidth k) + +local instance poolAuxiliaryModulusNeZero (population : ℕ) : + NeZero (4 * Separation.gridWidth population) := + ⟨Nat.ne_of_gt (Nat.mul_pos (by decide) + (lt_of_lt_of_le (by decide : 0 < 2) + (Separation.gridWidth_ge_two population)))⟩ + +noncomputable def poolAuxiliaryTensor (k : ℕ) : + Tensor ℂ (PoolAuxiliaryGroup k) (PoolAuxiliaryGroup k) (PoolAuxiliaryGroup k) := + if k = 1 then Tensor.rankOne (fun _ => 1) (fun _ => 1) (fun _ => 1) + else groupTensor (PoolAuxiliaryGroup k) + +theorem poolAuxiliaryTensor_rankAtMost (k : ℕ) : + Tensor.RankAtMost (poolAuxiliaryTensor k) (poolAuxiliaryCost k) := by + classical + by_cases hk : k = 1 + · simpa only [poolAuxiliaryTensor, poolAuxiliaryCost, ite_eq_left hk] using + Tensor.rankOne_rankAtMost (fun _ : PoolAuxiliaryGroup k => (1 : ℂ)) + (fun _ : PoolAuxiliaryGroup k => (1 : ℂ)) + (fun _ : PoolAuxiliaryGroup k => (1 : ℂ)) + · simpa only [poolAuxiliaryTensor, poolAuxiliaryCost, ite_eq_right hk, + PoolAuxiliaryGroup, Separation.card_auxiliaryGroup, Separation.gridGroupOrder] + using groupTensor_rankAtMost (PoolAuxiliaryGroup k) + +omit [DecidableEq Label] in +theorem exact_pool_mem_restrictionOrbit + [Fintype X] [Fintype Y] [Fintype Z] + (pool : Prefix → Finset Label) (k : ℕ) (counts : ∀ p, (pool p).card = k) + (T : Tensor ℂ X Y Z) (px : X → Prefix) (py : Y → Prefix) + (lx : X → Label) (ly : Y → Label) + (ax : ∀ x, lx x ∈ pool (px x)) (ay : ∀ y, ly y ∈ pool (py y)) + (prefixes : ∀ x y z, T x y z ≠ 0 → px x = py y) + (labels : ∀ x y z, T x y z ≠ 0 → lx x = ly y) : + separatedTensor (U := Fin k) + (poolCode pool (poolEnumeration pool k counts) px lx ax) T ∈ + Tensor.restrictionOrbit (Tensor.product T + (groupTensor (Separation.AuxiliaryGroup + (Separation.gridDimension k) (Separation.gridWidth k)))) := by + classical + have hagree : ∀ x y z, T x y z ≠ 0 → + poolCode pool (poolEnumeration pool k counts) px lx ax x = + poolCode pool (poolEnumeration pool k counts) py ly ay y := by + intro x y z h + exact poolCode_agree pool _ px py lx ly ax ay x y + (prefixes x y z h) (labels x y z h) + exact finite_grid_separation_mem_restrictionOrbit T + (poolCode pool (poolEnumeration pool k counts) px lx ax) + (poolCode pool (poolEnumeration pool k counts) py ly ay) + (d := Separation.gridDimension k) (Q := Separation.gridWidth k) (m := k) + (by simpa only [Fintype.card_fin] using Separation.grid_population_bound k) + (Separation.grid_population_bound k) hagree + +omit [DecidableEq Label] in +theorem exact_pool_raw_prefix_synchronized + (pool : Prefix → Finset Label) {k : ℕ} + (enumerate : ∀ p, ↥(pool p) ≃ Fin k) + (T : Tensor ℂ X Y Z) (px : X → Prefix) (py : Y → Prefix) (pz : Z → Prefix) + (lx : X → Label) (ly : Y → Label) + (ax : ∀ x, lx x ∈ pool (px x)) (_ay : ∀ y, ly y ∈ pool (py y)) + (prefixes : ∀ x y z, T x y z ≠ 0 → px x = py y ∧ px x = pz z) + (labels : ∀ x y z, T x y z ≠ 0 → lx x = ly y) + {Pairing : Type*} [DecidableEq Pairing] + (x : X × Pairing) (y : Y × Pairing) (z : Z × Fin k) + (h : separatedTensor (poolCode pool enumerate px lx ax) T x y z ≠ 0) : + (px x.1, lx x.1) = (py y.1, ly y.1) ∧ + (px x.1, lx x.1) = (pz z.1, ((enumerate (pz z.1)).symm z.2).val) := by + have guard : poolCode pool enumerate px lx ax x.1 = z.2 ∧ x.2 = y.2 := by + by_contra hn + exact h (by simp [separatedTensor, hn]) + have hT : T x.1 y.1 z.1 ≠ 0 := by + simpa [separatedTensor, guard] using h + obtain ⟨hxy, hxz⟩ := prefixes x.1 y.1 z.1 hT + have hz : lx x.1 = ((enumerate (pz z.1)).symm z.2).val := by + rw [← hxz, ← guard.1] + exact (poolCode_decode pool enumerate px lx ax x.1).symm + exact ⟨Prod.ext hxy (labels x.1 y.1 z.1 hT), Prod.ext hxz hz⟩ + +omit [DecidableEq Label] in +theorem exact_pool_rankAtMost + (pool : Prefix → Finset Label) (k : ℕ) (counts : ∀ p, (pool p).card = k) + (T : Tensor ℂ X Y Z) (px : X → Prefix) (py : Y → Prefix) + (lx : X → Label) (ly : Y → Label) + (ax : ∀ x, lx x ∈ pool (px x)) (ay : ∀ y, ly y ∈ pool (py y)) + {r : ℕ} (hT : Tensor.RankAtMost T r) + (prefixes : ∀ x y z, T x y z ≠ 0 → px x = py y) + (labels : ∀ x y z, T x y z ≠ 0 → lx x = ly y) : + Tensor.RankAtMost + (separatedTensor (U := Fin k) + (poolCode pool (poolEnumeration pool k counts) px lx ax) T) + (r * poolAuxiliaryCost k) := by + classical + by_cases hk : k = 1 + · subst k + have hcost : poolAuxiliaryCost 1 = 1 := by simp [poolAuxiliaryCost] + rw [hcost, mul_one, deterministic_separation_identity] + exact hT.pullback (fun x : X × Fin 1 => x.1) + (fun y : Y × Fin 1 => y.1) (fun z : Z × Fin 1 => z.1) + · have hagree : ∀ x y z, T x y z ≠ 0 → + poolCode pool (poolEnumeration pool k counts) px lx ax x = + poolCode pool (poolEnumeration pool k counts) py ly ay y := by + intro x y z h + exact poolCode_agree pool _ px py lx ly ax ay x y + (prefixes x y z h) (labels x y z h) + have hr := finite_grid_separation_rankAtMost T + (poolCode pool (poolEnumeration pool k counts) px lx ax) + (poolCode pool (poolEnumeration pool k counts) py ly ay) + (d := Separation.gridDimension k) (Q := Separation.gridWidth k) (m := k) + (lt_of_lt_of_le (by decide : 0 < 2) (Separation.gridWidth_ge_two k)) + (by simpa only [Fintype.card_fin] using Separation.grid_population_bound k) + (Separation.grid_population_bound k) hT hagree + simpa only [poolAuxiliaryCost, ite_eq_right hk, Separation.gridGroupOrder] using hr + +omit [DecidableEq Label] in +theorem exact_pool_borderRankAtMost + [Fintype X] [Fintype Y] [Fintype Z] + (pool : Prefix → Finset Label) (k : ℕ) (counts : ∀ p, (pool p).card = k) + (T : Tensor ℂ X Y Z) (px : X → Prefix) (py : Y → Prefix) + (lx : X → Label) (ly : Y → Label) + (ax : ∀ x, lx x ∈ pool (px x)) (ay : ∀ y, ly y ∈ pool (py y)) + {r : ℕ} (hT : Tensor.BorderRankAtMost T r) + (prefixes : ∀ x y z, T x y z ≠ 0 → px x = py y) + (labels : ∀ x y z, T x y z ≠ 0 → lx x = ly y) : + Tensor.BorderRankAtMost + (separatedTensor (U := Fin k) + (poolCode pool (poolEnumeration pool k counts) px lx ax) T) + (r * poolAuxiliaryCost k) := by + classical + by_cases hk : k = 1 + · subst k + have hcost : poolAuxiliaryCost 1 = 1 := by simp [poolAuxiliaryCost] + rw [hcost, mul_one, deterministic_separation_identity] + rw [Tensor.pullback_eq_restrict (fun x : X × Fin 1 => x.1) + (fun y : Y × Fin 1 => y.1) (fun z : Z × Fin 1 => z.1) T] + exact hT.restrict (fun (x : X × Fin 1) (original : X) => + if original = x.1 then 1 else 0) + (fun (y : Y × Fin 1) (original : Y) => if original = y.1 then 1 else 0) + (fun (z : Z × Fin 1) (original : Z) => if original = z.1 then 1 else 0) + · have hagree : ∀ x y z, T x y z ≠ 0 → + poolCode pool (poolEnumeration pool k counts) px lx ax x = + poolCode pool (poolEnumeration pool k counts) py ly ay y := by + intro x y z h + exact poolCode_agree pool _ px py lx ly ax ay x y + (prefixes x y z h) (labels x y z h) + have hr := finite_grid_separation_borderRankAtMost T + (poolCode pool (poolEnumeration pool k counts) px lx ax) + (poolCode pool (poolEnumeration pool k counts) py ly ay) + (d := Separation.gridDimension k) (Q := Separation.gridWidth k) (m := k) + (lt_of_lt_of_le (by decide : 0 < 2) (Separation.gridWidth_ge_two k)) + (by simpa only [Fintype.card_fin] using Separation.grid_population_bound k) + (Separation.grid_population_bound k) hT hagree + simpa only [poolAuxiliaryCost, ite_eq_right hk, Separation.gridGroupOrder] using hr + +omit [DecidableEq Label] in +theorem exact_pool_optimized_pullback + (pool : Prefix → Finset Label) (k : ℕ) (counts : ∀ p, (pool p).card = k) + (T : Tensor ℂ X Y Z) (px : X → Prefix) (py : Y → Prefix) + (lx : X → Label) (ly : Y → Label) + (ax : ∀ x, lx x ∈ pool (px x)) (ay : ∀ y, ly y ∈ pool (py y)) + (prefixes : ∀ x y z, T x y z ≠ 0 → px x = py y) + (labels : ∀ x y z, T x y z ≠ 0 → lx x = ly y) : + ∃ (fx : X × Fin k → PoolAuxiliaryGroup k) + (fy : Y × Fin k → PoolAuxiliaryGroup k) + (fz : Z × Fin k → PoolAuxiliaryGroup k), + Tensor.pullback (fun x => (x.1, fx x)) (fun y => (y.1, fy y)) + (fun z => (z.1, fz z)) (Tensor.product T (poolAuxiliaryTensor k)) = + separatedTensor + (poolCode pool (poolEnumeration pool k counts) px lx ax) T := by + classical + by_cases hk : k = 1 + · subst k + refine ⟨fun _ => 0, fun _ => 0, fun _ => 0, ?_⟩ + funext x y z + simp [Tensor.pullback, Tensor.product, poolAuxiliaryTensor, Tensor.rankOne, + separatedTensor, Subsingleton.elim x.2 y.2, + Subsingleton.elim (poolCode pool (poolEnumeration pool 1 counts) px lx ax x.1) z.2] + · obtain ⟨tag, point, collision⟩ := Separation.exists_modular_separation + (Separation.grid_population_bound k) (Separation.grid_population_bound k) + have hagree : ∀ x y z, T x y z ≠ 0 → + poolCode pool (poolEnumeration pool k counts) px lx ax x = + poolCode pool (poolEnumeration pool k counts) py ly ay y := by + intro x y z h + exact poolCode_agree pool _ px py lx ly ax ay x y + (prefixes x y z h) (labels x y z h) + refine ⟨fun x => point + (poolCode pool (poolEnumeration pool k counts) px lx ax x.1) x.2, + fun y => tag (poolCode pool (poolEnumeration pool k counts) py ly ay y.1) - + point (poolCode pool (poolEnumeration pool k counts) py ly ay y.1) y.2, + fun z => tag z.2, ?_⟩ + simpa only [poolAuxiliaryTensor, ite_eq_right hk] using finite_separation_identity T + (poolCode pool (poolEnumeration pool k counts) px lx ax) + (poolCode pool (poolEnumeration pool k counts) py ly ay) tag point hagree collision + +omit [DecidableEq Label] in +theorem exact_pool_optimized_mem_restrictionOrbit + [Fintype X] [Fintype Y] [Fintype Z] + (pool : Prefix → Finset Label) (k : ℕ) (counts : ∀ p, (pool p).card = k) + (T : Tensor ℂ X Y Z) (px : X → Prefix) (py : Y → Prefix) + (lx : X → Label) (ly : Y → Label) + (ax : ∀ x, lx x ∈ pool (px x)) (ay : ∀ y, ly y ∈ pool (py y)) + (prefixes : ∀ x y z, T x y z ≠ 0 → px x = py y) + (labels : ∀ x y z, T x y z ≠ 0 → lx x = ly y) : + separatedTensor (U := Fin k) + (poolCode pool (poolEnumeration pool k counts) px lx ax) T ∈ + Tensor.restrictionOrbit (Tensor.product T (poolAuxiliaryTensor k)) := by + classical + obtain ⟨fx, fy, fz, heq⟩ := + exact_pool_optimized_pullback pool k counts T px py lx ly ax ay prefixes labels + rw [← heq] + exact ⟨_, _, _, Tensor.pullback_eq_restrict _ _ _ _⟩ + +end ExactPools + +section SharedBranches + +variable {K X Y Z A B C A' B' C' Label : Type*} +variable [CommSemiring K] [Fintype X] [Fintype Y] [Fintype Z] +variable [Fintype A] [Fintype B] [Fintype C] [Fintype Label] + +theorem shared_branch_rankAtMost + (lx : X → Label) (ly : Y → Label) (lz : Z → Label) + (MX : Label → X → A' → A → K) (MY : Label → Y → B' → B → K) + (MZ : Label → Z → C' → C → K) + (T : Tensor K (X × A) (Y × B) (Z × C)) {r : ℕ} + (hT : Tensor.RankAtMost T r) + (synchronized : LocalMaps.SupportedOn (LocalMaps.Synchronized lx ly lz) T) : + Tensor.RankAtMost + (fun x y z => ∑ label, + LocalMaps.fiberTransform (MX label) (MY label) (MZ label) + (LocalMaps.originalMask (LocalMaps.InBranch lx ly lz label) T) x y z) + r := by + classical + rw [← LocalMaps.controlled_eq_sum_branches_of_supported + lx ly lz MX MY MZ T synchronized] + rw [LocalMaps.fiberTransform_eq_restrict] + exact hT.restrict _ _ _ + +end SharedBranches + +section FiniteAssembly + +universe u + +variable {K : Type*} [CommSemiring K] +variable {X Y Z A B C : ℕ → Type*} + +def AuxiliaryCoordinates (A : ℕ → Type u) : ℕ → Type u + | 0 => PUnit + | n + 1 => AuxiliaryCoordinates A n × A n + +instance auxiliaryCoordinatesFintype [∀ n, Fintype (A n)] (n : ℕ) : + Fintype (AuxiliaryCoordinates A n) := by + induction n with + | zero => exact inferInstanceAs (Fintype PUnit) + | succ n ih => + letI : Fintype (AuxiliaryCoordinates A n) := ih + exact inferInstanceAs (Fintype (AuxiliaryCoordinates A n × A n)) + +def auxiliaryTensor (E : ∀ n, Tensor K (A n) (B n) (C n)) : + ∀ n, Tensor K (AuxiliaryCoordinates A n) + (AuxiliaryCoordinates B n) (AuxiliaryCoordinates C n) + | 0 => fun _ _ _ => 1 + | n + 1 => Tensor.product (auxiliaryTensor E n) (E n) + +def sourceCoordinate (step : ∀ n, X (n + 1) → X n × A n) : + ∀ n, X n → X 0 + | 0 => id + | n + 1 => fun x => sourceCoordinate step n (step n x).1 + +def auxiliaryCoordinate (step : ∀ n, X (n + 1) → X n × A n) : + ∀ n, X n → AuxiliaryCoordinates A n + | 0 => fun _ => PUnit.unit + | n + 1 => fun x => (auxiliaryCoordinate step n (step n x).1, (step n x).2) + +def stageTensor (T : Tensor K (X 0) (Y 0) (Z 0)) + (E : ∀ n, Tensor K (A n) (B n) (C n)) + (fx : ∀ n, X (n + 1) → X n × A n) + (fy : ∀ n, Y (n + 1) → Y n × B n) + (fz : ∀ n, Z (n + 1) → Z n × C n) : + ∀ n, Tensor K (X n) (Y n) (Z n) + | 0 => T + | n + 1 => Tensor.pullback (fx n) (fy n) (fz n) + (Tensor.product (stageTensor T E fx fy fz n) (E n)) + +theorem stageTensor_eq_shared_bank + (T : Tensor K (X 0) (Y 0) (Z 0)) + (E : ∀ n, Tensor K (A n) (B n) (C n)) + (fx : ∀ n, X (n + 1) → X n × A n) + (fy : ∀ n, Y (n + 1) → Y n × B n) + (fz : ∀ n, Z (n + 1) → Z n × C n) (n : ℕ) : + stageTensor T E fx fy fz n = + Tensor.pullback + (fun x => (sourceCoordinate fx n x, auxiliaryCoordinate fx n x)) + (fun y => (sourceCoordinate fy n y, auxiliaryCoordinate fy n y)) + (fun z => (sourceCoordinate fz n z, auxiliaryCoordinate fz n z)) + (Tensor.product T (auxiliaryTensor E n)) := by + induction n with + | zero => + funext x y z + simp [stageTensor, Tensor.pullback, Tensor.product, sourceCoordinate, + auxiliaryTensor] + | succ n ih => + funext x y z + simp only [stageTensor, Tensor.pullback, Tensor.product] + rw [ih] + simp only [Tensor.pullback, Tensor.product, sourceCoordinate, + auxiliaryCoordinate, auxiliaryTensor, mul_assoc] + +theorem auxiliaryTensor_rankAtMost + (E : ∀ n, Tensor K (A n) (B n) (C n)) (r : ℕ → ℕ) + (hE : ∀ n, Tensor.RankAtMost (E n) (r n)) (n : ℕ) : + Tensor.RankAtMost (auxiliaryTensor E n) (∏ j ∈ Finset.range n, r j) := by + induction n with + | zero => + rw [Finset.prod_range_zero] + refine ⟨fun _ _ => 1, fun _ _ => 1, fun _ _ => 1, ?_⟩ + funext x y z + simp [auxiliaryTensor, Tensor.rankOne] + | succ n ih => + change Tensor.RankAtMost (Tensor.product (auxiliaryTensor E n) (E n)) _ + rw [Finset.prod_range_succ] + exact ih.product (hE n) + +theorem stageTensor_rankAtMost + (T : Tensor K (X 0) (Y 0) (Z 0)) {rT : ℕ} + (hT : Tensor.RankAtMost T rT) + (E : ∀ n, Tensor K (A n) (B n) (C n)) (r : ℕ → ℕ) + (hE : ∀ n, Tensor.RankAtMost (E n) (r n)) + (fx : ∀ n, X (n + 1) → X n × A n) + (fy : ∀ n, Y (n + 1) → Y n × B n) + (fz : ∀ n, Z (n + 1) → Z n × C n) (n : ℕ) : + Tensor.RankAtMost (stageTensor T E fx fy fz n) + (rT * ∏ j ∈ Finset.range n, r j) := by + rw [stageTensor_eq_shared_bank] + exact (hT.product (auxiliaryTensor_rankAtMost E r hE n)).pullback _ _ _ + +theorem stageTensor_borderRankAtMost + [∀ n, Fintype (X n)] [∀ n, Fintype (Y n)] [∀ n, Fintype (Z n)] + [∀ n, Fintype (A n)] [∀ n, Fintype (B n)] [∀ n, Fintype (C n)] + (T : Tensor ℂ (X 0) (Y 0) (Z 0)) {rT : ℕ} + (hT : Tensor.BorderRankAtMost T rT) + (E : ∀ n, Tensor ℂ (A n) (B n) (C n)) (r : ℕ → ℕ) + (hE : ∀ n, Tensor.RankAtMost (E n) (r n)) + (fx : ∀ n, X (n + 1) → X n × A n) + (fy : ∀ n, Y (n + 1) → Y n × B n) + (fz : ∀ n, Z (n + 1) → Z n × C n) (n : ℕ) : + Tensor.BorderRankAtMost (stageTensor T E fx fy fz n) + (rT * ∏ j ∈ Finset.range n, r j) := by + classical + rw [stageTensor_eq_shared_bank, Tensor.pullback_eq_restrict] + exact (hT.product (auxiliaryTensor_rankAtMost E r hE n).borderRankAtMost).restrict _ _ _ + +end FiniteAssembly + +end LabelHierarchySeparation +end MatrixMultiplication.Foundation + +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/Extraction/ComplexRationalTypes.lean b/lean/OAI/LinearAlgebra/MatrixFields/Extraction/ComplexRationalTypes.lean new file mode 100644 index 0000000000000000000000000000000000000000..6d6d7daf1a97f1f7821fcef1bcf7f3ba3eee32d4 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/Extraction/ComplexRationalTypes.lean @@ -0,0 +1,354 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Entropy.ZeroLeafRateFormula + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +namespace MatrixMultiplication.Foundation +namespace FiniteControl + +open scoped BigOperators + +theorem every_path_safe {State : Type*} (Safe : ℕ → State → Prop) + (Allows : ℕ → State → State → Prop) (n : ℕ) (path : ℕ → State) + (initial : Safe 0 (path 0)) + (closed : ∀ t < n, ∀ s s', Safe t s → Allows t s s' → Safe (t + 1) s') + (steps : ∀ t < n, Allows t (path t) (path (t + 1))) : + ∀ t ≤ n, Safe t (path t) := by + intro t + induction t with + | zero => intro _; exact initial + | succ t ih => + intro ht + have htn : t < n := Nat.lt_of_succ_le ht + exact closed t htn (path t) (path (t + 1)) + (ih (Nat.le_of_lt htn)) (steps t htn) + +theorem exists_population_preserving_equiv {I J Node : Type*} + [Fintype I] [Fintype J] [DecidableEq Node] + (f : I → Node) (g : J → Node) + (counts : ∀ node, Fintype.card {i // f i = node} = + Fintype.card {j // g j = node}) : + ∃ e : I ≃ J, ∀ i, g (e i) = f i := by + classical + let ef : ∀ node, {i // f i = node} ≃ {j // g j = node} := + fun node => Fintype.equivOfCardEq (counts node) + refine ⟨(Equiv.sigmaFiberEquiv f).symm.trans + ((Equiv.sigmaCongrRight ef).trans (Equiv.sigmaFiberEquiv g)), ?_⟩ + intro i + exact (ef (f i) ⟨i, rfl⟩).property + +theorem population_product_eq {I J Node M : Type*} + [Fintype I] [Fintype J] [DecidableEq Node] [CommMonoid M] + (f : I → Node) (g : J → Node) + (counts : ∀ node, Fintype.card {i // f i = node} = + Fintype.card {j // g j = node}) (cost : Node → M) : + (∏ i, cost (f i)) = ∏ j, cost (g j) := by + obtain ⟨e, he⟩ := exists_population_preserving_equiv f g counts + calc + (∏ i, cost (f i)) = ∏ i, cost (g (e i)) := by + apply Finset.prod_congr rfl + intro i _ + rw [he i] + _ = ∏ j, cost (g j) := e.prod_comp (fun j => cost (g j)) + +theorem exists_common_bank_multiple {Node : Type*} [Fintype Node] + (denominator blockSize : Node → ℕ) + (denominator_pos : ∀ node, 0 < denominator node) + (blockSize_pos : ∀ node, 0 < blockSize node) : + ∃ bank : ℕ, 0 < bank ∧ + ∀ node, denominator node * blockSize node ∣ bank := by + classical + refine ⟨∏ node, denominator node * blockSize node, ?_, ?_⟩ + · exact Finset.prod_pos fun node _ => + Nat.mul_pos (denominator_pos node) (blockSize_pos node) + · intro node + exact Finset.dvd_prod_of_mem (fun node => denominator node * blockSize node) + (Finset.mem_univ node) + +theorem exists_exact_rational_tiling {Node : Type*} [Fintype Node] + (weight : Node → ℚ) (nonnegative : ∀ node, 0 ≤ weight node) + (blockSize : Node → ℕ) (blockSize_pos : ∀ node, 0 < blockSize node) : + ∃ bank : ℕ, 0 < bank ∧ ∀ node, ∃ copies : ℕ, + (bank : ℚ) * weight node = (copies * blockSize node : ℕ) := by + obtain ⟨bank, bank_pos, divisible⟩ := exists_common_bank_multiple + (fun node => (weight node).den) blockSize + (fun node => (weight node).den_pos) blockSize_pos + refine ⟨bank, bank_pos, ?_⟩ + intro node + obtain ⟨multiple, hmultiple⟩ := divisible node + refine ⟨multiple * (weight node).num.toNat, ?_⟩ + have hnum : ((weight node).num.toNat : ℚ) = ((weight node).num : ℚ) := by + exact_mod_cast Int.toNat_of_nonneg (Rat.num_nonneg.mpr (nonnegative node)) + have hden : ((weight node).den : ℚ) ≠ 0 := by + exact_mod_cast (weight node).den_ne_zero + calc + (bank : ℚ) * weight node = + (bank : ℚ) * (((weight node).num : ℚ) / ((weight node).den : ℚ)) := by + rw [(weight node).num_div_den] + _ = ((multiple * (weight node).num.toNat) * blockSize node : ℕ) := by + rw [hmultiple] + push_cast + rw [hnum] + field_simp [hden] + +theorem target_relation_of_windows (a b c : ℤ) (x y z d : ℝ) + (hd : 0 < d) (tight : x + y + z = 0) + (hx : |x - (a : ℝ) * d| ≤ d / 10) + (hy : |y - (b : ℝ) * d| ≤ d / 10) + (hz : |z + 2 * (c : ℝ) * d| ≤ d / 10) : + a + b = c + c := by + obtain ⟨hx₀, hx₁⟩ := abs_le.mp hx + obtain ⟨hy₀, hy₁⟩ := abs_le.mp hy + obtain ⟨hz₀, hz₁⟩ := abs_le.mp hz + let k : ℤ := a + b - 2 * c + have hkcast : (k : ℝ) = (a : ℝ) + (b : ℝ) - 2 * (c : ℝ) := by + simp [k] + have hlow : -(1 : ℝ) < (k : ℝ) := by + by_contra hn + have hn' : (k : ℝ) ≤ -1 := le_of_not_gt hn + have hm := mul_le_mul_of_nonneg_right hn' (le_of_lt hd) + rw [hkcast] at hm + nlinarith + have hhigh : (k : ℝ) < 1 := by + by_contra hn + have hn' : 1 ≤ (k : ℝ) := le_of_not_gt hn + have hm := mul_le_mul_of_nonneg_right hn' (le_of_lt hd) + rw [hkcast] at hm + nlinarith + have hsmall : |(k : ℝ)| < 1 := abs_lt.mpr ⟨hlow, hhigh⟩ + have hsmallInt : |k| < 1 := by exact_mod_cast hsmall + have hk : k = 0 := Int.abs_lt_one_iff.mp hsmallInt + dsimp [k] at hk + linarith + +theorem synchronized_targets_of_windows (targets : Set ℤ) + (free : ThreeAPFree targets) (a b c : ℤ) + (ha : a ∈ targets) (hb : b ∈ targets) (hc : c ∈ targets) + (x y z d : ℝ) (hd : 0 < d) (tight : x + y + z = 0) + (hx : |x - (a : ℝ) * d| ≤ d / 10) + (hy : |y - (b : ℝ) * d| ≤ d / 10) + (hz : |z + 2 * (c : ℝ) * d| ≤ d / 10) : + a = b ∧ a = c := by + have hrelation := target_relation_of_windows a b c x y z d hd tight hx hy hz + have hac : a = c := free ha hc hb hrelation + exact ⟨by linarith, hac⟩ + +end FiniteControl +end MatrixMultiplication.Foundation + +namespace MatrixMultiplication.Foundation + +open scoped BigOperators + +structure RationalLaw (A : Type*) [Fintype A] where + mass : A → ℚ + nonneg : ∀ a, 0 ≤ mass a + total : ∑ a, mass a = 1 + +namespace RationalLaw + +variable {A B : Type*} [Fintype A] [Fintype B] + +def toFiniteLaw (p : RationalLaw A) : FiniteLaw A where + mass a := p.mass a + nonneg a := by exact_mod_cast p.nonneg a + total := by exact_mod_cast p.total + +@[simp] theorem toFiniteLaw_mass (p : RationalLaw A) (a : A) : + p.toFiniteLaw.mass a = (p.mass a : ℝ) := rfl + +theorem exists_exact_counts (p : RationalLaw A) : + ∃ D : ℕ, 0 < D ∧ ∃ counts : A → ℕ, + (∑ a, counts a) = D ∧ + ∀ a, (counts a : ℚ) = (D : ℚ) * p.mass a := by + classical + obtain ⟨D, hD, hcopies⟩ := FiniteControl.exists_exact_rational_tiling + p.mass p.nonneg (fun _ => 1) (fun _ => Nat.zero_lt_one) + choose counts hcounts using hcopies + have hc : ∀ a, (counts a : ℚ) = (D : ℚ) * p.mass a := by + intro a + simpa using (hcounts a).symm + refine ⟨D, hD, counts, ?_, hc⟩ + have hsum : (∑ a, (counts a : ℚ)) = (D : ℚ) := by + simp_rw [hc] + rw [← Finset.mul_sum, p.total, mul_one] + exact_mod_cast hsum + +theorem scale_exact_counts (p : RationalLaw A) (D : ℕ) (counts : A → ℕ) + (hsum : (∑ a, counts a) = D) + (hcounts : ∀ a, (counts a : ℚ) = (D : ℚ) * p.mass a) (k : ℕ) : + (∑ a, k * counts a) = k * D ∧ + ∀ a, ((k * counts a : ℕ) : ℚ) = ((k * D : ℕ) : ℚ) * p.mass a := by + constructor + · rw [← Finset.mul_sum, hsum] + · intro a + simp only [Nat.cast_mul] + rw [hcounts a] + ring + +theorem exact_counts_zero_iff (p : RationalLaw A) {D : ℕ} (hD : 0 < D) + {counts : A → ℕ} + (hcounts : ∀ a, (counts a : ℚ) = (D : ℚ) * p.mass a) (a : A) : + counts a = 0 ↔ p.mass a = 0 := by + have hDq : (D : ℚ) ≠ 0 := by exact_mod_cast (Nat.ne_of_gt hD) + constructor + · intro hzero + have hz : (D : ℚ) * p.mass a = 0 := by + rw [← hcounts a, hzero, Nat.cast_zero] + exact (mul_eq_zero.mp hz).resolve_left hDq + · intro hzero + have hz : (counts a : ℚ) = 0 := by rw [hcounts a, hzero, mul_zero] + exact_mod_cast hz + +theorem exact_counts_real_mass (p : RationalLaw A) {D : ℕ} (hD : 0 < D) + {counts : A → ℕ} + (hcounts : ∀ a, (counts a : ℚ) = (D : ℚ) * p.mass a) (a : A) : + (counts a : ℝ) / (D : ℝ) = p.toFiniteLaw.mass a := by + have hDr : (D : ℝ) ≠ 0 := by exact_mod_cast (Nat.ne_of_gt hD) + apply (div_eq_iff hDr).2 + have hc : (counts a : ℝ) = (D : ℝ) * (p.mass a : ℝ) := by + exact_mod_cast hcounts a + simpa only [toFiniteLaw_mass, mul_comm] using hc + +theorem exists_type_representation (p : RationalLaw A) : + ∃ counts : A → ℕ, 0 < ∑ a, counts a ∧ + ∀ a, (counts a : ℝ) / (∑ a, counts a : ℕ) = p.toFiniteLaw.mass a := by + obtain ⟨D, hD, counts, hsum, hcounts⟩ := p.exists_exact_counts + refine ⟨counts, by simpa only [hsum] using hD, ?_⟩ + intro a + rw [hsum] + exact p.exact_counts_real_mass hD hcounts a + +end RationalLaw + +private theorem exists_nonnegative_rat_below (x : ℝ) (hx : 0 ≤ x) + (δ : ℝ) (hδ : 0 < δ) : + ∃ r : ℚ, 0 ≤ r ∧ (r : ℝ) ≤ x ∧ (r = 0 ↔ x = 0) ∧ + |(r : ℝ) - x| < δ := by + by_cases hx0 : x = 0 + · subst x + exact ⟨0, le_rfl, by simp, by simp, by simpa using hδ⟩ + have hxpos : 0 < x := lt_of_le_of_ne hx (Ne.symm hx0) + have hlo : max 0 (x - δ) < x := max_lt hxpos (by linarith) + obtain ⟨r, hrlo, hrhi⟩ := exists_rat_btwn hlo + have hrpos : (0 : ℝ) < r := lt_of_le_of_lt (le_max_left _ _) hrlo + have hrposq : (0 : ℚ) < r := by exact_mod_cast hrpos + refine ⟨r, hrposq.le, hrhi.le, + iff_of_false (ne_of_gt hrposq) hx0, ?_⟩ + have hrlo' : x - δ < r := lt_of_le_of_lt (le_max_right _ _) hrlo + rw [abs_of_nonpos (sub_nonpos.mpr hrhi.le)] + linarith + +namespace FiniteLaw + +variable {A : Type*} [Fintype A] + +theorem exists_rational_approximation (p : FiniteLaw A) (ε : ℝ) (hε : 0 < ε) : + ∃ q : RationalLaw A, + (∀ a, q.mass a = 0 ↔ p.mass a = 0) ∧ + ∀ a, |(q.mass a : ℝ) - p.mass a| < ε := by + classical + have hpivot : ∃ a, 0 < p.mass a := by + by_contra h + have hnonpos : ∀ a, p.mass a ≤ 0 := + fun a => le_of_not_gt (fun ha => h ⟨a, ha⟩) + have hsum : (∑ a, p.mass a) ≤ 0 := + Finset.sum_nonpos (fun a _ => hnonpos a) + rw [p.total] at hsum + norm_num at hsum + obtain ⟨a₀, ha₀⟩ := hpivot + let δ : ℝ := ε / ((Fintype.card A : ℝ) + 1) + have hcard : 0 ≤ (Fintype.card A : ℝ) := Nat.cast_nonneg _ + have hden : 0 < (Fintype.card A : ℝ) + 1 := by linarith + have hδ : 0 < δ := div_pos hε hden + have hδε : δ * ((Fintype.card A : ℝ) + 1) = ε := + div_mul_cancel₀ ε (ne_of_gt hden) + have hcardδ : 0 ≤ (Fintype.card A : ℝ) * δ := mul_nonneg hcard hδ.le + have hδle : δ ≤ ε := by nlinarith + choose r hrnonneg hrle hrzero hrclose using + fun a => exists_nonnegative_rat_below (p.mass a) (p.nonneg a) δ hδ + have hsum : (∑ a, (r a : ℝ)) ≤ 1 := by + calc + (∑ a, (r a : ℝ)) ≤ ∑ a, p.mass a := + Finset.sum_le_sum (fun a _ => hrle a) + _ = 1 := p.total + have hrest : 0 ≤ 1 - ∑ a, (r a : ℝ) := sub_nonneg.mpr hsum + have hrestq : (0 : ℚ) ≤ 1 - ∑ a, r a := by exact_mod_cast hrest + have hrest_le : 1 - ∑ a, (r a : ℝ) ≤ (Fintype.card A : ℝ) * δ := by + calc + 1 - ∑ a, (r a : ℝ) = ∑ a, (p.mass a - (r a : ℝ)) := by + rw [Finset.sum_sub_distrib, p.total] + _ ≤ ∑ _a : A, δ := by + apply Finset.sum_le_sum + intro a _ + have h := (abs_lt.mp (hrclose a)).1 + linarith + _ = (Fintype.card A : ℝ) * δ := by simp + let q : RationalLaw A := + { mass := fun a => r a + if a = a₀ then 1 - ∑ b, r b else 0 + nonneg := by + intro a + apply add_nonneg (hrnonneg a) + split_ifs + · exact hrestq + · exact le_rfl + total := by + rw [Finset.sum_add_distrib] + simp only [Finset.sum_ite_eq', Finset.mem_univ, ite_true] + ring } + refine ⟨q, ?_, ?_⟩ + · intro a + by_cases ha : a = a₀ + · subst a + have hrpos : 0 < r a₀ := + lt_of_le_of_ne (hrnonneg a₀) (Ne.symm (fun hz => (ne_of_gt ha₀) ((hrzero a₀).mp hz))) + have hqpos : 0 < q.mass a₀ := by + dsimp [q] + simp only [ite_true] + linarith + exact iff_of_false (ne_of_gt hqpos) (ne_of_gt ha₀) + · simpa only [q, ite_eq_right ha, add_zero] using hrzero a + · intro a + by_cases ha : a = a₀ + · have hqcast : (q.mass a : ℝ) = + (r a : ℝ) + (1 - ∑ b, (r b : ℝ)) := by + simp [q, ha] + rw [hqcast] + have habs : |(r a : ℝ) + (1 - ∑ b, (r b : ℝ)) - p.mass a| ≤ + |(r a : ℝ) - p.mass a| + (1 - ∑ b, (r b : ℝ)) := by + calc + _ = |((r a : ℝ) - p.mass a) + (1 - ∑ b, (r b : ℝ))| := by + congr 1 + ring + _ ≤ |(r a : ℝ) - p.mass a| + |1 - ∑ b, (r b : ℝ)| := abs_add_le _ _ + _ = _ := by rw [abs_of_nonneg hrest] + have hclose := hrclose a + nlinarith + · simpa only [q, ite_eq_right ha, add_zero] using + lt_of_lt_of_le (hrclose a) hδle + +theorem exists_exact_type_approximation (p : FiniteLaw A) (ε : ℝ) (hε : 0 < ε) : + ∃ D : ℕ, 0 < D ∧ ∃ counts : A → ℕ, + (∑ a, counts a) = D ∧ + (∀ a, counts a = 0 ↔ p.mass a = 0) ∧ + ∀ a, |(counts a : ℝ) / (D : ℝ) - p.mass a| < ε := by + obtain ⟨q, hsupport, hclose⟩ := p.exists_rational_approximation ε hε + obtain ⟨D, hD, counts, hsum, hcounts⟩ := q.exists_exact_counts + refine ⟨D, hD, counts, hsum, ?_, ?_⟩ + · intro a + exact (q.exact_counts_zero_iff hD hcounts a).trans (hsupport a) + · intro a + rw [q.exact_counts_real_mass hD hcounts a, RationalLaw.toFiniteLaw_mass] + exact hclose a + +end FiniteLaw + +end MatrixMultiplication.Foundation + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/Extraction/ConditionalLabels.lean b/lean/OAI/LinearAlgebra/MatrixFields/Extraction/ConditionalLabels.lean new file mode 100644 index 0000000000000000000000000000000000000000..c11149b27df4068a3d891c99755000364e50a46c --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/Extraction/ConditionalLabels.lean @@ -0,0 +1,562 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Entropy.ZeroLeafRates + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section + +namespace MatrixMultiplication.Foundation.StageHierarchyResources + +open Filter HierarchySeparationRates LabelHierarchyCounts +open scoped BigOperators Topology + +universe u v + +local instance (priority := low) {B : Type*} : DecidableEq B := Classical.decEq B + +variable {A : Type u} [Fintype A] {Label : ℕ → Type v} + [∀ n, Fintype (Label n)] + +def stageRefinementCount (counts : A → ℕ) (labels : ∀ n, A → Label n) + (n t : ℕ) : ℕ := + refinementCount (sourcePrefixCounts (fun a => t * counts a) labels) n + +def stageNodeCounts (counts : A → ℕ) (labels : ∀ n, A → Label n) (n : ℕ) + (r : LabelRecord Label n) (s : Label n) : ℕ := + sourcePrefixCounts counts labels (n + 1) (r, s) + +theorem stageRefinementCount_eq_nodeProduct (counts : A → ℕ) + (labels : ∀ n, A → Label n) (n t : ℕ) : + stageRefinementCount counts labels n t = pairingProduct (stageNodeCounts counts labels n) t := by + unfold stageRefinementCount refinementCount pairingProduct + apply Finset.prod_congr rfl + intro r hr + change Nat.multinomial Finset.univ + (fun s : Label n => sourcePrefixCounts (fun a => t * counts a) labels (n + 1) (r, s)) = + Nat.multinomial Finset.univ + (fun s : Label n => t * sourcePrefixCounts counts labels (n + 1) (r, s)) + apply Nat.multinomial_congr + intro s hs + exact sourcePrefixCounts_mul counts labels t (n + 1) (r, s) + +theorem stageRefinementCount_eq_sourcePoolProduct (counts : A → ℕ) + (labels : ∀ n, A → Label n) (depth : ℕ) (n : Fin depth) (t : ℕ) : + stageRefinementCount counts labels n.val t = + ∏ r : LabelRecord Label n.val, + poolTypeCount (sourcePoolCounts counts labels depth) ⟨n, r⟩ t := + stageRefinementCount_eq_nodeProduct counts labels n.val t + +theorem stageRefinementCount_pos (counts : A → ℕ) (labels : ∀ n, A → Label n) + (n t : ℕ) : 0 < stageRefinementCount counts labels n t := by + unfold stageRefinementCount refinementCount + exact Finset.prod_pos (fun r _ => Nat.multinomial_pos _ _) + +theorem stageConditionalWords_card {Position : Type*} [Fintype Position] + (counts : A → ℕ) (labels : ∀ n, A → Label n) (n t : ℕ) + (w : Position → LabelRecord Label n) + (hword : ∀ r, wordPopulation w r = sourcePrefixCounts (fun a => t * counts a) labels n r) : + Fintype.card (ConditionalWords w + (fun r s => sourcePrefixCounts (fun a => t * counts a) labels (n + 1) (r, s))) = + stageRefinementCount counts labels n t := by + exact conditionalWords_card w + (fun r s => sourcePrefixCounts (fun a => t * counts a) labels (n + 1) (r, s)) + (fun r => (hword r).trans + (sourcePrefixCounts_compatible (fun a => t * counts a) labels n r)) + +theorem stageConditionalPool_card {Position : Type*} [Fintype Position] + (counts : A → ℕ) (labels : ∀ n, A → Label n) (n t : ℕ) + (w : Position → LabelRecord Label n) + (hword : ∀ r, wordPopulation w r = sourcePrefixCounts (fun a => t * counts a) labels n r) : + (Finset.univ.filter (fun fine : Position → Label n => + ∀ r s, Fintype.card {i // w i = r ∧ fine i = s} = + sourcePrefixCounts (fun a => t * counts a) labels (n + 1) (r, s))).card = + stageRefinementCount counts labels n t := by + simpa only [ConditionalWords, Fintype.card_subtype] using + stageConditionalWords_card counts labels n t w hword + +theorem stageConditionalWords_nonempty {Position : Type*} [Fintype Position] + (counts : A → ℕ) (labels : ∀ n, A → Label n) (n t : ℕ) + (w : Position → LabelRecord Label n) + (hword : ∀ r, wordPopulation w r = sourcePrefixCounts (fun a => t * counts a) labels n r) : + Nonempty (ConditionalWords w + (fun r s => sourcePrefixCounts (fun a => t * counts a) labels (n + 1) (r, s))) := by + apply Fintype.card_pos_iff.mp + rw [stageConditionalWords_card counts labels n t w hword] + exact stageRefinementCount_pos counts labels n t + +def stageEntropyRate (counts : A → ℕ) (labels : ∀ n, A → Label n) (n : ℕ) : ℝ := + poolEntropyTotal (stageNodeCounts counts labels n) + +theorem stageEntropyRate_nonneg (counts : A → ℕ) (labels : ∀ n, A → Label n) + (n : ℕ) : 0 ≤ stageEntropyRate counts labels n := by + exact Finset.sum_nonneg (fun r _ => populationEntropyRate_nonneg + (stageNodeCounts counts labels n r)) + +theorem tendsto_log_stageRefinementCount_div (counts : A → ℕ) + (labels : ∀ n, A → Label n) (n : ℕ) : + Tendsto (fun t : ℕ => Real.log (stageRefinementCount counts labels n t : ℝ) / (t : ℝ)) + atTop (𝓝 (stageEntropyRate counts labels n)) := by + simpa only [stageRefinementCount_eq_nodeProduct, stageEntropyRate] using + tendsto_log_pairingProduct_div (stageNodeCounts counts labels n) + +def stageCost (counts : A → ℕ) (labels : ∀ n, A → Label n) (n t : ℕ) : ℕ := + LabelHierarchySeparation.poolAuxiliaryCost (stageRefinementCount counts labels n t) + +theorem tendsto_log_stageCost_div (counts : A → ℕ) + (labels : ∀ n, A → Label n) (n : ℕ) : + Tendsto (fun t : ℕ => Real.log (stageCost counts labels n t : ℝ) / (t : ℝ)) + atTop (𝓝 (stageEntropyRate counts labels n)) := + LabelHierarchySeparation.tendsto_log_poolAuxiliaryCost_div_nat + (stageRefinementCount_pos counts labels n) (stageEntropyRate_nonneg counts labels n) + (tendsto_log_stageRefinementCount_div counts labels n) + +def stagePairingProduct (counts : A → ℕ) (labels : ∀ n, A → Label n) + (depth t : ℕ) : ℕ := + ∏ n : Fin depth, stageRefinementCount counts labels n.val t + +def stageAuxiliaryBudget (counts : A → ℕ) (labels : ∀ n, A → Label n) + (depth t : ℕ) : ℕ := + ∏ n : Fin depth, stageCost counts labels n.val t + +theorem stagePairingProduct_succ (counts : A → ℕ) (labels : ∀ n, A → Label n) + (n t : ℕ) : + stagePairingProduct counts labels (n + 1) t = + stagePairingProduct counts labels n t * stageRefinementCount counts labels n t := by + exact Fin.prod_univ_castSucc + (fun i : Fin (n + 1) => stageRefinementCount counts labels i.val t) + +theorem stageAuxiliaryBudget_succ (counts : A → ℕ) (labels : ∀ n, A → Label n) + (n t : ℕ) : + stageAuxiliaryBudget counts labels (n + 1) t = + stageAuxiliaryBudget counts labels n t * stageCost counts labels n t := by + exact Fin.prod_univ_castSucc + (fun i : Fin (n + 1) => stageCost counts labels i.val t) + +theorem stagePairingProduct_eq_exactWords_card (counts : A → ℕ) + (labels : ∀ n, A → Label n) (depth : ℕ) + (hinjective : Function.Injective (labelRecordOf labels depth)) (t : ℕ) : + stagePairingProduct counts labels depth t = + Fintype.card (ExactWords (fun a => t * counts a)) := by + unfold stagePairingProduct stageRefinementCount + rw [Fin.prod_univ_eq_prod_range] + exact source_refinementCount_product_eq_exactWords_card + (fun a => t * counts a) labels depth hinjective + +theorem stagePairingProduct_le_budget (counts : A → ℕ) + (labels : ∀ n, A → Label n) (depth t : ℕ) : + stagePairingProduct counts labels depth t ≤ stageAuxiliaryBudget counts labels depth t := by + exact Finset.prod_le_prod (fun n _ => + LabelHierarchySeparation.population_le_poolAuxiliaryCost + (stageRefinementCount counts labels n.val t)) + +theorem stageAuxiliaryBudget_pos (counts : A → ℕ) + (labels : ∀ n, A → Label n) (depth t : ℕ) : + 0 < stageAuxiliaryBudget counts labels depth t := by + exact Finset.prod_pos (fun n _ => LabelHierarchySeparation.poolAuxiliaryCost_pos + (stageRefinementCount counts labels n.val t)) + +abbrev StageAuxiliaryCoordinates (counts : A → ℕ) (labels : ∀ n, A → Label n) + (depth t : ℕ) := + ∀ n : Fin depth, + LabelHierarchySeparation.PoolAuxiliaryGroup (stageRefinementCount counts labels n.val t) + +local instance stageHierarchyAuxiliaryModulusNeZero (population : ℕ) : + NeZero (4 * Separation.gridWidth population) := + ⟨Nat.ne_of_gt (Nat.mul_pos (by decide) + (lt_of_lt_of_le (by decide : 0 < 2) + (Separation.gridWidth_ge_two population)))⟩ + +def stageAuxiliaryTensor (counts : A → ℕ) (labels : ∀ n, A → Label n) + (depth t : ℕ) : + Tensor ℂ (StageAuxiliaryCoordinates counts labels depth t) + (StageAuxiliaryCoordinates counts labels depth t) (StageAuxiliaryCoordinates counts labels depth t) := + LabelHierarchySeparation.bankTensor (fun n : Fin depth => + LabelHierarchySeparation.poolAuxiliaryTensor (stageRefinementCount counts labels n.val t)) + +theorem stageAuxiliaryTensor_rankAtMost (counts : A → ℕ) + (labels : ∀ n, A → Label n) (depth t : ℕ) : + Tensor.RankAtMost (stageAuxiliaryTensor counts labels depth t) + (stageAuxiliaryBudget counts labels depth t) := by + exact LabelHierarchySeparation.bankTensor_rankAtMost + (fun n : Fin depth => LabelHierarchySeparation.poolAuxiliaryTensor + (stageRefinementCount counts labels n.val t)) + (fun n => stageCost counts labels n.val t) + (fun n => LabelHierarchySeparation.poolAuxiliaryTensor_rankAtMost + (stageRefinementCount counts labels n.val t)) + +theorem stageAuxiliaryTensor_borderRankAtMost (counts : A → ℕ) + (labels : ∀ n, A → Label n) (depth t : ℕ) : + Tensor.BorderRankAtMost (stageAuxiliaryTensor counts labels depth t) + (stageAuxiliaryBudget counts labels depth t) := + (stageAuxiliaryTensor_rankAtMost counts labels depth t).borderRankAtMost + +abbrev StagePairingCoordinates (counts : A → ℕ) (labels : ∀ n, A → Label n) + (depth t : ℕ) := ∀ n : Fin depth, Fin (stageRefinementCount counts labels n.val t) + +theorem card_stagePairingCoordinates (counts : A → ℕ) + (labels : ∀ n, A → Label n) (depth t : ℕ) : + Fintype.card (StagePairingCoordinates counts labels depth t) = + stagePairingProduct counts labels depth t := by + simp only [StagePairingCoordinates, Fintype.card_pi, Fintype.card_fin, stagePairingProduct] + +theorem sum_stageEntropyRate_eq_nodeEntropyTotal (counts : A → ℕ) + (labels : ∀ n, A → Label n) (depth : ℕ) : + (∑ n : Fin depth, stageEntropyRate counts labels n.val) = + poolEntropyTotal (sourcePoolCounts counts labels depth) := by + simp only [stageEntropyRate, poolEntropyTotal, Fintype.sum_sigma] + apply Finset.sum_congr rfl + intro n hn + apply Finset.sum_congr rfl + intro r hr + rfl + +theorem sum_stageEntropyRate_eq_source (counts : A → ℕ) + (labels : ∀ n, A → Label n) (depth : ℕ) + (hinjective : Function.Injective (labelRecordOf labels depth)) : + (∑ n : Fin depth, stageEntropyRate counts labels n.val) = populationEntropyRate counts := by + rw [sum_stageEntropyRate_eq_nodeEntropyTotal] + exact source_poolEntropyTotal_eq counts labels depth hinjective + +theorem tendsto_log_stageAuxiliaryBudget_div (counts : A → ℕ) + (labels : ∀ n, A → Label n) (depth : ℕ) + (hinjective : Function.Injective (labelRecordOf labels depth)) : + Tendsto (fun t : ℕ => Real.log (stageAuxiliaryBudget counts labels depth t : ℝ) / (t : ℝ)) + atTop (𝓝 (populationEntropyRate counts)) := by + have h := Separation.tendsto_log_nat_prod_div_nat (I := Fin depth) Finset.univ + (fun n _ t => LabelHierarchySeparation.poolAuxiliaryCost_pos + (stageRefinementCount counts labels n.val t)) + (fun n _ => tendsto_log_stageCost_div counts labels n.val) + simpa only [stageAuxiliaryBudget, stageCost, + sum_stageEntropyRate_eq_source counts labels depth hinjective] using h + +theorem tendsto_log_stagePairingProduct (counts : A → ℕ) (hD : 0 < ∑ a, counts a) + (labels : ∀ n, A → Label n) (depth : ℕ) + (hinjective : Function.Injective (labelRecordOf labels depth)) : + Tendsto + (fun t : ℕ => Real.log (stagePairingProduct counts labels depth t : ℝ) / + ((t : ℝ) * (∑ a, counts a : ℕ))) + atTop (𝓝 (finiteEntropy (fun a => (counts a : ℝ) / (∑ a, counts a : ℕ)))) := by + simpa only [stagePairingProduct_eq_exactWords_card counts labels depth hinjective] using + tendsto_log_exactWords_card_mul counts hD + +theorem tendsto_log_stageAuxiliaryBudget (counts : A → ℕ) (hD : 0 < ∑ a, counts a) + (labels : ∀ n, A → Label n) (depth : ℕ) + (hinjective : Function.Injective (labelRecordOf labels depth)) : + Tendsto + (fun t : ℕ => Real.log (stageAuxiliaryBudget counts labels depth t : ℝ) / + ((t : ℝ) * (∑ a, counts a : ℕ))) + atTop (𝓝 (finiteEntropy (fun a => (counts a : ℝ) / (∑ a, counts a : ℕ)))) := by + have hD' : ((∑ a, counts a : ℕ) : ℝ) ≠ 0 := Nat.cast_ne_zero.mpr (Nat.ne_of_gt hD) + have hmain : populationEntropyRate counts / (∑ a, counts a : ℕ) = + finiteEntropy (fun a => (counts a : ℝ) / (∑ a, counts a : ℕ)) := by + unfold populationEntropyRate + exact mul_div_cancel_left₀ _ hD' + simpa only [div_div, hmain] using + (tendsto_log_stageAuxiliaryBudget_div counts labels depth hinjective).div_const + ((∑ a, counts a : ℕ) : ℝ) + +theorem source_stage_resource_rates (counts : A → ℕ) (hD : 0 < ∑ a, counts a) + (labels : ∀ n, A → Label n) (depth : ℕ) + (hinjective : Function.Injective (labelRecordOf labels depth)) : + (∀ t, Tensor.RankAtMost (stageAuxiliaryTensor counts labels depth t) + (stageAuxiliaryBudget counts labels depth t)) ∧ + (∀ t, stagePairingProduct counts labels depth t = + Fintype.card (ExactWords (fun a => t * counts a))) ∧ + (∀ t, stagePairingProduct counts labels depth t ≤ stageAuxiliaryBudget counts labels depth t) ∧ + Tendsto + (fun t : ℕ => Real.log (stagePairingProduct counts labels depth t : ℝ) / + ((t : ℝ) * (∑ a, counts a : ℕ))) + atTop (𝓝 (finiteEntropy (fun a => (counts a : ℝ) / (∑ a, counts a : ℕ)))) ∧ + Tendsto + (fun t : ℕ => Real.log (stageAuxiliaryBudget counts labels depth t : ℝ) / + ((t : ℝ) * (∑ a, counts a : ℕ))) + atTop (𝓝 (finiteEntropy (fun a => (counts a : ℝ) / (∑ a, counts a : ℕ)))) := + ⟨stageAuxiliaryTensor_rankAtMost counts labels depth, + stagePairingProduct_eq_exactWords_card counts labels depth hinjective, + stagePairingProduct_le_budget counts labels depth, + tendsto_log_stagePairingProduct counts hD labels depth hinjective, + tendsto_log_stageAuxiliaryBudget counts hD labels depth hinjective⟩ + +end MatrixMultiplication.Foundation.StageHierarchyResources + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section + +namespace MatrixMultiplication + +open MatrixMultiplication.Foundation Filter +open scoped Topology BigOperators Classical + +inductive ReaderPair where + | xy | xz | yz + deriving DecidableEq + +instance : Fintype ReaderPair where + elems := {.xy, .xz, .yz} + complete pair := by cases pair <;> simp + +namespace ConditionalLabels + +universe u v + +section PairAccounting + +variable {I : Type u} [Fintype I] + +def pairingSize (population : I → ℕ) (reader : I → ReaderPair) + (pair : ReaderPair) : ℕ := + ∏ i, if reader i = pair then population i else 1 + +def pairingRate (rate : I → ℝ) (reader : I → ReaderPair) + (pair : ReaderPair) : ℝ := + ∑ i, if reader i = pair then rate i else 0 + +theorem pairingSize_pos (population : I → ℕ) (reader : I → ReaderPair) + (pair : ReaderPair) (positive : ∀ i, 0 < population i) : + 0 < pairingSize population reader pair := by + apply Finset.prod_pos + intro i _ + split_ifs + · exact positive i + · exact Nat.zero_lt_one + +theorem pairingRate_nonneg (rate : I → ℝ) (reader : I → ReaderPair) + (pair : ReaderPair) (nonneg : ∀ i, 0 ≤ rate i) : + 0 ≤ pairingRate rate reader pair := by + apply Finset.sum_nonneg + intro i _ + split_ifs + · exact nonneg i + · exact le_rfl + +theorem pairingSize_product (population : I → ℕ) (reader : I → ReaderPair) : + pairingSize population reader .xy * pairingSize population reader .xz * + pairingSize population reader .yz = ∏ i, population i := by + simp only [pairingSize, ← Finset.prod_mul_distrib] + apply Finset.prod_congr rfl + intro i _ + cases reader i <;> simp + +theorem pairingRate_sum (rate : I → ℝ) (reader : I → ReaderPair) : + pairingRate rate reader .xy + pairingRate rate reader .xz + + pairingRate rate reader .yz = ∑ i, rate i := by + simp only [pairingRate, ← Finset.sum_add_distrib] + apply Finset.sum_congr rfl + intro i _ + cases reader i <;> simp + +theorem tendsto_log_pairingSize (population : I → ℕ → ℕ) + (rate : I → ℝ) (reader : I → ReaderPair) (pair : ReaderPair) + (positive : ∀ i n, 0 < population i n) + (growth : ∀ i, Tendsto (fun n => Real.log (population i n : ℝ) / (n : ℝ)) + atTop (𝓝 (rate i))) : + Tendsto (fun n => Real.log (pairingSize (fun i => population i n) reader pair : ℝ) / + (n : ℝ)) atTop (𝓝 (pairingRate rate reader pair)) := by + apply Separation.tendsto_log_nat_prod_div_nat Finset.univ + · intro i _ n + split_ifs + · exact positive i n + · exact Nat.zero_lt_one + · intro i _ + by_cases h : reader i = pair + · simpa only [h, ite_true] using growth i + · simpa only [h, ite_false, Nat.cast_one, Real.log_one, zero_div] using + (tendsto_const_nhds : Tendsto (fun _ : ℕ => (0 : ℝ)) atTop (𝓝 0)) + +end PairAccounting + +section SourceHierarchy + +variable {A : Type u} [Fintype A] {Label : ℕ → Type v} + [∀ n, Fintype (Label n)] + +open StageHierarchyResources HierarchySeparationRates + +def stagePairingSize (counts : A → ℕ) (labels : ∀ n, A → Label n) + (depth : ℕ) (reader : Fin depth → ReaderPair) (pair : ReaderPair) (t : ℕ) : ℕ := + pairingSize (fun n : Fin depth => stageRefinementCount counts labels n.val t) reader pair + +def stagePairingRate (counts : A → ℕ) (labels : ∀ n, A → Label n) + (depth : ℕ) (reader : Fin depth → ReaderPair) (pair : ReaderPair) : ℝ := + pairingRate (fun n : Fin depth => stageEntropyRate counts labels n.val) reader pair + +theorem stagePairingSize_product (counts : A → ℕ) (labels : ∀ n, A → Label n) + (depth : ℕ) (reader : Fin depth → ReaderPair) + (complete : Function.Injective (labelRecordOf labels depth)) (t : ℕ) : + stagePairingSize counts labels depth reader .xy t * + stagePairingSize counts labels depth reader .xz t * + stagePairingSize counts labels depth reader .yz t = + Fintype.card (ExactWords (fun a => t * counts a)) := by + rw [stagePairingSize, stagePairingSize, stagePairingSize, pairingSize_product] + exact stagePairingProduct_eq_exactWords_card counts labels depth complete t + +theorem stagePairingRate_sum (counts : A → ℕ) (labels : ∀ n, A → Label n) + (depth : ℕ) (reader : Fin depth → ReaderPair) + (complete : Function.Injective (labelRecordOf labels depth)) : + stagePairingRate counts labels depth reader .xy + + stagePairingRate counts labels depth reader .xz + + stagePairingRate counts labels depth reader .yz = populationEntropyRate counts := by + rw [stagePairingRate, stagePairingRate, stagePairingRate, pairingRate_sum] + exact sum_stageEntropyRate_eq_source counts labels depth complete + +theorem tendsto_log_stagePairingSize (counts : A → ℕ) (labels : ∀ n, A → Label n) + (depth : ℕ) (reader : Fin depth → ReaderPair) (pair : ReaderPair) : + Tendsto (fun t => Real.log (stagePairingSize counts labels depth reader pair t : ℝ) / + (t : ℝ)) atTop (𝓝 (stagePairingRate counts labels depth reader pair)) := by + exact tendsto_log_pairingSize _ _ reader pair + (fun n => stageRefinementCount_pos counts labels n.val) + (fun n => tendsto_log_stageRefinementCount_div counts labels n.val) + +theorem tendsto_log_stagePairingSize_normalized (counts : A → ℕ) + (labels : ∀ n, A → Label n) (depth : ℕ) + (reader : Fin depth → ReaderPair) (pair : ReaderPair) : + Tendsto (fun t => Real.log (stagePairingSize counts labels depth reader pair t : ℝ) / + ((t : ℝ) * (∑ a, counts a : ℕ))) atTop + (𝓝 (stagePairingRate counts labels depth reader pair / (∑ a, counts a : ℕ))) := by + simpa only [div_div] using + (tendsto_log_stagePairingSize counts labels depth reader pair).div_const + ((∑ a, counts a : ℕ) : ℝ) + +theorem auxiliary_overhead_tendsto_zero (counts : A → ℕ) (hD : 0 < ∑ a, counts a) + (labels : ∀ n, A → Label n) (depth : ℕ) + (complete : Function.Injective (labelRecordOf labels depth)) : + Tendsto (fun t => + (Real.log (stageAuxiliaryBudget counts labels depth t : ℝ) - + Real.log (Fintype.card (ExactWords (fun a => t * counts a)) : ℝ)) / + ((t : ℝ) * (∑ a, counts a : ℕ))) atTop (𝓝 0) := by + have h := (tendsto_log_stageAuxiliaryBudget counts hD labels depth complete).sub + (tendsto_log_exactWords_card_mul counts hD) + simpa only [sub_self, sub_div] using h + +theorem auxiliary_overhead_nonneg (counts : A → ℕ) + (labels : ∀ n, A → Label n) (depth : ℕ) + (complete : Function.Injective (labelRecordOf labels depth)) (t : ℕ) : + 0 ≤ Real.log (stageAuxiliaryBudget counts labels depth t : ℝ) - + Real.log (Fintype.card (ExactWords (fun a => t * counts a)) : ℝ) := by + apply sub_nonneg.mpr + rw [← stagePairingProduct_eq_exactWords_card counts labels depth complete t] + apply Real.log_le_log + · apply Nat.cast_pos.mpr + exact Finset.prod_pos (fun n _ => stageRefinementCount_pos counts labels n.val t) + · exact_mod_cast stagePairingProduct_le_budget counts labels depth t + +theorem charged_cost_tendsto (counts : A → ℕ) (hD : 0 < ∑ a, counts a) + (labels : ∀ n, A → Label n) (depth : ℕ) + (complete : Function.Injective (labelRecordOf labels depth)) (C : ℝ) : + Tendsto (fun t => C + + (Real.log (stageAuxiliaryBudget counts labels depth t : ℝ) - + Real.log (Fintype.card (ExactWords (fun a => t * counts a)) : ℝ)) / + ((t : ℝ) * (∑ a, counts a : ℕ))) atTop (𝓝 C) := by + simpa only [add_zero] using + (auxiliary_overhead_tendsto_zero counts hD labels depth complete).const_add C + +theorem limit_le_source_cost (counts : A → ℕ) (hD : 0 < ∑ a, counts a) + (labels : ∀ n, A → Label n) (depth : ℕ) + (complete : Function.Injective (labelRecordOf labels depth)) + {value : ℕ → ℝ} {rate C : ℝ} + (limit : Tendsto value atTop (𝓝 rate)) + (finite_bound : ∀ᶠ t in atTop, value t ≤ C + + (Real.log (stageAuxiliaryBudget counts labels depth t : ℝ) - + Real.log (Fintype.card (ExactWords (fun a => t * counts a)) : ℝ)) / + ((t : ℝ) * (∑ a, counts a : ℕ))) : rate ≤ C := + le_of_tendsto_of_tendsto limit + (charged_cost_tendsto counts hD labels depth complete C) finite_bound + +def lawPairingRate (p : FiniteLaw A) (labels : ∀ n, A → Label n) + (depth : ℕ) (reader : Fin depth → ReaderPair) (pair : ReaderPair) : ℝ := + pairingRate (fun n : Fin depth => + (FiniteLabelHierarchy.ofLawLabels p labels depth).refinementEntropy n.val) reader pair + +theorem lawPairingRate_sum (p : FiniteLaw A) (labels : ∀ n, A → Label n) + (depth : ℕ) (reader : Fin depth → ReaderPair) + (complete : Function.Injective (labelRecordOf labels depth)) : + lawPairingRate p labels depth reader .xy + + lawPairingRate p labels depth reader .xz + + lawPairingRate p labels depth reader .yz = finiteEntropy p.mass := by + rw [lawPairingRate, lawPairingRate, lawPairingRate, pairingRate_sum, + Fin.sum_univ_eq_sum_range] + exact FiniteLabelHierarchy.ofLawLabels_refinementEntropy_sum p labels depth complete + +theorem incident_rate_eq_prefix_entropy (p : FiniteLaw A) + (labels : ∀ n, A → Label n) (depth cut : ℕ) (hcut : cut ≤ depth) + (reader : Fin depth → ReaderPair) + (incident_prefix : ∀ n : Fin depth, + (reader n = .xy ∨ reader n = .xz) ↔ n.val < cut) : + lawPairingRate p labels depth reader .xy + + lawPairingRate p labels depth reader .xz = + finiteEntropy (p.map (labelRecordOf labels cut)).mass := by + let hierarchy := FiniteLabelHierarchy.ofLawLabels p labels depth + have hterms : ∀ n : Fin depth, + (if reader n = .xy then hierarchy.refinementEntropy n.val else 0) + + (if reader n = .xz then hierarchy.refinementEntropy n.val else 0) = + if n.val < cut then hierarchy.refinementEntropy n.val else 0 := by + intro n + cases hr : reader n with + | xy => + have hn := (incident_prefix n).mp (Or.inl hr) + simp [hn] + | xz => + have hn := (incident_prefix n).mp (Or.inr hr) + simp [hn] + | yz => + have hn : ¬n.val < cut := by + intro h + rcases (incident_prefix n).mpr h with h | h <;> simp [hr] at h + simp [hn] + have hfilter : (Finset.range depth).filter (fun n => n < cut) = Finset.range cut := by + ext n + simp only [Finset.mem_filter, Finset.mem_range] + omega + calc + lawPairingRate p labels depth reader .xy + + lawPairingRate p labels depth reader .xz = + ∑ n : Fin depth, if n.val < cut then hierarchy.refinementEntropy n.val else 0 := by + simp only [lawPairingRate, pairingRate, ← Finset.sum_add_distrib] + exact Finset.sum_congr rfl (fun n _ => hterms n) + _ = ∑ n ∈ Finset.range cut, hierarchy.refinementEntropy n := by + rw [show (∑ n : Fin depth, if n.val < cut then hierarchy.refinementEntropy n.val else 0) = + ∑ n ∈ Finset.range depth, if n < cut then hierarchy.refinementEntropy n else 0 from + Fin.sum_univ_eq_sum_range + (fun n => if n < cut then hierarchy.refinementEntropy n else 0) depth] + rw [← Finset.sum_filter, hfilter] + _ = finiteEntropy (hierarchy.prefixLaw cut hcut).mass := + (hierarchy.prefixLaw_entropy cut hcut).symm + _ = finiteEntropy (p.map (labelRecordOf labels cut)).mass := by + rw [FiniteLabelHierarchy.ofLawLabels_prefixLaw_mass] + +theorem remaining_rate_eq_entropy_sub_prefix (p : FiniteLaw A) + (labels : ∀ n, A → Label n) (depth cut : ℕ) (hcut : cut ≤ depth) + (reader : Fin depth → ReaderPair) + (incident_prefix : ∀ n : Fin depth, + (reader n = .xy ∨ reader n = .xz) ↔ n.val < cut) + (complete : Function.Injective (labelRecordOf labels depth)) : + lawPairingRate p labels depth reader .yz = finiteEntropy p.mass - + finiteEntropy (p.map (labelRecordOf labels cut)).mass := by + have hsum := lawPairingRate_sum p labels depth reader complete + have hprefix := incident_rate_eq_prefix_entropy p labels depth cut hcut reader incident_prefix + linarith + +end SourceHierarchy +end ConditionalLabels +end MatrixMultiplication + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/Extraction/ConstructionLabels.lean b/lean/OAI/LinearAlgebra/MatrixFields/Extraction/ConstructionLabels.lean new file mode 100644 index 0000000000000000000000000000000000000000..36bed353457b8808a201da7425a7c73d69969bea --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/Extraction/ConstructionLabels.lean @@ -0,0 +1,280 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Entropy.FloorExponentialRates +import OAI.LinearAlgebra.MatrixFields.Entropy.TerminalRates +import OAI.LinearAlgebra.MatrixFields.Histories.ScheduledPositivity + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +noncomputable section + +namespace MatrixMultiplication.AllFieldConstructionRates + +open MatrixMultiplication.Foundation AllFieldHistory AllFieldScheduledYield +open AllFieldActiveLaws Filter +open scoped BigOperators Topology Classical + +variable {K : ℕ} + +def denominator (allocation : Allocation) : ℕ := populationLength (K := K) allocation 1 + +theorem denominator_pos (allocation : Allocation) : 0 < denominator (K := K) allocation := + AllFieldPopulationCounts.blockLength_pos _ (by decide) + +theorem population_length (allocation : Allocation) (m : ℕ) : + populationLength (K := K) allocation m = m * denominator (K := K) allocation := + populationLength_dilation allocation m + +theorem populationLength_tendsto (allocation : Allocation) : + Tendsto (populationLength (K := K) allocation) atTop atTop := by + apply tendsto_atTop.mpr + intro b + filter_upwards [eventually_ge_atTop b] with m hm + rw [population_length] + exact hm.trans (by simpa using Nat.mul_le_mul_left m (denominator_pos allocation)) + +abbrev Slot (K : ℕ) := Unit ⊕ (Fin (K + 2) × Placement) + +def capacity (allocation : Allocation) : Slot K → ℝ + | .inl _ => (K : ℝ) * AllFieldInitialEntropy.nativeH0 + | .inr p => Staggering.minCapacity + (physicalTickCapacity allocation p.1.val (workCapacity (K := K)) p.2) + +def selectionRate (allocation : Allocation) (δ : ℝ) (slot : Slot K) : ℝ := + (denominator (K := K) allocation : ℝ) * capacity allocation slot - δ + +def initialCount (allocation : Allocation) (δ : ℝ) (m : ℕ) : ℕ := + FloorExponentialRates.count (selectionRate (K := K) allocation δ (.inl ())) m + +def groupCount (allocation : Allocation) (δ : ℝ) (m : ℕ) + (tick : Fin (K + 2)) (σ : Placement) : ℕ := + FloorExponentialRates.count (selectionRate allocation δ (.inr (tick, σ))) m + +theorem initialCount_eq (allocation : Allocation) (δ : ℝ) (m : ℕ) : + initialCount (K := K) allocation δ m = + ⌊Real.exp ((m : ℝ) * ((populationLength (K := K) allocation 1 : ℝ) * + ((K : ℝ) * AllFieldInitialEntropy.nativeH0) - δ))⌋₊ := rfl + +theorem groupCount_eq_native (allocation : Allocation) (δ : ℝ) (m : ℕ) + (tick : Fin (K + 2)) (σ : Placement) : + groupCount allocation δ m tick σ = + ⌊Real.exp ((m : ℝ) * ((populationLength (K := K) allocation 1 : ℝ) * + ((1 / 6 : ℝ) * Staggering.minCapacity (FiniteSchedule.tickCapacity K + AllFieldNativeCapacity.nativeLA AllFieldNativeCapacity.nativeLB + (AllFieldNativeCapacity.nativeLC (fun i => (allocation.mass i : ℝ))) tick.val)) - δ))⌋₊ := by + unfold groupCount FloorExponentialRates.count selectionRate + simp only [capacity, physical_order_native_capacity, + PhysicalOrders.minCapacity_mul _ _ (by norm_num : (0 : ℝ) ≤ 1 / 6)] + rfl + +abbrev SelectedLabels (allocation : Allocation) (δ : ℝ) (m : ℕ) := + Fin (initialCount (K := K) allocation δ m) × + ∀ tick : Fin (K + 2), ∀ σ : Placement, Fin (groupCount allocation δ m tick σ) + +theorem card_selected (allocation : Allocation) (δ : ℝ) (m : ℕ) : + Fintype.card (SelectedLabels (K := K) allocation δ m) = + initialCount (K := K) allocation δ m * + ∏ tick : Fin (K + 2), ∏ σ : Placement, groupCount allocation δ m tick σ := by + simp only [SelectedLabels, Fintype.card_prod, Fintype.card_pi, Fintype.card_fin] + +theorem card_selected_product (allocation : Allocation) (δ : ℝ) (m : ℕ) : + Fintype.card (SelectedLabels (K := K) allocation δ m) = + (∏ slot : Slot K, FloorExponentialRates.count (selectionRate allocation δ slot) m) := by + rw [card_selected] + simp [Slot, initialCount, groupCount, Fintype.prod_sum_type, Fintype.prod_prod_type] + +theorem card_selected_from_factors + (Initial : Type*) [Fintype Initial] + (Groups : Fin (K + 2) → Placement → Type*) [∀ tick σ, Fintype (Groups tick σ)] + (allocation : Allocation) (δ : ℝ) (m : ℕ) + (hI : Fintype.card Initial = initialCount (K := K) allocation δ m) + (hG : ∀ tick σ, Fintype.card (Groups tick σ) = groupCount allocation δ m tick σ) : + Fintype.card (Initial × ∀ tick σ, Groups tick σ) = + Fintype.card (SelectedLabels (K := K) allocation δ m) := by + simp only [Fintype.card_prod, Fintype.card_pi, hI, hG, Fintype.card_fin] + +theorem slot_card : Fintype.card (Slot K) = 1 + 6 * (K + 2) := by + simp [Slot, Placement, Fintype.card_perm, Nat.factorial_succ] + omega + +theorem sum_capacity (allocation : Allocation) : + (∑ slot : Slot K, capacity allocation slot) = + (K : ℝ) * AllFieldInitialEntropy.nativeH0 + physicalYield K allocation := by + simp only [Slot, Fintype.sum_sum_type, capacity, Fintype.sum_unique, + Fintype.sum_prod_type] + congr 1 + exact Fin.sum_univ_eq_sum_range (fun tick : ℕ => + ∑ σ : Placement, Staggering.minCapacity + (physicalTickCapacity allocation tick (workCapacity (K := K)) σ)) (K + 2) + +theorem sum_selectionRate (allocation : Allocation) (δ : ℝ) : + (∑ slot : Slot K, selectionRate allocation δ slot) = + (denominator (K := K) allocation : ℝ) * + ((K : ℝ) * AllFieldInitialEntropy.nativeH0 + physicalYield K allocation) - + (1 + 6 * (K + 2) : ℕ) * δ := by + simp only [selectionRate, Finset.sum_sub_distrib, ← Finset.mul_sum, + Finset.sum_const, Finset.card_univ, nsmul_eq_mul, slot_card, sum_capacity] + +theorem selected_pos (allocation : Allocation) (δ : ℝ) + (hδ : ∀ slot : Slot K, δ ≤ (denominator (K := K) allocation : ℝ) * + capacity allocation slot) (m : ℕ) : + 0 < Fintype.card (SelectedLabels (K := K) allocation δ m) := by + rw [card_selected_product] + exact Finset.prod_pos fun slot _ => + FloorExponentialRates.count_pos (sub_nonneg.mpr (hδ slot)) m + +theorem selected_rate (hK : 0 < K) (allocation : Allocation) (δ : ℝ) + (hδ : ∀ slot : Slot K, δ ≤ (denominator (K := K) allocation : ℝ) * + capacity allocation slot) : + Tendsto (fun m : ℕ => Real.log (Fintype.card + (SelectedLabels (K := K) allocation δ m) : ℝ) / + ((K : ℝ) * populationLength (K := K) allocation m)) atTop + (𝓝 (AllFieldInitialEntropy.nativeH0 + physicalYield K allocation / K - + (1 + 6 * (K + 2) : ℕ) * δ / + ((K : ℝ) * denominator (K := K) allocation))) := by + have h := (FloorExponentialRates.tendsto_log_prod_count_div_nat + (selectionRate (K := K) allocation δ) (fun slot => sub_nonneg.mpr (hδ slot))).div_const + ((K : ℝ) * denominator (K := K) allocation) + rw [sum_selectionRate] at h + have hk : (K : ℝ) ≠ 0 := Nat.cast_ne_zero.mpr hK.ne' + have hd : (denominator (K := K) allocation : ℝ) ≠ 0 := + Nat.cast_ne_zero.mpr (denominator_pos allocation).ne' + have hr : ((denominator (K := K) allocation : ℝ) * + ((K : ℝ) * AllFieldInitialEntropy.nativeH0 + physicalYield K allocation) - + (1 + 6 * (K + 2) : ℕ) * δ) / ((K : ℝ) * denominator (K := K) allocation) = + AllFieldInitialEntropy.nativeH0 + physicalYield K allocation / K - + (1 + 6 * (K + 2) : ℕ) * δ / + ((K : ℝ) * denominator (K := K) allocation) := by + field_simp [hk, hd] + rw [hr] at h + apply h.congr + intro m + rw [card_selected_product, population_length, Nat.cast_mul] + ring + +theorem exists_positive_slack (allocation : Allocation) + (hcap : ∀ slot : Slot K, 0 < capacity allocation slot) : + ∃ η : ℝ, 0 < η ∧ ∀ δ : ℝ, δ ≤ η → ∀ slot : Slot K, + δ ≤ (denominator (K := K) allocation : ℝ) * capacity allocation slot := by + let η := Finset.univ.inf' (show (Finset.univ : Finset (Slot K)).Nonempty from + ⟨.inl (), Finset.mem_univ _⟩) + (fun slot => (denominator (K := K) allocation : ℝ) * capacity allocation slot) + refine ⟨η, ?_, ?_⟩ + · apply (Finset.lt_inf'_iff _).mpr + intro slot _ + exact mul_pos (Nat.cast_pos.mpr (denominator_pos allocation)) (hcap slot) + · intro δ hδ slot + exact hδ.trans (Finset.inf'_le _ (Finset.mem_univ slot)) + +theorem exists_slack_for_loss (hK : 0 < K) (allocation : Allocation) + (hcap : ∀ slot : Slot K, 0 < capacity allocation slot) + {η : ℝ} (hη : 0 < η) : + ∃ δ : ℝ, 0 < δ ∧ + (∀ slot : Slot K, δ ≤ (denominator (K := K) allocation : ℝ) * + capacity allocation slot) ∧ + (1 + 6 * (K + 2) : ℕ) * δ / + ((K : ℝ) * denominator (K := K) allocation) < η := by + obtain ⟨bound, hbound, hslots⟩ := exists_positive_slack allocation hcap + have hk : (0 : ℝ) < K := Nat.cast_pos.mpr hK + have hd : (0 : ℝ) < denominator (K := K) allocation := + Nat.cast_pos.mpr (denominator_pos allocation) + have hc : (0 : ℝ) < (1 + 6 * (K + 2) : ℕ) := by positivity + let target := η * ((K : ℝ) * denominator (K := K) allocation) / + (1 + 6 * (K + 2) : ℕ) + have ht : 0 < target := div_pos (mul_pos hη (mul_pos hk hd)) hc + let δ := min bound target / 2 + have hm : 0 < min bound target := lt_min hbound ht + have hδ : 0 < δ := div_pos hm (by norm_num) + have hδmin : δ < min bound target := by dsimp [δ]; linarith + refine ⟨δ, hδ, hslots δ (hδmin.le.trans (min_le_left _ _)), ?_⟩ + apply (div_lt_iff₀ (mul_pos hk hd)).mpr + have hsmall := (lt_div_iff₀ hc).mp (hδmin.trans_le (min_le_right bound target)) + change δ * ((1 + 6 * (K + 2) : ℕ) : ℝ) < + η * ((K : ℝ) * denominator (K := K) allocation) at hsmall + simpa only [mul_comm δ] using hsmall + +theorem capacity_pos_of_native (hK : 2 ≤ K) (allocation : Allocation) + (ha : ∀ i, 0 < AllFieldNativeCapacity.nativeLA i) + (hb : ∀ i, 0 < AllFieldNativeCapacity.nativeLB i) + (hc : ∀ i, 0 < AllFieldNativeCapacity.nativeLC + (fun j => (allocation.mass j : ℝ)) i) (slot : Slot K) : + 0 < capacity allocation slot := by + cases slot with + | inl u => exact AllFieldScheduledPositivity.initial_capacity_pos K (by omega) + | inr p => + exact AllFieldScheduledPositivity.physical_order_capacity_pos K p.1.val hK + p.1.isLt allocation p.2 ha hb hc + +theorem eventually_capacity_pos (hK : 2 ≤ K) (allocation : ℕ → Allocation) + (h : ∀ i, Tendsto (fun j => ((allocation j).mass i : ℝ)) atTop + (𝓝 (AllFieldNativeCapacity.nativeLambda i))) + (ha : ∀ i, 0 < AllFieldNativeCapacity.nativeLA i) + (hb : ∀ i, 0 < AllFieldNativeCapacity.nativeLB i) + (hc : ∀ i, 0 < AllFieldNativeCapacity.nativeLC AllFieldNativeCapacity.nativeLambda i) : + ∀ᶠ j in atTop, ∀ slot : Slot K, 0 < capacity (allocation j) slot := by + filter_upwards [AllFieldScheduledPositivity.eventually_physical_order_capacity_pos + K hK allocation h ha hb hc] with j hj + intro slot + cases slot with + | inl u => exact AllFieldScheduledPositivity.initial_capacity_pos K (by omega) + | inr p => exact hj p.1.val p.1.isLt p.2 + +theorem terminalDilation_mul_one (K m : ℕ) : + AllFieldTerminalRates.terminalDilation K m = + m * AllFieldTerminalRates.terminalDilation K 1 := by + simp only [AllFieldTerminalRates.terminalDilation, + AllFieldTerminalPopulations.dilation, one_mul] + +theorem terminalDilation_tendsto (K : ℕ) : + Tendsto (AllFieldTerminalRates.terminalDilation K) atTop atTop := by + apply tendsto_atTop.mpr + intro b + filter_upwards [eventually_ge_atTop b] with m hm + rw [terminalDilation_mul_one] + have hD := AllFieldTerminalRates.terminalDilation_pos (K := K) (m := 1) (by decide) + have hmul : m ≤ m * AllFieldTerminalRates.terminalDilation K 1 := by + simpa using Nat.mul_le_mul_left m hD + exact hm.trans hmul + +theorem terminal_denominator (allocation : Allocation) : + AllFieldTerminalRates.terminalLength allocation K 1 = + AllFieldTerminalRates.terminalDilation K 1 * denominator (K := K) allocation := + population_length allocation _ + +theorem selected_terminal_rate (hK : 0 < K) (allocation : Allocation) (δ : ℝ) + (hδ : ∀ slot : Slot K, δ ≤ (denominator (K := K) allocation : ℝ) * + capacity allocation slot) : + Tendsto (fun m : ℕ => Real.log (Fintype.card + (SelectedLabels (K := K) allocation δ (AllFieldTerminalRates.terminalDilation K m)) : ℝ) / + ((K : ℝ) * AllFieldTerminalRates.terminalLength allocation K m)) atTop + (𝓝 (AllFieldInitialEntropy.nativeH0 + physicalYield K allocation / K - + (1 + 6 * (K + 2) : ℕ) * δ / + ((K : ℝ) * denominator (K := K) allocation))) := + (selected_rate hK allocation δ hδ).comp (terminalDilation_tendsto K) + +theorem selected_terminal_rate_of_cardinality + (Labels : ℕ → Type*) [∀ m, Fintype (Labels m)] + (hK : 0 < K) (allocation : Allocation) (δ : ℝ) + (hδ : ∀ slot : Slot K, δ ≤ (denominator (K := K) allocation : ℝ) * + capacity allocation slot) + (cards : ∀ᶠ m : ℕ in atTop, Fintype.card (Labels m) = Fintype.card + (SelectedLabels (K := K) allocation δ (AllFieldTerminalRates.terminalDilation K m))) : + Tendsto (fun m : ℕ => Real.log (Fintype.card (Labels m) : ℝ) / + ((K : ℝ) * AllFieldTerminalRates.terminalLength allocation K m)) atTop + (𝓝 (AllFieldInitialEntropy.nativeH0 + physicalYield K allocation / K - + (1 + 6 * (K + 2) : ℕ) * δ / + ((K : ℝ) * denominator (K := K) allocation))) := by + apply (selected_terminal_rate hK allocation δ hδ).congr' + filter_upwards [cards] with m hm + rw [hm] + +end MatrixMultiplication.AllFieldConstructionRates + +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/Extraction/GroupPairWindows.lean b/lean/OAI/LinearAlgebra/MatrixFields/Extraction/GroupPairWindows.lean new file mode 100644 index 0000000000000000000000000000000000000000..e4a6e36e4831d3717c12c1d1402c16f19b413fee --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/Extraction/GroupPairWindows.lean @@ -0,0 +1,815 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Construction.GroupAssignmentRetention +import OAI.LinearAlgebra.MatrixFields.Entropy.JointCompatibilityRateLimit + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section + +open scoped BigOperators +open MatrixMultiplication.Foundation +open MatrixMultiplication.JointTypeCounts MatrixMultiplication.JointCompatibilityIncidence + +namespace MatrixMultiplication.JointCompatibilityControls + +attribute [local instance] Classical.propDecidable + +private theorem exists_pos_le_family_inline_MatrixMultiplication_JointCompatibilityControls {K : Type*} [Fintype K] + (δ : K → ℝ) (hδ : ∀ k, 0 < δ k) : + ∃ ε : ℝ, 0 < ε ∧ ∀ k, ε ≤ δ k := by + classical + have aux : ∀ s : Finset K, ∃ ε : ℝ, 0 < ε ∧ ∀ k ∈ s, ε ≤ δ k := by + intro s + induction s using Finset.induction_on with + | empty => exact ⟨1, zero_lt_one, by simp⟩ + | @insert k s hk ih => + obtain ⟨ε, hε, hb⟩ := ih + refine ⟨min (δ k) ε, lt_min (hδ k) hε, ?_⟩ + intro j hj + rcases Finset.mem_insert.mp hj with rfl | hj + · exact min_le_left _ _ + · exact (min_le_right _ _).trans (hb j hj) + obtain ⟨ε, hε, hb⟩ := aux Finset.univ + exact ⟨ε, hε, fun k => hb k (Finset.mem_univ k)⟩ + +variable {C : Type*} [Fintype C] [DecidableEq C] + {Shape A : C → Type*} + [∀ c, Fintype (Shape c)] [∀ c, DecidableEq (Shape c)] + [∀ c, Fintype (A c)] [∀ c, DecidableEq (A c)] + +def residualBase (base : ∀ c, Shape c → ℕ) (d : ∀ c, Shape c → Prop) (c : C) : ℕ := + ∑ u : {u : Shape c // ¬d c u}, base c u.val + +def designatedBase (base : ∀ c, Shape c → ℕ) (d : ∀ c, Shape c → Prop) (c : C) : ℕ := + ∑ u : {u : Shape c // d c u}, base c u.val + +def totalCenterCount (base : ∀ c, Shape c → ℕ) + (law : ∀ c, Shape c → A c → ℝ) (c : C) (a : A c) : ℝ := + ∑ u, (base c u : ℝ) * law c u a + +def residualCenter (base : ∀ c, Shape c → ℕ) (d : ∀ c, Shape c → Prop) + (law : ∀ c, Shape c → A c → ℝ) (c : C) (a : A c) : ℝ := + (∑ u : {u : Shape c // ¬d c u}, (base c u.val : ℝ) * law c u.val a) / + residualBase base d c + +omit [Fintype C] [DecidableEq C] [∀ c, DecidableEq (Shape c)] + [∀ c, Fintype (A c)] [∀ c, DecidableEq (A c)] in +theorem residualBase_mul_center (base : ∀ c, Shape c → ℕ) (d : ∀ c, Shape c → Prop) + (law : ∀ c, Shape c → A c → ℝ) (c : C) (a : A c) : + (residualBase base d c : ℝ) * residualCenter base d law c a = + ∑ u : {u : Shape c // ¬d c u}, (base c u.val : ℝ) * law c u.val a := by + by_cases hr : residualBase base d c = 0 + · have hb (u : {u : Shape c // ¬d c u}) : base c u.val = 0 := by + have hle : base c u.val ≤ residualBase base d c := + Finset.single_le_sum + (f := fun v : {u : Shape c // ¬d c u} => base c v.val) + (fun _ _ => Nat.zero_le _) (Finset.mem_univ u) + rw [hr] at hle + exact Nat.eq_zero_of_le_zero hle + simp only [hr, Nat.cast_zero, zero_mul, hb, Finset.sum_const_zero] + · exact mul_div_cancel₀ _ (Nat.cast_ne_zero.mpr hr) + +omit [Fintype C] [DecidableEq C] [∀ c, DecidableEq (Shape c)] + [∀ c, Fintype (A c)] [∀ c, DecidableEq (A c)] in +theorem residualCenter_nonneg (base : ∀ c, Shape c → ℕ) (d : ∀ c, Shape c → Prop) + (law : ∀ c, Shape c → A c → ℝ) (h0 : ∀ c u a, 0 ≤ law c u a) + (c : C) (a : A c) : 0 ≤ residualCenter base d law c a := + div_nonneg (Finset.sum_nonneg fun shape _ => + mul_nonneg (Nat.cast_nonneg _) (h0 c shape.val a)) + (Nat.cast_nonneg _) + +omit [Fintype C] [DecidableEq C] [∀ c, DecidableEq (Shape c)] + [∀ c, Fintype (A c)] [∀ c, DecidableEq (A c)] in +theorem residualCenter_le_one (base : ∀ c, Shape c → ℕ) (d : ∀ c, Shape c → Prop) + (law : ∀ c, Shape c → A c → ℝ) (h1 : ∀ c u a, law c u a ≤ 1) + (c : C) (a : A c) : residualCenter base d law c a ≤ 1 := by + by_cases hr : residualBase base d c = 0 + · simp only [residualCenter, hr, Nat.cast_zero, div_zero, zero_le_one] + · have hp : (0 : ℝ) < residualBase base d c := Nat.cast_pos.mpr (Nat.pos_of_ne_zero hr) + apply (div_le_iff₀ hp).mpr + calc + (∑ u : {u : Shape c // ¬d c u}, (base c u.val : ℝ) * law c u.val a) ≤ + ∑ u : {u : Shape c // ¬d c u}, (base c u.val : ℝ) * 1 := + Finset.sum_le_sum fun u _ => mul_le_mul_of_nonneg_left (h1 _ _ _) (Nat.cast_nonneg _) + _ = 1 * (residualBase base d c : ℝ) := by + simp only [mul_one, one_mul, residualBase, Nat.cast_sum] + +def groupCenter (base : ∀ c, Shape c → ℕ) (d : ∀ c, Shape c → Prop) + (law : ∀ c, Shape c → A c → ℝ) (g : Σ c, Option (Shape c)) : A g.1 → ℝ := + match g.2 with + | some u => law g.1 u + | none => residualCenter base d law g.1 + +def groupCap (base : ∀ c, Shape c → ℕ) (d : ∀ c, Shape c → Prop) + (law : ∀ c, Shape c → A c → ℝ) (ε : ℝ) (g : Σ c, Option (Shape c)) : ℝ := + finiteEntropy (groupCenter base d law g) + ε + +omit [Fintype C] [DecidableEq C] [∀ c, DecidableEq (Shape c)] + [∀ c, DecidableEq (A c)] in +theorem groupCap_nonneg (base : ∀ c, Shape c → ℕ) (d : ∀ c, Shape c → Prop) + (law : ∀ c, Shape c → A c → ℝ) + (h0 : ∀ c u a, 0 ≤ law c u a) (h1 : ∀ c u a, law c u a ≤ 1) + {ε : ℝ} (hε : 0 ≤ ε) (g : Σ c, Option (Shape c)) : + 0 ≤ groupCap base d law ε g := by + apply add_nonneg _ hε + rcases g with ⟨c, k⟩ + cases k with + | some u => + exact finiteEntropy_nonneg (law c u) (h0 c u) (h1 c u) + | none => + exact finiteEntropy_nonneg (residualCenter base d law c) + (residualCenter_nonneg base d law h0 c) (residualCenter_le_one base d law h1 c) + +omit [DecidableEq C] [∀ c, DecidableEq (Shape c)] [∀ c, DecidableEq (A c)] in +private theorem exists_group_entropy_window_inline_MatrixMultiplication_JointCompatibilityControls (base : ∀ c, Shape c → ℕ) + (d : ∀ c, Shape c → Prop) (law : ∀ c, Shape c → A c → ℝ) + {ε : ℝ} (hε : 0 < ε) : + ∃ δ : ℝ, 0 < δ ∧ ∀ (g : Σ c, Option (Shape c)) (q : A g.1 → ℝ), + (∀ a, |q a - groupCenter base d law g a| ≤ δ) → + finiteEntropy q ≤ groupCap base d law ε g := by + have hex : ∀ g : Σ c, Option (Shape c), ∃ δ : ℝ, 0 < δ ∧ + ∀ q : A g.1 → ℝ, (∀ a, |q a - groupCenter base d law g a| ≤ δ) → + |finiteEntropy q - finiteEntropy (groupCenter base d law g)| < ε := + fun g => exists_entropy_window (groupCenter base d law g) hε + choose δ hδ hw using hex + obtain ⟨δ₀, hδ₀, hsmall⟩ := exists_pos_le_family_inline_MatrixMultiplication_JointCompatibilityControls δ hδ + refine ⟨δ₀, hδ₀, ?_⟩ + intro g q hq + have hh := (abs_lt.mp (hw g q (fun a => (hq a).trans (hsmall g)))).2 + change finiteEntropy q ≤ finiteEntropy (groupCenter base d law g) + ε + linarith + +omit [Fintype C] [DecidableEq C] in +theorem residual_card_repeated + {Pos : C → Type*} [∀ c, Fintype (Pos c)] [∀ c, DecidableEq (Pos c)] + (base : ∀ c, Shape c → ℕ) (d : ∀ c, Shape c → Prop) (t : ℕ) + (w : FixedClassWords Pos Shape (fun c u => t * base c u)) (c : C) : + Fintype.card {i : Pos c // ¬d c ((w c).val i)} = t * residualBase base d c := by + have he := (Fintype.card_congr (Equiv.sigmaSubtypeFiberEquivSubtype (w c).val + (p := fun i => ¬d c ((w c).val i)) (q := fun u => ¬d c u) + (fun _ => Iff.rfl))).symm + have hc : Fintype.card {i : Pos c // ¬d c ((w c).val i)} = + ∑ u : {u : Shape c // ¬d c u}, wordPopulation (w c).val u.val := by + simpa only [Fintype.card_sigma, wordPopulation] using he + exact hc.trans (by simp only [(w c).property, residualBase, Finset.mul_sum]) + +omit [Fintype C] [DecidableEq C] [∀ c, Fintype (A c)] [∀ c, DecidableEq (A c)] in +theorem repeated_mixture_balance + {Pos : C → Type*} [∀ c, Fintype (Pos c)] [∀ c, DecidableEq (Pos c)] + (base : ∀ c, Shape c → ℕ) (d : ∀ c, Shape c → Prop) + (law : ∀ c, Shape c → A c → ℝ) (t : ℕ) + (w : FixedClassWords Pos Shape (fun c u => t * base c u)) (c : C) (a : A c) : + (Fintype.card {i : Pos c // ¬d c ((w c).val i)} : ℝ) * residualCenter base d law c a = + (t : ℝ) * totalCenterCount base law c a - + ∑ u : {u : Shape c // d c u}, (t * base c u.val : ℕ) * law c u.val a := by + have hsplit := Fintype.sum_subtype_add_sum_subtype (d c) + (fun u => (base c u : ℝ) * law c u a) + have hb : (∑ u : {u : Shape c // ¬d c u}, (base c u.val : ℝ) * law c u.val a) = + totalCenterCount base law c a - + ∑ u : {u : Shape c // d c u}, (base c u.val : ℝ) * law c u.val a := by + unfold totalCenterCount + linarith + rw [residual_card_repeated, Nat.cast_mul, mul_assoc, residualBase_mul_center, hb] + simp only [Nat.cast_mul, mul_sub, Finset.mul_sum, mul_assoc] + +omit [Fintype C] [DecidableEq C] in +private theorem repeated_residual_width_le_inline_MatrixMultiplication_JointCompatibilityControls + {Pos : C → Type*} [∀ c, Fintype (Pos c)] [∀ c, DecidableEq (Pos c)] + (base : ∀ c, Shape c → ℕ) (d : ∀ c, Shape c → Prop) + (t : ℕ) (w : FixedClassWords Pos Shape (fun c u => t * base c u)) + (χ η δ : ℝ) (hδ : 0 ≤ δ) + (hnum : ∀ c, η + (designatedBase base d c : ℝ) * χ ≤ δ) (c : C) : + ((t : ℝ) * η + (∑ u : {u : Shape c // d c u}, ((t * base c u.val : ℕ) : ℝ)) * χ) / + Fintype.card {i : Pos c // ¬d c ((w c).val i)} ≤ δ := by + have hsum : (∑ u : {u : Shape c // d c u}, ((t * base c u.val : ℕ) : ℝ)) = + (t : ℝ) * designatedBase base d c := by + simp only [Nat.cast_mul, designatedBase, Nat.cast_sum, Finset.mul_sum] + rw [residual_card_repeated, hsum, Nat.cast_mul] + by_cases ht : t = 0 + · simpa only [ht, Nat.cast_zero, zero_mul, add_zero, zero_add, zero_div] using hδ + by_cases hr : residualBase base d c = 0 + · simpa only [hr, Nat.cast_zero, mul_zero, div_zero] using hδ + have htpos : (0 : ℝ) < t := Nat.cast_pos.mpr (Nat.pos_of_ne_zero ht) + have hrpos : (0 : ℝ) < residualBase base d c := Nat.cast_pos.mpr (Nat.pos_of_ne_zero hr) + have hrone : (1 : ℝ) ≤ residualBase base d c := by exact_mod_cast Nat.one_le_iff_ne_zero.mpr hr + have hres : η + (designatedBase base d c : ℝ) * χ ≤ δ * residualBase base d c := + (hnum c).trans (by simpa only [mul_one] using mul_le_mul_of_nonneg_left hrone hδ) + apply (div_le_iff₀ (mul_pos htpos hrpos)).mpr + calc + (t : ℝ) * η + ((t : ℝ) * designatedBase base d c) * χ = + (t : ℝ) * (η + (designatedBase base d c : ℝ) * χ) := by ring + _ ≤ (t : ℝ) * (δ * residualBase base d c) := + mul_le_mul_of_nonneg_left hres htpos.le + _ = δ * ((t : ℝ) * residualBase base d c) := by ring + +omit [DecidableEq C] in +theorem exists_uniform_sideEntropyControl + (Pos : ℕ → C → Type*) [∀ t c, Fintype (Pos t c)] [∀ t c, DecidableEq (Pos t c)] + (Pair : C → Type*) [∀ c, Fintype (Pair c)] [∀ c, DecidableEq (Pair c)] + (base : ∀ c, Shape c → ℕ) (d : ∀ c, Shape c → Prop) + (law : ∀ c, Shape c → A c → ℝ) (part : ∀ c, Pair c → A c) + (h0 : ∀ c u a, 0 ≤ law c u a) (h1 : ∀ c u a, law c u a ≤ 1) + {ε χMax ηMax : ℝ} (hε : 0 < ε) (hχMax : 0 < χMax) (hηMax : 0 < ηMax) : + ∃ χ η : ℝ, 0 < χ ∧ χ ≤ χMax ∧ 0 < η ∧ η ≤ ηMax ∧ + ∀ (t : ℕ) (pairCounts : ∀ c, Pair c → ℕ) + (w : FixedClassWords (Pos t) Shape (fun c u => t * base c u)), + (∀ c a, |((∑ s : {s : Pair c // part c s = a}, pairCounts c s.val : ℕ) : ℝ) - + (t : ℝ) * totalCenterCount base law c a| ≤ (t : ℝ) * η) → + Nonempty (SideEntropyControl (Pos t) Shape Pair A (fun c u => t * base c u) + pairCounts part d law χ (groupCap base d law ε) w) := by + obtain ⟨δ, hδ, hwindow⟩ := exists_group_entropy_window_inline_MatrixMultiplication_JointCompatibilityControls base d law hε + let D : ℕ := ∑ c, designatedBase base d c + have hD : (0 : ℝ) ≤ D := Nat.cast_nonneg _ + have hden : 0 < 2 * ((D : ℝ) + 1) := by positivity + let χ₀ : ℝ := δ / (2 * ((D : ℝ) + 1)) + have hχ₀ : 0 < χ₀ := div_pos hδ hden + have heq : (2 * ((D : ℝ) + 1)) * χ₀ = δ := mul_div_cancel₀ _ hden.ne' + have hχδ : χ₀ ≤ δ := by nlinarith [mul_nonneg hD hχ₀.le] + have hDχ : (D : ℝ) * χ₀ ≤ δ / 2 := by nlinarith + let χ := min χMax χ₀ + let η := min ηMax (δ / 2) + have hχ : 0 < χ := lt_min hχMax hχ₀ + have hη : 0 < η := lt_min hηMax (half_pos hδ) + have hχδ' : χ ≤ δ := (min_le_right _ _).trans hχδ + have hnum (c : C) : η + (designatedBase base d c : ℝ) * χ ≤ δ := by + have hc : (designatedBase base d c : ℝ) ≤ D := by + exact_mod_cast (Finset.single_le_sum (fun _ _ => Nat.zero_le _) + (Finset.mem_univ c) : designatedBase base d c ≤ ∑ c, designatedBase base d c) + have hm : (designatedBase base d c : ℝ) * χ ≤ (D : ℝ) * χ₀ := + mul_le_mul hc (min_le_right _ _) hχ.le hD + have he : η ≤ δ / 2 := min_le_right _ _ + linarith + refine ⟨χ, η, hχ, min_le_left _ _, hη, min_le_left _ _, ?_⟩ + intro t pairCounts w haggr + refine ⟨{ + residualLaw := residualCenter base d law + totalTarget := fun c a => (t : ℝ) * totalCenterCount base law c a + totalError := fun _ => (t : ℝ) * η + aggregate_window := haggr + mixture_balance := repeated_mixture_balance base d law t w + nonneg := groupCap_nonneg base d law h0 h1 hε.le + designated_entropy := ?_ + residual_entropy := ?_ }⟩ + · intro c u _ q hq + exact hwindow ⟨c, some u⟩ q (fun a => (hq a).trans hχδ') + · intro c q hq + exact hwindow ⟨c, none⟩ q (fun a => (hq a).trans + (repeated_residual_width_le_inline_MatrixMultiplication_JointCompatibilityControls base d t w χ η δ hδ.le hnum c)) + +def control_mono_width + {Pos Pair : C → Type*} + [∀ c, Fintype (Pos c)] [∀ c, DecidableEq (Pos c)] + [∀ c, Fintype (Pair c)] [∀ c, DecidableEq (Pair c)] + (shapeCounts : ∀ c, Shape c → ℕ) (pairCounts : ∀ c, Pair c → ℕ) + (part : ∀ c, Pair c → A c) (d : ∀ c, Shape c → Prop) + (law : ∀ c, Shape c → A c → ℝ) {χ χ' : ℝ} + (H : (Σ c, Option (Shape c)) → ℝ) + (w : FixedClassWords Pos Shape shapeCounts) + (control : SideEntropyControl Pos Shape Pair A shapeCounts pairCounts part d law χ H w) + (hχ : χ' ≤ χ) : + SideEntropyControl Pos Shape Pair A shapeCounts pairCounts part d law χ' H w where + residualLaw := control.residualLaw + totalTarget := control.totalTarget + totalError := control.totalError + aggregate_window := control.aggregate_window + mixture_balance := control.mixture_balance + nonneg := control.nonneg + designated_entropy c u hu q hq := + control.designated_entropy c u hu q (fun a => (hq a).trans hχ) + residual_entropy c q hq := by + apply control.residual_entropy c q + intro a + apply (hq a).trans + apply div_le_div_of_nonneg_right _ (Nat.cast_nonneg _) + apply add_le_add (le_refl _) + exact mul_le_mul_of_nonneg_left hχ (Finset.sum_nonneg fun _ _ => Nat.cast_nonneg _) + +end MatrixMultiplication.JointCompatibilityControls + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section + +namespace MatrixMultiplication.JointPairMixtureControls + +open JointCompatibilityControls JointCompatibilityScaling +open scoped BigOperators + +attribute [local instance] Classical.propDecidable + +variable {C : Type*} [Fintype C] [DecidableEq C] + {Shape A B : C → Type*} + [∀ c, Fintype (Shape c)] [∀ c, DecidableEq (Shape c)] + [∀ c, Fintype (A c)] [∀ c, DecidableEq (A c)] + [∀ c, Fintype (B c)] [∀ c, DecidableEq (B c)] + +def pairMixture (base : ∀ c, Shape c → ℕ) + (left : ∀ c, Shape c → A c → ℝ) (right : ∀ c, Shape c → B c → ℝ) + (c : C) (ab : A c × B c) : ℝ := + (∑ u, (base c u : ℝ) * left c u ab.1 * right c u ab.2) / baseSize base c + +omit [Fintype C] [DecidableEq C] [∀ c, DecidableEq (B c)] in +theorem sum_first_fiber (c : C) (q : A c × B c → ℝ) (a : A c) : + (∑ ab : {ab : A c × B c // ab.1 = a}, q ab.val) = ∑ b, q (a, b) := by + let e : B c ≃ {ab : A c × B c // ab.1 = a} := + { toFun := fun b => ⟨(a, b), rfl⟩ + invFun := fun ab => ab.val.2 + left_inv := fun _ => rfl + right_inv := fun ab => by apply Subtype.ext; exact Prod.ext ab.property.symm rfl } + exact (e.sum_comp (fun ab => q ab.val)).symm + +omit [Fintype C] [DecidableEq C] [∀ c, DecidableEq (A c)] in +theorem sum_second_fiber (c : C) (q : A c × B c → ℝ) (b : B c) : + (∑ ab : {ab : A c × B c // ab.2 = b}, q ab.val) = ∑ a, q (a, b) := by + let e : A c ≃ {ab : A c × B c // ab.2 = b} := + { toFun := fun a => ⟨(a, b), rfl⟩ + invFun := fun ab => ab.val.1 + left_inv := fun _ => rfl + right_inv := fun ab => by apply Subtype.ext; exact Prod.ext rfl ab.property.symm } + exact (e.sum_comp (fun ab => q ab.val)).symm + +omit [Fintype C] [DecidableEq C] [∀ c, DecidableEq (Shape c)] in +theorem base_eq_zero_of_size_eq_zero (base : ∀ c, Shape c → ℕ) + (c : C) (hz : baseSize base c = 0) (u : Shape c) : base c u = 0 := + Nat.eq_zero_of_le_zero ((Finset.single_le_sum (fun _ _ => Nat.zero_le _) + (Finset.mem_univ u)).trans_eq hz) + +omit [Fintype C] [DecidableEq C] [∀ c, DecidableEq (Shape c)] + [∀ c, Fintype (A c)] [∀ c, DecidableEq (A c)] in +theorem totalCenterCount_eq_zero_of_size_eq_zero (base : ∀ c, Shape c → ℕ) + (law : ∀ c, Shape c → A c → ℝ) (c : C) (hz : baseSize base c = 0) (a : A c) : + totalCenterCount base law c a = 0 := by + simp only [totalCenterCount, base_eq_zero_of_size_eq_zero base c hz, + Nat.cast_zero, zero_mul, Finset.sum_const_zero] + +omit [Fintype C] [DecidableEq C] [∀ c, DecidableEq (Shape c)] + [∀ c, DecidableEq (B c)] in +theorem pairMixture_left_balance (base : ∀ c, Shape c → ℕ) + (left : ∀ c, Shape c → A c → ℝ) (right : ∀ c, Shape c → B c → ℝ) + (hnormalized : ∀ c u, 0 < base c u → ∑ b, right c u b = 1) + (c : C) (a : A c) : + (baseSize base c : ℝ) * + (∑ ab : {ab : A c × B c // ab.1 = a}, pairMixture base left right c ab.val) = + totalCenterCount base left c a := by + rw [sum_first_fiber] + simp only [pairMixture, ← Finset.sum_div] + have hnum : (∑ b : B c, ∑ u : Shape c, + (base c u : ℝ) * left c u a * right c u b) = totalCenterCount base left c a := by + rw [Finset.sum_comm] + apply Finset.sum_congr rfl + intro u _ + by_cases hu : base c u = 0 + · simp [hu] + · rw [← Finset.mul_sum, hnormalized c u (Nat.pos_of_ne_zero hu), mul_one] + rw [hnum] + by_cases hz : baseSize base c = 0 + · rw [totalCenterCount_eq_zero_of_size_eq_zero base left c hz a] + simp + · exact mul_div_cancel₀ _ (Nat.cast_ne_zero.mpr hz) + +omit [Fintype C] [DecidableEq C] [∀ c, DecidableEq (Shape c)] + [∀ c, DecidableEq (A c)] in +theorem pairMixture_right_balance (base : ∀ c, Shape c → ℕ) + (left : ∀ c, Shape c → A c → ℝ) (right : ∀ c, Shape c → B c → ℝ) + (hnormalized : ∀ c u, 0 < base c u → ∑ a, left c u a = 1) + (c : C) (b : B c) : + (baseSize base c : ℝ) * + (∑ ab : {ab : A c × B c // ab.2 = b}, pairMixture base left right c ab.val) = + totalCenterCount base right c b := by + rw [sum_second_fiber] + simp only [pairMixture, ← Finset.sum_div] + have hnum : (∑ a : A c, ∑ u : Shape c, + (base c u : ℝ) * left c u a * right c u b) = totalCenterCount base right c b := by + rw [Finset.sum_comm] + apply Finset.sum_congr rfl + intro u _ + by_cases hu : base c u = 0 + · simp [hu] + · rw [← Finset.sum_mul, ← Finset.mul_sum, + hnormalized c u (Nat.pos_of_ne_zero hu), mul_one] + rw [hnum] + by_cases hz : baseSize base c = 0 + · rw [totalCenterCount_eq_zero_of_size_eq_zero base right c hz b] + simp + · exact mul_div_cancel₀ _ (Nat.cast_ne_zero.mpr hz) + +end MatrixMultiplication.JointPairMixtureControls + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section + +namespace MatrixMultiplication.AllFieldGroupPairWindows + +open MatrixMultiplication.Foundation AllFieldHistory AllFieldHistorySupport +open AllFieldHistoryChildLaws AllFieldHistoryMasks AllFieldHistoryMaskLaws +open AllFieldHistoryGroupMasks AllFieldHistoryGroupedRecovery +open AllFieldGroupOrbitData AllFieldGroupDegrees AllFieldGroupNativeLaws +open JointCompatibilityScaling JointCompatibilityRateLimit +open scoped BigOperators +attribute [local instance] Classical.propDecidable + +variable {K tick : ℕ} {sigma : Placement} + +def base (allocation : Allocation) (sigma : Placement) (side : Fin 3) := + JointPopulationCompatibility.classCounts + (Counts (K := K) (tick := tick) allocation 1 sigma) (sigma side) + +def q (allocation : Allocation) (sigma : Placement) (side : Fin 3) + (c : Class (K := K) (tick := tick) sigma) : Symbol (K := K) (tick := tick) sigma c × Symbol (K := K) (tick := tick) sigma c → ℝ := + JointPairMixtureControls.pairMixture (base (K := K) (tick := tick) allocation sigma side) + (fun c u => supportedHalfLaw allocation false c.1.val u (sigma side)) + (fun c u => supportedHalfLaw allocation true c.1.val u (sigma side)) c + +abbrev Positions (allocation : Allocation) (m : ℕ) (sigma : Placement) + (w : Raw (K := K) (tick := tick) allocation m sigma) := + JointPopulationCompatibility.ClassPos (Counts (K := K) (tick := tick) allocation m sigma) + (ownWord (K := K) (tick := tick) allocation m sigma w) + +def pairCounts (allocation : Allocation) (m : ℕ) (sigma : Placement) + (w : Raw (K := K) (tick := tick) allocation m sigma) := + JointPopulationCompatibility.statisticCounts (Counts (K := K) (tick := tick) allocation m sigma) + (Letter (K := K) (tick := tick) sigma) (Letter (K := K) (tick := tick) sigma) (Symbol (K := K) (tick := tick) sigma) (Symbol (K := K) (tick := tick) sigma) + (projectedStatistic (K := K) (tick := tick) sigma) (projectedStatistic (K := K) (tick := tick) sigma) + (ownWord (K := K) (tick := tick) allocation m sigma w) w + +def parentBase (allocation : Allocation) (h : ActiveOrder K tick sigma) : ℕ := + population allocation 1 (h.val.val.1.source, h.val.val.2) + +def parentPair (allocation : Allocation) (sigma : Placement) (side : Fin 3) + (h : ActiveOrder K tick sigma) (a : Statistic h.val × Statistic h.val) : ℝ := + (∑ u, (activeCounts allocation 1 h.val u : ℝ) * + supportedHalfLaw allocation false h.val u (sigma side) a.1 * + supportedHalfLaw allocation true h.val u (sigma side) a.2) / parentBase (K := K) (tick := tick) allocation h + +def classMass (allocation : Allocation) (sigma : Placement) (side : Fin 3) + (c : Class (K := K) (tick := tick) sigma) : ℝ := + (baseSize (base (K := K) (tick := tick) allocation sigma side) c : ℝ) / parentBase (K := K) (tick := tick) allocation c.1 + +def windowFactor (allocation : Allocation) (sigma : Placement) : ℝ := + 1 + ∑ h : ActiveOrder K tick sigma, (parentBase (K := K) (tick := tick) allocation h : ℝ) + +theorem windowFactor_pos (allocation : Allocation) (sigma : Placement) : + 0 < windowFactor (K := K) (tick := tick) allocation sigma := by + unfold windowFactor + positivity + +theorem parentBase_pos (allocation : Allocation) (h : ActiveOrder K tick sigma) : + 0 < parentBase (K := K) (tick := tick) allocation h := + AllFieldHistorySupport.work_source_population_pos allocation (by decide : 0 < (1 : ℕ)) h.val.val + +theorem parent_positions_card (allocation : Allocation) (m : ℕ) (sigma : Placement) + (h : ActiveOrder K tick sigma) : + Fintype.card (JointPopulation.Positions (Counts (K := K) (tick := tick) allocation m sigma) h) = + m * parentBase (K := K) (tick := tick) allocation h := by + change Fintype.card (Fin (∑ u, jointCounts allocation m h.val.val u)) = _ + rw [Fintype.card_fin, jointCounts_sum] + exact population_dilation allocation m _ + +theorem positions_card (allocation : Allocation) (m : ℕ) (ε : ℝ) (sigma : Placement) + (side : Fin 3) (e : Targets (K := K) (tick := tick) allocation m sigma) + (w : Raw (K := K) (tick := tick) allocation m sigma) (hw : Admissible allocation m ε sigma side e w) + (c : Class (K := K) (tick := tick) sigma) : + Fintype.card (Positions (K := K) (tick := tick) allocation m sigma w c) = + m * baseSize (base (K := K) (tick := tick) allocation sigma side) c := by + have he : JointPopulationCompatibility.FixedSideTargets (Counts (K := K) (tick := tick) allocation m sigma) + (sigma side) (ownWord (K := K) (tick := tick) allocation m sigma w) := + ⟨e, fun h j => (hw.1.1 h j).symm⟩ + rw [JointPopulationCompatibility.classCounts_size + (Counts (K := K) (tick := tick) allocation m sigma) (sigma side) (ownWord (K := K) (tick := tick) allocation m sigma w) he c] + simp only [JointPopulationCompatibility.classCounts, Counts, groupCounts, + activeCounts_dilation allocation m, base, baseSize, Finset.mul_sum, mul_ite, mul_zero] + +theorem parentPair_eq_parentCenter (allocation : Allocation) (sigma : Placement) + (side : Fin 3) (h : ActiveOrder K tick sigma) + (a : Statistic h.val × Statistic h.val) : + parentPair (K := K) (tick := tick) allocation sigma side h a = parentCenter allocation (sigma side) h.val a.1 a.2 := by + unfold parentPair parentCenter parentBase + rw [Finset.sum_div] + apply Finset.sum_congr rfl + intro u _ + by_cases hu : 0 < activeCounts allocation 1 h.val u + · simp only [supportedHalfLaw, ite_eq_left hu, halfLawAt, Bool.false_eq_true, + ite_false, ite_true] + ring + · have hz := Nat.eq_zero_of_not_pos hu + simp only [hz, Nat.cast_zero, zero_mul, zero_div] + +theorem parentPair_eq_native (allocation : Allocation) (sigma : Placement) + (side : Fin 3) (h : ActiveOrder K tick sigma) + (a : Statistic h.val × Statistic h.val) : + parentPair (K := K) (tick := tick) allocation sigma side h a = orderPairMixture h side a := by + rw [parentPair_eq_parentCenter] + unfold parentCenter orderPairMixture + apply Finset.sum_congr rfl + intro u _ + rw [show (activeCounts allocation 1 h.val u : ℝ) / + population allocation 1 (h.val.val.1.source, h.val.val.2) = + (AllFieldActiveLaws.orderLaw h).mass u from + AllFieldActiveLaws.jointCounts_ratio allocation (by decide : 0 < (1 : ℕ)) h.val.val u] + ring + +def parentStatistic (allocation : Allocation) (m : ℕ) (sigma : Placement) + (w : Raw (K := K) (tick := tick) allocation m sigma) (h : ActiveOrder K tick sigma) + (j : JointPopulation.Positions (Counts (K := K) (tick := tick) allocation m sigma) h) : + Statistic h.val × Statistic h.val := + (statistic h.val (w h j).1, statistic h.val (w h j).2) + +theorem parent_window (allocation : Allocation) (m : ℕ) (ε : ℝ) (sigma : Placement) + (side : Fin 3) (w : Raw (K := K) (tick := tick) allocation m sigma) + (hw : AllFieldHistoryGroupMasks.rawPass allocation m ε (sigma side) sigma w) + (h : ActiveOrder K tick sigma) (a : Statistic h.val × Statistic h.val) : + |(wordPopulation (parentStatistic (K := K) (tick := tick) allocation m sigma w h) a : ℝ) / + Fintype.card (JointPopulation.Positions (Counts (K := K) (tick := tick) allocation m sigma) h) - + parentPair (K := K) (tick := tick) allocation sigma side h a| ≤ pairWidth ε h.val := by + let defaults : SymbolChoice K tick := fun h => statistic h (fun _ => 0) + let l : SymbolChoice K tick := Function.update defaults h.val a.1 + let r : SymbolChoice K tick := Function.update defaults h.val a.2 + have hp := hw (h.val, l, r) h.property + rw [center_eq_parentCenter] at hp + simp only [l, r, Function.update_self] at hp + rw [parentPair_eq_parentCenter] + have hpop : Fintype.card (JointPopulation.Positions (Counts (K := K) (tick := tick) allocation m sigma) h) = + population allocation m (h.val.val.1.source, h.val.val.2) := by + change Fintype.card (Fin (∑ u, jointCounts allocation m h.val.val u)) = _ + rw [Fintype.card_fin] + exact jointCounts_sum allocation m h.val.val + rw [hpop] + have hcount : (wordPopulation (parentStatistic (K := K) (tick := tick) allocation m sigma w h) a : ℝ) = + ∑ j : JointPopulation.Positions (activeCounts allocation m) h.val, + if statistic h.val (w h j).1 = a.1 ∧ statistic h.val (w h j).2 = a.2 + then (1 : ℝ) else 0 := by + rcases a with ⟨a₁, a₂⟩ + simp only [wordPopulation, Fintype.card_subtype, Finset.card_eq_sum_ones, + Finset.sum_filter, Nat.cast_sum, Nat.cast_ite, Nat.cast_one, Nat.cast_zero, + parentStatistic, Prod.mk.injEq] + apply Finset.sum_congr rfl + intro j _ + split_ifs <;> rfl + rw [hcount] + exact hp + +def weightCode {K : ℕ} (w : Work K) : w.Statistic → Fin 17 := + match w with + | .stageA _ => AllFieldPairMarginals.halfWeightCode + | .stageB _ => AllFieldPairMarginals.statisticWeightCode + | .stageC _ => fun _ => 0 + +@[simp] theorem weightCode_val {K : ℕ} (w : Work K) (a : w.Statistic) : + (weightCode w a).val = w.statisticWeight a := by + cases w <;> rfl + +theorem weightCode_statistic {K : ℕ} (w : Work K) (hs : w.stage ≠ 2) + (x : CWWindowedLeaves.Raw w.halfLength) : + (weightCode w (w.statistic x)).val = CWStrands.weight x := + (weightCode_val w _).trans (w.statistic_weight hs x).symm + +theorem left_supported_zero (allocation : Allocation) (sigma : Placement) (side : Fin 3) + (h : ActiveOrder K tick sigma) (hs : h.val.val.1.stage ≠ 2) + (u : JointPopulation.Shape) (a : Statistic h.val) + (ha : weightCode h.val.val.1 a ≠ JointPopulation.shapeSide (sigma side) u) : + supportedHalfLaw allocation false h.val u (sigma side) a = 0 := by + by_cases hu : 0 < activeCounts allocation 1 h.val u + · rw [supportedHalfLaw_eq_of_counts_pos allocation 1 false h.val u hu, halfLawAt_eq] + apply Rat.cast_eq_zero.mpr + apply h.val.val.1.childLaw_outside_support hs _ + (halfShape_mem_of_counts_pos allocation 1 false h.val u hu) _ a + rw [halfShape_childWeight] + simpa only [childWeight, Bool.false_eq_true, ite_false, ← weightCode_val, + ne_eq, Fin.ext_iff] using ha + · simp only [supportedHalfLaw, ite_eq_right hu] + +theorem filtered_pair_sum (allocation : Allocation) (sigma : Placement) (side : Fin 3) + (c : Class (K := K) (tick := tick) sigma) (hs : c.1.val.val.1.stage ≠ 2) + (a : Symbol (K := K) (tick := tick) sigma c × Symbol (K := K) (tick := tick) sigma c) : + (∑ u, (base (K := K) (tick := tick) allocation sigma side c u : ℝ) * + supportedHalfLaw allocation false c.1.val u (sigma side) a.1 * + supportedHalfLaw allocation true c.1.val u (sigma side) a.2) = + if weightCode c.1.val.val.1 a.1 = c.2 then + ∑ u, (activeCounts allocation 1 c.1.val u : ℝ) * + supportedHalfLaw allocation false c.1.val u (sigma side) a.1 * + supportedHalfLaw allocation true c.1.val u (sigma side) a.2 + else 0 := by + have hterm (u : JointPopulation.Shape) : + (base (K := K) (tick := tick) allocation sigma side c u : ℝ) * + supportedHalfLaw allocation false c.1.val u (sigma side) a.1 * + supportedHalfLaw allocation true c.1.val u (sigma side) a.2 = + if weightCode c.1.val.val.1 a.1 = c.2 then + (activeCounts allocation 1 c.1.val u : ℝ) * + supportedHalfLaw allocation false c.1.val u (sigma side) a.1 * + supportedHalfLaw allocation true c.1.val u (sigma side) a.2 + else 0 := by + by_cases hu : JointPopulation.shapeSide (sigma side) u = c.2 + · simp only [base, JointPopulationCompatibility.classCounts, Counts, groupCounts, + hu, ite_true] + by_cases ha : weightCode c.1.val.val.1 a.1 = c.2 + · rw [ite_eq_left ha] + · have hz := left_supported_zero (K := K) (tick := tick) allocation sigma side c.1 hs u a.1 + (fun he => ha (he.trans hu)) + simp only [ha, ite_false, hz, mul_zero, zero_mul] + · simp only [base, JointPopulationCompatibility.classCounts, Counts, groupCounts, + hu, ite_false, Nat.cast_zero, zero_mul] + by_cases ha : weightCode c.1.val.val.1 a.1 = c.2 + · have hz := left_supported_zero (K := K) (tick := tick) allocation sigma side c.1 hs u a.1 + (fun he => hu (he.symm.trans ha)) + simp only [ha, ite_true, hz, mul_zero, zero_mul] + · rw [ite_eq_right ha] + simp_rw [hterm] + split_ifs <;> simp + +theorem q_eq_conditionalCenter (allocation : Allocation) (sigma : Placement) (side : Fin 3) + (c : Class (K := K) (tick := tick) sigma) (hs : c.1.val.val.1.stage ≠ 2) : + q (K := K) (tick := tick) allocation sigma side c = JointPairClassWindows.conditionalCenter + (fun a : Symbol (K := K) (tick := tick) sigma c × Symbol (K := K) (tick := tick) sigma c => weightCode c.1.val.val.1 a.1) + c.2 (parentPair (K := K) (tick := tick) allocation sigma side c.1) (classMass (K := K) (tick := tick) allocation sigma side c) := by + funext a + rw [q, JointPairMixtureControls.pairMixture, filtered_pair_sum (K := K) (tick := tick) allocation sigma side c hs] + unfold JointPairClassWindows.conditionalCenter parentPair classMass + by_cases ha : weightCode c.1.val.val.1 a.1 = c.2 + · simp only [ha, ite_true] + have hp : (parentBase (K := K) (tick := tick) allocation c.1 : ℝ) ≠ 0 := + Nat.cast_ne_zero.mpr (Nat.ne_of_gt (parentBase_pos (K := K) (tick := tick) allocation c.1)) + rw [div_div_div_cancel_right₀ hp] + · simp only [ha, ite_false, zero_div] + +theorem classMass_pos (allocation : Allocation) (sigma : Placement) (side : Fin 3) + (c : Class (K := K) (tick := tick) sigma) + (hc : 0 < baseSize (base (K := K) (tick := tick) allocation sigma side) c) : + 0 < classMass (K := K) (tick := tick) allocation sigma side c := + div_pos (Nat.cast_pos.mpr hc) (Nat.cast_pos.mpr (parentBase_pos (K := K) (tick := tick) allocation c.1)) + +theorem fiber_mass (allocation : Allocation) (m : ℕ) (ε : ℝ) (sigma : Placement) + (side : Fin 3) (e : Targets (K := K) (tick := tick) allocation m sigma) + (w : Raw (K := K) (tick := tick) allocation m sigma) (hw : Admissible allocation m ε sigma side e w) + (c : Class (K := K) (tick := tick) sigma) : + (Fintype.card (Positions (K := K) (tick := tick) allocation m sigma w c) : ℝ) = + (Fintype.card (JointPopulation.Positions (Counts (K := K) (tick := tick) allocation m sigma) c.1) : ℝ) * + classMass (K := K) (tick := tick) allocation sigma side c := by + rw [positions_card (K := K) (tick := tick) allocation m ε sigma side e w hw, parent_positions_card] + rw [Nat.cast_mul, Nat.cast_mul] + unfold classMass + have hp : (parentBase (K := K) (tick := tick) allocation c.1 : ℝ) ≠ 0 := + Nat.cast_ne_zero.mpr (Nat.ne_of_gt (parentBase_pos (K := K) (tick := tick) allocation c.1)) + rw [mul_assoc, mul_div_cancel₀ _ hp] + +theorem width_le (allocation : Allocation) {ε : ℝ} (hε : 0 ≤ ε) + (sigma : Placement) (side : Fin 3) (c : Class (K := K) (tick := tick) sigma) + (hc : 0 < baseSize (base (K := K) (tick := tick) allocation sigma side) c) : + pairWidth ε c.1.val / classMass (K := K) (tick := tick) allocation sigma side c ≤ + windowFactor (K := K) (tick := tick) allocation sigma * ε := by + have hpw : 0 ≤ pairWidth ε c.1.val := by unfold pairWidth; positivity + have hw : pairWidth ε c.1.val ≤ ε := + div_le_self hε (one_le_pow₀ (by norm_num)) + have hb : (1 : ℝ) ≤ baseSize (base (K := K) (tick := tick) allocation sigma side) c := by exact_mod_cast hc + have hn : (parentBase (K := K) (tick := tick) allocation c.1 : ℝ) ≤ windowFactor (K := K) (tick := tick) allocation sigma := by + unfold windowFactor + exact (Finset.single_le_sum (fun _ _ => Nat.cast_nonneg _) (Finset.mem_univ c.1)).trans + (le_add_of_nonneg_left zero_le_one) + unfold classMass + rw [div_div_eq_mul_div] + calc + pairWidth ε c.1.val * (parentBase (K := K) (tick := tick) allocation c.1 : ℝ) / + (baseSize (base (K := K) (tick := tick) allocation sigma side) c : ℝ) ≤ + pairWidth ε c.1.val * (parentBase (K := K) (tick := tick) allocation c.1 : ℝ) := + div_le_self (mul_nonneg hpw (Nat.cast_nonneg _)) hb + _ ≤ ε * windowFactor (K := K) (tick := tick) allocation sigma := mul_le_mul hw hn (Nat.cast_nonneg _) hε + _ = _ := mul_comm _ _ + +theorem sharing_window (allocation : Allocation) (m : ℕ) {ε : ℝ} (hε : 0 ≤ ε) + (sigma : Placement) (side : Fin 3) + (e : Targets (K := K) (tick := tick) allocation m sigma) + (w : Raw (K := K) (tick := tick) allocation m sigma) (hw : Admissible allocation m ε sigma side e w) + (hp : AllFieldHistoryGroupMasks.rawPass allocation m ε (sigma side) sigma w) + (c : Class (K := K) (tick := tick) sigma) (hs : c.1.val.val.1.stage ≠ 2) + (hc : 0 < baseSize (base (K := K) (tick := tick) allocation sigma side) c) + (a : Symbol (K := K) (tick := tick) sigma c × Symbol (K := K) (tick := tick) sigma c) : + |(pairCounts (K := K) (tick := tick) allocation m sigma w c a : ℝ) / + Fintype.card (Positions (K := K) (tick := tick) allocation m sigma w c) - q (K := K) (tick := tick) allocation sigma side c a| ≤ + windowFactor (K := K) (tick := tick) allocation sigma * ε := by + let z := parentStatistic (K := K) (tick := tick) allocation m sigma w c.1 + let k : JointPopulation.Positions (Counts (K := K) (tick := tick) allocation m sigma) c.1 → Fin 17 := + fun j => ownWord (K := K) (tick := tick) allocation m sigma w ⟨c.1, j⟩ + let f : Symbol (K := K) (tick := tick) sigma c × Symbol (K := K) (tick := tick) sigma c → Fin 17 := + fun a => weightCode c.1.val.val.1 a.1 + have hf (j) : f (z j) = k j := by + apply Fin.ext + exact weightCode_statistic c.1.val.val.1 hs (w c.1 j).1 + have hη : 0 ≤ pairWidth ε c.1.val := by unfold pairWidth; positivity + have hh := JointPairClassWindows.fiber_window z k f hf c.2 + (parentPair (K := K) (tick := tick) allocation sigma side c.1) (classMass (K := K) (tick := tick) allocation sigma side c) + (pairWidth ε c.1.val) (classMass_pos (K := K) (tick := tick) allocation sigma side c hc) hη + (fiber_mass (K := K) (tick := tick) allocation m ε sigma side e w hw c) + (parent_window (K := K) (tick := tick) allocation m ε sigma side w hp c.1) a + rw [← q_eq_conditionalCenter (K := K) (tick := tick) allocation sigma side c hs] at hh + exact hh.trans (width_le (K := K) (tick := tick) allocation hε sigma side c hc) + +theorem q_eq_one_of_subsingleton (allocation : Allocation) (sigma : Placement) (side : Fin 3) + (c : Class (K := K) (tick := tick) sigma) [Subsingleton (Symbol (K := K) (tick := tick) sigma c)] + (hc : 0 < baseSize (base (K := K) (tick := tick) allocation sigma side) c) + (a : Symbol (K := K) (tick := tick) sigma c × Symbol (K := K) (tick := tick) sigma c) : q (K := K) (tick := tick) allocation sigma side c a = 1 := by + have hl (right : Bool) (u : JointPopulation.Shape) + (hu : 0 < base (K := K) (tick := tick) allocation sigma side c u) : + supportedHalfLaw allocation right c.1.val u (sigma side) (if right then a.2 else a.1) = 1 := by + have hu' : 0 < activeCounts allocation 1 c.1.val u := by + unfold base JointPopulationCompatibility.classCounts Counts groupCounts at hu + split_ifs at hu with he + · exact hu + · omega + rw [supportedHalfLaw_eq_of_counts_pos allocation 1 right c.1.val u hu'] + have ht := halfLawAt_normalized allocation 1 right c.1.val u hu' (sigma side) + have he : (∑ b, halfLawAt right c.1.val u (sigma side) b) = + halfLawAt right c.1.val u (sigma side) (if right then a.2 else a.1) := + Fintype.sum_subsingleton _ _ + exact he.symm.trans ht + unfold q JointPairMixtureControls.pairMixture + have hn : (∑ u, (base (K := K) (tick := tick) allocation sigma side c u : ℝ) * + supportedHalfLaw allocation false c.1.val u (sigma side) a.1 * + supportedHalfLaw allocation true c.1.val u (sigma side) a.2) = + (baseSize (base (K := K) (tick := tick) allocation sigma side) c : ℝ) := by + rw [baseSize, Nat.cast_sum] + apply Finset.sum_congr rfl + intro u _ + by_cases hu : 0 < base (K := K) (tick := tick) allocation sigma side c u + · have hleft : supportedHalfLaw allocation false c.1.val u (sigma side) a.1 = 1 := by + simpa only [Bool.false_eq_true, ite_false] using hl false u hu + have hright : supportedHalfLaw allocation true c.1.val u (sigma side) a.2 = 1 := by + simpa only [ite_true] using hl true u hu + rw [hleft, hright, mul_one, mul_one] + · simp only [Nat.eq_zero_of_not_pos hu, Nat.cast_zero, zero_mul] + rw [hn] + exact div_self (Nat.cast_ne_zero.mpr (Nat.ne_of_gt hc)) + +theorem pairWindow_of_completeKeep (allocation : Allocation) {m : ℕ} (hm : 0 < m) + {ε : ℝ} (hε : 0 ≤ ε) (sigma : Placement) (side : Fin 3) + (e : Targets (K := K) (tick := tick) allocation m sigma) + (w : Raw (K := K) (tick := tick) allocation m sigma) (hw : Admissible allocation m ε sigma side e w) + (hp : completeKeep allocation m ε (sigma side) sigma w) : + PairWindow (base (K := K) (tick := tick) allocation sigma side) (q (K := K) (tick := tick) allocation sigma side) + (Positions (K := K) (tick := tick) allocation m sigma w) (pairCounts (K := K) (tick := tick) allocation m sigma w) + (windowFactor (K := K) (tick := tick) allocation sigma * ε) := by + intro c hc a + by_cases hs : c.1.val.val.1.stage ≠ 2 + · exact sharing_window (K := K) (tick := tick) allocation m hε sigma side e w hw hp.2.2 c hs hc a + · have hstage : c.1.val.val.1.stage = 2 := not_ne_iff.mp hs + have : Subsingleton (Symbol (K := K) (tick := tick) sigma c) := by + change Subsingleton c.1.val.val.1.Statistic + cases hh : c.1.val.val.1 with + | stageA h => simp [hh, Work.stage] at hstage + | stageB h => simp [hh, Work.stage] at hstage + | stageC h => dsimp [Work.Statistic]; infer_instance + have hpc : pairCounts (K := K) (tick := tick) allocation m sigma w c a = + Fintype.card (Positions (K := K) (tick := tick) allocation m sigma w c) := by + unfold pairCounts JointPopulationCompatibility.statisticCounts + have hall : ∀ i, JointPopulationCompatibility.statisticWord + (Counts (K := K) (tick := tick) allocation m sigma) (Letter (K := K) (tick := tick) sigma) (Letter (K := K) (tick := tick) sigma) (Symbol (K := K) (tick := tick) sigma) (Symbol (K := K) (tick := tick) sigma) + (projectedStatistic (K := K) (tick := tick) sigma) (projectedStatistic (K := K) (tick := tick) sigma) + (ownWord (K := K) (tick := tick) allocation m sigma w) w c i = a := fun _ => Subsingleton.elim _ _ + simp [wordPopulation, hall] + have hn : (Fintype.card (Positions (K := K) (tick := tick) allocation m sigma w c) : ℝ) ≠ 0 := by + rw [positions_card (K := K) (tick := tick) allocation m ε sigma side e w hw c] + exact Nat.cast_ne_zero.mpr (Nat.ne_of_gt (Nat.mul_pos hm hc)) + rw [hpc, div_self hn, q_eq_one_of_subsingleton (K := K) (tick := tick) allocation sigma side c hc a, + sub_self, abs_zero] + exact mul_nonneg (windowFactor_pos (K := K) (tick := tick) allocation sigma).le hε + +theorem passing_pairWindow (allocation : Allocation) {m : ℕ} (hm : 0 < m) + {ε : ℝ} (hε : 0 ≤ ε) (sigma : Placement) + (e : Targets (K := K) (tick := tick) allocation m sigma) + (o : Orbit (K := K) (tick := tick) allocation m sigma) (ho : o ∈ (data (K := K) (tick := tick) allocation m ε sigma).orbits e) + (v : Variable (K := K) (tick := tick) allocation m sigma) (hv : v ∈ (data (K := K) (tick := tick) allocation m ε sigma).passing e o) : + PairWindow (base (K := K) (tick := tick) allocation sigma v.1) (q (K := K) (tick := tick) allocation sigma v.1) + (Positions (K := K) (tick := tick) allocation m sigma v.2) (pairCounts (K := K) (tick := tick) allocation m sigma v.2) + (windowFactor (K := K) (tick := tick) allocation sigma * ε) := by + have hpass := (mem_passing allocation m ε sigma e o v).mp hv + exact pairWindow_of_completeKeep (K := K) (tick := tick) allocation hm hε sigma v.1 e v.2 + (AllFieldGroupAdmissible.full_admissible allocation m ε sigma e o ho v hpass.1) hpass.2 + +end MatrixMultiplication.AllFieldGroupPairWindows + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/Extraction/GroupSelection.lean b/lean/OAI/LinearAlgebra/MatrixFields/Extraction/GroupSelection.lean new file mode 100644 index 0000000000000000000000000000000000000000..7a8c3d443ec662d1f5d473bcad9019b0d20ed14c --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/Extraction/GroupSelection.lean @@ -0,0 +1,169 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Construction.GroupDegreeEnvelope +import OAI.LinearAlgebra.MatrixFields.Construction.GroupNativeDegreeBound + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section + +namespace MatrixMultiplication.AllFieldGroupSelection + +open MatrixMultiplication.Foundation AllFieldHistory AllFieldActiveLaws +open AllFieldActiveCapacity AllFieldScheduledYield AllFieldNativeCapacity +open scoped BigOperators +attribute [local instance] Classical.propDecidable + +variable {K tick : ℕ} + +def orbitPrefactor (allocation : Allocation) (sigma : Placement) : ℕ := + 3 * (AllFieldHistoryOrbitCount.basePopulationBound (K := K) (tick := tick) + allocation + 1) ^ AllFieldGroupOrbitCount.groupDegree K tick sigma + +theorem data_orbits_card_le (allocation : Allocation) (m : ℕ) (ε : ℝ) + (sigma : Placement) + (e : AllFieldGroupOrbitData.Targets (K := K) (tick := tick) allocation m sigma) : + ((AllFieldGroupOrbitData.data (K := K) (tick := tick) allocation m ε sigma).orbits e).card ≤ + orbitPrefactor (K := K) (tick := tick) allocation sigma * + (m + 1) ^ AllFieldGroupOrbitCount.groupDegree K tick sigma := by + have hb := AllFieldGroupOrbitData.orbits_card_le allocation m ε sigma e + unfold orbitPrefactor AllFieldGroupOrbitCount.groupOrbitPrefactor at * + exact_mod_cast hb + +theorem data_coarse_injective (allocation : Allocation) (m : ℕ) (ε : ℝ) + (sigma : Placement) : + Function.Injective + (AllFieldGroupOrbitData.data (K := K) (tick := tick) allocation m ε sigma).coarse := + AllFieldGroupOrbitData.coarse_injective allocation m sigma + +structure Selected (allocation : Allocation) (m : ℕ) (width : ℝ) + (sigma : Placement) (slack : ℝ) where + sample : JointCoarseHashing.Sample + (AllFieldGroupOrbitData.Pos (K := K) (tick := tick) allocation m sigma) + (JointOrdinarySelection.hashLevel + (selectionHashRate (K := K) (tick := tick) allocation sigma slack) m) + targets : Finset (AllFieldGroupOrbitData.Targets + (K := K) (tick := tick) allocation m sigma) + card_targets : targets.card = + ⌊Real.exp ((m : ℝ) * (nativeCapacity (K := K) (tick := tick) allocation - slack))⌋₊ + good : ∀ e ∈ targets, + (AllFieldGroupOrbitData.data (K := K) (tick := tick) allocation m width sigma).Good + (JointOrdinarySelection.hashLevel + (selectionHashRate (K := K) (tick := tick) allocation sigma slack) m) + (JointOrdinarySelection.hashSet + (selectionHashRate (K := K) (tick := tick) allocation sigma slack) m) + (m : ℝ) e sample + distinct_first : ∀ e ∈ targets, ∀ f ∈ targets, e ≠ f → + (AllFieldGroupOrbitData.coarse (K := K) (tick := tick) allocation m sigma e).1 ≠ + (AllFieldGroupOrbitData.coarse (K := K) (tick := tick) allocation m sigma f).1 + +end MatrixMultiplication.AllFieldGroupSelection + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section + +namespace MatrixMultiplication.AllFieldGroupSelection + +open MatrixMultiplication.Foundation AllFieldHistory AllFieldActiveLaws +open AllFieldActiveCapacity AllFieldScheduledYield AllFieldNativeCapacity +open Filter +open scoped BigOperators Topology +attribute [local instance] Classical.propDecidable + +variable {K tick : ℕ} + +private theorem selected_of_native_count_bound + (allocation : Allocation) (sigma : Placement) (width : ℝ) + {slack : ℝ} (hslack : 0 < slack) + (hcounts : ∀ᶠ m : ℕ in atTop, + (∀ e : AllFieldGroupOrbitData.Targets (K := K) (tick := tick) allocation m sigma, + (((AllFieldGroupOrbitData.data (K := K) (tick := tick) allocation m width sigma).eligibilityCompetitors e).card : ℝ) ≤ + Real.exp ((m : ℝ) * + (nativeDegree (K := K) (tick := tick) allocation sigma + slack / 4))) ∧ + (∀ e : AllFieldGroupOrbitData.Targets (K := K) (tick := tick) allocation m sigma, + ∀ o ∈ (AllFieldGroupOrbitData.data (K := K) (tick := tick) allocation m width sigma).orbits e, + ∀ v ∈ (AllFieldGroupOrbitData.data (K := K) (tick := tick) allocation m width sigma).passing e o, + (((AllFieldGroupOrbitData.data (K := K) (tick := tick) allocation m width sigma).competitors e o v).card : ℝ) ≤ + Real.exp ((m : ℝ) * + (nativeDegree (K := K) (tick := tick) allocation sigma + slack / 4)))) : + ∀ᶠ m : ℕ in atTop, + Nonempty (Selected (K := K) (tick := tick) allocation m width sigma slack) := by + have hD : 0 ≤ nativeDegree (K := K) (tick := tick) allocation sigma + slack / 4 := by + linarith [nativeDegree_nonneg (K := K) (tick := tick) allocation sigma] + have hdegree := AllFieldGroupDegreeEnvelope.eventually_log_uniformDegree_le + allocation width sigma hD hcounts + have hrate : ∀ η : ℝ, 0 < η → ∀ᶠ m : ℕ in atTop, + Real.log (AllFieldGroupDegreeEnvelope.uniformDegree + (K := K) (tick := tick) allocation m width sigma : ℝ) / (m : ℝ) ≤ + nativeDegree (K := K) (tick := tick) allocation sigma + slack / 4 + η := by + intro η hη + filter_upwards [hdegree] with m hm + linarith + let : ∀ m : ℕ, Fintype (AllFieldGroupOrbitData.Pos + (K := K) (tick := tick) allocation m sigma) := fun m => inferInstance + let : ∀ m : ℕ, Fintype (AllFieldGroupOrbitData.Targets + (K := K) (tick := tick) allocation m sigma) := fun m => inferInstance + have hselected := JointMaskedGoodSelection.eventually_exists_good_selection + (fun m => AllFieldGroupOrbitData.data (K := K) (tick := tick) allocation m width sigma) + (fun m => data_coarse_injective (K := K) (tick := tick) allocation m width sigma) + (fun m => AllFieldGroupDegreeEnvelope.uniformDegree (K := K) (tick := tick) allocation m width sigma) + (orbitPrefactor (K := K) (tick := tick) allocation sigma) + (AllFieldGroupOrbitCount.groupDegree K tick sigma) + (fun m => AllFieldGroupDegreeEnvelope.eligibility_card_le (K := K) (tick := tick) allocation m width sigma) + (fun m => AllFieldGroupDegreeEnvelope.competitors_card_le (K := K) (tick := tick) allocation m width sigma) + (fun m => data_orbits_card_le (K := K) (tick := tick) allocation m width sigma) + (selectionHashRate_nonneg (K := K) (tick := tick) allocation sigma hslack) + (selectionHashRate_window_gap (K := K) (tick := tick) allocation sigma hslack) hrate + (Eventually.of_forall (AllFieldGroupTargetRate.target_card_pos + (K := K) (tick := tick) (sigma := sigma) allocation)) + (AllFieldGroupTargetRate.tendsto_log_target_card_div + (K := K) (tick := tick) (sigma := sigma) allocation) + (half_pos hslack) + filter_upwards [hselected] with m hm + obtain ⟨s, G, hcard, hgood, hdistinct⟩ := hm + refine ⟨{ + sample := s + targets := G + card_targets := ?_ + good := hgood + distinct_first := hdistinct }⟩ + simpa only [selection_exponent] using hcard + +theorem exists_threshold_eventually_selected + (allocation : Allocation) (sigma : Placement) + {slack widthMax : ℝ} (hslack : 0 < slack) (hwidthMax : 0 < widthMax) : + ∃ threshold : ℝ, 0 < threshold ∧ threshold ≤ widthMax ∧ + ∀ width : ℝ, 0 < width → width ≤ threshold → + ∀ᶠ m : ℕ in atTop, + Nonempty (Selected (K := K) (tick := tick) allocation m width sigma slack) := by + obtain ⟨threshold, hthreshold, hthresholdMax, hcounts⟩ := + AllFieldGroupNativeDegreeBound.exists_threshold_eventually_counts_le + (K := K) (tick := tick) allocation sigma + (show 0 < slack / 4 by linarith) hwidthMax + refine ⟨threshold, hthreshold, hthresholdMax, ?_⟩ + intro width hwidth hsmall + apply selected_of_native_count_bound (K := K) (tick := tick) allocation sigma width hslack + simpa only [nativeDegree, AllFieldGroupNativeDegreeBound.maxNativeDegree] using + hcounts width hwidth hsmall + +end MatrixMultiplication.AllFieldGroupSelection + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/Extraction/InitialHash.lean b/lean/OAI/LinearAlgebra/MatrixFields/Extraction/InitialHash.lean new file mode 100644 index 0000000000000000000000000000000000000000..af454e732248fef00cf69d83b345849e2b54db70 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/Extraction/InitialHash.lean @@ -0,0 +1,143 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Construction.InitialState + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +noncomputable section + +namespace MatrixMultiplication.AllFieldInitialHash + +open MatrixMultiplication.Foundation AllFieldFiniteFamily AllFieldInitialStep +open JointPopulation JointCoarseHashing +open scoped BigOperators Classical + +variable {K : ℕ} (counts : Fin K → Shape → ℕ) + +def xKeep (k : ℕ) (U : Finset (ZMod (37 ^ k))) + (s : Sample (Position counts) k) (w : CoarseWord counts) : Prop := + JointHashing.xHash s (castWord k w) ∈ U + +def yKeep (k : ℕ) (U : Finset (ZMod (37 ^ k))) + (s : Sample (Position counts) k) (w : CoarseWord counts) : Prop := + JointHashing.yHash s (castWord k w) ∈ U + +def zKeep (k : ℕ) (U : Finset (ZMod (37 ^ k))) + (s : Sample (Position counts) k) (w : CoarseWord counts) : Prop := + JointHashing.zHash (twoUnit k) s (fun _ => (16 : ZMod (37 ^ k))) (castWord k w) ∈ U + +theorem ambient_support {H : Type*} [Fintype H] [DecidableEq H] + (counts : H → Shape → ℕ) (f : Triple (Position counts)) + (hf : f ∈ ambientSet counts (fun _ => 16)) : + HasSupportSum (fun _ => 16) f := + (Finset.mem_filter.mp hf).2.1 + +theorem target_mem_ambient + (hsupport : ∀ h u, 0 < counts h u → u.1.val + u.2.1.val + u.2.2.val = 16) + (e : Target counts) : triple counts e ∈ ambientSet counts (fun _ => 16) := + targetSet_subset_ambient counts (fun _ => 16) hsupport + (Finset.mem_image.mpr ⟨e, Finset.mem_univ _, rfl⟩) + +theorem side_survival_iff (k : ℕ) (U : Finset (ZMod (37 ^ k))) + (hAP : ∀ x ∈ U, ∀ y ∈ U, ∀ z ∈ U, x + y = 2 * z → x = z ∧ y = z) + (s : Sample (Position counts) k) (e : Triple (Position counts)) + (he : HasSupportSum (fun _ => 16) e) : + JointCoarseAssignment.survives (xKeep counts k U s) (yKeep counts k U s) + (zKeep counts k U s) e ↔ Survives k U e s := + full_survival_iff k U hAP (fun _ => 16) e he s + +theorem isolated_of_good + (hsupport : ∀ h u, 0 < counts h u → u.1.val + u.2.1.val + u.2.2.val = 16) + (k : ℕ) (U : Finset (ZMod (37 ^ k))) + (hAP : ∀ x ∈ U, ∀ y ∈ U, ∀ z ∈ U, x + y = 2 * z → x = z ∧ y = z) + (s : Sample (Position counts) k) (e : Target counts) + (hgood : JointOrdinarySelection.Good k U (ambientSet counts (fun _ => 16)) + (triple counts e) s) : + AllFieldInitialExact.Isolated counts (xKeep counts k U s) (yKeep counts k U s) + (zKeep counts k U s) e := by + constructor + · exact (side_survival_iff counts k U hAP s (triple counts e) + (triple_support counts (fun _ => 16) hsupport e)).mpr hgood.1 + · intro f hf hsurvives hshare + by_contra hne + have hs := (side_survival_iff counts k U hAP s f (ambient_support counts f hf)).mp + hsurvives + exact JointOrdinarySelection.good_excludes_neighbor k U + (ambientSet counts (fun _ => 16)) (triple counts e) f s hgood hf hne hshare hs + +abbrev SelectedTargets (G : Finset (Target counts)) := {e : Target counts // e ∈ G} + +def toTarget (G : Finset (Target counts)) : SelectedTargets counts G → Target counts := + Subtype.val + +theorem toTarget_injective (G : Finset (Target counts)) : + Function.Injective (toTarget counts G) := Subtype.val_injective + +@[simp] theorem selectedTargets_card (G : Finset (Target counts)) : + Fintype.card (SelectedTargets counts G) = G.card := Fintype.card_coe G + +variable {F : Type*} [Field F] {N : ℕ} + +def selectedExecution (total : ∀ h, ∑ u, counts h u = N) + (hsupport : ∀ h u, 0 < counts h u → u.1.val + u.2.1.val + u.2.2.val = 16) + (k : ℕ) (U : Finset (ZMod (37 ^ k))) + (hAP : ∀ x ∈ U, ∀ y ∈ U, ∀ z ∈ U, x + y = 2 * z → x = z ∧ y = z) + (s : Sample (Position counts) k) (G : Finset (Target counts)) + (hgood : ∀ e ∈ G, JointOrdinarySelection.Good k U + (ambientSet counts (fun _ => 16)) (triple counts e) s) : + Execution (cwSource F K N) + (Tensor.directSum (fun _ : SelectedTargets counts G => JointCanonicalInitial.canonical counts)) := + AllFieldInitialExact.selectedExecution counts + (xKeep counts k U s) (yKeep counts k U s) (zKeep counts k U s) + total (toTarget counts G) (toTarget_injective counts G) + (fun e => target_mem_ambient counts hsupport e.val) + (fun e => isolated_of_good counts hsupport k U hAP s e.val (hgood e.val e.property)) + +@[simp] theorem selectedExecution_copies (total : ∀ h, ∑ u, counts h u = N) + (hsupport : ∀ h u, 0 < counts h u → u.1.val + u.2.1.val + u.2.2.val = 16) + (k : ℕ) (U : Finset (ZMod (37 ^ k))) + (hAP : ∀ x ∈ U, ∀ y ∈ U, ∀ z ∈ U, x + y = 2 * z → x = z ∧ y = z) + (s : Sample (Position counts) k) (G : Finset (Target counts)) + (hgood : ∀ e ∈ G, JointOrdinarySelection.Good k U + (ambientSet counts (fun _ => 16)) (triple counts e) s) : + Fintype.card (selectedExecution (F := F) counts total hsupport k U hAP s G hgood).Copies = 1 := + rfl + +theorem exists_selectedExecution (total : ∀ h, ∑ u, counts h u = N) + (hsupport : ∀ h u, 0 < counts h u → u.1.val + u.2.1.val + u.2.2.val = 16) + (k : ℕ) (U : Finset (ZMod (37 ^ k))) + (hAP : ∀ x ∈ U, ∀ y ∈ U, ∀ z ∈ U, x + y = 2 * z → x = z ∧ y = z) + (D : ℕ) + (hdegree : ∀ e : Target counts, + (JointOrdinarySelection.neighbors (ambientSet counts (fun _ => 16)) + (triple counts e)).card ≤ D) + (hsmall : (D : ℝ) / ((37 ^ k : ℕ) : ℝ) ≤ 1 / 2) + (n : ℕ) (hn : (n : ℝ) ≤ (Fintype.card (Target counts) : ℝ) * + ((U.card : ℝ) / ((37 ^ k : ℕ) : ℝ) ^ 2 / 2)) : + ∃ (s : Sample (Position counts) k) (G : Finset (Target counts)), + G.card = n ∧ + (∀ e ∈ G, JointOrdinarySelection.Good k U + (ambientSet counts (fun _ => 16)) (triple counts e) s) ∧ + ∃ E : Execution (cwSource F K N) + (Tensor.directSum (fun _ : SelectedTargets counts G => + JointCanonicalInitial.canonical counts)), + Fintype.card E.Copies = 1 := by + obtain ⟨s, G, hcard, hgood, _hpairwise⟩ := + JointOrdinarySelection.exists_selection_of_degree_bound k U + (ambientSet counts (fun _ => 16)) (fun _ => 16) (triple counts) + (triple_injective counts) (fun f hf => ambient_support counts f hf) + (target_mem_ambient counts hsupport) D hdegree hsmall n hn + exact ⟨s, G, hcard, hgood, + selectedExecution (F := F) counts total hsupport k U hAP s G hgood, + selectedExecution_copies (F := F) counts total hsupport k U hAP s G hgood⟩ + +end MatrixMultiplication.AllFieldInitialHash + +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/Extraction/JointExtraction.lean b/lean/OAI/LinearAlgebra/MatrixFields/Extraction/JointExtraction.lean new file mode 100644 index 0000000000000000000000000000000000000000..995a020db94750c930f0fc0cb9417e0f365749bd --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/Extraction/JointExtraction.lean @@ -0,0 +1,143 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Tensors.ComplexDotPairing + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +namespace MatrixMultiplication.JointExtraction + +open MatrixMultiplication.Foundation + +variable {F X Y Z I : Type*} [CommSemiring F] + +structure Assignment (X Y Z I : Type*) where + x : X → Option I + y : Y → Option I + z : Z → Option I + +noncomputable def uniqueAssignment {A : Type*} (eligible : Finset I) + (compatible : I → A → Prop) (v : A) : Option I := by + classical + exact if h : ∃ i, i ∈ eligible ∧ compatible i v ∧ + ∀ j, j ∈ eligible → compatible j v → j = i + then some (Classical.choose h) else none + +theorem uniqueAssignment_spec {A : Type*} (eligible : Finset I) + (compatible : I → A → Prop) (v : A) (i : I) + (h : uniqueAssignment eligible compatible v = some i) : + i ∈ eligible ∧ compatible i v ∧ + ∀ j, j ∈ eligible → compatible j v → j = i := by + classical + unfold uniqueAssignment at h + split_ifs at h with hex + · have hi : Classical.choose hex = i := Option.some.inj h + simpa only [hi] using Classical.choose_spec hex + +theorem uniqueAssignment_unique {A : Type*} (eligible : Finset I) + (compatible : I → A → Prop) (v : A) (i j : I) + (hi : uniqueAssignment eligible compatible v = some i) + (hj : j ∈ eligible) (hc : compatible j v) : i = j := + ((uniqueAssignment_spec eligible compatible v i hi).2.2 j hj hc).symm + +noncomputable def retainAssignment {A : Type*} (f : A → Option I) + (keep : A → Prop) (v : A) : Option I := by + classical + exact if keep v then f v else none + +theorem retainAssignment_some {A : Type*} (f : A → Option I) + (keep : A → Prop) (v : A) (i : I) + (h : retainAssignment f keep v = some i) : f v = some i := by + classical + unfold retainAssignment at h + split_ifs at h + · exact h + +def Coherent (T : Tensor F X Y Z) (a : Assignment X Y Z I) : Prop := + ∀ x y z i j k, T x y z ≠ 0 → + a.x x = some i → a.y y = some j → a.z z = some k → i = j ∧ i = k + +theorem coherent_of_sequential + (T : Tensor F X Y Z) (a : Assignment X Y Z I) + (compatibleY : I → Y → Prop) (compatibleZ : I → Z → Prop) + (transferY : ∀ x y z i, T x y z ≠ 0 → a.x x = some i → compatibleY i y) + (transferZ : ∀ x y z i, T x y z ≠ 0 → + a.x x = some i → a.y y = some i → compatibleZ i z) + (uniqueY : ∀ y j i, a.y y = some j → compatibleY i y → j = i) + (uniqueZ : ∀ z k i, a.z z = some k → compatibleZ i z → k = i) : + Coherent T a := by + intro x y z i j k hT hx hy hz + have hji : j = i := uniqueY y j i hy (transferY x y z i hT hx) + have hki : k = i := uniqueZ z k i hz + (transferZ x y z i hT hx (hji ▸ hy)) + exact ⟨hji.symm, hki.symm⟩ + +noncomputable def branch (T : Tensor F X Y Z) (a : Assignment X Y Z I) + (i : I) : Tensor F X Y Z := by + classical + exact fun x y z => if a.x x = some i ∧ a.y y = some i ∧ a.z z = some i + then T x y z else 0 + +noncomputable def assignmentMatrix {A : Type*} (f : A → Option I) : + (I × A) → A → F := by + classical + exact fun p a => if a = p.2 ∧ f a = some p.1 then 1 else 0 + +theorem restrict_assignments_apply [Fintype X] [Fintype Y] [Fintype Z] [DecidableEq I] + (T : Tensor F X Y Z) (a : Assignment X Y Z I) + (x : I × X) (y : I × Y) (z : I × Z) : + Tensor.restrict (assignmentMatrix a.x) (assignmentMatrix a.y) + (assignmentMatrix a.z) T x y z = + if a.x x.2 = some x.1 ∧ a.y y.2 = some y.1 ∧ a.z z.2 = some z.1 + then T x.2 y.2 z.2 else 0 := by + classical + simp [Tensor.restrict, assignmentMatrix, ite_and, ite_mul, mul_ite] + split_ifs <;> simp_all + +theorem restrict_assignments_eq_directSum + [Fintype X] [Fintype Y] [Fintype Z] [DecidableEq I] + (T : Tensor F X Y Z) (a : Assignment X Y Z I) (h : Coherent T a) : + Tensor.restrict (assignmentMatrix a.x) (assignmentMatrix a.y) + (assignmentMatrix a.z) T = Tensor.directSum (branch T a) := by + classical + funext x y z + rw [restrict_assignments_apply] + by_cases hx : x.1 = y.1 + · by_cases hz : x.1 = z.1 + · simp [Tensor.directSum, branch, ← hx, ← hz] + · by_cases ht : T x.2 y.2 z.2 = 0 + · simp [Tensor.directSum, hz, ht] + · have hn : ¬ (a.x x.2 = some x.1 ∧ a.y y.2 = some y.1 ∧ + a.z z.2 = some z.1) := by + intro ha + exact hz (h _ _ _ _ _ _ ht ha.1 ha.2.1 ha.2.2).2 + simp [Tensor.directSum, hz, hn] + · by_cases ht : T x.2 y.2 z.2 = 0 + · simp [Tensor.directSum, hx, ht] + · have hn : ¬ (a.x x.2 = some x.1 ∧ a.y y.2 = some y.1 ∧ + a.z z.2 = some z.1) := by + intro ha + exact hx (h _ _ _ _ _ _ ht ha.1 ha.2.1 ha.2.2).1 + simp [Tensor.directSum, hx, hn] + +theorem rankAtMost_directSum_branches + [Fintype X] [Fintype Y] [Fintype Z] [DecidableEq I] + (T : Tensor F X Y Z) (a : Assignment X Y Z I) (h : Coherent T a) + {r : ℕ} (hT : Tensor.RankAtMost T r) : + Tensor.RankAtMost (Tensor.directSum (branch T a)) r := by + rw [← restrict_assignments_eq_directSum T a h] + exact hT.restrict _ _ _ + +theorem coherent_of_support_subset (T S : Tensor F X Y Z) + (a : Assignment X Y Z I) (h : Coherent T a) + (hs : ∀ x y z, S x y z ≠ 0 → T x y z ≠ 0) : Coherent S a := by + intro x y z i j k hS hx hy hz + exact h x y z i j k (hs x y z hS) hx hy hz + +end MatrixMultiplication.JointExtraction + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/Extraction/JointMaskedGoodSelection.lean b/lean/OAI/LinearAlgebra/MatrixFields/Extraction/JointMaskedGoodSelection.lean new file mode 100644 index 0000000000000000000000000000000000000000..81d3f0f6c49a24a699896852bb2dd9195b9d131c --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/Extraction/JointMaskedGoodSelection.lean @@ -0,0 +1,146 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Construction.JointMaskedAssignment +import OAI.LinearAlgebra.MatrixFields.Entropy.JointMaskedRates + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section + +namespace MatrixMultiplication.JointMaskedGoodSelection + +open Filter JointCoarseHashing JointExtractionRates JointMaskedSelection +open JointOrdinarySelection (hashLevel hashSet) +open JointMaskedRates +open scoped Topology + +attribute [local instance] Classical.propDecidable + +theorem eventually_exists_good_selection + {P E O V : ℕ → Type*} [∀ N, Fintype (P N)] [∀ N, Fintype (E N)] + (d : ∀ N, OrbitData (P N) (E N) (O N) (V N)) + (hinj : ∀ N, Function.Injective (d N).coarse) + (degree : ℕ → ℕ) (B p : ℕ) + (heligibility : ∀ N e, ((d N).eligibilityCompetitors e).card ≤ degree N) + (hdegree : ∀ N e, ∀ o ∈ (d N).orbits e, ∀ v ∈ (d N).passing e o, + ((d N).competitors e o v).card ≤ degree N) + (horbits : ∀ N e, ((d N).orbits e).card ≤ B * (N + 1) ^ p) + {A D H : ℝ} (hH : 0 ≤ H) (hgap : D < H) + (hdegreeRate : ∀ η : ℝ, 0 < η → + ∀ᶠ N in atTop, Real.log (degree N : ℝ) / (N : ℝ) ≤ D + η) + (hpos : ∀ᶠ N in atTop, 0 < Fintype.card (E N)) + (hE : Tendsto (fun N => Real.log (Fintype.card (E N) : ℝ) / (N : ℝ)) atTop (𝓝 A)) + {ε : ℝ} (hε : 0 < ε) : + ∀ᶠ N in atTop, ∃ (s : Sample (P N) (hashLevel H N)) (G : Finset (E N)), + G.card = ⌊Real.exp ((N : ℝ) * (A - H - ε))⌋₊ ∧ + (∀ e ∈ G, (d N).Good (hashLevel H N) (hashSet H N) (N : ℝ) e s) ∧ + (∀ e ∈ G, ∀ f ∈ G, e ≠ f → ((d N).coarse e).1 ≠ ((d N).coarse f).1) := by + classical + have huniform := eventually_errorBound_le_half degree B p hH hgap hdegreeRate + have hsmall : ∀ᶠ N in atTop, ∀ e, + (((d N).eligibilityCompetitors e).card : ℝ) / (hashModulus H N : ℝ) + + (((d N).orbits e).card : ℝ) * (N : ℝ) * + ((degree N : ℝ) / (hashModulus H N : ℝ)) ≤ 1 / 2 := by + filter_upwards [huniform] with N hN e + exact (count_error_le_envelope (d N) e (degree N) B p N (hashModulus H N) + (heligibility N e) (horbits N e)).trans hN + have hpositive : ∀ᶠ N : ℕ in atTop, (0 : ℝ) < N := by + filter_upwards [eventually_gt_atTop (0 : ℕ)] with N hN + exact_mod_cast hN + let good := fun N (s : Sample (P N) (hashLevel H N)) (e : E N) => + (d N).Good (hashLevel H N) (hashSet H N) (N : ℝ) e s + have hinc : ∀ᶠ N in atTop, ∀ e, + (((JointAPFree.modularSet (hashModulus H N)).card : ℝ) / + (hashModulus H N : ℝ) ^ 2 / 2) * + (Fintype.card (Sample (P N) (hashLevel H N)) : ℝ) ≤ + (goodIncidence (good N) e : ℝ) := by + filter_upwards [hsmall, hpositive] with N hN hNpos e + rw [show goodIncidence (good N) e = + ((d N).goodEvent (hashLevel H N) (hashSet H N) (N : ℝ) e).card from + (d N).goodIncidence_eq _ _ _ _] + exact (d N).goodEvent_card_lower (hashLevel H N) (hashSet H N) (N : ℝ) hNpos e + (degree N) (hdegree N e) (hN e) + have hyield := eventually_exists_many_good_explicit good hH hpos hinc hE hε + have hselection := eventually_exists_good_subfamily good + (fun N => ⌊Real.exp ((N : ℝ) * (A - H - ε))⌋₊) hyield + filter_upwards [hselection] with N hN + obtain ⟨s, G, hcard, hgood⟩ := hN + refine ⟨s, G, hcard, hgood, ?_⟩ + intro e he f hf hne + exact (d N).good_no_shared_x (hashLevel H N) (hashSet H N) (N : ℝ) f e s + (hgood f hf) (hgood e he) (fun h => hne ((hinj N) h)) + +end MatrixMultiplication.JointMaskedGoodSelection + +namespace MatrixMultiplication.JointMaskedSelection.OrbitData + +open JointCoarseHashing +attribute [local instance] Classical.propDecidable + +variable {P E O V : Type*} [Fintype P] [Fintype E] + +omit [Fintype E] in +theorem good_randomLossFraction_le (d : OrbitData P E O V) (k : ℕ) + (U : Finset (ZMod (37 ^ k))) (N : ℝ) (e : E) (s : Sample P k) + (hg : d.Good k U N e s) (o : O) (ho : o ∈ d.orbits e) : + JointLossCounts.randomLossFraction (d.full e o) (d.passing e o) + (d.variableBad k U e o) s ≤ 1 / N := by + exact le_of_not_gt (fun h => hg.2 (Or.inr ⟨o, ho, h⟩)) + +theorem passing_actual_failure_subset_bad (d : OrbitData P E O V) (k : ℕ) + (U : Finset (ZMod (37 ^ k))) + (hAP : ∀ x ∈ U, ∀ y ∈ U, ∀ z ∈ U, x + y = 2 * z → x = z ∧ y = z) + (N : ℝ) (e : E) (o : O) (ho : o ∈ d.orbits e) (s : Sample P k) + (hg : d.Good k U N e s) + (compatible useful : Triple P → V → Prop) (keep : V → Prop) + (hc : ∀ v ∈ d.passing e o, compatible (d.coarse e) v) + (hu : ∀ v ∈ d.passing e o, useful (d.coarse e) v) + (hk : ∀ v ∈ d.passing e o, keep v) + (hcover : ∀ v ∈ d.passing e o, ∀ f ∈ d.actualTargets, + f ≠ d.coarse e → compatible f v → f ∈ d.competitors e o v) : + (d.passing e o).filter (fun v => d.actualAssignment k U compatible useful keep s v ≠ + some (d.coarse e)) ⊆ (d.passing e o).filter (fun v => d.variableBad k U e o v s) := by + intro v hv + obtain ⟨hpass, hfail⟩ := Finset.mem_filter.mp hv + refine Finset.mem_filter.mpr ⟨hpass, ?_⟩ + by_contra hnotbad + have hret : v ∈ JointLossCounts.retained (d.passing e o) (d.variableBad k U e o) s := + Finset.mem_filter.mpr ⟨hpass, hnotbad⟩ + exact hfail (d.model_retained_assigned k U hAP N e o ho s hg + compatible useful keep v hret (hc v hpass) (hu v hpass) (hk v hpass) (hcover v hpass)) + +theorem good_passing_actual_failure_fraction_le (d : OrbitData P E O V) (k : ℕ) + (U : Finset (ZMod (37 ^ k))) + (hAP : ∀ x ∈ U, ∀ y ∈ U, ∀ z ∈ U, x + y = 2 * z → x = z ∧ y = z) + (N : ℝ) (e : E) (o : O) (ho : o ∈ d.orbits e) (s : Sample P k) + (hg : d.Good k U N e s) + (compatible useful : Triple P → V → Prop) (keep : V → Prop) + (hc : ∀ v ∈ d.passing e o, compatible (d.coarse e) v) + (hu : ∀ v ∈ d.passing e o, useful (d.coarse e) v) + (hk : ∀ v ∈ d.passing e o, keep v) + (hcover : ∀ v ∈ d.passing e o, ∀ f ∈ d.actualTargets, + f ≠ d.coarse e → compatible f v → f ∈ d.competitors e o v) : + (((d.passing e o).filter (fun v => d.actualAssignment k U compatible useful keep s v ≠ + some (d.coarse e))).card : ℝ) / ((d.full e o).card : ℝ) ≤ 1 / N := by + have hcard := Finset.card_le_card + (d.passing_actual_failure_subset_bad k U hAP N e o ho s hg + compatible useful keep hc hu hk hcover) + have hR : (((d.passing e o).filter (fun v => + d.actualAssignment k U compatible useful keep s v ≠ some (d.coarse e))).card : ℝ) ≤ + (((d.passing e o).filter (fun v => d.variableBad k U e o v s)).card : ℝ) := by + exact_mod_cast hcard + exact (div_le_div_of_nonneg_right hR (Nat.cast_nonneg _)).trans + (d.good_randomLossFraction_le k U N e s hg o ho) + +end MatrixMultiplication.JointMaskedSelection.OrbitData + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/Extraction/JointMaskedSelection.lean b/lean/OAI/LinearAlgebra/MatrixFields/Extraction/JointMaskedSelection.lean new file mode 100644 index 0000000000000000000000000000000000000000..1703e5c14b7aaeac7411ac0e6b6ac3aaa375855f --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/Extraction/JointMaskedSelection.lean @@ -0,0 +1,996 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Construction.JointLossCounts +import OAI.LinearAlgebra.MatrixFields.Entropy.JointExtractionRates + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +namespace MatrixMultiplication.JointHashing + +open scoped BigOperators + +attribute [local instance] Classical.propDecidable + +variable {P R : Type*} [Fintype P] [CommRing R] + +def dot (v w : P → R) : R := ∑ i, v i * w i + +@[simp] theorem dot_add_right (v w u : P → R) : dot v (w + u) = dot v w + dot v u := by + simp [dot, mul_add, Finset.sum_add_distrib] + +@[simp] theorem dot_sub_right (v w u : P → R) : dot v (w - u) = dot v w - dot v u := by + simp [dot, mul_sub, Finset.sum_sub_distrib] + +@[simp] theorem dot_add_left (v w u : P → R) : dot (v + w) u = dot v u + dot w u := by + simp [dot, add_mul, Finset.sum_add_distrib] + +@[simp] theorem dot_sub_left (v w u : P → R) : dot (v - w) u = dot v u - dot w u := by + simp [dot, sub_mul, Finset.sum_sub_distrib] + +abbrev Sample (P R : Type*) := (P → R) × R × R + +def xHash (s : Sample P R) (I : P → R) := s.2.1 + dot s.1 I +def yHash (s : Sample P R) (J : P → R) := s.2.2 + dot s.1 J + +def zHash (two : Rˣ) (s : Sample P R) (S K : P → R) := + (↑(two⁻¹) : R) * (s.2.1 + s.2.2 + dot s.1 (S - K)) + +def Survives (U : Set R) (I J : P → R) (s : Sample P R) : Prop := + xHash s I = yHash s J ∧ xHash s I ∈ U + +def survivalEquiv (U : Set R) (I J : P → R) : + {s : Sample P R // Survives U I J s} ≃ (P → R) × U where + toFun s := (s.val.1, ⟨xHash s.val I, s.property.2⟩) + invFun vt := ⟨(vt.1, vt.2.val - dot vt.1 I, vt.2.val - dot vt.1 J), by + simp [Survives, xHash, yHash, vt.2.property]⟩ + left_inv s := by + apply Subtype.ext + rcases s with ⟨⟨v, a, b⟩, hs⟩ + dsimp [Survives, xHash, yHash] at hs ⊢ + congr 1 + apply Prod.ext + · ring + · linear_combination hs.1 + right_inv vt := by + rcases vt with ⟨v, t, ht⟩ + simp [xHash] + +theorem hash_relation (two : Rˣ) (htwo : (two : R) = 2) + (s : Sample P R) (I J K S : P → R) (hs : I + J + K = S) : + xHash s I + yHash s J = 2 * zHash two s S K := by + have hSK : S - K = I + J := by rw [← hs]; abel + rw [zHash, ← htwo, ← mul_assoc] + rw [Units.mul_inv, one_mul, hSK, dot_add_right] + simp only [xHash, yHash] + ring + +theorem full_survival_iff (two : Rˣ) (htwo : (two : R) = 2) + (U : Set R) + (hAP : ∀ x ∈ U, ∀ y ∈ U, ∀ z ∈ U, x + y = 2 * z → x = z ∧ y = z) + (s : Sample P R) (I J K S : P → R) (hs : I + J + K = S) : + (xHash s I ∈ U ∧ yHash s J ∈ U ∧ zHash two s S K ∈ U) ↔ + Survives U I J s := by + have hr := hash_relation two htwo s I J K S hs + constructor + · rintro ⟨hx, hy, hz⟩ + obtain ⟨h1, h2⟩ := hAP _ hx _ hy _ hz hr + exact ⟨h1.trans h2.symm, hx⟩ + · rintro ⟨hxy, hx⟩ + have hz : zHash two s S K = xHash s I := by + have hh : (two : R) * zHash two s S K = (two : R) * xHash s I := by + rw [htwo, ← hr, hxy]; ring + exact two.isUnit.mul_left_cancel hh + exact ⟨hx, hxy ▸ hx, hz ▸ hx⟩ + +theorem survival_card [Fintype R] (U : Finset R) (I J : P → R) : + Fintype.card {s : Sample P R // Survives (U : Set R) I J s} = + Fintype.card R ^ Fintype.card P * U.card := by + classical + rw [Fintype.card_congr (survivalEquiv (U : Set R) I J)] + simp + +omit [CommRing R] in +@[simp] theorem sample_card [Fintype R] : + Fintype.card (Sample P R) = Fintype.card R ^ Fintype.card P * Fintype.card R ^ 2 := by + simp [Sample, pow_two] + +theorem shared_x_collision_iff (U : Set R) (I J J' : P → R) + (s : Sample P R) (hs : Survives U I J s) : + Survives U I J' s ↔ dot s.1 (J' - J) = 0 := by + rcases hs with ⟨heq, hU⟩ + simp only [Survives, dot_sub_right] + constructor + · intro h + dsimp [xHash, yHash] at heq h + linear_combination heq - h.1 + · intro h + refine ⟨?_, hU⟩ + dsimp [xHash, yHash] at heq ⊢ + linear_combination heq - h + +theorem shared_y_collision_iff (U : Set R) (I I' J : P → R) + (s : Sample P R) (hs : Survives U I J s) : + Survives U I' J s ↔ dot s.1 (I' - I) = 0 := by + rcases hs with ⟨heq, hU⟩ + simp only [Survives, dot_sub_right] + constructor + · intro h + dsimp [xHash, yHash] at heq h + linear_combination h.1 - heq + · intro h + have hx : xHash s I' = xHash s I := by + dsimp [xHash] + linear_combination h + exact ⟨hx.trans heq, hx ▸ hU⟩ + +def pivot [DecidableEq P] (i : P) (u : Rˣ) (t : R) : P → R := + Pi.single i ((↑(u⁻¹) : R) * t) + +@[simp] theorem dot_pivot [DecidableEq P] (d : P → R) (i : P) + (u : Rˣ) (hu : d i = u) (t : R) : dot (pivot i u t) d = t := by + simp [dot, pivot, Pi.single_apply, hu, mul_comm, mul_left_comm] + +def linearSplitEquiv [DecidableEq P] (d : P → R) (i : P) + (u : Rˣ) (hu : d i = u) : + (P → R) ≃ R × {v : P → R // dot v d = 0} where + toFun v := (dot v d, ⟨v - pivot i u (dot v d), by simp [hu]⟩) + invFun t := t.2.val + pivot i u t.1 + left_inv v := by simp + right_inv t := by + rcases t with ⟨t, v, hv⟩ + apply Prod.ext + · simp [hv, hu] + · apply Subtype.ext + simp [hv, hu] + +theorem linear_zero_fiber_card [Fintype R] + (d : P → R) (i : P) (u : Rˣ) (hu : d i = u) : + Fintype.card R * Fintype.card {v : P → R // dot v d = 0} = + Fintype.card R ^ Fintype.card P := by + classical + have h := Fintype.card_congr (linearSplitEquiv d i u hu) + simpa only [Fintype.card_prod, Fintype.card_fun] using h.symm + +def collisionEquiv (U : Set R) (I J d : P → R) : + {s : Sample P R // Survives U I J s ∧ dot s.1 d = 0} ≃ + {v : P → R // dot v d = 0} × U where + toFun s := (⟨s.val.1, s.property.2⟩, ⟨xHash s.val I, s.property.1.2⟩) + invFun vt := ⟨(vt.1.val, vt.2.val - dot vt.1.val I, vt.2.val - dot vt.1.val J), by + exact ⟨by simp [Survives, xHash, yHash, vt.2.property], vt.1.property⟩⟩ + left_inv s := by + apply Subtype.ext + exact congrArg (fun t : {s : Sample P R // Survives U I J s} => t.val) + ((survivalEquiv U I J).left_inv ⟨s.val, s.property.1⟩) + right_inv vt := by + rcases vt with ⟨⟨v, hv⟩, ⟨t, ht⟩⟩ + simp [xHash] + +theorem collision_card_mul [Fintype R] + (U : Finset R) (I J d : P → R) (i : P) (u : Rˣ) (hu : d i = u) : + Fintype.card R * + Fintype.card {s : Sample P R // Survives (U : Set R) I J s ∧ dot s.1 d = 0} = + Fintype.card {s : Sample P R // Survives (U : Set R) I J s} := by + classical + have hcard : Fintype.card {s : Sample P R // + Survives (U : Set R) I J s ∧ dot s.1 d = 0} = + Fintype.card {v : P → R // dot v d = 0} * U.card := by + simpa using Fintype.card_congr (collisionEquiv (U : Set R) I J d) + calc + _ = Fintype.card R * (Fintype.card {v : P → R // dot v d = 0} * U.card) := + congrArg (fun n : ℕ => Fintype.card R * n) hcard + _ = (Fintype.card R * Fintype.card {v : P → R // dot v d = 0}) * U.card := + (mul_assoc _ _ _).symm + _ = (Fintype.card R ^ Fintype.card P) * U.card := + congrArg (fun n : ℕ => n * U.card) (linear_zero_fiber_card d i u hu) + _ = _ := (survival_card U I J).symm + +theorem shared_x_collision_card_mul [Fintype R] + (U : Finset R) (I J J' : P → R) (i : P) (u : Rˣ) + (hu : J' i - J i = u) : + Fintype.card R * Fintype.card {s : Sample P R // + Survives (U : Set R) I J s ∧ Survives (U : Set R) I J' s} = + Fintype.card {s : Sample P R // Survives (U : Set R) I J s} := by + classical + let e : {s : Sample P R // Survives (U : Set R) I J s ∧ + Survives (U : Set R) I J' s} ≃ + {s : Sample P R // Survives (U : Set R) I J s ∧ dot s.1 (J' - J) = 0} := + Equiv.subtypeEquivRight (fun s => and_congr_right (fun hs => + shared_x_collision_iff (U : Set R) I J J' s hs)) + rw [Fintype.card_congr e] + exact collision_card_mul U I J (J' - J) i u hu + +theorem shared_y_collision_card_mul [Fintype R] + (U : Finset R) (I I' J : P → R) (i : P) (u : Rˣ) + (hu : I' i - I i = u) : + Fintype.card R * Fintype.card {s : Sample P R // + Survives (U : Set R) I J s ∧ Survives (U : Set R) I' J s} = + Fintype.card {s : Sample P R // Survives (U : Set R) I J s} := by + classical + let e : {s : Sample P R // Survives (U : Set R) I J s ∧ + Survives (U : Set R) I' J s} ≃ + {s : Sample P R // Survives (U : Set R) I J s ∧ dot s.1 (I' - I) = 0} := + Equiv.subtypeEquivRight (fun s => and_congr_right (fun hs => + shared_y_collision_iff (U : Set R) I I' J s hs)) + rw [Fintype.card_congr e] + exact collision_card_mul U I J (I' - I) i u hu + +theorem survival_fraction [Fintype R] (U : Finset R) (I J : P → R) : + (Fintype.card {s : Sample P R // Survives (U : Set R) I J s} : ℝ) / + Fintype.card (Sample P R) = (U.card : ℝ) / (Fintype.card R : ℝ) ^ 2 := by + have hR : (Fintype.card R : ℝ) ≠ 0 := by + exact_mod_cast Fintype.card_ne_zero + rw [survival_card, sample_card] + push_cast + field_simp + +theorem collision_fraction [Fintype R] + (U : Finset R) (hU : U.Nonempty) (I J d : P → R) + (i : P) (u : Rˣ) (hu : d i = u) : + (Fintype.card {s : Sample P R // Survives (U : Set R) I J s ∧ dot s.1 d = 0} : ℝ) / + Fintype.card {s : Sample P R // Survives (U : Set R) I J s} = + 1 / (Fintype.card R : ℝ) := by + have hR : (Fintype.card R : ℝ) ≠ 0 := by + exact_mod_cast Fintype.card_ne_zero + have hS : (Fintype.card {s : Sample P R // Survives (U : Set R) I J s} : ℝ) ≠ 0 := by + obtain ⟨t, ht⟩ := hU + let : Nonempty {s : Sample P R // Survives (U : Set R) I J s} := + ⟨(survivalEquiv (U : Set R) I J).symm (0, ⟨t, ht⟩)⟩ + exact Nat.cast_ne_zero.mpr Fintype.card_ne_zero + apply (div_eq_div_iff hS hR).mpr + simpa only [Nat.cast_mul, one_mul, mul_one, mul_comm] using + (congrArg (fun n : ℕ => (n : ℝ)) (collision_card_mul U I J d i u hu)) + +theorem small_nat_isUnit (k n : ℕ) (hn : 0 < n) (hn16 : n ≤ 16) : + IsUnit (n : ZMod (37 ^ k)) := by + apply (ZMod.isUnit_iff_coprime _ _).mpr + apply Nat.Coprime.pow_right + apply Nat.Coprime.symm + apply (Nat.Prime.coprime_iff_not_dvd (by decide : Nat.Prime 37)).mpr + intro h + have := Nat.le_of_dvd hn h + omega + +theorem coarse_difference_isUnit (k : ℕ) (a b : Fin 17) (hab : a ≠ b) : + IsUnit ((a.val : ZMod (37 ^ k)) - (b.val : ZMod (37 ^ k))) := by + have hne : a.val ≠ b.val := fun h => hab (Fin.ext h) + rcases lt_or_gt_of_ne hne with h | h + · have hu := small_nat_isUnit k (b.val - a.val) (Nat.sub_pos_of_lt h) (by omega) + rw [Nat.cast_sub h.le] at hu + simpa only [neg_sub] using hu.neg + · have hu := small_nat_isUnit k (a.val - b.val) (Nat.sub_pos_of_lt h) (by omega) + rwa [Nat.cast_sub h.le] at hu + +theorem coarse_words_unit_coordinate (k : ℕ) (I J : P → Fin 17) (hIJ : I ≠ J) : + ∃ i : P, IsUnit (((I i : ℕ) : ZMod (37 ^ k)) - ((J i : ℕ) : ZMod (37 ^ k))) := by + classical + have hi : ∃ i, I i ≠ J i := by + by_contra h + push Not at h + exact hIJ (funext h) + obtain ⟨i, hi⟩ := hi + exact ⟨i, coarse_difference_isUnit k (I i) (J i) hi⟩ + +theorem shared_z_collision_iff (two : Rˣ) (htwo : (two : R) = 2) + (U : Set R) (I I' J J' : P → R) (hIJ : I' + J' = I + J) + (s : Sample P R) (hs : Survives U I J s) : + Survives U I' J' s ↔ dot s.1 (I' - I) = 0 := by + have hsum : dot s.1 I' + dot s.1 J' = dot s.1 I + dot s.1 J := by + simpa using congrArg (dot s.1) hIJ + rcases hs with ⟨heq, hU⟩ + rw [dot_sub_right] + constructor + · rintro ⟨heq', _⟩ + dsimp [xHash, yHash] at heq heq' + have hz : (two : R) * (dot s.1 I' - dot s.1 I) = (two : R) * 0 := by + rw [htwo] + linear_combination heq' - heq + hsum + exact two.isUnit.mul_left_cancel hz + · intro hd + have hx : xHash s I' = xHash s I := by + dsimp [xHash] + linear_combination hd + have hy : yHash s J' = yHash s J := by + dsimp [yHash] + linear_combination hsum - hd + exact ⟨hx.trans (heq.trans hy.symm), hx ▸ hU⟩ + +theorem shared_z_collision_card_mul [Fintype R] + (two : Rˣ) (htwo : (two : R) = 2) + (U : Finset R) (I I' J J' : P → R) (hIJ : I' + J' = I + J) + (i : P) (u : Rˣ) (hu : I' i - I i = u) : + Fintype.card R * Fintype.card {s : Sample P R // + Survives (U : Set R) I J s ∧ Survives (U : Set R) I' J' s} = + Fintype.card {s : Sample P R // Survives (U : Set R) I J s} := by + classical + let e : {s : Sample P R // Survives (U : Set R) I J s ∧ + Survives (U : Set R) I' J' s} ≃ + {s : Sample P R // Survives (U : Set R) I J s ∧ dot s.1 (I' - I) = 0} := + Equiv.subtypeEquivRight (fun s => and_congr_right (fun hs => + shared_z_collision_iff two htwo (U : Set R) I I' J J' hIJ s hs)) + rw [Fintype.card_congr e] + exact collision_card_mul U I J (I' - I) i u hu + +end MatrixMultiplication.JointHashing + + + + + +noncomputable section + +namespace MatrixMultiplication.JointCoarseHashing + +attribute [local instance] Classical.propDecidable + +abbrev Word (P : Type*) := P → Fin 17 +abbrev Triple (P : Type*) := Word P × Word P × Word P + +variable {P : Type*} + +def HasSupportSum (S : P → ℕ) (e : Triple P) : Prop := + ∀ p, (e.1 p).val + (e.2.1 p).val + (e.2.2 p).val = S p + +theorem eq_of_shared_xy (S : P → ℕ) (e f : Triple P) + (he : HasSupportSum S e) (hf : HasSupportSum S f) + (hx : e.1 = f.1) (hy : e.2.1 = f.2.1) : e = f := by + have hz : e.2.2 = f.2.2 := by + funext p + apply Fin.ext + have he' := he p + have hf' := hf p + rw [hx, hy] at he' + omega + exact Prod.ext hx (Prod.ext hy hz) + +theorem eq_of_shared_xz (S : P → ℕ) (e f : Triple P) + (he : HasSupportSum S e) (hf : HasSupportSum S f) + (hx : e.1 = f.1) (hz : e.2.2 = f.2.2) : e = f := by + have hy : e.2.1 = f.2.1 := by + funext p + apply Fin.ext + have he' := he p + have hf' := hf p + rw [hx, hz] at he' + omega + exact Prod.ext hx (Prod.ext hy hz) + +theorem eq_of_shared_yz (S : P → ℕ) (e f : Triple P) + (he : HasSupportSum S e) (hf : HasSupportSum S f) + (hy : e.2.1 = f.2.1) (hz : e.2.2 = f.2.2) : e = f := by + have hx : e.1 = f.1 := by + funext p + apply Fin.ext + have he' := he p + have hf' := hf p + rw [hy, hz] at he' + omega + exact Prod.ext hx (Prod.ext hy hz) + +def castWord (k : ℕ) (w : Word P) : P → ZMod (37 ^ k) := + fun p => (w p).val + +def twoUnit (k : ℕ) : (ZMod (37 ^ k))ˣ := + (JointHashing.small_nat_isUnit k 2 (by decide) (by decide)).unit + +theorem twoUnit_coe (k : ℕ) : (twoUnit k : ZMod (37 ^ k)) = 2 := by + exact (JointHashing.small_nat_isUnit k 2 (by decide) (by decide)).unit_spec + +theorem supportSum_cast (k : ℕ) (S : P → ℕ) (e : Triple P) + (he : HasSupportSum S e) : + castWord k e.1 + castWord k e.2.1 + castWord k e.2.2 = + fun p => (S p : ZMod (37 ^ k)) := by + funext p + have h := congrArg (fun n : ℕ => (n : ZMod (37 ^ k))) (he p) + simpa only [Nat.cast_add, Pi.add_apply, castWord] using h + +theorem shared_z_cast_sum (k : ℕ) (S : P → ℕ) (e f : Triple P) + (he : HasSupportSum S e) (hf : HasSupportSum S f) + (hz : f.2.2 = e.2.2) : + castWord k f.1 + castWord k f.2.1 = castWord k e.1 + castWord k e.2.1 := by + have h := (supportSum_cast k S f hf).trans (supportSum_cast k S e he).symm + rw [hz] at h + exact add_right_cancel h + +section FiniteHashing + +variable [Fintype P] + +abbrev Sample (P : Type*) (k : ℕ) := JointHashing.Sample P (ZMod (37 ^ k)) + +def Survives (k : ℕ) (U : Finset (ZMod (37 ^ k))) (e : Triple P) (s : Sample P k) : Prop := + JointHashing.Survives (U : Set (ZMod (37 ^ k))) (castWord k e.1) (castWord k e.2.1) s + +theorem full_survival_iff (k : ℕ) (U : Finset (ZMod (37 ^ k))) + (hAP : ∀ x ∈ U, ∀ y ∈ U, ∀ z ∈ U, x + y = 2 * z → x = z ∧ y = z) + (S : P → ℕ) (e : Triple P) (he : HasSupportSum S e) (s : Sample P k) : + (JointHashing.xHash s (castWord k e.1) ∈ U ∧ + JointHashing.yHash s (castWord k e.2.1) ∈ U ∧ + JointHashing.zHash (twoUnit k) s (fun p => (S p : ZMod (37 ^ k))) + (castWord k e.2.2) ∈ U) ↔ Survives k U e s := by + exact JointHashing.full_survival_iff (twoUnit k) (twoUnit_coe k) + (U : Set (ZMod (37 ^ k))) hAP s (castWord k e.1) (castWord k e.2.1) + (castWord k e.2.2) (fun p => (S p : ZMod (37 ^ k))) (supportSum_cast k S e he) + +theorem survival_card (k : ℕ) (U : Finset (ZMod (37 ^ k))) (e : Triple P) : + Fintype.card {s : Sample P k // Survives k U e s} = + (37 ^ k) ^ Fintype.card P * U.card := by + have hcard := JointHashing.survival_card U (castWord k e.1) (castWord k e.2.1) + simp only [ZMod.card] at hcard + simp only [Fintype.card_eq_nat_card] at hcard ⊢ + exact hcard + +theorem shared_x_card_mul (k : ℕ) (U : Finset (ZMod (37 ^ k))) + (S : P → ℕ) (e f : Triple P) (he : HasSupportSum S e) (hf : HasSupportSum S f) + (hne : f ≠ e) (hx : f.1 = e.1) : + (37 ^ k) * Fintype.card {s : Sample P k // Survives k U e s ∧ Survives k U f s} = + Fintype.card {s : Sample P k // Survives k U e s} := by + classical + have hy : f.2.1 ≠ e.2.1 := fun hy => hne (eq_of_shared_xy S f e hf he hx hy) + obtain ⟨i, hi⟩ := JointHashing.coarse_words_unit_coordinate k f.2.1 e.2.1 hy + have h := JointHashing.shared_x_collision_card_mul U (castWord k e.1) + (castWord k e.2.1) (castWord k f.2.1) i hi.unit hi.unit_spec.symm + simp only [ZMod.card] at h + simp only [Fintype.card_eq_nat_card] at h ⊢ + simpa only [Survives, hx] using h + +theorem shared_y_card_mul (k : ℕ) (U : Finset (ZMod (37 ^ k))) + (S : P → ℕ) (e f : Triple P) (he : HasSupportSum S e) (hf : HasSupportSum S f) + (hne : f ≠ e) (hy : f.2.1 = e.2.1) : + (37 ^ k) * Fintype.card {s : Sample P k // Survives k U e s ∧ Survives k U f s} = + Fintype.card {s : Sample P k // Survives k U e s} := by + classical + have hx : f.1 ≠ e.1 := fun hx => hne (eq_of_shared_xy S f e hf he hx hy) + obtain ⟨i, hi⟩ := JointHashing.coarse_words_unit_coordinate k f.1 e.1 hx + have h := JointHashing.shared_y_collision_card_mul U (castWord k e.1) + (castWord k f.1) (castWord k e.2.1) i hi.unit hi.unit_spec.symm + simp only [ZMod.card] at h + simp only [Fintype.card_eq_nat_card] at h ⊢ + simpa only [Survives, hy] using h + +theorem shared_z_card_mul (k : ℕ) (U : Finset (ZMod (37 ^ k))) + (S : P → ℕ) (e f : Triple P) (he : HasSupportSum S e) (hf : HasSupportSum S f) + (hne : f ≠ e) (hz : f.2.2 = e.2.2) : + (37 ^ k) * Fintype.card {s : Sample P k // Survives k U e s ∧ Survives k U f s} = + Fintype.card {s : Sample P k // Survives k U e s} := by + classical + have hx : f.1 ≠ e.1 := fun hx => hne (eq_of_shared_xz S f e hf he hx hz) + obtain ⟨i, hi⟩ := JointHashing.coarse_words_unit_coordinate k f.1 e.1 hx + have h := JointHashing.shared_z_collision_card_mul (twoUnit k) (twoUnit_coe k) + U (castWord k e.1) (castWord k f.1) (castWord k e.2.1) (castWord k f.2.1) + (shared_z_cast_sum k S e f he hf hz) i hi.unit hi.unit_spec.symm + simp only [ZMod.card] at h + simp only [Fintype.card_eq_nat_card] at h ⊢ + exact h + +def SharesSide (e f : Triple P) : Prop := + f.1 = e.1 ∨ f.2.1 = e.2.1 ∨ f.2.2 = e.2.2 + +theorem pair_survival_card_mul (k : ℕ) (U : Finset (ZMod (37 ^ k))) + (S : P → ℕ) (e f : Triple P) (he : HasSupportSum S e) (hf : HasSupportSum S f) + (hne : f ≠ e) (hshare : SharesSide e f) : + (37 ^ k) * Fintype.card {s : Sample P k // Survives k U e s ∧ Survives k U f s} = + Fintype.card {s : Sample P k // Survives k U e s} := by + rcases hshare with hx | hy | hz + · exact shared_x_card_mul k U S e f he hf hne hx + · exact shared_y_card_mul k U S e f he hf hne hy + · exact shared_z_card_mul k U S e f he hf hne hz + +def ownEvent (k : ℕ) (U : Finset (ZMod (37 ^ k))) (e : Triple P) : Finset (Sample P k) := + Finset.univ.filter (Survives k U e) + +theorem ownEvent_card (k : ℕ) (U : Finset (ZMod (37 ^ k))) (e : Triple P) : + (ownEvent k U e).card = (37 ^ k) ^ Fintype.card P * U.card := by + simpa only [ownEvent, Fintype.card_subtype] using survival_card k U e + +theorem pair_event_card_mul (k : ℕ) (U : Finset (ZMod (37 ^ k))) + (S : P → ℕ) (e f : Triple P) (he : HasSupportSum S e) (hf : HasSupportSum S f) + (hne : f ≠ e) (hshare : SharesSide e f) : + (37 ^ k) * ((ownEvent k U e).filter (Survives k U f)).card = (ownEvent k U e).card := by + simpa only [ownEvent, Finset.filter_filter, Fintype.card_subtype] using + pair_survival_card_mul k U S e f he hf hne hshare + +theorem competitor_union_card_mul_le (k : ℕ) (U : Finset (ZMod (37 ^ k))) + (S : P → ℕ) (e : Triple P) (he : HasSupportSum S e) (competitors : Finset (Triple P)) + (hf : ∀ f ∈ competitors, HasSupportSum S f) + (hne : ∀ f ∈ competitors, f ≠ e) + (hshare : ∀ f ∈ competitors, SharesSide e f) : + (37 ^ k) * ((ownEvent k U e).filter + (fun s => ∃ f ∈ competitors, Survives k U f s)).card ≤ + competitors.card * (ownEvent k U e).card := by + apply JointLossCounts.competitor_union_card_mul_le + intro f hf' + exact (pair_event_card_mul k U S e f he (hf f hf') (hne f hf') (hshare f hf')).le + +theorem competitor_union_card_le (k : ℕ) (U : Finset (ZMod (37 ^ k))) + (S : P → ℕ) (e : Triple P) (he : HasSupportSum S e) (competitors : Finset (Triple P)) + (hf : ∀ f ∈ competitors, HasSupportSum S f) + (hne : ∀ f ∈ competitors, f ≠ e) + (hshare : ∀ f ∈ competitors, SharesSide e f) : + (((ownEvent k U e).filter (fun s => ∃ f ∈ competitors, Survives k U f s)).card : ℝ) ≤ + ((competitors.card : ℝ) / ((37 ^ k : ℕ) : ℝ)) * ((ownEvent k U e).card : ℝ) := by + have hM : (0 : ℝ) < ((37 ^ k : ℕ) : ℝ) := by + exact_mod_cast (pow_pos (by decide : 0 < (37 : ℕ)) k) + have h := competitor_union_card_mul_le k U S e he competitors hf hne hshare + have hR : ((37 ^ k : ℕ) : ℝ) * + (((ownEvent k U e).filter (fun s => ∃ f ∈ competitors, Survives k U f s)).card : ℝ) ≤ + (competitors.card : ℝ) * ((ownEvent k U e).card : ℝ) := by exact_mod_cast h + rw [div_mul_eq_mul_div] + exact (le_div_iff₀ hM).2 (by simpa only [mul_comm] using hR) + +theorem pair_survival_fraction (k : ℕ) (U : Finset (ZMod (37 ^ k))) (hU : U.Nonempty) + (S : P → ℕ) (e f : Triple P) (he : HasSupportSum S e) (hf : HasSupportSum S f) + (hne : f ≠ e) (hshare : SharesSide e f) : + (((ownEvent k U e).filter (Survives k U f)).card : ℝ) / ((ownEvent k U e).card : ℝ) = + 1 / ((37 ^ k : ℕ) : ℝ) := by + have hM : (0 : ℕ) < 37 ^ k := pow_pos (by decide) k + have hS : 0 < (ownEvent k U e).card := by + rw [ownEvent_card] + exact Nat.mul_pos (pow_pos hM _) (Finset.card_pos.mpr hU) + apply (div_eq_div_iff (by exact_mod_cast Nat.ne_of_gt hS) + (by exact_mod_cast Nat.ne_of_gt hM)).2 + have h := congrArg (fun n : ℕ => (n : ℝ)) (pair_event_card_mul k U S e f he hf hne hshare) + simpa only [Nat.cast_mul, one_mul, mul_comm] using h + +end FiniteHashing + +end MatrixMultiplication.JointCoarseHashing + + + + + + +namespace MatrixMultiplication.JointOrdinarySelection + +open JointCoarseHashing JointExtractionRates Filter +open scoped BigOperators Topology + +attribute [local instance] Classical.propDecidable + +variable {P E : Type*} + +def neighbors (ambient : Finset (Triple P)) (e : Triple P) : Finset (Triple P) := + ambient.filter (fun f => f ≠ e ∧ SharesSide e f) + +@[simp] theorem mem_neighbors (ambient : Finset (Triple P)) (e f : Triple P) : + f ∈ neighbors ambient e ↔ f ∈ ambient ∧ f ≠ e ∧ SharesSide e f := by + simp only [neighbors, Finset.mem_filter] + +section Finite + +variable [Fintype P] + +def Bad (k : ℕ) (U : Finset (ZMod (37 ^ k))) (ambient : Finset (Triple P)) + (e : Triple P) (s : Sample P k) : Prop := + ∃ f ∈ neighbors ambient e, Survives k U f s + +def Good (k : ℕ) (U : Finset (ZMod (37 ^ k))) (ambient : Finset (Triple P)) + (e : Triple P) (s : Sample P k) : Prop := + Survives k U e s ∧ ¬ Bad k U ambient e s + +def goodEvent (k : ℕ) (U : Finset (ZMod (37 ^ k))) (ambient : Finset (Triple P)) + (e : Triple P) : Finset (Sample P k) := + (ownEvent k U e).filter (fun s => ¬ Bad k U ambient e s) + +@[simp] theorem mem_goodEvent (k : ℕ) (U : Finset (ZMod (37 ^ k))) + (ambient : Finset (Triple P)) (e : Triple P) (s : Sample P k) : + s ∈ goodEvent k U ambient e ↔ Good k U ambient e s := by + simp only [goodEvent, ownEvent, Finset.mem_filter, Finset.mem_univ, true_and, Good] + +theorem good_excludes_neighbor (k : ℕ) (U : Finset (ZMod (37 ^ k))) + (ambient : Finset (Triple P)) (e f : Triple P) (s : Sample P k) + (hg : Good k U ambient e s) (hf : f ∈ ambient) (hne : f ≠ e) + (hshare : SharesSide e f) : ¬ Survives k U f s := by + intro hs + exact hg.2 ⟨f, (mem_neighbors ambient e f).2 ⟨hf, hne, hshare⟩, hs⟩ + +theorem good_no_shared_side (k : ℕ) (U : Finset (ZMod (37 ^ k))) + (ambient : Finset (Triple P)) (e f : Triple P) (s : Sample P k) + (he : Good k U ambient e s) (hf : Good k U ambient f s) + (hmem : f ∈ ambient) (hne : f ≠ e) : ¬ SharesSide e f := by + intro hshare + exact good_excludes_neighbor k U ambient e f s he hmem hne hshare hf.1 + +theorem ownEvent_card_real (k : ℕ) (U : Finset (ZMod (37 ^ k))) (e : Triple P) : + ((ownEvent k U e).card : ℝ) = + ((U.card : ℝ) / ((37 ^ k : ℕ) : ℝ) ^ 2) * (Fintype.card (Sample P k) : ℝ) := by + rw [ownEvent_card, JointHashing.sample_card, ZMod.card] + push_cast + field_simp + +theorem bad_card_le (k : ℕ) (U : Finset (ZMod (37 ^ k))) + (ambient : Finset (Triple P)) (S : P → ℕ) + (hsupport : ∀ f ∈ ambient, HasSupportSum S f) + (e : Triple P) (he : e ∈ ambient) : + (((ownEvent k U e).filter (Bad k U ambient e)).card : ℝ) ≤ + ((neighbors ambient e).card : ℝ) / ((37 ^ k : ℕ) : ℝ) * + ((ownEvent k U e).card : ℝ) := by + have hset : (ownEvent k U e).filter (Bad k U ambient e) = + (ownEvent k U e).filter (fun s => ∃ f ∈ neighbors ambient e, Survives k U f s) := by + ext s + simp only [Finset.mem_filter, Bad] + rw [hset] + apply competitor_union_card_le k U S e (hsupport e he) (neighbors ambient e) + · intro f hf + exact hsupport f ((mem_neighbors ambient e f).mp hf).1 + · intro f hf + exact ((mem_neighbors ambient e f).mp hf).2.1 + · intro f hf + exact ((mem_neighbors ambient e f).mp hf).2.2 + +theorem goodEvent_card_lower (k : ℕ) (U : Finset (ZMod (37 ^ k))) + (ambient : Finset (Triple P)) (S : P → ℕ) + (hsupport : ∀ f ∈ ambient, HasSupportSum S f) + (e : Triple P) (he : e ∈ ambient) (D : ℕ) + (hdegree : (neighbors ambient e).card ≤ D) + (hsmall : (D : ℝ) / ((37 ^ k : ℕ) : ℝ) ≤ 1 / 2) : + ((U.card : ℝ) / ((37 ^ k : ℕ) : ℝ) ^ 2 / 2) * + (Fintype.card (Sample P k) : ℝ) ≤ (goodEvent k U ambient e).card := by + have hM : (0 : ℝ) ≤ ((37 ^ k : ℕ) : ℝ) := Nat.cast_nonneg _ + have hdeg : ((neighbors ambient e).card : ℝ) / ((37 ^ k : ℕ) : ℝ) ≤ 1 / 2 := + (div_le_div_of_nonneg_right (by exact_mod_cast hdegree) hM).trans hsmall + have hb : (((ownEvent k U e).filter (Bad k U ambient e)).card : ℝ) ≤ + (1 / 2) * ((ownEvent k U e).card : ℝ) := + (bad_card_le k U ambient S hsupport e he).trans + (mul_le_mul_of_nonneg_right hdeg (Nat.cast_nonneg _)) + have hg := JointLossCounts.good_card_lower (ownEvent k U e) (Bad k U ambient e) + (1 / 2) hb + rw [ownEvent_card_real] at hg + change _ ≤ ((goodEvent k U ambient e).card : ℝ) at hg + convert hg using 1 + ring + +theorem goodIncidence_eq (k : ℕ) (U : Finset (ZMod (37 ^ k))) + (ambient : Finset (Triple P)) (coarse : E → Triple P) (e : E) : + goodIncidence (fun s e => Good k U ambient (coarse e) s) e = + (goodEvent k U ambient (coarse e)).card := by + unfold goodIncidence + congr 1 + ext s + simp only [Finset.mem_filter, Finset.mem_univ, true_and, mem_goodEvent] + +theorem exists_selection_of_degree_bound [Fintype E] + (k : ℕ) (U : Finset (ZMod (37 ^ k))) + (ambient : Finset (Triple P)) (S : P → ℕ) (coarse : E → Triple P) + (hinj : Function.Injective coarse) + (hsupport : ∀ f ∈ ambient, HasSupportSum S f) + (htarget : ∀ e, coarse e ∈ ambient) (D : ℕ) + (hdegree : ∀ e, (neighbors ambient (coarse e)).card ≤ D) + (hsmall : (D : ℝ) / ((37 ^ k : ℕ) : ℝ) ≤ 1 / 2) + (K : ℕ) (hK : (K : ℝ) ≤ (Fintype.card E : ℝ) * + ((U.card : ℝ) / ((37 ^ k : ℕ) : ℝ) ^ 2 / 2)) : + ∃ (s : Sample P k) (G : Finset E), G.card = K ∧ + (∀ e ∈ G, Good k U ambient (coarse e) s) ∧ + (G : Set E).Pairwise (fun e f => ¬ SharesSide (coarse e) (coarse f)) := by + classical + have hi (e : E) : + ((U.card : ℝ) / ((37 ^ k : ℕ) : ℝ) ^ 2 / 2) * + (Fintype.card (Sample P k) : ℝ) ≤ + (goodIncidence (fun s e => Good k U ambient (coarse e) s) e : ℝ) := by + rw [goodIncidence_eq] + exact goodEvent_card_lower k U ambient S hsupport (coarse e) (htarget e) D + (hdegree e) hsmall + obtain ⟨s, hs⟩ := exists_goodCount_ge (fun s e => Good k U ambient (coarse e) s) _ hi + have hk : K ≤ goodCount (fun s e => Good k U ambient (coarse e) s) s := by + exact_mod_cast hK.trans hs + obtain ⟨G, hcard, hgood⟩ := exists_good_subfamily + (fun s e => Good k U ambient (coarse e) s) s K hk + refine ⟨s, G, hcard, hgood, ?_⟩ + intro e he f hf hne + exact good_no_shared_side k U ambient (coarse e) (coarse f) s + (hgood e he) (hgood f hf) (htarget f) (fun h => hne (hinj h).symm) + +theorem exists_selection_floor [Fintype E] + (k : ℕ) (U : Finset (ZMod (37 ^ k))) + (ambient : Finset (Triple P)) (S : P → ℕ) (coarse : E → Triple P) + (hinj : Function.Injective coarse) + (hsupport : ∀ f ∈ ambient, HasSupportSum S f) + (htarget : ∀ e, coarse e ∈ ambient) (D : ℕ) + (hdegree : ∀ e, (neighbors ambient (coarse e)).card ≤ D) + (hsmall : (D : ℝ) / ((37 ^ k : ℕ) : ℝ) ≤ 1 / 2) : + ∃ (s : Sample P k) (G : Finset E), + G.card = ⌊(Fintype.card E : ℝ) * + ((U.card : ℝ) / ((37 ^ k : ℕ) : ℝ) ^ 2 / 2)⌋₊ ∧ + (∀ e ∈ G, Good k U ambient (coarse e) s) ∧ + (G : Set E).Pairwise (fun e f => ¬ SharesSide (coarse e) (coarse f)) := by + apply exists_selection_of_degree_bound k U ambient S coarse hinj hsupport htarget D + hdegree hsmall _ (Nat.floor_le ?_) + positivity + +end Finite + +def hashLevel (H : ℝ) (N : ℕ) : ℕ := ⌊(N : ℝ) * H / Real.log 37⌋₊ + 1 + +def hashSet (H : ℝ) (N : ℕ) : Finset (ZMod (37 ^ hashLevel H N)) := + JointAPFree.modularSet (hashModulus H N) + +theorem hashSet_AP (H : ℝ) (N : ℕ) : + ∀ x ∈ hashSet H N, ∀ y ∈ hashSet H N, ∀ z ∈ hashSet H N, + x + y = 2 * z → x = z ∧ y = z := + JointAPFree.modularSet_hashAP (hashModulus H N) + +theorem eventually_exists_selection + {P E : ℕ → Type*} [∀ N, Fintype (P N)] [∀ N, Fintype (E N)] + (ambient : ∀ N, Finset (Triple (P N))) (S : ∀ N, P N → ℕ) + (coarse : ∀ N, E N → Triple (P N)) + (hinj : ∀ N, Function.Injective (coarse N)) + (hsupport : ∀ N, ∀ f ∈ ambient N, HasSupportSum (S N) f) + (htarget : ∀ N e, coarse N e ∈ ambient N) + (degree : ℕ → ℕ) + (hdegree : ∀ N e, (neighbors (ambient N) (coarse N e)).card ≤ degree N) + {A D H : ℝ} (hH : 0 ≤ H) (hgap : D < H) + (hdegreeRate : ∀ η : ℝ, 0 < η → + ∀ᶠ N in atTop, Real.log (degree N : ℝ) / (N : ℝ) ≤ D + η) + (hpos : ∀ᶠ N in atTop, 0 < Fintype.card (E N)) + (hE : Tendsto (fun N => Real.log (Fintype.card (E N) : ℝ) / (N : ℝ)) + atTop (𝓝 A)) + {ε : ℝ} (hε : 0 < ε) : + ∀ᶠ N in atTop, ∃ (s : Sample (P N) (hashLevel H N)) (G : Finset (E N)), + G.card = ⌊Real.exp ((N : ℝ) * (A - H - ε))⌋₊ ∧ + (∀ e ∈ G, Good (hashLevel H N) (hashSet H N) (ambient N) (coarse N e) s) ∧ + (G : Set (E N)).Pairwise (fun e f => ¬ SharesSide (coarse N e) (coarse N f)) := by + classical + let c : ℝ := (H - D) / 2 + have hc : 0 < c := by dsimp [c]; linarith + have hclt : c < H - D := by dsimp [c]; linarith + have hratio := eventually_degree_div_hashModulus_le_exp hH hdegreeRate hclt + have hsmall : ∀ᶠ N in atTop, + (degree N : ℝ) / (hashModulus H N : ℝ) ≤ 1 / 2 := by + apply eventually_error_le_half 1 0 hc + simpa only [pow_zero, one_mul] using hratio + let good := fun N (s : Sample (P N) (hashLevel H N)) (e : E N) => + Good (hashLevel H N) (hashSet H N) (ambient N) (coarse N e) s + have hinc : ∀ᶠ N in atTop, ∀ e, + (((JointAPFree.modularSet (hashModulus H N)).card : ℝ) / + (hashModulus H N : ℝ) ^ 2 / 2) * + (Fintype.card (Sample (P N) (hashLevel H N)) : ℝ) ≤ + (goodIncidence (good N) e : ℝ) := by + filter_upwards [hsmall] with N hN e + rw [show goodIncidence (good N) e = + (goodEvent (hashLevel H N) (hashSet H N) (ambient N) (coarse N e)).card from + goodIncidence_eq _ _ _ _ _] + exact goodEvent_card_lower (hashLevel H N) (hashSet H N) (ambient N) (S N) + (hsupport N) (coarse N e) (htarget N e) (degree N) (hdegree N e) hN + have hyield := eventually_exists_many_good_explicit good hH hpos hinc hE hε + have hselection := eventually_exists_good_subfamily good + (fun N => ⌊Real.exp ((N : ℝ) * (A - H - ε))⌋₊) hyield + filter_upwards [hselection] with N hN + obtain ⟨s, G, hcard, hgood⟩ := hN + refine ⟨s, G, hcard, hgood, ?_⟩ + intro e he f hf hne + exact good_no_shared_side (hashLevel H N) (hashSet H N) (ambient N) + (coarse N e) (coarse N f) s (hgood e he) (hgood f hf) (htarget N f) + (fun h => hne ((hinj N) h).symm) + +end MatrixMultiplication.JointOrdinarySelection + + + + + + +namespace MatrixMultiplication.JointMaskedSelection + +open JointCoarseHashing JointExtractionRates + +attribute [local instance] Classical.propDecidable + +variable {P E O V : Type*} + +structure OrbitData (P E O V : Type*) where + ambient : Finset (Triple P) + support : P → ℕ + coarse : E → Triple P + support_ambient : ∀ f ∈ ambient, HasSupportSum support f + target_mem : ∀ e, coarse e ∈ ambient + orbits : E → Finset O + full : E → O → Finset V + passing : E → O → Finset V + full_pos : ∀ e, ∀ o ∈ orbits e, 0 < (full e o).card + passing_subset : ∀ e, ∀ o ∈ orbits e, passing e o ⊆ full e o + competitors : E → O → V → Finset (Triple P) + competitor_mem : ∀ e, ∀ o ∈ orbits e, ∀ v ∈ passing e o, + ∀ f ∈ competitors e o v, f ∈ ambient + competitor_ne : ∀ e, ∀ o ∈ orbits e, ∀ v ∈ passing e o, + ∀ f ∈ competitors e o v, f ≠ coarse e + competitor_shares : ∀ e, ∀ o ∈ orbits e, ∀ v ∈ passing e o, + ∀ f ∈ competitors e o v, SharesSide (coarse e) f + +namespace OrbitData + +def eligibilityCompetitors (d : OrbitData P E O V) (e : E) : Finset (Triple P) := + d.ambient.filter (fun f => f ≠ d.coarse e ∧ f.1 = (d.coarse e).1) + +@[simp] theorem mem_eligibilityCompetitors (d : OrbitData P E O V) (e : E) (f : Triple P) : + f ∈ d.eligibilityCompetitors e ↔ + f ∈ d.ambient ∧ f ≠ d.coarse e ∧ f.1 = (d.coarse e).1 := by + simp only [eligibilityCompetitors, Finset.mem_filter] + +section Finite + +variable [Fintype P] + +def variableBad (d : OrbitData P E O V) (k : ℕ) (U : Finset (ZMod (37 ^ k))) + (e : E) (o : O) (v : V) (s : Sample P k) : Prop := + ∃ f ∈ d.competitors e o v, Survives k U f s + +def eligibilityGood (d : OrbitData P E O V) (k : ℕ) (U : Finset (ZMod (37 ^ k))) + (e : E) (s : Sample P k) : Prop := + ¬ ∃ f ∈ d.eligibilityCompetitors e, Survives k U f s + +def Failure (d : OrbitData P E O V) (k : ℕ) (U : Finset (ZMod (37 ^ k))) + (N : ℝ) (e : E) (s : Sample P k) : Prop := + JointLossCounts.targetBad (d.orbits e) (d.full e) (d.passing e) + (d.variableBad k U e) (d.eligibilityGood k U e) N s + +def Good (d : OrbitData P E O V) (k : ℕ) (U : Finset (ZMod (37 ^ k))) + (N : ℝ) (e : E) (s : Sample P k) : Prop := + Survives k U (d.coarse e) s ∧ ¬ d.Failure k U N e s + +def goodEvent (d : OrbitData P E O V) (k : ℕ) (U : Finset (ZMod (37 ^ k))) + (N : ℝ) (e : E) : Finset (Sample P k) := + (ownEvent k U (d.coarse e)).filter (fun s => ¬ d.Failure k U N e s) + +@[simp] theorem mem_goodEvent (d : OrbitData P E O V) (k : ℕ) + (U : Finset (ZMod (37 ^ k))) (N : ℝ) (e : E) (s : Sample P k) : + s ∈ d.goodEvent k U N e ↔ d.Good k U N e s := by + simp only [goodEvent, ownEvent, Finset.mem_filter, Finset.mem_univ, true_and, Good] + +theorem variableBad_card_le (d : OrbitData P E O V) (k : ℕ) + (U : Finset (ZMod (37 ^ k))) (e : E) (o : O) (ho : o ∈ d.orbits e) + (v : V) (hv : v ∈ d.passing e o) (D : ℕ) + (hdegree : (d.competitors e o v).card ≤ D) : + (((ownEvent k U (d.coarse e)).filter (d.variableBad k U e o v)).card : ℝ) ≤ + ((D : ℝ) / ((37 ^ k : ℕ) : ℝ)) * ((ownEvent k U (d.coarse e)).card : ℝ) := by + have h := competitor_union_card_le k U d.support (d.coarse e) + (d.support_ambient _ (d.target_mem e)) (d.competitors e o v) + (fun f hf => d.support_ambient f (d.competitor_mem e o ho v hv f hf)) + (d.competitor_ne e o ho v hv) (d.competitor_shares e o ho v hv) + have hdegreeR : ((d.competitors e o v).card : ℝ) ≤ (D : ℝ) := by + exact_mod_cast hdegree + have hfilter : (ownEvent k U (d.coarse e)).filter (d.variableBad k U e o v) = + (ownEvent k U (d.coarse e)).filter + (fun s => ∃ f ∈ d.competitors e o v, Survives k U f s) := by + ext s + simp only [Finset.mem_filter, variableBad] + rw [hfilter] + exact h.trans (mul_le_mul_of_nonneg_right + (div_le_div_of_nonneg_right hdegreeR (Nat.cast_nonneg _)) + (Nat.cast_nonneg _)) + +theorem eligibilityFailure_card_le (d : OrbitData P E O V) (k : ℕ) + (U : Finset (ZMod (37 ^ k))) (e : E) : + (((ownEvent k U (d.coarse e)).filter (fun s => ¬ d.eligibilityGood k U e s)).card : ℝ) ≤ + (((d.eligibilityCompetitors e).card : ℝ) / ((37 ^ k : ℕ) : ℝ)) * + ((ownEvent k U (d.coarse e)).card : ℝ) := by + have h := competitor_union_card_le k U d.support (d.coarse e) + (d.support_ambient _ (d.target_mem e)) (d.eligibilityCompetitors e) + (fun f hf => d.support_ambient f ((d.mem_eligibilityCompetitors e f).1 hf).1) + (fun f hf => ((d.mem_eligibilityCompetitors e f).1 hf).2.1) + (fun f hf => Or.inl ((d.mem_eligibilityCompetitors e f).1 hf).2.2) + simpa only [eligibilityGood, not_not] using h + +theorem failure_card_le (d : OrbitData P E O V) (k : ℕ) + (U : Finset (ZMod (37 ^ k))) (N : ℝ) (hN : 0 < N) (e : E) (D : ℕ) + (hdegree : ∀ o ∈ d.orbits e, ∀ v ∈ d.passing e o, (d.competitors e o v).card ≤ D) : + (((ownEvent k U (d.coarse e)).filter (d.Failure k U N e)).card : ℝ) ≤ + (((d.eligibilityCompetitors e).card : ℝ) / ((37 ^ k : ℕ) : ℝ) + + ((d.orbits e).card : ℝ) * N * ((D : ℝ) / ((37 ^ k : ℕ) : ℝ))) * + ((ownEvent k U (d.coarse e)).card : ℝ) := by + exact JointLossCounts.targetBad_card_le (ownEvent k U (d.coarse e)) + (d.orbits e) (d.full e) (d.passing e) (d.variableBad k U e) + (d.eligibilityGood k U e) ((D : ℝ) / ((37 ^ k : ℕ) : ℝ)) + (((d.eligibilityCompetitors e).card : ℝ) / ((37 ^ k : ℕ) : ℝ)) N + (div_nonneg (Nat.cast_nonneg _) (Nat.cast_nonneg _)) hN (d.full_pos e) + (d.passing_subset e) + (fun o ho v hv => d.variableBad_card_le k U e o ho v hv D (hdegree o ho v hv)) + (d.eligibilityFailure_card_le k U e) + +theorem ownEvent_card_real (d : OrbitData P E O V) (k : ℕ) + (U : Finset (ZMod (37 ^ k))) (e : E) : + ((ownEvent k U (d.coarse e)).card : ℝ) = + ((U.card : ℝ) / ((37 ^ k : ℕ) : ℝ) ^ 2) * (Fintype.card (Sample P k) : ℝ) := by + exact JointOrdinarySelection.ownEvent_card_real k U (d.coarse e) + +theorem goodEvent_card_lower (d : OrbitData P E O V) (k : ℕ) + (U : Finset (ZMod (37 ^ k))) (N : ℝ) (hN : 0 < N) (e : E) (D : ℕ) + (hdegree : ∀ o ∈ d.orbits e, ∀ v ∈ d.passing e o, (d.competitors e o v).card ≤ D) + (hsmall : ((d.eligibilityCompetitors e).card : ℝ) / ((37 ^ k : ℕ) : ℝ) + + ((d.orbits e).card : ℝ) * N * ((D : ℝ) / ((37 ^ k : ℕ) : ℝ)) ≤ 1 / 2) : + ((U.card : ℝ) / ((37 ^ k : ℕ) : ℝ) ^ 2 / 2) * + (Fintype.card (Sample P k) : ℝ) ≤ (d.goodEvent k U N e).card := by + have hb : (((ownEvent k U (d.coarse e)).filter (d.Failure k U N e)).card : ℝ) ≤ + (1 / 2) * ((ownEvent k U (d.coarse e)).card : ℝ) := + (d.failure_card_le k U N hN e D hdegree).trans + (mul_le_mul_of_nonneg_right hsmall (Nat.cast_nonneg _)) + have hg := JointLossCounts.good_card_lower (ownEvent k U (d.coarse e)) + (d.Failure k U N e) (1 / 2) hb + rw [d.ownEvent_card_real] at hg + change _ ≤ ((d.goodEvent k U N e).card : ℝ) at hg + convert hg using 1 + ring + +theorem goodIncidence_eq (d : OrbitData P E O V) (k : ℕ) + (U : Finset (ZMod (37 ^ k))) (N : ℝ) (e : E) : + goodIncidence (fun s e => d.Good k U N e s) e = (d.goodEvent k U N e).card := by + unfold goodIncidence + congr 1 + ext s + simp only [Finset.mem_filter, Finset.mem_univ, true_and, mem_goodEvent] + +theorem good_eligibility (d : OrbitData P E O V) (k : ℕ) + (U : Finset (ZMod (37 ^ k))) (N : ℝ) (e : E) (s : Sample P k) + (hg : d.Good k U N e s) : d.eligibilityGood k U e s := by + by_contra h + exact hg.2 (Or.inl h) + +theorem good_no_shared_x (d : OrbitData P E O V) (k : ℕ) + (U : Finset (ZMod (37 ^ k))) (N : ℝ) (e f : E) (s : Sample P k) + (he : d.Good k U N e s) (hf : d.Good k U N f s) + (hne : d.coarse f ≠ d.coarse e) : (d.coarse f).1 ≠ (d.coarse e).1 := by + intro hx + exact d.good_eligibility k U N e s he + ⟨d.coarse f, (d.mem_eligibilityCompetitors e _).2 ⟨d.target_mem f, hne, hx⟩, hf.1⟩ + +theorem good_missingFraction_le (d : OrbitData P E O V) (k : ℕ) + (U : Finset (ZMod (37 ^ k))) (C₀ N : ℝ) (e : E) (s : Sample P k) + (hg : d.Good k U N e s) + (hdet : ∀ o ∈ d.orbits e, + JointLossCounts.deterministicLossFraction (d.full e o) (d.passing e o) ≤ C₀ / N) + (o : O) (ho : o ∈ d.orbits e) : + JointLossCounts.missingFraction (d.full e o) (d.passing e o) + (d.variableBad k U e o) s ≤ (C₀ + 1) / N := + JointLossCounts.good_missingFraction_le (d.orbits e) (d.full e) (d.passing e) + (d.variableBad k U e) (d.eligibilityGood k U e) C₀ N s hg.2 + (d.passing_subset e) hdet o ho + +theorem exists_selection [Fintype E] (d : OrbitData P E O V) + (hinj : Function.Injective d.coarse) (k : ℕ) (U : Finset (ZMod (37 ^ k))) + (C₀ N : ℝ) (hN : 0 < N) (D K : ℕ) + (hdegree : ∀ e, ∀ o ∈ d.orbits e, ∀ v ∈ d.passing e o, + (d.competitors e o v).card ≤ D) + (hsmall : ∀ e, ((d.eligibilityCompetitors e).card : ℝ) / ((37 ^ k : ℕ) : ℝ) + + ((d.orbits e).card : ℝ) * N * ((D : ℝ) / ((37 ^ k : ℕ) : ℝ)) ≤ 1 / 2) + (hdet : ∀ e, ∀ o ∈ d.orbits e, + JointLossCounts.deterministicLossFraction (d.full e o) (d.passing e o) ≤ C₀ / N) + (hK : (K : ℝ) ≤ (Fintype.card E : ℝ) * + ((U.card : ℝ) / ((37 ^ k : ℕ) : ℝ) ^ 2 / 2)) : + ∃ (s : Sample P k) (G : Finset E), G.card = K ∧ + (∀ e ∈ G, d.Good k U N e s) ∧ + (∀ e ∈ G, ∀ f ∈ G, e ≠ f → (d.coarse e).1 ≠ (d.coarse f).1) ∧ + ∀ e ∈ G, ∀ o ∈ d.orbits e, + JointLossCounts.missingFraction (d.full e o) (d.passing e o) + (d.variableBad k U e o) s ≤ (C₀ + 1) / N := by + classical + have hi (e : E) : + ((U.card : ℝ) / ((37 ^ k : ℕ) : ℝ) ^ 2 / 2) * + (Fintype.card (Sample P k) : ℝ) ≤ + (goodIncidence (fun s e => d.Good k U N e s) e : ℝ) := by + rw [d.goodIncidence_eq] + exact d.goodEvent_card_lower k U N hN e D (hdegree e) (hsmall e) + obtain ⟨s, hs⟩ := exists_goodCount_ge (fun s e => d.Good k U N e s) _ hi + have hk : K ≤ goodCount (fun s e => d.Good k U N e s) s := by exact_mod_cast hK.trans hs + obtain ⟨G, hcard, hgood⟩ := exists_good_subfamily (fun s e => d.Good k U N e s) s K hk + refine ⟨s, G, hcard, hgood, ?_, ?_⟩ + · intro e he f hf hne + exact d.good_no_shared_x k U N f e s (hgood f hf) (hgood e he) + (fun h => hne (hinj h)) + · intro e he o ho + exact d.good_missingFraction_le k U C₀ N e s (hgood e he) (hdet e) o ho + +end Finite + +end OrbitData + +end MatrixMultiplication.JointMaskedSelection + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/Extraction/JointPairClassWindows.lean b/lean/OAI/LinearAlgebra/MatrixFields/Extraction/JointPairClassWindows.lean new file mode 100644 index 0000000000000000000000000000000000000000..6375229705cf57b252d6fbc3fdf6a00d9b7bd162 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/Extraction/JointPairClassWindows.lean @@ -0,0 +1,523 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Entropy.ZeroLeafRateFormula + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +namespace MatrixMultiplication.Foundation + +open scoped BigOperators + +variable {A I J : Type*} [Fintype A] [DecidableEq A] [Fintype I] [Fintype J] + [DecidableEq I] + +def wordPopulation (w : I → A) (a : A) : ℕ := Fintype.card {i // w i = a} + +omit [DecidableEq I] in +theorem wordPopulation_sum (w : I → A) : + ∑ a, wordPopulation w a = Fintype.card I := by + simpa [wordPopulation] using Fintype.card_congr (Equiv.sigmaFiberEquiv w) + +omit [Fintype A] [DecidableEq I] in +theorem wordPopulation_reindex (w : I → A) (e : J ≃ I) (a : A) : + wordPopulation (w ∘ e) a = wordPopulation w a := + Fintype.card_congr (Equiv.subtypeEquiv e fun _ => Iff.rfl) + +abbrev ExactWords (counts : A → ℕ) := + {w : Fin (∑ a, counts a) → A // ∀ a, wordPopulation w a = counts a} + +theorem wordPopulation_sigma_fst (counts : A → ℕ) (a : A) : + wordPopulation (fun i : Σ b, Fin (counts b) => i.1) a = counts a := by + let e : {i : Σ b, Fin (counts b) // i.1 = a} ≃ Fin (counts a) := + { toFun := fun i => i.property ▸ i.val.2 + invFun := fun i => ⟨⟨a, i⟩, rfl⟩ + left_inv := by + rintro ⟨⟨b, i⟩, h⟩ + cases h + rfl + right_inv := by intro i; rfl } + exact (Fintype.card_congr e).trans (Fintype.card_fin _) + +theorem exactWords_nonempty (counts : A → ℕ) : Nonempty (ExactWords counts) := by + classical + let e : Fin (∑ a, counts a) ≃ (Σ a, Fin (counts a)) := + Fintype.equivOfCardEq (by simp) + refine ⟨⟨(fun i : Σ a, Fin (counts a) => i.1) ∘ e, ?_⟩⟩ + intro a + rw [wordPopulation_reindex, wordPopulation_sigma_fst] + +omit [Fintype A] [DecidableEq I] in +theorem samePopulation_iff_permutation (w v : I → A) : + (∀ a, wordPopulation v a = wordPopulation w a) ↔ + ∃ e : Equiv.Perm I, w ∘ e = v := by + classical + constructor + · intro h + let es : ∀ a, {i // v i = a} ≃ {i // w i = a} := + fun a => Fintype.equivOfCardEq (h a) + refine ⟨Equiv.ofFiberEquiv es, ?_⟩ + funext i + exact Equiv.ofFiberEquiv_map es i + · rintro ⟨e, rfl⟩ a + exact wordPopulation_reindex w e a + +theorem samePopulation_card_mul (w : I → A) : + Fintype.card {v : I → A // ∀ a, wordPopulation v a = wordPopulation w a} * + (∏ a, (wordPopulation w a).factorial) = (Fintype.card I).factorial := by + classical + let G := DomMulAct (Equiv.Perm I) + let : Fintype G := Fintype.ofEquiv (Equiv.Perm I) DomMulAct.mk + let eOrbit : {v : I → A // ∀ a, wordPopulation v a = wordPopulation w a} ≃ + MulAction.orbit G w := + Equiv.subtypeEquivRight fun v => by + rw [samePopulation_iff_permutation, MulAction.mem_orbit_iff] + constructor + · rintro ⟨e, he⟩ + exact ⟨DomMulAct.mk e, he⟩ + · rintro ⟨g, hg⟩ + exact ⟨DomMulAct.mk.symm g, hg⟩ + let eStab : MulAction.stabilizer G w ≃ + {e : Equiv.Perm I // w ∘ e = w} := + Equiv.subtypeEquiv DomMulAct.mk.symm fun _ => DomMulAct.mem_stabilizer_iff + have hstab : Fintype.card (MulAction.stabilizer G w) = + ∏ a, (wordPopulation w a).factorial := by + rw [Fintype.card_congr eStab] + exact DomMulAct.stabilizer_card w + have hgroup : Fintype.card G = (Fintype.card I).factorial := + (Fintype.card_congr DomMulAct.mk.symm).trans Fintype.card_perm + have h := MulAction.card_orbit_mul_card_stabilizer_eq_card_group G w + rw [← Fintype.card_congr eOrbit, hstab, hgroup] at h + exact h + +theorem exactWords_card (counts : A → ℕ) : + Fintype.card (ExactWords counts) = Nat.multinomial Finset.univ counts := by + classical + obtain ⟨w⟩ := exactWords_nonempty counts + let e : ExactWords counts ≃ + {v : Fin (∑ a, counts a) → A // ∀ a, + wordPopulation v a = wordPopulation w.val a} := + Equiv.subtypeEquivRight fun v => by simp only [w.property] + have h := samePopulation_card_mul w.val + rw [← Fintype.card_congr e] at h + simp only [w.property, Fintype.card_fin] at h + exact Nat.eq_div_of_mul_eq_left + (ne_of_gt (Nat.prod_factorial_pos Finset.univ counts)) h + +theorem exactWords_card_pos (counts : A → ℕ) : 0 < Fintype.card (ExactWords counts) := by + rw [exactWords_card] + exact Nat.multinomial_pos Finset.univ counts + +theorem exactWords_card_le (counts : A → ℕ) : + Fintype.card (ExactWords counts) ≤ (Fintype.card A) ^ (∑ a, counts a) := by + classical + calc + Fintype.card (ExactWords counts) ≤ + Fintype.card (Fin (∑ a, counts a) → A) := + Fintype.card_le_of_injective Subtype.val Subtype.val_injective + _ = _ := by simp + +end MatrixMultiplication.Foundation + + + + + +namespace MatrixMultiplication.Foundation + +open scoped BigOperators + +variable {A B I : Type*} [Fintype A] [DecidableEq A] + [Fintype B] [DecidableEq B] [Fintype I] [DecidableEq I] + +abbrev PopulationWords (I : Type*) [Fintype I] (counts : A → ℕ) := + {w : I → A // ∀ a, wordPopulation w a = counts a} + +noncomputable def populationWordsEquiv (counts : A → ℕ) + (h : Fintype.card I = ∑ a, counts a) : PopulationWords I counts ≃ ExactWords counts := by + let e : I ≃ Fin (∑ a, counts a) := Fintype.equivFinOfCardEq h + exact + { toFun := fun w => + ⟨w.val ∘ e.symm, fun a => (wordPopulation_reindex w.val e.symm a).trans (w.property a)⟩ + invFun := fun w => + ⟨w.val ∘ e, fun a => (wordPopulation_reindex w.val e a).trans (w.property a)⟩ + left_inv := by + intro w + apply Subtype.ext + funext i + simp + right_inv := by + intro w + apply Subtype.ext + funext i + simp } + +theorem populationWords_card (counts : A → ℕ) + (h : Fintype.card I = ∑ a, counts a) : + Fintype.card (PopulationWords I counts) = Nat.multinomial Finset.univ counts := by + rw [Fintype.card_congr (populationWordsEquiv counts h), exactWords_card] + +abbrev ConditionalWords (w : I → A) (counts : A → B → ℕ) := + {r : I → B // ∀ a b, Fintype.card {i // w i = a ∧ r i = b} = counts a b} + +def fiberWordEquiv (w : I → A) : (I → B) ≃ (∀ a, {i // w i = a} → B) where + toFun r _ i := r i.val + invFun r i := r (w i) ⟨i, rfl⟩ + left_inv _ := rfl + right_inv := by + intro r + funext a i + rcases i with ⟨i, hi⟩ + cases hi + rfl + +omit [Fintype A] [Fintype B] [DecidableEq I] in +theorem wordPopulation_fiber (w : I → A) (r : I → B) (a : A) (b : B) : + wordPopulation (fun i : {i // w i = a} => r i.val) b = + Fintype.card {i // w i = a ∧ r i = b} := + Fintype.card_congr + (Equiv.subtypeSubtypeEquivSubtypeInter (fun i => w i = a) (fun i => r i = b)) + +def conditionalWordsEquiv (w : I → A) (counts : A → B → ℕ) : + ConditionalWords w counts ≃ ∀ a, PopulationWords {i // w i = a} (counts a) := by + let e : ConditionalWords w counts ≃ + {r : ∀ a, {i // w i = a} → B // ∀ a b, wordPopulation (r a) b = counts a b} := + Equiv.subtypeEquiv (fiberWordEquiv w) fun r => by + change (∀ a b, Fintype.card {i // w i = a ∧ r i = b} = counts a b) ↔ + ∀ a b, wordPopulation (fun i : {i // w i = a} => r i.val) b = counts a b + simp only [wordPopulation_fiber] + exact e.trans (Equiv.subtypePiEquivPi + (β := fun a : A => {i // w i = a} → B) + (p := fun a r => ∀ b, wordPopulation r b = counts a b)) + +theorem conditionalWords_card (w : I → A) (counts : A → B → ℕ) + (h : ∀ a, wordPopulation w a = ∑ b, counts a b) : + Fintype.card (ConditionalWords w counts) = + ∏ a, Nat.multinomial Finset.univ (counts a) := by + rw [Fintype.card_congr (conditionalWordsEquiv w counts), Fintype.card_pi] + exact Finset.prod_congr rfl fun a _ => populationWords_card (counts a) (h a) + +theorem conditionalWords_card_pos (w : I → A) (counts : A → B → ℕ) + (h : ∀ a, wordPopulation w a = ∑ b, counts a b) : + 0 < Fintype.card (ConditionalWords w counts) := by + rw [conditionalWords_card w counts h] + exact Finset.prod_pos fun a _ => Nat.multinomial_pos Finset.univ (counts a) + +theorem conditionalWords_nonempty (w : I → A) (counts : A → B → ℕ) + (h : ∀ a, wordPopulation w a = ∑ b, counts a b) : + Nonempty (ConditionalWords w counts) := + Fintype.card_pos_iff.mp (conditionalWords_card_pos w counts h) + +theorem conditionalWords_nonempty_iff (w : I → A) (counts : A → B → ℕ) : + Nonempty (ConditionalWords w counts) ↔ + ∀ a, wordPopulation w a = ∑ b, counts a b := by + constructor + · rintro ⟨r⟩ a + calc + wordPopulation w a = + ∑ b, wordPopulation (fun i : {i // w i = a} => r.val i.val) b := + (wordPopulation_sum _).symm + _ = ∑ b, counts a b := by + apply Finset.sum_congr rfl + intro b _ + rw [wordPopulation_fiber, r.property] + · exact conditionalWords_nonempty w counts + +omit [DecidableEq A] [DecidableEq B] in +theorem multinomial_prod_counts (counts : A × B → ℕ) : + Nat.multinomial Finset.univ counts = + Nat.multinomial Finset.univ (fun a => ∑ b, counts (a, b)) * + ∏ a, Nat.multinomial Finset.univ (fun b => counts (a, b)) := by + apply Nat.mul_left_cancel (Nat.prod_factorial_pos Finset.univ counts) + rw [Nat.multinomial_spec] + symm + calc + (∏ ab, (counts ab).factorial) * + (Nat.multinomial Finset.univ (fun a => ∑ b, counts (a, b)) * + ∏ a, Nat.multinomial Finset.univ (fun b => counts (a, b))) = + ((∏ a, ∏ b, (counts (a, b)).factorial) * + ∏ a, Nat.multinomial Finset.univ (fun b => counts (a, b))) * + Nat.multinomial Finset.univ (fun a => ∑ b, counts (a, b)) := by + rw [Fintype.prod_prod_type] + ac_rfl + _ = (∏ a, ((∏ b, (counts (a, b)).factorial) * + Nat.multinomial Finset.univ (fun b => counts (a, b)))) * + Nat.multinomial Finset.univ (fun a => ∑ b, counts (a, b)) := by + rw [Finset.prod_mul_distrib] + _ = (∏ a, (∑ b, counts (a, b)).factorial) * + Nat.multinomial Finset.univ (fun a => ∑ b, counts (a, b)) := by + congr 1 + apply Finset.prod_congr rfl + intro a _ + exact Nat.multinomial_spec Finset.univ (fun b => counts (a, b)) + _ = (∑ a, ∑ b, counts (a, b)).factorial := + Nat.multinomial_spec Finset.univ (fun a => ∑ b, counts (a, b)) + _ = (∑ ab, counts ab).factorial := by rw [Fintype.sum_prod_type] + +theorem exactWords_card_prod_counts (counts : A × B → ℕ) : + Fintype.card (ExactWords counts) = + Fintype.card (ExactWords (fun a => ∑ b, counts (a, b))) * + ∏ a, Fintype.card (ExactWords (fun b => counts (a, b))) := by + simpa only [exactWords_card] using multinomial_prod_counts counts + +theorem exactWords_card_eq_coarse_mul_conditional (counts : A × B → ℕ) + (w : ExactWords (fun a => ∑ b, counts (a, b))) : + Fintype.card (ExactWords counts) = + Fintype.card (ExactWords (fun a => ∑ b, counts (a, b))) * + Fintype.card (ConditionalWords w.val (fun a b => counts (a, b))) := by + rw [conditionalWords_card w.val (fun a b => counts (a, b)) w.property] + simpa only [exactWords_card] using multinomial_prod_counts counts + +end MatrixMultiplication.Foundation + + + + + +noncomputable section + +namespace MatrixMultiplication.Foundation + +open scoped BigOperators + +universe u v + +def pushforwardCounts {A B : Type*} [Fintype A] + (counts : A → ℕ) (label : A → B) (b : B) : ℕ := by + classical + exact ∑ a, if label a = b then counts a else 0 + +theorem pushforwardCounts_sum {A B : Type*} [Fintype A] [Fintype B] + (counts : A → ℕ) (label : A → B) : + (∑ b, pushforwardCounts counts label b) = ∑ a, counts a := by + classical + unfold pushforwardCounts + rw [Finset.sum_comm] + simp + +theorem pushforwardCounts_apply {A B : Type*} [Fintype A] + (counts : A → ℕ) (label : A → B) (hinjective : Function.Injective label) + (a : A) : pushforwardCounts counts label (label a) = counts a := by + classical + simp [pushforwardCounts, hinjective.eq_iff] + +theorem pushforwardCounts_sum_pair {A B C : Type*} + [Fintype A] [Fintype C] (counts : A → ℕ) + (coarse : A → B) (fine : A → C) (b : B) : + (∑ c, pushforwardCounts counts (fun a => (coarse a, fine a)) (b, c)) = + pushforwardCounts counts coarse b := by + classical + unfold pushforwardCounts + rw [Finset.sum_comm] + apply Finset.sum_congr rfl + intro a _ + by_cases hab : coarse a = b + · simp [Prod.mk.injEq, hab] + · simp [Prod.mk.injEq, hab] + +theorem pushforwardCounts_factorial_prod_of_injective {A B : Type*} + [Fintype A] [Fintype B] (counts : A → ℕ) (label : A → B) + (hinjective : Function.Injective label) : + (∏ b, (pushforwardCounts counts label b).factorial) = + ∏ a, (counts a).factorial := by + classical + have hfactor (b : B) : (pushforwardCounts counts label b).factorial = + ∏ a, if label a = b then (counts a).factorial else 1 := by + by_cases hb : ∃ a, label a = b + · obtain ⟨a, rfl⟩ := hb + rw [pushforwardCounts_apply counts label hinjective] + simp [hinjective.eq_iff] + · simp [pushforwardCounts, not_exists.mp hb] + simp_rw [hfactor] + rw [Finset.prod_comm] + simp + +theorem multinomial_pushforwardCounts_of_injective {A B : Type*} + [Fintype A] [Fintype B] (counts : A → ℕ) (label : A → B) + (hinjective : Function.Injective label) : + Nat.multinomial Finset.univ (pushforwardCounts counts label) = + Nat.multinomial Finset.univ counts := by + simp only [Nat.multinomial, pushforwardCounts_sum, + pushforwardCounts_factorial_prod_of_injective counts label hinjective] + +namespace LabelHierarchyCounts + +variable {Label : ℕ → Type u} [∀ n, Fintype (Label n)] + +def refinementCount (counts : ∀ n, LabelRecord Label n → ℕ) (n : ℕ) : ℕ := + ∏ r : LabelRecord Label n, + Nat.multinomial Finset.univ (fun s : Label n => counts (n + 1) (r, s)) + +theorem multinomial_succ (counts : ∀ n, LabelRecord Label n → ℕ) (n : ℕ) + (compatible : ∀ r, counts n r = ∑ s : Label n, counts (n + 1) (r, s)) : + Nat.multinomial Finset.univ (counts (n + 1)) = + Nat.multinomial Finset.univ (counts n) * refinementCount counts n := by + classical + erw [multinomial_prod_counts] + have hrows : (fun r => ∑ s : Label n, counts (n + 1) (r, s)) = counts n := + funext fun r => (compatible r).symm + rw [hrows] + rfl + +theorem pool_multinomial_eq_one_of_zero + (counts : ∀ n, LabelRecord Label n → ℕ) (n : ℕ) + (compatible : ∀ r, counts n r = ∑ s : Label n, counts (n + 1) (r, s)) + (r : LabelRecord Label n) (hzero : counts n r = 0) : + Nat.multinomial Finset.univ (fun s : Label n => counts (n + 1) (r, s)) = 1 := by + have hchild (s : Label n) : counts (n + 1) (r, s) = 0 := by + apply Nat.eq_zero_of_le_zero + calc + counts (n + 1) (r, s) ≤ ∑ t : Label n, counts (n + 1) (r, t) := + Finset.single_le_sum (f := fun t : Label n => counts (n + 1) (r, t)) + (fun t _ => Nat.zero_le _) (Finset.mem_univ s) + _ = 0 := (compatible r).symm.trans hzero + simp [Nat.multinomial, hchild] + +theorem multinomial_eq_refinementCount_product + (counts : ∀ n, LabelRecord Label n → ℕ) (depth : ℕ) + (compatible : ∀ n < depth, ∀ r, + counts n r = ∑ s : Label n, counts (n + 1) (r, s)) : + Nat.multinomial Finset.univ (counts depth) = + ∏ n ∈ Finset.range depth, refinementCount counts n := by + classical + induction depth with + | zero => + have hroot : (Finset.univ : Finset (LabelRecord Label 0)) = {PUnit.unit} := rfl + erw [hroot, Nat.multinomial_singleton] + simp + | succ depth ih => + rw [multinomial_succ counts depth (compatible depth (Nat.lt_succ_self depth))] + rw [ih (fun n hn => compatible n (Nat.lt_trans hn (Nat.lt_succ_self depth))), + Finset.prod_range_succ] + +def sourcePrefixCounts {A : Type v} [Fintype A] (counts : A → ℕ) + (labels : ∀ n, A → Label n) (n : ℕ) : LabelRecord Label n → ℕ := + pushforwardCounts counts (labelRecordOf labels n) + +theorem sourcePrefixCounts_compatible {A : Type v} [Fintype A] + (counts : A → ℕ) (labels : ∀ n, A → Label n) (n : ℕ) + (r : LabelRecord Label n) : + sourcePrefixCounts counts labels n r = + ∑ s : Label n, sourcePrefixCounts counts labels (n + 1) (r, s) := + (pushforwardCounts_sum_pair counts (labelRecordOf labels n) (labels n) r).symm + +theorem source_refinementCount_product {A : Type v} [Fintype A] + (counts : A → ℕ) (labels : ∀ n, A → Label n) (depth : ℕ) + (hinjective : Function.Injective (labelRecordOf labels depth)) : + (∏ n ∈ Finset.range depth, refinementCount (sourcePrefixCounts counts labels) n) = + Nat.multinomial Finset.univ counts := by + calc + (∏ n ∈ Finset.range depth, refinementCount (sourcePrefixCounts counts labels) n) = + Nat.multinomial Finset.univ (sourcePrefixCounts counts labels depth) := + (multinomial_eq_refinementCount_product (sourcePrefixCounts counts labels) depth + (fun n _ r => sourcePrefixCounts_compatible counts labels n r)).symm + _ = Nat.multinomial Finset.univ counts := + multinomial_pushforwardCounts_of_injective counts + (labelRecordOf labels depth) hinjective + +theorem source_refinementCount_product_eq_exactWords_card + {A : Type v} [Fintype A] [DecidableEq A] + (counts : A → ℕ) (labels : ∀ n, A → Label n) (depth : ℕ) + (hinjective : Function.Injective (labelRecordOf labels depth)) : + (∏ n ∈ Finset.range depth, refinementCount (sourcePrefixCounts counts labels) n) = + Fintype.card (ExactWords counts) := by + rw [source_refinementCount_product counts labels depth hinjective, exactWords_card] + +end LabelHierarchyCounts +end MatrixMultiplication.Foundation + + + + + + +namespace MatrixMultiplication.JointPairClassWindows + +open MatrixMultiplication.Foundation + +attribute [local instance] Classical.propDecidable + +variable {I A C : Type*} [Fintype I] [Fintype A] [Fintype C] + [DecidableEq I] [DecidableEq A] [DecidableEq C] + +abbrev Fiber (k : I → C) (c : C) := {i : I // k i = c} + +def fiberWord (z : I → A) (k : I → C) (c : C) : Fiber k c → A := + fun i => z i.val + +omit [Fintype A] [Fintype C] [DecidableEq I] in +theorem fiber_population (z : I → A) (k : I → C) (f : A → C) + (hf : ∀ i, f (z i) = k i) (c : C) (a : A) : + wordPopulation (fiberWord z k c) a = + if f a = c then wordPopulation z a else 0 := by + classical + by_cases ha : f a = c + · rw [ite_eq_left ha] + unfold wordPopulation + apply Fintype.card_congr + exact + { toFun := fun i => ⟨i.val.val, i.property⟩ + invFun := fun i => ⟨⟨i.val, by rw [← hf i.val, i.property, ha]⟩, i.property⟩ + left_inv := fun ⟨⟨i, hi⟩, hia⟩ => rfl + right_inv := fun ⟨i, hia⟩ => rfl } + · rw [ite_eq_right ha] + let : IsEmpty {i : Fiber k c // fiberWord z k c i = a} := + ⟨fun i => ha (calc + f a = f (z i.val.val) := congrArg f i.property.symm + _ = k i.val.val := hf _ + _ = c := i.val.property)⟩ + exact Fintype.card_eq_zero + +omit [Fintype C] [DecidableEq I] in +theorem fiber_card (k : I → C) (c : C) : + Fintype.card (Fiber k c) = wordPopulation k c := rfl + +def conditionalCenter (f : A → C) (c : C) (q : A → ℝ) (mass : ℝ) : A → ℝ := + fun a => if f a = c then q a / mass else 0 + +omit [Fintype A] [Fintype C] [DecidableEq I] in +theorem fiber_window (z : I → A) (k : I → C) (f : A → C) + (hf : ∀ i, f (z i) = k i) (c : C) (q : A → ℝ) (mass η : ℝ) + (hmass : 0 < mass) (hη : 0 ≤ η) + (hclass : (Fintype.card (Fiber k c) : ℝ) = (Fintype.card I : ℝ) * mass) + (hwindow : ∀ a, |(wordPopulation z a : ℝ) / Fintype.card I - q a| ≤ η) : + ∀ a, |(wordPopulation (fiberWord z k c) a : ℝ) / Fintype.card (Fiber k c) - + conditionalCenter f c q mass a| ≤ η / mass := by + intro a + rw [fiber_population z k f hf c a] + by_cases ha : f a = c + · simp only [ha, ite_true, conditionalCenter] + rw [hclass] + have hid : (wordPopulation z a : ℝ) / ((Fintype.card I : ℝ) * mass) - q a / mass = + ((wordPopulation z a : ℝ) / Fintype.card I - q a) / mass := by + rw [sub_div, div_div] + rw [hid, abs_div, abs_of_pos hmass] + exact div_le_div_of_nonneg_right (hwindow a) hmass.le + · simp only [ha, ite_false, Nat.cast_zero, zero_div, conditionalCenter, sub_zero, abs_zero] + exact div_nonneg hη hmass.le + +omit [Fintype A] [Fintype C] [DecidableEq I] in +theorem fiber_count_window (z : I → A) (k : I → C) (f : A → C) + (hf : ∀ i, f (z i) = k i) (c : C) (q : A → ℝ) (η : ℝ) (hη : 0 ≤ η) + (hwindow : ∀ a, + |(wordPopulation z a : ℝ) - (Fintype.card I : ℝ) * q a| ≤ (Fintype.card I : ℝ) * η) : + ∀ a, |(wordPopulation (fiberWord z k c) a : ℝ) - + (Fintype.card I : ℝ) * (if f a = c then q a else 0)| ≤ (Fintype.card I : ℝ) * η := by + intro a + rw [fiber_population z k f hf c a] + by_cases ha : f a = c + · simpa only [ha, ite_true] using hwindow a + · simp only [ha, ite_false, Nat.cast_zero, mul_zero, sub_zero, abs_zero] + exact mul_nonneg (Nat.cast_nonneg _) hη + +end MatrixMultiplication.JointPairClassWindows + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/Extraction/JointTypeCounts.lean b/lean/OAI/LinearAlgebra/MatrixFields/Extraction/JointTypeCounts.lean new file mode 100644 index 0000000000000000000000000000000000000000..d3584f38c9e3c3590032539f7e1778cc76a2bc81 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/Extraction/JointTypeCounts.lean @@ -0,0 +1,659 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Entropy.ZeroLeafRates + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section + +namespace MatrixMultiplication.JointTypeCounts + +open MatrixMultiplication.Foundation Filter +open scoped BigOperators Topology + +section Incidence + +variable {G C B : Type*} [Group G] [MulAction G C] [MulAction G B] + [MulAction.IsPretransitive G C] [MulAction.IsPretransitive G B] + [Fintype C] [Fintype B] + +theorem invariant_incidence_count + (R : C → B → Prop) [∀ c b, Decidable (R c b)] + (hR : ∀ (g : G) (c : C) (b : B), R (g • c) (g • b) ↔ R c b) + (c₀ : C) (b₀ : B) : + Fintype.card C * Fintype.card {b : B // R c₀ b} = + Fintype.card B * Fintype.card {c : C // R c b₀} := by + classical + have hrow (c : C) : Fintype.card {b : B // R c b} = + Fintype.card {b : B // R c₀ b} := by + obtain ⟨g, hg⟩ := MulAction.exists_smul_eq G c c₀ + apply Fintype.card_congr + exact (MulAction.toPerm (β := B) g).subtypeEquiv (fun b => by + change R c b ↔ R c₀ (g • b) + rw [← hg] + exact (hR g c b).symm) + have hcol (b : B) : Fintype.card {c : C // R c b} = + Fintype.card {c : C // R c b₀} := by + obtain ⟨g, hg⟩ := MulAction.exists_smul_eq G b b₀ + apply Fintype.card_congr + exact (MulAction.toPerm (β := C) g).subtypeEquiv (fun c => by + change R c b ↔ R (g • c) b₀ + rw [← hg] + exact (hR g c b).symm) + let swap : (Σ c : C, {b : B // R c b}) ≃ + (Σ b : B, {c : C // R c b}) := + { toFun := fun x => ⟨x.2.1, x.1, x.2.2⟩ + invFun := fun x => ⟨x.2.1, x.1, x.2.2⟩ + left_inv := fun ⟨c, b, h⟩ => rfl + right_inv := fun ⟨b, c, h⟩ => rfl } + simpa only [Fintype.card_sigma, hrow, hcol, Finset.sum_const, + Finset.card_univ, nsmul_eq_mul, Nat.cast_id] using Fintype.card_congr swap + +theorem invariant_incidence_degree_eq + (R : C → B → Prop) [∀ c b, Decidable (R c b)] + (hR : ∀ (g : G) (c : C) (b : B), R (g • c) (g • b) ↔ R c b) + (c₀ : C) (b₀ : B) : + (Fintype.card {c : C // R c b₀} : ℝ) = + (Fintype.card C : ℝ) * Fintype.card {b : B // R c₀ b} / + Fintype.card B := by + have : Nonempty B := ⟨b₀⟩ + have hB : (Fintype.card B : ℝ) ≠ 0 := by + exact_mod_cast (Nat.ne_of_gt (Fintype.card_pos : 0 < Fintype.card B)) + apply (eq_div_iff hB).mpr + have h := invariant_incidence_count R hR c₀ b₀ + exact_mod_cast (by simpa only [Nat.mul_comm] using h.symm) + +theorem invariant_incidence_degree_le_exp + (R : C → B → Prop) [∀ c b, Decidable (R c b)] + (hR : ∀ (g : G) (c : C) (b : B), R (g • c) (g • b) ↔ R c b) + (c₀ : C) (b₀ : B) (candidateRate statisticRate rowRate : ℝ) + (hC : (Fintype.card C : ℝ) ≤ Real.exp candidateRate) + (hB : Real.exp statisticRate ≤ (Fintype.card B : ℝ)) + (hrow : (Fintype.card {b : B // R c₀ b} : ℝ) ≤ Real.exp rowRate) : + (Fintype.card {c : C // R c b₀} : ℝ) ≤ + Real.exp (candidateRate - statisticRate + rowRate) := by + rw [invariant_incidence_degree_eq R hR c₀ b₀] + have hnum : (Fintype.card C : ℝ) * Fintype.card {b : B // R c₀ b} ≤ + Real.exp (candidateRate + rowRate) := by + rw [Real.exp_add] + exact mul_le_mul hC hrow (Nat.cast_nonneg _) (Real.exp_pos _).le + calc + (Fintype.card C : ℝ) * Fintype.card {b : B // R c₀ b} / + Fintype.card B ≤ + Real.exp (candidateRate + rowRate) / Real.exp statisticRate := + div_le_div₀ (Real.exp_pos _).le hnum (Real.exp_pos _) hB + _ = Real.exp (candidateRate - statisticRate + rowRate) := by + rw [← Real.exp_sub] + congr 1 + ring + +end Incidence + +section FixedClasses + +variable {C : Type*} [Fintype C] [DecidableEq C] +variable (P A : C → Type*) + [∀ c, Fintype (P c)] [∀ c, DecidableEq (P c)] + [∀ c, Fintype (A c)] [∀ c, DecidableEq (A c)] + +abbrev FixedClassWords (counts : ∀ c, A c → ℕ) := + ∀ c, {w : P c → A c // ∀ a, wordPopulation w a = counts c a} + +def fixedWordsEquiv {I B : Type*} [Fintype I] [DecidableEq I] + [Fintype B] [DecidableEq B] (counts : B → ℕ) + (hsize : Fintype.card I = ∑ b, counts b) : + {w : I → B // ∀ b, wordPopulation w b = counts b} ≃ ExactWords counts := by + classical + let e : Fin (∑ b, counts b) ≃ I := Fintype.equivOfCardEq (by simpa using hsize.symm) + exact + { toFun := fun w => ⟨w.val ∘ e, fun b => by + rw [wordPopulation_reindex] + exact w.property b⟩ + invFun := fun w => ⟨w.val ∘ e.symm, fun b => by + rw [wordPopulation_reindex] + exact w.property b⟩ + left_inv := by + intro w + apply Subtype.ext + funext i + simp + right_inv := by + intro w + apply Subtype.ext + funext i + simp } + +theorem fixedClassWords_card (counts : ∀ c, A c → ℕ) + (hsize : ∀ c, Fintype.card (P c) = ∑ a, counts c a) : + Fintype.card (FixedClassWords P A counts) = + ∏ c, Nat.multinomial Finset.univ (counts c) := by + classical + rw [Fintype.card_pi] + apply Finset.prod_congr rfl + intro c _ + exact (Fintype.card_congr (fixedWordsEquiv (counts c) (hsize c))).trans + (exactWords_card (counts c)) + +abbrev ClassExactWords (counts : ∀ c, A c → ℕ) := ∀ c, ExactWords (counts c) + +theorem classExactWords_card (counts : ∀ c, A c → ℕ) : + Fintype.card (ClassExactWords A counts) = + ∏ c, Nat.multinomial Finset.univ (counts c) := by + classical + simp only [ClassExactWords, Fintype.card_pi, exactWords_card] + +theorem classExactWords_card_pos (counts : ∀ c, A c → ℕ) : + 0 < Fintype.card (ClassExactWords A counts) := by + rw [classExactWords_card] + exact Finset.prod_pos fun c _ => Nat.multinomial_pos _ _ + +theorem classExactWords_card_mul_factorials (counts : ∀ c, A c → ℕ) : + Fintype.card (ClassExactWords A counts) * + (∏ c, ∏ a, (counts c a).factorial) = + ∏ c, (∑ a, counts c a).factorial := by + rw [classExactWords_card, ← Finset.prod_mul_distrib] + apply Finset.prod_congr rfl + intro c _ + simpa only [mul_comm] using Nat.multinomial_spec Finset.univ (counts c) + +omit [Fintype C] [DecidableEq C] [∀ c, DecidableEq (P c)] + [∀ c, Fintype (A c)] in +theorem fixedClassWords_transitive (counts : ∀ c, A c → ℕ) + (w v : FixedClassWords P A counts) : + ∃ e : ∀ c, Equiv.Perm (P c), ∀ c, (w c).val ∘ e c = (v c).val := by + have he : ∀ c, ∃ e : Equiv.Perm (P c), (w c).val ∘ e = (v c).val := by + intro c + apply (samePopulation_iff_permutation (w c).val (v c).val).mp + intro a + rw [(w c).property a, (v c).property a] + choose e he using he + exact ⟨e, he⟩ + +theorem log_classExactWords_card (counts : ∀ c, A c → ℕ) : + Real.log (Fintype.card (ClassExactWords A counts) : ℝ) = + ∑ c, Real.log (Nat.multinomial Finset.univ (counts c) : ℝ) := by + rw [classExactWords_card, Nat.cast_prod] + exact Real.log_prod fun c _ => by + exact_mod_cast (Nat.ne_of_gt (Nat.multinomial_pos Finset.univ (counts c))) + +theorem log_classExactWords_card_eq_factorials (counts : ∀ c, A c → ℕ) : + Real.log (Fintype.card (ClassExactWords A counts) : ℝ) = + (∑ c, Real.log ((∑ a, counts c a).factorial : ℝ)) - + ∑ c, ∑ a, Real.log ((counts c a).factorial : ℝ) := by + simp only [log_classExactWords_card, log_multinomial, Finset.sum_sub_distrib] + +theorem abs_log_classExactWords_card_sub_entropy_le (counts : ∀ c, A c → ℕ) : + |Real.log (Fintype.card (ClassExactWords A counts) : ℝ) - + ∑ c, (∑ a, counts c a : ℕ) * + finiteEntropy (fun a => (counts c a : ℝ) / (∑ b, counts c b : ℕ))| ≤ + ∑ c, ((Fintype.card (A c) : ℝ) + 1) * + (1 + Real.log ((∑ a, counts c a) + 1 : ℕ)) := by + rw [log_classExactWords_card, ← Finset.sum_sub_distrib] + exact (Finset.abs_sum_le_sum_abs _ _).trans + (Finset.sum_le_sum fun c _ => abs_log_multinomial_sub_entropy_le (counts c)) + +theorem abs_log_fixedClassWords_card_sub_entropy_le (counts : ∀ c, A c → ℕ) + (hsize : ∀ c, Fintype.card (P c) = ∑ a, counts c a) : + |Real.log (Fintype.card (FixedClassWords P A counts) : ℝ) - + ∑ c, (∑ a, counts c a : ℕ) * + finiteEntropy (fun a => (counts c a : ℝ) / (∑ b, counts c b : ℕ))| ≤ + ∑ c, ((Fintype.card (A c) : ℝ) + 1) * + (1 + Real.log ((∑ a, counts c a) + 1 : ℕ)) := by + rw [fixedClassWords_card P A counts hsize, ← classExactWords_card A counts] + exact abs_log_classExactWords_card_sub_entropy_le A counts + +theorem tendsto_log_classExactWords_card_div (counts : ∀ c, A c → ℕ) + (hpos : ∀ c, 0 < ∑ a, counts c a) : + Tendsto (fun t : ℕ => + Real.log (Fintype.card (ClassExactWords A (fun c a => t * counts c a)) : ℝ) / + (t : ℝ)) atTop + (𝓝 (∑ c, (∑ a, counts c a : ℕ) * + finiteEntropy (fun a => (counts c a : ℝ) / (∑ b, counts c b : ℕ)))) := by + have hclass (c : C) : Tendsto + (fun t : ℕ => Real.log (Nat.multinomial Finset.univ + (fun a => t * counts c a) : ℝ) / (t : ℝ)) atTop + (𝓝 ((∑ a, counts c a : ℕ) * + finiteEntropy (fun a => (counts c a : ℝ) / (∑ b, counts c b : ℕ)))) := by + have hD : ((∑ a, counts c a : ℕ) : ℝ) ≠ 0 := by + exact_mod_cast (Nat.ne_of_gt (hpos c)) + have h := (tendsto_log_multinomial_mul (counts c) (hpos c)).const_mul + ((∑ a, counts c a : ℕ) : ℝ) + convert h using 1 + funext t + rw [← mul_div_assoc, mul_comm (t : ℝ) ((∑ a, counts c a : ℕ) : ℝ), + mul_div_mul_left _ _ hD] + have hsum := tendsto_finsetSum Finset.univ (fun c _ => hclass c) + simpa only [log_classExactWords_card, Finset.sum_div] using hsum + +end FixedClasses + +section CoarseFibers + +variable {I A B : Type*} [Fintype I] [DecidableEq I] + [Fintype A] [DecidableEq A] [Fintype B] [DecidableEq B] + +omit [DecidableEq A] [Fintype B] in +private theorem pushforwardCounts_eq_sum (counts : A → ℕ) (f : A → B) (b : B) : + pushforwardCounts counts f b = ∑ a, if f a = b then counts a else 0 := by + classical + dsimp only [pushforwardCounts] + apply Finset.sum_congr rfl + intro a _ + by_cases h : f a = b <;> simp only [h, ite_true, ite_false] + +abbrev FixedCoarseWords (counts : A → ℕ) (f : A → B) (k : I → B) := + {w : I → A // (∀ a, wordPopulation w a = counts a) ∧ ∀ i, f (w i) = k i} + +def fixedCoarseWordsEquiv (counts : A → ℕ) (f : A → B) (k : I → B) : + FixedCoarseWords counts f k ≃ + ConditionalWords k (fun b a => if f a = b then counts a else 0) := by + classical + apply Equiv.subtypeEquivRight + intro w + constructor + · rintro ⟨hw, hk⟩ b a + change Fintype.card {i : I // k i = b ∧ w i = a} = + if f a = b then counts a else 0 + by_cases hab : f a = b + · rw [ite_eq_left hab, ← hw a] + apply Fintype.card_congr + apply Equiv.subtypeEquivRight + intro i + constructor + · exact And.right + · intro hwa + exact ⟨by rw [← hk i, hwa, hab], hwa⟩ + · rw [ite_eq_right hab] + have : IsEmpty {i : I // k i = b ∧ w i = a} := ⟨fun i => by + apply hab + rw [← i.property.2, hk i.val, i.property.1]⟩ + exact Fintype.card_of_isEmpty + · intro hw + constructor + · intro a + calc + wordPopulation w a = + ∑ b, wordPopulation (fun i : {i // w i = a} => k i.val) b := + (wordPopulation_sum _).symm + _ = ∑ b, Fintype.card {i : I // k i = b ∧ w i = a} := by + apply Finset.sum_congr rfl + intro b _ + rw [wordPopulation_fiber] + exact Fintype.card_congr (Equiv.subtypeEquivRight fun _ => and_comm) + _ = counts a := by simp only [hw]; simp + · intro i + by_cases h : f (w i) = k i + · exact h + exfalso + have hzero := hw (k i) (w i) + simp only [h, ite_false] at hzero + have hpos : 0 < Fintype.card {j : I // k j = k i ∧ w j = w i} := + Fintype.card_pos_iff.mpr ⟨⟨i, rfl, rfl⟩⟩ + exact (Nat.ne_of_gt hpos) hzero + +theorem fixedCoarseWords_card (counts : A → ℕ) (f : A → B) (k : I → B) + (hk : ∀ b, wordPopulation k b = pushforwardCounts counts f b) : + Fintype.card (FixedCoarseWords counts f k) = + ∏ b, Nat.multinomial Finset.univ (fun a => if f a = b then counts a else 0) := by + rw [Fintype.card_congr (fixedCoarseWordsEquiv counts f k)] + apply conditionalWords_card + intro b + rw [← pushforwardCounts_eq_sum] + exact hk b + +theorem fixedCoarseWords_card_pos (counts : A → ℕ) (f : A → B) (k : I → B) + (hk : ∀ b, wordPopulation k b = pushforwardCounts counts f b) : + 0 < Fintype.card (FixedCoarseWords counts f k) := by + rw [fixedCoarseWords_card counts f k hk] + exact Finset.prod_pos fun b _ => Nat.multinomial_pos _ _ + +theorem exactWords_card_eq_coarse_mul_fixed (counts : A → ℕ) (f : A → B) (k : I → B) + (hk : ∀ b, wordPopulation k b = pushforwardCounts counts f b) : + Fintype.card (ExactWords counts) = + Fintype.card (ExactWords (pushforwardCounts counts f)) * + Fintype.card (FixedCoarseWords counts f k) := by + classical + have hgraph (b : B) (a : A) : + pushforwardCounts counts (fun a => (f a, a)) (b, a) = + if f a = b then counts a else 0 := by + simp [pushforwardCounts, Prod.mk.injEq, and_comm, ite_and] + have hinj : Function.Injective (fun a : A => (f a, a)) := + fun _ _ h => congrArg Prod.snd h + have hmain := multinomial_prod_counts + (pushforwardCounts counts (fun a => (f a, a))) + rw [multinomial_pushforwardCounts_of_injective counts _ hinj] at hmain + simp_rw [pushforwardCounts_sum_pair, hgraph] at hmain + rw [exactWords_card, exactWords_card, fixedCoarseWords_card counts f k hk] + exact hmain + +theorem log_fixedCoarseWords_card (counts : A → ℕ) (f : A → B) (k : I → B) + (hk : ∀ b, wordPopulation k b = pushforwardCounts counts f b) : + Real.log (Fintype.card (FixedCoarseWords counts f k) : ℝ) = + Real.log (Nat.multinomial Finset.univ counts : ℝ) - + Real.log (Nat.multinomial Finset.univ (pushforwardCounts counts f) : ℝ) := by + have h := congrArg (fun n : ℕ => Real.log (n : ℝ)) + (exactWords_card_eq_coarse_mul_fixed counts f k hk) + rw [Nat.cast_mul, Real.log_mul] at h + · simpa only [exactWords_card] using (eq_sub_iff_add_eq.mpr (by linarith : + Real.log (Fintype.card (FixedCoarseWords counts f k) : ℝ) + + Real.log (Fintype.card (ExactWords (pushforwardCounts counts f)) : ℝ) = + Real.log (Fintype.card (ExactWords counts) : ℝ))) + · exact_mod_cast (Nat.ne_of_gt (exactWords_card_pos (pushforwardCounts counts f))) + · exact_mod_cast (Nat.ne_of_gt (fixedCoarseWords_card_pos counts f k hk)) + +theorem log_fixedCoarseWords_card_eq_factorials + (counts : A → ℕ) (f : A → B) (k : I → B) + (hk : ∀ b, wordPopulation k b = pushforwardCounts counts f b) : + Real.log (Fintype.card (FixedCoarseWords counts f k) : ℝ) = + (∑ b, Real.log ((pushforwardCounts counts f b).factorial : ℝ)) - + ∑ a, Real.log ((counts a).factorial : ℝ) := by + rw [log_fixedCoarseWords_card counts f k hk, log_multinomial, + log_multinomial, pushforwardCounts_sum] + ring + +theorem abs_log_fixedCoarseWords_card_sub_entropy_le + (counts : A → ℕ) (f : A → B) (k : I → B) + (hk : ∀ b, wordPopulation k b = pushforwardCounts counts f b) : + |Real.log (Fintype.card (FixedCoarseWords counts f k) : ℝ) - + (∑ a, counts a : ℕ) * + (finiteEntropy (fun a => (counts a : ℝ) / (∑ a, counts a : ℕ)) - + finiteEntropy (fun b => (pushforwardCounts counts f b : ℝ) / + (∑ a, counts a : ℕ)))| ≤ + ((Fintype.card A : ℝ) + (Fintype.card B : ℝ) + 2) * + (1 + Real.log ((∑ a, counts a) + 1 : ℕ)) := by + have hA := abs_log_multinomial_sub_entropy_le counts + have hB := abs_log_multinomial_sub_entropy_le (pushforwardCounts counts f) + rw [pushforwardCounts_sum] at hB + rw [log_fixedCoarseWords_card counts f k hk] + have h := (abs_sub + (Real.log (Nat.multinomial Finset.univ counts : ℝ) - + (∑ a, counts a : ℕ) * + finiteEntropy (fun a => (counts a : ℝ) / (∑ a, counts a : ℕ))) + (Real.log (Nat.multinomial Finset.univ (pushforwardCounts counts f) : ℝ) - + (∑ a, counts a : ℕ) * + finiteEntropy (fun b => (pushforwardCounts counts f b : ℝ) / + (∑ a, counts a : ℕ)))).trans (add_le_add hA hB) + convert h using 1 <;> congr 1 <;> ring + +theorem card_allowed_over_coarse_le + (f : A → B) (k : I → B) (allowed : (I → A) → Prop) [DecidablePred allowed] + (H : ℝ) + (hcoarse : ∀ w, allowed w → ∀ i, f (w i) = k i) + (hentropy : ∀ w, allowed w → + finiteEntropy (fun a => (wordPopulation w a : ℝ) / Fintype.card I) ≤ H) : + (Fintype.card {w : I → A // allowed w} : ℝ) ≤ + ((Fintype.card I : ℝ) + 1) ^ Fintype.card A * + Real.exp ((Fintype.card I : ℝ) * + (H - finiteEntropy (fun b => (wordPopulation k b : ℝ) / Fintype.card I)) + + ((Fintype.card A : ℝ) + (Fintype.card B : ℝ) + 2) * + (1 + Real.log (Fintype.card I + 1 : ℕ))) := by + classical + let S := {w : I → A // allowed w} + let T := A → Fin (Fintype.card I + 1) + let E : ℝ := (Fintype.card I : ℝ) * + (H - finiteEntropy (fun b => (wordPopulation k b : ℝ) / Fintype.card I)) + + ((Fintype.card A : ℝ) + (Fintype.card B : ℝ) + 2) * + (1 + Real.log (Fintype.card I + 1 : ℕ)) + let profile : S → T := fun w a => + ⟨wordPopulation w.val a, + Nat.lt_succ_of_le (Fintype.card_subtype_le (fun i : I => w.val i = a))⟩ + have hcap (p : T) : + (Fintype.card {w : S // profile w = p} : ℝ) ≤ Real.exp E := by + let Fiber := {w : S // profile w = p} + by_cases hn : Nonempty Fiber + · let : Nonempty Fiber := hn + let w : Fiber := Classical.choice hn + let counts : A → ℕ := wordPopulation w.val.val + let encode : Fiber → FixedCoarseWords counts f k := fun v => + ⟨v.val.val, ⟨fun a => by + change wordPopulation v.val.val a = wordPopulation w.val.val a + exact congrArg Fin.val (congrFun (v.property.trans w.property.symm) a), + hcoarse v.val.val v.val.property⟩⟩ + have hinj : Function.Injective encode := by + intro x y h + apply Subtype.ext + apply Subtype.ext + exact congrArg (fun z : FixedCoarseWords counts f k => z.val) h + have hk : ∀ b, wordPopulation k b = pushforwardCounts counts f b := by + have hh := (conditionalWords_nonempty_iff k + (fun b a => if f a = b then counts a else 0)).mp + ⟨fixedCoarseWordsEquiv counts f k (encode w)⟩ + intro b + rw [pushforwardCounts_eq_sum] + exact hh b + have htotal : (∑ a, counts a) = Fintype.card I := wordPopulation_sum w.val.val + have hbound := (abs_le.mp + (abs_log_fixedCoarseWords_card_sub_entropy_le counts f k hk)).2 + rw [htotal] at hbound + simp_rw [← hk] at hbound + have hw := hentropy w.val.val w.val.property + have hmain := mul_le_mul_of_nonneg_left + (sub_le_sub_right hw + (finiteEntropy (fun b => (wordPopulation k b : ℝ) / Fintype.card I))) + (Nat.cast_nonneg (Fintype.card I) : (0 : ℝ) ≤ Fintype.card I) + have hfixed : Real.log (Fintype.card (FixedCoarseWords counts f k) : ℝ) ≤ E := by + dsimp only [E] + change (Fintype.card I : ℝ) * + (finiteEntropy (fun a => (counts a : ℝ) / Fintype.card I) - + finiteEntropy (fun b => (wordPopulation k b : ℝ) / Fintype.card I)) ≤ + _ at hmain + linarith + have hpos : (0 : ℝ) < Fintype.card Fiber := Nat.cast_pos.mpr Fintype.card_pos + have hlog : Real.log (Fintype.card Fiber : ℝ) ≤ E := + (Real.log_le_log hpos + (Nat.cast_le.mpr (Fintype.card_le_of_injective encode hinj))).trans hfixed + simpa only [Real.exp_log hpos] using Real.exp_le_exp.mpr hlog + · let : IsEmpty Fiber := ⟨fun w => hn ⟨w⟩⟩ + change (Fintype.card Fiber : ℝ) ≤ Real.exp E + simpa only [Fintype.card_of_isEmpty, Nat.cast_zero] using (Real.exp_pos E).le + have hdecomp : Fintype.card S = ∑ p : T, Fintype.card {w : S // profile w = p} := by + simpa only [Fintype.card_sigma] using + (Fintype.card_congr (Equiv.sigmaFiberEquiv profile)).symm + calc + (Fintype.card S : ℝ) = + ∑ p : T, (Fintype.card {w : S // profile w = p} : ℝ) := by + exact_mod_cast hdecomp + _ ≤ ∑ _p : T, Real.exp E := Finset.sum_le_sum fun p _ => hcap p + _ = (Fintype.card T : ℝ) * Real.exp E := by simp + _ = _ := by simp [T, E] + +end CoarseFibers + +section Windows + +theorem card_entropy_bounded_words_le + {I A : Type*} [Fintype I] [DecidableEq I] + [Fintype A] [DecidableEq A] (H : ℝ) : + (Fintype.card {w : I → A // + finiteEntropy (fun a => (wordPopulation w a : ℝ) / Fintype.card I) ≤ H} : ℝ) ≤ + ((Fintype.card I : ℝ) + 1) ^ Fintype.card A * + Real.exp ((Fintype.card I : ℝ) * H + + ((Fintype.card A : ℝ) + 1) * + (1 + Real.log (Fintype.card I + 1 : ℕ))) := by + classical + let S := {w : I → A // + finiteEntropy (fun a => (wordPopulation w a : ℝ) / Fintype.card I) ≤ H} + let T := A → Fin (Fintype.card I + 1) + let E : ℝ := (Fintype.card I : ℝ) * H + + ((Fintype.card A : ℝ) + 1) * + (1 + Real.log (Fintype.card I + 1 : ℕ)) + let profile : S → T := fun w a => + ⟨wordPopulation w.val a, + Nat.lt_succ_of_le (Fintype.card_subtype_le (fun i : I => w.val i = a))⟩ + have hcap (p : T) : + (Fintype.card {w : S // profile w = p} : ℝ) ≤ Real.exp E := by + let Fiber := {w : S // profile w = p} + by_cases hn : Nonempty Fiber + · let : Nonempty Fiber := hn + let w : Fiber := Classical.choice hn + let counts : A → ℕ := wordPopulation w.val.val + let encode₀ : Fiber → {v : I → A // ∀ a, wordPopulation v a = counts a} := + fun v => ⟨v.val.val, fun a => by + change wordPopulation v.val.val a = wordPopulation w.val.val a + exact congrArg Fin.val + (congrFun (v.property.trans w.property.symm) a)⟩ + have hinj₀ : Function.Injective encode₀ := by + intro x y h + apply Subtype.ext + apply Subtype.ext + exact congrArg + (fun z : {v : I → A // ∀ a, wordPopulation v a = counts a} => z.val) h + have hsize : Fintype.card I = ∑ a, counts a := + (wordPopulation_sum w.val.val).symm + let encode : Fiber → ExactWords counts := + fun v => fixedWordsEquiv (I := I) counts hsize (encode₀ v) + have hinj : Function.Injective encode := + (fixedWordsEquiv (I := I) counts hsize).injective.comp hinj₀ + have hlog := log_card_le_entropy_of_injective_exactWords counts encode hinj + have htotal : (∑ a, counts a) = Fintype.card I := hsize.symm + rw [htotal] at hlog + have hw : finiteEntropy (fun a => (counts a : ℝ) / Fintype.card I) ≤ H := + w.val.property + have hmain : (Fintype.card I : ℝ) * + finiteEntropy (fun a => (counts a : ℝ) / Fintype.card I) ≤ + (Fintype.card I : ℝ) * H := + mul_le_mul_of_nonneg_left hw (Nat.cast_nonneg _) + have hlog' : Real.log (Fintype.card Fiber : ℝ) ≤ E := by + dsimp only [E] + exact hlog.trans (add_le_add hmain le_rfl) + have hpos : (0 : ℝ) < Fintype.card Fiber := + Nat.cast_pos.mpr Fintype.card_pos + simpa only [Real.exp_log hpos] using Real.exp_le_exp.mpr hlog' + · let : IsEmpty Fiber := ⟨fun x => hn ⟨x⟩⟩ + change (Fintype.card Fiber : ℝ) ≤ Real.exp E + simpa only [Fintype.card_of_isEmpty, Nat.cast_zero] using (Real.exp_pos E).le + have hdecomp : Fintype.card S = + ∑ p : T, Fintype.card {w : S // profile w = p} := by + simpa only [Fintype.card_sigma] using + (Fintype.card_congr (Equiv.sigmaFiberEquiv profile)).symm + calc + (Fintype.card S : ℝ) = + ∑ p : T, (Fintype.card {w : S // profile w = p} : ℝ) := by + exact_mod_cast hdecomp + _ ≤ ∑ _p : T, Real.exp E := Finset.sum_le_sum (fun p _ => hcap p) + _ = (Fintype.card T : ℝ) * Real.exp E := by simp + _ = ((Fintype.card I : ℝ) + 1) ^ Fintype.card A * + Real.exp ((Fintype.card I : ℝ) * H + + ((Fintype.card A : ℝ) + 1) * + (1 + Real.log (Fintype.card I + 1 : ℕ))) := by + simp [T, E] + +theorem card_class_entropy_bounded_words_le + {C : Type*} [Fintype C] [DecidableEq C] (P A : C → Type*) + [∀ c, Fintype (P c)] [∀ c, DecidableEq (P c)] + [∀ c, Fintype (A c)] [∀ c, DecidableEq (A c)] (H : C → ℝ) : + (Fintype.card (∀ c, {w : P c → A c // + finiteEntropy (fun a => (wordPopulation w a : ℝ) / Fintype.card (P c)) ≤ H c}) : ℝ) ≤ + ∏ c, ((Fintype.card (P c) : ℝ) + 1) ^ Fintype.card (A c) * + Real.exp ((Fintype.card (P c) : ℝ) * H c + + ((Fintype.card (A c) : ℝ) + 1) * + (1 + Real.log (Fintype.card (P c) + 1 : ℕ))) := by + classical + rw [Fintype.card_pi, Nat.cast_prod] + exact Finset.prod_le_prod₀ (fun c _ => Nat.cast_nonneg _) + (fun c _ => card_entropy_bounded_words_le (I := P c) (A := A c) (H c)) + +theorem marginal_coordinate_error {A : Type*} [Fintype A] + (x y : A → ℝ) (η : ℝ) (h : ∀ a, |x a - y a| ≤ η) : + |(∑ a, x a) - ∑ a, y a| ≤ (Fintype.card A : ℝ) * η := by + rw [← Finset.sum_sub_distrib] + calc + |∑ a, (x a - y a)| ≤ ∑ a, |x a - y a| := Finset.abs_sum_le_sum_abs _ _ + _ ≤ ∑ _a : A, η := Finset.sum_le_sum fun a _ => h a + _ = _ := by simp + +theorem designated_coordinate_error {I : Type*} [Fintype I] + (weights actual target : I → ℝ) {χ : ℝ} + (hw : ∀ i, 0 ≤ weights i) (hsum : ∑ i, weights i ≤ 1) + (hχ : 0 ≤ χ) (herror : ∀ i, |actual i - target i| ≤ χ) : + |(∑ i, weights i * actual i) - ∑ i, weights i * target i| ≤ χ := by + rw [← Finset.sum_sub_distrib] + simp_rw [← mul_sub] + calc + |∑ i, weights i * (actual i - target i)| ≤ + ∑ i, |weights i * (actual i - target i)| := Finset.abs_sum_le_sum_abs _ _ + _ = ∑ i, weights i * |actual i - target i| := by + apply Finset.sum_congr rfl + intro i _ + rw [abs_mul, abs_of_nonneg (hw i)] + _ ≤ ∑ i, weights i * χ := Finset.sum_le_sum fun i _ => + mul_le_mul_of_nonneg_left (herror i) (hw i) + _ ≤ χ := by + rw [← Finset.sum_mul] + simpa using mul_le_mul_of_nonneg_right hsum hχ + +theorem residual_window_error {mass actual target total targetTotal designated + targetDesignated η χ : ℝ} + (hmass : 0 < mass) + (hactual : mass * actual = total - designated) + (htarget : mass * target = targetTotal - targetDesignated) + (htotal : |total - targetTotal| ≤ η) + (hdesignated : |designated - targetDesignated| ≤ χ) : + |actual - target| ≤ (η + χ) / mass := by + apply (le_div_iff₀ hmass).mpr + calc + |actual - target| * mass = |mass * (actual - target)| := by + rw [abs_mul, abs_of_pos hmass, mul_comm] + _ = |(total - targetTotal) - (designated - targetDesignated)| := by + rw [mul_sub, hactual, htarget] + congr 1 + ring + _ ≤ |total - targetTotal| + |designated - targetDesignated| := abs_sub _ _ + _ ≤ η + χ := add_le_add htotal hdesignated + +theorem exists_entropy_window {A : Type*} [Fintype A] + (p : A → ℝ) {ε : ℝ} (hε : 0 < ε) : + ∃ δ : ℝ, 0 < δ ∧ ∀ q : A → ℝ, + (∀ a, |q a - p a| ≤ δ) → |finiteEntropy q - finiteEntropy p| < ε := by + obtain ⟨δ, hδ, hcont⟩ := Metric.continuousAt_iff.mp + (continuous_finiteEntropy.continuousAt : ContinuousAt finiteEntropy p) ε hε + refine ⟨δ / 2, half_pos hδ, fun q hq => ?_⟩ + apply hcont + rw [dist_pi_lt_iff hδ] + intro a + rw [Real.dist_eq] + exact (hq a).trans_lt (half_lt_self hδ) + +theorem exists_window_word_count {A : Type*} [Fintype A] [DecidableEq A] + (p : A → ℝ) {ε : ℝ} (hε : 0 < ε) : + ∃ δ : ℝ, 0 < δ ∧ ∀ (I : Type*) [Fintype I] [DecidableEq I], + (Fintype.card {w : I → A // + ∀ a, |(wordPopulation w a : ℝ) / Fintype.card I - p a| ≤ δ} : ℝ) ≤ + ((Fintype.card I : ℝ) + 1) ^ Fintype.card A * + Real.exp ((Fintype.card I : ℝ) * (finiteEntropy p + ε) + + ((Fintype.card A : ℝ) + 1) * + (1 + Real.log (Fintype.card I + 1 : ℕ))) := by + classical + obtain ⟨δ, hδ, hwindow⟩ := exists_entropy_window p hε + refine ⟨δ, hδ, fun I _ _ => ?_⟩ + let encode : {w : I → A // + ∀ a, |(wordPopulation w a : ℝ) / Fintype.card I - p a| ≤ δ} → + {w : I → A // finiteEntropy + (fun a => (wordPopulation w a : ℝ) / Fintype.card I) ≤ finiteEntropy p + ε} := + fun w => ⟨w.val, by + have h := (abs_lt.mp (hwindow _ w.property)).2 + linarith⟩ + have hinj : Function.Injective encode := by + intro x y h + apply Subtype.ext + exact congrArg + (fun z : {w : I → A // finiteEntropy + (fun a => (wordPopulation w a : ℝ) / Fintype.card I) ≤ finiteEntropy p + ε} => + z.val) h + exact (Nat.cast_le.mpr (Fintype.card_le_of_injective encode hinj)).trans + (card_entropy_bounded_words_le (I := I) (finiteEntropy p + ε)) + +end Windows + +end MatrixMultiplication.JointTypeCounts + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/Histories/CWShapePhysicalPermutation.lean b/lean/OAI/LinearAlgebra/MatrixFields/Histories/CWShapePhysicalPermutation.lean new file mode 100644 index 0000000000000000000000000000000000000000..f04cf9175cdaa7a2d1343e9298315d770eb9f1d2 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/Histories/CWShapePhysicalPermutation.lean @@ -0,0 +1,254 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Construction.InitialState + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +open scoped BigOperators + +namespace MatrixMultiplication.Foundation.Tensor + +variable {K X Y : Type*} + +def sidePermutation (σ : Equiv.Perm (Fin 3)) (T : Tensor K X X X) : + Tensor K X X X := + fun x y z => T ((Matrix.vecCons (x) (Matrix.vecCons (y) (Matrix.vecCons (z) Matrix.vecEmpty))) (σ.symm 0)) + ((Matrix.vecCons (x) (Matrix.vecCons (y) (Matrix.vecCons (z) Matrix.vecEmpty))) (σ.symm 1)) ((Matrix.vecCons (x) (Matrix.vecCons (y) (Matrix.vecCons (z) Matrix.vecEmpty))) (σ.symm 2)) + +private theorem coordinates_eta (a : Fin 3 → X) : (Matrix.vecCons (a 0) (Matrix.vecCons (a 1) (Matrix.vecCons (a 2) Matrix.vecEmpty))) = a := by + funext i + fin_cases i <;> rfl + +theorem sidePermutation_apply_coordinates (σ : Equiv.Perm (Fin 3)) + (T : Tensor K X X X) (a : Fin 3 → X) : + sidePermutation σ T (a 0) (a 1) (a 2) = + T (a (σ.symm 0)) (a (σ.symm 1)) (a (σ.symm 2)) := by + simp only [sidePermutation, coordinates_eta] + +@[simp] theorem sidePermutation_refl (T : Tensor K X X X) : + sidePermutation (Equiv.refl _) T = T := by + rfl + +@[simp] theorem sidePermutation_symm (σ : Equiv.Perm (Fin 3)) + (T : Tensor K X X X) : + sidePermutation σ.symm (sidePermutation σ T) = T := by + funext x y z + let a : Fin 3 → X := (Matrix.vecCons (x) (Matrix.vecCons (y) (Matrix.vecCons (z) Matrix.vecEmpty))) + change sidePermutation σ.symm (sidePermutation σ T) (a 0) (a 1) (a 2) = T x y z + rw [sidePermutation_apply_coordinates] + change sidePermutation σ T ((fun i => a (σ i)) 0) + ((fun i => a (σ i)) 1) ((fun i => a (σ i)) 2) = T x y z + rw [sidePermutation_apply_coordinates σ T (fun i => a (σ i))] + simp [a] + +@[simp] theorem sidePermutation_apply_symm (σ : Equiv.Perm (Fin 3)) + (T : Tensor K X X X) : + sidePermutation σ (sidePermutation σ.symm T) = T := + sidePermutation_symm σ.symm T + +private def coordinatesEquiv (X : Type*) : (X × X × X) ≃ (Fin 3 → X) where + toFun a := (Matrix.vecCons (a.1) (Matrix.vecCons (a.2.1) (Matrix.vecCons (a.2.2) Matrix.vecEmpty))) + invFun a := (a 0, a 1, a 2) + left_inv _ := rfl + right_inv := coordinates_eta + +private def permuteCoordinates (σ : Equiv.Perm (Fin 3)) (X : Type*) : + (Fin 3 → X) ≃ (Fin 3 → X) where + toFun a := fun i => a (σ.symm i) + invFun a := fun i => a (σ i) + left_inv a := by funext i; simp + right_inv a := by funext i; simp + +variable [CommSemiring K] [Fintype X] + +private theorem restrict_eq_sum_coordinates (M : Fin 3 → Y → X → K) + (T : Tensor K X X X) (a : Fin 3 → Y) : + restrict (M 0) (M 1) (M 2) T (a 0) (a 1) (a 2) = + ∑ b : Fin 3 → X, (∏ i, M i (a i) (b i)) * T (b 0) (b 1) (b 2) := by + classical + rw [← (coordinatesEquiv X).sum_comp + (fun coordinates => (∏ index, M index (a index) (coordinates index)) * + T (coordinates 0) (coordinates 1) (coordinates 2))] + simp only [Fintype.sum_prod_type, Fin.prod_univ_three] + rfl + +theorem restrict_sidePermutation (σ : Equiv.Perm (Fin 3)) + (M : Fin 3 → Y → X → K) (T : Tensor K X X X) : + restrict (M (σ 0)) (M (σ 1)) (M (σ 2)) (sidePermutation σ T) = + sidePermutation σ (restrict (M 0) (M 1) (M 2) T) := by + classical + funext x y z + let a : Fin 3 → Y := (Matrix.vecCons (x) (Matrix.vecCons (y) (Matrix.vecCons (z) Matrix.vecEmpty))) + change restrict (M (σ 0)) (M (σ 1)) (M (σ 2)) (sidePermutation σ T) + (a 0) (a 1) (a 2) = + sidePermutation σ (restrict (M 0) (M 1) (M 2) T) (a 0) (a 1) (a 2) + rw [sidePermutation_apply_coordinates] + rw [restrict_eq_sum_coordinates (fun i => M (σ i))] + rw [restrict_eq_sum_coordinates M T (fun i => a (σ.symm i))] + rw [← (permuteCoordinates σ X).sum_comp + (fun b => (∏ i, M i (a (σ.symm i)) (b i)) * T (b 0) (b 1) (b 2))] + apply Finset.sum_congr rfl + intro b hb + rw [sidePermutation_apply_coordinates] + change (∏ i, M (σ i) (a i) (b i)) * + T (b (σ.symm 0)) (b (σ.symm 1)) (b (σ.symm 2)) = + (∏ i, M i (a (σ.symm i)) (b (σ.symm i))) * + T (b (σ.symm 0)) (b (σ.symm 1)) (b (σ.symm 2)) + congr 1 + simpa only [Equiv.symm_apply_apply] using + Equiv.prod_comp σ (fun i => M i (a (σ.symm i)) (b (σ.symm i))) + +end MatrixMultiplication.Foundation.Tensor + +namespace MatrixMultiplication.AllFieldFiniteFamily.LocalMap + +open MatrixMultiplication.Foundation + +variable {F : Type*} [Field F] {X Y : Type} [Fintype X] + {source : Tensor F X X X} {target : Tensor F Y Y Y} + +def sidePermutation (σ : Equiv.Perm (Fin 3)) (map : LocalMap source target) : + LocalMap (Tensor.sidePermutation σ source) (Tensor.sidePermutation σ target) where + x := (Matrix.vecCons (map.x) (Matrix.vecCons (map.y) (Matrix.vecCons (map.z) Matrix.vecEmpty))) (σ 0) + y := (Matrix.vecCons (map.x) (Matrix.vecCons (map.y) (Matrix.vecCons (map.z) Matrix.vecEmpty))) (σ 1) + z := (Matrix.vecCons (map.x) (Matrix.vecCons (map.y) (Matrix.vecCons (map.z) Matrix.vecEmpty))) (σ 2) + coefficient := by + rw [Tensor.restrict_sidePermutation σ (Matrix.vecCons (map.x) (Matrix.vecCons (map.y) (Matrix.vecCons (map.z) Matrix.vecEmpty)))] + change Tensor.sidePermutation σ (Tensor.restrict map.x map.y map.z source) = _ + rw [map.coefficient] + +def restoreSides (σ : Equiv.Perm (Fin 3)) + (map : LocalMap (Tensor.sidePermutation σ source) (Tensor.sidePermutation σ target)) : + LocalMap source target where + x := (Matrix.vecCons (map.x) (Matrix.vecCons (map.y) (Matrix.vecCons (map.z) Matrix.vecEmpty))) (σ.symm 0) + y := (Matrix.vecCons (map.x) (Matrix.vecCons (map.y) (Matrix.vecCons (map.z) Matrix.vecEmpty))) (σ.symm 1) + z := (Matrix.vecCons (map.x) (Matrix.vecCons (map.y) (Matrix.vecCons (map.z) Matrix.vecEmpty))) (σ.symm 2) + coefficient := by + have h := Tensor.restrict_sidePermutation σ.symm (Matrix.vecCons (map.x) (Matrix.vecCons (map.y) (Matrix.vecCons (map.z) Matrix.vecEmpty))) + (Tensor.sidePermutation σ source) + simp only [Matrix.cons_val_zero, Matrix.cons_val_one, Matrix.cons_val_two, + Matrix.head_cons, Matrix.tail_cons] at h + rw [map.coefficient] at h + simpa only [Tensor.sidePermutation_symm] using h + +end MatrixMultiplication.AllFieldFiniteFamily.LocalMap + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +noncomputable section + +namespace MatrixMultiplication.CWShapePhysicalPermutation + +open MatrixMultiplication.Foundation CWStrands +open scoped BigOperators + +variable {F : Type*} [CommRing F] + +private theorem tensor_swapXY_inline_MatrixMultiplication_CWShapePhysicalPermutation (q : ℕ) (x y z : Fin (q + 2)) : + FieldCW.tensor F q x y z = FieldCW.tensor F q y x z := by + unfold FieldCW.tensor + simp only [Finset.sum_add_distrib, mul_comm, mul_left_comm, mul_assoc] + ring + +private theorem tensor_swapYZ_inline_MatrixMultiplication_CWShapePhysicalPermutation (q : ℕ) (x y z : Fin (q + 2)) : + FieldCW.tensor F q x y z = FieldCW.tensor F q x z y := by + exact (FieldCW.tensor_cyclic F q x y z).trans + ((tensor_swapXY_inline_MatrixMultiplication_CWShapePhysicalPermutation q y z x).trans (FieldCW.tensor_cyclic F q x z y).symm) + +private theorem tensor_swapXZ_inline_MatrixMultiplication_CWShapePhysicalPermutation (q : ℕ) (x y z : Fin (q + 2)) : + FieldCW.tensor F q x y z = FieldCW.tensor F q z y x := by + exact (FieldCW.tensor_cyclic F q x y z).trans (tensor_swapXY_inline_MatrixMultiplication_CWShapePhysicalPermutation q y z x) + +theorem tensor_permute (q : ℕ) (σ : Equiv.Perm (Fin 3)) + (a : Fin 3 → Fin (q + 2)) : + FieldCW.tensor F q (a (σ 0)) (a (σ 1)) (a (σ 2)) = + FieldCW.tensor F q (a 0) (a 1) (a 2) := by + have h01 : σ 0 ≠ σ 1 := fun h => (by decide : (0 : Fin 3) ≠ 1) (σ.injective h) + have h02 : σ 0 ≠ σ 2 := fun h => (by decide : (0 : Fin 3) ≠ 2) (σ.injective h) + have h12 : σ 1 ≠ σ 2 := fun h => (by decide : (1 : Fin 3) ≠ 2) (σ.injective h) + generalize hs0 : σ 0 = s0 at * + generalize hs1 : σ 1 = s1 at * + generalize hs2 : σ 2 = s2 at * + fin_cases s0 <;> fin_cases s1 <;> fin_cases s2 <;> try contradiction + · rfl + · exact (tensor_swapYZ_inline_MatrixMultiplication_CWShapePhysicalPermutation q (a 0) (a 1) (a 2)).symm + · exact (tensor_swapXY_inline_MatrixMultiplication_CWShapePhysicalPermutation q (a 0) (a 1) (a 2)).symm + · exact (FieldCW.tensor_cyclic F q (a 0) (a 1) (a 2)).symm + · exact FieldCW.tensor_cyclic F q (a 2) (a 0) (a 1) + · exact (tensor_swapXZ_inline_MatrixMultiplication_CWShapePhysicalPermutation q (a 0) (a 1) (a 2)).symm + +theorem strand_permute {P : Type*} [Fintype P] + (σ : Equiv.Perm (Fin 3)) (a : Fin 3 → P → Fin 7) : + strand (F := F) P (a (σ 0)) (a (σ 1)) (a (σ 2)) = + strand P (a 0) (a 1) (a 2) := by + apply Finset.prod_congr rfl + intro i _ + exact tensor_permute 5 σ (fun s => a s i) + +theorem shapeTensor_permute {P : Type*} [Fintype P] + (σ : Equiv.Perm (Fin 3)) (g : Fin 3 → ℕ) (a : Fin 3 → P → Fin 7) : + shapeTensor (F := F) P (g ∘ σ) (a (σ 0)) (a (σ 1)) (a (σ 2)) = + shapeTensor P g (a 0) (a 1) (a 2) := by + have hmask : + (weight (a (σ 0)) = g (σ 0) ∧ weight (a (σ 1)) = g (σ 1) ∧ + weight (a (σ 2)) = g (σ 2)) ↔ + (weight (a 0) = g 0 ∧ weight (a 1) = g 1 ∧ weight (a 2) = g 2) := by + constructor + · rintro ⟨h0, h1, h2⟩ + have hs (s : Fin 3) : weight (a (σ s)) = g (σ s) := by + fin_cases s <;> assumption + exact ⟨by simpa using hs (σ.symm 0), by simpa using hs (σ.symm 1), + by simpa using hs (σ.symm 2)⟩ + · rintro ⟨h0, h1, h2⟩ + have hs (s : Fin 3) : weight (a s) = g s := by + fin_cases s <;> assumption + exact ⟨hs (σ 0), hs (σ 1), hs (σ 2)⟩ + have hp := strand_permute (F := F) σ a + simp only [shapeTensor, Function.comp_apply, hmask, hp] + +theorem shapeTensor_prod_permute {I : Type*} [Fintype I] + (P : I → Type*) [∀ i, Fintype (P i)] + (σ : I → Equiv.Perm (Fin 3)) (g : I → Fin 3 → ℕ) + (a : ∀ i, Fin 3 → P i → Fin 7) : + (∏ i, shapeTensor (F := F) (P i) (g i ∘ σ i) + (a i (σ i 0)) (a i (σ i 1)) (a i (σ i 2))) = + ∏ i, shapeTensor (P i) (g i) (a i 0) (a i 1) (a i 2) := by + apply Finset.prod_congr rfl + intro i _ + exact shapeTensor_permute (σ i) (g i) (a i) + +theorem shapeTensor_prod_permute_ne_zero_iff {I : Type*} [Fintype I] + (P : I → Type*) [∀ i, Fintype (P i)] + (σ : I → Equiv.Perm (Fin 3)) (g : I → Fin 3 → ℕ) + (a : ∀ i, Fin 3 → P i → Fin 7) : + (∏ i, shapeTensor (F := F) (P i) (g i ∘ σ i) + (a i (σ i 0)) (a i (σ i 1)) (a i (σ i 2))) ≠ 0 ↔ + (∏ i, shapeTensor (F := F) (P i) (g i) (a i 0) (a i 1) (a i 2)) ≠ 0 := by + rw [shapeTensor_prod_permute] + +theorem sidePermutation_shapeTensor {P : Type*} [Fintype P] + (σ : Equiv.Perm (Fin 3)) (g : Fin 3 → ℕ) : + Tensor.sidePermutation σ (shapeTensor (F := F) P g) = + shapeTensor P (g ∘ σ) := by + funext x y z + let a : Fin 3 → P → Fin 7 := (Matrix.vecCons (x) (Matrix.vecCons (y) (Matrix.vecCons (z) Matrix.vecEmpty))) + change Tensor.sidePermutation σ (shapeTensor P g) (a 0) (a 1) (a 2) = + shapeTensor P (g ∘ σ) (a 0) (a 1) (a 2) + rw [Tensor.sidePermutation_apply_coordinates] + have h := shapeTensor_permute (F := F) σ g (fun s => a (σ.symm s)) + simpa only [Equiv.symm_apply_apply] using h.symm + +end MatrixMultiplication.CWShapePhysicalPermutation + +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/Histories/GroupOrbitCount.lean b/lean/OAI/LinearAlgebra/MatrixFields/Histories/GroupOrbitCount.lean new file mode 100644 index 0000000000000000000000000000000000000000..74ba01cd43890dfbfcf5d43d0dcd76b701062926 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/Histories/GroupOrbitCount.lean @@ -0,0 +1,1170 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Histories.HistoryPositions +import OAI.LinearAlgebra.MatrixFields.Tensors.CWStageCStatistics + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section + +namespace MatrixMultiplication.RecoverySupport + +variable {K X Y Z : Type*} [Zero K] [Fintype X] [Fintype Y] [Fintype Z] + +def support (Q : X → Y → Z → K) : Finset (X × Y × Z) := by + classical + exact Finset.univ.filter fun p => Q p.1 p.2.1 p.2.2 ≠ 0 + +theorem support_card_le (Q : X → Y → Z → K) : + (support Q).card ≤ Fintype.card X * Fintype.card Y * Fintype.card Z := by + classical + have h := Finset.card_filter_le (s := (Finset.univ : Finset (X × Y × Z))) + (p := fun p => Q p.1 p.2.1 p.2.2 ≠ 0) + simpa only [support, Finset.card_univ, Fintype.card_prod, Nat.mul_assoc] using h + +theorem support_card_le_exp (Q : X → Y → Z → K) {bX bY bZ : ℝ} (N : ℕ) + (hX : (Fintype.card X : ℝ) ≤ Real.exp (bX * N)) + (hY : (Fintype.card Y : ℝ) ≤ Real.exp (bY * N)) + (hZ : (Fintype.card Z : ℝ) ≤ Real.exp (bZ * N)) : + ((support Q).card : ℝ) ≤ Real.exp ((bX + bY + bZ) * N) := by + have hcard : ((support Q).card : ℝ) ≤ + (Fintype.card X : ℝ) * Fintype.card Y * Fintype.card Z := by + exact_mod_cast support_card_le Q + calc + ((support Q).card : ℝ) ≤ + (Fintype.card X : ℝ) * Fintype.card Y * Fintype.card Z := hcard + _ ≤ (Real.exp (bX * N) * Real.exp (bY * N)) * Real.exp (bZ * N) := + mul_le_mul (mul_le_mul hX hY (Nat.cast_nonneg _) (Real.exp_pos _).le) + hZ (Nat.cast_nonneg _) (mul_nonneg (Real.exp_pos _).le (Real.exp_pos _).le) + _ = Real.exp ((bX + bY + bZ) * N) := by + rw [← Real.exp_add, ← Real.exp_add] + congr 1 + ring + +theorem word_card_eq_exp {d : ℕ} (hd : 0 < d) (a N : ℕ) : + (Fintype.card (Fin (a * N) → Fin d) : ℝ) = + Real.exp (((a : ℝ) * Real.log (d : ℝ)) * N) := by + have hdr : 0 < (d : ℝ) := by exact_mod_cast hd + simp only [Fintype.card_fun, Fintype.card_fin, Nat.cast_pow] + calc + (d : ℝ) ^ (a * N) = Real.exp (((a * N : ℕ) : ℝ) * Real.log (d : ℝ)) := by + rw [Real.exp_nat_mul, Real.exp_log hdr] + _ = Real.exp (((a : ℝ) * Real.log (d : ℝ)) * N) := by + simp only [Nat.cast_mul] + congr 1 + ring + +theorem card_le_exp_of_word_embedding {d : ℕ} (hd : 0 < d) (a N : ℕ) + (e : X ↪ (Fin (a * N) → Fin d)) : + (Fintype.card X : ℝ) ≤ Real.exp (((a : ℝ) * Real.log (d : ℝ)) * N) := by + rw [← word_card_eq_exp hd a N] + exact_mod_cast Fintype.card_le_of_injective e e.injective + +theorem support_card_le_exp_of_word_embeddings (Q : X → Y → Z → K) + {d : ℕ} (hd : 0 < d) (a N : ℕ) + (ex : X ↪ (Fin (a * N) → Fin d)) + (ey : Y ↪ (Fin (a * N) → Fin d)) + (ez : Z ↪ (Fin (a * N) → Fin d)) : + ((support Q).card : ℝ) ≤ Real.exp ((3 * (a : ℝ) * Real.log (d : ℝ)) * N) := by + have h := support_card_le_exp Q N + (card_le_exp_of_word_embedding hd a N ex) + (card_le_exp_of_word_embedding hd a N ey) + (card_le_exp_of_word_embedding hd a N ez) + convert h using 1 + congr 1 + ring + +def cw5SupportRate (a : ℕ) : ℝ := 3 * (a : ℝ) * Real.log 7 + 1 + +theorem cw5SupportRate_pos (a : ℕ) : 0 < cw5SupportRate a := by + have hlog : 0 ≤ Real.log 7 := Real.log_nonneg (by norm_num) + have h := mul_nonneg (mul_nonneg (by norm_num : (0 : ℝ) ≤ 3) (Nat.cast_nonneg a)) hlog + unfold cw5SupportRate + linarith + +theorem cw5_support_card_le_exp (Q : X → Y → Z → K) (a N : ℕ) + (ex : X ↪ (Fin (a * N) → Fin 7)) + (ey : Y ↪ (Fin (a * N) → Fin 7)) + (ez : Z ↪ (Fin (a * N) → Fin 7)) : + ((support Q).card : ℝ) ≤ Real.exp (cw5SupportRate a * N) := by + apply (support_card_le_exp_of_word_embeddings Q (by norm_num) a N ex ey ez).trans + apply Real.exp_le_exp.mpr + unfold cw5SupportRate + simp only [Nat.cast_ofNat] + exact mul_le_mul_of_nonneg_right (le_add_of_nonneg_right zero_le_one) (Nat.cast_nonneg N) + +end MatrixMultiplication.RecoverySupport + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section + +open scoped BigOperators + +namespace MatrixMultiplication.HistorySupport + +variable {H : Type*} + +abbrev HistoryWords (P : H → Type*) (l r : H → ℕ) (d : ℕ) := + ∀ h, P h → ((Fin (l h) → Fin d) × (Fin (r h) → Fin d)) + +def totalLength [Fintype H] (P : H → Type*) [∀ h, Fintype (P h)] + (l r : H → ℕ) : ℕ := + ∑ h, Fintype.card (P h) * (l h + r h) + +variable [Fintype H] [DecidableEq H] +variable (P : H → Type*) [∀ h, Fintype (P h)] [∀ h, DecidableEq (P h)] +variable (l r : H → ℕ) + +theorem card_historyWords (d : ℕ) : + Fintype.card (HistoryWords P l r d) = d ^ totalLength P l r := by + change Fintype.card (∀ h, P h → ((Fin (l h) → Fin d) × (Fin (r h) → Fin d))) = _ + rw [Fintype.card_pi] + simp only [Fintype.card_fun, Fintype.card_prod, Fintype.card_fin, ← pow_add, ← pow_mul] + rw [Finset.prod_pow_eq_pow_sum] + congr 1 + unfold totalLength + apply Finset.sum_congr rfl + intro h _ + exact Nat.mul_comm _ _ + +theorem card_historyWords_le_pow {d : ℕ} (hd : 0 < d) (a N : ℕ) + (hlen : totalLength P l r ≤ a * N) : + Fintype.card (HistoryWords P l r d) ≤ d ^ (a * N) := by + rw [card_historyWords] + exact Nat.pow_le_pow_right hd hlen + +theorem card_historyWords_le_exp {d : ℕ} (hd : 0 < d) (a N : ℕ) + (hlen : totalLength P l r ≤ a * N) : + (Fintype.card (HistoryWords P l r d) : ℝ) ≤ + Real.exp (((a : ℝ) * Real.log (d : ℝ)) * N) := by + have hpow : ((d ^ (a * N) : ℕ) : ℝ) = + Real.exp (((a : ℝ) * Real.log (d : ℝ)) * N) := by + simpa only [Fintype.card_fun, Fintype.card_fin] using + RecoverySupport.word_card_eq_exp hd a N + rw [← hpow] + exact_mod_cast card_historyWords_le_pow P l r hd a N hlen + +theorem support_card_le_exp {K : Type*} [Zero K] {d : ℕ} (hd : 0 < d) + (Q : HistoryWords P l r d → HistoryWords P l r d → HistoryWords P l r d → K) + (a N : ℕ) (hlen : totalLength P l r ≤ a * N) : + ((RecoverySupport.support Q).card : ℝ) ≤ + Real.exp ((3 * (a : ℝ) * Real.log (d : ℝ)) * N) := by + have hdim := card_historyWords_le_exp P l r hd a N hlen + have h := RecoverySupport.support_card_le_exp Q N hdim hdim hdim + convert h using 1 + congr 1 + ring + +theorem cw5_support_card_le_exp {K : Type*} [Zero K] + (Q : HistoryWords P l r 7 → HistoryWords P l r 7 → HistoryWords P l r 7 → K) + (a N : ℕ) (hlen : totalLength P l r ≤ a * N) : + ((RecoverySupport.support Q).card : ℝ) ≤ + Real.exp (RecoverySupport.cw5SupportRate a * N) := by + apply (support_card_le_exp P l r (by norm_num) Q a N hlen).trans + apply Real.exp_le_exp.mpr + unfold RecoverySupport.cw5SupportRate + simp only [Nat.cast_ofNat] + exact mul_le_mul_of_nonneg_right (le_add_of_nonneg_right zero_le_one) (Nat.cast_nonneg N) + +end MatrixMultiplication.HistorySupport + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.AllFieldHistory + +open AllFieldParameters +open scoped BigOperators +attribute [local instance] Classical.propDecidable Classical.decEq + +theorem work_source_amount_pos {K : ℕ} (allocation : Allocation) (w : PlacedWork K) : + 0 < amount allocation (w.1.source, w.2) := by + apply div_pos _ (by norm_num) + cases w.1 with + | stageA h => exact initialAmount_pos h.val + | stageB h => exact aAmount_pos h.val + | stageC h => exact partAmount_pos allocation h + +theorem work_source_population_pos {K : ℕ} (allocation : Allocation) {dilation : ℕ} + (hd : 0 < dilation) (w : PlacedWork K) : + 0 < population allocation dilation (w.1.source, w.2) := + (AllFieldPopulationCounts.count_pos_iff _ (amount_nonneg allocation) hd _).mpr + (work_source_amount_pos allocation w) + +abbrev PositiveBranch {K : ℕ} (allocation : Allocation) (w : PlacedWork K) := + {b : w.1.Branch // 0 < amount allocation (w.1.child b false, w.2)} + +theorem branchPopulation_pos_iff {K : ℕ} (allocation : Allocation) {dilation : ℕ} + (hd : 0 < dilation) (w : PlacedWork K) (b : w.1.Branch) : + 0 < branchPopulation allocation dilation w b ↔ + 0 < amount allocation (w.1.child b false, w.2) := + AllFieldPopulationCounts.count_pos_iff _ (amount_nonneg allocation) hd _ + +theorem positive_branch_minimum {K : ℕ} (allocation : Allocation) (dilation : ℕ) + (w : PlacedWork K) (b : PositiveBranch allocation w) : + dilation ≤ branchPopulation allocation dilation w b.val := + AllFieldPopulationCounts.dilation_le_count _ (amount_nonneg allocation) dilation _ b.property + +theorem positive_joint_class_minimum {K : ℕ} (allocation : Allocation) {dilation : ℕ} + (hd : 0 < dilation) (w : PlacedWork K) (u : JointPopulation.Shape) + (hu : 0 < jointCounts allocation dilation w u) : dilation ≤ jointCounts allocation dilation w u := by + obtain ⟨b, rfl, hb⟩ := shapeCounts_positive _ _ u hu + rw [jointCounts_at] + exact positive_branch_minimum allocation dilation w + ⟨b, (branchPopulation_pos_iff allocation hd w b).mp hb⟩ + +def activeLengthRate {K tick : ℕ} (allocation : Allocation) : ℚ := + ∑ h : Active K tick, amount allocation (h.val.1.source, h.val.2) * + (2 * h.val.1.halfLength : ℕ) + +def activePositions {K tick : ℕ} (allocation : Allocation) (dilation : ℕ) + (h : Active K tick) : Type := + Fin (population allocation dilation (h.val.1.source, h.val.2)) + +instance {K tick : ℕ} (allocation : Allocation) (dilation : ℕ) (h : Active K tick) : + Fintype (activePositions allocation dilation h) := inferInstanceAs (Fintype (Fin _)) + +theorem active_totalLength_cast {K tick : ℕ} (allocation : Allocation) (dilation : ℕ) : + (HistorySupport.totalLength (activePositions (K := K) (tick := tick) allocation dilation) + activeHalfLength activeHalfLength : ℚ) = + (populationLength (K := K) allocation dilation : ℚ) * + activeLengthRate (K := K) (tick := tick) allocation := by + simp only [HistorySupport.totalLength, Nat.cast_sum, Nat.cast_mul, + activeLengthRate, Finset.mul_sum] + apply Finset.sum_congr rfl + intro h hh + simp only [Fintype.card_eq_nat_card] + simp only [activePositions, Nat.card_fin, population_cast, activeHalfLength] + push_cast + ring + +def activeLengthBudget {K tick : ℕ} (allocation : Allocation) : ℕ := + Nat.ceil (activeLengthRate (K := K) (tick := tick) allocation) + +theorem active_totalLength_le {K tick : ℕ} (allocation : Allocation) (dilation : ℕ) : + HistorySupport.totalLength (activePositions (K := K) (tick := tick) allocation dilation) + activeHalfLength activeHalfLength ≤ + activeLengthBudget (K := K) (tick := tick) allocation * + populationLength (K := K) allocation dilation := by + have h := active_totalLength_cast (K := K) (tick := tick) allocation dilation + have hc : activeLengthRate (K := K) (tick := tick) allocation ≤ + (activeLengthBudget (K := K) (tick := tick) allocation : ℚ) := Nat.le_ceil _ + have hb := mul_le_mul_of_nonneg_left hc + (Nat.cast_nonneg (populationLength (K := K) allocation dilation) : + (0 : ℚ) ≤ populationLength (K := K) allocation dilation) + rw [← h] at hb + exact_mod_cast hb.trans_eq (mul_comm _ _) + +theorem active_cw5_support_bound {F : Type*} [Zero F] {K tick : ℕ} + (allocation : Allocation) (dilation : ℕ) + (Q : HistorySupport.HistoryWords + (activePositions (K := K) (tick := tick) allocation dilation) + activeHalfLength activeHalfLength 7 → + HistorySupport.HistoryWords + (activePositions (K := K) (tick := tick) allocation dilation) + activeHalfLength activeHalfLength 7 → + HistorySupport.HistoryWords + (activePositions (K := K) (tick := tick) allocation dilation) + activeHalfLength activeHalfLength 7 → F) : + ((RecoverySupport.support Q).card : ℝ) ≤ + Real.exp (RecoverySupport.cw5SupportRate + (activeLengthBudget (K := K) (tick := tick) allocation) * + (populationLength (K := K) allocation dilation : ℝ)) := + HistorySupport.cw5_support_card_le_exp _ _ _ Q _ _ + (active_totalLength_le allocation dilation) + +end MatrixMultiplication.AllFieldHistory + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section + +namespace MatrixMultiplication.AllFieldHistorySupport + +open AllFieldHistory +open scoped BigOperators +attribute [local instance] Classical.propDecidable Classical.decEq + +theorem population_dilation {K : ℕ} (allocation : Allocation) (m : ℕ) (h : History K) : + population allocation m h = m * population allocation 1 h := by + simp only [population, AllFieldPopulationCounts.count, one_mul] + +theorem branchPopulation_dilation {K : ℕ} (allocation : Allocation) (m : ℕ) + (w : PlacedWork K) (b : w.1.Branch) : + branchPopulation allocation m w b = m * branchPopulation allocation 1 w b := by + simp only [branchPopulation, population, AllFieldPopulationCounts.count, one_mul] + +theorem jointCounts_dilation {K : ℕ} (allocation : Allocation) (m : ℕ) + (w : PlacedWork K) (u : JointPopulation.Shape) : + jointCounts allocation m w u = m * jointCounts allocation 1 w u := by + simp only [jointCounts, shapeCounts, branchPopulation, population, + AllFieldPopulationCounts.count, one_mul, Finset.mul_sum, mul_ite, mul_zero] + +theorem activeCounts_dilation {K tick : ℕ} (allocation : Allocation) (m : ℕ) + (h : Active K tick) (u : JointPopulation.Shape) : + activeCounts allocation m h u = m * activeCounts allocation 1 h u := + jointCounts_dilation allocation m h.val u + +theorem activeCounts_pos_iff {K tick m : ℕ} (allocation : Allocation) (hm : 0 < m) + (h : Active K tick) (u : JointPopulation.Shape) : + 0 < activeCounts allocation m h u ↔ 0 < activeCounts allocation 1 h u := by + rw [activeCounts_dilation] + exact Nat.mul_pos_iff_of_pos_left hm + +theorem dilation_le_activeCounts {K tick : ℕ} (allocation : Allocation) (m : ℕ) + (h : Active K tick) (u : JointPopulation.Shape) + (hpos : 0 < activeCounts allocation 1 h u) : m ≤ activeCounts allocation m h u := by + rw [activeCounts_dilation] + calc + m = m * 1 := (Nat.mul_one m).symm + _ ≤ m * activeCounts allocation 1 h u := Nat.mul_le_mul_left m hpos + +theorem two_le_activeCounts {K tick m : ℕ} (allocation : Allocation) (hm : 2 ≤ m) + (h : Active K tick) (u : JointPopulation.Shape) + (hpos : 0 < activeCounts allocation 1 h u) : 2 ≤ activeCounts allocation m h u := + hm.trans (dilation_le_activeCounts allocation m h u hpos) + +theorem totalLength_dilation {K tick : ℕ} (allocation : Allocation) (m : ℕ) + (l r : Active K tick → ℕ) : + HistorySupport.totalLength (JointPopulation.Positions (activeCounts allocation m)) l r = + m * HistorySupport.totalLength (JointPopulation.Positions (activeCounts allocation 1)) l r := by + simp only [HistorySupport.totalLength, JointPopulation.Positions, Fintype.card_fin, + activeCounts_dilation allocation m, ← Finset.mul_sum, Nat.mul_assoc] + +def fixedBaseLength {K tick : ℕ} (allocation : Allocation) : ℕ := + HistorySupport.totalLength + (JointPopulation.Positions (activeCounts (K := K) (tick := tick) allocation 1)) + activeHalfLength activeHalfLength + +def supportRate {K tick : ℕ} (allocation : Allocation) : ℝ := + RecoverySupport.cw5SupportRate (fixedBaseLength (K := K) (tick := tick) allocation) + +theorem supportRate_pos {K tick : ℕ} (allocation : Allocation) : + 0 < supportRate (K := K) (tick := tick) allocation := + RecoverySupport.cw5SupportRate_pos _ + +abbrev ActiveRawPairs {K tick : ℕ} (allocation : Allocation) (m : ℕ) := + JointCanonicalization.RawPairs (activeCounts (K := K) (tick := tick) allocation m) + (JointCanonicalCW.Left activeHalfLength) (JointCanonicalCW.Right activeHalfLength) + +theorem raw_support_card_le_exp {K tick : ℕ} {F : Type*} [Zero F] + (allocation : Allocation) (m : ℕ) + (Q : ActiveRawPairs (K := K) (tick := tick) allocation m → + ActiveRawPairs (K := K) (tick := tick) allocation m → + ActiveRawPairs (K := K) (tick := tick) allocation m → F) : + ((RecoverySupport.support Q).card : ℝ) ≤ + Real.exp (supportRate (K := K) (tick := tick) allocation * m) := by + apply HistorySupport.cw5_support_card_le_exp + (JointPopulation.Positions (activeCounts (K := K) (tick := tick) allocation m)) + activeHalfLength activeHalfLength Q (fixedBaseLength (K := K) (tick := tick) allocation) m + rw [totalLength_dilation] + exact le_of_eq (Nat.mul_comm _ _) + +abbrev ActiveClass (K tick : ℕ) := Active K tick × JointPopulation.Shape + +def selectedBaseCount {K tick : ℕ} (allocation : Allocation) + (D : Finset (ActiveClass K tick)) : ℕ := + ∑ c ∈ D, activeCounts allocation 1 c.1 c.2 + +def selectedBasePopulation {K tick : ℕ} (allocation : Allocation) + (D : Finset (ActiveClass K tick)) : ℝ := (selectedBaseCount allocation D : ℝ) + +abbrev selectedPositions {K tick : ℕ} (allocation : Allocation) (m : ℕ) + (D : Finset (ActiveClass K tick)) (c : D) := + JointCanonicalization.ClassPositions (activeCounts allocation m) c.val + +theorem selected_count_dilation {K tick : ℕ} (allocation : Allocation) (m : ℕ) + (D : Finset (ActiveClass K tick)) : + (∑ c ∈ D, activeCounts allocation m c.1 c.2) = m * selectedBaseCount allocation D := by + simp only [selectedBaseCount, activeCounts_dilation allocation m, Finset.mul_sum] + +theorem selectedBaseCount_pos {K tick : ℕ} (allocation : Allocation) + (D : Finset (ActiveClass K tick)) (hD : D.Nonempty) + (hpos : ∀ c ∈ D, 0 < activeCounts allocation 1 c.1 c.2) : + 0 < selectedBaseCount allocation D := + Finset.sum_pos hpos hD + +theorem selectedBasePopulation_pos {K tick : ℕ} (allocation : Allocation) + (D : Finset (ActiveClass K tick)) (hD : D.Nonempty) + (hpos : ∀ c ∈ D, 0 < activeCounts allocation 1 c.1 c.2) : + 0 < selectedBasePopulation allocation D := by + unfold selectedBasePopulation + exact_mod_cast selectedBaseCount_pos allocation D hD hpos + +theorem selected_populationSize {K tick : ℕ} (allocation : Allocation) (m : ℕ) + (D : Finset (ActiveClass K tick)) : + PermutationMatching.populationSize (selectedPositions allocation m D) = + selectedBasePopulation allocation D * (m : ℝ) := by + simp only [PermutationMatching.populationSize, selectedPositions, + JointCanonicalization.ClassPositions, Fintype.card_fin] + rw [Finset.sum_coe_sort D + (fun c : ActiveClass K tick => (activeCounts allocation m c.1 c.2 : ℝ))] + simp only [activeCounts_dilation allocation m, Nat.cast_mul, ← Finset.mul_sum, + selectedBasePopulation, selectedBaseCount, Nat.cast_sum] + exact mul_comm _ _ + +theorem selected_two_le {K tick m : ℕ} (allocation : Allocation) (hm : 2 ≤ m) + (D : Finset (ActiveClass K tick)) + (hpos : ∀ c ∈ D, 0 < activeCounts allocation 1 c.1 c.2) (c : D) : + 2 ≤ Fintype.card (selectedPositions allocation m D c) := by + simpa only [selectedPositions, JointCanonicalization.ClassPositions, Fintype.card_fin] using + two_le_activeCounts allocation hm c.val.1 c.val.2 (hpos c.val c.property) + +theorem selected_classWeight_formula {K tick m : ℕ} (allocation : Allocation) + (hm : 0 < m) (D : Finset (ActiveClass K tick)) (c : D) : + PermutationMatching.classWeight (selectedPositions allocation m D) c = + (activeCounts allocation 1 c.val.1 c.val.2 : ℝ) / selectedBasePopulation allocation D := by + rw [PermutationMatching.classWeight, selected_populationSize] + simp only [selectedPositions, JointCanonicalization.ClassPositions, Fintype.card_fin, + activeCounts_dilation allocation m, Nat.cast_mul] + rw [mul_comm (selectedBasePopulation allocation D) (m : ℝ)] + exact mul_div_mul_left _ _ (Nat.cast_ne_zero.mpr (Nat.ne_of_gt hm)) + +theorem selected_classWeight_eq_one {K tick m : ℕ} (allocation : Allocation) + (hm : 0 < m) (D : Finset (ActiveClass K tick)) (c : D) : + PermutationMatching.classWeight (selectedPositions allocation m D) c = + PermutationMatching.classWeight (selectedPositions allocation 1 D) c := + (selected_classWeight_formula allocation hm D c).trans + (selected_classWeight_formula allocation (by decide : 0 < (1 : ℕ)) D c).symm + +theorem selected_classProductMixture_eq_one {K tick m : ℕ} (allocation : Allocation) + (hm : 0 < m) (D : Finset (ActiveClass K tick)) (left right : D → ℝ) : + PermutationMatching.classProductMixture (selectedPositions allocation m D) left right = + PermutationMatching.classProductMixture (selectedPositions allocation 1 D) left right := by + unfold PermutationMatching.classProductMixture + apply Finset.sum_congr rfl + intro c _ + rw [selected_classWeight_eq_one allocation hm D c] + +theorem work_source_amount_pos {K : ℕ} (allocation : Allocation) (w : PlacedWork K) : + 0 < amount allocation (w.1.source, w.2) := by + rcases w with ⟨w, phi⟩ + unfold amount + apply div_pos _ (by norm_num) + cases w with + | stageA h => exact initialAmount_pos h.val + | stageB h => exact aAmount_pos h.val + | stageC h => exact partAmount_pos allocation h + +theorem work_source_population_pos {K m : ℕ} (allocation : Allocation) (hm : 0 < m) + (w : PlacedWork K) : 0 < population allocation m (w.1.source, w.2) := + (AllFieldPopulationCounts.count_pos_iff (amount allocation) (amount_nonneg allocation) + hm (w.1.source, w.2)).2 (work_source_amount_pos allocation w) + +def positiveClasses {K tick : ℕ} (allocation : Allocation) (h : Active K tick) : + Finset (ActiveClass K tick) := + Finset.univ.filter fun c => c.1 = h ∧ 0 < activeCounts allocation 1 c.1 c.2 + +theorem positiveClasses_positive {K tick : ℕ} (allocation : Allocation) (h : Active K tick) + (c : ActiveClass K tick) (hc : c ∈ positiveClasses allocation h) : + 0 < activeCounts allocation 1 c.1 c.2 := (Finset.mem_filter.mp hc).2.2 + +theorem positiveClasses_baseCount {K tick : ℕ} (allocation : Allocation) (h : Active K tick) : + selectedBaseCount allocation (positiveClasses allocation h) = + population allocation 1 (h.val.1.source, h.val.2) := by + have hkeep (n : ℕ) : (if 0 < n then n else 0) = n := by + split_ifs <;> omega + calc + selectedBaseCount allocation (positiveClasses allocation h) = + ∑ u, activeCounts allocation 1 h u := by + simp [selectedBaseCount, positiveClasses, Finset.sum_filter, ite_and, hkeep, + Fintype.sum_prod_type] + _ = population allocation 1 (h.val.1.source, h.val.2) := + jointCounts_sum allocation 1 h.val + +theorem positiveClasses_basePopulation_pos {K tick : ℕ} (allocation : Allocation) + (h : Active K tick) : 0 < selectedBasePopulation allocation (positiveClasses allocation h) := by + unfold selectedBasePopulation + rw [positiveClasses_baseCount] + exact_mod_cast work_source_population_pos allocation (by decide : 0 < (1 : ℕ)) h.val + +theorem positiveClasses_nonempty {K tick : ℕ} (allocation : Allocation) (h : Active K tick) : + (positiveClasses allocation h).Nonempty := by + by_contra hn + have hempty := Finset.not_nonempty_iff_eq_empty.mp hn + have hp := positiveClasses_basePopulation_pos allocation h + simp [selectedBasePopulation, selectedBaseCount, hempty] at hp + +theorem positiveClasses_populationSize {K tick : ℕ} (allocation : Allocation) (m : ℕ) + (h : Active K tick) : + PermutationMatching.populationSize + (selectedPositions allocation m (positiveClasses allocation h)) = + (population allocation 1 (h.val.1.source, h.val.2) : ℝ) * m := by + rw [selected_populationSize] + simp only [selectedBasePopulation, positiveClasses_baseCount] + +end MatrixMultiplication.AllFieldHistorySupport + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section + +namespace MatrixMultiplication.AllFieldHistoryIncomingMasks + +open MatrixMultiplication.Foundation AllFieldHistory AllFieldParameters +open AllFieldHistoryChildLaws AllFieldHistorySupport +open scoped BigOperators +attribute [local instance] Classical.propDecidable Classical.decEq + +variable {K tick : ℕ} + +def joinHalves (w : Work K) : + ((Fin w.halfLength → Fin 7) × (Fin w.halfLength → Fin 7)) → + (Fin (currentLength w.source) → Fin 7) := + match w with + | .stageA _ => fun x => Fin.append x.1 x.2 + | .stageB _ => fun x => Fin.append x.1 x.2 + | .stageC _ => fun x => Fin.append x.1 x.2 + +def sourcePositionsEquiv (allocation : Allocation) (m : ℕ) (h : Active K tick) : + JointPopulation.Positions (activeCounts allocation m) h ≃ + Fin (population allocation m (h.val.1.source, h.val.2)) := + finCongr (jointCounts_sum allocation m h.val) + +def incomingWord (allocation : Allocation) (m : ℕ) (h : Active K tick) + (w : ActiveRawPairs (K := K) (tick := tick) allocation m) : + HistoryWord allocation m (h.val.1.source, h.val.2) := + fun p => joinHalves h.val.1 (w h ((sourcePositionsEquiv allocation m h).symm p)) + +def received (allocation : Allocation) (m : ℕ) (ε : ℝ) (side : Fin 3) + (w : ActiveRawPairs (K := K) (tick := tick) allocation m) : Prop := + ∀ h : Active K tick, + residentMask allocation m ε (h.val.1.source, h.val.2) side + (incomingWord allocation m h w) + +end MatrixMultiplication.AllFieldHistoryIncomingMasks + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section + +namespace MatrixMultiplication.AllFieldHistoryBranchWeights + +open AllFieldHistory AllFieldHistorySupport AllFieldParameters +open scoped BigOperators +attribute [local instance] Classical.propDecidable Classical.decEq + +theorem stageB_branchPopulation_rat {K : ℕ} (allocation : Allocation) (dilation : ℕ) + (h : APositive K) (b : BSplit h) (phi : Placement) : + (branchPopulation allocation dilation (.stageB h, phi) b : ℚ) = + (population allocation dilation (.afterA h.val, phi) : ℚ) * + stageBLaw (aShape h.val) (bSplit ⟨h, b, false⟩) := by + simp only [branchPopulation, Work.child, population_cast, amount, canonicalAmount, bAmount] + ring + +theorem stageB_branchPopulation_real {K : ℕ} (allocation : Allocation) (dilation : ℕ) + (h : APositive K) (b : BSplit h) (phi : Placement) : + (branchPopulation allocation dilation (.stageB h, phi) b : ℝ) = + (population allocation dilation (.afterA h.val, phi) : ℝ) * + (stageBLaw (aShape h.val) (bSplit ⟨h, b, false⟩) : ℝ) := by + exact_mod_cast stageB_branchPopulation_rat allocation dilation h b phi + +theorem stageB_branchWeight_rat {K dilation : ℕ} (allocation : Allocation) + (hd : 0 < dilation) (h : APositive K) (b : BSplit h) (phi : Placement) : + (branchPopulation allocation dilation (.stageB h, phi) b : ℚ) / + (population allocation dilation (.afterA h.val, phi) : ℚ) = + stageBLaw (aShape h.val) (bSplit ⟨h, b, false⟩) := by + have hpos := AllFieldHistorySupport.work_source_population_pos allocation hd (.stageB h, phi) + have hden : (population allocation dilation (.afterA h.val, phi) : ℚ) ≠ 0 := by + exact_mod_cast Nat.ne_of_gt hpos + apply (div_eq_iff hden).2 + rw [stageB_branchPopulation_rat] + exact mul_comm _ _ + +theorem stageB_branchWeight_real {K dilation : ℕ} (allocation : Allocation) + (hd : 0 < dilation) (h : APositive K) (b : BSplit h) (phi : Placement) : + (branchPopulation allocation dilation (.stageB h, phi) b : ℝ) / + (population allocation dilation (.afterA h.val, phi) : ℝ) = + (stageBLaw (aShape h.val) (bSplit ⟨h, b, false⟩) : ℝ) := by + have hpos := AllFieldHistorySupport.work_source_population_pos allocation hd (.stageB h, phi) + have hden : (population allocation dilation (.afterA h.val, phi) : ℝ) ≠ 0 := by + exact_mod_cast Nat.ne_of_gt hpos + apply (div_eq_iff hden).2 + rw [stageB_branchPopulation_real] + exact mul_comm _ _ + +theorem shapeCounts_weighted_sum {I : Type*} [Fintype I] + (code : I → JointPopulation.Shape) (weight : I → ℕ) + (f : JointPopulation.Shape → ℝ) : + (∑ u, (shapeCounts code weight u : ℝ) * f u) = + ∑ b, (weight b : ℝ) * f (code b) := by + simp only [shapeCounts, Nat.cast_sum, Nat.cast_ite, Nat.cast_zero, Finset.sum_mul] + rw [Finset.sum_comm] + apply Finset.sum_congr rfl + intro b _ + simp [ite_mul] + +end MatrixMultiplication.AllFieldHistoryBranchWeights + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section + +namespace MatrixMultiplication.AllFieldHistoryStageCIncoming + +open AllFieldHistory AllFieldHistorySupport AllFieldParameters +open CWStageCProducts InheritedMasks +open scoped BigOperators +attribute [local instance] Classical.propDecidable Classical.decEq + +variable {K tick : ℕ} + +def stageCActive (h : PartC K) (phi : Placement) + (ht : FiniteSchedule.lotTick (Work.stageC h).lot (Work.stageC h).stage = tick) : + Active K tick := ⟨(.stageC h, phi), ht⟩ + +def positionEquiv (allocation : Allocation) (dilation : ℕ) (h : PartC K) + (phi : Placement) + (ht : FiniteSchedule.lotTick (Work.stageC h).lot (Work.stageC h).stage = tick) + (e : JointPopulation.Target (activeCounts (K := K) (tick := tick) allocation dilation)) : + JointPopulation.Positions (activeCounts (K := K) (tick := tick) allocation dilation) (stageCActive h phi ht) ≃ + CWStageCProducts.Positions (populationAtomCounts allocation dilation (h, phi)) := + (JointCanonicalization.positionEquiv (activeCounts (K := K) (tick := tick) allocation dilation) e + (stageCActive h phi ht)).trans + (branchPositionEquiv allocation dilation (.stageC h, phi)) + +theorem positionEquiv_shape (allocation : Allocation) (dilation : ℕ) (h : PartC K) + (phi : Placement) + (ht : FiniteSchedule.lotTick (Work.stageC h).lot (Work.stageC h).stage = tick) + (e : JointPopulation.Target (activeCounts (K := K) (tick := tick) allocation dilation)) + (j : JointPopulation.Positions (activeCounts (K := K) (tick := tick) allocation dilation) (stageCActive h phi ht)) : + branchShape (.stageC h, phi) (positionEquiv allocation dilation h phi ht e j).1 = + (e (stageCActive h phi ht)).val j := by + exact (branchPositionEquiv_shape allocation dilation (.stageC h, phi) + (JointCanonicalization.positionEquiv (activeCounts (K := K) (tick := tick) allocation dilation) e + (stageCActive h phi ht) j)).trans + (JointCanonicalization.positionEquiv_shape (activeCounts (K := K) (tick := tick) allocation dilation) e + (stageCActive h phi ht) j) + +theorem positionEquiv_symm_shape (allocation : Allocation) (dilation : ℕ) (h : PartC K) + (phi : Placement) + (ht : FiniteSchedule.lotTick (Work.stageC h).lot (Work.stageC h).stage = tick) + (e : JointPopulation.Target (activeCounts (K := K) (tick := tick) allocation dilation)) + (p : CWStageCProducts.Positions (populationAtomCounts allocation dilation (h, phi))) : + (e (stageCActive h phi ht)).val ((positionEquiv allocation dilation h phi ht e).symm p) = + branchShape (.stageC h, phi) p.1 := by + have hp := positionEquiv_shape allocation dilation h phi ht e + ((positionEquiv allocation dilation h phi ht e).symm p) + simpa only [Equiv.apply_symm_apply] using hp.symm + +theorem typeWindow_of_target_side_weights (allocation : Allocation) {dilation : ℕ} + (hd : 0 < dilation) (h : PartC K) (phi : Placement) + (ht : FiniteSchedule.lotTick (Work.stageC h).lot (Work.stageC h).stage = tick) + (e : JointPopulation.Target (activeCounts (K := K) (tick := tick) allocation dilation)) + (w : ActiveRawPairs (K := K) (tick := tick) allocation dilation) (side : Fin 3) + (hweights : ∀ j : JointPopulation.Positions (activeCounts (K := K) (tick := tick) allocation dilation) + (stageCActive h phi ht), + CWLeafStatistics.weight ((w (stageCActive h phi ht) j).1 (0 : Fin 1)) = + (JointPopulation.shapeSide side ((e (stageCActive h phi ht)).val j)).val ∧ + CWLeafStatistics.weight ((w (stageCActive h phi ht) j).2 (0 : Fin 1)) = + activeParentShape (stageCActive h phi ht) side - + (JointPopulation.shapeSide side ((e (stageCActive h phi ht)).val j)).val) + (η : ℝ) (hη : 0 ≤ η) : + typeWindow + (fun a : Fin 6 => + (littleLaw (cParameterParent h) (cShapeParent h) (phi.symm side) a : ℝ)) η + (fun j => CWCompleteStatistics.twoStatistic + (Matrix.vecCons ((w (stageCActive h phi ht) j).1 (0 : Fin 1)) (Matrix.vecCons ((w (stageCActive h phi ht) j).2 (0 : Fin 1)) Matrix.vecEmpty))) := by + let p := positionEquiv allocation dilation h phi ht e + let words : CWStageCProducts.Positions (populationAtomCounts allocation dilation (h, phi)) → + CWStageCProducts.Word := fun j => + (Matrix.vecCons ((w (stageCActive h phi ht) (p.symm j)).1 (0 : Fin 1)) (Matrix.vecCons ((w (stageCActive h phi ht) (p.symm j)).2 (0 : Fin 1)) Matrix.vecEmpty)) + have hgeometry (j : CWStageCProducts.Positions + (populationAtomCounts allocation dilation (h, phi))) : + CWLeafStatistics.weight (words j 0) = + branchAtom (stageCDistinguished (cShapeParent h)) j.1 (phi.symm side) ∧ + CWLeafStatistics.weight (words j 1) = + CWStageCProducts.shape (stageCDistinguished (cShapeParent h)) (phi.symm side) - + branchAtom (stageCDistinguished (cShapeParent h)) j.1 (phi.symm side) := by + have hw := hweights (p.symm j) + have hs := positionEquiv_symm_shape allocation dilation h phi ht e j + change (e (stageCActive h phi ht)).val (p.symm j) = _ at hs + rw [hs] at hw + simpa only [words, Matrix.cons_val_zero, Matrix.cons_val_one, + activeParentShape, stageCActive, Work.parentShape, branchShape, + encodePhysicalShape_side, physicalShape, Work.splitShape, cSplit, + branchAtom_eq_stageCAtom, shape_eq_parent (cShapeParent h) (bShape_size h.1.val) + h.1.property] using hw + have hwindow := typeWindow_of_placed_side_weights + (populationAtomCounts allocation dilation (h, phi)) + (cParameterParent h) (cShapeParent h) (bShape_size h.1.val) h.1.property + (population allocation dilation (.partC h, phi)) + (AllFieldHistorySupport.work_source_population_pos allocation hd (.stageC h, phi)) + (populationAtomCounts_parent allocation dilation (h, phi)) + phi side words hgeometry η hη + exact (JointCanonicalization.typeWindow_reindex _ η + (fun j => CWCompleteStatistics.twoStatistic + (Matrix.vecCons ((w (stageCActive h phi ht) j).1 (0 : Fin 1)) (Matrix.vecCons ((w (stageCActive h phi ht) j).2 (0 : Fin 1)) Matrix.vecEmpty))) + p.symm).mp hwindow + +end MatrixMultiplication.AllFieldHistoryStageCIncoming + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +namespace MatrixMultiplication.PermutationMatching + +open scoped BigOperators +open Classical + +noncomputable section + +variable {C : Type*} [Fintype C] [DecidableEq C] + {P X Y : C → Type*} + [∀ c, Fintype (P c)] [∀ c, DecidableEq (P c)] + [∀ c, Fintype (X c)] [∀ c, DecidableEq (X c)] + [∀ c, Fintype (Y c)] [∀ c, DecidableEq (Y c)] + +abbrev PairProfile (P X Y : C → Type*) [∀ c, Fintype (P c)] := + InheritedMasks.Profile P X × InheritedMasks.Profile P Y + +def pairProfile (w : CompleteWordPair P X Y) : PairProfile P X Y := + (InheritedMasks.profile P X w.left, InheritedMasks.profile P Y w.right) + +omit [Fintype C] [DecidableEq C] [∀ c, DecidableEq (P c)] + [∀ c, Fintype (X c)] [∀ c, Fintype (Y c)] in +theorem pairProfile_smul (g : HalfClassPermutations P) + (w : CompleteWordPair P X Y) : pairProfile (g • w) = pairProfile w := by + apply Prod.ext + · apply (InheritedMasks.profile_eq_iff P X _ _).mpr + exact ⟨fun c => g.1 c, fun c => by + funext i + simp⟩ + · apply (InheritedMasks.profile_eq_iff P Y _ _).mpr + exact ⟨fun c => g.2 c, fun c => by + funext i + simp⟩ + +omit [Fintype C] [DecidableEq C] + [∀ c, Fintype (P c)] [∀ c, DecidableEq (P c)] + [∀ c, Fintype (X c)] [∀ c, DecidableEq (X c)] + [∀ c, Fintype (Y c)] [∀ c, DecidableEq (Y c)] in +private theorem completeWordPair_ext {w v : CompleteWordPair P X Y} + (hl : w.left = v.left) (hr : w.right = v.right) : w = v := by + cases w + cases v + cases hl + cases hr + rfl + +omit [Fintype C] [DecidableEq C] [∀ c, DecidableEq (P c)] + [∀ c, Fintype (X c)] [∀ c, Fintype (Y c)] in +theorem pairProfile_eq_iff (w v : CompleteWordPair P X Y) : + pairProfile w = pairProfile v ↔ + ∃ g : HalfClassPermutations P, g • w = v := by + constructor + · intro h + have hl := (InheritedMasks.profile_eq_iff P X w.left v.left).mp + (congrArg Prod.fst h) + have hr := (InheritedMasks.profile_eq_iff P Y w.right v.right).mp + (congrArg Prod.snd h) + obtain ⟨el, hel⟩ := hl + obtain ⟨er, her⟩ := hr + refine ⟨(fun c => (el c)⁻¹, fun c => (er c)⁻¹), ?_⟩ + apply completeWordPair_ext + · funext c i + exact congrFun (hel c) i + · funext c i + exact congrFun (her c) i + · rintro ⟨g, rfl⟩ + exact (pairProfile_smul g w).symm + +omit [Fintype C] [DecidableEq C] [∀ c, DecidableEq (P c)] + [∀ c, Fintype (X c)] [∀ c, Fintype (Y c)] in +theorem pairProfile_eq_iff_orbitRel (w v : CompleteWordPair P X Y) : + pairProfile w = pairProfile v ↔ + MulAction.orbitRel (HalfClassPermutations P) (CompleteWordPair P X Y) w v := by + constructor + · intro h + obtain ⟨g, hg⟩ := (pairProfile_eq_iff v w).mp h.symm + exact ⟨g, hg⟩ + · rintro ⟨g, rfl⟩ + exact pairProfile_smul g v + +abbrev PairOrbit (P X Y : C → Type*) := + MulAction.orbitRel.Quotient (HalfClassPermutations P) (CompleteWordPair P X Y) + +def pairOrbitProfile : PairOrbit P X Y → PairProfile P X Y := + Quotient.lift pairProfile fun w v h => (pairProfile_eq_iff_orbitRel w v).mpr h + +omit [Fintype C] [DecidableEq C] [∀ c, DecidableEq (P c)] + [∀ c, Fintype (X c)] [∀ c, Fintype (Y c)] in +theorem pairOrbitProfile_injective : + Function.Injective (pairOrbitProfile (P := P) (X := X) (Y := Y)) := by + intro q r + induction q using Quotient.inductionOn with + | h w => + induction r using Quotient.inductionOn with + | h v => + intro h + apply Quotient.sound + exact (pairProfile_eq_iff_orbitRel w v).mp h + +omit [∀ c, DecidableEq (P c)] in +theorem card_pairOrbits_le : + Nat.card (PairOrbit P X Y) ≤ + (∏ c, (Fintype.card (P c) + 1) ^ Fintype.card (X c)) * + (∏ c, (Fintype.card (P c) + 1) ^ Fintype.card (Y c)) := by + have : Finite (PairOrbit P X Y) := + Finite.of_injective pairOrbitProfile pairOrbitProfile_injective + let := Fintype.ofFinite (PairOrbit P X Y) + rw [Nat.card_eq_fintype_card] + calc + _ ≤ Fintype.card (PairProfile P X Y) := + Fintype.card_le_of_injective pairOrbitProfile pairOrbitProfile_injective + _ = _ := by + rw [Fintype.card_prod, InheritedMasks.card_profile, InheritedMasks.card_profile] + +omit [∀ c, DecidableEq (P c)] in +theorem card_pairOrbits_le_common_bound (m : ℕ) + (hm : ∀ c, Fintype.card (P c) ≤ m) : + Nat.card (PairOrbit P X Y) ≤ (m + 1) ^ + ((∑ c, Fintype.card (X c)) + ∑ c, Fintype.card (Y c)) := by + refine (card_pairOrbits_le (P := P) (X := X) (Y := Y)).trans ?_ + calc + _ ≤ (∏ c, (m + 1) ^ Fintype.card (X c)) * + (∏ c, (m + 1) ^ Fintype.card (Y c)) := by + apply Nat.mul_le_mul + · exact Finset.prod_le_prod fun c _ => + Nat.pow_le_pow_left (Nat.add_le_add_right (hm c) 1) _ + · exact Finset.prod_le_prod fun c _ => + Nat.pow_le_pow_left (Nat.add_le_add_right (hm c) 1) _ + _ = _ := by rw [Finset.prod_pow_eq_pow_sum, Finset.prod_pow_eq_pow_sum, pow_add] + +end + +end MatrixMultiplication.PermutationMatching + +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section + +namespace MatrixMultiplication.AllFieldHistoryOrbitCount + +open AllFieldHistory AllFieldHistorySupport PermutationMatching +open scoped BigOperators +attribute [local instance] Classical.propDecidable Classical.decEq + +abbrev Classes (K tick : ℕ) := ActiveClass K tick + +abbrev Positions {K tick : ℕ} (allocation : Allocation) (m : ℕ) + (c : Classes K tick) := + JointCanonicalization.ClassPositions (activeCounts allocation m) c + +abbrev Letters {K tick : ℕ} (c : Classes K tick) := + Fin (activeHalfLength c.1) → Fin 7 + +abbrev ActualOrbit {K tick : ℕ} (allocation : Allocation) (m : ℕ) := + PairOrbit (Positions (K := K) (tick := tick) allocation m) + (Letters (K := K) (tick := tick)) (Letters (K := K) (tick := tick)) + +noncomputable instance actualOrbitFintype {K tick : ℕ} + (allocation : Allocation) (m : ℕ) : + Fintype (ActualOrbit (K := K) (tick := tick) allocation m) := by + haveI : Finite (ActualOrbit (K := K) (tick := tick) allocation m) := + Finite.of_injective pairOrbitProfile pairOrbitProfile_injective + exact Fintype.ofFinite _ + +def basePopulationBound {K tick : ℕ} (allocation : Allocation) : ℕ := + ∑ c : Classes K tick, activeCounts allocation 1 c.1 c.2 + +def orbitDegree (K tick : ℕ) : ℕ := + 2 * ∑ c : Classes K tick, 7 ^ activeHalfLength c.1 + +theorem card_letters {K tick : ℕ} (c : Classes K tick) : + Fintype.card (Letters c) = 7 ^ activeHalfLength c.1 := by + simp only [Letters, Fintype.card_fun, Fintype.card_fin] + +theorem class_card_le {K tick : ℕ} (allocation : Allocation) (m : ℕ) + (c : Classes K tick) : + Fintype.card (Positions allocation m c) ≤ + basePopulationBound (K := K) (tick := tick) allocation * m := by + have hc : activeCounts allocation 1 c.1 c.2 ≤ + basePopulationBound (K := K) (tick := tick) allocation := by + unfold basePopulationBound + exact Finset.single_le_sum + (fun (d : Classes K tick) _ => Nat.zero_le (activeCounts allocation 1 d.1 d.2)) + (Finset.mem_univ c) + simp only [Positions, JointCanonicalization.ClassPositions, Fintype.card_fin, + activeCounts_dilation allocation m] + simpa only [Nat.mul_comm] using Nat.mul_le_mul_left m hc + +theorem card_actualOrbit_le {K tick : ℕ} (allocation : Allocation) (m : ℕ) : + Nat.card (ActualOrbit (K := K) (tick := tick) allocation m) ≤ + (basePopulationBound (K := K) (tick := tick) allocation * m + 1) ^ + orbitDegree K tick := by + simpa only [ActualOrbit, orbitDegree, card_letters, two_mul] using + (card_pairOrbits_le_common_bound + (P := Positions (K := K) (tick := tick) allocation m) + (X := Letters (K := K) (tick := tick)) + (Y := Letters (K := K) (tick := tick)) + (basePopulationBound (K := K) (tick := tick) allocation * m) + (class_card_le allocation m)) + +theorem card_actualOrbit_le_polynomial {K tick : ℕ} + (allocation : Allocation) (m : ℕ) : + Nat.card (ActualOrbit (K := K) (tick := tick) allocation m) ≤ + (basePopulationBound (K := K) (tick := tick) allocation + 1) ^ orbitDegree K tick * + (m + 1) ^ orbitDegree K tick := by + refine (card_actualOrbit_le allocation m).trans ?_ + rw [← mul_pow] + apply Nat.pow_le_pow_left + nlinarith [Nat.zero_le (basePopulationBound (K := K) (tick := tick) allocation)] + +def orbitPrefactor {K tick : ℕ} (allocation : Allocation) : ℝ := + ((basePopulationBound (K := K) (tick := tick) allocation + 1 : ℕ) : ℝ) ^ + orbitDegree K tick + +theorem orbitPrefactor_pos {K tick : ℕ} (allocation : Allocation) : + 0 < orbitPrefactor (K := K) (tick := tick) allocation := by + unfold orbitPrefactor + positivity + +theorem card_actualOrbit_le_polynomial_real {K tick : ℕ} + (allocation : Allocation) (m : ℕ) : + (Nat.card (ActualOrbit (K := K) (tick := tick) allocation m) : ℝ) ≤ + orbitPrefactor (K := K) (tick := tick) allocation * + ((m : ℝ) + 1) ^ orbitDegree K tick := by + unfold orbitPrefactor + exact_mod_cast card_actualOrbit_le_polynomial (K := K) (tick := tick) allocation m + +theorem usedOrbits_card_le {K tick : ℕ} (allocation : Allocation) (m : ℕ) + (s : Finset (ActualOrbit (K := K) (tick := tick) allocation m)) : + s.card ≤ (basePopulationBound (K := K) (tick := tick) allocation + 1) ^ + orbitDegree K tick * (m + 1) ^ orbitDegree K tick := by + have hs : s.card ≤ Nat.card (ActualOrbit (K := K) (tick := tick) allocation m) := by + rw [Nat.card_eq_fintype_card] + exact s.card_le_univ + exact hs.trans (card_actualOrbit_le_polynomial allocation m) + +theorem usedOrbits_card_le_real {K tick : ℕ} (allocation : Allocation) (m : ℕ) + (s : Finset (ActualOrbit (K := K) (tick := tick) allocation m)) : + (s.card : ℝ) ≤ orbitPrefactor (K := K) (tick := tick) allocation * + ((m : ℝ) + 1) ^ orbitDegree K tick := by + unfold orbitPrefactor + exact_mod_cast usedOrbits_card_le allocation m s + +theorem taggedUsedOrbits_card_le_real {K tick : ℕ} (allocation : Allocation) (m : ℕ) + (s : Finset (Fin 3 × ActualOrbit (K := K) (tick := tick) allocation m)) : + (s.card : ℝ) ≤ (3 * orbitPrefactor (K := K) (tick := tick) allocation) * + ((m : ℝ) + 1) ^ orbitDegree K tick := by + have hs : s.card ≤ 3 * Nat.card + (ActualOrbit (K := K) (tick := tick) allocation m) := by + simpa only [Fintype.card_prod, Fintype.card_fin, Nat.card_eq_fintype_card] using + s.card_le_univ + have hsreal : (s.card : ℝ) ≤ 3 * (Nat.card + (ActualOrbit (K := K) (tick := tick) allocation m) : ℝ) := by + exact_mod_cast hs + calc + _ ≤ 3 * (Nat.card (ActualOrbit (K := K) (tick := tick) allocation m) : ℝ) := hsreal + _ ≤ 3 * (orbitPrefactor (K := K) (tick := tick) allocation * + ((m : ℝ) + 1) ^ orbitDegree K tick) := + mul_le_mul_of_nonneg_left (card_actualOrbit_le_polynomial_real allocation m) + (by norm_num) + _ = _ := (mul_assoc _ _ _).symm + +end MatrixMultiplication.AllFieldHistoryOrbitCount + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section + +namespace MatrixMultiplication.AllFieldGroupOrbitCount + +open AllFieldHistory AllFieldHistorySupport PermutationMatching +open scoped BigOperators +attribute [local instance] Classical.propDecidable Classical.decEq + +abbrev GroupClasses (K tick : ℕ) (sigma : Placement) := + ActiveOrder K tick sigma × JointPopulation.Shape + +abbrev GroupPositions {K tick : ℕ} (allocation : Allocation) (m : ℕ) + {sigma : Placement} (c : GroupClasses K tick sigma) := + Fin (activeCounts allocation m c.1.val c.2) + +abbrev GroupLetters {K tick : ℕ} {sigma : Placement} (c : GroupClasses K tick sigma) := + Fin (activeHalfLength c.1.val) → Fin 7 + +abbrev GroupOrbit {K tick : ℕ} (allocation : Allocation) (m : ℕ) (sigma : Placement) := + PairOrbit (GroupPositions (K := K) (tick := tick) (sigma := sigma) allocation m) + (GroupLetters (K := K) (tick := tick) (sigma := sigma)) + (GroupLetters (K := K) (tick := tick) (sigma := sigma)) + +noncomputable instance groupOrbitFintype {K tick : ℕ} + (allocation : Allocation) (m : ℕ) (sigma : Placement) : + Fintype (GroupOrbit (K := K) (tick := tick) allocation m sigma) := by + haveI : Finite (GroupOrbit (K := K) (tick := tick) allocation m sigma) := + Finite.of_injective pairOrbitProfile pairOrbitProfile_injective + exact Fintype.ofFinite _ + +def groupDegree (K tick : ℕ) (sigma : Placement) : ℕ := + 2 * ∑ c : GroupClasses K tick sigma, 7 ^ activeHalfLength c.1.val + +theorem card_groupLetters {K tick : ℕ} {sigma : Placement} + (c : GroupClasses K tick sigma) : + Fintype.card (GroupLetters c) = 7 ^ activeHalfLength c.1.val := by + simp only [GroupLetters, Fintype.card_fun, Fintype.card_fin] + +theorem groupClass_card_le {K tick : ℕ} (allocation : Allocation) (m : ℕ) + {sigma : Placement} (c : GroupClasses K tick sigma) : + Fintype.card (GroupPositions allocation m c) ≤ + AllFieldHistoryOrbitCount.basePopulationBound (K := K) (tick := tick) allocation * m := + AllFieldHistoryOrbitCount.class_card_le allocation m (c.1.val, c.2) + +theorem card_groupOrbit_le {K tick : ℕ} + (allocation : Allocation) (m : ℕ) (sigma : Placement) : + Nat.card (GroupOrbit (K := K) (tick := tick) allocation m sigma) ≤ + (AllFieldHistoryOrbitCount.basePopulationBound (K := K) (tick := tick) allocation * m + 1) ^ + groupDegree K tick sigma := by + simpa only [GroupOrbit, groupDegree, card_groupLetters, two_mul] using + (card_pairOrbits_le_common_bound + (P := GroupPositions (K := K) (tick := tick) (sigma := sigma) allocation m) + (X := GroupLetters (K := K) (tick := tick) (sigma := sigma)) + (Y := GroupLetters (K := K) (tick := tick) (sigma := sigma)) + (AllFieldHistoryOrbitCount.basePopulationBound (K := K) (tick := tick) allocation * m) + (groupClass_card_le allocation m)) + +theorem card_groupOrbit_le_polynomial {K tick : ℕ} + (allocation : Allocation) (m : ℕ) (sigma : Placement) : + Nat.card (GroupOrbit (K := K) (tick := tick) allocation m sigma) ≤ + (AllFieldHistoryOrbitCount.basePopulationBound (K := K) (tick := tick) allocation + 1) ^ + groupDegree K tick sigma * (m + 1) ^ groupDegree K tick sigma := by + refine (card_groupOrbit_le allocation m sigma).trans ?_ + rw [← mul_pow] + apply Nat.pow_le_pow_left + nlinarith [Nat.zero_le + (AllFieldHistoryOrbitCount.basePopulationBound (K := K) (tick := tick) allocation)] + +def groupOrbitPrefactor {K tick : ℕ} (allocation : Allocation) (sigma : Placement) : ℝ := + ((AllFieldHistoryOrbitCount.basePopulationBound (K := K) (tick := tick) allocation + 1 : ℕ) : ℝ) ^ + groupDegree K tick sigma + +theorem groupOrbitPrefactor_pos {K tick : ℕ} (allocation : Allocation) (sigma : Placement) : + 0 < groupOrbitPrefactor (K := K) (tick := tick) allocation sigma := by + unfold groupOrbitPrefactor + positivity + +theorem card_groupOrbit_le_polynomial_real {K tick : ℕ} + (allocation : Allocation) (m : ℕ) (sigma : Placement) : + (Nat.card (GroupOrbit (K := K) (tick := tick) allocation m sigma) : ℝ) ≤ + groupOrbitPrefactor (K := K) (tick := tick) allocation sigma * + ((m : ℝ) + 1) ^ groupDegree K tick sigma := by + unfold groupOrbitPrefactor + exact_mod_cast card_groupOrbit_le_polynomial (K := K) (tick := tick) allocation m sigma + +theorem usedGroupOrbits_card_le_real {K tick : ℕ} (allocation : Allocation) (m : ℕ) + (sigma : Placement) + (s : Finset (GroupOrbit (K := K) (tick := tick) allocation m sigma)) : + (s.card : ℝ) ≤ groupOrbitPrefactor (K := K) (tick := tick) allocation sigma * + ((m : ℝ) + 1) ^ groupDegree K tick sigma := by + have hs : s.card ≤ Nat.card (GroupOrbit (K := K) (tick := tick) allocation m sigma) := by + rw [Nat.card_eq_fintype_card] + exact s.card_le_univ + have hsreal : (s.card : ℝ) ≤ + (Nat.card (GroupOrbit (K := K) (tick := tick) allocation m sigma) : ℝ) := by + exact_mod_cast hs + exact hsreal.trans (card_groupOrbit_le_polynomial_real allocation m sigma) + +theorem taggedUsedGroupOrbits_card_le_real {K tick : ℕ} + (allocation : Allocation) (m : ℕ) (sigma : Placement) + (s : Finset (Fin 3 × GroupOrbit (K := K) (tick := tick) allocation m sigma)) : + (s.card : ℝ) ≤ (3 * groupOrbitPrefactor (K := K) (tick := tick) allocation sigma) * + ((m : ℝ) + 1) ^ groupDegree K tick sigma := by + have hs : s.card ≤ 3 * Nat.card + (GroupOrbit (K := K) (tick := tick) allocation m sigma) := by + simpa only [Fintype.card_prod, Fintype.card_fin, Nat.card_eq_fintype_card] using + s.card_le_univ + have hsreal : (s.card : ℝ) ≤ 3 * (Nat.card + (GroupOrbit (K := K) (tick := tick) allocation m sigma) : ℝ) := by + exact_mod_cast hs + calc + _ ≤ 3 * (Nat.card (GroupOrbit (K := K) (tick := tick) allocation m sigma) : ℝ) := hsreal + _ ≤ 3 * (groupOrbitPrefactor (K := K) (tick := tick) allocation sigma * + ((m : ℝ) + 1) ^ groupDegree K tick sigma) := + mul_le_mul_of_nonneg_left (card_groupOrbit_le_polynomial_real allocation m sigma) + (by norm_num) + _ = _ := (mul_assoc _ _ _).symm + +end MatrixMultiplication.AllFieldGroupOrbitCount + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/Histories/GroupOrbitTransport.lean b/lean/OAI/LinearAlgebra/MatrixFields/Histories/GroupOrbitTransport.lean new file mode 100644 index 0000000000000000000000000000000000000000..132e86646f373d96e6a94d0f7f510f5044096ce9 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/Histories/GroupOrbitTransport.lean @@ -0,0 +1,527 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Construction.JointCoarseReorder +import OAI.LinearAlgebra.MatrixFields.Histories.HistorySourceAssignment +import OAI.LinearAlgebra.MatrixFields.Parameters.JointPopulationMixedCompatibility + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section + +namespace MatrixMultiplication.AllFieldGroupOrbitData + +open AllFieldHistory AllFieldHistorySupport AllFieldHistoryChildLaws +open AllFieldHistoryGroupMasks AllFieldHistoryGroupedRecovery +open AllFieldGroupOrbitCount JointPopulation JointCanonicalization +open JointCoarseHashing PermutationMatching +open scoped BigOperators +attribute [local instance] Classical.propDecidable + +variable {K tick : ℕ} {sigma : Placement} + +abbrev Counts (allocation : Allocation) (m : ℕ) (sigma : Placement) := + groupCounts (K := K) (tick := tick) allocation m sigma +abbrev Targets (allocation : Allocation) (m : ℕ) (sigma : Placement) := + Target (Counts (K := K) (tick := tick) allocation m sigma) +abbrev Pos (allocation : Allocation) (m : ℕ) (sigma : Placement) := + Position (Counts (K := K) (tick := tick) allocation m sigma) +abbrev Raw (allocation : Allocation) (m : ℕ) (sigma : Placement) := + GroupRaw (K := K) (tick := tick) allocation m sigma +abbrev Orbit (allocation : Allocation) (m : ℕ) (sigma : Placement) := + Fin 3 × GroupOrbit (K := K) (tick := tick) allocation m sigma +abbrev Variable (allocation : Allocation) (m : ℕ) (sigma : Placement) := + Fin 3 × Raw (K := K) (tick := tick) allocation m sigma + +def tripleSide {P : Type*} (s : Fin 3) (t : Triple P) : Word P := + (Matrix.vecCons (t.1) (Matrix.vecCons (t.2.1) (Matrix.vecCons (t.2.2) Matrix.vecEmpty))) s + +def reorder {P : Type*} (sigma : Placement) (t : Triple P) : Triple P := + (tripleSide (sigma 0) t, tripleSide (sigma 1) t, tripleSide (sigma 2) t) + +@[simp] theorem tripleSide_reorder {P : Type*} (sigma : Placement) + (t : Triple P) (s : Fin 3) : + tripleSide s (reorder sigma t) = tripleSide (sigma s) t := + JointCoarseReorder.tripleSide_reorder sigma t s + +theorem reorder_injective {P : Type*} (sigma : Placement) : + Function.Injective (reorder (P := P) sigma) := + JointCoarseReorder.reorder_injective sigma + +theorem reorder_support {P : Type*} (sigma : Placement) (S : P → ℕ) + (t : Triple P) (ht : HasSupportSum S t) : HasSupportSum S (reorder sigma t) := + JointCoarseReorder.reorder_support sigma S t ht + +def coarse (allocation : Allocation) (m : ℕ) (sigma : Placement) + (e : Targets (K := K) (tick := tick) allocation m sigma) : Triple (Pos (K := K) (tick := tick) allocation m sigma) := + reorder sigma (triple (Counts (K := K) (tick := tick) allocation m sigma) e) + +def ambient (allocation : Allocation) (m : ℕ) (sigma : Placement) : + Finset (Triple (Pos (K := K) (tick := tick) allocation m sigma)) := + (ambientSet (Counts (K := K) (tick := tick) allocation m sigma) (fun h => 2 * activeHalfLength h.val)).image + (reorder sigma) + +def support (allocation : Allocation) (m : ℕ) (sigma : Placement) + (p : Pos (K := K) (tick := tick) allocation m sigma) : ℕ := + 2 * activeHalfLength p.1.val + +theorem counts_support (allocation : Allocation) (m : ℕ) (sigma : Placement) + (h : ActiveOrder K tick sigma) (u : JointPopulation.Shape) + (hu : 0 < Counts (K := K) (tick := tick) allocation m sigma h u) : + u.1.val + u.2.1.val + u.2.2.val = 2 * activeHalfLength h.val := + jointCounts_support_sum allocation m h.val.val u hu + +theorem coarse_injective (allocation : Allocation) (m : ℕ) (sigma : Placement) : + Function.Injective (coarse (K := K) (tick := tick) allocation m sigma) := + (reorder_injective sigma).comp (triple_injective (Counts (K := K) (tick := tick) allocation m sigma)) + +theorem ambient_support (allocation : Allocation) (m : ℕ) (sigma : Placement) + (f : Triple (Pos (K := K) (tick := tick) allocation m sigma)) + (hf : f ∈ ambient allocation m sigma) : HasSupportSum (support allocation m sigma) f := by + obtain ⟨t, ht, rfl⟩ := Finset.mem_image.mp hf + exact reorder_support sigma _ t (Finset.mem_filter.mp ht).2.1 + +theorem coarse_mem_ambient (allocation : Allocation) (m : ℕ) (sigma : Placement) + (e : Targets (K := K) (tick := tick) allocation m sigma) : + coarse allocation m sigma e ∈ ambient allocation m sigma := by + apply Finset.mem_image.mpr + refine ⟨triple (Counts (K := K) (tick := tick) allocation m sigma) e, ?_, rfl⟩ + apply targetSet_subset_ambient (Counts (K := K) (tick := tick) allocation m sigma) + (fun h => 2 * activeHalfLength h.val) (counts_support allocation m sigma) + simp only [targetSet, Finset.mem_image, Finset.mem_univ, true_and] + exact ⟨e, rfl⟩ + +def sharing (h : ActiveOrder K tick sigma) : Bool := + match h.val.val.1 with + | .stageA _ => true + | .stageB _ => true + | .stageC _ => false + +def workComplement (w : Work K) : w.Statistic ≃ w.Statistic := + match w with + | .stageA _ => CWCompleteStatistics.orderedComplementStatistic + | .stageB _ => CWCompleteStatistics.complementStatistic + | .stageC _ => Equiv.refl _ + +def complement (h : ActiveOrder K tick sigma) : Statistic h.val ≃ Statistic h.val := + workComplement h.val.val.1 + +def compatibilityLaw (right : Bool) (side : Fin 3) (sigma : Placement) + (h : ActiveOrder K tick sigma) (u : JointPopulation.Shape) : Statistic h.val → ℝ := + let weight : Fin 3 → ℕ := fun i => + if right then activeParentShape h.val (sigma i) - (shapeSide (sigma i) u).val + else (shapeSide (sigma i) u).val + let source : Fin 3 := if side = 2 ∧ weight 1 ≠ 0 then sigma 1 else sigma 0 + (if right then rightLaw h.val u source else leftLaw h.val u source) ∘ + (complement h).symm + +def designated (right : Bool) (side : Fin 3) (sigma : Placement) + (h : ActiveOrder K tick sigma) (u : JointPopulation.Shape) : Prop := + sharing h = true ∧ + let weight : Fin 3 → ℕ := fun i => + if right then activeParentShape h.val (sigma i) - (shapeSide (sigma i) u).val + else (shapeSide (sigma i) u).val + if side = 1 then weight 2 = 0 + else if side = 2 then weight 0 * weight 1 = 0 else False + +def fineCompatible (allocation : Allocation) (m : ℕ) (ε : ℝ) (sigma : Placement) + (side : Fin 3) (e : Targets (K := K) (tick := tick) allocation m sigma) + (w : Raw (K := K) (tick := tick) allocation m sigma) : Prop := + ∀ (right : Bool) h u, designated right side sigma h u → ∀ a : Statistic h.val, + |(JointPopulationCompatibility.shapeStatisticCount (Counts (K := K) (tick := tick) allocation m sigma) e h u + (fun i => statistic h.val (if right then (w h i).2 else (w h i).1)) a : ℝ) - + (Counts (K := K) (tick := tick) allocation m sigma h u : ℝ) * compatibilityLaw right side sigma h u a| ≤ + (Counts (K := K) (tick := tick) allocation m sigma h u : ℝ) * AllFieldHistoryMasks.childWidth ε h.val + +def ownWord (allocation : Allocation) (m : ℕ) (sigma : Placement) + (w : Raw (K := K) (tick := tick) allocation m sigma) : Word (Pos (K := K) (tick := tick) allocation m sigma) := + fun p => groupCoarse 0 p.1 (w p.1 p.2) + +def Compatible (allocation : Allocation) (m : ℕ) (ε : ℝ) (sigma : Placement) + (side : Fin 3) (e : Targets (K := K) (tick := tick) allocation m sigma) + (w : Raw (K := K) (tick := tick) allocation m sigma) : Prop := + tripleSide side (coarse allocation m sigma e) = ownWord allocation m sigma w ∧ + fineCompatible allocation m ε sigma side e w + +def Admissible (allocation : Allocation) (m : ℕ) (ε : ℝ) (sigma : Placement) + (side : Fin 3) (e : Targets (K := K) (tick := tick) allocation m sigma) + (w : Raw (K := K) (tick := tick) allocation m sigma) : Prop := + groupIdealSide allocation m ε (sigma side) sigma e w ∧ + ∀ h j, CWStrands.weight (w h j).1 = (shapeSide (sigma side) ((e h).val j)).val ∧ + CWStrands.weight (w h j).2 = activeParentShape h.val (sigma side) - + (shapeSide (sigma side) ((e h).val j)).val + +def orbitOf (allocation : Allocation) (m : ℕ) (sigma : Placement) + (e : Targets (K := K) (tick := tick) allocation m sigma) + (w : Raw (K := K) (tick := tick) allocation m sigma) : GroupOrbit (K := K) (tick := tick) allocation m sigma := + Quotient.mk'' (groupCoordinates allocation m sigma e w) + +def usedOrbits (allocation : Allocation) (m : ℕ) (ε : ℝ) (sigma : Placement) + (e : Targets (K := K) (tick := tick) allocation m sigma) : Finset (Orbit (K := K) (tick := tick) allocation m sigma) := + Finset.univ.filter fun o => ∃ w, Admissible allocation m ε sigma o.1 e w ∧ + orbitOf allocation m sigma e w = o.2 + +def full (allocation : Allocation) (m : ℕ) (sigma : Placement) + (e : Targets (K := K) (tick := tick) allocation m sigma) (o : Orbit (K := K) (tick := tick) allocation m sigma) : + Finset (Variable (K := K) (tick := tick) allocation m sigma) := + Finset.univ.filter fun v => v.1 = o.1 ∧ orbitOf allocation m sigma e v.2 = o.2 + +def passing (allocation : Allocation) (m : ℕ) (sigma : Placement) (ε : ℝ) + (e : Targets (K := K) (tick := tick) allocation m sigma) (o : Orbit (K := K) (tick := tick) allocation m sigma) : + Finset (Variable (K := K) (tick := tick) allocation m sigma) := + (full allocation m sigma e o).filter fun v => completeKeep allocation m ε (sigma v.1) sigma v.2 + +def competitors (allocation : Allocation) (m : ℕ) (ε : ℝ) (sigma : Placement) + (e : Targets (K := K) (tick := tick) allocation m sigma) + (_o : Orbit (K := K) (tick := tick) allocation m sigma) (v : Variable (K := K) (tick := tick) allocation m sigma) : + Finset (Triple (Pos (K := K) (tick := tick) allocation m sigma)) := + (Finset.univ.image (coarse allocation m sigma)).filter fun t => + t ≠ coarse allocation m sigma e ∧ + tripleSide v.1 t = tripleSide v.1 (coarse allocation m sigma e) ∧ + ∃ f, coarse allocation m sigma f = t ∧ Compatible allocation m ε sigma v.1 f v.2 + +theorem full_pos (allocation : Allocation) (m : ℕ) (ε : ℝ) (sigma : Placement) + (e : Targets (K := K) (tick := tick) allocation m sigma) (o : Orbit (K := K) (tick := tick) allocation m sigma) + (ho : o ∈ usedOrbits allocation m ε sigma e) : 0 < (full allocation m sigma e o).card := by + obtain ⟨w, _, hw⟩ := (Finset.mem_filter.mp ho).2 + apply Finset.card_pos.mpr + exact ⟨(o.1, w), Finset.mem_filter.mpr ⟨Finset.mem_univ _, rfl, hw⟩⟩ + +theorem competitor_mem (allocation : Allocation) (m : ℕ) (ε : ℝ) (sigma : Placement) + (e : Targets (K := K) (tick := tick) allocation m sigma) (o : Orbit (K := K) (tick := tick) allocation m sigma) + (v : Variable (K := K) (tick := tick) allocation m sigma) (t : Triple (Pos (K := K) (tick := tick) allocation m sigma)) + (ht : t ∈ competitors allocation m ε sigma e o v) : t ∈ ambient allocation m sigma := by + obtain ⟨f, hf, _⟩ := (Finset.mem_filter.mp ht).2.2.2 + rw [← hf] + exact coarse_mem_ambient allocation m sigma f + +theorem competitor_shares (allocation : Allocation) (m : ℕ) (ε : ℝ) (sigma : Placement) + (e : Targets (K := K) (tick := tick) allocation m sigma) (o : Orbit (K := K) (tick := tick) allocation m sigma) + (v : Variable (K := K) (tick := tick) allocation m sigma) (t : Triple (Pos (K := K) (tick := tick) allocation m sigma)) + (ht : t ∈ competitors allocation m ε sigma e o v) : SharesSide (coarse allocation m sigma e) t := by + have h := (Finset.mem_filter.mp ht).2.2.1 + rcases v with ⟨side, w⟩ + fin_cases side + · exact Or.inl h + · exact Or.inr (Or.inl h) + · exact Or.inr (Or.inr h) + +def data (allocation : Allocation) (m : ℕ) (ε : ℝ) (sigma : Placement) : + JointMaskedSelection.OrbitData + (Pos (K := K) (tick := tick) allocation m sigma) (Targets (K := K) (tick := tick) allocation m sigma) + (Orbit (K := K) (tick := tick) allocation m sigma) (Variable (K := K) (tick := tick) allocation m sigma) where + ambient := ambient allocation m sigma + support := support allocation m sigma + coarse := coarse allocation m sigma + support_ambient := ambient_support allocation m sigma + target_mem := coarse_mem_ambient allocation m sigma + orbits := usedOrbits allocation m ε sigma + full := full allocation m sigma + passing := passing allocation m sigma ε + full_pos := full_pos allocation m ε sigma + passing_subset := fun _ _ _ => Finset.filter_subset _ _ + competitors := competitors allocation m ε sigma + competitor_mem := fun e o _ v _ t ht => competitor_mem allocation m ε sigma e o v t ht + competitor_ne := fun _ _ _ _ _ _ ht => (Finset.mem_filter.mp ht).2.1 + competitor_shares := fun e o _ v _ t ht => competitor_shares allocation m ε sigma e o v t ht + +theorem admissible_covered (allocation : Allocation) (m : ℕ) (ε : ℝ) (sigma : Placement) + (side : Fin 3) (e : Targets (K := K) (tick := tick) allocation m sigma) + (w : Raw (K := K) (tick := tick) allocation m sigma) (hw : Admissible allocation m ε sigma side e w) : + ∃ o ∈ (data allocation m ε sigma).orbits e, + (side, w) ∈ (data allocation m ε sigma).full e o := by + refine ⟨(side, orbitOf allocation m sigma e w), ?_, ?_⟩ + · exact Finset.mem_filter.mpr ⟨Finset.mem_univ _, w, hw, rfl⟩ + · exact Finset.mem_filter.mpr ⟨Finset.mem_univ _, rfl, rfl⟩ + +theorem orbits_card_le (allocation : Allocation) (m : ℕ) (ε : ℝ) (sigma : Placement) + (e : Targets (K := K) (tick := tick) allocation m sigma) : + (((data allocation m ε sigma).orbits e).card : ℝ) ≤ + (3 * groupOrbitPrefactor (K := K) (tick := tick) allocation sigma) * + ((m : ℝ) + 1) ^ groupDegree K tick sigma := + taggedUsedGroupOrbits_card_le_real allocation m sigma _ + +def actualCompatible (allocation : Allocation) (m : ℕ) (ε : ℝ) (sigma : Placement) + (t : Triple (Pos (K := K) (tick := tick) allocation m sigma)) + (v : Variable (K := K) (tick := tick) allocation m sigma) : Prop := + ∃ f, coarse allocation m sigma f = t ∧ Compatible allocation m ε sigma v.1 f v.2 + +def actualUseful (allocation : Allocation) (m : ℕ) (ε : ℝ) (sigma : Placement) + (t : Triple (Pos (K := K) (tick := tick) allocation m sigma)) + (v : Variable (K := K) (tick := tick) allocation m sigma) : Prop := + ∃ f, coarse allocation m sigma f = t ∧ + groupIdealSide allocation m ε (sigma v.1) sigma f v.2 + +def actualKeep (allocation : Allocation) (m : ℕ) (ε : ℝ) (sigma : Placement) + (v : Variable (K := K) (tick := tick) allocation m sigma) : Prop := + completeKeep allocation m ε (sigma v.1) sigma v.2 + +@[simp] theorem actualCompatible_coarse (allocation : Allocation) (m : ℕ) (ε : ℝ) + (sigma : Placement) (e : Targets (K := K) (tick := tick) allocation m sigma) + (v : Variable (K := K) (tick := tick) allocation m sigma) : + actualCompatible allocation m ε sigma (coarse allocation m sigma e) v ↔ + Compatible allocation m ε sigma v.1 e v.2 := by + constructor + · rintro ⟨f, hf, hv⟩ + exact (coarse_injective allocation m sigma hf) ▸ hv + · exact fun hv => ⟨e, rfl, hv⟩ + +@[simp] theorem actualUseful_coarse (allocation : Allocation) (m : ℕ) (ε : ℝ) + (sigma : Placement) (e : Targets (K := K) (tick := tick) allocation m sigma) + (v : Variable (K := K) (tick := tick) allocation m sigma) : + actualUseful allocation m ε sigma (coarse allocation m sigma e) v ↔ + groupIdealSide allocation m ε (sigma v.1) sigma e v.2 := by + constructor + · rintro ⟨f, hf, hv⟩ + exact (coarse_injective allocation m sigma hf) ▸ hv + · exact fun hv => ⟨e, rfl, hv⟩ + +theorem competitor_coverage (allocation : Allocation) (m : ℕ) (ε : ℝ) + (sigma : Placement) (e : Targets (K := K) (tick := tick) allocation m sigma) + (o : Orbit (K := K) (tick := tick) allocation m sigma) (v : Variable (K := K) (tick := tick) allocation m sigma) + (he : Compatible allocation m ε sigma v.1 e v.2) + (t : Triple (Pos (K := K) (tick := tick) allocation m sigma)) + (hne : t ≠ coarse allocation m sigma e) + (hc : actualCompatible allocation m ε sigma t v) : + t ∈ (data allocation m ε sigma).competitors e o v := by + obtain ⟨f, hf, hcomp⟩ := hc + apply Finset.mem_filter.mpr + refine ⟨?_, hne, ?_, f, hf, hcomp⟩ + · simp only [Finset.mem_image] + exact ⟨f, Finset.mem_univ _, hf⟩ + · rw [← hf] + exact hcomp.1.trans he.1.symm + +theorem mem_passing (allocation : Allocation) (m : ℕ) (ε : ℝ) + (sigma : Placement) (e : Targets (K := K) (tick := tick) allocation m sigma) + (o : Orbit (K := K) (tick := tick) allocation m sigma) (v : Variable (K := K) (tick := tick) allocation m sigma) : + v ∈ (data allocation m ε sigma).passing e o ↔ + v ∈ (data allocation m ε sigma).full e o ∧ actualKeep allocation m ε sigma v := + Finset.mem_filter + +end MatrixMultiplication.AllFieldGroupOrbitData + +end + + + + +namespace MatrixMultiplication.JointOrbitFibers + +attribute [local instance] Classical.propDecidable + +variable {G X Y : Type*} [Group G] [MulAction G X] [Fintype X] + +noncomputable def fullFiber (q : MulAction.orbitRel.Quotient G X) : Finset X := + Finset.univ.filter fun x => (Quotient.mk'' x : MulAction.orbitRel.Quotient G X) = q + +@[simp] theorem mem_fullFiber {q : MulAction.orbitRel.Quotient G X} {x : X} : + x ∈ fullFiber q ↔ (Quotient.mk'' x : MulAction.orbitRel.Quotient G X) = q := by + simp only [fullFiber, Finset.mem_filter, Finset.mem_univ, true_and] + +@[simp] theorem mem_fullFiber_mk {x y : X} : + y ∈ fullFiber (Quotient.mk'' x : MulAction.orbitRel.Quotient G X) ↔ + ∃ g : G, g • x = y := by + rw [mem_fullFiber] + constructor + · intro h + exact Quotient.exact h + · intro h + exact Quotient.sound h + +theorem fullFiber_nonempty (q : MulAction.orbitRel.Quotient G X) : + (fullFiber q).Nonempty := by + induction q using Quotient.inductionOn with + | h x => exact ⟨x, mem_fullFiber.mpr rfl⟩ + +theorem fullFiber_card_pos (q : MulAction.orbitRel.Quotient G X) : + 0 < (fullFiber q).card := + Finset.card_pos.mpr (fullFiber_nonempty q) + +section FiniteGroup + +variable [Fintype G] [DecidableEq X] + +theorem fullFiber_mk (x : X) : + fullFiber (Quotient.mk'' x : MulAction.orbitRel.Quotient G X) = + OrbitCounting.orbitSet (G := G) x := by + ext y + rw [mem_fullFiber_mk] + simp only [OrbitCounting.orbitSet, Finset.mem_image, Finset.mem_univ, true_and] + +theorem fullFiber_eq_orbitSet (q : MulAction.orbitRel.Quotient G X) (x : X) + (hx : x ∈ fullFiber q) : + fullFiber q = OrbitCounting.orbitSet (G := G) x := by + rw [← mem_fullFiber.mp hx, fullFiber_mk] + +end FiniteGroup + +noncomputable def transportedFiber (e : Y ≃ X) + (q : MulAction.orbitRel.Quotient G X) : Finset Y := + (fullFiber q).map e.symm.toEmbedding + +@[simp] theorem mem_transportedFiber (e : Y ≃ X) + {q : MulAction.orbitRel.Quotient G X} {y : Y} : + y ∈ transportedFiber e q ↔ + (Quotient.mk'' (e y) : MulAction.orbitRel.Quotient G X) = q := by + constructor + · intro h + obtain ⟨x, hx, hxy⟩ := Finset.mem_map.mp h + have he : e y = x := by + rw [← hxy] + exact e.apply_symm_apply x + rw [he] + exact mem_fullFiber.mp hx + · intro h + exact Finset.mem_map.mpr ⟨e y, mem_fullFiber.mpr h, e.symm_apply_apply y⟩ + +@[simp] theorem transportedFiber_card (e : Y ≃ X) + (q : MulAction.orbitRel.Quotient G X) : + (transportedFiber e q).card = (fullFiber q).card := + Finset.card_map _ + +theorem transportedFiber_card_pos (e : Y ≃ X) + (q : MulAction.orbitRel.Quotient G X) : + 0 < (transportedFiber e q).card := by + rw [transportedFiber_card] + exact fullFiber_card_pos q + +theorem transportedFiber_mk [Fintype G] [DecidableEq X] [DecidableEq Y] + (e : Y ≃ X) (y : Y) : + letI : MulAction G Y := EquivOrbitTransport.action e + transportedFiber e + (Quotient.mk'' (e y) : MulAction.orbitRel.Quotient G X) = + OrbitCounting.orbitSet (G := G) y := by + let : MulAction G Y := EquivOrbitTransport.action e + ext z + rw [mem_transportedFiber] + constructor + · intro h + have hz : e z ∈ fullFiber + (Quotient.mk'' (e y) : MulAction.orbitRel.Quotient G X) := + mem_fullFiber.mpr h + obtain ⟨g, hg⟩ := mem_fullFiber_mk.mp hz + apply Finset.mem_image.mpr + refine ⟨g, Finset.mem_univ _, ?_⟩ + change e.symm (g • e y) = z + rw [hg, e.symm_apply_apply] + · intro h + obtain ⟨g, _, hg⟩ := Finset.mem_image.mp h + apply Quotient.sound + change ∃ g : G, g • e y = e z + refine ⟨g, ?_⟩ + have he := congrArg e hg + change e (e.symm (g • e y)) = e z at he + simpa only [e.apply_symm_apply] using he + +theorem transportedFiber_filter_card (e : Y ≃ X) + (q : MulAction.orbitRel.Quotient G X) (bad : Y → Prop) [DecidablePred bad] : + ((transportedFiber e q).filter bad).card = + ((fullFiber q).filter (bad ∘ e.symm)).card := by + rw [transportedFiber, Finset.filter_map] + exact Finset.card_map _ + +end MatrixMultiplication.JointOrbitFibers + + + + + +noncomputable section + +namespace MatrixMultiplication.AllFieldGroupOrbitData + +open AllFieldHistory AllFieldHistoryGroupMasks AllFieldHistoryGroupedRecovery +open AllFieldGroupOrbitCount JointCoarseHashing PermutationMatching +attribute [local instance] Classical.propDecidable Classical.decEq + +variable {K tick : ℕ} + +local instance canonicalGroupAction (allocation : Allocation) (m : ℕ) (sigma : Placement) : + MulAction + (HalfClassPermutations (GroupPositions (K := K) (tick := tick) (sigma := sigma) allocation m)) + (JointCanonicalization.CanonicalPairs (groupCounts (K := K) (tick := tick) allocation m sigma) + (fun h => Fin (activeHalfLength h.val) → Fin 7) + (fun h => Fin (activeHalfLength h.val) → Fin 7)) := + completeWordPairMulAction + +local instance canonicalGroupFintype (allocation : Allocation) (m : ℕ) (sigma : Placement) : + Fintype + (JointCanonicalization.CanonicalPairs (groupCounts (K := K) (tick := tick) allocation m sigma) + (fun h => Fin (activeHalfLength h.val) → Fin 7) + (fun h => Fin (activeHalfLength h.val) → Fin 7)) := by + letI : ∀ c : GroupClasses K tick sigma, + Fintype (GroupPositions allocation m c) := fun _ => Fin.fintype _ + letI : ∀ c : GroupClasses K tick sigma, + DecidableEq (GroupPositions allocation m c) := fun _ => Classical.decEq _ + letI : ∀ c : GroupClasses K tick sigma, + Fintype (GroupLetters c) := fun _ => Pi.instFintype + exact HistorySymmetry.completeWordPairFintype + +def tag (allocation : Allocation) (m : ℕ) (sigma : Placement) (side : Fin 3) : + Raw (K := K) (tick := tick) allocation m sigma ↪ Variable (K := K) (tick := tick) allocation m sigma where + toFun w := (side, w) + inj' := by intro w v h; exact congrArg Prod.snd h + +theorem full_eq_tagged_fiber (allocation : Allocation) (m : ℕ) (sigma : Placement) + (e : Targets (K := K) (tick := tick) allocation m sigma) (o : Orbit (K := K) (tick := tick) allocation m sigma) : + full allocation m sigma e o = + (JointOrbitFibers.transportedFiber (groupCoordinates allocation m sigma e) o.2).map + (tag allocation m sigma o.1) := by + ext v + constructor + · intro hv + have hh := (Finset.mem_filter.mp hv).2 + apply Finset.mem_map.mpr + refine ⟨v.2, ?_, ?_⟩ + · exact (JointOrbitFibers.mem_transportedFiber (groupCoordinates allocation m sigma e)).mpr hh.2 + · exact Prod.ext hh.1.symm rfl + · intro hv + obtain ⟨w, hw, rfl⟩ := Finset.mem_map.mp hv + exact Finset.mem_filter.mpr ⟨Finset.mem_univ _, rfl, + (JointOrbitFibers.mem_transportedFiber (groupCoordinates allocation m sigma e)).mp hw⟩ + +theorem full_eq_tagged_localOrbit (allocation : Allocation) (m : ℕ) (sigma : Placement) + (e : Targets (K := K) (tick := tick) allocation m sigma) + (side : Fin 3) (w : Raw (K := K) (tick := tick) allocation m sigma) : + full allocation m sigma e (side, orbitOf allocation m sigma e w) = + (localOrbit allocation m sigma e w).map (tag allocation m sigma side) := by + rw [full_eq_tagged_fiber] + dsimp only [orbitOf] + apply congrArg (fun t : Finset (Raw (K := K) (tick := tick) allocation m sigma) => + t.map (tag allocation m sigma side)) + refine (JointOrbitFibers.transportedFiber_mk + (G := HalfClassPermutations (GroupPositions (sigma := sigma) allocation m)) + (groupCoordinates allocation m sigma e) w).trans ?_ + ext v + simp only [localOrbit, GroupOrbitProjection.rawOrbit, GroupOrbitProjection.transportedOrbit, + OrbitCounting.orbitSet, + Finset.mem_image, Finset.mem_univ, true_and] + rfl + +@[simp] theorem full_card_localOrbit (allocation : Allocation) (m : ℕ) (sigma : Placement) + (e : Targets (K := K) (tick := tick) allocation m sigma) + (side : Fin 3) (w : Raw (K := K) (tick := tick) allocation m sigma) : + (full allocation m sigma e (side, orbitOf allocation m sigma e w)).card = + (localOrbit allocation m sigma e w).card := by + rw [full_eq_tagged_localOrbit, Finset.card_map] + +theorem full_filter_card_localOrbit (allocation : Allocation) (m : ℕ) (sigma : Placement) + (e : Targets (K := K) (tick := tick) allocation m sigma) + (side : Fin 3) (w : Raw (K := K) (tick := tick) allocation m sigma) (bad : Variable (K := K) (tick := tick) allocation m sigma → Prop) : + ((full allocation m sigma e (side, orbitOf allocation m sigma e w)).filter bad).card = + ((localOrbit allocation m sigma e w).filter (fun v => bad (side, v))).card := by + rw [full_eq_tagged_localOrbit, Finset.filter_map] + exact Finset.card_map _ + +end MatrixMultiplication.AllFieldGroupOrbitData + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/Histories/HistoryChildLaws.lean b/lean/OAI/LinearAlgebra/MatrixFields/Histories/HistoryChildLaws.lean new file mode 100644 index 0000000000000000000000000000000000000000..86394cfce7870841ca8e8c7ccb14796e51370465 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/Histories/HistoryChildLaws.lean @@ -0,0 +1,1479 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Construction.ShapeEncoding +import OAI.LinearAlgebra.MatrixFields.Entropy.ParametersHalfLaws +import OAI.LinearAlgebra.MatrixFields.Parameters.PopulationCounts +import OAI.LinearAlgebra.MatrixFields.Tensors.CWCompleteStatistics + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +open scoped BigOperators + +noncomputable section + +namespace MatrixMultiplication.Staggering + +abbrev Capacity := Fin 3 → ℝ + +def totalCapacity (a b : Capacity) (base : ℝ) : ℝ := + base + (∑ i, (a i + b i)) / 3 + +def balanceFraction (a b : Capacity) (high base : ℝ) (i : Fin 3) : ℝ := + (high - totalCapacity a b base + (a i + b i)) / (3 * (high - base)) + +def thirdCapacity (a b : Capacity) (high base : ℝ) (i : Fin 3) : ℝ := + high - 3 * balanceFraction a b high base i * (high - base) + +theorem balanceFraction_pos (a b : Capacity) (high base : ℝ) + (hbase : base < high) + (hfeas : ∀ i, totalCapacity a b base - (a i + b i) < high) (i : Fin 3) : + 0 < balanceFraction a b high base i := by + apply div_pos + · linarith [hfeas i] + · exact mul_pos (by norm_num) (sub_pos.mpr hbase) + +theorem sum_balanceFraction (a b : Capacity) (high base : ℝ) + (hbase : base < high) : ∑ i, balanceFraction a b high base i = 1 := by + have hn : high - base ≠ 0 := ne_of_gt (sub_pos.mpr hbase) + simp only [balanceFraction, Fin.sum_univ_succ, + Fin.sum_univ_zero, add_zero] + unfold totalCapacity + simp only [Fin.sum_univ_succ, Fin.sum_univ_zero, add_zero] + field_simp + ring + +theorem thirdCapacity_eq (a b : Capacity) (high base : ℝ) + (hbase : base < high) (i : Fin 3) : + thirdCapacity a b high base i = totalCapacity a b base - (a i + b i) := by + have hn : high - base ≠ 0 := ne_of_gt (sub_pos.mpr hbase) + unfold thirdCapacity balanceFraction + field_simp + ring + +theorem balanced (a b : Capacity) (high base : ℝ) (hbase : base < high) + (i : Fin 3) : a i + b i + thirdCapacity a b high base i = + totalCapacity a b base := by + rw [thirdCapacity_eq a b high base hbase] + ring + +def minCapacity (a : Capacity) : ℝ := min (a 0) (min (a 1) (a 2)) + +def maxCapacity (a : Capacity) : ℝ := max (a 0) (max (a 1) (a 2)) + +theorem minCapacity_pos (a : Capacity) (h : ∀ i, 0 < a i) : + 0 < minCapacity a := by + exact lt_min (h 0) (lt_min (h 1) (h 2)) + +theorem minCapacity_le_maxCapacity (a : Capacity) : minCapacity a ≤ maxCapacity a := by + exact (min_le_left _ _).trans (le_max_left _ _) + +theorem minCapacity_complement (a : Capacity) (c : ℝ) : + minCapacity (fun i => c - a i) = c - maxCapacity a := by + simp only [minCapacity, maxCapacity, min_def, max_def] + split_ifs <;> linarith + +def boundaryDeficit (a b c : Capacity) (full : ℝ) : ℝ := + 2 * full - minCapacity a - minCapacity (fun i => a i + b i) - + minCapacity (fun i => b i + c i) - minCapacity c + +theorem boundaryDeficit_eq_ranges (a b c : Capacity) (full : ℝ) + (h : ∀ i, a i + b i + c i = full) : + boundaryDeficit a b c full = + (maxCapacity a - minCapacity a) + (maxCapacity c - minCapacity c) := by + have hab : (fun i => a i + b i) = (fun i => full - c i) := by + funext i + linarith [h i] + have hbc : (fun i => b i + c i) = (fun i => full - a i) := by + funext i + linarith [h i] + rw [boundaryDeficit, hab, hbc, minCapacity_complement, minCapacity_complement] + ring + +theorem boundaryDeficit_nonneg (a b c : Capacity) (full : ℝ) + (h : ∀ i, a i + b i + c i = full) : 0 ≤ boundaryDeficit a b c full := by + rw [boundaryDeficit_eq_ranges a b c full h] + exact add_nonneg (sub_nonneg.mpr (minCapacity_le_maxCapacity a)) + (sub_nonneg.mpr (minCapacity_le_maxCapacity c)) + +theorem finite_schedule_yield (a b c : Capacity) (full : ℝ) (K : ℕ) (hK : 2 ≤ K) : + (K - 2 : ℕ) * full + minCapacity a + minCapacity (fun i => a i + b i) + + minCapacity (fun i => b i + c i) + minCapacity c = + (K : ℝ) * full - boundaryDeficit a b c full := by + rw [Nat.cast_sub hK] + norm_num [boundaryDeficit] + ring + +theorem physical_order_unique (rho sigma : Equiv.Perm (Fin 3)) : + ∃! phi : Equiv.Perm (Fin 3), rho.trans phi = sigma := by + refine ⟨rho.symm.trans sigma, ?_, ?_⟩ + · ext i + simp + · intro phi hphi + apply Equiv.ext + intro i + have h := Equiv.congr_fun hphi (rho.symm i) + simpa using h + +end MatrixMultiplication.Staggering + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +open scoped BigOperators + +noncomputable section + +namespace MatrixMultiplication.FiniteSchedule + +open Staggering + +def lotTick {K : ℕ} (j : Fin K) (stage : Fin 3) : ℕ := j.val + stage.val + +theorem lotTick_lt {K : ℕ} (j : Fin K) (stage : Fin 3) : + lotTick j stage < K + 2 := by + have hj := j.isLt + have hs := stage.isLt + dsimp [lotTick] + omega + +def stageActive (K tick : ℕ) (stage : Fin 3) : Prop := + stage.val ≤ tick ∧ tick < K + stage.val + +instance (K tick : ℕ) (stage : Fin 3) : Decidable (stageActive K tick stage) := + inferInstanceAs (Decidable (stage.val ≤ tick ∧ tick < K + stage.val)) + +theorem stageActive_iff_unique_lot (K tick : ℕ) (stage : Fin 3) : + stageActive K tick stage ↔ ∃! j : Fin K, lotTick j stage = tick := by + constructor + · rintro ⟨hle, hlt⟩ + refine ⟨⟨tick - stage.val, by omega⟩, ?_, ?_⟩ + · dsimp [lotTick] + omega + · intro j hj + apply Fin.ext + dsimp [lotTick] at hj ⊢ + omega + · rintro ⟨j, hj, _⟩ + have hjlt := j.isLt + dsimp [stageActive, lotTick] at * + omega + +theorem lot_active_at_its_tick {K : ℕ} (j : Fin K) (stage : Fin 3) : + stageActive K (lotTick j stage) stage := by + have hj := j.isLt + dsimp [stageActive, lotTick] + omega + +def tickCapacity (K : ℕ) (a b c : Capacity) (tick : ℕ) : Capacity := fun i => + (if stageActive K tick 0 then a i else 0) + + (if stageActive K tick 1 then b i else 0) + + (if stageActive K tick 2 then c i else 0) + +theorem tickCapacity_first (K : ℕ) (hK : 2 ≤ K) (a b c : Capacity) : + tickCapacity K a b c 0 = a := by + funext i + have h0 : 0 < K := by omega + simp [tickCapacity, stageActive, h0] + +theorem tickCapacity_second (K : ℕ) (hK : 2 ≤ K) (a b c : Capacity) : + tickCapacity K a b c 1 = fun i => a i + b i := by + funext i + have h1 : 1 < K := by omega + have h2 : 1 < K + 1 := by omega + simp [tickCapacity, stageActive, h1, h2] + +theorem tickCapacity_interior (K tick : ℕ) (ht : 2 ≤ tick) (htK : tick < K) + (a b c : Capacity) : + tickCapacity K a b c tick = fun i => a i + b i + c i := by + funext i + have h1 : 1 ≤ tick := by omega + have ht1 : tick < K + 1 := by omega + have ht2 : tick < K + 2 := by omega + simp [tickCapacity, stageActive, ht, htK, h1, ht1, ht2] + +theorem tickCapacity_penultimate (K : ℕ) (hK : 2 ≤ K) (a b c : Capacity) : + tickCapacity K a b c K = fun i => b i + c i := by + funext i + have h1 : 1 ≤ K := by omega + simp [tickCapacity, stageActive, hK, h1] + +theorem tickCapacity_last (K : ℕ) (hK : 2 ≤ K) (a b c : Capacity) : + tickCapacity K a b c (K + 1) = c := by + funext i + have h1 : 2 ≤ K + 1 := by omega + simp [tickCapacity, stageActive, h1] + +theorem sum_tick_minima (K : ℕ) (hK : 2 ≤ K) (a b c : Capacity) (full : ℝ) + (hfull : ∀ i, a i + b i + c i = full) : + (∑ tick ∈ Finset.range (K + 2), minCapacity (tickCapacity K a b c tick)) = + (K - 2 : ℕ) * full + minCapacity a + minCapacity (fun i => a i + b i) + + minCapacity (fun i => b i + c i) + minCapacity c := by + let f : ℕ → ℝ := fun tick => minCapacity (tickCapacity K a b c tick) + have hhead : ∑ tick ∈ Finset.range 2, f tick = + minCapacity a + minCapacity (fun i => a i + b i) := by + simp [f, Finset.sum_range_succ, tickCapacity_first K hK, + tickCapacity_second K hK] + have hinterior : (∑ tick ∈ Finset.range (K - 2), f (2 + tick)) = + (K - 2 : ℕ) * full := by + calc + _ = ∑ _tick ∈ Finset.range (K - 2), full := by + apply Finset.sum_congr rfl + intro tick htick + have hlt := Finset.mem_range.mp htick + dsimp [f] + rw [tickCapacity_interior K (2 + tick) (by omega) (by omega)] + simp [minCapacity, hfull] + _ = _ := by simp + have htail : (∑ tick ∈ Finset.range 2, f (K + tick)) = + minCapacity (fun i => b i + c i) + minCapacity c := by + simp [f, Finset.sum_range_succ, tickCapacity_penultimate K hK, + tickCapacity_last K hK] + change (∑ tick ∈ Finset.range (K + 2), f tick) = _ + rw [Finset.sum_range_add f K 2, htail] + have hsplit : (∑ tick ∈ Finset.range K, f tick) = + (∑ tick ∈ Finset.range 2, f tick) + + ∑ tick ∈ Finset.range (K - 2), f (2 + tick) := by + have hKsum : 2 + (K - 2) = K := by omega + simpa only [hKsum] using Finset.sum_range_add f 2 (K - 2) + rw [hsplit, hhead, hinterior] + ring + +theorem finite_schedule_yield (K : ℕ) (hK : 2 ≤ K) (a b c : Capacity) (full : ℝ) + (hfull : ∀ i, a i + b i + c i = full) : + (∑ tick ∈ Finset.range (K + 2), minCapacity (tickCapacity K a b c tick)) = + (K : ℝ) * full - boundaryDeficit a b c full := by + rw [sum_tick_minima K hK a b c full hfull] + exact Staggering.finite_schedule_yield a b c full K hK + +theorem fixed_lot_boundary_limit {Y beta w S R : ℝ} + (hfixed : ∀ K : ℕ, 2 ≤ K → Y - beta / (K : ℝ) + w * S / 3 ≤ R) : + Y + w * S / 3 ≤ R := by + by_contra hnot + have hgap : 0 < Y + w * S / 3 - R := by linarith + obtain ⟨K, hK⟩ := exists_nat_gt (max (beta / (Y + w * S / 3 - R)) (2 : ℝ)) + have hKtwo : (2 : ℝ) < (K : ℝ) := lt_of_le_of_lt (le_max_right _ _) hK + have hKnat : 2 ≤ K := Nat.ofNat_le_cast.mp hKtwo.le + have hKpos : (0 : ℝ) < (K : ℝ) := by linarith + have hsmall : beta / (K : ℝ) < Y + w * S / 3 - R := by + apply (div_lt_iff₀ hKpos).2 + have hquot : beta / (Y + w * S / 3 - R) < (K : ℝ) := + lt_of_le_of_lt (le_max_left _ _) hK + simpa only [mul_comm] using (div_lt_iff₀ hgap).1 hquot + have hbound := hfixed K hKnat + linarith + +end MatrixMultiplication.FiniteSchedule + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +open scoped BigOperators + +noncomputable section + +namespace MatrixMultiplication.PhysicalOrders + +open Staggering + +abbrev PhysicalOrder := Equiv.Perm (Fin 3) + +theorem card_physical_orders : Fintype.card PhysicalOrder = 6 := by + norm_num [PhysicalOrder, Fintype.card_perm, Nat.factorial_succ] + +def placementAmount (amount : ℝ) (_phi : PhysicalOrder) : ℝ := amount / 6 + +theorem placementAmount_eq (amount : ℝ) (phi psi : PhysicalOrder) : + placementAmount amount phi = placementAmount amount psi := rfl + +theorem sum_placementAmount (amount : ℝ) : + ∑ phi : PhysicalOrder, placementAmount amount phi = amount := by + simp only [placementAmount, Finset.sum_const, Finset.card_univ, + card_physical_orders, nsmul_eq_mul] + norm_num + ring + +theorem placement_has_unique_order (rho phi : PhysicalOrder) : + ∃! sigma : PhysicalOrder, rho.trans phi = sigma := by + refine ⟨rho.trans phi, rfl, ?_⟩ + intro sigma hsigma + exact hsigma.symm + +theorem sum_selected_placement (rho sigma : PhysicalOrder) (value : ℝ) : + (∑ phi : PhysicalOrder, if rho.trans phi = sigma then value else 0) = value := by + classical + obtain ⟨phi, hphi, hunique⟩ := physical_order_unique rho sigma + calc + _ = ∑ psi : PhysicalOrder, if psi = phi then value else 0 := by + apply Finset.sum_congr rfl + intro psi _ + have hiff : rho.trans psi = sigma ↔ psi = phi := by + constructor + · exact hunique psi + · rintro rfl + exact hphi + simp only [hiff] + _ = value := by simp + +variable {History : Type*} [Fintype History] + +def aggregateCapacity (amount : History → ℝ) (capacity : History → Capacity) : Capacity := + fun i => ∑ h, amount h * capacity h i + +def perPhysicalOrderCapacity (amount : History → ℝ) (capacity : History → Capacity) + (priority : History → PhysicalOrder) (sigma : PhysicalOrder) : Capacity := by + classical + exact fun i => ∑ h, ∑ phi : PhysicalOrder, + if (priority h).trans phi = sigma then amount h / 6 * capacity h i else 0 + +theorem perPhysicalOrderCapacity_apply (amount : History → ℝ) + (capacity : History → Capacity) (priority : History → PhysicalOrder) + (sigma : PhysicalOrder) (i : Fin 3) : + perPhysicalOrderCapacity amount capacity priority sigma i = + (1 / 6 : ℝ) * aggregateCapacity amount capacity i := by + classical + unfold perPhysicalOrderCapacity aggregateCapacity + simp only [sum_selected_placement] + rw [Finset.mul_sum] + apply Finset.sum_congr rfl + intro h _ + ring + +theorem perPhysicalOrderCapacity_eq (amount : History → ℝ) + (capacity : History → Capacity) (priority : History → PhysicalOrder) + (sigma : PhysicalOrder) : + perPhysicalOrderCapacity amount capacity priority sigma = + fun i => (1 / 6 : ℝ) * aggregateCapacity amount capacity i := by + funext i + exact perPhysicalOrderCapacity_apply amount capacity priority sigma i + +theorem minCapacity_mul (a : Capacity) (r : ℝ) (hr : 0 ≤ r) : + minCapacity (fun i => r * a i) = r * minCapacity a := by + unfold minCapacity + rw [mul_min_of_nonneg _ _ hr, mul_min_of_nonneg _ _ hr] + +theorem sum_physical_order_minima (amount : History → ℝ) + (capacity : History → Capacity) (priority : History → PhysicalOrder) : + (∑ sigma : PhysicalOrder, + minCapacity (perPhysicalOrderCapacity amount capacity priority sigma)) = + minCapacity (aggregateCapacity amount capacity) := by + simp_rw [perPhysicalOrderCapacity_eq, + minCapacity_mul _ (1 / 6 : ℝ) (by norm_num)] + simp only [Finset.sum_const, Finset.card_univ, card_physical_orders, nsmul_eq_mul] + norm_num + ring + +end MatrixMultiplication.PhysicalOrders + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section + +namespace MatrixMultiplication.AllFieldHistory + +open AllFieldParameters +open scoped BigOperators +attribute [local instance] Classical.propDecidable Classical.decEq + +structure Allocation where + mass : Fin 3 → ℚ + positive : ∀ i, 0 < mass i + total : ∑ i, mass i = 1 + +abbrev Placement := PhysicalOrders.PhysicalOrder +abbrev Initial (K : ℕ) := Fin K × Fin sortedInitial.length + +def initialShape {K : ℕ} (h : Initial K) : Shape := sortedInitial.get h.2 + +theorem initialShape_mem {K : ℕ} (h : Initial K) : initialShape h ∈ sortedInitial := + List.get_mem _ _ + +abbrev InitialPositive (K : ℕ) := {h : Initial K // initialShape h ∈ positiveInitial} + +abbrev ASplit {K : ℕ} (h : InitialPositive K) := Fin (below (initialShape h.val)).length +abbrev AfterA (K : ℕ) := Σ h : InitialPositive K, ASplit h × Bool + +def aSplit {K : ℕ} (h : AfterA K) : Shape := + (below (initialShape h.1.val)).get h.2.1 + +def halfShape (parent left : Shape) (right : Bool) : Shape := + if right then complement parent left else left + +def aShape {K : ℕ} (h : AfterA K) : Shape := + halfShape (initialShape h.1.val) (aSplit h) h.2.2 + +theorem aSplit_mem {K : ℕ} (h : AfterA K) : aSplit h ∈ below (initialShape h.1.val) := + List.get_mem _ _ + +theorem aShape_mem {K : ℕ} (h : AfterA K) : aShape h ∈ below (initialShape h.1.val) := by + have hc := (stageA_support_complement _ h.1.property _ (aSplit_mem h)).1 + cases hh : h.2.2 <;> simp [aShape, halfShape, hh, aSplit_mem h, hc] + +theorem stageA_children_size : ∀ g ∈ positiveInitial, ∀ t ∈ below g, t ∈ shapes 8 := by + decide +kernel + +theorem aShape_size {K : ℕ} (h : AfterA K) : aShape h ∈ shapes 8 := + stageA_children_size _ h.1.property _ (aShape_mem h) + +abbrev APositive (K : ℕ) := {h : AfterA K // aShape h ∈ positiveSecond} +abbrev BSplit {K : ℕ} (h : APositive K) := Fin (below (aShape h.val)).length +abbrev AfterB (K : ℕ) := Σ h : APositive K, BSplit h × Bool + +def bSplit {K : ℕ} (h : AfterB K) : Shape := + (below (aShape h.1.val)).get h.2.1 + +def bShape {K : ℕ} (h : AfterB K) : Shape := + halfShape (aShape h.1.val) (bSplit h) h.2.2 + +theorem bSplit_mem {K : ℕ} (h : AfterB K) : bSplit h ∈ below (aShape h.1.val) := + List.get_mem _ _ + +theorem bShape_mem {K : ℕ} (h : AfterB K) : bShape h ∈ below (aShape h.1.val) := by + have hc := (stageB_support_complement _ h.1.property _ (bSplit_mem h)).1 + cases hh : h.2.2 <;> simp [bShape, halfShape, hh, bSplit_mem h, hc] + +theorem stageB_children_size : ∀ t ∈ positiveSecond, ∀ u ∈ below t, u ∈ shapes 4 := by + decide +kernel + +theorem bShape_size {K : ℕ} (h : AfterB K) : bShape h ∈ shapes 4 := + stageB_children_size _ h.1.property _ (bShape_mem h) + +abbrev BPositive (K : ℕ) := {h : AfterB K // positive (bShape h) = true} +abbrev PartC (K : ℕ) := BPositive K × Fin 3 +abbrev AfterC (K : ℕ) := PartC K × Fin 4 × Bool + +def cParameterParent {K : ℕ} (h : PartC K) : Shape := aShape h.1.val.1.val +def cShapeParent {K : ℕ} (h : PartC K) : Shape := bShape h.1.val + +def cSplit {K : ℕ} (h : AfterC K) : Shape := stageCAtom (cShapeParent h.1) h.2.1 + +def cShape {K : ℕ} (h : AfterC K) : Shape := + halfShape (cShapeParent h.1) (cSplit h) h.2.2 + +theorem cShape_zero {K : ℕ} (h : AfterC K) : ∃ i, cShape h i = 0 := by + have hg := stageC_children_geometry (cShapeParent h.1) + (bShape_size h.1.1.val) h.1.1.property (cSplit h) + (stageCAtom_mem _ (bShape_size h.1.1.val) h.1.1.property h.2.1) + cases hh : h.2.2 with + | false => simpa [cShape, halfShape, hh] using hg.2.2.1 + | true => simpa [cShape, halfShape, hh] using hg.2.2.2 + +instance initialPositiveFintype (K : ℕ) : Fintype (InitialPositive K) := + Fintype.ofFinite _ + +instance aPositiveFintype (K : ℕ) : Fintype (APositive K) := + Fintype.ofFinite _ + +instance bPositiveFintype (K : ℕ) : Fintype (BPositive K) := + Fintype.ofFinite _ + +inductive CanonicalHistory (K : ℕ) where + | initial (h : Initial K) + | afterA (h : AfterA K) + | afterB (h : AfterB K) + | partC (h : PartC K) + | afterC (h : AfterC K) + deriving Fintype + +abbrev History (K : ℕ) := CanonicalHistory K × Placement + +def initialAmount {K : ℕ} (h : Initial K) : ℚ := initialLaw (initialShape h) +def aAmount {K : ℕ} (h : AfterA K) : ℚ := + initialAmount h.1.val * stageALaw (initialShape h.1.val) (aSplit h) +def bAmount {K : ℕ} (h : AfterB K) : ℚ := + aAmount h.1.val * stageBLaw (aShape h.1.val) (bSplit h) +def partAmount {K : ℕ} (allocation : Allocation) (h : PartC K) : ℚ := + bAmount h.1.val * allocation.mass h.2 +def cAmount {K : ℕ} (allocation : Allocation) (h : AfterC K) : ℚ := + partAmount allocation h.1 * stageCWeight (cParameterParent h.1) (cShapeParent h.1) h.2.1 + +def canonicalAmount {K : ℕ} (allocation : Allocation) : CanonicalHistory K → ℚ + | .initial h => initialAmount h + | .afterA h => aAmount h + | .afterB h => bAmount h + | .partC h => partAmount allocation h + | .afterC h => cAmount allocation h + +def amount {K : ℕ} (allocation : Allocation) (h : History K) : ℚ := + canonicalAmount allocation h.1 / 6 + +theorem initialAmount_pos {K : ℕ} (h : Initial K) : 0 < initialAmount h := + initialLaw_positive _ (initialShape_mem h) + +theorem aAmount_pos {K : ℕ} (h : AfterA K) : 0 < aAmount h := + mul_pos (initialAmount_pos _) (stageALaw_positive _ _ (aSplit_mem h)) + +theorem bAmount_pos {K : ℕ} (h : AfterB K) : 0 < bAmount h := + mul_pos (aAmount_pos _) (stageBLaw_positive _ _ (bSplit_mem h)) + +theorem partAmount_pos {K : ℕ} (allocation : Allocation) (h : PartC K) : + 0 < partAmount allocation h := mul_pos (bAmount_pos _) (allocation.positive _) + +theorem cAmount_nonneg {K : ℕ} (allocation : Allocation) (h : AfterC K) : + 0 ≤ cAmount allocation h := + mul_nonneg (partAmount_pos allocation _).le (stageCWeight_nonnegative _ _ _) + +theorem amount_nonneg {K : ℕ} (allocation : Allocation) (h : History K) : + 0 ≤ amount allocation h := by + apply div_nonneg _ (by norm_num) + cases h.1 with + | initial h => exact (initialAmount_pos h).le + | afterA h => exact (aAmount_pos h).le + | afterB h => exact (bAmount_pos h).le + | partC h => exact (partAmount_pos allocation h).le + | afterC h => exact cAmount_nonneg allocation h + +theorem placement_amount_eq {K : ℕ} (allocation : Allocation) + (h : CanonicalHistory K) (phi psi : Placement) : + amount allocation (h, phi) = amount allocation (h, psi) := rfl + +theorem sum_placement_amount {K : ℕ} (allocation : Allocation) (h : CanonicalHistory K) : + ∑ phi : Placement, amount allocation (h, phi) = canonicalAmount allocation h := by + simp only [amount, Finset.sum_const, Finset.card_univ, + PhysicalOrders.card_physical_orders, nsmul_eq_mul] + norm_num + ring + +theorem initial_amount_sum (K : ℕ) (j : Fin K) : + ∑ g : Fin sortedInitial.length, initialAmount (j, g) = 1 := by + change (∑ g : Fin sortedInitial.length, initialLaw sortedInitial[g.val]) = 1 + rw [Fin.sum_univ_fun_getElem] + exact initialLaw_normalized + +theorem root_mass_sum_lot {K : ℕ} (allocation : Allocation) (j : Fin K) : + (∑ g : Fin sortedInitial.length, ∑ phi : Placement, + amount allocation (.initial (j, g), phi)) = 1 := by + simp only [sum_placement_amount, canonicalAmount] + exact initial_amount_sum K j + +theorem a_transition {K : ℕ} (h : InitialPositive K) (right : Bool) : + ∑ k : ASplit h, aAmount ⟨h, k, right⟩ = initialAmount h.val := by + change (∑ k : ASplit h, initialAmount h.val * + stageALaw (initialShape h.val) (below (initialShape h.val))[k.val]) = _ + rw [← Finset.mul_sum, Fin.sum_univ_fun_getElem, + stageALaw_normalized _ h.property, mul_one] + +theorem b_transition {K : ℕ} (h : APositive K) (right : Bool) : + ∑ k : BSplit h, bAmount ⟨h, k, right⟩ = aAmount h.val := by + change (∑ k : BSplit h, aAmount h.val * + stageBLaw (aShape h.val) (below (aShape h.val))[k.val]) = _ + rw [← Finset.mul_sum, Fin.sum_univ_fun_getElem, + stageBLaw_normalized _ h.property, mul_one] + +theorem part_transition {K : ℕ} (allocation : Allocation) (h : BPositive K) : + ∑ i : Fin 3, partAmount allocation (h, i) = bAmount h.val := by + simp only [partAmount, ← Finset.mul_sum, allocation.total, mul_one] + +theorem c_transition {K : ℕ} (allocation : Allocation) (h : PartC K) (right : Bool) : + ∑ k : Fin 4, cAmount allocation (h, k, right) = partAmount allocation h := by + simp only [cAmount, ← Finset.mul_sum, stageCWeight_normalized, mul_one] + +def population {K : ℕ} (allocation : Allocation) (dilation : ℕ) : History K → ℕ := + AllFieldPopulationCounts.count (amount allocation) dilation + +def populationLength {K : ℕ} (allocation : Allocation) (dilation : ℕ) : ℕ := + AllFieldPopulationCounts.blockLength (amount (K := K) allocation) dilation + +theorem population_cast {K : ℕ} (allocation : Allocation) (dilation : ℕ) (h : History K) : + (population allocation dilation h : ℚ) = + (populationLength (K := K) allocation dilation : ℚ) * amount allocation h := + AllFieldPopulationCounts.count_cast_blockLength _ (amount_nonneg allocation) dilation h + +theorem population_zero_iff {K : ℕ} (allocation : Allocation) {dilation : ℕ} + (hd : 0 < dilation) (h : History K) : + population allocation dilation h = 0 ↔ amount allocation h = 0 := + AllFieldPopulationCounts.count_zero_iff _ (amount_nonneg allocation) hd h + +theorem initial_population_sum {K : ℕ} (allocation : Allocation) (dilation : ℕ) + (j : Fin K) : + (∑ g : Fin sortedInitial.length, ∑ phi : Placement, + population allocation dilation (.initial (j, g), phi)) = + populationLength (K := K) allocation dilation := by + apply Nat.cast_injective (R := ℚ) + simp only [Nat.cast_sum, population_cast, ← Finset.mul_sum, + root_mass_sum_lot allocation j, mul_one] + +theorem a_population_transition {K : ℕ} (allocation : Allocation) (dilation : ℕ) + (h : InitialPositive K) (right : Bool) (phi : Placement) : + (∑ k : ASplit h, population allocation dilation (.afterA ⟨h, k, right⟩, phi)) = + population allocation dilation (.initial h.val, phi) := by + apply Nat.cast_injective (R := ℚ) + simp only [Nat.cast_sum, population_cast, amount, canonicalAmount, + ← Finset.mul_sum, ← Finset.sum_div, a_transition] + +theorem b_population_transition {K : ℕ} (allocation : Allocation) (dilation : ℕ) + (h : APositive K) (right : Bool) (phi : Placement) : + (∑ k : BSplit h, population allocation dilation (.afterB ⟨h, k, right⟩, phi)) = + population allocation dilation (.afterA h.val, phi) := by + apply Nat.cast_injective (R := ℚ) + simp only [Nat.cast_sum, population_cast, amount, canonicalAmount, + ← Finset.mul_sum, ← Finset.sum_div, b_transition] + +theorem part_population_transition {K : ℕ} (allocation : Allocation) (dilation : ℕ) + (h : BPositive K) (phi : Placement) : + (∑ i : Fin 3, population allocation dilation (.partC (h, i), phi)) = + population allocation dilation (.afterB h.val, phi) := by + apply Nat.cast_injective (R := ℚ) + simp only [Nat.cast_sum, population_cast, amount, canonicalAmount, + ← Finset.mul_sum, ← Finset.sum_div, part_transition] + +theorem c_population_transition {K : ℕ} (allocation : Allocation) (dilation : ℕ) + (h : PartC K) (right : Bool) (phi : Placement) : + (∑ k : Fin 4, population allocation dilation (.afterC (h, k, right), phi)) = + population allocation dilation (.partC h, phi) := by + apply Nat.cast_injective (R := ℚ) + simp only [Nat.cast_sum, population_cast, amount, canonicalAmount, + ← Finset.mul_sum, ← Finset.sum_div, c_transition] + +theorem a_half_counts_eq {K : ℕ} (allocation : Allocation) (dilation : ℕ) + (h : InitialPositive K) (k : ASplit h) (phi : Placement) : + population allocation dilation (.afterA ⟨h, k, false⟩, phi) = + population allocation dilation (.afterA ⟨h, k, true⟩, phi) := + AllFieldPopulationCounts.count_eq_of_mass_eq _ (amount_nonneg allocation) dilation rfl + +theorem b_half_counts_eq {K : ℕ} (allocation : Allocation) (dilation : ℕ) + (h : APositive K) (k : BSplit h) (phi : Placement) : + population allocation dilation (.afterB ⟨h, k, false⟩, phi) = + population allocation dilation (.afterB ⟨h, k, true⟩, phi) := + AllFieldPopulationCounts.count_eq_of_mass_eq _ (amount_nonneg allocation) dilation rfl + +theorem c_half_counts_eq {K : ℕ} (allocation : Allocation) (dilation : ℕ) + (h : PartC K) (k : Fin 4) (phi : Placement) : + population allocation dilation (.afterC (h, k, false), phi) = + population allocation dilation (.afterC (h, k, true), phi) := + AllFieldPopulationCounts.count_eq_of_mass_eq _ (amount_nonneg allocation) dilation rfl + +end MatrixMultiplication.AllFieldHistory + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section + +namespace MatrixMultiplication.AllFieldHistory + +open AllFieldParameters +open scoped BigOperators +attribute [local instance] Classical.propDecidable Classical.decEq + +def initialAncestor {K : ℕ} : CanonicalHistory K → Initial K + | .initial h => h + | .afterA h => h.1.val + | .afterB h => h.1.val.1.val + | .partC h => h.1.val.1.val.1.val + | .afterC h => h.1.1.val.1.val.1.val + +def ancestrySplits {K : ℕ} : CanonicalHistory K → List (Shape × Bool) + | .initial _ => [] + | .afterA h => [(aSplit h, h.2.2)] + | .afterB h => [(aSplit h.1.val, h.1.val.2.2), (bSplit h, h.2.2)] + | .partC h => [(aSplit h.1.val.1.val, h.1.val.1.val.2.2), + (bSplit h.1.val, h.1.val.2.2)] + | .afterC h => [(aSplit h.1.1.val.1.val, h.1.1.val.1.val.2.2), + (bSplit h.1.1.val, h.1.1.val.2.2), (cSplit h, h.2.2)] + +def ancestrySubdivisions {K : ℕ} : CanonicalHistory K → List ℕ + | .initial _ | .afterA _ | .afterB _ => [] + | .partC h => [h.2.val] + | .afterC h => [h.1.2.val] + +def historyKey {K : ℕ} (h : History K) : JointPopulation.HistoryKey where + lot := (initialAncestor h.1).1.val + initialShape := initialShape (initialAncestor h.1) + physicalPlacement := h.2 + parentSplits := ancestrySplits h.1 + subdivisions := ancestrySubdivisions h.1 + +theorem placement_preserved {K : ℕ} (h : CanonicalHistory K) (phi psi : Placement) + (heq : historyKey (h, phi) = historyKey (h, psi)) : phi = psi := + congrArg JointPopulation.HistoryKey.physicalPlacement heq + +inductive Work (K : ℕ) where + | stageA (h : InitialPositive K) + | stageB (h : APositive K) + | stageC (h : PartC K) + deriving Fintype + +def Work.source {K : ℕ} : Work K → CanonicalHistory K + | .stageA h => .initial h.val + | .stageB h => .afterA h.val + | .stageC h => .partC h + +def Work.stage {K : ℕ} : Work K → Fin 3 + | .stageA _ => 0 + | .stageB _ => 1 + | .stageC _ => 2 + +def Work.lot {K : ℕ} (w : Work K) : Fin K := (initialAncestor w.source).1 + +def Work.halfLength {K : ℕ} : Work K → ℕ + | .stageA _ => 4 + | .stageB _ => 2 + | .stageC _ => 1 + +def Work.parentShape {K : ℕ} : Work K → Shape + | .stageA h => initialShape h.val + | .stageB h => aShape h.val + | .stageC h => cShapeParent h + +def Work.Branch {K : ℕ} : Work K → Type + | .stageA h => ASplit h + | .stageB h => BSplit h + | .stageC _ => Fin 4 + +instance {K : ℕ} (w : Work K) : Fintype w.Branch := by + cases w <;> dsimp [Work.Branch] <;> infer_instance + +def Work.child {K : ℕ} (w : Work K) (b : w.Branch) (right : Bool) : CanonicalHistory K := + match w with + | .stageA h => .afterA ⟨h, b, right⟩ + | .stageB h => .afterB ⟨h, b, right⟩ + | .stageC h => .afterC (h, b, right) + +def Work.splitShape {K : ℕ} (w : Work K) (b : w.Branch) : Shape := + match w with + | .stageA h => aSplit ⟨h, b, false⟩ + | .stageB h => bSplit ⟨h, b, false⟩ + | .stageC h => cSplit (h, b, false) + +abbrev PlacedWork (K : ℕ) := Work K × Placement +abbrev Active (K tick : ℕ) := {w : PlacedWork K // + FiniteSchedule.lotTick w.1.lot w.1.stage = tick} + +theorem active_tick_lt {K tick : ℕ} (h : Active K tick) : tick < K + 2 := by + rw [← h.property] + exact FiniteSchedule.lotTick_lt h.val.1.lot h.val.1.stage + +def branchPopulation {K : ℕ} (allocation : Allocation) (dilation : ℕ) + (w : PlacedWork K) (b : w.1.Branch) : ℕ := + population allocation dilation (w.1.child b false, w.2) + +theorem branchPopulation_half {K : ℕ} (allocation : Allocation) (dilation : ℕ) + (w : PlacedWork K) (b : w.1.Branch) (right : Bool) : + population allocation dilation (w.1.child b right, w.2) = + branchPopulation allocation dilation w b := by + rcases w with ⟨w, phi⟩ + cases right with + | false => rfl + | true => + cases w with + | stageA h => exact (a_half_counts_eq allocation dilation h b phi).symm + | stageB h => exact (b_half_counts_eq allocation dilation h b phi).symm + | stageC h => exact (c_half_counts_eq allocation dilation h b phi).symm + +theorem branchPopulation_sum {K : ℕ} (allocation : Allocation) (dilation : ℕ) + (w : PlacedWork K) : + (∑ b : w.1.Branch, branchPopulation allocation dilation w b) = + population allocation dilation (w.1.source, w.2) := by + rcases w with ⟨w, phi⟩ + cases w with + | stageA h => exact a_population_transition allocation dilation h false phi + | stageB h => exact b_population_transition allocation dilation h false phi + | stageC h => exact c_population_transition allocation dilation h false phi + +def terminal {K : ℕ} : CanonicalHistory K → Prop + | .initial h => initialShape h ∉ positiveInitial + | .afterA h => aShape h ∉ positiveSecond + | .afterB h => positive (bShape h) ≠ true + | .partC _ => False + | .afterC _ => True + +def resident {K : ℕ} (tick : ℕ) : CanonicalHistory K → Prop + | .initial h => initialShape h ∈ positiveInitial → tick ≤ h.1.val + | .afterA h => h.1.val.1.val + 1 ≤ tick ∧ + (aShape h ∈ positiveSecond → tick ≤ h.1.val.1.val + 1) + | .afterB h => h.1.val.1.val.1.val + 2 ≤ tick ∧ positive (bShape h) ≠ true + | .partC h => tick = h.1.val.1.val.1.val.1.val + 2 + | .afterC h => h.1.1.val.1.val.1.val.1.val + 3 ≤ tick + +abbrev State (K tick : ℕ) := {h : History K // resident tick h.1} + +theorem terminal_carries {K tick : ℕ} (h : CanonicalHistory K) + (hr : resident tick h) (ht : terminal h) : resident (tick + 1) h := by + cases h with + | initial h => exact fun hp => False.elim (ht hp) + | afterA h => exact ⟨by have := hr.1; omega, fun hp => False.elim (ht hp)⟩ + | afterB h => exact ⟨by have := hr.1; omega, hr.2⟩ + | partC h => exact False.elim ht + | afterC h => dsimp [resident] at hr ⊢; omega + +theorem work_source_resident {K : ℕ} (w : Work K) : + resident (FiniteSchedule.lotTick w.lot w.stage) w.source := by + cases w with + | stageA h => simp [resident, Work.source, Work.lot, Work.stage, + initialAncestor, FiniteSchedule.lotTick] + | stageB h => simp [resident, Work.source, Work.lot, Work.stage, + initialAncestor, FiniteSchedule.lotTick] + | stageC h => simp [resident, Work.source, Work.lot, Work.stage, + initialAncestor, FiniteSchedule.lotTick] + +theorem a_child_resident {K : ℕ} (h : InitialPositive K) (b : ASplit h) (right : Bool) : + resident (h.val.1.val + 1) (.afterA ⟨h, b, right⟩) := by + simp [resident] + +theorem c_child_resident {K : ℕ} (h : PartC K) (b : Fin 4) (right : Bool) : + resident ((Work.stageC h).lot.val + 3) (.afterC (h, b, right)) := by + simp [resident, Work.lot, Work.source, initialAncestor] + +end MatrixMultiplication.AllFieldHistory + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.AllFieldHistory + +open AllFieldParameters +open scoped BigOperators +attribute [local instance] Classical.propDecidable Classical.decEq + +def shapeCounts {I : Type*} [Fintype I] (code : I → JointPopulation.Shape) + (weight : I → ℕ) (u : JointPopulation.Shape) : ℕ := + ∑ i, if code i = u then weight i else 0 + +theorem shapeCounts_sum {I : Type*} [Fintype I] (code : I → JointPopulation.Shape) + (weight : I → ℕ) : ∑ u, shapeCounts code weight u = ∑ i, weight i := by + unfold shapeCounts + rw [Finset.sum_comm] + simp + +theorem shapeCounts_positive {I : Type*} [Fintype I] (code : I → JointPopulation.Shape) + (weight : I → ℕ) (u : JointPopulation.Shape) (hu : 0 < shapeCounts code weight u) : + ∃ i, code i = u ∧ 0 < weight i := by + by_contra hn + have hz : shapeCounts code weight u = 0 := by + apply Finset.sum_eq_zero + intro i hi + split_ifs with heq + · by_contra hne + exact hn ⟨i, heq, Nat.pos_of_ne_zero hne⟩ + · rfl + omega + +theorem shapeCounts_at {I : Type*} [Fintype I] (code : I → JointPopulation.Shape) + (weight : I → ℕ) (hi : Function.Injective code) (i : I) : + shapeCounts code weight (code i) = weight i := by + unfold shapeCounts + simp only [hi.eq_iff] + simp + +theorem Work.parentShape_spec {K : ℕ} (w : Work K) : + ShapeBounded w.parentShape ∧ shapeTotal w.parentShape = 4 * w.halfLength := by + cases w with + | stageA h => exact positiveInitial_shape_spec _ h.property + | stageB h => exact positiveSecond_shape_spec _ h.property + | stageC h => + exact ⟨mem_shapes_bounded (bShape_size h.1.val) (by omega), + mem_shapes_total (bShape_size h.1.val)⟩ + +theorem Work.splitShape_spec {K : ℕ} (w : Work K) (b : w.Branch) : + ShapeBounded (w.splitShape b) ∧ shapeTotal (w.splitShape b) = 2 * w.halfLength := by + cases w with + | stageA h => exact stageA_shape_spec _ _ h.property (aSplit_mem ⟨h, b, false⟩) + | stageB h => exact stageB_shape_spec _ _ h.property (bSplit_mem ⟨h, b, false⟩) + | stageC h => exact stageC_shape_spec _ (bShape_size h.1.val) h.1.property b + +theorem Work.splitShape_le {K : ℕ} (w : Work K) (b : w.Branch) : + ∀ i, w.splitShape b i ≤ w.parentShape i := by + cases w with + | stageA h => exact below_le (aSplit_mem ⟨h, b, false⟩) + | stageB h => exact below_le (bSplit_mem ⟨h, b, false⟩) + | stageC h => exact below_le (stageCAtom_mem _ (bShape_size h.1.val) h.1.property b) + +theorem Work.splitShape_injective {K : ℕ} (w : Work K) : + Function.Injective w.splitShape := by + cases w with + | stageA h => exact stageA_get_injective _ h.property + | stageB h => exact stageB_get_injective _ h.property + | stageC h => exact stageCAtom_injective _ (bShape_size h.1.val) h.1.property + +def branchShape {K : ℕ} (w : PlacedWork K) (b : w.1.Branch) : JointPopulation.Shape := + encodePhysicalShape w.2 (w.1.splitShape b) (w.1.splitShape_spec b).1 + +theorem branchShape_injective {K : ℕ} (w : PlacedWork K) : + Function.Injective (branchShape w) := by + intro a b hab + exact w.1.splitShape_injective (encodePhysicalShape_inj w.2 hab) + +def jointCounts {K : ℕ} (allocation : Allocation) (dilation : ℕ) + (w : PlacedWork K) : JointPopulation.Shape → ℕ := + shapeCounts (branchShape w) (branchPopulation allocation dilation w) + +def activeCounts {K tick : ℕ} (allocation : Allocation) (dilation : ℕ) + (h : Active K tick) : JointPopulation.Shape → ℕ := jointCounts allocation dilation h.val + +def activeParentShape {K tick : ℕ} (h : Active K tick) : Shape := + physicalShape h.val.2 h.val.1.parentShape + +def activeHalfLength {K tick : ℕ} (h : Active K tick) : ℕ := h.val.1.halfLength + +theorem jointCounts_sum {K : ℕ} (allocation : Allocation) (dilation : ℕ) + (w : PlacedWork K) : ∑ u, jointCounts allocation dilation w u = + population allocation dilation (w.1.source, w.2) := by + rw [jointCounts, shapeCounts_sum, branchPopulation_sum] + +theorem jointCounts_at {K : ℕ} (allocation : Allocation) (dilation : ℕ) + (w : PlacedWork K) (b : w.1.Branch) : + jointCounts allocation dilation w (branchShape w b) = + branchPopulation allocation dilation w b := + shapeCounts_at _ _ (branchShape_injective w) b + +theorem jointCounts_support_sum {K : ℕ} (allocation : Allocation) (dilation : ℕ) + (w : PlacedWork K) (u : JointPopulation.Shape) + (hu : 0 < jointCounts allocation dilation w u) : + u.1.val + u.2.1.val + u.2.2.val = 2 * w.1.halfLength := by + obtain ⟨b, rfl, _⟩ := shapeCounts_positive _ _ u hu + exact (encodePhysicalShape_total _ _ _).trans (w.1.splitShape_spec b).2 + +theorem jointCounts_support_le {K : ℕ} (allocation : Allocation) (dilation : ℕ) + (w : PlacedWork K) (u : JointPopulation.Shape) + (hu : 0 < jointCounts allocation dilation w u) (s : Fin 3) : + (JointPopulation.shapeSide s u).val ≤ physicalShape w.2 w.1.parentShape s := by + obtain ⟨b, rfl, _⟩ := shapeCounts_positive _ _ u hu + rw [branchShape, encodePhysicalShape_side] + exact w.1.splitShape_le b (w.2.symm s) + +def shapePositionMap {K : ℕ} (allocation : Allocation) (dilation : ℕ) + (w : PlacedWork K) : + (Σ b : w.1.Branch, Fin (branchPopulation allocation dilation w b)) → + (Σ u : JointPopulation.Shape, Fin (jointCounts allocation dilation w u)) := + fun p => ⟨branchShape w p.1, + ⟨p.2.val, by rw [jointCounts_at]; exact p.2.isLt⟩⟩ + +theorem shapePositionMap_injective {K : ℕ} (allocation : Allocation) (dilation : ℕ) + (w : PlacedWork K) : Function.Injective (shapePositionMap allocation dilation w) := by + rintro ⟨b, i⟩ ⟨c, j⟩ heq + have hbc : b = c := branchShape_injective w (congrArg Sigma.fst heq) + subst c + have hij : i.val = j.val := congrArg (fun p => p.2.val) heq + have : i = j := Fin.ext hij + subst j + rfl + +theorem shapePositionMap_surjective {K : ℕ} (allocation : Allocation) (dilation : ℕ) + (w : PlacedWork K) : Function.Surjective (shapePositionMap allocation dilation w) := by + rintro ⟨u, i⟩ + obtain ⟨b, heq, hb⟩ := shapeCounts_positive _ _ u (Nat.zero_lt_of_lt i.isLt) + subst u + refine ⟨⟨b, ⟨i.val, ?_⟩⟩, ?_⟩ + · simpa only [jointCounts_at] using i.isLt + · rfl + +def branchPositionEquiv {K : ℕ} (allocation : Allocation) (dilation : ℕ) + (w : PlacedWork K) : + (Σ u : JointPopulation.Shape, Fin (jointCounts allocation dilation w u)) ≃ + (Σ b : w.1.Branch, Fin (branchPopulation allocation dilation w b)) := + (Equiv.ofBijective (shapePositionMap allocation dilation w) + ⟨shapePositionMap_injective allocation dilation w, + shapePositionMap_surjective allocation dilation w⟩).symm + +@[simp] theorem branchPositionEquiv_shape {K : ℕ} (allocation : Allocation) (dilation : ℕ) + (w : PlacedWork K) + (p : Σ u : JointPopulation.Shape, Fin (jointCounts allocation dilation w u)) : + branchShape w (branchPositionEquiv allocation dilation w p).1 = p.1 := by + exact congrArg Sigma.fst ((branchPositionEquiv allocation dilation w).symm_apply_apply p) + +def rootShape {K : ℕ} (h : Initial K) (phi : Placement) : JointPopulation.Shape := + encodePhysicalShape phi (initialShape h) (root_shape_spec _ (initialShape_mem h)).1 + +def initialJointCounts {K : ℕ} (allocation : Allocation) (dilation : ℕ) + (j : Fin K) : JointPopulation.Shape → ℕ := + shapeCounts (fun p : Fin sortedInitial.length × Placement => rootShape (j, p.1) p.2) + (fun p => population allocation dilation (.initial (j, p.1), p.2)) + +theorem initialJointCounts_sum {K : ℕ} (allocation : Allocation) (dilation : ℕ) + (j : Fin K) : ∑ u, initialJointCounts allocation dilation j u = + populationLength (K := K) allocation dilation := by + rw [initialJointCounts, shapeCounts_sum, Fintype.sum_prod_type] + exact initial_population_sum allocation dilation j + +theorem initialJointCounts_support {K : ℕ} (allocation : Allocation) (dilation : ℕ) + (j : Fin K) (u : JointPopulation.Shape) + (hu : 0 < initialJointCounts allocation dilation j u) : + u.1.val + u.2.1.val + u.2.2.val = 16 := by + obtain ⟨p, rfl, _⟩ := shapeCounts_positive _ _ u hu + exact (encodePhysicalShape_total _ _ _).trans (root_shape_spec _ (initialShape_mem _)).2 + +end MatrixMultiplication.AllFieldHistory + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +open scoped BigOperators + +noncomputable section + +namespace MatrixMultiplication.AllFieldHistory + +open AllFieldParameters + +def priorityPermutation (k : Fin 6) : Placement := + (Matrix.vecCons (Equiv.refl (Fin 3)) (Matrix.vecCons (Equiv.swap 1 2) (Matrix.vecCons (Equiv.swap 0 1) (Matrix.vecCons ((Equiv.swap 0 1).trans (Equiv.swap 0 2)) (Matrix.vecCons ((Equiv.swap 0 2).trans (Equiv.swap 0 1)) (Matrix.vecCons (Equiv.swap 0 2) Matrix.vecEmpty)))))) k + +def PriorityLexLE (rho sigma : Placement) : Prop := + rho 0 < sigma 0 ∨ rho 0 = sigma 0 ∧ + (rho 1 < sigma 1 ∨ rho 1 = sigma 1 ∧ rho 2 ≤ sigma 2) + +instance (rho sigma : Placement) : Decidable (PriorityLexLE rho sigma) := + inferInstanceAs (Decidable (rho 0 < sigma 0 ∨ rho 0 = sigma 0 ∧ + (rho 1 < sigma 1 ∨ rho 1 = sigma 1 ∧ rho 2 ≤ sigma 2))) + +theorem priorityPermutation_surjective : Function.Surjective priorityPermutation := by + decide +kernel + +theorem priorityPermutation_order : ∀ j k : Fin 6, + PriorityLexLE (priorityPermutation j) (priorityPermutation k) ↔ j ≤ k := by + decide +kernel + +def stageBRepresentatives : List Shape := + [shape 1 1 6, shape 1 2 5, shape 1 3 4, shape 2 2 4, shape 3 2 3] + +def readInPriority (t : Shape) (rho : Placement) : Shape := fun i => t (rho i) + +def stageBPriorityIndex (t : Shape) : Fin 6 := + ((List.finRange 6).find? fun k => + stageBRepresentatives.contains (readInPriority t (priorityPermutation k))).getD 0 + +def stageBPriority (t : Shape) : Placement := priorityPermutation (stageBPriorityIndex t) + +theorem stageBPriority_finite_spec : ∀ t ∈ positiveSecond, + stageBRepresentatives.contains (readInPriority t (stageBPriority t)) = true ∧ + ∀ k : Fin 6, + stageBRepresentatives.contains (readInPriority t (priorityPermutation k)) = true → + PriorityLexLE (stageBPriority t) (priorityPermutation k) := by + decide +kernel + +theorem stageBPriority_reads_representative (t : Shape) (ht : t ∈ positiveSecond) : + readInPriority t (stageBPriority t) ∈ stageBRepresentatives := by + simpa using (stageBPriority_finite_spec t ht).1 + +theorem stageBPriority_lex_first (t : Shape) (ht : t ∈ positiveSecond) + (rho : Placement) (hrho : readInPriority t rho ∈ stageBRepresentatives) : + PriorityLexLE (stageBPriority t) rho := by + obtain ⟨k, rfl⟩ := priorityPermutation_surjective rho + exact (stageBPriority_finite_spec t ht).2 k (by simpa using hrho) + +theorem stageBPriority_233 : + stageBPriority (shape 2 3 3) 0 = 1 ∧ + stageBPriority (shape 2 3 3) 1 = 0 ∧ + stageBPriority (shape 2 3 3) 2 = 2 := by + decide +kernel + +def cPriorityIndex : Fin 3 → Fin 3 → Fin 6 := + (Matrix.vecCons ((Matrix.vecCons (0) (Matrix.vecCons (2) (Matrix.vecCons (3) Matrix.vecEmpty)))) (Matrix.vecCons ((Matrix.vecCons (2) (Matrix.vecCons (0) (Matrix.vecCons (1) Matrix.vecEmpty)))) (Matrix.vecCons ((Matrix.vecCons (4) (Matrix.vecCons (1) (Matrix.vecCons (0) Matrix.vecEmpty)))) Matrix.vecEmpty))) + +def stageCPriorityLabel (distinguished part : Fin 3) : Placement := + priorityPermutation (cPriorityIndex distinguished part) + +theorem stageCPriorityLabel_at_part : ∀ distinguished part : Fin 3, + stageCPriorityLabel distinguished part part = distinguished := by + decide +kernel + +theorem stageCPriorityLabel_remaining_order : ∀ distinguished part j k : Fin 3, + j ≠ part → k ≠ part → j < k → + stageCPriorityLabel distinguished part j < stageCPriorityLabel distinguished part k := by + decide +kernel + +def cPriority {K : ℕ} (h : PartC K) : Placement := + stageCPriorityLabel (stageCDistinguished (cShapeParent h)) h.2 + +theorem cPriority_at_part {K : ℕ} (h : PartC K) : + cPriority h h.2 = stageCDistinguished (cShapeParent h) := + stageCPriorityLabel_at_part _ _ + +theorem cPriority_at_part_two {K : ℕ} (h : PartC K) : + cShapeParent h (cPriority h h.2) = 2 := by + rw [cPriority_at_part] + exact (stageCDistinguished_spec (cShapeParent h) + (bShape_size h.1.val) h.1.property).1 + +theorem cPriority_remaining_order {K : ℕ} (h : PartC K) + (j k : Fin 3) (hj : j ≠ h.2) (hk : k ≠ h.2) (hjk : j < k) : + cPriority h j < cPriority h k := + stageCPriorityLabel_remaining_order _ _ _ _ hj hk hjk + +def Work.priority {K : ℕ} : Work K → Placement + | .stageA _ => Equiv.refl (Fin 3) + | .stageB h => stageBPriority (aShape h.val) + | .stageC h => cPriority h + +@[simp] theorem Work.priority_stageA {K : ℕ} (h : InitialPositive K) : + (Work.stageA h).priority = Equiv.refl (Fin 3) := rfl + +theorem Work.priority_stageB {K : ℕ} (h : APositive K) : + readInPriority (Work.stageB h).parentShape (Work.stageB h).priority ∈ + stageBRepresentatives := stageBPriority_reads_representative _ h.property + +theorem Work.priority_stageC {K : ℕ} (h : PartC K) : + (Work.stageC h).priority h.2 = stageCDistinguished (cShapeParent h) := + cPriority_at_part h + +def PlacedWork.physicalOrder {K : ℕ} (w : PlacedWork K) : Placement := + w.1.priority.trans w.2 + +theorem work_placement_for_order_unique {K : ℕ} (w : Work K) (sigma : Placement) : + ∃! phi : Placement, PlacedWork.physicalOrder (w, phi) = sigma := + Staggering.physical_order_unique w.priority sigma + +abbrev CanonicalActive (K tick : ℕ) := + {w : Work K // FiniteSchedule.lotTick w.lot w.stage = tick} + +abbrev ActiveOrder (K tick : ℕ) (sigma : Placement) := + {w : Active K tick // w.val.physicalOrder = sigma} + +def canonicalActiveEquivOrder (K tick : ℕ) (sigma : Placement) : + CanonicalActive K tick ≃ ActiveOrder K tick sigma where + toFun w := ⟨⟨(w.val, w.val.priority.symm.trans sigma), w.property⟩, by + change w.val.priority.trans (w.val.priority.symm.trans sigma) = sigma + ext i + simp⟩ + invFun w := ⟨w.val.val.1, w.val.property⟩ + left_inv _ := rfl + right_inv w := by + apply Subtype.ext + apply Subtype.ext + apply Prod.ext + · rfl + · have hw : w.val.val.1.priority.trans w.val.val.2 = sigma := w.property + apply Equiv.ext + intro i + have hh := Equiv.congr_fun hw (w.val.val.1.priority.symm i) + simpa using hh.symm + +def workAmount {K : ℕ} (allocation : Allocation) (w : Work K) : ℝ := + canonicalAmount allocation w.source + +def activeAggregateCapacity {K : ℕ} (allocation : Allocation) (tick : ℕ) + (capacity : Work K → Staggering.Capacity) : Staggering.Capacity := + PhysicalOrders.aggregateCapacity (fun w : CanonicalActive K tick => workAmount allocation w.val) + (fun w => capacity w.val) + +def physicalTickCapacity {K : ℕ} (allocation : Allocation) (tick : ℕ) + (capacity : Work K → Staggering.Capacity) (sigma : Placement) : Staggering.Capacity := + fun i => ∑ w : CanonicalActive K tick, ∑ phi : Placement, + if PlacedWork.physicalOrder (w.val, phi) = sigma then + (amount allocation (w.val.source, phi) : ℝ) * capacity w.val i else 0 + +theorem physicalTickCapacity_eq_partition {K : ℕ} (allocation : Allocation) (tick : ℕ) + (capacity : Work K → Staggering.Capacity) (sigma : Placement) : + physicalTickCapacity allocation tick capacity sigma = + PhysicalOrders.perPhysicalOrderCapacity + (fun w : CanonicalActive K tick => workAmount allocation w.val) + (fun w => capacity w.val) (fun w => w.val.priority) sigma := by + funext i + simp only [physicalTickCapacity, PhysicalOrders.perPhysicalOrderCapacity, + PlacedWork.physicalOrder, amount, workAmount, Rat.cast_div, Rat.cast_ofNat] + +theorem physicalTickCapacity_eq_sixth {K : ℕ} (allocation : Allocation) (tick : ℕ) + (capacity : Work K → Staggering.Capacity) (sigma : Placement) : + physicalTickCapacity allocation tick capacity sigma = + fun i => (1 / 6 : ℝ) * activeAggregateCapacity allocation tick capacity i := by + rw [physicalTickCapacity_eq_partition] + exact PhysicalOrders.perPhysicalOrderCapacity_eq _ _ _ _ + +theorem sum_physicalTick_minima {K : ℕ} (allocation : Allocation) (tick : ℕ) + (capacity : Work K → Staggering.Capacity) : + (∑ sigma : Placement, Staggering.minCapacity + (physicalTickCapacity allocation tick capacity sigma)) = + Staggering.minCapacity (activeAggregateCapacity allocation tick capacity) := by + simp_rw [physicalTickCapacity_eq_partition] + exact PhysicalOrders.sum_physical_order_minima _ _ _ + +end MatrixMultiplication.AllFieldHistory + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section + +namespace MatrixMultiplication.AllFieldHistory + +open AllFieldParameters CWStrands CWWindowedLeaves +open scoped BigOperators +attribute [local instance] Classical.propDecidable Classical.decEq + +def Work.Statistic {K : ℕ} : Work K → Type + | .stageA _ => PairSlot + | .stageB _ => Fin 6 + | .stageC _ => PUnit + +instance {K : ℕ} (w : Work K) : Fintype w.Statistic := by + cases w <;> dsimp [Work.Statistic] <;> infer_instance + +instance {K : ℕ} (w : Work K) : DecidableEq w.Statistic := Classical.decEq _ + +def Work.statistic {K : ℕ} (w : Work K) : Raw w.halfLength → w.Statistic := + match w with + | .stageA _ => CWCompleteStatistics.fourStatistic + | .stageB _ => CWCompleteStatistics.twoStatistic + | .stageC _ => fun _ => PUnit.unit + +def Work.statisticWeight {K : ℕ} (w : Work K) : w.Statistic → ℕ := + match w with + | .stageA _ => fun a => AllFieldParameters.statisticWeight a.1 + + AllFieldParameters.statisticWeight a.2 + | .stageB _ => AllFieldParameters.statisticWeight + | .stageC _ => fun _ => 0 + +theorem Work.statistic_weight {K : ℕ} (w : Work K) (hsharing : w.stage ≠ 2) + (x : Raw w.halfLength) : CWStrands.weight x = w.statisticWeight (w.statistic x) := by + cases w with + | stageA h => exact CWCompleteStatistics.four_weight x + | stageB h => exact CWCompleteStatistics.two_weight x + | stageC h => exact False.elim (hsharing rfl) + +def Work.childLaw {K : ℕ} (w : Work K) (u : Shape) (side : Fin 3) : + w.Statistic → ℚ := + match w with + | .stageA _ => halfLaw u side + | .stageB h => littleLaw (aShape h.val) u side + | .stageC _ => fun _ => 1 + +theorem Work.childLaw_nonnegative {K : ℕ} (w : Work K) (u : Shape) + (side : Fin 3) (a : w.Statistic) : 0 ≤ w.childLaw u side a := by + cases w with + | stageA h => exact halfLaw_nonnegative u side a + | stageB h => exact littleLaw_nonnegative (aShape h.val) u side a + | stageC h => exact zero_le_one + +theorem Work.childLaw_normalized {K : ℕ} (w : Work K) (u : Shape) + (hu : u ∈ shapes (2 * w.halfLength)) (side : Fin 3) : + ∑ a : w.Statistic, w.childLaw u side a = 1 := by + cases w with + | stageA h => exact halfLaw_normalized u hu side + | stageB h => exact littleLaw_normalized (aShape h.val) u side + | stageC h => + change (∑ _ : PUnit, (1 : ℚ)) = 1 + simp + +theorem Work.childLaw_outside_support {K : ℕ} (w : Work K) (hsharing : w.stage ≠ 2) + (u : Shape) (hu : u ∈ shapes (2 * w.halfLength)) (side : Fin 3) + (a : w.Statistic) (ha : w.statisticWeight a ≠ u side) : w.childLaw u side a = 0 := by + cases w with + | stageA h => exact halfLaw_outside_support u hu side a ha + | stageB h => + have hbound : u side < 5 := + lt_of_le_of_lt (mem_shapes_bound hu side) (by norm_num [Work.halfLength]) + exact littleLaw_outside_support (aShape h.val) u side hbound a ha + | stageC h => exact False.elim (hsharing rfl) + +def canonicalChildShape {K : ℕ} (w : PlacedWork K) (u : JointPopulation.Shape) : Shape := + fun i => decodeShape u (w.2 i) + +@[simp] theorem canonicalChildShape_branchShape {K : ℕ} (w : PlacedWork K) + (b : w.1.Branch) : canonicalChildShape w (branchShape w b) = w.1.splitShape b := by + funext i + simp [canonicalChildShape, branchShape, physicalShape] + +theorem Work.halfShape_mem {K : ℕ} (w : Work K) (b : w.Branch) (right : Bool) : + halfShape w.parentShape (w.splitShape b) right ∈ shapes (2 * w.halfLength) := by + cases w with + | stageA h => exact aShape_size ⟨h, b, right⟩ + | stageB h => exact bShape_size ⟨h, b, right⟩ + | stageC h => + have hi := stageCAtom_mem (cShapeParent h) (bShape_size h.1.val) h.1.property b + have hs := stageC_children_geometry (cShapeParent h) + (bShape_size h.1.val) h.1.property (stageCAtom (cShapeParent h) b) + hi + have ht : shapeTotal (cShapeParent h) = 4 := mem_shapes_total (bShape_size h.1.val) + cases right + · change stageCAtom (cShapeParent h) b ∈ shapes 2 + simpa only [ht, Nat.reduceDiv] using below_mem_shapes hi + · change complement (cShapeParent h) (stageCAtom (cShapeParent h) b) ∈ shapes 2 + simpa only [ht, Nat.reduceDiv] using below_mem_shapes hs.1 + +def placedChildLawRat {K : ℕ} (w : PlacedWork K) (u : JointPopulation.Shape) + (side : Fin 3) (right : Bool) : w.1.Statistic → ℚ := + w.1.childLaw (halfShape w.1.parentShape (canonicalChildShape w u) right) + (w.2.symm side) + +def childLawRat {K : ℕ} (w : PlacedWork K) (u : JointPopulation.Shape) + (side : Fin 3) : w.1.Statistic → ℚ := placedChildLawRat w u side false + +def rightChildLawRat {K : ℕ} (w : PlacedWork K) (u : JointPopulation.Shape) + (side : Fin 3) : w.1.Statistic → ℚ := placedChildLawRat w u side true + +@[simp] theorem placedChildLawRat_branchShape {K : ℕ} (w : PlacedWork K) + (b : w.1.Branch) (side : Fin 3) (right : Bool) : + placedChildLawRat w (branchShape w b) side right = + w.1.childLaw (halfShape w.1.parentShape (w.1.splitShape b) right) + (w.2.symm side) := by + simp only [placedChildLawRat, canonicalChildShape_branchShape] + +theorem placedChildLawRat_nonnegative {K : ℕ} (w : PlacedWork K) + (u : JointPopulation.Shape) (side : Fin 3) (right : Bool) (a : w.1.Statistic) : + 0 ≤ placedChildLawRat w u side right a := + w.1.childLaw_nonnegative _ _ a + +theorem placedChildLawRat_normalized_of_pos {K : ℕ} (allocation : Allocation) + (dilation : ℕ) (w : PlacedWork K) (u : JointPopulation.Shape) + (hu : 0 < jointCounts allocation dilation w u) (side : Fin 3) (right : Bool) : + ∑ a : w.1.Statistic, placedChildLawRat w u side right a = 1 := by + obtain ⟨b, rfl, _⟩ := shapeCounts_positive _ _ u hu + simp only [placedChildLawRat_branchShape] + exact w.1.childLaw_normalized _ (w.1.halfShape_mem b right) _ + +def childLaw {K : ℕ} (w : PlacedWork K) (u : JointPopulation.Shape) + (side : Fin 3) (a : w.1.Statistic) : ℝ := childLawRat w u side a + +def rightChildLaw {K : ℕ} (w : PlacedWork K) (u : JointPopulation.Shape) + (side : Fin 3) (a : w.1.Statistic) : ℝ := rightChildLawRat w u side a + +abbrev ActiveStatistic {K tick : ℕ} (h : Active K tick) := h.val.1.Statistic + +def activeStatistic {K tick : ℕ} (h : Active K tick) : + Raw (activeHalfLength h) → ActiveStatistic h := h.val.1.statistic + +def leftChildLaw {K tick : ℕ} (side : Fin 3) + (c : Active K tick × JointPopulation.Shape) : ActiveStatistic c.1 → ℝ := + childLaw c.1.val c.2 side + +def rightClassChildLaw {K tick : ℕ} (side : Fin 3) + (c : Active K tick × JointPopulation.Shape) : ActiveStatistic c.1 → ℝ := + rightChildLaw c.1.val c.2 side + +theorem leftChildLaw_nonnegative {K tick : ℕ} (side : Fin 3) + (c : Active K tick × JointPopulation.Shape) (a : ActiveStatistic c.1) : + 0 ≤ leftChildLaw side c a := by + change (0 : ℝ) ≤ (placedChildLawRat c.1.val c.2 side false a : ℝ) + exact_mod_cast placedChildLawRat_nonnegative c.1.val c.2 side false a + +theorem rightClassChildLaw_nonnegative {K tick : ℕ} (side : Fin 3) + (c : Active K tick × JointPopulation.Shape) (a : ActiveStatistic c.1) : + 0 ≤ rightClassChildLaw side c a := by + change (0 : ℝ) ≤ (placedChildLawRat c.1.val c.2 side true a : ℝ) + exact_mod_cast placedChildLawRat_nonnegative c.1.val c.2 side true a + +theorem leftChildLaw_normalized_of_pos {K tick : ℕ} (allocation : Allocation) + (dilation : ℕ) (side : Fin 3) (c : Active K tick × JointPopulation.Shape) + (hc : 0 < activeCounts allocation dilation c.1 c.2) : + ∑ a : ActiveStatistic c.1, leftChildLaw side c a = 1 := by + change (∑ a : c.1.val.1.Statistic, + (placedChildLawRat c.1.val c.2 side false a : ℝ)) = 1 + exact_mod_cast placedChildLawRat_normalized_of_pos allocation dilation + c.1.val c.2 hc side false + +theorem rightClassChildLaw_normalized_of_pos {K tick : ℕ} (allocation : Allocation) + (dilation : ℕ) (side : Fin 3) (c : Active K tick × JointPopulation.Shape) + (hc : 0 < activeCounts allocation dilation c.1 c.2) : + ∑ a : ActiveStatistic c.1, rightClassChildLaw side c a = 1 := by + change (∑ a : c.1.val.1.Statistic, + (placedChildLawRat c.1.val c.2 side true a : ℝ)) = 1 + exact_mod_cast placedChildLawRat_normalized_of_pos allocation dilation + c.1.val c.2 hc side true + +end MatrixMultiplication.AllFieldHistory + +namespace MatrixMultiplication.AllFieldHistoryChildLaws + +open AllFieldHistory +open scoped BigOperators + +abbrev Statistic {K tick : ℕ} (h : Active K tick) := ActiveStatistic h + +abbrev statistic {K tick : ℕ} (h : Active K tick) : + CWWindowedLeaves.Raw (activeHalfLength h) → Statistic h := activeStatistic h + +abbrev leftLaw {K tick : ℕ} (h : Active K tick) (u : JointPopulation.Shape) + (side : Fin 3) : Statistic h → ℝ := childLaw h.val u side + +abbrev rightLaw {K tick : ℕ} (h : Active K tick) (u : JointPopulation.Shape) + (side : Fin 3) : Statistic h → ℝ := rightChildLaw h.val u side + +theorem leftLaw_nonnegative {K tick : ℕ} (h : Active K tick) (u : JointPopulation.Shape) + (side : Fin 3) (a : Statistic h) : 0 ≤ leftLaw h u side a := + leftChildLaw_nonnegative side (h, u) a + +theorem rightLaw_nonnegative {K tick : ℕ} (h : Active K tick) (u : JointPopulation.Shape) + (side : Fin 3) (a : Statistic h) : 0 ≤ rightLaw h u side a := + rightClassChildLaw_nonnegative side (h, u) a + +theorem leftLaw_normalized {K tick : ℕ} (allocation : Allocation) (dilation : ℕ) + (h : Active K tick) (u : JointPopulation.Shape) + (hu : 0 < activeCounts allocation dilation h u) (side : Fin 3) : + ∑ a : Statistic h, leftLaw h u side a = 1 := + leftChildLaw_normalized_of_pos allocation dilation side (h, u) hu + +theorem rightLaw_normalized {K tick : ℕ} (allocation : Allocation) (dilation : ℕ) + (h : Active K tick) (u : JointPopulation.Shape) + (hu : 0 < activeCounts allocation dilation h u) (side : Fin 3) : + ∑ a : Statistic h, rightLaw h u side a = 1 := + rightClassChildLaw_normalized_of_pos allocation dilation side (h, u) hu + +theorem singleton_typeWindow {P : Type*} [Fintype P] [DecidableEq P] [Nonempty P] + (η : ℝ) (hη : 0 ≤ η) (w : P → PUnit) : + InheritedMasks.typeWindow (fun _ : PUnit => 1) η w := by + intro a + have hcount : MatrixMultiplication.Foundation.wordPopulation w a = Fintype.card P := by + apply Fintype.card_congr + exact + { toFun := Subtype.val + invFun := fun i => ⟨i, Subsingleton.elim _ _⟩ + left_inv := fun i => Subtype.ext rfl + right_inv := fun i => rfl } + have hpos : (0 : ℝ) < Fintype.card P := by + exact_mod_cast (Fintype.card_pos : 0 < Fintype.card P) + simpa only [InheritedMasks.empiricalLaw, hcount, div_self (ne_of_gt hpos), + sub_self, abs_zero] using hη + +end MatrixMultiplication.AllFieldHistoryChildLaws + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/Histories/HistoryGroupCore.lean b/lean/OAI/LinearAlgebra/MatrixFields/Histories/HistoryGroupCore.lean new file mode 100644 index 0000000000000000000000000000000000000000..2d2ad0ae8865d348a58a7c5a088d875d87e9cb17 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/Histories/HistoryGroupCore.lean @@ -0,0 +1,931 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Construction.InitialState +import OAI.LinearAlgebra.MatrixFields.Histories.HistoryRecoveryBudget + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section + +namespace MatrixMultiplication.AllFieldHistoryRegrouping + +open MatrixMultiplication.Foundation AllFieldHistory AllFieldFiniteFamily +open scoped BigOperators Classical +attribute [local instance] Classical.propDecidable Classical.decEq + +variable {K tick : ℕ} (allocation : Allocation) (m : ℕ) + +abbrev StateWords (tick : ℕ) := ∀ h : State K tick, HistoryWord allocation m h.val +abbrev DueWords := ∀ h : DueState K tick, HistoryWord allocation m h.val.val +abbrev CarriedWords := ∀ h : Carried K tick, HistoryWord allocation m h.val.val +abbrev ActiveWords := ∀ h : Active K tick, + HistoryWord allocation m (activeSourceEquiv h).val.val +abbrev ProducedWords := ∀ h : Produced K tick, HistoryWord allocation m h.val + +instance dueWordsFintype : Fintype (DueWords (K := K) (tick := tick) allocation m) := + inferInstanceAs (Fintype (∀ h : DueState K tick, HistoryWord allocation m h.val.val)) + +instance carriedWordsFintype : Fintype (CarriedWords (K := K) (tick := tick) allocation m) := + inferInstanceAs (Fintype (∀ h : Carried K tick, HistoryWord allocation m h.val.val)) + +instance activeWordsFintype : Fintype (ActiveWords (K := K) (tick := tick) allocation m) := + inferInstanceAs (Fintype (∀ h : Active K tick, + HistoryWord allocation m (activeSourceEquiv h).val.val)) + +instance producedWordsFintype : Fintype (ProducedWords (K := K) (tick := tick) allocation m) := + inferInstanceAs (Fintype (∀ h : Produced K tick, HistoryWord allocation m h.val)) + +def carriedTensor (F : Type*) [Field F] (ε : ℝ) : + Tensor F (CarriedWords (K := K) (tick := tick) allocation m) + (CarriedWords (K := K) (tick := tick) allocation m) (CarriedWords (K := K) (tick := tick) allocation m) := + CommonDimensions.familyProduct (fun h : Carried K tick => + historyTensor F allocation m ε h.val.val) + +def activeTensor (F : Type*) [Field F] (ε : ℝ) : + Tensor F (ActiveWords (K := K) (tick := tick) allocation m) + (ActiveWords (K := K) (tick := tick) allocation m) (ActiveWords (K := K) (tick := tick) allocation m) := + CommonDimensions.familyProduct (fun h : Active K tick => + historyTensor F allocation m ε (activeSourceEquiv h).val.val) + +def producedTensor (F : Type*) [Field F] (ε : ℝ) : + Tensor F (ProducedWords (K := K) (tick := tick) allocation m) + (ProducedWords (K := K) (tick := tick) allocation m) (ProducedWords (K := K) (tick := tick) allocation m) := + CommonDimensions.familyProduct (fun h : Produced K tick => + historyTensor F allocation m ε h.val) + +def toState (x : DueWords (K := K) (tick := tick) allocation m × + CarriedWords (K := K) (tick := tick) allocation m) : StateWords (K := K) allocation m tick := + fun h => if hd : due tick h.val.1 then x.1 ⟨h, hd⟩ else x.2 ⟨h, hd⟩ + +@[simp] theorem toState_due + (x : DueWords (K := K) (tick := tick) allocation m × CarriedWords (K := K) (tick := tick) allocation m) + (h : DueState K tick) : toState (K := K) (tick := tick) allocation m x h.val = x.1 h := by + simp only [toState, dite_eq_left h.property] + +@[simp] theorem toState_carried + (x : DueWords (K := K) (tick := tick) allocation m × CarriedWords (K := K) (tick := tick) allocation m) + (h : Carried K tick) : toState (K := K) (tick := tick) allocation m x h.val = x.2 h := by + simp only [toState, dite_eq_right h.property] + +def dueTensorAt (F : Type*) [Field F] (ε : ℝ) : + Tensor F (DueWords (K := K) (tick := tick) allocation m) + (DueWords (K := K) (tick := tick) allocation m) (DueWords (K := K) (tick := tick) allocation m) := + CommonDimensions.familyProduct (fun h : DueState K tick => + historyTensor F allocation m ε h.val.val) + +theorem split_coefficient (F : Type*) [Field F] (ε : ℝ) + (x y z : DueWords (K := K) (tick := tick) allocation m × CarriedWords (K := K) (tick := tick) allocation m) : + stateTensor F (K := K) allocation m ε tick (toState (K := K) (tick := tick) allocation m x) + (toState (K := K) (tick := tick) allocation m y) (toState (K := K) (tick := tick) allocation m z) = + Tensor.product (dueTensorAt (K := K) (tick := tick) allocation m F ε) (carriedTensor (K := K) (tick := tick) allocation m F ε) x y z := by + change (∏ h : State K tick, historyTensor F allocation m ε h.val + (toState (K := K) (tick := tick) allocation m x h) (toState (K := K) (tick := tick) allocation m y h) (toState (K := K) (tick := tick) allocation m z h)) = _ + rw [← Fintype.prod_subtype_mul_prod_subtype (fun h : State K tick => due tick h.val.1)] + simp only [toState_due, toState_carried] + rfl + +def splitMap (F : Type*) [Field F] (ε : ℝ) : + LocalMap (stateTensor F (K := K) allocation m ε tick) + (Tensor.product (dueTensorAt (K := K) (tick := tick) allocation m F ε) + (carriedTensor (K := K) (tick := tick) allocation m F ε)) where + x := fun x s => if s = toState (K := K) (tick := tick) allocation m x then 1 else 0 + y := fun y s => if s = toState (K := K) (tick := tick) allocation m y then 1 else 0 + z := fun z s => if s = toState (K := K) (tick := tick) allocation m z then 1 else 0 + coefficient := by + rw [← Tensor.pullback_eq_restrict] + funext x y z + exact split_coefficient allocation m F ε x y z + +def toDue (x : ActiveWords (K := K) (tick := tick) allocation m) : + DueWords (K := K) (tick := tick) allocation m := + Equiv.piCongrLeft (fun h : DueState K tick => HistoryWord allocation m h.val.val) + activeSourceEquiv x + +theorem active_coefficient (F : Type*) [Field F] (ε : ℝ) + (x y z : ActiveWords (K := K) (tick := tick) allocation m) : + dueTensorAt (K := K) (tick := tick) allocation m F ε (toDue (K := K) (tick := tick) allocation m x) (toDue (K := K) (tick := tick) allocation m y) + (toDue (K := K) (tick := tick) allocation m z) = activeTensor (K := K) (tick := tick) allocation m F ε x y z := by + change (∏ h : DueState K tick, historyTensor F allocation m ε h.val.val + (toDue (K := K) (tick := tick) allocation m x h) (toDue (K := K) (tick := tick) allocation m y h) (toDue (K := K) (tick := tick) allocation m z h)) = _ + rw [← activeSourceEquiv.prod_comp] + unfold toDue + simp only [Equiv.piCongrLeft_apply_apply] + rfl + +def activeMap (F : Type*) [Field F] (ε : ℝ) : + LocalMap (dueTensorAt (K := K) (tick := tick) allocation m F ε) + (activeTensor (K := K) (tick := tick) allocation m F ε) where + x := fun x s => if s = toDue (K := K) (tick := tick) allocation m x then 1 else 0 + y := fun y s => if s = toDue (K := K) (tick := tick) allocation m y then 1 else 0 + z := fun z s => if s = toDue (K := K) (tick := tick) allocation m z then 1 else 0 + coefficient := by + rw [← Tensor.pullback_eq_restrict] + funext x y z + exact active_coefficient allocation m F ε x y z + +def activeCarriedMap (F : Type*) [Field F] (ε : ℝ) : + LocalMap (stateTensor F (K := K) allocation m ε tick) + (Tensor.product (activeTensor (K := K) (tick := tick) allocation m F ε) + (carriedTensor (K := K) (tick := tick) allocation m F ε)) := + (splitMap (K := K) (tick := tick) allocation m F ε).comp + ((activeMap (K := K) (tick := tick) allocation m F ε).product + (LocalMap.identity (carriedTensor (K := K) (tick := tick) allocation m F ε))) + +def fromNext (x : StateWords (K := K) allocation m (tick + 1)) : + ProducedWords (K := K) (tick := tick) allocation m × CarriedWords (K := K) (tick := tick) allocation m := + (fun h => x (stateTransition.symm (.inr h)), + fun h => x (stateTransition.symm (.inl h))) + +theorem next_coefficient (F : Type*) [Field F] (ε : ℝ) + (x y z : StateWords (K := K) allocation m (tick + 1)) : + Tensor.product (producedTensor (K := K) (tick := tick) allocation m F ε) + (carriedTensor (K := K) (tick := tick) allocation m F ε) (fromNext (K := K) (tick := tick) allocation m x) + (fromNext (K := K) (tick := tick) allocation m y) (fromNext (K := K) (tick := tick) allocation m z) = + stateTensor F (K := K) allocation m ε (tick + 1) x y z := by + change _ = ∏ h : State K (tick + 1), historyTensor F allocation m ε h.val + (x h) (y h) (z h) + rw [← stateTransition.symm.prod_comp] + rw [Fintype.prod_sum_type] + exact mul_comm _ _ + +def nextMap (F : Type*) [Field F] (ε : ℝ) : + LocalMap (Tensor.product (producedTensor (K := K) (tick := tick) allocation m F ε) + (carriedTensor (K := K) (tick := tick) allocation m F ε)) + (stateTensor F (K := K) allocation m ε (tick + 1)) := by + apply LocalMap.ofExists + refine ⟨_, _, _, (Tensor.pullback_eq_restrict + (fromNext (K := K) (tick := tick) allocation m) + (fromNext (K := K) (tick := tick) allocation m) + (fromNext (K := K) (tick := tick) allocation m) _).symm.trans ?_⟩ + funext x y z + exact next_coefficient allocation m F ε x y z + +end MatrixMultiplication.AllFieldHistoryRegrouping + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section + +namespace MatrixMultiplication.AllFieldHistoryTickCarry + +open MatrixMultiplication.Foundation AllFieldHistory AllFieldFiniteFamily +open AllFieldHistoryRegrouping +open scoped Classical +attribute [local instance] Classical.propDecidable Classical.decEq + +section Distribution + +variable {F : Type*} [Field F] + +def distributeProduct + {X Y Z U V W : Type} + [Fintype X] [Fintype Y] [Fintype Z] + [Fintype U] [Fintype V] [Fintype W] + (active : Tensor F X Y Z) (carried : Tensor F U V W) + (J : Type) [Fintype J] : + LocalMap (Tensor.product (Tensor.directSum (fun _ : J => active)) carried) + (Tensor.directSum (fun _ : J => Tensor.product active carried)) where + x := fun x s => if s = ((x.1, x.2.1), x.2.2) then 1 else 0 + y := fun y s => if s = ((y.1, y.2.1), y.2.2) then 1 else 0 + z := fun z s => if s = ((z.1, z.2.1), z.2.2) then 1 else 0 + coefficient := by + rw [← Tensor.pullback_eq_restrict] + funext x y z + simp [Tensor.pullback, Tensor.directSum, Tensor.product, ite_mul] + +end Distribution + +variable {K tick : ℕ} (allocation : Allocation) (m : ℕ) + (F : Type*) [Field F] (ε : ℝ) {J : Type} [Fintype J] + +def liftExecution + (E : Execution + (activeTensor (K := K) (tick := tick) allocation m F ε) + (Tensor.directSum (fun _ : J => + producedTensor (K := K) (tick := tick) allocation m F ε))) : + Execution (stateTensor F (K := K) allocation m ε tick) + (Tensor.directSum (fun _ : J => + stateTensor F (K := K) allocation m ε (tick + 1))) where + Copies := E.Copies + copies_positive := E.copies_positive + map := + ((activeCarriedMap (K := K) (tick := tick) allocation m F ε).parallelCopies E.Copies).comp + ((LocalMap.replicationProduct + (activeTensor (K := K) (tick := tick) allocation m F ε) + (carriedTensor (K := K) (tick := tick) allocation m F ε) E.Copies).comp + ((E.map.product + (LocalMap.identity (carriedTensor (K := K) (tick := tick) allocation m F ε))).comp + ((distributeProduct + (producedTensor (K := K) (tick := tick) allocation m F ε) + (carriedTensor (K := K) (tick := tick) allocation m F ε) J).comp + ((nextMap (K := K) (tick := tick) allocation m F ε).parallelCopies J)))) + +@[simp] theorem liftExecution_copies + (E : Execution + (activeTensor (K := K) (tick := tick) allocation m F ε) + (Tensor.directSum (fun _ : J => + producedTensor (K := K) (tick := tick) allocation m F ε))) : + (liftExecution allocation m F ε E).Copies = E.Copies := rfl + +@[simp] theorem liftExecution_card_copies + (E : Execution + (activeTensor (K := K) (tick := tick) allocation m F ε) + (Tensor.directSum (fun _ : J => + producedTensor (K := K) (tick := tick) allocation m F ε))) : + Fintype.card (liftExecution allocation m F ε E).Copies = Fintype.card E.Copies := rfl + +end MatrixMultiplication.AllFieldHistoryTickCarry + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +open scoped BigOperators + +noncomputable section + +namespace MatrixMultiplication.AllFieldHistory + +open MatrixMultiplication.Foundation +attribute [local instance] Classical.propDecidable Classical.decEq + +def activeEquivOrders (K tick : ℕ) : + Active K tick ≃ Σ sigma : Placement, ActiveOrder K tick sigma := + (Equiv.sigmaFiberEquiv (fun w : Active K tick => w.val.physicalOrder)).symm + +def activeWordsEquivOrders {K tick : ℕ} (W : Active K tick → Type*) : + (∀ h, W h) ≃ (∀ sigma : Placement, ∀ h : ActiveOrder K tick sigma, W h.val) where + toFun x _ h := x h.val + invFun x h := x h.val.physicalOrder ⟨h, rfl⟩ + left_inv _ := rfl + right_inv x := by + funext sigma h + rcases h with ⟨h, hh⟩ + cases hh + rfl + +theorem prod_active_eq_prod_orders {K tick : ℕ} {M : Type*} [CommMonoid M] + (f : Active K tick → M) : + (∏ h, f h) = ∏ sigma : Placement, ∏ h : ActiveOrder K tick sigma, f h.val := by + calc + _ = ∏ h : (Σ sigma : Placement, ActiveOrder K tick sigma), f h.2.val := + Fintype.prod_equiv (activeEquivOrders K tick) _ _ (fun _ => rfl) + _ = _ := Fintype.prod_sigma _ + +theorem familyProduct_active_eq_orders {K tick : ℕ} {F : Type*} [CommSemiring F] + {X Y Z : Active K tick → Type*} + (T : ∀ h, Tensor F (X h) (Y h) (Z h)) + (x : ∀ h, X h) (y : ∀ h, Y h) (z : ∀ h, Z h) : + CommonDimensions.familyProduct T x y z = + CommonDimensions.familyProduct + (fun sigma : Placement => CommonDimensions.familyProduct + (fun h : ActiveOrder K tick sigma => T h.val)) + (activeWordsEquivOrders X x) (activeWordsEquivOrders Y y) + (activeWordsEquivOrders Z z) := + prod_active_eq_prod_orders (fun h => T h (x h) (y h) (z h)) + +namespace GroupAssignment + +variable {I : Type*} {V E : I → Type*} + +def side {V E : Type*} (a : JointExtraction.Assignment V V V E) (i : Fin 3) : + V → Option E := (Matrix.vecCons (a.x) (Matrix.vecCons (a.y) (Matrix.vecCons (a.z) Matrix.vecEmpty))) i + +def restorePhysical {V E : Type*} (sigma : Placement) + (a : JointExtraction.Assignment V V V E) : JointExtraction.Assignment V V V E where + x := side a (sigma.symm 0) + y := side a (sigma.symm 1) + z := side a (sigma.symm 2) + +theorem side_restorePhysical {V E : Type*} (sigma : Placement) + (a : JointExtraction.Assignment V V V E) (i : Fin 3) : + side (restorePhysical sigma a) i = side a (sigma.symm i) := by + rcases i with ⟨i, hi⟩ + have h : i = 0 ∨ i = 1 ∨ i = 2 := by omega + rcases h with rfl | rfl | rfl <;> rfl + +def collect (a : ∀ i, V i → Option (E i)) (v : ∀ i, V i) : Option (∀ i, E i) := + if h : ∃ e : ∀ i, E i, ∀ i, a i (v i) = some (e i) then + some (Classical.choose h) else none + +theorem collect_eq_some (a : ∀ i, V i → Option (E i)) (v : ∀ i, V i) (e : ∀ i, E i) : + collect a v = some e ↔ ∀ i, a i (v i) = some (e i) := by + unfold collect + split_ifs with h + · constructor + · intro he i + have heq := Option.some.inj he + simpa only [heq] using Classical.choose_spec h i + · intro he + congr 1 + funext i + exact Option.some.inj ((Classical.choose_spec h i).symm.trans (he i)) + · constructor + · intro he + cases he + · intro he + exact False.elim (h ⟨e, he⟩) + +theorem collect_failure_iff (a : ∀ i, V i → Option (E i)) + (v : ∀ i, V i) (e : ∀ i, E i) : + collect a v ≠ some e ↔ ∃ i, a i (v i) ≠ some (e i) := by + rw [ne_eq, collect_eq_some, not_forall] + +variable {X Y Z : I → Type*} + +def product (a : ∀ i, JointExtraction.Assignment (X i) (Y i) (Z i) (E i)) : + JointExtraction.Assignment (∀ i, X i) (∀ i, Y i) (∀ i, Z i) (∀ i, E i) where + x := collect (fun i => (a i).x) + y := collect (fun i => (a i).y) + z := collect (fun i => (a i).z) + +variable [Fintype I] {F : Type*} [CommSemiring F] + +theorem product_coherent (T : ∀ i, Tensor F (X i) (Y i) (Z i)) + (a : ∀ i, JointExtraction.Assignment (X i) (Y i) (Z i) (E i)) + (ha : ∀ i, JointExtraction.Coherent (T i) (a i)) : + JointExtraction.Coherent (CommonDimensions.familyProduct T) (product a) := by + intro x y z e f g hT hx hy hz + have hx' := (collect_eq_some (fun i => (a i).x) x e).mp hx + have hy' := (collect_eq_some (fun i => (a i).y) y f).mp hy + have hz' := (collect_eq_some (fun i => (a i).z) z g).mp hz + have hfactor (i : I) : T i (x i) (y i) (z i) ≠ 0 := by + intro hi + exact hT (Finset.prod_eq_zero (Finset.mem_univ i) hi) + constructor + · funext i + exact (ha i (x i) (y i) (z i) (e i) (f i) (g i) + (hfactor i) (hx' i) (hy' i) (hz' i)).1 + · funext i + exact (ha i (x i) (y i) (z i) (e i) (f i) (g i) + (hfactor i) (hx' i) (hy' i) (hz' i)).2 + +theorem product_branch (T : ∀ i, Tensor F (X i) (Y i) (Z i)) + (a : ∀ i, JointExtraction.Assignment (X i) (Y i) (Z i) (E i)) + (e : ∀ i, E i) (x : ∀ i, X i) (y : ∀ i, Y i) (z : ∀ i, Z i) : + JointExtraction.branch (CommonDimensions.familyProduct T) (product a) e x y z = + ∏ i, JointExtraction.branch (T i) (a i) (e i) (x i) (y i) (z i) := by + simp only [JointExtraction.branch, product, CommonDimensions.familyProduct, + collect_eq_some] + by_cases h : ∀ i, (a i).x (x i) = some (e i) ∧ + (a i).y (y i) = some (e i) ∧ (a i).z (z i) = some (e i) + · have ho : (∀ i, (a i).x (x i) = some (e i)) ∧ + (∀ i, (a i).y (y i) = some (e i)) ∧ + (∀ i, (a i).z (z i) = some (e i)) := + ⟨fun i => (h i).1, fun i => (h i).2.1, fun i => (h i).2.2⟩ + rw [ite_eq_left ho] + apply Finset.prod_congr rfl + intro i _ + rw [ite_eq_left (h i)] + · have ho : ¬((∀ i, (a i).x (x i) = some (e i)) ∧ + (∀ i, (a i).y (y i) = some (e i)) ∧ + (∀ i, (a i).z (z i) = some (e i))) := by + intro hh + exact h (fun i => ⟨hh.1 i, hh.2.1 i, hh.2.2 i⟩) + rw [ite_eq_right ho] + obtain ⟨i, hi⟩ := not_forall.mp h + exact (Finset.prod_eq_zero (Finset.mem_univ i) (ite_eq_right hi)).symm + +end GroupAssignment + +variable {K tick : ℕ} + +def groupedSideAssignment (W : Active K tick → Type*) (E : Placement → Type*) + (a : ∀ sigma, (∀ h : ActiveOrder K tick sigma, W h.val) → Option (E sigma)) + (x : ∀ h, W h) : Option (∀ sigma, E sigma) := + GroupAssignment.collect a (activeWordsEquivOrders W x) + +theorem groupedSideAssignment_eq_some (W : Active K tick → Type*) (E : Placement → Type*) + (a : ∀ sigma, (∀ h : ActiveOrder K tick sigma, W h.val) → Option (E sigma)) + (x : ∀ h, W h) (e : ∀ sigma, E sigma) : + groupedSideAssignment W E a x = some e ↔ + ∀ sigma, a sigma (fun h => x h.val) = some (e sigma) := + GroupAssignment.collect_eq_some _ _ _ + +def groupedAssignment (X Y Z : Active K tick → Type*) (E : Placement → Type*) + (a : ∀ sigma, JointExtraction.Assignment + (∀ h : ActiveOrder K tick sigma, X h.val) + (∀ h : ActiveOrder K tick sigma, Y h.val) + (∀ h : ActiveOrder K tick sigma, Z h.val) (E sigma)) : + JointExtraction.Assignment (∀ h, X h) (∀ h, Y h) (∀ h, Z h) (∀ sigma, E sigma) where + x := groupedSideAssignment X E (fun sigma => (a sigma).x) + y := groupedSideAssignment Y E (fun sigma => (a sigma).y) + z := groupedSideAssignment Z E (fun sigma => (a sigma).z) + +theorem groupedAssignment_coherent {F : Type*} [CommSemiring F] + (X Y Z : Active K tick → Type*) (E : Placement → Type*) + (T : ∀ h, Tensor F (X h) (Y h) (Z h)) + (a : ∀ sigma, JointExtraction.Assignment + (∀ h : ActiveOrder K tick sigma, X h.val) + (∀ h : ActiveOrder K tick sigma, Y h.val) + (∀ h : ActiveOrder K tick sigma, Z h.val) (E sigma)) + (ha : ∀ sigma, JointExtraction.Coherent + (CommonDimensions.familyProduct (fun h : ActiveOrder K tick sigma => T h.val)) + (a sigma)) : + JointExtraction.Coherent (CommonDimensions.familyProduct T) + (groupedAssignment X Y Z E a) := by + intro x y z e f g hT hx hy hz + rw [familyProduct_active_eq_orders] at hT + exact GroupAssignment.product_coherent _ a ha + (activeWordsEquivOrders X x) (activeWordsEquivOrders Y y) + (activeWordsEquivOrders Z z) e f g hT hx hy hz + +theorem groupedAssignment_branch {F : Type*} [CommSemiring F] + (X Y Z : Active K tick → Type*) (E : Placement → Type*) + (T : ∀ h, Tensor F (X h) (Y h) (Z h)) + (a : ∀ sigma, JointExtraction.Assignment + (∀ h : ActiveOrder K tick sigma, X h.val) + (∀ h : ActiveOrder K tick sigma, Y h.val) + (∀ h : ActiveOrder K tick sigma, Z h.val) (E sigma)) + (e : ∀ sigma, E sigma) (x : ∀ h, X h) (y : ∀ h, Y h) (z : ∀ h, Z h) : + JointExtraction.branch (CommonDimensions.familyProduct T) + (groupedAssignment X Y Z E a) e x y z = + ∏ sigma : Placement, JointExtraction.branch + (CommonDimensions.familyProduct (fun h : ActiveOrder K tick sigma => T h.val)) + (a sigma) (e sigma) (fun h => x h.val) (fun h => y h.val) (fun h => z h.val) := by + calc + _ = JointExtraction.branch + (CommonDimensions.familyProduct (fun sigma : Placement => + CommonDimensions.familyProduct (fun h : ActiveOrder K tick sigma => T h.val))) + (GroupAssignment.product a) e (activeWordsEquivOrders X x) + (activeWordsEquivOrders Y y) (activeWordsEquivOrders Z z) := by + simp only [JointExtraction.branch, groupedAssignment, groupedSideAssignment, + GroupAssignment.product] + rw [familyProduct_active_eq_orders T x y z] + rfl + _ = _ := GroupAssignment.product_branch _ a e _ _ _ + +def joinGroupTargets (counts : Active K tick → JointPopulation.Shape → ℕ) + (e : ∀ sigma : Placement, + JointPopulation.Target (fun h : ActiveOrder K tick sigma => counts h.val)) : + JointPopulation.Target counts := + (activeWordsEquivOrders (fun h => MatrixMultiplication.Foundation.ExactWords (counts h))).symm e + +@[simp] theorem joinGroupTargets_apply (counts : Active K tick → JointPopulation.Shape → ℕ) + (e : ∀ sigma : Placement, + JointPopulation.Target (fun h : ActiveOrder K tick sigma => counts h.val)) + (h : Active K tick) : + joinGroupTargets counts e h = e h.val.physicalOrder ⟨h, rfl⟩ := rfl + +@[simp] theorem joinGroupTargets_on_group + (counts : Active K tick → JointPopulation.Shape → ℕ) + (e : ∀ sigma : Placement, + JointPopulation.Target (fun h : ActiveOrder K tick sigma => counts h.val)) + (sigma : Placement) (h : ActiveOrder K tick sigma) : + joinGroupTargets counts e h.val = e sigma h := by + rcases h with ⟨h, hh⟩ + cases hh + rfl + +theorem joinGroupTargets_injective (counts : Active K tick → JointPopulation.Shape → ℕ) : + Function.Injective (joinGroupTargets counts) := + (activeWordsEquivOrders (fun h => MatrixMultiplication.Foundation.ExactWords (counts h))).symm.injective + +end MatrixMultiplication.AllFieldHistory + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section + +namespace MatrixMultiplication.AllFieldHistoryGroupMasks + +open MatrixMultiplication.Foundation AllFieldHistory AllFieldHistorySupport AllFieldHistoryChildLaws +open AllFieldHistoryMasks AllFieldHistoryRawMasks AllFieldHistoryIncomingMasks +open JointPopulation JointCanonicalization JointCanonicalCW InheritedMasks +open scoped BigOperators +attribute [local instance] Classical.propDecidable Classical.decEq + +variable {K tick : ℕ} + +def groupCounts (allocation : Allocation) (m : ℕ) (sigma : Placement) + (h : ActiveOrder K tick sigma) : JointPopulation.Shape → ℕ := + activeCounts allocation m h.val + +abbrev GroupRaw (allocation : Allocation) (m : ℕ) (sigma : Placement) := + RawPairs (groupCounts (K := K) (tick := tick) allocation m sigma) + (fun h => Fin (activeHalfLength h.val) → Fin 7) + (fun h => Fin (activeHalfLength h.val) → Fin 7) + +def projectRaw (allocation : Allocation) (m : ℕ) (sigma : Placement) + (w : AllFieldHistoryRecovery.Raw (K := K) (tick := tick) allocation m) : + GroupRaw (K := K) (tick := tick) allocation m sigma := fun h j => w h.val j + +def marginal (allocation : Allocation) (m : ℕ) (side : Fin 3) (sigma : Placement) + (w : GroupRaw (K := K) (tick := tick) allocation m sigma) : Prop := + ∀ (h : ActiveOrder K tick sigma) a, + wordPopulation (fun j => coarse activeHalfLength activeHalfLength + AllFieldHistoryRecovery.halfLength_le_eight side h.val (w h j)) a = + wordPopulation (sideWord (activeCounts allocation m) side + (triple (activeCounts allocation m) (canonicalTarget (activeCounts allocation m))) h.val) a + +def incoming (allocation : Allocation) (m : ℕ) (sigma : Placement) + (h : ActiveOrder K tick sigma) (w : GroupRaw (K := K) (tick := tick) allocation m sigma) : + HistoryWord allocation m (h.val.val.1.source, h.val.val.2) := + fun p => joinHalves h.val.val.1 + (w h ((sourcePositionsEquiv allocation m h.val).symm p)) + +def received (allocation : Allocation) (m : ℕ) (ε : ℝ) (side : Fin 3) + (sigma : Placement) (w : GroupRaw (K := K) (tick := tick) allocation m sigma) : Prop := + ∀ h : ActiveOrder K tick sigma, + residentMask allocation m ε (h.val.val.1.source, h.val.val.2) side + (incoming allocation m sigma h w) + +def rawPass (allocation : Allocation) (m : ℕ) (ε : ℝ) (side : Fin 3) + (sigma : Placement) (w : GroupRaw (K := K) (tick := tick) allocation m sigma) : Prop := + ∀ (i : MaskIndex K tick) (hi : i.1.val.physicalOrder = sigma), + |(∑ j : JointPopulation.Positions (activeCounts allocation m) i.1, + if statistic i.1 (w ⟨i.1, hi⟩ j).1 = i.2.1 i.1 ∧ + statistic i.1 (w ⟨i.1, hi⟩ j).2 = i.2.2 i.1 then (1 : ℝ) else 0) / + (population allocation m (i.1.val.1.source, i.1.val.2) : ℝ) - + center allocation side i| ≤ pairWidth ε i.1 + +def completeKeep (allocation : Allocation) (m : ℕ) (ε : ℝ) (side : Fin 3) + (sigma : Placement) (w : GroupRaw (K := K) (tick := tick) allocation m sigma) : Prop := + marginal allocation m side sigma w ∧ received allocation m ε side sigma w ∧ + rawPass allocation m ε side sigma w + +theorem marginal_project (allocation : Allocation) (m : ℕ) (side : Fin 3) + (w : AllFieldHistoryRecovery.Raw (K := K) (tick := tick) allocation m) + (hw : JointCanonicalMixed.sideMask (activeCounts allocation m) + activeHalfLength activeHalfLength AllFieldHistoryRecovery.halfLength_le_eight side w) + (sigma : Placement) : marginal allocation m side sigma (projectRaw allocation m sigma w) := by + intro h a + exact hw h.val a + +theorem received_project (allocation : Allocation) (m : ℕ) (ε : ℝ) (side : Fin 3) + (w : AllFieldHistoryRecovery.Raw (K := K) (tick := tick) allocation m) + (hw : AllFieldHistoryIncomingMasks.received allocation m ε side w) + (sigma : Placement) : received allocation m ε side sigma (projectRaw allocation m sigma w) := by + intro h + exact hw h.val + +theorem rawPass_project (allocation : Allocation) (m : ℕ) (ε : ℝ) (side : Fin 3) + (w : AllFieldHistoryRecovery.Raw (K := K) (tick := tick) allocation m) + (hw : AllFieldHistoryRawMasks.rawPass allocation m ε side w) + (sigma : Placement) : rawPass allocation m ε side sigma (projectRaw allocation m sigma w) := by + intro i hi + exact hw i + +theorem completeKeep_project (allocation : Allocation) (m : ℕ) (ε : ℝ) (side : Fin 3) + (w : AllFieldHistoryRecovery.Raw (K := K) (tick := tick) allocation m) + (hw : AllFieldHistoryRecovery.completeKeep allocation m ε side w) + (sigma : Placement) : completeKeep allocation m ε side sigma + (projectRaw allocation m sigma w) := + ⟨marginal_project allocation m side w hw.1 sigma, + received_project allocation m ε side w hw.2.1 sigma, + rawPass_project allocation m ε side w hw.2.2 sigma⟩ + +theorem completeKeep_iff_all_groups (allocation : Allocation) (m : ℕ) (ε : ℝ) + (side : Fin 3) (w : AllFieldHistoryRecovery.Raw (K := K) (tick := tick) allocation m) : + AllFieldHistoryRecovery.completeKeep allocation m ε side w ↔ + ∀ sigma, completeKeep allocation m ε side sigma (projectRaw allocation m sigma w) := by + refine ⟨fun hw sigma => completeKeep_project allocation m ε side w hw sigma, ?_⟩ + intro hw + refine ⟨?_, ?_, ?_⟩ + · intro h a + exact (hw h.val.physicalOrder).1 ⟨h, rfl⟩ a + · intro h + exact (hw h.val.physicalOrder).2.1 ⟨h, rfl⟩ + · intro i + exact (hw i.1.val.physicalOrder).2.2 i rfl + +def groupRawSource (F : Type*) [CommRing F] (allocation : Allocation) (m : ℕ) + (sigma : Placement) : Tensor F + (GroupRaw (K := K) (tick := tick) allocation m sigma) + (GroupRaw (K := K) (tick := tick) allocation m sigma) (GroupRaw (K := K) (tick := tick) allocation m sigma) := + sourceTensor (groupCounts allocation m sigma) + (fun h => Fin (activeHalfLength h.val) → Fin 7) + (fun h => Fin (activeHalfLength h.val) → Fin 7) + (fun h => AllFieldHistoryRecovery.parents F h.val) + +def groupPreparedSource (F : Type*) [CommRing F] (allocation : Allocation) (m : ℕ) + (ε : ℝ) (sigma : Placement) : Tensor F + (GroupRaw (K := K) (tick := tick) allocation m sigma) + (GroupRaw (K := K) (tick := tick) allocation m sigma) (GroupRaw (K := K) (tick := tick) allocation m sigma) := + ExactRecovery.delete (groupRawSource F allocation m sigma) + (completeKeep allocation m ε 0 sigma) (completeKeep allocation m ε 1 sigma) + (completeKeep allocation m ε 2 sigma) + +theorem rawSource_factor (F : Type*) [CommRing F] (allocation : Allocation) (m : ℕ) + (x y z : AllFieldHistoryRecovery.Raw (K := K) (tick := tick) allocation m) : + AllFieldHistoryRecovery.rawSource F allocation m x y z = + ∏ sigma : Placement, groupRawSource F allocation m sigma + (projectRaw allocation m sigma x) (projectRaw allocation m sigma y) + (projectRaw allocation m sigma z) := + prod_active_eq_prod_orders (fun h => ∏ j, + AllFieldHistoryRecovery.parents F h (x h j) (y h j) (z h j)) + +theorem preparedSource_factor (F : Type*) [CommRing F] (allocation : Allocation) + (m : ℕ) (ε : ℝ) + (x y z : AllFieldHistoryRecovery.Raw (K := K) (tick := tick) allocation m) : + ExactRecovery.delete (AllFieldHistoryRecovery.rawSource F allocation m) + (AllFieldHistoryRecovery.completeKeep allocation m ε 0) + (AllFieldHistoryRecovery.completeKeep allocation m ε 1) + (AllFieldHistoryRecovery.completeKeep allocation m ε 2) x y z = + ∏ sigma : Placement, groupPreparedSource F allocation m ε sigma + (projectRaw allocation m sigma x) (projectRaw allocation m sigma y) + (projectRaw allocation m sigma z) := by + have heq : + (AllFieldHistoryRecovery.completeKeep allocation m ε 0 x ∧ + AllFieldHistoryRecovery.completeKeep allocation m ε 1 y ∧ + AllFieldHistoryRecovery.completeKeep allocation m ε 2 z) ↔ + ∀ sigma : Placement, + completeKeep allocation m ε 0 sigma (projectRaw allocation m sigma x) ∧ + completeKeep allocation m ε 1 sigma (projectRaw allocation m sigma y) ∧ + completeKeep allocation m ε 2 sigma (projectRaw allocation m sigma z) := by + rw [completeKeep_iff_all_groups, completeKeep_iff_all_groups, completeKeep_iff_all_groups] + exact ⟨fun h sigma => ⟨h.1 sigma, h.2.1 sigma, h.2.2 sigma⟩, + fun h => ⟨fun sigma => (h sigma).1, fun sigma => (h sigma).2.1, + fun sigma => (h sigma).2.2⟩⟩ + by_cases h : AllFieldHistoryRecovery.completeKeep allocation m ε 0 x ∧ + AllFieldHistoryRecovery.completeKeep allocation m ε 1 y ∧ + AllFieldHistoryRecovery.completeKeep allocation m ε 2 z + · rw [ExactRecovery.delete, ite_eq_left h, rawSource_factor] + apply Finset.prod_congr rfl + intro sigma _ + exact (ite_eq_left (heq.mp h sigma)).symm + · rw [ExactRecovery.delete, ite_eq_right h] + have hn : ¬∀ sigma : Placement, + completeKeep allocation m ε 0 sigma (projectRaw allocation m sigma x) ∧ + completeKeep allocation m ε 1 sigma (projectRaw allocation m sigma y) ∧ + completeKeep allocation m ε 2 sigma (projectRaw allocation m sigma z) := + fun hh => h (heq.mpr hh) + obtain ⟨sigma, hs⟩ := not_forall.mp hn + exact (Finset.prod_eq_zero (Finset.mem_univ sigma) (ite_eq_right hs)).symm + +end MatrixMultiplication.AllFieldHistoryGroupMasks + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section + +namespace MatrixMultiplication.AllFieldHistorySource + +open MatrixMultiplication.Foundation AllFieldHistory AllFieldFiniteFamily +open AllFieldHistoryRegrouping AllFieldHistoryIncomingMasks +open scoped BigOperators Classical +attribute [local instance] Classical.propDecidable Classical.decEq + +private def deleteWithPred {F : Type*} [Field F] {X Y Z : Type} + [Fintype X] [Fintype Y] [Fintype Z] + (source : Tensor F X Y Z) (px : X → Prop) (py : Y → Prop) (pz : Z → Prop) + [DecidablePred px] [DecidablePred py] [DecidablePred pz] : + LocalMap source (ExactRecovery.delete source px py pz) := by + let d := LocalMap.delete source px py pz + refine ⟨d.x, d.y, d.z, d.coefficient.trans ?_⟩ + funext x y z + unfold ExactRecovery.delete + split_ifs <;> rfl + +variable {K tick : ℕ} (allocation : Allocation) (m : ℕ) + +abbrev Raw := AllFieldHistoryRecovery.Raw (K := K) (tick := tick) allocation m + +def toActive (w : Raw (K := K) (tick := tick) allocation m) : + ActiveWords (K := K) (tick := tick) allocation m := fun h => incomingWord allocation m h w + +theorem parent_coefficient (F : Type*) [Field F] (h : Active K tick) + (x y z : Raw (K := K) (tick := tick) allocation m) : + Tensor.power + (CWStrands.shapeTensor (Fin (currentLength h.val.1.source)) + (currentPhysicalShape (h.val.1.source, h.val.2))) + (population allocation m (h.val.1.source, h.val.2)) + (incomingWord allocation m h x) (incomingWord allocation m h y) + (incomingWord allocation m h z) = + ∏ i : JointPopulation.Positions (activeCounts allocation m) h, + AllFieldHistoryRecovery.parents F h (x h i) (y h i) (z h i) := by + change (∏ p : Fin (population allocation m (h.val.1.source, h.val.2)), + CWStrands.shapeTensor _ _ (incomingWord allocation m h x p) + (incomingWord allocation m h y p) (incomingWord allocation m h z p)) = _ + refine ((sourcePositionsEquiv allocation m h).prod_comp (fun p => + CWStrands.shapeTensor (Fin (currentLength h.val.1.source)) + (currentPhysicalShape (h.val.1.source, h.val.2)) + (incomingWord allocation m h x p) (incomingWord allocation m h y p) + (incomingWord allocation m h z p))).symm.trans ?_ + apply Finset.prod_congr rfl + intro i _ + simp only [incomingWord, Equiv.symm_apply_apply] + erw [shapeTensor_joinHalves] + unfold AllFieldHistoryRecovery.parents JointCanonicalMixed.inputTensor + rw [ite_eq_left rfl] + unfold JointCanonicalCW.parentTensor currentPhysicalShape + rw [source_shape] + rfl + +def receivedSource (F : Type*) [Field F] (ε : ℝ) : + Tensor F (Raw (K := K) (tick := tick) allocation m) (Raw (K := K) (tick := tick) allocation m) (Raw (K := K) (tick := tick) allocation m) := + ExactRecovery.delete (AllFieldHistoryRecovery.rawSource F (K := K) (tick := tick) allocation m) + (received allocation m ε 0) (received allocation m ε 1) (received allocation m ε 2) + +theorem received_coefficient (F : Type*) [Field F] (ε : ℝ) + (x y z : Raw (K := K) (tick := tick) allocation m) : + activeTensor (K := K) (tick := tick) allocation m F ε (toActive allocation m x) (toActive allocation m y) + (toActive allocation m z) = receivedSource (K := K) (tick := tick) allocation m F ε x y z := by + change (∏ h : Active K tick, historyTensor F allocation m ε + (h.val.1.source, h.val.2) (incomingWord allocation m h x) + (incomingWord allocation m h y) (incomingWord allocation m h z)) = _ + unfold receivedSource ExactRecovery.delete + by_cases hp : received allocation m ε 0 x ∧ received allocation m ε 1 y ∧ + received allocation m ε 2 z + · rw [ite_eq_left hp] + change _ = ∏ h : Active K tick, ∏ i : JointPopulation.Positions (activeCounts allocation m) h, + AllFieldHistoryRecovery.parents F h (x h i) (y h i) (z h i) + apply Finset.prod_congr rfl + intro h _ + unfold historyTensor ExactRecovery.delete + rw [ite_eq_left ⟨hp.1 h, hp.2.1 h, hp.2.2 h⟩] + exact parent_coefficient allocation m F h x y z + · rw [ite_eq_right hp] + have hh : ∃ h : Active K tick, + ¬(residentMask allocation m ε (h.val.1.source, h.val.2) 0 (incomingWord allocation m h x) ∧ + residentMask allocation m ε (h.val.1.source, h.val.2) 1 (incomingWord allocation m h y) ∧ + residentMask allocation m ε (h.val.1.source, h.val.2) 2 (incomingWord allocation m h z)) := by + by_contra hn + apply hp + push Not at hn + exact ⟨fun h => (hn h).1, fun h => (hn h).2.1, fun h => (hn h).2.2⟩ + obtain ⟨h, hh⟩ := hh + apply Finset.prod_eq_zero (Finset.mem_univ h) + exact ite_eq_right hh + +def receivedMap (F : Type*) [Field F] (ε : ℝ) : + LocalMap (activeTensor (K := K) (tick := tick) allocation m F ε) + (receivedSource (K := K) (tick := tick) allocation m F ε) := by + apply LocalMap.ofExists + refine ⟨_, _, _, (Tensor.pullback_eq_restrict + (toActive (K := K) (tick := tick) allocation m) + (toActive (K := K) (tick := tick) allocation m) + (toActive (K := K) (tick := tick) allocation m) _).symm.trans ?_⟩ + funext x y z + exact received_coefficient allocation m F ε x y z + +def marginal (side : Fin 3) (w : Raw (K := K) (tick := tick) allocation m) : Prop := + JointCanonicalMixed.sideMask (activeCounts allocation m) activeHalfLength activeHalfLength + AllFieldHistoryRecovery.halfLength_le_eight side w + +def preparedSource (F : Type*) [Field F] (ε : ℝ) : + Tensor F (Raw (K := K) (tick := tick) allocation m) (Raw (K := K) (tick := tick) allocation m) (Raw (K := K) (tick := tick) allocation m) := + ExactRecovery.delete (receivedSource (K := K) (tick := tick) allocation m F ε) + (fun x => marginal (K := K) (tick := tick) allocation m 0 x ∧ AllFieldHistoryRawMasks.rawPass allocation m ε 0 x) + (fun y => marginal (K := K) (tick := tick) allocation m 1 y ∧ AllFieldHistoryRawMasks.rawPass allocation m ε 1 y) + (fun z => marginal (K := K) (tick := tick) allocation m 2 z ∧ AllFieldHistoryRawMasks.rawPass allocation m ε 2 z) + +theorem preparedSource_eq_delete (F : Type*) [Field F] (ε : ℝ) : + preparedSource (K := K) (tick := tick) allocation m F ε = + ExactRecovery.delete (AllFieldHistoryRecovery.rawSource F (K := K) (tick := tick) allocation m) + (AllFieldHistoryRecovery.completeKeep allocation m ε 0) + (AllFieldHistoryRecovery.completeKeep allocation m ε 1) + (AllFieldHistoryRecovery.completeKeep allocation m ε 2) := by + funext x y z + unfold preparedSource receivedSource marginal AllFieldHistoryRecovery.completeKeep + ExactRecovery.delete + split_ifs <;> simp_all only [and_true, true_and, not_false_eq_true] + all_goals tauto + +def preparedMap (F : Type*) [Field F] (ε : ℝ) : + LocalMap (activeTensor (K := K) (tick := tick) allocation m F ε) + (preparedSource (K := K) (tick := tick) allocation m F ε) := + (receivedMap (K := K) (tick := tick) allocation m F ε).comp (deleteWithPred (receivedSource (K := K) (tick := tick) allocation m F ε) + (fun x => marginal (K := K) (tick := tick) allocation m 0 x ∧ AllFieldHistoryRawMasks.rawPass allocation m ε 0 x) + (fun y => marginal (K := K) (tick := tick) allocation m 1 y ∧ AllFieldHistoryRawMasks.rawPass allocation m ε 1 y) + (fun z => marginal (K := K) (tick := tick) allocation m 2 z ∧ AllFieldHistoryRawMasks.rawPass allocation m ε 2 z)) + +abbrev GroupWords := ∀ sigma : Placement, + AllFieldHistoryGroupMasks.GroupRaw (K := K) (tick := tick) allocation m sigma + +def groupsEquiv : Raw (K := K) (tick := tick) allocation m ≃ + GroupWords (K := K) (tick := tick) allocation m := + activeWordsEquivOrders (fun h : Active K tick => + JointPopulation.Positions (activeCounts allocation m) h → + ((Fin (activeHalfLength h) → Fin 7) × (Fin (activeHalfLength h) → Fin 7))) + +@[simp] theorem project_groups_symm + (x : GroupWords (K := K) (tick := tick) allocation m) (sigma : Placement) : + AllFieldHistoryGroupMasks.projectRaw allocation m sigma + ((groupsEquiv allocation m).symm x) = x sigma := + congrFun ((groupsEquiv allocation m).apply_symm_apply x) sigma + +theorem grouped_coefficient (F : Type*) [Field F] (ε : ℝ) + (x y z : GroupWords (K := K) (tick := tick) allocation m) : + preparedSource (K := K) (tick := tick) allocation m F ε + ((groupsEquiv allocation m).symm x) ((groupsEquiv allocation m).symm y) + ((groupsEquiv allocation m).symm z) = + CommonDimensions.familyProduct + (fun sigma => AllFieldHistoryGroupMasks.groupPreparedSource F allocation m ε sigma) + x y z := by + rw [preparedSource_eq_delete, AllFieldHistoryGroupMasks.preparedSource_factor] + simp only [project_groups_symm, CommonDimensions.familyProduct] + +def groupsMap (F : Type*) [Field F] (ε : ℝ) : + LocalMap (preparedSource (K := K) (tick := tick) allocation m F ε) + (CommonDimensions.familyProduct (fun sigma : Placement => + AllFieldHistoryGroupMasks.groupPreparedSource F (K := K) (tick := tick) + allocation m ε sigma)) := by + apply LocalMap.ofExists + refine ⟨_, _, _, (Tensor.pullback_eq_restrict + (groupsEquiv (K := K) (tick := tick) allocation m).symm + (groupsEquiv (K := K) (tick := tick) allocation m).symm + (groupsEquiv (K := K) (tick := tick) allocation m).symm _).symm.trans ?_⟩ + funext x y z + exact grouped_coefficient allocation m F ε x y z + +end MatrixMultiplication.AllFieldHistorySource + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section + +namespace MatrixMultiplication.AllFieldHistoryGroupedRecovery + +open AllFieldHistory AllFieldHistorySupport AllFieldHistoryChildLaws +open AllFieldHistoryGroupMasks JointPopulation JointCanonicalization JointCanonicalCW +open PermutationMatching +open scoped BigOperators +attribute [local instance] Classical.propDecidable Classical.decEq + +variable {K tick : ℕ} + +abbrev GroupTarget (allocation : Allocation) (m : ℕ) (sigma : Placement) := + Target (groupCounts (K := K) (tick := tick) allocation m sigma) + +def projectTarget (allocation : Allocation) (m : ℕ) (sigma : Placement) + (e : AllFieldHistoryRecovery.Targets (K := K) (tick := tick) allocation m) : + GroupTarget (K := K) (tick := tick) allocation m sigma := fun h => e h.val + +def groupCoordinates (allocation : Allocation) (m : ℕ) (sigma : Placement) + (e : GroupTarget (K := K) (tick := tick) allocation m sigma) := + pairEquiv (groupCounts allocation m sigma) + (fun h => Fin (activeHalfLength h.val) → Fin 7) + (fun h => Fin (activeHalfLength h.val) → Fin 7) e + +def groupCoarse {sigma : Placement} (side : Fin 3) (h : ActiveOrder K tick sigma) + (w : (Fin (activeHalfLength h.val) → Fin 7) × (Fin (activeHalfLength h.val) → Fin 7)) := + coarse activeHalfLength activeHalfLength AllFieldHistoryRecovery.halfLength_le_eight + side h.val w + +def groupIdealSide (allocation : Allocation) (m : ℕ) (ε : ℝ) (side : Fin 3) + (sigma : Placement) (e : GroupTarget (K := K) (tick := tick) allocation m sigma) + (w : GroupRaw (K := K) (tick := tick) allocation m sigma) : Prop := + coarseMask (groupCounts allocation m sigma) + (fun h => Fin (activeHalfLength h.val) → Fin 7) + (fun h => Fin (activeHalfLength h.val) → Fin 7) groupCoarse side e w ∧ + rawWindows (SL := fun h : ActiveOrder K tick sigma => Statistic h.val) + (SR := fun h : ActiveOrder K tick sigma => Statistic h.val) + (groupCounts allocation m sigma) + (fun h => Fin (activeHalfLength h.val) → Fin 7) + (fun h => Fin (activeHalfLength h.val) → Fin 7) + (fun c => statistic c.1.val) (fun c => statistic c.1.val) + (fun c => leftLaw c.1.val c.2 side) (fun c => rightLaw c.1.val c.2 side) + (fun c => AllFieldHistoryMasks.childWidth ε c.1.val) + (fun c => AllFieldHistoryMasks.childWidth ε c.1.val) e w + +end MatrixMultiplication.AllFieldHistoryGroupedRecovery + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/Histories/HistoryIteration.lean b/lean/OAI/LinearAlgebra/MatrixFields/Histories/HistoryIteration.lean new file mode 100644 index 0000000000000000000000000000000000000000..e1222dd961f1f8132e63b019fccd4549b9750d0d --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/Histories/HistoryIteration.lean @@ -0,0 +1,1066 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Construction.GroupAssignments +import OAI.LinearAlgebra.MatrixFields.Construction.Subdivision +import OAI.LinearAlgebra.MatrixFields.Extraction.GroupSelection + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.AllFieldHistory + +open MatrixMultiplication.Foundation AllFieldParameters JointPopulation +open CWStrands HistorySymmetry InheritedMasks JointCanonicalization +open scoped BigOperators +attribute [local instance] Classical.propDecidable Classical.decEq + +variable {K tick : ℕ} (allocation : Allocation) (dilation : ℕ) + +abbrev CanonicalWords := CanonicalPairs (activeCounts (K := K) (tick := tick) allocation dilation) + (JointCanonicalCW.Left activeHalfLength) (JointCanonicalCW.Right activeHalfLength) + +abbrev ProducedWords := ∀ h : Produced K tick, + Fin (population allocation dilation h.val) → Fin (currentLength h.val.1) → Fin 7 + +abbrev CanonicalClassPosition := + Σ c : Active K tick × JointPopulation.Shape, Fin (activeCounts allocation dilation c.1 c.2) + +abbrev CanonicalHalfPosition := + CanonicalClassPosition (K := K) (tick := tick) allocation dilation × Bool + +def canonicalClassEquiv : CanonicalClassPosition (K := K) (tick := tick) allocation dilation ≃ + (Σ h : Active K tick, Σ u : JointPopulation.Shape, Fin (activeCounts allocation dilation h u)) where + toFun p := ⟨p.1.1, p.1.2, p.2⟩ + invFun p := ⟨(p.1, p.2.1), p.2.2⟩ + left_inv _ := rfl + right_inv _ := rfl + +def splitArrangeEquiv : + (Σ h : Active K tick, Σ b : h.val.1.Branch, + Fin (branchPopulation allocation dilation h.val b)) × Bool ≃ + SplitPositions (K := K) (tick := tick) allocation dilation where + toFun p := ⟨p.1.1, p.1.2.1, p.2, p.1.2.2⟩ + invFun p := (⟨p.1, p.2.1, p.2.2.2⟩, p.2.2.1) + left_inv _ := rfl + right_inv _ := rfl + +def canonicalSplitEquiv : + CanonicalHalfPosition (K := K) (tick := tick) allocation dilation ≃ + SplitPositions (K := K) (tick := tick) allocation dilation := + (Equiv.prodCongr + ((canonicalClassEquiv allocation dilation).trans + (Equiv.sigmaCongrRight fun h : Active K tick => + branchPositionEquiv allocation dilation h.val)) + (Equiv.refl Bool)).trans (splitArrangeEquiv allocation dilation) + +def canonicalProducedEquiv : + CanonicalHalfPosition (K := K) (tick := tick) allocation dilation ≃ + ProducedPositions (K := K) (tick := tick) allocation dilation := + (canonicalSplitEquiv allocation dilation).trans + (producedPositionEquiv allocation dilation).symm + +theorem splitProduced_length (p : SplitPositions (K := K) (tick := tick) allocation dilation) : + currentLength ((producedPositionEquiv allocation dilation).symm p).1.val.1 = + activeHalfLength p.1 := by + simpa only [Equiv.apply_symm_apply, activeHalfLength] using + producedPositionEquiv_length allocation dilation + ((producedPositionEquiv allocation dilation).symm p) + +def splitWord (x : ProducedWords (K := K) (tick := tick) allocation dilation) + (p : SplitPositions (K := K) (tick := tick) allocation dilation) : + Fin (activeHalfLength p.1) → Fin 7 := + let q := (producedPositionEquiv allocation dilation).symm p + fun i => x q.1 q.2 (Fin.cast (splitProduced_length allocation dilation p).symm i) + +def producedHalfWord (x : ProducedWords (K := K) (tick := tick) allocation dilation) + (h : Active K tick) (b : h.val.1.Branch) (right : Bool) : + Fin (branchPopulation allocation dilation h.val b) → Fin (activeHalfLength h) → Fin 7 := + fun i => splitWord allocation dilation x ⟨h, b, right, i⟩ + +def regroupAt (x : ProducedWords (K := K) (tick := tick) allocation dilation) + (p : CanonicalHalfPosition (K := K) (tick := tick) allocation dilation) : + Fin (activeHalfLength p.1.1.1) → Fin 7 := + splitWord allocation dilation x (canonicalSplitEquiv allocation dilation p) + +def regroupWords (x : ProducedWords (K := K) (tick := tick) allocation dilation) : + CanonicalWords (K := K) (tick := tick) allocation dilation where + left c i := regroupAt allocation dilation x (⟨c, i⟩, false) + right c i := regroupAt allocation dilation x (⟨c, i⟩, true) + +def branchClassEquiv (h : Active K tick) (b : h.val.1.Branch) : + Fin (branchPopulation allocation dilation h.val b) ≃ + Fin (activeCounts allocation dilation h (branchShape h.val b)) := + { toFun := fun i => ⟨i.val, by + change i.val < jointCounts allocation dilation h.val (branchShape h.val b) + rw [jointCounts_at] + exact i.isLt⟩ + invFun := fun i => ⟨i.val, by + simpa only [activeCounts, jointCounts_at] using i.isLt⟩ + left_inv := fun _ => rfl + right_inv := fun _ => rfl } + +def branchClassIndex (h : Active K tick) (b : h.val.1.Branch) + (i : Fin (branchPopulation allocation dilation h.val b)) : + Fin (activeCounts allocation dilation h (branchShape h.val b)) := + branchClassEquiv allocation dilation h b i + +theorem regroupWords_branch (x : ProducedWords (K := K) (tick := tick) allocation dilation) + (h : Active K tick) (b : h.val.1.Branch) (right : Bool) + (i : Fin (branchPopulation allocation dilation h.val b)) : + (if right then (regroupWords allocation dilation x).right + (h, branchShape h.val b) (branchClassIndex allocation dilation h b i) + else (regroupWords allocation dilation x).left + (h, branchShape h.val b) (branchClassIndex allocation dilation h b i)) = + producedHalfWord allocation dilation x h b right i := by + have he := (branchPositionEquiv allocation dilation h.val).apply_symm_apply ⟨b, i⟩ + cases right <;> simp only [Bool.false_eq_true, ↓reduceIte] + · exact congrArg (fun q : Σ b : h.val.1.Branch, + Fin (branchPopulation allocation dilation h.val b) => + producedHalfWord allocation dilation x h q.1 false q.2) he + · exact congrArg (fun q : Σ b : h.val.1.Branch, + Fin (branchPopulation allocation dilation h.val b) => + producedHalfWord allocation dilation x h q.1 true q.2) he + +def canonicalHalfShape + (p : CanonicalHalfPosition (K := K) (tick := tick) allocation dilation) : AllFieldParameters.Shape := + if p.2 then activeParentShape p.1.1.1 - JointCanonicalCW.shapeNat p.1.1.2 + else JointCanonicalCW.shapeNat p.1.1.2 + +theorem canonicalProduced_length + (p : CanonicalHalfPosition (K := K) (tick := tick) allocation dilation) : + currentLength (canonicalProducedEquiv allocation dilation p).1.val.1 = + activeHalfLength p.1.1.1 := + splitProduced_length allocation dilation (canonicalSplitEquiv allocation dilation p) + +theorem canonicalProduced_shape + (p : CanonicalHalfPosition (K := K) (tick := tick) allocation dilation) : + currentPhysicalShape (canonicalProducedEquiv allocation dilation p).1.val = + canonicalHalfShape allocation dilation p := by + let w := p.1.1.1 + let q := branchPositionEquiv allocation dilation w.val ⟨p.1.1.2, p.1.2⟩ + have hu : physicalShape w.val.2 (w.val.1.splitShape q.1) = + JointCanonicalCW.shapeNat p.1.1.2 := by + change physicalShape w.val.2 (w.val.1.splitShape q.1) = decodeShape p.1.1.2 + have hh := congrArg decodeShape + (branchPositionEquiv_shape allocation dilation w.val ⟨p.1.1.2, p.1.2⟩) + simpa only [branchShape, decode_encodePhysicalShape] using hh + let shapeOfSplit (r : SplitPositions (K := K) (tick := tick) allocation dilation) : + AllFieldParameters.Shape := + physicalShape r.1.val.2 (halfShape r.1.val.1.parentShape + (r.1.val.1.splitShape r.2.1) r.2.2.1) + have hs : currentPhysicalShape + ((producedPositionEquiv allocation dilation).symm + (canonicalSplitEquiv allocation dilation p)).1.val = + shapeOfSplit ((producedPositionEquiv allocation dilation) + ((producedPositionEquiv allocation dilation).symm + (canonicalSplitEquiv allocation dilation p))) := + producedPositionEquiv_shape allocation dilation + ((producedPositionEquiv allocation dilation).symm + (canonicalSplitEquiv allocation dilation p)) + rw [Equiv.apply_symm_apply] at hs + change currentPhysicalShape (canonicalProducedEquiv allocation dilation p).1.val = + physicalShape w.val.2 (halfShape w.val.1.parentShape + (w.val.1.splitShape q.1) p.2) at hs + rw [hs] + cases hr : p.2 <;> + simp [canonicalHalfShape, halfShape, hr, physicalShape_complement, hu, + activeParentShape] + rfl + +variable {F : Type*} [Field F] + +theorem shapeTensor_finCast {m n : ℕ} (h : m = n) (g : AllFieldParameters.Shape) + (x y z : Fin n → Fin 7) : + shapeTensor (F := F) (Fin m) g (x ∘ Fin.cast h) (y ∘ Fin.cast h) (z ∘ Fin.cast h) = + shapeTensor (Fin n) g x y z := by + cases h + rfl + +def canonicalChildren : Tensor F + (CanonicalWords (K := K) (tick := tick) allocation dilation) + (CanonicalWords (K := K) (tick := tick) allocation dilation) + (CanonicalWords (K := K) (tick := tick) allocation dilation) := + pairClassProduct (P := ClassPositions (activeCounts allocation dilation)) + (JointCanonicalCW.leftTensor activeHalfLength) + (JointCanonicalCW.rightTensor activeHalfLength activeParentShape) + +def producedBase : Tensor F + (ProducedWords (K := K) (tick := tick) allocation dilation) + (ProducedWords (K := K) (tick := tick) allocation dilation) + (ProducedWords (K := K) (tick := tick) allocation dilation) := + CommonDimensions.familyProduct (fun h : Produced K tick => + Tensor.power (shapeTensor (Fin (currentLength h.val.1)) (currentPhysicalShape h.val)) + (population allocation dilation h.val)) + +def canonicalHalfWord (x : CanonicalWords (K := K) (tick := tick) allocation dilation) + (p : CanonicalHalfPosition (K := K) (tick := tick) allocation dilation) : + Fin (activeHalfLength p.1.1.1) → Fin 7 := + if p.2 then x.right p.1.1 p.1.2 else x.left p.1.1 p.1.2 + +theorem regroupWords_half (x : ProducedWords (K := K) (tick := tick) allocation dilation) + (p : CanonicalHalfPosition (K := K) (tick := tick) allocation dilation) : + canonicalHalfWord allocation dilation (regroupWords allocation dilation x) p = + regroupAt allocation dilation x p := by + rcases p with ⟨⟨c, i⟩, right⟩ + cases right <;> simp only [canonicalHalfWord, regroupWords, Bool.false_eq_true, ↓reduceIte] + +theorem canonicalChildren_flat + (x y z : CanonicalWords (K := K) (tick := tick) allocation dilation) : + canonicalChildren (F := F) allocation dilation x y z = + ∏ p : CanonicalHalfPosition (K := K) (tick := tick) allocation dilation, + shapeTensor (Fin (activeHalfLength p.1.1.1)) (canonicalHalfShape allocation dilation p) + (canonicalHalfWord allocation dilation x p) + (canonicalHalfWord allocation dilation y p) + (canonicalHalfWord allocation dilation z p) := by + simp only [CanonicalHalfPosition, Fintype.prod_prod_type, CanonicalClassPosition, + Fintype.prod_sigma, Fintype.prod_bool, canonicalHalfShape, canonicalHalfWord, + Bool.false_eq_true, ↓reduceIte, Finset.prod_mul_distrib, + canonicalChildren, pairClassProduct, classProduct, JointCanonicalCW.leftTensor, + JointCanonicalCW.rightTensor] + exact mul_comm _ _ + +theorem producedBase_flat + (x y z : ProducedWords (K := K) (tick := tick) allocation dilation) : + producedBase (F := F) allocation dilation x y z = + ∏ p : ProducedPositions (K := K) (tick := tick) allocation dilation, + shapeTensor (Fin (currentLength p.1.val.1)) (currentPhysicalShape p.1.val) + (x p.1 p.2) (y p.1 p.2) (z p.1 p.2) := by + simp only [producedBase, CommonDimensions.familyProduct, Tensor.power, + ProducedPositions, Fintype.prod_sigma] + +theorem regroup_coefficient_at + (x y z : ProducedWords (K := K) (tick := tick) allocation dilation) + (p : CanonicalHalfPosition (K := K) (tick := tick) allocation dilation) : + shapeTensor (F := F) (Fin (activeHalfLength p.1.1.1)) (canonicalHalfShape allocation dilation p) + (regroupAt allocation dilation x p) (regroupAt allocation dilation y p) + (regroupAt allocation dilation z p) = + shapeTensor (Fin (currentLength (canonicalProducedEquiv allocation dilation p).1.val.1)) + (currentPhysicalShape (canonicalProducedEquiv allocation dilation p).1.val) + (x (canonicalProducedEquiv allocation dilation p).1 (canonicalProducedEquiv allocation dilation p).2) + (y (canonicalProducedEquiv allocation dilation p).1 (canonicalProducedEquiv allocation dilation p).2) + (z (canonicalProducedEquiv allocation dilation p).1 (canonicalProducedEquiv allocation dilation p).2) := by + rw [← canonicalProduced_shape allocation dilation p] + exact shapeTensor_finCast (canonicalProduced_length allocation dilation p).symm _ _ _ _ + +theorem regroup_coefficient + (x y z : ProducedWords (K := K) (tick := tick) allocation dilation) : + canonicalChildren (F := F) allocation dilation + (regroupWords allocation dilation x) (regroupWords allocation dilation y) + (regroupWords allocation dilation z) = producedBase allocation dilation x y z := by + rw [canonicalChildren_flat, producedBase_flat] + simp only [regroupWords_half] + exact Fintype.prod_equiv (canonicalProducedEquiv allocation dilation) _ _ + (regroup_coefficient_at allocation dilation x y z) + +theorem regroup_pullback : + Tensor.pullback (regroupWords allocation dilation) (regroupWords allocation dilation) + (regroupWords allocation dilation) (canonicalChildren (F := F) allocation dilation) = + producedBase (K := K) (tick := tick) allocation dilation := by + funext x y z + exact regroup_coefficient allocation dilation x y z + +def regroupMatrix : + ProducedWords (K := K) (tick := tick) allocation dilation → + CanonicalWords (K := K) (tick := tick) allocation dilation → F := + fun x s => if s = regroupWords allocation dilation x then 1 else 0 + +def producedBaseMap : + AllFieldFiniteFamily.LocalMap + (canonicalChildren (F := F) (K := K) (tick := tick) allocation dilation) + (producedBase (F := F) (K := K) (tick := tick) allocation dilation) where + x := regroupMatrix allocation dilation + y := regroupMatrix allocation dilation + z := regroupMatrix allocation dilation + coefficient := by + unfold regroupMatrix + rw [← Tensor.pullback_eq_restrict] + exact regroup_pullback allocation dilation + +end MatrixMultiplication.AllFieldHistory + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section + +namespace MatrixMultiplication.AllFieldHistoryProducedMasks + +open MatrixMultiplication.Foundation AllFieldParameters AllFieldHistory +open AllFieldHistoryChildLaws InheritedMasks +open JointCanonicalization +open scoped BigOperators +attribute [local instance] Classical.propDecidable Classical.decEq + +variable {K tick : ℕ} + +def nativeChildWidth (ε : ℝ) (h : Active K tick) : ℝ := + (ε / 16 ^ h.val.1.stage.val) / 8 + +def halfPositionEquiv (allocation : Allocation) (dilation : ℕ) + (w : PlacedWork K) (b : w.1.Branch) (right : Bool) : + Fin (branchPopulation allocation dilation w b) ≃ + Fin (population allocation dilation (w.1.child b right, w.2)) where + toFun := halfPosition allocation dilation w b right + invFun := unhalfPosition allocation dilation w b right + left_inv := unhalf_halfPosition allocation dilation w b right + right_inv := half_unhalfPosition allocation dilation w b right + +def childHalfWord (allocation : Allocation) (dilation : ℕ) + (h : Active K tick) (b : h.val.1.Branch) (right : Bool) + (v : HistoryWord allocation dilation (h.val.1.child b right, h.val.2)) : + Fin (branchPopulation allocation dilation h.val b) → + Fin (activeHalfLength h) → Fin 7 := + fun i j => v (halfPosition allocation dilation h.val b right i) + (Fin.cast (child_length h.val.1 b right).symm j) + +theorem subsingleton_typeWindow {P A : Type*} [Fintype P] [Nonempty P] + [Subsingleton A] [DecidableEq A] (η : ℝ) (hη : 0 ≤ η) (w : P → A) : + typeWindow (fun _ : A => 1) η w := by + intro a + have hcount : wordPopulation w a = Fintype.card P := by + apply Fintype.card_congr + exact + { toFun := Subtype.val + invFun := fun i => ⟨i, Subsingleton.elim _ _⟩ + left_inv := fun i => Subtype.ext rfl + right_inv := fun i => rfl } + have hpos : (0 : ℝ) < Fintype.card P := by + exact_mod_cast (Fintype.card_pos : 0 < Fintype.card P) + simpa only [empiricalLaw, hcount, div_self (ne_of_gt hpos), sub_self, abs_zero] using hη + +theorem childHalfWord_window (allocation : Allocation) (dilation : ℕ) + {ε : ℝ} (hε : 0 ≤ ε) (side : Fin 3) + (h : Active K tick) (b : h.val.1.Branch) (right : Bool) + (v : HistoryWord allocation dilation (h.val.1.child b right, h.val.2)) + (hv : residentMask allocation dilation ε (h.val.1.child b right, h.val.2) side v) + (hp : 0 < branchPopulation allocation dilation h.val b) : + typeWindow (fun a => (h.val.1.childLaw + (halfShape h.val.1.parentShape (h.val.1.splitShape b) right) + (h.val.2.symm side) a : ℝ)) (nativeChildWidth ε h) + (h.val.1.statistic ∘ childHalfWord allocation dilation h b right v) := by + rcases h with ⟨⟨work, phi⟩, ht⟩ + cases work with + | stageA parent => + have hp' : 0 < population allocation dilation + ((Work.stageA parent).child b right, phi) := by + rw [branchPopulation_half allocation dilation (.stageA parent, phi) b right] + exact hp + have hw := (Subdivision.typeWindow_reindex + (residentLaw ((Work.stageA parent).child b right, phi) side) + (ε / 8) (fun i => residentStatistic ((Work.stageA parent).child b right) (v i)) + (halfPositionEquiv allocation dilation (.stageA parent, phi) b right)).mpr (hv hp') + have he : nativeChildWidth ε (⟨(.stageA parent, phi), ht⟩ : Active K tick) = ε / 8 := by + norm_num [nativeChildWidth, Work.stage] + rw [he] + exact hw + | stageB parent => + have hp' : 0 < population allocation dilation + ((Work.stageB parent).child b right, phi) := by + rw [branchPopulation_half allocation dilation (.stageB parent, phi) b right] + exact hp + have hw := (Subdivision.typeWindow_reindex + (residentLaw ((Work.stageB parent).child b right, phi) side) + (ε / 128) (fun i => residentStatistic ((Work.stageB parent).child b right) (v i)) + (halfPositionEquiv allocation dilation (.stageB parent, phi) b right)).mpr (hv hp') + have he : nativeChildWidth ε (⟨(.stageB parent, phi), ht⟩ : Active K tick) = ε / 128 := by + norm_num [nativeChildWidth, Work.stage, div_div] + rw [he] + exact hw + | stageC parent => + let : Nonempty (Fin (branchPopulation allocation dilation (.stageC parent, phi) b)) := + ⟨⟨0, hp⟩⟩ + let : Subsingleton (Work.stageC parent).Statistic := by + change Subsingleton PUnit + infer_instance + simp only [Work.childLaw, Rat.cast_one] + apply subsingleton_typeWindow + unfold nativeChildWidth + positivity + +theorem afterB_mask_of_part_masks (allocation : Allocation) (dilation : ℕ) + {ε : ℝ} (hε : 0 ≤ ε) (h : BPositive K) (phi : Placement) (side : Fin 3) + (w : ∀ i : Fin 3, HistoryWord allocation dilation (.partC (h, i), phi)) + (hw : ∀ i, residentMask allocation dilation ε (.partC (h, i), phi) side (w i)) : + residentMask allocation dilation ε (.afterB h.val, phi) side + (fun j => w (bSubdivisionPositionEquiv allocation dilation h phi j).1 + (bSubdivisionPositionEquiv allocation dilation h phi j).2) := by + intro hp + let P : Fin 3 → Type := fun i => + Fin (population allocation dilation (.partC (h, i), phi)) + let e := bSubdivisionPositionEquiv allocation dilation h phi + have hsize : 0 < Fintype.card (Σ i, P i) := by + rw [← Fintype.card_congr e] + simpa only [Fintype.card_fin] using hp + have hwidth : ∀ _ : Fin 3, ε / 256 ≤ ε / 128 := by + intro i + linarith + have hparts : Subdivision.partWindows P + (residentLaw (.afterB h.val, phi) side) (fun _ => ε / 256) + (fun i => CWCompleteStatistics.twoStatistic ∘ w i) := by + intro i hi + have hi' : 0 < population allocation dilation (.partC (h, i), phi) := by + simpa only [P, Fintype.card_fin] using hi + exact hw i hi' + exact Subdivision.statisticWindow_concatenate_at + (A := ResidentStatistic (.afterB h.val)) P e CWCompleteStatistics.twoStatistic + (residentLaw (.afterB h.val, phi) side) (ε / 128) (fun _ => ε / 256) + (div_nonneg hε (by norm_num)) hwidth hsize w hparts + +def producedChildWord (allocation : Allocation) (dilation : ℕ) + (x : ProducedWords (K := K) (tick := tick) allocation dilation) + (h : Active K tick) (b : h.val.1.Branch) (right : Bool) : + HistoryWord allocation dilation (h.val.1.child b right, h.val.2) := by + rcases h with ⟨⟨work, phi⟩, ht⟩ + cases work with + | stageA parent => exact x ⟨(.afterA ⟨parent, b, right⟩, phi), ht.symm⟩ + | stageB parent => + by_cases hp : positive (bShape (⟨parent, b, right⟩ : AfterB K)) = true + · let g : BPositive K := ⟨⟨parent, b, right⟩, hp⟩ + let e := bSubdivisionPositionEquiv allocation dilation g phi + exact fun j => x ⟨(.partC (g, (e j).1), phi), ht.symm⟩ (e j).2 + · exact x ⟨(.afterB ⟨parent, b, right⟩, phi), ht.symm, hp⟩ + | stageC parent => exact x ⟨(.afterC (parent, b, right), phi), ht.symm⟩ + +theorem producedChildWord_mask (allocation : Allocation) (dilation : ℕ) + {ε : ℝ} (hε : 0 ≤ ε) (side : Fin 3) + (x : ProducedWords (K := K) (tick := tick) allocation dilation) + (hx : ∀ h : Produced K tick, residentMask allocation dilation ε h.val side (x h)) + (h : Active K tick) (b : h.val.1.Branch) (right : Bool) : + residentMask allocation dilation ε (h.val.1.child b right, h.val.2) side + (producedChildWord allocation dilation x h b right) := by + rcases h with ⟨⟨work, phi⟩, ht⟩ + cases work with + | stageA parent => exact hx ⟨(.afterA ⟨parent, b, right⟩, phi), ht.symm⟩ + | stageB parent => + by_cases hp : positive (bShape (⟨parent, b, right⟩ : AfterB K)) = true + · simp only [producedChildWord] + erw [dite_eq_left hp] + exact afterB_mask_of_part_masks allocation dilation hε + ⟨⟨parent, b, right⟩, hp⟩ phi side + (fun i => x ⟨(.partC (⟨⟨parent, b, right⟩, hp⟩, i), phi), ht.symm⟩) + (fun i => hx ⟨(.partC (⟨⟨parent, b, right⟩, hp⟩, i), phi), ht.symm⟩) + · simp only [producedChildWord] + erw [dite_eq_right hp] + exact hx (⟨(.afterB ⟨parent, b, right⟩, phi), ht.symm, hp⟩ : Produced K tick) + | stageC parent => trivial + +private theorem splitWord_eq_of_position (allocation : Allocation) (dilation : ℕ) + (x : ProducedWords (K := K) (tick := tick) allocation dilation) + (p : SplitPositions (K := K) (tick := tick) allocation dilation) + (q : ProducedPositions (K := K) (tick := tick) allocation dilation) + (hq : (producedPositionEquiv allocation dilation).symm p = q) + (hlen : currentLength q.1.val.1 = activeHalfLength p.1) : + splitWord allocation dilation x p = + fun i => x q.1 q.2 (Fin.cast hlen.symm i) := by + subst q + rfl + +theorem producedHalfWord_eq_childHalfWord (allocation : Allocation) (dilation : ℕ) + (x : ProducedWords (K := K) (tick := tick) allocation dilation) + (h : Active K tick) (b : h.val.1.Branch) (right : Bool) : + producedHalfWord allocation dilation x h b right = + childHalfWord allocation dilation h b right + (producedChildWord allocation dilation x h b right) := by + rcases h with ⟨⟨work, phi⟩, ht⟩ + cases work with + | stageA parent => rfl + | stageB parent => + by_cases hp : positive (bShape (⟨parent, b, right⟩ : AfterB K)) = true + · funext i + let g : BPositive K := ⟨⟨parent, b, right⟩, hp⟩ + let part := bSubdivisionPositionEquiv allocation dilation g phi + (halfPosition allocation dilation (.stageB parent, phi) b right i) + let q : ProducedPositions (K := K) (tick := tick) allocation dilation := + ⟨⟨(.partC (g, part.1), phi), ht.symm⟩, part.2⟩ + have hq : (producedPositionEquiv allocation dilation).symm + ⟨⟨(.stageB parent, phi), ht⟩, b, right, i⟩ = q := by + simp only [producedPositionEquiv, Equiv.symm, Equiv.coe_fn_mk, + splitToProduced, dite_eq_left hp] + rfl + simp only [producedHalfWord, producedChildWord] + erw [dite_eq_left hp] + exact splitWord_eq_of_position allocation dilation x + ⟨⟨(.stageB parent, phi), ht⟩, b, right, i⟩ q hq rfl + · funext i + let q : ProducedPositions (K := K) (tick := tick) allocation dilation := + ⟨⟨(.afterB ⟨parent, b, right⟩, phi), ht.symm, hp⟩, + halfPosition allocation dilation (.stageB parent, phi) b right i⟩ + have hq : (producedPositionEquiv allocation dilation).symm + ⟨⟨(.stageB parent, phi), ht⟩, b, right, i⟩ = q := by + simp only [producedPositionEquiv, Equiv.symm, Equiv.coe_fn_mk, + splitToProduced, dite_eq_right hp] + rfl + simp only [producedHalfWord, producedChildWord] + erw [dite_eq_right hp] + exact splitWord_eq_of_position allocation dilation x + ⟨⟨(.stageB parent, phi), ht⟩, b, right, i⟩ q hq rfl + | stageC parent => rfl + +theorem producedHalfWord_window (allocation : Allocation) (dilation : ℕ) + {ε : ℝ} (hε : 0 ≤ ε) (side : Fin 3) + (x : ProducedWords (K := K) (tick := tick) allocation dilation) + (hx : ∀ h : Produced K tick, residentMask allocation dilation ε h.val side (x h)) + (h : Active K tick) (b : h.val.1.Branch) (right : Bool) + (hp : 0 < branchPopulation allocation dilation h.val b) : + typeWindow (fun a => (h.val.1.childLaw + (halfShape h.val.1.parentShape (h.val.1.splitShape b) right) + (h.val.2.symm side) a : ℝ)) (nativeChildWidth ε h) + (h.val.1.statistic ∘ producedHalfWord allocation dilation x h b right) := by + rw [producedHalfWord_eq_childHalfWord] + exact childHalfWord_window allocation dilation hε side h b right _ + (producedChildWord_mask allocation dilation hε side x hx h b right) hp + +theorem regroupBranch_window (allocation : Allocation) (dilation : ℕ) + {ε : ℝ} (hε : 0 ≤ ε) (side : Fin 3) + (x : ProducedWords (K := K) (tick := tick) allocation dilation) + (hx : ∀ h : Produced K tick, residentMask allocation dilation ε h.val side (x h)) + (h : Active K tick) (b : h.val.1.Branch) (right : Bool) + (hp : 0 < branchPopulation allocation dilation h.val b) : + typeWindow (fun a => (placedChildLawRat h.val (branchShape h.val b) side right a : ℝ)) + (nativeChildWidth ε h) + (statistic h ∘ (if right then (regroupWords allocation dilation x).right + (h, branchShape h.val b) else (regroupWords allocation dilation x).left + (h, branchShape h.val b))) := by + apply (Subdivision.typeWindow_reindex _ _ _ (branchClassEquiv allocation dilation h b)).mp + have he : (statistic h ∘ (if right then (regroupWords allocation dilation x).right + (h, branchShape h.val b) else (regroupWords allocation dilation x).left + (h, branchShape h.val b))) ∘ branchClassEquiv allocation dilation h b = + h.val.1.statistic ∘ producedHalfWord allocation dilation x h b right := by + funext i + have hi := regroupWords_branch allocation dilation x h b right i + cases right <;> exact congrArg h.val.1.statistic hi + rw [he] + simpa only [placedChildLawRat_branchShape] using + producedHalfWord_window allocation dilation hε side x hx h b right hp + +theorem canonicalWindows_of_produced_masks (allocation : Allocation) (dilation : ℕ) + {ε : ℝ} (hε : 0 ≤ ε) (side : Fin 3) + (x : ProducedWords (K := K) (tick := tick) allocation dilation) + (hx : ∀ h : Produced K tick, residentMask allocation dilation ε h.val side (x h)) : + HistorySymmetry.childWindows + (fun c : Active K tick × JointPopulation.Shape => statistic c.1) + (fun c : Active K tick × JointPopulation.Shape => statistic c.1) + (activeLaw (activeCounts allocation dilation) (fun c => leftLaw c.1 c.2 side)) + (activeLaw (activeCounts allocation dilation) (fun c => rightLaw c.1 c.2 side)) + (activeWidth (activeCounts allocation dilation) (fun c => nativeChildWidth ε c.1)) + (activeWidth (activeCounts allocation dilation) (fun c => nativeChildWidth ε c.1)) + (regroupWords allocation dilation x) := by + rintro ⟨h, u⟩ + by_cases hp : 0 < activeCounts allocation dilation h u + · obtain ⟨b, hb, hpos⟩ := shapeCounts_positive (branchShape h.val) + (branchPopulation allocation dilation h.val) u hp + subst u + have hl := regroupBranch_window allocation dilation hε side x hx h b false hpos + have hr := regroupBranch_window allocation dilation hε side x hx h b true hpos + rw [activeLaw_of_pos (activeCounts allocation dilation) + (fun c => leftLaw c.1 c.2 side) (h, branchShape h.val b) hp, + activeLaw_of_pos (activeCounts allocation dilation) + (fun c => rightLaw c.1 c.2 side) (h, branchShape h.val b) hp] + simp only [activeWidth, ite_eq_left hp] + exact ⟨hl, hr⟩ + · have hz : activeCounts allocation dilation h u = 0 := Nat.eq_zero_of_not_pos hp + simp only [activeLaw, activeWidth, typeWindow, empiricalLaw, + Fintype.card_fin, hz, Nat.cast_zero, div_zero, sub_zero, abs_zero, + le_refl, implies_true, and_self, Nat.lt_irrefl, ite_false] + +end MatrixMultiplication.AllFieldHistoryProducedMasks + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section + +namespace MatrixMultiplication.AllFieldHistoryProducedMasks + +open MatrixMultiplication.Foundation AllFieldParameters AllFieldHistory +open AllFieldHistoryChildLaws AllFieldHistoryMasks InheritedMasks +open JointCanonicalization +open scoped BigOperators +attribute [local instance] Classical.propDecidable Classical.decEq + +variable {K tick : ℕ} + +theorem childWindows_of_produced_masks (allocation : Allocation) (dilation : ℕ) + {ε : ℝ} (hε : 0 ≤ ε) (side : Fin 3) + (x : ProducedWords (K := K) (tick := tick) allocation dilation) + (hx : ∀ h : Produced K tick, residentMask allocation dilation ε h.val side (x h)) : + AllFieldHistoryMasks.childWindows allocation dilation ε side + (regroupWords allocation dilation x) := + canonicalWindows_of_produced_masks allocation dilation hε side x hx + +end MatrixMultiplication.AllFieldHistoryProducedMasks + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section + +namespace MatrixMultiplication.AllFieldHistoryProduced + +open MatrixMultiplication.Foundation AllFieldHistory AllFieldFiniteFamily +open AllFieldHistoryProducedMasks +open scoped BigOperators Classical +attribute [local instance] Classical.propDecidable Classical.decEq + +variable {K tick : ℕ} (allocation : Allocation) (m : ℕ) + +def passes (ε : ℝ) (side : Fin 3) + (w : AllFieldHistory.ProducedWords (K := K) (tick := tick) allocation m) : Prop := + ∀ h : Produced K tick, residentMask allocation m ε h.val side (w h) + +theorem producedTensor_eq_delete (F : Type*) [Field F] (ε : ℝ) : + AllFieldHistoryRegrouping.producedTensor (K := K) (tick := tick) allocation m F ε = + ExactRecovery.delete (producedBase (F := F) (K := K) (tick := tick) allocation m) + (passes allocation m ε 0) (passes allocation m ε 1) (passes allocation m ε 2) := by + funext x y z + simp only [AllFieldHistoryRegrouping.producedTensor, CommonDimensions.familyProduct, + historyTensor, ExactRecovery.delete, Fintype.prod_ite_zero, + passes, forall_and, producedBase] + +theorem canonical_eq_delete (F : Type*) [Field F] (ε : ℝ) : + AllFieldHistoryRecovery.canonical F (K := K) (tick := tick) allocation m ε = + ExactRecovery.delete (canonicalChildren (F := F) (K := K) (tick := tick) allocation m) + (AllFieldHistoryMasks.childWindows allocation m ε 0) + (AllFieldHistoryMasks.childWindows allocation m ε 1) + (AllFieldHistoryMasks.childWindows allocation m ε 2) := by + have hb := JointCanonicalCW.canonicalBase_eq_children (F := F) + (activeCounts (K := K) (tick := tick) allocation m) + activeHalfLength activeHalfLength activeParentShape + AllFieldHistoryRecovery.halfLength_le_eight + (fun h u hu => jointCounts_support_le allocation m h.val u hu) + unfold AllFieldHistoryRecovery.canonical JointCanonicalization.canonicalIdeal + change ExactRecovery.delete + (JointCanonicalization.canonicalBase (activeCounts allocation m) + (JointCanonicalCW.Left activeHalfLength) (JointCanonicalCW.Right activeHalfLength) + (JointCanonicalCW.parentTensor activeHalfLength activeHalfLength activeParentShape) + (JointCanonicalCW.coarse activeHalfLength activeHalfLength + AllFieldHistoryRecovery.halfLength_le_eight)) + (AllFieldHistoryMasks.childWindows allocation m ε 0) + (AllFieldHistoryMasks.childWindows allocation m ε 1) + (AllFieldHistoryMasks.childWindows allocation m ε 2) = _ + rw [hb] + rfl + +def pulled (F : Type*) [Field F] (ε : ℝ) : + Tensor F (AllFieldHistory.ProducedWords (K := K) (tick := tick) allocation m) + (AllFieldHistory.ProducedWords (K := K) (tick := tick) allocation m) + (AllFieldHistory.ProducedWords (K := K) (tick := tick) allocation m) := + Tensor.pullback (regroupWords allocation m) (regroupWords allocation m) + (regroupWords allocation m) + (AllFieldHistoryRecovery.canonical F (K := K) (tick := tick) allocation m ε) + +theorem delete_pulled (F : Type*) [Field F] {ε : ℝ} (hε : 0 ≤ ε) : + ExactRecovery.delete (pulled (K := K) (tick := tick) allocation m F ε) + (passes allocation m ε 0) (passes allocation m ε 1) (passes allocation m ε 2) = + AllFieldHistoryRegrouping.producedTensor (K := K) (tick := tick) allocation m F ε := by + rw [producedTensor_eq_delete] + funext x y z + by_cases hp : passes allocation m ε 0 x ∧ passes allocation m ε 1 y ∧ + passes allocation m ε 2 z + · simp only [ExactRecovery.delete, ite_eq_left hp] + unfold pulled Tensor.pullback + rw [canonical_eq_delete] + have hx := childWindows_of_produced_masks allocation m hε 0 x hp.1 + have hy := childWindows_of_produced_masks allocation m hε 1 y hp.2.1 + have hz := childWindows_of_produced_masks allocation m hε 2 z hp.2.2 + unfold ExactRecovery.delete + rw [ite_eq_left ⟨hx, hy, hz⟩] + exact regroup_coefficient allocation m x y z + · simp only [ExactRecovery.delete, ite_eq_right hp] + +def pullbackMap (F : Type*) [Field F] (ε : ℝ) : + LocalMap (AllFieldHistoryRecovery.canonical F (K := K) (tick := tick) allocation m ε) + (pulled (K := K) (tick := tick) allocation m F ε) := by + apply LocalMap.ofExists + exact ⟨_, _, _, (Tensor.pullback_eq_restrict + (regroupWords (K := K) (tick := tick) allocation m) + (regroupWords (K := K) (tick := tick) allocation m) + (regroupWords (K := K) (tick := tick) allocation m) _).symm⟩ + +def map (F : Type*) [Field F] {ε : ℝ} (hε : 0 ≤ ε) : + LocalMap (AllFieldHistoryRecovery.canonical F (K := K) (tick := tick) allocation m ε) + (AllFieldHistoryRegrouping.producedTensor (K := K) (tick := tick) allocation m F ε) := by + let first := pullbackMap (K := K) (tick := tick) allocation m F ε + let last := LocalMap.delete (pulled (K := K) (tick := tick) allocation m F ε) + (passes allocation m ε 0) (passes allocation m ε 1) (passes allocation m ε 2) + let combined := first.comp last + exact ⟨combined.x, combined.y, combined.z, + combined.coefficient.trans (delete_pulled allocation m F hε)⟩ + +end MatrixMultiplication.AllFieldHistoryProduced + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section + +namespace MatrixMultiplication.AllFieldHistoryTick + +open MatrixMultiplication.Foundation AllFieldHistory AllFieldFiniteFamily +open AllFieldGroupSelection AllFieldHistoryGroupedRecovery +open scoped BigOperators Classical +attribute [local instance] Classical.propDecidable Classical.decEq + +variable {K tick : ℕ} (allocation : Allocation) (m : ℕ) (ε slack : ℝ) + +abbrev Choices := ∀ sigma : Placement, + Selected (K := K) (tick := tick) allocation m ε sigma slack + +abbrev AmbientTag (sigma : Placement) := + JointCoarseHashing.Triple + (AllFieldGroupOrbitData.Pos (K := K) (tick := tick) allocation m sigma) + +abbrev Tags (chosen : Choices (K := K) (tick := tick) allocation m ε slack) := + ∀ sigma : Placement, {e // e ∈ (chosen sigma).targets} + +local instance tagsDecidableEq (chosen : Choices (K := K) (tick := tick) allocation m ε slack) : + DecidableEq (Tags allocation m ε slack chosen) := Classical.decEq _ + +@[instance_reducible] private def coarseTripleFintype (P : Type) [Fintype P] : + Fintype (JointCoarseHashing.Triple P) := inferInstance + +instance ambientTagFintype (sigma : Placement) : + Fintype (AmbientTag (K := K) (tick := tick) allocation m sigma) := + coarseTripleFintype (AllFieldGroupOrbitData.Pos (K := K) (tick := tick) allocation m sigma) + +instance ambientTagsFintype : + Fintype (∀ sigma, AmbientTag (K := K) (tick := tick) allocation m sigma) := inferInstance + +instance tagsFintype (chosen : Choices (K := K) (tick := tick) allocation m ε slack) : + Fintype (Tags allocation m ε slack chosen) := inferInstance + +def select (chosen : Choices (K := K) (tick := tick) allocation m ε slack) + (j : Tags allocation m ε slack chosen) : + ∀ sigma, AmbientTag (K := K) (tick := tick) allocation m sigma := + fun sigma => AllFieldGroupOrbitData.coarse allocation m sigma (j sigma).val + +theorem select_injective + (chosen : Choices (K := K) (tick := tick) allocation m ε slack) : + Function.Injective (select allocation m ε slack chosen) := by + intro j k h + funext sigma + apply Subtype.ext + exact AllFieldGroupOrbitData.coarse_injective allocation m sigma (congrFun h sigma) + +def targets (chosen : Choices (K := K) (tick := tick) allocation m ε slack) + (j : Tags allocation m ε slack chosen) : + AllFieldHistoryRecovery.Targets (K := K) (tick := tick) allocation m := + joinGroupTargets (activeCounts allocation m) (fun sigma => (j sigma).val) + +def assignments (chosen : Choices (K := K) (tick := tick) allocation m ε slack) + (sigma : Placement) := + AllFieldGroupAssignmentRetention.physicalAssignment allocation m ε sigma + (JointOrdinarySelection.hashLevel + (selectionHashRate (K := K) (tick := tick) allocation sigma slack) m) + (JointOrdinarySelection.hashSet + (selectionHashRate (K := K) (tick := tick) allocation sigma slack) m) + (chosen sigma).sample + +def assignment (chosen : Choices (K := K) (tick := tick) allocation m ε slack) := + groupedAssignment allocation m (AmbientTag (K := K) (tick := tick) allocation m) + (assignments allocation m ε slack chosen) + +theorem coherent (F : Type*) [Field F] + (chosen : Choices (K := K) (tick := tick) allocation m ε slack) : + JointExtraction.Coherent + (AllFieldHistorySource.preparedSource (K := K) (tick := tick) allocation m F ε) + (assignment allocation m ε slack chosen) := by + apply AllFieldHistorySource.groupedAssignment_coherent allocation m F ε + intro sigma + exact AllFieldGroupAssignments.physicalAssignment_coherent F allocation m ε sigma + _ _ (chosen sigma).sample + +theorem repair (F : Type*) [Field F] (hε : 0 < ε) + (hm : AllFieldHistoryRecovery.minimumDilation (K := K) (tick := tick) allocation ε ≤ m) + (chosen : Choices (K := K) (tick := tick) allocation m ε slack) + (j : Tags allocation m ε slack chosen) : + InverseLinearRecovery.RecoveredBy + (AllFieldHistoryRecovery.ideal F allocation m ε (targets allocation m ε slack chosen j)) + (JointExtraction.branch + (AllFieldHistorySource.preparedSource (K := K) (tick := tick) allocation m F ε) + (assignment allocation m ε slack chosen) (select allocation m ε slack chosen j)) + (AllFieldHistoryRecovery.shiftCount (K := K) (tick := tick) allocation ε m) := by + rw [AllFieldHistorySource.preparedSource_eq_delete] + apply repair_grouped F allocation hε hm + (AmbientTag (K := K) (tick := tick) allocation m) + (assignments allocation m ε slack chosen) + (select allocation m ε slack chosen j) (fun sigma => (j sigma).val) + · intro sigma w hw + have hs := AllFieldGroupAssignmentRetention.assigned_some_idealSide + allocation m ε sigma _ _ (chosen sigma).sample (j sigma).val (sigma.symm 0, w) hw + simpa only [Equiv.apply_symm_apply] using hs + · intro sigma w hw + have hs := AllFieldGroupAssignmentRetention.assigned_some_idealSide + allocation m ε sigma _ _ (chosen sigma).sample (j sigma).val (sigma.symm 1, w) hw + simpa only [Equiv.apply_symm_apply] using hs + · intro sigma w hw + have hs := AllFieldGroupAssignmentRetention.assigned_some_idealSide + allocation m ε sigma _ _ (chosen sigma).sample (j sigma).val (sigma.symm 2, w) hw + simpa only [Equiv.apply_symm_apply] using hs + · intro side w hw sigma + have hg := (chosen sigma).good (j sigma).val (j sigma).property + have hh := AllFieldGroupAssignmentRetention.good_projected_failure_le F + allocation m ε sigma _ _ + (JointOrdinarySelection.hashSet_AP (selectionHashRate allocation sigma slack) m) + (m : ℝ) (chosen sigma).sample (targets allocation m ε slack chosen j) + (by simpa only [targets, project_joinGroupTargets] using hg) side w hw + simp only [targets, project_joinGroupTargets, assignments, select] at hh ⊢ + exact hh + +def canonicalMap (F : Type*) [Field F] + (e : AllFieldHistoryRecovery.Targets (K := K) (tick := tick) allocation m) : + LocalMap (AllFieldHistoryRecovery.ideal F allocation m ε e) + (AllFieldHistoryRecovery.canonical (K := K) (tick := tick) F allocation m ε) := by + apply LocalMap.ofExists + refine ⟨_, _, _, (Tensor.pullback_eq_restrict + (AllFieldHistoryRecovery.coordinates allocation m e).symm + (AllFieldHistoryRecovery.coordinates allocation m e).symm + (AllFieldHistoryRecovery.coordinates allocation m e).symm _).symm.trans ?_⟩ + funext x y z + change AllFieldHistoryRecovery.ideal F allocation m ε e _ _ _ = _ + rw [AllFieldHistoryRecovery.ideal_coordinates] + simp only [Equiv.apply_symm_apply] + +def activeExecution (F : Type*) [Field F] (hε : 0 < ε) + (hm : AllFieldHistoryRecovery.minimumDilation (K := K) (tick := tick) allocation ε ≤ m) + (chosen : Choices (K := K) (tick := tick) allocation m ε slack) : + Execution + (AllFieldHistoryRegrouping.activeTensor (K := K) (tick := tick) allocation m F ε) + (Tensor.directSum (fun _ : Tags allocation m ε slack chosen => + AllFieldHistoryRegrouping.producedTensor (K := K) (tick := tick) allocation m F ε)) := by + let prepared := (Execution.initial + (AllFieldHistoryRegrouping.activeTensor (K := K) (tick := tick) allocation m F ε)).restrict _ + (AllFieldHistorySource.preparedMap (K := K) (tick := tick) allocation m F ε) + let repaired := prepared.extractSelectedAndRepair + (assignment allocation m ε slack chosen) (coherent allocation m ε slack F chosen) + (select allocation m ε slack chosen) (select_injective allocation m ε slack chosen) + (fun j => AllFieldHistoryRecovery.ideal F allocation m ε (targets allocation m ε slack chosen j)) + (AllFieldHistoryRecovery.shiftCount (K := K) (tick := tick) allocation ε m) + (repair allocation m ε slack F hε hm chosen) + let canonical := repaired.restrict _ (LocalMap.directSum _ _ + (fun j => canonicalMap allocation m ε F (targets allocation m ε slack chosen j))) + exact canonical.restrict _ + ((AllFieldHistoryProduced.map (K := K) (tick := tick) allocation m F hε.le).parallelCopies _) + +@[simp] theorem activeExecution_copies (F : Type*) [Field F] (hε : 0 < ε) + (hm : AllFieldHistoryRecovery.minimumDilation (K := K) (tick := tick) allocation ε ≤ m) + (chosen : Choices (K := K) (tick := tick) allocation m ε slack) : + Fintype.card (activeExecution allocation m ε slack F hε hm chosen).Copies = + 2 ^ (3 * AllFieldHistoryRecovery.shiftCount (K := K) (tick := tick) allocation ε m) := by + simp only [activeExecution, Execution.restrict] + erw [Execution.extractSelectedAndRepair_copies] + simp only [Execution.initial] + exact mul_one _ + +theorem card_tags (chosen : Choices (K := K) (tick := tick) allocation m ε slack) : + Fintype.card (Tags allocation m ε slack chosen) = + ∏ _sigma : Placement, + ⌊Real.exp ((m : ℝ) * (nativeCapacity (K := K) (tick := tick) allocation - slack))⌋₊ := by + rw [Fintype.card_pi] + apply Finset.prod_congr rfl + intro sigma _ + simpa only [Fintype.card_coe] using (chosen sigma).card_targets + +def execution (F : Type*) [Field F] (hε : 0 < ε) + (hm : AllFieldHistoryRecovery.minimumDilation (K := K) (tick := tick) allocation ε ≤ m) + (chosen : Choices (K := K) (tick := tick) allocation m ε slack) : + Execution (stateTensor F (K := K) allocation m ε tick) + (Tensor.directSum (fun _ : Tags allocation m ε slack chosen => + stateTensor F (K := K) allocation m ε (tick + 1))) := + AllFieldHistoryTickCarry.liftExecution (K := K) (tick := tick) allocation m F ε + (activeExecution allocation m ε slack F hε hm chosen) + +@[simp] theorem execution_copies (F : Type*) [Field F] (hε : 0 < ε) + (hm : AllFieldHistoryRecovery.minimumDilation (K := K) (tick := tick) allocation ε ≤ m) + (chosen : Choices (K := K) (tick := tick) allocation m ε slack) : + Fintype.card (execution allocation m ε slack F hε hm chosen).Copies = + 2 ^ (3 * AllFieldHistoryRecovery.shiftCount (K := K) (tick := tick) allocation ε m) := + activeExecution_copies allocation m ε slack F hε hm chosen + +end MatrixMultiplication.AllFieldHistoryTick + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section + +namespace MatrixMultiplication.AllFieldHistoryIteration + +open MatrixMultiplication.Foundation AllFieldHistory AllFieldFiniteFamily +open scoped BigOperators Classical +attribute [local instance] Classical.propDecidable Classical.decEq + +section Presentation + +variable {F : Type*} [Field F] {SX SY SZ X Y Z : Type} + [Fintype SX] [Fintype SY] [Fintype SZ] + {source : Tensor F SX SY SZ} {target next : Tensor F X Y Z} + +private def retarget (E : Execution source target) (h : target = next) : + Execution source next where + Copies := E.Copies + copies_positive := E.copies_positive + map := { + x := E.map.x + y := E.map.y + z := E.map.z + coefficient := E.map.coefficient.trans h + } + +@[simp] private theorem retarget_copies (E : Execution source target) (h : target = next) : + Fintype.card (retarget E h).Copies = Fintype.card E.Copies := rfl + +end Presentation + +variable {K : ℕ} (allocation : Allocation) (m : ℕ) (ε slack : ℝ) + +abbrev ScheduleChoices := ∀ t : Fin (K + 2), + AllFieldHistoryTick.Choices (K := K) (tick := t.val) allocation m ε slack + +def Labels (InitialTag : Type) + (chosen : ScheduleChoices (K := K) allocation m ε slack) : + (n : ℕ) → n ≤ K + 2 → Type + | 0, _ => InitialTag + | n + 1, hn => + Labels InitialTag chosen n (Nat.le_of_succ_le hn) × + AllFieldHistoryTick.Tags allocation m ε slack (chosen ⟨n, hn⟩) + +instance labelsFintype (InitialTag : Type) [Fintype InitialTag] + (chosen : ScheduleChoices (K := K) allocation m ε slack) : + (n : ℕ) → (hn : n ≤ K + 2) → + Fintype (Labels allocation m ε slack InitialTag chosen n hn) + | 0, _ => inferInstanceAs (Fintype InitialTag) + | n + 1, hn => by + letI := labelsFintype InitialTag chosen n (Nat.le_of_succ_le hn) + exact inferInstanceAs (Fintype + (Labels allocation m ε slack InitialTag chosen n (Nat.le_of_succ_le hn) × + AllFieldHistoryTick.Tags allocation m ε slack (chosen ⟨n, hn⟩))) + +theorem card_labels (InitialTag : Type) [Fintype InitialTag] + (chosen : ScheduleChoices (K := K) allocation m ε slack) + (n : ℕ) (hn : n ≤ K + 2) : + Fintype.card (Labels allocation m ε slack InitialTag chosen n hn) = + Fintype.card InitialTag * ∏ t : Fin n, ∏ _sigma : Placement, + ⌊Real.exp ((m : ℝ) * + (AllFieldGroupSelection.nativeCapacity (K := K) (tick := t.val) allocation - slack))⌋₊ := by + induction n with + | zero => + simp [Labels] + rfl + | succ n ih => + change Fintype.card + (Labels allocation m ε slack InitialTag chosen n (Nat.le_of_succ_le hn) × + AllFieldHistoryTick.Tags allocation m ε slack (chosen ⟨n, hn⟩)) = _ + rw [Fintype.card_prod, AllFieldHistoryTick.card_tags, ih, Fin.prod_univ_castSucc] + exact Nat.mul_assoc _ _ _ + +abbrev Tags (InitialTag : Type) + (chosen : ScheduleChoices (K := K) allocation m ε slack) := + Labels allocation m ε slack InitialTag chosen (K + 2) le_rfl + +theorem card_tags (InitialTag : Type) [Fintype InitialTag] + (chosen : ScheduleChoices (K := K) allocation m ε slack) : + Fintype.card (Tags allocation m ε slack InitialTag chosen) = + Fintype.card InitialTag * ∏ t : Fin (K + 2), ∏ _sigma : Placement, + ⌊Real.exp ((m : ℝ) * + (AllFieldGroupSelection.nativeCapacity (K := K) (tick := t.val) allocation - slack))⌋₊ := + card_labels allocation m ε slack InitialTag chosen (K + 2) le_rfl + +variable (F : Type*) [Field F] (hε : 0 < ε) + (hm : ∀ t : Fin (K + 2), + AllFieldHistoryRecovery.minimumDilation (K := K) (tick := t.val) allocation ε ≤ m) + (chosen : ScheduleChoices (K := K) allocation m ε slack) + {InitialTag : Type} [Fintype InitialTag] + (start : Execution (cwSource F K (populationLength (K := K) allocation m)) + (Tensor.directSum (fun _ : InitialTag => stateTensor F (K := K) allocation m ε 0))) + +def run : (n : ℕ) → (hn : n ≤ K + 2) → + Execution (cwSource F K (populationLength (K := K) allocation m)) + (Tensor.directSum (fun _ : Labels allocation m ε slack InitialTag chosen n hn => + stateTensor F (K := K) allocation m ε n)) + | 0, _ => start + | n + 1, hn => + let step := AllFieldHistoryTick.execution allocation m ε slack F hε + (hm ⟨n, hn⟩) (chosen ⟨n, hn⟩) + let operation := Execution.branchOperation + (stateTensor F (K := K) allocation m ε n) + (stateTensor F (K := K) allocation m ε (n + 1)) + (run n (Nat.le_of_succ_le hn)) step.copies_positive step.map + retarget operation (by + funext x y z + simp only [Tensor.directSum] + split_ifs <;> first | rfl | contradiction) + +theorem run_copies (n : ℕ) (hn : n ≤ K + 2) : + Fintype.card (run allocation m ε slack F hε hm chosen start n hn).Copies = + Fintype.card start.Copies * ∏ t : Fin n, + 2 ^ (3 * AllFieldHistoryRecovery.shiftCount (K := K) (tick := t.val) allocation ε m) := by + induction n with + | zero => + simp [run] + rfl + | succ n ih => + rw [run] + erw [retarget_copies, Execution.branchOperation_copies, AllFieldHistoryTick.execution_copies, + ih, Fin.prod_univ_castSucc] + ring + +def execution : + Execution (cwSource F K (populationLength (K := K) allocation m)) + (Tensor.directSum (fun _ : Tags allocation m ε slack InitialTag chosen => + stateTensor F (K := K) allocation m ε (K + 2))) := + run allocation m ε slack F hε hm chosen start (K + 2) le_rfl + +@[simp] theorem execution_copies : + Fintype.card (execution allocation m ε slack F hε hm chosen start).Copies = + Fintype.card start.Copies * ∏ t : Fin (K + 2), + 2 ^ (3 * AllFieldHistoryRecovery.shiftCount (K := K) (tick := t.val) allocation ε m) := + run_copies allocation m ε slack F hε hm chosen start (K + 2) le_rfl + +end MatrixMultiplication.AllFieldHistoryIteration + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/Histories/HistoryPositions.lean b/lean/OAI/LinearAlgebra/MatrixFields/Histories/HistoryPositions.lean new file mode 100644 index 0000000000000000000000000000000000000000..1270a0e083811c868f72c7eca2fb6fcfd7e3d4ec --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/Histories/HistoryPositions.lean @@ -0,0 +1,658 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Arithmetic.CommonDimensions +import OAI.LinearAlgebra.MatrixFields.Histories.HistoryChildLaws + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.AllFieldHistory + +open AllFieldParameters +open scoped BigOperators +attribute [local instance] Classical.propDecidable Classical.decEq + +def due {K : ℕ} (tick : ℕ) : CanonicalHistory K → Prop + | .initial h => initialShape h ∈ positiveInitial ∧ tick = h.1.val + | .afterA h => aShape h ∈ positiveSecond ∧ tick = h.1.val.1.val + 1 + | .afterB _ => False + | .partC h => tick = h.1.val.1.val.1.val.1.val + 2 + | .afterC _ => False + +def produced {K : ℕ} (tick : ℕ) : CanonicalHistory K → Prop + | .initial _ => False + | .afterA h => tick = h.1.val.1.val + | .afterB h => tick = h.1.val.1.val.1.val + 1 ∧ positive (bShape h) ≠ true + | .partC h => tick = h.1.val.1.val.1.val.1.val + 1 + | .afterC h => tick = h.1.1.val.1.val.1.val.1.val + 2 + +abbrev Carried (K tick : ℕ) := {h : State K tick // ¬ due tick h.val.1} +abbrev Produced (K tick : ℕ) := {h : History K // produced tick h.1} + +theorem produced_not_resident {K tick : ℕ} (h : CanonicalHistory K) + (hp : produced tick h) : ¬ resident tick h := by + cases h with + | initial h => exact False.elim hp + | afterA h => simp only [produced] at hp; simp only [resident]; omega + | afterB h => simp only [produced] at hp; simp only [resident]; omega + | partC h => simp only [produced] at hp; simp only [resident]; omega + | afterC h => simp only [produced] at hp; simp only [resident]; omega + +theorem resident_succ_iff {K tick : ℕ} (h : CanonicalHistory K) : + resident (tick + 1) h ↔ (resident tick h ∧ ¬ due tick h) ∨ produced tick h := by + cases h with + | initial h => + by_cases hp : initialShape h ∈ positiveInitial + · simp only [resident, due, produced, hp, true_implies, true_and, or_false] + omega + · simp [resident, due, produced, hp] + | afterA h => + by_cases hp : aShape h ∈ positiveSecond + · simp only [resident, due, produced, hp, true_implies, true_and] + omega + · simp only [resident, due, produced, hp, false_implies, and_true, false_and, + not_false_eq_true] + omega + | afterB h => + by_cases hp : positive (bShape h) = true + · simp [resident, due, produced, hp] + · simp [resident, due, produced, hp, ne_eq] + omega + | partC h => simp only [resident, due, produced]; omega + | afterC h => simp only [resident, due, produced, not_false_eq_true, and_true]; omega + +def stateTransitionForward {K tick : ℕ} (h : State K (tick + 1)) : + Carried K tick ⊕ Produced K tick := by + by_cases hr : resident tick h.val.1 + · refine Sum.inl ⟨⟨h.val, hr⟩, ?_⟩ + rcases (resident_succ_iff h.val.1).mp h.property with hc | hp + · exact hc.2 + · exact False.elim (produced_not_resident _ hp hr) + · refine Sum.inr ⟨h.val, ?_⟩ + rcases (resident_succ_iff h.val.1).mp h.property with hc | hp + · exact False.elim (hr hc.1) + · exact hp + +def stateTransitionBackward {K tick : ℕ} : Carried K tick ⊕ Produced K tick → + State K (tick + 1) + | .inl h => ⟨h.val.val, (resident_succ_iff _).mpr (.inl ⟨h.val.property, h.property⟩)⟩ + | .inr h => ⟨h.val, (resident_succ_iff _).mpr (.inr h.property)⟩ + +def stateTransition {K tick : ℕ} : State K (tick + 1) ≃ Carried K tick ⊕ Produced K tick where + toFun := stateTransitionForward + invFun := stateTransitionBackward + left_inv h := by + unfold stateTransitionForward + split_ifs <;> rfl + right_inv h := by + cases h with + | inl h => simp [stateTransitionForward, stateTransitionBackward, h.val.property] + | inr h => + have hn := produced_not_resident h.val.1 h.property + simp [stateTransitionForward, stateTransitionBackward, hn] + +def productionParent {K tick : ℕ} (p : Produced K tick) : Active K tick := by + rcases p with ⟨⟨h, phi⟩, hp⟩ + cases h with + | initial h => exact False.elim hp + | afterA h => + refine ⟨(.stageA h.1, phi), ?_⟩ + exact hp.symm + | afterB h => + refine ⟨(.stageB h.1, phi), ?_⟩ + exact hp.1.symm + | partC h => + refine ⟨(.stageB h.1.val.1, phi), ?_⟩ + exact hp.symm + | afterC h => + refine ⟨(.stageC h.1, phi), ?_⟩ + exact hp.symm + +abbrev DueState (K tick : ℕ) := {h : State K tick // due tick h.val.1} + +def activeToDue {K tick : ℕ} (w : Active K tick) : DueState K tick := by + refine ⟨⟨(w.val.1.source, w.val.2), ?_⟩, ?_⟩ + · exact Eq.mp (congrArg (fun n => resident n w.val.1.source) w.property) + (work_source_resident w.val.1) + · rcases w with ⟨⟨w, phi⟩, hw⟩ + cases w with + | stageA h => exact ⟨h.property, hw.symm⟩ + | stageB h => exact ⟨h.property, hw.symm⟩ + | stageC h => exact hw.symm + +def dueToActive {K tick : ℕ} (h : DueState K tick) : Active K tick := by + rcases h with ⟨⟨⟨h, phi⟩, hr⟩, hd⟩ + cases h with + | initial h => exact ⟨(.stageA ⟨h, hd.1⟩, phi), hd.2.symm⟩ + | afterA h => exact ⟨(.stageB ⟨h, hd.1⟩, phi), hd.2.symm⟩ + | afterB h => exact False.elim hd + | partC h => exact ⟨(.stageC h, phi), hd.symm⟩ + | afterC h => exact False.elim hd + +def activeSourceEquiv {K tick : ℕ} : Active K tick ≃ DueState K tick where + toFun := activeToDue + invFun := dueToActive + left_inv w := by + rcases w with ⟨⟨w, phi⟩, hw⟩ + cases w <;> rfl + right_inv h := by + rcases h with ⟨⟨⟨h, phi⟩, hr⟩, hd⟩ + cases h with + | initial h => rfl + | afterA h => rfl + | afterB h => exact False.elim hd + | partC h => rfl + | afterC h => exact False.elim hd + +def bSubdivisionPositionEquiv {K : ℕ} (allocation : Allocation) (dilation : ℕ) + (h : BPositive K) (phi : Placement) : + Fin (population allocation dilation (.afterB h.val, phi)) ≃ + (Σ i : Fin 3, Fin (population allocation dilation (.partC (h, i), phi))) := + Fintype.equivOfCardEq (by + simp only [Fintype.card_fin, Fintype.card_sigma] + exact (part_population_transition allocation dilation h phi).symm) + +theorem final_state_terminal {K : ℕ} (h : State K (K + 2)) : terminal h.val.1 := by + have hr := h.property + have hlot := (initialAncestor h.val.1).1.isLt + cases hh : h.val.1 with + | initial g => + simp only [hh, resident] at hr + simp only [hh, initialAncestor] at hlot + intro hp + have := hr hp + omega + | afterA a => + simp only [hh, resident] at hr + simp only [hh, initialAncestor] at hlot + intro hp + have := hr.2 hp + omega + | afterB b => + simp only [hh, resident] at hr + exact hr.2 + | partC c => + simp only [hh, resident] at hr + simp only [hh, initialAncestor] at hlot + omega + | afterC c => trivial + +end MatrixMultiplication.AllFieldHistory + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.AllFieldHistory + +open AllFieldParameters +attribute [local instance] Classical.propDecidable Classical.decEq + +def currentShape {K : ℕ} : CanonicalHistory K → Shape + | .initial h => initialShape h + | .afterA h => aShape h + | .afterB h => bShape h + | .partC h => cShapeParent h + | .afterC h => cShape h + +def currentLength {K : ℕ} : CanonicalHistory K → ℕ + | .initial _ => 8 + | .afterA _ => 4 + | .afterB _ | .partC _ => 2 + | .afterC _ => 1 + +def currentPhysicalShape {K : ℕ} (h : History K) : Shape := + physicalShape h.2 (currentShape h.1) + +theorem currentShape_spec {K : ℕ} (h : CanonicalHistory K) : + ShapeBounded (currentShape h) ∧ shapeTotal (currentShape h) = 2 * currentLength h := by + cases h with + | initial h => exact root_shape_spec _ (initialShape_mem h) + | afterA h => exact ⟨mem_shapes_bounded (aShape_size h) (by omega), mem_shapes_total (aShape_size h)⟩ + | afterB h => exact ⟨mem_shapes_bounded (bShape_size h) (by omega), mem_shapes_total (bShape_size h)⟩ + | partC h => exact ⟨mem_shapes_bounded (bShape_size h.1.val) (by omega), + mem_shapes_total (bShape_size h.1.val)⟩ + | afterC h => + cases hh : h.2.2 with + | false => + simpa only [currentShape, currentLength, cShape, cSplit, cShapeParent, halfShape, hh, + Bool.false_eq_true, ite_false, Nat.mul_one] using + stageC_shape_spec _ (bShape_size h.1.1.val) h.1.1.property h.2.1 + | true => + simpa only [currentShape, currentLength, cShape, cSplit, cShapeParent, halfShape, hh, + ite_true, Nat.mul_one] using + stageC_complement_spec _ (bShape_size h.1.1.val) h.1.1.property h.2.1 + +theorem currentPhysicalShape_total {K : ℕ} (h : History K) : + shapeTotal (currentPhysicalShape h) = 2 * currentLength h.1 := + (physicalShape_total h.2 _).trans (currentShape_spec h.1).2 + +theorem positive_iff_no_zero (u : Shape) : positive u = true ↔ ∀ i, u i ≠ 0 := by + simp only [positive, Bool.and_eq_true, decide_eq_true_eq] + constructor + · intro h i + fin_cases i + · change u 0 ≠ 0 + omega + · change u 1 ≠ 0 + omega + · change u 2 ≠ 0 + omega + · intro h + have h0 := h 0 + have h1 := h 1 + have h2 := h 2 + omega + +theorem not_positive_has_zero (u : Shape) (hu : positive u ≠ true) : ∃ i, u i = 0 := by + by_contra hn + apply hu + rw [positive_iff_no_zero] + intro i hi + exact hn ⟨i, hi⟩ + +theorem terminal_has_zero {K : ℕ} (h : CanonicalHistory K) (ht : terminal h) : + ∃ i, currentShape h i = 0 := by + cases h with + | initial h => + apply not_positive_has_zero + intro hp + exact ht (List.mem_filter.mpr ⟨initialShape_mem h, hp⟩) + | afterA h => + apply not_positive_has_zero + intro hp + exact ht (List.mem_filter.mpr ⟨aShape_size h, hp⟩) + | afterB h => exact not_positive_has_zero _ ht + | partC h => exact False.elim ht + | afterC h => exact cShape_zero h + +theorem terminal_physical_zero {K : ℕ} (h : History K) (ht : terminal h.1) : + ∃ s, currentPhysicalShape h s = 0 := by + obtain ⟨i, hi⟩ := terminal_has_zero h.1 ht + exact ⟨h.2 i, by simpa only [currentPhysicalShape, physicalShape_source] using hi⟩ + +theorem final_physical_zero {K : ℕ} (h : State K (K + 2)) : + ∃ s, currentPhysicalShape h.val s = 0 := + terminal_physical_zero h.val (final_state_terminal h) + +theorem source_shape {K : ℕ} (w : Work K) : currentShape w.source = w.parentShape := by + cases w <;> rfl + +theorem source_length {K : ℕ} (w : Work K) : currentLength w.source = 2 * w.halfLength := by + cases w <;> rfl + +theorem child_shape {K : ℕ} (w : Work K) (b : w.Branch) (right : Bool) : + currentShape (w.child b right) = halfShape w.parentShape (w.splitShape b) right := by + cases w <;> rfl + +theorem child_length {K : ℕ} (w : Work K) (b : w.Branch) (right : Bool) : + currentLength (w.child b right) = w.halfLength := by + cases w <;> rfl + +end MatrixMultiplication.AllFieldHistory + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section + +namespace MatrixMultiplication.AllFieldHistory + +open MatrixMultiplication.Foundation AllFieldParameters CWStrands InheritedMasks +open scoped BigOperators Classical + +def ResidentStatistic {K : ℕ} : CanonicalHistory K → Type + | .initial _ => PUnit + | .afterA _ => PairSlot + | .afterB _ | .partC _ => Fin 6 + | .afterC _ => PUnit + +instance {K : ℕ} (h : CanonicalHistory K) : Fintype (ResidentStatistic h) := by + cases h <;> dsimp [ResidentStatistic] <;> infer_instance + +instance {K : ℕ} (h : CanonicalHistory K) : DecidableEq (ResidentStatistic h) := Classical.decEq _ + +def residentStatistic {K : ℕ} (h : CanonicalHistory K) : + (Fin (currentLength h) → Fin 7) → ResidentStatistic h := + match h with + | .initial _ => fun _ => PUnit.unit + | .afterA _ => CWCompleteStatistics.fourStatistic + | .afterB _ | .partC _ => CWCompleteStatistics.twoStatistic + | .afterC _ => fun _ => PUnit.unit + +def residentLawRat {K : ℕ} (h : CanonicalHistory K) (canonicalSide : Fin 3) : + ResidentStatistic h → ℚ := + match h with + | .initial _ => fun _ => 1 + | .afterA h => halfLaw (aShape h) canonicalSide + | .afterB h => littleLaw (aShape h.1.val) (bShape h) canonicalSide + | .partC h => littleLaw (cParameterParent h) (cShapeParent h) canonicalSide + | .afterC _ => fun _ => 1 + +def residentLaw {K : ℕ} (h : History K) (physicalSide : Fin 3) : + ResidentStatistic h.1 → ℝ := + fun a => residentLawRat h.1 (h.2.symm physicalSide) a + +theorem residentLawRat_nonnegative {K : ℕ} (h : CanonicalHistory K) (side : Fin 3) + (a : ResidentStatistic h) : 0 ≤ residentLawRat h side a := by + cases h with + | initial h => exact zero_le_one + | afterA h => exact halfLaw_nonnegative (aShape h) side a + | afterB h => exact littleLaw_nonnegative (aShape h.1.val) (bShape h) side a + | partC h => exact littleLaw_nonnegative (cParameterParent h) (cShapeParent h) side a + | afterC h => exact zero_le_one + +theorem residentLawRat_normalized {K : ℕ} (h : CanonicalHistory K) (side : Fin 3) : + ∑ a : ResidentStatistic h, residentLawRat h side a = 1 := by + cases h with + | initial h => + let : Unique (ResidentStatistic (.initial h)) := inferInstanceAs (Unique PUnit) + exact Fintype.sum_unique _ + | afterA h => exact halfLaw_normalized (aShape h) (aShape_size h) side + | afterB h => exact littleLaw_normalized (aShape h.1.val) (bShape h) side + | partC h => exact littleLaw_normalized (cParameterParent h) (cShapeParent h) side + | afterC h => + let : Unique (ResidentStatistic (.afterC h)) := inferInstanceAs (Unique PUnit) + exact Fintype.sum_unique _ + +def residentWidth {K : ℕ} (ε : ℝ) : CanonicalHistory K → ℝ + | .initial _ => 0 + | .afterA _ => ε / 8 + | .afterB _ => ε / 128 + | .partC _ => ε / 256 + | .afterC _ => 0 + +abbrev HistoryWord {K : ℕ} (allocation : Allocation) (dilation : ℕ) (h : History K) := + Fin (population allocation dilation h) → Fin (currentLength h.1) → Fin 7 + +def residentMask {K : ℕ} (allocation : Allocation) (dilation : ℕ) (ε : ℝ) + (h : History K) (side : Fin 3) (w : HistoryWord allocation dilation h) : Prop := + match h.1 with + | .initial _ => True + | .afterC _ => True + | .afterA _ | .afterB _ | .partC _ => + 0 < population allocation dilation h → + typeWindow (residentLaw h side) (residentWidth ε h.1) + (fun i => residentStatistic h.1 (w i)) + +theorem residentMask_zero_population {K : ℕ} (allocation : Allocation) (dilation : ℕ) + (ε : ℝ) (h : History K) (hp : population allocation dilation h = 0) + (side : Fin 3) (w : HistoryWord allocation dilation h) : + residentMask allocation dilation ε h side w := by + rcases h with ⟨h, phi⟩ + cases h <;> simp [residentMask, hp] + +theorem residentWidth_mono {K : ℕ} {ε δ : ℝ} (hε : ε ≤ δ) (h : CanonicalHistory K) : + residentWidth ε h ≤ residentWidth δ h := by + cases h <;> simp only [residentWidth] + all_goals first | exact le_rfl | exact div_le_div_of_nonneg_right hε (by norm_num) + +theorem residentMask_mono {K : ℕ} (allocation : Allocation) (dilation : ℕ) + {ε δ : ℝ} (hε : ε ≤ δ) (h : History K) (side : Fin 3) + (w : HistoryWord allocation dilation h) + (hw : residentMask allocation dilation ε h side w) : + residentMask allocation dilation δ h side w := by + rcases h with ⟨h, phi⟩ + cases h <;> simp only [residentMask] at hw ⊢ + all_goals first + | trivial + | intro hp a + exact le_trans (hw hp a) (residentWidth_mono hε _) + +def historyTensor (F : Type*) [Field F] {K : ℕ} + (allocation : Allocation) (dilation : ℕ) (ε : ℝ) (h : History K) : + Tensor F (HistoryWord allocation dilation h) (HistoryWord allocation dilation h) + (HistoryWord allocation dilation h) := + ExactRecovery.delete + (Tensor.power (shapeTensor (Fin (currentLength h.1)) (currentPhysicalShape h)) + (population allocation dilation h)) + (residentMask allocation dilation ε h 0) (residentMask allocation dilation ε h 1) + (residentMask allocation dilation ε h 2) + +def stateTensor (F : Type*) [Field F] {K : ℕ} + (allocation : Allocation) (dilation : ℕ) (ε : ℝ) (tick : ℕ) : + Tensor F (∀ h : State K tick, HistoryWord allocation dilation h.val) + (∀ h : State K tick, HistoryWord allocation dilation h.val) + (∀ h : State K tick, HistoryWord allocation dilation h.val) := + CommonDimensions.familyProduct (fun h : State K tick => + historyTensor F allocation dilation ε h.val) + +theorem historyTensor_support_shape (F : Type*) [Field F] {K : ℕ} + (allocation : Allocation) (dilation : ℕ) (ε : ℝ) (h : History K) + (x y z : HistoryWord allocation dilation h) + (hn : historyTensor F allocation dilation ε h x y z ≠ 0) + (i : Fin (population allocation dilation h)) : + weight (x i) = currentPhysicalShape h 0 ∧ + weight (y i) = currentPhysicalShape h 1 ∧ + weight (z i) = currentPhysicalShape h 2 := by + apply shapeTensor_support (F := F) (currentPhysicalShape h) (x i) (y i) (z i) + intro hz + apply hn + unfold historyTensor ExactRecovery.delete + split_ifs + · exact Finset.prod_eq_zero (Finset.mem_univ i) hz + · rfl + +@[simp] theorem historyTensor_initial (F : Type*) [Field F] {K : ℕ} + (allocation : Allocation) (dilation : ℕ) (ε : ℝ) (h : Initial K) (phi : Placement) : + historyTensor F allocation dilation ε (.initial h, phi) = + Tensor.power (shapeTensor (Fin 8) (physicalShape phi (initialShape h))) + (population allocation dilation (.initial h, phi)) := by + funext x y z + exact ite_eq_left ⟨trivial, trivial, trivial⟩ + +@[simp] theorem historyTensor_afterC (F : Type*) [Field F] {K : ℕ} + (allocation : Allocation) (dilation : ℕ) (ε : ℝ) (h : AfterC K) (phi : Placement) : + historyTensor F allocation dilation ε (.afterC h, phi) = + Tensor.power (shapeTensor (Fin 1) (physicalShape phi (cShape h))) + (population allocation dilation (.afterC h, phi)) := by + funext x y z + exact ite_eq_left ⟨trivial, trivial, trivial⟩ + +end MatrixMultiplication.AllFieldHistory + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.AllFieldHistory + +open AllFieldParameters +attribute [local instance] Classical.propDecidable Classical.decEq + +abbrev ProducedPositions {K tick : ℕ} (allocation : Allocation) (dilation : ℕ) := + Σ h : Produced K tick, Fin (population allocation dilation h.val) + +abbrev SplitPositions {K tick : ℕ} (allocation : Allocation) (dilation : ℕ) := + Σ w : Active K tick, Σ b : w.val.1.Branch, + Bool × Fin (branchPopulation allocation dilation w.val b) + +def halfPosition {K : ℕ} (allocation : Allocation) (dilation : ℕ) + (w : PlacedWork K) (b : w.1.Branch) (right : Bool) + (i : Fin (branchPopulation allocation dilation w b)) : + Fin (population allocation dilation (w.1.child b right, w.2)) := + ⟨i.val, by rw [branchPopulation_half]; exact i.isLt⟩ + +def unhalfPosition {K : ℕ} (allocation : Allocation) (dilation : ℕ) + (w : PlacedWork K) (b : w.1.Branch) (right : Bool) + (i : Fin (population allocation dilation (w.1.child b right, w.2))) : + Fin (branchPopulation allocation dilation w b) := + ⟨i.val, by rw [← branchPopulation_half allocation dilation w b right]; exact i.isLt⟩ + +@[simp] theorem unhalf_halfPosition {K : ℕ} (allocation : Allocation) (dilation : ℕ) + (w : PlacedWork K) (b : w.1.Branch) (right : Bool) + (i : Fin (branchPopulation allocation dilation w b)) : + unhalfPosition allocation dilation w b right (halfPosition allocation dilation w b right i) = i := rfl + +@[simp] theorem half_unhalfPosition {K : ℕ} (allocation : Allocation) (dilation : ℕ) + (w : PlacedWork K) (b : w.1.Branch) (right : Bool) + (i : Fin (population allocation dilation (w.1.child b right, w.2))) : + halfPosition allocation dilation w b right (unhalfPosition allocation dilation w b right i) = i := rfl + +def splitToProduced {K tick : ℕ} (allocation : Allocation) (dilation : ℕ) : + SplitPositions (K := K) (tick := tick) allocation dilation → + ProducedPositions (K := K) (tick := tick) allocation dilation := by + rintro ⟨⟨⟨w, phi⟩, hw⟩, b, right, i⟩ + cases w with + | stageA h => + exact ⟨⟨(.afterA ⟨h, b, right⟩, phi), hw.symm⟩, + halfPosition allocation dilation (.stageA h, phi) b right i⟩ + | stageB h => + let child : AfterB K := ⟨h, b, right⟩ + let j := halfPosition allocation dilation (.stageB h, phi) b right i + by_cases hp : positive (bShape child) = true + · let part := bSubdivisionPositionEquiv allocation dilation ⟨child, hp⟩ phi j + exact ⟨⟨(.partC (⟨child, hp⟩, part.1), phi), hw.symm⟩, part.2⟩ + · exact ⟨⟨(.afterB child, phi), hw.symm, hp⟩, j⟩ + | stageC h => + exact ⟨⟨(.afterC (h, b, right), phi), hw.symm⟩, + halfPosition allocation dilation (.stageC h, phi) b right i⟩ + +def producedToSplit {K tick : ℕ} (allocation : Allocation) (dilation : ℕ) : + ProducedPositions (K := K) (tick := tick) allocation dilation → + SplitPositions (K := K) (tick := tick) allocation dilation := by + rintro ⟨⟨⟨h, phi⟩, hp⟩, i⟩ + cases h with + | initial h => exact False.elim hp + | afterA h => + exact ⟨⟨(.stageA h.1, phi), hp.symm⟩, h.2.1, h.2.2, + unhalfPosition allocation dilation (.stageA h.1, phi) h.2.1 h.2.2 i⟩ + | afterB h => + exact ⟨⟨(.stageB h.1, phi), hp.1.symm⟩, h.2.1, h.2.2, + unhalfPosition allocation dilation (.stageB h.1, phi) h.2.1 h.2.2 i⟩ + | partC h => + let j := (bSubdivisionPositionEquiv allocation dilation h.1 phi).symm ⟨h.2, i⟩ + exact ⟨⟨(.stageB h.1.val.1, phi), hp.symm⟩, h.1.val.2.1, h.1.val.2.2, + unhalfPosition allocation dilation (.stageB h.1.val.1, phi) + h.1.val.2.1 h.1.val.2.2 j⟩ + | afterC h => + exact ⟨⟨(.stageC h.1, phi), hp.symm⟩, h.2.1, h.2.2, + unhalfPosition allocation dilation (.stageC h.1, phi) h.2.1 h.2.2 i⟩ + +theorem producedToSplit_splitToProduced {K tick : ℕ} (allocation : Allocation) (dilation : ℕ) + (p : SplitPositions (K := K) (tick := tick) allocation dilation) : + producedToSplit allocation dilation (splitToProduced allocation dilation p) = p := by + rcases p with ⟨⟨⟨w, phi⟩, hw⟩, b, right, i⟩ + cases w with + | stageA h => rfl + | stageB h => + by_cases hp : positive (bShape (⟨h, b, right⟩ : AfterB K)) = true + · dsimp only [splitToProduced] + rw [dite_eq_left hp] + dsimp only [producedToSplit] + let lift : Fin (population allocation dilation (.afterB ⟨h, b, right⟩, phi)) → + SplitPositions (K := K) (tick := tick) allocation dilation := + fun position => ⟨⟨(.stageB h, phi), hw⟩, b, right, + unhalfPosition allocation dilation (.stageB h, phi) b right position⟩ + exact congrArg lift ((bSubdivisionPositionEquiv allocation dilation + ⟨⟨h, b, right⟩, hp⟩ phi).symm_apply_apply + (halfPosition allocation dilation (.stageB h, phi) b right i)) + · dsimp only [splitToProduced] + rw [dite_eq_right hp] + rfl + | stageC h => rfl + +theorem splitToProduced_producedToSplit {K tick : ℕ} (allocation : Allocation) (dilation : ℕ) + (p : ProducedPositions (K := K) (tick := tick) allocation dilation) : + splitToProduced allocation dilation (producedToSplit allocation dilation p) = p := by + rcases p with ⟨⟨⟨h, phi⟩, hp⟩, i⟩ + cases h with + | initial h => exact False.elim hp + | afterA h => rfl + | afterB h => + rcases h with ⟨a, b, right⟩ + dsimp only [producedToSplit, splitToProduced] + rw [dite_eq_right hp.2] + rfl + | partC h => + rcases h with ⟨⟨⟨a, b, right⟩, hb⟩, part⟩ + dsimp only [producedToSplit, splitToProduced] + rw [dite_eq_left hb] + let lift : (Σ j : Fin 3, + Fin (population allocation dilation + (.partC (⟨⟨a, b, right⟩, hb⟩, j), phi))) → + ProducedPositions (K := K) (tick := tick) allocation dilation := + fun q => ⟨⟨(.partC (⟨⟨a, b, right⟩, hb⟩, q.1), phi), hp⟩, q.2⟩ + exact congrArg lift ((bSubdivisionPositionEquiv allocation dilation + ⟨⟨a, b, right⟩, hb⟩ phi).apply_symm_apply ⟨part, i⟩) + | afterC h => rfl + +def producedPositionEquiv {K tick : ℕ} (allocation : Allocation) (dilation : ℕ) : + ProducedPositions (K := K) (tick := tick) allocation dilation ≃ + SplitPositions (K := K) (tick := tick) allocation dilation where + toFun := producedToSplit allocation dilation + invFun := splitToProduced allocation dilation + left_inv := splitToProduced_producedToSplit allocation dilation + right_inv := producedToSplit_splitToProduced allocation dilation + +theorem producedPositionEquiv_parent {K tick : ℕ} (allocation : Allocation) (dilation : ℕ) + (p : ProducedPositions (K := K) (tick := tick) allocation dilation) : + (producedPositionEquiv allocation dilation p).1 = productionParent p.1 := by + rcases p with ⟨⟨⟨h, phi⟩, hp⟩, i⟩ + cases h with + | initial h => exact False.elim hp + | afterA h => rfl + | afterB h => rfl + | partC h => rfl + | afterC h => rfl + +theorem producedPositionEquiv_shape {K tick : ℕ} (allocation : Allocation) (dilation : ℕ) + (p : ProducedPositions (K := K) (tick := tick) allocation dilation) : + currentPhysicalShape p.1.val = + physicalShape (producedPositionEquiv allocation dilation p).1.val.2 + (halfShape (producedPositionEquiv allocation dilation p).1.val.1.parentShape + ((producedPositionEquiv allocation dilation p).1.val.1.splitShape + (producedPositionEquiv allocation dilation p).2.1) + (producedPositionEquiv allocation dilation p).2.2.1) := by + rcases p with ⟨⟨⟨h, phi⟩, hp⟩, i⟩ + cases h with + | initial h => exact False.elim hp + | afterA h => rfl + | afterB h => rfl + | partC h => rfl + | afterC h => rfl + +theorem producedPositionEquiv_length {K tick : ℕ} (allocation : Allocation) (dilation : ℕ) + (p : ProducedPositions (K := K) (tick := tick) allocation dilation) : + currentLength p.1.val.1 = (producedPositionEquiv allocation dilation p).1.val.1.halfLength := by + rcases p with ⟨⟨⟨h, phi⟩, hp⟩, i⟩ + cases h with + | initial h => exact False.elim hp + | afterA h => rfl + | afterB h => rfl + | partC h => rfl + | afterC h => rfl + +end MatrixMultiplication.AllFieldHistory + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/Histories/HistoryRecovery.lean b/lean/OAI/LinearAlgebra/MatrixFields/Histories/HistoryRecovery.lean new file mode 100644 index 0000000000000000000000000000000000000000..a7d49e282e303c59feb6ecc0d63fbe87fd662381 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/Histories/HistoryRecovery.lean @@ -0,0 +1,822 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Construction.JointCanonicalSymmetry + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +noncomputable section + +namespace MatrixMultiplication.PermutationMatching + +open MatrixMultiplication.InheritedMasks +open scoped BigOperators + +attribute [local instance] Classical.propDecidable Classical.decEq + +def fullOrbitFilter (G : Type*) {V : Type*} [SMul G V] [Fintype V] + (v : V) : Finset V := + @Finset.filter V (fun w => ∃ g : G, g • v = w) + (fun w => Classical.propDecidable (∃ g : G, g • v = w)) Finset.univ + +def rejectedFilter {V : Type*} (orbit : Finset V) (bad : V → Prop) : Finset V := + @Finset.filter V bad (fun v => Classical.propDecidable (bad v)) orbit + +theorem orbitSet_eq_fullOrbitFilter {G V : Type*} [Group G] [Fintype G] + [MulAction G V] [Fintype V] [DecidableEq V] (v : V) : + OrbitCounting.orbitSet (G := G) v = fullOrbitFilter G v := by + ext w + simp only [OrbitCounting.orbitSet, fullOrbitFilter, Finset.mem_image, + Finset.mem_univ, true_and, Finset.mem_filter] + +theorem rejectedFilter_congr {V : Type*} (orbit : Finset V) (p q : V → Prop) + (h : ∀ v, p v ↔ q v) : rejectedFilter orbit p = rejectedFilter orbit q := by + ext v + simp only [rejectedFilter, Finset.mem_filter, h] + +theorem fullOrbitFilter_bad_fraction_eq_orbit {G V : Type*} + [Group G] [Fintype G] [MulAction G V] [Fintype V] [DecidableEq V] + (w : V) (bad : V → Prop) [DecidablePred bad] : + ((rejectedFilter (fullOrbitFilter G w) bad).card : ℝ) / + (fullOrbitFilter G w).card = + (((OrbitCounting.orbitSet (G := G) w).filter bad).card : ℝ) / + (OrbitCounting.orbitSet (G := G) w).card := by + have horbit := orbitSet_eq_fullOrbitFilter (G := G) w + have hbad : (OrbitCounting.orbitSet (G := G) w).filter bad = + rejectedFilter (fullOrbitFilter G w) bad := by + ext v + simp only [Finset.mem_filter, rejectedFilter, horbit] + rw [hbad, horbit] + +theorem orbit_bad_fraction_eq_fullOrbitFilter_of_iff {G V : Type*} + [Group G] [Fintype G] [MulAction G V] [Fintype V] [DecidableEq V] + (w : V) (bad canonical : V → Prop) [DecidablePred bad] + (h : ∀ v, bad v ↔ canonical v) : + (((OrbitCounting.orbitSet (G := G) w).filter bad).card : ℝ) / + (OrbitCounting.orbitSet (G := G) w).card = + ((rejectedFilter (fullOrbitFilter G w) canonical).card : ℝ) / + (fullOrbitFilter G w).card := by + rw [← fullOrbitFilter_bad_fraction_eq_orbit (G := G) w bad, + rejectedFilter_congr (fullOrbitFilter G w) bad canonical h] + +theorem full_orbitSet_as_filter {G V : Type*} [Group G] [Fintype G] + [MulAction G V] [Fintype V] [DecidableEq V] (v : V) : + OrbitCounting.orbitSet (G := G) v = + Finset.univ.filter (fun w => ∃ g : G, g • v = w) := by + ext w + simp only [OrbitCounting.orbitSet, Finset.mem_image, Finset.mem_univ, + true_and, Finset.mem_filter] + +variable {C : Type*} {P X Y : C → Type*} +variable [Fintype C] [DecidableEq C] + [∀ c, Fintype (P c)] [∀ c, DecidableEq (P c)] + [Fintype (CompleteWordPair P X Y)] +variable {I : Type*} [Fintype I] {SL SR : I → C → Type*} + +theorem finite_selectedWordPair_full_filter_inverse_linear_of_windows + (D : I → Finset C) (w : CompleteWordPair P X Y) + (sl : ∀ i c, X c → SL i c) (sr : ∀ i c, Y c → SR i c) + (s : ∀ i c, SL i c) (t : ∀ i c, SR i c) + (hn : ∀ i c, c ∈ D i → 2 ≤ Fintype.card (P c)) + (mass : I → ℝ) (N : ℝ) (hN : 0 < N) (hmass : ∀ i, 0 < mass i) + (hsize : ∀ i, populationSize (fun c : D i => P c) = mass i * N) + (left right : I → C → ℝ) (η τ α ν : I → ℝ) (hη : ∀ i, 0 < η i) + (hright0 : ∀ i c, c ∈ D i → 0 ≤ right i c) + (hright1 : ∀ i c, c ∈ D i → right i c ≤ 1) + (hleft : ∀ i c, c ∈ D i → + |classDensity (wordPairLeftPositions w (sl i) (s i)) c - left i c| ≤ τ i) + (hright : ∀ i c, c ∈ D i → + |classDensity (wordPairRightPositions w (sr i) (t i)) c - right i c| ≤ τ i) + (happrox : ∀ i, |classProductMixture (fun c : D i => P c) + (fun c => left i c) (fun c => right i c) - ν i| ≤ α i) + (hτ : ∀ i, τ i ≤ η i / 8) (hα : ∀ i, α i ≤ η i / 4) : + ((rejectedFilter (fullOrbitFilter (HalfClassPermutations P) w) + (fun v => ∃ i, selectedWordPairMaskBad (D i) (sl i) (sr i) + (s i) (t i) (η i) (ν i) v)).card : ℝ) / + (fullOrbitFilter (HalfClassPermutations P) w).card ≤ + (∑ i, 1 / (2 * mass i * (η i) ^ 2)) / N := by + classical + have h := finite_selectedWordPair_orbit_inverse_linear_of_windows + D w sl sr s t hn mass N hN hmass hsize left right η τ α ν hη + hright0 hright1 hleft hright happrox hτ hα + exact (fullOrbitFilter_bad_fraction_eq_orbit (G := HalfClassPermutations P) w _).trans_le h + +end MatrixMultiplication.PermutationMatching + +namespace MatrixMultiplication.AllFieldHistoryMasks + +open AllFieldHistory AllFieldHistoryChildLaws AllFieldHistorySupport +open JointCanonicalization InheritedMasks PermutationMatching HistorySymmetry +open scoped BigOperators + +attribute [local instance] Classical.propDecidable Classical.decEq + +variable {K tick : ℕ} + +theorem testedClasses_parent (allocation : Allocation) (i : MaskIndex K tick) + (c : Classes K tick) (hc : c ∈ testedClasses allocation i) : c.1 = i.1 := + (Finset.mem_filter.mp hc).2.1 + +theorem rightProbability_le_one (allocation : Allocation) (side : Fin 3) + (i : MaskIndex K tick) (c : Classes K tick) (hc : c ∈ testedClasses allocation i) : + rightProbability side i c ≤ 1 := by + have hsum := rightLaw_normalized allocation 1 c.1 c.2 + (positiveClasses_positive allocation i.1 c hc) side + rw [← hsum] + exact Finset.single_le_sum (fun a _ => rightLaw_nonnegative c.1 c.2 side a) + (Finset.mem_univ _) + +theorem left_density_le (allocation : Allocation) {m : ℕ} (hm : 0 < m) + (ε : ℝ) (side : Fin 3) (w : Words (K := K) (tick := tick) allocation m) + (hw : childWindows allocation m ε side w) (i : MaskIndex K tick) + (c : Classes K tick) (hc : c ∈ testedClasses allocation i) : + |classDensity (wordPairLeftPositions w classStatistic (leftSymbol i)) c - + leftProbability side i c| ≤ childWidth ε i.1 := by + have hp : 0 < activeCounts allocation m c.1 c.2 := + (activeCounts_pos_iff allocation hm c.1 c.2).2 + (positiveClasses_positive allocation i.1 c hc) + have ht := (hw c).1 (leftSymbol i c) + have hh := testedClasses_parent allocation i c hc + have ht' : |empiricalLaw (classStatistic c ∘ w.left c) (leftSymbol i c) - + leftProbability side i c| ≤ childWidth ε c.1 := by + simpa only [activeLaw, activeWidth, ite_eq_left hp, leftProbability] using ht + have hd := classDensity_statisticPositions w.left classStatistic (leftSymbol i) c + change classDensity (wordPairLeftPositions w classStatistic (leftSymbol i)) c = _ at hd + rw [hd] + exact ht'.trans_eq (congrArg (childWidth ε) hh) + +theorem right_density_le (allocation : Allocation) {m : ℕ} (hm : 0 < m) + (ε : ℝ) (side : Fin 3) (w : Words (K := K) (tick := tick) allocation m) + (hw : childWindows allocation m ε side w) (i : MaskIndex K tick) + (c : Classes K tick) (hc : c ∈ testedClasses allocation i) : + |classDensity (wordPairRightPositions w classStatistic (rightSymbol i)) c - + rightProbability side i c| ≤ childWidth ε i.1 := by + have hp : 0 < activeCounts allocation m c.1 c.2 := + (activeCounts_pos_iff allocation hm c.1 c.2).2 + (positiveClasses_positive allocation i.1 c hc) + have ht := (hw c).2 (rightSymbol i c) + have hh := testedClasses_parent allocation i c hc + have ht' : |empiricalLaw (classStatistic c ∘ w.right c) (rightSymbol i c) - + rightProbability side i c| ≤ childWidth ε c.1 := by + simpa only [activeLaw, activeWidth, ite_eq_left hp, rightProbability] using ht + have hd := classDensity_statisticPositions w.right classStatistic (rightSymbol i) c + change classDensity (wordPairRightPositions w classStatistic (rightSymbol i)) c = _ at hd + rw [hd] + exact ht'.trans_eq (congrArg (childWidth ε) hh) + +theorem mixture_error_zero (allocation : Allocation) {m : ℕ} (hm : 0 < m) + (side : Fin 3) (i : MaskIndex K tick) : + |classProductMixture (fun c : testedClasses allocation i => Positions allocation m c.val) + (fun c => leftProbability side i c.val) (fun c => rightProbability side i c.val) - + center allocation side i| ≤ (0 : ℝ) := by + rw [selected_classProductMixture_eq_one allocation hm] + simp only [center, sub_self, abs_zero, le_refl] + +theorem orbitSet_as_filter {G V : Type*} [Group G] [Fintype G] [MulAction G V] + [Fintype V] [DecidableEq V] (v : V) : + OrbitCounting.orbitSet (G := G) v = + Finset.univ.filter (fun w => ∃ g : G, g • v = w) := by + ext w + simp only [OrbitCounting.orbitSet, Finset.mem_image, Finset.mem_univ, + true_and, Finset.mem_filter] + +attribute [local irreducible] activeCounts + +theorem full_filter_loss_le (allocation : Allocation) {m : ℕ} (hm : 2 ≤ m) + {ε : ℝ} (hε : 0 < ε) (side : Fin 3) + (w : Words (K := K) (tick := tick) allocation m) + (hw : childWindows allocation m ε side w) : + ((rejectedFilter + (fullOrbitFilter (HalfClassPermutations (Positions (K := K) (tick := tick) allocation m)) w) + (fun v => ∃ i : MaskIndex K tick, + selectedWordPairMaskBad (testedClasses allocation i) classStatistic classStatistic + (leftSymbol i) (rightSymbol i) (pairWidth ε i.1) (center allocation side i) v)).card : ℝ) / + (fullOrbitFilter + (HalfClassPermutations (Positions (K := K) (tick := tick) allocation m)) w).card ≤ + lossConstant (K := K) (tick := tick) allocation ε / m := by + have hmpos : 0 < m := lt_of_lt_of_le (by decide : 0 < 2) hm + have hsize (i : MaskIndex K tick) : + populationSize (fun c : testedClasses allocation i => Positions allocation m c.val) = + selectedBasePopulation allocation (testedClasses allocation i) * m := + selected_populationSize allocation m (testedClasses allocation i) + have hn (i : MaskIndex K tick) (c : Classes K tick) + (hc : c ∈ testedClasses allocation i) : 2 ≤ Fintype.card (Positions allocation m c) := by + exact selected_two_le allocation hm (testedClasses allocation i) + (positiveClasses_positive allocation i.1) ⟨c, hc⟩ + have hmass (i : MaskIndex K tick) : + 0 < selectedBasePopulation allocation (testedClasses allocation i) := + positiveClasses_basePopulation_pos allocation i.1 + have hright0 (i : MaskIndex K tick) (c : Classes K tick) + (_hc : c ∈ testedClasses allocation i) : 0 ≤ rightProbability side i c := + rightLaw_nonnegative c.1 c.2 side _ + have h := finite_selectedWordPair_full_filter_inverse_linear_of_windows + (C := Classes K tick) (P := Positions (K := K) (tick := tick) allocation m) + (X := Letters) (Y := Letters) (I := MaskIndex K tick) + (SL := fun _ c => Statistic c.1) (SR := fun _ c => Statistic c.1) + (testedClasses allocation) w (fun _ => classStatistic) (fun _ => classStatistic) + leftSymbol rightSymbol hn + (fun i => selectedBasePopulation allocation (testedClasses allocation i)) (m : ℝ) + (by exact_mod_cast hmpos) hmass hsize + (leftProbability side) (rightProbability side) + (fun i => pairWidth ε i.1) (fun i => childWidth ε i.1) (fun _ => 0) + (center allocation side) (fun i => pairWidth_pos hε i.1) + hright0 (rightProbability_le_one allocation side) + (left_density_le allocation hmpos ε side w hw) + (right_density_le allocation hmpos ε side w hw) + (mixture_error_zero allocation hmpos side) (fun _ => le_rfl) + (fun i => (div_pos (pairWidth_pos hε i.1) (by norm_num : (0 : ℝ) < 4)).le) + simpa only [lossConstant] using h + +theorem orbit_loss_le (allocation : Allocation) {m : ℕ} (hm : 2 ≤ m) + {ε : ℝ} (hε : 0 < ε) (side : Fin 3) + (w : Words (K := K) (tick := tick) allocation m) + (hw : childWindows allocation m ε side w) : + (((OrbitCounting.orbitSet + (G := HalfClassPermutations (Positions (K := K) (tick := tick) allocation m)) w).filter + (fun v => ¬passes allocation m ε side v)).card : ℝ) / + (OrbitCounting.orbitSet + (G := HalfClassPermutations (Positions (K := K) (tick := tick) allocation m)) w).card ≤ + lossConstant (K := K) (tick := tick) allocation ε / m := by + have heq := orbit_bad_fraction_eq_fullOrbitFilter_of_iff + (G := HalfClassPermutations (Positions (K := K) (tick := tick) allocation m)) w + (fun v => ¬passes allocation m ε side v) + (fun v => ∃ i : MaskIndex K tick, + selectedWordPairMaskBad (testedClasses allocation i) classStatistic classStatistic + (leftSymbol i) (rightSymbol i) (pairWidth ε i.1) (center allocation side i) v) + (fun v => by simp only [passes, not_forall, not_not]) + exact heq.trans_le (full_filter_loss_le allocation hm hε side w hw) + +end MatrixMultiplication.AllFieldHistoryMasks + +end + +namespace MatrixMultiplication.OrbitLoss + +variable {X : Type*} [DecidableEq X] + +theorem missing_card_partition (s : Finset X) (pass assigned : X → Prop) + [DecidablePred pass] [DecidablePred assigned] : + (s.filter fun x => ¬(pass x ∧ assigned x)).card = + (s.filter fun x => ¬pass x).card + + (s.filter fun x => pass x ∧ ¬assigned x).card := by + classical + have heq : (s.filter fun x => ¬(pass x ∧ assigned x)) = + (s.filter fun x => ¬pass x) ∪ (s.filter fun x => pass x ∧ ¬assigned x) := by + ext x + by_cases hp : pass x <;> simp [hp] + have hd : Disjoint (s.filter fun x => ¬pass x) + (s.filter fun x => pass x ∧ ¬assigned x) := by + apply Finset.disjoint_left.mpr + intro x hx hy + exact (Finset.mem_filter.mp hx).2 (Finset.mem_filter.mp hy).2.1 + rw [heq, Finset.card_union_of_disjoint hd] + +theorem missing_fraction_partition (s : Finset X) (pass assigned : X → Prop) + [DecidablePred pass] [DecidablePred assigned] : + ((s.filter fun x => ¬(pass x ∧ assigned x)).card : ℝ) / s.card = + ((s.filter fun x => ¬pass x).card : ℝ) / s.card + + ((s.filter fun x => pass x ∧ ¬assigned x).card : ℝ) / s.card := by + rw [missing_card_partition, Nat.cast_add, add_div] + +theorem combined_inverse_linear (s : Finset X) (pass assigned : X → Prop) + [DecidablePred pass] [DecidablePred assigned] (C : ℝ) (N : ℕ) + (hmask : ((s.filter fun x => ¬pass x).card : ℝ) / s.card ≤ C / N) + (hcollision : ((s.filter fun x => pass x ∧ ¬assigned x).card : ℝ) / s.card ≤ 1 / N) : + ((s.filter fun x => ¬(pass x ∧ assigned x)).card : ℝ) / s.card ≤ (C + 1) / N := by + rw [missing_fraction_partition, add_div] + exact add_le_add hmask hcollision + +end MatrixMultiplication.OrbitLoss + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +open MatrixMultiplication.Foundation + +namespace MatrixMultiplication.JointOrbitRecovery + +variable {K G X Y Z : Type*} [CommSemiring K] [Group G] [Fintype G] + [MulAction G X] [MulAction G Y] [MulAction G Z] + [Fintype X] [Fintype Y] [Fintype Z] + [DecidableEq X] [DecidableEq Y] [DecidableEq Z] + +def SeparatedLoss {V : Type*} [DecidableEq V] [MulAction G V] + (pass assigned : V → Prop) [DecidablePred pass] [DecidablePred assigned] + (C : ℝ) (N : ℕ) (v : V) : Prop := + (((OrbitCounting.orbitSet (G := G) v).filter fun w => ¬pass w).card : ℝ) / + (OrbitCounting.orbitSet (G := G) v).card ≤ C / N ∧ + (((OrbitCounting.orbitSet (G := G) v).filter fun w => pass w ∧ ¬assigned w).card : ℝ) / + (OrbitCounting.orbitSet (G := G) v).card ≤ 1 / N + +theorem separatedLoss_transport {U V : Type*} [DecidableEq U] [DecidableEq V] + [MulAction G V] (e : U ≃ V) + (pass assigned : U → Prop) [DecidablePred pass] [DecidablePred assigned] + (C : ℝ) (N : ℕ) (u : U) : + letI : MulAction G U := EquivOrbitTransport.action e + SeparatedLoss (G := G) pass assigned C N u ↔ + SeparatedLoss (G := G) (pass ∘ e.symm) (assigned ∘ e.symm) C N (e u) := by + let : MulAction G U := EquivOrbitTransport.action e + unfold SeparatedLoss + rw [EquivOrbitTransport.rejected_fraction e (fun w => ¬pass w) u, + EquivOrbitTransport.rejected_fraction e (fun w => pass w ∧ ¬assigned w) u] + simp only [Function.comp_def] + +theorem combined_loss {V : Type*} [DecidableEq V] [MulAction G V] + (pass assigned : V → Prop) [DecidablePred pass] [DecidablePred assigned] + (C : ℝ) (N : ℕ) (v : V) (h : SeparatedLoss (G := G) pass assigned C N v) : + (((OrbitCounting.orbitSet (G := G) v).filter fun w => ¬(assigned w ∧ pass w)).card : ℝ) / + (OrbitCounting.orbitSet (G := G) v).card ≤ (C + 1) / N := by + simpa only [and_comm] using + OrbitLoss.combined_inverse_linear (OrbitCounting.orbitSet (G := G) v) + pass assigned C N h.1 h.2 + +theorem repair_of_separated_losses + (Q H : Tensor K X Y Z) + (passX assignedX : X → Prop) (passY assignedY : Y → Prop) + (passZ assignedZ : Z → Prop) + [DecidablePred passX] [DecidablePred assignedX] + [DecidablePred passY] [DecidablePred assignedY] + [DecidablePred passZ] [DecidablePred assignedZ] + (hhole : H = ExactRecovery.delete Q + (fun x => assignedX x ∧ passX x) (fun y => assignedY y ∧ passY y) + (fun z => assignedZ z ∧ passZ z)) + (hpreserve : ∀ (g : G) x y z, Q (g • x) (g • y) (g • z) = Q x y z) + {b C : ℝ} {N : ℕ} (hb : 0 ≤ b) (hC : 0 ≤ C) + (hN : 3 * (C + 1) < (N : ℝ)) + (hsupport : ((RecoverySupport.support Q).card : ℝ) ≤ Real.exp (b * N)) + (hx : ∀ x, (∃ y z, Q x y z ≠ 0) → + SeparatedLoss (G := G) passX assignedX C N x) + (hy : ∀ y, (∃ x z, Q x y z ≠ 0) → + SeparatedLoss (G := G) passY assignedY C N y) + (hz : ∀ z, (∃ x y, Q x y z ≠ 0) → + SeparatedLoss (G := G) passZ assignedZ C N z) : + InverseLinearRecovery.RecoveredBy Q H (RecoveryGrowth.shiftCount b (C + 1) N) := by + classical + rw [hhole] + apply InverseLinearRecovery.repair_inverse_linear Q + (fun x => assignedX x ∧ passX x) (fun y => assignedY y ∧ passY y) + (fun z => assignedZ z ∧ passZ z) hpreserve hb (by linarith) hN + · have heq : (@Finset.filter (X × Y × Z) + (fun p => Q p.1 p.2.1 p.2.2 ≠ 0) (Classical.decPred _) Finset.univ) = + RecoverySupport.support Q := by + ext p + simp only [RecoverySupport.support, Finset.mem_filter] + rw [heq] + exact hsupport + · intro x hused + exact combined_loss passX assignedX C N x (hx x hused) + · intro y hused + exact combined_loss passY assignedY C N y (hy y hused) + · intro z hused + exact combined_loss passZ assignedZ C N z (hz z hused) + +theorem subexponential_copies {b C : ℝ} (hb : 0 < b) (hC : 0 ≤ C) : + Filter.Tendsto (fun N : ℕ => + Real.log (Fintype.card + (InverseLinearRecovery.MaskRectangles (RecoveryGrowth.shiftCount b (C + 1) N))) / N) + Filter.atTop (nhds 0) := + InverseLinearRecovery.subexponential_copies hb (by linarith) + +end MatrixMultiplication.JointOrbitRecovery + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +noncomputable section + +namespace MatrixMultiplication.AllFieldHistoryRecovery + +open MatrixMultiplication.Foundation AllFieldHistory AllFieldHistoryChildLaws +open AllFieldHistorySupport JointPopulation JointCanonicalization JointCanonicalCW +open PermutationMatching +open scoped BigOperators + +attribute [local instance] Classical.propDecidable Classical.decEq + +variable {K tick : ℕ} + +theorem ideal_coordinates (F : Type*) [CommRing F] (allocation : Allocation) + (m : ℕ) (ε : ℝ) (e : Targets (K := K) (tick := tick) allocation m) + (x y z : Raw (K := K) (tick := tick) allocation m) : + ideal F allocation m ε e x y z = canonical F allocation m ε + (coordinates allocation m e x) (coordinates allocation m e y) + (coordinates allocation m e z) := + ideal_eq_canonicalIdeal (activeCounts allocation m) (Left activeHalfLength) + (Right activeHalfLength) (parents F) + (coarse activeHalfLength activeHalfLength halfLength_le_eight) + childStatistic childStatistic leftPrescription rightPrescription + (outputWidth ε) (outputWidth ε) e x y z + +theorem ideal_support_windows (F : Type*) [CommRing F] (allocation : Allocation) + (m : ℕ) (ε : ℝ) (e : Targets (K := K) (tick := tick) allocation m) + (x y z : Raw (K := K) (tick := tick) allocation m) (hq : ideal F allocation m ε e x y z ≠ 0) : + AllFieldHistoryMasks.childWindows allocation m ε 0 (coordinates allocation m e x) ∧ + AllFieldHistoryMasks.childWindows allocation m ε 1 (coordinates allocation m e y) ∧ + AllFieldHistoryMasks.childWindows allocation m ε 2 (coordinates allocation m e z) := by + by_contra hn + apply hq + rw [ideal_coordinates] + change (if AllFieldHistoryMasks.childWindows allocation m ε 0 (coordinates allocation m e x) ∧ + AllFieldHistoryMasks.childWindows allocation m ε 1 (coordinates allocation m e y) ∧ + AllFieldHistoryMasks.childWindows allocation m ε 2 (coordinates allocation m e z) + then _ else 0) = 0 + exact ite_eq_right hn + +theorem raw_pair_loss_le (allocation : Allocation) {m : ℕ} (hm : 2 ≤ m) + {ε : ℝ} (hε : 0 < ε) (side : Fin 3) + (e : Targets (K := K) (tick := tick) allocation m) (w : Raw (K := K) (tick := tick) allocation m) + (hw : AllFieldHistoryMasks.childWindows allocation m ε side + (coordinates allocation m e w)) : + letI _rawInst : MulAction (Symmetries (K := K) (tick := tick) allocation m) (Raw (K := K) (tick := tick) allocation m) := rawAction allocation m e + (((OrbitCounting.orbitSet (G := Symmetries (K := K) (tick := tick) allocation m) w).filter + (fun v => ¬AllFieldHistoryRawMasks.rawPass allocation m ε side v)).card : ℝ) / + (OrbitCounting.orbitSet (G := Symmetries (K := K) (tick := tick) allocation m) w).card ≤ + AllFieldHistoryMasks.lossConstant (K := K) (tick := tick) allocation ε / m := by + let rawInst : MulAction (Symmetries (K := K) (tick := tick) allocation m) (Raw (K := K) (tick := tick) allocation m) := rawAction allocation m e + have htransport := EquivOrbitTransport.rejected_fraction + (G := Symmetries (K := K) (tick := tick) allocation m) (coordinates allocation m e) + (fun v => ¬AllFieldHistoryRawMasks.rawPass allocation m ε side v) w + have hcanonical := orbit_bad_fraction_eq_fullOrbitFilter_of_iff + (G := Symmetries (K := K) (tick := tick) allocation m) + (coordinates allocation m e w) + ((fun v => ¬AllFieldHistoryRawMasks.rawPass allocation m ε side v) ∘ + (coordinates allocation m e).symm) + (fun v => ∃ i : AllFieldHistoryMasks.MaskIndex K tick, + selectedWordPairMaskBad (AllFieldHistoryMasks.testedClasses allocation i) + AllFieldHistoryMasks.classStatistic AllFieldHistoryMasks.classStatistic + (AllFieldHistoryMasks.leftSymbol i) (AllFieldHistoryMasks.rightSymbol i) + (AllFieldHistoryMasks.pairWidth ε i.1) (AllFieldHistoryMasks.center allocation side i) v) + (fun v => by + change ¬AllFieldHistoryRawMasks.rawPass allocation m ε side + ((coordinates allocation m e).symm v) ↔ _ + rw [← AllFieldHistoryRawMasks.passes_pairEquiv_iff_rawPass allocation m ε side e] + change ¬AllFieldHistoryMasks.passes allocation m ε side + ((coordinates allocation m e) ((coordinates allocation m e).symm v)) ↔ _ + rw [Equiv.apply_symm_apply] + simp only [AllFieldHistoryMasks.passes, not_forall, not_not]) + exact htransport.trans_le (hcanonical.trans_le + (AllFieldHistoryMasks.full_filter_loss_le allocation hm hε side + (coordinates allocation m e w) hw)) + +theorem ideal_support_marginals (F : Type*) [CommRing F] (allocation : Allocation) + (m : ℕ) (ε : ℝ) (e : Targets (K := K) (tick := tick) allocation m) + (x y z : Raw (K := K) (tick := tick) allocation m) (hq : ideal F allocation m ε e x y z ≠ 0) : + JointCanonicalMixed.sideMask (activeCounts allocation m) + activeHalfLength activeHalfLength halfLength_le_eight 0 x ∧ + JointCanonicalMixed.sideMask (activeCounts allocation m) + activeHalfLength activeHalfLength halfLength_le_eight 1 y ∧ + JointCanonicalMixed.sideMask (activeCounts allocation m) + activeHalfLength activeHalfLength halfLength_le_eight 2 z := by + exact JointCanonicalMixed.ideal_support_masks (activeCounts allocation m) + activeHalfLength activeHalfLength activeParentShape (fun _ => true) + halfLength_le_eight e _ _ _ x y z hq + +def sideWeights (allocation : Allocation) (m : ℕ) (side : Fin 3) + (e : Targets (K := K) (tick := tick) allocation m) (w : Raw (K := K) (tick := tick) allocation m) : Prop := + ∀ h j, + CWStrands.weight (w h j).1 = (shapeSide side ((e h).val j)).val ∧ + CWStrands.weight (w h j).2 = activeParentShape h side - + (shapeSide side ((e h).val j)).val + +theorem ideal_support_weights (F : Type*) [CommRing F] (allocation : Allocation) + (m : ℕ) (ε : ℝ) (e : Targets (K := K) (tick := tick) allocation m) + (x y z : Raw (K := K) (tick := tick) allocation m) (hq : ideal F allocation m ε e x y z ≠ 0) : + sideWeights allocation m 0 e x ∧ sideWeights allocation m 1 e y ∧ + sideWeights allocation m 2 e z := by + have hb : coarseIdeal (activeCounts allocation m) + (Left activeHalfLength) (Right activeHalfLength) (parents F) + (coarse activeHalfLength activeHalfLength halfLength_le_eight) e x y z ≠ 0 := by + intro hz + apply hq + simp only [ideal, JointCanonicalization.ideal, ExactRecovery.delete, hz, ite_self] + have hc : + coarseMask (activeCounts allocation m) (Left activeHalfLength) (Right activeHalfLength) + (coarse activeHalfLength activeHalfLength halfLength_le_eight) 0 e x ∧ + coarseMask (activeCounts allocation m) (Left activeHalfLength) (Right activeHalfLength) + (coarse activeHalfLength activeHalfLength halfLength_le_eight) 1 e y ∧ + coarseMask (activeCounts allocation m) (Left activeHalfLength) (Right activeHalfLength) + (coarse activeHalfLength activeHalfLength halfLength_le_eight) 2 e z := by + by_contra hn + exact hb (by simp only [coarseIdeal, ExactRecovery.delete, ite_eq_right hn]) + have hs : rawSource F allocation m x y z ≠ 0 := by + intro hz + apply hb + change (if _ then rawSource F allocation m x y z else 0) = 0 + simp only [hz, ite_self] + have ht (h : Active K tick) (j : JointPopulation.Positions (activeCounts allocation m) h) : + parents F h (x h j) (y h j) (z h j) ≠ 0 := by + intro hz + apply hs + unfold rawSource sourceTensor InheritedMasks.classProduct + exact Finset.prod_eq_zero (Finset.mem_univ h) + (Finset.prod_eq_zero (Finset.mem_univ j) hz) + have hp (h : Active K tick) (j : JointPopulation.Positions (activeCounts allocation m) h) : + CWStrands.weight (x h j).1 + CWStrands.weight (x h j).2 = activeParentShape h 0 ∧ + CWStrands.weight (y h j).1 + CWStrands.weight (y h j).2 = activeParentShape h 1 ∧ + CWStrands.weight (z h j).1 + CWStrands.weight (z h j).2 = activeParentShape h 2 := by + have hh := ht h j + change CWStrands.shapeTensor + (Fin (activeHalfLength h) ⊕ Fin (activeHalfLength h)) (activeParentShape h) + (Sum.elim (x h j).1 (x h j).2) (Sum.elim (y h j).1 (y h j).2) + (Sum.elim (z h j).1 (z h j).2) ≠ 0 at hh + simpa only [CWStrands.weight_sum_elim] using + CWStrands.shapeTensor_support (activeParentShape h) _ _ _ hh + have hx (h : Active K tick) (j : JointPopulation.Positions (activeCounts allocation m) h) : + CWStrands.weight (x h j).1 = (shapeSide 0 ((e h).val j)).val := + congrArg Fin.val (hc.1 h j) + have hy (h : Active K tick) (j : JointPopulation.Positions (activeCounts allocation m) h) : + CWStrands.weight (y h j).1 = (shapeSide 1 ((e h).val j)).val := + congrArg Fin.val (hc.2.1 h j) + have hz (h : Active K tick) (j : JointPopulation.Positions (activeCounts allocation m) h) : + CWStrands.weight (z h j).1 = (shapeSide 2 ((e h).val j)).val := + congrArg Fin.val (hc.2.2 h j) + refine ⟨?_, ?_, ?_⟩ + · intro h j + refine ⟨hx h j, ?_⟩ + have hh := (hp h j).1 + rw [hx h j] at hh + omega + · intro h j + refine ⟨hy h j, ?_⟩ + have hh := (hp h j).2.1 + rw [hy h j] at hh + omega + · intro h j + refine ⟨hz h j, ?_⟩ + have hh := (hp h j).2.2 + rw [hz h j] at hh + omega + +theorem stageCWeights_of_sideWeights (allocation : Allocation) (m : ℕ) (side : Fin 3) + (e : Targets (K := K) (tick := tick) allocation m) (w : Raw (K := K) (tick := tick) allocation m) + (hw : sideWeights allocation m side e w) : + AllFieldHistoryIncomingMasks.stageCWeights allocation m side e w := by + intro h phi ht j + have hh := hw (AllFieldHistoryStageCIncoming.stageCActive h phi ht) j + change (∑ index : Fin 1, CWLeafStatistics.weight + ((w (AllFieldHistoryStageCIncoming.stageCActive h phi ht) j).1 index)) = _ ∧ + (∑ index : Fin 1, CWLeafStatistics.weight + ((w (AllFieldHistoryStageCIncoming.stageCActive h phi ht) j).2 index)) = _ at hh + simpa only [Fin.sum_univ_one] using hh + +theorem completeKeep_of_supported (allocation : Allocation) {m : ℕ} (hm : 0 < m) + {ε : ℝ} (hε : 0 ≤ ε) (side : Fin 3) + (e : Targets (K := K) (tick := tick) allocation m) (w : Raw (K := K) (tick := tick) allocation m) + (hmarginal : JointCanonicalMixed.sideMask (activeCounts allocation m) + activeHalfLength activeHalfLength halfLength_le_eight side w) + (hweights : sideWeights allocation m side e w) + (hpass : AllFieldHistoryRawMasks.rawPass allocation m ε side w) : + completeKeep allocation m ε side w := + ⟨hmarginal, AllFieldHistoryIncomingMasks.received_of_rawPass allocation hm hε side e w + hpass (stageCWeights_of_sideWeights allocation m side e w hweights), hpass⟩ + +theorem occupied_split_le (allocation : Allocation) (m : ℕ) + (h : Active K tick) (u : JointPopulation.Shape) + (hu : 0 < activeCounts allocation m h u) : + ∀ s, shapeNat u s ≤ activeParentShape h s := + jointCounts_support_le allocation m h.val u hu + +theorem ideal_smul (F : Type*) [CommRing F] (allocation : Allocation) (m : ℕ) (ε : ℝ) + (e : Targets (K := K) (tick := tick) allocation m) : + letI rawInst : MulAction (Symmetries (K := K) (tick := tick) allocation m) (Raw (K := K) (tick := tick) allocation m) := rawAction allocation m e + ∀ (g : Symmetries (K := K) (tick := tick) allocation m) (x y z : Raw (K := K) (tick := tick) allocation m), + ideal F allocation m ε e ((@SMul.smul _ _ rawInst.toSMul g x)) ((@SMul.smul _ _ rawInst.toSMul g y)) ((@SMul.smul _ _ rawInst.toSMul g z)) = ideal F allocation m ε e x y z := by + exact JointCanonicalSymmetry.rawIdeal_smul (activeCounts allocation m) + activeHalfLength activeHalfLength activeParentShape (fun _ => true) + halfLength_le_eight childStatistic childStatistic leftPrescription rightPrescription + (outputWidth ε) (outputWidth ε) + (fun h u hu _ => occupied_split_le allocation m h u hu) e + +def Used (F : Type*) [CommRing F] (allocation : Allocation) (m : ℕ) (ε : ℝ) + (e : Targets (K := K) (tick := tick) allocation m) (side : Fin 3) + (w : Raw (K := K) (tick := tick) allocation m) : Prop := + ∃ x y z, ideal F allocation m ε e x y z ≠ 0 ∧ sideVariable side x y z = w + +theorem used_windows (F : Type*) [CommRing F] (allocation : Allocation) + (m : ℕ) (ε : ℝ) (e : Targets (K := K) (tick := tick) allocation m) + (side : Fin 3) (w : Raw (K := K) (tick := tick) allocation m) (hw : Used F allocation m ε e side w) : + AllFieldHistoryMasks.childWindows allocation m ε side (coordinates allocation m e w) := by + obtain ⟨x, y, z, hq, rfl⟩ := hw + have hh := ideal_support_windows F allocation m ε e x y z hq + fin_cases side + · exact hh.1 + · exact hh.2.1 + · exact hh.2.2 + +theorem used_keep_iff_rawPass (F : Type*) [CommRing F] (allocation : Allocation) + {m : ℕ} (hm : 0 < m) {ε : ℝ} (hε : 0 ≤ ε) + (e : Targets (K := K) (tick := tick) allocation m) + (side : Fin 3) (w : Raw (K := K) (tick := tick) allocation m) (hw : Used F allocation m ε e side w) : + completeKeep allocation m ε side w ↔ AllFieldHistoryRawMasks.rawPass allocation m ε side w := by + refine ⟨fun h => h.2.2, ?_⟩ + intro hp + obtain ⟨x, y, z, hq, rfl⟩ := hw + have hmg := ideal_support_marginals F allocation m ε e x y z hq + have hwt := ideal_support_weights F allocation m ε e x y z hq + fin_cases side + · exact completeKeep_of_supported allocation hm hε 0 e x hmg.1 hwt.1 hp + · exact completeKeep_of_supported allocation hm hε 1 e y hmg.2.1 hwt.2.1 hp + · exact completeKeep_of_supported allocation hm hε 2 e z hmg.2.2 hwt.2.2 hp + +theorem used_smul (F : Type*) [CommRing F] (allocation : Allocation) + (m : ℕ) (ε : ℝ) (e : Targets (K := K) (tick := tick) allocation m) + (side : Fin 3) (w : Raw (K := K) (tick := tick) allocation m) : + letI rawInst : MulAction (Symmetries (K := K) (tick := tick) allocation m) (Raw (K := K) (tick := tick) allocation m) := rawAction allocation m e + ∀ g : Symmetries (K := K) (tick := tick) allocation m, Used F allocation m ε e side w → + Used F allocation m ε e side ((@SMul.smul _ _ rawInst.toSMul g w)) := by + let rawInst : MulAction (Symmetries (K := K) (tick := tick) allocation m) (Raw (K := K) (tick := tick) allocation m) := rawAction allocation m e + intro g hw + obtain ⟨x, y, z, hq, rfl⟩ := hw + refine ⟨(@SMul.smul _ _ rawInst.toSMul g x), (@SMul.smul _ _ rawInst.toSMul g y), (@SMul.smul _ _ rawInst.toSMul g z), ?_, ?_⟩ + · rwa [ideal_smul] + · fin_cases side <;> rfl + +theorem deterministic_loss_le (F : Type*) [CommRing F] (allocation : Allocation) + {m : ℕ} (hm : 2 ≤ m) {ε : ℝ} (hε : 0 < ε) + (e : Targets (K := K) (tick := tick) allocation m) + (side : Fin 3) (w : Raw (K := K) (tick := tick) allocation m) (hw : Used F allocation m ε e side w) : + letI _rawInst : MulAction (Symmetries (K := K) (tick := tick) allocation m) (Raw (K := K) (tick := tick) allocation m) := rawAction allocation m e + (((OrbitCounting.orbitSet (G := Symmetries (K := K) (tick := tick) allocation m) w).filter + (fun v => ¬completeKeep allocation m ε side v)).card : ℝ) / + (OrbitCounting.orbitSet (G := Symmetries (K := K) (tick := tick) allocation m) w).card ≤ + AllFieldHistoryMasks.lossConstant (K := K) (tick := tick) allocation ε / m := by + let rawInst : MulAction (Symmetries (K := K) (tick := tick) allocation m) (Raw (K := K) (tick := tick) allocation m) := rawAction allocation m e + have hmpos : 0 < m := lt_of_lt_of_le (by decide : 0 < 2) hm + have heq : ((OrbitCounting.orbitSet (G := Symmetries (K := K) (tick := tick) allocation m) w).filter + (fun v => ¬completeKeep allocation m ε side v)) = + ((OrbitCounting.orbitSet (G := Symmetries (K := K) (tick := tick) allocation m) w).filter + (fun v => ¬AllFieldHistoryRawMasks.rawPass allocation m ε side v)) := by + apply Finset.filter_congr + intro v hv + obtain ⟨g, _, rfl⟩ := Finset.mem_image.mp hv + exact not_congr (used_keep_iff_rawPass F allocation hmpos hε.le e side _ + (used_smul F allocation m ε e side w g hw)) + rw [heq] + exact raw_pair_loss_le allocation hm hε side e w + (used_windows F allocation m ε e side w hw) + +def holedIdeal (F : Type*) [CommRing F] (allocation : Allocation) (m : ℕ) (ε : ℝ) + (e : Targets (K := K) (tick := tick) allocation m) + (assigned : Fin 3 → Raw (K := K) (tick := tick) allocation m → Prop) : + Tensor F (Raw (K := K) (tick := tick) allocation m) (Raw (K := K) (tick := tick) allocation m) (Raw (K := K) (tick := tick) allocation m) := + ExactRecovery.delete (ideal F allocation m ε e) + (fun w => assigned 0 w ∧ completeKeep allocation m ε 0 w) + (fun w => assigned 1 w ∧ completeKeep allocation m ε 1 w) + (fun w => assigned 2 w ∧ completeKeep allocation m ε 2 w) + +theorem ideal_eq_delete_source (F : Type*) [CommRing F] (allocation : Allocation) + (m : ℕ) (ε : ℝ) (e : Targets (K := K) (tick := tick) allocation m) : + ideal F allocation m ε e = ExactRecovery.delete (rawSource F allocation m) + (idealSide allocation m ε 0 e) (idealSide allocation m ε 1 e) + (idealSide allocation m ε 2 e) := by + funext x y z + simp only [ideal, JointCanonicalization.ideal, coarseIdeal, rawSource, + idealSide, ExactRecovery.delete] + split_ifs <;> simp_all + rename_i hnot + symm + apply ite_eq_right + intro hkeep + exact hnot hkeep.1.2 hkeep.2.1.2 hkeep.2.2.2 + +@[simp] theorem sideVariable_zero {V : Type*} (x y z : V) : + sideVariable 0 x y z = x := rfl + +@[simp] theorem sideVariable_one {V : Type*} (x y z : V) : + sideVariable 1 x y z = y := rfl + +@[simp] theorem sideVariable_two {V : Type*} (x y z : V) : + sideVariable 2 x y z = z := rfl + +theorem branch_eq_holedIdeal {I : Type*} (F : Type*) [CommRing F] + (allocation : Allocation) (m : ℕ) (ε : ℝ) + (a : JointExtraction.Assignment (Raw (K := K) (tick := tick) allocation m) + (Raw (K := K) (tick := tick) allocation m) (Raw (K := K) (tick := tick) allocation m) I) + (i : I) (e : Targets (K := K) (tick := tick) allocation m) + (hx : ∀ w, a.x w = some i → idealSide allocation m ε 0 e w) + (hy : ∀ w, a.y w = some i → idealSide allocation m ε 1 e w) + (hz : ∀ w, a.z w = some i → idealSide allocation m ε 2 e w) : + JointExtraction.branch + (ExactRecovery.delete (rawSource F allocation m) + (completeKeep allocation m ε 0) (completeKeep allocation m ε 1) + (completeKeep allocation m ε 2)) a i = + holedIdeal F allocation m ε e + (fun side w => sideVariable side (a.x w = some i) (a.y w = some i) (a.z w = some i)) := by + funext x y z + simp only [holedIdeal, sideVariable_zero, sideVariable_one, sideVariable_two] + by_cases ha : a.x x = some i ∧ a.y y = some i ∧ a.z z = some i + · have hix := hx x ha.1 + have hiy := hy y ha.2.1 + have hiz := hz z ha.2.2 + rw [JointExtraction.branch, ite_eq_left ha, ideal_eq_delete_source] + simp only [ExactRecovery.delete, hix, hiy, hiz, ha.1, ha.2.1, ha.2.2, + true_and, ite_true] + · have hnot : ¬((a.x x = some i ∧ completeKeep allocation m ε 0 x) ∧ + (a.y y = some i ∧ completeKeep allocation m ε 1 y) ∧ + (a.z z = some i ∧ completeKeep allocation m ε 2 z)) := + fun h => ha ⟨h.1.1, h.2.1.1, h.2.2.1⟩ + rw [JointExtraction.branch, ite_eq_right ha] + simp only [ExactRecovery.delete, ite_eq_right hnot] + +theorem support_filter_eq {F X Y Z : Type*} [Zero F] + [Fintype X] [Fintype Y] [Fintype Z] (Q : Tensor F X Y Z) : + (@Finset.filter (X × Y × Z) (fun p => Q p.1 p.2.1 p.2.2 ≠ 0) + (Classical.decPred _) Finset.univ) = RecoverySupport.support Q := by + ext p + simp only [RecoverySupport.support, Finset.mem_filter] + +theorem repair_selected (F : Type*) [CommRing F] (allocation : Allocation) + {m : ℕ} {ε : ℝ} (hε : 0 < ε) + (hm : minimumDilation (K := K) (tick := tick) allocation ε ≤ m) + (e : Targets (K := K) (tick := tick) allocation m) + (assigned : Fin 3 → Raw (K := K) (tick := tick) allocation m → Prop) + (hcollision : + letI _rawInst : MulAction (Symmetries (K := K) (tick := tick) allocation m) (Raw (K := K) (tick := tick) allocation m) := rawAction allocation m e + ∀ side w, Used F allocation m ε e side w → + (((OrbitCounting.orbitSet (G := Symmetries (K := K) (tick := tick) allocation m) w).filter + (fun v => completeKeep allocation m ε side v ∧ ¬assigned side v)).card : ℝ) / + (OrbitCounting.orbitSet (G := Symmetries (K := K) (tick := tick) allocation m) w).card ≤ 6 / m) : + InverseLinearRecovery.RecoveredBy (ideal F allocation m ε e) + (holedIdeal F allocation m ε e assigned) (shiftCount (K := K) (tick := tick) allocation ε m) := by + let rawInst : MulAction (Symmetries (K := K) (tick := tick) allocation m) (Raw (K := K) (tick := tick) allocation m) := rawAction allocation m e + have hm' := minimumDilation_spec allocation ε hm + have hc : 0 < AllFieldHistoryMasks.lossConstant (K := K) (tick := tick) allocation ε + 6 := by + have := AllFieldHistoryMasks.lossConstant_nonneg (K := K) (tick := tick) allocation ε + linarith + have hloss (side : Fin 3) (w : Raw (K := K) (tick := tick) allocation m) + (hw : Used F allocation m ε e side w) : + (((OrbitCounting.orbitSet (G := Symmetries (K := K) (tick := tick) allocation m) w).filter + (fun v => ¬(assigned side v ∧ completeKeep allocation m ε side v))).card : ℝ) / + (OrbitCounting.orbitSet (G := Symmetries (K := K) (tick := tick) allocation m) w).card ≤ + (AllFieldHistoryMasks.lossConstant (K := K) (tick := tick) allocation ε + 6) / m := by + have heq : ((OrbitCounting.orbitSet (G := Symmetries (K := K) (tick := tick) allocation m) w).filter + (fun v => ¬(assigned side v ∧ completeKeep allocation m ε side v))) = + ((OrbitCounting.orbitSet (G := Symmetries (K := K) (tick := tick) allocation m) w).filter + (fun v => ¬(completeKeep allocation m ε side v ∧ assigned side v))) := by + ext v + simp only [Finset.mem_filter] + exact and_congr Iff.rfl (not_congr and_comm) + rw [heq] + rw [OrbitLoss.missing_fraction_partition + (OrbitCounting.orbitSet (G := Symmetries (K := K) (tick := tick) allocation m) w) + (completeKeep allocation m ε side) (assigned side), add_div] + exact add_le_add (deterministic_loss_le F allocation hm'.1 hε e side w hw) + (hcollision side w hw) + unfold holedIdeal shiftCount + refine InverseLinearRecovery.repair_inverse_linear (G := Symmetries (K := K) (tick := tick) allocation m) + (ideal F allocation m ε e) + (fun w => assigned 0 w ∧ completeKeep allocation m ε 0 w) + (fun w => assigned 1 w ∧ completeKeep allocation m ε 1 w) + (fun w => assigned 2 w ∧ completeKeep allocation m ε 2 w) + (ideal_smul F allocation m ε e) (supportRate_pos (K := K) (tick := tick) allocation).le hc hm'.2 ?_ ?_ ?_ ?_ + · rw [support_filter_eq] + exact raw_support_card_le_exp allocation m (ideal F allocation m ε e) + · intro x hx + obtain ⟨y, z, hq⟩ := hx + exact hloss 0 x ⟨x, y, z, hq, rfl⟩ + · intro y hy + obtain ⟨x, z, hq⟩ := hy + exact hloss 1 y ⟨x, y, z, hq, rfl⟩ + · intro z hz + obtain ⟨x, y, hq⟩ := hz + exact hloss 2 z ⟨x, y, z, hq, rfl⟩ + +theorem repair_selected_branch {I : Type*} (F : Type*) [CommRing F] + (allocation : Allocation) {m : ℕ} {ε : ℝ} (hε : 0 < ε) + (hm : minimumDilation (K := K) (tick := tick) allocation ε ≤ m) + (a : JointExtraction.Assignment (Raw (K := K) (tick := tick) allocation m) + (Raw (K := K) (tick := tick) allocation m) (Raw (K := K) (tick := tick) allocation m) I) + (i : I) (e : Targets (K := K) (tick := tick) allocation m) + (hx : ∀ w, a.x w = some i → idealSide allocation m ε 0 e w) + (hy : ∀ w, a.y w = some i → idealSide allocation m ε 1 e w) + (hz : ∀ w, a.z w = some i → idealSide allocation m ε 2 e w) + (hcollision : + letI _rawInst : MulAction (Symmetries (K := K) (tick := tick) allocation m) (Raw (K := K) (tick := tick) allocation m) := rawAction allocation m e + ∀ side w, Used F allocation m ε e side w → + (((OrbitCounting.orbitSet (G := Symmetries (K := K) (tick := tick) allocation m) w).filter + (fun v => completeKeep allocation m ε side v ∧ + ¬sideVariable side (a.x v = some i) (a.y v = some i) (a.z v = some i))).card : ℝ) / + (OrbitCounting.orbitSet (G := Symmetries (K := K) (tick := tick) allocation m) w).card ≤ 6 / m) : + InverseLinearRecovery.RecoveredBy (ideal F allocation m ε e) + (JointExtraction.branch + (ExactRecovery.delete (rawSource F allocation m) + (completeKeep allocation m ε 0) (completeKeep allocation m ε 1) + (completeKeep allocation m ε 2)) a i) (shiftCount (K := K) (tick := tick) allocation ε m) := by + rw [branch_eq_holedIdeal F allocation m ε a i e hx hy hz] + exact repair_selected F allocation hε hm e _ hcollision + +end MatrixMultiplication.AllFieldHistoryRecovery + +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/Histories/HistoryRecoveryBudget.lean b/lean/OAI/LinearAlgebra/MatrixFields/Histories/HistoryRecoveryBudget.lean new file mode 100644 index 0000000000000000000000000000000000000000..c6fb5926d9a8939168a9dfcd09b53b09670c4fe2 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/Histories/HistoryRecoveryBudget.lean @@ -0,0 +1,1201 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Construction.JointCanonicalMixed +import OAI.LinearAlgebra.MatrixFields.Histories.GroupOrbitCount + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +namespace MatrixMultiplication.PermutationMatching + +open scoped BigOperators +open MatrixMultiplication.InheritedMasks +open Classical + +noncomputable section + +variable {C : Type*} {P X Y : C → Type*} +variable [Fintype C] [DecidableEq C] + [∀ c, Fintype (P c)] [∀ c, DecidableEq (P c)] +variable {S T : C → Type*} + +def wordPairLeftPositions (w : CompleteWordPair P X Y) + (sl : ∀ c, X c → S c) (s : ∀ c, S c) : ∀ c, Finset (P c) := + fun c => statisticPositions (w.left c) (sl c) (s c) + +def wordPairRightPositions (w : CompleteWordPair P X Y) + (sr : ∀ c, Y c → T c) (t : ∀ c, T c) : ∀ c, Finset (P c) := + fun c => statisticPositions (w.right c) (sr c) (t c) + +def wordPairCount (w : CompleteWordPair P X Y) + (sl : ∀ c, X c → S c) (sr : ∀ c, Y c → T c) + (s : ∀ c, S c) (t : ∀ c, T c) : ℝ := + ∑ c, ∑ i : P c, + if sl c (w.left c i) = s c ∧ sr c (w.right c i) = t c then 1 else 0 + +omit [DecidableEq C] in +theorem wordPairCount_smul (w : CompleteWordPair P X Y) + (sl : ∀ c, X c → S c) (sr : ∀ c, Y c → T c) + (s : ∀ c, S c) (t : ∀ c, T c) (g : HalfClassPermutations P) : + wordPairCount (g • w) sl sr s t = + totalTwoHalfCount (wordPairLeftPositions w sl s) + (wordPairRightPositions w sr t) g⁻¹ := by + unfold wordPairCount totalTwoHalfCount wordPairLeftPositions wordPairRightPositions + apply Finset.sum_congr rfl + intro c _ + rw [twoHalfCount_statisticPositions] + rfl + +theorem average_wordPairCount_shift (w : CompleteWordPair P X Y) + (sl : ∀ c, X c → S c) (sr : ∀ c, Y c → T c) + (s : ∀ c, S c) (t : ∀ c, T c) (f : ℝ → ℝ) : + average (fun g : HalfClassPermutations P => f (wordPairCount (g • w) sl sr s t)) = + average (fun g : HalfClassPermutations P => + f (totalTwoHalfCount (wordPairLeftPositions w sl s) + (wordPairRightPositions w sr t) g)) := by + simp_rw [wordPairCount_smul] + exact average_equiv (Equiv.inv (HalfClassPermutations P)) + (fun g => f (totalTwoHalfCount (wordPairLeftPositions w sl s) + (wordPairRightPositions w sr t) g)) + +def wordPairMaskBad (sl : ∀ c, X c → S c) (sr : ∀ c, Y c → T c) + (s : ∀ c, S c) (t : ∀ c, T c) (η ν : ℝ) + (w : CompleteWordPair P X Y) : Prop := + η < |wordPairCount w sl sr s t / populationSize P - ν| + +theorem wordPair_orbit_fraction_eq (w : CompleteWordPair P X Y) + (sl : ∀ c, X c → S c) (sr : ∀ c, Y c → T c) + (s : ∀ c, S c) (t : ∀ c, T c) (η ν : ℝ) : + (((OrbitCounting.orbitSet (G := HalfClassPermutations P) w).filter + (wordPairMaskBad sl sr s t η ν)).card : ℝ) / + (OrbitCounting.orbitSet (G := HalfClassPermutations P) w).card = + average (fun g : HalfClassPermutations P => + if η < |totalTwoHalfCount (wordPairLeftPositions w sl s) + (wordPairRightPositions w sr t) g / populationSize P - ν| + then 1 else 0) := by + rw [← average_bad_shift_eq_orbit_fraction] + exact average_wordPairCount_shift w sl sr s t + (fun k => if η < |k / populationSize P - ν| then 1 else 0) + +theorem wordPair_orbit_rejection_le (w : CompleteWordPair P X Y) + (sl : ∀ c, X c → S c) (sr : ∀ c, Y c → T c) + (s : ∀ c, S c) (t : ∀ c, T c) + (hn : ∀ c, 2 ≤ Fintype.card (P c)) (hm : 0 < populationSize P) + (η ν : ℝ) (hη : 0 < η) + (hmargin : |totalMatchingMean (wordPairLeftPositions w sl s) + (wordPairRightPositions w sr t) / populationSize P - ν| ≤ η / 2) : + (((OrbitCounting.orbitSet (G := HalfClassPermutations P) w).filter + (wordPairMaskBad sl sr s t η ν)).card : ℝ) / + (OrbitCounting.orbitSet (G := HalfClassPermutations P) w).card ≤ + 1 / (2 * populationSize P * η ^ 2) := by + rw [wordPair_orbit_fraction_eq] + exact twoHalf_inheritedMask_rejection_le _ _ hn hm η ν hη hmargin + +theorem wordPair_orbit_rejection_of_windows_le [∀ c, Nonempty (P c)] + (w : CompleteWordPair P X Y) + (sl : ∀ c, X c → S c) (sr : ∀ c, Y c → T c) + (s : ∀ c, S c) (t : ∀ c, T c) + (hn : ∀ c, 2 ≤ Fintype.card (P c)) (hm : 0 < populationSize P) + (left right : C → ℝ) (η τ α ν : ℝ) (hη : 0 < η) + (hright0 : ∀ c, 0 ≤ right c) (hright1 : ∀ c, right c ≤ 1) + (hleft : ∀ c, |classDensity (wordPairLeftPositions w sl s) c - left c| ≤ τ) + (hright : ∀ c, |classDensity (wordPairRightPositions w sr t) c - right c| ≤ τ) + (happrox : |classProductMixture P left right - ν| ≤ α) + (hτ : τ ≤ η / 8) (hα : α ≤ η / 4) : + (((OrbitCounting.orbitSet (G := HalfClassPermutations P) w).filter + (wordPairMaskBad sl sr s t η ν)).card : ℝ) / + (OrbitCounting.orbitSet (G := HalfClassPermutations P) w).card ≤ + 1 / (2 * populationSize P * η ^ 2) := by + exact wordPair_orbit_rejection_le w sl sr s t hn hm η ν hη + (totalMatchingMean_inherited_margin _ _ hm left right η τ α ν + hright0 hright1 hleft hright happrox hτ hα) + +def selectedWordPairCount (D : Finset C) (w : CompleteWordPair P X Y) + (sl : ∀ c, X c → S c) (sr : ∀ c, Y c → T c) + (s : ∀ c, S c) (t : ∀ c, T c) : ℝ := + ∑ c : D, ∑ i : P c, + if sl c (w.left c i) = s c ∧ sr c (w.right c i) = t c then 1 else 0 + +omit [Fintype C] [DecidableEq C] in +theorem selectedWordPairCount_smul (D : Finset C) (w : CompleteWordPair P X Y) + (sl : ∀ c, X c → S c) (sr : ∀ c, Y c → T c) + (s : ∀ c, S c) (t : ∀ c, T c) (g : HalfClassPermutations P) : + selectedWordPairCount D (g • w) sl sr s t = + selectedTwoHalfCount D (wordPairLeftPositions w sl s) + (wordPairRightPositions w sr t) g⁻¹ := by + unfold selectedWordPairCount selectedTwoHalfCount totalTwoHalfCount + wordPairLeftPositions wordPairRightPositions + apply Finset.sum_congr rfl + intro c _ + rw [twoHalfCount_statisticPositions] + rfl + +theorem average_selectedWordPairCount_shift (D : Finset C) + (w : CompleteWordPair P X Y) + (sl : ∀ c, X c → S c) (sr : ∀ c, Y c → T c) + (s : ∀ c, S c) (t : ∀ c, T c) (f : ℝ → ℝ) : + average (fun g : HalfClassPermutations P => + f (selectedWordPairCount D (g • w) sl sr s t)) = + average (fun g : HalfClassPermutations P => + f (selectedTwoHalfCount D (wordPairLeftPositions w sl s) + (wordPairRightPositions w sr t) g)) := by + simp_rw [selectedWordPairCount_smul] + exact average_equiv (Equiv.inv (HalfClassPermutations P)) + (fun g => f (selectedTwoHalfCount D (wordPairLeftPositions w sl s) + (wordPairRightPositions w sr t) g)) + +def selectedWordPairMaskBad (D : Finset C) + (sl : ∀ c, X c → S c) (sr : ∀ c, Y c → T c) + (s : ∀ c, S c) (t : ∀ c, T c) (η ν : ℝ) + (w : CompleteWordPair P X Y) : Prop := + η < |selectedWordPairCount D w sl sr s t / + populationSize (fun c : D => P c) - ν| + +theorem selectedWordPair_orbit_fraction_eq (D : Finset C) + (w : CompleteWordPair P X Y) + (sl : ∀ c, X c → S c) (sr : ∀ c, Y c → T c) + (s : ∀ c, S c) (t : ∀ c, T c) (η ν : ℝ) : + (((OrbitCounting.orbitSet (G := HalfClassPermutations P) w).filter + (selectedWordPairMaskBad D sl sr s t η ν)).card : ℝ) / + (OrbitCounting.orbitSet (G := HalfClassPermutations P) w).card = + average (fun g : HalfClassPermutations P => + if η < |selectedTwoHalfCount D (wordPairLeftPositions w sl s) + (wordPairRightPositions w sr t) g / + populationSize (fun c : D => P c) - ν| then 1 else 0) := by + rw [← average_bad_shift_eq_orbit_fraction] + exact average_selectedWordPairCount_shift D w sl sr s t + (fun k => if η < |k / populationSize (fun c : D => P c) - ν| then 1 else 0) + +theorem selectedWordPair_orbit_rejection_le (D : Finset C) + (w : CompleteWordPair P X Y) + (sl : ∀ c, X c → S c) (sr : ∀ c, Y c → T c) + (s : ∀ c, S c) (t : ∀ c, T c) + (hn : ∀ c ∈ D, 2 ≤ Fintype.card (P c)) + (hm : 0 < populationSize (fun c : D => P c)) (η ν : ℝ) (hη : 0 < η) + (hmargin : |totalMatchingMean + (fun c : D => wordPairLeftPositions w sl s c) + (fun c : D => wordPairRightPositions w sr t c) / + populationSize (fun c : D => P c) - ν| ≤ η / 2) : + (((OrbitCounting.orbitSet (G := HalfClassPermutations P) w).filter + (selectedWordPairMaskBad D sl sr s t η ν)).card : ℝ) / + (OrbitCounting.orbitSet (G := HalfClassPermutations P) w).card ≤ + 1 / (2 * populationSize (fun c : D => P c) * η ^ 2) := by + rw [selectedWordPair_orbit_fraction_eq] + exact selectedTwoHalfMask_rejection_le D _ _ hn hm η ν hη hmargin + +theorem selectedWordPair_orbit_rejection_of_windows_le (D : Finset C) + (w : CompleteWordPair P X Y) + (sl : ∀ c, X c → S c) (sr : ∀ c, Y c → T c) + (s : ∀ c, S c) (t : ∀ c, T c) + (hn : ∀ c ∈ D, 2 ≤ Fintype.card (P c)) + (hm : 0 < populationSize (fun c : D => P c)) + (left right : C → ℝ) (η τ α ν : ℝ) (hη : 0 < η) + (hright0 : ∀ c ∈ D, 0 ≤ right c) (hright1 : ∀ c ∈ D, right c ≤ 1) + (hleft : ∀ c ∈ D, |classDensity (wordPairLeftPositions w sl s) c - left c| ≤ τ) + (hright : ∀ c ∈ D, |classDensity (wordPairRightPositions w sr t) c - right c| ≤ τ) + (happrox : |classProductMixture (fun c : D => P c) + (fun c => left c) (fun c => right c) - ν| ≤ α) + (hτ : τ ≤ η / 8) (hα : α ≤ η / 4) : + (((OrbitCounting.orbitSet (G := HalfClassPermutations P) w).filter + (selectedWordPairMaskBad D sl sr s t η ν)).card : ℝ) / + (OrbitCounting.orbitSet (G := HalfClassPermutations P) w).card ≤ + 1 / (2 * populationSize (fun c : D => P c) * η ^ 2) := by + rw [selectedWordPair_orbit_fraction_eq] + exact selectedTwoHalfMask_rejection_of_windows_le D _ _ hn hm left right + η τ α ν hη hright0 hright1 hleft hright happrox hτ hα + +theorem selectedWordPair_orbit_rejection_of_completeWindows_le + [∀ c, Fintype (X c)] [∀ c, DecidableEq (X c)] + [∀ c, Fintype (Y c)] [∀ c, DecidableEq (Y c)] + [∀ c, Fintype (S c)] [∀ c, DecidableEq (S c)] + [∀ c, Fintype (T c)] [∀ c, DecidableEq (T c)] + (D : Finset C) (w : CompleteWordPair P X Y) + (sl : ∀ c, X c → S c) (sr : ∀ c, Y c → T c) + (s : ∀ c, S c) (t : ∀ c, T c) + (hn : ∀ c ∈ D, 2 ≤ Fintype.card (P c)) + (hm : 0 < populationSize (fun c : D => P c)) + (leftLaw : ∀ c, X c → ℝ) (rightLaw : ∀ c, Y c → ℝ) + (leftε rightε : C → ℝ) (η α ν : ℝ) (hη : 0 < η) + (hright0 : ∀ c ∈ D, ∀ y, 0 ≤ rightLaw c y) + (hrightSum : ∀ c ∈ D, ∑ y, rightLaw c y = 1) + (hleftε : ∀ c ∈ D, 0 ≤ leftε c) (hrightε : ∀ c ∈ D, 0 ≤ rightε c) + (hleft : ∀ c ∈ D, typeWindow (leftLaw c) (leftε c) (w.left c)) + (hright : ∀ c ∈ D, typeWindow (rightLaw c) (rightε c) (w.right c)) + (hleftFactor : ∀ c ∈ D, (Fintype.card (X c) : ℝ) * leftε c ≤ η / 8) + (hrightFactor : ∀ c ∈ D, (Fintype.card (Y c) : ℝ) * rightε c ≤ η / 8) + (happrox : |classProductMixture (fun c : D => P c) + (fun c => pushforwardLaw (sl c) (leftLaw c) (s c)) + (fun c => pushforwardLaw (sr c) (rightLaw c) (t c)) - ν| ≤ α) + (hα : α ≤ η / 4) : + (((OrbitCounting.orbitSet (G := HalfClassPermutations P) w).filter + (selectedWordPairMaskBad D sl sr s t η ν)).card : ℝ) / + (OrbitCounting.orbitSet (G := HalfClassPermutations P) w).card ≤ + 1 / (2 * populationSize (fun c : D => P c) * η ^ 2) := by + rw [selectedWordPair_orbit_fraction_eq] + exact selectedTwoHalf_statistic_rejection_of_completeWindows_le D w.left w.right + sl sr s t hn hm leftLaw rightLaw leftε rightε η α ν hη hright0 hrightSum + hleftε hrightε hleft hright hleftFactor hrightFactor happrox hα + +section FiniteMasks + +variable {I : Type*} [Fintype I] {SL SR : I → C → Type*} + +theorem finite_selectedWordPair_sum_orbit_fraction_le + (D : I → Finset C) (w : CompleteWordPair P X Y) + (sl : ∀ i c, X c → SL i c) (sr : ∀ i c, Y c → SR i c) + (s : ∀ i c, SL i c) (t : ∀ i c, SR i c) (η : ℝ) (ν : I → ℝ) + (hη : 0 ≤ η) : + (((OrbitCounting.orbitSet (G := HalfClassPermutations P) w).filter + (fun v => η < |(∑ i, selectedWordPairCount (D i) v + (sl i) (sr i) (s i) (t i) / populationSize (fun c : D i => P c)) - + ∑ i, ν i|)).card : ℝ) / + (OrbitCounting.orbitSet (G := HalfClassPermutations P) w).card ≤ + (((OrbitCounting.orbitSet (G := HalfClassPermutations P) w).filter + (fun v => ∃ i, selectedWordPairMaskBad (D i) (sl i) (sr i) + (s i) (t i) (η / Fintype.card I) (ν i) v)).card : ℝ) / + (OrbitCounting.orbitSet (G := HalfClassPermutations P) w).card := by + by_cases hI : Fintype.card I = 0 + · have : IsEmpty I := Fintype.card_eq_zero_iff.mp hI + simp [not_lt_of_ge hη] + have : Nonempty I := Fintype.card_pos_iff.mp (Nat.pos_of_ne_zero hI) + have hcard : (0 : ℝ) < Fintype.card I := by + exact_mod_cast (Fintype.card_pos (α := I)) + let z (v : CompleteWordPair P X Y) (i : I) : ℝ := + selectedWordPairCount (D i) v (sl i) (sr i) (s i) (t i) / + populationSize (fun c : D i => P c) + let R := OrbitCounting.orbitSet (G := HalfClassPermutations P) w + let sumBad (v : CompleteWordPair P X Y) : Prop := + η < |(∑ i, z v i) - ∑ i, ν i| + let unionBad (v : CompleteWordPair P X Y) : Prop := + ∃ i, selectedWordPairMaskBad (D i) (sl i) (sr i) + (s i) (t i) (η / Fintype.card I) (ν i) v + have hEvent (v) (hv : sumBad v) : unionBad v := by + change ∃ i, η / Fintype.card I < |z v i - ν i| + change η < |(∑ i, z v i) - ∑ i, ν i| at hv + by_contra h + push Not at h + have he : |(∑ i, z v i) - ∑ i, ν i| ≤ η := by + rw [← Finset.sum_sub_distrib] + calc + _ ≤ ∑ i, |z v i - ν i| := Finset.abs_sum_le_sum_abs _ _ + _ ≤ ∑ _i : I, η / Fintype.card I := Finset.sum_le_sum fun i _ => h i + _ = η := by + simp only [Finset.sum_const, Finset.card_univ, nsmul_eq_mul] + field_simp [ne_of_gt hcard] + linarith + have hsub : R.filter sumBad ⊆ R.filter unionBad := + Finset.monotone_filter_right R (fun value _ => hEvent value) + have hcards : ((R.filter sumBad).card : ℝ) ≤ (R.filter unionBad).card := by + exact_mod_cast Finset.card_le_card hsub + exact div_le_div_of_nonneg_right hcards (Nat.cast_nonneg R.card) + +theorem finite_selectedWordPair_orbit_rejection_of_windows_le + (D : I → Finset C) (w : CompleteWordPair P X Y) + (sl : ∀ i c, X c → SL i c) (sr : ∀ i c, Y c → SR i c) + (s : ∀ i c, SL i c) (t : ∀ i c, SR i c) + (hn : ∀ i c, c ∈ D i → 2 ≤ Fintype.card (P c)) + (hm : ∀ i, 0 < populationSize (fun c : D i => P c)) + (left right : I → C → ℝ) (η τ α ν : I → ℝ) (hη : ∀ i, 0 < η i) + (hright0 : ∀ i c, c ∈ D i → 0 ≤ right i c) + (hright1 : ∀ i c, c ∈ D i → right i c ≤ 1) + (hleft : ∀ i c, c ∈ D i → + |classDensity (wordPairLeftPositions w (sl i) (s i)) c - left i c| ≤ τ i) + (hright : ∀ i c, c ∈ D i → + |classDensity (wordPairRightPositions w (sr i) (t i)) c - right i c| ≤ τ i) + (happrox : ∀ i, |classProductMixture (fun c : D i => P c) + (fun c => left i c) (fun c => right i c) - ν i| ≤ α i) + (hτ : ∀ i, τ i ≤ η i / 8) (hα : ∀ i, α i ≤ η i / 4) : + (((OrbitCounting.orbitSet (G := HalfClassPermutations P) w).filter + (fun v => ∃ i, selectedWordPairMaskBad (D i) (sl i) (sr i) + (s i) (t i) (η i) (ν i) v)).card : ℝ) / + (OrbitCounting.orbitSet (G := HalfClassPermutations P) w).card ≤ + ∑ i, 1 / (2 * populationSize (fun c : D i => P c) * (η i) ^ 2) := by + rw [← average_bad_shift_eq_orbit_fraction] + refine le_trans (average_indicator_exists_le_sum _) ?_ + apply Finset.sum_le_sum + intro i _ + change average (fun g : HalfClassPermutations P => + if η i < |selectedWordPairCount (D i) (g • w) (sl i) (sr i) (s i) (t i) / + populationSize (fun c : D i => P c) - ν i| then 1 else 0) ≤ _ + rw [average_selectedWordPairCount_shift (D i) w (sl i) (sr i) (s i) (t i) + (fun k => if η i < |k / populationSize (fun c : D i => P c) - ν i| + then 1 else 0)] + exact selectedTwoHalfMask_rejection_of_windows_le (D i) _ _ (hn i) (hm i) + (left i) (right i) (η i) (τ i) (α i) (ν i) (hη i) + (hright0 i) (hright1 i) (hleft i) (hright i) (happrox i) (hτ i) (hα i) + +theorem finite_selectedWordPair_orbit_inverse_linear_of_windows + (D : I → Finset C) (w : CompleteWordPair P X Y) + (sl : ∀ i c, X c → SL i c) (sr : ∀ i c, Y c → SR i c) + (s : ∀ i c, SL i c) (t : ∀ i c, SR i c) + (hn : ∀ i c, c ∈ D i → 2 ≤ Fintype.card (P c)) + (mass : I → ℝ) (N : ℝ) (hN : 0 < N) (hmass : ∀ i, 0 < mass i) + (hsize : ∀ i, populationSize (fun c : D i => P c) = mass i * N) + (left right : I → C → ℝ) (η τ α ν : I → ℝ) (hη : ∀ i, 0 < η i) + (hright0 : ∀ i c, c ∈ D i → 0 ≤ right i c) + (hright1 : ∀ i c, c ∈ D i → right i c ≤ 1) + (hleft : ∀ i c, c ∈ D i → + |classDensity (wordPairLeftPositions w (sl i) (s i)) c - left i c| ≤ τ i) + (hright : ∀ i c, c ∈ D i → + |classDensity (wordPairRightPositions w (sr i) (t i)) c - right i c| ≤ τ i) + (happrox : ∀ i, |classProductMixture (fun c : D i => P c) + (fun c => left i c) (fun c => right i c) - ν i| ≤ α i) + (hτ : ∀ i, τ i ≤ η i / 8) (hα : ∀ i, α i ≤ η i / 4) : + (((OrbitCounting.orbitSet (G := HalfClassPermutations P) w).filter + (fun v => ∃ i, selectedWordPairMaskBad (D i) (sl i) (sr i) + (s i) (t i) (η i) (ν i) v)).card : ℝ) / + (OrbitCounting.orbitSet (G := HalfClassPermutations P) w).card ≤ + (∑ i, 1 / (2 * mass i * (η i) ^ 2)) / N := by + have hm (i : I) : 0 < populationSize (fun c : D i => P c) := by + rw [hsize] + exact mul_pos (hmass i) hN + have h := finite_selectedWordPair_orbit_rejection_of_windows_le D w sl sr s t hn hm + left right η τ α ν hη hright0 hright1 hleft hright happrox hτ hα + simpa only [hsize, inverse_linear_mask_constant] using h + +end FiniteMasks + +end + +end MatrixMultiplication.PermutationMatching + + + + + +noncomputable section + +namespace MatrixMultiplication.AllFieldHistoryMasks + +open AllFieldHistory AllFieldHistoryChildLaws AllFieldHistorySupport +open JointCanonicalization InheritedMasks PermutationMatching HistorySymmetry +open scoped BigOperators + +attribute [local instance] Classical.propDecidable Classical.decEq + +variable {K tick : ℕ} + +abbrev Classes (K tick : ℕ) := Active K tick × JointPopulation.Shape + +abbrev Positions (allocation : Allocation) (m : ℕ) (c : Classes K tick) := + Fin (activeCounts allocation m c.1 c.2) + +abbrev Letters (c : Classes K tick) := Fin (activeHalfLength c.1) → Fin 7 + +abbrev Words (allocation : Allocation) (m : ℕ) := + CompleteWordPair (Positions (K := K) (tick := tick) allocation m) Letters Letters + +noncomputable instance permutationsFintype (allocation : Allocation) (m : ℕ) : + Fintype (HalfClassPermutations (Positions (K := K) (tick := tick) allocation m)) := by + letI : DecidableEq (Classes K tick) := Classical.decEq _ + letI : ∀ c : Classes K tick, DecidableEq (Positions allocation m c) := + fun _ => Classical.decEq _ + letI : Fintype (Classes K tick) := inferInstance + letI : ∀ c : Classes K tick, Fintype (Equiv.Perm (Positions allocation m c)) := + fun c => Equiv.instFintype + letI : Fintype ((c : Classes K tick) → Equiv.Perm (Positions allocation m c)) := + Pi.instFintype + change Fintype (((c : Classes K tick) → Equiv.Perm (Positions allocation m c)) × + ((c : Classes K tick) → Equiv.Perm (Positions allocation m c))) + infer_instance + +abbrev SymbolChoice (K tick : ℕ) := ∀ h : Active K tick, Statistic h + +abbrev MaskIndex (K tick : ℕ) := Active K tick × SymbolChoice K tick × SymbolChoice K tick + +def testedClasses (allocation : Allocation) (i : MaskIndex K tick) : Finset (Classes K tick) := + positiveClasses allocation i.1 + +def pairWidth (ε : ℝ) (h : Active K tick) : ℝ := ε / 16 ^ h.val.1.stage.val + +def childWidth (ε : ℝ) (h : Active K tick) : ℝ := pairWidth ε h / 8 + +theorem pairWidth_pos {ε : ℝ} (hε : 0 < ε) (h : Active K tick) : + 0 < pairWidth ε h := by + unfold pairWidth + positivity + +theorem childWidth_pos {ε : ℝ} (hε : 0 < ε) (h : Active K tick) : + 0 < childWidth ε h := div_pos (pairWidth_pos hε h) (by norm_num) + +def classStatistic (c : Classes K tick) : Letters c → Statistic c.1 := statistic c.1 + +def leftSymbol (i : MaskIndex K tick) (c : Classes K tick) : Statistic c.1 := i.2.1 c.1 + +def rightSymbol (i : MaskIndex K tick) (c : Classes K tick) : Statistic c.1 := i.2.2 c.1 + +def leftProbability (side : Fin 3) (i : MaskIndex K tick) (c : Classes K tick) : ℝ := + leftLaw c.1 c.2 side (leftSymbol i c) + +def rightProbability (side : Fin 3) (i : MaskIndex K tick) (c : Classes K tick) : ℝ := + rightLaw c.1 c.2 side (rightSymbol i c) + +def center (allocation : Allocation) (side : Fin 3) (i : MaskIndex K tick) : ℝ := + classProductMixture (fun c : testedClasses allocation i => Positions allocation 1 c.val) + (fun c => leftProbability side i c.val) (fun c => rightProbability side i c.val) + +def passes (allocation : Allocation) (m : ℕ) (ε : ℝ) (side : Fin 3) + (w : Words (K := K) (tick := tick) allocation m) : Prop := + ∀ i : MaskIndex K tick, ¬ selectedWordPairMaskBad (testedClasses allocation i) + classStatistic classStatistic (leftSymbol i) (rightSymbol i) + (pairWidth ε i.1) (center allocation side i) w + +def childWindows (allocation : Allocation) (m : ℕ) (ε : ℝ) (side : Fin 3) + (w : Words (K := K) (tick := tick) allocation m) : Prop := + HistorySymmetry.childWindows classStatistic classStatistic + (activeLaw (activeCounts allocation m) (fun c => leftLaw c.1 c.2 side)) + (activeLaw (activeCounts allocation m) (fun c => rightLaw c.1 c.2 side)) + (activeWidth (activeCounts allocation m) (fun c => childWidth ε c.1)) + (activeWidth (activeCounts allocation m) (fun c => childWidth ε c.1)) w + +def lossConstant (allocation : Allocation) (ε : ℝ) : ℝ := + ∑ i : MaskIndex K tick, + 1 / (2 * selectedBasePopulation allocation (testedClasses allocation i) * + (pairWidth ε i.1) ^ 2) + +theorem lossConstant_nonneg (allocation : Allocation) (ε : ℝ) : + 0 ≤ lossConstant (K := K) (tick := tick) allocation ε := by + apply Finset.sum_nonneg + intro i _ + change 0 ≤ 1 / (2 * (selectedBaseCount allocation (testedClasses allocation i) : ℝ) * + (pairWidth ε i.1) ^ 2) + exact div_nonneg zero_le_one + (mul_nonneg (mul_nonneg (by norm_num) (Nat.cast_nonneg _)) (sq_nonneg _)) + +end MatrixMultiplication.AllFieldHistoryMasks + + + + + + +namespace MatrixMultiplication.AllFieldHistoryMaskLaws + +open AllFieldHistory AllFieldHistoryChildLaws AllFieldHistorySupport +open AllFieldHistoryMasks AllFieldHistoryBranchWeights AllFieldParameters +open PermutationMatching +open scoped BigOperators +attribute [local instance] Classical.propDecidable Classical.decEq + +variable {K tick : ℕ} + +def parentCenter (allocation : Allocation) (side : Fin 3) (h : Active K tick) + (a b : Statistic h) : ℝ := + ∑ u : JointPopulation.Shape, + (activeCounts allocation 1 h u : ℝ) / + population allocation 1 (h.val.1.source, h.val.2) * + (leftLaw h u side a * rightLaw h u side b) + +theorem center_eq_parentCenter (allocation : Allocation) (side : Fin 3) + (i : MaskIndex K tick) : + center allocation side i = parentCenter allocation side i.1 (i.2.1 i.1) (i.2.2 i.1) := by + have hw (c : testedClasses allocation i) : + classWeight (fun c : testedClasses allocation i => Positions allocation 1 c.val) c = + (activeCounts allocation 1 c.val.1 c.val.2 : ℝ) / + population allocation 1 (i.1.val.1.source, i.1.val.2) := by + rw [selected_classWeight_formula allocation (by decide : 0 < (1 : ℕ))] + simp only [selectedBasePopulation, testedClasses, positiveClasses_baseCount] + unfold center classProductMixture + simp_rw [hw] + let f : Classes K tick → ℝ := fun c => + (activeCounts allocation 1 c.1 c.2 : ℝ) / + population allocation 1 (i.1.val.1.source, i.1.val.2) * + (leftProbability side i c * rightProbability side i c) + change (∑ c : testedClasses allocation i, f c.val) = _ + rw [Finset.sum_coe_sort] + have hzero (c : Classes K tick) : + (if 0 < activeCounts allocation 1 c.1 c.2 then f c else 0) = f c := by + split_ifs with hc + · rfl + · have hz : activeCounts allocation 1 c.1 c.2 = 0 := Nat.eq_zero_of_not_pos hc + simp [f, hz] + simp only [testedClasses, positiveClasses, Finset.sum_filter, ite_and, hzero] + rw [Fintype.sum_prod_type, Finset.sum_eq_single i.1] + · simp [f, parentCenter, leftProbability, rightProbability, leftSymbol, rightSymbol] + · intro other _ hne + simp only [hne, ite_false, Finset.sum_const_zero] + · simp + +def stageBActive (h : APositive K) (phi : Placement) + (ht : FiniteSchedule.lotTick (Work.stageB h).lot (Work.stageB h).stage = tick) : + Active K tick := ⟨(.stageB h, phi), ht⟩ + +theorem stageB_leftLaw_branch (h : APositive K) (phi : Placement) + (ht : FiniteSchedule.lotTick (Work.stageB h).lot (Work.stageB h).stage = tick) + (k : BSplit h) (side : Fin 3) (a : Fin 6) : + leftLaw (stageBActive h phi ht) (branchShape (.stageB h, phi) k) side a = + (littleLaw (aShape h.val) (bSplit ⟨h, k, false⟩) (phi.symm side) a : ℝ) := by + change (littleLaw (aShape h.val) + (canonicalChildShape (.stageB h, phi) (branchShape (.stageB h, phi) k)) + (phi.symm side) a : ℝ) = _ + rw [canonicalChildShape_branchShape (.stageB h, phi) k] + rfl + +theorem stageB_rightLaw_branch (h : APositive K) (phi : Placement) + (ht : FiniteSchedule.lotTick (Work.stageB h).lot (Work.stageB h).stage = tick) + (k : BSplit h) (side : Fin 3) (b : Fin 6) : + rightLaw (stageBActive h phi ht) (branchShape (.stageB h, phi) k) side b = + (littleLaw (aShape h.val) (complement (aShape h.val) (bSplit ⟨h, k, false⟩)) + (phi.symm side) b : ℝ) := by + change (littleLaw (aShape h.val) + (complement (aShape h.val) + (canonicalChildShape (.stageB h, phi) (branchShape (.stageB h, phi) k))) + (phi.symm side) b : ℝ) = _ + rw [canonicalChildShape_branchShape (.stageB h, phi) k] + rfl + +theorem stageB_sum_laws (h : APositive K) (side : Fin 3) (a b : Fin 6) : + (∑ k : BSplit h, + stageBLaw (aShape h.val) (bSplit ⟨h, k, false⟩) * + littleLaw (aShape h.val) (bSplit ⟨h, k, false⟩) side a * + littleLaw (aShape h.val) (complement (aShape h.val) (bSplit ⟨h, k, false⟩)) side b) = + halfLaw (aShape h.val) side (a, b) := by + rw [halfLaw_positive_parent _ h.property] + unfold positiveHalfLaw + change (∑ k : Fin (below (aShape h.val)).length, + stageBLaw (aShape h.val) (below (aShape h.val))[k.val] * + littleLaw (aShape h.val) (below (aShape h.val))[k.val] side a * + littleLaw (aShape h.val) (complement (aShape h.val) (below (aShape h.val))[k.val]) side b) = _ + exact Fin.sum_univ_fun_getElem (below (aShape h.val)) + (fun u => stageBLaw (aShape h.val) u * littleLaw (aShape h.val) u side a * + littleLaw (aShape h.val) (complement (aShape h.val) u) side b) + +theorem parentCenter_stageB (allocation : Allocation) (h : APositive K) (phi : Placement) + (ht : FiniteSchedule.lotTick (Work.stageB h).lot (Work.stageB h).stage = tick) + (side : Fin 3) (a b : Fin 6) : + parentCenter allocation side (stageBActive h phi ht) a b = + (halfLaw (aShape h.val) (phi.symm side) (a, b) : ℝ) := by + let w : PlacedWork K := (.stageB h, phi) + let f : JointPopulation.Shape → ℝ := fun u => + leftLaw (stageBActive h phi ht) u side a * rightLaw (stageBActive h phi ht) u side b + calc + parentCenter allocation side (stageBActive h phi ht) a b = + (∑ u, (jointCounts allocation 1 w u : ℝ) * f u) / + population allocation 1 (.afterA h.val, phi) := by + unfold parentCenter + rw [Finset.sum_div] + apply Finset.sum_congr rfl + intro u _ + dsimp only [activeCounts, stageBActive, w, f, Work.source] + ring + _ = (∑ k : BSplit h, (branchPopulation allocation 1 w k : ℝ) * f (branchShape w k)) / + population allocation 1 (.afterA h.val, phi) := by + rw [jointCounts, shapeCounts_weighted_sum] + rfl + _ = ∑ k : BSplit h, + (stageBLaw (aShape h.val) (bSplit ⟨h, k, false⟩) : ℝ) * + (littleLaw (aShape h.val) (bSplit ⟨h, k, false⟩) (phi.symm side) a : ℝ) * + (littleLaw (aShape h.val) (complement (aShape h.val) (bSplit ⟨h, k, false⟩)) + (phi.symm side) b : ℝ) := by + rw [Finset.sum_div] + apply Finset.sum_congr rfl + intro k _ + dsimp only [f, w] + rw [stageB_leftLaw_branch, stageB_rightLaw_branch] + rw [mul_div_right_comm, + stageB_branchWeight_real allocation (by decide : 0 < (1 : ℕ)) h k phi] + ring + _ = (halfLaw (aShape h.val) (phi.symm side) (a, b) : ℝ) := by + exact_mod_cast stageB_sum_laws h (phi.symm side) a b + +theorem center_stageB (allocation : Allocation) (h : APositive K) (phi : Placement) + (ht : FiniteSchedule.lotTick (Work.stageB h).lot (Work.stageB h).stage = tick) + (side : Fin 3) (a b : SymbolChoice K tick) : + center allocation side (stageBActive h phi ht, a, b) = + (halfLaw (aShape h.val) (phi.symm side) + (a (stageBActive h phi ht), b (stageBActive h phi ht)) : ℝ) := by + rw [center_eq_parentCenter] + exact parentCenter_stageB allocation h phi ht side _ _ + +end MatrixMultiplication.AllFieldHistoryMaskLaws + + + + + + +namespace MatrixMultiplication.AllFieldHistoryRawMasks + +open AllFieldHistory AllFieldHistoryChildLaws AllFieldHistorySupport AllFieldHistoryMasks +open JointCanonicalization PermutationMatching +open scoped BigOperators +attribute [local instance] Classical.propDecidable Classical.decEq + +variable {K tick : ℕ} + +def rawPairCount (allocation : Allocation) (m : ℕ) (i : MaskIndex K tick) + (w : ActiveRawPairs (K := K) (tick := tick) allocation m) : ℝ := + ∑ j : JointPopulation.Positions (activeCounts allocation m) i.1, + if statistic i.1 (w i.1 j).1 = i.2.1 i.1 ∧ + statistic i.1 (w i.1 j).2 = i.2.2 i.1 then 1 else 0 + +def rawPass (allocation : Allocation) (m : ℕ) (ε : ℝ) (side : Fin 3) + (w : ActiveRawPairs (K := K) (tick := tick) allocation m) : Prop := + ∀ i : MaskIndex K tick, + |rawPairCount allocation m i w / + (population allocation m (i.1.val.1.source, i.1.val.2) : ℝ) - + center allocation side i| ≤ pairWidth ε i.1 + +theorem sum_positiveClasses (allocation : Allocation) (m : ℕ) (h : Active K tick) + (f : ∀ c : Classes K tick, Positions allocation m c → ℝ) : + (∑ c : positiveClasses allocation h, ∑ j, f c.val j) = + ∑ u : JointPopulation.Shape, ∑ j, f (h, u) j := by + have hzero (c : Classes K tick) (hc : ¬0 < activeCounts allocation 1 c.1 c.2) : + (∑ j, f c j) = 0 := by + have hcount : activeCounts allocation m c.1 c.2 = 0 := by + rw [activeCounts_dilation, Nat.eq_zero_of_not_pos hc, mul_zero] + apply Finset.sum_eq_zero + intro j _ + have hj : j.val < 0 := by simpa only [hcount] using j.isLt + exact (Nat.not_lt_zero _ hj).elim + rw [Finset.sum_coe_sort (positiveClasses allocation h) + (fun c : Classes K tick => ∑ j, f c j)] + unfold positiveClasses + rw [Finset.sum_filter] + calc + (∑ c : Classes K tick, + if c.1 = h ∧ 0 < activeCounts allocation 1 c.1 c.2 then ∑ j, f c j else 0) = + ∑ c : Classes K tick, if c.1 = h then ∑ j, f c j else 0 := by + apply Finset.sum_congr rfl + intro c _ + by_cases hc : 0 < activeCounts allocation 1 c.1 c.2 + · simp only [hc, and_true] + · rw [hzero c hc] + simp + _ = ∑ u : JointPopulation.Shape, ∑ j, f (h, u) j := by + rw [Fintype.sum_prod_type, Finset.sum_eq_single h] + · simp + · intro other _ hne + simp only [hne, ite_false, Finset.sum_const_zero] + · simp + +theorem selectedWordPairCount_pairEquiv (allocation : Allocation) (m : ℕ) + (e : JointPopulation.Target (activeCounts (K := K) (tick := tick) allocation m)) + (i : MaskIndex K tick) (w : ActiveRawPairs (K := K) (tick := tick) allocation m) : + selectedWordPairCount (testedClasses allocation i) + (pairEquiv (activeCounts allocation m) + (JointCanonicalCW.Left activeHalfLength) (JointCanonicalCW.Right activeHalfLength) e w) + classStatistic classStatistic (leftSymbol i) (rightSymbol i) = + rawPairCount allocation m i w := by + let v : Words (K := K) (tick := tick) allocation m := + pairEquiv (activeCounts allocation m) + (JointCanonicalCW.Left activeHalfLength) (JointCanonicalCW.Right activeHalfLength) e w + have hsum := sum_positiveClasses allocation m i.1 (fun c j => + if classStatistic c (v.left c j) = leftSymbol i c ∧ + classStatistic c (v.right c j) = rightSymbol i c then (1 : ℝ) else 0) + unfold selectedWordPairCount + rw [testedClasses, hsum] + unfold rawPairCount + rw [← Fintype.sum_sigma'] + apply Fintype.sum_equiv (positionEquiv (activeCounts allocation m) e i.1).symm + rintro ⟨u, j⟩ + rfl + +theorem testedClasses_populationSize (allocation : Allocation) (m : ℕ) + (i : MaskIndex K tick) : + populationSize (fun c : testedClasses allocation i => Positions allocation m c.val) = + (population allocation m (i.1.val.1.source, i.1.val.2) : ℝ) := by + change populationSize (selectedPositions allocation m (positiveClasses allocation i.1)) = _ + rw [positiveClasses_populationSize, population_dilation allocation m, Nat.cast_mul] + exact mul_comm _ _ + +theorem raw_population_pos (allocation : Allocation) {m : ℕ} (hm : 0 < m) + (h : Active K tick) : + 0 < (population allocation m (h.val.1.source, h.val.2) : ℝ) := by + exact_mod_cast AllFieldHistorySupport.work_source_population_pos allocation hm h.val + +theorem passes_pairEquiv_iff_rawPass (allocation : Allocation) (m : ℕ) (ε : ℝ) + (side : Fin 3) + (e : JointPopulation.Target (activeCounts (K := K) (tick := tick) allocation m)) + (w : ActiveRawPairs (K := K) (tick := tick) allocation m) : + passes allocation m ε side + (pairEquiv (activeCounts allocation m) + (JointCanonicalCW.Left activeHalfLength) (JointCanonicalCW.Right activeHalfLength) e w) ↔ + rawPass allocation m ε side w := by + simp only [passes, selectedWordPairMaskBad, selectedWordPairCount_pairEquiv, + testedClasses_populationSize, rawPass, not_lt] + +theorem passes_pairEquiv_target_independent (allocation : Allocation) (m : ℕ) (ε : ℝ) + (side : Fin 3) + (e f : JointPopulation.Target (activeCounts (K := K) (tick := tick) allocation m)) + (w : ActiveRawPairs (K := K) (tick := tick) allocation m) : + passes allocation m ε side + (pairEquiv (activeCounts allocation m) + (JointCanonicalCW.Left activeHalfLength) (JointCanonicalCW.Right activeHalfLength) e w) ↔ + passes allocation m ε side + (pairEquiv (activeCounts allocation m) + (JointCanonicalCW.Left activeHalfLength) (JointCanonicalCW.Right activeHalfLength) f w) := + (passes_pairEquiv_iff_rawPass allocation m ε side e w).trans + (passes_pairEquiv_iff_rawPass allocation m ε side f w).symm + +end MatrixMultiplication.AllFieldHistoryRawMasks + + + + + + +namespace MatrixMultiplication.AllFieldHistoryIncomingMasks + +open MatrixMultiplication.Foundation AllFieldHistory AllFieldParameters +open AllFieldHistoryChildLaws AllFieldHistorySupport AllFieldHistoryMasks +open AllFieldHistoryMaskLaws AllFieldHistoryRawMasks InheritedMasks +open scoped BigOperators +attribute [local instance] Classical.propDecidable Classical.decEq + +variable {K tick : ℕ} + +theorem empiricalLaw_congr_decidable {P A : Type*} [Fintype P] + (d₁ d₂ : DecidableEq A) (w : P → A) (a : A) : + @empiricalLaw P A _ d₁ w a = @empiricalLaw P A _ d₂ w a := by + cases Subsingleton.elim d₁ d₂ + rfl + +theorem typeWindow_mono_decidable {P A : Type*} [Fintype P] + (d₁ d₂ : DecidableEq A) (ν : A → ℝ) {η δ : ℝ} (hη : η ≤ δ) + (w : P → A) (hw : @typeWindow P A _ d₁ ν η w) : + @typeWindow P A _ d₂ ν δ w := by + cases Subsingleton.elim d₁ d₂ + intro a + exact (hw a).trans hη + +theorem weight_append {m n : ℕ} (l : Fin m → Fin 7) (r : Fin n → Fin 7) : + CWStrands.weight (Fin.append l r) = CWStrands.weight l + CWStrands.weight r := by + simp [CWStrands.weight, Fin.sum_univ_add] + +theorem strand_append {F : Type*} [CommRing F] {m n : ℕ} + (x y z : (Fin m → Fin 7) × (Fin n → Fin 7)) : + CWStrands.strand (F := F) (Fin (m + n)) + (Fin.append x.1 x.2) (Fin.append y.1 y.2) (Fin.append z.1 z.2) = + CWStrands.strand (Fin m) x.1 y.1 z.1 * CWStrands.strand (Fin n) x.2 y.2 z.2 := by + simp [CWStrands.strand, Fin.prod_univ_add] + +theorem shapeTensor_append {F : Type*} [CommRing F] {m n : ℕ} (g : Shape) + (x y z : (Fin m → Fin 7) × (Fin n → Fin 7)) : + CWStrands.shapeTensor (F := F) (Fin (m + n)) g + (Fin.append x.1 x.2) (Fin.append y.1 y.2) (Fin.append z.1 z.2) = + CWStrands.shapeTensor (Fin m ⊕ Fin n) g + (Sum.elim x.1 x.2) (Sum.elim y.1 y.2) (Sum.elim z.1 z.2) := by + simp only [CWStrands.shapeTensor, weight_append, CWStrands.weight_sum_elim, + strand_append, CWStrands.strand_sum_elim, Tensor.product] + +theorem shapeTensor_joinHalves {F : Type*} [CommRing F] (w : Work K) (g : Shape) + (x y z : (Fin w.halfLength → Fin 7) × (Fin w.halfLength → Fin 7)) : + CWStrands.shapeTensor (F := F) (Fin (currentLength w.source)) g + (joinHalves w x) (joinHalves w y) (joinHalves w z) = + CWStrands.shapeTensor (Fin w.halfLength ⊕ Fin w.halfLength) g + (Sum.elim x.1 x.2) (Sum.elim y.1 y.2) (Sum.elim z.1 z.2) := by + cases w <;> exact shapeTensor_append g x y z + +def defaultStatistic : (w : Work K) → w.Statistic + | .stageA _ => (0, 0) + | .stageB _ => (0 : Fin 6) + | .stageC _ => PUnit.unit + +def choiceAt (h : Active K tick) (a : Statistic h) : SymbolChoice K tick := + Function.update (fun g => defaultStatistic g.val.1) h a + +@[simp] theorem choiceAt_self (h : Active K tick) (a : Statistic h) : + choiceAt h a h = a := by simp [choiceAt] + +theorem rawPairCount_eq_wordPopulation (allocation : Allocation) (m : ℕ) + (i : MaskIndex K tick) (w : ActiveRawPairs (K := K) (tick := tick) allocation m) : + rawPairCount allocation m i w = + (wordPopulation (fun j => (statistic i.1 (w i.1 j).1, + statistic i.1 (w i.1 j).2)) (i.2.1 i.1, i.2.2 i.1) : ℝ) := by + simp only [rawPairCount, wordPopulation, Fintype.card_subtype, Prod.mk.injEq] + exact Finset.sum_boole _ _ + +@[simp] theorem fourStatistic_append (l r : Fin 2 → Fin 7) : + CWCompleteStatistics.fourStatistic (Fin.append l r) = + (CWCompleteStatistics.twoStatistic l, CWCompleteStatistics.twoStatistic r) := rfl + +@[simp] theorem append_singletons (l r : Fin 1 → Fin 7) : + Fin.append l r = (Matrix.vecCons (l 0) (Matrix.vecCons (r 0) Matrix.vecEmpty)) := by + funext i + fin_cases i <;> rfl + +attribute [local irreducible] activeCounts population + +theorem rawPass_stageB_typeWindow (allocation : Allocation) (m : ℕ) (ε : ℝ) + (side : Fin 3) (w : ActiveRawPairs (K := K) (tick := tick) allocation m) + (hw : rawPass allocation m ε side w) (h : APositive K) (phi : Placement) + (ht : FiniteSchedule.lotTick (Work.stageB h).lot (Work.stageB h).stage = tick) : + typeWindow (fun ij : PairSlot => (halfLaw (aShape h.val) (phi.symm side) ij : ℝ)) + (pairWidth ε (stageBActive h phi ht)) + (fun j => CWCompleteStatistics.fourStatistic + (joinHalves (.stageB h) (w (stageBActive h phi ht) j))) := by + intro ij + have hp := hw (stageBActive h phi ht, + choiceAt (stageBActive h phi ht) ij.1, choiceAt (stageBActive h phi ht) ij.2) + rw [center_stageB] at hp + rw [rawPairCount_eq_wordPopulation] at hp + erw [choiceAt_self, choiceAt_self] at hp + have hcard : Fintype.card (JointPopulation.Positions (activeCounts allocation m) + (stageBActive h phi ht)) = population allocation m (.afterA h.val, phi) := by + simp only [Fintype.card_eq_nat_card] + simp only [JointPopulation.Positions, Nat.card_fin] + simpa only [activeCounts, stageBActive, Work.source] using + jointCounts_sum allocation m (.stageB h, phi) + have hword : (fun j => CWCompleteStatistics.fourStatistic + (joinHalves (.stageB h) (w (stageBActive h phi ht) j))) = + (fun j => (statistic (stageBActive h phi ht) (w (stageBActive h phi ht) j).1, + statistic (stageBActive h phi ht) (w (stageBActive h phi ht) j).2)) := by + funext j + rfl + have he : empiricalLaw (fun j => CWCompleteStatistics.fourStatistic + (joinHalves (.stageB h) (w (stageBActive h phi ht) j))) ij = + empiricalLaw (fun j => + (statistic (stageBActive h phi ht) (w (stageBActive h phi ht) j).1, + statistic (stageBActive h phi ht) (w (stageBActive h phi ht) j).2)) ij := by + rw [hword] + exact empiricalLaw_congr_decidable _ _ _ _ + rw [he] + unfold empiricalLaw + rw [hcard] + dsimp only [stageBActive, Work.source] at hp + erw [choiceAt_self, choiceAt_self] at hp + exact hp + +theorem incoming_stageA (allocation : Allocation) (m : ℕ) (ε : ℝ) + (side : Fin 3) (w : ActiveRawPairs (K := K) (tick := tick) allocation m) + (h : InitialPositive K) (phi : Placement) + (ht : FiniteSchedule.lotTick (Work.stageA h).lot (Work.stageA h).stage = tick) : + residentMask allocation m ε ((Work.stageA h).source, phi) side + (incomingWord allocation m ⟨(.stageA h, phi), ht⟩ w) := by + trivial + +theorem incoming_stageB (allocation : Allocation) (m : ℕ) {ε : ℝ} (hε : 0 ≤ ε) + (side : Fin 3) (w : ActiveRawPairs (K := K) (tick := tick) allocation m) + (hw : rawPass allocation m ε side w) (h : APositive K) (phi : Placement) + (ht : FiniteSchedule.lotTick (Work.stageB h).lot (Work.stageB h).stage = tick) : + residentMask allocation m ε ((Work.stageB h).source, phi) side + (incomingWord allocation m (stageBActive h phi ht) w) := by + intro _ + have hraw := rawPass_stageB_typeWindow allocation m ε side w hw h phi ht + have htransport := (JointCanonicalization.typeWindow_reindex + (fun ij : PairSlot => (halfLaw (aShape h.val) (phi.symm side) ij : ℝ)) + (pairWidth ε (stageBActive h phi ht)) + (fun j => CWCompleteStatistics.fourStatistic + (joinHalves (.stageB h) (w (stageBActive h phi ht) j))) + (sourcePositionsEquiv allocation m (stageBActive h phi ht)).symm).2 hraw + have hwidth : pairWidth ε (stageBActive h phi ht) ≤ ε / 8 := by + change ε / 16 ^ 1 ≤ ε / 8 + norm_num + linarith + dsimp only [Work.source, residentLaw, residentLawRat, residentWidth, residentStatistic] + exact typeWindow_mono_decidable _ _ _ hwidth _ htransport + +theorem incoming_stageC (allocation : Allocation) {m : ℕ} (hm : 0 < m) + {ε : ℝ} (hε : 0 ≤ ε) (side : Fin 3) + (e : JointPopulation.Target (activeCounts (K := K) (tick := tick) allocation m)) + (w : ActiveRawPairs (K := K) (tick := tick) allocation m) + (h : PartC K) (phi : Placement) + (ht : FiniteSchedule.lotTick (Work.stageC h).lot (Work.stageC h).stage = tick) + (hweights : ∀ j, + CWLeafStatistics.weight ((w (AllFieldHistoryStageCIncoming.stageCActive h phi ht) j).1 (0 : Fin 1)) = + (JointPopulation.shapeSide side ((e (AllFieldHistoryStageCIncoming.stageCActive h phi ht)).val j)).val ∧ + CWLeafStatistics.weight ((w (AllFieldHistoryStageCIncoming.stageCActive h phi ht) j).2 (0 : Fin 1)) = + activeParentShape (AllFieldHistoryStageCIncoming.stageCActive h phi ht) side - + (JointPopulation.shapeSide side ((e (AllFieldHistoryStageCIncoming.stageCActive h phi ht)).val j)).val) : + residentMask allocation m ε ((Work.stageC h).source, phi) side + (incomingWord allocation m (AllFieldHistoryStageCIncoming.stageCActive h phi ht) w) := by + intro _ + have hraw := AllFieldHistoryStageCIncoming.typeWindow_of_target_side_weights + allocation hm h phi ht e w side hweights (ε / 256) (div_nonneg hε (by norm_num)) + have htransport := (JointCanonicalization.typeWindow_reindex + (fun a : Fin 6 => (littleLaw (cParameterParent h) (cShapeParent h) (phi.symm side) a : ℝ)) + (ε / 256) + (fun j => CWCompleteStatistics.twoStatistic + (Matrix.vecCons ((w (AllFieldHistoryStageCIncoming.stageCActive h phi ht) j).1 (0 : Fin 1)) (Matrix.vecCons ((w (AllFieldHistoryStageCIncoming.stageCActive h phi ht) j).2 (0 : Fin 1)) Matrix.vecEmpty))) + (sourcePositionsEquiv allocation m (AllFieldHistoryStageCIncoming.stageCActive h phi ht)).symm).2 hraw + have hword : incomingWord allocation m + (AllFieldHistoryStageCIncoming.stageCActive h phi ht) w = + fun position => Matrix.vecCons + ((w (AllFieldHistoryStageCIncoming.stageCActive h phi ht) + ((sourcePositionsEquiv allocation m + (AllFieldHistoryStageCIncoming.stageCActive h phi ht)).symm position)).1 (0 : Fin 1)) + (Matrix.vecCons + ((w (AllFieldHistoryStageCIncoming.stageCActive h phi ht) + ((sourcePositionsEquiv allocation m + (AllFieldHistoryStageCIncoming.stageCActive h phi ht)).symm position)).2 (0 : Fin 1)) + Matrix.vecEmpty) := by + funext position + exact append_singletons _ _ + rw [hword] + dsimp only [Work.source, residentLaw, residentLawRat, residentWidth, residentStatistic] + exact typeWindow_mono_decidable _ _ _ le_rfl _ htransport + +def stageCWeights (allocation : Allocation) (m : ℕ) (side : Fin 3) + (e : JointPopulation.Target (activeCounts (K := K) (tick := tick) allocation m)) + (w : ActiveRawPairs (K := K) (tick := tick) allocation m) : Prop := + ∀ (h : PartC K) (phi : Placement) + (ht : FiniteSchedule.lotTick (Work.stageC h).lot (Work.stageC h).stage = tick) j, + CWLeafStatistics.weight ((w (AllFieldHistoryStageCIncoming.stageCActive h phi ht) j).1 (0 : Fin 1)) = + (JointPopulation.shapeSide side ((e (AllFieldHistoryStageCIncoming.stageCActive h phi ht)).val j)).val ∧ + CWLeafStatistics.weight ((w (AllFieldHistoryStageCIncoming.stageCActive h phi ht) j).2 (0 : Fin 1)) = + activeParentShape (AllFieldHistoryStageCIncoming.stageCActive h phi ht) side - + (JointPopulation.shapeSide side ((e (AllFieldHistoryStageCIncoming.stageCActive h phi ht)).val j)).val + +theorem received_of_rawPass (allocation : Allocation) {m : ℕ} (hm : 0 < m) + {ε : ℝ} (hε : 0 ≤ ε) (side : Fin 3) + (e : JointPopulation.Target (activeCounts (K := K) (tick := tick) allocation m)) + (w : ActiveRawPairs (K := K) (tick := tick) allocation m) + (hw : rawPass allocation m ε side w) (hc : stageCWeights allocation m side e w) : + received allocation m ε side w := by + rintro ⟨⟨work, phi⟩, ht⟩ + cases work with + | stageA h => exact incoming_stageA allocation m ε side w h phi ht + | stageB h => exact incoming_stageB allocation m hε side w hw h phi ht + | stageC h => exact incoming_stageC allocation hm hε side e w h phi ht (hc h phi ht) + +end MatrixMultiplication.AllFieldHistoryIncomingMasks + +end +end + + + + +section +open MatrixMultiplication.Foundation + +namespace MatrixMultiplication.EquivOrbitTransport + +variable {G X Y : Type*} [Group G] [MulAction G Y] + +@[instance_reducible] def action (e : X ≃ Y) : MulAction G X where + smul g x := e.symm (g • e x) + one_smul x := by + change e.symm ((1 : G) • e x) = x + simp + mul_smul g h x := by + change e.symm ((g * h) • e x) = e.symm (g • e (e.symm (h • e x))) + simp [mul_smul] + +@[simp] theorem equiv_smul (e : X ≃ Y) (g : G) (x : X) : + letI : MulAction G X := action e + e (g • x) = g • e x := by + exact e.apply_symm_apply _ + +section Finite + +variable [Fintype G] [DecidableEq X] [DecidableEq Y] + +theorem orbitSet_map (e : X ≃ Y) (x : X) : + letI : MulAction G X := action e + (OrbitCounting.orbitSet (G := G) x).map e.toEmbedding = + OrbitCounting.orbitSet (G := G) (e x) := by + let : MulAction G X := action e + change (Finset.univ.image fun g : G => e.symm (g • e x)).map e.toEmbedding = _ + simp only [Finset.map_eq_image, Finset.image_image, Function.comp_def, + Equiv.toEmbedding_apply, Equiv.apply_symm_apply, OrbitCounting.orbitSet] + +theorem orbitSet_card (e : X ≃ Y) (x : X) : + letI : MulAction G X := action e + (OrbitCounting.orbitSet (G := G) x).card = + (OrbitCounting.orbitSet (G := G) (e x)).card := by + let : MulAction G X := action e + simpa only [Finset.card_map] using congrArg Finset.card (orbitSet_map e x) + +theorem rejected_card (e : X ≃ Y) (bad : X → Prop) [DecidablePred bad] (x : X) : + letI : MulAction G X := action e + ((OrbitCounting.orbitSet (G := G) x).filter bad).card = + ((OrbitCounting.orbitSet (G := G) (e x)).filter (bad ∘ e.symm)).card := by + let : MulAction G X := action e + calc + ((OrbitCounting.orbitSet (G := G) x).filter bad).card = + (((OrbitCounting.orbitSet (G := G) x).filter bad).map e.toEmbedding).card := + (Finset.card_map _).symm + _ = _ := by rw [Finset.map_filter, orbitSet_map] + +theorem rejected_fraction (e : X ≃ Y) (bad : X → Prop) [DecidablePred bad] (x : X) : + letI : MulAction G X := action e + (((OrbitCounting.orbitSet (G := G) x).filter bad).card : ℝ) / + (OrbitCounting.orbitSet (G := G) x).card = + (((OrbitCounting.orbitSet (G := G) (e x)).filter (bad ∘ e.symm)).card : ℝ) / + (OrbitCounting.orbitSet (G := G) (e x)).card := by + let : MulAction G X := action e + rw [rejected_card e bad x, orbitSet_card e x] + +end Finite + +theorem coefficients_preserved + {K RX RY RZ CX CY CZ : Type*} [CommSemiring K] + [MulAction G CX] [MulAction G CY] [MulAction G CZ] + (ex : RX ≃ CX) (ey : RY ≃ CY) (ez : RZ ≃ CZ) + (raw : Tensor K RX RY RZ) (canonical : Tensor K CX CY CZ) + (hcoords : ∀ x y z, raw x y z = canonical (ex x) (ey y) (ez z)) + (hcanonical : ∀ (g : G) x y z, + canonical (g • x) (g • y) (g • z) = canonical x y z) : + letI : MulAction G RX := action ex + letI : MulAction G RY := action ey + letI : MulAction G RZ := action ez + ∀ (g : G) x y z, raw (g • x) (g • y) (g • z) = raw x y z := by + let : MulAction G RX := action ex + let : MulAction G RY := action ey + let : MulAction G RZ := action ez + intro g x y z + rw [hcoords, hcoords] + change canonical (ex (ex.symm (g • ex x))) (ey (ey.symm (g • ey y))) + (ez (ez.symm (g • ez z))) = _ + simpa only [Equiv.apply_symm_apply] using hcanonical g (ex x) (ey y) (ez z) + +end MatrixMultiplication.EquivOrbitTransport + +end + + + + +section +noncomputable section + +namespace MatrixMultiplication.AllFieldHistoryRecovery + +open MatrixMultiplication.Foundation AllFieldHistory AllFieldHistoryChildLaws +open AllFieldHistorySupport JointPopulation JointCanonicalization JointCanonicalCW +open PermutationMatching +open scoped BigOperators + +attribute [local instance] Classical.propDecidable Classical.decEq + +variable {K tick : ℕ} + +theorem halfLength_le_eight (h : Active K tick) : activeHalfLength h ≤ 8 := by + rcases h with ⟨⟨w, phi⟩, hh⟩ + cases w <;> norm_num [activeHalfLength, Work.halfLength] + +abbrev Raw (allocation : Allocation) (m : ℕ) := + ActiveRawPairs (K := K) (tick := tick) allocation m + +abbrev Targets (allocation : Allocation) (m : ℕ) := + Target (activeCounts (K := K) (tick := tick) allocation m) + +abbrev Symmetries (allocation : Allocation) (m : ℕ) := + HalfClassPermutations (ClassPositions + (activeCounts (K := K) (tick := tick) allocation m)) + +def childStatistic (_side : Fin 3) (c : Active K tick × JointPopulation.Shape) := + statistic c.1 + +def leftPrescription (side : Fin 3) (c : Active K tick × JointPopulation.Shape) := + leftLaw c.1 c.2 side + +def rightPrescription (side : Fin 3) (c : Active K tick × JointPopulation.Shape) := + rightLaw c.1 c.2 side + +def outputWidth (ε : ℝ) (_side : Fin 3) (c : Active K tick × JointPopulation.Shape) := + AllFieldHistoryMasks.childWidth ε c.1 + +def parents (F : Type*) [CommRing F] (h : Active K tick) := + JointCanonicalMixed.inputTensor (F := F) activeHalfLength activeHalfLength + activeParentShape (fun _ => true) h + +def rawSource (F : Type*) [CommRing F] (allocation : Allocation) (m : ℕ) : + Tensor F (Raw (K := K) (tick := tick) allocation m) + (Raw (K := K) (tick := tick) allocation m) (Raw (K := K) (tick := tick) allocation m) := + sourceTensor (activeCounts allocation m) (Left activeHalfLength) + (Right activeHalfLength) (parents F) + +def ideal (F : Type*) [CommRing F] (allocation : Allocation) (m : ℕ) (ε : ℝ) + (e : Targets (K := K) (tick := tick) allocation m) : + Tensor F (Raw (K := K) (tick := tick) allocation m) (Raw (K := K) (tick := tick) allocation m) (Raw (K := K) (tick := tick) allocation m) := + JointCanonicalization.ideal (activeCounts allocation m) + (Left activeHalfLength) (Right activeHalfLength) (parents F) + (coarse activeHalfLength activeHalfLength halfLength_le_eight) + childStatistic childStatistic leftPrescription rightPrescription + (outputWidth ε) (outputWidth ε) e + +def coordinates (allocation : Allocation) (m : ℕ) + (e : Targets (K := K) (tick := tick) allocation m) := + pairEquiv (activeCounts allocation m) (Left activeHalfLength) + (Right activeHalfLength) e + +def canonical (F : Type*) [CommRing F] (allocation : Allocation) (m : ℕ) (ε : ℝ) : + Tensor F (AllFieldHistoryMasks.Words (K := K) (tick := tick) allocation m) + (AllFieldHistoryMasks.Words (K := K) (tick := tick) allocation m) (AllFieldHistoryMasks.Words (K := K) (tick := tick) allocation m) := + canonicalIdeal (activeCounts allocation m) (Left activeHalfLength) + (Right activeHalfLength) (parents F) + (coarse activeHalfLength activeHalfLength halfLength_le_eight) + childStatistic childStatistic leftPrescription rightPrescription + (outputWidth ε) (outputWidth ε) + +@[instance_reducible] def rawAction (allocation : Allocation) (m : ℕ) + (e : Targets (K := K) (tick := tick) allocation m) : + MulAction (Symmetries (K := K) (tick := tick) allocation m) (Raw (K := K) (tick := tick) allocation m) := + EquivOrbitTransport.action (coordinates allocation m e) + +def completeKeep (allocation : Allocation) (m : ℕ) (ε : ℝ) (side : Fin 3) + (w : Raw (K := K) (tick := tick) allocation m) : Prop := + JointCanonicalMixed.sideMask (activeCounts allocation m) + activeHalfLength activeHalfLength halfLength_le_eight side w ∧ + AllFieldHistoryIncomingMasks.received allocation m ε side w ∧ + AllFieldHistoryRawMasks.rawPass allocation m ε side w + +def sideVariable {V : Type*} (side : Fin 3) (x y z : V) : V := (Matrix.vecCons (x) (Matrix.vecCons (y) (Matrix.vecCons (z) Matrix.vecEmpty))) side + +def idealSide (allocation : Allocation) (m : ℕ) (ε : ℝ) (side : Fin 3) + (e : Targets (K := K) (tick := tick) allocation m) (w : Raw (K := K) (tick := tick) allocation m) : Prop := + coarseMask (activeCounts allocation m) (Left activeHalfLength) (Right activeHalfLength) + (coarse activeHalfLength activeHalfLength halfLength_le_eight) side e w ∧ + rawWindows (activeCounts allocation m) (Left activeHalfLength) (Right activeHalfLength) + (childStatistic side) (childStatistic side) (leftPrescription side) + (rightPrescription side) (outputWidth ε side) (outputWidth ε side) e w + +end MatrixMultiplication.AllFieldHistoryRecovery + + + + + + +namespace MatrixMultiplication.AllFieldHistoryRecovery + +open AllFieldHistory AllFieldHistorySupport + +attribute [local instance] Classical.propDecidable Classical.decEq + +variable {K tick : ℕ} + +def minimumDilation (allocation : Allocation) (ε : ℝ) : ℕ := + Nat.ceil (3 * (AllFieldHistoryMasks.lossConstant (K := K) (tick := tick) allocation ε + 6)) + 2 + +theorem minimumDilation_spec (allocation : Allocation) (ε : ℝ) {m : ℕ} + (hm : minimumDilation (K := K) (tick := tick) allocation ε ≤ m) : + 2 ≤ m ∧ + 3 * (AllFieldHistoryMasks.lossConstant (K := K) (tick := tick) allocation ε + 6) < + (m : ℝ) := by + constructor + · exact (Nat.le_add_left 2 _).trans hm + · have hc := Nat.le_ceil + (3 * (AllFieldHistoryMasks.lossConstant (K := K) (tick := tick) allocation ε + 6)) + have hm' : (Nat.ceil + (3 * (AllFieldHistoryMasks.lossConstant (K := K) (tick := tick) allocation ε + 6)) : ℝ) + 2 ≤ m := by + exact_mod_cast hm + linarith + +def shiftCount (allocation : Allocation) (ε : ℝ) (m : ℕ) : ℕ := + RecoveryGrowth.shiftCount (supportRate (K := K) (tick := tick) allocation) + (AllFieldHistoryMasks.lossConstant (K := K) (tick := tick) allocation ε + 6) m + +theorem replication_subexponential (allocation : Allocation) (ε : ℝ) : + Filter.Tendsto (fun m : ℕ => + Real.log (Fintype.card (InverseLinearRecovery.MaskRectangles + (shiftCount (K := K) (tick := tick) allocation ε m))) / m) + Filter.atTop (nhds 0) := + InverseLinearRecovery.subexponential_copies (supportRate_pos allocation) + (by have := AllFieldHistoryMasks.lossConstant_nonneg (K := K) (tick := tick) allocation ε + linarith) + +end MatrixMultiplication.AllFieldHistoryRecovery + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/Histories/HistorySourceAssignment.lean b/lean/OAI/LinearAlgebra/MatrixFields/Histories/HistorySourceAssignment.lean new file mode 100644 index 0000000000000000000000000000000000000000..31033f08b82d02669172a79cfb60b8cf9d2713e9 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/Histories/HistorySourceAssignment.lean @@ -0,0 +1,751 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Histories.HistoryGroupCore +import OAI.LinearAlgebra.MatrixFields.Histories.HistoryRecovery + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +open scoped BigOperators + +noncomputable section + +namespace MatrixMultiplication.GroupOrbitProjection + +open PermutationMatching +attribute [local instance] Classical.propDecidable Classical.decEq + +section UniformRestriction + +variable {H S : Type*} [Fintype H] [Fintype S] [DecidableEq H] [DecidableEq S] + +def curryFamily (X : H × S → Type*) : (∀ c, X c) ≃ (∀ h s, X (h, s)) where + toFun x h s := x (h, s) + invFun x c := x c.1 c.2 + left_inv _ := rfl + right_inv _ := rfl + +theorem average_subtype_restrict {X : H → Type*} [∀ h, Fintype (X h)] + [∀ h, Nonempty (X h)] (p : H → Prop) [DecidablePred p] + (f : (∀ h : {h // p h}, X h.val) → ℝ) : + average (fun x : ∀ h, X h => f (fun h => x h.val)) = average f := by + change average (fun x => + (fun z : (∀ h : {h // p h}, X h.val) × (∀ h : {h // ¬p h}, X h.val) => f z.1) + ((Equiv.piEquivPiSubtypeProd p X) x)) = average f + rw [average_equiv (Equiv.piEquivPiSubtypeProd p X) + (fun z : (∀ h : {h // p h}, X h.val) × (∀ h : {h // ¬p h}, X h.val) => f z.1), + average_prod_fst] + +theorem average_history_restrict {X : H × S → Type*} [∀ c, Fintype (X c)] + [∀ c, Nonempty (X c)] (p : H → Prop) [DecidablePred p] + (f : (∀ c : {h // p h} × S, X (c.1.val, c.2)) → ℝ) : + average (fun x : ∀ c, X c => f (fun c => x (c.1.val, c.2))) = average f := by + calc + _ = average (fun x : ∀ h s, X (h, s) => f (fun c => x c.1.val c.2)) := + average_equiv (curryFamily X) _ + _ = average (fun x : ∀ h : {h // p h}, ∀ s, X (h.val, s) => + f (fun c => x c.1 c.2)) := + average_subtype_restrict (X := fun h => ∀ s, X (h, s)) p + (fun x => f (fun c => x c.1 c.2)) + _ = average f := + average_equiv (curryFamily (fun c : {h // p h} × S => X (c.1.val, c.2))).symm f + +theorem average_half_history_restrict {X : H × S → Type*} [∀ c, Fintype (X c)] + [∀ c, Nonempty (X c)] (p : H → Prop) [DecidablePred p] + (f : ((∀ c : {h // p h} × S, X (c.1.val, c.2)) × + (∀ c : {h // p h} × S, X (c.1.val, c.2))) → ℝ) : + average (fun g : (∀ c, X c) × (∀ c, X c) => + f ((fun c => g.1 (c.1.val, c.2)), (fun c => g.2 (c.1.val, c.2)))) = + average f := by + rw [average_prod_average] + calc + _ = average (fun x : ∀ c, X c => + average (fun y : ∀ c : {h // p h} × S, X (c.1.val, c.2) => + f ((fun c => x (c.1.val, c.2)), y))) := by + apply average_congr + intro x + exact average_history_restrict (X := X) p + (fun y => f ((fun c => x (c.1.val, c.2)), y)) + _ = average (fun x : ∀ c : {h // p h} × S, X (c.1.val, c.2) => + average (fun y => f (x, y))) := + average_history_restrict (X := X) p (fun x => average (fun y => f (x, y))) + _ = average f := (average_prod_average f).symm + +end UniformRestriction + +section OrbitFraction + +variable {G H X Y : Type*} [Group G] [Group H] [Fintype G] [Fintype H] + [MulAction G X] [MulAction H Y] + +theorem orbit_fraction_of_uniform_projection (project : X → Y) (shift : G → H) + (hsmul : ∀ g x, project (g • x) = shift g • project x) + (huniform : ∀ f : H → ℝ, average (fun g => f (shift g)) = average f) + (x : X) (bad : Y → Prop) : + (((OrbitCounting.orbitSet (G := G) x).filter (fun v => bad (project v))).card : ℝ) / + (OrbitCounting.orbitSet (G := G) x).card = + (((OrbitCounting.orbitSet (G := H) (project x)).filter bad).card : ℝ) / + (OrbitCounting.orbitSet (G := H) (project x)).card := by + rw [← OrbitCounting.bad_shift_fraction (G := G) x (fun v => bad (project v)), + ← OrbitCounting.bad_shift_fraction (G := H) (project x) bad] + rw [← average_indicator_eq, ← average_indicator_eq] + simp_rw [hsmul] + exact huniform (fun g => if bad (g • project x) then (1 : ℝ) else 0) + +theorem rejected_fraction_of_uniform_projection (project : X → Y) (shift : G → H) + (hsmul : ∀ g x, project (g • x) = shift g • project x) + (huniform : ∀ f : H → ℝ, average (fun g => f (shift g)) = average f) + (x : X) (bad : Y → Prop) : + ((rejectedFilter (OrbitCounting.orbitSet (G := G) x) + (fun v => bad (project v))).card : ℝ) / + (OrbitCounting.orbitSet (G := G) x).card = + ((rejectedFilter (OrbitCounting.orbitSet (G := H) (project x)) bad).card : ℝ) / + (OrbitCounting.orbitSet (G := H) (project x)).card := by + simpa only [rejectedFilter, Finset.filter_congr_decidable] using + orbit_fraction_of_uniform_projection project shift hsmul huniform x bad + +end OrbitFraction + +section ConjugatedProjection + +variable {G H RX RY CX CY : Type*} [Group G] [Group H] + [MulAction G CX] [MulAction H CY] + +theorem conjugated_projection_smul (ex : RX ≃ CX) (ey : RY ≃ CY) + (raw : RX → RY) (canonical : CX → CY) (shift : G → H) + (hc : ∀ x, ey (raw x) = canonical (ex x)) + (hs : ∀ g x, canonical (g • x) = shift g • canonical x) : + letI : MulAction G RX := EquivOrbitTransport.action ex + letI : MulAction H RY := EquivOrbitTransport.action ey + ∀ g x, raw (g • x) = shift g • raw x := by + let : MulAction G RX := EquivOrbitTransport.action ex + let : MulAction H RY := EquivOrbitTransport.action ey + intro g x + apply ey.injective + rw [hc, EquivOrbitTransport.equiv_smul ex, hs, + EquivOrbitTransport.equiv_smul ey, hc] + +end ConjugatedProjection + +def transportedOrbit {G RX CX : Type*} [Group G] [Fintype G] [MulAction G CX] + (ex : RX ≃ CX) (x : RX) : Finset RX := + @OrbitCounting.orbitSet G RX _ (EquivOrbitTransport.action ex) _ _ x + +theorem transported_projection_fraction {G H RX RY CX CY : Type*} + [Group G] [Group H] [Fintype G] [Fintype H] + [MulAction G CX] [MulAction H CY] + (ex : RX ≃ CX) (ey : RY ≃ CY) + (raw : RX → RY) (canonical : CX → CY) (shift : G → H) + (hc : ∀ x, ey (raw x) = canonical (ex x)) + (hs : ∀ g x, canonical (g • x) = shift g • canonical x) + (huniform : ∀ f : H → ℝ, average (fun g => f (shift g)) = average f) + (x : RX) (bad : RY → Prop) : + ((rejectedFilter (transportedOrbit (G := G) ex x) + (fun v => bad (raw v))).card : ℝ) / (transportedOrbit (G := G) ex x).card = + ((rejectedFilter (transportedOrbit (G := H) ey (raw x)) bad).card : ℝ) / + (transportedOrbit (G := H) ey (raw x)).card := + @rejected_fraction_of_uniform_projection G H RX RY _ _ _ _ + (EquivOrbitTransport.action ex) (EquivOrbitTransport.action ey) + raw shift (conjugated_projection_smul ex ey raw canonical shift hc hs) huniform x bad + +section CompleteHistories + +variable {H S : Type*} [Fintype H] [Fintype S] [DecidableEq H] [DecidableEq S] + (P X Y : H × S → Type*) [∀ c, Fintype (P c)] [∀ c, DecidableEq (P c)] + +def projectPair (p : H → Prop) (w : CompleteWordPair P X Y) : + CompleteWordPair (fun c : {h // p h} × S => P (c.1.val, c.2)) + (fun c => X (c.1.val, c.2)) (fun c => Y (c.1.val, c.2)) where + left c i := w.left (c.1.val, c.2) i + right c i := w.right (c.1.val, c.2) i + +def projectShifts (p : H → Prop) (g : HalfClassPermutations P) : + HalfClassPermutations (fun c : {h // p h} × S => P (c.1.val, c.2)) := + ((fun c => g.1 (c.1.val, c.2)), (fun c => g.2 (c.1.val, c.2))) + +omit [Fintype H] [Fintype S] [DecidableEq H] [DecidableEq S] + [∀ c, Fintype (P c)] [∀ c, DecidableEq (P c)] in +theorem projectPair_smul (p : H → Prop) (g : HalfClassPermutations P) + (w : CompleteWordPair P X Y) : + projectPair P X Y p (g • w) = projectShifts P p g • projectPair P X Y p w := rfl + +theorem complete_orbit_projection_fraction (p : H → Prop) [DecidablePred p] + (w : CompleteWordPair P X Y) + (bad : CompleteWordPair (fun c : {h // p h} × S => P (c.1.val, c.2)) + (fun c => X (c.1.val, c.2)) (fun c => Y (c.1.val, c.2)) → Prop) : + (((OrbitCounting.orbitSet (G := HalfClassPermutations P) w).filter + (fun v => bad (projectPair P X Y p v))).card : ℝ) / + (OrbitCounting.orbitSet (G := HalfClassPermutations P) w).card = + (((OrbitCounting.orbitSet + (G := HalfClassPermutations (fun c : {h // p h} × S => P (c.1.val, c.2))) + (projectPair P X Y p w)).filter bad).card : ℝ) / + (OrbitCounting.orbitSet + (G := HalfClassPermutations (fun c : {h // p h} × S => P (c.1.val, c.2))) + (projectPair P X Y p w)).card := by + apply orbit_fraction_of_uniform_projection (projectPair P X Y p) (projectShifts P p) + · exact projectPair_smul P X Y p + · intro f + exact average_half_history_restrict (X := fun c => Equiv.Perm (P c)) p f + +end CompleteHistories + +section UnionBound + +variable {G X I : Type*} [Group G] [Fintype G] [MulAction G X] [Fintype I] + +theorem orbit_union_fraction_le (x : X) (bad : I → X → Prop) (bound : I → ℝ) + (hbound : ∀ i, + (((OrbitCounting.orbitSet (G := G) x).filter (bad i)).card : ℝ) / + (OrbitCounting.orbitSet (G := G) x).card ≤ bound i) : + (((OrbitCounting.orbitSet (G := G) x).filter (fun v => ∃ i, bad i v)).card : ℝ) / + (OrbitCounting.orbitSet (G := G) x).card ≤ ∑ i, bound i := by + rw [← OrbitCounting.bad_shift_fraction (G := G) x (fun v => ∃ i, bad i v), + ← average_indicator_eq] + calc + _ ≤ average (fun g : G => ∑ i, if bad i (g • x) then (1 : ℝ) else 0) := by + apply average_mono + intro g + split_ifs with hex + · obtain ⟨i, hi⟩ := hex + have hterm : (if bad i (g • x) then (1 : ℝ) else 0) = 1 := ite_eq_left hi + exact hterm.symm.le.trans (Finset.single_le_sum + (f := fun j : I => if bad j (g • x) then (1 : ℝ) else 0) + (fun j _ => by split_ifs <;> norm_num) (Finset.mem_univ i)) + · exact Finset.sum_nonneg (fun i _ => by split_ifs <;> norm_num) + _ = ∑ i, average (fun g : G => if bad i (g • x) then (1 : ℝ) else 0) := + average_sum _ _ + _ ≤ ∑ i, bound i := by + apply Finset.sum_le_sum + intro i _ + rw [average_indicator_eq, OrbitCounting.bad_shift_fraction (G := G) x (bad i)] + exact hbound i + +end UnionBound + +section FinsetUnion + +variable {X I : Type*} [Fintype I] + +theorem finset_union_fraction_le (samples : Finset X) (bad : I → X → Prop) + (bound : I → ℝ) + (hbound : ∀ i, (((samples.filter (bad i)).card : ℝ) / samples.card) ≤ bound i) : + (((samples.filter (fun v => ∃ i, bad i v)).card : ℝ) / samples.card) ≤ + ∑ i, bound i := by + have hset : samples.filter (fun v => ∃ i, bad i v) = + Finset.univ.biUnion (fun i => samples.filter (bad i)) := by + ext v + simp only [Finset.mem_filter, Finset.mem_biUnion, Finset.mem_univ, true_and] + exact ⟨fun ⟨hv, i, hi⟩ => ⟨i, hv, hi⟩, fun ⟨i, hv, hi⟩ => ⟨hv, i, hi⟩⟩ + have hcard : ((samples.filter (fun v => ∃ i, bad i v)).card : ℝ) ≤ + ∑ i, ((samples.filter (bad i)).card : ℝ) := by + rw [hset, ← Nat.cast_sum] + exact Nat.cast_le.mpr Finset.card_biUnion_le + calc + _ ≤ (∑ i, ((samples.filter (bad i)).card : ℝ)) / samples.card := + div_le_div_of_nonneg_right hcard (Nat.cast_nonneg _) + _ = ∑ i, ((samples.filter (bad i)).card : ℝ) / samples.card := Finset.sum_div _ _ _ + _ ≤ ∑ i, bound i := Finset.sum_le_sum (fun i _ => hbound i) + +theorem rejected_union_fraction_le (samples : Finset X) (bad : I → X → Prop) + (bound : I → ℝ) + (hbound : ∀ i, ((rejectedFilter samples (bad i)).card : ℝ) / samples.card ≤ bound i) : + ((rejectedFilter samples (fun v => ∃ i, bad i v)).card : ℝ) / samples.card ≤ + ∑ i, bound i := by + have hh (i : I) : ((samples.filter (bad i)).card : ℝ) / samples.card ≤ bound i := by + simpa only [rejectedFilter, Finset.filter_congr_decidable] using hbound i + have heq : samples.filter (fun v => ∃ i, bad i v) = + rejectedFilter samples (fun v => ∃ i, bad i v) := by + ext v + simp only [rejectedFilter, Finset.mem_filter] + rw [← heq] + exact finset_union_fraction_le samples bad bound hh + +end FinsetUnion + +section GroupedHistories + +variable {H S I : Type*} [Fintype H] [Fintype S] [Fintype I] + [DecidableEq H] [DecidableEq S] [DecidableEq I] + (P X Y : H × S → Type*) [∀ c, Fintype (P c)] [∀ c, DecidableEq (P c)] + +theorem complete_group_union_fraction_le (group : H → I) + (w : CompleteWordPair P X Y) + (bad : ∀ i, CompleteWordPair + (fun c : {h // group h = i} × S => P (c.1.val, c.2)) + (fun c => X (c.1.val, c.2)) (fun c => Y (c.1.val, c.2)) → Prop) + (bound : I → ℝ) + (hbound : ∀ i, + (((OrbitCounting.orbitSet + (G := HalfClassPermutations (fun c : {h // group h = i} × S => P (c.1.val, c.2))) + (projectPair P X Y (fun h => group h = i) w)).filter (bad i)).card : ℝ) / + (OrbitCounting.orbitSet + (G := HalfClassPermutations (fun c : {h // group h = i} × S => P (c.1.val, c.2))) + (projectPair P X Y (fun h => group h = i) w)).card ≤ bound i) : + (((OrbitCounting.orbitSet (G := HalfClassPermutations P) w).filter + (fun v => ∃ i, bad i (projectPair P X Y (fun h => group h = i) v))).card : ℝ) / + (OrbitCounting.orbitSet (G := HalfClassPermutations P) w).card ≤ ∑ i, bound i := by + apply orbit_union_fraction_le + intro i + rw [complete_orbit_projection_fraction] + exact hbound i + +end GroupedHistories + +section RawHistories + +open JointPopulation JointCanonicalization + +variable {H : Type*} [Fintype H] [DecidableEq H] + (counts : H → Shape → ℕ) (L R : H → Type*) + +def groupCounts (p : H → Prop) : {h // p h} → Shape → ℕ := fun h => counts h.val + +def projectTarget (p : H → Prop) (e : Target counts) : Target (groupCounts counts p) := + fun h => e h.val + +def projectRaw (p : H → Prop) (w : RawPairs counts L R) : + RawPairs (groupCounts counts p) (fun h => L h.val) (fun h => R h.val) := + fun h => w h.val + +omit [Fintype H] [DecidableEq H] in +theorem pairEquiv_projectRaw (p : H → Prop) [DecidablePred p] (e : Target counts) + (w : RawPairs counts L R) : + pairEquiv (groupCounts counts p) (fun h => L h.val) (fun h => R h.val) + (projectTarget counts p e) (projectRaw counts L R p w) = + projectPair (ClassPositions counts) (fun c => L c.1) (fun c => R c.1) p + (pairEquiv counts L R e w) := rfl + +omit [Fintype H] [DecidableEq H] in +theorem projectRaw_pairEquiv_symm (p : H → Prop) [DecidablePred p] (e : Target counts) + (v : CanonicalPairs counts L R) : + projectRaw counts L R p ((pairEquiv counts L R e).symm v) = + (pairEquiv (groupCounts counts p) (fun h => L h.val) (fun h => R h.val) + (projectTarget counts p e)).symm + (projectPair (ClassPositions counts) (fun c => L c.1) (fun c => R c.1) p v) := by + apply (pairEquiv (groupCounts counts p) (fun h => L h.val) (fun h => R h.val) + (projectTarget counts p e)).eq_symm_apply.mpr + exact (pairEquiv_projectRaw counts L R p e _).trans + (congrArg (projectPair (ClassPositions counts) (fun c => L c.1) (fun c => R c.1) p) + ((pairEquiv counts L R e).apply_symm_apply v)) + +def rawOrbit (e : Target counts) (w : RawPairs counts L R) : + Finset (RawPairs counts L R) := + transportedOrbit (G := HalfClassPermutations (ClassPositions counts)) + (pairEquiv counts L R e) w + +theorem raw_orbit_projection_fraction (p : H → Prop) [DecidablePred p] (e : Target counts) + (w : RawPairs counts L R) + (bad : RawPairs (groupCounts counts p) (fun h => L h.val) (fun h => R h.val) → Prop) : + ((rejectedFilter (rawOrbit counts L R e w) + (fun v => bad (projectRaw counts L R p v))).card : ℝ) / + (rawOrbit counts L R e w).card = + ((rejectedFilter (rawOrbit (groupCounts counts p) (fun h => L h.val) (fun h => R h.val) + (projectTarget counts p e) (projectRaw counts L R p w)) bad).card : ℝ) / + (rawOrbit (groupCounts counts p) (fun h => L h.val) (fun h => R h.val) + (projectTarget counts p e) (projectRaw counts L R p w)).card := by + exact transported_projection_fraction + (G := HalfClassPermutations (ClassPositions counts)) + (H := HalfClassPermutations (ClassPositions (groupCounts counts p))) + (RX := RawPairs counts L R) + (RY := RawPairs (groupCounts counts p) (fun h => L h.val) (fun h => R h.val)) + (CX := CanonicalPairs counts L R) + (CY := CanonicalPairs (groupCounts counts p) (fun h => L h.val) (fun h => R h.val)) + (pairEquiv counts L R e) + (pairEquiv (groupCounts counts p) (fun h => L h.val) (fun h => R h.val) + (projectTarget counts p e)) + (projectRaw counts L R p) + (projectPair (ClassPositions counts) (fun c => L c.1) (fun c => R c.1) p) + (projectShifts (ClassPositions counts) p) + (pairEquiv_projectRaw counts L R p e) + (projectPair_smul (H := H) (S := Shape) (ClassPositions counts) + (fun c => L c.1) (fun c => R c.1) p) + (fun f => average_half_history_restrict (H := H) (S := Shape) + (X := fun c => Equiv.Perm (ClassPositions counts c)) p f) w bad + +theorem raw_group_passing_rejection_fraction_le {I : Type*} [Fintype I] [DecidableEq I] + (group : H → I) (e : Target counts) (w : RawPairs counts L R) + (keep : RawPairs counts L R → Prop) + (localKeep assigned : ∀ i : I, RawPairs (groupCounts counts (fun h => group h = i)) + (fun h => L h.val) (fun h => R h.val) → Prop) + (hkeep : ∀ v, keep v → ∀ i, + localKeep i (projectRaw counts L R (fun h => group h = i) v)) + (bound : I → ℝ) + (hbound : ∀ i, + ((rejectedFilter (rawOrbit (groupCounts counts (fun h => group h = i)) + (fun h => L h.val) (fun h => R h.val) + (projectTarget counts (fun h => group h = i) e) + (projectRaw counts L R (fun h => group h = i) w)) + (fun v => localKeep i v ∧ ¬assigned i v)).card : ℝ) / + (rawOrbit (groupCounts counts (fun h => group h = i)) + (fun h => L h.val) (fun h => R h.val) + (projectTarget counts (fun h => group h = i) e) + (projectRaw counts L R (fun h => group h = i) w)).card ≤ bound i) : + ((rejectedFilter (rawOrbit counts L R e w) + (fun v => keep v ∧ ¬∀ i, assigned i + (projectRaw counts L R (fun h => group h = i) v))).card : ℝ) / + (rawOrbit counts L R e w).card ≤ ∑ i, bound i := by + let bad : I → RawPairs counts L R → Prop := fun i v => + localKeep i (projectRaw counts L R (fun h => group h = i) v) ∧ + ¬assigned i (projectRaw counts L R (fun h => group h = i) v) + have hsub : rejectedFilter (rawOrbit counts L R e w) + (fun v => keep v ∧ ¬∀ i, assigned i + (projectRaw counts L R (fun h => group h = i) v)) ⊆ + rejectedFilter (rawOrbit counts L R e w) (fun v => ∃ i, bad i v) := by + intro v hv + simp only [rejectedFilter, Finset.mem_filter] at hv ⊢ + obtain ⟨hmem, hk, ha⟩ := hv + obtain ⟨i, hi⟩ := not_forall.mp ha + exact ⟨hmem, i, hkeep v hk i, hi⟩ + have hlocal (i : I) : + ((rejectedFilter (rawOrbit counts L R e w) (bad i)).card : ℝ) / + (rawOrbit counts L R e w).card ≤ bound i := + (raw_orbit_projection_fraction counts L R (fun h => group h = i) e w + (fun v => localKeep i v ∧ ¬assigned i v)).le.trans (hbound i) + have hunion : ((rejectedFilter (rawOrbit counts L R e w) + (fun v => ∃ i, bad i v)).card : ℝ) / + (rawOrbit counts L R e w).card ≤ ∑ i, bound i := + rejected_union_fraction_le (rawOrbit counts L R e w) bad bound hlocal + have hcard : ((rejectedFilter (rawOrbit counts L R e w) + (fun v => keep v ∧ ¬∀ i, assigned i + (projectRaw counts L R (fun h => group h = i) v))).card : ℝ) ≤ + ((rejectedFilter (rawOrbit counts L R e w) (fun v => ∃ i, bad i v)).card : ℝ) := + Nat.cast_le.mpr (Finset.card_le_card hsub) + exact (div_le_div_of_nonneg_right hcard + (Nat.cast_nonneg (rawOrbit counts L R e w).card)).trans hunion + +end RawHistories + +end MatrixMultiplication.GroupOrbitProjection + +end +end + + + + +section +namespace MatrixMultiplication.RecoveryOrbitDecisions + +theorem orbitSet_instances {G X : Type*} [Group G] [MulAction G X] + (f₁ f₂ : Fintype G) (d₁ d₂ : DecidableEq X) (x : X) : + @OrbitCounting.orbitSet G X _ _ f₁ d₁ x = + @OrbitCounting.orbitSet G X _ _ f₂ d₂ x := by + apply Finset.ext + intro y + simp only [OrbitCounting.orbitSet, Finset.mem_image, Finset.mem_univ, true_and] + +theorem orbitSet_eq_transportedOrbit {G X Y : Type*} [Group G] [MulAction G Y] + (fRaw fCanonical : Fintype G) (d : DecidableEq X) (e : X ≃ Y) (x : X) : + @OrbitCounting.orbitSet G X _ (EquivOrbitTransport.action e) fRaw d x = + @GroupOrbitProjection.transportedOrbit G X Y _ fCanonical _ e x := by + unfold GroupOrbitProjection.transportedOrbit + exact @orbitSet_instances G X _ (EquivOrbitTransport.action e) + fRaw fCanonical d _ x + +theorem transportedOrbit_eq_orbitSet {G X Y : Type*} [Group G] [MulAction G Y] + (fCanonical fRaw : Fintype G) (d : DecidableEq X) (e : X ≃ Y) (x : X) : + @GroupOrbitProjection.transportedOrbit G X Y _ fCanonical _ e x = + @OrbitCounting.orbitSet G X _ (EquivOrbitTransport.action e) fRaw d x := + (orbitSet_eq_transportedOrbit fRaw fCanonical d e x).symm + +end MatrixMultiplication.RecoveryOrbitDecisions + + + + + +noncomputable section + +namespace MatrixMultiplication.AllFieldHistoryGroupedRecovery + +open AllFieldHistory AllFieldHistorySupport AllFieldHistoryChildLaws +open AllFieldHistoryGroupMasks JointPopulation JointCanonicalization JointCanonicalCW +open PermutationMatching +open scoped BigOperators +attribute [local instance] Classical.propDecidable Classical.decEq + +variable {K tick : ℕ} + +theorem coordinates_project (allocation : Allocation) (m : ℕ) (sigma : Placement) + (e : AllFieldHistoryRecovery.Targets (K := K) (tick := tick) allocation m) + (w : AllFieldHistoryRecovery.Raw (K := K) (tick := tick) allocation m) : + GroupOrbitProjection.projectPair + (ClassPositions (activeCounts allocation m)) + AllFieldHistoryMasks.Letters AllFieldHistoryMasks.Letters + (fun h : Active K tick => h.val.physicalOrder = sigma) + (AllFieldHistoryRecovery.coordinates allocation m e w) = + groupCoordinates allocation m sigma (projectTarget allocation m sigma e) + (projectRaw allocation m sigma w) := rfl + +theorem idealSide_iff_all_groups (allocation : Allocation) (m : ℕ) (ε : ℝ) + (side : Fin 3) + (e : AllFieldHistoryRecovery.Targets (K := K) (tick := tick) allocation m) + (w : AllFieldHistoryRecovery.Raw (K := K) (tick := tick) allocation m) : + AllFieldHistoryRecovery.idealSide allocation m ε side e w ↔ + ∀ sigma, groupIdealSide allocation m ε side sigma + (projectTarget allocation m sigma e) (projectRaw allocation m sigma w) := by + constructor + · intro hw sigma + exact ⟨fun h j => hw.1 h.val j, fun h u hu => hw.2 h.val u hu⟩ + · intro hw + exact ⟨fun h j => (hw h.val.physicalOrder).1 ⟨h, rfl⟩ j, + fun h u hu => (hw h.val.physicalOrder).2 ⟨h, rfl⟩ u hu⟩ + +theorem project_joinGroupTargets (allocation : Allocation) (m : ℕ) + (e : ∀ sigma, GroupTarget (K := K) (tick := tick) allocation m sigma) + (sigma : Placement) : + projectTarget allocation m sigma (joinGroupTargets (activeCounts allocation m) e) = + e sigma := by + funext h + rcases h with ⟨h, hh⟩ + cases hh + rfl + +def groupedAssignment (allocation : Allocation) (m : ℕ) (E : Placement → Type*) + (a : ∀ sigma, JointExtraction.Assignment + (GroupRaw (K := K) (tick := tick) allocation m sigma) + (GroupRaw (K := K) (tick := tick) allocation m sigma) (GroupRaw (K := K) (tick := tick) allocation m sigma) (E sigma)) : + JointExtraction.Assignment (AllFieldHistoryRecovery.Raw (K := K) (tick := tick) allocation m) + (AllFieldHistoryRecovery.Raw (K := K) (tick := tick) allocation m) (AllFieldHistoryRecovery.Raw (K := K) (tick := tick) allocation m) + (∀ sigma, E sigma) where + x w := GroupAssignment.collect (fun sigma => (a sigma).x) + (fun sigma => projectRaw allocation m sigma w) + y w := GroupAssignment.collect (fun sigma => (a sigma).y) + (fun sigma => projectRaw allocation m sigma w) + z w := GroupAssignment.collect (fun sigma => (a sigma).z) + (fun sigma => projectRaw allocation m sigma w) + +theorem groupedAssignment_sound (allocation : Allocation) (m : ℕ) (ε : ℝ) + (E : Placement → Type*) + (a : ∀ sigma, JointExtraction.Assignment + (GroupRaw (K := K) (tick := tick) allocation m sigma) + (GroupRaw (K := K) (tick := tick) allocation m sigma) (GroupRaw (K := K) (tick := tick) allocation m sigma) (E sigma)) + (i : ∀ sigma, E sigma) (e : ∀ sigma, GroupTarget (K := K) (tick := tick) allocation m sigma) + (hx : ∀ sigma w, (a sigma).x w = some (i sigma) → + groupIdealSide allocation m ε 0 sigma (e sigma) w) + (hy : ∀ sigma w, (a sigma).y w = some (i sigma) → + groupIdealSide allocation m ε 1 sigma (e sigma) w) + (hz : ∀ sigma w, (a sigma).z w = some (i sigma) → + groupIdealSide allocation m ε 2 sigma (e sigma) w) : + (∀ w, (groupedAssignment allocation m E a).x w = some i → + AllFieldHistoryRecovery.idealSide allocation m ε 0 + (joinGroupTargets (activeCounts allocation m) e) w) ∧ + (∀ w, (groupedAssignment allocation m E a).y w = some i → + AllFieldHistoryRecovery.idealSide allocation m ε 1 + (joinGroupTargets (activeCounts allocation m) e) w) ∧ + (∀ w, (groupedAssignment allocation m E a).z w = some i → + AllFieldHistoryRecovery.idealSide allocation m ε 2 + (joinGroupTargets (activeCounts allocation m) e) w) := by + refine ⟨?_, ?_, ?_⟩ + · intro w hw + apply (idealSide_iff_all_groups allocation m ε 0 _ w).2 + intro sigma + rw [project_joinGroupTargets] + exact hx sigma _ ((GroupAssignment.collect_eq_some _ _ _).mp hw sigma) + · intro w hw + apply (idealSide_iff_all_groups allocation m ε 1 _ w).2 + intro sigma + rw [project_joinGroupTargets] + exact hy sigma _ ((GroupAssignment.collect_eq_some _ _ _).mp hw sigma) + · intro w hw + apply (idealSide_iff_all_groups allocation m ε 2 _ w).2 + intro sigma + rw [project_joinGroupTargets] + exact hz sigma _ ((GroupAssignment.collect_eq_some _ _ _).mp hw sigma) + +def localOrbit (allocation : Allocation) (m : ℕ) (sigma : Placement) + (e : GroupTarget (K := K) (tick := tick) allocation m sigma) + (w : GroupRaw (K := K) (tick := tick) allocation m sigma) : Finset (GroupRaw (K := K) (tick := tick) allocation m sigma) := + GroupOrbitProjection.rawOrbit (groupCounts allocation m sigma) + (fun h => Fin (activeHalfLength h.val) → Fin 7) + (fun h => Fin (activeHalfLength h.val) → Fin 7) e w + +def localAssigned (allocation : Allocation) (m : ℕ) (sigma : Placement) {E : Type*} + (a : JointExtraction.Assignment + (GroupRaw (K := K) (tick := tick) allocation m sigma) + (GroupRaw (K := K) (tick := tick) allocation m sigma) (GroupRaw (K := K) (tick := tick) allocation m sigma) E) + (i : E) (side : Fin 3) (w : GroupRaw (K := K) (tick := tick) allocation m sigma) : Prop := + AllFieldHistoryRecovery.sideVariable side (a.x w = some i) (a.y w = some i) (a.z w = some i) + +theorem grouped_assigned_iff (allocation : Allocation) (m : ℕ) + (E : Placement → Type*) + (a : ∀ sigma, JointExtraction.Assignment + (GroupRaw (K := K) (tick := tick) allocation m sigma) + (GroupRaw (K := K) (tick := tick) allocation m sigma) (GroupRaw (K := K) (tick := tick) allocation m sigma) (E sigma)) + (i : ∀ sigma, E sigma) (side : Fin 3) + (w : AllFieldHistoryRecovery.Raw (K := K) (tick := tick) allocation m) : + AllFieldHistoryRecovery.sideVariable side + ((groupedAssignment allocation m E a).x w = some i) + ((groupedAssignment allocation m E a).y w = some i) + ((groupedAssignment allocation m E a).z w = some i) ↔ + ∀ sigma, localAssigned allocation m sigma (a sigma) (i sigma) side + (projectRaw allocation m sigma w) := by + fin_cases side <;> exact GroupAssignment.collect_eq_some _ _ _ + +theorem filter_eq_rejected {V : Type*} (orbit : Finset V) + (bad : V → Prop) (d : DecidablePred bad) : + @Finset.filter V bad d orbit = rejectedFilter orbit bad := by + ext v + simp only [rejectedFilter, Finset.mem_filter] + +theorem grouped_collision_le (allocation : Allocation) (m : ℕ) (ε : ℝ) + (E : Placement → Type*) + (a : ∀ sigma, JointExtraction.Assignment + (GroupRaw (K := K) (tick := tick) allocation m sigma) + (GroupRaw (K := K) (tick := tick) allocation m sigma) (GroupRaw (K := K) (tick := tick) allocation m sigma) (E sigma)) + (i : ∀ sigma, E sigma) (e : ∀ sigma, GroupTarget (K := K) (tick := tick) allocation m sigma) + (side : Fin 3) (w : AllFieldHistoryRecovery.Raw (K := K) (tick := tick) allocation m) + (hbound : ∀ sigma, + (((localOrbit allocation m sigma (e sigma) (projectRaw allocation m sigma w)).filter + (fun v => AllFieldHistoryGroupMasks.completeKeep allocation m ε side sigma v ∧ + ¬localAssigned allocation m sigma (a sigma) (i sigma) side v)).card : ℝ) / + (localOrbit allocation m sigma (e sigma) (projectRaw allocation m sigma w)).card ≤ 1 / m) : + letI : MulAction (AllFieldHistoryRecovery.Symmetries (K := K) (tick := tick) allocation m) + (AllFieldHistoryRecovery.Raw (K := K) (tick := tick) allocation m) := + AllFieldHistoryRecovery.rawAction allocation m (joinGroupTargets (activeCounts allocation m) e) + (((OrbitCounting.orbitSet (G := AllFieldHistoryRecovery.Symmetries (K := K) (tick := tick) allocation m) w).filter + (fun v => AllFieldHistoryRecovery.completeKeep allocation m ε side v ∧ + ¬AllFieldHistoryRecovery.sideVariable side + ((groupedAssignment allocation m E a).x v = some i) + ((groupedAssignment allocation m E a).y v = some i) + ((groupedAssignment allocation m E a).z v = some i))).card : ℝ) / + (OrbitCounting.orbitSet (G := AllFieldHistoryRecovery.Symmetries (K := K) (tick := tick) allocation m) w).card ≤ 6 / m := by + let target := joinGroupTargets (activeCounts allocation m) e + let : MulAction (AllFieldHistoryRecovery.Symmetries (K := K) (tick := tick) allocation m) + (AllFieldHistoryRecovery.Raw (K := K) (tick := tick) allocation m) := AllFieldHistoryRecovery.rawAction allocation m target + have hb (sigma : Placement) : + ((rejectedFilter (GroupOrbitProjection.rawOrbit + (GroupOrbitProjection.groupCounts (activeCounts allocation m) + (fun h : Active K tick => h.val.physicalOrder = sigma)) + (fun h => Left activeHalfLength h.val) (fun h => Right activeHalfLength h.val) + (GroupOrbitProjection.projectTarget (activeCounts allocation m) + (fun h => h.val.physicalOrder = sigma) target) + (projectRaw allocation m sigma w)) + (fun v => AllFieldHistoryGroupMasks.completeKeep allocation m ε side sigma v ∧ + ¬localAssigned allocation m sigma (a sigma) (i sigma) side v)).card : ℝ) / + (GroupOrbitProjection.rawOrbit + (GroupOrbitProjection.groupCounts (activeCounts allocation m) + (fun h : Active K tick => h.val.physicalOrder = sigma)) + (fun h => Left activeHalfLength h.val) (fun h => Right activeHalfLength h.val) + (GroupOrbitProjection.projectTarget (activeCounts allocation m) + (fun h => h.val.physicalOrder = sigma) target) + (projectRaw allocation m sigma w)).card ≤ 1 / m := by + change ((rejectedFilter + (localOrbit allocation m sigma (projectTarget allocation m sigma target) + (projectRaw allocation m sigma w)) + (fun v => AllFieldHistoryGroupMasks.completeKeep allocation m ε side sigma v ∧ + ¬localAssigned allocation m sigma (a sigma) (i sigma) side v)).card : ℝ) / + (localOrbit allocation m sigma (projectTarget allocation m sigma target) + (projectRaw allocation m sigma w)).card ≤ 1 / m + dsimp only [target] + rw [project_joinGroupTargets] + have hb0 := hbound sigma + rw [filter_eq_rejected] at hb0 + exact hb0 + have hh := GroupOrbitProjection.raw_group_passing_rejection_fraction_le + (activeCounts allocation m) (Left activeHalfLength) (Right activeHalfLength) + (fun h : Active K tick => h.val.physicalOrder) target w + (AllFieldHistoryRecovery.completeKeep allocation m ε side) + (fun sigma => AllFieldHistoryGroupMasks.completeKeep allocation m ε side sigma) + (fun sigma => localAssigned allocation m sigma (a sigma) (i sigma) side) + (fun v hv sigma => completeKeep_project allocation m ε side v hv sigma) + (fun _ => (1 : ℝ) / m) hb + have hcard : Fintype.card Placement = 6 := by + norm_num [Placement, Fintype.card_perm, Nat.factorial] + have horbit : + OrbitCounting.orbitSet + (G := AllFieldHistoryRecovery.Symmetries (K := K) (tick := tick) allocation m) w = + GroupOrbitProjection.rawOrbit (activeCounts allocation m) + (Left activeHalfLength) (Right activeHalfLength) target w := by + exact RecoveryOrbitDecisions.orbitSet_eq_transportedOrbit + (G := AllFieldHistoryRecovery.Symmetries (K := K) (tick := tick) allocation m) + _ _ _ (AllFieldHistoryRecovery.coordinates allocation m target) w + rw [filter_eq_rejected, horbit] + simp only [target, grouped_assigned_iff, Finset.sum_const, Finset.card_univ, + hcard, nsmul_eq_mul, Nat.cast_ofNat, mul_one_div] at hh ⊢ + exact hh + +theorem repair_grouped (F : Type*) [CommRing F] (allocation : Allocation) + {m : ℕ} {ε : ℝ} (hε : 0 < ε) + (hm : AllFieldHistoryRecovery.minimumDilation (K := K) (tick := tick) allocation ε ≤ m) + (E : Placement → Type*) + (a : ∀ sigma, JointExtraction.Assignment + (GroupRaw (K := K) (tick := tick) allocation m sigma) + (GroupRaw (K := K) (tick := tick) allocation m sigma) (GroupRaw (K := K) (tick := tick) allocation m sigma) (E sigma)) + (i : ∀ sigma, E sigma) (e : ∀ sigma, GroupTarget (K := K) (tick := tick) allocation m sigma) + (hx : ∀ sigma w, (a sigma).x w = some (i sigma) → + groupIdealSide allocation m ε 0 sigma (e sigma) w) + (hy : ∀ sigma w, (a sigma).y w = some (i sigma) → + groupIdealSide allocation m ε 1 sigma (e sigma) w) + (hz : ∀ sigma w, (a sigma).z w = some (i sigma) → + groupIdealSide allocation m ε 2 sigma (e sigma) w) + (hbound : ∀ side w, + AllFieldHistoryRecovery.Used F allocation m ε + (joinGroupTargets (activeCounts allocation m) e) side w → ∀ sigma, + (((localOrbit allocation m sigma (e sigma) (projectRaw allocation m sigma w)).filter + (fun v => AllFieldHistoryGroupMasks.completeKeep allocation m ε side sigma v ∧ + ¬localAssigned allocation m sigma (a sigma) (i sigma) side v)).card : ℝ) / + (localOrbit allocation m sigma (e sigma) (projectRaw allocation m sigma w)).card ≤ 1 / m) : + InverseLinearRecovery.RecoveredBy + (AllFieldHistoryRecovery.ideal F allocation m ε (joinGroupTargets (activeCounts allocation m) e)) + (JointExtraction.branch + (ExactRecovery.delete (AllFieldHistoryRecovery.rawSource F allocation m) + (AllFieldHistoryRecovery.completeKeep allocation m ε 0) + (AllFieldHistoryRecovery.completeKeep allocation m ε 1) + (AllFieldHistoryRecovery.completeKeep allocation m ε 2)) + (groupedAssignment allocation m E a) i) + (AllFieldHistoryRecovery.shiftCount (K := K) (tick := tick) allocation ε m) := by + have hs := groupedAssignment_sound allocation m ε E a i e hx hy hz + apply AllFieldHistoryRecovery.repair_selected_branch F allocation hε hm + (groupedAssignment allocation m E a) i (joinGroupTargets (activeCounts allocation m) e) + hs.1 hs.2.1 hs.2.2 + intro side w hw + exact grouped_collision_le allocation m ε E a i e side w (hbound side w hw) + +end MatrixMultiplication.AllFieldHistoryGroupedRecovery + + + + + + +namespace MatrixMultiplication.AllFieldHistorySource + +open MatrixMultiplication.Foundation AllFieldHistory AllFieldFiniteFamily +open scoped BigOperators Classical +attribute [local instance] Classical.propDecidable Classical.decEq + +variable {K tick : ℕ} (allocation : Allocation) (m : ℕ) + +theorem groupedAssignment_coherent (F : Type*) [Field F] (ε : ℝ) + (E : Placement → Type) + (a : ∀ sigma, JointExtraction.Assignment + (AllFieldHistoryGroupMasks.GroupRaw (K := K) (tick := tick) allocation m sigma) + (AllFieldHistoryGroupMasks.GroupRaw (K := K) (tick := tick) allocation m sigma) + (AllFieldHistoryGroupMasks.GroupRaw (K := K) (tick := tick) allocation m sigma) (E sigma)) + (ha : ∀ sigma, JointExtraction.Coherent + (AllFieldHistoryGroupMasks.groupPreparedSource F allocation m ε sigma) (a sigma)) : + JointExtraction.Coherent (preparedSource (K := K) (tick := tick) allocation m F ε) + (AllFieldHistoryGroupedRecovery.groupedAssignment allocation m E a) := by + intro x y z i j k hT hx hy hz + have hprod : CommonDimensions.familyProduct + (fun sigma => AllFieldHistoryGroupMasks.groupPreparedSource F allocation m ε sigma) + (fun sigma => AllFieldHistoryGroupMasks.projectRaw allocation m sigma x) + (fun sigma => AllFieldHistoryGroupMasks.projectRaw allocation m sigma y) + (fun sigma => AllFieldHistoryGroupMasks.projectRaw allocation m sigma z) ≠ 0 := by + rw [preparedSource_eq_delete] at hT + exact fun hzero => hT ((AllFieldHistoryGroupMasks.preparedSource_factor + F allocation m ε x y z).trans hzero) + exact GroupAssignment.product_coherent _ a ha _ _ _ i j k hprod hx hy hz + +end MatrixMultiplication.AllFieldHistorySource + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/Histories/HistorySums.lean b/lean/OAI/LinearAlgebra/MatrixFields/Histories/HistorySums.lean new file mode 100644 index 0000000000000000000000000000000000000000..f740936cad8410b04ad7e775505eb3015f1e0095 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/Histories/HistorySums.lean @@ -0,0 +1,256 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Histories.HistoryChildLaws + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section + +namespace MatrixMultiplication.AllFieldHistory + +open AllFieldParameters +open scoped BigOperators +attribute [local instance] Classical.propDecidable Classical.decEq + +def secondMass (t : Shape) : ℚ := + 2 * (positiveInitial.map (fun g => initialLaw g * stageALaw g t)).sum + +def littleMass (t u : Shape) : ℚ := 2 * secondMass t * stageBLaw t u + +private theorem subtype_sum_indicator_inline_MatrixMultiplication_AllFieldHistorySums {A : Type*} [Fintype A] + (P : A → Prop) [DecidablePred P] [Fintype {a // P a}] (f : A → ℝ) : + (∑ a : {a // P a}, f a.val) = ∑ a, if P a then f a else 0 := by + rw [← Finset.sum_filter] + exact (Finset.sum_subtype _ (by simp) f).symm + +private theorem list_filter_sum_inline_MatrixMultiplication_AllFieldHistorySums {A : Type*} (xs : List A) (p : A → Bool) + (f : A → ℝ) : + ((xs.filter p).map f).sum = (xs.map (fun a => if p a then f a else 0)).sum := by + induction xs with + | nil => simp + | cons a xs ih => cases hp : p a <;> simp [hp, ih] + +private theorem list_sum_congr {A : Type*} (xs : List A) (f g : A → ℝ) + (h : ∀ a ∈ xs, f a = g a) : (xs.map f).sum = (xs.map g).sum := + congrArg List.sum (List.map_congr_left h) + +private theorem list_sum_comm {A B : Type*} (xs : List A) (ys : List B) + (f : A → B → ℝ) : + (xs.map (fun a => (ys.map (f a)).sum)).sum = + (ys.map (fun b => (xs.map (fun a => f a b)).sum)).sum := by + induction xs with + | nil => simp + | cons a xs ih => simp [ih, List.sum_map_add] + +private theorem list_rat_cast_inline_MatrixMultiplication_AllFieldHistorySums {A : Type*} (xs : List A) (f : A → ℚ) : + ((xs.map f).sum : ℝ) = (xs.map (fun a => (f a : ℝ))).sum := by + induction xs with + | nil => simp + | cons a xs ih => simp [ih] + + theorem secondMass_cast (t : Shape) : + (secondMass t : ℝ) = + 2 * (positiveInitial.map (fun g => (initialLaw g : ℝ) * (stageALaw g t : ℝ))).sum := by + simp only [secondMass, Rat.cast_mul, Rat.cast_ofNat, list_rat_cast_inline_MatrixMultiplication_AllFieldHistorySums] + + theorem littleMass_cast (t u : Shape) : + (littleMass t u : ℝ) = 2 * (secondMass t : ℝ) * (stageBLaw t u : ℝ) := by + simp only [littleMass, Rat.cast_mul, Rat.cast_ofNat] + + theorem initial_history_sum (K : ℕ) (f : Shape → ℝ) : + (∑ h : Initial K, (initialAmount h : ℝ) * f (initialShape h)) = + (K : ℝ) * (sortedInitial.map (fun g => (initialLaw g : ℝ) * f g)).sum := by + simp only [Fintype.sum_prod_type, initialAmount, initialShape, List.get_eq_getElem] + simp_rw [Fin.sum_univ_fun_getElem sortedInitial (fun g => (initialLaw g : ℝ) * f g)] + simp only [Finset.sum_const, Finset.card_univ, Fintype.card_fin, nsmul_eq_mul] + +theorem initial_positive_sum (K : ℕ) (f : Shape → ℝ) : + (∑ h : InitialPositive K, f (initialShape h.val)) = + (K : ℝ) * (positiveInitial.map f).sum := by + rw [subtype_sum_indicator_inline_MatrixMultiplication_AllFieldHistorySums (fun h : Initial K => initialShape h ∈ positiveInitial) + (fun h => f (initialShape h))] + change (∑ history : Initial K, + if sortedInitial[history.2.val] ∈ positiveInitial then f sortedInitial[history.2.val] else 0) = _ + simp only [Fintype.sum_prod_type] + simp_rw [Fin.sum_univ_fun_getElem sortedInitial + (fun g => if g ∈ positiveInitial then f g else 0)] + simp only [Finset.sum_const, Finset.card_univ, Fintype.card_fin, nsmul_eq_mul] + apply congrArg (fun r : ℝ => (K : ℝ) * r) + change _ = ((sortedInitial.filter positive).map f).sum + rw [list_filter_sum_inline_MatrixMultiplication_AllFieldHistorySums] + apply list_sum_congr + intro g hg + simp only [positiveInitial, List.mem_filter, hg, true_and] + +private theorem stageA_parent_sum : ∀ g ∈ positiveInitial, g 0 + g 1 + g 2 = 16 := by + decide +kernel + +private theorem stageA_extend_sum (g : Shape) (hg : g ∈ positiveInitial) + (f : Shape → ℝ) : + ((below g).map (fun t => (stageALaw g t : ℝ) * f t)).sum = + ((shapes 8).map (fun t => (stageALaw g t : ℝ) * f t)).sum := by + have he : below g = (shapes 8).filter + (fun t => t 0 ≤ g 0 && t 1 ≤ g 1 && t 2 ≤ g 2) := by + simp only [below, stageA_parent_sum g hg] + rw [he, list_filter_sum_inline_MatrixMultiplication_AllFieldHistorySums] + apply list_sum_congr + intro t ht + by_cases hb : (t 0 ≤ g 0 && t 1 ≤ g 1 && t 2 ≤ g 2) = true + · simp only [hb, ite_true] + · have hnot : t ∉ below g := by rw [he]; simp [hb] + have hz : stageALaw g t = 0 := splitLaw_outside_support _ _ g t hnot + simp [hb, hz] + + theorem a_parent_history_sum {K : ℕ} (h : InitialPositive K) (f : Shape → ℝ) : + (∑ p : ASplit h × Bool, (aAmount ⟨h, p⟩ : ℝ) * f (aShape ⟨h, p⟩)) = + 2 * (initialAmount h.val : ℝ) * + ((below (initialShape h.val)).map + (fun t => (stageALaw (initialShape h.val) t : ℝ) * f t)).sum := by + simp only [Fintype.sum_prod_type, Fintype.sum_bool, aAmount, aShape, aSplit, + halfShape, Bool.false_eq_true, ite_false, ite_true, Rat.cast_mul, + List.get_eq_getElem] + simp only [mul_assoc, Finset.sum_add_distrib, ← Finset.mul_sum] + rw [Fin.sum_univ_fun_getElem (below (initialShape h.val)) + (fun t => (stageALaw (initialShape h.val) t : ℝ) * + f (complement (initialShape h.val) t)), + Fin.sum_univ_fun_getElem (below (initialShape h.val)) + (fun t => (stageALaw (initialShape h.val) t : ℝ) * f t), + stageA_complement_sum _ h.property] + ring + + theorem a_history_sum_parents (K : ℕ) (f : Shape → ℝ) : + (∑ h : AfterA K, (aAmount h : ℝ) * f (aShape h)) = + (K : ℝ) * (positiveInitial.map (fun g => 2 * (initialLaw g : ℝ) * + ((below g).map (fun t => (stageALaw g t : ℝ) * f t)).sum)).sum := by + rw [Fintype.sum_sigma] + simp only [a_parent_history_sum, initialAmount] + exact initial_positive_sum K (fun g => 2 * (initialLaw g : ℝ) * + ((below g).map (fun t => (stageALaw g t : ℝ) * f t)).sum) + + theorem a_history_sum (K : ℕ) (f : Shape → ℝ) : + (∑ h : AfterA K, (aAmount h : ℝ) * f (aShape h)) = + (K : ℝ) * ((shapes 8).map (fun t => (secondMass t : ℝ) * f t)).sum := by + rw [a_history_sum_parents] + apply congrArg (fun r : ℝ => (K : ℝ) * r) + calc + _ = (positiveInitial.map (fun g => ((shapes 8).map + (fun t => 2 * (initialLaw g : ℝ) * ((stageALaw g t : ℝ) * f t))).sum)).sum := by + apply list_sum_congr + intro g hg + rw [stageA_extend_sum g hg, List.sum_map_mul_left] + _ = ((shapes 8).map (fun t => (positiveInitial.map + (fun g => 2 * (initialLaw g : ℝ) * ((stageALaw g t : ℝ) * f t))).sum)).sum := + list_sum_comm _ _ _ + _ = _ := by + apply list_sum_congr + intro t _ + rw [secondMass_cast] + calc + _ = (positiveInitial.map + (fun g => 2 * ((initialLaw g : ℝ) * (stageALaw g t : ℝ)) * f t)).sum := by + apply list_sum_congr + intro g _ + ring + _ = _ := by rw [List.sum_map_mul_right, List.sum_map_mul_left] + + theorem a_positive_history_sum (K : ℕ) (f : Shape → ℝ) : + (∑ h : APositive K, (aAmount h.val : ℝ) * f (aShape h.val)) = + (K : ℝ) * (positiveSecond.map (fun t => (secondMass t : ℝ) * f t)).sum := by + rw [subtype_sum_indicator_inline_MatrixMultiplication_AllFieldHistorySums (fun h : AfterA K => aShape h ∈ positiveSecond) + (fun h => (aAmount h : ℝ) * f (aShape h))] + trans ∑ h : AfterA K, (aAmount h : ℝ) * + (if aShape h ∈ positiveSecond then f (aShape h) else 0) + · apply Finset.sum_congr rfl + intro h _ + split_ifs <;> simp_all + rw [a_history_sum K (fun t => if t ∈ positiveSecond then f t else 0)] + apply congrArg (fun r : ℝ => (K : ℝ) * r) + change _ = (((shapes 8).filter positive).map + (fun t => (secondMass t : ℝ) * f t)).sum + rw [list_filter_sum_inline_MatrixMultiplication_AllFieldHistorySums] + apply list_sum_congr + intro t ht + simp only [positiveSecond, List.mem_filter, ht, true_and] + split_ifs <;> simp_all + + theorem b_parent_history_sum {K : ℕ} (h : APositive K) (f : Shape → ℝ) : + (∑ p : BSplit h × Bool, (bAmount ⟨h, p⟩ : ℝ) * f (bShape ⟨h, p⟩)) = + 2 * (aAmount h.val : ℝ) * + ((below (aShape h.val)).map + (fun u => (stageBLaw (aShape h.val) u : ℝ) * f u)).sum := by + simp only [Fintype.sum_prod_type, Fintype.sum_bool, bAmount, bShape, bSplit, + halfShape, Bool.false_eq_true, ite_false, ite_true, Rat.cast_mul, + List.get_eq_getElem] + simp only [mul_assoc, Finset.sum_add_distrib, ← Finset.mul_sum] + rw [Fin.sum_univ_fun_getElem (below (aShape h.val)) + (fun u => (stageBLaw (aShape h.val) u : ℝ) * + f (complement (aShape h.val) u)), + Fin.sum_univ_fun_getElem (below (aShape h.val)) + (fun u => (stageBLaw (aShape h.val) u : ℝ) * f u), + stageB_complement_sum _ h.property] + ring + + theorem b_history_sum (K : ℕ) (f : Shape → Shape → ℝ) : + (∑ h : AfterB K, (bAmount h : ℝ) * f (aShape h.1.val) (bShape h)) = + (K : ℝ) * (positiveSecond.map (fun t => + ((below t).map (fun u => (littleMass t u : ℝ) * f t u)).sum)).sum := by + rw [Fintype.sum_sigma] + simp only [b_parent_history_sum] + have he : (∑ h : APositive K, 2 * (aAmount h.val : ℝ) * + ((below (aShape h.val)).map + (fun u => (stageBLaw (aShape h.val) u : ℝ) * f (aShape h.val) u)).sum) = + ∑ h : APositive K, (aAmount h.val : ℝ) * + (2 * ((below (aShape h.val)).map + (fun u => (stageBLaw (aShape h.val) u : ℝ) * f (aShape h.val) u)).sum) := by + apply Finset.sum_congr rfl + intro h _ + ring + rw [he, a_positive_history_sum K (fun t => + 2 * ((below t).map (fun u => (stageBLaw t u : ℝ) * f t u)).sum)] + apply congrArg (fun r : ℝ => (K : ℝ) * r) + apply list_sum_congr + intro t _ + calc + _ = 2 * (secondMass t : ℝ) * + ((below t).map (fun u => (stageBLaw t u : ℝ) * f t u)).sum := by ring + _ = _ := by + rw [← List.sum_map_mul_left] + apply list_sum_congr + intro u _ + rw [littleMass_cast] + ring + + theorem b_positive_history_sum (K : ℕ) (f : Shape → Shape → ℝ) : + (∑ h : BPositive K, (bAmount h.val : ℝ) * + f (aShape h.val.1.val) (bShape h.val)) = + (K : ℝ) * (positiveSecond.map (fun t => + (((below t).filter positive).map + (fun u => (littleMass t u : ℝ) * f t u)).sum)).sum := by + rw [subtype_sum_indicator_inline_MatrixMultiplication_AllFieldHistorySums (fun h : AfterB K => positive (bShape h) = true) + (fun h => (bAmount h : ℝ) * f (aShape h.1.val) (bShape h))] + trans ∑ h : AfterB K, (bAmount h : ℝ) * + (if positive (bShape h) then f (aShape h.1.val) (bShape h) else 0) + · apply Finset.sum_congr rfl + intro h _ + split_ifs <;> simp_all + rw [b_history_sum K (fun t u => if positive u then f t u else 0)] + apply congrArg (fun r : ℝ => (K : ℝ) * r) + apply list_sum_congr + intro t _ + rw [list_filter_sum_inline_MatrixMultiplication_AllFieldHistorySums] + apply list_sum_congr + intro u _ + split_ifs <;> simp_all + +end MatrixMultiplication.AllFieldHistory + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/Histories/InheritedMaskMargins.lean b/lean/OAI/LinearAlgebra/MatrixFields/Histories/InheritedMaskMargins.lean new file mode 100644 index 0000000000000000000000000000000000000000..2d54b5f126580278ebcb4beb2c8698495db2c0e7 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/Histories/InheritedMaskMargins.lean @@ -0,0 +1,1479 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Construction.CompleteWordPair +import OAI.LinearAlgebra.MatrixFields.Entropy.FiniteAverage +import OAI.LinearAlgebra.MatrixFields.Extraction.JointPairClassWindows +import OAI.LinearAlgebra.MatrixFields.Histories.InverseLinearRecovery + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +namespace MatrixMultiplication.InheritedMasks + +open MatrixMultiplication.Foundation +open scoped BigOperators + +section ClassWords + +variable {C : Type*} (P A : C → Type*) + [∀ c, Fintype (P c)] [∀ c, DecidableEq (P c)] + [∀ c, Fintype (A c)] [∀ c, DecidableEq (A c)] + +abbrev ClassWords := ∀ c, P c → A c + +def SameClassOrbit (w v : ClassWords P A) : Prop := + ∃ e : ∀ c, Equiv.Perm (P c), ∀ c, w c ∘ e c = v c + +omit [∀ c, DecidableEq (P c)] [∀ c, Fintype (A c)] in +theorem sameClassOrbit_iff (w v : ClassWords P A) : + SameClassOrbit P A w v ↔ + ∀ c a, wordPopulation (v c) a = wordPopulation (w c) a := by + constructor + · rintro ⟨e, he⟩ c a + rw [← he c] + exact wordPopulation_reindex (w c) (e c) a + · intro h + have he : ∀ c, ∃ e : Equiv.Perm (P c), w c ∘ e = v c := + fun c => (samePopulation_iff_permutation (w c) (v c)).mp (h c) + choose e he using he + exact ⟨e, he⟩ + +abbrev Profile := ∀ c, A c → Fin (Fintype.card (P c) + 1) + +noncomputable def profile (w : ClassWords P A) : Profile P A := + fun c a => ⟨wordPopulation (w c) a, + Nat.lt_succ_of_le (Fintype.card_subtype_le _)⟩ + +omit [∀ c, DecidableEq (P c)] [∀ c, Fintype (A c)] in +theorem profile_eq_iff (w v : ClassWords P A) : + profile P A w = profile P A v ↔ SameClassOrbit P A w v := by + rw [sameClassOrbit_iff] + constructor + · intro h c a + have hh := congrArg (fun f : Profile P A => (f c a).val) h + exact hh.symm + · intro h + funext c a + apply Fin.ext + exact (h c a).symm + +omit [∀ c, DecidableEq (P c)] in +theorem card_profile [Fintype C] [DecidableEq C] : + Fintype.card (Profile P A) = + ∏ c, (Fintype.card (P c) + 1) ^ Fintype.card (A c) := by + simp [Profile, Fintype.card_pi] + +end ClassWords + +section TensorAction + +variable {F C : Type*} [CommSemiring F] [Fintype C] + {P X Y Z : C → Type*} [∀ c, Fintype (P c)] + +def classProduct (T : ∀ c, Tensor F (X c) (Y c) (Z c)) : + Tensor F (∀ c, P c → X c) (∀ c, P c → Y c) (∀ c, P c → Z c) := + fun x y z => ∏ c, ∏ i, T c (x c i) (y c i) (z c i) + +theorem classProduct_permutation + (T : ∀ c, Tensor F (X c) (Y c) (Z c)) + (e : ∀ c, Equiv.Perm (P c)) + (x : ∀ c, P c → X c) (y : ∀ c, P c → Y c) (z : ∀ c, P c → Z c) : + classProduct T (fun c => x c ∘ e c) (fun c => y c ∘ e c) + (fun c => z c ∘ e c) = classProduct T x y z := by + apply Finset.prod_congr rfl + intro c _ + exact Equiv.prod_comp (e c) (fun i => T c (x c i) (y c i) (z c i)) + +end TensorAction + +theorem statisticPopulation_permutation {P A B : Type*} + [Fintype P] [DecidableEq P] [Fintype B] [DecidableEq B] + (w : P → A) (statistic : A → B) (e : Equiv.Perm P) (b : B) : + wordPopulation (statistic ∘ w ∘ e) b = wordPopulation (statistic ∘ w) b := + wordPopulation_reindex (statistic ∘ w) e b + +section EmpiricalWindows + +variable {P A B : Type*} [Fintype P] [DecidableEq P] + [Fintype A] [DecidableEq A] [Fintype B] [DecidableEq B] + +noncomputable def empiricalLaw (w : P → A) (a : A) : ℝ := + (wordPopulation w a : ℝ) / Fintype.card P + +def typeWindow (ν : A → ℝ) (η : ℝ) (w : P → A) : Prop := + ∀ a, |empiricalLaw w a - ν a| ≤ η + +omit [DecidableEq P] [Fintype A] in +theorem typeWindow_permutation (ν : A → ℝ) (η : ℝ) (w : P → A) + (e : Equiv.Perm P) : typeWindow ν η (w ∘ e) ↔ typeWindow ν η w := by + simp [typeWindow, empiricalLaw, wordPopulation_reindex] + +omit [DecidableEq P] [Fintype A] [Fintype B] in +theorem wordPopulation_equiv (w : P → A) (e : A ≃ B) (a : A) : + wordPopulation (e ∘ w) (e a) = wordPopulation w a := by + apply Fintype.card_congr + exact Equiv.subtypeEquivRight fun i => e.injective.eq_iff + +omit [DecidableEq P] [Fintype A] [Fintype B] in +theorem typeWindow_equiv (ν : A → ℝ) (η : ℝ) (w : P → A) (e : A ≃ B) : + typeWindow (ν ∘ e.symm) η (e ∘ w) ↔ typeWindow ν η w := by + constructor + · intro h a + have hh := h (e a) + simpa [empiricalLaw, wordPopulation_equiv] using hh + · intro h b + obtain ⟨a, rfl⟩ := e.surjective b + simpa [empiricalLaw, wordPopulation_equiv] using h a + +end EmpiricalWindows + +section Windows + +variable {I : Type*} [Fintype I] + +theorem weighted_window (w x : I → ℝ) (μ η : ℝ) + (hw : ∀ i, 0 ≤ w i) (hsum : ∑ i, w i = 1) + (hx : ∀ i, |x i - μ| ≤ η) : + |(∑ i, w i * x i) - μ| ≤ η := by + have heq : (∑ i, w i * x i) - μ = ∑ i, w i * (x i - μ) := by + simp only [mul_sub, Finset.sum_sub_distrib, ← Finset.sum_mul, hsum, one_mul] + rw [heq] + calc + |∑ i, w i * (x i - μ)| ≤ ∑ i, |w i * (x i - μ)| := + Finset.abs_sum_le_sum_abs _ _ + _ = ∑ i, w i * |x i - μ| := by + apply Finset.sum_congr rfl + intro i _ + rw [abs_mul, abs_of_nonneg (hw i)] + _ ≤ ∑ i, w i * η := Finset.sum_le_sum fun i _ => mul_le_mul_of_nonneg_left (hx i) (hw i) + _ = η := by rw [← Finset.sum_mul, hsum, one_mul] + +theorem product_coordinate_error {a b a' b' τ : ℝ} + (ha : 0 ≤ a) (ha1 : a ≤ 1) (hb' : 0 ≤ b') (hb1' : b' ≤ 1) + (hea : |a - a'| ≤ τ) (heb : |b - b'| ≤ τ) : + |a * b - a' * b'| ≤ 2 * τ := by + have ht : 0 ≤ τ := le_trans (abs_nonneg _) hea + have heq : a * b - a' * b' = a * (b - b') + (a - a') * b' := by ring + rw [heq] + calc + |a * (b - b') + (a - a') * b'| ≤ |a * (b - b')| + |(a - a') * b'| := abs_add_le _ _ + _ = a * |b - b'| + |a - a'| * b' := by rw [abs_mul, abs_mul, abs_of_nonneg ha, abs_of_nonneg hb'] + _ ≤ a * τ + τ * b' := add_le_add + (mul_le_mul_of_nonneg_left heb ha) (mul_le_mul_of_nonneg_right hea hb') + _ ≤ 2 * τ := by nlinarith + +theorem inherited_margin {actual expected prescribed η τ α : ℝ} + (hchild : |expected - prescribed| ≤ 2 * τ) + (happrox : |actual - expected| ≤ α) + (hτ : τ ≤ η / 8) (hα : α ≤ η / 4) : + |actual - prescribed| ≤ η / 2 := by + calc + |actual - prescribed| = |(actual - expected) + (expected - prescribed)| := by ring_nf + _ ≤ |actual - expected| + |expected - prescribed| := abs_add_le _ _ + _ ≤ α + 2 * τ := add_le_add happrox hchild + _ ≤ η / 2 := by linarith + +end Windows + +end MatrixMultiplication.InheritedMasks + +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +namespace MatrixMultiplication.InheritedMasks + +open MatrixMultiplication.Foundation +open scoped BigOperators + +section Pushforward + +variable {A B : Type*} [Fintype A] [DecidableEq A] [DecidableEq B] + +def pushforwardLaw (statistic : A → B) (ν : A → ℝ) (b : B) : ℝ := + ∑ a with statistic a = b, ν a + +omit [DecidableEq A] in +theorem pushforwardLaw_nonneg (statistic : A → B) (ν : A → ℝ) + (hν : ∀ a, 0 ≤ ν a) (b : B) : 0 ≤ pushforwardLaw statistic ν b := by + exact Finset.sum_nonneg fun a _ => hν a + +omit [DecidableEq A] in +theorem pushforwardLaw_le_one (statistic : A → B) (ν : A → ℝ) + (hν : ∀ a, 0 ≤ ν a) (hsum : ∑ a, ν a = 1) (b : B) : + pushforwardLaw statistic ν b ≤ 1 := by + calc + pushforwardLaw statistic ν b ≤ ∑ a, ν a := + Finset.sum_le_sum_of_subset_of_nonneg (Finset.filter_subset _ _) + (fun a _ _ => hν a) + _ = 1 := hsum + +end Pushforward + +section Windows + +variable {P A B : Type*} [Fintype P] [DecidableEq P] + [Fintype A] [DecidableEq A] [Fintype B] [DecidableEq B] + +omit [DecidableEq P] [Fintype B] in +theorem wordPopulation_statistic (w : P → A) (statistic : A → B) (b : B) : + wordPopulation (statistic ∘ w) b = + ∑ a with statistic a = b, wordPopulation w a := by + simpa only [wordPopulation, Fintype.card_subtype, Finset.mem_filter, + Finset.mem_univ, true_and, Function.comp_apply] using + (Finset.sum_card_fiberwise_eq_card_filter (Finset.univ : Finset P) + (Finset.univ.filter fun a => statistic a = b) w).symm + +omit [DecidableEq P] [Fintype B] in +theorem empiricalLaw_statistic (w : P → A) (statistic : A → B) (b : B) : + empiricalLaw (statistic ∘ w) b = + pushforwardLaw statistic (empiricalLaw w) b := by + simp only [empiricalLaw, wordPopulation_statistic, pushforwardLaw, + Nat.cast_sum, Finset.sum_div] + +omit [DecidableEq P] [Fintype A] in +theorem typeWindow_mono (ν : A → ℝ) (w : P → A) {τ η : ℝ} + (hτη : τ ≤ η) (hw : typeWindow ν τ w) : typeWindow ν η w := by + intro a + exact (hw a).trans hτη + +omit [DecidableEq P] [Fintype B] in +theorem typeWindow_statistic_coordinate (ν : A → ℝ) (τ : ℝ) (w : P → A) + (statistic : A → B) (hw : typeWindow ν τ w) (b : B) : + |empiricalLaw (statistic ∘ w) b - pushforwardLaw statistic ν b| ≤ + ((Finset.univ.filter fun a => statistic a = b).card : ℝ) * τ := by + rw [empiricalLaw_statistic] + unfold pushforwardLaw + rw [← Finset.sum_sub_distrib] + calc + _ ≤ ∑ a with statistic a = b, |empiricalLaw w a - ν a| := + Finset.abs_sum_le_sum_abs _ _ + _ ≤ ∑ _a ∈ Finset.univ.filter (fun a => statistic a = b), τ := + Finset.sum_le_sum fun a _ => hw a + _ = _ := by simp only [Finset.sum_const, nsmul_eq_mul] + +omit [DecidableEq P] [Fintype B] in +theorem typeWindow_statistic (ν : A → ℝ) (τ : ℝ) (w : P → A) + (statistic : A → B) (hτ : 0 ≤ τ) (hw : typeWindow ν τ w) : + typeWindow (pushforwardLaw statistic ν) (Fintype.card A * τ) + (statistic ∘ w) := by + intro b + calc + _ ≤ ((Finset.univ.filter fun a => statistic a = b).card : ℝ) * τ := + typeWindow_statistic_coordinate ν τ w statistic hw b + _ ≤ Fintype.card A * τ := + mul_le_mul_of_nonneg_right (Nat.cast_le.mpr (Finset.card_le_univ _)) hτ + +end Windows + +end MatrixMultiplication.InheritedMasks + +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +open scoped BigOperators +open MatrixMultiplication.Foundation +open MatrixMultiplication.PermutationMatching +open MatrixMultiplication.InheritedMasks + +namespace MatrixMultiplication.HistorySymmetry + +variable {C : Type*} {P X Y : C → Type*} + +def completeWordPairEquiv : CompleteWordPair P X Y ≃ + ((∀ c, P c → X c) × (∀ c, P c → Y c)) where + toFun w := (w.left, w.right) + invFun w := ⟨w.1, w.2⟩ + left_inv _ := rfl + right_inv _ := rfl + +noncomputable instance completeWordPairFintype + [Fintype C] [DecidableEq C] [∀ c, Fintype (P c)] [∀ c, DecidableEq (P c)] + [∀ c, Fintype (X c)] [∀ c, Fintype (Y c)] : Fintype (CompleteWordPair P X Y) := + Fintype.ofEquiv _ completeWordPairEquiv.symm + +theorem card_completeWordPair + [Fintype C] [DecidableEq C] [∀ c, Fintype (P c)] [∀ c, DecidableEq (P c)] + [∀ c, Fintype (X c)] [∀ c, Fintype (Y c)] : + Fintype.card (CompleteWordPair P X Y) = + (∏ c, Fintype.card (X c) ^ Fintype.card (P c)) * + ∏ c, Fintype.card (Y c) ^ Fintype.card (P c) := by + rw [Fintype.card_congr completeWordPairEquiv] + simp + +section Coefficients + +variable {K : Type*} [CommSemiring K] [Fintype C] [∀ c, Fintype (P c)] + {XL YL ZL XR YR ZR : C → Type*} + +def pairClassProduct + (TL : ∀ c, Tensor K (XL c) (YL c) (ZL c)) + (TR : ∀ c, Tensor K (XR c) (YR c) (ZR c)) : + Tensor K (CompleteWordPair P XL XR) (CompleteWordPair P YL YR) (CompleteWordPair P ZL ZR) := + fun x y z => classProduct TL x.left y.left z.left * classProduct TR x.right y.right z.right + +theorem pairClassProduct_smul + (TL : ∀ c, Tensor K (XL c) (YL c) (ZL c)) + (TR : ∀ c, Tensor K (XR c) (YR c) (ZR c)) + (g : HalfClassPermutations P) + (x : CompleteWordPair P XL XR) (y : CompleteWordPair P YL YR) + (z : CompleteWordPair P ZL ZR) : + pairClassProduct TL TR (g • x) (g • y) (g • z) = pairClassProduct TL TR x y z := by + change classProduct TL (fun c => x.left c ∘ (g.1 c).symm) + (fun c => y.left c ∘ (g.1 c).symm) (fun c => z.left c ∘ (g.1 c).symm) * + classProduct TR (fun c => x.right c ∘ (g.2 c).symm) + (fun c => y.right c ∘ (g.2 c).symm) (fun c => z.right c ∘ (g.2 c).symm) = _ + rw [classProduct_permutation, classProduct_permutation] + rfl + +end Coefficients + +section Windows + +variable [Fintype C] [∀ c, Fintype (P c)] [∀ c, DecidableEq (P c)] + {SL SR : C → Type*} [∀ c, Fintype (SL c)] [∀ c, Fintype (SR c)] + [∀ c, DecidableEq (SL c)] [∀ c, DecidableEq (SR c)] + +def childWindows (sl : ∀ c, X c → SL c) (sr : ∀ c, Y c → SR c) + (νl : ∀ c, SL c → ℝ) (νr : ∀ c, SR c → ℝ) (ηl ηr : C → ℝ) + (w : CompleteWordPair P X Y) : Prop := + ∀ c, typeWindow (νl c) (ηl c) (sl c ∘ w.left c) ∧ + typeWindow (νr c) (ηr c) (sr c ∘ w.right c) + +omit [Fintype C] [∀ c, DecidableEq (P c)] [∀ c, Fintype (SL c)] + [∀ c, Fintype (SR c)] in +theorem childWindows_smul + (sl : ∀ c, X c → SL c) (sr : ∀ c, Y c → SR c) + (νl : ∀ c, SL c → ℝ) (νr : ∀ c, SR c → ℝ) (ηl ηr : C → ℝ) + (g : HalfClassPermutations P) (w : CompleteWordPair P X Y) : + childWindows sl sr νl νr ηl ηr (g • w) ↔ childWindows sl sr νl νr ηl ηr w := by + unfold childWindows + change (∀ c, typeWindow (νl c) (ηl c) ((sl c ∘ w.left c) ∘ (g.1 c).symm) ∧ + typeWindow (νr c) (ηr c) ((sr c ∘ w.right c) ∘ (g.2 c).symm)) ↔ _ + simp only [typeWindow_permutation] + +end Windows + +theorem delete_invariant {K G U V W : Type*} [CommSemiring K] [Group G] + [MulAction G U] [MulAction G V] [MulAction G W] + (Q : Tensor K U V W) (px : U → Prop) (py : V → Prop) (pz : W → Prop) + [DecidablePred px] [DecidablePred py] [DecidablePred pz] + (hQ : ∀ (g : G) x y z, Q (g • x) (g • y) (g • z) = Q x y z) + (hx : ∀ (g : G) x, px (g • x) ↔ px x) + (hy : ∀ (g : G) y, py (g • y) ↔ py y) + (hz : ∀ (g : G) z, pz (g • z) ↔ pz z) + (g : G) (x : U) (y : V) (z : W) : + ExactRecovery.delete Q px py pz (g • x) (g • y) (g • z) = + ExactRecovery.delete Q px py pz x y z := by + simp only [ExactRecovery.delete, hx, hy, hz, hQ] + +theorem delete_used_left {K U V W : Type*} [CommSemiring K] + (Q : Tensor K U V W) (px : U → Prop) (py : V → Prop) (pz : W → Prop) + [DecidablePred px] [DecidablePred py] [DecidablePred pz] (x : U) + (h : ∃ y z, ExactRecovery.delete Q px py pz x y z ≠ 0) : px x := by + obtain ⟨y, z, h⟩ := h + by_contra hn + simp [ExactRecovery.delete, hn] at h + +theorem delete_used_middle {K U V W : Type*} [CommSemiring K] + (Q : Tensor K U V W) (px : U → Prop) (py : V → Prop) (pz : W → Prop) + [DecidablePred px] [DecidablePred py] [DecidablePred pz] (y : V) + (h : ∃ x z, ExactRecovery.delete Q px py pz x y z ≠ 0) : py y := by + obtain ⟨x, z, h⟩ := h + by_contra hn + simp [ExactRecovery.delete, hn] at h + +theorem delete_used_right {K U V W : Type*} [CommSemiring K] + (Q : Tensor K U V W) (px : U → Prop) (py : V → Prop) (pz : W → Prop) + [DecidablePred px] [DecidablePred py] [DecidablePred pz] (z : W) + (h : ∃ x y, ExactRecovery.delete Q px py pz x y z ≠ 0) : pz z := by + obtain ⟨x, y, h⟩ := h + by_contra hn + simp [ExactRecovery.delete, hn] at h + +end MatrixMultiplication.HistorySymmetry + +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section + +namespace MatrixMultiplication.PermutationMatching + +open scoped BigOperators + +variable {P : Type*} [DecidableEq P] + +def membership (B : Finset P) (p : Equiv.Perm P) (i : P) : ℝ := + if p i ∈ B then 1 else 0 + +@[simp] theorem membership_sq (B : Finset P) (p : Equiv.Perm P) (i : P) : + membership B p i * membership B p i = membership B p i := by + simp only [membership] + split_ifs <;> norm_num + +theorem membership_nonneg (B : Finset P) (p : Equiv.Perm P) (i : P) : + 0 ≤ membership B p i := by + simp only [membership] + split_ifs <;> norm_num + +theorem membership_le_one (B : Finset P) (p : Equiv.Perm P) (i : P) : + membership B p i ≤ 1 := by + simp only [membership] + split_ifs <;> norm_num + +variable [Fintype P] + +theorem sum_membership (B : Finset P) (p : Equiv.Perm P) : + (∑ i : P, membership B p i) = (B.card : ℝ) := by + unfold membership + rw [Equiv.sum_comp p (fun i => if i ∈ B then (1 : ℝ) else 0)] + simp + +theorem sum_perm_right (f : Equiv.Perm P → ℝ) (q : Equiv.Perm P) : + (∑ p : Equiv.Perm P, f (p * q)) = ∑ p : Equiv.Perm P, f p := by + exact Equiv.sum_comp (Equiv.mulRight q) f + +theorem sum_membership_position_eq (B : Finset P) (i j : P) : + (∑ p : Equiv.Perm P, membership B p i) = + ∑ p : Equiv.Perm P, membership B p j := by + calc + _ = ∑ p : Equiv.Perm P, membership B (p * Equiv.swap i j) j := by + simp [membership, Equiv.Perm.mul_apply] + _ = _ := sum_perm_right (fun p => membership B p j) _ + +theorem card_mul_sum_membership (B : Finset P) (i : P) : + (Fintype.card P : ℝ) * (∑ p : Equiv.Perm P, membership B p i) = + (Fintype.card (Equiv.Perm P) : ℝ) * B.card := by + calc + _ = ∑ j : P, ∑ p : Equiv.Perm P, membership B p i := by simp + _ = ∑ j : P, ∑ p : Equiv.Perm P, membership B p j := by + apply Finset.sum_congr rfl + intro j _ + exact sum_membership_position_eq B i j + _ = ∑ p : Equiv.Perm P, ∑ j : P, membership B p j := Finset.sum_comm + _ = _ := by simp [sum_membership] + +theorem average_membership [Nonempty P] (B : Finset P) (i : P) : + average (fun p : Equiv.Perm P => membership B p i) = + (B.card : ℝ) / Fintype.card P := by + have hn : (Fintype.card P : ℝ) ≠ 0 := by + exact_mod_cast Fintype.card_ne_zero + have hp : (Fintype.card (Equiv.Perm P) : ℝ) ≠ 0 := by + exact_mod_cast Fintype.card_ne_zero + unfold average + apply (div_eq_div_iff hp hn).2 + simpa only [mul_comm] using card_mul_sum_membership B i + +theorem sum_membership_mul_position_eq (B : Finset P) {i j k : P} + (hij : i ≠ j) (hik : i ≠ k) : + (∑ p : Equiv.Perm P, membership B p i * membership B p j) = + ∑ p : Equiv.Perm P, membership B p i * membership B p k := by + calc + _ = ∑ p : Equiv.Perm P, + membership B (p * Equiv.swap j k) i * + membership B (p * Equiv.swap j k) k := by + simp [membership, Equiv.Perm.mul_apply, + Equiv.swap_apply_of_ne_of_ne hij hik] + _ = _ := sum_perm_right (fun p => membership B p i * membership B p k) _ + +theorem card_sub_one_mul_sum_membership_mul (B : Finset P) {i j : P} + (hij : i ≠ j) : + ((Fintype.card P : ℝ) - 1) * + (∑ p : Equiv.Perm P, membership B p i * membership B p j) = + ((B.card : ℝ) - 1) * (∑ p : Equiv.Perm P, membership B p i) := by + have hcard : (((Finset.univ : Finset P).erase i).card : ℝ) = + (Fintype.card P : ℝ) - 1 := by + have h := congrArg (fun n : ℕ => (n : ℝ)) + (Finset.card_erase_add_one (Finset.mem_univ i)) + simp only [Nat.cast_add, Nat.cast_one, Finset.card_univ] at h + linarith + have herase : + (∑ k ∈ (Finset.univ : Finset P).erase i, + ∑ p : Equiv.Perm P, membership B p i * membership B p k) = + ((Fintype.card P : ℝ) - 1) * + (∑ p : Equiv.Perm P, membership B p i * membership B p j) := by + calc + _ = ∑ k ∈ (Finset.univ : Finset P).erase i, + ∑ p : Equiv.Perm P, membership B p i * membership B p j := by + apply Finset.sum_congr rfl + intro k hk + exact sum_membership_mul_position_eq B (Finset.mem_erase.mp hk).1.symm hij + _ = _ := by simp only [Finset.sum_const, nsmul_eq_mul, hcard] + have htotal : + (∑ k : P, ∑ p : Equiv.Perm P, membership B p i * membership B p k) = + (B.card : ℝ) * (∑ p : Equiv.Perm P, membership B p i) := by + rw [Finset.sum_comm] + simp_rw [← Finset.mul_sum, sum_membership] + rw [← Finset.sum_mul, mul_comm] + have hsplit := Finset.sum_erase_add (Finset.univ : Finset P) + (fun k => ∑ p : Equiv.Perm P, membership B p i * membership B p k) + (Finset.mem_univ i) + rw [herase, htotal] at hsplit + simp only [membership_sq] at hsplit + nlinarith only [hsplit] + +theorem average_membership_mul_of_ne (B : Finset P) {i j : P} (hij : i ≠ j) : + average (fun p : Equiv.Perm P => membership B p i * membership B p j) = + (B.card : ℝ) * ((B.card : ℝ) - 1) / + ((Fintype.card P : ℝ) * ((Fintype.card P : ℝ) - 1)) := by + have hnlarge : 1 < Fintype.card P := Fintype.one_lt_card_iff.mpr ⟨i, j, hij⟩ + have hnlarge' : (1 : ℝ) < Fintype.card P := by exact_mod_cast hnlarge + have hn : (Fintype.card P : ℝ) ≠ 0 := by linarith + have hn1 : (Fintype.card P : ℝ) - 1 ≠ 0 := by linarith + have hp : (Fintype.card (Equiv.Perm P) : ℝ) ≠ 0 := by + exact_mod_cast Fintype.card_ne_zero + unfold average + apply (div_eq_div_iff hp (mul_ne_zero hn hn1)).2 + calc + _ = (Fintype.card P : ℝ) * (((Fintype.card P : ℝ) - 1) * + (∑ p : Equiv.Perm P, membership B p i * membership B p j)) := by ring + _ = (Fintype.card P : ℝ) * (((B.card : ℝ) - 1) * + (∑ p : Equiv.Perm P, membership B p i)) := by + rw [card_sub_one_mul_sum_membership_mul B hij] + _ = ((B.card : ℝ) - 1) * ((Fintype.card P : ℝ) * + (∑ p : Equiv.Perm P, membership B p i)) := by ring + _ = ((B.card : ℝ) - 1) * ((Fintype.card (Equiv.Perm P) : ℝ) * B.card) := by + rw [card_mul_sum_membership B i] + _ = _ := by ring + +end MatrixMultiplication.PermutationMatching + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section + +namespace MatrixMultiplication.PermutationMatching + +open scoped BigOperators + +variable {P : Type*} [Fintype P] [DecidableEq P] + +def matchingCount (A B : Finset P) (p : Equiv.Perm P) : ℝ := + ∑ i ∈ A, membership B p i + +theorem average_matchingCount [Nonempty P] (A B : Finset P) : + average (matchingCount A B) = + (A.card : ℝ) * (B.card : ℝ) / (Fintype.card P : ℝ) := by + unfold matchingCount + rw [average_finset_sum] + simp only [average_membership, Finset.sum_const, nsmul_eq_mul] + ring + +theorem average_matchingCount_sq [Nonempty P] (A B : Finset P) : + average (fun p => matchingCount A B p ^ 2) = + (A.card : ℝ) * (B.card : ℝ) / (Fintype.card P : ℝ) + + (A.card : ℝ) * ((A.card : ℝ) - 1) * (B.card : ℝ) * + ((B.card : ℝ) - 1) / + ((Fintype.card P : ℝ) * ((Fintype.card P : ℝ) - 1)) := by + let u : ℝ := (B.card : ℝ) / (Fintype.card P : ℝ) + let v : ℝ := (B.card : ℝ) * ((B.card : ℝ) - 1) / + ((Fintype.card P : ℝ) * ((Fintype.card P : ℝ) - 1)) + have hpair (i j : P) : + average (fun p => membership B p i * membership B p j) = + v + if i = j then u - v else 0 := by + by_cases hij : i = j + · subst j + simp only [membership_sq] + rw [average_membership] + dsimp [u] + ring + · rw [average_membership_mul_of_ne B hij] + simp [hij, v] + have hsq (p : Equiv.Perm P) : matchingCount A B p ^ 2 = + ∑ i ∈ A, ∑ j ∈ A, membership B p i * membership B p j := by + unfold matchingCount + rw [pow_two, Finset.sum_mul_sum] + simp_rw [hsq] + rw [average_finset_sum] + simp_rw [average_finset_sum, hpair] + have hinner (i : P) (hi : i ∈ A) : + (∑ j ∈ A, (v + (if i = j then u - v else 0))) = + (A.card : ℝ) * v + (u - v) := by + rw [Finset.sum_add_distrib] + simp [hi] + rw [Finset.sum_congr rfl hinner] + simp only [Finset.sum_const, nsmul_eq_mul] + dsimp [u, v] + ring + +theorem matchingCount_variance [Nonempty P] (A B : Finset P) + (hn : 2 ≤ Fintype.card P) : + average (fun p => (matchingCount A B p - average (matchingCount A B)) ^ 2) = + (A.card : ℝ) * ((Fintype.card P : ℝ) - (A.card : ℝ)) * + (B.card : ℝ) * ((Fintype.card P : ℝ) - (B.card : ℝ)) / + ((Fintype.card P : ℝ) ^ 2 * ((Fintype.card P : ℝ) - 1)) := by + rw [average_centered_sq, average_matchingCount_sq, average_matchingCount] + have hn' : (2 : ℝ) ≤ Fintype.card P := by exact_mod_cast hn + have hn0 : (Fintype.card P : ℝ) ≠ 0 := by linarith + have hn1 : (Fintype.card P : ℝ) - 1 ≠ 0 := by linarith + field_simp [hn0, hn1] + ring + +theorem matchingCount_variance_le (A B : Finset P) + (hn : 2 ≤ Fintype.card P) : + average (fun p => (matchingCount A B p - average (matchingCount A B)) ^ 2) ≤ + (Fintype.card P : ℝ) / 8 := by + have : Nonempty P := Fintype.card_pos_iff.mp (lt_of_lt_of_le (by decide : 0 < 2) hn) + rw [matchingCount_variance A B hn] + have hn' : (2 : ℝ) ≤ Fintype.card P := by exact_mod_cast hn + have ha : (A.card : ℝ) ≤ (Fintype.card P : ℝ) := by + exact_mod_cast Finset.card_le_univ A + have hb : (B.card : ℝ) ≤ (Fintype.card P : ℝ) := by + exact_mod_cast Finset.card_le_univ B + have ha0 : (0 : ℝ) ≤ A.card := Nat.cast_nonneg _ + have hb0 : (0 : ℝ) ≤ B.card := Nat.cast_nonneg _ + have hna : 0 ≤ (A.card : ℝ) * ((Fintype.card P : ℝ) - A.card) := + mul_nonneg ha0 (sub_nonneg.mpr ha) + have hnb : 0 ≤ (B.card : ℝ) * ((Fintype.card P : ℝ) - B.card) := + mul_nonneg hb0 (sub_nonneg.mpr hb) + have hqa : (A.card : ℝ) * ((Fintype.card P : ℝ) - A.card) ≤ + (Fintype.card P : ℝ) ^ 2 / 4 := by + nlinarith only [sq_nonneg ((A.card : ℝ) - (Fintype.card P : ℝ) / 2)] + have hqb : (B.card : ℝ) * ((Fintype.card P : ℝ) - B.card) ≤ + (Fintype.card P : ℝ) ^ 2 / 4 := by + nlinarith only [sq_nonneg ((B.card : ℝ) - (Fintype.card P : ℝ) / 2)] + have hprod := mul_le_mul hqa hqb hnb (by positivity : + (0 : ℝ) ≤ (Fintype.card P : ℝ) ^ 2 / 4) + have hn3 : 0 ≤ (Fintype.card P : ℝ) ^ 3 * ((Fintype.card P : ℝ) - 2) := + mul_nonneg (by positivity) (by linarith) + have hn1pos : (0 : ℝ) < (Fintype.card P : ℝ) - 1 := by linarith + have hnpos : (0 : ℝ) < Fintype.card P := by linarith + apply (div_le_iff₀ (show (0 : ℝ) < + (Fintype.card P : ℝ) ^ 2 * ((Fintype.card P : ℝ) - 1) by positivity)).mpr + nlinarith only [hprod, hn3] + +noncomputable def statisticPositions {A B : Type*} (w : P → A) + (statistic : A → B) (b : B) : Finset P := by + classical + exact Finset.univ.filter fun i => statistic (w i) = b + +noncomputable def statisticMatchingCount {A B S T : Type*} + (left : P → A) (right : P → B) (sl : A → S) (sr : B → T) + (s : S) (t : T) : Equiv.Perm P → ℝ := + matchingCount (statisticPositions left sl s) (statisticPositions right sr t) + +theorem statisticMatchingCount_variance_le {A B S T : Type*} + (left : P → A) (right : P → B) (sl : A → S) (sr : B → T) + (s : S) (t : T) (hn : 2 ≤ Fintype.card P) : + average (fun p => + (statisticMatchingCount left right sl sr s t p - + average (statisticMatchingCount left right sl sr s t)) ^ 2) ≤ + (Fintype.card P : ℝ) / 8 := + matchingCount_variance_le _ _ hn + +end MatrixMultiplication.PermutationMatching + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section + +namespace MatrixMultiplication.PermutationMatching + +open scoped BigOperators +open Classical + +variable {P : Type*} [Fintype P] [DecidableEq P] + +def twoHalfCount (A B : Finset P) (left right : Equiv.Perm P) : ℝ := + ∑ i : P, if left i ∈ A ∧ right i ∈ B then 1 else 0 + +theorem twoHalfCount_eq_matchingCount (A B : Finset P) + (left right : Equiv.Perm P) : + twoHalfCount A B left right = + matchingCount A B (left.symm.trans right) := by + classical + unfold twoHalfCount matchingCount membership + calc + _ = ∑ i : P, if i ∈ A ∧ right (left.symm i) ∈ B then (1 : ℝ) else 0 := by + simpa only [Equiv.symm_apply_apply] using + Equiv.sum_comp left (fun i => + if i ∈ A ∧ right (left.symm i) ∈ B then (1 : ℝ) else 0) + _ = ∑ i : P, if i ∈ A then + (if right (left.symm i) ∈ B then (1 : ℝ) else 0) else 0 := by + apply Finset.sum_congr rfl + intro i _ + split_ifs <;> simp_all + _ = _ := by + simp only [Equiv.trans_apply, Finset.sum_ite_mem_eq] + rfl + +def relativePairEquiv : + (Equiv.Perm P × Equiv.Perm P) ≃ (Equiv.Perm P × Equiv.Perm P) where + toFun lr := (lr.1, lr.1.symm.trans lr.2) + invFun lq := (lq.1, lq.1.trans lq.2) + left_inv := by + rintro ⟨left, right⟩ + dsimp only + apply Prod.ext + · rfl + · ext i + simp + right_inv := by + rintro ⟨left, relative⟩ + dsimp only + apply Prod.ext + · rfl + · ext i + simp + +theorem average_relativePerm (f : Equiv.Perm P → ℝ) : + average (fun lr : Equiv.Perm P × Equiv.Perm P => + f (lr.1.symm.trans lr.2)) = average f := by + calc + _ = average (fun lq : Equiv.Perm P × Equiv.Perm P => f lq.2) := + average_equiv relativePairEquiv (fun lq => f lq.2) + _ = _ := average_prod_snd f + +theorem average_twoHalfCount (A B : Finset P) (f : ℝ → ℝ) : + average (fun lr : Equiv.Perm P × Equiv.Perm P => + f (twoHalfCount A B lr.1 lr.2)) = + average (fun p : Equiv.Perm P => f (matchingCount A B p)) := by + simp_rw [twoHalfCount_eq_matchingCount] + exact average_relativePerm (fun p => f (matchingCount A B p)) + +theorem twoHalfCount_statisticPositions {X Y S T : Type*} + (leftWord : P → X) (rightWord : P → Y) (sl : X → S) (sr : Y → T) + (s : S) (t : T) (left right : Equiv.Perm P) : + twoHalfCount (statisticPositions leftWord sl s) + (statisticPositions rightWord sr t) left right = + ∑ i : P, if sl (leftWord (left i)) = s ∧ sr (rightWord (right i)) = t + then (1 : ℝ) else 0 := by + classical + simp [twoHalfCount, statisticPositions] + +section Families + +variable {C : Type*} (Q : C → Type*) + +def relativeFamily + (left right : ∀ c, Equiv.Perm (Q c)) : ∀ c, Equiv.Perm (Q c) := + fun c => (left c).symm.trans (right c) + +def relativeFamilyPairEquiv : + ((∀ c, Equiv.Perm (Q c)) × (∀ c, Equiv.Perm (Q c))) ≃ + ((∀ c, Equiv.Perm (Q c)) × (∀ c, Equiv.Perm (Q c))) where + toFun lr := (lr.1, relativeFamily Q lr.1 lr.2) + invFun lq := (lq.1, fun c => (lq.1 c).trans (lq.2 c)) + left_inv := by + rintro ⟨left, right⟩ + dsimp only + apply Prod.ext + · rfl + · funext c + ext i + simp [relativeFamily] + right_inv := by + rintro ⟨left, relative⟩ + dsimp only + apply Prod.ext + · rfl + · funext c + ext i + simp [relativeFamily] + +variable [Fintype C] [DecidableEq C] + [∀ c, Fintype (Q c)] [∀ c, DecidableEq (Q c)] + +theorem average_relativeFamily (f : (∀ c, Equiv.Perm (Q c)) → ℝ) : + average (fun lr : + (∀ c, Equiv.Perm (Q c)) × (∀ c, Equiv.Perm (Q c)) => + f (relativeFamily Q lr.1 lr.2)) = average f := by + calc + _ = average (fun lq : + (∀ c, Equiv.Perm (Q c)) × (∀ c, Equiv.Perm (Q c)) => f lq.2) := + average_equiv (relativeFamilyPairEquiv Q) (fun lq => f lq.2) + _ = _ := average_prod_snd f + +omit [DecidableEq C] in +theorem sum_twoHalfCount_eq_matchingCount + (A B : ∀ c, Finset (Q c)) (left right : ∀ c, Equiv.Perm (Q c)) : + (∑ c, twoHalfCount (A c) (B c) (left c) (right c)) = + ∑ c, matchingCount (A c) (B c) (relativeFamily Q left right c) := by + simp only [twoHalfCount_eq_matchingCount, relativeFamily] + +end Families + +end MatrixMultiplication.PermutationMatching + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +namespace MatrixMultiplication.PermutationMatching + +open scoped BigOperators +open Classical + +noncomputable section + +section ClassProducts + +variable {C : Type*} [Fintype C] [DecidableEq C] {P : C → Type*} + [∀ c, Fintype (P c)] [∀ c, DecidableEq (P c)] + +abbrev ClassPermutations (P : C → Type*) := ∀ c, Equiv.Perm (P c) + +def populationSize (P : C → Type*) [∀ c, Fintype (P c)] : ℝ := + ∑ c, (Fintype.card (P c) : ℝ) + +def totalMatchingCount (A B : ∀ c, Finset (P c)) + (p : ClassPermutations P) : ℝ := + ∑ c, matchingCount (A c) (B c) (p c) + +def totalMatchingMean (A B : ∀ c, Finset (P c)) : ℝ := + ∑ c, average (matchingCount (A c) (B c)) + +theorem average_totalMatchingCount (A B : ∀ c, Finset (P c)) : + average (totalMatchingCount A B) = totalMatchingMean A B := by + classical + unfold totalMatchingCount totalMatchingMean + rw [average_sum] + apply Finset.sum_congr rfl + intro c _ + exact average_pi_eval (X := fun c => Equiv.Perm (P c)) c + (matchingCount (A c) (B c)) + +omit [DecidableEq C] in +theorem totalMatchingMean_eq [∀ c, Nonempty (P c)] + (A B : ∀ c, Finset (P c)) : + totalMatchingMean A B = + ∑ c, ((A c).card : ℝ) * ((B c).card : ℝ) / (Fintype.card (P c) : ℝ) := by + classical + unfold totalMatchingMean + apply Finset.sum_congr rfl + intro c _ + exact average_matchingCount (A c) (B c) + +theorem totalMatchingCount_variance_le (A B : ∀ c, Finset (P c)) + (hn : ∀ c, 2 ≤ Fintype.card (P c)) : + average (fun p : ClassPermutations P => + (totalMatchingCount A B p - totalMatchingMean A B) ^ 2) ≤ + populationSize P / 8 := by + classical + calc + _ = ∑ c, average (fun p : Equiv.Perm (P c) => + (matchingCount (A c) (B c) p - average (matchingCount (A c) (B c))) ^ 2) := by + simpa only [totalMatchingCount, totalMatchingMean, Finset.sum_sub_distrib] + using average_pi_sum_centered_sq (fun c => matchingCount (A c) (B c)) + _ ≤ ∑ c, (Fintype.card (P c) : ℝ) / 8 := + Finset.sum_le_sum fun c _ => matchingCount_variance_le (A c) (B c) (hn c) + _ = populationSize P / 8 := by rw [← Finset.sum_div]; rfl + +theorem totalMatchingCount_deviation_le (A B : ∀ c, Finset (P c)) + (hn : ∀ c, 2 ≤ Fintype.card (P c)) (δ : ℝ) (hδ : 0 < δ) : + average (fun p : ClassPermutations P => + if δ ≤ |totalMatchingCount A B p - totalMatchingMean A B| then 1 else 0) ≤ + populationSize P / (8 * δ ^ 2) := by + classical + have h := (deviation_bound (totalMatchingCount A B) (totalMatchingMean A B) δ hδ).trans + (totalMatchingCount_variance_le A B hn) + calc + _ ≤ (populationSize P / 8) / δ ^ 2 := (le_div_iff₀ (sq_pos_of_pos hδ)).2 h + _ = _ := by rw [div_div] + +theorem normalizedMatchingCount_deviation_le (A B : ∀ c, Finset (P c)) + (hn : ∀ c, 2 ≤ Fintype.card (P c)) + (hm : 0 < populationSize P) (η : ℝ) (hη : 0 < η) : + average (fun p : ClassPermutations P => + if η / 2 ≤ |totalMatchingCount A B p / populationSize P - + totalMatchingMean A B / populationSize P| then 1 else 0) ≤ + 1 / (2 * populationSize P * η ^ 2) := by + classical + have hδ : 0 < populationSize P * η / 2 := by positivity + calc + _ ≤ average (fun p : ClassPermutations P => + if populationSize P * η / 2 ≤ + |totalMatchingCount A B p - totalMatchingMean A B| then 1 else 0) := by + apply average_mono + intro p + have hi : η / 2 ≤ |totalMatchingCount A B p / populationSize P - + totalMatchingMean A B / populationSize P| → + populationSize P * η / 2 ≤ + |totalMatchingCount A B p - totalMatchingMean A B| := by + intro hp + rw [← sub_div, abs_div, abs_of_pos hm] at hp + have hh := (le_div_iff₀ hm).mp hp + nlinarith + split_ifs <;> simp_all + _ ≤ populationSize P / (8 * (populationSize P * η / 2) ^ 2) := + totalMatchingCount_deviation_le A B hn _ hδ + _ = _ := by + field_simp [ne_of_gt hm, ne_of_gt hη] + ring + +theorem inheritedMask_rejection_le (A B : ∀ c, Finset (P c)) + (hn : ∀ c, 2 ≤ Fintype.card (P c)) + (hm : 0 < populationSize P) (η ν : ℝ) (hη : 0 < η) + (hmargin : |totalMatchingMean A B / populationSize P - ν| ≤ η / 2) : + average (fun p : ClassPermutations P => + if η < |totalMatchingCount A B p / populationSize P - ν| then 1 else 0) ≤ + 1 / (2 * populationSize P * η ^ 2) := by + classical + refine le_trans (average_mono ?_) (normalizedMatchingCount_deviation_le A B hn hm η hη) + intro p + have hi : η < |totalMatchingCount A B p / populationSize P - ν| → + η / 2 ≤ |totalMatchingCount A B p / populationSize P - + totalMatchingMean A B / populationSize P| := by + intro hp + have ht : |totalMatchingCount A B p / populationSize P - ν| ≤ + |totalMatchingCount A B p / populationSize P - + totalMatchingMean A B / populationSize P| + + |totalMatchingMean A B / populationSize P - ν| := by + simpa only [sub_add_sub_cancel] using abs_add_le + (totalMatchingCount A B p / populationSize P - totalMatchingMean A B / populationSize P) + (totalMatchingMean A B / populationSize P - ν) + linarith + split_ifs <;> simp_all + +theorem finite_inheritedMask_rejection_le {I : Type*} [Fintype I] + (A B : I → ∀ c, Finset (P c)) + (hn : ∀ c, 2 ≤ Fintype.card (P c)) (hm : 0 < populationSize P) + (η ν : I → ℝ) (hη : ∀ i, 0 < η i) + (hmargin : ∀ i, |totalMatchingMean (A i) (B i) / populationSize P - ν i| ≤ η i / 2) : + average (fun p : ClassPermutations P => + if ∃ i, η i < |totalMatchingCount (A i) (B i) p / populationSize P - ν i| + then 1 else 0) ≤ ∑ i, 1 / (2 * populationSize P * (η i) ^ 2) := by + classical + refine le_trans (average_indicator_exists_le_sum _) ?_ + exact Finset.sum_le_sum fun i _ => + inheritedMask_rejection_le (A i) (B i) hn hm (η i) (ν i) (hη i) (hmargin i) + +theorem pushforward_sum_rejection_le {I : Type*} [Fintype I] + (A B : I → ∀ c, Finset (P c)) + (hn : ∀ c, 2 ≤ Fintype.card (P c)) (hm : 0 < populationSize P) + (η : ℝ) (ν : I → ℝ) (hη : 0 < η) + (hmargin : ∀ i, |totalMatchingMean (A i) (B i) / populationSize P - ν i| ≤ + (η / Fintype.card I) / 2) : + average (fun p : ClassPermutations P => + if η < |(∑ i, totalMatchingCount (A i) (B i) p / populationSize P) - ∑ i, ν i| + then 1 else 0) ≤ + ∑ _i : I, 1 / (2 * populationSize P * (η / Fintype.card I) ^ 2) := by + classical + by_cases hIcard : Fintype.card I = 0 + · have : IsEmpty I := Fintype.card_eq_zero_iff.mp hIcard + simp [not_lt.mpr (le_of_lt hη)] + have : Nonempty I := Fintype.card_pos_iff.mp (Nat.pos_of_ne_zero hIcard) + have hcard : (0 : ℝ) < Fintype.card I := by + exact_mod_cast Fintype.card_pos + have htol : 0 < η / (Fintype.card I : ℝ) := div_pos hη hcard + refine le_trans (average_mono ?_) + (finite_inheritedMask_rejection_le A B hn hm (fun _ => η / Fintype.card I) + ν (fun _ => htol) hmargin) + intro p + have hi : η < |(∑ i, totalMatchingCount (A i) (B i) p / populationSize P) - + ∑ i, ν i| → + ∃ i, η / Fintype.card I < + |totalMatchingCount (A i) (B i) p / populationSize P - ν i| := by + intro hp + by_contra h + push Not at h + have he : |(∑ i, totalMatchingCount (A i) (B i) p / populationSize P) - + ∑ i, ν i| ≤ η := by + rw [← Finset.sum_sub_distrib] + calc + _ ≤ ∑ i, |totalMatchingCount (A i) (B i) p / populationSize P - ν i| := + Finset.abs_sum_le_sum_abs _ _ + _ ≤ ∑ _i : I, η / Fintype.card I := Finset.sum_le_sum fun i _ => h i + _ = η := by + simp only [Finset.sum_const, Finset.card_univ, nsmul_eq_mul] + field_simp [ne_of_gt hcard] + linarith + split_ifs <;> simp_all + +def totalTwoHalfCount (A B : ∀ c, Finset (P c)) + (p : ClassPermutations P × ClassPermutations P) : ℝ := + ∑ c, twoHalfCount (A c) (B c) (p.1 c) (p.2 c) + +theorem average_totalTwoHalfCount_test (A B : ∀ c, Finset (P c)) (f : ℝ → ℝ) : + average (fun p : ClassPermutations P × ClassPermutations P => + f (totalTwoHalfCount A B p)) = + average (fun p : ClassPermutations P => f (totalMatchingCount A B p)) := by + calc + _ = average (fun p : ClassPermutations P × ClassPermutations P => + f (totalMatchingCount A B (relativeFamily P p.1 p.2))) := by + apply average_congr + intro p + exact congrArg f (sum_twoHalfCount_eq_matchingCount P A B p.1 p.2) + _ = _ := average_relativeFamily P (fun p => f (totalMatchingCount A B p)) + +theorem average_totalTwoHalfCounts_test {I : Type*} + (A B : I → ∀ c, Finset (P c)) (f : (I → ℝ) → ℝ) : + average (fun p : ClassPermutations P × ClassPermutations P => + f (fun i => totalTwoHalfCount (A i) (B i) p)) = + average (fun p : ClassPermutations P => + f (fun i => totalMatchingCount (A i) (B i) p)) := by + calc + _ = average (fun p : ClassPermutations P × ClassPermutations P => + f (fun i => totalMatchingCount (A i) (B i) (relativeFamily P p.1 p.2))) := by + apply average_congr + intro p + apply congrArg f + funext i + exact sum_twoHalfCount_eq_matchingCount P (A i) (B i) p.1 p.2 + _ = _ := average_relativeFamily P + (fun p => f (fun i => totalMatchingCount (A i) (B i) p)) + +theorem twoHalf_pushforward_sum_rejection_le {I : Type*} [Fintype I] + (A B : I → ∀ c, Finset (P c)) + (hn : ∀ c, 2 ≤ Fintype.card (P c)) (hm : 0 < populationSize P) + (η : ℝ) (ν : I → ℝ) (hη : 0 < η) + (hmargin : ∀ i, |totalMatchingMean (A i) (B i) / populationSize P - ν i| ≤ + (η / Fintype.card I) / 2) : + average (fun p : ClassPermutations P × ClassPermutations P => + if η < |(∑ i, totalTwoHalfCount (A i) (B i) p / populationSize P) - ∑ i, ν i| + then 1 else 0) ≤ + ∑ _i : I, 1 / (2 * populationSize P * (η / Fintype.card I) ^ 2) := by + classical + rw [average_totalTwoHalfCounts_test A B + (fun k => if η < |(∑ i, k i / populationSize P) - ∑ i, ν i| then 1 else 0)] + exact pushforward_sum_rejection_le A B hn hm η ν hη hmargin + +theorem twoHalf_inheritedMask_rejection_le (A B : ∀ c, Finset (P c)) + (hn : ∀ c, 2 ≤ Fintype.card (P c)) + (hm : 0 < populationSize P) (η ν : ℝ) (hη : 0 < η) + (hmargin : |totalMatchingMean A B / populationSize P - ν| ≤ η / 2) : + average (fun p : ClassPermutations P × ClassPermutations P => + if η < |totalTwoHalfCount A B p / populationSize P - ν| then 1 else 0) ≤ + 1 / (2 * populationSize P * η ^ 2) := by + classical + rw [average_totalTwoHalfCount_test A B + (fun k => if η < |k / populationSize P - ν| then 1 else 0)] + exact inheritedMask_rejection_le A B hn hm η ν hη hmargin + +def selectedTwoHalfCount (D : Finset C) (A B : ∀ c, Finset (P c)) + (p : ClassPermutations P × ClassPermutations P) : ℝ := + totalTwoHalfCount (fun c : D => A c) (fun c : D => B c) + ((fun c => p.1 c), (fun c => p.2 c)) + +theorem selectedTwoHalfMask_rejection_le (D : Finset C) (A B : ∀ c, Finset (P c)) + (hn : ∀ c ∈ D, 2 ≤ Fintype.card (P c)) + (hm : 0 < populationSize (fun c : D => P c)) (η ν : ℝ) (hη : 0 < η) + (hmargin : |totalMatchingMean (fun c : D => A c) (fun c : D => B c) / + populationSize (fun c : D => P c) - ν| ≤ η / 2) : + average (fun p : ClassPermutations P × ClassPermutations P => + if η < |selectedTwoHalfCount D A B p / populationSize (fun c : D => P c) - ν| + then 1 else 0) ≤ 1 / (2 * populationSize (fun c : D => P c) * η ^ 2) := by + classical + have havg := average_prod_pi_restrict (X := fun c => Equiv.Perm (P c)) D + (fun p : ClassPermutations (fun c : D => P c) × + ClassPermutations (fun c : D => P c) => + if η < |totalTwoHalfCount (fun c : D => A c) (fun c : D => B c) p / + populationSize (fun c : D => P c) - ν| then (1 : ℝ) else 0) + change average (fun p : ClassPermutations P × ClassPermutations P => + if η < |totalTwoHalfCount (fun c : D => A c) (fun c : D => B c) + ((fun c => p.1 c), (fun c => p.2 c)) / + populationSize (fun c : D => P c) - ν| then 1 else 0) ≤ _ + rw [havg] + exact twoHalf_inheritedMask_rejection_le (P := fun c : D => P c) + (fun c : D => A c) (fun c : D => B c) + (fun c : D => hn c c.property) hm η ν hη hmargin + +theorem finite_selectedTwoHalfMask_rejection_le {I : Type*} [Fintype I] + (D : I → Finset C) (A B : I → ∀ c, Finset (P c)) + (hn : ∀ i c, c ∈ D i → 2 ≤ Fintype.card (P c)) + (hm : ∀ i, 0 < populationSize (fun c : D i => P c)) + (η ν : I → ℝ) (hη : ∀ i, 0 < η i) + (hmargin : ∀ i, + |totalMatchingMean (fun c : D i => A i c) (fun c : D i => B i c) / + populationSize (fun c : D i => P c) - ν i| ≤ η i / 2) : + average (fun p : ClassPermutations P × ClassPermutations P => + if ∃ i, η i < |selectedTwoHalfCount (D i) (A i) (B i) p / + populationSize (fun c : D i => P c) - ν i| then 1 else 0) ≤ + ∑ i, 1 / (2 * populationSize (fun c : D i => P c) * (η i) ^ 2) := by + classical + refine le_trans (average_indicator_exists_le_sum _) ?_ + exact Finset.sum_le_sum fun i _ => selectedTwoHalfMask_rejection_le + (D i) (A i) (B i) (hn i) (hm i) (η i) (ν i) (hη i) (hmargin i) + +theorem inverse_linear_mask_constant {I : Type*} [Fintype I] + (mass η : I → ℝ) (N : ℝ) : + (∑ i, 1 / (2 * (mass i * N) * (η i) ^ 2)) = + (∑ i, 1 / (2 * mass i * (η i) ^ 2)) / N := by + rw [Finset.sum_div] + apply Finset.sum_congr rfl + intro i _ + rw [div_div] + congr 1 + ring + +theorem finite_selectedTwoHalfMask_inverse_linear {I : Type*} [Fintype I] + (D : I → Finset C) (A B : I → ∀ c, Finset (P c)) + (hn : ∀ i c, c ∈ D i → 2 ≤ Fintype.card (P c)) + (mass η ν : I → ℝ) (N : ℝ) (hN : 0 < N) + (hmass : ∀ i, 0 < mass i) (hη : ∀ i, 0 < η i) + (hsize : ∀ i, populationSize (fun c : D i => P c) = mass i * N) + (hmargin : ∀ i, + |totalMatchingMean (fun c : D i => A i c) (fun c : D i => B i c) / + populationSize (fun c : D i => P c) - ν i| ≤ η i / 2) : + average (fun p : ClassPermutations P × ClassPermutations P => + if ∃ i, η i < |selectedTwoHalfCount (D i) (A i) (B i) p / + populationSize (fun c : D i => P c) - ν i| then 1 else 0) ≤ + (∑ i, 1 / (2 * mass i * (η i) ^ 2)) / N := by + have hm (i : I) : 0 < populationSize (fun c : D i => P c) := by + rw [hsize] + exact mul_pos (hmass i) hN + have h := finite_selectedTwoHalfMask_rejection_le D A B hn hm η ν hη hmargin + simpa only [hsize, inverse_linear_mask_constant] using h + +end ClassProducts + +section CompleteSymbols + +variable {P A S : Type*} [Fintype P] [DecidableEq P] [DecidableEq S] + +omit [DecidableEq P] in +theorem statisticPositions_card [Fintype S] + (w : P → A) (statistic : A → S) (s : S) : + (statisticPositions w statistic s).card = + MatrixMultiplication.Foundation.wordPopulation (statistic ∘ w) s := by + unfold statisticPositions MatrixMultiplication.Foundation.wordPopulation + rw [Fintype.card_subtype] + apply congrArg Finset.card + ext i + simp + +end CompleteSymbols + +section OrbitFractions + +variable {G X : Type*} [Group G] [MulAction G X] [Fintype G] [DecidableEq X] + +theorem average_bad_shift_eq_orbit_fraction (x : X) (bad : X → Prop) + [DecidablePred bad] : + average (fun g : G => if bad (g • x) then 1 else 0) = + (((OrbitCounting.orbitSet (G := G) x).filter bad).card : ℝ) / + (OrbitCounting.orbitSet (G := G) x).card := by + rw [average_indicator_eq] + exact OrbitCounting.bad_shift_fraction x bad + +end OrbitFractions + +end + +end MatrixMultiplication.PermutationMatching + +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +namespace MatrixMultiplication.PermutationMatching + +open scoped BigOperators +open MatrixMultiplication.InheritedMasks +open Classical + +noncomputable section + +section ClassMixtures + +variable {C : Type*} [Fintype C] [DecidableEq C] {P : C → Type*} + [∀ c, Fintype (P c)] [∀ c, DecidableEq (P c)] + +def classWeight (P : C → Type*) [∀ c, Fintype (P c)] (c : C) : ℝ := + (Fintype.card (P c) : ℝ) / populationSize P + +def classDensity (A : ∀ c, Finset (P c)) (c : C) : ℝ := + ((A c).card : ℝ) / Fintype.card (P c) + +def classProductMixture (P : C → Type*) [∀ c, Fintype (P c)] + (left right : C → ℝ) : ℝ := + ∑ c, classWeight P c * (left c * right c) + +omit [DecidableEq C] [∀ c, DecidableEq (P c)] in +theorem classWeight_nonneg (hm : 0 < populationSize P) (c : C) : + 0 ≤ classWeight P c := div_nonneg (Nat.cast_nonneg _) (le_of_lt hm) + +omit [DecidableEq C] [∀ c, DecidableEq (P c)] in +theorem sum_classWeight (hm : 0 < populationSize P) : + ∑ c, classWeight P c = 1 := by + unfold classWeight + rw [← Finset.sum_div] + exact div_self (ne_of_gt hm) + +omit [Fintype C] [DecidableEq C] [∀ c, DecidableEq (P c)] in +theorem classDensity_nonneg (A : ∀ c, Finset (P c)) (c : C) : + 0 ≤ classDensity A c := div_nonneg (Nat.cast_nonneg _) (Nat.cast_nonneg _) + +omit [Fintype C] [DecidableEq C] [∀ c, DecidableEq (P c)] in +theorem classDensity_le_one [∀ c, Nonempty (P c)] + (A : ∀ c, Finset (P c)) (c : C) : classDensity A c ≤ 1 := by + have hn : (0 : ℝ) < Fintype.card (P c) := by exact_mod_cast Fintype.card_pos + apply (div_le_iff₀ hn).2 + simpa using (Nat.cast_le.mpr (Finset.card_le_univ (A c)) : + ((A c).card : ℝ) ≤ Fintype.card (P c)) + +omit [DecidableEq C] in +theorem totalMatchingMean_normalized_eq [∀ c, Nonempty (P c)] + (A B : ∀ c, Finset (P c)) (hm : 0 < populationSize P) : + totalMatchingMean A B / populationSize P = + classProductMixture P (classDensity A) (classDensity B) := by + classical + rw [totalMatchingMean_eq, Finset.sum_div] + unfold classProductMixture + apply Finset.sum_congr rfl + intro c _ + have hn : (Fintype.card (P c) : ℝ) ≠ 0 := by + exact_mod_cast (ne_of_gt (Fintype.card_pos (α := P c))) + dsimp [classWeight, classDensity] + field_simp [hn, ne_of_gt hm] + +omit [DecidableEq C] in +theorem totalMatchingMean_prescribed_error [∀ c, Nonempty (P c)] + (A B : ∀ c, Finset (P c)) (hm : 0 < populationSize P) + (left right : C → ℝ) (τ : ℝ) + (hright0 : ∀ c, 0 ≤ right c) (hright1 : ∀ c, right c ≤ 1) + (hleft : ∀ c, |classDensity A c - left c| ≤ τ) + (hright : ∀ c, |classDensity B c - right c| ≤ τ) : + |totalMatchingMean A B / populationSize P - + classProductMixture P left right| ≤ 2 * τ := by + rw [totalMatchingMean_normalized_eq A B hm] + have h := weighted_window (classWeight P) + (fun c => classDensity A c * classDensity B c - left c * right c) + 0 (2 * τ) (classWeight_nonneg hm) (sum_classWeight hm) (by + intro c + simpa only [sub_zero] using product_coordinate_error + (classDensity_nonneg A c) (classDensity_le_one A c) + (hright0 c) (hright1 c) (hleft c) (hright c)) + simpa only [classProductMixture, sub_zero, mul_sub, Finset.sum_sub_distrib] using h + +omit [DecidableEq C] in +theorem totalMatchingMean_inherited_margin [∀ c, Nonempty (P c)] + (A B : ∀ c, Finset (P c)) (hm : 0 < populationSize P) + (left right : C → ℝ) (η τ α ν : ℝ) + (hright0 : ∀ c, 0 ≤ right c) (hright1 : ∀ c, right c ≤ 1) + (hleft : ∀ c, |classDensity A c - left c| ≤ τ) + (hright : ∀ c, |classDensity B c - right c| ≤ τ) + (happrox : |classProductMixture P left right - ν| ≤ α) + (hτ : τ ≤ η / 8) (hα : α ≤ η / 4) : + |totalMatchingMean A B / populationSize P - ν| ≤ η / 2 := by + have hchild := totalMatchingMean_prescribed_error A B hm left right τ + hright0 hright1 hleft hright + have h := inherited_margin (actual := ν) + (expected := classProductMixture P left right) + (prescribed := totalMatchingMean A B / populationSize P) + (by simpa only [abs_sub_comm] using hchild) + (by simpa only [abs_sub_comm] using happrox) hτ hα + simpa only [abs_sub_comm] using h + +theorem inheritedMask_rejection_of_windows_le [∀ c, Nonempty (P c)] + (A B : ∀ c, Finset (P c)) (hn : ∀ c, 2 ≤ Fintype.card (P c)) + (hm : 0 < populationSize P) (left right : C → ℝ) (η τ α ν : ℝ) + (hη : 0 < η) + (hright0 : ∀ c, 0 ≤ right c) (hright1 : ∀ c, right c ≤ 1) + (hleft : ∀ c, |classDensity A c - left c| ≤ τ) + (hright : ∀ c, |classDensity B c - right c| ≤ τ) + (happrox : |classProductMixture P left right - ν| ≤ α) + (hτ : τ ≤ η / 8) (hα : α ≤ η / 4) : + average (fun p : ClassPermutations P => + if η < |totalMatchingCount A B p / populationSize P - ν| then 1 else 0) ≤ + 1 / (2 * populationSize P * η ^ 2) := by + exact inheritedMask_rejection_le A B hn hm η ν hη + (totalMatchingMean_inherited_margin A B hm left right η τ α ν + hright0 hright1 hleft hright happrox hτ hα) + +theorem twoHalf_inheritedMask_rejection_of_windows_le [∀ c, Nonempty (P c)] + (A B : ∀ c, Finset (P c)) (hn : ∀ c, 2 ≤ Fintype.card (P c)) + (hm : 0 < populationSize P) (left right : C → ℝ) (η τ α ν : ℝ) + (hη : 0 < η) + (hright0 : ∀ c, 0 ≤ right c) (hright1 : ∀ c, right c ≤ 1) + (hleft : ∀ c, |classDensity A c - left c| ≤ τ) + (hright : ∀ c, |classDensity B c - right c| ≤ τ) + (happrox : |classProductMixture P left right - ν| ≤ α) + (hτ : τ ≤ η / 8) (hα : α ≤ η / 4) : + average (fun p : ClassPermutations P × ClassPermutations P => + if η < |totalTwoHalfCount A B p / populationSize P - ν| then 1 else 0) ≤ + 1 / (2 * populationSize P * η ^ 2) := by + exact twoHalf_inheritedMask_rejection_le A B hn hm η ν hη + (totalMatchingMean_inherited_margin A B hm left right η τ α ν + hright0 hright1 hleft hright happrox hτ hα) + +theorem selectedTwoHalfMask_rejection_of_windows_le + (D : Finset C) (A B : ∀ c, Finset (P c)) + (hn : ∀ c ∈ D, 2 ≤ Fintype.card (P c)) + (hm : 0 < populationSize (fun c : D => P c)) + (left right : C → ℝ) (η τ α ν : ℝ) (hη : 0 < η) + (hright0 : ∀ c ∈ D, 0 ≤ right c) (hright1 : ∀ c ∈ D, right c ≤ 1) + (hleft : ∀ c ∈ D, |classDensity A c - left c| ≤ τ) + (hright : ∀ c ∈ D, |classDensity B c - right c| ≤ τ) + (happrox : |classProductMixture (fun c : D => P c) + (fun c => left c) (fun c => right c) - ν| ≤ α) + (hτ : τ ≤ η / 8) (hα : α ≤ η / 4) : + average (fun p : ClassPermutations P × ClassPermutations P => + if η < |selectedTwoHalfCount D A B p / + populationSize (fun c : D => P c) - ν| then 1 else 0) ≤ + 1 / (2 * populationSize (fun c : D => P c) * η ^ 2) := by + let : ∀ c : D, Nonempty (P c) := fun c => + Fintype.card_pos_iff.mp (lt_of_lt_of_le (by decide : 0 < 2) (hn c c.property)) + apply selectedTwoHalfMask_rejection_le D A B hn hm η ν hη + exact totalMatchingMean_inherited_margin (fun c : D => A c) (fun c : D => B c) + hm (fun c => left c) (fun c => right c) η τ α ν + (fun c => hright0 c c.property) (fun c => hright1 c c.property) + (fun c => hleft c c.property) (fun c => hright c c.property) happrox hτ hα + +end ClassMixtures + +section CompleteWordStatistics + +variable {C : Type*} [Fintype C] [DecidableEq C] {P X Y S T : C → Type*} + [∀ c, Fintype (P c)] [∀ c, DecidableEq (P c)] + [∀ c, Fintype (S c)] [∀ c, DecidableEq (S c)] + [∀ c, Fintype (T c)] [∀ c, DecidableEq (T c)] + +omit [Fintype C] [DecidableEq C] [∀ c, DecidableEq (P c)] in +theorem classDensity_statisticPositions (w : ∀ c, P c → X c) + (statistic : ∀ c, X c → S c) (s : ∀ c, S c) (c : C) : + classDensity (fun c => statisticPositions (w c) (statistic c) (s c)) c = + empiricalLaw (statistic c ∘ w c) (s c) := by + rw [classDensity, statisticPositions_card, empiricalLaw] + +omit [DecidableEq C] in +theorem totalMatchingMean_statistic_eq [∀ c, Nonempty (P c)] + (w : ∀ c, P c → X c) (v : ∀ c, P c → Y c) + (leftStat : ∀ c, X c → S c) (rightStat : ∀ c, Y c → T c) + (s : ∀ c, S c) (t : ∀ c, T c) (hm : 0 < populationSize P) : + totalMatchingMean (fun c => statisticPositions (w c) (leftStat c) (s c)) + (fun c => statisticPositions (v c) (rightStat c) (t c)) / populationSize P = + classProductMixture P + (fun c => empiricalLaw (leftStat c ∘ w c) (s c)) + (fun c => empiricalLaw (rightStat c ∘ v c) (t c)) := by + rw [totalMatchingMean_normalized_eq _ _ hm] + simp only [classProductMixture, classDensity_statisticPositions] + +theorem twoHalf_statistic_rejection_of_typeWindows_le [∀ c, Nonempty (P c)] + (w : ∀ c, P c → X c) (v : ∀ c, P c → Y c) + (leftStat : ∀ c, X c → S c) (rightStat : ∀ c, Y c → T c) + (s : ∀ c, S c) (t : ∀ c, T c) + (hn : ∀ c, 2 ≤ Fintype.card (P c)) (hm : 0 < populationSize P) + (leftLaw : ∀ c, S c → ℝ) (rightLaw : ∀ c, T c → ℝ) + (η τ α ν : ℝ) (hη : 0 < η) + (hright0 : ∀ c, 0 ≤ rightLaw c (t c)) + (hright1 : ∀ c, rightLaw c (t c) ≤ 1) + (hleft : ∀ c, typeWindow (leftLaw c) τ (leftStat c ∘ w c)) + (hright : ∀ c, typeWindow (rightLaw c) τ (rightStat c ∘ v c)) + (happrox : |classProductMixture P + (fun c => leftLaw c (s c)) (fun c => rightLaw c (t c)) - ν| ≤ α) + (hτ : τ ≤ η / 8) (hα : α ≤ η / 4) : + average (fun p : ClassPermutations P × ClassPermutations P => + if η < |totalTwoHalfCount + (fun c => statisticPositions (w c) (leftStat c) (s c)) + (fun c => statisticPositions (v c) (rightStat c) (t c)) p / + populationSize P - ν| then 1 else 0) ≤ + 1 / (2 * populationSize P * η ^ 2) := by + apply twoHalf_inheritedMask_rejection_of_windows_le _ _ hn hm + (fun c => leftLaw c (s c)) (fun c => rightLaw c (t c)) η τ α ν hη + hright0 hright1 + · intro c + simpa only [classDensity_statisticPositions] using hleft c (s c) + · intro c + simpa only [classDensity_statisticPositions] using hright c (t c) + · exact happrox + · exact hτ + · exact hα + +theorem selectedTwoHalf_statistic_rejection_of_completeWindows_le + [∀ c, Fintype (X c)] [∀ c, DecidableEq (X c)] + [∀ c, Fintype (Y c)] [∀ c, DecidableEq (Y c)] + (D : Finset C) (w : ∀ c, P c → X c) (v : ∀ c, P c → Y c) + (leftStat : ∀ c, X c → S c) (rightStat : ∀ c, Y c → T c) + (s : ∀ c, S c) (t : ∀ c, T c) + (hn : ∀ c ∈ D, 2 ≤ Fintype.card (P c)) + (hm : 0 < populationSize (fun c : D => P c)) + (leftLaw : ∀ c, X c → ℝ) (rightLaw : ∀ c, Y c → ℝ) + (leftε rightε : C → ℝ) (η α ν : ℝ) (hη : 0 < η) + (hright0 : ∀ c ∈ D, ∀ y, 0 ≤ rightLaw c y) + (hrightSum : ∀ c ∈ D, ∑ y, rightLaw c y = 1) + (hleftε : ∀ c ∈ D, 0 ≤ leftε c) (hrightε : ∀ c ∈ D, 0 ≤ rightε c) + (hleft : ∀ c ∈ D, typeWindow (leftLaw c) (leftε c) (w c)) + (hright : ∀ c ∈ D, typeWindow (rightLaw c) (rightε c) (v c)) + (hleftFactor : ∀ c ∈ D, (Fintype.card (X c) : ℝ) * leftε c ≤ η / 8) + (hrightFactor : ∀ c ∈ D, (Fintype.card (Y c) : ℝ) * rightε c ≤ η / 8) + (happrox : |classProductMixture (fun c : D => P c) + (fun c => pushforwardLaw (leftStat c) (leftLaw c) (s c)) + (fun c => pushforwardLaw (rightStat c) (rightLaw c) (t c)) - ν| ≤ α) + (hα : α ≤ η / 4) : + average (fun p : ClassPermutations P × ClassPermutations P => + if η < |selectedTwoHalfCount D + (fun c => statisticPositions (w c) (leftStat c) (s c)) + (fun c => statisticPositions (v c) (rightStat c) (t c)) p / + populationSize (fun c : D => P c) - ν| then 1 else 0) ≤ + 1 / (2 * populationSize (fun c : D => P c) * η ^ 2) := by + apply selectedTwoHalfMask_rejection_of_windows_le D _ _ hn hm + (fun c => pushforwardLaw (leftStat c) (leftLaw c) (s c)) + (fun c => pushforwardLaw (rightStat c) (rightLaw c) (t c)) + η (η / 8) α ν hη + · intro c hc + exact pushforwardLaw_nonneg (rightStat c) (rightLaw c) (hright0 c hc) (t c) + · intro c hc + exact pushforwardLaw_le_one (rightStat c) (rightLaw c) + (hright0 c hc) (hrightSum c hc) (t c) + · intro c hc + rw [classDensity_statisticPositions] + exact (typeWindow_statistic (leftLaw c) (leftε c) (w c) (leftStat c) + (hleftε c hc) (hleft c hc) (s c)).trans (hleftFactor c hc) + · intro c hc + rw [classDensity_statisticPositions] + exact (typeWindow_statistic (rightLaw c) (rightε c) (v c) (rightStat c) + (hrightε c hc) (hright c hc) (t c)).trans (hrightFactor c hc) + · exact happrox + · exact le_rfl + · exact hα + +end CompleteWordStatistics + +end + +end MatrixMultiplication.PermutationMatching + +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/Histories/InitialOrbit.lean b/lean/OAI/LinearAlgebra/MatrixFields/Histories/InitialOrbit.lean new file mode 100644 index 0000000000000000000000000000000000000000..140aa72f1badb18d6e1e747b477b7befe411ecf1 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/Histories/InitialOrbit.lean @@ -0,0 +1,69 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Entropy.InitialEntropy + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +namespace MatrixMultiplication.AllFieldInitialOrbit + +open AllFieldParameters AllFieldHistory AllFieldInitialEntropy +open scoped BigOperators + +theorem source_total (p : PlacedInitial) : + (initialShapeCode p).1.val + (initialShapeCode p).2.1.val + + (initialShapeCode p).2.2.val = 16 := by + unfold initialShapeCode rootShape + rw [encodePhysicalShape_total] + exact (root_shape_spec _ (initialShape_mem _)).2 + +theorem decodeShape_injective : Function.Injective decodeShape := by + intro u v h + apply Prod.ext + · exact Fin.ext (congrFun h 0) + · apply Prod.ext + · exact Fin.ext (congrFun h 1) + · exact Fin.ext (congrFun h 2) + +theorem decodeShape_mem_shapes (u : JointPopulation.Shape) + (hu : u.1.val + u.2.1.val + u.2.2.val = 16) : + decodeShape u ∈ shapes 16 := by + simp only [shapes, List.mem_flatMap, List.mem_map, List.mem_range] + refine ⟨u.1.val, by omega, u.2.1.val, by omega, ?_⟩ + funext i + fin_cases i + · rfl + · rfl + · change 16 - u.1.val - u.2.1.val = u.2.2.val + omega + +theorem initialShapeCode_eq_iff (p : PlacedInitial) (u : JointPopulation.Shape) : + initialShapeCode p = u ↔ + physicalShape p.2 (sortedInitial.get p.1) = decodeShape u := by + have hdecode : decodeShape (initialShapeCode p) = + physicalShape p.2 (sortedInitial.get p.1) := by + funext i + exact initialShapeCode_side p i + rw [← hdecode] + exact decodeShape_injective.eq_iff.symm + +theorem weighted_shape_fiber_count : ∀ u ∈ shapes 16, + (∑ p : PlacedInitial, + if physicalShape p.2 (sortedInitial.get p.1) = u + then initialMultiplicity (sortedInitial.get p.1) else 0) = 6 := by + decide +kernel + +theorem weighted_fiber_count (u : JointPopulation.Shape) + (hu : u.1.val + u.2.1.val + u.2.2.val = 16) : + (∑ p : PlacedInitial, if initialShapeCode p = u + then initialMultiplicity (sortedInitial.get p.1) else 0) = 6 := by + simp only [initialShapeCode_eq_iff] + exact weighted_shape_fiber_count _ (decodeShape_mem_shapes u hu) + +end MatrixMultiplication.AllFieldInitialOrbit + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/Histories/InverseLinearRecovery.lean b/lean/OAI/LinearAlgebra/MatrixFields/Histories/InverseLinearRecovery.lean new file mode 100644 index 0000000000000000000000000000000000000000..51a39235dcdee7b5877e9f56f7e8afb9fd254bbb --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/Histories/InverseLinearRecovery.lean @@ -0,0 +1,626 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Construction.FiniteCover +import OAI.LinearAlgebra.MatrixFields.Tensors.ComplexDotPairing + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +open scoped BigOperators +open MatrixMultiplication.Foundation + +namespace MatrixMultiplication.ExactRecovery + +variable {K X Y Z I A B C : Type*} [CommSemiring K] + +def delete (Q : Tensor K X Y Z) (px : X → Prop) (py : Y → Prop) + (pz : Z → Prop) [DecidablePred px] [DecidablePred py] [DecidablePred pz] : + Tensor K X Y Z := fun x y z => if px x ∧ py y ∧ pz z then Q x y z else 0 + +def presence [Fintype I] [DecidableEq I] (p : I → X → Prop) + [∀ i, DecidablePred (p i)] (x : X) : Finset I := + Finset.univ.filter fun i => p i x + +@[simp] theorem mem_presence [Fintype I] [DecidableEq I] (p : I → X → Prop) + [∀ i, DecidablePred (p i)] (x : X) (i : I) : + i ∈ presence p x ↔ p i x := by simp [presence] + +theorem restrict_rectangles + [Fintype X] [Fintype Y] [Fintype Z] + [Fintype A] [Fintype B] [Fintype C] + [DecidableEq X] [DecidableEq Y] [DecidableEq Z] + [DecidableEq A] [DecidableEq B] [DecidableEq C] + (Q H : Tensor K X Y Z) (cx : X → A) (cy : Y → B) (cz : Z → C) + (fx : A × B × C → X → X) (fy : A × B × C → Y → Y) + (fz : A × B × C → Z → Z) + (h : ∀ x y z, H (fx (cx x, cy y, cz z) x) + (fy (cx x, cy y, cz z) y) (fz (cx x, cy y, cz z) z) = Q x y z) : + Tensor.restrict + (fun x s => if cx x = s.1.1 ∧ s.2 = fx s.1 x then (1 : K) else 0) + (fun y s => if cy y = s.1.2.1 ∧ s.2 = fy s.1 y then (1 : K) else 0) + (fun z s => if cz z = s.1.2.2 ∧ s.2 = fz s.1 z then (1 : K) else 0) + (Tensor.directSum (fun _ : A × B × C => H)) = Q := by + funext x y z + simp [Tensor.restrict, Tensor.directSum, Fintype.sum_prod_type, + ite_and, ite_mul, mul_ite, h] + +theorem repair_of_cover + [Fintype X] [Fintype Y] [Fintype Z] [Fintype I] [DecidableEq I] [Nonempty I] + (Q H : Tensor K X Y Z) + (px : I → X → Prop) (py : I → Y → Prop) (pz : I → Z → Prop) + (fx : I → X → X) (fy : I → Y → Y) (fz : I → Z → Z) + (hshift : ∀ i x y z, H (fx i x) (fy i y) (fz i z) = + @delete K X Y Z _ Q (px i) (py i) (pz i) + (Classical.decPred _) (Classical.decPred _) (Classical.decPred _) x y z) + (hcover : ∀ x y z, Q x y z ≠ 0 → ∃ i, px i x ∧ py i y ∧ pz i z) : + ∃ (a : X → ((Finset I × Finset I × Finset I) × X) → K) + (b : Y → ((Finset I × Finset I × Finset I) × Y) → K) + (c : Z → ((Finset I × Finset I × Finset I) × Z) → K), + Tensor.restrict a b c + (Tensor.directSum (fun _ : Finset I × Finset I × Finset I => H)) = Q := by + classical + let pick : Finset I × Finset I × Finset I → I := fun r => + if h : ∃ i, i ∈ r.1 ∧ i ∈ r.2.1 ∧ i ∈ r.2.2 then Classical.choose h + else Classical.choice inferInstance + have hpick (r : Finset I × Finset I × Finset I) + (hr : ∃ i, i ∈ r.1 ∧ i ∈ r.2.1 ∧ i ∈ r.2.2) : + pick r ∈ r.1 ∧ pick r ∈ r.2.1 ∧ pick r ∈ r.2.2 := by + simpa [pick, hr] using Classical.choose_spec hr + let cx := presence px + let cy := presence py + let cz := presence pz + have hrect (x : X) (y : Y) (z : Z) : + H (fx (pick (cx x, cy y, cz z)) x) + (fy (pick (cx x, cy y, cz z)) y) + (fz (pick (cx x, cy y, cz z)) z) = Q x y z := by + rw [hshift] + by_cases hq : Q x y z = 0 + · simp [delete, hq] + · rcases hcover x y z hq with ⟨i, hix, hiy, hiz⟩ + have hp := hpick (cx x, cy y, cz z) + ⟨i, by simpa [cx] using hix, by simpa [cy] using hiy, + by simpa [cz] using hiz⟩ + have hpx : px (pick (cx x, cy y, cz z)) x := by simpa [cx] using hp.1 + have hpy : py (pick (cx x, cy y, cz z)) y := by simpa [cy] using hp.2.1 + have hpz : pz (pick (cx x, cy y, cz z)) z := by simpa [cz] using hp.2.2 + simp [delete, hpx, hpy, hpz] + exact ⟨_, _, _, restrict_rectangles Q H cx cy cz + (fun r => fx (pick r)) (fun r => fy (pick r)) (fun r => fz (pick r)) hrect⟩ + +theorem card_mask_rectangles [Fintype I] : + Fintype.card (Finset I × Finset I × Finset I) = 2 ^ (3 * Fintype.card I) := by + classical + simp only [Fintype.card_prod, Fintype.card_finset] + rw [Nat.mul_comm 3 (Fintype.card I), pow_mul] + simp [pow_succ, mul_assoc] + +theorem repair_of_counting + [Fintype X] [Fintype Y] [Fintype Z] [Fintype I] + [DecidableEq X] [DecidableEq Y] [DecidableEq Z] [DecidableEq I] + (Q H : Tensor K X Y Z) + (px : I → X → Prop) (py : I → Y → Prop) (pz : I → Z → Prop) + (fx : I → X → X) (fy : I → Y → Y) (fz : I → Z → Z) + (hshift : ∀ i x y z, H (fx i x) (fy i y) (fz i z) = + @delete K X Y Z _ Q (px i) (py i) (pz i) + (Classical.decPred _) (Classical.decPred _) (Classical.decPred _) x y z) + (t L : ℕ) (hL : 0 < L) + (hbad : ∀ x y z, Q x y z ≠ 0 → + (@Finset.filter I (fun i => ¬(px i x ∧ py i y ∧ pz i z)) + (Classical.decPred _) Finset.univ).card ≤ t) + (hbudget : (@Finset.filter (X × Y × Z) + (fun p => Q p.1 p.2.1 p.2.2 ≠ 0) (Classical.decPred _) Finset.univ).card * t ^ L < + Fintype.card I ^ L) : + ∃ (a : X → ((Finset (Fin L) × Finset (Fin L) × Finset (Fin L)) × X) → K) + (b : Y → ((Finset (Fin L) × Finset (Fin L) × Finset (Fin L)) × Y) → K) + (c : Z → ((Finset (Fin L) × Finset (Fin L) × Finset (Fin L)) × Z) → K), + Tensor.restrict a b c + (Tensor.directSum (fun _ : Finset (Fin L) × Finset (Fin L) × Finset (Fin L) => H)) = Q := by + classical + let support : Finset (X × Y × Z) := @Finset.filter (X × Y × Z) + (fun p => Q p.1 p.2.1 p.2.2 ≠ 0) (Classical.decPred _) Finset.univ + let good (i : I) (p : X × Y × Z) : Prop := px i p.1 ∧ py i p.2.1 ∧ pz i p.2.2 + have hbad' : ∀ p ∈ support, (Finset.univ.filter fun i => ¬good i p).card ≤ t := by + intro p hp + have heq : (Finset.univ.filter fun i => ¬good i p) = + @Finset.filter I (fun i => ¬(px i p.1 ∧ py i p.2.1 ∧ pz i p.2.2)) + (Classical.decPred _) Finset.univ := by + ext i + simp only [Finset.mem_filter, good] + rw [heq] + apply hbad p.1 p.2.1 p.2.2 + simpa only [support, Finset.mem_filter, Finset.mem_univ, true_and] using hp + obtain ⟨f, hf⟩ := FiniteCover.exists_cover support good t L hbad' hbudget + let : Nonempty (Fin L) := ⟨⟨0, hL⟩⟩ + exact repair_of_cover Q H (fun i => px (f i)) (fun i => py (f i)) + (fun i => pz (f i)) (fun i => fx (f i)) (fun i => fy (f i)) + (fun i => fz (f i)) (fun i => hshift (f i)) + (fun x y z hq => hf (x, y, z) (by simp [support, hq])) + +end MatrixMultiplication.ExactRecovery + +end + + + + +section +open scoped BigOperators + +namespace MatrixMultiplication.OrbitCounting + +variable {G X : Type*} [Group G] [MulAction G X] [Fintype G] [DecidableEq X] + +def orbitSet (x : X) : Finset X := Finset.univ.image fun g : G => g • x + +@[simp] theorem smul_mem_orbitSet (x : X) (g : G) : g • x ∈ orbitSet (G := G) x := by + exact Finset.mem_image.mpr ⟨g, Finset.mem_univ _, rfl⟩ + +theorem card_fiber_eq (x y : X) (hy : y ∈ orbitSet (G := G) x) : + Fintype.card {g : G // g • x = y} = Fintype.card {g : G // g • x = x} := by + classical + obtain ⟨r, _, hr⟩ := Finset.mem_image.mp hy + let e : {g : G // g • x = y} ≃ {g : G // g • x = x} := + { toFun := fun g => ⟨r⁻¹ * g.1, by + rw [mul_smul, g.2, ← hr, inv_smul_smul]⟩ + invFun := fun g => ⟨r * g.1, by + rw [mul_smul, g.2, hr]⟩ + left_inv := by intro g; apply Subtype.ext; simp + right_inv := by intro g; apply Subtype.ext; simp } + exact Fintype.card_congr e + +theorem card_group (x : X) : + Fintype.card G = (orbitSet (G := G) x).card * + Fintype.card {g : G // g • x = x} := by + classical + let e := Equiv.sigmaSubtypeFiberEquiv (fun g : G => g • x) + (fun y => y ∈ orbitSet (G := G) x) (smul_mem_orbitSet x) + calc + Fintype.card G = Fintype.card (Σ y : {y // y ∈ orbitSet (G := G) x}, + {g : G // g • x = y.1}) := (Fintype.card_congr e).symm + _ = ∑ y : {y // y ∈ orbitSet (G := G) x}, + Fintype.card {g : G // g • x = y.1} := Fintype.card_sigma + _ = ∑ _y : {y // y ∈ orbitSet (G := G) x}, + Fintype.card {g : G // g • x = x} := by + apply Finset.sum_congr rfl + intro y _ + exact card_fiber_eq x y.1 y.2 + _ = _ := by simp + +theorem bad_shift_count (x : X) (bad : X → Prop) [DecidablePred bad] : + (Finset.univ.filter fun g : G => bad (g • x)).card = + ((orbitSet (G := G) x).filter bad).card * + Fintype.card {g : G // g • x = x} := by + classical + let e := Equiv.sigmaSubtypeFiberEquivSubtype (fun g : G => g • x) + (p := fun g => bad (g • x)) + (q := fun y => y ∈ (orbitSet (G := G) x).filter bad) + (fun g => by simp) + calc + (Finset.univ.filter fun g : G => bad (g • x)).card = + Fintype.card {g : G // bad (g • x)} := (Fintype.card_subtype _).symm + _ = Fintype.card (Σ y : {y // y ∈ (orbitSet (G := G) x).filter bad}, + {g : G // g • x = y.1}) := (Fintype.card_congr e).symm + _ = ∑ y : {y // y ∈ (orbitSet (G := G) x).filter bad}, + Fintype.card {g : G // g • x = y.1} := Fintype.card_sigma + _ = ∑ _y : {y // y ∈ (orbitSet (G := G) x).filter bad}, + Fintype.card {g : G // g • x = x} := by + apply Finset.sum_congr rfl + intro y _ + exact card_fiber_eq x y.1 (Finset.mem_filter.mp y.2).1 + _ = _ := by simp + +theorem bad_shift_bound (x : X) (bad : X → Prop) [DecidablePred bad] (N C : ℕ) + (h : N * ((orbitSet (G := G) x).filter bad).card ≤ C * (orbitSet (G := G) x).card) : + N * (Finset.univ.filter fun g : G => bad (g • x)).card ≤ C * Fintype.card G := by + rw [bad_shift_count, card_group (G := G) x] + simpa only [Nat.mul_assoc] using Nat.mul_le_mul_right + (Fintype.card {g : G // g • x = x}) h + +theorem bad_shift_fraction (x : X) (bad : X → Prop) [DecidablePred bad] : + ((Finset.univ.filter fun g : G => bad (g • x)).card : ℝ) / Fintype.card G = + (((orbitSet (G := G) x).filter bad).card : ℝ) / (orbitSet (G := G) x).card := by + have hsNat : 0 < Fintype.card {g : G // g • x = x} := + Fintype.card_pos_iff.mpr ⟨⟨1, one_smul G x⟩⟩ + have hs : (Fintype.card {g : G // g • x = x} : ℝ) ≠ 0 := + Nat.cast_ne_zero.mpr (Nat.ne_of_gt hsNat) + rw [bad_shift_count, card_group (G := G) x] + simp only [Nat.cast_mul] + exact mul_div_mul_right _ _ hs + +end MatrixMultiplication.OrbitCounting + +end + + + + +section +open scoped BigOperators +open MatrixMultiplication.Foundation + +namespace MatrixMultiplication.OrbitRecovery + +variable {G X Y Z : Type*} [Group G] [Fintype G] + [MulAction G X] [MulAction G Y] [MulAction G Z] + [DecidableEq X] [DecidableEq Y] [DecidableEq Z] + +def badShifts (px : X → Prop) (py : Y → Prop) (pz : Z → Prop) + [DecidablePred px] [DecidablePred py] [DecidablePred pz] + (x : X) (y : Y) (z : Z) : Finset G := + Finset.univ.filter fun g => ¬(px (g • x) ∧ py (g • y) ∧ pz (g • z)) + +omit [DecidableEq X] [DecidableEq Y] [DecidableEq Z] in +theorem badShifts_card_le (px : X → Prop) (py : Y → Prop) (pz : Z → Prop) + [DecidablePred px] [DecidablePred py] [DecidablePred pz] + (x : X) (y : Y) (z : Z) : + (badShifts (G := G) px py pz x y z).card ≤ + (Finset.univ.filter fun g : G => ¬px (g • x)).card + + (Finset.univ.filter fun g : G => ¬py (g • y)).card + + (Finset.univ.filter fun g : G => ¬pz (g • z)).card := by + classical + have heq : badShifts (G := G) px py pz x y z = + (Finset.univ.filter fun g : G => ¬px (g • x)) ∪ + ((Finset.univ.filter fun g : G => ¬py (g • y)) ∪ + (Finset.univ.filter fun g : G => ¬pz (g • z))) := by + ext g + by_cases hx : px (g • x) <;> by_cases hy : py (g • y) <;> + by_cases hz : pz (g • z) <;> simp [badShifts, hx, hy, hz] + rw [heq] + exact (Finset.card_union_le _ _).trans + ((Nat.add_le_add_left (Finset.card_union_le _ _) _).trans (le_of_eq (Nat.add_assoc _ _ _).symm)) + +theorem badShifts_fraction_le_at (px : X → Prop) (py : Y → Prop) (pz : Z → Prop) + [DecidablePred px] [DecidablePred py] [DecidablePred pz] + (γ : ℝ) (x : X) (y : Y) (z : Z) + (hx : (((OrbitCounting.orbitSet (G := G) x).filter fun v => ¬px v).card : ℝ) / + (OrbitCounting.orbitSet (G := G) x).card ≤ γ) + (hy : (((OrbitCounting.orbitSet (G := G) y).filter fun v => ¬py v).card : ℝ) / + (OrbitCounting.orbitSet (G := G) y).card ≤ γ) + (hz : (((OrbitCounting.orbitSet (G := G) z).filter fun v => ¬pz v).card : ℝ) / + (OrbitCounting.orbitSet (G := G) z).card ≤ γ) + : + ((badShifts (G := G) px py pz x y z).card : ℝ) / Fintype.card G ≤ 3 * γ := by + have hg : (0 : ℝ) < Fintype.card G := Nat.cast_pos.mpr Fintype.card_pos + have hx' := hx + have hy' := hy + have hz' := hz + rw [← OrbitCounting.bad_shift_fraction (G := G) x (fun v => ¬px v)] at hx' + rw [← OrbitCounting.bad_shift_fraction (G := G) y (fun v => ¬py v)] at hy' + rw [← OrbitCounting.bad_shift_fraction (G := G) z (fun v => ¬pz v)] at hz' + have hxc := (div_le_iff₀ hg).mp hx' + have hyc := (div_le_iff₀ hg).mp hy' + have hzc := (div_le_iff₀ hg).mp hz' + have hc : ((badShifts (G := G) px py pz x y z).card : ℝ) ≤ + ((Finset.univ.filter fun g : G => ¬px (g • x)).card : ℝ) + + ((Finset.univ.filter fun g : G => ¬py (g • y)).card : ℝ) + + ((Finset.univ.filter fun g : G => ¬pz (g • z)).card : ℝ) := by + exact_mod_cast badShifts_card_le (G := G) px py pz x y z + apply (div_le_iff₀ hg).mpr + linarith + +theorem floor_loss_fraction (γ : ℝ) (hγ : 0 ≤ γ) : + (Nat.floor (3 * γ * Fintype.card G) : ℝ) / Fintype.card G ≤ 3 * γ := by + have hg : (0 : ℝ) < Fintype.card G := Nat.cast_pos.mpr Fintype.card_pos + apply (div_le_iff₀ hg).mpr + exact Nat.floor_le (by positivity) + +theorem repair_from_orbit_loss + {K : Type*} [CommSemiring K] [Fintype X] [Fintype Y] [Fintype Z] + (Q : Tensor K X Y Z) + (px : X → Prop) (py : Y → Prop) (pz : Z → Prop) + [DecidablePred px] [DecidablePred py] [DecidablePred pz] + (hpreserve : ∀ (g : G) x y z, Q (g • x) (g • y) (g • z) = Q x y z) + (γ : ℝ) + (hx : ∀ x, (∃ y z, Q x y z ≠ 0) → (((OrbitCounting.orbitSet (G := G) x).filter fun v => ¬px v).card : ℝ) / + (OrbitCounting.orbitSet (G := G) x).card ≤ γ) + (hy : ∀ y, (∃ x z, Q x y z ≠ 0) → (((OrbitCounting.orbitSet (G := G) y).filter fun v => ¬py v).card : ℝ) / + (OrbitCounting.orbitSet (G := G) y).card ≤ γ) + (hz : ∀ z, (∃ x y, Q x y z ≠ 0) → (((OrbitCounting.orbitSet (G := G) z).filter fun v => ¬pz v).card : ℝ) / + (OrbitCounting.orbitSet (G := G) z).card ≤ γ) + (L : ℕ) (hL : 0 < L) + (hbudget : (@Finset.filter (X × Y × Z) + (fun p => Q p.1 p.2.1 p.2.2 ≠ 0) (Classical.decPred _) Finset.univ).card * + Nat.floor (3 * γ * Fintype.card G) ^ L < Fintype.card G ^ L) : + ∃ (a : X → ((Finset (Fin L) × Finset (Fin L) × Finset (Fin L)) × X) → K) + (b : Y → ((Finset (Fin L) × Finset (Fin L) × Finset (Fin L)) × Y) → K) + (c : Z → ((Finset (Fin L) × Finset (Fin L) × Finset (Fin L)) × Z) → K), + Tensor.restrict a b c (Tensor.directSum + (fun _ : Finset (Fin L) × Finset (Fin L) × Finset (Fin L) => + ExactRecovery.delete Q px py pz)) = Q := by + classical + apply ExactRecovery.repair_of_counting (I := G) Q (ExactRecovery.delete Q px py pz) + (fun g x => px (g • x)) (fun g y => py (g • y)) (fun g z => pz (g • z)) + (fun g x => g • x) (fun g y => g • y) (fun g z => g • z) + (fun g x y z => by simp [ExactRecovery.delete, hpreserve]) + (Nat.floor (3 * γ * Fintype.card G)) L hL ?_ hbudget + intro x y z hq + have heq : (@Finset.filter G + (fun g => ¬(px (g • x) ∧ py (g • y) ∧ pz (g • z))) + (Classical.decPred _) Finset.univ) = badShifts (G := G) px py pz x y z := by + ext g + simp only [badShifts, Finset.mem_filter] + rw [heq] + apply Nat.le_floor + have hg : (0 : ℝ) < Fintype.card G := Nat.cast_pos.mpr Fintype.card_pos + exact (div_le_iff₀ hg).mp (badShifts_fraction_le_at (G := G) px py pz γ x y z + (hx x ⟨y, z, hq⟩) (hy y ⟨x, z, hq⟩) (hz z ⟨x, y, hq⟩)) + +end MatrixMultiplication.OrbitRecovery + +end + + + + +section +noncomputable section + +namespace MatrixMultiplication.RecoveryGrowth + +open Filter +open scoped Topology BigOperators + +def shiftCount (b C : ℝ) (N : ℕ) : ℕ := + ⌈(b + 1) * (N : ℝ) / Real.log ((N : ℝ) / (3 * C))⌉₊ + +def replicationCount (b C : ℝ) (N : ℕ) : ℕ := + 2 ^ (3 * shiftCount b C N) + +theorem shiftCount_pos {b C : ℝ} {N : ℕ} + (hb : 0 ≤ b) (hC : 0 < C) (hN : 3 * C < (N : ℝ)) : + 0 < shiftCount b C N := by + have hC3 : 0 < 3 * C := by linarith + have hN0 : 0 < (N : ℝ) := hC3.trans hN + have hlog : 0 < Real.log ((N : ℝ) / (3 * C)) := + Real.log_pos ((one_lt_div hC3).2 hN) + exact Nat.ceil_pos.2 (div_pos (mul_pos (by linarith) hN0) hlog) + +theorem support_loss_bound {b C : ℝ} {N : ℕ} + (hC : 0 < C) (hN : 3 * C < (N : ℝ)) : + Real.exp (b * N) * (3 * C / (N : ℝ)) ^ shiftCount b C N ≤ + Real.exp (-(N : ℝ)) := by + have hC3 : 0 < 3 * C := by linarith + have hN0 : 0 < (N : ℝ) := hC3.trans hN + have hlog : 0 < Real.log ((N : ℝ) / (3 * C)) := + Real.log_pos ((one_lt_div hC3).2 hN) + have hceil : (b + 1) * (N : ℝ) ≤ + (shiftCount b C N : ℝ) * Real.log ((N : ℝ) / (3 * C)) := by + exact (div_le_iff₀ hlog).1 (Nat.le_ceil _) + have hbase : 3 * C / (N : ℝ) = + Real.exp (-Real.log ((N : ℝ) / (3 * C))) := by + rw [Real.exp_neg, Real.exp_log (div_pos hN0 hC3)] + simp + rw [hbase, ← Real.exp_nat_mul, ← Real.exp_add] + apply Real.exp_le_exp.mpr + nlinarith + +theorem cardinal_budget {b C : ℝ} {N S t g : ℕ} + (hC : 0 < C) (hN : 3 * C < (N : ℝ)) (hg : 0 < g) + (hS : (S : ℝ) ≤ Real.exp (b * N)) + (ht : (t : ℝ) / (g : ℝ) ≤ 3 * C / (N : ℝ)) : + S * t ^ shiftCount b C N < g ^ shiftCount b C N := by + have hgr : 0 < (g : ℝ) := by exact_mod_cast hg + have hN0 : 0 < (N : ℝ) := by linarith + have hpow := pow_le_pow_left₀ + (div_nonneg (Nat.cast_nonneg t) hgr.le) ht (shiftCount b C N) + have hprob : (S : ℝ) * ((t : ℝ) / (g : ℝ)) ^ shiftCount b C N < 1 := by + calc + (S : ℝ) * ((t : ℝ) / (g : ℝ)) ^ shiftCount b C N ≤ + Real.exp (b * N) * (3 * C / (N : ℝ)) ^ shiftCount b C N := + mul_le_mul hS hpow (pow_nonneg (div_nonneg (Nat.cast_nonneg t) hgr.le) _) + (Real.exp_pos _).le + _ ≤ Real.exp (-(N : ℝ)) := support_loss_bound hC hN + _ < 1 := by rw [Real.exp_lt_one_iff]; linarith + rw [div_pow, ← mul_div_assoc] at hprob + have hreal := (div_lt_iff₀ (pow_pos hgr (shiftCount b C N))).1 hprob + simp only [one_mul] at hreal + exact_mod_cast hreal + +theorem exists_cover {M G : Type*} [Fintype G] [Nonempty G] + [DecidableEq G] [DecidableEq M] + (s : Finset M) (good : G → M → Prop) [∀ g, DecidablePred (good g)] + {b C : ℝ} {N : ℕ} (hC : 0 < C) (hN : 3 * C < (N : ℝ)) + (hs : (s.card : ℝ) ≤ Real.exp (b * N)) + (hbad : ∀ m ∈ s, + ((Finset.univ.filter fun g => ¬good g m).card : ℝ) / Fintype.card G ≤ + 3 * C / (N : ℝ)) : + ∃ f : Fin (shiftCount b C N) → G, ∀ m ∈ s, ∃ i, good (f i) m := by + let t := ⌊(3 * C / (N : ℝ)) * Fintype.card G⌋₊ + have hg : 0 < (Fintype.card G : ℝ) := by exact_mod_cast Fintype.card_pos + have harg : 0 ≤ (3 * C / (N : ℝ)) * Fintype.card G := by + exact mul_nonneg (div_nonneg (by linarith) (Nat.cast_nonneg N)) hg.le + apply FiniteCover.exists_cover s good t (shiftCount b C N) + · intro m hm + exact Nat.le_floor ((div_le_iff₀ hg).1 (hbad m hm)) + · apply cardinal_budget hC hN Fintype.card_pos hs + exact (div_le_iff₀ hg).2 (Nat.floor_le harg) + +theorem shiftCount_div_nat_le {b C : ℝ} {N : ℕ} + (hb : 0 < b) (hC : 0 < C) (hN : 3 * C < (N : ℝ)) : + (shiftCount b C N : ℝ) / (N : ℝ) ≤ + (b + 1) / Real.log ((N : ℝ) / (3 * C)) + 1 / (N : ℝ) := by + have hC3 : 0 < 3 * C := by linarith + have hN0 : 0 < (N : ℝ) := hC3.trans hN + have hlog : 0 < Real.log ((N : ℝ) / (3 * C)) := + Real.log_pos ((one_lt_div hC3).2 hN) + have harg : 0 ≤ (b + 1) * (N : ℝ) / Real.log ((N : ℝ) / (3 * C)) := + div_nonneg (mul_nonneg (by linarith) hN0.le) hlog.le + have hceil := div_le_div_of_nonneg_right (Nat.ceil_lt_add_one harg).le hN0.le + change (shiftCount b C N : ℝ) / (N : ℝ) ≤ _ at hceil + convert hceil using 1 + field_simp [hN0.ne', hlog.ne'] + +theorem tendsto_shiftCount_div_nat {b C : ℝ} (hb : 0 < b) (hC : 0 < C) : + Tendsto (fun N : ℕ => (shiftCount b C N : ℝ) / (N : ℝ)) atTop (𝓝 0) := by + have hnat : Tendsto (fun N : ℕ => (N : ℝ)) atTop atTop := + tendsto_natCast_atTop_atTop + have hlog : Tendsto (fun N : ℕ => Real.log ((N : ℝ) / (3 * C))) atTop atTop := + Real.tendsto_log_atTop.comp (hnat.atTop_div_const (by linarith)) + have hmain : Tendsto (fun N : ℕ => + (b + 1) / Real.log ((N : ℝ) / (3 * C))) atTop (𝓝 0) := + tendsto_const_nhds.div_atTop hlog + have herr : Tendsto (fun N : ℕ => 1 / (N : ℝ)) atTop (𝓝 0) := + tendsto_const_nhds.div_atTop hnat + apply tendsto_of_tendsto_of_tendsto_of_le_of_le' tendsto_const_nhds + (by simpa only [add_zero] using hmain.add herr) + · exact Eventually.of_forall fun N => div_nonneg (Nat.cast_nonneg _) (Nat.cast_nonneg _) + · filter_upwards [hnat.eventually_gt_atTop (3 * C)] with N hN + exact shiftCount_div_nat_le hb hC hN + +theorem eventually_shiftCount_div_nat_le_log {b C : ℝ} (hb : 0 < b) (hC : 0 < C) : + ∀ᶠ N : ℕ in atTop, (shiftCount b C N : ℝ) / (N : ℝ) ≤ + (2 * b + 3) / Real.log (N : ℝ) := by + have hnat : Tendsto (fun N : ℕ => (N : ℝ)) atTop atTop := + tendsto_natCast_atTop_atTop + have hlognat := Real.tendsto_log_atTop.comp hnat + filter_upwards [hnat.eventually_gt_atTop (3 * C), hnat.eventually_gt_atTop 1, + hlognat.eventually_ge_atTop (2 * Real.log (3 * C))] with N hN hN1 hlarge + change 2 * Real.log (3 * C) ≤ Real.log (N : ℝ) at hlarge + have hN0 : 0 < (N : ℝ) := lt_trans zero_lt_one hN1 + have hC3 : 0 < 3 * C := by linarith + have hlog : 0 < Real.log (N : ℝ) := Real.log_pos hN1 + have hden : 0 < Real.log ((N : ℝ) / (3 * C)) := + Real.log_pos ((one_lt_div hC3).2 hN) + have hhalf : Real.log (N : ℝ) ≤ 2 * Real.log ((N : ℝ) / (3 * C)) := by + rw [Real.log_div hN0.ne' hC3.ne'] + linarith + have hmain : (b + 1) / Real.log ((N : ℝ) / (3 * C)) ≤ + (2 * (b + 1)) / Real.log (N : ℝ) := by + apply (div_le_div_iff₀ hden hlog).2 + nlinarith [mul_le_mul_of_nonneg_left hhalf (show 0 ≤ b + 1 by linarith)] + have herr : 1 / (N : ℝ) ≤ 1 / Real.log (N : ℝ) := + div_le_div_of_nonneg_left zero_le_one hlog (Real.log_le_self hN0.le) + calc + (shiftCount b C N : ℝ) / (N : ℝ) ≤ + (b + 1) / Real.log ((N : ℝ) / (3 * C)) + 1 / (N : ℝ) := + shiftCount_div_nat_le hb hC hN + _ ≤ (2 * (b + 1)) / Real.log (N : ℝ) + 1 / Real.log (N : ℝ) := + add_le_add hmain herr + _ = (2 * b + 3) / Real.log (N : ℝ) := by ring + +theorem log_replicationCount (b C : ℝ) (N : ℕ) : + Real.log (replicationCount b C N : ℝ) = + (3 * Real.log 2) * (shiftCount b C N : ℝ) := by + simp only [replicationCount, Nat.cast_pow, Real.log_pow, Nat.cast_mul, Nat.cast_ofNat] + ring + +theorem eventually_log_replicationCount_div_nat_le_log {b C : ℝ} + (hb : 0 < b) (hC : 0 < C) : + ∀ᶠ N : ℕ in atTop, Real.log (replicationCount b C N : ℝ) / (N : ℝ) ≤ + (3 * Real.log 2 * (2 * b + 3)) / Real.log (N : ℝ) := by + filter_upwards [eventually_shiftCount_div_nat_le_log hb hC] with N hN + have hlog2 : 0 ≤ 3 * Real.log 2 := + mul_nonneg (by norm_num) (Real.log_nonneg (by norm_num)) + simpa only [log_replicationCount, mul_div_assoc] using + mul_le_mul_of_nonneg_left hN hlog2 + +theorem tendsto_log_replicationCount_div_nat {b C : ℝ} (hb : 0 < b) (hC : 0 < C) : + Tendsto (fun N : ℕ => Real.log (replicationCount b C N : ℝ) / (N : ℝ)) + atTop (𝓝 0) := by + have h := (tendsto_shiftCount_div_nat hb hC).const_mul (3 * Real.log 2) + simp only [mul_zero] at h + convert h using 1 + ext N + simp only [log_replicationCount] + ring + +theorem eventually_replicationCount_le_exp {b C ε : ℝ} + (hb : 0 < b) (hC : 0 < C) (hε : 0 < ε) : + ∀ᶠ N : ℕ in atTop, (replicationCount b C N : ℝ) ≤ Real.exp (ε * N) := by + filter_upwards [(tendsto_log_replicationCount_div_nat hb hC).eventually_lt_const hε, + eventually_gt_atTop (0 : ℕ)] with N hrate hN + have hN0 : 0 < (N : ℝ) := by exact_mod_cast hN + have hrep : 0 < (replicationCount b C N : ℝ) := by + simp only [replicationCount, Nat.cast_pow, Nat.cast_ofNat] + exact pow_pos (by norm_num) _ + exact (Real.log_le_iff_le_exp hrep).1 ((div_lt_iff₀ hN0).1 hrate).le + +theorem tendsto_log_prod_div_nat {J : Type*} (s : Finset J) + {r : J → ℕ → ℕ} + (hr : ∀ j ∈ s, ∀ N, 0 < r j N) + (hlim : ∀ j ∈ s, Tendsto (fun N => Real.log (r j N : ℝ) / (N : ℝ)) + atTop (𝓝 0)) : + Tendsto (fun N => Real.log ((∏ j ∈ s, r j N : ℕ) : ℝ) / (N : ℝ)) + atTop (𝓝 0) := by + have hsum := tendsto_finsetSum s hlim + simp only [Finset.sum_const_zero] at hsum + apply hsum.congr + intro N + rw [Nat.cast_prod, Real.log_prod + (fun j hj => Nat.cast_ne_zero.mpr (Nat.ne_of_gt (hr j hj N)))] + simp only [div_eq_mul_inv, Finset.sum_mul] + +end MatrixMultiplication.RecoveryGrowth + +end +end + + + + +section +open MatrixMultiplication.Foundation + +namespace MatrixMultiplication.InverseLinearRecovery + +abbrev MaskRectangles (L : ℕ) := Finset (Fin L) × Finset (Fin L) × Finset (Fin L) + +def RecoveredBy {K X Y Z : Type*} [CommSemiring K] + [Fintype X] [Fintype Y] [Fintype Z] + (Q H : Tensor K X Y Z) (L : ℕ) : Prop := + ∃ (a : X → (MaskRectangles L × X) → K) + (b : Y → (MaskRectangles L × Y) → K) + (c : Z → (MaskRectangles L × Z) → K), + Tensor.restrict a b c (Tensor.directSum (fun _ : MaskRectangles L => H)) = Q + +theorem repair_inverse_linear + {K G X Y Z : Type*} [CommSemiring K] [Group G] [Fintype G] + [MulAction G X] [MulAction G Y] [MulAction G Z] + [Fintype X] [Fintype Y] [Fintype Z] + [DecidableEq X] [DecidableEq Y] [DecidableEq Z] + (Q : Tensor K X Y Z) + (px : X → Prop) (py : Y → Prop) (pz : Z → Prop) + [DecidablePred px] [DecidablePred py] [DecidablePred pz] + (hpreserve : ∀ (g : G) x y z, Q (g • x) (g • y) (g • z) = Q x y z) + {b C : ℝ} {N : ℕ} (hb : 0 ≤ b) (hC : 0 < C) (hN : 3 * C < (N : ℝ)) + (hsupport : ((@Finset.filter (X × Y × Z) + (fun p => Q p.1 p.2.1 p.2.2 ≠ 0) (Classical.decPred _) Finset.univ).card : ℝ) ≤ + Real.exp (b * N)) + (hx : ∀ x, (∃ y z, Q x y z ≠ 0) → (((OrbitCounting.orbitSet (G := G) x).filter fun v => ¬px v).card : ℝ) / + (OrbitCounting.orbitSet (G := G) x).card ≤ C / N) + (hy : ∀ y, (∃ x z, Q x y z ≠ 0) → (((OrbitCounting.orbitSet (G := G) y).filter fun v => ¬py v).card : ℝ) / + (OrbitCounting.orbitSet (G := G) y).card ≤ C / N) + (hz : ∀ z, (∃ x y, Q x y z ≠ 0) → (((OrbitCounting.orbitSet (G := G) z).filter fun v => ¬pz v).card : ℝ) / + (OrbitCounting.orbitSet (G := G) z).card ≤ C / N) : + RecoveredBy Q (ExactRecovery.delete Q px py pz) (RecoveryGrowth.shiftCount b C N) := by + classical + apply OrbitRecovery.repair_from_orbit_loss Q px py pz hpreserve (C / N) hx hy hz + (RecoveryGrowth.shiftCount b C N) (RecoveryGrowth.shiftCount_pos hb hC hN) + apply RecoveryGrowth.cardinal_budget hC hN Fintype.card_pos hsupport + simpa only [mul_div_assoc] using + OrbitRecovery.floor_loss_fraction (G := G) (C / N) + (div_nonneg hC.le (Nat.cast_nonneg N)) + +theorem card_recovery_copies (b C : ℝ) (N : ℕ) : + Fintype.card (MaskRectangles (RecoveryGrowth.shiftCount b C N)) = + RecoveryGrowth.replicationCount b C N := by + simpa only [MaskRectangles, Fintype.card_fin, RecoveryGrowth.replicationCount] using + (ExactRecovery.card_mask_rectangles (I := Fin (RecoveryGrowth.shiftCount b C N))) + +theorem subexponential_copies {b C : ℝ} (hb : 0 < b) (hC : 0 < C) : + Filter.Tendsto (fun N : ℕ => + Real.log (Fintype.card (MaskRectangles (RecoveryGrowth.shiftCount b C N))) / N) + Filter.atTop (nhds 0) := by + simp_rw [card_recovery_copies] + exact RecoveryGrowth.tendsto_log_replicationCount_div_nat hb hC + +end MatrixMultiplication.InverseLinearRecovery + +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/Histories/JointScalarOrbitAdmissibility.lean b/lean/OAI/LinearAlgebra/MatrixFields/Histories/JointScalarOrbitAdmissibility.lean new file mode 100644 index 0000000000000000000000000000000000000000..2cd6263725e6f5407b608ced783b96fad0aba2cc --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/Histories/JointScalarOrbitAdmissibility.lean @@ -0,0 +1,86 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Histories.HistoryRecoveryBudget + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section + +namespace MatrixMultiplication.JointScalarOrbitAdmissibility + +open JointPopulation JointCanonicalization PermutationMatching +attribute [local instance] Classical.propDecidable Classical.decEq + +variable {H : Type*} [Fintype H] [DecidableEq H] + (counts : H → Shape → ℕ) (L R : H → Type*) + +def ClassWeights (wl : ∀ h, L h → ℕ) (wr : ∀ h, R h → ℕ) + (vl vr : H → Shape → ℕ) (e : Target counts) (w : RawPairs counts L R) : Prop := + ∀ h j, wl h (w h j).1 = vl h ((e h).val j) ∧ + wr h (w h j).2 = vr h ((e h).val j) + +omit [Fintype H] [DecidableEq H] in +theorem classWeights_smul (wl : ∀ h, L h → ℕ) (wr : ∀ h, R h → ℕ) + (vl vr : H → Shape → ℕ) (e : Target counts) : + letI : MulAction (HalfClassPermutations (ClassPositions counts)) (RawPairs counts L R) := + EquivOrbitTransport.action (pairEquiv counts L R e) + ∀ (g : HalfClassPermutations (ClassPositions counts)) (w : RawPairs counts L R), + ClassWeights counts L R wl wr vl vr e w → + ClassWeights counts L R wl wr vl vr e ((EquivOrbitTransport.action (pairEquiv counts L R e)).smul g w) := by + let : MulAction (HalfClassPermutations (ClassPositions counts)) (RawPairs counts L R) := + EquivOrbitTransport.action (pairEquiv counts L R e) + intro g w hw h j + constructor + · change wl h (w h ((positionEquiv counts e h).symm + ⟨(e h).val j, (g.1 (h, (e h).val j)).symm (positionEquiv counts e h j).2⟩)).1 = _ + simpa only [positionEquiv_symm_shape] using + (hw h ((positionEquiv counts e h).symm + ⟨(e h).val j, (g.1 (h, (e h).val j)).symm (positionEquiv counts e h j).2⟩)).1 + · change wr h (w h ((positionEquiv counts e h).symm + ⟨(e h).val j, (g.2 (h, (e h).val j)).symm (positionEquiv counts e h j).2⟩)).2 = _ + simpa only [positionEquiv_symm_shape] using + (hw h ((positionEquiv counts e h).symm + ⟨(e h).val j, (g.2 (h, (e h).val j)).symm (positionEquiv counts e h j).2⟩)).2 + +section Windows + +variable {SL SR : H → Type*} + [∀ h, Fintype (SL h)] [∀ h, Fintype (SR h)] + [∀ h, DecidableEq (SL h)] [∀ h, DecidableEq (SR h)] + (sl : ∀ c : ClassKey (H := H), L c.1 → SL c.1) + (sr : ∀ c : ClassKey (H := H), R c.1 → SR c.1) + (νl : ∀ c : ClassKey (H := H), SL c.1 → ℝ) + (νr : ∀ c : ClassKey (H := H), SR c.1 → ℝ) + (ηl ηr : ClassKey (H := H) → ℝ) + +omit [Fintype H] [DecidableEq H] in +theorem rawWindows_smul (e : Target counts) : + letI : MulAction (HalfClassPermutations (ClassPositions counts)) (RawPairs counts L R) := + EquivOrbitTransport.action (pairEquiv counts L R e) + ∀ (g : HalfClassPermutations (ClassPositions counts)) (w : RawPairs counts L R), + rawWindows counts L R sl sr νl νr ηl ηr e ((EquivOrbitTransport.action (pairEquiv counts L R e)).smul g w) ↔ + rawWindows counts L R sl sr νl νr ηl ηr e w := by + let : MulAction (HalfClassPermutations (ClassPositions counts)) (RawPairs counts L R) := + EquivOrbitTransport.action (pairEquiv counts L R e) + intro g w + rw [rawWindows_iff_childWindows, rawWindows_iff_childWindows] + change HistorySymmetry.childWindows _ _ _ _ _ _ + ((pairEquiv counts L R e) ((pairEquiv counts L R e).symm + (g • (pairEquiv counts L R e) w))) ↔ _ + rw [Equiv.apply_symm_apply] + exact HistorySymmetry.childWindows_smul _ _ _ _ _ _ g _ + +end Windows + +end MatrixMultiplication.JointScalarOrbitAdmissibility + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/Histories/ScheduledPositivity.lean b/lean/OAI/LinearAlgebra/MatrixFields/Histories/ScheduledPositivity.lean new file mode 100644 index 0000000000000000000000000000000000000000..338ce10833c8c7c296c3c3273d755743bd996d8b --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/Histories/ScheduledPositivity.lean @@ -0,0 +1,322 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Construction.ActiveSums +import OAI.LinearAlgebra.MatrixFields.Construction.InitialFamily +import OAI.LinearAlgebra.MatrixFields.Entropy.ConditionalContinuity +import OAI.LinearAlgebra.MatrixFields.Parameters.StageCCapacity + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +noncomputable section + +namespace MatrixMultiplication.AllFieldScheduledYield + +open MatrixMultiplication.Foundation AllFieldParameters AllFieldHistory AllFieldNativeCapacity +open Filter +open scoped BigOperators Topology + +def workCapacity {K : ℕ} : Work K → Staggering.Capacity := + shapeCapacity stageACapacity stageBCapacity stageCCapacity + +theorem workCapacity_stageC {K : ℕ} (h : PartC K) (i : Fin 3) : + workCapacity (Work.stageC h) i = finiteEntropy + (AllFieldStageCCapacity.stageCMarginal (cParameterParent h) (cShapeParent h) + (cPriority h i)) := by + rw [AllFieldStageCCapacity.stageCMarginal_priority_entropy] + rfl + +private theorem sum_interiorPairs (f : Shape × Shape → ℝ) : + (interiorPairs.map f).sum = + (positiveSecond.map fun t => + (((below t).filter positive).map fun u => f (t,u)).sum).sum := by + unfold interiorPairs + have h : ∀ xs : List Shape, + ((xs.flatMap fun t => ((below t).filter positive).map fun u => (t,u)).map f).sum = + (xs.map fun t => (((below t).filter positive).map fun u => f (t,u)).sum).sum := by + intro xs + induction xs with + | nil => simp + | cons t xs ih => simp [ih, List.map_map, Function.comp_def] + exact h positiveSecond + +theorem stageCSourceCapacity_native (allocation : Allocation) : + stageCSourceCapacity allocation stageCCapacity = + nativeLC (fun i => (allocation.mass i : ℝ)) := by + funext i + unfold stageCSourceCapacity stageCSourceSum nativeLC + rw [sum_interiorPairs] + apply congrArg List.sum + apply List.map_congr_left + intro t ht + apply congrArg List.sum + apply List.map_congr_left + intro u hu + rw [show (∑ part : Fin 3, (allocation.mass part : ℝ) * stageCCapacity t u part i) = + (1 - (allocation.mass i : ℝ)) * Real.log 2 + + (allocation.mass i : ℝ) * binaryEntropyRate (binaryParameter t u) from + AllFieldStageCCapacity.allocation_capacity allocation (binaryParameter t u) i] + rfl + +theorem active_native_capacity (K tick : ℕ) (allocation : Allocation) : + activeAggregateCapacity allocation tick (workCapacity (K := K)) = + FiniteSchedule.tickCapacity K nativeLA nativeLB + (nativeLC (fun i => (allocation.mass i : ℝ))) tick := by + rw [workCapacity, activeAggregateCapacity_shapeCapacity, + stageCSourceCapacity_native] + rfl + +theorem physical_order_native_capacity (K tick : ℕ) (allocation : Allocation) + (sigma : Placement) : + physicalTickCapacity allocation tick (workCapacity (K := K)) sigma = + fun i => (1 / 6 : ℝ) * FiniteSchedule.tickCapacity K nativeLA nativeLB + (nativeLC (fun i => (allocation.mass i : ℝ))) tick i := by + rw [physicalTickCapacity_eq_sixth, active_native_capacity] + +theorem order_capacity_eq_physical (K tick : ℕ) (allocation : Allocation) + (sigma : Placement) (i : Fin 3) : + (∑ h : ActiveOrder K tick sigma, + AllFieldActiveLaws.orderMass allocation h * workCapacity h.val.val.1 i) = + physicalTickCapacity allocation tick (workCapacity (K := K)) sigma i := by + rw [physicalTickCapacity_eq_sixth] + rw [← (canonicalActiveEquivOrder K tick sigma).sum_comp + (fun h : ActiveOrder K tick sigma => + AllFieldActiveLaws.orderMass allocation h * workCapacity h.val.val.1 i)] + simp only [AllFieldActiveLaws.orderMass, canonicalActiveEquivOrder, amount, + Rat.cast_div, Rat.cast_ofNat, activeAggregateCapacity, + PhysicalOrders.aggregateCapacity, workAmount] + rw [Finset.mul_sum] + apply Finset.sum_congr rfl + intro h hh + change ((canonicalAmount allocation h.val.source : ℝ) / 6) * + workCapacity h.val i = (1 / 6 : ℝ) * + ((canonicalAmount allocation h.val.source : ℝ) * workCapacity h.val i) + ring + +theorem order_capacity_eq_native (K tick : ℕ) (allocation : Allocation) + (sigma : Placement) (i : Fin 3) : + (∑ h : ActiveOrder K tick sigma, + AllFieldActiveLaws.orderMass allocation h * workCapacity h.val.val.1 i) = + (1 / 6 : ℝ) * FiniteSchedule.tickCapacity K nativeLA nativeLB + (nativeLC (fun j => (allocation.mass j : ℝ))) tick i := by + rw [order_capacity_eq_physical, physical_order_native_capacity] + +theorem order_dilation_capacity (K tick : ℕ) (allocation : Allocation) + (sigma : Placement) (i : Fin 3) : + (∑ h : ActiveOrder K tick sigma, + ((populationLength (K := K) allocation 1 : ℝ) * + AllFieldActiveLaws.orderMass allocation h) * workCapacity h.val.val.1 i) = + (populationLength (K := K) allocation 1 : ℝ) * + ((1 / 6 : ℝ) * FiniteSchedule.tickCapacity K nativeLA nativeLB + (nativeLC (fun j => (allocation.mass j : ℝ))) tick i) := by + simp_rw [mul_assoc] + rw [← Finset.mul_sum, order_capacity_eq_native] + +def physicalYield (K : ℕ) (allocation : Allocation) : ℝ := + ∑ tick ∈ Finset.range (K + 2), ∑ sigma : Placement, + Staggering.minCapacity (physicalTickCapacity allocation tick + (workCapacity (K := K)) sigma) + +def scheduledYield (K : ℕ) (allocation : Fin 3 → ℝ) : ℝ := + ∑ tick ∈ Finset.range (K + 2), Staggering.minCapacity + (FiniteSchedule.tickCapacity K nativeLA nativeLB (nativeLC allocation) tick) + +theorem physicalYield_eq_scheduled (K : ℕ) (allocation : Allocation) : + physicalYield K allocation = scheduledYield K (fun i => (allocation.mass i : ℝ)) := by + unfold physicalYield scheduledYield + apply Finset.sum_congr rfl + intro tick htick + rw [sum_physicalTick_minima, active_native_capacity] + +theorem balanced_scheduledYield (K : ℕ) (hK : 2 ≤ K) (hgap : nativeB < nativeHigh) : + scheduledYield K nativeLambda = (K : ℝ) * nativeCstar - nativeBeta := + FiniteSchedule.finite_schedule_yield K hK nativeLA nativeLB + (nativeLC nativeLambda) nativeCstar (native_balanced hgap) + +theorem nativeLC_tendsto {J : Type*} {filter : Filter J} + {allocation : J → Fin 3 → ℝ} {limit : Fin 3 → ℝ} + (h : ∀ i, Tendsto (fun j => allocation j i) filter (𝓝 (limit i))) (i : Fin 3) : + Tendsto (fun j => nativeLC (allocation j) i) filter (𝓝 (nativeLC limit i)) := by + simp_rw [nativeLC_expansion] + exact tendsto_const_nhds.sub (((h i).const_mul 3).mul_const (nativeHigh - nativeB)) + +theorem tickCapacity_tendsto (K tick : ℕ) {J : Type*} {filter : Filter J} + {allocation : J → Fin 3 → ℝ} {limit : Fin 3 → ℝ} + (h : ∀ i, Tendsto (fun j => allocation j i) filter (𝓝 (limit i))) (i : Fin 3) : + Tendsto (fun j => FiniteSchedule.tickCapacity K nativeLA nativeLB + (nativeLC (allocation j)) tick i) filter + (𝓝 (FiniteSchedule.tickCapacity K nativeLA nativeLB (nativeLC limit) tick i)) := by + have hc : Tendsto (fun j => if FiniteSchedule.stageActive K tick 2 then + nativeLC (allocation j) i else 0) filter + (𝓝 (if FiniteSchedule.stageActive K tick 2 then nativeLC limit i else 0)) := by + by_cases hh : FiniteSchedule.stageActive K tick 2 + · simpa only [hh, ite_true] using nativeLC_tendsto h i + · simpa only [hh, ite_false] using (tendsto_const_nhds : + Tendsto (fun _ : J => (0 : ℝ)) filter (𝓝 0)) + exact (tendsto_const_nhds.add tendsto_const_nhds).add hc + +theorem scheduledYield_tendsto (K : ℕ) {J : Type*} {filter : Filter J} + {allocation : J → Fin 3 → ℝ} {limit : Fin 3 → ℝ} + (h : ∀ i, Tendsto (fun j => allocation j i) filter (𝓝 (limit i))) : + Tendsto (fun j => scheduledYield K (allocation j)) filter + (𝓝 (scheduledYield K limit)) := by + unfold scheduledYield + apply tendsto_finsetSum + intro tick htick + exact (tickCapacity_tendsto K tick h 0).min + ((tickCapacity_tendsto K tick h 1).min (tickCapacity_tendsto K tick h 2)) + +theorem physicalYield_tendsto_balanced (K : ℕ) (hK : 2 ≤ K) + (hgap : nativeB < nativeHigh) (allocation : ℕ → Allocation) + (h : ∀ i, Tendsto (fun j => ((allocation j).mass i : ℝ)) atTop (𝓝 (nativeLambda i))) : + Tendsto (fun j => physicalYield K (allocation j)) atTop + (𝓝 ((K : ℝ) * nativeCstar - nativeBeta)) := by + simp_rw [physicalYield_eq_scheduled] + rw [← balanced_scheduledYield K hK hgap] + exact scheduledYield_tendsto K h + +theorem exists_balanced_allocation_sequence (hgap : nativeB < nativeHigh) + (hfeas : ∀ i, nativeCstar - (nativeLA i + nativeLB i) < nativeHigh) : + ∃ allocation : ℕ → Allocation, + ∀ i, Tendsto (fun j => ((allocation j).mass i : ℝ)) atTop (𝓝 (nativeLambda i)) := by + have hpos (i : Fin 3) : 0 < nativeLambda i := + Staggering.balanceFraction_pos nativeLA nativeLB nativeHigh nativeB hgap hfeas i + let p : FiniteLaw (Fin 3) := { + mass := nativeLambda + nonneg := fun i => (hpos i).le + total := Staggering.sum_balanceFraction nativeLA nativeLB nativeHigh nativeB hgap } + obtain ⟨q, hq⟩ := ConditionalLabels.exists_rational_law_sequence p + have he : ∀ᶠ j in atTop, ∀ i, 0 < (q j).toFiniteLaw.mass i := + Filter.eventually_all.mpr (fun i => (hq i).eventually_const_lt (hpos i)) + obtain ⟨N, hN⟩ := Filter.eventually_atTop.mp he + let allocation : ℕ → Allocation := fun j => { + mass := (q (j + N)).mass + positive := fun i => by + have hi := hN (j + N) (by omega) i + change (0 : ℝ) < ((q (j + N)).mass i : ℝ) at hi + exact_mod_cast hi + total := (q (j + N)).total } + refine ⟨allocation, fun i => ?_⟩ + exact (hq i).comp (tendsto_add_atTop_nat N) + +theorem exists_physicalYield_limit (K : ℕ) (hK : 2 ≤ K) + (hgap : nativeB < nativeHigh) + (hfeas : ∀ i, nativeCstar - (nativeLA i + nativeLB i) < nativeHigh) : + ∃ allocation : ℕ → Allocation, + Tendsto (fun j => physicalYield K (allocation j)) atTop + (𝓝 ((K : ℝ) * nativeCstar - nativeBeta)) := by + obtain ⟨allocation, ha⟩ := exists_balanced_allocation_sequence hgap hfeas + exact ⟨allocation, physicalYield_tendsto_balanced K hK hgap allocation ha⟩ + +theorem initial_capacity (K : ℕ) : + JointOrdinaryPopulationSelection.entropyRate (fun _ : Fin K => (1 : ℝ)) + (fun _ : Fin K => AllFieldInitialEntropy.orderedInitialLaw) - + JointOrdinaryPopulationSelection.degreeRate (fun _ : Fin K => (1 : ℝ)) + (fun _ : Fin K => AllFieldInitialEntropy.orderedInitialLaw) = + (K : ℝ) * AllFieldInitialEntropy.nativeH0 := + AllFieldInitialEntropy.ordinary_capacity_all_lots K + +theorem initial_dilation_capacity (K : ℕ) (allocation : Allocation) : + JointOrdinaryPopulationSelection.entropyRate + (fun _ : Fin K => (populationLength (K := K) allocation 1 : ℝ)) + (fun _ : Fin K => AllFieldInitialEntropy.orderedInitialLaw) - + JointOrdinaryPopulationSelection.degreeRate + (fun _ : Fin K => (populationLength (K := K) allocation 1 : ℝ)) + (fun _ : Fin K => AllFieldInitialEntropy.orderedInitialLaw) = + (populationLength (K := K) allocation 1 : ℝ) * + ((K : ℝ) * AllFieldInitialEntropy.nativeH0) := by + simp only [JointOrdinaryPopulationSelection.entropyRate, + JointOrdinaryPopulationSelection.degreeRate, JointOrdinaryPopulationSelection.sideDegreeRate, + AllFieldInitialEntropy.orderedInitialLaw_side_entropy, Finset.sum_const, + Finset.card_univ, Fintype.card_fin, nsmul_eq_mul, max_self] + ring + +end MatrixMultiplication.AllFieldScheduledYield + +namespace MatrixMultiplication.AllFieldScheduledPositivity + +open MatrixMultiplication.Foundation AllFieldParameters AllFieldHistory +open AllFieldInitialEntropy AllFieldNativeCapacity AllFieldScheduledYield Filter +open scoped BigOperators Topology +attribute [local instance] Classical.propDecidable Classical.decEq + +theorem nativeH0_pos : 0 < nativeH0 := by + let p := orderedInitialLaw.map (JointPopulation.shapeSide 0) + have hzero : 0 < p.mass 0 := by + have hp := AllFieldInitialGibbs.orderedInitialLaw_positive + ((0 : Fin 17), (0 : Fin 17), (16 : Fin 17)) (by decide) + exact hp.trans_le (orderedInitialLaw.mass_le_map_mass + (JointPopulation.shapeSide 0) ((0 : Fin 17), (0 : Fin 17), (16 : Fin 17))) + have hone : 0 < p.mass 1 := by + have hp := AllFieldInitialGibbs.orderedInitialLaw_positive + ((1 : Fin 17), (0 : Fin 17), (15 : Fin 17)) (by decide) + exact hp.trans_le (orderedInitialLaw.mass_le_map_mass + (JointPopulation.shapeSide 0) ((1 : Fin 17), (0 : Fin 17), (15 : Fin 17))) + have hpair : p.mass 0 + p.mass 1 ≤ 1 := by + have hs : (∑ k ∈ ({0, 1} : Finset (Fin 17)), p.mass k) ≤ + ∑ k : Fin 17, p.mass k := + Finset.sum_le_sum_of_subset_of_nonneg (Finset.subset_univ _) + (fun k _ _ => p.nonneg k) + simpa [p.total] using hs + have hterm : 0 < entropyTerm (p.mass 0) := + mul_pos_of_neg_of_neg (neg_neg_of_pos hzero) (Real.log_neg hzero (by linarith)) + have hentropy : 0 < finiteEntropy p.mass := hterm.trans_le + (Finset.single_le_sum + (fun k _ => entropyTerm_nonneg (p.nonneg k) (p.mass_le_one k)) + (Finset.mem_univ 0)) + rw [← orderedInitialLaw_side_entropy 0] + have hm : p.mass = JointPopulationRates.sideMass orderedInitialLaw.mass 0 := by + funext k + simp only [p, FiniteLaw.map_mass, JointPopulationRates.sideMass] + rw [← hm] + exact hentropy + +theorem initial_capacity_pos (K : ℕ) (hK : 0 < K) : + 0 < (K : ℝ) * nativeH0 := mul_pos (Nat.cast_pos.mpr hK) nativeH0_pos + +theorem tickCapacity_pos (K tick : ℕ) (hK : 2 ≤ K) (htick : tick < K + 2) + (a b c : Staggering.Capacity) + (ha : ∀ i, 0 < a i) (hb : ∀ i, 0 < b i) (hc : ∀ i, 0 < c i) + (i : Fin 3) : 0 < FiniteSchedule.tickCapacity K a b c tick i := by + have hA := ha i + have hB := hb i + have hC := hc i + unfold FiniteSchedule.tickCapacity + split_ifs <;> first + | positivity + | (simp only [FiniteSchedule.stageActive, Fin.val_zero, Fin.val_one] at *; omega) + +theorem physical_order_capacity_pos (K tick : ℕ) (hK : 2 ≤ K) + (htick : tick < K + 2) (allocation : Allocation) (sigma : Placement) + (ha : ∀ i, 0 < nativeLA i) (hb : ∀ i, 0 < nativeLB i) + (hc : ∀ i, 0 < nativeLC (fun j => (allocation.mass j : ℝ)) i) : + 0 < Staggering.minCapacity + (physicalTickCapacity allocation tick (workCapacity (K := K)) sigma) := by + rw [physical_order_native_capacity, PhysicalOrders.minCapacity_mul _ _ (by norm_num)] + exact mul_pos (by norm_num) (Staggering.minCapacity_pos _ + (tickCapacity_pos K tick hK htick _ _ _ ha hb hc)) + +theorem eventually_physical_order_capacity_pos (K : ℕ) (hK : 2 ≤ K) + (allocation : ℕ → Allocation) + (h : ∀ i, Tendsto (fun j => ((allocation j).mass i : ℝ)) atTop (𝓝 (nativeLambda i))) + (ha : ∀ i, 0 < nativeLA i) (hb : ∀ i, 0 < nativeLB i) + (hc : ∀ i, 0 < nativeLC nativeLambda i) : + ∀ᶠ j in atTop, ∀ tick < K + 2, ∀ sigma : Placement, + 0 < Staggering.minCapacity + (physicalTickCapacity (allocation j) tick (workCapacity (K := K)) sigma) := by + have he : ∀ᶠ j in atTop, ∀ i, + 0 < nativeLC (fun k => ((allocation j).mass k : ℝ)) i := + Filter.eventually_all.mpr fun i => (nativeLC_tendsto h i).eventually_const_lt (hc i) + filter_upwards [he] with j hj + exact fun tick htick sigma => + physical_order_capacity_pos K tick hK htick (allocation j) sigma ha hb hj + +end MatrixMultiplication.AllFieldScheduledPositivity + +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/Histories/ZeroHistorySums.lean b/lean/OAI/LinearAlgebra/MatrixFields/Histories/ZeroHistorySums.lean new file mode 100644 index 0000000000000000000000000000000000000000..802e2a993609b542ce7d1716c44bc752d0886bac --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/Histories/ZeroHistorySums.lean @@ -0,0 +1,155 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Entropy.InitialLeafRates +import OAI.LinearAlgebra.MatrixFields.Entropy.StageCTerminalRates +import OAI.LinearAlgebra.MatrixFields.Entropy.TerminalStatisticLaws + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +noncomputable section + +namespace MatrixMultiplication.AllFieldZeroHistorySums + +open AllFieldHistory AllFieldParameters AllFieldTerminalStatisticLaws +open AllFieldTerminalRates AllFieldStageCTerminalRates +open scoped BigOperators +attribute [local instance] Classical.propDecidable Classical.decEq + +def zeroRate {K : ℕ} : TerminalZero K → ℝ + | .inl h => AllFieldZeroLeafRates.fourRate (aShape h.1.val) + | .inr h => statisticRate (binaryParameter (bParent h) (bShape h.1.val)) (bWeight h) + +private theorem subtype_sum_indicator_inline_MatrixMultiplication_AllFieldZeroHistorySums {A : Type*} [Fintype A] + (P : A → Prop) [DecidablePred P] [Fintype {a // P a}] (f : A → ℝ) : + (∑ a : {a // P a}, f a.val) = ∑ a, if P a then f a else 0 := by + rw [← Finset.sum_filter] + exact (Finset.sum_subtype _ (by simp) f).symm + +private theorem sum_subtype_complement {A : Type*} [Fintype A] + (P : A → Prop) [DecidablePred P] + [Fintype {a // P a}] [Fintype {a // ¬P a}] (f : A → ℝ) : + (∑ a : {a // ¬P a}, f a.val) + (∑ a : {a // P a}, f a.val) = ∑ a, f a := by + rw [subtype_sum_indicator_inline_MatrixMultiplication_AllFieldZeroHistorySums (fun a => ¬P a) f, subtype_sum_indicator_inline_MatrixMultiplication_AllFieldZeroHistorySums P f, + ← Finset.sum_add_distrib] + apply Finset.sum_congr rfl + intro a _ + by_cases ha : P a <;> simp [ha] + +private theorem list_filter_sum_inline_MatrixMultiplication_AllFieldZeroHistorySums {A : Type*} (xs : List A) (p : A → Bool) + (f : A → ℝ) : + ((xs.filter p).map f).sum = (xs.map (fun a => if p a then f a else 0)).sum := by + induction xs with + | nil => simp + | cons a xs ih => cases hp : p a <;> simp [hp, ih] + +theorem sum_placement_rate {K : ℕ} {H : Type*} [Fintype H] + (allocation : Allocation) (canonical : H → CanonicalHistory K) (f : H → ℝ) : + (∑ h : H × Placement, (amount allocation (canonical h.1, h.2) : ℝ) * f h.1) = + ∑ h : H, (canonicalAmount allocation (canonical h) : ℝ) * f h := by + rw [Fintype.sum_prod_type] + apply Finset.sum_congr rfl + intro h _ + change (∑ phi : Placement, (amount allocation (canonical h, phi) : ℝ) * f h) = + (canonicalAmount allocation (canonical h) : ℝ) * f h + rw [← Finset.sum_mul] + have hm : (∑ phi : Placement, (amount allocation (canonical h, phi) : ℝ)) = + (canonicalAmount allocation (canonical h) : ℝ) := by + exact_mod_cast sum_placement_amount allocation (canonical h) + rw [hm] + +theorem a_zero_canonical_rate (K : ℕ) : + (∑ h : {h : AfterA K // aShape h ∉ positiveSecond}, + (aAmount h.val : ℝ) * AllFieldZeroLeafRates.fourRate (aShape h.val)) = + (K : ℝ) * S1 := by + rw [subtype_sum_indicator_inline_MatrixMultiplication_AllFieldZeroHistorySums (fun h : AfterA K => aShape h ∉ positiveSecond) + (fun h => (aAmount h : ℝ) * AllFieldZeroLeafRates.fourRate (aShape h))] + calc + _ = ∑ h : AfterA K, (aAmount h : ℝ) * + (if aShape h ∉ positiveSecond then AllFieldZeroLeafRates.fourRate (aShape h) + else 0) := by + apply Finset.sum_congr rfl + intro h _ + split_ifs <;> simp + _ = _ := by + rw [a_history_sum K (fun t => + if t ∉ positiveSecond then AllFieldZeroLeafRates.fourRate t else 0), + S1, zeroSecond, list_filter_sum_inline_MatrixMultiplication_AllFieldZeroHistorySums] + apply congrArg (fun r : ℝ => (K : ℝ) * r) + apply congrArg List.sum + apply List.map_congr_left + intro t ht + cases hp : positive t <;> simp [positiveSecond, ht, hp] + +theorem a_zero_history_rate (K : ℕ) (allocation : Allocation) : + (∑ h : AZero K, (amount allocation (history (.inl h)) : ℝ) * + AllFieldZeroLeafRates.fourRate (aShape h.1.val)) = (K : ℝ) * S1 := by + calc + _ = ∑ h : {h : AfterA K // aShape h ∉ positiveSecond}, + (aAmount h.val : ℝ) * AllFieldZeroLeafRates.fourRate (aShape h.val) := by + exact sum_placement_rate (H := {h : AfterA K // aShape h ∉ positiveSecond}) + allocation (fun h => .afterA h.val) + (fun h => AllFieldZeroLeafRates.fourRate (aShape h.val)) + _ = _ := a_zero_canonical_rate K + +theorem b_positive_secondLeafRate (K : ℕ) : + (∑ h : BPositive K, (bAmount h.val : ℝ) * + secondLeafRate (aShape h.val.1.val) (bShape h.val)) = (K : ℝ) * interiorS2 := by + calc + _ = ∑ h : BPositive K, (bAmount h.val : ℝ) * + (2 - (binaryParameter (aShape h.val.1.val) (bShape h.val) : ℝ)) * + Real.log 5 := by + apply Finset.sum_congr rfl + intro h _ + rw [secondLeafRate_positive _ h.val.1.property _ (bShape_mem h.val) h.property] + ring + _ = _ := bPositive_rate_eq_interior K + +theorem b_zero_canonical_rate (K : ℕ) : + (∑ h : {h : AfterB K // positive (bShape h) ≠ true}, + (bAmount h.val : ℝ) * secondLeafRate (aShape h.val.1.val) (bShape h.val)) + + (K : ℝ) * interiorS2 = (K : ℝ) * S2 := by + rw [← b_positive_secondLeafRate K] + rw [sum_subtype_complement (fun h : AfterB K => positive (bShape h) = true) + (fun h => (bAmount h : ℝ) * secondLeafRate (aShape h.1.val) (bShape h))] + exact b_history_sum K secondLeafRate + +theorem b_zero_rate_eq_secondLeafRate {K : ℕ} (h : BZero K) : + statisticRate (binaryParameter (bParent h) (bShape h.1.val)) (bWeight h) = + secondLeafRate (aShape h.1.val.1.val) (bShape h.1.val) := by + have hz : positive (bShape h.1.val) = false := by simpa using h.1.property + exact (secondLeafRate_zero _ h.1.val.1.property _ (bShape_mem h.1.val) hz).symm + +theorem b_zero_history_rate (K : ℕ) (allocation : Allocation) : + (∑ h : BZero K, (amount allocation (history (.inr h)) : ℝ) * + statisticRate (binaryParameter (bParent h) (bShape h.1.val)) (bWeight h)) + + (K : ℝ) * interiorS2 = (K : ℝ) * S2 := by + have he : (∑ h : BZero K, (amount allocation (history (.inr h)) : ℝ) * + statisticRate (binaryParameter (bParent h) (bShape h.1.val)) (bWeight h)) = + ∑ h : {h : AfterB K // positive (bShape h) ≠ true}, + (bAmount h.val : ℝ) * secondLeafRate (aShape h.val.1.val) (bShape h.val) := by + simp_rw [b_zero_rate_eq_secondLeafRate] + exact sum_placement_rate (H := {h : AfterB K // positive (bShape h) ≠ true}) + allocation (fun h => .afterB h.val) + (fun h => secondLeafRate (aShape h.val.1.val) (bShape h.val)) + rw [he] + exact b_zero_canonical_rate K + +theorem zero_history_sum (K : ℕ) (allocation : Allocation) : + (∑ h : TerminalZero K, (amount allocation (history h) : ℝ) * zeroRate h) = + (K : ℝ) * (S1 + S2 - interiorS2) := by + rw [Fintype.sum_sum_type] + simp only [zeroRate] + rw [a_zero_history_rate K allocation] + have hb := b_zero_history_rate K allocation + nlinarith + +end MatrixMultiplication.AllFieldZeroHistorySums + +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/Main.lean b/lean/OAI/LinearAlgebra/MatrixFields/Main.lean new file mode 100644 index 0000000000000000000000000000000000000000..0b11e1d4cfb14928a79252bec978287718ebb470 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/Main.lean @@ -0,0 +1,5 @@ +import OAI.LinearAlgebra.MatrixFields.Conclusions.AllFieldsBound +import OAI.LinearAlgebra.MatrixFields.Construction.ComplexPolynomialWitnessProduct +import OAI.LinearAlgebra.MatrixFields.Extraction.AuxiliarySeparation +import OAI.LinearAlgebra.MatrixFields.Parameters.ParametersStageC + diff --git a/lean/OAI/LinearAlgebra/MatrixFields/Model.lean b/lean/OAI/LinearAlgebra/MatrixFields/Model.lean new file mode 100644 index 0000000000000000000000000000000000000000..e0d6d741353a7bc0a072835b60a6dae645251344 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/Model.lean @@ -0,0 +1,105 @@ +import Mathlib + +namespace OAI + +open scoped BigOperators Topology Polynomial + +namespace MatrixAllFields + +noncomputable section + +open scoped BigOperators + +namespace MatrixMultiplication.Arithmetic + +inductive Gate (F Input Register : Type*) where + | constant : F → Gate F Input Register + | input : Input → Gate F Input Register + | add : Register → Register → Gate F Input Register + | sub : Register → Register → Gate F Input Register + | mul : Register → Register → Gate F Input Register + +namespace Gate + +variable {F Input Register : Type*} + +def eval [Field F] (inputs : Input → F) (registers : Register → F) : + Gate F Input Register → F + | .constant z => z + | .input i => inputs i + | .add i j => registers i + registers j + | .sub i j => registers i - registers j + | .mul i j => registers i * registers j + +def cost : Gate F Input Register → ℕ + | .constant _ => 0 + | .input _ => 0 + | .add _ _ => 1 + | .sub _ _ => 1 + | .mul _ _ => 1 + +end Gate + +inductive Program (F Input : Type*) : ℕ → Type _ where + | nil : Program F Input 0 + | step {r : ℕ} : Program F Input r → Gate F Input (Fin r) → Program F Input (r + 1) + +namespace Program + +variable {F Input : Type*} + +def eval [Field F] : {r : ℕ} → Program F Input r → (Input → F) → Fin r → F + | 0, .nil, _ => Fin.elim0 + | _ + 1, .step p g, inputs => + Fin.cases (g.eval inputs (p.eval inputs)) (p.eval inputs) + +def cost : {r : ℕ} → Program F Input r → ℕ + | 0, .nil => 0 + | _ + 1, .step p g => p.cost + g.cost + +end Program + +abbrev MatrixInput (a b c : ℕ) := (Fin a × Fin b) ⊕ (Fin b × Fin c) + +def matrixInputs {F : Type*} {a b c : ℕ} + (A : Matrix (Fin a) (Fin b) F) (B : Matrix (Fin b) (Fin c) F) : + MatrixInput a b c → F + | .inl (i, j) => A i j + | .inr (j, k) => B j k + +structure MatrixAlgorithm (F : Type*) (a b c : ℕ) where + registers : ℕ + program : Program F (MatrixInput a b c) registers + output : Fin a → Fin c → Fin registers + +namespace MatrixAlgorithm + +variable {F : Type*} [Field F] {a b c : ℕ} + +def eval (P : MatrixAlgorithm F a b c) + (A : Matrix (Fin a) (Fin b) F) (B : Matrix (Fin b) (Fin c) F) : + Matrix (Fin a) (Fin c) F := + fun i k => P.program.eval (matrixInputs A B) (P.output i k) + +def Correct (P : MatrixAlgorithm F a b c) : Prop := + ∀ (A : Matrix (Fin a) (Fin b) F) (B : Matrix (Fin b) (Fin c) F), P.eval A B = A * B + +def cost (P : MatrixAlgorithm F a b c) : ℕ := P.program.cost + +end MatrixAlgorithm + +/-- Positive slack, one uniform constant, and a correct program at every size. -/ +def AdmissibleExponent (F : Type*) [Field F] (τ : ℝ) : Prop := + ∀ ε : ℝ, 0 < ε → ∃ C : ℝ, 0 < C ∧ + ∀ n : ℕ, 1 ≤ n → ∃ P : MatrixAlgorithm F n n n, + P.Correct ∧ (P.cost : ℝ) ≤ C * (n : ℝ) ^ (τ + ε) + +def omega (F : Type*) [Field F] : ℝ := sInf {τ : ℝ | AdmissibleExponent F τ} + +end MatrixMultiplication.Arithmetic + +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/Parameters/ComplementSums.lean b/lean/OAI/LinearAlgebra/MatrixFields/Parameters/ComplementSums.lean new file mode 100644 index 0000000000000000000000000000000000000000..5b96aefe96b2a22b47209856f2fcca51161293d5 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/Parameters/ComplementSums.lean @@ -0,0 +1,113 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Entropy.StageCLaw + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +namespace MatrixMultiplication.AllFieldParameters + +def placements (s : Shape) : List Shape := + [shape (s 0) (s 1) (s 2), shape (s 0) (s 2) (s 1), + shape (s 1) (s 0) (s 2), shape (s 1) (s 2) (s 0), + shape (s 2) (s 0) (s 1), shape (s 2) (s 1) (s 0)] + +theorem initialMultiplicity_counts_placements : ∀ s ∈ sortedInitial, + (placements s).eraseDups.length = initialMultiplicity s := by decide +kernel + +theorem parents_nodup : sortedInitial.Nodup ∧ positiveInitial.Nodup ∧ + positiveSecond.Nodup ∧ zeroSecond.Nodup := by decide +kernel + +theorem split_keys_nodup : (splitKeys positiveInitial).Nodup ∧ + (splitKeys positiveSecond).Nodup := by decide +kernel + +theorem binary_keys_nodup : binaryKeys.Nodup := by decide +kernel + +theorem pair_keys_nodup : pairKeys.Nodup := by decide +kernel + +theorem stageA_children_nodup : ∀ s ∈ positiveInitial, (below s).Nodup := by decide +kernel + +theorem stageB_children_nodup : ∀ s ∈ positiveSecond, (below s).Nodup := by decide +kernel + +theorem ordered_pairs_nodup : ∀ t ∈ zeroSecond, (orderedPairs t).Nodup := by decide +kernel + +theorem initial_placements_partition : + (sortedInitial.flatMap (fun s => (placements s).eraseDups)).Perm (shapes 16) := by + decide +kernel + +end MatrixMultiplication.AllFieldParameters + +noncomputable section + +namespace MatrixMultiplication.AllFieldParameters + +theorem list_map_involution_perm {α : Type*} (xs : List α) (f : α → α) + (hn : xs.Nodup) (hm : ∀ x ∈ xs, f x ∈ xs) + (hi : ∀ x ∈ xs, f (f x) = x) : (xs.map f).Perm xs := by + have hinj : ∀ x ∈ xs, ∀ y ∈ xs, f x = f y → x = y := by + intro x hx y hy hxy + simpa only [hi x hx, hi y hy] using congrArg f hxy + apply (List.perm_ext_iff_of_nodup (List.Nodup.map_on hinj hn) hn).2 + intro y + constructor + · intro hy + obtain ⟨x, hx, rfl⟩ := List.mem_map.mp hy + exact hm x hx + · intro hy + exact List.mem_map.mpr ⟨f y, hm y hy, hi y hy⟩ + +theorem list_weighted_involution_sum {α : Type*} (xs : List α) (f : α → α) + (hn : xs.Nodup) (hm : ∀ x ∈ xs, f x ∈ xs) + (hi : ∀ x ∈ xs, f (f x) = x) (w h : α → ℝ) + (hw : ∀ x ∈ xs, w (f x) = w x) : + (xs.map (fun x => w x * h (f x))).sum = + (xs.map (fun x => w x * h x)).sum := by + calc + _ = ((xs.map f).map (fun x => w x * h x)).sum := by + congr 1 + rw [List.map_map] + apply List.map_congr_left + intro x hx + simp only [Function.comp_apply, hw x hx] + _ = _ := ((list_map_involution_perm xs f hn hm hi).map _).sum_eq + +theorem complement_involution_of_le (s u : Shape) (hu : ∀ i, u i ≤ s i) : + complement s (complement s u) = u := by + funext i + exact Nat.sub_sub_self (hu i) + +theorem stageA_complement_sum (s : Shape) (hs : s ∈ positiveInitial) + (h : Shape → ℝ) : + ((below s).map (fun u => (stageALaw s u : ℝ) * h (complement s u))).sum = + ((below s).map (fun u => (stageALaw s u : ℝ) * h u)).sum := by + apply list_weighted_involution_sum (below s) (complement s) + (stageA_children_nodup s hs) + · intro u hu + exact (stageA_support_complement s hs u hu).1 + · intro u hu + exact complement_involution_of_le s u (stageA_support_complement s hs u hu).2 + · intro u hu + rw [stageALaw_complement s u hs hu] + +theorem stageB_complement_sum (s : Shape) (hs : s ∈ positiveSecond) + (h : Shape → ℝ) : + ((below s).map (fun u => (stageBLaw s u : ℝ) * h (complement s u))).sum = + ((below s).map (fun u => (stageBLaw s u : ℝ) * h u)).sum := by + apply list_weighted_involution_sum (below s) (complement s) + (stageB_children_nodup s hs) + · intro u hu + exact (stageB_support_complement s hs u hu).1 + · intro u hu + exact complement_involution_of_le s u (stageB_support_complement s hs u hu).2 + · intro u hu + rw [stageBLaw_complement s u hs hu] + +end MatrixMultiplication.AllFieldParameters + +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/Parameters/GroupSelectionParameters.lean b/lean/OAI/LinearAlgebra/MatrixFields/Parameters/GroupSelectionParameters.lean new file mode 100644 index 0000000000000000000000000000000000000000..c687729e66104c07cd2deeb84a104bf133d563ad --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/Parameters/GroupSelectionParameters.lean @@ -0,0 +1,206 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Histories.ScheduledPositivity + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +noncomputable section + +namespace MatrixMultiplication.AllFieldActiveCapacity + +open MatrixMultiplication.Foundation AllFieldParameters AllFieldHistory +open AllFieldNativeCapacity AllFieldActiveLaws AllFieldScheduledYield +open scoped BigOperators +attribute [local instance] Classical.propDecidable Classical.decEq + +def canonicalSideMass {K : ℕ} (w : Work K) (s : Fin 3) (k : Fin 17) : ℝ := + ∑ b : w.Branch, if w.splitShape b s = k.val then (branchLaw w).mass b else 0 + +theorem placedLaw_priority_sideMass {K : ℕ} (w : PlacedWork K) + (i : Fin 3) : + JointPopulationRates.sideMass (placedLaw w).mass (w.physicalOrder i) = + canonicalSideMass w.1 (w.1.priority i) := by + funext k + rw [placedLaw_sideMass] + simp only [Fin.ext_iff, branchShape, encodePhysicalShape_side, + PlacedWork.physicalOrder, Equiv.trans_apply, Equiv.symm_apply_apply, + canonicalSideMass, branchLaw_mass] + +theorem canonicalSideMass_stageA {K : ℕ} (h : InitialPositive K) (s : Fin 3) : + canonicalSideMass (.stageA h) s = + (stageAMarginalLaw (initialShape h.val) h.property s).mass := by + funext k + rw [show (stageAMarginalLaw (initialShape h.val) h.property s).mass k = + marginal (below (initialShape h.val)) + (fun u => (stageALaw (initialShape h.val) u : ℝ)) s k from + indexedMarginalLaw_mass _ _ _ _ _ _ k] + change (∑ b : ASplit h, if (below (initialShape h.val))[b.val] s = k.val + then (stageALaw (initialShape h.val) (below (initialShape h.val))[b.val] : ℝ) + else 0) = _ + exact Fin.sum_univ_fun_getElem _ + (fun u : Shape => if u s = k.val then (stageALaw (initialShape h.val) u : ℝ) else 0) + +theorem canonicalSideMass_stageB {K : ℕ} (h : APositive K) (s : Fin 3) : + canonicalSideMass (.stageB h) s = + (stageBMarginalLaw (aShape h.val) h.property s).mass := by + funext k + rw [show (stageBMarginalLaw (aShape h.val) h.property s).mass k = + marginal (below (aShape h.val)) + (fun u => (stageBLaw (aShape h.val) u : ℝ)) s k from + indexedMarginalLaw_mass _ _ _ _ _ _ k] + change (∑ b : BSplit h, if (below (aShape h.val))[b.val] s = k.val + then (stageBLaw (aShape h.val) (below (aShape h.val))[b.val] : ℝ) + else 0) = _ + exact Fin.sum_univ_fun_getElem _ + (fun u : Shape => if u s = k.val then (stageBLaw (aShape h.val) u : ℝ) else 0) + +theorem canonicalSideMass_stageC {K : ℕ} (h : PartC K) (s : Fin 3) : + canonicalSideMass (.stageC h) s = + AllFieldStageCCapacity.stageCMarginal (cParameterParent h) (cShapeParent h) s := rfl + +theorem workCapacity_first {K : ℕ} (w : PlacedWork K) : + workCapacity w.1 0 = finiteEntropy + (JointPopulationRates.sideMass (placedLaw w).mass (w.physicalOrder 0)) := by + rw [placedLaw_priority_sideMass] + rcases w with ⟨w, phi⟩ + cases w with + | stageA h => + rw [canonicalSideMass_stageA] + exact stageACapacity_first_entropy _ h.property + | stageB h => + rw [canonicalSideMass_stageB] + exact stageBCapacity_first_entropy _ h.property + | stageC h => + rw [canonicalSideMass_stageC] + exact workCapacity_stageC h 0 + +theorem workCapacity_stageC_physical {K : ℕ} (h : PartC K) + (phi : Placement) (i : Fin 3) : + workCapacity (.stageC h) i = finiteEntropy + (JointPopulationRates.sideMass (placedLaw (.stageC h, phi)).mass + ((PlacedWork.physicalOrder (.stageC h, phi)) i)) := by + rw [placedLaw_priority_sideMass, canonicalSideMass_stageC] + exact workCapacity_stageC h i + +theorem order_first_capacity {K tick : ℕ} {sigma : Placement} + (h : ActiveOrder K tick sigma) : + workCapacity h.val.val.1 0 = finiteEntropy + (JointPopulationRates.sideMass (orderLaw h).mass (sigma 0)) := by + have hh := workCapacity_first h.val.val + rw [h.property] at hh + exact hh + +def orderEntropyRate {K tick : ℕ} (allocation : Allocation) (sigma : Placement) : ℝ := + ∑ h : ActiveOrder K tick sigma, + ((populationLength (K := K) allocation 1 : ℝ) * orderMass allocation h) * + finiteEntropy (orderLaw h).mass + +def orderNativeDegree {K tick : ℕ} (allocation : Allocation) (sigma : Placement) + (i : Fin 3) : ℝ := + ∑ h : ActiveOrder K tick sigma, + ((populationLength (K := K) allocation 1 : ℝ) * orderMass allocation h) * + (finiteEntropy (orderLaw h).mass - workCapacity h.val.val.1 i) + +theorem order_entropy_sub_native_degree (K tick : ℕ) (allocation : Allocation) + (sigma : Placement) : + orderEntropyRate (K := K) (tick := tick) allocation sigma - + max (orderNativeDegree (K := K) (tick := tick) allocation sigma 0) + (max (orderNativeDegree (K := K) (tick := tick) allocation sigma 1) + (orderNativeDegree (K := K) (tick := tick) allocation sigma 2)) = + (populationLength (K := K) allocation 1 : ℝ) * + ((1 / 6 : ℝ) * Staggering.minCapacity + (FiniteSchedule.tickCapacity K nativeLA nativeLB + (nativeLC (fun i => (allocation.mass i : ℝ))) tick)) := by + unfold orderEntropyRate orderNativeDegree + rw [JointCapacityAlgebra.weighted_joint_capacity] + simp_rw [order_dilation_capacity, ← mul_assoc] + exact PhysicalOrders.minCapacity_mul _ _ (by positivity) + +end MatrixMultiplication.AllFieldActiveCapacity + +namespace MatrixMultiplication.AllFieldGroupSelection + +open MatrixMultiplication.Foundation AllFieldHistory AllFieldActiveLaws +open AllFieldActiveCapacity AllFieldScheduledYield AllFieldNativeCapacity +open scoped BigOperators +attribute [local instance] Classical.propDecidable Classical.decEq + +variable {K tick : ℕ} + +def nativeDegree (allocation : Allocation) (sigma : Placement) : ℝ := + max (orderNativeDegree (K := K) (tick := tick) allocation sigma 0) + (max (orderNativeDegree (K := K) (tick := tick) allocation sigma 1) + (orderNativeDegree (K := K) (tick := tick) allocation sigma 2)) + +theorem targetEntropy_eq (allocation : Allocation) (sigma : Placement) : + AllFieldGroupTargetRate.groupEntropyRate (K := K) (tick := tick) + (sigma := sigma) allocation = + orderEntropyRate (K := K) (tick := tick) allocation sigma := rfl + +theorem firstDegree_nonneg (allocation : Allocation) (sigma : Placement) : + 0 ≤ orderNativeDegree (K := K) (tick := tick) allocation sigma 0 := by + apply Finset.sum_nonneg + intro h _ + apply mul_nonneg + · exact mul_nonneg (Nat.cast_nonneg _) (orderMass_nonneg allocation h) + · rw [order_first_capacity h] + exact sub_nonneg.mpr + (JointOrdinaryPopulationSelection.sideMass_entropy_le (orderLaw h) (sigma 0)) + +theorem nativeDegree_nonneg (allocation : Allocation) (sigma : Placement) : + 0 ≤ nativeDegree (K := K) (tick := tick) allocation sigma := + (firstDegree_nonneg allocation sigma).trans (le_max_left _ _) + +def nativeCapacity (allocation : Allocation) : ℝ := + (populationLength (K := K) allocation 1 : ℝ) * + ((1 / 6 : ℝ) * Staggering.minCapacity + (FiniteSchedule.tickCapacity K nativeLA nativeLB + (nativeLC (fun i => (allocation.mass i : ℝ))) tick)) + +theorem targetEntropy_sub_degree (allocation : Allocation) (sigma : Placement) : + AllFieldGroupTargetRate.groupEntropyRate (K := K) (tick := tick) + (sigma := sigma) allocation - nativeDegree (K := K) (tick := tick) allocation sigma = + nativeCapacity (K := K) (tick := tick) allocation := + order_entropy_sub_native_degree K tick allocation sigma + +def selectionHashRate (allocation : Allocation) (sigma : Placement) (slack : ℝ) : ℝ := + nativeDegree (K := K) (tick := tick) allocation sigma + slack / 2 + +theorem selectionHashRate_nonneg (allocation : Allocation) (sigma : Placement) + {slack : ℝ} (hslack : 0 < slack) : + 0 ≤ selectionHashRate (K := K) (tick := tick) allocation sigma slack := by + unfold selectionHashRate + linarith [nativeDegree_nonneg (K := K) (tick := tick) allocation sigma] + +theorem selectionHashRate_gap (allocation : Allocation) (sigma : Placement) + {slack : ℝ} (hslack : 0 < slack) : + nativeDegree (K := K) (tick := tick) allocation sigma < + selectionHashRate (K := K) (tick := tick) allocation sigma slack := by + unfold selectionHashRate + linarith + +theorem selectionHashRate_window_gap (allocation : Allocation) (sigma : Placement) + {slack : ℝ} (hslack : 0 < slack) : + nativeDegree (K := K) (tick := tick) allocation sigma + slack / 4 < + selectionHashRate (K := K) (tick := tick) allocation sigma slack := by + unfold selectionHashRate + linarith + +theorem selection_exponent (allocation : Allocation) (sigma : Placement) (slack : ℝ) : + AllFieldGroupTargetRate.groupEntropyRate (K := K) (tick := tick) + (sigma := sigma) allocation - + selectionHashRate (K := K) (tick := tick) allocation sigma slack - slack / 2 = + nativeCapacity (K := K) (tick := tick) allocation - slack := by + rw [selectionHashRate] + linarith [targetEntropy_sub_degree (K := K) (tick := tick) allocation sigma] + +end MatrixMultiplication.AllFieldGroupSelection + +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/Parameters/GroupStatisticComplement.lean b/lean/OAI/LinearAlgebra/MatrixFields/Parameters/GroupStatisticComplement.lean new file mode 100644 index 0000000000000000000000000000000000000000..ced6317840709909119c27ac6840edd63ed16d0a --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/Parameters/GroupStatisticComplement.lean @@ -0,0 +1,32 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Histories.GroupOrbitTransport + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +noncomputable section + +namespace MatrixMultiplication.AllFieldGroupStatisticComplement + +open AllFieldHistory AllFieldHistoryChildLaws + +theorem statistic_wordComplement {K tick : ℕ} {sigma : Placement} + (h : ActiveOrder K tick sigma) (w : Fin (activeHalfLength h.val) → Fin 7) : + statistic h.val (CWCompatibilityTransfer.wordComplement w) = + AllFieldGroupOrbitData.complement h (statistic h.val w) := by + rcases h with ⟨⟨⟨work, phi⟩, ht⟩, ho⟩ + cases work with + | stageA a => exact CWCompleteStatistics.four_complement w + | stageB b => exact CWCompleteStatistics.two_complement w + | stageC c => rfl + +end MatrixMultiplication.AllFieldGroupStatisticComplement + +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/Parameters/JointOrdinaryPopulationSelection.lean b/lean/OAI/LinearAlgebra/MatrixFields/Parameters/JointOrdinaryPopulationSelection.lean new file mode 100644 index 0000000000000000000000000000000000000000..db028151aeebe529abff829822096976380312fb --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/Parameters/JointOrdinaryPopulationSelection.lean @@ -0,0 +1,303 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Entropy.GroupBranchLaws +import OAI.LinearAlgebra.MatrixFields.Entropy.JointAmbientEntropy + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +namespace MatrixMultiplication.JointCapacityAlgebra + +open scoped BigOperators + +theorem total_sub_max_degrees (A X Y Z : ℝ) : + A - max (A - X) (max (A - Y) (A - Z)) = min X (min Y Z) := by + simp only [max_def, min_def] + split_ifs <;> linarith + +theorem weighted_joint_capacity {H : Type*} [Fintype H] + (mass entropy : H → ℝ) (capacity : H → Fin 3 → ℝ) : + (∑ h, mass h * entropy h) - + max (∑ h, mass h * (entropy h - capacity h 0)) + (max (∑ h, mass h * (entropy h - capacity h 1)) + (∑ h, mass h * (entropy h - capacity h 2))) = + min (∑ h, mass h * capacity h 0) + (min (∑ h, mass h * capacity h 1) (∑ h, mass h * capacity h 2)) := by + simp_rw [mul_sub, Finset.sum_sub_distrib] + exact total_sub_max_degrees _ _ _ _ + +end MatrixMultiplication.JointCapacityAlgebra + + + + + +noncomputable section + +namespace MatrixMultiplication.JointOrdinaryPopulationSelection + +open MatrixMultiplication.Foundation JointPopulation JointPopulationRates Filter +open scoped BigOperators Topology + +attribute [local instance] Classical.propDecidable + +variable {Hist : Type*} [Fintype Hist] [DecidableEq Hist] + +def entropyRate (mass : Hist → ℝ) (p : Hist → FiniteLaw Shape) : ℝ := + ∑ h, mass h * finiteEntropy (p h).mass + +def sideDegreeRate (mass : Hist → ℝ) (p : Hist → FiniteLaw Shape) (s : Fin 3) : ℝ := + ∑ h, mass h * (finiteEntropy (p h).mass - finiteEntropy (sideMass (p h).mass s)) + +def degreeRate (mass : Hist → ℝ) (p : Hist → FiniteLaw Shape) : ℝ := + max (sideDegreeRate mass p 0) (max (sideDegreeRate mass p 1) (sideDegreeRate mass p 2)) + +def sideCapacity (mass : Hist → ℝ) (p : Hist → FiniteLaw Shape) (s : Fin 3) : ℝ := + ∑ h, mass h * finiteEntropy (sideMass (p h).mass s) + +omit [DecidableEq Hist] in +theorem entropyRate_sub_degreeRate_eq (mass : Hist → ℝ) (p : Hist → FiniteLaw Shape) : + entropyRate mass p - degreeRate mass p = + min (sideCapacity mass p 0) (min (sideCapacity mass p 1) (sideCapacity mass p 2)) := by + exact JointCapacityAlgebra.weighted_joint_capacity mass + (fun h => finiteEntropy (p h).mass) (fun h s => finiteEntropy (sideMass (p h).mass s)) + +theorem sideMass_entropy_le (p : FiniteLaw Shape) (s : Fin 3) : + finiteEntropy (sideMass p.mass s) ≤ finiteEntropy p.mass := by + simpa only [finiteEntropy, FiniteLaw.map_mass, sideMass] using + p.map_entropy_le (shapeSide s) + +omit [DecidableEq Hist] in +theorem sideDegreeRate_nonneg (mass : Hist → ℝ) (p : Hist → FiniteLaw Shape) + (hmass : ∀ h, 0 ≤ mass h) (s : Fin 3) : 0 ≤ sideDegreeRate mass p s := by + exact Finset.sum_nonneg fun h _ => + mul_nonneg (hmass h) (sub_nonneg.mpr (sideMass_entropy_le (p h) s)) + +omit [DecidableEq Hist] in +theorem degreeRate_nonneg (mass : Hist → ℝ) (p : Hist → FiniteLaw Shape) + (hmass : ∀ h, 0 ≤ mass h) : 0 ≤ degreeRate mass p := + (sideDegreeRate_nonneg mass p hmass 0).trans (le_max_left _ _) + +omit [DecidableEq Hist] in +theorem sideDegreeRate_le (mass : Hist → ℝ) (p : Hist → FiniteLaw Shape) (s : Fin 3) : + sideDegreeRate mass p s ≤ degreeRate mass p := by + unfold degreeRate + fin_cases s + · exact le_max_left _ _ + · exact (le_max_left _ _).trans (le_max_right _ _) + · exact (le_max_right _ _).trans (le_max_right _ _) + +def uniformDegree (counts : Hist → Shape → ℕ) (sum : Hist → ℕ) : ℕ := + Finset.univ.sup (fun e : Target counts => + (JointAmbientDegree.neighbors counts sum (triple counts e)).card) + +theorem ordinary_neighbors_eq (counts : Hist → Shape → ℕ) (sum : Hist → ℕ) + (e : JointCoarseHashing.Triple (Position counts)) : + JointOrdinarySelection.neighbors (ambientSet counts sum) e = + JointAmbientDegree.neighbors counts sum e := by + ext neighbor + rw [JointOrdinarySelection.mem_neighbors, JointAmbientDegree.neighbors, + Finset.mem_filter] + simp only [JointCoarseHashing.SharesSide, eq_comm] + +theorem neighbors_card_le_uniformDegree (counts : Hist → Shape → ℕ) + (sum : Hist → ℕ) (e : Target counts) : + (JointOrdinarySelection.neighbors (ambientSet counts sum) (triple counts e)).card ≤ + uniformDegree counts sum := by + rw [ordinary_neighbors_eq] + exact Finset.le_sup + (f := fun e : Target counts => + (JointAmbientDegree.neighbors counts sum (triple counts e)).card) + (Finset.mem_univ e) + +theorem uniformDegree_attained (counts : Hist → Shape → ℕ) (sum : Hist → ℕ) : + ∃ e : Target counts, + (JointAmbientDegree.neighbors counts sum (triple counts e)).card = + uniformDegree counts sum := by + let : Nonempty (Target counts) := target_nonempty counts + obtain ⟨e, _, he⟩ := Finset.sup_mem_of_nonempty + (s := Finset.univ) + (f := fun e : Target counts => + (JointAmbientDegree.neighbors counts sum (triple counts e)).card) + Finset.univ_nonempty + exact ⟨e, he⟩ + +theorem uniformDegree_log_upper_of_all_targets + (counts : ℕ → Hist → Shape → ℕ) (sum : Hist → ℕ) (B : ℝ) + (hbound : ∀ᶠ N in atTop, ∀ e : Target (counts N), + Real.log ((JointAmbientDegree.neighbors (counts N) sum (triple (counts N) e)).card : ℝ) / + (N : ℝ) ≤ B) : + ∀ᶠ N in atTop, Real.log (uniformDegree (counts N) sum : ℝ) / (N : ℝ) ≤ B := by + filter_upwards [hbound] with N hN + obtain ⟨e, he⟩ := uniformDegree_attained (counts N) sum + rw [← he] + exact hN e + +omit [DecidableEq Hist] in +theorem tendsto_sum_gibbsExponent + (counts : ℕ → Hist → Shape → ℕ) (mass : Hist → ℝ) + (p : Hist → FiniteLaw Shape) (u v w : Hist → Fin 17 → ℝ) + (hcounts : ∀ h a, Tendsto (fun N : ℕ => (counts N h a : ℝ) / (N : ℝ)) + atTop (𝓝 (mass h * (p h).mass a))) (s : Fin 3) : + Tendsto (fun N => (∑ h, JointAmbientDegree.classExponent (counts N) s + (triple (counts N) (canonicalTarget (counts N))) h + (JointAmbientEntropy.gibbsCap (counts N) h (p h) (u h) (v h) (w h))) / (N : ℝ)) + atTop (𝓝 (sideDegreeRate mass p s)) := by + have hsize (h : Hist) := tendsto_total_div_of_coordinate_rates + (fun N => counts N h) (mass h) (p h).mass (p h).total (hcounts h) + have hcap (h : Hist) := JointAmbientEntropy.tendsto_classScale_mul_gibbsCap + counts h (p h) (mass h) (u h) (v h) (w h) (hcounts h) + have hside (h : Hist) := tendsto_weighted_target_side_entropy counts + (fun N => canonicalTarget (counts N)) mass (fun h => (p h).mass) + (fun h => (p h).total) hcounts h s + have h := JointAmbientRateLimit.tendsto_sum_classExponent_div_nat counts s + (fun N h => JointAmbientEntropy.gibbsCap (counts N) h (p h) (u h) (v h) (w h)) + mass (fun h => mass h * finiteEntropy (p h).mass) + (fun h => mass h * finiteEntropy (sideMass (p h).mass s)) hsize + (fun h => by + simpa only [JointAmbientEntropy.classScale, Positions, Fintype.card_fin] using hcap h) + (fun h => by + simpa only [Positions, Fintype.card_fin] using hside h) + simpa only [sideDegreeRate, mul_sub] using h + +theorem uniformDegree_log_upper_of_word_support + (counts : ℕ → Hist → Shape → ℕ) (sum : Hist → ℕ) (mass : Hist → ℝ) + (p : Hist → FiniteLaw Shape) (u v w : Hist → Fin 17 → ℝ) (c : Hist → ℝ) + (hmass : ∀ h, 0 ≤ mass h) + (hsupport : ∀ᶠ N in atTop, ∀ h word, + JointAmbientDegree.localAllowed (counts N) sum h word → + ∀ i, 0 < (p h).mass (word i)) + (hlog : ∀ h a, 0 < (p h).mass a → Real.log ((p h).mass a) = + u h (shapeSide 0 a) + v h (shapeSide 1 a) + w h (shapeSide 2 a) - c h) + (hcounts : ∀ h a, Tendsto (fun N : ℕ => (counts N h a : ℝ) / (N : ℝ)) + atTop (𝓝 (mass h * (p h).mass a))) + (η : ℝ) (hη : 0 < η) : + ∀ᶠ N in atTop, Real.log (uniformDegree (counts N) sum : ℝ) / (N : ℝ) ≤ + degreeRate mass p + η := by + apply uniformDegree_log_upper_of_all_targets counts sum + apply JointAmbientRateLimit.eventually_all_target_degree_upper counts sum + (fun N h => JointAmbientEntropy.gibbsCap (counts N) h (p h) (u h) (v h) (w h)) + (sideDegreeRate mass p) (degreeRate mass p) (degreeRate_nonneg mass p hmass) + _ (tendsto_sum_gibbsExponent counts mass p u v w hcounts) + (sideDegreeRate_le mass p) η hη + filter_upwards [hsupport] with N hN + intro h word hw + exact JointAmbientEntropy.localAllowed_entropy_le_of_word_support + (counts N) sum h word (p h) (u h) (v h) (w h) (c h) + (hN h word hw) (hlog h) hw + +theorem uniformDegree_log_upper + (counts : ℕ → Hist → Shape → ℕ) (sum : Hist → ℕ) (mass : Hist → ℝ) + (p : Hist → FiniteLaw Shape) (u v w : Hist → Fin 17 → ℝ) (c : Hist → ℝ) + (hmass : ∀ h, 0 ≤ mass h) + (hsupport : ∀ h (a : Shape), + a.1.val + a.2.1.val + a.2.2.val = sum h → 0 < (p h).mass a) + (hlog : ∀ h a, 0 < (p h).mass a → Real.log ((p h).mass a) = + u h (shapeSide 0 a) + v h (shapeSide 1 a) + w h (shapeSide 2 a) - c h) + (hcounts : ∀ h a, Tendsto (fun N : ℕ => (counts N h a : ℝ) / (N : ℝ)) + atTop (𝓝 (mass h * (p h).mass a))) + (η : ℝ) (hη : 0 < η) : + ∀ᶠ N in atTop, Real.log (uniformDegree (counts N) sum : ℝ) / (N : ℝ) ≤ + degreeRate mass p + η := + uniformDegree_log_upper_of_word_support counts sum mass p u v w c hmass + (Eventually.of_forall fun _ h word hw i => hsupport h (word i) (hw.1 i)) + hlog hcounts η hη + +def selectionHashRate (mass : Hist → ℝ) (p : Hist → FiniteLaw Shape) (ε : ℝ) : ℝ := + degreeRate mass p + ε / 2 + +theorem eventually_exists_selection_of_word_support + (counts : ℕ → Hist → Shape → ℕ) (sum : Hist → ℕ) (mass : Hist → ℝ) + (p : Hist → FiniteLaw Shape) (u v w : Hist → Fin 17 → ℝ) (c : Hist → ℝ) + (hmass : ∀ h, 0 ≤ mass h) + (hcountSupport : ∀ N h a, 0 < counts N h a → + a.1.val + a.2.1.val + a.2.2.val = sum h) + (hsupport : ∀ᶠ N in atTop, ∀ h word, + JointAmbientDegree.localAllowed (counts N) sum h word → + ∀ i, 0 < (p h).mass (word i)) + (hlog : ∀ h a, 0 < (p h).mass a → Real.log ((p h).mass a) = + u h (shapeSide 0 a) + v h (shapeSide 1 a) + w h (shapeSide 2 a) - c h) + (hcounts : ∀ h a, Tendsto (fun N : ℕ => (counts N h a : ℝ) / (N : ℝ)) + atTop (𝓝 (mass h * (p h).mass a))) + {ε : ℝ} (hε : 0 < ε) : + ∀ᶠ N in atTop, + ∃ (s : JointCoarseHashing.Sample (Position (counts N)) + (JointOrdinarySelection.hashLevel (selectionHashRate mass p ε) N)) + (G : Finset (Target (counts N))), + G.card = ⌊Real.exp ((N : ℝ) * (entropyRate mass p - degreeRate mass p - ε))⌋₊ ∧ + (∀ e ∈ G, JointOrdinarySelection.Good + (JointOrdinarySelection.hashLevel (selectionHashRate mass p ε) N) + (JointOrdinarySelection.hashSet (selectionHashRate mass p ε) N) + (ambientSet (counts N) sum) (triple (counts N) e) s) ∧ + (G : Set (Target (counts N))).Pairwise (fun e f => + ¬ JointCoarseHashing.SharesSide (triple (counts N) e) (triple (counts N) f)) := by + have hD : 0 ≤ degreeRate mass p := degreeRate_nonneg mass p hmass + have hH : 0 ≤ selectionHashRate mass p ε := by unfold selectionHashRate; linarith + have hgap : degreeRate mass p < selectionHashRate mass p ε := by + unfold selectionHashRate + linarith + have htarget (N : ℕ) (e : Target (counts N)) : + triple (counts N) e ∈ ambientSet (counts N) sum := by + apply targetSet_subset_ambient (counts N) sum (hcountSupport N) + exact Finset.mem_image.mpr ⟨e, Finset.mem_univ _, rfl⟩ + have hpos : ∀ᶠ N in atTop, 0 < Fintype.card (Target (counts N)) := + Eventually.of_forall fun N => Fintype.card_pos_iff.mpr (target_nonempty (counts N)) + have htargetRate : Tendsto (fun N : ℕ => + Real.log (Fintype.card (Target (counts N)) : ℝ) / (N : ℝ)) + atTop (𝓝 (entropyRate mass p)) := + tendsto_log_target_card_div_of_coordinate_rates counts mass + (fun h => (p h).mass) hmass (fun h => (p h).total) hcounts + have hselection := JointOrdinarySelection.eventually_exists_selection + (fun N => ambientSet (counts N) sum) + (fun N (position : Position (counts N)) => sum position.1) + (fun N => triple (counts N)) (fun N => triple_injective (counts N)) + (fun N f hf => (Finset.mem_filter.mp hf).2.1) htarget + (fun N => uniformDegree (counts N) sum) + (fun N e => neighbors_card_le_uniformDegree (counts N) sum e) + hH hgap (uniformDegree_log_upper_of_word_support counts sum mass p u v w c + hmass hsupport hlog hcounts) + hpos htargetRate (show 0 < ε / 2 by linarith) + have heq : entropyRate mass p - selectionHashRate mass p ε - ε / 2 = + entropyRate mass p - degreeRate mass p - ε := by unfold selectionHashRate; ring + simpa only [heq] using hselection + +theorem eventually_exists_selection + (counts : ℕ → Hist → Shape → ℕ) (sum : Hist → ℕ) (mass : Hist → ℝ) + (p : Hist → FiniteLaw Shape) (u v w : Hist → Fin 17 → ℝ) (c : Hist → ℝ) + (hmass : ∀ h, 0 ≤ mass h) + (hcountSupport : ∀ N h a, 0 < counts N h a → + a.1.val + a.2.1.val + a.2.2.val = sum h) + (hsupport : ∀ h (a : Shape), + a.1.val + a.2.1.val + a.2.2.val = sum h → 0 < (p h).mass a) + (hlog : ∀ h a, 0 < (p h).mass a → Real.log ((p h).mass a) = + u h (shapeSide 0 a) + v h (shapeSide 1 a) + w h (shapeSide 2 a) - c h) + (hcounts : ∀ h a, Tendsto (fun N : ℕ => (counts N h a : ℝ) / (N : ℝ)) + atTop (𝓝 (mass h * (p h).mass a))) + {ε : ℝ} (hε : 0 < ε) : + ∀ᶠ N in atTop, + ∃ (s : JointCoarseHashing.Sample (Position (counts N)) + (JointOrdinarySelection.hashLevel (selectionHashRate mass p ε) N)) + (G : Finset (Target (counts N))), + G.card = ⌊Real.exp ((N : ℝ) * (entropyRate mass p - degreeRate mass p - ε))⌋₊ ∧ + (∀ e ∈ G, JointOrdinarySelection.Good + (JointOrdinarySelection.hashLevel (selectionHashRate mass p ε) N) + (JointOrdinarySelection.hashSet (selectionHashRate mass p ε) N) + (ambientSet (counts N) sum) (triple (counts N) e) s) ∧ + (G : Set (Target (counts N))).Pairwise (fun e f => + ¬ JointCoarseHashing.SharesSide (triple (counts N) e) (triple (counts N) f)) := + eventually_exists_selection_of_word_support counts sum mass p u v w c + hmass hcountSupport + (Eventually.of_forall fun _ h word hw i => hsupport h (word i) (hw.1 i)) + hlog hcounts hε + +end MatrixMultiplication.JointOrdinaryPopulationSelection + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/Parameters/JointPopulation.lean b/lean/OAI/LinearAlgebra/MatrixFields/Parameters/JointPopulation.lean new file mode 100644 index 0000000000000000000000000000000000000000..426c0938816d3d68d693e386e0c22769577f2197 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/Parameters/JointPopulation.lean @@ -0,0 +1,148 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Extraction.JointMaskedSelection +import OAI.LinearAlgebra.MatrixFields.Extraction.JointPairClassWindows + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section + +namespace MatrixMultiplication.JointPopulation + +open MatrixMultiplication.Foundation +open scoped BigOperators + +attribute [local instance] Classical.propDecidable + +structure HistoryKey where + lot : ℕ + initialShape : Fin 3 → ℕ + physicalPlacement : Equiv.Perm (Fin 3) + parentSplits : List ((Fin 3 → ℕ) × Bool) + subdivisions : List ℕ + +abbrev Shape := Fin 17 × Fin 17 × Fin 17 + +def shapeSide (s : Fin 3) (u : Shape) : Fin 17 := + if s = 0 then u.1 else if s = 1 then u.2.1 else u.2.2 + +variable {H : Type*} [Fintype H] [DecidableEq H] + (counts : H → Shape → ℕ) + +abbrev Positions (h : H) := Fin (∑ u, counts h u) +abbrev Target := ∀ h, ExactWords (counts h) + +def canonicalTarget : Target counts := + fun h => Classical.choice (exactWords_nonempty (counts h)) + +theorem target_card : Fintype.card (Target counts) = + ∏ h, Nat.multinomial Finset.univ (counts h) := by + simp only [Target, Fintype.card_pi, exactWords_card] + +omit [Fintype H] [DecidableEq H] in +theorem target_nonempty : Nonempty (Target counts) := ⟨canonicalTarget counts⟩ + +abbrev Position := Σ h, Positions counts h + +def triple (e : Target counts) : JointCoarseHashing.Triple (Position counts) := + (fun p => (e p.1).val p.2 |>.1, + fun p => (e p.1).val p.2 |>.2.1, + fun p => (e p.1).val p.2 |>.2.2) + +omit [Fintype H] [DecidableEq H] in +theorem triple_injective : Function.Injective (triple counts) := by + intro e f h + funext c + apply Subtype.ext + funext i + apply Prod.ext + · exact congrArg (fun t : JointCoarseHashing.Triple (Position counts) => t.1 ⟨c, i⟩) h + · apply Prod.ext + · exact congrArg (fun t : JointCoarseHashing.Triple (Position counts) => t.2.1 ⟨c, i⟩) h + · exact congrArg (fun t : JointCoarseHashing.Triple (Position counts) => t.2.2 ⟨c, i⟩) h + +def targetSet : Finset (JointCoarseHashing.Triple (Position counts)) := + Finset.univ.image (triple counts) + +theorem targetSet_card : (targetSet counts).card = + ∏ h, Nat.multinomial Finset.univ (counts h) := by + rw [targetSet, Finset.card_image_of_injective _ (triple_injective counts)] + simpa using target_card counts + +abbrev Class (e : Target counts) (h : H) (u : Shape) := + {i : Positions counts h // (e h).val i = u} + +omit [Fintype H] [DecidableEq H] in +theorem class_card (e : Target counts) (h : H) (u : Shape) : + Fintype.card (Class counts e h u) = counts h u := (e h).property u + +omit [Fintype H] [DecidableEq H] in +theorem symbol_count_pos (e : Target counts) (h : H) (i : Positions counts h) : + 0 < counts h ((e h).val i) := by + rw [← class_card counts e h ((e h).val i)] + exact Fintype.card_pos_iff.mpr ⟨⟨i, rfl⟩⟩ + +omit [Fintype H] [DecidableEq H] in +theorem triple_support (sum : H → ℕ) + (hsupport : ∀ h u, 0 < counts h u → + u.1.val + u.2.1.val + u.2.2.val = sum h) (e : Target counts) : + JointCoarseHashing.HasSupportSum (fun p : Position counts => sum p.1) (triple counts e) := by + intro p + exact hsupport p.1 ((e p.1).val p.2) (symbol_count_pos counts e p.1 p.2) + +omit [Fintype H] [DecidableEq H] in +theorem exists_position_permutation (e f : Target counts) : + ∃ p : ∀ h, Equiv.Perm (Positions counts h), ∀ h, (e h).val ∘ p h = (f h).val := by + have hp : ∀ h, ∃ p : Equiv.Perm (Positions counts h), (e h).val ∘ p = (f h).val := by + intro h + apply (samePopulation_iff_permutation _ _).mp + intro u + rw [(e h).property, (f h).property] + choose p hp using hp + exact ⟨p, hp⟩ + +def sideWord (s : Fin 3) (t : JointCoarseHashing.Triple (Position counts)) + (h : H) : Positions counts h → Fin 17 := + fun i => shapeSide s (t.1 ⟨h, i⟩, t.2.1 ⟨h, i⟩, t.2.2 ⟨h, i⟩) + +omit [Fintype H] [DecidableEq H] in +theorem sideWord_triple (s : Fin 3) (e : Target counts) (h : H) : + sideWord counts s (triple counts e) h = shapeSide s ∘ (e h).val := rfl + +omit [Fintype H] [DecidableEq H] in +theorem marginal_population_eq (e f : Target counts) (h : H) (s : Fin 3) (a : Fin 17) : + wordPopulation (sideWord counts s (triple counts e) h) a = + wordPopulation (sideWord counts s (triple counts f) h) a := by + obtain ⟨p, hp⟩ := exists_position_permutation counts e f + rw [sideWord_triple, sideWord_triple, ← hp h] + exact (wordPopulation_reindex (shapeSide s ∘ (e h).val) (p h) a).symm + +def ambientSet (sum : H → ℕ) : Finset (JointCoarseHashing.Triple (Position counts)) := + Finset.univ.filter fun t => + JointCoarseHashing.HasSupportSum (fun p : Position counts => sum p.1) t ∧ + ∀ h s a, wordPopulation (sideWord counts s t h) a = + wordPopulation (sideWord counts s (triple counts (canonicalTarget counts)) h) a + +theorem targetSet_subset_ambient (sum : H → ℕ) + (hsupport : ∀ h u, 0 < counts h u → + u.1.val + u.2.1.val + u.2.2.val = sum h) : + targetSet counts ⊆ ambientSet counts sum := by + intro t ht + obtain ⟨e, _, rfl⟩ := Finset.mem_image.mp ht + apply Finset.mem_filter.mpr + refine ⟨Finset.mem_univ _, triple_support counts sum hsupport e, ?_⟩ + intro h s a + exact marginal_population_eq counts e (canonicalTarget counts) h s a + +end MatrixMultiplication.JointPopulation + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/Parameters/JointPopulationMixedCompatibility.lean b/lean/OAI/LinearAlgebra/MatrixFields/Parameters/JointPopulationMixedCompatibility.lean new file mode 100644 index 0000000000000000000000000000000000000000..1dbbca631576b5c7c7107f0595a42b3e1487d921 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/Parameters/JointPopulationMixedCompatibility.lean @@ -0,0 +1,654 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Construction.JointCanonicalMixed +import OAI.LinearAlgebra.MatrixFields.Construction.JointCompatibilityIncidence +import OAI.LinearAlgebra.MatrixFields.Tensors.CWStrandCompatibility + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section + +namespace MatrixMultiplication.JointPopulationCompatibility + +open MatrixMultiplication.Foundation JointPopulation JointTypeCounts InheritedMasks +open JointCompatibilityIncidence +open scoped BigOperators + +attribute [local instance] Classical.propDecidable + +variable {H : Type*} [Fintype H] [DecidableEq H] + (counts : H → Shape → ℕ) + +abbrev ClassKey := H × Fin 17 + +abbrev ClassPos (b : Position counts → Fin 17) (c : ClassKey (H := H)) := + {i : Positions counts c.1 // b ⟨c.1, i⟩ = c.2} + +def classCounts (s : Fin 3) (c : ClassKey (H := H)) (u : Shape) : ℕ := + if shapeSide s u = c.2 then counts c.1 u else 0 + +abbrev FixedSideTargets (s : Fin 3) (b : Position counts → Fin 17) := + {e : Target counts // ∀ h i, shapeSide s ((e h).val i) = b ⟨h, i⟩} + +def candidateEquiv (s : Fin 3) (b : Position counts → Fin 17) : + FixedSideTargets counts s b ≃ + FixedClassWords (ClassPos counts b) (fun _ => Shape) (classCounts counts s) := by + let split : FixedSideTargets counts s b ≃ + (∀ h, FixedCoarseWords (counts h) (shapeSide s) (fun i => b ⟨h, i⟩)) := + { toFun := fun e h => ⟨(e.val h).val, (e.val h).property, e.property h⟩ + invFun := fun v => + ⟨fun h => ⟨(v h).val, (v h).property.1⟩, fun h => (v h).property.2⟩ + left_inv := by + intro e + apply Subtype.ext + funext h + apply Subtype.ext + rfl + right_inv := by + intro v + funext h + apply Subtype.ext + rfl } + let perHistory (h : H) := + (fixedCoarseWordsEquiv (counts h) (shapeSide s) (fun i => b ⟨h, i⟩)).trans + (conditionalWordsEquiv (fun i : Positions counts h => b ⟨h, i⟩) + (fun a u => if shapeSide s u = a then counts h u else 0)) + refine split.trans ((Equiv.piCongrRight perHistory).trans ?_) + exact + { toFun := fun v c => v c.1 c.2 + invFun := fun v h a => v (h, a) + left_inv := by intro v; rfl + right_inv := by + intro v + funext c + rcases c with ⟨h, a⟩ + rfl } + +omit [Fintype H] [DecidableEq H] in +@[simp] theorem candidateEquiv_apply (s : Fin 3) (b : Position counts → Fin 17) + (e : FixedSideTargets counts s b) (c : ClassKey (H := H)) (i : ClassPos counts b c) : + ((candidateEquiv counts s b e) c).val i = (e.val c.1).val i.val := rfl + +omit [Fintype H] [DecidableEq H] in +theorem classCounts_size (s : Fin 3) (b : Position counts → Fin 17) + (e : FixedSideTargets counts s b) (c : ClassKey (H := H)) : + Fintype.card (ClassPos counts b c) = ∑ u, classCounts counts s c u := by + calc + Fintype.card (ClassPos counts b c) = + ∑ u, wordPopulation ((candidateEquiv counts s b e) c).val u := + (wordPopulation_sum _).symm + _ = ∑ u, classCounts counts s c u := + Finset.sum_congr rfl fun u _ => ((candidateEquiv counts s b e) c).property u + +theorem fixedSideTargets_card (s : Fin 3) (b : Position counts → Fin 17) + (e : FixedSideTargets counts s b) : + Fintype.card (FixedSideTargets counts s b) = + ∏ c : ClassKey (H := H), Nat.multinomial Finset.univ (classCounts counts s c) := by + rw [Fintype.card_congr (candidateEquiv counts s b)] + exact fixedClassWords_card _ _ _ (classCounts_size counts s b e) + +def shapeStatisticCount {A : Type*} [Fintype A] [DecidableEq A] + (e : Target counts) (h : H) (u : Shape) (f : Positions counts h → A) (a : A) : ℕ := + wordPopulation (fun i : Class counts e h u => f i.val) a + +theorem scaled_count_window {x n p χ : ℝ} (hn : 0 < n) + (hw : |x / n - p| ≤ χ) : |x - n * p| ≤ n * χ := by + calc + |x - n * p| = |(x / n - p) * n| := by + rw [sub_mul, div_mul_cancel₀ _ hn.ne', mul_comm p n] + _ = |x / n - p| * n := by rw [abs_mul, abs_of_pos hn] + _ ≤ χ * n := mul_le_mul_of_nonneg_right hw hn.le + _ = n * χ := mul_comm _ _ + +omit [Fintype H] [DecidableEq H] in +theorem shape_count_window_of_typeWindow {A : Type*} [Fintype A] [DecidableEq A] + (e : Target counts) (h : H) (u : Shape) (f : Positions counts h → A) + (law : A → ℝ) (χ : ℝ) + (hw : 0 < counts h u → typeWindow law χ (fun i : Class counts e h u => f i.val)) : + ∀ a, |(shapeStatisticCount counts e h u f a : ℝ) - + (counts h u : ℝ) * law a| ≤ (counts h u : ℝ) * χ := by + intro a + by_cases hn : 0 < counts h u + · apply scaled_count_window (Nat.cast_pos.mpr hn) + simpa only [empiricalLaw, class_card, shapeStatisticCount] using hw hn a + · have hn0 : counts h u = 0 := Nat.eq_zero_of_not_pos hn + have hc : shapeStatisticCount counts e h u f a = 0 := by + apply Nat.eq_zero_of_le_zero + let forget : {i : Class counts e h u // f i.val = a} → Class counts e h u := + Subtype.val + have hinj : Function.Injective forget := Subtype.val_injective + have hbound := Fintype.card_le_of_injective forget hinj + calc + shapeStatisticCount counts e h u f a ≤ Fintype.card (Class counts e h u) := + hbound + _ = 0 := (class_card counts e h u).trans hn0 + simp only [hc, hn0, Nat.cast_zero, zero_mul, sub_zero, abs_zero, le_refl] + +theorem jointCount_le_population {P U Z A : Type*} + [Fintype P] [Fintype U] [DecidableEq U] [DecidableEq A] + (w : P → U) (z : P → Z) (part : Z → A) (u : U) (a : A) : + jointCount w z part u a ≤ wordPopulation w u := by + exact Fintype.card_le_of_injective + (fun i : {i : P // w i = u ∧ part (z i) = a} => + (⟨i.val, i.property.1⟩ : {i : P // w i = u})) + (fun _ _ h => Subtype.ext + (congrArg (fun j : {i : P // w i = u} => j.val) h)) + +omit [Fintype H] [DecidableEq H] in +theorem class_jointCount_eq {A : Type*} [Fintype A] [DecidableEq A] + (s : Fin 3) (b : Position counts → Fin 17) (e : FixedSideTargets counts s b) + (c : ClassKey (H := H)) (u : Shape) (hu : shapeSide s u = c.2) + (f : Positions counts c.1 → A) (a : A) : + jointCount ((candidateEquiv counts s b e) c).val + (fun i => f i.val) id u a = shapeStatisticCount counts (A := A) e.val c.1 u f a := by + let eFiber : {i : ClassPos counts b c // + ((candidateEquiv counts s b e) c).val i = u ∧ f i.val = a} ≃ + {i : Class counts e.val c.1 u // f i.val = a} := + { toFun := fun i => ⟨⟨i.val.val, by + simpa only [candidateEquiv_apply] using i.property.1⟩, i.property.2⟩ + invFun := fun i => + ⟨⟨i.val.val, by + calc + b ⟨c.1, i.val.val⟩ = shapeSide s ((e.val c.1).val i.val.val) := + (e.property c.1 i.val.val).symm + _ = shapeSide s u := congrArg (shapeSide s) i.val.property + _ = c.2 := hu⟩, + by simpa only [candidateEquiv_apply] using i.val.property, i.property⟩ + left_inv := by + intro i + apply Subtype.ext + apply Subtype.ext + rfl + right_inv := by + intro i + apply Subtype.ext + apply Subtype.ext + rfl } + unfold jointCount shapeStatisticCount wordPopulation + exact Fintype.card_congr eFiber + +omit [Fintype H] [DecidableEq H] in +theorem class_jointCount_zero {A : Type*} [DecidableEq A] + (s : Fin 3) (b : Position counts → Fin 17) (e : FixedSideTargets counts s b) + (c : ClassKey (H := H)) (u : Shape) (hu : shapeSide s u ≠ c.2) + (f : ClassPos counts b c → A) (a : A) : + jointCount ((candidateEquiv counts s b e) c).val f id u a = 0 := by + apply Nat.eq_zero_of_le_zero + calc + jointCount ((candidateEquiv counts s b e) c).val f id u a ≤ + wordPopulation ((candidateEquiv counts s b e) c).val u := + jointCount_le_population _ _ _ _ _ + _ = classCounts counts s c u := ((candidateEquiv counts s b e) c).property u + _ = 0 := ite_eq_right hu + +omit [Fintype H] [DecidableEq H] in +theorem side_compatibility_iff_class_counts + (A : ClassKey (H := H) → Type*) + [∀ c, Fintype (A c)] [∀ c, DecidableEq (A c)] + (s : Fin 3) (b : Position counts → Fin 17) (e : FixedSideTargets counts s b) + (f : ∀ h k, Positions counts h → A (h, k)) + (designated : ClassKey (H := H) → Shape → Prop) + (law : ∀ c, Shape → A c → ℝ) (χ : ℝ) : + (∀ h u, designated (h, shapeSide s u) u → ∀ a : A (h, shapeSide s u), + |(shapeStatisticCount counts (A := A (h, shapeSide s u)) + e.val h u (f h (shapeSide s u)) a : ℝ) - + (counts h u : ℝ) * law (h, shapeSide s u) u a| ≤ (counts h u : ℝ) * χ) ↔ + (∀ c u, designated c u → ∀ a : A c, + |(jointCount ((candidateEquiv counts s b e) c).val + (fun i => f c.1 c.2 i.val) id u a : ℝ) - + (classCounts counts s c u : ℝ) * law c u a| ≤ + (classCounts counts s c u : ℝ) * χ) := by + constructor + · intro h c u hd a + by_cases hu : shapeSide s u = c.2 + · rw [class_jointCount_eq counts s b e c u hu] + rcases c with ⟨h₀, k⟩ + dsimp at hu + subst k + simpa only [classCounts, ite_eq_left rfl, ite_true] using h h₀ u hd a + · rw [class_jointCount_zero counts s b e c u hu] + simp only [classCounts, ite_eq_right hu, Nat.cast_zero, zero_mul, sub_zero, abs_zero, le_refl] + · intro h h₀ u hd a + have hh := h (h₀, shapeSide s u) u hd a + rw [class_jointCount_eq counts s b e (h₀, shapeSide s u) u rfl] at hh + simpa only [classCounts, ite_eq_left rfl, ite_true] using hh + +section Statistics + +variable (L R : H → Type*) + (SL SR : ClassKey (H := H) → Type*) + [∀ c, Fintype (SL c)] [∀ c, DecidableEq (SL c)] + [∀ c, Fintype (SR c)] [∀ c, DecidableEq (SR c)] + (leftStatistic : ∀ c, L c.1 → SL c) + (rightStatistic : ∀ c, R c.1 → SR c) + +def statisticWord (b : Position counts → Fin 17) + (w : JointCanonicalization.RawPairs counts L R) (c : ClassKey (H := H)) : + ClassPos counts b c → SL c × SR c := + fun i => (leftStatistic c (w c.1 i.val).1, rightStatistic c (w c.1 i.val).2) + +def statisticCounts (b : Position counts → Fin 17) + (w : JointCanonicalization.RawPairs counts L R) (c : ClassKey (H := H)) : + SL c × SR c → ℕ := + wordPopulation (statisticWord counts L R SL SR leftStatistic rightStatistic b w c) + +def statisticElement (b : Position counts → Fin 17) + (w : JointCanonicalization.RawPairs counts L R) : + FixedClassWords (ClassPos counts b) (fun c => SL c × SR c) + (statisticCounts counts L R SL SR leftStatistic rightStatistic b w) := + fun c => ⟨statisticWord counts L R SL SR leftStatistic rightStatistic b w c, fun _ => rfl⟩ + +variable (designatedLeft designatedRight : ClassKey (H := H) → Shape → Prop) + (leftLaw : ∀ c, Shape → SL c → ℝ) (rightLaw : ∀ c, Shape → SR c → ℝ) (χ : ℝ) + +def Compatible (s : Fin 3) (e : Target counts) + (w : JointCanonicalization.RawPairs counts L R) : Prop := + (∀ h u, designatedLeft (h, shapeSide s u) u → ∀ a, + |(shapeStatisticCount counts e h u + (fun i => leftStatistic (h, shapeSide s u) (w h i).1) a : ℝ) - + (counts h u : ℝ) * leftLaw (h, shapeSide s u) u a| ≤ (counts h u : ℝ) * χ) ∧ + (∀ h u, designatedRight (h, shapeSide s u) u → ∀ a, + |(shapeStatisticCount counts e h u + (fun i => rightStatistic (h, shapeSide s u) (w h i).2) a : ℝ) - + (counts h u : ℝ) * rightLaw (h, shapeSide s u) u a| ≤ (counts h u : ℝ) * χ) + +omit [Fintype H] [DecidableEq H] in +theorem compatible_of_designated_windows (s : Fin 3) (e : Target counts) + (w : JointCanonicalization.RawPairs counts L R) + (hl : ∀ h u, 0 < counts h u → designatedLeft (h, shapeSide s u) u → + typeWindow (leftLaw (h, shapeSide s u) u) χ + (fun i : Class counts e h u => leftStatistic (h, shapeSide s u) (w h i.val).1)) + (hr : ∀ h u, 0 < counts h u → designatedRight (h, shapeSide s u) u → + typeWindow (rightLaw (h, shapeSide s u) u) χ + (fun i : Class counts e h u => rightStatistic (h, shapeSide s u) (w h i.val).2)) : + Compatible counts L R SL SR leftStatistic rightStatistic designatedLeft designatedRight + leftLaw rightLaw χ s e w := by + constructor + · intro h u hd + exact shape_count_window_of_typeWindow counts e h u _ _ χ (fun hn => hl h u hn hd) + · intro h u hd + exact shape_count_window_of_typeWindow counts e h u _ _ χ (fun hn => hr h u hn hd) + +omit [Fintype H] [DecidableEq H] in +theorem compatible_iff_kernel (s : Fin 3) (b : Position counts → Fin 17) + (e : FixedSideTargets counts s b) (w : JointCanonicalization.RawPairs counts L R) : + Compatible counts L R SL SR leftStatistic rightStatistic designatedLeft designatedRight + leftLaw rightLaw χ s e.val w ↔ + DesignatedCompatibility (ClassPos counts b) (fun _ => Shape) (fun c => SL c × SR c) + SL SR (classCounts counts s) + (statisticCounts counts L R SL SR leftStatistic rightStatistic b w) + (fun _ p => p.1) (fun _ p => p.2) designatedLeft designatedRight leftLaw rightLaw χ + (candidateEquiv counts s b e) + (statisticElement counts L R SL SR leftStatistic rightStatistic b w) := by + exact and_congr + (side_compatibility_iff_class_counts counts SL s b e + (fun h k i => leftStatistic (h, k) (w h i).1) designatedLeft leftLaw χ) + (side_compatibility_iff_class_counts counts SR s b e + (fun h k i => rightStatistic (h, k) (w h i).2) designatedRight rightLaw χ) + +def compatibleTargetCount (s : Fin 3) (b : Position counts → Fin 17) + (w : JointCanonicalization.RawPairs counts L R) : ℕ := + Fintype.card {e : FixedSideTargets counts s b // + Compatible counts L R SL SR leftStatistic rightStatistic designatedLeft designatedRight + leftLaw rightLaw χ s e.val w} + +theorem compatibleTargetCount_eq_kernel (s : Fin 3) (b : Position counts → Fin 17) + (w : JointCanonicalization.RawPairs counts L R) : + compatibleTargetCount counts L R SL SR leftStatistic rightStatistic + designatedLeft designatedRight leftLaw rightLaw χ s b w = + compatibleCandidateCount (ClassPos counts b) (fun _ => Shape) (fun c => SL c × SR c) + SL SR (classCounts counts s) + (statisticCounts counts L R SL SR leftStatistic rightStatistic b w) + (fun _ p => p.1) (fun _ p => p.2) designatedLeft designatedRight leftLaw rightLaw χ + (statisticElement counts L R SL SR leftStatistic rightStatistic b w) := by + exact Fintype.card_congr ((candidateEquiv counts s b).subtypeEquiv + (fun e => compatible_iff_kernel counts L R SL SR leftStatistic rightStatistic + designatedLeft designatedRight leftLaw rightLaw χ s b e w)) + +theorem compatibleTarget_incidence (s : Fin 3) (b : Position counts → Fin 17) + (e : FixedSideTargets counts s b) (w : JointCanonicalization.RawPairs counts L R) : + Fintype.card (FixedSideTargets counts s b) * + compatibleStatisticCount (ClassPos counts b) (fun _ => Shape) (fun c => SL c × SR c) + SL SR (classCounts counts s) + (statisticCounts counts L R SL SR leftStatistic rightStatistic b w) + (fun _ p => p.1) (fun _ p => p.2) designatedLeft designatedRight leftLaw rightLaw χ + (candidateEquiv counts s b e) = + Fintype.card (FixedClassWords (ClassPos counts b) (fun c => SL c × SR c) + (statisticCounts counts L R SL SR leftStatistic rightStatistic b w)) * + compatibleTargetCount counts L R SL SR leftStatistic rightStatistic + designatedLeft designatedRight leftLaw rightLaw χ s b w := by + rw [compatibleTargetCount_eq_kernel, + Fintype.card_congr (candidateEquiv counts s b)] + exact designated_incidence_count _ _ _ _ _ _ _ _ _ _ _ _ _ _ + (candidateEquiv counts s b e) + (statisticElement counts L R SL SR leftStatistic rightStatistic b w) + +def compatibleByTriple (s : Fin 3) + (t : JointCoarseHashing.Triple (Position counts)) + (w : JointCanonicalization.RawPairs counts L R) : Prop := + ∃ e : Target counts, triple counts e = t ∧ + Compatible counts L R SL SR leftStatistic rightStatistic designatedLeft designatedRight + leftLaw rightLaw χ s e w + +omit [Fintype H] [DecidableEq H] in +theorem compatibleByTriple_target (s : Fin 3) (e : Target counts) + (w : JointCanonicalization.RawPairs counts L R) : + compatibleByTriple counts L R SL SR leftStatistic rightStatistic + designatedLeft designatedRight leftLaw rightLaw χ s (triple counts e) w ↔ + Compatible counts L R SL SR leftStatistic rightStatistic designatedLeft designatedRight + leftLaw rightLaw χ s e w := by + constructor + · rintro ⟨f, hf, hw⟩ + have he : f = e := triple_injective counts hf + subst f + exact hw + · intro hw + exact ⟨e, rfl, hw⟩ + +def compatibleWithCoarse + (ownCoarse : JointCanonicalization.RawPairs counts L R → Position counts → Fin 17) + (s : Fin 3) (t : JointCoarseHashing.Triple (Position counts)) + (w : JointCanonicalization.RawPairs counts L R) : Prop := + (∀ h i, sideWord counts s t h i = ownCoarse w ⟨h, i⟩) ∧ + compatibleByTriple counts L R SL SR leftStatistic rightStatistic + designatedLeft designatedRight leftLaw rightLaw χ s t w + +omit [Fintype H] [DecidableEq H] in +theorem compatibleWithCoarse_target + (ownCoarse : JointCanonicalization.RawPairs counts L R → Position counts → Fin 17) + (s : Fin 3) (e : Target counts) (w : JointCanonicalization.RawPairs counts L R) : + compatibleWithCoarse counts L R SL SR leftStatistic rightStatistic + designatedLeft designatedRight leftLaw rightLaw χ ownCoarse s (triple counts e) w ↔ + (∀ h i, shapeSide s ((e h).val i) = ownCoarse w ⟨h, i⟩) ∧ + Compatible counts L R SL SR leftStatistic rightStatistic designatedLeft designatedRight + leftLaw rightLaw χ s e w := by + exact and_congr Iff.rfl (compatibleByTriple_target counts L R SL SR leftStatistic + rightStatistic designatedLeft designatedRight leftLaw rightLaw χ s e w) + +omit [Fintype H] [DecidableEq H] in +theorem compatibleWithCoarse_shares_side + (ownCoarse : JointCanonicalization.RawPairs counts L R → Position counts → Fin 17) + (s : Fin 3) (t t' : JointCoarseHashing.Triple (Position counts)) + (w : JointCanonicalization.RawPairs counts L R) + (ht : compatibleWithCoarse counts L R SL SR leftStatistic rightStatistic + designatedLeft designatedRight leftLaw rightLaw χ ownCoarse s t w) + (ht' : compatibleWithCoarse counts L R SL SR leftStatistic rightStatistic + designatedLeft designatedRight leftLaw rightLaw χ ownCoarse s t' w) : + ∀ h, sideWord counts s t h = sideWord counts s t' h := by + intro h + funext i + exact (ht.1 h i).trans (ht'.1 h i).symm + +theorem compatibleWithCoarse_target_count + (ownCoarse : JointCanonicalization.RawPairs counts L R → Position counts → Fin 17) + (s : Fin 3) (w : JointCanonicalization.RawPairs counts L R) : + Fintype.card {e : Target counts // + compatibleWithCoarse counts L R SL SR leftStatistic rightStatistic + designatedLeft designatedRight leftLaw rightLaw χ ownCoarse s (triple counts e) w} = + compatibleTargetCount counts L R SL SR leftStatistic rightStatistic + designatedLeft designatedRight leftLaw rightLaw χ s (ownCoarse w) w := by + apply Fintype.card_congr + exact (Equiv.subtypeEquivRight (fun e => compatibleWithCoarse_target counts L R SL SR + leftStatistic rightStatistic designatedLeft designatedRight leftLaw rightLaw χ + ownCoarse s e w)).trans (Equiv.subtypeSubtypeEquivSubtypeInter + (fun e : Target counts => ∀ h i, shapeSide s ((e h).val i) = ownCoarse w ⟨h, i⟩) + (fun e => Compatible counts L R SL SR leftStatistic rightStatistic + designatedLeft designatedRight leftLaw rightLaw χ s e w)).symm + +end Statistics + +def designatedYLeft (_ : ClassKey (H := H)) (u : Shape) : Prop := + (shapeSide 2 u).val = 0 + +def designatedYRight (parentShape : H → Fin 3 → ℕ) + (c : ClassKey (H := H)) (u : Shape) : Prop := + parentShape c.1 2 - (shapeSide 2 u).val = 0 + +def designatedZLeft (_ : ClassKey (H := H)) (u : Shape) : Prop := + (shapeSide 0 u).val * (shapeSide 1 u).val = 0 + +def designatedZRight (parentShape : H → Fin 3 → ℕ) + (c : ClassKey (H := H)) (u : Shape) : Prop := + (parentShape c.1 0 - (shapeSide 0 u).val) * + (parentShape c.1 1 - (shapeSide 1 u).val) = 0 + +end MatrixMultiplication.JointPopulationCompatibility + + + + + + +namespace MatrixMultiplication.JointPopulationMixedNonzero + +open MatrixMultiplication.Foundation JointPopulation JointCanonicalization JointCanonicalCW +open JointCanonicalMixed CWStrands InheritedMasks +open scoped BigOperators + +attribute [local instance] Classical.propDecidable + +variable {H F : Type*} [Fintype H] [DecidableEq H] [Field F] + +omit [DecidableEq H] in +theorem class_half_products_nonzero + (counts : H → Shape → ℕ) (leftLength rightLength : H → ℕ) + (parentShape : H → Fin 3 → ℕ) (sharing : H → Bool) + (hleft : ∀ h, leftLength h ≤ 8) + (hsupp : ∀ h u, 0 < counts h u → sharing h = true → + ∀ s, shapeNat u s ≤ parentShape h s) + (e : Target counts) + (x y z : RawPairs counts (Left leftLength) (Right rightLength)) + (hsource : sourceTensor counts (Left leftLength) (Right rightLength) + (inputTensor (F := F) leftLength rightLength parentShape sharing) x y z ≠ 0) + (hx : coarseMask counts (Left leftLength) (Right rightLength) + (coarse leftLength rightLength hleft) 0 e x) + (hy : coarseMask counts (Left leftLength) (Right rightLength) + (coarse leftLength rightLength hleft) 1 e y) + (hz : coarseMask counts (Left leftLength) (Right rightLength) + (coarse leftLength rightLength hleft) 2 e z) + (h : H) (u : Shape) (hn : 0 < counts h u) (hh : sharing h = true) : + (∏ i : Class counts e h u, + shapeTensor (F := F) (Fin (leftLength h)) (shapeNat u) + (x h i.val).1 (y h i.val).1 (z h i.val).1) ≠ 0 ∧ + (∏ i : Class counts e h u, + shapeTensor (F := F) (Fin (rightLength h)) (parentShape h - shapeNat u) + (x h i.val).2 (y h i.val).2 (z h i.val).2) ≠ 0 := by + change (∏ h' : H, ∏ i : Positions counts h', + inputTensor (F := F) leftLength rightLength parentShape sharing h' + (x h' i) (y h' i) (z h' i)) ≠ 0 at hsource + have hparent (i : Positions counts h) : + inputTensor (F := F) leftLength rightLength parentShape sharing h + (x h i) (y h i) (z h i) ≠ 0 := + Finset.prod_ne_zero_iff.mp + (Finset.prod_ne_zero_iff.mp hsource h (Finset.mem_univ h)) i (Finset.mem_univ i) + have hhalves (i : Class counts e h u) : + shapeTensor (F := F) (Fin (leftLength h)) (shapeNat u) + (x h i.val).1 (y h i.val).1 (z h i.val).1 * + shapeTensor (F := F) (Fin (rightLength h)) (parentShape h - shapeNat u) + (x h i.val).2 (y h i.val).2 (z h i.val).2 ≠ 0 := by + have hx' : coarse leftLength rightLength hleft 0 h (x h i.val) = u.1 := by + simpa [shapeSide, i.property] using hx h i.val + have hy' : coarse leftLength rightLength hleft 1 h (y h i.val) = u.2.1 := by + simpa [shapeSide, i.property] using hy h i.val + have hz' : coarse leftLength rightLength hleft 2 h (z h i.val) = u.2.2 := by + simpa [shapeSide, i.property] using hz h i.val + have hblock : block (Left leftLength) (Right rightLength) + (inputTensor (F := F) leftLength rightLength parentShape sharing) + (coarse leftLength rightLength hleft) (h, u) + (x h i.val) (y h i.val) (z h i.val) ≠ 0 := by + simpa [block, hx', hy', hz'] using hparent i.val + rw [block_eq_children leftLength rightLength parentShape sharing hleft h u + (hsupp h u hn)] at hblock + simpa only [Tensor.product, leftTensor, childRight, hh, ↓reduceIte, rightTensor] + using hblock + constructor + · apply Finset.prod_ne_zero_iff.mpr + intro i _ + exact (mul_ne_zero_iff.mp (hhalves i)).1 + · apply Finset.prod_ne_zero_iff.mpr + intro i _ + exact (mul_ne_zero_iff.mp (hhalves i)).2 + +end MatrixMultiplication.JointPopulationMixedNonzero + + + + + + +namespace MatrixMultiplication.JointPopulationMixedCompatibility + +open MatrixMultiplication.Foundation JointPopulation JointCanonicalization JointCanonicalCW +open JointPopulationCompatibility JointPopulationMixedNonzero CWStrands InheritedMasks +open CWStrandCompatibility +open scoped BigOperators + +attribute [local instance] Classical.propDecidable + +def sharingDesignated {H : Type*} (sharing : H → Bool) + (d : JointPopulationCompatibility.ClassKey (H := H) → Shape → Prop) + (c : JointPopulationCompatibility.ClassKey (H := H)) (u : Shape) : Prop := + sharing c.1 = true ∧ d c u + +variable {H F : Type*} [Fintype H] [DecidableEq H] [Field F] + (counts : H → Shape → ℕ) (leftLength rightLength : H → ℕ) + (parentShape : H → Fin 3 → ℕ) (sharing : H → Bool) (hleft : ∀ h, leftLength h ≤ 8) + (hsupport : ∀ h u, 0 < counts h u → sharing h = true → ∀ s, shapeNat u s ≤ parentShape h s) + (e : Target counts) + (x y z : RawPairs counts (Left leftLength) (Right rightLength)) + (hsource : sourceTensor counts (Left leftLength) (Right rightLength) + (JointCanonicalMixed.inputTensor (F := F) leftLength rightLength parentShape sharing) x y z ≠ 0) + (hx : coarseMask counts (Left leftLength) (Right rightLength) + (coarse leftLength rightLength hleft) 0 e x) + (hy : coarseMask counts (Left leftLength) (Right rightLength) + (coarse leftLength rightLength hleft) 1 e y) + (hz : coarseMask counts (Left leftLength) (Right rightLength) + (coarse leftLength rightLength hleft) 2 e z) + +variable (SL SR : H → Type*) + [∀ h, Fintype (SL h)] [∀ h, DecidableEq (SL h)] + [∀ h, Fintype (SR h)] [∀ h, DecidableEq (SR h)] + (leftStatistic : ∀ h, Left leftLength h → SL h) + (rightStatistic : ∀ h, Right rightLength h → SR h) + (κLeft : ∀ h, SL h ≃ SL h) (κRight : ∀ h, SR h ≃ SR h) + (hstatLeft : ∀ h w, leftStatistic h (CWCompatibilityTransfer.wordComplement w) = + κLeft h (leftStatistic h w)) + (hstatRight : ∀ h w, rightStatistic h (CWCompatibilityTransfer.wordComplement w) = + κRight h (rightStatistic h w)) + (xLeftLaw yLeftLaw : ∀ c : JointCanonicalization.ClassKey (H := H), SL c.1 → ℝ) + (xRightLaw yRightLaw : ∀ c : JointCanonicalization.ClassKey (H := H), SR c.1 → ℝ) + (χ : ℝ) + +include hsource hx hy hz hsupport hstatLeft hstatRight + +omit [DecidableEq H] in +theorem source_implies_compatibleY + (leftLaw : ∀ c : JointPopulationCompatibility.ClassKey (H := H), Shape → SL c.1 → ℝ) + (rightLaw : ∀ c : JointPopulationCompatibility.ClassKey (H := H), Shape → SR c.1 → ℝ) + (hlaw : ∀ h u, 0 < counts h u → sharing h = true → designatedYLeft (h, shapeSide 1 u) u → + leftLaw (h, shapeSide 1 u) u = xLeftLaw (h, u) ∘ (κLeft h).symm) + (hrlaw : ∀ h u, 0 < counts h u → sharing h = true → designatedYRight parentShape (h, shapeSide 1 u) u → + rightLaw (h, shapeSide 1 u) u = xRightLaw (h, u) ∘ (κRight h).symm) + (huseX : ∀ h u, 0 < counts h u → sharing h = true → + typeWindow (xLeftLaw (h, u)) χ + (fun i : Class counts e h u => leftStatistic h (x h i.val).1) ∧ + typeWindow (xRightLaw (h, u)) χ + (fun i : Class counts e h u => rightStatistic h (x h i.val).2)) : + Compatible counts (Left leftLength) (Right rightLength) + (fun c => SL c.1) (fun c => SR c.1) + (fun c => leftStatistic c.1) (fun c => rightStatistic c.1) + (sharingDesignated sharing designatedYLeft) + (sharingDesignated sharing (designatedYRight parentShape)) leftLaw rightLaw χ 1 e y := by + apply compatible_of_designated_windows + · intro h u hn hd + rw [hlaw h u hn hd.1 hd.2] + exact zeroZ_transfer (fun _ : Class counts e h u => shapeNat u) + (fun i => (x h i.val).1) (fun i => (y h i.val).1) (fun i => (z h i.val).1) + (class_half_products_nonzero counts leftLength rightLength parentShape sharing hleft + hsupport e x y z hsource hx hy hz h u hn hd.1).1 + (leftStatistic h) (κLeft h) (hstatLeft h) (xLeftLaw (h, u)) χ + (fun _ => hd.2) (huseX h u hn hd.1).1 + · intro h u hn hd + rw [hrlaw h u hn hd.1 hd.2] + exact zeroZ_transfer (fun _ : Class counts e h u => parentShape h - shapeNat u) + (fun i => (x h i.val).2) (fun i => (y h i.val).2) (fun i => (z h i.val).2) + (class_half_products_nonzero counts leftLength rightLength parentShape sharing hleft + hsupport e x y z hsource hx hy hz h u hn hd.1).2 + (rightStatistic h) (κRight h) (hstatRight h) (xRightLaw (h, u)) χ + (fun _ => hd.2) (huseX h u hn hd.1).2 + +omit [DecidableEq H] in +theorem source_implies_compatibleZ + (leftLaw : ∀ c : JointPopulationCompatibility.ClassKey (H := H), Shape → SL c.1 → ℝ) + (rightLaw : ∀ c : JointPopulationCompatibility.ClassKey (H := H), Shape → SR c.1 → ℝ) + (hlaw : ∀ h u, 0 < counts h u → sharing h = true → designatedZLeft (h, shapeSide 2 u) u → + leftLaw (h, shapeSide 2 u) u = + (if shapeNat u 1 = 0 then xLeftLaw (h, u) else yLeftLaw (h, u)) ∘ + (κLeft h).symm) + (hrlaw : ∀ h u, 0 < counts h u → sharing h = true → designatedZRight parentShape (h, shapeSide 2 u) u → + rightLaw (h, shapeSide 2 u) u = + (if (parentShape h - shapeNat u) 1 = 0 then xRightLaw (h, u) + else yRightLaw (h, u)) ∘ (κRight h).symm) + (huseX : ∀ h u, 0 < counts h u → sharing h = true → + typeWindow (xLeftLaw (h, u)) χ + (fun i : Class counts e h u => leftStatistic h (x h i.val).1) ∧ + typeWindow (xRightLaw (h, u)) χ + (fun i : Class counts e h u => rightStatistic h (x h i.val).2)) + (huseY : ∀ h u, 0 < counts h u → sharing h = true → + typeWindow (yLeftLaw (h, u)) χ + (fun i : Class counts e h u => leftStatistic h (y h i.val).1) ∧ + typeWindow (yRightLaw (h, u)) χ + (fun i : Class counts e h u => rightStatistic h (y h i.val).2)) : + Compatible counts (Left leftLength) (Right rightLength) + (fun c => SL c.1) (fun c => SR c.1) + (fun c => leftStatistic c.1) (fun c => rightStatistic c.1) + (sharingDesignated sharing designatedZLeft) + (sharingDesignated sharing (designatedZRight parentShape)) leftLaw rightLaw χ 2 e z := by + apply compatible_of_designated_windows + · intro h u hn hd + rw [hlaw h u hn hd.1 hd.2] + have hp := (class_half_products_nonzero counts leftLength rightLength parentShape sharing hleft + hsupport e x y z hsource hx hy hz h u hn hd.1).1 + by_cases hzeroY : shapeNat u 1 = 0 + · rw [ite_eq_left hzeroY] + exact zeroY_transfer (fun _ : Class counts e h u => shapeNat u) + (fun i => (x h i.val).1) (fun i => (y h i.val).1) (fun i => (z h i.val).1) hp + (leftStatistic h) (κLeft h) (hstatLeft h) (xLeftLaw (h, u)) χ + (fun _ => hzeroY) (huseX h u hn hd.1).1 + · rw [ite_eq_right hzeroY] + have hzeroX : shapeNat u 0 = 0 := + (Nat.mul_eq_zero.mp hd.2).resolve_right hzeroY + exact zeroX_transfer (fun _ : Class counts e h u => shapeNat u) + (fun i => (x h i.val).1) (fun i => (y h i.val).1) (fun i => (z h i.val).1) hp + (leftStatistic h) (κLeft h) (hstatLeft h) (yLeftLaw (h, u)) χ + (fun _ => hzeroX) (huseY h u hn hd.1).1 + · intro h u hn hd + rw [hrlaw h u hn hd.1 hd.2] + have hp := (class_half_products_nonzero counts leftLength rightLength parentShape sharing hleft + hsupport e x y z hsource hx hy hz h u hn hd.1).2 + by_cases hzeroY : (parentShape h - shapeNat u) 1 = 0 + · rw [ite_eq_left hzeroY] + exact zeroY_transfer (fun _ : Class counts e h u => parentShape h - shapeNat u) + (fun i => (x h i.val).2) (fun i => (y h i.val).2) (fun i => (z h i.val).2) hp + (rightStatistic h) (κRight h) (hstatRight h) (xRightLaw (h, u)) χ + (fun _ => hzeroY) (huseX h u hn hd.1).2 + · rw [ite_eq_right hzeroY] + have hzeroX : (parentShape h - shapeNat u) 0 = 0 := + (Nat.mul_eq_zero.mp hd.2).resolve_right hzeroY + exact zeroX_transfer (fun _ : Class counts e h u => parentShape h - shapeNat u) + (fun i => (x h i.val).2) (fun i => (y h i.val).2) (fun i => (z h i.val).2) hp + (rightStatistic h) (κRight h) (hstatRight h) (yRightLaw (h, u)) χ + (fun _ => hzeroX) (huseY h u hn hd.1).2 + +end MatrixMultiplication.JointPopulationMixedCompatibility + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/Parameters/NativeCapacity.lean b/lean/OAI/LinearAlgebra/MatrixFields/Parameters/NativeCapacity.lean new file mode 100644 index 0000000000000000000000000000000000000000..1740fb21321ceeea062bbbf0612896a7b5e8da7b --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/Parameters/NativeCapacity.lean @@ -0,0 +1,159 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Entropy.InitialLeafRates + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +noncomputable section + +namespace MatrixMultiplication.AllFieldNativeCapacity + +open MatrixMultiplication.Foundation AllFieldParameters AllFieldHistory +open scoped BigOperators +attribute [local instance] Classical.propDecidable Classical.decEq + +variable {A : Type*} [Fintype A] + +def marginal (support : List Shape) (p : Shape → ℝ) (side : Fin 3) + (k : Fin 17) : ℝ := + (support.map fun u => if u side = k.val then p u else 0).sum + +def pairLaw (support : List Shape) (s : Shape) (p : Shape → ℝ) + (q : Shape → A → ℝ) (ij : A × A) : ℝ := + (support.map fun u => p u * q u ij.1 * q (complement s u) ij.2).sum + +def designated (priority : Placement) (position : Fin 3) (u : Shape) : Prop := + if position = 1 then u (priority 2) = 0 + else u (priority 0) = 0 ∨ u (priority 1) = 0 + +def singletonEntropy (support : List Shape) (p : Shape → ℝ) + (priority : Placement) (position : Fin 3) (q : Shape → A → ℝ) : ℝ := + (support.map fun u => if designated priority position u then + p u * homogeneousEntropy (q u) else 0).sum + +def residualLaw (support : List Shape) (p : Shape → ℝ) + (priority : Placement) (position : Fin 3) (q : Shape → A → ℝ) + (k : Fin 17) (a : A) : ℝ := + (support.map fun u => + if ¬ designated priority position u ∧ u (priority position) = k.val + then p u * q u a else 0).sum + +def groupedEntropy (support : List Shape) (p : Shape → ℝ) + (priority : Placement) (position : Fin 3) (q : Shape → A → ℝ) : ℝ := + singletonEntropy support p priority position q + + ∑ k : Fin 17, homogeneousEntropy (residualLaw support p priority position q k) + +def nativeCapacity (support : List Shape) (s : Shape) (p : Shape → ℝ) + (priority : Placement) (q : Shape → Fin 3 → A → ℝ) : Staggering.Capacity := + fun i => if i = 0 then homogeneousEntropy (marginal support p (priority 0)) + else homogeneousEntropy (pairLaw support s p (fun u => q u (priority i))) - + 2 * groupedEntropy support p priority i (fun u => q u (priority i)) + +@[simp] theorem nativeCapacity_first (support : List Shape) (s : Shape) + (p : Shape → ℝ) (priority : Placement) (q : Shape → Fin 3 → A → ℝ) : + nativeCapacity support s p priority q 0 = + homogeneousEntropy (marginal support p (priority 0)) := by + simp [nativeCapacity] + +theorem nativeCapacity_sharing (support : List Shape) (s : Shape) + (p : Shape → ℝ) (priority : Placement) (q : Shape → Fin 3 → A → ℝ) + (i : Fin 3) (hi : i ≠ 0) : + nativeCapacity support s p priority q i = + homogeneousEntropy (pairLaw support s p (fun u => q u (priority i))) - + 2 * groupedEntropy support p priority i (fun u => q u (priority i)) := by + simp only [nativeCapacity, ite_eq_right hi] + +theorem residual_entropy_eq_mass_mul (support : List Shape) (p : Shape → ℝ) + (priority : Placement) (position : Fin 3) (q : Shape → A → ℝ) (k : Fin 17) + (hm : ∑ a, residualLaw support p priority position q k a ≠ 0) : + homogeneousEntropy (residualLaw support p priority position q k) = + (∑ a, residualLaw support p priority position q k a) * + finiteEntropy (fun a => residualLaw support p priority position q k a / + ∑ b, residualLaw support p priority position q k b) := + homogeneousEntropy_eq_mass_mul _ hm + +def stageACapacity (g : Shape) : Staggering.Capacity := + nativeCapacity (below g) g (fun u => (stageALaw g u : ℝ)) + (Equiv.refl (Fin 3)) (fun u w a => (halfLaw u w a : ℝ)) + +def stageBCapacity (t : Shape) : Staggering.Capacity := + nativeCapacity (below t) t (fun u => (stageBLaw t u : ℝ)) + (stageBPriority t) (fun u w a => (littleLaw t u w a : ℝ)) + +def stageCCapacity (t u : Shape) (part : Fin 3) : Staggering.Capacity := + fun i => if i = part then binaryEntropyRate (binaryParameter t u) else Real.log 2 + +def nativeLA : Staggering.Capacity := fun i => + (positiveInitial.map fun g => (initialLaw g : ℝ) * stageACapacity g i).sum + +def nativeLB : Staggering.Capacity := fun i => + (positiveSecond.map fun t => (secondMass t : ℝ) * stageBCapacity t i).sum + +def interiorPairs : List (Shape × Shape) := + positiveSecond.flatMap fun t => + ((below t).filter positive).map fun u => (t, u) + +def interiorMass (tu : Shape × Shape) : ℝ := littleMass tu.1 tu.2 + +def interiorEntropy (tu : Shape × Shape) : ℝ := + binaryEntropyRate (binaryParameter tu.1 tu.2) + +def nativeT : ℝ := (interiorPairs.map interiorMass).sum + +def nativeB : ℝ := + (interiorPairs.map fun tu => interiorMass tu * + (2 * Real.log 2 + interiorEntropy tu)).sum / 3 + +def nativeHigh : ℝ := nativeT * Real.log 2 + +def nativeCstar : ℝ := Staggering.totalCapacity nativeLA nativeLB nativeB + +def nativeLambda : Fin 3 → ℝ := + Staggering.balanceFraction nativeLA nativeLB nativeHigh nativeB + +def nativeLC (allocation : Fin 3 → ℝ) : Staggering.Capacity := fun i => + (interiorPairs.map fun tu => interiorMass tu * + ((1 - allocation i) * Real.log 2 + allocation i * interiorEntropy tu)).sum + +theorem nativeLC_expansion (allocation : Fin 3 → ℝ) (i : Fin 3) : + nativeLC allocation i = nativeHigh - 3 * allocation i * (nativeHigh - nativeB) := by + unfold nativeLC nativeHigh nativeT nativeB + have h : ∀ xs : List (Shape × Shape), + (xs.map fun tu => interiorMass tu * + ((1 - allocation i) * Real.log 2 + allocation i * interiorEntropy tu)).sum = + (xs.map interiorMass).sum * Real.log 2 - 3 * allocation i * + ((xs.map interiorMass).sum * Real.log 2 - + (xs.map fun tu => interiorMass tu * + (2 * Real.log 2 + interiorEntropy tu)).sum / 3) := by + intro xs + induction xs with + | nil => simp + | cons tu xs ih => simp only [List.map_cons, List.sum_cons]; rw [ih]; ring + exact h interiorPairs + +theorem nativeLC_balanced (hgap : nativeB < nativeHigh) (i : Fin 3) : + nativeLC nativeLambda i = nativeCstar - (nativeLA i + nativeLB i) := by + rw [nativeLC_expansion] + exact Staggering.thirdCapacity_eq nativeLA nativeLB nativeHigh nativeB hgap i + +theorem native_balanced (hgap : nativeB < nativeHigh) (i : Fin 3) : + nativeLA i + nativeLB i + nativeLC nativeLambda i = nativeCstar := by + rw [nativeLC_balanced hgap] + ring + +def nativeBeta : ℝ := + Staggering.boundaryDeficit nativeLA nativeLB (nativeLC nativeLambda) nativeCstar + +theorem nativeBeta_nonnegative (hgap : nativeB < nativeHigh) : 0 ≤ nativeBeta := + Staggering.boundaryDeficit_nonneg _ _ _ _ (native_balanced hgap) + +end MatrixMultiplication.AllFieldNativeCapacity + +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/Parameters/ParametersCompatibility.lean b/lean/OAI/LinearAlgebra/MatrixFields/Parameters/ParametersCompatibility.lean new file mode 100644 index 0000000000000000000000000000000000000000..f1521f6fa4e8d1ad1dc2f31095dfa82ceead66ad --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/Parameters/ParametersCompatibility.lean @@ -0,0 +1,56 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Entropy.StageCLaw + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +namespace MatrixMultiplication.AllFieldParameters + +def statisticLaw (d : ℚ) (k : Fin 5) (i : Fin 6) : ℚ := + if k.val = 2 then + if i = 2 then 1 - d else if i = 3 then d else 0 + else if i = singletonSlot k.val then 1 else 0 + +def statisticComplement (k : Fin 5) : Fin 5 := ⟨4 - k.val, by omega⟩ + +theorem statisticLaw_complement (d : ℚ) (k : Fin 5) (i : Fin 6) : + statisticLaw d k (kappa i) = statisticLaw d (statisticComplement k) i := by + fin_cases k <;> fin_cases i <;> rfl + +theorem statisticLaw_outside_support (d : ℚ) (k : Fin 5) (i : Fin 6) + (h : statisticWeight i ≠ k.val) : statisticLaw d k i = 0 := by + fin_cases k <;> fin_cases i + all_goals first | rfl | exact False.elim (h (by decide)) + +theorem littleLaw_eq_statisticLaw (t u : Shape) (w : Fin 3) (hw : u w < 5) (i : Fin 6) : + littleLaw t u w i = statisticLaw (binaryParameter t u) ⟨u w, hw⟩ i := rfl + +theorem littleLaw_outside_support (t u : Shape) (w : Fin 3) (hw : u w < 5) (i : Fin 6) + (h : statisticWeight i ≠ u w) : littleLaw t u w i = 0 := + statisticLaw_outside_support _ ⟨u w, hw⟩ i h + +theorem littleLaw_complement (t u : Shape) (w v : Fin 3) + (hw : u w < 5) (hv : u v < 5) (hsum : u w + u v = 4) (i : Fin 6) : + littleLaw t u w (kappa i) = littleLaw t u v i := by + rw [littleLaw_eq_statisticLaw t u w hw, littleLaw_eq_statisticLaw t u v hv] + have hk : (⟨u v, hv⟩ : Fin 5) = statisticComplement ⟨u w, hw⟩ := by + apply Fin.ext + simp only [statisticComplement] + omega + rw [hk] + exact statisticLaw_complement _ _ _ + +theorem child_statistic_weight_bounded : ∀ t ∈ positiveSecond, ∀ u ∈ below t, + ∀ w : Fin 3, u w < 5 := by decide +kernel + +theorem pair_complement_involution (i j : Fin 6) : + (kappa (kappa i), kappa (kappa j)) = (i, j) := by simp [kappa_involution] + +end MatrixMultiplication.AllFieldParameters + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/Parameters/ParametersContractions.lean b/lean/OAI/LinearAlgebra/MatrixFields/Parameters/ParametersContractions.lean new file mode 100644 index 0000000000000000000000000000000000000000..f564fe8ba94aa6e19003bd21c824ea869d588dd2 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/Parameters/ParametersContractions.lean @@ -0,0 +1,453 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Certificates.CertificatesReplay +import OAI.LinearAlgebra.MatrixFields.Entropy.StageCLaw + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +namespace MatrixMultiplication.AllFieldParameters.Contractions + +open MatrixMultiplication.AllFieldCertificates.Replay + +variable {α : Type} + +attribute [local instance] lexOrd + +abbrev Ref := Nat +abbrev Law (α : Type) := List (α × Ref) + +structure BuildState where + reversed : List Op := [] + count : Nat := 0 + memo : Std.TreeMap (Nat × Int × Nat) Nat := {} + +def BuildState.program (s : BuildState) : Program := s.reversed.reverse.toArray + +def opKey : Op → Nat × Int × Nat + | .constant q => (0,q.num,q.den) + | .add i j => (1,i,j) + | .neg i => (2,i,0) + | .mul i j => (3,i,j) + | .inv i => (4,i,0) + | .log i => (5,i,0) + +abbrev Build := StateM BuildState + +def emit (op : Op) : Build Ref := do + let s ← get + match s.memo[opKey op]? with + | some i => pure i + | none => + let i := s.count + set ({ + reversed := op :: s.reversed + count := i + 1 + memo := s.memo.insert (opKey op) i } : BuildState) + pure i + +def lit (q : ℚ) : Build Ref := emit (.constant q) + +def add (a b : Ref) : Build Ref := + if a = 0 then pure b else if b = 0 then pure a else emit (.add a b) + +def neg (a : Ref) : Build Ref := if a = 0 then pure a else emit (.neg a) + +def sub (a b : Ref) : Build Ref := do add a (← neg b) + +def mul (a b : Ref) : Build Ref := + if a = 0 then pure a else if b = 0 then pure b else + if a = 1 then pure b else if b = 1 then pure a else emit (.mul a b) + +def inv (a : Ref) : Build Ref := if a = 1 then pure a else emit (.inv a) + +def divide (a b : Ref) : Build Ref := do mul a (← inv b) + +def log (a : Ref) : Build Ref := + if a = 0 ∨ a = 1 then pure 0 else emit (.log a) + +def powerAux (a : Ref) : Nat → Nat → Build Ref + | 0, _ => pure 1 + | fuel + 1, n => + if n = 0 then pure 1 else if n = 1 then pure a else do + let h ← powerAux a fuel (n / 2) + let s ← mul h h + if n % 2 = 1 then mul s a else pure s + +def power (a : Ref) (n : Nat) : Build Ref := powerAux a n n + +def sumRefs (xs : List Ref) : Build Ref := xs.foldlM add 0 + +def getLaw [BEq α] (xs : Law α) (key : α) : Ref := + ((xs.find? (fun x => x.1 == key)).map Prod.snd).getD 0 + +def addMass [BEq α] (xs : Law α) (key : α) (mass : Ref) : Build (Law α) := do + match xs with + | [] => pure [(key, mass)] + | (k, v) :: rest => + if k == key then pure ((k, ← add v mass) :: rest) + else pure ((k, v) :: (← addMass rest key mass)) + +def normalize (xs : Law α) : Build (Law α) := do + let total ← sumRefs (xs.map Prod.snd) + xs.mapM fun (key, mass) => do pure (key, ← divide mass total) + +def entropy (xs : List Ref) : Build Ref := do + let xs := xs.filter (· != 0) + let total ← sumRefs xs + sub (← mul total (← log total)) + (← sumRefs (← xs.mapM fun x => do mul x (← log x))) + +def buildWeight (n : ℤ) : Build Ref := do + let y ← divide (← lit n) (← lit 640000) + let terms ← (List.range 17).mapM fun j => do + divide (← power y j) (← lit (Nat.factorial j)) + power (← sumRefs terms) 64 + +def insertInteger (n : ℤ) : List ℤ → List ℤ + | [] => [n] + | m :: ms => if n ≤ m then n :: m :: ms else m :: insertInteger n ms + +def sortIntegers : List ℤ → List ℤ + | [] => [] + | n :: ns => insertInteger n (sortIntegers ns) + +def weightArguments : List ℤ := + (sortIntegers (0 :: (tablea ++ tableP ++ tablep ++ tablez))).eraseDups + +def buildWeights : Build (Law ℤ) := + weightArguments.mapM fun n => do pure (n, ← buildWeight n) + +def initialMultiplicity (g : Shape) : Nat := + if g 0 = g 2 then 1 else if g 0 = g 1 ∨ g 1 = g 2 then 3 else 6 + +def buildInitial (weights : Law ℤ) : Build (Law Shape) := do + let unnormalized ← sortedInitial.mapM fun g => do + let a := getLaw weights (tablea[g 0]?.getD 0) + let b := getLaw weights (tablea[g 1]?.getD 0) + let c := getLaw weights (tablea[g 2]?.getD 0) + let x ← mul a (← lit (initialMultiplicity g)) + pure (g, ← mul (← mul x b) c) + normalize unnormalized + +def buildSplit (weights : Law ℤ) (parents : List Shape) (data : List ℤ) : + Build (List (Shape × Law Shape)) := + parents.mapM fun s => do + let unnormalized ← (below s).mapM fun u => do + let signature := splitSignature parents data s u + let x ← mul (getLaw weights (signature 0)) (getLaw weights (signature 1)) + pure (u, ← mul x (getLaw weights (signature 2))) + pure (s, ← normalize unnormalized) + +def getSplit (laws : List (Shape × Law Shape)) (s : Shape) : Law Shape := + ((laws.find? (fun x => x.1 == s)).map Prod.snd).getD [] + +def buildBinary : Build (Law (Shape × Shape)) := + binaryKeys.mapM fun (t, u) => do + pure ((t, u), ← divide (← lit (binaryInteger t u)) (← lit 1000000)) + +def buildZeroPairs (weights : Law ℤ) : Build (List (Shape × Law PairSlot)) := + zeroSecond.mapM fun t => do + + let slots := ((unorderedPairs t).flatMap fun (i,j) => [(i,j),(j,i)]).eraseDups + let law := slots.map fun (i,j) => ((i,j), getLaw weights (orderedPairInteger t i j)) + pure (t, ← normalize law) + +def getPairs (laws : List (Shape × Law PairSlot)) (s : Shape) : Law PairSlot := + ((laws.find? (fun x => x.1 == s)).map Prod.snd).getD [] + +def littleLaw (binary : Law (Shape × Shape)) (t u : Shape) (w : Fin 3) : + Build (Law (Fin 6)) := do + if u w = 2 then + let d := getLaw binary (t,u) + let c ← sub 1 d + pure ([(2,c),(3,d)].filter (fun e => e.2 != 0)) + else + pure [((([0,1,2,3,4,5] : List (Fin 6)).find? + (fun i => statisticWeight i == u w)).getD 0, 1)] + +def pair [BEq α] (p : Law Shape) (s : Shape) (q : List (Shape × Law α)) : + Build (Law (α × α)) := do + let mut result := [] + for (u, mass) in p do + let left := ((q.find? (fun e => e.1 == u)).map Prod.snd).getD [] + let right := ((q.find? (fun e => e.1 == complement s u)).map Prod.snd).getD [] + for (i, vi) in left do + for (j, vj) in right do + let product ← mul (← mul mass vi) vj + result ← addMass result (i,j) product + pure result + +def maxAxis (s : Shape) : Fin 3 := + (([0,1,2] : List (Fin 3)).find? (fun w => s w == shapeMax s)).getD 0 + +def buildHalfLaws (splits : List (Shape × Law Shape)) + (binary : Law (Shape × Shape)) (pairs : List (Shape × Law PairSlot)) : + Build (List ((Shape × Fin 3) × Law PairSlot)) := do + let mut result := [] + for t in shapes 8 do + for w in ([0,1,2] : List (Fin 3)) do + let law ← if positive t then do + let p := getSplit splits t + let q ← p.mapM fun (u,_) => do pure (u, ← littleLaw binary t u w) + pair p t q + else if t w = 0 then pure [((0,0),1)] + else if w = maxAxis t then pure (getPairs pairs t) + else pure ((getPairs pairs t).map fun ((i,j),mass) => ((kappa i,kappa j),mass)) + result := result ++ [((t,w),law)] + pure result + +def getHalf (laws : List ((Shape × Fin 3) × Law PairSlot)) (t : Shape) (w : Fin 3) : + Law PairSlot := + ((laws.find? (fun e => e.1 == (t,w))).map Prod.snd).getD [] + +def orders : List (Fin 3 × Fin 3 × Fin 3) := + [(0,1,2),(0,2,1),(1,0,2),(1,2,0),(2,0,1),(2,1,0)] + +def priority (t : Shape) : Fin 3 × Fin 3 × Fin 3 := + (orders.find? fun (x,y,z) => + ([shape 1 1 6, shape 1 2 5, shape 1 3 4, shape 2 2 4, shape 3 2 3]).contains + (shape (t x) (t y) (t z))).getD (0,1,2) + +def capacity [BEq α] (s : Shape) (p : Law Shape) + (order : Fin 3 × Fin 3 × Fin 3) (laws : Shape → Fin 3 → Build (Law α)) : + Build (List Ref) := do + let (x,y,z) := order + let mut marginal := [] + for (u,mass) in p do + marginal ← addMass marginal (u x) mass + let first ← entropy (marginal.map Prod.snd) + let mut result := [first] + for w in [y,z] do + let q ← p.mapM fun (u,_) => do pure (u, ← laws u w) + let mut groups : List (Nat × Law α) := [] + let mut singleton := 0 + for (u,mass) in p do + let law := ((q.find? (fun e => e.1 == u)).map Prod.snd).getD [] + let single := if w = y then u z = 0 else u x = 0 ∨ u y = 0 + if single then + singleton ← add singleton (← mul mass (← entropy (law.map Prod.snd))) + else + let key := u w + let mut group := ((groups.find? (fun e => e.1 == key)).map Prod.snd).getD [] + for (i,val) in law do + group ← addMass group i (← mul mass val) + if groups.any (fun e => e.1 == key) then + groups := groups.map fun e => if e.1 == key then (key,group) else e + else groups := groups ++ [(key,group)] + let groupEntropies ← groups.mapM fun e => entropy (e.2.map Prod.snd) + let j ← add singleton (← sumRefs groupEntropies) + let joint ← pair p s q + let cap ← sub (← entropy (joint.map Prod.snd)) (← mul j (← lit 2)) + result := result ++ [cap] + pure result + +def sortShape (t : Shape) : Shape := + let a := min (t 0) (min (t 1) (t 2)) + let c := max (t 0) (max (t 1) (t 2)) + shape a (t 0 + t 1 + t 2 - a - c) c + +def secondTypes : List Shape := + [shape 1 1 6, shape 1 2 5, shape 1 3 4, shape 2 2 4, shape 2 3 3] + +def buildMasses (a : Law Shape) (splits : List (Shape × Law Shape)) : Build (Law Shape) := + (shapes 8).mapM fun t => do + let terms ← positiveInitial.mapM fun g => do + mul (getLaw a g) (getLaw (getSplit splits g) t) + let mass ← sumRefs terms + pure (t, ← mul mass (← lit 2)) + +def buildLittleMasses (m : Law Shape) (splits : List (Shape × Law Shape)) : + Build (Law (Shape × Shape)) := do + let mut result := [] + for t in positiveSecond do + for (u,mass) in getSplit splits t do + let v ← mul (getLaw m t) (← lit 2) + result := result ++ [((t,u), ← mul v mass)] + pure result + +def addRow [BEq α] (rows : List (α × List Ref)) (key : α) (mass : Ref) + (caps : List Ref) : Build (List (α × List Ref)) := do + rows.mapM fun (k,row) => do + if k == key then + pure (k, ← (List.range 3).mapM fun i => do + add (row[i]?.getD 0) (← mul mass (caps[i]?.getD 0))) + else pure (k,row) + +def rowTotals (rows : List (α × List Ref)) : Build (List Ref) := + (List.range 3).mapM fun i => sumRefs (rows.map fun row => row.2[i]?.getD 0) + +def binaryEntropy (d : Ref) : Build Ref := do + add (← entropy [← sub 1 d,d]) (← mul d (← log (← lit 2))) + +def coefficientStep (xs : List Nat) : List Nat := + (List.range (xs.length + 2)).map fun i => + (xs[i]?.getD 0) + (if i > 0 then 5 * xs[i-1]?.getD 0 else 0) + + (if i > 1 then xs[i-2]?.getD 0 else 0) + +def coefficients : List Nat := (List.range 8).foldl (fun xs _ => coefficientStep xs) [1] + +structure Roots where + weights : Law ℤ + initial : Law Shape + stageA : List (Shape × Law Shape) + stageB : List (Shape × Law Shape) + binary : Law (Shape × Shape) + zeroPairs : List (Shape × Law PairSlot) + halfLaws : List ((Shape × Fin 3) × Law PairSlot) + masses : Law Shape + littleMasses : Law (Shape × Shape) + rowsA : List (Nat × List Ref) + rowsB : List (Shape × List Ref) + LA : List Ref + LB : List Ref + LAB : List Ref + LC : List Ref + lambda : List Ref + LCdirect : List Ref + H0 : Ref + B : Ref + T : Ref + C : Ref + S0 : Ref + S1 : Ref + S2 : Ref + S : Ref + rhs : Ref + exponent : Ref + denominatorSlack : Ref + balanceSlacks : List Ref + thresholdGap : Ref + deriving DecidableEq + +def buildAll : Build Roots := do + let _ ← lit 0 + let _ ← lit 1 + let weights ← buildWeights + let a ← buildInitial weights + let pa ← buildSplit weights positiveInitial tableP + let pb ← buildSplit weights positiveSecond tablep + let binary ← buildBinary + let zpairs ← buildZeroPairs weights + let half ← buildHalfLaws pb binary zpairs + let m ← buildMasses a pa + let mu ← buildLittleMasses m pb + let mut rowsA := (List.range 5).map fun i => (i+1,[0,0,0]) + let mut rowsB := secondTypes.map fun t => (t,[0,0,0]) + for t in positiveSecond do + let caps ← capacity t (getSplit pb t) (priority t) (littleLaw binary t) + rowsB ← addRow rowsB (sortShape t) (getLaw m t) caps + for g in positiveInitial do + let caps ← capacity g (getSplit pa g) (0,1,2) (fun t w => pure (getHalf half t w)) + rowsA ← addRow rowsA (g 0) (getLaw a g) caps + let la ← rowTotals rowsA + let lb ← rowTotals rowsB + let lab ← (List.range 3).mapM fun i => add (la[i]?.getD 0) (lb[i]?.getD 0) + let interior := mu.filter fun e => positive e.1.2 + let total ← sumRefs (interior.map Prod.snd) + let bterms ← interior.mapM fun ((t,u),mass) => do + let rate ← add (← mul (← log (← lit 2)) (← lit 2)) + (← binaryEntropy (getLaw binary (t,u))) + divide (← mul mass rate) (← lit 3) + let b ← sumRefs bterms + let c ← add b (← divide (← sumRefs lab) (← lit 3)) + let lc ← lab.mapM (sub c) + let lambda ← (List.range 3).mapM fun i => do + let numerator ← sub (← mul total (← log (← lit 2))) (lc[i]?.getD 0) + let denominator ← sub (← mul total (← log (← lit 2))) b + divide numerator (← mul denominator (← lit 3)) + let direct ← (List.range 3).mapM fun i => do + let terms ← interior.mapM fun ((t,u),mass) => do + let left ← mul (← sub 1 (lambda[i]?.getD 0)) (← log (← lit 2)) + let right ← mul (lambda[i]?.getD 0) (← binaryEntropy (getLaw binary (t,u))) + mul mass (← add left right) + sumRefs terms + let mut marginal := [] + for (g,mass) in a do + for w in ([0,1,2] : List (Fin 3)) do + marginal ← addMass marginal (g w) (← divide mass (← lit 3)) + let h0 ← entropy (marginal.map Prod.snd) + let s0terms ← (a.filter fun e => !positive e.1).mapM fun (g,mass) => do + mul mass (← log (← lit (coefficients[shapeMax g]?.getD 0))) + let s0 ← sumRefs s0terms + let s1terms ← zeroSecond.mapM fun t => do + let law := getPairs zpairs t + let ent ← entropy (law.map Prod.snd) + let terms ← law.mapM fun ((i,j),mass) => do + mul mass (← log (← lit (multiplicity i * multiplicity j))) + mul (getLaw m t) (← add ent (← sumRefs terms)) + let s1 ← sumRefs s1terms + let mut s2 := 0 + for ((t,u),mass) in mu do + let d := getLaw binary (t,u) + let rate ← if shapeMax u = 4 then pure 0 + else if shapeMax u = 3 then log (← lit 10) + else if !positive u then do + let first ← binaryEntropy d + let second ← mul (← mul (← sub 1 d) (← lit 2)) (← log (← lit 5)) + add first second + else mul (← sub (← lit 2) d) (← log (← lit 5)) + s2 ← add s2 (← mul mass rate) + let volume ← add (← add s0 s1) s2 + let rhs ← mul (← log (← lit 7)) (← lit 8) + let exponent ← divide (← mul (← sub (← sub rhs h0) c) (← lit 3)) volume + let denominatorSlack ← sub (← mul total (← log (← lit 2))) b + let balanceSlacks ← lc.mapM fun v => do sub (← mul total (← log (← lit 2))) v + let thresholdGap ← sub (← lit ((2371054887 : ℚ) / 10^9)) exponent + pure { + weights := weights + initial := a + stageA := pa + stageB := pb + binary := binary + zeroPairs := zpairs + halfLaws := half + masses := m + littleMasses := mu + rowsA := rowsA + rowsB := rowsB + LA := la + LB := lb + LAB := lab + LC := lc + lambda := lambda + LCdirect := direct + H0 := h0 + B := b + T := total + C := c + S0 := s0 + S1 := s1 + S2 := s2 + S := volume + rhs := rhs + exponent := exponent + denominatorSlack := denominatorSlack + balanceSlacks := balanceSlacks + thresholdGap := thresholdGap } + +def built := buildAll.run {} + +def program : Program := built.2.program + +def roots : Roots := built.1 + +noncomputable def exponent : ℝ := program.eval[roots.exponent]?.getD 0 + +noncomputable def scalar (root : Ref) : ℝ := program.eval[root]?.getD 0 + +noncomputable def Y : ℝ := scalar roots.H0 + scalar roots.C + +noncomputable def S : ℝ := scalar roots.S + +noncomputable def R : ℝ := 8 * Real.log 7 + +noncomputable def ratio : ℝ := 3 * (R - Y) / S + +end MatrixMultiplication.AllFieldParameters.Contractions + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/Parameters/ParametersHalfComplement.lean b/lean/OAI/LinearAlgebra/MatrixFields/Parameters/ParametersHalfComplement.lean new file mode 100644 index 0000000000000000000000000000000000000000..25b55e6f82e89d66f22339c5c100029d0f97dab3 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/Parameters/ParametersHalfComplement.lean @@ -0,0 +1,96 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Entropy.ParametersHalfLaws + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +namespace MatrixMultiplication.AllFieldParameters + +open scoped BigOperators + +theorem normalized_singleton_law {A : Type*} [Fintype A] [DecidableEq A] + (p : A → ℚ) (a : A) (hp : ∑ i, p i = 1) + (hs : ∀ i, i ≠ a → p i = 0) (i : A) : p i = if i = a then 1 else 0 := by + have ha : p a = 1 := by + have hsum : (∑ i, p i) = p a := by + apply Finset.sum_eq_single a + · intro i _ hi + exact hs i hi + · simp + exact hsum.symm.trans hp + by_cases hi : i = a + · simp [hi, ha] + · simp [hi, hs i hi] + +theorem pairWeight_zero : ∀ ij : PairSlot, + statisticWeight ij.1 + statisticWeight ij.2 = 0 ↔ ij = (0,0) := by decide +kernel + +theorem pairWeight_eight : ∀ ij : PairSlot, + statisticWeight ij.1 + statisticWeight ij.2 = 8 ↔ ij = (5,5) := by decide +kernel + +theorem pairKappa_zero : ∀ ij : PairSlot, + (kappa ij.1, kappa ij.2) = (0,0) ↔ ij = (5,5) := by decide +kernel + +theorem pairKappa_eight : ∀ ij : PairSlot, + (kappa ij.1, kappa ij.2) = (5,5) ↔ ij = (0,0) := by decide +kernel + +theorem halfLaw_weight_zero (t : Shape) (ht : t ∈ shapes 8) (w : Fin 3) + (hw : t w = 0) (ij : PairSlot) : + halfLaw t w ij = if ij = (0,0) then 1 else 0 := by + apply normalized_singleton_law (halfLaw t w) (0,0) (halfLaw_normalized t ht w) + intro pair hpair + apply halfLaw_outside_support t ht w pair + rw [hw] + exact fun h => hpair ((pairWeight_zero pair).mp h) + +theorem halfLaw_weight_eight (t : Shape) (ht : t ∈ shapes 8) (w : Fin 3) + (hw : t w = 8) (ij : PairSlot) : + halfLaw t w ij = if ij = (5,5) then 1 else 0 := by + apply normalized_singleton_law (halfLaw t w) (5,5) (halfLaw_normalized t ht w) + intro pair hpair + apply halfLaw_outside_support t ht w pair + rw [hw] + exact fun h => hpair ((pairWeight_eight pair).mp h) + +theorem complementary_half_sides_zero_parent : ∀ t ∈ shapes 8, ∀ w v : Fin 3, + w ≠ v → t w + t v = 8 → t ∈ zeroSecond := by decide +kernel + +theorem halfLaw_complementary_sides (t : Shape) (ht : t ∈ shapes 8) + (w v : Fin 3) (hwv : w ≠ v) (hsum : t w + t v = 8) (ij : PairSlot) : + halfLaw t w (kappa ij.1, kappa ij.2) = halfLaw t v ij := by + by_cases hw : t w = 0 + · have hv : t v = 8 := by omega + rw [halfLaw_weight_zero t ht w hw, halfLaw_weight_eight t ht v hv] + simp only [pairKappa_zero] + · by_cases hv : t v = 0 + · have hw8 : t w = 8 := by omega + rw [halfLaw_weight_eight t ht w hw8, halfLaw_weight_zero t ht v hv] + simp only [pairKappa_eight] + · exact halfLaw_zero_complement t + (complementary_half_sides_zero_parent t ht w v hwv hsum) w v hw hv hwv ij + +theorem zero_maximum_axis_nonzero : ∀ t ∈ zeroSecond, t (halfMaxAxis t) ≠ 0 := by + decide +kernel + +theorem halfLaw_at_maximum (t : Shape) (ht : t ∈ zeroSecond) (ij : PairSlot) : + halfLaw t (halfMaxAxis t) ij = zeroPairLaw t ij.1 ij.2 := by + have hp : positive t ≠ true := by simpa using (List.mem_filter.mp ht).2 + simp only [halfLaw, hp, Bool.false_eq_true, ite_false, + ite_eq_right (zero_maximum_axis_nonzero t ht), ite_true] + +theorem zeroPairLaw_shapeMax_eight (t : Shape) (ht : t ∈ zeroSecond) + (hmax : shapeMax t = 8) (ij : PairSlot) : + zeroPairLaw t ij.1 ij.2 = if ij = (5,5) then 1 else 0 := by + have hshape : t ∈ shapes 8 := (List.mem_filter.mp ht).1 + rw [← halfLaw_at_maximum t ht ij] + exact halfLaw_weight_eight t hshape (halfMaxAxis t) + ((halfMaxAxis_spec t hshape).trans hmax) ij + +end MatrixMultiplication.AllFieldParameters + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/Parameters/ParametersStageC.lean b/lean/OAI/LinearAlgebra/MatrixFields/Parameters/ParametersStageC.lean new file mode 100644 index 0000000000000000000000000000000000000000..8e61f57abcc65f5d4cf0cc049646b7f447774378 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/Parameters/ParametersStageC.lean @@ -0,0 +1,53 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Histories.HistoryChildLaws + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +namespace MatrixMultiplication.AllFieldParameters + +open scoped BigOperators + +noncomputable section + +theorem stageC_direct_identity {I : Type*} [Fintype I] + (mass entropy : I → ℝ) (allocation logTwo : ℝ) : + (∑ i, mass i * ((1 - allocation) * logTwo + allocation * entropy i)) = + (∑ i, mass i) * logTwo - 3 * allocation * + ((∑ i, mass i) * logTwo - + (∑ i, mass i * (2 * logTwo + entropy i)) / 3) := by + calc + _ = (∑ i, mass i * logTwo) - 3 * allocation * + ((∑ i, mass i * logTwo) - + (∑ i, mass i * (2 * logTwo + entropy i)) / 3) := by + rw [Finset.sum_div, ← Finset.sum_sub_distrib, Finset.mul_sum, + ← Finset.sum_sub_distrib] + apply Finset.sum_congr rfl + intro i _ + ring + _ = _ := by rw [Finset.sum_mul] + +theorem stageC_direct_balanced {I : Type*} [Fintype I] + (mass entropy : I → ℝ) (a b : Staggering.Capacity) (i : Fin 3) + (hgap : + (∑ j, mass j * (2 * Real.log 2 + entropy j)) / 3 < + (∑ j, mass j) * Real.log 2) : + let high := (∑ j, mass j) * Real.log 2 + let base := (∑ j, mass j * (2 * Real.log 2 + entropy j)) / 3 + let allocation := Staggering.balanceFraction a b high base i + (∑ j, mass j * ((1 - allocation) * Real.log 2 + allocation * entropy j)) = + Staggering.totalCapacity a b base - (a i + b i) := by + dsimp only + rw [stageC_direct_identity] + exact Staggering.thirdCapacity_eq a b _ _ hgap i + +end + +end MatrixMultiplication.AllFieldParameters + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/Parameters/ParametersWeights.lean b/lean/OAI/LinearAlgebra/MatrixFields/Parameters/ParametersWeights.lean new file mode 100644 index 0000000000000000000000000000000000000000..4a06dc236eb3118ae488acb9c3709edb189fb131 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/Parameters/ParametersWeights.lean @@ -0,0 +1,288 @@ +import Mathlib + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +namespace MatrixMultiplication.AllFieldParameters + +open scoped BigOperators + +abbrev Shape := Fin 3 → ℕ + +def shape (a b c : ℕ) : Shape := (Matrix.vecCons (a) (Matrix.vecCons (b) (Matrix.vecCons (c) Matrix.vecEmpty))) + +def shapes (n : ℕ) : List Shape := + (List.range (n + 1)).flatMap fun a => + (List.range (n + 1 - a)).map fun b => shape a b (n - a - b) + +def positive (s : Shape) : Bool := s 0 > 0 && s 1 > 0 && s 2 > 0 + +def sorted (s : Shape) : Bool := s 0 ≤ s 1 && s 1 ≤ s 2 + +def sortedInitial : List Shape := (shapes 16).filter sorted + +def positiveInitial : List Shape := sortedInitial.filter positive + +def positiveSecond : List Shape := (shapes 8).filter positive + +def zeroSecond : List Shape := (shapes 8).filter (fun s => !positive s) + +def shapeMax (s : Shape) : ℕ := max (s 0) (max (s 1) (s 2)) + +def below (s : Shape) : List Shape := + (shapes ((s 0 + s 1 + s 2) / 2)).filter + (fun u => u 0 ≤ s 0 && u 1 ≤ s 1 && u 2 ≤ s 2) + +def complement (s u : Shape) : Shape := fun i => s i - u i + +def tablea : List ℤ := + [-55839, -36137, -17449, -1780, 11561, 22640, 31188, 36731, 38593, 35898, + 29051, 18387, 3823, -14569, -39776, -38598, -23708] + +def tableP : List ℤ := + [-3070, 295, -20546, -1514, -38211, -9654, -7530, -2765, -55230, -16412, + -14246, -5912, -78106, -32809, -7009, -26324, -13519, -3592, -96458, -47439, + -16217, -46871, -25058, -9643, -95643, -62269, -28725, -8576, -2535, -2550, + -34711, -7207, -3270, -6376, -53221, -15352, -3477, -14828, -4187, -74924, + -32439, -7231, -3578, -24599, -8700, -92989, -46655, -16926, -3517, -42976, + -20283, -5132, -107049, -63201, -31013, -9730, -3705, -67421, -35684, -13735, + -68829, -36752, -13993, -7658, -7586, -76746, -33496, -7329, -7447, -17336, + -4721, -96770, -49297, -17874, -7143, -30044, -10107, -116558, -68325, -33467, + -10424, -7476, -51341, -24711, -5530, -76548, -41988, -15608, -17266, -4357, + -17106, -4343, -120770, -70820, -34294, -10580, -16819, -4315, -32943, -9992, + -83616, -44202, -16154, -17098, -4371, -56609, -25990, -5564, -56356, -25900, + -5561, -33052, -9918, -32951, -9906, -57255, -26128, -5560] + +def tablep : List ℤ := + [-39594, -5561, -55254, -15178, -62331, -19672, -54917, -18539, -16455, -32184, + -5716, -11688, -5527, -53009, -6669, -6669, -64938, -20286, -6616, -26336, + -26429, -6696, -60888, -19760, -6690, -5724, -32216, -15829, -58477, -18987, + -26339, -6619, -26393, -26340, -26359, -6620, -16239, -55176, -18587, -55107, + -18571, -16272, -60868, -19755, -6696, -6692, -55133, -18580, -16247, -32128, + -5727, -32138, -5725, -122] + +def tabled : List ℤ := + [63, 97655, 0, 42132, 92966, 1204, 42148, 95604, 41743, 3057, + 109933, 42092, 3747, 41991, 1, 100622, 42166, 103562, 9039, 42157, + 103577, 42165, 63582, 110082, 4584, 42175, 104091, 38838, 102383, 104793, + 42126, 11814, 63338, 42165, 104864, 3587, 42166, 110086, 2207, 94768, + 42166, 104185, 4735, 38889, 110065, 42166, 102372, 104314, 38956, 4876, + 102395, 42166, 110068, 2953, 42166, 96000, 41863, 95723, 3031, 63321, + 42040, 42174, 104662, 11860, 104902, 42189, 2967, 96042, 42047, 109872, + 3986, 42200, 3834, 110106, 60257] + +def tablez : List ℤ := + [-11037, -36170, -4779, 23107, -12831, 29263, 45052, 22289, -6216, 23895, + -14326, -40670, -9623, -34674, -12708, -36610, -2174, 21564, -5587, 22521, + -9766, 28961, 43809, 22299, -12216, 28778, 44147, 22176, -7811, 21870, + -6053, 23786, -166, 94, -52, 17] + +theorem table_lengths : + [tablea.length, tableP.length, tablep.length, tabled.length, tablez.length] = + [17, 118, 54, 75, 36] := by decide +kernel + +theorem parent_counts : + [sortedInitial.length, positiveInitial.length, positiveSecond.length, + zeroSecond.length] = [30, 21, 21, 24] := by decide +kernel + +def statisticWeight : Fin 6 → ℕ := (Matrix.vecCons (0) (Matrix.vecCons (1) (Matrix.vecCons (2) (Matrix.vecCons (2) (Matrix.vecCons (3) (Matrix.vecCons (4) Matrix.vecEmpty)))))) + +def multiplicity : Fin 6 → ℕ := (Matrix.vecCons (1) (Matrix.vecCons (10) (Matrix.vecCons (25) (Matrix.vecCons (2) (Matrix.vecCons (10) (Matrix.vecCons (1) Matrix.vecEmpty)))))) + +def kappa : Fin 6 → Fin 6 := (Matrix.vecCons (5) (Matrix.vecCons (4) (Matrix.vecCons (2) (Matrix.vecCons (3) (Matrix.vecCons (1) (Matrix.vecCons (0) Matrix.vecEmpty)))))) + +theorem kappa_involution (i : Fin 6) : kappa (kappa i) = i := by + revert i + decide +kernel + +theorem multiplicity_kappa (i : Fin 6) : multiplicity (kappa i) = multiplicity i := by + revert i + decide +kernel + +theorem statisticWeight_kappa (i : Fin 6) : + statisticWeight (kappa i) = 4 - statisticWeight i := by + revert i + decide +kernel + +def weight (n : ℤ) : ℚ := + (∑ j ∈ Finset.range 17, ((n : ℚ) / 640000) ^ j / Nat.factorial j) ^ 64 + +theorem weight_nonnegative (n : ℤ) : 0 ≤ weight n := by + unfold weight + positivity + +abbrev SplitKey := Shape × Fin 3 × ℕ + +def splitKeys (parents : List Shape) : List SplitKey := + parents.flatMap fun s => + ([0, 1, 2] : List (Fin 3)).flatMap fun i => + (List.range (s i / 2)).filterMap fun j => + if s i - (s 0 + s 1 + s 2) / 2 ≤ j then some (s, i, j) else none + +def assigned {α : Type} [BEq α] (keys : List α) (data : List ℤ) (key : α) : ℤ := + (((keys.zip data).find? (fun e => e.1 == key)).map Prod.snd).getD 0 + +def splitSignature (parents : List Shape) (data : List ℤ) (s u : Shape) : Fin 3 → ℤ := + fun i => assigned (splitKeys parents) data (s, i, min (u i) (s i - u i)) + +def stageASignature := splitSignature positiveInitial tableP + +def stageBSignature := splitSignature positiveSecond tablep + +def splitWeight (parents : List Shape) (data : List ℤ) (s u : Shape) : ℚ := + ∏ i : Fin 3, weight (splitSignature parents data s u i) + +def splitLaw (parents : List Shape) (data : List ℤ) (s u : Shape) : ℚ := + if u ∈ below s then + splitWeight parents data s u / ((below s).map (splitWeight parents data s)).sum + else 0 + +def stageALaw := splitLaw positiveInitial tableP + +def stageBLaw := splitLaw positiveSecond tablep + +theorem split_consumption : + [(splitKeys positiveInitial).length, (splitKeys positiveSecond).length] = + [118, 54] := by decide +kernel + +theorem splitSignature_complement (parents : List Shape) (data : List ℤ) + (s u : Shape) (h : ∀ i, u i ≤ s i) : + splitSignature parents data s (complement s u) = splitSignature parents data s u := by + funext i + simp only [splitSignature, complement, Nat.sub_sub_self (h i), min_comm] + +theorem splitWeight_complement (parents : List Shape) (data : List ℤ) + (s u : Shape) (h : ∀ i, u i ≤ s i) : + splitWeight parents data s (complement s u) = splitWeight parents data s u := by + simp only [splitWeight, splitSignature_complement parents data s u h] + +theorem splitLaw_complement (parents : List Shape) (data : List ℤ) + (s u : Shape) (h : ∀ i, u i ≤ s i) + (hu : u ∈ below s) (hc : complement s u ∈ below s) : + splitLaw parents data s (complement s u) = splitLaw parents data s u := by + simp only [splitLaw, hu, hc, ite_true, splitWeight_complement parents data s u h] + +theorem splitLaw_outside_support (parents : List Shape) (data : List ℤ) + (s u : Shape) (hu : u ∉ below s) : splitLaw parents data s u = 0 := by + simp only [splitLaw, hu, ite_false] + +def binaryKeys : List (Shape × Shape) := + positiveSecond.flatMap fun t => + ((below t).filter (fun u => shapeMax u == 2)).map fun u => (t, u) + +def binaryInteger (t u : Shape) : ℤ := assigned binaryKeys tabled (t, u) + +def binaryParameter (t u : Shape) : ℚ := (binaryInteger t u : ℚ) / 1000000 + +theorem binary_consumption : binaryKeys.length = 75 := by decide +kernel + +theorem binary_table_range : tabled.all (fun n => 0 ≤ n && n ≤ 110106) = true := by + decide +kernel + +theorem complementary_binary_parameters_are_distinct : + binaryInteger (shape 1 3 4) (shape 0 2 2) = 92966 ∧ + binaryInteger (shape 1 3 4) (shape 1 1 2) = 1204 := by decide +kernel + +theorem unreachable_parent_retained : shape 6 1 1 ∈ positiveSecond := by decide +kernel + +abbrev PairSlot := Fin 6 × Fin 6 + +def unorderedPairs (t : Shape) : List PairSlot := + (List.finRange 6).flatMap fun i => + (List.finRange 6).filterMap fun j => + if i ≤ j ∧ statisticWeight i + statisticWeight j = shapeMax t + then some (i, j) else none + +def pairKeys : List (Shape × PairSlot) := + zeroSecond.flatMap fun t => + ((unorderedPairs t).dropLast).map fun ij => (t, ij) + +def orderedPairInteger (t : Shape) (i j : Fin 6) : ℤ := + assigned pairKeys tablez (t, min i j, max i j) + +def orderedPairs (t : Shape) : List PairSlot := + (List.finRange 6).flatMap fun i => + (List.finRange 6).filterMap fun j => + if statisticWeight i + statisticWeight j = shapeMax t then some (i, j) else none + +def zeroPairLaw (t : Shape) (i j : Fin 6) : ℚ := + if statisticWeight i + statisticWeight j = shapeMax t then + weight (orderedPairInteger t i j) / + ((orderedPairs t).map (fun ij => weight (orderedPairInteger t ij.1 ij.2))).sum + else 0 + +theorem pair_consumption : pairKeys.length = 36 := by decide +kernel + +theorem orderedPairInteger_swap (t : Shape) (i j : Fin 6) : + orderedPairInteger t i j = orderedPairInteger t j i := by + simp only [orderedPairInteger, min_comm, max_comm] + +theorem zeroPairLaw_swap (t : Shape) (i j : Fin 6) : + zeroPairLaw t i j = zeroPairLaw t j i := by + simp only [zeroPairLaw, orderedPairInteger_swap t i j, add_comm] + +theorem zeroPairLaw_outside_support (t : Shape) (i j : Fin 6) + (h : statisticWeight i + statisticWeight j ≠ shapeMax t) : + zeroPairLaw t i j = 0 := by + simp only [zeroPairLaw, h, ite_false] + +theorem truncated_polynomial_positive (y : ℚ) (hy : |y| ≤ 1 / 4) : + 0 < ∑ j ∈ Finset.range 17, y ^ j / Nat.factorial j := by + have term_bound (j : ℕ) : + |y ^ (j + 1) / (Nat.factorial (j + 1) : ℚ)| ≤ (1 / 4 : ℚ) ^ (j + 1) := by + have hd : (1 : ℚ) ≤ Nat.factorial (j + 1) := by + exact_mod_cast (Nat.succ_le_iff.mpr (Nat.factorial_pos (j + 1))) + calc + _ = |y| ^ (j + 1) / (Nat.factorial (j + 1) : ℚ) := by + simp only [abs_div, abs_pow, + abs_of_nonneg (Nat.cast_nonneg (Nat.factorial (j + 1)) : + (0 : ℚ) ≤ (Nat.factorial (j + 1) : ℚ))] + _ ≤ (1 / 4 : ℚ) ^ (j + 1) / (Nat.factorial (j + 1) : ℚ) := by gcongr + _ ≤ _ := div_le_self (by positivity) hd + have hb : |∑ j ∈ Finset.range 16, y ^ (j + 1) / (Nat.factorial (j + 1) : ℚ)| < 1 := by + calc + _ ≤ ∑ j ∈ Finset.range 16, |y ^ (j + 1) / (Nat.factorial (j + 1) : ℚ)| := + Finset.abs_sum_le_sum_abs _ _ + _ ≤ ∑ j ∈ Finset.range 16, (1 / 4 : ℚ) ^ (j + 1) := + Finset.sum_le_sum (fun j _ => term_bound j) + _ < 1 := by norm_num [Finset.sum_range_succ] + rw [show 17 = 16 + 1 by decide, Finset.sum_range_succ'] + norm_num only [pow_zero, Nat.factorial_zero, Nat.cast_one, div_one] + linarith [(abs_lt.mp hb).1] + +theorem weight_positive_of_argument_bound (n : ℤ) (hn : |n| ≤ 160000) : + 0 < weight n := by + unfold weight + apply pow_pos + apply truncated_polynomial_positive + have hn' : |(n : ℚ)| ≤ 160000 := by exact_mod_cast hn + rw [abs_div] + rw [abs_of_pos (by norm_num : (0 : ℚ) < 640000)] + exact (div_le_iff₀ (by norm_num)).mpr (by linarith) + +def weightArguments : List ℤ := 0 :: (tablea ++ tableP ++ tablep ++ tablez) + +theorem all_weight_arguments_bounded : ∀ n ∈ weightArguments, |n| ≤ 160000 := by + decide +kernel + +theorem all_weights_positive (n : ℤ) (hn : n ∈ weightArguments) : 0 < weight n := + weight_positive_of_argument_bound n (all_weight_arguments_bounded n hn) + +theorem normalized_sum {ι : Type} [Fintype ι] (w : ι → ℚ) + (h : ∑ i, w i ≠ 0) : ∑ i, w i / (∑ j, w j) = 1 := by + simp only [div_eq_mul_inv] + rw [← Finset.sum_mul, ← div_eq_mul_inv, div_self h] + +theorem normalized_positive {ι : Type} [Fintype ι] (w : ι → ℚ) + (hw : ∀ i, 0 < w i) (i : ι) : 0 < w i / (∑ j, w j) := by + apply div_pos (hw i) + exact Finset.sum_pos (fun j _ => hw j) ⟨i, Finset.mem_univ i⟩ + +end MatrixMultiplication.AllFieldParameters + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/Parameters/PopulationCounts.lean b/lean/OAI/LinearAlgebra/MatrixFields/Parameters/PopulationCounts.lean new file mode 100644 index 0000000000000000000000000000000000000000..f8170a171ec8a058eb63684d9bae5a635cea3008 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/Parameters/PopulationCounts.lean @@ -0,0 +1,140 @@ +import Mathlib + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +namespace MatrixMultiplication.AllFieldPopulationCounts + +open scoped BigOperators + +noncomputable section + +variable {I : Type*} [Fintype I] [DecidableEq I] + +def denominator (w : I → ℚ) : ℕ := ∏ i, (w i).den + +def baseCount (w : I → ℚ) (i : I) : ℕ := + (w i).num.toNat * ∏ j ∈ Finset.univ.erase i, (w j).den + +def count (w : I → ℚ) (m : ℕ) (i : I) : ℕ := m * baseCount w i + +def blockLength (w : I → ℚ) (m : ℕ) : ℕ := m * denominator w + +omit [DecidableEq I] in +theorem denominator_pos (w : I → ℚ) : 0 < denominator w := by + exact Finset.prod_pos fun i _ => (w i).den_pos + +theorem denominator_factor (w : I → ℚ) (i : I) : + (w i).den * (∏ j ∈ Finset.univ.erase i, (w j).den) = denominator w := by + exact Finset.mul_prod_erase Finset.univ (fun j => (w j).den) (Finset.mem_univ i) + +theorem baseCount_cast (w : I → ℚ) (hw : ∀ i, 0 ≤ w i) (i : I) : + (baseCount w i : ℚ) = (denominator w : ℚ) * w i := by + have hnum : ((w i).num.toNat : ℚ) = ((w i).num : ℚ) := by + exact_mod_cast Int.toNat_of_nonneg (Rat.num_nonneg.mpr (hw i)) + have hden : ((w i).den : ℚ) ≠ 0 := by exact_mod_cast (w i).den_ne_zero + have hq : ((w i).num : ℚ) = w i * ((w i).den : ℚ) := by + calc + ((w i).num : ℚ) = + (((w i).num : ℚ) / ((w i).den : ℚ)) * ((w i).den : ℚ) := + (div_mul_cancel₀ _ hden).symm + _ = w i * ((w i).den : ℚ) := by rw [(w i).num_div_den] + rw [baseCount, ← denominator_factor w i] + push_cast + rw [hnum, hq] + ring + +theorem count_cast (w : I → ℚ) (hw : ∀ i, 0 ≤ w i) (m : ℕ) (i : I) : + (count w m i : ℚ) = (m : ℚ) * (denominator w : ℚ) * w i := by + simp only [count, Nat.cast_mul, baseCount_cast w hw, mul_assoc] + +theorem count_cast_blockLength (w : I → ℚ) (hw : ∀ i, 0 ≤ w i) + (m : ℕ) (i : I) : + (count w m i : ℚ) = (blockLength w m : ℚ) * w i := by + simpa only [blockLength, Nat.cast_mul] using count_cast w hw m i + +omit [DecidableEq I] in +theorem blockLength_pos (w : I → ℚ) {m : ℕ} (hm : 0 < m) : + 0 < blockLength w m := Nat.mul_pos hm (denominator_pos w) + +theorem count_zero_iff (w : I → ℚ) (hw : ∀ i, 0 ≤ w i) + {m : ℕ} (hm : 0 < m) (i : I) : count w m i = 0 ↔ w i = 0 := by + have hD : (denominator w : ℚ) ≠ 0 := by + exact_mod_cast (ne_of_gt (denominator_pos w)) + have hM : (m : ℚ) ≠ 0 := by exact_mod_cast (ne_of_gt hm) + have h : (count w m i : ℚ) = 0 ↔ w i = 0 := by + rw [count_cast w hw] + simp only [mul_eq_zero, hM, hD, false_or] + simpa only [Nat.cast_eq_zero] using h + +theorem count_pos_iff (w : I → ℚ) (hw : ∀ i, 0 ≤ w i) + {m : ℕ} (hm : 0 < m) (i : I) : 0 < count w m i ↔ 0 < w i := by + rw [Nat.pos_iff_ne_zero, ne_eq, count_zero_iff w hw hm] + constructor + · intro h + exact lt_of_le_of_ne (hw i) (Ne.symm h) + · exact ne_of_gt + +theorem sum_count_cast {J : Type*} (w : I → ℚ) (hw : ∀ i, 0 ≤ w i) + (m : ℕ) (s : Finset J) (f : J → I) : + ((∑ j ∈ s, count w m (f j) : ℕ) : ℚ) = + (blockLength w m : ℚ) * ∑ j ∈ s, w (f j) := by + simp only [Nat.cast_sum, count_cast_blockLength w hw] + rw [Finset.mul_sum] + +theorem transition_sum {J : Type*} (w : I → ℚ) (hw : ∀ i, 0 ≤ w i) + (m : ℕ) (s : Finset J) (f : J → I) (parent : I) + (hs : ∑ j ∈ s, w (f j) = w parent) : + ∑ j ∈ s, count w m (f j) = count w m parent := by + apply Nat.cast_injective (R := ℚ) + rw [sum_count_cast w hw, hs, count_cast_blockLength w hw] + +theorem unit_sum {J : Type*} (w : I → ℚ) (hw : ∀ i, 0 ≤ w i) + (m : ℕ) (s : Finset J) (f : J → I) + (hs : ∑ j ∈ s, w (f j) = 1) : + ∑ j ∈ s, count w m (f j) = blockLength w m := by + apply Nat.cast_injective (R := ℚ) + rw [sum_count_cast w hw, hs, mul_one] + +theorem count_eq_of_mass_eq (w : I → ℚ) (hw : ∀ i, 0 ≤ w i) + (m : ℕ) {i j : I} (h : w i = w j) : count w m i = count w m j := by + apply Nat.cast_injective (R := ℚ) + rw [count_cast w hw, count_cast w hw, h] + +theorem count_ratio (w : I → ℚ) (hw : ∀ i, 0 ≤ w i) + {m : ℕ} (hm : 0 < m) (i : I) : + (count w m i : ℚ) / blockLength w m = w i := by + rw [count_cast_blockLength w hw] + have h : (blockLength w m : ℚ) ≠ 0 := by + exact_mod_cast (ne_of_gt (blockLength_pos w hm)) + exact mul_div_cancel_left₀ _ h + +theorem count_dilate (w : I → ℚ) (m n : ℕ) (i : I) : + count w (m * n) i = m * count w n i := by simp [count, Nat.mul_assoc] + +theorem dilation_le_count (w : I → ℚ) (hw : ∀ i, 0 ≤ w i) + (m : ℕ) (i : I) (hi : 0 < w i) : m ≤ count w m i := by + have hb : 0 < baseCount w i := by + have h := (count_pos_iff w hw (m := 1) (by decide) i).2 hi + simpa only [count, one_mul] using h + calc + m = m * 1 := (Nat.mul_one m).symm + _ ≤ m * baseCount w i := Nat.mul_le_mul_left m hb + +theorem two_le_positive_count (w : I → ℚ) (hw : ∀ i, 0 ≤ w i) + {m : ℕ} (hm : 2 ≤ m) (i : I) (hi : 0 < w i) : 2 ≤ count w m i := + hm.trans (dilation_le_count w hw m i hi) + +end + +end MatrixMultiplication.AllFieldPopulationCounts + +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/Parameters/StageCCapacity.lean b/lean/OAI/LinearAlgebra/MatrixFields/Parameters/StageCCapacity.lean new file mode 100644 index 0000000000000000000000000000000000000000..5fdfbe610008b8c7f8b010819a2a90bf28f0c8bf --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/Parameters/StageCCapacity.lean @@ -0,0 +1,252 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Entropy.InitialLeafRates + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +noncomputable section + +namespace MatrixMultiplication.AllFieldStageCCapacity + +open AllFieldHistory AllFieldParameters MatrixMultiplication.Foundation +open scoped BigOperators + +def stageCMarginal (t u : Shape) (i : Fin 3) (k : Fin 17) : ℝ := + ∑ b : Fin 4, if stageCAtom u b i = k.val then (stageCWeight t u b : ℝ) else 0 + +theorem stageCMarginal_eq_shapeLaw (t u : Shape) (hu : u ∈ shapes 4) + (hpos : positive u = true) (i : Fin 3) (k : Fin 17) : + stageCMarginal t u i k = + ∑ b : Fin 4, if stageCAtom u b i = k.val then + (stageCLaw t u (stageCAtom u b) : ℝ) else 0 := by + simp only [stageCMarginal, stageCLaw_atom t u hu hpos] + +private def symbolicMarginal (u : Shape) (d : ℝ) (i : Fin 3) (k : Fin 17) : ℝ := + ∑ b : Fin 4, if stageCAtom u b i = k.val then + (if b.val < 2 then d / 2 else (1 - d) / 2) else 0 + +private theorem stageCMarginal_symbolic (t u : Shape) (i : Fin 3) (k : Fin 17) : + stageCMarginal t u i k = symbolicMarginal u (binaryParameter t u) i k := by + unfold stageCMarginal symbolicMarginal + apply Finset.sum_congr rfl + intro b _ + by_cases hb : b.val < 2 <;> simp [stageCWeight, hb] + +private theorem symbolicMarginal_eq_2_1_1_0 (d : ℝ) (k : Fin 17) : + symbolicMarginal (shape 2 1 1) d 0 k = + if (0 : Fin 3) = stageCDistinguished (shape 2 1 1) then + (if k = 0 then d / 2 else if k = 1 then 1 - d else if k = 2 then d / 2 else 0) + else (if k = 0 then 1 / 2 else if k = 1 then 1 / 2 else 0) := by + simp only [symbolicMarginal, Fin.sum_univ_four] + fin_cases k <;> + norm_num [stageCAtom, stageCDistinguished, + stageCCanonicalAtom, shape, Matrix.cons_val_two, + Fin.ext_iff] + +private theorem symbolicMarginal_eq_2_1_1_1 (d : ℝ) (k : Fin 17) : + symbolicMarginal (shape 2 1 1) d 1 k = + if (1 : Fin 3) = stageCDistinguished (shape 2 1 1) then + (if k = 0 then d / 2 else if k = 1 then 1 - d else if k = 2 then d / 2 else 0) + else (if k = 0 then 1 / 2 else if k = 1 then 1 / 2 else 0) := by + simp only [symbolicMarginal, Fin.sum_univ_four] + fin_cases k <;> + norm_num [stageCAtom, stageCDistinguished, + stageCCanonicalAtom, shape, Matrix.cons_val_two, + Fin.ext_iff] <;> ring + +private theorem symbolicMarginal_eq_2_1_1_2 (d : ℝ) (k : Fin 17) : + symbolicMarginal (shape 2 1 1) d 2 k = + if (2 : Fin 3) = stageCDistinguished (shape 2 1 1) then + (if k = 0 then d / 2 else if k = 1 then 1 - d else if k = 2 then d / 2 else 0) + else (if k = 0 then 1 / 2 else if k = 1 then 1 / 2 else 0) := by + simp only [symbolicMarginal, Fin.sum_univ_four] + fin_cases k <;> + norm_num [stageCAtom, stageCDistinguished, + stageCCanonicalAtom, shape, Matrix.cons_val_two, + Fin.ext_iff] <;> ring + +private theorem symbolicMarginal_eq_1_2_1_0 (d : ℝ) (k : Fin 17) : + symbolicMarginal (shape 1 2 1) d 0 k = + if (0 : Fin 3) = stageCDistinguished (shape 1 2 1) then + (if k = 0 then d / 2 else if k = 1 then 1 - d else if k = 2 then d / 2 else 0) + else (if k = 0 then 1 / 2 else if k = 1 then 1 / 2 else 0) := by + simp only [symbolicMarginal, Fin.sum_univ_four] + fin_cases k <;> + norm_num [stageCAtom, stageCDistinguished, + stageCCanonicalAtom, shape, Matrix.cons_val_two, + Fin.ext_iff] <;> ring + +private theorem symbolicMarginal_eq_1_2_1_1 (d : ℝ) (k : Fin 17) : + symbolicMarginal (shape 1 2 1) d 1 k = + if (1 : Fin 3) = stageCDistinguished (shape 1 2 1) then + (if k = 0 then d / 2 else if k = 1 then 1 - d else if k = 2 then d / 2 else 0) + else (if k = 0 then 1 / 2 else if k = 1 then 1 / 2 else 0) := by + simp only [symbolicMarginal, Fin.sum_univ_four] + fin_cases k <;> + norm_num [stageCAtom, stageCDistinguished, + stageCCanonicalAtom, shape, Matrix.cons_val_two, + Fin.ext_iff] + +private theorem symbolicMarginal_eq_1_2_1_2 (d : ℝ) (k : Fin 17) : + symbolicMarginal (shape 1 2 1) d 2 k = + if (2 : Fin 3) = stageCDistinguished (shape 1 2 1) then + (if k = 0 then d / 2 else if k = 1 then 1 - d else if k = 2 then d / 2 else 0) + else (if k = 0 then 1 / 2 else if k = 1 then 1 / 2 else 0) := by + simp only [symbolicMarginal, Fin.sum_univ_four] + fin_cases k <;> + norm_num [stageCAtom, stageCDistinguished, + stageCCanonicalAtom, shape, Matrix.cons_val_two, + Fin.ext_iff] <;> ring + +private theorem symbolicMarginal_eq_1_1_2_0 (d : ℝ) (k : Fin 17) : + symbolicMarginal (shape 1 1 2) d 0 k = + if (0 : Fin 3) = stageCDistinguished (shape 1 1 2) then + (if k = 0 then d / 2 else if k = 1 then 1 - d else if k = 2 then d / 2 else 0) + else (if k = 0 then 1 / 2 else if k = 1 then 1 / 2 else 0) := by + simp only [symbolicMarginal, Fin.sum_univ_four] + fin_cases k <;> + norm_num [stageCAtom, stageCDistinguished, + stageCCanonicalAtom, shape, Matrix.cons_val_two, + Fin.ext_iff] <;> ring + +private theorem symbolicMarginal_eq_1_1_2_1 (d : ℝ) (k : Fin 17) : + symbolicMarginal (shape 1 1 2) d 1 k = + if (1 : Fin 3) = stageCDistinguished (shape 1 1 2) then + (if k = 0 then d / 2 else if k = 1 then 1 - d else if k = 2 then d / 2 else 0) + else (if k = 0 then 1 / 2 else if k = 1 then 1 / 2 else 0) := by + simp only [symbolicMarginal, Fin.sum_univ_four] + fin_cases k <;> + norm_num [stageCAtom, stageCDistinguished, + stageCCanonicalAtom, shape, Matrix.cons_val_two, + Fin.ext_iff] <;> ring + +private theorem symbolicMarginal_eq_1_1_2_2 (d : ℝ) (k : Fin 17) : + symbolicMarginal (shape 1 1 2) d 2 k = + if (2 : Fin 3) = stageCDistinguished (shape 1 1 2) then + (if k = 0 then d / 2 else if k = 1 then 1 - d else if k = 2 then d / 2 else 0) + else (if k = 0 then 1 / 2 else if k = 1 then 1 / 2 else 0) := by + simp only [symbolicMarginal, Fin.sum_univ_four] + fin_cases k <;> + norm_num [stageCAtom, stageCDistinguished, + stageCCanonicalAtom, shape, Matrix.cons_val_two, + Fin.ext_iff] + +private theorem symbolicMarginal_eq (u : Shape) (hu : u ∈ shapes 4) + (hpos : positive u = true) (d : ℝ) (i : Fin 3) (k : Fin 17) : + symbolicMarginal u d i k = + if i = stageCDistinguished u then + (if k = 0 then d / 2 else if k = 1 then 1 - d else if k = 2 then d / 2 else 0) + else (if k = 0 then 1 / 2 else if k = 1 then 1 / 2 else 0) := by + rcases positive_four_shapes u hu hpos with rfl | rfl | rfl <;> fin_cases i + · exact symbolicMarginal_eq_1_1_2_0 d k + · exact symbolicMarginal_eq_1_1_2_1 d k + · exact symbolicMarginal_eq_1_1_2_2 d k + · exact symbolicMarginal_eq_1_2_1_0 d k + · exact symbolicMarginal_eq_1_2_1_1 d k + · exact symbolicMarginal_eq_1_2_1_2 d k + · exact symbolicMarginal_eq_2_1_1_0 d k + · exact symbolicMarginal_eq_2_1_1_1 d k + · exact symbolicMarginal_eq_2_1_1_2 d k + +theorem stageCMarginal_eq (t u : Shape) (hu : u ∈ shapes 4) + (hpos : positive u = true) (i : Fin 3) (k : Fin 17) : + stageCMarginal t u i k = + if i = stageCDistinguished u then + (if k = 0 then (binaryParameter t u : ℝ) / 2 + else if k = 1 then 1 - (binaryParameter t u : ℝ) + else if k = 2 then (binaryParameter t u : ℝ) / 2 else 0) + else (if k = 0 then 1 / 2 else if k = 1 then 1 / 2 else 0) := by + rw [stageCMarginal_symbolic] + exact symbolicMarginal_eq u hu hpos _ i k + +private theorem entropy_three_points {A : Type*} [Fintype A] [DecidableEq A] + (a b c : A) (hab : a ≠ b) (hac : a ≠ c) (hbc : b ≠ c) (p q r : ℝ) : + finiteEntropy (fun i => if i = a then p else if i = b then q + else if i = c then r else 0) = entropyTerm p + entropyTerm q + entropyTerm r := by + unfold finiteEntropy + calc + _ = ∑ i : A, ((if i = a then entropyTerm p else 0) + + (if i = b then entropyTerm q else 0) + (if i = c then entropyTerm r else 0)) := by + apply Finset.sum_congr rfl + intro i _ + by_cases ha : i = a + · subst i + simp [hab, hac] + · by_cases hb : i = b + · subst i + simp [ha, hbc] + · by_cases hc : i = c <;> simp [ha, hb, hc, Ne.symm hac, Ne.symm hbc] + _ = _ := by simp [Finset.sum_add_distrib] + +private theorem entropy_distinguished (d : ℚ) : + finiteEntropy (fun k : Fin 17 => + if k = 0 then (d : ℝ) / 2 else if k = 1 then 1 - (d : ℝ) + else if k = 2 then (d : ℝ) / 2 else 0) = binaryEntropyRate d := by + rw [entropy_three_points (0 : Fin 17) 1 2 (by decide) (by decide) (by decide)] + simp only [entropyTerm_divide] + unfold binaryEntropyRate + ring + +private theorem entropy_other : + finiteEntropy (fun k : Fin 17 => + if k = 0 then (1 / 2 : ℝ) else if k = 1 then 1 / 2 else 0) = Real.log 2 := by + rw [entropy_two_points (0 : Fin 17) 1 (by decide)] + simp only [entropyTerm_divide] + norm_num [entropyTerm] + ring + +theorem stageCMarginal_entropy (t u : Shape) (hu : u ∈ shapes 4) + (hpos : positive u = true) (i : Fin 3) : + finiteEntropy (stageCMarginal t u i) = + if i = stageCDistinguished u then binaryEntropyRate (binaryParameter t u) + else Real.log 2 := by + change finiteEntropy (fun k => stageCMarginal t u i k) = _ + simp_rw [stageCMarginal_eq t u hu hpos] + by_cases hi : i = stageCDistinguished u + · simp only [hi, ite_true] + exact entropy_distinguished _ + · simp only [hi, ite_false] + exact entropy_other + +theorem stageCMarginal_priority_entropy {K : ℕ} (h : PartC K) (i : Fin 3) : + finiteEntropy (stageCMarginal (cParameterParent h) (cShapeParent h) (cPriority h i)) = + if i = h.2 then binaryEntropyRate (binaryParameter (cParameterParent h) (cShapeParent h)) + else Real.log 2 := by + rw [stageCMarginal_entropy (cParameterParent h) (cShapeParent h) + (bShape_size h.1.val) h.1.property (cPriority h i)] + have hi : cPriority h i = stageCDistinguished (cShapeParent h) ↔ i = h.2 := by + rw [← cPriority_at_part h, Equiv.apply_eq_iff_eq] + simp only [hi] + +theorem allocation_capacity (allocation : Allocation) (d : ℚ) (i : Fin 3) : + (∑ part : Fin 3, (allocation.mass part : ℝ) * + (if i = part then binaryEntropyRate d else Real.log 2)) = + (1 - (allocation.mass i : ℝ)) * Real.log 2 + + (allocation.mass i : ℝ) * binaryEntropyRate d := by + have hsum : (∑ part : Fin 3, (allocation.mass part : ℝ)) = 1 := by + exact_mod_cast allocation.total + calc + _ = ∑ part : Fin 3, ((allocation.mass part : ℝ) * Real.log 2 + + if part = i then (allocation.mass i : ℝ) * (binaryEntropyRate d - Real.log 2) else 0) := by + apply Finset.sum_congr rfl + intro part _ + by_cases hp : part = i + · subst part + simp only [ite_true] + ring + · simp [hp, Ne.symm hp] + _ = _ := by + rw [Finset.sum_add_distrib, ← Finset.sum_mul] + simp only [hsum, one_mul, Finset.sum_ite_eq', Finset.mem_univ, ite_true] + ring + +end MatrixMultiplication.AllFieldStageCCapacity + +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/Parameters/TerminalPopulations.lean b/lean/OAI/LinearAlgebra/MatrixFields/Parameters/TerminalPopulations.lean new file mode 100644 index 0000000000000000000000000000000000000000..299a95b26c73833de0700864f2a827b5fa8d4f62 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/Parameters/TerminalPopulations.lean @@ -0,0 +1,197 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Entropy.ConditionalRateBridge + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +noncomputable section + +namespace MatrixMultiplication.AllFieldTerminalPopulations + +open AllFieldHistory +open scoped BigOperators +attribute [local instance] Classical.propDecidable Classical.decEq + +variable {K : ℕ} {H : Type*} [Fintype H] + {A : H → Type*} [∀ h, Fintype (A h)] + +def law (ν : ∀ h, A h → ℚ) (x : Sigma A) : ℚ := ν x.1 x.2 + +def denominator (ν : ∀ h, A h → ℚ) : ℕ := + AllFieldPopulationCounts.denominator (law ν) + +def dilation (ν : ∀ h, A h → ℚ) (m : ℕ) : ℕ := m * denominator ν + +def count (allocation : Allocation) (history : H → History K) + (ν : ∀ h, A h → ℚ) (m : ℕ) (h : H) (a : A h) : ℕ := + population allocation m (history h) * + AllFieldPopulationCounts.baseCount (law ν) ⟨h, a⟩ + +theorem denominator_pos (ν : ∀ h, A h → ℚ) : 0 < denominator ν := + AllFieldPopulationCounts.denominator_pos (law ν) + +theorem dilation_pos (ν : ∀ h, A h → ℚ) {m : ℕ} (hm : 0 < m) : + 0 < dilation ν m := Nat.mul_pos hm (denominator_pos ν) + +theorem baseCount_cast (ν : ∀ h, A h → ℚ) (hν : ∀ h a, 0 ≤ ν h a) + (h : H) (a : A h) : + (AllFieldPopulationCounts.baseCount (law ν) ⟨h, a⟩ : ℚ) = + (denominator ν : ℚ) * ν h a := + AllFieldPopulationCounts.baseCount_cast (law ν) (fun x => hν x.1 x.2) ⟨h, a⟩ + +theorem sum_baseCount (ν : ∀ h, A h → ℚ) (hν : ∀ h a, 0 ≤ ν h a) + (htotal : ∀ h, ∑ a, ν h a = 1) (h : H) : + (∑ a, AllFieldPopulationCounts.baseCount (law ν) ⟨h, a⟩) = denominator ν := by + apply Nat.cast_injective (R := ℚ) + simp only [Nat.cast_sum, baseCount_cast ν hν, ← Finset.mul_sum, htotal, mul_one] + +theorem population_dilation (allocation : Allocation) (ν : ∀ h, A h → ℚ) + (m : ℕ) (h : History K) : + population allocation (dilation ν m) h = + population allocation m h * denominator ν := by + simp only [population, AllFieldPopulationCounts.count, dilation] + ac_rfl + +theorem populationLength_dilation (allocation : Allocation) (ν : ∀ h, A h → ℚ) + (m : ℕ) : + populationLength (K := K) allocation (dilation ν m) = + populationLength (K := K) allocation m * denominator ν := by + simp only [populationLength, AllFieldPopulationCounts.blockLength, dilation] + ac_rfl + +theorem sum_count (allocation : Allocation) (history : H → History K) + (ν : ∀ h, A h → ℚ) (hν : ∀ h a, 0 ≤ ν h a) + (htotal : ∀ h, ∑ a, ν h a = 1) (m : ℕ) (h : H) : + (∑ a, count allocation history ν m h a) = + population allocation (dilation ν m) (history h) := by + simp only [count, ← Finset.mul_sum, sum_baseCount ν hν htotal, + population_dilation] + +theorem count_cast (allocation : Allocation) (history : H → History K) + (ν : ∀ h, A h → ℚ) (hν : ∀ h a, 0 ≤ ν h a) + (m : ℕ) (h : H) (a : A h) : + (count allocation history ν m h a : ℚ) = + (populationLength (K := K) allocation (dilation ν m) : ℚ) * + amount allocation (history h) * ν h a := by + rw [count, Nat.cast_mul, population_cast, baseCount_cast ν hν, + populationLength_dilation, Nat.cast_mul] + ring + +theorem count_cast_real (allocation : Allocation) (history : H → History K) + (ν : ∀ h, A h → ℚ) (hν : ∀ h a, 0 ≤ ν h a) + (m : ℕ) (h : H) (a : A h) : + (count allocation history ν m h a : ℝ) = + (populationLength (K := K) allocation (dilation ν m) : ℝ) * + (amount allocation (history h) : ℝ) * (ν h a : ℝ) := by + exact_mod_cast count_cast allocation history ν hν m h a + +theorem count_dilate (allocation : Allocation) (history : H → History K) + (ν : ∀ h, A h → ℚ) (m n : ℕ) (h : H) (a : A h) : + count allocation history ν (m * n) h a = + m * count allocation history ν n h a := by + simp only [count, population, AllFieldPopulationCounts.count] + ac_rfl + +theorem count_mul_one (allocation : Allocation) (history : H → History K) + (ν : ∀ h, A h → ℚ) (m : ℕ) (h : H) (a : A h) : + count allocation history ν m h a = m * count allocation history ν 1 h a := by + simpa only [Nat.mul_one] using count_dilate allocation history ν m 1 h a + +theorem source_population_pos (allocation : Allocation) (ν : ∀ h, A h → ℚ) + {m : ℕ} (hm : 0 < m) (h : History K) (hh : 0 < amount allocation h) : + 0 < population allocation (dilation ν m) h := + (AllFieldPopulationCounts.count_pos_iff (amount allocation) + (amount_nonneg allocation) (dilation_pos ν hm) h).2 hh + +theorem sum_count_pos (allocation : Allocation) (history : H → History K) + (ν : ∀ h, A h → ℚ) (hν : ∀ h a, 0 ≤ ν h a) + (htotal : ∀ h, ∑ a, ν h a = 1) {m : ℕ} (hm : 0 < m) + (h : H) (hh : 0 < amount allocation (history h)) : + 0 < ∑ a, count allocation history ν m h a := by + rw [sum_count allocation history ν hν htotal] + exact source_population_pos allocation ν hm (history h) hh + +theorem count_positive_law_positive (allocation : Allocation) (history : H → History K) + (ν : ∀ h, A h → ℚ) (hν : ∀ h a, 0 ≤ ν h a) + (m : ℕ) (h : H) (a : A h) (ha : 0 < count allocation history ν m h a) : + 0 < ν h a := by + have hb : 0 < AllFieldPopulationCounts.baseCount (law ν) ⟨h, a⟩ := + Nat.pos_of_mul_pos_left ha + have hbq : (0 : ℚ) < AllFieldPopulationCounts.baseCount (law ν) ⟨h, a⟩ := by + exact_mod_cast hb + rw [baseCount_cast ν hν] at hbq + have hD : (0 : ℚ) < denominator ν := by exact_mod_cast denominator_pos ν + exact (mul_pos_iff_of_pos_left hD).mp hbq + +theorem count_pos_iff (allocation : Allocation) (history : H → History K) + (ν : ∀ h, A h → ℚ) (hν : ∀ h a, 0 ≤ ν h a) + {m : ℕ} (hm : 0 < m) (h : H) (hh : 0 < amount allocation (history h)) + (a : A h) : 0 < count allocation history ν m h a ↔ 0 < ν h a := by + constructor + · exact count_positive_law_positive allocation history ν hν m h a + · intro ha + apply Nat.mul_pos + · exact (AllFieldPopulationCounts.count_pos_iff (amount allocation) + (amount_nonneg allocation) hm (history h)).2 hh + · have hb := (AllFieldPopulationCounts.count_pos_iff (law ν) + (fun x => hν x.1 x.2) (m := 1) (by decide) ⟨h, a⟩).2 ha + simpa only [AllFieldPopulationCounts.count, one_mul] using hb + +theorem count_eq_zero_of_law_eq_zero (allocation : Allocation) (history : H → History K) + (ν : ∀ h, A h → ℚ) (hν : ∀ h a, 0 ≤ ν h a) + (m : ℕ) (h : H) (a : A h) (ha : ν h a = 0) : + count allocation history ν m h a = 0 := by + apply Nat.cast_injective (R := ℚ) + simp only [count_cast allocation history ν hν, ha, mul_zero, Nat.cast_zero] + +theorem count_ratio (allocation : Allocation) (history : H → History K) + (ν : ∀ h, A h → ℚ) (hν : ∀ h a, 0 ≤ ν h a) + (htotal : ∀ h, ∑ a, ν h a = 1) {m : ℕ} (hm : 0 < m) + (h : H) (hh : 0 < amount allocation (history h)) (a : A h) : + (count allocation history ν m h a : ℚ) / + (∑ b, count allocation history ν m h b : ℕ) = ν h a := by + rw [sum_count allocation history ν hν htotal, count_cast allocation history ν hν, + population_cast] + have hp : (populationLength (K := K) allocation (dilation ν m) : ℚ) * + amount allocation (history h) ≠ 0 := by + rw [← population_cast] + exact_mod_cast (Nat.ne_of_gt (source_population_pos allocation ν hm (history h) hh)) + exact mul_div_cancel_left₀ _ hp + +theorem count_ratio_real (allocation : Allocation) (history : H → History K) + (ν : ∀ h, A h → ℚ) (hν : ∀ h a, 0 ≤ ν h a) + (htotal : ∀ h, ∑ a, ν h a = 1) {m : ℕ} (hm : 0 < m) + (h : H) (hh : 0 < amount allocation (history h)) (a : A h) : + (count allocation history ν m h a : ℝ) / + (∑ b, count allocation history ν m h b : ℕ) = (ν h a : ℝ) := by + have hq := congrArg (fun q : ℚ => (q : ℝ)) + (count_ratio allocation history ν hν htotal hm h hh a) + simpa only [Rat.cast_div, Rat.cast_natCast] using hq + +theorem normalizedCountLaw_mass (allocation : Allocation) (history : H → History K) + (ν : ∀ h, A h → ℚ) (hν : ∀ h a, 0 ≤ ν h a) + (htotal : ∀ h, ∑ a, ν h a = 1) {m : ℕ} (hm : 0 < m) + (h : H) (hh : 0 < amount allocation (history h)) (a : A h) : + (ConditionalLabels.normalizedCountLaw (count allocation history ν m h) + (sum_count_pos allocation history ν hν htotal hm h hh)).mass a = (ν h a : ℝ) := + count_ratio_real allocation history ν hν htotal hm h hh a + +theorem normalizedCountLaw_mass_eq (allocation : Allocation) (history : H → History K) + (ν : ∀ h, A h → ℚ) (hν : ∀ h a, 0 ≤ ν h a) + (htotal : ∀ h, ∑ a, ν h a = 1) {m : ℕ} (hm : 0 < m) + (h : H) (hh : 0 < amount allocation (history h)) : + (ConditionalLabels.normalizedCountLaw (count allocation history ν m h) + (sum_count_pos allocation history ν hν htotal hm h hh)).mass = + fun a => (ν h a : ℝ) := + funext (normalizedCountLaw_mass allocation history ν hν htotal hm h hh) + +end MatrixMultiplication.AllFieldTerminalPopulations + +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/Tensors/CWCompleteStatistics.lean b/lean/OAI/LinearAlgebra/MatrixFields/Tensors/CWCompleteStatistics.lean new file mode 100644 index 0000000000000000000000000000000000000000..f1455b5ae99ad84c8d3613642ea43396d290c93c --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/Tensors/CWCompleteStatistics.lean @@ -0,0 +1,1348 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Construction.ComplexRectangularASI +import OAI.LinearAlgebra.MatrixFields.Construction.ExactStatisticWords +import OAI.LinearAlgebra.MatrixFields.Construction.JointMaskedAssignment + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section + +open scoped BigOperators +open MatrixMultiplication.Foundation + +namespace MatrixMultiplication.FieldCoefficientExtraction + +variable {F X Y Z : Type*} + +theorem coeff_triple [CommSemiring F] (a b c : Polynomial F) (d : ℕ) : + (a * b * c).coeff d = + ∑ i : Fin (d + 1), ∑ j : Fin (d + 1), + (if j.val ≤ d - i.val then a.coeff (d - i.val - j.val) else 0) * + b.coeff j.val * c.coeff i.val := by + classical + rw [show a * b * c = c * (b * a) by ring] + rw [Polynomial.coeff_mul, Finset.Nat.sum_antidiagonal_eq_sum_range_succ_mk] + rw [← Fin.sum_univ_eq_sum_range] + apply Finset.sum_congr rfl + intro i hi + rw [Polynomial.coeff_mul, Finset.Nat.sum_antidiagonal_eq_sum_range_succ_mk] + rw [Finset.mul_sum] + rw [Fin.sum_univ_eq_sum_range (fun j : ℕ => + (if j ≤ d - i.val then a.coeff (d - i.val - j) else 0) * + b.coeff j * c.coeff i.val) (d + 1)] + symm + calc + (∑ j ∈ Finset.range (d + 1), + (if j ≤ d - i.val then a.coeff (d - i.val - j) else 0) * + b.coeff j * c.coeff i.val) = + ∑ j ∈ Finset.range (d - i.val + 1), + (if j ≤ d - i.val then a.coeff (d - i.val - j) else 0) * + b.coeff j * c.coeff i.val := by + symm + apply Finset.sum_subset (Finset.range_mono (by omega)) + intro j hj hjnot + have h : ¬ j ≤ d - i.val := by + simpa only [Finset.mem_range, Nat.lt_succ_iff] using hjnot + simp [h] + _ = ∑ j ∈ Finset.range (d - i.val + 1), + c.coeff i.val * (b.coeff j * a.coeff (d - i.val - j)) := by + apply Finset.sum_congr rfl + intro j hj + rw [ite_eq_left (Nat.le_of_lt_succ (Finset.mem_range.mp hj))] + ring + +theorem rankAtMost_coeff [CommSemiring F] + {P : Tensor (Polynomial F) X Y Z} {r : ℕ} + (hP : Tensor.RankAtMost P r) (d : ℕ) : + Tensor.RankAtMost (fun x y z => (P x y z).coeff d) ((d + 1) ^ 2 * r) := by + classical + rcases hP with ⟨a, b, c, rfl⟩ + let aa : (Fin r × Fin (d + 1) × Fin (d + 1)) → X → F := + fun v x => if v.2.2.val ≤ d - v.2.1.val then + (a v.1 x).coeff (d - v.2.1.val - v.2.2.val) else 0 + let bb : (Fin r × Fin (d + 1) × Fin (d + 1)) → Y → F := + fun v y => (b v.1 y).coeff v.2.2.val + let cc : (Fin r × Fin (d + 1) × Fin (d + 1)) → Z → F := + fun v z => (c v.1 z).coeff v.2.1.val + have heq : (fun x y z => (∑ j, Tensor.rankOne (a j) (b j) (c j) x y z).coeff d) = + fun x y z => ∑ v, Tensor.rankOne (aa v) (bb v) (cc v) x y z := by + funext x y z + simp only [Polynomial.finsetSum_coeff, Tensor.rankOne, Fintype.sum_prod_type, + coeff_triple, aa, bb, cc] + rw [heq] + simpa only [Fintype.card_prod, Fintype.card_fin, pow_two, Nat.mul_comm, + Nat.mul_left_comm, Nat.mul_assoc] using Tensor.rankAtMost_sum_rankOne aa bb cc + +theorem rank_power [Field F] {T : Tensor F X Y Z} {r d D : ℕ} + (A : Tensor.PolynomialApproximation T r d D) (n : ℕ) : + Tensor.RankAtMost (Tensor.power T n) ((d * n + 1) ^ 2 * r ^ n) := by + have h := rankAtMost_coeff (A.power n).rank_bound (d * n) + have heq : (fun x y z => ((A.power n).polynomial x y z).coeff (d * n)) = + Tensor.power T n := by + funext x y z + exact (A.power n).leading x y z + rw [heq] at h + exact h + +end MatrixMultiplication.FieldCoefficientExtraction + +end + + + + +noncomputable section + +open scoped BigOperators +open MatrixMultiplication.Foundation Polynomial + +namespace MatrixMultiplication.FieldCW + +section Integral + +variable (F : Type*) [CommRing F] (q : ℕ) + +def zeroForm (x : Fin (q + 2)) : F := if x.val = 0 then 1 else 0 + +def interiorForm (i : Fin q) (x : Fin (q + 2)) : F := + if x.val = i.val + 1 then 1 else 0 + +def lastForm (x : Fin (q + 2)) : F := if x.val = q + 1 then 1 else 0 + +def interiorSum (x : Fin (q + 2)) : F := ∑ i, interiorForm F q i x + +def tensor : Tensor F (Fin (q + 2)) (Fin (q + 2)) (Fin (q + 2)) := + fun x y z => + (∑ i : Fin q, + (zeroForm F q x * interiorForm F q i y * interiorForm F q i z + + interiorForm F q i x * zeroForm F q y * interiorForm F q i z + + interiorForm F q i x * interiorForm F q i y * zeroForm F q z)) + + lastForm F q x * zeroForm F q y * zeroForm F q z + + zeroForm F q x * lastForm F q y * zeroForm F q z + + zeroForm F q x * zeroForm F q y * lastForm F q z + +theorem interior_pair_sum (x y : Fin (q + 2)) : + (∑ i : Fin q, interiorForm F q i x * interiorForm F q i y) = + if x = y ∧ 1 ≤ x.val ∧ x.val ≤ q then 1 else 0 := by + classical + by_cases hx : 1 ≤ x.val ∧ x.val ≤ q + · let i : Fin q := ⟨x.val - 1, by omega⟩ + rw [Finset.sum_eq_single i] + · simp [interiorForm, i, Nat.sub_add_cancel hx.1, hx.1, hx.2, + Fin.ext_iff, eq_comm] + · intro j hj hji + have hne : x.val ≠ j.val + 1 := by + intro h + apply hji + apply Fin.ext + dsimp [i] + omega + simp [interiorForm, hne] + · simp + · have hsum : (∑ i : Fin q, interiorForm F q i x * interiorForm F q i y) = 0 := by + apply Finset.sum_eq_zero + intro i hi + have hne : x.val ≠ i.val + 1 := by + intro h + apply hx + have := i.isLt + omega + simp [interiorForm, hne] + rw [hsum, ite_eq_right] + intro h + exact hx ⟨h.2.1, h.2.2⟩ + +theorem tensor_zero_side (x y z : Fin (q + 2)) (hx : x.val = 0) : + tensor F q x y z = + if (y.val = 0 ∧ z.val = q + 1) ∨ + (y.val = q + 1 ∧ z.val = 0) ∨ + (1 ≤ y.val ∧ y.val ≤ q ∧ y = z) then 1 else 0 := by + have hx0 : zeroForm F q x = 1 := by simp [zeroForm, hx] + have hxlast : lastForm F q x = 0 := by simp [lastForm, hx] + have hxmid (i : Fin q) : interiorForm F q i x = 0 := by + simp [interiorForm, hx] + simp only [tensor, hx0, hxlast, hxmid, one_mul, zero_mul, add_zero] + rw [interior_pair_sum] + by_cases hy0 : y.val = 0 + · simp [zeroForm, lastForm, hy0] + · by_cases hylast : y.val = q + 1 + · have hyinter : ¬ y.val ≤ q := by omega + simp [zeroForm, lastForm, hylast] + · have hylo : 1 ≤ y.val := by omega + have hyhi : y.val ≤ q := by have := y.isLt; omega + simp [zeroForm, lastForm, hy0, hylast, hylo, hyhi] + +theorem tensor_cyclic (x y z : Fin (q + 2)) : + tensor F q x y z = tensor F q y z x := by + unfold tensor + have hsum : + (∑ i : Fin q, + (zeroForm F q x * interiorForm F q i y * interiorForm F q i z + + interiorForm F q i x * zeroForm F q y * interiorForm F q i z + + interiorForm F q i x * interiorForm F q i y * zeroForm F q z)) = + ∑ i : Fin q, + (zeroForm F q y * interiorForm F q i z * interiorForm F q i x + + interiorForm F q i y * zeroForm F q z * interiorForm F q i x + + interiorForm F q i y * interiorForm F q i z * zeroForm F q x) := by + apply Finset.sum_congr rfl + intro i hi + ring + rw [hsum] + ring + +def form (e : ℕ) (u v : F) : Polynomial F := C u + X ^ e * C v + +def left : Option (Option (Fin q)) → Fin (q + 2) → Polynomial F + | some (some i), x => X * form F 1 (zeroForm F q x) (interiorForm F q i x) + | some none, x => -form F 2 (zeroForm F q x) (interiorSum F q x) + | none, x => (1 - C (q : F) * X) * form F 3 (zeroForm F q x) (lastForm F q x) + +def other : Option (Option (Fin q)) → Fin (q + 2) → Polynomial F + | some (some i), x => form F 1 (zeroForm F q x) (interiorForm F q i x) + | some none, x => form F 2 (zeroForm F q x) (interiorSum F q x) + | none, x => form F 3 (zeroForm F q x) (lastForm F q x) + +def polynomial : Tensor (Polynomial F) (Fin (q + 2)) (Fin (q + 2)) (Fin (q + 2)) := + fun x y z => ∑ i, Tensor.rankOne (left F q i) (other F q i) (other F q i) x y z + +theorem rank_bound : Tensor.RankAtMost (polynomial F q) (q + 2) := by + unfold polynomial + simpa only [Fintype.card_option, Fintype.card_fin, Nat.add_assoc, + Nat.reduceAdd] using + Tensor.rankAtMost_sum_rankOne (left F q) (other F q) (other F q) + +theorem polynomial_apply (x y z : Fin (q + 2)) : + polynomial F q x y z = + (∑ i : Fin q, X * form F 1 (zeroForm F q x) (interiorForm F q i x) * + form F 1 (zeroForm F q y) (interiorForm F q i y) * + form F 1 (zeroForm F q z) (interiorForm F q i z)) - + form F 2 (zeroForm F q x) (interiorSum F q x) * + form F 2 (zeroForm F q y) (interiorSum F q y) * + form F 2 (zeroForm F q z) (interiorSum F q z) + + (1 - C (q : F) * X) * form F 3 (zeroForm F q x) (lastForm F q x) * + form F 3 (zeroForm F q y) (lastForm F q y) * + form F 3 (zeroForm F q z) (lastForm F q z) := by + simp only [polynomial, Fintype.sum_option, Tensor.rankOne, left, other] + ring + +private theorem coeff_mul_two (a b : Polynomial F) : + (a * b).coeff 2 = a.coeff 0 * b.coeff 2 + a.coeff 1 * b.coeff 1 + + a.coeff 2 * b.coeff 0 := by + rw [Polynomial.coeff_mul, Finset.Nat.sum_antidiagonal_eq_sum_range_succ_mk] + simp [Finset.sum_range_succ, add_assoc] + +private theorem coeff_mul_three (a b : Polynomial F) : + (a * b).coeff 3 = a.coeff 0 * b.coeff 3 + a.coeff 1 * b.coeff 2 + + a.coeff 2 * b.coeff 1 + a.coeff 3 * b.coeff 0 := by + rw [Polynomial.coeff_mul, Finset.Nat.sum_antidiagonal_eq_sum_range_succ_mk] + simp [Finset.sum_range_succ, add_assoc] + +theorem vanishes (x y z : Fin (q + 2)) (k : ℕ) (hk : k < 3) : + (polynomial F q x y z).coeff k = 0 := by + interval_cases k <;> + simp [polynomial_apply, Polynomial.mul_coeff_zero, + Polynomial.mul_coeff_one, coeff_mul_two, form, Polynomial.coeff_add, + Polynomial.coeff_sub, interiorSum, + Polynomial.coeff_one, Polynomial.coeff_X, + Finset.sum_add_distrib, Finset.sum_mul, Finset.mul_sum] <;> + simp only [mul_assoc, mul_comm] <;> ring_nf + simp only [Finset.sum_add_distrib, Finset.mul_sum, mul_assoc, mul_comm] + ring + +theorem leading (x y z : Fin (q + 2)) : + (polynomial F q x y z).coeff 3 = tensor F q x y z := by + simp [polynomial_apply, Polynomial.mul_coeff_zero, + Polynomial.mul_coeff_one, coeff_mul_two, coeff_mul_three, form, + Polynomial.coeff_add, Polynomial.coeff_sub, + tensor, Polynomial.coeff_one, Polynomial.coeff_X, + Finset.sum_add_distrib] + simp only [mul_assoc, mul_comm, mul_left_comm] + ring_nf + simp only [Finset.sum_add_distrib, mul_assoc, mul_comm, mul_left_comm] + ring + +def degreeBound : ℕ := Finset.univ.sup fun xyz : + Fin (q + 2) × Fin (q + 2) × Fin (q + 2) => + (polynomial F q xyz.1 xyz.2.1 xyz.2.2).natDegree + +theorem degree_bound (x y z : Fin (q + 2)) : + (polynomial F q x y z).degree ≤ degreeBound F q := by + let f : (Fin (q + 2) × Fin (q + 2) × Fin (q + 2)) → ℕ := + fun xyz => (polynomial F q xyz.1 xyz.2.1 xyz.2.2).natDegree + have h := Finset.le_sup (s := Finset.univ) (f := f) (b := (x, y, z)) + (Finset.mem_univ (x, y, z)) + exact Polynomial.degree_le_of_natDegree_le h + +end Integral + +variable (F : Type*) [Field F] (q : ℕ) + +def approximation : Tensor.PolynomialApproximation (tensor F q) (q + 2) 3 + (degreeBound F q) where + polynomial := polynomial F q + rank_bound := rank_bound F q + vanishes := vanishes F q + leading := leading F q + degree_bound := degree_bound F q + +theorem rank_power (n : ℕ) : + Tensor.RankAtMost (Tensor.power (tensor F q) n) ((3 * n + 1) ^ 2 * (q + 2) ^ n) := + FieldCoefficientExtraction.rank_power (approximation F q) n + +end MatrixMultiplication.FieldCW + +end + + + + +namespace MatrixMultiplication.CWLeafRestrictions + +open MatrixMultiplication.Foundation + +def lastLabel (q : ℕ) : Fin (q + 2) := ⟨q + 1, by omega⟩ + +def complement (q : ℕ) : Fin (q + 2) ≃ Fin (q + 2) := + Equiv.swap 0 (lastLabel q) + +@[simp] theorem complement_zero (q : ℕ) : complement q 0 = lastLabel q := by + simp [complement] + +@[simp] theorem complement_last (q : ℕ) : complement q (lastLabel q) = 0 := by + simp [complement] + +@[simp] theorem complement_involution (q : ℕ) (x : Fin (q + 2)) : + complement q (complement q x) = x := by + simp [complement] + +theorem complement_interior (q : ℕ) (x : Fin (q + 2)) + (hx0 : x.val ≠ 0) (hxlast : x.val ≠ q + 1) : complement q x = x := by + apply Equiv.swap_apply_of_ne_of_ne + · intro h + exact hx0 (congrArg Fin.val h) + · intro h + exact hxlast (congrArg Fin.val h) + +theorem zero_support_iff (q : ℕ) (y z : Fin (q + 2)) : + ((y.val = 0 ∧ z.val = q + 1) ∨ + (y.val = q + 1 ∧ z.val = 0) ∨ + (1 ≤ y.val ∧ y.val ≤ q ∧ y = z)) ↔ complement q y = z := by + by_cases hy0 : y.val = 0 + · have hy : y = 0 := Fin.ext hy0 + subst y + rw [complement_zero] + constructor + · rintro (⟨_, hz⟩ | ⟨hy, _⟩ | ⟨hy, _⟩) + · exact Fin.ext hz.symm + · have : (0 : ℕ) = q + 1 := hy + omega + · have : 1 ≤ (0 : ℕ) := hy + omega + · intro h + exact Or.inl ⟨rfl, (congrArg Fin.val h).symm⟩ + · by_cases hylast : y.val = q + 1 + · have hy : y = lastLabel q := Fin.ext hylast + subst y + rw [complement_last] + constructor + · rintro (⟨hy, _⟩ | ⟨_, hz⟩ | ⟨_, hy, _⟩) + · have : q + 1 = 0 := hy + omega + · exact Fin.ext hz.symm + · have : q + 1 ≤ q := hy + omega + · intro h + exact Or.inr (Or.inl ⟨rfl, (congrArg Fin.val h).symm⟩) + · have hlo : 1 ≤ y.val := by omega + have hhi : y.val ≤ q := by have := y.isLt; omega + rw [complement_interior q y hy0 hylast] + simp [hy0, hylast, hlo, hhi] + +theorem tensor_zero_matching (F : Type*) [CommRing F] (q : ℕ) + (y z : Fin (q + 2)) : + FieldCW.tensor F q 0 y (complement q z) = if y = z then 1 else 0 := by + rw [FieldCW.tensor_zero_side F q 0 y (complement q z) rfl] + simp only [zero_support_iff, Equiv.apply_eq_iff_eq] + +theorem tensor_middle_zero_matching (F : Type*) [CommRing F] (q : ℕ) + (x z : Fin (q + 2)) : + FieldCW.tensor F q x 0 (complement q z) = if x = z then 1 else 0 := by + rw [FieldCW.tensor_cyclic F q x 0 (complement q z)] + have h := tensor_zero_matching F q (complement q z) (complement q x) + simpa only [complement_involution, Equiv.apply_eq_iff_eq, eq_comm] using h + +theorem tensor_last_zero_matching (F : Type*) [CommRing F] (q : ℕ) + (x y : Fin (q + 2)) : + FieldCW.tensor F q x (complement q y) 0 = if x = y then 1 else 0 := by + rw [FieldCW.tensor_cyclic F q x (complement q y) 0, + FieldCW.tensor_cyclic F q (complement q y) 0 x] + exact tensor_zero_matching F q x y + +theorem zeroX_leaf (F : Type*) [CommRing F] (q n : ℕ) + (p : (Fin n → Fin (q + 2)) → Prop) [DecidablePred p] : + Tensor.pullback (fun _ : Unit × Unit => fun _ : Fin n => (0 : Fin (q + 2))) + (fun y : Unit × {w // p w} => y.2.val) + (fun z : {w // p w} × Unit => fun i => complement q (z.1.val i)) + (Tensor.power (FieldCW.tensor F q) n) = + Tensor.matrixCoefficients Unit Unit {w // p w} := + LeafVolumes.matchingPower_matrixCoefficients (FieldCW.tensor F q) 0 + (complement q) (tensor_zero_matching F q) n p + +theorem zeroY_leaf (F : Type*) [CommRing F] (q n : ℕ) + (p : (Fin n → Fin (q + 2)) → Prop) [DecidablePred p] : + Tensor.pullback (fun x : {w // p w} × Unit => x.1.val) + (fun _ : Unit × Unit => fun _ : Fin n => (0 : Fin (q + 2))) + (fun z : Unit × {w // p w} => fun i => complement q (z.2.val i)) + (Tensor.power (FieldCW.tensor F q) n) = + Tensor.matrixCoefficients {w // p w} Unit Unit := by + funext x y z + simp only [Tensor.pullback, Tensor.power, tensor_middle_zero_matching, + Fintype.prod_boole, ← funext_iff, Tensor.matrixCoefficients] + simp [Subtype.ext_iff, eq_comm] + +theorem zeroZ_leaf (F : Type*) [CommRing F] (q n : ℕ) + (p : (Fin n → Fin (q + 2)) → Prop) [DecidablePred p] : + Tensor.pullback (fun x : Unit × {w // p w} => x.2.val) + (fun y : {w // p w} × Unit => fun i => complement q (y.1.val i)) + (fun _ : Unit × Unit => fun _ : Fin n => (0 : Fin (q + 2))) + (Tensor.power (FieldCW.tensor F q) n) = + Tensor.matrixCoefficients Unit {w // p w} Unit := by + funext x y z + simp only [Tensor.pullback, Tensor.power, tensor_last_zero_matching, + Fintype.prod_boole, ← funext_iff, Tensor.matrixCoefficients] + simp [Subtype.ext_iff] + +end MatrixMultiplication.CWLeafRestrictions + + + + + +namespace MatrixMultiplication.CWLeafStatistics + +open MatrixMultiplication.Foundation + +def weight (x : Fin 7) : ℕ := if x.val = 0 then 0 else if x.val = 6 then 2 else 1 + +def pairStatistic (x : Fin 7 × Fin 7) : Fin 6 := + if weight x.1 + weight x.2 = 0 then 0 + else if weight x.1 + weight x.2 = 1 then 1 + else if weight x.1 + weight x.2 = 2 then + if weight x.1 = 1 ∧ weight x.2 = 1 then 2 else 3 + else if weight x.1 + weight x.2 = 3 then 4 else 5 + +theorem statistic_weight : ∀ x : Fin 7 × Fin 7, + AllFieldParameters.statisticWeight (pairStatistic x) = weight x.1 + weight x.2 := by + decide +kernel + +theorem pair_multiplicity : ∀ i : Fin 6, + Fintype.card {x : Fin 7 × Fin 7 // pairStatistic x = i} = + AllFieldParameters.multiplicity i := by + decide +kernel + +theorem complement_weight : ∀ x : Fin 7, + weight (CWLeafRestrictions.complement 5 x) + weight x = 2 := by + decide +kernel + +theorem complement_statistic : ∀ x : Fin 7 × Fin 7, + pairStatistic (CWLeafRestrictions.complement 5 x.1, + CWLeafRestrictions.complement 5 x.2) = + AllFieldParameters.kappa (pairStatistic x) := by + decide +kernel + +theorem ordered_pair_multiplicity (i j : Fin 6) : + Fintype.card {x : (Fin 7 × Fin 7) × (Fin 7 × Fin 7) // + pairStatistic x.1 = i ∧ pairStatistic x.2 = j} = + AllFieldParameters.multiplicity i * AllFieldParameters.multiplicity j := by + let e : {x : (Fin 7 × Fin 7) × (Fin 7 × Fin 7) // + pairStatistic x.1 = i ∧ pairStatistic x.2 = j} ≃ + {x : Fin 7 × Fin 7 // pairStatistic x = i} × + {x : Fin 7 × Fin 7 // pairStatistic x = j} := + { toFun := fun x => (⟨x.val.1, x.property.1⟩, ⟨x.val.2, x.property.2⟩) + invFun := fun x => ⟨(x.1.val, x.2.val), x.1.property, x.2.property⟩ + left_inv := by intro x; rfl + right_inv := by intro x; rfl } + rw [Fintype.card_congr e, Fintype.card_prod, pair_multiplicity, pair_multiplicity] + +end MatrixMultiplication.CWLeafStatistics + + + + + +noncomputable section + +namespace MatrixMultiplication.CWCompatibilityTransfer + +open MatrixMultiplication.Foundation CWLeafRestrictions InheritedMasks +open scoped BigOperators + +def wordWeight {n : ℕ} (w : Fin n → Fin 7) : ℕ := ∑ i, CWLeafStatistics.weight (w i) + +def wordComplement {n : ℕ} (w : Fin n → Fin 7) : Fin n → Fin 7 := + fun i => complement 5 (w i) + +@[simp] theorem wordComplement_involution {n : ℕ} (w : Fin n → Fin 7) : + wordComplement (wordComplement w) = w := by + funext i + exact complement_involution 5 (w i) + +theorem weight_eq_zero_iff : ∀ x : Fin 7, CWLeafStatistics.weight x = 0 ↔ x = 0 := by + decide +kernel + +theorem wordWeight_zero {n : ℕ} (w : Fin n → Fin 7) (h : wordWeight w = 0) : + ∀ i, w i = 0 := by + intro i + have hle : CWLeafStatistics.weight (w i) ≤ wordWeight w := by + unfold wordWeight + exact Finset.single_le_sum (fun j _ => Nat.zero_le (CWLeafStatistics.weight (w j))) + (Finset.mem_univ i) + apply (weight_eq_zero_iff (w i)).mp + omega + +theorem site_nonzero {F : Type*} [CommRing F] {n : ℕ} + (x y z : Fin n → Fin 7) + (h : Tensor.power (FieldCW.tensor F 5) n x y z ≠ 0) (i : Fin n) : + FieldCW.tensor F 5 (x i) (y i) (z i) ≠ 0 := by + intro hi + apply h + exact Finset.prod_eq_zero (Finset.mem_univ i) hi + +theorem zeroX_word_match {F : Type*} [CommRing F] {n : ℕ} + (x y z : Fin n → Fin 7) + (h : Tensor.power (FieldCW.tensor F 5) n x y z ≠ 0) + (hx : wordWeight x = 0) : z = wordComplement y := by + funext i + have hi := site_nonzero x y z h i + rw [wordWeight_zero x hx i] at hi + have heq : FieldCW.tensor F 5 0 (y i) (z i) = + if y i = complement 5 (z i) then 1 else 0 := by + simpa only [complement_involution] using + tensor_zero_matching F 5 (y i) (complement 5 (z i)) + have hyz : y i = complement 5 (z i) := by + by_contra hn + rw [heq, ite_eq_right hn] at hi + exact hi rfl + have hh := congrArg (complement 5) hyz + simpa only [wordComplement, complement_involution] using hh.symm + +theorem zeroY_word_match {F : Type*} [CommRing F] {n : ℕ} + (x y z : Fin n → Fin 7) + (h : Tensor.power (FieldCW.tensor F 5) n x y z ≠ 0) + (hy : wordWeight y = 0) : z = wordComplement x := by + funext i + have hi := site_nonzero x y z h i + rw [wordWeight_zero y hy i] at hi + have heq : FieldCW.tensor F 5 (x i) 0 (z i) = + if x i = complement 5 (z i) then 1 else 0 := by + simpa only [complement_involution] using + tensor_middle_zero_matching F 5 (x i) (complement 5 (z i)) + have hxz : x i = complement 5 (z i) := by + by_contra hn + rw [heq, ite_eq_right hn] at hi + exact hi rfl + have hh := congrArg (complement 5) hxz + simpa only [wordComplement, complement_involution] using hh.symm + +theorem zeroZ_word_match {F : Type*} [CommRing F] {n : ℕ} + (x y z : Fin n → Fin 7) + (h : Tensor.power (FieldCW.tensor F 5) n x y z ≠ 0) + (hz : wordWeight z = 0) : y = wordComplement x := by + funext i + have hi := site_nonzero x y z h i + rw [wordWeight_zero z hz i] at hi + have heq : FieldCW.tensor F 5 (x i) (y i) 0 = + if x i = complement 5 (y i) then 1 else 0 := by + simpa only [complement_involution] using + tensor_last_zero_matching F 5 (x i) (complement 5 (y i)) + have hxy : x i = complement 5 (y i) := by + by_contra hn + rw [heq, ite_eq_right hn] at hi + exact hi rfl + have hh := congrArg (complement 5) hxy + simpa only [wordComplement, complement_involution] using hh.symm + +theorem transfer_window {P A : Type*} [Fintype P] [DecidableEq P] + [Fintype A] [DecidableEq A] {n : ℕ} + (statistic : (Fin n → Fin 7) → A) (κ : A ≃ A) + (hstatistic : ∀ w, statistic (wordComplement w) = κ (statistic w)) + (x y : P → (Fin n → Fin 7)) (hmatch : ∀ i, y i = wordComplement (x i)) + (ν : A → ℝ) (η : ℝ) + (hx : typeWindow ν η (fun i => statistic (x i))) : + typeWindow (ν ∘ κ.symm) η (fun i => statistic (y i)) := by + have heq : (fun i => statistic (y i)) = κ ∘ (fun i => statistic (x i)) := by + funext i + rw [hmatch i, hstatistic] + rfl + rw [heq] + exact (typeWindow_equiv ν η (fun i => statistic (x i)) κ).mpr hx + +end MatrixMultiplication.CWCompatibilityTransfer + + + + + + +namespace MatrixMultiplication.CWStrands + +open MatrixMultiplication.Foundation +open scoped BigOperators + +variable {F : Type*} [CommRing F] + +theorem site_weight_support (x y z : Fin 7) + (h : FieldCW.tensor F 5 x y z ≠ 0) : + CWLeafStatistics.weight x + CWLeafStatistics.weight y + CWLeafStatistics.weight z = 2 := by + have hzero (a b : Fin 7) (hh : FieldCW.tensor F 5 0 a b ≠ 0) : + CWLeafStatistics.weight a + CWLeafStatistics.weight b = 2 := by + have he := CWLeafRestrictions.tensor_zero_matching F 5 a + (CWLeafRestrictions.complement 5 b) + simp only [CWLeafRestrictions.complement_involution] at he + by_cases hm : a = CWLeafRestrictions.complement 5 b + · subst a + exact CWLeafStatistics.complement_weight b + · rw [ite_eq_right hm] at he + exact False.elim (hh he) + by_cases hx : x = 0 + · subst x + simpa [CWLeafStatistics.weight] using hzero y z h + by_cases hy : y = 0 + · subst y + have hh : FieldCW.tensor F 5 0 z x ≠ 0 := by + rwa [← FieldCW.tensor_cyclic] + have hw := hzero z x hh + simp only [CWLeafStatistics.weight, Fin.val_zero, ite_eq_left, add_zero] at * + omega + by_cases hz : z = 0 + · subst z + have hh : FieldCW.tensor F 5 0 x y ≠ 0 := by + rwa [FieldCW.tensor_cyclic] + have hw := hzero x y hh + simpa [CWLeafStatistics.weight] using hw + have hx0 : x.val ≠ 0 := by simpa only [Fin.ext_iff, Fin.val_zero] using hx + have hy0 : y.val ≠ 0 := by simpa only [Fin.ext_iff, Fin.val_zero] using hy + have hz0 : z.val ≠ 0 := by simpa only [Fin.ext_iff, Fin.val_zero] using hz + apply False.elim (h _) + simp only [FieldCW.tensor, FieldCW.zeroForm, hx0, hy0, hz0, ite_false, + zero_mul, mul_zero, add_zero, Finset.sum_const_zero] + +def weight {P : Type*} [Fintype P] (w : P → Fin 7) : ℕ := + ∑ i, CWLeafStatistics.weight (w i) + +def strand (P : Type*) [Fintype P] : Tensor F (P → Fin 7) (P → Fin 7) (P → Fin 7) := + fun x y z => ∏ i, FieldCW.tensor F 5 (x i) (y i) (z i) + +theorem strand_support {P : Type*} [Fintype P] + (x y z : P → Fin 7) (h : strand (F := F) P x y z ≠ 0) : + weight x + weight y + weight z = 2 * Fintype.card P := by + have hi (i : P) : FieldCW.tensor F 5 (x i) (y i) (z i) ≠ 0 := by + intro he + exact h (Finset.prod_eq_zero (Finset.mem_univ i) he) + calc + weight x + weight y + weight z = + ∑ i, (CWLeafStatistics.weight (x i) + CWLeafStatistics.weight (y i) + + CWLeafStatistics.weight (z i)) := by simp [weight, Finset.sum_add_distrib] + _ = ∑ _i : P, 2 := Finset.sum_congr rfl (fun i _ => site_weight_support _ _ _ (hi i)) + _ = 2 * Fintype.card P := by simp [Nat.mul_comm] + +def shapeTensor (P : Type*) [Fintype P] (g : Fin 3 → ℕ) : + Tensor F (P → Fin 7) (P → Fin 7) (P → Fin 7) := + fun x y z => if weight x = g 0 ∧ weight y = g 1 ∧ weight z = g 2 + then strand P x y z else 0 + +theorem shapeTensor_support {P : Type*} [Fintype P] + (g : Fin 3 → ℕ) (x y z : P → Fin 7) + (h : shapeTensor (F := F) P g x y z ≠ 0) : + weight x = g 0 ∧ weight y = g 1 ∧ weight z = g 2 := by + classical + by_contra hn + exact h (ite_eq_right hn) + +theorem weight_sum_elim {P Q : Type*} [Fintype P] [Fintype Q] + (x : P → Fin 7) (y : Q → Fin 7) : + weight (Sum.elim x y) = weight x + weight y := by + simp [weight, Fintype.sum_sum_type] + +theorem strand_sum_elim {P Q : Type*} [Fintype P] [Fintype Q] + (x : (P → Fin 7) × (Q → Fin 7)) + (y : (P → Fin 7) × (Q → Fin 7)) + (z : (P → Fin 7) × (Q → Fin 7)) : + strand (F := F) (P ⊕ Q) (Sum.elim x.1 x.2) (Sum.elim y.1 y.2) (Sum.elim z.1 z.2) = + Tensor.product (strand P) (strand Q) x y z := by + simp [strand, Tensor.product, Fintype.prod_sum_type] + +theorem shape_split {P Q : Type*} [Fintype P] [Fintype Q] + (u v : Fin 3 → ℕ) + (x : (P → Fin 7) × (Q → Fin 7)) + (y : (P → Fin 7) × (Q → Fin 7)) + (z : (P → Fin 7) × (Q → Fin 7)) : + (if weight x.1 = u 0 ∧ weight y.1 = u 1 ∧ weight z.1 = u 2 then + shapeTensor (F := F) (P ⊕ Q) (u + v) (Sum.elim x.1 x.2) (Sum.elim y.1 y.2) + (Sum.elim z.1 z.2) else 0) = + Tensor.product (shapeTensor P u) (shapeTensor Q v) x y z := by + classical + simp only [shapeTensor, weight_sum_elim, Pi.add_apply, strand_sum_elim, + Tensor.product] + by_cases hx : weight x.1 = u 0 + · by_cases hy : weight y.1 = u 1 + · by_cases hz : weight z.1 = u 2 + · simp [hx, hy, hz, mul_ite] + · simp [hz] + · simp [hy] + · simp [hx] + +theorem shape_split_sub {P Q : Type*} [Fintype P] [Fintype Q] + (g u : Fin 3 → ℕ) (hu : ∀ s, u s ≤ g s) + (x : (P → Fin 7) × (Q → Fin 7)) + (y : (P → Fin 7) × (Q → Fin 7)) + (z : (P → Fin 7) × (Q → Fin 7)) : + (if weight x.1 = u 0 ∧ weight y.1 = u 1 ∧ weight z.1 = u 2 then + shapeTensor (F := F) (P ⊕ Q) g (Sum.elim x.1 x.2) (Sum.elim y.1 y.2) + (Sum.elim z.1 z.2) else 0) = + Tensor.product (shapeTensor P u) (shapeTensor Q (g - u)) x y z := by + have hg : u + (g - u) = g := by + funext s + exact Nat.add_sub_of_le (hu s) + simpa only [hg] using shape_split u (g - u) x y z + +def splitMatrix {P Q : Type*} [Fintype P] (u : ℕ) : + ((P → Fin 7) × (Q → Fin 7)) → ((P ⊕ Q) → Fin 7) → F := by + classical + exact fun x w => if w = Sum.elim x.1 x.2 ∧ weight x.1 = u then 1 else 0 + +theorem shape_split_restrict {P Q : Type*} [Fintype P] [Fintype Q] + [DecidableEq P] [DecidableEq Q] (u v : Fin 3 → ℕ) : + Tensor.restrict (splitMatrix (F := F) (u 0)) (splitMatrix (u 1)) (splitMatrix (u 2)) + (shapeTensor (P ⊕ Q) (u + v)) = + Tensor.product (shapeTensor P u) (shapeTensor Q v) := by + classical + funext x y z + have hcollapse : Tensor.restrict (splitMatrix (F := F) (u 0)) + (splitMatrix (u 1)) (splitMatrix (u 2)) (shapeTensor (P ⊕ Q) (u + v)) x y z = + if weight x.1 = u 0 ∧ weight y.1 = u 1 ∧ weight z.1 = u 2 then + shapeTensor (P ⊕ Q) (u + v) (Sum.elim x.1 x.2) (Sum.elim y.1 y.2) + (Sum.elim z.1 z.2) else 0 := by + simp [Tensor.restrict, splitMatrix, ite_and, ite_mul, mul_ite] + split_ifs <;> simp_all + rw [hcollapse] + exact shape_split u v x y z + +end MatrixMultiplication.CWStrands + + + + + + +namespace MatrixMultiplication.CWCoarseIndices + +open MatrixMultiplication.Foundation CWStrands +open scoped BigOperators + +theorem label_weight_le_two : ∀ x : Fin 7, CWLeafStatistics.weight x ≤ 2 := by + decide +kernel + +theorem weight_le {P : Type*} [Fintype P] (w : P → Fin 7) : + weight w ≤ 2 * Fintype.card P := by + calc + weight w ≤ ∑ _i : P, 2 := Finset.sum_le_sum fun i _ => label_weight_le_two (w i) + _ = _ := by simp [Nat.mul_comm] + +def coarseIndex {P : Type*} [Fintype P] (hP : Fintype.card P ≤ 8) + (w : P → Fin 7) : Fin 17 := ⟨weight w, by have := weight_le w; omega⟩ + +theorem strand_coarse_support {F P : Type*} [CommRing F] [Fintype P] + (hP : Fintype.card P ≤ 8) (x y z : P → Fin 7) + (h : strand (F := F) P x y z ≠ 0) : + (coarseIndex hP x).val + (coarseIndex hP y).val + (coarseIndex hP z).val = + 2 * Fintype.card P := strand_support x y z h + +theorem split_coarse_support {F P Q : Type*} [CommRing F] [Fintype P] [Fintype Q] + (hP : Fintype.card P ≤ 8) (g : Fin 3 → ℕ) + (x : (P → Fin 7) × (Q → Fin 7)) + (y : (P → Fin 7) × (Q → Fin 7)) + (z : (P → Fin 7) × (Q → Fin 7)) + (h : shapeTensor (F := F) (P ⊕ Q) g (Sum.elim x.1 x.2) + (Sum.elim y.1 y.2) (Sum.elim z.1 z.2) ≠ 0) : + ((coarseIndex hP x.1).val + (coarseIndex hP y.1).val + + (coarseIndex hP z.1).val = 2 * Fintype.card P) ∧ + (coarseIndex hP x.1).val ≤ g 0 ∧ (coarseIndex hP y.1).val ≤ g 1 ∧ + (coarseIndex hP z.1).val ≤ g 2 := by + have hshape := shapeTensor_support g _ _ _ h + have ht : strand (F := F) (P ⊕ Q) (Sum.elim x.1 x.2) + (Sum.elim y.1 y.2) (Sum.elim z.1 z.2) ≠ 0 := by + simpa only [shapeTensor, ite_eq_left hshape] using h + rw [strand_sum_elim, Tensor.product] at ht + have hl : strand (F := F) P x.1 y.1 z.1 ≠ 0 := by + intro he + exact ht (by rw [he, zero_mul]) + refine ⟨strand_coarse_support hP x.1 y.1 z.1 hl, ?_, ?_, ?_⟩ + · have hs := hshape.1 + rw [weight_sum_elim] at hs + exact hs ▸ Nat.le_add_right (weight x.1) (weight x.2) + · have hs := hshape.2.1 + rw [weight_sum_elim] at hs + exact hs ▸ Nat.le_add_right (weight y.1) (weight y.2) + · have hs := hshape.2.2 + rw [weight_sum_elim] at hs + exact hs ▸ Nat.le_add_right (weight z.1) (weight z.2) + +end MatrixMultiplication.CWCoarseIndices + + + + + + +namespace MatrixMultiplication.JointCanonicalCW + +open MatrixMultiplication.Foundation JointPopulation JointCanonicalization +open CWStrands HistorySymmetry InheritedMasks +open scoped BigOperators + +attribute [local instance] Classical.propDecidable + +variable {H F : Type*} [Fintype H] [DecidableEq H] [CommRing F] + (counts : H → Shape → ℕ) (leftLength rightLength : H → ℕ) + (parentShape : H → Fin 3 → ℕ) + (hleft : ∀ h, leftLength h ≤ 8) + +abbrev Left (h : H) := Fin (leftLength h) → Fin 7 +abbrev Right (h : H) := Fin (rightLength h) → Fin 7 + +def shapeNat (u : Shape) : Fin 3 → ℕ := fun s => (shapeSide s u).val + +def parentTensor (h : H) : Tensor F + (Left leftLength h × Right rightLength h) + (Left leftLength h × Right rightLength h) + (Left leftLength h × Right rightLength h) := + fun x y z => shapeTensor (Fin (leftLength h) ⊕ Fin (rightLength h)) (parentShape h) + (Sum.elim x.1 x.2) (Sum.elim y.1 y.2) (Sum.elim z.1 z.2) + +def coarse (_s : Fin 3) (h : H) (w : Left leftLength h × Right rightLength h) : Fin 17 := + CWCoarseIndices.coarseIndex (by simpa using hleft h) w.1 + +def leftTensor (c : ClassKey (H := H)) : + Tensor F (Left leftLength c.1) (Left leftLength c.1) (Left leftLength c.1) := + shapeTensor (Fin (leftLength c.1)) (shapeNat c.2) + +def rightTensor (c : ClassKey (H := H)) : + Tensor F (Right rightLength c.1) (Right rightLength c.1) (Right rightLength c.1) := + shapeTensor (Fin (rightLength c.1)) (parentShape c.1 - shapeNat c.2) + +omit [Fintype H] [DecidableEq H] in +theorem block_eq_product (h : H) (u : Shape) + (hu : ∀ s, shapeNat u s ≤ parentShape h s) : + block (Left leftLength) (Right rightLength) + (parentTensor leftLength rightLength parentShape) + (coarse leftLength rightLength hleft) (h, u) = + Tensor.product (leftTensor (F := F) leftLength (h, u)) + (rightTensor rightLength parentShape (h, u)) := by + have hadd : shapeNat u + (parentShape h - shapeNat u) = parentShape h := by + funext s + exact Nat.add_sub_of_le (hu s) + funext x y z + have hs := shape_split (F := F) (P := Fin (leftLength h)) + (Q := Fin (rightLength h)) (shapeNat u) (parentShape h - shapeNat u) x y z + rw [hadd] at hs + simpa [block, parentTensor, coarse, CWCoarseIndices.coarseIndex, + Fin.ext_iff, leftTensor, rightTensor, shapeNat, shapeSide, + Fin.isValue, ↓reduceIte] using hs + +omit [DecidableEq H] in +theorem canonicalBase_eq_children + (hsupport : ∀ h u, 0 < counts h u → ∀ s, shapeNat u s ≤ parentShape h s) : + canonicalBase counts (Left leftLength) (Right rightLength) + (parentTensor leftLength rightLength parentShape) + (coarse leftLength rightLength hleft) = + pairClassProduct (leftTensor (F := F) leftLength) + (rightTensor rightLength parentShape) := by + funext x y z + unfold canonicalBase + have hf : (∏ c : ClassKey (H := H), ∏ j : ClassPositions counts c, + block (Left leftLength) (Right rightLength) + (parentTensor leftLength rightLength parentShape) + (coarse leftLength rightLength hleft) c + (x.left c j, x.right c j) (y.left c j, y.right c j) (z.left c j, z.right c j)) = + ∏ c : ClassKey (H := H), ∏ j : ClassPositions counts c, + (leftTensor (F := F) leftLength c (x.left c j) (y.left c j) (z.left c j) * + rightTensor rightLength parentShape c (x.right c j) (y.right c j) (z.right c j)) := by + apply Finset.prod_congr rfl + intro c _ + apply Finset.prod_congr rfl + intro j _ + have hc : 0 < counts c.1 c.2 := lt_of_le_of_lt (Nat.zero_le j.val) j.isLt + rw [block_eq_product leftLength rightLength parentShape hleft c.1 c.2 + (hsupport c.1 c.2 hc)] + rfl + rw [hf] + simp only [pairClassProduct, classProduct, Finset.prod_mul_distrib] + +abbrev RawStrands := ∀ h, Positions counts h → + ((Fin (leftLength h) ⊕ Fin (rightLength h)) → Fin 7) + +def rawParentSource : Tensor F (RawStrands counts leftLength rightLength) + (RawStrands counts leftLength rightLength) (RawStrands counts leftLength rightLength) := + classProduct (fun h => shapeTensor (Fin (leftLength h) ⊕ Fin (rightLength h)) (parentShape h)) + +def joinWords (w : RawPairs counts (Left leftLength) (Right rightLength)) : + RawStrands counts leftLength rightLength := + fun h i => Sum.elim (w h i).1 (w h i).2 + +def joinMatrix : RawPairs counts (Left leftLength) (Right rightLength) → + RawStrands counts leftLength rightLength → F := + fun w v => if v = joinWords counts leftLength rightLength w then 1 else 0 + +theorem parentTensor_restrict : + Tensor.restrict (joinMatrix (F := F) counts leftLength rightLength) + (joinMatrix counts leftLength rightLength) (joinMatrix counts leftLength rightLength) + (rawParentSource counts leftLength rightLength parentShape) = + sourceTensor counts (Left leftLength) (Right rightLength) + (parentTensor leftLength rightLength parentShape) := by + classical + funext x y z + simp [Tensor.restrict, joinMatrix, rawParentSource, sourceTensor, + classProduct, joinWords, parentTensor, ite_mul, mul_ite] + +end MatrixMultiplication.JointCanonicalCW + + + + + + +namespace MatrixMultiplication.CWShapeLeaves + +open MatrixMultiplication.Foundation CWStrands CWLeafRestrictions +open scoped BigOperators + +theorem complement_word_weight {P : Type*} [Fintype P] (w : P → Fin 7) : + weight (fun i => complement 5 (w i)) + weight w = 2 * Fintype.card P := by + calc + weight (fun i => complement 5 (w i)) + weight w = + ∑ i, (CWLeafStatistics.weight (complement 5 (w i)) + CWLeafStatistics.weight (w i)) := by + simp [weight, Finset.sum_add_distrib] + _ = ∑ _i : P, 2 := Finset.sum_congr rfl (fun i _ => CWLeafStatistics.complement_weight (w i)) + _ = 2 * Fintype.card P := by simp [Nat.mul_comm] + +theorem zeroX_shape_leaf (F : Type*) [CommRing F] (n a b : ℕ) + (hab : a + b = 2 * n) + (p : (Fin n → Fin 7) → Prop) [DecidablePred p] + (hp : ∀ w, p w → weight w = a) : + Tensor.pullback (fun _ : Unit × Unit => fun _ : Fin n => (0 : Fin 7)) + (fun y : Unit × {w // p w} => y.2.val) + (fun z : {w // p w} × Unit => fun i => complement 5 (z.1.val i)) + (shapeTensor (F := F) (Fin n) (Matrix.vecCons (0) (Matrix.vecCons (a) (Matrix.vecCons (b) Matrix.vecEmpty)))) = + Tensor.matrixCoefficients Unit Unit {w // p w} := by + funext x y z + have hy : weight y.2.val = a := hp _ y.2.property + have hz : weight (fun i => complement 5 (z.1.val i)) = b := by + have hw := complement_word_weight z.1.val + have hzw : weight z.1.val = a := hp _ z.1.property + simp only [Fintype.card_fin] at hw + omega + have hzero : weight (fun _ : Fin n => (0 : Fin 7)) = 0 := by + simp [weight, CWLeafStatistics.weight] + have hleaf := congrFun (congrFun (congrFun (zeroX_leaf F 5 n p) x) y) z + simpa [Tensor.pullback, shapeTensor, hzero, hy, hz, strand, Tensor.power] using hleaf + +theorem zeroY_shape_leaf (F : Type*) [CommRing F] (n a b : ℕ) + (hab : a + b = 2 * n) + (p : (Fin n → Fin 7) → Prop) [DecidablePred p] + (hp : ∀ w, p w → weight w = a) : + Tensor.pullback (fun x : {w // p w} × Unit => x.1.val) + (fun _ : Unit × Unit => fun _ : Fin n => (0 : Fin 7)) + (fun z : Unit × {w // p w} => fun i => complement 5 (z.2.val i)) + (shapeTensor (F := F) (Fin n) (Matrix.vecCons (a) (Matrix.vecCons (0) (Matrix.vecCons (b) Matrix.vecEmpty)))) = + Tensor.matrixCoefficients {w // p w} Unit Unit := by + funext x y z + have hx : weight x.1.val = a := hp _ x.1.property + have hz : weight (fun i => complement 5 (z.2.val i)) = b := by + have hw := complement_word_weight z.2.val + have hzw : weight z.2.val = a := hp _ z.2.property + simp only [Fintype.card_fin] at hw + omega + have hzero : weight (fun _ : Fin n => (0 : Fin 7)) = 0 := by + simp [weight, CWLeafStatistics.weight] + have hleaf := congrFun (congrFun (congrFun (zeroY_leaf F 5 n p) x) y) z + simpa [Tensor.pullback, shapeTensor, hzero, hx, hz, strand, Tensor.power] using hleaf + +theorem zeroZ_shape_leaf (F : Type*) [CommRing F] (n a b : ℕ) + (hab : a + b = 2 * n) + (p : (Fin n → Fin 7) → Prop) [DecidablePred p] + (hp : ∀ w, p w → weight w = a) : + Tensor.pullback (fun x : Unit × {w // p w} => x.2.val) + (fun y : {w // p w} × Unit => fun i => complement 5 (y.1.val i)) + (fun _ : Unit × Unit => fun _ : Fin n => (0 : Fin 7)) + (shapeTensor (F := F) (Fin n) (Matrix.vecCons (a) (Matrix.vecCons (b) (Matrix.vecCons (0) Matrix.vecEmpty)))) = + Tensor.matrixCoefficients Unit {w // p w} Unit := by + funext x y z + have hx : weight x.2.val = a := hp _ x.2.property + have hy : weight (fun i => complement 5 (y.1.val i)) = b := by + have hw := complement_word_weight y.1.val + have hyw : weight y.1.val = a := hp _ y.1.property + simp only [Fintype.card_fin] at hw + omega + have hzero : weight (fun _ : Fin n => (0 : Fin 7)) = 0 := by + simp [weight, CWLeafStatistics.weight] + have hleaf := congrFun (congrFun (congrFun (zeroZ_leaf F 5 n p) x) y) z + simpa [Tensor.pullback, shapeTensor, hzero, hx, hy, strand, Tensor.power] using hleaf + +end MatrixMultiplication.CWShapeLeaves + + + + + + +namespace MatrixMultiplication.CWWindowedLeaves + +open MatrixMultiplication.Foundation CWStrands CWShapeLeaves CWLeafRestrictions InheritedMasks +open scoped BigOperators + +attribute [local instance] Classical.propDecidable + +abbrev Raw (n : ℕ) := Fin n → Fin 7 +abbrev Alphabet (n a : ℕ) := {w : Raw n // weight w = a} + +def complementWord {n : ℕ} (w : Raw n) : Raw n := fun i => complement 5 (w i) +def zeroWord (n : ℕ) : Raw n := fun _ => 0 + +variable (F : Type*) [CommRing F] + +theorem zeroX_local (n a b : ℕ) (hab : a + b = 2 * n) + (u v : Alphabet n a) : + shapeTensor (F := F) (Fin n) (Matrix.vecCons (0) (Matrix.vecCons (a) (Matrix.vecCons (b) Matrix.vecEmpty))) (zeroWord n) u.val (complementWord v.val) = + if u = v then 1 else 0 := by + unfold zeroWord complementWord + have h := zeroX_shape_leaf F n a b hab (fun w => weight w = a) (fun _ h => h) + have hh := congrFun (congrFun (congrFun h ((), ())) ((), u)) (v, ()) + simpa only [Tensor.pullback, Tensor.matrixCoefficients, + true_and, and_true] using hh + +theorem zeroY_local (n a b : ℕ) (hab : a + b = 2 * n) + (u v : Alphabet n a) : + shapeTensor (F := F) (Fin n) (Matrix.vecCons (a) (Matrix.vecCons (0) (Matrix.vecCons (b) Matrix.vecEmpty))) u.val (zeroWord n) (complementWord v.val) = + if u = v then 1 else 0 := by + unfold zeroWord complementWord + have h := zeroY_shape_leaf F n a b hab (fun w => weight w = a) (fun _ h => h) + have hh := congrFun (congrFun (congrFun h (u, ())) ((), ())) ((), v) + have huv : (v = u) ↔ (u = v) := eq_comm + simpa only [Tensor.pullback, Tensor.matrixCoefficients, + true_and, and_true, huv] using hh + +theorem zeroZ_local (n a b : ℕ) (hab : a + b = 2 * n) + (u v : Alphabet n a) : + shapeTensor (F := F) (Fin n) (Matrix.vecCons (a) (Matrix.vecCons (b) (Matrix.vecCons (0) Matrix.vecEmpty))) u.val (complementWord v.val) (zeroWord n) = + if u = v then 1 else 0 := by + unfold zeroWord complementWord + have h := zeroZ_shape_leaf F n a b hab (fun w => weight w = a) (fun _ h => h) + have hh := congrFun (congrFun (congrFun h ((), u)) (v, ())) ((), ()) + simpa only [Tensor.pullback, Tensor.matrixCoefficients, + true_and, and_true] using hh + +section Classes + +variable (n a b m : ℕ) (hab : a + b = 2 * n) + (p : (Fin m → Alphabet n a) → Prop) [DecidablePred p] + +def rawSelected (w : {w : Fin m → Alphabet n a // p w}) : Fin m → Raw n := + fun i => (w.val i).val + +def complementarySelected (w : {w : Fin m → Alphabet n a // p w}) : Fin m → Raw n := + fun i => complementWord (w.val i).val + +include hab + +omit [DecidablePred p] in +theorem zeroX_class : + Tensor.pullback (fun _ : Unit × Unit => fun _ : Fin m => zeroWord n) + (fun y : Unit × {w // p w} => rawSelected n a m p y.2) + (fun z : {w // p w} × Unit => complementarySelected n a m p z.1) + (Tensor.power (shapeTensor (F := F) (Fin n) (Matrix.vecCons (0) (Matrix.vecCons (a) (Matrix.vecCons (b) Matrix.vecEmpty)))) m) = + Tensor.matrixCoefficients Unit Unit {w // p w} := by + funext x y z + simp only [Tensor.pullback, Tensor.power, rawSelected, complementarySelected, + zeroX_local F n a b hab, Fintype.prod_boole, ← funext_iff, Tensor.matrixCoefficients] + simp [Subtype.ext_iff] + +omit [DecidablePred p] in +theorem zeroY_class : + Tensor.pullback (fun x : {w // p w} × Unit => rawSelected n a m p x.1) + (fun _ : Unit × Unit => fun _ : Fin m => zeroWord n) + (fun z : Unit × {w // p w} => complementarySelected n a m p z.2) + (Tensor.power (shapeTensor (F := F) (Fin n) (Matrix.vecCons (a) (Matrix.vecCons (0) (Matrix.vecCons (b) Matrix.vecEmpty)))) m) = + Tensor.matrixCoefficients {w // p w} Unit Unit := by + funext x y z + simp only [Tensor.pullback, Tensor.power, rawSelected, complementarySelected, + zeroY_local F n a b hab, Fintype.prod_boole, ← funext_iff, Tensor.matrixCoefficients] + simp [Subtype.ext_iff, eq_comm] + +omit [DecidablePred p] in +theorem zeroZ_class : + Tensor.pullback (fun x : Unit × {w // p w} => rawSelected n a m p x.2) + (fun y : {w // p w} × Unit => complementarySelected n a m p y.1) + (fun _ : Unit × Unit => fun _ : Fin m => zeroWord n) + (Tensor.power (shapeTensor (F := F) (Fin n) (Matrix.vecCons (a) (Matrix.vecCons (b) (Matrix.vecCons (0) Matrix.vecEmpty)))) m) = + Tensor.matrixCoefficients Unit {w // p w} Unit := by + funext x y z + simp only [Tensor.pullback, Tensor.power, rawSelected, complementarySelected, + zeroZ_local F n a b hab, Fintype.prod_boole, ← funext_iff, Tensor.matrixCoefficients] + simp [Subtype.ext_iff] + +omit [DecidablePred p] in +theorem zeroX_masked + (keepX keepY keepZ : (Fin m → Raw n) → Prop) + (hx : keepX (fun _ => zeroWord n)) + (hy : ∀ w, keepY (rawSelected n a m p w)) + (hz : ∀ w, keepZ (complementarySelected n a m p w)) : + Tensor.pullback (fun _ : Unit × Unit => fun _ : Fin m => zeroWord n) + (fun y : Unit × {w // p w} => rawSelected n a m p y.2) + (fun z : {w // p w} × Unit => complementarySelected n a m p z.1) + (ExactRecovery.delete (Tensor.power (shapeTensor (F := F) (Fin n) (Matrix.vecCons (0) (Matrix.vecCons (a) (Matrix.vecCons (b) Matrix.vecEmpty)))) m) + keepX keepY keepZ) = Tensor.matrixCoefficients Unit Unit {w // p w} := by + have h := zeroX_class F n a b m hab p + funext x y z + simpa only [Tensor.pullback, ExactRecovery.delete, hx, hy, hz, and_self, ite_true] using + congrFun (congrFun (congrFun h x) y) z + +omit [DecidablePred p] in +theorem zeroY_masked + (keepX keepY keepZ : (Fin m → Raw n) → Prop) + (hx : ∀ w, keepX (rawSelected n a m p w)) + (hy : keepY (fun _ => zeroWord n)) + (hz : ∀ w, keepZ (complementarySelected n a m p w)) : + Tensor.pullback (fun x : {w // p w} × Unit => rawSelected n a m p x.1) + (fun _ : Unit × Unit => fun _ : Fin m => zeroWord n) + (fun z : Unit × {w // p w} => complementarySelected n a m p z.2) + (ExactRecovery.delete (Tensor.power (shapeTensor (F := F) (Fin n) (Matrix.vecCons (a) (Matrix.vecCons (0) (Matrix.vecCons (b) Matrix.vecEmpty)))) m) + keepX keepY keepZ) = Tensor.matrixCoefficients {w // p w} Unit Unit := by + have h := zeroY_class F n a b m hab p + funext x y z + simpa only [Tensor.pullback, ExactRecovery.delete, hx, hy, hz, and_self, ite_true] using + congrFun (congrFun (congrFun h x) y) z + +omit [DecidablePred p] in +theorem zeroZ_masked + (keepX keepY keepZ : (Fin m → Raw n) → Prop) + (hx : ∀ w, keepX (rawSelected n a m p w)) + (hy : ∀ w, keepY (complementarySelected n a m p w)) + (hz : keepZ (fun _ => zeroWord n)) : + Tensor.pullback (fun x : Unit × {w // p w} => rawSelected n a m p x.2) + (fun y : {w // p w} × Unit => complementarySelected n a m p y.1) + (fun _ : Unit × Unit => fun _ : Fin m => zeroWord n) + (ExactRecovery.delete (Tensor.power (shapeTensor (F := F) (Fin n) (Matrix.vecCons (a) (Matrix.vecCons (b) (Matrix.vecCons (0) Matrix.vecEmpty)))) m) + keepX keepY keepZ) = Tensor.matrixCoefficients Unit {w // p w} Unit := by + have h := zeroZ_class F n a b m hab p + funext x y z + simpa only [Tensor.pullback, ExactRecovery.delete, hx, hy, hz, and_self, ite_true] using + congrFun (congrFun (congrFun h x) y) z + +omit [DecidablePred p] in +theorem zeroX_restriction + (keepX keepY keepZ : (Fin m → Raw n) → Prop) + (hx : keepX (fun _ => zeroWord n)) + (hy : ∀ w, keepY (rawSelected n a m p w)) + (hz : ∀ w, keepZ (complementarySelected n a m p w)) : + ∃ (A : (Unit × Unit) → (Fin m → Raw n) → F) + (B : (Unit × {w // p w}) → (Fin m → Raw n) → F) + (C : ({w // p w} × Unit) → (Fin m → Raw n) → F), + Tensor.restrict A B C + (ExactRecovery.delete (Tensor.power (shapeTensor (F := F) (Fin n) (Matrix.vecCons (0) (Matrix.vecCons (a) (Matrix.vecCons (b) Matrix.vecEmpty)))) m) + keepX keepY keepZ) = Tensor.matrixCoefficients Unit Unit {w // p w} := by + refine ⟨(fun _ v => if v = (fun _ => zeroWord n) then 1 else 0), + (fun y v => if v = rawSelected n a m p y.2 then 1 else 0), + (fun z v => if v = complementarySelected n a m p z.1 then 1 else 0), ?_⟩ + rw [← Tensor.pullback_eq_restrict] + exact zeroX_masked F n a b m hab p keepX keepY keepZ hx hy hz + +omit [DecidablePred p] in +theorem zeroY_restriction + (keepX keepY keepZ : (Fin m → Raw n) → Prop) + (hx : ∀ w, keepX (rawSelected n a m p w)) + (hy : keepY (fun _ => zeroWord n)) + (hz : ∀ w, keepZ (complementarySelected n a m p w)) : + ∃ (A : ({w // p w} × Unit) → (Fin m → Raw n) → F) + (B : (Unit × Unit) → (Fin m → Raw n) → F) + (C : (Unit × {w // p w}) → (Fin m → Raw n) → F), + Tensor.restrict A B C + (ExactRecovery.delete (Tensor.power (shapeTensor (F := F) (Fin n) (Matrix.vecCons (a) (Matrix.vecCons (0) (Matrix.vecCons (b) Matrix.vecEmpty)))) m) + keepX keepY keepZ) = Tensor.matrixCoefficients {w // p w} Unit Unit := by + refine ⟨(fun x v => if v = rawSelected n a m p x.1 then 1 else 0), + (fun _ v => if v = (fun _ => zeroWord n) then 1 else 0), + (fun z v => if v = complementarySelected n a m p z.2 then 1 else 0), ?_⟩ + rw [← Tensor.pullback_eq_restrict] + exact zeroY_masked F n a b m hab p keepX keepY keepZ hx hy hz + +omit [DecidablePred p] in +theorem zeroZ_restriction + (keepX keepY keepZ : (Fin m → Raw n) → Prop) + (hx : ∀ w, keepX (rawSelected n a m p w)) + (hy : ∀ w, keepY (complementarySelected n a m p w)) + (hz : keepZ (fun _ => zeroWord n)) : + ∃ (A : (Unit × {w // p w}) → (Fin m → Raw n) → F) + (B : ({w // p w} × Unit) → (Fin m → Raw n) → F) + (C : (Unit × Unit) → (Fin m → Raw n) → F), + Tensor.restrict A B C + (ExactRecovery.delete (Tensor.power (shapeTensor (F := F) (Fin n) (Matrix.vecCons (a) (Matrix.vecCons (b) (Matrix.vecCons (0) Matrix.vecEmpty)))) m) + keepX keepY keepZ) = Tensor.matrixCoefficients Unit {w // p w} Unit := by + refine ⟨(fun x v => if v = rawSelected n a m p x.2 then 1 else 0), + (fun y v => if v = complementarySelected n a m p y.1 then 1 else 0), + (fun _ v => if v = (fun _ => zeroWord n) then 1 else 0), ?_⟩ + rw [← Tensor.pullback_eq_restrict] + exact zeroZ_masked F n a b m hab p keepX keepY keepZ hx hy hz + +end Classes + +section ExactWindows + +variable {A : Type*} [Fintype A] [DecidableEq A] + +theorem exact_selected_window (n a : ℕ) (statistic : Raw n → A) + (counts : A → ℕ) (ν : A → ℝ) (η : ℝ) + (happrox : ∀ s, |(counts s : ℝ) / (∑ s, counts s : ℕ) - ν s| ≤ η) + (w : ExactStatisticWords.Words (fun u : Alphabet n a => statistic u.val) counts) : + typeWindow ν η (fun i => statistic (w.val i).val) := + ExactStatisticWords.typeWindow_of_counts _ counts w ν η happrox + +theorem exact_complementary_window (n a : ℕ) (statistic : Raw n → A) + (κ : A ≃ A) + (hstatistic : ∀ u : Alphabet n a, statistic (complementWord u.val) = κ (statistic u.val)) + (counts : A → ℕ) (ν : A → ℝ) (η : ℝ) + (happrox : ∀ s, |(counts s : ℝ) / (∑ s, counts s : ℕ) - ν s| ≤ η) + (w : ExactStatisticWords.Words (fun u : Alphabet n a => statistic u.val) counts) : + typeWindow (ν ∘ κ.symm) η (fun i => statistic (complementWord (w.val i).val)) := by + have heq : (fun i => statistic (complementWord (w.val i).val)) = + κ ∘ (fun i => statistic (w.val i).val) := by + funext i + exact hstatistic (w.val i) + rw [heq] + exact (typeWindow_equiv ν η _ κ).mpr + (exact_selected_window n a statistic counts ν η happrox w) + +omit [Fintype A] in +theorem zero_window (n m : ℕ) (hm : 0 < m) (statistic : Raw n → A) + (ν : A → ℝ) (η : ℝ) (hη : 0 ≤ η) + (hν : ∀ s, ν s = if statistic (zeroWord n) = s then 1 else 0) : + typeWindow ν η (fun _ : Fin m => statistic (zeroWord n)) := by + intro s + have hm' : (m : ℝ) ≠ 0 := by exact_mod_cast (Nat.ne_of_gt hm) + by_cases hs : statistic (zeroWord n) = s <;> + simpa [empiricalLaw, wordPopulation, hν s, hs, hm'] using hη + +end ExactWindows + +end MatrixMultiplication.CWWindowedLeaves + + + + + + +namespace MatrixMultiplication.CWCompleteStatistics + +open CWWindowedLeaves CWLeafStatistics CWStrands AllFieldParameters +open scoped BigOperators + +attribute [local instance] Classical.propDecidable + +def pairEquiv : Raw 2 ≃ (Fin 7 × Fin 7) where + toFun w := (w 0, w 1) + invFun u := (Matrix.vecCons (u.1) (Matrix.vecCons (u.2) Matrix.vecEmpty)) + left_inv w := by funext i; fin_cases i <;> rfl + right_inv u := by cases u; rfl + +def orderedEquiv : Raw 4 ≃ ((Fin 7 × Fin 7) × (Fin 7 × Fin 7)) where + toFun w := ((w 0, w 1), (w 2, w 3)) + invFun u := (Matrix.vecCons (u.1.1) (Matrix.vecCons (u.1.2) (Matrix.vecCons (u.2.1) (Matrix.vecCons (u.2.2) Matrix.vecEmpty)))) + left_inv w := by funext i; fin_cases i <;> rfl + right_inv u := by cases u with | mk u v => cases u; cases v; rfl + +def twoStatistic (w : Raw 2) : Fin 6 := pairStatistic (pairEquiv w) +def fourStatistic (w : Raw 4) : Fin 6 × Fin 6 := + (pairStatistic (orderedEquiv w).1, pairStatistic (orderedEquiv w).2) + +def complementStatistic : Fin 6 ≃ Fin 6 := + { toFun := kappa + invFun := kappa + left_inv := kappa_involution + right_inv := kappa_involution } + +def orderedComplementStatistic : (Fin 6 × Fin 6) ≃ (Fin 6 × Fin 6) := + Equiv.prodCongr complementStatistic complementStatistic + +theorem two_weight (w : Raw 2) : + CWStrands.weight w = statisticWeight (twoStatistic w) := by + rw [twoStatistic, statistic_weight] + simp [CWStrands.weight, pairEquiv, Fin.sum_univ_succ] + +theorem four_weight (w : Raw 4) : + CWStrands.weight w = statisticWeight (fourStatistic w).1 + + statisticWeight (fourStatistic w).2 := by + simp only [fourStatistic, statistic_weight] + simp [CWStrands.weight, orderedEquiv, Fin.sum_univ_succ, Nat.add_assoc] + +theorem two_multiplicity (s : Fin 6) : + Fintype.card {w : Raw 2 // twoStatistic w = s} = AllFieldParameters.multiplicity s := by + let e : {w : Raw 2 // twoStatistic w = s} ≃ + {u : Fin 7 × Fin 7 // pairStatistic u = s} := + { toFun := fun w => ⟨pairEquiv w.val, w.property⟩ + invFun := fun u => ⟨pairEquiv.symm u.val, by simpa [twoStatistic] using u.property⟩ + left_inv := by intro w; apply Subtype.ext; simp + right_inv := by intro u; apply Subtype.ext; simp } + rw [Fintype.card_congr e, pair_multiplicity] + +theorem four_multiplicity (s : Fin 6 × Fin 6) : + Fintype.card {w : Raw 4 // fourStatistic w = s} = + AllFieldParameters.multiplicity s.1 * AllFieldParameters.multiplicity s.2 := by + let e : {w : Raw 4 // fourStatistic w = s} ≃ + {u : (Fin 7 × Fin 7) × (Fin 7 × Fin 7) // + pairStatistic u.1 = s.1 ∧ pairStatistic u.2 = s.2} := + { toFun := fun w => ⟨orderedEquiv w.val, + congrArg Prod.fst w.property, congrArg Prod.snd w.property⟩ + invFun := fun u => ⟨orderedEquiv.symm u.val, by + apply Prod.ext + · simpa [fourStatistic] using u.property.1 + · simpa [fourStatistic] using u.property.2⟩ + left_inv := by intro w; apply Subtype.ext; simp + right_inv := by intro u; apply Subtype.ext; simp } + rw [Fintype.card_congr e, ordered_pair_multiplicity] + +theorem two_complement (w : Raw 2) : + twoStatistic (complementWord w) = complementStatistic (twoStatistic w) := by + exact complement_statistic (pairEquiv w) + +theorem four_complement (w : Raw 4) : + fourStatistic (complementWord w) = orderedComplementStatistic (fourStatistic w) := by + apply Prod.ext + · exact complement_statistic (orderedEquiv w).1 + · exact complement_statistic (orderedEquiv w).2 + +theorem two_fixedWeight_multiplicity (a : ℕ) (s : Fin 6) (hs : statisticWeight s = a) : + Fintype.card {w : Alphabet 2 a // twoStatistic w.val = s} = + AllFieldParameters.multiplicity s := by + rw [ExactStatisticWords.card_fixedWeight_fiber twoStatistic CWStrands.weight + statisticWeight two_weight a s hs, two_multiplicity] + +theorem four_fixedWeight_multiplicity (a : ℕ) (s : Fin 6 × Fin 6) + (hs : statisticWeight s.1 + statisticWeight s.2 = a) : + Fintype.card {w : Alphabet 4 a // fourStatistic w.val = s} = + AllFieldParameters.multiplicity s.1 * AllFieldParameters.multiplicity s.2 := by + rw [ExactStatisticWords.card_fixedWeight_fiber fourStatistic CWStrands.weight + (fun s => statisticWeight s.1 + statisticWeight s.2) four_weight a s hs, + four_multiplicity] + +end MatrixMultiplication.CWCompleteStatistics + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/Tensors/CWStageCPlacements.lean b/lean/OAI/LinearAlgebra/MatrixFields/Tensors/CWStageCPlacements.lean new file mode 100644 index 0000000000000000000000000000000000000000..0d18ed54f08f9dc3ea1bd82b1babb8dfdb51bd78 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/Tensors/CWStageCPlacements.lean @@ -0,0 +1,826 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Arithmetic.CommonDimensions +import OAI.LinearAlgebra.MatrixFields.Histories.HistoryChildLaws + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +open scoped BigOperators +open MatrixMultiplication.Foundation +open MatrixMultiplication.CommonDimensions + +namespace MatrixMultiplication.TerminalProducts + +variable {K H : Type*} [CommSemiring K] [Fintype H] [DecidableEq H] + +theorem restrict_familyProduct {X Y Z X' Y' Z' : H → Type*} + [∀ h, Fintype (X h)] [∀ h, Fintype (Y h)] [∀ h, Fintype (Z h)] + (T : ∀ h, Tensor K (X h) (Y h) (Z h)) + (a : ∀ h, X' h → X h → K) (b : ∀ h, Y' h → Y h → K) + (c : ∀ h, Z' h → Z h → K) : + Tensor.restrict (fun x s => ∏ h, a h (x h) (s h)) + (fun y s => ∏ h, b h (y h) (s h)) (fun z s => ∏ h, c h (z h) (s h)) + (familyProduct T) = familyProduct (fun h => Tensor.restrict (a h) (b h) (c h) (T h)) := by + funext x y z + simp only [Tensor.restrict, familyProduct, Fintype.prod_sum, ← Finset.prod_mul_distrib] + +theorem matrix_restriction_of_history_restrictions {X Y Z : H → Type*} + [∀ h, Fintype (X h)] [∀ h, Fintype (Y h)] [∀ h, Fintype (Z h)] + (T : ∀ h, Tensor K (X h) (Y h) (Z h)) (A B C : H → Type*) + [∀ h, Fintype (A h)] [∀ h, Fintype (B h)] [∀ h, Fintype (C h)] + [∀ h, DecidableEq (A h)] [∀ h, DecidableEq (B h)] [∀ h, DecidableEq (C h)] + (a : ∀ h, (A h × B h) → X h → K) (b : ∀ h, (B h × C h) → Y h → K) + (c : ∀ h, (C h × A h) → Z h → K) + (hloc : ∀ h, Tensor.restrict (a h) (b h) (c h) (T h) = + Tensor.matrixCoefficients (A h) (B h) (C h)) : + ∃ (aa : ((∀ h, A h) × (∀ h, B h)) → (∀ h, X h) → K) + (bb : ((∀ h, B h) × (∀ h, C h)) → (∀ h, Y h) → K) + (cc : ((∀ h, C h) × (∀ h, A h)) → (∀ h, Z h) → K), + Tensor.restrict aa bb cc (familyProduct T) = + Tensor.matrixCoefficients (∀ h, A h) (∀ h, B h) (∀ h, C h) := by + classical + have hp := restrict_familyProduct T a b c + simp_rw [hloc] at hp + obtain ⟨aa, bb, cc, hmatrix⟩ := matrix_familyProduct_restrict (K := K) A B C + refine ⟨Tensor.composeRestrictionMatrix aa (fun x s => ∏ h, a h (x h) (s h)), + Tensor.composeRestrictionMatrix bb (fun y s => ∏ h, b h (y h) (s h)), + Tensor.composeRestrictionMatrix cc (fun z s => ∏ h, c h (z h) (s h)), ?_⟩ + rw [← Tensor.restrict_restrict, hp, hmatrix] + +end MatrixMultiplication.TerminalProducts + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +noncomputable section + +namespace MatrixMultiplication.CWStageC + +open MatrixMultiplication.Foundation CWStrands CWLeafRestrictions + +def interior (i : Fin 5) : Fin 7 := ⟨i.val + 1, by have := i.isLt; omega⟩ + +theorem interior_injective : Function.Injective interior := by + intro i j h + apply Fin.ext + have hval := congrArg Fin.val h + simpa only [interior, Nat.add_right_cancel_iff] using hval + +@[simp] theorem interior_weight (i : Fin 5) : CWLeafStatistics.weight (interior i) = 1 := by + have hi : i.val + 1 ≠ 6 := by have := i.isLt; omega + simp [CWLeafStatistics.weight, interior, hi] + +@[simp] theorem zero_weight : CWLeafStatistics.weight (0 : Fin 7) = 0 := rfl + +@[simp] theorem last_weight : CWLeafStatistics.weight (6 : Fin 7) = 2 := rfl + +@[simp] theorem interior_complement (i : Fin 5) : complement 5 (interior i) = interior i := by + apply complement_interior + · simp [interior] + · dsimp [interior] + have := i.isLt + omega + +variable (F : Type*) [CommRing F] + +theorem coefficient110 (i j : Fin 5) : + FieldCW.tensor F 5 (interior i) (interior j) 0 = if i = j then 1 else 0 := by + simpa only [interior_complement, interior_injective.eq_iff] using + tensor_last_zero_matching F 5 (interior i) (interior j) + +theorem coefficient101 (i j : Fin 5) : + FieldCW.tensor F 5 (interior i) 0 (interior j) = if i = j then 1 else 0 := by + simpa only [interior_complement, interior_injective.eq_iff] using + tensor_middle_zero_matching F 5 (interior i) (interior j) + +theorem coefficient011 (i j : Fin 5) : + FieldCW.tensor F 5 0 (interior i) (interior j) = if i = j then 1 else 0 := by + simpa only [interior_complement, interior_injective.eq_iff] using + tensor_zero_matching F 5 (interior i) (interior j) + +theorem coefficient002 : FieldCW.tensor F 5 0 0 6 = 1 := by + simpa [complement, lastLabel] using tensor_zero_matching F 5 0 0 + +theorem branch0 : + Tensor.pullback (fun x : Unit × Fin 5 => (Matrix.vecCons (0) (Matrix.vecCons (interior x.2) Matrix.vecEmpty))) + (fun y : Fin 5 × Unit => (Matrix.vecCons (0) (Matrix.vecCons (interior y.1) Matrix.vecEmpty))) + (fun _ : Unit × Unit => (Matrix.vecCons (6) (Matrix.vecCons (0) Matrix.vecEmpty))) + (shapeTensor (F := F) (Fin 2) (Matrix.vecCons (1) (Matrix.vecCons (1) (Matrix.vecCons (2) Matrix.vecEmpty)))) = + Tensor.matrixCoefficients Unit (Fin 5) Unit := by + funext x y z + simp [Tensor.pullback, shapeTensor, weight, strand, Fin.sum_univ_succ, + Fin.prod_univ_succ, interior_weight, + coefficient002, coefficient110, Tensor.matrixCoefficients] + +theorem branch1 : + Tensor.pullback (fun x : Unit × Fin 5 => (Matrix.vecCons (interior x.2) (Matrix.vecCons (0) Matrix.vecEmpty))) + (fun y : Fin 5 × Unit => (Matrix.vecCons (interior y.1) (Matrix.vecCons (0) Matrix.vecEmpty))) + (fun _ : Unit × Unit => (Matrix.vecCons (0) (Matrix.vecCons (6) Matrix.vecEmpty))) + (shapeTensor (F := F) (Fin 2) (Matrix.vecCons (1) (Matrix.vecCons (1) (Matrix.vecCons (2) Matrix.vecEmpty)))) = + Tensor.matrixCoefficients Unit (Fin 5) Unit := by + funext x y z + simp [Tensor.pullback, shapeTensor, weight, strand, Fin.sum_univ_succ, + Fin.prod_univ_succ, interior_weight, + coefficient002, coefficient110, Tensor.matrixCoefficients] + +theorem branch2 : + Tensor.pullback (fun x : Fin 5 × Unit => (Matrix.vecCons (0) (Matrix.vecCons (interior x.1) Matrix.vecEmpty))) + (fun y : Unit × Fin 5 => (Matrix.vecCons (interior y.2) (Matrix.vecCons (0) Matrix.vecEmpty))) + (fun z : Fin 5 × Fin 5 => (Matrix.vecCons (interior z.1) (Matrix.vecCons (interior z.2) Matrix.vecEmpty))) + (shapeTensor (F := F) (Fin 2) (Matrix.vecCons (1) (Matrix.vecCons (1) (Matrix.vecCons (2) Matrix.vecEmpty)))) = + Tensor.matrixCoefficients (Fin 5) Unit (Fin 5) := by + funext x y z + simp [Tensor.pullback, shapeTensor, weight, strand, Fin.sum_univ_succ, + Fin.prod_univ_succ, interior_weight, + coefficient011, coefficient101, Tensor.matrixCoefficients] + all_goals (split_ifs <;> simp_all [eq_comm]) + +theorem branch3 : + Tensor.pullback (fun x : Fin 5 × Unit => (Matrix.vecCons (interior x.1) (Matrix.vecCons (0) Matrix.vecEmpty))) + (fun y : Unit × Fin 5 => (Matrix.vecCons (0) (Matrix.vecCons (interior y.2) Matrix.vecEmpty))) + (fun z : Fin 5 × Fin 5 => (Matrix.vecCons (interior z.2) (Matrix.vecCons (interior z.1) Matrix.vecEmpty))) + (shapeTensor (F := F) (Fin 2) (Matrix.vecCons (1) (Matrix.vecCons (1) (Matrix.vecCons (2) Matrix.vecEmpty)))) = + Tensor.matrixCoefficients (Fin 5) Unit (Fin 5) := by + funext x y z + simp [Tensor.pullback, shapeTensor, weight, strand, Fin.sum_univ_succ, + Fin.prod_univ_succ, interior_weight, + coefficient011, coefficient101, Tensor.matrixCoefficients] + all_goals (split_ifs <;> simp_all [eq_comm]) + +end MatrixMultiplication.CWStageC + +open scoped BigOperators +open MatrixMultiplication.Foundation + +namespace MatrixMultiplication.CWStageCProducts + +def SmallRow : Fin 4 → Type := (Matrix.vecCons (Unit) (Matrix.vecCons (Unit) (Matrix.vecCons (Fin 5) (Matrix.vecCons (Fin 5) Matrix.vecEmpty)))) + +def SmallInner : Fin 4 → Type := (Matrix.vecCons (Fin 5) (Matrix.vecCons (Fin 5) (Matrix.vecCons (Unit) (Matrix.vecCons (Unit) Matrix.vecEmpty)))) + +instance smallRowFintype (b : Fin 4) : Fintype (SmallRow b) := by + refine Fin.cases ?_ (Fin.cases ?_ (Fin.cases ?_ (Fin.cases ?_ (fun b => Fin.elim0 b)))) b + all_goals dsimp [SmallRow]; infer_instance + +instance smallInnerFintype (b : Fin 4) : Fintype (SmallInner b) := by + refine Fin.cases ?_ (Fin.cases ?_ (Fin.cases ?_ (Fin.cases ?_ (fun b => Fin.elim0 b)))) b + all_goals dsimp [SmallInner]; infer_instance + +instance smallRowDecidableEq (b : Fin 4) : DecidableEq (SmallRow b) := by + refine Fin.cases ?_ (Fin.cases ?_ (Fin.cases ?_ (Fin.cases ?_ (fun b => Fin.elim0 b)))) b + all_goals dsimp [SmallRow]; infer_instance + +instance smallInnerDecidableEq (b : Fin 4) : DecidableEq (SmallInner b) := by + refine Fin.cases ?_ (Fin.cases ?_ (Fin.cases ?_ (Fin.cases ?_ (fun b => Fin.elim0 b)))) b + all_goals dsimp [SmallInner]; infer_instance + +def Row (s : Fin 3) (b : Fin 4) : Type := + if s = 1 then SmallInner b else SmallRow b + +def Middle (s : Fin 3) (b : Fin 4) : Type := + if s = 2 then SmallInner b else SmallRow b + +def Column (s : Fin 3) (b : Fin 4) : Type := + if s = 0 then SmallInner b else SmallRow b + +instance rowFintype (s : Fin 3) (b : Fin 4) : Fintype (Row s b) := by + unfold Row; split_ifs <;> infer_instance +instance middleFintype (s : Fin 3) (b : Fin 4) : Fintype (Middle s b) := by + unfold Middle; split_ifs <;> infer_instance +instance columnFintype (s : Fin 3) (b : Fin 4) : Fintype (Column s b) := by + unfold Column; split_ifs <;> infer_instance +instance rowDecidableEq (s : Fin 3) (b : Fin 4) : DecidableEq (Row s b) := by + unfold Row; split_ifs <;> infer_instance +instance middleDecidableEq (s : Fin 3) (b : Fin 4) : DecidableEq (Middle s b) := by + unfold Middle; split_ifs <;> infer_instance +instance columnDecidableEq (s : Fin 3) (b : Fin 4) : DecidableEq (Column s b) := by + unfold Column; split_ifs <;> infer_instance + +abbrev Word := Fin 2 → Fin 7 + +def shape (s : Fin 3) : Fin 3 → ℕ := fun i => if i = s then 2 else 1 + +def source (F : Type*) [CommRing F] (s : Fin 3) : Tensor F Word Word Word := + CWStrands.shapeTensor (Fin 2) (shape s) + +def canonicalAtom : Fin 4 → (Fin 3 → ℕ) := + (Matrix.vecCons ((Matrix.vecCons (1) (Matrix.vecCons (1) (Matrix.vecCons (0) Matrix.vecEmpty)))) (Matrix.vecCons ((Matrix.vecCons (0) (Matrix.vecCons (0) (Matrix.vecCons (2) Matrix.vecEmpty)))) (Matrix.vecCons ((Matrix.vecCons (1) (Matrix.vecCons (0) (Matrix.vecCons (1) Matrix.vecEmpty)))) (Matrix.vecCons ((Matrix.vecCons (0) (Matrix.vecCons (1) (Matrix.vecCons (1) Matrix.vecEmpty)))) Matrix.vecEmpty)))) + +def branchAtom (s : Fin 3) (b : Fin 4) : Fin 3 → ℕ := + if s = 0 then (Matrix.vecCons (canonicalAtom b 2) (Matrix.vecCons (canonicalAtom b 1) (Matrix.vecCons (canonicalAtom b 0) Matrix.vecEmpty))) + else if s = 1 then (Matrix.vecCons (canonicalAtom b 0) (Matrix.vecCons (canonicalAtom b 2) (Matrix.vecCons (canonicalAtom b 1) Matrix.vecEmpty))) + else canonicalAtom b + +def branchSource (F : Type*) [CommRing F] (s : Fin 3) (b : Fin 4) : + Tensor F Word Word Word := + fun x y z => + if CWLeafStatistics.weight (x 0) = branchAtom s b 0 ∧ + CWLeafStatistics.weight (y 0) = branchAtom s b 1 ∧ + CWLeafStatistics.weight (z 0) = branchAtom s b 2 + then source F s x y z else 0 + +abbrev Positions (counts : Fin 4 → ℕ) := Σ b : Fin 4, Fin (counts b) + +abbrev RowWords (s : Fin 3) (counts : Fin 4 → ℕ) := + ∀ p : Positions counts, Row s p.1 +abbrev MiddleWords (s : Fin 3) (counts : Fin 4 → ℕ) := + ∀ p : Positions counts, Middle s p.1 +abbrev ColumnWords (s : Fin 3) (counts : Fin 4 → ℕ) := + ∀ p : Positions counts, Column s p.1 + +def singleCount (counts : Fin 4 → ℕ) : ℕ := counts 0 + counts 1 +def crossCount (counts : Fin 4 → ℕ) : ℕ := counts 2 + counts 3 +def totalCount (counts : Fin 4 → ℕ) : ℕ := singleCount counts + crossCount counts + +variable (F : Type*) [CommRing F] + +theorem coefficient_swapXZ (x y z : Fin 7) : + FieldCW.tensor F 5 x y z = FieldCW.tensor F 5 z y x := by + simp only [FieldCW.tensor, Finset.sum_add_distrib, + mul_assoc, mul_comm, mul_left_comm] + ring + +theorem coefficient_swapYZ (x y z : Fin 7) : + FieldCW.tensor F 5 x y z = FieldCW.tensor F 5 x z y := by + simp only [FieldCW.tensor, Finset.sum_add_distrib, + mul_assoc, mul_comm, mul_left_comm] + ring + +theorem source_zero_apply (x y z : Word) : + source F 0 x y z = source F 2 z y x := by + have hs : CWStrands.strand (F := F) (Fin 2) x y z = + CWStrands.strand (F := F) (Fin 2) z y x := by + apply Finset.prod_congr rfl + intro i hi + exact coefficient_swapXZ F (x i) (y i) (z i) + simp [source, CWStrands.shapeTensor, shape, hs, and_comm, and_assoc] + +theorem source_one_apply (x y z : Word) : + source F 1 x y z = source F 2 x z y := by + have hs : CWStrands.strand (F := F) (Fin 2) x y z = + CWStrands.strand (F := F) (Fin 2) x z y := by + apply Finset.prod_congr rfl + intro i hi + exact coefficient_swapYZ F (x i) (y i) (z i) + simp [source, CWStrands.shapeTensor, shape, hs, and_comm] + +theorem source_two : source F 2 = + CWStrands.shapeTensor (F := F) (Fin 2) (Matrix.vecCons (1) (Matrix.vecCons (1) (Matrix.vecCons (2) Matrix.vecEmpty))) := by + congr 1 + +theorem canonical_pullback (b : Fin 4) : + ∃ (a : (SmallRow b × SmallInner b) → Word) + (c : (SmallInner b × SmallRow b) → Word) + (e : (SmallRow b × SmallRow b) → Word), + Tensor.pullback a c e (source F 2) = + Tensor.matrixCoefficients (SmallRow b) (SmallInner b) (SmallRow b) := by + rw [source_two] + fin_cases b + · exact ⟨_, _, _, CWStageC.branch1 F⟩ + · exact ⟨_, _, _, CWStageC.branch0 F⟩ + · exact ⟨_, _, _, CWStageC.branch3 F⟩ + · exact ⟨_, _, _, CWStageC.branch2 F⟩ + +theorem canonical_masked_pullback (b : Fin 4) : + ∃ (a : (SmallRow b × SmallInner b) → Word) + (c : (SmallInner b × SmallRow b) → Word) + (e : (SmallRow b × SmallRow b) → Word), + Tensor.pullback a c e (branchSource F 2 b) = + Tensor.matrixCoefficients (SmallRow b) (SmallInner b) (SmallRow b) := by + fin_cases b + · refine ⟨(fun x : Unit × Fin 5 => (Matrix.vecCons (CWStageC.interior x.2) (Matrix.vecCons (0) Matrix.vecEmpty))), + (fun y : Fin 5 × Unit => (Matrix.vecCons (CWStageC.interior y.1) (Matrix.vecCons (0) Matrix.vecEmpty))), + (fun _ : Unit × Unit => (Matrix.vecCons (0) (Matrix.vecCons (6) Matrix.vecEmpty))), ?_⟩ + funext x y z + have h := congrFun (congrFun (congrFun (CWStageC.branch1 F) x) y) z + convert h using 1 <;> first | rfl | simp [Tensor.pullback, + branchSource, branchAtom, canonicalAtom, + CWStageC.zero_weight, CWStageC.interior_weight, source_two] + · refine ⟨(fun x : Unit × Fin 5 => (Matrix.vecCons (0) (Matrix.vecCons (CWStageC.interior x.2) Matrix.vecEmpty))), + (fun y : Fin 5 × Unit => (Matrix.vecCons (0) (Matrix.vecCons (CWStageC.interior y.1) Matrix.vecEmpty))), + (fun _ : Unit × Unit => (Matrix.vecCons (6) (Matrix.vecCons (0) Matrix.vecEmpty))), ?_⟩ + funext x y z + have h := congrFun (congrFun (congrFun (CWStageC.branch0 F) x) y) z + convert h using 1 <;> rfl + · refine ⟨(fun x : Fin 5 × Unit => (Matrix.vecCons (CWStageC.interior x.1) (Matrix.vecCons (0) Matrix.vecEmpty))), + (fun y : Unit × Fin 5 => (Matrix.vecCons (0) (Matrix.vecCons (CWStageC.interior y.2) Matrix.vecEmpty))), + (fun z : Fin 5 × Fin 5 => (Matrix.vecCons (CWStageC.interior z.2) (Matrix.vecCons (CWStageC.interior z.1) Matrix.vecEmpty))), ?_⟩ + funext x y z + have h := congrFun (congrFun (congrFun (CWStageC.branch3 F) x) y) z + convert h using 1 <;> first | rfl | simp [Tensor.pullback, + branchSource, branchAtom, canonicalAtom, + CWStageC.zero_weight, CWStageC.interior_weight, source_two] + · refine ⟨(fun x : Fin 5 × Unit => (Matrix.vecCons (0) (Matrix.vecCons (CWStageC.interior x.1) Matrix.vecEmpty))), + (fun y : Unit × Fin 5 => (Matrix.vecCons (CWStageC.interior y.2) (Matrix.vecCons (0) Matrix.vecEmpty))), + (fun z : Fin 5 × Fin 5 => (Matrix.vecCons (CWStageC.interior z.1) (Matrix.vecCons (CWStageC.interior z.2) Matrix.vecEmpty))), ?_⟩ + funext x y z + have h := congrFun (congrFun (congrFun (CWStageC.branch2 F) x) y) z + convert h using 1 <;> first | rfl | simp [Tensor.pullback, + branchSource, branchAtom, canonicalAtom, + CWStageC.zero_weight, CWStageC.interior_weight, source_two] + +theorem branchSource_zero_apply (b : Fin 4) (x y z : Word) : + branchSource F 0 b x y z = branchSource F 2 b z y x := by + simp [branchSource, branchAtom, source_zero_apply, + and_comm, and_assoc] + +theorem branchSource_one_apply (b : Fin 4) (x y z : Word) : + branchSource F 1 b x y z = branchSource F 2 b x z y := by + simp [branchSource, branchAtom, source_one_apply, + and_comm] + +theorem oriented_pullback (s : Fin 3) (b : Fin 4) : + ∃ (a : (Row s b × Middle s b) → Word) + (c : (Middle s b × Column s b) → Word) + (e : (Column s b × Row s b) → Word), + Tensor.pullback a c e (source F s) = + Tensor.matrixCoefficients (Row s b) (Middle s b) (Column s b) := by + obtain ⟨a, c, e, h⟩ := canonical_pullback F b + fin_cases s + · refine ⟨fun x => e x.swap, fun y => c y.swap, fun z => a z.swap, ?_⟩ + funext x y z + have hh := congrFun (congrFun (congrFun h z.swap) y.swap) x.swap + simpa [Tensor.pullback, source_zero_apply, Row, Middle, Column, + Tensor.matrixCoefficients, Prod.swap, eq_comm, and_comm, and_left_comm, and_assoc] using hh + · refine ⟨fun x => a x.swap, fun y => e y.swap, fun z => c z.swap, ?_⟩ + funext x y z + have hh := congrFun (congrFun (congrFun h x.swap) z.swap) y.swap + simpa [Tensor.pullback, source_one_apply, Row, Middle, Column, + Tensor.matrixCoefficients, Prod.swap, eq_comm, and_comm, and_left_comm, and_assoc] using hh + · exact ⟨a, c, e, h⟩ + +theorem oriented_masked_pullback (s : Fin 3) (b : Fin 4) : + ∃ (a : (Row s b × Middle s b) → Word) + (c : (Middle s b × Column s b) → Word) + (e : (Column s b × Row s b) → Word), + Tensor.pullback a c e (branchSource F s b) = + Tensor.matrixCoefficients (Row s b) (Middle s b) (Column s b) := by + obtain ⟨a, c, e, h⟩ := canonical_masked_pullback F b + fin_cases s + · refine ⟨fun x => e x.swap, fun y => c y.swap, fun z => a z.swap, ?_⟩ + funext x y z + have hh := congrFun (congrFun (congrFun h z.swap) y.swap) x.swap + simpa [Tensor.pullback, branchSource_zero_apply, Row, Middle, Column, + Tensor.matrixCoefficients, Prod.swap, eq_comm, and_comm, and_left_comm, and_assoc] using hh + · refine ⟨fun x => a x.swap, fun y => e y.swap, fun z => c z.swap, ?_⟩ + funext x y z + have hh := congrFun (congrFun (congrFun h x.swap) z.swap) y.swap + simpa [Tensor.pullback, branchSource_one_apply, Row, Middle, Column, + Tensor.matrixCoefficients, Prod.swap, eq_comm, and_comm, and_left_comm, and_assoc] using hh + · exact ⟨a, c, e, h⟩ + +theorem oriented_restriction (s : Fin 3) (b : Fin 4) : + ∃ (a : (Row s b × Middle s b) → Word → F) + (c : (Middle s b × Column s b) → Word → F) + (e : (Column s b × Row s b) → Word → F), + Tensor.restrict a c e (branchSource F s b) = + Tensor.matrixCoefficients (Row s b) (Middle s b) (Column s b) := by + classical + obtain ⟨a, c, e, h⟩ := oriented_masked_pullback F s b + refine ⟨(fun x w => if w = a x then 1 else 0), + (fun y w => if w = c y then 1 else 0), + (fun z w => if w = e z then 1 else 0), ?_⟩ + rw [← Tensor.pullback_eq_restrict] + exact h + +def productSource (s : Fin 3) (counts : Fin 4 → ℕ) : + Tensor F (Positions counts → Word) (Positions counts → Word) (Positions counts → Word) := + CommonDimensions.familyProduct (fun p : Positions counts => branchSource F s p.1) + +theorem product_restriction (s : Fin 3) (counts : Fin 4 → ℕ) : + ∃ (a : (RowWords s counts × MiddleWords s counts) → (Positions counts → Word) → F) + (c : (MiddleWords s counts × ColumnWords s counts) → (Positions counts → Word) → F) + (e : (ColumnWords s counts × RowWords s counts) → (Positions counts → Word) → F), + Tensor.restrict a c e (productSource F s counts) = + Tensor.matrixCoefficients (RowWords s counts) (MiddleWords s counts) + (ColumnWords s counts) := by + classical + choose a c e h using fun p : Positions counts => oriented_restriction F s p.1 + exact TerminalProducts.matrix_restriction_of_history_restrictions + (fun p : Positions counts => branchSource F s p.1) + (fun p => Row s p.1) (fun p => Middle s p.1) (fun p => Column s p.1) a c e h + +end MatrixMultiplication.CWStageCProducts + +end + +noncomputable section + +open scoped BigOperators + +namespace MatrixMultiplication.CWStageCProducts + +attribute [local instance] Classical.propDecidable Classical.decEq + +theorem card_positions (counts : Fin 4 → ℕ) : + Fintype.card (Positions counts) = totalCount counts := by + simp [Positions, Fintype.card_sigma, Fin.sum_univ_succ, totalCount, + singleCount, crossCount, Nat.add_assoc] + +theorem card_rowWords (s : Fin 3) (counts : Fin 4 → ℕ) : + Fintype.card (RowWords s counts) = + 5 ^ (if s = 1 then singleCount counts else crossCount counts) := by + rw [Fintype.card_pi, Fintype.prod_sigma] + simp only [Fintype.card_eq_nat_card] + fin_cases s <;> + simp [Fin.prod_univ_succ, Row, SmallRow, SmallInner, singleCount, crossCount, pow_add] + +theorem card_middleWords (s : Fin 3) (counts : Fin 4 → ℕ) : + Fintype.card (MiddleWords s counts) = + 5 ^ (if s = 2 then singleCount counts else crossCount counts) := by + rw [Fintype.card_pi, Fintype.prod_sigma] + simp only [Fintype.card_eq_nat_card] + fin_cases s <;> + simp [Fin.prod_univ_succ, Middle, SmallRow, SmallInner, singleCount, crossCount, pow_add] + +theorem card_columnWords (s : Fin 3) (counts : Fin 4 → ℕ) : + Fintype.card (ColumnWords s counts) = + 5 ^ (if s = 0 then singleCount counts else crossCount counts) := by + rw [Fintype.card_pi, Fintype.prod_sigma] + simp only [Fintype.card_eq_nat_card] + fin_cases s <;> + simp [Fin.prod_univ_succ, Column, SmallRow, SmallInner, singleCount, crossCount, pow_add] + +def volume (s : Fin 3) (counts : Fin 4 → ℕ) : ℕ := + Fintype.card (RowWords s counts) * Fintype.card (MiddleWords s counts) * + Fintype.card (ColumnWords s counts) + +theorem volume_eq (s : Fin 3) (counts : Fin 4 → ℕ) : + volume s counts = 5 ^ (singleCount counts + 2 * crossCount counts) := by + rw [volume, card_rowWords, card_middleWords, card_columnWords] + fin_cases s <;> simp [pow_add, two_mul] <;> ring + +theorem volume_pos (s : Fin 3) (counts : Fin 4 → ℕ) : 0 < volume s counts := by + rw [volume_eq] + positivity + +theorem log_volume (s : Fin 3) (counts : Fin 4 → ℕ) : + Real.log (volume s counts : ℝ) = + ((singleCount counts : ℝ) + 2 * crossCount counts) * Real.log 5 := by + rw [volume_eq] + simp only [Nat.cast_pow, Nat.cast_ofNat, Real.log_pow, Nat.cast_add, Nat.cast_mul] + +theorem normalized_log_volume (s : Fin 3) (counts : Fin 4 → ℕ) + (hpos : 0 < totalCount counts) : + Real.log (volume s counts : ℝ) / totalCount counts = + (2 - (singleCount counts : ℝ) / totalCount counts) * Real.log 5 := by + have hn : (totalCount counts : ℝ) ≠ 0 := by exact_mod_cast (ne_of_gt hpos) + have ht : (totalCount counts : ℝ) = singleCount counts + (crossCount counts : ℝ) := by + simp [totalCount] + rw [log_volume, mul_div_right_comm] + congr 1 + field_simp [hn] + rw [ht] + ring + +theorem totalCount_of_atom_counts (counts : Fin 4 → ℕ) + (t u : AllFieldParameters.Shape) (n : ℕ) + (hc : ∀ i, (counts i : ℚ) = (n : ℚ) * AllFieldHistory.stageCWeight t u i) : + totalCount counts = n := by + apply Nat.cast_injective (R := ℚ) + calc + (totalCount counts : ℚ) = ∑ i, (counts i : ℚ) := by + simp [totalCount, singleCount, crossCount, Fin.sum_univ_succ, add_assoc] + _ = n := by + simp only [hc, ← Finset.mul_sum, AllFieldHistory.stageCWeight_normalized, mul_one] + +theorem log_volume_of_atom_counts (s : Fin 3) (counts : Fin 4 → ℕ) + (t u : AllFieldParameters.Shape) (n : ℕ) + (hc : ∀ i, (counts i : ℚ) = (n : ℚ) * AllFieldHistory.stageCWeight t u i) : + Real.log (volume s counts : ℝ) = + (n : ℝ) * (2 - (AllFieldParameters.binaryParameter t u : ℝ)) * Real.log 5 := by + have hs : (singleCount counts : ℚ) = (n : ℚ) * AllFieldParameters.binaryParameter t u := by + simp only [singleCount, Nat.cast_add, hc, ← mul_add, + AllFieldHistory.stageCWeight_single] + have hx : (crossCount counts : ℚ) = + (n : ℚ) * (1 - AllFieldParameters.binaryParameter t u) := by + simp only [crossCount, Nat.cast_add, hc, ← mul_add, + AllFieldHistory.stageCWeight_cross] + have hsr : (singleCount counts : ℝ) = + (n : ℝ) * (AllFieldParameters.binaryParameter t u : ℝ) := by exact_mod_cast hs + have hxr : (crossCount counts : ℝ) = + (n : ℝ) * (1 - (AllFieldParameters.binaryParameter t u : ℝ)) := by exact_mod_cast hx + rw [log_volume, hsr, hxr] + ring + +theorem normalized_log_volume_of_atom_counts (s : Fin 3) (counts : Fin 4 → ℕ) + (t u : AllFieldParameters.Shape) (n : ℕ) (hn : 0 < n) + (hc : ∀ i, (counts i : ℚ) = (n : ℚ) * AllFieldHistory.stageCWeight t u i) : + Real.log (volume s counts : ℝ) / totalCount counts = + (2 - (AllFieldParameters.binaryParameter t u : ℝ)) * Real.log 5 := by + rw [log_volume_of_atom_counts s counts t u n hc, totalCount_of_atom_counts counts t u n hc] + have hn' : (n : ℝ) ≠ 0 := by exact_mod_cast (ne_of_gt hn) + field_simp [hn'] + +variable {H : Type*} [Fintype H] + +abbrev HistoryRowWords (side : H → Fin 3) (counts : H → Fin 4 → ℕ) := + ∀ h, RowWords (side h) (counts h) +abbrev HistoryMiddleWords (side : H → Fin 3) (counts : H → Fin 4 → ℕ) := + ∀ h, MiddleWords (side h) (counts h) +abbrev HistoryColumnWords (side : H → Fin 3) (counts : H → Fin 4 → ℕ) := + ∀ h, ColumnWords (side h) (counts h) + +theorem card_historyRowWords (side : H → Fin 3) (counts : H → Fin 4 → ℕ) : + Fintype.card (HistoryRowWords side counts) = + 5 ^ ∑ h, (if side h = 1 then singleCount (counts h) else crossCount (counts h)) := by + rw [Fintype.card_pi] + simp only [card_rowWords] + exact Finset.prod_pow_eq_pow_sum _ _ _ + +theorem card_historyMiddleWords (side : H → Fin 3) (counts : H → Fin 4 → ℕ) : + Fintype.card (HistoryMiddleWords side counts) = + 5 ^ ∑ h, (if side h = 2 then singleCount (counts h) else crossCount (counts h)) := by + rw [Fintype.card_pi] + simp only [card_middleWords] + exact Finset.prod_pow_eq_pow_sum _ _ _ + +theorem card_historyColumnWords (side : H → Fin 3) (counts : H → Fin 4 → ℕ) : + Fintype.card (HistoryColumnWords side counts) = + 5 ^ ∑ h, (if side h = 0 then singleCount (counts h) else crossCount (counts h)) := by + rw [Fintype.card_pi] + simp only [card_columnWords] + exact Finset.prod_pow_eq_pow_sum _ _ _ + +def historyVolume (side : H → Fin 3) (counts : H → Fin 4 → ℕ) : ℕ := + Fintype.card (HistoryRowWords side counts) * + Fintype.card (HistoryMiddleWords side counts) * + Fintype.card (HistoryColumnWords side counts) + +theorem historyVolume_eq_prod (side : H → Fin 3) (counts : H → Fin 4 → ℕ) : + historyVolume side counts = ∏ h, volume (side h) (counts h) := by + simp only [historyVolume, HistoryRowWords, HistoryMiddleWords, HistoryColumnWords, + Fintype.card_pi, volume, Finset.prod_mul_distrib] + +theorem historyVolume_eq (side : H → Fin 3) (counts : H → Fin 4 → ℕ) : + historyVolume side counts = + 5 ^ ∑ h, (singleCount (counts h) + 2 * crossCount (counts h)) := by + rw [historyVolume_eq_prod] + simp only [volume_eq] + exact Finset.prod_pow_eq_pow_sum _ _ _ + +theorem log_historyVolume (side : H → Fin 3) (counts : H → Fin 4 → ℕ) : + Real.log (historyVolume side counts : ℝ) = + ∑ h, ((singleCount (counts h) : ℝ) + 2 * crossCount (counts h)) * Real.log 5 := by + rw [historyVolume_eq] + simp only [Nat.cast_pow, Nat.cast_ofNat, Real.log_pow, Nat.cast_sum, + Nat.cast_add, Nat.cast_mul, Finset.sum_mul] + +theorem log_historyVolume_of_mass_counts (side : H → Fin 3) + (counts : H → Fin 4 → ℕ) (t u : H → AllFieldParameters.Shape) + (mass : H → ℚ) (N : ℕ) + (hc : ∀ h i, (counts h i : ℚ) = + (N : ℚ) * mass h * AllFieldHistory.stageCWeight (t h) (u h) i) : + Real.log (historyVolume side counts : ℝ) = + (N : ℝ) * ∑ h, (mass h : ℝ) * + (2 - (AllFieldParameters.binaryParameter (t h) (u h) : ℝ)) * Real.log 5 := by + have hs (h : H) : (singleCount (counts h) : ℚ) = + (N : ℚ) * mass h * AllFieldParameters.binaryParameter (t h) (u h) := by + simp only [singleCount, Nat.cast_add, hc, ← mul_add, + AllFieldHistory.stageCWeight_single] + have hx (h : H) : (crossCount (counts h) : ℚ) = + (N : ℚ) * mass h * (1 - AllFieldParameters.binaryParameter (t h) (u h)) := by + simp only [crossCount, Nat.cast_add, hc, ← mul_add, + AllFieldHistory.stageCWeight_cross] + rw [log_historyVolume, Finset.mul_sum] + apply Finset.sum_congr rfl + intro h _ + have hsr : (singleCount (counts h) : ℝ) = + (N : ℝ) * (mass h : ℝ) * (AllFieldParameters.binaryParameter (t h) (u h) : ℝ) := by + exact_mod_cast hs h + have hxr : (crossCount (counts h) : ℝ) = + (N : ℝ) * (mass h : ℝ) * (1 - (AllFieldParameters.binaryParameter (t h) (u h) : ℝ)) := by + exact_mod_cast hx h + rw [hsr, hxr] + ring + +theorem normalized_log_historyVolume_of_mass_counts (side : H → Fin 3) + (counts : H → Fin 4 → ℕ) (t u : H → AllFieldParameters.Shape) + (mass : H → ℚ) (N : ℕ) (hN : 0 < N) + (hc : ∀ h i, (counts h i : ℚ) = + (N : ℚ) * mass h * AllFieldHistory.stageCWeight (t h) (u h) i) : + Real.log (historyVolume side counts : ℝ) / N = + ∑ h, (mass h : ℝ) * + (2 - (AllFieldParameters.binaryParameter (t h) (u h) : ℝ)) * Real.log 5 := by + rw [log_historyVolume_of_mass_counts side counts t u mass N hc] + have hn : (N : ℝ) ≠ 0 := by exact_mod_cast (ne_of_gt hN) + exact mul_div_cancel_left₀ _ hn + +abbrev PopulationHistory (K : ℕ) := AllFieldHistory.PartC K × AllFieldHistory.Placement + +def populationSide {K : ℕ} (h : PopulationHistory K) : Fin 3 := + h.2 (AllFieldHistory.stageCDistinguished (AllFieldHistory.cShapeParent h.1)) + +def populationAtomCounts {K : ℕ} (allocation : AllFieldHistory.Allocation) + (dilation : ℕ) (h : PopulationHistory K) (i : Fin 4) : ℕ := + AllFieldHistory.population allocation dilation (.afterC (h.1, i, false), h.2) + +theorem populationAtomCounts_mass {K : ℕ} (allocation : AllFieldHistory.Allocation) + (dilation : ℕ) (h : PopulationHistory K) (i : Fin 4) : + (populationAtomCounts allocation dilation h i : ℚ) = + (AllFieldHistory.populationLength (K := K) allocation dilation : ℚ) * + AllFieldHistory.amount allocation (.partC h.1, h.2) * + AllFieldHistory.stageCWeight (AllFieldHistory.cParameterParent h.1) + (AllFieldHistory.cShapeParent h.1) i := by + rw [populationAtomCounts, AllFieldHistory.population_cast] + simp only [AllFieldHistory.amount, AllFieldHistory.canonicalAmount, + AllFieldHistory.cAmount] + ring + +theorem populationAtomCounts_parent {K : ℕ} (allocation : AllFieldHistory.Allocation) + (dilation : ℕ) (h : PopulationHistory K) (i : Fin 4) : + (populationAtomCounts allocation dilation h i : ℚ) = + (AllFieldHistory.population allocation dilation (.partC h.1, h.2) : ℚ) * + AllFieldHistory.stageCWeight (AllFieldHistory.cParameterParent h.1) + (AllFieldHistory.cShapeParent h.1) i := by + rw [populationAtomCounts_mass, AllFieldHistory.population_cast] + +theorem populationAtomCounts_total {K : ℕ} (allocation : AllFieldHistory.Allocation) + (dilation : ℕ) (h : PopulationHistory K) : + totalCount (populationAtomCounts allocation dilation h) = + AllFieldHistory.population allocation dilation (.partC h.1, h.2) := by + simpa [totalCount, singleCount, crossCount, populationAtomCounts, + Fin.sum_univ_succ, Nat.add_assoc] using + AllFieldHistory.c_population_transition allocation dilation h.1 false h.2 + +theorem log_population_historyVolume {K : ℕ} (allocation : AllFieldHistory.Allocation) + (dilation : ℕ) (side : PopulationHistory K → Fin 3) : + Real.log (historyVolume side (populationAtomCounts allocation dilation) : ℝ) = + (AllFieldHistory.populationLength (K := K) allocation dilation : ℝ) * + ∑ h : PopulationHistory K, + (AllFieldHistory.amount allocation (.partC h.1, h.2) : ℝ) * + (2 - (AllFieldParameters.binaryParameter + (AllFieldHistory.cParameterParent h.1) + (AllFieldHistory.cShapeParent h.1) : ℝ)) * Real.log 5 := by + exact log_historyVolume_of_mass_counts side (populationAtomCounts allocation dilation) + (fun h => AllFieldHistory.cParameterParent h.1) + (fun h => AllFieldHistory.cShapeParent h.1) + (fun h => AllFieldHistory.amount allocation (.partC h.1, h.2)) + (AllFieldHistory.populationLength (K := K) allocation dilation) + (populationAtomCounts_mass allocation dilation) + +theorem normalized_log_population_historyVolume {K : ℕ} + (allocation : AllFieldHistory.Allocation) (dilation : ℕ) (hd : 0 < dilation) + (side : PopulationHistory K → Fin 3) : + Real.log (historyVolume side (populationAtomCounts allocation dilation) : ℝ) / + AllFieldHistory.populationLength (K := K) allocation dilation = + ∑ h : PopulationHistory K, + (AllFieldHistory.amount allocation (.partC h.1, h.2) : ℝ) * + (2 - (AllFieldParameters.binaryParameter + (AllFieldHistory.cParameterParent h.1) + (AllFieldHistory.cShapeParent h.1) : ℝ)) * Real.log 5 := by + exact normalized_log_historyVolume_of_mass_counts side + (populationAtomCounts allocation dilation) + (fun h => AllFieldHistory.cParameterParent h.1) + (fun h => AllFieldHistory.cShapeParent h.1) + (fun h => AllFieldHistory.amount allocation (.partC h.1, h.2)) + (AllFieldHistory.populationLength (K := K) allocation dilation) + (AllFieldPopulationCounts.blockLength_pos _ hd) + (populationAtomCounts_mass allocation dilation) + +def populationVolume {K : ℕ} (allocation : AllFieldHistory.Allocation) + (dilation : ℕ) : ℕ := + historyVolume (populationSide (K := K)) (populationAtomCounts allocation dilation) + +theorem log_populationVolume {K : ℕ} (allocation : AllFieldHistory.Allocation) + (dilation : ℕ) : + Real.log (populationVolume (K := K) allocation dilation : ℝ) = + (AllFieldHistory.populationLength (K := K) allocation dilation : ℝ) * + ∑ h : PopulationHistory K, + (AllFieldHistory.amount allocation (.partC h.1, h.2) : ℝ) * + (2 - (AllFieldParameters.binaryParameter + (AllFieldHistory.cParameterParent h.1) + (AllFieldHistory.cShapeParent h.1) : ℝ)) * Real.log 5 := + log_population_historyVolume allocation dilation populationSide + +theorem normalized_log_populationVolume {K : ℕ} + (allocation : AllFieldHistory.Allocation) (dilation : ℕ) (hd : 0 < dilation) : + Real.log (populationVolume (K := K) allocation dilation : ℝ) / + AllFieldHistory.populationLength (K := K) allocation dilation = + ∑ h : PopulationHistory K, + (AllFieldHistory.amount allocation (.partC h.1, h.2) : ℝ) * + (2 - (AllFieldParameters.binaryParameter + (AllFieldHistory.cParameterParent h.1) + (AllFieldHistory.cShapeParent h.1) : ℝ)) * Real.log 5 := + normalized_log_population_historyVolume allocation dilation hd populationSide + +end MatrixMultiplication.CWStageCProducts + +end + +noncomputable section + +open scoped BigOperators +open MatrixMultiplication.Foundation + +namespace MatrixMultiplication.CWStageCProducts + +def atomPermutation (s : Fin 3) (phi : Equiv.Perm (Fin 3)) : Equiv.Perm (Fin 4) := + if phi (Equiv.swap 2 s 0) = Equiv.swap 2 (phi s) 0 then Equiv.refl _ + else Equiv.swap 2 3 + +theorem branchAtom_transport (s : Fin 3) (phi : Equiv.Perm (Fin 3)) + (b : Fin 4) (i : Fin 3) : + branchAtom (phi s) (atomPermutation s phi b) (phi i) = branchAtom s b i := by + revert s phi b i + decide +kernel + +theorem atomPermutation_single (s : Fin 3) (phi : Equiv.Perm (Fin 3)) (b : Fin 4) : + (atomPermutation s phi b).val < 2 ↔ b.val < 2 := by + unfold atomPermutation + split_ifs + · rfl + · fin_cases b <;> decide + +theorem branchAtom_eq_stageCAtom (u : AllFieldParameters.Shape) (b : Fin 4) : + branchAtom (AllFieldHistory.stageCDistinguished u) b = AllFieldHistory.stageCAtom u b := by + rfl + +theorem shape_eq_parent (u : AllFieldParameters.Shape) + (hu : u ∈ AllFieldParameters.shapes 4) (hpos : AllFieldParameters.positive u = true) : + shape (AllFieldHistory.stageCDistinguished u) = u := by + rcases AllFieldHistory.positive_four_shapes u hu hpos with rfl | rfl | rfl <;> + funext i <;> fin_cases i <;> rfl + +theorem shape_transport (s : Fin 3) (phi : Equiv.Perm (Fin 3)) (i : Fin 3) : + shape (phi s) i = shape s (phi.symm i) := by + have hiff : i = phi s ↔ phi.symm i = s := by + constructor + · intro h + simp only [h, Equiv.symm_apply_apply] + · intro h + have hh := congrArg phi h + simpa only [Equiv.apply_symm_apply] using hh + simp only [shape, hiff] + +def placedBranchSource (F : Type*) [CommRing F] (s : Fin 3) + (phi : Equiv.Perm (Fin 3)) (b : Fin 4) : Tensor F Word Word Word := + fun x y z => + if CWLeafStatistics.weight (x 0) = branchAtom s b (phi.symm 0) ∧ + CWLeafStatistics.weight (y 0) = branchAtom s b (phi.symm 1) ∧ + CWLeafStatistics.weight (z 0) = branchAtom s b (phi.symm 2) + then source F (phi s) x y z else 0 + +theorem placedBranchSource_eq (F : Type*) [CommRing F] (s : Fin 3) + (phi : Equiv.Perm (Fin 3)) (b : Fin 4) : + placedBranchSource F s phi b = branchSource F (phi s) (atomPermutation s phi b) := by + have h0 := branchAtom_transport s phi b (phi.symm 0) + have h1 := branchAtom_transport s phi b (phi.symm 1) + have h2 := branchAtom_transport s phi b (phi.symm 2) + simp only [Equiv.apply_symm_apply] at h0 h1 h2 + funext x y z + simp only [placedBranchSource, branchSource, h0, h1, h2] + +theorem placed_branch_restriction (F : Type*) [CommRing F] (s : Fin 3) + (phi : Equiv.Perm (Fin 3)) (b : Fin 4) : + ∃ (a : (Row (phi s) b × Middle (phi s) b) → Word → F) + (c : (Middle (phi s) b × Column (phi s) b) → Word → F) + (e : (Column (phi s) b × Row (phi s) b) → Word → F), + Tensor.restrict a c e (placedBranchSource F s phi b) = + Tensor.matrixCoefficients (Row (phi s) b) (Middle (phi s) b) (Column (phi s) b) := by + rw [placedBranchSource_eq] + have h := oriented_restriction F (phi s) (atomPermutation s phi b) + by_cases hp : phi (Equiv.swap 2 s 0) = Equiv.swap 2 (phi s) 0 + · have he : atomPermutation s phi = Equiv.refl _ := ite_eq_left hp + rw [he] at h ⊢ + exact h + · have he : atomPermutation s phi = Equiv.swap 2 3 := ite_eq_right hp + rw [he] at h ⊢ + fin_cases b <;> norm_num only [Equiv.swap_apply_def] at h ⊢ <;> exact h + +def placedProductSource (F : Type*) [CommRing F] (s : Fin 3) + (phi : Equiv.Perm (Fin 3)) (counts : Fin 4 → ℕ) : + Tensor F (Positions counts → Word) (Positions counts → Word) (Positions counts → Word) := + CommonDimensions.familyProduct (fun p : Positions counts => placedBranchSource F s phi p.1) + +theorem placed_product_restriction (F : Type*) [CommRing F] (s : Fin 3) + (phi : Equiv.Perm (Fin 3)) (counts : Fin 4 → ℕ) : + ∃ (a : (RowWords (phi s) counts × MiddleWords (phi s) counts) → + (Positions counts → Word) → F) + (c : (MiddleWords (phi s) counts × ColumnWords (phi s) counts) → + (Positions counts → Word) → F) + (e : (ColumnWords (phi s) counts × RowWords (phi s) counts) → + (Positions counts → Word) → F), + Tensor.restrict a c e (placedProductSource F s phi counts) = + Tensor.matrixCoefficients (RowWords (phi s) counts) (MiddleWords (phi s) counts) + (ColumnWords (phi s) counts) := by + classical + choose a c e h using fun p : Positions counts => placed_branch_restriction F s phi p.1 + exact TerminalProducts.matrix_restriction_of_history_restrictions + (fun p : Positions counts => placedBranchSource F s phi p.1) + (fun p => Row (phi s) p.1) (fun p => Middle (phi s) p.1) + (fun p => Column (phi s) p.1) a c e h + +end MatrixMultiplication.CWStageCProducts + +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/Tensors/CWStageCStatistics.lean b/lean/OAI/LinearAlgebra/MatrixFields/Tensors/CWStageCStatistics.lean new file mode 100644 index 0000000000000000000000000000000000000000..093fcd4293797639a21b36d552eeec6de8c4c842 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/Tensors/CWStageCStatistics.lean @@ -0,0 +1,503 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Tensors.CWStageCPlacements + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +noncomputable section + +open scoped BigOperators +open MatrixMultiplication.Foundation + +namespace MatrixMultiplication.CWStageCProducts + +abbrev ChildPair := Fin 7 × Fin 7 + +def joinChildren (p : ChildPair) : Word := (Matrix.vecCons (p.1) (Matrix.vecCons (p.2) Matrix.vecEmpty)) +def splitChildren (w : Word) : ChildPair := (w 0, w 1) + +@[simp] theorem joinChildren_zero (p : ChildPair) : joinChildren p 0 = p.1 := rfl +@[simp] theorem joinChildren_one (p : ChildPair) : joinChildren p 1 = p.2 := rfl + +@[simp] theorem join_split_children (w : Word) : joinChildren (splitChildren w) = w := by + funext i + fin_cases i <;> rfl + +def siteTensor (F : Type*) [CommRing F] (g : Fin 3 → ℕ) : + Tensor F (Fin 7) (Fin 7) (Fin 7) := + fun x y z => if CWLeafStatistics.weight x = g 0 ∧ + CWLeafStatistics.weight y = g 1 ∧ CWLeafStatistics.weight z = g 2 + then FieldCW.tensor F 5 x y z else 0 + +theorem siteTensor_support (F : Type*) [CommRing F] (g : Fin 3 → ℕ) + (x y z : Fin 7) (h : siteTensor F g x y z ≠ 0) : + CWLeafStatistics.weight x = g 0 ∧ CWLeafStatistics.weight y = g 1 ∧ + CWLeafStatistics.weight z = g 2 := by + by_contra hn + exact h (ite_eq_right hn) + +theorem siteProduct_side_weights (F : Type*) [CommRing F] (g h : Fin 3 → ℕ) + (x y z : ChildPair) + (hne : Tensor.product (siteTensor F g) (siteTensor F h) x y z ≠ 0) (i : Fin 3) : + CWLeafStatistics.weight (((Matrix.vecCons (x) (Matrix.vecCons (y) (Matrix.vecCons (z) Matrix.vecEmpty))) i).1) = g i ∧ + CWLeafStatistics.weight (((Matrix.vecCons (x) (Matrix.vecCons (y) (Matrix.vecCons (z) Matrix.vecEmpty))) i).2) = h i := by + change siteTensor F g x.1 y.1 z.1 * siteTensor F h x.2 y.2 z.2 ≠ 0 at hne + have hL : siteTensor F g x.1 y.1 z.1 ≠ 0 := by + intro he + exact hne (by simp [he]) + have hR : siteTensor F h x.2 y.2 z.2 ≠ 0 := by + intro he + exact hne (by simp [he]) + obtain ⟨hxL, hyL, hzL⟩ := siteTensor_support F g x.1 y.1 z.1 hL + obtain ⟨hxR, hyR, hzR⟩ := siteTensor_support F h x.2 y.2 z.2 hR + fin_cases i + · exact ⟨hxL, hxR⟩ + · exact ⟨hyL, hyR⟩ + · exact ⟨hzL, hzR⟩ + +theorem siteTensor_eq_shapeTensor (F : Type*) [CommRing F] (g : Fin 3 → ℕ) : + Tensor.pullback (fun (x : Fin 7) (_ : Fin 1) => x) + (fun (y : Fin 7) (_ : Fin 1) => y) (fun (z : Fin 7) (_ : Fin 1) => z) + (CWStrands.shapeTensor (F := F) (Fin 1) g) = siteTensor F g := by + funext x y z + simp [Tensor.pullback, CWStrands.shapeTensor, CWStrands.weight, CWStrands.strand, + siteTensor] + +def childProduct (F : Type*) [CommRing F] (s : Fin 3) (b : Fin 4) : + Tensor F ChildPair ChildPair ChildPair := + Tensor.product (siteTensor F (branchAtom s b)) + (siteTensor F (fun i => shape s i - branchAtom s b i)) + +theorem branchAtom_le_shape (s : Fin 3) (b : Fin 4) (i : Fin 3) : + branchAtom s b i ≤ shape s i := by + fin_cases s <;> fin_cases b <;> fin_cases i <;> decide + +theorem weight_joinChildren (x : ChildPair) : + CWStrands.weight (joinChildren x) = + CWLeafStatistics.weight x.1 + CWLeafStatistics.weight x.2 := by + simp [CWStrands.weight, joinChildren, Fin.sum_univ_succ] + +theorem strand_joinChildren (F : Type*) [CommRing F] (x y z : ChildPair) : + CWStrands.strand (F := F) (Fin 2) (joinChildren x) (joinChildren y) (joinChildren z) = + FieldCW.tensor F 5 x.1 y.1 z.1 * FieldCW.tensor F 5 x.2 y.2 z.2 := by + simp [CWStrands.strand, joinChildren, Fin.prod_univ_succ] + +theorem masked_eq_childProduct (F : Type*) [CommRing F] (s : Fin 3) (b : Fin 4) : + Tensor.pullback joinChildren joinChildren joinChildren (branchSource F s b) = + childProduct F s b := by + funext x y z + have h0 := branchAtom_le_shape s b 0 + have h1 := branchAtom_le_shape s b 1 + have h2 := branchAtom_le_shape s b 2 + by_cases hL : CWLeafStatistics.weight x.1 = branchAtom s b 0 ∧ + CWLeafStatistics.weight y.1 = branchAtom s b 1 ∧ + CWLeafStatistics.weight z.1 = branchAtom s b 2 + · have htotal : + (CWLeafStatistics.weight x.1 + CWLeafStatistics.weight x.2 = shape s 0 ∧ + CWLeafStatistics.weight y.1 + CWLeafStatistics.weight y.2 = shape s 1 ∧ + CWLeafStatistics.weight z.1 + CWLeafStatistics.weight z.2 = shape s 2) ↔ + (CWLeafStatistics.weight x.2 = shape s 0 - branchAtom s b 0 ∧ + CWLeafStatistics.weight y.2 = shape s 1 - branchAtom s b 1 ∧ + CWLeafStatistics.weight z.2 = shape s 2 - branchAtom s b 2) := by + rcases hL with ⟨hx, hy, hz⟩ + constructor <;> rintro ⟨ha, hb, hc⟩ <;> + exact ⟨by omega, by omega, by omega⟩ + simp only [hL.1, hL.2.1, hL.2.2] at htotal + simp [Tensor.pullback, branchSource, source, CWStrands.shapeTensor, + weight_joinChildren, strand_joinChildren, childProduct, Tensor.product, siteTensor, + hL, htotal, mul_ite] + · simp [Tensor.pullback, branchSource, childProduct, Tensor.product, siteTensor, hL] + +theorem childProduct_split (F : Type*) [CommRing F] (s : Fin 3) (b : Fin 4) + (x y z : Word) : + childProduct F s b (splitChildren x) (splitChildren y) (splitChildren z) = + branchSource F s b x y z := by + have h := congrFun (congrFun (congrFun (masked_eq_childProduct F s b) + (splitChildren x)) (splitChildren y)) (splitChildren z) + simpa only [Tensor.pullback, join_split_children] using h.symm + +theorem childProduct_pullback (F : Type*) [CommRing F] (s : Fin 3) (b : Fin 4) : + ∃ (a : (Row s b × Middle s b) → ChildPair) + (c : (Middle s b × Column s b) → ChildPair) + (e : (Column s b × Row s b) → ChildPair), + Tensor.pullback a c e (childProduct F s b) = + Tensor.matrixCoefficients (Row s b) (Middle s b) (Column s b) := by + obtain ⟨a, c, e, h⟩ := oriented_masked_pullback F s b + refine ⟨splitChildren ∘ a, splitChildren ∘ c, splitChildren ∘ e, ?_⟩ + funext x y z + change childProduct F s b (splitChildren (a x)) (splitChildren (c y)) + (splitChildren (e z)) = _ + rw [childProduct_split] + exact congrFun (congrFun (congrFun h x) y) z + +theorem childProduct_restriction (F : Type*) [CommRing F] (s : Fin 3) (b : Fin 4) : + ∃ (a : (Row s b × Middle s b) → ChildPair → F) + (c : (Middle s b × Column s b) → ChildPair → F) + (e : (Column s b × Row s b) → ChildPair → F), + Tensor.restrict a c e (childProduct F s b) = + Tensor.matrixCoefficients (Row s b) (Middle s b) (Column s b) := by + classical + obtain ⟨a, c, e, h⟩ := childProduct_pullback F s b + refine ⟨(fun x w => if w = a x then 1 else 0), + (fun y w => if w = c y then 1 else 0), + (fun z w => if w = e z then 1 else 0), ?_⟩ + rw [← Tensor.pullback_eq_restrict] + exact h + +def placedChildProduct (F : Type*) [CommRing F] (s : Fin 3) + (phi : Equiv.Perm (Fin 3)) (b : Fin 4) := + childProduct F (phi s) (atomPermutation s phi b) + +theorem placedChildProduct_eq (F : Type*) [CommRing F] (s : Fin 3) + (phi : Equiv.Perm (Fin 3)) (b : Fin 4) : + placedChildProduct F s phi b = + Tensor.product (siteTensor F (fun i => branchAtom s b (phi.symm i))) + (siteTensor F (fun i => shape s (phi.symm i) - branchAtom s b (phi.symm i))) := by + have ha : branchAtom (phi s) (atomPermutation s phi b) = + fun i => branchAtom s b (phi.symm i) := by + funext i + simpa only [Equiv.apply_symm_apply] using branchAtom_transport s phi b (phi.symm i) + have hs : shape (phi s) = fun i => shape s (phi.symm i) := by + funext i + exact shape_transport s phi i + simp only [placedChildProduct, childProduct, ha, hs] + +theorem placedChildProduct_eq_stageC (F : Type*) [CommRing F] + (u : AllFieldParameters.Shape) (hu : u ∈ AllFieldParameters.shapes 4) + (hpos : AllFieldParameters.positive u = true) + (phi : Equiv.Perm (Fin 3)) (b : Fin 4) : + placedChildProduct F (AllFieldHistory.stageCDistinguished u) phi b = + Tensor.product (siteTensor F (fun i => AllFieldHistory.stageCAtom u b (phi.symm i))) + (siteTensor F (fun i => u (phi.symm i) - + AllFieldHistory.stageCAtom u b (phi.symm i))) := by + rw [placedChildProduct_eq, branchAtom_eq_stageCAtom, shape_eq_parent u hu hpos] + +theorem placedChildProduct_side_weights (F : Type*) [CommRing F] (s : Fin 3) + (phi : Equiv.Perm (Fin 3)) (b : Fin 4) (x y z : ChildPair) + (hne : placedChildProduct F s phi b x y z ≠ 0) (i : Fin 3) : + CWLeafStatistics.weight (((Matrix.vecCons (x) (Matrix.vecCons (y) (Matrix.vecCons (z) Matrix.vecEmpty))) i).1) = branchAtom s b (phi.symm i) ∧ + CWLeafStatistics.weight (((Matrix.vecCons (x) (Matrix.vecCons (y) (Matrix.vecCons (z) Matrix.vecEmpty))) i).2) = + shape s (phi.symm i) - branchAtom s b (phi.symm i) := by + rw [placedChildProduct_eq] at hne + exact siteProduct_side_weights F _ _ x y z hne i + +theorem placedChildProduct_restriction (F : Type*) [CommRing F] (s : Fin 3) + (phi : Equiv.Perm (Fin 3)) (b : Fin 4) : + ∃ (a : (Row (phi s) b × Middle (phi s) b) → ChildPair → F) + (c : (Middle (phi s) b × Column (phi s) b) → ChildPair → F) + (e : (Column (phi s) b × Row (phi s) b) → ChildPair → F), + Tensor.restrict a c e (placedChildProduct F s phi b) = + Tensor.matrixCoefficients (Row (phi s) b) (Middle (phi s) b) (Column (phi s) b) := by + have h := childProduct_restriction F (phi s) (atomPermutation s phi b) + unfold placedChildProduct + by_cases hp : phi (Equiv.swap 2 s 0) = Equiv.swap 2 (phi s) 0 + · have he : atomPermutation s phi = Equiv.refl _ := ite_eq_left hp + rw [he] at h ⊢ + exact h + · have he : atomPermutation s phi = Equiv.swap 2 3 := ite_eq_right hp + rw [he] at h ⊢ + fin_cases b <;> norm_num only [Equiv.swap_apply_def] at h ⊢ <;> exact h + +def placedChildProducts (F : Type*) [CommRing F] (s : Fin 3) + (phi : Equiv.Perm (Fin 3)) (counts : Fin 4 → ℕ) : + Tensor F (Positions counts → ChildPair) (Positions counts → ChildPair) + (Positions counts → ChildPair) := + CommonDimensions.familyProduct (fun p : Positions counts => placedChildProduct F s phi p.1) + +theorem placedChildProducts_side_weights (F : Type*) [CommRing F] (s : Fin 3) + (phi : Equiv.Perm (Fin 3)) (counts : Fin 4 → ℕ) + (x y z : Positions counts → ChildPair) + (hne : placedChildProducts F s phi counts x y z ≠ 0) + (p : Positions counts) (i : Fin 3) : + CWLeafStatistics.weight (((Matrix.vecCons (x p) (Matrix.vecCons (y p) (Matrix.vecCons (z p) Matrix.vecEmpty))) i).1) = branchAtom s p.1 (phi.symm i) ∧ + CWLeafStatistics.weight (((Matrix.vecCons (x p) (Matrix.vecCons (y p) (Matrix.vecCons (z p) Matrix.vecEmpty))) i).2) = + shape s (phi.symm i) - branchAtom s p.1 (phi.symm i) := by + have hp : placedChildProduct F s phi p.1 (x p) (y p) (z p) ≠ 0 := by + intro he + exact hne (Finset.prod_eq_zero (Finset.mem_univ p) he) + exact placedChildProduct_side_weights F s phi p.1 (x p) (y p) (z p) hp i + +theorem placedChildProducts_restriction (F : Type*) [CommRing F] (s : Fin 3) + (phi : Equiv.Perm (Fin 3)) (counts : Fin 4 → ℕ) : + ∃ (a : (RowWords (phi s) counts × MiddleWords (phi s) counts) → + (Positions counts → ChildPair) → F) + (c : (MiddleWords (phi s) counts × ColumnWords (phi s) counts) → + (Positions counts → ChildPair) → F) + (e : (ColumnWords (phi s) counts × RowWords (phi s) counts) → + (Positions counts → ChildPair) → F), + Tensor.restrict a c e (placedChildProducts F s phi counts) = + Tensor.matrixCoefficients (RowWords (phi s) counts) (MiddleWords (phi s) counts) + (ColumnWords (phi s) counts) := by + classical + choose a c e h using fun p : Positions counts => placedChildProduct_restriction F s phi p.1 + exact TerminalProducts.matrix_restriction_of_history_restrictions + (fun p : Positions counts => placedChildProduct F s phi p.1) + (fun p => Row (phi s) p.1) (fun p => Middle (phi s) p.1) + (fun p => Column (phi s) p.1) a c e h + +end MatrixMultiplication.CWStageCProducts + +end + +noncomputable section +section + +open MatrixMultiplication.Foundation + +namespace MatrixMultiplication.CWStageCProducts + +abbrev ChildWords := (Fin 1 → Fin 7) × (Fin 1 → Fin 7) + +def singletonChildWords (p : ChildPair) : ChildWords := + (fun _ => p.1, fun _ => p.2) + +def collapseChildWords (w : ChildWords) : ChildPair := (w.1 0, w.2 0) + +@[simp] theorem singleton_collapse_childWords (w : ChildWords) : + singletonChildWords (collapseChildWords w) = w := by + apply Prod.ext <;> funext i <;> fin_cases i <;> rfl + +def placedShapeChildProduct (F : Type*) [CommRing F] (s : Fin 3) + (phi : Equiv.Perm (Fin 3)) (b : Fin 4) : Tensor F ChildWords ChildWords ChildWords := + Tensor.product + (CWStrands.shapeTensor (Fin 1) (fun i => branchAtom s b (phi.symm i))) + (CWStrands.shapeTensor (Fin 1) + (fun i => shape s (phi.symm i) - branchAtom s b (phi.symm i))) + +theorem placedShapeChildProduct_eq_stageC (F : Type*) [CommRing F] + (u : AllFieldParameters.Shape) (hu : u ∈ AllFieldParameters.shapes 4) + (hpos : AllFieldParameters.positive u = true) + (phi : Equiv.Perm (Fin 3)) (b : Fin 4) : + placedShapeChildProduct F (AllFieldHistory.stageCDistinguished u) phi b = + Tensor.product + (CWStrands.shapeTensor (Fin 1) (fun i => AllFieldHistory.stageCAtom u b (phi.symm i))) + (CWStrands.shapeTensor (Fin 1) (fun i => u (phi.symm i) - + AllFieldHistory.stageCAtom u b (phi.symm i))) := by + unfold placedShapeChildProduct + rw [branchAtom_eq_stageCAtom, shape_eq_parent u hu hpos] + +theorem placedShapeChildProduct_pullback (F : Type*) [CommRing F] (s : Fin 3) + (phi : Equiv.Perm (Fin 3)) (b : Fin 4) : + Tensor.pullback singletonChildWords singletonChildWords singletonChildWords + (placedShapeChildProduct F s phi b) = placedChildProduct F s phi b := by + rw [placedChildProduct_eq] + funext x y z + have hL := congrFun (congrFun (congrFun + (siteTensor_eq_shapeTensor F (fun i => branchAtom s b (phi.symm i))) x.1) y.1) z.1 + have hR := congrFun (congrFun (congrFun + (siteTensor_eq_shapeTensor F + (fun i => shape s (phi.symm i) - branchAtom s b (phi.symm i))) x.2) y.2) z.2 + exact congrArg₂ (fun a b : F => a * b) hL hR + +theorem placedShapeChildProduct_restriction (F : Type*) [CommRing F] (s : Fin 3) + (phi : Equiv.Perm (Fin 3)) (b : Fin 4) : + ∃ (a : (Row (phi s) b × Middle (phi s) b) → ChildWords → F) + (c : (Middle (phi s) b × Column (phi s) b) → ChildWords → F) + (e : (Column (phi s) b × Row (phi s) b) → ChildWords → F), + Tensor.restrict a c e (placedShapeChildProduct F s phi b) = + Tensor.matrixCoefficients (Row (phi s) b) (Middle (phi s) b) (Column (phi s) b) := by + classical + let E : ChildPair → ChildWords → F := fun p w => if w = singletonChildWords p then 1 else 0 + have hE : Tensor.restrict E E E (placedShapeChildProduct F s phi b) = + placedChildProduct F s phi b := by + rw [← Tensor.pullback_eq_restrict] + exact placedShapeChildProduct_pullback F s phi b + obtain ⟨a, c, e, h⟩ := placedChildProduct_restriction F s phi b + refine ⟨Tensor.composeRestrictionMatrix a E, Tensor.composeRestrictionMatrix c E, + Tensor.composeRestrictionMatrix e E, ?_⟩ + rw [← Tensor.restrict_restrict, hE, h] + +def placedShapeChildProducts (F : Type*) [CommRing F] (s : Fin 3) + (phi : Equiv.Perm (Fin 3)) (counts : Fin 4 → ℕ) : + Tensor F (Positions counts → ChildWords) (Positions counts → ChildWords) + (Positions counts → ChildWords) := + CommonDimensions.familyProduct + (fun p : Positions counts => placedShapeChildProduct F s phi p.1) + +theorem placedShapeChildProducts_collapse (F : Type*) [CommRing F] (s : Fin 3) + (phi : Equiv.Perm (Fin 3)) (counts : Fin 4 → ℕ) + (x y z : Positions counts → ChildWords) : + placedChildProducts F s phi counts (collapseChildWords ∘ x) + (collapseChildWords ∘ y) (collapseChildWords ∘ z) = + placedShapeChildProducts F s phi counts x y z := by + dsimp only [placedChildProducts, placedShapeChildProducts, CommonDimensions.familyProduct] + apply Finset.prod_congr rfl + intro p _ + have h := congrFun (congrFun (congrFun (placedShapeChildProduct_pullback F s phi p.1) + (collapseChildWords (x p))) (collapseChildWords (y p))) (collapseChildWords (z p)) + simpa only [Tensor.pullback, singleton_collapse_childWords, Function.comp_apply] using h.symm + +theorem placedShapeChildProducts_restriction (F : Type*) [CommRing F] (s : Fin 3) + (phi : Equiv.Perm (Fin 3)) (counts : Fin 4 → ℕ) : + ∃ (a : (RowWords (phi s) counts × MiddleWords (phi s) counts) → + (Positions counts → ChildWords) → F) + (c : (MiddleWords (phi s) counts × ColumnWords (phi s) counts) → + (Positions counts → ChildWords) → F) + (e : (ColumnWords (phi s) counts × RowWords (phi s) counts) → + (Positions counts → ChildWords) → F), + Tensor.restrict a c e (placedShapeChildProducts F s phi counts) = + Tensor.matrixCoefficients (RowWords (phi s) counts) (MiddleWords (phi s) counts) + (ColumnWords (phi s) counts) := by + classical + choose a c e h using fun p : Positions counts => placedShapeChildProduct_restriction F s phi p.1 + exact TerminalProducts.matrix_restriction_of_history_restrictions + (fun p : Positions counts => placedShapeChildProduct F s phi p.1) + (fun p => Row (phi s) p.1) (fun p => Middle (phi s) p.1) + (fun p => Column (phi s) p.1) a c e h + +end MatrixMultiplication.CWStageCProducts + +end + +open scoped BigOperators +open MatrixMultiplication.Foundation + +namespace MatrixMultiplication.CWStageCProducts + +attribute [local instance] Classical.propDecidable Classical.decEq + +def branchStatistic (s : Fin 3) (b : Fin 4) (i : Fin 3) : Fin 6 := + if i = s then if b.val < 2 then 3 else 2 else 1 + +theorem twoStatistic_of_side_weights (s : Fin 3) (b : Fin 4) (i : Fin 3) + (w : Word) + (hleft : CWLeafStatistics.weight (w 0) = branchAtom s b i) + (hright : CWLeafStatistics.weight (w 1) = shape s i - branchAtom s b i) : + CWCompleteStatistics.twoStatistic w = branchStatistic s b i := by + change CWLeafStatistics.pairStatistic (w 0, w 1) = _ + unfold CWLeafStatistics.pairStatistic + dsimp only + rw [hleft, hright] + fin_cases s <;> fin_cases b <;> fin_cases i <;> decide + +theorem placed_twoStatistic_of_side_weights (s : Fin 3) + (phi : Equiv.Perm (Fin 3)) (b : Fin 4) (i : Fin 3) (w : Word) + (hleft : CWLeafStatistics.weight (w 0) = branchAtom s b (phi.symm i)) + (hright : CWLeafStatistics.weight (w 1) = + shape s (phi.symm i) - branchAtom s b (phi.symm i)) : + CWCompleteStatistics.twoStatistic w = branchStatistic s b (phi.symm i) := + twoStatistic_of_side_weights s b (phi.symm i) w hleft hright + +theorem wordPopulation_of_branchStatistic (counts : Fin 4 → ℕ) (s i : Fin 3) + (w : Positions counts → Fin 6) + (hw : ∀ p, w p = branchStatistic s p.1 i) (a : Fin 6) : + wordPopulation w a = + ∑ b : Fin 4, if branchStatistic s b i = a then counts b else 0 := by + let e : {p : Positions counts // w p = a} ≃ + (Σ b : Fin 4, {j : Fin (counts b) // branchStatistic s b i = a}) := + { toFun := fun p => ⟨p.val.1, ⟨p.val.2, (hw p.val).symm.trans p.property⟩⟩ + invFun := fun p => ⟨⟨p.1, p.2.val⟩, (hw _).trans p.2.property⟩ + left_inv := by intro p; rfl + right_inv := by intro p; rfl } + rw [wordPopulation, Fintype.card_congr e, Fintype.card_sigma] + apply Finset.sum_congr rfl + intro b _ + by_cases h : branchStatistic s b i = a <;> simp [h] + +theorem empiricalLaw_eq_littleLaw (counts : Fin 4 → ℕ) + (t u : AllFieldParameters.Shape) (hu : u ∈ AllFieldParameters.shapes 4) + (hpos : AllFieldParameters.positive u = true) (n : ℕ) (hn : 0 < n) + (hc : ∀ b, (counts b : ℚ) = (n : ℚ) * AllFieldHistory.stageCWeight t u b) + (i : Fin 3) (w : Positions counts → Fin 6) + (hw : ∀ p, w p = branchStatistic (AllFieldHistory.stageCDistinguished u) p.1 i) : + InheritedMasks.empiricalLaw w = + fun a => (AllFieldParameters.littleLaw t u i a : ℝ) := by + have hcard : Fintype.card (Positions counts) = n := by + apply Nat.cast_injective (R := ℚ) + calc + (Fintype.card (Positions counts) : ℚ) = ∑ b, (counts b : ℚ) := by + simp [Positions, Fintype.card_sigma] + _ = n := by + simp only [hc, ← Finset.mul_sum, AllFieldHistory.stageCWeight_normalized, mul_one] + have hshape : u i = if i = AllFieldHistory.stageCDistinguished u then 2 else 1 := by + exact congrFun (shape_eq_parent u hu hpos).symm i + have hcount (a : Fin 6) : (wordPopulation w a : ℚ) = + (n : ℚ) * AllFieldParameters.littleLaw t u i a := by + rw [wordPopulation_of_branchStatistic counts _ i w hw a] + simp only [Nat.cast_sum, Nat.cast_ite, Nat.cast_zero] + simp_rw [hc] + simp only [AllFieldParameters.littleLaw, hshape] + by_cases hi : i = AllFieldHistory.stageCDistinguished u <;> + fin_cases a <;> + simp [branchStatistic, hi, Fin.sum_univ_succ, + AllFieldParameters.singletonSlot, + AllFieldHistory.stageCWeight] <;> ring + funext a + have hr : (wordPopulation w a : ℝ) = + (n : ℝ) * (AllFieldParameters.littleLaw t u i a : ℝ) := by + exact_mod_cast hcount a + have hn' : (n : ℝ) ≠ 0 := by exact_mod_cast (ne_of_gt hn) + rw [InheritedMasks.empiricalLaw, hr, hcard] + exact mul_div_cancel_left₀ _ hn' + +theorem typeWindow_of_placed_side_weights (counts : Fin 4 → ℕ) + (t u : AllFieldParameters.Shape) (hu : u ∈ AllFieldParameters.shapes 4) + (hpos : AllFieldParameters.positive u = true) (n : ℕ) (hn : 0 < n) + (hc : ∀ b, (counts b : ℚ) = (n : ℚ) * AllFieldHistory.stageCWeight t u b) + (phi : Equiv.Perm (Fin 3)) (i : Fin 3) (w : Positions counts → Word) + (hweights : ∀ p, + CWLeafStatistics.weight (w p 0) = + branchAtom (AllFieldHistory.stageCDistinguished u) p.1 (phi.symm i) ∧ + CWLeafStatistics.weight (w p 1) = + shape (AllFieldHistory.stageCDistinguished u) (phi.symm i) - + branchAtom (AllFieldHistory.stageCDistinguished u) p.1 (phi.symm i)) + (η : ℝ) (hη : 0 ≤ η) : + InheritedMasks.typeWindow + (fun a : Fin 6 => (AllFieldParameters.littleLaw t u (phi.symm i) a : ℝ)) η + (fun p => CWCompleteStatistics.twoStatistic (w p)) := by + have he := empiricalLaw_eq_littleLaw counts t u hu hpos n hn hc (phi.symm i) + (fun p => CWCompleteStatistics.twoStatistic (w p)) (fun p => + twoStatistic_of_side_weights _ _ _ _ (hweights p).1 (hweights p).2) + intro a + rw [he] + simpa only [sub_self, abs_zero] using hη + +theorem placedChildProducts_support_typeWindow (F : Type*) [CommRing F] + (counts : Fin 4 → ℕ) (t u : AllFieldParameters.Shape) + (hu : u ∈ AllFieldParameters.shapes 4) (hpos : AllFieldParameters.positive u = true) + (n : ℕ) (hn : 0 < n) + (hc : ∀ b, (counts b : ℚ) = (n : ℚ) * AllFieldHistory.stageCWeight t u b) + (phi : Equiv.Perm (Fin 3)) (x y z : Positions counts → ChildPair) + (hne : placedChildProducts F (AllFieldHistory.stageCDistinguished u) phi counts x y z ≠ 0) + (i : Fin 3) (η : ℝ) (hη : 0 ≤ η) : + InheritedMasks.typeWindow + (fun a : Fin 6 => (AllFieldParameters.littleLaw t u (phi.symm i) a : ℝ)) η + (fun p => CWCompleteStatistics.twoStatistic (joinChildren ((Matrix.vecCons (x p) (Matrix.vecCons (y p) (Matrix.vecCons (z p) Matrix.vecEmpty))) i))) := by + apply typeWindow_of_placed_side_weights counts t u hu hpos n hn hc phi i + (fun p => joinChildren ((Matrix.vecCons (x p) (Matrix.vecCons (y p) (Matrix.vecCons (z p) Matrix.vecEmpty))) i)) _ η hη + intro p + exact placedChildProducts_side_weights F _ phi counts x y z hne p i + +theorem placedShapeChildProducts_support_typeWindow (F : Type*) [CommRing F] + (counts : Fin 4 → ℕ) (t u : AllFieldParameters.Shape) + (hu : u ∈ AllFieldParameters.shapes 4) (hpos : AllFieldParameters.positive u = true) + (n : ℕ) (hn : 0 < n) + (hc : ∀ b, (counts b : ℚ) = (n : ℚ) * AllFieldHistory.stageCWeight t u b) + (phi : Equiv.Perm (Fin 3)) (x y z : Positions counts → ChildWords) + (hne : placedShapeChildProducts F (AllFieldHistory.stageCDistinguished u) + phi counts x y z ≠ 0) + (i : Fin 3) (η : ℝ) (hη : 0 ≤ η) : + InheritedMasks.typeWindow + (fun a : Fin 6 => (AllFieldParameters.littleLaw t u (phi.symm i) a : ℝ)) η + (fun p => CWCompleteStatistics.twoStatistic + (joinChildren (collapseChildWords ((Matrix.vecCons (x p) (Matrix.vecCons (y p) (Matrix.vecCons (z p) Matrix.vecEmpty))) i)))) := by + have hcollapse : placedChildProducts F (AllFieldHistory.stageCDistinguished u) + phi counts (collapseChildWords ∘ x) (collapseChildWords ∘ y) + (collapseChildWords ∘ z) ≠ 0 := by + rw [placedShapeChildProducts_collapse] + exact hne + have hwindow := placedChildProducts_support_typeWindow F counts t u hu hpos n hn hc + phi (collapseChildWords ∘ x) (collapseChildWords ∘ y) (collapseChildWords ∘ z) + hcollapse i η hη + fin_cases i <;> exact hwindow + +end MatrixMultiplication.CWStageCProducts + +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/Tensors/CWStrandCompatibility.lean b/lean/OAI/LinearAlgebra/MatrixFields/Tensors/CWStrandCompatibility.lean new file mode 100644 index 0000000000000000000000000000000000000000..873ab309f9c7925cd9ba6f51492e21a3ddb1007b --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/Tensors/CWStrandCompatibility.lean @@ -0,0 +1,94 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Tensors.CWCompleteStatistics + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section + +namespace MatrixMultiplication.CWStrandCompatibility + +open MatrixMultiplication.Foundation CWStrands CWCompatibilityTransfer InheritedMasks +open scoped BigOperators + +variable {F : Type*} [CommRing F] + +theorem shape_nonzero_power {n : ℕ} (g : Fin 3 → ℕ) + (x y z : Fin n → Fin 7) (h : shapeTensor (F := F) (Fin n) g x y z ≠ 0) : + Tensor.power (FieldCW.tensor F 5) n x y z ≠ 0 := by + have hm := shapeTensor_support g x y z h + simpa only [shapeTensor, ite_eq_left hm, strand, Tensor.power] using h + +section Classes + +variable {P A : Type*} [Fintype P] [DecidableEq P] + [Fintype A] [DecidableEq A] {n : ℕ} + (g : P → Fin 3 → ℕ) (x y z : P → (Fin n → Fin 7)) + (h : (∏ i, shapeTensor (F := F) (Fin n) (g i) (x i) (y i) (z i)) ≠ 0) + (statistic : (Fin n → Fin 7) → A) (κ : A ≃ A) + (hstatistic : ∀ w, statistic (wordComplement w) = κ (statistic w)) + (ν : A → ℝ) (η : ℝ) + +include h + +omit [DecidableEq P] in +theorem class_coefficient_nonzero (i : P) : + shapeTensor (F := F) (Fin n) (g i) (x i) (y i) (z i) ≠ 0 := by + intro hi + exact h (Finset.prod_eq_zero (Finset.mem_univ i) hi) + +include hstatistic + +theorem zeroZ_transfer (hg : ∀ i, g i 2 = 0) + (hx : typeWindow ν η (fun i => statistic (x i))) : + typeWindow (ν ∘ κ.symm) η (fun i => statistic (y i)) := by + apply transfer_window statistic κ hstatistic x y _ ν η hx + intro i + have hi := class_coefficient_nonzero g x y z h i + have hm := shapeTensor_support (g i) (x i) (y i) (z i) hi + have hz : wordWeight (z i) = 0 := by + change weight (z i) = 0 + exact hm.2.2.trans (hg i) + exact zeroZ_word_match (x i) (y i) (z i) + (shape_nonzero_power (g i) (x i) (y i) (z i) hi) hz + +theorem zeroY_transfer (hg : ∀ i, g i 1 = 0) + (hx : typeWindow ν η (fun i => statistic (x i))) : + typeWindow (ν ∘ κ.symm) η (fun i => statistic (z i)) := by + apply transfer_window statistic κ hstatistic x z _ ν η hx + intro i + have hi := class_coefficient_nonzero g x y z h i + have hm := shapeTensor_support (g i) (x i) (y i) (z i) hi + have hy : wordWeight (y i) = 0 := by + change weight (y i) = 0 + exact hm.2.1.trans (hg i) + exact zeroY_word_match (x i) (y i) (z i) + (shape_nonzero_power (g i) (x i) (y i) (z i) hi) hy + +theorem zeroX_transfer (hg : ∀ i, g i 0 = 0) + (hy : typeWindow ν η (fun i => statistic (y i))) : + typeWindow (ν ∘ κ.symm) η (fun i => statistic (z i)) := by + apply transfer_window statistic κ hstatistic y z _ ν η hy + intro i + have hi := class_coefficient_nonzero g x y z h i + have hm := shapeTensor_support (g i) (x i) (y i) (z i) hi + have hx : wordWeight (x i) = 0 := by + change weight (x i) = 0 + exact hm.1.trans (hg i) + exact zeroX_word_match (x i) (y i) (z i) + (shape_nonzero_power (g i) (x i) (y i) (z i) hi) hx + +end Classes + +end MatrixMultiplication.CWStrandCompatibility + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/Tensors/CWWordDimensionParameters.lean b/lean/OAI/LinearAlgebra/MatrixFields/Tensors/CWWordDimensionParameters.lean new file mode 100644 index 0000000000000000000000000000000000000000..17083eb9bd41388b0aab321c065e55b7cea4f130 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/Tensors/CWWordDimensionParameters.lean @@ -0,0 +1,120 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Parameters.ParametersContractions +import OAI.LinearAlgebra.MatrixFields.Tensors.CWCompleteStatistics + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +noncomputable section + +namespace MatrixMultiplication.CWWordDimensions + +open scoped BigOperators Polynomial +open CWStrands + +attribute [local instance] Classical.propDecidable + +def sitePolynomial : Polynomial ℕ := 1 + Polynomial.C 5 * Polynomial.X + Polynomial.X ^ 2 + +theorem site_enumerator : + (∑ a : Fin 7, (Polynomial.X : Polynomial ℕ) ^ CWLeafStatistics.weight a) = + sitePolynomial := by + norm_num [Fin.sum_univ_succ, CWLeafStatistics.weight, sitePolynomial] + ring + +theorem word_enumerator (P : Type*) [Fintype P] : + (∑ w : P → Fin 7, (Polynomial.X : Polynomial ℕ) ^ weight w) = + sitePolynomial ^ Fintype.card P := by + classical + calc + (∑ w : P → Fin 7, (Polynomial.X : Polynomial ℕ) ^ weight w) = + ∑ w : P → Fin 7, ∏ i, (Polynomial.X : Polynomial ℕ) ^ + CWLeafStatistics.weight (w i) := by + apply Finset.sum_congr rfl + intro w _ + exact (Finset.prod_pow_eq_pow_sum Finset.univ + (fun i => CWLeafStatistics.weight (w i)) Polynomial.X).symm + _ = ∏ _i : P, ∑ a : Fin 7, (Polynomial.X : Polynomial ℕ) ^ + CWLeafStatistics.weight a := + (Fintype.prod_sum (fun (_i : P) (a : Fin 7) => + (Polynomial.X : Polynomial ℕ) ^ CWLeafStatistics.weight a)).symm + _ = sitePolynomial ^ Fintype.card P := by simp only [site_enumerator, Finset.prod_const, + Finset.card_univ] + +abbrev WeightWords (P : Type*) [Fintype P] (j : ℕ) := {w : P → Fin 7 // weight w = j} + +theorem card_weightWords (P : Type*) [Fintype P] (j : ℕ) : + Fintype.card (WeightWords P j) = (sitePolynomial ^ Fintype.card P).coeff j := by + classical + rw [← word_enumerator] + simp [WeightWords, Fintype.card_subtype, + Polynomial.coeff_X_pow, eq_comm] + +def recursiveCoeff : ℕ → ℕ → ℕ + | 0, j => if j = 0 then 1 else 0 + | n + 1, j => recursiveCoeff n j + + 5 * (if 1 ≤ j then recursiveCoeff n (j - 1) else 0) + + (if 2 ≤ j then recursiveCoeff n (j - 2) else 0) + +theorem coeff_eq_recursive (n j : ℕ) : + (sitePolynomial ^ n).coeff j = recursiveCoeff n j := by + induction n generalizing j with + | zero => simp [recursiveCoeff, Polynomial.coeff_one] + | succ n ih => + have hmul (p : Polynomial ℕ) : sitePolynomial * p = + p + Polynomial.C 5 * (Polynomial.X * p) + Polynomial.X ^ 2 * p := by + simp only [sitePolynomial, add_mul, one_mul, mul_assoc] + have hshift := Polynomial.coeff_X_pow_mul' (sitePolynomial ^ n) 1 j + simp only [pow_one] at hshift + rw [pow_succ', hmul, Polynomial.coeff_add, Polynomial.coeff_add, + Polynomial.coeff_C_mul, hshift, Polynomial.coeff_X_pow_mul'] + simp only [ih, recursiveCoeff] + +theorem card_weightWords_fin (n j : ℕ) : + Fintype.card (WeightWords (Fin n) j) = recursiveCoeff n j := by + have h := card_weightWords (Fin n) j + simp only [Fintype.card_fin, coeff_eq_recursive] at h + rw [Fintype.card_eq_nat_card] at h ⊢ + exact h + +end MatrixMultiplication.CWWordDimensions + +end + +namespace MatrixMultiplication.CWWordDimensionParameters + +open CWWordDimensions AllFieldParameters.Contractions + +theorem table_eq_recursive : ∀ j : Fin 17, + (coefficients[j.val]?.getD 0) = recursiveCoeff 8 j.val := by + decide +kernel + +theorem table_eq_polynomial (j : Fin 17) : + (coefficients[j.val]?.getD 0) = (sitePolynomial ^ 8).coeff j.val := by + rw [coeff_eq_recursive, table_eq_recursive] + +theorem table_eq_card (j : Fin 17) : + (coefficients[j.val]?.getD 0) = + Fintype.card (WeightWords (Fin 8) j.val) := by + have h := card_weightWords_fin 8 j.val + rw [Fintype.card_eq_nat_card] at h ⊢ + exact (table_eq_recursive j).trans h.symm + +theorem table_positive : ∀ j : Fin 17, 0 < (coefficients[j.val]?.getD 0) := by + decide +kernel + +theorem word_card_positive (j : Fin 17) : + 0 < Fintype.card (WeightWords (Fin 8) j.val) := by + have h := table_eq_card j + rw [Fintype.card_eq_nat_card] at h ⊢ + rw [← h] + exact table_positive j + +end MatrixMultiplication.CWWordDimensionParameters + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/Tensors/CWZeroGeometry.lean b/lean/OAI/LinearAlgebra/MatrixFields/Tensors/CWZeroGeometry.lean new file mode 100644 index 0000000000000000000000000000000000000000..c7220bd3b7632762e819b528689722dd9cb917e1 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/Tensors/CWZeroGeometry.lean @@ -0,0 +1,293 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Construction.InitialState + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section +namespace MatrixMultiplication.CWOrientedZero +open MatrixMultiplication.Foundation CWWindowedLeaves CWStrands AllFieldFiniteFamily +open scoped BigOperators +attribute [local instance] Classical.propDecidable + +variable (F : Type*) [Field F] + +private theorem tensor_swapXY_inline_MatrixMultiplication_CWOrientedZero (x y z : Fin 7) : + FieldCW.tensor F 5 x y z = FieldCW.tensor F 5 y x z := by + unfold FieldCW.tensor + simp only [Finset.sum_add_distrib, mul_comm, mul_left_comm, mul_assoc] + ring + +private theorem tensor_swapYZ_inline_MatrixMultiplication_CWOrientedZero (x y z : Fin 7) : + FieldCW.tensor F 5 x y z = FieldCW.tensor F 5 x z y := by + exact (FieldCW.tensor_cyclic F 5 x y z).trans + ((tensor_swapXY_inline_MatrixMultiplication_CWOrientedZero F y z x).trans (FieldCW.tensor_cyclic F 5 x z y).symm) + +private theorem tensor_swapXZ_inline_MatrixMultiplication_CWOrientedZero (x y z : Fin 7) : + FieldCW.tensor F 5 x y z = FieldCW.tensor F 5 z y x := by + exact (FieldCW.tensor_cyclic F 5 x y z).trans (tensor_swapXY_inline_MatrixMultiplication_CWOrientedZero F y z x) + +private theorem shape_swapXY (n a b c : ℕ) (x y z : Raw n) : + shapeTensor (F := F) (Fin n) (Matrix.vecCons (a) (Matrix.vecCons (b) (Matrix.vecCons (c) Matrix.vecEmpty))) x y z = + shapeTensor (F := F) (Fin n) (Matrix.vecCons (b) (Matrix.vecCons (a) (Matrix.vecCons (c) Matrix.vecEmpty))) y x z := by + have hp : strand (F := F) (Fin n) x y z = strand (F := F) (Fin n) y x z := by + apply Finset.prod_congr rfl + intro i _ + exact tensor_swapXY_inline_MatrixMultiplication_CWOrientedZero F _ _ _ + simp only [shapeTensor, Matrix.cons_val_zero, Matrix.cons_val_one, + Matrix.cons_val, hp] + congr 1 + apply propext + tauto + +private theorem shape_swapYZ (n a b c : ℕ) (x y z : Raw n) : + shapeTensor (F := F) (Fin n) (Matrix.vecCons (a) (Matrix.vecCons (b) (Matrix.vecCons (c) Matrix.vecEmpty))) x y z = + shapeTensor (F := F) (Fin n) (Matrix.vecCons (a) (Matrix.vecCons (c) (Matrix.vecCons (b) Matrix.vecEmpty))) x z y := by + have hp : strand (F := F) (Fin n) x y z = strand (F := F) (Fin n) x z y := by + apply Finset.prod_congr rfl + intro i _ + exact tensor_swapYZ_inline_MatrixMultiplication_CWOrientedZero F _ _ _ + simp only [shapeTensor, Matrix.cons_val_zero, Matrix.cons_val_one, + Matrix.cons_val, hp] + congr 1 + apply propext + tauto + +private theorem shape_swapXZ (n a b c : ℕ) (x y z : Raw n) : + shapeTensor (F := F) (Fin n) (Matrix.vecCons (a) (Matrix.vecCons (b) (Matrix.vecCons (c) Matrix.vecEmpty))) x y z = + shapeTensor (F := F) (Fin n) (Matrix.vecCons (c) (Matrix.vecCons (b) (Matrix.vecCons (a) Matrix.vecEmpty))) z y x := by + rw [shape_swapXY, shape_swapYZ, shape_swapXY] + +def placedShape (zero selected : Fin 3) (a b : ℕ) : Fin 3 → ℕ := + fun s => if s = zero then 0 else if s = selected then a else b + +def sideWord (zero selected : Fin 3) {n a : ℕ} (side : Fin 3) + (w : Alphabet n a) : Raw n := + if side = zero then zeroWord n else if side = selected then w.val else complementWord w.val + +def matched (zero : Fin 3) {E : Type*} (x y z : E) : Prop := + if zero = 0 then y = z else if zero = 1 then x = z else x = y + +theorem local_coefficient (n a b : ℕ) (hab : a + b = 2*n) + (zero selected : Fin 3) (hne : zero ≠ selected) (x y z : Alphabet n a) : + shapeTensor (F := F) (Fin n) (placedShape zero selected a b) + (sideWord zero selected 0 x) (sideWord zero selected 1 y) + (sideWord zero selected 2 z) = if matched zero x y z then 1 else 0 := by + have shape_eq : placedShape zero selected a b = + ![placedShape zero selected a b 0, placedShape zero selected a b 1, + placedShape zero selected a b 2] := by + ext side + fin_cases side <;> rfl + rw [shape_eq] + fin_cases zero <;> fin_cases selected + all_goals try contradiction + · simpa [placedShape, sideWord, matched] using zeroX_local F n a b hab y z + · have hh := (shape_swapYZ F n 0 b a (zeroWord n) (complementWord y.val) z.val).trans + (zeroX_local F n a b hab z y) + have he : (z = y) ↔ (y = z) := eq_comm + simpa [placedShape, sideWord, matched, he] using hh + · simpa [placedShape, sideWord, matched] using zeroY_local F n a b hab x z + · have hh := (shape_swapXZ F n b 0 a (complementWord x.val) (zeroWord n) z.val).trans + (zeroY_local F n a b hab z x) + have he : (z = x) ↔ (x = z) := eq_comm + simpa [placedShape, sideWord, matched, he] using hh + · simpa [placedShape, sideWord, matched] using zeroZ_local F n a b hab x y + · have hh := (shape_swapXY F n b a 0 (complementWord x.val) y.val (zeroWord n)).trans + (zeroZ_local F n a b hab y x) + have he : (y = x) ↔ (x = y) := eq_comm + simpa [placedShape, sideWord, matched, he] using hh + +def Row (zero : Fin 3) (E : Type) : Type := if zero = 1 then E else Unit +def Middle (zero : Fin 3) (E : Type) : Type := if zero = 2 then E else Unit +def Column (zero : Fin 3) (E : Type) : Type := if zero = 0 then E else Unit +instance (zero : Fin 3) (E : Type) [Fintype E] : Fintype (Row zero E) := by + unfold Row; split_ifs <;> infer_instance +instance (zero : Fin 3) (E : Type) [Fintype E] : Fintype (Middle zero E) := by + unfold Middle; split_ifs <;> infer_instance +instance (zero : Fin 3) (E : Type) [Fintype E] : Fintype (Column zero E) := by + unfold Column; split_ifs <;> infer_instance + +theorem volume (zero : Fin 3) (E : Type) [Fintype E] : + Fintype.card (Row zero E) * Fintype.card (Middle zero E) * + Fintype.card (Column zero E) = Fintype.card E := by + fin_cases zero + · change Fintype.card Unit * Fintype.card Unit * Fintype.card E = Fintype.card E + simp + · change Fintype.card E * Fintype.card Unit * Fintype.card Unit = Fintype.card E + simp + · change Fintype.card Unit * Fintype.card E * Fintype.card Unit = Fintype.card E + simp + +theorem matching_nonempty {V E : Type} [Fintype V] [Fintype E] [Nonempty E] + (Q : Tensor F V V V) (zero : Fin 3) (embed : Fin 3 → E → V) + (h : ∀ x y z, Q (embed 0 x) (embed 1 y) (embed 2 z) = + if matched zero x y z then 1 else 0) : + Nonempty (LocalMap Q (Tensor.matrixCoefficients (Row zero E) (Middle zero E) (Column zero E))) := by + let e : E := Classical.choice inferInstance + fin_cases zero + · refine ⟨LocalMap.ofExists ⟨(fun _ v => if v = embed 0 e then 1 else 0), + (fun y v => if v = embed 1 y.2 then 1 else 0), + (fun z v => if v = embed 2 z.1 then 1 else 0), ?_⟩⟩ + rw [← Tensor.pullback_eq_restrict] + funext x y z + let sm0 : Subsingleton (Middle (0 : Fin 3) E) := by simp only [Middle, show (0 : Fin 3) ≠ 2 from by decide, ite_false]; infer_instance + let sr0 : Subsingleton (Row (0 : Fin 3) E) := by simp only [Row, show (0 : Fin 3) ≠ 1 from by decide, ite_false]; infer_instance + have hu1 : x.2 = y.1 := @Subsingleton.elim _ sm0 _ _ + have hu2 : z.2 = x.1 := @Subsingleton.elim _ sr0 _ _ + simpa [Tensor.pullback, Tensor.matrixCoefficients, matched, Row, Middle, Column, hu1, hu2] using + h e y.2 z.1 + · refine ⟨LocalMap.ofExists ⟨(fun x v => if v = embed 0 x.1 then 1 else 0), + (fun _ v => if v = embed 1 e then 1 else 0), + (fun z v => if v = embed 2 z.2 then 1 else 0), ?_⟩⟩ + rw [← Tensor.pullback_eq_restrict] + funext x y z + let sm1 : Subsingleton (Middle (1 : Fin 3) E) := by simp only [Middle, show (1 : Fin 3) ≠ 2 from by decide, ite_false]; infer_instance + let sc1 : Subsingleton (Column (1 : Fin 3) E) := by simp only [Column, show (1 : Fin 3) ≠ 0 from by decide, ite_false]; infer_instance + have hu1 : x.2 = y.1 := @Subsingleton.elim _ sm1 _ _ + have hu2 : y.2 = z.1 := @Subsingleton.elim _ sc1 _ _ + simpa [Tensor.pullback, Tensor.matrixCoefficients, matched, Row, Middle, Column, hu1, hu2, eq_comm] using + h x.1 e z.2 + · refine ⟨LocalMap.ofExists ⟨(fun x v => if v = embed 0 x.2 then 1 else 0), + (fun y v => if v = embed 1 y.1 then 1 else 0), + (fun _ v => if v = embed 2 e then 1 else 0), ?_⟩⟩ + rw [← Tensor.pullback_eq_restrict] + funext x y z + let sc2 : Subsingleton (Column (2 : Fin 3) E) := by simp only [Column, show (2 : Fin 3) ≠ 0 from by decide, ite_false]; infer_instance + let sr2 : Subsingleton (Row (2 : Fin 3) E) := by simp only [Row, show (2 : Fin 3) ≠ 1 from by decide, ite_false]; infer_instance + have hu1 : y.2 = z.1 := @Subsingleton.elim _ sc2 _ _ + have hu2 : z.2 = x.1 := @Subsingleton.elim _ sr2 _ _ + simpa [Tensor.pullback, Tensor.matrixCoefficients, matched, Row, Middle, Column, hu1, hu2] using + h x.2 y.1 e + +def ofMatching {V E : Type} [Fintype V] [Fintype E] [Nonempty E] + (Q : Tensor F V V V) (zero : Fin 3) (embed : Fin 3 → E → V) + (h : ∀ x y z, Q (embed 0 x) (embed 1 y) (embed 2 z) = + if matched zero x y z then 1 else 0) : + LocalMap Q (Tensor.matrixCoefficients (Row zero E) (Middle zero E) (Column zero E)) := + Classical.choice (matching_nonempty F Q zero embed h) + +theorem power_coefficient {E : Type} (n a b m : ℕ) (hab : a+b=2*n) + (zero selected : Fin 3) (hne : zero ≠ selected) + (words : E → Fin m → Alphabet n a) (hinj : Function.Injective words) + (x y z : E) : + Tensor.power (shapeTensor (F := F) (Fin n) (placedShape zero selected a b)) m + (fun i => sideWord zero selected 0 (words x i)) + (fun i => sideWord zero selected 1 (words y i)) + (fun i => sideWord zero selected 2 (words z i)) = + if matched zero x y z then 1 else 0 := by + simp only [Tensor.power, local_coefficient F n a b hab zero selected hne] + fin_cases zero <;> simp [matched, Fintype.prod_boole, ← funext_iff, hinj.eq_iff] + +end MatrixMultiplication.CWOrientedZero + +end +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +namespace MatrixMultiplication.CWZeroGeometry + +open AllFieldParameters AllFieldHistory CWOrientedZero + +def zeroAxis (g : Shape) : Fin 3 := + if g 0 = 0 then 0 else if g 1 = 0 then 1 else 2 + +def maxAxis (g : Shape) : Fin 3 := + if g 0 = shapeMax g then 0 else if g 1 = shapeMax g then 1 else 2 + +theorem zeroAxis_spec (g : Shape) (hz : ∃ i, g i = 0) : g (zeroAxis g) = 0 := by + unfold zeroAxis + split_ifs with h0 h1 + · exact h0 + · exact h1 + · obtain ⟨i, hi⟩ := hz + fin_cases i <;> simp_all + +theorem maxAxis_spec (g : Shape) : g (maxAxis g) = shapeMax g := by + have hm : shapeMax g = g 0 ∨ shapeMax g = g 1 ∨ shapeMax g = g 2 := by + unfold shapeMax + rcases le_total (g 0) (max (g 1) (g 2)) with h | h + · rw [max_eq_right h] + rcases le_total (g 1) (g 2) with h | h + · exact Or.inr (Or.inr (max_eq_right h)) + · exact Or.inr (Or.inl (max_eq_left h)) + · exact Or.inl (max_eq_left h) + unfold maxAxis + split_ifs with h0 h1 + · exact h0 + · exact h1 + · rcases hm with hm | hm | hm + · exact (h0 hm.symm).elim + · exact (h1 hm.symm).elim + · exact hm.symm + +theorem shapeMax_le_total (g : Shape) : shapeMax g ≤ shapeTotal g := by + exact max_le (coordinate_le_total g 0) + (max_le (coordinate_le_total g 1) (coordinate_le_total g 2)) + +theorem shapeMax_pos (g : Shape) (ht : 0 < shapeTotal g) : 0 < shapeMax g := by + have h0 : g 0 ≤ shapeMax g := le_max_left _ _ + have h1 : g 1 ≤ shapeMax g := (le_max_left _ _).trans (le_max_right _ _) + have h2 : g 2 ≤ shapeMax g := (le_max_right _ _).trans (le_max_right _ _) + unfold shapeTotal at ht + omega + +theorem zero_ne_selected (g : Shape) (zero selected : Fin 3) + (ht : 0 < shapeTotal g) (hz : g zero = 0) (hs : g selected = shapeMax g) : + zero ≠ selected := by + intro he + have hp := shapeMax_pos g ht + rw [← he, hz] at hs + omega + +theorem max_add_complement (g : Shape) : + shapeMax g + (shapeTotal g - shapeMax g) = shapeTotal g := + Nat.add_sub_of_le (shapeMax_le_total g) + +theorem eq_placedShape (g : Shape) (zero selected : Fin 3) + (hz : g zero = 0) (hs : g selected = shapeMax g) (hne : zero ≠ selected) : + g = placedShape zero selected (shapeMax g) (shapeTotal g - shapeMax g) := by + funext side + fin_cases zero <;> fin_cases selected + all_goals try contradiction + all_goals fin_cases side <;> + simp_all [placedShape, shapeTotal] + +theorem physicalShape_eq_placedShape (g : Shape) (phi : Equiv.Perm (Fin 3)) + (zero selected : Fin 3) (hz : g zero = 0) + (hs : g selected = shapeMax g) (hne : zero ≠ selected) : + physicalShape phi g = placedShape (phi zero) (phi selected) + (shapeMax g) (shapeTotal g - shapeMax g) := by + funext side + calc + physicalShape phi g side = + placedShape zero selected (shapeMax g) (shapeTotal g - shapeMax g) + (phi.symm side) := congrFun (eq_placedShape g zero selected hz hs hne) _ + _ = _ := by simp only [placedShape, Equiv.symm_apply_eq] + +theorem selected_add_remaining (g : Shape) (zero selected side : Fin 3) + (hz : g zero = 0) (hs : g selected = shapeMax g) (hne : zero ≠ selected) + (hzs : side ≠ zero) (hss : side ≠ selected) : + g selected + g side = shapeTotal g := by + have hside : g side = shapeTotal g - shapeMax g := by + rw [congrFun (eq_placedShape g zero selected hz hs hne) side] + simp only [placedShape, ite_eq_right hzs, ite_eq_right hss] + rw [hs, hside] + exact max_add_complement g + +end MatrixMultiplication.CWZeroGeometry + +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/Tensors/ComplexDotPairing.lean b/lean/OAI/LinearAlgebra/MatrixFields/Tensors/ComplexDotPairing.lean new file mode 100644 index 0000000000000000000000000000000000000000..6534e75fd1d8014da55dfdbbe55d2cc0eacd10be --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/Tensors/ComplexDotPairing.lean @@ -0,0 +1,778 @@ +import Mathlib + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +open scoped BigOperators + +namespace MatrixMultiplication.Foundation + +abbrev Tensor (K X Y Z : Type*) := X → Y → Z → K + +namespace Tensor + +section Algebra + +variable {K X Y Z X' Y' Z' : Type*} [CommSemiring K] + +def rankOne (a : X → K) (b : Y → K) (c : Z → K) : Tensor K X Y Z := + fun x y z => a x * b y * c z + +def RankAtMost (T : Tensor K X Y Z) (r : ℕ) : Prop := + ∃ (a : Fin r → X → K) (b : Fin r → Y → K) (c : Fin r → Z → K), + T = fun x y z => ∑ i, rankOne (a i) (b i) (c i) x y z + +def restrict [Fintype X] [Fintype Y] [Fintype Z] + (A : X' → X → K) (B : Y' → Y → K) (C : Z' → Z → K) + (T : Tensor K X Y Z) : Tensor K X' Y' Z' := + fun x' y' z' => ∑ x, ∑ y, ∑ z, + A x' x * B y' y * C z' z * T x y z + +def contract (T : Tensor K X Y Z) [Fintype X] [Fintype Y] + (a : X → K) (b : Y → K) : Z → K := + fun z => ∑ x, ∑ y, T x y z * a x * b y + +def product {U V W : Type*} (T : Tensor K X Y Z) (S : Tensor K U V W) : + Tensor K (X × U) (Y × V) (Z × W) := + fun x y z => T x.1 y.1 z.1 * S x.2 y.2 z.2 + +def directSum {ι : Type*} [DecidableEq ι] (T : ι → Tensor K X Y Z) : + Tensor K (ι × X) (ι × Y) (ι × Z) := + fun x y z => if x.1 = y.1 ∧ x.1 = z.1 then T x.1 x.2 y.2 z.2 else 0 + +def power (T : Tensor K X Y Z) (n : ℕ) : + Tensor K (Fin n → X) (Fin n → Y) (Fin n → Z) := + fun x y z => ∏ i, T (x i) (y i) (z i) + +@[simp] theorem directSum_matching {ι : Type*} [DecidableEq ι] + (T : ι → Tensor K X Y Z) (i : ι) (x : X) (y : Y) (z : Z) : + directSum T (i, x) (i, y) (i, z) = T i x y z := by + simp [directSum] + +theorem directSum_zero_of_left_ne {ι : Type*} [DecidableEq ι] + (T : ι → Tensor K X Y Z) (x : ι × X) (y : ι × Y) (z : ι × Z) + (h : x.1 ≠ y.1) : directSum T x y z = 0 := by + simp [directSum, h] + +@[simp] theorem rankAtMost_zero : RankAtMost (0 : Tensor K X Y Z) 0 := by + refine ⟨fun i => Fin.elim0 i, fun i => Fin.elim0 i, fun i => Fin.elim0 i, ?_⟩ + funext x y z + simp + +theorem rankOne_rankAtMost (a : X → K) (b : Y → K) (c : Z → K) : + RankAtMost (rankOne a b c) 1 := by + refine ⟨fun _ => a, fun _ => b, fun _ => c, ?_⟩ + funext x y z + simp + +theorem RankAtMost.map {L : Type*} [CommSemiring L] + (f : K →+* L) {T : Tensor K X Y Z} {r : ℕ} (h : RankAtMost T r) : + RankAtMost (fun x y z => f (T x y z)) r := by + rcases h with ⟨a, b, c, rfl⟩ + refine ⟨fun i x => f (a i x), fun i y => f (b i y), fun i z => f (c i z), ?_⟩ + funext x y z + simp [rankOne] + +theorem RankAtMost.scale {T : Tensor K X Y Z} {r : ℕ} + (h : RankAtMost T r) (u : K) : + RankAtMost (fun x y z => u * T x y z) r := by + rcases h with ⟨a, b, c, rfl⟩ + refine ⟨fun i x => u * a i x, b, c, ?_⟩ + funext x y z + simp [rankOne, Finset.mul_sum, mul_assoc] + +theorem rankAtMost_sum_rankOne {ι : Type*} [Fintype ι] + (a : ι → X → K) (b : ι → Y → K) (c : ι → Z → K) : + RankAtMost (fun x y z => ∑ i, rankOne (a i) (b i) (c i) x y z) + (Fintype.card ι) := by + classical + refine ⟨fun i => a ((Fintype.equivFin ι).symm i), + fun i => b ((Fintype.equivFin ι).symm i), + fun i => c ((Fintype.equivFin ι).symm i), ?_⟩ + funext x y z + exact ((Fintype.equivFin ι).symm.sum_comp + (fun i => rankOne (a i) (b i) (c i) x y z)).symm + +theorem RankAtMost.product {U V W : Type*} + {T : Tensor K X Y Z} {S : Tensor K U V W} {r s : ℕ} + (hT : RankAtMost T r) (hS : RankAtMost S s) : + RankAtMost (Tensor.product T S) (r * s) := by + rcases hT with ⟨a, b, c, rfl⟩ + rcases hS with ⟨d, e, f, rfl⟩ + let aa : (Fin r × Fin s) → (X × U) → K := fun i x => a i.1 x.1 * d i.2 x.2 + let bb : (Fin r × Fin s) → (Y × V) → K := fun i y => b i.1 y.1 * e i.2 y.2 + let cc : (Fin r × Fin s) → (Z × W) → K := fun i z => c i.1 z.1 * f i.2 z.2 + have heq : Tensor.product + (fun x y z => ∑ i, rankOne (a i) (b i) (c i) x y z) + (fun u v w => ∑ j, rankOne (d j) (e j) (f j) u v w) = + fun x y z => ∑ i, rankOne (aa i) (bb i) (cc i) x y z := by + funext x y z + simp only [Tensor.product, Fintype.sum_prod_type, Finset.sum_mul_sum] + apply Finset.sum_congr rfl + intro i hi + apply Finset.sum_congr rfl + intro j hj + dsimp [rankOne, aa, bb, cc] + ring + rw [heq] + simpa only [Fintype.card_prod, Fintype.card_fin] using rankAtMost_sum_rankOne aa bb cc + +theorem RankAtMost.power {T : Tensor K X Y Z} {r : ℕ} + (h : RankAtMost T r) (n : ℕ) : RankAtMost (Tensor.power T n) (r ^ n) := by + rcases h with ⟨a, b, c, rfl⟩ + let aa : (Fin n → Fin r) → (Fin n → X) → K := fun f x => ∏ i, a (f i) (x i) + let bb : (Fin n → Fin r) → (Fin n → Y) → K := fun f y => ∏ i, b (f i) (y i) + let cc : (Fin n → Fin r) → (Fin n → Z) → K := fun f z => ∏ i, c (f i) (z i) + have heq : Tensor.power (fun x y z => ∑ j, rankOne (a j) (b j) (c j) x y z) n = + fun x y z => ∑ f, rankOne (aa f) (bb f) (cc f) x y z := by + funext x y z + simp only [Tensor.power, Fintype.prod_sum] + apply Finset.sum_congr rfl + intro f hf + simp only [rankOne, aa, bb, cc, Finset.prod_mul_distrib] + rw [heq] + simpa only [Fintype.card_pi_const, Fintype.card_fin] using rankAtMost_sum_rankOne aa bb cc + +variable [Fintype X] [Fintype Y] [Fintype Z] + +theorem restrict_rankOne (A : X' → X → K) (B : Y' → Y → K) + (C : Z' → Z → K) (a : X → K) (b : Y → K) (c : Z → K) : + restrict A B C (rankOne a b c) = + rankOne (fun x' => ∑ x, A x' x * a x) + (fun y' => ∑ y, B y' y * b y) + (fun z' => ∑ z, C z' z * c z) := by + funext x' y' z' + simp only [restrict, rankOne] + conv_rhs => rw [mul_assoc, Finset.sum_mul_sum, Finset.sum_mul_sum] + simp only [Finset.mul_sum] + apply Finset.sum_congr rfl + intro x hx + apply Finset.sum_congr rfl + intro y hy + apply Finset.sum_congr rfl + intro z hz + ring + +theorem restrict_sum {ι : Type*} [Fintype ι] + (A : X' → X → K) (B : Y' → Y → K) (C : Z' → Z → K) + (T : ι → Tensor K X Y Z) : + restrict A B C (fun x y z => ∑ i, T i x y z) = + fun x' y' z' => ∑ i, restrict A B C (T i) x' y' z' := by + funext x' y' z' + simp only [restrict, Finset.mul_sum] + calc + (∑ x, ∑ y, ∑ z, ∑ i, A x' x * B y' y * C z' z * T i x y z) = + ∑ x, ∑ y, ∑ i, ∑ z, A x' x * B y' y * C z' z * T i x y z := by + apply Finset.sum_congr rfl + intro x hx + apply Finset.sum_congr rfl + intro y hy + exact Finset.sum_comm + _ = ∑ x, ∑ i, ∑ y, ∑ z, A x' x * B y' y * C z' z * T i x y z := by + apply Finset.sum_congr rfl + intro x hx + exact Finset.sum_comm + _ = ∑ i, ∑ x, ∑ y, ∑ z, A x' x * B y' y * C z' z * T i x y z := + Finset.sum_comm + +theorem RankAtMost.restrict {T : Tensor K X Y Z} {r : ℕ} + (h : RankAtMost T r) (A : X' → X → K) (B : Y' → Y → K) + (C : Z' → Z → K) : RankAtMost (Tensor.restrict A B C T) r := by + rcases h with ⟨a, b, c, rfl⟩ + refine ⟨fun i x' => ∑ x, A x' x * a i x, + fun i y' => ∑ y, B y' y * b i y, + fun i z' => ∑ z, C z' z * c i z, ?_⟩ + rw [restrict_sum] + funext x' y' z' + apply Finset.sum_congr rfl + intro i hi + exact congrFun (congrFun (congrFun (restrict_rankOne A B C (a i) (b i) (c i)) x') y') z' + +end Algebra + +section Pullback +variable {K X Y Z X' Y' Z' : Type*} [CommSemiring K] + +def pullback (fx : X' → X) (fy : Y' → Y) (fz : Z' → Z) + (T : Tensor K X Y Z) : Tensor K X' Y' Z' := + fun x y z => T (fx x) (fy y) (fz z) + +theorem pullback_eq_restrict [Fintype X] [Fintype Y] [Fintype Z] + [DecidableEq X] [DecidableEq Y] [DecidableEq Z] + (fx : X' → X) (fy : Y' → Y) (fz : Z' → Z) (T : Tensor K X Y Z) : + pullback fx fy fz T = restrict + (fun x' x => if x = fx x' then 1 else 0) + (fun y' y => if y = fy y' then 1 else 0) + (fun z' z => if z = fz z' then 1 else 0) T := by + classical + funext x y z + simp [pullback, restrict, ite_mul, mul_ite] + +theorem RankAtMost.pullback {T : Tensor K X Y Z} {r : ℕ} + (h : RankAtMost T r) (fx : X' → X) (fy : Y' → Y) (fz : Z' → Z) : + RankAtMost (pullback fx fy fz T) r := by + rcases h with ⟨a, b, c, rfl⟩ + exact ⟨fun i x => a i (fx x), fun i y => b i (fy y), + fun i z => c i (fz z), rfl⟩ + +end Pullback + +section ComplexTopology + +variable {X Y Z X' Y' Z' : Type*} + +def BorderRankAtMost [Fintype X] [Fintype Y] [Fintype Z] + (T : Tensor ℂ X Y Z) (r : ℕ) : Prop := + T ∈ closure {S | RankAtMost S r} + +def restrictionOrbit [Fintype X] [Fintype Y] [Fintype Z] + (T : Tensor ℂ X Y Z) : Set (Tensor ℂ X' Y' Z') := + {U | ∃ (A : X' → X → ℂ) (B : Y' → Y → ℂ) (C : Z' → Z → ℂ), + U = restrict A B C T} + +def DegeneratesTo [Fintype X] [Fintype Y] [Fintype Z] + [Fintype X'] [Fintype Y'] [Fintype Z'] + (T : Tensor ℂ X Y Z) (U : Tensor ℂ X' Y' Z') : Prop := + U ∈ closure (restrictionOrbit T) + +theorem RankAtMost.borderRankAtMost [Fintype X] [Fintype Y] [Fintype Z] + {T : Tensor ℂ X Y Z} {r : ℕ} (h : RankAtMost T r) : + BorderRankAtMost T r := subset_closure h + +theorem continuous_restrict [Fintype X] [Fintype Y] [Fintype Z] + (A : X' → X → ℂ) (B : Y' → Y → ℂ) (C : Z' → Z → ℂ) : + Continuous (Tensor.restrict A B C) := by + unfold restrict + fun_prop + +theorem BorderRankAtMost.restrict [Fintype X] [Fintype Y] [Fintype Z] + [Fintype X'] [Fintype Y'] [Fintype Z'] + {T : Tensor ℂ X Y Z} {r : ℕ} (h : BorderRankAtMost T r) + (A : X' → X → ℂ) (B : Y' → Y → ℂ) (C : Z' → Z → ℂ) : + BorderRankAtMost (Tensor.restrict A B C T) r := by + have hclosed : IsClosed {S : Tensor ℂ X Y Z | + BorderRankAtMost (Tensor.restrict A B C S) r} := + isClosed_closure.preimage (continuous_restrict A B C) + have hsubset : {S : Tensor ℂ X Y Z | RankAtMost S r} ⊆ + {S | BorderRankAtMost (Tensor.restrict A B C S) r} := by + intro S hS + exact (hS.restrict A B C).borderRankAtMost + exact closure_minimal hsubset hclosed h + +theorem continuous_product_left {U V W : Type*} (S : Tensor ℂ U V W) : + Continuous (fun T : Tensor ℂ X Y Z => Tensor.product T S) := by + unfold product + fun_prop + +theorem continuous_product_right {U V W : Type*} (T : Tensor ℂ X Y Z) : + Continuous (fun S : Tensor ℂ U V W => Tensor.product T S) := by + unfold product + fun_prop + +theorem BorderRankAtMost.product {U V W : Type*} + [Fintype X] [Fintype Y] [Fintype Z] [Fintype U] [Fintype V] [Fintype W] + {T : Tensor ℂ X Y Z} {S : Tensor ℂ U V W} {r s : ℕ} + (hT : BorderRankAtMost T r) (hS : BorderRankAtMost S s) : + BorderRankAtMost (Tensor.product T S) (r * s) := by + have hexact : ∀ T' : Tensor ℂ X Y Z, RankAtMost T' r → + BorderRankAtMost (Tensor.product T' S) (r * s) := by + intro T' hT' + have hclosed : IsClosed {S' : Tensor ℂ U V W | + BorderRankAtMost (Tensor.product T' S') (r * s)} := + isClosed_closure.preimage (continuous_product_right T') + have hsubset : {S' : Tensor ℂ U V W | RankAtMost S' s} ⊆ + {S' | BorderRankAtMost (Tensor.product T' S') (r * s)} := by + intro S' hS' + exact (hT'.product hS').borderRankAtMost + exact closure_minimal hsubset hclosed hS + have hclosed : IsClosed {T' : Tensor ℂ X Y Z | + BorderRankAtMost (Tensor.product T' S) (r * s)} := + isClosed_closure.preimage (continuous_product_left S) + exact closure_minimal hexact hclosed hT + +theorem BorderRankAtMost.of_degeneration [Fintype X] [Fintype Y] [Fintype Z] + [Fintype X'] [Fintype Y'] [Fintype Z'] + {T : Tensor ℂ X Y Z} {U : Tensor ℂ X' Y' Z'} {r : ℕ} + (hT : BorderRankAtMost T r) (hTU : DegeneratesTo T U) : + BorderRankAtMost U r := by + have hsubset : restrictionOrbit T ⊆ + {S : Tensor ℂ X' Y' Z' | BorderRankAtMost S r} := by + rintro S ⟨A, B, C, rfl⟩ + exact hT.restrict A B C + exact closure_minimal hsubset isClosed_closure hTU + +end ComplexTopology + +end Tensor +end MatrixMultiplication.Foundation + +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +open scoped BigOperators + +namespace MatrixMultiplication.Foundation +namespace Tensor + +variable {K X Y Z U V W : Type*} [CommSemiring K] + +def diagonal (ι : Type*) [DecidableEq ι] : Tensor K ι ι ι := + fun i j k => if i = j ∧ i = k then 1 else 0 + +theorem diagonal_rankAtMost (ι : Type*) [Fintype ι] [DecidableEq ι] : + RankAtMost (diagonal (K := K) ι) (Fintype.card ι) := by + let a : ι → ι → K := fun i j => if i = j then 1 else 0 + have heq : diagonal (K := K) ι = + fun x y z => ∑ i, rankOne (a i) (a i) (a i) x y z := by + funext x y z + simp [diagonal, rankOne, a, mul_ite, ite_and] + split_ifs <;> simp_all + rw [heq] + exact rankAtMost_sum_rankOne a a a + +theorem RankAtMost.repeat_batch {S : Tensor K U V W} {k r R B : ℕ} + (hbatch : RankAtMost (directSum (fun _ : Fin k => S)) r) (hfit : R ≤ B * k) : + RankAtMost (directSum (fun _ : Fin R => S)) (B * r) := by + classical + let f : Fin R → Fin B × Fin k := fun i => finProdFinEquiv.symm (Fin.castLE hfit i) + have hf : Function.Injective f := finProdFinEquiv.symm.injective.comp (Fin.castLE_injective hfit) + have hbig := (diagonal_rankAtMost (K := K) (Fin B)).product hbatch + simp only [Fintype.card_fin] at hbig + rcases hbig with ⟨a, b, c, heq⟩ + let liftU : (Fin R × U) → Fin B × (Fin k × U) := fun x => ((f x.1).1, (f x.1).2, x.2) + let liftV : (Fin R × V) → Fin B × (Fin k × V) := fun y => ((f y.1).1, (f y.1).2, y.2) + let liftW : (Fin R × W) → Fin B × (Fin k × W) := fun z => ((f z.1).1, (f z.1).2, z.2) + refine ⟨fun i x => a i (liftU x), fun i y => b i (liftV y), + fun i z => c i (liftW z), ?_⟩ + funext x y z + change directSum (fun _ : Fin R => S) x y z = + ∑ i, rankOne (a i) (b i) (c i) (liftU x) (liftV y) (liftW z) + have hentry := congrFun (congrFun (congrFun heq (liftU x)) (liftV y)) (liftW z) + rw [← hentry] + by_cases hxy : x.1 = y.1 + · by_cases hxz : x.1 = z.1 + · have hyz : y.1 = z.1 := hxy.symm.trans hxz + simp [directSum, Tensor.product, diagonal, liftU, liftV, liftW, hxy, hyz] + · have hn : f x.1 ≠ f z.1 := fun h => hxz (hf h) + have hs : (f x.1).1 ≠ (f z.1).1 ∨ (f x.1).2 ≠ (f z.1).2 := by + by_cases hfirst : (f x.1).1 = (f z.1).1 + · exact Or.inr (fun hsecond => hn (Prod.ext hfirst hsecond)) + · exact Or.inl hfirst + rcases hs with hs | hs <;> + simp [directSum, Tensor.product, diagonal, liftU, liftV, liftW, hxz, hs] + · have hn : f x.1 ≠ f y.1 := fun h => hxy (hf h) + have hs : (f x.1).1 ≠ (f y.1).1 ∨ (f x.1).2 ≠ (f y.1).2 := by + by_cases hfirst : (f x.1).1 = (f y.1).1 + · exact Or.inr (fun hsecond => hn (Prod.ext hfirst hsecond)) + · exact Or.inl hfirst + rcases hs with hs | hs <;> + simp [directSum, Tensor.product, diagonal, liftU, liftV, liftW, hxy, hs] + +theorem RankAtMost.batch_substitute [Fintype U] [Fintype V] [Fintype W] + {T : Tensor K X Y Z} {S : Tensor K U V W} {r b : ℕ} + (hT : RankAtMost T r) + (hbatch : RankAtMost (directSum (fun _ : Fin r => S)) b) : + RankAtMost (Tensor.product T S) b := by + classical + rcases hT with ⟨a, c, e, rfl⟩ + let A : (X × U) → (Fin r × U) → K := + fun x i => if x.2 = i.2 then a i.1 x.1 else 0 + let B : (Y × V) → (Fin r × V) → K := + fun y i => if y.2 = i.2 then c i.1 y.1 else 0 + let C : (Z × W) → (Fin r × W) → K := + fun z i => if z.2 = i.2 then e i.1 z.1 else 0 + have heq : Tensor.restrict A B C (directSum (fun _ : Fin r => S)) = + Tensor.product (fun x y z => ∑ i, rankOne (a i) (c i) (e i) x y z) S := by + funext x y z + simp [Tensor.restrict, directSum, Tensor.product, rankOne, A, B, C, + Fintype.sum_prod_type, ite_and, ite_mul, mul_ite, Finset.sum_mul] + rw [← heq] + exact hbatch.restrict A B C + +theorem RankAtMost.batch_product [Fintype U] [Fintype V] [Fintype W] + {T : Tensor K X Y Z} {S : Tensor K U V W} {R k r B : ℕ} + (hT : RankAtMost T R) + (hbatch : RankAtMost (directSum (fun _ : Fin k => S)) r) + (hfit : R ≤ B * k) : RankAtMost (Tensor.product T S) (B * r) := + hT.batch_substitute (hbatch.repeat_batch hfit) + +end Tensor +end MatrixMultiplication.Foundation + +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +open scoped BigOperators + +namespace MatrixMultiplication.Foundation +namespace Tensor + +section Algebra + +variable {K X Y Z X' Y' Z' X'' Y'' Z'' : Type*} [CommSemiring K] + +def composeRestrictionMatrix [Fintype X'] + (D : X'' → X' → K) (A : X' → X → K) : X'' → X → K := + fun x'' x => ∑ x', D x'' x' * A x' x + +private theorem sum_three_mul [Fintype X] [Fintype Y] [Fintype Z] + (a : X → K) (b : Y → K) (c : Z → K) (t : K) : + (∑ x, a x) * (∑ y, b y) * (∑ z, c z) * t = + ∑ x, ∑ y, ∑ z, a x * b y * c z * t := by + rw [Finset.sum_mul_sum] + simp_rw [Finset.sum_mul] + simp_rw [Finset.mul_sum] + simp_rw [Finset.sum_mul] + +private theorem sum_six_comm [Fintype X] [Fintype Y] [Fintype Z] + [Fintype X'] [Fintype Y'] [Fintype Z'] + (f : X' → Y' → Z' → X → Y → Z → K) : + (∑ x', ∑ y', ∑ z', ∑ x, ∑ y, ∑ z, f x' y' z' x y z) = + ∑ x, ∑ y, ∑ z, ∑ x', ∑ y', ∑ z', f x' y' z' x y z := by + calc + _ = ∑ p : X' × Y' × Z', ∑ q : X × Y × Z, + f p.1 p.2.1 p.2.2 q.1 q.2.1 q.2.2 := by + simp only [Fintype.sum_prod_type] + _ = ∑ q : X × Y × Z, ∑ p : X' × Y' × Z', + f p.1 p.2.1 p.2.2 q.1 q.2.1 q.2.2 := Finset.sum_comm + _ = _ := by simp only [Fintype.sum_prod_type] + +private theorem sum_interleaved_triples {U V W : Type*} + [Fintype X] [Fintype Y] [Fintype Z] [Fintype U] [Fintype V] [Fintype W] + (f : X → Y → Z → U → V → W → K) : + (∑ x, ∑ u, ∑ y, ∑ v, ∑ z, ∑ w, f x y z u v w) = + ∑ x, ∑ y, ∑ z, ∑ u, ∑ v, ∑ w, f x y z u v w := by + apply Finset.sum_congr rfl + intro x hx + calc + (∑ u, ∑ y, ∑ v, ∑ z, ∑ w, f x y z u v w) = + ∑ y, ∑ u, ∑ v, ∑ z, ∑ w, f x y z u v w := Finset.sum_comm + _ = _ := by + apply Finset.sum_congr rfl + intro y hy + calc + (∑ u, ∑ v, ∑ z, ∑ w, f x y z u v w) = + ∑ u, ∑ z, ∑ v, ∑ w, f x y z u v w := by + apply Finset.sum_congr rfl + intro u hu + exact Finset.sum_comm + _ = _ := Finset.sum_comm + +theorem restrict_restrict [Fintype X] [Fintype Y] [Fintype Z] + [Fintype X'] [Fintype Y'] [Fintype Z'] + (A : X' → X → K) (B : Y' → Y → K) (C : Z' → Z → K) + (D : X'' → X' → K) (E : Y'' → Y' → K) (F : Z'' → Z' → K) + (T : Tensor K X Y Z) : + restrict D E F (restrict A B C T) = + restrict (composeRestrictionMatrix D A) (composeRestrictionMatrix E B) + (composeRestrictionMatrix F C) T := by + funext x'' y'' z'' + unfold restrict composeRestrictionMatrix + calc + _ = ∑ x', ∑ y', ∑ z', ∑ x, ∑ y, ∑ z, + D x'' x' * E y'' y' * F z'' z' * + (A x' x * B y' y * C z' z * T x y z) := by + simp only [Finset.mul_sum] + _ = ∑ x, ∑ y, ∑ z, ∑ x', ∑ y', ∑ z', + D x'' x' * E y'' y' * F z'' z' * + (A x' x * B y' y * C z' z * T x y z) := sum_six_comm _ + _ = _ := by + apply Finset.sum_congr rfl + intro x hx + apply Finset.sum_congr rfl + intro y hy + apply Finset.sum_congr rfl + intro z hz + rw [sum_three_mul] + apply Finset.sum_congr rfl + intro x' hx' + apply Finset.sum_congr rfl + intro y' hy' + apply Finset.sum_congr rfl + intro z' hz' + ring + +theorem restrict_product {U V W U' V' W' : Type*} + [Fintype X] [Fintype Y] [Fintype Z] [Fintype U] [Fintype V] [Fintype W] + (A : X' → X → K) (B : Y' → Y → K) (C : Z' → Z → K) + (D : U' → U → K) (E : V' → V → K) (F : W' → W → K) + (T : Tensor K X Y Z) (S : Tensor K U V W) : + restrict (fun (x : X' × U') (u : X × U) => A x.1 u.1 * D x.2 u.2) + (fun (y : Y' × V') (v : Y × V) => B y.1 v.1 * E y.2 v.2) + (fun (z : Z' × W') (w : Z × W) => C z.1 w.1 * F z.2 w.2) (product T S) = + product (restrict A B C T) (restrict D E F S) := by + funext x' y' z' + simp only [restrict, product, Fintype.sum_prod_type] + calc + _ = ∑ x, ∑ y, ∑ z, ∑ u, ∑ v, ∑ w, + (A x'.1 x * D x'.2 u) * (B y'.1 y * E y'.2 v) * + (C z'.1 z * F z'.2 w) * (T x y z * S u v w) := + sum_interleaved_triples _ + _ = ∑ x, ∑ y, ∑ z, ∑ u, ∑ v, ∑ w, + (A x'.1 x * B y'.1 y * C z'.1 z * T x y z) * + (D x'.2 u * E y'.2 v * F z'.2 w * S u v w) := by + apply Finset.sum_congr rfl + intro x hx + apply Finset.sum_congr rfl + intro y hy + apply Finset.sum_congr rfl + intro z hz + apply Finset.sum_congr rfl + intro u hu + apply Finset.sum_congr rfl + intro v hv + apply Finset.sum_congr rfl + intro w hw + ring + _ = _ := by + simp_rw [Finset.sum_mul] + simp_rw [Finset.mul_sum] + +theorem restrict_identity [Fintype X] [Fintype Y] [Fintype Z] + [DecidableEq X] [DecidableEq Y] [DecidableEq Z] + (T : Tensor K X Y Z) : + restrict (fun x' x => if x = x' then 1 else 0) + (fun y' y => if y = y' then 1 else 0) + (fun z' z => if z = z' then 1 else 0) T = T := by + exact (pullback_eq_restrict id id id T).symm + +end Algebra + +section ComplexTopology + +variable {X Y Z X' Y' Z' X'' Y'' Z'' : Type*} +variable [Fintype X] [Fintype Y] [Fintype Z] +variable [Fintype X'] [Fintype Y'] [Fintype Z'] +variable [Fintype X''] [Fintype Y''] [Fintype Z''] + +theorem degeneratesTo_restrict (T : Tensor ℂ X Y Z) + (A : X' → X → ℂ) (B : Y' → Y → ℂ) (C : Z' → Z → ℂ) : + DegeneratesTo T (restrict A B C T) := + subset_closure ⟨A, B, C, rfl⟩ + +theorem DegeneratesTo.refl (T : Tensor ℂ X Y Z) : DegeneratesTo T T := by + classical + have h := degeneratesTo_restrict T + (fun x' x => if x = x' then 1 else 0) + (fun y' y => if y = y' then 1 else 0) + (fun z' z => if z = z' then 1 else 0) + simpa only [restrict_identity] using h + +omit [Fintype X''] [Fintype Y''] [Fintype Z''] in +theorem mem_restrictionOrbit_restrict {T : Tensor ℂ X Y Z} + {U : Tensor ℂ X' Y' Z'} (h : U ∈ restrictionOrbit T) + (D : X'' → X' → ℂ) (E : Y'' → Y' → ℂ) (F : Z'' → Z' → ℂ) : + restrict D E F U ∈ restrictionOrbit T := by + rcases h with ⟨A, B, C, rfl⟩ + exact ⟨composeRestrictionMatrix D A, composeRestrictionMatrix E B, + composeRestrictionMatrix F C, restrict_restrict A B C D E F T⟩ + +theorem DegeneratesTo.restrict {T : Tensor ℂ X Y Z} {U : Tensor ℂ X' Y' Z'} + (h : DegeneratesTo T U) + (D : X'' → X' → ℂ) (E : Y'' → Y' → ℂ) (F : Z'' → Z' → ℂ) : + DegeneratesTo T (Tensor.restrict D E F U) := by + have hclosed : IsClosed {S : Tensor ℂ X' Y' Z' | + DegeneratesTo T (Tensor.restrict D E F S)} := + isClosed_closure.preimage (continuous_restrict D E F) + have hsubset : restrictionOrbit T ⊆ + {S : Tensor ℂ X' Y' Z' | DegeneratesTo T (Tensor.restrict D E F S)} := by + intro S hS + exact subset_closure (mem_restrictionOrbit_restrict hS D E F) + exact closure_minimal hsubset hclosed h + +theorem DegeneratesTo.trans {T : Tensor ℂ X Y Z} {U : Tensor ℂ X' Y' Z'} + {V : Tensor ℂ X'' Y'' Z''} (hTU : DegeneratesTo T U) + (hUV : DegeneratesTo U V) : DegeneratesTo T V := by + have hsubset : restrictionOrbit U ⊆ + {S : Tensor ℂ X'' Y'' Z'' | DegeneratesTo T S} := by + rintro S ⟨D, E, F, rfl⟩ + exact hTU.restrict D E F + exact closure_minimal hsubset isClosed_closure hUV + +theorem DegeneratesTo.of_restrict {T : Tensor ℂ X Y Z} {V : Tensor ℂ X'' Y'' Z''} + (A : X' → X → ℂ) (B : Y' → Y → ℂ) (C : Z' → Z → ℂ) + (h : DegeneratesTo (Tensor.restrict A B C T) V) : DegeneratesTo T V := + (degeneratesTo_restrict T A B C).trans h + +end ComplexTopology + +end Tensor +end MatrixMultiplication.Foundation + +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +open scoped BigOperators +open MatrixMultiplication.Foundation + +namespace MatrixMultiplication.Replication + +variable {K I R X Y Z X' Y' Z' : Type*} [CommSemiring K] + +theorem restrict_directSum + [Fintype I] [DecidableEq I] [Fintype X] [Fintype Y] [Fintype Z] + (T : I → Tensor K X Y Z) + (a : I → X' → X → K) (b : I → Y' → Y → K) (c : I → Z' → Z → K) : + Tensor.restrict + (fun x s => if x.1 = s.1 then a x.1 x.2 s.2 else 0) + (fun y s => if y.1 = s.1 then b y.1 y.2 s.2 else 0) + (fun z s => if z.1 = s.1 then c z.1 z.2 s.2 else 0) + (Tensor.directSum T) = Tensor.directSum (fun i => Tensor.restrict (a i) (b i) (c i) (T i)) := by + classical + funext x y z + rcases x with ⟨i, x⟩ + rcases y with ⟨j, y⟩ + rcases z with ⟨k, z⟩ + by_cases hij : i = j + · subst j + by_cases hik : i = k + · subst k + simp [Tensor.restrict, Tensor.directSum, Fintype.sum_prod_type, + ite_and, ite_mul, mul_ite] + · simp [Tensor.restrict, Tensor.directSum, Fintype.sum_prod_type, + ite_and, ite_mul, mul_ite, hik] + · simp [Tensor.restrict, Tensor.directSum, Fintype.sum_prod_type, + ite_and, ite_mul, mul_ite, hij] + intro hjk hik + exact (hij (hik.trans hjk.symm)).elim + +theorem swap_replication [DecidableEq I] [DecidableEq R] + (T : I → Tensor K X Y Z) : + Tensor.pullback + (fun x : I × (R × X) => (x.2.1, (x.1, x.2.2))) + (fun y : I × (R × Y) => (y.2.1, (y.1, y.2.2))) + (fun z : I × (R × Z) => (z.2.1, (z.1, z.2.2))) + (Tensor.directSum (fun _ : R => Tensor.directSum T)) = + Tensor.directSum (fun i => Tensor.directSum (fun _ : R => T i)) := by + funext x y z + simp only [Tensor.pullback, Tensor.directSum] + split_ifs <;> simp_all + +theorem repair_branches + [Fintype I] [DecidableEq I] [Fintype R] [DecidableEq R] + [Fintype X] [Fintype Y] [Fintype Z] + (T : I → Tensor K X Y Z) (Q : I → Tensor K X' Y' Z') + (a : I → X' → (R × X) → K) (b : I → Y' → (R × Y) → K) + (c : I → Z' → (R × Z) → K) + (h : ∀ i, Tensor.restrict (a i) (b i) (c i) + (Tensor.directSum (fun _ : R => T i)) = Q i) : + ∃ (A : (I × X') → (R × (I × X)) → K) + (B : (I × Y') → (R × (I × Y)) → K) + (C : (I × Z') → (R × (I × Z)) → K), + Tensor.restrict A B C (Tensor.directSum (fun _ : R => Tensor.directSum T)) = + Tensor.directSum Q := by + classical + have hb := restrict_directSum (fun i => Tensor.directSum (fun _ : R => T i)) a b c + simp_rw [h] at hb + rw [← swap_replication T, Tensor.pullback_eq_restrict, Tensor.restrict_restrict] at hb + exact ⟨_, _, _, hb⟩ + +end MatrixMultiplication.Replication + +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +namespace MatrixMultiplication.Foundation + +variable (G : Type*) [AddCommGroup G] [Fintype G] [DecidableEq G] + +def groupTensor : Tensor ℂ G G G := fun a b c => if a + b = c then 1 else 0 + +theorem groupTensor_fourier : + groupTensor G = fun a b c => ∑ χ : AddChar G ℂ, + Tensor.rankOne (fun a => χ a / (Fintype.card G : ℂ)) + (fun b => χ b) (fun c => χ (-c)) a b c := by + funext a b c + have hcard : (Fintype.card G : ℂ) ≠ 0 := Nat.cast_ne_zero.mpr Fintype.card_ne_zero + calc + groupTensor G a b c = + (∑ χ : AddChar G ℂ, χ (a + b - c)) / (Fintype.card G : ℂ) := by + rw [AddChar.sum_apply_eq_ite] + by_cases h : a + b = c + · simp [groupTensor, h, hcard] + · simp [groupTensor, h, sub_ne_zero.mpr h] + _ = _ := by + rw [Finset.sum_div] + apply Finset.sum_congr rfl + intro χ hχ + simp only [Tensor.rankOne, sub_eq_add_neg, AddChar.map_add_eq_mul] + ring + +theorem groupTensor_rankAtMost : Tensor.RankAtMost (groupTensor G) (Fintype.card G) := by + rw [groupTensor_fourier] + simpa only [AddChar.card_eq] using + Tensor.rankAtMost_sum_rankOne + (fun χ : AddChar G ℂ => fun a => χ a / (Fintype.card G : ℂ)) + (fun χ : AddChar G ℂ => fun b => χ b) + (fun χ : AddChar G ℂ => fun c => χ (-c)) + +end MatrixMultiplication.Foundation + +end + +end MatrixAllFields + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +open scoped BigOperators + +namespace MatrixMultiplication.Foundation +namespace Tensor + +section Pairing + +variable {K U : Type*} [CommSemiring K] [DecidableEq U] + +def dotPairing (U : Type*) [DecidableEq U] : Tensor K U U Unit := + fun i j _ => if i = j then 1 else 0 + +@[simp] theorem dotPairing_matching (i : U) : + dotPairing (K := K) U i i () = 1 := by + simp [dotPairing] + +theorem contract_dotPairing [Fintype U] (a b : U → K) : + contract (dotPairing (K := K) U) a b () = ∑ i, a i * b i := by + classical + simp [contract, dotPairing, ite_mul] + +end Pairing + +end Tensor +end MatrixMultiplication.Foundation + +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/Tensors/ComplexSeparatedTensorDecomposition.lean b/lean/OAI/LinearAlgebra/MatrixFields/Tensors/ComplexSeparatedTensorDecomposition.lean new file mode 100644 index 0000000000000000000000000000000000000000..18563f6bc7f450bf273eecf65e406c2ef7ecc16c --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/Tensors/ComplexSeparatedTensorDecomposition.lean @@ -0,0 +1,306 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Extraction.ComplexFiniteSeparation + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +open scoped BigOperators + +namespace MatrixMultiplication.Foundation +namespace Tensor + +variable {K S : Type*} [CommSemiring K] [DecidableEq S] +variable {X Y Z : S → Type*} + +def dependentDirectSum (T : ∀ s, Tensor K (X s) (Y s) (Z s)) : + Tensor K (Σ s, X s) (Σ s, Y s) (Σ s, Z s) := + fun x y z => + if hxy : y.1 = x.1 then + if hxz : z.1 = x.1 then T x.1 x.2 (hxy ▸ y.2) (hxz ▸ z.2) + else 0 + else 0 + +@[simp] theorem dependentDirectSum_matching + (T : ∀ s, Tensor K (X s) (Y s) (Z s)) + (s : S) (x : X s) (y : Y s) (z : Z s) : + dependentDirectSum T ⟨s, x⟩ ⟨s, y⟩ ⟨s, z⟩ = T s x y z := by + simp [dependentDirectSum] + +theorem dependentDirectSum_zero_of_left_ne + (T : ∀ s, Tensor K (X s) (Y s) (Z s)) + (x : Σ s, X s) (y : Σ s, Y s) (z : Σ s, Z s) + (h : x.1 ≠ y.1) : dependentDirectSum T x y z = 0 := by + simp [dependentDirectSum, Ne.symm h] + +def directSumCoordinateEquiv {A : Type*} (e : ∀ s, X s ≃ A) : + (Σ s, X s) ≃ S × A where + toFun x := (x.1, e x.1 x.2) + invFun x := ⟨x.1, (e x.1).symm x.2⟩ + left_inv := by + rintro ⟨s, x⟩ + simp + right_inv := by + rintro ⟨s, x⟩ + simp + +theorem dependentDirectSum_reindex {A B C : Type*} + (T : ∀ s, Tensor K (X s) (Y s) (Z s)) + (ex : ∀ s, X s ≃ A) (ey : ∀ s, Y s ≃ B) (ez : ∀ s, Z s ≃ C) : + pullback (directSumCoordinateEquiv ex).symm + (directSumCoordinateEquiv ey).symm (directSumCoordinateEquiv ez).symm + (dependentDirectSum T) = + directSum (fun s => pullback (ex s).symm (ey s).symm (ez s).symm (T s)) := by + funext x y z + rcases x with ⟨s, x⟩ + rcases y with ⟨t, y⟩ + rcases z with ⟨v, z⟩ + by_cases ht : t = s + · subst t + by_cases hv : v = s + · subst v + simp [pullback, directSumCoordinateEquiv, dependentDirectSum, directSum] + · simp [pullback, directSumCoordinateEquiv, dependentDirectSum, directSum, + hv, Ne.symm hv] + · simp [pullback, directSumCoordinateEquiv, dependentDirectSum, directSum, + ht, Ne.symm ht] + +end Tensor + +variable {X Y Z S U : Type*} [DecidableEq S] [DecidableEq U] + +def labelFiberTensor (lx : X → S) (ly : Y → S) (T : Tensor ℂ X Y Z) (s : S) : + Tensor ℂ {x // lx x = s} {y // ly y = s} Z := + fun x y z => T x.1 y.1 z + +def fiberCoordinateEquiv (lx : X → S) : + (Σ s, {x // lx x = s} × U) ≃ X × U where + toFun x := (x.2.1.1, x.2.2) + invFun x := ⟨lx x.1, (⟨x.1, rfl⟩, x.2)⟩ + left_inv := by + rintro ⟨s, ⟨⟨x, hx⟩, u⟩⟩ + cases hx + rfl + right_inv := by + rintro ⟨x, u⟩ + rfl + +def tagCoordinateEquiv : (Σ _ : S, Z × Unit) ≃ Z × S where + toFun z := (z.2.1, z.1) + invFun z := ⟨z.2, (z.1, ())⟩ + left_inv := by + rintro ⟨s, z, u⟩ + cases u + rfl + right_inv := by + rintro ⟨z, s⟩ + rfl + +theorem separatedTensor_eq_fiber_directSum + (T : Tensor ℂ X Y Z) (lx : X → S) (ly : Y → S) + (hlabels : ∀ x y z, T x y z ≠ 0 → lx x = ly y) : + Tensor.pullback (fiberCoordinateEquiv (U := U) lx) + (fiberCoordinateEquiv (U := U) ly) (tagCoordinateEquiv (Z := Z) (S := S)) + (separatedTensor lx T) = + Tensor.dependentDirectSum (fun s => + Tensor.product (labelFiberTensor lx ly T s) (Tensor.dotPairing U)) := by + classical + funext x y z + rcases x with ⟨s, x, u⟩ + rcases y with ⟨t, y, v⟩ + rcases z with ⟨w, z, q⟩ + by_cases ht : t = s + · subst t + by_cases hw : w = s + · subst w + rw [Tensor.dependentDirectSum_matching] + simp [Tensor.pullback, fiberCoordinateEquiv, tagCoordinateEquiv, + separatedTensor, Tensor.product, labelFiberTensor, Tensor.dotPairing, + x.property, mul_ite] + · simp [Tensor.pullback, fiberCoordinateEquiv, tagCoordinateEquiv, + separatedTensor, Tensor.dependentDirectSum, x.property, hw, Ne.symm hw] + · have hzero : T x.1 y.1 z = 0 := by + by_contra hzero + have hxy := hlabels x.1 y.1 z hzero + exact ht (y.property.symm.trans (hxy.symm.trans x.property)) + simp [Tensor.pullback, fiberCoordinateEquiv, tagCoordinateEquiv, + separatedTensor, Tensor.dependentDirectSum, ht, hzero] + +theorem fiber_directSum_eq_separatedTensor + (T : Tensor ℂ X Y Z) (lx : X → S) (ly : Y → S) + (hlabels : ∀ x y z, T x y z ≠ 0 → lx x = ly y) : + Tensor.pullback (fiberCoordinateEquiv (U := U) lx).symm + (fiberCoordinateEquiv (U := U) ly).symm + (tagCoordinateEquiv (Z := Z) (S := S)).symm + (Tensor.dependentDirectSum (fun s => + Tensor.product (labelFiberTensor lx ly T s) (Tensor.dotPairing U))) = + separatedTensor lx T := by + rw [← separatedTensor_eq_fiber_directSum T lx ly hlabels] + funext x y z + simp [Tensor.pullback] + +theorem separatedTensor_fiber_directSum_rankAtMost + (T : Tensor ℂ X Y Z) (lx : X → S) (ly : Y → S) {r : ℕ} + (hlabels : ∀ x y z, T x y z ≠ 0 → lx x = ly y) + (h : Tensor.RankAtMost (separatedTensor (U := U) lx T) r) : + Tensor.RankAtMost (Tensor.dependentDirectSum (fun s => + Tensor.product (labelFiberTensor lx ly T s) (Tensor.dotPairing U))) r := by + rw [← separatedTensor_eq_fiber_directSum T lx ly hlabels] + exact h.pullback _ _ _ + +theorem separatedTensor_fiber_directSum_rankAtMost_iff + (T : Tensor ℂ X Y Z) (lx : X → S) (ly : Y → S) {r : ℕ} + (hlabels : ∀ x y z, T x y z ≠ 0 → lx x = ly y) : + Tensor.RankAtMost (separatedTensor (U := U) lx T) r ↔ + Tensor.RankAtMost (Tensor.dependentDirectSum (fun s => + Tensor.product (labelFiberTensor lx ly T s) (Tensor.dotPairing U))) r := by + constructor + · exact separatedTensor_fiber_directSum_rankAtMost T lx ly hlabels + · intro h + rw [← fiber_directSum_eq_separatedTensor T lx ly hlabels] + exact h.pullback _ _ _ + +theorem separatedTensor_fiber_directSum_borderRankAtMost + [Fintype X] [Fintype Y] [Fintype Z] [Fintype S] [Fintype U] + (T : Tensor ℂ X Y Z) (lx : X → S) (ly : Y → S) {r : ℕ} + (hlabels : ∀ x y z, T x y z ≠ 0 → lx x = ly y) + (h : Tensor.BorderRankAtMost (separatedTensor (U := U) lx T) r) : + Tensor.BorderRankAtMost (Tensor.dependentDirectSum (fun s => + Tensor.product (labelFiberTensor lx ly T s) (Tensor.dotPairing U))) r := by + classical + rw [← separatedTensor_eq_fiber_directSum T lx ly hlabels] + rw [Tensor.pullback_eq_restrict] + exact h.restrict _ _ _ + +theorem separatedTensor_uniform_directSum_rankAtMost {A B : Type*} + (T : Tensor ℂ X Y Z) (lx : X → S) (ly : Y → S) + (ex : ∀ s, {x // lx x = s} ≃ A) (ey : ∀ s, {y // ly y = s} ≃ B) + {r : ℕ} (hlabels : ∀ x y z, T x y z ≠ 0 → lx x = ly y) + (h : Tensor.RankAtMost (separatedTensor (U := U) lx T) r) : + Tensor.RankAtMost (Tensor.directSum (fun s => Tensor.pullback + (Equiv.prodCongr (ex s) (Equiv.refl U)).symm + (Equiv.prodCongr (ey s) (Equiv.refl U)).symm + (Equiv.refl (Z × Unit)).symm + (Tensor.product (labelFiberTensor lx ly T s) (Tensor.dotPairing U)))) r := by + have hf := separatedTensor_fiber_directSum_rankAtMost T lx ly hlabels h + have hp := hf.pullback + (Tensor.directSumCoordinateEquiv + (fun s => Equiv.prodCongr (ex s) (Equiv.refl U))).symm + (Tensor.directSumCoordinateEquiv + (fun s => Equiv.prodCongr (ey s) (Equiv.refl U))).symm + (Tensor.directSumCoordinateEquiv (fun _ : S => Equiv.refl (Z × Unit))).symm + rw [Tensor.dependentDirectSum_reindex] at hp + exact hp + +theorem separatedTensor_localModels_identity {A B C : Type*} + (T : Tensor ℂ X Y Z) (lx : X → S) (ly : Y → S) + (fx : S → A → X) (fy : S → B → Y) (fz : S → C → Z) + (hfx : ∀ s a, lx (fx s a) = s) (hfy : ∀ s b, ly (fy s b) = s) + (hlabels : ∀ x y z, T x y z ≠ 0 → lx x = ly y) : + Tensor.pullback + (fun x : S × (A × U) => (fx x.1 x.2.1, x.2.2)) + (fun y : S × (B × U) => (fy y.1 y.2.1, y.2.2)) + (fun z : S × (C × Unit) => (fz z.1 z.2.1, z.1)) + (separatedTensor lx T) = + Tensor.directSum (fun s => Tensor.product + (Tensor.pullback (fx s) (fy s) (fz s) T) (Tensor.dotPairing U)) := by + funext x y z + rcases x with ⟨s, a, u⟩ + rcases y with ⟨t, b, v⟩ + rcases z with ⟨w, c, q⟩ + by_cases ht : t = s + · subst t + by_cases hw : w = s + · subst w + simp [Tensor.pullback, separatedTensor, Tensor.directSum, + Tensor.product, Tensor.dotPairing, hfx, mul_ite] + · simp [Tensor.pullback, separatedTensor, Tensor.directSum, + hfx, Ne.symm hw] + · have hzero : T (fx s a) (fy t b) (fz w c) = 0 := by + by_contra hzero + have hxy := hlabels (fx s a) (fy t b) (fz w c) hzero + exact ht ((hfy t b).symm.trans (hxy.symm.trans (hfx s a))) + simp [Tensor.pullback, separatedTensor, Tensor.directSum, + Ne.symm ht, hzero] + +theorem separatedTensor_localModels_rankAtMost {A B C : Type*} + (T : Tensor ℂ X Y Z) (lx : X → S) (ly : Y → S) + (fx : S → A → X) (fy : S → B → Y) (fz : S → C → Z) + (hfx : ∀ s a, lx (fx s a) = s) (hfy : ∀ s b, ly (fy s b) = s) + (hlabels : ∀ x y z, T x y z ≠ 0 → lx x = ly y) + {r : ℕ} (h : Tensor.RankAtMost (separatedTensor (U := U) lx T) r) : + Tensor.RankAtMost (Tensor.directSum (fun s => Tensor.product + (Tensor.pullback (fx s) (fy s) (fz s) T) (Tensor.dotPairing U))) r := by + rw [← separatedTensor_localModels_identity T lx ly fx fy fz hfx hfy hlabels] + exact h.pullback _ _ _ + +theorem separatedTensor_localModels_borderRankAtMost {A B C : Type*} + [Fintype X] [Fintype Y] [Fintype Z] [Fintype S] [Fintype U] + [Fintype A] [Fintype B] [Fintype C] + (T : Tensor ℂ X Y Z) (lx : X → S) (ly : Y → S) + (fx : S → A → X) (fy : S → B → Y) (fz : S → C → Z) + (hfx : ∀ s a, lx (fx s a) = s) (hfy : ∀ s b, ly (fy s b) = s) + (hlabels : ∀ x y z, T x y z ≠ 0 → lx x = ly y) + {r : ℕ} (h : Tensor.BorderRankAtMost (separatedTensor (U := U) lx T) r) : + Tensor.BorderRankAtMost (Tensor.directSum (fun s => Tensor.product + (Tensor.pullback (fx s) (fy s) (fz s) T) (Tensor.dotPairing U))) r := by + classical + rw [← separatedTensor_localModels_identity T lx ly fx fy fz hfx hfy hlabels] + rw [Tensor.pullback_eq_restrict] + exact h.restrict _ _ _ + +theorem separatedTensor_scalar_identity + (T : Tensor ℂ X Y Z) (lx : X → S) (ly : Y → S) + (sx : S → X) (sy : S → Y) (sz : S → Z) + (hsx : ∀ s, lx (sx s) = s) (hsy : ∀ s, ly (sy s) = s) + (hlabels : ∀ x y z, T x y z ≠ 0 → lx x = ly y) + (hscalar : ∀ s, T (sx s) (sy s) (sz s) = 1) : + Tensor.pullback + (fun x : S × U => (sx x.1, x.2)) + (fun y : S × U => (sy y.1, y.2)) + (fun z : S × Unit => (sz z.1, z.1)) (separatedTensor lx T) = + Tensor.directSum (fun _ : S => Tensor.dotPairing U) := by + have hmodels := separatedTensor_localModels_identity (U := U) T lx ly + (fun s (_ : Unit) => sx s) (fun s (_ : Unit) => sy s) (fun s (_ : Unit) => sz s) + (fun s _ => hsx s) (fun s _ => hsy s) hlabels + have h := congrArg (Tensor.pullback + (fun x : S × U => (x.1, ((), x.2))) + (fun y : S × U => (y.1, ((), y.2))) + (fun z : S × Unit => (z.1, ((), z.2)))) hmodels + funext x y z + have hpoint := congrFun (congrFun (congrFun h x) y) z + simpa only [Tensor.pullback, Tensor.directSum, Tensor.product, hscalar, one_mul] + using hpoint + +theorem separatedTensor_scalar_rankAtMost + (T : Tensor ℂ X Y Z) (lx : X → S) (ly : Y → S) + (sx : S → X) (sy : S → Y) (sz : S → Z) + (hsx : ∀ s, lx (sx s) = s) (hsy : ∀ s, ly (sy s) = s) + (hlabels : ∀ x y z, T x y z ≠ 0 → lx x = ly y) + (hscalar : ∀ s, T (sx s) (sy s) (sz s) = 1) + {r : ℕ} (h : Tensor.RankAtMost (separatedTensor (U := U) lx T) r) : + Tensor.RankAtMost (Tensor.directSum (fun _ : S => Tensor.dotPairing (K := ℂ) U)) r := by + rw [← separatedTensor_scalar_identity T lx ly sx sy sz hsx hsy hlabels hscalar] + exact h.pullback _ _ _ + +theorem separatedTensor_scalar_borderRankAtMost + [Fintype X] [Fintype Y] [Fintype Z] [Fintype S] [Fintype U] + (T : Tensor ℂ X Y Z) (lx : X → S) (ly : Y → S) + (sx : S → X) (sy : S → Y) (sz : S → Z) + (hsx : ∀ s, lx (sx s) = s) (hsy : ∀ s, ly (sy s) = s) + (hlabels : ∀ x y z, T x y z ≠ 0 → lx x = ly y) + (hscalar : ∀ s, T (sx s) (sy s) (sz s) = 1) + {r : ℕ} (h : Tensor.BorderRankAtMost (separatedTensor (U := U) lx T) r) : + Tensor.BorderRankAtMost (Tensor.directSum (fun _ : S => Tensor.dotPairing U)) r := by + classical + rw [← separatedTensor_scalar_identity T lx ly sx sy sz hsx hsy hlabels hscalar] + rw [Tensor.pullback_eq_restrict] + exact h.restrict _ _ _ + +end MatrixMultiplication.Foundation + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/Tensors/JointPopulationCWNonzero.lean b/lean/OAI/LinearAlgebra/MatrixFields/Tensors/JointPopulationCWNonzero.lean new file mode 100644 index 0000000000000000000000000000000000000000..32dce051a81d287d12382caa12d98d689f3a688a --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/Tensors/JointPopulationCWNonzero.lean @@ -0,0 +1,87 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Tensors.CWCompleteStatistics + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +noncomputable section + +namespace MatrixMultiplication.JointPopulationCWNonzero + +open MatrixMultiplication.Foundation JointPopulation JointCanonicalization JointCanonicalCW +open CWStrands InheritedMasks +open scoped BigOperators + +attribute [local instance] Classical.propDecidable + +variable {H F : Type*} [Fintype H] [DecidableEq H] [Field F] + +omit [DecidableEq H] in +theorem class_half_products_nonzero + (counts : H → Shape → ℕ) (leftLength rightLength : H → ℕ) + (parentShape : H → Fin 3 → ℕ) (hleft : ∀ h, leftLength h ≤ 8) + (hsupp : ∀ h u, 0 < counts h u → ∀ s, shapeNat u s ≤ parentShape h s) + (e : Target counts) + (x y z : RawPairs counts (Left leftLength) (Right rightLength)) + (hsource : sourceTensor counts (Left leftLength) (Right rightLength) + (parentTensor (F := F) leftLength rightLength parentShape) x y z ≠ 0) + (hx : coarseMask counts (Left leftLength) (Right rightLength) + (coarse leftLength rightLength hleft) 0 e x) + (hy : coarseMask counts (Left leftLength) (Right rightLength) + (coarse leftLength rightLength hleft) 1 e y) + (hz : coarseMask counts (Left leftLength) (Right rightLength) + (coarse leftLength rightLength hleft) 2 e z) + (h : H) (u : Shape) (hn : 0 < counts h u) : + (∏ i : Class counts e h u, + shapeTensor (F := F) (Fin (leftLength h)) (shapeNat u) + (x h i.val).1 (y h i.val).1 (z h i.val).1) ≠ 0 ∧ + (∏ i : Class counts e h u, + shapeTensor (F := F) (Fin (rightLength h)) (parentShape h - shapeNat u) + (x h i.val).2 (y h i.val).2 (z h i.val).2) ≠ 0 := by + change (∏ h' : H, ∏ i : Positions counts h', + parentTensor (F := F) leftLength rightLength parentShape h' + (x h' i) (y h' i) (z h' i)) ≠ 0 at hsource + have hparent (i : Positions counts h) : + parentTensor (F := F) leftLength rightLength parentShape h + (x h i) (y h i) (z h i) ≠ 0 := + Finset.prod_ne_zero_iff.mp + (Finset.prod_ne_zero_iff.mp hsource h (Finset.mem_univ h)) i (Finset.mem_univ i) + have hhalves (i : Class counts e h u) : + shapeTensor (F := F) (Fin (leftLength h)) (shapeNat u) + (x h i.val).1 (y h i.val).1 (z h i.val).1 * + shapeTensor (F := F) (Fin (rightLength h)) (parentShape h - shapeNat u) + (x h i.val).2 (y h i.val).2 (z h i.val).2 ≠ 0 := by + have hx' : coarse leftLength rightLength hleft 0 h (x h i.val) = u.1 := by + simpa [shapeSide, i.property] using hx h i.val + have hy' : coarse leftLength rightLength hleft 1 h (y h i.val) = u.2.1 := by + simpa [shapeSide, i.property] using hy h i.val + have hz' : coarse leftLength rightLength hleft 2 h (z h i.val) = u.2.2 := by + simpa [shapeSide, i.property] using hz h i.val + have hblock : block (Left leftLength) (Right rightLength) + (parentTensor (F := F) leftLength rightLength parentShape) + (coarse leftLength rightLength hleft) (h, u) + (x h i.val) (y h i.val) (z h i.val) ≠ 0 := by + simpa [block, hx', hy', hz'] using hparent i.val + rw [block_eq_product leftLength rightLength parentShape hleft h u + (hsupp h u hn)] at hblock + exact hblock + constructor + · apply Finset.prod_ne_zero_iff.mpr + intro i _ + exact (mul_ne_zero_iff.mp (hhalves i)).1 + · apply Finset.prod_ne_zero_iff.mpr + intro i _ + exact (mul_ne_zero_iff.mp (hhalves i)).2 + +end MatrixMultiplication.JointPopulationCWNonzero + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixFields/Tensors/TerminalRelabel.lean b/lean/OAI/LinearAlgebra/MatrixFields/Tensors/TerminalRelabel.lean new file mode 100644 index 0000000000000000000000000000000000000000..ea222aa7fec479c257240b1b8ad9b98c4d3c65cb --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixFields/Tensors/TerminalRelabel.lean @@ -0,0 +1,519 @@ +import Mathlib +import OAI.LinearAlgebra.MatrixFields.Arithmetic.ComplexArithmeticLowerBound + +namespace OAI + +namespace MatrixAllFields + +open scoped BigOperators Topology Polynomial + +section +open scoped BigOperators + +namespace MatrixMultiplication.Foundation +namespace Tensor + +variable {K A B C D E F : Type*} [CommSemiring K] + +def matrixCoefficients (A B C : Type*) [DecidableEq A] [DecidableEq B] [DecidableEq C] : + Tensor K (A × B) (B × C) (C × A) := + fun x y z => if x.2 = y.1 ∧ y.2 = z.1 ∧ z.2 = x.1 then 1 else 0 + +theorem matrixMultiplication_eq_matrixCoefficients (a b c : ℕ) : + matrixMultiplication a b c = matrixCoefficients (K := ℂ) (Fin a) (Fin b) (Fin c) := rfl + +theorem contract_matrixCoefficients [Fintype A] [Fintype B] [Fintype C] + [DecidableEq A] [DecidableEq B] [DecidableEq C] + (left : A × B → K) (right : B × C → K) (i : A) (k : C) : + contract (matrixCoefficients A B C) left right (k, i) = + ∑ j, left (i, j) * right (j, k) := by + simp [contract, matrixCoefficients, Fintype.sum_prod_type, ite_and, ite_mul] + +theorem matrixCoefficients_product [DecidableEq A] [DecidableEq B] [DecidableEq C] + [DecidableEq D] [DecidableEq E] [DecidableEq F] + (x : (A × D) × (B × E)) (y : (B × E) × (C × F)) (z : (C × F) × (A × D)) : + product (matrixCoefficients (K := K) A B C) (matrixCoefficients D E F) + ((x.1.1, x.2.1), (x.1.2, x.2.2)) + ((y.1.1, y.2.1), (y.1.2, y.2.2)) + ((z.1.1, z.2.1), (z.1.2, z.2.2)) = + matrixCoefficients (A × D) (B × E) (C × F) x y z := by + simp only [product, matrixCoefficients, Prod.ext_iff] + split_ifs <;> simp_all + +theorem matrixCoefficients_cyclic [DecidableEq A] [DecidableEq B] [DecidableEq C] + (x : B × C) (y : C × A) (z : A × B) : + matrixCoefficients (K := K) A B C z x y = matrixCoefficients B C A x y z := by + have h : (z.2 = x.1 ∧ x.2 = y.1 ∧ y.2 = z.1) ↔ + (x.2 = y.1 ∧ y.2 = z.1 ∧ z.2 = x.1) := + ⟨fun h => ⟨h.2.1, h.2.2, h.1⟩, fun h => ⟨h.2.2, h.1, h.2.1⟩⟩ + simp only [matrixCoefficients, h] + +theorem matrixCoefficients_rank_of_product [DecidableEq A] [DecidableEq B] [DecidableEq C] + [DecidableEq D] [DecidableEq E] [DecidableEq F] {r : ℕ} + (hproduct : RankAtMost (product (matrixCoefficients (K := K) A B C) + (matrixCoefficients D E F)) r) : + RankAtMost (matrixCoefficients (K := K) (A × D) (B × E) (C × F)) r := by + have h := hproduct.pullback + (fun x : (A × D) × (B × E) => ((x.1.1, x.2.1), (x.1.2, x.2.2))) + (fun y : (B × E) × (C × F) => ((y.1.1, y.2.1), (y.1.2, y.2.2))) + (fun z : (C × F) × (A × D) => ((z.1.1, z.2.1), (z.1.2, z.2.2))) + have heq : pullback + (fun x : (A × D) × (B × E) => ((x.1.1, x.2.1), (x.1.2, x.2.2))) + (fun y : (B × E) × (C × F) => ((y.1.1, y.2.1), (y.1.2, y.2.2))) + (fun z : (C × F) × (A × D) => ((z.1.1, z.2.1), (z.1.2, z.2.2))) + (product (matrixCoefficients (K := K) A B C) (matrixCoefficients D E F)) = + matrixCoefficients (K := K) (A × D) (B × E) (C × F) := by + funext x y z + exact matrixCoefficients_product x y z + rw [heq] at h + exact h + +theorem matrixCoefficients_product_rank [DecidableEq A] [DecidableEq B] [DecidableEq C] + [DecidableEq D] [DecidableEq E] [DecidableEq F] {r s : ℕ} + (hT : RankAtMost (matrixCoefficients (K := K) A B C) r) + (hS : RankAtMost (matrixCoefficients (K := K) D E F) s) : + RankAtMost (matrixCoefficients (K := K) (A × D) (B × E) (C × F)) (r * s) := + matrixCoefficients_rank_of_product (hT.product hS) + +theorem matrixCoefficients_batch_rank [DecidableEq A] [DecidableEq B] [Fintype B] + {R k r batches : ℕ} + (houter : RankAtMost (matrixCoefficients (K := K) A A A) R) + (hbatch : RankAtMost (directSum (fun _ : Fin k => matrixCoefficients (K := K) B B B)) r) + (hfit : R ≤ batches * k) : + RankAtMost (matrixCoefficients (K := K) (A × B) (A × B) (A × B)) (batches * r) := + matrixCoefficients_rank_of_product (houter.batch_product hbatch hfit) + +theorem matrixCoefficients_power [DecidableEq A] [DecidableEq B] [DecidableEq C] + (n : ℕ) (x : (Fin n → A) × (Fin n → B)) + (y : (Fin n → B) × (Fin n → C)) (z : (Fin n → C) × (Fin n → A)) : + Tensor.power (matrixCoefficients (K := K) A B C) n + (fun i => (x.1 i, x.2 i)) (fun i => (y.1 i, y.2 i)) (fun i => (z.1 i, z.2 i)) = + matrixCoefficients (Fin n → A) (Fin n → B) (Fin n → C) x y z := by + simp only [Tensor.power, matrixCoefficients, Fintype.prod_boole, forall_and, ← funext_iff] + +theorem matrixCoefficients_cyclic_rank [DecidableEq A] [DecidableEq B] [DecidableEq C] + {r : ℕ} (h : RankAtMost (matrixCoefficients (K := K) A B C) r) : + RankAtMost (matrixCoefficients (K := K) B C A) r := by + rcases h with ⟨a, b, c, heq⟩ + refine ⟨b, c, a, ?_⟩ + funext x y z + rw [← matrixCoefficients_cyclic (K := K) x y z] + rw [congrFun (congrFun (congrFun heq z) x) y] + apply Finset.sum_congr rfl + intro i hi + simp only [rankOne] + ring + +end Tensor + + + + + + +namespace Tensor + +variable {K X Y Z U V W : Type*} [CommSemiring K] + +def cyclic (T : Tensor K X Y Z) : Tensor K Y Z X := + fun y z x => T x y z + +theorem RankAtMost.cyclic {T : Tensor K X Y Z} {r : ℕ} + (h : RankAtMost T r) : RankAtMost (Tensor.cyclic T) r := by + rcases h with ⟨a, b, c, rfl⟩ + refine ⟨b, c, a, ?_⟩ + funext y z x + simp only [Tensor.cyclic, rankOne] + apply Finset.sum_congr rfl + intro i hi + ring + +def directSumProductEquiv (ι κ X U : Type*) : + ((ι × κ) × (X × U)) ≃ ((ι × X) × (κ × U)) where + toFun x := ((x.1.1, x.2.1), (x.1.2, x.2.2)) + invFun x := ((x.1.1, x.2.1), (x.1.2, x.2.2)) + left_inv _ := rfl + right_inv _ := rfl + +theorem directSum_product {ι κ : Type*} [DecidableEq ι] [DecidableEq κ] + (T : ι → Tensor K X Y Z) (S : κ → Tensor K U V W) : + pullback (directSumProductEquiv ι κ X U) + (directSumProductEquiv ι κ Y V) (directSumProductEquiv ι κ Z W) + (product (directSum T) (directSum S)) = + directSum (fun i : ι × κ => product (T i.1) (S i.2)) := by + funext x y z + change + (if x.1.1 = y.1.1 ∧ x.1.1 = z.1.1 then + T x.1.1 x.2.1 y.2.1 z.2.1 else 0) * + (if x.1.2 = y.1.2 ∧ x.1.2 = z.1.2 then + S x.1.2 x.2.2 y.2.2 z.2.2 else 0) = + if x.1 = y.1 ∧ x.1 = z.1 then + T x.1.1 x.2.1 y.2.1 z.2.1 * S x.1.2 x.2.2 y.2.2 z.2.2 else 0 + have hguard : (x.1 = y.1 ∧ x.1 = z.1) ↔ + (x.1.1 = y.1.1 ∧ x.1.1 = z.1.1) ∧ + (x.1.2 = y.1.2 ∧ x.1.2 = z.1.2) := by + constructor + · intro h + exact ⟨⟨congrArg Prod.fst h.1, congrArg Prod.fst h.2⟩, + ⟨congrArg Prod.snd h.1, congrArg Prod.snd h.2⟩⟩ + · intro h + exact ⟨Prod.ext h.1.1 h.2.1, Prod.ext h.1.2 h.2.2⟩ + by_cases hi : x.1.1 = y.1.1 ∧ x.1.1 = z.1.1 + · by_cases hk : x.1.2 = y.1.2 ∧ x.1.2 = z.1.2 + · simp only [ite_eq_left hi, ite_eq_left hk, ite_eq_left (hguard.mpr ⟨hi, hk⟩)] + · have hfull : ¬ (x.1 = y.1 ∧ x.1 = z.1) := fun h => hk (hguard.mp h).2 + simp only [ite_eq_left hi, ite_eq_right hk, ite_eq_right hfull, mul_zero] + · have hfull : ¬ (x.1 = y.1 ∧ x.1 = z.1) := fun h => hi (hguard.mp h).1 + simp only [ite_eq_right hi, ite_eq_right hfull, zero_mul] + +theorem RankAtMost.directSum_product {ι κ : Type*} [DecidableEq ι] [DecidableEq κ] + {T : ι → Tensor K X Y Z} {S : κ → Tensor K U V W} {r s : ℕ} + (hT : RankAtMost (directSum T) r) (hS : RankAtMost (directSum S) s) : + RankAtMost (directSum (fun i : ι × κ => Tensor.product (T i.1) (S i.2))) (r * s) := by + have h := (hT.product hS).pullback (directSumProductEquiv ι κ X U) + (directSumProductEquiv ι κ Y V) (directSumProductEquiv ι κ Z W) + rw [Tensor.directSum_product] at h + exact h + +theorem directSum_pullback {ι X' Y' Z' : Type*} [DecidableEq ι] + (T : ι → Tensor K X Y Z) (fx : X' → X) (fy : Y' → Y) (fz : Z' → Z) : + pullback (fun x : ι × X' => (x.1, fx x.2)) + (fun y : ι × Y' => (y.1, fy y.2)) (fun z : ι × Z' => (z.1, fz z.2)) + (directSum T) = directSum (fun i => pullback fx fy fz (T i)) := rfl + +theorem RankAtMost.directSum_pullback {ι X' Y' Z' : Type*} [DecidableEq ι] + {T : ι → Tensor K X Y Z} {r : ℕ} (h : RankAtMost (directSum T) r) + (fx : X' → X) (fy : Y' → Y) (fz : Z' → Z) : + RankAtMost (directSum (fun i => Tensor.pullback fx fy fz (T i))) r := + h.pullback (fun x : ι × X' => (x.1, fx x.2)) + (fun y : ι × Y' => (y.1, fy y.2)) (fun z : ι × Z' => (z.1, fz z.2)) + +theorem cyclic_directSum {ι : Type*} [DecidableEq ι] + (T : ι → Tensor K X Y Z) : + cyclic (directSum T) = directSum (fun i => cyclic (T i)) := by + funext x y z + rcases x with ⟨i, x⟩ + rcases y with ⟨j, y⟩ + rcases z with ⟨k, z⟩ + by_cases hij : i = j + · subst j + by_cases hik : i = k + · subst k + simp [cyclic, directSum] + · simp [cyclic, directSum, hik, Ne.symm hik] + · by_cases hki : k = i + · subst k + simp [cyclic, directSum, hij] + · simp [cyclic, directSum, hij, hki] + +theorem RankAtMost.directSum_cyclic {ι : Type*} [DecidableEq ι] + {T : ι → Tensor K X Y Z} {r : ℕ} (h : RankAtMost (directSum T) r) : + RankAtMost (directSum (fun i => Tensor.cyclic (T i))) r := by + rw [← Tensor.cyclic_directSum] + exact h.cyclic + +def directSumPowerEquiv (ι X : Type*) (n : ℕ) : + ((Fin n → ι) × (Fin n → X)) ≃ (Fin n → ι × X) where + toFun x i := (x.1 i, x.2 i) + invFun x := (fun i => (x i).1, fun i => (x i).2) + left_inv _ := rfl + right_inv _ := rfl + +theorem directSum_power {ι : Type*} [DecidableEq ι] + (T : ι → Tensor K X Y Z) (n : ℕ) : + pullback (directSumPowerEquiv ι X n) (directSumPowerEquiv ι Y n) + (directSumPowerEquiv ι Z n) (power (directSum T) n) = + directSum (fun f : Fin n → ι => + fun x y z => ∏ i, T (f i) (x i) (y i) (z i)) := by + funext x y z + change (∏ i, if x.1 i = y.1 i ∧ x.1 i = z.1 i then + T (x.1 i) (x.2 i) (y.2 i) (z.2 i) else 0) = + if x.1 = y.1 ∧ x.1 = z.1 then + ∏ i, T (x.1 i) (x.2 i) (y.2 i) (z.2 i) else 0 + simp only [Fintype.prod_ite_zero, forall_and, ← funext_iff] + +theorem directSum_const_power {ι : Type*} [DecidableEq ι] + (T : Tensor K X Y Z) (n : ℕ) : + pullback (directSumPowerEquiv ι X n) (directSumPowerEquiv ι Y n) + (directSumPowerEquiv ι Z n) (power (directSum (fun _ : ι => T)) n) = + directSum (fun _ : Fin n → ι => power T n) := + directSum_power (fun _ : ι => T) n + +theorem RankAtMost.directSum_const_of_power {ι : Type*} [DecidableEq ι] + {T : Tensor K X Y Z} {n R : ℕ} + (h : RankAtMost (Tensor.power (directSum (fun _ : ι => T)) n) R) : + RankAtMost (directSum (fun _ : Fin n → ι => Tensor.power T n)) R := by + have h' := h.pullback (directSumPowerEquiv ι X n) + (directSumPowerEquiv ι Y n) (directSumPowerEquiv ι Z n) + rw [Tensor.directSum_const_power] at h' + exact h' + +theorem RankAtMost.directSum_const_power {ι : Type*} [DecidableEq ι] + {T : Tensor K X Y Z} {r : ℕ} (h : RankAtMost (directSum (fun _ : ι => T)) r) + (n : ℕ) : RankAtMost (directSum (fun _ : Fin n → ι => Tensor.power T n)) (r ^ n) := + (h.power n).directSum_const_of_power + +section Rectangular + +variable {A B C : Type*} + +def rectangularSquareX (A B C : Type*) : + ((A × B × C) × (A × B × C)) ≃ (((A × B) × (B × C)) × (C × A)) where + toFun x := (((x.1.1, x.2.2.1), (x.1.2.1, x.2.2.2)), (x.1.2.2, x.2.1)) + invFun x := ((x.1.1.1, x.1.2.1, x.2.1), (x.2.2, x.1.1.2, x.1.2.2)) + left_inv _ := rfl + right_inv _ := rfl + +def rectangularSquareY (A B C : Type*) : + ((A × B × C) × (A × B × C)) ≃ (((B × C) × (C × A)) × (A × B)) where + toFun y := (((y.1.2.1, y.2.2.2), (y.1.2.2, y.2.1)), (y.1.1, y.2.2.1)) + invFun y := ((y.2.1, y.1.1.1, y.1.2.1), (y.1.2.2, y.2.2, y.1.1.2)) + left_inv _ := rfl + right_inv _ := rfl + +def rectangularSquareZ (A B C : Type*) : + ((A × B × C) × (A × B × C)) ≃ (((C × A) × (A × B)) × (B × C)) where + toFun z := (((z.1.2.2, z.2.1), (z.1.1, z.2.2.1)), (z.1.2.1, z.2.2.2)) + invFun z := ((z.1.2.1, z.2.1, z.1.1.1), (z.1.1.2, z.1.2.2, z.2.2)) + left_inv _ := rfl + right_inv _ := rfl + +variable [DecidableEq A] [DecidableEq B] [DecidableEq C] + +theorem matrixCoefficients_directSum_rank_of_power + {ι : Type*} [DecidableEq ι] {n R : ℕ} + (h : RankAtMost + (power (directSum (fun _ : ι => matrixCoefficients (K := K) A B C)) n) R) : + RankAtMost (directSum (fun _ : Fin n → ι => + matrixCoefficients (K := K) (Fin n → A) (Fin n → B) (Fin n → C))) R := by + have h' := h.directSum_const_of_power.directSum_pullback + (fun x : (Fin n → A) × (Fin n → B) => fun i => (x.1 i, x.2 i)) + (fun y : (Fin n → B) × (Fin n → C) => fun i => (y.1 i, y.2 i)) + (fun z : (Fin n → C) × (Fin n → A) => fun i => (z.1 i, z.2 i)) + have heq : pullback + (fun x : (Fin n → A) × (Fin n → B) => fun i => (x.1 i, x.2 i)) + (fun y : (Fin n → B) × (Fin n → C) => fun i => (y.1 i, y.2 i)) + (fun z : (Fin n → C) × (Fin n → A) => fun i => (z.1 i, z.2 i)) + (power (matrixCoefficients (K := K) A B C) n) = + matrixCoefficients (Fin n → A) (Fin n → B) (Fin n → C) := by + funext x y z + exact matrixCoefficients_power n x y z + simpa only [heq] using h' + +theorem matrixCoefficients_cyclic_product_square : + pullback (rectangularSquareX A B C) (rectangularSquareY A B C) + (rectangularSquareZ A B C) + (product (product (matrixCoefficients (K := K) A B C) + (matrixCoefficients B C A)) (matrixCoefficients C A B)) = + matrixCoefficients (A × B × C) (A × B × C) (A × B × C) := by + funext x y z + dsimp only [pullback, rectangularSquareX, rectangularSquareY, rectangularSquareZ, + product, matrixCoefficients] + simp only [Prod.ext_iff, ite_mul, one_mul, zero_mul, ← ite_and] + congr 1 + apply propext + tauto + +theorem cyclic_matrixCoefficients : + cyclic (matrixCoefficients (K := K) A B C) = matrixCoefficients B C A := by + funext x y z + exact matrixCoefficients_cyclic x y z + +theorem matrixCoefficients_symmetrized_rank {r : ℕ} + (h : RankAtMost (matrixCoefficients (K := K) A B C) r) : + RankAtMost (matrixCoefficients (K := K) + (A × B × C) (A × B × C) (A × B × C)) (r ^ 3) := by + have h' := ((h.product (matrixCoefficients_cyclic_rank h)).product + (matrixCoefficients_cyclic_rank (matrixCoefficients_cyclic_rank h))).pullback + (rectangularSquareX A B C) (rectangularSquareY A B C) (rectangularSquareZ A B C) + rw [matrixCoefficients_cyclic_product_square] at h' + simpa only [pow_succ, pow_zero, one_mul] using h' + +theorem matrixCoefficients_directSum_symmetrized_rank + {ι : Type*} [DecidableEq ι] {r : ℕ} + (h : RankAtMost (directSum (fun _ : ι => matrixCoefficients (K := K) A B C)) r) : + RankAtMost (directSum (fun _ : (ι × ι) × ι => + matrixCoefficients (K := K) (A × B × C) (A × B × C) (A × B × C))) (r ^ 3) := by + have h₁ : RankAtMost (directSum (fun _ : ι => matrixCoefficients (K := K) B C A)) r := by + simpa only [cyclic_matrixCoefficients] using h.directSum_cyclic + have h₂ : RankAtMost (directSum (fun _ : ι => matrixCoefficients (K := K) C A B)) r := by + simpa only [cyclic_matrixCoefficients] using h₁.directSum_cyclic + have h₃ := ((h.directSum_product h₁).directSum_product h₂).directSum_pullback + (rectangularSquareX A B C) (rectangularSquareY A B C) (rectangularSquareZ A B C) + simpa only [matrixCoefficients_cyclic_product_square, pow_succ, pow_zero, one_mul] using h₃ + +theorem symmetrized_tag_card (ι : Type*) [Fintype ι] : + Fintype.card ((ι × ι) × ι) = Fintype.card ι ^ 3 := by + simp [Fintype.card_prod, pow_succ] + +omit [DecidableEq A] [DecidableEq B] [DecidableEq C] in +theorem symmetrized_index_card [Fintype A] [Fintype B] [Fintype C] : + Fintype.card (A × B × C) = Fintype.card A * Fintype.card B * Fintype.card C := by + simp [Fintype.card_prod, mul_assoc] + +end Rectangular + +end Tensor +end MatrixMultiplication.Foundation + +end + + + + +section +noncomputable section + +open scoped BigOperators + +namespace MatrixMultiplication.Foundation +namespace Tensor + +variable {K X Y Z : Type*} [Field K] + +theorem RankAtMost.card_le_of_identity {ι : Type*} [Fintype ι] [DecidableEq ι] + {T : Tensor K X Y Z} {r : ℕ} (hT : RankAtMost T r) + (x : ι → X) (y : ι → Y) (z : ι → Z) + (hidentity : ∀ i j, T (x i) (y i) (z j) = if i = j then 1 else 0) : + Fintype.card ι ≤ r := by + rcases hT with ⟨a, b, c, heq⟩ + let L : Matrix ι (Fin r) K := fun i q => a q (x i) * b q (y i) + let R : Matrix (Fin r) ι K := fun q j => c q (z j) + have hmul : L * R = (1 : Matrix ι ι K) := by + funext i j + change (∑ q, (a q (x i) * b q (y i)) * c q (z j)) = if i = j then 1 else 0 + calc + (∑ q, (a q (x i) * b q (y i)) * c q (z j)) = T (x i) (y i) (z j) := + (congrFun (congrFun (congrFun heq (x i)) (y i)) (z j)).symm + _ = _ := hidentity i j + have hle : (1 : Matrix ι ι K).rank ≤ r := by + rw [← hmul] + exact (Matrix.rank_mul_le_left L R).trans (by + simpa only [Fintype.card_fin] using Matrix.rank_le_card_width L) + simpa only [Matrix.rank_one] using hle + +theorem directSum_matrixCoefficients_rank_lower + {Label A B C : Type*} [Fintype Label] [Fintype A] [Fintype C] + [DecidableEq Label] [DecidableEq A] [DecidableEq B] [DecidableEq C] + [Nonempty B] {r : ℕ} + (h : RankAtMost (directSum (fun _ : Label => matrixCoefficients (K := K) A B C)) r) : + Fintype.card Label * (Fintype.card C * Fintype.card A) ≤ r := by + classical + let b₀ : B := Classical.choice inferInstance + have hminor : ∀ i j : Label × (C × A), + directSum (fun _ : Label => matrixCoefficients (K := K) A B C) + (i.1, (i.2.2, b₀)) (i.1, (b₀, i.2.1)) j = if i = j then 1 else 0 := by + intro i j + simp only [directSum, matrixCoefficients] + split_ifs <;> simp_all [Prod.ext_iff] + have hlower := h.card_le_of_identity + (fun i : Label × (C × A) => (i.1, (i.2.2, b₀))) + (fun i : Label × (C × A) => (i.1, (b₀, i.2.1))) + (fun i : Label × (C × A) => i) hminor + simpa only [Fintype.card_prod] using hlower + +theorem directSum_square_rank_lower (k n r : ℕ) (hn : 0 < n) + (h : RankAtMost (directSum (fun _ : Fin k => + matrixCoefficients (K := K) (Fin n) (Fin n) (Fin n))) r) : + k * n ^ 2 ≤ r := by + let : Nonempty (Fin n) := ⟨⟨0, hn⟩⟩ + simpa only [Fintype.card_fin, pow_two] using directSum_matrixCoefficients_rank_lower h + +end Tensor +end MatrixMultiplication.Foundation + +end + + + + +noncomputable section + +open MatrixMultiplication.Foundation + +namespace MatrixMultiplication.TerminalRelabel + +variable {K I A B C I' A' B' C' : Type*} [CommSemiring K] + +def taggedPair (eI : I' ≃ I) (eA : A' ≃ A) (eB : B' ≃ B) : + I' × (A' × B') → I × (A × B) := + fun x => (eI x.1, (eA x.2.1, eB x.2.2)) + +theorem directSum_matrix_pullback + [DecidableEq I] [DecidableEq A] [DecidableEq B] [DecidableEq C] + [DecidableEq I'] [DecidableEq A'] [DecidableEq B'] [DecidableEq C'] + (eI : I' ≃ I) (eA : A' ≃ A) (eB : B' ≃ B) (eC : C' ≃ C) : + Tensor.pullback (taggedPair eI eA eB) (taggedPair eI eB eC) (taggedPair eI eC eA) + (Tensor.directSum (fun _ : I => Tensor.matrixCoefficients (K := K) A B C)) = + Tensor.directSum (fun _ : I' => Tensor.matrixCoefficients (K := K) A' B' C') := by + funext x y z + simp only [Tensor.pullback, taggedPair, Tensor.directSum, Tensor.matrixCoefficients, + eI.injective.eq_iff, eA.injective.eq_iff, eB.injective.eq_iff, eC.injective.eq_iff] + +theorem directSum_matrix_restrict_equiv + [Fintype I] [Fintype A] [Fintype B] [Fintype C] + [DecidableEq I] [DecidableEq A] [DecidableEq B] [DecidableEq C] + [DecidableEq I'] [DecidableEq A'] [DecidableEq B'] [DecidableEq C'] + (eI : I' ≃ I) (eA : A' ≃ A) (eB : B' ≃ B) (eC : C' ≃ C) : + Tensor.restrict + (fun x s => if s = taggedPair eI eA eB x then (1 : K) else 0) + (fun y s => if s = taggedPair eI eB eC y then (1 : K) else 0) + (fun z s => if s = taggedPair eI eC eA z then (1 : K) else 0) + (Tensor.directSum (fun _ : I => Tensor.matrixCoefficients (K := K) A B C)) = + Tensor.directSum (fun _ : I' => Tensor.matrixCoefficients (K := K) A' B' C') := by + rw [← Tensor.pullback_eq_restrict] + exact directSum_matrix_pullback eI eA eB eC + +theorem exists_directSum_matrix_restrict_equiv + [Fintype I] [Fintype A] [Fintype B] [Fintype C] + [DecidableEq I] [DecidableEq A] [DecidableEq B] [DecidableEq C] + [DecidableEq I'] [DecidableEq A'] [DecidableEq B'] [DecidableEq C'] + (eI : I' ≃ I) (eA : A' ≃ A) (eB : B' ≃ B) (eC : C' ≃ C) : + ∃ (a : (I' × (A' × B')) → (I × (A × B)) → K) + (b : (I' × (B' × C')) → (I × (B × C)) → K) + (c : (I' × (C' × A')) → (I × (C × A)) → K), + Tensor.restrict a b c + (Tensor.directSum (fun _ : I => Tensor.matrixCoefficients (K := K) A B C)) = + Tensor.directSum (fun _ : I' => Tensor.matrixCoefficients (K := K) A' B' C') := + ⟨_, _, _, directSum_matrix_restrict_equiv eI eA eB eC⟩ + +theorem directSum_matrix_restrict_of_card_eq + (I A B C : Type*) [Fintype I] [Fintype A] [Fintype B] [Fintype C] + [DecidableEq I] [DecidableEq A] [DecidableEq B] [DecidableEq C] + {L a b c : ℕ} (hI : Fintype.card I = L) (hA : Fintype.card A = a) + (hB : Fintype.card B = b) (hC : Fintype.card C = c) : + ∃ (aa : (Fin L × (Fin a × Fin b)) → (I × (A × B)) → K) + (bb : (Fin L × (Fin b × Fin c)) → (I × (B × C)) → K) + (cc : (Fin L × (Fin c × Fin a)) → (I × (C × A)) → K), + Tensor.restrict aa bb cc + (Tensor.directSum (fun _ : I => Tensor.matrixCoefficients (K := K) A B C)) = + Tensor.directSum (fun _ : Fin L => + Tensor.matrixCoefficients (K := K) (Fin a) (Fin b) (Fin c)) := + exists_directSum_matrix_restrict_equiv + (Fintype.equivFinOfCardEq hI).symm (Fintype.equivFinOfCardEq hA).symm + (Fintype.equivFinOfCardEq hB).symm (Fintype.equivFinOfCardEq hC).symm + +theorem directSum_matrix_restrict_fin + (I A B C : Type*) [Fintype I] [Fintype A] [Fintype B] [Fintype C] + [DecidableEq I] [DecidableEq A] [DecidableEq B] [DecidableEq C] : + ∃ (a : (Fin (Fintype.card I) × (Fin (Fintype.card A) × Fin (Fintype.card B))) → + (I × (A × B)) → K) + (b : (Fin (Fintype.card I) × (Fin (Fintype.card B) × Fin (Fintype.card C))) → + (I × (B × C)) → K) + (c : (Fin (Fintype.card I) × (Fin (Fintype.card C) × Fin (Fintype.card A))) → + (I × (C × A)) → K), + Tensor.restrict a b c + (Tensor.directSum (fun _ : I => Tensor.matrixCoefficients (K := K) A B C)) = + Tensor.directSum (fun _ : Fin (Fintype.card I) => + Tensor.matrixCoefficients (K := K) + (Fin (Fintype.card A)) (Fin (Fintype.card B)) (Fin (Fintype.card C))) := + directSum_matrix_restrict_of_card_eq I A B C rfl rfl rfl rfl + +end MatrixMultiplication.TerminalRelabel + +end +end + +end MatrixAllFields + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/Arithmetic/CommonDimensions.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/Arithmetic/CommonDimensions.lean new file mode 100644 index 0000000000000000000000000000000000000000..b687b5dcec855b3338204a41294412b658c09712 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/Arithmetic/CommonDimensions.lean @@ -0,0 +1,85 @@ +import OAI.LinearAlgebra.MatrixMultiplication.Tensor.ComplexMatrixTensor +import Mathlib.Data.Fintype.Pi + +namespace OAI + +/-! Division-free arithmetic programs over a field and their operation counts. -/ + +open scoped BigOperators +open MatrixMultiplication.Foundation + +namespace MatrixMultiplication.CommonDimensions + +variable {K H : Type*} [CommSemiring K] [Fintype H] [DecidableEq H] + +def familyProduct {X Y Z : H → Type*} (T : ∀ h, Tensor K (X h) (Y h) (Z h)) : + Tensor K (∀ h, X h) (∀ h, Y h) (∀ h, Z h) := + fun x y z => ∏ h, T h (x h) (y h) (z h) + +def pairWords (A B : H → Type*) : + ((∀ h, A h) × (∀ h, B h)) ≃ (∀ h, A h × B h) where + toFun x h := (x.1 h, x.2 h) + invFun x := (fun h => (x h).1, fun h => (x h).2) + left_inv _ := rfl + right_inv _ := rfl + +omit [DecidableEq H] in +theorem matrix_familyProduct (A B C : H → Type*) + [∀ h, DecidableEq (A h)] [∀ h, DecidableEq (B h)] [∀ h, DecidableEq (C h)] : + Tensor.pullback (pairWords A B) (pairWords B C) (pairWords C A) + (familyProduct (fun h => Tensor.matrixCoefficients (K := K) (A h) (B h) (C h))) = + Tensor.matrixCoefficients (∀ h, A h) (∀ h, B h) (∀ h, C h) := by + classical + funext x y z + simp only [Tensor.pullback, pairWords, familyProduct, Tensor.matrixCoefficients, + Equiv.coe_fn_mk] + by_cases h : x.2 = y.1 ∧ y.2 = z.1 ∧ z.2 = x.1 + · rw [ite_eq_left h] + apply Finset.prod_eq_one + intro i _ + exact ite_eq_left ⟨congrFun h.1 i, congrFun h.2.1 i, congrFun h.2.2 i⟩ + · rw [ite_eq_right h] + have hn : ¬ ∀ i, x.2 i = y.1 i ∧ y.2 i = z.1 i ∧ z.2 i = x.1 i := by + intro hi + exact h ⟨funext (fun i => (hi i).1), funext (fun i => (hi i).2.1), + funext (fun i => (hi i).2.2)⟩ + obtain ⟨i, hi⟩ := not_forall.mp hn + apply Finset.prod_eq_zero (Finset.mem_univ i) + exact ite_eq_right hi + +theorem matrix_familyProduct_restrict (A B C : H → Type*) + [∀ h, Fintype (A h)] [∀ h, Fintype (B h)] [∀ h, Fintype (C h)] + [∀ h, DecidableEq (A h)] [∀ h, DecidableEq (B h)] [∀ h, DecidableEq (C h)] : + ∃ (a : ((∀ h, A h) × (∀ h, B h)) → (∀ h, A h × B h) → K) + (b : ((∀ h, B h) × (∀ h, C h)) → (∀ h, B h × C h) → K) + (c : ((∀ h, C h) × (∀ h, A h)) → (∀ h, C h × A h) → K), + Tensor.restrict a b c + (familyProduct (fun h => Tensor.matrixCoefficients (K := K) (A h) (B h) (C h))) = + Tensor.matrixCoefficients (∀ h, A h) (∀ h, B h) (∀ h, C h) := by + classical + refine ⟨(fun x s => if s = pairWords A B x then 1 else 0), + (fun y s => if s = pairWords B C y then 1 else 0), + (fun z s => if s = pairWords C A z then 1 else 0), ?_⟩ + rw [← Tensor.pullback_eq_restrict] + exact matrix_familyProduct A B C + +theorem dimension_card (a : H → ℕ) : + Fintype.card (∀ h, Fin (a h)) = ∏ h, a h := by simp + +theorem volume_card (a b c : H → ℕ) : + Fintype.card (∀ h, Fin (a h)) * Fintype.card (∀ h, Fin (b h)) * + Fintype.card (∀ h, Fin (c h)) = ∏ h, a h * b h * c h := by + simp [Finset.prod_mul_distrib] + +theorem common_oriented_dimensions {S : Type*} + (a b c : S → H → ℕ) (a₀ b₀ c₀ : H → ℕ) + (ha : ∀ s h, a s h = a₀ h) (hb : ∀ s h, b s h = b₀ h) + (hc : ∀ s h, c s h = c₀ h) (s : S) : + (Fintype.card (∀ h, Fin (a s h)), Fintype.card (∀ h, Fin (b s h)), + Fintype.card (∀ h, Fin (c s h))) = + (∏ h, a₀ h, ∏ h, b₀ h, ∏ h, c₀ h) := by + simp [ha, hb, hc] + +end MatrixMultiplication.CommonDimensions + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/Arithmetic/Compatibility.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/Arithmetic/Compatibility.lean new file mode 100644 index 0000000000000000000000000000000000000000..69245f5cb65aff03f61a4446be8cc459a895be49 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/Arithmetic/Compatibility.lean @@ -0,0 +1,180 @@ +import OAI.LinearAlgebra.MatrixMultiplication.Arithmetic.Complexity +import OAI.LinearAlgebra.MatrixMultiplication.ComplexArithmetic.Exponent + +namespace OAI + +/-! Division-free arithmetic programs over a field and their operation counts. -/ + +noncomputable section + +namespace MatrixMultiplication.Arithmetic + +namespace Gate + +variable {Input Register : Type*} + +def toLegacy : Gate ℂ Input Register → MatrixMultiplication.Foundation.Arithmetic.Gate Input Register + | .constant z => .constant z + | .input i => .input i + | .add i j => .add i j + | .sub i j => .sub i j + | .mul i j => .mul i j + +def ofLegacy : MatrixMultiplication.Foundation.Arithmetic.Gate Input Register → Gate ℂ Input Register + | .constant z => .constant z + | .input i => .input i + | .add i j => .add i j + | .sub i j => .sub i j + | .mul i j => .mul i j + +@[simp] theorem eval_toLegacy (g : Gate ℂ Input Register) + (inputs : Input → ℂ) (registers : Register → ℂ) : + g.toLegacy.eval inputs registers = g.eval inputs registers := by + cases g <;> rfl + +@[simp] theorem cost_toLegacy (g : Gate ℂ Input Register) : g.toLegacy.cost = g.cost := by + cases g <;> rfl + +@[simp] theorem eval_ofLegacy (g : MatrixMultiplication.Foundation.Arithmetic.Gate Input Register) + (inputs : Input → ℂ) (registers : Register → ℂ) : + (ofLegacy g).eval inputs registers = g.eval inputs registers := by + cases g <;> rfl + +@[simp] theorem cost_ofLegacy (g : MatrixMultiplication.Foundation.Arithmetic.Gate Input Register) : + (ofLegacy g).cost = g.cost := by + cases g <;> rfl + +end Gate + +namespace Program + +variable {Input : Type*} + +def toLegacy : {r : ℕ} → Program ℂ Input r → MatrixMultiplication.Foundation.Arithmetic.Program Input r + | 0, .nil => .nil + | _ + 1, .step p g => p.toLegacy.step g.toLegacy + +def ofLegacy : {r : ℕ} → MatrixMultiplication.Foundation.Arithmetic.Program Input r → Program ℂ Input r + | 0, .nil => .nil + | _ + 1, .step p g => (ofLegacy p).step (Gate.ofLegacy g) + +@[simp] theorem eval_toLegacy {r : ℕ} (p : Program ℂ Input r) (inputs : Input → ℂ) : + p.toLegacy.eval inputs = p.eval inputs := by + induction p with + | nil => rfl + | step p g ih => + funext i + refine Fin.cases ?_ (fun j => ?_) i + · simp only [toLegacy, MatrixMultiplication.Foundation.Arithmetic.Program.eval_step_zero, + eval_step_zero, Gate.eval_toLegacy, ih] + · simp only [toLegacy, MatrixMultiplication.Foundation.Arithmetic.Program.eval_step_succ, + eval_step_succ, ih] + +@[simp] theorem cost_toLegacy {r : ℕ} (p : Program ℂ Input r) : p.toLegacy.cost = p.cost := by + induction p with + | nil => rfl + | step p g ih => simp only [toLegacy, MatrixMultiplication.Foundation.Arithmetic.Program.cost_step, + cost_step, Gate.cost_toLegacy, ih] + +@[simp] theorem eval_ofLegacy {r : ℕ} + (p : MatrixMultiplication.Foundation.Arithmetic.Program Input r) (inputs : Input → ℂ) : + (ofLegacy p).eval inputs = p.eval inputs := by + induction p with + | nil => rfl + | step p g ih => + funext i + refine Fin.cases ?_ (fun j => ?_) i + · simp only [ofLegacy, MatrixMultiplication.Foundation.Arithmetic.Program.eval_step_zero, + eval_step_zero, Gate.eval_ofLegacy, ih] + · simp only [ofLegacy, MatrixMultiplication.Foundation.Arithmetic.Program.eval_step_succ, + eval_step_succ, ih] + +@[simp] theorem cost_ofLegacy {r : ℕ} + (p : MatrixMultiplication.Foundation.Arithmetic.Program Input r) : (ofLegacy p).cost = p.cost := by + induction p with + | nil => rfl + | step p g ih => simp only [ofLegacy, MatrixMultiplication.Foundation.Arithmetic.Program.cost_step, + cost_step, Gate.cost_ofLegacy, ih] + +end Program + +namespace MatrixAlgorithm + +def toLegacy {n : ℕ} (P : MatrixAlgorithm ℂ n n n) : + MatrixMultiplication.Foundation.Arithmetic.MatrixAlgorithm n := + ⟨P.registers, P.program.toLegacy, P.output⟩ + +def ofLegacy {n : ℕ} (P : MatrixMultiplication.Foundation.Arithmetic.MatrixAlgorithm n) : + MatrixAlgorithm ℂ n n n := + ⟨P.registers, Program.ofLegacy P.program, P.output⟩ + +@[simp] theorem eval_toLegacy {n : ℕ} (P : MatrixAlgorithm ℂ n n n) + (A B : Matrix (Fin n) (Fin n) ℂ) : P.toLegacy.eval A B = P.eval A B := by + funext i k + have hin : MatrixMultiplication.Foundation.Arithmetic.matrixInputs A B = matrixInputs A B := by + funext x + cases x <;> rfl + change P.program.toLegacy.eval (MatrixMultiplication.Foundation.Arithmetic.matrixInputs A B) + (P.output i k) = P.program.eval (matrixInputs A B) (P.output i k) + rw [hin] + exact congrFun (P.program.eval_toLegacy (matrixInputs A B)) (P.output i k) + +@[simp] theorem eval_ofLegacy {n : ℕ} + (P : MatrixMultiplication.Foundation.Arithmetic.MatrixAlgorithm n) + (A B : Matrix (Fin n) (Fin n) ℂ) : (ofLegacy P).eval A B = P.eval A B := by + funext i k + have hin : MatrixMultiplication.Foundation.Arithmetic.matrixInputs A B = matrixInputs A B := by + funext x + cases x <;> rfl + change (Program.ofLegacy P.program).eval (matrixInputs A B) (P.output i k) = + P.program.eval (MatrixMultiplication.Foundation.Arithmetic.matrixInputs A B) (P.output i k) + rw [hin] + exact congrFun (Program.eval_ofLegacy P.program (matrixInputs A B)) (P.output i k) + +theorem toLegacy_correct {n : ℕ} {P : MatrixAlgorithm ℂ n n n} + (hP : P.Correct) : P.toLegacy.Correct := by + intro A B + exact (P.eval_toLegacy A B).trans (hP A B) + +theorem ofLegacy_correct {n : ℕ} {P : MatrixMultiplication.Foundation.Arithmetic.MatrixAlgorithm n} + (hP : P.Correct) : (ofLegacy P).Correct := by + intro A B + exact (eval_ofLegacy P A B).trans (hP A B) + +@[simp] theorem cost_toLegacy {n : ℕ} (P : MatrixAlgorithm ℂ n n n) : + P.toLegacy.cost = P.cost := P.program.cost_toLegacy + +@[simp] theorem cost_ofLegacy {n : ℕ} + (P : MatrixMultiplication.Foundation.Arithmetic.MatrixAlgorithm n) : + (ofLegacy P).cost = P.cost := Program.cost_ofLegacy P.program + +end MatrixAlgorithm + +theorem complex_admissibleExponent_iff (τ : ℝ) : + AdmissibleExponent ℂ τ ↔ MatrixMultiplication.Foundation.Arithmetic.AdmissibleExponent τ := by + constructor + · intro h ε hε + obtain ⟨C, hC, hbound⟩ := h ε hε + refine ⟨C, hC, ?_⟩ + intro n hn + obtain ⟨P, hP, hcost⟩ := hbound n hn + exact ⟨P.toLegacy, MatrixAlgorithm.toLegacy_correct hP, by simpa using hcost⟩ + · intro h ε hε + obtain ⟨C, hC, hbound⟩ := h ε hε + refine ⟨C, hC, ?_⟩ + intro n hn + obtain ⟨P, hP, hcost⟩ := hbound n hn + exact ⟨MatrixAlgorithm.ofLegacy P, MatrixAlgorithm.ofLegacy_correct hP, + by simpa using hcost⟩ + +theorem complex_omega_eq : omega ℂ = MatrixMultiplication.Foundation.Arithmetic.omega := by + unfold omega MatrixMultiplication.Foundation.Arithmetic.omega + congr 1 + ext τ + exact complex_admissibleExponent_iff τ + +end MatrixMultiplication.Arithmetic + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/Arithmetic/Complexity.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/Arithmetic/Complexity.lean new file mode 100644 index 0000000000000000000000000000000000000000..3c615a48bd5b7848564db0c5934f9e598998f310 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/Arithmetic/Complexity.lean @@ -0,0 +1,109 @@ +import OAI.LinearAlgebra.MatrixMultiplication.Model +import OAI.LinearAlgebra.MatrixMultiplication.ComplexArithmetic.Complexity +import Mathlib.Algebra.Order.Floor.Semiring + +namespace OAI + +/-! Division-free arithmetic programs over a field and their operation counts. -/ + +noncomputable section + +open scoped BigOperators + +namespace MatrixMultiplication.Arithmetic + +namespace Gate + +variable {F Input Register : Type*} + +end Gate + +namespace Program + +variable {F Input : Type*} + +@[simp] theorem eval_step_zero [Field F] {r : ℕ} (p : Program F Input r) + (g : Gate F Input (Fin r)) (inputs : Input → F) : + (p.step g).eval inputs 0 = g.eval inputs (p.eval inputs) := rfl + +@[simp] theorem eval_step_succ [Field F] {r : ℕ} (p : Program F Input r) + (g : Gate F Input (Fin r)) (inputs : Input → F) (i : Fin r) : + (p.step g).eval inputs i.succ = p.eval inputs i := rfl + +@[simp] theorem cost_step {r : ℕ} (p : Program F Input r) + (g : Gate F Input (Fin r)) : (p.step g).cost = p.cost + g.cost := rfl + +end Program + +namespace MatrixAlgorithm + +variable {F : Type*} [Field F] {a b c : ℕ} + +theorem correct_iff_entries (P : MatrixAlgorithm F a b c) : + P.Correct ↔ ∀ (A : Matrix (Fin a) (Fin b) F) (B : Matrix (Fin b) (Fin c) F) + (i : Fin a) (k : Fin c), + P.program.eval (matrixInputs A B) (P.output i k) = ∑ j, A i j * B j k := by + constructor + · intro h A B i k + exact congrFun (congrFun (h A B) i) k + · intro h A B + funext i k + exact h A B i k + +end MatrixAlgorithm + +def scalarAlgorithm (F : Type*) [Field F] : MatrixAlgorithm F 1 1 1 where + registers := 3 + program := ((Program.nil.step (.input (.inl (0, 0)))).step + (.input (.inr (0, 0)))).step (.mul 1 0) + output := fun _ _ => 0 + +theorem scalarAlgorithm_correct (F : Type*) [Field F] : (scalarAlgorithm F).Correct := by + intro A B + funext i k + have hi : i = 0 := Subsingleton.elim _ _ + have hk : k = 0 := Subsingleton.elim _ _ + subst i + subst k + change A 0 0 * B 0 0 = (A * B) 0 0 + simp [Matrix.mul_apply] + +@[simp] theorem scalarAlgorithm_cost (F : Type*) [Field F] : (scalarAlgorithm F).cost = 1 := rfl + +theorem one_le_innerSize {n : ℕ} (hn : 1 ≤ n) (k : ℝ) : 1 ≤ innerSize n k := by + apply Nat.one_le_ceil_iff.mpr + exact Real.rpow_pos_of_pos (by exact_mod_cast (lt_of_lt_of_le Nat.zero_lt_one hn)) k + +@[simp] theorem innerSize_zero (n : ℕ) : innerSize n 0 = 1 := by + simp [innerSize] + +@[simp] theorem innerSize_one (n : ℕ) : innerSize n 1 = n := by + simp [innerSize] + +theorem innerSize_mono {n : ℕ} (hn : 1 ≤ n) {k l : ℝ} (hkl : k ≤ l) : + innerSize n k ≤ innerSize n l := by + exact Nat.ceil_mono (Real.rpow_le_rpow_of_exponent_le (by exact_mod_cast hn) hkl) + +theorem innerSize_le_pow {a b n t : ℕ} {k : ℝ} (hk : 0 ≤ k) + (hn : n ≤ a ^ t) (hab : (a : ℝ) ^ k ≤ b) : innerSize n k ≤ b ^ t := by + apply Nat.ceil_le.mpr + calc + (n : ℝ) ^ k ≤ ((a ^ t : ℕ) : ℝ) ^ k := + Real.rpow_le_rpow (Nat.cast_nonneg n) (by exact_mod_cast hn) hk + _ = ((a : ℝ) ^ k) ^ t := by + rw [Nat.cast_pow, ← Real.rpow_pow_comm (Nat.cast_nonneg a)] + _ ≤ (b : ℝ) ^ t := pow_le_pow_left₀ (Real.rpow_nonneg (Nat.cast_nonneg a) k) hab t + _ = ((b ^ t : ℕ) : ℝ) := by rw [Nat.cast_pow] + +theorem innerSize_cast_le {n : ℕ} (hn : 1 ≤ n) {k : ℝ} (hk : 0 ≤ k) : + (innerSize n k : ℝ) ≤ 2 * (n : ℝ) ^ k := by + have hpow : 1 ≤ (n : ℝ) ^ k := Real.one_le_rpow (by exact_mod_cast hn) hk + have hceil := (Nat.ceil_lt_add_one (Real.rpow_nonneg (Nat.cast_nonneg n) k)).le + change (⌈(n : ℝ) ^ k⌉₊ : ℝ) ≤ _ + linarith + +end MatrixMultiplication.Arithmetic + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/Arithmetic/Exponent.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/Arithmetic/Exponent.lean new file mode 100644 index 0000000000000000000000000000000000000000..15fc85efb147227da9bf361f1999623b1393db2a --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/Arithmetic/Exponent.lean @@ -0,0 +1,159 @@ +import OAI.LinearAlgebra.MatrixMultiplication.Arithmetic.NaiveAlgorithm +import OAI.LinearAlgebra.MatrixMultiplication.Arithmetic.LowerBound +import OAI.LinearAlgebra.MatrixMultiplication.Arithmetic.Padding + +namespace OAI + +/-! Division-free arithmetic programs over a field and their operation counts. -/ + +noncomputable section + +namespace MatrixMultiplication.Arithmetic + +variable {F : Type*} [Field F] + +theorem AdmissibleExponent.mono {τ σ : ℝ} (hτ : AdmissibleExponent F τ) + (hτσ : τ ≤ σ) : AdmissibleExponent F σ := by + intro ε hε + obtain ⟨C, hC, hbound⟩ := hτ ε hε + refine ⟨C, hC, ?_⟩ + intro n hn + obtain ⟨P, hP, hcost⟩ := hbound n hn + refine ⟨P, hP, hcost.trans ?_⟩ + apply mul_le_mul_of_nonneg_left _ hC.le + exact Real.rpow_le_rpow_of_exponent_le (by exact_mod_cast hn) + (add_le_add_left hτσ ε) + +theorem omega_two_le : 2 ≤ omega F := + le_csInf admissibleExponent_nonempty (fun _ hτ => admissibleExponent_two_le hτ) + +theorem omega_nonneg : 0 ≤ omega F := le_trans (by norm_num) omega_two_le + +theorem omega_le_three : omega F ≤ 3 := + omega_le_of_admissibleExponent admissibleExponent_three + +theorem omega_admissibleExponent : AdmissibleExponent F (omega F) := by + intro ε hε + have hhalf : 0 < ε / 2 := half_pos hε + obtain ⟨τ, hτ, hclose⟩ := exists_lt_of_csInf_lt admissibleExponent_nonempty + (show sInf {σ : ℝ | AdmissibleExponent F σ} < omega F + ε / 2 from + lt_add_of_pos_right (omega F) hhalf) + obtain ⟨C, hC, hbound⟩ := hτ (ε / 2) hhalf + refine ⟨C, hC, ?_⟩ + intro n hn + obtain ⟨P, hP, hcost⟩ := hbound n hn + refine ⟨P, hP, hcost.trans ?_⟩ + apply mul_le_mul_of_nonneg_left _ hC.le + exact Real.rpow_le_rpow_of_exponent_le (by exact_mod_cast hn) (by linarith) + +theorem admissibleExponent_iff_omega_le {τ : ℝ} : + AdmissibleExponent F τ ↔ omega F ≤ τ := + ⟨omega_le_of_admissibleExponent, omega_admissibleExponent.mono⟩ + +theorem RectangularAdmissibleExponent.mono {k τ σ : ℝ} + (hτ : RectangularAdmissibleExponent F k τ) (hτσ : τ ≤ σ) : + RectangularAdmissibleExponent F k σ := by + intro ε hε + obtain ⟨C, hC, hbound⟩ := hτ ε hε + refine ⟨C, hC, ?_⟩ + intro n hn + obtain ⟨P, hP, hcost⟩ := hbound n hn + refine ⟨P, hP, hcost.trans ?_⟩ + apply mul_le_mul_of_nonneg_left _ hC.le + exact Real.rpow_le_rpow_of_exponent_le (by exact_mod_cast hn) + (add_le_add_left hτσ ε) + +theorem rectangularAdmissibleExponent_of_uniform_costs {k τ C : ℝ} (hC : 0 < C) + (hbound : ∀ n : ℕ, 1 ≤ n → ∃ P : MatrixAlgorithm F n (innerSize n k) n, + P.Correct ∧ (P.cost : ℝ) ≤ C * (n : ℝ) ^ τ) : + RectangularAdmissibleExponent F k τ := by + intro ε hε + refine ⟨C, hC, ?_⟩ + intro n hn + obtain ⟨P, hP, hcost⟩ := hbound n hn + refine ⟨P, hP, hcost.trans ?_⟩ + apply mul_le_mul_of_nonneg_left _ hC.le + exact Real.rpow_le_rpow_of_exponent_le (by exact_mod_cast hn) + (le_add_of_nonneg_right hε.le) + +theorem rectangularAdmissibleExponent_naive (k : ℝ) : + RectangularAdmissibleExponent F k (2 + max k 0) := by + apply rectangularAdmissibleExponent_of_uniform_costs (C := 4) (by norm_num) + intro n hn + refine ⟨naiveAlgorithm n (innerSize n k) n, + naiveAlgorithm_correct n (innerSize n k) n, ?_⟩ + have hnpos : 0 < (n : ℝ) := by exact_mod_cast (lt_of_lt_of_le Nat.zero_lt_one hn) + have hinner : (innerSize n k : ℝ) ≤ 2 * (n : ℝ) ^ max k 0 := + (Nat.cast_le.mpr (innerSize_mono hn (le_max_left k 0))).trans + (innerSize_cast_le hn (le_max_right k 0)) + rw [naiveAlgorithm_cost] + push_cast + calc + 2 * (n : ℝ) * innerSize n k * n = 2 * (n : ℝ) ^ 2 * innerSize n k := by ring + _ ≤ 2 * (n : ℝ) ^ 2 * (2 * (n : ℝ) ^ max k 0) := + mul_le_mul_of_nonneg_left hinner (by positivity) + _ = 4 * (n : ℝ) ^ (2 + max k 0) := by + rw [Real.rpow_add hnpos] + norm_num + ring + +theorem rectangularAdmissibleExponent_nonempty (k : ℝ) : + Set.Nonempty {τ : ℝ | RectangularAdmissibleExponent F k τ} := + ⟨2 + max k 0, rectangularAdmissibleExponent_naive k⟩ + +theorem rectangularOmega_two_le (k : ℝ) : 2 ≤ rectangularOmega F k := + le_csInf (rectangularAdmissibleExponent_nonempty k) + (fun _ hτ => rectangularAdmissibleExponent_two_le hτ) + +theorem rectangularOmega_admissibleExponent (k : ℝ) : + RectangularAdmissibleExponent F k (rectangularOmega F k) := by + intro ε hε + have hhalf : 0 < ε / 2 := half_pos hε + obtain ⟨τ, hτ, hclose⟩ := exists_lt_of_csInf_lt (rectangularAdmissibleExponent_nonempty k) + (show sInf {σ : ℝ | RectangularAdmissibleExponent F k σ} < + rectangularOmega F k + ε / 2 from lt_add_of_pos_right (rectangularOmega F k) hhalf) + obtain ⟨C, hC, hbound⟩ := hτ (ε / 2) hhalf + refine ⟨C, hC, ?_⟩ + intro n hn + obtain ⟨P, hP, hcost⟩ := hbound n hn + refine ⟨P, hP, hcost.trans ?_⟩ + apply mul_le_mul_of_nonneg_left _ hC.le + exact Real.rpow_le_rpow_of_exponent_le (by exact_mod_cast hn) (by linarith) + +theorem rectangularAdmissibleExponent_iff_omega_le {k τ : ℝ} : + RectangularAdmissibleExponent F k τ ↔ rectangularOmega F k ≤ τ := + ⟨rectangularOmega_le_of_admissibleExponent, (rectangularOmega_admissibleExponent k).mono⟩ + +theorem rectangularOmega_mono {k l : ℝ} (hkl : k ≤ l) : + rectangularOmega F k ≤ rectangularOmega F l := + rectangularOmega_le_of_admissibleExponent + ((rectangularOmega_admissibleExponent l).mono_aspect hkl) + +@[simp] theorem rectangularOmega_zero : rectangularOmega F 0 = 2 := by + apply le_antisymm _ (rectangularOmega_two_le 0) + apply rectangularOmega_le_of_admissibleExponent + simpa using (rectangularAdmissibleExponent_naive (F := F) 0) + +theorem complexAlpha_set_nonempty : + Set.Nonempty {k : ℝ | k ∈ Set.Icc 0 1 ∧ rectangularOmega ℂ k = 2} := + ⟨0, ⟨by norm_num, by norm_num⟩, rectangularOmega_zero⟩ + +theorem complexAlpha_set_bddAbove : + BddAbove {k : ℝ | k ∈ Set.Icc 0 1 ∧ rectangularOmega ℂ k = 2} := + ⟨1, fun _ h => h.1.2⟩ + +theorem le_complexAlpha {k : ℝ} (hk : k ∈ Set.Icc 0 1) + (hω : rectangularOmega ℂ k = 2) : k ≤ complexAlpha := + le_csSup complexAlpha_set_bddAbove ⟨hk, hω⟩ + +theorem complexAlpha_le_one : complexAlpha ≤ 1 := + csSup_le complexAlpha_set_nonempty (fun _ h => h.1.2) + +theorem complexAlpha_nonneg : 0 ≤ complexAlpha := + le_complexAlpha ⟨le_refl 0, by norm_num⟩ rectangularOmega_zero + +end MatrixMultiplication.Arithmetic + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/Arithmetic/LowerBound.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/Arithmetic/LowerBound.lean new file mode 100644 index 0000000000000000000000000000000000000000..b6c0e4cf28c999f819b58d5545570483c5c2500d --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/Arithmetic/LowerBound.lean @@ -0,0 +1,222 @@ +import OAI.LinearAlgebra.MatrixMultiplication.Arithmetic.Complexity +import Mathlib.Algebra.Order.BigOperators.Group.Finset +import Mathlib.Tactic.Linarith +import Lean.Elab.Tactic.Omega + +namespace OAI + +/-! Division-free arithmetic programs over a field and their operation counts. -/ + +noncomputable section + +open scoped BigOperators + +namespace MatrixMultiplication.Arithmetic + +namespace Program + +variable {F Input : Type*} + +def registerCost : {r : ℕ} → Program F Input r → Fin r → ℕ + | 0, .nil => Fin.elim0 + | _ + 1, .step p g => Fin.cases g.cost p.registerCost + +theorem sum_registerCost {r : ℕ} (p : Program F Input r) : + ∑ i, p.registerCost i = p.cost := by + induction p with + | nil => simp [registerCost, cost] + | step p g ih => simp [registerCost, Fin.sum_univ_succ, ih, Nat.add_comm] + +theorem eval_eq_constant_or_input_of_registerCost_eq_zero [Field F] + {r : ℕ} (p : Program F Input r) (i : Fin r) (hi : p.registerCost i = 0) : + (∃ z : F, ∀ inputs, p.eval inputs i = z) ∨ + (∃ a : Input, ∀ inputs, p.eval inputs i = inputs a) := by + revert i + induction p with + | nil => intro i; exact Fin.elim0 i + | @step r p g ih => + intro i hi + revert hi + refine Fin.cases ?_ (fun j => ?_) i + · intro hi + change g.cost = 0 at hi + cases g with + | constant z => exact Or.inl ⟨z, fun _ => rfl⟩ + | input a => exact Or.inr ⟨a, fun _ => rfl⟩ + | add a b => simp [Gate.cost] at hi + | sub a b => simp [Gate.cost] at hi + | mul a b => simp [Gate.cost] at hi + · intro hi + simpa only [eval_step_succ] using ih j hi + +end Program + +section ElementaryMatrices + +variable {F : Type*} [Field F] {a b c : ℕ} + +def elementaryLeft (i : Fin a) (j : Fin b) : Matrix (Fin a) (Fin b) F := + fun x y => if x = i then if y = j then 1 else 0 else 0 + +def elementaryRight (j : Fin b) (k : Fin c) : Matrix (Fin b) (Fin c) F := + fun y z => if z = k then if y = j then 1 else 0 else 0 + +theorem elementaryProduct (i x : Fin a) (j : Fin b) (k z : Fin c) : + (elementaryLeft (F := F) i j * elementaryRight (F := F) j k) x z = + if (x, z) = (i, k) then 1 else 0 := by + by_cases hi : x = i <;> by_cases hk : z = k <;> + simp [Matrix.mul_apply, elementaryLeft, elementaryRight, hi, hk] + +end ElementaryMatrices + +namespace MatrixAlgorithm + +variable {F : Type*} [Field F] {a b c : ℕ} + +theorem output_injective (P : MatrixAlgorithm F a b c) (hb : 1 ≤ b) + (hP : P.Correct) : Function.Injective (fun o : Fin a × Fin c => P.output o.1 o.2) := by + classical + intro x y hxy + change P.output x.1 x.2 = P.output y.1 y.2 at hxy + let j : Fin b := ⟨0, by omega⟩ + let A := elementaryLeft (F := F) x.1 j + let B := elementaryRight (F := F) j x.2 + have hx := congrFun (congrFun (hP A B) x.1) x.2 + have hy := congrFun (congrFun (hP A B) y.1) y.2 + have heq : (A * B) x.1 x.2 = (A * B) y.1 y.2 := by + rw [← hx, ← hy] + change P.program.eval (matrixInputs A B) (P.output x.1 x.2) = + P.program.eval (matrixInputs A B) (P.output y.1 y.2) + rw [hxy] + simp only [A, B, elementaryProduct, Prod.eta, ite_true] at heq + by_contra hne + have hyx : y ≠ x := Ne.symm hne + simp [hyx] at heq + +theorem one_le_output_registerCost (P : MatrixAlgorithm F a b c) (hb : 1 ≤ b) + (hP : P.Correct) (i : Fin a) (k : Fin c) : + 1 ≤ P.program.registerCost (P.output i k) := by + by_contra hn + have hzero : P.program.registerCost (P.output i k) = 0 := by omega + let j : Fin b := ⟨0, by omega⟩ + have hentry (A : Matrix (Fin a) (Fin b) F) (B : Matrix (Fin b) (Fin c) F) : + P.program.eval (matrixInputs A B) (P.output i k) = (A * B) i k := + congrFun (congrFun (hP A B) i) k + rcases P.program.eval_eq_constant_or_input_of_registerCost_eq_zero + (P.output i k) hzero with ⟨z, hz⟩ | ⟨u, hu⟩ + · have hz0 : z = 0 := by + have h := hentry 0 0 + rw [hz] at h + simpa using h + have hz1 : z = 1 := by + have h := hentry (elementaryLeft i j) (elementaryRight j k) + rw [hz] at h + simpa only [elementaryProduct, ite_true] using h + exact (zero_ne_one : (0 : F) ≠ 1) (hz0.symm.trans hz1) + · rcases u with ⟨x, y⟩ | ⟨y, z⟩ + · have h := hentry (Matrix.of fun _ _ => 1) 0 + rw [hu] at h + simp [matrixInputs, Matrix.mul_apply] at h + · have h := hentry 0 (Matrix.of fun _ _ => 1) + rw [hu] at h + simp [matrixInputs, Matrix.mul_apply] at h + +theorem output_size_le_cost (P : MatrixAlgorithm F a b c) (hb : 1 ≤ b) + (hP : P.Correct) : a * c ≤ P.cost := by + classical + let f : Fin a × Fin c → Fin P.registers := fun o => P.output o.1 o.2 + have hf : Function.Injective f := P.output_injective hb hP + calc + a * c = ∑ _o : Fin a × Fin c, (1 : ℕ) := by simp + _ ≤ ∑ o : Fin a × Fin c, P.program.registerCost (f o) := by + apply Finset.sum_le_sum + intro o ho + exact P.one_le_output_registerCost hb hP o.1 o.2 + _ = ∑ r ∈ Finset.univ.image f, P.program.registerCost r := by + rw [Finset.sum_image] + exact fun _ _ _ _ h => hf h + _ ≤ ∑ r, P.program.registerCost r := + Finset.sum_le_sum_of_subset (Finset.subset_univ _) + _ = P.cost := P.program.sum_registerCost + +end MatrixAlgorithm + +theorem rectangularAdmissibleExponent_two_le {F : Type*} [Field F] {k τ : ℝ} + (hτ : RectangularAdmissibleExponent F k τ) : 2 ≤ τ := by + by_contra hneg + have hτlt : τ < 2 := lt_of_not_ge hneg + let ε : ℝ := (2 - τ) / 2 + have hε : 0 < ε := by dsimp [ε]; linarith + obtain ⟨C, hC, hbound⟩ := hτ ε hε + obtain ⟨n, hn⟩ := exists_nat_gt (max (C ^ ε⁻¹) 1) + have hnreal : 1 < (n : ℝ) := lt_of_le_of_lt (le_max_right _ _) hn + have hnpos : 0 < (n : ℝ) := lt_trans zero_lt_one hnreal + have hn1 : 1 ≤ n := (Nat.one_le_cast (α := ℝ)).mp hnreal.le + have hpow : C < (n : ℝ) ^ ε := + (Real.rpow_inv_lt_iff_of_pos hC.le (Nat.cast_nonneg n) hε).mp + (lt_of_le_of_lt (le_max_left _ _) hn) + obtain ⟨P, hP, hcost⟩ := hbound n hn1 + have hlower : (n : ℝ) ^ (2 : ℕ) ≤ P.cost := by + have h : n ^ 2 ≤ P.cost := by + simpa [pow_two] using P.output_size_le_cost (one_le_innerSize hn1 k) hP + exact_mod_cast h + have hstrict : (n : ℝ) ^ (2 : ℕ) < (n : ℝ) ^ (2 : ℕ) := calc + (n : ℝ) ^ (2 : ℕ) ≤ C * (n : ℝ) ^ (τ + ε) := hlower.trans hcost + _ < (n : ℝ) ^ ε * (n : ℝ) ^ (τ + ε) := + mul_lt_mul_of_pos_right hpow (Real.rpow_pos_of_pos hnpos _) + _ = (n : ℝ) ^ (2 : ℕ) := by + rw [← Real.rpow_add hnpos] + have he : ε + (τ + ε) = 2 := by dsimp [ε]; ring + rw [he] + norm_num + exact (lt_irrefl _ hstrict) + +theorem rectangularAdmissibleExponent_bddBelow (F : Type*) [Field F] (k : ℝ) : + BddBelow {τ : ℝ | RectangularAdmissibleExponent F k τ} := + ⟨2, fun _ h => rectangularAdmissibleExponent_two_le h⟩ + +theorem rectangularOmega_le_of_admissibleExponent {F : Type*} [Field F] {k τ : ℝ} + (hτ : RectangularAdmissibleExponent F k τ) : rectangularOmega F k ≤ τ := + csInf_le (rectangularAdmissibleExponent_bddBelow F k) hτ + +theorem admissibleExponent_iff_rectangular_one (F : Type*) [Field F] (τ : ℝ) : + AdmissibleExponent F τ ↔ RectangularAdmissibleExponent F 1 τ := by + constructor + · intro h ε hε + obtain ⟨C, hC, hbound⟩ := h ε hε + refine ⟨C, hC, ?_⟩ + intro n hn + rw [innerSize_one] + exact hbound n hn + · intro h ε hε + obtain ⟨C, hC, hbound⟩ := h ε hε + refine ⟨C, hC, ?_⟩ + intro n hn + have hnBound := hbound n hn + rw [innerSize_one] at hnBound + exact hnBound + +theorem admissibleExponent_two_le {F : Type*} [Field F] {τ : ℝ} + (hτ : AdmissibleExponent F τ) : 2 ≤ τ := + rectangularAdmissibleExponent_two_le ((admissibleExponent_iff_rectangular_one F τ).mp hτ) + +theorem admissibleExponent_bddBelow (F : Type*) [Field F] : + BddBelow {τ : ℝ | AdmissibleExponent F τ} := + ⟨2, fun _ h => admissibleExponent_two_le h⟩ + +theorem omega_le_of_admissibleExponent {F : Type*} [Field F] {τ : ℝ} + (hτ : AdmissibleExponent F τ) : omega F ≤ τ := + csInf_le (admissibleExponent_bddBelow F) hτ + +@[simp] theorem rectangularOmega_one (F : Type*) [Field F] : + rectangularOmega F 1 = omega F := by + unfold rectangularOmega omega + congr 1 + ext τ + exact (admissibleExponent_iff_rectangular_one F τ).symm + +end MatrixMultiplication.Arithmetic + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/Arithmetic/MatrixMapDecidable.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/Arithmetic/MatrixMapDecidable.lean new file mode 100644 index 0000000000000000000000000000000000000000..ddfd7ea42104b386b1f5e0414a91bccac78fe99e --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/Arithmetic/MatrixMapDecidable.lean @@ -0,0 +1,47 @@ +import OAI.LinearAlgebra.MatrixMultiplication.FieldConstruction.FiniteFamily + +namespace OAI + +/-! Division-free arithmetic programs over a field and their operation counts. -/ + +noncomputable section + +namespace MatrixMultiplication.AllFieldFiniteFamily + +open MatrixMultiplication.Foundation + +variable {F : Type*} [Field F] + +private theorem matrixCoefficients_decidable (A B C : Type) + (dA eA : DecidableEq A) (dB eB : DecidableEq B) (dC eC : DecidableEq C) : + @Tensor.matrixCoefficients F _ A B C dA dB dC = + @Tensor.matrixCoefficients F _ A B C eA eB eC := by + have hA : dA = eA := Subsingleton.elim _ _ + have hB : dB = eB := Subsingleton.elim _ _ + have hC : dC = eC := Subsingleton.elim _ _ + cases hA + cases hB + cases hC + rfl + +namespace LocalMap + +def redecideMatrix {X Y Z A B C : Type} + [Fintype X] [Fintype Y] [Fintype Z] + {source : Tensor F X Y Z} + {dA : DecidableEq A} {dB : DecidableEq B} {dC : DecidableEq C} + (map : LocalMap source (@Tensor.matrixCoefficients F _ A B C dA dB dC)) + (eA : DecidableEq A) (eB : DecidableEq B) (eC : DecidableEq C) : + LocalMap source (@Tensor.matrixCoefficients F _ A B C eA eB eC) where + x := map.x + y := map.y + z := map.z + coefficient := map.coefficient.trans + (matrixCoefficients_decidable A B C dA eA dB eB dC eC) + +end LocalMap +end MatrixMultiplication.AllFieldFiniteFamily + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/Arithmetic/NaiveAlgorithm.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/Arithmetic/NaiveAlgorithm.lean new file mode 100644 index 0000000000000000000000000000000000000000..56165bb6931fe60b200778d7fafea7dfe9e28336 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/Arithmetic/NaiveAlgorithm.lean @@ -0,0 +1,106 @@ +import OAI.LinearAlgebra.MatrixMultiplication.Polynomial.ExpressionFamily +import Mathlib.Tactic.NormNum + +namespace OAI + +/-! Division-free arithmetic programs over a field and their operation counts. -/ + +noncomputable section + +open scoped BigOperators + +namespace MatrixMultiplication.Arithmetic + +variable {F : Type*} [Field F] + +namespace Expression + +variable {Input : Type*} + +def sumFin : {n : ℕ} → (Fin n → Expression F Input) → Expression F Input + | 0, _ => .constant 0 + | n + 1, f => .add (f 0) (sumFin (fun i : Fin n => f i.succ)) + +theorem sumFin_eval {n : ℕ} (f : Fin n → Expression F Input) (inputs : Input → F) : + (sumFin f).eval inputs = ∑ i, (f i).eval inputs := by + induction n with + | zero => simp [sumFin, eval] + | succ n ih => simp [sumFin, eval, ih, Fin.sum_univ_succ] + +theorem sumFin_cost {n : ℕ} (f : Fin n → Expression F Input) : + (sumFin f).cost = (∑ i, (f i).cost) + n := by + induction n with + | zero => simp [sumFin, cost] + | succ n ih => + simp only [sumFin, cost, ih, Fin.sum_univ_succ] + omega + +end Expression + +def naiveEntry {a b c : ℕ} (i : Fin a) (k : Fin c) : Expression F (MatrixInput a b c) := + Expression.sumFin fun j : Fin b => + .mul (.input (.inl (i, j))) (.input (.inr (j, k))) + +theorem naiveEntry_eval {a b c : ℕ} (i : Fin a) (k : Fin c) + (A : Matrix (Fin a) (Fin b) F) (B : Matrix (Fin b) (Fin c) F) : + (naiveEntry i k).eval (matrixInputs A B) = ∑ j, A i j * B j k := by + simp [naiveEntry, Expression.sumFin_eval, Expression.eval, matrixInputs] + +@[simp] theorem naiveEntry_cost {a b c : ℕ} (i : Fin a) (k : Fin c) : + (naiveEntry (F := F) (b := b) i k).cost = 2 * b := by + simp [naiveEntry, Expression.sumFin_cost, Expression.cost, two_mul] + +def naiveAlgorithm (a b c : ℕ) : MatrixAlgorithm F a b c := + let p := Expression.compileFamily (fun ik : Fin a × Fin c => naiveEntry (b := b) ik.1 ik.2) + { registers := p.registers + program := p.program + output := fun i k => p.output (i, k) } + +theorem naiveAlgorithm_correct (a b c : ℕ) : (naiveAlgorithm (F := F) a b c).Correct := by + apply (MatrixAlgorithm.correct_iff_entries _).2 + intro A B i k + let p := Expression.compileFamily (fun ik : Fin a × Fin c => naiveEntry (F := F) (b := b) ik.1 ik.2) + change p.program.eval (matrixInputs A B) (p.output (i, k)) = _ + rw [p.correct] + exact naiveEntry_eval i k A B + +@[simp] theorem naiveAlgorithm_cost (a b c : ℕ) : + (naiveAlgorithm (F := F) a b c).cost = 2 * a * b * c := by + let p := Expression.compileFamily (fun ik : Fin a × Fin c => naiveEntry (F := F) (b := b) ik.1 ik.2) + change p.program.cost = _ + rw [p.cost_eq] + simp only [naiveEntry_cost, Finset.sum_const, Finset.card_univ, + Fintype.card_prod, Fintype.card_fin, nsmul_eq_mul, Nat.cast_id] + ring + +theorem naiveAlgorithm_cost_le (a b c : ℕ) : + (naiveAlgorithm (F := F) a b c).cost ≤ 2 * a * b * c := + (naiveAlgorithm_cost a b c).le + +theorem admissibleExponent_three : AdmissibleExponent F 3 := by + intro ε hε + refine ⟨2, by norm_num, ?_⟩ + intro n hn + refine ⟨naiveAlgorithm n n n, naiveAlgorithm_correct n n n, ?_⟩ + rw [naiveAlgorithm_cost] + have hnR : (1 : ℝ) ≤ (n : ℝ) := by exact_mod_cast hn + have hpow : (n : ℝ) ^ (3 : ℝ) ≤ (n : ℝ) ^ (3 + ε) := + Real.rpow_le_rpow_of_exponent_le hnR (le_add_of_nonneg_right hε.le) + calc + ((2 * n * n * n : ℕ) : ℝ) = 2 * (n : ℝ) ^ (3 : ℝ) := by + calc + ((2 * n * n * n : ℕ) : ℝ) = 2 * (n : ℝ) ^ (3 : ℕ) := by + push_cast + ring + _ = 2 * (n : ℝ) ^ (3 : ℝ) := + congrArg (fun t : ℝ => 2 * t) (Real.rpow_natCast (n : ℝ) 3).symm + _ ≤ 2 * (n : ℝ) ^ (3 + ε) := mul_le_mul_of_nonneg_left hpow (by norm_num) + +theorem admissibleExponent_nonempty : Set.Nonempty {τ : ℝ | AdmissibleExponent F τ} := + ⟨3, admissibleExponent_three⟩ + +end MatrixMultiplication.Arithmetic + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/Arithmetic/Padding.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/Arithmetic/Padding.lean new file mode 100644 index 0000000000000000000000000000000000000000..98bde1b95790931a2017db2f0700b0828eebf13d --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/Arithmetic/Padding.lean @@ -0,0 +1,120 @@ +import OAI.LinearAlgebra.MatrixMultiplication.Arithmetic.ProgramComposition + +namespace OAI + +/-! Division-free arithmetic programs over a field and their operation counts. -/ + +noncomputable section + +open scoped BigOperators + +namespace MatrixMultiplication.Arithmetic + +variable {F : Type*} [Field F] + +def zeroPadMatrix {a b : ℕ} (A B : ℕ) (M : Matrix (Fin a) (Fin b) F) : + Matrix (Fin A) (Fin B) F := + fun i j => if hi : i.val < a then + if hj : j.val < b then M ⟨i.val, hi⟩ ⟨j.val, hj⟩ else 0 + else 0 + +@[simp] theorem zeroPadMatrix_castLE {a b A B : ℕ} (ha : a ≤ A) (hb : b ≤ B) + (M : Matrix (Fin a) (Fin b) F) (i : Fin a) (j : Fin b) : + zeroPadMatrix A B M (Fin.castLE ha i) (Fin.castLE hb j) = M i j := by + simp [zeroPadMatrix, i.is_lt, j.is_lt] + +theorem sum_fin_castLE_of_zero {n m : ℕ} (h : n ≤ m) (f : Fin m → F) + (hf : ∀ j : Fin m, n ≤ j.val → f j = 0) : + (∑ j : Fin m, f j) = ∑ j : Fin n, f (Fin.castLE h j) := by + symm + refine Fintype.sum_of_injective (Fin.castLE h) ?_ + (fun j : Fin n => f (Fin.castLE h j)) f ?_ (fun _ => rfl) + · intro i j hij + exact Fin.ext (congrArg (fun v : Fin m => v.val) hij) + · intro j hj + exact hf j (le_of_not_gt fun hsmall => hj ⟨⟨j.val, hsmall⟩, Fin.ext rfl⟩) + +theorem zeroPadMatrix_mul {a b c A B C : ℕ} (ha : a ≤ A) (hb : b ≤ B) (hc : c ≤ C) + (M : Matrix (Fin a) (Fin b) F) (N : Matrix (Fin b) (Fin c) F) + (i : Fin a) (k : Fin c) : + (zeroPadMatrix A B M * zeroPadMatrix B C N) (Fin.castLE ha i) (Fin.castLE hc k) = + (M * N) i k := by + rw [Matrix.mul_apply, Matrix.mul_apply] + calc + (∑ j : Fin B, + zeroPadMatrix A B M (Fin.castLE ha i) j * + zeroPadMatrix B C N j (Fin.castLE hc k)) = + ∑ j : Fin b, + zeroPadMatrix A B M (Fin.castLE ha i) (Fin.castLE hb j) * + zeroPadMatrix B C N (Fin.castLE hb j) (Fin.castLE hc k) := by + apply sum_fin_castLE_of_zero hb + intro j hj + simp [zeroPadMatrix, not_lt_of_ge hj] + _ = ∑ j : Fin b, M i j * N j k := by simp + +def padSource {a b c A B C : ℕ} : MatrixInput A B C → MatrixInput a b c ⊕ F + | .inl (i, j) => if hi : i.val < a then + if hj : j.val < b then .inl (.inl (⟨i.val, hi⟩, ⟨j.val, hj⟩)) else .inr 0 + else .inr 0 + | .inr (j, k) => if hj : j.val < b then + if hk : k.val < c then .inl (.inr (⟨j.val, hj⟩, ⟨k.val, hk⟩)) else .inr 0 + else .inr 0 + +theorem padSource_eval {a b c A B C : ℕ} + (M : Matrix (Fin a) (Fin b) F) (N : Matrix (Fin b) (Fin c) F) : + (fun x : MatrixInput A B C => Sum.elim (matrixInputs M N) id (padSource x)) = + matrixInputs (zeroPadMatrix A B M) (zeroPadMatrix B C N) := by + funext x + rcases x with ⟨i, j⟩ | ⟨j, k⟩ + · by_cases hi : i.val < a <;> by_cases hj : j.val < b <;> + simp [padSource, matrixInputs, zeroPadMatrix, hi, hj] + · by_cases hj : j.val < b <;> by_cases hk : k.val < c <;> + simp [padSource, matrixInputs, zeroPadMatrix, hj, hk] + +namespace MatrixAlgorithm + +def pad {a b c A B C : ℕ} (ha : a ≤ A) (_hb : b ≤ B) (hc : c ≤ C) + (P : MatrixAlgorithm F A B C) : MatrixAlgorithm F a b c where + registers := P.registers + program := P.program.mapSource (padSource (a := a) (b := b) (c := c)) + output := fun i k => P.output (Fin.castLE ha i) (Fin.castLE hc k) + +theorem pad_correct {a b c A B C : ℕ} (ha : a ≤ A) (hb : b ≤ B) (hc : c ≤ C) + {P : MatrixAlgorithm F A B C} (hP : P.Correct) : (pad ha hb hc P).Correct := by + intro M N + funext i k + change (P.program.mapSource (padSource (a := a) (b := b) (c := c))).eval + (matrixInputs M N) (P.output (Fin.castLE ha i) (Fin.castLE hc k)) = (M * N) i k + rw [Program.eval_mapSource, padSource_eval] + have hentry := congrFun (congrFun + (hP (zeroPadMatrix A B M) (zeroPadMatrix B C N)) (Fin.castLE ha i)) (Fin.castLE hc k) + exact hentry.trans (zeroPadMatrix_mul ha hb hc M N i k) + +@[simp] theorem pad_cost_eq {a b c A B C : ℕ} (ha : a ≤ A) (hb : b ≤ B) (hc : c ≤ C) + (P : MatrixAlgorithm F A B C) : (pad ha hb hc P).cost = P.cost := + Program.cost_mapSource (padSource (a := a) (b := b) (c := c)) P.program + +theorem exists_restrict {a b c A B C : ℕ} (ha : a ≤ A) (hb : b ≤ B) (hc : c ≤ C) + (P : MatrixAlgorithm F A B C) (hP : P.Correct) : + ∃ Q : MatrixAlgorithm F a b c, Q.Correct ∧ Q.cost ≤ P.cost := + ⟨pad ha hb hc P, pad_correct ha hb hc hP, (pad_cost_eq ha hb hc P).le⟩ + +end MatrixAlgorithm + +theorem RectangularAdmissibleExponent.mono_aspect {k l τ : ℝ} + (h : RectangularAdmissibleExponent F l τ) (hkl : k ≤ l) : + RectangularAdmissibleExponent F k τ := by + intro ε hε + obtain ⟨C, hC, hbound⟩ := h ε hε + refine ⟨C, hC, ?_⟩ + intro n hn + obtain ⟨P, hP, hcost⟩ := hbound n hn + obtain ⟨Q, hQ, hcostQ⟩ := MatrixAlgorithm.exists_restrict (le_refl n) + (innerSize_mono hn hkl) (le_refl n) P hP + exact ⟨Q, hQ, (Nat.cast_le.mpr hcostQ).trans hcost⟩ + +end MatrixMultiplication.Arithmetic + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/Arithmetic/ProgramComposition.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/Arithmetic/ProgramComposition.lean new file mode 100644 index 0000000000000000000000000000000000000000..fd3999f8217d6c3ba9be74d568e136caf38c389c --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/Arithmetic/ProgramComposition.lean @@ -0,0 +1,198 @@ +import OAI.LinearAlgebra.MatrixMultiplication.Arithmetic.Programs + +namespace OAI + +/-! Division-free arithmetic programs over a field and their operation counts. -/ + +noncomputable section + +namespace MatrixMultiplication.Arithmetic + +variable {F : Type*} [Field F] + +namespace Gate + +variable {Input Input' Register : Type*} + +def mapInput (f : Input → Input') : Gate F Input Register → Gate F Input' Register + | .constant z => .constant z + | .input i => .input (f i) + | .add i j => .add i j + | .sub i j => .sub i j + | .mul i j => .mul i j + +@[simp] theorem eval_mapInput (f : Input → Input') (g : Gate F Input Register) + (inputs : Input' → F) (registers : Register → F) : + (g.mapInput f).eval inputs registers = g.eval (inputs ∘ f) registers := by + cases g <;> rfl + +omit [Field F] in +@[simp] theorem cost_mapInput (f : Input → Input') (g : Gate F Input Register) : + (g.mapInput f).cost = g.cost := by + cases g <;> rfl + +def mapSource (f : Input → Input' ⊕ F) : Gate F Input Register → Gate F Input' Register + | .constant z => .constant z + | .input i => match f i with + | .inl j => .input j + | .inr z => .constant z + | .add i j => .add i j + | .sub i j => .sub i j + | .mul i j => .mul i j + +@[simp] theorem eval_mapSource (f : Input → Input' ⊕ F) (g : Gate F Input Register) + (inputs : Input' → F) (registers : Register → F) : + (g.mapSource f).eval inputs registers = + g.eval (fun i => Sum.elim inputs id (f i)) registers := by + cases g with + | input i => cases h : f i <;> simp [mapSource, h, eval] + | constant => rfl + | add => rfl + | sub => rfl + | mul => rfl + +omit [Field F] in +@[simp] theorem cost_mapSource (f : Input → Input' ⊕ F) (g : Gate F Input Register) : + (g.mapSource f).cost = g.cost := by + cases g with + | input i => cases h : f i <;> simp [mapSource, h, cost] + | constant => rfl + | add => rfl + | sub => rfl + | mul => rfl + +end Gate + +namespace Program + +variable {Input Input' Mid : Type*} + +def mapInput (f : Input → Input') : {r : ℕ} → Program F Input r → Program F Input' r + | 0, .nil => .nil + | _ + 1, .step p g => (p.mapInput f).step (g.mapInput f) + +@[simp] theorem eval_mapInput (f : Input → Input') {r : ℕ} (p : Program F Input r) + (inputs : Input' → F) : + ∀ i : Fin r, (p.mapInput f).eval inputs i = p.eval (inputs ∘ f) i := by + induction p with + | nil => intro i; exact Fin.elim0 i + | @step r p g ih => + intro i + refine Fin.cases ?_ (fun j => ?_) i + · simp only [mapInput, eval_step_zero, Gate.eval_mapInput] + rw [funext ih] + · exact ih j + +omit [Field F] in +@[simp] theorem cost_mapInput (f : Input → Input') {r : ℕ} (p : Program F Input r) : + (p.mapInput f).cost = p.cost := by + induction p with + | nil => rfl + | step p g ih => simp only [mapInput, cost_step, Gate.cost_mapInput, ih] + +def mapSource (f : Input → Input' ⊕ F) : {r : ℕ} → Program F Input r → Program F Input' r + | 0, .nil => .nil + | _ + 1, .step p g => (p.mapSource f).step (g.mapSource f) + +@[simp] theorem eval_mapSource (f : Input → Input' ⊕ F) {r : ℕ} + (p : Program F Input r) (inputs : Input' → F) : + ∀ i : Fin r, (p.mapSource f).eval inputs i = + p.eval (fun j => Sum.elim inputs id (f j)) i := by + induction p with + | nil => intro i; exact Fin.elim0 i + | @step r p g ih => + intro i + refine Fin.cases ?_ (fun j => ?_) i + · simp only [mapSource, eval_step_zero, Gate.eval_mapSource] + rw [funext ih] + · exact ih j + +omit [Field F] in +@[simp] theorem cost_mapSource (f : Input → Input' ⊕ F) {r : ℕ} + (p : Program F Input r) : (p.mapSource f).cost = p.cost := by + induction p with + | nil => rfl + | step p g ih => simp only [mapSource, cost_step, Gate.cost_mapSource, ih] + +structure Substituted {r s : ℕ} (p : Program F Input r) (q : Program F Mid s) + (wires : Mid → Fin r) where + registers : ℕ + program : Program F Input registers + oldOutput : Fin r → Fin registers + output : Fin s → Fin registers + correctOld : ∀ inputs i, program.eval inputs (oldOutput i) = p.eval inputs i + correct : ∀ inputs i, program.eval inputs (output i) = + q.eval (fun j => p.eval inputs (wires j)) i + cost_eq : program.cost = p.cost + q.cost + +namespace Substituted + +def step {r s : ℕ} {p : Program F Input r} {q : Program F Mid s} + {wires : Mid → Fin r} (a : Substituted p q wires) + (g : Gate F Mid (Fin s)) (h : Gate F Input (Fin a.registers)) + (heval : ∀ inputs, h.eval inputs (a.program.eval inputs) = + g.eval (fun j => p.eval inputs (wires j)) + (q.eval (fun j => p.eval inputs (wires j)))) + (hcost : h.cost = g.cost) : Substituted p (q.step g) wires where + registers := a.registers + 1 + program := a.program.step h + oldOutput := fun i => (a.oldOutput i).succ + output := Fin.cases 0 (fun i => (a.output i).succ) + correctOld := by + intro inputs i + exact a.correctOld inputs i + correct := by + intro inputs i + refine Fin.cases ?_ (fun j => ?_) i + · exact heval inputs + · exact a.correct inputs j + cost_eq := by + simp only [cost_step, a.cost_eq, hcost, Nat.add_assoc] + +end Substituted + +def substitute {r : ℕ} (p : Program F Input r) : + {s : ℕ} → (q : Program F Mid s) → (wires : Mid → Fin r) → Substituted p q wires + | 0, .nil, wires => + { registers := r + program := p + oldOutput := id + output := Fin.elim0 + correctOld := fun _ _ => rfl + correct := fun _ i => Fin.elim0 i + cost_eq := by simp only [cost, Nat.add_zero] } + | _ + 1, .step q g, wires => + let a := substitute p q wires + match g with + | .input j => + { registers := a.registers + program := a.program + oldOutput := a.oldOutput + output := Fin.cases (a.oldOutput (wires j)) a.output + correctOld := a.correctOld + correct := by + intro inputs i + refine Fin.cases ?_ (fun k => ?_) i + · exact a.correctOld inputs (wires j) + · exact a.correct inputs k + cost_eq := by + simpa only [cost_step, Gate.cost, Nat.add_zero] using a.cost_eq } + | .constant z => + a.step (.constant z) (.constant z) (fun _ => rfl) rfl + | .add i j => + a.step (.add i j) (.add (a.output i) (a.output j)) + (by intro inputs; simp only [Gate.eval, a.correct]) rfl + | .sub i j => + a.step (.sub i j) (.sub (a.output i) (a.output j)) + (by intro inputs; simp only [Gate.eval, a.correct]) rfl + | .mul i j => + a.step (.mul i j) (.mul (a.output i) (a.output j)) + (by intro inputs; simp only [Gate.eval, a.correct]) rfl + +end Program + +end MatrixMultiplication.Arithmetic + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/Arithmetic/Programs.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/Arithmetic/Programs.lean new file mode 100644 index 0000000000000000000000000000000000000000..89fd79ee145db58b40295b832ccd5418eba61082 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/Arithmetic/Programs.lean @@ -0,0 +1,188 @@ +import OAI.LinearAlgebra.MatrixMultiplication.Arithmetic.Complexity +import Lean.Elab.Tactic.Omega + +namespace OAI + +/-! Division-free arithmetic programs over a field and their operation counts. -/ + +noncomputable section + +namespace MatrixMultiplication.Arithmetic + +variable {F : Type*} [Field F] + +namespace Gate + +variable {Input R S : Type*} + +def mapRegister (f : R → S) : Gate F Input R → Gate F Input S + | .constant z => .constant z + | .input i => .input i + | .add i j => .add (f i) (f j) + | .sub i j => .sub (f i) (f j) + | .mul i j => .mul (f i) (f j) + +theorem eval_mapRegister (g : Gate F Input R) (f : R → S) + (inputs : Input → F) (registers : S → F) : + (g.mapRegister f).eval inputs registers = g.eval inputs (fun i => registers (f i)) := by + cases g <;> rfl + +omit [Field F] in +@[simp] theorem cost_mapRegister (g : Gate F Input R) (f : R → S) : + (g.mapRegister f).cost = g.cost := by + cases g <;> rfl + +end Gate + +namespace Program + +variable {Input : Type*} + +def oldIndex (r s : ℕ) (i : Fin r) : Fin (r + s) := ⟨s + i.val, by omega⟩ + +def newIndex (r s : ℕ) (i : Fin s) : Fin (r + s) := ⟨i.val, by omega⟩ + +@[simp] theorem oldIndex_zero (r : ℕ) (i : Fin r) : oldIndex r 0 i = i := by + apply Fin.ext + simp [oldIndex] + +@[simp] theorem oldIndex_succ (r s : ℕ) (i : Fin r) : + oldIndex r (s + 1) i = (oldIndex r s i).succ := by + apply Fin.ext + simp only [oldIndex, Fin.val_succ] + omega + +@[simp] theorem newIndex_zero (r s : ℕ) : newIndex r (s + 1) 0 = 0 := by + apply Fin.ext + rfl + +@[simp] theorem newIndex_succ (r s : ℕ) (i : Fin s) : + newIndex r (s + 1) i.succ = (newIndex r s i).succ := by + apply Fin.ext + rfl + +def append {r : ℕ} (p : Program F Input r) : {s : ℕ} → Program F Input s → Program F Input (r + s) + | 0, .nil => p + | s + 1, .step q g => (p.append q).step (g.mapRegister (newIndex r s)) + +theorem eval_append_new {r s : ℕ} (p : Program F Input r) (q : Program F Input s) + (inputs : Input → F) : + ∀ i : Fin s, (p.append q).eval inputs (newIndex r s i) = q.eval inputs i := by + induction q with + | nil => intro i; exact Fin.elim0 i + | @step s q g ih => + intro i + refine Fin.cases ?_ (fun j => ?_) i + · simp only [append, newIndex_zero, eval_step_zero, Gate.eval_mapRegister] + rw [funext ih] + · simpa only [append, newIndex_succ, eval_step_succ] using ih j + +theorem eval_append_old {r s : ℕ} (p : Program F Input r) (q : Program F Input s) + (inputs : Input → F) : + ∀ i : Fin r, (p.append q).eval inputs (oldIndex r s i) = p.eval inputs i := by + induction q with + | nil => intro i; simp [append] + | @step s q g ih => + intro i + simpa only [append, oldIndex_succ, eval_step_succ] using ih i + +omit [Field F] in +@[simp] theorem cost_append {r s : ℕ} (p : Program F Input r) (q : Program F Input s) : + (p.append q).cost = p.cost + q.cost := by + induction q with + | nil => simp [append, cost] + | @step s q g ih => simp [append, ih, Nat.add_assoc] + +end Program + +inductive Expression (F Input : Type*) where + | constant : F → Expression F Input + | input : Input → Expression F Input + | add : Expression F Input → Expression F Input → Expression F Input + | sub : Expression F Input → Expression F Input → Expression F Input + | mul : Expression F Input → Expression F Input → Expression F Input + +namespace Expression + +variable {Input : Type*} + +def eval (inputs : Input → F) : Expression F Input → F + | .constant z => z + | .input i => inputs i + | .add e f => e.eval inputs + f.eval inputs + | .sub e f => e.eval inputs - f.eval inputs + | .mul e f => e.eval inputs * f.eval inputs + +def cost : Expression F Input → ℕ + | .constant _ => 0 + | .input _ => 0 + | .add e f => e.cost + f.cost + 1 + | .sub e f => e.cost + f.cost + 1 + | .mul e f => e.cost + f.cost + 1 + +structure Compiled (e : Expression F Input) where + registers : ℕ + program : Program F Input registers + output : Fin registers + correct : ∀ inputs, program.eval inputs output = e.eval inputs + cost_eq : program.cost = e.cost + +def compile : (e : Expression F Input) → Compiled e + | .constant z => + { registers := 1 + program := Program.nil.step (.constant z) + output := 0 + correct := fun _ => rfl + cost_eq := rfl } + | .input i => + { registers := 1 + program := Program.nil.step (.input i) + output := 0 + correct := fun _ => rfl + cost_eq := rfl } + | .add e f => + let p := compile e + let q := compile f + { registers := p.registers + q.registers + 1 + program := (p.program.append q.program).step + (.add (Program.oldIndex _ _ p.output) (Program.newIndex _ _ q.output)) + output := 0 + correct := by + intro inputs + simp only [Program.eval_step_zero, Gate.eval, Program.eval_append_old, + Program.eval_append_new, p.correct, q.correct, eval] + cost_eq := by + simp only [Program.cost_step, Program.cost_append, Gate.cost, p.cost_eq, q.cost_eq, cost] } + | .sub e f => + let p := compile e + let q := compile f + { registers := p.registers + q.registers + 1 + program := (p.program.append q.program).step + (.sub (Program.oldIndex _ _ p.output) (Program.newIndex _ _ q.output)) + output := 0 + correct := by + intro inputs + simp only [Program.eval_step_zero, Gate.eval, Program.eval_append_old, + Program.eval_append_new, p.correct, q.correct, eval] + cost_eq := by + simp only [Program.cost_step, Program.cost_append, Gate.cost, p.cost_eq, q.cost_eq, cost] } + | .mul e f => + let p := compile e + let q := compile f + { registers := p.registers + q.registers + 1 + program := (p.program.append q.program).step + (.mul (Program.oldIndex _ _ p.output) (Program.newIndex _ _ q.output)) + output := 0 + correct := by + intro inputs + simp only [Program.eval_step_zero, Gate.eval, Program.eval_append_old, + Program.eval_append_new, p.correct, q.correct, eval] + cost_eq := by + simp only [Program.cost_step, Program.cost_append, Gate.cost, p.cost_eq, q.cost_eq, cost] } + +end Expression +end MatrixMultiplication.Arithmetic + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/Arithmetic/RecursiveBlockPrograms.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/Arithmetic/RecursiveBlockPrograms.lean new file mode 100644 index 0000000000000000000000000000000000000000..83b9951e2df241790f86903faf09e3fe7061eafd --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/Arithmetic/RecursiveBlockPrograms.lean @@ -0,0 +1,400 @@ +import OAI.LinearAlgebra.MatrixMultiplication.Polynomial.ExpressionFamily +import OAI.LinearAlgebra.MatrixMultiplication.Arithmetic.ProgramComposition +import OAI.LinearAlgebra.MatrixMultiplication.Tensor.ComplexMatrixTensor +import Mathlib.Logic.Equiv.Fin.Basic +import Mathlib.Tactic.Ring + +namespace OAI + +/-! Division-free arithmetic programs over a field and their operation counts. -/ + +noncomputable section + +open scoped BigOperators + +namespace MatrixMultiplication.Arithmetic.RecursiveBlock + +open MatrixMultiplication.Foundation + +variable {F : Type*} [Field F] + +namespace LinearExpression + +variable {Input : Type*} + +def sumFin : (n : ℕ) → (Fin n → Expression F Input) → Expression F Input + | 0, _ => .constant 0 + | n + 1, f => .add (f 0) (sumFin n (fun i => f i.succ)) + +theorem eval_sumFin (n : ℕ) (f : Fin n → Expression F Input) (inputs : Input → F) : + (sumFin n f).eval inputs = ∑ i, (f i).eval inputs := by + induction n with + | zero => simp [sumFin, Expression.eval] + | succ n ih => + simp only [sumFin, Expression.eval, ih, Fin.sum_univ_succ] + +theorem cost_sumFin (n : ℕ) (f : Fin n → Expression F Input) : + (sumFin n f).cost = (∑ i, (f i).cost) + n := by + induction n with + | zero => simp [sumFin, Expression.cost] + | succ n ih => + simp only [sumFin, Expression.cost, ih, Fin.sum_univ_succ] + omega + +def linear {Term : Type*} [Fintype Term] (a : Term → F) (wire : Term → Input) : + Expression F Input := + sumFin (Fintype.card Term) (fun i => + .mul (.constant (a ((Fintype.equivFin Term).symm i))) + (.input (wire ((Fintype.equivFin Term).symm i)))) + +theorem eval_linear {Term : Type*} [Fintype Term] + (a : Term → F) (wire : Term → Input) (inputs : Input → F) : + (linear a wire).eval inputs = ∑ i, a i * inputs (wire i) := by + rw [linear, eval_sumFin] + exact (Fintype.equivFin Term).symm.sum_comp (fun i => a i * inputs (wire i)) + +theorem cost_linear {Term : Type*} [Fintype Term] + (a : Term → F) (wire : Term → Input) : + (linear a wire).cost = 2 * Fintype.card Term := by + simp [linear, cost_sumFin, Expression.cost, two_mul] + +end LinearExpression + +structure Family (F Input Output : Type*) where + registers : ℕ + program : Program F Input registers + output : Output → Fin registers + +namespace Family + +variable {Input Mid Output : Type*} + +def eval (p : Family F Input Output) (inputs : Input → F) (o : Output) : F := + p.program.eval inputs (p.output o) + +def cost (p : Family F Input Output) : ℕ := p.program.cost + +def expressions [Fintype Output] (e : Output → Expression F Input) : Family F Input Output := + let p := Expression.compileFamily e + ⟨p.registers, p.program, p.output⟩ + +theorem eval_expressions [Fintype Output] (e : Output → Expression F Input) + (inputs : Input → F) (o : Output) : + (expressions e).eval inputs o = (e o).eval inputs := + (Expression.compileFamily e).correct inputs o + +theorem cost_expressions [Fintype Output] (e : Output → Expression F Input) : + (expressions e).cost = ∑ o, (e o).cost := + (Expression.compileFamily e).cost_eq + +def compose (p : Family F Input Mid) (q : Family F Mid Output) : Family F Input Output := + let s := p.program.substitute q.program p.output + ⟨s.registers, s.program, fun o => s.output (q.output o)⟩ + +theorem eval_compose (p : Family F Input Mid) (q : Family F Mid Output) + (inputs : Input → F) (o : Output) : + (compose p q).eval inputs o = q.eval (p.eval inputs) o := + (p.program.substitute q.program p.output).correct inputs (q.output o) + +theorem cost_compose (p : Family F Input Mid) (q : Family F Mid Output) : + (compose p q).cost = p.cost + q.cost := + (p.program.substitute q.program p.output).cost_eq + +def mapInputs {NewInput : Type*} (f : Input → NewInput) (p : Family F Input Output) : + Family F NewInput Output := + ⟨p.registers, p.program.mapInput f, p.output⟩ + +theorem eval_mapInputs {NewInput : Type*} (f : Input → NewInput) + (p : Family F Input Output) (inputs : NewInput → F) (o : Output) : + (p.mapInputs f).eval inputs o = p.eval (fun i => inputs (f i)) o := by + exact Program.eval_mapInput f p.program inputs (p.output o) + +omit [Field F] in +theorem cost_mapInputs {NewInput : Type*} (f : Input → NewInput) + (p : Family F Input Output) : (p.mapInputs f).cost = p.cost := by + exact Program.cost_mapInput f p.program + +def parallel : (r : ℕ) → (Fin r → Family F Input Output) → Family F Input (Fin r × Output) + | 0, _ => ⟨0, Program.nil, fun o => Fin.elim0 o.1⟩ + | r + 1, p => + let head := p 0 + let tail := parallel r (fun i => p i.succ) + { registers := head.registers + tail.registers + program := head.program.append tail.program + output := fun o => Fin.cases + (Program.oldIndex _ _ (head.output o.2)) + (fun i => Program.newIndex _ _ (tail.output (i, o.2))) o.1 } + +theorem eval_parallel (r : ℕ) (p : Fin r → Family F Input Output) + (inputs : Input → F) (o : Fin r × Output) : + (parallel r p).eval inputs o = (p o.1).eval inputs o.2 := by + induction r with + | zero => exact Fin.elim0 o.1 + | succ r ih => + rcases o with ⟨i, o⟩ + refine Fin.cases ?_ (fun j => ?_) i + · exact Program.eval_append_old _ _ inputs _ + · exact (Program.eval_append_new _ _ inputs _).trans + (ih (fun j => p j.succ) (j, o)) + +omit [Field F] in +theorem cost_parallel (r : ℕ) (p : Fin r → Family F Input Output) : + (parallel r p).cost = ∑ i, (p i).cost := by + induction r with + | zero => simp [parallel, cost, Program.cost] + | succ r ih => + change ((p 0).program.append (parallel r (fun i => p i.succ)).program).cost = _ + rw [Program.cost_append] + change (p 0).cost + (parallel r (fun i => p i.succ)).cost = _ + rw [ih, Fin.sum_univ_succ] + +def copies (r : ℕ) (p : Family F Input Output) : + Family F (Fin r × Input) (Fin r × Output) := + parallel r (fun i => p.mapInputs (fun x => (i, x))) + +theorem eval_copies (r : ℕ) (p : Family F Input Output) + (inputs : Fin r × Input → F) (o : Fin r × Output) : + (copies r p).eval inputs o = p.eval (fun x => inputs (o.1, x)) o.2 := by + rw [copies, eval_parallel, eval_mapInputs] + +omit [Field F] in +theorem cost_copies (r : ℕ) (p : Family F Input Output) : + (copies r p).cost = r * p.cost := by + simp [copies, cost_parallel, cost_mapInputs] + +def ofMatrix {m l q : ℕ} (p : MatrixAlgorithm F m l q) : + Family F (MatrixInput m l q) (Fin m × Fin q) := + ⟨p.registers, p.program, fun o => p.output o.1 o.2⟩ + +omit [Field F] in +@[simp] theorem cost_ofMatrix {m l q : ℕ} (p : MatrixAlgorithm F m l q) : + (ofMatrix p).cost = p.cost := rfl + +theorem eval_ofMatrix {m l q : ℕ} (p : MatrixAlgorithm F m l q) (hp : p.Correct) + (inputs : MatrixInput m l q → F) (o : Fin m × Fin q) : + (ofMatrix p).eval inputs o = + ∑ j, inputs (.inl (o.1, j)) * inputs (.inr (j, o.2)) := by + have h := (MatrixAlgorithm.correct_iff_entries p).mp hp + (fun i j => inputs (.inl (i, j))) (fun j k => inputs (.inr (j, k))) o.1 o.2 + have hi : matrixInputs (fun i j => inputs (.inl (i, j))) + (fun j k => inputs (.inr (j, k))) = inputs := by + funext x + cases x <;> rfl + rw [hi] at h + exact h + +end Family + +section BlockIdentities + +variable {n₁ n₂ n₃ r m₁ m₂ m₃ : ℕ} + +def join {n m : ℕ} (i : Fin n) (j : Fin m) : Fin (n * m) := finProdFinEquiv (i, j) + +theorem rank_bilinear_identity + (a : Fin r → Fin n₁ × Fin n₂ → F) + (b : Fin r → Fin n₂ × Fin n₃ → F) + (c : Fin r → Fin n₃ × Fin n₁ → F) + (h : Tensor.matrixCoefficients (K := F) (Fin n₁) (Fin n₂) (Fin n₃) = + fun x y z => ∑ q, Tensor.rankOne (a q) (b q) (c q) x y z) + (left : Fin n₁ × Fin n₂ → F) (right : Fin n₂ × Fin n₃ → F) + (i : Fin n₁) (k : Fin n₃) : + (∑ q, c q (k, i) * (∑ x, a q x * left x) * (∑ y, b q y * right y)) = + ∑ j, left (i, j) * right (j, k) := by + rw [← Tensor.contract_matrixCoefficients left right i k] + rw [h] + simp only [Tensor.contract, Tensor.rankOne, Finset.sum_mul, Finset.mul_sum] + calc + (∑ q, ∑ y, ∑ x, c q (k, i) * (a q x * left x) * (b q y * right y)) = + ∑ q, ∑ x, ∑ y, c q (k, i) * (a q x * left x) * (b q y * right y) := by + apply Finset.sum_congr rfl + intro q hq + exact Finset.sum_comm + _ = ∑ x, ∑ q, ∑ y, c q (k, i) * (a q x * left x) * (b q y * right y) := + Finset.sum_comm + _ = ∑ x, ∑ y, ∑ q, a q x * b q y * c q (k, i) * left x * right y := by + apply Finset.sum_congr rfl + intro x hx + rw [Finset.sum_comm] + apply Finset.sum_congr rfl + intro y hy + apply Finset.sum_congr rfl + intro q hq + ring + +def leftBlock (a : Fin r → Fin n₁ × Fin n₂ → F) + (A : Matrix (Fin (n₁ * m₁)) (Fin (n₂ * m₂)) F) (q : Fin r) : + Matrix (Fin m₁) (Fin m₂) F := + fun s t => ∑ x, a q x * A (join x.1 s) (join x.2 t) + +def rightBlock (b : Fin r → Fin n₂ × Fin n₃ → F) + (B : Matrix (Fin (n₂ * m₂)) (Fin (n₃ * m₃)) F) (q : Fin r) : + Matrix (Fin m₂) (Fin m₃) F := + fun t u => ∑ y, b q y * B (join y.1 t) (join y.2 u) + +theorem block_identity + (a : Fin r → Fin n₁ × Fin n₂ → F) + (b : Fin r → Fin n₂ × Fin n₃ → F) + (c : Fin r → Fin n₃ × Fin n₁ → F) + (h : Tensor.matrixCoefficients (K := F) (Fin n₁) (Fin n₂) (Fin n₃) = + fun x y z => ∑ q, Tensor.rankOne (a q) (b q) (c q) x y z) + (A : Matrix (Fin (n₁ * m₁)) (Fin (n₂ * m₂)) F) + (B : Matrix (Fin (n₂ * m₂)) (Fin (n₃ * m₃)) F) + (i : Fin n₁) (k : Fin n₃) (s : Fin m₁) (u : Fin m₃) : + (∑ q, c q (k, i) * ((leftBlock a A q) * (rightBlock b B q)) s u) = + (A * B) (join i s) (join k u) := by + simp only [Matrix.mul_apply, Finset.mul_sum] + rw [Finset.sum_comm] + have hlocal (t : Fin m₂) := rank_bilinear_identity a b c h + (fun x => A (join x.1 s) (join x.2 t)) + (fun y => B (join y.1 t) (join y.2 u)) i k + simp only [leftBlock, rightBlock] + simp_rw [← mul_assoc, hlocal] + rw [Finset.sum_comm] + exact (Fintype.sum_prod_type _).symm.trans + (finProdFinEquiv.sum_comp (fun j => A (join i s) j * B j (join k u))) + +end BlockIdentities + +section BlockPrograms + +variable {n₁ n₂ n₃ r m₁ m₂ m₃ : ℕ} + +def inputExpressions (a : Fin r → Fin n₁ × Fin n₂ → F) + (b : Fin r → Fin n₂ × Fin n₃ → F) : + Fin r × MatrixInput m₁ m₂ m₃ → + Expression F (MatrixInput (n₁ * m₁) (n₂ * m₂) (n₃ * m₃)) + | (q, .inl (s, t)) => LinearExpression.linear (a q) + (fun x => .inl (join x.1 s, join x.2 t)) + | (q, .inr (t, u)) => LinearExpression.linear (b q) + (fun y => .inr (join y.1 t, join y.2 u)) + +def inputFamily (a : Fin r → Fin n₁ × Fin n₂ → F) + (b : Fin r → Fin n₂ × Fin n₃ → F) : + Family F (MatrixInput (n₁ * m₁) (n₂ * m₂) (n₃ * m₃)) + (Fin r × MatrixInput m₁ m₂ m₃) := + Family.expressions (inputExpressions a b) + +theorem inputFamily_eval (a : Fin r → Fin n₁ × Fin n₂ → F) + (b : Fin r → Fin n₂ × Fin n₃ → F) + (A : Matrix (Fin (n₁ * m₁)) (Fin (n₂ * m₂)) F) + (B : Matrix (Fin (n₂ * m₂)) (Fin (n₃ * m₃)) F) + (q : Fin r) (x : MatrixInput m₁ m₂ m₃) : + (inputFamily a b).eval (matrixInputs A B) (q, x) = + matrixInputs (leftBlock a A q) (rightBlock b B q) x := by + cases x with + | inl x => + simp only [inputFamily, Family.eval_expressions, inputExpressions, + LinearExpression.eval_linear, matrixInputs, leftBlock] + | inr x => + simp only [inputFamily, Family.eval_expressions, inputExpressions, + LinearExpression.eval_linear, matrixInputs, rightBlock] + +theorem inputFamily_cost (a : Fin r → Fin n₁ × Fin n₂ → F) + (b : Fin r → Fin n₂ × Fin n₃ → F) : + (inputFamily (m₁ := m₁) (m₂ := m₂) (m₃ := m₃) a b).cost = + 2 * r * (n₁ * n₂ * m₁ * m₂ + n₂ * n₃ * m₂ * m₃) := by + rw [inputFamily, Family.cost_expressions] + simp only [Fintype.sum_prod_type, Fintype.sum_sum_type, + inputExpressions, LinearExpression.cost_linear, Fintype.card_prod, + Fintype.card_fin, Finset.sum_const, Finset.card_univ, smul_eq_mul] + ring + +def recursiveProducts (a : Fin r → Fin n₁ × Fin n₂ → F) + (b : Fin r → Fin n₂ × Fin n₃ → F) (p : MatrixAlgorithm F m₁ m₂ m₃) : + Family F (MatrixInput (n₁ * m₁) (n₂ * m₂) (n₃ * m₃)) + (Fin r × (Fin m₁ × Fin m₃)) := + (inputFamily a b).compose (Family.copies r (Family.ofMatrix p)) + +theorem recursiveProducts_eval (a : Fin r → Fin n₁ × Fin n₂ → F) + (b : Fin r → Fin n₂ × Fin n₃ → F) + (p : MatrixAlgorithm F m₁ m₂ m₃) (hp : p.Correct) + (A : Matrix (Fin (n₁ * m₁)) (Fin (n₂ * m₂)) F) + (B : Matrix (Fin (n₂ * m₂)) (Fin (n₃ * m₃)) F) + (q : Fin r) (s : Fin m₁) (u : Fin m₃) : + (recursiveProducts a b p).eval (matrixInputs A B) (q, (s, u)) = + ((leftBlock a A q) * (rightBlock b B q)) s u := by + rw [recursiveProducts, Family.eval_compose, Family.eval_copies, + Family.eval_ofMatrix _ hp] + simp only [inputFamily_eval, matrixInputs, Matrix.mul_apply] + +theorem recursiveProducts_cost (a : Fin r → Fin n₁ × Fin n₂ → F) + (b : Fin r → Fin n₂ × Fin n₃ → F) (p : MatrixAlgorithm F m₁ m₂ m₃) : + (recursiveProducts a b p).cost = + 2 * r * (n₁ * n₂ * m₁ * m₂ + n₂ * n₃ * m₂ * m₃) + r * p.cost := by + rw [recursiveProducts, Family.cost_compose, inputFamily_cost, + Family.cost_copies, Family.cost_ofMatrix] + +def outputExpressions (c : Fin r → Fin n₃ × Fin n₁ → F) : + Fin (n₁ * m₁) × Fin (n₃ * m₃) → Expression F (Fin r × (Fin m₁ × Fin m₃)) := + fun o => LinearExpression.linear + (fun q => c q ((finProdFinEquiv.symm o.2).1, (finProdFinEquiv.symm o.1).1)) + (fun q => (q, ((finProdFinEquiv.symm o.1).2, (finProdFinEquiv.symm o.2).2))) + +def outputFamily (c : Fin r → Fin n₃ × Fin n₁ → F) : + Family F (Fin r × (Fin m₁ × Fin m₃)) (Fin (n₁ * m₁) × Fin (n₃ * m₃)) := + Family.expressions (outputExpressions c) + +theorem outputFamily_eval (c : Fin r → Fin n₃ × Fin n₁ → F) + (inputs : Fin r × (Fin m₁ × Fin m₃) → F) + (i : Fin n₁) (k : Fin n₃) (s : Fin m₁) (u : Fin m₃) : + (outputFamily c).eval inputs (join i s, join k u) = + ∑ q, c q (k, i) * inputs (q, (s, u)) := by + simp only [outputFamily, Family.eval_expressions, outputExpressions, + LinearExpression.eval_linear, join, Equiv.symm_apply_apply] + +theorem outputFamily_cost (c : Fin r → Fin n₃ × Fin n₁ → F) : + (outputFamily (m₁ := m₁) (m₃ := m₃) c).cost = 2 * r * n₁ * n₃ * m₁ * m₃ := by + simp only [outputFamily, Family.cost_expressions, outputExpressions, + LinearExpression.cost_linear, Fintype.card_fin, Finset.sum_const, + Finset.card_univ, Fintype.card_prod, smul_eq_mul] + ring + +def algorithm (a : Fin r → Fin n₁ × Fin n₂ → F) + (b : Fin r → Fin n₂ × Fin n₃ → F) (c : Fin r → Fin n₃ × Fin n₁ → F) + (p : MatrixAlgorithm F m₁ m₂ m₃) : + MatrixAlgorithm F (n₁ * m₁) (n₂ * m₂) (n₃ * m₃) := + let f := (recursiveProducts a b p).compose (outputFamily c) + ⟨f.registers, f.program, fun i k => f.output (i, k)⟩ + +theorem algorithm_correct + (a : Fin r → Fin n₁ × Fin n₂ → F) + (b : Fin r → Fin n₂ × Fin n₃ → F) (c : Fin r → Fin n₃ × Fin n₁ → F) + (h : Tensor.matrixCoefficients (K := F) (Fin n₁) (Fin n₂) (Fin n₃) = + fun x y z => ∑ q, Tensor.rankOne (a q) (b q) (c q) x y z) + (p : MatrixAlgorithm F m₁ m₂ m₃) (hp : p.Correct) : (algorithm a b c p).Correct := by + intro A B + funext i k + obtain ⟨⟨i, s⟩, rfl⟩ := finProdFinEquiv.surjective i + obtain ⟨⟨k, u⟩, rfl⟩ := finProdFinEquiv.surjective k + change ((recursiveProducts a b p).compose (outputFamily c)).eval + (matrixInputs A B) (join i s, join k u) = _ + rw [Family.eval_compose, outputFamily_eval] + simp_rw [recursiveProducts_eval a b p hp A B] + exact block_identity a b c h A B i k s u + +theorem algorithm_cost (a : Fin r → Fin n₁ × Fin n₂ → F) + (b : Fin r → Fin n₂ × Fin n₃ → F) (c : Fin r → Fin n₃ × Fin n₁ → F) + (p : MatrixAlgorithm F m₁ m₂ m₃) : + (algorithm a b c p).cost = r * p.cost + + 2 * r * (n₁ * n₂ * m₁ * m₂ + n₂ * n₃ * m₂ * m₃ + n₁ * n₃ * m₁ * m₃) := by + change ((recursiveProducts a b p).compose (outputFamily c)).cost = _ + rw [Family.cost_compose, recursiveProducts_cost, outputFamily_cost] + ring + +theorem rank_block_step + (h : Tensor.RankAtMost (Tensor.matrixCoefficients (K := F) (Fin n₁) (Fin n₂) (Fin n₃)) r) + (p : MatrixAlgorithm F m₁ m₂ m₃) (hp : p.Correct) : + ∃ q : MatrixAlgorithm F (n₁ * m₁) (n₂ * m₂) (n₃ * m₃), q.Correct ∧ + q.cost = r * p.cost + + 2 * r * (n₁ * n₂ * m₁ * m₂ + n₂ * n₃ * m₂ * m₃ + n₁ * n₃ * m₁ * m₃) := by + rcases h with ⟨a, b, c, h⟩ + exact ⟨algorithm a b c p, algorithm_correct a b c h p hp, algorithm_cost a b c p⟩ + +end BlockPrograms + +end MatrixMultiplication.Arithmetic.RecursiveBlock + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Arithmetic/CharacterRounding.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Arithmetic/CharacterRounding.lean new file mode 100644 index 0000000000000000000000000000000000000000..e6c9311f5c162c42012bbd9e8a1870a07c88a5ec --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Arithmetic/CharacterRounding.lean @@ -0,0 +1,122 @@ +import OAI.LinearAlgebra.MatrixMultiplication.AuxiliarySeparation.Arithmetic.ExponentComparison +import OAI.LinearAlgebra.MatrixMultiplication.AuxiliarySeparation.Character.Basic +import OAI.LinearAlgebra.MatrixMultiplication.AuxiliarySeparation.Arithmetic.RankExponent +import Mathlib.Algebra.Order.Floor.Ring + +namespace OAI + +/-! +# Integer rounding in the detecting-character argument + +The character used at a matrix size may depend on that size. A uniform bound +on all those characters is enough: the loss of one in rounding their target +values cannot change a positive power exponent. The character-existence and +character-growth assumptions remain explicit in the final implications. +-/ + +namespace MatrixMultiplication.AuxiliarySeparation + +open MatrixMultiplication.Foundation + +/-- Rounding strictly down works at integers too: use `ceil x - 1`. -/ +theorem exists_nat_sub_one_le_lt {x : ℝ} (hx : 0 < x) : + ∃ k : ℕ, x - 1 ≤ (k : ℝ) ∧ (k : ℝ) < x := by + have hc : 1 ≤ ⌈x⌉₊ := Nat.one_le_ceil_iff.mpr hx + refine ⟨⌈x⌉₊ - 1, ?_, ?_⟩ + · rw [Nat.cast_sub hc] + norm_num only [Nat.cast_one] + linarith [Nat.le_ceil x] + · exact ((Nat.ceil_eq_iff (by omega : ⌈x⌉₊ ≠ 0)).1 rfl).1 + +/-- An additive loss of one does not affect a comparison to a nonnegative +power exponent. No sign assumption on the exponent on the left is needed. -/ +theorem rpow_exponent_le_of_nat_sub_one_bound {ν τ : ℝ} (hτ : 0 ≤ τ) + (hbound : ∀ d : ℕ, 2 ≤ d → (d : ℝ) ^ ν - 1 ≤ (d : ℝ) ^ τ) : + ν ≤ τ := by + apply rpow_exponent_le_of_nat_bound (C := 2) + intro d hd + by_cases hd2 : 2 ≤ d + · have h := hbound d hd2 + have hdreal : (1 : ℝ) ≤ d := by exact_mod_cast hd + have hpow : 1 ≤ (d : ℝ) ^ τ := Real.one_le_rpow hdreal hτ + linarith + · have hd1 : d = 1 := by omega + simp [hd1] + +/-- The integer witnesses in the final rounding argument can vary with `d`. -/ +theorem exponent_le_of_integer_rounding {ν τ : ℝ} (hτ : 0 ≤ τ) + (hround : ∀ d : ℕ, 2 ≤ d → + ∃ k : ℕ, (d : ℝ) ^ ν - 1 ≤ k ∧ (k : ℝ) ≤ (d : ℝ) ^ τ) : + ν ≤ τ := by + apply rpow_exponent_le_of_nat_sub_one_bound hτ + intro d hd + obtain ⟨k, hk, hk'⟩ := hround d hd + exact hk.trans hk' + +/-- A positive exponent on the left makes the target exponent nonnegative +automatically, so it is an alternative to that hypothesis above. -/ +theorem exponent_le_of_integer_rounding_of_pos {ν τ : ℝ} (hν : 0 < ν) + (hround : ∀ d : ℕ, 2 ≤ d → + ∃ k : ℕ, (d : ℝ) ^ ν - 1 ≤ k ∧ (k : ℝ) ≤ (d : ℝ) ^ τ) : + ν ≤ τ := by + have hτ : 0 ≤ τ := by + by_contra hneg + obtain ⟨k, hk, hk'⟩ := hround 2 le_rfl + norm_num only [Nat.cast_ofNat] at hk hk' + have hpτ : (2 : ℝ) ^ τ < 1 := + Real.rpow_lt_one_of_one_lt_of_neg (by norm_num) (lt_of_not_ge hneg) + have hklt : (k : ℝ) < 1 := hk'.trans_lt hpτ + have hk0 : k = 0 := by + have : k < 1 := by exact_mod_cast hklt + omega + rw [hk0, Nat.cast_zero] at hk + have hpν : 1 < (2 : ℝ) ^ ν := Real.one_lt_rpow (by norm_num) hν + linarith + exact exponent_le_of_integer_rounding hτ hround + +/-- Explicitly conditional passage from detecting characters to the exponent +bound. The detecting character is allowed to depend on both `d` and `k`. -/ +theorem exponent_le_of_detecting_characters {ν τ : ℝ} (hτ : 0 ≤ τ) + (detect : ∀ d : ℕ, 2 ≤ d → ∀ k : ℕ, (k : ℝ) < (d : ℝ) ^ ν → + ∃ χ : Character, (k : ℝ) ≤ χ.value (Tensor.matrixMultiplication d d d)) + (bound : ∀ χ : Character, ∀ d : ℕ, 2 ≤ d → + χ.value (Tensor.matrixMultiplication d d d) ≤ (d : ℝ) ^ τ) : + ν ≤ τ := by + apply exponent_le_of_integer_rounding hτ + intro d hd + have hdpos : (0 : ℝ) < d := by exact_mod_cast (show 0 < d by omega) + obtain ⟨k, hk, hk'⟩ := + exists_nat_sub_one_le_lt (Real.rpow_pos_of_pos hdpos ν) + obtain ⟨χ, hχ⟩ := detect d hd k hk' + exact ⟨k, hk, hχ.trans (bound χ d hd)⟩ + +/-- The character growth bound can be supplied as a uniform bound on its +exponent sum, together with the matrix-value identity. -/ +theorem exponent_le_of_detecting_character_exponents {ν τ : ℝ} (hτ : 0 ≤ τ) + (exponentSum : Character → ℝ) + (value : ∀ χ : Character, ∀ d : ℕ, 2 ≤ d → + χ.value (Tensor.matrixMultiplication d d d) = (d : ℝ) ^ exponentSum χ) + (upper : ∀ χ : Character, exponentSum χ ≤ τ) + (detect : ∀ d : ℕ, 2 ≤ d → ∀ k : ℕ, (k : ℝ) < (d : ℝ) ^ ν → + ∃ χ : Character, (k : ℝ) ≤ χ.value (Tensor.matrixMultiplication d d d)) : + ν ≤ τ := by + apply exponent_le_of_detecting_characters hτ detect + intro χ d hd + rw [value χ d hd] + exact Real.rpow_le_rpow_of_exponent_le (by exact_mod_cast (show 1 ≤ d by omega)) + (upper χ) + +/-- The paper's final `ν ≤ 9/4` implication, with its two substantive character +inputs visible rather than incorporated into the definition of `ν`. -/ +theorem exactRankExponent_le_nine_quarters_of_characters + (detect : ∀ d : ℕ, 2 ≤ d → ∀ k : ℕ, + (k : ℝ) < (d : ℝ) ^ exactRankExponent → + ∃ χ : Character, (k : ℝ) ≤ χ.value (Tensor.matrixMultiplication d d d)) + (bound : ∀ χ : Character, ∀ d : ℕ, 2 ≤ d → + χ.value (Tensor.matrixMultiplication d d d) ≤ (d : ℝ) ^ (9 / 4 : ℝ)) : + exactRankExponent ≤ 9 / 4 := + exponent_le_of_detecting_characters (by norm_num) detect bound + +end MatrixMultiplication.AuxiliarySeparation + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Arithmetic/Exponent.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Arithmetic/Exponent.lean new file mode 100644 index 0000000000000000000000000000000000000000..9bf25d253ffbfd8e99f5c4ca6ed4d6f35e049ead --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Arithmetic/Exponent.lean @@ -0,0 +1,131 @@ +import OAI.LinearAlgebra.MatrixMultiplication.AuxiliarySeparation.Arithmetic.RankExponent +import OAI.LinearAlgebra.MatrixMultiplication.ComplexArithmetic.Growth +import OAI.LinearAlgebra.MatrixMultiplication.Arithmetic.Compatibility +import OAI.LinearAlgebra.MatrixMultiplication.Arithmetic.Exponent + +namespace OAI + +/-! +# From exact tensor rank to arithmetic complexity + +This file supplies the arithmetic conversion in Section 6.2. It uses the +existing division-free straight-line programs over `ℂ`: loading inputs and +constants is free, and each scalar addition, subtraction, or multiplication +costs one. Correctness means matrix multiplication on every pair of inputs. + +The substantive tensor estimates are separate. Here `omega` is an alias for +the existing arithmetic exponent, and the general bridge proves +`omega ≤ exactRankExponent`. Thus any independently established upper bound +on the exact-rank exponent gives an arithmetic bound with every positive +exponent slack. No particular numerical upper bound is assumed or asserted. +-/ + +noncomputable section + +namespace MatrixMultiplication.AuxiliarySeparation + +open MatrixMultiplication.Foundation + +/-- The arithmetic matrix multiplication exponent over the complex numbers, +in the repository's existing scalar-operation model. -/ +abbrev omega : ℝ := MatrixMultiplication.Arithmetic.omega ℂ + +/-- A uniform scalar-operation bound with arbitrary positive exponent slack. -/ +abbrev ArithmeticBound (τ : ℝ) : Prop := + MatrixMultiplication.Arithmetic.AdmissibleExponent ℂ τ + +/-- The existing arithmetic exponent is itself admissible; hence its infimum +has exactly the expected upper-bound interpretation. -/ +theorem arithmeticBound_iff_omega_le {τ : ℝ} : + ArithmeticBound τ ↔ omega ≤ τ := + MatrixMultiplication.Arithmetic.admissibleExponent_iff_omega_le + +/-- Expanded form of the arithmetic statement, including its quantifier order +and the correctness and operation cost of the resulting programs. -/ +theorem arithmeticComplexity_iff_omega_le {τ : ℝ} : + (∀ ε : ℝ, 0 < ε → ∃ C : ℝ, 0 < C ∧ + ∀ n : ℕ, 1 ≤ n → + ∃ P : MatrixMultiplication.Arithmetic.MatrixAlgorithm ℂ n n n, + P.Correct ∧ (P.cost : ℝ) ≤ C * (n : ℝ) ^ (τ + ε)) ↔ omega ≤ τ := + arithmeticBound_iff_omega_le + +/-- A finite exact decomposition gives an arithmetic bound by block +substitution, including all the scalar operations in the linear combinations, +followed by padding to arbitrary positive sizes. -/ +theorem arithmeticBound_of_rankAtMost {n R : ℕ} (hn : 2 ≤ n) + (hRank : Tensor.RankAtMost (Tensor.matrixMultiplication n n n) R) + {τ : ℝ} (hτ : 2 ≤ τ) (hR : (R : ℝ) ≤ (n : ℝ) ^ τ) : + ArithmeticBound τ := + (MatrixMultiplication.Arithmetic.complex_admissibleExponent_iff τ).mpr + (MatrixMultiplication.Foundation.Arithmetic.admissibleExponent_of_rankAtMost hn hRank hτ hR) + +theorem omega_le_of_rankAtMost {n R : ℕ} (hn : 2 ≤ n) + (hRank : Tensor.RankAtMost (Tensor.matrixMultiplication n n n) R) + {τ : ℝ} (hτ : 2 ≤ τ) (hR : (R : ℝ) ≤ (n : ℝ) ^ τ) : + omega ≤ τ := + arithmeticBound_iff_omega_le.mp (arithmeticBound_of_rankAtMost hn hRank hτ hR) + +/-- The quadratic rank lower bound pays for the quadratic block-combination +overhead, including the boundary case of rank exactly `n²`. -/ +theorem omega_le_logb_rank {n R : ℕ} (hn : 2 ≤ n) + (hRank : Tensor.RankAtMost (Tensor.matrixMultiplication n n n) R) : + omega ≤ Real.logb (n : ℝ) (R : ℝ) := by + have hquad : n ^ 2 ≤ R := matrixMultiplication_rank_lower (by omega) hRank + have hn1 : 1 < (n : ℝ) := by exact_mod_cast (show 1 < n by omega) + have hn0 : 0 < (n : ℝ) := zero_lt_one.trans hn1 + have hR0 : 0 < (R : ℝ) := by + have : 0 < n ^ 2 := pow_pos (by omega : 0 < n) _ + exact_mod_cast (this.trans_le hquad) + have hτ : 2 ≤ Real.logb (n : ℝ) (R : ℝ) := by + apply (Real.le_logb_iff_rpow_le hn1 hR0).mpr + simpa only [Real.rpow_two, Nat.cast_pow] using + (Nat.cast_le.mpr hquad : ((n ^ 2 : ℕ) : ℝ) ≤ (R : ℝ)) + exact omega_le_of_rankAtMost hn hRank hτ + (Real.rpow_logb hn0 (ne_of_gt hn1) hR0).symm.le + +/-- Near-optimal finite blocks suffice: no finite decomposition is required +to attain the limiting exponent. -/ +theorem arithmeticBound_of_arbitrarily_close_rankBounds {τ : ℝ} (hτ : 2 ≤ τ) + (hRank : ∀ δ : ℝ, 0 < δ → ∃ n R : ℕ, 2 ≤ n ∧ + Tensor.RankAtMost (Tensor.matrixMultiplication n n n) R ∧ + (R : ℝ) ≤ (n : ℝ) ^ (τ + δ)) : ArithmeticBound τ := by + apply arithmeticBound_iff_omega_le.mpr + apply le_of_forall_pos_le_add + intro δ hδ + obtain ⟨n, R, hn, hRank, hR⟩ := hRank δ hδ + exact omega_le_of_rankAtMost hn hRank (by linarith) hR + +/-- The arithmetic exponent is bounded by each exact finite-block exponent. -/ +theorem omega_le_exactMatrixRank_logb {n : ℕ} (hn : 2 ≤ n) : + omega ≤ Real.logb (n : ℝ) (exactMatrixRank n : ℝ) := + omega_le_logb_rank hn (exactMatrixRank_spec n) + +/-- General exact-rank-to-arithmetic bridge. The proof uses a lower bound for +every finite-block exponent, so it does not require attainment of the infimum. -/ +theorem omega_le_exactRankExponent : omega ≤ exactRankExponent := by + apply le_csInf exactRankExponentSet_nonempty + rintro τ ⟨n, hn, rfl⟩ + exact omega_le_exactMatrixRank_logb hn + +theorem arithmeticBound_exactRankExponent : ArithmeticBound exactRankExponent := + arithmeticBound_iff_omega_le.mpr omega_le_exactRankExponent + +/-- Any upper bound on the exact-rank exponent gives the same arithmetic +exponent bound, with arbitrary positive slack. -/ +theorem arithmeticBound_of_exactRankExponent_le {τ : ℝ} + (hτ : exactRankExponent ≤ τ) : ArithmeticBound τ := + arithmeticBound_iff_omega_le.mpr (omega_le_exactRankExponent.trans hτ) + +/-- Explicit epsilon-complexity conclusion from an exact-rank exponent bound. -/ +theorem arithmeticComplexity_of_exactRankExponent_le {τ : ℝ} + (hτ : exactRankExponent ≤ τ) (ε : ℝ) (hε : 0 < ε) : + ∃ C : ℝ, 0 < C ∧ ∀ n : ℕ, 1 ≤ n → + ∃ P : MatrixMultiplication.Arithmetic.MatrixAlgorithm ℂ n n n, + P.Correct ∧ (P.cost : ℝ) ≤ C * (n : ℝ) ^ (τ + ε) := + arithmeticBound_of_exactRankExponent_le hτ ε hε + +end MatrixMultiplication.AuxiliarySeparation + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Arithmetic/ExponentComparison.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Arithmetic/ExponentComparison.lean new file mode 100644 index 0000000000000000000000000000000000000000..8bb4ed77e5143f3117d0269859fc10de6a603539 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Arithmetic/ExponentComparison.lean @@ -0,0 +1,89 @@ +import Mathlib.Analysis.SpecialFunctions.Pow.Real +import Mathlib.Tactic + +namespace OAI + +/-! +# Comparing power growth + +The last scalar step of the auxiliary-separation argument compares a +fourth-power lower bound for the cube of the diagonal profile with its +dimension upper bound. Powers of two suffice to compare the exponents, so +the argument needs no asymptotic estimates or approximation of constants. +-/ + +namespace MatrixMultiplication.AuxiliarySeparation + +/-- A uniform bound on all positive natural inputs forces the exponent on +the left to be no larger than the exponent on the right. -/ +theorem rpow_exponent_le_of_nat_bound {a b C : ℝ} + (hbound : ∀ n : ℕ, 1 ≤ n → (n : ℝ) ^ a ≤ C * (n : ℝ) ^ b) : + a ≤ b := by + have hC : 0 < C := by + have h := hbound 1 (by omega) + norm_num at h + linarith + by_contra hab + have hab' : 0 < a - b := sub_pos.mpr (lt_of_not_ge hab) + have hlog2 : 0 < Real.log (2 : ℝ) := Real.log_pos (by norm_num) + have hp : 0 < (a - b) * Real.log 2 := mul_pos hab' hlog2 + obtain ⟨k, hk⟩ := exists_nat_gt (Real.log C / ((a - b) * Real.log 2)) + have hk' : Real.log C < (k : ℝ) * ((a - b) * Real.log 2) := + (div_lt_iff₀ hp).mp hk + have hn : (0 : ℝ) < (2 ^ k : ℕ) := by positivity + have h := Real.log_le_log (Real.rpow_pos_of_pos hn a) + (hbound (2 ^ k) (Nat.one_le_iff_ne_zero.mpr (by positivity))) + rw [Real.log_mul hC.ne' (Real.rpow_pos_of_pos hn b).ne', + Real.log_rpow hn a, Real.log_rpow hn b] at h + simp only [Nat.cast_pow, Nat.cast_ofNat, Real.log_pow] at h + nlinarith + +/-- The diagonal lower bound and the dimension upper bound force the scalar +exponent to be at most `3/4`. -/ +theorem diagonal_exponent_le_three_quarters {D : ℕ → ℝ} {t : ℝ} + (ht : 0 < t) + (hnonneg : ∀ n : ℕ, 1 ≤ n → 0 ≤ D n) + (hlower : ∀ n : ℕ, 1 ≤ n → (n : ℝ) ^ 4 ≤ D n ^ 3) + (hupper : ∀ n : ℕ, 1 ≤ n → D n ≤ (2 * (n : ℝ) - 1) ^ (1 / t)) : + t ≤ 3 / 4 := by + have hexp : 0 ≤ 1 / t := le_of_lt (one_div_pos.mpr ht) + have hpower : ∀ n : ℕ, 1 ≤ n → + (n : ℝ) ^ (4 : ℝ) ≤ + (2 : ℝ) ^ ((1 / t) * 3) * (n : ℝ) ^ ((1 / t) * 3) := by + intro n hn + have hn' : (1 : ℝ) ≤ n := by exact_mod_cast hn + have hbase : 0 ≤ 2 * (n : ℝ) - 1 := by linarith + have hu : D n ≤ (2 * (n : ℝ)) ^ (1 / t) := + (hupper n hn).trans (Real.rpow_le_rpow hbase (by linarith) hexp) + calc + (n : ℝ) ^ (4 : ℝ) = (n : ℝ) ^ 4 := by norm_num + _ ≤ D n ^ 3 := hlower n hn + _ ≤ ((2 * (n : ℝ)) ^ (1 / t)) ^ 3 := + pow_le_pow_left₀ (hnonneg n hn) hu 3 + _ = (2 * (n : ℝ)) ^ ((1 / t) * 3) := by + simpa only [Nat.cast_ofNat] using + (Real.rpow_mul_natCast (show 0 ≤ 2 * (n : ℝ) by positivity) (1 / t) 3).symm + _ = (2 : ℝ) ^ ((1 / t) * 3) * (n : ℝ) ^ ((1 / t) * 3) := + Real.mul_rpow (by norm_num) (by positivity) + have hcompare : (4 : ℝ) ≤ (1 / t) * 3 := + rpow_exponent_le_of_nat_bound hpower + have hmul := mul_le_mul_of_nonneg_right hcompare (le_of_lt ht) + have hcancel : ((1 / t) * 3) * t = (3 : ℝ) := by + field_simp + rw [hcancel] at hmul + linarith + +/-- The scalar comparison in the normalization used for the matrix +multiplication exponent. -/ +theorem three_mul_diagonal_exponent_le_nine_quarters {D : ℕ → ℝ} {t : ℝ} + (ht : 0 < t) + (hnonneg : ∀ n : ℕ, 1 ≤ n → 0 ≤ D n) + (hlower : ∀ n : ℕ, 1 ≤ n → (n : ℝ) ^ 4 ≤ D n ^ 3) + (hupper : ∀ n : ℕ, 1 ≤ n → D n ≤ (2 * (n : ℝ) - 1) ^ (1 / t)) : + 3 * t ≤ 9 / 4 := by + have h := diagonal_exponent_le_three_quarters ht hnonneg hlower hupper + linarith + +end MatrixMultiplication.AuxiliarySeparation + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Arithmetic/RankBound.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Arithmetic/RankBound.lean new file mode 100644 index 0000000000000000000000000000000000000000..f3636ab6427f99d6bed1c9487a013996a79151c0 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Arithmetic/RankBound.lean @@ -0,0 +1,29 @@ +import OAI.LinearAlgebra.MatrixMultiplication.AuxiliarySeparation.Character.Existence +import OAI.LinearAlgebra.MatrixMultiplication.AuxiliarySeparation.Arithmetic.CharacterRounding +import OAI.LinearAlgebra.MatrixMultiplication.AuxiliarySeparation.Polynomial.Inequalities + +namespace OAI + +/-! +# The exact-rank exponent bound + +Detecting characters exist by Appendix A. The determinant and three-sector +polynomial constructions bound the sum of their dot-product exponents by +`9/4`. Integer rounding then gives the same bound for the exact-rank exponent. +-/ + +namespace MatrixMultiplication.AuxiliarySeparation + +/-- The polynomial inequalities bound the actual exact-rank exponent. -/ +theorem exactRankExponent_le_nine_quarters : exactRankExponent ≤ (9 : ℝ) / 4 := by + apply exactRankExponent_le_nine_quarters_of_characters + · intro d hd k hk + exact exists_detecting_character hd hk + · intro χ d hd + rw [χ.value_matrixMultiplication (by omega)] + exact Real.rpow_le_rpow_of_exponent_le + (by exact_mod_cast (show 1 ≤ d by omega)) χ.exponent_sum_le_nine_quarters + +end MatrixMultiplication.AuxiliarySeparation + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Arithmetic/RankExponent.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Arithmetic/RankExponent.lean new file mode 100644 index 0000000000000000000000000000000000000000..090afb7629c421eb89ec8a34d2c7593aee37ba89 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Arithmetic/RankExponent.lean @@ -0,0 +1,225 @@ +import OAI.LinearAlgebra.MatrixMultiplication.Tensor.ComplexTensorFlattening +import Mathlib.Analysis.SpecialFunctions.Log.Base + +namespace OAI + +/-! +# Exact tensor rank and its matrix multiplication exponent + +The rank is the least size of an exact decomposition into simple tensors. The +exponent is the infimum of the finite matrix multiplication rank ratios from +Section 3; no attainment of this real infimum is assumed. +-/ + +noncomputable section + +open MatrixMultiplication.Foundation +open scoped BigOperators + +namespace MatrixMultiplication.AuxiliarySeparation + +/-- Every finite coefficient tensor has a finite exact rank decomposition. -/ +theorem exists_rankAtMost {X Y Z : Type*} [Fintype X] [Fintype Y] [Fintype Z] + (T : Tensor ℂ X Y Z) : ∃ r : ℕ, Tensor.RankAtMost T r := by + classical + let a : X × Y × Z → X → ℂ := fun p x => if x = p.1 then T p.1 p.2.1 p.2.2 else 0 + let b : X × Y × Z → Y → ℂ := fun p y => if y = p.2.1 then 1 else 0 + let c : X × Y × Z → Z → ℂ := fun p z => if z = p.2.2 then 1 else 0 + refine ⟨Fintype.card (X × Y × Z), ?_⟩ + have heq : T = fun x y z => ∑ p, Tensor.rankOne (a p) (b p) (c p) x y z := by + funext x y z + simp [a, b, c, Tensor.rankOne, Fintype.sum_prod_type, mul_ite] + rw [heq] + exact Tensor.rankAtMost_sum_rankOne a b c + +/-- Exact rank of a finite complex coefficient tensor. -/ +def exactRank {X Y Z : Type*} [Fintype X] [Fintype Y] [Fintype Z] + (T : Tensor ℂ X Y Z) : ℕ := by + classical + exact Nat.find (exists_rankAtMost T) + +/-- The least exact rank comes with an actual rank decomposition. -/ +theorem exactRank_spec {X Y Z : Type*} [Fintype X] [Fintype Y] [Fintype Z] + (T : Tensor ℂ X Y Z) : Tensor.RankAtMost T (exactRank T) := by + classical + exact Nat.find_spec (exists_rankAtMost T) + +/-- Every exact decomposition bounds the least rank. -/ +theorem exactRank_le {X Y Z : Type*} [Fintype X] [Fintype Y] [Fintype Z] + {T : Tensor ℂ X Y Z} {r : ℕ} (h : Tensor.RankAtMost T r) : exactRank T ≤ r := by + classical + exact Nat.find_min' (exists_rankAtMost T) h + +/-- Exact rank cannot increase under a linear restriction. -/ +theorem exactRank_restrict_le {X Y Z X' Y' Z' : Type*} + [Fintype X] [Fintype Y] [Fintype Z] + [Fintype X'] [Fintype Y'] [Fintype Z'] + (T : Tensor ℂ X Y Z) (A : X' → X → ℂ) (B : Y' → Y → ℂ) + (C : Z' → Z → ℂ) : exactRank (Tensor.restrict A B C T) ≤ exactRank T := + exactRank_le ((exactRank_spec T).restrict A B C) + +/-- Independent bijections of the three coordinate sets preserve exact rank. -/ +theorem exactRank_reindex {X Y Z X' Y' Z' : Type*} + [Fintype X] [Fintype Y] [Fintype Z] + [Fintype X'] [Fintype Y'] [Fintype Z'] + (T : Tensor ℂ X Y Z) (ex : X' ≃ X) (ey : Y' ≃ Y) (ez : Z' ≃ Z) : + exactRank (Tensor.pullback ex ey ez T) = exactRank T := by + apply le_antisymm (exactRank_le ((exactRank_spec T).pullback ex ey ez)) + have h := exactRank_le + ((exactRank_spec (Tensor.pullback ex ey ez T)).pullback ex.symm ey.symm ez.symm) + have heq : Tensor.pullback ex.symm ey.symm ez.symm (Tensor.pullback ex ey ez T) = T := by + funext x y z + simp [Tensor.pullback] + simpa only [heq] using h + +/-- Tensor product decompositions give the usual submultiplicative rank bound. -/ +theorem exactRank_product_le {X Y Z U V W : Type*} + [Fintype X] [Fintype Y] [Fintype Z] + [Fintype U] [Fintype V] [Fintype W] + (T : Tensor ℂ X Y Z) (S : Tensor ℂ U V W) : + exactRank (Tensor.product T S) ≤ exactRank T * exactRank S := + exactRank_le ((exactRank_spec T).product (exactRank_spec S)) + +/-- Exact rank of the square matrix multiplication tensor. -/ +def exactMatrixRank (n : ℕ) : ℕ := exactRank (Tensor.matrixMultiplication n n n) + +theorem exactMatrixRank_spec (n : ℕ) : + Tensor.RankAtMost (Tensor.matrixMultiplication n n n) (exactMatrixRank n) := + exactRank_spec _ + +/-- The ordinary scalar multiplication algorithm uses `n³` simple tensors. -/ +theorem matrixMultiplication_rankAtMost_cubic (n : ℕ) : + Tensor.RankAtMost (Tensor.matrixMultiplication n n n) (n ^ 3) := by + classical + let a : Fin n × Fin n × Fin n → Fin n × Fin n → ℂ := + fun p x => if x = (p.1, p.2.1) then 1 else 0 + let b : Fin n × Fin n × Fin n → Fin n × Fin n → ℂ := + fun p y => if y = (p.2.1, p.2.2) then 1 else 0 + let c : Fin n × Fin n × Fin n → Fin n × Fin n → ℂ := + fun p z => if z = (p.2.2, p.1) then 1 else 0 + have heq : Tensor.matrixMultiplication n n n = + fun x y z => ∑ p, Tensor.rankOne (a p) (b p) (c p) x y z := by + funext x y z + simp [a, b, c, Tensor.rankOne, Tensor.matrixMultiplication, + Fintype.sum_prod_type, Prod.ext_iff, ite_and, mul_ite] + split_ifs <;> simp_all + rw [heq] + convert Tensor.rankAtMost_sum_rankOne a b c using 1 + simp [Fintype.card_prod, pow_succ, Nat.mul_assoc] + +theorem exactMatrixRank_upper (n : ℕ) : exactMatrixRank n ≤ n ^ 3 := + exactRank_le (matrixMultiplication_rankAtMost_cubic n) + +/-- An identity minor of the output flattening forces the quadratic lower bound. -/ +theorem matrixMultiplication_rank_lower {n R : ℕ} (hn : 0 < n) + (hRank : Tensor.RankAtMost (Tensor.matrixMultiplication n n n) R) : n ^ 2 ≤ R := by + let j : Fin n := ⟨0, hn⟩ + have hminor : ∀ i k : Fin n × Fin n, + Tensor.matrixMultiplication n n n (i.2, j) (j, i.1) k = + if i = k then 1 else 0 := by + intro i k + simp [Tensor.matrixMultiplication, Prod.ext_iff, eq_comm] + have h := hRank.card_le_of_identity + (fun i : Fin n × Fin n => (i.2, j)) + (fun i : Fin n × Fin n => (j, i.1)) id hminor + simpa [Fintype.card_prod, pow_two] using h + +theorem exactMatrixRank_lower {n : ℕ} (hn : 0 < n) : n ^ 2 ≤ exactMatrixRank n := + matrixMultiplication_rank_lower hn (exactMatrixRank_spec n) + +theorem exactMatrixRank_pos {n : ℕ} (hn : 0 < n) : 0 < exactMatrixRank n := + lt_of_lt_of_le (pow_pos hn 2) (exactMatrixRank_lower hn) + +@[simp] theorem exactMatrixRank_zero : exactMatrixRank 0 = 0 := + Nat.eq_zero_of_le_zero (by simpa using exactMatrixRank_upper 0) + +@[simp] theorem exactMatrixRank_one : exactMatrixRank 1 = 1 := by + apply le_antisymm + · simpa using exactMatrixRank_upper 1 + · simpa using exactMatrixRank_lower (n := 1) zero_lt_one + +/-- The set of finite exact-rank exponents in the definition of `ν`. -/ +def exactRankExponentSet : Set ℝ := + {τ | ∃ n : ℕ, 2 ≤ n ∧ τ = Real.logb n (exactMatrixRank n)} + +/-- The exact-rank exponent `ν = inf_{n ≥ 2} log(R(Tₙ))/log(n)`. -/ +def exactRankExponent : ℝ := sInf exactRankExponentSet + +theorem exactRankExponentSet_nonempty : exactRankExponentSet.Nonempty := + ⟨Real.logb 2 (exactMatrixRank 2), 2, le_rfl, rfl⟩ + +theorem exactMatrixRank_logb_lower {n : ℕ} (hn : 2 ≤ n) : + 2 ≤ Real.logb n (exactMatrixRank n) := by + have hn1 : 1 < (n : ℝ) := by exact_mod_cast (show 1 < n by omega) + have hr : 0 < (exactMatrixRank n : ℝ) := by + exact_mod_cast exactMatrixRank_pos (show 0 < n by omega) + apply (Real.le_logb_iff_rpow_le hn1 hr).mpr + rw [Real.rpow_two] + exact_mod_cast exactMatrixRank_lower (show 0 < n by omega) + +theorem exactMatrixRank_logb_upper {n : ℕ} (hn : 2 ≤ n) : + Real.logb n (exactMatrixRank n) ≤ 3 := by + have hn1 : 1 < (n : ℝ) := by exact_mod_cast (show 1 < n by omega) + have hr : 0 < (exactMatrixRank n : ℝ) := by + exact_mod_cast exactMatrixRank_pos (show 0 < n by omega) + apply (Real.logb_le_iff_le_rpow hn1 hr).mpr + rw [show (3 : ℝ) = (3 : ℕ) by norm_num, Real.rpow_natCast] + exact_mod_cast exactMatrixRank_upper n + +theorem exactRankExponentSet_bddBelow : BddBelow exactRankExponentSet := by + refine ⟨2, ?_⟩ + rintro τ ⟨n, hn, rfl⟩ + exact exactMatrixRank_logb_lower hn + +theorem exactRankExponent_lower : 2 ≤ exactRankExponent := + le_csInf exactRankExponentSet_nonempty (by + rintro τ ⟨n, hn, rfl⟩ + exact exactMatrixRank_logb_lower hn) + +theorem exactRankExponent_le_logb {n : ℕ} (hn : 2 ≤ n) : + exactRankExponent ≤ Real.logb n (exactMatrixRank n) := + csInf_le exactRankExponentSet_bddBelow ⟨n, hn, rfl⟩ + +theorem exactRankExponent_upper : exactRankExponent ≤ 3 := + (exactRankExponent_le_logb (n := 2) le_rfl).trans + (exactMatrixRank_logb_upper (n := 2) le_rfl) + +/-- Each matrix multiplication tensor has rank at least `n^ν`. -/ +theorem exactMatrixRank_rpow_lower {n : ℕ} (hn : 2 ≤ n) : + (n : ℝ) ^ exactRankExponent ≤ exactMatrixRank n := by + have hn1 : 1 < (n : ℝ) := by exact_mod_cast (show 1 < n by omega) + have hr : 0 < (exactMatrixRank n : ℝ) := by + exact_mod_cast exactMatrixRank_pos (show 0 < n by omega) + exact (Real.le_logb_iff_rpow_le hn1 hr).mp (exactRankExponent_le_logb hn) + +/-- The rank lower bound includes the one-dimensional boundary case. -/ +theorem exactMatrixRank_rpow_lower_of_pos {n : ℕ} (hn : 0 < n) : + (n : ℝ) ^ exactRankExponent ≤ exactMatrixRank n := by + by_cases hn2 : 2 ≤ n + · exact exactMatrixRank_rpow_lower hn2 + · have hn1 : n = 1 := by omega + simp [hn1] + +/-- A strict upper bound for the infimum is witnessed by an actual finite block. -/ +theorem exists_exactMatrixRank_lt_rpow {τ : ℝ} (hτ : exactRankExponent < τ) : + ∃ n : ℕ, 2 ≤ n ∧ (exactMatrixRank n : ℝ) < (n : ℝ) ^ τ := by + obtain ⟨σ, ⟨n, hn, rfl⟩, hσ⟩ := + exists_lt_of_csInf_lt exactRankExponentSet_nonempty hτ + refine ⟨n, hn, ?_⟩ + have hn1 : 1 < (n : ℝ) := by exact_mod_cast (show 1 < n by omega) + have hr : 0 < (exactMatrixRank n : ℝ) := by + exact_mod_cast exactMatrixRank_pos (show 0 < n by omega) + exact (Real.logb_lt_iff_lt_rpow hn1 hr).mp hσ + +/-- Finite decompositions approximate the exact-rank exponent with any positive slack. -/ +theorem exists_rankAtMost_of_exponent_slack {ε : ℝ} (hε : 0 < ε) : + ∃ n R : ℕ, 2 ≤ n ∧ Tensor.RankAtMost (Tensor.matrixMultiplication n n n) R ∧ + (R : ℝ) ≤ (n : ℝ) ^ (exactRankExponent + ε) := by + obtain ⟨n, hn, hR⟩ := exists_exactMatrixRank_lt_rpow (lt_add_of_pos_right _ hε) + exact ⟨n, exactMatrixRank n, hn, exactMatrixRank_spec n, hR.le⟩ + +end MatrixMultiplication.AuxiliarySeparation + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Character/Basic.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Character/Basic.lean new file mode 100644 index 0000000000000000000000000000000000000000..ba7fc3b9d6f3621c33072e144a0d8cc8b3f641da --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Character/Basic.lean @@ -0,0 +1,158 @@ +import OAI.LinearAlgebra.MatrixMultiplication.Tensor.ComplexTensor +import Mathlib.Logic.Equiv.Prod + +namespace OAI + +/-! +# Characters of finite complex tensors + +The tensor operations in this file are the coefficient operations from +`MatrixMultiplication.Foundation.Tensor`. A character is an assumption on those +operations, not an assertion that a character exists. Restriction monotonicity +forces invariance under independent invertible changes of coordinates, so this +interface descends to the mutual-restriction classes of Section 3 of the paper. +-/ + +noncomputable section + +open MatrixMultiplication.Foundation +open scoped BigOperators + +namespace MatrixMultiplication.AuxiliarySeparation + +/-- The scalar multiplication tensor, the multiplicative unit. -/ +def unitTensor : Tensor ℂ PUnit PUnit PUnit := fun _ _ _ => 1 + +/-- The direct sum of `r` scalar multiplication tensors, in diagonal coordinates. -/ +def scalarTensor (r : ℕ) : Tensor ℂ (Fin r) (Fin r) (Fin r) := + fun i j k => if i = j ∧ i = k then 1 else 0 + +/-- A normalized, additive, multiplicative, restriction-monotone tensor valuation. + +Index types vary over all finite types in `Type`. No character-existence result is +included among the fields or claimed by this definition. +-/ +structure Character where + value : {X Y Z : Type} → [Fintype X] → [Fintype Y] → [Fintype Z] → + Tensor ℂ X Y Z → ℝ + nonneg : ∀ {X Y Z : Type} [Fintype X] [Fintype Y] [Fintype Z] + (T : Tensor ℂ X Y Z), 0 ≤ value T + map_zero : ∀ {X Y Z : Type} [Fintype X] [Fintype Y] [Fintype Z], + value (0 : Tensor ℂ X Y Z) = 0 + map_one : value unitTensor = 1 + map_directSum : ∀ {ι X Y Z : Type} [Fintype ι] [DecidableEq ι] + [Fintype X] [Fintype Y] [Fintype Z] (T : ι → Tensor ℂ X Y Z), + value (Tensor.directSum T) = ∑ i, value (T i) + map_product : ∀ {X Y Z U V W : Type} [Fintype X] [Fintype Y] [Fintype Z] + [Fintype U] [Fintype V] [Fintype W] + (T : Tensor ℂ X Y Z) (S : Tensor ℂ U V W), + value (Tensor.product T S) = value T * value S + monotone : ∀ {X Y Z X' Y' Z' : Type} + [Fintype X] [Fintype Y] [Fintype Z] + [Fintype X'] [Fintype Y'] [Fintype Z'] + (T : Tensor ℂ X Y Z) (A : X' → X → ℂ) + (B : Y' → Y → ℂ) (C : Z' → Z → ℂ), + value (Tensor.restrict A B C T) ≤ value T + +namespace Character + +variable (χ : Character) +variable {X Y Z X' Y' Z' : Type} +variable [Fintype X] [Fintype Y] [Fintype Z] +variable [Fintype X'] [Fintype Y'] [Fintype Z'] + +/-- Coordinate pullbacks are restrictions. -/ +theorem value_pullback_le (T : Tensor ℂ X Y Z) + (fx : X' → X) (fy : Y' → Y) (fz : Z' → Z) : + χ.value (Tensor.pullback fx fy fz T) ≤ χ.value T := by + classical + rw [Tensor.pullback_eq_restrict] + exact χ.monotone T _ _ _ + +/-- Independent coordinate bijections preserve a character. -/ +theorem value_reindex (T : Tensor ℂ X Y Z) + (ex : X' ≃ X) (ey : Y' ≃ Y) (ez : Z' ≃ Z) : + χ.value (Tensor.pullback ex ey ez T) = χ.value T := by + apply le_antisymm (χ.value_pullback_le T ex ey ez) + have h := χ.value_pullback_le (Tensor.pullback ex ey ez T) ex.symm ey.symm ez.symm + have heq : Tensor.pullback ex.symm ey.symm ez.symm + (Tensor.pullback ex ey ez T) = T := by + funext x y z + simp [Tensor.pullback] + simpa only [heq] using h + +/-- The character has the same value on mutually restricting tensors. -/ +theorem value_eq_of_mutual_restriction (T : Tensor ℂ X Y Z) (S : Tensor ℂ X' Y' Z') + (A : X' → X → ℂ) (B : Y' → Y → ℂ) (C : Z' → Z → ℂ) + (A' : X → X' → ℂ) (B' : Y → Y' → ℂ) (C' : Z → Z' → ℂ) + (hS : S = Tensor.restrict A B C T) (hT : T = Tensor.restrict A' B' C' S) : + χ.value T = χ.value S := by + apply le_antisymm + · calc + χ.value T = χ.value (Tensor.restrict A' B' C' S) := congrArg χ.value hT + _ ≤ χ.value S := χ.monotone S A' B' C' + · calc + χ.value S = χ.value (Tensor.restrict A B C T) := congrArg χ.value hS + _ ≤ χ.value T := χ.monotone T A B C + +/-- An integer scalar tensor has its expected character value. -/ +@[simp] theorem value_scalarTensor (r : ℕ) : χ.value (scalarTensor r) = r := by + let T : Fin r → Tensor ℂ PUnit PUnit PUnit := fun _ => unitTensor + have heq : Tensor.pullback (Equiv.prodPUnit (Fin r)).symm + (Equiv.prodPUnit (Fin r)).symm (Equiv.prodPUnit (Fin r)).symm + (Tensor.directSum T) = scalarTensor r := by + rfl + rw [← heq, χ.value_reindex, χ.map_directSum] + simp [T, χ.map_one] + +omit [Fintype X] [Fintype Y] [Fintype Z] in +/-- Restricting a diagonal scalar tensor realizes a rank decomposition. -/ +theorem restrict_scalarTensor (r : ℕ) (a : Fin r → X → ℂ) + (b : Fin r → Y → ℂ) (c : Fin r → Z → ℂ) : + Tensor.restrict (fun x i => a i x) (fun y i => b i y) (fun z i => c i z) + (scalarTensor r) = + fun x y z => ∑ i, Tensor.rankOne (a i) (b i) (c i) x y z := by + classical + funext x y z + simp [Tensor.restrict, scalarTensor, Tensor.rankOne, mul_ite, ite_and] + +/-- Character values are bounded by every exact rank decomposition size. -/ +theorem value_le_rank {T : Tensor ℂ X Y Z} {r : ℕ} (h : Tensor.RankAtMost T r) : + χ.value T ≤ r := by + rcases h with ⟨a, b, c, rfl⟩ + rw [← restrict_scalarTensor r a b c] + exact (χ.monotone (scalarTensor r) _ _ _).trans_eq (χ.value_scalarTensor r) + +/-- Every nonzero tensor restricts to the scalar multiplication tensor. -/ +theorem one_le_value {T : Tensor ℂ X Y Z} (hT : T ≠ 0) : 1 ≤ χ.value T := by + classical + obtain ⟨x, hx⟩ := Function.ne_iff.mp hT + obtain ⟨y, hy⟩ := Function.ne_iff.mp hx + obtain ⟨z, hz⟩ := Function.ne_iff.mp hy + change T x y z ≠ 0 at hz + let A : PUnit → X → ℂ := fun _ x' => if x' = x then (T x y z)⁻¹ else 0 + let B : PUnit → Y → ℂ := fun _ y' => if y' = y then 1 else 0 + let C : PUnit → Z → ℂ := fun _ z' => if z' = z then 1 else 0 + have heq : Tensor.restrict A B C T = unitTensor := by + funext i j k + simp [Tensor.restrict, A, B, C, unitTensor, ite_mul, mul_ite, hz] + simpa only [heq, χ.map_one] using χ.monotone T A B C + +/-- Normalization and restriction monotonicity make the character faithful. -/ +@[simp] theorem value_eq_zero_iff (T : Tensor ℂ X Y Z) : χ.value T = 0 ↔ T = 0 := by + constructor + · intro h + by_contra hT + have hle := χ.one_le_value hT + rw [h] at hle + exact (not_le_of_gt zero_lt_one) hle + · rintro rfl + exact χ.map_zero + +end Character + +end MatrixMultiplication.AuxiliarySeparation + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Character/Degeneration.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Character/Degeneration.lean new file mode 100644 index 0000000000000000000000000000000000000000..d6a8ef8317f628a2848e662039dd3cd01f8a7576 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Character/Degeneration.lean @@ -0,0 +1,165 @@ +import OAI.LinearAlgebra.MatrixMultiplication.AuxiliarySeparation.Polynomial.Interpolation +import OAI.LinearAlgebra.MatrixMultiplication.AuxiliarySeparation.Tensor.CharacterBounds +import OAI.LinearAlgebra.MatrixMultiplication.AuxiliarySeparation.Growth.PolynomialOverhead + +namespace OAI + +/-! +# Characters decrease under polynomial degeneration + +Finite interpolation expresses a polynomial's leading coefficient as a sum +of evaluations. Applying it after tensor powering gives only a linear +overhead, which disappears in the exponential growth rate. No continuity +assumption on the character is used. +-/ + +noncomputable section + +open MatrixMultiplication.Foundation +open scoped BigOperators + +namespace MatrixMultiplication.AuxiliarySeparation +namespace Character + +variable (χ : Character) +variable {X Y Z : Type} [Fintype X] [Fintype Y] [Fintype Z] + +/-- Scalar multiplication is a restriction, including when the scalar is zero. -/ +theorem value_scale_le (c : ℂ) (T : Tensor ℂ X Y Z) : + χ.value (fun x y z => c * T x y z) ≤ χ.value T := by + classical + have heq : Tensor.restrict + (fun x' x => if x = x' then c else 0) + (fun y' y => if y = y' then 1 else 0) + (fun z' z => if z = z' then 1 else 0) T = + fun x y z => c * T x y z := by + funext x y z + simp [Tensor.restrict, ite_mul, mul_ite] + simpa only [heq] using χ.monotone T + (fun x' x => if x = x' then c else 0) + (fun y' y => if y = y' then 1 else 0) + (fun z' z => if z = z' then 1 else 0) + +/-- Nonzero scalar multiplication preserves a character. -/ +theorem value_scale (c : ℂ) (hc : c ≠ 0) (T : Tensor ℂ X Y Z) : + χ.value (fun x y z => c * T x y z) = χ.value T := by + apply le_antisymm (χ.value_scale_le c T) + have h := χ.value_scale_le c⁻¹ (fun x y z => c * T x y z) + simpa only [← mul_assoc, inv_mul_cancel₀ hc, one_mul] using h + +/-- Adding tensors is a restriction of their independent direct sum. -/ +theorem value_sum_le {ι : Type} [Fintype ι] (T : ι → Tensor ℂ X Y Z) : + χ.value (fun x y z => ∑ i, T i x y z) ≤ ∑ i, χ.value (T i) := by + classical + have heq : Tensor.restrict + (fun x (p : ι × X) => if p.2 = x then 1 else 0) + (fun y (p : ι × Y) => if p.2 = y then 1 else 0) + (fun z (p : ι × Z) => if p.2 = z then 1 else 0) + (Tensor.directSum T) = fun x y z => ∑ i, T i x y z := by + funext x y z + simp [Tensor.restrict, Tensor.directSum, Fintype.sum_prod_type, + ite_mul, mul_ite, ite_and] + rw [← χ.map_directSum T, ← heq] + exact χ.monotone (Tensor.directSum T) _ _ _ + +/-- Exact interpolation bounds any polynomial coefficient by the sum of the +character values of finitely many evaluation tensors. -/ +theorem value_coefficient_le (P : Tensor (Polynomial ℂ) X Y Z) (d D : ℕ) + (hdegree : ∀ x y z, (P x y z).degree ≤ D) : + χ.value (fun x y z => (P x y z).coeff d) ≤ + ∑ i : Fin (D + 1), χ.value (fun x y z => (P x y z).eval (interpolationNode D i)) := by + classical + let w : Fin (D + 1) → ℂ := fun i => + (Lagrange.basis Finset.univ (interpolationNode D) i).coeff d + have heq : (fun x y z => (P x y z).coeff d) = + fun x y z => ∑ i : Fin (D + 1), w i * (P x y z).eval (interpolationNode D i) := by + funext x y z + have hlt : (P x y z).degree < Fintype.card (Fin (D + 1)) := by + simp only [Fintype.card_fin] + exact lt_of_le_of_lt (hdegree x y z) + (WithBot.coe_lt_coe.mpr (Nat.lt_succ_self D)) + simpa only [w, mul_comm] using Tensor.coeff_eq_sum_eval + (interpolationNode D) (interpolationNode_injective D) (P x y z) d hlt + rw [heq] + apply (χ.value_sum_le _).trans + exact Finset.sum_le_sum fun i _ => χ.value_scale_le (w i) _ + +/-- A uniform bound on nonzero evaluations bounds the leading tensor. The +proof uses tensor powers and removes their linear interpolation overhead. -/ +theorem value_le_of_polynomialApproximation + {U : Tensor ℂ X Y Z} {r d D : ℕ} + (A : Tensor.PolynomialApproximation U r d D) {b : ℝ} (hb : 0 ≤ b) + (hbound : ∀ t : ℂ, t ≠ 0 → + χ.value (fun x y z => (A.polynomial x y z).eval t) ≤ b) : + χ.value U ≤ b := by + apply le_of_pow_le_linear_mul_pow (K := (D : ℝ)) hb + intro n + have hcoefficient := χ.value_coefficient_le (A.power n).polynomial + (d * n) (D * n) (A.power n).degree_bound + have hleading : (fun x y z => ((A.power n).polynomial x y z).coeff (d * n)) = + Tensor.power U n := by + funext x y z + exact (A.power n).leading x y z + rw [hleading, χ.value_power] at hcoefficient + apply hcoefficient.trans + calc + (∑ i : Fin (D * n + 1), χ.value + (fun x y z => ((A.power n).polynomial x y z).eval + (interpolationNode (D * n) i))) ≤ + ∑ _i : Fin (D * n + 1), b ^ n := by + apply Finset.sum_le_sum + intro i hi + have heval : (fun x y z => ((A.power n).polynomial x y z).eval + (interpolationNode (D * n) i)) = + Tensor.power (fun x y z => (A.polynomial x y z).eval + (interpolationNode (D * n) i)) n := by + funext x y z + simp only [Tensor.PolynomialApproximation.power, Tensor.power, + Polynomial.eval_prod] + rw [heval, χ.value_power] + exact pow_le_pow_left₀ (χ.nonneg _) + (hbound _ (interpolationNode_ne_zero _ _)) n + _ = ((n : ℝ) * (D : ℝ) + 1) * b ^ n := by + simp only [Finset.sum_const, Finset.card_univ, Fintype.card_fin, + nsmul_eq_mul, Nat.cast_add, Nat.cast_mul, Nat.cast_one] + ring + +omit [Fintype Z] in +private theorem exists_rankAtMost (T : Tensor ℂ X Y Z) : + ∃ r : ℕ, Tensor.RankAtMost T r := by + classical + let a : X × Y → X → ℂ := fun p x => if p.1 = x then 1 else 0 + let b : X × Y → Y → ℂ := fun p y => if p.2 = y then 1 else 0 + let c : X × Y → Z → ℂ := fun p z => T p.1 p.2 z + have heq : T = fun x y z => ∑ p, Tensor.rankOne (a p) (b p) (c p) x y z := by + funext x y z + simp [Tensor.rankOne, a, b, c, Fintype.sum_prod_type, ite_mul, mul_ite] + exact ⟨Fintype.card (X × Y), heq ▸ Tensor.rankAtMost_sum_rankOne a b c⟩ + +/-- The character axioms imply monotonicity under polynomial degeneration. +Continuity of the character is neither assumed nor used. -/ +theorem value_polynomialRestrictionDegeneration_le + {X' Y' Z' : Type} [Fintype X'] [Fintype Y'] [Fintype Z'] + {T : Tensor ℂ X Y Z} {U : Tensor ℂ X' Y' Z'} {k Lx Ly Lz : ℕ} + (L : Tensor.PolynomialRestrictionDegeneration T U k Lx Ly Lz) : + χ.value U ≤ χ.value T := by + obtain ⟨r, hr⟩ := exists_rankAtMost T + apply χ.value_le_of_polynomialApproximation + (restrictionDegeneration_approximation L hr) (χ.nonneg T) + intro t ht + have heval : (fun x y z => + ((restrictionDegeneration_approximation L hr).polynomial x y z).eval t) = + Tensor.restrict (fun x' x => (L.leftMap x' x).eval t) + (fun y' y => (L.middleMap y' y).eval t) + (fun z' z => (L.rightMap z' z).eval t) T := by + funext x y z + exact restrictionDegeneration_eval L t x y z + rw [heval] + exact χ.monotone T _ _ _ + +end Character +end MatrixMultiplication.AuxiliarySeparation + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Character/Dot.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Character/Dot.lean new file mode 100644 index 0000000000000000000000000000000000000000..34fd841931706b96377a8a6636a33f213162f3df --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Character/Dot.lean @@ -0,0 +1,175 @@ +import OAI.LinearAlgebra.MatrixMultiplication.AuxiliarySeparation.Character.Basic +import OAI.LinearAlgebra.MatrixMultiplication.AuxiliarySeparation.Growth.MultiplicativePower +import OAI.LinearAlgebra.MatrixMultiplication.Tensor.ComplexPairingMatrixTensor + +namespace OAI + +/-! +# Dot-product exponents of tensor characters + +The power laws here follow from restriction monotonicity and tensor products. +They are not additional assumptions on a character. The three exponents refer +to the leg on which the corresponding dot product has dimension one. +-/ + +noncomputable section + +open MatrixMultiplication.Foundation +open scoped BigOperators + +namespace MatrixMultiplication.AuxiliarySeparation.Character + +variable (χ : Character) + +theorem value_pos {X Y Z : Type} [Fintype X] [Fintype Y] [Fintype Z] + {T : Tensor ℂ X Y Z} (hT : T ≠ 0) : 0 < χ.value T := + lt_of_lt_of_le zero_lt_one (χ.one_le_value hT) + +/-- Precomposing a character with a cyclic permutation gives a character. -/ +def cyclicCharacter : Character where + value T := χ.value (Tensor.cyclic T) + nonneg T := χ.nonneg (Tensor.cyclic T) + map_zero := χ.map_zero + map_one := χ.map_one + map_directSum T := by + rw [Tensor.cyclic_directSum, χ.map_directSum] + map_product T S := χ.map_product (Tensor.cyclic T) (Tensor.cyclic S) + monotone T A B C := by + have heq : Tensor.cyclic (Tensor.restrict A B C T) = + Tensor.restrict B C A (Tensor.cyclic T) := by + funext y z x + simp only [Tensor.cyclic, Tensor.restrict] + rw [Finset.sum_comm] + apply Finset.sum_congr rfl + intro j hj + rw [Finset.sum_comm] + apply Finset.sum_congr rfl + intro k hk + apply Finset.sum_congr rfl + intro i hi + ring + rw [heq] + exact χ.monotone (Tensor.cyclic T) B C A + +@[simp] theorem cyclicCharacter_value {X Y Z : Type} + [Fintype X] [Fintype Y] [Fintype Z] (T : Tensor ℂ X Y Z) : + χ.cyclicCharacter.value T = χ.value (Tensor.cyclic T) := rfl + +private theorem dotPairing_ne_zero {m : ℕ} (hm : 0 < m) : + Tensor.dotPairing (K := ℂ) (Fin m) ≠ 0 := by + intro h + have hv := congrFun (congrFun (congrFun h ⟨0, hm⟩) ⟨0, hm⟩) () + simp [Tensor.dotPairing] at hv + +private theorem dotPairing_rank (m : ℕ) : + Tensor.RankAtMost (Tensor.dotPairing (K := ℂ) (Fin m)) m := by + let a : Fin m → Fin m → ℂ := fun i j => if i = j then 1 else 0 + have heq : Tensor.dotPairing (K := ℂ) (Fin m) = + fun x y z => ∑ i, Tensor.rankOne (a i) (a i) (fun _ : Unit => 1) x y z := by + funext x y z + simp [Tensor.dotPairing, Tensor.rankOne, a, mul_ite, eq_comm] + rw [heq] + simpa using Tensor.rankAtMost_sum_rankOne a a (fun (_ : Fin m) (_ : Unit) => (1 : ℂ)) + +theorem value_dotPairing_pos {m : ℕ} (hm : 0 < m) : + 0 < χ.value (Tensor.dotPairing (K := ℂ) (Fin m)) := + χ.value_pos (dotPairing_ne_zero hm) + +theorem value_dotPairing_le (m : ℕ) : + χ.value (Tensor.dotPairing (K := ℂ) (Fin m)) ≤ m := + χ.value_le_rank (dotPairing_rank m) + +theorem value_dotPairing_mono {m n : ℕ} (hmn : m ≤ n) : + χ.value (Tensor.dotPairing (K := ℂ) (Fin m)) ≤ + χ.value (Tensor.dotPairing (K := ℂ) (Fin n)) := by + have heq : Tensor.pullback (Fin.castLE hmn) (Fin.castLE hmn) id + (Tensor.dotPairing (K := ℂ) (Fin n)) = Tensor.dotPairing (K := ℂ) (Fin m) := by + funext x y z + simp [Tensor.pullback, Tensor.dotPairing] + rw [← heq] + exact χ.value_pullback_le _ _ _ _ + +theorem value_dotPairing_mul (m n : ℕ) : + χ.value (Tensor.dotPairing (K := ℂ) (Fin (m * n))) = + χ.value (Tensor.dotPairing (K := ℂ) (Fin m)) * + χ.value (Tensor.dotPairing (K := ℂ) (Fin n)) := by + have heq : Tensor.pullback finProdFinEquiv.symm finProdFinEquiv.symm + (Equiv.prodUnique Unit Unit).symm + (Tensor.product (Tensor.dotPairing (K := ℂ) (Fin m)) + (Tensor.dotPairing (K := ℂ) (Fin n))) = + Tensor.dotPairing (K := ℂ) (Fin (m * n)) := by + funext x y z + simp only [Tensor.pullback, Tensor.product, Tensor.dotPairing, + ite_zero_mul_ite_zero, one_mul, ← Prod.ext_iff, Equiv.apply_eq_iff_eq] + rw [← heq, χ.value_reindex, χ.map_product] + +/-- The exponent on dot products whose third leg has dimension one. -/ +def pZ : ℝ := + Real.log (χ.value (Tensor.dotPairing (K := ℂ) (Fin 2))) / Real.log 2 + +/-- The exponent on dot products whose second leg has dimension one. -/ +def pY : ℝ := χ.cyclicCharacter.pZ + +/-- The exponent on dot products whose first leg has dimension one. -/ +def pX : ℝ := χ.cyclicCharacter.cyclicCharacter.pZ + +theorem pZ_nonneg : 0 ≤ χ.pZ := by + apply div_nonneg _ (Real.log_nonneg (by norm_num)) + exact Real.log_nonneg (χ.one_le_value (dotPairing_ne_zero (by norm_num))) + +theorem pZ_le_one : χ.pZ ≤ 1 := by + apply (div_le_one (Real.log_pos (by norm_num))).2 + exact Real.log_le_log (χ.value_dotPairing_pos (by norm_num)) (χ.value_dotPairing_le 2) + +theorem pY_nonneg : 0 ≤ χ.pY := χ.cyclicCharacter.pZ_nonneg +theorem pY_le_one : χ.pY ≤ 1 := χ.cyclicCharacter.pZ_le_one +theorem pX_nonneg : 0 ≤ χ.pX := χ.cyclicCharacter.cyclicCharacter.pZ_nonneg +theorem pX_le_one : χ.pX ≤ 1 := χ.cyclicCharacter.cyclicCharacter.pZ_le_one + +theorem value_dotPairing {m : ℕ} (hm : 0 < m) : + χ.value (Tensor.dotPairing (K := ℂ) (Fin m)) = (m : ℝ) ^ χ.pZ := by + apply positiveMultiplicative_eq_rpow + (f := fun m => χ.value (Tensor.dotPairing (K := ℂ) (Fin m))) + (fun n hn => χ.value_dotPairing_pos hn) + (fun m n _ _ => χ.value_dotPairing_mul m n) + (fun _ _ _ _ hmn => χ.value_dotPairing_mono hmn) hm + +theorem value_cyclic_dotPairing {m : ℕ} (hm : 0 < m) : + χ.value (Tensor.cyclic (Tensor.dotPairing (K := ℂ) (Fin m))) = + (m : ℝ) ^ χ.pY := + χ.cyclicCharacter.value_dotPairing hm + +theorem value_cyclic_cyclic_dotPairing {m : ℕ} (hm : 0 < m) : + χ.value (Tensor.cyclic (Tensor.cyclic (Tensor.dotPairing (K := ℂ) (Fin m)))) = + (m : ℝ) ^ χ.pX := + χ.cyclicCharacter.cyclicCharacter.value_dotPairing hm + +/-- Exact factorization through the three oriented dot products. -/ +theorem value_matrixCoefficients {a b c : ℕ} (ha : 0 < a) (hb : 0 < b) (hc : 0 < c) : + χ.value (Tensor.matrixCoefficients (K := ℂ) (Fin a) (Fin b) (Fin c)) = + (b : ℝ) ^ χ.pZ * (a : ℝ) ^ χ.pY * (c : ℝ) ^ χ.pX := by + rw [← Tensor.pairingTriple_matrixCoefficients, χ.value_reindex] + simp only [Tensor.pairingTriple, χ.map_product, χ.value_dotPairing hb, + χ.value_cyclic_dotPairing ha, χ.value_cyclic_cyclic_dotPairing hc] + +/-- The character of square matrix multiplication has exponent `pX + pY + pZ`. -/ +theorem value_matrixCoefficients_square {m : ℕ} (hm : 0 < m) : + χ.value (Tensor.matrixCoefficients (K := ℂ) (Fin m) (Fin m) (Fin m)) = + (m : ℝ) ^ (χ.pX + χ.pY + χ.pZ) := by + rw [χ.value_matrixCoefficients hm hm hm] + have hm' : 0 < (m : ℝ) := Nat.cast_pos.mpr hm + rw [Real.rpow_add hm', Real.rpow_add hm'] + ring + +/-- The same power law in the matrix-tensor notation used for exact rank. -/ +theorem value_matrixMultiplication {m : ℕ} (hm : 0 < m) : + χ.value (Tensor.matrixMultiplication m m m) = + (m : ℝ) ^ (χ.pX + χ.pY + χ.pZ) := by + simpa only [Tensor.matrixMultiplication_eq_matrixCoefficients] using + χ.value_matrixCoefficients_square hm + +end MatrixMultiplication.AuxiliarySeparation.Character + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Character/Existence.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Character/Existence.lean new file mode 100644 index 0000000000000000000000000000000000000000..4e516283f2827389d42ee438c4bf4a18c8edaece --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Character/Existence.lean @@ -0,0 +1,49 @@ +import OAI.LinearAlgebra.MatrixMultiplication.AuxiliarySeparation.Spectrum.StateObstruction +import OAI.LinearAlgebra.MatrixMultiplication.AuxiliarySeparation.Spectrum.MultiplicativeStates +import OAI.LinearAlgebra.MatrixMultiplication.AuxiliarySeparation.Spectrum.Obstruction +import OAI.LinearAlgebra.MatrixMultiplication.AuxiliarySeparation.Tensor.Characters + +namespace OAI + +/-! +# Detecting characters for complex matrix multiplication + +This proves Lemma 3.1, including Appendix A. Finite inconsistency would +produce a positive scalar-gain catalyst, ruled out by the exact-rank exponent. +A compact normalized state space then yields a multiplicative state, which +transfers to the concrete coefficient-level character interface. +-/ + +noncomputable section + +namespace MatrixMultiplication.AuxiliarySeparation + +open MatrixMultiplication.Foundation + +/-- Lemma 3.1: normalized, additive, multiplicative, restriction-monotone +characters detect every integer strictly below the exact-rank growth value. -/ +theorem exists_detecting_character {d k : ℕ} (hd : 2 ≤ d) + (hk : (k : ℝ) < (d : ℝ) ^ exactRankExponent) : + ∃ χ : Character, (k : ℝ) ≤ χ.value (Tensor.matrixMultiplication d d d) := by + have hnonempty := normalizedStates_nonempty_of_no_catalyst + TensorSemiring.rank (TensorSemiring.matrixClass d) k + TensorSemiring.zero_le TensorSemiring.le_rank + (fun _ _ _ _ h₁ h₂ => TensorSemiring.add_mono h₁ h₂) + (fun D s m hm hcat => no_tensor_catalytic_gain (by omega) hk ⟨D, s, m, hm, hcat⟩) + have hdom (z x : TensorSemiring.TensorClass) : + z * x ≤ (TensorSemiring.rank x : TensorSemiring.TensorClass) * z := by + calc + z * x ≤ z * (TensorSemiring.rank x : TensorSemiring.TensorClass) := + TensorSemiring.mul_mono le_rfl (TensorSemiring.le_rank x) + _ = (TensorSemiring.rank x : TensorSemiring.TensorClass) * z := mul_comm _ _ + obtain ⟨φ, hφ, _, hdetect⟩ := exists_monotone_semiringHom_of_normalizedStates + TensorSemiring.rank (TensorSemiring.matrixClass d) (k : ℝ) + (fun z hz => TensorSemiring.one_le_of_ne_zero hz) + (fun _ _ _ h => TensorSemiring.mul_mono le_rfl h) hdom hnonempty + exact ⟨Character.ofTensorClassHom φ hφ, hdetect⟩ + +end MatrixMultiplication.AuxiliarySeparation + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Character/FiniteSeparation.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Character/FiniteSeparation.lean new file mode 100644 index 0000000000000000000000000000000000000000..9c88d8c8e9bb096baab60c0247221d09fae073a3 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Character/FiniteSeparation.lean @@ -0,0 +1,101 @@ +import OAI.LinearAlgebra.MatrixMultiplication.AuxiliarySeparation.Separation.Basic +import OAI.LinearAlgebra.MatrixMultiplication.AuxiliarySeparation.Character.Degeneration +import OAI.LinearAlgebra.MatrixMultiplication.AuxiliarySeparation.Character.Dot +import OAI.LinearAlgebra.MatrixMultiplication.AuxiliarySeparation.Tensor.CharacterBounds + +namespace OAI + +/-! +# The character bound from finite separation + +The explicit Fourier and square-weight construction gives a polynomial tensor +whose nonzero evaluations restrict from exactly `5M` complete source copies. +Character monotonicity follows by interpolation and tensor powering; it does +not require continuity of the character. +-/ + +noncomputable section + +open MatrixMultiplication.Foundation +open scoped BigOperators + +namespace MatrixMultiplication.AuxiliarySeparation + +variable {M : ℕ} {X Y Z : Type} +variable [Fintype X] [Fintype Y] [Fintype Z] + +omit [Fintype Z] in +private theorem polynomial_rank_bound + (P : Tensor (Polynomial ℂ) X Y Z) : + Tensor.RankAtMost P (Fintype.card (X × Y)) := by + classical + let a : X × Y → X → Polynomial ℂ := fun i x => if i.1 = x then 1 else 0 + let b : X × Y → Y → Polynomial ℂ := fun i y => if i.2 = y then 1 else 0 + let c : X × Y → Z → Polynomial ℂ := fun i z => P i.1 i.2 z + have heq : P = fun x y z => ∑ i, Tensor.rankOne (a i) (b i) (c i) x y z := by + funext x y z + simp [Tensor.rankOne, a, b, c, Fintype.sum_prod_type, ite_mul, mul_ite] + rw [heq] + exact Tensor.rankAtMost_sum_rankOne a b c + +/-- The explicit separation polynomial, viewed as a polynomial approximation +to its constant tensor. Its rank bound is supplied by a coordinate expansion. -/ +def separationPolynomialApproximation {ζ : ℂ} (hM : 0 < M) + (hζ : IsPrimitiveRoot ζ (5 * M)) (B : Fin M → Tensor ℂ X Y Z) : + Tensor.PolynomialApproximation (separationTarget B) + (Fintype.card ((X × Fin M) × ((Fin M × Y) × Fin M))) 0 ((M - 1) ^ 2) where + polynomial := separationPolynomial ζ B + rank_bound := polynomial_rank_bound _ + vanishes := by + intro _ _ _ k hk + exact (Nat.not_lt_zero k hk).elim + leading := by + intro x y z + exact congrFun (congrFun (congrFun (separationPolynomial_coeff_zero hM hζ B) x) y) z + degree_bound := separationPolynomial_degree hM hζ B + +namespace Character + +variable (χ : Character) + +/-- The separated constant tensor costs at most the character of the `5M` +source copies. This uses the explicit polynomial, not topological continuity. -/ +theorem value_separationTarget_le (hM : 0 < M) (B : Fin M → Tensor ℂ X Y Z) : + χ.value (separationTarget B) ≤ + 5 * (M : ℝ) * χ.value (sharedFirstTensor B) := by + classical + let ζ : ℂ := Complex.exp (2 * Real.pi * Complex.I / (5 * M : ℕ)) + have hζ : IsPrimitiveRoot ζ (5 * M) := + Complex.isPrimitiveRoot_exp _ (by omega) + have hbound : χ.value (separationTarget B) ≤ + χ.value (Tensor.directSum (fun _ : Fin (5 * M) => sharedFirstTensor B)) := by + apply χ.value_le_of_polynomialApproximation + (separationPolynomialApproximation hM hζ B) (χ.nonneg _) + intro t ht + change χ.value (fun x y z => (separationPolynomial ζ B x y z).eval t) ≤ _ + rw [separationPolynomial_eval hM hζ B t ht] + exact χ.monotone _ _ _ _ + simpa only [χ.value_copies, Nat.cast_mul, Nat.cast_ofNat] using hbound + +/-- Character accounting for the genuine direct sum in the separated tensor. -/ +theorem value_separationTarget (hM : 0 < M) (B : Fin M → Tensor ℂ X Y Z) : + χ.value (separationTarget B) = + (∑ h, χ.value (B h)) * (M : ℝ) ^ χ.pX := by + classical + rw [separationTarget_eq_directSum, χ.value_reindex, χ.map_directSum] + simp only [χ.map_product, χ.value_cyclic_cyclic_dotPairing hM, Finset.sum_mul] + +/-- Exact finite character separation: the common first coordinate can be +separated at a cost of `5M`, retaining an `M`-dimensional first-leg dot factor. -/ +theorem finiteSeparation_bound (hM : 0 < M) (B : Fin M → Tensor ℂ X Y Z) : + (∑ h, χ.value (B h)) * (M : ℝ) ^ χ.pX ≤ + 5 * (M : ℝ) * χ.value (sharedFirstTensor B) := by + rw [← χ.value_separationTarget hM B] + exact χ.value_separationTarget_le hM B + +end Character +end MatrixMultiplication.AuxiliarySeparation + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Character/Permutation.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Character/Permutation.lean new file mode 100644 index 0000000000000000000000000000000000000000..481d320a9419173d012b4db64eb3ffe0a70f0aa1 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Character/Permutation.lean @@ -0,0 +1,116 @@ +import OAI.LinearAlgebra.MatrixMultiplication.AuxiliarySeparation.Character.Dot +import OAI.LinearAlgebra.MatrixMultiplication.AuxiliarySeparation.Character.Symmetrization + +namespace OAI + +/-! +# The six permuted tensor characters + +Precomposing a character with a leg permutation gives another character. The +six resulting values multiply to the symmetrized product, and each singleton +leg exponent occurs twice among their first-leg exponents. +-/ + +noncomputable section + +open MatrixMultiplication.Foundation +open scoped BigOperators + +namespace MatrixMultiplication.AuxiliarySeparation.Character + +variable (χ : Character) + +/-- The reflected character exchanges the second and third tensor legs. -/ +def swap23Character : Character where + value T := χ.value (fun x z y => T x y z) + nonneg T := χ.nonneg (fun x z y => T x y z) + map_zero := χ.map_zero + map_one := χ.map_one + map_directSum T := by + have heq : (fun x z y => Tensor.directSum T x y z) = + Tensor.directSum (fun i x z y => T i x y z) := by + funext x z y + simp only [Tensor.directSum, and_comm] + change χ.value (fun x z y => Tensor.directSum T x y z) = _ + rw [heq, χ.map_directSum] + map_product T S := χ.map_product (fun x z y => T x y z) (fun x z y => S x y z) + monotone T A B C := by + have heq : (fun x z y => Tensor.restrict A B C T x y z) = + Tensor.restrict A C B (fun x z y => T x y z) := by + funext x z y + simp only [Tensor.restrict] + apply Finset.sum_congr rfl + intro i hi + rw [Finset.sum_comm] + apply Finset.sum_congr rfl + intro k hk + apply Finset.sum_congr rfl + intro j hj + ring + change χ.value (fun x z y => Tensor.restrict A B C T x y z) ≤ _ + rw [heq] + exact χ.monotone (fun x z y => T x y z) A C B + +@[simp] theorem swap23Character_value {X Y Z : Type} + [Fintype X] [Fintype Y] [Fintype Z] (T : Tensor ℂ X Y Z) : + χ.swap23Character.value T = χ.value (fun x z y => T x y z) := rfl + +/-- The three cyclic orders followed by their reflected orders. -/ +def permutedCharacter (i : Fin 6) : Character := + ![χ, χ.cyclicCharacter, χ.cyclicCharacter.cyclicCharacter, + χ.swap23Character, χ.swap23Character.cyclicCharacter, + χ.swap23Character.cyclicCharacter.cyclicCharacter] i + +/-- The six permuted characters give exactly the sixfold product on any legs. -/ +theorem prod_permutedCharacter_value {X Y Z : Type} + [Fintype X] [Fintype Y] [Fintype Z] (T : Tensor ℂ X Y Z) : + (∏ i : Fin 6, (χ.permutedCharacter i).value T) = χ.sixfoldProduct T := by + simp only [Fin.prod_univ_succ, Fin.prod_univ_zero, mul_one] + change χ.value T * (χ.value (fun y z x => T x y z) * + (χ.value (fun z x y => T x y z) * (χ.value (fun x z y => T x y z) * + (χ.value (fun y x z => T x y z) * χ.value (fun z y x => T x y z))))) = _ + unfold sixfoldProduct + ring + +@[simp] theorem cyclicCharacter_pX : χ.cyclicCharacter.pX = χ.pZ := by + rfl + +@[simp] theorem cyclicCharacter_pY : χ.cyclicCharacter.pY = χ.pX := rfl + +@[simp] theorem cyclicCharacter_pZ : χ.cyclicCharacter.pZ = χ.pY := rfl + +@[simp] theorem swap23Character_pX : χ.swap23Character.pX = χ.pX := by + unfold pX pZ + simp only [cyclicCharacter_value, swap23Character_value] + congr 2 + apply congrArg χ.value + funext x y z + simp [Tensor.cyclic, Tensor.dotPairing, eq_comm] + +@[simp] theorem swap23Character_pY : χ.swap23Character.pY = χ.pZ := by + unfold pY pZ + simp only [cyclicCharacter_value, swap23Character_value] + congr 2 + apply congrArg χ.value + funext x y z + simp [Tensor.cyclic, Tensor.dotPairing, eq_comm] + +@[simp] theorem swap23Character_pZ : χ.swap23Character.pZ = χ.pY := by + unfold pY pZ + simp only [cyclicCharacter_value, swap23Character_value] + congr 2 + apply congrArg χ.value + funext x y z + simp [Tensor.cyclic, Tensor.dotPairing, eq_comm] + +/-- Each singleton-leg exponent occurs twice among the first-leg exponents. -/ +theorem sum_permutedCharacter_pX : + (∑ i : Fin 6, (χ.permutedCharacter i).pX) = 2 * (χ.pX + χ.pY + χ.pZ) := by + simp [permutedCharacter, Fin.sum_univ_succ] + ring + +end MatrixMultiplication.AuxiliarySeparation.Character + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Character/Symmetrization.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Character/Symmetrization.lean new file mode 100644 index 0000000000000000000000000000000000000000..0d4bef48836999d485c7a421cdcddd040be796f0 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Character/Symmetrization.lean @@ -0,0 +1,120 @@ +import OAI.LinearAlgebra.MatrixMultiplication.AuxiliarySeparation.Growth.PermutationProduct +import OAI.LinearAlgebra.MatrixMultiplication.AuxiliarySeparation.Character.Basic +import OAI.LinearAlgebra.MatrixMultiplication.AuxiliarySeparation.Convolution.Basic +import Mathlib.Analysis.SpecialFunctions.Pow.Real + +namespace OAI + +/-! +# The symmetrized tensor-character product + +The sixfold product is defined on arbitrary finite, possibly different, leg +spaces. Its symmetry follows by permuting the factors and requires no symmetry +of the character itself. +-/ + +noncomputable section + +namespace MatrixMultiplication.AuxiliarySeparation + +namespace Character + +open MatrixMultiplication.Foundation + +variable (χ : Character) +variable {X Y Z X' Y' Z' : Type} +variable [Fintype X] [Fintype Y] [Fintype Z] +variable [Fintype X'] [Fintype Y'] [Fintype Z'] + +/-- The product of character values in the six orders of possibly different legs. -/ +def sixfoldProduct (T : Tensor ℂ X Y Z) : ℝ := + χ.value T * + χ.value (fun y z x => T x y z) * + χ.value (fun z x y => T x y z) * + χ.value (fun x z y => T x y z) * + χ.value (fun z y x => T x y z) * + χ.value (fun y x z => T x y z) + +/-- Cycling the legs permutes the six factors. -/ +theorem sixfoldProduct_cyclic (T : Tensor ℂ X Y Z) : + χ.sixfoldProduct (fun y z x => T x y z) = χ.sixfoldProduct T := by + dsimp [sixfoldProduct] + ring + +/-- Exchanging the first two legs permutes the six factors. -/ +theorem sixfoldProduct_swap12 (T : Tensor ℂ X Y Z) : + χ.sixfoldProduct (fun y x z => T x y z) = χ.sixfoldProduct T := by + dsimp [sixfoldProduct] + ring + +/-- The leg exchange used by the middle convolution branch preserves the product. -/ +theorem sixfoldProduct_swap23 (T : Tensor ℂ X Y Z) : + χ.sixfoldProduct (fun x z y => T x y z) = χ.sixfoldProduct T := by + dsimp [sixfoldProduct] + ring + +/-- Changing coordinates separately on the legs preserves the sixfold product. -/ +theorem sixfoldProduct_reindex (T : Tensor ℂ X Y Z) + (ex : X' ≃ X) (ey : Y' ≃ Y) (ez : Z' ≃ Z) : + χ.sixfoldProduct (Tensor.pullback ex ey ez T) = χ.sixfoldProduct T := by + unfold sixfoldProduct + rw [χ.value_reindex T ex ey ez] + have h1 := χ.value_reindex (fun y z x => T x y z) ey ez ex + have h2 := χ.value_reindex (fun z x y => T x y z) ez ex ey + have h3 := χ.value_reindex (fun x z y => T x y z) ex ez ey + have h4 := χ.value_reindex (fun z y x => T x y z) ez ey ex + have h5 := χ.value_reindex (fun y x z => T x y z) ey ex ez + change χ.value (fun y z x => T (ex x) (ey y) (ez z)) = + χ.value (fun y z x => T x y z) at h1 + change χ.value (fun z x y => T (ex x) (ey y) (ez z)) = + χ.value (fun z x y => T x y z) at h2 + change χ.value (fun x z y => T (ex x) (ey y) (ez z)) = + χ.value (fun x z y => T x y z) at h3 + change χ.value (fun z y x => T (ex x) (ey y) (ez z)) = + χ.value (fun z y x => T x y z) at h4 + change χ.value (fun y x z => T (ex x) (ey y) (ez z)) = + χ.value (fun y x z => T x y z) at h5 + simp only [Tensor.pullback] + rw [h1, h2, h3, h4, h5] + +/-- Commuting convolution inputs preserves the sixfold character product. -/ +theorem sixfoldProduct_convolution_comm (a b : ℕ) : + χ.sixfoldProduct (convolution a b) = χ.sixfoldProduct (convolution b a) := by + let e : Fin (a + b - 1) ≃ Fin (b + a - 1) := finCongr (by omega) + have heq : Tensor.pullback (Equiv.refl (Fin b)) (Equiv.refl (Fin a)) e + (convolution b a) = fun j i k => convolution a b i j k := by + funext j i k + exact (convolution_comm a b i j k).symm + have h := χ.sixfoldProduct_reindex (convolution b a) + (Equiv.refl (Fin b)) (Equiv.refl (Fin a)) e + rw [heq, χ.sixfoldProduct_swap12] at h + exact h + +/-- The Section 5 symmetrized value with mean singleton-leg exponent `t`. -/ +def symmetrizedProfile (t : ℝ) (T : Tensor ℂ X Y Z) : ℝ := + χ.sixfoldProduct T ^ (1 / (6 * t)) + +theorem symmetrizedProfile_cyclic (t : ℝ) (T : Tensor ℂ X Y Z) : + χ.symmetrizedProfile t (fun y z x => T x y z) = χ.symmetrizedProfile t T := by + exact congrArg (fun s : ℝ => s ^ (1 / (6 * t))) (χ.sixfoldProduct_cyclic T) + +theorem symmetrizedProfile_swap12 (t : ℝ) (T : Tensor ℂ X Y Z) : + χ.symmetrizedProfile t (fun y x z => T x y z) = χ.symmetrizedProfile t T := by + exact congrArg (fun s : ℝ => s ^ (1 / (6 * t))) (χ.sixfoldProduct_swap12 T) + +theorem symmetrizedProfile_swap23 (t : ℝ) (T : Tensor ℂ X Y Z) : + χ.symmetrizedProfile t (fun x z y => T x y z) = χ.symmetrizedProfile t T := by + exact congrArg (fun s : ℝ => s ^ (1 / (6 * t))) (χ.sixfoldProduct_swap23 T) + +theorem symmetrizedProfile_reindex (t : ℝ) (T : Tensor ℂ X Y Z) + (ex : X' ≃ X) (ey : Y' ≃ Y) (ez : Z' ≃ Z) : + χ.symmetrizedProfile t (Tensor.pullback ex ey ez T) = χ.symmetrizedProfile t T := by + exact congrArg (fun s : ℝ => s ^ (1 / (6 * t))) (χ.sixfoldProduct_reindex T ex ey ez) + +end Character + +end MatrixMultiplication.AuxiliarySeparation + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Convex/ConeSupport.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Convex/ConeSupport.lean new file mode 100644 index 0000000000000000000000000000000000000000..f31f9fa9947a84b342b1212676d06c7e9cdf8646 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Convex/ConeSupport.lean @@ -0,0 +1,103 @@ +import Mathlib.Analysis.Convex.Caratheodory +import Mathlib.Geometry.Convex.Cone.Pointed +import Mathlib.Tactic + +namespace OAI + +/-! +# Independent generators for a finite conical combination + +Every conical combination can be expressed using a linearly independent +subfamily of its original generators. +-/ + +namespace MatrixMultiplication.AuxiliarySeparation + +variable {I E : Type*} [AddCommGroup E] [Module ℝ E] + +private theorem exists_positive_relation (A : I → E) (s : Finset I) + (h : ¬ LinearIndependent ℝ (fun i : s ↦ A i)) : + ∃ g : I → ℝ, (∑ i ∈ s, g i • A i) = 0 ∧ ∃ i ∈ s, 0 < g i := by + classical + obtain ⟨g, hg, i, hi, hgi⟩ := + (not_linearIndepOn_finset_iff (R := ℝ) (v := A)).mp h + rcases lt_or_gt_of_ne hgi with hneg | hpos + · refine ⟨fun j ↦ -g j, ?_, i, hi, neg_pos.mpr hneg⟩ + simp_rw [neg_smul, Finset.sum_neg_distrib, hg, neg_zero] + · exact ⟨g, hg, i, hi, hpos⟩ + +private theorem exists_nonneg_representation_erase [DecidableEq I] (A : I → E) (s : Finset I) + (w : I → ℝ) (hw : ∀ i ∈ s, 0 ≤ w i) + (h : ¬ LinearIndependent ℝ (fun i : s ↦ A i)) : + ∃ i ∈ s, ∃ v : I → ℝ, (∀ j ∈ s.erase i, 0 ≤ v j) ∧ + (∑ j ∈ s.erase i, v j • A j) = ∑ j ∈ s, w j • A j := by + classical + obtain ⟨g, hg, i, hi, hgi⟩ := exists_positive_relation A s h + let p := s.filter fun i ↦ 0 < g i + obtain ⟨i₀, hi₀, hmin⟩ : + ∃ i₀ ∈ p, ∀ j ∈ p, w i₀ / g i₀ ≤ w j / g j := by + apply p.exists_min_image + exact ⟨i, Finset.mem_filter.mpr ⟨hi, hgi⟩⟩ + have hi₀s : i₀ ∈ s := (Finset.mem_filter.mp hi₀).1 + have hgi₀ : 0 < g i₀ := (Finset.mem_filter.mp hi₀).2 + let v : I → ℝ := fun j ↦ w j - w i₀ / g i₀ * g j + have hvi₀ : v i₀ = 0 := by simp [v, ne_of_gt hgi₀] + refine ⟨i₀, hi₀s, v, ?_, ?_⟩ + · intro j hj + have hjs : j ∈ s := Finset.mem_of_mem_erase hj + dsimp [v] + apply sub_nonneg.mpr + by_cases hjp : j ∈ p + · have hgj : 0 < g j := (Finset.mem_filter.mp hjp).2 + exact (le_div_iff₀ hgj).mp (hmin j hjp) + · have hgj : g j ≤ 0 := by + simpa only [p, Finset.mem_filter, hjs, true_and, not_lt] using hjp + exact (mul_nonpos_of_nonneg_of_nonpos + (div_nonneg (hw i₀ hi₀s) hgi₀.le) hgj).trans (hw j hjs) + · calc + (∑ j ∈ s.erase i₀, v j • A j) = ∑ j ∈ s, v j • A j := by + apply Finset.sum_erase + rw [hvi₀, zero_smul] + _ = ∑ j ∈ s, w j • A j := by + simp only [v, sub_smul, mul_smul, Finset.sum_sub_distrib, + ← Finset.smul_sum, hg, smul_zero, sub_zero] + +/-- A nonnegative finite combination uses a linearly independent subfamily +after possibly changing its coefficients. -/ +theorem exists_nonneg_representation_linearIndependent (A : I → E) (s : Finset I) + (w : I → ℝ) (hw : ∀ i ∈ s, 0 ≤ w i) : + ∃ t : Finset I, t ⊆ s ∧ LinearIndependent ℝ (fun i : t ↦ A i) ∧ + ∃ v : I → ℝ, (∀ i ∈ t, 0 ≤ v i) ∧ + (∑ i ∈ t, v i • A i) = ∑ i ∈ s, w i • A i := by + classical + induction s using Finset.strongInductionOn generalizing w with + | _ s ih => + by_cases hs : LinearIndependent ℝ (fun i : s ↦ A i) + · exact ⟨s, Finset.Subset.refl _, hs, w, hw, rfl⟩ + · obtain ⟨i, hi, v, hv, heq⟩ := exists_nonneg_representation_erase A s w hw hs + obtain ⟨t, hts, ht, z, hz, hzeq⟩ := ih (s.erase i) (Finset.erase_ssubset hi) v hv + exact ⟨t, hts.trans (Finset.erase_subset _ _), ht, z, hz, hzeq.trans heq⟩ + +/-- Every element of a finitely generated cone belongs to the cone generated +by some linearly independent subfamily of the given generators. -/ +theorem exists_linearIndependent_subcone [Fintype I] (A : I → E) {x : E} + (hx : x ∈ PointedCone.hull ℝ (Set.range A)) : + ∃ s : Finset I, LinearIndependent ℝ (fun i : s ↦ A i) ∧ + x ∈ PointedCone.hull ℝ (Set.range (fun i : s ↦ A i)) := by + classical + obtain ⟨w, hw⟩ := (Submodule.mem_span_range_iff_exists_fun (Nonneg ℝ)).mp hx + obtain ⟨s, _, hs, v, hv, heq⟩ := + exists_nonneg_representation_linearIndependent A Finset.univ + (fun i ↦ (w i : ℝ)) (fun i _ ↦ (w i).property) + refine ⟨s, hs, ?_⟩ + have hsum : (∑ i ∈ s, v i • A i) = x := by + exact heq.trans (by simpa only [← Nonneg.coe_smul] using hw) + rw [← hsum] + apply Submodule.sum_mem + intro i hi + exact PointedCone.smul_mem _ (hv i hi) + (PointedCone.subset_hull ⟨⟨i, hi⟩, rfl⟩) + +end MatrixMultiplication.AuxiliarySeparation + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Convex/Farkas.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Convex/Farkas.lean new file mode 100644 index 0000000000000000000000000000000000000000..b68a98f4e4a17b167423a67cc2d425dedf5b51a6 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Convex/Farkas.lean @@ -0,0 +1,72 @@ +import OAI.LinearAlgebra.MatrixMultiplication.AuxiliarySeparation.Convex.RationalCone +import OAI.LinearAlgebra.MatrixMultiplication.AuxiliarySeparation.Convex.FiniteConeClosed +import Mathlib.Analysis.Convex.Cone.Dual + +namespace OAI + +/-! +# Finite rational cone duality + +A finite family of integral vectors admits a normalized nonnegative linear +functional whenever the negative normalizing vector has no positive integral +multiple in the monoid generated by the family. +-/ + +namespace MatrixMultiplication.AuxiliarySeparation + +/-- Closed-cone separation followed by rational certificate extraction yields +a normalized nonnegative linear functional. -/ +theorem exists_normalized_nonneg_linear_of_no_nat_certificate_of_isClosed + {I J : Type*} [Fintype I] [Fintype J] + (A : I → J → ℤ) (u : J → ℤ) + (hclosed : IsClosed (PointedCone.hull ℝ + (Set.range (fun i j ↦ (A i j : ℝ))) : Set (J → ℝ))) + (hno : ¬ ∃ D : ℕ, 0 < D ∧ ∃ c : I → ℕ, + ∀ j, ∑ i, (c i : ℤ) * A i j = -(D : ℤ) * u j) : + ∃ L : (J → ℝ) →ₗ[ℝ] ℝ, + L (fun j ↦ (u j : ℝ)) = 1 ∧ + ∀ i, 0 ≤ L (fun j ↦ (A i j : ℝ)) := by + classical + let C : ProperCone ℝ (J → ℝ) := + { toSubmodule := PointedCone.hull ℝ (Set.range (fun i j ↦ (A i j : ℝ))) + isClosed' := hclosed } + have houtside : -(fun j ↦ (u j : ℝ)) ∉ C := by + intro hmem + obtain ⟨x, hx⟩ := + (Submodule.mem_span_range_iff_exists_fun (Nonneg ℝ)).1 hmem + have hreal : ∃ x : I → ℝ, (∀ i, 0 ≤ x i) ∧ + ∀ j, ∑ i, x i * (A i j : ℝ) = ((-u j : ℤ) : ℝ) := by + refine ⟨fun i ↦ (x i : ℝ), fun i ↦ (x i).property, fun j ↦ ?_⟩ + have hj := congrFun hx j + simpa only [Finset.sum_apply, Pi.smul_apply, ← Nonneg.coe_smul, + smul_eq_mul, Pi.neg_apply, Int.cast_neg] using hj + obtain ⟨D, hD, c, hc⟩ := + exists_nat_scaled_int_solution_of_nonneg_real A (fun j ↦ -u j) hreal + exact hno ⟨D, hD, c, fun j ↦ by simpa only [mul_neg, neg_mul] using hc j⟩ + obtain ⟨f, hf, hfu⟩ := C.hyperplane_separation_point houtside + have hpos : 0 < f (fun j ↦ (u j : ℝ)) := by + simpa only [map_neg, neg_neg, neg_lt_zero] using hfu + refine ⟨(f (fun j ↦ (u j : ℝ)))⁻¹ • f.toLinearMap, ?_, fun i ↦ ?_⟩ + · simp only [LinearMap.smul_apply, ContinuousLinearMap.coe_coe, smul_eq_mul] + exact inv_mul_cancel₀ hpos.ne' + · change 0 ≤ (f (fun j ↦ (u j : ℝ)))⁻¹ * f (fun j ↦ (A i j : ℝ)) + exact mul_nonneg (inv_nonneg.mpr hpos.le) + (hf _ (PointedCone.subset_hull (Set.mem_range_self i))) + +/-- A finite integral cone either contains a positive integer multiple of the +negative normalizing vector, or admits a linear functional which is +nonnegative on the generators and takes value one on that vector. -/ +theorem exists_normalized_nonneg_linear_of_no_nat_certificate + {I J : Type*} [Fintype I] [Fintype J] + (A : I → J → ℤ) (u : J → ℤ) + (hno : ¬ ∃ D : ℕ, 0 < D ∧ ∃ c : I → ℕ, + ∀ j, ∑ i, (c i : ℤ) * A i j = -(D : ℤ) * u j) : + ∃ L : (J → ℝ) →ₗ[ℝ] ℝ, + L (fun j ↦ (u j : ℝ)) = 1 ∧ + ∀ i, 0 ≤ L (fun j ↦ (A i j : ℝ)) := + exists_normalized_nonneg_linear_of_no_nat_certificate_of_isClosed A u + (isClosed_pointedCone_hull_range _) hno + +end MatrixMultiplication.AuxiliarySeparation + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Convex/FiniteConeClosed.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Convex/FiniteConeClosed.lean new file mode 100644 index 0000000000000000000000000000000000000000..dc5f7b3dbf2f1f0e51e57e571e61b23887848322 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Convex/FiniteConeClosed.lean @@ -0,0 +1,75 @@ +import OAI.LinearAlgebra.MatrixMultiplication.AuxiliarySeparation.Convex.ConeSupport +import Mathlib.Geometry.Convex.Cone.Pointed +import Mathlib.Topology.Algebra.Module.FiniteDimension +import Mathlib.Tactic + +namespace OAI + +/-! +# Closed finitely generated cones +-/ + +open Topology + +namespace MatrixMultiplication.AuxiliarySeparation + +/-- A finite conic combination is a sum with nonnegative coefficients. -/ +theorem mem_pointedCone_hull_range_iff {I E : Type*} [Fintype I] + [AddCommGroup E] [Module ℝ E] (A : I → E) (x : E) : + x ∈ PointedCone.hull ℝ (Set.range A) ↔ + ∃ c : I → ℝ, (∀ i, 0 ≤ c i) ∧ ∑ i, c i • A i = x := by + rw [PointedCone.hull, Submodule.mem_span_range_iff_exists_fun] + constructor + · rintro ⟨c, hc⟩ + exact ⟨fun i ↦ (c i : ℝ), fun i ↦ (c i).2, hc⟩ + · rintro ⟨c, hc, hcx⟩ + exact ⟨fun i ↦ ⟨c i, hc i⟩, hcx⟩ + +/-- The cone spanned by a finite linearly independent family is closed. -/ +theorem isClosed_pointedCone_hull_range_of_linearIndependent + {I E : Type*} [Fintype I] [NormedAddCommGroup E] [NormedSpace ℝ E] + (A : I → E) (hA : LinearIndependent ℝ A) : + IsClosed (PointedCone.hull ℝ (Set.range A) : Set E) := by + let f := Fintype.linearCombination ℝ A + have hf : IsClosedEmbedding f := + LinearMap.isClosedEmbedding_of_injective + (LinearMap.ker_eq_bot.mpr hA.fintypeLinearCombination_injective) + have hnonneg : IsClosed {c : I → ℝ | ∀ i, 0 ≤ c i} := by + simpa only [Set.ofPred_forall] using + isClosed_iInter fun i ↦ isClosed_le (continuous_const : Continuous fun _ : I → ℝ ↦ (0 : ℝ)) (continuous_apply i) + have heq : (PointedCone.hull ℝ (Set.range A) : Set E) = + f '' {c : I → ℝ | ∀ i, 0 ≤ c i} := by + ext x + change x ∈ PointedCone.hull ℝ (Set.range A) ↔ _ + rw [mem_pointedCone_hull_range_iff] + simp only [Set.mem_image, Set.mem_ofPred_eq] + rfl + rw [heq] + exact hf.isClosedMap _ hnonneg + +/-- A cone generated by a finite family of real vectors is closed. -/ +theorem isClosed_pointedCone_hull_range + {I E : Type*} [Fintype I] [NormedAddCommGroup E] [NormedSpace ℝ E] + (A : I → E) : + IsClosed (PointedCone.hull ℝ (Set.range A) : Set E) := by + classical + let S := {s : Finset I // LinearIndependent ℝ (fun i : s ↦ A i)} + have heq : (PointedCone.hull ℝ (Set.range A) : Set E) = + ⋃ s : S, (PointedCone.hull ℝ (Set.range (fun i : s.1 ↦ A i)) : Set E) := by + ext x + constructor + · intro hx + obtain ⟨s, hs, hx⟩ := exists_linearIndependent_subcone A hx + exact Set.mem_iUnion.mpr ⟨⟨s, hs⟩, hx⟩ + · intro hx + obtain ⟨s, hs⟩ := Set.mem_iUnion.mp hx + apply Submodule.span_mono _ hs + rintro _ ⟨i, rfl⟩ + exact ⟨i.1, rfl⟩ + rw [heq] + exact isClosed_iUnion_of_finite fun s : S ↦ + isClosed_pointedCone_hull_range_of_linearIndependent _ s.2 + +end MatrixMultiplication.AuxiliarySeparation + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Convex/FixedPoint.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Convex/FixedPoint.lean new file mode 100644 index 0000000000000000000000000000000000000000..99c42a4155736746cde8b91cc6b1cfcbc297bd5b --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Convex/FixedPoint.lean @@ -0,0 +1,226 @@ +import FixedPointTheorems.brouwer +import Mathlib.Analysis.Convex.PartitionOfUnity + +namespace OAI + +/-! Fixed points of continuous maps on compact convex sets of real-valued functions. -/ + +namespace MatrixMultiplication.AuxiliarySeparation + +open Set +open scoped BigOperators + +private def weightSimplex (J : Type*) [Fintype J] : Set (J → ℝ) := + {w | (∀ j, 0 ≤ w j) ∧ ∑ j, w j = 1} + +private theorem weightSimplex_convex (J : Type*) [Fintype J] : + Convex ℝ (weightSimplex J) := by + intro x hx y hy a b ha hb hab + constructor + · intro j + exact add_nonneg (mul_nonneg ha (hx.1 j)) (mul_nonneg hb (hy.1 j)) + · simp only [Pi.add_apply, Pi.smul_apply, smul_eq_mul] + rw [Finset.sum_add_distrib, ← Finset.mul_sum, ← Finset.mul_sum, hx.2, hy.2] + simpa using hab + +private theorem weightSimplex_compact (J : Type*) [Fintype J] : + IsCompact (weightSimplex J) := by + have hc : IsClosed (weightSimplex J) := by + change IsClosed ({w : J → ℝ | ∀ j, 0 ≤ w j} ∩ {w | ∑ j, w j = 1}) + have hn : IsClosed {w : J → ℝ | ∀ j, 0 ≤ w j} := by + simp only [ofPred_forall] + exact isClosed_iInter fun j => isClosed_le continuous_const + (continuous_apply j : Continuous (fun w : J → ℝ => w j)) + exact hn.inter + (isClosed_eq (continuous_finsetSum _ fun _ _ => continuous_apply _) continuous_const) + apply isCompact_Icc.of_isClosed_subset hc + intro w hw + constructor + · exact hw.1 + · intro j + calc + w j ≤ ∑ k, w k := Finset.single_le_sum (fun k _ => hw.1 k) (Finset.mem_univ j) + _ = 1 := hw.2 + +/-- A finite continuous system of barycentric weights gives an approximate fixed point. +The approximation is measured on any prescribed finite set of coordinates. -/ +theorem exists_approximate_fixedPoint_of_weights + {I J : Type*} [Fintype J] [Nonempty J] + {K : Set (I → ℝ)} (hK : Convex ℝ K) (f : C(K, K)) + (a : J → K) (w : J → C(K, ℝ)) + (hw0 : ∀ j x, 0 ≤ w j x) (hw1 : ∀ x, ∑ j, w j x = 1) + (s : Finset I) (ε : ℝ) + (hclose : ∀ x j, w j x ≠ 0 → ∀ i ∈ s, |(a j).val i - x.val i| ≤ ε) : + ∃ x : K, ∀ i ∈ s, |(f x).val i - x.val i| ≤ ε := by + classical + let D := weightSimplex J + let b : D → K := fun v => + ⟨∑ j, v.val j • (a j).val, + hK.sum_mem (fun j _ => v.property.1 j) v.property.2 (fun j _ => (a j).property)⟩ + have hb : Continuous b := by + apply Continuous.subtype_mk + exact continuous_finsetSum _ fun j _ => + ((continuous_apply j).comp continuous_subtype_val).smul continuous_const + let q : K → D := fun x => ⟨fun j => w j x, (fun j => hw0 j x), hw1 x⟩ + have hq : Continuous q := by + exact (continuous_pi fun j => (w j).continuous).subtype_mk _ + let g : C(D, D) := ⟨fun v => q (f (b v)), hq.comp (f.continuous.comp hb)⟩ + have hDne : D.Nonempty := by + let j₀ : J := Classical.choice inferInstance + refine ⟨Pi.single j₀ 1, ?_, ?_⟩ + · intro j + by_cases h : j = j₀ <;> simp [h] + · simp + obtain ⟨v, hv⟩ := brouwer_fixed_point D (weightSimplex_convex J) + (weightSimplex_compact J) hDne g + let x := b v + have hwv (j : J) : w j (f x) = v.val j := congrArg (fun t : D => t.val j) hv + refine ⟨x, fun i hi => ?_⟩ + have hx : x.val i - (f x).val i = ∑ j, v.val j * ((a j).val i - (f x).val i) := by + change (∑ j, v.val j • (a j).val) i - (f x).val i = _ + simp only [Finset.sum_apply, Pi.smul_apply, smul_eq_mul] + simp_rw [mul_sub] + rw [Finset.sum_sub_distrib, ← Finset.sum_mul, v.property.2, one_mul] + rw [abs_sub_comm, hx] + calc + |∑ j, v.val j * ((a j).val i - (f x).val i)| + ≤ ∑ j, |v.val j * ((a j).val i - (f x).val i)| := + Finset.abs_sum_le_sum_abs _ _ + _ = ∑ j, v.val j * |(a j).val i - (f x).val i| := by + apply Finset.sum_congr rfl + intro j _ + rw [abs_mul, abs_of_nonneg (v.property.1 j)] + _ ≤ ∑ j, v.val j * ε := by + apply Finset.sum_le_sum + intro j _ + by_cases hj : v.val j = 0 + · simp [hj] + · exact mul_le_mul_of_nonneg_left + (hclose (f x) j (by rwa [hwv]) i hi) (v.property.1 j) + _ = ε := by rw [← Finset.sum_mul, v.property.2, one_mul] + +theorem exists_finite_partition_weights {I : Type*} {K : Set (I → ℝ)} + (hK : IsCompact K) (s : Finset I) {ε : ℝ} (hε : 0 < ε) : + ∃ n : ℕ, ∃ a : Fin n → K, ∃ w : Fin n → C(K, ℝ), + (∀ x j, 0 ≤ w j x) ∧ (∀ x, ∑ j, w j x = 1) ∧ + (∀ x j, w j x ≠ 0 → ∀ i ∈ s, |(a j).val i - x.val i| < ε) := by + classical + let : CompactSpace K := isCompact_iff_compactSpace.mp hK + let U : K → Set K := fun a => {x | ∀ i ∈ s, |a.val i - x.val i| < ε} + have hUo : ∀ a, IsOpen (U a) := by + intro a + have hUa : U a = ⋂ i ∈ s, {x : K | |a.val i - x.val i| < ε} := by + ext x + simp [U] + rw [hUa] + apply isOpen_biInter_finset + intro i hi + exact isOpen_lt (continuous_const.sub ((continuous_apply i).comp continuous_subtype_val)).abs continuous_const + have hUc : (univ : Set K) ⊆ ⋃ a, U a := by + intro x hx + refine mem_iUnion.mpr ⟨x, ?_⟩ + intro i hi + simpa using hε + obtain ⟨t, ht⟩ := isCompact_univ.elim_finite_subcover U hUo hUc + have htc : (univ : Set K) ⊆ ⋃ a : t, U a.val := by + intro x hx + obtain ⟨a, ha⟩ := mem_iUnion.mp (ht hx) + obtain ⟨hat, hax⟩ := mem_iUnion.mp ha + exact mem_iUnion.mpr ⟨⟨a, hat⟩, hax⟩ + obtain ⟨w, hw⟩ := PartitionOfUnity.exists_isSubordinate isClosed_univ + (fun a : t => U a.val) (fun a => hUo a.val) htc + let e : Fin (Fintype.card t) ≃ t := (Fintype.equivFin t).symm + refine ⟨Fintype.card t, (fun j => (e j).val), (fun j => w (e j)), ?_, ?_, ?_⟩ + · intro x j + exact w.nonneg (e j) x + · intro x + change ∑ j, w (e j) x = 1 + calc + ∑ j, w (e j) x = ∑ a : t, w a x := e.sum_comp (fun a => w a x) + _ = 1 := by simpa only [finsum_eq_sum_of_fintype] using w.sum_eq_one (mem_univ x) + · intro x j hj i hi + exact hw (e j) (subset_closure hj) i hi + + +theorem exists_finite_partition_weights_nonempty {I : Type*} {K : Set (I → ℝ)} + (hK : IsCompact K) (hne : K.Nonempty) (s : Finset I) {ε : ℝ} (hε : 0 < ε) : + ∃ n : ℕ, 0 < n ∧ ∃ a : Fin n → K, ∃ w : Fin n → C(K, ℝ), + (∀ x j, 0 ≤ w j x) ∧ (∀ x, ∑ j, w j x = 1) ∧ + (∀ x j, w j x ≠ 0 → ∀ i ∈ s, |(a j).val i - x.val i| < ε) := by + obtain ⟨n, a, w, hw0, hw1, hwa⟩ := exists_finite_partition_weights hK s hε + have hn : 0 < n := by + by_contra hn + have hn0 : n = 0 := Nat.eq_zero_of_not_pos hn + subst n + obtain ⟨x, hx⟩ := hne + simpa using hw1 ⟨x, hx⟩ + exact ⟨n, hn, a, w, hw0, hw1, hwa⟩ + +theorem compact_approx_limit {I : Type*} {K : Set (I → ℝ)} + (hK : IsCompact K) (_hne : K.Nonempty) (f : K → (I → ℝ)) (hf : Continuous f) + (happrox : ∀ s : Finset I, ∀ ε : ℝ, 0 < ε → + ∃ x : K, ∀ i ∈ s, |f x i - x.val i| ≤ ε) : + ∃ x : K, f x = x.val := by + classical + let : CompactSpace K := isCompact_iff_compactSpace.mp hK + let C : (I × {ε : ℝ // 0 < ε}) → Set K := + fun p => {x | |f x p.1 - x.val p.1| ≤ p.2.val} + have hclosed (p : I × {ε : ℝ // 0 < ε}) : IsClosed (C p) := by + exact isClosed_le + (((continuous_apply p.1).comp hf).sub + ((continuous_apply p.1).comp continuous_subtype_val)).abs continuous_const + have hfinite (s : Finset (I × {ε : ℝ // 0 < ε})) : + (⋂ p ∈ s, C p).Nonempty := by + let es : Finset ℝ := insert 1 (s.image fun p => p.2.val) + have hes : es.Nonempty := ⟨1, by simp [es]⟩ + have he : 0 < es.min' hes := by + rw [Finset.lt_min'_iff] + intro e he + rcases Finset.mem_insert.mp he with rfl | he + · norm_num + · obtain ⟨p, _, rfl⟩ := Finset.mem_image.mp he + exact p.2.property + obtain ⟨x, hx⟩ := happrox (s.image Prod.fst) (es.min' hes) he + refine ⟨x, ?_⟩ + simp only [Set.mem_iInter] + intro p hp + exact (hx p.1 (Finset.mem_image.mpr ⟨p, hp, rfl⟩)).trans + (Finset.min'_le es p.2.val (Finset.mem_insert_of_mem + (Finset.mem_image.mpr ⟨p, hp, rfl⟩))) + obtain ⟨x, hx⟩ := CompactSpace.iInter_nonempty hclosed hfinite + refine ⟨x, funext fun i => ?_⟩ + have hzero : |f x i - x.val i| ≤ 0 := by + apply le_of_forall_pos_le_add + intro ε hε + simpa only [C, Set.mem_ofPred_eq, zero_add] using + (Set.mem_iInter.mp hx (i, ⟨ε, hε⟩)) + exact sub_eq_zero.mp (abs_eq_zero.mp (le_antisymm hzero (abs_nonneg _))) + + +/-- Schauder--Tychonoff for an arbitrary product of real lines. Compactness of the +set, rather than finite dimensionality of the ambient space, is the hypothesis. -/ +theorem compact_convex_fixedPoint {I : Type*} {K : Set (I → ℝ)} + (hKcompact : IsCompact K) (hKconvex : Convex ℝ K) (hKne : K.Nonempty) + (f : C(K, K)) : ∃ x : K, f x = x := by + have happrox : ∀ s : Finset I, ∀ ε : ℝ, 0 < ε → + ∃ x : K, ∀ i ∈ s, |(f x).val i - x.val i| ≤ ε := by + intro s ε hε + obtain ⟨n, hn, a, w, hw0, hw1, hwa⟩ := + exists_finite_partition_weights_nonempty hKcompact hKne s hε + let : Nonempty (Fin n) := ⟨⟨0, hn⟩⟩ + exact exists_approximate_fixedPoint_of_weights hKconvex f a w + (fun j x => hw0 x j) hw1 s ε + (fun x j hj i hi => (hwa x j hj i hi).le) + obtain ⟨x, hx⟩ := compact_approx_limit hKcompact hKne + (fun x => (f x).val) (continuous_subtype_val.comp f.continuous) happrox + exact ⟨x, Subtype.ext hx⟩ + +/-- An unbundled form of the product-space fixed-point theorem. -/ +theorem compact_convex_fixedPoint_of_continuous {I : Type*} {K : Set (I → ℝ)} + (hKcompact : IsCompact K) (hKconvex : Convex ℝ K) (hKne : K.Nonempty) + (f : K → K) (hf : Continuous f) : ∃ x : K, f x = x := + compact_convex_fixedPoint hKcompact hKconvex hKne ⟨f, hf⟩ + +end MatrixMultiplication.AuxiliarySeparation + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Convex/RationalCone.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Convex/RationalCone.lean new file mode 100644 index 0000000000000000000000000000000000000000..82f2dcb6e4b27ec91a05cb8c420c4f7542724f15 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Convex/RationalCone.lean @@ -0,0 +1,203 @@ +import OAI.LinearAlgebra.MatrixMultiplication.AuxiliarySeparation.Convex.RationalSpan +import OAI.LinearAlgebra.MatrixMultiplication.AuxiliarySeparation.Convex.RationalDenominators +import Mathlib.Analysis.Convex.Caratheodory +import Mathlib.Geometry.Convex.Cone.Pointed +import Mathlib.Tactic + +namespace OAI + +/-!+# Rational nonnegative certificates + +Finite rational linear systems with a nonnegative real solution have a +nonnegative rational solution. Affinely independent convex representations +allow a rational-linear projection to preserve the coefficients exactly. +-/ + +namespace MatrixMultiplication.AuxiliarySeparation + +/-- Coordinatewise inclusion of rational vectors into real vectors. -/ +def rationalVectorCast {J : Type*} (v : J → ℚ) : J → ℝ := fun j ↦ v j + +@[simp] theorem rationalVectorCast_apply {J : Type*} (v : J → ℚ) (j : J) : + rationalVectorCast v j = (v j : ℝ) := rfl + +/-- In an affinely independent rational family, the coefficients of a real +convex representation of a rational point are rational. -/ +theorem exists_rat_convex_weights_of_affineIndependent + {I J : Type*} [Fintype I] (v : I → J → ℚ) (b : J → ℚ) + (w : I → ℝ) + (hpos : ∀ i, 0 ≤ w i) (hsum : ∑ i, w i = 1) + (heq : ∑ i, w i • rationalVectorCast (v i) = rationalVectorCast b) + (hind : AffineIndependent ℝ (fun i ↦ rationalVectorCast (v i))) : + ∃ q : I → ℚ, (∀ i, 0 ≤ q i) ∧ ∑ i, q i = 1 ∧ + ∑ i, q i • v i = b := by + classical + obtain ⟨p, hp⟩ := exists_ratLinear_retraction + have hpone : p 1 = 1 := by simpa using hp 1 + let q : I → ℚ := fun i ↦ p (w i) + have hqsum : ∑ i, q i = 1 := by + simpa only [q, map_sum, hpone] using congrArg p hsum + have hqeq : ∑ i, q i • v i = b := by + funext j + have hj := congrFun heq j + simp only [Finset.sum_apply, Pi.smul_apply, rationalVectorCast_apply, + smul_eq_mul] at hj + have hj' := congrArg p hj + simp only [map_sum, hp] at hj' + simp only [Finset.sum_apply, Pi.smul_apply, smul_eq_mul] + convert hj' using 1 + apply Finset.sum_congr rfl + intro i _ + have hm := p.map_smul (v i j) (w i) + simpa only [q, Rat.smul_def, smul_eq_mul, mul_comm] using hm.symm + have hqsumReal : ∑ i, (q i : ℝ) = 1 := by exact_mod_cast hqsum + have hqeqReal : + ∑ i, (q i : ℝ) • rationalVectorCast (v i) = rationalVectorCast b := by + funext j + have hj := congrFun hqeq j + simp only [Finset.sum_apply, Pi.smul_apply, smul_eq_mul] at hj + simpa only [Finset.sum_apply, Pi.smul_apply, rationalVectorCast_apply, + smul_eq_mul] using (show (∑ i, (q i : ℝ) * (v i j : ℝ)) = (b j : ℝ) by + exact_mod_cast hj) + have hqw : ∀ i, (q i : ℝ) = w i := by + intro i + exact hind.eq_of_sum_eq_sum (s := Finset.univ) + (hqsumReal.trans hsum.symm) (hqeqReal.trans heq.symm) i (Finset.mem_univ i) + refine ⟨q, ?_, hqsum, hqeq⟩ + intro i + exact_mod_cast (hqw i ▸ hpos i : 0 ≤ (q i : ℝ)) + +/-- Taking the convex hull of rational vectors in real space does not create +new rational points. -/ +theorem rationalVectorCast_mem_convexHull_descend + {J : Type*} {s : Set (J → ℚ)} {b : J → ℚ} + (h : rationalVectorCast b ∈ convexHull ℝ (rationalVectorCast '' s)) : + b ∈ convexHull ℚ s := by + classical + obtain ⟨I, hI, z, w, hz, hind, hpos, hsum, heq⟩ := + eq_pos_convex_span_of_mem_convexHull h + let : Fintype I := hI + have hv : ∀ i, ∃ v ∈ s, rationalVectorCast v = z i := by + intro i + exact hz (Set.mem_range_self i) + choose v hv hvc using hv + obtain ⟨q, hqpos, hqsum, hqeq⟩ := + exists_rat_convex_weights_of_affineIndependent v b w (fun i ↦ (hpos i).le) + hsum (by simpa only [hvc] using heq) (by simpa only [hvc] using hind) + exact mem_convexHull_of_exists_fintype q v hqpos hqsum hv hqeq + +/-- A rational point in the real cone generated by a finite rational family +already lies in the rational cone generated by that family. -/ +theorem mem_rationalCone_of_nonneg_real_solution + {I J : Type*} [Fintype I] (A : I → J → ℚ) (b : J → ℚ) + (x : I → ℝ) (hxpos : ∀ i, 0 ≤ x i) + (hxeq : ∀ j, ∑ i, x i * (A i j : ℝ) = (b j : ℝ)) : + b ∈ PointedCone.hull ℚ (Set.range A) := by + classical + obtain ⟨N, hN⟩ := exists_nat_gt (∑ i, x i) + have hNpos : (0 : ℝ) < N := + (Finset.sum_nonneg fun i _ ↦ hxpos i).trans_lt hN + have hNne : (N : ℝ) ≠ 0 := hNpos.ne' + have hNrat : (N : ℚ) ≠ 0 := by exact_mod_cast hNne + let scaled : J → ℚ := fun j ↦ b j / N + let v : Option I → J → ℚ := fun i ↦ match i with + | none => 0 + | some i => A i + let w : Option I → ℝ := fun i ↦ match i with + | none => 1 - (∑ i, x i) / N + | some i => x i / N + have hwpos : ∀ i, 0 ≤ w i := by + intro i + cases i with + | none => + change 0 ≤ 1 - (∑ i, x i) / N + exact sub_nonneg.mpr ((div_le_one hNpos).2 hN.le) + | some i => exact div_nonneg (hxpos i) hNpos.le + have hwsum : ∑ i, w i = 1 := by + simp only [Fintype.sum_option, w, ← Finset.sum_div] + ring + have hweq : ∑ i, w i • rationalVectorCast (v i) = rationalVectorCast scaled := by + funext j + simp only [Finset.sum_apply, Pi.smul_apply, smul_eq_mul, + Fintype.sum_option, w, v, rationalVectorCast_apply, Pi.zero_apply, + Rat.cast_zero, mul_zero, zero_add, scaled, Rat.cast_div, Rat.cast_natCast] + simp_rw [div_mul_eq_mul_div] + rw [← Finset.sum_div, hxeq] + let s : Set (J → ℚ) := insert 0 (Set.range A) + have hv : ∀ i, rationalVectorCast (v i) ∈ rationalVectorCast '' s := by + intro i + refine ⟨v i, ?_, rfl⟩ + cases i with + | none => exact Set.mem_insert 0 _ + | some i => exact Set.mem_insert_of_mem 0 (Set.mem_range_self i) + have hcReal : rationalVectorCast scaled ∈ + convexHull ℝ (rationalVectorCast '' s) := + mem_convexHull_of_exists_fintype w (fun i ↦ rationalVectorCast (v i)) + hwpos hwsum hv hweq + have hcRat : scaled ∈ convexHull ℚ s := + rationalVectorCast_mem_convexHull_descend hcReal + have hs : s ⊆ PointedCone.hull ℚ (Set.range A) := by + intro a ha + rcases ha with rfl | ha + · exact Submodule.zero_mem _ + · exact PointedCone.subset_hull ha + have hscaled : scaled ∈ PointedCone.hull ℚ (Set.range A) := + convexHull_min hs (PointedCone.convex _) hcRat + have hscale : (N : ℚ) • scaled = b := by + funext j + simp only [Pi.smul_apply, smul_eq_mul, scaled] + field_simp + rw [← hscale] + exact PointedCone.smul_mem _ (Nat.cast_nonneg N) hscaled + +/-- Nonnegative solvability of a finite rational linear system descends from +real coefficients to rational coefficients. The equation index type may be +infinite. -/ +theorem exists_nonneg_rat_solution_of_real + {I J : Type*} [Fintype I] (A : I → J → ℚ) (b : J → ℚ) + (h : ∃ x : I → ℝ, (∀ i, 0 ≤ x i) ∧ + ∀ j, ∑ i, x i * (A i j : ℝ) = (b j : ℝ)) : + ∃ q : I → ℚ, (∀ i, 0 ≤ q i) ∧ ∀ j, ∑ i, q i * A i j = b j := by + obtain ⟨x, hxpos, hxeq⟩ := h + have hb := mem_rationalCone_of_nonneg_real_solution A b x hxpos hxeq + obtain ⟨q, hq⟩ := (Submodule.mem_span_range_iff_exists_fun (Nonneg ℚ)).1 hb + refine ⟨fun i ↦ (q i : ℚ), fun i ↦ (q i).property, ?_⟩ + intro j + have hj := congrFun hq j + simpa only [Finset.sum_apply, Pi.smul_apply, ← Nonneg.coe_smul, smul_eq_mul] using hj + +/-- Clearing denominators turns a nonnegative real solution of a rational +system into a positive integer multiple with natural coefficients. -/ +theorem exists_nat_scaled_solution_of_nonneg_real + {I J : Type*} [Fintype I] (A : I → J → ℚ) (b : J → ℚ) + (h : ∃ x : I → ℝ, (∀ i, 0 ≤ x i) ∧ + ∀ j, ∑ i, x i * (A i j : ℝ) = (b j : ℝ)) : + ∃ D : ℕ, 0 < D ∧ ∃ c : I → ℕ, + ∀ j, ∑ i, (c i : ℚ) * A i j = (D : ℚ) * b j := by + obtain ⟨q, hqpos, hqeq⟩ := exists_nonneg_rat_solution_of_real A b h + obtain ⟨D, hDpos, c, hc⟩ := exists_nat_mul_eq_nat q hqpos + refine ⟨D, hDpos, c, fun j ↦ ?_⟩ + calc + ∑ i, (c i : ℚ) * A i j = ∑ i, ((D : ℚ) * q i) * A i j := by simp only [hc] + _ = (D : ℚ) * ∑ i, q i * A i j := by rw [Finset.mul_sum]; simp only [mul_assoc] + _ = (D : ℚ) * b j := by rw [hqeq] + +/-- Integer form of finite cone certificate extraction. This is the form used +when the selected additive relations have integral coefficients. -/ +theorem exists_nat_scaled_int_solution_of_nonneg_real + {I J : Type*} [Fintype I] (A : I → J → ℤ) (b : J → ℤ) + (h : ∃ x : I → ℝ, (∀ i, 0 ≤ x i) ∧ + ∀ j, ∑ i, x i * (A i j : ℝ) = (b j : ℝ)) : + ∃ D : ℕ, 0 < D ∧ ∃ c : I → ℕ, + ∀ j, ∑ i, (c i : ℤ) * A i j = (D : ℤ) * b j := by + obtain ⟨x, hxpos, hxeq⟩ := h + obtain ⟨D, hDpos, c, hc⟩ := + exists_nat_scaled_solution_of_nonneg_real + (fun i j ↦ (A i j : ℚ)) (fun j ↦ (b j : ℚ)) + ⟨x, hxpos, by simpa using hxeq⟩ + refine ⟨D, hDpos, c, fun j ↦ ?_⟩ + exact_mod_cast hc j + +end MatrixMultiplication.AuxiliarySeparation + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Convex/RationalDenominators.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Convex/RationalDenominators.lean new file mode 100644 index 0000000000000000000000000000000000000000..dc2b951e92f18201514fae508c5f5165e2a46c13 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Convex/RationalDenominators.lean @@ -0,0 +1,44 @@ +import Mathlib.Algebra.Order.Ring.Rat +import Mathlib.Data.Fintype.BigOperators +import Mathlib.Tactic + +namespace OAI + +/-! +# Clearing denominators in nonnegative rational families +-/ + +namespace MatrixMultiplication.AuxiliarySeparation + +/-- Every natural multiple of a denominator clears its nonnegative rational. -/ +theorem exists_nat_eq_mul_rat_of_den_dvd {q : ℚ} (hq : 0 ≤ q) + {D : ℕ} (hD : q.den ∣ D) : + ∃ c : ℕ, (D : ℚ) * q = (c : ℚ) := by + obtain ⟨k, rfl⟩ := hD + refine ⟨k * q.num.toNat, ?_⟩ + have hnum : (q.num.toNat : ℚ) = (q.num : ℚ) := by + exact_mod_cast Int.toNat_of_nonneg (Rat.num_nonneg.mpr hq) + push_cast + rw [hnum] + calc + (q.den : ℚ) * k * q = k * ((q.den : ℚ) * q) := by ring + _ = k * (q.num : ℚ) := by rw [Rat.den_mul_eq_num] + +/-- A finite nonnegative rational family has a common positive denominator +which turns every coefficient into a natural number. -/ +theorem exists_nat_mul_eq_nat {I : Type*} [Fintype I] + (q : I → ℚ) (hq : ∀ i, 0 ≤ q i) : + ∃ D : ℕ, 0 < D ∧ ∃ c : I → ℕ, ∀ i, (D : ℚ) * q i = (c i : ℚ) := by + classical + let D : ℕ := ∏ i, (q i).den + have hD : 0 < D := Finset.prod_pos fun i _ ↦ (q i).den_pos + have hc : ∀ i, ∃ c : ℕ, (D : ℚ) * q i = (c : ℚ) := by + intro i + exact exists_nat_eq_mul_rat_of_den_dvd (hq i) + (Finset.dvd_prod_of_mem (fun j ↦ (q j).den) (Finset.mem_univ i)) + choose c hc using hc + exact ⟨D, hD, c, hc⟩ + +end MatrixMultiplication.AuxiliarySeparation + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Convex/RationalSpan.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Convex/RationalSpan.lean new file mode 100644 index 0000000000000000000000000000000000000000..f6076e78ae0c5e127611b70e3c2bb40d96bb743f --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Convex/RationalSpan.lean @@ -0,0 +1,48 @@ +import Mathlib.Basic.Real.Basic +import Mathlib.Algebra.Algebra.Rat +import Mathlib.LinearAlgebra.Dual.Lemmas + +namespace OAI + +/-! +# Descent of rational linear systems + +A rational linear system which has a real solution also has a rational solution. +The proof applies a rational-linear projection from the reals onto the rationals. +-/ + +namespace MatrixMultiplication.AuxiliarySeparation + +/-- A rational-linear functional on the reals taking `1` to `1`. -/ +theorem exists_ratLinear_one : + ∃ p : ℝ →ₗ[ℚ] ℚ, p 1 = 1 := + Module.Projective.exists_dual_eq_one ℚ (one_ne_zero : (1 : ℝ) ≠ 0) + +/-- A rational-linear projection from the reals to the rationals. -/ +theorem exists_ratLinear_retraction : + ∃ p : ℝ →ₗ[ℚ] ℚ, ∀ q : ℚ, p (q : ℝ) = q := by + obtain ⟨p, hp⟩ := exists_ratLinear_one + refine ⟨p, fun q ↦ ?_⟩ + have h := p.map_smul q (1 : ℝ) + simpa [hp] using h + +/-- Solvability of a finite rational linear system descends from real to rational +coefficients. The set of equations need not be finite. -/ +theorem exists_rat_solution_of_real {I : Type*} {J : Type*} [Fintype I] + (A : I → J → ℚ) (b : J → ℚ) + (h : ∃ x : I → ℝ, ∀ j, ∑ i, x i * (A i j : ℝ) = (b j : ℝ)) : + ∃ q : I → ℚ, ∀ j, ∑ i, q i * A i j = b j := by + obtain ⟨p, hp⟩ := exists_ratLinear_retraction + obtain ⟨x, hx⟩ := h + refine ⟨fun i ↦ p (x i), fun j ↦ ?_⟩ + have heq := congrArg p (hx j) + simp only [map_sum, hp] at heq + convert heq using 1 + apply Finset.sum_congr rfl + intro i _ + have hmul := p.map_smul (A i j) (x i) + simpa only [Rat.smul_def, smul_eq_mul, mul_comm] using hmul.symm + +end MatrixMultiplication.AuxiliarySeparation + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Convolution/Basic.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Convolution/Basic.lean new file mode 100644 index 0000000000000000000000000000000000000000..b62143b8d611ea8ec7b23ef497cb76e06b1f3495 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Convolution/Basic.lean @@ -0,0 +1,161 @@ +import OAI.LinearAlgebra.MatrixMultiplication.Tensor.ComplexDotPairing +import OAI.LinearAlgebra.MatrixMultiplication.Tensor.ComplexTensorSymmetrization +import Mathlib.Tactic + +namespace OAI + +/-! +# The polynomial multiplication tensor + +The coefficient tensor `convolution a b` represents multiplication of binary forms +of degrees `a - 1` and `b - 1`, or equivalently ordinary coefficient convolution. +The output leg has `a + b - 1` coordinates. The definitions also make sense when +an input dimension is zero, while the nonzero and full-output-support statements +use the positive dimensions assumed in Section 5 of the paper. +-/ + +open scoped BigOperators + +namespace MatrixMultiplication.AuxiliarySeparation + +open MatrixMultiplication.Foundation + +/-- The tensor `C(a,b)` of Section 5, in monomial coefficient coordinates. -/ +def convolution (a b : ℕ) : Tensor ℂ (Fin a) (Fin b) (Fin (a + b - 1)) := + fun i j k => if i.val + j.val = k.val then 1 else 0 + +@[simp] theorem convolution_apply (a b : ℕ) + (i : Fin a) (j : Fin b) (k : Fin (a + b - 1)) : + convolution a b i j k = if i.val + j.val = k.val then 1 else 0 := rfl + +@[simp] theorem convolution_ne_zero_iff {a b : ℕ} + (i : Fin a) (j : Fin b) (k : Fin (a + b - 1)) : + convolution a b i j k ≠ 0 ↔ i.val + j.val = k.val := by + simp only [convolution] + split_ifs <;> simp_all + +@[simp] theorem convolution_eq_one_iff {a b : ℕ} + (i : Fin a) (j : Fin b) (k : Fin (a + b - 1)) : + convolution a b i j k = 1 ↔ i.val + j.val = k.val := by + simp only [convolution] + split_ifs <;> simp_all + +@[simp] theorem convolution_eq_zero_iff {a b : ℕ} + (i : Fin a) (j : Fin b) (k : Fin (a + b - 1)) : + convolution a b i j k = 0 ↔ i.val + j.val ≠ k.val := by + simp only [convolution] + split_ifs <;> simp_all + +/-- Every pair of input monomials has a valid output coordinate. -/ +def convolutionOutput {a b : ℕ} (i : Fin a) (j : Fin b) : Fin (a + b - 1) := + ⟨i.val + j.val, by have hi := i.isLt; have hj := j.isLt; omega⟩ + +@[simp] theorem convolution_at_output {a b : ℕ} (i : Fin a) (j : Fin b) : + convolution a b i j (convolutionOutput i j) = 1 := by + simp [convolutionOutput] + +/-- Every output monomial of the expected degree occurs in the product. -/ +theorem convolution_output_supported {a b : ℕ} (ha : 0 < a) (hb : 0 < b) + (k : Fin (a + b - 1)) : + ∃ (i : Fin a) (j : Fin b), convolution a b i j k = 1 := by + by_cases hk : k.val < a + · exact ⟨⟨k.val, hk⟩, ⟨0, hb⟩, by simp⟩ + · have hk' := k.isLt + refine ⟨⟨a - 1, by omega⟩, ⟨k.val - (a - 1), by omega⟩, ?_⟩ + apply (convolution_eq_one_iff _ _ _).mpr + dsimp + omega + +theorem convolution_nonzero {a b : ℕ} (ha : 0 < a) (hb : 0 < b) : + convolution a b ≠ 0 := by + intro hz + have hc := congrFun (congrFun (congrFun hz ⟨0, ha⟩) ⟨0, hb⟩) + (convolutionOutput ⟨0, ha⟩ ⟨0, hb⟩) + change convolution a b ⟨0, ha⟩ ⟨0, hb⟩ + (convolutionOutput ⟨0, ha⟩ ⟨0, hb⟩) = 0 at hc + rw [convolution_at_output] at hc + exact one_ne_zero hc + +theorem convolution_nonzero_iff (a b : ℕ) : + convolution a b ≠ 0 ↔ 0 < a ∧ 0 < b := by + constructor + · intro h + constructor + · by_contra ha + have ha' : a = 0 := by omega + subst a + apply h + funext i + exact Fin.elim0 i + · by_contra hb + have hb' : b = 0 := by omega + subst b + apply h + funext i j + exact Fin.elim0 j + · rintro ⟨ha, hb⟩ + exact convolution_nonzero ha hb + +/-- Commuting the two inputs only casts the equal output dimensions. -/ +theorem convolution_comm (a b : ℕ) (i : Fin a) (j : Fin b) + (k : Fin (a + b - 1)) : + convolution a b i j k = + convolution b a j i (Fin.cast (by omega) k) := by + simp only [convolution, Fin.val_cast, Nat.add_comm] + +/-- The boundary tensor `C(1,b)` has the coefficient matrix of a dot product. -/ +theorem convolution_one_left (b : ℕ) (i : Fin 1) (j : Fin b) + (k : Fin (1 + b - 1)) : + convolution 1 b i j k = if j.val = k.val then 1 else 0 := by + simp [convolution] + +/-- The other boundary tensor has the same coordinate identity. -/ +theorem convolution_one_right (a : ℕ) (i : Fin a) (j : Fin 1) + (k : Fin (a + 1 - 1)) : + convolution a 1 i j k = if i.val = k.val then 1 else 0 := by + simp [convolution] + +/-- Relabel the output of `C(1,b)` by its actual dimension `b`. -/ +def convolutionOneOutputEquiv (b : ℕ) : Fin b ≃ Fin (1 + b - 1) := + finCongr (by omega) + +/-- Relabel the single input coordinate of `C(1,b)` by `Unit`. -/ +def convolutionOneInputEquiv : Unit ≃ Fin 1 where + toFun _ := 0 + invFun _ := () + left_inv _ := rfl + right_inv _i := Subsingleton.elim _ _ + +/-- `C(1,b)` is the dot-product tensor with the singleton on the first leg. -/ +theorem convolution_one_left_dotPairing (b : ℕ) : + Tensor.pullback convolutionOneInputEquiv (Equiv.refl (Fin b)) + (convolutionOneOutputEquiv b) (convolution 1 b) = + Tensor.cyclic (Tensor.cyclic (Tensor.dotPairing (K := ℂ) (Fin b))) := by + funext i j k + simp [Tensor.pullback, convolutionOneInputEquiv, convolutionOneOutputEquiv, + Tensor.cyclic, Tensor.dotPairing, convolution, Fin.ext_iff] + +/-- Relabel the output of `C(a,1)` by its actual dimension `a`. -/ +def convolutionRightOneOutputEquiv (a : ℕ) : Fin a ≃ Fin (a + 1 - 1) := + finCongr (by omega) + +/-- `C(a,1)` is the dot-product tensor with the singleton on the second leg. -/ +theorem convolution_one_right_dotPairing (a : ℕ) : + Tensor.pullback (Equiv.refl (Fin a)) convolutionOneInputEquiv + (convolutionRightOneOutputEquiv a) (convolution a 1) = + Tensor.cyclic (Tensor.dotPairing (K := ℂ) (Fin a)) := by + funext i j k + simp [Tensor.pullback, convolutionOneInputEquiv, convolutionRightOneOutputEquiv, + Tensor.cyclic, Tensor.dotPairing, convolution, Fin.ext_iff, eq_comm] + +/-- Contracting the coefficient tensor computes ordinary finite convolution. -/ +theorem contract_convolution {a b : ℕ} (x : Fin a → ℂ) (y : Fin b → ℂ) + (k : Fin (a + b - 1)) : + Tensor.contract (convolution a b) x y k = + ∑ i : Fin a, ∑ j : Fin b, + if i.val + j.val = k.val then x i * y j else 0 := by + simp [Tensor.contract, convolution, ite_mul] + +end MatrixMultiplication.AuxiliarySeparation + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Convolution/Rank.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Convolution/Rank.lean new file mode 100644 index 0000000000000000000000000000000000000000..6fc2faeb88cd7b9a69e58384f2ee38f66b91db1d --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Convolution/Rank.lean @@ -0,0 +1,71 @@ +import OAI.LinearAlgebra.MatrixMultiplication.AuxiliarySeparation.Convolution.Basic +import Mathlib.LinearAlgebra.Lagrange + +namespace OAI + +/-! +# Polynomial convolution by evaluation and interpolation + +Evaluating the two input polynomials at `a + b - 1` distinct complex points, +then interpolating their product, expresses the convolution tensor as a sum +of `a + b - 1` rank-one tensors. This is the polynomial multiplication rank +upper bound used in Section 5. +-/ + +open scoped BigOperators +open Polynomial + +namespace MatrixMultiplication.AuxiliarySeparation + +open MatrixMultiplication.Foundation + +/-- Recover each monomial coefficient from evaluations at distinct nodes. -/ +lemma monomial_coeff_eq_sum_interpolation {n m : ℕ} (hm : m < n) + (v : Fin n → ℂ) (hv : Function.Injective v) (k : ℕ) : + (if m = k then (1 : ℂ) else 0) = + ∑ r : Fin n, v r ^ m * (Lagrange.basis Finset.univ v r).coeff k := by + have hdeg : (X ^ m : ℂ[X]).degree < (Finset.univ : Finset (Fin n)).card := by + simpa using hm + have hpoly := Lagrange.eq_interpolate (f := (X ^ m : ℂ[X])) hv.injOn hdeg + have hcoeff := congrArg (fun p : ℂ[X] => p.coeff k) hpoly + simpa only [Lagrange.interpolate_apply, Polynomial.finsetSum_coeff, + Polynomial.coeff_C_mul, Polynomial.eval_pow, Polynomial.eval_X, + Polynomial.coeff_X_pow, eq_comm] using hcoeff + +/-- Evaluation at distinct nodes and Lagrange interpolation give an explicit +rank-one decomposition of polynomial convolution. -/ +theorem convolution_eq_sum_rankOne {a b : ℕ} + (v : Fin (a + b - 1) → ℂ) (hv : Function.Injective v) : + convolution a b = fun i j k => ∑ r : Fin (a + b - 1), + Tensor.rankOne (fun i : Fin a => v r ^ i.val) + (fun j : Fin b => v r ^ j.val) + (fun k : Fin (a + b - 1) => (Lagrange.basis Finset.univ v r).coeff k.val) + i j k := by + funext i j k + have hij : i.val + j.val < a + b - 1 := (convolutionOutput i j).isLt + simpa only [convolution_apply, Tensor.rankOne, pow_add] using + monomial_coeff_eq_sum_interpolation hij v hv k.val + +/-- The convolution tensor `C(a,b)` has rank at most `a + b - 1` over `ℂ`. -/ +theorem convolution_rankAtMost (a b : ℕ) : + Tensor.RankAtMost (convolution a b) (a + b - 1) := by + let v : Fin (a + b - 1) → ℂ := fun r => r.val + have hv : Function.Injective v := by + intro i j h + apply Fin.ext + change (i.val : ℂ) = j.val at h + exact_mod_cast h + rw [convolution_eq_sum_rankOne v hv] + simpa using Tensor.rankAtMost_sum_rankOne + (fun r (i : Fin a) => v r ^ i.val) + (fun r (j : Fin b) => v r ^ j.val) + (fun r (k : Fin (a + b - 1)) => (Lagrange.basis Finset.univ v r).coeff k.val) + +/-- The interpolation algorithm also bounds border rank. -/ +theorem convolution_borderRankAtMost (a b : ℕ) : + Tensor.BorderRankAtMost (convolution a b) (a + b - 1) := + (convolution_rankAtMost a b).borderRankAtMost + +end MatrixMultiplication.AuxiliarySeparation + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Convolution/RankLowerBound.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Convolution/RankLowerBound.lean new file mode 100644 index 0000000000000000000000000000000000000000..10279307a71a22f4eda4e1dcb3cc100078be5413 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Convolution/RankLowerBound.lean @@ -0,0 +1,51 @@ +import OAI.LinearAlgebra.MatrixMultiplication.AuxiliarySeparation.Convolution.Rank +import OAI.LinearAlgebra.MatrixMultiplication.AuxiliarySeparation.Arithmetic.RankExponent + +namespace OAI + +/-! +# Exact rank of polynomial convolution + +Each output coefficient of polynomial multiplication occurs in some product +of two input monomials. Choosing one such pair for each output gives an +identity minor in the output flattening. Together with evaluation and +interpolation, this proves the exact rank of `C(a,b)` for positive dimensions. +-/ + +noncomputable section + +namespace MatrixMultiplication.AuxiliarySeparation + +open MatrixMultiplication.Foundation + +/-- Choosing one product for every output monomial gives an identity minor +of the output flattening. -/ +theorem convolution_identity_minor {a b : ℕ} (ha : 0 < a) (hb : 0 < b) : + ∃ (x : Fin (a + b - 1) → Fin a) (y : Fin (a + b - 1) → Fin b), + ∀ k l, convolution a b (x k) (y k) l = if k = l then 1 else 0 := by + choose x y hxy using fun k : Fin (a + b - 1) => convolution_output_supported ha hb k + have hsum (k : Fin (a + b - 1)) : (x k).val + (y k).val = k.val := + (convolution_eq_one_iff _ _ _).mp (hxy k) + refine ⟨x, y, ?_⟩ + intro k l + simp only [convolution_apply, hsum, Fin.val_inj] + +/-- Every rank decomposition of convolution has at least one term per output +coefficient. -/ +theorem convolution_rank_lower {a b r : ℕ} (ha : 0 < a) (hb : 0 < b) + (hRank : Tensor.RankAtMost (convolution a b) r) : a + b - 1 ≤ r := by + obtain ⟨x, y, hxy⟩ := convolution_identity_minor ha hb + simpa using hRank.card_le_of_identity x y id hxy + +/-- Polynomial multiplication has exact rank `a+b-1` when both inputs have +positive dimension. -/ +theorem exactRank_convolution {a b : ℕ} (ha : 0 < a) (hb : 0 < b) : + exactRank (convolution a b) = a + b - 1 := by + apply le_antisymm (exactRank_le (convolution_rankAtMost a b)) + exact convolution_rank_lower ha hb (exactRank_spec _) + +end MatrixMultiplication.AuxiliarySeparation + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Convolution/Symmetry.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Convolution/Symmetry.lean new file mode 100644 index 0000000000000000000000000000000000000000..aa35b2746abf461c2bcbecf773770a266f81ad3a --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Convolution/Symmetry.lean @@ -0,0 +1,161 @@ +import OAI.LinearAlgebra.MatrixMultiplication.AuxiliarySeparation.Character.Symmetrization +import OAI.LinearAlgebra.MatrixMultiplication.AuxiliarySeparation.Convolution.Rank +import OAI.LinearAlgebra.MatrixMultiplication.AuxiliarySeparation.Character.Dot +import OAI.LinearAlgebra.MatrixMultiplication.AuxiliarySeparation.Growth.NormalizedProfile + +namespace OAI + +/-! +# Character identities for polynomial convolution + +The boundary convolution tensors are dot products. In the sixfold character +product, each possible singleton leg appears exactly twice. Consequently the +normalization by the average dot-product exponent gives the boundary values +of the polynomial profile from Section 5. +-/ + +noncomputable section + +namespace MatrixMultiplication.AuxiliarySeparation +namespace Character + +open MatrixMultiplication.Foundation + +variable (χ : Character) + +/-- A symmetric dot product occurs twice in each of its three leg positions. -/ +theorem sixfoldProduct_dotPairing (n : ℕ) : + χ.sixfoldProduct (Tensor.dotPairing (K := ℂ) (Fin n)) = + (χ.value (Tensor.dotPairing (K := ℂ) (Fin n)) * + χ.value (Tensor.cyclic (Tensor.dotPairing (K := ℂ) (Fin n))) * + χ.value (Tensor.cyclic (Tensor.cyclic + (Tensor.dotPairing (K := ℂ) (Fin n))))) ^ 2 := by + let D := Tensor.dotPairing (K := ℂ) (Fin n) + have h3 : (fun (i : Fin n) (_ : Unit) (j : Fin n) => D i j ()) = + Tensor.cyclic D := by + funext i u j + simp [D, Tensor.cyclic, Tensor.dotPairing, eq_comm] + have h4 : (fun (_ : Unit) (j i : Fin n) => D i j ()) = + Tensor.cyclic (Tensor.cyclic D) := by + funext u j i + simp [D, Tensor.cyclic, Tensor.dotPairing, eq_comm] + have h5 : (fun (j i : Fin n) (_ : Unit) => D i j ()) = D := by + funext j i u + simp [D, Tensor.dotPairing, eq_comm] + change χ.sixfoldProduct D = _ + unfold sixfoldProduct + change χ.value D * χ.value (Tensor.cyclic D) * + χ.value (Tensor.cyclic (Tensor.cyclic D)) * + χ.value (fun (i : Fin n) (_ : Unit) (j : Fin n) => D i j ()) * + χ.value (fun (_ : Unit) (j i : Fin n) => D i j ()) * + χ.value (fun (j i : Fin n) (_ : Unit) => D i j ()) = _ + rw [h3, h4, h5] + ring + +/-- The boundary `C(1,b)` has the sixfold product of a dot product. -/ +theorem sixfoldProduct_convolution_one_left (b : ℕ) : + χ.sixfoldProduct (convolution 1 b) = + χ.sixfoldProduct (Tensor.dotPairing (K := ℂ) (Fin b)) := by + have h := χ.sixfoldProduct_reindex (convolution 1 b) + convolutionOneInputEquiv (Equiv.refl (Fin b)) (convolutionOneOutputEquiv b) + rw [convolution_one_left_dotPairing] at h + calc + _ = χ.sixfoldProduct (Tensor.cyclic (Tensor.cyclic + (Tensor.dotPairing (K := ℂ) (Fin b)))) := h.symm + _ = χ.sixfoldProduct (Tensor.cyclic (Tensor.dotPairing (K := ℂ) (Fin b))) := + χ.sixfoldProduct_cyclic _ + _ = _ := χ.sixfoldProduct_cyclic _ + +/-- The boundary `C(a,1)` has the same dot-product product. -/ +theorem sixfoldProduct_convolution_one_right (a : ℕ) : + χ.sixfoldProduct (convolution a 1) = + χ.sixfoldProduct (Tensor.dotPairing (K := ℂ) (Fin a)) := by + rw [χ.sixfoldProduct_convolution_comm, χ.sixfoldProduct_convolution_one_left] + +/-- The mean of the character's three singleton-leg exponents. -/ +def meanExponent : ℝ := (χ.pX + χ.pY + χ.pZ) / 3 + +theorem meanExponent_nonneg : 0 ≤ χ.meanExponent := by + exact div_nonneg (add_nonneg (add_nonneg χ.pX_nonneg χ.pY_nonneg) χ.pZ_nonneg) + (by norm_num) + +theorem meanExponent_le_one : χ.meanExponent ≤ 1 := by + unfold meanExponent + have hx := χ.pX_le_one + have hy := χ.pY_le_one + have hz := χ.pZ_le_one + linarith + +/-- The three exponents occur twice in the sixfold boundary product. -/ +theorem sixfoldProduct_dotPairing_eq_rpow {n : ℕ} (hn : 0 < n) : + χ.sixfoldProduct (Tensor.dotPairing (K := ℂ) (Fin n)) = + (n : ℝ) ^ (6 * χ.meanExponent) := by + have hn' : 0 < (n : ℝ) := Nat.cast_pos.mpr hn + rw [χ.sixfoldProduct_dotPairing, χ.value_dotPairing hn, + χ.value_cyclic_dotPairing hn, χ.value_cyclic_cyclic_dotPairing hn, + ← Real.rpow_add hn', ← Real.rpow_add hn'] + calc + ((n : ℝ) ^ (χ.pZ + χ.pY + χ.pX)) ^ 2 = + (n : ℝ) ^ ((χ.pZ + χ.pY + χ.pX) * (2 : ℕ)) := + (Real.rpow_mul_natCast hn'.le _ 2).symm + _ = _ := by congr 1; unfold meanExponent; ring + +/-- The positive-size boundary product has its exact normalized power. -/ +theorem sixfoldProduct_convolution_one_left_eq_rpow {b : ℕ} (hb : 0 < b) : + χ.sixfoldProduct (convolution 1 b) = (b : ℝ) ^ (6 * χ.meanExponent) := by + rw [χ.sixfoldProduct_convolution_one_left, χ.sixfoldProduct_dotPairing_eq_rpow hb] + +/-- The polynomial profile `P(a,b)` normalized by the actual mean exponent. -/ +def convolutionProfile (a b : ℕ) : ℝ := + χ.symmetrizedProfile χ.meanExponent (convolution a b) + +/-- Swapping the two polynomial inputs preserves the normalized profile. -/ +theorem convolutionProfile_comm (a b : ℕ) : + χ.convolutionProfile a b = χ.convolutionProfile b a := by + exact congrArg (fun s : ℝ => s ^ (1 / (6 * χ.meanExponent))) + (χ.sixfoldProduct_convolution_comm a b) + +theorem convolutionProfile_nonneg (a b : ℕ) : 0 ≤ χ.convolutionProfile a b := + χ.symmetrizedProfile_nonneg _ _ + +/-- Nonzero polynomial multiplication gives a positive normalized profile. -/ +theorem convolutionProfile_pos {a b : ℕ} (ha : 0 < a) (hb : 0 < b) : + 0 < χ.convolutionProfile a b := + χ.symmetrizedProfile_pos _ (convolution_nonzero ha hb) + +/-- The evaluation/interpolation algorithm bounds the normalized profile. -/ +theorem convolutionProfile_le {a b : ℕ} (ht : 0 < χ.meanExponent) : + χ.convolutionProfile a b ≤ (a + b - 1 : ℕ) ^ (1 / χ.meanExponent) := + χ.symmetrizedProfile_le_rank ht (convolution_rankAtMost a b) + +/-- The normalization gives the exact initial value `P(1,b) = b`. -/ +theorem convolutionProfile_one_left {b : ℕ} (ht : 0 < χ.meanExponent) (hb : 0 < b) : + χ.convolutionProfile 1 b = b := by + have hb' : 0 < (b : ℝ) := Nat.cast_pos.mpr hb + unfold convolutionProfile symmetrizedProfile + rw [χ.sixfoldProduct_convolution_one_left_eq_rpow hb, ← Real.rpow_mul hb'.le] + rw [show (6 * χ.meanExponent) * (1 / (6 * χ.meanExponent)) = 1 by + field_simp [ne_of_gt ht]] + exact Real.rpow_one _ + +/-- Input symmetry gives the other exact initial value `P(a,1) = a`. -/ +theorem convolutionProfile_one_right {a : ℕ} (ht : 0 < χ.meanExponent) (ha : 0 < a) : + χ.convolutionProfile a 1 = a := by + rw [χ.convolutionProfile_comm, χ.convolutionProfile_one_left ht ha] + +/-- Interpolation bounds an individual character on polynomial convolution. -/ +theorem value_convolution_le (a b : ℕ) : + χ.value (convolution a b) ≤ (a + b - 1 : ℕ) := + χ.value_le_rank (convolution_rankAtMost a b) + +/-- Positive input sizes give a positive individual character value. -/ +theorem value_convolution_pos {a b : ℕ} (ha : 0 < a) (hb : 0 < b) : + 0 < χ.value (convolution a b) := + zero_lt_one.trans_le (χ.one_le_value (convolution_nonzero ha hb)) + +end Character +end MatrixMultiplication.AuxiliarySeparation + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Determinant/Basis.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Determinant/Basis.lean new file mode 100644 index 0000000000000000000000000000000000000000..432145b76cf87c29d7393e93445a0d378b07f75c --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Determinant/Basis.lean @@ -0,0 +1,111 @@ +import OAI.LinearAlgebra.MatrixMultiplication.AuxiliarySeparation.Determinant.Kernel +import Mathlib.LinearAlgebra.FiniteDimensional.Lemmas + +namespace OAI + +/-! +# The finite adapted basis for the determinant filtration + +The quotient vectors and determinant-kernel vectors of Section 5.1 form a basis +of the actual space of bidegree `(e,1)` forms. The proof works over every field, +including in the boundary case `e = 0` where the kernel has dimension zero. +-/ + +noncomputable section + +namespace MatrixMultiplication.AuxiliarySeparation.DeterminantBasis + +open Polynomial + +variable {R : Type*} [CommRing R] + +/-- Affine coefficient pairs of forms of bidegree `(e,1)`. -/ +abbrev BoundedPair (R : Type*) [CommRing R] (e : ℕ) := + degreeLT R (e + 1) × degreeLT R (e + 1) + +/-- Forget the degree bounds in the affine representation of binary forms. -/ +def forget (e : ℕ) : BoundedPair R e →ₗ[R] DeterminantKernel.FormPair R where + toFun p := ((p.1 : R[X]), (p.2 : R[X])) + map_add' _ _ := rfl + map_smul' _ _ := rfl + +theorem forget_injective (e : ℕ) : Function.Injective (forget (R := R) e) := by + intro p q h + apply Prod.ext <;> apply Subtype.ext + · exact congrArg Prod.fst h + · exact congrArg Prod.snd h + +/-- A quotient vector with both coefficient polynomials of degree at most `e`. -/ +def quotientVector (e : ℕ) (j : Fin (e + 2)) : BoundedPair R e := + if h : (j : ℕ) < e + 1 then + (⟨X ^ (j : ℕ), mem_degreeLT.mpr ((degree_X_pow_le _).trans_lt (by exact_mod_cast h))⟩, 0) + else + (0, ⟨X ^ e, mem_degreeLT.mpr ((degree_X_pow_le _).trans_lt (by exact_mod_cast Nat.lt_succ_self e))⟩) + +/-- A bounded kernel vector, obtained by multiplication by `uw-vs`. -/ +def kernelVector (e : ℕ) (j : Fin e) : BoundedPair R e := + (⟨-(X ^ ((j : ℕ) + 1)), mem_degreeLT.mpr <| by + rw [degree_neg] + exact (degree_X_pow_le _).trans_lt (by exact_mod_cast (show (j : ℕ) + 1 < e + 1 by omega))⟩, + ⟨X ^ (j : ℕ), mem_degreeLT.mpr <| + (degree_X_pow_le _).trans_lt (by exact_mod_cast (show (j : ℕ) < e + 1 by omega))⟩) + +/-- The quotient vectors first, followed by the determinant-kernel vectors. -/ +def vector (e : ℕ) : (Fin (e + 2) ⊕ Fin e) → BoundedPair R e := + Sum.elim (quotientVector e) (kernelVector e) + +@[simp] theorem forget_quotientVector (e : ℕ) (j : Fin (e + 2)) : + forget e (quotientVector (R := R) e j) = DeterminantKernel.quotientVector e j := by + unfold quotientVector DeterminantKernel.quotientVector + split_ifs <;> rfl + +@[simp] theorem forget_kernelVector (e : ℕ) (j : Fin e) : + forget e (kernelVector (R := R) e j) = DeterminantKernel.kernelVector e j := by + apply Prod.ext + · change -(X ^ ((j : ℕ) + 1)) = -X * X ^ (j : ℕ) + rw [pow_succ, mul_comm, neg_mul] + · rfl + +@[simp] theorem forget_vector (e : ℕ) (j : Fin (e + 2) ⊕ Fin e) : + forget e (vector (R := R) e j) = + Sum.elim (DeterminantKernel.quotientVector e) (DeterminantKernel.kernelVector e) j := by + cases j <;> simp [vector] + +/-- Linear independence holds over a general commutative coefficient ring. -/ +theorem vector_linearIndependent (e : ℕ) : LinearIndependent R (vector (R := R) e) := by + apply LinearIndependent.of_comp (forget e) + simpa only [Function.comp_def, forget_vector] using + DeterminantKernel.adaptedVectors_linearIndependent (R := R) e + +/-- The dimension of the original space of forms is twice `e+1`. -/ +theorem finrank_boundedPair (K : Type*) [Field K] (e : ℕ) : + Module.finrank K (BoundedPair K e) = 2 * (e + 1) := by + have h : Module.finrank K (degreeLT K (e + 1)) = e + 1 := by + simpa using Module.finrank_eq_card_basis (degreeLT.basis K (e + 1)) + rw [Module.finrank_prod, h] + omega + +/-- The fixed simultaneous change of basis used in the determinant degeneration. -/ +def basis (K : Type*) [Field K] (e : ℕ) : + Module.Basis (Fin (e + 2) ⊕ Fin e) K (BoundedPair K e) := + basisOfLinearIndependentOfCardEqFinrank' (vector e) (vector_linearIndependent e) (by + rw [Fintype.card_sum, Fintype.card_fin, Fintype.card_fin, finrank_boundedPair] + omega) + +@[simp] theorem basis_apply (K : Type*) [Field K] (e : ℕ) + (j : Fin (e + 2) ⊕ Fin e) : basis K e j = vector e j := by + rw [basis, coe_basisOfLinearIndependentOfCardEqFinrank'] + +/-- Forgetting degree bounds identifies the finite basis with the explicit +polynomial-pair formulas. -/ +@[simp] theorem forget_basis (K : Type*) [Field K] (e : ℕ) + (j : Fin (e + 2) ⊕ Fin e) : + forget e (basis K e j) = + Sum.elim (DeterminantKernel.quotientVector e) (DeterminantKernel.kernelVector e) j := by + rw [basis_apply, forget_vector] + +end MatrixMultiplication.AuxiliarySeparation.DeterminantBasis + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Determinant/Bounds.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Determinant/Bounds.lean new file mode 100644 index 0000000000000000000000000000000000000000..e00439b7948189d38a94d9a0c38c30ec552ff5f6 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Determinant/Bounds.lean @@ -0,0 +1,181 @@ +import Mathlib.RingTheory.Polynomial.DegreeLT +import Mathlib.Tactic.Ring +import Lean.Elab.Tactic.Omega + +namespace OAI + +/-! +# Degree bounds for the binary determinant relation + +The polynomial identity `A + X * B = 0` forces one extra degree of cancellation: +if `A` has degree less than `e + 1`, then `B` has degree less than `e`. +-/ + +noncomputable section + +namespace MatrixMultiplication.AuxiliarySeparation.DeterminantBounds + +open Polynomial + +variable {R : Type*} [CommRing R] + +/-- A degree bound on the first component of a diagonal relation bounds the +second component by one degree less. -/ +theorem degree_lt_of_diagonal_eq_zero {e : ℕ} {A B : R[X]} + (hA : A.degree < (e + 1 : ℕ)) (h : A + X * B = 0) : + B.degree < e := by + rw [degree_lt_iff_coeff_zero] at hA ⊢ + intro n hn + have hc := congrArg (fun p : R[X] => p.coeff (n + 1)) h + simpa only [coeff_add, coeff_X_mul, hA (n + 1) (by omega), + zero_add, coeff_zero] using hc + +/-- Multiplication by `-X` increases the strict degree bound by at most one. -/ +theorem degree_neg_X_mul_lt {e : ℕ} {q : R[X]} (hq : q.degree < e) : + (-(X * q) : R[X]).degree < (e + 1 : ℕ) := by + rw [degree_lt_iff_coeff_zero] at hq ⊢ + intro n hn + obtain ⟨k, rfl⟩ := Nat.exists_eq_succ_of_ne_zero (by omega : n ≠ 0) + simp only [coeff_neg, Nat.succ_eq_add_one, coeff_X_mul] + exact neg_eq_zero.mpr (hq k (by omega)) + +/-- The determinant generator preserves the two component degree bounds. -/ +theorem determinant_degree_bounds {e : ℕ} {q : R[X]} (hq : q.degree < e) : + (-(X * q) : R[X]).degree < (e + 1 : ℕ) ∧ q.degree < (e + 1 : ℕ) := by + refine ⟨degree_neg_X_mul_lt hq, hq.trans_le ?_⟩ + exact_mod_cast Nat.le_succ e + +/-- Pairs representing forms of bidegree `(e, 1)`. -/ +abbrev BoundedPair (R : Type*) [CommRing R] (e : ℕ) := + degreeLT R (e + 1) × degreeLT R (e + 1) + +/-- Diagonal substitution on the space with the prescribed degree bounds. -/ +def diagonal (e : ℕ) : BoundedPair R e →ₗ[R] R[X] where + toFun p := (p.1 : R[X]) + X * (p.2 : R[X]) + map_add' p q := by simp [mul_add]; ring + map_smul' c p := by simp [smul_eq_C_mul]; ring + +/-- The first component of multiplication by `uw-vs`. -/ +def negativeShift (e : ℕ) : degreeLT R e →ₗ[R] degreeLT R (e + 1) := + ((LinearMap.mulLeft R (-X : R[X])).domRestrict (degreeLT R e)).codRestrict + (degreeLT R (e + 1)) (fun q => mem_degreeLT.mpr <| by + simpa only [LinearMap.domRestrict_apply, LinearMap.mulLeft_apply, neg_mul] using + degree_neg_X_mul_lt (mem_degreeLT.mp q.2)) + +/-- Increase the allowed degree bound by one. -/ +def widen (e : ℕ) : degreeLT R e →ₗ[R] degreeLT R (e + 1) := + Submodule.inclusion (degreeLT_mono (Nat.le_succ e)) + +@[simp] theorem widen_coe (e : ℕ) (q : degreeLT R e) : + (widen e q : R[X]) = (q : R[X]) := + Submodule.coe_inclusion _ q + +/-- Multiplication by `uw-vs` lands in the bounded pair space. -/ +def determinant (e : ℕ) : degreeLT R e →ₗ[R] BoundedPair R e where + toFun q := (negativeShift e q, widen e q) + map_add' p q := Prod.ext (map_add (negativeShift e) p q) (map_add (widen e) p q) + map_smul' c p := Prod.ext (map_smul (negativeShift e) c p) (map_smul (widen e) c p) + +@[simp] theorem diagonal_apply (e : ℕ) (p : BoundedPair R e) : + diagonal e p = (p.1 : R[X]) + X * (p.2 : R[X]) := rfl + +@[simp] theorem determinant_fst (e : ℕ) (q : degreeLT R e) : + ((determinant e q).1 : R[X]) = -X * (q : R[X]) := rfl + +@[simp] theorem determinant_snd (e : ℕ) (q : degreeLT R e) : + ((determinant (R := R) e q).2 : R[X]) = (q : R[X]) := by + change (widen e q : R[X]) = (q : R[X]) + exact widen_coe e q + +@[simp] theorem diagonal_determinant (e : ℕ) (q : degreeLT R e) : + diagonal e (determinant e q) = 0 := by + simp only [diagonal_apply, determinant_fst, determinant_snd, neg_mul, neg_add_cancel] + +/-- The determinant map with codomain restricted to the diagonal kernel. -/ +def toKernel (e : ℕ) : degreeLT R e →ₗ[R] LinearMap.ker (diagonal (R := R) e) := + (determinant (R := R) e).codRestrict _ fun q => diagonal_determinant e q + +@[simp] theorem toKernel_coe (e : ℕ) (q : degreeLT R e) : + (toKernel e q : BoundedPair R e) = determinant e q := rfl + +theorem toKernel_bijective (e : ℕ) : Function.Bijective (toKernel (R := R) e) := by + constructor + · intro p q h + apply Subtype.ext + have hc := congrArg (fun z : LinearMap.ker (diagonal (R := R) e) => + (z.1.2 : R[X])) h + simpa only [toKernel_coe, determinant_snd] using hc + · rintro ⟨p, hp⟩ + let q : degreeLT R e := ⟨(p.2 : R[X]), mem_degreeLT.mpr <| + degree_lt_of_diagonal_eq_zero (mem_degreeLT.mp p.1.2) hp⟩ + refine ⟨q, Subtype.ext ?_⟩ + change determinant (R := R) e q = p + apply Prod.ext + · apply Subtype.ext + rw [determinant_fst] + have h : (p.1 : R[X]) + X * (p.2 : R[X]) = 0 := hp + simpa only [q, neg_mul] using (eq_neg_of_add_eq_zero_left h).symm + · apply Subtype.ext + exact determinant_snd e q + +/-- The bounded determinant kernel has exactly the degree-`< e` polynomials +as its parameters, including at `e = 0`. -/ +def kernelEquiv (e : ℕ) : degreeLT R e ≃ₗ[R] LinearMap.ker (diagonal (R := R) e) := + LinearEquiv.ofBijective (toKernel e) (toKernel_bijective e) + +/-- The finite determinant kernel has dimension `e`. -/ +theorem finrank_kernel (K : Type*) [Field K] (e : ℕ) : + Module.finrank K (LinearMap.ker (diagonal (R := K) e)) = e := by + rw [← (kernelEquiv (R := K) e).finrank_eq] + simpa using Module.finrank_eq_card_basis (degreeLT.basis K e) + +/-- The diagonal has the next larger degree bound. -/ +theorem degree_diagonal_lt (e : ℕ) (p : BoundedPair R e) : + (diagonal e p).degree < (e + 2 : ℕ) := by + change ((p.1 : R[X]) + X * (p.2 : R[X])).degree < ((e + 2 : ℕ) : WithBot ℕ) + refine (degree_add_le _ _).trans_lt (max_lt ?_ ?_) + · refine (mem_degreeLT.mp p.1.2).trans_le ?_ + exact_mod_cast (show e + 1 ≤ e + 2 by omega) + · simpa only [degree_neg, Nat.add_assoc] using + degree_neg_X_mul_lt (mem_degreeLT.mp p.2.2) + +/-- Diagonal substitution with both the domain and codomain degree bounded. -/ +def diagonalToDegreeLT (e : ℕ) : BoundedPair R e →ₗ[R] degreeLT R (e + 2) := + (diagonal e).codRestrict _ fun p => mem_degreeLT.mpr (degree_diagonal_lt e p) + +@[simp] theorem diagonalToDegreeLT_coe (e : ℕ) (p : BoundedPair R e) : + (diagonalToDegreeLT e p : R[X]) = diagonal e p := rfl + +/-- Removing the constant coefficient lowers the strict degree bound by one. -/ +theorem degree_divX_lt {e : ℕ} {p : R[X]} (hp : p.degree < (e + 1 : ℕ)) : + p.divX.degree < e := by + rw [degree_lt_iff_coeff_zero] at hp ⊢ + intro n hn + rw [coeff_divX] + exact hp (n + 1) (by omega) + +/-- Every polynomial of the output degree is a diagonal restriction of a +bounded pair. -/ +theorem diagonalToDegreeLT_surjective (e : ℕ) : + Function.Surjective (diagonalToDegreeLT (R := R) e) := by + intro p + let A : degreeLT R (e + 1) := ⟨C ((p : R[X]).coeff 0), mem_degreeLT.mpr <| + degree_C_lt.trans_le (by exact_mod_cast (show 1 ≤ e + 1 by omega))⟩ + let B : degreeLT R (e + 1) := ⟨(p : R[X]).divX, mem_degreeLT.mpr <| + degree_divX_lt (by simpa only [Nat.add_assoc] using mem_degreeLT.mp p.2)⟩ + refine ⟨(A, B), ?_⟩ + apply Subtype.ext + change C ((p : R[X]).coeff 0) + X * (p : R[X]).divX = (p : R[X]) + simpa only [add_comm] using X_mul_divX_add (p : R[X]) + +@[simp] theorem ker_diagonalToDegreeLT (e : ℕ) : + LinearMap.ker (diagonalToDegreeLT (R := R) e) = LinearMap.ker (diagonal e) := by + ext p + simp only [LinearMap.mem_ker] + exact Subtype.val_inj.symm + +end MatrixMultiplication.AuxiliarySeparation.DeterminantBounds + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Determinant/Character.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Determinant/Character.lean new file mode 100644 index 0000000000000000000000000000000000000000..4c91d291e026482730e61c160fbfc074879c046c --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Determinant/Character.lean @@ -0,0 +1,181 @@ +import OAI.LinearAlgebra.MatrixMultiplication.AuxiliarySeparation.Determinant.Filtration +import OAI.LinearAlgebra.MatrixMultiplication.AuxiliarySeparation.Character.Degeneration +import OAI.LinearAlgebra.MatrixMultiplication.AuxiliarySeparation.Character.Dot +import OAI.LinearAlgebra.MatrixMultiplication.AuxiliarySeparation.Tensor.SupportExtension +import OAI.LinearAlgebra.MatrixMultiplication.AuxiliarySeparation.Tensor.TagInequality +import OAI.LinearAlgebra.MatrixMultiplication.AuxiliarySeparation.Polynomial.Laws +import OAI.LinearAlgebra.MatrixMultiplication.AuxiliarySeparation.Separation.BranchTagging + +namespace OAI + +/-! +# The determinant inequality for an actual tensor character + +The shared-input tag inequality is applied to the two concrete branches of the +checked determinant degeneration. All basis changes and the output-dual change +are supplied by `DeterminantFiltration`. +-/ + +noncomputable section + +open MatrixMultiplication.Foundation +open scoped BigOperators + +namespace MatrixMultiplication.AuxiliarySeparation.DeterminantFiltration + +/-- The two graded blocks, padded with zeros in common coordinate spaces. -/ +def branch (d e : ℕ) (n : Fin 2) : + Tensor ℂ (Fin (d + 1)) (Index e) (Index (d + e)) + | i, .inl j, .inl k => if n = 0 then if i.val + j.val = k.val then 1 else 0 else 0 + | i, .inr j, .inr k => if n = 1 then if i.val + j.val = k.val then 1 else 0 else 0 + | _, _, _ => 0 + +def branchLabel (e : ℕ) : Index e → Fin 2 + | .inl _ => 0 + | .inr _ => 1 + +theorem branch_support (d e : ℕ) (n : Fin 2) (i : Fin (d + 1)) + (j : Index e) (k : Index (d + e)) (h : branch d e n i j k ≠ 0) : + branchLabel e j = n ∧ branchLabel (d + e) k = n := by + fin_cases n <;> rcases j with j | j <;> rcases k with k | k <;> + simp_all [branch, branchLabel] + +theorem sum_branch (d e : ℕ) : (∑ n, branch d e n) = gradedTensor d e := by + funext i j k + rcases j with j | j <;> rcases k with k | k <;> + simp [branch, gradedTensor] + +theorem branch_ne_zero (d e : ℕ) (he : 0 < e) (n : Fin 2) : branch d e n ≠ 0 := by + intro h + fin_cases n + · have hv := congrFun (congrFun (congrFun h ⟨0, by omega⟩) + (.inl ⟨0, by omega⟩)) (.inl ⟨0, by omega⟩) + simp [branch] at hv + · have hv := congrFun (congrFun (congrFun h ⟨0, by omega⟩) + (.inr ⟨0, he⟩)) (.inr ⟨0, by omega⟩) + simp [branch] at hv + +end DeterminantFiltration + +namespace Character + +open DeterminantFiltration + +variable (χ : Character) + +theorem value_determinant_branch_zero (d e : ℕ) : + χ.value (branch d e 0) = χ.value (convolution (d + 1) (e + 2)) := by + let fz : Fin ((d + 1) + (e + 2) - 1) → Index (d + e) := + fun k => .inl (Fin.cast (by omega) k) + have hfz : Function.Injective fz := by + intro a b h + exact Fin.ext (congrArg (fun z : Index (d + e) => + match z with | .inl k => k.val | .inr k => k.val) h) + have hs : ∀ i j k, branch d e 0 i j k ≠ 0 → + i ∈ Set.range (id : Fin (d + 1) → Fin (d + 1)) ∧ + j ∈ Set.range (Sum.inl : Fin (e + 2) → Index e) ∧ k ∈ Set.range fz := by + intro i j k h + rcases j with j | j <;> rcases k with k | k + · exact ⟨⟨i, rfl⟩, ⟨j, rfl⟩, ⟨Fin.cast (by omega) k, by simp [fz]⟩⟩ + all_goals simp [branch] at h + have hv := χ.value_eq_pullback_of_support (branch d e 0) id Sum.inl fz + Function.injective_id Sum.inl_injective hfz hs + have ht : Tensor.pullback id Sum.inl fz (branch d e 0) = + convolution (d + 1) (e + 2) := by + funext i j k + simp [Tensor.pullback, branch, fz, convolution] + simpa only [ht] using hv + +theorem value_determinant_branch_one (d e : ℕ) : + χ.value (branch d e 1) = χ.value (convolution (d + 1) e) := by + let fz : Fin ((d + 1) + e - 1) → Index (d + e) := + fun k => .inr (Fin.cast (by omega) k) + have hfz : Function.Injective fz := by + intro a b h + exact Fin.ext (congrArg (fun z : Index (d + e) => + match z with | .inl k => k.val | .inr k => k.val) h) + have hs : ∀ i j k, branch d e 1 i j k ≠ 0 → + i ∈ Set.range (id : Fin (d + 1) → Fin (d + 1)) ∧ + j ∈ Set.range (Sum.inr : Fin e → Index e) ∧ k ∈ Set.range fz := by + intro i j k h + rcases j with j | j <;> rcases k with k | k + any_goals simp [branch] at h + exact ⟨⟨i, rfl⟩, ⟨j, rfl⟩, ⟨Fin.cast (by omega) k, by simp [fz]⟩⟩ + have hv := χ.value_eq_pullback_of_support (branch d e 1) id Sum.inr fz + Function.injective_id Sum.inr_injective hfz hs + have ht : Tensor.pullback id Sum.inr fz (branch d e 1) = + convolution (d + 1) e := by + funext i j k + simp [Tensor.pullback, branch, fz, convolution] + simpa only [ht] using hv + +private theorem value_bool_dot : + χ.value (Tensor.cyclic (Tensor.cyclic (Tensor.dotPairing (K := ℂ) Bool))) = + (2 : ℝ) ^ χ.pX := by + have hv := χ.value_reindex + (Tensor.cyclic (Tensor.cyclic (Tensor.dotPairing (K := ℂ) Bool))) + (Equiv.refl Unit) finTwoEquiv finTwoEquiv + have ht : Tensor.pullback (Equiv.refl Unit) finTwoEquiv finTwoEquiv + (Tensor.cyclic (Tensor.cyclic (Tensor.dotPairing (K := ℂ) Bool))) = + Tensor.cyclic (Tensor.cyclic (Tensor.dotPairing (K := ℂ) (Fin 2))) := by + funext i j k + simp [Tensor.pullback, Tensor.cyclic, Tensor.dotPairing] + rw [ht] at hv + exact hv.symm.trans (χ.value_cyclic_cyclic_dotPairing (by decide)) + +/-- The auxiliary dot product is charged once, on the actual source tensor. -/ +theorem value_determinant_source_le (d e : ℕ) : + χ.value (sourceTensor d e) ≤ + (2 : ℝ) ^ χ.pX * χ.value (convolution (d + 1) (e + 1)) := by + rw [sourceTensor_product] + apply (χ.value_pullback_le _ _ _ _).trans_eq + rw [χ.map_product, χ.value_bool_dot] + ring + +/-- Actual basis-change and degeneration certificates give this comparison. -/ +theorem value_determinant_graded_le (d e : ℕ) : + χ.value (gradedTensor d e) ≤ + (2 : ℝ) ^ χ.pX * χ.value (convolution (d + 1) (e + 1)) := by + calc + χ.value (gradedTensor d e) ≤ χ.value (adaptedTensor d e) := + χ.value_polynomialRestrictionDegeneration_le (degeneration d e) + _ ≤ χ.value (sourceTensor d e) := by + simpa only [sourceTensor_coordinate_change] using + χ.monotone (sourceTensor d e) (fixedFirst d) (inputChange e) + (outputDualChange (d + e)) + _ ≤ _ := χ.value_determinant_source_le d e + +/-- The binary tag bound before normalizing over all six characters. -/ +theorem convolution_concavity_tag_dims (d e : ℕ) (he : 0 < e) + (q : ℝ) (hq₀ : 0 ≤ q) (hq₁ : q ≤ 1) : + Real.exp (χ.pX * Real.binEntropy q) * + χ.value (convolution (d + 1) (e + 2)) ^ q * + χ.value (convolution (d + 1) e) ^ (1 - q) ≤ + (2 : ℝ) ^ χ.pX * χ.value (convolution (d + 1) (e + 1)) := by + have ht := χ.sharedFirst_tag (binaryLaw q hq₀ hq₁) (branch d e) + (branch_ne_zero d e he) + rw [χ.value_sharedFirstTensor_eq_sum (branch d e) + (branchLabel e) (branchLabel (d + e)) (branch_support d e), sum_branch] at ht + rw [binaryLaw_entropy, binaryLaw_product, + χ.value_determinant_branch_zero, χ.value_determinant_branch_one] at ht + apply le_trans (b := χ.value (gradedTensor d e)) + · simpa only [mul_assoc] using ht + · exact χ.value_determinant_graded_le d e + +/-- The determinant inequality in the paper's positive-dimension notation. -/ +theorem convolution_concavity_tag (a b : ℕ) (ha : 0 < a) (hb : 2 ≤ b) + (q : ℝ) (hq₀ : 0 ≤ q) (hq₁ : q ≤ 1) : + Real.exp (χ.pX * Real.binEntropy q) * + χ.value (convolution a (b + 1)) ^ q * + χ.value (convolution a (b - 1)) ^ (1 - q) ≤ + (2 : ℝ) ^ χ.pX * χ.value (convolution a b) := by + obtain ⟨d, rfl⟩ : ∃ d, a = d + 1 := ⟨a - 1, by omega⟩ + obtain ⟨e, rfl, he⟩ : ∃ e, b = e + 1 ∧ 0 < e := ⟨b - 1, by omega, by omega⟩ + simpa [Nat.add_assoc] using χ.convolution_concavity_tag_dims d e he q hq₀ hq₁ + +end Character +end MatrixMultiplication.AuxiliarySeparation + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Determinant/Filtration.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Determinant/Filtration.lean new file mode 100644 index 0000000000000000000000000000000000000000..cd9427e99fbe9d9dc28dbbe20b4b1a8f1f8ef48c --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Determinant/Filtration.lean @@ -0,0 +1,343 @@ +import OAI.LinearAlgebra.MatrixMultiplication.AuxiliarySeparation.Convolution.Basic +import OAI.LinearAlgebra.MatrixMultiplication.AuxiliarySeparation.Determinant.Kernel +import OAI.LinearAlgebra.MatrixMultiplication.AuxiliarySeparation.Determinant.Basis +import OAI.LinearAlgebra.MatrixMultiplication.Polynomial.ComplexPolynomialDegenerationComposition + +namespace OAI + +/-! +# The finite determinant filtration of polynomial multiplication + +The first leg is kept fixed throughout. The second and third legs use the +explicit quotient/kernel vectors of `DeterminantKernel`. The coefficient +identity `adaptedTensor_reconstruct` verifies the actual multiplication on +every basis input; it does not assume a simultaneous triangularization. +-/ + +noncomputable section + +open scoped BigOperators +open MatrixMultiplication.Foundation Polynomial + +namespace MatrixMultiplication.AuxiliarySeparation.DeterminantFiltration + +abbrev Index (e : ℕ) := Sum (Fin (e + 2)) (Fin e) + +/-- The ordered quotient/kernel vectors in the actual polynomial pair space. -/ +def vector (e : ℕ) : Index e → DeterminantKernel.FormPair ℂ := + Sum.elim (DeterminantKernel.quotientVector e) (DeterminantKernel.kernelVector e) + +/-- All multiplication coefficients in the explicit adapted bases. +Here `a=d+1`, `b=e+1`, and no first-leg change of coordinates occurs. -/ +def adaptedTensor (d e : ℕ) : Tensor ℂ (Fin (d + 1)) (Index e) (Index (d + e)) + | i, .inl j, .inl k => if i.val + j.val = k.val then 1 else 0 + | i, .inl j, .inr k => + if j.val = e + 1 ∧ i.val < d ∧ e + i.val = k.val then 1 else 0 + | _, .inr _, .inl _ => 0 + | i, .inr j, .inr k => if i.val + j.val = k.val then 1 else 0 + +/-- The associated graded tensor, whose two branches still share the first leg. -/ +def gradedTensor (d e : ℕ) : Tensor ℂ (Fin (d + 1)) (Index e) (Index (d + e)) + | i, .inl j, .inl k => if i.val + j.val = k.val then 1 else 0 + | _, .inl _, .inr _ => 0 + | _, .inr _, .inl _ => 0 + | i, .inr j, .inr k => if i.val + j.val = k.val then 1 else 0 + +private theorem sum_coordinate {n r : ℕ} (hr : r < n) + (v : Fin n → DeterminantKernel.FormPair ℂ) : + (∑ k : Fin n, (if r = k.val then (1 : ℂ) else 0) • v k) = v ⟨r, hr⟩ := by + have h (k : Fin n) : r = k.val ↔ k = ⟨r, hr⟩ := by + constructor + · intro hk + apply Fin.ext + exact hk.symm + · intro hk + exact congrArg Fin.val hk.symm + simp_rw [h] + simp + +/-- Exact coordinate reconstruction of every first-leg slice, in common bases. -/ +theorem adaptedTensor_reconstruct (d e : ℕ) (i : Fin (d + 1)) (j : Index e) : + (∑ k : Index (d + e), adaptedTensor d e i j k • vector (d + e) k) = + DeterminantKernel.multiply (X ^ i.val) (vector e j) := by + have hi : i.val ≤ d := by omega + rcases j with j | j + · by_cases hj : j.val ≤ e + · have hn : j.val ≠ e + 1 := by omega + simp only [Fintype.sum_sum_type, adaptedTensor, vector, Sum.elim_inl, + Sum.elim_inr, hn, false_and, ↓reduceIte, zero_smul, Finset.sum_const_zero, + add_zero] + rw [sum_coordinate (by omega)] + exact (DeterminantKernel.multiply_quotientVector_ordinary d e i.val j.val hi hj).symm + · have hj' : j.val = e + 1 := by omega + have hjfin : j = ⟨e + 1, by omega⟩ := Fin.ext hj' + rw [hjfin] + by_cases hi' : i.val < d + · simp only [Fintype.sum_sum_type, adaptedTensor, vector, Sum.elim_inl, + Sum.elim_inr, hi', true_and] + rw [sum_coordinate (by omega), sum_coordinate (by omega)] + have h := DeterminantKernel.multiply_quotientVector_top_cross + (R := ℂ) d e i.val hi' + simpa only [Nat.add_assoc, Nat.add_comm, Nat.add_left_comm] using h.symm + · have hi'' : i.val = d := by omega + simp only [Fintype.sum_sum_type, adaptedTensor, vector, Sum.elim_inl, + Sum.elim_inr, hi', and_false, false_and, ↓reduceIte, zero_smul, + Finset.sum_const_zero, add_zero] + rw [sum_coordinate (by omega)] + have h := DeterminantKernel.multiply_quotientVector_top_last (R := ℂ) d e + simpa only [hi'', Nat.add_assoc, Nat.add_comm, Nat.add_left_comm] using h.symm + · simp only [Fintype.sum_sum_type, adaptedTensor, vector, Sum.elim_inl, + Sum.elim_inr, zero_smul, Finset.sum_const_zero, zero_add] + rw [sum_coordinate (by omega)] + exact (DeterminantKernel.multiply_kernelVector d e i.val j.val hi j.isLt).symm + +/-- The reconstruction uniquely determines every tensor coefficient. -/ +theorem adaptedTensor_unique (d e : ℕ) + (T : Tensor ℂ (Fin (d + 1)) (Index e) (Index (d + e))) + (hT : ∀ i j, (∑ k, T i j k • vector (d + e) k) = + DeterminantKernel.multiply (X ^ i.val) (vector e j)) : + T = adaptedTensor d e := by + funext i j k + have h := (DeterminantKernel.adaptedVectors_linearIndependent (R := ℂ) (d + e)) + have hs : ∑ z, (T i j z - adaptedTensor d e i j z) • vector (d + e) z = 0 := by + simp_rw [sub_smul] + rw [Finset.sum_sub_distrib, hT, adaptedTensor_reconstruct, sub_self] + exact sub_eq_zero.mp ((Fintype.linearIndependent_iff.mp h) _ hs k) + +/-- The quotient branch is exactly `C(a,b+1)`. -/ +theorem gradedTensor_quotient (d e : ℕ) (i : Fin (d + 1)) + (j : Fin (e + 2)) (k : Fin (d + e + 2)) : + gradedTensor d e i (.inl j) (.inl k) = + convolution (d + 1) (e + 2) i j (Fin.cast (by omega) k) := by + simp only [gradedTensor, convolution, Fin.val_cast] + +/-- The kernel branch is exactly `C(a,b-1)`. -/ +theorem gradedTensor_kernel (d e : ℕ) (i : Fin (d + 1)) + (j : Fin e) (k : Fin (d + e)) : + gradedTensor d e i (.inr j) (.inr k) = + convolution (d + 1) e i j (Fin.cast (by omega) k) := by + simp only [gradedTensor, convolution, Fin.val_cast] + +@[simp] theorem adaptedTensor_kernel_to_quotient (d e : ℕ) + (i : Fin (d + 1)) (j : Fin e) (k : Fin (d + e + 2)) : + adaptedTensor d e i (.inr j) (.inl k) = 0 := rfl + +/-- Polynomial diagonal maps; scaling the quotient input by `X` clears +the negative input-kernel weight without changing the leading tensor. -/ +def inputScale (e : ℕ) : Index e → ℂ[X] + | .inl _ => X + | .inr _ => 1 + +def outputScale (e : ℕ) : Index e → ℂ[X] + | .inl _ => 1 + | .inr _ => X + +def diagonalMap {I : Type*} [DecidableEq I] (s : I → ℂ[X]) : I → I → ℂ[X] := + fun i j => if i = j then s i else 0 + +private theorem restrict_diagonal {I J K : Type*} + [Fintype I] [Fintype J] [Fintype K] + [DecidableEq I] [DecidableEq J] [DecidableEq K] + (a : I → ℂ[X]) (b : J → ℂ[X]) (c : K → ℂ[X]) + (T : Tensor ℂ[X] I J K) (i : I) (j : J) (k : K) : + Tensor.restrict (diagonalMap a) (diagonalMap b) (diagonalMap c) T i j k = + a i * b j * c k * T i j k := by + simp [Tensor.restrict, diagonalMap, ite_mul, mul_ite] + +/-- A checked polynomial degeneration to the two matched convolution branches. -/ +def degeneration (d e : ℕ) : + Tensor.PolynomialRestrictionDegeneration (adaptedTensor d e) + (gradedTensor d e) 1 0 1 1 where + leftMap := diagonalMap (fun _ => 1) + middleMap := diagonalMap (inputScale e) + rightMap := diagonalMap (outputScale (d + e)) + left_degree := by + intro i j + simp only [diagonalMap] + split_ifs <;> simp + middle_degree := by + intro i j + simp only [diagonalMap] + split_ifs + · cases i <;> simp [inputScale] + · simp + right_degree := by + intro i j + simp only [diagonalMap] + split_ifs + · cases i <;> simp [outputScale] + · simp + vanishes := by + intro i j k n hn + have hn' : n = 0 := by omega + rw [restrict_diagonal] + rcases j with j | j <;> rcases k with k | k + all_goals simp only [inputScale, outputScale, adaptedTensor, one_mul] + all_goals (try split_ifs) <;> simp [hn', ← pow_two] + leading := by + intro i j k + rw [restrict_diagonal] + rcases j with j | j <;> rcases k with k | k + all_goals simp only [inputScale, outputScale, adaptedTensor, gradedTensor, one_mul] + all_goals (try split_ifs) <;> simp [← pow_two] + +/-! The actual coordinate change from the original two-copy convolution. -/ + +abbrev OriginalIndex (e : ℕ) := Sum (Fin (e + 1)) (Fin (e + 1)) + +/-- The original monomial bases in the `s` and `w` components. -/ +def originalBasis (e : ℕ) : + Module.Basis (OriginalIndex e) ℂ (DeterminantBasis.BoundedPair ℂ e) := + (Polynomial.degreeLT.basis ℂ (e + 1)).prod (Polynomial.degreeLT.basis ℂ (e + 1)) + +private theorem degree_shift_lt (d e : ℕ) (i : Fin (d + 1)) + (p : Polynomial.degreeLT ℂ (e + 1)) : + ((X : ℂ[X]) ^ i.val * (p : ℂ[X])).degree < (d + e + 1 : ℕ) := by + rw [Polynomial.degree_lt_iff_coeff_zero] + intro n hn + rw [Polynomial.coeff_X_pow_mul'] + split_ifs with h + · have hp := Polynomial.mem_degreeLT.mp p.2 + rw [Polynomial.degree_lt_iff_coeff_zero] at hp + exact hp (n - i.val) (by have hi := i.isLt; omega) + · rfl + +/-- Multiplication by a fixed first-input monomial between the bounded spaces. -/ +def boundedShift (d e : ℕ) (i : Fin (d + 1)) : + Polynomial.degreeLT ℂ (e + 1) →ₗ[ℂ] Polynomial.degreeLT ℂ (d + e + 1) where + toFun p := ⟨X ^ i.val * (p : ℂ[X]), Polynomial.mem_degreeLT.mpr (degree_shift_lt d e i p)⟩ + map_add' p q := by apply Subtype.ext; simp [mul_add] + map_smul' c p := by apply Subtype.ext; simp [Polynomial.smul_eq_C_mul]; ring + +/-- The same first monomial multiplies both components. -/ +def boundedMultiply (d e : ℕ) (i : Fin (d + 1)) : + DeterminantBasis.BoundedPair ℂ e →ₗ[ℂ] DeterminantBasis.BoundedPair ℂ (d + e) := + (boundedShift d e i).prodMap (boundedShift d e i) + +@[simp] theorem forget_boundedMultiply (d e : ℕ) (i : Fin (d + 1)) + (p : DeterminantBasis.BoundedPair ℂ e) : + DeterminantBasis.forget (d + e) (boundedMultiply d e i p) = + DeterminantKernel.multiply (X ^ i.val) (DeterminantBasis.forget e p) := rfl + +/-- Polynomial multiplication in its original monomial coordinates. -/ +def sourceTensor (d e : ℕ) : + Tensor ℂ (Fin (d + 1)) (OriginalIndex e) (OriginalIndex (d + e)) := + fun i j k => (originalBasis (d + e)).repr + (boundedMultiply d e i (originalBasis e j)) k + +@[simp] theorem sourceTensor_inl_inl (d e : ℕ) (i : Fin (d + 1)) + (j : Fin (e + 1)) (k : Fin (d + e + 1)) : + sourceTensor d e i (.inl j) (.inl k) = + convolution (d + 1) (e + 1) i j (Fin.cast (by omega) k) := by + simp [sourceTensor, originalBasis, boundedMultiply, boundedShift, + ← pow_add, convolution, eq_comm] + +@[simp] theorem sourceTensor_inr_inr (d e : ℕ) (i : Fin (d + 1)) + (j : Fin (e + 1)) (k : Fin (d + e + 1)) : + sourceTensor d e i (.inr j) (.inr k) = + convolution (d + 1) (e + 1) i j (Fin.cast (by omega) k) := by + simp [sourceTensor, originalBasis, boundedMultiply, boundedShift, + ← pow_add, convolution, eq_comm] + +@[simp] theorem sourceTensor_inl_inr (d e : ℕ) (i : Fin (d + 1)) + (j : Fin (e + 1)) (k : Fin (d + e + 1)) : + sourceTensor d e i (.inl j) (.inr k) = 0 := by + simp [sourceTensor, originalBasis, boundedMultiply, boundedShift] + +@[simp] theorem sourceTensor_inr_inl (d e : ℕ) (i : Fin (d + 1)) + (j : Fin (e + 1)) (k : Fin (d + e + 1)) : + sourceTensor d e i (.inr j) (.inl k) = 0 := by + simp [sourceTensor, originalBasis, boundedMultiply, boundedShift] + +/-- Record the polynomial coordinate and the choice of `s` or `w` separately. -/ +def originalCoordinate (e : ℕ) : OriginalIndex e → Fin (e + 1) × Bool + | .inl j => (j, false) + | .inr j => (j, true) + +/-- The source is exactly polynomial convolution tensored with a two-coordinate +dot product whose singleton is on the unchanged first leg. -/ +theorem sourceTensor_product (d e : ℕ) : + sourceTensor d e = + Tensor.pullback (fun i : Fin (d + 1) => (i, ())) (originalCoordinate e) + (fun k => (Fin.cast (by omega) (originalCoordinate (d + e) k).1, + (originalCoordinate (d + e) k).2)) + (Tensor.product (convolution (d + 1) (e + 1)) + (Tensor.cyclic (Tensor.cyclic (Tensor.dotPairing (K := ℂ) Bool)))) := by + funext i j k + rcases j with j | j <;> rcases k with k | k <;> + simp [Tensor.pullback, Tensor.product, Tensor.cyclic, Tensor.dotPairing, + originalCoordinate] + +/-- The input matrix has adapted vectors as columns in the original basis. -/ +def inputChange (e : ℕ) (j : Index e) (old : OriginalIndex e) : ℂ := + (originalBasis e).repr (DeterminantBasis.basis ℂ e j) old + +/-- The output-dual matrix uses the inverse basis change, as required for tensors. -/ +def outputDualChange (e : ℕ) (k : Index e) (old : OriginalIndex e) : ℂ := + (DeterminantBasis.basis ℂ e).repr (originalBasis e old) k + +/-- The first input is unchanged, including throughout the basis change. -/ +def fixedFirst (d : ℕ) (i j : Fin (d + 1)) : ℂ := if i = j then 1 else 0 + +private theorem restrict_fixedFirst (d e : ℕ) + (B : Index e → OriginalIndex e → ℂ) + (C : Index (d + e) → OriginalIndex (d + e) → ℂ) + (T : Tensor ℂ (Fin (d + 1)) (OriginalIndex e) (OriginalIndex (d + e))) + (i : Fin (d + 1)) (j : Index e) (k : Index (d + e)) : + Tensor.restrict (fixedFirst d) B C T i j k = + ∑ y, ∑ z, B j y * C k z * T i y z := by + simp [Tensor.restrict, fixedFirst, ite_mul] + +theorem boundedMultiply_adapted_coordinates (d e : ℕ) (i : Fin (d + 1)) + (j : Index e) (k : Index (d + e)) : + (DeterminantBasis.basis ℂ (d + e)).repr + (boundedMultiply d e i (DeterminantBasis.basis ℂ e j)) k = + adaptedTensor d e i j k := by + have h := adaptedTensor_unique d e + (fun i j k => (DeterminantBasis.basis ℂ (d + e)).repr + (boundedMultiply d e i (DeterminantBasis.basis ℂ e j)) k) ?_ + · exact congrFun (congrFun (congrFun h i) j) k + · intro i j + have hsum := congrArg (DeterminantBasis.forget (R := ℂ) (d + e)) + ((DeterminantBasis.basis ℂ (d + e)).sum_repr + (boundedMultiply d e i (DeterminantBasis.basis ℂ e j))) + simpa only [map_sum, map_smul, DeterminantBasis.forget_basis, + forget_boundedMultiply, vector] using hsum + +/-- A concrete restriction, with the identity first map, changes the original +two-copy convolution into the simultaneously triangular coefficient tensor. -/ +theorem sourceTensor_coordinate_change (d e : ℕ) : + Tensor.restrict (fixedFirst d) (inputChange e) (outputDualChange (d + e)) + (sourceTensor d e) = adaptedTensor d e := by + funext i j k + rw [restrict_fixedFirst] + simp only [inputChange, outputDualChange, sourceTensor] + calc + (∑ y, ∑ z, + (originalBasis e).repr (DeterminantBasis.basis ℂ e j) y * + (DeterminantBasis.basis ℂ (d + e)).repr (originalBasis (d + e) z) k * + (originalBasis (d + e)).repr (boundedMultiply d e i (originalBasis e y)) z) = + ∑ y, (originalBasis e).repr (DeterminantBasis.basis ℂ e j) y * + (DeterminantBasis.basis ℂ (d + e)).repr + (boundedMultiply d e i (originalBasis e y)) k := by + apply Finset.sum_congr rfl + intro y hy + simp only [mul_assoc] + rw [← Finset.mul_sum] + congr 1 + exact (DeterminantBasis.basis ℂ (d + e)).sum_repr_mul_repr + (originalBasis (d + e)) _ k + _ = (DeterminantBasis.basis ℂ (d + e)).repr + (boundedMultiply d e i (DeterminantBasis.basis ℂ e j)) k := by + have hsum := congrArg (fun p => (DeterminantBasis.basis ℂ (d + e)).repr + (boundedMultiply d e i p) k) + ((originalBasis e).sum_repr (DeterminantBasis.basis ℂ e j)) + simpa only [map_sum, map_smul, Finset.sum_apply', Finsupp.smul_apply, + smul_eq_mul] using hsum + _ = adaptedTensor d e i j k := boundedMultiply_adapted_coordinates d e i j k + +end MatrixMultiplication.AuxiliarySeparation.DeterminantFiltration + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Determinant/Kernel.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Determinant/Kernel.lean new file mode 100644 index 0000000000000000000000000000000000000000..09e1bfa0558f579d365beb7f33d562c2e34949e9 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Determinant/Kernel.lean @@ -0,0 +1,286 @@ +import Mathlib.RingTheory.Polynomial.DegreeLT +import Mathlib.Tactic + +namespace OAI + +/-! +# The determinant kernel of diagonal substitution + +A form `A(u,v)s + B(u,v)w` of bidegree `(e,1)` is represented on the affine chart +`u = 1` by the polynomial pair `(A(1,X), B(1,X))`. Diagonal substitution becomes +`(A,B) ↦ A + X * B`, and multiplication by `uw - vs` becomes +`p ↦ (-X * p, p)`. + +The identities here hold over every commutative ring. They include the fixed +quotient/kernel coordinates and the monomial identities underlying the +simultaneous triangularization in Section 5.1 of *Matrix Multiplication via +Auxiliary Separation and Polynomial Multiplication*. +-/ + +noncomputable section + +namespace MatrixMultiplication.AuxiliarySeparation.DeterminantKernel + +open Polynomial + +variable {R : Type*} [CommRing R] + +/-- Affine representatives of forms linear in the second pair of variables. -/ +abbrev FormPair (R : Type*) [CommRing R] := R[X] × R[X] + +/-- Substitute the first variable pair into the second variable pair. -/ +def diagonal : FormPair R →ₗ[R] R[X] where + toFun p := p.1 + X * p.2 + map_add' p q := by simp only [Prod.fst_add, Prod.snd_add, mul_add]; ring + map_smul' c p := by simp [smul_eq_C_mul]; ring + +/-- Multiplication by `D = uw - vs` after putting `u = 1`. -/ +def determinant : R[X] →ₗ[R] FormPair R where + toFun p := (-X * p, p) + map_add' p q := by apply Prod.ext <;> simp [mul_add] + map_smul' c p := by + apply Prod.ext <;> simp [smul_eq_C_mul] + ring + +@[simp] theorem diagonal_apply (p : FormPair R) : diagonal p = p.1 + X * p.2 := rfl + +@[simp] theorem determinant_apply (p : R[X]) : determinant p = (-X * p, p) := rfl + +@[simp] theorem diagonal_determinant (p : R[X]) : diagonal (determinant p) = 0 := by + simp [diagonal, determinant] + +/-- The determinant factor can be recovered from the second component. -/ +theorem determinant_injective : Function.Injective (determinant (R := R)) := by + intro p q h + exact congrArg Prod.snd h + +/-- Vanishing after diagonal substitution is exactly divisibility by `uw - vs`. -/ +theorem diagonal_eq_zero_iff (p : FormPair R) : + diagonal p = 0 ↔ p = determinant p.2 := by + constructor + · intro h + apply Prod.ext + · change p.1 = -X * p.2 + have h' : p.1 + X * p.2 = 0 := h + linear_combination h' + · rfl + · intro h + rw [h] + exact diagonal_determinant _ + +/-- The kernel parametrization does not require any field or domain hypothesis. -/ +theorem mem_kernel_iff (p : FormPair R) : + p ∈ LinearMap.ker diagonal ↔ ∃ q, determinant q = p := by + rw [LinearMap.mem_ker, diagonal_eq_zero_iff] + constructor + · intro h + exact ⟨p.2, h.symm⟩ + · rintro ⟨q, rfl⟩ + rfl + +theorem kernel_eq_range : LinearMap.ker (diagonal (R := R)) = LinearMap.range determinant := by + ext p + exact mem_kernel_iff p + +/-- A fixed linear complement to the determinant kernel on unrestricted polynomials. -/ +def split : (R[X] × R[X]) ≃ₗ[R] FormPair R where + toFun p := (p.1 - X * p.2, p.2) + invFun p := (p.1 + X * p.2, p.2) + left_inv p := by apply Prod.ext <;> simp + right_inv p := by apply Prod.ext <;> simp + map_add' p q := by + apply Prod.ext <;> simp + ring + map_smul' c p := by + apply Prod.ext <;> simp [smul_eq_C_mul] + ring + +@[simp] theorem split_apply (p : R[X] × R[X]) : split p = (p.1 - X * p.2, p.2) := rfl + +@[simp] theorem split_symm_apply (p : FormPair R) : split.symm p = (diagonal p, p.2) := rfl + +@[simp] theorem diagonal_split (p : R[X] × R[X]) : diagonal (split p) = p.1 := by + simp [split, diagonal] + +@[simp] theorem split_zero_left (q : R[X]) : split (0, q) = determinant q := by + simp [split, determinant] + +theorem diagonal_surjective : Function.Surjective (diagonal (R := R)) := by + intro p + exact ⟨(p, 0), by simp⟩ + +/-- The kernel is canonically isomorphic to one polynomial copy. -/ +def kernelEquiv : R[X] ≃ₗ[R] LinearMap.ker (diagonal (R := R)) where + toFun p := ⟨determinant p, by simp⟩ + invFun p := p.1.2 + left_inv p := rfl + right_inv p := by + apply Subtype.ext + exact ((diagonal_eq_zero_iff p.1).mp p.2).symm + map_add' p q := by apply Subtype.ext; exact map_add determinant p q + map_smul' c p := by apply Subtype.ext; exact map_smul determinant c p + +/-- Multiply both coefficients by a first-input polynomial. -/ +def multiply (f : R[X]) : FormPair R →ₗ[R] FormPair R where + toFun p := (f * p.1, f * p.2) + map_add' p q := by apply Prod.ext <;> simp [mul_add] + map_smul' c p := by apply Prod.ext <;> simp [smul_eq_C_mul] <;> ring + +@[simp] theorem multiply_apply (f : R[X]) (p : FormPair R) : + multiply f p = (f * p.1, f * p.2) := rfl + +/-- The quotient action is ordinary polynomial multiplication. -/ +theorem diagonal_multiply (f : R[X]) (p : FormPair R) : + diagonal (multiply f p) = f * diagonal p := by + simp [diagonal, multiply] + ring + +/-- The kernel action is ordinary polynomial multiplication with the same first input. -/ +theorem multiply_determinant (f p : R[X]) : + multiply f (determinant p) = determinant (f * p) := by + apply Prod.ext <;> simp [multiply, determinant] + ring + +/-- Every first-input slice preserves the determinant kernel. -/ +theorem multiply_mem_kernel (f : R[X]) {p : FormPair R} + (hp : p ∈ LinearMap.ker diagonal) : multiply f p ∈ LinearMap.ker diagonal := by + rw [LinearMap.mem_ker, diagonal_multiply, LinearMap.mem_ker.mp hp, mul_zero] + +/-- Quotient and kernel coordinates transform simultaneously, with an unchanged first input. -/ +theorem split_multiply (f : R[X]) (p : R[X] × R[X]) : + multiply f (split p) = split (f * p.1, f * p.2) := by + apply Prod.ext <;> simp [multiply, split] + ring + +/-- The ordinary quotient monomial `u^(e-j) v^j s`, with `j ≤ e`. -/ +def quotientMonomial (j : ℕ) : FormPair R := (X ^ j, 0) + +/-- The last quotient monomial `v^e w`. -/ +def quotientTop (e : ℕ) : FormPair R := (0, X ^ e) + +/-- The kernel monomial `(uw-vs) u^(e-1-j) v^j`, with `j < e`. -/ +def kernelMonomial (j : ℕ) : FormPair R := determinant (X ^ j) + +@[simp] theorem diagonal_quotientMonomial (j : ℕ) : + diagonal (quotientMonomial (R := R) j) = X ^ j := by + simp [diagonal, quotientMonomial] + +@[simp] theorem diagonal_quotientTop (e : ℕ) : + diagonal (quotientTop (R := R) e) = X ^ (e + 1) := by + simp [diagonal, quotientTop, pow_succ, mul_comm] + +@[simp] theorem diagonal_kernelMonomial (j : ℕ) : + diagonal (kernelMonomial (R := R) j) = 0 := by + simp [kernelMonomial] + +@[simp] theorem multiply_quotientMonomial (i j : ℕ) : + multiply (X ^ i) (quotientMonomial (R := R) j) = quotientMonomial (i + j) := by + apply Prod.ext <;> simp [multiply, quotientMonomial, pow_add] + +@[simp] theorem multiply_kernelMonomial (i j : ℕ) : + multiply (X ^ i) (kernelMonomial (R := R) j) = kernelMonomial (i + j) := by + rw [kernelMonomial, multiply_determinant, ← pow_add, kernelMonomial] + +/-- The sole cross term in a nonfinal first-input slice has coefficient one. -/ +theorem multiply_quotientTop_cross (i e : ℕ) : + multiply (X ^ i) (quotientTop (R := R) e) = + quotientMonomial (i + e + 1) + kernelMonomial (i + e) := by + apply Prod.ext <;> simp [multiply, quotientTop, quotientMonomial, kernelMonomial, determinant, + pow_add, pow_succ] + ring + +/-- For the final first-input monomial the last quotient vector remains the last vector. -/ +theorem multiply_quotientTop_last (d e : ℕ) : + multiply (X ^ d) (quotientTop (R := R) e) = quotientTop (d + e) := by + apply Prod.ext <;> simp [multiply, quotientTop, pow_add] + +/-- The actual quotient vectors used at degree `e`: there are `e + 2` of them. -/ +def quotientVector (e : ℕ) (j : Fin (e + 2)) : FormPair R := + if (j : ℕ) < e + 1 then quotientMonomial j else quotientTop e + +/-- The actual kernel vectors used at degree `e`: there are `e` of them. -/ +def kernelVector (_e : ℕ) (j : Fin _e) : FormPair R := kernelMonomial j + +@[simp] theorem diagonal_quotientVector (e : ℕ) (j : Fin (e + 2)) : + diagonal (quotientVector (R := R) e j) = X ^ (j : ℕ) := by + unfold quotientVector + split_ifs with h + · exact diagonal_quotientMonomial j + · have hj : (j : ℕ) = e + 1 := by omega + simpa [hj] using diagonal_quotientTop (R := R) e + +@[simp] theorem diagonal_kernelVector (e : ℕ) (j : Fin e) : + diagonal (kernelVector (R := R) e j) = 0 := by + exact diagonal_kernelMonomial j + +/-- Ordinary quotient columns have no kernel correction in the adapted output basis. -/ +theorem multiply_quotientVector_ordinary (d e i j : ℕ) + (hi : i ≤ d) (hj : j ≤ e) : + multiply (X ^ i) (quotientVector (R := R) e ⟨j, by omega⟩) = + quotientVector (d + e) ⟨i + j, by omega⟩ := by + simp only [quotientVector, show j < e + 1 by omega, + show i + j < d + e + 1 by omega, ↓reduceIte] + exact multiply_quotientMonomial i j + +/-- Nonfinal slices have exactly the quotient-top cross term described in Section 5.1. -/ +theorem multiply_quotientVector_top_cross (d e i : ℕ) (hi : i < d) : + multiply (X ^ i) (quotientVector (R := R) e ⟨e + 1, by omega⟩) = + quotientVector (d + e) ⟨e + 1 + i, by omega⟩ + + kernelVector (d + e) ⟨e + i, by omega⟩ := by + simp only [quotientVector, lt_self_iff_false, ↓reduceIte, + show e + 1 + i < d + e + 1 by omega, kernelVector] + simpa only [Nat.add_comm, Nat.add_left_comm, Nat.add_assoc] using + multiply_quotientTop_cross (R := R) i e + +/-- The final slice has no cross term. -/ +theorem multiply_quotientVector_top_last (d e : ℕ) : + multiply (X ^ d) (quotientVector (R := R) e ⟨e + 1, by omega⟩) = + quotientVector (d + e) ⟨d + e + 1, by omega⟩ := by + simp only [quotientVector, lt_self_iff_false, ↓reduceIte] + exact multiply_quotientTop_last d e + +/-- All kernel columns have the convolution indices of the smaller branch. -/ +theorem multiply_kernelVector (d e i j : ℕ) (hi : i ≤ d) (hj : j < e) : + multiply (X ^ i) (kernelVector (R := R) e ⟨j, hj⟩) = + kernelVector (d + e) ⟨i + j, by omega⟩ := by + exact multiply_kernelMonomial i j + + +/-- Distinct bounded powers of `X` are independent even when the coefficient ring +has zero divisors. -/ +theorem monomials_linearIndependent (n : ℕ) : + LinearIndependent R (fun i : Fin n => (X : R[X]) ^ (i : ℕ)) := by + have h := (Polynomial.degreeLT.basis R n).linearIndependent.map' + (Polynomial.degreeLT R n).subtype + (LinearMap.ker_eq_bot.mpr Subtype.val_injective) + simpa only [Function.comp_def, Submodule.subtype_apply, Polynomial.degreeLT.basis_val] using h + +/-- The quotient vectors followed by the kernel vectors are linearly independent. +This establishes nonsingularity of the simultaneous change of coordinates, +without any genericity assumption on the first input. -/ +theorem adaptedVectors_linearIndependent (e : ℕ) : + LinearIndependent R (Sum.elim (quotientVector (R := R) e) (kernelVector e)) := by + classical + rw [Fintype.linearIndependent_iff] + intro c hc + have hq : ∑ i : Fin (e + 2), c (Sum.inl i) • (X : R[X]) ^ (i : ℕ) = 0 := by + have h := congrArg (diagonal (R := R)) hc + simpa only [Fintype.sum_sum_type, map_add, map_sum, map_smul, + Sum.elim_inl, Sum.elim_inr, diagonal_quotientVector, diagonal_kernelVector, + smul_zero, Finset.sum_const_zero, add_zero, map_zero] using h + have cq : ∀ i : Fin (e + 2), c (Sum.inl i) = 0 := + (Fintype.linearIndependent_iff.mp (monomials_linearIndependent (R := R) (e + 2))) _ hq + have hk : ∑ i : Fin e, c (Sum.inr i) • (X : R[X]) ^ (i : ℕ) = 0 := by + have h := congrArg Prod.snd hc + simpa only [Fintype.sum_sum_type, Prod.snd_add, Prod.snd_sum, Prod.snd_smul, + Sum.elim_inl, Sum.elim_inr, cq, zero_smul, Finset.sum_const_zero, zero_add, + kernelVector, kernelMonomial, determinant_apply, Prod.snd_zero, Prod.smul_mk] using h + have ck : ∀ i : Fin e, c (Sum.inr i) = 0 := + (Fintype.linearIndependent_iff.mp (monomials_linearIndependent (R := R) e)) _ hk + exact Sum.rec cq ck + +end MatrixMultiplication.AuxiliarySeparation.DeterminantKernel + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Entropy/Optimization.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Entropy/Optimization.lean new file mode 100644 index 0000000000000000000000000000000000000000..821c3a11019cc521eb77ac04551c36cf0c623ec3 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Entropy/Optimization.lean @@ -0,0 +1,95 @@ +import Mathlib.Algebra.BigOperators.Field +import Mathlib.Analysis.SpecialFunctions.BinaryEntropy +import Mathlib.Analysis.SpecialFunctions.Pow.Real +import Mathlib.Tactic.FieldSimp +import Mathlib.Tactic.Ring + +namespace OAI + +/-! +# Entropy optimization for finitely many sectors + +The normalized weights `q = A / (A + B)` and `1 - q = B / (A + B)` +make the entropy-weighted geometric mean equal to `A + B`. This is the +scalar identity used in Section 5.1 of the auxiliary-separation argument. +The same calculation also applies to an arbitrary nonempty finite family. +-/ + +open scoped BigOperators + +namespace MatrixMultiplication.AuxiliarySeparation + +/-- The logarithmic form of the entropy identity at the normalized weights. -/ +theorem binary_entropy_log_partition {A B : ℝ} (hA : 0 < A) (hB : 0 < B) : + Real.binEntropy (A / (A + B)) + + Real.log A * (A / (A + B)) + + Real.log B * (1 - A / (A + B)) = Real.log (A + B) := by + have hsum : A + B ≠ 0 := ne_of_gt (add_pos hA hB) + have hcomplement : 1 - A / (A + B) = B / (A + B) := by + field_simp + ring + rw [Real.binEntropy, hcomplement, Real.log_inv, Real.log_inv, + Real.log_div hA.ne' hsum, Real.log_div hB.ne' hsum] + field_simp + ring + +/-- Entropy compensates the weighted geometric mean at the normalized weights. -/ +theorem binary_entropy_variational_identity {A B : ℝ} (hA : 0 < A) (hB : 0 < B) : + Real.exp (Real.binEntropy (A / (A + B))) * + A ^ (A / (A + B)) * B ^ (1 - A / (A + B)) = A + B := by + rw [Real.rpow_def_of_pos hA, Real.rpow_def_of_pos hB, + ← Real.exp_add, ← Real.exp_add, binary_entropy_log_partition hA hB, + Real.exp_log (add_pos hA hB)] + +/-- The identity with an explicitly named optimizing proportion. -/ +theorem binary_entropy_variational_identity_of_ratio {A B q : ℝ} + (hA : 0 < A) (hB : 0 < B) (hq : q = A / (A + B)) : + Real.exp (-q * Real.log q - (1 - q) * Real.log (1 - q)) * + A ^ q * B ^ (1 - q) = A + B := by + subst q + have hentropy : + -(A / (A + B)) * Real.log (A / (A + B)) - + (1 - A / (A + B)) * Real.log (1 - A / (A + B)) = + Real.binEntropy (A / (A + B)) := by + simp only [Real.binEntropy, Real.log_inv] + ring + rw [hentropy] + exact binary_entropy_variational_identity hA hB + +/-- The logarithmic entropy identity for positive weights on a finite set. -/ +theorem finite_entropy_log_partition {ι : Type*} (s : Finset ι) (A : ι → ℝ) + (hs : s.Nonempty) (hA : ∀ i ∈ s, 0 < A i) : + -(∑ i ∈ s, (A i / (∑ j ∈ s, A j)) * Real.log (A i / (∑ j ∈ s, A j))) + + (∑ i ∈ s, Real.log (A i) * (A i / (∑ j ∈ s, A j))) = + Real.log (∑ j ∈ s, A j) := by + have hsum : 0 < ∑ j ∈ s, A j := Finset.sum_pos hA hs + calc + _ = ∑ i ∈ s, (A i / (∑ j ∈ s, A j)) * Real.log (∑ j ∈ s, A j) := by + rw [← Finset.sum_neg_distrib, ← Finset.sum_add_distrib] + apply Finset.sum_congr rfl + intro i hi + rw [Real.log_div (hA i hi).ne' hsum.ne'] + ring + _ = (∑ i ∈ s, A i / (∑ j ∈ s, A j)) * Real.log (∑ j ∈ s, A j) := by + rw [Finset.sum_mul] + _ = _ := by rw [← Finset.sum_div, div_self hsum.ne', one_mul] + +/-- Normalizing any positive finite family attains its sum in the entropy formula. -/ +theorem finite_entropy_variational_identity {ι : Type*} (s : Finset ι) (A : ι → ℝ) + (hs : s.Nonempty) (hA : ∀ i ∈ s, 0 < A i) : + Real.exp (-(∑ i ∈ s, (A i / (∑ j ∈ s, A j)) * + Real.log (A i / (∑ j ∈ s, A j)))) * + (∏ i ∈ s, (A i) ^ (A i / (∑ j ∈ s, A j))) = ∑ j ∈ s, A j := by + have hsum : 0 < ∑ j ∈ s, A j := Finset.sum_pos hA hs + have hprod : (∏ i ∈ s, (A i) ^ (A i / (∑ j ∈ s, A j))) = + Real.exp (∑ i ∈ s, Real.log (A i) * (A i / (∑ j ∈ s, A j))) := by + rw [Real.exp_sum] + apply Finset.prod_congr rfl + intro i hi + exact Real.rpow_def_of_pos (hA i hi) _ + rw [hprod, ← Real.exp_add, finite_entropy_log_partition s A hs hA, + Real.exp_log hsum] + +end MatrixMultiplication.AuxiliarySeparation + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Entropy/Tag.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Entropy/Tag.lean new file mode 100644 index 0000000000000000000000000000000000000000..dd802d866ec3ca9aa9f3a25efe0ccd8f4644879c --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Entropy/Tag.lean @@ -0,0 +1,221 @@ +import OAI.LinearAlgebra.MatrixMultiplication.AuxiliarySeparation.Character.Basic +import OAI.LinearAlgebra.MatrixMultiplication.AuxiliarySeparation.Growth.PolynomialOverhead +import OAI.LinearAlgebra.MatrixMultiplication.Entropy.ComplexTypeEntropy +import OAI.LinearAlgebra.MatrixMultiplication.Entropy.ConditionalContinuity +import Mathlib.Analysis.SpecialFunctions.Pow.Real + +namespace OAI + +/-! +# The entropy limit for matched types + +The finite hypothesis in this file is an inequality at every integral type. +The conclusion follows by first repeating a fixed type, and then approximating +an arbitrary probability law by rational laws. No entropy inequality is +included in the finite hypothesis. +-/ + +noncomputable section + +open MatrixMultiplication.Foundation Filter +open scoped BigOperators Topology + +namespace MatrixMultiplication.AuxiliarySeparation + +variable {A : Type*} [Fintype A] [DecidableEq A] + +/-- The character contribution of all words of one prescribed type. -/ +def typeContribution (values : A → ℝ) (p : ℝ) (counts : A → ℕ) (t : ℕ) : ℝ := + (Fintype.card (ExactWords (fun a => t * counts a)) : ℝ) ^ p * + ∏ a, values a ^ (t * counts a) + +theorem typeContribution_pos (values : A → ℝ) (p : ℝ) (counts : A → ℕ) + (hvalues : ∀ a, 0 < values a) (t : ℕ) : + 0 < typeContribution values p counts t := by + unfold typeContribution + exact mul_pos + (Real.rpow_pos_of_pos (Nat.cast_pos.mpr (exactWords_card_pos _)) p) + (Finset.prod_pos (fun a _ => pow_pos (hvalues a) _)) + +theorem log_typeContribution (values : A → ℝ) (p : ℝ) (counts : A → ℕ) + (hvalues : ∀ a, 0 < values a) (t : ℕ) : + Real.log (typeContribution values p counts t) = + p * Real.log (Fintype.card (ExactWords (fun a => t * counts a)) : ℝ) + + (t : ℝ) * ∑ a, (counts a : ℝ) * Real.log (values a) := by + unfold typeContribution + rw [Real.log_mul + (Real.rpow_pos_of_pos (Nat.cast_pos.mpr (exactWords_card_pos _)) p).ne' + (Finset.prod_pos (fun a _ => pow_pos (hvalues a) _)).ne', + Real.log_rpow (Nat.cast_pos.mpr (exactWords_card_pos _)), + Real.log_prod (fun a _ => (pow_pos (hvalues a) _).ne')] + simp only [Real.log_pow, Nat.cast_mul, mul_assoc, Finset.mul_sum] + +/-- Repeating one exact type has its Shannon entropy growth rate. -/ +theorem typeContribution_rate (values : A → ℝ) (p : ℝ) (counts : A → ℕ) + (hvalues : ∀ a, 0 < values a) (hD : 0 < ∑ a, counts a) : + Tendsto + (fun t : ℕ => Real.log (typeContribution values p counts t) / + ((t : ℝ) * (∑ a, counts a : ℕ))) atTop + (𝓝 (p * finiteEntropy (fun a => (counts a : ℝ) / (∑ a, counts a : ℕ)) + + ∑ a, ((counts a : ℝ) / (∑ a, counts a : ℕ)) * Real.log (values a))) := by + have hlimit := ((tendsto_log_exactWords_card_mul counts hD).const_mul p).add_const + (∑ a, ((counts a : ℝ) / (∑ a, counts a : ℕ)) * Real.log (values a)) + apply hlimit.congr' + filter_upwards [eventually_gt_atTop (0 : ℕ)] with t ht + rw [log_typeContribution values p counts hvalues] + have ht' : (t : ℝ) ≠ 0 := (Nat.cast_pos.mpr ht).ne' + have hD' : (∑ a, counts a : ℝ) ≠ 0 := by + exact_mod_cast (Nat.ne_of_gt hD) + simp_rw [div_mul_eq_mul_div] + rw [← Finset.sum_div] + push_cast + field_simp + +/-- A finite bound on each repetition of a fixed type implies its logarithmic +entropy bound; the fixed loss `C` disappears in the limit. -/ +theorem log_type_bound (values : A → ℝ) (p source C : ℝ) (counts : A → ℕ) + (hvalues : ∀ a, 0 < values a) (hsource : 0 < source) (hC : 0 < C) + (hD : 0 < ∑ a, counts a) + (hfinite : ∀ t : ℕ, 0 < t → + typeContribution values p counts t ≤ C * source ^ (t * ∑ a, counts a)) : + p * finiteEntropy (fun a => (counts a : ℝ) / (∑ a, counts a : ℕ)) + + ∑ a, ((counts a : ℝ) / (∑ a, counts a : ℕ)) * Real.log (values a) ≤ + Real.log source := by + apply (Real.le_log_iff_exp_le hsource).2 + apply exp_le_of_tendsto_log_div hsource hC + (tendsto_id.atTop_mul_const' hD) + (Eventually.of_forall (typeContribution_pos values p counts hvalues)) + · simpa only [Nat.cast_mul, id_eq] using typeContribution_rate values p counts hvalues hD + · filter_upwards [eventually_gt_atTop (0 : ℕ)] with t ht + exact hfinite t ht + +/-- Rational laws can be represented by one exact integral type. -/ +theorem rational_log_tag_of_finite_type_bounds + (q : RationalLaw A) (values : A → ℝ) (p source C : ℝ) + (hvalues : ∀ a, 0 < values a) (hsource : 0 < source) (hC : 0 < C) + (hfinite : ∀ counts : A → ℕ, 0 < ∑ a, counts a → ∀ t : ℕ, 0 < t → + typeContribution values p counts t ≤ C * source ^ (t * ∑ a, counts a)) : + p * finiteEntropy q.toFiniteLaw.mass + + ∑ a, q.toFiniteLaw.mass a * Real.log (values a) ≤ Real.log source := by + obtain ⟨counts, hD, hmass⟩ := q.exists_type_representation + have h := log_type_bound values p source C counts hvalues hsource hC hD + (hfinite counts hD) + simpa only [hmass] using h + +/-- Integral type bounds imply the tag inequality on the whole finite +probability simplex, including laws with zero coordinates. -/ +theorem log_tag_of_finite_type_bounds + (q : FiniteLaw A) (values : A → ℝ) (p source C : ℝ) + (hvalues : ∀ a, 0 < values a) (hsource : 0 < source) (hC : 0 < C) + (hfinite : ∀ counts : A → ℕ, 0 < ∑ a, counts a → ∀ t : ℕ, 0 < t → + typeContribution values p counts t ≤ C * source ^ (t * ∑ a, counts a)) : + p * finiteEntropy q.mass + + ∑ a, q.mass a * Real.log (values a) ≤ Real.log source := by + obtain ⟨r, hr⟩ := MatrixMultiplication.ConditionalLabels.exists_rational_law_sequence q + have hlinear : Tendsto + (fun n => ∑ a, (r n).toFiniteLaw.mass a * Real.log (values a)) atTop + (𝓝 (∑ a, q.mass a * Real.log (values a))) := + tendsto_finsetSum Finset.univ (fun a _ => (hr a).mul_const _) + have hlimit := ((FiniteLaw.entropy_tendsto hr).const_mul p).add hlinear + exact le_of_tendsto hlimit (Eventually.of_forall (fun n => + rational_log_tag_of_finite_type_bounds (r n) values p source C + hvalues hsource hC hfinite)) + +/-- Exponentiating gives the entropy-weighted geometric-mean form. -/ +theorem tag_of_finite_type_bounds + (q : FiniteLaw A) (values : A → ℝ) (p source C : ℝ) + (hvalues : ∀ a, 0 < values a) (hsource : 0 < source) (hC : 0 < C) + (hfinite : ∀ counts : A → ℕ, 0 < ∑ a, counts a → ∀ t : ℕ, 0 < t → + typeContribution values p counts t ≤ C * source ^ (t * ∑ a, counts a)) : + Real.exp (p * finiteEntropy q.mass) * ∏ a, values a ^ q.mass a ≤ source := by + have h := Real.exp_le_exp.mpr + (log_tag_of_finite_type_bounds q values p source C hvalues hsource hC hfinite) + rw [Real.exp_log hsource, Real.exp_add, Real.exp_sum] at h + convert h using 1 + congr 1 + apply Finset.prod_congr rfl + intro a _ + rw [Real.rpow_def_of_pos (hvalues a), mul_comm] + +/-- It suffices to prove one finite inequality for every integral type. -/ +theorem log_tag_of_integral_bounds + (q : FiniteLaw A) (values : A → ℝ) (p source C : ℝ) + (hvalues : ∀ a, 0 < values a) (hsource : 0 < source) (hC : 0 < C) + (hfinite : ∀ counts : A → ℕ, 0 < ∑ a, counts a → + (Fintype.card (ExactWords counts) : ℝ) ^ p * ∏ a, values a ^ counts a ≤ + C * source ^ (∑ a, counts a)) : + p * finiteEntropy q.mass + + ∑ a, q.mass a * Real.log (values a) ≤ Real.log source := by + apply log_tag_of_finite_type_bounds q values p source C hvalues hsource hC + intro counts hD t ht + have hsum : (∑ a, t * counts a) = t * ∑ a, counts a := by + rw [Finset.mul_sum] + have hpositive : 0 < ∑ a, t * counts a := by + rw [hsum] + exact Nat.mul_pos ht hD + simpa only [typeContribution, hsum] using hfinite (fun a => t * counts a) hpositive + +/-- The geometric-mean formulation from finite inequalities for integral types. -/ +theorem tag_of_integral_bounds + (q : FiniteLaw A) (values : A → ℝ) (p source C : ℝ) + (hvalues : ∀ a, 0 < values a) (hsource : 0 < source) (hC : 0 < C) + (hfinite : ∀ counts : A → ℕ, 0 < ∑ a, counts a → + (Fintype.card (ExactWords counts) : ℝ) ^ p * ∏ a, values a ^ counts a ≤ + C * source ^ (∑ a, counts a)) : + Real.exp (p * finiteEntropy q.mass) * ∏ a, values a ^ q.mass a ≤ source := by + apply tag_of_finite_type_bounds q values p source C hvalues hsource hC + intro counts hD t ht + have hsum : (∑ a, t * counts a) = t * ∑ a, counts a := by + rw [Finset.mul_sum] + have hpositive : 0 < ∑ a, t * counts a := by + rw [hsum] + exact Nat.mul_pos ht hD + simpa only [typeContribution, hsum] using hfinite (fun a => t * counts a) hpositive + +namespace Character + +variable {I X Y Z : Type} [Fintype I] [DecidableEq I] + [Fintype X] [Fintype Y] [Fintype Z] + {BX BY BZ : I → Type} + [∀ a, Fintype (BX a)] [∀ a, Fintype (BY a)] [∀ a, Fintype (BZ a)] + +/-- For a character, nonzero tensors supply all positivity needed by the +entropy limit. The only quantitative premise is the finite integral-type +comparison with the paper's fixed loss five. -/ +theorem log_tag_of_integral_type_comparison (χ : Character) + (q : FiniteLaw I) (T : Tensor ℂ X Y Z) + (B : ∀ a, Tensor ℂ (BX a) (BY a) (BZ a)) (p : ℝ) + (hT : T ≠ 0) (hB : ∀ a, B a ≠ 0) + (hfinite : ∀ counts : I → ℕ, 0 < ∑ a, counts a → + (Fintype.card (ExactWords counts) : ℝ) ^ p * + ∏ a, χ.value (B a) ^ counts a ≤ + 5 * χ.value T ^ (∑ a, counts a)) : + p * finiteEntropy q.mass + ∑ a, q.mass a * Real.log (χ.value (B a)) ≤ + Real.log (χ.value T) := + MatrixMultiplication.AuxiliarySeparation.log_tag_of_integral_bounds q (fun a => χ.value (B a)) p + (χ.value T) 5 (fun a => lt_of_lt_of_le zero_lt_one (χ.one_le_value (hB a))) + (lt_of_lt_of_le zero_lt_one (χ.one_le_value hT)) (by norm_num) hfinite + +/-- The entropy-weighted tag bound, once the finite matched-type tensor +comparison has been established. -/ +theorem tag_of_integral_type_comparison (χ : Character) + (q : FiniteLaw I) (T : Tensor ℂ X Y Z) + (B : ∀ a, Tensor ℂ (BX a) (BY a) (BZ a)) (p : ℝ) + (hT : T ≠ 0) (hB : ∀ a, B a ≠ 0) + (hfinite : ∀ counts : I → ℕ, 0 < ∑ a, counts a → + (Fintype.card (ExactWords counts) : ℝ) ^ p * + ∏ a, χ.value (B a) ^ counts a ≤ + 5 * χ.value T ^ (∑ a, counts a)) : + Real.exp (p * finiteEntropy q.mass) * ∏ a, χ.value (B a) ^ q.mass a ≤ + χ.value T := + MatrixMultiplication.AuxiliarySeparation.tag_of_integral_bounds q (fun a => χ.value (B a)) p + (χ.value T) 5 (fun a => lt_of_lt_of_le zero_lt_one (χ.one_le_value (hB a))) + (lt_of_lt_of_le zero_lt_one (χ.one_le_value hT)) (by norm_num) hfinite + +end Character + +end MatrixMultiplication.AuxiliarySeparation + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Growth/ConcaveSlopes.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Growth/ConcaveSlopes.lean new file mode 100644 index 0000000000000000000000000000000000000000..393c580ebe237557f7c1359586d3752f7e5835e0 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Growth/ConcaveSlopes.lean @@ -0,0 +1,123 @@ +import Mathlib.Analysis.Asymptotics.SpecificAsymptotics +import Mathlib.Topology.Order.MonotoneConvergence +import Mathlib.Tactic + +namespace OAI + +/-! +# Slopes of positive discretely concave sequences + +The row sequences in Section 6 have decreasing consecutive increments. A +nonnegative sequence cannot have a negative increment of this kind: every later +increment would be at least as negative. Consequently the increments converge +to a nonnegative limit, and the sequence divided by its index has the same limit. +-/ + +namespace MatrixMultiplication.AuxiliarySeparation + +open Filter +open scoped Topology + +/-- The usual second-difference inequality makes the increments decreasing. -/ +theorem antitone_increments_of_discrete_concavity {u : ℕ → ℝ} + (hu : ∀ n, u (n + 2) + u n ≤ 2 * u (n + 1)) : + Antitone (fun n => u (n + 1) - u n) := by + apply antitone_nat_of_succ_le + intro n + have h := hu n + simp only [Nat.add_assoc] at * + linarith + +/-- A tangent-line upper bound for a sequence with decreasing increments. -/ +theorem concave_sequence_le_affine {u : ℕ → ℝ} + (hd : Antitone (fun n => u (n + 1) - u n)) (n k : ℕ) : + u (n + k) ≤ u n + (k : ℝ) * (u (n + 1) - u n) := by + induction k with + | zero => simp + | succ k ih => + have hstep := hd (show n ≤ n + k by omega) + simp only at hstep + rw [Nat.cast_add, Nat.cast_one] + have hindex : n + (k + 1) = n + k + 1 := by omega + rw [hindex] + nlinarith + +/-- Every increment of a nonnegative discretely concave sequence is nonnegative. -/ +theorem increment_nonneg_of_antitone {u : ℕ → ℝ} + (hu : ∀ n, 0 ≤ u n) (hd : Antitone (fun n => u (n + 1) - u n)) + (n : ℕ) : 0 ≤ u (n + 1) - u n := by + by_contra hn + have hneg : u (n + 1) - u n < 0 := lt_of_not_ge hn + obtain ⟨k, hk⟩ := exists_lt_nsmul (neg_pos.mpr hneg) (u n) + have hk' : u n < (k : ℝ) * -(u (n + 1) - u n) := by + simpa only [nsmul_eq_mul] using hk + have hbound := concave_sequence_le_affine hd n k + have hnonneg := hu (n + k) + nlinarith + +/-- A nonnegative discretely concave sequence is increasing. -/ +theorem monotone_of_nonneg_of_antitone_increments {u : ℕ → ℝ} + (hu : ∀ n, 0 ≤ u n) (hd : Antitone (fun n => u (n + 1) - u n)) : + Monotone u := by + apply monotone_nat_of_le_succ + intro n + have := increment_nonneg_of_antitone hu hd n + linarith + +/-- Telescoping and Cesàro convergence identify the linear growth rate. -/ +theorem tendsto_div_nat_of_tendsto_increments {u : ℕ → ℝ} {g : ℝ} + (hd : Tendsto (fun n => u (n + 1) - u n) atTop (𝓝 g)) : + Tendsto (fun n => u n / (n : ℝ)) atTop (𝓝 g) := by + have hmean := hd.cesaro + simp only [Finset.sum_range_sub] at hmean + have hconst := tendsto_const_div_atTop_nhds_zero_nat (u 0) + have hsum := hmean.add hconst + simpa only [add_zero, div_eq_mul_inv, mul_sub, sub_add_cancel, mul_comm] using hsum + +/-- The limiting increment of a nonnegative discretely concave sequence is +nonnegative, and it is also its linear growth rate. -/ +theorem exists_nonneg_limit_of_antitone_increments {u : ℕ → ℝ} + (hu : ∀ n, 0 ≤ u n) (hd : Antitone (fun n => u (n + 1) - u n)) : + ∃ g : ℝ, 0 ≤ g ∧ + Tendsto (fun n => u (n + 1) - u n) atTop (𝓝 g) ∧ + Tendsto (fun n => u n / (n : ℝ)) atTop (𝓝 g) := by + have hnonneg := increment_nonneg_of_antitone hu hd + have hbdd : BddBelow (Set.range (fun n => u (n + 1) - u n)) := by + refine ⟨0, ?_⟩ + rintro _ ⟨n, rfl⟩ + exact hnonneg n + have hlim := tendsto_atTop_ciInf hd hbdd + refine ⟨⨅ n, u (n + 1) - u n, ?_, hlim, + tendsto_div_nat_of_tendsto_increments hlim⟩ + exact ge_of_tendsto hlim (Eventually.of_forall hnonneg) + +/-- Positive-index version, suitable for the rows in Section 6. The value at +index zero is irrelevant. -/ +theorem exists_concave_slope_limit {P : ℕ → ℝ} + (hP : ∀ n, 0 < P (n + 1)) + (hd : Antitone (fun n => P (n + 2) - P (n + 1))) : + ∃ g : ℝ, 0 ≤ g ∧ + (∀ n, g ≤ P (n + 2) - P (n + 1)) ∧ + Tendsto (fun n => P (n + 2) - P (n + 1)) atTop (𝓝 g) ∧ + Tendsto (fun n => P n / (n : ℝ)) atTop (𝓝 g) := by + have hd' : Antitone (fun n => P ((n + 1) + 1) - P (n + 1)) := by + simpa only [Nat.add_assoc] using hd + obtain ⟨g, hg, hlim, hratio⟩ := exists_nonneg_limit_of_antitone_increments + (u := fun n => P (n + 1)) (fun n => (hP n).le) hd' + have hmul := hratio.mul (tendsto_natCast_div_add_atTop (1 : ℝ)) + have hshift : Tendsto (fun n => P (n + 1) / ((n + 1 : ℕ) : ℝ)) + atTop (𝓝 g) := by + rw [mul_one] at hmul + apply hmul.congr' + filter_upwards [eventually_ge_atTop 1] with n hn + have hn' : (n : ℝ) ≠ 0 := by exact_mod_cast (show n ≠ 0 by omega) + rw [Nat.cast_add, Nat.cast_one] + field_simp + refine ⟨g, hg, ?_, ?_, (tendsto_add_atTop_iff_nat 1).mp hshift⟩ + · intro n + exact hd.le_of_tendsto (by simpa only [Nat.add_assoc] using hlim) n + · simpa only [Nat.add_assoc] using hlim + +end MatrixMultiplication.AuxiliarySeparation + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Growth/Floor.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Growth/Floor.lean new file mode 100644 index 0000000000000000000000000000000000000000..3c03f4657a1c54ffe7eb1b00dcb9de8c9b780142 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Growth/Floor.lean @@ -0,0 +1,63 @@ +import Mathlib.Analysis.SpecificLimits.Basic +import Mathlib.Analysis.SpecialFunctions.Log.Base +import Mathlib.Analysis.SpecialFunctions.Pow.Continuity + +namespace OAI + +/-! +# Growth rates of floor-rounded exponents + +The integer exponents obtained by rounding a nonnegative multiple of the tensor +power have the intended normalized growth rate. Applying a positive base to +these exponents preserves that rate after taking roots. +-/ + +namespace MatrixMultiplication.AuxiliarySeparation + +open Filter +open scoped Topology + +/-- Rounding a nonnegative linear exponent down has vanishing normalized error. -/ +theorem tendsto_floor_mul_div {c : ℝ} (hc : 0 ≤ c) : + Tendsto (fun j : ℕ => (⌊(j : ℝ) * c⌋₊ : ℝ) / (j : ℝ)) + atTop (𝓝 c) := by + simpa only [Function.comp_def, mul_comm] using + (tendsto_nat_floor_mul_div_atTop hc).comp + (tendsto_natCast_atTop_atTop (R := ℝ)) + +/-- A floor-rounded exponent diverges when its linear coefficient is positive. -/ +theorem tendsto_floor_mul_atTop {c : ℝ} (hc : 0 < c) : + Tendsto (fun j : ℕ => ⌊(j : ℝ) * c⌋₊) atTop atTop := by + simpa only [mul_comm] using tendsto_nat_floor_mul_atTop c hc + +/-- The root growth rate of powers with floor-rounded exponents. -/ +theorem tendsto_pow_floor_rpow_inv {u c : ℝ} (hu : 0 < u) (hc : 0 ≤ c) : + Tendsto (fun j : ℕ => (u ^ ⌊(j : ℝ) * c⌋₊) ^ (1 / (j : ℝ))) + atTop (𝓝 (u ^ c)) := by + have h := (Real.continuousAt_const_rpow hu.ne').tendsto.comp + (tendsto_floor_mul_div hc) + convert h using 1 + funext j + simp only [Function.comp_def, div_eq_mul_inv, one_mul] + rw [Real.rpow_mul hu.le, Real.rpow_natCast] + +/-- The logarithmic choice of exponent gives the prescribed root growth rate. +In the tensor application, `s` is the exponent bound with a positive slack. -/ +theorem tendsto_pow_floor_logb_div_rpow_inv {u n s : ℝ} + (hu : 1 < u) (hn : 1 ≤ n) (hs : 0 < s) : + Tendsto + (fun j : ℕ => (u ^ ⌊(j : ℝ) * (Real.logb u n / s)⌋₊) ^ (1 / (j : ℝ))) + atTop (𝓝 (n ^ (1 / s))) := by + have hu₀ : 0 < u := zero_lt_one.trans hu + have hn₀ : 0 < n := zero_lt_one.trans_le hn + have h := tendsto_pow_floor_rpow_inv hu₀ + (div_nonneg (Real.logb_nonneg hu hn) hs.le) + have hrate : u ^ (Real.logb u n / s) = n ^ (1 / s) := by + rw [div_eq_mul_inv, Real.rpow_mul hu₀.le, Real.rpow_logb hu₀ hu.ne' hn₀, + one_div] + rw [hrate] at h + exact h + +end MatrixMultiplication.AuxiliarySeparation + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Growth/MultiplicativePower.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Growth/MultiplicativePower.lean new file mode 100644 index 0000000000000000000000000000000000000000..a54264fb69ee8633c8dd5a9ab5b2debb55fce69b --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Growth/MultiplicativePower.lean @@ -0,0 +1,159 @@ +import Mathlib.Analysis.SpecialFunctions.Pow.Real +import Mathlib.Algebra.Order.Archimedean.Basic +import Mathlib.Tactic + +namespace OAI + +/-! +# Monotone multiplicative functions on the positive natural numbers + +The scalar classification used in Section 3.1: positivity, multiplicativity, +and monotonicity force a function on positive natural numbers to be a real +power. No property of the function at zero is required. +-/ + +namespace MatrixMultiplication.AuxiliarySeparation + +/-- Multiplicativity and positivity determine the value at one. -/ +theorem positiveMultiplicative_one + {f : ℕ → ℝ} (hpos : ∀ n, 0 < n → 0 < f n) + (hmul : ∀ m n, 0 < m → 0 < n → f (m * n) = f m * f n) : + f 1 = 1 := by + have hm := hmul 1 1 (by omega) (by omega) + have hp := hpos 1 (by omega) + norm_num at hm + nlinarith + +/-- A positive multiplicative function preserves natural powers. -/ +theorem positiveMultiplicative_pow + {f : ℕ → ℝ} (hpos : ∀ n, 0 < n → 0 < f n) + (hmul : ∀ m n, 0 < m → 0 < n → f (m * n) = f m * f n) + {n : ℕ} (hn : 0 < n) (k : ℕ) : f (n ^ k) = f n ^ k := by + induction k with + | zero => simpa using positiveMultiplicative_one hpos hmul + | succ k ih => + rw [pow_succ, hmul (n ^ k) n (pow_pos hn k) hn, ih, pow_succ] + +/-- Monotonicity transfers comparisons of natural powers to the values. -/ +theorem positiveMultiplicative_pow_le_pow + {f : ℕ → ℝ} (hpos : ∀ n, 0 < n → 0 < f n) + (hmul : ∀ m n, 0 < m → 0 < n → f (m * n) = f m * f n) + (hmono : MonotoneOn f (Set.Ioi 0)) + {m n : ℕ} (hm : 0 < m) (hn : 0 < n) {j k : ℕ} + (h : m ^ j ≤ n ^ k) : f m ^ j ≤ f n ^ k := by + rw [← positiveMultiplicative_pow hpos hmul hm, + ← positiveMultiplicative_pow hpos hmul hn] + exact hmono (pow_pos hm j) (pow_pos hn k) h + +/-- The same comparison after taking logarithms. -/ +theorem positiveMultiplicative_log_pow_le + {f : ℕ → ℝ} (hpos : ∀ n, 0 < n → 0 < f n) + (hmul : ∀ m n, 0 < m → 0 < n → f (m * n) = f m * f n) + (hmono : MonotoneOn f (Set.Ioi 0)) + {m n : ℕ} (hm : 0 < m) (hn : 0 < n) {j k : ℕ} + (h : m ^ j ≤ n ^ k) : + (j : ℝ) * Real.log (f m) ≤ (k : ℝ) * Real.log (f n) := by + have hv := positiveMultiplicative_pow_le_pow hpos hmul hmono hm hn h + simpa only [Real.log_pow] using + Real.log_le_log (pow_pos (hpos m hm) j) hv + +/-- Bounds from neighboring powers of two have a fixed logarithmic error, +independent of the exponent `k`. -/ +theorem positiveMultiplicative_log_error_bounds + {f : ℕ → ℝ} (hpos : ∀ n, 0 < n → 0 < f n) + (hmul : ∀ m n, 0 < m → 0 < n → f (m * n) = f m * f n) + (hmono : MonotoneOn f (Set.Ioi 0)) + {n : ℕ} (hn : 0 < n) (k : ℕ) : + (k : ℝ) * (Real.log (f n) * Real.log 2 - + Real.log (n : ℝ) * Real.log (f 2)) ≤ Real.log (f 2) * Real.log 2 ∧ + (k : ℝ) * (Real.log (n : ℝ) * Real.log (f 2) - + Real.log (f n) * Real.log 2) ≤ Real.log (f 2) * Real.log 2 := by + have hf2 : 0 ≤ Real.log (f 2) := by + apply Real.log_nonneg + have hm := hmono (show (1 : ℕ) ∈ Set.Ioi 0 by norm_num) + (show (2 : ℕ) ∈ Set.Ioi 0 by norm_num) (by norm_num) + rwa [positiveMultiplicative_one hpos hmul] at hm + have hlog2 : 0 ≤ Real.log (2 : ℝ) := Real.log_nonneg (by norm_num) + obtain ⟨m, hlow, hupp⟩ := + exists_nat_pow_near (show 1 ≤ n ^ k from Nat.one_le_iff_ne_zero.mpr (by positivity)) + (show 1 < (2 : ℕ) by omega) + have hflow := positiveMultiplicative_log_pow_le hpos hmul hmono + (show 0 < (2 : ℕ) by omega) hn hlow + have hfupp := positiveMultiplicative_log_pow_le hpos hmul hmono hn + (show 0 < (2 : ℕ) by omega) hupp.le + have hlow' : (2 : ℝ) ^ m ≤ (n : ℝ) ^ k := by exact_mod_cast hlow + have hupp' : (n : ℝ) ^ k ≤ (2 : ℝ) ^ (m + 1) := by exact_mod_cast hupp.le + have hnp : (0 : ℝ) < n := by exact_mod_cast hn + have hnlow := Real.log_le_log (pow_pos (by norm_num : (0 : ℝ) < 2) m) hlow' + have hnupp := Real.log_le_log (pow_pos hnp k) hupp' + simp only [Real.log_pow, Nat.cast_add, Nat.cast_one] at hflow hfupp hnlow hnupp + have h₁ := mul_le_mul_of_nonneg_right hfupp hlog2 + have h₂ := mul_le_mul_of_nonneg_right hnlow hf2 + have h₃ := mul_le_mul_of_nonneg_right hnupp hf2 + have h₄ := mul_le_mul_of_nonneg_right hflow hlog2 + constructor <;> nlinarith + +/-- If every natural multiple of both differences has a common upper bound, +the two real numbers coincide. -/ +theorem eq_of_nat_mul_sub_bounded {x y C : ℝ} + (hxy : ∀ k : ℕ, (k : ℝ) * (x - y) ≤ C) + (hyx : ∀ k : ℕ, (k : ℝ) * (y - x) ≤ C) : x = y := by + apply le_antisymm + · by_contra h + have hd : 0 < x - y := sub_pos.mpr (lt_of_not_ge h) + obtain ⟨k, hk⟩ := exists_nat_gt (C / (x - y)) + have hk' : C < (k : ℝ) * (x - y) := (div_lt_iff₀ hd).mp hk + exact (not_lt_of_ge (hxy k)) hk' + · by_contra h + have hd : 0 < y - x := sub_pos.mpr (lt_of_not_ge h) + obtain ⟨k, hk⟩ := exists_nat_gt (C / (y - x)) + have hk' : C < (k : ℝ) * (y - x) := (div_lt_iff₀ hd).mp hk + exact (not_lt_of_ge (hyx k)) hk' + +/-- The logarithmic exponent is the same at every positive natural number. -/ +theorem positiveMultiplicative_log_eq + {f : ℕ → ℝ} (hpos : ∀ n, 0 < n → 0 < f n) + (hmul : ∀ m n, 0 < m → 0 < n → f (m * n) = f m * f n) + (hmono : MonotoneOn f (Set.Ioi 0)) + {n : ℕ} (hn : 0 < n) : + Real.log (f n) = Real.log (n : ℝ) * (Real.log (f 2) / Real.log 2) := by + have heq : Real.log (f n) * Real.log 2 = + Real.log (n : ℝ) * Real.log (f 2) := + eq_of_nat_mul_sub_bounded + (fun k => (positiveMultiplicative_log_error_bounds hpos hmul hmono hn k).1) + (fun k => (positiveMultiplicative_log_error_bounds hpos hmul hmono hn k).2) + calc + Real.log (f n) = (Real.log (n : ℝ) * Real.log (f 2)) / Real.log 2 := + (eq_div_iff (Real.log_pos (show (1 : ℝ) < 2 by norm_num)).ne').2 heq + _ = Real.log (n : ℝ) * (Real.log (f 2) / Real.log 2) := by ring + +/-- The explicit exponent in the classification of positive monotone +multiplicative functions on the positive natural numbers. -/ +theorem positiveMultiplicative_eq_rpow + {f : ℕ → ℝ} (hpos : ∀ n, 0 < n → 0 < f n) + (hmul : ∀ m n, 0 < m → 0 < n → f (m * n) = f m * f n) + (hmono : MonotoneOn f (Set.Ioi 0)) + {n : ℕ} (hn : 0 < n) : + f n = (n : ℝ) ^ (Real.log (f 2) / Real.log 2) := by + have hnp : (0 : ℝ) < n := by exact_mod_cast hn + rw [Real.rpow_def_of_pos hnp, ← positiveMultiplicative_log_eq hpos hmul hmono hn, + Real.exp_log (hpos n hn)] + +/-- Every positive monotone multiplicative function on the positive natural +numbers is a nonnegative real power, as used in Section 3.1. -/ +theorem positiveMultiplicative_is_rpow + {f : ℕ → ℝ} (hpos : ∀ n, 0 < n → 0 < f n) + (hmul : ∀ m n, 0 < m → 0 < n → f (m * n) = f m * f n) + (hmono : MonotoneOn f (Set.Ioi 0)) : + ∃ p : ℝ, 0 ≤ p ∧ ∀ n : ℕ, 0 < n → f n = (n : ℝ) ^ p := by + refine ⟨Real.log (f 2) / Real.log 2, ?_, fun n hn => + positiveMultiplicative_eq_rpow hpos hmul hmono hn⟩ + apply div_nonneg _ (Real.log_nonneg (by norm_num)) + apply Real.log_nonneg + have hm := hmono (show (1 : ℕ) ∈ Set.Ioi 0 by norm_num) + (show (2 : ℕ) ∈ Set.Ioi 0 by norm_num) (by norm_num) + rwa [positiveMultiplicative_one hpos hmul] at hm + +end MatrixMultiplication.AuxiliarySeparation + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Growth/NormalizedProfile.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Growth/NormalizedProfile.lean new file mode 100644 index 0000000000000000000000000000000000000000..62eabda77c7589a038850ac2425618e4435f3668 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Growth/NormalizedProfile.lean @@ -0,0 +1,81 @@ +import OAI.LinearAlgebra.MatrixMultiplication.AuxiliarySeparation.Tensor.SixfoldProductBounds +import Mathlib.Tactic.FieldSimp + +namespace OAI + +/-! +# Positivity and rank bounds for the normalized profile + +The normalization exponent is positive when the mean singleton-leg exponent +is positive. Under this hypothesis, passing to the profile preserves order, +and a rank bound `r` becomes the bound `r ^ (1 / t)`. +-/ + +namespace MatrixMultiplication.AuxiliarySeparation +namespace Character + +open MatrixMultiplication.Foundation + +variable (χ : Character) +variable {X Y Z U V W : Type} +variable [Fintype X] [Fintype Y] [Fintype Z] +variable [Fintype U] [Fintype V] [Fintype W] + +theorem symmetrizedProfile_nonneg (t : ℝ) (T : Tensor ℂ X Y Z) : + 0 ≤ χ.symmetrizedProfile t T := + Real.rpow_nonneg (χ.sixfoldProduct_nonneg T) _ + +theorem symmetrizedProfile_pos (t : ℝ) {T : Tensor ℂ X Y Z} (hT : T ≠ 0) : + 0 < χ.symmetrizedProfile t T := + Real.rpow_pos_of_pos (χ.sixfoldProduct_pos hT) _ + +theorem one_le_symmetrizedProfile {t : ℝ} (ht : 0 < t) + {T : Tensor ℂ X Y Z} (hT : T ≠ 0) : 1 ≤ χ.symmetrizedProfile t T := by + exact Real.one_le_rpow (χ.one_le_sixfoldProduct hT) (by positivity) + +/-- Tensor products become products of normalized profile values. -/ +theorem symmetrizedProfile_product (t : ℝ) (T : Tensor ℂ X Y Z) + (S : Tensor ℂ U V W) : + χ.symmetrizedProfile t (Tensor.product T S) = + χ.symmetrizedProfile t T * χ.symmetrizedProfile t S := by + simp only [symmetrizedProfile, χ.sixfoldProduct_product] + exact Real.mul_rpow (χ.sixfoldProduct_nonneg T) (χ.sixfoldProduct_nonneg S) + +/-- Positive normalization preserves the order of the underlying sixfold products. -/ +theorem symmetrizedProfile_le_iff {t : ℝ} (ht : 0 < t) + (T : Tensor ℂ X Y Z) (S : Tensor ℂ U V W) : + χ.symmetrizedProfile t T ≤ χ.symmetrizedProfile t S ↔ + χ.sixfoldProduct T ≤ χ.sixfoldProduct S := by + exact Real.rpow_le_rpow_iff (χ.sixfoldProduct_nonneg T) + (χ.sixfoldProduct_nonneg S) (by positivity) + +/-- The symmetrized profile has the rank bound used in Section 5. -/ +theorem symmetrizedProfile_le_rank {t : ℝ} (ht : 0 < t) + {T : Tensor ℂ X Y Z} {r : ℕ} (h : Tensor.RankAtMost T r) : + χ.symmetrizedProfile t T ≤ (r : ℝ) ^ (1 / t) := by + calc + χ.symmetrizedProfile t T ≤ ((r : ℝ) ^ 6) ^ (1 / (6 * t)) := + Real.rpow_le_rpow (χ.sixfoldProduct_nonneg T) (χ.sixfoldProduct_le_rank h) + (by positivity) + _ = (r : ℝ) ^ (1 / t) := by + rw [← Real.rpow_natCast (r : ℝ) 6, ← Real.rpow_mul (by positivity)] + congr 1 + field_simp + norm_num + +/-- A factor `c ^ (6*t)` in the sixfold product becomes `c` in the profile. -/ +theorem mul_symmetrizedProfile_le_of_le {t c : ℝ} (ht : 0 < t) (hc : 0 ≤ c) + (T : Tensor ℂ X Y Z) (S : Tensor ℂ U V W) + (h : c ^ (6 * t) * χ.sixfoldProduct T ≤ χ.sixfoldProduct S) : + c * χ.symmetrizedProfile t T ≤ χ.symmetrizedProfile t S := by + have hp := Real.rpow_le_rpow + (mul_nonneg (Real.rpow_nonneg hc _) (χ.sixfoldProduct_nonneg T)) h + (show 0 ≤ 1 / (6 * t) by positivity) + rw [Real.mul_rpow (Real.rpow_nonneg hc _) (χ.sixfoldProduct_nonneg T), + one_div, Real.rpow_rpow_inv hc (ne_of_gt (mul_pos (by norm_num) ht))] at hp + simpa only [symmetrizedProfile, one_div] using hp + +end Character +end MatrixMultiplication.AuxiliarySeparation + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Growth/PermutationProduct.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Growth/PermutationProduct.lean new file mode 100644 index 0000000000000000000000000000000000000000..fb4a6e0dc4f43e90197e19514e906c05228d8395 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Growth/PermutationProduct.lean @@ -0,0 +1,118 @@ +import Mathlib.Algebra.BigOperators.Group.Finset.Basic +import Mathlib.Algebra.Group.Equiv.Basic +import Mathlib.Data.Fintype.Perm +import Mathlib.Basic.Real.Basic +import Mathlib.Tactic.FinCases +import Mathlib.Tactic.NormNum +import Mathlib.Tactic.Ring + +namespace OAI + +/-! +# Products over the six permutations of three tensor legs + +The symmetrized quantity in Section 5 uses every permutation of the three +tensor legs. Composing by a fixed permutation preserves this product. For +the exponent calculation, each original leg occurs twice in any fixed slot. +These are finite identities; they do not assume that an individual tensor +character is invariant under exchanging its legs. +-/ + +open scoped BigOperators + +namespace MatrixMultiplication.AuxiliarySeparation + +/-- A permutation of the three tensor legs. -/ +abbrev LegPermutation := Equiv.Perm (Fin 3) + +namespace LegPermutation + +/-- There are six orders of the three legs. -/ +theorem card : Fintype.card LegPermutation = 6 := by + norm_num [Fintype.card_perm, Nat.factorial] + +/-- Right composition just reindexes a product over all six permutations. -/ +theorem prod_mul_right {M : Type*} [CommMonoid M] + (f : LegPermutation → M) (σ : LegPermutation) : + (∏ π, f (π * σ)) = ∏ π, f π := by + exact Equiv.prod_comp (Equiv.mulRight σ) f + +/-- Left composition also just reindexes the six factors. -/ +theorem prod_mul_left {M : Type*} [CommMonoid M] + (f : LegPermutation → M) (σ : LegPermutation) : + (∏ π, f (σ * π)) = ∏ π, f π := by + exact Equiv.prod_comp (Equiv.mulLeft σ) f + +/-- The same reindexing statement in explicit equivalence-composition notation. -/ +theorem prod_trans_right {M : Type*} [CommMonoid M] + (f : LegPermutation → M) (σ : LegPermutation) : + (∏ π : LegPermutation, f (π.trans σ)) = ∏ π, f π := by + exact prod_mul_left f σ + +/-- A permutation-independent sum may likewise be reindexed on the right. -/ +theorem sum_mul_right {A : Type*} [AddCommMonoid A] + (f : LegPermutation → A) (σ : LegPermutation) : + (∑ π, f (π * σ)) = ∑ π, f π := by + exact Equiv.sum_comp (Equiv.mulRight σ) f + +/-- Each original leg occurs twice in each fixed position. -/ +theorem card_apply_fiber (i j : Fin 3) : + Fintype.card {π : LegPermutation // π i = j} = 2 := by + let _ : Fintype LegPermutation := fintypePerm + fin_cases i <;> fin_cases j <;> decide + +/-- The product of values attached to one slot contains each leg twice. -/ +theorem prod_apply {M : Type*} [CommMonoid M] (f : Fin 3 → M) (i : Fin 3) : + (∏ π : LegPermutation, f (π i)) = (∏ j, f j) ^ 2 := by + rw [← Fintype.prod_fiberwise' (fun π : LegPermutation => π i) f] + simp only [Finset.prod_const, Finset.card_univ, card_apply_fiber, Finset.prod_pow] + +/-- The exponent attached to one slot contains each leg exponent twice. -/ +theorem sum_apply {A : Type*} [AddCommMonoid A] (p : Fin 3 → A) (i : Fin 3) : + (∑ π : LegPermutation, p (π i)) = 2 • ∑ j, p j := by + rw [← Fintype.sum_fiberwise' (fun π : LegPermutation => π i) p] + simp only [Finset.sum_const, Finset.card_univ, card_apply_fiber, Finset.sum_nsmul] + +/-- Inverting the permutation preserves the symmetrized product. -/ +theorem prod_symm {M : Type*} [CommMonoid M] (f : LegPermutation → M) : + (∏ π : LegPermutation, f π.symm) = ∏ π, f π := by + exact Equiv.prod_comp (Equiv.inv LegPermutation) f + +/-- Inverting the permutation preserves a sum over all six orders. -/ +theorem sum_symm {A : Type*} [AddCommMonoid A] (f : LegPermutation → A) : + (∑ π : LegPermutation, f π.symm) = ∑ π, f π := by + exact Equiv.sum_comp (Equiv.inv LegPermutation) f + +/-- The twice-per-leg count is independent of the permutation convention. -/ +theorem sum_symm_apply {A : Type*} [AddCommMonoid A] + (p : Fin 3 → A) (i : Fin 3) : + (∑ π : LegPermutation, p (π.symm i)) = 2 • ∑ j, p j := by + rw [sum_symm (fun π => p (π i)), sum_apply] + +/-- The sum of the six singleton-leg exponents is six times their mean. -/ +theorem sum_exponents (p : Fin 3 → ℝ) (i : Fin 3) (t : ℝ) + (h : (∑ j, p j) = 3 * t) : + (∑ π : LegPermutation, p (π i)) = 6 * t := by + rw [sum_apply, h] + simp only [nsmul_eq_mul] + ring + +/-- The product of the valuations of all six transforms of an object. -/ +def orbitProduct {X M : Type*} [CommMonoid M] + (transform : LegPermutation → X → X) (value : X → M) (x : X) : M := + ∏ π : LegPermutation, value (transform π x) + +/-- A further leg transformation preserves the product whenever transforms compose. -/ +theorem orbitProduct_transform {X M : Type*} [CommMonoid M] + (transform : LegPermutation → X → X) (value : X → M) + (compose : ∀ π σ x, transform π (transform σ x) = transform (π * σ) x) + (σ : LegPermutation) (x : X) : + orbitProduct transform value (transform σ x) = orbitProduct transform value x := by + simp only [orbitProduct, compose] + exact prod_mul_right (fun π => value (transform π x)) σ + +end LegPermutation + +end MatrixMultiplication.AuxiliarySeparation + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Growth/PolynomialOverhead.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Growth/PolynomialOverhead.lean new file mode 100644 index 0000000000000000000000000000000000000000..b71b8681f5964334d33728dba6a2e5dcdaaeb158 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Growth/PolynomialOverhead.lean @@ -0,0 +1,97 @@ +import Mathlib.Analysis.SpecificLimits.Normed +import Mathlib.Analysis.SpecialFunctions.Log.Basic +import Mathlib.Tactic + +namespace OAI + +/-! +# Removing polynomial overhead from exponential inequalities + +The interpolation argument in Section 4 bounds tensor powers with an extra +linear factor. Such a factor does not change their exponential growth rate. +The statements below include eventual inequalities and constant factors, so +the same argument also removes fixed counting losses in entropy limits. +-/ + +namespace MatrixMultiplication.AuxiliarySeparation + +open Filter +open scoped Topology + +/-- An eventual linear prefactor cannot increase an exponential growth rate. -/ +theorem le_of_eventually_pow_le_linear_mul_pow {a b K C : ℝ} + (ha : 0 ≤ a) + (h : ∀ᶠ j : ℕ in atTop, b ^ j ≤ ((j : ℝ) * K + C) * a ^ j) : + b ≤ a := by + by_contra hba + have hab : a < b := lt_of_not_ge hba + have hb : 0 < b := lt_of_le_of_lt ha hab + have hr₀ : 0 ≤ a / b := div_nonneg ha hb.le + have hr₁ : a / b < 1 := (div_lt_one hb).2 hab + have hlinear := (tendsto_self_mul_const_pow_of_lt_one hr₀ hr₁).mul_const K + have hconstant := (tendsto_pow_atTop_nhds_zero_of_lt_one hr₀ hr₁).const_mul C + have hlim : Tendsto (fun j : ℕ => ((j : ℝ) * K + C) * (a / b) ^ j) + atTop (𝓝 0) := by + convert hlinear.add hconstant using 1 <;> try simp + funext j + ring + have hbound : ∀ᶠ j : ℕ in atTop, + 1 ≤ ((j : ℝ) * K + C) * (a / b) ^ j := by + filter_upwards [h] with j hj + have hdiv := (div_le_div_iff_of_pos_right (pow_pos hb j)).2 hj + simpa only [div_self (pow_ne_zero j hb.ne'), mul_div_assoc, div_pow] using hdiv + have hfalse : (1 : ℝ) ≤ 0 := ge_of_tendsto hlim hbound + linarith + +/-- Removing the linear interpolation overhead from inequalities for all powers. -/ +theorem le_of_pow_le_linear_mul_pow {a b K : ℝ} (ha : 0 ≤ a) + (h : ∀ j : ℕ, b ^ j ≤ ((j : ℝ) * K + 1) * a ^ j) : b ≤ a := + le_of_eventually_pow_le_linear_mul_pow ha (Eventually.of_forall h) + +/-- Fixed multiplicative losses disappear on taking exponential growth rates. -/ +theorem le_of_eventually_pow_le_const_mul_pow {a b C : ℝ} (ha : 0 ≤ a) + (h : ∀ᶠ j : ℕ in atTop, b ^ j ≤ C * a ^ j) : b ≤ a := by + apply le_of_eventually_pow_le_linear_mul_pow (K := 0) (C := C) ha + simpa only [mul_zero, zero_add] using h + +/-- An all-powers form of constant-factor removal. -/ +theorem le_of_pow_le_const_mul_pow {a b C : ℝ} (ha : 0 ≤ a) + (h : ∀ j : ℕ, b ^ j ≤ C * a ^ j) : b ≤ a := + le_of_eventually_pow_le_const_mul_pow ha (Eventually.of_forall h) + +/-- In particular, the fixed factor five in the type-counting bound is harmless. -/ +theorem le_of_pow_le_five_mul_pow {a b : ℝ} (ha : 0 ≤ a) + (h : ∀ j : ℕ, b ^ j ≤ 5 * a ^ j) : b ≤ a := + le_of_eventually_pow_le_const_mul_pow ha (Eventually.of_forall h) + +/-- A fixed counting loss does not contribute to a normalized logarithmic +growth rate. The exponent may run through any sequence tending to infinity, +including the multiples of a common denominator used for rational types. -/ +theorem exp_le_of_tendsto_log_div {u : ℕ → ℝ} {n : ℕ → ℕ} {b C L : ℝ} + (hb : 0 < b) (hC : 0 < C) (hn : Tendsto n atTop atTop) + (hu : ∀ᶠ k in atTop, 0 < u k) + (hlim : Tendsto (fun k => Real.log (u k) / (n k : ℝ)) atTop (𝓝 L)) + (hbound : ∀ᶠ k in atTop, u k ≤ C * b ^ n k) : + Real.exp L ≤ b := by + have hconstant : Tendsto (fun k => Real.log C / (n k : ℝ) + Real.log b) + atTop (𝓝 (Real.log b)) := by + simpa using ((tendsto_const_div_atTop_nhds_zero_nat (Real.log C)).comp hn).add_const + (Real.log b) + have hnormalized : ∀ᶠ k in atTop, + Real.log (u k) / (n k : ℝ) ≤ Real.log C / (n k : ℝ) + Real.log b := by + filter_upwards [hu, hbound, hn.eventually (eventually_gt_atTop 0)] with k huk hk hnk + have hnpos : (0 : ℝ) < n k := by exact_mod_cast hnk + have hlog := Real.log_le_log huk hk + rw [Real.log_mul hC.ne' (pow_ne_zero _ hb.ne'), Real.log_pow] at hlog + calc + Real.log (u k) / (n k : ℝ) ≤ + (Real.log C + (n k : ℝ) * Real.log b) / (n k : ℝ) := + (div_le_div_iff_of_pos_right hnpos).2 hlog + _ = Real.log C / (n k : ℝ) + Real.log b := by + field_simp + have hL : L ≤ Real.log b := le_of_tendsto_of_tendsto hlim hconstant hnormalized + simpa only [Real.exp_log hb] using Real.exp_le_exp.mpr hL + +end MatrixMultiplication.AuxiliarySeparation + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Growth/Product.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Growth/Product.lean new file mode 100644 index 0000000000000000000000000000000000000000..a629f59b4a32faa4aaba8fdac2bc2b62854a1588 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Growth/Product.lean @@ -0,0 +1,65 @@ +import Mathlib.Basic.Real.Basic +import Mathlib.Tactic + +namespace OAI + +/-! +# Exact growth of the product in Section 6 + +The paper's sequence starts at `G₁ = 1`. Here `growthProduct n` denotes +`Gₙ₊₁`. Cubing each factor gives an elementary lower bound, so no logarithmic +asymptotics are needed for this part of the argument. +-/ + +namespace MatrixMultiplication.AuxiliarySeparation + +/-- The product sequence from Section 6, indexed from zero. -/ +noncomputable def growthProduct : ℕ → ℝ + | 0 => 1 + | n + 1 => growthProduct n * (1 + 1 / (3 * ((n : ℝ) + 1))) + +@[simp] theorem growthProduct_zero : growthProduct 0 = 1 := rfl + +@[simp] theorem growthProduct_succ (n : ℕ) : + growthProduct (n + 1) = growthProduct n * (1 + 1 / (3 * ((n : ℝ) + 1))) := rfl + +theorem growthProduct_pos (n : ℕ) : 0 < growthProduct n := by + induction n with + | zero => norm_num + | succ n ih => + rw [growthProduct_succ] + exact mul_pos ih (by positivity) + +/-- Cubing one product factor dominates the corresponding telescoping factor. -/ +theorem one_add_recip_three_cube_lower {a : ℝ} (ha : 0 < a) : + 1 + 1 / a ≤ (1 + 1 / (3 * a)) ^ 3 := by + have hnonneg : 0 ≤ 1 / (3 * a) := by positivity + have hdiv : 1 / a = 3 * (1 / (3 * a)) := by + field_simp + rw [hdiv] + nlinarith [sq_nonneg (1 / (3 * a)), + mul_nonneg (sq_nonneg (1 / (3 * a))) hnonneg] + +/-- The exact lower bound `Gₙ₊₁³ ≥ n + 1`. -/ +theorem growthProduct_cube_lower (n : ℕ) : + (n : ℝ) + 1 ≤ growthProduct n ^ 3 := by + induction n with + | zero => norm_num + | succ n ih => + have ha : 0 < (n : ℝ) + 1 := by positivity + have hfactor := one_add_recip_three_cube_lower ha + have hfactor_nonneg : 0 ≤ (1 + 1 / (3 * ((n : ℝ) + 1))) ^ 3 := by + positivity + have hfirst := mul_le_mul_of_nonneg_right ih hfactor_nonneg + have hsecond := mul_le_mul_of_nonneg_left hfactor (le_of_lt ha) + have htelescoping : ((n : ℝ) + 1) * (1 + 1 / ((n : ℝ) + 1)) = + (n : ℝ) + 2 := by + field_simp + ring + rw [growthProduct_succ, mul_pow] + push_cast + linarith + +end MatrixMultiplication.AuxiliarySeparation + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Growth/Profile.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Growth/Profile.lean new file mode 100644 index 0000000000000000000000000000000000000000..f65e86ff8c5c2f4ec93aa88c50547ea85e7d5639 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Growth/Profile.lean @@ -0,0 +1,139 @@ +import OAI.LinearAlgebra.MatrixMultiplication.AuxiliarySeparation.Growth.ConcaveSlopes +import OAI.LinearAlgebra.MatrixMultiplication.AuxiliarySeparation.Growth.ProfileSlopes +import OAI.LinearAlgebra.MatrixMultiplication.AuxiliarySeparation.Growth.Recurrence +import OAI.LinearAlgebra.MatrixMultiplication.AuxiliarySeparation.Arithmetic.ExponentComparison + +namespace OAI + +/-! +# Growth of the scalar profile + +This file proves the scalar implication of Section 6 (Lemma 6.1). The profile +properties are explicit hypotheses: the construction of a profile from a tensor +character and the proof of those properties are separate arguments. +-/ + +namespace MatrixMultiplication.AuxiliarySeparation + +open Filter +open scoped Topology + +/-- The scalar profile hypotheses used in Section 6. Only positive indices +carry mathematical content; the values on either coordinate axis are unused. -/ +structure ScalarProfile (t : ℝ) where + value : ℕ → ℕ → ℝ + positive : ∀ a b : ℕ, 1 ≤ a → 1 ≤ b → 0 < value a b + symmetric : ∀ a b : ℕ, 1 ≤ a → 1 ≤ b → value a b = value b a + boundary : ∀ b : ℕ, 1 ≤ b → value 1 b = (b : ℝ) + concave : ∀ a h : ℕ, 1 ≤ a → 2 ≤ h → + value a (h - 1) + value a (h + 1) ≤ 2 * value a h + tripling : ∀ a h : ℕ, 1 ≤ a → 1 ≤ h → + 3 * value a h ≤ value a (3 * h + a - 1) + rank_bound : ∀ a b : ℕ, 1 ≤ a → 1 ≤ b → + value a b ≤ ((a : ℝ) + (b : ℝ) - 1) ^ (1 / t) + +namespace ScalarProfile + +/-- Each row has a nonnegative limiting slope that bounds every increment +from below and equals the limit of the row divided by its index. -/ +theorem exists_row_slope {t : ℝ} (P : ScalarProfile t) (a : ℕ) (ha : 1 ≤ a) : + ∃ g : ℝ, 0 ≤ g ∧ + (∀ h : ℕ, 1 ≤ h → g ≤ P.value a (h + 1) - P.value a h) ∧ + Tendsto (fun h : ℕ => P.value a h / (h : ℝ)) atTop (𝓝 g) := by + have hd : Antitone (fun n : ℕ => P.value a (n + 2) - P.value a (n + 1)) := by + apply antitone_nat_of_succ_le + intro n + have hc := P.concave a (n + 2) ha (by omega) + have hpred : n + 2 - 1 = n + 1 := by omega + rw [hpred] at hc + simp only [Nat.add_assoc] at * + linarith + obtain ⟨g, hg, hinc, _, hratio⟩ := exists_concave_slope_limit + (P := P.value a) (fun n => P.positive a (n + 1) ha (by omega)) hd + refine ⟨g, hg, ?_, hratio⟩ + intro h hh + cases h with + | zero => omega + | succ n => simpa only [Nat.add_assoc] using hinc n + +/-- Choose the row slopes together, retaining their bounds and limits on all +positive rows. -/ +theorem exists_row_slopes {t : ℝ} (P : ScalarProfile t) : + ∃ g : ℕ → ℝ, ∀ a : ℕ, 1 ≤ a → 0 ≤ g a ∧ + (∀ h : ℕ, 1 ≤ h → g a ≤ P.value a (h + 1) - P.value a h) ∧ + Tendsto (fun h : ℕ => P.value a h / (h : ℝ)) atTop (𝓝 (g a)) := by + classical + have hex (a : ℕ) : ∃ g : ℝ, 1 ≤ a → 0 ≤ g ∧ + (∀ h : ℕ, 1 ≤ h → g ≤ P.value a (h + 1) - P.value a h) ∧ + Tendsto (fun h : ℕ => P.value a h / (h : ℝ)) atTop (𝓝 g) := by + by_cases ha : 1 ≤ a + · obtain ⟨g, hg⟩ := P.exists_row_slope a ha + exact ⟨g, fun _ => hg⟩ + · exact ⟨0, fun ha' => False.elim (ha ha')⟩ + choose g hg using hex + exact ⟨g, hg⟩ + +/-- The exact polynomial lower bound on the diagonal, obtained from row +concavity, shifted tripling, and the simultaneous scalar induction. -/ +theorem diagonal_fourth_power_lower {t : ℝ} (P : ScalarProfile t) + (n : ℕ) (hn : 1 ≤ n) : (n : ℝ) ^ 4 ≤ P.value n n ^ 3 := by + obtain ⟨g, hg⟩ := P.exists_row_slopes + have hupper : ∀ a : ℕ, 1 ≤ a → + P.value a a ≤ ((3 * (a : ℝ) - 1) / 2) * g a := by + apply profile_diagonal_le_slope + · intro a ha h hh + exact P.tripling a h ha hh + · intro a ha + exact (hg a ha).2.2 + have hincrement : ∀ a : ℕ, 1 ≤ a → + P.value a a + g a + g (a + 1) ≤ P.value (a + 1) (a + 1) := by + apply diagonal_increment_of_slope_lower + · intro a ha b hb + exact P.symmetric a b ha hb + · intro a ha h hh + exact (hg a ha).2.1 h hh + have hDbase : 1 ≤ P.value 1 1 := by + rw [P.boundary 1 (by omega)] + norm_num + have hgbase : 1 ≤ g 1 := by + have hu := hupper 1 (by omega) + rw [P.boundary 1 (by omega)] at hu + norm_num at hu + exact hu + exact MatrixMultiplication.AuxiliarySeparation.diagonal_fourth_power_lower_of_one_le + (fun a => P.value a a) g hgbase hDbase hupper hincrement n hn + +/-- Lemma 6.1: a positive symmetric profile satisfying the stated concavity, +tripling, boundary, and rank bounds has exponent at most `3/4`. -/ +theorem exponent_le_three_quarters {t : ℝ} (P : ScalarProfile t) (ht : 0 < t) : + t ≤ 3 / 4 := by + apply diagonal_exponent_le_three_quarters (D := fun a => P.value a a) ht + · intro n hn + exact (P.positive n n hn hn).le + · exact P.diagonal_fourth_power_lower + · intro n hn + have hu := P.rank_bound n n hn hn + simpa only [two_mul] using hu + +end ScalarProfile + +/-- The scalar profile implication, with every profile assumption displayed +explicitly rather than bundled in `ScalarProfile`. -/ +theorem profile_exponent_le_three_quarters {P : ℕ → ℕ → ℝ} {t : ℝ} + (ht : 0 < t) + (hpositive : ∀ a b : ℕ, 1 ≤ a → 1 ≤ b → 0 < P a b) + (hsymmetric : ∀ a b : ℕ, 1 ≤ a → 1 ≤ b → P a b = P b a) + (hboundary : ∀ b : ℕ, 1 ≤ b → P 1 b = (b : ℝ)) + (hconcave : ∀ a h : ℕ, 1 ≤ a → 2 ≤ h → + P a (h - 1) + P a (h + 1) ≤ 2 * P a h) + (htripling : ∀ a h : ℕ, 1 ≤ a → 1 ≤ h → + 3 * P a h ≤ P a (3 * h + a - 1)) + (hrank : ∀ a b : ℕ, 1 ≤ a → 1 ≤ b → + P a b ≤ ((a : ℝ) + (b : ℝ) - 1) ^ (1 / t)) : + t ≤ 3 / 4 := by + exact ScalarProfile.exponent_le_three_quarters + ⟨P, hpositive, hsymmetric, hboundary, hconcave, htripling, hrank⟩ ht + +end MatrixMultiplication.AuxiliarySeparation + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Growth/ProfileSlopes.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Growth/ProfileSlopes.lean new file mode 100644 index 0000000000000000000000000000000000000000..540bb82495c86928530e023d2291b5f753446077 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Growth/ProfileSlopes.lean @@ -0,0 +1,149 @@ +import OAI.LinearAlgebra.MatrixMultiplication.AuxiliarySeparation.Growth.ConcaveSlopes + +namespace OAI + +/-! +# Shifted tripling and diagonal increments + +These are the two estimates on the limiting row slopes used in Section 6. +Iteration retains the additive shift in the tripling inequality. Symmetry +then expresses a diagonal step as one increment in each of two adjacent rows. +-/ + +namespace MatrixMultiplication.AuxiliarySeparation + +open Filter +open scoped Topology + +/-- The indices obtained by repeatedly applying the affine tripling map. -/ +def shiftedTriplingIndex (c h : ℕ) : ℕ → ℕ + | 0 => h + | j + 1 => 3 * shiftedTriplingIndex c h j + c + +/-- Starting at a positive index, affine tripling escapes to infinity. -/ +theorem shiftedTriplingIndex_lower (c h : ℕ) (hh : 1 ≤ h) (j : ℕ) : + h + j ≤ shiftedTriplingIndex c h j := by + induction j with + | zero => simp [shiftedTriplingIndex] + | succ j ih => + simp only [shiftedTriplingIndex] + omega + +theorem shiftedTriplingIndex_tendsto (c h : ℕ) (hh : 1 ≤ h) : + Tendsto (shiftedTriplingIndex c h) atTop atTop := by + apply tendsto_atTop_mono _ tendsto_id + intro j + change j ≤ shiftedTriplingIndex c h j + have := shiftedTriplingIndex_lower c h hh j + omega + +/-- The exact affine solution, written without truncated natural subtraction. -/ +theorem shiftedTriplingIndex_cast (c h j : ℕ) : + (shiftedTriplingIndex c h j : ℝ) + (c : ℝ) / 2 = + (3 : ℝ) ^ j * ((h : ℝ) + (c : ℝ) / 2) := by + induction j with + | zero => simp [shiftedTriplingIndex] + | succ j ih => + simp only [shiftedTriplingIndex, Nat.cast_add, Nat.cast_mul, Nat.cast_ofNat, + pow_succ] + nlinarith + +/-- Iterating the tripling inequality multiplies the profile by powers of three. -/ +theorem shiftedTripling_profile_lower {P : ℕ → ℝ} {c h : ℕ} (hh : 1 ≤ h) + (htrip : ∀ n : ℕ, 1 ≤ n → 3 * P n ≤ P (3 * n + c)) (j : ℕ) : + (3 : ℝ) ^ j * P h ≤ P (shiftedTriplingIndex c h j) := by + induction j with + | zero => simp [shiftedTriplingIndex] + | succ j ih => + have hj : 1 ≤ shiftedTriplingIndex c h j := by + have := shiftedTriplingIndex_lower c h hh j + omega + have hstep := htrip (shiftedTriplingIndex c h j) hj + simp only [shiftedTriplingIndex, pow_succ] + nlinarith + +/-- A row with a limiting linear slope and shifted tripling lies below the +corresponding affine multiple of that slope. -/ +theorem profile_le_affine_slope {P : ℕ → ℝ} {g : ℝ} {c h : ℕ} + (hh : 1 ≤ h) + (htrip : ∀ n : ℕ, 1 ≤ n → 3 * P n ≤ P (3 * n + c)) + (hlim : Tendsto (fun n : ℕ => P n / (n : ℝ)) atTop (𝓝 g)) : + P h ≤ ((h : ℝ) + (c : ℝ) / 2) * g := by + have hpow : Tendsto (fun j : ℕ => (3 : ℝ) ^ j) atTop atTop := + tendsto_pow_atTop_atTop_of_one_lt (by norm_num) + have hzero : Tendsto (fun j : ℕ => ((c : ℝ) / 2) / (3 : ℝ) ^ j) + atTop (𝓝 0) := hpow.const_div_atTop _ + have hindex : Tendsto + (fun j : ℕ => (shiftedTriplingIndex c h j : ℝ) / (3 : ℝ) ^ j) + atTop (𝓝 ((h : ℝ) + (c : ℝ) / 2)) := by + have heq (j : ℕ) : + (shiftedTriplingIndex c h j : ℝ) / (3 : ℝ) ^ j = + (h : ℝ) + (c : ℝ) / 2 - ((c : ℝ) / 2) / (3 : ℝ) ^ j := by + have hj := shiftedTriplingIndex_cast c h j + have hp : (3 : ℝ) ^ j ≠ 0 := pow_ne_zero _ (by norm_num) + field_simp + nlinarith + simpa only [heq, sub_zero] using tendsto_const_nhds.sub hzero + have hproduct := (hlim.comp (shiftedTriplingIndex_tendsto c h hh)).mul hindex + have hprofile : Tendsto + (fun j : ℕ => P (shiftedTriplingIndex c h j) / (3 : ℝ) ^ j) + atTop (𝓝 (g * ((h : ℝ) + (c : ℝ) / 2))) := by + apply hproduct.congr' + apply Eventually.of_forall + intro j + have hj : (shiftedTriplingIndex c h j : ℝ) ≠ 0 := by + have := shiftedTriplingIndex_lower c h hh j + exact_mod_cast (show shiftedTriplingIndex c h j ≠ 0 by omega) + dsimp only [Function.comp_def] + field_simp + have hbound : ∀ j : ℕ, P h ≤ P (shiftedTriplingIndex c h j) / (3 : ℝ) ^ j := by + intro j + apply (le_div_iff₀ (pow_pos (by norm_num : (0 : ℝ) < 3) j)).mpr + simpa only [mul_comm] using shiftedTripling_profile_lower hh htrip j + simpa only [mul_comm] using ge_of_tendsto hprofile (Eventually.of_forall hbound) + +/-- The row estimate in the positive-index notation of the paper. -/ +theorem profile_row_le_slope {P : ℕ → ℕ → ℝ} {g : ℕ → ℝ} + (htrip : ∀ a : ℕ, 1 ≤ a → ∀ h : ℕ, 1 ≤ h → + 3 * P a h ≤ P a (3 * h + a - 1)) + (hlim : ∀ a : ℕ, 1 ≤ a → + Tendsto (fun h : ℕ => P a h / (h : ℝ)) atTop (𝓝 (g a))) + (a h : ℕ) (ha : 1 ≤ a) (hh : 1 ≤ h) : + P a h ≤ ((h : ℝ) + ((a : ℝ) - 1) / 2) * g a := by + have ht : ∀ n : ℕ, 1 ≤ n → 3 * P a n ≤ P a (3 * n + (a - 1)) := by + intro n hn + have hi : 3 * n + (a - 1) = 3 * n + a - 1 := by omega + rw [hi] + exact htrip a ha n hn + have hcast : ((a - 1 : ℕ) : ℝ) = (a : ℝ) - 1 := by + rw [Nat.cast_sub ha, Nat.cast_one] + simpa only [hcast] using profile_le_affine_slope hh ht (hlim a ha) + +/-- The diagonal is bounded above by the limiting row slope with the precise +coefficient `(3a-1)/2`. -/ +theorem profile_diagonal_le_slope {P : ℕ → ℕ → ℝ} {g : ℕ → ℝ} + (htrip : ∀ a : ℕ, 1 ≤ a → ∀ h : ℕ, 1 ≤ h → + 3 * P a h ≤ P a (3 * h + a - 1)) + (hlim : ∀ a : ℕ, 1 ≤ a → + Tendsto (fun h : ℕ => P a h / (h : ℝ)) atTop (𝓝 (g a))) + (a : ℕ) (ha : 1 ≤ a) : + P a a ≤ ((3 * (a : ℝ) - 1) / 2) * g a := by + have hc : (a : ℝ) + ((a : ℝ) - 1) / 2 = (3 * (a : ℝ) - 1) / 2 := by ring + simpa only [hc] using profile_row_le_slope htrip hlim a a ha ha + +/-- Symmetry identifies a diagonal step with one increment in each adjacent +row. Only positive-index symmetry and slope bounds are used. -/ +theorem diagonal_increment_of_slope_lower {P : ℕ → ℕ → ℝ} {g : ℕ → ℝ} + (hsymm : ∀ a : ℕ, 1 ≤ a → ∀ b : ℕ, 1 ≤ b → P a b = P b a) + (hinc : ∀ a : ℕ, 1 ≤ a → ∀ h : ℕ, 1 ≤ h → + g a ≤ P a (h + 1) - P a h) + (n : ℕ) (hn : 1 ≤ n) : + P n n + g n + g (n + 1) ≤ P (n + 1) (n + 1) := by + have hfirst := hinc n hn n hn + have hsecond := hinc (n + 1) (by omega) n hn + have hsym := hsymm n hn (n + 1) (by omega) + linarith + +end MatrixMultiplication.AuxiliarySeparation + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Growth/Recurrence.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Growth/Recurrence.lean new file mode 100644 index 0000000000000000000000000000000000000000..de92ce2e9f03c16f2b477b5d0eb39fcabde013e6 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Growth/Recurrence.lean @@ -0,0 +1,183 @@ +import OAI.LinearAlgebra.MatrixMultiplication.AuxiliarySeparation.Growth.Product + +namespace OAI + +/-! +# The scalar simultaneous induction in Section 6 + +The two diagonal inequalities imply, simultaneously, lower bounds for the +limiting row slopes and for the diagonal profile. All profile properties +needed for this argument are expressed as hypotheses below. +-/ + +namespace MatrixMultiplication.AuxiliarySeparation + +/-- One step of the Section 6 simultaneous induction, with a positive real +index. The proof uses the diagonal increment inequality to obtain the second +conclusion as well as the first. -/ +theorem growthRecurrence_step_real + {n Dprev Dnext gprev gnext Gprev : ℝ} (hn : 0 < n) + (hupper : Dnext ≤ ((3 * (n + 1) - 1) / 2) * gnext) + (hincrement : Dprev + gprev + gnext ≤ Dnext) + (hgprev : Gprev ≤ gprev) + (hDprev : ((3 * n - 1) / 2) * Gprev ≤ Dprev) : + (1 + 1 / (3 * n)) * Gprev ≤ gnext ∧ + ((3 * (n + 1) - 1) / 2) * ((1 + 1 / (3 * n)) * Gprev) ≤ Dnext := by + have hden : 0 < 3 * n := by positivity + have hbound : (3 * n + 1) * Gprev ≤ (3 * n) * gnext := by + nlinarith + have hidentity : (1 + 1 / (3 * n)) * Gprev = + ((3 * n + 1) * Gprev) / (3 * n) := by + field_simp + have hgnew : (1 + 1 / (3 * n)) * Gprev ≤ gnext := by + rw [hidentity] + exact (div_le_iff₀ hden).mpr (by simpa only [mul_comm] using hbound) + refine ⟨hgnew, ?_⟩ + have hdiagonal : ((3 * (n + 1) - 1) / 2) * + ((1 + 1 / (3 * n)) * Gprev) = + ((3 * n - 1) / 2) * Gprev + Gprev + + (1 + 1 / (3 * n)) * Gprev := by + field_simp + ring + rw [hdiagonal] + linarith + +/-- The natural-number form of the scalar induction step, indexed by `n + 1` +so that no truncated subtraction occurs in the recurrence. -/ +theorem growthRecurrence_step + {n : ℕ} (hn : 1 ≤ n) {Dprev Dnext gprev gnext Gprev : ℝ} + (hupper : Dnext ≤ ((3 * ((n : ℝ) + 1) - 1) / 2) * gnext) + (hincrement : Dprev + gprev + gnext ≤ Dnext) + (hgprev : Gprev ≤ gprev) + (hDprev : ((3 * (n : ℝ) - 1) / 2) * Gprev ≤ Dprev) : + (1 + 1 / (3 * (n : ℝ))) * Gprev ≤ gnext ∧ + ((3 * ((n : ℝ) + 1) - 1) / 2) * + ((1 + 1 / (3 * (n : ℝ))) * Gprev) ≤ Dnext := by + apply growthRecurrence_step_real + · exact_mod_cast (show 0 < n by omega) + · exact hupper + · exact hincrement + · exact hgprev + · exact hDprev + +/-- The simultaneous slope and diagonal estimates, conditional only on the +initial values, the recurrence for `G`, and the two diagonal inequalities. -/ +theorem growthRecurrence_induction + (D g G : ℕ → ℝ) + (hGbase : G 1 = 1) + (hgbase : 1 ≤ g 1) + (hDbase : 1 ≤ D 1) + (hGstep : ∀ n : ℕ, 1 ≤ n → + G (n + 1) = (1 + 1 / (3 * (n : ℝ))) * G n) + (hupper : ∀ n : ℕ, 1 ≤ n → + D n ≤ ((3 * (n : ℝ) - 1) / 2) * g n) + (hincrement : ∀ n : ℕ, 1 ≤ n → + D n + g n + g (n + 1) ≤ D (n + 1)) : + ∀ n : ℕ, 1 ≤ n → G n ≤ g n ∧ ((3 * (n : ℝ) - 1) / 2) * G n ≤ D n := by + intro n hn + induction n, hn using Nat.le_induction with + | base => + norm_num [hGbase] + exact ⟨hgbase, hDbase⟩ + | succ n hn ih => + have hu : D (n + 1) ≤ + ((3 * ((n : ℝ) + 1) - 1) / 2) * g (n + 1) := by + simpa only [Nat.cast_add, Nat.cast_one] using hupper (n + 1) (by omega) + have hs := growthRecurrence_step hn hu (hincrement n hn) ih.1 ih.2 + simpa only [hGstep n hn, Nat.cast_add, Nat.cast_one] using hs + +/-- A zero-indexed version of `growthRecurrence_induction`, convenient when the +initial term of the comparison sequence is stored at index zero. -/ +theorem growthRecurrence_induction_shifted + (D g H : ℕ → ℝ) + (hHbase : H 0 = 1) + (hgbase : 1 ≤ g 1) + (hDbase : 1 ≤ D 1) + (hHstep : ∀ n : ℕ, + H (n + 1) = (1 + 1 / (3 * ((n : ℝ) + 1))) * H n) + (hupper : ∀ n : ℕ, 1 ≤ n → + D n ≤ ((3 * (n : ℝ) - 1) / 2) * g n) + (hincrement : ∀ n : ℕ, 1 ≤ n → + D n + g n + g (n + 1) ≤ D (n + 1)) : + ∀ n : ℕ, H n ≤ g (n + 1) ∧ + ((3 * ((n : ℝ) + 1) - 1) / 2) * H n ≤ D (n + 1) := by + intro n + induction n with + | zero => + norm_num [hHbase] + exact ⟨hgbase, hDbase⟩ + | succ n ih => + have hn : 1 ≤ n + 1 := by omega + have hu : D (n + 1 + 1) ≤ + ((3 * (((n + 1 : ℕ) : ℝ) + 1) - 1) / 2) * g (n + 1 + 1) := by + simpa only [Nat.cast_add, Nat.cast_one] using + hupper (n + 1 + 1) (by omega) + have hp : ((3 * ((n + 1 : ℕ) : ℝ) - 1) / 2) * H n ≤ D (n + 1) := by + simpa only [Nat.cast_add, Nat.cast_one] using ih.2 + have hs := growthRecurrence_step hn hu (hincrement (n + 1) hn) ih.1 hp + simpa only [hHstep, Nat.cast_add, Nat.cast_one] using hs + +/-- The simultaneous bounds for the explicit comparison product from Section 6. -/ +theorem growthProduct_le_slope_and_diagonal + (D g : ℕ → ℝ) + (hgbase : 1 ≤ g 1) + (hDbase : 1 ≤ D 1) + (hupper : ∀ n : ℕ, 1 ≤ n → + D n ≤ ((3 * (n : ℝ) - 1) / 2) * g n) + (hincrement : ∀ n : ℕ, 1 ≤ n → + D n + g n + g (n + 1) ≤ D (n + 1)) : + ∀ n : ℕ, growthProduct n ≤ g (n + 1) ∧ + ((3 * ((n : ℝ) + 1) - 1) / 2) * growthProduct n ≤ D (n + 1) := by + apply growthRecurrence_induction_shifted D g growthProduct + growthProduct_zero hgbase hDbase + · intro n + rw [growthProduct_succ, mul_comm] + · exact hupper + · exact hincrement + +/-- Combining the scalar induction with the elementary product estimate gives +an exact fourth-power lower bound on the cube of each diagonal value. -/ +theorem diagonal_fourth_power_lower + (D g : ℕ → ℝ) + (hgbase : 1 ≤ g 1) + (hDbase : 1 ≤ D 1) + (hupper : ∀ n : ℕ, 1 ≤ n → + D n ≤ ((3 * (n : ℝ) - 1) / 2) * g n) + (hincrement : ∀ n : ℕ, 1 ≤ n → + D n + g n + g (n + 1) ≤ D (n + 1)) + (n : ℕ) : + ((n : ℝ) + 1) ^ 4 ≤ D (n + 1) ^ 3 := by + have hdiag := (growthProduct_le_slope_and_diagonal D g hgbase hDbase + hupper hincrement n).2 + have hpositive := growthProduct_pos n + have hlinear : ((n : ℝ) + 1) * growthProduct n ≤ D (n + 1) := by + have hcoeff : (n : ℝ) + 1 ≤ (3 * ((n : ℝ) + 1) - 1) / 2 := by + have hn : (0 : ℝ) ≤ n := Nat.cast_nonneg n + linarith + exact (mul_le_mul_of_nonneg_right hcoeff (le_of_lt hpositive)).trans hdiag + calc + ((n : ℝ) + 1) ^ 4 = ((n : ℝ) + 1) ^ 3 * ((n : ℝ) + 1) := by ring + _ ≤ ((n : ℝ) + 1) ^ 3 * growthProduct n ^ 3 := + mul_le_mul_of_nonneg_left (growthProduct_cube_lower n) (by positivity) + _ = (((n : ℝ) + 1) * growthProduct n) ^ 3 := by ring + _ ≤ D (n + 1) ^ 3 := pow_le_pow_left₀ (by positivity) hlinear 3 + +/-- The diagonal fourth-power lower bound using the paper's positive indices. -/ +theorem diagonal_fourth_power_lower_of_one_le + (D g : ℕ → ℝ) + (hgbase : 1 ≤ g 1) + (hDbase : 1 ≤ D 1) + (hupper : ∀ n : ℕ, 1 ≤ n → + D n ≤ ((3 * (n : ℝ) - 1) / 2) * g n) + (hincrement : ∀ n : ℕ, 1 ≤ n → + D n + g n + g (n + 1) ≤ D (n + 1)) + (n : ℕ) (hn : 1 ≤ n) : (n : ℝ) ^ 4 ≤ D n ^ 3 := by + cases n with + | zero => omega + | succ n => + simpa only [Nat.cast_add, Nat.cast_one] using + diagonal_fourth_power_lower D g hgbase hDbase hupper hincrement n + +end MatrixMultiplication.AuxiliarySeparation + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Growth/SpectralLimit.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Growth/SpectralLimit.lean new file mode 100644 index 0000000000000000000000000000000000000000..491d7410f17006b3c1852a80cf21fa2977829ab3 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Growth/SpectralLimit.lean @@ -0,0 +1,76 @@ +import Mathlib.Analysis.SpecialFunctions.Pow.Continuity +import Mathlib.Analysis.SpecificLimits.Basic +import Mathlib.Tactic + +namespace OAI + +/-! +# Removing positive slack from the spectral inequality + +The positive slack in the exponent can be sent to zero with the matrix size +fixed. A bound at all positive natural sizes then removes a fixed additive +error term. +-/ + +namespace MatrixMultiplication.AuxiliarySeparation + +open Filter Topology + +/-- Continuity removes the positive slack in the spectral exponent. -/ +theorem spectral_bound_of_positive_slack {ν k D : ℝ} {d n : ℕ} + (hν : 0 < ν) (hn : 1 ≤ n) + (hbound : ∀ δ : ℝ, 0 < δ → + (d : ℝ) ^ ν * (n : ℝ) ^ (ν / (ν + δ)) ≤ (n : ℝ) * k + D) : + (d : ℝ) ^ ν * (n : ℝ) ≤ (n : ℝ) * k + D := by + have hn0 : (n : ℝ) ≠ 0 := by + have : (0 : ℝ) < n := by exact_mod_cast (lt_of_lt_of_le Nat.zero_lt_one hn) + exact this.ne' + have hδ : Tendsto (fun m : ℕ => 1 / ((m : ℝ) + 1)) atTop (𝓝 0) := + tendsto_one_div_add_atTop_nhds_zero_nat + have hdenom : Tendsto (fun m : ℕ => ν + 1 / ((m : ℝ) + 1)) + atTop (𝓝 ν) := by + simpa only [add_zero] using (tendsto_const_nhds (x := ν)).add hδ + have hexponent : Tendsto (fun m : ℕ => ν / (ν + 1 / ((m : ℝ) + 1))) + atTop (𝓝 1) := by + have h : Tendsto (fun m : ℕ => ν / (ν + 1 / ((m : ℝ) + 1))) + atTop (𝓝 (ν / ν)) := by + exact (tendsto_const_nhds (x := ν)).div hdenom hν.ne' + rwa [div_self hν.ne'] at h + have hpower : Tendsto + (fun m : ℕ => (d : ℝ) ^ ν * (n : ℝ) ^ (ν / (ν + 1 / ((m : ℝ) + 1)))) + atTop (𝓝 ((d : ℝ) ^ ν * (n : ℝ))) := by + simpa using tendsto_const_nhds.mul + ((Real.continuousAt_const_rpow hn0).tendsto.comp hexponent) + exact le_of_tendsto' hpower fun m => hbound _ (by positivity) + +/-- A fixed additive error cannot enlarge a coefficient bounded at every +positive natural size. -/ +theorem coefficient_le_of_nat_mul_bound {a k D : ℝ} + (hbound : ∀ n : ℕ, 1 ≤ n → a * (n : ℝ) ≤ (n : ℝ) * k + D) : + a ≤ k := by + by_contra h + have hgap : 0 < a - k := sub_pos.mpr (lt_of_not_ge h) + obtain ⟨n, hn⟩ := exists_nat_gt (max (D / (a - k)) 0) + have hn0 : (0 : ℝ) < n := lt_of_le_of_lt (le_max_right _ _) hn + have hn1 : 1 ≤ n := by + have : 0 < n := by exact_mod_cast hn0 + omega + have hlarge : D < (n : ℝ) * (a - k) := + (div_lt_iff₀ hgap).mp (lt_of_le_of_lt (le_max_left _ _) hn) + have hsmall := hbound n hn1 + nlinarith + +/-- Uniform spectral inequalities for all positive sizes and all positive +slacks force the desired coefficient bound. -/ +theorem spectral_coefficient_le_of_all_nat {ν k D : ℝ} {d : ℕ} + (hν : 0 < ν) + (hbound : ∀ n : ℕ, 1 ≤ n → ∀ δ : ℝ, 0 < δ → + (d : ℝ) ^ ν * (n : ℝ) ^ (ν / (ν + δ)) ≤ (n : ℝ) * k + D) : + (d : ℝ) ^ ν ≤ k := by + apply coefficient_le_of_nat_mul_bound + intro n hn + exact spectral_bound_of_positive_slack hν hn (hbound n hn) + +end MatrixMultiplication.AuxiliarySeparation + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Main.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Main.lean new file mode 100644 index 0000000000000000000000000000000000000000..53e8412da4ba65eee8effd0f7963e6d3b2aade99 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Main.lean @@ -0,0 +1,33 @@ +import OAI.LinearAlgebra.MatrixMultiplication.AuxiliarySeparation.Arithmetic.Exponent +import OAI.LinearAlgebra.MatrixMultiplication.AuxiliarySeparation.Arithmetic.RankBound +import OAI.LinearAlgebra.MatrixMultiplication.AuxiliarySeparation.Convolution.RankLowerBound +import OAI.LinearAlgebra.MatrixMultiplication.AuxiliarySeparation.Determinant.Bounds +import OAI.LinearAlgebra.MatrixMultiplication.AuxiliarySeparation.Growth.Floor + +namespace OAI + +/-! +# Matrix multiplication via auxiliary separation and polynomial multiplication + +Theorem 1.1 gives a uniform arithmetic-operation bound for complex square +matrix multiplication, and consequently an upper bound of `9/4` on its exponent. +The two conclusions are stated separately in the existing arithmetic model. +-/ + +namespace MatrixMultiplication.AuxiliarySeparation + +/-- Theorem 1.1: for every positive exponent slack, one constant bounds the cost +of correct complex matrix multiplication programs at every positive size. -/ +theorem matrix_multiplication_cost_le (ε : ℝ) (hε : 0 < ε) : + ∃ C : ℝ, 0 < C ∧ ∀ n : ℕ, 1 ≤ n → + ∃ P : Arithmetic.MatrixAlgorithm ℂ n n n, + P.Correct ∧ (P.cost : ℝ) ≤ C * (n : ℝ) ^ ((9 : ℝ) / 4 + ε) := + arithmeticComplexity_of_exactRankExponent_le exactRankExponent_le_nine_quarters ε hε + +/-- The complex arithmetic matrix multiplication exponent is at most `9/4`. -/ +theorem omega_le_nine_quarters : Arithmetic.omega ℂ ≤ (9 : ℝ) / 4 := + omega_le_exactRankExponent.trans exactRankExponent_le_nine_quarters + +end MatrixMultiplication.AuxiliarySeparation + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Polynomial/Inequalities.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Polynomial/Inequalities.lean new file mode 100644 index 0000000000000000000000000000000000000000..90256d33ffdbb4699d6fbfe19408b9870c0b9990 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Polynomial/Inequalities.lean @@ -0,0 +1,126 @@ +import OAI.LinearAlgebra.MatrixMultiplication.AuxiliarySeparation.Convolution.Symmetry +import OAI.LinearAlgebra.MatrixMultiplication.AuxiliarySeparation.Character.Permutation +import OAI.LinearAlgebra.MatrixMultiplication.AuxiliarySeparation.Polynomial.Laws +import OAI.LinearAlgebra.MatrixMultiplication.AuxiliarySeparation.Determinant.Character +import OAI.LinearAlgebra.MatrixMultiplication.AuxiliarySeparation.Sector.Character +import OAI.LinearAlgebra.MatrixMultiplication.AuxiliarySeparation.Polynomial.ProductBounds +import OAI.LinearAlgebra.MatrixMultiplication.AuxiliarySeparation.Growth.Profile + +namespace OAI + +/-! +# The inequalities for the polynomial profile + +The six character values are combined before the common probability law is +optimized. Each first-leg exponent occurs twice, so the total entropy exponent +is exactly six times the mean exponent used to normalize the profile. +-/ + +noncomputable section + +open scoped BigOperators +open MatrixMultiplication.Foundation + +namespace MatrixMultiplication.AuxiliarySeparation.Character + +variable (χ : Character) + +/-- All six permuted characters have the same mean singleton-leg exponent. -/ +theorem permutedCharacter_meanExponent (i : Fin 6) : + (χ.permutedCharacter i).meanExponent = χ.meanExponent := by + fin_cases i <;> simp [permutedCharacter, meanExponent] <;> ring + +/-- The exponents of the six permuted characters have the normalization total. -/ +theorem sum_permutedCharacter_pX_mean : + (∑ i : Fin 6, (χ.permutedCharacter i).pX) = 6 * χ.meanExponent := by + rw [χ.sum_permutedCharacter_pX] + unfold meanExponent + ring + +/-- All six factors associated to a positive-size polynomial tensor are positive. -/ +theorem permutedCharacter_convolution_pos {a b : ℕ} (ha : 0 < a) (hb : 0 < b) + (i : Fin 6) : 0 < (χ.permutedCharacter i).value (convolution a b) := + (χ.permutedCharacter i).value_convolution_pos ha hb + +/-- Exchanging the two output-side positions reorders the six convolution factors. -/ +theorem prod_permutedCharacter_swapped_convolution (a b : ℕ) : + (∏ i : Fin 6, (χ.permutedCharacter i).value + (fun x z y => convolution a b x y z)) = + ∏ i : Fin 6, (χ.permutedCharacter i).value (convolution a b) := by + rw [χ.prod_permutedCharacter_value, χ.prod_permutedCharacter_value] + exact χ.sixfoldProduct_swap23 _ + +/-- The actual polynomial profile is concave in its second positive index. -/ +theorem convolutionProfile_concave {a b : ℕ} (ht : 0 < χ.meanExponent) + (ha : 0 < a) (hb : 2 ≤ b) : + χ.convolutionProfile a (b - 1) + χ.convolutionProfile a (b + 1) ≤ + 2 * χ.convolutionProfile a b := by + have h := finite_product_concavity + (fun i : Fin 6 => (χ.permutedCharacter i).value (convolution a b)) + (fun i : Fin 6 => (χ.permutedCharacter i).value (convolution a (b + 1))) + (fun i : Fin 6 => (χ.permutedCharacter i).value (convolution a (b - 1))) + (fun i : Fin 6 => (χ.permutedCharacter i).pX) + (mul_pos (by norm_num : (0 : ℝ) < 6) ht) χ.sum_permutedCharacter_pX_mean + (fun i => χ.permutedCharacter_convolution_pos ha (by omega) i) + (fun i => χ.permutedCharacter_convolution_pos ha (by omega) i) + (fun i => χ.permutedCharacter_convolution_pos ha (by omega) i) + (fun i q hq₀ hq₁ => + (χ.permutedCharacter i).convolution_concavity_tag a b ha hb q hq₀ hq₁) + simp only [χ.prod_permutedCharacter_value] at h + change χ.convolutionProfile a (b + 1) + χ.convolutionProfile a (b - 1) ≤ + 2 * χ.convolutionProfile a b at h + simpa only [add_comm] using h + +/-- The actual three-sector degeneration triples the normalized profile. -/ +theorem convolutionProfile_tripling {a h : ℕ} (ht : 0 < χ.meanExponent) + (ha : 0 < a) (hh : 0 < h) : + 3 * χ.convolutionProfile a h ≤ χ.convolutionProfile a (3 * h + a - 1) := by + have hsw : (fun i s r => convolution a h i r s) ≠ 0 := by + intro hz + apply convolution_nonzero ha hh + exact congrArg + (fun T : Tensor ℂ (Fin a) (Fin (a + h - 1)) (Fin h) => fun i j k => T i k j) hz + have h := finite_product_tripling + (fun i : Fin 6 => (χ.permutedCharacter i).value (convolution a (3 * h + a - 1))) + (fun i : Fin 6 => (χ.permutedCharacter i).value (convolution a h)) + (fun i : Fin 6 => (χ.permutedCharacter i).value (fun x z y => convolution a h x y z)) + (fun i : Fin 6 => (χ.permutedCharacter i).pX) + (mul_pos (by norm_num : (0 : ℝ) < 6) ht) χ.sum_permutedCharacter_pX_mean + (fun i => χ.permutedCharacter_convolution_pos ha (by omega) i) + (fun i => χ.permutedCharacter_convolution_pos ha hh i) + (fun i => (χ.permutedCharacter i).value_pos hsw) + (fun i => Sector.convolution_tripling_tag (χ.permutedCharacter i) a h ha hh) + (χ.prod_permutedCharacter_swapped_convolution a h) + simpa only [χ.prod_permutedCharacter_value, convolutionProfile, symmetrizedProfile] using h + +/-- The polynomial profile satisfies every hypothesis of the scalar growth theorem. -/ +def toScalarProfile (ht : 0 < χ.meanExponent) : ScalarProfile χ.meanExponent where + value := χ.convolutionProfile + positive a b ha hb := χ.convolutionProfile_pos (by omega) (by omega) + symmetric a b _ _ := χ.convolutionProfile_comm a b + boundary b hb := χ.convolutionProfile_one_left ht (by omega) + concave a b ha hb := χ.convolutionProfile_concave ht (by omega) hb + tripling a h ha hh := χ.convolutionProfile_tripling ht (by omega) (by omega) + rank_bound a b ha hb := by + have h := χ.convolutionProfile_le (a := a) (b := b) ht + have hab : 1 ≤ a + b := by omega + simpa only [Nat.cast_sub hab, Nat.cast_add, Nat.cast_one] using h + +/-- Every actual tensor character has mean singleton-leg exponent at most `3/4`. -/ +theorem meanExponent_le_three_quarters : χ.meanExponent ≤ 3 / 4 := by + by_cases ht : 0 < χ.meanExponent + · exact (χ.toScalarProfile ht).exponent_le_three_quarters ht + · have hle : χ.meanExponent ≤ 0 := le_of_not_gt ht + linarith + +/-- The three dot-product exponents of an actual character sum to at most `9/4`. -/ +theorem exponent_sum_le_nine_quarters : χ.pX + χ.pY + χ.pZ ≤ 9 / 4 := by + have h := χ.meanExponent_le_three_quarters + unfold meanExponent at h + linarith + +end MatrixMultiplication.AuxiliarySeparation.Character + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Polynomial/Interpolation.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Polynomial/Interpolation.lean new file mode 100644 index 0000000000000000000000000000000000000000..fc0293f8baeb4606e62c193c3fcc25c7a8f368a0 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Polynomial/Interpolation.lean @@ -0,0 +1,204 @@ +import OAI.LinearAlgebra.MatrixMultiplication.Polynomial.ComplexPolynomialDegenerationComposition + +namespace OAI + +/-! +# Exact interpolation away from zero + +The coefficient-extraction theorem already proved for matrix multiplication is +used here with the nonzero nodes `1, ..., D + 1`. In particular a polynomial +degeneration can be recovered by a finite sum of its ordinary restrictions at +nonzero parameters, with the leading power divided out at each parameter. +-/ + +noncomputable section + +open scoped BigOperators + +namespace MatrixMultiplication.AuxiliarySeparation + +open MatrixMultiplication.Foundation + +/-- An explicit set of `D + 1` nonzero complex interpolation parameters. -/ +def interpolationNode (D : ℕ) (i : Fin (D + 1)) : ℂ := (i.val + 1 : ℕ) + +theorem interpolationNode_injective (D : ℕ) : + Function.Injective (interpolationNode D) := by + intro i j hij + apply Fin.ext + exact Nat.add_right_cancel (Nat.cast_injective hij) + +theorem interpolationNode_ne_zero (D : ℕ) (i : Fin (D + 1)) : + interpolationNode D i ≠ 0 := by + change ((i.val + 1 : ℕ) : ℂ) ≠ 0 + exact Nat.cast_ne_zero.mpr (Nat.succ_ne_zero i.val) + +/-- The constant-coefficient functional expressed in the Lagrange basis. -/ +def constantInterpolationWeight {ι : Type*} [Fintype ι] [DecidableEq ι] + (nodes : ι → ℂ) (i : ι) : ℂ := + (Lagrange.basis Finset.univ nodes i).coeff 0 + +/-- Exact constant recovery; this specializes the existing coefficient theorem. -/ +theorem constant_eq_sum_eval {ι : Type*} [Fintype ι] [DecidableEq ι] + (nodes : ι → ℂ) (hinj : Function.Injective nodes) (p : Polynomial ℂ) + (hdegree : p.degree < Fintype.card ι) : + p.coeff 0 = ∑ i, constantInterpolationWeight nodes i * p.eval (nodes i) := by + simpa only [constantInterpolationWeight, mul_comm] using + Tensor.coeff_eq_sum_eval nodes hinj p 0 hdegree + +/-- A degree-`D` polynomial is recovered at zero using only nonzero parameters. -/ +theorem constant_eq_sum_nonzero_eval (D : ℕ) (p : Polynomial ℂ) + (hdegree : p.degree ≤ D) : + p.coeff 0 = ∑ i, constantInterpolationWeight (interpolationNode D) i * + p.eval (interpolationNode D i) := by + apply constant_eq_sum_eval _ (interpolationNode_injective D) + simp only [Fintype.card_fin] + exact lt_of_le_of_lt hdegree (WithBot.coe_lt_coe.mpr (Nat.lt_succ_self D)) + +/-- Removing a leading power before interpolation only requires evaluations at +nonzero nodes. The degree bound is on the normalized polynomial. -/ +theorem leading_eq_sum_normalized_eval {ι : Type*} [Fintype ι] [DecidableEq ι] + (nodes : ι → ℂ) (hinj : Function.Injective nodes) + (hnonzero : ∀ i, nodes i ≠ 0) (p q : Polynomial ℂ) (d : ℕ) + (hp : p = Polynomial.X ^ d * q) (hdegree : q.degree < Fintype.card ι) : + p.coeff d = ∑ i, constantInterpolationWeight nodes i * + (nodes i ^ d)⁻¹ * p.eval (nodes i) := by + have hcoeff : p.coeff d = q.coeff 0 := by + rw [hp, Polynomial.coeff_X_pow_mul'] + simp + rw [hcoeff, constant_eq_sum_eval nodes hinj q hdegree] + apply Finset.sum_congr rfl + intro i hi + rw [hp, Polynomial.eval_mul, Polynomial.eval_pow, Polynomial.eval_X] + have hpow : nodes i ^ d ≠ 0 := pow_ne_zero d (hnonzero i) + calc + constantInterpolationWeight nodes i * q.eval (nodes i) = + constantInterpolationWeight nodes i * + ((nodes i ^ d)⁻¹ * (nodes i ^ d)) * q.eval (nodes i) := by + rw [inv_mul_cancel₀ hpow, mul_one] + _ = _ := by ring + +/-- A leading coefficient is a finite linear combination of normalized +evaluations, assuming all lower coefficients vanish. -/ +theorem leading_eq_sum_nonzero_eval (D d : ℕ) (p : Polynomial ℂ) + (hvanish : ∀ j < d, p.coeff j = 0) (hdegree : p.degree ≤ D) : + p.coeff d = ∑ i, constantInterpolationWeight (interpolationNode D) i * + (interpolationNode D i ^ d)⁻¹ * p.eval (interpolationNode D i) := by + obtain ⟨q, hp⟩ := Polynomial.X_pow_dvd_iff.mpr hvanish + apply leading_eq_sum_normalized_eval _ (interpolationNode_injective D) + (interpolationNode_ne_zero D) p q d hp + have hqdegree : q.degree ≤ p.degree := by + rw [hp, mul_comm] + exact Polynomial.degree_le_mul_left q (pow_ne_zero d Polynomial.X_ne_zero) + simp only [Fintype.card_fin] + exact lt_of_le_of_lt (le_trans hqdegree hdegree) + (WithBot.coe_lt_coe.mpr (Nat.lt_succ_self D)) + +section PolynomialRestriction + +variable {X Y Z X' Y' Z' : Type*} +variable [Fintype X] [Fintype Y] [Fintype Z] +variable {T : Tensor ℂ X Y Z} {U : Tensor ℂ X' Y' Z'} +variable {k Lx Ly Lz : ℕ} + +/-- Evaluating the polynomial restriction evaluates its three local maps. -/ +theorem restrictionDegeneration_eval + (L : Tensor.PolynomialRestrictionDegeneration T U k Lx Ly Lz) + (t : ℂ) (x' : X') (y' : Y') (z' : Z') : + (L.basePolynomial x' y' z').eval t = + Tensor.restrict (fun a x => (L.leftMap a x).eval t) + (fun b y => (L.middleMap b y).eval t) + (fun c z => (L.rightMap c z).eval t) T x' y' z' := by + simp only [Tensor.PolynomialRestrictionDegeneration.basePolynomial, Tensor.restrict, + Polynomial.eval_finsetSum, Polynomial.eval_mul, Polynomial.eval_C] + +/-- The degree of a polynomial restriction is bounded by the sum of the +degrees of its three local maps. -/ +theorem restrictionDegeneration_degree + (L : Tensor.PolynomialRestrictionDegeneration T U k Lx Ly Lz) + (x' : X') (y' : Y') (z' : Z') : + (L.basePolynomial x' y' z').degree ≤ (Lx + Ly + Lz : ℕ) := by + apply Polynomial.degree_le_of_natDegree_le + unfold Tensor.PolynomialRestrictionDegeneration.basePolynomial Tensor.restrict + apply Polynomial.natDegree_sum_le_of_forall_le + intro x hx + apply Polynomial.natDegree_sum_le_of_forall_le + intro y hy + apply Polynomial.natDegree_sum_le_of_forall_le + intro z hz + have hA := Polynomial.natDegree_le_of_degree_le (L.left_degree x' x) + have hB := Polynomial.natDegree_le_of_degree_le (L.middle_degree y' y) + have hC := Polynomial.natDegree_le_of_degree_le (L.right_degree z' z) + have hconstant : (Polynomial.C (T x y z)).natDegree ≤ 0 := by simp + simpa using Polynomial.natDegree_mul_le_of_le + (Polynomial.natDegree_mul_le_of_le + (Polynomial.natDegree_mul_le_of_le hA hB) hC) hconstant + +/-- The existing polynomial-approximation API applies to a polynomial +restriction as soon as the source tensor has a rank bound. -/ +def restrictionDegeneration_approximation + (L : Tensor.PolynomialRestrictionDegeneration T U k Lx Ly Lz) + {r : ℕ} (hT : Tensor.RankAtMost T r) : + Tensor.PolynomialApproximation U r k (Lx + Ly + Lz) where + polynomial := L.basePolynomial + rank_bound := (hT.map Polynomial.C).restrict L.leftMap L.middleMap L.rightMap + vanishes := L.vanishes + leading := L.leading + degree_bound := restrictionDegeneration_degree L + +/-- Interpolation after tensor powering has a linear degree overhead, rather +than raising the single-copy interpolation overhead to the tensor power. -/ +theorem restrictionDegeneration_power_rankAtMost + (L : Tensor.PolynomialRestrictionDegeneration T U k Lx Ly Lz) + {r : ℕ} (hT : Tensor.RankAtMost T r) (n : ℕ) : + Tensor.RankAtMost (Tensor.power U n) (((Lx + Ly + Lz) * n + 1) * r ^ n) := + (restrictionDegeneration_approximation L hT).rank_power n + +/-- A polynomial degeneration yields an exact finite sum of ordinary +restrictions at nonzero parameters. There are `Lx + Ly + Lz + 1` terms. -/ +theorem restrictionDegeneration_recovery + (L : Tensor.PolynomialRestrictionDegeneration T U k Lx Ly Lz) + (x' : X') (y' : Y') (z' : Z') : + U x' y' z' = ∑ i, + constantInterpolationWeight (interpolationNode (Lx + Ly + Lz)) i * + (interpolationNode (Lx + Ly + Lz) i ^ k)⁻¹ * + Tensor.restrict + (fun a x => (L.leftMap a x).eval (interpolationNode (Lx + Ly + Lz) i)) + (fun b y => (L.middleMap b y).eval (interpolationNode (Lx + Ly + Lz) i)) + (fun c z => (L.rightMap c z).eval (interpolationNode (Lx + Ly + Lz) i)) + T x' y' z' := by + rw [← L.leading x' y' z'] + change (L.basePolynomial x' y' z').coeff k = _ + rw [leading_eq_sum_nonzero_eval (Lx + Ly + Lz) k + (L.basePolynomial x' y' z') (L.vanishes x' y' z') + (restrictionDegeneration_degree L x' y' z')] + simp_rw [restrictionDegeneration_eval] + +/-- Finite interpolation converts a polynomial degeneration into an exact +rank bound with its explicit number of evaluation parameters. -/ +theorem restrictionDegeneration_rankAtMost + (L : Tensor.PolynomialRestrictionDegeneration T U k Lx Ly Lz) + {r : ℕ} (hT : Tensor.RankAtMost T r) : + Tensor.RankAtMost U ((Lx + Ly + Lz + 1) * r) := by + have hbase := (hT.map Polynomial.C).restrict L.leftMap L.middleMap L.rightMap + change Tensor.RankAtMost L.basePolynomial r at hbase + have hdegree (x' : X') (y' : Y') (z' : Z') : + (L.basePolynomial x' y' z').degree < + Fintype.card (Fin (Lx + Ly + Lz + 1)) := by + simp only [Fintype.card_fin] + exact lt_of_le_of_lt (restrictionDegeneration_degree L x' y' z') + (WithBot.coe_lt_coe.mpr (Nat.lt_succ_self (Lx + Ly + Lz))) + have h := hbase.coeff (interpolationNode (Lx + Ly + Lz)) + (interpolationNode_injective _) k hdegree + have hleading : (fun x' y' z' => (L.basePolynomial x' y' z').coeff k) = U := by + funext x' y' z' + exact L.leading x' y' z' + simpa only [hleading, Fintype.card_fin] using h + +end PolynomialRestriction + +end MatrixMultiplication.AuxiliarySeparation + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Polynomial/Laws.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Polynomial/Laws.lean new file mode 100644 index 0000000000000000000000000000000000000000..b3ef9171c133e1730f6a58cd5f38bc24d81c70ed --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Polynomial/Laws.lean @@ -0,0 +1,65 @@ +import OAI.LinearAlgebra.MatrixMultiplication.Entropy.ComplexEntropyContinuity +import Mathlib.Analysis.SpecialFunctions.BinaryEntropy +import Mathlib.Analysis.SpecialFunctions.Pow.Real +import Mathlib.Tactic.FinCases + +namespace OAI + +/-! +# Probability laws for the polynomial tensor inequalities + +The determinant filtration uses an arbitrary binary law, while the three-sector +filtration uses the uniform law on three branches. +-/ + +noncomputable section + +open scoped BigOperators +open MatrixMultiplication.Foundation + +namespace MatrixMultiplication.AuxiliarySeparation + +/-- The common binary probability law used for every permuted character. -/ +def binaryLaw (q : ℝ) (hq₀ : 0 ≤ q) (hq₁ : q ≤ 1) : FiniteLaw (Fin 2) where + mass i := if i = 0 then q else 1 - q + nonneg i := by + fin_cases i + · simpa using hq₀ + · simpa using sub_nonneg.mpr hq₁ + total := by simp [Fin.sum_univ_two] + +@[simp] theorem binaryLaw_zero (q : ℝ) (hq₀ : 0 ≤ q) (hq₁ : q ≤ 1) : + (binaryLaw q hq₀ hq₁).mass 0 = q := by simp [binaryLaw] + +@[simp] theorem binaryLaw_one (q : ℝ) (hq₀ : 0 ≤ q) (hq₁ : q ≤ 1) : + (binaryLaw q hq₀ hq₁).mass 1 = 1 - q := by simp [binaryLaw] + +/-- The finite-law entropy agrees exactly with the binary entropy convention. -/ +theorem binaryLaw_entropy (q : ℝ) (hq₀ : 0 ≤ q) (hq₁ : q ≤ 1) : + finiteEntropy (binaryLaw q hq₀ hq₁).mass = Real.binEntropy q := by + simp [finiteEntropy, Fin.sum_univ_two, entropyTerm, Real.binEntropy, Real.log_inv] + ring + +theorem binaryLaw_product (q : ℝ) (hq₀ : 0 ≤ q) (hq₁ : q ≤ 1) (f : Fin 2 → ℝ) : + (∏ i, f i ^ (binaryLaw q hq₀ hq₁).mass i) = f 0 ^ q * f 1 ^ (1 - q) := by + simp [Fin.prod_univ_two] + +/-- The three-sector entropy factor is `3 ^ p`. -/ +theorem uniformThree_entropy_factor (p : ℝ) : + Real.exp (p * finiteEntropy (FiniteLaw.uniform (Fin 3)).mass) = (3 : ℝ) ^ p := by + rw [FiniteLaw.uniform_entropy] + norm_num only [Fintype.card_fin] + rw [Real.rpow_def_of_pos (by norm_num)] + congr 1 + ring + +theorem uniformThree_product (f : Fin 3 → ℝ) : + (∏ i, f i ^ (FiniteLaw.uniform (Fin 3)).mass i) = + f 0 ^ (1 / 3 : ℝ) * f 1 ^ (1 / 3 : ℝ) * f 2 ^ (1 / 3 : ℝ) := by + simp [Fin.prod_univ_three, FiniteLaw.uniform_mass, mul_assoc] + +end MatrixMultiplication.AuxiliarySeparation + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Polynomial/ProductBounds.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Polynomial/ProductBounds.lean new file mode 100644 index 0000000000000000000000000000000000000000..fd81507e1a5a90e9d6ffc0defc221407c606bbd0 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Polynomial/ProductBounds.lean @@ -0,0 +1,103 @@ +import OAI.LinearAlgebra.MatrixMultiplication.AuxiliarySeparation.Entropy.Optimization +import Mathlib.Analysis.SpecialFunctions.Pow.NNReal +import Mathlib.Tactic.Linarith +import Mathlib.Tactic.Positivity + +namespace OAI + +/-! +# Combining the scalar sector bounds + +Pointwise character bounds multiply over a finite family of leg orders. After +normalization by the sum of the singleton exponents, the entropy identity gives +the midpoint-concavity bound for the profile. +-/ + +open scoped BigOperators + +namespace MatrixMultiplication.AuxiliarySeparation + +/-- Multiplying the entropy bounds and taking the positive normalization root +gives the midpoint-concavity inequality. -/ +theorem finite_product_concavity {ι : Type*} [Fintype ι] + (A B C p : ι → ℝ) {s : ℝ} (hs : 0 < s) (hsum : ∑ i, p i = s) + (hA : ∀ i, 0 < A i) (hB : ∀ i, 0 < B i) (hC : ∀ i, 0 < C i) + (hbound : ∀ i q, 0 ≤ q → q ≤ 1 → + Real.exp (p i * Real.binEntropy q) * (B i) ^ q * (C i) ^ (1 - q) ≤ + (2 : ℝ) ^ (p i) * A i) : + (∏ i, B i) ^ (1 / s) + (∏ i, C i) ^ (1 / s) ≤ + 2 * (∏ i, A i) ^ (1 / s) := by + have hprodA : 0 < ∏ i, A i := Finset.prod_pos (fun i _ => hA i) + have hprodB : 0 < ∏ i, B i := Finset.prod_pos (fun i _ => hB i) + have hprodC : 0 < ∏ i, C i := Finset.prod_pos (fun i _ => hC i) + let a : ℝ := (∏ i, A i) ^ (1 / s) + let b : ℝ := (∏ i, B i) ^ (1 / s) + let c : ℝ := (∏ i, C i) ^ (1 / s) + have ha : 0 < a := Real.rpow_pos_of_pos hprodA _ + have hb : 0 < b := Real.rpow_pos_of_pos hprodB _ + have hc : 0 < c := Real.rpow_pos_of_pos hprodC _ + let q : ℝ := b / (b + c) + have hq0 : 0 ≤ q := le_of_lt (div_pos hb (add_pos hb hc)) + have hq1 : q ≤ 1 := (div_le_one (add_pos hb hc)).mpr (le_of_lt (lt_add_of_pos_right b hc)) + have hlog : ∀ i, p i * Real.binEntropy q + q * Real.log (B i) + + (1 - q) * Real.log (C i) ≤ p i * Real.log 2 + Real.log (A i) := by + intro i + have hleft1 : 0 < Real.exp (p i * Real.binEntropy q) * (B i) ^ q := + mul_pos (Real.exp_pos _) (Real.rpow_pos_of_pos (hB i) _) + have h := Real.log_le_log + (mul_pos hleft1 (Real.rpow_pos_of_pos (hC i) _)) (hbound i q hq0 hq1) + rw [Real.log_mul hleft1.ne' (Real.rpow_pos_of_pos (hC i) _).ne', + Real.log_mul (Real.exp_pos _).ne' (Real.rpow_pos_of_pos (hB i) _).ne', + Real.log_exp, Real.log_rpow (hB i), Real.log_rpow (hC i), + Real.log_mul (Real.rpow_pos_of_pos (by norm_num : (0 : ℝ) < 2) _).ne' + (hA i).ne', Real.log_rpow (by norm_num : (0 : ℝ) < 2)] at h + simpa only [mul_comm (Real.log 2) (p i)] using h + have hlogs := Finset.sum_le_sum (fun i (_ : i ∈ Finset.univ) => hlog i) + simp only [Finset.sum_add_distrib, ← Finset.sum_mul, ← Finset.mul_sum, + hsum, ← Real.log_prod (fun i _ => (hA i).ne'), + ← Real.log_prod (fun i _ => (hB i).ne'), + ← Real.log_prod (fun i _ => (hC i).ne')] at hlogs + have hnormalized : Real.binEntropy q + Real.log b * q + Real.log c * (1 - q) ≤ + Real.log 2 + Real.log a := by + dsimp only [a, b, c] + rw [Real.log_rpow hprodA, Real.log_rpow hprodB, Real.log_rpow hprodC] + convert div_le_div_of_nonneg_right hlogs hs.le using 1 <;> field_simp [hs.ne'] + change Real.binEntropy (b / (b + c)) + Real.log b * (b / (b + c)) + + Real.log c * (1 - b / (b + c)) ≤ Real.log 2 + Real.log a at hnormalized + rw [binary_entropy_log_partition hb hc, + ← Real.log_mul (by norm_num : (2 : ℝ) ≠ 0) ha.ne'] at hnormalized + exact (Real.log_le_log_iff (add_pos hb hc) (mul_pos (by norm_num) ha)).mp hnormalized + +/-- Multiplying the cyclic bounds and taking the positive normalization root +gives the factor of three in the tripling inequality. -/ +theorem finite_product_tripling {ι : Type*} [Fintype ι] + (A B C p : ι → ℝ) {s : ℝ} (hs : 0 < s) (hsum : ∑ i, p i = s) + (_hA : ∀ i, 0 < A i) (hB : ∀ i, 0 < B i) (hC : ∀ i, 0 < C i) + (hbound : ∀ i, (3 : ℝ) ^ p i * B i ^ (2 / 3 : ℝ) * C i ^ (1 / 3 : ℝ) ≤ A i) + (hprod_eq : ∏ i, C i = ∏ i, B i) : + 3 * (∏ i, B i) ^ (1 / s) ≤ (∏ i, A i) ^ (1 / s) := by + have hBprod : 0 < ∏ i, B i := Finset.prod_pos fun i _ => hB i + have hprod : (3 : ℝ) ^ s * (∏ i, B i) ≤ ∏ i, A i := by + have hmul := Finset.prod_le_prod₀ (s := Finset.univ) + (f := fun i => (3 : ℝ) ^ p i * B i ^ (2 / 3 : ℝ) * C i ^ (1 / 3 : ℝ)) + (g := A) + (fun i _ => mul_nonneg + (mul_nonneg (Real.rpow_nonneg (by norm_num) _) (Real.rpow_nonneg (hB i).le _)) + (Real.rpow_nonneg (hC i).le _)) + (fun i _ => hbound i) + rw [Finset.prod_mul_distrib, Finset.prod_mul_distrib, + ← Real.rpow_sum_of_pos (by norm_num : (0 : ℝ) < 3) p Finset.univ, hsum, + Real.finsetProd_rpow Finset.univ B (fun i _ => (hB i).le), + Real.finsetProd_rpow Finset.univ C (fun i _ => (hC i).le), hprod_eq, + mul_assoc, ← Real.rpow_add hBprod] at hmul + norm_num at hmul + exact hmul + have hmean := Real.rpow_le_rpow (by positivity) hprod (by positivity : (0 : ℝ) ≤ 1 / s) + rw [Real.mul_rpow (by positivity) hBprod.le, + ← Real.rpow_mul (by norm_num : (0 : ℝ) ≤ 3), mul_one_div_cancel hs.ne', + Real.rpow_one] at hmean + exact hmean + +end MatrixMultiplication.AuxiliarySeparation + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Sector/Branches.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Sector/Branches.lean new file mode 100644 index 0000000000000000000000000000000000000000..b8132de4003f7bae30c1165b63b77c1682b00c72 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Sector/Branches.lean @@ -0,0 +1,290 @@ +import OAI.LinearAlgebra.MatrixMultiplication.AuxiliarySeparation.Sector.Degeneration +import OAI.LinearAlgebra.MatrixMultiplication.AuxiliarySeparation.Tensor.SupportExtension +import Mathlib.Data.Fin.Rev + +namespace OAI + +/-! +# Coordinate identifications of the three retained sectors + +Each outer branch is a zero extension of `C(a,h)`, using the same first-leg +coordinates. The middle branch is a zero extension after reversing the first +coordinate and exchanging the second and third tensor legs. +-/ + +noncomputable section + +open MatrixMultiplication.Foundation +open scoped Classical + + +namespace MatrixMultiplication.AuxiliarySeparation.Sector + +/-- Embed the left second-leg interval. -/ +def leftY (a h : ℕ) (r : Fin h) : YIndex a h := + ⟨r.val, by have hr := r.isLt; unfold sourceWidth; omega⟩ + +/-- Embed the left third-leg interval. -/ +def leftZ (a h : ℕ) (s : Fin (a + h - 1)) : ZIndex a h := + ⟨s.val, by have hs := s.isLt; unfold sourceWidth; omega⟩ + +/-- Embed the middle second-leg interval, which carries the convolution output. -/ +def middleY (a h : ℕ) (s : Fin (a + h - 1)) : YIndex a h := + ⟨h + s.val, by have hs := s.isLt; unfold sourceWidth; omega⟩ + +/-- Embed the middle third-leg interval, which carries the second input. -/ +def middleZ (a h : ℕ) (r : Fin h) : ZIndex a h := + ⟨h + a - 1 + r.val, by have hr := r.isLt; unfold sourceWidth; omega⟩ + +/-- Embed the right second-leg interval. -/ +def rightY (a h : ℕ) (r : Fin h) : YIndex a h := + ⟨rightStart a h + r.val, + by have hr := r.isLt; unfold rightStart sourceWidth; omega⟩ + +/-- Embed the right third-leg interval. -/ +def rightZ (a h : ℕ) (s : Fin (a + h - 1)) : ZIndex a h := + ⟨rightStart a h + s.val, + by have hs := s.isLt; unfold rightStart sourceWidth; omega⟩ + +theorem leftY_injective (a h : ℕ) : Function.Injective (leftY a h) := by + intro r s heq + apply Fin.ext + exact congrArg (fun t : YIndex a h => t.val) heq + +theorem leftZ_injective (a h : ℕ) : Function.Injective (leftZ a h) := by + intro r s heq + apply Fin.ext + exact congrArg (fun t : ZIndex a h => t.val) heq + +theorem middleY_injective (a h : ℕ) : Function.Injective (middleY a h) := by + intro r s heq + apply Fin.ext + have hv := congrArg Fin.val heq + dsimp [middleY] at hv + omega + +theorem middleZ_injective (a h : ℕ) : Function.Injective (middleZ a h) := by + intro r s heq + apply Fin.ext + have hv := congrArg Fin.val heq + dsimp [middleZ] at hv + omega + +theorem rightY_injective (a h : ℕ) : Function.Injective (rightY a h) := by + intro r s heq + apply Fin.ext + have hv := congrArg Fin.val heq + dsimp [rightY] at hv + omega + +theorem rightZ_injective (a h : ℕ) : Function.Injective (rightZ a h) := by + intro r s heq + apply Fin.ext + have hv := congrArg Fin.val heq + dsimp [rightZ] at hv + omega + +/-- Pulling back the left block gives ordinary convolution. -/ +theorem leftTensor_pullback (a h : ℕ) : + Tensor.pullback id (leftY a h) (leftZ a h) (leftTensor a h) = + convolution a h := by + funext i r s + have hb : LeftBranch a h i.val r.val s.val ↔ i.val + r.val = s.val := by + constructor + · rintro ⟨u, t, hu, ht, hi, hr, hs⟩ + omega + · intro hs + exact ⟨i.val, r.val, i.isLt, r.isLt, rfl, rfl, hs.symm⟩ + simp only [Tensor.pullback, leftTensor, leftY, leftZ, id_eq, convolution, hb] + +/-- Pulling back the translated right block also gives ordinary convolution. -/ +theorem rightTensor_pullback (a h : ℕ) : + Tensor.pullback id (rightY a h) (rightZ a h) (rightTensor a h) = + convolution a h := by + funext i r s + have hb : RightBranch a h i.val (rightStart a h + r.val) + (rightStart a h + s.val) ↔ i.val + r.val = s.val := by + constructor + · rintro ⟨u, t, hu, ht, hi, hr, hs⟩ + omega + · intro hs + refine ⟨i.val, r.val, i.isLt, r.isLt, rfl, rfl, ?_⟩ + omega + simp only [Tensor.pullback, rightTensor, rightY, rightZ, id_eq, convolution, hb] + +/-- Exchange the two outer convolution legs while retaining the original input +order in the displayed coefficient equation. -/ +def exchangedConvolution (a h : ℕ) : + Tensor ℂ (Fin a) (Fin (a + h - 1)) (Fin h) := + fun i s r => convolution a h i r s + +/-- The middle branch is exactly convolution with its last two legs exchanged; +the first-leg reversal occurs solely in this individual branch identification. -/ +theorem middleTensor_pullback (a h : ℕ) : + Tensor.pullback Fin.rev (middleY a h) (middleZ a h) (middleTensor a h) = + exchangedConvolution a h := by + funext i s r + have hi := i.isLt + have hr := r.isLt + have hb : MiddleBranch a h (a - (i.val + 1)) (h + s.val) + (h + a - 1 + r.val) ↔ i.val + r.val = s.val := by + constructor + · rintro ⟨u, t, hu, ht, hx, hy, hz⟩ + omega + · intro hs + refine ⟨i.val, r.val, hi, hr, ?_, ?_, rfl⟩ <;> omega + simp only [Tensor.pullback, middleTensor, middleY, middleZ, + exchangedConvolution, convolution, Fin.val_rev, hb] + +/-- All nonzero left-branch coordinates lie in the displayed embeddings. -/ +theorem leftTensor_support (a h : ℕ) (i : Fin a) (j : YIndex a h) + (k : ZIndex a h) (hn : leftTensor a h i j k ≠ 0) : + (∃ r, leftY a h r = j) ∧ (∃ s, leftZ a h s = k) := by + have hb : LeftBranch a h i.val j.val k.val := by + by_contra hn' + exact hn (by simp [leftTensor, hn']) + rcases hb with ⟨u, r, hu, hr, hi, hj, hk⟩ + constructor + · exact ⟨⟨r, hr⟩, Fin.ext hj.symm⟩ + · exact ⟨⟨u + r, by omega⟩, Fin.ext hk.symm⟩ + +/-- All nonzero right-branch coordinates lie in the translated embeddings. -/ +theorem rightTensor_support (a h : ℕ) (i : Fin a) (j : YIndex a h) + (k : ZIndex a h) (hn : rightTensor a h i j k ≠ 0) : + (∃ r, rightY a h r = j) ∧ (∃ s, rightZ a h s = k) := by + have hb : RightBranch a h i.val j.val k.val := by + by_contra hn' + exact hn (by simp [rightTensor, hn']) + rcases hb with ⟨u, r, hu, hr, hi, hj, hk⟩ + constructor + · exact ⟨⟨r, hr⟩, Fin.ext hj.symm⟩ + · refine ⟨⟨u + r, by omega⟩, Fin.ext ?_⟩ + dsimp [rightZ] + omega + +/-- All nonzero middle-branch coordinates lie in the exchanged embeddings. -/ +theorem middleTensor_support (a h : ℕ) (i : Fin a) (j : YIndex a h) + (k : ZIndex a h) (hn : middleTensor a h i j k ≠ 0) : + (∃ u, Fin.rev u = i) ∧ (∃ s, middleY a h s = j) ∧ + (∃ r, middleZ a h r = k) := by + have hb : MiddleBranch a h i.val j.val k.val := by + by_contra hn' + exact hn (by simp [middleTensor, hn']) + rcases hb with ⟨u, r, hu, hr, hi, hj, hk⟩ + refine ⟨⟨⟨u, hu⟩, Fin.ext ?_⟩, ⟨⟨u + r, by omega⟩, Fin.ext ?_⟩, + ⟨⟨r, hr⟩, Fin.ext ?_⟩⟩ + · simp only [Fin.val_rev] + omega + · dsimp [middleY] + omega + · exact hk.symm + +/-- The left block is the zero extension of the ordinary convolution tensor. -/ +theorem leftTensor_eq_extension (a h : ℕ) : + leftTensor a h = Tensor.restrict + (fun x i => if i = x then 1 else 0) + (fun y r => if leftY a h r = y then 1 else 0) + (fun z s => if leftZ a h s = z then 1 else 0) (convolution a h) := by + have hs (i : Fin a) (j : YIndex a h) (k : ZIndex a h) + (hn : leftTensor a h i j k ≠ 0) : + i ∈ Set.range (id : Fin a → Fin a) ∧ + j ∈ Set.range (leftY a h) ∧ k ∈ Set.range (leftZ a h) := by + exact ⟨⟨i, rfl⟩, leftTensor_support a h i j k hn⟩ + classical + have heq := tensor_eq_extendByZero_pullback (leftTensor a h) id (leftY a h) (leftZ a h) + Function.injective_id (leftY_injective a h) (leftZ_injective a h) hs + rw [leftTensor_pullback] at heq + convert heq using 1 + congr 1 <;> funext x i <;> (try dsimp only [id_eq]) <;> split_ifs <;> rfl + +/-- The right block is the zero extension along the translated coordinates. -/ +theorem rightTensor_eq_extension (a h : ℕ) : + rightTensor a h = Tensor.restrict + (fun x i => if i = x then 1 else 0) + (fun y r => if rightY a h r = y then 1 else 0) + (fun z s => if rightZ a h s = z then 1 else 0) (convolution a h) := by + have hs (i : Fin a) (j : YIndex a h) (k : ZIndex a h) + (hn : rightTensor a h i j k ≠ 0) : + i ∈ Set.range (id : Fin a → Fin a) ∧ + j ∈ Set.range (rightY a h) ∧ k ∈ Set.range (rightZ a h) := by + exact ⟨⟨i, rfl⟩, rightTensor_support a h i j k hn⟩ + classical + have heq := tensor_eq_extendByZero_pullback (rightTensor a h) id (rightY a h) (rightZ a h) + Function.injective_id (rightY_injective a h) (rightZ_injective a h) hs + rw [rightTensor_pullback] at heq + convert heq using 1 + congr 1 <;> funext x i <;> (try dsimp only [id_eq]) <;> split_ifs <;> rfl + +/-- The middle block is the zero extension of the exchanged convolution, with +one reversible change of basis on its first leg. -/ +theorem middleTensor_eq_extension (a h : ℕ) : + middleTensor a h = Tensor.restrict + (fun x i => if Fin.rev i = x then 1 else 0) + (fun y s => if middleY a h s = y then 1 else 0) + (fun z r => if middleZ a h r = z then 1 else 0) (exchangedConvolution a h) := by + classical + have heq := tensor_eq_extendByZero_pullback (middleTensor a h) Fin.rev (middleY a h) + (middleZ a h) Fin.rev_injective (middleY_injective a h) (middleZ_injective a h) + (middleTensor_support a h) + rw [middleTensor_pullback] at heq + convert heq using 1 + congr 1 <;> funext x i <;> split_ifs <;> rfl + +/-- Every character assigns the left branch the value of `C(a,h)`. -/ +theorem value_leftTensor (χ : Character) (a h : ℕ) : + χ.value (leftTensor a h) = χ.value (convolution a h) := by + rw [leftTensor_eq_extension] + exact χ.value_extendByZero _ id (leftY a h) (leftZ a h) Function.injective_id + (leftY_injective a h) (leftZ_injective a h) + +/-- Translation of the outer coordinates preserves the right-branch value. -/ +theorem value_rightTensor (χ : Character) (a h : ℕ) : + χ.value (rightTensor a h) = χ.value (convolution a h) := by + rw [rightTensor_eq_extension] + exact χ.value_extendByZero _ id (rightY a h) (rightZ a h) Function.injective_id + (rightY_injective a h) (rightZ_injective a h) + +/-- The middle-branch value is the value of the exchanged convolution tensor. -/ +theorem value_middleTensor (χ : Character) (a h : ℕ) : + χ.value (middleTensor a h) = χ.value (exchangedConvolution a h) := by + rw [middleTensor_eq_extension] + exact χ.value_extendByZero _ Fin.rev (middleY a h) (middleZ a h) + Fin.rev_injective (middleY_injective a h) (middleZ_injective a h) + +/-- Exchanging two tensor legs preserves nonzeroness. -/ +theorem exchangedConvolution_nonzero {a h : ℕ} (ha : 0 < a) (hh : 0 < h) : + exchangedConvolution a h ≠ 0 := by + intro hz + apply convolution_nonzero ha hh + funext i r s + exact congrFun (congrFun (congrFun hz i) s) r + +/-- The left retained branch is nonzero in every positive size. -/ +theorem leftTensor_nonzero {a h : ℕ} (ha : 0 < a) (hh : 0 < h) : + leftTensor a h ≠ 0 := by + intro hz + have hp := leftTensor_pullback a h + rw [hz] at hp + exact convolution_nonzero ha hh hp.symm + +/-- The translated right branch is nonzero in every positive size. -/ +theorem rightTensor_nonzero {a h : ℕ} (ha : 0 < a) (hh : 0 < h) : + rightTensor a h ≠ 0 := by + intro hz + have hp := rightTensor_pullback a h + rw [hz] at hp + exact convolution_nonzero ha hh hp.symm + +/-- The exchanged middle branch is nonzero in every positive size. -/ +theorem middleTensor_nonzero {a h : ℕ} (ha : 0 < a) (hh : 0 < h) : + middleTensor a h ≠ 0 := by + intro hz + have hp := middleTensor_pullback a h + rw [hz] at hp + exact exchangedConvolution_nonzero ha hh hp.symm + +end MatrixMultiplication.AuxiliarySeparation.Sector + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Sector/Character.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Sector/Character.lean new file mode 100644 index 0000000000000000000000000000000000000000..329fc34fa43ecc7d0c5f5ebd867fa36f057c0ac2 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Sector/Character.lean @@ -0,0 +1,142 @@ +import OAI.LinearAlgebra.MatrixMultiplication.AuxiliarySeparation.Sector.Degeneration +import OAI.LinearAlgebra.MatrixMultiplication.AuxiliarySeparation.Character.Degeneration +import OAI.LinearAlgebra.MatrixMultiplication.AuxiliarySeparation.Polynomial.Laws +import OAI.LinearAlgebra.MatrixMultiplication.AuxiliarySeparation.Tensor.TagInequality +import OAI.LinearAlgebra.MatrixMultiplication.AuxiliarySeparation.Sector.Branches +import OAI.LinearAlgebra.MatrixMultiplication.AuxiliarySeparation.Separation.BranchTagging + +namespace OAI + +/-! +# The character inequality from the three-sector degeneration + +The retained tensor has three branches sharing its actual first-input space. +Their two remaining coordinate intervals determine matching branch labels. +The uniform three-branch tag inequality and polynomial degeneration then yield +the character inequality of Section 5.2 before symmetrization. +-/ + +noncomputable section + +open scoped BigOperators Classical +open MatrixMultiplication.Foundation + +namespace MatrixMultiplication.AuxiliarySeparation.Sector + +/-- The actual three retained tensors in their original ambient spaces. -/ +def branchFamily (a h : ℕ) (b : Fin 3) : + Tensor ℂ (Fin a) (YIndex a h) (ZIndex a h) := + if b = 0 then leftTensor a h else if b = 1 then middleTensor a h else rightTensor a h + +@[simp] theorem branchFamily_zero (a h : ℕ) : + branchFamily a h 0 = leftTensor a h := by simp [branchFamily] + +@[simp] theorem branchFamily_one (a h : ℕ) : + branchFamily a h 1 = middleTensor a h := by simp [branchFamily] + +@[simp] theorem branchFamily_two (a h : ℕ) : + branchFamily a h 2 = rightTensor a h := by simp [branchFamily] + +/-- Label a second-leg coordinate by its interval. -/ +def yLabel (a h : ℕ) (j : YIndex a h) : Fin 3 := + if j.val < h then 0 else if j.val < rightStart a h then 1 else 2 + +/-- Label a third-leg coordinate by its corresponding interval. -/ +def zLabel (a h : ℕ) (k : ZIndex a h) : Fin 3 := + if k.val < h + a - 1 then 0 else if k.val < rightStart a h then 1 else 2 + +/-- Every nonzero branch coefficient lies in the two matching labelled sectors. -/ +theorem branchFamily_labels (a h : ℕ) (b : Fin 3) (i : Fin a) + (j : YIndex a h) (k : ZIndex a h) (hn : branchFamily a h b i j k ≠ 0) : + yLabel a h j = b ∧ zLabel a h k = b := by + fin_cases b + · have hb : LeftBranch a h i.val j.val k.val := by + by_contra hb + exact hn (by simp [branchFamily, leftTensor, hb]) + have h := (leftBranch_iff hb.support).mp hb + simp [yLabel, zLabel, h.1, h.2] + · have hb : MiddleBranch a h i.val j.val k.val := by + by_contra hb + exact hn (by simp [branchFamily, middleTensor, hb]) + rcases (middleBranch_iff hb.support).mp hb with ⟨⟨hy₀, hy₁⟩, ⟨hz₀, hz₁⟩⟩ + simp [yLabel, zLabel, not_lt.mpr hy₀, hy₁, not_lt.mpr hz₀, hz₁] + · have hb : RightBranch a h i.val j.val k.val := by + by_contra hb + exact hn (by simp [branchFamily, rightTensor, hb]) + rcases (rightBranch_iff hb.support).mp hb with ⟨hy, hz⟩ + have hi := i.isLt + have hy₀ : h ≤ j.val := by unfold rightStart at hy; omega + have hz₀ : h + a - 1 ≤ k.val := by unfold rightStart at hz; omega + simp [yLabel, zLabel, not_lt.mpr hy₀, not_lt.mpr hy, + not_lt.mpr hz₀, not_lt.mpr hz] + +/-- The branch family sums to exactly the retained tensor. -/ +theorem sum_branchFamily (a h : ℕ) : + (∑ b : Fin 3, branchFamily a h b) = retained a h := by + simp only [Fin.sum_univ_three, branchFamily_zero, branchFamily_one, branchFamily_two] + exact (retained_eq_three_branches a h).symm + +/-- The character comparison uses the actual polynomial degeneration. -/ +theorem value_retained_le_source (χ : Character) (a h : ℕ) : + χ.value (retained a h) ≤ χ.value (source a h) := + χ.value_polynomialRestrictionDegeneration_le (restriction a h) + +/-- Both interval labels can be recovered without changing the common first +input, so the tagged branch tensor has precisely the retained tensor's value. -/ +theorem value_sharedFirst_branchFamily (χ : Character) (a h : ℕ) : + χ.value (sharedFirstTensor (branchFamily a h)) = χ.value (retained a h) := by + rw [χ.value_sharedFirstTensor_eq_sum (branchFamily a h) + (yLabel a h) (zLabel a h) (branchFamily_labels a h), sum_branchFamily] + +theorem branchFamily_nonzero {a h : ℕ} (ha : 0 < a) (hh : 0 < h) + (b : Fin 3) : branchFamily a h b ≠ 0 := by + fin_cases b + · simpa [branchFamily] using leftTensor_nonzero ha hh + · simpa [branchFamily] using middleTensor_nonzero ha hh + · simpa [branchFamily] using rightTensor_nonzero ha hh + +/-- The uniform branch product combines the two outer convolution values. -/ +theorem uniform_branchFamily_product (χ : Character) (a h : ℕ) + (ha : 0 < a) (hh : 0 < h) : + (∏ b, χ.value (branchFamily a h b) ^ (FiniteLaw.uniform (Fin 3)).mass b) = + χ.value (convolution a h) ^ (2 / 3 : ℝ) * + χ.value (exchangedConvolution a h) ^ (1 / 3 : ℝ) := by + rw [uniformThree_product] + simp only [branchFamily_zero, branchFamily_one, branchFamily_two, + value_leftTensor, value_middleTensor, value_rightTensor] + have hc : 0 < χ.value (convolution a h) := + lt_of_lt_of_le zero_lt_one (χ.one_le_value (convolution_nonzero ha hh)) + calc + χ.value (convolution a h) ^ (1 / 3 : ℝ) * + χ.value (exchangedConvolution a h) ^ (1 / 3 : ℝ) * + χ.value (convolution a h) ^ (1 / 3 : ℝ) = + (χ.value (convolution a h) ^ (1 / 3 : ℝ) * + χ.value (convolution a h) ^ (1 / 3 : ℝ)) * + χ.value (exchangedConvolution a h) ^ (1 / 3 : ℝ) := by ring + _ = _ := by + rw [← Real.rpow_add hc] + norm_num + +/-- The per-character three-sector inequality, before multiplication over +the six tensor-leg permutations. All tensor values are actual convolution +values, with only the middle branch exchanging its last two legs. -/ +theorem convolution_tripling_tag (χ : Character) (a h : ℕ) + (ha : 0 < a) (hh : 0 < h) : + (3 : ℝ) ^ χ.pX * χ.value (convolution a h) ^ (2 / 3 : ℝ) * + χ.value (fun i s r => convolution a h i r s) ^ (1 / 3 : ℝ) ≤ + χ.value (convolution a (3 * h + a - 1)) := by + have htag := χ.sharedFirst_tag (FiniteLaw.uniform (Fin 3)) + (branchFamily a h) (branchFamily_nonzero ha hh) + rw [uniformThree_entropy_factor, uniform_branchFamily_product χ a h ha hh, + value_sharedFirst_branchFamily] at htag + have hresult := htag.trans (value_retained_le_source χ a h) + change (3 : ℝ) ^ χ.pX * (χ.value (convolution a h) ^ (2 / 3 : ℝ) * + χ.value (fun i s r => convolution a h i r s) ^ (1 / 3 : ℝ)) ≤ + χ.value (convolution a (3 * h + a - 1)) at hresult + simpa only [mul_assoc] using hresult + +end MatrixMultiplication.AuxiliarySeparation.Sector + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Sector/Degeneration.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Sector/Degeneration.lean new file mode 100644 index 0000000000000000000000000000000000000000..707f8af36fe147237bd4d3e8cb0860b05bc8ca37 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Sector/Degeneration.lean @@ -0,0 +1,242 @@ +import OAI.LinearAlgebra.MatrixMultiplication.AuxiliarySeparation.Convolution.Basic +import OAI.LinearAlgebra.MatrixMultiplication.AuxiliarySeparation.Sector.Weights +import OAI.LinearAlgebra.MatrixMultiplication.AuxiliarySeparation.Polynomial.Interpolation + +namespace OAI + +/-! +# The actual three-sector polynomial degeneration + +The interval weights of `SectorWeights` act by diagonal local maps on the +coefficient tensor `C(a, 3h+a-1)`. Shifting every third-leg weight by one makes +the local maps polynomial. Their restriction is exactly `X * retained + +X^2 * erased`, so the existing polynomial-restriction degeneration interface +applies with leading order one and local degree bounds `(0,1,1)`. +-/ + +noncomputable section + +open scoped BigOperators Classical + +namespace MatrixMultiplication.AuxiliarySeparation.Sector + +open MatrixMultiplication.Foundation +open Polynomial + +abbrev YIndex (a h : ℕ) := Fin (sourceWidth a h) +abbrev ZIndex (a h : ℕ) := Fin (a + sourceWidth a h - 1) + +/-- The source coefficient tensor, with its actual shared first-input space. -/ +def source (a h : ℕ) : Tensor ℂ (Fin a) (YIndex a h) (ZIndex a h) := + convolution a (sourceWidth a h) + +theorem source_ne_zero_iff {a h : ℕ} (i : Fin a) (j : YIndex a h) + (k : ZIndex a h) : + source a h i j k ≠ 0 ↔ Support a h i.val j.val k.val := by + simp only [source, convolution_ne_zero_iff, Support] + constructor + · intro heq + exact ⟨i.isLt, j.isLt, heq.symm⟩ + · intro hs + exact hs.2.2.symm + +/-- The weight-zero part in the original coordinate spaces. -/ +def retained (a h : ℕ) : Tensor ℂ (Fin a) (YIndex a h) (ZIndex a h) := + fun i j k => if totalWeight a h i.val j.val k.val = 0 then source a h i j k else 0 + +/-- The positive-weight part, all of whose supported terms have weight one. -/ +def erased (a h : ℕ) : Tensor ℂ (Fin a) (YIndex a h) (ZIndex a h) := + fun i j k => if totalWeight a h i.val j.val k.val = 1 then source a h i j k else 0 + +/-- The left retained branch, still in the common ambient coordinate spaces. -/ +def leftTensor (a h : ℕ) : Tensor ℂ (Fin a) (YIndex a h) (ZIndex a h) := + fun i j k => if LeftBranch a h i.val j.val k.val then 1 else 0 + +/-- The middle retained branch; its first leg is the actual shared first leg. -/ +def middleTensor (a h : ℕ) : Tensor ℂ (Fin a) (YIndex a h) (ZIndex a h) := + fun i j k => if MiddleBranch a h i.val j.val k.val then 1 else 0 + +/-- The right retained branch in the original coordinate spaces. -/ +def rightTensor (a h : ℕ) : Tensor ℂ (Fin a) (YIndex a h) (ZIndex a h) := + fun i j k => if RightBranch a h i.val j.val k.val then 1 else 0 + +/-- The retained tensor is exactly the sum of the three stated branches, +with coefficient one on each and the original first-leg coordinates shared. -/ +theorem retained_eq_three_branches (a h : ℕ) : + retained a h = leftTensor a h + middleTensor a h + rightTensor a h := by + funext i j k + by_cases hs : Support a h i.val j.val k.val + · have hsource : source a h i j k = 1 := by + exact (convolution_eq_one_iff i j k).mpr hs.2.2.symm + have hw := retained_support_iff hs + have hlm := leftBranch_not_middleBranch (a := a) (h := h) + (i := i.val) (j := j.val) (k := k.val) + have hlr := leftBranch_not_rightBranch (a := a) (h := h) + (i := i.val) (j := j.val) (k := k.val) + have hmr := middleBranch_not_rightBranch (a := a) (h := h) + (i := i.val) (j := j.val) (k := k.val) + by_cases hl : LeftBranch a h i.val j.val k.val <;> + by_cases hm : MiddleBranch a h i.val j.val k.val <;> + by_cases hr : RightBranch a h i.val j.val k.val + all_goals simp_all [retained, leftTensor, middleTensor, rightTensor] + · have hsource : source a h i j k = 0 := by + by_contra hz + exact hs ((source_ne_zero_iff i j k).mp hz) + have hl : ¬ LeftBranch a h i.val j.val k.val := fun hb => hs hb.support + have hm : ¬ MiddleBranch a h i.val j.val k.val := fun hb => hs hb.support + have hr : ¬ RightBranch a h i.val j.val k.val := fun hb => hs hb.support + simp [retained, leftTensor, middleTensor, rightTensor, hsource, hl, hm, hr] + +/-- Every source term belongs either to the retained tensor or the erased one. -/ +theorem source_eq_retained_add_erased (a h : ℕ) : + source a h = retained a h + erased a h := by + funext i j k + by_cases hs : source a h i j k = 0 + · simp [retained, erased, hs] + · rcases totalWeight_eq_zero_or_one ((source_ne_zero_iff i j k).mp hs) with hw | hw + all_goals simp [retained, erased, hw] + +/-- The normalized polynomial family appearing in the unshifted weights. -/ +def normalizedPolynomial (a h : ℕ) : + Tensor (Polynomial ℂ) (Fin a) (YIndex a h) (ZIndex a h) := + fun i j k => C (retained a h i j k) + X * C (erased a h i j k) + +/-- The first local map fixes the common input basis. -/ +def leftMap (a : ℕ) (output input : Fin a) : Polynomial ℂ := + if input = output then 1 else 0 + +/-- The second local map assigns weight one to the middle interval. -/ +def middleMap (a h : ℕ) (output input : YIndex a h) : Polynomial ℂ := + if input = output then (if MiddleY a h output.val then X else 1) else 0 + +/-- Shift the third-leg weights by one, giving weight zero to the middle +interval and weight one to the two outer intervals. -/ +def rightMap (a h : ℕ) (output input : ZIndex a h) : Polynomial ℂ := + if input = output then (if MiddleZ a h output.val then 1 else X) else 0 + +/-- One simultaneous polynomial restriction of the whole source tensor. -/ +def polynomial (a h : ℕ) : + Tensor (Polynomial ℂ) (Fin a) (YIndex a h) (ZIndex a h) := + Tensor.restrict (leftMap a) (middleMap a h) (rightMap a h) + (fun i j k => C (source a h i j k)) + +theorem polynomial_apply (a h : ℕ) (i : Fin a) (j : YIndex a h) + (k : ZIndex a h) : + polynomial a h i j k = + (if MiddleY a h j.val then X else 1) * + (if MiddleZ a h k.val then 1 else X) * C (source a h i j k) := by + simp [polynomial, Tensor.restrict, leftMap, middleMap, rightMap, ite_mul, mul_ite] + +/-- The shifted polynomial restriction has precisely two possible degrees. -/ +theorem polynomial_identity (a h : ℕ) (i : Fin a) (j : YIndex a h) + (k : ZIndex a h) : + polynomial a h i j k = + X * C (retained a h i j k) + X ^ 2 * C (erased a h i j k) := by + by_cases hs : source a h i j k = 0 + · simp [polynomial_apply, retained, erased, hs] + · have hsupport := (source_ne_zero_iff i j k).mp hs + have hmiddle := middleY_of_middleZ hsupport + by_cases hy : MiddleY a h j.val <;> by_cases hz : MiddleZ a h k.val + all_goals + simp_all [polynomial_apply, retained, erased, totalWeight, firstWeight, + secondWeight, thirdWeight, pow_two] + +theorem polynomial_eq_X_mul_normalized (a h : ℕ) (i : Fin a) (j : YIndex a h) + (k : ZIndex a h) : + polynomial a h i j k = X * normalizedPolynomial a h i j k := by + rw [polynomial_identity, normalizedPolynomial] + ring + +theorem polynomial_coeff (a h : ℕ) (i : Fin a) (j : YIndex a h) + (k : ZIndex a h) (n : ℕ) : + (polynomial a h i j k).coeff n = + (if n = 1 then retained a h i j k else 0) + + (if n = 2 then erased a h i j k else 0) := by + rw [polynomial_identity, Polynomial.coeff_add, + mul_comm X (C (retained a h i j k)), + mul_comm (X ^ 2) (C (erased a h i j k)), + Polynomial.coeff_C_mul_X, Polynomial.coeff_C_mul_X_pow] + +theorem leftMap_degree (a : ℕ) (output input : Fin a) : + (leftMap a output input).degree ≤ 0 := by + by_cases heq : input = output <;> simp [leftMap, heq] + +theorem middleMap_degree (a h : ℕ) (output input : YIndex a h) : + (middleMap a h output input).degree ≤ 1 := by + by_cases heq : input = output <;> by_cases hy : MiddleY a h output.val <;> + simp [middleMap, heq, hy] + +theorem rightMap_degree (a h : ℕ) (output input : ZIndex a h) : + (rightMap a h output input).degree ≤ 1 := by + by_cases heq : input = output <;> by_cases hz : MiddleZ a h output.val <;> + simp [rightMap, heq, hz] + +/-- The three-sector construction is an actual polynomial restriction +degeneration in the existing tensor API, with leading order one. -/ +def restriction (a h : ℕ) : + Tensor.PolynomialRestrictionDegeneration (source a h) (retained a h) 1 0 1 1 where + leftMap := leftMap a + middleMap := middleMap a h + rightMap := rightMap a h + left_degree := leftMap_degree a + middle_degree := middleMap_degree a h + right_degree := rightMap_degree a h + vanishes := by + intro i j k n hn + change (polynomial a h i j k).coeff n = 0 + rw [polynomial_coeff] + have hn0 : n = 0 := by omega + simp [hn0] + leading := by + intro i j k + change (polynomial a h i j k).coeff 1 = retained a h i j k + simp [polynomial_coeff] + +@[simp] theorem restriction_basePolynomial (a h : ℕ) : + (restriction a h).basePolynomial = polynomial a h := rfl + +/-- Evaluation of the normalized family has exactly the paper's form. -/ +theorem normalizedPolynomial_eval (a h : ℕ) (t : ℂ) (i : Fin a) + (j : YIndex a h) (k : ZIndex a h) : + (normalizedPolynomial a h i j k).eval t = + retained a h i j k + t * erased a h i j k := by + simp only [normalizedPolynomial, Polynomial.eval_add, Polynomial.eval_mul, + Polynomial.eval_C, Polynomial.eval_X] + +/-- At nonzero parameters, the unshifted normalized polynomial is still an +ordinary restriction: divide the first local map by the parameter. -/ +theorem normalizedPolynomial_eval_restriction (a h : ℕ) (t : ℂ) (ht : t ≠ 0) : + (fun i j k => (normalizedPolynomial a h i j k).eval t) = + Tensor.restrict + (fun output input => if input = output then t⁻¹ else 0) + (fun output input => (middleMap a h output input).eval t) + (fun output input => (rightMap a h output input).eval t) + (source a h) := by + funext i j k + have hev := congrArg (fun p : Polynomial ℂ => p.eval t) + (polynomial_eq_X_mul_normalized a h i j k) + simp only [Polynomial.eval_mul, Polynomial.eval_X] at hev + have hscaled : + Tensor.restrict + (fun output input => if input = output then t⁻¹ else 0) + (fun output input => (middleMap a h output input).eval t) + (fun output input => (rightMap a h output input).eval t) + (source a h) i j k = t⁻¹ * (polynomial a h i j k).eval t := by + rw [polynomial_apply] + simp only [middleMap, rightMap, apply_ite, Polynomial.eval_zero, + Polynomial.eval_one, Polynomial.eval_X, Polynomial.eval_mul, Polynomial.eval_C] + simp [Tensor.restrict, ite_mul, mul_ite, mul_assoc] + rw [hscaled, hev, ← mul_assoc, inv_mul_cancel₀ ht, one_mul] + +/-- Existing interpolation gives a rank bound with only linear overhead after +tensor powering. -/ +theorem retained_power_rankAtMost (a h r n : ℕ) + (hsource : Tensor.RankAtMost (source a h) r) : + Tensor.RankAtMost (Tensor.power (retained a h) n) ((2 * n + 1) * r ^ n) := by + simpa using restrictionDegeneration_power_rankAtMost (restriction a h) hsource n + +end MatrixMultiplication.AuxiliarySeparation.Sector + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Sector/Weights.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Sector/Weights.lean new file mode 100644 index 0000000000000000000000000000000000000000..c34f97c78a107367be742dec97d8ba4c35d8967b --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Sector/Weights.lean @@ -0,0 +1,266 @@ +import Mathlib.Data.Int.Basic +import Mathlib.Tactic + +namespace OAI + +/-! +# Interval weights for the three-sector convolution degeneration + +Section 5.2 assigns weights to the second and third coordinates of +`C(a, 3 * h + a - 1)`. The total weight is nonnegative on convolution support, +and its zero set consists exactly of the three matching sector blocks. +The middle block is a convolution with the last two legs exchanged and the +first coordinate reversed. +-/ + +namespace MatrixMultiplication.AuxiliarySeparation.Sector + +/-- Number of second-leg coordinates in the original convolution. -/ +def sourceWidth (a h : ℕ) : ℕ := 3 * h + a - 1 + +/-- Beginning of the right sector on both the second and third legs. -/ +def rightStart (a h : ℕ) : ℕ := 2 * h + a - 1 + +/-- A coefficient-one term of the original convolution tensor. -/ +def Support (a h i j k : ℕ) : Prop := + i < a ∧ j < sourceWidth a h ∧ k = i + j + +/-- The middle interval on the second tensor leg. -/ +def MiddleY (a h j : ℕ) : Prop := h ≤ j ∧ j < rightStart a h + +/-- The middle interval on the third tensor leg. -/ +def MiddleZ (a h k : ℕ) : Prop := h + a - 1 ≤ k ∧ k < rightStart a h + +instance (a h j : ℕ) : Decidable (MiddleY a h j) := inferInstanceAs + (Decidable (h ≤ j ∧ j < rightStart a h)) + +instance (a h k : ℕ) : Decidable (MiddleZ a h k) := inferInstanceAs + (Decidable (h + a - 1 ≤ k ∧ k < rightStart a h)) + +/-- No weight is assigned to the common first leg. -/ +def firstWeight (_i : ℕ) : ℤ := 0 + +/-- Weight one on the middle second-leg interval, zero elsewhere. -/ +def secondWeight (a h j : ℕ) : ℤ := if MiddleY a h j then 1 else 0 + +/-- Weight minus one on the middle third-leg interval, zero elsewhere. -/ +def thirdWeight (a h k : ℕ) : ℤ := if MiddleZ a h k then -1 else 0 + +/-- Exponent of the degeneration parameter on one term. -/ +def totalWeight (a h i j k : ℕ) : ℤ := + firstWeight i + secondWeight a h j + thirdWeight a h k + +/-- The three retained blocks have matching sector labels. -/ +def MatchingSectors (a h j k : ℕ) : Prop := + (j < h ∧ k < h + a - 1) ∨ + (MiddleY a h j ∧ MiddleZ a h k) ∨ + (rightStart a h ≤ j ∧ rightStart a h ≤ k) + +/-- A middle third-leg coordinate can only be reached from the middle second leg. -/ +theorem middleY_of_middleZ {a h i j k : ℕ} + (hs : Support a h i j k) (hz : MiddleZ a h k) : MiddleY a h j := by + unfold Support at hs + unfold MiddleY MiddleZ rightStart at * + omega + +/-- Every term has exponent zero or one, so no negative powers occur. -/ +theorem totalWeight_eq_zero_or_one {a h i j k : ℕ} + (hs : Support a h i j k) : + totalWeight a h i j k = 0 ∨ totalWeight a h i j k = 1 := by + have hmiddle := middleY_of_middleZ hs + by_cases hy : MiddleY a h j <;> by_cases hz : MiddleZ a h k + all_goals simp [totalWeight, firstWeight, secondWeight, thirdWeight, hy, hz] at * + +theorem totalWeight_nonneg {a h i j k : ℕ} + (hs : Support a h i j k) : 0 ≤ totalWeight a h i j k := by + rcases totalWeight_eq_zero_or_one hs with hw | hw <;> omega + +/-- The constant coefficient consists exactly of the three matching blocks. -/ +theorem totalWeight_eq_zero_iff {a h i j k : ℕ} + (hs : Support a h i j k) : + totalWeight a h i j k = 0 ↔ MatchingSectors a h j k := by + unfold Support sourceWidth at hs + unfold MatchingSectors MiddleY MiddleZ rightStart + unfold totalWeight firstWeight secondWeight thirdWeight MiddleY MiddleZ rightStart + split_ifs <;> omega + +/-- Only a middle second-leg coordinate paired with an outer third-leg coordinate +is erased by the degeneration. -/ +theorem totalWeight_eq_one_iff {a h i j k : ℕ} + (hs : Support a h i j k) : + totalWeight a h i j k = 1 ↔ MiddleY a h j ∧ ¬ MiddleZ a h k := by + have hmiddle := middleY_of_middleZ hs + by_cases hy : MiddleY a h j <;> by_cases hz : MiddleZ a h k + all_goals simp [totalWeight, firstWeight, secondWeight, thirdWeight, hy, hz] at * + +/-- Parametrization of the left copy of `C(a,h)`. -/ +def LeftBranch (a h i j k : ℕ) : Prop := + ∃ u r, u < a ∧ r < h ∧ i = u ∧ j = r ∧ k = u + r + +/-- Parametrization of the middle copy with the second and third legs exchanged. -/ +def MiddleBranch (a h i j k : ℕ) : Prop := + ∃ u r, u < a ∧ r < h ∧ i = a - 1 - u ∧ + j = h + u + r ∧ k = h + a - 1 + r + +/-- Parametrization of the right translated copy of `C(a,h)`. -/ +def RightBranch (a h i j k : ℕ) : Prop := + ∃ u r, u < a ∧ r < h ∧ i = u ∧ + j = rightStart a h + r ∧ k = rightStart a h + u + r + +/-- The left block preserves the actual first coordinate. -/ +theorem leftBranch_iff {a h i j k : ℕ} (hs : Support a h i j k) : + LeftBranch a h i j k ↔ j < h ∧ k < h + a - 1 := by + rcases hs with ⟨hi, hj, hk⟩ + constructor + · rintro ⟨u, r, hu, hr, rfl, rfl, rfl⟩ + omega + · rintro ⟨hleft, _⟩ + exact ⟨i, j, hi, hleft, rfl, rfl, hk⟩ + +/-- The middle support equation becomes convolution after reversing the first +coordinate and exchanging the second and third legs. -/ +theorem middleBranch_iff {a h i j k : ℕ} (hs : Support a h i j k) : + MiddleBranch a h i j k ↔ MiddleY a h j ∧ MiddleZ a h k := by + rcases hs with ⟨hi, hj, hk⟩ + unfold MiddleY MiddleZ rightStart + constructor + · rintro ⟨u, r, hu, hr, rfl, rfl, rfl⟩ + omega + · rintro ⟨hy, hz⟩ + refine ⟨a - 1 - i, k - (h + a - 1), ?_, ?_, ?_, ?_, ?_⟩ <;> omega + +/-- The right block is the same convolution after translating the two outer +coordinates. -/ +theorem rightBranch_iff {a h i j k : ℕ} (hs : Support a h i j k) : + RightBranch a h i j k ↔ rightStart a h ≤ j ∧ rightStart a h ≤ k := by + rcases hs with ⟨hi, hj, hk⟩ + unfold sourceWidth at hj + unfold RightBranch rightStart + constructor + · rintro ⟨u, r, hu, hr, rfl, rfl, rfl⟩ + omega + · rintro ⟨hjr, hkr⟩ + refine ⟨i, j - (2 * h + a - 1), hi, ?_, rfl, ?_, ?_⟩ <;> omega + +/-- On the left coordinate block, the support equation is the ordinary +convolution equation. -/ +theorem left_support_coordinates {a h i r s : ℕ} (hi : i < a) (hr : r < h) : + Support a h i r s ↔ s = i + r := by + unfold Support sourceWidth + omega + +/-- Translation of the right block preserves the convolution equation. -/ +theorem right_support_coordinates {a h i r s : ℕ} (hi : i < a) (hr : r < h) : + Support a h i (rightStart a h + r) (rightStart a h + s) ↔ s = i + r := by + unfold Support sourceWidth rightStart + omega + +/-- In middle-block coordinates the support equation is convolution with the +first coordinate reversed and the other two coordinates exchanged. -/ +theorem middle_support_coordinates {a h i s r : ℕ} + (hi : i < a) (hr : r < h) : + Support a h i (h + s) (h + a - 1 + r) ↔ s = a - 1 - i + r := by + unfold Support sourceWidth + omega + +/-- Exact retained support of the three-sector degeneration. -/ +theorem retained_support_iff {a h i j k : ℕ} (hs : Support a h i j k) : + totalWeight a h i j k = 0 ↔ + LeftBranch a h i j k ∨ MiddleBranch a h i j k ∨ RightBranch a h i j k := by + rw [totalWeight_eq_zero_iff hs, leftBranch_iff hs, middleBranch_iff hs, + rightBranch_iff hs] + rfl + +/-- Every displayed left-branch term belongs to the original convolution. -/ +theorem LeftBranch.support {a h i j k : ℕ} (hb : LeftBranch a h i j k) : + Support a h i j k := by + rcases hb with ⟨u, r, hu, hr, rfl, rfl, rfl⟩ + unfold Support sourceWidth + omega + +/-- Every displayed middle-branch term belongs to the original convolution. -/ +theorem MiddleBranch.support {a h i j k : ℕ} (hb : MiddleBranch a h i j k) : + Support a h i j k := by + rcases hb with ⟨u, r, hu, hr, rfl, rfl, rfl⟩ + unfold Support sourceWidth + omega + +/-- Every displayed right-branch term belongs to the original convolution. -/ +theorem RightBranch.support {a h i j k : ℕ} (hb : RightBranch a h i j k) : + Support a h i j k := by + rcases hb with ⟨u, r, hu, hr, rfl, rfl, rfl⟩ + unfold Support sourceWidth rightStart + omega + +/-- Exact equality of the retained support and the three explicitly +parametrized convolution branches, without a pre-existing support assumption. -/ +theorem support_and_weight_zero_iff (a h i j k : ℕ) : + (Support a h i j k ∧ totalWeight a h i j k = 0) ↔ + LeftBranch a h i j k ∨ MiddleBranch a h i j k ∨ RightBranch a h i j k := by + constructor + · rintro ⟨hs, hw⟩ + exact (retained_support_iff hs).mp hw + · intro hb + have hs : Support a h i j k := hb.elim LeftBranch.support + (fun hb => hb.elim MiddleBranch.support RightBranch.support) + exact ⟨hs, (retained_support_iff hs).mpr hb⟩ + +/-- The first-coordinate reversal is involutive on its natural range. -/ +theorem reverse_reverse {a u : ℕ} (hu : u < a) : + a - 1 - (a - 1 - u) = u := by + omega + +/-- The middle branch has unique reversed-convolution coordinates. -/ +theorem middleBranch_coordinates_unique {a h i k u r u' r' : ℕ} + (hu : u < a) (hu' : u' < a) + (hi : i = a - 1 - u) (hi' : i = a - 1 - u') + (hk : k = h + a - 1 + r) (hk' : k = h + a - 1 + r') : + u = u' ∧ r = r' := by + omega + +/-- The left and middle branches use disjoint second-leg coordinates. -/ +theorem leftBranch_not_middleBranch {a h i j k : ℕ} + (hl : LeftBranch a h i j k) : ¬ MiddleBranch a h i j k := by + intro hm + have hl' := (leftBranch_iff hl.support).mp hl + have hm' := (middleBranch_iff hm.support).mp hm + unfold MiddleY at hm' + omega + +/-- The left and right branches use disjoint second-leg coordinates. -/ +theorem leftBranch_not_rightBranch {a h i j k : ℕ} + (hl : LeftBranch a h i j k) : ¬ RightBranch a h i j k := by + intro hr + have hl' := (leftBranch_iff hl.support).mp hl + have hr' := (rightBranch_iff hr.support).mp hr + have hi := hr.support.1 + unfold rightStart at hr' + omega + +/-- The middle and right branches use disjoint second-leg coordinates. -/ +theorem middleBranch_not_rightBranch {a h i j k : ℕ} + (hm : MiddleBranch a h i j k) : ¬ RightBranch a h i j k := by + intro hr + have hm' := (middleBranch_iff hm.support).mp hm + have hr' := (rightBranch_iff hr.support).mp hr + unfold MiddleY at hm' + omega + +/-- Positivity of the two original dimensions makes the left branch nonempty. -/ +theorem leftBranch_nonempty {a h : ℕ} (ha : 0 < a) (hh : 0 < h) : + ∃ i j k, LeftBranch a h i j k := + ⟨0, 0, 0, 0, 0, ha, hh, rfl, rfl, rfl⟩ + +/-- Positivity makes the exchanged middle branch nonempty as well. -/ +theorem middleBranch_nonempty {a h : ℕ} (ha : 0 < a) (hh : 0 < h) : + ∃ i j k, MiddleBranch a h i j k := by + refine ⟨a - 1, h, h + a - 1, 0, 0, ha, hh, ?_, ?_, ?_⟩ <;> omega + +/-- Positivity also makes the translated right branch nonempty. -/ +theorem rightBranch_nonempty {a h : ℕ} (ha : 0 < a) (hh : 0 < h) : + ∃ i j k, RightBranch a h i j k := by + refine ⟨0, rightStart a h, rightStart a h, 0, 0, ha, hh, ?_, ?_, ?_⟩ <;> omega + +end MatrixMultiplication.AuxiliarySeparation.Sector + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Separation/Basic.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Separation/Basic.lean new file mode 100644 index 0000000000000000000000000000000000000000..02f162f846dfaf537f143fc36024e3d8aa948743 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Separation/Basic.lean @@ -0,0 +1,383 @@ +import OAI.LinearAlgebra.MatrixMultiplication.AuxiliarySeparation.Separation.FiniteProjection +import OAI.LinearAlgebra.MatrixMultiplication.Tensor.ComplexTensor +import OAI.LinearAlgebra.MatrixMultiplication.Tensor.ComplexDotPairing +import OAI.LinearAlgebra.MatrixMultiplication.Tensor.ComplexTensorSymmetrization +import OAI.LinearAlgebra.MatrixMultiplication.Tensor.ComplexTensorRestrictionComposition +import OAI.LinearAlgebra.MatrixMultiplication.Polynomial.ComplexPolynomialApproximation +import Mathlib.RingTheory.RootsOfUnity.Complex +import Mathlib.Tactic + +namespace OAI + +/-! +# The tensor map with exactly `5M` copies + +The branches have a common first coordinate space and common sizes on the other +two legs. Their second and third coordinates carry a matching sector label. +The three maps below are independent linear substitutions on the three legs of +`5M` complete copies of the source tensor. +-/ + +noncomputable section + +open scoped BigOperators +open MatrixMultiplication.Foundation + +namespace MatrixMultiplication.AuxiliarySeparation + +variable {M : ℕ} {X Y Z : Type*} + +/-- The paper numbers sectors from one, while `Fin M` numbers them from zero. -/ +def sectorNumber (i : Fin M) : ℤ := (i.val : ℤ) + 1 + +theorem sectorNumber_bounds (i : Fin M) : + 1 ≤ sectorNumber i ∧ sectorNumber i ≤ M := by + have hi := i.isLt + unfold sectorNumber + omega + +theorem sectorNumber_injective : Function.Injective (@sectorNumber M) := by + intro i j hij + apply Fin.ext + unfold sectorNumber at hij + omega + +/-- Branches sharing X, with matching and disjoint Y and Z sectors. -/ +def sharedFirstTensor (B : Fin M → Tensor ℂ X Y Z) : + Tensor ℂ X (Fin M × Y) (Fin M × Z) := + fun x y z => if y.1 = z.1 then B y.1 x y.2 z.2 else 0 + +/-- The first local Fourier substitution guesses the missing sector. -/ +def firstProjectionMap (ζ : ℂ) : + (X × Fin M) → (Fin (5 * M) × X) → ℂ := by + classical + exact fun x r => if r.2 = x.1 then + ζ ^ ((r.1.val : ℤ) * (2 * sectorNumber x.2)) else 0 + +/-- The second local map knows the sector through its original coordinate. -/ +def secondProjectionMap (ζ : ℂ) : + ((Fin M × Y) × Fin M) → (Fin (5 * M) × (Fin M × Y)) → ℂ := by + classical + exact fun y r => if r.2 = y.1 then + ζ ^ ((r.1.val : ℤ) * (sectorNumber y.2 - sectorNumber y.1.1)) else 0 + +/-- The third local map carries the single Fourier normalization factor. -/ +def thirdProjectionMap (ζ : ℂ) : + ((Fin M × Z) × Fin M) → (Fin (5 * M) × (Fin M × Z)) → ℂ := by + classical + exact fun z r => if r.2 = z.1 then + (5 * M : ℂ)⁻¹ * + ζ ^ ((r.1.val : ℤ) * (-sectorNumber z.2 - sectorNumber z.1.1)) else 0 + +private theorem restrict_constantCopies + {K A B C A' B' C' R : Type*} [CommSemiring K] + [Fintype A] [Fintype B] [Fintype C] [Fintype R] [DecidableEq R] + (T : Tensor K A B C) + (a : A' → R × A → K) (b : B' → R × B → K) (c : C' → R × C → K) + (x : A') (y : B') (z : C') : + Tensor.restrict a b c (Tensor.directSum (fun _ : R => T)) x y z = + ∑ r : R, ∑ i, ∑ j, ∑ k, a x (r, i) * b y (r, j) * c z (r, k) * T i j k := by + classical + simp [Tensor.restrict, Tensor.directSum, Fintype.sum_prod_type, mul_ite, ite_and] + +private theorem restrict_constantCopies_delta + {K A B C A' B' C' R : Type*} [CommSemiring K] + [Fintype A] [Fintype B] [Fintype C] [Fintype R] [DecidableEq R] + [DecidableEq A] [DecidableEq B] [DecidableEq C] + (T : Tensor K A B C) (fa : A' → A) (fb : B' → B) (fc : C' → C) + (a : A' → R → K) (b : B' → R → K) (c : C' → R → K) + (x : A') (y : B') (z : C') : + Tensor.restrict + (fun x r => if r.2 = fa x then a x r.1 else 0) + (fun y r => if r.2 = fb y then b y r.1 else 0) + (fun z r => if r.2 = fc z then c z r.1 else 0) + (Tensor.directSum (fun _ : R => T)) x y z = + (∑ r : R, a x r * b y r * c z r) * T (fa x) (fb y) (fc z) := by + rw [restrict_constantCopies] + simp [ite_mul, mul_ite, Finset.sum_mul] + +/-- The exact coefficient tensor after Fourier projection, before weighting. -/ +def projectedTensor (ζ : ℂ) (B : Fin M → Tensor ℂ X Y Z) : + Tensor ℂ (X × Fin M) ((Fin M × Y) × Fin M) ((Fin M × Z) × Fin M) := + fun x y z => if y.1.1 = z.1.1 then + finiteFourierCoefficient ζ (5 * M) + (phase (sectorNumber x.2) (sectorNumber y.1.1) + (sectorNumber y.2) (sectorNumber z.2)) (B y.1.1 x.1 y.1.2 z.1.2) + else 0 + +/-- The paper's `5M` copies and its three explicit local Fourier maps realize +the projected tensor by an ordinary restriction. -/ +theorem finiteProjection_restrict [Fintype X] [Fintype Y] [Fintype Z] + (ζ : ℂ) (hζ : ζ ≠ 0) (B : Fin M → Tensor ℂ X Y Z) : + Tensor.restrict (firstProjectionMap ζ) (secondProjectionMap ζ) + (thirdProjectionMap ζ) + (Tensor.directSum (fun _ : Fin (5 * M) => sharedFirstTensor B)) = + projectedTensor ζ B := by + classical + funext x y z + unfold firstProjectionMap secondProjectionMap thirdProjectionMap + rw [restrict_constantCopies_delta (R := Fin (5 * M)) + (sharedFirstTensor B) Prod.fst Prod.fst Prod.fst + (fun x r => ζ ^ ((r.val : ℤ) * (2 * sectorNumber x.2))) + (fun y r => ζ ^ ((r.val : ℤ) * (sectorNumber y.2 - sectorNumber y.1.1))) + (fun z r => (5 * M : ℂ)⁻¹ * + ζ ^ ((r.val : ℤ) * (-sectorNumber z.2 - sectorNumber z.1.1))) x y z] + by_cases hyz : y.1.1 = z.1.1 + · simp only [sharedFirstTensor, projectedTensor, hyz, ↓reduceIte] + have hterm (r : Fin (5 * M)) : + ζ ^ ((r.val : ℤ) * (2 * sectorNumber x.2)) * + ζ ^ ((r.val : ℤ) * (sectorNumber y.2 - sectorNumber y.1.1)) * + ((5 * M : ℂ)⁻¹ * + ζ ^ ((r.val : ℤ) * (-sectorNumber z.2 - sectorNumber z.1.1))) = + (5 * M : ℂ)⁻¹ * + ζ ^ ((r.val : ℤ) * phase (sectorNumber x.2) (sectorNumber y.1.1) + (sectorNumber y.2) (sectorNumber z.2)) := by + rw [← hyz] + calc + _ = (5 * M : ℂ)⁻¹ * + (ζ ^ ((r.val : ℤ) * (2 * sectorNumber x.2)) * + ζ ^ ((r.val : ℤ) * (sectorNumber y.2 - sectorNumber y.1.1)) * + ζ ^ ((r.val : ℤ) * (-sectorNumber z.2 - sectorNumber y.1.1))) := by ring + _ = (5 * M : ℂ)⁻¹ * ζ ^ + ((r.val : ℤ) * (2 * sectorNumber x.2) + + (r.val : ℤ) * (sectorNumber y.2 - sectorNumber y.1.1) + + (r.val : ℤ) * (-sectorNumber z.2 - sectorNumber y.1.1)) := by + rw [zpow_add₀ hζ, zpow_add₀ hζ] + _ = _ := by congr 2; unfold phase; ring + simp only [← hyz] at hterm ⊢ + simp_rw [hterm] + rw [← Finset.mul_sum, + Fin.sum_univ_eq_sum_range (fun r : ℕ => ζ ^ ((r : ℤ) * + phase (sectorNumber x.2) (sectorNumber y.1.1) + (sectorNumber y.2) (sectorNumber z.2))) (5 * M)] + unfold finiteFourierCoefficient + rw [← Finset.sum_mul] + simp only [Nat.cast_mul, Nat.cast_ofNat, mul_assoc] + · simp [sharedFirstTensor, projectedTensor, hyz] + +/-- The polynomial after the Fourier projection and square weighting. -/ +def separationPolynomial (ζ : ℂ) (B : Fin M → Tensor ℂ X Y Z) : + Tensor (Polynomial ℂ) (X × Fin M) + ((Fin M × Y) × Fin M) ((Fin M × Z) × Fin M) := + fun x y z => if y.1.1 = z.1.1 then + projectedBranchPolynomial ζ M (sectorNumber x.2) (sectorNumber y.1.1) + (sectorNumber y.2) (sectorNumber z.2) (B y.1.1 x.1 y.1.2 z.1.2) + else 0 + +/-- The surviving tensor: sector labels match on all three legs, while the +additional second/third coordinates form a dot product. -/ +def separationTarget (B : Fin M → Tensor ℂ X Y Z) : + Tensor ℂ (X × Fin M) ((Fin M × Y) × Fin M) ((Fin M × Z) × Fin M) := + fun x y z => if x.2 = y.1.1 ∧ y.1.1 = z.1.1 ∧ y.2 = z.2 then + B y.1.1 x.1 y.1.2 z.1.2 else 0 + +/-- The square-weighted polynomial has exactly the advertised constant tensor. -/ +theorem separationPolynomial_coeff_zero {ζ : ℂ} (hM : 0 < M) + (hζ : IsPrimitiveRoot ζ (5 * M)) (B : Fin M → Tensor ℂ X Y Z) : + (fun x y z => (separationPolynomial ζ B x y z).coeff 0) = + separationTarget B := by + classical + funext x y z + by_cases hyz : y.1.1 = z.1.1 + · simp only [separationPolynomial, hyz, ↓reduceIte] + rw [projectedBranchPolynomial_coeff_zero hM hζ + (sectorNumber_bounds _) (sectorNumber_bounds _) + (sectorNumber_bounds _) (sectorNumber_bounds _)] + simp only [sectorNumber_injective.eq_iff, separationTarget, hyz, true_and] + · simp [separationPolynomial, separationTarget, hyz] + +/-- Its degree is bounded for each fixed finite separation construction. -/ +theorem separationPolynomial_degree {ζ : ℂ} (hM : 0 < M) + (hζ : IsPrimitiveRoot ζ (5 * M)) (B : Fin M → Tensor ℂ X Y Z) + (x : X × Fin M) (y : (Fin M × Y) × Fin M) (z : (Fin M × Z) × Fin M) : + (separationPolynomial ζ B x y z).degree ≤ ((M - 1) ^ 2 : ℕ) := by + apply Polynomial.degree_le_of_natDegree_le + rw [Polynomial.natDegree_le_iff_coeff_eq_zero] + intro n hn + by_cases hyz : y.1.1 = z.1.1 + · simp only [separationPolynomial, hyz, ↓reduceIte] + exact projectedBranchPolynomial_coeff_eq_zero_of_lt hM hζ + (sectorNumber_bounds _) (sectorNumber_bounds _) + (sectorNumber_bounds _) (sectorNumber_bounds _) hn _ + · simp [separationPolynomial, hyz] + +private theorem restrict_target_scalars + {A B C A' B' C' : Type*} [Fintype A] [Fintype B] [Fintype C] + (T : Tensor ℂ A B C) (a : A' → A → ℂ) (b : B' → B → ℂ) + (c : C' → C → ℂ) (s : A' → ℂ) (t : B' → ℂ) (u : C' → ℂ) : + Tensor.restrict (fun x i => s x * a x i) (fun y j => t y * b y j) + (fun z k => u z * c z k) T = + fun x y z => (s x * t y * u z) * Tensor.restrict a b c T x y z := by + funext x y z + simp only [Tensor.restrict, Finset.mul_sum] + apply Finset.sum_congr rfl + intro i hi + apply Finset.sum_congr rfl + intro j hj + apply Finset.sum_congr rfl + intro k hk + ring + +/-- The first local Fourier map followed by its integer weight. -/ +def firstSeparationMap (ζ t : ℂ) (x : X × Fin M) (r : Fin (5 * M) × X) : ℂ := + t ^ firstWeight (sectorNumber x.2) * firstProjectionMap ζ x r + +/-- The second local Fourier map followed by its possibly negative weight. -/ +def secondSeparationMap (ζ t : ℂ) (y : (Fin M × Y) × Fin M) + (r : Fin (5 * M) × (Fin M × Y)) : ℂ := + t ^ secondWeight (sectorNumber y.1.1) (sectorNumber y.2) * secondProjectionMap ζ y r + +/-- The third local Fourier map followed by its possibly negative weight. -/ +def thirdSeparationMap (ζ t : ℂ) (z : (Fin M × Z) × Fin M) + (r : Fin (5 * M) × (Fin M × Z)) : ℂ := + t ^ thirdWeight (sectorNumber z.1.1) (sectorNumber z.2) * thirdProjectionMap ζ z r + +theorem weightedProjection_restrict [Fintype X] [Fintype Y] [Fintype Z] + (ζ t : ℂ) (hζ : ζ ≠ 0) (B : Fin M → Tensor ℂ X Y Z) : + Tensor.restrict (firstSeparationMap ζ t) (secondSeparationMap ζ t) + (thirdSeparationMap ζ t) + (Tensor.directSum (fun _ : Fin (5 * M) => sharedFirstTensor B)) = + fun x y z => + (t ^ firstWeight (sectorNumber x.2) * + t ^ secondWeight (sectorNumber y.1.1) (sectorNumber y.2) * + t ^ thirdWeight (sectorNumber z.1.1) (sectorNumber z.2)) * + projectedTensor ζ B x y z := by + unfold firstSeparationMap secondSeparationMap thirdSeparationMap + rw [restrict_target_scalars, finiteProjection_restrict ζ hζ B] + +/-- At every nonzero parameter the polynomial tensor is an ordinary restriction +of exactly `5M` complete source copies. -/ +theorem separationPolynomial_eval [Fintype X] [Fintype Y] [Fintype Z] + {ζ : ℂ} (hM : 0 < M) (hζ : IsPrimitiveRoot ζ (5 * M)) + (B : Fin M → Tensor ℂ X Y Z) (t : ℂ) (ht : t ≠ 0) : + (fun x y z => (separationPolynomial ζ B x y z).eval t) = + Tensor.restrict (firstSeparationMap ζ t) (secondSeparationMap ζ t) + (thirdSeparationMap ζ t) + (Tensor.directSum (fun _ : Fin (5 * M) => sharedFirstTensor B)) := by + rw [weightedProjection_restrict ζ t (hζ.ne_zero (by omega)) B] + funext x y z + by_cases hyz : y.1.1 = z.1.1 + · simp only [separationPolynomial, projectedTensor, hyz, ↓reduceIte, + projectedBranchPolynomial, Polynomial.eval_monomial] + simp only [← hyz] + rw [fiveMFourierCoefficient_eq_ite hM hζ + (sectorNumber_bounds _) (sectorNumber_bounds _) + (sectorNumber_bounds _) (sectorNumber_bounds _)] + split_ifs with hp + · have he : t ^ firstWeight (sectorNumber x.2) * + t ^ secondWeight (sectorNumber y.1.1) (sectorNumber y.2) * + t ^ thirdWeight (sectorNumber y.1.1) (sectorNumber z.2) = + t ^ totalWeight (sectorNumber x.2) (sectorNumber y.1.1) + (sectorNumber y.2) (sectorNumber z.2) := by + rw [totalWeight, zpow_add₀ ht, zpow_add₀ ht] + rw [he, ← totalDegree_cast_of_phase_eq_zero hp, zpow_natCast] + exact mul_comm _ _ + · simp + · simp [separationPolynomial, projectedTensor, hyz] + +private theorem polynomial_degeneration_of_nonzero_restrictions + {A B C A' B' C' : Type*} + [Fintype A] [Fintype B] [Fintype C] + [Fintype A'] [Fintype B'] [Fintype C'] + (S : Tensor ℂ A B C) (P : Tensor (Polynomial ℂ) A' B' C') + (hP : ∀ t : ℂ, t ≠ 0 → + (fun x y z => (P x y z).eval t) ∈ Tensor.restrictionOrbit S) : + Tensor.DegeneratesTo S (fun x y z => (P x y z).coeff 0) := by + let f : ℂ → Tensor ℂ A' B' C' := fun t x y z => (P x y z).eval t + have hf : Continuous f := by + apply continuous_pi + intro x + apply continuous_pi + intro y + apply continuous_pi + intro z + exact (P x y z).continuous + have hclosed : IsClosed {t : ℂ | Tensor.DegeneratesTo S (f t)} := + isClosed_closure.preimage hf + have hsubset : ({0}ᶜ : Set ℂ) ⊆ {t : ℂ | Tensor.DegeneratesTo S (f t)} := by + intro t ht + exact subset_closure (hP t (by simpa using ht)) + have hz := closure_minimal hsubset hclosed ((dense_compl_singleton (0 : ℂ)) 0) + change Tensor.DegeneratesTo S (f 0) at hz + simpa only [f, Polynomial.coeff_zero_eq_eval_zero] using hz + +/-- Exact finite separation: `5M` source copies degenerate to all M branches, +each retaining an M-dimensional dot-product factor. -/ +theorem finiteSeparation_degeneratesTo [Fintype X] [Fintype Y] [Fintype Z] + (hM : 0 < M) (B : Fin M → Tensor ℂ X Y Z) : + Tensor.DegeneratesTo + (Tensor.directSum (fun _ : Fin (5 * M) => sharedFirstTensor B)) + (separationTarget B) := by + let ζ : ℂ := Complex.exp (2 * Real.pi * Complex.I / (5 * M : ℕ)) + have hζ : IsPrimitiveRoot ζ (5 * M) := + Complex.isPrimitiveRoot_exp _ (by omega) + rw [← separationPolynomial_coeff_zero hM hζ B] + apply polynomial_degeneration_of_nonzero_restrictions _ (separationPolynomial ζ B) + intro t ht + exact ⟨firstSeparationMap ζ t, secondSeparationMap ζ t, thirdSeparationMap ζ t, + separationPolynomial_eval hM hζ B t ht⟩ + +/-- The first-leg relabeling adds the trivial first coordinate of the dot product. -/ +def separationFirstEquiv : (X × Fin M) ≃ (Fin M × (X × Unit)) where + toFun x := (x.2, (x.1, ())) + invFun x := (x.2.1, x.1) + left_inv _ := rfl + right_inv x := by rcases x with ⟨h, x, u⟩; cases u; rfl + +/-- The other two relabelings merely reassociate their coordinates. -/ +def separationSideEquiv (A : Type*) : ((Fin M × A) × Fin M) ≃ + (Fin M × (A × Fin M)) := Equiv.prodAssoc _ _ _ + +/-- The separated target, expressed as a genuine full direct sum of products. -/ +theorem separationTarget_eq_directSum (B : Fin M → Tensor ℂ X Y Z) : + separationTarget B = + Tensor.pullback + separationFirstEquiv (separationSideEquiv Y) (separationSideEquiv Z) + (Tensor.directSum (fun h => Tensor.product (B h) + (Tensor.cyclic (Tensor.cyclic (Tensor.dotPairing (K := ℂ) (Fin M)))))) := by + classical + funext x y z + simp only [separationTarget, Tensor.pullback, Tensor.directSum, Tensor.product, + Tensor.cyclic, Tensor.dotPairing, separationFirstEquiv, separationSideEquiv, + Equiv.coe_fn_mk, Equiv.prodAssoc_apply] + by_cases hxy : x.2 = y.1.1 + · by_cases hyz : y.1.1 = z.1.1 + · simp [hxy, hyz] + · simp [hxy, hyz] + · simp [hxy] + +/-- The finite separation theorem with the output written literally as a full +direct sum of the M branch/dot-product tensors. -/ +theorem finiteSeparation_directSum_degeneratesTo + [Fintype X] [Fintype Y] [Fintype Z] + (hM : 0 < M) (B : Fin M → Tensor ℂ X Y Z) : + Tensor.DegeneratesTo + (Tensor.directSum (fun _ : Fin (5 * M) => sharedFirstTensor B)) + (Tensor.directSum (fun h => Tensor.product (B h) + (Tensor.cyclic (Tensor.cyclic (Tensor.dotPairing (K := ℂ) (Fin M)))))) := by + classical + have h := finiteSeparation_degeneratesTo hM B + have h' := h.restrict + (fun x x' => if x' = separationFirstEquiv.symm x then 1 else 0) + (fun y y' => if y' = (separationSideEquiv Y).symm y then 1 else 0) + (fun z z' => if z' = (separationSideEquiv Z).symm z then 1 else 0) + rw [← Tensor.pullback_eq_restrict, separationTarget_eq_directSum] at h' + have heq : + Tensor.pullback separationFirstEquiv.symm + (separationSideEquiv Y).symm (separationSideEquiv Z).symm + (Tensor.pullback separationFirstEquiv + (separationSideEquiv Y) (separationSideEquiv Z) + (Tensor.directSum (fun h => Tensor.product (B h) + (Tensor.cyclic (Tensor.cyclic (Tensor.dotPairing (K := ℂ) (Fin M))))))) = + Tensor.directSum (fun h => Tensor.product (B h) + (Tensor.cyclic (Tensor.cyclic (Tensor.dotPairing (K := ℂ) (Fin M))))) := by + funext x y z + simp only [Tensor.pullback, Equiv.apply_symm_apply] + rw [heq] at h' + exact h' + +end MatrixMultiplication.AuxiliarySeparation + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Separation/BranchTagging.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Separation/BranchTagging.lean new file mode 100644 index 0000000000000000000000000000000000000000..fcab5c97ca53cc642dff1c61d152a4781a01dd3a --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Separation/BranchTagging.lean @@ -0,0 +1,82 @@ +import OAI.LinearAlgebra.MatrixMultiplication.AuxiliarySeparation.Separation.Basic +import OAI.LinearAlgebra.MatrixMultiplication.AuxiliarySeparation.Tensor.SupportExtension + +namespace OAI + +/-! +# Recovering branch tags from coordinate support + +When both non-shared coordinates determine a branch label, adding explicit +matching branch tags does not change a character's value. The tags can be +recovered by independent coordinate maps, and forgetting them recovers the +original coefficientwise sum of branches. +-/ + +noncomputable section + +open MatrixMultiplication.Foundation +open scoped BigOperators + +namespace MatrixMultiplication.AuxiliarySeparation + +variable {M : ℕ} {X Y Z : Type} +variable [Fintype X] [Fintype Y] [Fintype Z] + +omit [Fintype X] [Fintype Y] [Fintype Z] in +/-- Recovering the two coordinate labels identifies the tagged tensor with +the coefficientwise sum of the branches. -/ +theorem sharedFirstTensor_pullback_labels + (B : Fin M → Tensor ℂ X Y Z) (ly : Y → Fin M) (lz : Z → Fin M) + (hsupport : ∀ i x y z, B i x y z ≠ 0 → ly y = i ∧ lz z = i) : + Tensor.pullback id (fun y => (ly y, y)) (fun z => (lz z, z)) + (sharedFirstTensor B) = ∑ i, B i := by + classical + funext x y z + simp only [Finset.sum_apply] + change (if ly y = lz z then B (ly y) x y z else 0) = ∑ i, B i x y z + have hsum : (∑ i, B i x y z) = B (ly y) x y z := by + apply Finset.sum_eq_single (ly y) + · intro i _ hi + by_contra h + exact hi (hsupport i x y z h).1.symm + · simp + rw [hsum] + split_ifs with h + · rfl + · symm + by_contra hb + exact h ((hsupport (ly y) x y z hb).2.symm) + +namespace Character + +/-- Branch labels determined by both non-shared coordinates can be inserted +or forgotten without changing a character. -/ +theorem value_sharedFirstTensor_eq_sum (χ : Character) + (B : Fin M → Tensor ℂ X Y Z) (ly : Y → Fin M) (lz : Z → Fin M) + (hsupport : ∀ i x y z, B i x y z ≠ 0 → ly y = i ∧ lz z = i) : + χ.value (sharedFirstTensor B) = χ.value (∑ i, B i) := by + have hs : ∀ x y z, sharedFirstTensor B x y z ≠ 0 → + x ∈ Set.range (id : X → X) ∧ + y ∈ Set.range (fun y => (ly y, y)) ∧ + z ∈ Set.range (fun z => (lz z, z)) := by + intro x y z h + have hyz : y.1 = z.1 := by + by_contra hne + exact h (by simp [sharedFirstTensor, hne]) + have hb : B y.1 x y.2 z.2 ≠ 0 := by + simpa only [sharedFirstTensor, hyz, ↓reduceIte] using h + obtain ⟨hy, hz⟩ := hsupport y.1 x y.2 z.2 hb + exact ⟨⟨x, rfl⟩, ⟨y.2, Prod.ext hy rfl⟩, + ⟨z.2, Prod.ext (hz.trans hyz) rfl⟩⟩ + have heq := χ.value_eq_pullback_of_support (sharedFirstTensor B) id + (fun y => (ly y, y)) (fun z => (lz z, z)) Function.injective_id + (fun _ _ h => congrArg Prod.snd h) (fun _ _ h => congrArg Prod.snd h) hs + rw [sharedFirstTensor_pullback_labels B ly lz hsupport] at heq + exact heq + +end Character +end MatrixMultiplication.AuxiliarySeparation + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Separation/FiniteProjection.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Separation/FiniteProjection.lean new file mode 100644 index 0000000000000000000000000000000000000000..585d246122aebba1c7fec25f180c2fab16e0c92c --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Separation/FiniteProjection.lean @@ -0,0 +1,193 @@ +import OAI.LinearAlgebra.MatrixMultiplication.AuxiliarySeparation.Separation.Fourier +import OAI.LinearAlgebra.MatrixMultiplication.AuxiliarySeparation.Separation.NoWrap +import OAI.LinearAlgebra.MatrixMultiplication.AuxiliarySeparation.Separation.SquareWeights +import Mathlib.Algebra.Polynomial.Degree.Lemmas + +namespace OAI + +/-! +# Exact finite Fourier projection and square filtering + +The `5 * M`-term Fourier average is applied to an arbitrary branch coefficient. +The label bounds eliminate modular wrap. The weights on the three tensor legs +then give a nonnegative square degree on every surviving branch. Taking the +constant coefficient retains exactly the branches with `g = h` and `u = v`. + +The finite-family statements permit arbitrary coefficients and arbitrary +repetitions of labels; they use only linearity of the Fourier projection and +coefficient extraction, without assumptions on an ambient tensor. +-/ + +open scoped BigOperators + +namespace MatrixMultiplication.AuxiliarySeparation + +/-- A normalized finite Fourier average of one branch coefficient. -/ +noncomputable def finiteFourierCoefficient (ζ : ℂ) (L : ℕ) (e : ℤ) (c : ℂ) : ℂ := + (L : ℂ)⁻¹ * ∑ r ∈ Finset.range L, ζ ^ ((r : ℤ) * e) * c + +/-- The Fourier average is a scalar support indicator, for every coefficient. -/ +theorem finiteFourierCoefficient_eq_ite {ζ : ℂ} {L : ℕ} + (hL : L ≠ 0) (hζ : IsPrimitiveRoot ζ L) (e : ℤ) (c : ℂ) : + finiteFourierCoefficient ζ L e c = if (L : ℤ) ∣ e then c else 0 := by + unfold finiteFourierCoefficient + rw [← Finset.sum_mul, ← mul_assoc, normalized_sum_zpow_primitive_root hL hζ] + split_ifs <;> simp + +/-- Averaging a finite family of branches agrees with averaging each branch. -/ +theorem finiteFourierCoefficient_sum {ι : Type*} (s : Finset ι) + (ζ : ℂ) (L : ℕ) (e : ι → ℤ) (c : ι → ℂ) : + (L : ℂ)⁻¹ * (∑ r ∈ Finset.range L, ∑ i ∈ s, ζ ^ ((r : ℤ) * e i) * c i) = + ∑ i ∈ s, finiteFourierCoefficient ζ L (e i) (c i) := by + rw [Finset.sum_comm, Finset.mul_sum] + rfl + +/-- Exactly `5 * M` phases select the integer support equation. -/ +theorem fiveMFourierCoefficient_eq_ite {ζ : ℂ} {M : ℕ} {g h u v : ℤ} + (hM : 0 < M) (hζ : IsPrimitiveRoot ζ (5 * M)) + (hg : 1 ≤ g ∧ g ≤ M) (hh : 1 ≤ h ∧ h ≤ M) + (hu : 1 ≤ u ∧ u ≤ M) (hv : 1 ≤ v ∧ v ≤ M) (c : ℂ) : + finiteFourierCoefficient ζ (5 * M) (phase g h u v) c = + if phase g h u v = 0 then c else 0 := by + rw [finiteFourierCoefficient_eq_ite (by omega) hζ] + have hnoWrap := fourierPhase_dvd_iff_eq_zero (M := (M : ℤ)) + (by omega) hh hg hu hv + simp only [phase, Nat.cast_mul, Nat.cast_ofNat, hnoWrap] + rfl + +/-- A projected branch, recorded as an ordinary polynomial after Fourier averaging. -/ +noncomputable def projectedBranchPolynomial (ζ : ℂ) (M : ℕ) + (g h u v : ℤ) (c : ℂ) : Polynomial ℂ := + Polynomial.monomial (totalDegree g h u v) + (finiteFourierCoefficient ζ (5 * M) (phase g h u v) c) + +/-- The surviving polynomial weight is the square `(g - h)^2`. -/ +theorem projectedBranchPolynomial_eq_ite {ζ : ℂ} {M : ℕ} {g h u v : ℤ} + (hM : 0 < M) (hζ : IsPrimitiveRoot ζ (5 * M)) + (hg : 1 ≤ g ∧ g ≤ M) (hh : 1 ≤ h ∧ h ≤ M) + (hu : 1 ≤ u ∧ u ≤ M) (hv : 1 ≤ v ∧ v ≤ M) (c : ℂ) : + projectedBranchPolynomial ζ M g h u v c = + if phase g h u v = 0 then Polynomial.monomial ((g - h) ^ 2).toNat c else 0 := by + unfold projectedBranchPolynomial + rw [fiveMFourierCoefficient_eq_ite hM hζ hg hh hu hv] + split_ifs with hp + · rw [totalDegree, totalWeight_eq_sq_of_phase_eq_zero hp] + · simp + +/-- A coefficient occurs exactly on the Fourier support at its integer total weight. -/ +theorem projectedBranchPolynomial_coeff {ζ : ℂ} {M n : ℕ} {g h u v : ℤ} + (hM : 0 < M) (hζ : IsPrimitiveRoot ζ (5 * M)) + (hg : 1 ≤ g ∧ g ≤ M) (hh : 1 ≤ h ∧ h ≤ M) + (hu : 1 ≤ u ∧ u ≤ M) (hv : 1 ≤ v ∧ v ≤ M) (c : ℂ) : + (projectedBranchPolynomial ζ M g h u v c).coeff n = + if phase g h u v = 0 ∧ totalWeight g h u v = (n : ℤ) then c else 0 := by + unfold projectedBranchPolynomial + rw [fiveMFourierCoefficient_eq_ite hM hζ hg hh hu hv] + by_cases hp : phase g h u v = 0 + · have hd : totalDegree g h u v = n ↔ totalWeight g h u v = (n : ℤ) := by + have hcast := totalDegree_cast_of_phase_eq_zero hp + omega + simp only [hp, ↓reduceIte, Polynomial.coeff_monomial, hd, true_and] + · simp [hp] + +/-- Each projected branch has no polynomial coefficient above `(M - 1)^2`. -/ +theorem projectedBranchPolynomial_coeff_eq_zero_of_lt + {ζ : ℂ} {M n : ℕ} {g h u v : ℤ} + (hM : 0 < M) (hζ : IsPrimitiveRoot ζ (5 * M)) + (hg : 1 ≤ g ∧ g ≤ M) (hh : 1 ≤ h ∧ h ≤ M) + (hu : 1 ≤ u ∧ u ≤ M) (hv : 1 ≤ v ∧ v ≤ M) + (hn : (M - 1) ^ 2 < n) (c : ℂ) : + (projectedBranchPolynomial ζ M g h u v c).coeff n = 0 := by + unfold projectedBranchPolynomial + rw [fiveMFourierCoefficient_eq_ite hM hζ hg hh hu hv] + split_ifs with hp + · have hd := totalDegree_le_of_labels hg hh hp + exact Polynomial.coeff_monomial_of_ne c (by omega) + · simp + +/-- Constant coefficient extraction is the exact square filter, with no restriction +on the original complex coefficient. -/ +theorem projectedBranchPolynomial_coeff_zero {ζ : ℂ} {M : ℕ} {g h u v : ℤ} + (hM : 0 < M) (hζ : IsPrimitiveRoot ζ (5 * M)) + (hg : 1 ≤ g ∧ g ≤ M) (hh : 1 ≤ h ∧ h ≤ M) + (hu : 1 ≤ u ∧ u ≤ M) (hv : 1 ≤ v ∧ v ≤ M) (c : ℂ) : + (projectedBranchPolynomial ζ M g h u v c).coeff 0 = + if g = h ∧ u = v then c else 0 := by + unfold projectedBranchPolynomial + rw [fiveMFourierCoefficient_eq_ite hM hζ hg hh hu hv] + by_cases hp : phase g h u v = 0 + · simp only [hp, ↓reduceIte, Polynomial.coeff_monomial, + totalDegree_eq_zero_iff_of_phase_eq_zero hp] + · have hlabels : ¬ (g = h ∧ u = v) := by + rintro ⟨rfl, rfl⟩ + exact hp (by simp [phase]) + simp [hp, hlabels] + +/-- Apply the finite Fourier projection and square weights branch by branch. -/ +noncomputable def projectedPolynomial {ι : Type*} (s : Finset ι) + (ζ : ℂ) (M : ℕ) (g h u v : ι → ℤ) (c : ι → ℂ) : Polynomial ℂ := + ∑ i ∈ s, projectedBranchPolynomial ζ M (g i) (h i) (u i) (v i) (c i) + +/-- Every coefficient of the projected polynomial has the exact integer support. -/ +theorem projectedPolynomial_coeff {ι : Type*} (s : Finset ι) + {ζ : ℂ} {M n : ℕ} (g h u v : ι → ℤ) (c : ι → ℂ) + (hM : 0 < M) (hζ : IsPrimitiveRoot ζ (5 * M)) + (hg : ∀ i ∈ s, 1 ≤ g i ∧ g i ≤ M) (hh : ∀ i ∈ s, 1 ≤ h i ∧ h i ≤ M) + (hu : ∀ i ∈ s, 1 ≤ u i ∧ u i ≤ M) (hv : ∀ i ∈ s, 1 ≤ v i ∧ v i ≤ M) : + (projectedPolynomial s ζ M g h u v c).coeff n = + ∑ i ∈ s, if phase (g i) (h i) (u i) (v i) = 0 ∧ + totalWeight (g i) (h i) (u i) (v i) = (n : ℤ) then c i else 0 := by + classical + unfold projectedPolynomial + simp only [Polynomial.finsetSum_coeff] + apply Finset.sum_congr rfl + intro i hi + exact projectedBranchPolynomial_coeff hM hζ (hg i hi) (hh i hi) + (hu i hi) (hv i hi) (c i) + +/-- Exact finite filtering for an arbitrary finite family of branch coefficients. -/ +theorem projectedPolynomial_coeff_zero {ι : Type*} (s : Finset ι) + {ζ : ℂ} {M : ℕ} (g h u v : ι → ℤ) (c : ι → ℂ) + (hM : 0 < M) (hζ : IsPrimitiveRoot ζ (5 * M)) + (hg : ∀ i ∈ s, 1 ≤ g i ∧ g i ≤ M) (hh : ∀ i ∈ s, 1 ≤ h i ∧ h i ≤ M) + (hu : ∀ i ∈ s, 1 ≤ u i ∧ u i ≤ M) (hv : ∀ i ∈ s, 1 ≤ v i ∧ v i ≤ M) : + (projectedPolynomial s ζ M g h u v c).coeff 0 = + ∑ i ∈ s, if g i = h i ∧ u i = v i then c i else 0 := by + classical + unfold projectedPolynomial + simp only [Polynomial.finsetSum_coeff] + apply Finset.sum_congr rfl + intro i hi + exact projectedBranchPolynomial_coeff_zero hM hζ (hg i hi) (hh i hi) + (hu i hi) (hv i hi) (c i) + +/-- The finite projected polynomial has support only in degrees at most `(M - 1)^2`. -/ +theorem projectedPolynomial_coeff_eq_zero_of_lt {ι : Type*} (s : Finset ι) + {ζ : ℂ} {M n : ℕ} (g h u v : ι → ℤ) (c : ι → ℂ) + (hM : 0 < M) (hζ : IsPrimitiveRoot ζ (5 * M)) + (hg : ∀ i ∈ s, 1 ≤ g i ∧ g i ≤ M) (hh : ∀ i ∈ s, 1 ≤ h i ∧ h i ≤ M) + (hu : ∀ i ∈ s, 1 ≤ u i ∧ u i ≤ M) (hv : ∀ i ∈ s, 1 ≤ v i ∧ v i ≤ M) + (hn : (M - 1) ^ 2 < n) : + (projectedPolynomial s ζ M g h u v c).coeff n = 0 := by + classical + unfold projectedPolynomial + simp only [Polynomial.finsetSum_coeff] + apply Finset.sum_eq_zero + intro i hi + exact projectedBranchPolynomial_coeff_eq_zero_of_lt hM hζ (hg i hi) (hh i hi) + (hu i hi) (hv i hi) hn (c i) + +/-- The degree bound is independent of the number or values of the coefficients. -/ +theorem projectedPolynomial_natDegree_le {ι : Type*} (s : Finset ι) + {ζ : ℂ} {M : ℕ} (g h u v : ι → ℤ) (c : ι → ℂ) + (hM : 0 < M) (hζ : IsPrimitiveRoot ζ (5 * M)) + (hg : ∀ i ∈ s, 1 ≤ g i ∧ g i ≤ M) (hh : ∀ i ∈ s, 1 ≤ h i ∧ h i ≤ M) + (hu : ∀ i ∈ s, 1 ≤ u i ∧ u i ≤ M) (hv : ∀ i ∈ s, 1 ≤ v i ∧ v i ≤ M) : + (projectedPolynomial s ζ M g h u v c).natDegree ≤ (M - 1) ^ 2 := by + rw [Polynomial.natDegree_le_iff_coeff_eq_zero] + intro n hn + exact projectedPolynomial_coeff_eq_zero_of_lt s g h u v c hM hζ hg hh hu hv hn + +end MatrixMultiplication.AuxiliarySeparation + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Separation/Fourier.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Separation/Fourier.lean new file mode 100644 index 0000000000000000000000000000000000000000..881c9ecfbf1101b5f5d75f997e30efc6171f3a2b --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Separation/Fourier.lean @@ -0,0 +1,69 @@ +import Mathlib.Analysis.Complex.Basic +import Mathlib.RingTheory.RootsOfUnity.PrimitiveRoots + +namespace OAI + +/-! +# Finite root-of-unity filters + +Averaging the integer powers of a primitive root over one period detects +exactly the exponents divisible by that period. This is the finite Fourier +filter used for auxiliary separation. +-/ + +open scoped BigOperators + +namespace MatrixMultiplication.AuxiliarySeparation + +/-- The sum over a complete period of a root of unity is zero unless the root is one. -/ +lemma sum_pow_root_of_unity (z : ℂ) (L : ℕ) (hz : z ^ L = 1) : + (∑ r ∈ Finset.range L, z ^ r) = if z = 1 then (L : ℂ) else 0 := by + split_ifs with h + · simp [h] + · have hsum : (1 - z) * ∑ r ∈ Finset.range L, z ^ r = 0 := by + rw [mul_neg_geom_sum, hz, sub_self] + exact (mul_eq_zero.mp hsum).resolve_left (sub_ne_zero.mpr (Ne.symm h)) + +/-- An unnormalized finite Fourier filter, with an integer exponent. -/ +theorem sum_zpow_primitive_root {ζ : ℂ} {L : ℕ} + (hζ : IsPrimitiveRoot ζ L) (e : ℤ) : + (∑ r ∈ Finset.range L, ζ ^ ((r : ℤ) * e)) = + if (L : ℤ) ∣ e then (L : ℂ) else 0 := by + have hpow : (ζ ^ e) ^ L = 1 := by + rw [← zpow_natCast, ← zpow_mul, mul_comm, zpow_mul, hζ.zpow_eq_one, one_zpow] + have hterm (r : ℕ) : ζ ^ ((r : ℤ) * e) = (ζ ^ e) ^ r := by + rw [← zpow_natCast, ← zpow_mul, mul_comm] + simp_rw [hterm] + rw [sum_pow_root_of_unity _ _ hpow] + simp only [hζ.zpow_eq_one_iff_dvd] + +/-- Averaging over a primitive root's period selects exactly its divisible exponents. -/ +theorem normalized_sum_zpow_primitive_root {ζ : ℂ} {L : ℕ} + (hL : L ≠ 0) (hζ : IsPrimitiveRoot ζ L) (e : ℤ) : + (L : ℂ)⁻¹ * (∑ r ∈ Finset.range L, ζ ^ ((r : ℤ) * e)) = + if (L : ℤ) ∣ e then 1 else 0 := by + rw [sum_zpow_primitive_root hζ e] + split_ifs <;> simp [hL] + +/-- Divisibility by a positive period is exact equality to zero inside one period. -/ +lemma int_dvd_iff_eq_zero_of_abs_lt {L : ℕ} {e : ℤ} (he : |e| < (L : ℤ)) : + (L : ℤ) ∣ e ↔ e = 0 := by + constructor + · intro hd + apply abs_eq_zero.mp + exact Int.eq_zero_of_dvd_of_nonneg_of_lt (abs_nonneg e) he + ((dvd_abs (L : ℤ) e).mpr hd) + · rintro rfl + exact dvd_zero _ + +/-- Within one period, the finite Fourier filter selects exactly exponent zero. -/ +theorem normalized_sum_zpow_primitive_root_of_abs_lt {ζ : ℂ} {L : ℕ} {e : ℤ} + (hL : L ≠ 0) (hζ : IsPrimitiveRoot ζ L) (he : |e| < (L : ℤ)) : + (L : ℂ)⁻¹ * (∑ r ∈ Finset.range L, ζ ^ ((r : ℤ) * e)) = + if e = 0 then 1 else 0 := by + rw [normalized_sum_zpow_primitive_root hL hζ e] + simp only [int_dvd_iff_eq_zero_of_abs_lt he] + +end MatrixMultiplication.AuxiliarySeparation + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Separation/NoWrap.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Separation/NoWrap.lean new file mode 100644 index 0000000000000000000000000000000000000000..5f200ad4aaa63cb45373472889bdbdcc7d9c6a8c --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Separation/NoWrap.lean @@ -0,0 +1,100 @@ +import Mathlib.Algebra.Order.Group.Unbundled.Int +import Lean.Elab.Tactic.Omega + +namespace OAI + +/-! +# The Fourier projection has no modular wrap + +Section 4.1 of *Matrix Multiplication via Auxiliary Separation and Polynomial +Multiplication* uses exactly `5 * M` Fourier phases. The exponent +`u - v + 2 * (g - h)` has absolute value at most `3 * (M - 1)` when all four +labels lie in `{1, ..., M}`. Consequently, divisibility by `5 * M` is equivalent +to the exact integer support equation. +-/ + +namespace MatrixMultiplication.AuxiliarySeparation + +/-- The explicit bound for the exponent in the finite Fourier projection. -/ +theorem fourierPhase_abs_le {M h g u v : ℤ} + (hh : 1 ≤ h ∧ h ≤ M) (hg : 1 ≤ g ∧ g ≤ M) + (hu : 1 ≤ u ∧ u ≤ M) (hv : 1 ≤ v ∧ v ≤ M) : + |u - v + 2 * (g - h)| ≤ 3 * (M - 1) := by + rw [abs_le'] + constructor <;> omega + +/-- The Fourier modulus exceeds the full possible range of the exponent. -/ +theorem fourierRadius_lt_modulus {M : ℤ} (hM : 1 ≤ M) : + 3 * (M - 1) < 5 * M := by + omega + +/-- Every possible exponent lies strictly between minus and plus the modulus. -/ +theorem fourierPhase_abs_lt {M h g u v : ℤ} + (hM : 1 ≤ M) (hh : 1 ≤ h ∧ h ≤ M) (hg : 1 ≤ g ∧ g ≤ M) + (hu : 1 ≤ u ∧ u ≤ M) (hv : 1 ≤ v ∧ v ≤ M) : + |u - v + 2 * (g - h)| < 5 * M := + lt_of_le_of_lt (fourierPhase_abs_le hh hg hu hv) (fourierRadius_lt_modulus hM) + +/-- Modular Fourier support is exact integer support for the allowed labels. -/ +theorem fourierPhase_eq_zero_of_dvd {M h g u v : ℤ} + (hM : 1 ≤ M) (hh : 1 ≤ h ∧ h ≤ M) (hg : 1 ≤ g ∧ g ≤ M) + (hu : 1 ≤ u ∧ u ≤ M) (hv : 1 ≤ v ∧ v ≤ M) + (hdiv : 5 * M ∣ u - v + 2 * (g - h)) : + u - v + 2 * (g - h) = 0 := + Int.eq_zero_of_abs_lt_dvd hdiv (fourierPhase_abs_lt hM hh hg hu hv) + +/-- Characterization of the surviving Fourier support without modular arithmetic. -/ +theorem fourierPhase_dvd_iff_eq_zero {M h g u v : ℤ} + (hM : 1 ≤ M) (hh : 1 ≤ h ∧ h ≤ M) (hg : 1 ≤ g ∧ g ≤ M) + (hu : 1 ≤ u ∧ u ≤ M) (hv : 1 ≤ v ∧ v ≤ M) : + (5 * M ∣ u - v + 2 * (g - h)) ↔ u - v + 2 * (g - h) = 0 := by + constructor + · exact fourierPhase_eq_zero_of_dvd hM hh hg hu hv + · intro hzero + rw [hzero] + exact ⟨0, by simp⟩ + +/-- The same exponent bound for natural-number labels, interpreted in `ℤ`. -/ +theorem fourierPhase_abs_le_nat {M h g u v : ℕ} + (hh : 1 ≤ h ∧ h ≤ M) (hg : 1 ≤ g ∧ g ≤ M) + (hu : 1 ≤ u ∧ u ≤ M) (hv : 1 ≤ v ∧ v ≤ M) : + |(u : ℤ) - v + 2 * ((g : ℤ) - h)| ≤ 3 * ((M : ℤ) - 1) := by + apply fourierPhase_abs_le <;> omega + +/-- Natural-number labels admit no additional solutions modulo `5 * M`. -/ +theorem fourierPhase_dvd_iff_eq_zero_nat {M h g u v : ℕ} + (hM : 1 ≤ M) (hh : 1 ≤ h ∧ h ≤ M) (hg : 1 ≤ g ∧ g ≤ M) + (hu : 1 ≤ u ∧ u ≤ M) (hv : 1 ≤ v ∧ v ≤ M) : + ((5 : ℤ) * M ∣ (u : ℤ) - v + 2 * ((g : ℤ) - h)) ↔ + (u : ℤ) - v + 2 * ((g : ℤ) - h) = 0 := by + apply fourierPhase_dvd_iff_eq_zero <;> omega + +/-- Zero-based finite labels have the same exponent as the paper's labels plus one. -/ +theorem fourierPhase_abs_le_fin {M : ℕ} (h g u v : Fin M) : + |(u.val : ℤ) - v.val + 2 * ((g.val : ℤ) - h.val)| ≤ + 3 * ((M : ℤ) - 1) := by + have hh := h.isLt + have hg := g.isLt + have hu := u.isLt + have hv := v.isLt + rw [abs_le'] + constructor <;> omega + +/-- The support test for a Fourier projection indexed by `Fin M`. -/ +theorem fourierPhase_dvd_iff_eq_zero_fin {M : ℕ} (h g u v : Fin M) : + ((5 : ℤ) * M ∣ (u.val : ℤ) - v.val + 2 * ((g.val : ℤ) - h.val)) ↔ + (u.val : ℤ) - v.val + 2 * ((g.val : ℤ) - h.val) = 0 := by + constructor + · intro hdiv + apply Int.eq_zero_of_abs_lt_dvd hdiv + apply lt_of_le_of_lt (fourierPhase_abs_le_fin h g u v) + apply fourierRadius_lt_modulus + have hh := h.isLt + omega + · intro hzero + rw [hzero] + exact ⟨0, by simp⟩ + +end MatrixMultiplication.AuxiliarySeparation + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Separation/SquareWeights.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Separation/SquareWeights.lean new file mode 100644 index 0000000000000000000000000000000000000000..2592d0adba3c73d7d8925262e8e2568c79656c1d --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Separation/SquareWeights.lean @@ -0,0 +1,115 @@ +import Mathlib.Data.Int.Basic +import Mathlib.Tactic + +namespace OAI + +/-!+# The square weights in auxiliary separation + +Sections 4.1–4.3 use the phase `u - v + 2 * (g - h)` to select monomials. +On a selected monomial, the three integer variable weights add to `(g - h)^2`. +Thus the surviving monomials have nonnegative total degree, although individual +variable weights may be negative. Their degree is zero precisely when the guess +`g` matches the sector `h` and the auxiliary labels agree. +-/ + +namespace MatrixMultiplication.AuxiliarySeparation + +/-- The exponent occurring in the finite Fourier projection. -/ +def phase (g h u v : ℤ) : ℤ := u - v + 2 * (g - h) + +/-- Weight on the first tensor leg, which carries the guessed sector label. -/ +def firstWeight (g : ℤ) : ℤ := g ^ 2 + +/-- Weight on the second tensor leg. -/ +def secondWeight (h u : ℤ) : ℤ := h * u - h ^ 2 + +/-- Weight on the third tensor leg. -/ +def thirdWeight (h v : ℤ) : ℤ := -(h * v) + +/-- Total weight of a target monomial after the three independent substitutions. -/ +def totalWeight (g h u v : ℤ) : ℤ := + firstWeight g + secondWeight h u + thirdWeight h v + +theorem totalWeight_eq_square_add_phase (g h u v : ℤ) : + totalWeight g h u v = (g - h) ^ 2 + h * phase g h u v := by + unfold totalWeight firstWeight secondWeight thirdWeight phase + ring + +/-- The projection equation converts the total weight into a square. -/ +theorem totalWeight_eq_sq_of_phase_eq_zero {g h u v : ℤ} + (hphase : phase g h u v = 0) : + totalWeight g h u v = (g - h) ^ 2 := by + rw [totalWeight_eq_square_add_phase, hphase, mul_zero, add_zero] + +theorem totalWeight_nonneg_of_phase_eq_zero {g h u v : ℤ} + (hphase : phase g h u v = 0) : 0 ≤ totalWeight g h u v := by + rw [totalWeight_eq_sq_of_phase_eq_zero hphase] + exact sq_nonneg (g - h) + +/-- On the Fourier support, precisely the correctly matched terms have weight zero. -/ +theorem totalWeight_eq_zero_iff_of_phase_eq_zero {g h u v : ℤ} + (hphase : phase g h u v = 0) : + totalWeight g h u v = 0 ↔ g = h ∧ u = v := by + rw [totalWeight_eq_sq_of_phase_eq_zero hphase, sq_eq_zero_iff] + constructor + · intro hzero + have hgh : g = h := sub_eq_zero.mp hzero + refine ⟨hgh, ?_⟩ + unfold phase at hphase + omega + · rintro ⟨hgh, _⟩ + exact sub_eq_zero.mpr hgh + +theorem phase_and_totalWeight_eq_zero_iff (g h u v : ℤ) : + (phase g h u v = 0 ∧ totalWeight g h u v = 0) ↔ g = h ∧ u = v := by + constructor + · rintro ⟨hphase, hweight⟩ + exact (totalWeight_eq_zero_iff_of_phase_eq_zero hphase).mp hweight + · rintro ⟨rfl, rfl⟩ + simp [phase, totalWeight, firstWeight, secondWeight, thirdWeight] + +theorem totalWeight_pos_iff_of_phase_eq_zero {g h u v : ℤ} + (hphase : phase g h u v = 0) : + 0 < totalWeight g h u v ↔ g ≠ h := by + rw [totalWeight_eq_sq_of_phase_eq_zero hphase, sq_pos_iff, sub_ne_zero] + +/-- The degree bound in Section 4.3, for sector labels in `1, …, M`. -/ +theorem totalWeight_le_of_labels {M g h u v : ℤ} + (hg : 1 ≤ g ∧ g ≤ M) (hh : 1 ≤ h ∧ h ≤ M) + (hphase : phase g h u v = 0) : + totalWeight g h u v ≤ (M - 1) ^ 2 := by + rw [totalWeight_eq_sq_of_phase_eq_zero hphase] + have hprod : 0 ≤ ((M - 1) - (g - h)) * ((M - 1) + (g - h)) := + mul_nonneg (by omega) (by omega) + nlinarith + +/-- The polynomial degree attached to a surviving monomial. -/ +def totalDegree (g h u v : ℤ) : ℕ := (totalWeight g h u v).toNat + +theorem totalDegree_cast_of_phase_eq_zero {g h u v : ℤ} + (hphase : phase g h u v = 0) : + (totalDegree g h u v : ℤ) = totalWeight g h u v := by + exact Int.toNat_of_nonneg (totalWeight_nonneg_of_phase_eq_zero hphase) + +theorem totalDegree_eq_zero_iff_of_phase_eq_zero {g h u v : ℤ} + (hphase : phase g h u v = 0) : + totalDegree g h u v = 0 ↔ g = h ∧ u = v := by + have hcast := totalDegree_cast_of_phase_eq_zero hphase + have hzero : totalDegree g h u v = 0 ↔ totalWeight g h u v = 0 := by omega + exact hzero.trans (totalWeight_eq_zero_iff_of_phase_eq_zero hphase) + +theorem totalDegree_le_of_labels {M : ℕ} {g h u v : ℤ} + (hg : 1 ≤ g ∧ g ≤ M) (hh : 1 ≤ h ∧ h ≤ M) + (hphase : phase g h u v = 0) : + totalDegree g h u v ≤ (M - 1) ^ 2 := by + have hM : 1 ≤ M := by omega + have hbound := totalWeight_le_of_labels hg hh hphase + have hcast := totalDegree_cast_of_phase_eq_zero hphase + have hsub : ((M - 1 : ℕ) : ℤ) = (M : ℤ) - 1 := by omega + exact_mod_cast (show (totalDegree g h u v : ℤ) ≤ ((M - 1 : ℕ) : ℤ) ^ 2 by + rw [hcast, hsub] + exact hbound) + +end MatrixMultiplication.AuxiliarySeparation + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Spectrum/Catalyst.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Spectrum/Catalyst.lean new file mode 100644 index 0000000000000000000000000000000000000000..6ed7da05625241b18609217b19ddd01e15353d41 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Spectrum/Catalyst.lean @@ -0,0 +1,85 @@ +import Mathlib.GroupTheory.MonoidLocalization.GrothendieckGroup +import Mathlib.Tactic + +namespace OAI + +/-! +# Catalysts from additive completion certificates + +Equality in the Grothendieck additive group means equality after adding a +common element of the original semiring. This gives catalytic inequalities +without assuming additive cancellation. +-/ + +namespace MatrixMultiplication.AuxiliarySeparation + +open Algebra + +variable {S : Type*} [CommSemiring S] [Preorder S] + +/-- A negative-unit certificate in the additive completion gives a catalytic +inequality in the original semiring, even when its addition is not cancellative. -/ +theorem exists_catalyst_of_completion_eq + (hadd : ∀ a b c d : S, a ≤ b → c ≤ d → a + c ≤ b + d) + (m k : ℕ) (d X Y s : S) (hXY : X ≤ Y) + (heq : -(m : ℤ) • GrothendieckAddGroup.of (1 : S) = + GrothendieckAddGroup.of Y - GrothendieckAddGroup.of X + + GrothendieckAddGroup.of (d * s) - k • GrothendieckAddGroup.of s) : + ∃ D : S, D + (m : S) + d * s ≤ D + (k : S) * s := by + let η : S →+ GrothendieckAddGroup S := GrothendieckAddGroup.of + have hm : η (m : S) = m • η 1 := by + rw [← nsmul_one m, map_nsmul] + have hk : η ((k : S) * s) = k • η s := by + rw [← nsmul_eq_mul, map_nsmul] + have heq' : η ((m : S) + Y + d * s) = η (X + (k : S) * s) := by + simp only [map_add, hm, hk] + change -(m : ℤ) • η 1 = η Y - η X + η (d * s) - k • η s at heq + simp only [neg_zsmul, natCast_zsmul] at heq + calc + m • η 1 + η Y + η (d * s) = + m • η 1 + (η Y - η X + η (d * s) - k • η s) + η X + k • η s := by abel + _ = m • η 1 + -(m • η 1) + η X + k • η s := by rw [← heq] + _ = η X + k • η s := by abel + obtain ⟨C, hC⟩ := (AddLocalization.addMonoidOf (⊤ : AddSubmonoid S)).exists_of_eq heq' + refine ⟨(C : S) + Y, ?_⟩ + calc + ((C : S) + Y) + (m : S) + d * s = (C : S) + ((m : S) + Y + d * s) := by ac_rfl + _ = (C : S) + (X + (k : S) * s) := hC + _ ≤ (C : S) + (Y + (k : S) * s) := + hadd _ _ _ _ le_rfl (hadd _ _ _ _ hXY le_rfl) + _ = ((C : S) + Y) + (k : S) * s := by ac_rfl + +/-- A finite nonnegative integral combination of completion relations gives +one catalytic inequality. The catalyst absorbs the aggregate of the ordered +relations, and the resulting test element is the same combination of the +original test elements. -/ +theorem exists_catalyst_of_completion_sum_eq + (hadd : ∀ a b c d : S, a ≤ b → c ≤ d → a + c ≤ b + d) + {I : Type*} [Fintype I] (m k : ℕ) (d : S) + (n : I → ℕ) (X Y Z : I → S) (hXY : ∀ i, X i ≤ Y i) + (heq : -(m : ℤ) • GrothendieckAddGroup.of (1 : S) = + ∑ i, n i • (GrothendieckAddGroup.of (Y i) - GrothendieckAddGroup.of (X i) + + GrothendieckAddGroup.of (d * Z i) - k • GrothendieckAddGroup.of (Z i))) : + ∃ D : S, D + (m : S) + d * (∑ i, n i • Z i) ≤ + D + (k : S) * (∑ i, n i • Z i) := by + classical + have hnsmul (a b : S) (hab : a ≤ b) (l : ℕ) : l • a ≤ l • b := by + induction l with + | zero => simp + | succ l ih => simpa only [succ_nsmul] using hadd _ _ _ _ ih hab + have hsum (t : Finset I) : ∑ i ∈ t, n i • X i ≤ ∑ i ∈ t, n i • Y i := by + induction t using Finset.induction_on with + | empty => simp + | @insert i t hi ih => + simpa only [Finset.sum_insert hi] using + hadd _ _ _ _ (hnsmul (X i) (Y i) (hXY i) (n i)) ih + apply exists_catalyst_of_completion_eq hadd m k d + (∑ i, n i • X i) (∑ i, n i • Y i) (∑ i, n i • Z i) (hsum Finset.univ) + convert heq using 1 + simp only [smul_sub, smul_add, Finset.sum_sub_distrib, Finset.sum_add_distrib, + map_sum, map_nsmul, Finset.mul_sum, mul_smul_comm, ← smul_comm k] + rw [Finset.smul_sum] + +end MatrixMultiplication.AuxiliarySeparation + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Spectrum/Coordinates.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Spectrum/Coordinates.lean new file mode 100644 index 0000000000000000000000000000000000000000..4a61cb6e619630ecb4245d1f60746f347ccf7ebd --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Spectrum/Coordinates.lean @@ -0,0 +1,68 @@ +import Mathlib.LinearAlgebra.Finsupp.LinearCombination +import Mathlib.Basic.Real.Basic + +namespace OAI + +/-! +# Extending a finite coordinate functional + +A linear functional on a finite coordinate set determines a state on the +whole index type by evaluating coordinate indicators. Its value on any +finitely supported integral vector depends only on those finite coordinates. +-/ + +noncomputable section + +namespace MatrixMultiplication.AuxiliarySeparation + +/-- Extend a functional on a finite coordinate set by zero outside that set. -/ +def finiteCoordinateState {S : Type*} (H : Finset S) + (L : (H → ℝ) →ₗ[ℝ] ℝ) (x : S) : ℝ := by + classical + exact L (fun j : H ↦ if (j : S) = x then 1 else 0) + +@[simp] theorem finiteCoordinateState_eq_zero_of_not_mem {S : Type*} + (H : Finset S) (L : (H → ℝ) →ₗ[ℝ] ℝ) {x : S} (hx : x ∉ H) : + finiteCoordinateState H L x = 0 := by + classical + unfold finiteCoordinateState + have hz : (fun j : H ↦ if (j : S) = x then (1 : ℝ) else 0) = 0 := by + funext j + simp only [Pi.zero_apply, ite_eq_right_iff, one_ne_zero, imp_false] + exact fun h ↦ hx (h ▸ j.property) + rw [hz, map_zero] + +/-- Evaluating a finitely supported integral vector against the extended +state agrees with restricting its coordinates and applying the functional. -/ +theorem linearCombination_finiteCoordinateState {S : Type*} + (H : Finset S) (L : (H → ℝ) →ₗ[ℝ] ℝ) (v : S →₀ ℤ) : + Finsupp.linearCombination ℤ (finiteCoordinateState H L) v = + L (fun j : H ↦ (v j : ℝ)) := by + classical + induction v using Finsupp.induction with + | zero => + simp only [map_zero, Finsupp.zero_apply, Int.cast_zero] + exact (L.map_zero).symm + | single_add x n v _ _ ih => + rw [map_add, Finsupp.linearCombination_single, ih] + have hsingle : + (fun j : H ↦ ((Finsupp.single x n : S →₀ ℤ) j : ℝ)) = + n • (fun j : H ↦ if (j : S) = x then (1 : ℝ) else 0) := by + funext j + by_cases hj : (j : S) = x + · simp [hj] + · simp [hj] + have hadd : + (fun j : H ↦ ((Finsupp.single x n + v) j : ℝ)) = + (fun j : H ↦ ((Finsupp.single x n : S →₀ ℤ) j : ℝ)) + + (fun j : H ↦ (v j : ℝ)) := by + funext j + simp + rw [hadd, map_add, hsingle, map_zsmul] + rfl + +end MatrixMultiplication.AuxiliarySeparation + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Spectrum/MultiplicativeStates.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Spectrum/MultiplicativeStates.lean new file mode 100644 index 0000000000000000000000000000000000000000..379b06b92fedfd30588bce9d6d208436a2288643 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Spectrum/MultiplicativeStates.lean @@ -0,0 +1,232 @@ +import OAI.LinearAlgebra.MatrixMultiplication.AuxiliarySeparation.Convex.FixedPoint +import OAI.LinearAlgebra.MatrixMultiplication.AuxiliarySeparation.Spectrum.NormalizedStates + +namespace OAI + +/-! Multiplicative states obtained by normalizing translates of additive states. -/ + +noncomputable section + +namespace MatrixMultiplication.AuxiliarySeparation + +open Set + +variable {S : Type*} [CommSemiring S] + +/-- Translate a state by multiplication, then normalize at the unit. -/ +def normalizedTranslate (z : S) (f : S → ℝ) : S → ℝ := + fun x => f (z * x) / f z + +theorem normalizedTranslate_continuousOn {K : Set (S → ℝ)} (z : S) + (hz : ∀ f ∈ K, f z ≠ 0) : + Continuous (fun f : K => normalizedTranslate z f.val) := by + apply continuous_pi + intro x + exact ((continuous_apply (z * x)).comp continuous_subtype_val).div + ((continuous_apply z).comp continuous_subtype_val) (fun f => hz f.val f.property) + +def frozenConstraint (z : S) (c : ℝ) : Set (S → ℝ) := + {f | ∀ x, f (z * x) = c * f x} + +def frozenSlice (C : Set (S → ℝ)) (z : S) (c : ℝ) : Set (S → ℝ) := + C ∩ frozenConstraint z c + +theorem frozenConstraint_isClosed (z : S) (c : ℝ) : + IsClosed (frozenConstraint z c) := by + unfold frozenConstraint + simp only [ofPred_forall] + exact isClosed_iInter fun x => + isClosed_eq (continuous_apply (z * x)) (continuous_const.mul (continuous_apply x)) + +theorem frozenSlice_isClosed {C : Set (S → ℝ)} (hC : IsClosed C) (z : S) (c : ℝ) : + IsClosed (frozenSlice C z c) := + hC.inter (frozenConstraint_isClosed z c) + +theorem frozenSlice_isCompact {C : Set (S → ℝ)} (hC : IsCompact C) (z : S) (c : ℝ) : + IsCompact (frozenSlice C z c) := + hC.inter_right (frozenConstraint_isClosed z c) + +theorem frozenConstraint_convex (z : S) (c : ℝ) : + Convex ℝ (frozenConstraint z c) := by + intro f hf g hg a b _ _ _ x + change a * f (z * x) + b * g (z * x) = c * (a * f x + b * g x) + rw [hf x, hg x] + ring + +theorem frozenSlice_convex {C : Set (S → ℝ)} (hC : Convex ℝ C) (z : S) (c : ℝ) : + Convex ℝ (frozenSlice C z c) := + hC.inter (frozenConstraint_convex z c) + +theorem normalizedTranslate_mem_frozenConstraint {z w : S} {c : ℝ} {f : S → ℝ} + (hf : f ∈ frozenConstraint z c) : + normalizedTranslate w f ∈ frozenConstraint z c := by + intro x + change f (w * (z * x)) / f w = c * (f (w * x) / f w) + rw [show w * (z * x) = z * (w * x) by ac_rfl, hf (w * x)] + ring + +theorem frozenSlice_mapsTo_normalizedTranslate {C : Set (S → ℝ)} {z w : S} {c : ℝ} + (hC : MapsTo (normalizedTranslate w) C C) : + MapsTo (normalizedTranslate w) (frozenSlice C z c) (frozenSlice C z c) := by + intro f hf + exact ⟨hC hf.1, normalizedTranslate_mem_frozenConstraint hf.2⟩ + +theorem frozenConstraint_value {z : S} {c : ℝ} {f : S → ℝ} + (hf : f ∈ frozenConstraint z c) (hf1 : f 1 = 1) : f z = c := by + simpa only [mul_one, hf1] using hf 1 + +theorem frozenConstraint_normalizedTranslate_eq {z : S} {c : ℝ} {f : S → ℝ} + (hf : f ∈ frozenConstraint z c) (hf1 : f 1 = 1) (hfz : f z ≠ 0) : + normalizedTranslate z f = f := by + funext x + change f (z * x) / f z = f x + rw [hf x, ← frozenConstraint_value hf hf1] + exact mul_div_cancel_left₀ (f x) hfz + +theorem normalizedTranslate_eq_mem_frozenConstraint {z : S} {f : S → ℝ} + (hfz : f z ≠ 0) (hf : normalizedTranslate z f = f) : + f ∈ frozenConstraint z (f z) := by + intro x + have hx : f (z * x) / f z = f x := congrFun hf x + exact (div_eq_iff hfz).mp hx |>.trans (mul_comm _ _) + +theorem normalizedTranslate_eq_nonzero {z : S} {f : S → ℝ} + (hf1 : f 1 = 1) (hf : normalizedTranslate z f = f) : f z ≠ 0 := by + intro hfz + have hx := congrFun hf 1 + simp [normalizedTranslate, hfz, hf1] at hx + +theorem normalizedTranslate_eq_mem_frozenConstraint_of_normalized {z : S} {f : S → ℝ} + (hf1 : f 1 = 1) (hf : normalizedTranslate z f = f) : + f ∈ frozenConstraint z (f z) := + normalizedTranslate_eq_mem_frozenConstraint (normalizedTranslate_eq_nonzero hf1 hf) hf + +theorem normalizedTranslate_eq_mem_frozenSlice {C : Set (S → ℝ)} {z : S} {f : S → ℝ} + (hfC : f ∈ C) (hf1 : f 1 = 1) (hf : normalizedTranslate z f = f) : + f ∈ frozenSlice C z (f z) := + ⟨hfC, normalizedTranslate_eq_mem_frozenConstraint_of_normalized hf1 hf⟩ + +/-- Every finite collection of multiplication identities holds throughout a +nonempty compact convex subset that remains invariant under all translates. -/ +theorem exists_finite_multiplicative_slice {K : Set (S → ℝ)} + (hKcompact : IsCompact K) (hKconvex : Convex ℝ K) (hKne : K.Nonempty) + (hKnorm : ∀ f ∈ K, f 1 = 1) + (hKnonzero : ∀ f ∈ K, ∀ z : S, z ≠ 0 → f z ≠ 0) + (hKmap : ∀ z : S, z ≠ 0 → MapsTo (normalizedTranslate z) K K) + (t : Finset {z : S // z ≠ 0}) : + ∃ C : Set (S → ℝ), C ⊆ K ∧ C.Nonempty ∧ IsCompact C ∧ Convex ℝ C ∧ + (∀ z : S, z ≠ 0 → MapsTo (normalizedTranslate z) C C) ∧ + ∀ f ∈ C, ∀ z ∈ t, ∀ x, f (z.val * x) = f z.val * f x := by + classical + induction t using Finset.induction_on with + | empty => + exact ⟨K, Subset.rfl, hKne, hKcompact, hKconvex, hKmap, by simp⟩ + | @insert z t hzt ih => + obtain ⟨C, hCK, hCne, hCcompact, hCconvex, hCmap, hCt⟩ := ih + let P : C → C := fun f => + ⟨normalizedTranslate z.val f.val, hCmap z.val z.property f.property⟩ + have hP : Continuous P := by + apply Continuous.subtype_mk + exact normalizedTranslate_continuousOn z.val + (fun f hf => hKnonzero f (hCK hf) z.val z.property) + obtain ⟨g, hg⟩ := compact_convex_fixedPoint_of_continuous + hCcompact hCconvex hCne P hP + have hg' : normalizedTranslate z.val g.val = g.val := congrArg Subtype.val hg + let c : ℝ := g.val z.val + let D := frozenSlice C z.val c + have hDC : D ⊆ C := fun _ hf => hf.1 + have hDK : D ⊆ K := hDC.trans hCK + refine ⟨D, hDK, ?_, frozenSlice_isCompact hCcompact z.val c, + frozenSlice_convex hCconvex z.val c, ?_, ?_⟩ + · exact ⟨g.val, normalizedTranslate_eq_mem_frozenSlice g.property + (hKnorm g.val (hCK g.property)) hg'⟩ + · intro w hw + exact frozenSlice_mapsTo_normalizedTranslate (hCmap w hw) + · intro f hf w hw x + rcases Finset.mem_insert.mp hw with rfl | hwt + · have hfc : f w.val = c := frozenConstraint_value hf.2 (hKnorm f (hDK hf)) + rw [hfc] + exact hf.2 x + · exact hCt f (hDC hf) w hwt x + +/-- A compact convex normalized state space invariant under multiplication +translates contains a multiplicative state. Frozen eigenvalue slices preserve +convexity at each finite fixed-point step. -/ +theorem exists_multiplicative_of_invariant_states {K : Set (S → ℝ)} + (hKcompact : IsCompact K) (hKconvex : Convex ℝ K) (hKne : K.Nonempty) + (hKnorm : ∀ f ∈ K, f 1 = 1) (hKzero : ∀ f ∈ K, f 0 = 0) + (hKnonzero : ∀ f ∈ K, ∀ z : S, z ≠ 0 → f z ≠ 0) + (hKmap : ∀ z : S, z ≠ 0 → MapsTo (normalizedTranslate z) K K) : + ∃ f ∈ K, ∀ x y, f (x * y) = f x * f y := by + classical + let : CompactSpace K := isCompact_iff_compactSpace.mp hKcompact + let F : {z : S // z ≠ 0} → Set K := + fun z => {f | ∀ x, f.val (z.val * x) = f.val z.val * f.val x} + have hFclosed (z : {z : S // z ≠ 0}) : IsClosed (F z) := by + change IsClosed {f : K | ∀ x, f.val (z.val * x) = f.val z.val * f.val x} + simp only [ofPred_forall] + exact isClosed_iInter fun x => + isClosed_eq ((continuous_apply (z.val * x)).comp continuous_subtype_val) + (((continuous_apply z.val).comp continuous_subtype_val).mul + ((continuous_apply x).comp continuous_subtype_val)) + have hFfinite (t : Finset {z : S // z ≠ 0}) : (⋂ z ∈ t, F z).Nonempty := by + obtain ⟨C, hCK, hCne, _, _, _, hCt⟩ := exists_finite_multiplicative_slice + hKcompact hKconvex hKne hKnorm hKnonzero hKmap t + obtain ⟨f, hf⟩ := hCne + refine ⟨⟨f, hCK hf⟩, ?_⟩ + simp only [mem_iInter] + intro z hz + exact hCt f hf z hz + obtain ⟨f, hf⟩ := CompactSpace.iInter_nonempty hFclosed hFfinite + refine ⟨f.val, f.property, fun x y => ?_⟩ + by_cases hx : x = 0 + · simp [hx, hKzero f.val f.property] + · exact mem_iInter.mp hf ⟨x, hx⟩ y + +/-- Appendix A.2 for a ranked restriction semiring: once the preliminary +normalized state set is nonempty, it contains a multiplicative state. -/ +theorem normalizedStates_exists_multiplicative [Preorder S] + (R : S → ℕ) (d : S) (k : ℝ) + (hunit : ∀ z : S, z ≠ 0 → 1 ≤ z) + (hmulmono : ∀ z x y : S, x ≤ y → z * x ≤ z * y) + (hdom : ∀ z x : S, z * x ≤ (R x : S) * z) + (hne : (normalizedStates (fun x => (R x : ℝ)) d k).Nonempty) : + ∃ f ∈ normalizedStates (fun x => (R x : ℝ)) d k, + ∀ x y, f (x * y) = f x * f y := by + apply exists_multiplicative_of_invariant_states + (normalizedStates_isCompact _ d k) (normalizedStates_convex _ d k) hne + · exact fun _ hf => hf.2.1 + · exact fun _ hf => state_zero hf + · intro f hf z hz + exact ne_of_gt (lt_of_lt_of_le zero_lt_one (state_one_le hf (hunit z hz))) + · intro z hz f hf + exact state_rescale hf z (hunit z hz) (hmulmono z) (hdom z) + +/-- The multiplicative state as a normalized monotone semiring homomorphism, +with the original rank bounds and detector inequality preserved. -/ +theorem exists_monotone_semiringHom_of_normalizedStates [Preorder S] + (R : S → ℕ) (d : S) (k : ℝ) + (hunit : ∀ z : S, z ≠ 0 → 1 ≤ z) + (hmulmono : ∀ z x y : S, x ≤ y → z * x ≤ z * y) + (hdom : ∀ z x : S, z * x ≤ (R x : S) * z) + (hne : (normalizedStates (fun x => (R x : ℝ)) d k).Nonempty) : + ∃ χ : S →+* ℝ, Monotone χ ∧ (∀ x, 0 ≤ χ x ∧ χ x ≤ R x) ∧ k ≤ χ d := by + obtain ⟨f, hf, hfmul⟩ := + normalizedStates_exists_multiplicative R d k hunit hmulmono hdom hne + let χ : S →+* ℝ := + { toFun := f + map_zero' := state_zero hf + map_one' := hf.2.1 + map_add' := hf.2.2.1 + map_mul' := hfmul } + refine ⟨χ, ?_, hf.1, ?_⟩ + · intro x y hxy + exact hf.2.2.2.1 x y hxy + · simpa only [χ, RingHom.coe_mk, MonoidHom.coe_mk, OneHom.coe_mk, + mul_one, hf.2.1] using hf.2.2.2.2 1 + +end MatrixMultiplication.AuxiliarySeparation + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Spectrum/NormalizedStates.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Spectrum/NormalizedStates.lean new file mode 100644 index 0000000000000000000000000000000000000000..7b0dedbf39b26b842cf35641f7efe87e8dd45031 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Spectrum/NormalizedStates.lean @@ -0,0 +1,145 @@ +import Mathlib.Analysis.Convex.Topology +import Mathlib.Topology.Algebra.Order.Field + +namespace OAI + +/-! +# Compact convex spaces of normalized additive states + +These are the closed linear constraints in Appendix A. The nonemptiness of +this state space, and its instantiation by the tensor restriction semiring, +are separate statements. +-/ + +noncomputable section + +namespace MatrixMultiplication.AuxiliarySeparation + +open Set + +variable {S : Type*} [CommSemiring S] [Preorder S] + +/-- Additive restriction-monotone states with a fixed detector inequality. -/ +def normalizedStates (R : S → ℝ) (d : S) (k : ℝ) : Set (S → ℝ) := + {f | (∀ x, 0 ≤ f x ∧ f x ≤ R x) ∧ f 1 = 1 ∧ + (∀ x y, f (x + y) = f x + f y) ∧ + (∀ x y, x ≤ y → f x ≤ f y) ∧ + (∀ x, k * f x ≤ f (d * x))} + +theorem normalizedStates_isClosed (R : S → ℝ) (d : S) (k : ℝ) : + IsClosed (normalizedStates R d k) := by + unfold normalizedStates + have hb : IsClosed {f : S → ℝ | ∀ x, 0 ≤ f x ∧ f x ≤ R x} := by + simp only [ofPred_forall] + apply isClosed_iInter + intro x + exact (isClosed_le continuous_const (continuous_apply x)).inter + (isClosed_le (continuous_apply x) continuous_const) + have hn : IsClosed {f : S → ℝ | f 1 = 1} := + isClosed_eq (continuous_apply 1) continuous_const + have ha : IsClosed {f : S → ℝ | ∀ x y, f (x + y) = f x + f y} := by + simp only [ofPred_forall] + exact isClosed_iInter fun x => isClosed_iInter fun y => + isClosed_eq (continuous_apply (x + y)) + ((continuous_apply x).add (continuous_apply y)) + have hm : IsClosed {f : S → ℝ | ∀ x y, x ≤ y → f x ≤ f y} := by + simp only [ofPred_forall] + exact isClosed_iInter fun x => isClosed_iInter fun y => + isClosed_iInter fun _ => isClosed_le (continuous_apply x) (continuous_apply y) + have hd : IsClosed {f : S → ℝ | ∀ x, k * f x ≤ f (d * x)} := by + simp only [ofPred_forall] + exact isClosed_iInter fun x => + isClosed_le (continuous_const.mul (continuous_apply x)) (continuous_apply (d * x)) + exact hb.inter (hn.inter (ha.inter (hm.inter hd))) + +theorem normalizedStates_isCompact (R : S → ℝ) (d : S) (k : ℝ) : + IsCompact (normalizedStates R d k) := by + apply (isCompact_univ_pi (fun x => isCompact_Icc (a := (0 : ℝ)) (b := R x))).of_isClosed_subset + (normalizedStates_isClosed R d k) + intro f hf x _ + exact hf.1 x + +theorem normalizedStates_convex (R : S → ℝ) (d : S) (k : ℝ) : + Convex ℝ (normalizedStates R d k) := by + intro f hf g hg a b ha hb hab + refine ⟨?_, ?_, ?_, ?_, ?_⟩ + · intro x + change 0 ≤ a * f x + b * g x ∧ a * f x + b * g x ≤ R x + constructor + · exact add_nonneg (mul_nonneg ha (hf.1 x).1) (mul_nonneg hb (hg.1 x).1) + · calc + a * f x + b * g x ≤ a * R x + b * R x := + add_le_add (mul_le_mul_of_nonneg_left (hf.1 x).2 ha) + (mul_le_mul_of_nonneg_left (hg.1 x).2 hb) + _ = R x := by rw [← add_mul, hab, one_mul] + · change a * f 1 + b * g 1 = 1 + rw [hf.2.1, hg.2.1, mul_one, mul_one, hab] + · intro x y + change a * f (x + y) + b * g (x + y) = + (a * f x + b * g x) + (a * f y + b * g y) + rw [hf.2.2.1, hg.2.2.1] + ring + · intro x y hxy + exact add_le_add (mul_le_mul_of_nonneg_left (hf.2.2.2.1 x y hxy) ha) + (mul_le_mul_of_nonneg_left (hg.2.2.2.1 x y hxy) hb) + · intro x + change k * (a * f x + b * g x) ≤ a * f (d * x) + b * g (d * x) + calc + k * (a * f x + b * g x) = a * (k * f x) + b * (k * g x) := by ring + _ ≤ a * f (d * x) + b * g (d * x) := + add_le_add (mul_le_mul_of_nonneg_left (hf.2.2.2.2 x) ha) + (mul_le_mul_of_nonneg_left (hg.2.2.2.2 x) hb) + +theorem state_zero {R : S → ℝ} {d : S} {k : ℝ} {f : S → ℝ} + (hf : f ∈ normalizedStates R d k) : f 0 = 0 := by + have h := hf.2.2.1 0 0 + rw [zero_add] at h + linarith + +theorem state_nat_mul {R : S → ℝ} {d : S} {k : ℝ} {f : S → ℝ} + (hf : f ∈ normalizedStates R d k) (n : ℕ) (x : S) : + f ((n : S) * x) = (n : ℝ) * f x := by + induction n with + | zero => simp [state_zero hf] + | succ n ih => + rw [Nat.cast_add, Nat.cast_one, add_mul, one_mul, hf.2.2.1, ih] + push_cast + ring + +theorem state_one_le {R : S → ℝ} {d : S} {k : ℝ} {f : S → ℝ} + (hf : f ∈ normalizedStates R d k) {z : S} (hz : 1 ≤ z) : 1 ≤ f z := by + simpa only [hf.2.1] using hf.2.2.2.1 1 z hz + +/-- Translation followed by normalization preserves every state constraint. +The two order hypotheses are exactly those supplied by tensor multiplication +and the finite rank bound in the restriction semiring. -/ +theorem state_rescale {R : S → ℕ} {d : S} {k : ℝ} {f : S → ℝ} + (hf : f ∈ normalizedStates (fun x => (R x : ℝ)) d k) (z : S) + (hz : 1 ≤ z) + (hmulmono : ∀ x y : S, x ≤ y → z * x ≤ z * y) + (hdom : ∀ x : S, z * x ≤ (R x : S) * z) : + (fun x => f (z * x) / f z) ∈ normalizedStates (fun x => (R x : ℝ)) d k := by + have hfz : 0 < f z := lt_of_lt_of_le zero_lt_one (state_one_le hf hz) + refine ⟨?_, ?_, ?_, ?_, ?_⟩ + · intro x + refine ⟨div_nonneg (hf.1 (z * x)).1 hfz.le, ?_⟩ + apply (div_le_iff₀ hfz).mpr + have h := hf.2.2.2.1 (z * x) ((R x : S) * z) (hdom x) + simpa only [state_nat_mul hf] using h + · simp [mul_one, ne_of_gt hfz] + · intro x y + change f (z * (x + y)) / f z = f (z * x) / f z + f (z * y) / f z + rw [mul_add, hf.2.2.1, add_div] + · intro x y hxy + exact div_le_div_of_nonneg_right (hf.2.2.2.1 _ _ (hmulmono x y hxy)) hfz.le + · intro x + have h := hf.2.2.2.2 (z * x) + have hc : d * (z * x) = z * (d * x) := by ring + rw [hc] at h + simpa only [mul_div_assoc] using div_le_div_of_nonneg_right h hfz.le + +end MatrixMultiplication.AuxiliarySeparation + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Spectrum/Obstruction.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Spectrum/Obstruction.lean new file mode 100644 index 0000000000000000000000000000000000000000..2144915b1837978be583cd162fa9839527f9c225 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Spectrum/Obstruction.lean @@ -0,0 +1,369 @@ +import OAI.LinearAlgebra.MatrixMultiplication.AuxiliarySeparation.Arithmetic.RankExponent +import OAI.LinearAlgebra.MatrixMultiplication.AuxiliarySeparation.Growth.PolynomialOverhead +import OAI.LinearAlgebra.MatrixMultiplication.AuxiliarySeparation.Growth.SpectralLimit +import OAI.LinearAlgebra.MatrixMultiplication.AuxiliarySeparation.Tensor.Scalar + +namespace OAI + +/-! +# The rank obstruction behind the preliminary spectral state + +The finite catalyst is kept fixed while first tensor powers, then exponent +slack, then the number of copies are varied. The hypotheses below isolate the +rank inequalities supplied by the catalytic comparison; they do not assert +the existence of a tensor spectrum or the separation argument producing that +comparison. +-/ + +noncomputable section + +open MatrixMultiplication.Foundation + +namespace MatrixMultiplication.AuxiliarySeparation + +/-- Tensor powers of a fixed exact matrix algorithm retain their exact rank +bound after identifying the product coordinates with one matrix dimension. -/ +theorem exactMatrixRank_pow_le (u j : ℕ) : + exactMatrixRank (u ^ j) ≤ exactMatrixRank u ^ j := by + classical + let e : Fin (u ^ j) ≃ (Fin j → Fin u) := Fintype.equivOfCardEq (by simp) + let f : Fin (u ^ j) × Fin (u ^ j) → Fin j → Fin u × Fin u := + fun x i => (e x.1 i, e x.2 i) + have h := ((exactMatrixRank_spec u).power j).pullback f f f + have heq : Tensor.pullback f f f (Tensor.power (Tensor.matrixMultiplication u u u) j) = + Tensor.matrixMultiplication (u ^ j) (u ^ j) (u ^ j) := by + funext x y z + simp only [Tensor.pullback, Tensor.power, Tensor.matrixMultiplication, f, + Fintype.prod_boole, forall_and, ← funext_iff, e.injective.eq_iff] + rw [heq] at h + exact exactRank_le h + +/-- A floor approximation uses at most `n^j` copies of a fixed matrix +algorithm and loses at most one factor of its fixed matrix dimension. -/ +theorem floor_rank_power_bounds {u n R : ℕ} (hu : 2 ≤ u) (hn : 1 ≤ n) + {τ : ℝ} (hτ : 0 < τ) (hR : (R : ℝ) ≤ (u : ℝ) ^ τ) (j : ℕ) : + let l := ⌊(j : ℝ) * Real.logb (u : ℝ) (n : ℝ) / τ⌋₊ + (R : ℝ) ^ l ≤ (n : ℝ) ^ j ∧ + (n : ℝ) ^ ((j : ℝ) / τ) ≤ (u : ℝ) * (u : ℝ) ^ l := by + have hu1 : (1 : ℝ) < u := by exact_mod_cast (show 1 < u by omega) + have hu0 : (0 : ℝ) < u := zero_lt_one.trans hu1 + have hn1 : (1 : ℝ) ≤ n := by exact_mod_cast hn + have hn0 : (0 : ℝ) < n := zero_lt_one.trans_le hn1 + let x := (j : ℝ) * Real.logb (u : ℝ) (n : ℝ) / τ + let l := ⌊x⌋₊ + have hx : 0 ≤ x := div_nonneg + (mul_nonneg (Nat.cast_nonneg j) (Real.logb_nonneg hu1 hn1)) hτ.le + have hl : (l : ℝ) ≤ x := Nat.floor_le hx + have hxl : x ≤ (l : ℝ) + 1 := (Nat.lt_floor_add_one x).le + have hlog : (u : ℝ) ^ Real.logb (u : ℝ) (n : ℝ) = n := + Real.rpow_logb hu0 (ne_of_gt hu1) hn0 + change (R : ℝ) ^ l ≤ (n : ℝ) ^ j ∧ + (n : ℝ) ^ ((j : ℝ) / τ) ≤ (u : ℝ) * (u : ℝ) ^ l + constructor + · calc + (R : ℝ) ^ l ≤ ((u : ℝ) ^ τ) ^ l := + pow_le_pow_left₀ (Nat.cast_nonneg R) hR l + _ = (u : ℝ) ^ (τ * (l : ℝ)) := by + rw [← Real.rpow_natCast, ← Real.rpow_mul hu0.le] + _ ≤ (u : ℝ) ^ (τ * x) := + Real.rpow_le_rpow_of_exponent_le hu1.le (mul_le_mul_of_nonneg_left hl hτ.le) + _ = (n : ℝ) ^ j := by + rw [show τ * x = Real.logb (u : ℝ) (n : ℝ) * (j : ℝ) by + dsimp [x]; field_simp] + rw [Real.rpow_mul hu0.le, hlog, Real.rpow_natCast] + · calc + (n : ℝ) ^ ((j : ℝ) / τ) = (u : ℝ) ^ x := by + rw [← hlog, ← Real.rpow_mul hu0.le] + congr 1 + dsimp [x] + ring + _ ≤ (u : ℝ) ^ ((l : ℝ) + 1) := + Real.rpow_le_rpow_of_exponent_le hu1.le hxl + _ = (u : ℝ) * (u : ℝ) ^ l := by + rw [Real.rpow_add hu0, Real.rpow_natCast, Real.rpow_one, mul_comm] + +/-- At fixed `n` and exponent slack, every admissible matrix rank budget +forces the exponential growth rate of the catalytic comparison. The constant +`R` is fixed before the tensor-power parameter varies. -/ +theorem catalytic_rank_bound_at_slack {d n K R : ℕ} + (hd : 0 < d) (hn : 1 ≤ n) + (hbound : ∀ j : ℕ, 1 ≤ j → ∀ g : ℕ, exactMatrixRank g ≤ n ^ j → + exactMatrixRank (d ^ j * g) ≤ R * K ^ j) + {δ : ℝ} (hδ : 0 < δ) : + (d : ℝ) ^ exactRankExponent * + (n : ℝ) ^ (exactRankExponent / (exactRankExponent + δ)) ≤ K := by + let ν := exactRankExponent + let τ := ν + δ + have hν : 0 ≤ ν := (by norm_num : (0 : ℝ) ≤ 2).trans exactRankExponent_lower + have hτ : 0 < τ := add_pos_of_nonneg_of_pos hν hδ + obtain ⟨u, hu, huR⟩ := exists_exactMatrixRank_lt_rpow + (show exactRankExponent < τ from lt_add_of_pos_right _ hδ) + apply le_of_eventually_pow_le_const_mul_pow (C := (u : ℝ) ^ ν * R) + (Nat.cast_nonneg K) + filter_upwards [Filter.eventually_ge_atTop (1 : ℕ)] with j hj + let l := ⌊(j : ℝ) * Real.logb (u : ℝ) (n : ℝ) / τ⌋₊ + let g := u ^ l + have hg : 0 < g := pow_pos (by omega) l + have hf := floor_rank_power_bounds hu hn hτ huR.le j + change (exactMatrixRank u : ℝ) ^ l ≤ (n : ℝ) ^ j ∧ + (n : ℝ) ^ ((j : ℝ) / τ) ≤ (u : ℝ) * (u : ℝ) ^ l at hf + have hbudget : exactMatrixRank g ≤ n ^ j := by + have hpow : (exactMatrixRank g : ℝ) ≤ (exactMatrixRank u : ℝ) ^ l := by + exact_mod_cast exactMatrixRank_pow_le u l + have hb := hpow.trans hf.1 + exact_mod_cast hb + have hrank := hbound j hj g hbudget + have hsize : (n : ℝ) ^ ((j : ℝ) / τ) ≤ (u : ℝ) * g := by + simpa only [g, Nat.cast_pow] using hf.2 + have hlow := exactMatrixRank_rpow_lower_of_pos (mul_pos (pow_pos hd j) hg) + have hpow_n : ((n : ℝ) ^ (ν / τ)) ^ j = + ((n : ℝ) ^ ((j : ℝ) / τ)) ^ ν := by + rw [← Real.rpow_natCast, ← Real.rpow_mul (Nat.cast_nonneg n), + ← Real.rpow_mul (Nat.cast_nonneg n)] + congr 1 + ring + calc + ((d : ℝ) ^ ν * (n : ℝ) ^ (ν / τ)) ^ j = + (((d ^ j : ℕ) : ℝ) ^ ν) * ((n : ℝ) ^ ((j : ℝ) / τ)) ^ ν := by + rw [mul_pow, Real.rpow_pow_comm (Nat.cast_nonneg d), hpow_n, Nat.cast_pow] + _ ≤ (((d ^ j : ℕ) : ℝ) ^ ν) * ((u : ℝ) * g) ^ ν := by + exact mul_le_mul_of_nonneg_left + (Real.rpow_le_rpow (Real.rpow_nonneg (Nat.cast_nonneg n) _) hsize hν) + (Real.rpow_nonneg (Nat.cast_nonneg _) _) + _ = (u : ℝ) ^ ν * (((d ^ j * g : ℕ) : ℝ) ^ ν) := by + rw [Nat.cast_mul, Real.mul_rpow (Nat.cast_nonneg u) (Nat.cast_nonneg g), + Real.mul_rpow (Nat.cast_nonneg (d ^ j)) (Nat.cast_nonneg g)] + ring + _ ≤ (u : ℝ) ^ ν * (exactMatrixRank (d ^ j * g) : ℝ) := + mul_le_mul_of_nonneg_left hlow (Real.rpow_nonneg (Nat.cast_nonneg u) _) + _ ≤ (u : ℝ) ^ ν * ((R : ℝ) * (K : ℝ) ^ j) := by + apply mul_le_mul_of_nonneg_left _ (Real.rpow_nonneg (Nat.cast_nonneg u) _) + exact_mod_cast hrank + _ = ((u : ℝ) ^ ν * R) * (K : ℝ) ^ j := by ring + +/-- The numerical rank consequence of a single fixed finite catalyst is +incompatible with `k < d^ν`. The same `D` and `R` occur for every `n` and +every tensor power. No uniform bound on the approximation block selected +after an exponent slack is assumed. -/ +theorem catalytic_rank_obstruction {d k D R : ℕ} (hd : 0 < d) + (hbound : ∀ n : ℕ, 1 ≤ n → ∀ j : ℕ, 1 ≤ j → ∀ g : ℕ, + exactMatrixRank g ≤ n ^ j → + exactMatrixRank (d ^ j * g) ≤ R * (n * k + D) ^ j) : + (d : ℝ) ^ exactRankExponent ≤ k := by + apply spectral_coefficient_le_of_all_nat + (hν := lt_of_lt_of_le (by norm_num : (0 : ℝ) < 2) exactRankExponent_lower) + (D := (D : ℝ)) + intro n hn δ hδ + have h := catalytic_rank_bound_at_slack hd hn (hbound n hn) hδ + simpa only [Nat.cast_add, Nat.cast_mul] using h + +/-- Contradiction form for the finite-obstruction argument. -/ +theorem not_catalytic_rank_bounds_of_lt {d k D R : ℕ} (hd : 0 < d) + (hk : (k : ℝ) < (d : ℝ) ^ exactRankExponent) : + ¬ (∀ n : ℕ, 1 ≤ n → ∀ j : ℕ, 1 ≤ j → ∀ g : ℕ, + exactMatrixRank g ≤ n ^ j → + exactMatrixRank (d ^ j * g) ≤ R * (n * k + D) ^ j) := by + intro hbound + exact (not_lt_of_ge (catalytic_rank_obstruction hd hbound)) hk + +/-- Iteration and absorption of a fixed catalyst require no cancellation of +the tensor factor `s`. Monotonicity is explicit so the lemma applies to the +restriction order on a tensor semiring, where additive cancellation fails. -/ +theorem catalytic_power_comparison {S : Type*} [CommSemiring S] [Preorder S] + (hadd : ∀ {a b c e : S}, a ≤ b → c ≤ e → a + c ≤ b + e) + (hmul : ∀ {a b c e : S}, a ≤ b → c ≤ e → a * c ≤ b * e) + (hzero : ∀ a : S, 0 ≤ a) + (D t s : S) (k C : ℕ) + (hcat : D + t * s ≤ D + (k : S) * s) + (hD : D ≤ (C : S) * s) (n j : ℕ) : + (n : S) ^ j * t ^ j * s ≤ ((n * k + C : ℕ) : S) ^ j * s := by + have hiter : ∀ m : ℕ, + D + (m : S) * (t * s) ≤ D + (m : S) * ((k : S) * s) := by + intro m + induction m with + | zero => simp + | succ m ih => + calc + D + ((m + 1 : ℕ) : S) * (t * s) = + (D + t * s) + (m : S) * (t * s) := by push_cast; ring + _ ≤ (D + (k : S) * s) + (m : S) * (t * s) := hadd hcat le_rfl + _ = (D + (m : S) * (t * s)) + (k : S) * s := by ring + _ ≤ (D + (m : S) * ((k : S) * s)) + (k : S) * s := hadd ih le_rfl + _ = D + ((m + 1 : ℕ) : S) * ((k : S) * s) := by push_cast; ring + have habsorb : (n : S) * t * s ≤ ((n * k + C : ℕ) : S) * s := by + calc + (n : S) * t * s = 0 + (n : S) * (t * s) := by ring + _ ≤ D + (n : S) * (t * s) := hadd (hzero D) le_rfl + _ ≤ D + (n : S) * ((k : S) * s) := hiter n + _ ≤ (C : S) * s + (n : S) * ((k : S) * s) := hadd hD le_rfl + _ = ((n * k + C : ℕ) : S) * s := by push_cast; ring + induction j with + | zero => simp + | succ j ih => + calc + (n : S) ^ (j + 1) * t ^ (j + 1) * s = + ((n : S) ^ j * t ^ j) * ((n : S) * t * s) := by ring + _ ≤ ((n : S) ^ j * t ^ j) * (((n * k + C : ℕ) : S) * s) := + hmul le_rfl habsorb + _ = ((n * k + C : ℕ) : S) * ((n : S) ^ j * t ^ j * s) := by ring + _ ≤ ((n * k + C : ℕ) : S) * (((n * k + C : ℕ) : S) ^ j * s) := + hmul le_rfl ih + _ = ((n * k + C : ℕ) : S) ^ (j + 1) * s := by ring + +/-- A rank-compatible ordered tensor semiring converts a single finite +catalytic inequality into the actual exact-rank obstruction. The hypotheses +name the required tensor interpretation and scalar rank domination explicitly; +no additive rank formula or cancellation property is assumed. -/ +theorem catalytic_semiring_obstruction {S : Type*} [CommSemiring S] [Preorder S] + (hadd : ∀ {a b c e : S}, a ≤ b → c ≤ e → a + c ≤ b + e) + (hmul : ∀ {a b c e : S}, a ≤ b → c ≤ e → a * c ≤ b * e) + (hzero : ∀ a : S, 0 ≤ a) + (ρ : S → ℕ) (hρmono : Monotone ρ) + (hρcopies : ∀ (m : ℕ) (s : S), ρ ((m : S) * s) ≤ m * ρ s) + (M : ℕ → S) + (hMmul : ∀ a b : ℕ, M (a * b) = M a * M b) + (hMpow : ∀ a j : ℕ, M (a ^ j) = M a ^ j) + (hρM : ∀ a : ℕ, ρ (M a) = exactMatrixRank a) + (hbudget : ∀ n j g : ℕ, exactMatrixRank g ≤ n ^ j → M g ≤ (n : S) ^ j) + (D s : S) (d k C : ℕ) (hd : 0 < d) (hs : 1 ≤ s) + (hcat : D + M d * s ≤ D + (k : S) * s) + (hD : D ≤ (C : S) * s) : + (d : ℝ) ^ exactRankExponent ≤ k := by + apply catalytic_rank_obstruction (D := C) (R := ρ s) hd + intro n _hn j _hj g hg + have hcompare : M (d ^ j * g) ≤ ((n * k + C : ℕ) : S) ^ j * s := by + calc + M (d ^ j * g) = M d ^ j * M g := by rw [hMmul, hMpow] + _ ≤ M d ^ j * (n : S) ^ j := hmul le_rfl (hbudget n j g hg) + _ = ((n : S) ^ j * M d ^ j) * 1 := by ring + _ ≤ ((n : S) ^ j * M d ^ j) * s := hmul le_rfl hs + _ ≤ ((n * k + C : ℕ) : S) ^ j * s := + catalytic_power_comparison hadd hmul hzero D (M d) s k C hcat hD n j + calc + exactMatrixRank (d ^ j * g) = ρ (M (d ^ j * g)) := (hρM _).symm + _ ≤ ρ (((n * k + C : ℕ) : S) ^ j * s) := hρmono hcompare + _ = ρ ((((n * k + C) ^ j : ℕ) : S) * s) := by rw [Nat.cast_pow] + _ ≤ (n * k + C) ^ j * ρ s := hρcopies _ s + _ = ρ s * (n * k + C) ^ j := Nat.mul_comm _ _ + +/-- In the semiring of actual finite complex tensors modulo mutual +restriction, a fixed catalyst cannot make `k` copies dominate multiplication +by `T_d` unless `k ≥ d^ν`. The nonzero hypothesis is exactly what supplies +the scalar restriction `s ≥ 1`; the catalyst remains fixed throughout. -/ +theorem tensor_catalytic_obstruction + {D s : TensorSemiring.TensorClass} {d k : ℕ} + (hd : 0 < d) (hs : s ≠ 0) + (hcat : D + TensorSemiring.matrixClass d * s ≤ D + (k : TensorSemiring.TensorClass) * s) : + (d : ℝ) ^ exactRankExponent ≤ k := by + have hs1 : 1 ≤ s := TensorSemiring.one_le_of_ne_zero hs + have hcopies : ∀ (m : ℕ) (x : TensorSemiring.TensorClass), + TensorSemiring.rank ((m : TensorSemiring.TensorClass) * x) ≤ + m * TensorSemiring.rank x := by + intro m x + simpa only [TensorSemiring.rank_natCast] using + TensorSemiring.rank_mul_le (m : TensorSemiring.TensorClass) x + have hbudget : ∀ n j g : ℕ, exactMatrixRank g ≤ n ^ j → + TensorSemiring.matrixClass g ≤ (n : TensorSemiring.TensorClass) ^ j := by + intro n j g hg + have hleft : TensorSemiring.matrixClass g ≤ + (exactMatrixRank g : TensorSemiring.TensorClass) := by + simpa only [TensorSemiring.rank_matrixClass] using + TensorSemiring.le_rank (TensorSemiring.matrixClass g) + obtain ⟨q, hq⟩ := Nat.exists_eq_add_of_le hg + have hright : (exactMatrixRank g : TensorSemiring.TensorClass) ≤ + (n : TensorSemiring.TensorClass) ^ j := by + rw [← Nat.cast_pow, hq, Nat.cast_add] + simpa only [add_zero] using TensorSemiring.add_mono + (le_refl (exactMatrixRank g : TensorSemiring.TensorClass)) + (TensorSemiring.zero_le (q : TensorSemiring.TensorClass)) + exact hleft.trans hright + have hD : D ≤ (TensorSemiring.rank D : TensorSemiring.TensorClass) * s := by + calc + D ≤ (TensorSemiring.rank D : TensorSemiring.TensorClass) := TensorSemiring.le_rank D + _ = (TensorSemiring.rank D : TensorSemiring.TensorClass) * 1 := (mul_one _).symm + _ ≤ (TensorSemiring.rank D : TensorSemiring.TensorClass) * s := + TensorSemiring.mul_mono le_rfl hs1 + exact catalytic_semiring_obstruction + TensorSemiring.add_mono TensorSemiring.mul_mono TensorSemiring.zero_le + TensorSemiring.rank (fun _ _ h => TensorSemiring.rank_mono h) hcopies + TensorSemiring.matrixClass TensorSemiring.matrixClass_mul TensorSemiring.matrixClass_pow + TensorSemiring.rank_matrixClass hbudget D s d k (TensorSemiring.rank D) hd hs1 hcat hD + +/-- The stronger comparison produced by a finite separation certificate +has the same consequence. Its positive scalar summand is only needed +earlier to rule out `s = 0`; that nonzero fact is explicit here. -/ +theorem tensor_catalytic_obstruction_of_scalar_gain + {D s : TensorSemiring.TensorClass} {d k m : ℕ} + (hd : 0 < d) (hs : s ≠ 0) + (hcat : D + (m : TensorSemiring.TensorClass) + TensorSemiring.matrixClass d * s ≤ + D + (k : TensorSemiring.TensorClass) * s) : + (d : ℝ) ^ exactRankExponent ≤ k := by + apply tensor_catalytic_obstruction hd hs + refine le_trans ?_ hcat + simpa only [add_zero] using TensorSemiring.add_mono + (TensorSemiring.add_mono (le_refl D) + (TensorSemiring.zero_le (m : TensorSemiring.TensorClass))) + (le_refl (TensorSemiring.matrixClass d * s)) + +/-- A finite tensor cannot absorb a positive scalar direct summand. Iterating +such an absorption would place arbitrarily large scalar tensors below one +fixed finite-rank tensor. This uses rank monotonicity, not rank additivity. -/ +theorem not_tensor_add_positive_nat_le_self (D : TensorSemiring.TensorClass) + {m : ℕ} (hm : 0 < m) : ¬ D + (m : TensorSemiring.TensorClass) ≤ D := by + intro h + have hiter : ∀ n : ℕ, D + ((n * m : ℕ) : TensorSemiring.TensorClass) ≤ D := by + intro n + induction n with + | zero => simp + | succ n ih => + calc + D + (((n + 1) * m : ℕ) : TensorSemiring.TensorClass) = + (D + ((n * m : ℕ) : TensorSemiring.TensorClass)) + m := by push_cast; ring + _ ≤ D + (m : TensorSemiring.TensorClass) := TensorSemiring.add_mono ih le_rfl + _ ≤ D := h + let n := TensorSemiring.rank D + 1 + have hscalar : ((n * m : ℕ) : TensorSemiring.TensorClass) ≤ D := by + have hleft := TensorSemiring.add_mono (TensorSemiring.zero_le D) + (le_refl ((n * m : ℕ) : TensorSemiring.TensorClass)) + have hsmall : ((n * m : ℕ) : TensorSemiring.TensorClass) ≤ + D + ((n * m : ℕ) : TensorSemiring.TensorClass) := by + simpa only [zero_add] using hleft + exact hsmall.trans (hiter n) + have hrank : n * m ≤ TensorSemiring.rank D := by + simpa only [TensorSemiring.rank_natCast] using TensorSemiring.rank_mono hscalar + have hnm : n ≤ n * m := by + simpa only [Nat.mul_one] using Nat.mul_le_mul_left n (Nat.succ_le_of_lt hm) + have hlarge : TensorSemiring.rank D + 1 ≤ TensorSemiring.rank D := hnm.trans hrank + omega + +/-- The exact finite-obstruction comparison from Appendix A.1 forces +`k ≥ d^ν`. Both tensors are fixed, `m` is a positive scalar gain, and the +ordinary tensor rank and restriction order are the actual ones. -/ +theorem tensor_catalytic_obstruction_of_positive_scalar_gain + {D s : TensorSemiring.TensorClass} {d k m : ℕ} + (hd : 0 < d) (hm : 0 < m) + (hcat : D + (m : TensorSemiring.TensorClass) + TensorSemiring.matrixClass d * s ≤ + D + (k : TensorSemiring.TensorClass) * s) : + (d : ℝ) ^ exactRankExponent ≤ k := by + apply tensor_catalytic_obstruction_of_scalar_gain hd (m := m) ?_ hcat + intro hs + subst s + have hbad : D + (m : TensorSemiring.TensorClass) ≤ D := by + simpa only [mul_zero, add_zero] using hcat + exact not_tensor_add_positive_nat_le_self D hm hbad + +/-- Contradiction interface for the finite inconsistency certificate in +the construction of an additive monotone state. -/ +theorem no_tensor_catalytic_gain {d k : ℕ} (hd : 0 < d) + (hk : (k : ℝ) < (d : ℝ) ^ exactRankExponent) : + ¬ ∃ (D s : TensorSemiring.TensorClass) (m : ℕ), 0 < m ∧ + D + (m : TensorSemiring.TensorClass) + TensorSemiring.matrixClass d * s ≤ + D + (k : TensorSemiring.TensorClass) * s := by + rintro ⟨D, s, m, hm, hcat⟩ + exact (not_lt_of_ge (tensor_catalytic_obstruction_of_positive_scalar_gain hd hm hcat)) hk + +end MatrixMultiplication.AuxiliarySeparation + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Spectrum/StateObstruction.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Spectrum/StateObstruction.lean new file mode 100644 index 0000000000000000000000000000000000000000..be59ca33f759963782864583567b258a824442ee --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Spectrum/StateObstruction.lean @@ -0,0 +1,308 @@ +import OAI.LinearAlgebra.MatrixMultiplication.AuxiliarySeparation.Spectrum.NormalizedStates +import OAI.LinearAlgebra.MatrixMultiplication.AuxiliarySeparation.Convex.Farkas +import OAI.LinearAlgebra.MatrixMultiplication.AuxiliarySeparation.Spectrum.Catalyst +import OAI.LinearAlgebra.MatrixMultiplication.AuxiliarySeparation.Spectrum.Coordinates +import Mathlib.GroupTheory.MonoidLocalization.GrothendieckGroup +import Mathlib.LinearAlgebra.Finsupp.LinearCombination +import Mathlib.Tactic + +namespace OAI + +/-!+# Finite obstructions to normalized additive states + +The state equations are homogeneous integer inequalities, except for the +normalization at the unit. Their finite certificates are interpreted in the +additive group completion, preserving catalysts in the original semiring. +-/ + +noncomputable section + +namespace MatrixMultiplication.AuxiliarySeparation + +open Set + +variable {S : Type*} [CommSemiring S] [Preorder S] + +/-- The homogeneous inequalities defining a normalized additive state. Both +signs of the additive relation are included. -/ +inductive StateConstraint (S : Type*) [Preorder S] where + | lower (x : S) + | upper (x : S) + | addPos (x y : S) + | addNeg (x y : S) + | order (x y : S) (h : x ≤ y) + | detector (x : S) + +/-- Integer coefficient vector of a homogeneous state constraint. -/ +def stateConstraintVector (R : S → ℕ) (d : S) (k : ℕ) + (c : StateConstraint S) : S →₀ ℤ := by + classical + exact match c with + | .lower x => Finsupp.single x 1 + | .upper x => Finsupp.single (1 : S) (R x : ℤ) - Finsupp.single x 1 + | .addPos x y => Finsupp.single (x + y) 1 - Finsupp.single x 1 - Finsupp.single y 1 + | .addNeg x y => -(Finsupp.single (x + y) 1 - Finsupp.single x 1 - Finsupp.single y 1) + | .order x y _ => Finsupp.single y 1 - Finsupp.single x 1 + | .detector x => Finsupp.single (d * x) 1 - Finsupp.single x (k : ℤ) + +/-- Evaluation of a finite integer coefficient vector on a real-valued function. -/ +def statePairing (f : S → ℝ) : (S →₀ ℤ) →ₗ[ℤ] ℝ := + Finsupp.linearCombination ℤ f + +omit [CommSemiring S] [Preorder S] in +theorem statePairing_apply (f : S → ℝ) (v : S →₀ ℤ) : + statePairing f v = ∑ x ∈ v.support, (v x : ℝ) * f x := by + simp [statePairing, Finsupp.linearCombination_apply, Finsupp.sum, zsmul_eq_mul] + +omit [CommSemiring S] [Preorder S] in +@[simp] theorem statePairing_single (f : S → ℝ) (x : S) (n : ℤ) : + statePairing f (Finsupp.single x n) = (n : ℝ) * f x := by + simp [statePairing, zsmul_eq_mul] + +omit [CommSemiring S] [Preorder S] in +theorem continuous_statePairing (v : S →₀ ℤ) : + Continuous (fun f : S → ℝ ↦ statePairing f v) := by + simp only [statePairing_apply] + exact continuous_finsetSum _ fun x _ ↦ continuous_const.mul (continuous_apply x) + +theorem normalizedStates_iff_stateConstraint (R : S → ℕ) (d : S) (k : ℕ) + (f : S → ℝ) : + f ∈ normalizedStates (fun x ↦ (R x : ℝ)) d k ↔ + f 1 = 1 ∧ ∀ c : StateConstraint S, 0 ≤ statePairing f (stateConstraintVector R d k c) := by + classical + constructor + · intro hf + refine ⟨hf.2.1, ?_⟩ + intro c + cases c with + | lower x => simpa [stateConstraintVector] using (hf.1 x).1 + | upper x => + simp only [stateConstraintVector, map_sub, statePairing_single, Int.cast_natCast, + Int.cast_one, one_mul, hf.2.1, mul_one, sub_nonneg] + exact (hf.1 x).2 + | addPos x y => simp [stateConstraintVector, hf.2.2.1] + | addNeg x y => simp [stateConstraintVector, hf.2.2.1] + | order x y h => simpa [stateConstraintVector, sub_nonneg] using hf.2.2.2.1 x y h + | detector x => simpa [stateConstraintVector, sub_nonneg] using hf.2.2.2.2 x + · rintro ⟨hn, hc⟩ + refine ⟨?_, hn, ?_, ?_, ?_⟩ + · intro x + constructor + · simpa [stateConstraintVector] using hc (.lower x) + · simpa [stateConstraintVector, hn, sub_nonneg] using hc (.upper x) + · intro x y + have hp := hc (.addPos x y) + have hm := hc (.addNeg x y) + simp [stateConstraintVector] at hp hm + linarith + · intro x y hxy + simpa [stateConstraintVector, sub_nonneg] using hc (.order x y hxy) + · intro x + simpa [stateConstraintVector, sub_nonneg] using hc (.detector x) + +/-- The ordinary monotonicity difference in a state constraint. -/ +def stateConstraintLower (c : StateConstraint S) : S := + match c with + | .lower _ => 0 + | .upper x => x + | .order x _ _ => x + | _ => 0 + +def stateConstraintUpper (R : S → ℕ) (c : StateConstraint S) : S := + match c with + | .lower x => x + | .upper x => R x + | .order _ y _ => y + | _ => 0 + +/-- The multiplier of the distinguished detector difference. -/ +def stateConstraintDetector (c : StateConstraint S) : S := + match c with + | .detector x => x + | _ => 0 + +theorem stateConstraintLower_le_upper (R : S → ℕ) + (hzero : ∀ x : S, 0 ≤ x) (hbound : ∀ x : S, x ≤ (R x : S)) + (c : StateConstraint S) : + stateConstraintLower c ≤ stateConstraintUpper R c := by + cases c with + | lower x => exact hzero x + | upper x => exact hbound x + | order _ _ h => exact h + | addPos _ _ => exact le_rfl + | addNeg _ _ => exact le_rfl + | detector _ => exact le_rfl + +/-- Interpreting a constraint in the group completion separates its ordinary +order difference from its detector difference. -/ +theorem stateConstraintVector_completion (R : S → ℕ) (d : S) (k : ℕ) + (c : StateConstraint S) : + Finsupp.linearCombination ℤ (Algebra.GrothendieckAddGroup.of (M := S)) + (stateConstraintVector R d k c) = + Algebra.GrothendieckAddGroup.of (stateConstraintUpper R c) - + Algebra.GrothendieckAddGroup.of (stateConstraintLower c) + + Algebra.GrothendieckAddGroup.of (d * stateConstraintDetector c) - + k • Algebra.GrothendieckAddGroup.of (stateConstraintDetector c) := by + classical + have hcast (n : ℕ) : Algebra.GrothendieckAddGroup.of (n : S) = + n • Algebra.GrothendieckAddGroup.of (1 : S) := by + rw [← nsmul_one, map_nsmul] + cases c <;> + simp [stateConstraintVector, stateConstraintLower, stateConstraintUpper, + stateConstraintDetector, hcast, Nat.cast_smul_eq_nsmul, map_add] <;> abel + +/-- In the absence of a catalytic obstruction, no positive multiple of the +negative unit is a natural combination of state-constraint vectors. -/ +theorem no_stateConstraint_certificate (R : S → ℕ) (d : S) (k : ℕ) + (hzero : ∀ x : S, 0 ≤ x) (hbound : ∀ x : S, x ≤ (R x : S)) + (hadd : ∀ a b c e : S, a ≤ b → c ≤ e → a + c ≤ b + e) + (hno : ∀ (D s : S) (m : ℕ), 0 < m → + ¬D + (m : S) + d * s ≤ D + (k : S) * s) + {I : Type*} [Fintype I] (cs : I → StateConstraint S) : + ¬∃ m : ℕ, 0 < m ∧ ∃ n : I → ℕ, + ∑ i, n i • stateConstraintVector R d k (cs i) = + -(m : ℤ) • Finsupp.single (1 : S) (1 : ℤ) := by + classical + rintro ⟨m, hm, n, hn⟩ + have heq := congrArg + (Finsupp.linearCombination ℤ (Algebra.GrothendieckAddGroup.of (M := S))) hn + simp only [map_sum, map_nsmul, map_smul, Finsupp.linearCombination_single, + one_smul, stateConstraintVector_completion] at heq + obtain ⟨D, hD⟩ := exists_catalyst_of_completion_sum_eq hadd m k d n + (fun i ↦ stateConstraintLower (cs i)) (fun i ↦ stateConstraintUpper R (cs i)) + (fun i ↦ stateConstraintDetector (cs i)) + (fun i ↦ stateConstraintLower_le_upper R hzero hbound (cs i)) heq.symm + exact hno D _ m hm hD + +/-- Every finite family of constraints supported on `H` has a normalized +solution that vanishes outside `H`, provided no positive catalyst exists. -/ +theorem finite_stateConstraint_solution (R : S → ℕ) (d : S) (k : ℕ) + (hzero : ∀ x : S, 0 ≤ x) (hbound : ∀ x : S, x ≤ (R x : S)) + (hadd : ∀ a b c e : S, a ≤ b → c ≤ e → a + c ≤ b + e) + (hno : ∀ (D s : S) (m : ℕ), 0 < m → + ¬D + (m : S) + d * s ≤ D + (k : S) * s) + {I : Type*} [Fintype I] (cs : I → StateConstraint S) (H : Finset S) (hOne : (1 : S) ∈ H) + (hH : ∀ i, (stateConstraintVector R d k (cs i)).support ⊆ H) : + ∃ f : S → ℝ, f 1 = 1 ∧ + (∀ i, 0 ≤ statePairing f (stateConstraintVector R d k (cs i))) ∧ + ∀ x ∉ H, f x = 0 := by + classical + let A : I → H → ℤ := fun i j ↦ stateConstraintVector R d k (cs i) j + let u : H → ℤ := fun j ↦ (Finsupp.single (1 : S) (1 : ℤ)) j + have hcert : ¬∃ m : ℕ, 0 < m ∧ ∃ n : I → ℕ, + ∀ j, ∑ i, (n i : ℤ) * A i j = -(m : ℤ) * u j := by + rintro ⟨m, hm, n, hn⟩ + apply no_stateConstraint_certificate R d k hzero hbound hadd hno cs + refine ⟨m, hm, n, ?_⟩ + ext x + by_cases hx : x ∈ H + · have heq := hn ⟨x, hx⟩ + by_cases hx1 : (1 : S) = x <;> + simpa [A, u, Finsupp.coe_finsetSum, Finset.sum_apply, + Finsupp.smul_apply, nsmul_eq_mul, zsmul_eq_mul, Finsupp.single_apply, hx1] using heq + · have hz : ∀ i, stateConstraintVector R d k (cs i) x = 0 := by + intro i + apply Finsupp.notMem_support_iff.mp + exact fun h ↦ hx (hH i h) + simp only [Finsupp.coe_finsetSum, Finset.sum_apply, Finsupp.smul_apply, + hz, smul_zero, Finset.sum_const_zero] + have hx1 : x ≠ 1 := by + rintro rfl + exact hx hOne + simp [hx1] + obtain ⟨L, hLu, hLA⟩ := + exists_normalized_nonneg_linear_of_no_nat_certificate A u hcert + let f := finiteCoordinateState H L + refine ⟨f, ?_, ?_, ?_⟩ + · have heq := linearCombination_finiteCoordinateState H L + (Finsupp.single (1 : S) (1 : ℤ)) + simpa [f, u] using heq.trans hLu + · intro i + simpa only [statePairing, f, linearCombination_finiteCoordinateState, A] using hLA i + · intro x hx + exact finiteCoordinateState_eq_zero_of_not_mem H L hx + +/-- A finite collection of state constraints can be solved while keeping all +coordinates in their rank intervals. -/ +theorem bounded_finite_stateConstraint_solution (R : S → ℕ) (d : S) (k : ℕ) + (hzero : ∀ x : S, 0 ≤ x) (hbound : ∀ x : S, x ≤ (R x : S)) + (hadd : ∀ a b c e : S, a ≤ b → c ≤ e → a + c ≤ b + e) + (hno : ∀ (D s : S) (m : ℕ), 0 < m → + ¬D + (m : S) + d * s ≤ D + (k : S) * s) + (F : Finset (StateConstraint S)) : + ∃ f : S → ℝ, (∀ x, 0 ≤ f x ∧ f x ≤ R x) ∧ f 1 = 1 ∧ + ∀ c ∈ F, 0 ≤ statePairing f (stateConstraintVector R d k c) := by + classical + let H : Finset S := insert 1 (F.biUnion fun c ↦ (stateConstraintVector R d k c).support) + have hOne : (1 : S) ∈ H := Finset.mem_insert_self _ _ + let cs : F ⊕ (Bool × H) → StateConstraint S + | .inl c => c + | .inr (false, x) => .lower x + | .inr (true, x) => .upper x + have hH : ∀ i, (stateConstraintVector R d k (cs i)).support ⊆ H := by + intro i a ha + cases i with + | inl c => + exact Finset.mem_insert_of_mem + (Finset.mem_biUnion.mpr ⟨c, c.property, ha⟩) + | inr i => + rcases i with ⟨tag, x⟩ + by_contra hnot + have ha1 : a ≠ 1 := by + rintro rfl + exact hnot hOne + have hax : a ≠ (x : S) := by + rintro rfl + exact hnot x.property + have ha0 := Finsupp.mem_support_iff.mp ha + cases tag <;> + simp [cs, stateConstraintVector, ha1, hax] at ha0 + obtain ⟨f, hf1, hfc, hfzero⟩ := + finite_stateConstraint_solution R d k hzero hbound hadd hno cs H hOne hH + refine ⟨f, ?_, hf1, ?_⟩ + · intro x + by_cases hx : x ∈ H + · have hlo := hfc (.inr (false, ⟨x, hx⟩)) + have hhi := hfc (.inr (true, ⟨x, hx⟩)) + constructor + · simpa [cs, stateConstraintVector] using hlo + · simpa [cs, stateConstraintVector, hf1, sub_nonneg] using hhi + · rw [hfzero x hx] + exact ⟨le_rfl, Nat.cast_nonneg _⟩ + · intro c hc + exact hfc (.inl ⟨c, hc⟩) + +/-- Absence of positive scalar-gain catalysts guarantees the existence of a +normalized additive monotone state satisfying the detector inequality. -/ +theorem normalizedStates_nonempty_of_no_catalyst (R : S → ℕ) (d : S) (k : ℕ) + (hzero : ∀ x : S, 0 ≤ x) (hbound : ∀ x : S, x ≤ (R x : S)) + (hadd : ∀ a b c e : S, a ≤ b → c ≤ e → a + c ≤ b + e) + (hno : ∀ (D s : S) (m : ℕ), 0 < m → + ¬D + (m : S) + d * s ≤ D + (k : S) * s) : + (normalizedStates (fun x ↦ (R x : ℝ)) d k).Nonempty := by + let B : Set (S → ℝ) := {f | ∀ x, 0 ≤ f x ∧ f x ≤ R x} + let K : Set (S → ℝ) := B ∩ {f | f 1 = 1} + let t : StateConstraint S → Set (S → ℝ) := + fun c ↦ {f | 0 ≤ statePairing f (stateConstraintVector R d k c)} + have hBcompact : IsCompact B := + isCompact_pi_infinite (fun x ↦ isCompact_Icc (a := (0 : ℝ)) (b := (R x : ℝ))) + have hKcompact : IsCompact K := + hBcompact.inter_right (isClosed_eq (continuous_apply 1) continuous_const) + have htclosed : ∀ c, IsClosed (t c) := fun c ↦ + isClosed_le continuous_const (continuous_statePairing (stateConstraintVector R d k c)) + have hfinite : ∀ F : Finset (StateConstraint S), (K ∩ ⋂ c ∈ F, t c).Nonempty := by + intro F + obtain ⟨f, hfb, hf1, hfc⟩ := + bounded_finite_stateConstraint_solution R d k hzero hbound hadd hno F + refine ⟨f, ⟨hfb, hf1⟩, ?_⟩ + simp only [Set.mem_iInter] + exact hfc + obtain ⟨f, hfK, hft⟩ := hKcompact.inter_iInter_nonempty t htclosed hfinite + refine ⟨f, (normalizedStates_iff_stateConstraint R d k f).mpr ?_⟩ + exact ⟨hfK.2, fun c ↦ Set.mem_iInter.mp hft c⟩ + +end MatrixMultiplication.AuxiliarySeparation + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Tensor/BinaryCharacter.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Tensor/BinaryCharacter.lean new file mode 100644 index 0000000000000000000000000000000000000000..2ae3434670cf533aace3e85513ff73d104919899 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Tensor/BinaryCharacter.lean @@ -0,0 +1,53 @@ +import OAI.LinearAlgebra.MatrixMultiplication.AuxiliarySeparation.Tensor.CharacterBounds +import OAI.LinearAlgebra.MatrixMultiplication.AuxiliarySeparation.Tensor.DirectSum + +namespace OAI + +/-! +# Character additivity for binary tensor sums + +The summands may have different finite coordinate types. A binary sum is a +coordinate reindexing of the dependent direct sum over `Bool`. +-/ + +noncomputable section + +open MatrixMultiplication.Foundation +open scoped BigOperators + +namespace MatrixMultiplication.AuxiliarySeparation.Character + +/-- A character is additive on binary direct sums with arbitrary finite +coordinate types. -/ +theorem value_sumTensor (χ : Character) + {X Y Z U V W : Type} + [Fintype X] [Fintype Y] [Fintype Z] + [Fintype U] [Fintype V] [Fintype W] + (T : Tensor ℂ X Y Z) (S : Tensor ℂ U V W) : + χ.value (sumTensor T S) = χ.value T + χ.value S := by + classical + let family : (b : Bool) → + Tensor ℂ (bif b then U else X) (bif b then V else Y) (bif b then W else Z) + | false => T + | true => S + let : ∀ b : Bool, Fintype (bif b then U else X) := + fun | false => inferInstanceAs (Fintype X) | true => inferInstanceAs (Fintype U) + let : ∀ b : Bool, Fintype (bif b then V else Y) := + fun | false => inferInstanceAs (Fintype Y) | true => inferInstanceAs (Fintype V) + let : ∀ b : Bool, Fintype (bif b then W else Z) := + fun | false => inferInstanceAs (Fintype Z) | true => inferInstanceAs (Fintype W) + have heq : Tensor.pullback (Equiv.sumEquivSigmaBool X U) + (Equiv.sumEquivSigmaBool Y V) (Equiv.sumEquivSigmaBool Z W) + (Tensor.dependentDirectSum family) = sumTensor T S := by + funext x y z + cases x <;> cases y <;> cases z <;> + simp [Tensor.pullback, Tensor.dependentDirectSum, Equiv.sumEquivSigmaBool, + family, sumTensor] + rw [← heq, χ.value_reindex, χ.value_dependentDirectSum] + simp [family, add_comm] + +end MatrixMultiplication.AuxiliarySeparation.Character + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Tensor/CharacterBounds.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Tensor/CharacterBounds.lean new file mode 100644 index 0000000000000000000000000000000000000000..1f6cb545e5893d87bf762fef058d196f27e63376 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Tensor/CharacterBounds.lean @@ -0,0 +1,220 @@ +import OAI.LinearAlgebra.MatrixMultiplication.AuxiliarySeparation.Character.Basic +import OAI.LinearAlgebra.MatrixMultiplication.Tensor.ComplexSeparatedTensorDecomposition + +namespace OAI + +/-! +# Character values on powers and varying-dimension direct sums + +These are consequences of the normalized restriction-monotone character +interface. Coordinate changes preserve values; permuting the three tensor +legs need not preserve an individual character. +-/ + +noncomputable section + +open MatrixMultiplication.Foundation +open scoped BigOperators Classical + +namespace MatrixMultiplication.AuxiliarySeparation.Character + +variable (χ : Character) + +section Embeddings + +variable {X Y Z X' Y' Z' : Type} +variable [Fintype X] [Fintype Y] [Fintype Z] +variable [Fintype X'] [Fintype Y'] [Fintype Z'] +variable [DecidableEq X'] [DecidableEq Y'] [DecidableEq Z'] + +/-- Extending finite coordinates by zero does not change a character value. -/ +theorem value_extendByZero (T : Tensor ℂ X Y Z) + (fx : X → X') (fy : Y → Y') (fz : Z → Z') + (hx : Function.Injective fx) (hy : Function.Injective fy) + (hz : Function.Injective fz) : + χ.value (Tensor.restrict + (fun x' x => if fx x = x' then 1 else 0) + (fun y' y => if fy y = y' then 1 else 0) + (fun z' z => if fz z = z' then 1 else 0) T) = χ.value T := by + classical + apply le_antisymm (χ.monotone T _ _ _) + have h := χ.value_pullback_le (Tensor.restrict + (fun x' x => if fx x = x' then 1 else 0) + (fun y' y => if fy y = y' then 1 else 0) + (fun z' z => if fz z = z' then 1 else 0) T) fx fy fz + have heq : Tensor.pullback fx fy fz (Tensor.restrict + (fun x' x => if fx x = x' then 1 else 0) + (fun y' y => if fy y = y' then 1 else 0) + (fun z' z => if fz z = z' then 1 else 0) T) = T := by + funext x y z + simp [Tensor.pullback, Tensor.restrict, hx.eq_iff, hy.eq_iff, hz.eq_iff, + ite_mul, mul_ite] + simpa only [heq] using h + +end Embeddings + +section Powers + +variable {X Y Z : Type} [Fintype X] [Fintype Y] [Fintype Z] + +/-- Tensor powers turn a character value into an ordinary natural power. -/ +@[simp] theorem value_power (T : Tensor ℂ X Y Z) (n : ℕ) : + χ.value (Tensor.power T n) = χ.value T ^ n := by + induction n with + | zero => + have heq : Tensor.power T 0 = Tensor.pullback + (Equiv.equivPUnit (Fin 0 → X)) + (Equiv.equivPUnit (Fin 0 → Y)) + (Equiv.equivPUnit (Fin 0 → Z)) unitTensor := by + funext x y z + simp [Tensor.power, Tensor.pullback, unitTensor] + rw [heq, χ.value_reindex, χ.map_one, pow_zero] + | succ n ih => + have heq : Tensor.power T (n + 1) = Tensor.pullback + (Fin.consEquiv (fun _ : Fin (n + 1) => X)).symm + (Fin.consEquiv (fun _ : Fin (n + 1) => Y)).symm + (Fin.consEquiv (fun _ : Fin (n + 1) => Z)).symm + (Tensor.product T (Tensor.power T n)) := by + funext x y z + simp [Tensor.power, Tensor.pullback, Tensor.product, Fin.consEquiv, + Fin.prod_univ_succ, Fin.tail] + rw [heq, χ.value_reindex, χ.map_product, ih, pow_succ, mul_comm] + +/-- Full independent copies contribute their exact multiplicity. -/ +theorem value_copies (T : Tensor ℂ X Y Z) (r : ℕ) : + χ.value (Tensor.directSum (fun _ : Fin r => T)) = r * χ.value T := by + rw [χ.map_directSum] + simp + +/-- The character cost of an exact number of full copies of a tensor power. -/ +theorem value_power_copies (T : Tensor ℂ X Y Z) (r n : ℕ) : + χ.value (Tensor.directSum (fun _ : Fin r => Tensor.power T n)) = + r * χ.value T ^ n := by + rw [χ.value_copies, χ.value_power] + +end Powers + +section DependentDirectSum + +variable {ι : Type} [Fintype ι] [DecidableEq ι] +variable {X Y Z : ι → Type} +variable [∀ i, Fintype (X i)] [∀ i, Fintype (Y i)] [∀ i, Fintype (Z i)] + +/-- A branch extended to the common ambient sigma coordinate spaces. -/ +def paddedBranch (T : ∀ i, Tensor ℂ (X i) (Y i) (Z i)) (i : ι) : + Tensor ℂ (Σ i, X i) (Σ i, Y i) (Σ i, Z i) := + Tensor.restrict + (fun x a => if Sigma.mk i a = x then 1 else 0) + (fun y b => if Sigma.mk i b = y then 1 else 0) + (fun z c => if Sigma.mk i c = z then 1 else 0) (T i) + +@[simp] theorem value_paddedBranch + (T : ∀ i, Tensor ℂ (X i) (Y i) (Z i)) (i : ι) : + χ.value (paddedBranch T i) = χ.value (T i) := by + simpa only [paddedBranch] using + χ.value_extendByZero (T i) (Sigma.mk i) (Sigma.mk i) (Sigma.mk i) + (fun _ _ h => eq_of_heq (Sigma.mk.inj h).2) + (fun _ _ h => eq_of_heq (Sigma.mk.inj h).2) + (fun _ _ h => eq_of_heq (Sigma.mk.inj h).2) + +omit [Fintype ι] in +@[simp] theorem paddedBranch_matching + (T : ∀ i, Tensor ℂ (X i) (Y i) (Z i)) + (i : ι) (x : X i) (y : Y i) (z : Z i) : + paddedBranch T i ⟨i, x⟩ ⟨i, y⟩ ⟨i, z⟩ = T i x y z := by + simp [paddedBranch, Tensor.restrict, ite_mul, mul_ite] + +omit [Fintype ι] in +theorem paddedBranch_zero_left + (T : ∀ i, Tensor ℂ (X i) (Y i) (Z i)) (i : ι) + (x : Σ i, X i) (y : Σ i, Y i) (z : Σ i, Z i) (hx : x.1 ≠ i) : + paddedBranch T i x y z = 0 := by + have hzero : ∀ a : X i, Sigma.mk i a ≠ x := + fun a h => hx (congrArg Sigma.fst h).symm + simp [paddedBranch, Tensor.restrict, hzero] + +omit [Fintype ι] in +theorem paddedBranch_zero_middle + (T : ∀ i, Tensor ℂ (X i) (Y i) (Z i)) (i : ι) + (x : Σ i, X i) (y : Σ i, Y i) (z : Σ i, Z i) (hy : y.1 ≠ i) : + paddedBranch T i x y z = 0 := by + have hzero : ∀ b : Y i, Sigma.mk i b ≠ y := + fun b h => hy (congrArg Sigma.fst h).symm + simp [paddedBranch, Tensor.restrict, hzero] + +omit [Fintype ι] in +theorem paddedBranch_zero_right + (T : ∀ i, Tensor ℂ (X i) (Y i) (Z i)) (i : ι) + (x : Σ i, X i) (y : Σ i, Y i) (z : Σ i, Z i) (hz : z.1 ≠ i) : + paddedBranch T i x y z = 0 := by + have hzero : ∀ c : Z i, Sigma.mk i c ≠ z := + fun c h => hz (congrArg Sigma.fst h).symm + simp [paddedBranch, Tensor.restrict, hzero] + +/-- Redundant outer labels give a zero extension of the varying-dimension sum. -/ +theorem directSum_paddedBranch + (T : ∀ i, Tensor ℂ (X i) (Y i) (Z i)) : + Tensor.directSum (paddedBranch T) = Tensor.restrict + (fun (x' : ι × (Σ i, X i)) x => if (x.1, x) = x' then 1 else 0) + (fun (y' : ι × (Σ i, Y i)) y => if (y.1, y) = y' then 1 else 0) + (fun (z' : ι × (Σ i, Z i)) z => if (z.1, z) = z' then 1 else 0) + (Tensor.dependentDirectSum T) := by + funext x' y' z' + rcases x' with ⟨i, ⟨ix, x⟩⟩ + rcases y' with ⟨j, ⟨iy, y⟩⟩ + rcases z' with ⟨k, ⟨iz, z⟩⟩ + have hgraph {A : Type} (f : A → ι) (a x : A) (i : ι) : + (f a, a) = (i, x) ↔ a = x ∧ f x = i := by + constructor + · intro h + have ha : a = x := congrArg Prod.snd h + refine ⟨ha, ?_⟩ + rw [← ha] + exact congrArg Prod.fst h + · rintro ⟨rfl, h⟩ + simp [h] + simp only [Tensor.restrict, hgraph, ite_and] + simp only [ite_mul, zero_mul, mul_ite, mul_zero] + simp only [Finset.sum_ite_eq', Finset.mem_univ, ite_true] + by_cases hi : ix = i + · subst ix + by_cases hj : iy = i + · subst iy + by_cases hk : iz = i + · subst iz + by_cases hij : i = j + · subst j + by_cases hik : i = k + · subst k + simp [Tensor.directSum, Tensor.dependentDirectSum] + · simp [Tensor.directSum, hik] + · simp [Tensor.directSum, hij] + · simp [Tensor.directSum, Tensor.dependentDirectSum, + paddedBranch_zero_right T i ⟨i, x⟩ ⟨i, y⟩ ⟨iz, z⟩ hk, + hk] + · simp [Tensor.directSum, Tensor.dependentDirectSum, + paddedBranch_zero_middle T i ⟨i, x⟩ ⟨iy, y⟩ ⟨iz, z⟩ hj, + hj] + · simp [Tensor.directSum, + paddedBranch_zero_left T i ⟨ix, x⟩ ⟨iy, y⟩ ⟨iz, z⟩ hi, hi] + + +/-- Additivity holds even when each summand has different coordinate types. -/ +theorem value_dependentDirectSum + (T : ∀ i, Tensor ℂ (X i) (Y i) (Z i)) : + χ.value (Tensor.dependentDirectSum T) = ∑ i, χ.value (T i) := by + have h := χ.value_extendByZero (Tensor.dependentDirectSum T) + (fun x => (x.1, x)) (fun y => (y.1, y)) (fun z => (z.1, z)) + (fun _ _ h => congrArg Prod.snd h) (fun _ _ h => congrArg Prod.snd h) + (fun _ _ h => congrArg Prod.snd h) + rw [← directSum_paddedBranch] at h + rw [← h, χ.map_directSum] + simp + +end DependentDirectSum + +end MatrixMultiplication.AuxiliarySeparation.Character + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Tensor/Characters.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Tensor/Characters.lean new file mode 100644 index 0000000000000000000000000000000000000000..16e107c331f56b1c7d813f75b42f71809ac9676b --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Tensor/Characters.lean @@ -0,0 +1,178 @@ +import OAI.LinearAlgebra.MatrixMultiplication.AuxiliarySeparation.Tensor.Semiring +import OAI.LinearAlgebra.MatrixMultiplication.AuxiliarySeparation.Character.Basic +import OAI.LinearAlgebra.MatrixMultiplication.AuxiliarySeparation.Tensor.BinaryCharacter +import OAI.LinearAlgebra.MatrixMultiplication.AuxiliarySeparation.Tensor.DirectSumClass + +namespace OAI + +/-! +# Concrete tensor characters and the tensor semiring + +The coefficient-level character interface and monotone real-valued semiring +homomorphisms on mutual-restriction classes describe the same valuations. +The map `classOf` uses finite natural-number coordinate presentations, so +the construction applies to all finite coordinate types in the character +interface. +-/ + +noncomputable section + +open MatrixMultiplication.Foundation +open scoped BigOperators + +namespace MatrixMultiplication.AuxiliarySeparation + +open TensorSemiring + +namespace Character + +/-- A character has a well-defined value on mutual-restriction classes. -/ +def valueOnTensorClass (χ : Character) : TensorClass → ℝ := + Quotient.lift (fun T : FiniteTensor => χ.value T.coeff) (by + intro T S h + apply le_antisymm + · rcases h.1 with ⟨A, B, C, heq⟩ + rw [heq] + exact χ.monotone S.coeff A B C + · rcases h.2 with ⟨A, B, C, heq⟩ + rw [heq] + exact χ.monotone T.coeff A B C) + +@[simp] theorem valueOnTensorClass_tensorClass (χ : Character) (T : FiniteTensor) : + χ.valueOnTensorClass (tensorClass T) = χ.value T.coeff := rfl + +/-- Passing to a finite natural-coordinate presentation preserves the value. -/ +@[simp] theorem valueOnTensorClass_classOf (χ : Character) + {X Y Z : Type} [Fintype X] [Fintype Y] [Fintype Z] + (T : Tensor ℂ X Y Z) : χ.valueOnTensorClass (classOf T) = χ.value T := + χ.value_reindex T _ _ _ + +/-- Restriction monotonicity descends to the quotient order. -/ +theorem valueOnTensorClass_monotone (χ : Character) : Monotone χ.valueOnTensorClass := by + intro T S h + induction T using Quotient.inductionOn with | h T => + induction S using Quotient.inductionOn with | h S => + change IsRestriction T.coeff S.coeff at h + rcases h with ⟨A, B, C, heq⟩ + change χ.value T.coeff ≤ χ.value S.coeff + rw [heq] + exact χ.monotone S.coeff A B C + +@[simp] theorem valueOnTensorClass_zero (χ : Character) : + χ.valueOnTensorClass 0 = 0 := by + change χ.valueOnTensorClass (classOf (0 : Tensor ℂ Empty Empty Empty)) = 0 + rw [χ.valueOnTensorClass_classOf, χ.map_zero] + +@[simp] theorem valueOnTensorClass_one (χ : Character) : + χ.valueOnTensorClass 1 = 1 := by + change χ.valueOnTensorClass (classOf unitTensor) = 1 + rw [χ.valueOnTensorClass_classOf, χ.map_one] + +/-- Multiplicativity is unchanged on passing to tensor classes. -/ +theorem valueOnTensorClass_mul (χ : Character) (T S : TensorClass) : + χ.valueOnTensorClass (T * S) = χ.valueOnTensorClass T * χ.valueOnTensorClass S := by + induction T using Quotient.inductionOn with | h T => + induction S using Quotient.inductionOn with | h S => + change χ.valueOnTensorClass (tensorClass T * tensorClass S) = + χ.valueOnTensorClass (tensorClass T) * χ.valueOnTensorClass (tensorClass S) + rw [← classOf_coeff T, ← classOf_coeff S, ← classOf_product] + simp only [χ.valueOnTensorClass_classOf] + exact χ.map_product T.coeff S.coeff + +/-- Additivity is unchanged on passing to tensor classes. -/ +theorem valueOnTensorClass_add (χ : Character) (T S : TensorClass) : + χ.valueOnTensorClass (T + S) = χ.valueOnTensorClass T + χ.valueOnTensorClass S := by + induction T using Quotient.inductionOn with | h T => + induction S using Quotient.inductionOn with | h S => + change χ.valueOnTensorClass (tensorClass T + tensorClass S) = + χ.valueOnTensorClass (tensorClass T) + χ.valueOnTensorClass (tensorClass S) + rw [← classOf_coeff T, ← classOf_coeff S, ← classOf_sum] + simp only [χ.valueOnTensorClass_classOf] + exact χ.value_sumTensor T.coeff S.coeff + +/-- A coefficient-level character descends to a normalized semiring homomorphism. -/ +def toTensorClassHom (χ : Character) : TensorClass →+* ℝ where + toFun := χ.valueOnTensorClass + map_zero' := χ.valueOnTensorClass_zero + map_one' := χ.valueOnTensorClass_one + map_add' := χ.valueOnTensorClass_add + map_mul' := χ.valueOnTensorClass_mul + +theorem toTensorClassHom_monotone (χ : Character) : Monotone χ.toTensorClassHom := + χ.valueOnTensorClass_monotone + +@[simp] theorem toTensorClassHom_classOf (χ : Character) + {X Y Z : Type} [Fintype X] [Fintype Y] [Fintype Z] + (T : Tensor ℂ X Y Z) : χ.toTensorClassHom (classOf T) = χ.value T := + χ.valueOnTensorClass_classOf T + +/-- A monotone semiring homomorphism on tensor classes gives a character on all +finite coefficient tensors. Normalization follows from preservation of `0` and `1`. -/ +def ofTensorClassHom (φ : TensorClass →+* ℝ) (hφ : Monotone φ) : Character where + value := fun T => φ (classOf T) + nonneg := by + intro X Y Z hX hY hZ T + simpa only [φ.map_zero] using hφ (TensorSemiring.zero_le (classOf T)) + map_zero := by + intro X Y Z hX hY hZ + rw [classOf_zero] + exact φ.map_zero + map_one := by + change φ 1 = 1 + exact φ.map_one + map_directSum := by + intro ι X Y Z hι dι hX hY hZ T + rw [classOf_directSum, map_sum] + map_product := by + intro X Y Z U V W hX hY hZ hU hV hW T S + rw [classOf_product, map_mul] + monotone := by + intro X Y Z X' Y' Z' hX hY hZ hX' hY' hZ' T A B C + apply hφ + exact (classOf_le_iff _ _).mpr ⟨A, B, C, rfl⟩ + +@[simp] theorem ofTensorClassHom_value (φ : TensorClass →+* ℝ) (hφ : Monotone φ) + {X Y Z : Type} [Fintype X] [Fintype Y] [Fintype Z] + (T : Tensor ℂ X Y Z) : (ofTensorClassHom φ hφ).value T = φ (classOf T) := rfl + +/-- Equality of all coefficient-level values determines a character. -/ +@[ext] theorem ext {χ ψ : Character} + (h : ∀ {X Y Z : Type} [Fintype X] [Fintype Y] [Fintype Z] + (T : Tensor ℂ X Y Z), χ.value T = ψ.value T) : χ = ψ := by + cases χ + cases ψ + congr + funext X Y Z hX hY hZ T + exact h T + +/-- Descending and then lifting recovers the original coefficient-level character. -/ +@[simp] theorem ofTensorClassHom_toTensorClassHom (χ : Character) : + ofTensorClassHom χ.toTensorClassHom χ.toTensorClassHom_monotone = χ := by + apply ext + intro X Y Z hX hY hZ T + exact χ.toTensorClassHom_classOf T + +/-- Lifting and then descending recovers the original semiring homomorphism. -/ +@[simp] theorem toTensorClassHom_ofTensorClassHom + (φ : TensorClass →+* ℝ) (hφ : Monotone φ) : + (ofTensorClassHom φ hφ).toTensorClassHom = φ := by + apply RingHom.ext + intro T + induction T using Quotient.inductionOn with | h T => + change φ (classOf T.coeff) = φ (tensorClass T) + rw [classOf_coeff] + +/-- Concrete characters are exactly monotone real-valued tensor semiring homomorphisms. -/ +def tensorClassHomEquiv : Character ≃ {φ : TensorClass →+* ℝ // Monotone φ} where + toFun χ := ⟨χ.toTensorClassHom, χ.toTensorClassHom_monotone⟩ + invFun φ := ofTensorClassHom φ.1 φ.2 + left_inv := ofTensorClassHom_toTensorClassHom + right_inv φ := Subtype.ext (toTensorClassHom_ofTensorClassHom φ.1 φ.2) + +end Character + +end MatrixMultiplication.AuxiliarySeparation + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Tensor/DirectSum.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Tensor/DirectSum.lean new file mode 100644 index 0000000000000000000000000000000000000000..9aee3bb36a5eb1111b1d45b227d93f7fbe8d7437 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Tensor/DirectSum.lean @@ -0,0 +1,139 @@ +import OAI.LinearAlgebra.MatrixMultiplication.Tensor.ComplexTensorRestrictionComposition +import Mathlib.Logic.Equiv.Sum +import Mathlib.Logic.Equiv.Prod + +namespace OAI + +/-! +# Binary sums of finite coefficient tensors + +The coordinate types of the summands may differ. The identities below give +the explicit changes of coordinates needed for the tensor semiring, together +with the block-diagonal restriction maps. +-/ + +open MatrixMultiplication.Foundation + +namespace MatrixMultiplication.AuxiliarySeparation + +variable {K X Y Z U V W A B C : Type*} [CommSemiring K] + +/-- The binary direct sum, with each of its three block labels retained. -/ +def sumTensor (T : Tensor K X Y Z) (S : Tensor K U V W) : + Tensor K (X ⊕ U) (Y ⊕ V) (Z ⊕ W) + | .inl x, .inl y, .inl z => T x y z + | .inr u, .inr v, .inr w => S u v w + | _, _, _ => 0 + +/-- The block-diagonal sum of two restriction matrices. -/ +def sumRestriction {X' U' : Type*} (f : X' → X → K) (g : U' → U → K) : + (X' ⊕ U') → (X ⊕ U) → K + | .inl x', .inl x => f x' x + | .inr u', .inr u => g u' u + | _, _ => 0 + +/-- Independent restrictions of both summands give a restriction of the sum. -/ +theorem sumTensor_restrict + {X' Y' Z' U' V' W' : Type*} + [Fintype X] [Fintype Y] [Fintype Z] [Fintype U] [Fintype V] [Fintype W] + (f : X' → X → K) (g : Y' → Y → K) (h : Z' → Z → K) + (f' : U' → U → K) (g' : V' → V → K) (h' : W' → W → K) + (T : Tensor K X Y Z) (S : Tensor K U V W) : + Tensor.restrict (sumRestriction f f') (sumRestriction g g') + (sumRestriction h h') (sumTensor T S) = + sumTensor (Tensor.restrict f g h T) (Tensor.restrict f' g' h' S) := by + funext x y z + cases x <;> cases y <;> cases z <;> + simp [Tensor.restrict, sumRestriction, sumTensor, Fintype.sum_sum_type] + +/-- Exchanging the two blocks is a coordinate permutation. -/ +theorem sumTensor_comm (T : Tensor K X Y Z) (S : Tensor K U V W) : + Tensor.pullback (Equiv.sumComm X U) (Equiv.sumComm Y V) + (Equiv.sumComm Z W) (sumTensor S T) = sumTensor T S := by + funext x y z + cases x <;> cases y <;> cases z <;> rfl + +/-- Reassociating the three blocks is a coordinate permutation. -/ +theorem sumTensor_assoc (T : Tensor K X Y Z) (S : Tensor K U V W) + (R : Tensor K A B C) : + Tensor.pullback (Equiv.sumAssoc X U A) (Equiv.sumAssoc Y V B) + (Equiv.sumAssoc Z W C) (sumTensor T (sumTensor S R)) = + sumTensor (sumTensor T S) R := by + funext x y z + rcases x with (x | x) | x <;> + rcases y with (y | y) | y <;> + rcases z with (z | z) | z <;> rfl + +/-- An empty right summand disappears under its canonical coordinates. -/ +theorem sumTensor_empty_right [IsEmpty U] [IsEmpty V] [IsEmpty W] + (T : Tensor K X Y Z) (S : Tensor K U V W) : + Tensor.pullback (Equiv.sumEmpty X U).symm (Equiv.sumEmpty Y V).symm + (Equiv.sumEmpty Z W).symm (sumTensor T S) = T := by + rfl + +/-- An empty left summand disappears under its canonical coordinates. -/ +theorem sumTensor_empty_left [IsEmpty X] [IsEmpty Y] [IsEmpty Z] + (T : Tensor K X Y Z) (S : Tensor K U V W) : + Tensor.pullback (Equiv.emptySum X U).symm (Equiv.emptySum Y V).symm + (Equiv.emptySum Z W).symm (sumTensor T S) = S := by + rfl + +/-- Tensor product distributes over the first binary sum by coordinate +permutation. -/ +theorem sumTensor_product (T : Tensor K X Y Z) (S : Tensor K U V W) + (R : Tensor K A B C) : + Tensor.pullback (Equiv.sumProdDistrib X U A).symm + (Equiv.sumProdDistrib Y V B).symm (Equiv.sumProdDistrib Z W C).symm + (Tensor.product (sumTensor T S) R) = + sumTensor (Tensor.product T R) (Tensor.product S R) := by + funext x y z + cases x <;> cases y <;> cases z <;> + simp [Tensor.pullback, Tensor.product, sumTensor] + +/-- Tensor product distributes over the second binary sum by coordinate +permutation. -/ +theorem product_sumTensor (T : Tensor K X Y Z) (S : Tensor K U V W) + (R : Tensor K A B C) : + Tensor.pullback (Equiv.prodSumDistrib X U A).symm + (Equiv.prodSumDistrib Y V B).symm (Equiv.prodSumDistrib Z W C).symm + (Tensor.product T (sumTensor S R)) = + sumTensor (Tensor.product T S) (Tensor.product T R) := by + funext x y z + cases x <;> cases y <;> cases z <;> + simp [Tensor.pullback, Tensor.product, sumTensor] + +/-- Exchanging product factors is a coordinate permutation. -/ +theorem tensorProduct_comm (T : Tensor K X Y Z) (S : Tensor K U V W) : + Tensor.pullback (Equiv.prodComm X U) (Equiv.prodComm Y V) + (Equiv.prodComm Z W) (Tensor.product S T) = Tensor.product T S := by + funext x y z + simp [Tensor.pullback, Tensor.product, mul_comm] + +/-- Reassociating product factors is a coordinate permutation. -/ +theorem tensorProduct_assoc (T : Tensor K X Y Z) (S : Tensor K U V W) + (R : Tensor K A B C) : + Tensor.pullback (Equiv.prodAssoc X U A) (Equiv.prodAssoc Y V B) + (Equiv.prodAssoc Z W C) (Tensor.product T (Tensor.product S R)) = + Tensor.product (Tensor.product T S) R := by + funext x y z + simp [Tensor.pullback, Tensor.product, mul_assoc] + +/-- Scalar multiplication by one is the right unit for tensor product. -/ +theorem tensorProduct_one_right (T : Tensor K X Y Z) : + Tensor.pullback (Equiv.prodPUnit X).symm (Equiv.prodPUnit Y).symm + (Equiv.prodPUnit Z).symm + (Tensor.product T (fun (_ _ _ : PUnit) => (1 : K))) = T := by + funext x y z + simp [Tensor.pullback, Tensor.product] + +/-- Scalar multiplication by one is the left unit for tensor product. -/ +theorem tensorProduct_one_left (T : Tensor K X Y Z) : + Tensor.pullback (Equiv.punitProd X).symm (Equiv.punitProd Y).symm + (Equiv.punitProd Z).symm + (Tensor.product (fun (_ _ _ : PUnit) => (1 : K)) T) = T := by + funext x y z + simp [Tensor.pullback, Tensor.product] + +end MatrixMultiplication.AuxiliarySeparation + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Tensor/DirectSumClass.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Tensor/DirectSumClass.lean new file mode 100644 index 0000000000000000000000000000000000000000..521792b9677adede5f5a5d6ccb23dd0b63c44f22 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Tensor/DirectSumClass.lean @@ -0,0 +1,75 @@ +import OAI.LinearAlgebra.MatrixMultiplication.AuxiliarySeparation.Tensor.Semiring +import Mathlib.Data.Fintype.Option + +namespace OAI + +/-! +# Finite direct sums in the tensor semiring + +The tensor class of a block direct sum is the sum of its constituent classes. +-/ + +noncomputable section + +open MatrixMultiplication.Foundation +open scoped BigOperators + +namespace MatrixMultiplication.AuxiliarySeparation.TensorSemiring + +variable {X Y Z : Type*} [Fintype X] [Fintype Y] [Fintype Z] + +private theorem classOf_directSum_reindex {ι κ : Type*} + [Fintype ι] [Fintype κ] [DecidableEq ι] [DecidableEq κ] + (T : κ → Tensor ℂ X Y Z) (e : ι ≃ κ) : + classOf (Tensor.directSum (fun i => T (e i))) = classOf (Tensor.directSum T) := by + apply classOf_eq_of_reindex (Equiv.prodCongr e (Equiv.refl X)) + (Equiv.prodCongr e (Equiv.refl Y)) (Equiv.prodCongr e (Equiv.refl Z)) + funext x y z + simp [Tensor.pullback, Tensor.directSum, e.injective.eq_iff] + +private theorem classOf_directSum_option {ι : Type*} [Fintype ι] [di : DecidableEq ι] + [dopt : DecidableEq (Option ι)] + (T : Option ι → Tensor ℂ X Y Z) : + classOf (Tensor.directSum T) = + classOf (T none) + classOf (Tensor.directSum (fun i => T (some i))) := by + rw [← classOf_sum] + symm + apply classOf_eq_of_reindex optionProdEquiv.symm + optionProdEquiv.symm optionProdEquiv.symm + funext x y z + cases x with + | inl x => + cases y <;> cases z <;> simp [Tensor.pullback, Tensor.directSum, sumTensor] + | inr x => + cases y <;> cases z <;> simp [Tensor.pullback, Tensor.directSum, sumTensor] + +/-- Passing to tensor classes converts every finite block direct sum to a sum. -/ +theorem classOf_directSum {ι : Type*} [Fintype ι] [dec : DecidableEq ι] + (T : ι → Tensor ℂ X Y Z) : + classOf (Tensor.directSum T) = ∑ i, classOf (T i) := by + have hdec : dec = (fun a b => Classical.propDecidable (a = b)) := Subsingleton.elim _ _ + subst dec + classical + refine Fintype.induction_empty_option + (P := fun ι _ => ∀ T : ι → Tensor ℂ X Y Z, + classOf (Tensor.directSum T) = ∑ i, classOf (T i)) ?_ ?_ ?_ ι T + · intro α β _ e ih S + let : Fintype α := Fintype.ofEquiv β e.symm + rw [← classOf_directSum_reindex S e, ih] + exact e.sum_comp (fun i => classOf (S i)) + · intro S + have he : (∑ i, classOf (S i)) = 0 := Finset.sum_eq_zero (fun i _ => i.elim) + rw [he] + apply (classOf_eq_zero_iff _).mpr + funext x + exact x.1.elim + · intro α _ ih S + rw [classOf_directSum_option + (di := fun a b => Classical.propDecidable (a = b)) + (dopt := fun a b => Classical.propDecidable (a = b)), ih, Fintype.sum_option] + +end MatrixMultiplication.AuxiliarySeparation.TensorSemiring + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Tensor/Scalar.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Tensor/Scalar.lean new file mode 100644 index 0000000000000000000000000000000000000000..581c48d3563d945775c6d275e1143866d1e2ef81 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Tensor/Scalar.lean @@ -0,0 +1,140 @@ +import OAI.LinearAlgebra.MatrixMultiplication.AuxiliarySeparation.Tensor.Semiring +import OAI.LinearAlgebra.MatrixMultiplication.AuxiliarySeparation.Character.Basic +import Mathlib.Logic.Equiv.Fin.Basic + +namespace OAI + +/-! +# Natural numbers and rank in the tensor semiring + +The natural number `r` is the class of the diagonal scalar tensor with `r` +terms. Consequently, comparison with `r` in the restriction order is exactly +the existence of a rank decomposition with `r` terms. +-/ + +noncomputable section + +open MatrixMultiplication.Foundation + +namespace MatrixMultiplication.AuxiliarySeparation + +/-- Splitting the diagonal index set splits its scalar tensor into two blocks. -/ +theorem scalarTensor_add_reindex (m n : ℕ) : + Tensor.pullback (finSumFinEquiv : Fin m ⊕ Fin n ≃ Fin (m + n)) + finSumFinEquiv finSumFinEquiv (scalarTensor (m + n)) = + sumTensor (scalarTensor m) (scalarTensor n) := by + funext x y z + simp only [Tensor.pullback, scalarTensor, + (finSumFinEquiv : Fin m ⊕ Fin n ≃ Fin (m + n)).injective.eq_iff] + cases x <;> cases y <;> cases z <;> simp [sumTensor, scalarTensor] + +/-- A diagonal scalar tensor has its evident decomposition into simple terms. -/ +theorem scalarTensor_rankAtMost (r : ℕ) : Tensor.RankAtMost (scalarTensor r) r := by + classical + refine ⟨(fun i x => if x = i then 1 else 0), + (fun i y => if y = i then 1 else 0), (fun i z => if z = i then 1 else 0), ?_⟩ + funext x y z + simp [scalarTensor, Tensor.rankOne, mul_ite, ite_and] + split_ifs <;> simp_all + +/-- The diagonal flattening also gives the matching lower bound. -/ +@[simp] theorem exactRank_scalarTensor (r : ℕ) : exactRank (scalarTensor r) = r := by + apply le_antisymm (exactRank_le (scalarTensor_rankAtMost r)) + have h := (exactRank_spec (scalarTensor r)).card_le_of_identity id id id + (by intro i j; simp [scalarTensor]) + simpa only [Fintype.card_fin] using h + +namespace TensorSemiring + +/-- Addition of the diagonal index sets is semiring addition. -/ +theorem classOf_scalarTensor_add (m n : ℕ) : + classOf (scalarTensor (m + n)) = + classOf (scalarTensor m) + classOf (scalarTensor n) := by + have h := classOf_eq_of_reindex _ _ _ (scalarTensor_add_reindex m n) + exact h.symm.trans (classOf_sum _ _) + +@[simp] theorem classOf_scalarTensor_zero : + classOf (scalarTensor 0) = (0 : TensorClass) := by + have h : scalarTensor 0 = 0 := by + funext x + exact Fin.elim0 x + rw [h, classOf_zero] + +@[simp] theorem classOf_scalarTensor_one : + classOf (scalarTensor 1) = (1 : TensorClass) := by + change classOf (scalarTensor 1) = classOf (fun (_ _ _ : PUnit.{1}) => (1 : ℂ)) + apply classOf_eq_of_reindex (Equiv.equivPUnit (Fin 1)) + (Equiv.equivPUnit (Fin 1)) (Equiv.equivPUnit (Fin 1)) + funext x y z + simp [Tensor.pullback, scalarTensor, Subsingleton.elim x y, Subsingleton.elim y z] + +/-- Natural numbers in the quotient semiring have their intended tensor meaning. -/ +@[simp] theorem classOf_scalarTensor (r : ℕ) : + classOf (scalarTensor r) = (r : TensorClass) := by + induction r with + | zero => exact classOf_scalarTensor_zero + | succ r ih => + simpa only [Nat.cast_add, Nat.cast_one, Nat.cast_succ, + classOf_scalarTensor_one, ih] using + classOf_scalarTensor_add r 1 + +/-- Exact rank decompositions are precisely restrictions of diagonal tensors. -/ +theorem rankAtMost_iff_isRestriction_scalarTensor + {X Y Z : Type*} [Fintype X] [Fintype Y] [Fintype Z] + (T : Tensor ℂ X Y Z) (r : ℕ) : + Tensor.RankAtMost T r ↔ IsRestriction T (scalarTensor r) := by + constructor + · rintro ⟨a, b, c, h⟩ + refine ⟨(fun x i => a i x), (fun y i => b i y), (fun z i => c i z), ?_⟩ + apply h.trans + funext x y z + simp [Tensor.restrict, scalarTensor, Tensor.rankOne, mul_ite, ite_and] + · rintro ⟨A, B, C, rfl⟩ + exact (scalarTensor_rankAtMost r).restrict A B C + +/-- The restriction order below a natural number is exactly the usual rank bound. -/ +theorem classOf_le_nat_iff_rankAtMost + {X Y Z : Type*} [Fintype X] [Fintype Y] [Fintype Z] + (T : Tensor ℂ X Y Z) (r : ℕ) : + classOf T ≤ (r : TensorClass) ↔ Tensor.RankAtMost T r := by + rw [← classOf_scalarTensor r, classOf_le_iff] + exact (rankAtMost_iff_isRestriction_scalarTensor T r).symm + +/-- Rank takes its usual value on natural numbers in the tensor semiring. -/ +@[simp] theorem rank_natCast (r : ℕ) : rank (r : TensorClass) = r := by + rw [← classOf_scalarTensor r, rank_classOf, exactRank_scalarTensor] + +/-- The rank is a natural-number upper bound in the restriction order. -/ +theorem le_rank (T : TensorClass) : T ≤ (rank T : TensorClass) := by + induction T using Quotient.inductionOn with + | h T => + change tensorClass T ≤ (exactRank T.coeff : TensorClass) + rw [← classOf_coeff T] + exact (classOf_le_nat_iff_rankAtMost T.coeff (exactRank T.coeff)).mpr + (exactRank_spec T.coeff) + +/-- The tensor restriction order induces the usual order on natural numbers. -/ +@[simp] theorem natCast_le_natCast_iff (m n : ℕ) : + (m : TensorClass) ≤ (n : TensorClass) ↔ m ≤ n := by + constructor + · intro h + simpa only [rank_natCast] using rank_mono h + · intro h + obtain ⟨k, rfl⟩ := Nat.exists_eq_add_of_le h + rw [Nat.cast_add] + simpa only [add_zero] using add_mono (le_refl (m : TensorClass)) (zero_le (k : TensorClass)) + +/-- A natural multiple of any nonzero tensor contains any prescribed tensor +by restriction. -/ +theorem le_nat_mul_of_ne_zero (T S : TensorClass) (hS : S ≠ 0) : + T ≤ (rank T : TensorClass) * S := by + apply (le_rank T).trans + simpa only [mul_one] using + mul_mono (le_refl (rank T : TensorClass)) (one_le_of_ne_zero hS) + +end TensorSemiring +end MatrixMultiplication.AuxiliarySeparation + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Tensor/Semiring.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Tensor/Semiring.lean new file mode 100644 index 0000000000000000000000000000000000000000..624f7fcf0d6586fdb2ccbc0aaf496e995637e4c3 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Tensor/Semiring.lean @@ -0,0 +1,541 @@ +import OAI.LinearAlgebra.MatrixMultiplication.Tensor.ComplexTensorRestrictionComposition +import OAI.LinearAlgebra.MatrixMultiplication.AuxiliarySeparation.Tensor.DirectSum +import OAI.LinearAlgebra.MatrixMultiplication.AuxiliarySeparation.Arithmetic.RankExponent +import Mathlib.Order.Antisymmetrization +import Mathlib.Algebra.Order.Ring.Defs + +namespace OAI + +/-! +# Finite tensors modulo mutual restriction + +Representatives have three natural-number dimensions and complex coefficients. +The order is actual linear restriction, and equality in the quotient is mutual +restriction. In particular, changing coordinates does not change the class. +-/ + +noncomputable section + +open MatrixMultiplication.Foundation +open scoped BigOperators + +namespace MatrixMultiplication.AuxiliarySeparation.TensorSemiring + +section Restriction + +variable {X Y Z U V W P Q R : Type*} +variable [Fintype X] [Fintype Y] [Fintype Z] +variable [Fintype U] [Fintype V] [Fintype W] +variable [Fintype P] [Fintype Q] [Fintype R] + +/-- `T` is obtained from `S` by three linear maps on its coordinate spaces. -/ +def IsRestriction (T : Tensor ℂ X Y Z) (S : Tensor ℂ U V W) : Prop := + ∃ (A : X → U → ℂ) (B : Y → V → ℂ) (C : Z → W → ℂ), + T = Tensor.restrict A B C S + +theorem IsRestriction.refl (T : Tensor ℂ X Y Z) : IsRestriction T T := by + classical + exact ⟨_, _, _, (Tensor.restrict_identity T).symm⟩ + +omit [Fintype X] [Fintype Y] [Fintype Z] in +theorem IsRestriction.trans {T : Tensor ℂ X Y Z} {S : Tensor ℂ U V W} + {L : Tensor ℂ P Q R} (hTS : IsRestriction T S) (hSL : IsRestriction S L) : + IsRestriction T L := by + rcases hTS with ⟨A, B, C, rfl⟩ + rcases hSL with ⟨D, E, F, rfl⟩ + exact ⟨Tensor.composeRestrictionMatrix A D, Tensor.composeRestrictionMatrix B E, + Tensor.composeRestrictionMatrix C F, Tensor.restrict_restrict D E F A B C L⟩ + +omit [Fintype U] [Fintype V] [Fintype W] in +theorem IsRestriction.pullback (T : Tensor ℂ X Y Z) + (fx : U → X) (fy : V → Y) (fz : W → Z) : + IsRestriction (Tensor.pullback fx fy fz T) T := by + classical + exact ⟨_, _, _, Tensor.pullback_eq_restrict fx fy fz T⟩ + +omit [Fintype X] [Fintype Y] [Fintype Z] in +theorem IsRestriction.of_reindex (T : Tensor ℂ X Y Z) + (ex : U ≃ X) (ey : V ≃ Y) (ez : W ≃ Z) : + IsRestriction T (Tensor.pullback ex ey ez T) := by + have h := IsRestriction.pullback (Tensor.pullback ex ey ez T) ex.symm ey.symm ez.symm + have heq : Tensor.pullback ex.symm ey.symm ez.symm (Tensor.pullback ex ey ez T) = T := by + funext x y z + simp [Tensor.pullback] + rwa [heq] at h + +theorem IsRestriction.reindex_iff + (T : Tensor ℂ X Y Z) (S : Tensor ℂ U V W) + {X' Y' Z' U' V' W' : Type*} + [Fintype X'] [Fintype Y'] [Fintype Z'] + [Fintype U'] [Fintype V'] [Fintype W'] + (ex : X' ≃ X) (ey : Y' ≃ Y) (ez : Z' ≃ Z) + (eu : U' ≃ U) (ev : V' ≃ V) (ew : W' ≃ W) : + IsRestriction (Tensor.pullback ex ey ez T) (Tensor.pullback eu ev ew S) ↔ + IsRestriction T S := by + constructor + · intro h + exact (IsRestriction.of_reindex T ex ey ez).trans + (h.trans (IsRestriction.pullback S eu ev ew)) + · intro h + exact (IsRestriction.pullback T ex ey ez).trans + (h.trans (IsRestriction.of_reindex S eu ev ew)) + +omit [Fintype X] [Fintype Y] [Fintype Z] [Fintype U] [Fintype V] [Fintype W] in +theorem IsRestriction.product {T : Tensor ℂ X Y Z} {S : Tensor ℂ U V W} + {T' : Tensor ℂ P Q R} {U' V' W' : Type*} + [Fintype U'] [Fintype V'] [Fintype W'] {S' : Tensor ℂ U' V' W'} + (hT : IsRestriction T T') (hS : IsRestriction S S') : + IsRestriction (Tensor.product T S) (Tensor.product T' S') := by + rcases hT with ⟨A, B, C, rfl⟩ + rcases hS with ⟨D, E, F, rfl⟩ + exact ⟨_, _, _, (Tensor.restrict_product A B C D E F T' S').symm⟩ + +omit [Fintype X] [Fintype Y] [Fintype Z] [Fintype U] [Fintype V] [Fintype W] in +theorem IsRestriction.sum {T : Tensor ℂ X Y Z} {S : Tensor ℂ U V W} + {T' : Tensor ℂ P Q R} {U' V' W' : Type*} + [Fintype U'] [Fintype V'] [Fintype W'] {S' : Tensor ℂ U' V' W'} + (hT : IsRestriction T T') (hS : IsRestriction S S') : + IsRestriction (sumTensor T S) (sumTensor T' S') := by + rcases hT with ⟨A, B, C, rfl⟩ + rcases hS with ⟨D, E, F, rfl⟩ + exact ⟨_, _, _, (sumTensor_restrict A B C D E F T' S').symm⟩ + +omit [Fintype X] [Fintype Y] [Fintype Z] in +theorem IsRestriction.zero (S : Tensor ℂ U V W) : + IsRestriction (0 : Tensor ℂ X Y Z) S := by + refine ⟨0, 0, 0, ?_⟩ + funext x y z + simp [Tensor.restrict] + +theorem IsRestriction.rank_le {T : Tensor ℂ X Y Z} {S : Tensor ℂ U V W} + (h : IsRestriction T S) : exactRank T ≤ exactRank S := by + rcases h with ⟨A, B, C, rfl⟩ + exact exactRank_restrict_le S A B C + +omit [Fintype X] [Fintype Y] [Fintype Z] in +theorem IsRestriction.eq_zero_of_zero {T : Tensor ℂ X Y Z} + (h : IsRestriction T (0 : Tensor ℂ U V W)) : T = 0 := by + rcases h with ⟨A, B, C, h⟩ + funext x y z + rw [h] + simp [Tensor.restrict] + +end Restriction + +/-- A set-sized presentation of any finite complex coefficient tensor. -/ +structure FiniteTensor where + nx : ℕ + ny : ℕ + nz : ℕ + coeff : Tensor ℂ (Fin nx) (Fin ny) (Fin nz) + +namespace FiniteTensor + +/-- Replace arbitrary finite coordinate sets by standard finite sets. -/ +def ofTensor {X Y Z : Type*} [Fintype X] [Fintype Y] [Fintype Z] + (T : Tensor ℂ X Y Z) : FiniteTensor where + nx := Fintype.card X + ny := Fintype.card Y + nz := Fintype.card Z + coeff := Tensor.pullback (Fintype.equivFin X).symm + (Fintype.equivFin Y).symm (Fintype.equivFin Z).symm T + +instance : LE FiniteTensor := ⟨fun T S => IsRestriction T.coeff S.coeff⟩ + +instance : Preorder FiniteTensor where + le_refl T := IsRestriction.refl T.coeff + le_trans _ _ _ := IsRestriction.trans + +theorem ofTensor_le_iff {X Y Z U V W : Type*} + [Fintype X] [Fintype Y] [Fintype Z] + [Fintype U] [Fintype V] [Fintype W] + (T : Tensor ℂ X Y Z) (S : Tensor ℂ U V W) : + ofTensor T ≤ ofTensor S ↔ IsRestriction T S := + IsRestriction.reindex_iff T S _ _ _ _ _ _ + +def product (T S : FiniteTensor) : FiniteTensor := + ofTensor (Tensor.product T.coeff S.coeff) + +def sum (T S : FiniteTensor) : FiniteTensor := + ofTensor (sumTensor T.coeff S.coeff) + +theorem product_mono {T T' S S' : FiniteTensor} (hT : T ≤ T') (hS : S ≤ S') : + product T S ≤ product T' S' := + (ofTensor_le_iff _ _).mpr (IsRestriction.product hT hS) + +theorem sum_mono {T T' S S' : FiniteTensor} (hT : T ≤ T') (hS : S ≤ S') : + sum T S ≤ sum T' S' := + (ofTensor_le_iff _ _).mpr (IsRestriction.sum hT hS) + +end FiniteTensor + +/-- Finite complex tensors, with two presentations identified exactly when +each is a linear restriction of the other. -/ +abbrev TensorClass := Antisymmetrization FiniteTensor (· ≤ ·) + +/-- The class of a finite tensor presentation. -/ +def tensorClass (T : FiniteTensor) : TensorClass := toAntisymmetrization (· ≤ ·) T + +@[simp] theorem tensorClass_eq_iff (T S : FiniteTensor) : + tensorClass T = tensorClass S ↔ T ≤ S ∧ S ≤ T := + toAntisymmetrization_eq (· ≤ ·) T S + +@[simp] theorem tensorClass_le_iff (T S : FiniteTensor) : + tensorClass T ≤ tensorClass S ↔ T ≤ S := Iff.rfl + +/-- The quotient class of a tensor on any three finite coordinate sets. -/ +def classOf {X Y Z : Type*} [Fintype X] [Fintype Y] [Fintype Z] + (T : Tensor ℂ X Y Z) : TensorClass := tensorClass (FiniteTensor.ofTensor T) + +theorem classOf_le_iff {X Y Z U V W : Type*} + [Fintype X] [Fintype Y] [Fintype Z] + [Fintype U] [Fintype V] [Fintype W] + (T : Tensor ℂ X Y Z) (S : Tensor ℂ U V W) : + classOf T ≤ classOf S ↔ IsRestriction T S := FiniteTensor.ofTensor_le_iff T S + +theorem classOf_eq_iff {X Y Z U V W : Type*} + [Fintype X] [Fintype Y] [Fintype Z] + [Fintype U] [Fintype V] [Fintype W] + (T : Tensor ℂ X Y Z) (S : Tensor ℂ U V W) : + classOf T = classOf S ↔ IsRestriction T S ∧ IsRestriction S T := by + rw [le_antisymm_iff, classOf_le_iff, classOf_le_iff] + +theorem classOf_reindex {X Y Z U V W : Type*} + [Fintype X] [Fintype Y] [Fintype Z] + [Fintype U] [Fintype V] [Fintype W] + (T : Tensor ℂ X Y Z) (ex : U ≃ X) (ey : V ≃ Y) (ez : W ≃ Z) : + classOf (Tensor.pullback ex ey ez T) = classOf T := + (classOf_eq_iff _ _).mpr ⟨IsRestriction.pullback T ex ey ez, + IsRestriction.of_reindex T ex ey ez⟩ + +theorem classOf_eq_of_reindex {X Y Z U V W : Type*} + [Fintype X] [Fintype Y] [Fintype Z] + [Fintype U] [Fintype V] [Fintype W] + {T : Tensor ℂ X Y Z} {S : Tensor ℂ U V W} + (ex : X ≃ U) (ey : Y ≃ V) (ez : Z ≃ W) + (h : Tensor.pullback ex ey ez S = T) : classOf T = classOf S := + (congrArg classOf h).symm.trans (classOf_reindex S ex ey ez) + +@[simp] theorem classOf_coeff (T : FiniteTensor) : classOf T.coeff = tensorClass T := by + apply (tensorClass_eq_iff _ _).mpr + exact ⟨IsRestriction.pullback T.coeff _ _ _, IsRestriction.of_reindex T.coeff _ _ _⟩ + +instance : Mul TensorClass where + mul := Quotient.map₂ FiniteTensor.product (by + intro T T' hT S S' hS + exact ⟨FiniteTensor.product_mono hT.1 hS.1, + FiniteTensor.product_mono hT.2 hS.2⟩) + +instance : Add TensorClass where + add := Quotient.map₂ FiniteTensor.sum (by + intro T T' hT S S' hS + exact ⟨FiniteTensor.sum_mono hT.1 hS.1, FiniteTensor.sum_mono hT.2 hS.2⟩) + +@[simp] theorem tensorClass_product (T S : FiniteTensor) : + tensorClass T * tensorClass S = tensorClass (FiniteTensor.product T S) := rfl + +@[simp] theorem tensorClass_sum (T S : FiniteTensor) : + tensorClass T + tensorClass S = tensorClass (FiniteTensor.sum T S) := rfl + +theorem classOf_product {X Y Z U V W : Type*} + [Fintype X] [Fintype Y] [Fintype Z] + [Fintype U] [Fintype V] [Fintype W] + (T : Tensor ℂ X Y Z) (S : Tensor ℂ U V W) : + classOf (Tensor.product T S) = classOf T * classOf S := by + symm + exact classOf_reindex (Tensor.product T S) + (Equiv.prodCongr (Fintype.equivFin X).symm (Fintype.equivFin U).symm) + (Equiv.prodCongr (Fintype.equivFin Y).symm (Fintype.equivFin V).symm) + (Equiv.prodCongr (Fintype.equivFin Z).symm (Fintype.equivFin W).symm) + +theorem classOf_sum {X Y Z U V W : Type*} + [Fintype X] [Fintype Y] [Fintype Z] + [Fintype U] [Fintype V] [Fintype W] + (T : Tensor ℂ X Y Z) (S : Tensor ℂ U V W) : + classOf (sumTensor T S) = classOf T + classOf S := by + symm + have h := classOf_reindex (sumTensor T S) + (Equiv.sumCongr (Fintype.equivFin X).symm (Fintype.equivFin U).symm) + (Equiv.sumCongr (Fintype.equivFin Y).symm (Fintype.equivFin V).symm) + (Equiv.sumCongr (Fintype.equivFin Z).symm (Fintype.equivFin W).symm) + change classOf (sumTensor (FiniteTensor.ofTensor T).coeff + (FiniteTensor.ofTensor S).coeff) = _ + have heq : sumTensor (FiniteTensor.ofTensor T).coeff (FiniteTensor.ofTensor S).coeff = + Tensor.pullback + (Equiv.sumCongr (Fintype.equivFin X).symm (Fintype.equivFin U).symm) + (Equiv.sumCongr (Fintype.equivFin Y).symm (Fintype.equivFin V).symm) + (Equiv.sumCongr (Fintype.equivFin Z).symm (Fintype.equivFin W).symm) + (sumTensor T S) := by + funext x y z + cases x <;> cases y <;> cases z <;> rfl + rw [heq] + exact h + +instance : Zero TensorClass := ⟨classOf (0 : Tensor ℂ Empty Empty Empty)⟩ +instance : One TensorClass := ⟨classOf (fun (_ _ _ : PUnit.{1}) => (1 : ℂ))⟩ + +theorem classOf_zero {X Y Z : Type*} [Fintype X] [Fintype Y] [Fintype Z] : + classOf (0 : Tensor ℂ X Y Z) = 0 := + (classOf_eq_iff _ _).mpr ⟨IsRestriction.zero _, IsRestriction.zero _⟩ + +private theorem class_add_assoc (a b c : TensorClass) : (a + b) + c = a + (b + c) := by + induction a using Quotient.inductionOn with | h a => + induction b using Quotient.inductionOn with | h b => + induction c using Quotient.inductionOn with | h c => + change (tensorClass a + tensorClass b) + tensorClass c = + tensorClass a + (tensorClass b + tensorClass c) + rw [← classOf_coeff a, ← classOf_coeff b, ← classOf_coeff c] + simp only [← classOf_sum] + exact classOf_eq_of_reindex _ _ _ (sumTensor_assoc a.coeff b.coeff c.coeff) + +private theorem class_add_comm (a b : TensorClass) : a + b = b + a := by + induction a using Quotient.inductionOn with | h a => + induction b using Quotient.inductionOn with | h b => + change tensorClass a + tensorClass b = tensorClass b + tensorClass a + rw [← classOf_coeff a, ← classOf_coeff b] + simp only [← classOf_sum] + exact classOf_eq_of_reindex _ _ _ (sumTensor_comm a.coeff b.coeff) + +private theorem class_add_zero (a : TensorClass) : a + 0 = a := by + induction a using Quotient.inductionOn with | h a => + change tensorClass a + 0 = tensorClass a + rw [← classOf_coeff a] + change classOf a.coeff + classOf (0 : Tensor ℂ Empty Empty Empty) = classOf a.coeff + rw [← classOf_sum] + exact (classOf_eq_of_reindex _ _ _ (sumTensor_empty_right a.coeff + (0 : Tensor ℂ Empty Empty Empty))).symm + +private theorem class_zero_add (a : TensorClass) : 0 + a = a := + (class_add_comm 0 a).trans (class_add_zero a) + +private theorem class_mul_assoc (a b c : TensorClass) : (a * b) * c = a * (b * c) := by + induction a using Quotient.inductionOn with | h a => + induction b using Quotient.inductionOn with | h b => + induction c using Quotient.inductionOn with | h c => + change (tensorClass a * tensorClass b) * tensorClass c = + tensorClass a * (tensorClass b * tensorClass c) + rw [← classOf_coeff a, ← classOf_coeff b, ← classOf_coeff c] + simp only [← classOf_product] + exact classOf_eq_of_reindex _ _ _ (tensorProduct_assoc a.coeff b.coeff c.coeff) + +private theorem class_mul_comm (a b : TensorClass) : a * b = b * a := by + induction a using Quotient.inductionOn with | h a => + induction b using Quotient.inductionOn with | h b => + change tensorClass a * tensorClass b = tensorClass b * tensorClass a + rw [← classOf_coeff a, ← classOf_coeff b] + simp only [← classOf_product] + exact classOf_eq_of_reindex _ _ _ (tensorProduct_comm a.coeff b.coeff) + +private theorem class_mul_one (a : TensorClass) : a * 1 = a := by + induction a using Quotient.inductionOn with | h a => + change tensorClass a * 1 = tensorClass a + rw [← classOf_coeff a] + change classOf a.coeff * classOf (fun (_ _ _ : PUnit.{1}) => (1 : ℂ)) = classOf a.coeff + rw [← classOf_product] + exact (classOf_eq_of_reindex _ _ _ (tensorProduct_one_right a.coeff)).symm + +private theorem class_one_mul (a : TensorClass) : 1 * a = a := + (class_mul_comm 1 a).trans (class_mul_one a) + +private theorem class_mul_zero (a : TensorClass) : a * 0 = 0 := by + induction a using Quotient.inductionOn with | h a => + change tensorClass a * 0 = 0 + rw [← classOf_coeff a] + change classOf a.coeff * classOf (0 : Tensor ℂ Empty Empty Empty) = 0 + rw [← classOf_product] + have heq : Tensor.product a.coeff (0 : Tensor ℂ Empty Empty Empty) = 0 := by + funext x y z + simp [Tensor.product] + rw [heq, classOf_zero] + +private theorem class_zero_mul (a : TensorClass) : 0 * a = 0 := + (class_mul_comm 0 a).trans (class_mul_zero a) + +private theorem class_left_distrib (a b c : TensorClass) : a * (b + c) = a * b + a * c := by + induction a using Quotient.inductionOn with | h a => + induction b using Quotient.inductionOn with | h b => + induction c using Quotient.inductionOn with | h c => + change tensorClass a * (tensorClass b + tensorClass c) = + tensorClass a * tensorClass b + tensorClass a * tensorClass c + rw [← classOf_coeff a, ← classOf_coeff b, ← classOf_coeff c] + simp only [← classOf_product, ← classOf_sum] + exact (classOf_eq_of_reindex _ _ _ (product_sumTensor a.coeff b.coeff c.coeff)).symm + +private theorem class_right_distrib (a b c : TensorClass) : (a + b) * c = a * c + b * c := by + rw [class_mul_comm, class_left_distrib, class_mul_comm c a, class_mul_comm c b] + +instance : CommSemiring TensorClass where + add_assoc := class_add_assoc + add_comm := class_add_comm + zero_add := class_zero_add + add_zero := class_add_zero + nsmul := nsmulRec + mul_assoc := class_mul_assoc + mul_comm := class_mul_comm + one_mul := class_one_mul + mul_one := class_mul_one + zero_mul := class_zero_mul + mul_zero := class_mul_zero + left_distrib := class_left_distrib + right_distrib := class_right_distrib + +theorem mul_mono {T T' S S' : TensorClass} (hT : T ≤ T') (hS : S ≤ S') : + T * S ≤ T' * S' := by + induction T using Quotient.inductionOn with | h T => + induction T' using Quotient.inductionOn with | h T' => + induction S using Quotient.inductionOn with | h S => + induction S' using Quotient.inductionOn with | h S' => + exact FiniteTensor.product_mono hT hS + +theorem add_mono {T T' S S' : TensorClass} (hT : T ≤ T') (hS : S ≤ S') : + T + S ≤ T' + S' := by + induction T using Quotient.inductionOn with | h T => + induction T' using Quotient.inductionOn with | h T' => + induction S using Quotient.inductionOn with | h S => + induction S' using Quotient.inductionOn with | h S' => + exact FiniteTensor.sum_mono hT hS + +/-- Every tensor class is nonnegative in the restriction order. -/ +theorem zero_le (T : TensorClass) : 0 ≤ T := by + induction T using Quotient.inductionOn with | h T => + change (0 : TensorClass) ≤ tensorClass T + rw [← classOf_coeff T] + exact (classOf_le_iff _ _).mpr (IsRestriction.zero T.coeff) + +instance : OrderBot TensorClass where + bot := 0 + bot_le := zero_le + +instance : IsOrderedAddMonoid TensorClass where + add_le_add_left _ _ h _c := add_mono h le_rfl + +instance : IsOrderedMonoid TensorClass where + mul_le_mul_left _ _ h _c := mul_mono h le_rfl + +instance : IsOrderedRing TensorClass where + zero_le_one := zero_le 1 + mul_le_mul_of_nonneg_left := by + intro a ha b c hbc + exact mul_mono le_rfl hbc + mul_le_mul_of_nonneg_right := by + intro a ha b c hbc + exact mul_mono hbc le_rfl + +/-- Exact rank descends to mutual-restriction classes. -/ +def rank : TensorClass → ℕ := Quotient.lift (fun T : FiniteTensor => exactRank T.coeff) + (by + intro T S h + exact le_antisymm (IsRestriction.rank_le h.1) (IsRestriction.rank_le h.2)) + +@[simp] theorem rank_tensorClass (T : FiniteTensor) : + rank (tensorClass T) = exactRank T.coeff := rfl + +@[simp] theorem rank_classOf {X Y Z : Type*} [Fintype X] [Fintype Y] [Fintype Z] + (T : Tensor ℂ X Y Z) : rank (classOf T) = exactRank T := + exactRank_reindex T _ _ _ + +theorem rank_mono {T S : TensorClass} (h : T ≤ S) : rank T ≤ rank S := by + induction T using Quotient.inductionOn with | h T => + induction S using Quotient.inductionOn with | h S => + exact IsRestriction.rank_le h + +theorem rank_mul_le (T S : TensorClass) : rank (T * S) ≤ rank T * rank S := by + induction T using Quotient.inductionOn with | h T => + induction S using Quotient.inductionOn with | h S => + change rank (tensorClass T * tensorClass S) ≤ rank (tensorClass T) * rank (tensorClass S) + rw [← classOf_coeff T, ← classOf_coeff S, ← classOf_product] + simp only [rank_classOf] + exact exactRank_product_le _ _ + +/-- Square matrix multiplication as an element of the tensor semiring. -/ +def matrixClass (n : ℕ) : TensorClass := classOf (Tensor.matrixMultiplication n n n) + +@[simp] theorem rank_matrixClass (n : ℕ) : rank (matrixClass n) = exactMatrixRank n := + rank_classOf _ + +private theorem classOf_matrixCoefficients_equiv {A B : Type*} + [Fintype A] [Fintype B] [DecidableEq A] [DecidableEq B] (e : A ≃ B) : + classOf (Tensor.matrixCoefficients (K := ℂ) A A A) = + classOf (Tensor.matrixCoefficients (K := ℂ) B B B) := by + apply classOf_eq_of_reindex (Equiv.prodCongr e e) (Equiv.prodCongr e e) + (Equiv.prodCongr e e) + funext x y z + simp [Tensor.pullback, Tensor.matrixCoefficients, e.injective.eq_iff] + +theorem matrixClass_mul (m n : ℕ) : matrixClass (m * n) = matrixClass m * matrixClass n := by + let e : Fin (m * n) ≃ Fin m × Fin n := Fintype.equivOfCardEq (by simp) + have h := classOf_matrixCoefficients_equiv e + change matrixClass (m * n) = classOf (Tensor.matrixCoefficients (K := ℂ) + (Fin m × Fin n) (Fin m × Fin n) (Fin m × Fin n)) at h + rw [h] + change _ = classOf (Tensor.matrixCoefficients (K := ℂ) (Fin m) (Fin m) (Fin m)) * + classOf (Tensor.matrixCoefficients (K := ℂ) (Fin n) (Fin n) (Fin n)) + rw [← classOf_product] + apply classOf_eq_of_reindex (Equiv.prodProdProdComm _ _ _ _) + (Equiv.prodProdProdComm _ _ _ _) (Equiv.prodProdProdComm _ _ _ _) + funext x y z + exact Tensor.matrixCoefficients_product x y z + +@[simp] theorem matrixClass_one : matrixClass 1 = 1 := by + let e : Fin 1 × Fin 1 ≃ PUnit.{1} := Fintype.equivOfCardEq (by simp) + apply classOf_eq_of_reindex e e e + funext x y z + have hxy : x.2 = y.1 := Subsingleton.elim _ _ + have hyz : y.2 = z.1 := Subsingleton.elim _ _ + have hzx : z.2 = x.1 := Subsingleton.elim _ _ + simp [Tensor.pullback, Tensor.matrixMultiplication, hxy, hyz, hzx] + +theorem matrixClass_pow (m j : ℕ) : matrixClass (m ^ j) = matrixClass m ^ j := by + induction j with + | zero => simp + | succ j ih => rw [pow_succ, matrixClass_mul, ih, pow_succ] + +theorem classOf_eq_zero_iff {X Y Z : Type*} [Fintype X] [Fintype Y] [Fintype Z] + (T : Tensor ℂ X Y Z) : classOf T = 0 ↔ T = 0 := by + constructor + · intro h + have hr : IsRestriction T (0 : Tensor ℂ Empty Empty Empty) := + ((classOf_eq_iff _ _).mp h).1 + exact hr.eq_zero_of_zero + · rintro rfl + exact classOf_zero + +instance : Nontrivial TensorClass := by + refine ⟨⟨1, 0, ?_⟩⟩ + intro h + have heq : (fun (_ _ _ : PUnit.{1}) => (1 : ℂ)) = 0 := + (classOf_eq_zero_iff _).mp h + have := congrFun (congrFun (congrFun heq PUnit.unit) PUnit.unit) PUnit.unit + exact one_ne_zero this + +/-- A nonzero tensor has a nonzero coefficient, which restricts to scalar multiplication. -/ +theorem one_le_classOf_of_ne_zero {X Y Z : Type*} + [Fintype X] [Fintype Y] [Fintype Z] {T : Tensor ℂ X Y Z} (hT : T ≠ 0) : + 1 ≤ classOf T := by + classical + have hex : ∃ x y z, T x y z ≠ 0 := by + by_contra! h + apply hT + funext x y z + exact h x y z + obtain ⟨x, y, z, hxyz⟩ := hex + apply (classOf_le_iff _ _).mpr + refine ⟨(fun _ u => if u = x then (T x y z)⁻¹ else 0), + (fun _ v => if v = y then 1 else 0), + (fun _ w => if w = z then 1 else 0), ?_⟩ + funext a b c + simp [Tensor.restrict, ite_mul, mul_ite, hxyz] + +/-- Every nonzero class dominates the multiplicative unit. -/ +theorem one_le_of_ne_zero {T : TensorClass} (hT : T ≠ 0) : 1 ≤ T := by + induction T using Quotient.inductionOn with | h T => + change tensorClass T ≠ 0 at hT + change 1 ≤ tensorClass T + rw [← classOf_coeff T] at hT ⊢ + exact one_le_classOf_of_ne_zero (fun h => hT ((classOf_eq_zero_iff _).mpr h)) + +end MatrixMultiplication.AuxiliarySeparation.TensorSemiring + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Tensor/SharedPadding.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Tensor/SharedPadding.lean new file mode 100644 index 0000000000000000000000000000000000000000..06ecd05ff68be91adcefc79f617bcf1623677c7a --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Tensor/SharedPadding.lean @@ -0,0 +1,147 @@ +import OAI.LinearAlgebra.MatrixMultiplication.AuxiliarySeparation.Tensor.CharacterBounds +import OAI.LinearAlgebra.MatrixMultiplication.AuxiliarySeparation.Separation.Basic + +namespace OAI + +/-! +# Padding shared-input tensors with different branch dimensions + +The finite separation construction uses fixed ambient coordinate spaces on +each leg. A family with a common first leg and varying second and third legs +embeds into that setting without changing any character values. The extra +coordinates introduced by padding have zero coefficients. +-/ + +noncomputable section + +open MatrixMultiplication.Foundation +open scoped BigOperators Classical + +namespace MatrixMultiplication.AuxiliarySeparation + +variable {M : ℕ} {X : Type} {Y Z : Fin M → Type} +variable [Fintype X] [∀ i, Fintype (Y i)] [∀ i, Fintype (Z i)] + +/-- Branches sharing their first input but with independently sized other legs. -/ +def sharedFirstDependentTensor (B : ∀ i, Tensor ℂ X (Y i) (Z i)) : + Tensor ℂ X (Σ i, Y i) (Σ i, Z i) := + fun x y z => if h : z.1 = y.1 then B y.1 x y.2 (h ▸ z.2) else 0 + +/-- A branch in the two common sigma coordinate spaces, with zero padding. -/ +def paddedSharedBranch (B : ∀ i, Tensor ℂ X (Y i) (Z i)) (i : Fin M) : + Tensor ℂ X (Σ i, Y i) (Σ i, Z i) := + Tensor.restrict (fun x' x => if x = x' then 1 else 0) + (fun y b => if Sigma.mk i b = y then 1 else 0) + (fun z c => if Sigma.mk i c = z then 1 else 0) (B i) + +omit [Fintype X] [∀ i, Fintype (Y i)] [∀ i, Fintype (Z i)] in +@[simp] theorem sharedFirstDependentTensor_matching + (B : ∀ i, Tensor ℂ X (Y i) (Z i)) (i : Fin M) + (x : X) (y : Y i) (z : Z i) : + sharedFirstDependentTensor B x ⟨i, y⟩ ⟨i, z⟩ = B i x y z := by + simp [sharedFirstDependentTensor] + +@[simp] theorem paddedSharedBranch_matching + (B : ∀ i, Tensor ℂ X (Y i) (Z i)) (i : Fin M) + (x : X) (y : Y i) (z : Z i) : + paddedSharedBranch B i x ⟨i, y⟩ ⟨i, z⟩ = B i x y z := by + simp [paddedSharedBranch, Tensor.restrict, ite_mul, mul_ite] + +theorem paddedSharedBranch_pullback + (B : ∀ i, Tensor ℂ X (Y i) (Z i)) (i : Fin M) : + Tensor.pullback id (Sigma.mk i) (Sigma.mk i) (paddedSharedBranch B i) = B i := by + funext x y z + exact paddedSharedBranch_matching B i x y z + +/-- A nonzero branch remains nonzero after padding. -/ +theorem paddedSharedBranch_ne_zero + (B : ∀ i, Tensor ℂ X (Y i) (Z i)) (i : Fin M) (hB : B i ≠ 0) : + paddedSharedBranch B i ≠ 0 := by + intro h + apply hB + rw [← paddedSharedBranch_pullback B i, h] + rfl + +theorem paddedSharedBranch_zero_middle + (B : ∀ i, Tensor ℂ X (Y i) (Z i)) (i : Fin M) + (x : X) (y : Σ i, Y i) (z : Σ i, Z i) (hy : y.1 ≠ i) : + paddedSharedBranch B i x y z = 0 := by + have hzero : ∀ b : Y i, Sigma.mk i b ≠ y := + fun b h => hy (congrArg Sigma.fst h).symm + simp [paddedSharedBranch, Tensor.restrict, hzero] + +theorem paddedSharedBranch_zero_right + (B : ∀ i, Tensor ℂ X (Y i) (Z i)) (i : Fin M) + (x : X) (y : Σ i, Y i) (z : Σ i, Z i) (hz : z.1 ≠ i) : + paddedSharedBranch B i x y z = 0 := by + have hzero : ∀ c : Z i, Sigma.mk i c ≠ z := + fun c h => hz (congrArg Sigma.fst h).symm + simp [paddedSharedBranch, Tensor.restrict, hzero] + +/-- Redundant branch labels zero-extend the varying-dimension shared tensor. -/ +theorem sharedFirstTensor_paddedSharedBranch + (B : ∀ i, Tensor ℂ X (Y i) (Z i)) : + sharedFirstTensor (paddedSharedBranch B) = Tensor.restrict + (fun (x' : X) x => if x = x' then 1 else 0) + (fun (y' : Fin M × (Σ i, Y i)) y => if (y.1, y) = y' then 1 else 0) + (fun (z' : Fin M × (Σ i, Z i)) z => if (z.1, z) = z' then 1 else 0) + (sharedFirstDependentTensor B) := by + funext x' y' z' + rcases y' with ⟨i, ⟨iy, y⟩⟩ + rcases z' with ⟨j, ⟨iz, z⟩⟩ + have hgraph {A : Type} (f : A → Fin M) (a x : A) (i : Fin M) : + (f a, a) = (i, x) ↔ a = x ∧ f x = i := by + constructor + · intro h + have ha : a = x := congrArg Prod.snd h + refine ⟨ha, ?_⟩ + rw [← ha] + exact congrArg Prod.fst h + · rintro ⟨rfl, h⟩ + simp [h] + simp only [Tensor.restrict, hgraph, ite_and] + simp only [ite_mul, zero_mul, mul_ite, mul_zero] + simp only [Finset.sum_ite_eq', Finset.mem_univ, ite_true] + by_cases hi : iy = i + · subst iy + by_cases hz : iz = i + · subst iz + by_cases hij : i = j + · subst j + simp [sharedFirstTensor, sharedFirstDependentTensor] + · simp [sharedFirstTensor, hij] + · simp [sharedFirstTensor, sharedFirstDependentTensor, + paddedSharedBranch_zero_right B i x' ⟨i, y⟩ ⟨iz, z⟩ hz, hz] + · simp [sharedFirstTensor, + paddedSharedBranch_zero_middle B i x' ⟨iy, y⟩ ⟨iz, z⟩ hi, hi] + +namespace Character + +/-- Padding a branch changes no character value. -/ +@[simp] theorem value_paddedSharedBranch (χ : Character) + (B : ∀ i, Tensor ℂ X (Y i) (Z i)) (i : Fin M) : + χ.value (paddedSharedBranch B i) = χ.value (B i) := by + simpa only [paddedSharedBranch, id_eq] using + χ.value_extendByZero (B i) id (Sigma.mk i) (Sigma.mk i) + Function.injective_id + (fun _ _ h => eq_of_heq (Sigma.mk.inj h).2) + (fun _ _ h => eq_of_heq (Sigma.mk.inj h).2) + +/-- Passing to uniform ambient branch spaces adds no character cost. -/ +@[simp] theorem value_sharedFirstTensor_padded (χ : Character) + (B : ∀ i, Tensor ℂ X (Y i) (Z i)) : + χ.value (sharedFirstTensor (paddedSharedBranch B)) = + χ.value (sharedFirstDependentTensor B) := by + rw [sharedFirstTensor_paddedSharedBranch] + simpa only [id_eq] using + χ.value_extendByZero (sharedFirstDependentTensor B) id + (fun y => (y.1, y)) (fun z => (z.1, z)) Function.injective_id + (fun _ _ h => congrArg Prod.snd h) (fun _ _ h => congrArg Prod.snd h) + +end Character + +end MatrixMultiplication.AuxiliarySeparation + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Tensor/SixfoldProductBounds.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Tensor/SixfoldProductBounds.lean new file mode 100644 index 0000000000000000000000000000000000000000..3c9c2d45ee8c75e820590a90e126b0528f550b81 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Tensor/SixfoldProductBounds.lean @@ -0,0 +1,111 @@ +import OAI.LinearAlgebra.MatrixMultiplication.AuxiliarySeparation.Character.Symmetrization +import OAI.LinearAlgebra.MatrixMultiplication.Tensor.ComplexTensorSymmetrization +import Mathlib.Tactic.GCongr + +namespace OAI + +/-! +# Algebra and bounds for the sixfold character product + +The product over all six leg orders is multiplicative and nonnegative. A +nonzero tensor has product at least one, and every rank decomposition bounds +the product by the sixth power of its size. +-/ + +namespace MatrixMultiplication.AuxiliarySeparation +namespace Character + +open MatrixMultiplication.Foundation + +variable (χ : Character) +variable {X Y Z U V W : Type} +variable [Fintype X] [Fintype Y] [Fintype Z] +variable [Fintype U] [Fintype V] [Fintype W] + +/-- Taking the product over all six leg orders preserves tensor multiplication. -/ +theorem sixfoldProduct_product (T : Tensor ℂ X Y Z) (S : Tensor ℂ U V W) : + χ.sixfoldProduct (Tensor.product T S) = χ.sixfoldProduct T * χ.sixfoldProduct S := by + unfold sixfoldProduct + change χ.value (Tensor.product T S) * + χ.value (Tensor.product (fun y z x => T x y z) (fun v w u => S u v w)) * + χ.value (Tensor.product (fun z x y => T x y z) (fun w u v => S u v w)) * + χ.value (Tensor.product (fun x z y => T x y z) (fun u w v => S u v w)) * + χ.value (Tensor.product (fun z y x => T x y z) (fun w v u => S u v w)) * + χ.value (Tensor.product (fun y x z => T x y z) (fun v u w => S u v w)) = _ + simp only [χ.map_product] + ring + +/-- All six factors of the symmetrized product are nonnegative. -/ +theorem sixfoldProduct_nonneg (T : Tensor ℂ X Y Z) : 0 ≤ χ.sixfoldProduct T := by + exact mul_nonneg (mul_nonneg (mul_nonneg (mul_nonneg (mul_nonneg + (χ.nonneg T) (χ.nonneg _)) (χ.nonneg _)) (χ.nonneg _)) (χ.nonneg _)) (χ.nonneg _) + +/-- Every nonzero tensor has symmetrized character product at least one. -/ +theorem one_le_sixfoldProduct {T : Tensor ℂ X Y Z} (hT : T ≠ 0) : + 1 ≤ χ.sixfoldProduct T := by + classical + obtain ⟨x, hx⟩ := Function.ne_iff.mp hT + obtain ⟨y, hy⟩ := Function.ne_iff.mp hx + obtain ⟨z, hz⟩ := Function.ne_iff.mp hy + change T x y z ≠ 0 at hz + have h0 := χ.one_le_value hT + have h1 : 1 ≤ χ.value (fun y z x => T x y z) := χ.one_le_value (by + intro h + exact hz (congrArg (fun S => S y z x) h)) + have h2 : 1 ≤ χ.value (fun z x y => T x y z) := χ.one_le_value (by + intro h + exact hz (congrArg (fun S => S z x y) h)) + have h3 : 1 ≤ χ.value (fun x z y => T x y z) := χ.one_le_value (by + intro h + exact hz (congrArg (fun S => S x z y) h)) + have h4 : 1 ≤ χ.value (fun z y x => T x y z) := χ.one_le_value (by + intro h + exact hz (congrArg (fun S => S z y x) h)) + have h5 : 1 ≤ χ.value (fun y x z => T x y z) := χ.one_le_value (by + intro h + exact hz (congrArg (fun S => S y x z) h)) + exact one_le_mul_of_one_le_of_one_le + (one_le_mul_of_one_le_of_one_le (one_le_mul_of_one_le_of_one_le + (one_le_mul_of_one_le_of_one_le (one_le_mul_of_one_le_of_one_le h0 h1) h2) h3) h4) h5 + +/-- In particular, the sixfold product of a nonzero tensor is positive. -/ +theorem sixfoldProduct_pos {T : Tensor ℂ X Y Z} (hT : T ≠ 0) : + 0 < χ.sixfoldProduct T := + zero_lt_one.trans_le (χ.one_le_sixfoldProduct hT) + +private theorem rankAtMost_swap12 {K X Y Z : Type*} [CommSemiring K] + {T : Tensor K X Y Z} {r : ℕ} (h : Tensor.RankAtMost T r) : + Tensor.RankAtMost (fun y x z => T x y z) r := by + rcases h with ⟨a, b, c, rfl⟩ + refine ⟨b, a, c, ?_⟩ + funext y x z + apply Finset.sum_congr rfl + intro i hi + dsimp only [Tensor.rankOne] + ring + +/-- A rank decomposition bounds each of the six character factors. -/ +theorem sixfoldProduct_le_rank {T : Tensor ℂ X Y Z} {r : ℕ} + (h : Tensor.RankAtMost T r) : χ.sixfoldProduct T ≤ (r : ℝ) ^ 6 := by + have h0 := χ.value_le_rank h + have h1 := χ.value_le_rank h.cyclic + have h2 := χ.value_le_rank h.cyclic.cyclic + have h5 := χ.value_le_rank (rankAtMost_swap12 h) + have h3 := χ.value_le_rank (rankAtMost_swap12 h).cyclic + have h4 := χ.value_le_rank (rankAtMost_swap12 h).cyclic.cyclic + unfold sixfoldProduct + calc + _ ≤ (r : ℝ) * r * r * r * r * r := by + gcongr <;> first + | exact χ.nonneg _ + | exact h0 + | exact h1 + | exact h2 + | exact h3 + | exact h4 + _ = _ := by ring + +end Character +end MatrixMultiplication.AuxiliarySeparation + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Tensor/SupportExtension.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Tensor/SupportExtension.lean new file mode 100644 index 0000000000000000000000000000000000000000..2d750e4f3872b02582a00795dde6a5522575104f --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Tensor/SupportExtension.lean @@ -0,0 +1,83 @@ +import OAI.LinearAlgebra.MatrixMultiplication.AuxiliarySeparation.Tensor.CharacterBounds + +namespace OAI + +/-! +# Recovering tensors from their supported coordinate subspaces + +If a tensor has support inside three injectively embedded coordinate sets, it +is exactly the extension by zero of its pullback to those sets. Characters +therefore have the same value on the ambient tensor and this smaller tensor. +-/ + +namespace MatrixMultiplication.AuxiliarySeparation + +open MatrixMultiplication.Foundation +open scoped Classical + +variable {X Y Z X' Y' Z' : Type} +variable [Fintype X] [Fintype Y] [Fintype Z] +variable [Fintype X'] [Fintype Y'] [Fintype Z'] + +omit [Fintype X'] [Fintype Y'] [Fintype Z'] in +/-- Support in embedded coordinate sets reconstructs the tensor by zero extension. -/ +theorem tensor_eq_extendByZero_pullback (T : Tensor ℂ X' Y' Z') + (fx : X → X') (fy : Y → Y') (fz : Z → Z') + (hx : Function.Injective fx) (hy : Function.Injective fy) + (hz : Function.Injective fz) + (hs : ∀ x' y' z', T x' y' z' ≠ 0 → + x' ∈ Set.range fx ∧ y' ∈ Set.range fy ∧ z' ∈ Set.range fz) : + T = Tensor.restrict + (fun x' x => if fx x = x' then 1 else 0) + (fun y' y => if fy y = y' then 1 else 0) + (fun z' z => if fz z = z' then 1 else 0) + (Tensor.pullback fx fy fz T) := by + classical + funext x' y' z' + by_cases hx' : x' ∈ Set.range fx + · obtain ⟨x, rfl⟩ := hx' + by_cases hy' : y' ∈ Set.range fy + · obtain ⟨y, rfl⟩ := hy' + by_cases hz' : z' ∈ Set.range fz + · obtain ⟨z, rfl⟩ := hz' + simp [Tensor.restrict, Tensor.pullback, hx.eq_iff, hy.eq_iff, hz.eq_iff, + ite_mul, mul_ite] + · have hzero : T (fx x) (fy y) z' = 0 := by + by_contra h + exact hz' (hs _ _ _ h).2.2 + have hnone : ∀ z, fz z ≠ z' := fun z h => hz' ⟨z, h⟩ + simp [Tensor.restrict, hzero, hnone] + · have hzero : T (fx x) y' z' = 0 := by + by_contra h + exact hy' (hs _ _ _ h).2.1 + have hnone : ∀ y, fy y ≠ y' := fun y h => hy' ⟨y, h⟩ + simp [Tensor.restrict, hzero, hnone] + · have hzero : T x' y' z' = 0 := by + by_contra h + exact hx' (hs _ _ _ h).1 + have hnone : ∀ x, fx x ≠ x' := fun x h => hx' ⟨x, h⟩ + simp [Tensor.restrict, hzero, hnone] + +namespace Character + +/-- A character ignores ambient coordinates outside a tensor's support. -/ +theorem value_eq_pullback_of_support (χ : Character) (T : Tensor ℂ X' Y' Z') + (fx : X → X') (fy : Y → Y') (fz : Z → Z') + (hx : Function.Injective fx) (hy : Function.Injective fy) + (hz : Function.Injective fz) + (hs : ∀ x' y' z', T x' y' z' ≠ 0 → + x' ∈ Set.range fx ∧ y' ∈ Set.range fy ∧ z' ∈ Set.range fz) : + χ.value T = χ.value (Tensor.pullback fx fy fz T) := by + calc + χ.value T = χ.value (Tensor.restrict + (fun x' x => if fx x = x' then 1 else 0) + (fun y' y => if fy y = y' then 1 else 0) + (fun z' z => if fz z = z' then 1 else 0) + (Tensor.pullback fx fy fz T)) := + congrArg χ.value (tensor_eq_extendByZero_pullback T fx fy fz hx hy hz hs) + _ = _ := χ.value_extendByZero _ fx fy fz hx hy hz + +end Character +end MatrixMultiplication.AuxiliarySeparation + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Tensor/TagInequality.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Tensor/TagInequality.lean new file mode 100644 index 0000000000000000000000000000000000000000..1c3470ceba6442c034574c37d0f65f851062040f --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/AuxiliarySeparation/Tensor/TagInequality.lean @@ -0,0 +1,222 @@ +import OAI.LinearAlgebra.MatrixMultiplication.AuxiliarySeparation.Entropy.Tag +import OAI.LinearAlgebra.MatrixMultiplication.AuxiliarySeparation.Separation.Basic +import OAI.LinearAlgebra.MatrixMultiplication.AuxiliarySeparation.Character.Dot +import OAI.LinearAlgebra.MatrixMultiplication.AuxiliarySeparation.Tensor.CharacterBounds +import OAI.LinearAlgebra.MatrixMultiplication.AuxiliarySeparation.Character.FiniteSeparation +import OAI.LinearAlgebra.MatrixMultiplication.AuxiliarySeparation.Tensor.SharedPadding + +namespace OAI + +/-! +# The shared-input tensor tag inequality + +Exact type words in a power of a matched-sector tensor are obtained by explicit +coordinate pullbacks. Their character values depend only on the type counts. +The finite auxiliary separation inequality therefore supplies the integral +bounds required by the entropy limit. +-/ + +noncomputable section + +open MatrixMultiplication.Foundation +open scoped BigOperators Classical + +namespace MatrixMultiplication.AuxiliarySeparation + +variable {s : ℕ} {X Y Z : Type} + [Fintype X] [Fintype Y] [Fintype Z] + +/-- A word prescribes one branch tensor at each tensor-product position. -/ +def branchWordTensor (B : Fin s → Tensor ℂ X Y Z) {n : ℕ} (w : Fin n → Fin s) : + Tensor ℂ (Fin n → X) (Fin n → Y) (Fin n → Z) := + fun x y z => ∏ i, B (w i) (x i) (y i) (z i) + +/-- The canonical branch word tensor evaluates multiplicatively. -/ +theorem Character.value_branchWordTensor (χ : Character) + (B : Fin s → Tensor ℂ X Y Z) {n : ℕ} (w : Fin n → Fin s) : + χ.value (branchWordTensor B w) = ∏ i, χ.value (B (w i)) := by + induction n with + | zero => + have hzero : branchWordTensor B w = Tensor.pullback + (Equiv.equivPUnit (Fin 0 → X)) + (Equiv.equivPUnit (Fin 0 → Y)) + (Equiv.equivPUnit (Fin 0 → Z)) unitTensor := by + funext x y z + simp [branchWordTensor, Tensor.pullback, unitTensor] + rw [hzero, χ.value_reindex, χ.map_one] + simp + | succ n ih => + have heq : branchWordTensor B w = Tensor.pullback + (Fin.consEquiv (fun _ : Fin (n + 1) => X)).symm + (Fin.consEquiv (fun _ : Fin (n + 1) => Y)).symm + (Fin.consEquiv (fun _ : Fin (n + 1) => Z)).symm + (Tensor.product (B (w 0)) (branchWordTensor B (Fin.tail w))) := by + funext x y z + simp [branchWordTensor, Tensor.pullback, Tensor.product, Fin.consEquiv, + Fin.prod_univ_succ, Fin.tail] + rw [heq, χ.value_reindex, χ.map_product, ih, Fin.prod_univ_succ] + rfl + +/-- All words of an exact type have the same character value. -/ +theorem Character.value_exact_branchWordTensor (χ : Character) + (B : Fin s → Tensor ℂ X Y Z) (counts : Fin s → ℕ) (w : ExactWords counts) : + χ.value (branchWordTensor B w.val) = ∏ a, χ.value (B a) ^ counts a := by + rw [χ.value_branchWordTensor, + ← Fintype.prod_fiberwise' w.val (fun a => χ.value (B a))] + simp only [Finset.prod_const, Finset.card_univ] + apply Finset.prod_congr rfl + intro a _ + rw [show Fintype.card {i // w.val i = a} = counts a from w.property a] + +/-- A coordinate on a retained split leg remembers its type word. -/ +def typeWordCoordinate (counts : Fin s → ℕ) + (e : Fin (Fintype.card (ExactWords counts)) ≃ ExactWords counts) + {U : Type} (y : Fin (Fintype.card (ExactWords counts)) × + (Fin (∑ a, counts a) → U)) : Fin (∑ a, counts a) → (Fin s × U) := + fun i => ((e y.1).val i, y.2 i) + +omit [Fintype X] [Fintype Y] [Fintype Z] in +/-- Restricting both split legs to one exact type produces a shared-first +tensor whose branches are precisely the prescribed branch products. -/ +theorem exactType_power_pullback (B : Fin s → Tensor ℂ X Y Z) + (counts : Fin s → ℕ) + (e : Fin (Fintype.card (ExactWords counts)) ≃ ExactWords counts) : + Tensor.pullback id (typeWordCoordinate counts e) (typeWordCoordinate counts e) + (Tensor.power (sharedFirstTensor B) (∑ a, counts a)) = + sharedFirstTensor (fun h => branchWordTensor B (e h).val) := by + funext x y z + by_cases h : y.1 = z.1 + · simp [Tensor.pullback, Tensor.power, typeWordCoordinate, sharedFirstTensor, + branchWordTensor, h] + · have hword : (e y.1).val ≠ (e z.1).val := by + intro heq + exact h (e.injective (Subtype.ext heq)) + obtain ⟨i, hi⟩ := Function.ne_iff.mp hword + simp only [Tensor.pullback, Tensor.power, sharedFirstTensor, h, ↓reduceIte, + typeWordCoordinate, id_eq] + apply Finset.prod_eq_zero (Finset.mem_univ i) + simp [hi] + +/-- The exact-type restriction never exceeds the source power in character. -/ +theorem Character.exactType_value_le_power (χ : Character) + (B : Fin s → Tensor ℂ X Y Z) (counts : Fin s → ℕ) + (e : Fin (Fintype.card (ExactWords counts)) ≃ ExactWords counts) : + χ.value (sharedFirstTensor (fun h => branchWordTensor B (e h).val)) ≤ + χ.value (sharedFirstTensor B) ^ (∑ a, counts a) := by + rw [← exactType_power_pullback B counts e, ← χ.value_power] + exact χ.value_pullback_le _ _ _ _ + +/-- The finite separation construction and exact-type restriction give the +integral inequality, with no assumed character comparison. -/ +theorem Character.integral_type_comparison (χ : Character) + (B : Fin s → Tensor ℂ X Y Z) (counts : Fin s → ℕ) : + (Fintype.card (ExactWords counts) : ℝ) ^ χ.pX * + ∏ a, χ.value (B a) ^ counts a ≤ + 5 * χ.value (sharedFirstTensor B) ^ (∑ a, counts a) := by + let M := Fintype.card (ExactWords counts) + let e : Fin M ≃ ExactWords counts := (Fintype.equivFin _).symm + let W : Fin M → Tensor ℂ (Fin (∑ a, counts a) → X) + (Fin (∑ a, counts a) → Y) (Fin (∑ a, counts a) → Z) := + fun h => branchWordTensor B (e h).val + have hM : 0 < M := by + simpa only [M, Fintype.card_eq_nat_card] using exactWords_card_pos counts + have hsep : ((M : ℝ) * ∏ a, χ.value (B a) ^ counts a) * (M : ℝ) ^ χ.pX ≤ + 5 * (M : ℝ) * χ.value (sharedFirstTensor W) := by + simpa only [W, χ.value_exact_branchWordTensor, Finset.sum_const, + Finset.card_univ, Fintype.card_fin, nsmul_eq_mul] using + χ.finiteSeparation_bound hM W + have hsource : χ.value (sharedFirstTensor W) ≤ + χ.value (sharedFirstTensor B) ^ (∑ a, counts a) := + χ.exactType_value_le_power B counts e + have hcancel : (M : ℝ) * + ((M : ℝ) ^ χ.pX * ∏ a, χ.value (B a) ^ counts a) ≤ + (M : ℝ) * (5 * χ.value (sharedFirstTensor B) ^ (∑ a, counts a)) := by + calc + _ = ((M : ℝ) * ∏ a, χ.value (B a) ^ counts a) * (M : ℝ) ^ χ.pX := by ring + _ ≤ 5 * (M : ℝ) * χ.value (sharedFirstTensor W) := hsep + _ ≤ 5 * (M : ℝ) * χ.value (sharedFirstTensor B) ^ (∑ a, counts a) := + mul_le_mul_of_nonneg_left hsource (by positivity) + _ = _ := by ring + have hbound := (mul_le_mul_iff_right₀ (Nat.cast_pos.mpr hM : (0 : ℝ) < M)).mp hcancel + simpa only [M, Fintype.card_eq_nat_card] using hbound + +omit [Fintype X] [Fintype Y] [Fintype Z] in +/-- A nonzero branch remains visible in the tensor with a shared first leg. -/ +theorem sharedFirstTensor_ne_zero_of_branch (B : Fin s → Tensor ℂ X Y Z) + (a : Fin s) (ha : B a ≠ 0) : sharedFirstTensor B ≠ 0 := by + intro h + apply ha + funext x y z + have hxyz := congrFun (congrFun (congrFun h x) (a, y)) (a, z) + simpa only [sharedFirstTensor, ↓reduceIte, Pi.zero_apply] using hxyz + +/-- The actual shared-input tensor tag inequality, including probability laws +with zero coordinates. The branch labels are disjoint on the second and third +legs, while the first coordinate is shared. -/ +theorem Character.sharedFirst_tag (χ : Character) + (q : FiniteLaw (Fin s)) (B : Fin s → Tensor ℂ X Y Z) + (hB : ∀ a, B a ≠ 0) : + Real.exp (χ.pX * finiteEntropy q.mass) * + ∏ a, χ.value (B a) ^ q.mass a ≤ χ.value (sharedFirstTensor B) := by + have hs : 0 < s := by + by_contra hn + have hs0 : s = 0 := Nat.eq_zero_of_not_pos hn + subst s + have htotal := q.total + simp at htotal + have hT : sharedFirstTensor B ≠ 0 := + sharedFirstTensor_ne_zero_of_branch B ⟨0, hs⟩ (hB ⟨0, hs⟩) + apply χ.tag_of_integral_type_comparison q (sharedFirstTensor B) B χ.pX hT hB + intro counts _hcounts + simpa only [Fintype.card_eq_nat_card] using χ.integral_type_comparison B counts + +/-- The logarithmic form of the actual tensor tag inequality. -/ +theorem Character.log_sharedFirst_tag (χ : Character) + (q : FiniteLaw (Fin s)) (B : Fin s → Tensor ℂ X Y Z) + (hB : ∀ a, B a ≠ 0) : + χ.pX * finiteEntropy q.mass + ∑ a, q.mass a * Real.log (χ.value (B a)) ≤ + Real.log (χ.value (sharedFirstTensor B)) := by + have hs : 0 < s := by + by_contra hn + have hs0 : s = 0 := Nat.eq_zero_of_not_pos hn + subst s + have htotal := q.total + simp at htotal + have hT : sharedFirstTensor B ≠ 0 := + sharedFirstTensor_ne_zero_of_branch B ⟨0, hs⟩ (hB ⟨0, hs⟩) + apply χ.log_tag_of_integral_type_comparison q (sharedFirstTensor B) B χ.pX hT hB + intro counts _hcounts + simpa only [Fintype.card_eq_nat_card] using χ.integral_type_comparison B counts + +section Dependent + +variable {U V : Fin s → Type} [∀ a, Fintype (U a)] [∀ a, Fintype (V a)] + +/-- Branches may have different second- and third-leg dimensions. Padding +those spaces preserves their character values and the shared-input tensor. -/ +theorem Character.sharedFirstDependent_tag (χ : Character) + (q : FiniteLaw (Fin s)) (B : ∀ a, Tensor ℂ X (U a) (V a)) + (hB : ∀ a, B a ≠ 0) : + Real.exp (χ.pX * finiteEntropy q.mass) * + ∏ a, χ.value (B a) ^ q.mass a ≤ χ.value (sharedFirstDependentTensor B) := by + simpa only [χ.value_paddedSharedBranch, χ.value_sharedFirstTensor_padded] using + χ.sharedFirst_tag q (paddedSharedBranch B) + (fun a => paddedSharedBranch_ne_zero B a (hB a)) + +/-- The logarithmic tag inequality for branches with varying dimensions. -/ +theorem Character.log_sharedFirstDependent_tag (χ : Character) + (q : FiniteLaw (Fin s)) (B : ∀ a, Tensor ℂ X (U a) (V a)) + (hB : ∀ a, B a ≠ 0) : + χ.pX * finiteEntropy q.mass + ∑ a, q.mass a * Real.log (χ.value (B a)) ≤ + Real.log (χ.value (sharedFirstDependentTensor B)) := by + simpa only [χ.value_paddedSharedBranch, χ.value_sharedFirstTensor_padded] using + χ.log_sharedFirst_tag q (paddedSharedBranch B) + (fun a => paddedSharedBranch_ne_zero B a (hB a)) + +end Dependent + +end MatrixMultiplication.AuxiliarySeparation + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/Completion/Cardinality.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/Completion/Cardinality.lean new file mode 100644 index 0000000000000000000000000000000000000000..e7c3d0ef4eb8cf83e9a57845145ad42687ce1749 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/Completion/Cardinality.lean @@ -0,0 +1,128 @@ +import OAI.LinearAlgebra.MatrixMultiplication.Completion.Labels +import Mathlib.Data.Fintype.Sum +import Mathlib.Data.Fintype.BigOperators + +namespace OAI + +/-! Readable tensor completion and its finite arithmetic realization. -/ + +noncomputable section + +namespace MatrixMultiplication.CompletionCardinality + +open MatrixMultiplication.Foundation RecursiveCompletion CompletionLabels +attribute [local instance] Classical.propDecidable Classical.decEq + +universe uCoord +variable {X Y Z : Type uCoord} + +def conditionalCount [Fintype X] [Fintype Y] [Fintype Z] + (S : FlaggedTensor X Y Z) (c : Color) : ℕ := + Fintype.card {a : Leaf S // leafColor S a = c} + +private abbrev AllowedLeaf (S : FlaggedTensor X Y Z) (center output : Color) := + {a : Leaf S // leafColor S a = center ∨ leafColor S a = output} + +private def centerLeafEquiv (S : FlaggedTensor X Y Z) (center : Color) (m : ℕ) : + {a : Leaf (complete S center m) // + leafColor (complete S center m) a = center} ≃ + (Fin m → {a : Leaf S // leafColor S a = center}) := + (conditionalLeafEquiv S center center m).trans + ((Equiv.subtypeEquivRight (fun w => by simp [raisedFlag])).trans + Equiv.subtypePiEquivPi) + +private def noncenterLeafEquiv (S : FlaggedTensor X Y Z) (center output : Color) + (m : ℕ) (h : center ≠ output) : + {a : Leaf (complete S center m) // + leafColor (complete S center m) a = output} ≃ + {w : Fin m → AllowedLeaf S center output // + ¬ ∀ i, leafColor S (w i).val = center} := + (conditionalLeafEquiv S center output m).trans + { toFun := fun w => + ⟨fun i => ⟨w.val i, w.property.2 i⟩, by + intro hall + have hex : ∃ i, leafColor S (w.val i) = output := by + simpa only [raisedFlag, ite_eq_right h] using w.property.1 + obtain ⟨i, hi⟩ := hex + exact h ((hall i).symm.trans hi)⟩ + invFun := fun w => + ⟨fun i => (w.val i).val, by + constructor + · simp only [raisedFlag, ite_eq_right h] + by_contra hex + apply w.property + intro i + rcases (w.val i).property with hc | ho + · exact hc + · exact False.elim (hex ⟨i, ho⟩) + · exact fun i => (w.val i).property⟩ + left_inv := fun _ => Subtype.ext rfl + right_inv := fun _ => Subtype.ext rfl } + +private def allCenterEquiv (S : FlaggedTensor X Y Z) (center output : Color) + (m : ℕ) : + {w : Fin m → AllowedLeaf S center output // + ∀ i, leafColor S (w i).val = center} ≃ + (Fin m → {a : Leaf S // leafColor S a = center}) where + toFun w i := ⟨(w.val i).val, w.property i⟩ + invFun w := ⟨fun i => ⟨(w i).val, Or.inl (w i).property⟩, + fun i => (w i).property⟩ + left_inv _ := Subtype.ext rfl + right_inv _ := rfl + +variable [Fintype X] [Fintype Y] [Fintype Z] + +private theorem card_allowedLeaf (S : FlaggedTensor X Y Z) (center output : Color) + (h : center ≠ output) : + Fintype.card (AllowedLeaf S center output) = + conditionalCount S center + conditionalCount S output := by + apply Fintype.card_subtype_or_disjoint + exact Pi.disjoint_iff.mpr fun a => Prop.disjoint_iff.mpr + (fun ha => h (ha.1.symm.trans ha.2)) + +theorem count_complete_center (S : FlaggedTensor X Y Z) (center : Color) (m : ℕ) : + conditionalCount (complete S center m) center = conditionalCount S center ^ m := by + calc + conditionalCount (complete S center m) center = + Fintype.card (Fin m → {a : Leaf S // leafColor S a = center}) := + Fintype.card_congr (centerLeafEquiv S center m) + _ = conditionalCount S center ^ m := by simp [conditionalCount] + +theorem count_complete_noncenter (S : FlaggedTensor X Y Z) (center output : Color) + (m : ℕ) (h : center ≠ output) : + conditionalCount (complete S center m) output = + (conditionalCount S center + conditionalCount S output) ^ m - + conditionalCount S center ^ m := by + have hall : Fintype.card {w : Fin m → AllowedLeaf S center output // + ∀ i, leafColor S (w i).val = center} = conditionalCount S center ^ m := by + calc + _ = Fintype.card (Fin m → {a : Leaf S // leafColor S a = center}) := + Fintype.card_congr (allCenterEquiv S center output m) + _ = _ := by simp [conditionalCount] + calc + conditionalCount (complete S center m) output = + Fintype.card {w : Fin m → AllowedLeaf S center output // + ¬ ∀ i, leafColor S (w i).val = center} := + Fintype.card_congr (noncenterLeafEquiv S center output m h) + _ = Fintype.card (Fin m → AllowedLeaf S center output) - + Fintype.card {w : Fin m → AllowedLeaf S center output // + ∀ i, leafColor S (w i).val = center} := Fintype.card_subtype_compl _ + _ = (conditionalCount S center + conditionalCount S output) ^ m - + conditionalCount S center ^ m := by + rw [hall, Fintype.card_fun, Fintype.card_fin, card_allowedLeaf S center output h] + +theorem count_complete (S : FlaggedTensor X Y Z) (center : Color) (m : ℕ) (c : Color) : + conditionalCount (complete S center m) c = + if c = center then conditionalCount S center ^ m + else (conditionalCount S center + conditionalCount S c) ^ m - + conditionalCount S center ^ m := by + by_cases h : c = center + · subst c + simpa using count_complete_center S center m + · simpa [h] using count_complete_noncenter S center c m (Ne.symm h) + +end MatrixMultiplication.CompletionCardinality + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/Completion/CenterLaw.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/Completion/CenterLaw.lean new file mode 100644 index 0000000000000000000000000000000000000000..cde8b9aee86a398e1314c8f6aa9a0b5582ba0b21 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/Completion/CenterLaw.lean @@ -0,0 +1,148 @@ +import OAI.LinearAlgebra.MatrixMultiplication.Completion.ColorLaws + +namespace OAI + +/-! Readable tensor completion and its finite arithmetic realization. -/ + +noncomputable section + +universe uCoord + +namespace MatrixMultiplication.CompletionColorLaws + +open MatrixMultiplication.Foundation RecursiveCompletion CompletionLabels +open CompletionLaws CompletionProductLaws +open scoped BigOperators +attribute [local instance 10000] Classical.propDecidable Classical.decEq +attribute [local instance 11000] instDecidableEqFin + +variable {X Y Z : Type uCoord} [Fintype X] [Fintype Y] [Fintype Z] + +def centerWordEquiv (S : FlaggedTensor X Y Z) (center : Color) (m : ℕ) : + (Fin m → ColorSlice S center) ≃ + {w : Fin m → Leaf S // completionEvent S center center m w} where + toFun w := ⟨fun i => (w i).val, by + constructor + · simpa [raisedFlag] using (fun i => (w i).property) + · exact fun i => Or.inl (w i).property⟩ + invFun w := fun i => ⟨w.val i, by + have hall : ∀ j, leafColor S (w.val j) = center := by + simpa [raisedFlag] using w.property.1 + exact hall i⟩ + left_inv w := by + funext i + apply Subtype.ext + rfl + right_inv w := by + apply Subtype.ext + rfl + +def centerCompletionEquiv (S : FlaggedTensor X Y Z) (center : Color) (m : ℕ) : + (Fin m → ColorSlice S center) ≃ ColorSlice (complete S center m) center := + (centerWordEquiv S center m).trans (conditionalLeafEquiv S center center m).symm + +omit [Fintype X] [Fintype Y] [Fintype Z] in +theorem centerCompletionEquiv_slots (S : FlaggedTensor X Y Z) (center : Color) + (m : ℕ) (w : Fin m → ColorSlice S center) : + slot S center m ((centerCompletionEquiv S center m) w).val = + fun i => (w i).val := by + funext i + apply Subtype.ext + rfl + +def centerCompletionLaw (S : FlaggedTensor X Y Z) (center : Color) + (p : FiniteLaw (ColorSlice S center)) (m : ℕ) : + FiniteLaw (ColorSlice (complete S center m) center) := + transport (centerCompletionEquiv S center m) + (independentProduct (fun _ : Fin m => p)) + +theorem centerCompletionLaw_mass (S : FlaggedTensor X Y Z) (center : Color) + (p : FiniteLaw (ColorSlice S center)) (m : ℕ) (w : Fin m → ColorSlice S center) : + (centerCompletionLaw S center p m).mass ((centerCompletionEquiv S center m) w) = + ∏ i, p.mass (w i) := + transport_mass (centerCompletionEquiv S center m) _ w + +theorem centerCompletionLaw_entropy (S : FlaggedTensor X Y Z) (center : Color) + (p : FiniteLaw (ColorSlice S center)) (m : ℕ) : + finiteEntropy (centerCompletionLaw S center p m).mass = + (m : ℝ) * finiteEntropy p.mass := by + rw [centerCompletionLaw, transport_entropy, independentProduct_entropy] + simp only [Finset.sum_const, Finset.card_univ, Fintype.card_fin, nsmul_eq_mul] + +theorem centerCompletionLaw_map_mass {B : Type*} [Fintype B] + (S : FlaggedTensor X Y Z) (center : Color) + (p : FiniteLaw (ColorSlice S center)) (m : ℕ) (f : Leaf S → B) (y : Fin m → B) : + ((centerCompletionLaw S center p m).map + (fun a i => f (slot S center m a.val i))).mass y = + ∏ i, (p.map (fun a => f a.val)).mass (y i) := by + rw [FiniteLaw.map_mass] + calc + (∑ a, if (fun i => f (slot S center m a.val i)) = y then + (centerCompletionLaw S center p m).mass a else 0) = + ∑ w : Fin m → ColorSlice S center, + if (fun i => f (w i).val) = y then ∏ i, p.mass (w i) else 0 := by + rw [← (centerCompletionEquiv S center m).sum_comp + (fun a => if (fun i => f (slot S center m a.val i)) = y then + (centerCompletionLaw S center p m).mass a else 0)] + simp only [centerCompletionEquiv_slots, centerCompletionLaw_mass] + _ = _ := by + simpa only [FiniteLaw.map_mass, independentProduct_mass] using + independentProduct_map_mass (fun _ : Fin m => p) + (fun _ a => f a.val) y + +theorem completionEvent_same_zero_mass (S : FlaggedTensor X Y Z) (center : Color) + (p : FiniteLaw (ColorSlice S center)) (m : ℕ) : + eventMass (iidColorLaw S center center p p m 0 (by norm_num) (by norm_num)) + (completionEvent S center center m) = 1 := by + unfold eventMass + rw [← (centerWordEquiv S center m).sum_comp + (fun w => (iidColorLaw S center center p p m 0 (by norm_num) (by norm_num)).mass w.val)] + calc + _ = ∑ w : Fin m → ColorSlice S center, + (independentProduct (fun _ : Fin m => p)).mass w := by + apply Finset.sum_congr rfl + intro w _ + change (∏ i, (colorMix S center center p p 0 (by norm_num) (by norm_num)).mass + (w i).val) = ∏ i, p.mass (w i) + apply Finset.prod_congr rfl + intro i _ + rw [colorMix_mass] + simp only [zero_mul, sub_zero, one_mul, zero_add] + exact p.map_mass_apply Subtype.val Subtype.val_injective (w i) + _ = 1 := (independentProduct (fun _ : Fin m => p)).total + +theorem conditionalCompletionLaw_same_zero_mass + (S : FlaggedTensor X Y Z) (center : Color) + (p : FiniteLaw (ColorSlice S center)) (m : ℕ) (hm : 0 < m) + (w : Fin m → ColorSlice S center) : + (conditionalCompletionLaw S center center p p m hm 0 (by norm_num) (by norm_num)).mass + ((centerCompletionEquiv S center m) w) = ∏ i, p.mass (w i) := by + rw [conditionalCompletionLaw_mass, completionEvent_same_zero_mass, div_one, + centerCompletionEquiv_slots] + change (∏ i, (colorMix S center center p p 0 (by norm_num) (by norm_num)).mass + (w i).val) = ∏ i, p.mass (w i) + apply Finset.prod_congr rfl + intro i _ + rw [colorMix_mass] + simp only [zero_mul, sub_zero, one_mul, zero_add] + exact p.map_mass_apply Subtype.val Subtype.val_injective (w i) + +theorem conditionalCompletionLaw_same_zero_entropy + (S : FlaggedTensor X Y Z) (center : Color) + (p : FiniteLaw (ColorSlice S center)) (m : ℕ) (hm : 0 < m) : + finiteEntropy + (conditionalCompletionLaw S center center p p m hm 0 (by norm_num) (by norm_num)).mass = + (m : ℝ) * finiteEntropy p.mass := by + have hmass : + (conditionalCompletionLaw S center center p p m hm 0 (by norm_num) (by norm_num)).mass = + (centerCompletionLaw S center p m).mass := by + funext a + obtain ⟨w, rfl⟩ := (centerCompletionEquiv S center m).surjective a + rw [conditionalCompletionLaw_same_zero_mass, centerCompletionLaw_mass] + rw [hmass, centerCompletionLaw_entropy] + +end MatrixMultiplication.CompletionColorLaws + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/Completion/ColorEntropy.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/Completion/ColorEntropy.lean new file mode 100644 index 0000000000000000000000000000000000000000..fc479e87fe1d283837c1afeaec27d140d68e049b --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/Completion/ColorEntropy.lean @@ -0,0 +1,69 @@ +import OAI.LinearAlgebra.MatrixMultiplication.Completion.ColorLaws + +namespace OAI + +/-! Readable tensor completion and its finite arithmetic realization. -/ + +noncomputable section + +universe uCoord + +namespace MatrixMultiplication.CompletionColorLaws + +open MatrixMultiplication.Foundation RecursiveCompletion CompletionLabels +open scoped BigOperators +attribute [local instance 10000] Classical.propDecidable Classical.decEq +attribute [local instance 11000] instDecidableEqFin + +theorem finiteEntropy_scale {A : Type*} [Fintype A] (p : FiniteLaw A) (r : ℝ) : + finiteEntropy (fun a => r * p.mass a) = + entropyTerm r + r * finiteEntropy p.mass := by + simp only [finiteEntropy, entropyTerm_mul, Finset.sum_add_distrib, + ← Finset.sum_mul, ← Finset.mul_sum, p.total, one_mul] + +variable {X Y Z : Type uCoord} [Fintype X] [Fintype Y] [Fintype Z] + +theorem colorMix_entropy (S : FlaggedTensor X Y Z) (center output : Color) + (hne : center ≠ output) + (pc : FiniteLaw (ColorSlice S center)) (po : FiniteLaw (ColorSlice S output)) + (α : ℝ) (hα : 0 ≤ α) (hα' : α ≤ 1) : + finiteEntropy (colorMix S center output pc po α hα hα').mass = + entropyTerm α + entropyTerm (1 - α) + + α * finiteEntropy pc.mass + (1 - α) * finiteEntropy po.mass := by + have hterm (a : Leaf S) : + entropyTerm ((colorMix S center output pc po α hα hα').mass a) = + entropyTerm (α * (pc.map Subtype.val).mass a) + + entropyTerm ((1 - α) * (po.map Subtype.val).mass a) := by + by_cases hc : leafColor S a = center + · have ho : leafColor S a ≠ output := fun ho => hne (hc.symm.trans ho) + rw [colorMix_mass, colorSlice_map_mass_zero S output po a ho] + simp + · rw [colorMix_mass, colorSlice_map_mass_zero S center pc a hc] + simp + calc + finiteEntropy (colorMix S center output pc po α hα hα').mass = + finiteEntropy (fun a => α * (pc.map Subtype.val).mass a) + + finiteEntropy (fun a => (1 - α) * (po.map Subtype.val).mass a) := by + simp only [finiteEntropy, hterm, Finset.sum_add_distrib] + _ = _ := by + rw [finiteEntropy_scale, finiteEntropy_scale, + pc.map_entropy_of_injective Subtype.val Subtype.val_injective, + po.map_entropy_of_injective Subtype.val Subtype.val_injective] + ring + +theorem iidColorLaw_entropy (S : FlaggedTensor X Y Z) (center output : Color) + (hne : center ≠ output) + (pc : FiniteLaw (ColorSlice S center)) (po : FiniteLaw (ColorSlice S output)) + (m : ℕ) (α : ℝ) (hα : 0 ≤ α) (hα' : α ≤ 1) : + finiteEntropy (iidColorLaw S center output pc po m α hα hα').mass = + (m : ℝ) * (entropyTerm α + entropyTerm (1 - α) + + α * finiteEntropy pc.mass + (1 - α) * finiteEntropy po.mass) := by + rw [iidColorLaw, CompletionProductLaws.independentProduct_entropy] + simp only [colorMix_entropy S center output hne pc po α hα hα', + Finset.sum_const, Finset.card_univ, Fintype.card_fin, nsmul_eq_mul] + +end MatrixMultiplication.CompletionColorLaws + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/Completion/ColorLaws.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/Completion/ColorLaws.lean new file mode 100644 index 0000000000000000000000000000000000000000..76d1470f4db5f61ebc2f0f404799de5659ff3e7e --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/Completion/ColorLaws.lean @@ -0,0 +1,186 @@ +import OAI.LinearAlgebra.MatrixMultiplication.Completion.ProductLaws +import OAI.LinearAlgebra.MatrixMultiplication.Completion.Conditioning +import OAI.LinearAlgebra.MatrixMultiplication.Completion.Labels + +namespace OAI + +/-! Readable tensor completion and its finite arithmetic realization. -/ + +noncomputable section + +universe uCoord + +namespace MatrixMultiplication.CompletionColorLaws + +open MatrixMultiplication.Foundation RecursiveCompletion CompletionLabels +open CompletionLaws CompletionProductLaws +open scoped BigOperators +attribute [local instance 10000] Classical.propDecidable Classical.decEq +attribute [local instance 11000] instDecidableEqFin + +variable {X Y Z : Type uCoord} [Fintype X] [Fintype Y] [Fintype Z] + +abbrev ColorSlice (S : FlaggedTensor X Y Z) (c : Color) := + {a : Leaf S // leafColor S a = c} + +def colorMix (S : FlaggedTensor X Y Z) (center output : Color) + (pc : FiniteLaw (ColorSlice S center)) (po : FiniteLaw (ColorSlice S output)) + (α : ℝ) (hα : 0 ≤ α) (hα' : α ≤ 1) : FiniteLaw (Leaf S) where + mass a := α * (pc.map Subtype.val).mass a + (1 - α) * (po.map Subtype.val).mass a + nonneg a := add_nonneg (mul_nonneg hα ((pc.map Subtype.val).nonneg a)) + (mul_nonneg (sub_nonneg.mpr hα') ((po.map Subtype.val).nonneg a)) + total := by + rw [Finset.sum_add_distrib, ← Finset.mul_sum, ← Finset.mul_sum, + (pc.map Subtype.val).total, (po.map Subtype.val).total] + ring + +theorem colorMix_mass (S : FlaggedTensor X Y Z) (center output : Color) + (pc : FiniteLaw (ColorSlice S center)) (po : FiniteLaw (ColorSlice S output)) + (α : ℝ) (hα : 0 ≤ α) (hα' : α ≤ 1) (a : Leaf S) : + (colorMix S center output pc po α hα hα').mass a = + α * (pc.map Subtype.val).mass a + (1 - α) * (po.map Subtype.val).mass a := rfl + +theorem colorMix_map_mass {B : Type*} [Fintype B] + (S : FlaggedTensor X Y Z) (center output : Color) + (pc : FiniteLaw (ColorSlice S center)) (po : FiniteLaw (ColorSlice S output)) + (α : ℝ) (hα : 0 ≤ α) (hα' : α ≤ 1) (f : Leaf S → B) (b : B) : + ((colorMix S center output pc po α hα hα').map f).mass b = + α * ((pc.map Subtype.val).map f).mass b + + (1 - α) * ((po.map Subtype.val).map f).mass b := by + rw [FiniteLaw.map_mass] + simp only [colorMix_mass] + calc + _ = ∑ a, (α * (if f a = b then (pc.map Subtype.val).mass a else 0) + + (1 - α) * (if f a = b then (po.map Subtype.val).mass a else 0)) := by + apply Finset.sum_congr rfl + intro a _ + split_ifs <;> simp + _ = _ := by + rw [Finset.sum_add_distrib, ← Finset.mul_sum, ← Finset.mul_sum, + FiniteLaw.map_mass (pc.map Subtype.val) f b, + FiniteLaw.map_mass (po.map Subtype.val) f b] + +theorem colorSlice_map_mass_zero (S : FlaggedTensor X Y Z) (c : Color) + (p : FiniteLaw (ColorSlice S c)) (a : Leaf S) (ha : leafColor S a ≠ c) : + (p.map Subtype.val).mass a = 0 := by + rw [FiniteLaw.map_mass] + apply Finset.sum_eq_zero + intro b _ + apply ite_eq_right + intro hb + exact ha ((congrArg (leafColor S) hb).symm.trans b.property) + +theorem colorMix_mass_zero (S : FlaggedTensor X Y Z) (center output : Color) + (pc : FiniteLaw (ColorSlice S center)) (po : FiniteLaw (ColorSlice S output)) + (α : ℝ) (hα : 0 ≤ α) (hα' : α ≤ 1) (a : Leaf S) + (hc : leafColor S a ≠ center) (ho : leafColor S a ≠ output) : + (colorMix S center output pc po α hα hα').mass a = 0 := by + rw [colorMix_mass, colorSlice_map_mass_zero S center pc a hc, + colorSlice_map_mass_zero S output po a ho] + ring + +theorem colorMix_center_mass (S : FlaggedTensor X Y Z) (center output : Color) + (hne : center ≠ output) + (pc : FiniteLaw (ColorSlice S center)) (po : FiniteLaw (ColorSlice S output)) + (α : ℝ) (hα : 0 ≤ α) (hα' : α ≤ 1) (a : ColorSlice S center) : + (colorMix S center output pc po α hα hα').mass a.val = α * pc.mass a := by + rw [colorMix_mass, pc.map_mass_apply Subtype.val Subtype.val_injective, + colorSlice_map_mass_zero S output po a.val (by simpa only [a.property] using hne)] + ring + +theorem colorMix_output_mass (S : FlaggedTensor X Y Z) (center output : Color) + (hne : center ≠ output) + (pc : FiniteLaw (ColorSlice S center)) (po : FiniteLaw (ColorSlice S output)) + (α : ℝ) (hα : 0 ≤ α) (hα' : α ≤ 1) (a : ColorSlice S output) : + (colorMix S center output pc po α hα hα').mass a.val = (1 - α) * po.mass a := by + rw [colorMix_mass, po.map_mass_apply Subtype.val Subtype.val_injective, + colorSlice_map_mass_zero S center pc a.val (by simpa only [a.property] using hne.symm)] + ring + +theorem exists_mass_pos {A : Type*} [Fintype A] (p : FiniteLaw A) : + ∃ a, 0 < p.mass a := by + by_contra h + have hz : ∀ a, p.mass a = 0 := by + intro a + exact le_antisymm (le_of_not_gt (fun ha => h ⟨a, ha⟩)) (p.nonneg a) + have ht := p.total + simp only [hz, Finset.sum_const_zero] at ht + exact zero_ne_one ht + +theorem colorMix_output_mass_pos (S : FlaggedTensor X Y Z) (center output : Color) + (pc : FiniteLaw (ColorSlice S center)) (po : FiniteLaw (ColorSlice S output)) + (α : ℝ) (hα : 0 ≤ α) (hα' : α < 1) (a : ColorSlice S output) + (ha : 0 < po.mass a) : + 0 < (colorMix S center output pc po α hα hα'.le).mass a.val := by + rw [colorMix_mass, po.map_mass_apply Subtype.val Subtype.val_injective] + exact add_pos_of_nonneg_of_pos + (mul_nonneg hα ((pc.map Subtype.val).nonneg a.val)) + (mul_pos (sub_pos.mpr hα') ha) + +abbrev completionEvent (S : FlaggedTensor X Y Z) (center output : Color) (m : ℕ) + (w : Fin m → Leaf S) : Prop := + raisedFlag center output (fun i => leafColor S (w i) = output) ∧ + ∀ i, leafColor S (w i) = center ∨ leafColor S (w i) = output + +omit [Fintype X] [Fintype Y] [Fintype Z] in +theorem completionEvent_constant (S : FlaggedTensor X Y Z) (center output : Color) + (m : ℕ) (hm : 0 < m) (a : ColorSlice S output) : + completionEvent S center output m (fun _ => a.val) := by + constructor + · by_cases h : center = output + · simp [raisedFlag, h, a.property] + · simpa only [raisedFlag, ite_eq_right h] using + (show ∃ _i : Fin m, leafColor S a.val = output from ⟨⟨0, hm⟩, a.property⟩) + · exact fun _ => Or.inr a.property + +def iidColorLaw (S : FlaggedTensor X Y Z) (center output : Color) + (pc : FiniteLaw (ColorSlice S center)) (po : FiniteLaw (ColorSlice S output)) + (m : ℕ) (α : ℝ) (hα : 0 ≤ α) (hα' : α ≤ 1) : + FiniteLaw (Fin m → Leaf S) := + independentProduct (I := Fin m) (A := fun _ => Leaf S) + (fun _ : Fin m => colorMix S center output pc po α hα hα') + +theorem completionEvent_mass_pos (S : FlaggedTensor X Y Z) (center output : Color) + (pc : FiniteLaw (ColorSlice S center)) (po : FiniteLaw (ColorSlice S output)) + (m : ℕ) (hm : 0 < m) (α : ℝ) (hα : 0 ≤ α) (hα' : α < 1) : + 0 < eventMass (iidColorLaw S center output pc po m α hα hα'.le) + (completionEvent S center output m) := by + obtain ⟨a, ha⟩ := exists_mass_pos po + let w : {w : Fin m → Leaf S // completionEvent S center output m w} := + ⟨fun _ => a.val, completionEvent_constant S center output m hm a⟩ + have hw : 0 < (iidColorLaw S center output pc po m α hα hα'.le).mass w.val := by + change 0 < ∏ _i : Fin m, (colorMix S center output pc po α hα hα'.le).mass a.val + exact Finset.prod_pos fun _ _ => colorMix_output_mass_pos S center output pc po α hα hα' a ha + exact lt_of_lt_of_le hw (Finset.single_le_sum + (fun v _ => (iidColorLaw S center output pc po m α hα hα'.le).nonneg v.val) + (Finset.mem_univ w)) + +def conditionalCompletionLaw (S : FlaggedTensor X Y Z) (center output : Color) + (pc : FiniteLaw (ColorSlice S center)) (po : FiniteLaw (ColorSlice S output)) + (m : ℕ) (hm : 0 < m) (α : ℝ) (hα : 0 ≤ α) (hα' : α < 1) : + FiniteLaw (ColorSlice (complete S center m) output) := + transport (conditionalLeafEquiv S center output m).symm + (condition (iidColorLaw S center output pc po m α hα hα'.le) + (completionEvent S center output m) + (completionEvent_mass_pos S center output pc po m hm α hα hα')) + +theorem conditionalCompletionLaw_mass + (S : FlaggedTensor X Y Z) (center output : Color) + (pc : FiniteLaw (ColorSlice S center)) (po : FiniteLaw (ColorSlice S output)) + (m : ℕ) (hm : 0 < m) (α : ℝ) (hα : 0 ≤ α) (hα' : α < 1) + (a : ColorSlice (complete S center m) output) : + (conditionalCompletionLaw S center output pc po m hm α hα hα').mass a = + (iidColorLaw S center output pc po m α hα hα'.le).mass (slot S center m a.val) / + eventMass (iidColorLaw S center output pc po m α hα hα'.le) + (completionEvent S center output m) := by + let e := conditionalLeafEquiv S center output m + have he : e.symm (e a) = a := e.symm_apply_apply a + conv_lhs => rw [← he] + rw [conditionalCompletionLaw, transport_mass, condition_mass] + rfl + +end MatrixMultiplication.CompletionColorLaws + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/Completion/Conditioning.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/Completion/Conditioning.lean new file mode 100644 index 0000000000000000000000000000000000000000..e51c83ac5385d19005b8e8e4fe316eef9e187577 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/Completion/Conditioning.lean @@ -0,0 +1,101 @@ +import OAI.LinearAlgebra.MatrixMultiplication.Completion.Laws + +namespace OAI + +/-! Readable tensor completion and its finite arithmetic realization. -/ + +noncomputable section + +namespace MatrixMultiplication.CompletionLaws + +open MatrixMultiplication.Foundation +open scoped BigOperators +attribute [local instance] Classical.propDecidable Classical.decEq + +variable {A X : Type*} [Fintype A] [Fintype X] + +theorem sum_subtype_indicator (P : A → Prop) (f : A → ℝ) : + (∑ a : {a // P a}, f a.val) = ∑ a, if P a then f a else 0 := by + rw [← Finset.sum_filter] + exact (Finset.sum_subtype _ (by simp) f).symm + +def eventMass (p : FiniteLaw A) (P : A → Prop) : ℝ := + ∑ a : {a // P a}, p.mass a.val + +theorem eventMass_nonneg (p : FiniteLaw A) (P : A → Prop) : 0 ≤ eventMass p P := + Finset.sum_nonneg fun a _ => p.nonneg a.val + +def condition (p : FiniteLaw A) (P : A → Prop) (h : 0 < eventMass p P) : + FiniteLaw {a // P a} where + mass a := p.mass a.val / eventMass p P + nonneg a := div_nonneg (p.nonneg a.val) h.le + total := by rw [← Finset.sum_div]; exact div_self h.ne' + +theorem condition_mass (p : FiniteLaw A) (P : A → Prop) + (h : 0 < eventMass p P) (a : {a // P a}) : + (condition p P h).mass a = p.mass a.val / eventMass p P := rfl + +theorem condition_coordinate_mass (p : FiniteLaw A) (f : A → X) (Q : X → Prop) + (h : 0 < eventMass p (fun a => Q (f a))) (x : X) : + ((condition p (fun a => Q (f a)) h).map (fun a => f a.val)).mass x = + if Q x then (p.map f).mass x / eventMass p (fun a => Q (f a)) else 0 := by + rw [FiniteLaw.map_mass] + simp only [condition_mass] + have hsum : + (∑ a : {a // Q (f a)}, if f a.val = x then + p.mass a.val / eventMass p (fun a => Q (f a)) else 0) = + ∑ a, if Q (f a) then + (if f a = x then p.mass a / eventMass p (fun a => Q (f a)) else 0) else 0 := + sum_subtype_indicator (fun a => Q (f a)) + (fun a => if f a = x then p.mass a / eventMass p (fun a => Q (f a)) else 0) + rw [hsum] + by_cases hx : Q x + · rw [ite_eq_left hx, FiniteLaw.map_mass, Finset.sum_div] + apply Finset.sum_congr rfl + intro a _ + by_cases ha : f a = x + · simp [ha, hx] + · simp [ha] + · rw [ite_eq_right hx] + apply Finset.sum_eq_zero + intro a _ + by_cases ha : f a = x + · simp [ha, hx] + · simp [ha] + +theorem eventMass_coordinate (p : FiniteLaw A) (f : A → X) (Q : X → Prop) : + eventMass p (fun a => Q (f a)) = eventMass (p.map f) Q := by + rw [eventMass, eventMass, sum_subtype_indicator, sum_subtype_indicator] + simp only [FiniteLaw.map_mass] + calc + (∑ a, if Q (f a) then p.mass a else 0) = + ∑ a, ∑ x, if Q x then (if f a = x then p.mass a else 0) else 0 := by + apply Finset.sum_congr rfl + intro a _ + rw [Finset.sum_eq_single (f a)] + · simp + · intro x _ hne + simp [Ne.symm hne] + · simp + _ = ∑ x, ∑ a, if Q x then (if f a = x then p.mass a else 0) else 0 := + Finset.sum_comm + _ = ∑ x, if Q x then ∑ a, if f a = x then p.mass a else 0 else 0 := by + apply Finset.sum_congr rfl + intro x _ + split_ifs <;> simp + +def transport {B : Type*} [Fintype B] (e : A ≃ B) (p : FiniteLaw A) : FiniteLaw B := + p.map e + +theorem transport_mass {B : Type*} [Fintype B] (e : A ≃ B) (p : FiniteLaw A) (a : A) : + (transport e p).mass (e a) = p.mass a := p.map_mass_apply e e.injective a + +theorem transport_entropy {B : Type*} [Fintype B] (e : A ≃ B) (p : FiniteLaw A) : + finiteEntropy (transport e p).mass = finiteEntropy p.mass := + p.map_entropy_of_injective e e.injective + +end MatrixMultiplication.CompletionLaws + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/Completion/Entropy.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/Completion/Entropy.lean new file mode 100644 index 0000000000000000000000000000000000000000..1ffb4bad70152786b7163537ef918aff25debdf0 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/Completion/Entropy.lean @@ -0,0 +1,94 @@ +import OAI.LinearAlgebra.MatrixMultiplication.Completion.Conditioning + +namespace OAI + +/-! Readable tensor completion and its finite arithmetic realization. -/ + +noncomputable section + +namespace MatrixMultiplication.CompletionLaws + +open MatrixMultiplication.Foundation +open scoped BigOperators +attribute [local instance 10000] Classical.propDecidable Classical.decEq + +variable {A : Type*} [Fintype A] + +theorem entropy_scaled_law (p : FiniteLaw A) (s : ℝ) : + finiteEntropy (fun a => s * p.mass a) = entropyTerm s + s * finiteEntropy p.mass := by + simp only [finiteEntropy, entropyTerm_mul, Finset.sum_add_distrib, + ← Finset.sum_mul, ← Finset.mul_sum, p.total, one_mul] + +theorem mass_eq_event_mul_condition (p : FiniteLaw A) (P : A → Prop) + (h : 0 < eventMass p P) (a : {a // P a}) : + p.mass a.val = eventMass p P * (condition p P h).mass a := by + rw [condition_mass, mul_div_cancel₀ _ h.ne'] + +theorem event_entropy (p : FiniteLaw A) (P : A → Prop) + (h : 0 < eventMass p P) : + (∑ a : {a // P a}, entropyTerm (p.mass a.val)) = + entropyTerm (eventMass p P) + eventMass p P * finiteEntropy (condition p P h).mass := by + conv_lhs => enter [2, a]; rw [mass_eq_event_mul_condition p P h a] + exact entropy_scaled_law (condition p P h) (eventMass p P) + +theorem condition_entropy_mul (p : FiniteLaw A) (P : A → Prop) + (h : 0 < eventMass p P) : + eventMass p P * finiteEntropy (condition p P h).mass = + (∑ a : {a // P a}, entropyTerm (p.mass a.val)) - entropyTerm (eventMass p P) := by + linarith [event_entropy p P h] + +theorem eventMass_add_complement (p : FiniteLaw A) (P : A → Prop) : + eventMass p P + eventMass p (fun a => ¬ P a) = 1 := by + rw [eventMass, eventMass, sum_subtype_indicator, sum_subtype_indicator, + ← Finset.sum_add_distrib] + calc + (∑ a, ((if P a then p.mass a else 0) + (if ¬ P a then p.mass a else 0))) = + ∑ a, p.mass a := by + apply Finset.sum_congr rfl + intro a _ + by_cases h : P a <;> simp [h] + _ = _ := p.total + +theorem entropy_sum_event_complement (p : FiniteLaw A) (P : A → Prop) : + (∑ a : {a // P a}, entropyTerm (p.mass a.val)) + + (∑ a : {a // ¬ P a}, entropyTerm (p.mass a.val)) = finiteEntropy p.mass := by + rw [sum_subtype_indicator P (fun a => entropyTerm (p.mass a)), + sum_subtype_indicator (fun a => ¬ P a) (fun a => entropyTerm (p.mass a)), + ← Finset.sum_add_distrib] + apply Finset.sum_congr rfl + intro a _ + by_cases h : P a <;> simp [h] + +theorem entropy_event_split (p : FiniteLaw A) (P : A → Prop) + (hP : 0 < eventMass p P) (hQ : 0 < eventMass p (fun a => ¬ P a)) : + finiteEntropy p.mass = + entropyTerm (eventMass p P) + entropyTerm (eventMass p (fun a => ¬ P a)) + + eventMass p P * finiteEntropy (condition p P hP).mass + + eventMass p (fun a => ¬ P a) * finiteEntropy (condition p (fun a => ¬ P a) hQ).mass := by + rw [← entropy_sum_event_complement p P, event_entropy p P hP, + event_entropy p (fun a => ¬ P a) hQ] + ring + +theorem condition_entropy_of_removed_event (p : FiniteLaw A) (P : A → Prop) + (hP : 0 < eventMass p P) (removedMass removedEntropy : ℝ) + (hmass : eventMass p (fun a => ¬ P a) = removedMass) + (hremoved : (∑ a : {a // ¬ P a}, entropyTerm (p.mass a.val)) = + entropyTerm removedMass + removedMass * removedEntropy) : + finiteEntropy (condition p P hP).mass = + (finiteEntropy p.mass - entropyTerm removedMass - + entropyTerm (1 - removedMass) - removedMass * removedEntropy) / + (1 - removedMass) := by + have hevent : eventMass p P = 1 - removedMass := by + linarith [eventMass_add_complement p P] + have hsum := entropy_sum_event_complement p P + have hc := condition_entropy_mul p P hP + rw [hremoved] at hsum + rw [hevent] at hc + apply (eq_div_iff (by linarith : 1 - removedMass ≠ 0)).mpr + nlinarith + +end MatrixMultiplication.CompletionLaws + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/Completion/EntropyAlgebra.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/Completion/EntropyAlgebra.lean new file mode 100644 index 0000000000000000000000000000000000000000..12cc07825caa88f1c277b10c47e3d90743cec17e --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/Completion/EntropyAlgebra.lean @@ -0,0 +1,131 @@ +import OAI.LinearAlgebra.MatrixMultiplication.Entropy.ComplexEntropyContinuity +import Mathlib.Analysis.SpecialFunctions.Exp + +namespace OAI + +/-! Readable tensor completion and its finite arithmetic realization. -/ + +noncomputable section + +namespace MatrixMultiplication.CompletionEntropyAlgebra + +open MatrixMultiplication.Foundation + +def binaryEntropy (a : ℝ) : ℝ := entropyTerm a + entropyTerm (1 - a) + +def conditionalMixEntropy (a : ℝ) (m : ℕ) (Hc Ho : ℝ) : ℝ := + ((m : ℝ) * (binaryEntropy a + a * Hc + (1 - a) * Ho) - + binaryEntropy (a ^ m) - a ^ m * ((m : ℝ) * Hc)) / (1 - a ^ m) + +theorem conditionalMixEntropy_eq_split (a : ℝ) (m : ℕ) (Hc Ho : ℝ) + (hden : 1 - a ^ m ≠ 0) : + conditionalMixEntropy a m Hc Ho = + ((m : ℝ) * (binaryEntropy a + a * Hc + (1 - a) * Ho) - + entropyTerm (a ^ m) - a ^ m * ((m : ℝ) * Hc)) / (1 - a ^ m) + + Real.log (1 - a ^ m) := by + dsimp [conditionalMixEntropy, binaryEntropy, entropyTerm] + field_simp + ring + +private theorem conditionalMixEntropy_cancel + (a C O L hc ho : ℝ) (m : ℕ) + (hden : 1 - a ^ m ≠ 0) + (hcLog : Real.log a = C - L) + (hoLog : Real.log (1 - a) = O - L) : + conditionalMixEntropy a m (C + hc) (O + ho) = + m * L + Real.log (1 - a ^ m) + + m * ((a - a ^ m) / (1 - a ^ m) * hc + + (1 - a) / (1 - a ^ m) * ho) := by + dsimp [conditionalMixEntropy, binaryEntropy, entropyTerm] + rw [Real.log_pow, hcLog, hoLog] + field_simp + ring + +private theorem ratio_range (x y : ℝ) (hx : 0 < x) (hy : 0 < y) : + 0 < x / (x + y) ∧ x / (x + y) < 1 := by + have hs : 0 < x + y := add_pos hx hy + exact ⟨div_pos hx hs, (div_lt_one hs).mpr (by linarith)⟩ + +private theorem ratio_complement (x y : ℝ) (h : x + y ≠ 0) : + 1 - x / (x + y) = y / (x + y) := by + field_simp + exact add_sub_cancel_left x y + +theorem binaryEntropy_cardinal_mixture (np nq : ℝ) (hnp : 0 < np) (hnq : 0 < nq) : + let a := np / (np + nq) + binaryEntropy a + a * Real.log np + (1 - a) * Real.log nq = + Real.log (np + nq) := by + let a := np / (np + nq) + have hs : 0 < np + nq := add_pos hnp hnq + have hcLog : Real.log a = Real.log np - Real.log (np + nq) := + Real.log_div hnp.ne' hs.ne' + have hoLog : Real.log (1 - a) = Real.log nq - Real.log (np + nq) := by + rw [show 1 - a = nq / (np + nq) from ratio_complement np nq hs.ne', + Real.log_div hnq.ne' hs.ne'] + change binaryEntropy a + a * Real.log np + (1 - a) * Real.log nq = _ + dsimp [binaryEntropy, entropyTerm] + rw [hcLog, hoLog] + ring + +theorem conditionalMixEntropy_incident + (np nq hc ho : ℝ) (m : ℕ) + (hnp : 0 < np) (hnq : 0 < nq) (hm : 0 < m) : + let a := np / (np + nq) + conditionalMixEntropy a m (Real.log np + hc) (Real.log nq + ho) - + Real.log ((np + nq) ^ m - np ^ m) = + m * ((a - a ^ m) / (1 - a ^ m) * hc + + (1 - a) / (1 - a ^ m) * ho) := by + let a := np / (np + nq) + change conditionalMixEntropy a m (Real.log np + hc) (Real.log nq + ho) - + Real.log ((np + nq) ^ m - np ^ m) = _ + have hs : 0 < np + nq := add_pos hnp hnq + have ha : 0 < a ∧ a < 1 := ratio_range np nq hnp hnq + have hden : 0 < 1 - a ^ m := + sub_pos.mpr (pow_lt_one₀ ha.1.le ha.2 (Nat.ne_of_gt hm)) + have hcLog : Real.log a = Real.log np - Real.log (np + nq) := + Real.log_div hnp.ne' hs.ne' + have hoLog : Real.log (1 - a) = Real.log nq - Real.log (np + nq) := by + rw [show 1 - a = nq / (np + nq) from ratio_complement np nq hs.ne', + Real.log_div hnq.ne' hs.ne'] + have hfactor : (np + nq) ^ m - np ^ m = + (np + nq) ^ m * (1 - a ^ m) := by + dsimp [a] + rw [div_pow] + field_simp + have hlog : Real.log ((np + nq) ^ m - np ^ m) = + m * Real.log (np + nq) + Real.log (1 - a ^ m) := by + rw [hfactor, Real.log_mul (pow_ne_zero _ hs.ne') hden.ne', Real.log_pow] + rw [conditionalMixEntropy_cancel a (Real.log np) (Real.log nq) + (Real.log (np + nq)) hc ho m hden.ne' hcLog hoLog, hlog] + ring + +theorem conditionalMixEntropy_gibbs (q hc ho : ℝ) (m : ℕ) (hm : 0 < m) : + conditionalMixEntropy (Real.exp hc / (Real.exp hc + Real.exp ho)) m + (Real.log q + hc) (Real.log q + ho) - m * Real.log q = + Real.log ((Real.exp hc + Real.exp ho) ^ m - Real.exp ((m : ℝ) * hc)) := by + let a := Real.exp hc / (Real.exp hc + Real.exp ho) + have ha : 0 < a ∧ a < 1 := ratio_range _ _ (Real.exp_pos hc) (Real.exp_pos ho) + have hden : 1 - a ^ m ≠ 0 := + (sub_pos.mpr (pow_lt_one₀ ha.1.le ha.2 (Nat.ne_of_gt hm))).ne' + have hmean : m * ((a - a ^ m) / (1 - a ^ m) * Real.log q + + (1 - a) / (1 - a ^ m) * Real.log q) = m * Real.log q := by + field_simp + ring + have h := conditionalMixEntropy_incident (Real.exp hc) (Real.exp ho) + (Real.log q) (Real.log q) m (Real.exp_pos hc) (Real.exp_pos ho) hm + change conditionalMixEntropy a m (Real.log (Real.exp hc) + Real.log q) + (Real.log (Real.exp ho) + Real.log q) - + Real.log ((Real.exp hc + Real.exp ho) ^ m - Real.exp hc ^ m) = + m * ((a - a ^ m) / (1 - a ^ m) * Real.log q + + (1 - a) / (1 - a ^ m) * Real.log q) at h + rw [Real.log_exp, Real.log_exp, add_comm hc (Real.log q), + add_comm ho (Real.log q), hmean, ← Real.exp_nat_mul hc m] at h + change conditionalMixEntropy a m (Real.log q + hc) (Real.log q + ho) - + m * Real.log q = _ + linarith + +end MatrixMultiplication.CompletionEntropyAlgebra + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/Completion/Execution.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/Completion/Execution.lean new file mode 100644 index 0000000000000000000000000000000000000000..a7c414b83764216c1d7547ab6cabde802000b486 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/Completion/Execution.lean @@ -0,0 +1,416 @@ +import OAI.LinearAlgebra.MatrixMultiplication.Completion.HierarchyWords +import OAI.LinearAlgebra.MatrixMultiplication.Completion.GeometricValues +import OAI.LinearAlgebra.MatrixMultiplication.Entropy.ComplexConditionalHierarchyStage +import OAI.LinearAlgebra.MatrixMultiplication.Entropy.ComplexOrientedConditionalHierarchyStage +import OAI.LinearAlgebra.MatrixMultiplication.Tensor.ComplexGeometricStageCoordinates +import OAI.LinearAlgebra.MatrixMultiplication.Polynomial.ComplexPolynomialExecutionReindex + +namespace OAI + +/-! Readable tensor completion and its finite arithmetic realization. -/ + +noncomputable section + +namespace MatrixMultiplication.CompletionExecution + +open MatrixMultiplication.Foundation CompletionHierarchyWords ConditionalPrefixWords +open PolynomialKernelExecution ExecutionPairingBudget StageHierarchyResources +open scoped BigOperators Classical + +variable {A X Y Z : Type} [Fintype A] +variable (H : ReadableHierarchy A X Y Z) + +abbrev Position (counts : A → ℕ) (t : ℕ) := Fin (t * ∑ a, counts a) +abbrev Coordinate (U : Type) (counts : A → ℕ) (t : ℕ) := Position counts t → U +abbrev Prefix (counts : A → ℕ) (t n : ℕ) := + ExactPrefix counts H.labels n t (Position counts t) + +def support (counts : A → ℕ) (t : ℕ) + (x : Coordinate X counts t) (y : Coordinate Y counts t) + (z : Coordinate Z counts t) : Prop := + ∀ i, ∃ a : A, H.x a = x i ∧ H.y a = y i ∧ H.z a = z i + +def pairingProduct (counts : A → ℕ) (t : ℕ) (pair : ReaderPair) (n : ℕ) : ℕ := + ∏ i ∈ Finset.range n, if H.pair i = pair then + stageRefinementCount counts H.labels i t else 1 + +@[simp] theorem pairingProduct_zero (counts : A → ℕ) (t : ℕ) (pair : ReaderPair) : + pairingProduct H counts t pair 0 = 1 := by simp [pairingProduct] + +theorem pairingProduct_succ (counts : A → ℕ) (t : ℕ) (pair : ReaderPair) (n : ℕ) : + pairingProduct H counts t pair (n + 1) = pairingProduct H counts t pair n * + (if H.pair n = pair then stageRefinementCount counts H.labels n t else 1) := by + simp only [pairingProduct, Finset.prod_range_succ] + +def prefixValue {PX PY PZ : Type*} (counts : A → ℕ) (t n : ℕ) + (pairing : Tensor ℂ PX PY PZ) : + Tensor ℂ (Coordinate X counts t × (Prefix H counts t n × PX)) + (Coordinate Y counts t × (Prefix H counts t n × PY)) + (Coordinate Z counts t × (Prefix H counts t n × PZ)) := + fun x y z => if x.2.1 = y.2.1 ∧ x.2.1 = z.2.1 ∧ + eligible H id x.2.1 x.1 y.1 z.1 then pairing x.2.2 y.2.2 z.2.2 else 0 + +structure Bundle (counts : A → ℕ) (t n : ℕ) where + PX : Type + PY : Type + PZ : Type + AX : Type + AY : Type + AZ : Type + [finitePX : Fintype PX] + [finitePY : Fintype PY] + [finitePZ : Fintype PZ] + [finiteAX : Fintype AX] + [finiteAY : Fintype AY] + [finiteAZ : Fintype AZ] + execution : Execution (Coordinate X counts t) (Coordinate Y counts t) (Coordinate Z counts t) + (Prefix H counts t n) PX PY PZ AX AY AZ + (support H counts t) + shape : MatrixCoordinates PX PY PZ + shape_positive : shape.Positive + normal : execution.value = prefixValue H counts t n shape.tensor + rank_exact : execution.rankBound = stageAuxiliaryBudget counts H.labels n t + volume_exact : shape.volume = stagePairingProduct counts H.labels n t + rows_exact : shape.rows = pairingProduct H counts t .xz n + inner_exact : shape.inner = pairingProduct H counts t .xy n + columns_exact : shape.columns = pairingProduct H counts t .yz n + pairing_budget : shape.volume ≤ execution.rankBound + +attribute [instance] Bundle.finitePX Bundle.finitePY Bundle.finitePZ +attribute [instance] Bundle.finiteAX Bundle.finiteAY Bundle.finiteAZ + +theorem position_card (counts : A → ℕ) (t : ℕ) : + Fintype.card (Position counts t) = ∑ a, t * counts a := by + simp [Position, Finset.mul_sum] + +def scalarAuxiliary : Tensor ℂ PUnit PUnit PUnit := fun _ _ _ => 1 + +theorem scalarAuxiliary_rank : Tensor.RankAtMost scalarAuxiliary 1 := by + refine ⟨fun _ _ => 1, fun _ _ => 1, fun _ _ => 1, ?_⟩ + funext x y z + simp [scalarAuxiliary, Tensor.rankOne] + +def initial (counts : A → ℕ) (t : ℕ) : Bundle H counts t 0 := by + let E : Execution (Coordinate X counts t) (Coordinate Y counts t) + (Coordinate Z counts t) (Prefix H counts t 0) PUnit PUnit PUnit + PUnit PUnit PUnit (support H counts t) := { + auxiliary := scalarAuxiliary + rankBound := 1 + auxiliary_rank := scalarAuxiliary_rank + order := 0 + leftDegree := 0 + middleDegree := 0 + rightDegree := 0 + leftMap := fun _ _ _ => 1 + middleMap := fun _ _ _ => 1 + rightMap := fun _ _ _ => 1 + left_degree := by intros; simp + middle_degree := by intros; simp + right_degree := by intros; simp + value := prefixValue H counts t 0 MatrixCoordinates.scalar.tensor + vanishes := by intro _ _ _ _ j hj; omega + leading := by + intro x y z hs + have hxy : x.2.1 = y.2.1 := Subsingleton.elim _ _ + have hxz : x.2.1 = z.2.1 := Subsingleton.elim _ _ + have he : eligible H id x.2.1 x.1 y.1 z.1 := + (root_eligible_iff H x.2.1 x.1 y.1 z.1).mpr hs + change _ = (if x.2.1 = y.2.1 ∧ x.2.1 = z.2.1 ∧ + eligible H id x.2.1 x.1 y.1 z.1 then + MatrixCoordinates.scalar.tensor x.2.2 y.2.2 z.2.2 else 0) + rw [ite_eq_left ⟨hxy, hxz, he⟩, MatrixCoordinates.scalar_tensor] + simp [PolynomialLocalConstruction.kernel, LocalMaps.fiberTransform, scalarAuxiliary] + synchronized := by intro _ _ _ _ _; exact ⟨Subsingleton.elim _ _, Subsingleton.elim _ _⟩ + } + exact { + PX := PUnit + PY := PUnit + PZ := PUnit + AX := PUnit + AY := PUnit + AZ := PUnit + execution := E + shape := MatrixCoordinates.scalar + shape_positive := MatrixCoordinates.scalar_positive + normal := rfl + rank_exact := by simp [E, stageAuxiliaryBudget] + volume_exact := by simp [stagePairingProduct] + rows_exact := by simp [MatrixCoordinates.scalar] + inner_exact := by simp [MatrixCoordinates.scalar] + columns_exact := by simp [MatrixCoordinates.scalar] + pairing_budget := le_rfl + } + +variable {H} + +theorem previous_eligible {counts : A → ℕ} {t n : ℕ} (B : Bundle H counts t n) + (x : Coordinate X counts t × (Prefix H counts t n × B.PX)) + (y : Coordinate Y counts t × (Prefix H counts t n × B.PY)) + (z : Coordinate Z counts t × (Prefix H counts t n × B.PZ)) + (_hs : support H counts t x.1 y.1 z.1) + (hn : B.execution.value x y z ≠ 0) : eligible H id x.2.1 x.1 y.1 z.1 := by + rw [B.normal] at hn + by_contra h + exact hn (by simp [prefixValue, h]) + +section Successor + +variable {counts : A → ℕ} {t n : ℕ} (B : Bundle H counts t n) +variable {NX NY NZ BX BY BZ : Type} +variable [Fintype BX] [Fintype BY] [Fintype BZ] + +def refinedExecution + (S : Stage B.execution (Fin (stageRefinementCount counts H.labels n t)) + NX NY NZ BX BY BZ) : + Execution (Coordinate X counts t) (Coordinate Y counts t) (Coordinate Z counts t) + (Prefix H counts t (n + 1)) (B.PX × NX) (B.PY × NY) (B.PZ × NZ) + (B.AX × BX) (B.AY × BY) (B.AZ × BZ) + (support H counts t) := + (B.execution.step S).reindexOutput + (nextPrefixEquiv counts H.labels n t (Position counts t)) + (Equiv.refl _) (Equiv.refl _) (Equiv.refl _) + +theorem refinedExecution_normal + (S : Stage B.execution (Fin (stageRefinementCount counts H.labels n t)) + NX NY NZ BX BY BZ) + (shape : MatrixCoordinates NX NY NZ) + (hstage : ∀ p x y z, eligible H id p x.1 y.1 z.1 → + S.value p x y z = if x.2.1 = y.2.1 ∧ x.2.1 = z.2.1 ∧ + eligible H id (appendCode p x.2.1) x.1 y.1 z.1 + then shape.tensor x.2.2 y.2.2 z.2.2 else 0) : + (refinedExecution B S).value = + prefixValue H counts t (n + 1) (B.shape.product shape).tensor := by + classical + funext x y z + let e := nextPrefixEquiv counts H.labels n t (Position counts t) + let px := e x.2.1 + let py := e y.2.1 + let pz := e z.2.1 + have hdecode (p : Prefix H counts t (n + 1)) : + appendCode (e p).1 (e p).2 = p := e.symm_apply_apply p + change B.execution.value (x.1, (px.1, x.2.2.1)) + (y.1, (py.1, y.2.2.1)) (z.1, (pz.1, z.2.2.1)) * + S.value px.1 (x.1, (px.2, x.2.2.2)) + (y.1, (py.2, y.2.2.2)) (z.1, (pz.2, z.2.2.2)) = _ + rw [B.normal] + simp only [prefixValue] + by_cases hold : px.1 = py.1 ∧ px.1 = pz.1 ∧ eligible H id px.1 x.1 y.1 z.1 + · rw [ite_eq_left hold] + have hguard : + (px.2 = py.2 ∧ px.2 = pz.2 ∧ eligible H id (appendCode px.1 px.2) x.1 y.1 z.1) ↔ + (x.2.1 = y.2.1 ∧ x.2.1 = z.2.1 ∧ eligible H id x.2.1 x.1 y.1 z.1) := by + constructor + · rintro ⟨hxy, hxz, he⟩ + refine ⟨e.injective (Prod.ext hold.1 hxy), + e.injective (Prod.ext hold.2.1 hxz), ?_⟩ + simpa only [px, hdecode] using he + · rintro ⟨hxy, hxz, he⟩ + refine ⟨congrArg (fun p => (e p).2) hxy, + congrArg (fun p => (e p).2) hxz, ?_⟩ + simpa only [px, hdecode] using he + rw [hstage px.1 (x.1, (px.2, x.2.2.2)) + (y.1, (py.2, y.2.2.2)) (z.1, (pz.2, z.2.2.2)) hold.2.2] + simp only [hguard, + MatrixCoordinates.product_tensor, Tensor.product, mul_ite, mul_zero] + · have hnext : ¬ (x.2.1 = y.2.1 ∧ x.2.1 = z.2.1 ∧ + eligible H id x.2.1 x.1 y.1 z.1) := by + rintro ⟨hxy, hxz, he⟩ + apply hold + refine ⟨congrArg (fun p => (e p).1) hxy, + congrArg (fun p => (e p).1) hxz, ?_⟩ + rw [← hdecode x.2.1] at he + obtain ⟨word, hw, _⟩ := + (eligible_appendCode_iff H px.1 px.2 x.1 y.1 z.1).mp he + exact ⟨word, hw⟩ + rw [ite_eq_right hold, ite_eq_right hnext, zero_mul] + +def extendBundle [Fintype NX] [Fintype NY] [Fintype NZ] + (S : Stage B.execution (Fin (stageRefinementCount counts H.labels n t)) + NX NY NZ BX BY BZ) + (shape : MatrixCoordinates NX NY NZ) (hpositive : shape.Positive) + (hvolume : shape.volume = stageRefinementCount counts H.labels n t) + (hrank : S.rankBound = stageCost counts H.labels n t) + (hrows : shape.rows = if H.pair n = .xz then + stageRefinementCount counts H.labels n t else 1) + (hinner : shape.inner = if H.pair n = .xy then + stageRefinementCount counts H.labels n t else 1) + (hcolumns : shape.columns = if H.pair n = .yz then + stageRefinementCount counts H.labels n t else 1) + (hstage : ∀ p x y z, eligible H id p x.1 y.1 z.1 → + S.value p x y z = if x.2.1 = y.2.1 ∧ x.2.1 = z.2.1 ∧ + eligible H id (appendCode p x.2.1) x.1 y.1 z.1 + then shape.tensor x.2.2 y.2.2 z.2.2 else 0) : Bundle H counts t (n + 1) where + PX := B.PX × NX + PY := B.PY × NY + PZ := B.PZ × NZ + AX := B.AX × BX + AY := B.AY × BY + AZ := B.AZ × BZ + execution := refinedExecution B S + shape := B.shape.product shape + shape_positive := B.shape.product_positive shape B.shape_positive hpositive + normal := refinedExecution_normal B S shape hstage + rank_exact := by + change B.execution.rankBound * S.rankBound = _ + rw [B.rank_exact, hrank, stageAuxiliaryBudget_succ] + volume_exact := by + rw [MatrixCoordinates.product_volume, B.volume_exact, hvolume, stagePairingProduct_succ] + rows_exact := by + change B.shape.rows * shape.rows = _ + rw [B.rows_exact, hrows, pairingProduct_succ] + inner_exact := by + change B.shape.inner * shape.inner = _ + rw [B.inner_exact, hinner, pairingProduct_succ] + columns_exact := by + change B.shape.columns * shape.columns = _ + rw [B.columns_exact, hcolumns, pairingProduct_succ] + pairing_budget := by + change (B.shape.product shape).volume ≤ B.execution.rankBound * S.rankBound + rw [MatrixCoordinates.product_volume] + apply Nat.mul_le_mul B.pairing_budget + rw [hvolume, hrank] + exact LabelHierarchySeparation.population_le_poolAuxiliaryCost _ + +end Successor + +section ConcreteStages + +variable {counts : A → ℕ} {t n : ℕ} + +def extendXY (B : Bundle H counts t n) (hn : n < H.depth) + (hpair : H.pair n = .xy) : Bundle H counts t (n + 1) := Classical.choice (by + have hagree : ∀ (p : Prefix H counts t n) + (x : Coordinate X counts t) (y : Coordinate Y counts t) + (z : Coordinate Z counts t), eligible H id p x y z → + readXYX H id hpair p x = readXYY H id hpair p y := by + intro p x y z he + exact readable_XY H id hpair p x y z hn he + obtain ⟨S, _, hrank, _, _, _, _, hvalue⟩ := + ConditionalHierarchyStage.exists_actualPoolStage counts H.labels n t B.execution id + (readXYX H id hpair) (readXYY H id hpair) + (eligible H id) (previous_eligible B) hagree + refine ⟨extendBundle B S (GeometricStageCoordinates.xy _) + (GeometricStageCoordinates.xy_positive (stageRefinementCount_pos counts H.labels n t)) + (GeometricStageCoordinates.xy_volume _) hrank + (by simp [hpair, GeometricStageCoordinates.xy]) + (by simp [hpair, GeometricStageCoordinates.xy]) + (by simp [hpair, GeometricStageCoordinates.xy]) ?_⟩ + intro p x y z he + rw [hvalue] + obtain ⟨word, hw⟩ := he + exact CompletionGeometricValues.raw_XY_normal H p hn hpair x y z word hw) + +def extendXZ (B : Bundle H counts t n) (hn : n < H.depth) + (hpair : H.pair n = .xz) : Bundle H counts t (n + 1) := Classical.choice (by + have hagree : ∀ (p : Prefix H counts t n) + (x : Coordinate X counts t) (y : Coordinate Y counts t) + (z : Coordinate Z counts t), eligible H id p x y z → + readXZX H id hpair p x = readXZZ H id hpair p z := by + intro p x y z he + exact readable_XZ H id hpair p x y z hn he + obtain ⟨S, _, hrank, _, _, _, _, hvalue⟩ := + OrientedConditionalHierarchyStage.exists_actualPoolStage_XZ counts H.labels n t B.execution id + (readXZX H id hpair) (readXZZ H id hpair) + (eligible H id) (previous_eligible B) hagree + refine ⟨extendBundle B S (GeometricStageCoordinates.xz _) + (GeometricStageCoordinates.xz_positive (stageRefinementCount_pos counts H.labels n t)) + (GeometricStageCoordinates.xz_volume _) hrank + (by simp [hpair, GeometricStageCoordinates.xz]) + (by simp [hpair, GeometricStageCoordinates.xz]) + (by simp [hpair, GeometricStageCoordinates.xz]) ?_⟩ + intro p x y z he + rw [hvalue] + obtain ⟨word, hw⟩ := he + exact CompletionGeometricValues.raw_XZ_normal H p hn hpair x y z word hw) + +def extendYZ (B : Bundle H counts t n) (hn : n < H.depth) + (hpair : H.pair n = .yz) : Bundle H counts t (n + 1) := Classical.choice (by + have hagree : ∀ (p : Prefix H counts t n) + (x : Coordinate X counts t) (y : Coordinate Y counts t) + (z : Coordinate Z counts t), eligible H id p x y z → + readYZY H id hpair p y = readYZZ H id hpair p z := by + intro p x y z he + exact readable_YZ H id hpair p x y z hn he + obtain ⟨S, _, hrank, _, _, _, _, hvalue⟩ := + OrientedConditionalHierarchyStage.exists_actualPoolStage_YZ counts H.labels n t B.execution id + (readYZY H id hpair) (readYZZ H id hpair) + (eligible H id) (previous_eligible B) hagree + refine ⟨extendBundle B S (GeometricStageCoordinates.yz _) + (GeometricStageCoordinates.yz_positive (stageRefinementCount_pos counts H.labels n t)) + (GeometricStageCoordinates.yz_volume _) hrank + (by simp [hpair, GeometricStageCoordinates.yz]) + (by simp [hpair, GeometricStageCoordinates.yz]) + (by simp [hpair, GeometricStageCoordinates.yz]) ?_⟩ + intro p x y z he + rw [hvalue] + obtain ⟨word, hw⟩ := he + exact CompletionGeometricValues.raw_YZ_normal H p hn hpair x y z word hw) + +def extend (B : Bundle H counts t n) (hn : n < H.depth) : + Bundle H counts t (n + 1) := + match hp : H.pair n with + | .xy => extendXY B hn hp + | .xz => extendXZ B hn hp + | .yz => extendYZ B hn hp + +end ConcreteStages + +variable (H) + +def run (counts : A → ℕ) (t : ℕ) : (n : ℕ) → n ≤ H.depth → Bundle H counts t n + | 0, _ => initial H counts t + | n + 1, hn => extend (run counts t n (by omega)) (by omega) + +def realize (counts : A → ℕ) (t : ℕ) : Bundle H counts t H.depth := + run H counts t H.depth le_rfl + +theorem realize_dimensions (counts : A → ℕ) (t : ℕ) : + (realize H counts t).shape.rows = + ConditionalLabels.stagePairingSize counts H.labels H.depth + (fun n => H.pair n.val) .xz t ∧ + (realize H counts t).shape.inner = + ConditionalLabels.stagePairingSize counts H.labels H.depth + (fun n => H.pair n.val) .xy t ∧ + (realize H counts t).shape.columns = + ConditionalLabels.stagePairingSize counts H.labels H.depth + (fun n => H.pair n.val) .yz t := by + have h (pair : ReaderPair) : pairingProduct H counts t pair H.depth = + ConditionalLabels.stagePairingSize counts H.labels H.depth + (fun n => H.pair n.val) pair t := by + simp only [pairingProduct, ConditionalLabels.stagePairingSize, + ConditionalLabels.pairingSize, ← Fin.prod_univ_eq_prod_range] + exact ⟨(realize H counts t).rows_exact.trans (h .xz), + (realize H counts t).inner_exact.trans (h .xy), + (realize H counts t).columns_exact.trans (h .yz)⟩ + +theorem realize_rankBound (counts : A → ℕ) (t : ℕ) : + (realize H counts t).execution.rankBound = + stageAuxiliaryBudget counts H.labels H.depth t := + (realize H counts t).rank_exact + +theorem realize_volume (counts : A → ℕ) (t : ℕ) + (complete : Function.Injective (labelRecordOf H.labels H.depth)) : + (realize H counts t).shape.volume = + Fintype.card (ExactWords (fun a => t * counts a)) := by + rw [(realize H counts t).volume_exact] + exact stagePairingProduct_eq_exactWords_card counts H.labels H.depth complete t + +theorem realize_label_card (counts : A → ℕ) (t : ℕ) + (complete : Function.Injective (labelRecordOf H.labels H.depth)) : + Fintype.card (Prefix H counts t H.depth) = + Fintype.card (ExactWords (fun a => t * counts a)) := by + rw [exactWords_card] + calc + Fintype.card (Prefix H counts t H.depth) = + Fintype.card (PopulationWords (Position counts t) (fun a => t * counts a)) := + Fintype.card_congr + (sourcePrefixEquiv counts H.labels H.depth t (Position counts t) complete) + _ = Nat.multinomial Finset.univ (fun a => t * counts a) := + populationWords_card (I := Position counts t) + (fun a => t * counts a) (position_card counts t) + +end MatrixMultiplication.CompletionExecution + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/Completion/FiniteRealization.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/Completion/FiniteRealization.lean new file mode 100644 index 0000000000000000000000000000000000000000..4c97d1343ae423de357ea8488ea9a7e052d779c0 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/Completion/FiniteRealization.lean @@ -0,0 +1,280 @@ +import OAI.LinearAlgebra.MatrixMultiplication.Completion.Scripts +import OAI.LinearAlgebra.MatrixMultiplication.Completion.Execution +import OAI.LinearAlgebra.MatrixMultiplication.Separation.ExecutionApproximation +import OAI.LinearAlgebra.MatrixMultiplication.Tensor.ComplexExecutionPairingBudget +import OAI.LinearAlgebra.MatrixMultiplication.Separation.ComplexFiniteMMRealization + +namespace OAI + +/-! Readable tensor completion and its finite arithmetic realization. -/ + +noncomputable section + +namespace MatrixMultiplication.CompletionFiniteRealization + +open MatrixMultiplication.Foundation RecursiveCompletion +open scoped BigOperators Classical + +theorem power_coefficient_one {X Y Z : Type*} (T : Tensor ℂ X Y Z) + (unit : ∀ x y z, T x y z ≠ 0 → T x y z = 1) (n : ℕ) + (x : Fin n → X) (y : Fin n → Y) (z : Fin n → Z) + (supported : Tensor.power T n x y z ≠ 0) : Tensor.power T n x y z = 1 := by + apply Finset.prod_eq_one + intro i hi + exact unit _ _ _ ((Finset.prod_ne_zero_iff.mp supported) i hi) + +theorem complete_coefficient_one {X Y Z : Type*} (S : FlaggedTensor X Y Z) + (unit : ∀ x y z, S.tensor x y z ≠ 0 → S.tensor x y z = 1) + (center : Color) (m : ℕ) (x : Fin m → X) (y : Fin m → Y) (z : Fin m → Z) + (supported : (complete S center m).tensor x y z ≠ 0) : + (complete S center m).tensor x y z = 1 := by + rw [complete_tensor] at supported ⊢ + split_ifs at supported ⊢ with hweight + · exact power_coefficient_one S.tensor unit m x y z supported + · exact False.elim (supported rfl) + +theorem script_coefficient_one {X Y Z : Type*} (S : FlaggedTensor X Y Z) + (unit : ∀ x y z, S.tensor x y z ≠ 0 → S.tensor x y z = 1) (s : Script) : + ∀ x y z, (s.tensor S).tensor x y z ≠ 0 → (s.tensor S).tensor x y z = 1 := by + induction s with + | base => exact unit + | step prior center m ih => exact complete_coefficient_one (prior.tensor S) ih center m + +def scriptSourceApproximation {X Y Z : Type*} + [Fintype X] [Fintype Y] [Fintype Z] (S : FlaggedTensor X Y Z) {d D : ℕ} + (source : Tensor.PolynomialApproximation S.tensor 3 d D) (s : Script) (blocks : ℕ) : + Tensor.PolynomialApproximation (Tensor.power (s.tensor S).tensor blocks) + (3 ^ (s.factors * blocks)) (s.order d * blocks) (s.degree D * blocks) := by + simpa only [pow_mul] using (s.approximation S source).power blocks + +open CompletionHierarchyWords CompletionExecution ExecutionPairingBudget + +variable {A X Y Z : Type} [Fintype A] +variable (H : ReadableHierarchy A X Y Z) (counts : A → ℕ) (t : ℕ) + +def blocks : ℕ := t * ∑ a, counts a + +def copies : ℕ := Fintype.card (Prefix H counts t H.depth) + +def rows : ℕ := (realize H counts t).shape.rows +def inner : ℕ := (realize H counts t).shape.inner +def columns : ℕ := (realize H counts t).shape.columns + +def order (d : ℕ) : ℕ := + d * blocks counts t * ((realize H counts t).execution.order + 1) + + (realize H counts t).execution.order + +def degree (D : ℕ) : ℕ := + D * blocks counts t * ((realize H counts t).execution.order + 1) + + (realize H counts t).execution.leftDegree + + (realize H counts t).execution.middleDegree + + (realize H counts t).execution.rightDegree + +def labelEquiv : Fin (copies H counts t) ≃ Prefix H counts t H.depth := + (Fintype.equivFin _).symm + +variable (complete : Function.Injective (labelRecordOf H.labels H.depth)) + +def designatedX (p : Prefix H counts t H.depth) : Coordinate X counts t := + longX H (terminalWord H complete p).val + +def designatedY (p : Prefix H counts t H.depth) : Coordinate Y counts t := + longY H (terminalWord H complete p).val + +def designatedZ (p : Prefix H counts t H.depth) : Coordinate Z counts t := + longZ H (terminalWord H complete p).val + +theorem leading_shape + (x : Coordinate X counts t × (Prefix H counts t H.depth × (realize H counts t).PX)) + (y : Coordinate Y counts t × (Prefix H counts t H.depth × (realize H counts t).PY)) + (z : Coordinate Z counts t × (Prefix H counts t H.depth × (realize H counts t).PZ)) : + (realize H counts t).execution.value x y z = + if x.2.1 = y.2.1 ∧ x.2.1 = z.2.1 ∧ + x.1 = designatedX H counts t complete x.2.1 ∧ + y.1 = designatedY H counts t complete x.2.1 ∧ + z.1 = designatedZ H counts t complete x.2.1 + then (realize H counts t).shape.tensor x.2.2 y.2.2 z.2.2 else 0 := by + rw [(realize H counts t).normal] + simp only [prefixValue, terminal_eligible_iff H complete, + designatedX, designatedY, designatedZ] + rfl + +def leftSelect + (u : Fin (copies H counts t) × (Fin (rows H counts t) × Fin (inner H counts t))) : + Coordinate X counts t × (Prefix H counts t H.depth × (realize H counts t).PX) := + (designatedX H counts t complete (labelEquiv H counts t u.1), + (labelEquiv H counts t u.1, (realize H counts t).shape.left.symm u.2)) + +def middleSelect + (v : Fin (copies H counts t) × (Fin (inner H counts t) × Fin (columns H counts t))) : + Coordinate Y counts t × (Prefix H counts t H.depth × (realize H counts t).PY) := + (designatedY H counts t complete (labelEquiv H counts t v.1), + (labelEquiv H counts t v.1, (realize H counts t).shape.middle.symm v.2)) + +def rightSelect + (w : Fin (copies H counts t) × (Fin (columns H counts t) × Fin (rows H counts t))) : + Coordinate Z counts t × (Prefix H counts t H.depth × (realize H counts t).PZ) := + (designatedZ H counts t complete (labelEquiv H counts t w.1), + (labelEquiv H counts t w.1, (realize H counts t).shape.right.symm w.2)) + +theorem designated_coefficient_one (T : Tensor ℂ X Y Z) + (unit : ∀ a, T (H.x a) (H.y a) (H.z a) = 1) + (p : Prefix H counts t H.depth) : + Tensor.power T (blocks counts t) (designatedX H counts t complete p) + (designatedY H counts t complete p) (designatedZ H counts t complete p) = 1 := by + apply Finset.prod_eq_one + intro i _ + exact unit ((terminalWord H complete p).val i) + +theorem selected_output (T : Tensor ℂ X Y Z) + (unit : ∀ a, T (H.x a) (H.y a) (H.z a) = 1) : + Tensor.pullback (leftSelect H counts t complete) (middleSelect H counts t complete) + (rightSelect H counts t complete) + (LocalMaps.originalScale (Tensor.power T (blocks counts t)) + (realize H counts t).execution.value) = + Tensor.directSum (fun _ : Fin (copies H counts t) => + Tensor.matrixMultiplication (rows H counts t) (inner H counts t) (columns H counts t)) := by + funext u v w + simp only [Tensor.pullback, LocalMaps.originalScale, leftSelect, middleSelect, rightSelect] + rw [leading_shape H counts t complete] + simp only [MatrixCoordinates.tensor, Tensor.pullback] + by_cases h : u.1 = v.1 ∧ u.1 = w.1 + · have hv : v.1 = u.1 := h.1.symm + have hw : w.1 = u.1 := h.2.symm + simp only [hv, hw, designated_coefficient_one H counts t complete T unit, + Tensor.directSum, true_and, ite_true, one_mul, + Tensor.matrixMultiplication_eq_matrixCoefficients, rows, inner, columns] + rw [(realize H counts t).shape.left.apply_symm_apply u.2, + (realize H counts t).shape.middle.apply_symm_apply v.2, + (realize H counts t).shape.right.apply_symm_apply w.2] + · have hn : ¬ (labelEquiv H counts t u.1 = labelEquiv H counts t v.1 ∧ + labelEquiv H counts t u.1 = labelEquiv H counts t w.1 ∧ + True ∧ + designatedY H counts t complete (labelEquiv H counts t v.1) = + designatedY H counts t complete (labelEquiv H counts t u.1) ∧ + designatedZ H counts t complete (labelEquiv H counts t w.1) = + designatedZ H counts t complete (labelEquiv H counts t u.1)) := by + intro he + exact h ⟨(labelEquiv H counts t).injective he.1, + (labelEquiv H counts t).injective he.2.1⟩ + simp only [Tensor.directSum, ite_eq_right h, ite_eq_right hn, mul_zero] + +theorem dimensions_positive : + 0 < rows H counts t ∧ 0 < inner H counts t ∧ 0 < columns H counts t := + (realize H counts t).shape_positive + +include complete in +theorem volume_eq_copies : + rows H counts t * inner H counts t * columns H counts t = copies H counts t := + (realize_volume H counts t complete).trans (realize_label_card H counts t complete).symm + +include complete in +theorem copies_pos : 0 < copies H counts t := by + rw [← volume_eq_copies H counts t complete] + exact Nat.mul_pos (Nat.mul_pos (dimensions_positive H counts t).1 + (dimensions_positive H counts t).2.1) (dimensions_positive H counts t).2.2 + +theorem auxiliaryRank_pos : 0 < (realize H counts t).execution.rankBound := + lt_of_lt_of_le + (Nat.mul_pos (Nat.mul_pos (dimensions_positive H counts t).1 + (dimensions_positive H counts t).2.1) (dimensions_positive H counts t).2.2) + (realize H counts t).pairing_budget + +variable [Fintype X] [Fintype Y] [Fintype Z] + +def sourceApproximation {T : Tensor ℂ X Y Z} {factors d D : ℕ} + (source : Tensor.PolynomialApproximation T (3 ^ factors) d D) : + Tensor.PolynomialApproximation (Tensor.power T (blocks counts t)) + (3 ^ (factors * blocks counts t)) (d * blocks counts t) (D * blocks counts t) := by + simpa only [pow_mul] using source.power (blocks counts t) + +def approximation {T : Tensor ℂ X Y Z} {factors d D : ℕ} + (source : Tensor.PolynomialApproximation T (3 ^ factors) d D) + (supported : ∀ x y z, T x y z ≠ 0 → ∃ a, H.x a = x ∧ H.y a = y ∧ H.z a = z) + (unit : ∀ a, T (H.x a) (H.y a) (H.z a) = 1) : + Tensor.PolynomialApproximation + (Tensor.directSum (fun _ : Fin (copies H counts t) => + Tensor.matrixMultiplication (rows H counts t) (inner H counts t) (columns H counts t))) + (3 ^ (factors * blocks counts t) * (realize H counts t).execution.rankBound) + (order H counts t d) (degree H counts t D) := by + have hs : ∀ x y z, ¬ support H counts t x y z → + Tensor.power T (blocks counts t) x y z = 0 := by + intro x y z outside + by_contra nonzero + apply outside + intro i + exact supported _ _ _ ((Finset.prod_ne_zero_iff.mp nonzero) i (Finset.mem_univ i)) + have full := ExecutionApproximation.approximation (realize H counts t).execution + (sourceApproximation counts t source) hs + have selected := full.pullback (leftSelect H counts t complete) + (middleSelect H counts t complete) (rightSelect H counts t complete) + rw [selected_output H counts t complete T unit] at selected + exact selected + +def realization {T : Tensor ℂ X Y Z} {factors d D : ℕ} + (source : Tensor.PolynomialApproximation T (3 ^ factors) d D) + (supported : ∀ x y z, T x y z ≠ 0 → ∃ a, H.x a = x ∧ H.y a = y ∧ H.z a = z) + (unit : ∀ a, T (H.x a) (H.y a) (H.z a) = 1) + (factors_pos : 0 < factors) (blocks_pos : 0 < blocks counts t) : FiniteMMRealization where + occurrences := factors * blocks counts t + multiplicity := copies H counts t + auxiliaryRank := (realize H counts t).execution.rankBound + rows := rows H counts t + inner := inner H counts t + columns := columns H counts t + occurrences_pos := Nat.mul_pos factors_pos blocks_pos + multiplicity_pos := copies_pos H counts t complete + auxiliaryRank_pos := auxiliaryRank_pos H counts t + rows_pos := (dimensions_positive H counts t).1 + inner_pos := (dimensions_positive H counts t).2.1 + columns_pos := (dimensions_positive H counts t).2.2 + order := order H counts t d + degree := degree H counts t D + approximation := approximation H counts t complete source supported unit + +section Projections + +variable {T : Tensor ℂ X Y Z} {factors d D : ℕ} +variable (source : Tensor.PolynomialApproximation T (3 ^ factors) d D) +variable (supported : ∀ x y z, T x y z ≠ 0 → + ∃ a, H.x a = x ∧ H.y a = y ∧ H.z a = z) +variable (unit : ∀ a, T (H.x a) (H.y a) (H.z a) = 1) +variable (factors_pos : 0 < factors) (blocks_pos : 0 < blocks counts t) + +@[simp] theorem realization_occurrences : + (realization H counts t complete source supported unit factors_pos blocks_pos).occurrences = + factors * blocks counts t := rfl + +@[simp] theorem realization_multiplicity : + (realization H counts t complete source supported unit factors_pos blocks_pos).multiplicity = + copies H counts t := rfl + +@[simp] theorem realization_auxiliaryRank : + (realization H counts t complete source supported unit factors_pos blocks_pos).auxiliaryRank = + StageHierarchyResources.stageAuxiliaryBudget counts H.labels H.depth t := + realize_rankBound H counts t + +@[simp] theorem realization_rows : + (realization H counts t complete source supported unit factors_pos blocks_pos).rows = + rows H counts t := rfl + +@[simp] theorem realization_inner : + (realization H counts t complete source supported unit factors_pos blocks_pos).inner = + inner H counts t := rfl + +@[simp] theorem realization_columns : + (realization H counts t complete source supported unit factors_pos blocks_pos).columns = + columns H counts t := rfl + +@[simp] theorem realization_volume : + (realization H counts t complete source supported unit factors_pos blocks_pos).rates.volume = + copies H counts t := + volume_eq_copies H counts t complete + +end Projections + +end MatrixMultiplication.CompletionFiniteRealization + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/Completion/GeometricValues.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/Completion/GeometricValues.lean new file mode 100644 index 0000000000000000000000000000000000000000..720c5a1b1d14e83a0e0d48f19558a120d62cf9c2 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/Completion/GeometricValues.lean @@ -0,0 +1,158 @@ +import OAI.LinearAlgebra.MatrixMultiplication.Completion.HierarchyWords +import OAI.LinearAlgebra.MatrixMultiplication.Entropy.ComplexConditionalHierarchyStage +import OAI.LinearAlgebra.MatrixMultiplication.Separation.ComplexPrefixSeparationOrientations +import OAI.LinearAlgebra.MatrixMultiplication.Tensor.ComplexGeometricStageCoordinates + +namespace OAI + +/-! Readable tensor completion and its finite arithmetic realization. -/ + +noncomputable section + +namespace MatrixMultiplication.CompletionGeometricValues + +open MatrixMultiplication.Foundation +open CompletionHierarchyWords ConditionalPrefixWords +open ConditionalHierarchyStage PrefixSeparationPolynomialStage PrefixSeparationOrientations +open StageHierarchyResources +open scoped Classical + +variable {A X Y Z : Type*} [Fintype A] (H : ReadableHierarchy A X Y Z) +variable {Position : Type*} [Fintype Position] {counts : A → ℕ} {n t : ℕ} + +abbrev size (counts : A → ℕ) (n t : ℕ) := stageRefinementCount counts H.labels n t + +theorem actualPool_decode (old : ExactPrefix counts H.labels n t Position) + (code : Fin (size H counts n t)) : + decodePool (actualPool counts H.labels n t id) (size H counts n t) + (actualPool_card counts H.labels n t id) old code = + ((conditionalPoolEquivFin old).symm code).val := rfl + +theorem decode_eq_iff_eligible (old : ExactPrefix counts H.labels n t Position) + (code : Fin (size H counts n t)) + (u : Position → X) (v : Position → Y) (w : Position → Z) + (word : Position → A) (hword : Represents H id old u v w word) : + decodePool (actualPool counts H.labels n t id) (size H counts n t) + (actualPool_card counts H.labels n t id) old code = (fun i => H.labels n (word i)) ↔ + eligible H id (appendCode old code) u v w := by + rw [actualPool_decode] + exact (eligible_appendCode_iff_of_represents H old code u v w word hword).symm + +theorem raw_XY_normal + (old : ExactPrefix counts H.labels n t Position) (hn : n < H.depth) + (hp : H.pair n = .xy) + (x : (Position → X) × InformedOutput (size H counts n t)) + (y : (Position → Y) × InformedOutput (size H counts n t)) + (z : (Position → Z) × MissingOutput (size H counts n t)) + (word : Position → A) (hword : Represents H id old x.1 y.1 z.1 word) : + rawPoolLeading (actualPool counts H.labels n t id) (size H counts n t) + (stageRefinementCount_pos counts H.labels n t) (actualPool_card counts H.labels n t id) + (readXYX H id hp) (readXYY H id hp) old x y z = + if x.2.1 = y.2.1 ∧ x.2.1 = z.2.1 ∧ + eligible H id (appendCode old x.2.1) x.1 y.1 z.1 then + (GeometricStageCoordinates.xy (size H counts n t)).tensor x.2.2 y.2.2 z.2.2 + else 0 := by + have hx : readXYX H id hp old x.1 = fun i => H.labels n (word i) := by + rw [hword.1] + exact readXYX_on_original_word H id hp old word hn hword.2.2.2 + have hy : readXYY H id hp old y.1 = fun i => H.labels n (word i) := by + rw [hword.2.1] + exact readXYY_on_original_word H id hp old word hn hword.2.2.2 + rw [rawPoolLeading_eq_decodedLeading + (actualPool counts H.labels n t id) (size H counts n t) + (stageRefinementCount_pos counts H.labels n t) (actualPool_card counts H.labels n t id) + (readXYX H id hp) (readXYY H id hp) (fun _ _ _ _ => fun i => H.labels n (word i)) + old x y z hx hy] + unfold decodedLeading + simp only [decode_eq_iff_eligible H old x.2.1 x.1 y.1 z.1 word hword, + GeometricStageCoordinates.xy_tensor_apply] + simp only [ite_and] + +theorem raw_XZ_normal + (old : ExactPrefix counts H.labels n t Position) (hn : n < H.depth) + (hp : H.pair n = .xz) + (x : (Position → X) × InformedOutput (size H counts n t)) + (y : (Position → Y) × MissingOutput (size H counts n t)) + (z : (Position → Z) × InformedOutput (size H counts n t)) + (word : Position → A) (hword : Represents H id old x.1 y.1 z.1 word) : + rawPoolLeadingXZ (actualPool counts H.labels n t id) (size H counts n t) + (stageRefinementCount_pos counts H.labels n t) (actualPool_card counts H.labels n t id) + (readXZX H id hp) (readXZZ H id hp) old x y z = + if x.2.1 = y.2.1 ∧ x.2.1 = z.2.1 ∧ + eligible H id (appendCode old x.2.1) x.1 y.1 z.1 then + (GeometricStageCoordinates.xz (size H counts n t)).tensor x.2.2 y.2.2 z.2.2 + else 0 := by + have hx : readXZX H id hp old x.1 = fun i => H.labels n (word i) := by + rw [hword.1] + exact readXZX_on_original_word H id hp old word hn hword.2.2.2 + have hz : readXZZ H id hp old z.1 = fun i => H.labels n (word i) := by + rw [hword.2.2.1] + exact readXZZ_on_original_word H id hp old word hn hword.2.2.2 + unfold rawPoolLeadingXZ + rw [rawPoolLeading_eq_decodedLeading + (actualPool counts H.labels n t id) (size H counts n t) + (stageRefinementCount_pos counts H.labels n t) (actualPool_card counts H.labels n t id) + (readXZX H id hp) (readXZZ H id hp) (fun _ _ _ _ => fun i => H.labels n (word i)) + old x z y hx hz] + unfold decodedLeading + simp only [decode_eq_iff_eligible H old x.2.1 x.1 y.1 z.1 word hword, + GeometricStageCoordinates.xz_tensor_apply] + have hswap : + (x.2.1 = z.2.1 ∧ x.2.1 = y.2.1 ∧ + eligible H id (appendCode old x.2.1) x.1 y.1 z.1 ∧ x.2.2 = z.2.2) ↔ + (x.2.1 = y.2.1 ∧ x.2.1 = z.2.1 ∧ + eligible H id (appendCode old x.2.1) x.1 y.1 z.1 ∧ x.2.2 = z.2.2) := + and_left_comm + simp only [hswap, ite_and] + +theorem raw_YZ_normal + (old : ExactPrefix counts H.labels n t Position) (hn : n < H.depth) + (hp : H.pair n = .yz) + (x : (Position → X) × MissingOutput (size H counts n t)) + (y : (Position → Y) × InformedOutput (size H counts n t)) + (z : (Position → Z) × InformedOutput (size H counts n t)) + (word : Position → A) (hword : Represents H id old x.1 y.1 z.1 word) : + rawPoolLeadingYZ (actualPool counts H.labels n t id) (size H counts n t) + (stageRefinementCount_pos counts H.labels n t) (actualPool_card counts H.labels n t id) + (readYZY H id hp) (readYZZ H id hp) old x y z = + if x.2.1 = y.2.1 ∧ x.2.1 = z.2.1 ∧ + eligible H id (appendCode old x.2.1) x.1 y.1 z.1 then + (GeometricStageCoordinates.yz (size H counts n t)).tensor x.2.2 y.2.2 z.2.2 + else 0 := by + have hy : readYZY H id hp old y.1 = fun i => H.labels n (word i) := by + rw [hword.2.1] + exact readYZY_on_original_word H id hp old word hn hword.2.2.2 + have hz : readYZZ H id hp old z.1 = fun i => H.labels n (word i) := by + rw [hword.2.2.1] + exact readYZZ_on_original_word H id hp old word hn hword.2.2.2 + unfold rawPoolLeadingYZ + rw [rawPoolLeading_eq_decodedLeading + (actualPool counts H.labels n t id) (size H counts n t) + (stageRefinementCount_pos counts H.labels n t) (actualPool_card counts H.labels n t id) + (readYZY H id hp) (readYZZ H id hp) (fun _ _ _ _ => fun i => H.labels n (word i)) + old y z x hy hz] + have hguard : + (y.2.1 = z.2.1 ∧ y.2.1 = x.2.1 ∧ + decodePool (actualPool counts H.labels n t id) (size H counts n t) + (actualPool_card counts H.labels n t id) old y.2.1 = (fun i => H.labels n (word i)) ∧ + y.2.2 = z.2.2) ↔ + (x.2.1 = y.2.1 ∧ x.2.1 = z.2.1 ∧ + eligible H id (appendCode old x.2.1) x.1 y.1 z.1 ∧ y.2.2 = z.2.2) := by + constructor + · rintro ⟨hyz, hyx, hdecode, hpair⟩ + refine ⟨hyx.symm, hyx.symm.trans hyz, ?_, hpair⟩ + apply (decode_eq_iff_eligible H old x.2.1 x.1 y.1 z.1 word hword).mp + simpa only [hyx] using hdecode + · rintro ⟨hxy, hxz, he, hpair⟩ + refine ⟨hxy.symm.trans hxz, hxy.symm, ?_, hpair⟩ + have hdecode := (decode_eq_iff_eligible H old x.2.1 x.1 y.1 z.1 word hword).mpr he + simpa only [hxy] using hdecode + unfold decodedLeading + simp only [hguard, GeometricStageCoordinates.yz_tensor_apply] + simp only [ite_and] + +end MatrixMultiplication.CompletionGeometricValues + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/Completion/HierarchyPrograms.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/Completion/HierarchyPrograms.lean new file mode 100644 index 0000000000000000000000000000000000000000..9f421a302116bd1d147b697dd92521f74159de75 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/Completion/HierarchyPrograms.lean @@ -0,0 +1,90 @@ +import OAI.LinearAlgebra.MatrixMultiplication.Completion.HierarchyWords +import OAI.LinearAlgebra.MatrixMultiplication.Completion.Labels + +namespace OAI + +/-! Readable tensor completion and its finite arithmetic realization. -/ + +noncomputable section + +namespace MatrixMultiplication.CompletionHierarchyWords + +open MatrixMultiplication.Foundation + +universe u v p q + +variable {A : Type u} + +namespace ReadableHierarchy + +open RecursiveCompletion CompletionLabels.TopologicalFlatten + +def ofProgram {Coord : Color → Type v} {Context : Type q} {Code : Type p} + [Fintype Code] {depth : ℕ} (s : Program A Coord Context Code depth) + (ctx : Context) (hctx : ∀ a, s.context a = ctx) + (joint : Function.Injective (fun a => (s.view .B a, s.view .C a, s.view .A a))) : + ReadableHierarchy A (Coord .B) (Coord .C) (Coord .A) where + Label := fun _ => Code + fintypeLabel := fun _ => inferInstance + labels := s.labels + depth := depth + pair := s.pair + x := s.view .B + y := s.view .C + z := s.view .A + coordinates_injective := joint + readXYX n _ prior own := s.read n .B ctx (Program.recordArray n prior) own + readXYY n _ prior own := s.read n .C ctx (Program.recordArray n prior) own + readXZX n _ prior own := s.read n .B ctx (Program.recordArray n prior) own + readXZZ n _ prior own := s.read n .A ctx (Program.recordArray n prior) own + readYZY n _ prior own := s.read n .C ctx (Program.recordArray n prior) own + readYZZ n _ prior own := s.read n .A ctx (Program.recordArray n prior) own + readXYX_readable n hn hp a := by + change s.read n .B ctx (Program.recordArray n (labelRecordOf s.labels n a)) + (s.view .B a) = s.labels n a + rw [Program.recordArray_labelRecordOf, ← hctx a] + exact s.readable n hn a .B (Or.inl (by simp only [hp, firstSide])) + readXYY_readable n hn hp a := by + change s.read n .C ctx (Program.recordArray n (labelRecordOf s.labels n a)) + (s.view .C a) = s.labels n a + rw [Program.recordArray_labelRecordOf, ← hctx a] + exact s.readable n hn a .C (Or.inr (by simp only [hp, secondSide])) + readXZX_readable n hn hp a := by + change s.read n .B ctx (Program.recordArray n (labelRecordOf s.labels n a)) + (s.view .B a) = s.labels n a + rw [Program.recordArray_labelRecordOf, ← hctx a] + exact s.readable n hn a .B (Or.inl (by simp only [hp, firstSide])) + readXZZ_readable n hn hp a := by + change s.read n .A ctx (Program.recordArray n (labelRecordOf s.labels n a)) + (s.view .A a) = s.labels n a + rw [Program.recordArray_labelRecordOf, ← hctx a] + exact s.readable n hn a .A (Or.inr (by simp only [hp, secondSide])) + readYZY_readable n hn hp a := by + change s.read n .C ctx (Program.recordArray n (labelRecordOf s.labels n a)) + (s.view .C a) = s.labels n a + rw [Program.recordArray_labelRecordOf, ← hctx a] + exact s.readable n hn a .C (Or.inl (by simp only [hp, firstSide])) + readYZZ_readable n hn hp a := by + change s.read n .A ctx (Program.recordArray n (labelRecordOf s.labels n a)) + (s.view .A a) = s.labels n a + rw [Program.recordArray_labelRecordOf, ← hctx a] + exact s.readable n hn a .A (Or.inr (by simp only [hp, secondSide])) + +theorem ofProgram_complete {Coord : Color → Type v} {Context : Type q} {Code : Type p} + [Fintype Code] {depth : ℕ} (s : Program A Coord Context Code depth) + (ctx : Context) (hctx : ∀ a, s.context a = ctx) + (joint : Function.Injective (fun a => (s.view .B a, s.view .C a, s.view .A a))) + (complete : s.Complete) : + Function.Injective (labelRecordOf (ofProgram s ctx hctx joint).labels depth) := by + intro a b h + apply complete a b ((hctx a).trans (hctx b).symm) + intro n hn + exact label_eq_of_record_eq s.labels h hn + +end ReadableHierarchy + +end MatrixMultiplication.CompletionHierarchyWords + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/Completion/HierarchyWords.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/Completion/HierarchyWords.lean new file mode 100644 index 0000000000000000000000000000000000000000..d883434633edaca99fa427517772f60df732b0bf --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/Completion/HierarchyWords.lean @@ -0,0 +1,335 @@ +import OAI.LinearAlgebra.MatrixMultiplication.Entropy.ComplexConditionalPrefixWords +import OAI.LinearAlgebra.MatrixMultiplication.Entropy.ConditionalLabels + +namespace OAI + +/-! Readable tensor completion and its finite arithmetic realization. -/ + +noncomputable section + +namespace MatrixMultiplication.CompletionHierarchyWords + +open MatrixMultiplication.Foundation ConditionalPrefixWords +open scoped BigOperators Classical + +universe u v x y z p q + +structure ReadableHierarchy (A : Type u) (X : Type x) (Y : Type y) (Z : Type z) where + Label : ℕ → Type v + fintypeLabel : ∀ n, Fintype (Label n) + labels : ∀ n, A → Label n + depth : ℕ + pair : ℕ → ReaderPair + x : A → X + y : A → Y + z : A → Z + coordinates_injective : Function.Injective (fun a => (x a, y a, z a)) + readXYX : (n : ℕ) → pair n = .xy → LabelRecord Label n → X → Label n + readXYY : (n : ℕ) → pair n = .xy → LabelRecord Label n → Y → Label n + readXZX : (n : ℕ) → pair n = .xz → LabelRecord Label n → X → Label n + readXZZ : (n : ℕ) → pair n = .xz → LabelRecord Label n → Z → Label n + readYZY : (n : ℕ) → pair n = .yz → LabelRecord Label n → Y → Label n + readYZZ : (n : ℕ) → pair n = .yz → LabelRecord Label n → Z → Label n + readXYX_readable : ∀ n, n < depth → ∀ (hp : pair n = .xy) (a : A), + readXYX n hp (labelRecordOf labels n a) (x a) = labels n a + readXYY_readable : ∀ n, n < depth → ∀ (hp : pair n = .xy) (a : A), + readXYY n hp (labelRecordOf labels n a) (y a) = labels n a + readXZX_readable : ∀ n, n < depth → ∀ (hp : pair n = .xz) (a : A), + readXZX n hp (labelRecordOf labels n a) (x a) = labels n a + readXZZ_readable : ∀ n, n < depth → ∀ (hp : pair n = .xz) (a : A), + readXZZ n hp (labelRecordOf labels n a) (z a) = labels n a + readYZY_readable : ∀ n, n < depth → ∀ (hp : pair n = .yz) (a : A), + readYZY n hp (labelRecordOf labels n a) (y a) = labels n a + readYZZ_readable : ∀ n, n < depth → ∀ (hp : pair n = .yz) (a : A), + readYZZ n hp (labelRecordOf labels n a) (z a) = labels n a + +attribute [instance] ReadableHierarchy.fintypeLabel + +variable {A : Type u} {X : Type x} {Y : Type y} {Z : Type z} +variable (H : ReadableHierarchy A X Y Z) +variable {Position : Type p} [Fintype Position] + +def longX (word : Position → A) : Position → X := fun i => H.x (word i) +def longY (word : Position → A) : Position → Y := fun i => H.y (word i) +def longZ (word : Position → A) : Position → Z := fun i => H.z (word i) + +omit [Fintype Position] in +theorem longCoordinates_injective : Function.Injective + (fun word : Position → A => (longX H word, longY H word, longZ H word)) := by + intro word other h + funext i + apply H.coordinates_injective + exact Prod.ext (congrFun (congrArg Prod.fst h) i) + (Prod.ext (congrFun (congrArg (fun q => q.2.1) h) i) + (congrFun (congrArg (fun q => q.2.2) h) i)) + +variable [Fintype A] {Prefix : Type q} {counts : A → ℕ} {n t : ℕ} + +def Represents (priorWord : Prefix → ExactPrefix counts H.labels n t Position) + (prior : Prefix) (u : Position → X) (v : Position → Y) (w : Position → Z) + (word : Position → A) : Prop := + u = longX H word ∧ v = longY H word ∧ w = longZ H word ∧ + ∀ i, (priorWord prior).val i = labelRecordOf H.labels n (word i) + +def eligible (priorWord : Prefix → ExactPrefix counts H.labels n t Position) + (prior : Prefix) (u : Position → X) (v : Position → Y) (w : Position → Z) : Prop := + ∃ word : Position → A, Represents H priorWord prior u v w word + +def readXYX (priorWord : Prefix → ExactPrefix counts H.labels n t Position) + (hp : H.pair n = .xy) (prior : Prefix) (own : Position → X) : Position → H.Label n := + fun i => H.readXYX n hp ((priorWord prior).val i) (own i) + +theorem readXYX_on_original_word + (priorWord : Prefix → ExactPrefix counts H.labels n t Position) + (hp : H.pair n = .xy) (prior : Prefix) (word : Position → A) + (hn : n < H.depth) + (hprior : ∀ i, (priorWord prior).val i = labelRecordOf H.labels n (word i)) : + readXYX H priorWord hp prior (longX H word) = fun i => H.labels n (word i) := by + funext i + change H.readXYX n hp ((priorWord prior).val i) (H.x (word i)) = H.labels n (word i) + rw [hprior i] + exact H.readXYX_readable n hn hp (word i) + +def readXYY (priorWord : Prefix → ExactPrefix counts H.labels n t Position) + (hp : H.pair n = .xy) (prior : Prefix) (own : Position → Y) : Position → H.Label n := + fun i => H.readXYY n hp ((priorWord prior).val i) (own i) + +theorem readXYY_on_original_word + (priorWord : Prefix → ExactPrefix counts H.labels n t Position) + (hp : H.pair n = .xy) (prior : Prefix) (word : Position → A) + (hn : n < H.depth) + (hprior : ∀ i, (priorWord prior).val i = labelRecordOf H.labels n (word i)) : + readXYY H priorWord hp prior (longY H word) = fun i => H.labels n (word i) := by + funext i + change H.readXYY n hp ((priorWord prior).val i) (H.y (word i)) = H.labels n (word i) + rw [hprior i] + exact H.readXYY_readable n hn hp (word i) + +def readXZX (priorWord : Prefix → ExactPrefix counts H.labels n t Position) + (hp : H.pair n = .xz) (prior : Prefix) (own : Position → X) : Position → H.Label n := + fun i => H.readXZX n hp ((priorWord prior).val i) (own i) + +theorem readXZX_on_original_word + (priorWord : Prefix → ExactPrefix counts H.labels n t Position) + (hp : H.pair n = .xz) (prior : Prefix) (word : Position → A) + (hn : n < H.depth) + (hprior : ∀ i, (priorWord prior).val i = labelRecordOf H.labels n (word i)) : + readXZX H priorWord hp prior (longX H word) = fun i => H.labels n (word i) := by + funext i + change H.readXZX n hp ((priorWord prior).val i) (H.x (word i)) = H.labels n (word i) + rw [hprior i] + exact H.readXZX_readable n hn hp (word i) + +def readXZZ (priorWord : Prefix → ExactPrefix counts H.labels n t Position) + (hp : H.pair n = .xz) (prior : Prefix) (own : Position → Z) : Position → H.Label n := + fun i => H.readXZZ n hp ((priorWord prior).val i) (own i) + +theorem readXZZ_on_original_word + (priorWord : Prefix → ExactPrefix counts H.labels n t Position) + (hp : H.pair n = .xz) (prior : Prefix) (word : Position → A) + (hn : n < H.depth) + (hprior : ∀ i, (priorWord prior).val i = labelRecordOf H.labels n (word i)) : + readXZZ H priorWord hp prior (longZ H word) = fun i => H.labels n (word i) := by + funext i + change H.readXZZ n hp ((priorWord prior).val i) (H.z (word i)) = H.labels n (word i) + rw [hprior i] + exact H.readXZZ_readable n hn hp (word i) + +def readYZY (priorWord : Prefix → ExactPrefix counts H.labels n t Position) + (hp : H.pair n = .yz) (prior : Prefix) (own : Position → Y) : Position → H.Label n := + fun i => H.readYZY n hp ((priorWord prior).val i) (own i) + +theorem readYZY_on_original_word + (priorWord : Prefix → ExactPrefix counts H.labels n t Position) + (hp : H.pair n = .yz) (prior : Prefix) (word : Position → A) + (hn : n < H.depth) + (hprior : ∀ i, (priorWord prior).val i = labelRecordOf H.labels n (word i)) : + readYZY H priorWord hp prior (longY H word) = fun i => H.labels n (word i) := by + funext i + change H.readYZY n hp ((priorWord prior).val i) (H.y (word i)) = H.labels n (word i) + rw [hprior i] + exact H.readYZY_readable n hn hp (word i) + +def readYZZ (priorWord : Prefix → ExactPrefix counts H.labels n t Position) + (hp : H.pair n = .yz) (prior : Prefix) (own : Position → Z) : Position → H.Label n := + fun i => H.readYZZ n hp ((priorWord prior).val i) (own i) + +theorem readYZZ_on_original_word + (priorWord : Prefix → ExactPrefix counts H.labels n t Position) + (hp : H.pair n = .yz) (prior : Prefix) (word : Position → A) + (hn : n < H.depth) + (hprior : ∀ i, (priorWord prior).val i = labelRecordOf H.labels n (word i)) : + readYZZ H priorWord hp prior (longZ H word) = fun i => H.labels n (word i) := by + funext i + change H.readYZZ n hp ((priorWord prior).val i) (H.z (word i)) = H.labels n (word i) + rw [hprior i] + exact H.readYZZ_readable n hn hp (word i) + +theorem readable_XY + (priorWord : Prefix → ExactPrefix counts H.labels n t Position) + (hp : H.pair n = .xy) (prior : Prefix) + (u : Position → X) (v : Position → Y) (w : Position → Z) + (hn : n < H.depth) (h : eligible H priorWord prior u v w) : + readXYX H priorWord hp prior u = + readXYY H priorWord hp prior v := by + obtain ⟨word, hu, hv, hw, hprior⟩ := h + rw [hu, hv] + rw [readXYX_on_original_word H priorWord hp prior word hn hprior, + readXYY_on_original_word H priorWord hp prior word hn hprior] + +theorem readable_XZ + (priorWord : Prefix → ExactPrefix counts H.labels n t Position) + (hp : H.pair n = .xz) (prior : Prefix) + (u : Position → X) (v : Position → Y) (w : Position → Z) + (hn : n < H.depth) (h : eligible H priorWord prior u v w) : + readXZX H priorWord hp prior u = + readXZZ H priorWord hp prior w := by + obtain ⟨word, hu, hv, hw, hprior⟩ := h + rw [hu, hw] + rw [readXZX_on_original_word H priorWord hp prior word hn hprior, + readXZZ_on_original_word H priorWord hp prior word hn hprior] + +theorem readable_YZ + (priorWord : Prefix → ExactPrefix counts H.labels n t Position) + (hp : H.pair n = .yz) (prior : Prefix) + (u : Position → X) (v : Position → Y) (w : Position → Z) + (hn : n < H.depth) (h : eligible H priorWord prior u v w) : + readYZY H priorWord hp prior v = + readYZZ H priorWord hp prior w := by + obtain ⟨word, hu, hv, hw, hprior⟩ := h + rw [hv, hw] + rw [readYZY_on_original_word H priorWord hp prior word hn hprior, + readYZZ_on_original_word H priorWord hp prior word hn hprior] + +theorem represented_word_unique + (priorWord : Prefix → ExactPrefix counts H.labels n t Position) (prior : Prefix) + (u : Position → X) (v : Position → Y) (w : Position → Z) {word other : Position → A} + (hword : Represents H priorWord prior u v w word) + (hother : Represents H priorWord prior u v w other) : word = other := by + apply longCoordinates_injective H + exact Prod.ext (hword.1.symm.trans hother.1) + (Prod.ext (hword.2.1.symm.trans hother.2.1) + (hword.2.2.1.symm.trans hother.2.2.1)) + +theorem eligible_appendCode_iff + (old : ExactPrefix counts H.labels n t Position) + (code : Fin (StageHierarchyResources.stageRefinementCount counts H.labels n t)) + (u : Position → X) (v : Position → Y) (w : Position → Z) : + eligible H id (appendCode old code) u v w ↔ + ∃ word : Position → A, Represents H id old u v w word ∧ + ((conditionalPoolEquivFin old).symm code).val = + (fun i => H.labels n (word i)) := by + constructor + · rintro ⟨word, hu, hv, hw, hprior⟩ + refine ⟨word, ⟨hu, hv, hw, ?_⟩, ?_⟩ + · intro i + have hi := hprior i + change (old.val i, ((conditionalPoolEquivFin old).symm code).val i) = + (labelRecordOf H.labels n (word i), H.labels n (word i)) at hi + exact congrArg Prod.fst hi + · funext i + have hi := hprior i + change (old.val i, ((conditionalPoolEquivFin old).symm code).val i) = + (labelRecordOf H.labels n (word i), H.labels n (word i)) at hi + exact congrArg Prod.snd hi + · rintro ⟨word, ⟨hu, hv, hw, hprior⟩, hfine⟩ + refine ⟨word, hu, hv, hw, ?_⟩ + intro i + change (old.val i, ((conditionalPoolEquivFin old).symm code).val i) = + (labelRecordOf H.labels n (word i), H.labels n (word i)) + exact Prod.ext (hprior i) (congrFun hfine i) + +theorem represented_fine_eq + (priorWord : Prefix → ExactPrefix counts H.labels n t Position) (prior : Prefix) + (u : Position → X) (v : Position → Y) (w : Position → Z) {word other : Position → A} + (hword : Represents H priorWord prior u v w word) + (hother : Represents H priorWord prior u v w other) : + (fun i => H.labels n (word i)) = (fun i => H.labels n (other i)) := by + rw [represented_word_unique H priorWord prior u v w hword hother] + +theorem eligible_appendCode_iff_of_represents + (old : ExactPrefix counts H.labels n t Position) + (code : Fin (StageHierarchyResources.stageRefinementCount counts H.labels n t)) + (u : Position → X) (v : Position → Y) (w : Position → Z) (word : Position → A) + (hword : Represents H id old u v w word) : + eligible H id (appendCode old code) u v w ↔ + ((conditionalPoolEquivFin old).symm code).val = (fun i => H.labels n (word i)) := by + rw [eligible_appendCode_iff] + constructor + · rintro ⟨other, hother, hfine⟩ + exact hfine.trans (represented_fine_eq H id old u v w hother hword) + · intro hfine + exact ⟨word, hword, hfine⟩ + +theorem root_eligible_iff + (old : ExactPrefix counts H.labels 0 t Position) + (u : Position → X) (v : Position → Y) (w : Position → Z) : + eligible H id old u v w ↔ ∀ i, ∃ a : A, + H.x a = u i ∧ H.y a = v i ∧ H.z a = w i := by + constructor + · rintro ⟨word, hu, hv, hw, _⟩ i + refine ⟨word i, ?_, ?_, ?_⟩ + · exact (congrFun hu i).symm + · exact (congrFun hv i).symm + · exact (congrFun hw i).symm + · intro h + choose word hx hy hz using h + refine ⟨word, ?_, ?_, ?_, ?_⟩ + · funext i + exact (hx i).symm + · funext i + exact (hy i).symm + · funext i + exact (hz i).symm + · intro i + exact Subsingleton.elim _ _ + +def terminalWord (complete : Function.Injective (labelRecordOf H.labels H.depth)) + (last : ExactPrefix counts H.labels H.depth t Position) : + PopulationWords Position (fun a => t * counts a) := by + let source := sourcePrefixEquiv counts H.labels H.depth t Position complete last + refine ⟨source.val, ?_⟩ + intro a + refine Eq.trans ?_ (source.property a) + unfold wordPopulation + exact congrArg + (fun inst : Fintype {i : Position // source.val i = a} => @Fintype.card _ inst) + (Subsingleton.elim _ _) + +theorem terminalWord_record + (complete : Function.Injective (labelRecordOf H.labels H.depth)) + (last : ExactPrefix counts H.labels H.depth t Position) (i : Position) : + labelRecordOf H.labels H.depth ((terminalWord H complete last).val i) = last.val i := + sourceSymbol_record last i + +theorem terminalWord_of_represents + (complete : Function.Injective (labelRecordOf H.labels H.depth)) + (last : ExactPrefix counts H.labels H.depth t Position) + (u : Position → X) (v : Position → Y) (w : Position → Z) + (word : Position → A) (hword : Represents H id last u v w word) : + (terminalWord H complete last).val = word := by + funext i + exact (sourceSymbol_eq_iff complete last i (word i)).2 (hword.2.2.2 i) + +theorem terminal_eligible_iff + (complete : Function.Injective (labelRecordOf H.labels H.depth)) + (last : ExactPrefix counts H.labels H.depth t Position) + (u : Position → X) (v : Position → Y) (w : Position → Z) : + eligible H id last u v w ↔ + u = longX H (terminalWord H complete last).val ∧ + v = longY H (terminalWord H complete last).val ∧ + w = longZ H (terminalWord H complete last).val := by + constructor + · rintro ⟨word, hword⟩ + rw [terminalWord_of_represents H complete last u v w word hword] + exact ⟨hword.1, hword.2.1, hword.2.2.1⟩ + · rintro ⟨hu, hv, hw⟩ + refine ⟨(terminalWord H complete last).val, hu, hv, hw, ?_⟩ + intro i + exact (terminalWord_record H complete last i).symm + +end MatrixMultiplication.CompletionHierarchyWords + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/Completion/Labels.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/Completion/Labels.lean new file mode 100644 index 0000000000000000000000000000000000000000..c2e89d0c52fc28ffa85ab270fded6b5417489d61 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/Completion/Labels.lean @@ -0,0 +1,1285 @@ +import OAI.LinearAlgebra.MatrixMultiplication.Completion.Scripts +import OAI.LinearAlgebra.MatrixMultiplication.Entropy.ConditionalLabels + +namespace OAI + +/-! Readable tensor completion and its finite arithmetic realization. -/ + +noncomputable section + +universe uCoord + +namespace MatrixMultiplication.CompletionLabels + +open MatrixMultiplication.Foundation RecursiveCompletion +open scoped BigOperators +attribute [local instance] Classical.propDecidable Classical.decEq + +variable {X Y Z : Type uCoord} + +def Leaf (S : FlaggedTensor X Y Z) := + {p : X × Y × Z // S.tensor p.1 p.2.1 p.2.2 ≠ 0} + +instance leafFintype [Fintype X] [Fintype Y] [Fintype Z] + (S : FlaggedTensor X Y Z) : Fintype (Leaf S) := + inferInstanceAs (Fintype {p : X × Y × Z // S.tensor p.1 p.2.1 p.2.2 ≠ 0}) + +def Coordinate (X Y Z : Type uCoord) : Color → Type uCoord + | .B => X + | .A => Z + | .C => Y + +def coordinate (p : X × Y × Z) : (c : Color) → Coordinate X Y Z c + | .B => p.1 + | .A => p.2.2 + | .C => p.2.1 + +def ownerFlag (S : FlaggedTensor X Y Z) : (c : Color) → Coordinate X Y Z c → Prop + | .B => S.flagB + | .A => S.flagA + | .C => S.flagC + +def leafColor (S : FlaggedTensor X Y Z) (a : Leaf S) : Color := + if S.flagB a.val.1 then .B else if S.flagA a.val.2.2 then .A else .C + +theorem leafColor_eq_iff (S : FlaggedTensor X Y Z) (a : Leaf S) (c : Color) : + leafColor S a = c ↔ ownerFlag S c (coordinate a.val c) := by + have h := S.one_hot _ _ _ a.property + cases c <;> + by_cases hb : S.flagB a.val.1 <;> + by_cases ha : S.flagA a.val.2.2 <;> + by_cases hc : S.flagC a.val.2.1 <;> + simp_all [leafColor, ownerFlag, coordinate] + +theorem complete_supported (S : FlaggedTensor X Y Z) (center : Color) (m : ℕ) + (a : Leaf (complete S center m)) : + Tensor.power S.tensor m a.val.1 a.val.2.1 a.val.2.2 ≠ 0 := by + have h := a.property + change (if weight S center m a.val.1 a.val.2.1 a.val.2.2 = 1 then + Tensor.power S.tensor m a.val.1 a.val.2.1 a.val.2.2 else 0) ≠ 0 at h + split_ifs at h with hw + · exact h + · exact False.elim (h rfl) + +def slot (S : FlaggedTensor X Y Z) (center : Color) (m : ℕ) + (a : Leaf (complete S center m)) (i : Fin m) : Leaf S := + ⟨(a.val.1 i, a.val.2.1 i, a.val.2.2 i), + (Finset.prod_ne_zero_iff.mp (complete_supported S center m a)) i (Finset.mem_univ i)⟩ + +def pattern (S : FlaggedTensor X Y Z) (center : Color) (m : ℕ) + (a : Leaf (complete S center m)) : Fin m → Color := + fun i => leafColor S (slot S center m a i) + +theorem slot_injective (S : FlaggedTensor X Y Z) (center : Color) (m : ℕ) : + Function.Injective (slot S center m) := by + intro a b h + apply Subtype.ext + apply Prod.ext + · funext i + exact congrArg (fun w : Leaf S => w.val.1) (congrFun h i) + · apply Prod.ext + · funext i + exact congrArg (fun w : Leaf S => w.val.2.1) (congrFun h i) + · funext i + exact congrArg (fun w : Leaf S => w.val.2.2) (congrFun h i) + +theorem completed_color_iff (S : FlaggedTensor X Y Z) (center : Color) (m : ℕ) + (a : Leaf (complete S center m)) (c : Color) : + leafColor (complete S center m) a = c ↔ + raisedFlag center c (fun i => pattern S center m a i = c) := by + rw [leafColor_eq_iff] + have hold (i : Fin m) := leafColor_eq_iff S (slot S center m a i) c + have heq : (fun i => pattern S center m a i = c) = + (fun i => ownerFlag S c (coordinate (slot S center m a i).val c)) := by + funext i + exact propext (hold i) + rw [heq] + cases c <;> rfl + +theorem pattern_mem (S : FlaggedTensor X Y Z) (center : Color) (m : ℕ) + (a : Leaf (complete S center m)) (i : Fin m) : + pattern S center m a i = center ∨ + pattern S center m a i = leafColor (complete S center m) a := by + by_cases hc : pattern S center m a i = center + · exact Or.inl hc + · right + have hn : center ≠ pattern S center m a i := Ne.symm hc + have hnew : leafColor (complete S center m) a = pattern S center m a i := by + apply (completed_color_iff S center m a _).mpr + simp only [raisedFlag, ite_eq_right hn] + exact ⟨i, rfl⟩ + exact hnew.symm + +theorem pattern_eq_center (S : FlaggedTensor X Y Z) (center : Color) (m : ℕ) + (a : Leaf (complete S center m)) + (h : leafColor (complete S center m) a = center) : + pattern S center m a = fun _ => center := by + funext i + have hi := pattern_mem S center m a i + simpa only [h, or_self] using hi + +def centerRead (S : FlaggedTensor X Y Z) (center output : Color) (m : ℕ) + (u : Fin m → Coordinate X Y Z center) : Fin m → Color := + fun i => if ownerFlag S center (u i) then center else output + +def outputRead (S : FlaggedTensor X Y Z) (center output : Color) (m : ℕ) + (u : Fin m → Coordinate X Y Z output) : Fin m → Color := + fun i => if ownerFlag S output (u i) then output else center + +theorem centerRead_pattern (S : FlaggedTensor X Y Z) (center : Color) (m : ℕ) + (a : Leaf (complete S center m)) : + centerRead S center (leafColor (complete S center m) a) m + (fun i => coordinate (slot S center m a i).val center) = pattern S center m a := by + funext i + have hc := leafColor_eq_iff S (slot S center m a i) center + change (if ownerFlag S center _ then center else _) = _ + by_cases h : pattern S center m a i = center + · rw [ite_eq_left (hc.mp h), h] + · rw [ite_eq_right (fun hf => h (hc.mpr hf))] + exact (Or.resolve_left (pattern_mem S center m a i) h).symm + +theorem outputRead_pattern (S : FlaggedTensor X Y Z) (center : Color) (m : ℕ) + (a : Leaf (complete S center m)) : + outputRead S center (leafColor (complete S center m) a) m + (fun i => coordinate (slot S center m a i).val + (leafColor (complete S center m) a)) = pattern S center m a := by + funext i + have hc := leafColor_eq_iff S (slot S center m a i) + (leafColor (complete S center m) a) + change (if ownerFlag S _ _ then _ else center) = _ + by_cases h : pattern S center m a i = leafColor (complete S center m) a + · rw [ite_eq_left (hc.mp h), h] + · rw [ite_eq_right (fun hf => h (hc.mpr hf))] + exact (Or.resolve_right (pattern_mem S center m a i) h).symm + +theorem raisedFlag_iff_output {I : Type*} (p : I → Color) (center output : Color) + (active : raisedFlag center output (fun i => p i = output)) + (allowed : ∀ i, p i = center ∨ p i = output) (c : Color) : + raisedFlag center c (fun i => p i = c) ↔ c = output := by + constructor + · intro hc + by_contra hco + by_cases hcc : center = c + · subst c + have hne : center ≠ output := hco + have ha : ∃ i, p i = output := by + simpa only [raisedFlag, ite_eq_right hne] using active + have hall : ∀ i, p i = center := by + simpa only [raisedFlag, ite_eq_left rfl, ite_true] using hc + obtain ⟨i, hi⟩ := ha + exact hne ((hall i).symm.trans hi) + · have ha : ∃ i, p i = c := by + simpa only [raisedFlag, ite_eq_right hcc] using hc + obtain ⟨i, hi⟩ := ha + rcases allowed i with h | h + · exact hcc (h.symm.trans hi) + · exact hco (hi.symm.trans h) + · rintro rfl + exact active + +def wordCoordinates {m : ℕ} (S : FlaggedTensor X Y Z) (w : Fin m → Leaf S) : + (Fin m → X) × (Fin m → Y) × (Fin m → Z) := + (fun i => (w i).val.1, fun i => (w i).val.2.1, fun i => (w i).val.2.2) + +theorem word_ownerFlag (S : FlaggedTensor X Y Z) (center : Color) (m : ℕ) + (w : Fin m → Leaf S) (c : Color) : + ownerFlag (complete S center m) c (coordinate (wordCoordinates S w) c) ↔ + raisedFlag center c (fun i => leafColor S (w i) = c) := by + have heq : (fun i => leafColor S (w i) = c) = + (fun i => ownerFlag S c (coordinate (w i).val c)) := by + funext i + exact propext (leafColor_eq_iff S (w i) c) + rw [heq] + cases c <;> rfl + +def packLeaf (S : FlaggedTensor X Y Z) (center output : Color) (m : ℕ) + (w : Fin m → Leaf S) + (active : raisedFlag center output (fun i => leafColor S (w i) = output)) + (allowed : ∀ i, leafColor S (w i) = center ∨ leafColor S (w i) = output) : + Leaf (complete S center m) := by + have hflag (c : Color) : + ownerFlag (complete S center m) c (coordinate (wordCoordinates S w) c) ↔ + c = output := + (word_ownerFlag S center m w c).trans + (raisedFlag_iff_output _ center output active allowed c) + have hw : weight S center m (wordCoordinates S w).1 + (wordCoordinates S w).2.1 (wordCoordinates S w).2.2 = 1 := by + have hb := hflag .B + have ha := hflag .A + have hc := hflag .C + change flagB S center m (wordCoordinates S w).1 ↔ Color.B = output at hb + change flagA S center m (wordCoordinates S w).2.2 ↔ Color.A = output at ha + change flagC S center m (wordCoordinates S w).2.1 ↔ Color.C = output at hc + simp only [weight, hb, ha, hc] + cases output <;> simp + refine ⟨wordCoordinates S w, ?_⟩ + rw [complete_tensor, ite_eq_left hw] + apply Finset.prod_ne_zero_iff.mpr + intro i _ + exact (w i).property + +@[simp] theorem slot_packLeaf (S : FlaggedTensor X Y Z) (center output : Color) (m : ℕ) + (w : Fin m → Leaf S) (active) (allowed) : + slot S center m (packLeaf S center output m w active allowed) = w := by + funext i + apply Subtype.ext + rfl + +theorem packLeaf_color (S : FlaggedTensor X Y Z) (center output : Color) (m : ℕ) + (w : Fin m → Leaf S) (active) (allowed) : + leafColor (complete S center m) (packLeaf S center output m w active allowed) = output := by + apply (completed_color_iff S center m _ output).mpr + simpa only [pattern, slot_packLeaf] using active + +def conditionalLeafEquiv (S : FlaggedTensor X Y Z) (center output : Color) (m : ℕ) : + {a : Leaf (complete S center m) // leafColor (complete S center m) a = output} ≃ + {w : Fin m → Leaf S // + raisedFlag center output (fun i => leafColor S (w i) = output) ∧ + ∀ i, leafColor S (w i) = center ∨ leafColor S (w i) = output} where + toFun a := ⟨slot S center m a.val, + (completed_color_iff S center m a.val output).mp a.property, + fun i => by simpa only [pattern, ← a.property] using pattern_mem S center m a.val i⟩ + invFun w := ⟨packLeaf S center output m w.val w.property.1 w.property.2, + packLeaf_color S center output m w.val w.property.1 w.property.2⟩ + left_inv a := by + apply Subtype.ext + apply slot_injective S center m + simp only [slot_packLeaf] + right_inv w := by + apply Subtype.ext + simp only [slot_packLeaf] + +def RetainedLeaf (S : FlaggedTensor X Y Z) (first second : Color) := + {a : Leaf S // leafColor S a = first ∨ leafColor S a = second} + +instance retainedLeafFintype [Fintype X] [Fintype Y] [Fintype Z] + (S : FlaggedTensor X Y Z) (first second : Color) : + Fintype (RetainedLeaf S first second) := + inferInstanceAs (Fintype {a : Leaf S // leafColor S a = first ∨ leafColor S a = second}) + +def terminationFirstRead (S : FlaggedTensor X Y Z) (first second : Color) + (u : Coordinate X Y Z first) : Color := + if ownerFlag S first u then first else second + +def terminationSecondRead (S : FlaggedTensor X Y Z) (first second : Color) + (u : Coordinate X Y Z second) : Color := + if ownerFlag S second u then second else first + +theorem termination_readable (S : FlaggedTensor X Y Z) (first second : Color) + (a : RetainedLeaf S first second) : + terminationFirstRead S first second (coordinate a.val.val first) = leafColor S a.val ∧ + terminationSecondRead S first second (coordinate a.val.val second) = leafColor S a.val := by + have hf := leafColor_eq_iff S a.val first + have hs := leafColor_eq_iff S a.val second + constructor + · by_cases h : leafColor S a.val = first + · simp only [terminationFirstRead, ite_eq_left (hf.mp h), h] + · rw [terminationFirstRead, ite_eq_right (fun hflag => h (hf.mpr hflag))] + exact (Or.resolve_left a.property h).symm + · by_cases h : leafColor S a.val = second + · simp only [terminationSecondRead, ite_eq_left (hs.mp h), h] + · rw [terminationSecondRead, ite_eq_right (fun hflag => h (hs.mpr hflag))] + exact (Or.resolve_right a.property h).symm + +end MatrixMultiplication.CompletionLabels +namespace MatrixMultiplication.CompletionLabels.TopologicalFlatten + +open MatrixMultiplication.Foundation RecursiveCompletion + +universe u v + +def firstSide : ReaderPair → Color + | .xy => .B + | .xz => .B + | .yz => .C + +def secondSide : ReaderPair → Color + | .xy => .C + | .xz => .A + | .yz => .A + +structure NodeSchedule (A : Type u) where + arity : ℕ → ℕ + readerPair : ℕ → ReaderPair + active : ℕ → A → Bool + branch : (n : ℕ) → A → Fin (arity n) + +namespace NodeSchedule + +variable {A : Type u} + +def Label (s : NodeSchedule A) (n : ℕ) : Type := Option (Fin (s.arity n)) + +instance labelFintype (s : NodeSchedule A) (n : ℕ) : Fintype (s.Label n) := + inferInstanceAs (Fintype (Option (Fin (s.arity n)))) + +def labels (s : NodeSchedule A) (n : ℕ) (a : A) : s.Label n := + if s.active n a then some (s.branch n a) else none + +@[simp] theorem labels_of_inactive (s : NodeSchedule A) (n : ℕ) (a : A) + (h : s.active n a = false) : s.labels n a = none := by + simp [labels, h]; rfl + +@[simp] theorem labels_of_active (s : NodeSchedule A) (n : ℕ) (a : A) + (h : s.active n a = true) : s.labels n a = some (s.branch n a) := by + simp [labels, h]; rfl + +theorem labels_eq_iff (s : NodeSchedule A) (n : ℕ) (a b : A) : + s.labels n a = s.labels n b ↔ + s.active n a = s.active n b ∧ + (s.active n a = true → s.branch n a = s.branch n b) := by + cases ha : s.active n a <;> cases hb : s.active n b <;> + simp [labels, ha, hb] + · rfl + · exact ⟨Option.some.inj, congrArg some⟩ + +def Complete (s : NodeSchedule A) (depth : ℕ) : Prop := + ∀ a b, (∀ n, n < depth → + s.active n a = s.active n b ∧ + (s.active n a = true → s.branch n a = s.branch n b)) → a = b + +end NodeSchedule + +structure TopologicalSchedule (A : Type u) (Coord : Color → Type v) (depth : ℕ) + extends NodeSchedule A where + view : (c : Color) → A → Coord c + activate : (n : ℕ) → LabelRecord toNodeSchedule.Label n → Bool + activate_correct : ∀ n, n < depth → ∀ a, + activate n (labelRecordOf toNodeSchedule.labels n a) = active n a + localFirst : (n : ℕ) → Coord (firstSide (readerPair n)) → Fin (arity n) + localSecond : (n : ℕ) → Coord (secondSide (readerPair n)) → Fin (arity n) + localFirst_read : ∀ n, n < depth → ∀ a, active n a = true → + localFirst n (view (firstSide (readerPair n)) a) = branch n a + localSecond_read : ∀ n, n < depth → ∀ a, active n a = true → + localSecond n (view (secondSide (readerPair n)) a) = branch n a + +namespace TopologicalSchedule + +variable {A : Type u} {Coord : Color → Type v} {depth : ℕ} + +def pairs (s : TopologicalSchedule A Coord depth) : Fin depth → ReaderPair := + fun n => s.readerPair n.val + +def firstReader (s : TopologicalSchedule A Coord depth) (n : ℕ) + (prior : LabelRecord s.toNodeSchedule.Label n) + (own : Coord (firstSide (s.readerPair n))) : s.toNodeSchedule.Label n := + if s.activate n prior then some (s.localFirst n own) else none + +def secondReader (s : TopologicalSchedule A Coord depth) (n : ℕ) + (prior : LabelRecord s.toNodeSchedule.Label n) + (own : Coord (secondSide (s.readerPair n))) : s.toNodeSchedule.Label n := + if s.activate n prior then some (s.localSecond n own) else none + +theorem firstReader_readable (s : TopologicalSchedule A Coord depth) + (n : ℕ) (hn : n < depth) (a : A) : + s.firstReader n (labelRecordOf s.toNodeSchedule.labels n a) + (s.view (firstSide (s.readerPair n)) a) = + s.toNodeSchedule.labels n a := by + simp only [firstReader, NodeSchedule.labels, s.activate_correct n hn a] + by_cases h : s.active n a = true + · simp [h, s.localFirst_read n hn a h]; rfl + · simp [h]; rfl + +theorem secondReader_readable (s : TopologicalSchedule A Coord depth) + (n : ℕ) (hn : n < depth) (a : A) : + s.secondReader n (labelRecordOf s.toNodeSchedule.labels n a) + (s.view (secondSide (s.readerPair n)) a) = + s.toNodeSchedule.labels n a := by + simp only [secondReader, NodeSchedule.labels, s.activate_correct n hn a] + by_cases h : s.active n a = true + · simp [h, s.localSecond_read n hn a h]; rfl + · simp [h]; rfl + +theorem readers_off_branch (s : TopologicalSchedule A Coord depth) + (n : ℕ) (hn : n < depth) (a : A) (ha : s.active n a = false) + (ownFirst : Coord (firstSide (s.readerPair n))) + (ownSecond : Coord (secondSide (s.readerPair n))) : + s.firstReader n (labelRecordOf s.toNodeSchedule.labels n a) ownFirst = none ∧ + s.secondReader n (labelRecordOf s.toNodeSchedule.labels n a) ownSecond = none := by + simp [firstReader, secondReader, s.activate_correct n hn a, ha]; rfl + +end TopologicalSchedule + +theorem labelRecordOf_eq_prefix {A : Type u} {Label : ℕ → Type v} + (labels : ∀ n, A → Label n) {a b : A} : + ∀ {m k : ℕ}, k ≤ m → + labelRecordOf labels m a = labelRecordOf labels m b → + labelRecordOf labels k a = labelRecordOf labels k b := by + intro m + induction m with + | zero => + intro k hk _ + have hk0 : k = 0 := Nat.eq_zero_of_le_zero hk + subst k + rfl + | succ m ih => + intro k hk h + rcases Nat.eq_or_lt_of_le hk with hk | hk + · subst k + exact h + · exact ih (Nat.le_of_lt_succ hk) (congrArg Prod.fst h) + +theorem label_eq_of_record_eq {A : Type u} {Label : ℕ → Type v} + (labels : ∀ n, A → Label n) {depth n : ℕ} {a b : A} + (h : labelRecordOf labels depth a = labelRecordOf labels depth b) + (hn : n < depth) : labels n a = labels n b := by + have hp : labelRecordOf labels (n + 1) a = + labelRecordOf labels (n + 1) b := + labelRecordOf_eq_prefix labels (Nat.succ_le_of_lt hn) h + exact congrArg Prod.snd hp + +namespace NodeSchedule + +theorem completeRecord_injective {A : Type u} (s : NodeSchedule A) (depth : ℕ) + (complete : s.Complete depth) : + Function.Injective (labelRecordOf s.labels depth) := by + intro a b h + apply complete a b + intro n hn + exact (s.labels_eq_iff n a b).mp (label_eq_of_record_eq s.labels h hn) + +end NodeSchedule + +namespace TopologicalSchedule + +variable {A : Type u} {Coord : Color → Type v} {depth : ℕ} + +theorem completeRecord_injective (s : TopologicalSchedule A Coord depth) + (complete : s.toNodeSchedule.Complete depth) : + Function.Injective (labelRecordOf s.toNodeSchedule.labels depth) := + s.toNodeSchedule.completeRecord_injective depth complete + +end TopologicalSchedule +end MatrixMultiplication.CompletionLabels.TopologicalFlatten + +namespace MatrixMultiplication.CompletionLabels + +open RecursiveCompletion TopologicalFlatten +attribute [local instance] Classical.propDecidable Classical.decEq + +variable {X Y Z : Type uCoord} + +def ownerPair : Color → Color → ReaderPair + | .B, .A | .A, .B => .xz + | .A, .C | .C, .A => .yz + | _, _ => .xy + +theorem ownerPair_first_mem (center output : Color) (h : center ≠ output) : + firstSide (ownerPair center output) = center ∨ + firstSide (ownerPair center output) = output := by + cases center <;> cases output <;> simp_all [ownerPair, firstSide] + +theorem ownerPair_second_mem (center output : Color) (h : center ≠ output) : + secondSide (ownerPair center output) = center ∨ + secondSide (ownerPair center output) = output := by + cases center <;> cases output <;> simp_all [ownerPair, secondSide] + +def patternSideRead (S : FlaggedTensor X Y Z) (center output side : Color) (m : ℕ) + (u : Fin m → Coordinate X Y Z side) : Fin m → Color := + if center = output then fun _ => center + else if side = center then fun i => if ownerFlag S side (u i) then center else output + else fun i => if ownerFlag S side (u i) then output else center + +theorem patternSideRead_correct (S : FlaggedTensor X Y Z) (center output : Color) (m : ℕ) + (a : Leaf (complete S center m)) + (ha : leafColor (complete S center m) a = output) (side : Color) + (hs : center ≠ output → side = center ∨ side = output) : + patternSideRead S center output side m + (fun i => coordinate (slot S center m a i).val side) = pattern S center m a := by + by_cases h : center = output + · simp only [patternSideRead, ite_eq_left h] + exact (pattern_eq_center S center m a (ha.trans h.symm)).symm + · rcases hs h with heq | heq + · subst side + simp only [patternSideRead, ite_eq_right h, ite_true] + have hr := centerRead_pattern S center m a + rw [ha] at hr + unfold centerRead at hr + exact hr + · subst side + simp only [patternSideRead, ite_eq_right h, ite_eq_right (Ne.symm h)] + have hr := outputRead_pattern S center m a + rw [ha] at hr + exact hr + +theorem completion_pattern_readers (S : FlaggedTensor X Y Z) (center output : Color) (m : ℕ) + (a : Leaf (complete S center m)) + (ha : leafColor (complete S center m) a = output) : + patternSideRead S center output (firstSide (ownerPair center output)) m + (fun i => coordinate (slot S center m a i).val (firstSide (ownerPair center output))) = + pattern S center m a ∧ + patternSideRead S center output (secondSide (ownerPair center output)) m + (fun i => coordinate (slot S center m a i).val (secondSide (ownerPair center output))) = + pattern S center m a := by + exact ⟨patternSideRead_correct S center output m a ha _ (ownerPair_first_mem center output), + patternSideRead_correct S center output m a ha _ (ownerPair_second_mem center output)⟩ + +end MatrixMultiplication.CompletionLabels +namespace MatrixMultiplication.CompletionLabels.TopologicalFlatten + +open MatrixMultiplication.Foundation RecursiveCompletion + +attribute [local instance] Classical.propDecidable Classical.decEq + +universe u v w z u' v' w' + +namespace NodeSchedule + +def PrefixDetermined {A : Type u} (s : NodeSchedule A) (depth : ℕ) : Prop := + ∀ n, n < depth → ∀ a b, + labelRecordOf s.labels n a = labelRecordOf s.labels n b → + s.active n a = s.active n b + +def canonicalActivate {A : Type u} (s : NodeSchedule A) (n : ℕ) + (prior : LabelRecord s.Label n) : Bool := + if h : ∃ a, labelRecordOf s.labels n a = prior then + s.active n (Classical.choose h) + else false + +theorem canonicalActivate_correct {A : Type u} (s : NodeSchedule A) (depth : ℕ) + (topological : s.PrefixDetermined depth) (n : ℕ) (hn : n < depth) (a : A) : + s.canonicalActivate n (labelRecordOf s.labels n a) = s.active n a := by + unfold canonicalActivate + split_ifs with h + · exact topological n hn _ a (Classical.choose_spec h) + · exact False.elim (h ⟨a, rfl⟩) + +end NodeSchedule + +namespace TopologicalSchedule + +def ofPrefixDetermined {A : Type u} {Coord : Color → Type v} {depth : ℕ} + (s : NodeSchedule A) (view : (side : Color) → A → Coord side) + (topological : s.PrefixDetermined depth) + (localFirst : (n : ℕ) → Coord (firstSide (s.readerPair n)) → Fin (s.arity n)) + (localSecond : (n : ℕ) → Coord (secondSide (s.readerPair n)) → Fin (s.arity n)) + (first_correct : ∀ n, n < depth → ∀ a, s.active n a = true → + localFirst n (view (firstSide (s.readerPair n)) a) = s.branch n a) + (second_correct : ∀ n, n < depth → ∀ a, s.active n a = true → + localSecond n (view (secondSide (s.readerPair n)) a) = s.branch n a) : + TopologicalSchedule A Coord depth where + toNodeSchedule := s + view := view + activate := s.canonicalActivate + activate_correct := s.canonicalActivate_correct depth topological + localFirst := localFirst + localSecond := localSecond + localFirst_read := first_correct + localSecond_read := second_correct + +end TopologicalSchedule + +structure Program (A : Type u) (Coord : Color → Type v) + (Context : Type z) (Code : Type w) (depth : ℕ) where + context : A → Context + view : (side : Color) → A → Coord side + pair : ℕ → ReaderPair + labels : ℕ → A → Code + read : (n : ℕ) → (side : Color) → Context → (Fin n → Code) → Coord side → Code + readable : ∀ n, n < depth → ∀ a side, + (side = firstSide (pair n) ∨ side = secondSide (pair n)) → + read n side (context a) (fun j => labels j.val a) (view side a) = labels n a + +namespace Program + +variable {A : Type u} {Coord : Color → Type v} + {Context : Type z} {Code : Type w} {depth : ℕ} + +def Complete (p : Program A Coord Context Code depth) : Prop := + ∀ a b, p.context a = p.context b → + (∀ n, n < depth → p.labels n a = p.labels n b) → a = b + +def pullback {B : Type u'} {NewCoord : Color → Type v'} + (p : Program A Coord Context Code depth) (source : B → A) + (view : (side : Color) → B → NewCoord side) + (project : (side : Color) → NewCoord side → Coord side) + (projects : ∀ side b, project side (view side b) = p.view side (source b)) : + Program B NewCoord Context Code depth where + context b := p.context (source b) + view := view + pair := p.pair + labels n b := p.labels n (source b) + read n side ctx prior own := p.read n side ctx prior (project side own) + readable := by + intro n hn b side hs + simpa only [projects side b] using p.readable n hn (source b) side hs + +theorem pullback_complete {B : Type u'} {NewCoord : Color → Type v'} + (p : Program A Coord Context Code depth) (source : B → A) + (view : (side : Color) → B → NewCoord side) + (project : (side : Color) → NewCoord side → Coord side) + (projects : ∀ side b, project side (view side b) = p.view side (source b)) + (complete : p.Complete) (injective : Function.Injective source) : + (p.pullback source view project projects).Complete := by + intro a b hc hl + apply injective + exact complete (source a) (source b) hc hl + +def recode {NewCode : Type w'} (p : Program A Coord Context Code depth) + (encode : Code → NewCode) (decode : NewCode → Code) + (roundtrip : Function.LeftInverse decode encode) : + Program A Coord Context NewCode depth where + context := p.context + view := p.view + pair := p.pair + labels n a := encode (p.labels n a) + read n side ctx prior own := encode (p.read n side ctx (fun j => decode (prior j)) own) + readable := by + intro n hn a side hs + have hprior : (fun j : Fin n => decode (encode (p.labels j.val a))) = + (fun j : Fin n => p.labels j.val a) := by + funext j + exact roundtrip _ + dsimp + rw [hprior, p.readable n hn a side hs] + +theorem recode_complete {NewCode : Type w'} (p : Program A Coord Context Code depth) + (encode : Code → NewCode) (decode : NewCode → Code) + (roundtrip : Function.LeftInverse decode encode) (complete : p.Complete) : + (p.recode encode decode roundtrip).Complete := by + intro a b hc hl + apply complete a b hc + intro n hn + exact roundtrip.injective (hl n hn) + +def single (context : A → Context) (view : (side : Color) → A → Coord side) + (pair : ReaderPair) (label : A → Code) + (read : (side : Color) → Context → Coord side → Code) + (correct : ∀ a side, (side = firstSide pair ∨ side = secondSide pair) → + read side (context a) (view side a) = label a) : + Program A Coord Context Code 1 where + context := context + view := view + pair _ := pair + labels _ := label + read _ side ctx _ own := read side ctx own + readable := by + intro n hn a side hs + exact correct a side hs + +private def appendLabel (d : ℕ) (f g : ℕ → A → Code) (n : ℕ) (a : A) : Code := + if n < d then f n a else g (n - d) a + +private def takeArray {n d : ℕ} (h : d ≤ n) (prior : Fin n → Code) : Fin d → Code := + fun j => prior ⟨j.val, lt_of_lt_of_le j.isLt h⟩ + +private def dropArray {n d : ℕ} (h : d ≤ n) (prior : Fin n → Code) : Fin (n - d) → Code := + fun j => prior ⟨d + j.val, by omega⟩ + +def append {OtherContext : Type z} {d e : ℕ} + (p : Program A Coord Context Code d) (q : Program A Coord OtherContext Code e) + (sameView : ∀ side a, p.view side a = q.view side a) + (derive : Context → (Fin d → Code) → OtherContext) + (derive_correct : ∀ a, derive (p.context a) (fun j => p.labels j.val a) = q.context a) : + Program A Coord Context Code (d + e) where + context := p.context + view := p.view + pair n := if n < d then p.pair n else q.pair (n - d) + labels := appendLabel d p.labels q.labels + read n side ctx prior own := + if h : n < d then p.read n side ctx prior own + else q.read (n - d) side + (derive ctx (takeArray (Nat.le_of_not_gt h) prior)) + (dropArray (Nat.le_of_not_gt h) prior) own + readable := by + intro n hn a side hs + by_cases h : n < d + · have hprior : (fun j : Fin n => appendLabel d p.labels q.labels j.val a) = + (fun j : Fin n => p.labels j.val a) := by + funext j + simp [appendLabel, lt_trans j.isLt h] + simp only [ite_eq_left h] at hs + simp only [dite_eq_left h] + rw [hprior] + simpa only [appendLabel, ite_eq_left h] using p.readable n h a side hs + · have hd : d ≤ n := Nat.le_of_not_gt h + have hhead : takeArray hd (fun j : Fin n => appendLabel d p.labels q.labels j.val a) = + (fun j : Fin d => p.labels j.val a) := by + funext j + simp [takeArray, appendLabel, j.isLt] + have htail : dropArray hd (fun j : Fin n => appendLabel d p.labels q.labels j.val a) = + (fun j : Fin (n - d) => q.labels j.val a) := by + funext j + have hj : ¬ d + j.val < d := by omega + simp [dropArray, appendLabel, hj] + have hnq : n - d < e := by omega + simp only [ite_eq_right h] at hs + simp only [dite_eq_right h] + rw [hhead, htail, derive_correct a, sameView side a] + simpa only [appendLabel, ite_eq_right h] using q.readable (n - d) hnq a side hs + +theorem append_labels_left {OtherContext : Type z} {d e : ℕ} + (p : Program A Coord Context Code d) (q : Program A Coord OtherContext Code e) + (sameView : ∀ side a, p.view side a = q.view side a) + (derive : Context → (Fin d → Code) → OtherContext) + (derive_correct : ∀ a, derive (p.context a) (fun j => p.labels j.val a) = q.context a) + (n : ℕ) (hn : n < d) (a : A) : + (p.append q sameView derive derive_correct).labels n a = p.labels n a := by + simp [append, appendLabel, hn] + +theorem append_labels_right {OtherContext : Type z} {d e : ℕ} + (p : Program A Coord Context Code d) (q : Program A Coord OtherContext Code e) + (sameView : ∀ side a, p.view side a = q.view side a) + (derive : Context → (Fin d → Code) → OtherContext) + (derive_correct : ∀ a, derive (p.context a) (fun j => p.labels j.val a) = q.context a) + (n : ℕ) (a : A) : + (p.append q sameView derive derive_correct).labels (d + n) a = q.labels n a := by + have h : ¬d + n < d := by omega + simp [append, appendLabel, h] + +theorem append_complete {OtherContext : Type z} {d e : ℕ} + (p : Program A Coord Context Code d) (q : Program A Coord OtherContext Code e) + (sameView : ∀ side a, p.view side a = q.view side a) + (derive : Context → (Fin d → Code) → OtherContext) + (derive_correct : ∀ a, derive (p.context a) (fun j => p.labels j.val a) = q.context a) + (complete : q.Complete) : + (p.append q sameView derive derive_correct).Complete := by + intro a b hc hl + change p.context a = p.context b at hc + have hhead : (fun j : Fin d => p.labels j.val a) = + (fun j : Fin d => p.labels j.val b) := by + funext j + have h := hl j.val (by omega) + simpa only [append_labels_left p q sameView derive derive_correct j.val j.isLt] using h + have hctx : q.context a = q.context b := by + rw [← derive_correct a, ← derive_correct b, hc, hhead] + apply complete a b hctx + intro n hn + have h := hl (d + n) (by omega) + simpa only [append_labels_right] using h + +def recordArray {Code : Type w} : + (n : ℕ) → LabelRecord (fun _ => Code) n → Fin n → Code + | 0, _, i => Fin.elim0 i + | n + 1, prior, i => + if h : i.val < n then recordArray n prior.1 ⟨i.val, h⟩ else prior.2 + +theorem recordArray_labelRecordOf {B : Type u'} (labels : ℕ → B → Code) + (n : ℕ) (a : B) : + recordArray n (labelRecordOf labels n a) = (fun i => labels i.val a) := by + induction n with + | zero => funext i; exact Fin.elim0 i + | succ n ih => + funext i + by_cases h : i.val < n + · simp only [recordArray, dite_eq_left h] + exact congrFun ih ⟨i.val, h⟩ + · have hi : i.val = n := by omega + simp [recordArray, hi, labelRecordOf] + +def firstReader (p : Program A Coord Context Code depth) (n : ℕ) (ctx : Context) + (prior : LabelRecord (fun _ => Code) n) + (own : Coord (firstSide (p.pair n))) : Code := + p.read n (firstSide (p.pair n)) ctx (recordArray n prior) own + +def secondReader (p : Program A Coord Context Code depth) (n : ℕ) (ctx : Context) + (prior : LabelRecord (fun _ => Code) n) + (own : Coord (secondSide (p.pair n))) : Code := + p.read n (secondSide (p.pair n)) ctx (recordArray n prior) own + +theorem firstReader_readable (p : Program A Coord Context Code depth) + (n : ℕ) (hn : n < depth) (a : A) : + p.firstReader n (p.context a) (labelRecordOf p.labels n a) + (p.view (firstSide (p.pair n)) a) = p.labels n a := by + rw [firstReader, recordArray_labelRecordOf] + exact p.readable n hn a _ (Or.inl rfl) + +theorem secondReader_readable (p : Program A Coord Context Code depth) + (n : ℕ) (hn : n < depth) (a : A) : + p.secondReader n (p.context a) (labelRecordOf p.labels n a) + (p.view (secondSide (p.pair n)) a) = p.labels n a := by + rw [secondReader, recordArray_labelRecordOf] + exact p.readable n hn a _ (Or.inr rfl) + +theorem record_injective_on_context (p : Program A Coord Context Code depth) + (complete : p.Complete) (ctx : Context) : + Function.Injective + (fun a : {a : A // p.context a = ctx} => labelRecordOf p.labels depth a.val) := by + intro a b h + apply Subtype.ext + apply complete a.val b.val (a.property.trans b.property.symm) + intro n hn + exact label_eq_of_record_eq p.labels h hn + +end Program +end MatrixMultiplication.CompletionLabels.TopologicalFlatten + +namespace MatrixMultiplication.CompletionLabels + +open MatrixMultiplication.Foundation RecursiveCompletion TopologicalFlatten +attribute [local instance] Classical.propDecidable Classical.decEq + +variable {X Y Z : Type uCoord} + +def rootColor (n : ℕ) : Color := if n = 0 then .B else if n = 1 then .A else .C + +def rootIndex : Color → Fin 3 + | .B => 0 + | .A => 1 + | .C => 2 + +@[simp] theorem rootColor_rootIndex (c : Color) : rootColor (rootIndex c).val = c := by + cases c <;> simp [rootIndex, rootColor] + +def completionView (S : FlaggedTensor X Y Z) (center : Color) (m : ℕ) + (side : Color) (a : Leaf (complete S center m)) : Fin m → Coordinate X Y Z side := + fun i => coordinate (slot S center m a i).val side + +def patternProgram (S : FlaggedTensor X Y Z) (center : Color) (m : ℕ) : + Program (Leaf (complete S center m)) (fun side => Fin m → Coordinate X Y Z side) + Color (Option (Fin m → Color)) 3 where + context := leafColor (complete S center m) + view := completionView S center m + pair n := ownerPair center (rootColor n) + labels n a := if leafColor (complete S center m) a = rootColor n then + some (pattern S center m a) else none + read n side ctx _ own := if ctx = rootColor n then + some (patternSideRead S center ctx side m own) else none + readable := by + intro n hn a side hs + by_cases h : leafColor (complete S center m) a = rootColor n + · simp only [ite_eq_left h] + congr 1 + apply patternSideRead_correct S center _ m a rfl side + intro hne + have hmem : side = center ∨ side = rootColor n := by + rcases hs with rfl | rfl + · exact ownerPair_first_mem center (rootColor n) (by simpa only [h] using hne) + · exact ownerPair_second_mem center (rootColor n) (by simpa only [h] using hne) + simpa only [h] using hmem + · simp only [ite_eq_right h] + +def decodePattern (center : Color) (m : ℕ) (output : Color) + (prior : Fin 3 → Option (Fin m → Color)) : Fin m → Color := + (prior (rootIndex output)).getD (fun _ => center) + +theorem decodePattern_correct (S : FlaggedTensor X Y Z) (center : Color) (m : ℕ) + (a : Leaf (complete S center m)) : + decodePattern center m ((patternProgram S center m).context a) + (fun j => (patternProgram S center m).labels j.val a) = pattern S center m a := by + simp [decodePattern, patternProgram] + +end MatrixMultiplication.CompletionLabels +namespace MatrixMultiplication.CompletionLabels.TopologicalFlatten.Program + +open MatrixMultiplication.Foundation RecursiveCompletion + +universe u v w z + +variable {A : Type u} {Coord : Color → Type v} + {Context : Type z} {Code : Type w} {depth : ℕ} + +private def powPast (d n : ℕ) (j : Fin (n % d)) : Fin n := + ⟨(n / d) * d + j.val, by + calc + (n / d) * d + j.val < (n / d) * d + n % d := + Nat.add_lt_add_left j.isLt _ + _ = n := by + simpa only [Nat.mul_comm] using Nat.div_add_mod n d⟩ + +private def powLabel [Inhabited Code] + (p : Program A Coord Context Code depth) (m n : ℕ) (a : Fin m → A) : Code := + if hi : n / depth < m then + p.labels (n % depth) (a ⟨n / depth, hi⟩) + else default + +private theorem powLabel_at [Inhabited Code] + (p : Program A Coord Context Code depth) (m : ℕ) + (a : Fin m → A) (i : Fin m) {k : ℕ} (hk : k < depth) : + powLabel p m (i.val * depth + k) a = p.labels k (a i) := by + have hd : 0 < depth := lt_of_le_of_lt (Nat.zero_le k) hk + have hquot : (i.val * depth + k) / depth = i.val := by + rw [Nat.add_comm, Nat.add_mul_div_right _ _ hd, + Nat.div_eq_of_lt hk, Nat.zero_add] + have hrem : (i.val * depth + k) % depth = k := by + rw [Nat.mul_add_mod_self_right, Nat.mod_eq_of_lt hk] + simp only [powLabel, hquot, hrem, dite_eq_left i.isLt] + +def pow [Inhabited Code] (p : Program A Coord Context Code depth) (m : ℕ) : + Program (Fin m → A) (fun side => Fin m → Coord side) + (Fin m → Context) Code (m * depth) where + context a i := p.context (a i) + view side a i := p.view side (a i) + pair n := p.pair (n % depth) + labels := powLabel p m + read n side ctx prior own := + if hi : n / depth < m then + p.read (n % depth) side (ctx ⟨n / depth, hi⟩) + (fun j => prior (powPast depth n j)) (own ⟨n / depth, hi⟩) + else default + readable := by + intro n hn a side hs + have hd : 0 < depth := by + by_contra h + have hzero : depth = 0 := by omega + simp [hzero] at hn + have hi : n / depth < m := (Nat.div_lt_iff_lt_mul hd).2 hn + let i : Fin m := ⟨n / depth, hi⟩ + have hlocal : n % depth < depth := Nat.mod_lt n hd + have hprior : + (fun j : Fin (n % depth) => powLabel p m (powPast depth n j).val a) = + (fun j : Fin (n % depth) => p.labels j.val (a i)) := by + funext j + change powLabel p m (i.val * depth + j.val) a = p.labels j.val (a i) + exact powLabel_at p m a i (lt_trans j.isLt hlocal) + simp only [dite_eq_left hi] + change p.read (n % depth) side (p.context (a i)) + (fun j : Fin (n % depth) => powLabel p m (powPast depth n j).val a) + (p.view side (a i)) = powLabel p m n a + rw [hprior] + simpa only [powLabel, dite_eq_left hi] using + p.readable (n % depth) hlocal (a i) side hs + +theorem pow_labels [Inhabited Code] (p : Program A Coord Context Code depth) (m : ℕ) + (a : Fin m → A) (i : Fin m) (n : ℕ) (hn : n < depth) : + (p.pow m).labels (i.val * depth + n) a = p.labels n (a i) := + powLabel_at p m a i hn + +theorem pow_complete [Inhabited Code] + (p : Program A Coord Context Code depth) (m : ℕ) (complete : p.Complete) : + (p.pow m).Complete := by + intro a b hc hl + funext i + apply complete (a i) (b i) + · exact congrFun hc i + · intro k hk + have hindex : i.val * depth + k < m * depth := by + calc + i.val * depth + k < i.val * depth + depth := Nat.add_lt_add_left hk _ + _ = (i.val + 1) * depth := by rw [Nat.add_mul, Nat.one_mul] + _ ≤ m * depth := Nat.mul_le_mul_right depth (Nat.succ_le_of_lt i.isLt) + have h := hl (i.val * depth + k) hindex + change powLabel p m (i.val * depth + k) a = + powLabel p m (i.val * depth + k) b at h + rw [powLabel_at p m a i hk, powLabel_at p m b i hk] at h + exact h + +end MatrixMultiplication.CompletionLabels.TopologicalFlatten.Program + +namespace MatrixMultiplication.CompletionLabels + +open MatrixMultiplication.Foundation RecursiveCompletion TopologicalFlatten + +universe w +variable {X Y Z : Type uCoord} {Code : Type w} {depth : ℕ} + +abbrev CompletionCode (m : ℕ) (Code : Type w) := Option ((Fin m → Color) ⊕ Code) + +def encodePattern {m : ℕ} : Option (Fin m → Color) → CompletionCode m Code + | none => none + | some pattern => some (.inl pattern) + +def decodePatternCode {m : ℕ} : CompletionCode m Code → Option (Fin m → Color) + | some (.inl pattern) => some pattern + | _ => none + +theorem patternCode_roundtrip {m : ℕ} : + Function.LeftInverse (decodePatternCode (Code := Code)) (encodePattern (m := m)) := by + intro c + cases c <;> rfl + +def encodeOld {m : ℕ} (c : Code) : CompletionCode m Code := some (.inr c) + +def decodeOld [Inhabited Code] {m : ℕ} : CompletionCode m Code → Code + | some (.inr c) => c + | _ => default + +theorem oldCode_roundtrip [Inhabited Code] {m : ℕ} : + Function.LeftInverse (decodeOld (Code := Code) (m := m)) encodeOld := by + intro c + rfl + +def inheritedProgram (S : FlaggedTensor X Y Z) (center : Color) (m : ℕ) + [Inhabited Code] + (p : Program (Leaf S) (Coordinate X Y Z) Color Code depth) + (view_eq : ∀ side a, p.view side a = coordinate a.val side) : + Program (Leaf (complete S center m)) (fun side => Fin m → Coordinate X Y Z side) + (Fin m → Color) (CompletionCode m Code) (m * depth) := + let old := p.recode encodeOld decodeOld oldCode_roundtrip + (old.pow m).pullback (slot S center m) (completionView S center m) + (fun _ => id) (by + intro side a + funext i + exact (view_eq side (slot S center m a i)).symm) + +theorem inheritedProgram_complete (S : FlaggedTensor X Y Z) (center : Color) (m : ℕ) + [Inhabited Code] + (p : Program (Leaf S) (Coordinate X Y Z) Color Code depth) + (view_eq : ∀ side a, p.view side a = coordinate a.val side) + (complete : p.Complete) : + (inheritedProgram S center m p view_eq).Complete := by + exact Program.pullback_complete + ((p.recode encodeOld decodeOld oldCode_roundtrip).pow m) + (slot S center m) (completionView S center m) (fun _ => id) + (by intro side a; funext i; exact (view_eq side (slot S center m a i)).symm) + (Program.pow_complete _ m + (Program.recode_complete p encodeOld decodeOld oldCode_roundtrip complete)) + (slot_injective S center m) + +private def completionContextDecoder (center : Color) (m : ℕ) (output : Color) + (prior : Fin 3 → CompletionCode m Code) : Fin m → Color := + decodePattern center m output (fun i => decodePatternCode (prior i)) + +private theorem completionContextDecoder_correct + (S : FlaggedTensor X Y Z) (center : Color) (m : ℕ) [Inhabited Code] + (p : Program (Leaf S) (Coordinate X Y Z) Color Code depth) + (context_eq : ∀ a, p.context a = leafColor S a) + (view_eq : ∀ side a, p.view side a = coordinate a.val side) + (a : Leaf (complete S center m)) : + completionContextDecoder (Code := Code) center m + (((patternProgram S center m).recode (encodePattern (Code := Code)) decodePatternCode + patternCode_roundtrip).context a) + (fun j => ((patternProgram S center m).recode (encodePattern (Code := Code)) decodePatternCode + patternCode_roundtrip).labels j.val a) = + (inheritedProgram S center m p view_eq).context a := by + change decodePattern center m (leafColor (complete S center m) a) + (fun j => decodePatternCode (Code := Code) + (encodePattern ((patternProgram S center m).labels j.val a))) = + (fun i => p.context (slot S center m a i)) + have hr (c : Option (Fin m → Color)) : + decodePatternCode (encodePattern c : CompletionCode m Code) = c := patternCode_roundtrip c + simp only [hr] + exact (decodePattern_correct S center m a).trans (by + funext i + exact (context_eq (slot S center m a i)).symm) + +def completionProgram (S : FlaggedTensor X Y Z) (center : Color) (m : ℕ) + [Inhabited Code] + (p : Program (Leaf S) (Coordinate X Y Z) Color Code depth) + (context_eq : ∀ a, p.context a = leafColor S a) + (view_eq : ∀ side a, p.view side a = coordinate a.val side) : + Program (Leaf (complete S center m)) (fun side => Fin m → Coordinate X Y Z side) + Color (CompletionCode m Code) (3 + m * depth) := + ((patternProgram S center m).recode encodePattern decodePatternCode patternCode_roundtrip).append + (inheritedProgram S center m p view_eq) (fun _ _ => rfl) + (completionContextDecoder center m) + (completionContextDecoder_correct S center m p context_eq view_eq) + +theorem completionProgram_complete (S : FlaggedTensor X Y Z) (center : Color) (m : ℕ) + [Inhabited Code] + (p : Program (Leaf S) (Coordinate X Y Z) Color Code depth) + (context_eq : ∀ a, p.context a = leafColor S a) + (view_eq : ∀ side a, p.view side a = coordinate a.val side) + (complete : p.Complete) : + (completionProgram S center m p context_eq view_eq).Complete := by + exact Program.append_complete + ((patternProgram S center m).recode encodePattern decodePatternCode patternCode_roundtrip) + (inheritedProgram S center m p view_eq) (fun _ _ => rfl) + (completionContextDecoder center m) + (completionContextDecoder_correct S center m p context_eq view_eq) + (inheritedProgram_complete S center m p view_eq complete) + +def coordinateWord (m : ℕ) (side : Color) : + Coordinate (Fin m → X) (Fin m → Y) (Fin m → Z) side → + (Fin m → Coordinate X Y Z side) := by + cases side <;> exact id + +theorem coordinateWord_coordinate (S : FlaggedTensor X Y Z) (center : Color) (m : ℕ) + (side : Color) (a : Leaf (complete S center m)) : + coordinateWord m side (coordinate a.val side) = completionView S center m side a := by + cases side <;> rfl + +def completionLocalProgram (S : FlaggedTensor X Y Z) (center : Color) (m : ℕ) + [Inhabited Code] + (p : Program (Leaf S) (Coordinate X Y Z) Color Code depth) + (context_eq : ∀ a, p.context a = leafColor S a) + (view_eq : ∀ side a, p.view side a = coordinate a.val side) : + Program (Leaf (complete S center m)) + (Coordinate (Fin m → X) (Fin m → Y) (Fin m → Z)) + Color (CompletionCode m Code) (3 + m * depth) := + (completionProgram S center m p context_eq view_eq).pullback id + (fun side a => coordinate a.val side) (coordinateWord m) + (coordinateWord_coordinate S center m) + +theorem completionLocalProgram_complete (S : FlaggedTensor X Y Z) (center : Color) (m : ℕ) + [Inhabited Code] + (p : Program (Leaf S) (Coordinate X Y Z) Color Code depth) + (context_eq : ∀ a, p.context a = leafColor S a) + (view_eq : ∀ side a, p.view side a = coordinate a.val side) + (complete : p.Complete) : + (completionLocalProgram S center m p context_eq view_eq).Complete := by + exact Program.pullback_complete (completionProgram S center m p context_eq view_eq) + id (fun side a => coordinate a.val side) (coordinateWord m) + (coordinateWord_coordinate S center m) + (completionProgram_complete S center m p context_eq view_eq complete) + Function.injective_id + +structure ReadableTensor (S : FlaggedTensor X Y Z) where + Code : Type + [finiteCode : Fintype Code] + [inhabitedCode : Inhabited Code] + depth : ℕ + program : Program (Leaf S) (Coordinate X Y Z) Color Code depth + context_eq : ∀ a, program.context a = leafColor S a + view_eq : ∀ side a, program.view side a = coordinate a.val side + complete : program.Complete + +attribute [instance] ReadableTensor.finiteCode ReadableTensor.inhabitedCode + +namespace ReadableTensor + +def raise (S : FlaggedTensor X Y Z) (r : ReadableTensor S) (center : Color) (m : ℕ) : + ReadableTensor (RecursiveCompletion.complete S center m) where + Code := CompletionCode m r.Code + depth := 3 + m * r.depth + program := completionLocalProgram S center m r.program r.context_eq r.view_eq + context_eq _ := rfl + view_eq _ _ := rfl + complete := completionLocalProgram_complete S center m r.program r.context_eq r.view_eq r.complete + +def script (S : FlaggedTensor X Y Z) (r : ReadableTensor S) : + (s : Script) → ReadableTensor (Script.tensor S s) + | .base => r + | .step prior center m => raise _ (script S r prior) center m + +end ReadableTensor + +end MatrixMultiplication.CompletionLabels +namespace MatrixMultiplication.CompletionLabels + +open MatrixMultiplication.Foundation RecursiveCompletion TopologicalFlatten + +attribute [local instance] Classical.propDecidable Classical.decEq + +universe u + +variable {X Y Z : Type uCoord} {Code : Type u} {depth : ℕ} + +def terminationSideRead (S : FlaggedTensor X Y Z) (first second side : Color) + (own : Coordinate X Y Z side) : Color := + if side = first then + if ownerFlag S side own then first else second + else if ownerFlag S side own then second else first + +theorem terminationSideRead_correct (S : FlaggedTensor X Y Z) + (first second : Color) (distinct : first ≠ second) + (a : RetainedLeaf S first second) (side : Color) + (hs : side = first ∨ side = second) : + terminationSideRead S first second side (coordinate a.val.val side) = + leafColor S a.val := by + rcases hs with h | h + · subst side + simpa only [terminationSideRead, ite_eq_left rfl, ite_true, terminationFirstRead] using + (termination_readable S first second a).1 + · subst side + simpa only [terminationSideRead, ite_eq_right (Ne.symm distinct), terminationSecondRead] using + (termination_readable S first second a).2 + +def terminationRoot (S : FlaggedTensor X Y Z) (first second : Color) + (distinct : first ≠ second) : + Program (RetainedLeaf S first second) (Coordinate X Y Z) PUnit Color 1 := + Program.single (fun _ => PUnit.unit) + (fun side a => coordinate a.val.val side) + (ownerPair first second) (fun a => leafColor S a.val) + (fun side _ own => terminationSideRead S first second side own) + (by + intro a side hs + apply terminationSideRead_correct S first second distinct a side + rcases hs with h | h + · rw [h] + exact ownerPair_first_mem first second distinct + · rw [h] + exact ownerPair_second_mem first second distinct) + +def terminationInherited (S : FlaggedTensor X Y Z) (first second : Color) + (p : Program (Leaf S) (Coordinate X Y Z) Color Code depth) + (view_eq : ∀ side a, p.view side a = coordinate a.val side) : + Program (RetainedLeaf S first second) (Coordinate X Y Z) Color Code depth := + p.pullback Subtype.val (fun side a => coordinate a.val.val side) (fun _ => id) + (fun side a => (view_eq side a.val).symm) + +theorem terminationInherited_complete (S : FlaggedTensor X Y Z) (first second : Color) + (p : Program (Leaf S) (Coordinate X Y Z) Color Code depth) + (view_eq : ∀ side a, p.view side a = coordinate a.val side) + (complete : p.Complete) : + (terminationInherited S first second p view_eq).Complete := by + unfold terminationInherited + exact p.pullback_complete + (fun a : RetainedLeaf S first second => a.val) + (fun side a => coordinate a.val.val side) (fun _ => id) + (fun side a => (view_eq side a.val).symm) complete Subtype.val_injective + +def terminationDecodeColor (fallback : Color) : Color ⊕ Code → Color + | .inl color => color + | .inr _ => fallback + +def terminationDecodeOld [Inhabited Code] : Color ⊕ Code → Code + | .inl _ => default + | .inr code => code + +def terminationProgram [Inhabited Code] + (S : FlaggedTensor X Y Z) (first second : Color) (distinct : first ≠ second) + (p : Program (Leaf S) (Coordinate X Y Z) Color Code depth) + (context_eq : ∀ a, p.context a = leafColor S a) + (view_eq : ∀ side a, p.view side a = coordinate a.val side) : + Program (RetainedLeaf S first second) (Coordinate X Y Z) + PUnit (Color ⊕ Code) (1 + depth) := + ((terminationRoot S first second distinct).recode Sum.inl + (terminationDecodeColor first) (fun _ => rfl)).append + ((terminationInherited S first second p view_eq).recode Sum.inr + terminationDecodeOld (fun _ => rfl)) + (by intro side a; rfl) + (fun _ prior => terminationDecodeColor first (prior 0)) + (by + intro a + change leafColor S a.val = p.context a.val + exact (context_eq a.val).symm) + +theorem terminationProgram_complete [Inhabited Code] + (S : FlaggedTensor X Y Z) (first second : Color) (distinct : first ≠ second) + (p : Program (Leaf S) (Coordinate X Y Z) Color Code depth) + (context_eq : ∀ a, p.context a = leafColor S a) + (view_eq : ∀ side a, p.view side a = coordinate a.val side) + (complete : p.Complete) : + (terminationProgram S first second distinct p context_eq view_eq).Complete := by + exact Program.append_complete + ((terminationRoot S first second distinct).recode Sum.inl + (terminationDecodeColor first) (fun _ => rfl)) + ((terminationInherited S first second p view_eq).recode Sum.inr + terminationDecodeOld (fun _ => rfl)) + (by intro side a; rfl) + (fun _ prior => terminationDecodeColor first (prior 0)) + (by + intro a + change leafColor S a.val = p.context a.val + exact (context_eq a.val).symm) + (Program.recode_complete (terminationInherited S first second p view_eq) + Sum.inr terminationDecodeOld (fun _ => rfl) + (terminationInherited_complete S first second p view_eq complete)) + +@[simp] theorem terminationProgram_context [Inhabited Code] + (S : FlaggedTensor X Y Z) (first second : Color) (distinct : first ≠ second) + (p : Program (Leaf S) (Coordinate X Y Z) Color Code depth) + (context_eq : ∀ a, p.context a = leafColor S a) + (view_eq : ∀ side a, p.view side a = coordinate a.val side) + (a : RetainedLeaf S first second) : + (terminationProgram S first second distinct p context_eq view_eq).context a = + PUnit.unit := rfl + +@[simp] theorem terminationProgram_view [Inhabited Code] + (S : FlaggedTensor X Y Z) (first second : Color) (distinct : first ≠ second) + (p : Program (Leaf S) (Coordinate X Y Z) Color Code depth) + (context_eq : ∀ a, p.context a = leafColor S a) + (view_eq : ∀ side a, p.view side a = coordinate a.val side) + (side : Color) (a : RetainedLeaf S first second) : + (terminationProgram S first second distinct p context_eq view_eq).view side a = + coordinate a.val.val side := rfl + +theorem terminationRecord_injective [Inhabited Code] + (S : FlaggedTensor X Y Z) (first second : Color) (distinct : first ≠ second) + (p : Program (Leaf S) (Coordinate X Y Z) Color Code depth) + (context_eq : ∀ a, p.context a = leafColor S a) + (view_eq : ∀ side a, p.view side a = coordinate a.val side) + (complete : p.Complete) : + Function.Injective (labelRecordOf + (terminationProgram S first second distinct p context_eq view_eq).labels (1 + depth)) := by + intro a b h + apply terminationProgram_complete S first second distinct p context_eq view_eq complete a b rfl + intro n hn + exact label_eq_of_record_eq _ h hn + +end MatrixMultiplication.CompletionLabels + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/Completion/Laws.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/Completion/Laws.lean new file mode 100644 index 0000000000000000000000000000000000000000..d93ff29fc4edc0175fb0f974c1e17cbc63c4ea2c --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/Completion/Laws.lean @@ -0,0 +1,94 @@ +import OAI.LinearAlgebra.MatrixMultiplication.Entropy.ComplexEntropyContinuity + +namespace OAI + +/-! Readable tensor completion and its finite arithmetic realization. -/ + +noncomputable section + +namespace MatrixMultiplication.CompletionLaws + +open MatrixMultiplication.Foundation +open scoped BigOperators + +variable {A B X : Type*} [Fintype A] [Fintype B] [Fintype X] + +def mixture (p : FiniteLaw B) (q : B → FiniteLaw A) : FiniteLaw A := + (p.joint q).map Prod.snd + +theorem mixture_mass (p : FiniteLaw B) (q : B → FiniteLaw A) (a : A) : + (mixture p q).mass a = ∑ b, p.mass b * (q b).mass a := by + classical + simp [mixture, FiniteLaw.map_mass, FiniteLaw.joint, Fintype.sum_prod_type] + +theorem mixture_map_mass (p : FiniteLaw B) (q : B → FiniteLaw A) + (f : A → X) (x : X) : + ((mixture p q).map f).mass x = ∑ b, p.mass b * ((q b).map f).mass x := by + classical + simp only [FiniteLaw.map_mass, mixture_mass] + calc + (∑ a, if f a = x then ∑ b, p.mass b * (q b).mass a else 0) = + ∑ a, ∑ b, if f a = x then p.mass b * (q b).mass a else 0 := by + apply Finset.sum_congr rfl + intro a _ + split_ifs <;> simp + _ = ∑ b, ∑ a, if f a = x then p.mass b * (q b).mass a else 0 := + Finset.sum_comm + _ = ∑ b, p.mass b * ∑ a, if f a = x then (q b).mass a else 0 := by + apply Finset.sum_congr rfl + intro b _ + rw [Finset.mul_sum] + apply Finset.sum_congr rfl + intro a _ + split_ifs <;> simp + +theorem mixture_common_marginal (p : FiniteLaw B) (q : B → FiniteLaw A) + (f : A → X) (r : FiniteLaw X) + (hq : ∀ b x, ((q b).map f).mass x = r.mass x) (x : X) : + ((mixture p q).map f).mass x = r.mass x := by + rw [mixture_map_mass] + simp_rw [hq] + rw [← Finset.sum_mul, p.total, one_mul] + +theorem joint_common_marginal (p : FiniteLaw B) (q : B → FiniteLaw A) + (f : A → X) (r : FiniteLaw X) + (hq : ∀ b x, ((q b).map f).mass x = r.mass x) (b : B) (x : X) : + ((p.joint q).map (fun ba => (ba.1, f ba.2))).mass (b, x) = + p.mass b * r.mass x := by + classical + simp only [FiniteLaw.map_mass, FiniteLaw.joint, Fintype.sum_prod_type, + Prod.mk.injEq] + calc + (∑ b', ∑ a, if b' = b ∧ f a = x then p.mass b' * (q b').mass a else 0) = + ∑ a, if f a = x then p.mass b * (q b).mass a else 0 := by + rw [Finset.sum_eq_single b] + · simp + · intro b' _ hne + simp [hne] + · simp + _ = p.mass b * ((q b).map f).mass x := by + rw [FiniteLaw.map_mass, Finset.mul_sum] + apply Finset.sum_congr rfl + intro a _ + split_ifs <;> simp + _ = _ := by rw [hq] + +theorem common_marginal_entropy (p : FiniteLaw B) (q : B → FiniteLaw A) + (f : A → X) (r : FiniteLaw X) + (hq : ∀ b x, ((q b).map f).mass x = r.mass x) : + (∑ b, p.mass b * finiteEntropy ((q b).map f).mass) = + finiteEntropy r.mass := by + have heq (b : B) : ((q b).map f).mass = r.mass := funext (hq b) + simp_rw [heq] + rw [← Finset.sum_mul, p.total, one_mul] + +theorem independent_entropy (p : FiniteLaw A) (q : FiniteLaw B) : + finiteEntropy (p.joint (fun _ => q)).mass = + finiteEntropy p.mass + finiteEntropy q.mass := by + rw [FiniteLaw.joint_entropy, ← Finset.sum_mul, p.total, one_mul] + +end MatrixMultiplication.CompletionLaws + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/Completion/Partitions.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/Completion/Partitions.lean new file mode 100644 index 0000000000000000000000000000000000000000..ada1fe7d4df2a177107cb8851d50a912f222a240 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/Completion/Partitions.lean @@ -0,0 +1,90 @@ +import OAI.LinearAlgebra.MatrixMultiplication.Completion.Scripts +import Mathlib.Data.Fintype.Card +import Mathlib.Tactic.FieldSimp + +namespace OAI + +/-! Readable tensor completion and its finite arithmetic realization. -/ + +noncomputable section + +namespace MatrixMultiplication.CompletionPartitions + +open MatrixMultiplication.Foundation RecursiveCompletion +attribute [local instance 10000] Classical.propDecidable Classical.decEq +attribute [local instance 11000] instDecidableEqFin + +variable {X Y Z : Type*} [Fintype X] + +def activeCount (S : FlaggedTensor X Y Z) : ℕ := Fintype.card {x // S.flagB x} +def inactiveCount (S : FlaggedTensor X Y Z) : ℕ := Fintype.card {x // ¬ S.flagB x} + +theorem partition_count (S : FlaggedTensor X Y Z) : + activeCount S + inactiveCount S = Fintype.card X := by + rw [activeCount, inactiveCount, Fintype.card_subtype_compl] + exact Nat.add_sub_of_le (Fintype.card_subtype_le S.flagB) + +theorem card_all (p : X → Prop) (m : ℕ) : + Fintype.card {x : Fin m → X // ∀ i, p (x i)} = Fintype.card {x // p x} ^ m := by + calc + _ = Fintype.card (Fin m → {x // p x}) := + Fintype.card_congr Equiv.subtypePiEquivPi + _ = _ := by simp + +theorem activeCount_minus (S : FlaggedTensor X Y Z) (m : ℕ) : + activeCount (complete S .B m) = activeCount S ^ m := by + simpa [activeCount, complete, flagB, raisedFlag] using card_all S.flagB m + +theorem inactiveCount_plus (S : FlaggedTensor X Y Z) (center : Color) + (hc : center ≠ .B) (m : ℕ) : + inactiveCount (complete S center m) = inactiveCount S ^ m := by + change Fintype.card {x : Fin m → X // ¬ raisedFlag center .B (fun i => S.flagB (x i))} = _ + calc + _ = Fintype.card {x : Fin m → X // ∀ i, ¬ S.flagB (x i)} := + Fintype.card_congr (Equiv.subtypeEquivRight fun x => by simp [raisedFlag, hc]) + _ = Fintype.card (Fin m → {x // ¬ S.flagB x}) := + Fintype.card_congr + { toFun := fun w i => ⟨w.val i, w.property i⟩ + invFun := fun w => ⟨fun i => (w i).val, fun i => (w i).property⟩ + left_inv := fun _ => rfl + right_inv := fun _ => rfl } + _ = _ := by simp [inactiveCount] + +def activeFraction (S : FlaggedTensor X Y Z) : ℝ := + (activeCount S : ℝ) / Fintype.card X + +def inactiveFraction (S : FlaggedTensor X Y Z) : ℝ := + (inactiveCount S : ℝ) / Fintype.card X + +theorem fraction_sum [Nonempty X] (S : FlaggedTensor X Y Z) : + activeFraction S + inactiveFraction S = 1 := by + have hc : (Fintype.card X : ℝ) ≠ 0 := (Nat.cast_pos.mpr Fintype.card_pos).ne' + rw [activeFraction, inactiveFraction, ← add_div, ← Nat.cast_add, partition_count] + exact div_self hc + +theorem activeFraction_minus (S : FlaggedTensor X Y Z) (m : ℕ) : + activeFraction (complete S .B m) = activeFraction S ^ m := by + simp only [activeFraction, activeCount_minus, Fintype.card_fun, + Fintype.card_fin, Nat.cast_pow, div_pow] + +theorem inactiveFraction_plus (S : FlaggedTensor X Y Z) (center : Color) + (hc : center ≠ .B) (m : ℕ) : + inactiveFraction (complete S center m) = inactiveFraction S ^ m := by + simp only [inactiveFraction, inactiveCount_plus S center hc m, + Fintype.card_fun, Fintype.card_fin, Nat.cast_pow, div_pow] + +theorem activeFraction_plus [Nonempty X] (S : FlaggedTensor X Y Z) + (center : Color) (hc : center ≠ .B) (m : ℕ) : + activeFraction (complete S center m) = 1 - (1 - activeFraction S) ^ m := by + have h := fraction_sum (complete S center m) + rw [inactiveFraction_plus S center hc m] at h + have hold : inactiveFraction S = 1 - activeFraction S := by + linarith [fraction_sum S] + rw [hold] at h + linarith + +end MatrixMultiplication.CompletionPartitions + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/Completion/ProductLaws.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/Completion/ProductLaws.lean new file mode 100644 index 0000000000000000000000000000000000000000..a9029ed39f6a3c24f9022897c3a8926b02d0eca4 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/Completion/ProductLaws.lean @@ -0,0 +1,200 @@ +import OAI.LinearAlgebra.MatrixMultiplication.Entropy.ComplexEntropyContinuity +import Mathlib.Algebra.BigOperators.Ring.Finset + +namespace OAI + +/-! Readable tensor completion and its finite arithmetic realization. -/ + +noncomputable section + +namespace MatrixMultiplication.CompletionProductLaws + +open MatrixMultiplication.Foundation +open scoped BigOperators +attribute [local instance] Classical.propDecidable Classical.decEq + +variable {I : Type*} [Fintype I] [DecidableEq I] {A : I → Type*} [∀ i, Fintype (A i)] + +def independentProduct (p : ∀ i, FiniteLaw (A i)) : FiniteLaw (∀ i, A i) := by + classical + exact + { mass := fun x => ∏ i, (p i).mass (x i) + nonneg := fun x => Finset.prod_nonneg fun i _ => (p i).nonneg (x i) + total := by rw [← Fintype.prod_sum]; simp only [(p _).total, Finset.prod_const_one] } + +@[simp] theorem independentProduct_mass (p : ∀ i, FiniteLaw (A i)) (x : ∀ i, A i) : + (independentProduct p).mass x = ∏ i, (p i).mass (x i) := rfl + +theorem entropyTerm_prod {J : Type*} [DecidableEq J] (s : Finset J) (f : J → ℝ) : + entropyTerm (∏ i ∈ s, f i) = + ∑ i ∈ s, ∏ j ∈ s, if j = i then entropyTerm (f j) else f j := by + classical + induction s using Finset.induction_on with + | empty => simp + | @insert a s ha ih => + rw [Finset.prod_insert ha, entropyTerm_mul, Finset.sum_insert ha] + have hrest : (∏ j ∈ s, if j = a then entropyTerm (f j) else f j) = + ∏ j ∈ s, f j := by + apply Finset.prod_congr rfl + intro j hj + have hja : j ≠ a := by rintro rfl; exact ha hj + simp only [hja, ite_false] + rw [Finset.prod_insert ha, ite_eq_left rfl, hrest, ih] + rw [Finset.mul_sum] + apply congrArg₂ (· + ·) + · ring + · apply Finset.sum_congr rfl + intro i hi + have hai : a ≠ i := by rintro rfl; exact ha hi + rw [Finset.prod_insert ha, ite_eq_right hai] + +theorem independentProduct_entropy (p : ∀ i, FiniteLaw (A i)) : + finiteEntropy (independentProduct p).mass = + ∑ i, finiteEntropy (p i).mass := by + classical + simp only [finiteEntropy, independentProduct_mass, entropyTerm_prod] + rw [Finset.sum_comm] + apply Finset.sum_congr rfl + intro i _ + rw [← Fintype.prod_sum (fun j (a : A j) => + if j = i then entropyTerm ((p j).mass a) else (p j).mass a)] + calc + (∏ j, ∑ a : A j, if j = i then entropyTerm ((p j).mass a) else (p j).mass a) = + ∏ j, if j = i then (∑ a : A j, entropyTerm ((p j).mass a)) else 1 := by + apply Finset.prod_congr rfl + intro j _ + by_cases hji : j = i <;> simp only [hji, ite_true, ite_false, (p j).total] + _ = _ := Fintype.prod_ite_eq' i _ + +omit [∀ index, Fintype (A index)] in +private theorem prod_update_eval + (f : ∀ i, A i → ℝ) (i : I) (g : A i → ℝ) (x : ∀ i, A i) : + (∏ j, Function.update f i g j (x j)) = + g (x i) * ∏ j ∈ Finset.univ.erase i, f j (x j) := by + rw [← Finset.mul_prod_erase Finset.univ + (fun j => Function.update f i g j (x j)) (Finset.mem_univ i)] + rw [Function.update_self] + congr 1 + apply Finset.prod_congr rfl + intro j hj + rw [Function.update_of_ne (Finset.mem_erase.mp hj).1] + +theorem independentProduct_coordinate_expectation + (p : ∀ i, FiniteLaw (A i)) (i : I) (g : A i → ℝ) : + (∑ x, (independentProduct p).mass x * g (x i)) = + ∑ a, (p i).mass a * g a := by + classical + let f : ∀ j, A j → ℝ := fun j => (p j).mass + let k : ∀ j, A j → ℝ := Function.update f i (fun a => (p i).mass a * g a) + calc + (∑ x, (independentProduct p).mass x * g (x i)) = + ∑ x : ∀ j, A j, ∏ j, k j (x j) := by + apply Finset.sum_congr rfl + intro x _ + rw [independentProduct_mass] + dsimp only [k] + rw [prod_update_eval] + rw [← Finset.mul_prod_erase Finset.univ + (fun j => (p j).mass (x j)) (Finset.mem_univ i)] + dsimp only [f] + ring + _ = ∏ j, ∑ a, k j a := (Fintype.prod_sum (κ := A) k).symm + _ = ∏ j, if j = i then (∑ a, (p i).mass a * g a) else 1 := by + apply Finset.prod_congr rfl + intro j _ + by_cases hji : j = i + · subst j + simp [k] + · simp [k, hji, f, (p j).total] + _ = _ := by simp + +theorem independentProduct_coordinate_mass + (p : ∀ i, FiniteLaw (A i)) (i : I) (a : A i) : + ((independentProduct p).map (fun x => x i)).mass a = (p i).mass a := by + classical + rw [FiniteLaw.map_mass] + calc + (∑ x, if x i = a then (independentProduct p).mass x else 0) = + ∑ x, (independentProduct p).mass x * (if x i = a then 1 else 0) := by + apply Finset.sum_congr rfl + intro x _ + split_ifs <;> simp + _ = ∑ b, (p i).mass b * (if b = a then 1 else 0) := + independentProduct_coordinate_expectation p i (fun b => if b = a then 1 else 0) + _ = _ := by simp + +theorem independentProduct_map_mass + {B : I → Type*} [∀ i, Fintype (B i)] + (p : ∀ i, FiniteLaw (A i)) (f : ∀ i, A i → B i) (y : ∀ i, B i) : + ((independentProduct p).map (fun x i => f i (x i))).mass y = + ∏ i, ((p i).map (f i)).mass (y i) := by + classical + rw [FiniteLaw.map_mass] + calc + (∑ x, if (fun i => f i (x i)) = y then (independentProduct p).mass x else 0) = + ∑ x : ∀ i, A i, ∏ i, if f i (x i) = y i then (p i).mass (x i) else 0 := by + apply Finset.sum_congr rfl + intro x _ + by_cases h : ∀ i, f i (x i) = y i + · simp [h] + · have hne : (fun i => f i (x i)) ≠ y := fun he => h (congrFun he) + rw [ite_eq_right hne] + obtain ⟨i, hi⟩ := not_forall.mp h + symm + exact Finset.prod_eq_zero (Finset.mem_univ i) (ite_eq_right hi) + _ = ∏ i, ∑ a, if f i a = y i then (p i).mass a else 0 := + (Fintype.prod_sum (fun i (a : A i) => if f i a = y i then (p i).mass a else 0)).symm + _ = _ := by simp only [FiniteLaw.map_mass] + +theorem independentProduct_map_entropy + {B : I → Type*} [∀ i, Fintype (B i)] + (p : ∀ i, FiniteLaw (A i)) (f : ∀ i, A i → B i) : + finiteEntropy ((independentProduct p).map (fun x i => f i (x i))).mass = + ∑ i, finiteEntropy ((p i).map (f i)).mass := by + have hmass : ((independentProduct p).map (fun x i => f i (x i))).mass = + (independentProduct (fun i => (p i).map (f i))).mass := by + funext y + exact independentProduct_map_mass p f y + rw [hmass, independentProduct_entropy] + +def sigmaJoint (p : FiniteLaw I) (q : ∀ i, FiniteLaw (A i)) : FiniteLaw (Sigma A) where + mass x := p.mass x.1 * (q x.1).mass x.2 + nonneg x := mul_nonneg (p.nonneg x.1) ((q x.1).nonneg x.2) + total := by simp [Fintype.sum_sigma, ← Finset.mul_sum, (q _).total, p.total] + +omit [DecidableEq I] in +@[simp] theorem sigmaJoint_mass (p : FiniteLaw I) (q : ∀ i, FiniteLaw (A i)) (x : Sigma A) : + (sigmaJoint p q).mass x = p.mass x.1 * (q x.1).mass x.2 := rfl + +omit [DecidableEq I] in +theorem sigmaJoint_entropy (p : FiniteLaw I) (q : ∀ i, FiniteLaw (A i)) : + finiteEntropy (sigmaJoint p q).mass = + finiteEntropy p.mass + ∑ i, p.mass i * finiteEntropy (q i).mass := by + simp only [finiteEntropy, sigmaJoint_mass, Fintype.sum_sigma, entropyTerm_mul, + Finset.sum_add_distrib, ← Finset.sum_mul, ← Finset.mul_sum, (q _).total, one_mul] + +theorem sigmaJoint_fst_mass (p : FiniteLaw I) (q : ∀ i, FiniteLaw (A i)) (i : I) : + ((sigmaJoint p q).map Sigma.fst).mass i = p.mass i := by + classical + simp [FiniteLaw.map_mass, Fintype.sum_sigma, sigmaJoint_mass, + Finset.sum_ite_irrel, ← Finset.mul_sum, (q _).total] + +omit [DecidableEq I] in +theorem sigmaJoint_map_mass {B : Type*} [Fintype B] + (p : FiniteLaw I) (q : ∀ i, FiniteLaw (A i)) (f : Sigma A → B) (b : B) : + ((sigmaJoint p q).map f).mass b = + ∑ i, p.mass i * ((q i).map (fun a => f ⟨i, a⟩)).mass b := by + classical + simp only [FiniteLaw.map_mass, Fintype.sum_sigma, sigmaJoint_mass] + apply Finset.sum_congr rfl + intro i _ + rw [Finset.mul_sum] + apply Finset.sum_congr rfl + intro a _ + split_ifs <;> simp + +end MatrixMultiplication.CompletionProductLaws + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/Completion/ProgramPrefixes.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/Completion/ProgramPrefixes.lean new file mode 100644 index 0000000000000000000000000000000000000000..f48bcf6c707b18568969185429795d0f2624c009 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/Completion/ProgramPrefixes.lean @@ -0,0 +1,280 @@ +import OAI.LinearAlgebra.MatrixMultiplication.Completion.Labels + +namespace OAI + +/-! Readable tensor completion and its finite arithmetic realization. -/ + +noncomputable section + +namespace MatrixMultiplication.CompletionLabels.TopologicalFlatten + +open MatrixMultiplication.Foundation RecursiveCompletion + +universe u v w z + +theorem labelRecordOf_eq_iff {A : Type u} {Label : ℕ → Type v} + (labels : ∀ n, A → Label n) (n : ℕ) (a b : A) : + labelRecordOf labels n a = labelRecordOf labels n b ↔ + ∀ k, k < n → labels k a = labels k b := by + constructor + · intro h k hk + exact label_eq_of_record_eq labels h hk + · intro h + revert h + induction n with + | zero => intro h; rfl + | succ n ih => + intro h + apply Prod.ext + · exact ih (fun k hk => h k (Nat.lt_succ_of_lt hk)) + · exact h n (Nat.lt_succ_self n) + +namespace Program + +variable {A : Type u} {Coord : Color → Type v} + {Context OtherContext : Type z} {Code : Type w} {d e : ℕ} + +theorem append_record_eq_iff + (p : Program A Coord Context Code d) (q : Program A Coord OtherContext Code e) + (sameView : ∀ side a, p.view side a = q.view side a) + (derive : Context → (Fin d → Code) → OtherContext) + (derive_correct : ∀ a, derive (p.context a) (fun j => p.labels j.val a) = q.context a) + (k : ℕ) (a b : A) : + labelRecordOf (p.append q sameView derive derive_correct).labels (d + k) a = + labelRecordOf (p.append q sameView derive derive_correct).labels (d + k) b ↔ + labelRecordOf p.labels d a = labelRecordOf p.labels d b ∧ + labelRecordOf q.labels k a = labelRecordOf q.labels k b := by + simp only [labelRecordOf_eq_iff] + constructor + · intro h + constructor + · intro n hn + have heq := h n (by omega) + simpa only [append_labels_left p q sameView derive derive_correct n hn] using heq + · intro n hn + have heq := h (d + n) (by omega) + simpa only [append_labels_right] using heq + · rintro ⟨hp, hq⟩ n hn + by_cases hd : n < d + · simpa only [append_labels_left p q sameView derive derive_correct n hd] using hp n hd + · have hdn : d + (n - d) = n := Nat.add_sub_of_le (Nat.le_of_not_gt hd) + have heq := hq (n - d) (by omega) + have ha := append_labels_right p q sameView derive derive_correct (n - d) a + have hb := append_labels_right p q sameView derive derive_correct (n - d) b + rw [hdn] at ha hb + exact ha.trans (heq.trans hb.symm) + +theorem recode_record_eq_iff {NewCode : Type*} + (p : Program A Coord Context Code d) (encode : Code → NewCode) + (decode : NewCode → Code) (roundtrip : Function.LeftInverse decode encode) + (k : ℕ) (a b : A) : + labelRecordOf (p.recode encode decode roundtrip).labels k a = + labelRecordOf (p.recode encode decode roundtrip).labels k b ↔ + labelRecordOf p.labels k a = labelRecordOf p.labels k b := by + simp only [labelRecordOf_eq_iff] + constructor + · intro h n hn + exact roundtrip.injective (h n hn) + · intro h n hn + exact congrArg encode (h n hn) + +theorem pow_record_eq_iff [Inhabited Code] + (p : Program A Coord Context Code d) (m : ℕ) (i : Fin m) + (k : ℕ) (hk : k ≤ d) (a b : Fin m → A) : + labelRecordOf (p.pow m).labels (i.val * d + k) a = + labelRecordOf (p.pow m).labels (i.val * d + k) b ↔ + (∀ j : Fin m, j.val < i.val → + labelRecordOf p.labels d (a j) = labelRecordOf p.labels d (b j)) ∧ + labelRecordOf p.labels k (a i) = labelRecordOf p.labels k (b i) := by + simp only [labelRecordOf_eq_iff] + constructor + · intro h + constructor + · intro j hj n hn + have hindex : j.val * d + n < i.val * d + k := by + calc + j.val * d + n < j.val * d + d := Nat.add_lt_add_left hn _ + _ = (j.val + 1) * d := by rw [Nat.add_mul, Nat.one_mul] + _ ≤ i.val * d := Nat.mul_le_mul_right d (Nat.succ_le_of_lt hj) + _ ≤ i.val * d + k := Nat.le_add_right _ _ + have heq := h (j.val * d + n) hindex + simpa only [pow_labels p m a j n hn, pow_labels p m b j n hn] using heq + · intro n hn + have hnd : n < d := lt_of_lt_of_le hn hk + have heq := h (i.val * d + n) (Nat.add_lt_add_left hn _) + simpa only [pow_labels p m a i n hnd, pow_labels p m b i n hnd] using heq + · rintro ⟨hp, hc⟩ n hn + have hd : 0 < d := by + by_contra h + have hz : d = 0 := by omega + simp [hz] at hk hn + omega + have hq : n / d ≤ i.val := by + have hbound : n < (i.val + 1) * d := by + rw [Nat.add_mul, Nat.one_mul] + exact lt_of_lt_of_le hn (Nat.add_le_add_left hk _) + exact Nat.le_of_lt_succ ((Nat.div_lt_iff_lt_mul hd).2 hbound) + let j : Fin m := ⟨n / d, lt_of_le_of_lt hq i.isLt⟩ + have hrem : n % d < d := Nat.mod_lt n hd + have hsplit : j.val * d + n % d = n := by + simpa only [j, Nat.mul_comm] using Nat.div_add_mod n d + have heq : p.labels (n % d) (a j) = p.labels (n % d) (b j) := by + by_cases hj : j.val < i.val + · exact hp j hj (n % d) hrem + · have hji : j = i := Fin.ext (by dsimp [j] at hj ⊢; omega) + have hcur : n % d < k := by + rw [hji] at hsplit + omega + simpa only [hji] using hc (n % d) hcur + rw [← hsplit, pow_labels p m a j (n % d) hrem, pow_labels p m b j (n % d) hrem] + exact heq + +end Program +end MatrixMultiplication.CompletionLabels.TopologicalFlatten + +namespace MatrixMultiplication.CompletionLabels + +open MatrixMultiplication.Foundation RecursiveCompletion TopologicalFlatten + +attribute [local instance] Classical.propDecidable Classical.decEq + +universe uCoord +variable {X Y Z : Type uCoord} + +theorem completionLocalProgram_label_root {Code : Type*} [Inhabited Code] {depth : ℕ} + (S : FlaggedTensor X Y Z) (center : Color) (m : ℕ) + (p : Program (Leaf S) (Coordinate X Y Z) Color Code depth) + (context_eq : ∀ a, p.context a = leafColor S a) + (view_eq : ∀ side a, p.view side a = coordinate a.val side) + (n : ℕ) (hn : n < 3) (a : Leaf (complete S center m)) : + (completionLocalProgram S center m p context_eq view_eq).labels n a = + encodePattern (if leafColor (complete S center m) a = rootColor n then + some (pattern S center m a) else none) := by + change (if n < 3 then encodePattern ((patternProgram S center m).labels n a) + else (inheritedProgram S center m p view_eq).labels (n - 3) a) = _ + rw [ite_eq_left hn] + rfl + +theorem completionLocalProgram_pair_root {Code : Type*} [Inhabited Code] {depth : ℕ} + (S : FlaggedTensor X Y Z) (center : Color) (m : ℕ) + (p : Program (Leaf S) (Coordinate X Y Z) Color Code depth) + (context_eq : ∀ a, p.context a = leafColor S a) + (view_eq : ∀ side a, p.view side a = coordinate a.val side) + (n : ℕ) (hn : n < 3) : + (completionLocalProgram S center m p context_eq view_eq).pair n = + ownerPair center (rootColor n) := by + change (if n < 3 then ownerPair center (rootColor n) else p.pair ((n - 3) % depth)) = _ + rw [ite_eq_left hn] + +theorem completionLocalProgram_label_slot {Code : Type*} [Inhabited Code] {depth : ℕ} + (S : FlaggedTensor X Y Z) (center : Color) (m : ℕ) + (p : Program (Leaf S) (Coordinate X Y Z) Color Code depth) + (context_eq : ∀ a, p.context a = leafColor S a) + (view_eq : ∀ side a, p.view side a = coordinate a.val side) + (i : Fin m) (k : ℕ) (hk : k < depth) (a : Leaf (complete S center m)) : + (completionLocalProgram S center m p context_eq view_eq).labels (3 + (i.val * depth + k)) a = + encodeOld (p.labels k (slot S center m a i)) := by + change (if 3 + (i.val * depth + k) < 3 then + encodePattern ((patternProgram S center m).labels (3 + (i.val * depth + k)) a) + else (inheritedProgram S center m p view_eq).labels + (3 + (i.val * depth + k) - 3) a) = _ + have hsub : 3 + (i.val * depth + k) - 3 = i.val * depth + k := by omega + rw [ite_eq_right (by omega), hsub] + change ((p.recode encodeOld decodeOld oldCode_roundtrip).pow m).labels + (i.val * depth + k) (slot S center m a) = _ + rw [Program.pow_labels _ m _ i k hk] + rfl + +theorem completionLocalProgram_pair_slot {Code : Type*} [Inhabited Code] {depth : ℕ} + (S : FlaggedTensor X Y Z) (center : Color) (m : ℕ) + (p : Program (Leaf S) (Coordinate X Y Z) Color Code depth) + (context_eq : ∀ a, p.context a = leafColor S a) + (view_eq : ∀ side a, p.view side a = coordinate a.val side) + (i : Fin m) (k : ℕ) (hk : k < depth) : + (completionLocalProgram S center m p context_eq view_eq).pair (3 + (i.val * depth + k)) = + p.pair k := by + change (if 3 + (i.val * depth + k) < 3 then _ + else p.pair ((3 + (i.val * depth + k) - 3) % depth)) = _ + rw [ite_eq_right (by omega)] + have hsub : 3 + (i.val * depth + k) - 3 = i.val * depth + k := by omega + rw [hsub, Nat.mul_add_mod_self_right, Nat.mod_eq_of_lt hk] + +theorem patternProgram_record_eq_iff (S : FlaggedTensor X Y Z) (center : Color) (m : ℕ) + (a b : Leaf (complete S center m)) : + labelRecordOf (patternProgram S center m).labels 3 a = + labelRecordOf (patternProgram S center m).labels 3 b ↔ + leafColor (complete S center m) a = leafColor (complete S center m) b ∧ + pattern S center m a = pattern S center m b := by + constructor + · intro h + have heq := label_eq_of_record_eq (patternProgram S center m).labels h + (rootIndex (leafColor (complete S center m) a)).isLt + change (if leafColor (complete S center m) a = + rootColor (rootIndex (leafColor (complete S center m) a)).val + then some (pattern S center m a) else none) = + (if leafColor (complete S center m) b = + rootColor (rootIndex (leafColor (complete S center m) a)).val + then some (pattern S center m b) else none) at heq + rw [rootColor_rootIndex, ite_eq_left rfl] at heq + by_cases hb : leafColor (complete S center m) b = leafColor (complete S center m) a + · rw [ite_eq_left hb] at heq + exact ⟨hb.symm, Option.some.inj heq⟩ + · rw [ite_eq_right hb] at heq + cases heq + · rintro ⟨hc, hp⟩ + apply (labelRecordOf_eq_iff _ _ _ _).mpr + intro n hn + change (if leafColor (complete S center m) a = rootColor n then + some (pattern S center m a) else none) = + (if leafColor (complete S center m) b = rootColor n then + some (pattern S center m b) else none) + rw [hc, hp] + +theorem completionProgram_record_eq_iff {Code : Type*} [Inhabited Code] {depth : ℕ} + (S : FlaggedTensor X Y Z) (center : Color) (m : ℕ) + (p : Program (Leaf S) (Coordinate X Y Z) Color Code depth) + (context_eq : ∀ a, p.context a = leafColor S a) + (view_eq : ∀ side a, p.view side a = coordinate a.val side) + (i : Fin m) (k : ℕ) (hk : k ≤ depth) + (a b : Leaf (complete S center m)) : + labelRecordOf (completionLocalProgram S center m p context_eq view_eq).labels + (3 + (i.val * depth + k)) a = + labelRecordOf (completionLocalProgram S center m p context_eq view_eq).labels + (3 + (i.val * depth + k)) b ↔ + (leafColor (complete S center m) a = leafColor (complete S center m) b ∧ + pattern S center m a = pattern S center m b) ∧ + ((∀ j : Fin m, j.val < i.val → + labelRecordOf p.labels depth (slot S center m a j) = + labelRecordOf p.labels depth (slot S center m b j)) ∧ + labelRecordOf p.labels k (slot S center m a i) = + labelRecordOf p.labels k (slot S center m b i)) := by + change labelRecordOf (completionProgram S center m p context_eq view_eq).labels + (3 + (i.val * depth + k)) a = + labelRecordOf (completionProgram S center m p context_eq view_eq).labels + (3 + (i.val * depth + k)) b ↔ _ + trans + (labelRecordOf ((patternProgram S center m).recode (encodePattern (Code := Code)) + decodePatternCode patternCode_roundtrip).labels 3 a = + labelRecordOf ((patternProgram S center m).recode (encodePattern (Code := Code)) + decodePatternCode patternCode_roundtrip).labels 3 b ∧ + labelRecordOf (inheritedProgram S center m p view_eq).labels (i.val * depth + k) a = + labelRecordOf (inheritedProgram S center m p view_eq).labels (i.val * depth + k) b) + · exact Program.append_record_eq_iff _ _ _ _ _ (i.val * depth + k) a b + rw [Program.recode_record_eq_iff, patternProgram_record_eq_iff] + have htail : + (labelRecordOf (inheritedProgram S center m p view_eq).labels (i.val * depth + k) a = + labelRecordOf (inheritedProgram S center m p view_eq).labels (i.val * depth + k) b) ↔ + (labelRecordOf ((p.recode (encodeOld (m := m)) decodeOld oldCode_roundtrip).pow m).labels + (i.val * depth + k) (slot S center m a) = + labelRecordOf ((p.recode (encodeOld (m := m)) decodeOld oldCode_roundtrip).pow m).labels + (i.val * depth + k) (slot S center m b)) := by + simp only [labelRecordOf_eq_iff] + rfl + rw [htail, Program.pow_record_eq_iff _ m i k hk] + simp only [Program.recode_record_eq_iff] + +end MatrixMultiplication.CompletionLabels + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/Completion/RecursiveCompletion.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/Completion/RecursiveCompletion.lean new file mode 100644 index 0000000000000000000000000000000000000000..f0c0aca42174f694771f459cf9be88ebdfce50d9 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/Completion/RecursiveCompletion.lean @@ -0,0 +1,202 @@ +import OAI.LinearAlgebra.MatrixMultiplication.Polynomial.ComplexPolynomialDegenerationComposition +import OAI.LinearAlgebra.MatrixMultiplication.Polynomial.ComplexPolynomialWitnessProduct +import Mathlib.Tactic.Ring + +namespace OAI + +/-! Readable tensor completion and its finite arithmetic realization. -/ + +noncomputable section + +namespace MatrixMultiplication + +open MatrixMultiplication.Foundation +open scoped BigOperators +attribute [local instance] Classical.propDecidable Classical.decEq + +inductive Color where + | B | A | C + deriving DecidableEq + +instance : Fintype Color where + elems := {.B, .A, .C} + complete color := by cases color <;> simp + +structure FlaggedTensor (X Y Z : Type*) where + tensor : Tensor ℂ X Y Z + flagB : X → Prop + flagA : Z → Prop + flagC : Y → Prop + one_hot : ∀ x y z, tensor x y z ≠ 0 → + (if flagB x then 1 else 0) + (if flagA z then 1 else 0) + + (if flagC y then 1 else 0) = (1 : ℕ) + +namespace RecursiveCompletion + +def raisedFlag {I : Type*} (center color : Color) (p : I → Prop) : Prop := + if center = color then ∀ i, p i else ∃ i, p i + +variable {X Y Z : Type*} + +def flagB (S : FlaggedTensor X Y Z) (center : Color) (m : ℕ) + (x : Fin m → X) : Prop := raisedFlag center .B (fun i => S.flagB (x i)) + +def flagA (S : FlaggedTensor X Y Z) (center : Color) (m : ℕ) + (z : Fin m → Z) : Prop := raisedFlag center .A (fun i => S.flagA (z i)) + +def flagC (S : FlaggedTensor X Y Z) (center : Color) (m : ℕ) + (y : Fin m → Y) : Prop := raisedFlag center .C (fun i => S.flagC (y i)) + +def weight (S : FlaggedTensor X Y Z) (center : Color) (m : ℕ) + (x : Fin m → X) (y : Fin m → Y) (z : Fin m → Z) : ℕ := + (if flagB S center m x then 1 else 0) + + (if flagA S center m z then 1 else 0) + + (if flagC S center m y then 1 else 0) + +theorem weight_pos (S : FlaggedTensor X Y Z) (center : Color) (m : ℕ) + (x : Fin m → X) (y : Fin m → Y) (z : Fin m → Z) + (hs : Tensor.power S.tensor m x y z ≠ 0) : + 0 < weight S center m x y z := by + classical + have hold (i : Fin m) : + (if S.flagB (x i) then 1 else 0) + + (if S.flagA (z i) then 1 else 0) + + (if S.flagC (y i) then 1 else 0) = (1 : ℕ) := by + apply S.one_hot + exact (Finset.prod_ne_zero_iff.mp hs) i (Finset.mem_univ i) + by_contra h + have hw : weight S center m x y z = 0 := Nat.eq_zero_of_not_pos h + have hb : ¬ flagB S center m x := by + intro hb + simp only [weight, ite_eq_left hb] at hw + omega + have ha : ¬ flagA S center m z := by + intro ha + simp only [weight, ite_eq_left ha] at hw + omega + have hc : ¬ flagC S center m y := by + intro hc + simp only [weight, ite_eq_left hc] at hw + omega + cases center with + | B => + change ¬ (∀ i, S.flagB (x i)) at hb + change ¬ (∃ i, S.flagA (z i)) at ha + change ¬ (∃ i, S.flagC (y i)) at hc + obtain ⟨i, hi⟩ := not_forall.mp hb + simpa [hi, not_exists.mp ha i, not_exists.mp hc i] using hold i + | A => + change ¬ (∃ i, S.flagB (x i)) at hb + change ¬ (∀ i, S.flagA (z i)) at ha + change ¬ (∃ i, S.flagC (y i)) at hc + obtain ⟨i, hi⟩ := not_forall.mp ha + simpa [not_exists.mp hb i, hi, not_exists.mp hc i] using hold i + | C => + change ¬ (∃ i, S.flagB (x i)) at hb + change ¬ (∃ i, S.flagA (z i)) at ha + change ¬ (∀ i, S.flagC (y i)) at hc + obtain ⟨i, hi⟩ := not_forall.mp hc + simpa [not_exists.mp hb i, not_exists.mp ha i, hi] using hold i + +def complete (S : FlaggedTensor X Y Z) (center : Color) (m : ℕ) : + FlaggedTensor (Fin m → X) (Fin m → Y) (Fin m → Z) where + tensor x y z := if weight S center m x y z = 1 then + Tensor.power S.tensor m x y z else 0 + flagB := flagB S center m + flagA := flagA S center m + flagC := flagC S center m + one_hot := by + intro x y z hs + by_cases hw : weight S center m x y z = 1 + · exact hw + · simp [hw] at hs + +@[simp] theorem complete_tensor (S : FlaggedTensor X Y Z) (center : Color) + (m : ℕ) (x : Fin m → X) (y : Fin m → Y) (z : Fin m → Z) : + (complete S center m).tensor x y z = + if weight S center m x y z = 1 then Tensor.power S.tensor m x y z else 0 := rfl + +def diagonalMap {K U : Type*} [Zero K] [DecidableEq U] (f : U → K) : U → U → K := + fun output input => if input = output then f output else 0 + +theorem restrict_diagonal {K U V W : Type*} [CommSemiring K] + [Fintype U] [Fintype V] [Fintype W] + [DecidableEq U] [DecidableEq V] [DecidableEq W] + (a : U → K) (b : V → K) (c : W → K) (T : Tensor K U V W) + (x : U) (y : V) (z : W) : + Tensor.restrict (diagonalMap a) (diagonalMap b) (diagonalMap c) T x y z = + a x * b y * c z * T x y z := by + simp [Tensor.restrict, diagonalMap, ite_mul, mul_ite] + +def flagPolynomial (p : Prop) : Polynomial ℂ := if p then Polynomial.X else 1 + +theorem flagPolynomial_eq (p : Prop) : + flagPolynomial p = (Polynomial.X : Polynomial ℂ) ^ (if p then 1 else 0 : ℕ) := by + classical + by_cases hp : p <;> simp [flagPolynomial, hp] + +theorem flagPolynomial_degree (p : Prop) : (flagPolynomial p).degree ≤ 1 := by + classical + by_cases hp : p <;> simp [flagPolynomial, hp] + +variable [Fintype X] [Fintype Y] [Fintype Z] + +def leftMap (S : FlaggedTensor X Y Z) (center : Color) (m : ℕ) : + (Fin m → X) → (Fin m → X) → Polynomial ℂ := + diagonalMap (fun x => flagPolynomial (flagB S center m x)) + +def middleMap (S : FlaggedTensor X Y Z) (center : Color) (m : ℕ) : + (Fin m → Y) → (Fin m → Y) → Polynomial ℂ := + diagonalMap (fun y => flagPolynomial (flagC S center m y)) + +def rightMap (S : FlaggedTensor X Y Z) (center : Color) (m : ℕ) : + (Fin m → Z) → (Fin m → Z) → Polynomial ℂ := + diagonalMap (fun z => flagPolynomial (flagA S center m z)) + +theorem diagonalMap_flag_degree {U : Type*} [DecidableEq U] (p : U → Prop) + (u v : U) : (diagonalMap (fun u => flagPolynomial (p u)) u v).degree ≤ 1 := by + classical + by_cases h : v = u + · simpa [diagonalMap, h] using flagPolynomial_degree (p u) + · simp [diagonalMap, h] + +theorem scalingPolynomial (S : FlaggedTensor X Y Z) (center : Color) (m : ℕ) + (x : Fin m → X) (y : Fin m → Y) (z : Fin m → Z) : + Tensor.restrict (leftMap S center m) (middleMap S center m) (rightMap S center m) + (fun x y z => Polynomial.C (Tensor.power S.tensor m x y z)) x y z = + Polynomial.C (Tensor.power S.tensor m x y z) * + Polynomial.X ^ weight S center m x y z := by + classical + rw [leftMap, middleMap, rightMap, restrict_diagonal] + simp only [flagPolynomial_eq, weight, pow_add] + ring + +def completionDegeneration (S : FlaggedTensor X Y Z) (center : Color) (m : ℕ) : + Tensor.PolynomialRestrictionDegeneration (Tensor.power S.tensor m) + (complete S center m).tensor 1 1 1 1 where + leftMap := leftMap S center m + middleMap := middleMap S center m + rightMap := rightMap S center m + left_degree := diagonalMap_flag_degree _ + middle_degree := diagonalMap_flag_degree _ + right_degree := diagonalMap_flag_degree _ + vanishes := by + intro x y z j hj + have hj0 : j = 0 := by omega + subst j + rw [scalingPolynomial, Polynomial.coeff_C_mul_X_pow] + by_cases hs : Tensor.power S.tensor m x y z = 0 + · simp [hs] + · have hw := weight_pos S center m x y z hs + simp [Ne.symm (Nat.ne_of_gt hw)] + leading := by + intro x y z + rw [scalingPolynomial, Polynomial.coeff_C_mul_X_pow, complete_tensor] + simp only [eq_comm] + +end RecursiveCompletion +end MatrixMultiplication + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/Completion/Scripts.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/Completion/Scripts.lean new file mode 100644 index 0000000000000000000000000000000000000000..8e0fcabcd7e0dd5be05bbc09e476c0459b573b24 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/Completion/Scripts.lean @@ -0,0 +1,82 @@ +import OAI.LinearAlgebra.MatrixMultiplication.Completion.RecursiveCompletion + +namespace OAI + +/-! Readable tensor completion and its finite arithmetic realization. -/ + +noncomputable section + +namespace MatrixMultiplication.RecursiveCompletion + +open MatrixMultiplication.Foundation + +inductive Script where + | base + | step (prior : Script) (center : Color) (size : ℕ) + +namespace Script + +def factors : Script → ℕ + | .base => 1 + | .step prior _ m => prior.factors * m + +def Coord (U : Type*) : Script → Type _ + | .base => U + | .step prior _ m => Fin m → Coord U prior + +instance coordFintype (U : Type*) [Fintype U] (s : Script) : Fintype (Coord U s) := by + induction s with + | base => exact inferInstanceAs (Fintype U) + | step prior center m ih => + letI := ih + exact inferInstanceAs (Fintype (Fin m → Coord U prior)) + +def tensor {X Y Z : Type*} (S : FlaggedTensor X Y Z) : + (s : Script) → FlaggedTensor (Coord X s) (Coord Y s) (Coord Z s) + | .base => S + | .step prior center m => complete (tensor S prior) center m + +def order (d : ℕ) : Script → ℕ + | .base => d + | .step prior _ m => order d prior * m * 2 + 1 + +def degree (D : ℕ) : Script → ℕ + | .base => D + | .step prior _ m => degree D prior * m * 2 + 1 + 1 + 1 + +def approximation {X Y Z : Type*} [Fintype X] [Fintype Y] [Fintype Z] + (S : FlaggedTensor X Y Z) {R d D : ℕ} + (A : Tensor.PolynomialApproximation S.tensor R d D) (s : Script) : + Tensor.PolynomialApproximation (tensor S s).tensor + (R ^ s.factors) (order d s) (degree D s) := by + induction s with + | base => simpa only [tensor, Coord, factors, order, degree, pow_one] using A + | step prior center m ih => + have next := (completionDegeneration (tensor S prior) center m).compose (ih.power m) + simpa only [tensor, Coord, factors, order, degree, pow_mul] using next + +theorem rank_power {X Y Z : Type*} [Fintype X] [Fintype Y] [Fintype Z] + (S : FlaggedTensor X Y Z) {R d D : ℕ} + (A : Tensor.PolynomialApproximation S.tensor R d D) (s : Script) (n : ℕ) : + Tensor.RankAtMost (Tensor.power (tensor S s).tensor n) + ((degree D s * n + 1) * (R ^ s.factors) ^ n) := + (approximation S A s).rank_power n + +def dual : Script := + step (step (step (step (step (step (step base .B 2) .A 2) .C 2) .B 3) .C 2) .B 2) .A 3 + +def curve : Script := step base .A 3 + +def square : Script := + step (step (step (step (step base .B 2) .A 3) .C 2) .B 2) .A 3 + +@[simp] theorem dual_factors : dual.factors = 288 := by rfl +@[simp] theorem curve_factors : curve.factors = 3 := by rfl +@[simp] theorem square_factors : square.factors = 72 := by rfl + +end Script +end MatrixMultiplication.RecursiveCompletion + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/Completion/SquareRates.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/Completion/SquareRates.lean new file mode 100644 index 0000000000000000000000000000000000000000..baa03d8219e66192a89f9197da4a4819840a6f62 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/Completion/SquareRates.lean @@ -0,0 +1,122 @@ +import OAI.LinearAlgebra.MatrixMultiplication.Completion.FiniteRealization +import OAI.LinearAlgebra.MatrixMultiplication.ComplexBounds.SquareWitness + +namespace OAI + +/-! Readable tensor completion and its finite arithmetic realization. -/ + +noncomputable section + +namespace MatrixMultiplication.CompletionSquareRates + +open MatrixMultiplication.Foundation CompletionHierarchyWords CompletionFiniteRealization +open Filter StageHierarchyResources +open scoped BigOperators Topology Classical + +variable {A X Y Z : Type} [Fintype A] [Fintype X] [Fintype Y] [Fintype Z] +variable (H : ReadableHierarchy A X Y Z) (counts : A → ℕ) +variable (hD : 0 < ∑ a, counts a) +variable (complete : Function.Injective (labelRecordOf H.labels H.depth)) +variable {T : Tensor ℂ X Y Z} {factors d D : ℕ} +variable (source : Tensor.PolynomialApproximation T (3 ^ factors) d D) +variable (supported : ∀ x y z, T x y z ≠ 0 → + ∃ a, H.x a = x ∧ H.y a = y ∧ H.z a = z) +variable (unit : ∀ a, T (H.x a) (H.y a) (H.z a) = 1) +variable (factors_pos : 0 < factors) + +def positiveRealization (n : ℕ) : FiniteMMRealization := + realization H counts (n + 1) complete source supported unit factors_pos + (Nat.mul_pos (Nat.succ_pos n) hD) + +def countMass (a : A) : ℝ := (counts a : ℝ) / (∑ a, counts a : ℕ) + +private theorem normalize_log (K t population factors : ℕ) + (_ : 0 < t) (_ : 0 < population) (_ : 0 < factors) : + Real.log (K : ℝ) / ((factors * (t * population) : ℕ) : ℝ) = + (Real.log (K : ℝ) / ((t : ℝ) * (population : ℝ))) / (factors : ℝ) := by + simp only [Nat.cast_mul, div_div] + congr 1 + ring + +theorem multiplicity_rate : + Tendsto (fun n => + Real.log ((positiveRealization H counts hD complete source supported unit factors_pos n).multiplicity : ℝ) / + ((positiveRealization H counts hD complete source supported unit factors_pos n).occurrences : ℝ)) + atTop (𝓝 (finiteEntropy (countMass counts) / factors)) := by + have hpop := (tendsto_log_exactWords_card_mul counts hD).comp (tendsto_add_atTop_nat 1) + have hnormalized := hpop.div_const (factors : ℝ) + change Tendsto _ atTop (𝓝 (finiteEntropy (countMass counts) / factors)) at hnormalized + apply hnormalized.congr + intro n + symm + change Real.log (copies H counts (n + 1) : ℝ) / + ((factors * blocks counts (n + 1) : ℕ) : ℝ) = _ + simp only [copies, blocks, CompletionExecution.realize_label_card H counts (n + 1) complete] + exact normalize_log _ (n + 1) (∑ a, counts a) factors (Nat.succ_pos n) hD factors_pos + +theorem auxiliary_rate : + Tendsto (fun n => + Real.log ((positiveRealization H counts hD complete source supported unit factors_pos n).auxiliaryRank : ℝ) / + ((positiveRealization H counts hD complete source supported unit factors_pos n).occurrences : ℝ)) + atTop (𝓝 (finiteEntropy (countMass counts) / factors)) := by + have hrank := (tendsto_log_stageAuxiliaryBudget counts hD H.labels H.depth complete).comp + (tendsto_add_atTop_nat 1) + have hnormalized := hrank.div_const (factors : ℝ) + change Tendsto _ atTop (𝓝 (finiteEntropy (countMass counts) / factors)) at hnormalized + apply hnormalized.congr + intro n + symm + change Real.log ((CompletionExecution.realize H counts (n + 1)).execution.rankBound : ℝ) / + ((factors * blocks counts (n + 1) : ℕ) : ℝ) = _ + simp only [CompletionExecution.realize_rankBound, blocks] + exact normalize_log _ (n + 1) (∑ a, counts a) factors (Nat.succ_pos n) hD factors_pos + +theorem volume_rate : + Tendsto (fun n => + Real.log ((positiveRealization H counts hD complete source supported unit factors_pos n).rates.volume : ℝ) / + ((positiveRealization H counts hD complete source supported unit factors_pos n).occurrences : ℝ)) + atTop (𝓝 (finiteEntropy (countMass counts) / factors)) := by + have hpop := (tendsto_log_exactWords_card_mul counts hD).comp (tendsto_add_atTop_nat 1) + have hnormalized := hpop.div_const (factors : ℝ) + change Tendsto _ atTop (𝓝 (finiteEntropy (countMass counts) / factors)) at hnormalized + apply hnormalized.congr + intro n + symm + change Real.log ((rows H counts (n + 1) * inner H counts (n + 1) * + columns H counts (n + 1) : ℕ) : ℝ) / + ((factors * blocks counts (n + 1) : ℕ) : ℝ) = _ + rw [volume_eq_copies H counts (n + 1) complete] + simp only [copies, blocks, CompletionExecution.realize_label_card H counts (n + 1) complete] + exact normalize_log _ (n + 1) (∑ a, counts a) factors (Nat.succ_pos n) hD factors_pos + +theorem score_limit (β : ℝ) : + Tendsto (fun n => + (positiveRealization H counts hD complete source supported unit factors_pos n).rates.score β) + atTop (𝓝 (β / (3 * factors) * finiteEntropy (countMass counts))) := by + have hm := multiplicity_rate H counts hD complete source supported unit factors_pos + have ha := auxiliary_rate H counts hD complete source supported unit factors_pos + have hv := volume_rate H counts hD complete source supported unit factors_pos + have hl := (hm.sub ha).add (hv.const_mul (β / 3)) + have he : finiteEntropy (countMass counts) / factors - + finiteEntropy (countMass counts) / factors + + β / 3 * (finiteEntropy (countMass counts) / factors) = + β / (3 * factors) * finiteEntropy (countMass counts) := by ring + rw [he] at hl + apply hl.congr + intro n + simp only [FiniteConstructionRates.score, FiniteMMRealization.rates] + ring + +include H hD complete source supported unit factors_pos in +theorem omega_lt_of_entropy_gap (β : ℝ) + (gap : Real.log 3 < β / (3 * factors) * finiteEntropy (countMass counts)) : + MatrixMultiplication.Foundation.Arithmetic.omega < β := + ComplexWitness.omega_lt_of_score_limit + (positiveRealization H counts hD complete source supported unit factors_pos) + (score_limit H counts hD complete source supported unit factors_pos β) gap + +end MatrixMultiplication.CompletionSquareRates + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/Completion/Termination.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/Completion/Termination.lean new file mode 100644 index 0000000000000000000000000000000000000000..6b3e179e9f9fc5f5bf3fc0950ff3a82f74145a6e --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/Completion/Termination.lean @@ -0,0 +1,88 @@ +import OAI.LinearAlgebra.MatrixMultiplication.Completion.Labels +import OAI.LinearAlgebra.MatrixMultiplication.Polynomial.ComplexPolynomialRestriction + +namespace OAI + +/-! Readable tensor completion and its finite arithmetic realization. -/ + +noncomputable section + +namespace MatrixMultiplication.CompletionTermination + +open MatrixMultiplication.Foundation RecursiveCompletion CompletionLabels +attribute [local instance] Classical.propDecidable Classical.decEq + +universe uCoord +variable {X Y Z : Type uCoord} + +def tensor (S : FlaggedTensor X Y Z) (deleted : Color) : Tensor ℂ X Y Z := + fun x y z => if ownerFlag S deleted (coordinate (x, y, z) deleted) then 0 + else S.tensor x y z + +theorem support_iff (S : FlaggedTensor X Y Z) (deleted : Color) (x y z) : + tensor S deleted x y z ≠ 0 ↔ S.tensor x y z ≠ 0 ∧ + ¬ ownerFlag S deleted (coordinate (x, y, z) deleted) := by + by_cases h : ownerFlag S deleted (coordinate (x, y, z) deleted) <;> + simp [tensor, h] + +def leftMap (S : FlaggedTensor X Y Z) (deleted : Color) : X → X → ℂ := + diagonalMap (fun x => if deleted = .B ∧ S.flagB x then 0 else 1) + +def middleMap (S : FlaggedTensor X Y Z) (deleted : Color) : Y → Y → ℂ := + diagonalMap (fun y => if deleted = .C ∧ S.flagC y then 0 else 1) + +def rightMap (S : FlaggedTensor X Y Z) (deleted : Color) : Z → Z → ℂ := + diagonalMap (fun z => if deleted = .A ∧ S.flagA z then 0 else 1) + +variable [Fintype X] [Fintype Y] [Fintype Z] + +theorem restriction (S : FlaggedTensor X Y Z) (deleted : Color) : + Tensor.restrict (leftMap S deleted) (middleMap S deleted) (rightMap S deleted) + S.tensor = tensor S deleted := by + funext x y z + rw [leftMap, middleMap, rightMap, restrict_diagonal] + cases deleted <;> simp [tensor, ownerFlag, coordinate, ite_mul, reduceCtorEq] <;> rfl + +def approximation (S : FlaggedTensor X Y Z) (deleted : Color) {R d D : ℕ} + (W : Tensor.PolynomialApproximation S.tensor R d D) : + Tensor.PolynomialApproximation (tensor S deleted) R d D := by + simpa only [restriction] using + W.restrict (leftMap S deleted) (middleMap S deleted) (rightMap S deleted) + +def Leaf (S : FlaggedTensor X Y Z) (deleted : Color) := + {p : X × Y × Z // tensor S deleted p.1 p.2.1 p.2.2 ≠ 0} + +instance leafFintype (S : FlaggedTensor X Y Z) (deleted : Color) : + Fintype (Leaf S deleted) := + inferInstanceAs (Fintype {p : X × Y × Z // tensor S deleted p.1 p.2.1 p.2.2 ≠ 0}) + +def leafEquiv (S : FlaggedTensor X Y Z) (deleted : Color) : + Leaf S deleted ≃ {a : CompletionLabels.Leaf S // leafColor S a ≠ deleted} where + toFun a := + ⟨⟨a.val, ((support_iff S deleted _ _ _).mp a.property).1⟩, + fun h => ((support_iff S deleted _ _ _).mp a.property).2 + ((leafColor_eq_iff S _ deleted).mp h)⟩ + invFun a := + ⟨a.val.val, (support_iff S deleted _ _ _).mpr + ⟨a.val.property, fun h => a.property ((leafColor_eq_iff S _ deleted).mpr h)⟩⟩ + left_inv a := by apply Subtype.ext; rfl + right_inv a := by apply Subtype.ext; apply Subtype.ext; rfl + +def retainedLeafEquiv (S : FlaggedTensor X Y Z) (deleted first second : Color) + (colors : ∀ c : Color, c ≠ deleted ↔ c = first ∨ c = second) : + Leaf S deleted ≃ RetainedLeaf S first second := + (leafEquiv S deleted).trans + (Equiv.subtypeEquivRight (fun a => colors (leafColor S a))) + +omit [Fintype X] [Fintype Y] [Fintype Z] in +@[simp] theorem retainedLeafEquiv_coordinates + (S : FlaggedTensor X Y Z) (deleted first second : Color) + (colors : ∀ c : Color, c ≠ deleted ↔ c = first ∨ c = second) + (a : Leaf S deleted) : + ((retainedLeafEquiv S deleted first second colors a).val).val = a.val := rfl + +end MatrixMultiplication.CompletionTermination + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/Completion/TerminationLaw.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/Completion/TerminationLaw.lean new file mode 100644 index 0000000000000000000000000000000000000000..5d64bf24601d857e7c0a5f8ff5bfddfd8db3d651 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/Completion/TerminationLaw.lean @@ -0,0 +1,105 @@ +import OAI.LinearAlgebra.MatrixMultiplication.Completion.ColorEntropy +import OAI.LinearAlgebra.MatrixMultiplication.Completion.Entropy +import OAI.LinearAlgebra.MatrixMultiplication.Entropy.IndependentConditioning + +namespace OAI + +/-! Readable tensor completion and its finite arithmetic realization. -/ + +noncomputable section + +namespace MatrixMultiplication.CompletionTerminationLaw + +open MatrixMultiplication.Foundation CompletionLabels CompletionColorLaws CompletionLaws +open scoped BigOperators +attribute [local instance 10000] Classical.propDecidable Classical.decEq +attribute [local instance 11000] instDecidableEqFin + +universe u +variable {X Y Z : Type u} [Fintype X] [Fintype Y] [Fintype Z] + +theorem retained_mass_one (S : FlaggedTensor X Y Z) (first second : Color) + (pf : FiniteLaw (ColorSlice S first)) (ps : FiniteLaw (ColorSlice S second)) + (a : ℝ) (ha : 0 ≤ a) (ha' : a ≤ 1) : + eventMass (colorMix S first second pf ps a ha ha') + (fun w => leafColor S w = first ∨ leafColor S w = second) = 1 := by + rw [eventMass, sum_subtype_indicator] + calc + _ = ∑ w, (colorMix S first second pf ps a ha ha').mass w := by + apply Finset.sum_congr rfl + intro w _ + split_ifs with h + · rfl + · exact (colorMix_mass_zero S first second pf ps a ha ha' w + (fun h' => h (Or.inl h')) (fun h' => h (Or.inr h'))).symm + _ = _ := (colorMix S first second pf ps a ha ha').total + +def retainedEquiv (S : FlaggedTensor X Y Z) (first second : Color) : + {w : Leaf S // leafColor S w = first ∨ leafColor S w = second} ≃ + RetainedLeaf S first second := Equiv.refl _ + +theorem retained_sum (S : FlaggedTensor X Y Z) (first second : Color) (f : Leaf S → ℝ) : + (∑ w : RetainedLeaf S first second, f w.val) = + ∑ w : {w : Leaf S // leafColor S w = first ∨ leafColor S w = second}, f w.val := by + exact ((retainedEquiv S first second).sum_comp + (fun w : RetainedLeaf S first second => f w.val)).symm + +def law (S : FlaggedTensor X Y Z) (first second : Color) + (pf : FiniteLaw (ColorSlice S first)) (ps : FiniteLaw (ColorSlice S second)) + (a : ℝ) (ha : 0 ≤ a) (ha' : a ≤ 1) : + FiniteLaw (RetainedLeaf S first second) where + mass w := (colorMix S first second pf ps a ha ha').mass w.val + nonneg w := (colorMix S first second pf ps a ha ha').nonneg w.val + total := by + rw [retained_sum] + exact retained_mass_one S first second pf ps a ha ha' + +theorem law_mass (S : FlaggedTensor X Y Z) (first second : Color) + (pf : FiniteLaw (ColorSlice S first)) (ps : FiniteLaw (ColorSlice S second)) + (a : ℝ) (ha : 0 ≤ a) (ha' : a ≤ 1) (w : RetainedLeaf S first second) : + (law S first second pf ps a ha ha').mass w = + (colorMix S first second pf ps a ha ha').mass w.val := rfl + +theorem law_map_mass {U : Type*} [Fintype U] + (S : FlaggedTensor X Y Z) (first second : Color) + (pf : FiniteLaw (ColorSlice S first)) (ps : FiniteLaw (ColorSlice S second)) + (a : ℝ) (ha : 0 ≤ a) (ha' : a ≤ 1) (f : Leaf S → U) (u : U) : + ((law S first second pf ps a ha ha').map (fun w => f w.val)).mass u = + ((colorMix S first second pf ps a ha ha').map f).mass u := by + rw [FiniteLaw.map_mass] + simp only [law_mass] + rw [retained_sum S first second + (fun w => if f w = u then (colorMix S first second pf ps a ha ha').mass w else 0)] + rw [sum_subtype_indicator (fun w : Leaf S => + leafColor S w = first ∨ leafColor S w = second) + (fun w => if f w = u then (colorMix S first second pf ps a ha ha').mass w else 0)] + rw [FiniteLaw.map_mass] + apply Finset.sum_congr rfl + intro w _ + by_cases h : leafColor S w = first ∨ leafColor S w = second + · simp [h] + · have hz := colorMix_mass_zero S first second pf ps a ha ha' w + (fun h' => h (Or.inl h')) (fun h' => h (Or.inr h')) + simp [h, hz] + +theorem law_entropy (S : FlaggedTensor X Y Z) (first second : Color) + (hne : first ≠ second) + (pf : FiniteLaw (ColorSlice S first)) (ps : FiniteLaw (ColorSlice S second)) + (a : ℝ) (ha : 0 ≤ a) (ha' : a ≤ 1) : + finiteEntropy (law S first second pf ps a ha ha').mass = + entropyTerm a + entropyTerm (1 - a) + + a * finiteEntropy pf.mass + (1 - a) * finiteEntropy ps.mass := by + have hmap : ((law S first second pf ps a ha ha').map Subtype.val).mass = + (colorMix S first second pf ps a ha ha').mass := by + funext w + exact (law_map_mass S first second pf ps a ha ha' id w).trans + ((colorMix S first second pf ps a ha ha').map_mass_apply id Function.injective_id w) + rw [← (law S first second pf ps a ha ha').map_entropy_of_injective + Subtype.val Subtype.val_injective, hmap] + exact colorMix_entropy S first second hne pf ps a ha ha' + +end MatrixMultiplication.CompletionTerminationLaw + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/ComplexArithmetic/Complexity.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/ComplexArithmetic/Complexity.lean new file mode 100644 index 0000000000000000000000000000000000000000..37c2e0a2c9d693bc8c2e65770db871b352b66a54 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/ComplexArithmetic/Complexity.lean @@ -0,0 +1,151 @@ +import OAI.LinearAlgebra.MatrixMultiplication.Tensor.ComplexTensor +import Mathlib.Analysis.SpecialFunctions.Pow.Real +import Mathlib.Data.Matrix.Mul + +namespace OAI + +/-! Complex arithmetic programs and asymptotic matrix multiplication costs. -/ + +noncomputable section + +open scoped BigOperators + +namespace MatrixMultiplication.Foundation + +namespace Arithmetic + +inductive Gate (Input Register : Type*) where + | constant : ℂ → Gate Input Register + | input : Input → Gate Input Register + | add : Register → Register → Gate Input Register + | sub : Register → Register → Gate Input Register + | mul : Register → Register → Gate Input Register + +namespace Gate + +variable {Input Register : Type*} + +def eval (inputs : Input → ℂ) (registers : Register → ℂ) : Gate Input Register → ℂ + | .constant z => z + | .input i => inputs i + | .add i j => registers i + registers j + | .sub i j => registers i - registers j + | .mul i j => registers i * registers j + +def cost : Gate Input Register → ℕ + | .constant _ => 0 + | .input _ => 0 + | .add _ _ => 1 + | .sub _ _ => 1 + | .mul _ _ => 1 + +end Gate + +inductive Program (Input : Type*) : ℕ → Type _ where + | nil : Program Input 0 + | step {r : ℕ} : Program Input r → Gate Input (Fin r) → Program Input (r + 1) + +namespace Program + +variable {Input : Type*} + +def eval : {r : ℕ} → Program Input r → (Input → ℂ) → Fin r → ℂ + | 0, .nil, _ => Fin.elim0 + | _ + 1, .step p g, inputs => + Fin.cases (g.eval inputs (p.eval inputs)) (p.eval inputs) + +def cost : {r : ℕ} → Program Input r → ℕ + | 0, .nil => 0 + | _ + 1, .step p g => p.cost + g.cost + +@[simp] theorem eval_step_zero {r : ℕ} (p : Program Input r) + (g : Gate Input (Fin r)) (inputs : Input → ℂ) : + (p.step g).eval inputs 0 = g.eval inputs (p.eval inputs) := rfl + +@[simp] theorem eval_step_succ {r : ℕ} (p : Program Input r) + (g : Gate Input (Fin r)) (inputs : Input → ℂ) (i : Fin r) : + (p.step g).eval inputs i.succ = p.eval inputs i := rfl + +@[simp] theorem cost_step {r : ℕ} (p : Program Input r) + (g : Gate Input (Fin r)) : (p.step g).cost = p.cost + g.cost := rfl + +end Program + +abbrev MatrixInput (n : ℕ) := (Fin n × Fin n) ⊕ (Fin n × Fin n) + +def matrixInputs {n : ℕ} (A B : Matrix (Fin n) (Fin n) ℂ) : MatrixInput n → ℂ + | .inl (i, j) => A i j + | .inr (j, k) => B j k + +structure MatrixAlgorithm (n : ℕ) where + registers : ℕ + program : Program (MatrixInput n) registers + output : Fin n → Fin n → Fin registers + +namespace MatrixAlgorithm + +def eval {n : ℕ} (P : MatrixAlgorithm n) + (A B : Matrix (Fin n) (Fin n) ℂ) : Matrix (Fin n) (Fin n) ℂ := + fun i k => P.program.eval (matrixInputs A B) (P.output i k) + +def Correct {n : ℕ} (P : MatrixAlgorithm n) : Prop := + ∀ A B : Matrix (Fin n) (Fin n) ℂ, P.eval A B = A * B + +def cost {n : ℕ} (P : MatrixAlgorithm n) : ℕ := P.program.cost + +theorem correct_iff_entries {n : ℕ} (P : MatrixAlgorithm n) : + P.Correct ↔ ∀ (A B : Matrix (Fin n) (Fin n) ℂ) (i k : Fin n), + P.program.eval (matrixInputs A B) (P.output i k) = ∑ j, A i j * B j k := by + constructor + · intro h A B i k + exact congrFun (congrFun (h A B) i) k + · intro h A B + funext i k + exact h A B i k + +end MatrixAlgorithm + +def scalarAlgorithm : MatrixAlgorithm 1 where + registers := 3 + program := ((Program.nil.step (.input (.inl (0, 0)))).step + (.input (.inr (0, 0)))).step (.mul 1 0) + output := fun _ _ => 0 + +theorem scalarAlgorithm_correct : scalarAlgorithm.Correct := by + intro A B + funext i k + have hi : i = 0 := Subsingleton.elim _ _ + have hk : k = 0 := Subsingleton.elim _ _ + subst i + subst k + change A 0 0 * B 0 0 = (A * B) 0 0 + simp [Matrix.mul_apply] + +@[simp] theorem scalarAlgorithm_cost : scalarAlgorithm.cost = 1 := rfl + +def AdmissibleExponent (τ : ℝ) : Prop := + ∀ ε : ℝ, 0 < ε → ∃ C : ℝ, 0 < C ∧ + ∀ n : ℕ, 1 ≤ n → ∃ P : MatrixAlgorithm n, + P.Correct ∧ (P.cost : ℝ) ≤ C * (n : ℝ) ^ (τ + ε) + +noncomputable def omega : ℝ := sInf {τ : ℝ | AdmissibleExponent τ} + +end Arithmetic + +namespace Tensor + +def matrixMultiplication (a b c : ℕ) : + Tensor ℂ (Fin a × Fin b) (Fin b × Fin c) (Fin c × Fin a) := + fun x y z => if x.2 = y.1 ∧ y.2 = z.1 ∧ z.2 = x.1 then 1 else 0 + +@[simp] theorem matrixMultiplication_matching (a b c : ℕ) + (i : Fin a) (j : Fin b) (k : Fin c) : + matrixMultiplication a b c (i, j) (j, k) (k, i) = 1 := by + simp [matrixMultiplication] + +end Tensor +end MatrixMultiplication.Foundation + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/ComplexArithmetic/Exponent.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/ComplexArithmetic/Exponent.lean new file mode 100644 index 0000000000000000000000000000000000000000..b6898b4476c504b75f2bb009c6aa1830635c1a77 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/ComplexArithmetic/Exponent.lean @@ -0,0 +1,56 @@ +import OAI.LinearAlgebra.MatrixMultiplication.ComplexArithmetic.NaiveAlgorithm +import OAI.LinearAlgebra.MatrixMultiplication.ComplexArithmetic.LowerBound + +namespace OAI + +/-! Complex arithmetic programs and asymptotic matrix multiplication costs. -/ + +noncomputable section + +namespace MatrixMultiplication.Foundation.Arithmetic + +theorem AdmissibleExponent.mono {τ σ : ℝ} (hτ : AdmissibleExponent τ) + (hτσ : τ ≤ σ) : AdmissibleExponent σ := by + intro ε hε + obtain ⟨C, hC, hbound⟩ := hτ ε hε + refine ⟨C, hC, ?_⟩ + intro n hn + obtain ⟨P, hP, hcost⟩ := hbound n hn + refine ⟨P, hP, hcost.trans ?_⟩ + apply mul_le_mul_of_nonneg_left _ hC.le + exact Real.rpow_le_rpow_of_exponent_le (by exact_mod_cast hn) + (add_le_add_left hτσ ε) + +theorem omega_le_of_admissibleExponent {τ : ℝ} (hτ : AdmissibleExponent τ) : + omega ≤ τ := + csInf_le admissibleExponent_bddBelow hτ + +theorem omega_nonneg : 0 ≤ omega := + le_csInf admissibleExponent_nonempty (fun _ hτ => admissibleExponent_nonneg hτ) + +theorem omega_le_three : omega ≤ 3 := + omega_le_of_admissibleExponent admissibleExponent_three + +theorem omega_admissibleExponent : AdmissibleExponent omega := by + intro ε hε + have hhalf : 0 < ε / 2 := half_pos hε + obtain ⟨τ, hτ, hclose⟩ := exists_lt_of_csInf_lt admissibleExponent_nonempty + (show sInf {σ : ℝ | AdmissibleExponent σ} < omega + ε / 2 from + lt_add_of_pos_right omega hhalf) + obtain ⟨C, hC, hbound⟩ := hτ (ε / 2) hhalf + refine ⟨C, hC, ?_⟩ + intro n hn + obtain ⟨P, hP, hcost⟩ := hbound n hn + refine ⟨P, hP, hcost.trans ?_⟩ + apply mul_le_mul_of_nonneg_left _ hC.le + exact Real.rpow_le_rpow_of_exponent_le (by exact_mod_cast hn) (by linarith) + +theorem admissibleExponent_iff_omega_le {τ : ℝ} : + AdmissibleExponent τ ↔ omega ≤ τ := + ⟨omega_le_of_admissibleExponent, omega_admissibleExponent.mono⟩ + +end MatrixMultiplication.Foundation.Arithmetic + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/ComplexArithmetic/Growth.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/ComplexArithmetic/Growth.lean new file mode 100644 index 0000000000000000000000000000000000000000..7540631217521cc9cb34ea5f35ef3b549da9b4bf --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/ComplexArithmetic/Growth.lean @@ -0,0 +1,226 @@ +import OAI.LinearAlgebra.MatrixMultiplication.ComplexArithmetic.Complexity +import OAI.LinearAlgebra.MatrixMultiplication.ComplexArithmetic.MatrixPadding +import OAI.LinearAlgebra.MatrixMultiplication.ComplexArithmetic.RecursiveBlockPrograms +import Mathlib.Data.Nat.Log +import Mathlib.Tactic.FieldSimp +import Mathlib.Tactic.Linarith +import Mathlib.Tactic.Ring +import Lean.Elab.Tactic.Omega + +namespace OAI + +/-! Complex arithmetic programs and asymptotic matrix multiplication costs. -/ + +noncomputable section + +namespace MatrixMultiplication.Foundation.Arithmetic + +theorem exists_power_cover {b n : ℕ} (hb : 2 ≤ b) (hn : 1 ≤ n) : + ∃ k : ℕ, n ≤ b ^ k ∧ b ^ k ≤ b * n := by + refine ⟨Nat.log b n + 1, (Nat.lt_pow_succ_log_self (by omega) n).le, ?_⟩ + rw [pow_succ'] + exact Nat.mul_le_mul_left b (Nat.pow_log_le_self b (by omega)) + +theorem geometric_cost_recurrence_bound (x : ℕ → ℝ) (a b d q : ℝ) + (hx : 0 ≤ x 0) (ha : 0 ≤ a) (hb : 0 ≤ b) (hd : 0 ≤ d) + (haq : a < q) (hdq : d ≤ q) + (hstep : ∀ k, x (k + 1) ≤ a * x k + b * d ^ k) : + ∃ C : ℝ, 0 < C ∧ ∀ k, x k ≤ C * q ^ k := by + let C := x 0 + b / (q - a) + 1 + have hgap : 0 < q - a := sub_pos.mpr haq + have hfrac : 0 ≤ b / (q - a) := div_nonneg hb hgap.le + have hC : 0 < C := by dsimp [C]; linarith + have hcancel : (q - a) * (b / (q - a)) = b := by + field_simp [ne_of_gt hgap] + have hCfrac : b / (q - a) ≤ C := by dsimp [C]; linarith + have hcoeff : a * C + b ≤ C * q := by + have hmul := mul_le_mul_of_nonneg_left hCfrac hgap.le + rw [hcancel] at hmul + calc + a * C + b ≤ a * C + (q - a) * C := add_le_add_right hmul _ + _ = C * q := by ring + refine ⟨C, hC, ?_⟩ + intro k + induction k with + | zero => simp only [pow_zero, mul_one]; dsimp [C]; linarith + | succ k ih => + calc + x (k + 1) ≤ a * x k + b * d ^ k := hstep k + _ ≤ a * (C * q ^ k) + b * q ^ k := + add_le_add (mul_le_mul_of_nonneg_left ih ha) + (mul_le_mul_of_nonneg_left (pow_le_pow_left₀ hd hdq k) hb) + _ = (a * C + b) * q ^ k := by ring + _ ≤ (C * q) * q ^ k := + mul_le_mul_of_nonneg_right hcoeff (pow_nonneg (hd.trans hdq) k) + _ = C * q ^ (k + 1) := by rw [pow_succ]; ring + +theorem power_cost_padding_bound + (hpad : ∀ {n m : ℕ}, n ≤ m → ∀ P : MatrixAlgorithm m, P.Correct → + ∃ Q : MatrixAlgorithm n, Q.Correct ∧ Q.cost ≤ P.cost) + {b : ℕ} (hb : 2 ≤ b) {s C : ℝ} (hs : 0 ≤ s) (hC : 0 < C) + (hpower : ∀ k : ℕ, ∃ P : MatrixAlgorithm (b ^ k), + P.Correct ∧ (P.cost : ℝ) ≤ C * ((b : ℝ) ^ s) ^ k) : + ∃ D : ℝ, 0 < D ∧ ∀ n : ℕ, 1 ≤ n → ∃ P : MatrixAlgorithm n, + P.Correct ∧ (P.cost : ℝ) ≤ D * (n : ℝ) ^ s := by + have hbpos : 0 < (b : ℝ) := by exact_mod_cast (by omega : 0 < b) + refine ⟨C * (b : ℝ) ^ s, mul_pos hC (Real.rpow_pos_of_pos hbpos s), ?_⟩ + intro n hn + obtain ⟨k, hnk, hkn⟩ := exists_power_cover hb hn + obtain ⟨P, hP, hcost⟩ := hpower k + obtain ⟨Q, hQ, hQP⟩ := hpad hnk P hP + refine ⟨Q, hQ, ?_⟩ + calc + (Q.cost : ℝ) ≤ (P.cost : ℝ) := by exact_mod_cast hQP + _ ≤ C * ((b : ℝ) ^ s) ^ k := hcost + _ = C * ((b ^ k : ℕ) : ℝ) ^ s := by + rw [Real.rpow_pow_comm hbpos.le, Nat.cast_pow] + _ ≤ C * ((b : ℝ) * (n : ℝ)) ^ s := + mul_le_mul_of_nonneg_left + (Real.rpow_le_rpow (Nat.cast_nonneg _) (by exact_mod_cast hkn) hs) hC.le + _ = (C * (b : ℝ) ^ s) * (n : ℝ) ^ s := by + rw [Real.mul_rpow hbpos.le (Nat.cast_nonneg n)] + ring + +theorem admissibleExponent_of_uniform_power_costs + (hpad : ∀ {n m : ℕ}, n ≤ m → ∀ P : MatrixAlgorithm m, P.Correct → + ∃ Q : MatrixAlgorithm n, Q.Correct ∧ Q.cost ≤ P.cost) + {b : ℕ} (hb : 2 ≤ b) {τ C : ℝ} (hτ : 0 ≤ τ) (hC : 0 < C) + (hpower : ∀ k : ℕ, ∃ P : MatrixAlgorithm (b ^ k), + P.Correct ∧ (P.cost : ℝ) ≤ C * ((b : ℝ) ^ τ) ^ k) : + AdmissibleExponent τ := by + obtain ⟨D, hD, hall⟩ := power_cost_padding_bound hpad hb hτ hC hpower + intro ε hε + refine ⟨D, hD, ?_⟩ + intro n hn + obtain ⟨P, hP, hcost⟩ := hall n hn + refine ⟨P, hP, hcost.trans ?_⟩ + exact mul_le_mul_of_nonneg_left + (Real.rpow_le_rpow_of_exponent_le (by exact_mod_cast hn) (by linarith)) hD.le + +theorem admissibleExponent_of_power_costs + (hpad : ∀ {n m : ℕ}, n ≤ m → ∀ P : MatrixAlgorithm m, P.Correct → + ∃ Q : MatrixAlgorithm n, Q.Correct ∧ Q.cost ≤ P.cost) + {b : ℕ} (hb : 2 ≤ b) {τ : ℝ} (hτ : 0 ≤ τ) + (hpower : ∀ ε : ℝ, 0 < ε → ∃ C : ℝ, 0 < C ∧ + ∀ k : ℕ, ∃ P : MatrixAlgorithm (b ^ k), + P.Correct ∧ (P.cost : ℝ) ≤ C * ((b : ℝ) ^ (τ + ε)) ^ k) : + AdmissibleExponent τ := by + intro ε hε + obtain ⟨C, hC, hcost⟩ := hpower ε hε + exact power_cost_padding_bound hpad hb (by linarith) hC hcost + +theorem admissibleExponent_of_recursive_costs + (hpad : ∀ {n m : ℕ}, n ≤ m → ∀ P : MatrixAlgorithm m, P.Correct → + ∃ Q : MatrixAlgorithm n, Q.Correct ∧ Q.cost ≤ P.cost) + {b R K : ℕ} (hb : 2 ≤ b) {τ : ℝ} (hτ : 2 ≤ τ) + (hR : (R : ℝ) ≤ (b : ℝ) ^ τ) + (P : ∀ k : ℕ, MatrixAlgorithm (b ^ k)) + (hP : ∀ k, (P k).Correct) + (hstep : ∀ k, (P (k + 1)).cost ≤ R * (P k).cost + K * (b ^ k) ^ 2) : + AdmissibleExponent τ := by + apply admissibleExponent_of_power_costs hpad hb (by linarith) + intro ε hε + have hbpos : 0 < (b : ℝ) := by exact_mod_cast (by omega : 0 < b) + have hbone : 1 < (b : ℝ) := by exact_mod_cast (by omega : 1 < b) + have hrate : (R : ℝ) < (b : ℝ) ^ (τ + ε) := + hR.trans_lt (Real.rpow_lt_rpow_of_exponent_lt hbone (by linarith)) + have hquad : (b : ℝ) ^ (2 : ℕ) ≤ (b : ℝ) ^ (τ + ε) := by + rw [← Real.rpow_natCast] + change (b : ℝ) ^ (2 : ℝ) ≤ (b : ℝ) ^ (τ + ε) + exact Real.rpow_le_rpow_of_exponent_le hbone.le (by linarith) + obtain ⟨C, hC, hbound⟩ := geometric_cost_recurrence_bound + (fun k => ((P k).cost : ℝ)) (R : ℝ) (K : ℝ) ((b : ℝ) ^ (2 : ℕ)) + ((b : ℝ) ^ (τ + ε)) (Nat.cast_nonneg _) (Nat.cast_nonneg _) + (Nat.cast_nonneg _) (sq_nonneg _) hrate hquad (fun k => by + have h := hstep k + have hcast : ((P (k + 1)).cost : ℝ) ≤ + (R : ℝ) * ((P k).cost : ℝ) + (K : ℝ) * ((b : ℝ) ^ k) ^ 2 := by + exact_mod_cast h + simpa only [← pow_mul, Nat.mul_comm k 2] using hcast) + exact ⟨C, hC, fun k => ⟨P k, hP k, hbound k⟩⟩ + +def blockRecurrenceCost (b R K : ℕ) : ℕ → ℕ + | 0 => 1 + | k + 1 => R * blockRecurrenceCost b R K k + K * (b ^ k) ^ 2 + +@[simp] theorem blockRecurrenceCost_zero (b R K : ℕ) : + blockRecurrenceCost b R K 0 = 1 := rfl + +@[simp] theorem blockRecurrenceCost_succ (b R K k : ℕ) : + blockRecurrenceCost b R K (k + 1) = + R * blockRecurrenceCost b R K k + K * (b ^ k) ^ 2 := rfl + +theorem power_programs_of_block_step {b R K : ℕ} + (hstep : ∀ m : ℕ, ∀ P : MatrixAlgorithm m, P.Correct → + ∃ Q : MatrixAlgorithm (b * m), Q.Correct ∧ + Q.cost ≤ R * P.cost + K * m ^ 2) : + ∀ k : ℕ, ∃ P : MatrixAlgorithm (b ^ k), P.Correct ∧ + P.cost ≤ blockRecurrenceCost b R K k := by + intro k + induction k with + | zero => + exact ⟨scalarAlgorithm, scalarAlgorithm_correct, by simp⟩ + | succ k ih => + obtain ⟨P, hP, hcost⟩ := ih + obtain ⟨Q, hQ, hQcost⟩ := hstep (b ^ k) P hP + have hbound : Q.cost ≤ blockRecurrenceCost b R K (k + 1) := by + exact hQcost.trans (Nat.add_le_add_right (Nat.mul_le_mul_left R hcost) _) + have hresult : ∃ Q : MatrixAlgorithm (b * b ^ k), Q.Correct ∧ + Q.cost ≤ blockRecurrenceCost b R K (k + 1) := ⟨Q, hQ, hbound⟩ + exact (pow_succ' b k).symm ▸ hresult + +theorem admissibleExponent_of_block_step_of_padding + (hpad : ∀ {n m : ℕ}, n ≤ m → ∀ P : MatrixAlgorithm m, P.Correct → + ∃ Q : MatrixAlgorithm n, Q.Correct ∧ Q.cost ≤ P.cost) + {b R K : ℕ} (hb : 2 ≤ b) {τ : ℝ} (hτ : 2 ≤ τ) + (hR : (R : ℝ) ≤ (b : ℝ) ^ τ) + (hstep : ∀ m : ℕ, ∀ P : MatrixAlgorithm m, P.Correct → + ∃ Q : MatrixAlgorithm (b * m), Q.Correct ∧ + Q.cost ≤ R * P.cost + K * m ^ 2) : + AdmissibleExponent τ := by + apply admissibleExponent_of_power_costs hpad hb (by linarith) + intro ε hε + have hbone : 1 < (b : ℝ) := by exact_mod_cast (by omega : 1 < b) + have hrate : (R : ℝ) < (b : ℝ) ^ (τ + ε) := + hR.trans_lt (Real.rpow_lt_rpow_of_exponent_lt hbone (by linarith)) + have hquad : (b : ℝ) ^ (2 : ℕ) ≤ (b : ℝ) ^ (τ + ε) := by + rw [← Real.rpow_natCast] + change (b : ℝ) ^ (2 : ℝ) ≤ (b : ℝ) ^ (τ + ε) + exact Real.rpow_le_rpow_of_exponent_le hbone.le (by linarith) + obtain ⟨C, hC, hbound⟩ := geometric_cost_recurrence_bound + (fun k => (blockRecurrenceCost b R K k : ℝ)) + (R : ℝ) (K : ℝ) ((b : ℝ) ^ (2 : ℕ)) ((b : ℝ) ^ (τ + ε)) + (Nat.cast_nonneg _) (Nat.cast_nonneg _) (Nat.cast_nonneg _) + (sq_nonneg _) hrate hquad (fun k => by + simp only [blockRecurrenceCost_succ, Nat.cast_add, Nat.cast_mul, Nat.cast_pow] + rw [← pow_mul, ← pow_mul, Nat.mul_comm k 2]) + refine ⟨C, hC, ?_⟩ + intro k + obtain ⟨P, hP, hcost⟩ := power_programs_of_block_step hstep k + exact ⟨P, hP, (by exact_mod_cast hcost : (P.cost : ℝ) ≤ + (blockRecurrenceCost b R K k : ℝ)).trans (hbound k)⟩ + +theorem admissibleExponent_of_block_step + {b R K : ℕ} (hb : 2 ≤ b) {τ : ℝ} (hτ : 2 ≤ τ) + (hR : (R : ℝ) ≤ (b : ℝ) ^ τ) + (hstep : ∀ m : ℕ, ∀ P : MatrixAlgorithm m, P.Correct → + ∃ Q : MatrixAlgorithm (b * m), Q.Correct ∧ + Q.cost ≤ R * P.cost + K * m ^ 2) : + AdmissibleExponent τ := + admissibleExponent_of_block_step_of_padding + (fun h P hP => MatrixAlgorithm.exists_restrict h P hP) hb hτ hR hstep + +theorem admissibleExponent_of_rankAtMost {n R : ℕ} (hn : 2 ≤ n) + (hRank : Tensor.RankAtMost (Tensor.matrixMultiplication n n n) R) + {τ : ℝ} (hτ : 2 ≤ τ) (hR : (R : ℝ) ≤ (n : ℝ) ^ τ) : + AdmissibleExponent τ := by + apply admissibleExponent_of_block_step (K := 6 * R * n ^ 2) hn hτ hR + intro m P hP + obtain ⟨Q, hQ, hcost⟩ := RecursiveBlock.rank_block_step hRank P hP + exact ⟨Q, hQ, hcost.le⟩ + +end MatrixMultiplication.Foundation.Arithmetic + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/ComplexArithmetic/LowerBound.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/ComplexArithmetic/LowerBound.lean new file mode 100644 index 0000000000000000000000000000000000000000..3602a0d0c5b4816323a566c83112c94679cc7b8e --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/ComplexArithmetic/LowerBound.lean @@ -0,0 +1,104 @@ +import OAI.LinearAlgebra.MatrixMultiplication.ComplexArithmetic.Complexity +import Mathlib.Tactic.Linarith +import Lean.Elab.Tactic.Omega + +namespace OAI + +/-! Complex arithmetic programs and asymptotic matrix multiplication costs. -/ + +noncomputable section + +namespace MatrixMultiplication.Foundation.Arithmetic + +namespace Program + +theorem eval_eq_constant_or_input_of_cost_eq_zero {Input : Type*} {r : ℕ} + (p : Program Input r) (hp : p.cost = 0) (i : Fin r) : + (∃ z : ℂ, ∀ inputs, p.eval inputs i = z) ∨ + (∃ a : Input, ∀ inputs, p.eval inputs i = inputs a) := by + revert hp i + induction p with + | nil => + intro _ i + exact Fin.elim0 i + | @step r p g ih => + intro hp i + have hcost : p.cost + g.cost = 0 := hp + have hp0 : p.cost = 0 := by omega + have hg0 : g.cost = 0 := by omega + refine Fin.cases ?_ (fun j => ?_) i + · cases g with + | constant z => exact Or.inl ⟨z, fun _ => rfl⟩ + | input a => exact Or.inr ⟨a, fun _ => rfl⟩ + | add a b => simp [Gate.cost] at hg0 + | sub a b => simp [Gate.cost] at hg0 + | mul a b => simp [Gate.cost] at hg0 + · simpa only [eval_step_succ] using ih hp0 j + +end Program + +namespace MatrixAlgorithm + +theorem one_le_cost {n : ℕ} (P : MatrixAlgorithm n) (hn : 1 ≤ n) + (hP : P.Correct) : 1 ≤ P.cost := by + by_contra hcost + have hzero : P.program.cost = 0 := by + change ¬ 1 ≤ P.program.cost at hcost + omega + let i : Fin n := ⟨0, by omega⟩ + have hentry (A B : Matrix (Fin n) (Fin n) ℂ) : + P.program.eval (matrixInputs A B) (P.output i i) = (A * B) i i := + congrFun (congrFun (hP A B) i) i + rcases P.program.eval_eq_constant_or_input_of_cost_eq_zero hzero (P.output i i) + with ⟨z, hz⟩ | ⟨a, ha⟩ + · have hz0 : z = 0 := by + have h := hentry 0 0 + rw [hz] at h + simpa using h + have hz1 : z = 1 := by + have h := hentry 1 1 + rw [hz] at h + simpa using h + exact (zero_ne_one : (0 : ℂ) ≠ 1) (hz0.symm.trans hz1) + · rcases a with ⟨j, k⟩ | ⟨j, k⟩ + · have h := hentry (Matrix.of fun _ _ => 1) 0 + rw [ha] at h + simp [matrixInputs, Matrix.mul_apply] at h + · have h := hentry 0 (Matrix.of fun _ _ => 1) + rw [ha] at h + simp [matrixInputs, Matrix.mul_apply] at h + +end MatrixAlgorithm + +theorem admissibleExponent_nonneg {τ : ℝ} (hτ : AdmissibleExponent τ) : 0 ≤ τ := by + by_contra hneg + have hτneg : τ < 0 := lt_of_not_ge hneg + let ε : ℝ := -τ / 2 + have hε : 0 < ε := by dsimp [ε]; linarith + have hsum : τ + ε = -ε := by dsimp [ε]; ring + obtain ⟨C, hC, hbound⟩ := hτ ε hε + obtain ⟨n, hn⟩ := exists_nat_gt (max (C ^ ε⁻¹) 1) + have hnreal : 1 < (n : ℝ) := lt_of_le_of_lt (le_max_right _ _) hn + have hnpos : 0 < (n : ℝ) := lt_trans zero_lt_one hnreal + have hn1 : 1 ≤ n := (Nat.one_le_cast (α := ℝ)).mp hnreal.le + have hpow : C < (n : ℝ) ^ ε := + (Real.rpow_inv_lt_iff_of_pos hC.le (Nat.cast_nonneg n) hε).mp + (lt_of_le_of_lt (le_max_left _ _) hn) + obtain ⟨P, hP, hcost⟩ := hbound n hn1 + have hcostone : (1 : ℝ) ≤ P.cost := + (Nat.one_le_cast (α := ℝ)).mpr (P.one_le_cost hn1 hP) + rw [hsum, Real.rpow_neg (Nat.cast_nonneg n), ← div_eq_mul_inv] at hcost + have hsmall : C / (n : ℝ) ^ ε < 1 := + (div_lt_one (Real.rpow_pos_of_pos hnpos ε)).mpr hpow + exact (not_lt_of_ge (hcostone.trans hcost)) hsmall + +theorem admissibleExponent_bddBelow : BddBelow {τ : ℝ | AdmissibleExponent τ} := by + refine ⟨0, ?_⟩ + intro τ hτ + exact admissibleExponent_nonneg hτ + +end MatrixMultiplication.Foundation.Arithmetic + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/ComplexArithmetic/MatrixPadding.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/ComplexArithmetic/MatrixPadding.lean new file mode 100644 index 0000000000000000000000000000000000000000..cae8835666b9fbc452131306a9893b92eb00b915 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/ComplexArithmetic/MatrixPadding.lean @@ -0,0 +1,101 @@ +import OAI.LinearAlgebra.MatrixMultiplication.ComplexArithmetic.ProgramComposition + +namespace OAI + +/-! Complex arithmetic programs and asymptotic matrix multiplication costs. -/ + +noncomputable section + +open scoped BigOperators + +namespace MatrixMultiplication.Foundation.Arithmetic + +def zeroPadMatrix {n : ℕ} (m : ℕ) (A : Matrix (Fin n) (Fin n) ℂ) : + Matrix (Fin m) (Fin m) ℂ := + fun i j => if hi : i.val < n then + if hj : j.val < n then A ⟨i.val, hi⟩ ⟨j.val, hj⟩ else 0 + else 0 + +@[simp] theorem zeroPadMatrix_castLE {n m : ℕ} (h : n ≤ m) + (A : Matrix (Fin n) (Fin n) ℂ) (i j : Fin n) : + zeroPadMatrix m A (Fin.castLE h i) (Fin.castLE h j) = A i j := by + simp [zeroPadMatrix, i.is_lt, j.is_lt] + +theorem sum_fin_castLE_of_zero {n m : ℕ} (h : n ≤ m) (f : Fin m → ℂ) + (hf : ∀ j : Fin m, n ≤ j.val → f j = 0) : + (∑ j : Fin m, f j) = ∑ j : Fin n, f (Fin.castLE h j) := by + symm + refine Fintype.sum_of_injective (Fin.castLE h) ?_ + (fun j : Fin n => f (Fin.castLE h j)) f ?_ (fun _ => rfl) + · intro i j hij + exact Fin.ext (congrArg (fun v : Fin m => v.val) hij) + · intro j hj + exact hf j (le_of_not_gt fun hsmall => hj ⟨⟨j.val, hsmall⟩, Fin.ext rfl⟩) + +theorem zeroPadMatrix_mul {n m : ℕ} (h : n ≤ m) + (A B : Matrix (Fin n) (Fin n) ℂ) (i k : Fin n) : + (zeroPadMatrix m A * zeroPadMatrix m B) (Fin.castLE h i) (Fin.castLE h k) = + (A * B) i k := by + rw [Matrix.mul_apply, Matrix.mul_apply] + calc + (∑ j : Fin m, + zeroPadMatrix m A (Fin.castLE h i) j * + zeroPadMatrix m B j (Fin.castLE h k)) = + ∑ j : Fin n, + zeroPadMatrix m A (Fin.castLE h i) (Fin.castLE h j) * + zeroPadMatrix m B (Fin.castLE h j) (Fin.castLE h k) := by + apply sum_fin_castLE_of_zero h + intro j hj + simp [zeroPadMatrix, not_lt_of_ge hj] + _ = ∑ j : Fin n, A i j * B j k := by simp + +def padSource {n m : ℕ} : MatrixInput m → MatrixInput n ⊕ ℂ + | .inl (i, j) => if hi : i.val < n then + if hj : j.val < n then .inl (.inl (⟨i.val, hi⟩, ⟨j.val, hj⟩)) else .inr 0 + else .inr 0 + | .inr (i, j) => if hi : i.val < n then + if hj : j.val < n then .inl (.inr (⟨i.val, hi⟩, ⟨j.val, hj⟩)) else .inr 0 + else .inr 0 + +theorem padSource_eval {n m : ℕ} (A B : Matrix (Fin n) (Fin n) ℂ) : + (fun x : MatrixInput m => Sum.elim (matrixInputs A B) id (padSource x)) = + matrixInputs (zeroPadMatrix m A) (zeroPadMatrix m B) := by + funext x + rcases x with ⟨i, j⟩ | ⟨i, j⟩ + all_goals + by_cases hi : i.val < n <;> by_cases hj : j.val < n <;> + simp [padSource, matrixInputs, zeroPadMatrix, hi, hj] + +namespace MatrixAlgorithm + +def pad {n m : ℕ} (h : n ≤ m) (P : MatrixAlgorithm m) : MatrixAlgorithm n where + registers := P.registers + program := P.program.mapSource (padSource (n := n)) + output := fun i k => P.output (Fin.castLE h i) (Fin.castLE h k) + +theorem pad_correct {n m : ℕ} (h : n ≤ m) {P : MatrixAlgorithm m} + (hP : P.Correct) : (pad h P).Correct := by + intro A B + funext i k + change (P.program.mapSource (padSource (n := n))).eval (matrixInputs A B) + (P.output (Fin.castLE h i) (Fin.castLE h k)) = (A * B) i k + rw [Program.eval_mapSource, padSource_eval] + have hentry := congrFun (congrFun + (hP (zeroPadMatrix m A) (zeroPadMatrix m B)) (Fin.castLE h i)) (Fin.castLE h k) + exact hentry.trans (zeroPadMatrix_mul h A B i k) + +@[simp] theorem pad_cost_eq {n m : ℕ} (h : n ≤ m) (P : MatrixAlgorithm m) : + (pad h P).cost = P.cost := + Program.cost_mapSource (padSource (n := n)) P.program + +theorem exists_restrict {n m : ℕ} (h : n ≤ m) (P : MatrixAlgorithm m) + (hP : P.Correct) : ∃ Q : MatrixAlgorithm n, Q.Correct ∧ Q.cost ≤ P.cost := + ⟨pad h P, pad_correct h hP, (pad_cost_eq h P).le⟩ + +end MatrixAlgorithm + +end MatrixMultiplication.Foundation.Arithmetic + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/ComplexArithmetic/NaiveAlgorithm.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/ComplexArithmetic/NaiveAlgorithm.lean new file mode 100644 index 0000000000000000000000000000000000000000..aefd16ac7bbcaf232c64e8da0bdfc7dea30ceed6 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/ComplexArithmetic/NaiveAlgorithm.lean @@ -0,0 +1,101 @@ +import OAI.LinearAlgebra.MatrixMultiplication.Polynomial.ComplexExpressionFamily +import Mathlib.Tactic.NormNum + +namespace OAI + +/-! Complex arithmetic programs and asymptotic matrix multiplication costs. -/ + +noncomputable section + +open scoped BigOperators + +namespace MatrixMultiplication.Foundation.Arithmetic + +namespace Expression + +variable {Input : Type*} + +def sumFin : {n : ℕ} → (Fin n → Expression Input) → Expression Input + | 0, _ => .constant 0 + | n + 1, f => .add (f 0) (sumFin (fun i : Fin n => f i.succ)) + +theorem sumFin_eval {n : ℕ} (f : Fin n → Expression Input) (inputs : Input → ℂ) : + (sumFin f).eval inputs = ∑ i, (f i).eval inputs := by + induction n with + | zero => simp [sumFin, eval] + | succ n ih => simp [sumFin, eval, ih, Fin.sum_univ_succ] + +theorem sumFin_cost {n : ℕ} (f : Fin n → Expression Input) : + (sumFin f).cost = (∑ i, (f i).cost) + n := by + induction n with + | zero => simp [sumFin, cost] + | succ n ih => + simp only [sumFin, cost, ih, Fin.sum_univ_succ] + omega + +end Expression + +def naiveEntry {n : ℕ} (i k : Fin n) : Expression (MatrixInput n) := + Expression.sumFin fun j : Fin n => + .mul (.input (.inl (i, j))) (.input (.inr (j, k))) + +theorem naiveEntry_eval {n : ℕ} (i k : Fin n) + (A B : Matrix (Fin n) (Fin n) ℂ) : + (naiveEntry i k).eval (matrixInputs A B) = ∑ j, A i j * B j k := by + simp [naiveEntry, Expression.sumFin_eval, Expression.eval, matrixInputs] + +@[simp] theorem naiveEntry_cost {n : ℕ} (i k : Fin n) : + (naiveEntry i k).cost = 2 * n := by + simp [naiveEntry, Expression.sumFin_cost, Expression.cost, two_mul] + +def naiveAlgorithm (n : ℕ) : MatrixAlgorithm n := + let p := Expression.compileFamily (fun ik : Fin n × Fin n => naiveEntry ik.1 ik.2) + { registers := p.registers + program := p.program + output := fun i k => p.output (i, k) } + +theorem naiveAlgorithm_correct (n : ℕ) : (naiveAlgorithm n).Correct := by + apply (MatrixAlgorithm.correct_iff_entries _).2 + intro A B i k + let p := Expression.compileFamily (fun ik : Fin n × Fin n => naiveEntry ik.1 ik.2) + change p.program.eval (matrixInputs A B) (p.output (i, k)) = _ + rw [p.correct] + exact naiveEntry_eval i k A B + +@[simp] theorem naiveAlgorithm_cost (n : ℕ) : (naiveAlgorithm n).cost = 2 * n ^ 3 := by + let p := Expression.compileFamily (fun ik : Fin n × Fin n => naiveEntry ik.1 ik.2) + change p.program.cost = _ + rw [p.cost_eq] + simp only [naiveEntry_cost, Finset.sum_const, Finset.card_univ, + Fintype.card_prod, Fintype.card_fin, nsmul_eq_mul, Nat.cast_id] + ring + +theorem naiveAlgorithm_cost_le (n : ℕ) : (naiveAlgorithm n).cost ≤ 2 * n ^ 3 := + (naiveAlgorithm_cost n).le + +theorem admissibleExponent_three : AdmissibleExponent 3 := by + intro ε hε + refine ⟨2, by norm_num, ?_⟩ + intro n hn + refine ⟨naiveAlgorithm n, naiveAlgorithm_correct n, ?_⟩ + rw [naiveAlgorithm_cost] + have hnR : (1 : ℝ) ≤ (n : ℝ) := by exact_mod_cast hn + have hpow : (n : ℝ) ^ (3 : ℝ) ≤ (n : ℝ) ^ (3 + ε) := + Real.rpow_le_rpow_of_exponent_le hnR (le_add_of_nonneg_right hε.le) + calc + ((2 * n ^ 3 : ℕ) : ℝ) = 2 * (n : ℝ) ^ (3 : ℝ) := by + calc + ((2 * n ^ 3 : ℕ) : ℝ) = 2 * (n : ℝ) ^ (3 : ℕ) := by + simp only [Nat.cast_mul, Nat.cast_pow, Nat.cast_ofNat] + _ = 2 * (n : ℝ) ^ (3 : ℝ) := + congrArg (fun t : ℝ => 2 * t) (Real.rpow_natCast (n : ℝ) 3).symm + _ ≤ 2 * (n : ℝ) ^ (3 + ε) := mul_le_mul_of_nonneg_left hpow (by norm_num) + +theorem admissibleExponent_nonempty : Set.Nonempty {τ : ℝ | AdmissibleExponent τ} := + ⟨3, admissibleExponent_three⟩ + +end MatrixMultiplication.Foundation.Arithmetic + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/ComplexArithmetic/ProgramComposition.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/ComplexArithmetic/ProgramComposition.lean new file mode 100644 index 0000000000000000000000000000000000000000..d7022e00a68e902d94045de014ddb62b514d6f2c --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/ComplexArithmetic/ProgramComposition.lean @@ -0,0 +1,192 @@ +import OAI.LinearAlgebra.MatrixMultiplication.ComplexArithmetic.Programs + +namespace OAI + +/-! Complex arithmetic programs and asymptotic matrix multiplication costs. -/ + +noncomputable section + +namespace MatrixMultiplication.Foundation.Arithmetic + +namespace Gate + +variable {Input Input' Register : Type*} + +def mapInput (f : Input → Input') : Gate Input Register → Gate Input' Register + | .constant z => .constant z + | .input i => .input (f i) + | .add i j => .add i j + | .sub i j => .sub i j + | .mul i j => .mul i j + +@[simp] theorem eval_mapInput (f : Input → Input') (g : Gate Input Register) + (inputs : Input' → ℂ) (registers : Register → ℂ) : + (g.mapInput f).eval inputs registers = g.eval (inputs ∘ f) registers := by + cases g <;> rfl + +@[simp] theorem cost_mapInput (f : Input → Input') (g : Gate Input Register) : + (g.mapInput f).cost = g.cost := by + cases g <;> rfl + +def mapSource (f : Input → Input' ⊕ ℂ) : Gate Input Register → Gate Input' Register + | .constant z => .constant z + | .input i => match f i with + | .inl j => .input j + | .inr z => .constant z + | .add i j => .add i j + | .sub i j => .sub i j + | .mul i j => .mul i j + +@[simp] theorem eval_mapSource (f : Input → Input' ⊕ ℂ) (g : Gate Input Register) + (inputs : Input' → ℂ) (registers : Register → ℂ) : + (g.mapSource f).eval inputs registers = + g.eval (fun i => Sum.elim inputs id (f i)) registers := by + cases g with + | input i => cases h : f i <;> simp [mapSource, h, eval] + | constant => rfl + | add => rfl + | sub => rfl + | mul => rfl + +@[simp] theorem cost_mapSource (f : Input → Input' ⊕ ℂ) (g : Gate Input Register) : + (g.mapSource f).cost = g.cost := by + cases g with + | input i => cases h : f i <;> simp [mapSource, h, cost] + | constant => rfl + | add => rfl + | sub => rfl + | mul => rfl + +end Gate + +namespace Program + +variable {Input Input' Mid : Type*} + +def mapInput (f : Input → Input') : {r : ℕ} → Program Input r → Program Input' r + | 0, .nil => .nil + | _ + 1, .step p g => (p.mapInput f).step (g.mapInput f) + +@[simp] theorem eval_mapInput (f : Input → Input') {r : ℕ} (p : Program Input r) + (inputs : Input' → ℂ) : + ∀ i : Fin r, (p.mapInput f).eval inputs i = p.eval (inputs ∘ f) i := by + induction p with + | nil => intro i; exact Fin.elim0 i + | @step r p g ih => + intro i + refine Fin.cases ?_ (fun j => ?_) i + · simp only [mapInput, eval_step_zero, Gate.eval_mapInput] + rw [funext ih] + · exact ih j + +@[simp] theorem cost_mapInput (f : Input → Input') {r : ℕ} (p : Program Input r) : + (p.mapInput f).cost = p.cost := by + induction p with + | nil => rfl + | step p g ih => simp only [mapInput, cost_step, Gate.cost_mapInput, ih] + +def mapSource (f : Input → Input' ⊕ ℂ) : {r : ℕ} → Program Input r → Program Input' r + | 0, .nil => .nil + | _ + 1, .step p g => (p.mapSource f).step (g.mapSource f) + +@[simp] theorem eval_mapSource (f : Input → Input' ⊕ ℂ) {r : ℕ} + (p : Program Input r) (inputs : Input' → ℂ) : + ∀ i : Fin r, (p.mapSource f).eval inputs i = + p.eval (fun j => Sum.elim inputs id (f j)) i := by + induction p with + | nil => intro i; exact Fin.elim0 i + | @step r p g ih => + intro i + refine Fin.cases ?_ (fun j => ?_) i + · simp only [mapSource, eval_step_zero, Gate.eval_mapSource] + rw [funext ih] + · exact ih j + +@[simp] theorem cost_mapSource (f : Input → Input' ⊕ ℂ) {r : ℕ} + (p : Program Input r) : (p.mapSource f).cost = p.cost := by + induction p with + | nil => rfl + | step p g ih => simp only [mapSource, cost_step, Gate.cost_mapSource, ih] + +structure Substituted {r s : ℕ} (p : Program Input r) (q : Program Mid s) + (wires : Mid → Fin r) where + registers : ℕ + program : Program Input registers + oldOutput : Fin r → Fin registers + output : Fin s → Fin registers + correctOld : ∀ inputs i, program.eval inputs (oldOutput i) = p.eval inputs i + correct : ∀ inputs i, program.eval inputs (output i) = + q.eval (fun j => p.eval inputs (wires j)) i + cost_eq : program.cost = p.cost + q.cost + +namespace Substituted + +def step {r s : ℕ} {p : Program Input r} {q : Program Mid s} + {wires : Mid → Fin r} (a : Substituted p q wires) + (g : Gate Mid (Fin s)) (h : Gate Input (Fin a.registers)) + (heval : ∀ inputs, h.eval inputs (a.program.eval inputs) = + g.eval (fun j => p.eval inputs (wires j)) + (q.eval (fun j => p.eval inputs (wires j)))) + (hcost : h.cost = g.cost) : Substituted p (q.step g) wires where + registers := a.registers + 1 + program := a.program.step h + oldOutput := fun i => (a.oldOutput i).succ + output := Fin.cases 0 (fun i => (a.output i).succ) + correctOld := by + intro inputs i + exact a.correctOld inputs i + correct := by + intro inputs i + refine Fin.cases ?_ (fun j => ?_) i + · exact heval inputs + · exact a.correct inputs j + cost_eq := by + simp only [cost_step, a.cost_eq, hcost, Nat.add_assoc] + +end Substituted + +def substitute {r : ℕ} (p : Program Input r) : + {s : ℕ} → (q : Program Mid s) → (wires : Mid → Fin r) → Substituted p q wires + | 0, .nil, wires => + { registers := r + program := p + oldOutput := id + output := Fin.elim0 + correctOld := fun _ _ => rfl + correct := fun _ i => Fin.elim0 i + cost_eq := by simp only [cost, Nat.add_zero] } + | _ + 1, .step q g, wires => + let a := substitute p q wires + match g with + | .input j => + { registers := a.registers + program := a.program + oldOutput := a.oldOutput + output := Fin.cases (a.oldOutput (wires j)) a.output + correctOld := a.correctOld + correct := by + intro inputs i + refine Fin.cases ?_ (fun k => ?_) i + · exact a.correctOld inputs (wires j) + · exact a.correct inputs k + cost_eq := by + simpa only [cost_step, Gate.cost, Nat.add_zero] using a.cost_eq } + | .constant z => + a.step (.constant z) (.constant z) (fun _ => rfl) rfl + | .add i j => + a.step (.add i j) (.add (a.output i) (a.output j)) + (by intro inputs; simp only [Gate.eval, a.correct]) rfl + | .sub i j => + a.step (.sub i j) (.sub (a.output i) (a.output j)) + (by intro inputs; simp only [Gate.eval, a.correct]) rfl + | .mul i j => + a.step (.mul i j) (.mul (a.output i) (a.output j)) + (by intro inputs; simp only [Gate.eval, a.correct]) rfl + +end Program + +end MatrixMultiplication.Foundation.Arithmetic + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/ComplexArithmetic/Programs.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/ComplexArithmetic/Programs.lean new file mode 100644 index 0000000000000000000000000000000000000000..9a352322f581dbbcd1e62272837992b70e4f8c9f --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/ComplexArithmetic/Programs.lean @@ -0,0 +1,184 @@ +import OAI.LinearAlgebra.MatrixMultiplication.ComplexArithmetic.Complexity +import Lean.Elab.Tactic.Omega + +namespace OAI + +/-! Complex arithmetic programs and asymptotic matrix multiplication costs. -/ + +noncomputable section + +namespace MatrixMultiplication.Foundation.Arithmetic + +namespace Gate + +variable {Input R S : Type*} + +def mapRegister (f : R → S) : Gate Input R → Gate Input S + | .constant z => .constant z + | .input i => .input i + | .add i j => .add (f i) (f j) + | .sub i j => .sub (f i) (f j) + | .mul i j => .mul (f i) (f j) + +theorem eval_mapRegister (g : Gate Input R) (f : R → S) + (inputs : Input → ℂ) (registers : S → ℂ) : + (g.mapRegister f).eval inputs registers = g.eval inputs (fun i => registers (f i)) := by + cases g <;> rfl + +@[simp] theorem cost_mapRegister (g : Gate Input R) (f : R → S) : + (g.mapRegister f).cost = g.cost := by + cases g <;> rfl + +end Gate + +namespace Program + +variable {Input : Type*} + +def oldIndex (r s : ℕ) (i : Fin r) : Fin (r + s) := ⟨s + i.val, by omega⟩ + +def newIndex (r s : ℕ) (i : Fin s) : Fin (r + s) := ⟨i.val, by omega⟩ + +@[simp] theorem oldIndex_zero (r : ℕ) (i : Fin r) : oldIndex r 0 i = i := by + apply Fin.ext + simp [oldIndex] + +@[simp] theorem oldIndex_succ (r s : ℕ) (i : Fin r) : + oldIndex r (s + 1) i = (oldIndex r s i).succ := by + apply Fin.ext + simp only [oldIndex, Fin.val_succ] + omega + +@[simp] theorem newIndex_zero (r s : ℕ) : newIndex r (s + 1) 0 = 0 := by + apply Fin.ext + rfl + +@[simp] theorem newIndex_succ (r s : ℕ) (i : Fin s) : + newIndex r (s + 1) i.succ = (newIndex r s i).succ := by + apply Fin.ext + rfl + +def append {r : ℕ} (p : Program Input r) : {s : ℕ} → Program Input s → Program Input (r + s) + | 0, .nil => p + | s + 1, .step q g => (p.append q).step (g.mapRegister (newIndex r s)) + +theorem eval_append_new {r s : ℕ} (p : Program Input r) (q : Program Input s) + (inputs : Input → ℂ) : + ∀ i : Fin s, (p.append q).eval inputs (newIndex r s i) = q.eval inputs i := by + induction q with + | nil => intro i; exact Fin.elim0 i + | @step s q g ih => + intro i + refine Fin.cases ?_ (fun j => ?_) i + · simp only [append, newIndex_zero, eval_step_zero, Gate.eval_mapRegister] + rw [funext ih] + · simpa only [append, newIndex_succ, eval_step_succ] using ih j + +theorem eval_append_old {r s : ℕ} (p : Program Input r) (q : Program Input s) + (inputs : Input → ℂ) : + ∀ i : Fin r, (p.append q).eval inputs (oldIndex r s i) = p.eval inputs i := by + induction q with + | nil => intro i; simp [append] + | @step s q g ih => + intro i + simpa only [append, oldIndex_succ, eval_step_succ] using ih i + +@[simp] theorem cost_append {r s : ℕ} (p : Program Input r) (q : Program Input s) : + (p.append q).cost = p.cost + q.cost := by + induction q with + | nil => simp [append, cost] + | @step s q g ih => simp [append, ih, Nat.add_assoc] + +end Program + +inductive Expression (Input : Type*) where + | constant : ℂ → Expression Input + | input : Input → Expression Input + | add : Expression Input → Expression Input → Expression Input + | sub : Expression Input → Expression Input → Expression Input + | mul : Expression Input → Expression Input → Expression Input + +namespace Expression + +variable {Input : Type*} + +def eval (inputs : Input → ℂ) : Expression Input → ℂ + | .constant z => z + | .input i => inputs i + | .add e f => e.eval inputs + f.eval inputs + | .sub e f => e.eval inputs - f.eval inputs + | .mul e f => e.eval inputs * f.eval inputs + +def cost : Expression Input → ℕ + | .constant _ => 0 + | .input _ => 0 + | .add e f => e.cost + f.cost + 1 + | .sub e f => e.cost + f.cost + 1 + | .mul e f => e.cost + f.cost + 1 + +structure Compiled (e : Expression Input) where + registers : ℕ + program : Program Input registers + output : Fin registers + correct : ∀ inputs, program.eval inputs output = e.eval inputs + cost_eq : program.cost = e.cost + +def compile : (e : Expression Input) → Compiled e + | .constant z => + { registers := 1 + program := Program.nil.step (.constant z) + output := 0 + correct := fun _ => rfl + cost_eq := rfl } + | .input i => + { registers := 1 + program := Program.nil.step (.input i) + output := 0 + correct := fun _ => rfl + cost_eq := rfl } + | .add e f => + let p := compile e + let q := compile f + { registers := p.registers + q.registers + 1 + program := (p.program.append q.program).step + (.add (Program.oldIndex _ _ p.output) (Program.newIndex _ _ q.output)) + output := 0 + correct := by + intro inputs + simp only [Program.eval_step_zero, Gate.eval, Program.eval_append_old, + Program.eval_append_new, p.correct, q.correct, eval] + cost_eq := by + simp only [Program.cost_step, Program.cost_append, Gate.cost, p.cost_eq, q.cost_eq, cost] } + | .sub e f => + let p := compile e + let q := compile f + { registers := p.registers + q.registers + 1 + program := (p.program.append q.program).step + (.sub (Program.oldIndex _ _ p.output) (Program.newIndex _ _ q.output)) + output := 0 + correct := by + intro inputs + simp only [Program.eval_step_zero, Gate.eval, Program.eval_append_old, + Program.eval_append_new, p.correct, q.correct, eval] + cost_eq := by + simp only [Program.cost_step, Program.cost_append, Gate.cost, p.cost_eq, q.cost_eq, cost] } + | .mul e f => + let p := compile e + let q := compile f + { registers := p.registers + q.registers + 1 + program := (p.program.append q.program).step + (.mul (Program.oldIndex _ _ p.output) (Program.newIndex _ _ q.output)) + output := 0 + correct := by + intro inputs + simp only [Program.eval_step_zero, Gate.eval, Program.eval_append_old, + Program.eval_append_new, p.correct, q.correct, eval] + cost_eq := by + simp only [Program.cost_step, Program.cost_append, Gate.cost, p.cost_eq, q.cost_eq, cost] } + +end Expression +end MatrixMultiplication.Foundation.Arithmetic + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/ComplexArithmetic/RecursiveBlockPrograms.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/ComplexArithmetic/RecursiveBlockPrograms.lean new file mode 100644 index 0000000000000000000000000000000000000000..ac017e24baaf79d80920f4013d40e0bd4ea805ca --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/ComplexArithmetic/RecursiveBlockPrograms.lean @@ -0,0 +1,368 @@ +import OAI.LinearAlgebra.MatrixMultiplication.Polynomial.ComplexExpressionFamily +import OAI.LinearAlgebra.MatrixMultiplication.ComplexArithmetic.ProgramComposition +import OAI.LinearAlgebra.MatrixMultiplication.Tensor.ComplexMatrixTensor +import Mathlib.Logic.Equiv.Fin.Basic +import Mathlib.Tactic.Ring + +namespace OAI + +/-! Complex arithmetic programs and asymptotic matrix multiplication costs. -/ + +noncomputable section + +open scoped BigOperators + +namespace MatrixMultiplication.Foundation.Arithmetic.RecursiveBlock + +namespace LinearExpression + +variable {Input : Type*} + +def sumFin : (n : ℕ) → (Fin n → Expression Input) → Expression Input + | 0, _ => .constant 0 + | n + 1, f => .add (f 0) (sumFin n (fun i => f i.succ)) + +theorem eval_sumFin (n : ℕ) (f : Fin n → Expression Input) (inputs : Input → ℂ) : + (sumFin n f).eval inputs = ∑ i, (f i).eval inputs := by + induction n with + | zero => simp [sumFin, Expression.eval] + | succ n ih => + simp only [sumFin, Expression.eval, ih, Fin.sum_univ_succ] + +theorem cost_sumFin (n : ℕ) (f : Fin n → Expression Input) : + (sumFin n f).cost = (∑ i, (f i).cost) + n := by + induction n with + | zero => simp [sumFin, Expression.cost] + | succ n ih => + simp only [sumFin, Expression.cost, ih, Fin.sum_univ_succ] + omega + +def linear {Term : Type*} [Fintype Term] (a : Term → ℂ) (wire : Term → Input) : + Expression Input := + sumFin (Fintype.card Term) (fun i => + .mul (.constant (a ((Fintype.equivFin Term).symm i))) + (.input (wire ((Fintype.equivFin Term).symm i)))) + +theorem eval_linear {Term : Type*} [Fintype Term] + (a : Term → ℂ) (wire : Term → Input) (inputs : Input → ℂ) : + (linear a wire).eval inputs = ∑ i, a i * inputs (wire i) := by + rw [linear, eval_sumFin] + exact (Fintype.equivFin Term).symm.sum_comp (fun i => a i * inputs (wire i)) + +theorem cost_linear {Term : Type*} [Fintype Term] + (a : Term → ℂ) (wire : Term → Input) : + (linear a wire).cost = 2 * Fintype.card Term := by + simp [linear, cost_sumFin, Expression.cost, two_mul] + +end LinearExpression + +structure Family (Input Output : Type*) where + registers : ℕ + program : Program Input registers + output : Output → Fin registers + +namespace Family + +variable {Input Mid Output : Type*} + +def eval (p : Family Input Output) (inputs : Input → ℂ) (o : Output) : ℂ := + p.program.eval inputs (p.output o) + +def cost (p : Family Input Output) : ℕ := p.program.cost + +def expressions [Fintype Output] (e : Output → Expression Input) : Family Input Output := + let p := Expression.compileFamily e + ⟨p.registers, p.program, p.output⟩ + +theorem eval_expressions [Fintype Output] (e : Output → Expression Input) + (inputs : Input → ℂ) (o : Output) : + (expressions e).eval inputs o = (e o).eval inputs := + (Expression.compileFamily e).correct inputs o + +theorem cost_expressions [Fintype Output] (e : Output → Expression Input) : + (expressions e).cost = ∑ o, (e o).cost := + (Expression.compileFamily e).cost_eq + +def compose (p : Family Input Mid) (q : Family Mid Output) : Family Input Output := + let s := p.program.substitute q.program p.output + ⟨s.registers, s.program, fun o => s.output (q.output o)⟩ + +theorem eval_compose (p : Family Input Mid) (q : Family Mid Output) + (inputs : Input → ℂ) (o : Output) : + (compose p q).eval inputs o = q.eval (p.eval inputs) o := + (p.program.substitute q.program p.output).correct inputs (q.output o) + +theorem cost_compose (p : Family Input Mid) (q : Family Mid Output) : + (compose p q).cost = p.cost + q.cost := + (p.program.substitute q.program p.output).cost_eq + +def mapInputs {NewInput : Type*} (f : Input → NewInput) (p : Family Input Output) : + Family NewInput Output := + ⟨p.registers, p.program.mapInput f, p.output⟩ + +theorem eval_mapInputs {NewInput : Type*} (f : Input → NewInput) + (p : Family Input Output) (inputs : NewInput → ℂ) (o : Output) : + (p.mapInputs f).eval inputs o = p.eval (fun i => inputs (f i)) o := by + exact Program.eval_mapInput f p.program inputs (p.output o) + +theorem cost_mapInputs {NewInput : Type*} (f : Input → NewInput) + (p : Family Input Output) : (p.mapInputs f).cost = p.cost := by + exact Program.cost_mapInput f p.program + +def parallel : (r : ℕ) → (Fin r → Family Input Output) → Family Input (Fin r × Output) + | 0, _ => ⟨0, Program.nil, fun o => Fin.elim0 o.1⟩ + | r + 1, p => + let head := p 0 + let tail := parallel r (fun i => p i.succ) + { registers := head.registers + tail.registers + program := head.program.append tail.program + output := fun o => Fin.cases + (Program.oldIndex _ _ (head.output o.2)) + (fun i => Program.newIndex _ _ (tail.output (i, o.2))) o.1 } + +theorem eval_parallel (r : ℕ) (p : Fin r → Family Input Output) + (inputs : Input → ℂ) (o : Fin r × Output) : + (parallel r p).eval inputs o = (p o.1).eval inputs o.2 := by + induction r with + | zero => exact Fin.elim0 o.1 + | succ r ih => + rcases o with ⟨i, o⟩ + refine Fin.cases ?_ (fun j => ?_) i + · exact Program.eval_append_old _ _ inputs _ + · exact (Program.eval_append_new _ _ inputs _).trans + (ih (fun j => p j.succ) (j, o)) + +theorem cost_parallel (r : ℕ) (p : Fin r → Family Input Output) : + (parallel r p).cost = ∑ i, (p i).cost := by + induction r with + | zero => simp [parallel, cost, Program.cost] + | succ r ih => + change ((p 0).program.append (parallel r (fun i => p i.succ)).program).cost = _ + rw [Program.cost_append] + change (p 0).cost + (parallel r (fun i => p i.succ)).cost = _ + rw [ih, Fin.sum_univ_succ] + +def copies (r : ℕ) (p : Family Input Output) : + Family (Fin r × Input) (Fin r × Output) := + parallel r (fun i => p.mapInputs (fun x => (i, x))) + +theorem eval_copies (r : ℕ) (p : Family Input Output) + (inputs : Fin r × Input → ℂ) (o : Fin r × Output) : + (copies r p).eval inputs o = p.eval (fun x => inputs (o.1, x)) o.2 := by + rw [copies, eval_parallel, eval_mapInputs] + +theorem cost_copies (r : ℕ) (p : Family Input Output) : + (copies r p).cost = r * p.cost := by + simp [copies, cost_parallel, cost_mapInputs] + +def ofMatrix {m : ℕ} (p : MatrixAlgorithm m) : + Family (MatrixInput m) (Fin m × Fin m) := + ⟨p.registers, p.program, fun o => p.output o.1 o.2⟩ + +@[simp] theorem cost_ofMatrix {m : ℕ} (p : MatrixAlgorithm m) : + (ofMatrix p).cost = p.cost := rfl + +theorem eval_ofMatrix {m : ℕ} (p : MatrixAlgorithm m) (hp : p.Correct) + (inputs : MatrixInput m → ℂ) (o : Fin m × Fin m) : + (ofMatrix p).eval inputs o = + ∑ j, inputs (.inl (o.1, j)) * inputs (.inr (j, o.2)) := by + have h := (MatrixAlgorithm.correct_iff_entries p).mp hp + (fun i j => inputs (.inl (i, j))) (fun j k => inputs (.inr (j, k))) o.1 o.2 + have hi : matrixInputs (fun i j => inputs (.inl (i, j))) + (fun j k => inputs (.inr (j, k))) = inputs := by + funext x + cases x <;> rfl + rw [hi] at h + exact h + +end Family + +section BlockIdentities + +variable {n r m : ℕ} + +def join (i : Fin n) (j : Fin m) : Fin (n * m) := finProdFinEquiv (i, j) + +theorem rank_bilinear_identity + (a b c : Fin r → Fin n × Fin n → ℂ) + (h : Tensor.matrixMultiplication n n n = + fun x y z => ∑ q, Tensor.rankOne (a q) (b q) (c q) x y z) + (left right : Fin n × Fin n → ℂ) (i k : Fin n) : + (∑ q, c q (k, i) * (∑ x, a q x * left x) * (∑ y, b q y * right y)) = + ∑ j, left (i, j) * right (j, k) := by + rw [← Tensor.contract_matrixCoefficients left right i k] + change _ = Tensor.contract (Tensor.matrixMultiplication n n n) left right (k, i) + rw [h] + simp only [Tensor.contract, Tensor.rankOne, Finset.sum_mul, Finset.mul_sum] + calc + (∑ q, ∑ y, ∑ x, c q (k, i) * (a q x * left x) * (b q y * right y)) = + ∑ q, ∑ x, ∑ y, c q (k, i) * (a q x * left x) * (b q y * right y) := by + apply Finset.sum_congr rfl + intro q hq + exact Finset.sum_comm + _ = + ∑ x, ∑ q, ∑ y, c q (k, i) * (a q x * left x) * (b q y * right y) := + Finset.sum_comm + _ = ∑ x, ∑ y, ∑ q, a q x * b q y * c q (k, i) * left x * right y := by + apply Finset.sum_congr rfl + intro x hx + rw [Finset.sum_comm] + apply Finset.sum_congr rfl + intro y hy + apply Finset.sum_congr rfl + intro q hq + ring + +def leftBlock (a : Fin r → Fin n × Fin n → ℂ) + (A : Matrix (Fin (n * m)) (Fin (n * m)) ℂ) (q : Fin r) : + Matrix (Fin m) (Fin m) ℂ := + fun s t => ∑ x, a q x * A (join x.1 s) (join x.2 t) + +def rightBlock (b : Fin r → Fin n × Fin n → ℂ) + (B : Matrix (Fin (n * m)) (Fin (n * m)) ℂ) (q : Fin r) : + Matrix (Fin m) (Fin m) ℂ := + fun t u => ∑ y, b q y * B (join y.1 t) (join y.2 u) + +theorem block_identity + (a b c : Fin r → Fin n × Fin n → ℂ) + (h : Tensor.matrixMultiplication n n n = + fun x y z => ∑ q, Tensor.rankOne (a q) (b q) (c q) x y z) + (A B : Matrix (Fin (n * m)) (Fin (n * m)) ℂ) + (i k : Fin n) (s u : Fin m) : + (∑ q, c q (k, i) * ((leftBlock a A q) * (rightBlock b B q)) s u) = + (A * B) (join i s) (join k u) := by + simp only [Matrix.mul_apply, Finset.mul_sum] + rw [Finset.sum_comm] + have hlocal (t : Fin m) := rank_bilinear_identity a b c h + (fun x => A (join x.1 s) (join x.2 t)) + (fun y => B (join y.1 t) (join y.2 u)) i k + simp only [leftBlock, rightBlock] + simp_rw [← mul_assoc, hlocal] + rw [Finset.sum_comm] + exact (Fintype.sum_prod_type _).symm.trans + (finProdFinEquiv.sum_comp (fun j => A (join i s) j * B j (join k u))) + +end BlockIdentities + +section BlockPrograms + +variable {n r m : ℕ} + +def inputExpressions (a b : Fin r → Fin n × Fin n → ℂ) : + Fin r × MatrixInput m → Expression (MatrixInput (n * m)) + | (q, .inl (s, t)) => LinearExpression.linear (a q) + (fun x => .inl (join x.1 s, join x.2 t)) + | (q, .inr (t, u)) => LinearExpression.linear (b q) + (fun y => .inr (join y.1 t, join y.2 u)) + +def inputFamily (a b : Fin r → Fin n × Fin n → ℂ) : + Family (MatrixInput (n * m)) (Fin r × MatrixInput m) := + Family.expressions (inputExpressions a b) + +theorem inputFamily_eval (a b : Fin r → Fin n × Fin n → ℂ) + (A B : Matrix (Fin (n * m)) (Fin (n * m)) ℂ) (q : Fin r) (x : MatrixInput m) : + (inputFamily a b).eval (matrixInputs A B) (q, x) = + matrixInputs (leftBlock a A q) (rightBlock b B q) x := by + cases x with + | inl x => + simp only [inputFamily, Family.eval_expressions, inputExpressions, + LinearExpression.eval_linear, matrixInputs, leftBlock] + | inr x => + simp only [inputFamily, Family.eval_expressions, inputExpressions, + LinearExpression.eval_linear, matrixInputs, rightBlock] + +theorem inputFamily_cost (a b : Fin r → Fin n × Fin n → ℂ) : + (inputFamily (m := m) a b).cost = 4 * r * n ^ 2 * m ^ 2 := by + rw [inputFamily, Family.cost_expressions] + have hc (o : Fin r × MatrixInput m) : (inputExpressions a b o).cost = 2 * n ^ 2 := by + rcases o with ⟨q, o⟩ + cases o <;> simp [inputExpressions, LinearExpression.cost_linear, pow_two] + simp_rw [hc] + simp only [Finset.sum_const, Finset.card_univ, Fintype.card_prod, + Fintype.card_fin, Fintype.card_sum, smul_eq_mul] + ring + +def recursiveProducts (a b : Fin r → Fin n × Fin n → ℂ) (p : MatrixAlgorithm m) : + Family (MatrixInput (n * m)) (Fin r × (Fin m × Fin m)) := + (inputFamily a b).compose (Family.copies r (Family.ofMatrix p)) + +theorem recursiveProducts_eval (a b : Fin r → Fin n × Fin n → ℂ) + (p : MatrixAlgorithm m) (hp : p.Correct) + (A B : Matrix (Fin (n * m)) (Fin (n * m)) ℂ) (q : Fin r) (s u : Fin m) : + (recursiveProducts a b p).eval (matrixInputs A B) (q, (s, u)) = + ((leftBlock a A q) * (rightBlock b B q)) s u := by + rw [recursiveProducts, Family.eval_compose, Family.eval_copies, + Family.eval_ofMatrix _ hp] + simp only [inputFamily_eval, matrixInputs, Matrix.mul_apply] + +theorem recursiveProducts_cost (a b : Fin r → Fin n × Fin n → ℂ) + (p : MatrixAlgorithm m) : + (recursiveProducts a b p).cost = 4 * r * n ^ 2 * m ^ 2 + r * p.cost := by + rw [recursiveProducts, Family.cost_compose, inputFamily_cost, + Family.cost_copies, Family.cost_ofMatrix] + +def outputExpressions (c : Fin r → Fin n × Fin n → ℂ) : + Fin (n * m) × Fin (n * m) → Expression (Fin r × (Fin m × Fin m)) := + fun o => LinearExpression.linear + (fun q => c q ((finProdFinEquiv.symm o.2).1, (finProdFinEquiv.symm o.1).1)) + (fun q => (q, ((finProdFinEquiv.symm o.1).2, (finProdFinEquiv.symm o.2).2))) + +def outputFamily (c : Fin r → Fin n × Fin n → ℂ) : + Family (Fin r × (Fin m × Fin m)) (Fin (n * m) × Fin (n * m)) := + Family.expressions (outputExpressions c) + +theorem outputFamily_eval (c : Fin r → Fin n × Fin n → ℂ) + (inputs : Fin r × (Fin m × Fin m) → ℂ) (i k : Fin n) (s u : Fin m) : + (outputFamily c).eval inputs (join i s, join k u) = + ∑ q, c q (k, i) * inputs (q, (s, u)) := by + simp only [outputFamily, Family.eval_expressions, outputExpressions, + LinearExpression.eval_linear, join, Equiv.symm_apply_apply] + +theorem outputFamily_cost (c : Fin r → Fin n × Fin n → ℂ) : + (outputFamily (m := m) c).cost = 2 * r * n ^ 2 * m ^ 2 := by + simp only [outputFamily, Family.cost_expressions, outputExpressions, + LinearExpression.cost_linear, Fintype.card_fin, Finset.sum_const, + Finset.card_univ, Fintype.card_prod, smul_eq_mul] + ring + +def algorithm (a b c : Fin r → Fin n × Fin n → ℂ) (p : MatrixAlgorithm m) : + MatrixAlgorithm (n * m) := + let f := (recursiveProducts a b p).compose (outputFamily c) + ⟨f.registers, f.program, fun i k => f.output (i, k)⟩ + +theorem algorithm_correct + (a b c : Fin r → Fin n × Fin n → ℂ) + (h : Tensor.matrixMultiplication n n n = + fun x y z => ∑ q, Tensor.rankOne (a q) (b q) (c q) x y z) + (p : MatrixAlgorithm m) (hp : p.Correct) : (algorithm a b c p).Correct := by + intro A B + funext i k + obtain ⟨⟨i, s⟩, rfl⟩ := finProdFinEquiv.surjective i + obtain ⟨⟨k, u⟩, rfl⟩ := finProdFinEquiv.surjective k + change ((recursiveProducts a b p).compose (outputFamily c)).eval + (matrixInputs A B) (join i s, join k u) = _ + rw [Family.eval_compose, outputFamily_eval] + simp_rw [recursiveProducts_eval a b p hp A B] + exact block_identity a b c h A B i k s u + +theorem algorithm_cost (a b c : Fin r → Fin n × Fin n → ℂ) + (p : MatrixAlgorithm m) : + (algorithm a b c p).cost = r * p.cost + (6 * r * n ^ 2) * m ^ 2 := by + change ((recursiveProducts a b p).compose (outputFamily c)).cost = _ + rw [Family.cost_compose, recursiveProducts_cost, outputFamily_cost] + ring + +theorem rank_block_step (h : Tensor.RankAtMost (Tensor.matrixMultiplication n n n) r) + (p : MatrixAlgorithm m) (hp : p.Correct) : + ∃ q : MatrixAlgorithm (n * m), q.Correct ∧ + q.cost = r * p.cost + (6 * r * n ^ 2) * m ^ 2 := by + rcases h with ⟨a, b, c, h⟩ + exact ⟨algorithm a b c p, algorithm_correct a b c h p hp, algorithm_cost a b c p⟩ + +end BlockPrograms + +end MatrixMultiplication.Foundation.Arithmetic.RecursiveBlock + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/ComplexBounds/CW75ReorderedBalanced.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/ComplexBounds/CW75ReorderedBalanced.lean new file mode 100644 index 0000000000000000000000000000000000000000..3daff704c1016a934d6e7a36bd4dcddf0cef6c74 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/ComplexBounds/CW75ReorderedBalanced.lean @@ -0,0 +1,63 @@ +import OAI.LinearAlgebra.MatrixMultiplication.Tensor.MatrixBalancing +import OAI.LinearAlgebra.MatrixMultiplication.ComplexBounds.CW75ReorderedFinite + +namespace OAI + +/-! Explicit complex square and rectangular matrix multiplication bounds. -/ + +noncomputable section + +namespace MatrixMultiplication.CW75ReorderedBalanced + +open MatrixMultiplication.Foundation CW75LabelHierarchy MatrixBalancing + +def witness (counts : Scalar → ℕ) (t : ℕ) : ComplexWitness.FiniteRectangularWitness where + outer := CW75ReorderedFinite.rows counts t * CW75ReorderedFinite.inner counts t + inner := CW75ReorderedFinite.columns counts t ^ 2 + multiplicity := CW75ReorderedFinite.copies counts t ^ 2 + rank := CW75ReorderedFinite.rankBudget counts t ^ 2 + outer_pos := Nat.mul_pos (CW75ReorderedFinite.rows_pos counts t) + (CW75ReorderedFinite.inner_pos counts t) + inner_pos := pow_pos (CW75ReorderedFinite.columns_pos counts t) 2 + multiplicity_pos := pow_pos (CW75ReorderedFinite.copies_pos counts t) 2 + rank_pos := pow_pos (CW75ReorderedFinite.rankBudget_pos counts t) 2 + order := 2 * CW75ReorderedFinite.order counts t + degree := 2 * CW75ReorderedFinite.degree counts t + approximation := finiteBalanced (CW75ReorderedFinite.approximation counts t) + +@[simp] theorem witness_outer (counts : Scalar → ℕ) (t : ℕ) : + (witness counts t).outer = + CW75ReorderedFinite.rows counts t * CW75ReorderedFinite.inner counts t := rfl + +@[simp] theorem witness_inner (counts : Scalar → ℕ) (t : ℕ) : + (witness counts t).inner = CW75ReorderedFinite.columns counts t ^ 2 := rfl + +@[simp] theorem witness_multiplicity (counts : Scalar → ℕ) (t : ℕ) : + (witness counts t).multiplicity = CW75ReorderedFinite.copies counts t ^ 2 := rfl + +@[simp] theorem witness_rank (counts : Scalar → ℕ) (t : ℕ) : + (witness counts t).rank = CW75ReorderedFinite.rankBudget counts t ^ 2 := rfl + +theorem witness_volume (counts : Scalar → ℕ) (t : ℕ) : + (witness counts t).outer ^ 2 * (witness counts t).inner = + (witness counts t).multiplicity := by + simp only [witness_outer, witness_inner, witness_multiplicity, ← mul_pow, + CW75ReorderedFinite.volume_eq_copies] + +theorem witness_dimensions (counts : Scalar → ℕ) (t : ℕ) : + (witness counts t).outer = + ConditionalLabels.stagePairingSize counts ComplexWitness.curveLabels 5 + ComplexWitness.curveReaderPair .xz t * + ConditionalLabels.stagePairingSize counts ComplexWitness.curveLabels 5 + ComplexWitness.curveReaderPair .xy t ∧ + (witness counts t).inner = + ConditionalLabels.stagePairingSize counts ComplexWitness.curveLabels 5 + ComplexWitness.curveReaderPair .yz t ^ 2 := by + rcases CW75ReorderedFinite.dimensions_eq_pairingSize counts t with ⟨hr, hi, hc⟩ + simp only [witness_outer, witness_inner, hr, hi, hc, and_self] + +end MatrixMultiplication.CW75ReorderedBalanced + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/ComplexBounds/CW75ReorderedBalancedRates.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/ComplexBounds/CW75ReorderedBalancedRates.lean new file mode 100644 index 0000000000000000000000000000000000000000..747a14bd9a6d6d7dd583b1687a839b73af20885c --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/ComplexBounds/CW75ReorderedBalancedRates.lean @@ -0,0 +1,129 @@ +import OAI.LinearAlgebra.MatrixMultiplication.ComplexBounds.CW75ReorderedBalanced +import OAI.LinearAlgebra.MatrixMultiplication.ComplexBounds.CW75ReorderedFiniteRates +import OAI.LinearAlgebra.MatrixMultiplication.Entropy.ConditionalRateBridge +import OAI.LinearAlgebra.MatrixMultiplication.Rectangular.Witness + +namespace OAI + +/-! Explicit complex square and rectangular matrix multiplication bounds. -/ + +noncomputable section + +namespace MatrixMultiplication.CW75ReorderedBalancedRates + +open MatrixMultiplication.Foundation Filter CW75LabelHierarchy +open ConditionalLabels ComplexWitness CW75ReorderedBalanced +open scoped BigOperators Topology Classical + +variable (counts : Scalar → ℕ) (hD : 0 < ∑ a, counts a) + (p : FiniteLaw Scalar) + (mass : ∀ a, p.mass a = (counts a : ℝ) / (∑ b, counts b : ℕ)) + +include hD mass + +theorem tendsto_log_rows : + Tendsto (fun t => Real.log (CW75ReorderedFinite.rows counts t : ℝ) / + ((t : ℝ) * (∑ a, counts a : ℕ))) atTop + (𝓝 (lawPairingRate p curveLabels 5 curveReaderPair .xz)) := by + have h := tendsto_log_stagePairingSize_law counts hD p mass + curveLabels 5 curveReaderPair .xz + apply h.congr + intro t + rw [(CW75ReorderedFinite.dimensions_eq_pairingSize counts t).1] + +theorem tendsto_log_inner : + Tendsto (fun t => Real.log (CW75ReorderedFinite.inner counts t : ℝ) / + ((t : ℝ) * (∑ a, counts a : ℕ))) atTop + (𝓝 (lawPairingRate p curveLabels 5 curveReaderPair .xy)) := by + have h := tendsto_log_stagePairingSize_law counts hD p mass + curveLabels 5 curveReaderPair .xy + apply h.congr + intro t + rw [(CW75ReorderedFinite.dimensions_eq_pairingSize counts t).2.1] + +theorem tendsto_log_columns : + Tendsto (fun t => Real.log (CW75ReorderedFinite.columns counts t : ℝ) / + ((t : ℝ) * (∑ a, counts a : ℕ))) atTop + (𝓝 (lawPairingRate p curveLabels 5 curveReaderPair .yz)) := by + have h := tendsto_log_stagePairingSize_law counts hD p mass + curveLabels 5 curveReaderPair .yz + apply h.congr + intro t + rw [(CW75ReorderedFinite.dimensions_eq_pairingSize counts t).2.2] + +theorem tendsto_log_witness_outer : + Tendsto (fun t => Real.log ((witness counts t).outer : ℝ) / + ((t : ℝ) * (∑ a, counts a : ℕ))) atTop + (𝓝 (lawPairingRate p curveLabels 5 curveReaderPair .xy + + lawPairingRate p curveLabels 5 curveReaderPair .xz)) := by + have h := (tendsto_log_rows counts hD p mass).add + (tendsto_log_inner counts hD p mass) + rw [add_comm (lawPairingRate p curveLabels 5 curveReaderPair .xz)] at h + apply h.congr + intro t + rw [witness_outer, Nat.cast_mul, Real.log_mul + (Nat.cast_ne_zero.mpr (Nat.ne_of_gt (CW75ReorderedFinite.rows_pos counts t))) + (Nat.cast_ne_zero.mpr (Nat.ne_of_gt (CW75ReorderedFinite.inner_pos counts t))), add_div] + +theorem tendsto_log_witness_inner : + Tendsto (fun t => Real.log ((witness counts t).inner : ℝ) / + ((t : ℝ) * (∑ a, counts a : ℕ))) atTop + (𝓝 (2 * lawPairingRate p curveLabels 5 curveReaderPair .yz)) := by + simpa only [witness_inner, Nat.cast_pow, Real.log_pow, Nat.cast_ofNat, + mul_div_assoc] using (tendsto_log_columns counts hD p mass).const_mul 2 + +theorem tendsto_log_witness_multiplicity : + Tendsto (fun t => Real.log ((witness counts t).multiplicity : ℝ) / + ((t : ℝ) * (∑ a, counts a : ℕ))) atTop + (𝓝 (2 * finiteEntropy p.mass)) := by + simpa only [witness_multiplicity, Nat.cast_pow, Real.log_pow, Nat.cast_ofNat, + mul_div_assoc] using + (CW75ReorderedFiniteRates.tendsto_log_copies counts hD p mass).const_mul 2 + +theorem tendsto_log_witness_rank : + Tendsto (fun t => Real.log ((witness counts t).rank : ℝ) / + ((t : ℝ) * (∑ a, counts a : ℕ))) atTop + (𝓝 (6 * Real.log 3 + 2 * finiteEntropy p.mass)) := by + have h := (CW75ReorderedFiniteRates.tendsto_log_rankBudget counts hD p mass).const_mul 2 + have hcost : 2 * (3 * Real.log 3 + finiteEntropy p.mass) = + 6 * Real.log 3 + 2 * finiteEntropy p.mass := by ring + simpa only [witness_rank, Nat.cast_pow, Real.log_pow, Nat.cast_ofNat, + mul_div_assoc, hcost] using h + +omit mass + +theorem scale_eventually_pos : + ∀ᶠ t : ℕ in atTop, 0 < (t : ℝ) * (∑ a, counts a : ℕ) := by + filter_upwards [eventually_ge_atTop 1] with t ht + exact mul_pos (Nat.cast_pos.mpr (by omega)) (Nat.cast_pos.mpr hD) + +include mass + +theorem omega_lt_of_fixed_count_law (k target : ℝ) + (k_nonneg : 0 ≤ k) + (incident_positive : 0 < lawPairingRate p curveLabels 5 curveReaderPair .xy + + lawPairingRate p curveLabels 5 curveReaderPair .xz) + (aspect_gap : k * (lawPairingRate p curveLabels 5 curveReaderPair .xy + + lawPairingRate p curveLabels 5 curveReaderPair .xz) < + 2 * lawPairingRate p curveLabels 5 curveReaderPair .yz) + (cost_gap : 6 * Real.log 3 < target * + (lawPairingRate p curveLabels 5 curveReaderPair .xy + + lawPairingRate p curveLabels 5 curveReaderPair .xz)) : + Arithmetic.rectangularOmega ℂ k < target := + RectangularWitness.omega_lt_of_balanced_family (witness counts) + (fun t => (t : ℝ) * (∑ a, counts a : ℕ)) k target + (lawPairingRate p curveLabels 5 curveReaderPair .yz) + (lawPairingRate p curveLabels 5 curveReaderPair .xy + + lawPairingRate p curveLabels 5 curveReaderPair .xz) + (finiteEntropy p.mass) k_nonneg incident_positive aspect_gap cost_gap + (scale_eventually_pos counts hD) + (tendsto_log_witness_outer counts hD p mass) + (tendsto_log_witness_inner counts hD p mass) + (tendsto_log_witness_multiplicity counts hD p mass) + (tendsto_log_witness_rank counts hD p mass) + +end MatrixMultiplication.CW75ReorderedBalancedRates + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/ComplexBounds/CW75ReorderedExecution.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/ComplexBounds/CW75ReorderedExecution.lean new file mode 100644 index 0000000000000000000000000000000000000000..fef17e94661b132e0d0c35344ed3115160611878 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/ComplexBounds/CW75ReorderedExecution.lean @@ -0,0 +1,405 @@ +import OAI.LinearAlgebra.MatrixMultiplication.CoppersmithWinograd.ComplexCW75InitialExecution +import OAI.LinearAlgebra.MatrixMultiplication.ComplexBounds.CW75ReorderedWords +import OAI.LinearAlgebra.MatrixMultiplication.ComplexBounds.CW75ReorderedGeometricValues +import OAI.LinearAlgebra.MatrixMultiplication.Entropy.ComplexConditionalHierarchyStage +import OAI.LinearAlgebra.MatrixMultiplication.Entropy.ComplexOrientedConditionalHierarchyStage +import OAI.LinearAlgebra.MatrixMultiplication.Tensor.ComplexGeometricStageCoordinates +import OAI.LinearAlgebra.MatrixMultiplication.Polynomial.ComplexPolynomialExecutionReindex + +namespace OAI + +/-! Explicit complex square and rectangular matrix multiplication bounds. -/ + +noncomputable section + +namespace MatrixMultiplication.CW75ReorderedExecution + +open MatrixMultiplication.Foundation +open CW75LabelHierarchy CW75ReorderedWords ConditionalPrefixWords ComplexWitness +open PolynomialKernelExecution ExecutionPairingBudget StageHierarchyResources +open scoped BigOperators Classical + +attribute [local irreducible] CW75LabelHierarchy.retainedWords + +abbrev Position (counts : Scalar → ℕ) (t : ℕ) := BlockPosition counts t +abbrev Coordinate (counts : Scalar → ℕ) (t : ℕ) := LongWord (Position counts t) +abbrev Prefix (counts : Scalar → ℕ) (t n : ℕ) := + ExactPrefix counts curveLabels n t (Position counts t) + +def readerPair : ℕ → ReaderPair + | 1 => .xz + | 3 | 4 => .yz + | _ => .xy + +def pairingProduct (counts : Scalar → ℕ) (t : ℕ) (pair : ReaderPair) (n : ℕ) : ℕ := + ∏ i ∈ Finset.range n, if readerPair i = pair then + stageRefinementCount counts curveLabels i t else 1 + +@[simp] theorem pairingProduct_zero (counts : Scalar → ℕ) (t : ℕ) (pair : ReaderPair) : + pairingProduct counts t pair 0 = 1 := by simp [pairingProduct] + +theorem pairingProduct_succ (counts : Scalar → ℕ) (t : ℕ) (pair : ReaderPair) (n : ℕ) : + pairingProduct counts t pair (n + 1) = pairingProduct counts t pair n * + (if readerPair n = pair then stageRefinementCount counts curveLabels n t else 1) := by + simp only [pairingProduct, Finset.prod_range_succ] + +def prefixValue {PX PY PZ : Type*} (counts : Scalar → ℕ) (t n : ℕ) + (pairing : Tensor ℂ PX PY PZ) : + Tensor ℂ (Coordinate counts t × (Prefix counts t n × PX)) + (Coordinate counts t × (Prefix counts t n × PY)) + (Coordinate counts t × (Prefix counts t n × PZ)) := + fun x y z => if x.2.1 = y.2.1 ∧ x.2.1 = z.2.1 ∧ + eligible id x.2.1 x.1 y.1 z.1 then pairing x.2.2 y.2.2 z.2.2 else 0 + +structure Bundle (counts : Scalar → ℕ) (t n : ℕ) where + PX : Type + PY : Type + PZ : Type + AX : Type + AY : Type + AZ : Type + [finitePX : Fintype PX] + [finitePY : Fintype PY] + [finitePZ : Fintype PZ] + [finiteAX : Fintype AX] + [finiteAY : Fintype AY] + [finiteAZ : Fintype AZ] + execution : Execution (Coordinate counts t) (Coordinate counts t) (Coordinate counts t) + (Prefix counts t n) PX PY PZ AX AY AZ + (CW75InitialExecution.support (N := t * ∑ a, counts a)) + shape : MatrixCoordinates PX PY PZ + shape_positive : shape.Positive + normal : execution.value = prefixValue counts t n shape.tensor + rank_exact : execution.rankBound = stageAuxiliaryBudget counts curveLabels n t + volume_exact : shape.volume = stagePairingProduct counts curveLabels n t + rows_exact : shape.rows = pairingProduct counts t .xz n + inner_exact : shape.inner = pairingProduct counts t .xy n + columns_exact : shape.columns = pairingProduct counts t .yz n + pairing_budget : shape.volume ≤ execution.rankBound + +attribute [instance] Bundle.finitePX Bundle.finitePY Bundle.finitePZ +attribute [instance] Bundle.finiteAX Bundle.finiteAY Bundle.finiteAZ + +theorem position_card (counts : Scalar → ℕ) (t : ℕ) : + Fintype.card (Position counts t) = ∑ a, t * counts a := by + simp [Position, BlockPosition, Finset.mul_sum] + +def initial (counts : Scalar → ℕ) (t : ℕ) : Bundle counts t 0 := by + let E := (CW75InitialExecution.execution (t * ∑ a, counts a)).reindexOutput + (rootPrefixEquiv counts curveLabels t (Position counts t) (position_card counts t)) + (Equiv.refl PUnit) (Equiv.refl PUnit) (Equiv.refl PUnit) + refine { + PX := PUnit + PY := PUnit + PZ := PUnit + AX := PUnit + AY := PUnit + AZ := PUnit + execution := E + shape := MatrixCoordinates.scalar + shape_positive := MatrixCoordinates.scalar_positive + normal := ?_ + rank_exact := ?_ + volume_exact := ?_ + rows_exact := by simp [MatrixCoordinates.scalar] + inner_exact := by simp [MatrixCoordinates.scalar] + columns_exact := by simp [MatrixCoordinates.scalar] + pairing_budget := le_rfl + } + · funext x y z + change E.value x y z = prefixValue counts t 0 MatrixCoordinates.scalar.tensor x y z + rw [Execution.reindexOutput_value, CW75InitialExecution.value_retained] + have hxy : x.2.1 = y.2.1 := Subsingleton.elim _ _ + have hxz : x.2.1 = z.2.1 := Subsingleton.elim _ _ + have hguard : (x.2.1 = y.2.1 ∧ x.2.1 = z.2.1 ∧ + eligible id x.2.1 x.1 y.1 z.1) ↔ + ∀ i, CW75Primitive.tensor (x.1 i) (y.1 i) (z.1 i) ≠ 0 := by + rw [root_eligible_iff] + exact ⟨fun h => h.2.2, fun h => ⟨hxy, hxz, h⟩⟩ + simp only [prefixValue, hguard, MatrixCoordinates.scalar_tensor] + · change 1 = stageAuxiliaryBudget counts curveLabels 0 t + simp [stageAuxiliaryBudget] + · change 1 = stagePairingProduct counts curveLabels 0 t + simp [stagePairingProduct] + +theorem previous_eligible {counts : Scalar → ℕ} {t n : ℕ} (B : Bundle counts t n) + (x : Coordinate counts t × (Prefix counts t n × B.PX)) + (y : Coordinate counts t × (Prefix counts t n × B.PY)) + (z : Coordinate counts t × (Prefix counts t n × B.PZ)) + (_hs : CW75InitialExecution.support (N := t * ∑ a, counts a) x.1 y.1 z.1) + (hn : B.execution.value x y z ≠ 0) : eligible id x.2.1 x.1 y.1 z.1 := by + rw [B.normal] at hn + by_contra h + exact hn (by simp [prefixValue, h]) + +section Successor + +variable {counts : Scalar → ℕ} {t n : ℕ} (B : Bundle counts t n) +variable {NX NY NZ BX BY BZ : Type} +variable [Fintype BX] [Fintype BY] [Fintype BZ] + +def refinedExecution + (S : Stage B.execution (Fin (stageRefinementCount counts curveLabels n t)) + NX NY NZ BX BY BZ) : + Execution (Coordinate counts t) (Coordinate counts t) (Coordinate counts t) + (Prefix counts t (n + 1)) (B.PX × NX) (B.PY × NY) (B.PZ × NZ) + (B.AX × BX) (B.AY × BY) (B.AZ × BZ) + (CW75InitialExecution.support (N := t * ∑ a, counts a)) := + (B.execution.step S).reindexOutput + (nextPrefixEquiv counts curveLabels n t (Position counts t)) + (Equiv.refl _) (Equiv.refl _) (Equiv.refl _) + +theorem refinedExecution_normal + (S : Stage B.execution (Fin (stageRefinementCount counts curveLabels n t)) + NX NY NZ BX BY BZ) + (shape : MatrixCoordinates NX NY NZ) + (hstage : ∀ p x y z, eligible id p x.1 y.1 z.1 → + S.value p x y z = if x.2.1 = y.2.1 ∧ x.2.1 = z.2.1 ∧ + eligible id (appendCode p x.2.1) x.1 y.1 z.1 + then shape.tensor x.2.2 y.2.2 z.2.2 else 0) : + (refinedExecution B S).value = + prefixValue counts t (n + 1) (B.shape.product shape).tensor := by + classical + funext x y z + let e := nextPrefixEquiv counts curveLabels n t (Position counts t) + let px := e x.2.1 + let py := e y.2.1 + let pz := e z.2.1 + have hdecode (p : Prefix counts t (n + 1)) : + appendCode (e p).1 (e p).2 = p := e.symm_apply_apply p + change B.execution.value (x.1, (px.1, x.2.2.1)) + (y.1, (py.1, y.2.2.1)) (z.1, (pz.1, z.2.2.1)) * + S.value px.1 (x.1, (px.2, x.2.2.2)) + (y.1, (py.2, y.2.2.2)) (z.1, (pz.2, z.2.2.2)) = _ + rw [B.normal] + simp only [prefixValue] + by_cases hold : px.1 = py.1 ∧ px.1 = pz.1 ∧ eligible id px.1 x.1 y.1 z.1 + · rw [ite_eq_left hold] + have hguard : + (px.2 = py.2 ∧ px.2 = pz.2 ∧ eligible id (appendCode px.1 px.2) x.1 y.1 z.1) ↔ + (x.2.1 = y.2.1 ∧ x.2.1 = z.2.1 ∧ eligible id x.2.1 x.1 y.1 z.1) := by + constructor + · rintro ⟨hxy, hxz, he⟩ + refine ⟨e.injective (Prod.ext hold.1 hxy), + e.injective (Prod.ext hold.2.1 hxz), ?_⟩ + simpa only [px, hdecode] using he + · rintro ⟨hxy, hxz, he⟩ + refine ⟨congrArg (fun p => (e p).2) hxy, + congrArg (fun p => (e p).2) hxz, ?_⟩ + simpa only [px, hdecode] using he + rw [hstage px.1 (x.1, (px.2, x.2.2.2)) + (y.1, (py.2, y.2.2.2)) (z.1, (pz.2, z.2.2.2)) hold.2.2] + simp only [hguard, + MatrixCoordinates.product_tensor, Tensor.product, mul_ite, mul_zero] + · have hnext : ¬ (x.2.1 = y.2.1 ∧ x.2.1 = z.2.1 ∧ + eligible id x.2.1 x.1 y.1 z.1) := by + rintro ⟨hxy, hxz, he⟩ + apply hold + refine ⟨congrArg (fun p => (e p).1) hxy, + congrArg (fun p => (e p).1) hxz, ?_⟩ + rw [← hdecode x.2.1] at he + obtain ⟨word, hw, _⟩ := + (eligible_appendCode_iff px.1 px.2 x.1 y.1 z.1).mp he + exact ⟨word, hw⟩ + rw [ite_eq_right hold, ite_eq_right hnext, zero_mul] + +def extendBundle [Fintype NX] [Fintype NY] [Fintype NZ] + (S : Stage B.execution (Fin (stageRefinementCount counts curveLabels n t)) + NX NY NZ BX BY BZ) + (shape : MatrixCoordinates NX NY NZ) (hpositive : shape.Positive) + (hvolume : shape.volume = stageRefinementCount counts curveLabels n t) + (hrank : S.rankBound = stageCost counts curveLabels n t) + (hrows : shape.rows = if readerPair n = .xz then + stageRefinementCount counts curveLabels n t else 1) + (hinner : shape.inner = if readerPair n = .xy then + stageRefinementCount counts curveLabels n t else 1) + (hcolumns : shape.columns = if readerPair n = .yz then + stageRefinementCount counts curveLabels n t else 1) + (hstage : ∀ p x y z, eligible id p x.1 y.1 z.1 → + S.value p x y z = if x.2.1 = y.2.1 ∧ x.2.1 = z.2.1 ∧ + eligible id (appendCode p x.2.1) x.1 y.1 z.1 + then shape.tensor x.2.2 y.2.2 z.2.2 else 0) : Bundle counts t (n + 1) where + PX := B.PX × NX + PY := B.PY × NY + PZ := B.PZ × NZ + AX := B.AX × BX + AY := B.AY × BY + AZ := B.AZ × BZ + execution := refinedExecution B S + shape := B.shape.product shape + shape_positive := B.shape.product_positive shape B.shape_positive hpositive + normal := refinedExecution_normal B S shape hstage + rank_exact := by + simp only [refinedExecution, Execution.reindexOutput_rankBound, + Execution.step_rankBound, B.rank_exact, hrank, stageAuxiliaryBudget_succ] + volume_exact := by + rw [MatrixCoordinates.product_volume, B.volume_exact, hvolume, stagePairingProduct_succ] + rows_exact := by + change B.shape.rows * shape.rows = _ + rw [B.rows_exact, hrows, pairingProduct_succ] + inner_exact := by + change B.shape.inner * shape.inner = _ + rw [B.inner_exact, hinner, pairingProduct_succ] + columns_exact := by + change B.shape.columns * shape.columns = _ + rw [B.columns_exact, hcolumns, pairingProduct_succ] + pairing_budget := by + change (B.shape.product shape).volume ≤ B.execution.rankBound * S.rankBound + rw [MatrixCoordinates.product_volume] + apply Nat.mul_le_mul B.pairing_budget + rw [hvolume, hrank] + exact LabelHierarchySeparation.population_le_poolAuxiliaryCost _ + +end Successor + +section ConcreteStages + +variable {counts : Scalar → ℕ} {t n : ℕ} + +def extendXY (B : Bundle counts t n) (hn : n < 5) + (hfirst : curveFirstSide n = .x) (hsecond : curveSecondSide n = .y) : + Bundle counts t (n + 1) := Classical.choice (by + have hpair : readerPair n = .xy := by + interval_cases n <;> simp_all [curveFirstSide, curveSecondSide, readerPair] + have hagree : ∀ (p : Prefix counts t n) (x y z : Coordinate counts t), eligible id p x y z → + firstRead id p x = secondRead id p y := by + intro p x y z he + simpa only [hfirst, hsecond, coordinateOf] using + readable_of_eligible id p x y z hn he + obtain ⟨S, _, hrank, _, _, _, _, hvalue⟩ := + ConditionalHierarchyStage.exists_actualPoolStage counts curveLabels n t B.execution id + (firstRead id) (secondRead id) (eligible id) (previous_eligible B) hagree + refine ⟨extendBundle B S (GeometricStageCoordinates.xy _) + (GeometricStageCoordinates.xy_positive (stageRefinementCount_pos counts curveLabels n t)) + (GeometricStageCoordinates.xy_volume _) hrank + (by simp [hpair, GeometricStageCoordinates.xy]) + (by simp [hpair, GeometricStageCoordinates.xy]) + (by simp [hpair, GeometricStageCoordinates.xy]) ?_⟩ + intro p x y z he + rw [hvalue] + obtain ⟨word, hw⟩ := he + exact CW75ReorderedGeometricValues.raw_XY_normal p hn hfirst hsecond x y z word hw) + +def extendXZ (B : Bundle counts t n) (hn : n < 5) + (hfirst : curveFirstSide n = .x) (hsecond : curveSecondSide n = .z) : + Bundle counts t (n + 1) := Classical.choice (by + have hpair : readerPair n = .xz := by + interval_cases n <;> simp_all [curveFirstSide, curveSecondSide, readerPair] + have hagree : ∀ (p : Prefix counts t n) (x y z : Coordinate counts t), eligible id p x y z → + firstRead id p x = secondRead id p z := by + intro p x y z he + simpa only [hfirst, hsecond, coordinateOf] using + readable_of_eligible id p x y z hn he + obtain ⟨S, _, hrank, _, _, _, _, hvalue⟩ := + OrientedConditionalHierarchyStage.exists_actualPoolStage_XZ counts curveLabels n t B.execution id + (firstRead id) (secondRead id) (eligible id) (previous_eligible B) hagree + refine ⟨extendBundle B S (GeometricStageCoordinates.xz _) + (GeometricStageCoordinates.xz_positive (stageRefinementCount_pos counts curveLabels n t)) + (GeometricStageCoordinates.xz_volume _) hrank + (by simp [hpair, GeometricStageCoordinates.xz]) + (by simp [hpair, GeometricStageCoordinates.xz]) + (by simp [hpair, GeometricStageCoordinates.xz]) ?_⟩ + intro p x y z he + rw [hvalue] + obtain ⟨word, hw⟩ := he + exact CW75ReorderedGeometricValues.raw_XZ_normal p hn hfirst hsecond x y z word hw) + +def extendYZ (B : Bundle counts t n) (hn : n < 5) + (hfirst : curveFirstSide n = .y) (hsecond : curveSecondSide n = .z) : + Bundle counts t (n + 1) := Classical.choice (by + have hpair : readerPair n = .yz := by + interval_cases n <;> simp_all [curveFirstSide, curveSecondSide, readerPair] + have hagree : ∀ (p : Prefix counts t n) (x y z : Coordinate counts t), eligible id p x y z → + firstRead id p y = secondRead id p z := by + intro p x y z he + simpa only [hfirst, hsecond, coordinateOf] using + readable_of_eligible id p x y z hn he + obtain ⟨S, _, hrank, _, _, _, _, hvalue⟩ := + OrientedConditionalHierarchyStage.exists_actualPoolStage_YZ counts curveLabels n t B.execution id + (firstRead id) (secondRead id) (eligible id) (previous_eligible B) hagree + refine ⟨extendBundle B S (GeometricStageCoordinates.yz _) + (GeometricStageCoordinates.yz_positive (stageRefinementCount_pos counts curveLabels n t)) + (GeometricStageCoordinates.yz_volume _) hrank + (by simp [hpair, GeometricStageCoordinates.yz]) + (by simp [hpair, GeometricStageCoordinates.yz]) + (by simp [hpair, GeometricStageCoordinates.yz]) ?_⟩ + intro p x y z he + rw [hvalue] + obtain ⟨word, hw⟩ := he + exact CW75ReorderedGeometricValues.raw_YZ_normal p hn hfirst hsecond x y z word hw) + +end ConcreteStages + +def realize (counts : Scalar → ℕ) (t : ℕ) : Bundle counts t 5 := + let B0 := initial counts t + let B1 : Bundle counts t 1 := extendXY B0 (by decide) rfl rfl + let B2 : Bundle counts t 2 := extendXZ B1 (by decide) rfl rfl + let B3 : Bundle counts t 3 := extendXY B2 (by decide) rfl rfl + let B4 : Bundle counts t 4 := extendYZ B3 (by decide) rfl rfl + extendYZ B4 (by decide) rfl rfl + +theorem realize_dimensions (counts : Scalar → ℕ) (t : ℕ) : + (realize counts t).shape.rows = + ConditionalLabels.stagePairingSize counts curveLabels 5 curveReaderPair .xz t ∧ + (realize counts t).shape.inner = + ConditionalLabels.stagePairingSize counts curveLabels 5 curveReaderPair .xy t ∧ + (realize counts t).shape.columns = + ConditionalLabels.stagePairingSize counts curveLabels 5 curveReaderPair .yz t := by + have h (pair : ReaderPair) : pairingProduct counts t pair 5 = + ConditionalLabels.stagePairingSize counts curveLabels 5 curveReaderPair pair t := by + change (∏ i ∈ Finset.range 5, + if readerPair i = pair then stageRefinementCount counts curveLabels i t else 1) = + ∏ i : Fin 5, + if readerPair i.val = pair then stageRefinementCount counts curveLabels i.val t else 1 + exact (Fin.prod_univ_eq_prod_range + (fun i => if readerPair i = pair then + stageRefinementCount counts curveLabels i t else 1) 5).symm + exact ⟨(realize counts t).rows_exact.trans (h .xz), + (realize counts t).inner_exact.trans (h .xy), + (realize counts t).columns_exact.trans (h .yz)⟩ + +theorem realize_rankBound (counts : Scalar → ℕ) (t : ℕ) : + (realize counts t).execution.rankBound = stageAuxiliaryBudget counts curveLabels 5 t := + (realize counts t).rank_exact + +theorem realize_volume (counts : Scalar → ℕ) (t : ℕ) : + (realize counts t).shape.volume = Fintype.card (ExactWords (fun a => t * counts a)) := by + rw [(realize counts t).volume_exact] + simpa only [exactWords_card] using + (stagePairingProduct_eq_exactWords_card counts curveLabels 5 curve_completeRecord_injective t) + +theorem realize_pairing_budget (counts : Scalar → ℕ) (t : ℕ) : + (realize counts t).shape.volume ≤ (realize counts t).execution.rankBound := + (realize counts t).pairing_budget + +theorem realize_value (counts : Scalar → ℕ) (t : ℕ) + (x : Coordinate counts t × (Prefix counts t 5 × (realize counts t).PX)) + (y : Coordinate counts t × (Prefix counts t 5 × (realize counts t).PY)) + (z : Coordinate counts t × (Prefix counts t 5 × (realize counts t).PZ)) : + (realize counts t).execution.value x y z = + if x.2.1 = y.2.1 ∧ x.2.1 = z.2.1 ∧ + x.1 = longX (terminalWord x.2.1).val ∧ + y.1 = longY (terminalWord x.2.1).val ∧ + z.1 = longZ (terminalWord x.2.1).val + then (realize counts t).shape.tensor x.2.2 y.2.2 z.2.2 else 0 := by + rw [(realize counts t).normal] + simp only [prefixValue, terminal_eligible_iff] + +theorem realize_label_card (counts : Scalar → ℕ) (t : ℕ) : + Fintype.card (Prefix counts t 5) = Fintype.card (ExactWords (fun a => t * counts a)) := by + rw [exactWords_card] + let : DecidableEq Scalar := Classical.decEq Scalar + calc + Fintype.card (Prefix counts t 5) = + Fintype.card (PopulationWords (Position counts t) (fun a => t * counts a)) := + Fintype.card_congr + (sourcePrefixEquiv counts curveLabels 5 t (Position counts t) curve_completeRecord_injective) + _ = Nat.multinomial Finset.univ (fun a => t * counts a) := + populationWords_card (I := Position counts t) + (fun a => t * counts a) (position_card counts t) + +end MatrixMultiplication.CW75ReorderedExecution + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/ComplexBounds/CW75ReorderedFinite.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/ComplexBounds/CW75ReorderedFinite.lean new file mode 100644 index 0000000000000000000000000000000000000000..2b93a7b08d2530e6cca2928807f0640715d32631 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/ComplexBounds/CW75ReorderedFinite.lean @@ -0,0 +1,200 @@ +import OAI.LinearAlgebra.MatrixMultiplication.ComplexBounds.CW75ReorderedExecution +import OAI.LinearAlgebra.MatrixMultiplication.Separation.ExecutionApproximation + +namespace OAI + +/-! Explicit complex square and rectangular matrix multiplication bounds. -/ + +noncomputable section + +namespace MatrixMultiplication.CW75ReorderedFinite + +open MatrixMultiplication.Foundation CW75LabelHierarchy StageHierarchyResources +open ExecutionPairingBudget CW75ReorderedWords CW75ReorderedExecution ComplexWitness +open scoped BigOperators Classical + +attribute [local irreducible] CW75LabelHierarchy.retainedWords + +def blocks (counts : Scalar → ℕ) (t : ℕ) : ℕ := t * ∑ a, counts a + +def copies (counts : Scalar → ℕ) (t : ℕ) : ℕ := + Fintype.card (ExactWords (fun a => t * counts a)) + +def rows (counts : Scalar → ℕ) (t : ℕ) : ℕ := (realize counts t).shape.rows +def inner (counts : Scalar → ℕ) (t : ℕ) : ℕ := (realize counts t).shape.inner +def columns (counts : Scalar → ℕ) (t : ℕ) : ℕ := (realize counts t).shape.columns + +def rankBudget (counts : Scalar → ℕ) (t : ℕ) : ℕ := + 27 ^ blocks counts t * stageAuxiliaryBudget counts curveLabels 5 t + +def order (counts : Scalar → ℕ) (t : ℕ) : ℕ := + 6 * blocks counts t * ((realize counts t).execution.order + 1) + + (realize counts t).execution.order + +def degree (counts : Scalar → ℕ) (t : ℕ) : ℕ := + 18 * blocks counts t * ((realize counts t).execution.order + 1) + + (realize counts t).execution.leftDegree + + (realize counts t).execution.middleDegree + + (realize counts t).execution.rightDegree + +def sourceApproximation (counts : Scalar → ℕ) (t : ℕ) : + Tensor.PolynomialApproximation (CW75InitialExecution.fullSource (blocks counts t)) + (27 ^ blocks counts t) (6 * blocks counts t) (18 * blocks counts t) := by + simpa only [CW75InitialExecution.fullSource, show (3 : ℕ) ^ 3 = 27 by norm_num, + show (2 : ℕ) * 3 = 6 by norm_num, show (6 : ℕ) * 3 = 18 by norm_num] using + (CoppersmithWinograd.approximation.power 3).power (blocks counts t) + +def labelEquiv (counts : Scalar → ℕ) (t : ℕ) : + Fin (copies counts t) ≃ Prefix counts t 5 := + Fintype.equivOfCardEq ((Fintype.card_fin (copies counts t)).trans + (realize_label_card counts t).symm) + +def designatedX {counts : Scalar → ℕ} {t : ℕ} (p : Prefix counts t 5) : + Coordinate counts t := longX (terminalWord p).val + +def designatedY {counts : Scalar → ℕ} {t : ℕ} (p : Prefix counts t 5) : + Coordinate counts t := longY (terminalWord p).val + +def designatedZ {counts : Scalar → ℕ} {t : ℕ} (p : Prefix counts t 5) : + Coordinate counts t := longZ (terminalWord p).val + +theorem designated_coefficient_one (counts : Scalar → ℕ) (t : ℕ) + (p : Prefix counts t 5) : + CW75InitialExecution.fullSource (blocks counts t) + (designatedX p) (designatedY p) (designatedZ p) = 1 := by + unfold CW75InitialExecution.fullSource Tensor.power + apply Finset.prod_eq_one + intro i _ + apply Finset.prod_eq_one + intro j _ + have hs := CW75Primitive.original_support _ _ _ + (coefficient_ne_zero ((terminalWord p).val i)) j + simp only [CoppersmithWinograd.tensor, designatedX, designatedY, designatedZ, + longX, longY, longZ] + exact ite_eq_left hs + +def leftSelect (counts : Scalar → ℕ) (t : ℕ) + (u : Fin (copies counts t) × (Fin (rows counts t) × Fin (inner counts t))) : + Coordinate counts t × (Prefix counts t 5 × (realize counts t).PX) := + (designatedX (labelEquiv counts t u.1), + (labelEquiv counts t u.1, (realize counts t).shape.left.symm u.2)) + +def middleSelect (counts : Scalar → ℕ) (t : ℕ) + (v : Fin (copies counts t) × (Fin (inner counts t) × Fin (columns counts t))) : + Coordinate counts t × (Prefix counts t 5 × (realize counts t).PY) := + (designatedY (labelEquiv counts t v.1), + (labelEquiv counts t v.1, (realize counts t).shape.middle.symm v.2)) + +def rightSelect (counts : Scalar → ℕ) (t : ℕ) + (w : Fin (copies counts t) × (Fin (columns counts t) × Fin (rows counts t))) : + Coordinate counts t × (Prefix counts t 5 × (realize counts t).PZ) := + (designatedZ (labelEquiv counts t w.1), + (labelEquiv counts t w.1, (realize counts t).shape.right.symm w.2)) + +theorem selected_output (counts : Scalar → ℕ) (t : ℕ) : + Tensor.pullback (leftSelect counts t) (middleSelect counts t) (rightSelect counts t) + (LocalMaps.originalScale (CW75InitialExecution.fullSource (blocks counts t)) + (realize counts t).execution.value) = + Tensor.directSum (fun _ : Fin (copies counts t) => + Tensor.matrixCoefficients (K := ℂ) (Fin (rows counts t)) + (Fin (inner counts t)) (Fin (columns counts t))) := by + funext u v w + simp only [Tensor.pullback, LocalMaps.originalScale, leftSelect, middleSelect, rightSelect] + rw [realize_value] + simp only [MatrixCoordinates.tensor, Tensor.pullback] + by_cases h : u.1 = v.1 ∧ u.1 = w.1 + · have hv : v.1 = u.1 := h.1.symm + have hw : w.1 = u.1 := h.2.symm + have hc := designated_coefficient_one counts t (labelEquiv counts t u.1) + simp only [designatedX, designatedY, designatedZ] at hc + simp only [hv, hw, designatedX, designatedY, designatedZ, hc, + Tensor.directSum, true_and, ite_true, one_mul] + simp only [rows, inner, columns, + (realize counts t).shape.left.apply_symm_apply u.2, + (realize counts t).shape.middle.apply_symm_apply v.2, + (realize counts t).shape.right.apply_symm_apply w.2] + unfold Tensor.matrixCoefficients + split_ifs <;> rfl + · have hn : ¬ (labelEquiv counts t u.1 = labelEquiv counts t v.1 ∧ + labelEquiv counts t u.1 = labelEquiv counts t w.1 ∧ + designatedX (labelEquiv counts t u.1) = + longX (terminalWord (labelEquiv counts t u.1)).val ∧ + designatedY (labelEquiv counts t v.1) = + longY (terminalWord (labelEquiv counts t u.1)).val ∧ + designatedZ (labelEquiv counts t w.1) = + longZ (terminalWord (labelEquiv counts t u.1)).val) := by + intro he + exact h ⟨(labelEquiv counts t).injective he.1, + (labelEquiv counts t).injective he.2.1⟩ + simp only [Tensor.directSum, ite_eq_right h, ite_eq_right hn, mul_zero] + +def approximation (counts : Scalar → ℕ) (t : ℕ) : + Tensor.PolynomialApproximation + (Tensor.directSum (fun _ : Fin (copies counts t) => + Tensor.matrixCoefficients (K := ℂ) (Fin (rows counts t)) + (Fin (inner counts t)) (Fin (columns counts t)))) + (rankBudget counts t) (order counts t) (degree counts t) := by + have supported : ∀ x y z : Coordinate counts t, + ¬ CW75InitialExecution.support x y z → + CW75InitialExecution.fullSource (blocks counts t) x y z = 0 := by + intro x y z hs + exact not_ne_iff.mp hs + have full := ExecutionApproximation.approximation (realize counts t).execution + (sourceApproximation counts t) supported + have selected := full.pullback (leftSelect counts t) (middleSelect counts t) + (rightSelect counts t) + rw [selected_output] at selected + simpa only [rankBudget, order, degree, realize_rankBound] using selected + +theorem dimensions_positive (counts : Scalar → ℕ) (t : ℕ) : + 0 < rows counts t ∧ 0 < inner counts t ∧ 0 < columns counts t := + (realize counts t).shape_positive + +theorem volume_eq_copies (counts : Scalar → ℕ) (t : ℕ) : + rows counts t * inner counts t * columns counts t = copies counts t := + realize_volume counts t + +theorem rows_pos (counts : Scalar → ℕ) (t : ℕ) : 0 < rows counts t := + (dimensions_positive counts t).1 + +theorem inner_pos (counts : Scalar → ℕ) (t : ℕ) : 0 < inner counts t := + (dimensions_positive counts t).2.1 + +theorem columns_pos (counts : Scalar → ℕ) (t : ℕ) : 0 < columns counts t := + (dimensions_positive counts t).2.2 + +theorem copies_pos (counts : Scalar → ℕ) (t : ℕ) : 0 < copies counts t := by + rw [← volume_eq_copies] + exact Nat.mul_pos (Nat.mul_pos (rows_pos counts t) (inner_pos counts t)) + (columns_pos counts t) + +theorem rankBudget_pos (counts : Scalar → ℕ) (t : ℕ) : 0 < rankBudget counts t := by + apply Nat.mul_pos (pow_pos (by decide) _) + rw [← realize_rankBound] + exact lt_of_lt_of_le (by + change 0 < rows counts t * inner counts t * columns counts t + rw [volume_eq_copies] + exact copies_pos counts t) (realize_pairing_budget counts t) + +theorem dimensions_eq_pairingSize (counts : Scalar → ℕ) (t : ℕ) : + rows counts t = + ConditionalLabels.stagePairingSize counts curveLabels 5 curveReaderPair .xz t ∧ + inner counts t = + ConditionalLabels.stagePairingSize counts curveLabels 5 curveReaderPair .xy t ∧ + columns counts t = + ConditionalLabels.stagePairingSize counts curveLabels 5 curveReaderPair .yz t := + realize_dimensions counts t + +theorem rank_power (counts : Scalar → ℕ) (t n : ℕ) : + Tensor.RankAtMost + (Tensor.power (Tensor.directSum (fun _ : Fin (copies counts t) => + Tensor.matrixCoefficients (K := ℂ) (Fin (rows counts t)) + (Fin (inner counts t)) (Fin (columns counts t)))) n) + ((degree counts t * n + 1) * rankBudget counts t ^ n) := + (approximation counts t).rank_power n + +end MatrixMultiplication.CW75ReorderedFinite + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/ComplexBounds/CW75ReorderedFiniteRates.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/ComplexBounds/CW75ReorderedFiniteRates.lean new file mode 100644 index 0000000000000000000000000000000000000000..722a863df295fa50aaae880a44d2fbe55f22c1e6 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/ComplexBounds/CW75ReorderedFiniteRates.lean @@ -0,0 +1,75 @@ +import OAI.LinearAlgebra.MatrixMultiplication.ComplexBounds.CW75ReorderedFinite + +namespace OAI + +/-! Explicit complex square and rectangular matrix multiplication bounds. -/ + +noncomputable section + +namespace MatrixMultiplication.CW75ReorderedFiniteRates + +open MatrixMultiplication.Foundation CW75LabelHierarchy StageHierarchyResources +open CW75ReorderedFinite ComplexWitness Filter +open scoped BigOperators Topology Classical + +theorem tendsto_log_copies (counts : Scalar → ℕ) (hD : 0 < ∑ a, counts a) + (p : FiniteLaw Scalar) + (mass : ∀ a, p.mass a = (counts a : ℝ) / (∑ b, counts b : ℕ)) : + Tendsto (fun t : ℕ => Real.log (copies counts t : ℝ) / + ((t : ℝ) * (∑ a, counts a : ℕ))) atTop + (𝓝 (finiteEntropy p.mass)) := by + have hmass : (fun a => (counts a : ℝ) / (∑ b, counts b : ℕ)) = p.mass := + (funext mass).symm + simpa only [copies, hmass] using tendsto_log_exactWords_card_mul counts hD + +theorem tendsto_log_auxiliaryBudget (counts : Scalar → ℕ) (hD : 0 < ∑ a, counts a) + (p : FiniteLaw Scalar) + (mass : ∀ a, p.mass a = (counts a : ℝ) / (∑ b, counts b : ℕ)) : + Tendsto (fun t : ℕ => Real.log (stageAuxiliaryBudget counts curveLabels 5 t : ℝ) / + ((t : ℝ) * (∑ a, counts a : ℕ))) atTop + (𝓝 (finiteEntropy p.mass)) := by + have hmass : (fun a => (counts a : ℝ) / (∑ b, counts b : ℕ)) = p.mass := + (funext mass).symm + simpa only [hmass] using tendsto_log_stageAuxiliaryBudget counts hD curveLabels 5 + curve_completeRecord_injective + +theorem tendsto_log_sourceRank (counts : Scalar → ℕ) (hD : 0 < ∑ a, counts a) : + Tendsto (fun t : ℕ => Real.log ((27 ^ blocks counts t : ℕ) : ℝ) / + ((t : ℝ) * (∑ a, counts a : ℕ))) atTop + (𝓝 (3 * Real.log 3)) := by + have hlog27 : Real.log (27 : ℝ) = 3 * Real.log 3 := by + rw [show (27 : ℝ) = 3 ^ 3 by norm_num, Real.log_pow] + norm_num + have hD' : ((∑ a, counts a : ℕ) : ℝ) ≠ 0 := + Nat.cast_ne_zero.mpr (Nat.ne_of_gt hD) + apply tendsto_const_nhds.congr' + filter_upwards [eventually_ne_atTop (0 : ℕ)] with t ht + have htD : (t : ℝ) * (∑ a, counts a : ℕ) ≠ 0 := + mul_ne_zero (Nat.cast_ne_zero.mpr ht) hD' + rw [Nat.cast_pow, Real.log_pow, blocks, Nat.cast_mul] + change 3 * Real.log 3 = + ((t : ℝ) * (∑ a, counts a : ℕ)) * Real.log 27 / + ((t : ℝ) * (∑ a, counts a : ℕ)) + rw [mul_div_cancel_left₀ _ htD, hlog27] + +theorem tendsto_log_rankBudget (counts : Scalar → ℕ) (hD : 0 < ∑ a, counts a) + (p : FiniteLaw Scalar) + (mass : ∀ a, p.mass a = (counts a : ℝ) / (∑ b, counts b : ℕ)) : + Tendsto (fun t : ℕ => Real.log (rankBudget counts t : ℝ) / + ((t : ℝ) * (∑ a, counts a : ℕ))) atTop + (𝓝 (3 * Real.log 3 + finiteEntropy p.mass)) := by + apply ((tendsto_log_sourceRank counts hD).add + (tendsto_log_auxiliaryBudget counts hD p mass)).congr + intro t + have hsource : ((27 ^ blocks counts t : ℕ) : ℝ) ≠ 0 := + Nat.cast_ne_zero.mpr (pow_ne_zero _ (by decide)) + have hauxiliary : (stageAuxiliaryBudget counts curveLabels 5 t : ℝ) ≠ 0 := + Nat.cast_ne_zero.mpr + (Nat.ne_of_gt (stageAuxiliaryBudget_pos counts curveLabels 5 t)) + rw [rankBudget, Nat.cast_mul, Real.log_mul hsource hauxiliary, add_div] + +end MatrixMultiplication.CW75ReorderedFiniteRates + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/ComplexBounds/CW75ReorderedGeometricValues.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/ComplexBounds/CW75ReorderedGeometricValues.lean new file mode 100644 index 0000000000000000000000000000000000000000..5c4aebbdb9bcf51079d3d77f6feeaa924e3171fb --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/ComplexBounds/CW75ReorderedGeometricValues.lean @@ -0,0 +1,164 @@ +import OAI.LinearAlgebra.MatrixMultiplication.ComplexBounds.CW75ReorderedWords +import OAI.LinearAlgebra.MatrixMultiplication.Entropy.ComplexConditionalHierarchyStage +import OAI.LinearAlgebra.MatrixMultiplication.Separation.ComplexPrefixSeparationOrientations +import OAI.LinearAlgebra.MatrixMultiplication.Tensor.ComplexGeometricStageCoordinates + +namespace OAI + +/-! Explicit complex square and rectangular matrix multiplication bounds. -/ + +noncomputable section + +namespace MatrixMultiplication.CW75ReorderedGeometricValues + +open MatrixMultiplication.Foundation +open ComplexWitness CW75LabelHierarchy CW75ReorderedWords ConditionalPrefixWords +open ConditionalHierarchyStage PrefixSeparationPolynomialStage PrefixSeparationOrientations +open StageHierarchyResources +open scoped Classical + +variable {Position : Type*} [Fintype Position] {counts : Scalar → ℕ} {n t : ℕ} + +abbrev size (counts : Scalar → ℕ) (n t : ℕ) := stageRefinementCount counts curveLabels n t + +theorem actualPool_decode (old : ExactPrefix counts curveLabels n t Position) + (code : Fin (size counts n t)) : + decodePool (actualPool counts curveLabels n t id) (size counts n t) + (actualPool_card counts curveLabels n t id) old code = + ((conditionalPoolEquivFin old).symm code).val := rfl + +theorem decode_eq_iff_eligible (old : ExactPrefix counts curveLabels n t Position) + (code : Fin (size counts n t)) (u v w : LongWord Position) + (word : Position → Scalar) (hword : Represents id old u v w word) : + decodePool (actualPool counts curveLabels n t id) (size counts n t) + (actualPool_card counts curveLabels n t id) old code = (fun i => curveLabels n (word i)) ↔ + eligible id (appendCode old code) u v w := by + rw [actualPool_decode] + exact (eligible_appendCode_iff_of_represents old code u v w word hword).symm + +private theorem first_read (old : ExactPrefix counts curveLabels n t Position) + (u v w : LongWord Position) (word : Position → Scalar) (hn : n < 5) + (hword : Represents id old u v w word) : + firstRead id old (coordinateOf (curveFirstSide n) u v w) = fun i => curveLabels n (word i) := by + rw [hword.1, hword.2.1, hword.2.2.1, coordinateOf_original] + exact firstRead_on_original_word id old word hn hword.2.2.2 + +private theorem second_read (old : ExactPrefix counts curveLabels n t Position) + (u v w : LongWord Position) (word : Position → Scalar) (hn : n < 5) + (hword : Represents id old u v w word) : + secondRead id old (coordinateOf (curveSecondSide n) u v w) = fun i => curveLabels n (word i) := by + rw [hword.1, hword.2.1, hword.2.2.1, coordinateOf_original] + exact secondRead_on_original_word id old word hn hword.2.2.2 + +theorem raw_XY_normal + (old : ExactPrefix counts curveLabels n t Position) (hn : n < 5) + (hfirst : curveFirstSide n = .x) (hsecond : curveSecondSide n = .y) + (x : LongWord Position × InformedOutput (size counts n t)) + (y : LongWord Position × InformedOutput (size counts n t)) + (z : LongWord Position × MissingOutput (size counts n t)) + (word : Position → Scalar) (hword : Represents id old x.1 y.1 z.1 word) : + rawPoolLeading (actualPool counts curveLabels n t id) (size counts n t) + (stageRefinementCount_pos counts curveLabels n t) (actualPool_card counts curveLabels n t id) + (firstRead id) (secondRead id) old x y z = + if x.2.1 = y.2.1 ∧ x.2.1 = z.2.1 ∧ + eligible id (appendCode old x.2.1) x.1 y.1 z.1 then + (GeometricStageCoordinates.xy (size counts n t)).tensor x.2.2 y.2.2 z.2.2 + else 0 := by + have hx := first_read old x.1 y.1 z.1 word hn hword + have hy := second_read old x.1 y.1 z.1 word hn hword + simp only [hfirst, coordinateOf] at hx + simp only [hsecond, coordinateOf] at hy + rw [rawPoolLeading_eq_decodedLeading + (actualPool counts curveLabels n t id) (size counts n t) + (stageRefinementCount_pos counts curveLabels n t) (actualPool_card counts curveLabels n t id) + (firstRead id) (secondRead id) (fun _ _ _ _ => fun i => curveLabels n (word i)) + old x y z hx hy] + unfold decodedLeading + simp only [decode_eq_iff_eligible old x.2.1 x.1 y.1 z.1 word hword, + GeometricStageCoordinates.xy_tensor_apply] + simp only [ite_and] + +theorem raw_XZ_normal + (old : ExactPrefix counts curveLabels n t Position) (hn : n < 5) + (hfirst : curveFirstSide n = .x) (hsecond : curveSecondSide n = .z) + (x : LongWord Position × InformedOutput (size counts n t)) + (y : LongWord Position × MissingOutput (size counts n t)) + (z : LongWord Position × InformedOutput (size counts n t)) + (word : Position → Scalar) (hword : Represents id old x.1 y.1 z.1 word) : + rawPoolLeadingXZ (actualPool counts curveLabels n t id) (size counts n t) + (stageRefinementCount_pos counts curveLabels n t) (actualPool_card counts curveLabels n t id) + (firstRead id) (secondRead id) old x y z = + if x.2.1 = y.2.1 ∧ x.2.1 = z.2.1 ∧ + eligible id (appendCode old x.2.1) x.1 y.1 z.1 then + (GeometricStageCoordinates.xz (size counts n t)).tensor x.2.2 y.2.2 z.2.2 + else 0 := by + have hx := first_read old x.1 y.1 z.1 word hn hword + have hz := second_read old x.1 y.1 z.1 word hn hword + simp only [hfirst, coordinateOf] at hx + simp only [hsecond, coordinateOf] at hz + unfold rawPoolLeadingXZ + rw [rawPoolLeading_eq_decodedLeading + (actualPool counts curveLabels n t id) (size counts n t) + (stageRefinementCount_pos counts curveLabels n t) (actualPool_card counts curveLabels n t id) + (firstRead id) (secondRead id) (fun _ _ _ _ => fun i => curveLabels n (word i)) + old x z y hx hz] + unfold decodedLeading + simp only [decode_eq_iff_eligible old x.2.1 x.1 y.1 z.1 word hword, + GeometricStageCoordinates.xz_tensor_apply] + have hswap : + (x.2.1 = z.2.1 ∧ x.2.1 = y.2.1 ∧ + eligible id (appendCode old x.2.1) x.1 y.1 z.1 ∧ x.2.2 = z.2.2) ↔ + (x.2.1 = y.2.1 ∧ x.2.1 = z.2.1 ∧ + eligible id (appendCode old x.2.1) x.1 y.1 z.1 ∧ x.2.2 = z.2.2) := + and_left_comm + simp only [hswap, ite_and] + +theorem raw_YZ_normal + (old : ExactPrefix counts curveLabels n t Position) (hn : n < 5) + (hfirst : curveFirstSide n = .y) (hsecond : curveSecondSide n = .z) + (x : LongWord Position × MissingOutput (size counts n t)) + (y : LongWord Position × InformedOutput (size counts n t)) + (z : LongWord Position × InformedOutput (size counts n t)) + (word : Position → Scalar) (hword : Represents id old x.1 y.1 z.1 word) : + rawPoolLeadingYZ (actualPool counts curveLabels n t id) (size counts n t) + (stageRefinementCount_pos counts curveLabels n t) (actualPool_card counts curveLabels n t id) + (firstRead id) (secondRead id) old x y z = + if x.2.1 = y.2.1 ∧ x.2.1 = z.2.1 ∧ + eligible id (appendCode old x.2.1) x.1 y.1 z.1 then + (GeometricStageCoordinates.yz (size counts n t)).tensor x.2.2 y.2.2 z.2.2 + else 0 := by + have hy := first_read old x.1 y.1 z.1 word hn hword + have hz := second_read old x.1 y.1 z.1 word hn hword + simp only [hfirst, coordinateOf] at hy + simp only [hsecond, coordinateOf] at hz + unfold rawPoolLeadingYZ + rw [rawPoolLeading_eq_decodedLeading + (actualPool counts curveLabels n t id) (size counts n t) + (stageRefinementCount_pos counts curveLabels n t) (actualPool_card counts curveLabels n t id) + (firstRead id) (secondRead id) (fun _ _ _ _ => fun i => curveLabels n (word i)) + old y z x hy hz] + have hguard : + (y.2.1 = z.2.1 ∧ y.2.1 = x.2.1 ∧ + decodePool (actualPool counts curveLabels n t id) (size counts n t) + (actualPool_card counts curveLabels n t id) old y.2.1 = (fun i => curveLabels n (word i)) ∧ + y.2.2 = z.2.2) ↔ + (x.2.1 = y.2.1 ∧ x.2.1 = z.2.1 ∧ + eligible id (appendCode old x.2.1) x.1 y.1 z.1 ∧ y.2.2 = z.2.2) := by + constructor + · rintro ⟨hyz, hyx, hdecode, hpair⟩ + refine ⟨hyx.symm, hyx.symm.trans hyz, ?_, hpair⟩ + apply (decode_eq_iff_eligible old x.2.1 x.1 y.1 z.1 word hword).mp + simpa only [hyx] using hdecode + · rintro ⟨hxy, hxz, he, hpair⟩ + refine ⟨hxy.symm.trans hxz, hxy.symm, ?_, hpair⟩ + have hdecode := (decode_eq_iff_eligible old x.2.1 x.1 y.1 z.1 word hword).mpr he + simpa only [hxy] using hdecode + unfold decodedLeading + simp only [hguard, GeometricStageCoordinates.yz_tensor_apply] + simp only [ite_and] + +end MatrixMultiplication.CW75ReorderedGeometricValues + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/ComplexBounds/CW75ReorderedRectangular.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/ComplexBounds/CW75ReorderedRectangular.lean new file mode 100644 index 0000000000000000000000000000000000000000..6df5debc5657b655233b338c0a6b582be2818df5 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/ComplexBounds/CW75ReorderedRectangular.lean @@ -0,0 +1,34 @@ +import OAI.LinearAlgebra.MatrixMultiplication.ComplexBounds.CW75ReorderedBalancedRates +import OAI.LinearAlgebra.MatrixMultiplication.Entropy.CurveRationalLaw + +namespace OAI + +/-! Explicit complex square and rectangular matrix multiplication bounds. -/ + +namespace MatrixMultiplication.CW75ReorderedRectangular + +open MatrixMultiplication.Foundation ConditionalLabels ComplexWitness +open CW75ReorderedBalanced CW75ReorderedBalancedRates +open scoped BigOperators + +theorem rectangularOmega_lt_target : + Arithmetic.rectangularOmega ℂ ((709 : ℝ) / 1000) < (523 : ℝ) / 250 := by + obtain ⟨counts, hD, h_lower, h_upper, g_lower, _g_upper⟩ := + CurveLaws.exists_count_rate_bounds + let p := normalizedCountLaw counts hD + have mass : ∀ a, p.mass a = (counts a : ℝ) / (∑ b, counts b : ℕ) := fun _ => rfl + exact RectangularWitness.omega_lt_target_of_nearby_balanced_family + (witness counts) (fun t => (t : ℝ) * (∑ a, counts a : ℕ)) + (lawPairingRate p curveLabels 5 curveReaderPair .yz) + (lawPairingRate p curveLabels 5 curveReaderPair .xy + + lawPairingRate p curveLabels 5 curveReaderPair .xz) + (finiteEntropy p.mass) g_lower h_lower h_upper + (scale_eventually_pos counts hD) + (tendsto_log_witness_outer counts hD p mass) + (tendsto_log_witness_inner counts hD p mass) + (tendsto_log_witness_multiplicity counts hD p mass) + (tendsto_log_witness_rank counts hD p mass) + +end MatrixMultiplication.CW75ReorderedRectangular + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/ComplexBounds/CW75ReorderedWords.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/ComplexBounds/CW75ReorderedWords.lean new file mode 100644 index 0000000000000000000000000000000000000000..746c952eb5818cf91ab7512969af3e66081a0110 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/ComplexBounds/CW75ReorderedWords.lean @@ -0,0 +1,301 @@ +import OAI.LinearAlgebra.MatrixMultiplication.Entropy.ComplexConditionalPrefixWords +import OAI.LinearAlgebra.MatrixMultiplication.Tensor.ComplexWitness + +namespace OAI + +/-! Explicit complex square and rectangular matrix multiplication bounds. -/ + +noncomputable section + +namespace MatrixMultiplication.CW75ReorderedWords + +open MatrixMultiplication.Foundation +open CW75LabelHierarchy ConditionalPrefixWords ComplexWitness +open scoped BigOperators Classical + +universe u v + +abbrev BlockPosition (counts : Scalar → ℕ) (t : ℕ) := Fin (t * ∑ a, counts a) + +variable {Position : Type u} [Fintype Position] + +abbrev LongWord (Position : Type u) := Position → Word + +def longX (word : Position → Scalar) : LongWord Position := fun i => x (word i) +def longY (word : Position → Scalar) : LongWord Position := fun i => y (word i) +def longZ (word : Position → Scalar) : LongWord Position := fun i => z (word i) + +def longCoordinate (side : Side) (word : Position → Scalar) : LongWord Position := + fun i => originalCoordinate side (word i) + +def coordinateOf : Side → LongWord Position → LongWord Position → LongWord Position → + LongWord Position + | .x, u, _, _ => u + | .y, _, v, _ => v + | .z, _, _, w => w + +omit [Fintype Position] in +theorem coordinateOf_original (side : Side) (word : Position → Scalar) : + coordinateOf side (longX word) (longY word) (longZ word) = + longCoordinate side word := by + cases side <;> rfl + +omit [Fintype Position] in +theorem longCoordinates_injective : Function.Injective + (fun word : Position → Scalar => (longX word, longY word, longZ word)) := by + intro word other h + funext i + apply coordinates_injective + exact Prod.ext (congrFun (congrArg Prod.fst h) i) + (Prod.ext (congrFun (congrArg (fun q => q.2.1) h) i) + (congrFun (congrArg (fun q => q.2.2) h) i)) + +variable {Prefix : Type v} {counts : Scalar → ℕ} {n t : ℕ} + +def Represents (priorWord : Prefix → ExactPrefix counts curveLabels n t Position) + (prior : Prefix) (u v w : LongWord Position) (word : Position → Scalar) : Prop := + u = longX word ∧ v = longY word ∧ w = longZ word ∧ + ∀ i, (priorWord prior).val i = labelRecordOf curveLabels n (word i) + +def eligible (priorWord : Prefix → ExactPrefix counts curveLabels n t Position) + (prior : Prefix) (u v w : LongWord Position) : Prop := + ∃ word : Position → Scalar, Represents priorWord prior u v w word + +def firstRead (priorWord : Prefix → ExactPrefix counts curveLabels n t Position) + (prior : Prefix) (own : LongWord Position) : Position → Label n := + fun i => curveFirstReader n ((priorWord prior).val i) (own i) + +def secondRead (priorWord : Prefix → ExactPrefix counts curveLabels n t Position) + (prior : Prefix) (own : LongWord Position) : Position → Label n := + fun i => curveSecondReader n ((priorWord prior).val i) (own i) + +theorem firstRead_on_original_word + (priorWord : Prefix → ExactPrefix counts curveLabels n t Position) (prior : Prefix) + (word : Position → Scalar) (hn : n < 5) + (hprior : ∀ i, (priorWord prior).val i = labelRecordOf curveLabels n (word i)) : + firstRead priorWord prior (longCoordinate (curveFirstSide n) word) = + fun i => curveLabels n (word i) := by + funext i + change curveFirstReader n ((priorWord prior).val i) + (originalCoordinate (curveFirstSide n) (word i)) = curveLabels n (word i) + rw [hprior i] + exact curveFirstReader_readable n hn (word i) + +theorem secondRead_on_original_word + (priorWord : Prefix → ExactPrefix counts curveLabels n t Position) (prior : Prefix) + (word : Position → Scalar) (hn : n < 5) + (hprior : ∀ i, (priorWord prior).val i = labelRecordOf curveLabels n (word i)) : + secondRead priorWord prior (longCoordinate (curveSecondSide n) word) = + fun i => curveLabels n (word i) := by + funext i + change curveSecondReader n ((priorWord prior).val i) + (originalCoordinate (curveSecondSide n) (word i)) = curveLabels n (word i) + rw [hprior i] + exact curveSecondReader_readable n hn (word i) + +theorem readers_recover_original_fine + (priorWord : Prefix → ExactPrefix counts curveLabels n t Position) (prior : Prefix) + (u v w : LongWord Position) (hn : n < 5) (h : eligible priorWord prior u v w) : + ∃ word : Position → Scalar, Represents priorWord prior u v w word ∧ + firstRead priorWord prior (coordinateOf (curveFirstSide n) u v w) = + (fun i => curveLabels n (word i)) ∧ + secondRead priorWord prior (coordinateOf (curveSecondSide n) u v w) = + (fun i => curveLabels n (word i)) := by + obtain ⟨word, hw⟩ := h + refine ⟨word, hw, ?_, ?_⟩ + · rw [hw.1, hw.2.1, hw.2.2.1, coordinateOf_original] + exact firstRead_on_original_word priorWord prior word hn hw.2.2.2 + · rw [hw.1, hw.2.1, hw.2.2.1, coordinateOf_original] + exact secondRead_on_original_word priorWord prior word hn hw.2.2.2 + +theorem readable_of_eligible + (priorWord : Prefix → ExactPrefix counts curveLabels n t Position) (prior : Prefix) + (u v w : LongWord Position) (hn : n < 5) (h : eligible priorWord prior u v w) : + firstRead priorWord prior (coordinateOf (curveFirstSide n) u v w) = + secondRead priorWord prior (coordinateOf (curveSecondSide n) u v w) := by + obtain ⟨word, _, hfirst, hsecond⟩ := + readers_recover_original_fine priorWord prior u v w hn h + exact hfirst.trans hsecond.symm + +theorem represented_word_unique + (priorWord : Prefix → ExactPrefix counts curveLabels n t Position) (prior : Prefix) + (u v w : LongWord Position) {word other : Position → Scalar} + (hword : Represents priorWord prior u v w word) + (hother : Represents priorWord prior u v w other) : word = other := by + apply longCoordinates_injective + exact Prod.ext (hword.1.symm.trans hother.1) + (Prod.ext (hword.2.1.symm.trans hother.2.1) + (hword.2.2.1.symm.trans hother.2.2.1)) + +theorem eligible_coefficient_one + (priorWord : Prefix → ExactPrefix counts curveLabels n t Position) (prior : Prefix) + (u v w : LongWord Position) (h : eligible priorWord prior u v w) (i : Position) : + CW75Primitive.tensor (u i) (v i) (w i) = 1 := by + obtain ⟨word, hw⟩ := h + rw [hw.1, hw.2.1, hw.2.2.1] + exact coefficient_one (word i) + +theorem eligible_original_grade + (priorWord : Prefix → ExactPrefix counts curveLabels n t Position) (prior : Prefix) + (u v w : LongWord Position) {word : Position → Scalar} + (h : Represents priorWord prior u v w word) (i : Position) : + CWOriginalWords.decodeWord (u i) (v i) (w i) = grade (word i) := by + rw [h.1, h.2.1, h.2.2.1] + exact decode_original_grade (word i) + +theorem eligible_appendCode_iff + (old : ExactPrefix counts curveLabels n t Position) + (code : Fin (StageHierarchyResources.stageRefinementCount counts curveLabels n t)) + (u v w : LongWord Position) : + eligible id (appendCode old code) u v w ↔ + ∃ word : Position → Scalar, Represents id old u v w word ∧ + ((conditionalPoolEquivFin old).symm code).val = + (fun i => curveLabels n (word i)) := by + constructor + · rintro ⟨word, hu, hv, hw, hprior⟩ + refine ⟨word, ⟨hu, hv, hw, ?_⟩, ?_⟩ + · intro i + have hi := hprior i + change (old.val i, ((conditionalPoolEquivFin old).symm code).val i) = + (labelRecordOf curveLabels n (word i), curveLabels n (word i)) at hi + exact congrArg Prod.fst hi + · funext i + have hi := hprior i + change (old.val i, ((conditionalPoolEquivFin old).symm code).val i) = + (labelRecordOf curveLabels n (word i), curveLabels n (word i)) at hi + exact congrArg Prod.snd hi + · rintro ⟨word, ⟨hu, hv, hw, hprior⟩, hfine⟩ + refine ⟨word, hu, hv, hw, ?_⟩ + intro i + change (old.val i, ((conditionalPoolEquivFin old).symm code).val i) = + (labelRecordOf curveLabels n (word i), curveLabels n (word i)) + exact Prod.ext (hprior i) (congrFun hfine i) + +theorem represented_fine_eq + (priorWord : Prefix → ExactPrefix counts curveLabels n t Position) (prior : Prefix) + (u v w : LongWord Position) {word other : Position → Scalar} + (hword : Represents priorWord prior u v w word) + (hother : Represents priorWord prior u v w other) : + (fun i => curveLabels n (word i)) = (fun i => curveLabels n (other i)) := by + rw [represented_word_unique priorWord prior u v w hword hother] + +theorem eligible_appendCode_iff_of_represents + (old : ExactPrefix counts curveLabels n t Position) + (code : Fin (StageHierarchyResources.stageRefinementCount counts curveLabels n t)) + (u v w : LongWord Position) (word : Position → Scalar) + (hword : Represents id old u v w word) : + eligible id (appendCode old code) u v w ↔ + ((conditionalPoolEquivFin old).symm code).val = (fun i => curveLabels n (word i)) := by + rw [eligible_appendCode_iff] + constructor + · rintro ⟨other, hother, hfine⟩ + exact hfine.trans (represented_fine_eq id old u v w hother hword) + · intro hfine + exact ⟨word, hword, hfine⟩ + +theorem root_eligible_iff + (old : ExactPrefix counts curveLabels 0 t Position) (u v w : LongWord Position) : + eligible id old u v w ↔ ∀ i, CW75Primitive.tensor (u i) (v i) (w i) ≠ 0 := by + constructor + · intro h i + rw [eligible_coefficient_one id old u v w h i] + exact one_ne_zero + · intro h + have hchoice : ∀ i : Position, ∃ a : Scalar, (x a, y a, z a) = (u i, v i, w i) := + fun i => CW75LabelHierarchy.support_exhausted (u i) (v i) (w i) (h i) + choose word hword using hchoice + refine ⟨word, ?_, ?_, ?_, ?_⟩ + · funext i + exact (congrArg Prod.fst (hword i)).symm + · funext i + exact (congrArg (fun q => q.2.1) (hword i)).symm + · funext i + exact (congrArg (fun q => q.2.2) (hword i)).symm + · intro i + change (old.val i : PUnit) = PUnit.unit + exact Subsingleton.elim _ _ + +def terminalWord (last : ExactPrefix counts curveLabels 5 t Position) : + PopulationWords Position (fun a => t * counts a) := by + let source := sourcePrefixEquiv counts curveLabels 5 t Position curve_completeRecord_injective last + refine ⟨source.val, ?_⟩ + intro a + refine Eq.trans ?_ (source.property a) + unfold wordPopulation + exact congrArg + (fun inst : Fintype {i : Position // source.val i = a} => @Fintype.card _ inst) + (Subsingleton.elim _ _) + +theorem terminalWord_record (last : ExactPrefix counts curveLabels 5 t Position) (i : Position) : + labelRecordOf curveLabels 5 ((terminalWord last).val i) = last.val i := + sourceSymbol_record last i + +theorem terminalWord_of_represents + (last : ExactPrefix counts curveLabels 5 t Position) (u v w : LongWord Position) + (word : Position → Scalar) (hword : Represents id last u v w word) : + (terminalWord last).val = word := by + funext i + exact (sourceSymbol_eq_iff curve_completeRecord_injective last i (word i)).2 (hword.2.2.2 i) + +theorem terminal_eligible_iff + (last : ExactPrefix counts curveLabels 5 t Position) (u v w : LongWord Position) : + eligible id last u v w ↔ + u = longX (terminalWord last).val ∧ v = longY (terminalWord last).val ∧ + w = longZ (terminalWord last).val := by + constructor + · rintro ⟨word, hword⟩ + rw [terminalWord_of_represents last u v w word hword] + exact ⟨hword.1, hword.2.1, hword.2.2.1⟩ + · rintro ⟨hu, hv, hw⟩ + refine ⟨(terminalWord last).val, hu, hv, hw, ?_⟩ + intro i + exact (terminalWord_record last i).symm + +theorem terminal_original_grade + (last : ExactPrefix counts curveLabels 5 t Position) (u v w : LongWord Position) + (h : eligible id last u v w) (i : Position) : + CWOriginalWords.decodeWord (u i) (v i) (w i) = grade ((terminalWord last).val i) := by + obtain ⟨hu, hv, hw⟩ := (terminal_eligible_iff last u v w).mp h + rw [hu, hv, hw] + exact decode_original_grade ((terminalWord last).val i) + +theorem stage0_XY_readable + (priorWord : Prefix → ExactPrefix counts curveLabels 0 t Position) (prior : Prefix) + (u v w : LongWord Position) (h : eligible priorWord prior u v w) : + firstRead priorWord prior u = secondRead priorWord prior v := by + simpa [curveFirstSide, curveSecondSide, coordinateOf] using + readable_of_eligible priorWord prior u v w (by decide : 0 < 5) h + +theorem stage1_XZ_readable + (priorWord : Prefix → ExactPrefix counts curveLabels 1 t Position) (prior : Prefix) + (u v w : LongWord Position) (h : eligible priorWord prior u v w) : + firstRead priorWord prior u = secondRead priorWord prior w := by + simpa [curveFirstSide, curveSecondSide, coordinateOf] using + readable_of_eligible priorWord prior u v w (by decide : 1 < 5) h + +theorem stage2_XY_readable + (priorWord : Prefix → ExactPrefix counts curveLabels 2 t Position) (prior : Prefix) + (u v w : LongWord Position) (h : eligible priorWord prior u v w) : + firstRead priorWord prior u = secondRead priorWord prior v := by + simpa [curveFirstSide, curveSecondSide, coordinateOf] using + readable_of_eligible priorWord prior u v w (by decide : 2 < 5) h + +theorem stage3_YZ_readable + (priorWord : Prefix → ExactPrefix counts curveLabels 3 t Position) (prior : Prefix) + (u v w : LongWord Position) (h : eligible priorWord prior u v w) : + firstRead priorWord prior v = secondRead priorWord prior w := by + simpa [curveFirstSide, curveSecondSide, coordinateOf] using + readable_of_eligible priorWord prior u v w (by decide : 3 < 5) h + +theorem stage4_YZ_readable + (priorWord : Prefix → ExactPrefix counts curveLabels 4 t Position) (prior : Prefix) + (u v w : LongWord Position) (h : eligible priorWord prior u v w) : + firstRead priorWord prior v = secondRead priorWord prior w := by + simpa [curveFirstSide, curveSecondSide, coordinateOf] using + readable_of_eligible priorWord prior u v w (by decide : 4 < 5) h + +end MatrixMultiplication.CW75ReorderedWords + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/ComplexBounds/SquareBound.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/ComplexBounds/SquareBound.lean new file mode 100644 index 0000000000000000000000000000000000000000..72e8fefd0231ccf0f6cdc863f4936eb96d2674e8 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/ComplexBounds/SquareBound.lean @@ -0,0 +1,113 @@ +import OAI.LinearAlgebra.MatrixMultiplication.Entropy.BaseConditionalReaders +import OAI.LinearAlgebra.MatrixMultiplication.Arithmetic.Compatibility +import OAI.LinearAlgebra.MatrixMultiplication.Completion.HierarchyPrograms +import OAI.LinearAlgebra.MatrixMultiplication.Completion.SquareRates +import OAI.LinearAlgebra.MatrixMultiplication.ComplexBounds.SquareCounts + +namespace OAI + +/-! Explicit complex square and rectangular matrix multiplication bounds. -/ + +noncomputable section + +namespace MatrixMultiplication.SquareBound + +open MatrixMultiplication.Foundation RecursiveCompletion CompletionLabels +open CompletionLabels.TopologicalFlatten CompletionHierarchyWords Filter +open scoped BigOperators Topology Classical + +abbrev Coordinate := Script.Coord (Fin 3) Script.square +abbrev Carrier := RetainedLeaf SquareCounts.completed .B .C + +def conditional : ReadableTensor SquareCounts.completed := + ReadableTensor.script BaseThree.flagged BaseConditionalReaders.baseThreeReadable Script.square + +def program : + Program Carrier (CompletionLabels.Coordinate Coordinate Coordinate Coordinate) + PUnit (Color ⊕ conditional.Code) (1 + conditional.depth) := + terminationProgram SquareCounts.completed .B .C (by decide) + conditional.program conditional.context_eq conditional.view_eq + +theorem program_context (a : Carrier) : program.context a = PUnit.unit := rfl + +theorem program_view (side : Color) (a : Carrier) : + program.view side a = coordinate a.val.val side := rfl + +theorem program_joint : + Function.Injective (fun a : Carrier => (program.view .B a, program.view .C a, + program.view .A a)) := by + intro a b h + apply Subtype.ext + apply Subtype.ext + exact h + +def hierarchy : ReadableHierarchy Carrier Coordinate Coordinate Coordinate := + ReadableHierarchy.ofProgram program PUnit.unit program_context program_joint + +theorem hierarchy_complete : + Function.Injective (labelRecordOf hierarchy.labels hierarchy.depth) := by + apply ReadableHierarchy.ofProgram_complete program PUnit.unit program_context program_joint + exact terminationProgram_complete SquareCounts.completed .B .C (by decide) + conditional.program conditional.context_eq conditional.view_eq conditional.complete + +@[simp] theorem hierarchy_x (a : Carrier) : hierarchy.x a = a.val.val.1 := rfl +@[simp] theorem hierarchy_y (a : Carrier) : hierarchy.y a = a.val.val.2.1 := rfl +@[simp] theorem hierarchy_z (a : Carrier) : hierarchy.z a = a.val.val.2.2 := rfl + +theorem source_supported (x y z : Coordinate) (h : SquareCounts.tensor x y z ≠ 0) : + ∃ a : Carrier, hierarchy.x a = x ∧ hierarchy.y a = y ∧ hierarchy.z a = z := by + exact ⟨SquareCounts.retainedLeafEquiv ⟨(x, y, z), h⟩, rfl, rfl, rfl⟩ + +theorem source_unit (a : Carrier) : + SquareCounts.tensor (hierarchy.x a) (hierarchy.y a) (hierarchy.z a) = 1 := by + exact SquareCounts.tensor_unit_coefficients _ _ _ + (SquareCounts.retainedLeafEquiv.symm a).property + +def counts (_ : Carrier) : ℕ := 1 + +theorem card_carrier : Fintype.card Carrier = SquareCounts.leafCount := + (Fintype.card_congr SquareCounts.retainedLeafEquiv.symm).trans SquareCounts.card_leaf + +theorem total_counts : (∑ a : Carrier, counts a) = SquareCounts.leafCount := by + exact (Finset.card_eq_sum_ones Finset.univ).symm.trans card_carrier + +theorem total_counts_pos : 0 < ∑ a : Carrier, counts a := by + rw [total_counts] + exact SquareCounts.leafCount_pos + +theorem count_entropy : + finiteEntropy (CompletionSquareRates.countMass counts) = Real.log SquareCounts.leafCount := by + have hm : CompletionSquareRates.countMass counts = SquareCounts.retainedUniformLaw.mass := by + funext a + rw [SquareCounts.retainedUniformLaw_mass] + rw [CompletionSquareRates.countMass, total_counts] + simp only [counts, Nat.cast_one, one_div] + rw [hm, SquareCounts.retainedUniformLaw_entropy] + +def family (n : ℕ) : FiniteMMRealization := + CompletionSquareRates.positiveRealization hierarchy counts total_counts_pos + hierarchy_complete SquareCounts.approximation source_supported source_unit (by decide) n + +theorem score_limit (β : ℝ) : + Tendsto (fun n => (family n).rates.score β) atTop + (𝓝 (β / 216 * Real.log SquareWitness.leafCount)) := by + have h := CompletionSquareRates.score_limit hierarchy counts total_counts_pos + hierarchy_complete SquareCounts.approximation source_supported source_unit (by decide) β + rw [count_entropy] at h + convert h using 1 <;> norm_num [family, SquareCounts.leafCount, SquareWitness.leafCount] + +theorem omega_lt_2267_div_1000 : + MatrixMultiplication.Foundation.Arithmetic.omega < (2267 : ℝ) / 1000 := + SquareWitness.omega_lt_of_certified_uniform_square_family family + (score_limit ((2267 : ℝ) / 1000)) + +theorem complex_omega_lt_2267_div_1000 : + MatrixMultiplication.Arithmetic.omega ℂ < (2267 : ℝ) / 1000 := by + rw [MatrixMultiplication.Arithmetic.complex_omega_eq] + exact omega_lt_2267_div_1000 + +end MatrixMultiplication.SquareBound + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/ComplexBounds/SquareCounts.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/ComplexBounds/SquareCounts.lean new file mode 100644 index 0000000000000000000000000000000000000000..bf1050a6e48d95536e5aaa2dfc38bce555436ca1 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/ComplexBounds/SquareCounts.lean @@ -0,0 +1,252 @@ +import OAI.LinearAlgebra.MatrixMultiplication.Completion.Cardinality +import OAI.LinearAlgebra.MatrixMultiplication.Completion.Termination +import OAI.LinearAlgebra.MatrixMultiplication.Tensor.BaseTensorBudgets +import OAI.LinearAlgebra.MatrixMultiplication.Entropy.ComplexEntropyContinuity + +namespace OAI + +/-! Explicit complex square and rectangular matrix multiplication bounds. -/ + +noncomputable section + +namespace MatrixMultiplication.SquareCounts + +open MatrixMultiplication.Foundation RecursiveCompletion CompletionLabels CompletionCardinality +open scoped BigOperators +attribute [local instance] Classical.propDecidable Classical.decEq + +universe uCoord + +private theorem colorBA : Color.B ≠ Color.A := by intro h; cases h +private theorem colorBC : Color.B ≠ Color.C := by intro h; cases h +private theorem colorAB : Color.A ≠ Color.B := by intro h; cases h +private theorem colorAC : Color.A ≠ Color.C := by intro h; cases h +private theorem colorCB : Color.C ≠ Color.B := by intro h; cases h +private theorem colorCA : Color.C ≠ Color.A := by intro h; cases h + +attribute [local simp] colorBA colorBC colorAB colorAC colorCB colorCA + +def baseLeaf (i : Fin 5) : CompletionLabels.Leaf BaseThree.flagged := + ⟨BaseThree.point i, by + change BaseThree.tensor _ _ _ ≠ 0 + rw [BaseThree.point_supported] + exact one_ne_zero⟩ + +def baseLeafEquiv : Fin 5 ≃ CompletionLabels.Leaf BaseThree.flagged := + Equiv.ofBijective baseLeaf ⟨by + intro i j h + exact BaseThree.point_injective (congrArg Subtype.val h), by + intro a + obtain ⟨i, hi⟩ := (BaseThree.support_enumeration _ _ _).mp a.property + exact ⟨i, Subtype.ext hi⟩⟩ + +theorem baseLeaf_color (i : Fin 5) : + leafColor BaseThree.flagged (baseLeaf i) = BaseThree.leafColor i := by + fin_cases i <;> + norm_num [leafColor, baseLeaf, BaseThree.flagged, BaseThree.flagB, BaseThree.flagA, + BaseThree.point, BaseThree.leafColor, Fin.ext_iff] + +def initialCount : Color → ℕ + | .B => 2 + | .A => 2 + | .C => 1 + +theorem base_conditionalCount (c : Color) : + conditionalCount BaseThree.flagged c = initialCount c := by + have h := Fintype.card_congr + (baseLeafEquiv.subtypeEquiv + (p := fun i => BaseThree.leafColor i = c) + (q := fun a => leafColor BaseThree.flagged a = c) + (fun i => by change _ ↔ leafColor BaseThree.flagged (baseLeaf i) = c + rw [baseLeaf_color])) + change Fintype.card {a : CompletionLabels.Leaf BaseThree.flagged // + leafColor BaseThree.flagged a = c} = _ + rw [← h] + simp only [Fintype.card_subtype, Finset.card_filter, Fin.sum_univ_five] + cases c <;> + norm_num [BaseThree.leafColor, initialCount, + show (3 : Fin 5).val = 3 from rfl, show (4 : Fin 5).val = 4 from rfl] + +def counts : Script → Color → ℕ + | .base => initialCount + | .step prior center m => fun c => + if c = center then counts prior center ^ m + else (counts prior center + counts prior c) ^ m - counts prior center ^ m + +theorem conditionalCount_script (s : Script) (c : Color) : + conditionalCount (Script.tensor BaseThree.flagged s) c = counts s c := by + induction s generalizing c with + | base => exact base_conditionalCount c + | step prior center m ih => + change conditionalCount (complete (Script.tensor BaseThree.flagged prior) center m) c = _ + rw [CompletionCardinality.count_complete] + simp only [counts, ih] + +def stageOne : Script := Script.step Script.base .B 2 +def stageTwo : Script := stageOne.step .A 3 +def stageThree : Script := stageTwo.step .C 2 +def stageFour : Script := stageThree.step .B 2 + +theorem factors_at_every_stage : + stageOne.factors = 2 ∧ stageTwo.factors = 6 ∧ stageThree.factors = 12 ∧ + stageFour.factors = 24 ∧ Script.square.factors = 72 := by + norm_num [stageOne, stageTwo, stageThree, stageFour, Script.factors, Script.square] + +theorem counts_after_three : + counts stageThree .B = 20691584 ∧ counts stageThree .A = 13993344 ∧ + counts stageThree .C = 10144225 := by + norm_num [counts, initialCount, stageThree, stageTwo, stageOne, reduceCtorEq] + +theorem counts_after_four : + counts stageFour .B = 428141648429056 ∧ + counts stageFour .A = 774902581936128 ∧ + counts stageFour .C = 522705468255425 := by + norm_num [counts, initialCount, stageFour, stageThree, stageTwo, stageOne, reduceCtorEq] + +theorem actual_counts_after_three : + conditionalCount (Script.tensor BaseThree.flagged stageThree) .B = 20691584 ∧ + conditionalCount (Script.tensor BaseThree.flagged stageThree) .A = 13993344 ∧ + conditionalCount (Script.tensor BaseThree.flagged stageThree) .C = 10144225 := by + simpa only [conditionalCount_script] using counts_after_three + +theorem actual_counts_after_four : + conditionalCount (Script.tensor BaseThree.flagged stageFour) .B = 428141648429056 ∧ + conditionalCount (Script.tensor BaseThree.flagged stageFour) .A = 774902581936128 ∧ + conditionalCount (Script.tensor BaseThree.flagged stageFour) .C = 522705468255425 := by + simpa only [conditionalCount_script] using counts_after_four + +def completed := Script.tensor BaseThree.flagged Script.square + +theorem completion_unit_coefficients {X Y Z : Type uCoord} + (S : FlaggedTensor X Y Z) + (unit : ∀ x y z, S.tensor x y z ≠ 0 → S.tensor x y z = 1) + (center : Color) (m : ℕ) (x y z) + (supported : (complete S center m).tensor x y z ≠ 0) : + (complete S center m).tensor x y z = 1 := by + rw [complete_tensor] at supported ⊢ + split_ifs at supported ⊢ with h + · apply Finset.prod_eq_one + intro i hi + exact unit _ _ _ ((Finset.prod_ne_zero_iff.mp supported) i hi) + · exact False.elim (supported rfl) + +theorem script_unit_coefficients (s : Script) : + ∀ x y z, (Script.tensor BaseThree.flagged s).tensor x y z ≠ 0 → + (Script.tensor BaseThree.flagged s).tensor x y z = 1 := by + induction s with + | base => + intro x y z hs + obtain ⟨i, hi⟩ := (BaseThree.support_enumeration x y z).mp hs + have hp := BaseThree.point_supported i + simpa only [Script.tensor, BaseThree.flagged, hi] using hp + | step prior center m ih => + exact completion_unit_coefficients (Script.tensor BaseThree.flagged prior) + ih center m + +def tensor := CompletionTermination.tensor completed .A + +theorem tensor_unit_coefficients (x y z) (hs : tensor x y z ≠ 0) : + tensor x y z = 1 := by + have h := (CompletionTermination.support_iff completed .A x y z).mp hs + rw [tensor, CompletionTermination.tensor, ite_eq_right h.2] + exact script_unit_coefficients Script.square x y z h.1 + +abbrev Leaf := CompletionTermination.Leaf completed .A + +def retainedLeafEquiv : Leaf ≃ RetainedLeaf completed .B .C := + CompletionTermination.retainedLeafEquiv completed .A .B .C + (by intro c; cases c <;> simp) + +@[simp] theorem retainedLeafEquiv_coordinates (a : Leaf) : + (retainedLeafEquiv a).val.val = a.val := rfl + +def leafCount : ℕ := 2995461856366867388223311649574852466276480577 + +theorem leafCount_pos : 0 < leafCount := by norm_num [leafCount] + +theorem card_termination_A {X Y Z : Type uCoord} [Fintype X] [Fintype Y] [Fintype Z] + (S : FlaggedTensor X Y Z) : + Fintype.card (CompletionTermination.Leaf S .A) = + conditionalCount S .B + conditionalCount S .C := by + rw [Fintype.card_congr (CompletionTermination.leafEquiv S .A)] + simp only [conditionalCount, Fintype.card_subtype, Finset.card_filter, + ← Finset.sum_add_distrib] + apply Finset.sum_congr rfl + intro a _ + cases leafColor S a <;> simp + +theorem card_leaf : Fintype.card Leaf = leafCount := by + rw [card_termination_A, completed, conditionalCount_script, conditionalCount_script] + norm_num [counts, initialCount, Script.square, leafCount, reduceCtorEq] + +instance leafNonempty : Nonempty Leaf := + Fintype.card_pos_iff.mp (by rw [card_leaf]; exact leafCount_pos) + +def uniformLaw : FiniteLaw Leaf := FiniteLaw.uniform Leaf + +theorem uniformLaw_mass (a : Leaf) : uniformLaw.mass a = (leafCount : ℝ)⁻¹ := by + simp [uniformLaw, card_leaf] + +theorem uniformLaw_pos (a : Leaf) : 0 < uniformLaw.mass a := by + rw [uniformLaw_mass] + exact inv_pos.mpr (Nat.cast_pos.mpr leafCount_pos) + +theorem uniformLaw_entropy : finiteEntropy uniformLaw.mass = Real.log leafCount := by + rw [uniformLaw, FiniteLaw.uniform_entropy, card_leaf] + +def leafMultiplicity (_ : Leaf) : ℕ := 1 + +theorem totalMultiplicity : (∑ a : Leaf, leafMultiplicity a) = leafCount := by + exact (Finset.card_eq_sum_ones (Finset.univ : Finset Leaf)).symm.trans card_leaf + +theorem totalMultiplicity_pos : 0 < ∑ a : Leaf, leafMultiplicity a := by + rw [totalMultiplicity] + exact leafCount_pos + +theorem uniformLaw_mass_counts (a : Leaf) : + uniformLaw.mass a = (leafMultiplicity a : ℝ) / + (∑ b : Leaf, leafMultiplicity b : ℕ) := by + rw [uniformLaw_mass, totalMultiplicity] + simp [leafMultiplicity, one_div] + +def retainedUniformLaw : FiniteLaw (RetainedLeaf completed .B .C) := + uniformLaw.map retainedLeafEquiv + +theorem retainedUniformLaw_mass (a : RetainedLeaf completed .B .C) : + retainedUniformLaw.mass a = (leafCount : ℝ)⁻¹ := by + have h := uniformLaw.map_mass_apply retainedLeafEquiv retainedLeafEquiv.injective + (retainedLeafEquiv.symm a) + simpa only [retainedUniformLaw, Equiv.apply_symm_apply, uniformLaw_mass] using h + +theorem retainedUniformLaw_entropy : + finiteEntropy retainedUniformLaw.mass = Real.log leafCount := by + rw [retainedUniformLaw, FiniteLaw.map_entropy_of_injective uniformLaw + retainedLeafEquiv retainedLeafEquiv.injective, uniformLaw_entropy] + +theorem uniform_pairRate_sum {Label : ℕ → Type*} [∀ n, Fintype (Label n)] + (labels : ∀ n, Leaf → Label n) (depth : ℕ) + (reader : Fin depth → ReaderPair) + (complete : Function.Injective (labelRecordOf labels depth)) : + ConditionalLabels.lawPairingRate uniformLaw labels depth reader .xy + + ConditionalLabels.lawPairingRate uniformLaw labels depth reader .xz + + ConditionalLabels.lawPairingRate uniformLaw labels depth reader .yz = + Real.log leafCount := by + rw [ConditionalLabels.lawPairingRate_sum uniformLaw labels depth reader complete, + uniformLaw_entropy] + +def approximation : + Tensor.PolynomialApproximation tensor (3 ^ 72) + (Script.order 5 Script.square) (Script.degree 15 Script.square) := + CompletionTermination.approximation completed .A + (Script.approximation BaseThree.flagged BaseThree.approximation Script.square) + +theorem rank_power (n : ℕ) : + Tensor.RankAtMost (Tensor.power tensor n) + ((Script.degree 15 Script.square * n + 1) * (3 ^ 72) ^ n) := + approximation.rank_power n + +end MatrixMultiplication.SquareCounts + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/ComplexBounds/SquareWitness.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/ComplexBounds/SquareWitness.lean new file mode 100644 index 0000000000000000000000000000000000000000..b5a55128a1a401b55d759ed5f57937ee87522604 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/ComplexBounds/SquareWitness.lean @@ -0,0 +1,64 @@ +import OAI.LinearAlgebra.MatrixMultiplication.Tensor.ComplexWitness +import OAI.LinearAlgebra.MatrixMultiplication.Numerical.ComplexCertificates + +namespace OAI + +/-! Explicit complex square and rectangular matrix multiplication bounds. -/ + +open Filter + +namespace MatrixMultiplication.SquareWitness + +open MatrixMultiplication.Foundation + +def leafCount : ℕ := 2995461856366867388223311649574852466276480577 + +theorem leafCount_pos : 0 < leafCount := by decide + +theorem exponent_upper {c l : ℝ} + (hc : c < (10987 : ℝ) / 10000) + (hl : (523471 : ℝ) / 5000 < l) : + 216 * c / l < (1186596 : ℝ) / 523471 := by + have hl₀ : 0 < l := by linarith + apply (div_lt_iff₀ hl₀).2 + nlinarith + +theorem exponent_lt_target {c l : ℝ} + (hc : c < (10987 : ℝ) / 10000) + (hl : (523471 : ℝ) / 5000 < l) : + 216 * c / l < (2267 : ℝ) / 1000 := by + exact (exponent_upper hc hl).trans + (by norm_num : (1186596 : ℝ) / 523471 < 2267 / 1000) + +theorem strict_log_gap + (hthree : Real.log 3 < (10987 : ℝ) / 10000) + (hleaves : (523471 : ℝ) / 5000 < Real.log leafCount) : + Real.log 3 < ((2267 : ℝ) / 1000) / 216 * Real.log leafCount := by + have h := exponent_lt_target hthree hleaves + have hl₀ : 0 < Real.log leafCount := by linarith + have hm := (div_lt_iff₀ hl₀).1 h + nlinarith + +theorem omega_lt_of_uniform_square_family + (W : ℕ → FiniteMMRealization) + (hlimit : Tendsto + (fun n => (W n).rates.score ((2267 : ℝ) / 1000)) atTop + (nhds (((2267 : ℝ) / 1000) / 216 * Real.log leafCount))) + (hthree : Real.log 3 < (10987 : ℝ) / 10000) + (hleaves : (523471 : ℝ) / 5000 < Real.log leafCount) : + Arithmetic.omega < (2267 : ℝ) / 1000 := + ComplexWitness.omega_lt_of_score_limit W hlimit (strict_log_gap hthree hleaves) + +theorem omega_lt_of_certified_uniform_square_family + (W : ℕ → FiniteMMRealization) + (hlimit : Tendsto + (fun n => (W n).rates.score ((2267 : ℝ) / 1000)) atTop + (nhds (((2267 : ℝ) / 1000) / 216 * Real.log leafCount))) : + Arithmetic.omega < (2267 : ℝ) / 1000 := by + apply omega_lt_of_uniform_square_family W hlimit + ComplexCertificates.log_three_upper + exact ComplexCertificates.square_log_lower + +end MatrixMultiplication.SquareWitness + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/CoppersmithWinograd/CWCoarseIndices.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/CoppersmithWinograd/CWCoarseIndices.lean new file mode 100644 index 0000000000000000000000000000000000000000..09864351dfe11327ddb0e13421a9138a0d102ffd --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/CoppersmithWinograd/CWCoarseIndices.lean @@ -0,0 +1,66 @@ +import OAI.LinearAlgebra.MatrixMultiplication.CoppersmithWinograd.CWStrands + +namespace OAI + +/-! Coppersmith–Winograd tensors, tensor powers and local restrictions. -/ + +noncomputable section + +namespace MatrixMultiplication.CWCoarseIndices + +open MatrixMultiplication.Foundation CWStrands +open scoped BigOperators + +theorem label_weight_le_two : ∀ x : Fin 7, CWLeafStatistics.weight x ≤ 2 := by + decide +kernel + +theorem weight_le {P : Type*} [Fintype P] (w : P → Fin 7) : + weight w ≤ 2 * Fintype.card P := by + calc + weight w ≤ ∑ _i : P, 2 := Finset.sum_le_sum fun i _ => label_weight_le_two (w i) + _ = _ := by simp [Nat.mul_comm] + +def coarseIndex {P : Type*} [Fintype P] (hP : Fintype.card P ≤ 8) + (w : P → Fin 7) : Fin 17 := ⟨weight w, by have := weight_le w; omega⟩ + +theorem strand_coarse_support {F P : Type*} [CommRing F] [Fintype P] + (hP : Fintype.card P ≤ 8) (x y z : P → Fin 7) + (h : strand (F := F) P x y z ≠ 0) : + (coarseIndex hP x).val + (coarseIndex hP y).val + (coarseIndex hP z).val = + 2 * Fintype.card P := strand_support x y z h + +theorem split_coarse_support {F P Q : Type*} [CommRing F] [Fintype P] [Fintype Q] + (hP : Fintype.card P ≤ 8) (g : Fin 3 → ℕ) + (x : (P → Fin 7) × (Q → Fin 7)) + (y : (P → Fin 7) × (Q → Fin 7)) + (z : (P → Fin 7) × (Q → Fin 7)) + (h : shapeTensor (F := F) (P ⊕ Q) g (Sum.elim x.1 x.2) + (Sum.elim y.1 y.2) (Sum.elim z.1 z.2) ≠ 0) : + ((coarseIndex hP x.1).val + (coarseIndex hP y.1).val + + (coarseIndex hP z.1).val = 2 * Fintype.card P) ∧ + (coarseIndex hP x.1).val ≤ g 0 ∧ (coarseIndex hP y.1).val ≤ g 1 ∧ + (coarseIndex hP z.1).val ≤ g 2 := by + have hshape := shapeTensor_support g _ _ _ h + have ht : strand (F := F) (P ⊕ Q) (Sum.elim x.1 x.2) + (Sum.elim y.1 y.2) (Sum.elim z.1 z.2) ≠ 0 := by + simpa only [shapeTensor, ite_eq_left hshape] using h + rw [strand_sum_elim, Tensor.product] at ht + have hl : strand (F := F) P x.1 y.1 z.1 ≠ 0 := by + intro he + exact ht (by rw [he, zero_mul]) + refine ⟨strand_coarse_support hP x.1 y.1 z.1 hl, ?_, ?_, ?_⟩ + · have hs := hshape.1 + rw [weight_sum_elim] at hs + exact hs ▸ Nat.le_add_right (weight x.1) (weight x.2) + · have hs := hshape.2.1 + rw [weight_sum_elim] at hs + exact hs ▸ Nat.le_add_right (weight y.1) (weight y.2) + · have hs := hshape.2.2 + rw [weight_sum_elim] at hs + exact hs ▸ Nat.le_add_right (weight z.1) (weight z.2) + +end MatrixMultiplication.CWCoarseIndices + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/CoppersmithWinograd/CWCompatibilityTransfer.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/CoppersmithWinograd/CWCompatibilityTransfer.lean new file mode 100644 index 0000000000000000000000000000000000000000..fc57f285143384a9c84893fea94c723ecb29a8a3 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/CoppersmithWinograd/CWCompatibilityTransfer.lean @@ -0,0 +1,119 @@ +import OAI.LinearAlgebra.MatrixMultiplication.CoppersmithWinograd.CWLeafStatistics +import OAI.LinearAlgebra.MatrixMultiplication.Recovery.InheritedMasks + +namespace OAI + +/-! Coppersmith–Winograd tensors, tensor powers and local restrictions. -/ + +noncomputable section + +namespace MatrixMultiplication.CWCompatibilityTransfer + +open MatrixMultiplication.Foundation CWLeafRestrictions InheritedMasks +open scoped BigOperators + +def wordWeight {n : ℕ} (w : Fin n → Fin 7) : ℕ := ∑ i, CWLeafStatistics.weight (w i) + +def wordComplement {n : ℕ} (w : Fin n → Fin 7) : Fin n → Fin 7 := + fun i => complement 5 (w i) + +@[simp] theorem wordComplement_involution {n : ℕ} (w : Fin n → Fin 7) : + wordComplement (wordComplement w) = w := by + funext i + exact complement_involution 5 (w i) + +theorem weight_eq_zero_iff : ∀ x : Fin 7, CWLeafStatistics.weight x = 0 ↔ x = 0 := by + decide +kernel + +theorem wordWeight_zero {n : ℕ} (w : Fin n → Fin 7) (h : wordWeight w = 0) : + ∀ i, w i = 0 := by + intro i + have hle : CWLeafStatistics.weight (w i) ≤ wordWeight w := by + unfold wordWeight + exact Finset.single_le_sum (fun j _ => Nat.zero_le (CWLeafStatistics.weight (w j))) + (Finset.mem_univ i) + apply (weight_eq_zero_iff (w i)).mp + omega + +theorem site_nonzero {F : Type*} [CommRing F] {n : ℕ} + (x y z : Fin n → Fin 7) + (h : Tensor.power (FieldCW.tensor F 5) n x y z ≠ 0) (i : Fin n) : + FieldCW.tensor F 5 (x i) (y i) (z i) ≠ 0 := by + intro hi + apply h + exact Finset.prod_eq_zero (Finset.mem_univ i) hi + +theorem zeroX_word_match {F : Type*} [CommRing F] {n : ℕ} + (x y z : Fin n → Fin 7) + (h : Tensor.power (FieldCW.tensor F 5) n x y z ≠ 0) + (hx : wordWeight x = 0) : z = wordComplement y := by + funext i + have hi := site_nonzero x y z h i + rw [wordWeight_zero x hx i] at hi + have heq : FieldCW.tensor F 5 0 (y i) (z i) = + if y i = complement 5 (z i) then 1 else 0 := by + simpa only [complement_involution] using + tensor_zero_matching F 5 (y i) (complement 5 (z i)) + have hyz : y i = complement 5 (z i) := by + by_contra hn + rw [heq, ite_eq_right hn] at hi + exact hi rfl + have hh := congrArg (complement 5) hyz + simpa only [wordComplement, complement_involution] using hh.symm + +theorem zeroY_word_match {F : Type*} [CommRing F] {n : ℕ} + (x y z : Fin n → Fin 7) + (h : Tensor.power (FieldCW.tensor F 5) n x y z ≠ 0) + (hy : wordWeight y = 0) : z = wordComplement x := by + funext i + have hi := site_nonzero x y z h i + rw [wordWeight_zero y hy i] at hi + have heq : FieldCW.tensor F 5 (x i) 0 (z i) = + if x i = complement 5 (z i) then 1 else 0 := by + simpa only [complement_involution] using + tensor_middle_zero_matching F 5 (x i) (complement 5 (z i)) + have hxz : x i = complement 5 (z i) := by + by_contra hn + rw [heq, ite_eq_right hn] at hi + exact hi rfl + have hh := congrArg (complement 5) hxz + simpa only [wordComplement, complement_involution] using hh.symm + +theorem zeroZ_word_match {F : Type*} [CommRing F] {n : ℕ} + (x y z : Fin n → Fin 7) + (h : Tensor.power (FieldCW.tensor F 5) n x y z ≠ 0) + (hz : wordWeight z = 0) : y = wordComplement x := by + funext i + have hi := site_nonzero x y z h i + rw [wordWeight_zero z hz i] at hi + have heq : FieldCW.tensor F 5 (x i) (y i) 0 = + if x i = complement 5 (y i) then 1 else 0 := by + simpa only [complement_involution] using + tensor_last_zero_matching F 5 (x i) (complement 5 (y i)) + have hxy : x i = complement 5 (y i) := by + by_contra hn + rw [heq, ite_eq_right hn] at hi + exact hi rfl + have hh := congrArg (complement 5) hxy + simpa only [wordComplement, complement_involution] using hh.symm + +theorem transfer_window {P A : Type*} [Fintype P] [DecidableEq P] + [Fintype A] [DecidableEq A] {n : ℕ} + (statistic : (Fin n → Fin 7) → A) (κ : A ≃ A) + (hstatistic : ∀ w, statistic (wordComplement w) = κ (statistic w)) + (x y : P → (Fin n → Fin 7)) (hmatch : ∀ i, y i = wordComplement (x i)) + (ν : A → ℝ) (η : ℝ) + (hx : typeWindow ν η (fun i => statistic (x i))) : + typeWindow (ν ∘ κ.symm) η (fun i => statistic (y i)) := by + have heq : (fun i => statistic (y i)) = κ ∘ (fun i => statistic (x i)) := by + funext i + rw [hmatch i, hstatistic] + rfl + rw [heq] + exact (typeWindow_equiv ν η (fun i => statistic (x i)) κ).mpr hx + +end MatrixMultiplication.CWCompatibilityTransfer + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/CoppersmithWinograd/CWCompleteStatistics.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/CoppersmithWinograd/CWCompleteStatistics.lean new file mode 100644 index 0000000000000000000000000000000000000000..c697cb0d18e60905559498f4df12ddbbcd3805d1 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/CoppersmithWinograd/CWCompleteStatistics.lean @@ -0,0 +1,106 @@ +import OAI.LinearAlgebra.MatrixMultiplication.CoppersmithWinograd.CWWindowedLeaves + +namespace OAI + +/-! Coppersmith–Winograd tensors, tensor powers and local restrictions. -/ + +noncomputable section + +namespace MatrixMultiplication.CWCompleteStatistics + +open CWWindowedLeaves CWLeafStatistics CWStrands AllFieldParameters +open scoped BigOperators + +attribute [local instance] Classical.propDecidable + +def pairEquiv : Raw 2 ≃ (Fin 7 × Fin 7) where + toFun w := (w 0, w 1) + invFun u := ![u.1, u.2] + left_inv w := by funext i; fin_cases i <;> rfl + right_inv u := by cases u; rfl + +def orderedEquiv : Raw 4 ≃ ((Fin 7 × Fin 7) × (Fin 7 × Fin 7)) where + toFun w := ((w 0, w 1), (w 2, w 3)) + invFun u := ![u.1.1, u.1.2, u.2.1, u.2.2] + left_inv w := by funext i; fin_cases i <;> rfl + right_inv u := by cases u with | mk u v => cases u; cases v; rfl + +def twoStatistic (w : Raw 2) : Fin 6 := pairStatistic (pairEquiv w) +def fourStatistic (w : Raw 4) : Fin 6 × Fin 6 := + (pairStatistic (orderedEquiv w).1, pairStatistic (orderedEquiv w).2) + +def complementStatistic : Fin 6 ≃ Fin 6 := + { toFun := kappa + invFun := kappa + left_inv := kappa_involution + right_inv := kappa_involution } + +def orderedComplementStatistic : (Fin 6 × Fin 6) ≃ (Fin 6 × Fin 6) := + Equiv.prodCongr complementStatistic complementStatistic + +theorem two_weight (w : Raw 2) : + CWStrands.weight w = statisticWeight (twoStatistic w) := by + rw [twoStatistic, statistic_weight] + simp [CWStrands.weight, pairEquiv, Fin.sum_univ_succ] + +theorem four_weight (w : Raw 4) : + CWStrands.weight w = statisticWeight (fourStatistic w).1 + + statisticWeight (fourStatistic w).2 := by + simp only [fourStatistic, statistic_weight] + simp [CWStrands.weight, orderedEquiv, Fin.sum_univ_succ, Nat.add_assoc] + +theorem two_multiplicity (s : Fin 6) : + Fintype.card {w : Raw 2 // twoStatistic w = s} = AllFieldParameters.multiplicity s := by + let e : {w : Raw 2 // twoStatistic w = s} ≃ + {u : Fin 7 × Fin 7 // pairStatistic u = s} := + { toFun := fun w => ⟨pairEquiv w.val, w.property⟩ + invFun := fun u => ⟨pairEquiv.symm u.val, by simpa [twoStatistic] using u.property⟩ + left_inv := by intro w; apply Subtype.ext; simp + right_inv := by intro u; apply Subtype.ext; simp } + rw [Fintype.card_congr e, pair_multiplicity] + +theorem four_multiplicity (s : Fin 6 × Fin 6) : + Fintype.card {w : Raw 4 // fourStatistic w = s} = + AllFieldParameters.multiplicity s.1 * AllFieldParameters.multiplicity s.2 := by + let e : {w : Raw 4 // fourStatistic w = s} ≃ + {u : (Fin 7 × Fin 7) × (Fin 7 × Fin 7) // + pairStatistic u.1 = s.1 ∧ pairStatistic u.2 = s.2} := + { toFun := fun w => ⟨orderedEquiv w.val, + congrArg Prod.fst w.property, congrArg Prod.snd w.property⟩ + invFun := fun u => ⟨orderedEquiv.symm u.val, by + apply Prod.ext + · simpa [fourStatistic] using u.property.1 + · simpa [fourStatistic] using u.property.2⟩ + left_inv := by intro w; apply Subtype.ext; simp + right_inv := by intro u; apply Subtype.ext; simp } + rw [Fintype.card_congr e, ordered_pair_multiplicity] + +theorem two_complement (w : Raw 2) : + twoStatistic (complementWord w) = complementStatistic (twoStatistic w) := by + exact complement_statistic (pairEquiv w) + +theorem four_complement (w : Raw 4) : + fourStatistic (complementWord w) = orderedComplementStatistic (fourStatistic w) := by + apply Prod.ext + · exact complement_statistic (orderedEquiv w).1 + · exact complement_statistic (orderedEquiv w).2 + +theorem two_fixedWeight_multiplicity (a : ℕ) (s : Fin 6) (hs : statisticWeight s = a) : + Fintype.card {w : Alphabet 2 a // twoStatistic w.val = s} = + AllFieldParameters.multiplicity s := by + rw [ExactStatisticWords.card_fixedWeight_fiber twoStatistic CWStrands.weight + statisticWeight two_weight a s hs, two_multiplicity] + +theorem four_fixedWeight_multiplicity (a : ℕ) (s : Fin 6 × Fin 6) + (hs : statisticWeight s.1 + statisticWeight s.2 = a) : + Fintype.card {w : Alphabet 4 a // fourStatistic w.val = s} = + AllFieldParameters.multiplicity s.1 * AllFieldParameters.multiplicity s.2 := by + rw [ExactStatisticWords.card_fixedWeight_fiber fourStatistic CWStrands.weight + (fun s => statisticWeight s.1 + statisticWeight s.2) four_weight a s hs, + four_multiplicity] + +end MatrixMultiplication.CWCompleteStatistics + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/CoppersmithWinograd/CWLeafRestrictions.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/CoppersmithWinograd/CWLeafRestrictions.lean new file mode 100644 index 0000000000000000000000000000000000000000..0976967c90d5765274ef0a350feace1e45fda45f --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/CoppersmithWinograd/CWLeafRestrictions.lean @@ -0,0 +1,126 @@ +import OAI.LinearAlgebra.MatrixMultiplication.CoppersmithWinograd.FieldCW +import OAI.LinearAlgebra.MatrixMultiplication.Tensor.LeafVolumes + +namespace OAI + +/-! Coppersmith–Winograd tensors, tensor powers and local restrictions. -/ + +namespace MatrixMultiplication.CWLeafRestrictions + +open MatrixMultiplication.Foundation + +def lastLabel (q : ℕ) : Fin (q + 2) := ⟨q + 1, by omega⟩ + +def complement (q : ℕ) : Fin (q + 2) ≃ Fin (q + 2) := + Equiv.swap 0 (lastLabel q) + +@[simp] theorem complement_zero (q : ℕ) : complement q 0 = lastLabel q := by + simp [complement] + +@[simp] theorem complement_last (q : ℕ) : complement q (lastLabel q) = 0 := by + simp [complement] + +@[simp] theorem complement_involution (q : ℕ) (x : Fin (q + 2)) : + complement q (complement q x) = x := by + simp [complement] + +theorem complement_interior (q : ℕ) (x : Fin (q + 2)) + (hx0 : x.val ≠ 0) (hxlast : x.val ≠ q + 1) : complement q x = x := by + apply Equiv.swap_apply_of_ne_of_ne + · intro h + exact hx0 (congrArg Fin.val h) + · intro h + exact hxlast (congrArg Fin.val h) + +theorem zero_support_iff (q : ℕ) (y z : Fin (q + 2)) : + ((y.val = 0 ∧ z.val = q + 1) ∨ + (y.val = q + 1 ∧ z.val = 0) ∨ + (1 ≤ y.val ∧ y.val ≤ q ∧ y = z)) ↔ complement q y = z := by + by_cases hy0 : y.val = 0 + · have hy : y = 0 := Fin.ext hy0 + subst y + rw [complement_zero] + constructor + · rintro (⟨_, hz⟩ | ⟨hy, _⟩ | ⟨hy, _⟩) + · exact Fin.ext hz.symm + · have : (0 : ℕ) = q + 1 := hy + omega + · have : 1 ≤ (0 : ℕ) := hy + omega + · intro h + exact Or.inl ⟨rfl, (congrArg Fin.val h).symm⟩ + · by_cases hylast : y.val = q + 1 + · have hy : y = lastLabel q := Fin.ext hylast + subst y + rw [complement_last] + constructor + · rintro (⟨hy, _⟩ | ⟨_, hz⟩ | ⟨_, hy, _⟩) + · have : q + 1 = 0 := hy + omega + · exact Fin.ext hz.symm + · have : q + 1 ≤ q := hy + omega + · intro h + exact Or.inr (Or.inl ⟨rfl, (congrArg Fin.val h).symm⟩) + · have hlo : 1 ≤ y.val := by omega + have hhi : y.val ≤ q := by have := y.isLt; omega + rw [complement_interior q y hy0 hylast] + simp [hy0, hylast, hlo, hhi] + +theorem tensor_zero_matching (F : Type*) [CommRing F] (q : ℕ) + (y z : Fin (q + 2)) : + FieldCW.tensor F q 0 y (complement q z) = if y = z then 1 else 0 := by + rw [FieldCW.tensor_zero_side F q 0 y (complement q z) rfl] + simp only [zero_support_iff, Equiv.apply_eq_iff_eq] + +theorem tensor_middle_zero_matching (F : Type*) [CommRing F] (q : ℕ) + (x z : Fin (q + 2)) : + FieldCW.tensor F q x 0 (complement q z) = if x = z then 1 else 0 := by + rw [FieldCW.tensor_cyclic F q x 0 (complement q z)] + have h := tensor_zero_matching F q (complement q z) (complement q x) + simpa only [complement_involution, Equiv.apply_eq_iff_eq, eq_comm] using h + +theorem tensor_last_zero_matching (F : Type*) [CommRing F] (q : ℕ) + (x y : Fin (q + 2)) : + FieldCW.tensor F q x (complement q y) 0 = if x = y then 1 else 0 := by + rw [FieldCW.tensor_cyclic F q x (complement q y) 0, + FieldCW.tensor_cyclic F q (complement q y) 0 x] + exact tensor_zero_matching F q x y + +theorem zeroX_leaf (F : Type*) [CommRing F] (q n : ℕ) + (p : (Fin n → Fin (q + 2)) → Prop) [DecidablePred p] : + Tensor.pullback (fun _ : Unit × Unit => fun _ : Fin n => (0 : Fin (q + 2))) + (fun y : Unit × {w // p w} => y.2.val) + (fun z : {w // p w} × Unit => fun i => complement q (z.1.val i)) + (Tensor.power (FieldCW.tensor F q) n) = + Tensor.matrixCoefficients Unit Unit {w // p w} := + LeafVolumes.matchingPower_matrixCoefficients (FieldCW.tensor F q) 0 + (complement q) (tensor_zero_matching F q) n p + +theorem zeroY_leaf (F : Type*) [CommRing F] (q n : ℕ) + (p : (Fin n → Fin (q + 2)) → Prop) [DecidablePred p] : + Tensor.pullback (fun x : {w // p w} × Unit => x.1.val) + (fun _ : Unit × Unit => fun _ : Fin n => (0 : Fin (q + 2))) + (fun z : Unit × {w // p w} => fun i => complement q (z.2.val i)) + (Tensor.power (FieldCW.tensor F q) n) = + Tensor.matrixCoefficients {w // p w} Unit Unit := by + funext x y z + simp only [Tensor.pullback, Tensor.power, tensor_middle_zero_matching, + Fintype.prod_boole, ← funext_iff, Tensor.matrixCoefficients] + simp [Subtype.ext_iff, eq_comm] + +theorem zeroZ_leaf (F : Type*) [CommRing F] (q n : ℕ) + (p : (Fin n → Fin (q + 2)) → Prop) [DecidablePred p] : + Tensor.pullback (fun x : Unit × {w // p w} => x.2.val) + (fun y : {w // p w} × Unit => fun i => complement q (y.1.val i)) + (fun _ : Unit × Unit => fun _ : Fin n => (0 : Fin (q + 2))) + (Tensor.power (FieldCW.tensor F q) n) = + Tensor.matrixCoefficients Unit {w // p w} Unit := by + funext x y z + simp only [Tensor.pullback, Tensor.power, tensor_last_zero_matching, + Fintype.prod_boole, ← funext_iff, Tensor.matrixCoefficients] + simp [Subtype.ext_iff] + +end MatrixMultiplication.CWLeafRestrictions + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/CoppersmithWinograd/CWLeafStatistics.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/CoppersmithWinograd/CWLeafStatistics.lean new file mode 100644 index 0000000000000000000000000000000000000000..7f4abed7ccd8fa21b9803153fd406cf24fe428fe --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/CoppersmithWinograd/CWLeafStatistics.lean @@ -0,0 +1,56 @@ +import OAI.LinearAlgebra.MatrixMultiplication.CoppersmithWinograd.CWLeafRestrictions +import OAI.LinearAlgebra.MatrixMultiplication.FieldParameters.Basic + +namespace OAI + +/-! Coppersmith–Winograd tensors, tensor powers and local restrictions. -/ + +namespace MatrixMultiplication.CWLeafStatistics + +open MatrixMultiplication.Foundation + +def weight (x : Fin 7) : ℕ := if x.val = 0 then 0 else if x.val = 6 then 2 else 1 + +def pairStatistic (x : Fin 7 × Fin 7) : Fin 6 := + if weight x.1 + weight x.2 = 0 then 0 + else if weight x.1 + weight x.2 = 1 then 1 + else if weight x.1 + weight x.2 = 2 then + if weight x.1 = 1 ∧ weight x.2 = 1 then 2 else 3 + else if weight x.1 + weight x.2 = 3 then 4 else 5 + +theorem statistic_weight : ∀ x : Fin 7 × Fin 7, + AllFieldParameters.statisticWeight (pairStatistic x) = weight x.1 + weight x.2 := by + decide +kernel + +theorem pair_multiplicity : ∀ i : Fin 6, + Fintype.card {x : Fin 7 × Fin 7 // pairStatistic x = i} = + AllFieldParameters.multiplicity i := by + decide +kernel + +theorem complement_weight : ∀ x : Fin 7, + weight (CWLeafRestrictions.complement 5 x) + weight x = 2 := by + decide +kernel + +theorem complement_statistic : ∀ x : Fin 7 × Fin 7, + pairStatistic (CWLeafRestrictions.complement 5 x.1, + CWLeafRestrictions.complement 5 x.2) = + AllFieldParameters.kappa (pairStatistic x) := by + decide +kernel + +theorem ordered_pair_multiplicity (i j : Fin 6) : + Fintype.card {x : (Fin 7 × Fin 7) × (Fin 7 × Fin 7) // + pairStatistic x.1 = i ∧ pairStatistic x.2 = j} = + AllFieldParameters.multiplicity i * AllFieldParameters.multiplicity j := by + let e : {x : (Fin 7 × Fin 7) × (Fin 7 × Fin 7) // + pairStatistic x.1 = i ∧ pairStatistic x.2 = j} ≃ + {x : Fin 7 × Fin 7 // pairStatistic x = i} × + {x : Fin 7 × Fin 7 // pairStatistic x = j} := + { toFun := fun x => (⟨x.val.1, x.property.1⟩, ⟨x.val.2, x.property.2⟩) + invFun := fun x => ⟨(x.1.val, x.2.val), x.1.property, x.2.property⟩ + left_inv := by intro x; rfl + right_inv := by intro x; rfl } + rw [Fintype.card_congr e, Fintype.card_prod, pair_multiplicity, pair_multiplicity] + +end MatrixMultiplication.CWLeafStatistics + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/CoppersmithWinograd/CWOrientedZero.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/CoppersmithWinograd/CWOrientedZero.lean new file mode 100644 index 0000000000000000000000000000000000000000..01e6cd2ac5d6ff83b57f7c3d244a9a6de97ab14e --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/CoppersmithWinograd/CWOrientedZero.lean @@ -0,0 +1,204 @@ +import OAI.LinearAlgebra.MatrixMultiplication.CoppersmithWinograd.CWWindowedLeaves +import OAI.LinearAlgebra.MatrixMultiplication.FieldConstruction.FiniteFamily + +namespace OAI + +/-! Coppersmith–Winograd tensors, tensor powers and local restrictions. -/ + +noncomputable section +namespace MatrixMultiplication.CWOrientedZero +open MatrixMultiplication.Foundation CWWindowedLeaves CWStrands AllFieldFiniteFamily +open scoped BigOperators +attribute [local instance] Classical.propDecidable + +variable (F : Type*) [Field F] + +private theorem tensor_swapXY (x y z : Fin 7) : + FieldCW.tensor F 5 x y z = FieldCW.tensor F 5 y x z := by + unfold FieldCW.tensor + simp only [Finset.sum_add_distrib, mul_comm, mul_left_comm, mul_assoc] + ring + +private theorem tensor_swapYZ (x y z : Fin 7) : + FieldCW.tensor F 5 x y z = FieldCW.tensor F 5 x z y := by + exact (FieldCW.tensor_cyclic F 5 x y z).trans + ((tensor_swapXY F y z x).trans (FieldCW.tensor_cyclic F 5 x z y).symm) + +private theorem tensor_swapXZ (x y z : Fin 7) : + FieldCW.tensor F 5 x y z = FieldCW.tensor F 5 z y x := by + exact (FieldCW.tensor_cyclic F 5 x y z).trans (tensor_swapXY F y z x) + +private theorem shape_swapXY (n a b c : ℕ) (x y z : Raw n) : + shapeTensor (F := F) (Fin n) ![a,b,c] x y z = + shapeTensor (F := F) (Fin n) ![b,a,c] y x z := by + have hp : strand (F := F) (Fin n) x y z = strand (F := F) (Fin n) y x z := by + apply Finset.prod_congr rfl + intro i _ + exact tensor_swapXY F _ _ _ + simp only [shapeTensor, Matrix.cons_val_zero, Matrix.cons_val_one, + Matrix.cons_val, hp] + congr 1 + apply propext + tauto + +private theorem shape_swapYZ (n a b c : ℕ) (x y z : Raw n) : + shapeTensor (F := F) (Fin n) ![a,b,c] x y z = + shapeTensor (F := F) (Fin n) ![a,c,b] x z y := by + have hp : strand (F := F) (Fin n) x y z = strand (F := F) (Fin n) x z y := by + apply Finset.prod_congr rfl + intro i _ + exact tensor_swapYZ F _ _ _ + simp only [shapeTensor, Matrix.cons_val_zero, Matrix.cons_val_one, + Matrix.cons_val, hp] + congr 1 + apply propext + tauto + +private theorem shape_swapXZ (n a b c : ℕ) (x y z : Raw n) : + shapeTensor (F := F) (Fin n) ![a,b,c] x y z = + shapeTensor (F := F) (Fin n) ![c,b,a] z y x := by + rw [shape_swapXY, shape_swapYZ, shape_swapXY] + +def placedShape (zero selected : Fin 3) (a b : ℕ) : Fin 3 → ℕ := + fun s => if s = zero then 0 else if s = selected then a else b + +def sideWord (zero selected : Fin 3) {n a : ℕ} (side : Fin 3) + (w : Alphabet n a) : Raw n := + if side = zero then zeroWord n else if side = selected then w.val else complementWord w.val + +def matched (zero : Fin 3) {E : Type*} (x y z : E) : Prop := + if zero = 0 then y = z else if zero = 1 then x = z else x = y + +theorem local_coefficient (n a b : ℕ) (hab : a + b = 2*n) + (zero selected : Fin 3) (hne : zero ≠ selected) (x y z : Alphabet n a) : + shapeTensor (F := F) (Fin n) (placedShape zero selected a b) + (sideWord zero selected 0 x) (sideWord zero selected 1 y) + (sideWord zero selected 2 z) = if matched zero x y z then 1 else 0 := by + fin_cases zero <;> fin_cases selected + all_goals try contradiction + · simp [shapeTensor, placedShape, sideWord, matched] + exact zeroX_local F n a b hab y z + · have hh := (shape_swapYZ F n 0 b a (zeroWord n) (complementWord y.val) z.val).trans + (zeroX_local F n a b hab z y) + have he : (z = y) ↔ (y = z) := eq_comm + simp only [he] at hh + simp [shapeTensor, placedShape, sideWord, matched] + exact hh + · simp [shapeTensor, placedShape, sideWord, matched] + exact zeroY_local F n a b hab x z + · have hh := (shape_swapXZ F n b 0 a (complementWord x.val) (zeroWord n) z.val).trans + (zeroY_local F n a b hab z x) + have he : (z = x) ↔ (x = z) := eq_comm + simp only [he] at hh + simp [shapeTensor, placedShape, sideWord, matched] + exact hh + · simp [shapeTensor, placedShape, sideWord, matched] + exact zeroZ_local F n a b hab x y + · have hh := (shape_swapXY F n b a 0 (complementWord x.val) y.val (zeroWord n)).trans + (zeroZ_local F n a b hab y x) + have he : (y = x) ↔ (x = y) := eq_comm + simp only [he] at hh + simp [shapeTensor, placedShape, sideWord, matched] + exact hh + +def Row (zero : Fin 3) (E : Type) : Type := if zero = 1 then E else Unit +def Middle (zero : Fin 3) (E : Type) : Type := if zero = 2 then E else Unit +def Column (zero : Fin 3) (E : Type) : Type := if zero = 0 then E else Unit +instance (zero : Fin 3) (E : Type) [Fintype E] : Fintype (Row zero E) := by + unfold Row; split_ifs <;> infer_instance +instance (zero : Fin 3) (E : Type) [Fintype E] : Fintype (Middle zero E) := by + unfold Middle; split_ifs <;> infer_instance +instance (zero : Fin 3) (E : Type) [Fintype E] : Fintype (Column zero E) := by + unfold Column; split_ifs <;> infer_instance + +theorem volume (zero : Fin 3) (E : Type) [Fintype E] : + Fintype.card (Row zero E) * Fintype.card (Middle zero E) * + Fintype.card (Column zero E) = Fintype.card E := by + have hunit (inst : Fintype Unit) : @Fintype.card Unit inst = 1 := + @Fintype.card_unique Unit (uniqueOfSubsingleton ()) inst + fin_cases zero + · have hr := Fintype.card_congr' (show Row (0 : Fin 3) E = Unit by simp [Row]) + have hm := Fintype.card_congr' (show Middle (0 : Fin 3) E = Unit by simp [Middle]) + have hc := Fintype.card_congr' (show Column (0 : Fin 3) E = E by simp [Column]) + exact (congrArg₂ Nat.mul + (congrArg₂ Nat.mul (hr.trans (hunit _)) (hm.trans (hunit _))) hc).trans + (Nat.one_mul (Fintype.card E)) + · have hr := Fintype.card_congr' (show Row (1 : Fin 3) E = E by simp [Row]) + have hm := Fintype.card_congr' (show Middle (1 : Fin 3) E = Unit by simp [Middle]) + have hc := Fintype.card_congr' (show Column (1 : Fin 3) E = Unit by simp [Column]) + exact (congrArg₂ Nat.mul + (congrArg₂ Nat.mul hr (hm.trans (hunit _))) (hc.trans (hunit _))).trans + ((Nat.mul_one (Nat.mul (Fintype.card E) 1)).trans (Nat.mul_one (Fintype.card E))) + · have hr := Fintype.card_congr' (show Row (2 : Fin 3) E = Unit by simp [Row]) + have hm := Fintype.card_congr' (show Middle (2 : Fin 3) E = E by simp [Middle]) + have hc := Fintype.card_congr' (show Column (2 : Fin 3) E = Unit by simp [Column]) + exact (congrArg₂ Nat.mul + (congrArg₂ Nat.mul (hr.trans (hunit _)) hm) (hc.trans (hunit _))).trans + ((Nat.mul_one (Nat.mul 1 (Fintype.card E))).trans (Nat.one_mul (Fintype.card E))) + +theorem matching_nonempty {V E : Type} [Fintype V] [Fintype E] [Nonempty E] + (Q : Tensor F V V V) (zero : Fin 3) (embed : Fin 3 → E → V) + (h : ∀ x y z, Q (embed 0 x) (embed 1 y) (embed 2 z) = + if matched zero x y z then 1 else 0) : + Nonempty (LocalMap Q (Tensor.matrixCoefficients (Row zero E) (Middle zero E) (Column zero E))) := by + let e : E := Classical.choice inferInstance + fin_cases zero + · refine ⟨LocalMap.ofExists ⟨(fun _ v => if v = embed 0 e then 1 else 0), + (fun y v => if v = embed 1 y.2 then 1 else 0), + (fun z v => if v = embed 2 z.1 then 1 else 0), ?_⟩⟩ + rw [← Tensor.pullback_eq_restrict] + funext x y z + let sm0 : Subsingleton (Middle (0 : Fin 3) E) := by simp only [Middle, show (0 : Fin 3) ≠ 2 from by decide, ite_false]; infer_instance + let sr0 : Subsingleton (Row (0 : Fin 3) E) := by simp only [Row, show (0 : Fin 3) ≠ 1 from by decide, ite_false]; infer_instance + have hu1 : x.2 = y.1 := @Subsingleton.elim _ sm0 _ _ + have hu2 : z.2 = x.1 := @Subsingleton.elim _ sr0 _ _ + simpa [Tensor.pullback, Tensor.matrixCoefficients, matched, Row, Middle, Column, hu1, hu2] using + h e y.2 z.1 + · refine ⟨LocalMap.ofExists ⟨(fun x v => if v = embed 0 x.1 then 1 else 0), + (fun _ v => if v = embed 1 e then 1 else 0), + (fun z v => if v = embed 2 z.2 then 1 else 0), ?_⟩⟩ + rw [← Tensor.pullback_eq_restrict] + funext x y z + let sm1 : Subsingleton (Middle (1 : Fin 3) E) := by simp only [Middle, show (1 : Fin 3) ≠ 2 from by decide, ite_false]; infer_instance + let sc1 : Subsingleton (Column (1 : Fin 3) E) := by simp only [Column, show (1 : Fin 3) ≠ 0 from by decide, ite_false]; infer_instance + have hu1 : x.2 = y.1 := @Subsingleton.elim _ sm1 _ _ + have hu2 : y.2 = z.1 := @Subsingleton.elim _ sc1 _ _ + simpa [Tensor.pullback, Tensor.matrixCoefficients, matched, Row, Middle, Column, + hu1, hu2, eq_comm] using + h x.1 e z.2 + · refine ⟨LocalMap.ofExists ⟨(fun x v => if v = embed 0 x.2 then 1 else 0), + (fun y v => if v = embed 1 y.1 then 1 else 0), + (fun _ v => if v = embed 2 e then 1 else 0), ?_⟩⟩ + rw [← Tensor.pullback_eq_restrict] + funext x y z + let sc2 : Subsingleton (Column (2 : Fin 3) E) := by simp only [Column, show (2 : Fin 3) ≠ 0 from by decide, ite_false]; infer_instance + let sr2 : Subsingleton (Row (2 : Fin 3) E) := by simp only [Row, show (2 : Fin 3) ≠ 1 from by decide, ite_false]; infer_instance + have hu1 : y.2 = z.1 := @Subsingleton.elim _ sc2 _ _ + have hu2 : z.2 = x.1 := @Subsingleton.elim _ sr2 _ _ + simpa [Tensor.pullback, Tensor.matrixCoefficients, matched, Row, Middle, Column, hu1, hu2] using + h x.2 y.1 e + +def ofMatching {V E : Type} [Fintype V] [Fintype E] [Nonempty E] + (Q : Tensor F V V V) (zero : Fin 3) (embed : Fin 3 → E → V) + (h : ∀ x y z, Q (embed 0 x) (embed 1 y) (embed 2 z) = + if matched zero x y z then 1 else 0) : + LocalMap Q (Tensor.matrixCoefficients (Row zero E) (Middle zero E) (Column zero E)) := + Classical.choice (matching_nonempty F Q zero embed h) + +theorem power_coefficient {E : Type} (n a b m : ℕ) (hab : a+b=2*n) + (zero selected : Fin 3) (hne : zero ≠ selected) + (words : E → Fin m → Alphabet n a) (hinj : Function.Injective words) + (x y z : E) : + Tensor.power (shapeTensor (F := F) (Fin n) (placedShape zero selected a b)) m + (fun i => sideWord zero selected 0 (words x i)) + (fun i => sideWord zero selected 1 (words y i)) + (fun i => sideWord zero selected 2 (words z i)) = + if matched zero x y z then 1 else 0 := by + simp only [Tensor.power, local_coefficient F n a b hab zero selected hne] + fin_cases zero <;> simp [matched, Fintype.prod_boole, ← funext_iff, hinj.eq_iff] + +end MatrixMultiplication.CWOrientedZero + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/CoppersmithWinograd/CWShapeLeaves.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/CoppersmithWinograd/CWShapeLeaves.lean new file mode 100644 index 0000000000000000000000000000000000000000..8e8aacf571ce2352fc03dbef87ad33ae7a2d461f --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/CoppersmithWinograd/CWShapeLeaves.lean @@ -0,0 +1,90 @@ +import OAI.LinearAlgebra.MatrixMultiplication.CoppersmithWinograd.CWStrands + +namespace OAI + +/-! Coppersmith–Winograd tensors, tensor powers and local restrictions. -/ + +noncomputable section + +namespace MatrixMultiplication.CWShapeLeaves + +open MatrixMultiplication.Foundation CWStrands CWLeafRestrictions +open scoped BigOperators + +theorem complement_word_weight {P : Type*} [Fintype P] (w : P → Fin 7) : + weight (fun i => complement 5 (w i)) + weight w = 2 * Fintype.card P := by + calc + weight (fun i => complement 5 (w i)) + weight w = + ∑ i, (CWLeafStatistics.weight (complement 5 (w i)) + CWLeafStatistics.weight (w i)) := by + simp [weight, Finset.sum_add_distrib] + _ = ∑ _i : P, 2 := Finset.sum_congr rfl (fun i _ => CWLeafStatistics.complement_weight (w i)) + _ = 2 * Fintype.card P := by simp [Nat.mul_comm] + +theorem zeroX_shape_leaf (F : Type*) [CommRing F] (n a b : ℕ) + (hab : a + b = 2 * n) + (p : (Fin n → Fin 7) → Prop) [DecidablePred p] + (hp : ∀ w, p w → weight w = a) : + Tensor.pullback (fun _ : Unit × Unit => fun _ : Fin n => (0 : Fin 7)) + (fun y : Unit × {w // p w} => y.2.val) + (fun z : {w // p w} × Unit => fun i => complement 5 (z.1.val i)) + (shapeTensor (F := F) (Fin n) ![0, a, b]) = + Tensor.matrixCoefficients Unit Unit {w // p w} := by + funext x y z + have hy : weight y.2.val = a := hp _ y.2.property + have hz : weight (fun i => complement 5 (z.1.val i)) = b := by + have hw := complement_word_weight z.1.val + have hzw : weight z.1.val = a := hp _ z.1.property + simp only [Fintype.card_fin] at hw + omega + have hzero : weight (fun _ : Fin n => (0 : Fin 7)) = 0 := by + simp [weight, CWLeafStatistics.weight] + have hleaf := congrFun (congrFun (congrFun (zeroX_leaf F 5 n p) x) y) z + simpa [Tensor.pullback, shapeTensor, hzero, hy, hz, strand, Tensor.power] using hleaf + +theorem zeroY_shape_leaf (F : Type*) [CommRing F] (n a b : ℕ) + (hab : a + b = 2 * n) + (p : (Fin n → Fin 7) → Prop) [DecidablePred p] + (hp : ∀ w, p w → weight w = a) : + Tensor.pullback (fun x : {w // p w} × Unit => x.1.val) + (fun _ : Unit × Unit => fun _ : Fin n => (0 : Fin 7)) + (fun z : Unit × {w // p w} => fun i => complement 5 (z.2.val i)) + (shapeTensor (F := F) (Fin n) ![a, 0, b]) = + Tensor.matrixCoefficients {w // p w} Unit Unit := by + funext x y z + have hx : weight x.1.val = a := hp _ x.1.property + have hz : weight (fun i => complement 5 (z.2.val i)) = b := by + have hw := complement_word_weight z.2.val + have hzw : weight z.2.val = a := hp _ z.2.property + simp only [Fintype.card_fin] at hw + omega + have hzero : weight (fun _ : Fin n => (0 : Fin 7)) = 0 := by + simp [weight, CWLeafStatistics.weight] + have hleaf := congrFun (congrFun (congrFun (zeroY_leaf F 5 n p) x) y) z + simpa [Tensor.pullback, shapeTensor, hzero, hx, hz, strand, Tensor.power] using hleaf + +theorem zeroZ_shape_leaf (F : Type*) [CommRing F] (n a b : ℕ) + (hab : a + b = 2 * n) + (p : (Fin n → Fin 7) → Prop) [DecidablePred p] + (hp : ∀ w, p w → weight w = a) : + Tensor.pullback (fun x : Unit × {w // p w} => x.2.val) + (fun y : {w // p w} × Unit => fun i => complement 5 (y.1.val i)) + (fun _ : Unit × Unit => fun _ : Fin n => (0 : Fin 7)) + (shapeTensor (F := F) (Fin n) ![a, b, 0]) = + Tensor.matrixCoefficients Unit {w // p w} Unit := by + funext x y z + have hx : weight x.2.val = a := hp _ x.2.property + have hy : weight (fun i => complement 5 (y.1.val i)) = b := by + have hw := complement_word_weight y.1.val + have hyw : weight y.1.val = a := hp _ y.1.property + simp only [Fintype.card_fin] at hw + omega + have hzero : weight (fun _ : Fin n => (0 : Fin 7)) = 0 := by + simp [weight, CWLeafStatistics.weight] + have hleaf := congrFun (congrFun (congrFun (zeroZ_leaf F 5 n p) x) y) z + simpa [Tensor.pullback, shapeTensor, hzero, hx, hy, strand, Tensor.power] using hleaf + +end MatrixMultiplication.CWShapeLeaves + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/CoppersmithWinograd/CWShapePhysicalPermutation.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/CoppersmithWinograd/CWShapePhysicalPermutation.lean new file mode 100644 index 0000000000000000000000000000000000000000..702450b1a2045370f0288efd42af3d9b4f9b3db2 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/CoppersmithWinograd/CWShapePhysicalPermutation.lean @@ -0,0 +1,115 @@ +import OAI.LinearAlgebra.MatrixMultiplication.CoppersmithWinograd.CWStrands +import OAI.LinearAlgebra.MatrixMultiplication.Tensor.TensorSidePermutation + +namespace OAI + +/-! Coppersmith–Winograd tensors, tensor powers and local restrictions. -/ + +noncomputable section + +namespace MatrixMultiplication.CWShapePhysicalPermutation + +open MatrixMultiplication.Foundation CWStrands +open scoped BigOperators + +variable {F : Type*} [CommRing F] + +private theorem tensor_swapXY (q : ℕ) (x y z : Fin (q + 2)) : + FieldCW.tensor F q x y z = FieldCW.tensor F q y x z := by + unfold FieldCW.tensor + simp only [Finset.sum_add_distrib, mul_comm, mul_left_comm, mul_assoc] + ring + +private theorem tensor_swapYZ (q : ℕ) (x y z : Fin (q + 2)) : + FieldCW.tensor F q x y z = FieldCW.tensor F q x z y := by + exact (FieldCW.tensor_cyclic F q x y z).trans + ((tensor_swapXY q y z x).trans (FieldCW.tensor_cyclic F q x z y).symm) + +private theorem tensor_swapXZ (q : ℕ) (x y z : Fin (q + 2)) : + FieldCW.tensor F q x y z = FieldCW.tensor F q z y x := by + exact (FieldCW.tensor_cyclic F q x y z).trans (tensor_swapXY q y z x) + +theorem tensor_permute (q : ℕ) (σ : Equiv.Perm (Fin 3)) + (a : Fin 3 → Fin (q + 2)) : + FieldCW.tensor F q (a (σ 0)) (a (σ 1)) (a (σ 2)) = + FieldCW.tensor F q (a 0) (a 1) (a 2) := by + have h01 : σ 0 ≠ σ 1 := fun h => (by decide : (0 : Fin 3) ≠ 1) (σ.injective h) + have h02 : σ 0 ≠ σ 2 := fun h => (by decide : (0 : Fin 3) ≠ 2) (σ.injective h) + have h12 : σ 1 ≠ σ 2 := fun h => (by decide : (1 : Fin 3) ≠ 2) (σ.injective h) + generalize hs0 : σ 0 = s0 at * + generalize hs1 : σ 1 = s1 at * + generalize hs2 : σ 2 = s2 at * + fin_cases s0 <;> fin_cases s1 <;> fin_cases s2 <;> try contradiction + · rfl + · exact (tensor_swapYZ q (a 0) (a 1) (a 2)).symm + · exact (tensor_swapXY q (a 0) (a 1) (a 2)).symm + · exact (FieldCW.tensor_cyclic F q (a 0) (a 1) (a 2)).symm + · exact FieldCW.tensor_cyclic F q (a 2) (a 0) (a 1) + · exact (tensor_swapXZ q (a 0) (a 1) (a 2)).symm + +theorem strand_permute {P : Type*} [Fintype P] + (σ : Equiv.Perm (Fin 3)) (a : Fin 3 → P → Fin 7) : + strand (F := F) P (a (σ 0)) (a (σ 1)) (a (σ 2)) = + strand P (a 0) (a 1) (a 2) := by + apply Finset.prod_congr rfl + intro i _ + exact tensor_permute 5 σ (fun s => a s i) + +theorem shapeTensor_permute {P : Type*} [Fintype P] + (σ : Equiv.Perm (Fin 3)) (g : Fin 3 → ℕ) (a : Fin 3 → P → Fin 7) : + shapeTensor (F := F) P (g ∘ σ) (a (σ 0)) (a (σ 1)) (a (σ 2)) = + shapeTensor P g (a 0) (a 1) (a 2) := by + have hmask : + (weight (a (σ 0)) = g (σ 0) ∧ weight (a (σ 1)) = g (σ 1) ∧ + weight (a (σ 2)) = g (σ 2)) ↔ + (weight (a 0) = g 0 ∧ weight (a 1) = g 1 ∧ weight (a 2) = g 2) := by + constructor + · rintro ⟨h0, h1, h2⟩ + have hs (s : Fin 3) : weight (a (σ s)) = g (σ s) := by + fin_cases s <;> assumption + exact ⟨by simpa using hs (σ.symm 0), by simpa using hs (σ.symm 1), + by simpa using hs (σ.symm 2)⟩ + · rintro ⟨h0, h1, h2⟩ + have hs (s : Fin 3) : weight (a s) = g s := by + fin_cases s <;> assumption + exact ⟨hs (σ 0), hs (σ 1), hs (σ 2)⟩ + have hp := strand_permute (F := F) σ a + simp only [shapeTensor, Function.comp_apply, hmask, hp] + +theorem shapeTensor_prod_permute {I : Type*} [Fintype I] + (P : I → Type*) [∀ i, Fintype (P i)] + (σ : I → Equiv.Perm (Fin 3)) (g : I → Fin 3 → ℕ) + (a : ∀ i, Fin 3 → P i → Fin 7) : + (∏ i, shapeTensor (F := F) (P i) (g i ∘ σ i) + (a i (σ i 0)) (a i (σ i 1)) (a i (σ i 2))) = + ∏ i, shapeTensor (P i) (g i) (a i 0) (a i 1) (a i 2) := by + apply Finset.prod_congr rfl + intro i _ + exact shapeTensor_permute (σ i) (g i) (a i) + +theorem shapeTensor_prod_permute_ne_zero_iff {I : Type*} [Fintype I] + (P : I → Type*) [∀ i, Fintype (P i)] + (σ : I → Equiv.Perm (Fin 3)) (g : I → Fin 3 → ℕ) + (a : ∀ i, Fin 3 → P i → Fin 7) : + (∏ i, shapeTensor (F := F) (P i) (g i ∘ σ i) + (a i (σ i 0)) (a i (σ i 1)) (a i (σ i 2))) ≠ 0 ↔ + (∏ i, shapeTensor (F := F) (P i) (g i) (a i 0) (a i 1) (a i 2)) ≠ 0 := by + rw [shapeTensor_prod_permute] + +theorem sidePermutation_shapeTensor {P : Type*} [Fintype P] + (σ : Equiv.Perm (Fin 3)) (g : Fin 3 → ℕ) : + Tensor.sidePermutation σ (shapeTensor (F := F) P g) = + shapeTensor P (g ∘ σ) := by + funext x y z + let a : Fin 3 → P → Fin 7 := ![x, y, z] + change Tensor.sidePermutation σ (shapeTensor P g) (a 0) (a 1) (a 2) = + shapeTensor P (g ∘ σ) (a 0) (a 1) (a 2) + rw [Tensor.sidePermutation_apply_coordinates] + have h := shapeTensor_permute (F := F) σ g (fun s => a (σ.symm s)) + simpa only [Equiv.symm_apply_apply] using h.symm + +end MatrixMultiplication.CWShapePhysicalPermutation + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/CoppersmithWinograd/CWStageC.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/CoppersmithWinograd/CWStageC.lean new file mode 100644 index 0000000000000000000000000000000000000000..a0c0d21d983f7709e52f597345fb49d639ee64db --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/CoppersmithWinograd/CWStageC.lean @@ -0,0 +1,106 @@ +import OAI.LinearAlgebra.MatrixMultiplication.CoppersmithWinograd.CWStrands + +namespace OAI + +/-! Coppersmith–Winograd tensors, tensor powers and local restrictions. -/ + +noncomputable section + +namespace MatrixMultiplication.CWStageC + +open MatrixMultiplication.Foundation CWStrands CWLeafRestrictions + +def interior (i : Fin 5) : Fin 7 := ⟨i.val + 1, by have := i.isLt; omega⟩ + +theorem interior_injective : Function.Injective interior := by + intro i j h + apply Fin.ext + have hval := congrArg Fin.val h + simpa only [interior, Nat.add_right_cancel_iff] using hval + +@[simp] theorem interior_weight (i : Fin 5) : CWLeafStatistics.weight (interior i) = 1 := by + have hi : i.val + 1 ≠ 6 := by have := i.isLt; omega + simp [CWLeafStatistics.weight, interior, hi] + +@[simp] theorem zero_weight : CWLeafStatistics.weight (0 : Fin 7) = 0 := rfl + +@[simp] theorem last_weight : CWLeafStatistics.weight (6 : Fin 7) = 2 := rfl + +@[simp] theorem interior_complement (i : Fin 5) : complement 5 (interior i) = interior i := by + apply complement_interior + · simp [interior] + · dsimp [interior] + have := i.isLt + omega + +variable (F : Type*) [CommRing F] + +theorem coefficient110 (i j : Fin 5) : + FieldCW.tensor F 5 (interior i) (interior j) 0 = if i = j then 1 else 0 := by + simpa only [interior_complement, interior_injective.eq_iff] using + tensor_last_zero_matching F 5 (interior i) (interior j) + +theorem coefficient101 (i j : Fin 5) : + FieldCW.tensor F 5 (interior i) 0 (interior j) = if i = j then 1 else 0 := by + simpa only [interior_complement, interior_injective.eq_iff] using + tensor_middle_zero_matching F 5 (interior i) (interior j) + +theorem coefficient011 (i j : Fin 5) : + FieldCW.tensor F 5 0 (interior i) (interior j) = if i = j then 1 else 0 := by + simpa only [interior_complement, interior_injective.eq_iff] using + tensor_zero_matching F 5 (interior i) (interior j) + +theorem coefficient002 : FieldCW.tensor F 5 0 0 6 = 1 := by + simpa [complement, lastLabel] using tensor_zero_matching F 5 0 0 + +theorem branch0 : + Tensor.pullback (fun x : Unit × Fin 5 => ![0, interior x.2]) + (fun y : Fin 5 × Unit => ![0, interior y.1]) + (fun _ : Unit × Unit => ![6, 0]) + (shapeTensor (F := F) (Fin 2) ![1, 1, 2]) = + Tensor.matrixCoefficients Unit (Fin 5) Unit := by + funext x y z + simp [Tensor.pullback, shapeTensor, weight, strand, Fin.sum_univ_succ, + Fin.prod_univ_succ, interior_weight, + coefficient002, coefficient110, Tensor.matrixCoefficients] + +theorem branch1 : + Tensor.pullback (fun x : Unit × Fin 5 => ![interior x.2, 0]) + (fun y : Fin 5 × Unit => ![interior y.1, 0]) + (fun _ : Unit × Unit => ![0, 6]) + (shapeTensor (F := F) (Fin 2) ![1, 1, 2]) = + Tensor.matrixCoefficients Unit (Fin 5) Unit := by + funext x y z + simp [Tensor.pullback, shapeTensor, weight, strand, Fin.sum_univ_succ, + Fin.prod_univ_succ, interior_weight, + coefficient002, coefficient110, Tensor.matrixCoefficients] + +theorem branch2 : + Tensor.pullback (fun x : Fin 5 × Unit => ![0, interior x.1]) + (fun y : Unit × Fin 5 => ![interior y.2, 0]) + (fun z : Fin 5 × Fin 5 => ![interior z.1, interior z.2]) + (shapeTensor (F := F) (Fin 2) ![1, 1, 2]) = + Tensor.matrixCoefficients (Fin 5) Unit (Fin 5) := by + funext x y z + simp [Tensor.pullback, shapeTensor, weight, strand, Fin.sum_univ_succ, + Fin.prod_univ_succ, interior_weight, + coefficient011, coefficient101, Tensor.matrixCoefficients] + all_goals (split_ifs <;> simp_all [eq_comm]) + +theorem branch3 : + Tensor.pullback (fun x : Fin 5 × Unit => ![interior x.1, 0]) + (fun y : Unit × Fin 5 => ![0, interior y.2]) + (fun z : Fin 5 × Fin 5 => ![interior z.2, interior z.1]) + (shapeTensor (F := F) (Fin 2) ![1, 1, 2]) = + Tensor.matrixCoefficients (Fin 5) Unit (Fin 5) := by + funext x y z + simp [Tensor.pullback, shapeTensor, weight, strand, Fin.sum_univ_succ, + Fin.prod_univ_succ, interior_weight, + coefficient011, coefficient101, Tensor.matrixCoefficients] + all_goals (split_ifs <;> simp_all [eq_comm]) + +end MatrixMultiplication.CWStageC + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/CoppersmithWinograd/CWStageCChildProducts.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/CoppersmithWinograd/CWStageCChildProducts.lean new file mode 100644 index 0000000000000000000000000000000000000000..d32b45eec6365e974578947e845a13fed77cd8f3 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/CoppersmithWinograd/CWStageCChildProducts.lean @@ -0,0 +1,242 @@ +import OAI.LinearAlgebra.MatrixMultiplication.CoppersmithWinograd.CWStageCPlacements + +namespace OAI + +/-! Coppersmith–Winograd tensors, tensor powers and local restrictions. -/ + +noncomputable section + +open scoped BigOperators +open MatrixMultiplication.Foundation + +namespace MatrixMultiplication.CWStageCProducts + +abbrev ChildPair := Fin 7 × Fin 7 + +def joinChildren (p : ChildPair) : Word := ![p.1, p.2] +def splitChildren (w : Word) : ChildPair := (w 0, w 1) + +@[simp] theorem joinChildren_zero (p : ChildPair) : joinChildren p 0 = p.1 := rfl +@[simp] theorem joinChildren_one (p : ChildPair) : joinChildren p 1 = p.2 := rfl + +@[simp] theorem join_split_children (w : Word) : joinChildren (splitChildren w) = w := by + funext i + fin_cases i <;> rfl + +def siteTensor (F : Type*) [CommRing F] (g : Fin 3 → ℕ) : + Tensor F (Fin 7) (Fin 7) (Fin 7) := + fun x y z => if CWLeafStatistics.weight x = g 0 ∧ + CWLeafStatistics.weight y = g 1 ∧ CWLeafStatistics.weight z = g 2 + then FieldCW.tensor F 5 x y z else 0 + +theorem siteTensor_support (F : Type*) [CommRing F] (g : Fin 3 → ℕ) + (x y z : Fin 7) (h : siteTensor F g x y z ≠ 0) : + CWLeafStatistics.weight x = g 0 ∧ CWLeafStatistics.weight y = g 1 ∧ + CWLeafStatistics.weight z = g 2 := by + by_contra hn + exact h (ite_eq_right hn) + +theorem siteProduct_side_weights (F : Type*) [CommRing F] (g h : Fin 3 → ℕ) + (x y z : ChildPair) + (hne : Tensor.product (siteTensor F g) (siteTensor F h) x y z ≠ 0) (i : Fin 3) : + CWLeafStatistics.weight ((![x, y, z] i).1) = g i ∧ + CWLeafStatistics.weight ((![x, y, z] i).2) = h i := by + change siteTensor F g x.1 y.1 z.1 * siteTensor F h x.2 y.2 z.2 ≠ 0 at hne + have hL : siteTensor F g x.1 y.1 z.1 ≠ 0 := by + intro he + exact hne (by simp [he]) + have hR : siteTensor F h x.2 y.2 z.2 ≠ 0 := by + intro he + exact hne (by simp [he]) + obtain ⟨hxL, hyL, hzL⟩ := siteTensor_support F g x.1 y.1 z.1 hL + obtain ⟨hxR, hyR, hzR⟩ := siteTensor_support F h x.2 y.2 z.2 hR + fin_cases i + · exact ⟨hxL, hxR⟩ + · exact ⟨hyL, hyR⟩ + · exact ⟨hzL, hzR⟩ + +theorem siteTensor_eq_shapeTensor (F : Type*) [CommRing F] (g : Fin 3 → ℕ) : + Tensor.pullback (fun (x : Fin 7) (_ : Fin 1) => x) + (fun (y : Fin 7) (_ : Fin 1) => y) (fun (z : Fin 7) (_ : Fin 1) => z) + (CWStrands.shapeTensor (F := F) (Fin 1) g) = siteTensor F g := by + funext x y z + simp [Tensor.pullback, CWStrands.shapeTensor, CWStrands.weight, CWStrands.strand, + siteTensor] + +def childProduct (F : Type*) [CommRing F] (s : Fin 3) (b : Fin 4) : + Tensor F ChildPair ChildPair ChildPair := + Tensor.product (siteTensor F (branchAtom s b)) + (siteTensor F (fun i => shape s i - branchAtom s b i)) + +theorem branchAtom_le_shape (s : Fin 3) (b : Fin 4) (i : Fin 3) : + branchAtom s b i ≤ shape s i := by + fin_cases s <;> fin_cases b <;> fin_cases i <;> decide + +theorem weight_joinChildren (x : ChildPair) : + CWStrands.weight (joinChildren x) = + CWLeafStatistics.weight x.1 + CWLeafStatistics.weight x.2 := by + simp [CWStrands.weight, joinChildren, Fin.sum_univ_succ] + +theorem strand_joinChildren (F : Type*) [CommRing F] (x y z : ChildPair) : + CWStrands.strand (F := F) (Fin 2) (joinChildren x) (joinChildren y) (joinChildren z) = + FieldCW.tensor F 5 x.1 y.1 z.1 * FieldCW.tensor F 5 x.2 y.2 z.2 := by + simp [CWStrands.strand, joinChildren, Fin.prod_univ_succ] + +theorem masked_eq_childProduct (F : Type*) [CommRing F] (s : Fin 3) (b : Fin 4) : + Tensor.pullback joinChildren joinChildren joinChildren (branchSource F s b) = + childProduct F s b := by + funext x y z + have h0 := branchAtom_le_shape s b 0 + have h1 := branchAtom_le_shape s b 1 + have h2 := branchAtom_le_shape s b 2 + by_cases hL : CWLeafStatistics.weight x.1 = branchAtom s b 0 ∧ + CWLeafStatistics.weight y.1 = branchAtom s b 1 ∧ + CWLeafStatistics.weight z.1 = branchAtom s b 2 + · have htotal : + (CWLeafStatistics.weight x.1 + CWLeafStatistics.weight x.2 = shape s 0 ∧ + CWLeafStatistics.weight y.1 + CWLeafStatistics.weight y.2 = shape s 1 ∧ + CWLeafStatistics.weight z.1 + CWLeafStatistics.weight z.2 = shape s 2) ↔ + (CWLeafStatistics.weight x.2 = shape s 0 - branchAtom s b 0 ∧ + CWLeafStatistics.weight y.2 = shape s 1 - branchAtom s b 1 ∧ + CWLeafStatistics.weight z.2 = shape s 2 - branchAtom s b 2) := by + rcases hL with ⟨hx, hy, hz⟩ + constructor <;> rintro ⟨ha, hb, hc⟩ <;> + exact ⟨by omega, by omega, by omega⟩ + simp only [hL.1, hL.2.1, hL.2.2] at htotal + simp [Tensor.pullback, branchSource, source, CWStrands.shapeTensor, + weight_joinChildren, strand_joinChildren, childProduct, Tensor.product, siteTensor, + hL, htotal, mul_ite] + · simp [Tensor.pullback, branchSource, childProduct, Tensor.product, siteTensor, hL] + +theorem childProduct_split (F : Type*) [CommRing F] (s : Fin 3) (b : Fin 4) + (x y z : Word) : + childProduct F s b (splitChildren x) (splitChildren y) (splitChildren z) = + branchSource F s b x y z := by + have h := congrFun (congrFun (congrFun (masked_eq_childProduct F s b) + (splitChildren x)) (splitChildren y)) (splitChildren z) + simpa only [Tensor.pullback, join_split_children] using h.symm + +theorem childProduct_pullback (F : Type*) [CommRing F] (s : Fin 3) (b : Fin 4) : + ∃ (a : (Row s b × Middle s b) → ChildPair) + (c : (Middle s b × Column s b) → ChildPair) + (e : (Column s b × Row s b) → ChildPair), + Tensor.pullback a c e (childProduct F s b) = + Tensor.matrixCoefficients (Row s b) (Middle s b) (Column s b) := by + obtain ⟨a, c, e, h⟩ := oriented_masked_pullback F s b + refine ⟨splitChildren ∘ a, splitChildren ∘ c, splitChildren ∘ e, ?_⟩ + funext x y z + change childProduct F s b (splitChildren (a x)) (splitChildren (c y)) + (splitChildren (e z)) = _ + rw [childProduct_split] + exact congrFun (congrFun (congrFun h x) y) z + +theorem childProduct_restriction (F : Type*) [CommRing F] (s : Fin 3) (b : Fin 4) : + ∃ (a : (Row s b × Middle s b) → ChildPair → F) + (c : (Middle s b × Column s b) → ChildPair → F) + (e : (Column s b × Row s b) → ChildPair → F), + Tensor.restrict a c e (childProduct F s b) = + Tensor.matrixCoefficients (Row s b) (Middle s b) (Column s b) := by + classical + obtain ⟨a, c, e, h⟩ := childProduct_pullback F s b + refine ⟨(fun x w => if w = a x then 1 else 0), + (fun y w => if w = c y then 1 else 0), + (fun z w => if w = e z then 1 else 0), ?_⟩ + rw [← Tensor.pullback_eq_restrict] + exact h + +def placedChildProduct (F : Type*) [CommRing F] (s : Fin 3) + (phi : Equiv.Perm (Fin 3)) (b : Fin 4) := + childProduct F (phi s) (atomPermutation s phi b) + +theorem placedChildProduct_eq (F : Type*) [CommRing F] (s : Fin 3) + (phi : Equiv.Perm (Fin 3)) (b : Fin 4) : + placedChildProduct F s phi b = + Tensor.product (siteTensor F (fun i => branchAtom s b (phi.symm i))) + (siteTensor F (fun i => shape s (phi.symm i) - branchAtom s b (phi.symm i))) := by + have ha : branchAtom (phi s) (atomPermutation s phi b) = + fun i => branchAtom s b (phi.symm i) := by + funext i + simpa only [Equiv.apply_symm_apply] using branchAtom_transport s phi b (phi.symm i) + have hs : shape (phi s) = fun i => shape s (phi.symm i) := by + funext i + exact shape_transport s phi i + simp only [placedChildProduct, childProduct, ha, hs] + +theorem placedChildProduct_eq_stageC (F : Type*) [CommRing F] + (u : AllFieldParameters.Shape) (hu : u ∈ AllFieldParameters.shapes 4) + (hpos : AllFieldParameters.positive u = true) + (phi : Equiv.Perm (Fin 3)) (b : Fin 4) : + placedChildProduct F (AllFieldHistory.stageCDistinguished u) phi b = + Tensor.product (siteTensor F (fun i => AllFieldHistory.stageCAtom u b (phi.symm i))) + (siteTensor F (fun i => u (phi.symm i) - + AllFieldHistory.stageCAtom u b (phi.symm i))) := by + rw [placedChildProduct_eq, branchAtom_eq_stageCAtom, shape_eq_parent u hu hpos] + +theorem placedChildProduct_side_weights (F : Type*) [CommRing F] (s : Fin 3) + (phi : Equiv.Perm (Fin 3)) (b : Fin 4) (x y z : ChildPair) + (hne : placedChildProduct F s phi b x y z ≠ 0) (i : Fin 3) : + CWLeafStatistics.weight ((![x, y, z] i).1) = branchAtom s b (phi.symm i) ∧ + CWLeafStatistics.weight ((![x, y, z] i).2) = + shape s (phi.symm i) - branchAtom s b (phi.symm i) := by + rw [placedChildProduct_eq] at hne + exact siteProduct_side_weights F _ _ x y z hne i + +theorem placedChildProduct_restriction (F : Type*) [CommRing F] (s : Fin 3) + (phi : Equiv.Perm (Fin 3)) (b : Fin 4) : + ∃ (a : (Row (phi s) b × Middle (phi s) b) → ChildPair → F) + (c : (Middle (phi s) b × Column (phi s) b) → ChildPair → F) + (e : (Column (phi s) b × Row (phi s) b) → ChildPair → F), + Tensor.restrict a c e (placedChildProduct F s phi b) = + Tensor.matrixCoefficients (Row (phi s) b) (Middle (phi s) b) (Column (phi s) b) := by + have h := childProduct_restriction F (phi s) (atomPermutation s phi b) + unfold placedChildProduct + by_cases hp : phi (Equiv.swap 2 s 0) = Equiv.swap 2 (phi s) 0 + · have he : atomPermutation s phi = Equiv.refl _ := ite_eq_left hp + rw [he] at h ⊢ + exact h + · have he : atomPermutation s phi = Equiv.swap 2 3 := ite_eq_right hp + rw [he] at h ⊢ + fin_cases b <;> exact h + +def placedChildProducts (F : Type*) [CommRing F] (s : Fin 3) + (phi : Equiv.Perm (Fin 3)) (counts : Fin 4 → ℕ) : + Tensor F (Positions counts → ChildPair) (Positions counts → ChildPair) + (Positions counts → ChildPair) := + CommonDimensions.familyProduct (fun p : Positions counts => placedChildProduct F s phi p.1) + +theorem placedChildProducts_side_weights (F : Type*) [CommRing F] (s : Fin 3) + (phi : Equiv.Perm (Fin 3)) (counts : Fin 4 → ℕ) + (x y z : Positions counts → ChildPair) + (hne : placedChildProducts F s phi counts x y z ≠ 0) + (p : Positions counts) (i : Fin 3) : + CWLeafStatistics.weight ((![x p, y p, z p] i).1) = branchAtom s p.1 (phi.symm i) ∧ + CWLeafStatistics.weight ((![x p, y p, z p] i).2) = + shape s (phi.symm i) - branchAtom s p.1 (phi.symm i) := by + have hp : placedChildProduct F s phi p.1 (x p) (y p) (z p) ≠ 0 := by + intro he + exact hne (Finset.prod_eq_zero (Finset.mem_univ p) he) + exact placedChildProduct_side_weights F s phi p.1 (x p) (y p) (z p) hp i + +theorem placedChildProducts_restriction (F : Type*) [CommRing F] (s : Fin 3) + (phi : Equiv.Perm (Fin 3)) (counts : Fin 4 → ℕ) : + ∃ (a : (RowWords (phi s) counts × MiddleWords (phi s) counts) → + (Positions counts → ChildPair) → F) + (c : (MiddleWords (phi s) counts × ColumnWords (phi s) counts) → + (Positions counts → ChildPair) → F) + (e : (ColumnWords (phi s) counts × RowWords (phi s) counts) → + (Positions counts → ChildPair) → F), + Tensor.restrict a c e (placedChildProducts F s phi counts) = + Tensor.matrixCoefficients (RowWords (phi s) counts) (MiddleWords (phi s) counts) + (ColumnWords (phi s) counts) := by + classical + choose a c e h using fun p : Positions counts => placedChildProduct_restriction F s phi p.1 + exact TerminalProducts.matrix_restriction_of_history_restrictions + (fun p : Positions counts => placedChildProduct F s phi p.1) + (fun p => Row (phi s) p.1) (fun p => Middle (phi s) p.1) + (fun p => Column (phi s) p.1) a c e h + +end MatrixMultiplication.CWStageCProducts + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/CoppersmithWinograd/CWStageCPlacements.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/CoppersmithWinograd/CWStageCPlacements.lean new file mode 100644 index 0000000000000000000000000000000000000000..01b61facec2e2749c9d4d450cad90c7264a68582 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/CoppersmithWinograd/CWStageCPlacements.lean @@ -0,0 +1,123 @@ +import OAI.LinearAlgebra.MatrixMultiplication.CoppersmithWinograd.CWStageCProducts +import OAI.LinearAlgebra.MatrixMultiplication.FieldConstruction.StageCLaw + +namespace OAI + +/-! Coppersmith–Winograd tensors, tensor powers and local restrictions. -/ + +noncomputable section + +open scoped BigOperators +open MatrixMultiplication.Foundation + +namespace MatrixMultiplication.CWStageCProducts + +def atomPermutation (s : Fin 3) (phi : Equiv.Perm (Fin 3)) : Equiv.Perm (Fin 4) := + if phi (Equiv.swap 2 s 0) = Equiv.swap 2 (phi s) 0 then Equiv.refl _ + else Equiv.swap 2 3 + +theorem branchAtom_transport (s : Fin 3) (phi : Equiv.Perm (Fin 3)) + (b : Fin 4) (i : Fin 3) : + branchAtom (phi s) (atomPermutation s phi b) (phi i) = branchAtom s b i := by + have h01 : phi 0 ≠ phi 1 := phi.injective.ne (by decide) + have h02 : phi 0 ≠ phi 2 := phi.injective.ne (by decide) + have h12 : phi 1 ≠ phi 2 := phi.injective.ne (by decide) + generalize hp0 : phi 0 = p0 at * + generalize hp1 : phi 1 = p1 at * + generalize hp2 : phi 2 = p2 at * + fin_cases p0 <;> fin_cases p1 <;> fin_cases p2 <;> simp_all only [ne_eq, + not_false_eq_true, not_true_eq_false] + all_goals fin_cases s <;> fin_cases b <;> fin_cases i <;> + simp [atomPermutation, branchAtom, canonicalAtom, Equiv.swap_apply_def, hp0, hp1, hp2] + +theorem atomPermutation_single (s : Fin 3) (phi : Equiv.Perm (Fin 3)) (b : Fin 4) : + (atomPermutation s phi b).val < 2 ↔ b.val < 2 := by + unfold atomPermutation + split_ifs + · rfl + · fin_cases b <;> decide + +theorem branchAtom_eq_stageCAtom (u : AllFieldParameters.Shape) (b : Fin 4) : + branchAtom (AllFieldHistory.stageCDistinguished u) b = AllFieldHistory.stageCAtom u b := by + rfl + +theorem shape_eq_parent (u : AllFieldParameters.Shape) + (hu : u ∈ AllFieldParameters.shapes 4) (hpos : AllFieldParameters.positive u = true) : + shape (AllFieldHistory.stageCDistinguished u) = u := by + rcases AllFieldHistory.positive_four_shapes u hu hpos with rfl | rfl | rfl <;> + funext i <;> fin_cases i <;> rfl + +theorem shape_transport (s : Fin 3) (phi : Equiv.Perm (Fin 3)) (i : Fin 3) : + shape (phi s) i = shape s (phi.symm i) := by + have hiff : i = phi s ↔ phi.symm i = s := by + constructor + · intro h + simp only [h, Equiv.symm_apply_apply] + · intro h + have hh := congrArg phi h + simpa only [Equiv.apply_symm_apply] using hh + simp only [shape, hiff] + +def placedBranchSource (F : Type*) [CommRing F] (s : Fin 3) + (phi : Equiv.Perm (Fin 3)) (b : Fin 4) : Tensor F Word Word Word := + fun x y z => + if CWLeafStatistics.weight (x 0) = branchAtom s b (phi.symm 0) ∧ + CWLeafStatistics.weight (y 0) = branchAtom s b (phi.symm 1) ∧ + CWLeafStatistics.weight (z 0) = branchAtom s b (phi.symm 2) + then source F (phi s) x y z else 0 + +theorem placedBranchSource_eq (F : Type*) [CommRing F] (s : Fin 3) + (phi : Equiv.Perm (Fin 3)) (b : Fin 4) : + placedBranchSource F s phi b = branchSource F (phi s) (atomPermutation s phi b) := by + have h0 := branchAtom_transport s phi b (phi.symm 0) + have h1 := branchAtom_transport s phi b (phi.symm 1) + have h2 := branchAtom_transport s phi b (phi.symm 2) + simp only [Equiv.apply_symm_apply] at h0 h1 h2 + funext x y z + simp only [placedBranchSource, branchSource, h0, h1, h2] + +theorem placed_branch_restriction (F : Type*) [CommRing F] (s : Fin 3) + (phi : Equiv.Perm (Fin 3)) (b : Fin 4) : + ∃ (a : (Row (phi s) b × Middle (phi s) b) → Word → F) + (c : (Middle (phi s) b × Column (phi s) b) → Word → F) + (e : (Column (phi s) b × Row (phi s) b) → Word → F), + Tensor.restrict a c e (placedBranchSource F s phi b) = + Tensor.matrixCoefficients (Row (phi s) b) (Middle (phi s) b) (Column (phi s) b) := by + rw [placedBranchSource_eq] + have h := oriented_restriction F (phi s) (atomPermutation s phi b) + by_cases hp : phi (Equiv.swap 2 s 0) = Equiv.swap 2 (phi s) 0 + · have he : atomPermutation s phi = Equiv.refl _ := by simp [atomPermutation, hp] + rw [he] at h ⊢ + exact h + · have he : atomPermutation s phi = Equiv.swap 2 3 := by simp [atomPermutation, hp] + rw [he] at h ⊢ + fin_cases b <;> exact h + +def placedProductSource (F : Type*) [CommRing F] (s : Fin 3) + (phi : Equiv.Perm (Fin 3)) (counts : Fin 4 → ℕ) : + Tensor F (Positions counts → Word) (Positions counts → Word) (Positions counts → Word) := + CommonDimensions.familyProduct (fun p : Positions counts => placedBranchSource F s phi p.1) + +theorem placed_product_restriction (F : Type*) [CommRing F] (s : Fin 3) + (phi : Equiv.Perm (Fin 3)) (counts : Fin 4 → ℕ) : + ∃ (a : (RowWords (phi s) counts × MiddleWords (phi s) counts) → + (Positions counts → Word) → F) + (c : (MiddleWords (phi s) counts × ColumnWords (phi s) counts) → + (Positions counts → Word) → F) + (e : (ColumnWords (phi s) counts × RowWords (phi s) counts) → + (Positions counts → Word) → F), + Tensor.restrict a c e (placedProductSource F s phi counts) = + Tensor.matrixCoefficients (RowWords (phi s) counts) (MiddleWords (phi s) counts) + (ColumnWords (phi s) counts) := by + classical + choose a c e h using fun p : Positions counts => placed_branch_restriction F s phi p.1 + exact TerminalProducts.matrix_restriction_of_history_restrictions + (fun p : Positions counts => placedBranchSource F s phi p.1) + (fun p => Row (phi s) p.1) (fun p => Middle (phi s) p.1) + (fun p => Column (phi s) p.1) a c e h + +end MatrixMultiplication.CWStageCProducts + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/CoppersmithWinograd/CWStageCProductRates.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/CoppersmithWinograd/CWStageCProductRates.lean new file mode 100644 index 0000000000000000000000000000000000000000..c5596f6b0a6e5a188275a0ca7ce46427d9c251f8 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/CoppersmithWinograd/CWStageCProductRates.lean @@ -0,0 +1,314 @@ +import OAI.LinearAlgebra.MatrixMultiplication.CoppersmithWinograd.CWStageCProducts +import OAI.LinearAlgebra.MatrixMultiplication.FieldConstruction.StageCLaw +import OAI.LinearAlgebra.MatrixMultiplication.FieldHistory.Populations +import Mathlib.Analysis.SpecialFunctions.Log.Basic + +namespace OAI + +/-! Coppersmith–Winograd tensors, tensor powers and local restrictions. -/ + +noncomputable section + +open scoped BigOperators + +namespace MatrixMultiplication.CWStageCProducts + +attribute [local instance] Classical.propDecidable Classical.decEq + +theorem card_positions (counts : Fin 4 → ℕ) : + Fintype.card (Positions counts) = totalCount counts := by + simp [Positions, Fintype.card_sigma, Fin.sum_univ_succ, totalCount, + singleCount, crossCount, Nat.add_assoc] + +theorem card_rowWords (s : Fin 3) (counts : Fin 4 → ℕ) : + Fintype.card (RowWords s counts) = + 5 ^ (if s = 1 then singleCount counts else crossCount counts) := by + rw [Fintype.card_eq_nat_card, Nat.card_pi, Fintype.prod_sigma] + fin_cases s <;> + simp [Fin.prod_univ_succ, Row, SmallRow, SmallInner, singleCount, crossCount, + pow_add, Nat.card_fin, -Nat.card_eq_fintype_card] + +theorem card_middleWords (s : Fin 3) (counts : Fin 4 → ℕ) : + Fintype.card (MiddleWords s counts) = + 5 ^ (if s = 2 then singleCount counts else crossCount counts) := by + rw [Fintype.card_eq_nat_card, Nat.card_pi, Fintype.prod_sigma] + fin_cases s <;> + simp [Fin.prod_univ_succ, Middle, SmallRow, SmallInner, singleCount, crossCount, + pow_add, Nat.card_fin, -Nat.card_eq_fintype_card] + +theorem card_columnWords (s : Fin 3) (counts : Fin 4 → ℕ) : + Fintype.card (ColumnWords s counts) = + 5 ^ (if s = 0 then singleCount counts else crossCount counts) := by + rw [Fintype.card_eq_nat_card, Nat.card_pi, Fintype.prod_sigma] + fin_cases s <;> + simp [Fin.prod_univ_succ, Column, SmallRow, SmallInner, singleCount, crossCount, + pow_add, Nat.card_fin, -Nat.card_eq_fintype_card] + +def volume (s : Fin 3) (counts : Fin 4 → ℕ) : ℕ := + Fintype.card (RowWords s counts) * Fintype.card (MiddleWords s counts) * + Fintype.card (ColumnWords s counts) + +theorem volume_eq (s : Fin 3) (counts : Fin 4 → ℕ) : + volume s counts = 5 ^ (singleCount counts + 2 * crossCount counts) := by + rw [volume, card_rowWords, card_middleWords, card_columnWords] + fin_cases s <;> simp [pow_add, two_mul] <;> ring + +theorem volume_pos (s : Fin 3) (counts : Fin 4 → ℕ) : 0 < volume s counts := by + rw [volume_eq] + positivity + +theorem log_volume (s : Fin 3) (counts : Fin 4 → ℕ) : + Real.log (volume s counts : ℝ) = + ((singleCount counts : ℝ) + 2 * crossCount counts) * Real.log 5 := by + rw [volume_eq] + simp only [Nat.cast_pow, Nat.cast_ofNat, Real.log_pow, Nat.cast_add, Nat.cast_mul] + +theorem normalized_log_volume (s : Fin 3) (counts : Fin 4 → ℕ) + (hpos : 0 < totalCount counts) : + Real.log (volume s counts : ℝ) / totalCount counts = + (2 - (singleCount counts : ℝ) / totalCount counts) * Real.log 5 := by + have hn : (totalCount counts : ℝ) ≠ 0 := by exact_mod_cast (ne_of_gt hpos) + have ht : (totalCount counts : ℝ) = singleCount counts + (crossCount counts : ℝ) := by + simp [totalCount] + rw [log_volume, mul_div_right_comm] + congr 1 + field_simp [hn] + rw [ht] + ring + +theorem totalCount_of_atom_counts (counts : Fin 4 → ℕ) + (t u : AllFieldParameters.Shape) (n : ℕ) + (hc : ∀ i, (counts i : ℚ) = (n : ℚ) * AllFieldHistory.stageCWeight t u i) : + totalCount counts = n := by + apply Nat.cast_injective (R := ℚ) + calc + (totalCount counts : ℚ) = ∑ i, (counts i : ℚ) := by + simp [totalCount, singleCount, crossCount, Fin.sum_univ_succ, add_assoc] + _ = n := by + simp only [hc, ← Finset.mul_sum, AllFieldHistory.stageCWeight_normalized, mul_one] + +theorem log_volume_of_atom_counts (s : Fin 3) (counts : Fin 4 → ℕ) + (t u : AllFieldParameters.Shape) (n : ℕ) + (hc : ∀ i, (counts i : ℚ) = (n : ℚ) * AllFieldHistory.stageCWeight t u i) : + Real.log (volume s counts : ℝ) = + (n : ℝ) * (2 - (AllFieldParameters.binaryParameter t u : ℝ)) * Real.log 5 := by + have hs : (singleCount counts : ℚ) = (n : ℚ) * AllFieldParameters.binaryParameter t u := by + simp only [singleCount, Nat.cast_add, hc, ← mul_add, + AllFieldHistory.stageCWeight_single] + have hx : (crossCount counts : ℚ) = + (n : ℚ) * (1 - AllFieldParameters.binaryParameter t u) := by + simp only [crossCount, Nat.cast_add, hc, ← mul_add, + AllFieldHistory.stageCWeight_cross] + have hsr : (singleCount counts : ℝ) = + (n : ℝ) * (AllFieldParameters.binaryParameter t u : ℝ) := by exact_mod_cast hs + have hxr : (crossCount counts : ℝ) = + (n : ℝ) * (1 - (AllFieldParameters.binaryParameter t u : ℝ)) := by exact_mod_cast hx + rw [log_volume, hsr, hxr] + ring + +theorem normalized_log_volume_of_atom_counts (s : Fin 3) (counts : Fin 4 → ℕ) + (t u : AllFieldParameters.Shape) (n : ℕ) (hn : 0 < n) + (hc : ∀ i, (counts i : ℚ) = (n : ℚ) * AllFieldHistory.stageCWeight t u i) : + Real.log (volume s counts : ℝ) / totalCount counts = + (2 - (AllFieldParameters.binaryParameter t u : ℝ)) * Real.log 5 := by + rw [log_volume_of_atom_counts s counts t u n hc, totalCount_of_atom_counts counts t u n hc] + have hn' : (n : ℝ) ≠ 0 := by exact_mod_cast (ne_of_gt hn) + field_simp [hn'] + +variable {H : Type*} [Fintype H] + +abbrev HistoryRowWords (side : H → Fin 3) (counts : H → Fin 4 → ℕ) := + ∀ h, RowWords (side h) (counts h) +abbrev HistoryMiddleWords (side : H → Fin 3) (counts : H → Fin 4 → ℕ) := + ∀ h, MiddleWords (side h) (counts h) +abbrev HistoryColumnWords (side : H → Fin 3) (counts : H → Fin 4 → ℕ) := + ∀ h, ColumnWords (side h) (counts h) + +theorem card_historyRowWords (side : H → Fin 3) (counts : H → Fin 4 → ℕ) : + Fintype.card (HistoryRowWords side counts) = + 5 ^ ∑ h, (if side h = 1 then singleCount (counts h) else crossCount (counts h)) := by + rw [Fintype.card_pi] + simp only [card_rowWords] + exact Finset.prod_pow_eq_pow_sum _ _ _ + +theorem card_historyMiddleWords (side : H → Fin 3) (counts : H → Fin 4 → ℕ) : + Fintype.card (HistoryMiddleWords side counts) = + 5 ^ ∑ h, (if side h = 2 then singleCount (counts h) else crossCount (counts h)) := by + rw [Fintype.card_pi] + simp only [card_middleWords] + exact Finset.prod_pow_eq_pow_sum _ _ _ + +theorem card_historyColumnWords (side : H → Fin 3) (counts : H → Fin 4 → ℕ) : + Fintype.card (HistoryColumnWords side counts) = + 5 ^ ∑ h, (if side h = 0 then singleCount (counts h) else crossCount (counts h)) := by + rw [Fintype.card_pi] + simp only [card_columnWords] + exact Finset.prod_pow_eq_pow_sum _ _ _ + +def historyVolume (side : H → Fin 3) (counts : H → Fin 4 → ℕ) : ℕ := + Fintype.card (HistoryRowWords side counts) * + Fintype.card (HistoryMiddleWords side counts) * + Fintype.card (HistoryColumnWords side counts) + +theorem historyVolume_eq_prod (side : H → Fin 3) (counts : H → Fin 4 → ℕ) : + historyVolume side counts = ∏ h, volume (side h) (counts h) := by + simp only [historyVolume, HistoryRowWords, HistoryMiddleWords, HistoryColumnWords, + Fintype.card_pi, volume, Finset.prod_mul_distrib] + +theorem historyVolume_eq (side : H → Fin 3) (counts : H → Fin 4 → ℕ) : + historyVolume side counts = + 5 ^ ∑ h, (singleCount (counts h) + 2 * crossCount (counts h)) := by + rw [historyVolume_eq_prod] + simp only [volume_eq] + exact Finset.prod_pow_eq_pow_sum _ _ _ + +theorem log_historyVolume (side : H → Fin 3) (counts : H → Fin 4 → ℕ) : + Real.log (historyVolume side counts : ℝ) = + ∑ h, ((singleCount (counts h) : ℝ) + 2 * crossCount (counts h)) * Real.log 5 := by + rw [historyVolume_eq] + simp only [Nat.cast_pow, Nat.cast_ofNat, Real.log_pow, Nat.cast_sum, + Nat.cast_add, Nat.cast_mul, Finset.sum_mul] + +theorem log_historyVolume_of_mass_counts (side : H → Fin 3) + (counts : H → Fin 4 → ℕ) (t u : H → AllFieldParameters.Shape) + (mass : H → ℚ) (N : ℕ) + (hc : ∀ h i, (counts h i : ℚ) = + (N : ℚ) * mass h * AllFieldHistory.stageCWeight (t h) (u h) i) : + Real.log (historyVolume side counts : ℝ) = + (N : ℝ) * ∑ h, (mass h : ℝ) * + (2 - (AllFieldParameters.binaryParameter (t h) (u h) : ℝ)) * Real.log 5 := by + have hs (h : H) : (singleCount (counts h) : ℚ) = + (N : ℚ) * mass h * AllFieldParameters.binaryParameter (t h) (u h) := by + simp only [singleCount, Nat.cast_add, hc, ← mul_add, + AllFieldHistory.stageCWeight_single] + have hx (h : H) : (crossCount (counts h) : ℚ) = + (N : ℚ) * mass h * (1 - AllFieldParameters.binaryParameter (t h) (u h)) := by + simp only [crossCount, Nat.cast_add, hc, ← mul_add, + AllFieldHistory.stageCWeight_cross] + rw [log_historyVolume, Finset.mul_sum] + apply Finset.sum_congr rfl + intro h _ + have hsr : (singleCount (counts h) : ℝ) = + (N : ℝ) * (mass h : ℝ) * (AllFieldParameters.binaryParameter (t h) (u h) : ℝ) := by + exact_mod_cast hs h + have hxr : (crossCount (counts h) : ℝ) = + (N : ℝ) * (mass h : ℝ) * (1 - (AllFieldParameters.binaryParameter (t h) (u h) : ℝ)) := by + exact_mod_cast hx h + rw [hsr, hxr] + ring + +theorem normalized_log_historyVolume_of_mass_counts (side : H → Fin 3) + (counts : H → Fin 4 → ℕ) (t u : H → AllFieldParameters.Shape) + (mass : H → ℚ) (N : ℕ) (hN : 0 < N) + (hc : ∀ h i, (counts h i : ℚ) = + (N : ℚ) * mass h * AllFieldHistory.stageCWeight (t h) (u h) i) : + Real.log (historyVolume side counts : ℝ) / N = + ∑ h, (mass h : ℝ) * + (2 - (AllFieldParameters.binaryParameter (t h) (u h) : ℝ)) * Real.log 5 := by + rw [log_historyVolume_of_mass_counts side counts t u mass N hc] + have hn : (N : ℝ) ≠ 0 := by exact_mod_cast (ne_of_gt hN) + exact mul_div_cancel_left₀ _ hn + +abbrev PopulationHistory (K : ℕ) := AllFieldHistory.PartC K × AllFieldHistory.Placement + +def populationSide {K : ℕ} (h : PopulationHistory K) : Fin 3 := + h.2 (AllFieldHistory.stageCDistinguished (AllFieldHistory.cShapeParent h.1)) + +def populationAtomCounts {K : ℕ} (allocation : AllFieldHistory.Allocation) + (dilation : ℕ) (h : PopulationHistory K) (i : Fin 4) : ℕ := + AllFieldHistory.population allocation dilation (.afterC (h.1, i, false), h.2) + +theorem populationAtomCounts_mass {K : ℕ} (allocation : AllFieldHistory.Allocation) + (dilation : ℕ) (h : PopulationHistory K) (i : Fin 4) : + (populationAtomCounts allocation dilation h i : ℚ) = + (AllFieldHistory.populationLength (K := K) allocation dilation : ℚ) * + AllFieldHistory.amount allocation (.partC h.1, h.2) * + AllFieldHistory.stageCWeight (AllFieldHistory.cParameterParent h.1) + (AllFieldHistory.cShapeParent h.1) i := by + rw [populationAtomCounts, AllFieldHistory.population_cast] + simp only [AllFieldHistory.amount, AllFieldHistory.canonicalAmount, + AllFieldHistory.cAmount] + ring + +theorem populationAtomCounts_parent {K : ℕ} (allocation : AllFieldHistory.Allocation) + (dilation : ℕ) (h : PopulationHistory K) (i : Fin 4) : + (populationAtomCounts allocation dilation h i : ℚ) = + (AllFieldHistory.population allocation dilation (.partC h.1, h.2) : ℚ) * + AllFieldHistory.stageCWeight (AllFieldHistory.cParameterParent h.1) + (AllFieldHistory.cShapeParent h.1) i := by + rw [populationAtomCounts_mass, AllFieldHistory.population_cast] + +theorem populationAtomCounts_total {K : ℕ} (allocation : AllFieldHistory.Allocation) + (dilation : ℕ) (h : PopulationHistory K) : + totalCount (populationAtomCounts allocation dilation h) = + AllFieldHistory.population allocation dilation (.partC h.1, h.2) := by + simpa [totalCount, singleCount, crossCount, populationAtomCounts, + Fin.sum_univ_succ, Nat.add_assoc] using + AllFieldHistory.c_population_transition allocation dilation h.1 false h.2 + +theorem log_population_historyVolume {K : ℕ} (allocation : AllFieldHistory.Allocation) + (dilation : ℕ) (side : PopulationHistory K → Fin 3) : + Real.log (historyVolume side (populationAtomCounts allocation dilation) : ℝ) = + (AllFieldHistory.populationLength (K := K) allocation dilation : ℝ) * + ∑ h : PopulationHistory K, + (AllFieldHistory.amount allocation (.partC h.1, h.2) : ℝ) * + (2 - (AllFieldParameters.binaryParameter + (AllFieldHistory.cParameterParent h.1) + (AllFieldHistory.cShapeParent h.1) : ℝ)) * Real.log 5 := by + exact log_historyVolume_of_mass_counts side (populationAtomCounts allocation dilation) + (fun h => AllFieldHistory.cParameterParent h.1) + (fun h => AllFieldHistory.cShapeParent h.1) + (fun h => AllFieldHistory.amount allocation (.partC h.1, h.2)) + (AllFieldHistory.populationLength (K := K) allocation dilation) + (populationAtomCounts_mass allocation dilation) + +theorem normalized_log_population_historyVolume {K : ℕ} + (allocation : AllFieldHistory.Allocation) (dilation : ℕ) (hd : 0 < dilation) + (side : PopulationHistory K → Fin 3) : + Real.log (historyVolume side (populationAtomCounts allocation dilation) : ℝ) / + AllFieldHistory.populationLength (K := K) allocation dilation = + ∑ h : PopulationHistory K, + (AllFieldHistory.amount allocation (.partC h.1, h.2) : ℝ) * + (2 - (AllFieldParameters.binaryParameter + (AllFieldHistory.cParameterParent h.1) + (AllFieldHistory.cShapeParent h.1) : ℝ)) * Real.log 5 := by + exact normalized_log_historyVolume_of_mass_counts side + (populationAtomCounts allocation dilation) + (fun h => AllFieldHistory.cParameterParent h.1) + (fun h => AllFieldHistory.cShapeParent h.1) + (fun h => AllFieldHistory.amount allocation (.partC h.1, h.2)) + (AllFieldHistory.populationLength (K := K) allocation dilation) + (AllFieldPopulationCounts.blockLength_pos _ hd) + (populationAtomCounts_mass allocation dilation) + +def populationVolume {K : ℕ} (allocation : AllFieldHistory.Allocation) + (dilation : ℕ) : ℕ := + historyVolume (populationSide (K := K)) (populationAtomCounts allocation dilation) + +theorem log_populationVolume {K : ℕ} (allocation : AllFieldHistory.Allocation) + (dilation : ℕ) : + Real.log (populationVolume (K := K) allocation dilation : ℝ) = + (AllFieldHistory.populationLength (K := K) allocation dilation : ℝ) * + ∑ h : PopulationHistory K, + (AllFieldHistory.amount allocation (.partC h.1, h.2) : ℝ) * + (2 - (AllFieldParameters.binaryParameter + (AllFieldHistory.cParameterParent h.1) + (AllFieldHistory.cShapeParent h.1) : ℝ)) * Real.log 5 := + log_population_historyVolume allocation dilation populationSide + +theorem normalized_log_populationVolume {K : ℕ} + (allocation : AllFieldHistory.Allocation) (dilation : ℕ) (hd : 0 < dilation) : + Real.log (populationVolume (K := K) allocation dilation : ℝ) / + AllFieldHistory.populationLength (K := K) allocation dilation = + ∑ h : PopulationHistory K, + (AllFieldHistory.amount allocation (.partC h.1, h.2) : ℝ) * + (2 - (AllFieldParameters.binaryParameter + (AllFieldHistory.cParameterParent h.1) + (AllFieldHistory.cShapeParent h.1) : ℝ)) * Real.log 5 := + normalized_log_population_historyVolume allocation dilation hd populationSide + +end MatrixMultiplication.CWStageCProducts + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/CoppersmithWinograd/CWStageCProducts.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/CoppersmithWinograd/CWStageCProducts.lean new file mode 100644 index 0000000000000000000000000000000000000000..a27a7d10dfc474d9d7f5c881244d3e9af4f2155a --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/CoppersmithWinograd/CWStageCProducts.lean @@ -0,0 +1,269 @@ +import OAI.LinearAlgebra.MatrixMultiplication.CoppersmithWinograd.CWStageC +import OAI.LinearAlgebra.MatrixMultiplication.Tensor.TerminalProducts + +namespace OAI + +/-! Coppersmith–Winograd tensors, tensor powers and local restrictions. -/ + +noncomputable section + +open scoped BigOperators +open MatrixMultiplication.Foundation + +namespace MatrixMultiplication.CWStageCProducts + +def SmallRow : Fin 4 → Type := ![Unit, Unit, Fin 5, Fin 5] + +def SmallInner : Fin 4 → Type := ![Fin 5, Fin 5, Unit, Unit] + +instance smallRowFintype (b : Fin 4) : Fintype (SmallRow b) := by + refine Fin.cases ?_ (Fin.cases ?_ (Fin.cases ?_ (Fin.cases ?_ (fun b => Fin.elim0 b)))) b + all_goals dsimp [SmallRow]; infer_instance + +instance smallInnerFintype (b : Fin 4) : Fintype (SmallInner b) := by + refine Fin.cases ?_ (Fin.cases ?_ (Fin.cases ?_ (Fin.cases ?_ (fun b => Fin.elim0 b)))) b + all_goals dsimp [SmallInner]; infer_instance + +instance smallRowDecidableEq (b : Fin 4) : DecidableEq (SmallRow b) := by + refine Fin.cases ?_ (Fin.cases ?_ (Fin.cases ?_ (Fin.cases ?_ (fun b => Fin.elim0 b)))) b + all_goals dsimp [SmallRow]; infer_instance + +instance smallInnerDecidableEq (b : Fin 4) : DecidableEq (SmallInner b) := by + refine Fin.cases ?_ (Fin.cases ?_ (Fin.cases ?_ (Fin.cases ?_ (fun b => Fin.elim0 b)))) b + all_goals dsimp [SmallInner]; infer_instance + +def Row (s : Fin 3) (b : Fin 4) : Type := + if s = 1 then SmallInner b else SmallRow b + +def Middle (s : Fin 3) (b : Fin 4) : Type := + if s = 2 then SmallInner b else SmallRow b + +def Column (s : Fin 3) (b : Fin 4) : Type := + if s = 0 then SmallInner b else SmallRow b + +instance rowFintype (s : Fin 3) (b : Fin 4) : Fintype (Row s b) := by + unfold Row; split_ifs <;> infer_instance +instance middleFintype (s : Fin 3) (b : Fin 4) : Fintype (Middle s b) := by + unfold Middle; split_ifs <;> infer_instance +instance columnFintype (s : Fin 3) (b : Fin 4) : Fintype (Column s b) := by + unfold Column; split_ifs <;> infer_instance +instance rowDecidableEq (s : Fin 3) (b : Fin 4) : DecidableEq (Row s b) := by + unfold Row; split_ifs <;> infer_instance +instance middleDecidableEq (s : Fin 3) (b : Fin 4) : DecidableEq (Middle s b) := by + unfold Middle; split_ifs <;> infer_instance +instance columnDecidableEq (s : Fin 3) (b : Fin 4) : DecidableEq (Column s b) := by + unfold Column; split_ifs <;> infer_instance + +abbrev Word := Fin 2 → Fin 7 + +def shape (s : Fin 3) : Fin 3 → ℕ := fun i => if i = s then 2 else 1 + +def source (F : Type*) [CommRing F] (s : Fin 3) : Tensor F Word Word Word := + CWStrands.shapeTensor (Fin 2) (shape s) + +def canonicalAtom : Fin 4 → (Fin 3 → ℕ) := + ![![1, 1, 0], ![0, 0, 2], ![1, 0, 1], ![0, 1, 1]] + +def branchAtom (s : Fin 3) (b : Fin 4) : Fin 3 → ℕ := + if s = 0 then ![canonicalAtom b 2, canonicalAtom b 1, canonicalAtom b 0] + else if s = 1 then ![canonicalAtom b 0, canonicalAtom b 2, canonicalAtom b 1] + else canonicalAtom b + +def branchSource (F : Type*) [CommRing F] (s : Fin 3) (b : Fin 4) : + Tensor F Word Word Word := + fun x y z => + if CWLeafStatistics.weight (x 0) = branchAtom s b 0 ∧ + CWLeafStatistics.weight (y 0) = branchAtom s b 1 ∧ + CWLeafStatistics.weight (z 0) = branchAtom s b 2 + then source F s x y z else 0 + +abbrev Positions (counts : Fin 4 → ℕ) := Σ b : Fin 4, Fin (counts b) + +abbrev RowWords (s : Fin 3) (counts : Fin 4 → ℕ) := + ∀ p : Positions counts, Row s p.1 +abbrev MiddleWords (s : Fin 3) (counts : Fin 4 → ℕ) := + ∀ p : Positions counts, Middle s p.1 +abbrev ColumnWords (s : Fin 3) (counts : Fin 4 → ℕ) := + ∀ p : Positions counts, Column s p.1 + +def singleCount (counts : Fin 4 → ℕ) : ℕ := counts 0 + counts 1 +def crossCount (counts : Fin 4 → ℕ) : ℕ := counts 2 + counts 3 +def totalCount (counts : Fin 4 → ℕ) : ℕ := singleCount counts + crossCount counts + +variable (F : Type*) [CommRing F] + +theorem coefficient_swapXZ (x y z : Fin 7) : + FieldCW.tensor F 5 x y z = FieldCW.tensor F 5 z y x := by + simp only [FieldCW.tensor, Finset.sum_add_distrib, + mul_assoc, mul_comm, mul_left_comm] + ring + +theorem coefficient_swapYZ (x y z : Fin 7) : + FieldCW.tensor F 5 x y z = FieldCW.tensor F 5 x z y := by + simp only [FieldCW.tensor, Finset.sum_add_distrib, + mul_assoc, mul_comm, mul_left_comm] + ring + +theorem source_zero_apply (x y z : Word) : + source F 0 x y z = source F 2 z y x := by + have hs : CWStrands.strand (F := F) (Fin 2) x y z = + CWStrands.strand (F := F) (Fin 2) z y x := by + apply Finset.prod_congr rfl + intro i hi + exact coefficient_swapXZ F (x i) (y i) (z i) + simp [source, CWStrands.shapeTensor, shape, hs, and_comm, and_assoc] + +theorem source_one_apply (x y z : Word) : + source F 1 x y z = source F 2 x z y := by + have hs : CWStrands.strand (F := F) (Fin 2) x y z = + CWStrands.strand (F := F) (Fin 2) x z y := by + apply Finset.prod_congr rfl + intro i hi + exact coefficient_swapYZ F (x i) (y i) (z i) + simp [source, CWStrands.shapeTensor, shape, hs, and_comm] + +theorem source_two : source F 2 = + CWStrands.shapeTensor (F := F) (Fin 2) ![1, 1, 2] := by + congr 1 + +theorem canonical_pullback (b : Fin 4) : + ∃ (a : (SmallRow b × SmallInner b) → Word) + (c : (SmallInner b × SmallRow b) → Word) + (e : (SmallRow b × SmallRow b) → Word), + Tensor.pullback a c e (source F 2) = + Tensor.matrixCoefficients (SmallRow b) (SmallInner b) (SmallRow b) := by + rw [source_two] + fin_cases b + · exact ⟨_, _, _, CWStageC.branch1 F⟩ + · exact ⟨_, _, _, CWStageC.branch0 F⟩ + · exact ⟨_, _, _, CWStageC.branch3 F⟩ + · exact ⟨_, _, _, CWStageC.branch2 F⟩ + +theorem canonical_masked_pullback (b : Fin 4) : + ∃ (a : (SmallRow b × SmallInner b) → Word) + (c : (SmallInner b × SmallRow b) → Word) + (e : (SmallRow b × SmallRow b) → Word), + Tensor.pullback a c e (branchSource F 2 b) = + Tensor.matrixCoefficients (SmallRow b) (SmallInner b) (SmallRow b) := by + fin_cases b + · refine ⟨(fun x : Unit × Fin 5 => ![CWStageC.interior x.2, 0]), + (fun y : Fin 5 × Unit => ![CWStageC.interior y.1, 0]), + (fun _ : Unit × Unit => ![0, 6]), ?_⟩ + funext x y z + have h := congrFun (congrFun (congrFun (CWStageC.branch1 F) x) y) z + simp [Tensor.pullback, branchSource, branchAtom, canonicalAtom, + CWStageC.zero_weight, CWStageC.interior_weight, source_two] + exact h + · refine ⟨(fun x : Unit × Fin 5 => ![0, CWStageC.interior x.2]), + (fun y : Fin 5 × Unit => ![0, CWStageC.interior y.1]), + (fun _ : Unit × Unit => ![6, 0]), ?_⟩ + funext x y z + have h := congrFun (congrFun (congrFun (CWStageC.branch0 F) x) y) z + simp [Tensor.pullback, branchSource, branchAtom, canonicalAtom, + CWStageC.zero_weight, CWStageC.last_weight, source_two] + exact h + · refine ⟨(fun x : Fin 5 × Unit => ![CWStageC.interior x.1, 0]), + (fun y : Unit × Fin 5 => ![0, CWStageC.interior y.2]), + (fun z : Fin 5 × Fin 5 => ![CWStageC.interior z.2, CWStageC.interior z.1]), ?_⟩ + funext x y z + have h := congrFun (congrFun (congrFun (CWStageC.branch3 F) x) y) z + simp [Tensor.pullback, branchSource, branchAtom, canonicalAtom, + CWStageC.zero_weight, CWStageC.interior_weight, source_two] + exact h + · refine ⟨(fun x : Fin 5 × Unit => ![0, CWStageC.interior x.1]), + (fun y : Unit × Fin 5 => ![CWStageC.interior y.2, 0]), + (fun z : Fin 5 × Fin 5 => ![CWStageC.interior z.1, CWStageC.interior z.2]), ?_⟩ + funext x y z + have h := congrFun (congrFun (congrFun (CWStageC.branch2 F) x) y) z + simp [Tensor.pullback, branchSource, branchAtom, canonicalAtom, + CWStageC.zero_weight, CWStageC.interior_weight, source_two] + exact h + +theorem branchSource_zero_apply (b : Fin 4) (x y z : Word) : + branchSource F 0 b x y z = branchSource F 2 b z y x := by + simp [branchSource, branchAtom, source_zero_apply, + and_comm, and_assoc] + +theorem branchSource_one_apply (b : Fin 4) (x y z : Word) : + branchSource F 1 b x y z = branchSource F 2 b x z y := by + simp [branchSource, branchAtom, source_one_apply, + and_comm] + +theorem oriented_pullback (s : Fin 3) (b : Fin 4) : + ∃ (a : (Row s b × Middle s b) → Word) + (c : (Middle s b × Column s b) → Word) + (e : (Column s b × Row s b) → Word), + Tensor.pullback a c e (source F s) = + Tensor.matrixCoefficients (Row s b) (Middle s b) (Column s b) := by + obtain ⟨a, c, e, h⟩ := canonical_pullback F b + fin_cases s + all_goals dsimp [Row, Middle, Column] + · refine ⟨fun x => e x.swap, fun y => c y.swap, fun z => a z.swap, ?_⟩ + funext x y z + have hh := congrFun (congrFun (congrFun h z.swap) y.swap) x.swap + simpa [Tensor.pullback, source_zero_apply, Prod.swap, + Tensor.matrixCoefficients, eq_comm, and_comm, and_left_comm, and_assoc] using hh + · refine ⟨fun x => a x.swap, fun y => e y.swap, fun z => c z.swap, ?_⟩ + funext x y z + have hh := congrFun (congrFun (congrFun h x.swap) z.swap) y.swap + simpa [Tensor.pullback, source_one_apply, Prod.swap, + Tensor.matrixCoefficients, eq_comm, and_comm, and_left_comm, and_assoc] using hh + · exact ⟨a, c, e, h⟩ + +theorem oriented_masked_pullback (s : Fin 3) (b : Fin 4) : + ∃ (a : (Row s b × Middle s b) → Word) + (c : (Middle s b × Column s b) → Word) + (e : (Column s b × Row s b) → Word), + Tensor.pullback a c e (branchSource F s b) = + Tensor.matrixCoefficients (Row s b) (Middle s b) (Column s b) := by + obtain ⟨a, c, e, h⟩ := canonical_masked_pullback F b + fin_cases s + all_goals dsimp [Row, Middle, Column] + · refine ⟨fun x => e x.swap, fun y => c y.swap, fun z => a z.swap, ?_⟩ + funext x y z + have hh := congrFun (congrFun (congrFun h z.swap) y.swap) x.swap + simpa [Tensor.pullback, branchSource_zero_apply, Prod.swap, + Tensor.matrixCoefficients, eq_comm, and_comm, and_left_comm, and_assoc] using hh + · refine ⟨fun x => a x.swap, fun y => e y.swap, fun z => c z.swap, ?_⟩ + funext x y z + have hh := congrFun (congrFun (congrFun h x.swap) z.swap) y.swap + simpa [Tensor.pullback, branchSource_one_apply, Prod.swap, + Tensor.matrixCoefficients, eq_comm, and_comm, and_left_comm, and_assoc] using hh + · exact ⟨a, c, e, h⟩ + +theorem oriented_restriction (s : Fin 3) (b : Fin 4) : + ∃ (a : (Row s b × Middle s b) → Word → F) + (c : (Middle s b × Column s b) → Word → F) + (e : (Column s b × Row s b) → Word → F), + Tensor.restrict a c e (branchSource F s b) = + Tensor.matrixCoefficients (Row s b) (Middle s b) (Column s b) := by + classical + obtain ⟨a, c, e, h⟩ := oriented_masked_pullback F s b + refine ⟨(fun x w => if w = a x then 1 else 0), + (fun y w => if w = c y then 1 else 0), + (fun z w => if w = e z then 1 else 0), ?_⟩ + rw [← Tensor.pullback_eq_restrict] + exact h + +def productSource (s : Fin 3) (counts : Fin 4 → ℕ) : + Tensor F (Positions counts → Word) (Positions counts → Word) (Positions counts → Word) := + CommonDimensions.familyProduct (fun p : Positions counts => branchSource F s p.1) + +theorem product_restriction (s : Fin 3) (counts : Fin 4 → ℕ) : + ∃ (a : (RowWords s counts × MiddleWords s counts) → (Positions counts → Word) → F) + (c : (MiddleWords s counts × ColumnWords s counts) → (Positions counts → Word) → F) + (e : (ColumnWords s counts × RowWords s counts) → (Positions counts → Word) → F), + Tensor.restrict a c e (productSource F s counts) = + Tensor.matrixCoefficients (RowWords s counts) (MiddleWords s counts) + (ColumnWords s counts) := by + classical + choose a c e h using fun p : Positions counts => oriented_restriction F s p.1 + exact TerminalProducts.matrix_restriction_of_history_restrictions + (fun p : Positions counts => branchSource F s p.1) + (fun p => Row s p.1) (fun p => Middle s p.1) (fun p => Column s p.1) a c e h + +end MatrixMultiplication.CWStageCProducts + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/CoppersmithWinograd/CWStageCShapeProducts.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/CoppersmithWinograd/CWStageCShapeProducts.lean new file mode 100644 index 0000000000000000000000000000000000000000..c3170af9d66982e6f5a8f5eecaeb2149ba11858f --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/CoppersmithWinograd/CWStageCShapeProducts.lean @@ -0,0 +1,116 @@ +import OAI.LinearAlgebra.MatrixMultiplication.CoppersmithWinograd.CWStageCChildProducts + +namespace OAI + +/-! Coppersmith–Winograd tensors, tensor powers and local restrictions. -/ + +noncomputable section + +open MatrixMultiplication.Foundation + +namespace MatrixMultiplication.CWStageCProducts + +abbrev ChildWords := (Fin 1 → Fin 7) × (Fin 1 → Fin 7) + +def singletonChildWords (p : ChildPair) : ChildWords := + (fun _ => p.1, fun _ => p.2) + +def collapseChildWords (w : ChildWords) : ChildPair := (w.1 0, w.2 0) + +@[simp] theorem singleton_collapse_childWords (w : ChildWords) : + singletonChildWords (collapseChildWords w) = w := by + apply Prod.ext <;> funext i <;> fin_cases i <;> rfl + +def placedShapeChildProduct (F : Type*) [CommRing F] (s : Fin 3) + (phi : Equiv.Perm (Fin 3)) (b : Fin 4) : Tensor F ChildWords ChildWords ChildWords := + Tensor.product + (CWStrands.shapeTensor (Fin 1) (fun i => branchAtom s b (phi.symm i))) + (CWStrands.shapeTensor (Fin 1) + (fun i => shape s (phi.symm i) - branchAtom s b (phi.symm i))) + +theorem placedShapeChildProduct_eq_stageC (F : Type*) [CommRing F] + (u : AllFieldParameters.Shape) (hu : u ∈ AllFieldParameters.shapes 4) + (hpos : AllFieldParameters.positive u = true) + (phi : Equiv.Perm (Fin 3)) (b : Fin 4) : + placedShapeChildProduct F (AllFieldHistory.stageCDistinguished u) phi b = + Tensor.product + (CWStrands.shapeTensor (Fin 1) (fun i => AllFieldHistory.stageCAtom u b (phi.symm i))) + (CWStrands.shapeTensor (Fin 1) (fun i => u (phi.symm i) - + AllFieldHistory.stageCAtom u b (phi.symm i))) := by + unfold placedShapeChildProduct + rw [branchAtom_eq_stageCAtom, shape_eq_parent u hu hpos] + +theorem placedShapeChildProduct_pullback (F : Type*) [CommRing F] (s : Fin 3) + (phi : Equiv.Perm (Fin 3)) (b : Fin 4) : + Tensor.pullback singletonChildWords singletonChildWords singletonChildWords + (placedShapeChildProduct F s phi b) = placedChildProduct F s phi b := by + rw [placedChildProduct_eq] + funext x y z + have hL := congrFun (congrFun (congrFun + (siteTensor_eq_shapeTensor F (fun i => branchAtom s b (phi.symm i))) x.1) y.1) z.1 + have hR := congrFun (congrFun (congrFun + (siteTensor_eq_shapeTensor F + (fun i => shape s (phi.symm i) - branchAtom s b (phi.symm i))) x.2) y.2) z.2 + exact congrArg₂ (fun a b : F => a * b) hL hR + +theorem placedShapeChildProduct_restriction (F : Type*) [CommRing F] (s : Fin 3) + (phi : Equiv.Perm (Fin 3)) (b : Fin 4) : + ∃ (a : (Row (phi s) b × Middle (phi s) b) → ChildWords → F) + (c : (Middle (phi s) b × Column (phi s) b) → ChildWords → F) + (e : (Column (phi s) b × Row (phi s) b) → ChildWords → F), + Tensor.restrict a c e (placedShapeChildProduct F s phi b) = + Tensor.matrixCoefficients (Row (phi s) b) (Middle (phi s) b) (Column (phi s) b) := by + classical + let E : ChildPair → ChildWords → F := fun p w => if w = singletonChildWords p then 1 else 0 + have hE : Tensor.restrict E E E (placedShapeChildProduct F s phi b) = + placedChildProduct F s phi b := by + rw [← Tensor.pullback_eq_restrict] + exact placedShapeChildProduct_pullback F s phi b + obtain ⟨a, c, e, h⟩ := placedChildProduct_restriction F s phi b + refine ⟨Tensor.composeRestrictionMatrix a E, Tensor.composeRestrictionMatrix c E, + Tensor.composeRestrictionMatrix e E, ?_⟩ + rw [← Tensor.restrict_restrict, hE, h] + +def placedShapeChildProducts (F : Type*) [CommRing F] (s : Fin 3) + (phi : Equiv.Perm (Fin 3)) (counts : Fin 4 → ℕ) : + Tensor F (Positions counts → ChildWords) (Positions counts → ChildWords) + (Positions counts → ChildWords) := + CommonDimensions.familyProduct + (fun p : Positions counts => placedShapeChildProduct F s phi p.1) + +theorem placedShapeChildProducts_collapse (F : Type*) [CommRing F] (s : Fin 3) + (phi : Equiv.Perm (Fin 3)) (counts : Fin 4 → ℕ) + (x y z : Positions counts → ChildWords) : + placedChildProducts F s phi counts (collapseChildWords ∘ x) + (collapseChildWords ∘ y) (collapseChildWords ∘ z) = + placedShapeChildProducts F s phi counts x y z := by + dsimp only [placedChildProducts, placedShapeChildProducts, CommonDimensions.familyProduct] + apply Finset.prod_congr rfl + intro p _ + have h := congrFun (congrFun (congrFun (placedShapeChildProduct_pullback F s phi p.1) + (collapseChildWords (x p))) (collapseChildWords (y p))) (collapseChildWords (z p)) + simpa only [Tensor.pullback, singleton_collapse_childWords, Function.comp_apply] using h.symm + +theorem placedShapeChildProducts_restriction (F : Type*) [CommRing F] (s : Fin 3) + (phi : Equiv.Perm (Fin 3)) (counts : Fin 4 → ℕ) : + ∃ (a : (RowWords (phi s) counts × MiddleWords (phi s) counts) → + (Positions counts → ChildWords) → F) + (c : (MiddleWords (phi s) counts × ColumnWords (phi s) counts) → + (Positions counts → ChildWords) → F) + (e : (ColumnWords (phi s) counts × RowWords (phi s) counts) → + (Positions counts → ChildWords) → F), + Tensor.restrict a c e (placedShapeChildProducts F s phi counts) = + Tensor.matrixCoefficients (RowWords (phi s) counts) (MiddleWords (phi s) counts) + (ColumnWords (phi s) counts) := by + classical + choose a c e h using fun p : Positions counts => placedShapeChildProduct_restriction F s phi p.1 + exact TerminalProducts.matrix_restriction_of_history_restrictions + (fun p : Positions counts => placedShapeChildProduct F s phi p.1) + (fun p => Row (phi s) p.1) (fun p => Middle (phi s) p.1) + (fun p => Column (phi s) p.1) a c e h + +end MatrixMultiplication.CWStageCProducts + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/CoppersmithWinograd/CWStageCStatistics.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/CoppersmithWinograd/CWStageCStatistics.lean new file mode 100644 index 0000000000000000000000000000000000000000..0708375382a873ea79e1ee5698e08097738ddf8d --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/CoppersmithWinograd/CWStageCStatistics.lean @@ -0,0 +1,156 @@ +import OAI.LinearAlgebra.MatrixMultiplication.CoppersmithWinograd.CWCompleteStatistics +import OAI.LinearAlgebra.MatrixMultiplication.CoppersmithWinograd.CWStageCShapeProducts + +namespace OAI + +/-! Coppersmith–Winograd tensors, tensor powers and local restrictions. -/ + +noncomputable section + +open scoped BigOperators +open MatrixMultiplication.Foundation + +namespace MatrixMultiplication.CWStageCProducts + +attribute [local instance] Classical.propDecidable Classical.decEq + +def branchStatistic (s : Fin 3) (b : Fin 4) (i : Fin 3) : Fin 6 := + if i = s then if b.val < 2 then 3 else 2 else 1 + +theorem twoStatistic_of_side_weights (s : Fin 3) (b : Fin 4) (i : Fin 3) + (w : Word) + (hleft : CWLeafStatistics.weight (w 0) = branchAtom s b i) + (hright : CWLeafStatistics.weight (w 1) = shape s i - branchAtom s b i) : + CWCompleteStatistics.twoStatistic w = branchStatistic s b i := by + change CWLeafStatistics.pairStatistic (w 0, w 1) = _ + unfold CWLeafStatistics.pairStatistic + dsimp only + rw [hleft, hright] + fin_cases s <;> fin_cases b <;> fin_cases i <;> decide + +theorem placed_twoStatistic_of_side_weights (s : Fin 3) + (phi : Equiv.Perm (Fin 3)) (b : Fin 4) (i : Fin 3) (w : Word) + (hleft : CWLeafStatistics.weight (w 0) = branchAtom s b (phi.symm i)) + (hright : CWLeafStatistics.weight (w 1) = + shape s (phi.symm i) - branchAtom s b (phi.symm i)) : + CWCompleteStatistics.twoStatistic w = branchStatistic s b (phi.symm i) := + twoStatistic_of_side_weights s b (phi.symm i) w hleft hright + +theorem wordPopulation_of_branchStatistic (counts : Fin 4 → ℕ) (s i : Fin 3) + (w : Positions counts → Fin 6) + (hw : ∀ p, w p = branchStatistic s p.1 i) (a : Fin 6) : + wordPopulation w a = + ∑ b : Fin 4, if branchStatistic s b i = a then counts b else 0 := by + let e : {p : Positions counts // w p = a} ≃ + (Σ b : Fin 4, {j : Fin (counts b) // branchStatistic s b i = a}) := + { toFun := fun p => ⟨p.val.1, ⟨p.val.2, (hw p.val).symm.trans p.property⟩⟩ + invFun := fun p => ⟨⟨p.1, p.2.val⟩, (hw _).trans p.2.property⟩ + left_inv := by intro p; rfl + right_inv := by intro p; rfl } + rw [wordPopulation, Fintype.card_congr e, Fintype.card_sigma] + apply Finset.sum_congr rfl + intro b _ + by_cases h : branchStatistic s b i = a <;> simp [h] + +theorem empiricalLaw_eq_littleLaw (counts : Fin 4 → ℕ) + (t u : AllFieldParameters.Shape) (hu : u ∈ AllFieldParameters.shapes 4) + (hpos : AllFieldParameters.positive u = true) (n : ℕ) (hn : 0 < n) + (hc : ∀ b, (counts b : ℚ) = (n : ℚ) * AllFieldHistory.stageCWeight t u b) + (i : Fin 3) (w : Positions counts → Fin 6) + (hw : ∀ p, w p = branchStatistic (AllFieldHistory.stageCDistinguished u) p.1 i) : + InheritedMasks.empiricalLaw w = + fun a => (AllFieldParameters.littleLaw t u i a : ℝ) := by + have hcard : Fintype.card (Positions counts) = n := by + apply Nat.cast_injective (R := ℚ) + calc + (Fintype.card (Positions counts) : ℚ) = ∑ b, (counts b : ℚ) := by + simp [Positions, Fintype.card_sigma] + _ = n := by + simp only [hc, ← Finset.mul_sum, AllFieldHistory.stageCWeight_normalized, mul_one] + have hshape : u i = if i = AllFieldHistory.stageCDistinguished u then 2 else 1 := by + exact congrFun (shape_eq_parent u hu hpos).symm i + have hcount (a : Fin 6) : (wordPopulation w a : ℚ) = + (n : ℚ) * AllFieldParameters.littleLaw t u i a := by + rw [wordPopulation_of_branchStatistic counts _ i w hw a] + simp only [Nat.cast_sum, Nat.cast_ite, Nat.cast_zero] + simp_rw [hc] + simp only [AllFieldParameters.littleLaw, hshape] + by_cases hi : i = AllFieldHistory.stageCDistinguished u <;> + fin_cases a <;> + simp [branchStatistic, hi, Fin.sum_univ_succ, + AllFieldParameters.singletonSlot, + AllFieldHistory.stageCWeight] <;> ring + funext a + have hr : (wordPopulation w a : ℝ) = + (n : ℝ) * (AllFieldParameters.littleLaw t u i a : ℝ) := by + exact_mod_cast hcount a + have hn' : (n : ℝ) ≠ 0 := by exact_mod_cast (ne_of_gt hn) + rw [InheritedMasks.empiricalLaw, hr, hcard] + exact mul_div_cancel_left₀ _ hn' + +theorem typeWindow_of_placed_side_weights (counts : Fin 4 → ℕ) + (t u : AllFieldParameters.Shape) (hu : u ∈ AllFieldParameters.shapes 4) + (hpos : AllFieldParameters.positive u = true) (n : ℕ) (hn : 0 < n) + (hc : ∀ b, (counts b : ℚ) = (n : ℚ) * AllFieldHistory.stageCWeight t u b) + (phi : Equiv.Perm (Fin 3)) (i : Fin 3) (w : Positions counts → Word) + (hweights : ∀ p, + CWLeafStatistics.weight (w p 0) = + branchAtom (AllFieldHistory.stageCDistinguished u) p.1 (phi.symm i) ∧ + CWLeafStatistics.weight (w p 1) = + shape (AllFieldHistory.stageCDistinguished u) (phi.symm i) - + branchAtom (AllFieldHistory.stageCDistinguished u) p.1 (phi.symm i)) + (η : ℝ) (hη : 0 ≤ η) : + InheritedMasks.typeWindow + (fun a : Fin 6 => (AllFieldParameters.littleLaw t u (phi.symm i) a : ℝ)) η + (fun p => CWCompleteStatistics.twoStatistic (w p)) := by + have he := empiricalLaw_eq_littleLaw counts t u hu hpos n hn hc (phi.symm i) + (fun p => CWCompleteStatistics.twoStatistic (w p)) (fun p => + twoStatistic_of_side_weights _ _ _ _ (hweights p).1 (hweights p).2) + intro a + rw [he] + simpa only [sub_self, abs_zero] using hη + +theorem placedChildProducts_support_typeWindow (F : Type*) [CommRing F] + (counts : Fin 4 → ℕ) (t u : AllFieldParameters.Shape) + (hu : u ∈ AllFieldParameters.shapes 4) (hpos : AllFieldParameters.positive u = true) + (n : ℕ) (hn : 0 < n) + (hc : ∀ b, (counts b : ℚ) = (n : ℚ) * AllFieldHistory.stageCWeight t u b) + (phi : Equiv.Perm (Fin 3)) (x y z : Positions counts → ChildPair) + (hne : placedChildProducts F (AllFieldHistory.stageCDistinguished u) phi counts x y z ≠ 0) + (i : Fin 3) (η : ℝ) (hη : 0 ≤ η) : + InheritedMasks.typeWindow + (fun a : Fin 6 => (AllFieldParameters.littleLaw t u (phi.symm i) a : ℝ)) η + (fun p => CWCompleteStatistics.twoStatistic (joinChildren (![x p, y p, z p] i))) := by + apply typeWindow_of_placed_side_weights counts t u hu hpos n hn hc phi i + (fun p => joinChildren (![x p, y p, z p] i)) _ η hη + intro p + exact placedChildProducts_side_weights F _ phi counts x y z hne p i + +theorem placedShapeChildProducts_support_typeWindow (F : Type*) [CommRing F] + (counts : Fin 4 → ℕ) (t u : AllFieldParameters.Shape) + (hu : u ∈ AllFieldParameters.shapes 4) (hpos : AllFieldParameters.positive u = true) + (n : ℕ) (hn : 0 < n) + (hc : ∀ b, (counts b : ℚ) = (n : ℚ) * AllFieldHistory.stageCWeight t u b) + (phi : Equiv.Perm (Fin 3)) (x y z : Positions counts → ChildWords) + (hne : placedShapeChildProducts F (AllFieldHistory.stageCDistinguished u) + phi counts x y z ≠ 0) + (i : Fin 3) (η : ℝ) (hη : 0 ≤ η) : + InheritedMasks.typeWindow + (fun a : Fin 6 => (AllFieldParameters.littleLaw t u (phi.symm i) a : ℝ)) η + (fun p => CWCompleteStatistics.twoStatistic + (joinChildren (collapseChildWords (![x p, y p, z p] i)))) := by + have hcollapse : placedChildProducts F (AllFieldHistory.stageCDistinguished u) + phi counts (collapseChildWords ∘ x) (collapseChildWords ∘ y) + (collapseChildWords ∘ z) ≠ 0 := by + rw [placedShapeChildProducts_collapse] + exact hne + have hwindow := placedChildProducts_support_typeWindow F counts t u hu hpos n hn hc + phi (collapseChildWords ∘ x) (collapseChildWords ∘ y) (collapseChildWords ∘ z) + hcollapse i η hη + fin_cases i <;> exact hwindow + +end MatrixMultiplication.CWStageCProducts + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/CoppersmithWinograd/CWStrandCompatibility.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/CoppersmithWinograd/CWStrandCompatibility.lean new file mode 100644 index 0000000000000000000000000000000000000000..3a15d3da09735bf2210263224ea82d2a417e03cb --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/CoppersmithWinograd/CWStrandCompatibility.lean @@ -0,0 +1,87 @@ +import OAI.LinearAlgebra.MatrixMultiplication.CoppersmithWinograd.CWStrands + +namespace OAI + +/-! Coppersmith–Winograd tensors, tensor powers and local restrictions. -/ + +noncomputable section + +namespace MatrixMultiplication.CWStrandCompatibility + +open MatrixMultiplication.Foundation CWStrands CWCompatibilityTransfer InheritedMasks +open scoped BigOperators + +variable {F : Type*} [CommRing F] + +theorem shape_nonzero_power {n : ℕ} (g : Fin 3 → ℕ) + (x y z : Fin n → Fin 7) (h : shapeTensor (F := F) (Fin n) g x y z ≠ 0) : + Tensor.power (FieldCW.tensor F 5) n x y z ≠ 0 := by + have hm := shapeTensor_support g x y z h + simpa only [shapeTensor, ite_eq_left hm, strand, Tensor.power] using h + +section Classes + +variable {P A : Type*} [Fintype P] [DecidableEq P] + [Fintype A] [DecidableEq A] {n : ℕ} + (g : P → Fin 3 → ℕ) (x y z : P → (Fin n → Fin 7)) + (h : (∏ i, shapeTensor (F := F) (Fin n) (g i) (x i) (y i) (z i)) ≠ 0) + (statistic : (Fin n → Fin 7) → A) (κ : A ≃ A) + (hstatistic : ∀ w, statistic (wordComplement w) = κ (statistic w)) + (ν : A → ℝ) (η : ℝ) + +include h + +omit [DecidableEq P] in +theorem class_coefficient_nonzero (i : P) : + shapeTensor (F := F) (Fin n) (g i) (x i) (y i) (z i) ≠ 0 := by + intro hi + exact h (Finset.prod_eq_zero (Finset.mem_univ i) hi) + +include hstatistic + +theorem zeroZ_transfer (hg : ∀ i, g i 2 = 0) + (hx : typeWindow ν η (fun i => statistic (x i))) : + typeWindow (ν ∘ κ.symm) η (fun i => statistic (y i)) := by + apply transfer_window statistic κ hstatistic x y _ ν η hx + intro i + have hi := class_coefficient_nonzero g x y z h i + have hm := shapeTensor_support (g i) (x i) (y i) (z i) hi + have hz : wordWeight (z i) = 0 := by + change weight (z i) = 0 + exact hm.2.2.trans (hg i) + exact zeroZ_word_match (x i) (y i) (z i) + (shape_nonzero_power (g i) (x i) (y i) (z i) hi) hz + +theorem zeroY_transfer (hg : ∀ i, g i 1 = 0) + (hx : typeWindow ν η (fun i => statistic (x i))) : + typeWindow (ν ∘ κ.symm) η (fun i => statistic (z i)) := by + apply transfer_window statistic κ hstatistic x z _ ν η hx + intro i + have hi := class_coefficient_nonzero g x y z h i + have hm := shapeTensor_support (g i) (x i) (y i) (z i) hi + have hy : wordWeight (y i) = 0 := by + change weight (y i) = 0 + exact hm.2.1.trans (hg i) + exact zeroY_word_match (x i) (y i) (z i) + (shape_nonzero_power (g i) (x i) (y i) (z i) hi) hy + +theorem zeroX_transfer (hg : ∀ i, g i 0 = 0) + (hy : typeWindow ν η (fun i => statistic (y i))) : + typeWindow (ν ∘ κ.symm) η (fun i => statistic (z i)) := by + apply transfer_window statistic κ hstatistic y z _ ν η hy + intro i + have hi := class_coefficient_nonzero g x y z h i + have hm := shapeTensor_support (g i) (x i) (y i) (z i) hi + have hx : wordWeight (x i) = 0 := by + change weight (x i) = 0 + exact hm.1.trans (hg i) + exact zeroX_word_match (x i) (y i) (z i) + (shape_nonzero_power (g i) (x i) (y i) (z i) hi) hx + +end Classes + +end MatrixMultiplication.CWStrandCompatibility + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/CoppersmithWinograd/CWStrands.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/CoppersmithWinograd/CWStrands.lean new file mode 100644 index 0000000000000000000000000000000000000000..719de8b0e60e719e07704c89e88e4cbb904ffb7f --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/CoppersmithWinograd/CWStrands.lean @@ -0,0 +1,152 @@ +import OAI.LinearAlgebra.MatrixMultiplication.CoppersmithWinograd.CWCompatibilityTransfer + +namespace OAI + +/-! Coppersmith–Winograd tensors, tensor powers and local restrictions. -/ + +noncomputable section + +namespace MatrixMultiplication.CWStrands + +open MatrixMultiplication.Foundation +open scoped BigOperators + +variable {F : Type*} [CommRing F] + +private theorem site_weight_zero_support (x y z : Fin 7) (hx : x.val = 0) + (h : FieldCW.tensor F 5 x y z ≠ 0) : + CWLeafStatistics.weight x + CWLeafStatistics.weight y + CWLeafStatistics.weight z = 2 := by + rw [FieldCW.tensor_zero_side F 5 x y z hx] at h + have hs : (y.val = 0 ∧ z.val = 6) ∨ (y.val = 6 ∧ z.val = 0) ∨ + (1 ≤ y.val ∧ y.val ≤ 5 ∧ y = z) := by + by_contra hs + exact h (ite_eq_right hs) + rcases hs with ⟨hy, hz⟩ | ⟨hy, hz⟩ | ⟨hylo, hyhi, hyz⟩ + · simp [CWLeafStatistics.weight, hx, hy, hz] + · simp [CWLeafStatistics.weight, hx, hy, hz] + · subst z + have hy0 : y.val ≠ 0 := by omega + have hy6 : y.val ≠ 6 := by omega + simp [CWLeafStatistics.weight, hx, hy0, hy6] + +theorem site_weight_support (x y z : Fin 7) + (h : FieldCW.tensor F 5 x y z ≠ 0) : + CWLeafStatistics.weight x + CWLeafStatistics.weight y + CWLeafStatistics.weight z = 2 := by + by_cases hx : x.val = 0 + · exact site_weight_zero_support x y z hx h + by_cases hy : y.val = 0 + · rw [FieldCW.tensor_cyclic F 5 x y z] at h + have hw := site_weight_zero_support y z x hy h + omega + by_cases hz : z.val = 0 + · rw [FieldCW.tensor_cyclic F 5 x y z, FieldCW.tensor_cyclic F 5 y z x] at h + have hw := site_weight_zero_support z x y hz h + omega + · exact False.elim (h (by simp [FieldCW.tensor, FieldCW.zeroForm, hx, hy, hz])) + +def weight {P : Type*} [Fintype P] (w : P → Fin 7) : ℕ := + ∑ i, CWLeafStatistics.weight (w i) + +def strand (P : Type*) [Fintype P] : Tensor F (P → Fin 7) (P → Fin 7) (P → Fin 7) := + fun x y z => ∏ i, FieldCW.tensor F 5 (x i) (y i) (z i) + +theorem strand_support {P : Type*} [Fintype P] + (x y z : P → Fin 7) (h : strand (F := F) P x y z ≠ 0) : + weight x + weight y + weight z = 2 * Fintype.card P := by + have hi (i : P) : FieldCW.tensor F 5 (x i) (y i) (z i) ≠ 0 := by + intro he + exact h (Finset.prod_eq_zero (Finset.mem_univ i) he) + calc + weight x + weight y + weight z = + ∑ i, (CWLeafStatistics.weight (x i) + CWLeafStatistics.weight (y i) + + CWLeafStatistics.weight (z i)) := by simp [weight, Finset.sum_add_distrib] + _ = ∑ _i : P, 2 := Finset.sum_congr rfl (fun i _ => site_weight_support _ _ _ (hi i)) + _ = 2 * Fintype.card P := by simp [Nat.mul_comm] + +def shapeTensor (P : Type*) [Fintype P] (g : Fin 3 → ℕ) : + Tensor F (P → Fin 7) (P → Fin 7) (P → Fin 7) := + fun x y z => if weight x = g 0 ∧ weight y = g 1 ∧ weight z = g 2 + then strand P x y z else 0 + +theorem shapeTensor_support {P : Type*} [Fintype P] + (g : Fin 3 → ℕ) (x y z : P → Fin 7) + (h : shapeTensor (F := F) P g x y z ≠ 0) : + weight x = g 0 ∧ weight y = g 1 ∧ weight z = g 2 := by + classical + by_contra hn + exact h (ite_eq_right hn) + +theorem weight_sum_elim {P Q : Type*} [Fintype P] [Fintype Q] + (x : P → Fin 7) (y : Q → Fin 7) : + weight (Sum.elim x y) = weight x + weight y := by + simp [weight, Fintype.sum_sum_type] + +theorem strand_sum_elim {P Q : Type*} [Fintype P] [Fintype Q] + (x : (P → Fin 7) × (Q → Fin 7)) + (y : (P → Fin 7) × (Q → Fin 7)) + (z : (P → Fin 7) × (Q → Fin 7)) : + strand (F := F) (P ⊕ Q) (Sum.elim x.1 x.2) (Sum.elim y.1 y.2) (Sum.elim z.1 z.2) = + Tensor.product (strand P) (strand Q) x y z := by + simp [strand, Tensor.product, Fintype.prod_sum_type] + +theorem shape_split {P Q : Type*} [Fintype P] [Fintype Q] + (u v : Fin 3 → ℕ) + (x : (P → Fin 7) × (Q → Fin 7)) + (y : (P → Fin 7) × (Q → Fin 7)) + (z : (P → Fin 7) × (Q → Fin 7)) : + (if weight x.1 = u 0 ∧ weight y.1 = u 1 ∧ weight z.1 = u 2 then + shapeTensor (F := F) (P ⊕ Q) (u + v) (Sum.elim x.1 x.2) (Sum.elim y.1 y.2) + (Sum.elim z.1 z.2) else 0) = + Tensor.product (shapeTensor P u) (shapeTensor Q v) x y z := by + classical + simp only [shapeTensor, weight_sum_elim, Pi.add_apply, strand_sum_elim, + Tensor.product] + by_cases hx : weight x.1 = u 0 + · by_cases hy : weight y.1 = u 1 + · by_cases hz : weight z.1 = u 2 + · simp [hx, hy, hz, mul_ite] + · simp [hz] + · simp [hy] + · simp [hx] + +theorem shape_split_sub {P Q : Type*} [Fintype P] [Fintype Q] + (g u : Fin 3 → ℕ) (hu : ∀ s, u s ≤ g s) + (x : (P → Fin 7) × (Q → Fin 7)) + (y : (P → Fin 7) × (Q → Fin 7)) + (z : (P → Fin 7) × (Q → Fin 7)) : + (if weight x.1 = u 0 ∧ weight y.1 = u 1 ∧ weight z.1 = u 2 then + shapeTensor (F := F) (P ⊕ Q) g (Sum.elim x.1 x.2) (Sum.elim y.1 y.2) + (Sum.elim z.1 z.2) else 0) = + Tensor.product (shapeTensor P u) (shapeTensor Q (g - u)) x y z := by + have hg : u + (g - u) = g := by + funext s + exact Nat.add_sub_of_le (hu s) + simpa only [hg] using shape_split u (g - u) x y z + +def splitMatrix {P Q : Type*} [Fintype P] (u : ℕ) : + ((P → Fin 7) × (Q → Fin 7)) → ((P ⊕ Q) → Fin 7) → F := by + classical + exact fun x w => if w = Sum.elim x.1 x.2 ∧ weight x.1 = u then 1 else 0 + +theorem shape_split_restrict {P Q : Type*} [Fintype P] [Fintype Q] + [DecidableEq P] [DecidableEq Q] (u v : Fin 3 → ℕ) : + Tensor.restrict (splitMatrix (F := F) (u 0)) (splitMatrix (u 1)) (splitMatrix (u 2)) + (shapeTensor (P ⊕ Q) (u + v)) = + Tensor.product (shapeTensor P u) (shapeTensor Q v) := by + classical + funext x y z + have hcollapse : Tensor.restrict (splitMatrix (F := F) (u 0)) + (splitMatrix (u 1)) (splitMatrix (u 2)) (shapeTensor (P ⊕ Q) (u + v)) x y z = + if weight x.1 = u 0 ∧ weight y.1 = u 1 ∧ weight z.1 = u 2 then + shapeTensor (P ⊕ Q) (u + v) (Sum.elim x.1 x.2) (Sum.elim y.1 y.2) + (Sum.elim z.1 z.2) else 0 := by + simp [Tensor.restrict, splitMatrix, ite_and, ite_mul, mul_ite] + split_ifs <;> simp_all + rw [hcollapse] + exact shape_split u v x y z + +end MatrixMultiplication.CWStrands + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/CoppersmithWinograd/CWWindowedLeaves.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/CoppersmithWinograd/CWWindowedLeaves.lean new file mode 100644 index 0000000000000000000000000000000000000000..41be5761e845f91b7c73989a8b4d03946a009ff2 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/CoppersmithWinograd/CWWindowedLeaves.lean @@ -0,0 +1,246 @@ +import OAI.LinearAlgebra.MatrixMultiplication.CoppersmithWinograd.CWShapeLeaves +import OAI.LinearAlgebra.MatrixMultiplication.Tensor.ExactStatisticWords +import OAI.LinearAlgebra.MatrixMultiplication.Recovery.ExactRecovery + +namespace OAI + +/-! Coppersmith–Winograd tensors, tensor powers and local restrictions. -/ + +noncomputable section + +namespace MatrixMultiplication.CWWindowedLeaves + +open MatrixMultiplication.Foundation CWStrands CWShapeLeaves CWLeafRestrictions InheritedMasks +open scoped BigOperators + +attribute [local instance] Classical.propDecidable + +abbrev Raw (n : ℕ) := Fin n → Fin 7 +abbrev Alphabet (n a : ℕ) := {w : Raw n // weight w = a} + +def complementWord {n : ℕ} (w : Raw n) : Raw n := fun i => complement 5 (w i) +def zeroWord (n : ℕ) : Raw n := fun _ => 0 + +variable (F : Type*) [CommRing F] + +theorem zeroX_local (n a b : ℕ) (hab : a + b = 2 * n) + (u v : Alphabet n a) : + shapeTensor (F := F) (Fin n) ![0, a, b] (zeroWord n) u.val (complementWord v.val) = + if u = v then 1 else 0 := by + have h := zeroX_shape_leaf F n a b hab (fun w => weight w = a) (fun _ h => h) + have hh := congrFun (congrFun (congrFun h ((), ())) ((), u)) (v, ()) + change shapeTensor (F := F) (Fin n) ![0, a, b] (fun _ => 0) u.val + (fun i => complement 5 (v.val i)) = if u = v then 1 else 0 + simpa only [Tensor.pullback, Tensor.matrixCoefficients, + true_and, and_true] using hh + +theorem zeroY_local (n a b : ℕ) (hab : a + b = 2 * n) + (u v : Alphabet n a) : + shapeTensor (F := F) (Fin n) ![a, 0, b] u.val (zeroWord n) (complementWord v.val) = + if u = v then 1 else 0 := by + have h := zeroY_shape_leaf F n a b hab (fun w => weight w = a) (fun _ h => h) + have hh := congrFun (congrFun (congrFun h (u, ())) ((), ())) ((), v) + have huv : (v = u) ↔ (u = v) := eq_comm + change shapeTensor (F := F) (Fin n) ![a, 0, b] u.val (fun _ => 0) + (fun i => complement 5 (v.val i)) = if u = v then 1 else 0 + simpa only [Tensor.pullback, Tensor.matrixCoefficients, + true_and, and_true, huv] using hh + +theorem zeroZ_local (n a b : ℕ) (hab : a + b = 2 * n) + (u v : Alphabet n a) : + shapeTensor (F := F) (Fin n) ![a, b, 0] u.val (complementWord v.val) (zeroWord n) = + if u = v then 1 else 0 := by + have h := zeroZ_shape_leaf F n a b hab (fun w => weight w = a) (fun _ h => h) + have hh := congrFun (congrFun (congrFun h ((), u)) (v, ())) ((), ()) + change shapeTensor (F := F) (Fin n) ![a, b, 0] u.val + (fun i => complement 5 (v.val i)) (fun _ => 0) = if u = v then 1 else 0 + simpa only [Tensor.pullback, Tensor.matrixCoefficients, + true_and, and_true] using hh + +section Classes + +variable (n a b m : ℕ) (hab : a + b = 2 * n) + (p : (Fin m → Alphabet n a) → Prop) + +def rawSelected (w : {w : Fin m → Alphabet n a // p w}) : Fin m → Raw n := + fun i => (w.val i).val + +def complementarySelected (w : {w : Fin m → Alphabet n a // p w}) : Fin m → Raw n := + fun i => complementWord (w.val i).val + +include hab + +theorem zeroX_class : + Tensor.pullback (fun _ : Unit × Unit => fun _ : Fin m => zeroWord n) + (fun y : Unit × {w // p w} => rawSelected n a m p y.2) + (fun z : {w // p w} × Unit => complementarySelected n a m p z.1) + (Tensor.power (shapeTensor (F := F) (Fin n) ![0, a, b]) m) = + Tensor.matrixCoefficients Unit Unit {w // p w} := by + funext x y z + simp only [Tensor.pullback, Tensor.power, rawSelected, complementarySelected, + zeroX_local F n a b hab, Fintype.prod_boole, ← funext_iff, Tensor.matrixCoefficients] + simp [Subtype.ext_iff] + +theorem zeroY_class : + Tensor.pullback (fun x : {w // p w} × Unit => rawSelected n a m p x.1) + (fun _ : Unit × Unit => fun _ : Fin m => zeroWord n) + (fun z : Unit × {w // p w} => complementarySelected n a m p z.2) + (Tensor.power (shapeTensor (F := F) (Fin n) ![a, 0, b]) m) = + Tensor.matrixCoefficients {w // p w} Unit Unit := by + funext x y z + simp only [Tensor.pullback, Tensor.power, rawSelected, complementarySelected, + zeroY_local F n a b hab, Fintype.prod_boole, ← funext_iff, Tensor.matrixCoefficients] + simp [Subtype.ext_iff, eq_comm] + +theorem zeroZ_class : + Tensor.pullback (fun x : Unit × {w // p w} => rawSelected n a m p x.2) + (fun y : {w // p w} × Unit => complementarySelected n a m p y.1) + (fun _ : Unit × Unit => fun _ : Fin m => zeroWord n) + (Tensor.power (shapeTensor (F := F) (Fin n) ![a, b, 0]) m) = + Tensor.matrixCoefficients Unit {w // p w} Unit := by + funext x y z + simp only [Tensor.pullback, Tensor.power, rawSelected, complementarySelected, + zeroZ_local F n a b hab, Fintype.prod_boole, ← funext_iff, Tensor.matrixCoefficients] + simp [Subtype.ext_iff] + +theorem zeroX_masked + (keepX keepY keepZ : (Fin m → Raw n) → Prop) + (hx : keepX (fun _ => zeroWord n)) + (hy : ∀ w, keepY (rawSelected n a m p w)) + (hz : ∀ w, keepZ (complementarySelected n a m p w)) : + Tensor.pullback (fun _ : Unit × Unit => fun _ : Fin m => zeroWord n) + (fun y : Unit × {w // p w} => rawSelected n a m p y.2) + (fun z : {w // p w} × Unit => complementarySelected n a m p z.1) + (ExactRecovery.delete (Tensor.power (shapeTensor (F := F) (Fin n) ![0, a, b]) m) + keepX keepY keepZ) = Tensor.matrixCoefficients Unit Unit {w // p w} := by + have h := zeroX_class F n a b m hab p + funext x y z + simpa only [Tensor.pullback, ExactRecovery.delete, hx, hy, hz, and_self, ite_true] using + congrFun (congrFun (congrFun h x) y) z + +theorem zeroY_masked + (keepX keepY keepZ : (Fin m → Raw n) → Prop) + (hx : ∀ w, keepX (rawSelected n a m p w)) + (hy : keepY (fun _ => zeroWord n)) + (hz : ∀ w, keepZ (complementarySelected n a m p w)) : + Tensor.pullback (fun x : {w // p w} × Unit => rawSelected n a m p x.1) + (fun _ : Unit × Unit => fun _ : Fin m => zeroWord n) + (fun z : Unit × {w // p w} => complementarySelected n a m p z.2) + (ExactRecovery.delete (Tensor.power (shapeTensor (F := F) (Fin n) ![a, 0, b]) m) + keepX keepY keepZ) = Tensor.matrixCoefficients {w // p w} Unit Unit := by + have h := zeroY_class F n a b m hab p + funext x y z + simpa only [Tensor.pullback, ExactRecovery.delete, hx, hy, hz, and_self, ite_true] using + congrFun (congrFun (congrFun h x) y) z + +theorem zeroZ_masked + (keepX keepY keepZ : (Fin m → Raw n) → Prop) + (hx : ∀ w, keepX (rawSelected n a m p w)) + (hy : ∀ w, keepY (complementarySelected n a m p w)) + (hz : keepZ (fun _ => zeroWord n)) : + Tensor.pullback (fun x : Unit × {w // p w} => rawSelected n a m p x.2) + (fun y : {w // p w} × Unit => complementarySelected n a m p y.1) + (fun _ : Unit × Unit => fun _ : Fin m => zeroWord n) + (ExactRecovery.delete (Tensor.power (shapeTensor (F := F) (Fin n) ![a, b, 0]) m) + keepX keepY keepZ) = Tensor.matrixCoefficients Unit {w // p w} Unit := by + have h := zeroZ_class F n a b m hab p + funext x y z + simpa only [Tensor.pullback, ExactRecovery.delete, hx, hy, hz, and_self, ite_true] using + congrFun (congrFun (congrFun h x) y) z + +theorem zeroX_restriction + (keepX keepY keepZ : (Fin m → Raw n) → Prop) + (hx : keepX (fun _ => zeroWord n)) + (hy : ∀ w, keepY (rawSelected n a m p w)) + (hz : ∀ w, keepZ (complementarySelected n a m p w)) : + ∃ (A : (Unit × Unit) → (Fin m → Raw n) → F) + (B : (Unit × {w // p w}) → (Fin m → Raw n) → F) + (C : ({w // p w} × Unit) → (Fin m → Raw n) → F), + Tensor.restrict A B C + (ExactRecovery.delete (Tensor.power (shapeTensor (F := F) (Fin n) ![0, a, b]) m) + keepX keepY keepZ) = Tensor.matrixCoefficients Unit Unit {w // p w} := by + refine ⟨(fun _ v => if v = (fun _ => zeroWord n) then 1 else 0), + (fun y v => if v = rawSelected n a m p y.2 then 1 else 0), + (fun z v => if v = complementarySelected n a m p z.1 then 1 else 0), ?_⟩ + rw [← Tensor.pullback_eq_restrict] + exact zeroX_masked F n a b m hab p keepX keepY keepZ hx hy hz + +theorem zeroY_restriction + (keepX keepY keepZ : (Fin m → Raw n) → Prop) + (hx : ∀ w, keepX (rawSelected n a m p w)) + (hy : keepY (fun _ => zeroWord n)) + (hz : ∀ w, keepZ (complementarySelected n a m p w)) : + ∃ (A : ({w // p w} × Unit) → (Fin m → Raw n) → F) + (B : (Unit × Unit) → (Fin m → Raw n) → F) + (C : (Unit × {w // p w}) → (Fin m → Raw n) → F), + Tensor.restrict A B C + (ExactRecovery.delete (Tensor.power (shapeTensor (F := F) (Fin n) ![a, 0, b]) m) + keepX keepY keepZ) = Tensor.matrixCoefficients {w // p w} Unit Unit := by + refine ⟨(fun x v => if v = rawSelected n a m p x.1 then 1 else 0), + (fun _ v => if v = (fun _ => zeroWord n) then 1 else 0), + (fun z v => if v = complementarySelected n a m p z.2 then 1 else 0), ?_⟩ + rw [← Tensor.pullback_eq_restrict] + exact zeroY_masked F n a b m hab p keepX keepY keepZ hx hy hz + +theorem zeroZ_restriction + (keepX keepY keepZ : (Fin m → Raw n) → Prop) + (hx : ∀ w, keepX (rawSelected n a m p w)) + (hy : ∀ w, keepY (complementarySelected n a m p w)) + (hz : keepZ (fun _ => zeroWord n)) : + ∃ (A : (Unit × {w // p w}) → (Fin m → Raw n) → F) + (B : ({w // p w} × Unit) → (Fin m → Raw n) → F) + (C : (Unit × Unit) → (Fin m → Raw n) → F), + Tensor.restrict A B C + (ExactRecovery.delete (Tensor.power (shapeTensor (F := F) (Fin n) ![a, b, 0]) m) + keepX keepY keepZ) = Tensor.matrixCoefficients Unit {w // p w} Unit := by + refine ⟨(fun x v => if v = rawSelected n a m p x.2 then 1 else 0), + (fun y v => if v = complementarySelected n a m p y.1 then 1 else 0), + (fun _ v => if v = (fun _ => zeroWord n) then 1 else 0), ?_⟩ + rw [← Tensor.pullback_eq_restrict] + exact zeroZ_masked F n a b m hab p keepX keepY keepZ hx hy hz + +end Classes + +section ExactWindows + +variable {A : Type*} [Fintype A] [DecidableEq A] + +theorem exact_selected_window (n a : ℕ) (statistic : Raw n → A) + (counts : A → ℕ) (ν : A → ℝ) (η : ℝ) + (happrox : ∀ s, |(counts s : ℝ) / (∑ s, counts s : ℕ) - ν s| ≤ η) + (w : ExactStatisticWords.Words (fun u : Alphabet n a => statistic u.val) counts) : + typeWindow ν η (fun i => statistic (w.val i).val) := + ExactStatisticWords.typeWindow_of_counts _ counts w ν η happrox + +theorem exact_complementary_window (n a : ℕ) (statistic : Raw n → A) + (κ : A ≃ A) + (hstatistic : ∀ u : Alphabet n a, statistic (complementWord u.val) = κ (statistic u.val)) + (counts : A → ℕ) (ν : A → ℝ) (η : ℝ) + (happrox : ∀ s, |(counts s : ℝ) / (∑ s, counts s : ℕ) - ν s| ≤ η) + (w : ExactStatisticWords.Words (fun u : Alphabet n a => statistic u.val) counts) : + typeWindow (ν ∘ κ.symm) η (fun i => statistic (complementWord (w.val i).val)) := by + have heq : (fun i => statistic (complementWord (w.val i).val)) = + κ ∘ (fun i => statistic (w.val i).val) := by + funext i + exact hstatistic (w.val i) + rw [heq] + exact (typeWindow_equiv ν η _ κ).mpr + (exact_selected_window n a statistic counts ν η happrox w) + +omit [Fintype A] in +theorem zero_window (n m : ℕ) (hm : 0 < m) (statistic : Raw n → A) + (ν : A → ℝ) (η : ℝ) (hη : 0 ≤ η) + (hν : ∀ s, ν s = if statistic (zeroWord n) = s then 1 else 0) : + typeWindow ν η (fun _ : Fin m => statistic (zeroWord n)) := by + intro s + have hm' : (m : ℝ) ≠ 0 := by exact_mod_cast (Nat.ne_of_gt hm) + by_cases hs : statistic (zeroWord n) = s <;> + simpa [empiricalLaw, wordPopulation, hν s, hs, hm'] using hη + +end ExactWindows + +end MatrixMultiplication.CWWindowedLeaves + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/CoppersmithWinograd/CWWordDimensionParameters.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/CoppersmithWinograd/CWWordDimensionParameters.lean new file mode 100644 index 0000000000000000000000000000000000000000..d5187df22365756f9df04e95dbcbc431f4185068 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/CoppersmithWinograd/CWWordDimensionParameters.lean @@ -0,0 +1,39 @@ +import OAI.LinearAlgebra.MatrixMultiplication.CoppersmithWinograd.CWWordDimensions +import OAI.LinearAlgebra.MatrixMultiplication.FieldParameters.Contractions + +namespace OAI + +/-! Coppersmith–Winograd tensors, tensor powers and local restrictions. -/ + +namespace MatrixMultiplication.CWWordDimensionParameters + +open CWWordDimensions AllFieldParameters.Contractions + +theorem table_eq_recursive : ∀ j : Fin 17, + (coefficients[j.val]?.getD 0) = recursiveCoeff 8 j.val := by + decide +kernel + +theorem table_eq_polynomial (j : Fin 17) : + (coefficients[j.val]?.getD 0) = (sitePolynomial ^ 8).coeff j.val := by + rw [coeff_eq_recursive, table_eq_recursive] + +theorem table_eq_card (j : Fin 17) : + (coefficients[j.val]?.getD 0) = + Fintype.card (WeightWords (Fin 8) j.val) := by + have h := card_weightWords_fin 8 j.val + rw [Fintype.card_eq_nat_card] at h ⊢ + exact (table_eq_recursive j).trans h.symm + +theorem table_positive : ∀ j : Fin 17, 0 < (coefficients[j.val]?.getD 0) := by + decide +kernel + +theorem word_card_positive (j : Fin 17) : + 0 < Fintype.card (WeightWords (Fin 8) j.val) := by + have h := table_eq_card j + rw [Fintype.card_eq_nat_card] at h ⊢ + rw [← h] + exact table_positive j + +end MatrixMultiplication.CWWordDimensionParameters + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/CoppersmithWinograd/CWWordDimensions.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/CoppersmithWinograd/CWWordDimensions.lean new file mode 100644 index 0000000000000000000000000000000000000000..07f678cbab96ee83497f49799507a6a036d7c301 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/CoppersmithWinograd/CWWordDimensions.lean @@ -0,0 +1,85 @@ +import OAI.LinearAlgebra.MatrixMultiplication.CoppersmithWinograd.CWStrands +import Mathlib.Algebra.Polynomial.Coeff +import Mathlib.Algebra.BigOperators.Ring.Finset +import Mathlib.SetTheory.Cardinal.Finite + +namespace OAI + +/-! Coppersmith–Winograd tensors, tensor powers and local restrictions. -/ + +noncomputable section + +namespace MatrixMultiplication.CWWordDimensions + +open scoped BigOperators Polynomial +open CWStrands + +attribute [local instance] Classical.propDecidable + +def sitePolynomial : Polynomial ℕ := 1 + Polynomial.C 5 * Polynomial.X + Polynomial.X ^ 2 + +theorem site_enumerator : + (∑ a : Fin 7, (Polynomial.X : Polynomial ℕ) ^ CWLeafStatistics.weight a) = + sitePolynomial := by + norm_num [Fin.sum_univ_succ, CWLeafStatistics.weight, sitePolynomial] + ring + +theorem word_enumerator (P : Type*) [Fintype P] : + (∑ w : P → Fin 7, (Polynomial.X : Polynomial ℕ) ^ weight w) = + sitePolynomial ^ Fintype.card P := by + classical + calc + (∑ w : P → Fin 7, (Polynomial.X : Polynomial ℕ) ^ weight w) = + ∑ w : P → Fin 7, ∏ i, (Polynomial.X : Polynomial ℕ) ^ + CWLeafStatistics.weight (w i) := by + apply Finset.sum_congr rfl + intro w _ + exact (Finset.prod_pow_eq_pow_sum Finset.univ + (fun i => CWLeafStatistics.weight (w i)) Polynomial.X).symm + _ = ∏ _i : P, ∑ a : Fin 7, (Polynomial.X : Polynomial ℕ) ^ + CWLeafStatistics.weight a := + (Fintype.prod_sum (fun (_i : P) (a : Fin 7) => + (Polynomial.X : Polynomial ℕ) ^ CWLeafStatistics.weight a)).symm + _ = sitePolynomial ^ Fintype.card P := by simp only [site_enumerator, Finset.prod_const, + Finset.card_univ] + +abbrev WeightWords (P : Type*) [Fintype P] (j : ℕ) := {w : P → Fin 7 // weight w = j} + +theorem card_weightWords (P : Type*) [Fintype P] (j : ℕ) : + Fintype.card (WeightWords P j) = (sitePolynomial ^ Fintype.card P).coeff j := by + classical + rw [← word_enumerator] + simp [WeightWords, Fintype.card_subtype, Polynomial.coeff_X_pow, eq_comm] + +def recursiveCoeff : ℕ → ℕ → ℕ + | 0, j => if j = 0 then 1 else 0 + | n + 1, j => recursiveCoeff n j + + 5 * (if 1 ≤ j then recursiveCoeff n (j - 1) else 0) + + (if 2 ≤ j then recursiveCoeff n (j - 2) else 0) + +theorem coeff_eq_recursive (n j : ℕ) : + (sitePolynomial ^ n).coeff j = recursiveCoeff n j := by + induction n generalizing j with + | zero => simp [recursiveCoeff, Polynomial.coeff_one] + | succ n ih => + have hmul (p : Polynomial ℕ) : sitePolynomial * p = + p + Polynomial.C 5 * (Polynomial.X * p) + Polynomial.X ^ 2 * p := by + simp only [sitePolynomial, add_mul, one_mul, mul_assoc] + have hshift := Polynomial.coeff_X_pow_mul' (sitePolynomial ^ n) 1 j + simp only [pow_one] at hshift + rw [pow_succ', hmul, Polynomial.coeff_add, Polynomial.coeff_add, + Polynomial.coeff_C_mul, hshift, Polynomial.coeff_X_pow_mul'] + simp only [ih, recursiveCoeff] + +theorem card_weightWords_fin (n j : ℕ) : + Fintype.card (WeightWords (Fin n) j) = recursiveCoeff n j := by + have h := card_weightWords (Fin n) j + simp only [Fintype.card_fin, coeff_eq_recursive] at h + rw [Fintype.card_eq_nat_card] at h ⊢ + exact h + +end MatrixMultiplication.CWWordDimensions + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/CoppersmithWinograd/CWZeroGeometry.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/CoppersmithWinograd/CWZeroGeometry.lean new file mode 100644 index 0000000000000000000000000000000000000000..8f83333f2b0e9f6038b4bbc248b351ce5e7e045a --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/CoppersmithWinograd/CWZeroGeometry.lean @@ -0,0 +1,100 @@ +import OAI.LinearAlgebra.MatrixMultiplication.CoppersmithWinograd.CWOrientedZero +import OAI.LinearAlgebra.MatrixMultiplication.FieldConstruction.ShapeEncoding + +namespace OAI + +/-! Coppersmith–Winograd tensors, tensor powers and local restrictions. -/ + +namespace MatrixMultiplication.CWZeroGeometry + +open AllFieldParameters AllFieldHistory CWOrientedZero + +def zeroAxis (g : Shape) : Fin 3 := + if g 0 = 0 then 0 else if g 1 = 0 then 1 else 2 + +def maxAxis (g : Shape) : Fin 3 := + if g 0 = shapeMax g then 0 else if g 1 = shapeMax g then 1 else 2 + +theorem zeroAxis_spec (g : Shape) (hz : ∃ i, g i = 0) : g (zeroAxis g) = 0 := by + unfold zeroAxis + split_ifs with h0 h1 + · exact h0 + · exact h1 + · obtain ⟨i, hi⟩ := hz + fin_cases i <;> simp_all + +theorem maxAxis_spec (g : Shape) : g (maxAxis g) = shapeMax g := by + have hm : shapeMax g = g 0 ∨ shapeMax g = g 1 ∨ shapeMax g = g 2 := by + unfold shapeMax + rcases le_total (g 0) (max (g 1) (g 2)) with h | h + · rw [max_eq_right h] + rcases le_total (g 1) (g 2) with h | h + · exact Or.inr (Or.inr (max_eq_right h)) + · exact Or.inr (Or.inl (max_eq_left h)) + · exact Or.inl (max_eq_left h) + unfold maxAxis + split_ifs with h0 h1 + · exact h0 + · exact h1 + · rcases hm with hm | hm | hm + · exact (h0 hm.symm).elim + · exact (h1 hm.symm).elim + · exact hm.symm + +theorem shapeMax_le_total (g : Shape) : shapeMax g ≤ shapeTotal g := by + exact max_le (coordinate_le_total g 0) + (max_le (coordinate_le_total g 1) (coordinate_le_total g 2)) + +theorem shapeMax_pos (g : Shape) (ht : 0 < shapeTotal g) : 0 < shapeMax g := by + have h0 : g 0 ≤ shapeMax g := le_max_left _ _ + have h1 : g 1 ≤ shapeMax g := (le_max_left _ _).trans (le_max_right _ _) + have h2 : g 2 ≤ shapeMax g := (le_max_right _ _).trans (le_max_right _ _) + unfold shapeTotal at ht + omega + +theorem zero_ne_selected (g : Shape) (zero selected : Fin 3) + (ht : 0 < shapeTotal g) (hz : g zero = 0) (hs : g selected = shapeMax g) : + zero ≠ selected := by + intro he + have hp := shapeMax_pos g ht + rw [← he, hz] at hs + omega + +theorem max_add_complement (g : Shape) : + shapeMax g + (shapeTotal g - shapeMax g) = shapeTotal g := + Nat.add_sub_of_le (shapeMax_le_total g) + +theorem eq_placedShape (g : Shape) (zero selected : Fin 3) + (hz : g zero = 0) (hs : g selected = shapeMax g) (hne : zero ≠ selected) : + g = placedShape zero selected (shapeMax g) (shapeTotal g - shapeMax g) := by + funext side + fin_cases zero <;> fin_cases selected + all_goals try contradiction + all_goals fin_cases side <;> + simp_all [placedShape, shapeTotal] + +theorem physicalShape_eq_placedShape (g : Shape) (phi : Equiv.Perm (Fin 3)) + (zero selected : Fin 3) (hz : g zero = 0) + (hs : g selected = shapeMax g) (hne : zero ≠ selected) : + physicalShape phi g = placedShape (phi zero) (phi selected) + (shapeMax g) (shapeTotal g - shapeMax g) := by + funext side + calc + physicalShape phi g side = + placedShape zero selected (shapeMax g) (shapeTotal g - shapeMax g) + (phi.symm side) := congrFun (eq_placedShape g zero selected hz hs hne) _ + _ = _ := by simp only [placedShape, Equiv.symm_apply_eq] + +theorem selected_add_remaining (g : Shape) (zero selected side : Fin 3) + (hz : g zero = 0) (hs : g selected = shapeMax g) (hne : zero ≠ selected) + (hzs : side ≠ zero) (hss : side ≠ selected) : + g selected + g side = shapeTotal g := by + have hside : g side = shapeTotal g - shapeMax g := by + rw [congrFun (eq_placedShape g zero selected hz hs hne) side] + simp only [placedShape, ite_eq_right hzs, ite_eq_right hss] + rw [hs, hside] + exact max_add_complement g + +end MatrixMultiplication.CWZeroGeometry + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/CoppersmithWinograd/ComplexCW75InitialExecution.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/CoppersmithWinograd/ComplexCW75InitialExecution.lean new file mode 100644 index 0000000000000000000000000000000000000000..3ab752b2837e6d9771dd19ede0b0f7cbfdba6c67 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/CoppersmithWinograd/ComplexCW75InitialExecution.lean @@ -0,0 +1,301 @@ +import OAI.LinearAlgebra.MatrixMultiplication.CoppersmithWinograd.ComplexCW75Primitive +import OAI.LinearAlgebra.MatrixMultiplication.Polynomial.ComplexPolynomialKernelExecution + +namespace OAI + +/-! Coppersmith–Winograd tensors, tensor powers and local restrictions. -/ + +noncomputable section + +namespace MatrixMultiplication.Foundation.CW75InitialExecution + +open Polynomial +open scoped BigOperators Classical + +abbrev Word := CW75Primitive.Word +abbrev Blocks (N : ℕ) := Fin N → Word + +def fullSource (N : ℕ) : Tensor ℂ (Blocks N) (Blocks N) (Blocks N) := + Tensor.power (Tensor.power CoppersmithWinograd.tensor 3) N + +def support {N : ℕ} (x y z : Blocks N) : Prop := fullSource N x y z ≠ 0 + +theorem support_iff {N : ℕ} (x y z : Blocks N) : + support x y z ↔ ∀ i j, (x i j).val + (y i j).val + (z i j).val = 2 := by + simp [support, fullSource, Tensor.power, Finset.prod_ne_zero_iff, + CWOriginalWords.tensor_ne_zero_iff] + +def boundaryPolynomial (x y z : Word) : Polynomial ℂ := + ∏ i, CWBoundary.scalingPolynomial (x i) (y i) (z i) + +def boundaryNormalized (x y z : Word) : Polynomial ℂ := + ∏ i, (C (CWBoundary.tensor (x i) (y i) (z i)) + + X ^ 2 * C (CWBoundary.deleted (x i) (y i) (z i))) + +theorem boundaryPolynomial_factor (x y z : Word) : + boundaryPolynomial x y z = X ^ 3 * boundaryNormalized x y z := by + have hp (i : Fin 3) : CWBoundary.scalingPolynomial (x i) (y i) (z i) = + X * (C (CWBoundary.tensor (x i) (y i) (z i)) + + X ^ 2 * C (CWBoundary.deleted (x i) (y i) (z i))) := by + rw [CWBoundary.scalingPolynomial_apply] + ring + simp [boundaryPolynomial, boundaryNormalized, hp, Finset.prod_mul_distrib] + +theorem boundaryPolynomial_vanishes (x y z : Word) (j : ℕ) (hj : j < 3) : + (boundaryPolynomial x y z).coeff j = 0 := by + rw [boundaryPolynomial_factor] + simp only [Polynomial.coeff_X_pow_mul', Nat.not_le_of_lt hj, ite_false] + +theorem boundaryPolynomial_leading (x y z : Word) : + (boundaryPolynomial x y z).coeff 3 = CW75Primitive.source x y z := by + rw [boundaryPolynomial_factor] + simp [Polynomial.coeff_X_pow_mul', boundaryNormalized, + Polynomial.coeff_zero_prod, CW75Primitive.source, Tensor.power] + +def completionPolynomial (x y z : Word) : Polynomial ℂ := + (if CW75Primitive.hasB x then X else 1) * + (if CW75Primitive.hasC y then X else 1) * + (if CW75Primitive.allA z then 0 else 1) + +private theorem boundary_one (x y z : Fin 3) (h : CWBoundary.tensor x y z ≠ 0) : + CWBoundary.tensor x y z = 1 := by + by_cases hd : x = 1 ∧ y = 0 ∧ z = 1 + · simp [CWBoundary.tensor, hd] at h + · by_cases hs : x.val + y.val + z.val = 2 + · simp [CWBoundary.tensor, CoppersmithWinograd.tensor, hd, hs] + · simp [CWBoundary.tensor, CoppersmithWinograd.tensor, hd, hs] at h + +private theorem boundarySource_one (x y z : Word) (h : CW75Primitive.source x y z ≠ 0) : + CW75Primitive.source x y z = 1 := by + unfold CW75Primitive.source Tensor.power + apply Finset.prod_eq_one + intro i hi + exact boundary_one _ _ _ (CW75Primitive.source_factors x y z h i) + +theorem retained_coefficient_one (x y z : Word) (h : CW75Primitive.tensor x y z ≠ 0) : + CW75Primitive.tensor x y z = 1 := by + by_cases hr : CW75Primitive.retained x y z + · rw [CW75Primitive.tensor, ite_eq_left hr] at h ⊢ + exact boundarySource_one x y z h + · simp [CW75Primitive.tensor, hr] at h + +private theorem completion_eq (x y z : Word) (h : CW75Primitive.source x y z ≠ 0) : + completionPolynomial x y z = CW75Primitive.polynomial x y z := by + have hone := boundarySource_one x y z h + rw [CW75Primitive.polynomial_apply] + by_cases hz : CW75Primitive.allA z <;> simp [completionPolynomial, hone, hz] + +private theorem source_mul_retained (x y z : Word) : + CW75Primitive.source x y z * CW75Primitive.tensor x y z = + CW75Primitive.tensor x y z := by + by_cases hs : CW75Primitive.source x y z = 0 + · simp [CW75Primitive.tensor, hs] + · rw [boundarySource_one x y z hs, one_mul] + +def leftBlock (x : Word) : Polynomial ℂ := + Polynomial.expand ℂ 2 (∏ i, CWBoundary.outerWeight X (x i)) * + (if CW75Primitive.hasB x then X else 1) + +def middleBlock (y : Word) : Polynomial ℂ := + Polynomial.expand ℂ 2 (∏ i, CWBoundary.middleWeight X (y i)) * + (if CW75Primitive.hasC y then X else 1) + +def rightBlock (z : Word) : Polynomial ℂ := + Polynomial.expand ℂ 2 (∏ i, CWBoundary.outerWeight X (z i)) * + (if CW75Primitive.allA z then 0 else 1) + +def blockKernel (x y z : Word) : Polynomial ℂ := leftBlock x * middleBlock y * rightBlock z + +theorem blockKernel_factor (x y z : Word) + (hs : ∀ i, (x i).val + (y i).val + (z i).val = 2) : + blockKernel x y z = Polynomial.expand ℂ 2 (boundaryPolynomial x y z) * + completionPolynomial x y z := by + have hpoint (i : Fin 3) : + CWBoundary.outerWeight X (x i) * CWBoundary.middleWeight X (y i) * + CWBoundary.outerWeight X (z i) = CWBoundary.scalingPolynomial (x i) (y i) (z i) := by + unfold CWBoundary.scalingPolynomial + rw [CWBoundary.outerMap, CWBoundary.middleMap, CWBoundary.restrict_diagonal_apply] + simp [CoppersmithWinograd.tensor, hs i] + have hprod : (∏ i, CWBoundary.outerWeight X (x i)) * + (∏ i, CWBoundary.middleWeight X (y i)) * (∏ i, CWBoundary.outerWeight X (z i)) = + boundaryPolynomial x y z := by + simp only [boundaryPolynomial, ← hpoint, Finset.prod_mul_distrib] + calc + blockKernel x y z = Polynomial.expand ℂ 2 + ((∏ i, CWBoundary.outerWeight X (x i)) * + (∏ i, CWBoundary.middleWeight X (y i)) * (∏ i, CWBoundary.outerWeight X (z i))) * + completionPolynomial x y z := by + simp only [blockKernel, leftBlock, middleBlock, rightBlock, completionPolynomial, map_mul] + ring + _ = _ := by rw [hprod] + +theorem blockKernel_vanishes (x y z : Word) + (hs : ∀ i, (x i).val + (y i).val + (z i).val = 2) + (j : ℕ) (hj : j < 7) : (blockKernel x y z).coeff j = 0 := by + rw [blockKernel_factor x y z hs] + apply PolynomialControlledKernel.expanded_mul_vanishes_of_leading_support + (boundaryPolynomial x y z) (completionPolynomial x y z) 3 1 + (CW75Primitive.source x y z) + (boundaryPolynomial_vanishes x y z) (boundaryPolynomial_leading x y z) _ j hj + intro hn k hk + rw [completion_eq x y z hn] + have hkzero : k = 0 := by omega + subst k + simp [CW75Primitive.polynomial_coeff] + +theorem blockKernel_leading (x y z : Word) + (hs : ∀ i, (x i).val + (y i).val + (z i).val = 2) : + (blockKernel x y z).coeff 7 = CW75Primitive.tensor x y z := by + rw [blockKernel_factor x y z hs] + have h := PolynomialControlledKernel.expanded_mul_leading_of_leading_support + (boundaryPolynomial x y z) (completionPolynomial x y z) 3 1 + (CW75Primitive.source x y z) (CW75Primitive.tensor x y z) + (boundaryPolynomial_vanishes x y z) (boundaryPolynomial_leading x y z) (by + intro hn + rw [completion_eq x y z hn] + simp [CW75Primitive.polynomial_coeff]) + exact h.trans (source_mul_retained x y z) + +private theorem degree_product {n D : ℕ} (f : Fin n → Polynomial ℂ) + (h : ∀ i, (f i).degree ≤ D) : (∏ i, f i).degree ≤ D * n := by + apply Polynomial.degree_le_of_natDegree_le + calc + (∏ i, f i).natDegree ≤ ∑ i, (f i).natDegree := Polynomial.natDegree_prod_le _ _ + _ ≤ ∑ _i : Fin n, D := by + apply Finset.sum_le_sum + intro i hi + exact Polynomial.natDegree_le_of_degree_le (h i) + _ = D * n := by simp [Nat.mul_comm] + +private theorem degree_expanded_product (P Q : Polynomial ℂ) {d e : ℕ} + (hP : P.degree ≤ d) (hQ : Q.degree ≤ e) : + (Polynomial.expand ℂ 2 P * Q).degree ≤ d * 2 + e := by + apply Polynomial.degree_le_of_natDegree_le + apply Polynomial.natDegree_mul_le_of_le + · rw [Polynomial.natDegree_expand] + exact Nat.mul_le_mul_right 2 (Polynomial.natDegree_le_of_degree_le hP) + · exact Polynomial.natDegree_le_of_degree_le hQ + +private theorem outerWeight_degree (a : Fin 3) : + (CWBoundary.outerWeight (X : Polynomial ℂ) a).degree ≤ 1 := by + by_cases h : a = 1 <;> simp [CWBoundary.outerWeight, h] + +private theorem middleWeight_degree (a : Fin 3) : + (CWBoundary.middleWeight (X : Polynomial ℂ) a).degree ≤ 1 := by + by_cases h : a = 1 <;> simp [CWBoundary.middleWeight, h] + +theorem leftBlock_degree (x : Word) : (leftBlock x).degree ≤ 7 := by + apply degree_expanded_product (d := 3) (e := 1) + (∏ i, CWBoundary.outerWeight X (x i)) (if CW75Primitive.hasB x then X else 1) + (degree_product _ (fun i => outerWeight_degree (x i))) + by_cases h : CW75Primitive.hasB x <;> simp [h] + +theorem middleBlock_degree (y : Word) : (middleBlock y).degree ≤ 7 := by + apply degree_expanded_product (d := 3) (e := 1) + (∏ i, CWBoundary.middleWeight X (y i)) (if CW75Primitive.hasC y then X else 1) + (degree_product _ (fun i => middleWeight_degree (y i))) + by_cases h : CW75Primitive.hasC y <;> simp [h] + +theorem rightBlock_degree (z : Word) : (rightBlock z).degree ≤ 6 := by + apply degree_expanded_product (d := 3) (e := 0) + (∏ i, CWBoundary.outerWeight X (z i)) (if CW75Primitive.allA z then 0 else 1) + (degree_product _ (fun i => outerWeight_degree (z i))) + by_cases h : CW75Primitive.allA z <;> simp [h] + +def auxiliary : Tensor ℂ PUnit.{1} PUnit.{1} PUnit.{1} := fun _ _ _ => 1 + +theorem auxiliary_rank : Tensor.RankAtMost auxiliary 1 := by + refine ⟨fun _ _ => 1, fun _ _ => 1, fun _ _ => 1, ?_⟩ + funext x y z + simp [auxiliary, Tensor.rankOne] + +def leftMap {N : ℕ} (x : Blocks N) (_ : PUnit.{1} × PUnit.{1}) (_ : PUnit.{1}) : Polynomial ℂ := + ∏ i, leftBlock (x i) + +def middleMap {N : ℕ} (y : Blocks N) (_ : PUnit.{1} × PUnit.{1}) (_ : PUnit.{1}) : Polynomial ℂ := + ∏ i, middleBlock (y i) + +def rightMap {N : ℕ} (z : Blocks N) (_ : PUnit.{1} × PUnit.{1}) (_ : PUnit.{1}) : Polynomial ℂ := + ∏ i, rightBlock (z i) + +def value {N : ℕ} : Tensor ℂ (Blocks N × (PUnit.{1} × PUnit.{1})) + (Blocks N × (PUnit.{1} × PUnit.{1})) (Blocks N × (PUnit.{1} × PUnit.{1})) := + fun x y z => ∏ i, CW75Primitive.tensor (x.1 i) (y.1 i) (z.1 i) + +theorem kernel_eq {N : ℕ} (x y z : Blocks N × (PUnit.{1} × PUnit.{1})) : + PolynomialLocalConstruction.kernel auxiliary leftMap middleMap rightMap x y z = + ∏ i, blockKernel (x.1 i) (y.1 i) (z.1 i) := by + simp [PolynomialLocalConstruction.kernel, LocalMaps.fiberTransform, + auxiliary, leftMap, middleMap, rightMap, blockKernel, Finset.prod_mul_distrib] + +theorem kernel_coefficients {N : ℕ} (x y z : Blocks N × (PUnit.{1} × PUnit.{1})) + (hs : support x.1 y.1 z.1) : + (∀ j, j < 7 * N → + (PolynomialLocalConstruction.kernel auxiliary leftMap middleMap rightMap x y z).coeff j = 0) ∧ + (PolynomialLocalConstruction.kernel auxiliary leftMap middleMap rightMap x y z).coeff (7 * N) = + value x y z := by + have hsites := (support_iff x.1 y.1 z.1).mp hs + have hd (i : Fin N) : X ^ 7 ∣ blockKernel (x.1 i) (y.1 i) (z.1 i) := + Polynomial.X_pow_dvd_iff.mpr (blockKernel_vanishes _ _ _ (hsites i)) + let Q : Fin N → Polynomial ℂ := fun i => Classical.choose (hd i) + have hQ (i : Fin N) : blockKernel (x.1 i) (y.1 i) (z.1 i) = X ^ 7 * Q i := + Classical.choose_spec (hd i) + have hQzero (i : Fin N) : (Q i).coeff 0 = CW75Primitive.tensor (x.1 i) (y.1 i) (z.1 i) := by + have h := blockKernel_leading _ _ _ (hsites i) + rw [hQ] at h + simpa only [Polynomial.coeff_X_pow_mul', le_refl, ite_true, Nat.sub_self] using h + have hfactor : (∏ i, blockKernel (x.1 i) (y.1 i) (z.1 i)) = + X ^ (7 * N) * ∏ i, Q i := by + simp only [hQ, Finset.prod_mul_distrib, Finset.prod_const, + Finset.card_univ, Fintype.card_fin, ← pow_mul] + simp only [kernel_eq, hfactor] + constructor + · intro j hj + simp only [Polynomial.coeff_X_pow_mul', Nat.not_le_of_lt hj, ite_false] + · simp only [Polynomial.coeff_X_pow_mul', le_refl, ite_true, Nat.sub_self, + Polynomial.coeff_zero_prod, hQzero, value] + +def execution (N : ℕ) : PolynomialKernelExecution.Execution + (Blocks N) (Blocks N) (Blocks N) PUnit.{1} PUnit.{1} PUnit.{1} PUnit.{1} PUnit.{1} PUnit.{1} PUnit.{1} support where + auxiliary := auxiliary + rankBound := 1 + auxiliary_rank := auxiliary_rank + order := 7 * N + leftDegree := 7 * N + middleDegree := 7 * N + rightDegree := 6 * N + leftMap := leftMap + middleMap := middleMap + rightMap := rightMap + left_degree := fun x _ _ => degree_product _ (fun i => leftBlock_degree (x i)) + middle_degree := fun y _ _ => degree_product _ (fun i => middleBlock_degree (y i)) + right_degree := fun z _ _ => degree_product _ (fun i => rightBlock_degree (z i)) + value := value + vanishes := fun x y z hs => (kernel_coefficients x y z hs).1 + leading := fun x y z hs => (kernel_coefficients x y z hs).2 + synchronized := fun _ _ _ _ _ => ⟨Subsingleton.elim _ _, Subsingleton.elim _ _⟩ + +@[simp] theorem execution_value (N : ℕ) : (execution N).value = value := rfl + +theorem value_ne_zero_iff {N : ℕ} (x y z : Blocks N × (PUnit.{1} × PUnit.{1})) : + (execution N).value x y z ≠ 0 ↔ + ∀ i, CW75Primitive.tensor (x.1 i) (y.1 i) (z.1 i) ≠ 0 := by + simp [execution_value, value, Finset.prod_ne_zero_iff] + +theorem value_retained {N : ℕ} (x y z : Blocks N × (PUnit.{1} × PUnit.{1})) : + (execution N).value x y z = + if ∀ i, CW75Primitive.tensor (x.1 i) (y.1 i) (z.1 i) ≠ 0 then 1 else 0 := by + by_cases h : ∀ i, CW75Primitive.tensor (x.1 i) (y.1 i) (z.1 i) ≠ 0 + · simp only [ite_eq_left h, execution_value, value] + apply Finset.prod_eq_one + intro i hi + exact retained_coefficient_one _ _ _ (h i) + · rw [ite_eq_right h] + by_contra hn + exact h ((value_ne_zero_iff x y z).mp hn) + +end MatrixMultiplication.Foundation.CW75InitialExecution + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/CoppersmithWinograd/ComplexCW75LabelHierarchy.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/CoppersmithWinograd/ComplexCW75LabelHierarchy.lean new file mode 100644 index 0000000000000000000000000000000000000000..4109a92dd4bc5754f013b196d0ce7f9761dc9ec5 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/CoppersmithWinograd/ComplexCW75LabelHierarchy.lean @@ -0,0 +1,323 @@ +import OAI.LinearAlgebra.MatrixMultiplication.CoppersmithWinograd.ComplexCW75Primitive +import OAI.LinearAlgebra.MatrixMultiplication.Entropy.ComplexHierarchyEntropy + +namespace OAI + +/-! Coppersmith–Winograd tensors, tensor powers and local restrictions. -/ + +noncomputable section + +namespace MatrixMultiplication.Foundation.CW75LabelHierarchy + +open Elementary +open scoped Classical + +abbrev Word := CW75Primitive.Word +abbrev BitWord := Fin 3 → Bool + +def retainedWords : Finset (List BoundaryTerm) := + (Elementary.triples.filter Elementary.retained).toFinset + +abbrev Scalar := ↥retainedWords + +theorem scalar_mem (a : Scalar) : + a.val ∈ Elementary.triples.filter Elementary.retained := by + exact List.mem_toFinset.mp a.property + +theorem scalar_card : Fintype.card Scalar = 75 := by + rw [Fintype.card_coe, retainedWords, + List.toFinset_card_of_nodup (CW75Primitive.triples_nodup.filter _)] + exact Elementary.retained_triples_count + +def letter (a : Scalar) (i : Fin 3) : BoundaryTerm := a.val.getD i.val .a0 + +def grade (a : Scalar) : Fin 3 → CWOriginalWords.OriginalComponent := + fun i => CW75Primitive.component (letter a i) + +def x (a : Scalar) : Word := CWOriginalWords.xWord (grade a) +def y (a : Scalar) : Word := CWOriginalWords.yWord (grade a) +def z (a : Scalar) : Word := CWOriginalWords.zWord (grade a) + +theorem coefficient_one (a : Scalar) : CW75Primitive.tensor (x a) (y a) (z a) = 1 := + CW75Primitive.retained_coefficient_one a.val (scalar_mem a) + +theorem coefficient_ne_zero (a : Scalar) : + CW75Primitive.tensor (x a) (y a) (z a) ≠ 0 := by + rw [coefficient_one] + exact one_ne_zero + +theorem grade_injective : Function.Injective grade := by + intro a b h + apply Subtype.ext + exact CW75Primitive.listedWords_injective a.val b.val + (List.mem_filter.mp (scalar_mem a)).1 (List.mem_filter.mp (scalar_mem b)).1 + (congrArg CWOriginalWords.originalWords h) + +theorem coordinates_injective : Function.Injective (fun a : Scalar => (x a, y a, z a)) := by + intro a b h + apply grade_injective + exact CWOriginalWords.originalWords_injective h + +theorem support_exhausted (u v w : Word) (h : CW75Primitive.tensor u v w ≠ 0) : + ∃ a : Scalar, (x a, y a, z a) = (u, v, w) := by + obtain ⟨terms, hterms, he⟩ := CW75Primitive.support_exhausted u v w h + refine ⟨⟨terms, ?_⟩, he⟩ + simpa [retainedWords] using hterms + +abbrev ActualSupport := + {uvw : Word × Word × Word // CW75Primitive.tensor uvw.1 uvw.2.1 uvw.2.2 ≠ 0} + +def toActualSupport (a : Scalar) : ActualSupport := + ⟨(x a, y a, z a), coefficient_ne_zero a⟩ + +theorem toActualSupport_bijective : Function.Bijective toActualSupport := by + constructor + · intro a b h + exact coordinates_injective (congrArg Subtype.val h) + · intro s + obtain ⟨a, ha⟩ := support_exhausted s.val.1 s.val.2.1 s.val.2.2 s.property + exact ⟨a, Subtype.ext ha⟩ + +def actualSupportEquiv : Scalar ≃ ActualSupport := + Equiv.ofBijective toActualSupport toActualSupport_bijective + +theorem actualSupport_card : Fintype.card ActualSupport = 75 := by + rw [← Fintype.card_congr actualSupportEquiv] + exact scalar_card + +@[simp] theorem decode_original_grade (a : Scalar) : + CWOriginalWords.decodeWord (x a) (y a) (z a) = grade a := + CWOriginalWords.decodeWord_originalWords (grade a) + +private theorem retained_actual (a : Scalar) : + CW75Primitive.retained (x a) (y a) (z a) := by + by_contra h + have hc := coefficient_one a + simp [CW75Primitive.tensor, h] at hc + +private theorem source_ne_zero (a : Scalar) : + CW75Primitive.source (x a) (y a) (z a) ≠ 0 := by + intro h + have hc := coefficient_one a + simp [CW75Primitive.tensor, h] at hc + +theorem hasB_iff_not_hasC (a : Scalar) : + CW75Primitive.hasB (x a) ↔ ¬ CW75Primitive.hasC (y a) := by + have hr := retained_actual a + have ha := CW75Primitive.allA_iff (x a) (y a) (z a) (source_ne_zero a) + constructor + · intro hb hc + exact hr.1 ⟨hb, hc⟩ + · intro hc + by_contra hb + exact hr.2 (ha.mpr ⟨hb, hc⟩) + +def outer (a : Scalar) : Bool := decide (CW75Primitive.hasB (x a)) + +def bPositions (a : Scalar) : BitWord := fun i => decide (x a i ≠ 0) +def cPositions (a : Scalar) : BitWord := fun i => decide (y a i = 2) +def aChoices (a : Scalar) : BitWord := fun i => decide (z a i = 1) +def bChoices (a : Scalar) : BitWord := fun i => decide (x a i = 1) + +theorem bPositions_eq_zero_of_outer_false (a : Scalar) (h : outer a = false) : + bPositions a = fun _ => false := by + have hb : ¬ CW75Primitive.hasB (x a) := by simpa [outer] using h + funext i + have hx : x a i = 0 := by + by_contra hn + exact hb ⟨i, hn⟩ + simp [bPositions, hx] + +theorem cPositions_eq_zero_of_outer_true (a : Scalar) (h : outer a = true) : + cPositions a = fun _ => false := by + have hb : CW75Primitive.hasB (x a) := by simpa [outer] using h + have hc := (hasB_iff_not_hasC a).mp hb + funext i + have hy : y a i ≠ 2 := fun hn => hc ⟨i, hn⟩ + simp [cPositions, hy] + +def outerX (u : Word) : Bool := decide (CW75Primitive.hasB u) +def outerY (v : Word) : Bool := !decide (CW75Primitive.hasC v) + +def bPositionsX (u : Word) : BitWord := fun i => decide (u i ≠ 0) +def bPositionsZ (pb : Bool) (w : Word) : BitWord := + fun i => if pb then decide (w i = 0) else false + +def cPositionsY (v : Word) : BitWord := fun i => decide (v i = 2) +def cPositionsZ (pb : Bool) (w : Word) : BitWord := + fun i => if pb then false else decide (w i = 0) + +def aChoicesY (bs cs : BitWord) (v : Word) : BitWord := + fun i => !bs i && !cs i && decide (v i = 1) +def aChoicesZ (w : Word) : BitWord := fun i => decide (w i = 1) + +def bChoicesX (u : Word) : BitWord := fun i => decide (u i = 1) +def bChoicesY (bs : BitWord) (v : Word) : BitWord := + fun i => bs i && decide (v i = 1) + +theorem outerX_read (a : Scalar) : outerX (x a) = outer a := rfl + +theorem outerY_read (a : Scalar) : outerY (y a) = outer a := by + simp only [outerY, outer, hasB_iff_not_hasC, decide_not] + +theorem bPositionsX_read (a : Scalar) : bPositionsX (x a) = bPositions a := rfl + +theorem bPositionsZ_read (a : Scalar) : bPositionsZ (outer a) (z a) = bPositions a := by + funext i + have hactive := CW75Primitive.boundary_active (x a i) (y a i) (z a i) + (CW75Primitive.source_factors (x a) (y a) (z a) (source_ne_zero a) i) + by_cases hb : CW75Primitive.hasB (x a) + · have hy : y a i ≠ 2 := fun h => (hasB_iff_not_hasC a).mp hb ⟨i, h⟩ + have he : z a i = 0 ↔ x a i ≠ 0 := by tauto + simp [bPositionsZ, outer, bPositions, hb, he] + · have hx : x a i = 0 := by + by_contra h + exact hb ⟨i, h⟩ + simp [bPositionsZ, outer, bPositions, hb, hx] + +theorem cPositionsY_read (a : Scalar) : cPositionsY (y a) = cPositions a := rfl + +theorem cPositionsZ_read (a : Scalar) : cPositionsZ (outer a) (z a) = cPositions a := by + funext i + have hactive := CW75Primitive.boundary_active (x a i) (y a i) (z a i) + (CW75Primitive.source_factors (x a) (y a) (z a) (source_ne_zero a) i) + by_cases hb : CW75Primitive.hasB (x a) + · have hy : y a i ≠ 2 := fun h => (hasB_iff_not_hasC a).mp hb ⟨i, h⟩ + simp [cPositionsZ, outer, cPositions, hb, hy] + · have hx : x a i = 0 := by + by_contra h + exact hb ⟨i, h⟩ + have he : z a i = 0 ↔ y a i = 2 := by tauto + simp [cPositionsZ, outer, cPositions, hb, he] + +theorem aChoicesY_read (a : Scalar) : + aChoicesY (bPositions a) (cPositions a) (y a) = aChoices a := by + funext i + change (!decide ((CW75Primitive.component (letter a i)).x ≠ 0) && + !decide ((CW75Primitive.component (letter a i)).y = 2) && + decide ((CW75Primitive.component (letter a i)).y = 1)) = + decide ((CW75Primitive.component (letter a i)).z = 1) + cases letter a i <;> + norm_num [CW75Primitive.component, CWOriginalWords.OriginalComponent.x, + CWOriginalWords.OriginalComponent.y, CWOriginalWords.OriginalComponent.z, + ← Fin.val_eq_val] + +theorem aChoicesZ_read (a : Scalar) : aChoicesZ (z a) = aChoices a := rfl + +theorem bChoicesX_read (a : Scalar) : bChoicesX (x a) = bChoices a := rfl + +theorem bChoicesY_read (a : Scalar) : + bChoicesY (bPositions a) (y a) = bChoices a := by + funext i + change (decide ((CW75Primitive.component (letter a i)).x ≠ 0) && + decide ((CW75Primitive.component (letter a i)).y = 1)) = + decide ((CW75Primitive.component (letter a i)).x = 1) + cases letter a i <;> + norm_num [CW75Primitive.component, CWOriginalWords.OriginalComponent.x, + CWOriginalWords.OriginalComponent.y, ← Fin.val_eq_val] + +private theorem term_bits_injective : Function.Injective + (fun a : BoundaryTerm => + (decide ((CW75Primitive.component a).x ≠ 0), + decide ((CW75Primitive.component a).y = 2), + decide ((CW75Primitive.component a).z = 1), + decide ((CW75Primitive.component a).x = 1))) := by + intro a b h + cases a <;> cases b <;> + norm_num [CW75Primitive.component, CWOriginalWords.OriginalComponent.x, + CWOriginalWords.OriginalComponent.y, CWOriginalWords.OriginalComponent.z, + ← Fin.val_eq_val] at h <;> rfl + +theorem positionLabels_injective : Function.Injective + (fun a : Scalar => (bPositions a, cPositions a, aChoices a, bChoices a)) := by + intro a b h + apply grade_injective + funext i + apply congrArg CW75Primitive.component + apply term_bits_injective + exact Prod.ext (congrFun (congrArg Prod.fst h) i) + (Prod.ext (congrFun (congrArg (fun q => q.2.1) h) i) + (Prod.ext (congrFun (congrArg (fun q => q.2.2.1) h) i) + (congrFun (congrArg (fun q => q.2.2.2) h) i))) + +def Label : ℕ → Type + | 0 => Bool + | _ + 1 => BitWord + +instance labelFintype (n : ℕ) : Fintype (Label n) := by + cases n <;> simp only [Label] <;> infer_instance + +def labels : (n : ℕ) → Scalar → Label n + | 0 => outer + | 1 => bPositions + | 2 => cPositions + | 3 => aChoices + | 4 => bChoices + | _ + 5 => fun _ _ => false + +inductive Side where + | x | y | z + deriving DecidableEq + +def firstSide : ℕ → Side + | 2 | 3 => .y + | _ => .x + +def secondSide : ℕ → Side + | 1 | 2 | 3 => .z + | _ => .y + +def originalCoordinate : Side → Scalar → Word + | .x => x + | .y => y + | .z => z + +def firstReader : (n : ℕ) → LabelRecord Label n → Word → Label n + | 0, _ => outerX + | 1, _ => bPositionsX + | 2, _ => cPositionsY + | 3, prior => aChoicesY prior.1.2 prior.2 + | 4, _ => bChoicesX + | _ + 5, _ => fun _ _ => false + +def secondReader : (n : ℕ) → LabelRecord Label n → Word → Label n + | 0, _ => outerY + | 1, prior => bPositionsZ prior.2 + | 2, prior => cPositionsZ prior.1.2 + | 3, _ => aChoicesZ + | 4, prior => bChoicesY prior.1.1.2 + | _ + 5, _ => fun _ _ => false + +theorem firstReader_readable (n : ℕ) (hn : n < 5) (a : Scalar) : + firstReader n (labelRecordOf labels n a) (originalCoordinate (firstSide n) a) = + labels n a := by + interval_cases n + · exact outerX_read a + · exact bPositionsX_read a + · exact cPositionsY_read a + · exact aChoicesY_read a + · exact bChoicesX_read a + +theorem secondReader_readable (n : ℕ) (hn : n < 5) (a : Scalar) : + secondReader n (labelRecordOf labels n a) (originalCoordinate (secondSide n) a) = + labels n a := by + interval_cases n + · exact outerY_read a + · exact bPositionsZ_read a + · exact cPositionsZ_read a + · exact aChoicesZ_read a + · exact bChoicesY_read a + +theorem completeRecord_injective : Function.Injective (labelRecordOf labels 5) := by + intro a b h + apply positionLabels_injective + exact Prod.ext (congrArg (fun q : LabelRecord Label 5 => q.1.1.1.2) h) + (Prod.ext (congrArg (fun q : LabelRecord Label 5 => q.1.1.2) h) + (Prod.ext (congrArg (fun q : LabelRecord Label 5 => q.1.2) h) + (congrArg (fun q : LabelRecord Label 5 => q.2) h))) + +end MatrixMultiplication.Foundation.CW75LabelHierarchy + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/CoppersmithWinograd/ComplexCW75Primitive.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/CoppersmithWinograd/ComplexCW75Primitive.lean new file mode 100644 index 0000000000000000000000000000000000000000..58e083ebbd546888c059fff15cb5b10f774df55b --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/CoppersmithWinograd/ComplexCW75Primitive.lean @@ -0,0 +1,300 @@ +import OAI.LinearAlgebra.MatrixMultiplication.CoppersmithWinograd.ComplexCWPrimitiveDegeneration +import OAI.LinearAlgebra.MatrixMultiplication.CoppersmithWinograd.ComplexCWOriginalWords +import OAI.LinearAlgebra.MatrixMultiplication.Tensor.ComplexElementary + +namespace OAI + +/-! Coppersmith–Winograd tensors, tensor powers and local restrictions. -/ + +noncomputable section + +namespace MatrixMultiplication.Foundation.CW75Primitive + +open Polynomial +open scoped BigOperators Classical + +abbrev Word := Fin 3 → Fin 3 + +def source : Tensor ℂ Word Word Word := Tensor.power CWBoundary.tensor 3 + +def hasB (x : Word) : Prop := ∃ i, x i ≠ 0 + +def hasC (y : Word) : Prop := ∃ i, y i = 2 + +def allA (z : Word) : Prop := ∀ i, z i ≠ 0 + +def retained (x y z : Word) : Prop := ¬ (hasB x ∧ hasC y) ∧ ¬ allA z + +def tensor : Tensor ℂ Word Word Word := + fun x y z => if retained x y z then source x y z else 0 + +def mixed : Tensor ℂ Word Word Word := + fun x y z => if hasB x ∧ hasC y ∧ ¬ allA z then source x y z else 0 + +theorem boundary_active (x y z : Fin 3) (h : CWBoundary.tensor x y z ≠ 0) : + z ≠ 0 ↔ x = 0 ∧ y ≠ 2 := by + fin_cases x <;> fin_cases y <;> fin_cases z <;> + norm_num [← Fin.val_eq_val, CWBoundary.tensor, CoppersmithWinograd.tensor] at h <;> + norm_num [← Fin.val_eq_val] + +theorem source_factors (x y z : Word) (h : source x y z ≠ 0) (i : Fin 3) : + CWBoundary.tensor (x i) (y i) (z i) ≠ 0 := by + unfold source Tensor.power at h + exact (Finset.prod_ne_zero_iff.mp h) i (Finset.mem_univ i) + +theorem allA_iff (x y z : Word) (h : source x y z ≠ 0) : + allA z ↔ ¬ hasB x ∧ ¬ hasC y := by + have hpoint (i : Fin 3) : z i ≠ 0 ↔ x i = 0 ∧ y i ≠ 2 := + boundary_active _ _ _ (source_factors x y z h i) + simp only [allA, hasB, hasC, not_exists, not_not, hpoint, forall_and] + +def leftMap (output input : Word) : Polynomial ℂ := + if input = output then (if hasB output then X else 1) else 0 + +def middleMap (output input : Word) : Polynomial ℂ := + if input = output then (if hasC output then X else 1) else 0 + +def rightMap (output input : Word) : Polynomial ℂ := + if input = output ∧ ¬ allA output then 1 else 0 + +def polynomial : Tensor (Polynomial ℂ) Word Word Word := + Tensor.restrict leftMap middleMap rightMap (fun x y z => C (source x y z)) + +theorem polynomial_apply (x y z : Word) : + polynomial x y z = if allA z then 0 else + (if hasB x then X else 1) * (if hasC y then X else 1) * C (source x y z) := by + by_cases hz : allA z <;> + simp [polynomial, Tensor.restrict, leftMap, middleMap, rightMap, + ite_mul, mul_ite, hz] + +theorem polynomial_identity (x y z : Word) : + polynomial x y z = X * C (tensor x y z) + X ^ 2 * C (mixed x y z) := by + by_cases hs : source x y z = 0 + · simp [polynomial_apply, tensor, mixed, hs] + · have hA := allA_iff x y z hs + by_cases hz : allA z <;> by_cases hx : hasB x <;> by_cases hy : hasC y + all_goals simp_all [polynomial_apply, tensor, mixed, retained, pow_two] + +theorem polynomial_coeff (x y z : Word) (j : ℕ) : + (polynomial x y z).coeff j = + (if j = 1 then tensor x y z else 0) + (if j = 2 then mixed x y z else 0) := by + rw [polynomial_identity, Polynomial.coeff_add, + mul_comm X (C (tensor x y z)), mul_comm (X ^ 2) (C (mixed x y z)), + Polynomial.coeff_C_mul_X, Polynomial.coeff_C_mul_X_pow] + +theorem leftMap_degree (output input : Word) : (leftMap output input).degree ≤ 1 := by + by_cases heq : input = output <;> by_cases hx : hasB output <;> + simp [leftMap, heq, hx] + +theorem middleMap_degree (output input : Word) : (middleMap output input).degree ≤ 1 := by + by_cases heq : input = output <;> by_cases hy : hasC output <;> + simp [middleMap, heq, hy] + +theorem rightMap_degree (output input : Word) : (rightMap output input).degree ≤ 0 := by + by_cases h : input = output ∧ ¬ allA output <;> simp [rightMap, h] + +def restriction : Tensor.PolynomialRestrictionDegeneration source tensor 1 1 1 0 where + leftMap := leftMap + middleMap := middleMap + rightMap := rightMap + left_degree := leftMap_degree + middle_degree := middleMap_degree + right_degree := rightMap_degree + vanishes := by + intro x y z j hj + have hcoeff := polynomial_coeff x y z j + unfold polynomial at hcoeff + rw [hcoeff] + have hjzero : j = 0 := by omega + simp [hjzero] + leading := by + intro x y z + have hcoeff := polynomial_coeff x y z 1 + unfold polynomial at hcoeff + rw [hcoeff] + simp + +@[simp] theorem restriction_basePolynomial : restriction.basePolynomial = polynomial := rfl + +def sourceApproximation : Tensor.PolynomialApproximation source 27 15 45 := + CWPrimitiveDegeneration.boundaryApproximation.power 3 + +def approximation : Tensor.PolynomialApproximation tensor 27 31 92 := + restriction.compose sourceApproximation + +@[simp] theorem approximation_polynomial : + approximation.polynomial = Tensor.restrict leftMap middleMap rightMap + (fun x y z => Polynomial.expand ℂ 2 + (Tensor.power CWPrimitiveDegeneration.boundaryApproximation.polynomial 3 x y z)) := by + simp only [approximation, Tensor.PolynomialRestrictionDegeneration.compose, + Tensor.PolynomialRestrictionDegeneration.compositionPolynomial, + restriction, sourceApproximation, Tensor.PolynomialApproximation.power] + +theorem leading (x y z : Word) : (approximation.polynomial x y z).coeff 31 = tensor x y z := + approximation.leading x y z + +theorem borderRankAtMost : Tensor.BorderRankAtMost tensor 27 := approximation.borderRankAtMost + +theorem original_support (x y z : Word) (h : tensor x y z ≠ 0) (i : Fin 3) : + (x i).val + (y i).val + (z i).val = 2 := by + have hs : source x y z ≠ 0 := by + intro hs + simp [tensor, hs] at h + have hi := source_factors x y z hs i + have hcw : CoppersmithWinograd.tensor (x i) (y i) (z i) ≠ 0 := by + intro hzero + simp [CWBoundary.tensor, hzero] at hi + exact (CWOriginalWords.tensor_ne_zero_iff _ _ _).mp hcw + +theorem originalWords_decode (x y z : Word) (h : tensor x y z ≠ 0) : + CWOriginalWords.originalWords (CWOriginalWords.decodeWord x y z) = (x, y, z) := + CWOriginalWords.originalWords_decodeWord_of_support x y z (original_support x y z h) + +open Elementary + +def component : BoundaryTerm → CWOriginalWords.OriginalComponent + | .a0 => ⟨(0, 0, 2), by decide⟩ + | .a1 => ⟨(0, 1, 1), by decide⟩ + | .b0 => ⟨(2, 0, 0), by decide⟩ + | .b1 => ⟨(1, 1, 0), by decide⟩ + | .c => ⟨(0, 2, 0), by decide⟩ + +theorem component_injective : Function.Injective component := by + intro a b h + have hx := congrArg (fun g => (CWOriginalWords.OriginalComponent.x g).val) h + have hy := congrArg (fun g => (CWOriginalWords.OriginalComponent.y g).val) h + have hz := congrArg (fun g => (CWOriginalWords.OriginalComponent.z g).val) h + cases a <;> cases b <;> + simp_all [component, CWOriginalWords.OriginalComponent.x, + CWOriginalWords.OriginalComponent.y, CWOriginalWords.OriginalComponent.z] + +def listedWord (w : List BoundaryTerm) : Fin 3 → CWOriginalWords.OriginalComponent := + fun i => component (w.getD i.val .a0) + +def listedX (w : List BoundaryTerm) : Word := CWOriginalWords.xWord (listedWord w) +def listedY (w : List BoundaryTerm) : Word := CWOriginalWords.yWord (listedWord w) +def listedZ (w : List BoundaryTerm) : Word := CWOriginalWords.zWord (listedWord w) + +theorem tensor_on_triple (a b third : BoundaryTerm) : + tensor (listedX [a, b, third]) (listedY [a, b, third]) (listedZ [a, b, third]) = + if Elementary.retained [a, b, third] then 1 else 0 := by + have hboundary (s : BoundaryTerm) : + CWBoundary.tensor (component s).x (component s).y (component s).z = 1 := by + cases s <;> + norm_num [component, CWOriginalWords.OriginalComponent.x, + CWOriginalWords.OriginalComponent.y, CWOriginalWords.OriginalComponent.z, + CWBoundary.tensor, CoppersmithWinograd.tensor, ← Fin.val_eq_val] + have hx (s : BoundaryTerm) : (component s).x.val = s.x := by cases s <;> rfl + have hy (s : BoundaryTerm) : (component s).y.val = s.y := by cases s <;> rfl + have hz (s : BoundaryTerm) : (component s).z.val = s.z := by cases s <;> rfl + simp [tensor, retained, source, Tensor.power, + hasB, hasC, allA, Fin.exists_fin_succ, Fin.forall_fin_succ, + listedX, listedY, listedZ, listedWord, + CWOriginalWords.xWord, CWOriginalWords.yWord, CWOriginalWords.zWord, + ← Fin.val_eq_val, hboundary, hx, hy, hz, + Elementary.retained, Elementary.testA, Elementary.testB, Elementary.testC] + cases a <;> cases b <;> cases third <;> + norm_num [BoundaryTerm.x, BoundaryTerm.y, BoundaryTerm.z] + +theorem mem_triples_shape (w : List BoundaryTerm) (hw : w ∈ Elementary.triples) : + ∃ a b third, w = [a, b, third] := by + simp only [Elementary.triples, List.mem_flatMap, List.mem_map] at hw + rcases hw with ⟨a, _, b, _, third, _, rfl⟩ + exact ⟨a, b, third, rfl⟩ + +theorem tensor_on_enumeration (w : List BoundaryTerm) (hw : w ∈ Elementary.triples) : + tensor (listedX w) (listedY w) (listedZ w) = + if Elementary.retained w then 1 else 0 := by + rcases mem_triples_shape w hw with ⟨a, b, third, rfl⟩ + exact tensor_on_triple a b third + +theorem retained_coefficient_one (w : List BoundaryTerm) + (hw : w ∈ Elementary.triples.filter Elementary.retained) : + tensor (listedX w) (listedY w) (listedZ w) = 1 := by + rw [tensor_on_enumeration w (List.mem_filter.mp hw).1] + simp [(List.mem_filter.mp hw).2] + +theorem listed_coefficient_count : + (Elementary.triples.filter (fun w => + decide (tensor (listedX w) (listedY w) (listedZ w) = 1))).length = 75 := by + have heq : Elementary.triples.filter (fun w => + decide (tensor (listedX w) (listedY w) (listedZ w) = 1)) = + Elementary.triples.filter Elementary.retained := by + apply List.filter_congr + intro w hw + rw [tensor_on_enumeration w hw] + cases Elementary.retained w <;> simp + rw [heq] + exact Elementary.retained_triples_count + +theorem listedWords_injective (w v : List BoundaryTerm) + (hw : w ∈ Elementary.triples) (hv : v ∈ Elementary.triples) + (he : CWOriginalWords.originalWords (listedWord w) = + CWOriginalWords.originalWords (listedWord v)) : w = v := by + rcases mem_triples_shape w hw with ⟨a, b, third, rfl⟩ + rcases mem_triples_shape v hv with ⟨a', b', c', rfl⟩ + have hword := CWOriginalWords.originalWords_injective he + have ha := component_injective (by simpa [listedWord] using congrFun hword 0) + have hb := component_injective (by simpa [listedWord] using congrFun hword 1) + have hc := component_injective (by simpa [listedWord] using congrFun hword 2) + simp [ha, hb, hc] + +theorem boundary_component_complete (x y z : Fin 3) + (h : CWBoundary.tensor x y z ≠ 0) : + ∃ a : BoundaryTerm, (component a).x = x ∧ (component a).y = y ∧ + (component a).z = z := by + fin_cases x <;> fin_cases y <;> fin_cases z <;> + norm_num [CWBoundary.tensor, CoppersmithWinograd.tensor] at h + all_goals first + | exact ⟨.a0, rfl, rfl, rfl⟩ + | exact ⟨.a1, rfl, rfl, rfl⟩ + | exact ⟨.b0, rfl, rfl, rfl⟩ + | exact ⟨.b1, rfl, rfl, rfl⟩ + | exact ⟨.c, rfl, rfl, rfl⟩ + +private theorem term_mem_all (a : BoundaryTerm) : a ∈ BoundaryTerm.all := by + cases a <;> simp [BoundaryTerm.all] + +private theorem triple_mem (a b third : BoundaryTerm) : [a, b, third] ∈ Elementary.triples := by + simp only [Elementary.triples, List.mem_flatMap, List.mem_map] + exact ⟨a, term_mem_all a, b, term_mem_all b, third, term_mem_all third, rfl⟩ + +theorem triples_nodup : Elementary.triples.Nodup := by + decide + +theorem support_exhausted (x y z : Word) (h : tensor x y z ≠ 0) : + ∃ w, w ∈ Elementary.triples.filter Elementary.retained ∧ + (listedX w, listedY w, listedZ w) = (x, y, z) := by + have hs : source x y z ≠ 0 := by + intro hs + simp [tensor, hs] at h + obtain ⟨a, hax, hay, haz⟩ := + boundary_component_complete (x 0) (y 0) (z 0) (source_factors x y z hs 0) + obtain ⟨b, hbx, hby, hbz⟩ := + boundary_component_complete (x 1) (y 1) (z 1) (source_factors x y z hs 1) + obtain ⟨third, hcx, hcy, hcz⟩ := + boundary_component_complete (x 2) (y 2) (z 2) (source_factors x y z hs 2) + have hx : listedX [a, b, third] = x := by + funext i + fin_cases i <;> + simp [listedX, listedWord, CWOriginalWords.xWord, hax, hbx, hcx] + have hy : listedY [a, b, third] = y := by + funext i + fin_cases i <;> + simp [listedY, listedWord, CWOriginalWords.yWord, hay, hby, hcy] + have hz : listedZ [a, b, third] = z := by + funext i + fin_cases i <;> + simp [listedZ, listedWord, CWOriginalWords.zWord, haz, hbz, hcz] + have hc := tensor_on_triple a b third + rw [hx, hy, hz] at hc + have hr : Elementary.retained [a, b, third] = true := by + cases hret : Elementary.retained [a, b, third] <;> simp_all + exact ⟨[a, b, third], List.mem_filter.mpr ⟨triple_mem a b third, hr⟩, + Prod.ext hx (Prod.ext hy hz)⟩ + +end MatrixMultiplication.Foundation.CW75Primitive + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/CoppersmithWinograd/ComplexCWBoundary.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/CoppersmithWinograd/ComplexCWBoundary.lean new file mode 100644 index 0000000000000000000000000000000000000000..a145aef49a37a907aa28c64e0d7466456502e5a7 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/CoppersmithWinograd/ComplexCWBoundary.lean @@ -0,0 +1,249 @@ +import OAI.LinearAlgebra.MatrixMultiplication.CoppersmithWinograd.ComplexCoppersmithWinograd + +namespace OAI + +/-! Coppersmith–Winograd tensors, tensor powers and local restrictions. -/ + +noncomputable section + +namespace MatrixMultiplication.Foundation +namespace CWBoundary + +open Polynomial + +def deleted : Tensor ℂ (Fin 3) (Fin 3) (Fin 3) := + fun x y z => if x = 1 ∧ y = 0 ∧ z = 1 then 1 else 0 + +def tensor : Tensor ℂ (Fin 3) (Fin 3) (Fin 3) := + fun x y z => if x = 1 ∧ y = 0 ∧ z = 1 then 0 + else CoppersmithWinograd.tensor x y z + +@[simp] theorem tensor_deleted : tensor 1 0 1 = 0 := by simp [tensor] + +theorem tensor_preserves (x y z : Fin 3) (h : ¬ (x = 1 ∧ y = 0 ∧ z = 1)) : + tensor x y z = CoppersmithWinograd.tensor x y z := by simp [tensor, h] + +theorem deleted_rankAtMost : Tensor.RankAtMost deleted 1 := by + have heq : deleted = Tensor.rankOne + (fun x : Fin 3 => if x = 1 then (1 : ℂ) else 0) + (fun y : Fin 3 => if y = 0 then (1 : ℂ) else 0) + (fun z : Fin 3 => if z = 1 then (1 : ℂ) else 0) := by + funext x y z + by_cases hx : x = 1 <;> by_cases hy : y = 0 <;> by_cases hz : z = 1 <;> + simp [deleted, Tensor.rankOne, hx, hy, hz] + rw [heq] + exact Tensor.rankOne_rankAtMost _ _ _ + +section LocalMaps + +variable {K : Type*} [CommSemiring K] + +def diagonalMap (w : Fin 3 → K) : Fin 3 → Fin 3 → K := + fun output input => if input = output then w output else 0 + +def outerWeight (t : K) (x : Fin 3) : K := if x = 1 then t else 1 + +def middleWeight (t : K) (y : Fin 3) : K := if y = 1 then 1 else t + +def outerMap (t : K) : Fin 3 → Fin 3 → K := diagonalMap (outerWeight t) + +def middleMap (t : K) : Fin 3 → Fin 3 → K := diagonalMap (middleWeight t) + +theorem restrict_diagonal_apply (a b c : Fin 3 → K) + (T : Tensor K (Fin 3) (Fin 3) (Fin 3)) (x y z : Fin 3) : + Tensor.restrict (diagonalMap a) (diagonalMap b) (diagonalMap c) T x y z = + a x * b y * c z * T x y z := by + simp [Tensor.restrict, diagonalMap, ite_mul, mul_ite] + +theorem weight_on_support (t : K) (x y z : Fin 3) + (hs : x.val + y.val + z.val = 2) : + outerWeight t x * middleWeight t y * outerWeight t z = + if x = 1 ∧ y = 0 ∧ z = 1 then t ^ 3 else t := by + fin_cases x <;> fin_cases y <;> fin_cases z <;> + norm_num at hs <;> norm_num [outerWeight, middleWeight] + all_goals ring + +theorem scale_lifted_tensor (f : ℂ →+* K) (t : K) : + Tensor.restrict (outerMap t) (middleMap t) (outerMap t) + (fun x y z => f (CoppersmithWinograd.tensor x y z)) = + fun x y z => t * f (tensor x y z) + t ^ 3 * f (deleted x y z) := by + funext x y z + rw [outerMap, middleMap, restrict_diagonal_apply] + by_cases hs : x.val + y.val + z.val = 2 + · rw [weight_on_support t x y z hs] + by_cases hd : x = 1 ∧ y = 0 ∧ z = 1 <;> + simp [tensor, deleted, CoppersmithWinograd.tensor, hs, hd] + · by_cases hd : x = 1 ∧ y = 0 ∧ z = 1 + · rcases hd with ⟨rfl, rfl, rfl⟩ + norm_num at hs + · simp [tensor, deleted, CoppersmithWinograd.tensor, hs, hd] + +end LocalMaps + +theorem scaling_identity (t : ℂ) : + Tensor.restrict (outerMap t) (middleMap t) (outerMap t) + CoppersmithWinograd.tensor = + fun x y z => t * tensor x y z + t ^ 3 * deleted x y z := by + simpa using scale_lifted_tensor (RingHom.id ℂ) t + +def scalingPolynomial : Tensor (Polynomial ℂ) (Fin 3) (Fin 3) (Fin 3) := + Tensor.restrict (outerMap X) (middleMap X) (outerMap X) + (fun x y z => C (CoppersmithWinograd.tensor x y z)) + +theorem scalingPolynomial_apply (x y z : Fin 3) : + scalingPolynomial x y z = X * C (tensor x y z) + X ^ 3 * C (deleted x y z) := by + exact congrFun (congrFun (congrFun (scale_lifted_tensor C X) x) y) z + +theorem scalingPolynomial_coeff (x y z : Fin 3) (k : ℕ) : + (scalingPolynomial x y z).coeff k = + (if k = 1 then tensor x y z else 0) + + (if k = 3 then deleted x y z else 0) := by + rw [scalingPolynomial_apply, Polynomial.coeff_add, + mul_comm X (C (tensor x y z)), mul_comm (X ^ 3) (C (deleted x y z)), + Polynomial.coeff_C_mul_X, Polynomial.coeff_C_mul_X_pow] + +theorem scalingPolynomial_leading (x y z : Fin 3) : + (scalingPolynomial x y z).coeff 1 = tensor x y z := by + simp [scalingPolynomial_coeff] + +theorem scalingPolynomial_degree (x y z : Fin 3) : + (scalingPolynomial x y z).degree ≤ 3 := by + rw [scalingPolynomial_apply, + mul_comm X (C (tensor x y z)), mul_comm (X ^ 3) (C (deleted x y z))] + apply Polynomial.degree_add_le_of_degree_le + · exact (Polynomial.degree_C_mul_X_le (tensor x y z)).trans (by norm_num) + · exact Polynomial.degree_C_mul_X_pow_le 3 (deleted x y z) + +def normalizedCurve (t : ℂ) : Tensor ℂ (Fin 3) (Fin 3) (Fin 3) := + fun x y z => tensor x y z + t ^ 2 * deleted x y z + +theorem normalizedCurve_restriction (t : ℂ) (ht : t ≠ 0) : + normalizedCurve t = Tensor.restrict + (diagonalMap (fun x => t⁻¹ * outerWeight t x)) + (middleMap t) (outerMap t) CoppersmithWinograd.tensor := by + funext x y z + rw [middleMap, outerMap, restrict_diagonal_apply] + have h := congrFun (congrFun (congrFun (scaling_identity t) x) y) z + rw [outerMap, middleMap, restrict_diagonal_apply] at h + calc + normalizedCurve t x y z = + (t⁻¹ * t) * tensor x y z + (t⁻¹ * t) * t ^ 2 * deleted x y z := by + simp [normalizedCurve, inv_mul_cancel₀ ht] + _ = t⁻¹ * (t * tensor x y z + t ^ 3 * deleted x y z) := by ring + _ = t⁻¹ * (outerWeight t x * middleWeight t y * outerWeight t z * + CoppersmithWinograd.tensor x y z) := by rw [h] + _ = _ := by ring + +theorem degeneration : Tensor.DegeneratesTo CoppersmithWinograd.tensor tensor := by + have hf : Continuous normalizedCurve := by + unfold normalizedCurve + fun_prop + have hclosed : IsClosed {t : ℂ | normalizedCurve t ∈ + closure (Tensor.restrictionOrbit CoppersmithWinograd.tensor)} := + isClosed_closure.preimage hf + have hsubset : ({0}ᶜ : Set ℂ) ⊆ {t : ℂ | normalizedCurve t ∈ + closure (Tensor.restrictionOrbit CoppersmithWinograd.tensor)} := by + intro t ht + apply subset_closure + exact ⟨diagonalMap (fun x => t⁻¹ * outerWeight t x), middleMap t, outerMap t, + normalizedCurve_restriction t (by simpa using ht)⟩ + have hz := closure_minimal hsubset hclosed ((dense_compl_singleton (0 : ℂ)) 0) + have heq : normalizedCurve 0 = tensor := by + funext x y z + simp [normalizedCurve] + change normalizedCurve 0 ∈ + closure (Tensor.restrictionOrbit CoppersmithWinograd.tensor) at hz + rw [heq] at hz + exact hz + +def weight (x y z : Fin 3) : ℕ := + (if x = 1 then 1 else 0) + (if y = 1 then 0 else 1) + + (if z = 1 then 1 else 0) + +def polynomial : Tensor (Polynomial ℂ) (Fin 3) (Fin 3) (Fin 3) := + Tensor.restrict (outerMap X) (middleMap X) (outerMap X) + CoppersmithWinograd.polynomial + +theorem polynomial_rankAtMost : Tensor.RankAtMost polynomial 3 := + CoppersmithWinograd.rank_bound.restrict (outerMap X) (middleMap X) (outerMap X) + +theorem polynomial_apply (x y z : Fin 3) : + polynomial x y z = + if x.val + y.val + z.val = 2 ∨ x.val + y.val + z.val = 4 ∨ + x.val + y.val + z.val = 6 then + X ^ (x.val + y.val + z.val + weight x y z) else 0 := by + unfold polynomial outerMap middleMap + rw [restrict_diagonal_apply, CoppersmithWinograd.polynomial_apply] + by_cases hs : x.val + y.val + z.val = 2 ∨ x.val + y.val + z.val = 4 ∨ + x.val + y.val + z.val = 6 + · simp only [ite_eq_left hs] + by_cases hx : x = 1 <;> by_cases hy : y = 1 <;> by_cases hz : z = 1 <;> + simp [outerWeight, middleWeight, weight, hx, hy, hz, pow_add] <;> ring + · simp [hs] + +theorem weighted_degree (x y z : Fin 3) + (hs : x.val + y.val + z.val = 2 ∨ x.val + y.val + z.val = 4 ∨ + x.val + y.val + z.val = 6) : + (x.val + y.val + z.val + weight x y z = 3 ↔ + x.val + y.val + z.val = 2 ∧ ¬ (x = 1 ∧ y = 0 ∧ z = 1)) ∧ + 3 ≤ x.val + y.val + z.val + weight x y z ∧ + x.val + y.val + z.val + weight x y z ≤ 7 := by + fin_cases x <;> fin_cases y <;> fin_cases z <;> norm_num at hs <;> norm_num [weight] + +theorem polynomial_leading (x y z : Fin 3) : + (polynomial x y z).coeff 3 = tensor x y z := by + rw [polynomial_apply] + by_cases hs : x.val + y.val + z.val = 2 ∨ x.val + y.val + z.val = 4 ∨ + x.val + y.val + z.val = 6 + · simp only [ite_eq_left hs, Polynomial.coeff_X_pow] + have hd : (3 = x.val + y.val + z.val + weight x y z) ↔ + (x.val + y.val + z.val = 2 ∧ ¬ (x = 1 ∧ y = 0 ∧ z = 1)) := + eq_comm.trans (weighted_degree x y z hs).1 + simp only [hd] + by_cases hb : x = 1 ∧ y = 0 ∧ z = 1 <;> + by_cases htwo : x.val + y.val + z.val = 2 <;> + simp [tensor, CoppersmithWinograd.tensor, hb, htwo] + · have htwo : x.val + y.val + z.val ≠ 2 := fun h => hs (Or.inl h) + rw [ite_eq_right hs] + simp [tensor, CoppersmithWinograd.tensor, htwo] + +theorem polynomial_vanishes (x y z : Fin 3) (k : ℕ) (hk : k < 3) : + (polynomial x y z).coeff k = 0 := by + rw [polynomial_apply] + by_cases hs : x.val + y.val + z.val = 2 ∨ x.val + y.val + z.val = 4 ∨ + x.val + y.val + z.val = 6 + · have hd := (weighted_degree x y z hs).2.1 + have hne : k ≠ x.val + y.val + z.val + weight x y z := by omega + simp [hs, Polynomial.coeff_X_pow, hne] + · simp [hs] + +theorem polynomial_degree (x y z : Fin 3) : (polynomial x y z).degree ≤ 7 := by + rw [polynomial_apply] + by_cases hs : x.val + y.val + z.val = 2 ∨ x.val + y.val + z.val = 4 ∨ + x.val + y.val + z.val = 6 + · rw [ite_eq_left hs] + apply Polynomial.degree_le_of_natDegree_le + rw [Polynomial.natDegree_X_pow] + exact (weighted_degree x y z hs).2.2 + · simp [hs] + +def approximation : Tensor.PolynomialApproximation tensor 3 3 7 where + polynomial := polynomial + rank_bound := polynomial_rankAtMost + vanishes := polynomial_vanishes + leading := polynomial_leading + degree_bound := polynomial_degree + +theorem borderRankAtMost : Tensor.BorderRankAtMost tensor 3 := + approximation.borderRankAtMost + +theorem rank_power (n : ℕ) : + Tensor.RankAtMost (Tensor.power tensor n) ((7 * n + 1) * 3 ^ n) := + approximation.rank_power n + +end CWBoundary +end MatrixMultiplication.Foundation + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/CoppersmithWinograd/ComplexCWLocalConstruction.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/CoppersmithWinograd/ComplexCWLocalConstruction.lean new file mode 100644 index 0000000000000000000000000000000000000000..3543c51fb326d94a029c2964e649984858d3ee97 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/CoppersmithWinograd/ComplexCWLocalConstruction.lean @@ -0,0 +1,132 @@ +import OAI.LinearAlgebra.MatrixMultiplication.Polynomial.ComplexPolynomialLocalConstruction +import OAI.LinearAlgebra.MatrixMultiplication.CoppersmithWinograd.ComplexCWOriginalWords + +namespace OAI + +/-! Coppersmith–Winograd tensors, tensor powers and local restrictions. -/ + +noncomputable section + +namespace MatrixMultiplication.Foundation.CWLocalConstruction + +open Tensor OrientationRates CWOriginalWords PolynomialLocalConstruction + +abbrev Site (m : ℕ) := Orientation × Fin m + +@[simp] theorem site_card (m : ℕ) : Fintype.card (Site m) = 6 * m := by + simp only [Site, Fintype.card_prod, orientation_card, Fintype.card_fin] + +def siteEquiv (m : ℕ) : Fin (6 * m) ≃ Site m := + (Fintype.equivFinOfCardEq (site_card m)).symm + +def sourceApproximation (m : ℕ) : + PolynomialApproximation (siteTensor (Site := Site m)) + (3 ^ (6 * m)) (2 * (6 * m)) (6 * (6 * m)) := by + have W := (CoppersmithWinograd.approximation.power (6 * m)).pullback + (fun x : Site m → Fin 3 => fun i => x (siteEquiv m i)) + (fun y : Site m → Fin 3 => fun i => y (siteEquiv m i)) + (fun z : Site m → Fin 3 => fun i => z (siteEquiv m i)) + have hsource : Tensor.pullback + (fun x : Site m → Fin 3 => fun i => x (siteEquiv m i)) + (fun y : Site m → Fin 3 => fun i => y (siteEquiv m i)) + (fun z : Site m → Fin 3 => fun i => z (siteEquiv m i)) + (Tensor.power CoppersmithWinograd.tensor (6 * m)) = + siteTensor (Site := Site m) := by + funext x y z + exact (siteTensor_eq_power (siteEquiv m) x y z).symm + rw [hsource] at W + exact W + +variable {AX AY AZ Label : Type*} +variable [Fintype AX] [Fintype AY] [Fintype AZ] [Fintype Label] [DecidableEq Label] +variable {m a b c : ℕ} + +abbrev CWPrimitive (m a b c : ℕ) := + Primitive (Site m → Fin 3) (Site m → Fin 3) (Site m → Fin 3) + AX AY AZ Label OriginalComponent m a b c + +variable (P : CWPrimitive (AX := AX) (AY := AY) (AZ := AZ) (Label := Label) m a b c) + +def word (label : Label) : Site m → OriginalComponent := + fun site => P.word label site.1 site.2 + +structure SourceCompatible (physical : Site m → Orientation) : Prop where + support_contains : ∀ x y z, + siteTensor x y z ≠ 0 → P.support x y z + grade_decodes : ∀ x y z, siteTensor x y z ≠ 0 → + originalWords (permuteWord physical + (fun site => P.gradeOf x y z site.1 site.2)) = (x, y, z) + designated_coordinates : ∀ label, + (P.designatedX label, P.designatedY label, P.designatedZ label) = + originalWords (permuteWord physical (word P label)) + +namespace SourceCompatible + +variable {P} {physical : Site m → Orientation} +variable (h : SourceCompatible P physical) + +include h + +theorem inputSupported : P.InputSupported (siteTensor (Site := Site m)) := by + intro x y z hs + by_contra hn + exact hs (h.support_contains x y z hn) + +theorem designatedCoefficients : + P.DesignatedCoefficients (siteTensor (Site := Site m)) := by + intro label + have hc := congrArg (fun xyz => siteTensor xyz.1 xyz.2.1 xyz.2.2) + (h.designated_coordinates label) + exact hc.trans (siteTensor_oriented_originalWords physical (word P label)) + +theorem grade_eq_word_iff (x y z : Site m → Fin 3) + (nonzero : siteTensor x y z ≠ 0) (label : Label) : + P.gradeOf x y z = P.word label ↔ + (x, y, z) = (P.designatedX label, P.designatedY label, P.designatedZ label) := by + constructor + · intro hgrade + calc + (x, y, z) = originalWords (permuteWord physical + (fun site => P.gradeOf x y z site.1 site.2)) := + (h.grade_decodes x y z nonzero).symm + _ = originalWords (permuteWord physical (word P label)) := by rw [hgrade]; rfl + _ = (P.designatedX label, P.designatedY label, P.designatedZ label) := + (h.designated_coordinates label).symm + · intro hcoordinates + calc + P.gradeOf x y z = P.gradeOf (P.designatedX label) (P.designatedY label) + (P.designatedZ label) := + congrArg (fun xyz => P.gradeOf xyz.1 xyz.2.1 xyz.2.2) hcoordinates + _ = P.word label := P.designated_word label + +def terminalApproximation : + PolynomialApproximation + (Tensor.directSum (fun _ : Label => + matrixCoefficients (K := ℂ) (Fin a) (Fin b) (Fin c))) + (3 ^ (6 * m) * P.rankBound) + ((2 * (6 * m)) * (P.order + 1) + P.order) + ((6 * (6 * m)) * (P.order + 1) + + P.leftDegree + P.middleDegree + P.rightDegree) := + P.terminalApproximation (sourceApproximation m) + h.inputSupported h.designatedCoefficients + +end SourceCompatible + +structure Admissible (physical : Site m → Orientation) : Prop + extends SourceCompatible P physical where + pairing_budget : a * b * c ≤ P.rankBound + +namespace Admissible + +variable {P} {physical : Site m → Orientation} + +theorem rankBound_pos (h : Admissible P physical) : 0 < P.rankBound := + lt_of_lt_of_le (Nat.mul_pos (Nat.mul_pos P.leftDim_pos P.middleDim_pos) + P.rightDim_pos) h.pairing_budget + +end Admissible +end MatrixMultiplication.Foundation.CWLocalConstruction + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/CoppersmithWinograd/ComplexCWOriginalWords.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/CoppersmithWinograd/ComplexCWOriginalWords.lean new file mode 100644 index 0000000000000000000000000000000000000000..69013c7d53bfb77acc6babd37710605337acde07 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/CoppersmithWinograd/ComplexCWOriginalWords.lean @@ -0,0 +1,270 @@ +import OAI.LinearAlgebra.MatrixMultiplication.CoppersmithWinograd.ComplexCoppersmithWinograd +import Mathlib.Data.Fintype.Pi + +namespace OAI + +/-! Coppersmith–Winograd tensors, tensor powers and local restrictions. -/ + +noncomputable section + +namespace MatrixMultiplication.Foundation.CWOriginalWords + +open scoped BigOperators + +abbrev OriginalComponent := + {xyz : Fin 3 × Fin 3 × Fin 3 // xyz.1.val + xyz.2.1.val + xyz.2.2.val = 2} + +@[simp] theorem originalComponent_card : Fintype.card OriginalComponent = 6 := by + decide + +namespace OriginalComponent + +def x (g : OriginalComponent) : Fin 3 := g.val.1 +def y (g : OriginalComponent) : Fin 3 := g.val.2.1 +def z (g : OriginalComponent) : Fin 3 := g.val.2.2 + +theorem sum_eq_two (g : OriginalComponent) : g.x.val + g.y.val + g.z.val = 2 := + g.property + +@[ext] theorem ext {g h : OriginalComponent} + (hx : g.x = h.x) (hy : g.y = h.y) (hz : g.z = h.z) : g = h := by + apply Subtype.ext + exact Prod.ext hx (Prod.ext hy hz) + +theorem eq_of_xy {g h : OriginalComponent} (hx : g.x = h.x) (hy : g.y = h.y) : g = h := by + apply ext hx hy + apply Fin.ext + have hg := g.sum_eq_two + have hh := h.sum_eq_two + rw [hx, hy] at hg + omega + +theorem eq_of_xz {g h : OriginalComponent} (hx : g.x = h.x) (hz : g.z = h.z) : g = h := by + apply ext hx _ hz + apply Fin.ext + have hg := g.sum_eq_two + have hh := h.sum_eq_two + rw [hx, hz] at hg + omega + +theorem eq_of_yz {g h : OriginalComponent} (hy : g.y = h.y) (hz : g.z = h.z) : g = h := by + apply ext _ hy hz + apply Fin.ext + have hg := g.sum_eq_two + have hh := h.sum_eq_two + rw [hy, hz] at hg + omega + +@[simp] theorem coefficient (g : OriginalComponent) : + CoppersmithWinograd.tensor g.x g.y g.z = 1 := by + simp only [CoppersmithWinograd.tensor, g.sum_eq_two, ite_true] + +def coordinate (g : OriginalComponent) : Fin 3 → Fin 3 + | 0 => g.x + | 1 => g.y + | 2 => g.z + +theorem coordinate_sum (g : OriginalComponent) : + (∑ side, (g.coordinate side).val) = 2 := by + simpa [coordinate, Fin.sum_univ_succ, add_assoc] using g.sum_eq_two + +theorem coordinate_injective : Function.Injective coordinate := by + intro g h he + exact ext (congrFun he 0) (congrFun he 1) (congrFun he 2) + +def permute (σ : Equiv.Perm (Fin 3)) (g : OriginalComponent) : OriginalComponent := + ⟨(g.coordinate (σ 0), g.coordinate (σ 1), g.coordinate (σ 2)), by + have h := (Equiv.sum_comp σ (fun side => (g.coordinate side).val)).trans g.coordinate_sum + simpa [Fin.sum_univ_succ, add_assoc] using h⟩ + +@[simp] theorem coordinate_permute (σ : Equiv.Perm (Fin 3)) + (g : OriginalComponent) (side : Fin 3) : + (permute σ g).coordinate side = g.coordinate (σ side) := by + fin_cases side <;> rfl + +theorem permute_injective (σ : Equiv.Perm (Fin 3)) : Function.Injective (permute σ) := by + intro g h he + apply coordinate_injective + funext side + have hs := congrArg (fun a : OriginalComponent => a.coordinate (σ.symm side)) he + simpa only [coordinate_permute, Equiv.apply_symm_apply] using hs + +end OriginalComponent + +theorem tensor_ne_zero_iff (x y z : Fin 3) : + CoppersmithWinograd.tensor x y z ≠ 0 ↔ x.val + y.val + z.val = 2 := by + by_cases h : x.val + y.val + z.val = 2 <;> simp [CoppersmithWinograd.tensor, h] + +def decodeComponent (x y z : Fin 3) : OriginalComponent := + if h : x.val + y.val + z.val = 2 then ⟨(x, y, z), h⟩ + else ⟨(2, 0, 0), by decide⟩ + +@[simp] theorem decodeComponent_coordinates (g : OriginalComponent) : + decodeComponent g.x g.y g.z = g := by + rw [decodeComponent, dite_eq_left g.sum_eq_two] + apply Subtype.ext + rfl + +section Words + +variable {Site : Type*} + +def xWord (word : Site → OriginalComponent) : Site → Fin 3 := fun s => (word s).x +def yWord (word : Site → OriginalComponent) : Site → Fin 3 := fun s => (word s).y +def zWord (word : Site → OriginalComponent) : Site → Fin 3 := fun s => (word s).z + +def originalWords (word : Site → OriginalComponent) : + (Site → Fin 3) × (Site → Fin 3) × (Site → Fin 3) := + (xWord word, yWord word, zWord word) + +def decodeWord (x y z : Site → Fin 3) : Site → OriginalComponent := + fun s => decodeComponent (x s) (y s) (z s) + +@[simp] theorem decodeWord_originalWords (word : Site → OriginalComponent) : + decodeWord (xWord word) (yWord word) (zWord word) = word := by + funext s + exact decodeComponent_coordinates (word s) + +theorem originalWords_decodeWord_of_support (x y z : Site → Fin 3) + (support : ∀ s, (x s).val + (y s).val + (z s).val = 2) : + originalWords (decodeWord x y z) = (x, y, z) := by + apply Prod.ext + · funext s + simp [originalWords, xWord, decodeWord, decodeComponent, support s, + OriginalComponent.x] + · apply Prod.ext + · funext s + simp [originalWords, yWord, decodeWord, decodeComponent, support s, + OriginalComponent.y] + · funext s + simp [originalWords, zWord, decodeWord, decodeComponent, support s, + OriginalComponent.z] + +theorem decodeWord_eq_iff_of_support (x y z : Site → Fin 3) + (support : ∀ s, (x s).val + (y s).val + (z s).val = 2) + (word : Site → OriginalComponent) : + decodeWord x y z = word ↔ x = xWord word ∧ y = yWord word ∧ z = zWord word := by + constructor + · intro he + have h := originalWords_decodeWord_of_support x y z support + rw [he] at h + exact ⟨(congrArg Prod.fst h).symm, + (congrArg (fun words => words.2.1) h).symm, + (congrArg (fun words => words.2.2) h).symm⟩ + · rintro ⟨rfl, rfl, rfl⟩ + exact decodeWord_originalWords word + +theorem originalWords_injective : Function.Injective (originalWords (Site := Site)) := by + intro first second he + funext s + apply OriginalComponent.ext + · exact congrFun (congrArg Prod.fst he) s + · exact congrFun (congrArg (fun words => words.2.1) he) s + · exact congrFun (congrArg (fun words => words.2.2) he) s + +theorem xyWords_injective : + Function.Injective (fun word : Site → OriginalComponent => (xWord word, yWord word)) := by + intro first second he + funext s + exact OriginalComponent.eq_of_xy + (congrFun (congrArg Prod.fst he) s) (congrFun (congrArg Prod.snd he) s) + +theorem xzWords_injective : + Function.Injective (fun word : Site → OriginalComponent => (xWord word, zWord word)) := by + intro first second he + funext s + exact OriginalComponent.eq_of_xz + (congrFun (congrArg Prod.fst he) s) (congrFun (congrArg Prod.snd he) s) + +theorem yzWords_injective : + Function.Injective (fun word : Site → OriginalComponent => (yWord word, zWord word)) := by + intro first second he + funext s + exact OriginalComponent.eq_of_yz + (congrFun (congrArg Prod.fst he) s) (congrFun (congrArg Prod.snd he) s) + +def permuteWord (orientation : Site → Equiv.Perm (Fin 3)) + (word : Site → OriginalComponent) : Site → OriginalComponent := + fun s => OriginalComponent.permute (orientation s) (word s) + +theorem permuteWord_injective (orientation : Site → Equiv.Perm (Fin 3)) : + Function.Injective (permuteWord orientation) := by + intro first second he + funext s + exact OriginalComponent.permute_injective (orientation s) (congrFun he s) + +theorem oriented_originalWords_injective (orientation : Site → Equiv.Perm (Fin 3)) : + Function.Injective (fun word => originalWords (permuteWord orientation word)) := + originalWords_injective.comp (permuteWord_injective orientation) + +variable [Fintype Site] + +def siteTensor : Tensor ℂ (Site → Fin 3) (Site → Fin 3) (Site → Fin 3) := + fun x y z => ∏ s, CoppersmithWinograd.tensor (x s) (y s) (z s) + +@[simp] theorem siteTensor_originalWords (word : Site → OriginalComponent) : + siteTensor (xWord word) (yWord word) (zWord word) = 1 := by + simp only [siteTensor, xWord, yWord, zWord, OriginalComponent.coefficient, + Finset.prod_const_one] + +theorem siteTensor_originalWords_ne_zero (word : Site → OriginalComponent) : + siteTensor (xWord word) (yWord word) (zWord word) ≠ 0 := by + rw [siteTensor_originalWords] + exact one_ne_zero + +theorem siteTensor_oriented_originalWords (orientation : Site → Equiv.Perm (Fin 3)) + (word : Site → OriginalComponent) : + siteTensor (xWord (permuteWord orientation word)) + (yWord (permuteWord orientation word)) (zWord (permuteWord orientation word)) = 1 := + siteTensor_originalWords _ + +theorem siteTensor_ne_zero_iff (x y z : Site → Fin 3) : + siteTensor x y z ≠ 0 ↔ ∀ s, (x s).val + (y s).val + (z s).val = 2 := by + simp only [siteTensor, Finset.prod_ne_zero_iff, Finset.mem_univ, forall_const, + tensor_ne_zero_iff] + +def supportedWordEquiv : (Site → OriginalComponent) ≃ + {words : (Site → Fin 3) × (Site → Fin 3) × (Site → Fin 3) // + siteTensor words.1 words.2.1 words.2.2 ≠ 0} where + toFun word := ⟨originalWords word, siteTensor_originalWords_ne_zero word⟩ + invFun words s := ⟨(words.val.1 s, words.val.2.1 s, words.val.2.2 s), + (siteTensor_ne_zero_iff _ _ _).mp words.property s⟩ + left_inv word := by + funext s + apply Subtype.ext + rfl + right_inv words := by + apply Subtype.ext + rfl + +section WordCard + +local instance : DecidableEq Site := Classical.decEq Site + +@[simp] theorem word_card : Fintype.card (Site → OriginalComponent) = + 6 ^ Fintype.card Site := by + simp only [Fintype.card_pi, originalComponent_card, Finset.prod_const, Finset.card_univ] + +end WordCard + +theorem siteTensor_eq_power {n : ℕ} (site : Fin n ≃ Site) + (x y z : Site → Fin 3) : + siteTensor x y z = Tensor.power CoppersmithWinograd.tensor n + (fun i => x (site i)) (fun i => y (site i)) (fun i => z (site i)) := by + exact (site.prod_comp (fun s => CoppersmithWinograd.tensor (x s) (y s) (z s))).symm + +end Words + +@[simp] theorem power_originalWords (n : ℕ) (word : Fin n → OriginalComponent) : + Tensor.power CoppersmithWinograd.tensor n (xWord word) (yWord word) (zWord word) = 1 := + siteTensor_originalWords word + +theorem power_originalWords_ne_zero (n : ℕ) (word : Fin n → OriginalComponent) : + Tensor.power CoppersmithWinograd.tensor n (xWord word) (yWord word) (zWord word) ≠ 0 := + siteTensor_originalWords_ne_zero word + +end MatrixMultiplication.Foundation.CWOriginalWords + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/CoppersmithWinograd/ComplexCWPrimitiveDegeneration.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/CoppersmithWinograd/ComplexCWPrimitiveDegeneration.lean new file mode 100644 index 0000000000000000000000000000000000000000..6b01fe80449cdee7a0e53722f9b3296c70aa08fd --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/CoppersmithWinograd/ComplexCWPrimitiveDegeneration.lean @@ -0,0 +1,162 @@ +import OAI.LinearAlgebra.MatrixMultiplication.CoppersmithWinograd.ComplexCWBoundary +import OAI.LinearAlgebra.MatrixMultiplication.Polynomial.ComplexPolynomialDegenerationComposition + +namespace OAI + +/-! Coppersmith–Winograd tensors, tensor powers and local restrictions. -/ + +noncomputable section + +namespace MatrixMultiplication.Foundation +namespace CWPrimitiveDegeneration + +open Polynomial + +theorem outerMap_degree (output input : Fin 3) : + (CWBoundary.outerMap (X : Polynomial ℂ) output input).degree ≤ 1 := by + by_cases heq : input = output + · rw [CWBoundary.outerMap, CWBoundary.diagonalMap, ite_eq_left heq] + by_cases hone : output = 1 <;> simp [CWBoundary.outerWeight, hone] + · simp [CWBoundary.outerMap, CWBoundary.diagonalMap, heq] + +theorem middleMap_degree (output input : Fin 3) : + (CWBoundary.middleMap (X : Polynomial ℂ) output input).degree ≤ 1 := by + by_cases heq : input = output + · rw [CWBoundary.middleMap, CWBoundary.diagonalMap, ite_eq_left heq] + by_cases hone : output = 1 <;> simp [CWBoundary.middleWeight, hone] + · simp [CWBoundary.middleMap, CWBoundary.diagonalMap, heq] + +def boundary : Tensor.PolynomialRestrictionDegeneration + CoppersmithWinograd.tensor CWBoundary.tensor 1 1 1 1 where + leftMap := CWBoundary.outerMap X + middleMap := CWBoundary.middleMap X + rightMap := CWBoundary.outerMap X + left_degree := outerMap_degree + middle_degree := middleMap_degree + right_degree := outerMap_degree + vanishes := by + intro x y z j hj + have hjzero : j = 0 := by omega + subst j + change (CWBoundary.scalingPolynomial x y z).coeff 0 = 0 + simp [CWBoundary.scalingPolynomial_coeff] + leading := CWBoundary.scalingPolynomial_leading + +@[simp] theorem boundary_basePolynomial : + boundary.basePolynomial = CWBoundary.scalingPolynomial := rfl + +theorem five_initial_coefficients : + CWBoundary.tensor 0 0 2 = 1 ∧ CWBoundary.tensor 0 1 1 = 1 ∧ + CWBoundary.tensor 2 0 0 = 1 ∧ CWBoundary.tensor 1 1 0 = 1 ∧ + CWBoundary.tensor 0 2 0 = 1 := by + norm_num [CWBoundary.tensor, CoppersmithWinograd.tensor] + +def boundaryApproximation : Tensor.PolynomialApproximation CWBoundary.tensor 3 5 15 := + boundary.compose CoppersmithWinograd.approximation + +@[simp] theorem boundaryApproximation_polynomial : + boundaryApproximation.polynomial = + Tensor.restrict (CWBoundary.outerMap X) (CWBoundary.middleMap X) + (CWBoundary.outerMap X) + (fun x y z => Polynomial.expand ℂ 2 (CoppersmithWinograd.polynomial x y z)) := rfl + +theorem boundaryApproximation_polynomial_apply (x y z : Fin 3) : + boundaryApproximation.polynomial x y z = + if x.val + y.val + z.val = 2 ∨ x.val + y.val + z.val = 4 ∨ + x.val + y.val + z.val = 6 then + X ^ (2 * (x.val + y.val + z.val) + CWBoundary.weight x y z) else 0 := by + rw [boundaryApproximation_polynomial] + change Tensor.restrict + (CWBoundary.diagonalMap (CWBoundary.outerWeight X)) + (CWBoundary.diagonalMap (CWBoundary.middleWeight X)) + (CWBoundary.diagonalMap (CWBoundary.outerWeight X)) + (fun x y z => Polynomial.expand ℂ 2 (CoppersmithWinograd.polynomial x y z)) + x y z = _ + rw [CWBoundary.restrict_diagonal_apply, CoppersmithWinograd.polynomial_apply] + by_cases hs : x.val + y.val + z.val = 2 ∨ x.val + y.val + z.val = 4 ∨ + x.val + y.val + z.val = 6 + · simp only [ite_eq_left hs, map_pow, Polynomial.expand_X, ← pow_mul] + by_cases hx : x = 1 <;> by_cases hy : y = 1 <;> by_cases hz : z = 1 <;> + simp [CWBoundary.outerWeight, CWBoundary.middleWeight, CWBoundary.weight, + hx, hy, hz, pow_add] <;> ring + · simp [hs] + +theorem boundaryApproximation_leading (x y z : Fin 3) : + (boundaryApproximation.polynomial x y z).coeff 5 = CWBoundary.tensor x y z := + boundaryApproximation.leading x y z + +theorem boundary_rank_power (n : ℕ) : + Tensor.RankAtMost (Tensor.power CWBoundary.tensor n) ((15 * n + 1) * 3 ^ n) := + boundaryApproximation.rank_power n + +theorem cw_cyclic : Tensor.cyclic CoppersmithWinograd.tensor = + CoppersmithWinograd.tensor := by + funext x y z + simp [Tensor.cyclic, CoppersmithWinograd.tensor, + Nat.add_comm, Nat.add_left_comm] + +def cyclicBoundary : Tensor.PolynomialRestrictionDegeneration + CoppersmithWinograd.tensor (Tensor.cyclic CWBoundary.tensor) 1 1 1 1 where + leftMap := boundary.cyclic.leftMap + middleMap := boundary.cyclic.middleMap + rightMap := boundary.cyclic.rightMap + left_degree := boundary.cyclic.left_degree + middle_degree := boundary.cyclic.middle_degree + right_degree := boundary.cyclic.right_degree + vanishes := by + intro x y z j hj + simpa only [cw_cyclic] using boundary.cyclic.vanishes x y z j hj + leading := by + intro x y z + simpa only [cw_cyclic] using boundary.cyclic.leading x y z + +def twiceCyclicBoundary : Tensor.PolynomialRestrictionDegeneration + CoppersmithWinograd.tensor (Tensor.cyclic (Tensor.cyclic CWBoundary.tensor)) + 1 1 1 1 where + leftMap := cyclicBoundary.cyclic.leftMap + middleMap := cyclicBoundary.cyclic.middleMap + rightMap := cyclicBoundary.cyclic.rightMap + left_degree := cyclicBoundary.cyclic.left_degree + middle_degree := cyclicBoundary.cyclic.middle_degree + right_degree := cyclicBoundary.cyclic.right_degree + vanishes := by + intro x y z j hj + simpa only [cw_cyclic] using cyclicBoundary.cyclic.vanishes x y z j hj + leading := by + intro x y z + simpa only [cw_cyclic] using cyclicBoundary.cyclic.leading x y z + +theorem cyclicBoundary_deleted : Tensor.cyclic CWBoundary.tensor 0 1 1 = 0 := by + exact CWBoundary.tensor_deleted + +theorem twiceCyclicBoundary_deleted : + Tensor.cyclic (Tensor.cyclic CWBoundary.tensor) 1 1 0 = 0 := by + exact CWBoundary.tensor_deleted + +def cyclicBoundaryApproximation : + Tensor.PolynomialApproximation (Tensor.cyclic CWBoundary.tensor) 3 5 15 := + cyclicBoundary.compose CoppersmithWinograd.approximation + +def twiceCyclicBoundaryApproximation : + Tensor.PolynomialApproximation (Tensor.cyclic (Tensor.cyclic CWBoundary.tensor)) + 3 5 15 := + twiceCyclicBoundary.compose CoppersmithWinograd.approximation + +@[simp] theorem cyclicBoundaryApproximation_polynomial : + cyclicBoundaryApproximation.polynomial = + Tensor.restrict (CWBoundary.middleMap X) (CWBoundary.outerMap X) + (CWBoundary.outerMap X) + (fun x y z => Polynomial.expand ℂ 2 (CoppersmithWinograd.polynomial x y z)) := rfl + +@[simp] theorem twiceCyclicBoundaryApproximation_polynomial : + twiceCyclicBoundaryApproximation.polynomial = + Tensor.restrict (CWBoundary.outerMap X) (CWBoundary.outerMap X) + (CWBoundary.middleMap X) + (fun x y z => Polynomial.expand ℂ 2 (CoppersmithWinograd.polynomial x y z)) := rfl + +end CWPrimitiveDegeneration +end MatrixMultiplication.Foundation + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/CoppersmithWinograd/ComplexCoppersmithWinograd.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/CoppersmithWinograd/ComplexCoppersmithWinograd.lean new file mode 100644 index 0000000000000000000000000000000000000000..f382629fdf14e47fd691a11dad02ce8c3b8e0db5 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/CoppersmithWinograd/ComplexCoppersmithWinograd.lean @@ -0,0 +1,94 @@ +import OAI.LinearAlgebra.MatrixMultiplication.Polynomial.ComplexPolynomialApproximation +import Mathlib.Tactic.FinCases +import Mathlib.Tactic.NormNum +import Lean.Elab.Tactic.Omega + +namespace OAI + +/-! Coppersmith–Winograd tensors, tensor powers and local restrictions. -/ + +noncomputable section + +open scoped BigOperators + +namespace MatrixMultiplication.Foundation +namespace CoppersmithWinograd + +open Polynomial + +def tensor : Tensor ℂ (Fin 3) (Fin 3) (Fin 3) := + fun x y z => if x.val + y.val + z.val = 2 then 1 else 0 + +def first : Fin 3 → Fin 3 → Polynomial ℂ + | 0, x => C (1 / 2) * X ^ x.val + | 1, x => C (1 / 2) * (-X) ^ x.val + | 2, x => if x.val = 0 then -1 else 0 + +def other : Fin 3 → Fin 3 → Polynomial ℂ + | 0, x => X ^ x.val + | 1, x => (-X) ^ x.val + | 2, x => if x.val = 0 then 1 else 0 + +def polynomial : Tensor (Polynomial ℂ) (Fin 3) (Fin 3) (Fin 3) := + fun x y z => ∑ i, Tensor.rankOne (first i) (other i) (other i) x y z + +theorem rank_bound : Tensor.RankAtMost polynomial 3 := + ⟨first, other, other, rfl⟩ + +theorem polynomial_apply (x y z : Fin 3) : + polynomial x y z = + if x.val + y.val + z.val = 2 ∨ x.val + y.val + z.val = 4 ∨ + x.val + y.val + z.val = 6 then + X ^ (x.val + y.val + z.val) else 0 := by + have htwo : C (2 : ℂ) = (2 : Polynomial ℂ) := by + calc + _ = C ((1 : ℂ) + 1) := by norm_num + _ = C (1 : ℂ) + C (1 : ℂ) := Polynomial.C_add + _ = 2 := by norm_num [Polynomial.C_1] + have hhalf : C (1 / 2 : ℂ) * 2 = (1 : Polynomial ℂ) := by + calc + _ = C ((1 / 2 : ℂ) * 2) := by rw [Polynomial.C_mul, htwo] + _ = 1 := by norm_num + have hhalf_mul (p : Polynomial ℂ) : C (1 / 2 : ℂ) * p * 2 = p := by + calc + _ = (C (1 / 2 : ℂ) * 2) * p := by ring + _ = p := by rw [hhalf, one_mul] + fin_cases x <;> fin_cases y <;> fin_cases z <;> + norm_num [polynomial, Tensor.rankOne, first, other, Fin.sum_univ_succ] <;> + ring_nf <;> simp only [hhalf, hhalf_mul, neg_add_cancel] + +theorem leading (x y z : Fin 3) : (polynomial x y z).coeff 2 = tensor x y z := by + fin_cases x <;> fin_cases y <;> fin_cases z <;> + norm_num [polynomial_apply, tensor] + +theorem vanishes (x y z : Fin 3) (k : ℕ) (hk : k < 2) : + (polynomial x y z).coeff k = 0 := by + have hcases : k = 0 ∨ k = 1 := by omega + rcases hcases with rfl | rfl <;> + fin_cases x <;> fin_cases y <;> fin_cases z <;> + norm_num [polynomial_apply] + +theorem degree_bound (x y z : Fin 3) : (polynomial x y z).degree ≤ 6 := by + fin_cases x <;> fin_cases y <;> fin_cases z <;> + norm_num [polynomial_apply] + +def approximation : Tensor.PolynomialApproximation tensor 3 2 6 where + polynomial := polynomial + rank_bound := rank_bound + vanishes := vanishes + leading := leading + degree_bound := degree_bound + +theorem borderRankAtMost : Tensor.BorderRankAtMost tensor 3 := + approximation.borderRankAtMost + +theorem rank_power (n : ℕ) : + Tensor.RankAtMost (Tensor.power tensor n) ((6 * n + 1) * 3 ^ n) := + approximation.rank_power n + +end CoppersmithWinograd +end MatrixMultiplication.Foundation + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/CoppersmithWinograd/FieldCW.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/CoppersmithWinograd/FieldCW.lean new file mode 100644 index 0000000000000000000000000000000000000000..c247dd270fb5352b37f3a8ef7fde741f6ebfe756 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/CoppersmithWinograd/FieldCW.lean @@ -0,0 +1,211 @@ +import OAI.LinearAlgebra.MatrixMultiplication.Tensor.FieldCoefficientExtraction +import Mathlib.Algebra.BigOperators.Option +import Mathlib.Tactic.IntervalCases + +namespace OAI + +/-! Coppersmith–Winograd tensors, tensor powers and local restrictions. -/ + +noncomputable section + +open scoped BigOperators +open MatrixMultiplication.Foundation Polynomial + +namespace MatrixMultiplication.FieldCW + +section Integral + +variable (F : Type*) [CommRing F] (q : ℕ) + +def zeroForm (x : Fin (q + 2)) : F := if x.val = 0 then 1 else 0 + +def interiorForm (i : Fin q) (x : Fin (q + 2)) : F := + if x.val = i.val + 1 then 1 else 0 + +def lastForm (x : Fin (q + 2)) : F := if x.val = q + 1 then 1 else 0 + +def interiorSum (x : Fin (q + 2)) : F := ∑ i, interiorForm F q i x + +def tensor : Tensor F (Fin (q + 2)) (Fin (q + 2)) (Fin (q + 2)) := + fun x y z => + (∑ i : Fin q, + (zeroForm F q x * interiorForm F q i y * interiorForm F q i z + + interiorForm F q i x * zeroForm F q y * interiorForm F q i z + + interiorForm F q i x * interiorForm F q i y * zeroForm F q z)) + + lastForm F q x * zeroForm F q y * zeroForm F q z + + zeroForm F q x * lastForm F q y * zeroForm F q z + + zeroForm F q x * zeroForm F q y * lastForm F q z + +theorem interior_pair_sum (x y : Fin (q + 2)) : + (∑ i : Fin q, interiorForm F q i x * interiorForm F q i y) = + if x = y ∧ 1 ≤ x.val ∧ x.val ≤ q then 1 else 0 := by + classical + by_cases hx : 1 ≤ x.val ∧ x.val ≤ q + · let i : Fin q := ⟨x.val - 1, by omega⟩ + rw [Finset.sum_eq_single i] + · simp [interiorForm, i, Nat.sub_add_cancel hx.1, hx.1, hx.2, + Fin.ext_iff, eq_comm] + · intro j hj hji + have hne : x.val ≠ j.val + 1 := by + intro h + apply hji + apply Fin.ext + dsimp [i] + omega + simp [interiorForm, hne] + · simp + · have hsum : (∑ i : Fin q, interiorForm F q i x * interiorForm F q i y) = 0 := by + apply Finset.sum_eq_zero + intro i hi + have hne : x.val ≠ i.val + 1 := by + intro h + apply hx + have := i.isLt + omega + simp [interiorForm, hne] + rw [hsum, ite_eq_right] + intro h + exact hx ⟨h.2.1, h.2.2⟩ + +theorem tensor_zero_side (x y z : Fin (q + 2)) (hx : x.val = 0) : + tensor F q x y z = + if (y.val = 0 ∧ z.val = q + 1) ∨ + (y.val = q + 1 ∧ z.val = 0) ∨ + (1 ≤ y.val ∧ y.val ≤ q ∧ y = z) then 1 else 0 := by + have hx0 : zeroForm F q x = 1 := by simp [zeroForm, hx] + have hxlast : lastForm F q x = 0 := by simp [lastForm, hx] + have hxmid (i : Fin q) : interiorForm F q i x = 0 := by + simp [interiorForm, hx] + simp only [tensor, hx0, hxlast, hxmid, one_mul, zero_mul, add_zero] + rw [interior_pair_sum] + by_cases hy0 : y.val = 0 + · simp [zeroForm, lastForm, hy0] + · by_cases hylast : y.val = q + 1 + · have hyinter : ¬ y.val ≤ q := by omega + simp [zeroForm, lastForm, hylast] + · have hylo : 1 ≤ y.val := by omega + have hyhi : y.val ≤ q := by have := y.isLt; omega + simp [zeroForm, lastForm, hy0, hylast, hylo, hyhi] + +theorem tensor_cyclic (x y z : Fin (q + 2)) : + tensor F q x y z = tensor F q y z x := by + unfold tensor + have hsum : + (∑ i : Fin q, + (zeroForm F q x * interiorForm F q i y * interiorForm F q i z + + interiorForm F q i x * zeroForm F q y * interiorForm F q i z + + interiorForm F q i x * interiorForm F q i y * zeroForm F q z)) = + ∑ i : Fin q, + (zeroForm F q y * interiorForm F q i z * interiorForm F q i x + + interiorForm F q i y * zeroForm F q z * interiorForm F q i x + + interiorForm F q i y * interiorForm F q i z * zeroForm F q x) := by + apply Finset.sum_congr rfl + intro i hi + ring + rw [hsum] + ring + +def form (e : ℕ) (u v : F) : Polynomial F := C u + X ^ e * C v + +def left : Option (Option (Fin q)) → Fin (q + 2) → Polynomial F + | some (some i), x => X * form F 1 (zeroForm F q x) (interiorForm F q i x) + | some none, x => -form F 2 (zeroForm F q x) (interiorSum F q x) + | none, x => (1 - C (q : F) * X) * form F 3 (zeroForm F q x) (lastForm F q x) + +def other : Option (Option (Fin q)) → Fin (q + 2) → Polynomial F + | some (some i), x => form F 1 (zeroForm F q x) (interiorForm F q i x) + | some none, x => form F 2 (zeroForm F q x) (interiorSum F q x) + | none, x => form F 3 (zeroForm F q x) (lastForm F q x) + +def polynomial : Tensor (Polynomial F) (Fin (q + 2)) (Fin (q + 2)) (Fin (q + 2)) := + fun x y z => ∑ i, Tensor.rankOne (left F q i) (other F q i) (other F q i) x y z + +theorem rank_bound : Tensor.RankAtMost (polynomial F q) (q + 2) := by + have h := Tensor.rankAtMost_sum_rankOne (left F q) (other F q) (other F q) + simp only [Fintype.card_option, Fintype.card_fin, Nat.add_assoc] at h + convert h using 1 + rfl + +theorem polynomial_apply (x y z : Fin (q + 2)) : + polynomial F q x y z = + (∑ i : Fin q, X * form F 1 (zeroForm F q x) (interiorForm F q i x) * + form F 1 (zeroForm F q y) (interiorForm F q i y) * + form F 1 (zeroForm F q z) (interiorForm F q i z)) - + form F 2 (zeroForm F q x) (interiorSum F q x) * + form F 2 (zeroForm F q y) (interiorSum F q y) * + form F 2 (zeroForm F q z) (interiorSum F q z) + + (1 - C (q : F) * X) * form F 3 (zeroForm F q x) (lastForm F q x) * + form F 3 (zeroForm F q y) (lastForm F q y) * + form F 3 (zeroForm F q z) (lastForm F q z) := by + simp only [polynomial, Fintype.sum_option, Tensor.rankOne, left, other] + ring + +private theorem coeff_mul_two (a b : Polynomial F) : + (a * b).coeff 2 = a.coeff 0 * b.coeff 2 + a.coeff 1 * b.coeff 1 + + a.coeff 2 * b.coeff 0 := by + rw [Polynomial.coeff_mul, Finset.Nat.sum_antidiagonal_eq_sum_range_succ_mk] + simp [Finset.sum_range_succ, add_assoc] + +private theorem coeff_mul_three (a b : Polynomial F) : + (a * b).coeff 3 = a.coeff 0 * b.coeff 3 + a.coeff 1 * b.coeff 2 + + a.coeff 2 * b.coeff 1 + a.coeff 3 * b.coeff 0 := by + rw [Polynomial.coeff_mul, Finset.Nat.sum_antidiagonal_eq_sum_range_succ_mk] + simp [Finset.sum_range_succ, add_assoc] + +theorem vanishes (x y z : Fin (q + 2)) (k : ℕ) (hk : k < 3) : + (polynomial F q x y z).coeff k = 0 := by + interval_cases k <;> + simp [polynomial_apply, Polynomial.mul_coeff_zero, + Polynomial.mul_coeff_one, coeff_mul_two, form, Polynomial.coeff_add, + Polynomial.coeff_sub, interiorSum, + Polynomial.coeff_one, Polynomial.coeff_X, + Finset.sum_add_distrib, Finset.sum_mul, Finset.mul_sum] <;> + simp only [mul_assoc, mul_comm] <;> ring_nf + simp only [Finset.sum_add_distrib, Finset.mul_sum, mul_assoc, mul_comm] + ring + +theorem leading (x y z : Fin (q + 2)) : + (polynomial F q x y z).coeff 3 = tensor F q x y z := by + simp [polynomial_apply, Polynomial.mul_coeff_zero, + Polynomial.mul_coeff_one, coeff_mul_two, coeff_mul_three, form, + Polynomial.coeff_add, Polynomial.coeff_sub, + tensor, Polynomial.coeff_one, Polynomial.coeff_X, + Finset.sum_add_distrib] + simp only [mul_assoc, mul_comm, mul_left_comm] + ring_nf + simp only [Finset.sum_add_distrib, mul_assoc, mul_comm, mul_left_comm] + ring + +def degreeBound : ℕ := Finset.univ.sup fun xyz : + Fin (q + 2) × Fin (q + 2) × Fin (q + 2) => + (polynomial F q xyz.1 xyz.2.1 xyz.2.2).natDegree + +theorem degree_bound (x y z : Fin (q + 2)) : + (polynomial F q x y z).degree ≤ degreeBound F q := by + let f : (Fin (q + 2) × Fin (q + 2) × Fin (q + 2)) → ℕ := + fun xyz => (polynomial F q xyz.1 xyz.2.1 xyz.2.2).natDegree + have h := Finset.le_sup (s := Finset.univ) (f := f) (b := (x, y, z)) + (Finset.mem_univ (x, y, z)) + exact Polynomial.degree_le_of_natDegree_le h + +end Integral + +variable (F : Type*) [Field F] (q : ℕ) + +def approximation : Tensor.PolynomialApproximation (tensor F q) (q + 2) 3 + (degreeBound F q) where + polynomial := polynomial F q + rank_bound := rank_bound F q + vanishes := vanishes F q + leading := leading F q + degree_bound := degree_bound F q + +theorem rank_power (n : ℕ) : + Tensor.RankAtMost (Tensor.power (tensor F q) n) ((3 * n + 1) ^ 2 * (q + 2) ^ n) := + FieldCoefficientExtraction.rank_power (approximation F q) n + +end MatrixMultiplication.FieldCW + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/Duality/CompletionIndependence.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/Duality/CompletionIndependence.lean new file mode 100644 index 0000000000000000000000000000000000000000..d0cdf67a057902f6e07415d7583ced04055388a2 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/Duality/CompletionIndependence.lean @@ -0,0 +1,211 @@ +import OAI.LinearAlgebra.MatrixMultiplication.Duality.ProgramIndependence +import OAI.LinearAlgebra.MatrixMultiplication.Duality.InformationConditioning +import OAI.LinearAlgebra.MatrixMultiplication.Duality.InformationTransport +import OAI.LinearAlgebra.MatrixMultiplication.Completion.ProgramPrefixes + +namespace OAI + +/-! Dual matrix multiplication exponents and finite rectangular constructions. -/ + +noncomputable section + +namespace MatrixMultiplication.DualProgramIndependence + +universe u w + +open MatrixMultiplication.Foundation RecursiveCompletion CompletionLabels +open CompletionLaws CompletionColorLaws CompletionProductLaws +open DualInformation DualInformationTransport TopologicalFlatten +open scoped BigOperators +attribute [local instance 10000] Classical.propDecidable Classical.decEq +attribute [local instance 11000] instDecidableEqFin + +variable {X Y Z : Type u} {Code : Type w} [Fintype X] [Fintype Y] [Fintype Z] + [Fintype Code] [Inhabited Code] {depth m : ℕ} + +def slotCut (depth k : ℕ) (i j : Fin m) : ℕ := + if j.val < i.val then depth else if j = i then k else 0 + +def slotPrior (S : FlaggedTensor X Y Z) + (p : Program (Leaf S) (Coordinate X Y Z) Color Code depth) + (i : Fin m) (k : ℕ) (j : Fin m) (a : Leaf S) : + Color × LabelRecord (fun _ => Code) (slotCut depth k i j) := + (leafColor S a, labelRecordOf p.labels (slotCut depth k i j) a) + +def slotLabel (S : FlaggedTensor X Y Z) + (p : Program (Leaf S) (Coordinate X Y Z) Color Code depth) + (i : Fin m) (k : ℕ) (j : Fin m) (a : Leaf S) : Code := + if j = i then p.labels k a else default + +omit [Fintype X] [Fintype Y] [Fintype Z] [Fintype Code] [Inhabited Code] in +theorem slotPrior_word_eq_iff (S : FlaggedTensor X Y Z) + (p : Program (Leaf S) (Coordinate X Y Z) Color Code depth) + (i : Fin m) (k : ℕ) (a b : Fin m → Leaf S) : + (fun j => slotPrior S p i k j (a j)) = (fun j => slotPrior S p i k j (b j)) ↔ + (∀ j, leafColor S (a j) = leafColor S (b j)) ∧ + ((∀ j : Fin m, j.val < i.val → + labelRecordOf p.labels depth (a j) = labelRecordOf p.labels depth (b j)) ∧ + labelRecordOf p.labels k (a i) = labelRecordOf p.labels k (b i)) := by + constructor + · intro h + refine ⟨fun j => congrArg Prod.fst (congrFun h j), ?_, ?_⟩ + · intro j hj + have hs := congrArg Prod.snd (congrFun h j) + change labelRecordOf p.labels (slotCut depth k i j) (a j) = + labelRecordOf p.labels (slotCut depth k i j) (b j) at hs + rw [labelRecordOf_eq_iff] at hs ⊢ + simpa only [slotCut, ite_eq_left hj] using hs + · have hs := congrArg Prod.snd (congrFun h i) + change labelRecordOf p.labels (slotCut depth k i i) (a i) = + labelRecordOf p.labels (slotCut depth k i i) (b i) at hs + rw [labelRecordOf_eq_iff] at hs ⊢ + simpa [slotCut] using hs + · rintro ⟨hc, hp, hi⟩ + funext j + apply Prod.ext (hc j) + change labelRecordOf p.labels (slotCut depth k i j) (a j) = + labelRecordOf p.labels (slotCut depth k i j) (b j) + rw [labelRecordOf_eq_iff] + intro n hn + by_cases hj : j.val < i.val + · have hn' : n < depth := by simpa only [slotCut, ite_eq_left hj] using hn + exact label_eq_of_record_eq p.labels (hp j hj) hn' + · by_cases hji : j = i + · subst j + have hn' : n < k := by simpa [slotCut] using hn + exact label_eq_of_record_eq p.labels hi hn' + · simp only [slotCut, ite_eq_right hj, ite_eq_right hji] at hn + exact (Nat.not_lt_zero n hn).elim + +omit [Fintype X] [Fintype Y] [Fintype Z] [Fintype Code] in +theorem slotLabel_word_eq_iff (S : FlaggedTensor X Y Z) + (p : Program (Leaf S) (Coordinate X Y Z) Color Code depth) + (i : Fin m) (k : ℕ) (a b : Fin m → Leaf S) : + (fun j => slotLabel S p i k j (a j)) = (fun j => slotLabel S p i k j (b j)) ↔ + p.labels k (a i) = p.labels k (b i) := by + constructor + · intro h + simpa only [slotLabel, ite_eq_left rfl, ite_true] using congrFun h i + · intro h + funext j + by_cases hji : j = i + · subst j + simpa only [slotLabel, ite_eq_left rfl, ite_true] using h + · simp only [slotLabel, ite_eq_right hji] + +theorem iidColorLaw_slot_factorization (S : FlaggedTensor X Y Z) + (p : Program (Leaf S) (Coordinate X Y Z) Color Code depth) + (center output : Color) + (pc : FiniteLaw (ColorSlice S center)) (po : FiniteLaw (ColorSlice S output)) + (α : ℝ) (hα : 0 ≤ α) (hα' : α ≤ 1) (hbranch : center ≠ output ∨ α = 0) + (i : Fin m) (k : ℕ) + (hc : ConditionalMassFactorization pc (fun a => labelRecordOf p.labels k a.val) + (fun a => p.labels k a.val) (fun a => a.val.val.1)) + (ho : ConditionalMassFactorization po (fun a => labelRecordOf p.labels k a.val) + (fun a => p.labels k a.val) (fun a => a.val.val.1)) : + ConditionalMassFactorization (iidColorLaw S center output pc po m α hα hα') + (fun a j => slotPrior S p i k j (a j)) + (fun a j => slotLabel S p i k j (a j)) (fun a j => (a j).val.1) := by + apply independentProduct_factorization + (fun _ : Fin m => colorMix S center output pc po α hα hα') + (slotPrior S p i k) (slotLabel S p i k) (fun _ a => a.val.1) + intro j + by_cases hji : j = i + · subst j + apply mass_factorization_of_same_partitions (colorMix S center output pc po α hα hα') + (fun a => (leafColor S a, labelRecordOf p.labels k a)) (p.labels k) (fun a => a.val.1) + · intro a b + simp only [slotPrior, Prod.mk.injEq, labelRecordOf_eq_iff] + simp [slotCut] + · intro a b + simp [slotLabel] + · intro a b + rfl + · exact colorMix_recorded_factorization S center output pc po α hα hα' hbranch + (labelRecordOf p.labels k) (p.labels k) (fun a => a.val.1) hc ho + · have hl : slotLabel S p i k j = (fun _ => (default : Code)) := by + funext a + simp [slotLabel, hji] + rw [hl] + exact factorization_constant_label (colorMix S center output pc po α hα hα') + (slotPrior S p i k j) (default : Code) (fun a => a.val.1) + +def slotCompletionEvent (center output : Color) (i : Fin m) (k : ℕ) + (r : ∀ j : Fin m, Color × LabelRecord (fun _ => Code) (slotCut depth k i j)) : Prop := + raisedFlag center output (fun j => (r j).1 = output) ∧ + ∀ j, (r j).1 = center ∨ (r j).1 = output + +theorem condition_slot_factorization (S : FlaggedTensor X Y Z) + (p : Program (Leaf S) (Coordinate X Y Z) Color Code depth) + (center output : Color) + (pc : FiniteLaw (ColorSlice S center)) (po : FiniteLaw (ColorSlice S output)) + (α : ℝ) (hα : 0 ≤ α) (hα' : α < 1) (hbranch : center ≠ output ∨ α = 0) + (hm : 0 < m) (i : Fin m) (k : ℕ) + (hc : ConditionalMassFactorization pc (fun a => labelRecordOf p.labels k a.val) + (fun a => p.labels k a.val) (fun a => a.val.val.1)) + (ho : ConditionalMassFactorization po (fun a => labelRecordOf p.labels k a.val) + (fun a => p.labels k a.val) (fun a => a.val.val.1)) : + ConditionalMassFactorization + (condition (iidColorLaw S center output pc po m α hα hα'.le) + (completionEvent S center output m) + (completionEvent_mass_pos S center output pc po m hm α hα hα')) + (fun a j => slotPrior S p i k j (a.val j)) + (fun a j => slotLabel S p i k j (a.val j)) (fun a j => (a.val j).val.1) := by + exact conditionalMassFactorization_condition + (iidColorLaw S center output pc po m α hα hα'.le) + (fun a j => slotPrior S p i k j (a j)) + (fun a j => slotLabel S p i k j (a j)) (fun a j => (a j).val.1) + (slotCompletionEvent center output i k) + (completionEvent_mass_pos S center output pc po m hm α hα hα') + (iidColorLaw_slot_factorization S p center output pc po α hα hα'.le hbranch i k hc ho) + +theorem conditionalCompletionLaw_inherited_factorization (S : FlaggedTensor X Y Z) + (p : Program (Leaf S) (Coordinate X Y Z) Color Code depth) + (context_eq : ∀ a, p.context a = leafColor S a) + (view_eq : ∀ side a, p.view side a = coordinate a.val side) + (center output : Color) + (pc : FiniteLaw (ColorSlice S center)) (po : FiniteLaw (ColorSlice S output)) + (α : ℝ) (hα : 0 ≤ α) (hα' : α < 1) (hbranch : center ≠ output ∨ α = 0) + (hm : 0 < m) (i : Fin m) (k : ℕ) (hk : k < depth) + (hc : ConditionalMassFactorization pc (fun a => labelRecordOf p.labels k a.val) + (fun a => p.labels k a.val) (fun a => a.val.val.1)) + (ho : ConditionalMassFactorization po (fun a => labelRecordOf p.labels k a.val) + (fun a => p.labels k a.val) (fun a => a.val.val.1)) : + ConditionalMassFactorization + (conditionalCompletionLaw S center output pc po m hm α hα hα') + (fun a => labelRecordOf + (completionLocalProgram S center m p context_eq view_eq).labels + (3 + (i.val * depth + k)) a.val) + (fun a => (completionLocalProgram S center m p context_eq view_eq).labels + (3 + (i.val * depth + k)) a.val) + (fun a => a.val.val.1) := by + let e := conditionalLeafEquiv S center output m + let q := condition (iidColorLaw S center output pc po m α hα hα'.le) + (completionEvent S center output m) + (completionEvent_mass_pos S center output pc po m hm α hα hα') + have hslot (a : {w : Fin m → Leaf S // completionEvent S center output m w}) : + slot S center m (e.symm a).val = a.val := + congrArg Subtype.val (e.apply_symm_apply a) + change ConditionalMassFactorization (q.map e.symm) _ _ _ + rw [mass_factorization_map_iff] + apply mass_factorization_of_same_partitions q + (fun a j => slotPrior S p i k j (a.val j)) + (fun a j => slotLabel S p i k j (a.val j)) (fun a j => (a.val j).val.1) + · intro a b + rw [slotPrior_word_eq_iff, completionProgram_record_eq_iff _ _ _ _ _ _ i k hk.le] + simp only [(e.symm a).property, (e.symm b).property, true_and, pattern, + hslot, funext_iff] + · intro a b + rw [slotLabel_word_eq_iff, + completionLocalProgram_label_slot _ _ _ _ _ _ i k hk, + completionLocalProgram_label_slot _ _ _ _ _ _ i k hk, hslot, hslot] + simp only [encodeOld, Option.some.injEq, Sum.inr.injEq] + · intro a b + rfl + · exact condition_slot_factorization S p center output pc po α hα hα' hbranch hm i k hc ho + +end MatrixMultiplication.DualProgramIndependence + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/Duality/CompletionLaws.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/Duality/CompletionLaws.lean new file mode 100644 index 0000000000000000000000000000000000000000..4f4eef8ee899926051dd62cd86c94206086a0e5e --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/Duality/CompletionLaws.lean @@ -0,0 +1,117 @@ +import OAI.LinearAlgebra.MatrixMultiplication.Completion.ColorLaws +import OAI.LinearAlgebra.MatrixMultiplication.Tensor.BaseTensorBudgets +import OAI.LinearAlgebra.MatrixMultiplication.Duality.WitnessArithmetic +import Mathlib.Analysis.SpecialFunctions.Exp + +namespace OAI + +/-! Dual matrix multiplication exponents and finite rectangular constructions. -/ + +noncomputable section + +namespace MatrixMultiplication.DualCompletionLaws + +attribute [local instance 10000] Classical.propDecidable Classical.decEq +attribute [local instance 11000] instDecidableEqFin + +open MatrixMultiplication.Foundation RecursiveCompletion CompletionLabels CompletionColorLaws + +universe u +variable {X Y Z : Type u} [Fintype X] [Fintype Y] [Fintype Z] + +abbrev Laws (S : FlaggedTensor X Y Z) := ∀ c, FiniteLaw (ColorSlice S c) + +def gibbsWeight (a b : ℝ) : ℝ := Real.exp a / (Real.exp a + Real.exp b) + +theorem gibbsWeight_nonneg (a b : ℝ) : 0 ≤ gibbsWeight a b := + div_nonneg (Real.exp_pos a).le (add_pos (Real.exp_pos a) (Real.exp_pos b)).le + +theorem gibbsWeight_lt_one (a b : ℝ) : gibbsWeight a b < 1 := by + apply (div_lt_one (add_pos (Real.exp_pos a) (Real.exp_pos b))).mpr + linarith [Real.exp_pos b] + +def minusLaws (S : FlaggedTensor X Y Z) (p : Laws S) (m : ℕ) (hm : 0 < m) + (rho : ℝ) (hrho0 : 0 < rho) (hrho1 : rho < 1) : Laws (complete S .B m) + | .B => conditionalCompletionLaw S .B .B (p .B) (p .B) m hm 0 (by norm_num) (by norm_num) + | .A => conditionalCompletionLaw S .B .A (p .B) (p .A) m hm rho hrho0.le hrho1 + | .C => conditionalCompletionLaw S .B .C (p .B) (p .C) m hm rho hrho0.le hrho1 + +def plusALaws (S : FlaggedTensor X Y Z) (p : Laws S) (m : ℕ) (hm : 0 < m) + (rho hA hC : ℝ) (hrho0 : 0 < rho) (hrho1 : rho < 1) : Laws (complete S .A m) + | .B => conditionalCompletionLaw S .A .B (p .A) (p .B) m hm (1 - rho) + (sub_nonneg.mpr hrho1.le) (by linarith) + | .A => conditionalCompletionLaw S .A .A (p .A) (p .A) m hm 0 (by norm_num) (by norm_num) + | .C => conditionalCompletionLaw S .A .C (p .A) (p .C) m hm (gibbsWeight hA hC) + (gibbsWeight_nonneg hA hC) (gibbsWeight_lt_one hA hC) + +def plusCLaws (S : FlaggedTensor X Y Z) (p : Laws S) (m : ℕ) (hm : 0 < m) + (rho hA hC : ℝ) (hrho0 : 0 < rho) (hrho1 : rho < 1) : Laws (complete S .C m) + | .B => conditionalCompletionLaw S .C .B (p .C) (p .B) m hm (1 - rho) + (sub_nonneg.mpr hrho1.le) (by linarith) + | .A => conditionalCompletionLaw S .C .A (p .C) (p .A) m hm (gibbsWeight hC hA) + (gibbsWeight_nonneg hC hA) (gibbsWeight_lt_one hC hA) + | .C => conditionalCompletionLaw S .C .C (p .C) (p .C) m hm 0 (by norm_num) (by norm_num) + +def baseLeaf : (c : Color) → ColorSlice BaseTwo.flagged c + | .B => ⟨⟨(1, 0, 0), by norm_num [BaseTwo.flagged, BaseTwo.tensor]⟩, + by simp [leafColor, BaseTwo.flagged, BaseTwo.flagB]⟩ + | .A => ⟨⟨(0, 0, 1), by norm_num [BaseTwo.flagged, BaseTwo.tensor]⟩, + by simp [leafColor, BaseTwo.flagged, BaseTwo.flagB, BaseTwo.flagA]⟩ + | .C => ⟨⟨(0, 1, 0), by norm_num [BaseTwo.flagged, BaseTwo.tensor]⟩, + by simp [leafColor, BaseTwo.flagged, BaseTwo.flagB, BaseTwo.flagA]⟩ + +def baseLaws : Laws BaseTwo.flagged := fun c => FiniteLaw.pure (baseLeaf c) + +def script2 : Script := .step .base .B 2 +def script4 : Script := .step script2 .A 2 +def script8 : Script := .step script4 .C 2 +def script24 : Script := .step script8 .B 3 +def script48 : Script := .step script24 .C 2 +def script96 : Script := .step script48 .B 2 + +def laws2 : Laws (Script.tensor BaseTwo.flagged script2) := + minusLaws BaseTwo.flagged baseLaws 2 (Nat.zero_lt_succ 1) (1 / 2) (by norm_num) (by norm_num) + +def laws4 : Laws (Script.tensor BaseTwo.flagged script4) := + plusALaws (Script.tensor BaseTwo.flagged script2) laws2 2 (Nat.zero_lt_succ 1) + DualWitness.state2.rho DualWitness.state2.hA DualWitness.state2.hC + (by norm_num [DualWitness.state2, DualWitness.initial, DualWitness.minus]) + (by norm_num [DualWitness.state2, DualWitness.initial, DualWitness.minus]) + +def laws8 : Laws (Script.tensor BaseTwo.flagged script8) := + plusCLaws (Script.tensor BaseTwo.flagged script4) laws4 2 (Nat.zero_lt_succ 1) + DualWitness.state4.rho DualWitness.state4.hA DualWitness.state4.hC + (by norm_num [DualWitness.state4, DualWitness.state2, DualWitness.initial, + DualWitness.minus, DualWitness.plusA]) + (by norm_num [DualWitness.state4, DualWitness.state2, DualWitness.initial, + DualWitness.minus, DualWitness.plusA]) + +def laws24 : Laws (Script.tensor BaseTwo.flagged script24) := + minusLaws (Script.tensor BaseTwo.flagged script8) laws8 3 (Nat.zero_lt_succ 2) + DualWitness.state8.rho + (by rw [DualWitness.state8_rho]; exact DualWitness.rho8_range.1) + (by rw [DualWitness.state8_rho]; exact DualWitness.rho8_range.2) + +def laws48 : Laws (Script.tensor BaseTwo.flagged script48) := + plusCLaws (Script.tensor BaseTwo.flagged script24) laws24 2 (Nat.zero_lt_succ 1) + DualWitness.state24.rho DualWitness.state24.hA DualWitness.state24.hC + (by rw [DualWitness.state24_rho]; exact DualWitness.rho24_range.1) + (by rw [DualWitness.state24_rho]; exact DualWitness.rho24_range.2) + +def laws96 : Laws (Script.tensor BaseTwo.flagged script96) := + minusLaws (Script.tensor BaseTwo.flagged script48) laws48 2 (Nat.zero_lt_succ 1) + DualWitness.state48.rho + (by rw [DualWitness.state48_rho]; exact DualWitness.rho48_range.1) + (by rw [DualWitness.state48_rho]; exact DualWitness.rho48_range.2) + +def laws288 : Laws (Script.tensor BaseTwo.flagged Script.dual) := + plusALaws (Script.tensor BaseTwo.flagged script96) laws96 3 (Nat.zero_lt_succ 2) + DualWitness.state96.rho DualWitness.state96.hA DualWitness.state96.hC + (by rw [DualWitness.state96_rho]; exact DualWitness.rho96_range.1) + (by rw [DualWitness.state96_rho]; exact DualWitness.rho96_range.2) + +end MatrixMultiplication.DualCompletionLaws + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/Duality/EntropyHelpers.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/Duality/EntropyHelpers.lean new file mode 100644 index 0000000000000000000000000000000000000000..cb8806bd6359d4fc081207123fdb243f404bd8b6 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/Duality/EntropyHelpers.lean @@ -0,0 +1,94 @@ +import OAI.LinearAlgebra.MatrixMultiplication.Completion.Laws +import OAI.LinearAlgebra.MatrixMultiplication.Entropy.ComplexHierarchyEntropy + +namespace OAI + +/-! Dual matrix multiplication exponents and finite rectangular constructions. -/ + +noncomputable section + +namespace MatrixMultiplication.DualEntropyHelpers + +open MatrixMultiplication.Foundation +open scoped BigOperators + +variable {A B C X : Type*} [Fintype A] [Fintype B] [Fintype C] [Fintype X] + +theorem map_comp_mass (p : FiniteLaw A) (f : A → B) (g : B → C) : + ((p.map f).map g).mass = (p.map (fun a => g (f a))).mass := by + classical + funext c + simp only [FiniteLaw.map_mass] + calc + (∑ b, if g b = c then ∑ a, if f a = b then p.mass a else 0 else 0) = + ∑ b, ∑ a, if f a = b then (if g b = c then p.mass a else 0) else 0 := by + apply Finset.sum_congr rfl + intro b _ + by_cases h : g b = c <;> simp [h] + _ = ∑ a, ∑ b, if f a = b then (if g b = c then p.mass a else 0) else 0 := + Finset.sum_comm + _ = ∑ a, if g (f a) = c then p.mass a else 0 := by + apply Finset.sum_congr rfl + intro a _ + simp + +theorem deterministic_pair_entropy (p : FiniteLaw A) (f : A → B) (g : B → C) : + finiteEntropy (p.map (fun a => (f a, g (f a)))).mass = + finiteEntropy (p.map f).mass := by + rw [← map_comp_mass p f (fun b => (b, g b))] + exact (p.map f).map_entropy_of_injective _ (fun _ _ h => congrArg Prod.fst h) + +theorem pair_entropy (p : FiniteLaw A) (f : A → B) (g : A → C) : + finiteEntropy (p.map (fun a => (f a, g a))).mass = + finiteEntropy (p.map f).mass + + ∑ b, (p.map f).mass b * finiteEntropy ((p.conditional f b).map g).mass := by + have hm : ((p.map f).joint (fun b => (p.conditional f b).map g)).mass = + (p.map (fun a => (f a, g a))).mass := by + funext bc + exact p.map_mass_mul_conditional_map f g bc.1 bc.2 + rw [← hm, FiniteLaw.joint_entropy] + +theorem conditional_independence_entropy (p : FiniteLaw A) + (f : A → B) (g : A → C) (x : A → X) + (independent : ∀ b, 0 < (p.map f).mass b → ∀ c xx, + ((p.conditional f b).map (fun a => (g a, x a))).mass (c, xx) = + ((p.conditional f b).map g).mass c * + ((p.conditional f b).map x).mass xx) : + finiteEntropy (p.map (fun a => ((f a, g a), x a))).mass - + finiteEntropy (p.map (fun a => (f a, g a))).mass = + finiteEntropy (p.map (fun a => (f a, x a))).mass - + finiteEntropy (p.map f).mass := by + classical + have hassoc : finiteEntropy (p.map (fun a => ((f a, g a), x a))).mass = + finiteEntropy (p.map (fun a => (f a, (g a, x a)))).mass := by + have h := (p.map (fun a => ((f a, g a), x a))).map_entropy_of_injective + (Equiv.prodAssoc B C X) (Equiv.prodAssoc B C X).injective + rw [map_comp_mass] at h + exact h.symm + have hcond (b : B) : + (p.map f).mass b * + finiteEntropy ((p.conditional f b).map (fun a => (g a, x a))).mass = + (p.map f).mass b * + (finiteEntropy ((p.conditional f b).map g).mass + + finiteEntropy ((p.conditional f b).map x).mass) := by + by_cases hb : (p.map f).mass b = 0 + · simp only [hb, zero_mul] + · have hpos : 0 < (p.map f).mass b := + lt_of_le_of_ne ((p.map f).nonneg b) (Ne.symm hb) + have hm : ((p.conditional f b).map (fun a => (g a, x a))).mass = + (((p.conditional f b).map g).joint + (fun _ => (p.conditional f b).map x)).mass := by + funext cx + exact independent b hpos cx.1 cx.2 + rw [hm, CompletionLaws.independent_entropy] + rw [hassoc, pair_entropy p f (fun a => (g a, x a)), + pair_entropy p f g, pair_entropy p f x] + simp_rw [hcond] + simp only [mul_add, Finset.sum_add_distrib] + ring + +end MatrixMultiplication.DualEntropyHelpers + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/Duality/ExponentBound.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/Duality/ExponentBound.lean new file mode 100644 index 0000000000000000000000000000000000000000..b7fd804f97cee88aff94c79fec3614ef69ef232c --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/Duality/ExponentBound.lean @@ -0,0 +1,47 @@ +import OAI.LinearAlgebra.MatrixMultiplication.Duality.FamilyConstruction +import OAI.LinearAlgebra.MatrixMultiplication.Duality.WitnessRealization +import OAI.LinearAlgebra.MatrixMultiplication.Duality.WitnessRates + +namespace OAI + +/-! Dual matrix multiplication exponents and finite rectangular constructions. -/ + +noncomputable section + +namespace MatrixMultiplication.DualWitnessRealization + +@[simp] theorem pairRate_law (pair : ReaderPair) : + DualFiniteRealization.pairRate hierarchy DualWitness.law pair = DualWitness.rate pair := rfl + +end MatrixMultiplication.DualWitnessRealization + +namespace MatrixMultiplication.DualExponentBound + +open DualWitnessRealization + +theorem fixedAspect_actual_families : + ∀ ε : ℝ, 0 < ε → Nonempty (ActualFamily fixedAspect (2 + ε)) := by + apply DualFiniteRealization.arbitrarily_close_families_of_exact_incident + hierarchy hierarchy_complete DualWitness.law approximation + (pow_pos (by decide : 0 < (2 : ℕ)) 288) source_supported source_unit + source_log_positive + · rw [pairRate_law, pairRate_law, source_log] + exact DualWitnessRates.incident_rate + · rw [pairRate_law, pairRate_law, pairRate_law, + DualWitnessRates.incident_rate, DualWitnessRates.hidden_rate] + have hlog : 0 < Real.log (2 : ℝ) := Real.log_pos (by norm_num) + have hgap := (lt_div_iff₀ hlog).mp fixedAspect_lt_dual_aspect + change fixedAspect * Real.log 2 < 2 * DualWitness.hiddenRate at hgap + nlinarith + +theorem fixedAspect_omega_eq_two : Arithmetic.rectangularOmega ℂ fixedAspect = 2 := + omega_eq_two_of_arbitrarily_close_families fixedAspect_mem_unit.1 fixedAspect_actual_families + +theorem alpha_gt : (93 : ℝ) / 200 < Arithmetic.complexAlpha := + alpha_gt_target_of_arbitrarily_close_families fixedAspect_actual_families + +end MatrixMultiplication.DualExponentBound + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/Duality/ExponentConsumer.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/Duality/ExponentConsumer.lean new file mode 100644 index 0000000000000000000000000000000000000000..aeb8c77530f36f29f0b070dad1e18867322bc02e --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/Duality/ExponentConsumer.lean @@ -0,0 +1,87 @@ +import OAI.LinearAlgebra.MatrixMultiplication.Arithmetic.Exponent +import OAI.LinearAlgebra.MatrixMultiplication.Numerical.ComplexCertificatesDual +import OAI.LinearAlgebra.MatrixMultiplication.Tensor.ComplexWitness +import OAI.LinearAlgebra.MatrixMultiplication.Rectangular.ASI +import OAI.LinearAlgebra.MatrixMultiplication.Rectangular.RateLimit + +namespace OAI + +/-! Dual matrix multiplication exponents and finite rectangular constructions. -/ + +noncomputable section + +namespace MatrixMultiplication.DualExponentBound + +open Filter +open scoped Topology + +def fixedAspect : ℝ := 4651 / 10000 + +theorem target_lt_fixedAspect : (93 : ℝ) / 200 < fixedAspect := by + norm_num [fixedAspect] + +theorem fixedAspect_lt_certificate : fixedAspect < (1548637 : ℝ) / 3327360 := by + norm_num [fixedAspect] + +theorem fixedAspect_lt_dual_aspect : fixedAspect < DualWitness.aspect := + fixedAspect_lt_certificate.trans ComplexCertificates.dual_aspect_lower + +theorem fixedAspect_mem_unit : fixedAspect ∈ Set.Icc (0 : ℝ) 1 := by + norm_num [fixedAspect] + +structure ActualFamily (k budget : ℝ) where + witness : ℕ → ComplexWitness.FiniteRectangularWitness + scale : ℕ → ℝ + outerRate : ℝ + innerRate : ℝ + multiplicityRate : ℝ + rankRate : ℝ + scale_positive : ∀ᶠ n in atTop, 0 < scale n + outer_positive : 0 < outerRate + outer_limit : Tendsto + (fun n => Real.log ((witness n).outer : ℝ) / scale n) atTop (𝓝 outerRate) + inner_limit : Tendsto + (fun n => Real.log ((witness n).inner : ℝ) / scale n) atTop (𝓝 innerRate) + multiplicity_limit : Tendsto + (fun n => Real.log ((witness n).multiplicity : ℝ) / scale n) atTop (𝓝 multiplicityRate) + rank_limit : Tendsto + (fun n => Real.log ((witness n).rank : ℝ) / scale n) atTop (𝓝 rankRate) + aspect_gap : k * outerRate < innerRate + cost_bound : rankRate - multiplicityRate ≤ budget * outerRate + +namespace ActualFamily + +theorem omega_le {k budget : ℝ} (P : ActualFamily k budget) (hk : 0 ≤ k) : + Arithmetic.rectangularOmega ℂ k ≤ budget := by + have hbound := RectangularRateLimit.exponent_le_of_finite_asi + (fun n => (P.witness n).outer_pos) (fun n => (P.witness n).inner_pos) + P.scale_positive P.outer_limit P.inner_limit P.multiplicity_limit P.rank_limit + P.outer_positive P.aspect_gap + (fun n ha hab => Arithmetic.equalRectangular_log_inequality_of_polynomialApproximation + ha (P.witness n).multiplicity_pos hk hab (P.witness n).approximation) + exact hbound.trans ((div_le_iff₀ P.outer_positive).2 P.cost_bound) + +end ActualFamily + +theorem omega_eq_two_of_arbitrarily_close_families {k : ℝ} (hk : 0 ≤ k) + (families : ∀ ε : ℝ, 0 < ε → Nonempty (ActualFamily k (2 + ε))) : + Arithmetic.rectangularOmega ℂ k = 2 := by + apply le_antisymm _ (Arithmetic.rectangularOmega_two_le k) + by_contra h + have hω : 2 < Arithmetic.rectangularOmega ℂ k := lt_of_not_ge h + have hε : 0 < (Arithmetic.rectangularOmega ℂ k - 2) / 2 := by linarith + obtain ⟨P⟩ := families ((Arithmetic.rectangularOmega ℂ k - 2) / 2) hε + have hbound := P.omega_le hk + linarith + +theorem alpha_gt_target_of_arbitrarily_close_families + (families : ∀ ε : ℝ, 0 < ε → Nonempty (ActualFamily fixedAspect (2 + ε))) : + (93 : ℝ) / 200 < Arithmetic.complexAlpha := by + have hω := omega_eq_two_of_arbitrarily_close_families fixedAspect_mem_unit.1 families + exact target_lt_fixedAspect.trans_le (Arithmetic.le_complexAlpha fixedAspect_mem_unit hω) + +end MatrixMultiplication.DualExponentBound + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/Duality/FamilyConstruction.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/Duality/FamilyConstruction.lean new file mode 100644 index 0000000000000000000000000000000000000000..350b6922c3d3b20f5c7f3eb935c077bbdf7ead9a --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/Duality/FamilyConstruction.lean @@ -0,0 +1,77 @@ +import OAI.LinearAlgebra.MatrixMultiplication.Duality.ExponentConsumer +import OAI.LinearAlgebra.MatrixMultiplication.Duality.FiniteRates +import OAI.LinearAlgebra.MatrixMultiplication.Entropy.ConditionalContinuity + +namespace OAI + +/-! Dual matrix multiplication exponents and finite rectangular constructions. -/ + +noncomputable section + +namespace MatrixMultiplication.DualFiniteRealization + +open MatrixMultiplication.Foundation CompletionHierarchyWords Filter +open scoped BigOperators Topology Classical + +variable {A X Y Z : Type} [Fintype A] [Fintype X] [Fintype Y] [Fintype Z] +variable (H : ReadableHierarchy A X Y Z) (counts : A → ℕ) +variable (hD : 0 < ∑ a, counts a) +variable (complete : Function.Injective (labelRecordOf H.labels H.depth)) +variable (p : FiniteLaw A) +variable (mass : ∀ a, p.mass a = (counts a : ℝ) / (∑ b, counts b : ℕ)) +variable {T : Tensor ℂ X Y Z} {R d D : ℕ} +variable (source : Tensor.PolynomialApproximation T R d D) (hR : 0 < R) +variable (supported : ∀ x y z, T x y z ≠ 0 → + ∃ a, H.x a = x ∧ H.y a = y ∧ H.z a = z) +variable (unit : ∀ a, T (H.x a) (H.y a) (H.z a) = 1) + +def actualFamily {k budget : ℝ} + (positive : 0 < pairRate H p .xy + pairRate H p .xz) + (aspect : k * (pairRate H p .xy + pairRate H p .xz) < 2 * pairRate H p .yz) + (cost : 2 * Real.log R ≤ budget * (pairRate H p .xy + pairRate H p .xz)) : + DualExponentBound.ActualFamily k budget where + witness := fun t => witness H counts t complete source hR supported unit + scale := fun t => (t : ℝ) * (∑ a, counts a : ℕ) + outerRate := pairRate H p .xy + pairRate H p .xz + innerRate := 2 * pairRate H p .yz + multiplicityRate := 2 * finiteEntropy p.mass + rankRate := 2 * (Real.log R + finiteEntropy p.mass) + scale_positive := by + filter_upwards [eventually_ne_atTop (0 : ℕ)] with t ht + exact mul_pos (Nat.cast_pos.mpr (Nat.pos_of_ne_zero ht)) (Nat.cast_pos.mpr hD) + outer_positive := positive + outer_limit := witness_outer_limit H counts hD complete p mass source hR supported unit + inner_limit := witness_inner_limit H counts hD complete p mass source hR supported unit + multiplicity_limit := witness_multiplicity_limit H counts hD complete p mass source hR supported unit + rank_limit := witness_rank_limit H counts hD complete p mass source hR supported unit + aspect_gap := aspect + cost_bound := by simpa only [mul_add, add_sub_cancel_right] using cost + +include complete source hR supported unit in + +theorem arbitrarily_close_families_of_exact_incident {k : ℝ} + (log_positive : 0 < Real.log R) + (incident : pairRate H p .xy + pairRate H p .xz = Real.log R) + (aspect : k * (pairRate H p .xy + pairRate H p .xz) < 2 * pairRate H p .yz) : + ∀ ε : ℝ, 0 < ε → Nonempty (DualExponentBound.ActualFamily k (2 + ε)) := by + intro ε hε + have positive : 0 < pairRate H p .xy + pairRate H p .xz := by + rw [incident] + exact log_positive + have cost : 2 * Real.log R < (2 + ε) * (pairRate H p .xy + pairRate H p .xz) := by + rw [incident] + nlinarith + obtain ⟨q, hpositive, haspect, hcost⟩ := + ConditionalLabels.exists_rational_with_strict_margins p H.labels H.depth + (fun n => H.pair n.val) positive aspect cost + obtain ⟨population, hpopulation, hmass⟩ := q.exists_type_representation + refine ⟨actualFamily H population hpopulation complete q.toFiniteLaw ?_ + source hR supported unit hpositive haspect hcost.le⟩ + intro a + exact (hmass a).symm + +end MatrixMultiplication.DualFiniteRealization + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/Duality/FiniteRates.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/Duality/FiniteRates.lean new file mode 100644 index 0000000000000000000000000000000000000000..5ef8bac9e2acbea798af95c8abfd6f063d3c709c --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/Duality/FiniteRates.lean @@ -0,0 +1,142 @@ +import OAI.LinearAlgebra.MatrixMultiplication.Duality.FiniteRealization +import OAI.LinearAlgebra.MatrixMultiplication.Entropy.ConditionalRateBridge + +namespace OAI + +/-! Dual matrix multiplication exponents and finite rectangular constructions. -/ + +noncomputable section + +namespace MatrixMultiplication.DualFiniteRealization + +open MatrixMultiplication.Foundation CompletionHierarchyWords CompletionExecution +open CompletionFiniteRealization StageHierarchyResources ConditionalLabels Filter +open scoped BigOperators Topology Classical + +variable {A X Y Z : Type} [Fintype A] [Fintype X] [Fintype Y] [Fintype Z] +variable (H : ReadableHierarchy A X Y Z) (counts : A → ℕ) +variable (hD : 0 < ∑ a, counts a) +variable (complete : Function.Injective (labelRecordOf H.labels H.depth)) +variable (p : FiniteLaw A) +variable (mass : ∀ a, p.mass a = (counts a : ℝ) / (∑ b, counts b : ℕ)) + +def pairRate (pair : ReaderPair) : ℝ := + lawPairingRate p H.labels H.depth (fun n => H.pair n.val) pair + +include hD complete mass in +omit [Fintype X] [Fintype Y] [Fintype Z] in +theorem copies_limit : + Tendsto (fun t : ℕ => Real.log (copies H counts t : ℝ) / + ((t : ℝ) * (∑ a, counts a : ℕ))) atTop (𝓝 (finiteEntropy p.mass)) := by + have hmass : (fun a => (counts a : ℝ) / (∑ b, counts b : ℕ)) = p.mass := + (funext mass).symm + simpa only [copies, realize_label_card H counts _ complete, hmass] using + tendsto_log_exactWords_card_mul counts hD + +include hD complete mass in +omit [Fintype X] [Fintype Y] [Fintype Z] in +theorem auxiliary_limit : + Tendsto (fun t : ℕ => Real.log ((realize H counts t).execution.rankBound : ℝ) / + ((t : ℝ) * (∑ a, counts a : ℕ))) atTop (𝓝 (finiteEntropy p.mass)) := by + have hmass : (fun a => (counts a : ℝ) / (∑ b, counts b : ℕ)) = p.mass := + (funext mass).symm + simpa only [realize_rankBound, hmass] using + tendsto_log_stageAuxiliaryBudget counts hD H.labels H.depth complete + +include hD in +theorem source_rank_limit (R : ℕ) : + Tendsto (fun t : ℕ => + Real.log ((R ^ CompletionFiniteRealization.blocks counts t : ℕ) : ℝ) / + ((t : ℝ) * (∑ a, counts a : ℕ))) atTop (𝓝 (Real.log R)) := by + have hD' : ((∑ a, counts a : ℕ) : ℝ) ≠ 0 := + Nat.cast_ne_zero.mpr (Nat.ne_of_gt hD) + apply tendsto_const_nhds.congr' + filter_upwards [eventually_ne_atTop (0 : ℕ)] with t ht + have htD : (t : ℝ) * (∑ a, counts a : ℕ) ≠ 0 := + mul_ne_zero (Nat.cast_ne_zero.mpr ht) hD' + rw [Nat.cast_pow, Real.log_pow, CompletionFiniteRealization.blocks, Nat.cast_mul] + exact (mul_div_cancel_left₀ (Real.log R) htD).symm + +include hD complete mass in +omit [Fintype X] [Fintype Y] [Fintype Z] in +theorem rank_budget_limit {R : ℕ} (hR : 0 < R) : + Tendsto (fun t : ℕ => Real.log (rankBudget H counts t R : ℝ) / + ((t : ℝ) * (∑ a, counts a : ℕ))) atTop + (𝓝 (Real.log R + finiteEntropy p.mass)) := by + apply ((source_rank_limit counts hD R).add + (auxiliary_limit H counts hD complete p mass)).congr + intro t + have hs : ((R ^ CompletionFiniteRealization.blocks counts t : ℕ) : ℝ) ≠ 0 := + Nat.cast_ne_zero.mpr (pow_ne_zero _ (Nat.ne_of_gt hR)) + have ha : ((realize H counts t).execution.rankBound : ℝ) ≠ 0 := + Nat.cast_ne_zero.mpr (Nat.ne_of_gt (auxiliaryRank_pos H counts t)) + rw [rankBudget, Nat.cast_mul, Real.log_mul hs ha, add_div] + +variable {T : Tensor ℂ X Y Z} {R d D : ℕ} +variable (source : Tensor.PolynomialApproximation T R d D) (hR : 0 < R) +variable (supported : ∀ x y z, T x y z ≠ 0 → + ∃ a, H.x a = x ∧ H.y a = y ∧ H.z a = z) +variable (unit : ∀ a, T (H.x a) (H.y a) (H.z a) = 1) + +include hD mass in +theorem witness_outer_limit : + Tendsto (fun t : ℕ => + Real.log ((witness H counts t complete source hR supported unit).outer : ℝ) / + ((t : ℝ) * (∑ a, counts a : ℕ))) atTop + (𝓝 (pairRate H p .xy + pairRate H p .xz)) := by + have hi := tendsto_log_stagePairingSize_law counts hD p mass H.labels H.depth + (fun n => H.pair n.val) .xy + have hr := tendsto_log_stagePairingSize_law counts hD p mass H.labels H.depth + (fun n => H.pair n.val) .xz + apply (hi.add hr).congr + intro t + rw [(witness_dimensions H counts t complete source hR supported unit).1, + Nat.cast_mul, Real.log_mul] + · ring + · exact Nat.cast_ne_zero.mpr (Nat.ne_of_gt + (pairingSize_pos _ _ _ (fun n => stageRefinementCount_pos counts H.labels n.val t))) + · exact Nat.cast_ne_zero.mpr (Nat.ne_of_gt + (pairingSize_pos _ _ _ (fun n => stageRefinementCount_pos counts H.labels n.val t))) + +include hD mass in +theorem witness_inner_limit : + Tendsto (fun t : ℕ => + Real.log ((witness H counts t complete source hR supported unit).inner : ℝ) / + ((t : ℝ) * (∑ a, counts a : ℕ))) atTop (𝓝 (2 * pairRate H p .yz)) := by + apply ((tendsto_log_stagePairingSize_law counts hD p mass H.labels H.depth + (fun n => H.pair n.val) .yz).const_mul 2).congr + intro t + rw [(witness_dimensions H counts t complete source hR supported unit).2, + Nat.cast_pow, Real.log_pow] + norm_num + ring + +include hD mass in +theorem witness_multiplicity_limit : + Tendsto (fun t : ℕ => + Real.log ((witness H counts t complete source hR supported unit).multiplicity : ℝ) / + ((t : ℝ) * (∑ a, counts a : ℕ))) atTop (𝓝 (2 * finiteEntropy p.mass)) := by + apply ((copies_limit H counts hD complete p mass).const_mul 2).congr + intro t + rw [witness_multiplicity, Nat.cast_pow, Real.log_pow] + norm_num + ring + +include hD mass in +theorem witness_rank_limit : + Tendsto (fun t : ℕ => + Real.log ((witness H counts t complete source hR supported unit).rank : ℝ) / + ((t : ℝ) * (∑ a, counts a : ℕ))) atTop + (𝓝 (2 * (Real.log R + finiteEntropy p.mass))) := by + apply ((rank_budget_limit H counts hD complete p mass hR).const_mul 2).congr + intro t + rw [witness_rank, Nat.cast_pow, Real.log_pow] + simp only [rankBudget, Nat.cast_mul, Nat.cast_pow] + norm_num + ring + +end MatrixMultiplication.DualFiniteRealization + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/Duality/FiniteRealization.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/Duality/FiniteRealization.lean new file mode 100644 index 0000000000000000000000000000000000000000..687139fbd6e085c7f5efedafa6c26ab6b4982b1a --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/Duality/FiniteRealization.lean @@ -0,0 +1,143 @@ +import OAI.LinearAlgebra.MatrixMultiplication.Completion.FiniteRealization +import OAI.LinearAlgebra.MatrixMultiplication.Tensor.MatrixBalancing +import OAI.LinearAlgebra.MatrixMultiplication.Tensor.ComplexWitness +import OAI.LinearAlgebra.MatrixMultiplication.Tensor.BaseTensorBudgets + +namespace OAI + +/-! Dual matrix multiplication exponents and finite rectangular constructions. -/ + +noncomputable section + +namespace MatrixMultiplication.DualFiniteRealization + +open MatrixMultiplication.Foundation RecursiveCompletion +open CompletionHierarchyWords CompletionExecution CompletionFiniteRealization +open scoped BigOperators Classical + +variable {A X Y Z : Type} [Fintype A] +variable (H : ReadableHierarchy A X Y Z) (counts : A → ℕ) (t : ℕ) +variable (complete : Function.Injective (labelRecordOf H.labels H.depth)) +variable [Fintype X] [Fintype Y] [Fintype Z] + +def rankBudget (R : ℕ) : ℕ := + R ^ CompletionFiniteRealization.blocks counts t * (realize H counts t).execution.rankBound + +def sourcePower {T : Tensor ℂ X Y Z} {R d D : ℕ} + (source : Tensor.PolynomialApproximation T R d D) : + Tensor.PolynomialApproximation + (Tensor.power T (CompletionFiniteRealization.blocks counts t)) + (R ^ CompletionFiniteRealization.blocks counts t) + (d * CompletionFiniteRealization.blocks counts t) + (D * CompletionFiniteRealization.blocks counts t) := + source.power (CompletionFiniteRealization.blocks counts t) + +def approximation {T : Tensor ℂ X Y Z} {R d D : ℕ} + (source : Tensor.PolynomialApproximation T R d D) + (supported : ∀ x y z, T x y z ≠ 0 → ∃ a, H.x a = x ∧ H.y a = y ∧ H.z a = z) + (unit : ∀ a, T (H.x a) (H.y a) (H.z a) = 1) : + Tensor.PolynomialApproximation + (Tensor.directSum (fun _ : Fin (copies H counts t) => + Tensor.matrixCoefficients (K := ℂ) + (Fin (rows H counts t)) (Fin (inner H counts t)) (Fin (columns H counts t)))) + (rankBudget H counts t R) (order H counts t d) (degree H counts t D) := by + have hs : ∀ x y z, ¬ support H counts t x y z → + Tensor.power T (CompletionFiniteRealization.blocks counts t) x y z = 0 := by + intro x y z outside + by_contra nonzero + apply outside + intro i + exact supported _ _ _ ((Finset.prod_ne_zero_iff.mp nonzero) i (Finset.mem_univ i)) + have full := ExecutionApproximation.approximation (realize H counts t).execution + (sourcePower counts t source) hs + have selected := full.pullback (leftSelect H counts t complete) + (middleSelect H counts t complete) (rightSelect H counts t complete) + rw [selected_output H counts t complete T unit] at selected + exact selected + +omit [Fintype X] [Fintype Y] [Fintype Z] in +theorem rankBudget_pos {R : ℕ} (hR : 0 < R) : 0 < rankBudget H counts t R := + Nat.mul_pos (pow_pos hR _) (auxiliaryRank_pos H counts t) + +def witness {T : Tensor ℂ X Y Z} {R d D : ℕ} + (source : Tensor.PolynomialApproximation T R d D) (hR : 0 < R) + (supported : ∀ x y z, T x y z ≠ 0 → ∃ a, H.x a = x ∧ H.y a = y ∧ H.z a = z) + (unit : ∀ a, T (H.x a) (H.y a) (H.z a) = 1) : + ComplexWitness.FiniteRectangularWitness where + outer := rows H counts t * inner H counts t + inner := columns H counts t ^ 2 + multiplicity := copies H counts t ^ 2 + rank := rankBudget H counts t R ^ 2 + outer_pos := Nat.mul_pos (dimensions_positive H counts t).1 + (dimensions_positive H counts t).2.1 + inner_pos := pow_pos (dimensions_positive H counts t).2.2 2 + multiplicity_pos := pow_pos (copies_pos H counts t complete) 2 + rank_pos := pow_pos (rankBudget_pos H counts t hR) 2 + order := 2 * order H counts t d + degree := 2 * degree H counts t D + approximation := MatrixBalancing.finiteBalanced + (approximation H counts t complete source supported unit) + +section Projections + +variable {T : Tensor ℂ X Y Z} {R d D : ℕ} +variable (source : Tensor.PolynomialApproximation T R d D) (hR : 0 < R) +variable (supported : ∀ x y z, T x y z ≠ 0 → ∃ a, H.x a = x ∧ H.y a = y ∧ H.z a = z) +variable (unit : ∀ a, T (H.x a) (H.y a) (H.z a) = 1) + +@[simp] theorem witness_outer : + (witness H counts t complete source hR supported unit).outer = + rows H counts t * inner H counts t := rfl + +@[simp] theorem witness_inner : + (witness H counts t complete source hR supported unit).inner = columns H counts t ^ 2 := rfl + +@[simp] theorem witness_multiplicity : + (witness H counts t complete source hR supported unit).multiplicity = copies H counts t ^ 2 := + rfl + +@[simp] theorem witness_rank : + (witness H counts t complete source hR supported unit).rank = + (R ^ CompletionFiniteRealization.blocks counts t * + (realize H counts t).execution.rankBound) ^ 2 := rfl + +theorem witness_dimensions : + (witness H counts t complete source hR supported unit).outer = + ConditionalLabels.stagePairingSize counts H.labels H.depth + (fun n => H.pair n.val) .xz t * + ConditionalLabels.stagePairingSize counts H.labels H.depth + (fun n => H.pair n.val) .xy t ∧ + (witness H counts t complete source hR supported unit).inner = + ConditionalLabels.stagePairingSize counts H.labels H.depth + (fun n => H.pair n.val) .yz t ^ 2 := by + rcases realize_dimensions H counts t with ⟨hr, hi, hc⟩ + change (realize H counts t).shape.rows * (realize H counts t).shape.inner = _ ∧ + (realize H counts t).shape.columns ^ 2 = _ + simp only [hr, hi, hc, and_self] + +theorem witness_rank_stageBudget : + (witness H counts t complete source hR supported unit).rank = + (R ^ CompletionFiniteRealization.blocks counts t * + StageHierarchyResources.stageAuxiliaryBudget counts H.labels H.depth t) ^ 2 := by + rw [witness_rank, realize_rankBound] + +end Projections + +omit [Fintype X] [Fintype Y] [Fintype Z] in +theorem rankBudget_base (base factors : ℕ) : + rankBudget H counts t (base ^ factors) = + base ^ (factors * CompletionFiniteRealization.blocks counts t) * + StageHierarchyResources.stageAuxiliaryBudget counts H.labels H.depth t := by + simp only [rankBudget, ← pow_mul, realize_rankBound] + +def dualSource : + Tensor.PolynomialApproximation (Script.tensor BaseTwo.flagged Script.dual).tensor + (2 ^ 288) (Script.dual.order 1) (Script.dual.degree 3) := by + simpa only [Script.dual_factors] using + Script.approximation BaseTwo.flagged BaseTwo.approximation Script.dual + +end MatrixMultiplication.DualFiniteRealization + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/Duality/HiddenCounts.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/Duality/HiddenCounts.lean new file mode 100644 index 0000000000000000000000000000000000000000..7276c64d00be2b16c4cd71beab5b0136efce10b0 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/Duality/HiddenCounts.lean @@ -0,0 +1,76 @@ +import OAI.LinearAlgebra.MatrixMultiplication.Completion.Partitions + +namespace OAI + +/-! Dual matrix multiplication exponents and finite rectangular constructions. -/ + +noncomputable section + +namespace MatrixMultiplication.DualHiddenRates + +open MatrixMultiplication.Foundation RecursiveCompletion CompletionPartitions +attribute [local instance 10000] Classical.propDecidable Classical.decEq +attribute [local instance 11000] instDecidableEqFin + +variable {X Y Z : Type*} [Fintype X] + +theorem inactiveCount_minus_real (S : FlaggedTensor X Y Z) (m : ℕ) : + (inactiveCount (complete S .B m) : ℝ) = + ((activeCount S : ℝ) + (inactiveCount S : ℝ)) ^ m - + (activeCount S : ℝ) ^ m := by + have h := partition_count (complete S .B m) + rw [activeCount_minus, Fintype.card_fun, Fintype.card_fin, + ← partition_count S] at h + have hreal : (activeCount S : ℝ) ^ m + + (inactiveCount (complete S .B m) : ℝ) = + ((activeCount S : ℝ) + (inactiveCount S : ℝ)) ^ m := by + simpa only [Nat.cast_add, Nat.cast_pow] using + congrArg (fun n : ℕ => (n : ℝ)) h + linarith + +theorem activeCount_plus_real (S : FlaggedTensor X Y Z) (center : Color) + (hc : center ≠ .B) (m : ℕ) : + (activeCount (complete S center m) : ℝ) = + ((inactiveCount S : ℝ) + (activeCount S : ℝ)) ^ m - + (inactiveCount S : ℝ) ^ m := by + have h := partition_count (complete S center m) + rw [inactiveCount_plus S center hc m, Fintype.card_fun, + Fintype.card_fin, ← partition_count S] at h + have hreal : (activeCount (complete S center m) : ℝ) + + (inactiveCount S : ℝ) ^ m = + ((activeCount S : ℝ) + (inactiveCount S : ℝ)) ^ m := by + simpa only [Nat.cast_add, Nat.cast_pow] using + congrArg (fun n : ℕ => (n : ℝ)) h + rw [add_comm (activeCount S : ℝ) (inactiveCount S : ℝ)] at hreal + linarith + +theorem activeFraction_ratio (S : FlaggedTensor X Y Z) : + activeFraction S = (activeCount S : ℝ) / + ((activeCount S : ℝ) + (inactiveCount S : ℝ)) := by + rw [activeFraction, ← Nat.cast_add, partition_count] + +theorem inactiveFraction_ratio [Nonempty X] (S : FlaggedTensor X Y Z) : + 1 - activeFraction S = (inactiveCount S : ℝ) / + ((inactiveCount S : ℝ) + (activeCount S : ℝ)) := by + rw [add_comm (inactiveCount S : ℝ) (activeCount S : ℝ), + ← Nat.cast_add, partition_count] + have h := fraction_sum S + unfold inactiveFraction at h + linarith + +theorem counts_pos [Nonempty X] (S : FlaggedTensor X Y Z) + (h0 : 0 < activeFraction S) (h1 : activeFraction S < 1) : + 0 < (activeCount S : ℝ) ∧ 0 < (inactiveCount S : ℝ) := by + have hcard : (0 : ℝ) < Fintype.card X := + Nat.cast_pos.mpr Fintype.card_pos + have hi : 0 < inactiveFraction S := by + linarith [fraction_sum S] + constructor + · exact (div_pos_iff_of_pos_right hcard).mp h0 + · exact (div_pos_iff_of_pos_right hcard).mp hi + +end MatrixMultiplication.DualHiddenRates + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/Duality/HiddenInstances.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/Duality/HiddenInstances.lean new file mode 100644 index 0000000000000000000000000000000000000000..b8d965ee5e4b60e853676d9d1bf1c25d9399de88 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/Duality/HiddenInstances.lean @@ -0,0 +1,154 @@ +import OAI.LinearAlgebra.MatrixMultiplication.Duality.HiddenRates +import OAI.LinearAlgebra.MatrixMultiplication.Duality.UniformInstances +import OAI.LinearAlgebra.MatrixMultiplication.Duality.WitnessRecurrence + +namespace OAI + +/-! Dual matrix multiplication exponents and finite rectangular constructions. -/ + +noncomputable section + +namespace MatrixMultiplication.DualHiddenRates + +open MatrixMultiplication.Foundation RecursiveCompletion CompletionLabels CompletionColorLaws +open CompletionLaws DualCompletionLaws CompletionPartitions +attribute [local instance 10000] Classical.propDecidable Classical.decEq +attribute [local instance 11000] instDecidableEqFin + +private theorem coord_nonempty (s : Script) : Nonempty (Script.Coord (Fin 2) s) := by + induction s with + | base => exact inferInstanceAs (Nonempty (Fin 2)) + | step prior center m ih => + let := ih + exact inferInstanceAs (Nonempty (Fin m → Script.Coord (Fin 2) prior)) +attribute [local instance] coord_nonempty + +theorem base_hidden : HiddenInvariant BaseTwo.flagged baseLaws DualWitness.initial := by + have hc : Fintype.card {x // BaseTwo.flagged.flagB x} = 1 := + @Fintype.card_subtype_eq (Fin 2) 1 + (inferInstanceAs (Fintype {x // BaseTwo.flagged.flagB x})) + constructor <;> + norm_num [baseLaws, DualWitness.initial, activeCount, inactiveCount, + BaseTwo.flagged, BaseTwo.flagB, Fintype.card_subtype_compl] + all_goals norm_num [hc] + +theorem laws2_hidden : HiddenInvariant (Script.tensor BaseTwo.flagged script2) + laws2 DualWitness.state2 := + minus_hidden BaseTwo.flagged baseLaws DualWitness.initial 2 (by norm_num) + (by norm_num [DualWitness.initial]) (by norm_num [DualWitness.initial]) + DualUniform.base_activeFraction.symm base_hidden + +theorem laws4_hidden : HiddenInvariant (Script.tensor BaseTwo.flagged script4) + laws4 DualWitness.state4 := + plusA_hidden _ laws2 DualWitness.state2 2 (by norm_num) + (by norm_num [DualWitness.state2, DualWitness.initial, DualWitness.minus]) + (by norm_num [DualWitness.state2, DualWitness.initial, DualWitness.minus]) + DualUniform.rho2.symm laws2_hidden + +theorem laws8_hidden : HiddenInvariant (Script.tensor BaseTwo.flagged script8) + laws8 DualWitness.state8 := + plusC_hidden _ laws4 DualWitness.state4 2 (by norm_num) + (by norm_num [DualWitness.state4, DualWitness.state2, DualWitness.initial, + DualWitness.minus, DualWitness.plusA]) + (by norm_num [DualWitness.state4, DualWitness.state2, DualWitness.initial, + DualWitness.minus, DualWitness.plusA]) + DualUniform.rho4.symm laws4_hidden + +theorem laws24_hidden : HiddenInvariant (Script.tensor BaseTwo.flagged script24) + laws24 DualWitness.state24 := + minus_hidden _ laws8 DualWitness.state8 3 (by norm_num) + (by rw [DualWitness.state8_rho]; exact DualWitness.rho8_range.1) + (by rw [DualWitness.state8_rho]; exact DualWitness.rho8_range.2) + DualUniform.rho8.symm laws8_hidden + +theorem laws48_hidden : HiddenInvariant (Script.tensor BaseTwo.flagged script48) + laws48 DualWitness.state48 := + plusC_hidden _ laws24 DualWitness.state24 2 (by norm_num) + (by rw [DualWitness.state24_rho]; exact DualWitness.rho24_range.1) + (by rw [DualWitness.state24_rho]; exact DualWitness.rho24_range.2) + DualUniform.rho24.symm laws24_hidden + +theorem laws96_hidden : HiddenInvariant (Script.tensor BaseTwo.flagged script96) + laws96 DualWitness.state96 := + minus_hidden _ laws48 DualWitness.state48 2 (by norm_num) + (by rw [DualWitness.state48_rho]; exact DualWitness.rho48_range.1) + (by rw [DualWitness.state48_rho]; exact DualWitness.rho48_range.2) + DualUniform.rho48.symm laws48_hidden + +theorem laws288_hidden : HiddenInvariant (Script.tensor BaseTwo.flagged Script.dual) + laws288 DualWitness.state288 := + plusA_hidden _ laws96 DualWitness.state96 3 (by norm_num) + (by rw [DualWitness.state96_rho]; exact DualWitness.rho96_range.1) + (by rw [DualWitness.state96_rho]; exact DualWitness.rho96_range.2) + DualUniform.rho96.symm laws96_hidden + +theorem laws288_hidden_B : + finiteEntropy (laws288 .B).mass - + finiteEntropy ((laws288 .B).map (fun a => a.val.val.1)).mass = + DualWitness.state288.hB := by + rw [laws288_hidden.B, + DualUniform.UniformLaws.entropy_B _ _ DualUniform.laws288_uniform] + ring + +theorem laws288_hidden_A : + finiteEntropy (laws288 .A).mass - + finiteEntropy ((laws288 .A).map (fun a => a.val.val.1)).mass = + DualWitness.state288.hA := by + rw [laws288_hidden.A, + DualUniform.UniformLaws.entropy_A _ _ DualUniform.laws288_uniform] + ring + +theorem laws288_hidden_C : + finiteEntropy (laws288 .C).mass - + finiteEntropy ((laws288 .C).map (fun a => a.val.val.1)).mass = + DualWitness.state288.hC := by + rw [laws288_hidden.C, + DualUniform.UniformLaws.entropy_C _ _ DualUniform.laws288_uniform] + ring + +theorem laws288_normalizedHidden : + (DualWitness.state288.rho * (finiteEntropy (laws288 .B).mass - + finiteEntropy ((laws288 .B).map (fun a => a.val.val.1)).mass) + + (1 - DualWitness.state288.rho) * (finiteEntropy (laws288 .C).mass - + finiteEntropy ((laws288 .C).map (fun a => a.val.val.1)).mass)) / 288 = + DualWitness.hiddenRate := by + rw [laws288_hidden_B, laws288_hidden_C] + have h := DualWitness.state288_normalizedHidden + rw [DualWitness.normalizedHidden, DualWitness.state288_max, + DualWitness.state_factors] at h + exact h + +theorem laws288_weightedHidden : + DualWitness.state288.rho * (finiteEntropy (laws288 .B).mass - + finiteEntropy ((laws288 .B).map (fun a => a.val.val.1)).mass) + + (1 - DualWitness.state288.rho) * (finiteEntropy (laws288 .C).mass - + finiteEntropy ((laws288 .C).map (fun a => a.val.val.1)).mass) = + 288 * DualWitness.hiddenRate := by + linarith only [laws288_normalizedHidden] + +theorem laws288_coordinateEntropy : + CompletionEntropyAlgebra.binaryEntropy DualWitness.state288.rho + + DualWitness.state288.rho * + Real.log (activeCount (Script.tensor BaseTwo.flagged Script.dual)) + + (1 - DualWitness.state288.rho) * + Real.log (inactiveCount (Script.tensor BaseTwo.flagged Script.dual)) = + Real.log (Fintype.card (Script.Coord (Fin 2) Script.dual)) := by + have hc := counts_pos (Script.tensor BaseTwo.flagged Script.dual) + (by + rw [DualUniform.rho288, DualWitness.state288_rho] + exact DualWitness.rho288_range.1) + (by + rw [DualUniform.rho288, DualWitness.state288_rho] + exact DualWitness.rho288_range.2) + have h := CompletionEntropyAlgebra.binaryEntropy_cardinal_mixture + (activeCount (Script.tensor BaseTwo.flagged Script.dual)) + (inactiveCount (Script.tensor BaseTwo.flagged Script.dual)) hc.1 hc.2 + dsimp only at h + rw [← activeFraction_ratio, DualUniform.rho288, ← Nat.cast_add, partition_count] at h + exact h + +end MatrixMultiplication.DualHiddenRates + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/Duality/HiddenRates.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/Duality/HiddenRates.lean new file mode 100644 index 0000000000000000000000000000000000000000..66f7da98285c191c13c1cc7145bbfd431ac498da --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/Duality/HiddenRates.lean @@ -0,0 +1,150 @@ +import OAI.LinearAlgebra.MatrixMultiplication.Duality.LawEntropy +import OAI.LinearAlgebra.MatrixMultiplication.Completion.CenterLaw +import OAI.LinearAlgebra.MatrixMultiplication.Duality.CompletionLaws +import OAI.LinearAlgebra.MatrixMultiplication.Duality.HiddenCounts + +namespace OAI + +/-! Dual matrix multiplication exponents and finite rectangular constructions. -/ + +noncomputable section + +namespace MatrixMultiplication.DualHiddenRates + +universe u + +open MatrixMultiplication.Foundation RecursiveCompletion CompletionLabels CompletionColorLaws +open DualCompletionLaws CompletionPartitions CompletionEntropyAlgebra +attribute [local instance 10000] Classical.propDecidable Classical.decEq +attribute [local instance 11000] instDecidableEqFin + +variable {X Y Z : Type u} [Fintype X] [Fintype Y] [Fintype Z] + +structure HiddenInvariant (S : FlaggedTensor X Y Z) (p : Laws S) + (s : DualWitness.State) : Prop where + B : finiteEntropy (p .B).mass = Real.log (activeCount S) + s.hB + A : finiteEntropy (p .A).mass = Real.log (inactiveCount S) + s.hA + C : finiteEntropy (p .C).mass = Real.log (inactiveCount S) + s.hC + +variable [Nonempty X] + +private theorem incident_minus_entropy (S : FlaggedTensor X Y Z) (output : Color) + (hne : Color.B ≠ output) + (pc : FiniteLaw (ColorSlice S .B)) (po : FiniteLaw (ColorSlice S output)) + (m : ℕ) (hm : 0 < m) (rho hb ho : ℝ) (h0 : 0 < rho) (h1 : rho < 1) + (hrho : rho = activeFraction S) + (hpc : finiteEntropy pc.mass = Real.log (activeCount S) + hb) + (hpo : finiteEntropy po.mass = Real.log (inactiveCount S) + ho) : + finiteEntropy (conditionalCompletionLaw S .B output pc po m hm rho h0.le h1).mass = + Real.log (inactiveCount (complete S .B m)) + + m * ((rho - rho ^ m) / (1 - rho ^ m) * hb + + (1 - rho) / (1 - rho ^ m) * ho) := by + have hc := counts_pos S (hrho ▸ h0) (hrho ▸ h1) + have hr : (activeCount S : ℝ) / ((activeCount S : ℝ) + inactiveCount S) = rho := + (activeFraction_ratio S).symm.trans hrho.symm + have he := conditionalMixEntropy_incident (activeCount S) (inactiveCount S) + hb ho m hc.1 hc.2 hm + dsimp only at he + rw [hr] at he + rw [DualLawEntropy.conditionalCompletionLaw_entropy S .B output hne, + hpc, hpo, inactiveCount_minus_real] + linarith only [he] + +private theorem incident_plus_entropy (S : FlaggedTensor X Y Z) (center : Color) + (hc : center ≠ .B) + (pc : FiniteLaw (ColorSlice S center)) (po : FiniteLaw (ColorSlice S .B)) + (m : ℕ) (hm : 0 < m) (rho hcEntropy hb : ℝ) (h0 : 0 < rho) (h1 : rho < 1) + (hrho : rho = activeFraction S) + (hpc : finiteEntropy pc.mass = Real.log (inactiveCount S) + hcEntropy) + (hpo : finiteEntropy po.mass = Real.log (activeCount S) + hb) : + finiteEntropy (conditionalCompletionLaw S center .B pc po m hm (1 - rho) + (sub_nonneg.mpr h1.le) (by linarith)).mass = + Real.log (activeCount (complete S center m)) + + m * (rho / (1 - (1 - rho) ^ m) * hb + + ((1 - (1 - rho) ^ m) - rho) / (1 - (1 - rho) ^ m) * hcEntropy) := by + have hcounts := counts_pos S (hrho ▸ h0) (hrho ▸ h1) + have hr : (inactiveCount S : ℝ) / ((inactiveCount S : ℝ) + activeCount S) = + 1 - rho := by rw [← inactiveFraction_ratio S, ← hrho] + have he := conditionalMixEntropy_incident (inactiveCount S) (activeCount S) + hcEntropy hb m hcounts.2 hcounts.1 hm + dsimp only at he + rw [hr] at he + have hcoeff : + (m : ℝ) * (((1 - rho) - (1 - rho) ^ m) / (1 - (1 - rho) ^ m) * hcEntropy + + (1 - (1 - rho)) / (1 - (1 - rho) ^ m) * hb) = + m * (rho / (1 - (1 - rho) ^ m) * hb + + ((1 - (1 - rho) ^ m) - rho) / (1 - (1 - rho) ^ m) * hcEntropy) := by ring + rw [hcoeff] at he + rw [DualLawEntropy.conditionalCompletionLaw_entropy S center .B hc, + hpc, hpo, activeCount_plus_real S center hc] + linarith only [he] + +omit [Nonempty X] in +private theorem gibbs_entropy (S : FlaggedTensor X Y Z) (center output : Color) + (hc : center ≠ .B) (hne : center ≠ output) + (pc : FiniteLaw (ColorSlice S center)) (po : FiniteLaw (ColorSlice S output)) + (m : ℕ) (hm : 0 < m) (hcEntropy hoEntropy : ℝ) + (hpc : finiteEntropy pc.mass = Real.log (inactiveCount S) + hcEntropy) + (hpo : finiteEntropy po.mass = Real.log (inactiveCount S) + hoEntropy) : + finiteEntropy (conditionalCompletionLaw S center output pc po m hm + (gibbsWeight hcEntropy hoEntropy) (gibbsWeight_nonneg _ _) + (gibbsWeight_lt_one _ _)).mass = + Real.log (inactiveCount (complete S center m)) + + Real.log ((Real.exp hcEntropy + Real.exp hoEntropy) ^ m - + Real.exp ((m : ℝ) * hcEntropy)) := by + rw [DualLawEntropy.conditionalCompletionLaw_entropy S center output hne, + hpc, hpo, inactiveCount_plus S center hc, Nat.cast_pow, Real.log_pow] + have he := conditionalMixEntropy_gibbs (inactiveCount S) hcEntropy hoEntropy m hm + dsimp only [gibbsWeight] + linarith only [he] + +theorem minus_hidden (S : FlaggedTensor X Y Z) (p : Laws S) (s : DualWitness.State) + (m : ℕ) (hm : 0 < m) (h0 : 0 < s.rho) (h1 : s.rho < 1) + (hrho : s.rho = activeFraction S) (h : HiddenInvariant S p s) : + HiddenInvariant (complete S .B m) (minusLaws S p m hm s.rho h0 h1) + (DualWitness.minus m s) := by + constructor + · dsimp only [minusLaws, DualWitness.minus] + rw [conditionalCompletionLaw_same_zero_entropy, h.B, + activeCount_minus, Nat.cast_pow, Real.log_pow] + ring + · exact incident_minus_entropy S .A (by intro hne; cases hne) (p .B) (p .A) m hm + s.rho s.hB s.hA h0 h1 hrho h.B h.A + · exact incident_minus_entropy S .C (by intro hne; cases hne) (p .B) (p .C) m hm + s.rho s.hB s.hC h0 h1 hrho h.B h.C + +theorem plusA_hidden (S : FlaggedTensor X Y Z) (p : Laws S) (s : DualWitness.State) + (m : ℕ) (hm : 0 < m) (h0 : 0 < s.rho) (h1 : s.rho < 1) + (hrho : s.rho = activeFraction S) (h : HiddenInvariant S p s) : + HiddenInvariant (complete S .A m) + (plusALaws S p m hm s.rho s.hA s.hC h0 h1) (DualWitness.plusA m s) := by + constructor + · exact incident_plus_entropy S .A (by intro hne; cases hne) (p .A) (p .B) m hm + s.rho s.hA s.hB h0 h1 hrho h.A h.B + · dsimp only [plusALaws, DualWitness.plusA] + rw [conditionalCompletionLaw_same_zero_entropy, h.A, + inactiveCount_plus S .A (by intro hne; cases hne), Nat.cast_pow, Real.log_pow] + ring + · exact gibbs_entropy S .A .C (by intro hne; cases hne) (by intro hne; cases hne) (p .A) (p .C) m hm + s.hA s.hC h.A h.C + +theorem plusC_hidden (S : FlaggedTensor X Y Z) (p : Laws S) (s : DualWitness.State) + (m : ℕ) (hm : 0 < m) (h0 : 0 < s.rho) (h1 : s.rho < 1) + (hrho : s.rho = activeFraction S) (h : HiddenInvariant S p s) : + HiddenInvariant (complete S .C m) + (plusCLaws S p m hm s.rho s.hA s.hC h0 h1) (DualWitness.plusC m s) := by + constructor + · exact incident_plus_entropy S .C (by intro hne; cases hne) (p .C) (p .B) m hm + s.rho s.hC s.hB h0 h1 hrho h.C h.B + · exact gibbs_entropy S .C .A (by intro hne; cases hne) (by intro hne; cases hne) (p .C) (p .A) m hm + s.hC s.hA h.C h.A + · dsimp only [plusCLaws, DualWitness.plusC] + rw [conditionalCompletionLaw_same_zero_entropy, h.C, + inactiveCount_plus S .C (by intro hne; cases hne), Nat.cast_pow, Real.log_pow] + ring + +end MatrixMultiplication.DualHiddenRates + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/Duality/Information.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/Duality/Information.lean new file mode 100644 index 0000000000000000000000000000000000000000..eb428721d3eda74a1328f74b6cdc282ad8e5cf5c --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/Duality/Information.lean @@ -0,0 +1,241 @@ +import OAI.LinearAlgebra.MatrixMultiplication.Entropy.ConditionalLabels +import OAI.LinearAlgebra.MatrixMultiplication.Duality.EntropyHelpers + +namespace OAI + +/-! Dual matrix multiplication exponents and finite rectangular constructions. -/ + +noncomputable section + +namespace MatrixMultiplication.DualInformation + +open MatrixMultiplication.Foundation DualEntropyHelpers +open scoped BigOperators +attribute [local instance] Classical.propDecidable Classical.decEq + +universe u v w + +variable {A : Type u} [Fintype A] {X : Type w} [Fintype X] + +def ConditionalIndependent {R L : Type*} [Fintype R] [Fintype L] + (p : FiniteLaw A) (prior : A → R) (label : A → L) (x : A → X) : Prop := + ∀ r, 0 < (p.map prior).mass r → ∀ l xx, + ((p.conditional prior r).map (fun a => (label a, x a))).mass (l, xx) = + ((p.conditional prior r).map label).mass l * + ((p.conditional prior r).map x).mass xx + +def ConditionalMassFactorization {R L : Type*} [Fintype R] [Fintype L] + (p : FiniteLaw A) (prior : A → R) (label : A → L) (x : A → X) : Prop := + ∀ r l xx, + (p.map (fun a => (prior a, (label a, x a)))).mass (r, (l, xx)) * + (p.map prior).mass r = + (p.map (fun a => (prior a, label a))).mass (r, l) * + (p.map (fun a => (prior a, x a))).mass (r, xx) + +theorem conditionalIndependent_of_mass_factorization {R L : Type*} + [Fintype R] [Fintype L] (p : FiniteLaw A) + (prior : A → R) (label : A → L) (x : A → X) + (factor : ConditionalMassFactorization p prior label x) : + ConditionalIndependent p prior label x := by + intro r hr l xx + have h := factor r l xx + rw [← p.map_mass_mul_conditional_map prior (fun a => (label a, x a)) r (l, xx), + ← p.map_mass_mul_conditional_map prior label r l, + ← p.map_mass_mul_conditional_map prior x r xx] at h + apply mul_left_cancel₀ (mul_ne_zero hr.ne' hr.ne') + calc + ((p.map prior).mass r * (p.map prior).mass r) * + ((p.conditional prior r).map (fun a => (label a, x a))).mass (l, xx) = + ((p.map prior).mass r * + ((p.conditional prior r).map (fun a => (label a, x a))).mass (l, xx)) * + (p.map prior).mass r := by ring + _ = ((p.map prior).mass r * ((p.conditional prior r).map label).mass l) * + ((p.map prior).mass r * ((p.conditional prior r).map x).mass xx) := h + _ = ((p.map prior).mass r * (p.map prior).mass r) * + (((p.conditional prior r).map label).mass l * + ((p.conditional prior r).map x).mass xx) := by ring + +theorem mass_factorization_of_conditionalIndependent {R L : Type*} + [Fintype R] [Fintype L] (p : FiniteLaw A) + (prior : A → R) (label : A → L) (x : A → X) + (independent : ConditionalIndependent p prior label x) : + ConditionalMassFactorization p prior label x := by + intro r l xx + rw [← p.map_mass_mul_conditional_map prior (fun a => (label a, x a)) r (l, xx), + ← p.map_mass_mul_conditional_map prior label r l, + ← p.map_mass_mul_conditional_map prior x r xx] + by_cases hr : (p.map prior).mass r = 0 + · simp only [hr, zero_mul, mul_zero] + · have hpos : 0 < (p.map prior).mass r := + lt_of_le_of_ne ((p.map prior).nonneg r) (Ne.symm hr) + rw [independent r hpos l xx] + ring + +theorem conditionalIndependent_iff_mass_factorization {R L : Type*} + [Fintype R] [Fintype L] (p : FiniteLaw A) + (prior : A → R) (label : A → L) (x : A → X) : + ConditionalIndependent p prior label x ↔ ConditionalMassFactorization p prior label x := + ⟨mass_factorization_of_conditionalIndependent p prior label x, + conditionalIndependent_of_mass_factorization p prior label x⟩ + +theorem joint_append_readable_entropy {R L : Type*} [Fintype R] [Fintype L] + (p : FiniteLaw A) (prior : A → R) (label : A → L) (x : A → X) + (read : R × X → L) (hread : ∀ a, read (prior a, x a) = label a) : + finiteEntropy (p.map (fun a => ((prior a, label a), x a))).mass = + finiteEntropy (p.map (fun a => (prior a, x a))).mass := by + let lift : R × X → (R × L) × X := fun rx => ((rx.1, read rx), rx.2) + have hinj : Function.Injective lift := by + intro a b h + apply Prod.ext + · exact congrArg (fun t : (R × L) × X => t.1.1) h + · exact congrArg (fun t : (R × L) × X => t.2) h + have hcomp : (fun a => lift (prior a, x a)) = + (fun a => ((prior a, label a), x a)) := by + funext a + simp only [lift, hread] + have hm := map_comp_mass p (fun a => (prior a, x a)) lift + rw [hcomp] at hm + calc + finiteEntropy (p.map (fun a => ((prior a, label a), x a))).mass = + finiteEntropy (((p.map (fun a => (prior a, x a))).map lift).mass) := by + rw [hm] + _ = _ := (p.map (fun a => (prior a, x a))).map_entropy_of_injective lift hinj + +variable {Label : ℕ → Type v} [∀ n, Fintype (Label n)] + +def remainingEntropy (p : FiniteLaw A) (labels : ∀ n, A → Label n) + (x : A → X) (n : ℕ) : ℝ := + finiteEntropy (p.map (fun a => (labelRecordOf labels n a, x a))).mass - + finiteEntropy (p.map (labelRecordOf labels n)).mass + +@[simp] theorem remainingEntropy_zero (p : FiniteLaw A) + (labels : ∀ n, A → Label n) (x : A → X) : + remainingEntropy p labels x 0 = finiteEntropy (p.map x).mass := by + have hm := map_comp_mass p x (fun xx : X => ((PUnit.unit : PUnit.{v + 1}), xx)) + have he : finiteEntropy (p.map (fun a => (labelRecordOf labels 0 a, x a))).mass = + finiteEntropy (p.map x).mass := by + change finiteEntropy (p.map (fun a => ((PUnit.unit : PUnit.{v + 1}), x a))).mass = + finiteEntropy (p.map x).mass + rw [← hm] + exact (p.map x).map_entropy_of_injective _ (fun _ _ h => congrArg Prod.snd h) + have hz : finiteEntropy (p.map (labelRecordOf labels 0)).mass = 0 := by + change finiteEntropy (p.map (fun _ : A => (PUnit.unit : PUnit.{v + 1}))).mass = 0 + simp [finiteEntropy, FiniteLaw.map_mass, p.total, entropyTerm] + rw [remainingEntropy, he, hz, sub_zero] + +theorem remainingEntropy_complete (p : FiniteLaw A) + (labels : ∀ n, A → Label n) (x : A → X) (depth : ℕ) + (complete : Function.Injective (labelRecordOf labels depth)) : + remainingEntropy p labels x depth = 0 := by + have hi : Function.Injective (fun a => (labelRecordOf labels depth a, x a)) := + fun _ _ h => complete (congrArg Prod.fst h) + rw [remainingEntropy, p.map_entropy_of_injective _ hi, + p.map_entropy_of_injective _ complete, sub_self] + +theorem prefix_entropy_succ (p : FiniteLaw A) (labels : ∀ n, A → Label n) + (depth n : ℕ) (hn : n < depth) : + finiteEntropy (p.map (labelRecordOf labels (n + 1))).mass = + finiteEntropy (p.map (labelRecordOf labels n)).mass + + (FiniteLabelHierarchy.ofLawLabels p labels depth).refinementEntropy n := by + have h := (FiniteLabelHierarchy.ofLawLabels p labels depth).prefixLaw_entropy_succ + n (Nat.succ_le_of_lt hn) + rw [FiniteLabelHierarchy.ofLawLabels_prefixLaw_mass, + FiniteLabelHierarchy.ofLawLabels_prefixLaw_mass] at h + exact h + +theorem remainingEntropy_succ_readable (p : FiniteLaw A) + (labels : ∀ n, A → Label n) (x : A → X) (depth n : ℕ) (hn : n < depth) + (read : LabelRecord Label n × X → Label n) + (hread : ∀ a, read (labelRecordOf labels n a, x a) = labels n a) : + remainingEntropy p labels x n - remainingEntropy p labels x (n + 1) = + (FiniteLabelHierarchy.ofLawLabels p labels depth).refinementEntropy n := by + have hj := joint_append_readable_entropy p (labelRecordOf labels n) (labels n) + x read hread + have hp := prefix_entropy_succ p labels depth n hn + change finiteEntropy (p.map (fun a => (labelRecordOf labels (n + 1) a, x a))).mass = + finiteEntropy (p.map (fun a => (labelRecordOf labels n a, x a))).mass at hj + unfold remainingEntropy + rw [hj, hp] + ring + +theorem remainingEntropy_succ_independent (p : FiniteLaw A) + (labels : ∀ n, A → Label n) (x : A → X) (n : ℕ) + (independent : ConditionalIndependent p (labelRecordOf labels n) (labels n) x) : + remainingEntropy p labels x (n + 1) = remainingEntropy p labels x n := by + exact conditional_independence_entropy p (labelRecordOf labels n) (labels n) x independent + +theorem incident_rate_eq_coordinate_entropy (p : FiniteLaw A) + (labels : ∀ n, A → Label n) (depth : ℕ) + (reader : Fin depth → ReaderPair) (x : A → X) + (complete : Function.Injective (labelRecordOf labels depth)) + (readable : ∀ n : Fin depth, reader n ≠ .yz → + ∃ read : LabelRecord Label n.val × X → Label n.val, + ∀ a, read (labelRecordOf labels n.val a, x a) = labels n.val a) + (independent : ∀ n : Fin depth, reader n = .yz → + ConditionalIndependent p (labelRecordOf labels n.val) (labels n.val) x) : + ConditionalLabels.lawPairingRate p labels depth reader .xy + + ConditionalLabels.lawPairingRate p labels depth reader .xz = + finiteEntropy (p.map x).mass := by + let E := remainingEntropy p labels x + have hterm (n : Fin depth) : + (if reader n = .xy then + (FiniteLabelHierarchy.ofLawLabels p labels depth).refinementEntropy n.val else 0) + + (if reader n = .xz then + (FiniteLabelHierarchy.ofLawLabels p labels depth).refinementEntropy n.val else 0) = + E n.val - E (n.val + 1) := by + by_cases hi : reader n = .yz + · have he := remainingEntropy_succ_independent p labels x n.val (independent n hi) + simp only [hi, reduceCtorEq, ite_false] + change 0 + 0 = remainingEntropy p labels x n.val - + remainingEntropy p labels x (n.val + 1) + rw [he] + ring + · obtain ⟨read, hread⟩ := readable n hi + have he := remainingEntropy_succ_readable p labels x depth n.val n.isLt read hread + change _ = remainingEntropy p labels x n.val - + remainingEntropy p labels x (n.val + 1) + rw [he] + cases hr : reader n <;> simp_all + have htel : ∀ k, (∑ n ∈ Finset.range k, (E n - E (n + 1))) = E 0 - E k := by + intro k + induction k with + | zero => simp + | succ k ih => rw [Finset.sum_range_succ, ih]; ring + calc + ConditionalLabels.lawPairingRate p labels depth reader .xy + + ConditionalLabels.lawPairingRate p labels depth reader .xz = + ∑ n : Fin depth, (E n.val - E (n.val + 1)) := by + simp only [ConditionalLabels.lawPairingRate, ConditionalLabels.pairingRate, + ← Finset.sum_add_distrib] + exact Finset.sum_congr rfl (fun n _ => hterm n) + _ = E 0 - E depth := by + calc + (∑ n : Fin depth, (E n.val - E (n.val + 1))) = + ∑ n ∈ Finset.range depth, (E n - E (n + 1)) := + Fin.sum_univ_eq_sum_range (fun n => E n - E (n + 1)) depth + _ = E 0 - E depth := htel depth + _ = finiteEntropy (p.map x).mass := by + rw [show E 0 = finiteEntropy (p.map x).mass from remainingEntropy_zero p labels x, + show E depth = 0 from remainingEntropy_complete p labels x depth complete, sub_zero] + +theorem nonincident_rate_eq_entropy_sub_coordinate (p : FiniteLaw A) + (labels : ∀ n, A → Label n) (depth : ℕ) + (reader : Fin depth → ReaderPair) (x : A → X) + (complete : Function.Injective (labelRecordOf labels depth)) + (readable : ∀ n : Fin depth, reader n ≠ .yz → + ∃ read : LabelRecord Label n.val × X → Label n.val, + ∀ a, read (labelRecordOf labels n.val a, x a) = labels n.val a) + (independent : ∀ n : Fin depth, reader n = .yz → + ConditionalIndependent p (labelRecordOf labels n.val) (labels n.val) x) : + ConditionalLabels.lawPairingRate p labels depth reader .yz = + finiteEntropy p.mass - finiteEntropy (p.map x).mass := by + have hall := ConditionalLabels.lawPairingRate_sum p labels depth reader complete + have hx := incident_rate_eq_coordinate_entropy p labels depth reader x + complete readable independent + linarith + +end MatrixMultiplication.DualInformation + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/Duality/InformationConditioning.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/Duality/InformationConditioning.lean new file mode 100644 index 0000000000000000000000000000000000000000..2625e421f834a83caf2f5fdaafdb323e3f22029e --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/Duality/InformationConditioning.lean @@ -0,0 +1,67 @@ +import OAI.LinearAlgebra.MatrixMultiplication.Completion.Conditioning +import OAI.LinearAlgebra.MatrixMultiplication.Duality.Information + +namespace OAI + +/-! Dual matrix multiplication exponents and finite rectangular constructions. -/ + +noncomputable section + +namespace MatrixMultiplication.DualInformation + +open MatrixMultiplication.Foundation CompletionLaws +attribute [local instance] Classical.propDecidable Classical.decEq + +variable {A R L X : Type*} [Fintype A] [Fintype R] [Fintype L] [Fintype X] + +theorem conditionalMassFactorization_condition (p : FiniteLaw A) + (prior : A → R) (label : A → L) (x : A → X) (Q : R → Prop) + (h : 0 < eventMass p (fun a => Q (prior a))) + (factor : ConditionalMassFactorization p prior label x) : + ConditionalMassFactorization (condition p (fun a => Q (prior a)) h) + (fun a => prior a.val) (fun a => label a.val) (fun a => x a.val) := by + intro r l xx + have hj := condition_coordinate_mass p (fun a => (prior a, (label a, x a))) + (fun v => Q v.1) h (r, (l, xx)) + have hr := condition_coordinate_mass p prior Q h r + have hl := condition_coordinate_mass p (fun a => (prior a, label a)) + (fun v => Q v.1) h (r, l) + have hx := condition_coordinate_mass p (fun a => (prior a, x a)) + (fun v => Q v.1) h (r, xx) + change + ((condition p (fun a => Q (prior a)) h).map + (fun a => (prior a.val, (label a.val, x a.val)))).mass (r, (l, xx)) * + ((condition p (fun a => Q (prior a)) h).map (fun a => prior a.val)).mass r = + ((condition p (fun a => Q (prior a)) h).map + (fun a => (prior a.val, label a.val))).mass (r, l) * + ((condition p (fun a => Q (prior a)) h).map + (fun a => (prior a.val, x a.val))).mass (r, xx) + rw [hj, hr, hl, hx] + by_cases hQ : Q r + · simp only [hQ, ite_true] + rw [div_mul_div_comm, div_mul_div_comm, factor r l xx] + · simp only [hQ, ite_false, zero_mul] + +theorem conditionalIndependent_condition_of_mass_factorization (p : FiniteLaw A) + (prior : A → R) (label : A → L) (x : A → X) (Q : R → Prop) + (h : 0 < eventMass p (fun a => Q (prior a))) + (factor : ConditionalMassFactorization p prior label x) : + ConditionalIndependent (condition p (fun a => Q (prior a)) h) + (fun a => prior a.val) (fun a => label a.val) (fun a => x a.val) := + conditionalIndependent_of_mass_factorization _ _ _ _ + (conditionalMassFactorization_condition p prior label x Q h factor) + +theorem conditionalIndependent_condition (p : FiniteLaw A) + (prior : A → R) (label : A → L) (x : A → X) (Q : R → Prop) + (h : 0 < eventMass p (fun a => Q (prior a))) + (independent : ConditionalIndependent p prior label x) : + ConditionalIndependent (condition p (fun a => Q (prior a)) h) + (fun a => prior a.val) (fun a => label a.val) (fun a => x a.val) := + conditionalIndependent_condition_of_mass_factorization p prior label x Q h + (mass_factorization_of_conditionalIndependent p prior label x independent) + +end MatrixMultiplication.DualInformation + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/Duality/InformationLabelConditioning.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/Duality/InformationLabelConditioning.lean new file mode 100644 index 0000000000000000000000000000000000000000..0fc61b89a956b4f1208b582dcadfa58de4558500 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/Duality/InformationLabelConditioning.lean @@ -0,0 +1,63 @@ +import OAI.LinearAlgebra.MatrixMultiplication.Entropy.IndependentConditioning +import OAI.LinearAlgebra.MatrixMultiplication.Duality.Information + +namespace OAI + +/-! Dual matrix multiplication exponents and finite rectangular constructions. -/ + +noncomputable section + +namespace MatrixMultiplication.DualInformation + +open MatrixMultiplication.Foundation CompletionLaws +attribute [local instance] Classical.propDecidable Classical.decEq + +variable {A L X : Type*} [Fintype A] [Fintype L] [Fintype X] + +theorem mass_factorization_const_iff (p : FiniteLaw A) + (label : A → L) (x : A → X) : + ConditionalMassFactorization p (fun _ => PUnit.unit) label x ↔ + ∀ l xx, (p.map (fun a => (label a, x a))).mass (l, xx) = + (p.map label).mass l * (p.map x).mass xx := by + classical + constructor + · intro h l xx + have hf := h PUnit.unit l xx + simpa [FiniteLaw.map_mass, Prod.mk.injEq, p.total] using hf + · intro h r l xx + cases r + simpa [FiniteLaw.map_mass, Prod.mk.injEq, p.total] using h l xx + +theorem conditionalMassFactorization_condition_label (p : FiniteLaw A) + (label : A → L) (x : A → X) (Q : L → Prop) + (h : 0 < eventMass p (fun a => Q (label a))) + (factor : ConditionalMassFactorization p (fun _ => PUnit.unit) label x) : + ConditionalMassFactorization (condition p (fun a => Q (label a)) h) + (fun _ => PUnit.unit) (fun a => label a.val) (fun a => x a.val) := by + have independent := (mass_factorization_const_iff p label x).mp factor + have swapped : ∀ xx l, + (p.map (fun a => (x a, label a))).mass (xx, l) = + (p.map x).mass xx * (p.map label).mass l := by + intro xx l + have hm : (p.map (fun a => (x a, label a))).mass (xx, l) = + (p.map (fun a => (label a, x a))).mass (l, xx) := by + simp only [FiniteLaw.map_mass, Prod.mk.injEq, and_comm] + rw [hm, independent l xx, mul_comm] + apply (mass_factorization_const_iff _ _ _).mpr + intro l xx + have hj := condition_coordinate_mass p (fun a => (label a, x a)) + (fun v => Q v.1) h (l, xx) + have hl := condition_coordinate_mass p label Q h l + have hx := condition_independent_coordinate_mass p x label Q swapped h xx + rw [hj, hl, hx] + by_cases hQ : Q l + · simp only [hQ, ite_true] + rw [independent l xx] + ring + · simp only [hQ, ite_false, zero_mul] + +end MatrixMultiplication.DualInformation + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/Duality/InformationSchedule.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/Duality/InformationSchedule.lean new file mode 100644 index 0000000000000000000000000000000000000000..7cbb969294744cae7175074054d5daad44cba924 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/Duality/InformationSchedule.lean @@ -0,0 +1,91 @@ +import OAI.LinearAlgebra.MatrixMultiplication.Completion.Labels +import OAI.LinearAlgebra.MatrixMultiplication.Duality.Information + +namespace OAI + +/-! Dual matrix multiplication exponents and finite rectangular constructions. -/ + +noncomputable section + +namespace MatrixMultiplication.CompletionLabels.TopologicalFlatten.TopologicalSchedule + +open MatrixMultiplication.Foundation RecursiveCompletion DualInformation + +universe u v + +variable {A : Type u} [Fintype A] {Coord : Color → Type v} + [Fintype (Coord .B)] {depth : ℕ} + +theorem incident_rate_eq_x_entropy (s : TopologicalSchedule A Coord depth) + (p : FiniteLaw A) (complete : s.toNodeSchedule.Complete depth) + (independent : ∀ n : Fin depth, s.pairs n = .yz → + ConditionalIndependent p (labelRecordOf s.toNodeSchedule.labels n.val) + (s.toNodeSchedule.labels n.val) (s.view .B)) : + ConditionalLabels.lawPairingRate p s.toNodeSchedule.labels depth s.pairs .xy + + ConditionalLabels.lawPairingRate p s.toNodeSchedule.labels depth s.pairs .xz = + finiteEntropy (p.map (s.view .B)).mass := by + apply incident_rate_eq_coordinate_entropy p s.toNodeSchedule.labels depth s.pairs + (s.view .B) (s.completeRecord_injective complete) ?_ independent + intro n hn + have hs : firstSide (s.readerPair n.val) = .B := by + cases hr : s.readerPair n.val <;> simp_all [pairs, firstSide] + let read : LabelRecord s.toNodeSchedule.Label n.val → Coord .B → + s.toNodeSchedule.Label n.val := fun r x => + s.firstReader n.val r (hs.symm ▸ x) + refine ⟨fun rx => read rx.1 rx.2, ?_⟩ + intro a + have transport (c d : Color) (h : c = d) : + h.symm ▸ s.view d a = s.view c a := by + cases h + rfl + have hv : hs.symm ▸ s.view .B a = s.view (firstSide (s.readerPair n.val)) a := + transport _ _ hs + change s.firstReader n.val (labelRecordOf s.toNodeSchedule.labels n.val a) + (hs.symm ▸ s.view .B a) = s.toNodeSchedule.labels n.val a + rw [hv] + exact s.firstReader_readable n.val n.isLt a + +end MatrixMultiplication.CompletionLabels.TopologicalFlatten.TopologicalSchedule + +namespace MatrixMultiplication.CompletionLabels.TopologicalFlatten.Program + +open MatrixMultiplication.Foundation RecursiveCompletion DualInformation + +universe u v w z + +variable {A : Type u} [Fintype A] {Coord : Color → Type v} + [Fintype (Coord .B)] {Context : Type z} {Code : Type w} [Fintype Code] + {depth : ℕ} + +theorem incident_rate_eq_x_entropy (s : Program A Coord Context Code depth) + (p : FiniteLaw A) (complete : s.Complete) (ctx : Context) + (context_constant : ∀ a, s.context a = ctx) + (independent : ∀ n : Fin depth, s.pair n.val = .yz → + ConditionalIndependent p (labelRecordOf s.labels n.val) + (s.labels n.val) (s.view .B)) : + ConditionalLabels.lawPairingRate p s.labels depth (fun n => s.pair n.val) .xy + + ConditionalLabels.lawPairingRate p s.labels depth (fun n => s.pair n.val) .xz = + finiteEntropy (p.map (s.view .B)).mass := by + have hinj : Function.Injective (labelRecordOf s.labels depth) := by + intro a b h + apply complete a b ((context_constant a).trans (context_constant b).symm) + intro n hn + exact label_eq_of_record_eq s.labels h hn + apply incident_rate_eq_coordinate_entropy p s.labels depth (fun n => s.pair n.val) + (s.view .B) hinj ?_ independent + intro n hn + have hs : .B = firstSide (s.pair n.val) := by + cases hr : s.pair n.val <;> simp_all [firstSide] + refine ⟨fun rx => s.read n.val .B ctx (recordArray n.val rx.1) rx.2, ?_⟩ + intro a + change s.read n.val .B ctx (recordArray n.val (labelRecordOf s.labels n.val a)) + (s.view .B a) = s.labels n.val a + rw [recordArray_labelRecordOf] + rw [← context_constant a] + exact s.readable n.val n.isLt a .B (Or.inl hs) + +end MatrixMultiplication.CompletionLabels.TopologicalFlatten.Program + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/Duality/InformationTransport.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/Duality/InformationTransport.lean new file mode 100644 index 0000000000000000000000000000000000000000..9bb5879c5b7f6777adfd3a664fc5603f691eb2b1 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/Duality/InformationTransport.lean @@ -0,0 +1,116 @@ +import OAI.LinearAlgebra.MatrixMultiplication.Duality.Information + +namespace OAI + +/-! Dual matrix multiplication exponents and finite rectangular constructions. -/ + +noncomputable section + +namespace MatrixMultiplication.DualInformationTransport + +open MatrixMultiplication.Foundation DualEntropyHelpers DualInformation +open scoped BigOperators + +variable {A B R L X R' L' X' : Type*} + [Fintype A] [Fintype B] [Fintype R] [Fintype L] [Fintype X] + [Fintype R'] [Fintype L'] [Fintype X'] + +theorem mass_factorization_congr_mass_iff (p q : FiniteLaw A) + (hmass : p.mass = q.mass) (prior : A → R) (label : A → L) (x : A → X) : + ConditionalMassFactorization p prior label x ↔ + ConditionalMassFactorization q prior label x := by + classical + simp only [ConditionalMassFactorization, FiniteLaw.map_mass, hmass] + +theorem mass_factorization_map_iff (p : FiniteLaw A) (e : A → B) + (prior : B → R) (label : B → L) (x : B → X) : + ConditionalMassFactorization (p.map e) prior label x ↔ + ConditionalMassFactorization p (fun a => prior (e a)) + (fun a => label (e a)) (fun a => x (e a)) := by + simp only [ConditionalMassFactorization, map_comp_mass] + +theorem conditionalIndependent_map_of_mass_factorization + (p : FiniteLaw A) (e : A → B) + (prior : B → R) (label : B → L) (x : B → X) + (h : ConditionalMassFactorization p (fun a => prior (e a)) + (fun a => label (e a)) (fun a => x (e a))) : + ConditionalIndependent (p.map e) prior label x := by + apply conditionalIndependent_of_mass_factorization + exact (mass_factorization_map_iff p e prior label x).mpr h + +theorem map_mass_eq_of_fiber (p : FiniteLaw A) (f : A → B) (g : A → R) + (b : B) (r : R) (fiber : ∀ a, f a = b ↔ g a = r) : + (p.map f).mass b = (p.map g).mass r := by + classical + simp only [FiniteLaw.map_mass] + apply Finset.sum_congr rfl + intro a _ + rw [fiber a] + +theorem mass_factorization_of_same_partitions (p : FiniteLaw A) + (priorA : A → R) (labelA : A → L) (xA : A → X) + (priorB : A → R') (labelB : A → L') (xB : A → X') + (hprior : ∀ a b, priorA a = priorA b ↔ priorB a = priorB b) + (hlabel : ∀ a b, labelA a = labelA b ↔ labelB a = labelB b) + (hx : ∀ a b, xA a = xA b ↔ xB a = xB b) + (factor : ConditionalMassFactorization p priorA labelA xA) : + ConditionalMassFactorization p priorB labelB xB := by + classical + intro r l xx + by_cases hr : ∃ a, priorB a = r + · obtain ⟨a, rfl⟩ := hr + by_cases hl : ∃ b, labelB b = l + · obtain ⟨b, rfl⟩ := hl + by_cases hxx : ∃ c, xB c = xx + · obtain ⟨c, rfl⟩ := hxx + have hp : (p.map priorB).mass (priorB a) = + (p.map priorA).mass (priorA a) := + map_mass_eq_of_fiber p priorB priorA _ _ (fun d => (hprior d a).symm) + have hpl : (p.map (fun d => (priorB d, labelB d))).mass + (priorB a, labelB b) = + (p.map (fun d => (priorA d, labelA d))).mass (priorA a, labelA b) := by + apply map_mass_eq_of_fiber + intro d + simp only [Prod.mk.injEq, ← hprior, ← hlabel] + have hpx : (p.map (fun d => (priorB d, xB d))).mass + (priorB a, xB c) = + (p.map (fun d => (priorA d, xA d))).mass (priorA a, xA c) := by + apply map_mass_eq_of_fiber + intro d + simp only [Prod.mk.injEq, ← hprior, ← hx] + have hplx : (p.map (fun d => (priorB d, (labelB d, xB d)))).mass + (priorB a, (labelB b, xB c)) = + (p.map (fun d => (priorA d, (labelA d, xA d)))).mass + (priorA a, (labelA b, xA c)) := by + apply map_mass_eq_of_fiber + intro d + simp only [Prod.mk.injEq, ← hprior, ← hlabel, ← hx] + rw [hplx, hp, hpl, hpx] + exact factor (priorA a) (labelA b) (xA c) + · have hn : ∀ c, xB c ≠ xx := not_exists.mp hxx + simp [FiniteLaw.map_mass, Prod.mk.injEq, hn] + · have hn : ∀ b, labelB b ≠ l := not_exists.mp hl + simp [FiniteLaw.map_mass, Prod.mk.injEq, hn] + · have hn : ∀ a, priorB a ≠ r := not_exists.mp hr + simp [FiniteLaw.map_mass, Prod.mk.injEq, hn] + +theorem mass_factorization_partition_iff (p : FiniteLaw A) + (priorA : A → R) (labelA : A → L) (xA : A → X) + (priorB : A → R') (labelB : A → L') (xB : A → X') + (hprior : ∀ a b, priorA a = priorA b ↔ priorB a = priorB b) + (hlabel : ∀ a b, labelA a = labelA b ↔ labelB a = labelB b) + (hx : ∀ a b, xA a = xA b ↔ xB a = xB b) : + ConditionalMassFactorization p priorA labelA xA ↔ + ConditionalMassFactorization p priorB labelB xB := by + constructor + · exact mass_factorization_of_same_partitions p priorA labelA xA priorB labelB xB + hprior hlabel hx + · exact mass_factorization_of_same_partitions p priorB labelB xB priorA labelA xA + (fun a b => (hprior a b).symm) (fun a b => (hlabel a b).symm) + (fun a b => (hx a b).symm) + +end MatrixMultiplication.DualInformationTransport + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/Duality/LawEntropy.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/Duality/LawEntropy.lean new file mode 100644 index 0000000000000000000000000000000000000000..d5ae6f204541738a6170bf0bd6f33540424de8ab --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/Duality/LawEntropy.lean @@ -0,0 +1,174 @@ +import OAI.LinearAlgebra.MatrixMultiplication.Completion.ColorLaws +import OAI.LinearAlgebra.MatrixMultiplication.Completion.Entropy +import OAI.LinearAlgebra.MatrixMultiplication.Completion.ColorEntropy +import OAI.LinearAlgebra.MatrixMultiplication.Completion.EntropyAlgebra + +namespace OAI + +/-! Dual matrix multiplication exponents and finite rectangular constructions. -/ + +noncomputable section + +namespace MatrixMultiplication.DualLawEntropy + +open MatrixMultiplication.Foundation RecursiveCompletion CompletionLabels CompletionColorLaws +open CompletionProductLaws CompletionLaws +open scoped BigOperators +attribute [local instance 10000] Classical.propDecidable Classical.decEq +attribute [local instance 11000] instDecidableEqFin + +universe u +variable {X Y Z : Type u} [Fintype X] [Fintype Y] [Fintype Z] + +def allCenter (S : FlaggedTensor X Y Z) (center : Color) (m : ℕ) + (w : Fin m → Leaf S) : Prop := ∀ i, leafColor S (w i) = center + +theorem iid_allowed (S : FlaggedTensor X Y Z) (center output : Color) + (pc : FiniteLaw (ColorSlice S center)) (po : FiniteLaw (ColorSlice S output)) + (m : ℕ) (a : ℝ) (ha : 0 ≤ a) (ha' : a ≤ 1) (w : Fin m → Leaf S) + (hw : (iidColorLaw S center output pc po m a ha ha').mass w ≠ 0) (i : Fin m) : + leafColor S (w i) = center ∨ leafColor S (w i) = output := by + change (∏ j : Fin m, (colorMix S center output pc po a ha ha').mass (w j)) ≠ 0 at hw + have hn : (colorMix S center output pc po a ha ha').mass (w i) ≠ 0 := + (Finset.prod_ne_zero_iff.mp hw) i (Finset.mem_univ i) + by_contra h + exact hn (colorMix_mass_zero S center output pc po a ha ha' (w i) + (fun h' => h (Or.inl h')) (fun h' => h (Or.inr h'))) + +omit [Fintype X] [Fintype Y] [Fintype Z] in +theorem not_event_iff_allCenter (S : FlaggedTensor X Y Z) (center output : Color) + (hne : center ≠ output) (m : ℕ) (w : Fin m → Leaf S) + (allowed : ∀ i, leafColor S (w i) = center ∨ leafColor S (w i) = output) : + ¬ completionEvent S center output m w ↔ allCenter S center m w := by + constructor + · intro h i + rcases allowed i with hi | hi + · exact hi + · exfalso + apply h + refine ⟨?_, allowed⟩ + simpa only [raisedFlag, ite_eq_right hne] using Exists.intro i hi + · intro h he + have hx : ∃ i, leafColor S (w i) = output := by + simpa only [raisedFlag, ite_eq_right hne] using he.1 + obtain ⟨i, hi⟩ := hx + exact hne ((h i).symm.trans hi) + +theorem event_sum_congr {A : Type*} [Fintype A] (P Q : A → Prop) (f : A → ℝ) + (agree : ∀ a, f a ≠ 0 → (P a ↔ Q a)) : + (∑ a : {a // P a}, f a.val) = ∑ a : {a // Q a}, f a.val := by + rw [sum_subtype_indicator P f, sum_subtype_indicator Q f] + apply Finset.sum_congr rfl + intro a _ + by_cases ha : f a = 0 + · simp [ha] + · simp only [agree a ha] + +theorem removed_event_mass_eq (S : FlaggedTensor X Y Z) (center output : Color) + (hne : center ≠ output) + (pc : FiniteLaw (ColorSlice S center)) (po : FiniteLaw (ColorSlice S output)) + (m : ℕ) (a : ℝ) (ha : 0 ≤ a) (ha' : a ≤ 1) : + eventMass (iidColorLaw S center output pc po m a ha ha') + (fun w => ¬ completionEvent S center output m w) = + eventMass (iidColorLaw S center output pc po m a ha ha') (allCenter S center m) := by + apply event_sum_congr + intro w hw + exact not_event_iff_allCenter S center output hne m w + (iid_allowed S center output pc po m a ha ha' w hw) + +theorem removed_event_entropy_eq (S : FlaggedTensor X Y Z) (center output : Color) + (hne : center ≠ output) + (pc : FiniteLaw (ColorSlice S center)) (po : FiniteLaw (ColorSlice S output)) + (m : ℕ) (a : ℝ) (ha : 0 ≤ a) (ha' : a ≤ 1) : + (∑ w : {w // ¬ completionEvent S center output m w}, + entropyTerm ((iidColorLaw S center output pc po m a ha ha').mass w.val)) = + ∑ w : {w // allCenter S center m w}, + entropyTerm ((iidColorLaw S center output pc po m a ha ha').mass w.val) := by + apply event_sum_congr (fun w => ¬ completionEvent S center output m w) + (allCenter S center m) + (fun w => entropyTerm ((iidColorLaw S center output pc po m a ha ha').mass w)) + intro w hw + have hm : (iidColorLaw S center output pc po m a ha ha').mass w ≠ 0 := by + intro hm + simp [hm] at hw + exact not_event_iff_allCenter S center output hne m w + (iid_allowed S center output pc po m a ha ha' w hm) + +def centerWordEquiv (S : FlaggedTensor X Y Z) (center : Color) (m : ℕ) : + {w : Fin m → Leaf S // allCenter S center m w} ≃ (Fin m → ColorSlice S center) where + toFun w i := ⟨w.val i, w.property i⟩ + invFun w := ⟨fun i => (w i).val, fun i => (w i).property⟩ + left_inv _ := rfl + right_inv _ := rfl + +theorem center_word_mass (S : FlaggedTensor X Y Z) (center output : Color) + (hne : center ≠ output) + (pc : FiniteLaw (ColorSlice S center)) (po : FiniteLaw (ColorSlice S output)) + (m : ℕ) (a : ℝ) (ha : 0 ≤ a) (ha' : a ≤ 1) + (w : {w : Fin m → Leaf S // allCenter S center m w}) : + (iidColorLaw S center output pc po m a ha ha').mass w.val = + a ^ m * (independentProduct (fun _ : Fin m => pc)).mass (centerWordEquiv S center m w) := by + change (∏ i, (colorMix S center output pc po a ha ha').mass (w.val i)) = + a ^ m * ∏ i, pc.mass ⟨w.val i, w.property i⟩ + have hslot (i : Fin m) : (colorMix S center output pc po a ha ha').mass (w.val i) = + a * pc.mass ⟨w.val i, w.property i⟩ := + colorMix_center_mass S center output hne pc po a ha ha' ⟨w.val i, w.property i⟩ + simp_rw [hslot] + rw [Finset.prod_mul_distrib] + simp + +theorem allCenter_mass (S : FlaggedTensor X Y Z) (center output : Color) + (hne : center ≠ output) + (pc : FiniteLaw (ColorSlice S center)) (po : FiniteLaw (ColorSlice S output)) + (m : ℕ) (a : ℝ) (ha : 0 ≤ a) (ha' : a ≤ 1) : + eventMass (iidColorLaw S center output pc po m a ha ha') (allCenter S center m) = a ^ m := by + unfold eventMass + simp_rw [center_word_mass S center output hne pc po m a ha ha'] + rw [← Finset.mul_sum, (centerWordEquiv S center m).sum_comp, + (independentProduct (fun _ : Fin m => pc)).total, mul_one] + +theorem allCenter_entropy (S : FlaggedTensor X Y Z) (center output : Color) + (hne : center ≠ output) + (pc : FiniteLaw (ColorSlice S center)) (po : FiniteLaw (ColorSlice S output)) + (m : ℕ) (a : ℝ) (ha : 0 ≤ a) (ha' : a ≤ 1) : + (∑ w : {w // allCenter S center m w}, + entropyTerm ((iidColorLaw S center output pc po m a ha ha').mass w.val)) = + entropyTerm (a ^ m) + a ^ m * ((m : ℝ) * finiteEntropy pc.mass) := by + simp_rw [center_word_mass S center output hne pc po m a ha ha'] + rw [(centerWordEquiv S center m).sum_comp + (fun w => entropyTerm (a ^ m * (independentProduct (fun _ : Fin m => pc)).mass w))] + change finiteEntropy (fun w => a ^ m * + (independentProduct (fun _ : Fin m => pc)).mass w) = _ + rw [entropy_scaled_law, independentProduct_entropy] + simp + +theorem conditionalCompletionLaw_entropy (S : FlaggedTensor X Y Z) (center output : Color) + (hne : center ≠ output) + (pc : FiniteLaw (ColorSlice S center)) (po : FiniteLaw (ColorSlice S output)) + (m : ℕ) (hm : 0 < m) (a : ℝ) (ha : 0 ≤ a) (ha' : a < 1) : + finiteEntropy (conditionalCompletionLaw S center output pc po m hm a ha ha').mass = + CompletionEntropyAlgebra.conditionalMixEntropy a m + (finiteEntropy pc.mass) (finiteEntropy po.mass) := by + rw [conditionalCompletionLaw, transport_entropy] + have hmass : eventMass (iidColorLaw S center output pc po m a ha ha'.le) + (fun w => ¬ completionEvent S center output m w) = a ^ m := + (removed_event_mass_eq S center output hne pc po m a ha ha'.le).trans + (allCenter_mass S center output hne pc po m a ha ha'.le) + have hremoved : + (∑ w : {w // ¬ completionEvent S center output m w}, + entropyTerm ((iidColorLaw S center output pc po m a ha ha'.le).mass w.val)) = + entropyTerm (a ^ m) + a ^ m * ((m : ℝ) * finiteEntropy pc.mass) := + (removed_event_entropy_eq S center output hne pc po m a ha ha'.le).trans + (allCenter_entropy S center output hne pc po m a ha ha'.le) + rw [condition_entropy_of_removed_event _ _ _ (a ^ m) + ((m : ℝ) * finiteEntropy pc.mass) hmass hremoved] + rw [iidColorLaw_entropy S center output hne pc po m a ha ha'.le] + unfold CompletionEntropyAlgebra.conditionalMixEntropy CompletionEntropyAlgebra.binaryEntropy + congr 1 + ring + +end MatrixMultiplication.DualLawEntropy + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/Duality/ProgramIndependence.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/Duality/ProgramIndependence.lean new file mode 100644 index 0000000000000000000000000000000000000000..f3843d693157f57118e988d156a6a02886ea475f --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/Duality/ProgramIndependence.lean @@ -0,0 +1,195 @@ +import OAI.LinearAlgebra.MatrixMultiplication.Duality.Information +import OAI.LinearAlgebra.MatrixMultiplication.Completion.ColorLaws +import OAI.LinearAlgebra.MatrixMultiplication.Duality.UniformProducts + +namespace OAI + +/-! Dual matrix multiplication exponents and finite rectangular constructions. -/ + +noncomputable section + +namespace MatrixMultiplication.DualProgramIndependence + +universe u v w z + +open MatrixMultiplication.Foundation DualInformation CompletionProductLaws +open CompletionColorLaws CompletionLabels RecursiveCompletion DualEntropyHelpers +open DualUniformProducts +open scoped BigOperators +attribute [local instance 10000] Classical.propDecidable Classical.decEq +attribute [local instance 11000] instDecidableEqFin + +variable {I : Type*} [Fintype I] [DecidableEq I] + {A : I → Type u} {R : I → Type v} {L : I → Type w} {X : I → Type z} + [∀ i, Fintype (A i)] [∀ i, Fintype (R i)] + [∀ i, Fintype (L i)] [∀ i, Fintype (X i)] + +theorem independentProduct_triple_mass + (p : ∀ i, FiniteLaw (A i)) (prior : ∀ i, A i → R i) + (label : ∀ i, A i → L i) (x : ∀ i, A i → X i) + (r : ∀ i, R i) (l : ∀ i, L i) (xx : ∀ i, X i) : + ((independentProduct p).map (fun a => ((fun i => prior i (a i)), + ((fun i => label i (a i)), (fun i => x i (a i)))))).mass (r, (l, xx)) = + ∏ i, ((p i).map (fun a => (prior i a, (label i a, x i a)))).mass + (r i, (l i, xx i)) := by + rw [← independentProduct_map_mass p + (fun i a => (prior i a, (label i a, x i a))) + (fun i => (r i, (l i, xx i)))] + simp only [FiniteLaw.map_mass] + apply Finset.sum_congr rfl + intro a _ + simp only [Prod.mk.injEq, funext_iff, forall_and] + +theorem independentProduct_factorization + (p : ∀ i, FiniteLaw (A i)) (prior : ∀ i, A i → R i) + (label : ∀ i, A i → L i) (x : ∀ i, A i → X i) + (h : ∀ i, ConditionalMassFactorization (p i) (prior i) (label i) (x i)) : + ConditionalMassFactorization (independentProduct p) + (fun a i => prior i (a i)) (fun a i => label i (a i)) + (fun a i => x i (a i)) := by + intro r l xx + rw [independentProduct_triple_mass p prior label x r l xx, + independentProduct_map_mass p prior r, + independentProduct_joint_mass p prior label r l, + independentProduct_joint_mass p prior x r xx, + ← Finset.prod_mul_distrib, ← Finset.prod_mul_distrib] + apply Finset.prod_congr rfl + intro i _ + exact h i (r i) (l i) (xx i) + +section Constant + +variable {B : Type u} {P : Type v} {C : Type w} {Y : Type z} + [Fintype B] [Fintype P] [Fintype C] [Fintype Y] + +theorem factorization_constant_label (p : FiniteLaw B) (prior : B → P) + (c : C) (x : B → Y) : + ConditionalMassFactorization p prior (fun _ => c) x := by + intro r l xx + by_cases h : c = l + · subst l + simp only [FiniteLaw.map_mass, Prod.mk.injEq, true_and, and_true] + ring + · simp only [FiniteLaw.map_mass, Prod.mk.injEq, h, false_and, and_false, + ite_false, Finset.sum_const_zero, zero_mul] + +end Constant + +section ColorMixture + +variable {SX SY SZ : Type u} {P : Type v} {C : Type w} {V : Type z} + [Fintype SX] [Fintype SY] [Fintype SZ] + [Fintype P] [Fintype C] [Fintype V] + +theorem colorSlice_context_mass (S : FlaggedTensor SX SY SZ) (color c : Color) + (p : FiniteLaw (ColorSlice S color)) (f : Leaf S → V) (v : V) : + ((p.map Subtype.val).map (fun a => (leafColor S a, f a))).mass (c, v) = + if color = c then (p.map (fun a => f a.val)).mass v else 0 := by + rw [map_comp_mass] + simp only [FiniteLaw.map_mass, Prod.mk.injEq] + by_cases h : color = c + · simp only [show ∀ a : ColorSlice S color, leafColor S a.val = color from + fun a => a.property, h, true_and, ite_true] + · simp only [show ∀ a : ColorSlice S color, leafColor S a.val = color from + fun a => a.property, h, false_and, ite_false, Finset.sum_const_zero] + +theorem colorMix_context_mass (S : FlaggedTensor SX SY SZ) (center output c : Color) + (pc : FiniteLaw (ColorSlice S center)) (po : FiniteLaw (ColorSlice S output)) + (α : ℝ) (hα : 0 ≤ α) (hα' : α ≤ 1) (f : Leaf S → V) (v : V) : + ((colorMix S center output pc po α hα hα').map + (fun a => (leafColor S a, f a))).mass (c, v) = + α * (if center = c then (pc.map (fun a => f a.val)).mass v else 0) + + (1 - α) * (if output = c then (po.map (fun a => f a.val)).mass v else 0) := by + rw [colorMix_map_mass, colorSlice_context_mass, colorSlice_context_mass] + +theorem colorMix_refined_context_mass (S : FlaggedTensor SX SY SZ) + (center output c : Color) + (pc : FiniteLaw (ColorSlice S center)) (po : FiniteLaw (ColorSlice S output)) + (α : ℝ) (hα : 0 ≤ α) (hα' : α ≤ 1) + (prior : Leaf S → P) (f : Leaf S → V) (r : P) (v : V) : + ((colorMix S center output pc po α hα hα').map + (fun a => ((leafColor S a, prior a), f a))).mass ((c, r), v) = + α * (if center = c then + (pc.map (fun a => (prior a.val, f a.val))).mass (r, v) else 0) + + (1 - α) * (if output = c then + (po.map (fun a => (prior a.val, f a.val))).mass (r, v) else 0) := by + rw [← colorMix_context_mass S center output c pc po α hα hα' + (fun a => (prior a, f a)) (r, v)] + simp only [FiniteLaw.map_mass, Prod.mk.injEq, and_assoc] + +theorem colorMix_factorization (S : FlaggedTensor SX SY SZ) (center output : Color) + (hne : center ≠ output) + (pc : FiniteLaw (ColorSlice S center)) (po : FiniteLaw (ColorSlice S output)) + (α : ℝ) (hα : 0 ≤ α) (hα' : α ≤ 1) + (prior : Leaf S → P) (label : Leaf S → C) (x : Leaf S → V) + (hc : ConditionalMassFactorization pc (fun a => prior a.val) + (fun a => label a.val) (fun a => x a.val)) + (ho : ConditionalMassFactorization po (fun a => prior a.val) + (fun a => label a.val) (fun a => x a.val)) : + ConditionalMassFactorization (colorMix S center output pc po α hα hα') + (fun a => (leafColor S a, prior a)) label x := by + rintro ⟨c, r⟩ l xx + rw [colorMix_refined_context_mass, colorMix_context_mass, + colorMix_refined_context_mass, colorMix_refined_context_mass] + by_cases hcc : center = c + · subst c + have hoc : output ≠ center := Ne.symm hne + simp only [ite_true, ite_eq_right hoc, mul_zero, add_zero] + calc + _ = α ^ 2 * + ((pc.map (fun a => (prior a.val, (label a.val, x a.val)))).mass (r, (l, xx)) * + (pc.map (fun a => prior a.val)).mass r) := by ring + _ = _ := by rw [hc r l xx]; ring + · by_cases hoc : output = c + · subst c + simp only [ite_eq_right hne, ite_true, mul_zero, zero_add] + calc + _ = (1 - α) ^ 2 * + ((po.map (fun a => (prior a.val, (label a.val, x a.val)))).mass (r, (l, xx)) * + (po.map (fun a => prior a.val)).mass r) := by ring + _ = _ := by rw [ho r l xx]; ring + · simp only [ite_eq_right hcc, ite_eq_right hoc, mul_zero, zero_add] + +theorem colorMix_recorded_factorization (S : FlaggedTensor SX SY SZ) + (center output : Color) + (pc : FiniteLaw (ColorSlice S center)) (po : FiniteLaw (ColorSlice S output)) + (α : ℝ) (hα : 0 ≤ α) (hα' : α ≤ 1) (hbranch : center ≠ output ∨ α = 0) + (prior : Leaf S → P) (label : Leaf S → C) (x : Leaf S → V) + (hc : ConditionalMassFactorization pc (fun a => prior a.val) + (fun a => label a.val) (fun a => x a.val)) + (ho : ConditionalMassFactorization po (fun a => prior a.val) + (fun a => label a.val) (fun a => x a.val)) : + ConditionalMassFactorization (colorMix S center output pc po α hα hα') + (fun a => (leafColor S a, prior a)) label x := by + rcases hbranch with hne | hz + · exact colorMix_factorization S center output hne pc po α hα hα' prior label x hc ho + · subst α + rintro ⟨c, r⟩ l xx + rw [colorMix_refined_context_mass, colorMix_context_mass, + colorMix_refined_context_mass, colorMix_refined_context_mass] + by_cases hoc : output = c + · simp only [zero_mul, zero_add, sub_zero, one_mul, ite_eq_left hoc] + exact ho r l xx + · simp only [zero_mul, zero_add, sub_zero, one_mul, ite_eq_right hoc] + +end ColorMixture + +section ProgramInvariant + +variable {SX SY SZ : Type u} [Fintype SX] [Fintype SY] [Fintype SZ] + +def ProgramLawsIndependent (S : FlaggedTensor SX SY SZ) (r : ReadableTensor S) + (p : ∀ c, FiniteLaw (ColorSlice S c)) : Prop := + ∀ c, ∀ n : Fin r.depth, r.program.pair n.val = .yz → + ConditionalMassFactorization (p c) + (fun a => labelRecordOf r.program.labels n.val a.val) + (fun a => r.program.labels n.val a.val) + (fun a => a.val.val.1) + +end ProgramInvariant + +end MatrixMultiplication.DualProgramIndependence + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/Duality/RootIndependence.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/Duality/RootIndependence.lean new file mode 100644 index 0000000000000000000000000000000000000000..c8996491b25e6f2635df85f03e810f1f56368de1 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/Duality/RootIndependence.lean @@ -0,0 +1,206 @@ +import OAI.LinearAlgebra.MatrixMultiplication.Duality.CompletionIndependence +import OAI.LinearAlgebra.MatrixMultiplication.Duality.InformationLabelConditioning +import OAI.LinearAlgebra.MatrixMultiplication.Duality.UniformMixtures + +namespace OAI + +/-! Dual matrix multiplication exponents and finite rectangular constructions. -/ + +noncomputable section + +namespace MatrixMultiplication.DualProgramIndependence + +universe u w + +open MatrixMultiplication.Foundation RecursiveCompletion CompletionLabels +open CompletionLaws CompletionColorLaws CompletionProductLaws DualUniformProducts +open DualInformation DualInformationTransport DualUniformMixtures TopologicalFlatten +open scoped BigOperators +theorem rootColor_inj_before_three {i j : ℕ} (hi : i < 3) (hj : j < 3) : + rootColor i = rootColor j ↔ i = j := by + interval_cases i <;> interval_cases j <;> simp [rootColor] + +private theorem completion_index_decomposition {n m depth : ℕ} + (hn : n < 3 + m * depth) (hn3 : ¬ n < 3) : + 0 < depth ∧ n - 3 < m * depth ∧ + n = 3 + ((n - 3) / depth * depth + (n - 3) % depth) := by + have hd : 0 < depth := by + by_contra h + have hz : depth = 0 := by omega + simp only [hz, mul_zero, add_zero] at hn + omega + refine ⟨hd, by omega, ?_⟩ + have h : (n - 3) / depth * depth + (n - 3) % depth = n - 3 := by + simpa only [Nat.mul_comm] using Nat.div_add_mod (n - 3) depth + omega + +attribute [local instance 10000] Classical.propDecidable Classical.decEq +attribute [local instance 11000] instDecidableEqFin + +variable {X Y Z : Type u} {Code : Type w} [Fintype X] [Fintype Y] [Fintype Z] + [Fintype Code] [Inhabited Code] {depth m : ℕ} + +theorem conditionalCompletionLaw_pattern_factorization (S : FlaggedTensor X Y Z) + (center output : Color) + (pc : FiniteLaw (ColorSlice S center)) (po : FiniteLaw (ColorSlice S output)) + (α : ℝ) (hα : 0 ≤ α) (hα' : α < 1) (hm : 0 < m) + (hcommon : ∀ x, (pc.map (fun a => a.val.val.1)).mass x = + (po.map (fun a => a.val.val.1)).mass x) : + ConditionalMassFactorization + (conditionalCompletionLaw S center output pc po m hm α hα hα') + (fun _ => (PUnit.unit : PUnit.{1})) (fun a => pattern S center m a.val) + (fun a => a.val.val.1) := by + let mix := colorMix S center output pc po α hα hα'.le + have hs (c : Color) (x : X) : + (mix.map (fun a => (leafColor S a, a.val.1))).mass (c, x) = + (mix.map (leafColor S)).mass c * (mix.map (fun a => a.val.1)).mass x := by + have h := colorMix_independent_common S center output pc po α hα hα'.le + (fun a => a.val.1) hcommon x c + simpa only [FiniteLaw.map_mass, Prod.mk.injEq, and_comm, mul_comm] using h + have hw : ConditionalMassFactorization (iidColorLaw S center output pc po m α hα hα'.le) + (fun _ => (PUnit.unit : PUnit.{1})) (fun a j => leafColor S (a j)) (fun a j => (a j).val.1) := by + apply (mass_factorization_const_iff _ _ _).mpr + exact independentProduct_independent (fun _ : Fin m => mix) + (fun _ => leafColor S) (fun _ a => a.val.1) (fun _ => hs) + let Q : (Fin m → Color) → Prop := fun c => + raisedFlag center output (fun j => c j = output) ∧ + ∀ j, c j = center ∨ c j = output + have hcondition := conditionalMassFactorization_condition_label + (iidColorLaw S center output pc po m α hα hα'.le) + (fun a j => leafColor S (a j)) (fun a j => (a j).val.1) Q + (completionEvent_mass_pos S center output pc po m hm α hα hα') hw + let e := conditionalLeafEquiv S center output m + let q := condition (iidColorLaw S center output pc po m α hα hα'.le) + (completionEvent S center output m) + (completionEvent_mass_pos S center output pc po m hm α hα hα') + have hslot (a : {w : Fin m → Leaf S // completionEvent S center output m w}) : + slot S center m (e.symm a).val = a.val := + congrArg Subtype.val (e.apply_symm_apply a) + change ConditionalMassFactorization (q.map e.symm) _ _ _ + rw [mass_factorization_map_iff] + apply mass_factorization_of_same_partitions q (fun _ => (PUnit.unit : PUnit.{1})) + (fun a j => leafColor S (a.val j)) (fun a j => (a.val j).val.1) + · intro a b + rfl + · intro a b + rfl + · intro a b + rfl + · exact hcondition + +theorem conditionalCompletionLaw_root_factorization (S : FlaggedTensor X Y Z) + (p : Program (Leaf S) (Coordinate X Y Z) Color Code depth) + (context_eq : ∀ a, p.context a = leafColor S a) + (view_eq : ∀ side a, p.view side a = coordinate a.val side) + (center output : Color) + (pc : FiniteLaw (ColorSlice S center)) (po : FiniteLaw (ColorSlice S output)) + (α : ℝ) (hα : 0 ≤ α) (hα' : α < 1) (hm : 0 < m) + (n : ℕ) (hn : n < 3) + (hcommon : ownerPair center output = .yz → ∀ x, + (pc.map (fun a => a.val.val.1)).mass x = + (po.map (fun a => a.val.val.1)).mass x) + (hpair : (completionLocalProgram S center m p context_eq view_eq).pair n = .yz) : + ConditionalMassFactorization + (conditionalCompletionLaw S center output pc po m hm α hα hα') + (fun a => labelRecordOf + (completionLocalProgram S center m p context_eq view_eq).labels n a.val) + (fun a => (completionLocalProgram S center m p context_eq view_eq).labels n a.val) + (fun a => a.val.val.1) := by + let law := conditionalCompletionLaw S center output pc po m hm α hα hα' + let cp := completionLocalProgram S center m p context_eq view_eq + have hroot (j : ℕ) (hj : j < 3) (a : ColorSlice (complete S center m) output) : + cp.labels j a.val = encodePattern + (if output = rootColor j then some (pattern S center m a.val) else none) := by + rw [completionLocalProgram_label_root S center m p context_eq view_eq j hj, a.property] + split_ifs <;> rfl + by_cases hactive : output = rootColor n + · have hp : ownerPair center output = .yz := by + rw [completionLocalProgram_pair_root S center m p context_eq view_eq n hn, + ← hactive] at hpair + exact hpair + have hprev (a b : ColorSlice (complete S center m) output) : + labelRecordOf cp.labels n a.val = labelRecordOf cp.labels n b.val := by + apply (labelRecordOf_eq_iff _ _ _ _).mpr + intro j hj + have hj3 : j < 3 := lt_trans hj hn + have hne : output ≠ rootColor j := by + intro he + have hnj : n = j := (rootColor_inj_before_three hn hj3).mp (hactive.symm.trans he) + exact (Nat.ne_of_lt hj) hnj.symm + rw [hroot j hj3 a, hroot j hj3 b, ite_eq_right hne, ite_eq_right hne] + apply mass_factorization_of_same_partitions law (fun _ => (PUnit.unit : PUnit.{1})) + (fun a => pattern S center m a.val) (fun a => a.val.val.1) + · intro a b + exact iff_of_true rfl (hprev a b) + · intro a b + rw [hroot n hn a, hroot n hn b, ite_eq_left hactive, ite_eq_left hactive] + simp only [encodePattern, Option.some.injEq, Sum.inl.injEq] + · intro a b + rfl + · exact conditionalCompletionLaw_pattern_factorization S center output pc po α hα hα' hm + (hcommon hp) + · have hlabel : (fun a : ColorSlice (complete S center m) output => cp.labels n a.val) = + (fun _ => encodePattern (Code := Code) none) := by + funext a + rw [hroot n hn a, ite_eq_right hactive] + change ConditionalMassFactorization law _ _ _ + rw [hlabel] + exact factorization_constant_label law _ _ _ + +theorem conditionalCompletionLaw_program_factorization (S : FlaggedTensor X Y Z) + (p : Program (Leaf S) (Coordinate X Y Z) Color Code depth) + (context_eq : ∀ a, p.context a = leafColor S a) + (view_eq : ∀ side a, p.view side a = coordinate a.val side) + (center output : Color) + (pc : FiniteLaw (ColorSlice S center)) (po : FiniteLaw (ColorSlice S output)) + (α : ℝ) (hα : 0 ≤ α) (hα' : α < 1) (hbranch : center ≠ output ∨ α = 0) + (hm : 0 < m) + (hcommon : ownerPair center output = .yz → ∀ x, + (pc.map (fun a => a.val.val.1)).mass x = + (po.map (fun a => a.val.val.1)).mass x) + (hc : ∀ n : Fin depth, p.pair n.val = .yz → + ConditionalMassFactorization pc (fun a => labelRecordOf p.labels n.val a.val) + (fun a => p.labels n.val a.val) (fun a => a.val.val.1)) + (ho : ∀ n : Fin depth, p.pair n.val = .yz → + ConditionalMassFactorization po (fun a => labelRecordOf p.labels n.val a.val) + (fun a => p.labels n.val a.val) (fun a => a.val.val.1)) + (n : Fin (3 + m * depth)) + (hpair : (completionLocalProgram S center m p context_eq view_eq).pair n.val = .yz) : + ConditionalMassFactorization + (conditionalCompletionLaw S center output pc po m hm α hα hα') + (fun a => labelRecordOf + (completionLocalProgram S center m p context_eq view_eq).labels n.val a.val) + (fun a => (completionLocalProgram S center m p context_eq view_eq).labels n.val a.val) + (fun a => a.val.val.1) := by + by_cases hn : n.val < 3 + · exact conditionalCompletionLaw_root_factorization S p context_eq view_eq + center output pc po α hα hα' hm n.val hn hcommon hpair + · obtain ⟨hd, hnm, hdecomp⟩ := completion_index_decomposition n.isLt hn + let i : Fin m := ⟨(n.val - 3) / depth, (Nat.div_lt_iff_lt_mul hd).mpr hnm⟩ + let k : ℕ := (n.val - 3) % depth + have hk : k < depth := Nat.mod_lt _ hd + have hsplit : n.val = 3 + (i.val * depth + k) := hdecomp + rw [hsplit, completionLocalProgram_pair_slot S center m p context_eq view_eq i k hk] at hpair + apply mass_factorization_of_same_partitions + (conditionalCompletionLaw S center output pc po m hm α hα hα') + (fun a => labelRecordOf + (completionLocalProgram S center m p context_eq view_eq).labels + (3 + (i.val * depth + k)) a.val) + (fun a => (completionLocalProgram S center m p context_eq view_eq).labels + (3 + (i.val * depth + k)) a.val) + (fun a => a.val.val.1) + · intro a b + simp only [labelRecordOf_eq_iff, ← hsplit] + · intro a b + simp only [← hsplit] + · intro a b + rfl + · exact conditionalCompletionLaw_inherited_factorization + S p context_eq view_eq center output pc po α hα hα' hbranch hm i k hk + (hc ⟨k, hk⟩ hpair) (ho ⟨k, hk⟩ hpair) + +end MatrixMultiplication.DualProgramIndependence + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/Duality/ScriptIndependence.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/Duality/ScriptIndependence.lean new file mode 100644 index 0000000000000000000000000000000000000000..73f2372d163ec90078dbed9750dc07cd50d1c188 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/Duality/ScriptIndependence.lean @@ -0,0 +1,119 @@ +import OAI.LinearAlgebra.MatrixMultiplication.Duality.RootIndependence +import OAI.LinearAlgebra.MatrixMultiplication.Duality.UniformInstances +import OAI.LinearAlgebra.MatrixMultiplication.Entropy.BaseConditionalReaders + +namespace OAI + +/-! Dual matrix multiplication exponents and finite rectangular constructions. -/ + +noncomputable section + +namespace MatrixMultiplication.DualProgramIndependence + +universe u w + +open MatrixMultiplication.Foundation RecursiveCompletion CompletionLabels +open CompletionColorLaws DualCompletionLaws DualInformation TopologicalFlatten DualUniform + +attribute [local instance 10000] Classical.propDecidable Classical.decEq +attribute [local instance 11000] instDecidableEqFin + +variable {X Y Z : Type u} {Code : Type w} [Fintype X] [Fintype Y] [Fintype Z] + [Fintype Code] [Inhabited Code] {depth m : ℕ} + +theorem minusLaws_independent (S : FlaggedTensor X Y Z) (r : ReadableTensor S) + (p : Laws S) (m : ℕ) (hm : 0 < m) (rho : ℝ) + (hrho0 : 0 < rho) (hrho1 : rho < 1) (h : ProgramLawsIndependent S r p) : + ProgramLawsIndependent (complete S .B m) (ReadableTensor.raise S r .B m) + (minusLaws S p m hm rho hrho0 hrho1) := by + intro c n hn + cases c + · exact conditionalCompletionLaw_program_factorization S r.program r.context_eq r.view_eq + .B .B (p .B) (p .B) 0 (le_refl 0) zero_lt_one (Or.inr rfl) hm + (by intro hh; simp [ownerPair] at hh) (h .B) (h .B) n hn + · exact conditionalCompletionLaw_program_factorization S r.program r.context_eq r.view_eq + .B .A (p .B) (p .A) rho hrho0.le hrho1 (Or.inl (by intro he; cases he)) hm + (by intro hh; simp [ownerPair] at hh) (h .B) (h .A) n hn + · exact conditionalCompletionLaw_program_factorization S r.program r.context_eq r.view_eq + .B .C (p .B) (p .C) rho hrho0.le hrho1 (Or.inl (by intro he; cases he)) hm + (by intro hh; simp [ownerPair] at hh) (h .B) (h .C) n hn + +theorem plusALaws_independent (S : FlaggedTensor X Y Z) (r : ReadableTensor S) + (p : Laws S) (m : ℕ) (hm : 0 < m) (rho hA hC : ℝ) + (hrho0 : 0 < rho) (hrho1 : rho < 1) (h : ProgramLawsIndependent S r p) + (hu : UniformLaws S p) : + ProgramLawsIndependent (complete S .A m) (ReadableTensor.raise S r .A m) + (plusALaws S p m hm rho hA hC hrho0 hrho1) := by + intro c n hn + cases c + · exact conditionalCompletionLaw_program_factorization S r.program r.context_eq r.view_eq + .A .B (p .A) (p .B) (1-rho) (sub_nonneg.mpr hrho1.le) (sub_lt_self 1 hrho0) + (Or.inl (by intro he; cases he)) hm (by intro hh; simp [ownerPair] at hh) (h .A) (h .B) n hn + · exact conditionalCompletionLaw_program_factorization S r.program r.context_eq r.view_eq + .A .A (p .A) (p .A) 0 (le_refl 0) zero_lt_one (Or.inr rfl) hm + (by intro hh; simp [ownerPair] at hh) (h .A) (h .A) n hn + · exact conditionalCompletionLaw_program_factorization S r.program r.context_eq r.view_eq + .A .C (p .A) (p .C) (gibbsWeight hA hC) + (gibbsWeight_nonneg hA hC) (gibbsWeight_lt_one hA hC) (Or.inl (by intro he; cases he)) hm + (fun _ x => (hu.A x).trans (hu.C x).symm) (h .A) (h .C) n hn + +theorem plusCLaws_independent (S : FlaggedTensor X Y Z) (r : ReadableTensor S) + (p : Laws S) (m : ℕ) (hm : 0 < m) (rho hA hC : ℝ) + (hrho0 : 0 < rho) (hrho1 : rho < 1) (h : ProgramLawsIndependent S r p) + (hu : UniformLaws S p) : + ProgramLawsIndependent (complete S .C m) (ReadableTensor.raise S r .C m) + (plusCLaws S p m hm rho hA hC hrho0 hrho1) := by + intro c n hn + cases c + · exact conditionalCompletionLaw_program_factorization S r.program r.context_eq r.view_eq + .C .B (p .C) (p .B) (1-rho) (sub_nonneg.mpr hrho1.le) (sub_lt_self 1 hrho0) + (Or.inl (by intro he; cases he)) hm (by intro hh; simp [ownerPair] at hh) (h .C) (h .B) n hn + · exact conditionalCompletionLaw_program_factorization S r.program r.context_eq r.view_eq + .C .A (p .C) (p .A) (gibbsWeight hC hA) + (gibbsWeight_nonneg hC hA) (gibbsWeight_lt_one hC hA) (Or.inl (by intro he; cases he)) hm + (fun _ x => (hu.C x).trans (hu.A x).symm) (h .C) (h .A) n hn + · exact conditionalCompletionLaw_program_factorization S r.program r.context_eq r.view_eq + .C .C (p .C) (p .C) 0 (le_refl 0) zero_lt_one (Or.inr rfl) hm + (by intro hh; simp [ownerPair] at hh) (h .C) (h .C) n hn + +abbrev dualReadable (s : Script) := + ReadableTensor.script BaseTwo.flagged BaseConditionalReaders.baseTwoReadable s + +theorem base_independent : ProgramLawsIndependent BaseTwo.flagged + BaseConditionalReaders.baseTwoReadable baseLaws := by + intro c n + exact Fin.elim0 n + +theorem laws2_independent : ProgramLawsIndependent (Script.tensor BaseTwo.flagged script2) + (dualReadable script2) laws2 := + minusLaws_independent _ _ _ _ _ _ _ _ base_independent + +theorem laws4_independent : ProgramLawsIndependent (Script.tensor BaseTwo.flagged script4) + (dualReadable script4) laws4 := + plusALaws_independent _ _ _ _ _ _ _ _ _ _ laws2_independent laws2_uniform + +theorem laws8_independent : ProgramLawsIndependent (Script.tensor BaseTwo.flagged script8) + (dualReadable script8) laws8 := + plusCLaws_independent _ _ _ _ _ _ _ _ _ _ laws4_independent laws4_uniform + +theorem laws24_independent : ProgramLawsIndependent (Script.tensor BaseTwo.flagged script24) + (dualReadable script24) laws24 := + minusLaws_independent _ _ _ _ _ _ _ _ laws8_independent + +theorem laws48_independent : ProgramLawsIndependent (Script.tensor BaseTwo.flagged script48) + (dualReadable script48) laws48 := + plusCLaws_independent _ _ _ _ _ _ _ _ _ _ laws24_independent laws24_uniform + +theorem laws96_independent : ProgramLawsIndependent (Script.tensor BaseTwo.flagged script96) + (dualReadable script96) laws96 := + minusLaws_independent _ _ _ _ _ _ _ _ laws48_independent + +theorem laws288_independent : ProgramLawsIndependent (Script.tensor BaseTwo.flagged Script.dual) + (dualReadable Script.dual) laws288 := + plusALaws_independent _ _ _ _ _ _ _ _ _ _ laws96_independent laws96_uniform + +end MatrixMultiplication.DualProgramIndependence + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/Duality/TerminationIndependence.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/Duality/TerminationIndependence.lean new file mode 100644 index 0000000000000000000000000000000000000000..6701a02775f0f31509fa0009d017b41fc48e2ab9 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/Duality/TerminationIndependence.lean @@ -0,0 +1,168 @@ +import OAI.LinearAlgebra.MatrixMultiplication.Duality.ProgramIndependence +import OAI.LinearAlgebra.MatrixMultiplication.Completion.ProgramPrefixes +import OAI.LinearAlgebra.MatrixMultiplication.Completion.TerminationLaw +import OAI.LinearAlgebra.MatrixMultiplication.Duality.InformationTransport + +namespace OAI + +/-! Dual matrix multiplication exponents and finite rectangular constructions. -/ + +noncomputable section + +namespace MatrixMultiplication.DualProgramIndependence + +open MatrixMultiplication.Foundation CompletionLabels CompletionLabels.TopologicalFlatten +open CompletionColorLaws DualInformation DualInformationTransport +attribute [local instance 10000] Classical.propDecidable Classical.decEq +attribute [local instance 11000] instDecidableEqFin + +universe u w +variable {X Y Z : Type u} [Fintype X] [Fintype Y] [Fintype Z] + {Code : Type w} [Fintype Code] [Inhabited Code] {depth : ℕ} + +omit [Fintype X] [Fintype Y] [Fintype Z] [Fintype Code] in +theorem termination_label_succ (S : FlaggedTensor X Y Z) (first second : Color) + (hne : first ≠ second) + (p : Program (Leaf S) (Coordinate X Y Z) Color Code depth) + (hcontext : ∀ a, p.context a = leafColor S a) + (hview : ∀ c a, p.view c a = coordinate a.val c) + (k : ℕ) (a : RetainedLeaf S first second) : + (terminationProgram S first second hne p hcontext hview).labels (1 + k) a = + Sum.inr (p.labels k a.val) := by + exact Program.append_labels_right _ _ _ _ _ k a + +omit [Fintype X] [Fintype Y] [Fintype Z] [Fintype Code] in +theorem termination_pair_succ (S : FlaggedTensor X Y Z) (first second : Color) + (hne : first ≠ second) + (p : Program (Leaf S) (Coordinate X Y Z) Color Code depth) + (hcontext : ∀ a, p.context a = leafColor S a) + (hview : ∀ c a, p.view c a = coordinate a.val c) (k : ℕ) : + (terminationProgram S first second hne p hcontext hview).pair (1 + k) = p.pair k := by + simp [terminationProgram, Program.append, Program.recode, terminationInherited, + Program.pullback] + +omit [Fintype X] [Fintype Y] [Fintype Z] [Fintype Code] in +theorem termination_record_eq_iff (S : FlaggedTensor X Y Z) (first second : Color) + (hne : first ≠ second) + (p : Program (Leaf S) (Coordinate X Y Z) Color Code depth) + (hcontext : ∀ a, p.context a = leafColor S a) + (hview : ∀ c a, p.view c a = coordinate a.val c) + (k : ℕ) (a b : RetainedLeaf S first second) : + labelRecordOf (terminationProgram S first second hne p hcontext hview).labels (1 + k) a = + labelRecordOf (terminationProgram S first second hne p hcontext hview).labels (1 + k) b ↔ + leafColor S a.val = leafColor S b.val ∧ + labelRecordOf p.labels k a.val = labelRecordOf p.labels k b.val := by + trans + (labelRecordOf (terminationRoot S first second hne).labels 1 a = + labelRecordOf (terminationRoot S first second hne).labels 1 b ∧ + labelRecordOf (terminationInherited S first second p hview).labels k a = + labelRecordOf (terminationInherited S first second p hview).labels k b) + · exact (Program.append_record_eq_iff _ _ _ _ _ k a b).trans + (and_congr + (Program.recode_record_eq_iff _ _ _ _ 1 a b) + (Program.recode_record_eq_iff _ _ _ _ k a b)) + simp only [terminationRoot, Program.single, labelRecordOf, + terminationInherited, Program.pullback] + have hpull (v : RetainedLeaf S first second) : + labelRecordOf (fun n (b : RetainedLeaf S first second) => p.labels n b.val) k v = + labelRecordOf p.labels k v.val := by + induction k with + | zero => rfl + | succ k ih => simp only [labelRecordOf, ih]; rfl + rw [hpull a, hpull b] + constructor + · rintro ⟨he, hr⟩ + exact ⟨congrArg Prod.snd he, hr⟩ + · rintro ⟨he, hr⟩ + refine ⟨?_, hr⟩ + rw [he] + +theorem termination_factorization (S : FlaggedTensor X Y Z) (r : ReadableTensor S) + (p : ∀ c, FiniteLaw (ColorSlice S c)) (a : ℝ) (ha : 0 ≤ a) (ha' : a ≤ 1) + (h : ProgramLawsIndependent S r p) (k : Fin r.depth) + (hk : r.program.pair k.val = .yz) : + ConditionalMassFactorization + (CompletionTerminationLaw.law S .B .C (p .B) (p .C) a ha ha') + (labelRecordOf (terminationProgram S .B .C (by intro h; cases h) + r.program r.context_eq r.view_eq).labels (1 + k.val)) + ((terminationProgram S .B .C (by intro h; cases h) + r.program r.context_eq r.view_eq).labels (1 + k.val)) + (fun w => w.val.val.1) := by + let μ := CompletionTerminationLaw.law S .B .C (p .B) (p .C) a ha ha' + let q := colorMix S .B .C (p .B) (p .C) a ha ha' + let prior := labelRecordOf r.program.labels k.val + let label := r.program.labels k.val + let xx : Leaf S → X := fun w => w.val.1 + have hq : ConditionalMassFactorization q (fun w => (leafColor S w, prior w)) label xx := + colorMix_factorization S .B .C (by intro h; cases h) (p .B) (p .C) a ha ha' + prior label xx (h .B k hk) (h .C k hk) + have hmass : (μ.map Subtype.val).mass = q.mass := by + funext w + exact (CompletionTerminationLaw.law_map_mass S .B .C (p .B) (p .C) + a ha ha' id w).trans (q.map_mass_apply id Function.injective_id w) + have hmapped : ConditionalMassFactorization (μ.map Subtype.val) + (fun w => (leafColor S w, prior w)) label xx := + (mass_factorization_congr_mass_iff (μ.map Subtype.val) q hmass _ _ _).mpr hq + have hμ := (mass_factorization_map_iff μ Subtype.val + (fun w => (leafColor S w, prior w)) label xx).mp hmapped + apply mass_factorization_of_same_partitions μ + (fun w => (leafColor S w.val, prior w.val)) + (fun w => label w.val) (fun w => xx w.val) + (labelRecordOf (terminationProgram S .B .C (by intro h; cases h) + r.program r.context_eq r.view_eq).labels (1 + k.val)) + ((terminationProgram S .B .C (by intro h; cases h) + r.program r.context_eq r.view_eq).labels (1 + k.val)) + (fun w => w.val.val.1) ?_ ?_ ?_ hμ + · intro u v + simp only [Prod.mk.injEq] + exact (termination_record_eq_iff S .B .C (by intro h; cases h) + r.program r.context_eq r.view_eq k.val u v).symm + · intro u v + simp only [termination_label_succ, Sum.inr.injEq] + rfl + · intro u v + rfl + +theorem termination_independent (S : FlaggedTensor X Y Z) (r : ReadableTensor S) + (p : ∀ c, FiniteLaw (ColorSlice S c)) (a : ℝ) (ha : 0 ≤ a) (ha' : a ≤ 1) + (h : ProgramLawsIndependent S r p) + (n : Fin (1 + r.depth)) + (hn : (terminationProgram S .B .C (by intro h; cases h) + r.program r.context_eq r.view_eq).pair n.val = .yz) : + ConditionalIndependent + (CompletionTerminationLaw.law S .B .C (p .B) (p .C) a ha ha') + (labelRecordOf (terminationProgram S .B .C (by intro h; cases h) + r.program r.context_eq r.view_eq).labels n.val) + ((terminationProgram S .B .C (by intro h; cases h) + r.program r.context_eq r.view_eq).labels n.val) + (fun w => w.val.val.1) := by + rcases n with ⟨n, hnd⟩ + cases n with + | zero => + simp [terminationProgram, Program.append, Program.recode, + terminationRoot, Program.single, ownerPair] at hn + | succ k => + have hkd : k < r.depth := Nat.lt_of_succ_lt_succ + (by simpa only [Nat.one_add] using hnd) + simp only [Fin.val_mk] at hn ⊢ + simp only [Nat.add_comm k 1] at hn + have hk : r.program.pair k = .yz := + (termination_pair_succ S .B .C (by intro h; cases h) + r.program r.context_eq r.view_eq k).symm.trans hn + apply conditionalIndependent_of_mass_factorization + let labels := (terminationProgram S .B .C (by intro h; cases h) + r.program r.context_eq r.view_eq).labels + have hf := termination_factorization S r p a ha ha' h ⟨k, hkd⟩ hk + exact Eq.mp + (congrArg + (fun n : ℕ => ConditionalMassFactorization + (CompletionTerminationLaw.law S .B .C (p .B) (p .C) a ha ha') + (labelRecordOf labels n) (labels n) (fun w => w.val.val.1)) + (Nat.one_add k)) + hf + +end MatrixMultiplication.DualProgramIndependence + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/Duality/Uniform.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/Duality/Uniform.lean new file mode 100644 index 0000000000000000000000000000000000000000..6fd96c6b7a290aef08a86c134af4e28d9bed7281 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/Duality/Uniform.lean @@ -0,0 +1,152 @@ +import OAI.LinearAlgebra.MatrixMultiplication.Duality.CompletionLaws +import OAI.LinearAlgebra.MatrixMultiplication.Duality.UniformUpdates +import OAI.LinearAlgebra.MatrixMultiplication.Duality.UniformMixtures +import OAI.LinearAlgebra.MatrixMultiplication.Completion.Partitions + +namespace OAI + +/-! Dual matrix multiplication exponents and finite rectangular constructions. -/ + +noncomputable section +universe uCoord +namespace MatrixMultiplication.DualUniform + +open MatrixMultiplication.Foundation RecursiveCompletion CompletionLabels CompletionColorLaws +open CompletionLaws DualCompletionLaws DualUniformConditioning DualUniformUpdates +open DualUniformMixtures CompletionPartitions +open scoped BigOperators +attribute [local instance 10000] Classical.propDecidable Classical.decEq +attribute [local instance 11000] instDecidableEqFin + +variable {X Y Z : Type uCoord} [Fintype X] [Fintype Y] [Fintype Z] + +structure UniformLaws (S : FlaggedTensor X Y Z) (p : Laws S) : Prop where + B : UniformCoordinate (p .B) (fun a => a.val.val.1) S.flagB + A : UniformCoordinate (p .A) (fun a => a.val.val.1) (fun x => ¬ S.flagB x) + C : UniformCoordinate (p .C) (fun a => a.val.val.1) (fun x => ¬ S.flagB x) + +theorem UniformLaws.color (S : FlaggedTensor X Y Z) (p : Laws S) + (h : UniformLaws S p) (c : Color) : + UniformCoordinate (p c) (fun a => a.val.val.1) + (fun x => if c = .B then S.flagB x else ¬ S.flagB x) := by + cases c + · simpa using h.B + · simpa using h.A + · simpa using h.C + +theorem UniformLaws.entropy_B (S : FlaggedTensor X Y Z) (p : Laws S) + (h : UniformLaws S p) : + finiteEntropy ((p .B).map (fun a => a.val.val.1)).mass = Real.log (activeCount S) := + uniform_coordinate_entropy (p .B) _ _ h.B + +theorem UniformLaws.entropy_A (S : FlaggedTensor X Y Z) (p : Laws S) + (h : UniformLaws S p) : + finiteEntropy ((p .A).map (fun a => a.val.val.1)).mass = Real.log (inactiveCount S) := + uniform_coordinate_entropy (p .A) _ _ h.A + +theorem UniformLaws.entropy_C (S : FlaggedTensor X Y Z) (p : Laws S) + (h : UniformLaws S p) : + finiteEntropy ((p .C).map (fun a => a.val.val.1)).mass = Real.log (inactiveCount S) := + uniform_coordinate_entropy (p .C) _ _ h.C + +theorem conditionalCompletionLaw_uniform_common + (S : FlaggedTensor X Y Z) (center output : Color) + (pc : FiniteLaw (ColorSlice S center)) (po : FiniteLaw (ColorSlice S output)) + (m : ℕ) (hm : 0 < m) (α : ℝ) (hα : 0 ≤ α) (hα' : α < 1) + (P : X → Prop) + (hc : UniformCoordinate pc (fun a => a.val.val.1) P) + (ho : UniformCoordinate po (fun a => a.val.val.1) P) : + UniformCoordinate + (conditionalCompletionLaw S center output pc po m hm α hα hα') + (fun a => a.val.val.1) (fun x => ∀ i, P (x i)) := + conditionalCompletionLaw_uniform_independent S center output pc po m hm α hα hα' P + (colorMix_uniform_common S center output pc po α hα hα'.le P hc ho) + (colorMix_independent_uniform S center output pc po α hα hα'.le P hc ho) + +private theorem inactive_uniform_update + (S : FlaggedTensor X Y Z) (center output : Color) (hcenter : center ≠ .B) + (pc : FiniteLaw (ColorSlice S center)) (po : FiniteLaw (ColorSlice S output)) + (m : ℕ) (hm : 0 < m) (α : ℝ) (hα : 0 ≤ α) (hα' : α < 1) + (hc : UniformCoordinate pc (fun a => a.val.val.1) (fun x => ¬ S.flagB x)) + (ho : UniformCoordinate po (fun a => a.val.val.1) (fun x => ¬ S.flagB x)) : + UniformCoordinate + (conditionalCompletionLaw S center output pc po m hm α hα hα') + (fun a => a.val.val.1) (fun x => ¬ (complete S center m).flagB x) := by + apply uniform_coordinate_pred_congr _ _ (fun x => ∀ i, ¬ S.flagB (x i)) + · intro x + change (∀ i, ¬ S.flagB (x i)) ↔ ¬ raisedFlag center .B (fun i => S.flagB (x i)) + simp [raisedFlag, hcenter] + · exact conditionalCompletionLaw_uniform_common S center output pc po m hm α hα hα' + (fun x => ¬ S.flagB x) hc ho + +theorem minusLaws_uniform (S : FlaggedTensor X Y Z) (p : Laws S) + (m : ℕ) (hm : 0 < m) (rho : ℝ) (hrho0 : 0 < rho) (hrho1 : rho < 1) + (h : UniformLaws S p) (hrho : rho = activeFraction S) : + UniformLaws (complete S .B m) (minusLaws S p m hm rho hrho0 hrho1) := by + constructor + · exact conditionalCompletionLaw_uniform_common S .B .B (p .B) (p .B) m hm 0 + (by norm_num) (by norm_num) S.flagB h.B h.B + · have hu := conditionalCompletionLaw_uniform_incident S .B .A (Or.inl rfl) + (p .B) (p .A) m hm rho hrho0.le hrho1 + (colorMix_uniform_complement S .B .A (p .B) (p .A) rho hrho0.le hrho1.le + S.flagB h.B h.A hrho) + simpa only [minusLaws, reduceCtorEq, ite_false] using hu + · have hu := conditionalCompletionLaw_uniform_incident S .B .C (Or.inl rfl) + (p .B) (p .C) m hm rho hrho0.le hrho1 + (colorMix_uniform_complement S .B .C (p .B) (p .C) rho hrho0.le hrho1.le + S.flagB h.B h.C hrho) + simpa only [minusLaws, reduceCtorEq, ite_false] using hu + +theorem plusALaws_uniform (S : FlaggedTensor X Y Z) (p : Laws S) + (m : ℕ) (hm : 0 < m) (rho hA hC : ℝ) (hrho0 : 0 < rho) (hrho1 : rho < 1) + (h : UniformLaws S p) (hrho : rho = activeFraction S) : + UniformLaws (complete S .A m) (plusALaws S p m hm rho hA hC hrho0 hrho1) := by + constructor + · have hu := conditionalCompletionLaw_uniform_incident S .A .B (Or.inr rfl) + (p .A) (p .B) m hm (1-rho) (sub_nonneg.mpr hrho1.le) (by linarith) + (colorMix_uniform_complement_reverse S .A .B (p .A) (p .B) rho + (sub_nonneg.mpr hrho1.le) (by linarith) S.flagB h.A h.B hrho) + simpa only [plusALaws, ite_eq_left rfl, ite_true] using hu + · exact inactive_uniform_update S .A .A (by intro h; cases h) (p .A) (p .A) m hm 0 + (by norm_num) (by norm_num) h.A h.A + · exact inactive_uniform_update S .A .C (by intro h; cases h) (p .A) (p .C) m hm + (gibbsWeight hA hC) (gibbsWeight_nonneg hA hC) (gibbsWeight_lt_one hA hC) h.A h.C + +theorem plusCLaws_uniform (S : FlaggedTensor X Y Z) (p : Laws S) + (m : ℕ) (hm : 0 < m) (rho hA hC : ℝ) (hrho0 : 0 < rho) (hrho1 : rho < 1) + (h : UniformLaws S p) (hrho : rho = activeFraction S) : + UniformLaws (complete S .C m) (plusCLaws S p m hm rho hA hC hrho0 hrho1) := by + constructor + · have hu := conditionalCompletionLaw_uniform_incident S .C .B (Or.inr rfl) + (p .C) (p .B) m hm (1-rho) (sub_nonneg.mpr hrho1.le) (by linarith) + (colorMix_uniform_complement_reverse S .C .B (p .C) (p .B) rho + (sub_nonneg.mpr hrho1.le) (by linarith) S.flagB h.C h.B hrho) + simpa only [plusCLaws, ite_eq_left rfl, ite_true] using hu + · exact inactive_uniform_update S .C .A (by intro h; cases h) (p .C) (p .A) m hm + (gibbsWeight hC hA) (gibbsWeight_nonneg hC hA) (gibbsWeight_lt_one hC hA) h.C h.A + · exact inactive_uniform_update S .C .C (by intro h; cases h) (p .C) (p .C) m hm 0 + (by norm_num) (by norm_num) h.C h.C + +private theorem pure_map_mass {A U : Type*} [Fintype A] [Fintype U] + (a : A) (f : A → U) (x : U) : + ((FiniteLaw.pure a).map f).mass x = if f a = x then 1 else 0 := by + rw [FiniteLaw.map_mass, Finset.sum_eq_single a] + · simp [FiniteLaw.pure] + · intro b _ hb + simp [FiniteLaw.pure, hb] + · simp + +theorem baseLaws_uniform : UniformLaws BaseTwo.flagged baseLaws := by + have hc : Fintype.card {x // BaseTwo.flagged.flagB x} = 1 := by + exact @Fintype.card_subtype_eq (Fin 2) 1 + (inferInstanceAs (Fintype {x // BaseTwo.flagged.flagB x})) + constructor <;> intro x <;> rw [baseLaws, pure_map_mass] <;> + fin_cases x <;> + norm_num [baseLeaf, BaseTwo.flagged, BaseTwo.flagB, Fintype.card_subtype_compl] + all_goals rw [hc] + +end MatrixMultiplication.DualUniform + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/Duality/UniformConditioning.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/Duality/UniformConditioning.lean new file mode 100644 index 0000000000000000000000000000000000000000..2cc013940b477f6323952f8286cfbefdff699598 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/Duality/UniformConditioning.lean @@ -0,0 +1,146 @@ +import OAI.LinearAlgebra.MatrixMultiplication.Completion.ColorLaws +import OAI.LinearAlgebra.MatrixMultiplication.Entropy.IndependentConditioning +import OAI.LinearAlgebra.MatrixMultiplication.Duality.EntropyHelpers + +namespace OAI + +/-! Dual matrix multiplication exponents and finite rectangular constructions. -/ + +noncomputable section +universe uCoord +namespace MatrixMultiplication.DualUniformConditioning + +open MatrixMultiplication.Foundation RecursiveCompletion CompletionLabels CompletionColorLaws +open CompletionLaws CompletionProductLaws DualEntropyHelpers +open scoped BigOperators +attribute [local instance 10000] Classical.propDecidable Classical.decEq +attribute [local instance 11000] instDecidableEqFin + +variable {A : Type*} {X Y Z : Type uCoord} [Fintype A] [Fintype X] [Fintype Y] [Fintype Z] + +theorem eventMass_congr_support (p : FiniteLaw A) (P Q : A → Prop) + (h : ∀ a, p.mass a ≠ 0 → (P a ↔ Q a)) : eventMass p P = eventMass p Q := by + rw [eventMass, eventMass, sum_subtype_indicator, sum_subtype_indicator] + apply Finset.sum_congr rfl + intro a _ + by_cases ha : p.mass a = 0 + · simp [ha] + · rw [h a ha] + +theorem condition_map_mass_congr_support (p : FiniteLaw A) (P Q : A → Prop) + (h : ∀ a, p.mass a ≠ 0 → (P a ↔ Q a)) + (hP : 0 < eventMass p P) (hQ : 0 < eventMass p Q) (f : A → X) (x : X) : + ((condition p P hP).map (fun a => f a.val)).mass x = + ((condition p Q hQ).map (fun a => f a.val)).mass x := by + rw [condition_map_mass, condition_map_mass, eventMass_congr_support p P Q h] + congr 1 + rw [sum_subtype_indicator P (fun a => if f a = x then p.mass a else 0), + sum_subtype_indicator Q (fun a => if f a = x then p.mass a else 0)] + apply Finset.sum_congr rfl + intro a _ + by_cases ha : p.mass a = 0 + · simp [ha] + · rw [h a ha] + +theorem uniform_coordinate_pred_congr (p : FiniteLaw A) (f : A → X) + (P Q : X → Prop) (h : ∀ x, P x ↔ Q x) (hp : UniformCoordinate p f P) : + UniformCoordinate p f Q := by + have he : P = Q := funext (fun x => propext (h x)) + simpa only [he] using hp + +theorem uniform_coordinate_condition_positive (p : FiniteLaw A) (f : A → X) + (P Q : X → Prop) (h : UniformCoordinate p f P) + (hevent : 0 < eventMass p (fun a => Q (f a))) : + UniformCoordinate (condition p (fun a => Q (f a)) hevent) + (fun a => f a.val) (fun x => P x ∧ Q x) := by + have hratio := hevent + rw [uniform_coordinate_eventMass p f P Q h] at hratio + have hPQ : 0 < Fintype.card {x // P x ∧ Q x} := by + by_contra hn + have hz : Fintype.card {x // P x ∧ Q x} = 0 := Nat.eq_zero_of_not_pos hn + simp [hz] at hratio + have hP : 0 < Fintype.card {x // P x} := by + by_contra hn + have hz : Fintype.card {x // P x} = 0 := Nat.eq_zero_of_not_pos hn + simp [hz] at hratio + exact (uniform_coordinate_condition p f P Q h hP hPQ).choose_spec + +theorem uniform_coordinate_condition_supported (p : FiniteLaw A) (f : A → X) + (P Q : X → Prop) (E : A → Prop) (h : UniformCoordinate p f P) + (heq : ∀ a, p.mass a ≠ 0 → (E a ↔ Q (f a))) + (hevent : 0 < eventMass p E) : + UniformCoordinate (condition p E hevent) (fun a => f a.val) + (fun x => P x ∧ Q x) := by + have hQ : 0 < eventMass p (fun a => Q (f a)) := by + rwa [← eventMass_congr_support p E (fun a => Q (f a)) heq] + have hu := uniform_coordinate_condition_positive p f P Q h hQ + intro x + rw [condition_map_mass_congr_support p E (fun a => Q (f a)) heq hevent hQ] + exact hu x + +theorem conditionalCompletionLaw_X_mass + (S : FlaggedTensor X Y Z) (center output : Color) + (pc : FiniteLaw (ColorSlice S center)) (po : FiniteLaw (ColorSlice S output)) + (m : ℕ) (hm : 0 < m) (α : ℝ) (hα : 0 ≤ α) (hα' : α < 1) + (x : Fin m → X) : + ((conditionalCompletionLaw S center output pc po m hm α hα hα').map + (fun a => a.val.val.1)).mass x = + ((condition (iidColorLaw S center output pc po m α hα hα'.le) + (completionEvent S center output m) + (completionEvent_mass_pos S center output pc po m hm α hα hα')).map + (fun w i => (w.val i).val.1)).mass x := by + unfold conditionalCompletionLaw transport + rw [map_comp_mass] + rfl + +theorem iidColorLaw_allowed + (S : FlaggedTensor X Y Z) (center output : Color) + (pc : FiniteLaw (ColorSlice S center)) (po : FiniteLaw (ColorSlice S output)) + (m : ℕ) (α : ℝ) (hα : 0 ≤ α) (hα' : α ≤ 1) + (w : Fin m → Leaf S) + (hw : (iidColorLaw S center output pc po m α hα hα').mass w ≠ 0) : + ∀ i, leafColor S (w i) = center ∨ leafColor S (w i) = output := by + intro i + by_contra h + have hc : leafColor S (w i) ≠ center := fun hc => h (Or.inl hc) + have ho : leafColor S (w i) ≠ output := fun ho => h (Or.inr ho) + have hz := colorMix_mass_zero S center output pc po α hα hα' (w i) hc ho + rw [iidColorLaw, independentProduct_mass] at hw + exact ((Finset.prod_ne_zero_iff.mp hw) i (Finset.mem_univ i)) hz + +omit [Fintype X] [Fintype Y] [Fintype Z] in +theorem completionEvent_outputB (S : FlaggedTensor X Y Z) (center : Color) + (m : ℕ) (w : Fin m → Leaf S) + (ha : ∀ i, leafColor S (w i) = center ∨ leafColor S (w i) = .B) : + completionEvent S center .B m w ↔ + (complete S center m).flagB (fun i => (w i).val.1) := by + have heq : (fun i => leafColor S (w i) = .B) = + (fun i => S.flagB (w i).val.1) := by + funext i + exact propext (leafColor_eq_iff S (w i) .B) + simp only [completionEvent, ha, forall_true_iff, and_true, heq] + rfl + +omit [Fintype X] [Fintype Y] [Fintype Z] in +theorem completionEvent_centerB (S : FlaggedTensor X Y Z) (output : Color) + (ho : output ≠ .B) (m : ℕ) (w : Fin m → Leaf S) + (ha : ∀ i, leafColor S (w i) = .B ∨ leafColor S (w i) = output) : + completionEvent S .B output m w ↔ + ¬ (complete S .B m).flagB (fun i => (w i).val.1) := by + change (raisedFlag .B output (fun i => leafColor S (w i) = output) ∧ _) ↔ + ¬ raisedFlag .B .B (fun i => S.flagB (w i).val.1) + simp only [raisedFlag, ite_eq_right ho.symm, ite_true, ha, forall_true_iff, and_true] + constructor + · rintro ⟨i, hi⟩ hall + have hb := (leafColor_eq_iff S (w i) .B).mpr (hall i) + exact ho (hi.symm.trans hb) + · intro hn + obtain ⟨i, hi⟩ := not_forall.mp hn + refine ⟨i, (ha i).resolve_left ?_⟩ + exact fun hb => hi ((leafColor_eq_iff S (w i) .B).mp hb) + +end MatrixMultiplication.DualUniformConditioning + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/Duality/UniformInstances.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/Duality/UniformInstances.lean new file mode 100644 index 0000000000000000000000000000000000000000..47d07e850d97c3be0c5a57bf90c35b09fd89b015 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/Duality/UniformInstances.lean @@ -0,0 +1,121 @@ +import OAI.LinearAlgebra.MatrixMultiplication.Duality.Uniform + +namespace OAI + +/-! Dual matrix multiplication exponents and finite rectangular constructions. -/ + +noncomputable section +namespace MatrixMultiplication.DualUniform + +open MatrixMultiplication.Foundation RecursiveCompletion CompletionLabels CompletionColorLaws +open CompletionLaws DualCompletionLaws CompletionPartitions +attribute [local instance 10000] Classical.propDecidable Classical.decEq +attribute [local instance 11000] instDecidableEqFin + +private theorem coord_nonempty (s : Script) : Nonempty (Script.Coord (Fin 2) s) := by + induction s with + | base => exact inferInstanceAs (Nonempty (Fin 2)) + | step prior center m ih => + let _ := ih + exact inferInstanceAs (Nonempty (Fin m → Script.Coord (Fin 2) prior)) +attribute [local instance] coord_nonempty + +theorem base_activeFraction : activeFraction BaseTwo.flagged = (1/2 : ℝ) := by + have hc : activeCount BaseTwo.flagged = 1 := + @Fintype.card_subtype_eq (Fin 2) 1 + (inferInstanceAs (Fintype {x // BaseTwo.flagged.flagB x})) + rw [activeFraction, hc] + norm_num + +theorem rho2 : activeFraction (Script.tensor BaseTwo.flagged script2) = + DualWitness.state2.rho := by + change activeFraction (complete BaseTwo.flagged .B 2) = _ + rw [activeFraction_minus, base_activeFraction] + rfl + +theorem rho4 : activeFraction (Script.tensor BaseTwo.flagged script4) = + DualWitness.state4.rho := by + change activeFraction (complete (Script.tensor BaseTwo.flagged script2) .A 2) = _ + rw [activeFraction_plus _ .A (by intro h; cases h), rho2] + rfl + +theorem rho8 : activeFraction (Script.tensor BaseTwo.flagged script8) = + DualWitness.state8.rho := by + change activeFraction (complete (Script.tensor BaseTwo.flagged script4) .C 2) = _ + rw [activeFraction_plus _ .C (by intro h; cases h), rho4] + rfl + +theorem rho24 : activeFraction (Script.tensor BaseTwo.flagged script24) = + DualWitness.state24.rho := by + change activeFraction (complete (Script.tensor BaseTwo.flagged script8) .B 3) = _ + rw [activeFraction_minus, rho8] + rfl + +theorem rho48 : activeFraction (Script.tensor BaseTwo.flagged script48) = + DualWitness.state48.rho := by + change activeFraction (complete (Script.tensor BaseTwo.flagged script24) .C 2) = _ + rw [activeFraction_plus _ .C (by intro h; cases h), rho24] + rfl + +theorem rho96 : activeFraction (Script.tensor BaseTwo.flagged script96) = + DualWitness.state96.rho := by + change activeFraction (complete (Script.tensor BaseTwo.flagged script48) .B 2) = _ + rw [activeFraction_minus, rho48] + rfl + +theorem rho288 : activeFraction (Script.tensor BaseTwo.flagged Script.dual) = + DualWitness.state288.rho := by + change activeFraction (complete (Script.tensor BaseTwo.flagged script96) .A 3) = _ + rw [activeFraction_plus _ .A (by intro h; cases h), rho96] + rfl + +theorem laws2_uniform : UniformLaws (Script.tensor BaseTwo.flagged script2) laws2 := + minusLaws_uniform BaseTwo.flagged baseLaws 2 (Nat.zero_lt_succ _) (1/2) (by norm_num) + (by norm_num) baseLaws_uniform base_activeFraction.symm + +theorem laws4_uniform : UniformLaws (Script.tensor BaseTwo.flagged script4) laws4 := + plusALaws_uniform _ laws2 2 (Nat.zero_lt_succ _) + DualWitness.state2.rho DualWitness.state2.hA DualWitness.state2.hC + (by norm_num [DualWitness.state2, DualWitness.initial, DualWitness.minus]) + (by norm_num [DualWitness.state2, DualWitness.initial, DualWitness.minus]) + laws2_uniform rho2.symm + +theorem laws8_uniform : UniformLaws (Script.tensor BaseTwo.flagged script8) laws8 := + plusCLaws_uniform _ laws4 2 (Nat.zero_lt_succ _) + DualWitness.state4.rho DualWitness.state4.hA DualWitness.state4.hC + (by norm_num [DualWitness.state4, DualWitness.state2, DualWitness.initial, + DualWitness.minus, DualWitness.plusA]) + (by norm_num [DualWitness.state4, DualWitness.state2, DualWitness.initial, + DualWitness.minus, DualWitness.plusA]) laws4_uniform rho4.symm + +theorem laws24_uniform : UniformLaws (Script.tensor BaseTwo.flagged script24) laws24 := + minusLaws_uniform _ laws8 3 (Nat.zero_lt_succ _) DualWitness.state8.rho + (by rw [DualWitness.state8_rho]; exact DualWitness.rho8_range.1) + (by rw [DualWitness.state8_rho]; exact DualWitness.rho8_range.2) + laws8_uniform rho8.symm + +theorem laws48_uniform : UniformLaws (Script.tensor BaseTwo.flagged script48) laws48 := + plusCLaws_uniform _ laws24 2 (Nat.zero_lt_succ _) + DualWitness.state24.rho DualWitness.state24.hA DualWitness.state24.hC + (by rw [DualWitness.state24_rho]; exact DualWitness.rho24_range.1) + (by rw [DualWitness.state24_rho]; exact DualWitness.rho24_range.2) + laws24_uniform rho24.symm + +theorem laws96_uniform : UniformLaws (Script.tensor BaseTwo.flagged script96) laws96 := + minusLaws_uniform _ laws48 2 (Nat.zero_lt_succ _) DualWitness.state48.rho + (by rw [DualWitness.state48_rho]; exact DualWitness.rho48_range.1) + (by rw [DualWitness.state48_rho]; exact DualWitness.rho48_range.2) + laws48_uniform rho48.symm + +theorem laws288_uniform : UniformLaws (Script.tensor BaseTwo.flagged Script.dual) laws288 := + plusALaws_uniform _ laws96 3 (Nat.zero_lt_succ _) + DualWitness.state96.rho DualWitness.state96.hA DualWitness.state96.hC + (by rw [DualWitness.state96_rho]; exact DualWitness.rho96_range.1) + (by rw [DualWitness.state96_rho]; exact DualWitness.rho96_range.2) + laws96_uniform rho96.symm + +end MatrixMultiplication.DualUniform + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/Duality/UniformMixtures.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/Duality/UniformMixtures.lean new file mode 100644 index 0000000000000000000000000000000000000000..19b71fedfa67a06a96a68d9add5b26757f02c974 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/Duality/UniformMixtures.lean @@ -0,0 +1,185 @@ +import OAI.LinearAlgebra.MatrixMultiplication.Completion.ColorLaws +import OAI.LinearAlgebra.MatrixMultiplication.Tensor.UniformCoordinate +import OAI.LinearAlgebra.MatrixMultiplication.Duality.EntropyHelpers + +namespace OAI + +/-! Dual matrix multiplication exponents and finite rectangular constructions. -/ + +noncomputable section + +universe uCoord + +namespace MatrixMultiplication.DualUniformMixtures + +open MatrixMultiplication.Foundation RecursiveCompletion CompletionLabels CompletionColorLaws +open CompletionLaws DualEntropyHelpers +open scoped BigOperators +attribute [local instance 10000] Classical.propDecidable Classical.decEq +attribute [local instance 11000] instDecidableEqFin + +variable {X Y Z : Type uCoord} {U A : Type*} [Fintype X] [Fintype Y] [Fintype Z] + [Fintype U] [Fintype A] + +theorem uniform_coordinate_card_pos (p : FiniteLaw A) (f : A → U) + (P : U → Prop) (h : UniformCoordinate p f P) : + 0 < Fintype.card {x // P x} := by + by_contra hn + have hz : Fintype.card {x // P x} = 0 := Nat.eq_zero_of_not_pos hn + have ht := (p.map f).total + have hmass : ∀ x, (p.map f).mass x = + if P x then (Fintype.card {x // P x} : ℝ)⁻¹ else 0 := h + simp_rw [hmass] at ht + simp [hz] at ht + +theorem colorMix_map_comp_mass (S : FlaggedTensor X Y Z) (center output : Color) + (pc : FiniteLaw (ColorSlice S center)) (po : FiniteLaw (ColorSlice S output)) + (α : ℝ) (hα : 0 ≤ α) (hα' : α ≤ 1) (f : Leaf S → U) (x : U) : + ((colorMix S center output pc po α hα hα').map f).mass x = + α * (pc.map (fun a => f a.val)).mass x + + (1 - α) * (po.map (fun a => f a.val)).mass x := by + rw [colorMix_map_mass, map_comp_mass, map_comp_mass] + +theorem colorMix_map_of_common (S : FlaggedTensor X Y Z) (center output : Color) + (pc : FiniteLaw (ColorSlice S center)) (po : FiniteLaw (ColorSlice S output)) + (α : ℝ) (hα : 0 ≤ α) (hα' : α ≤ 1) (f : Leaf S → U) + (hcommon : ∀ x, (pc.map (fun a => f a.val)).mass x = + (po.map (fun a => f a.val)).mass x) (x : U) : + ((colorMix S center output pc po α hα hα').map f).mass x = + (pc.map (fun a => f a.val)).mass x := by + rw [colorMix_map_comp_mass, ← hcommon x] + ring + +theorem colorMix_uniform_common (S : FlaggedTensor X Y Z) (center output : Color) + (pc : FiniteLaw (ColorSlice S center)) (po : FiniteLaw (ColorSlice S output)) + (α : ℝ) (hα : 0 ≤ α) (hα' : α ≤ 1) (P : X → Prop) + (hc : UniformCoordinate pc (fun a => a.val.val.1) P) + (ho : UniformCoordinate po (fun a => a.val.val.1) P) : + UniformCoordinate (colorMix S center output pc po α hα hα') + (fun a => a.val.1) P := by + intro x + rw [colorMix_map_of_common S center output pc po α hα hα' (fun a => a.val.1) + (fun x => (hc x).trans (ho x).symm)] + exact hc x + +theorem colorMix_uniform_complement (S : FlaggedTensor X Y Z) (center output : Color) + (pc : FiniteLaw (ColorSlice S center)) (po : FiniteLaw (ColorSlice S output)) + (α : ℝ) (hα : 0 ≤ α) (hα' : α ≤ 1) (P : X → Prop) + (hc : UniformCoordinate pc (fun a => a.val.val.1) P) + (ho : UniformCoordinate po (fun a => a.val.val.1) (fun x => ¬ P x)) + (hweight : α = (Fintype.card {x // P x} : ℝ) / Fintype.card X) : + UniformCoordinate (colorMix S center output pc po α hα hα') + (fun a => a.val.1) (fun _ => True) := by + have hp : (Fintype.card {x // P x} : ℝ) ≠ 0 := + (Nat.cast_pos.mpr (uniform_coordinate_card_pos pc _ P hc)).ne' + have hn : (Fintype.card {x // ¬ P x} : ℝ) ≠ 0 := + (Nat.cast_pos.mpr (uniform_coordinate_card_pos po _ _ ho)).ne' + have hsumNat : Fintype.card {x // P x} + Fintype.card {x // ¬ P x} = + Fintype.card X := by + rw [Fintype.card_subtype_compl] + exact Nat.add_sub_of_le (Fintype.card_subtype_le P) + have hsum : (Fintype.card {x // P x} : ℝ) + Fintype.card {x // ¬ P x} = + Fintype.card X := by exact_mod_cast hsumNat + have hX : (Fintype.card X : ℝ) ≠ 0 := by + have : 0 < Fintype.card X := lt_of_lt_of_le + (uniform_coordinate_card_pos pc _ P hc) (Fintype.card_subtype_le P) + exact (Nat.cast_pos.mpr this).ne' + have hrest : 1 - α = + (Fintype.card {x // ¬ P x} : ℝ) / Fintype.card X := by + rw [hweight, one_sub_div hX, show (Fintype.card X : ℝ) - + Fintype.card {x // P x} = Fintype.card {x // ¬ P x} by linarith] + intro x + rw [colorMix_map_comp_mass, hc x, ho x, hrest, hweight] + simp only [ite_true, Fintype.card_subtype_true] + by_cases hx : P x <;> simp only [hx, not_true_eq_false, not_false_eq_true, + ite_true, ite_false, mul_zero, zero_add, add_zero] + · rw [div_eq_mul_inv, mul_right_comm, mul_inv_cancel₀ hp, one_mul] + · rw [div_eq_mul_inv, mul_right_comm, mul_inv_cancel₀ hn, one_mul] + +theorem colorMix_uniform_complement_reverse + (S : FlaggedTensor X Y Z) (center output : Color) + (pc : FiniteLaw (ColorSlice S center)) (po : FiniteLaw (ColorSlice S output)) + (rho : ℝ) (hα : 0 ≤ 1 - rho) (hα' : 1 - rho ≤ 1) (P : X → Prop) + (hc : UniformCoordinate pc (fun a => a.val.val.1) (fun x => ¬ P x)) + (ho : UniformCoordinate po (fun a => a.val.val.1) P) + (hweight : rho = (Fintype.card {x // P x} : ℝ) / Fintype.card X) : + UniformCoordinate (colorMix S center output pc po (1 - rho) hα hα') + (fun a => a.val.1) (fun _ => True) := by + apply colorMix_uniform_complement S center output pc po (1 - rho) hα hα' + (fun x => ¬ P x) hc + · simpa only [not_not] using ho + · have hsumNat : Fintype.card {x // P x} + Fintype.card {x // ¬ P x} = + Fintype.card X := by + rw [Fintype.card_subtype_compl] + exact Nat.add_sub_of_le (Fintype.card_subtype_le P) + have hsum : (Fintype.card {x // P x} : ℝ) + Fintype.card {x // ¬ P x} = + Fintype.card X := by exact_mod_cast hsumNat + have hX : (Fintype.card X : ℝ) ≠ 0 := by + have : 0 < Fintype.card X := lt_of_lt_of_le + (uniform_coordinate_card_pos po _ P ho) (Fintype.card_subtype_le P) + exact (Nat.cast_pos.mpr this).ne' + rw [hweight, one_sub_div hX, show (Fintype.card X : ℝ) - + Fintype.card {x // P x} = Fintype.card {x // ¬ P x} by linarith] + +theorem colorSlice_color_mass (S : FlaggedTensor X Y Z) (c : Color) + (p : FiniteLaw (ColorSlice S c)) (b : Color) : + ((p.map Subtype.val).map (leafColor S)).mass b = if c = b then 1 else 0 := by + rw [map_comp_mass, FiniteLaw.map_mass] + have hc : ∀ a : ColorSlice S c, leafColor S a.val = c := fun a => a.property + simp_rw [hc] + by_cases h : c = b <;> simp [h, p.total] + +theorem colorSlice_pair_mass (S : FlaggedTensor X Y Z) (c : Color) + (p : FiniteLaw (ColorSlice S c)) (f : Leaf S → U) (x : U) (b : Color) : + ((p.map Subtype.val).map (fun a => (f a, leafColor S a))).mass (x, b) = + if c = b then (p.map (fun a => f a.val)).mass x else 0 := by + rw [map_comp_mass, FiniteLaw.map_mass] + have hc : ∀ a : ColorSlice S c, leafColor S a.val = c := fun a => a.property + simp_rw [hc] + by_cases h : c = b <;> simp [h, FiniteLaw.map_mass] + +theorem colorMix_independent_common (S : FlaggedTensor X Y Z) (center output : Color) + (pc : FiniteLaw (ColorSlice S center)) (po : FiniteLaw (ColorSlice S output)) + (α : ℝ) (hα : 0 ≤ α) (hα' : α ≤ 1) (f : Leaf S → U) + (hcommon : ∀ x, (pc.map (fun a => f a.val)).mass x = + (po.map (fun a => f a.val)).mass x) (x : U) (b : Color) : + ((colorMix S center output pc po α hα hα').map + (fun a => (f a, leafColor S a))).mass (x, b) = + ((colorMix S center output pc po α hα hα').map f).mass x * + ((colorMix S center output pc po α hα hα').map (leafColor S)).mass b := by + rw [colorMix_map_of_common S center output pc po α hα hα' f hcommon x] + rw [colorMix_map_mass, colorMix_map_mass, + colorSlice_pair_mass, colorSlice_pair_mass, + colorSlice_color_mass, colorSlice_color_mass, ← hcommon x] + by_cases hc : center = b <;> by_cases ho : output = b <;> simp [hc, ho] <;> ring + +theorem colorMix_independent_uniform (S : FlaggedTensor X Y Z) (center output : Color) + (pc : FiniteLaw (ColorSlice S center)) (po : FiniteLaw (ColorSlice S output)) + (α : ℝ) (hα : 0 ≤ α) (hα' : α ≤ 1) (P : X → Prop) + (hc : UniformCoordinate pc (fun a => a.val.val.1) P) + (ho : UniformCoordinate po (fun a => a.val.val.1) P) (x : X) (b : Color) : + ((colorMix S center output pc po α hα hα').map + (fun a => (a.val.1, leafColor S a))).mass (x, b) = + ((colorMix S center output pc po α hα hα').map (fun a => a.val.1)).mass x * + ((colorMix S center output pc po α hα hα').map (leafColor S)).mass b := + colorMix_independent_common S center output pc po α hα hα' (fun a => a.val.1) + (fun x => (hc x).trans (ho x).symm) x b + +theorem colorMix_independent_same (S : FlaggedTensor X Y Z) (c : Color) + (pc po : FiniteLaw (ColorSlice S c)) + (α : ℝ) (hα : 0 ≤ α) (hα' : α ≤ 1) (f : Leaf S → U) (x : U) (b : Color) : + ((colorMix S c c pc po α hα hα').map + (fun a => (f a, leafColor S a))).mass (x, b) = + ((colorMix S c c pc po α hα hα').map f).mass x * + ((colorMix S c c pc po α hα hα').map (leafColor S)).mass b := by + rw [colorMix_map_comp_mass S c c pc po α hα hα' f x] + rw [colorMix_map_mass, colorMix_map_mass, + colorSlice_pair_mass, colorSlice_pair_mass, + colorSlice_color_mass, colorSlice_color_mass] + by_cases hc : c = b <;> simp [hc] + +end MatrixMultiplication.DualUniformMixtures + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/Duality/UniformProducts.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/Duality/UniformProducts.lean new file mode 100644 index 0000000000000000000000000000000000000000..a30d0161d66c584b90f1c1d46a0a92620315f03e --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/Duality/UniformProducts.lean @@ -0,0 +1,86 @@ +import OAI.LinearAlgebra.MatrixMultiplication.Completion.ProductLaws +import OAI.LinearAlgebra.MatrixMultiplication.Tensor.UniformCoordinate + +namespace OAI + +/-! Dual matrix multiplication exponents and finite rectangular constructions. -/ + +noncomputable section + +namespace MatrixMultiplication.DualUniformProducts + +open MatrixMultiplication.Foundation CompletionProductLaws CompletionLaws +open scoped BigOperators +attribute [local instance 10000] Classical.propDecidable Classical.decEq +attribute [local instance 11000] instDecidableEqFin + +variable {I : Type*} [Fintype I] [DecidableEq I] +variable {A X Y : I → Type*} +variable [∀ i, Fintype (A i)] [∀ i, Fintype (X i)] [∀ i, Fintype (Y i)] + +def supportWordEquiv (P : ∀ i, X i → Prop) : + {x : ∀ i, X i // ∀ i, P i (x i)} ≃ ∀ i, {x : X i // P i x} where + toFun x i := ⟨x.val i, x.property i⟩ + invFun x := ⟨fun i => (x i).val, fun i => (x i).property⟩ + left_inv _ := rfl + right_inv _ := rfl + +theorem supportWord_card (P : ∀ i, X i → Prop) : + Fintype.card {x : ∀ i, X i // ∀ i, P i (x i)} = + ∏ i, Fintype.card {x : X i // P i x} := by + rw [Fintype.card_congr (supportWordEquiv P), Fintype.card_pi] + +theorem independentProduct_uniformCoordinate + (p : ∀ i, FiniteLaw (A i)) (f : ∀ i, A i → X i) + (P : ∀ i, X i → Prop) + (h : ∀ i, UniformCoordinate (p i) (f i) (P i)) : + UniformCoordinate (independentProduct p) (fun a i => f i (a i)) + (fun x => ∀ i, P i (x i)) := by + have hmass (i : I) (x : X i) : + ((p i).map (f i)).mass x = + if P i x then (Fintype.card {x : X i // P i x} : ℝ)⁻¹ else 0 := h i x + intro x + rw [independentProduct_map_mass] + simp_rw [hmass] + by_cases hx : ∀ i, P i (x i) + · rw [ite_eq_left hx] + simp only [hx, ite_true] + rw [supportWord_card] + simp only [Nat.cast_prod, Finset.prod_inv_distrib] + · rw [ite_eq_right hx] + obtain ⟨i, hi⟩ := not_forall.mp hx + exact Finset.prod_eq_zero (Finset.mem_univ i) (ite_eq_right hi) + +theorem independentProduct_joint_mass + (p : ∀ i, FiniteLaw (A i)) + (f : ∀ i, A i → X i) (g : ∀ i, A i → Y i) + (x : ∀ i, X i) (y : ∀ i, Y i) : + ((independentProduct p).map + (fun a => ((fun i => f i (a i)), (fun i => g i (a i))))).mass (x, y) = + ∏ i, ((p i).map (fun a => (f i a, g i a))).mass (x i, y i) := by + calc + _ = ((independentProduct p).map + (fun a i => (f i (a i), g i (a i)))).mass (fun i => (x i, y i)) := by + simp only [FiniteLaw.map_mass, Prod.mk.injEq, funext_iff, forall_and] + _ = _ := independentProduct_map_mass p (fun i a => (f i a, g i a)) _ + +theorem independentProduct_independent + (p : ∀ i, FiniteLaw (A i)) + (f : ∀ i, A i → X i) (g : ∀ i, A i → Y i) + (h : ∀ i x y, ((p i).map (fun a => (f i a, g i a))).mass (x, y) = + ((p i).map (f i)).mass x * ((p i).map (g i)).mass y) + (x : ∀ i, X i) (y : ∀ i, Y i) : + ((independentProduct p).map + (fun a => ((fun i => f i (a i)), (fun i => g i (a i))))).mass (x, y) = + ((independentProduct p).map (fun a i => f i (a i))).mass x * + ((independentProduct p).map (fun a i => g i (a i))).mass y := by + rw [independentProduct_joint_mass, independentProduct_map_mass, + independentProduct_map_mass] + simp_rw [h] + exact Finset.prod_mul_distrib + +end MatrixMultiplication.DualUniformProducts + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/Duality/UniformUpdates.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/Duality/UniformUpdates.lean new file mode 100644 index 0000000000000000000000000000000000000000..6bea255bc182e71795c7ee9f2034acff31af6a21 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/Duality/UniformUpdates.lean @@ -0,0 +1,102 @@ +import OAI.LinearAlgebra.MatrixMultiplication.Duality.UniformConditioning +import OAI.LinearAlgebra.MatrixMultiplication.Duality.UniformProducts + +namespace OAI + +/-! Dual matrix multiplication exponents and finite rectangular constructions. -/ + +noncomputable section +universe uCoord +namespace MatrixMultiplication.DualUniformUpdates + +open MatrixMultiplication.Foundation RecursiveCompletion CompletionLabels CompletionColorLaws +open CompletionLaws CompletionProductLaws DualUniformConditioning DualUniformProducts +open scoped BigOperators +attribute [local instance 10000] Classical.propDecidable Classical.decEq +attribute [local instance 11000] instDecidableEqFin + +variable {X Y Z : Type uCoord} [Fintype X] [Fintype Y] [Fintype Z] + +theorem conditionalCompletionLaw_uniform_independent + (S : FlaggedTensor X Y Z) (center output : Color) + (pc : FiniteLaw (ColorSlice S center)) (po : FiniteLaw (ColorSlice S output)) + (m : ℕ) (hm : 0 < m) (α : ℝ) (hα : 0 ≤ α) (hα' : α < 1) + (P : X → Prop) + (hu : UniformCoordinate (colorMix S center output pc po α hα hα'.le) + (fun a => a.val.1) P) + (hi : ∀ x c, + ((colorMix S center output pc po α hα hα'.le).map + (fun a => (a.val.1, leafColor S a))).mass (x,c) = + ((colorMix S center output pc po α hα hα'.le).map (fun a => a.val.1)).mass x * + ((colorMix S center output pc po α hα hα'.le).map (leafColor S)).mass c) : + UniformCoordinate + (conditionalCompletionLaw S center output pc po m hm α hα hα') + (fun a => a.val.val.1) (fun x => ∀ i, P (x i)) := by + let p := iidColorLaw S center output pc po m α hα hα'.le + let f : (Fin m → Leaf S) → (Fin m → X) := fun w i => (w i).val.1 + let g : (Fin m → Leaf S) → (Fin m → Color) := fun w i => leafColor S (w i) + let Q : (Fin m → Color) → Prop := fun w => + raisedFlag center output (fun i => w i = output) ∧ + ∀ i, w i = center ∨ w i = output + have hprod : UniformCoordinate p f (fun x => ∀ i, P (x i)) := + independentProduct_uniformCoordinate + (fun _ : Fin m => colorMix S center output pc po α hα hα'.le) + (fun _ a => a.val.1) (fun _ => P) (fun _ => hu) + have hind : ∀ x c, (p.map (fun a => (f a, g a))).mass (x,c) = + (p.map f).mass x * (p.map g).mass c := + independentProduct_independent + (fun _ : Fin m => colorMix S center output pc po α hα hα'.le) + (fun _ a => a.val.1) (fun _ => leafColor S) (fun _ => hi) + have hcond := uniform_coordinate_independent_condition p f g + (fun x => ∀ i, P (x i)) Q hprod hind + (completionEvent_mass_pos S center output pc po m hm α hα hα') + intro x + rw [conditionalCompletionLaw_X_mass] + exact hcond x + +theorem conditionalCompletionLaw_uniform_incident + (S : FlaggedTensor X Y Z) (center output : Color) + (hc : center = .B ∨ output = .B) + (pc : FiniteLaw (ColorSlice S center)) (po : FiniteLaw (ColorSlice S output)) + (m : ℕ) (hm : 0 < m) (α : ℝ) (hα : 0 ≤ α) (hα' : α < 1) + (hu : UniformCoordinate (colorMix S center output pc po α hα hα'.le) + (fun a => a.val.1) (fun _ => True)) : + UniformCoordinate + (conditionalCompletionLaw S center output pc po m hm α hα hα') + (fun a => a.val.val.1) + (fun x => if output = .B then (complete S center m).flagB x + else ¬ (complete S center m).flagB x) := by + let p := iidColorLaw S center output pc po m α hα hα'.le + let f : (Fin m → Leaf S) → (Fin m → X) := fun w i => (w i).val.1 + let Q : (Fin m → X) → Prop := fun x => if output = .B then + (complete S center m).flagB x else ¬ (complete S center m).flagB x + have hprod : UniformCoordinate p f (fun _ => True) := by + apply uniform_coordinate_pred_congr p f (fun x => ∀ _i : Fin m, True) + (fun _ => True) (fun _ => by simp) + exact independentProduct_uniformCoordinate + (fun _ : Fin m => colorMix S center output pc po α hα hα'.le) + (fun _ a => a.val.1) (fun _ _ => True) (fun _ => hu) + have heq : ∀ w, p.mass w ≠ 0 → + (completionEvent S center output m w ↔ Q (f w)) := by + intro w hw + have ha := iidColorLaw_allowed S center output pc po m α hα hα'.le w hw + by_cases ho : output = .B + · subst output + simpa only [Q, f, ite_eq_left rfl, ite_true] using completionEvent_outputB S center m w ha + · have hcenter : center = .B := hc.resolve_right ho + subst center + simpa only [Q, f, ite_eq_right ho] using completionEvent_centerB S output ho m w ha + have hcond := uniform_coordinate_condition_supported p f (fun _ => True) Q + (completionEvent S center output m) hprod heq + (completionEvent_mass_pos S center output pc po m hm α hα hα') + have hcond' := uniform_coordinate_pred_congr _ _ (fun x => True ∧ Q x) Q + (fun _ => ⟨And.right, fun h => ⟨True.intro, h⟩⟩) hcond + intro x + rw [conditionalCompletionLaw_X_mass] + exact hcond' x + +end MatrixMultiplication.DualUniformUpdates + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/Duality/Witness.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/Duality/Witness.lean new file mode 100644 index 0000000000000000000000000000000000000000..cb737e5b296965bbe1d3569675d2b717d76034ea --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/Duality/Witness.lean @@ -0,0 +1,57 @@ +import OAI.LinearAlgebra.MatrixMultiplication.Duality.CompletionLaws +import OAI.LinearAlgebra.MatrixMultiplication.Duality.UniformInstances +import OAI.LinearAlgebra.MatrixMultiplication.Completion.TerminationLaw +import OAI.LinearAlgebra.MatrixMultiplication.Duality.WitnessProgram + +namespace OAI + +/-! Dual matrix multiplication exponents and finite rectangular constructions. -/ + +noncomputable section + +namespace MatrixMultiplication.DualWitness + +attribute [local instance 10000] Classical.propDecidable Classical.decEq +attribute [local instance 11000] instDecidableEqFin + +open MatrixMultiplication.Foundation RecursiveCompletion CompletionLabels +open CompletionLaws CompletionColorLaws DualCompletionLaws + +def law : FiniteLaw Support := + CompletionTerminationLaw.law source .B .C (laws288 .B) (laws288 .C) state288.rho + (by rw [state288_rho]; exact rho288_range.1.le) + (by rw [state288_rho]; exact rho288_range.2.le) + +def rate (pair : ReaderPair) : ℝ := + ConditionalLabels.lawPairingRate law program.labels (1 + readable.depth) + (fun n => program.pair n.val) pair + +theorem law_uniform : UniformCoordinate law x (fun _ => True) := by + have hu := DualUniformMixtures.colorMix_uniform_complement source .B .C + (laws288 .B) (laws288 .C) state288.rho + (by rw [state288_rho]; exact rho288_range.1.le) + (by rw [state288_rho]; exact rho288_range.2.le) + source.flagB DualUniform.laws288_uniform.B DualUniform.laws288_uniform.C + DualUniform.rho288.symm + intro u + change ((law.map (fun a : Support => a.val.val.1)).mass u) = _ + exact (CompletionTerminationLaw.law_map_mass source .B .C + (laws288 .B) (laws288 .C) state288.rho + (by rw [state288_rho]; exact rho288_range.1.le) + (by rw [state288_rho]; exact rho288_range.2.le) + (fun a : Leaf source => a.val.1) u).trans (hu u) + +theorem x_entropy : finiteEntropy (law.map x).mass = 288 * Real.log 2 := by + rw [uniform_coordinate_entropy law x (fun _ => True) law_uniform] + simp only [Fintype.card_subtype_true, word_card, Nat.cast_pow, Nat.cast_ofNat, + Real.log_pow] + +theorem rate_sum : rate .xy + rate .xz + rate .yz = finiteEntropy law.mass := + ConditionalLabels.lawPairingRate_sum law program.labels (1 + readable.depth) + (fun n => program.pair n.val) record_injective + +end MatrixMultiplication.DualWitness + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/Duality/WitnessArithmetic.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/Duality/WitnessArithmetic.lean new file mode 100644 index 0000000000000000000000000000000000000000..81fbf2e784666aeeaa66acd13b5ce0b3116b64b5 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/Duality/WitnessArithmetic.lean @@ -0,0 +1,102 @@ +import Mathlib.Analysis.SpecialFunctions.Log.Basic +import Mathlib.Analysis.SpecialFunctions.Exp +import Mathlib.Tactic.NormNum + +namespace OAI + +/-! Dual matrix multiplication exponents and finite rectangular constructions. -/ + +noncomputable section + +namespace MatrixMultiplication.DualWitness + +structure State where + rho : ℝ + factors : ℕ + hB : ℝ + hA : ℝ + hC : ℝ + +def initial : State := ⟨1 / 2, 1, 0, 0, 0⟩ + +def minus (m : ℕ) (s : State) : State := + let rho' := s.rho ^ m + { rho := rho' + factors := m * s.factors + hB := m * s.hB + hA := m * ((s.rho - rho') / (1 - rho') * s.hB + + (1 - s.rho) / (1 - rho') * s.hA) + hC := m * ((s.rho - rho') / (1 - rho') * s.hB + + (1 - s.rho) / (1 - rho') * s.hC) } + +def plusA (m : ℕ) (s : State) : State := + let rho' := 1 - (1 - s.rho) ^ m + { rho := rho' + factors := m * s.factors + hB := m * (s.rho / rho' * s.hB + (rho' - s.rho) / rho' * s.hA) + hA := m * s.hA + hC := Real.log ((Real.exp s.hA + Real.exp s.hC) ^ m - Real.exp (m * s.hA)) } + +def plusC (m : ℕ) (s : State) : State := + let rho' := 1 - (1 - s.rho) ^ m + { rho := rho' + factors := m * s.factors + hB := m * (s.rho / rho' * s.hB + (rho' - s.rho) / rho' * s.hC) + hA := Real.log ((Real.exp s.hC + Real.exp s.hA) ^ m - Real.exp (m * s.hC)) + hC := m * s.hC } + +def state2 : State := minus 2 initial +def state4 : State := plusA 2 state2 +def state8 : State := plusC 2 state4 +def state24 : State := minus 3 state8 +def state48 : State := plusC 2 state24 +def state96 : State := minus 2 state48 +def state288 : State := plusA 3 state96 + +def normalizedHidden (s : State) : ℝ := + (s.rho * s.hB + (1 - s.rho) * max s.hA s.hC) / s.factors + +def rho8 : ℝ := 1 - (3 / 4 : ℝ) ^ 4 +def rho24 : ℝ := rho8 ^ 3 +def delta24 : ℝ := 3 * (1 - rho8) / (1 - rho24) * Real.log (9 / 7 : ℝ) +def z48 : ℝ := Real.log ((1 + Real.exp (-delta24)) ^ 2 - 1) +def rho48 : ℝ := 1 - (1 - rho24) ^ 2 +def rho96 : ℝ := rho48 ^ 2 +def delta96 : ℝ := 2 * z48 / (1 + rho48) +def rho288 : ℝ := 1 - (1 - rho96) ^ 3 +def z288 : ℝ := Real.log ((1 + Real.exp (-delta96)) ^ 3 - 1) +def hiddenRate : ℝ := 9 / 64 * Real.log 3 + + (1 - rho48) / 48 * z48 + (1 - rho288) / 288 * z288 +def aspect : ℝ := 2 * hiddenRate / Real.log 2 + +theorem state_factors : state288.factors = 288 := by + norm_num [state288, state96, state48, state24, state8, state4, state2, + initial, minus, plusA, plusC] + +theorem state8_rho : state8.rho = rho8 := by + norm_num [state8, state4, state2, initial, minus, plusA, plusC, rho8] + +theorem state24_rho : state24.rho = rho24 := by + simp only [state24, minus, rho24, state8_rho] + +theorem state48_rho : state48.rho = rho48 := by + simp only [state48, plusC, rho48, state24_rho] + +theorem state96_rho : state96.rho = rho96 := by + simp only [state96, minus, rho96, state48_rho] + +theorem state288_rho : state288.rho = rho288 := by + simp only [state288, plusA, rho288, state96_rho] + +theorem rho8_range : 0 < rho8 ∧ rho8 < 1 := by norm_num [rho8] +theorem rho24_range : 0 < rho24 ∧ rho24 < 1 := by norm_num [rho24, rho8] +theorem rho48_range : 0 < rho48 ∧ rho48 < 1 := by norm_num [rho48, rho24, rho8] +theorem rho96_range : 0 < rho96 ∧ rho96 < 1 := by norm_num [rho96, rho48, rho24, rho8] +theorem rho288_range : 0 < rho288 ∧ rho288 < 1 := by + norm_num [rho288, rho96, rho48, rho24, rho8] + +end MatrixMultiplication.DualWitness + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/Duality/WitnessEntropy.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/Duality/WitnessEntropy.lean new file mode 100644 index 0000000000000000000000000000000000000000..089dd38c59da8f2479f2b4845f7901771d3392c9 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/Duality/WitnessEntropy.lean @@ -0,0 +1,45 @@ +import OAI.LinearAlgebra.MatrixMultiplication.Duality.Witness +import OAI.LinearAlgebra.MatrixMultiplication.Duality.HiddenInstances + +namespace OAI + +/-! Dual matrix multiplication exponents and finite rectangular constructions. -/ + +noncomputable section + +namespace MatrixMultiplication.DualWitness + +attribute [local instance 10000] Classical.propDecidable Classical.decEq +attribute [local instance 11000] instDecidableEqFin + +open MatrixMultiplication.Foundation RecursiveCompletion CompletionLabels +open CompletionLaws CompletionColorLaws DualCompletionLaws CompletionPartitions + +theorem law_entropy : finiteEntropy law.mass = + 288 * Real.log 2 + 288 * hiddenRate := by + have hhidden := DualHiddenRates.laws288_weightedHidden + rw [DualUniform.UniformLaws.entropy_B _ _ DualUniform.laws288_uniform, + DualUniform.UniformLaws.entropy_C _ _ DualUniform.laws288_uniform] at hhidden + have hcoord := DualHiddenRates.laws288_coordinateEntropy + change CompletionEntropyAlgebra.binaryEntropy state288.rho + + state288.rho * Real.log (activeCount source) + + (1 - state288.rho) * Real.log (inactiveCount source) = + Real.log (Fintype.card Word) at hcoord + rw [word_card, Nat.cast_pow, Nat.cast_ofNat, Real.log_pow] at hcoord + unfold CompletionEntropyAlgebra.binaryEntropy at hcoord + dsimp only [source] at hcoord + norm_num only [Nat.cast_ofNat] at hcoord + change finiteEntropy (CompletionTerminationLaw.law + (Script.tensor BaseTwo.flagged Script.dual) .B .C (laws288 .B) (laws288 .C) + state288.rho _ _).mass = _ + rw [CompletionTerminationLaw.law_entropy _ .B .C (by intro h; cases h)] + linarith only [hhidden, hcoord] + +theorem total_hidden_entropy : finiteEntropy law.mass - finiteEntropy (law.map x).mass = + 288 * hiddenRate := by rw [law_entropy, x_entropy]; ring + +end MatrixMultiplication.DualWitness + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/Duality/WitnessProgram.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/Duality/WitnessProgram.lean new file mode 100644 index 0000000000000000000000000000000000000000..8c56f30e2f4e4b85cf20868e314ae9a7c562ea41 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/Duality/WitnessProgram.lean @@ -0,0 +1,54 @@ +import OAI.LinearAlgebra.MatrixMultiplication.Entropy.BaseConditionalReaders + +namespace OAI + +/-! Dual matrix multiplication exponents and finite rectangular constructions. -/ + +noncomputable section + +namespace MatrixMultiplication.DualWitness + +attribute [local instance 10000] Classical.propDecidable Classical.decEq +attribute [local instance 11000] instDecidableEqFin + +open MatrixMultiplication.Foundation RecursiveCompletion CompletionLabels + +abbrev Word := Script.Coord (Fin 2) Script.dual +def source : FlaggedTensor Word Word Word := Script.tensor BaseTwo.flagged Script.dual +abbrev Support := RetainedLeaf source .B .C + +def readable : ReadableTensor source := + ReadableTensor.script BaseTwo.flagged BaseConditionalReaders.baseTwoReadable Script.dual + +def program := terminationProgram source .B .C (by intro h; cases h) + readable.program readable.context_eq readable.view_eq + +theorem program_complete : program.Complete := + terminationProgram_complete source .B .C (by intro h; cases h) + readable.program readable.context_eq readable.view_eq readable.complete + +theorem record_injective : Function.Injective + (labelRecordOf program.labels (1 + readable.depth)) := + terminationRecord_injective source .B .C (by intro h; cases h) + readable.program readable.context_eq readable.view_eq readable.complete + +def x (a : Support) : Word := a.val.val.1 + +theorem coord_card (U : Type*) [Fintype U] (s : Script) : + Fintype.card (Script.Coord U s) = Fintype.card U ^ s.factors := by + induction s with + | base => + change Fintype.card U = Fintype.card U ^ 1 + exact (pow_one _).symm + | step prior center m ih => + change Fintype.card (Fin m → Script.Coord U prior) = _ + simp only [Fintype.card_fun, Fintype.card_fin, ih, Script.factors, pow_mul] + +theorem word_card : Fintype.card Word = 2 ^ 288 := by + simpa only [Fintype.card_fin, Script.dual_factors] using coord_card (Fin 2) Script.dual + +end MatrixMultiplication.DualWitness + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/Duality/WitnessRates.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/Duality/WitnessRates.lean new file mode 100644 index 0000000000000000000000000000000000000000..8557c1b658a2982e1b1401493cea688f27d7fefd --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/Duality/WitnessRates.lean @@ -0,0 +1,45 @@ +import OAI.LinearAlgebra.MatrixMultiplication.Duality.WitnessEntropy +import OAI.LinearAlgebra.MatrixMultiplication.Duality.ScriptIndependence +import OAI.LinearAlgebra.MatrixMultiplication.Duality.TerminationIndependence +import OAI.LinearAlgebra.MatrixMultiplication.Duality.InformationSchedule + +namespace OAI + +/-! Dual matrix multiplication exponents and finite rectangular constructions. -/ + +noncomputable section + +namespace MatrixMultiplication.DualWitnessRates + +attribute [local instance 10000] Classical.propDecidable Classical.decEq +attribute [local instance 11000] instDecidableEqFin + +open MatrixMultiplication.Foundation CompletionLabels CompletionLabels.TopologicalFlatten +open DualInformation DualCompletionLaws DualWitness + +theorem nonincident_independent (n : Fin (1 + readable.depth)) + (hn : program.pair n.val = .yz) : + ConditionalIndependent law (labelRecordOf program.labels n.val) + (program.labels n.val) x := by + exact DualProgramIndependence.termination_independent source readable laws288 + state288.rho + (by rw [state288_rho]; exact rho288_range.1.le) + (by rw [state288_rho]; exact rho288_range.2.le) + DualProgramIndependence.laws288_independent n hn + +theorem incident_rate : rate .xy + rate .xz = 288 * Real.log 2 := by + let : Fintype (Coordinate Word Word Word .B) := inferInstanceAs (Fintype Word) + have h := program.incident_rate_eq_x_entropy law program_complete PUnit.unit + (fun _ => rfl) (fun n hn => nonincident_independent n hn) + change rate .xy + rate .xz = finiteEntropy (law.map x).mass at h + rw [x_entropy] at h + exact h + +theorem hidden_rate : rate .yz = 288 * hiddenRate := by + linarith only [rate_sum, law_entropy, incident_rate] + +end MatrixMultiplication.DualWitnessRates + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/Duality/WitnessRealization.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/Duality/WitnessRealization.lean new file mode 100644 index 0000000000000000000000000000000000000000..f2a532350df0feac7ccd940482523f02c0d51240 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/Duality/WitnessRealization.lean @@ -0,0 +1,103 @@ +import OAI.LinearAlgebra.MatrixMultiplication.Duality.FiniteRealization +import OAI.LinearAlgebra.MatrixMultiplication.Duality.FiniteRates +import OAI.LinearAlgebra.MatrixMultiplication.Duality.WitnessProgram +import OAI.LinearAlgebra.MatrixMultiplication.Completion.HierarchyPrograms +import OAI.LinearAlgebra.MatrixMultiplication.Completion.Termination + +namespace OAI + +/-! Dual matrix multiplication exponents and finite rectangular constructions. -/ + +noncomputable section + +namespace MatrixMultiplication.DualWitnessRealization + +open MatrixMultiplication.Foundation RecursiveCompletion CompletionLabels +open CompletionLabels.TopologicalFlatten CompletionHierarchyWords +open scoped BigOperators Classical + +theorem program_context (a : DualWitness.Support) : DualWitness.program.context a = PUnit.unit := + rfl + +theorem program_joint : + Function.Injective (fun a : DualWitness.Support => + (DualWitness.program.view .B a, DualWitness.program.view .C a, + DualWitness.program.view .A a)) := by + intro a b h + apply Subtype.ext + apply Subtype.ext + exact h + +def hierarchy : + ReadableHierarchy DualWitness.Support DualWitness.Word DualWitness.Word DualWitness.Word := + ReadableHierarchy.ofProgram DualWitness.program PUnit.unit program_context program_joint + +theorem hierarchy_complete : + Function.Injective (labelRecordOf hierarchy.labels hierarchy.depth) := + ReadableHierarchy.ofProgram_complete DualWitness.program PUnit.unit program_context + program_joint DualWitness.program_complete + +@[simp] theorem hierarchy_x (a : DualWitness.Support) : hierarchy.x a = a.val.val.1 := rfl +@[simp] theorem hierarchy_y (a : DualWitness.Support) : hierarchy.y a = a.val.val.2.1 := rfl +@[simp] theorem hierarchy_z (a : DualWitness.Support) : hierarchy.z a = a.val.val.2.2 := rfl + +def tensor : Tensor ℂ DualWitness.Word DualWitness.Word DualWitness.Word := + CompletionTermination.tensor DualWitness.source .A + +def retainedLeafEquiv : CompletionTermination.Leaf DualWitness.source .A ≃ DualWitness.Support := + CompletionTermination.retainedLeafEquiv DualWitness.source .A .B .C + (by intro c; cases c <;> simp) + +def approximation : + Tensor.PolynomialApproximation tensor (2 ^ 288) + (Script.dual.order 1) (Script.dual.degree 3) := + CompletionTermination.approximation DualWitness.source .A DualFiniteRealization.dualSource + +theorem base_unit (x y z : Fin 2) (h : BaseTwo.tensor x y z ≠ 0) : + BaseTwo.tensor x y z = 1 := by + unfold BaseTwo.tensor at h ⊢ + split_ifs with hsum + · rfl + · simp [hsum] at h + +theorem tensor_unit_coefficients (x y z : DualWitness.Word) (h : tensor x y z ≠ 0) : + tensor x y z = 1 := by + obtain ⟨hs, ha⟩ := (CompletionTermination.support_iff DualWitness.source .A x y z).mp h + change (if ownerFlag DualWitness.source .A (coordinate (x, y, z) .A) then 0 + else DualWitness.source.tensor x y z) = 1 + rw [ite_eq_right ha] + exact CompletionFiniteRealization.script_coefficient_one BaseTwo.flagged base_unit + Script.dual x y z hs + +theorem source_supported (x y z : DualWitness.Word) (h : tensor x y z ≠ 0) : + ∃ a : DualWitness.Support, hierarchy.x a = x ∧ hierarchy.y a = y ∧ hierarchy.z a = z := + ⟨retainedLeafEquiv ⟨(x, y, z), h⟩, rfl, rfl, rfl⟩ + +theorem source_unit (a : DualWitness.Support) : + tensor (hierarchy.x a) (hierarchy.y a) (hierarchy.z a) = 1 := + tensor_unit_coefficients _ _ _ (retainedLeafEquiv.symm a).property + +def witness (counts : DualWitness.Support → ℕ) (t : ℕ) : + ComplexWitness.FiniteRectangularWitness := + DualFiniteRealization.witness hierarchy counts t hierarchy_complete approximation + (pow_pos (by decide : 0 < (2 : ℕ)) 288) source_supported source_unit + +theorem witness_rank (counts : DualWitness.Support → ℕ) (t : ℕ) : + (witness counts t).rank = + (2 ^ (288 * CompletionFiniteRealization.blocks counts t) * + StageHierarchyResources.stageAuxiliaryBudget counts hierarchy.labels hierarchy.depth t) ^ 2 := by + rw [witness, DualFiniteRealization.witness_rank_stageBudget, ← pow_mul] + +theorem source_log : Real.log ((2 ^ 288 : ℕ) : ℝ) = 288 * Real.log 2 := by + rw [Nat.cast_pow, Real.log_pow] + norm_num + +theorem source_log_positive : 0 < Real.log ((2 ^ 288 : ℕ) : ℝ) := by + rw [source_log] + exact mul_pos (by norm_num) (Real.log_pos (by norm_num)) + +end MatrixMultiplication.DualWitnessRealization + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/Duality/WitnessRecurrence.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/Duality/WitnessRecurrence.lean new file mode 100644 index 0000000000000000000000000000000000000000..9f84502824522cc00ce39a501f975f6b7f3722ac --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/Duality/WitnessRecurrence.lean @@ -0,0 +1,221 @@ +import OAI.LinearAlgebra.MatrixMultiplication.Numerical.ComplexCertificatesDual + +namespace OAI + +/-! Dual matrix multiplication exponents and finite rectangular constructions. -/ + +noncomputable section + +namespace MatrixMultiplication.DualWitness + +private def massA (s : State) : ℝ := s.rho * s.hB + (1 - s.rho) * s.hA +private def massC (s : State) : ℝ := s.rho * s.hB + (1 - s.rho) * s.hC + +private theorem massA_eq_massC (s : State) : + massA s = massC s + (1 - s.rho) * (s.hA - s.hC) := by + dsimp [massA, massC] + ring + +private theorem massC_eq_massA (s : State) : + massC s = massA s + (1 - s.rho) * (s.hC - s.hA) := by + dsimp [massA, massC] + ring + +private theorem minus_massA (m : ℕ) (s : State) (h : 1 - s.rho ^ m ≠ 0) : + massA (minus m s) = m * massA s := by + dsimp [massA, minus] + field_simp + ring + +private theorem minus_massC (m : ℕ) (s : State) (h : 1 - s.rho ^ m ≠ 0) : + massC (minus m s) = m * massC s := by + dsimp [massC, minus] + field_simp + ring + +private theorem minus_gap (m : ℕ) (s : State) : + (minus m s).hC - (minus m s).hA = + m * ((1 - s.rho) / (1 - s.rho ^ m)) * (s.hC - s.hA) := by + dsimp [minus] + ring + +private theorem minus_gap_reverse (m : ℕ) (s : State) : + (minus m s).hA - (minus m s).hC = + m * ((1 - s.rho) / (1 - s.rho ^ m)) * (s.hA - s.hC) := by + dsimp [minus] + ring + +private theorem plusA_massA (m : ℕ) (s : State) + (h : 1 - (1 - s.rho) ^ m ≠ 0) : + massA (plusA m s) = m * massA s := by + dsimp [massA, plusA] + field_simp + ring + +private theorem plusC_massC (m : ℕ) (s : State) + (h : 1 - (1 - s.rho) ^ m ≠ 0) : + massC (plusC m s) = m * massC s := by + dsimp [massC, plusC] + field_simp + ring + +private theorem log_exp_sum_pow_sub (a c : ℝ) (m : ℕ) (hm : m ≠ 0) : + Real.log ((Real.exp a + Real.exp c) ^ m - Real.exp ((m : ℝ) * a)) = + (m : ℝ) * a + Real.log ((1 + Real.exp (c - a)) ^ m - 1) := by + have h : (1 + Real.exp (c - a)) ^ m - 1 ≠ 0 := + (sub_pos.mpr (one_lt_pow₀ (by linarith [Real.exp_pos (c - a)]) hm)).ne' + have hfactor : Real.exp a + Real.exp c = + Real.exp a * (1 + Real.exp (c - a)) := by + rw [mul_add, mul_one, ← Real.exp_add, show a + (c - a) = c by ring] + have harg : (Real.exp a + Real.exp c) ^ m - Real.exp ((m : ℝ) * a) = + Real.exp ((m : ℝ) * a) * ((1 + Real.exp (c - a)) ^ m - 1) := by + rw [hfactor, mul_pow, Real.exp_nat_mul a m] + ring + rw [harg, Real.log_mul (Real.exp_ne_zero _) h, Real.log_exp] + +theorem state4_hB : state4.hB = 0 := by + norm_num [state4, state2, initial, minus, plusA] + +theorem state4_hA : state4.hA = 0 := by + norm_num [state4, state2, initial, minus, plusA] + +theorem state4_hC : state4.hC = Real.log 3 := by + norm_num [state4, state2, initial, minus, plusA] + +theorem state8_hB : state8.hB = (18 / 25 : ℝ) * Real.log 3 := by + simp only [state8, plusC, state4_hB, state4_hC] + norm_num [state4, state2, initial, minus, plusA] + ring + +theorem state8_hA : state8.hA = Real.log 7 := by + simp only [state8, plusC, state4_hC, state4_hA] + have he2 := Real.exp_nat_mul (Real.log 3) 2 + norm_num [Real.exp_log (by norm_num : (0 : ℝ) < 3)] at he2 + norm_num [he2, Real.exp_log (by norm_num : (0 : ℝ) < 3)] + +theorem state8_hC : state8.hC = 2 * Real.log 3 := by + simp [state8, plusC, state4_hC] + +theorem state8_hidden : state8.hB = (18 / 25 : ℝ) * Real.log 3 ∧ + state8.hA = Real.log 7 ∧ state8.hC = 2 * Real.log 3 := + ⟨state8_hB, state8_hA, state8_hC⟩ + +theorem state8_gap : state8.hC - state8.hA = Real.log (9 / 7 : ℝ) := by + rw [state8_hC, state8_hA, Real.log_div (by norm_num : (9 : ℝ) ≠ 0) + (by norm_num : (7 : ℝ) ≠ 0)] + have h9 : Real.log (9 : ℝ) = 2 * Real.log 3 := by + rw [show (9 : ℝ) = 3 ^ 2 by norm_num, Real.log_pow] + norm_num + rw [h9] + +theorem state24_gap : state24.hC - state24.hA = delta24 := by + rw [state24, minus_gap, state8_rho, state8_gap] + dsimp [delta24, rho24] + norm_num + ring + +theorem state48_gap : state48.hA - state48.hC = z48 := by + change Real.log ((Real.exp state24.hC + Real.exp state24.hA) ^ 2 - + Real.exp (2 * state24.hC)) - 2 * state24.hC = z48 + have hlog := log_exp_sum_pow_sub state24.hC state24.hA 2 (by norm_num) + simp only [Nat.cast_ofNat] at hlog + rw [hlog] + have hgap : state24.hA - state24.hC = -delta24 := by + linarith [state24_gap] + rw [hgap] + dsimp [z48] + ring + +theorem state96_gap : state96.hA - state96.hC = delta96 := by + rw [state96, minus_gap_reverse, state48_rho, state48_gap] + norm_num [delta96, rho48, rho24, rho8] + ring + +theorem state288_gap : state288.hC - state288.hA = z288 := by + change Real.log ((Real.exp state96.hA + Real.exp state96.hC) ^ 3 - + Real.exp (3 * state96.hA)) - 3 * state96.hA = z288 + have hlog := log_exp_sum_pow_sub state96.hA state96.hC 3 (by norm_num) + simp only [Nat.cast_ofNat] at hlog + rw [hlog] + have hgap : state96.hC - state96.hA = -delta96 := by + linarith [state96_gap] + rw [hgap] + dsimp [z288] + ring + +theorem initial_max : max initial.hA initial.hC = initial.hA := by + norm_num [initial] + +theorem state2_max : max state2.hA state2.hC = state2.hA := by + norm_num [state2, minus, initial] + +theorem state4_max : max state4.hA state4.hC = state4.hC := by + apply max_eq_right + rw [state4_hA, state4_hC] + exact (Real.log_pos (by norm_num : (1 : ℝ) < 3)).le + +theorem state8_max : max state8.hA state8.hC = state8.hC := by + apply max_eq_right + have hlog := Real.log_pos (by norm_num : (1 : ℝ) < 9 / 7) + linarith [state8_gap] + +theorem state24_max : max state24.hA state24.hC = state24.hC := by + apply max_eq_right + linarith [state24_gap, ComplexCertificates.delta24_bounds.1] + +theorem state48_max : max state48.hA state48.hC = state48.hA := by + apply max_eq_left + linarith [state48_gap, ComplexCertificates.z48_bounds.1] + +theorem state96_max : max state96.hA state96.hC = state96.hA := by + apply max_eq_left + linarith [state96_gap, ComplexCertificates.delta96_bounds.1] + +theorem state288_max : max state288.hA state288.hC = state288.hC := by + apply max_eq_right + linarith [state288_gap, ComplexCertificates.z288_bounds.1] + +private theorem state8_mass : massC state8 = (9 / 8 : ℝ) * Real.log 3 := by + dsimp [massC] + rw [state8_rho, state8_hB, state8_hC] + norm_num [rho8] + ring + +private theorem state24_mass : massC state24 = 3 * massC state8 := by + apply minus_massC + rw [state8_rho] + exact ne_of_gt (sub_pos.mpr rho24_range.2) + +private theorem state48_mass : + massA state48 = 2 * massC state24 + (1 - rho48) * z48 := by + rw [massA_eq_massC, state48_gap, state48_rho] + congr 1 + apply plusC_massC + rw [state24_rho] + exact ne_of_gt rho48_range.1 + +private theorem state96_mass : massA state96 = 2 * massA state48 := by + apply minus_massA + rw [state48_rho] + exact ne_of_gt (sub_pos.mpr rho96_range.2) + +private theorem state288_mass : + massC state288 = 3 * massA state96 + (1 - rho288) * z288 := by + rw [massC_eq_massA, state288_gap, state288_rho] + congr 1 + apply plusA_massA + rw [state96_rho] + exact ne_of_gt rho288_range.1 + +theorem state288_normalizedHidden : normalizedHidden state288 = hiddenRate := by + rw [normalizedHidden, state288_max, state_factors] + change massC state288 / 288 = hiddenRate + rw [state288_mass, state96_mass, state48_mass, state24_mass, state8_mass] + dsimp [hiddenRate] + ring + +end MatrixMultiplication.DualWitness + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/Entropy/BaseConditionalReaders.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/Entropy/BaseConditionalReaders.lean new file mode 100644 index 0000000000000000000000000000000000000000..0d8c8a5574a877c9761ee4dd6f81f08ce8e73ec2 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/Entropy/BaseConditionalReaders.lean @@ -0,0 +1,344 @@ +import OAI.LinearAlgebra.MatrixMultiplication.Tensor.BaseTensorBudgets +import OAI.LinearAlgebra.MatrixMultiplication.Completion.Labels + +namespace OAI + +/-! Finite entropy, rate estimates and ordered asymptotic limits. -/ + +noncomputable section + +namespace MatrixMultiplication.BaseConditionalReaders + +open MatrixMultiplication.Foundation CompletionLabels CompletionLabels.TopologicalFlatten +open scoped Classical + +universe u + +variable {X Y Z : Type u} + +def ConditionalLeaf (S : FlaggedTensor X Y Z) (c : Color) := + {a : Leaf S // CompletionLabels.leafColor S a = c} + +def view (S : FlaggedTensor X Y Z) (c : Color) (k : Color) + (a : ConditionalLeaf S c) : Coordinate X Y Z k := coordinate a.val.val k + +theorem conditional_flag (S : FlaggedTensor X Y Z) (c : Color) + (a : ConditionalLeaf S c) : ownerFlag S c (coordinate a.val.val c) := + (leafColor_eq_iff S a.val c).mp a.property + +def trivialSchedule (S : FlaggedTensor X Y Z) (c : Color) : + TopologicalSchedule (ConditionalLeaf S c) (Coordinate X Y Z) 0 where + arity := fun _ => 1 + readerPair := fun _ => .xy + active := fun _ _ => false + branch := fun _ _ => 0 + view := view S c + activate := fun _ _ => false + activate_correct := by intro n hn; omega + localFirst := fun _ _ => 0 + localSecond := fun _ _ => 0 + localFirst_read := by intro n hn; omega + localSecond_read := by intro n hn; omega + +theorem trivialSchedule_complete (S : FlaggedTensor X Y Z) (c : Color) + (h : Subsingleton (ConditionalLeaf S c)) : + (trivialSchedule S c).toNodeSchedule.Complete 0 := by + intro a b _ + exact h.allEq a b + +def binarySchedule {A : Type*} {Coord : Color → Type*} + (v : (c : Color) → A → Coord c) (pair : ReaderPair) + (choice : A → Fin 2) + (first : Coord (firstSide pair) → Fin 2) + (second : Coord (secondSide pair) → Fin 2) + (hfirst : ∀ a, first (v (firstSide pair) a) = choice a) + (hsecond : ∀ a, second (v (secondSide pair) a) = choice a) : + TopologicalSchedule A Coord 1 where + arity := fun | 0 => 2 | _ + 1 => 1 + readerPair := fun _ => pair + active := fun | 0, _ => true | _ + 1, _ => false + branch := fun | 0, a => choice a | _ + 1, _ => 0 + view := v + activate := fun | 0, _ => true | _ + 1, _ => false + activate_correct := by + intro n hn a + have hn0 : n = 0 := by omega + subst n + rfl + localFirst := fun | 0, u => first u | _ + 1, _ => 0 + localSecond := fun | 0, u => second u | _ + 1, _ => 0 + localFirst_read := by + intro n hn a _ + have hn0 : n = 0 := by omega + subst n + exact hfirst a + localSecond_read := by + intro n hn a _ + have hn0 : n = 0 := by omega + subst n + exact hsecond a + +theorem binarySchedule_complete {A : Type*} {Coord : Color → Type*} + (v : (c : Color) → A → Coord c) (pair : ReaderPair) + (choice : A → Fin 2) (first) (second) (hfirst) (hsecond) + (hinj : Function.Injective choice) : + (binarySchedule v pair choice first second hfirst hsecond).toNodeSchedule.Complete 1 := by + intro a b h + apply hinj + exact (h 0 (by omega)).2 rfl + +theorem baseTwo_subsingleton (c : Color) : + Subsingleton (ConditionalLeaf BaseTwo.flagged c) := by + refine ⟨?_⟩ + intro a b + have ha := conditional_flag BaseTwo.flagged c a + have hb := conditional_flag BaseTwo.flagged c b + have hsa := a.val.property + have hsb := b.val.property + apply Subtype.ext + apply Subtype.ext + cases c with + | B => + obtain ⟨hax, hay, haz⟩ := (BaseTwo.conditionalB _ _ _).mp ⟨hsa, ha⟩ + obtain ⟨hbx, hby, hbz⟩ := (BaseTwo.conditionalB _ _ _).mp ⟨hsb, hb⟩ + exact Prod.ext (hax.trans hbx.symm) (Prod.ext (hay.trans hby.symm) (haz.trans hbz.symm)) + | A => + obtain ⟨hax, hay, haz⟩ := (BaseTwo.conditionalA _ _ _).mp ⟨hsa, ha⟩ + obtain ⟨hbx, hby, hbz⟩ := (BaseTwo.conditionalA _ _ _).mp ⟨hsb, hb⟩ + exact Prod.ext (hax.trans hbx.symm) (Prod.ext (hay.trans hby.symm) (haz.trans hbz.symm)) + | C => + obtain ⟨hax, hay, haz⟩ := (BaseTwo.conditionalC _ _ _).mp ⟨hsa, ha⟩ + obtain ⟨hbx, hby, hbz⟩ := (BaseTwo.conditionalC _ _ _).mp ⟨hsb, hb⟩ + exact Prod.ext (hax.trans hbx.symm) (Prod.ext (hay.trans hby.symm) (haz.trans hbz.symm)) + +def baseTwo (c : Color) : + TopologicalSchedule (ConditionalLeaf BaseTwo.flagged c) + (Coordinate (Fin 2) (Fin 2) (Fin 2)) 0 := trivialSchedule BaseTwo.flagged c + +theorem baseTwo_complete (c : Color) : (baseTwo c).toNodeSchedule.Complete 0 := + trivialSchedule_complete BaseTwo.flagged c (baseTwo_subsingleton c) + +def aChoice (a : ConditionalLeaf BaseThree.flagged .A) : Fin 2 := + if a.val.val.2.1 = 0 then 0 else 1 + +def bChoice (a : ConditionalLeaf BaseThree.flagged .B) : Fin 2 := + if a.val.val.1 = 2 then 0 else 1 + +theorem aChoice_read (a : ConditionalLeaf BaseThree.flagged .A) : + (if a.val.val.2.2 = 2 then (0 : Fin 2) else 1) = aChoice a := by + have ha := conditional_flag BaseThree.flagged .A a + have h := BaseThree.readableA _ _ _ a.val.property ha + simp only [aChoice, ← h] + +theorem bChoice_read (a : ConditionalLeaf BaseThree.flagged .B) : + (if a.val.val.2.1 = 0 then (0 : Fin 2) else 1) = bChoice a := by + have hb := conditional_flag BaseThree.flagged .B a + have h := BaseThree.readableB _ _ _ a.val.property hb + simp only [bChoice, ← h] + +theorem aChoice_injective : Function.Injective aChoice := by + intro a b h + have ha := (BaseThree.conditionalA _ _ _).mp + ⟨a.val.property, conditional_flag BaseThree.flagged .A a⟩ + have hb := (BaseThree.conditionalA _ _ _).mp + ⟨b.val.property, conditional_flag BaseThree.flagged .A b⟩ + rcases ha with ⟨hax, ha | ha⟩ <;> rcases hb with ⟨hbx, hb | hb⟩ <;> + rcases ha with ⟨hay, haz⟩ <;> rcases hb with ⟨hby, hbz⟩ + all_goals + first + | apply Subtype.ext + apply Subtype.ext + exact Prod.ext (hax.trans hbx.symm) (Prod.ext (hay.trans hby.symm) (haz.trans hbz.symm)) + | simp [aChoice, hay, hby] at h + +theorem bChoice_injective : Function.Injective bChoice := by + intro a b h + have ha := (BaseThree.conditionalB _ _ _).mp + ⟨a.val.property, conditional_flag BaseThree.flagged .B a⟩ + have hb := (BaseThree.conditionalB _ _ _).mp + ⟨b.val.property, conditional_flag BaseThree.flagged .B b⟩ + rcases ha with ⟨haz, ha | ha⟩ <;> rcases hb with ⟨hbz, hb | hb⟩ <;> + rcases ha with ⟨hax, hay⟩ <;> rcases hb with ⟨hbx, hby⟩ + all_goals + first + | apply Subtype.ext + apply Subtype.ext + exact Prod.ext (hax.trans hbx.symm) (Prod.ext (hay.trans hby.symm) (haz.trans hbz.symm)) + | simp [bChoice, hax, hbx, Fin.ext_iff] at h + +def baseThreeA : + TopologicalSchedule (ConditionalLeaf BaseThree.flagged .A) + (Coordinate (Fin 3) (Fin 3) (Fin 3)) 1 := + binarySchedule (view BaseThree.flagged .A) .yz aChoice + (fun (y : Fin 3) => if y = 0 then 0 else 1) (fun (z : Fin 3) => if z = 2 then 0 else 1) + (fun _ => rfl) aChoice_read + +def baseThreeB : + TopologicalSchedule (ConditionalLeaf BaseThree.flagged .B) + (Coordinate (Fin 3) (Fin 3) (Fin 3)) 1 := + binarySchedule (view BaseThree.flagged .B) .xy bChoice + (fun (x : Fin 3) => if x = 2 then 0 else 1) (fun (y : Fin 3) => if y = 0 then 0 else 1) + (fun _ => rfl) bChoice_read + +theorem baseThreeA_complete : baseThreeA.toNodeSchedule.Complete 1 := by + unfold baseThreeA + exact binarySchedule_complete _ _ _ _ _ _ _ aChoice_injective + +theorem baseThreeB_complete : baseThreeB.toNodeSchedule.Complete 1 := by + unfold baseThreeB + exact binarySchedule_complete _ _ _ _ _ _ _ bChoice_injective + +theorem baseThreeC_subsingleton : Subsingleton (ConditionalLeaf BaseThree.flagged .C) := by + refine ⟨?_⟩ + intro a b + obtain ⟨hax, hay, haz⟩ := (BaseThree.conditionalC _ _ _).mp + ⟨a.val.property, conditional_flag BaseThree.flagged .C a⟩ + obtain ⟨hbx, hby, hbz⟩ := (BaseThree.conditionalC _ _ _).mp + ⟨b.val.property, conditional_flag BaseThree.flagged .C b⟩ + apply Subtype.ext + apply Subtype.ext + exact Prod.ext (hax.trans hbx.symm) (Prod.ext (hay.trans hby.symm) (haz.trans hbz.symm)) + +def baseThreeC : + TopologicalSchedule (ConditionalLeaf BaseThree.flagged .C) + (Coordinate (Fin 3) (Fin 3) (Fin 3)) 0 := trivialSchedule BaseThree.flagged .C + +theorem baseThreeC_complete : baseThreeC.toNodeSchedule.Complete 0 := + trivialSchedule_complete BaseThree.flagged .C baseThreeC_subsingleton + +def baseTwoProgram : + Program (Leaf BaseTwo.flagged) (Coordinate (Fin 2) (Fin 2) (Fin 2)) + Color (Fin 2) 0 where + context := CompletionLabels.leafColor BaseTwo.flagged + view := fun side a => coordinate a.val side + pair := fun _ => .xy + labels := fun _ _ => 0 + read := fun _ _ _ _ _ => 0 + readable := by intro n hn; omega + +theorem baseTwoProgram_complete : baseTwoProgram.Complete := by + intro a b hc _ + change CompletionLabels.leafColor BaseTwo.flagged a = + CompletionLabels.leafColor BaseTwo.flagged b at hc + let aa : ConditionalLeaf BaseTwo.flagged (CompletionLabels.leafColor BaseTwo.flagged a) := + ⟨a, rfl⟩ + let bb : ConditionalLeaf BaseTwo.flagged (CompletionLabels.leafColor BaseTwo.flagged a) := + ⟨b, hc.symm⟩ + exact congrArg Subtype.val ((baseTwo_subsingleton _).allEq aa bb) + +def aLabel (a : Leaf BaseThree.flagged) : Fin 2 := + if CompletionLabels.leafColor BaseThree.flagged a = .A then + if a.val.2.1 = 0 then 0 else 1 else 0 + +def bLabel (a : Leaf BaseThree.flagged) : Fin 2 := + if CompletionLabels.leafColor BaseThree.flagged a = .B then + if a.val.1 = 2 then 0 else 1 else 0 + +def aRead (side : Color) (ctx : Color) : Coordinate (Fin 3) (Fin 3) (Fin 3) side → Fin 2 := + match side with + | .B => fun _ => 0 + | .A => fun (z : Fin 3) => if ctx = .A then (if z = 2 then 0 else 1) else 0 + | .C => fun (y : Fin 3) => if ctx = .A then (if y = 0 then 0 else 1) else 0 + +def bRead (side : Color) (ctx : Color) : Coordinate (Fin 3) (Fin 3) (Fin 3) side → Fin 2 := + match side with + | .B => fun (x : Fin 3) => if ctx = .B then (if x = 2 then 0 else 1) else 0 + | .A => fun _ => 0 + | .C => fun (y : Fin 3) => if ctx = .B then (if y = 0 then 0 else 1) else 0 + +theorem aRead_correct (a : Leaf BaseThree.flagged) (side : Color) + (hs : side = firstSide .yz ∨ side = secondSide .yz) : + aRead side (CompletionLabels.leafColor BaseThree.flagged a) (coordinate a.val side) = + aLabel a := by + cases side with + | B => rcases hs with h | h <;> cases h + | A => + by_cases ha : CompletionLabels.leafColor BaseThree.flagged a = .A + · have hf := (leafColor_eq_iff BaseThree.flagged a .A).mp ha + have h := BaseThree.readableA _ _ _ a.property hf + simp only [aRead, aLabel, ha, ite_true, coordinate, ← h] + · simp [aRead, aLabel, ha] + | C => rfl + +theorem bRead_correct (a : Leaf BaseThree.flagged) (side : Color) + (hs : side = firstSide .xy ∨ side = secondSide .xy) : + bRead side (CompletionLabels.leafColor BaseThree.flagged a) (coordinate a.val side) = + bLabel a := by + cases side with + | B => rfl + | A => rcases hs with h | h <;> cases h + | C => + by_cases hb : CompletionLabels.leafColor BaseThree.flagged a = .B + · have hf := (leafColor_eq_iff BaseThree.flagged a .B).mp hb + have h := BaseThree.readableB _ _ _ a.property hf + simp only [bRead, bLabel, hb, ite_true, coordinate, ← h] + · simp [bRead, bLabel, hb] + +def baseThreeProgram : + Program (Leaf BaseThree.flagged) (Coordinate (Fin 3) (Fin 3) (Fin 3)) + Color (Fin 2) 2 where + context := CompletionLabels.leafColor BaseThree.flagged + view := fun side a => coordinate a.val side + pair := fun | 0 => .yz | _ + 1 => .xy + labels := fun | 0, a => aLabel a | 1, a => bLabel a | _ + 2, _ => 0 + read := fun + | 0, side, ctx, _, own => aRead side ctx own + | 1, side, ctx, _, own => bRead side ctx own + | _ + 2, _, _, _, _ => 0 + readable := by + intro n hn a side hs + have hn2 : n = 0 ∨ n = 1 := by omega + rcases hn2 with rfl | rfl + · exact aRead_correct a side hs + · exact bRead_correct a side hs + +theorem baseThreeProgram_complete : baseThreeProgram.Complete := by + intro a b hc hl + change CompletionLabels.leafColor BaseThree.flagged a = + CompletionLabels.leafColor BaseThree.flagged b at hc + cases ha : CompletionLabels.leafColor BaseThree.flagged a with + | A => + have hb : CompletionLabels.leafColor BaseThree.flagged b = .A := hc.symm.trans ha + let aa : ConditionalLeaf BaseThree.flagged .A := ⟨a, ha⟩ + let bb : ConditionalLeaf BaseThree.flagged .A := ⟨b, hb⟩ + have hh := hl 0 (by omega) + change aLabel a = aLabel b at hh + have he : aChoice aa = aChoice bb := by + simpa only [aLabel, ha, hb, ite_true, aChoice, aa, bb] using hh + exact congrArg Subtype.val (aChoice_injective he) + | B => + have hb : CompletionLabels.leafColor BaseThree.flagged b = .B := hc.symm.trans ha + let aa : ConditionalLeaf BaseThree.flagged .B := ⟨a, ha⟩ + let bb : ConditionalLeaf BaseThree.flagged .B := ⟨b, hb⟩ + have hh := hl 1 (by omega) + change bLabel a = bLabel b at hh + have he : bChoice aa = bChoice bb := by + simpa only [bLabel, ha, hb, ite_true, bChoice, aa, bb] using hh + exact congrArg Subtype.val (bChoice_injective he) + | C => + have hb : CompletionLabels.leafColor BaseThree.flagged b = .C := hc.symm.trans ha + let aa : ConditionalLeaf BaseThree.flagged .C := ⟨a, ha⟩ + let bb : ConditionalLeaf BaseThree.flagged .C := ⟨b, hb⟩ + exact congrArg Subtype.val (baseThreeC_subsingleton.allEq aa bb) + +def baseTwoReadable : ReadableTensor BaseTwo.flagged where + Code := Fin 2 + depth := 0 + program := baseTwoProgram + context_eq _ := rfl + view_eq _ _ := rfl + complete := baseTwoProgram_complete + +def baseThreeReadable : ReadableTensor BaseThree.flagged where + Code := Fin 2 + depth := 2 + program := baseThreeProgram + context_eq _ := rfl + view_eq _ _ := rfl + complete := baseThreeProgram_complete + +end MatrixMultiplication.BaseConditionalReaders + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/Entropy/ComplexAnalyticValue.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/Entropy/ComplexAnalyticValue.lean new file mode 100644 index 0000000000000000000000000000000000000000..daee62f27424f1e30c77d3c5de4c9b0d11d9a7ea --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/Entropy/ComplexAnalyticValue.lean @@ -0,0 +1,351 @@ +import Mathlib.Analysis.Convex.Function +import Mathlib.Analysis.Convex.Topology +import Mathlib.Algebra.BigOperators.Field +import Mathlib.Analysis.SpecialFunctions.Log.Basic +import Mathlib.Topology.Order.Monotone +import Mathlib.Topology.Semicontinuity.Basic +import Mathlib.Topology.Instances.Real.Lemmas +import Mathlib.Tactic.FieldSimp +import Mathlib.Tactic.Linarith +import Mathlib.Tactic.Ring + +namespace OAI + +/-! Finite entropy, rate estimates and ordered asymptotic limits. -/ + +noncomputable section + +open Set Filter +open scoped Topology BigOperators + +namespace MatrixMultiplication.Foundation + +theorem unitInterval_subset_closure_rat : + Icc (0 : ℝ) 1 ⊆ closure (((↑) : ℚ → ℝ) '' Icc 0 1) := by + have hinterior : Ioo (0 : ℝ) 1 ⊆ closure (((↑) : ℚ → ℝ) '' Icc 0 1) := by + intro x hx + rw [mem_closure_iff] + intro U hU hxU + obtain ⟨z, hz, hzrat⟩ := Rat.denseRange_cast.inter_open_nonempty + (U ∩ Ioo (0 : ℝ) 1) (hU.inter isOpen_Ioo) ⟨x, hxU, hx⟩ + obtain ⟨q, rfl⟩ := hzrat + refine ⟨(q : ℝ), hz.1, q, ?_, rfl⟩ + constructor + · exact Rat.cast_nonneg.mp hz.2.1.le + · exact Rat.cast_le.mp (by simpa using hz.2.2.le) + have hclosed := closure_minimal hinterior isClosed_closure + simpa only [closure_Ioo (show (0 : ℝ) ≠ 1 by norm_num)] using hclosed + +structure FiniteConstructionRates where + occurrences : ℕ + multiplicity : ℕ + auxiliaryRank : ℕ + volume : ℕ + occurrences_pos : 0 < occurrences + multiplicity_pos : 0 < multiplicity + auxiliaryRank_pos : 0 < auxiliaryRank + volume_pos : 0 < volume + +def FiniteConstructionRates.score (r : FiniteConstructionRates) (β : ℝ) : ℝ := + (Real.log r.multiplicity - Real.log r.auxiliaryRank + + (β / 3) * Real.log r.volume) / r.occurrences + +structure AttainableFamily (C X : Type*) where + law : C → X + score : C → ℝ + +def finiteConstructionFamily {C X : Type*} (β : ℝ) (law : C → X) + (rates : C → FiniteConstructionRates) : AttainableFamily C X := + ⟨law, fun c => (rates c).score β⟩ + +namespace AttainableFamily + +variable {C X : Type*} [TopologicalSpace X] (A : AttainableFamily C X) + +def pairs : Set (X × ℝ) := + {p | ∃ c, A.law c = p.1 ∧ p.2 ≤ A.score c} + +def closedPairs : Set (X × ℝ) := closure A.pairs + +def fiber (x : X) : Set ℝ := {t | (x, t) ∈ A.closedPairs} + +def value (x : X) : ℝ := sSup (A.fiber x) + +theorem finite_mem_closedPairs (c : C) : (A.law c, A.score c) ∈ A.closedPairs := + subset_closure ⟨c, rfl, le_rfl⟩ + +theorem closedPairs_law_mem_of_isClosed {s : Set X} (hs : IsClosed s) + (hlaw : ∀ c, A.law c ∈ s) : ∀ p ∈ A.closedPairs, p.1 ∈ s := by + apply closure_minimal + · rintro p ⟨c, hc, _⟩ + change p.1 ∈ s + rw [← hc] + exact hlaw c + · exact hs.preimage continuous_fst + +theorem closedPairs_downward {x : X} {u v : ℝ} + (hu : (x, u) ∈ A.closedPairs) (hvu : v ≤ u) : + (x, v) ∈ A.closedPairs := by + let T : X × ℝ → X × ℝ := fun p => (p.1, p.2 - (u - v)) + have hT : Continuous T := + continuous_fst.prodMk (continuous_snd.sub continuous_const) + have himage : T '' A.pairs ⊆ A.pairs := by + rintro _ ⟨p, ⟨c, hc, hscore⟩, rfl⟩ + exact ⟨c, hc, by dsimp [T]; linarith⟩ + have hmem : T (x, u) ∈ closure (T '' A.pairs) := + image_closure_subset_closure_image hT ⟨(x, u), hu, rfl⟩ + have := closure_mono himage hmem + simpa [T, closedPairs] using this + +theorem isClosed_fiber (x : X) : IsClosed (A.fiber x) := + isClosed_closure.preimage (continuous_const.prodMk continuous_id) + +theorem value_mem_closedPairs (x : X) (hne : (A.fiber x).Nonempty) + (hbound : BddAbove (A.fiber x)) : (x, A.value x) ∈ A.closedPairs := + (A.isClosed_fiber x).csSup_mem hne hbound + +theorem mem_closedPairs_iff_le_value (x : X) (hne : (A.fiber x).Nonempty) + (hbound : BddAbove (A.fiber x)) (t : ℝ) : + (x, t) ∈ A.closedPairs ↔ t ≤ A.value x := by + constructor + · exact fun ht => le_csSup hbound ht + · exact fun ht => A.closedPairs_downward (A.value_mem_closedPairs x hne hbound) ht + +theorem closedPairs_le_continuous_cap (H : X → ℝ) (hH : Continuous H) + (hcap : ∀ c, A.score c ≤ H (A.law c)) : + ∀ p ∈ A.closedPairs, p.2 ≤ H p.1 := by + apply closure_minimal + · rintro p ⟨c, hc, ht⟩ + exact ht.trans (hc ▸ hcap c) + · exact isClosed_le continuous_snd (hH.comp continuous_fst) + +theorem value_le_continuous_cap (H : X → ℝ) (hH : Continuous H) + (hcap : ∀ c, A.score c ≤ H (A.law c)) (x : X) + (hne : (A.fiber x).Nonempty) : A.value x ≤ H x := + csSup_le hne (fun _ ht => A.closedPairs_le_continuous_cap H hH hcap _ ht) + +theorem value_nonneg (x : X) (hzero : (x, 0) ∈ A.closedPairs) + (hbound : BddAbove (A.fiber x)) : 0 ≤ A.value x := + le_csSup hbound hzero + +theorem upperSemicontinuous_value + (hne : ∀ x, (A.fiber x).Nonempty) (hbound : ∀ x, BddAbove (A.fiber x)) : + UpperSemicontinuous A.value := by + intro x b hb + have hnot : (x, b) ∉ A.closedPairs := by + intro hmem + exact (not_le_of_gt hb) + ((A.mem_closedPairs_iff_le_value x (hne x) (hbound x) b).mp hmem) + have hclosed : IsClosed {y : X | (y, b) ∈ A.closedPairs} := + isClosed_closure.preimage (continuous_id.prodMk continuous_const) + have hnear : ∀ᶠ y in 𝓝 x, (y, b) ∉ A.closedPairs := + hclosed.isOpen_compl.mem_nhds hnot + filter_upwards [hnear] with y hy + exact lt_of_not_ge (fun hle => + hy ((A.mem_closedPairs_iff_le_value y (hne y) (hbound y) b).mpr hle)) + +theorem upperSemicontinuous_value_comp {Y : Type*} [TopologicalSpace Y] + (α : Y → X) (hα : Continuous α) + (hne : ∀ y, (A.fiber (α y)).Nonempty) + (hbound : ∀ y, BddAbove (A.fiber (α y))) : + UpperSemicontinuous (fun y => A.value (α y)) := by + intro y b hb + have hnot : (α y, b) ∉ A.closedPairs := by + intro hmem + exact (not_le_of_gt hb) + ((A.mem_closedPairs_iff_le_value (α y) (hne y) (hbound y) b).mp hmem) + have hclosed : IsClosed {z : Y | (α z, b) ∈ A.closedPairs} := + isClosed_closure.preimage (hα.prodMk continuous_const) + have hnear : ∀ᶠ z in 𝓝 y, (α z, b) ∉ A.closedPairs := + hclosed.isOpen_compl.mem_nhds hnot + filter_upwards [hnear] with z hz + exact lt_of_not_ge (fun hle => + hz ((A.mem_closedPairs_iff_le_value (α z) (hne z) (hbound z) b).mpr hle)) + +theorem exists_finite_in_open_gt {x : X} {b : ℝ} (hne : (A.fiber x).Nonempty) + (hb : b < A.value x) {U : Set X} (hU : IsOpen U) (hx : x ∈ U) : + ∃ c, A.law c ∈ U ∧ b < A.score c := by + obtain ⟨t, ht, hbt⟩ := exists_lt_of_lt_csSup hne hb + have hopen : IsOpen (U ×ˢ Ioi b) := hU.prod isOpen_Ioi + obtain ⟨p, hpU, hpA⟩ := mem_closure_iff.mp ht (U ×ˢ Ioi b) hopen ⟨hx, hbt⟩ + obtain ⟨c, hc, hscore⟩ := hpA + refine ⟨c, hc.symm ▸ hpU.1, lt_of_lt_of_le hpU.2 hscore⟩ + +theorem exists_finite_gt {x : X} {b : ℝ} (hne : (A.fiber x).Nonempty) + (hb : b < A.value x) : ∃ c, b < A.score c := by + obtain ⟨c, _, hc⟩ := A.exists_finite_in_open_gt hne hb isOpen_univ (mem_univ x) + exact ⟨c, hc⟩ + +section Concavity + +variable [AddCommGroup X] [Module ℝ X] + +theorem concaveOn_value (s : Set X) (hs : Convex ℝ s) + (hne : ∀ x ∈ s, (A.fiber x).Nonempty) + (hbound : ∀ x ∈ s, BddAbove (A.fiber x)) + (hmix : Convex ℝ A.closedPairs) : ConcaveOn ℝ s A.value := by + refine ⟨hs, ?_⟩ + intro x hx y hy a b ha hb hab + have hpair := hmix (A.value_mem_closedPairs x (hne x hx) (hbound x hx)) + (A.value_mem_closedPairs y (hne y hy) (hbound y hy)) ha hb hab + exact le_csSup (hbound _ (hs hx hy ha hb hab)) hpair + +end Concavity + +section RationalMixtures + +variable [AddCommGroup X] [Module ℝ X] [ContinuousAdd X] [ContinuousSMul ℝ X] + +theorem closedPairs_convex_of_rational_mixing + (hmix : ∀ c d : C, ∀ q : ℚ, q ∈ Icc 0 1 → + (q : ℝ) • (A.law c, A.score c) + + (1 - (q : ℝ)) • (A.law d, A.score d) ∈ A.pairs) : + Convex ℝ A.closedPairs := by + have hfull : ∀ c d : C, ∀ t : ℝ, t ∈ Icc 0 1 → + t • (A.law c, A.score c) + (1 - t) • (A.law d, A.score d) ∈ + A.closedPairs := by + intro c d t ht + let T : ℝ → X × ℝ := fun u => + u • (A.law c, A.score c) + (1 - u) • (A.law d, A.score d) + have hT : Continuous T := + (continuous_id.smul continuous_const).add + ((continuous_const.sub continuous_id).smul continuous_const) + have himage : T '' (((↑) : ℚ → ℝ) '' Icc 0 1) ⊆ A.pairs := by + rintro _ ⟨_, ⟨q, hq, rfl⟩, rfl⟩ + exact hmix c d q hq + exact closure_mono himage + (image_closure_subset_closure_image hT ⟨t, unitInterval_subset_closure_rat ht, rfl⟩) + intro x hx y hy a b ha hb hab + have hb_eq : b = 1 - a := by linarith + subst b + have ha1 : a ≤ 1 := by linarith + let T : (X × ℝ) → (X × ℝ) → X × ℝ := fun p q => a • p + (1 - a) • q + have hT : Continuous (Function.uncurry T) := by + change Continuous (fun p : (X × ℝ) × (X × ℝ) => a • p.1 + (1 - a) • p.2) + have hfst : Continuous (fun p : (X × ℝ) × (X × ℝ) => a • p.1) := + continuous_fst.const_smul a + have hsnd : Continuous (fun p : (X × ℝ) × (X × ℝ) => (1 - a) • p.2) := + continuous_snd.const_smul (1 - a) + exact hfst.add hsnd + have hseed : ∀ p ∈ A.pairs, ∀ q ∈ A.pairs, T p q ∈ A.closedPairs := by + rintro p ⟨c, hc, hp⟩ q ⟨d, hd, hq⟩ + have h := hfull c d a ⟨ha, ha1⟩ + have hlaw : a • A.law c + (1 - a) • A.law d = + a • p.1 + (1 - a) • q.1 := by rw [hc, hd] + have hscore : a * p.2 + (1 - a) * q.2 ≤ + a * A.score c + (1 - a) * A.score d := + add_le_add (mul_le_mul_of_nonneg_left hp ha) + (mul_le_mul_of_nonneg_left hq hb) + change (a • A.law c + (1 - a) • A.law d, + a * A.score c + (1 - a) * A.score d) ∈ A.closedPairs at h + rw [hlaw] at h + exact A.closedPairs_downward h hscore + have hresult : T x y ∈ closure A.closedPairs := map_mem_closure₂ hT hx hy hseed + simpa only [closedPairs, closure_closure] using hresult + +end RationalMixtures +end AttainableFamily + +private abbrev realSimplex (ι : Type*) [Fintype ι] : Set (ι → ℝ) := + {weights | (∀ index, 0 ≤ weights index) ∧ ∑ index, weights index = 1} + +private theorem convex_realSimplex (ι : Type*) [Fintype ι] : + Convex ℝ (realSimplex ι) := by + intro left hleft right hright leftWeight rightWeight hleftWeight hrightWeight hsum + refine ⟨fun index => add_nonneg (mul_nonneg hleftWeight (hleft.1 index)) + (mul_nonneg hrightWeight (hright.1 index)), ?_⟩ + simp only [Pi.add_apply, Pi.smul_apply, smul_eq_mul, Finset.sum_add_distrib, + ← Finset.mul_sum, hleft.2, hright.2, mul_one, hsum] + +theorem simplex_residual {ι : Type*} [Fintype ι] {x y : ι → ℝ} + (hx : x ∈ realSimplex ι) (hy : y ∈ realSimplex ι) + {ε : ℝ} (hε : 0 < ε) (hdom : ∀ i, (1 - ε) * x i ≤ y i) : + (fun i => (y i - (1 - ε) * x i) / ε) ∈ realSimplex ι := by + refine ⟨fun i => div_nonneg (sub_nonneg.mpr (hdom i)) hε.le, ?_⟩ + rw [← Finset.sum_div, Finset.sum_sub_distrib, ← Finset.mul_sum, hx.2, hy.2] + field_simp [ne_of_gt hε] + ring + +theorem concave_simplex_domination {ι : Type*} [Fintype ι] {F : (ι → ℝ) → ℝ} + (hF : ConcaveOn ℝ (realSimplex ι) F) + (hzero : ∀ x ∈ realSimplex ι, 0 ≤ F x) + {x y : ι → ℝ} (hx : x ∈ realSimplex ι) (hy : y ∈ realSimplex ι) + {ε : ℝ} (hε : 0 < ε) (hε1 : ε ≤ 1) + (hdom : ∀ i, (1 - ε) * x i ≤ y i) : (1 - ε) * F x ≤ F y := by + let r : ι → ℝ := fun i => (y i - (1 - ε) * x i) / ε + have hr : r ∈ realSimplex ι := simplex_residual hx hy hε hdom + have hmix : (1 - ε) • x + ε • r = y := by + funext i + dsimp [r] + field_simp [ne_of_gt hε] + ring + have hconc := hF.2 hx hr (sub_nonneg.mpr hε1) hε.le (by ring) + rw [hmix] at hconc + change (1 - ε) * F x + ε * F r ≤ F y at hconc + exact le_trans (le_add_of_nonneg_right (mul_nonneg hε.le (hzero r hr))) hconc + +theorem lowerSemicontinuousOn_nonneg_concave_simplex {ι : Type*} [Fintype ι] + {F : (ι → ℝ) → ℝ} (hF : ConcaveOn ℝ (realSimplex ι) F) + (hzero : ∀ x ∈ realSimplex ι, 0 ≤ F x) : + LowerSemicontinuousOn F (realSimplex ι) := by + intro x hx b hb + by_cases hb0 : b < 0 + · filter_upwards [self_mem_nhdsWithin] with y hy + exact lt_of_lt_of_le hb0 (hzero y hy) + have hbnonneg : 0 ≤ b := le_of_not_gt hb0 + have hxpos : 0 < F x := lt_of_le_of_lt hbnonneg hb + let ε : ℝ := (F x - b) / (2 * F x) + have hden : 0 < 2 * F x := mul_pos (by norm_num) hxpos + have hε : 0 < ε := div_pos (sub_pos.mpr hb) hden + have hε1 : ε ≤ 1 := by + apply (div_le_iff₀ hden).2 + linarith + have hεeq : ε * (2 * F x) = F x - b := div_mul_cancel₀ _ (ne_of_gt hden) + have hgap : b < (1 - ε) * F x := by nlinarith + have hdom : ∀ᶠ y in 𝓝[realSimplex ι] x, ∀ i, (1 - ε) * x i ≤ y i := by + apply Filter.eventually_all.2 + intro i + by_cases hxi : x i = 0 + · filter_upwards [self_mem_nhdsWithin] with y hy + simpa [hxi] using hy.1 i + have hxipos : 0 < x i := lt_of_le_of_ne (hx.1 i) (Ne.symm hxi) + have hlt : (1 - ε) * x i < x i := by nlinarith + have hev : ∀ᶠ y : ι → ℝ in 𝓝 x, (1 - ε) * x i < y i := + (continuous_apply i).continuousAt.eventually (lt_mem_nhds hlt) + exact (hev.filter_mono nhdsWithin_le_nhds).mono (fun _ h => h.le) + filter_upwards [self_mem_nhdsWithin, hdom] with y hy hdomy + exact lt_of_lt_of_le hgap (concave_simplex_domination hF hzero hx hy hε hε1 hdomy) + +theorem lowerSemicontinuous_comp_of_mem {X Y : Type*} [TopologicalSpace X] + [TopologicalSpace Y] {s : Set X} {F : X → ℝ} + (hF : LowerSemicontinuousOn F s) (α : Y → X) (hα : Continuous α) + (hmem : ∀ y, α y ∈ s) : LowerSemicontinuous (fun y => F (α y)) := by + intro y b hb + have ht : Tendsto α (𝓝 y) (𝓝[s] α y) := + tendsto_nhdsWithin_iff.mpr ⟨hα.continuousAt, Eventually.of_forall hmem⟩ + exact ht.eventually (hF (α y) (hmem y) b hb) + +theorem AttainableFamily.continuous_value_on_simplex_chart {C Y ι : Type*} + [TopologicalSpace Y] [Fintype ι] (A : AttainableFamily C (ι → ℝ)) + (hzero : ∀ x ∈ realSimplex ι, (x, 0) ∈ A.closedPairs) + (hbound : ∀ x ∈ realSimplex ι, BddAbove (A.fiber x)) + (hmix : Convex ℝ A.closedPairs) + (α : Y → (ι → ℝ)) (hα : Continuous α) + (hmem : ∀ y, α y ∈ realSimplex ι) : + Continuous (fun y => A.value (α y)) := by + have hne : ∀ x ∈ realSimplex ι, (A.fiber x).Nonempty := + fun x hx => ⟨0, hzero x hx⟩ + have hconc := A.concaveOn_value _ (convex_realSimplex ι) hne hbound hmix + have hnonneg : ∀ x ∈ realSimplex ι, 0 ≤ A.value x := + fun x hx => A.value_nonneg x (hzero x hx) (hbound x hx) + exact continuous_iff_lower_upperSemicontinuous.mpr + ⟨lowerSemicontinuous_comp_of_mem + (lowerSemicontinuousOn_nonneg_concave_simplex hconc hnonneg) α hα hmem, + A.upperSemicontinuous_value_comp α hα + (fun y => hne _ (hmem y)) (fun y => hbound _ (hmem y))⟩ + +end MatrixMultiplication.Foundation + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/Entropy/ComplexAsymptoticRecurrence.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/Entropy/ComplexAsymptoticRecurrence.lean new file mode 100644 index 0000000000000000000000000000000000000000..050bbc293f2846910264e9472417a66c171a0534 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/Entropy/ComplexAsymptoticRecurrence.lean @@ -0,0 +1,39 @@ +import Mathlib.Basic.Real.Basic +import Mathlib.Tactic.FieldSimp +import Mathlib.Tactic.Linarith +import Mathlib.Tactic.Ring + +namespace OAI + +/-! Finite entropy, rate estimates and ordered asymptotic limits. -/ + +namespace MatrixMultiplication.Foundation + +theorem affine_recurrence_shifted (x : ℕ → ℝ) (a c : ℝ) (ha : 0 ≤ a) + (hstep : ∀ t, x (t + 1) ≤ a * x t + (a - 1) * c) : + ∀ t, x t + c ≤ a ^ t * (x 0 + c) := by + intro t + induction t with + | zero => simp + | succ t ih => + calc + x (t + 1) + c ≤ a * x t + (a - 1) * c + c := add_le_add_left (hstep t) c + _ = a * (x t + c) := by ring + _ ≤ a * (a ^ t * (x 0 + c)) := mul_le_mul_of_nonneg_left ih ha + _ = a ^ (t + 1) * (x 0 + c) := by rw [pow_succ]; ring + +theorem affine_recurrence_bound (x : ℕ → ℝ) (a b : ℝ) (ha : 1 < a) (hb : 0 ≤ b) + (hstep : ∀ t, x (t + 1) ≤ a * x t + b) : + ∀ t, x t ≤ a ^ t * (x 0 + b / (a - 1)) := by + have hpos : 0 < a - 1 := sub_pos.mpr ha + have hcancel : (a - 1) * (b / (a - 1)) = b := by + field_simp [ne_of_gt hpos] + have hshift := affine_recurrence_shifted x a (b / (a - 1)) (by linarith) + (fun t => by rw [hcancel]; exact hstep t) + intro t + have hc : 0 ≤ b / (a - 1) := div_nonneg hb hpos.le + exact (le_add_of_nonneg_right hc).trans (hshift t) + +end MatrixMultiplication.Foundation + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/Entropy/ComplexConditionalHierarchyStage.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/Entropy/ComplexConditionalHierarchyStage.lean new file mode 100644 index 0000000000000000000000000000000000000000..e0db4671c641dee97f0dc16af88ddc057f013fc2 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/Entropy/ComplexConditionalHierarchyStage.lean @@ -0,0 +1,261 @@ +import OAI.LinearAlgebra.MatrixMultiplication.Polynomial.ComplexPrefixSeparationPolynomialStage +import OAI.LinearAlgebra.MatrixMultiplication.Polynomial.ComplexPolynomialKernelExecution +import OAI.LinearAlgebra.MatrixMultiplication.Separation.ComplexStageHierarchyResources +import OAI.LinearAlgebra.MatrixMultiplication.Entropy.ComplexConditionalPrefixWords + +namespace OAI + +/-! Finite entropy, rate estimates and ordered asymptotic limits. -/ + +noncomputable section + +namespace MatrixMultiplication.Foundation.ConditionalHierarchyStage + +open Tensor PolynomialLocalConstruction PolynomialKernelExecution +open PrefixSeparationPolynomialStage LabelHierarchySeparation + +variable {Prefix RawLabel X Y Z : Type*} [DecidableEq RawLabel] + +def decodePool (pool : Prefix → Finset RawLabel) (k : ℕ) + (counts : ∀ p, (pool p).card = k) (p : Prefix) (q : Fin k) : RawLabel := + ((poolEnumeration pool k counts p).symm q).val + +omit [DecidableEq RawLabel] in +theorem decodePool_mem (pool : Prefix → Finset RawLabel) (k : ℕ) + (counts : ∀ p, (pool p).card = k) (p : Prefix) (q : Fin k) : + decodePool pool k counts p q ∈ pool p := + ((poolEnumeration pool k counts p).symm q).property + +theorem decodePool_eq_iff (pool : Prefix → Finset RawLabel) (k : ℕ) + (positive : 0 < k) (counts : ∀ p, (pool p).card = k) + (p : Prefix) (q : Fin k) (s : RawLabel) : + decodePool pool k counts p q = s ↔ + s ∈ pool p ∧ q = maskedPoolCode pool k positive counts p s := by + classical + constructor + · intro h + have hs : s ∈ pool p := h ▸ decodePool_mem pool k counts p q + refine ⟨hs, ?_⟩ + have hsub : (poolEnumeration pool k counts p).symm q = ⟨s, hs⟩ := + Subtype.ext h + have hcode := congrArg (poolEnumeration pool k counts p) hsub + simpa [maskedPoolCode, hs] using hcode + · rintro ⟨hs, rfl⟩ + exact maskedPoolCode_decode pool k positive counts p s hs + +def decodedLeading (pool : Prefix → Finset RawLabel) (k : ℕ) + (counts : ∀ p, (pool p).card = k) + (fine : Prefix → X → Y → Z → RawLabel) (p : Prefix) : + Tensor ℂ (X × InformedOutput k) (Y × InformedOutput k) + (Z × MissingOutput k) := by + classical + exact fun x y z => if + x.2.1 = y.2.1 ∧ x.2.1 = z.2.1 ∧ + decodePool pool k counts p x.2.1 = fine p x.1 y.1 z.1 ∧ x.2.2 = y.2.2 + then 1 else 0 + +theorem rawPoolLeading_eq_decodedLeading (pool : Prefix → Finset RawLabel) (k : ℕ) + (positive : 0 < k) (counts : ∀ p, (pool p).card = k) + (readX : Prefix → X → RawLabel) (readY : Prefix → Y → RawLabel) + (fine : Prefix → X → Y → Z → RawLabel) (p : Prefix) + (x : X × InformedOutput k) (y : Y × InformedOutput k) (z : Z × MissingOutput k) + (hx : readX p x.1 = fine p x.1 y.1 z.1) + (hy : readY p y.1 = fine p x.1 y.1 z.1) : + rawPoolLeading pool k positive counts readX readY p x y z = + decodedLeading pool k counts fine p x y z := by + classical + unfold rawPoolLeading stageLeading decodedLeading + simp only [hx, hy] + congr 1 + apply propext + constructor + · rintro ⟨⟨hmem, hxc⟩, ⟨_, hyc⟩, _, hcz, hij⟩ + exact ⟨hxc.trans hyc.symm, hxc.trans hcz, + (decodePool_eq_iff pool k positive counts p x.2.1 _).mpr ⟨hmem, hxc⟩, hij⟩ + · rintro ⟨hxy, hxz, hdecode, hij⟩ + obtain ⟨hmem, hxc⟩ := (decodePool_eq_iff pool k positive counts p x.2.1 _).mp hdecode + exact ⟨⟨hmem, hxc⟩, ⟨hmem, hxy.symm.trans hxc⟩, trivial, + hxc.symm.trans hxz, hij⟩ + +section ExecutionStage + +variable {PX PY PZ AX AY AZ : Type*} +variable [Fintype AX] [Fintype AY] [Fintype AZ] +variable {support : X → Y → Z → Prop} + +theorem exists_rawPoolStage + (E : Execution X Y Z Prefix PX PY PZ AX AY AZ support) + (pool : Prefix → Finset RawLabel) (k : ℕ) (positive : 0 < k) + (counts : ∀ p, (pool p).card = k) + (readX : Prefix → X → RawLabel) (readY : Prefix → Y → RawLabel) + (eligible : Prefix → X → Y → Z → Prop) + (previous : ∀ x y z, support x.1 y.1 z.1 → E.value x y z ≠ 0 → + eligible x.2.1 x.1 y.1 z.1) + (agree : ∀ p x y z, eligible p x y z → readX p x = readY p y) : + ∃ S : Stage E (Fin k) (Fin k) (Fin k) PUnit + (PoolAuxiliaryGroup k) (PoolAuxiliaryGroup k) (PoolAuxiliaryGroup k), + S.auxiliary = poolAuxiliaryTensor k ∧ + S.rankBound = poolAuxiliaryCost k ∧ S.order = 0 ∧ + S.leftDegree = 0 ∧ S.middleDegree = 0 ∧ S.rightDegree = 0 ∧ + S.value = rawPoolLeading pool k positive counts readX readY := by + classical + obtain ⟨MX, MY, MZ, hMX, hMY, hMZ, hkernel⟩ := + exists_raw_pool_stage pool k positive counts readX readY eligible agree + let S : Stage E (Fin k) (Fin k) (Fin k) PUnit + (PoolAuxiliaryGroup k) (PoolAuxiliaryGroup k) (PoolAuxiliaryGroup k) := { + auxiliary := poolAuxiliaryTensor k + rankBound := poolAuxiliaryCost k + auxiliary_rank := poolAuxiliaryTensor_rankAtMost k + order := 0 + leftDegree := 0 + middleDegree := 0 + rightDegree := 0 + leftMap := MX + middleMap := MY + rightMap := MZ + left_degree := hMX + middle_degree := hMY + right_degree := hMZ + eligible := eligible + previous_eligible := previous + value := rawPoolLeading pool k positive counts readX readY + vanishes := by + intro _ _ _ _ _ j hj + exact (Nat.not_lt_zero j hj).elim + leading := by + intro p x y z he + rw [hkernel p x y z he] + exact Polynomial.coeff_C_zero + synchronized := by + intro p x y z he hn + have hread := agree p x.1 y.1 z.1 he + have hcodes : maskedPoolCode pool k positive counts p (readX p x.1) = + maskedPoolCode pool k positive counts p (readY p y.1) := congrArg _ hread + have hsync := stageLeading_synchronized k _ _ _ _ _ p x y z hcodes hn + exact ⟨hsync.1, hsync.2.1⟩ + } + exact ⟨S, rfl, rfl, rfl, rfl, rfl, rfl, rfl⟩ + +end ExecutionStage + +section ExactConditionalPools + +open ConditionalPrefixWords StageHierarchyResources LabelHierarchyCounts + +variable {A Position : Type*} [Fintype A] [Fintype Position] +variable {Label : ℕ → Type*} [∀ n, Fintype (Label n)] +variable (counts : A → ℕ) (labels : ∀ n, A → Label n) (n t : ℕ) + +local instance (priority := low) {B : Type*} : DecidableEq B := Classical.decEq B + +def actualPool + (priorWord : Prefix → ExactPrefix counts labels n t Position) : + Prefix → Finset (Position → Label n) := + fun p => conditionalFinset (priorWord p) + +theorem actualPool_card + (priorWord : Prefix → ExactPrefix counts labels n t Position) (p : Prefix) : + (actualPool counts labels n t priorWord p).card = stageRefinementCount counts labels n t := + conditionalFinset_card (priorWord p) + +def nextPrefixDecoder + (priorWord : Prefix → ExactPrefix counts labels n t Position) : + Prefix × Fin (stageRefinementCount counts labels n t) → + ExactPrefix counts labels (n + 1) t Position := + fun p => appendCode (priorWord p.1) p.2 + +theorem nextPrefixDecoder_injective + (priorWord : Prefix → ExactPrefix counts labels n t Position) + (hinj : Function.Injective priorWord) : + Function.Injective (nextPrefixDecoder counts labels n t priorWord) := by + intro p q hpq + have h : (priorWord p.1, p.2) = (priorWord q.1, q.2) := by + apply appendCode_injective + exact hpq + obtain ⟨hprior, hcode⟩ := Prod.mk.inj h + exact Prod.ext (hinj hprior) hcode + +theorem nextPrefixDecoder_surjective + (priorWord : Prefix → ExactPrefix counts labels n t Position) + (hsurj : Function.Surjective priorWord) : + Function.Surjective (nextPrefixDecoder counts labels n t priorWord) := by + intro next + obtain ⟨⟨old, code⟩, hnext⟩ := appendCode_surjective next + obtain ⟨p, hp⟩ := hsurj old + exact ⟨(p, code), by simpa only [nextPrefixDecoder, hp] using hnext⟩ + +theorem nextPrefixDecoder_val + (priorWord : Prefix → ExactPrefix counts labels n t Position) + (p : Prefix) (q : Fin (stageRefinementCount counts labels n t)) (i : Position) : + (nextPrefixDecoder counts labels n t priorWord (p, q)).val i = + ((priorWord p).val i, + decodePool (actualPool counts labels n t priorWord) + (stageRefinementCount counts labels n t) + (actualPool_card counts labels n t priorWord) p q i) := rfl + +theorem surviving_nextPrefix + (priorWord : Prefix → ExactPrefix counts labels n t Position) + (readX : Prefix → X → Position → Label n) + (readY : Prefix → Y → Position → Label n) + (p : Prefix) (word : Position → A) + (x : X × InformedOutput (stageRefinementCount counts labels n t)) + (y : Y × InformedOutput (stageRefinementCount counts labels n t)) + (z : Z × MissingOutput (stageRefinementCount counts labels n t)) + (hprior : ∀ i, (priorWord p).val i = labelRecordOf labels n (word i)) + (hx : readX p x.1 = fun i => labels n (word i)) + (hy : readY p y.1 = fun i => labels n (word i)) + (hn : rawPoolLeading (actualPool counts labels n t priorWord) + (stageRefinementCount counts labels n t) (stageRefinementCount_pos counts labels n t) + (actualPool_card counts labels n t priorWord) readX readY p x y z ≠ 0) : + ∀ i, (nextPrefixDecoder counts labels n t priorWord (p, x.2.1)).val i = + labelRecordOf labels (n + 1) (word i) := by + classical + have heq := rawPoolLeading_eq_decodedLeading + (actualPool counts labels n t priorWord) (stageRefinementCount counts labels n t) + (stageRefinementCount_pos counts labels n t) (actualPool_card counts labels n t priorWord) + readX readY (fun _ _ _ _ => fun i => labels n (word i)) p x y z hx hy + rw [heq] at hn + have hdecode : decodePool (actualPool counts labels n t priorWord) + (stageRefinementCount counts labels n t) + (actualPool_card counts labels n t priorWord) p x.2.1 = + fun i => labels n (word i) := by + by_contra h + exact hn (by simp [decodedLeading, h]) + intro i + rw [nextPrefixDecoder_val, hprior, hdecode] + rfl + +theorem exists_actualPoolStage + {PX PY PZ AX AY AZ : Type*} [Fintype AX] [Fintype AY] [Fintype AZ] + {support : X → Y → Z → Prop} + (E : Execution X Y Z Prefix PX PY PZ AX AY AZ support) + (priorWord : Prefix → ExactPrefix counts labels n t Position) + (readX : Prefix → X → Position → Label n) + (readY : Prefix → Y → Position → Label n) + (eligible : Prefix → X → Y → Z → Prop) + (previous : ∀ x y z, support x.1 y.1 z.1 → E.value x y z ≠ 0 → + eligible x.2.1 x.1 y.1 z.1) + (agree : ∀ p x y z, eligible p x y z → readX p x = readY p y) : + ∃ S : Stage E (Fin (stageRefinementCount counts labels n t)) + (Fin (stageRefinementCount counts labels n t)) + (Fin (stageRefinementCount counts labels n t)) PUnit + (PoolAuxiliaryGroup (stageRefinementCount counts labels n t)) + (PoolAuxiliaryGroup (stageRefinementCount counts labels n t)) + (PoolAuxiliaryGroup (stageRefinementCount counts labels n t)), + S.auxiliary = poolAuxiliaryTensor (stageRefinementCount counts labels n t) ∧ + S.rankBound = stageCost counts labels n t ∧ S.order = 0 ∧ + S.leftDegree = 0 ∧ S.middleDegree = 0 ∧ S.rightDegree = 0 ∧ + S.value = rawPoolLeading (actualPool counts labels n t priorWord) + (stageRefinementCount counts labels n t) (stageRefinementCount_pos counts labels n t) + (actualPool_card counts labels n t priorWord) readX readY := by + exact exists_rawPoolStage E (actualPool counts labels n t priorWord) + (stageRefinementCount counts labels n t) (stageRefinementCount_pos counts labels n t) + (actualPool_card counts labels n t priorWord) readX readY eligible previous agree + +end ExactConditionalPools + +end MatrixMultiplication.Foundation.ConditionalHierarchyStage + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/Entropy/ComplexConditionalPrefixWords.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/Entropy/ComplexConditionalPrefixWords.lean new file mode 100644 index 0000000000000000000000000000000000000000..e84d81851a3f7bd768c8bf97bb352b033344f654 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/Entropy/ComplexConditionalPrefixWords.lean @@ -0,0 +1,385 @@ +import OAI.LinearAlgebra.MatrixMultiplication.Separation.ComplexStageHierarchyResources + +namespace OAI + +/-! Finite entropy, rate estimates and ordered asymptotic limits. -/ + +noncomputable section + +namespace MatrixMultiplication.Foundation.ConditionalPrefixWords + +open LabelHierarchyCounts StageHierarchyResources +open scoped BigOperators + +universe u v w + +local instance (priority := low) {B : Type*} : DecidableEq B := Classical.decEq B + +instance labelRecordZero_subsingleton {Label : ℕ → Type v} : + Subsingleton (LabelRecord Label 0) := by + change Subsingleton PUnit + infer_instance + +private theorem population_fst {B C Position : Type*} + [Fintype B] [Fintype C] [Fintype Position] + (word : Position → B × C) (b : B) : + wordPopulation (fun i => (word i).1) b = ∑ c, wordPopulation word (b, c) := by + calc + wordPopulation (fun i => (word i).1) b = + ∑ c, wordPopulation (fun i : {i // (word i).1 = b} => (word i.val).2) c := + (wordPopulation_sum _).symm + _ = ∑ c, Fintype.card {i // (word i).1 = b ∧ (word i).2 = c} := by + apply Finset.sum_congr rfl + intro c hc + exact wordPopulation_fiber (fun i => (word i).1) (fun i => (word i).2) b c + _ = ∑ c, wordPopulation word (b, c) := by + apply Finset.sum_congr rfl + intro c hc + simp only [wordPopulation, Prod.ext_iff] + +variable {A : Type u} [Fintype A] {Label : ℕ → Type v} + [∀ n, Fintype (Label n)] + +abbrev ExactPrefix (counts : A → ℕ) (labels : ∀ n, A → Label n) (n t : ℕ) + (Position : Type w) [Fintype Position] := + PopulationWords Position (sourcePrefixCounts (fun a => t * counts a) labels n) + +variable {Position : Type w} [Fintype Position] +variable {counts : A → ℕ} {labels : ∀ n, A → Label n} {n t : ℕ} + +abbrev conditionalPool (old : ExactPrefix counts labels n t Position) := + ConditionalWords old.val + (fun r s => sourcePrefixCounts (fun a => t * counts a) labels (n + 1) (r, s)) + +def conditionalFinset (old : ExactPrefix counts labels n t Position) : + Finset (Position → Label n) := + Finset.univ.filter (fun fine => ∀ r s, + Fintype.card {i // old.val i = r ∧ fine i = s} = + sourcePrefixCounts (fun a => t * counts a) labels (n + 1) (r, s)) + +@[simp] theorem mem_conditionalFinset (old : ExactPrefix counts labels n t Position) + (fine : Position → Label n) : + fine ∈ conditionalFinset old ↔ ∀ r s, + Fintype.card {i // old.val i = r ∧ fine i = s} = + sourcePrefixCounts (fun a => t * counts a) labels (n + 1) (r, s) := by + simp only [conditionalFinset, Finset.mem_filter, Finset.mem_univ, true_and] + +def conditionalFinsetEquiv (old : ExactPrefix counts labels n t Position) : + ↥(conditionalFinset old) ≃ conditionalPool old := + Equiv.subtypeEquivRight (fun fine => mem_conditionalFinset old fine) + +theorem conditionalPool_card (old : ExactPrefix counts labels n t Position) : + Fintype.card (conditionalPool old) = stageRefinementCount counts labels n t := + stageConditionalWords_card counts labels n t old.val old.property + +theorem conditionalFinset_card (old : ExactPrefix counts labels n t Position) : + (conditionalFinset old).card = stageRefinementCount counts labels n t := + stageConditionalPool_card counts labels n t old.val old.property + +def conditionalFinsetEquivFin (old : ExactPrefix counts labels n t Position) : + ↥(conditionalFinset old) ≃ Fin (stageRefinementCount counts labels n t) := + LabelHierarchySeparation.poolEnumeration + (fun previous : ExactPrefix counts labels n t Position => conditionalFinset previous) + (stageRefinementCount counts labels n t) (fun previous => conditionalFinset_card previous) old + +def conditionalPoolEquivFin (old : ExactPrefix counts labels n t Position) : + conditionalPool old ≃ Fin (stageRefinementCount counts labels n t) := + (conditionalFinsetEquiv old).symm.trans (conditionalFinsetEquivFin old) + +@[simp] theorem decodedFine_eq_geometryDecode (old : ExactPrefix counts labels n t Position) + (code : Fin (stageRefinementCount counts labels n t)) : + ((conditionalPoolEquivFin old).symm code).val = + ((LabelHierarchySeparation.poolEnumeration + (fun previous : ExactPrefix counts labels n t Position => conditionalFinset previous) + (stageRefinementCount counts labels n t) + (fun previous => conditionalFinset_card previous) old).symm code).val := rfl + +def appendPrefix (old : ExactPrefix counts labels n t Position) (fine : conditionalPool old) : + ExactPrefix counts labels (n + 1) t Position := by + classical + refine ⟨fun i => (old.val i, fine.val i), ?_⟩ + rintro ⟨r, s⟩ + refine Eq.trans ?_ (fine.property r s) + unfold wordPopulation + apply Fintype.card_congr + exact Equiv.subtypeEquivRight (fun i => Prod.ext_iff) + +omit [∀ n, Fintype (Label n)] in +@[simp] theorem appendPrefix_val (old : ExactPrefix counts labels n t Position) + (fine : conditionalPool old) (i : Position) : + (appendPrefix old fine).val i = (old.val i, fine.val i) := rfl + +def oldPrefix (next : ExactPrefix counts labels (n + 1) t Position) : + ExactPrefix counts labels n t Position := by + classical + refine ⟨fun i => (next.val i).1, ?_⟩ + intro r + calc + wordPopulation (fun i => (next.val i).1) r = + ∑ s : Label n, wordPopulation next.val (r, s) := by + have h := population_fst next.val r + refine h.trans ?_ + apply Finset.sum_congr rfl + intro s hs + unfold wordPopulation + exact congrArg (@Fintype.card _) (Subsingleton.elim _ _) + _ = ∑ s : Label n, + sourcePrefixCounts (fun a => t * counts a) labels (n + 1) (r, s) := by + apply Finset.sum_congr rfl + intro s hs + exact next.property (r, s) + _ = sourcePrefixCounts (fun a => t * counts a) labels n r := + (sourcePrefixCounts_compatible (fun a => t * counts a) labels n r).symm + +@[simp] theorem oldPrefix_val (next : ExactPrefix counts labels (n + 1) t Position) + (i : Position) : (oldPrefix next).val i = (next.val i).1 := rfl + +def finePrefix (next : ExactPrefix counts labels (n + 1) t Position) : + conditionalPool (oldPrefix next) := by + classical + refine ⟨fun i => (next.val i).2, ?_⟩ + intro r s + refine Eq.trans ?_ (next.property (r, s)) + unfold wordPopulation + apply Fintype.card_congr + exact Equiv.subtypeEquivRight (fun i => by + change ((next.val i).1 = r ∧ (next.val i).2 = s) ↔ next.val i = (r, s) + constructor + · rintro ⟨hfst, hsnd⟩ + exact Prod.ext hfst hsnd + · intro h + exact ⟨congrArg Prod.fst h, congrArg Prod.snd h⟩) + +@[simp] theorem finePrefix_val (next : ExactPrefix counts labels (n + 1) t Position) + (i : Position) : (finePrefix next).val i = (next.val i).2 := rfl + +@[simp] theorem oldPrefix_appendPrefix (old : ExactPrefix counts labels n t Position) + (fine : conditionalPool old) : oldPrefix (appendPrefix old fine) = old := by + apply Subtype.ext + rfl + +def nextPrefixSigmaEquiv (counts : A → ℕ) (labels : ∀ n, A → Label n) (n t : ℕ) + (Position : Type w) [Fintype Position] : + ExactPrefix counts labels (n + 1) t Position ≃ + Σ old : ExactPrefix counts labels n t Position, conditionalPool old where + toFun next := ⟨oldPrefix next, finePrefix next⟩ + invFun p := appendPrefix p.1 p.2 + left_inv next := by + apply Subtype.ext + funext i + rfl + right_inv := by + rintro ⟨⟨old, ho⟩, ⟨fine, hf⟩⟩ + rfl + +def nextPrefixEquiv (counts : A → ℕ) (labels : ∀ n, A → Label n) (n t : ℕ) + (Position : Type w) [Fintype Position] : + ExactPrefix counts labels (n + 1) t Position ≃ + ExactPrefix counts labels n t Position × Fin (stageRefinementCount counts labels n t) := + (nextPrefixSigmaEquiv counts labels n t Position).trans + (Equiv.sigmaEquivProdOfEquiv (fun old => conditionalPoolEquivFin old)) + +def appendCode (old : ExactPrefix counts labels n t Position) + (code : Fin (stageRefinementCount counts labels n t)) : + ExactPrefix counts labels (n + 1) t Position := + appendPrefix old ((conditionalPoolEquivFin old).symm code) + +@[simp] theorem appendCode_val (old : ExactPrefix counts labels n t Position) + (code : Fin (stageRefinementCount counts labels n t)) (i : Position) : + (appendCode old code).val i = + (old.val i, ((conditionalPoolEquivFin old).symm code).val i) := rfl + +@[simp] theorem nextPrefixEquiv_symm_apply + (old : ExactPrefix counts labels n t Position) + (code : Fin (stageRefinementCount counts labels n t)) : + (nextPrefixEquiv counts labels n t Position).symm (old, code) = appendCode old code := rfl + +@[simp] theorem nextPrefixEquiv_appendCode + (old : ExactPrefix counts labels n t Position) + (code : Fin (stageRefinementCount counts labels n t)) : + nextPrefixEquiv counts labels n t Position (appendCode old code) = (old, code) := + (nextPrefixEquiv counts labels n t Position).apply_symm_apply (old, code) + +theorem appendCode_injective : Function.Injective + (fun p : ExactPrefix counts labels n t Position × Fin (stageRefinementCount counts labels n t) => + appendCode p.1 p.2) := + (nextPrefixEquiv counts labels n t Position).symm.injective + +theorem appendCode_surjective : Function.Surjective + (fun p : ExactPrefix counts labels n t Position × Fin (stageRefinementCount counts labels n t) => + appendCode p.1 p.2) := + (nextPrefixEquiv counts labels n t Position).symm.surjective + +theorem decodedFine_mem_conditionalFinset (old : ExactPrefix counts labels n t Position) + (code : Fin (stageRefinementCount counts labels n t)) : + ((conditionalPoolEquivFin old).symm code).val ∈ conditionalFinset old := + (mem_conditionalFinset old _).2 ((conditionalPoolEquivFin old).symm code).property + +section Root + +omit [∀ n, Fintype (Label n)] + +private theorem rootPopulation (counts : A → ℕ) (labels : ∀ n, A → Label n) (t : ℕ) + (r : LabelRecord Label 0) : + sourcePrefixCounts (fun a => t * counts a) labels 0 r = ∑ a, t * counts a := by + cases r + unfold sourcePrefixCounts pushforwardCounts + apply Finset.sum_congr rfl + intro a ha + exact ite_eq_left (Subsingleton.elim _ _) + +def rootPrefixWord (counts : A → ℕ) (labels : ∀ n, A → Label n) (t : ℕ) + (Position : Type w) [Fintype Position] + (hN : Fintype.card Position = ∑ a, t * counts a) : + ExactPrefix counts labels 0 t Position := by + classical + refine ⟨fun _ => PUnit.unit, ?_⟩ + intro r + cases r + calc + _ = Fintype.card Position := by + unfold wordPopulation + exact Fintype.card_congr (Equiv.subtypeUnivEquiv (fun _ => rfl)) + _ = ∑ a, t * counts a := hN + _ = sourcePrefixCounts (fun a => t * counts a) labels 0 PUnit.unit := + (rootPopulation counts labels t PUnit.unit).symm + +@[simp] theorem rootPrefixWord_val (counts : A → ℕ) (labels : ∀ n, A → Label n) (t : ℕ) + (hN : Fintype.card Position = ∑ a, t * counts a) (i : Position) : + (rootPrefixWord counts labels t Position hN).val i = PUnit.unit := rfl + +def rootPrefixEquiv (counts : A → ℕ) (labels : ∀ n, A → Label n) (t : ℕ) + (Position : Type w) [Fintype Position] + (hN : Fintype.card Position = ∑ a, t * counts a) : + ExactPrefix counts labels 0 t Position ≃ PUnit where + toFun _ := PUnit.unit + invFun _ := rootPrefixWord counts labels t Position hN + left_inv word := by + apply Subtype.ext + funext i + exact Subsingleton.elim _ _ + right_inv point := by cases point; rfl + +end Root + +section Terminal + +omit [∀ n, Fintype (Label n)] + +variable {depth : ℕ} + +theorem prefixSymbol_in_source_range (word : ExactPrefix counts labels depth t Position) + (i : Position) : ∃ a : A, labelRecordOf labels depth a = word.val i := by + by_contra hnone + have hnot : ∀ a : A, labelRecordOf labels depth a ≠ word.val i := not_exists.mp hnone + have hzero : sourcePrefixCounts (fun a => t * counts a) labels depth (word.val i) = 0 := by + simp [sourcePrefixCounts, pushforwardCounts, hnot] + have hpos : 0 < wordPopulation word.val (word.val i) := + Fintype.card_pos_iff.mpr ⟨⟨i, rfl⟩⟩ + rw [word.property (word.val i)] at hpos + exact (Nat.ne_of_gt hpos) hzero + +def sourceSymbol (word : ExactPrefix counts labels depth t Position) (i : Position) : A := + Classical.choose (prefixSymbol_in_source_range word i) + +@[simp] theorem sourceSymbol_record (word : ExactPrefix counts labels depth t Position) + (i : Position) : labelRecordOf labels depth (sourceSymbol word i) = word.val i := + Classical.choose_spec (prefixSymbol_in_source_range word i) + +theorem sourceSymbol_eq_iff + (hinjective : Function.Injective (labelRecordOf labels depth)) + (word : ExactPrefix counts labels depth t Position) (i : Position) (a : A) : + sourceSymbol word i = a ↔ word.val i = labelRecordOf labels depth a := by + constructor + · intro h + rw [← sourceSymbol_record word i, h] + · intro h + exact hinjective ((sourceSymbol_record word i).trans h) + +theorem sourceSymbol_grade {Grade : Type*} (grade : A → Grade) + (hinjective : Function.Injective (labelRecordOf labels depth)) + (word : ExactPrefix counts labels depth t Position) (i : Position) (a : A) + (hrecord : labelRecordOf labels depth a = word.val i) : + grade (sourceSymbol word i) = grade a := + congrArg grade ((sourceSymbol_eq_iff hinjective word i a).2 hrecord.symm) + +def decodeSourceWord (hinjective : Function.Injective (labelRecordOf labels depth)) + (word : ExactPrefix counts labels depth t Position) : + PopulationWords Position (fun a => t * counts a) := by + refine ⟨fun i => sourceSymbol word i, ?_⟩ + intro a + calc + wordPopulation (fun i => sourceSymbol word i) a = + wordPopulation word.val (labelRecordOf labels depth a) := + Fintype.card_congr (Equiv.subtypeEquivRight + (fun i => sourceSymbol_eq_iff hinjective word i a)) + _ = sourcePrefixCounts (fun a => t * counts a) labels depth (labelRecordOf labels depth a) := + word.property _ + _ = t * counts a := pushforwardCounts_apply (fun a => t * counts a) + (labelRecordOf labels depth) hinjective a + +def encodeSourceWord (counts : A → ℕ) (labels : ∀ n, A → Label n) (depth t : ℕ) + (hinjective : Function.Injective (labelRecordOf labels depth)) + (word : PopulationWords Position (fun a => t * counts a)) : + ExactPrefix counts labels depth t Position := by + refine ⟨fun i => labelRecordOf labels depth (word.val i), ?_⟩ + intro r + by_cases hr : ∃ a : A, labelRecordOf labels depth a = r + · obtain ⟨a, rfl⟩ := hr + calc + wordPopulation (fun i => labelRecordOf labels depth (word.val i)) + (labelRecordOf labels depth a) = wordPopulation word.val a := by + simp only [wordPopulation, hinjective.eq_iff] + _ = t * counts a := word.property a + _ = sourcePrefixCounts (fun a => t * counts a) labels depth (labelRecordOf labels depth a) := + (pushforwardCounts_apply (fun a => t * counts a) + (labelRecordOf labels depth) hinjective a).symm + · have hnot : ∀ a : A, labelRecordOf labels depth a ≠ r := not_exists.mp hr + simp [wordPopulation, sourcePrefixCounts, pushforwardCounts, hnot] + +@[simp] theorem encodeSourceWord_val (counts : A → ℕ) (labels : ∀ n, A → Label n) + (depth t : ℕ) (hinjective : Function.Injective (labelRecordOf labels depth)) + (word : PopulationWords Position (fun a => t * counts a)) (i : Position) : + (encodeSourceWord counts labels depth t hinjective word).val i = + labelRecordOf labels depth (word.val i) := rfl + +@[simp] theorem sourceSymbol_encodeSourceWord (counts : A → ℕ) (labels : ∀ n, A → Label n) + (depth t : ℕ) (hinjective : Function.Injective (labelRecordOf labels depth)) + (word : PopulationWords Position (fun a => t * counts a)) (i : Position) : + sourceSymbol (encodeSourceWord counts labels depth t hinjective word) i = word.val i := + hinjective (sourceSymbol_record (encodeSourceWord counts labels depth t hinjective word) i) + +def sourcePrefixEquiv (counts : A → ℕ) (labels : ∀ n, A → Label n) (depth t : ℕ) + (Position : Type w) [Fintype Position] + (hinjective : Function.Injective (labelRecordOf labels depth)) : + ExactPrefix counts labels depth t Position ≃ PopulationWords Position (fun a => t * counts a) where + toFun word := decodeSourceWord hinjective word + invFun word := encodeSourceWord counts labels depth t hinjective word + left_inv word := by + apply Subtype.ext + funext i + exact sourceSymbol_record word i + right_inv word := by + apply Subtype.ext + funext i + exact sourceSymbol_encodeSourceWord counts labels depth t hinjective word i + +@[simp] theorem sourcePrefixEquiv_apply_val (counts : A → ℕ) (labels : ∀ n, A → Label n) + (depth t : ℕ) (hinjective : Function.Injective (labelRecordOf labels depth)) + (word : ExactPrefix counts labels depth t Position) (i : Position) : + (sourcePrefixEquiv counts labels depth t Position hinjective word).val i = + sourceSymbol word i := rfl + +@[simp] theorem sourcePrefixEquiv_symm_val (counts : A → ℕ) (labels : ∀ n, A → Label n) + (depth t : ℕ) (hinjective : Function.Injective (labelRecordOf labels depth)) + (word : PopulationWords Position (fun a => t * counts a)) (i : Position) : + ((sourcePrefixEquiv counts labels depth t Position hinjective).symm word).val i = + labelRecordOf labels depth (word.val i) := rfl + +end Terminal + +end MatrixMultiplication.Foundation.ConditionalPrefixWords + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/Entropy/ComplexConditionalTypeCounting.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/Entropy/ComplexConditionalTypeCounting.lean new file mode 100644 index 0000000000000000000000000000000000000000..290f92b7419404990aaa944fa6e9016ade1317b8 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/Entropy/ComplexConditionalTypeCounting.lean @@ -0,0 +1,154 @@ +import OAI.LinearAlgebra.MatrixMultiplication.Separation.ComplexTypeCounting + +namespace OAI + +/-! Finite entropy, rate estimates and ordered asymptotic limits. -/ + +namespace MatrixMultiplication.Foundation + +open scoped BigOperators + +variable {A B I : Type*} [Fintype A] [DecidableEq A] + [Fintype B] [DecidableEq B] [Fintype I] [DecidableEq I] + +abbrev PopulationWords (I : Type*) [Fintype I] (counts : A → ℕ) := + {w : I → A // ∀ a, wordPopulation w a = counts a} + +noncomputable def populationWordsEquiv (counts : A → ℕ) + (h : Fintype.card I = ∑ a, counts a) : PopulationWords I counts ≃ ExactWords counts := by + let e : I ≃ Fin (∑ a, counts a) := Fintype.equivFinOfCardEq h + exact + { toFun := fun w => + ⟨w.val ∘ e.symm, fun a => (wordPopulation_reindex w.val e.symm a).trans (w.property a)⟩ + invFun := fun w => + ⟨w.val ∘ e, fun a => (wordPopulation_reindex w.val e a).trans (w.property a)⟩ + left_inv := by + intro w + apply Subtype.ext + funext i + simp + right_inv := by + intro w + apply Subtype.ext + funext i + simp } + +theorem populationWords_card (counts : A → ℕ) + (h : Fintype.card I = ∑ a, counts a) : + Fintype.card (PopulationWords I counts) = Nat.multinomial Finset.univ counts := by + rw [Fintype.card_congr (populationWordsEquiv counts h), exactWords_card] + +abbrev ConditionalWords (w : I → A) (counts : A → B → ℕ) := + {r : I → B // ∀ a b, Fintype.card {i // w i = a ∧ r i = b} = counts a b} + +def fiberWordEquiv (w : I → A) : (I → B) ≃ (∀ a, {i // w i = a} → B) where + toFun r _ i := r i.val + invFun r i := r (w i) ⟨i, rfl⟩ + left_inv _ := rfl + right_inv := by + intro r + funext a i + rcases i with ⟨i, hi⟩ + cases hi + rfl + +omit [Fintype A] [Fintype B] [DecidableEq I] in +theorem wordPopulation_fiber (w : I → A) (r : I → B) (a : A) (b : B) : + wordPopulation (fun i : {i // w i = a} => r i.val) b = + Fintype.card {i // w i = a ∧ r i = b} := + Fintype.card_congr + (Equiv.subtypeSubtypeEquivSubtypeInter (fun i => w i = a) (fun i => r i = b)) + +def conditionalWordsEquiv (w : I → A) (counts : A → B → ℕ) : + ConditionalWords w counts ≃ ∀ a, PopulationWords {i // w i = a} (counts a) := by + let e : ConditionalWords w counts ≃ + {r : ∀ a, {i // w i = a} → B // ∀ a b, wordPopulation (r a) b = counts a b} := + Equiv.subtypeEquiv (fiberWordEquiv w) fun r => by + change (∀ a b, Fintype.card {i // w i = a ∧ r i = b} = counts a b) ↔ + ∀ a b, wordPopulation (fun i : {i // w i = a} => r i.val) b = counts a b + simp only [wordPopulation_fiber] + exact e.trans (Equiv.subtypePiEquivPi + (β := fun a : A => {i // w i = a} → B) + (p := fun a r => ∀ b, wordPopulation r b = counts a b)) + +theorem conditionalWords_card (w : I → A) (counts : A → B → ℕ) + (h : ∀ a, wordPopulation w a = ∑ b, counts a b) : + Fintype.card (ConditionalWords w counts) = + ∏ a, Nat.multinomial Finset.univ (counts a) := by + rw [Fintype.card_congr (conditionalWordsEquiv w counts), Fintype.card_pi] + exact Finset.prod_congr rfl fun a _ => populationWords_card (counts a) (h a) + +theorem conditionalWords_card_pos (w : I → A) (counts : A → B → ℕ) + (h : ∀ a, wordPopulation w a = ∑ b, counts a b) : + 0 < Fintype.card (ConditionalWords w counts) := by + rw [conditionalWords_card w counts h] + exact Finset.prod_pos fun a _ => Nat.multinomial_pos Finset.univ (counts a) + +theorem conditionalWords_nonempty (w : I → A) (counts : A → B → ℕ) + (h : ∀ a, wordPopulation w a = ∑ b, counts a b) : + Nonempty (ConditionalWords w counts) := + Fintype.card_pos_iff.mp (conditionalWords_card_pos w counts h) + +theorem conditionalWords_nonempty_iff (w : I → A) (counts : A → B → ℕ) : + Nonempty (ConditionalWords w counts) ↔ + ∀ a, wordPopulation w a = ∑ b, counts a b := by + constructor + · rintro ⟨r⟩ a + calc + wordPopulation w a = + ∑ b, wordPopulation (fun i : {i // w i = a} => r.val i.val) b := + (wordPopulation_sum _).symm + _ = ∑ b, counts a b := by + apply Finset.sum_congr rfl + intro b _ + rw [wordPopulation_fiber, r.property] + · exact conditionalWords_nonempty w counts + +omit [DecidableEq A] [DecidableEq B] in +theorem multinomial_prod_counts (counts : A × B → ℕ) : + Nat.multinomial Finset.univ counts = + Nat.multinomial Finset.univ (fun a => ∑ b, counts (a, b)) * + ∏ a, Nat.multinomial Finset.univ (fun b => counts (a, b)) := by + apply Nat.mul_left_cancel (Nat.prod_factorial_pos Finset.univ counts) + rw [Nat.multinomial_spec] + symm + calc + (∏ ab, (counts ab).factorial) * + (Nat.multinomial Finset.univ (fun a => ∑ b, counts (a, b)) * + ∏ a, Nat.multinomial Finset.univ (fun b => counts (a, b))) = + ((∏ a, ∏ b, (counts (a, b)).factorial) * + ∏ a, Nat.multinomial Finset.univ (fun b => counts (a, b))) * + Nat.multinomial Finset.univ (fun a => ∑ b, counts (a, b)) := by + rw [Fintype.prod_prod_type] + ac_rfl + _ = (∏ a, ((∏ b, (counts (a, b)).factorial) * + Nat.multinomial Finset.univ (fun b => counts (a, b)))) * + Nat.multinomial Finset.univ (fun a => ∑ b, counts (a, b)) := by + rw [Finset.prod_mul_distrib] + _ = (∏ a, (∑ b, counts (a, b)).factorial) * + Nat.multinomial Finset.univ (fun a => ∑ b, counts (a, b)) := by + congr 1 + apply Finset.prod_congr rfl + intro a _ + exact Nat.multinomial_spec Finset.univ (fun b => counts (a, b)) + _ = (∑ a, ∑ b, counts (a, b)).factorial := + Nat.multinomial_spec Finset.univ (fun a => ∑ b, counts (a, b)) + _ = (∑ ab, counts ab).factorial := by rw [Fintype.sum_prod_type] + +theorem exactWords_card_prod_counts (counts : A × B → ℕ) : + Fintype.card (ExactWords counts) = + Fintype.card (ExactWords (fun a => ∑ b, counts (a, b))) * + ∏ a, Fintype.card (ExactWords (fun b => counts (a, b))) := by + simpa only [exactWords_card] using multinomial_prod_counts counts + +theorem exactWords_card_eq_coarse_mul_conditional (counts : A × B → ℕ) + (w : ExactWords (fun a => ∑ b, counts (a, b))) : + Fintype.card (ExactWords counts) = + Fintype.card (ExactWords (fun a => ∑ b, counts (a, b))) * + Fintype.card (ConditionalWords w.val (fun a b => counts (a, b))) := by + rw [conditionalWords_card w.val (fun a b => counts (a, b)) w.property] + simpa only [exactWords_card] using multinomial_prod_counts counts + +end MatrixMultiplication.Foundation + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/Entropy/ComplexEntropyContinuity.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/Entropy/ComplexEntropyContinuity.lean new file mode 100644 index 0000000000000000000000000000000000000000..b0b75f68360e357bff8a875d5bfc519bc13fc198 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/Entropy/ComplexEntropyContinuity.lean @@ -0,0 +1,180 @@ +import OAI.LinearAlgebra.MatrixMultiplication.Entropy.ComplexFiniteEntropy +import Mathlib.Analysis.SpecialFunctions.Log.NegMulLog +import Mathlib.Analysis.Convex.Jensen + +namespace OAI + +/-! Finite entropy, rate estimates and ordered asymptotic limits. -/ + +noncomputable section + +open scoped Topology +open Filter + +namespace MatrixMultiplication.Foundation + +theorem entropyTerm_eq_negMulLog (p : ℝ) : entropyTerm p = Real.negMulLog p := rfl + +@[simp] theorem entropyTerm_one : entropyTerm 1 = 0 := by simp [entropyTerm] + +theorem mul_entropyTerm_inv (x : ℝ) : x * entropyTerm x⁻¹ = Real.log x := by + by_cases hx : x = 0 + · simp [hx] + · simp only [entropyTerm, Real.log_inv] + calc + _ = (x * x⁻¹) * Real.log x := by ring + _ = Real.log x := by rw [mul_inv_cancel₀ hx, one_mul] + +theorem finiteEntropy_uniform {A : Type*} [Fintype A] : + finiteEntropy (fun _a : A => (Fintype.card A : ℝ)⁻¹) = + Real.log (Fintype.card A) := by + simp only [finiteEntropy, Finset.sum_const, Finset.card_univ, nsmul_eq_mul] + exact mul_entropyTerm_inv (Fintype.card A) + +theorem finiteEntropy_deterministic {A : Type*} [Fintype A] [DecidableEq A] + (a : A) : finiteEntropy (fun b => if b = a then 1 else 0) = 0 := by + apply Finset.sum_eq_zero + intro b hb + change entropyTerm (if b = a then 1 else 0) = 0 + split_ifs <;> simp + +@[fun_prop] theorem continuous_entropyTerm : Continuous entropyTerm := + Real.continuous_negMulLog + +theorem entropyTerm_nonneg {p : ℝ} (hp₀ : 0 ≤ p) (hp₁ : p ≤ 1) : + 0 ≤ entropyTerm p := + Real.negMulLog_nonneg hp₀ hp₁ + +theorem concaveOn_entropyTerm : ConcaveOn ℝ (Set.Ici 0) entropyTerm := + Real.concaveOn_negMulLog + +@[fun_prop] theorem continuous_finiteEntropy {A : Type*} [Fintype A] : + Continuous (finiteEntropy : (A → ℝ) → ℝ) := by + unfold finiteEntropy + exact continuous_finsetSum _ fun value _ => + continuous_entropyTerm.comp (continuous_apply value) + +theorem tendsto_entropyTerm {I : Type*} {l : Filter I} {p : I → ℝ} {q : ℝ} + (h : Tendsto p l (𝓝 q)) : + Tendsto (fun i => entropyTerm (p i)) l (𝓝 (entropyTerm q)) := + continuous_entropyTerm.continuousAt.tendsto.comp h + +theorem tendsto_entropyTerm_zero {I : Type*} {l : Filter I} {p : I → ℝ} + (h : Tendsto p l (𝓝 0)) : + Tendsto (fun i => entropyTerm (p i)) l (𝓝 0) := by + simpa only [entropyTerm_zero] using tendsto_entropyTerm h + +theorem tendsto_finiteEntropy_of_tendsto {I A : Type*} [Fintype A] + {l : Filter I} {p : I → A → ℝ} {q : A → ℝ} + (h : ∀ a, Tendsto (fun i => p i a) l (𝓝 (q a))) : + Tendsto (fun i => finiteEntropy (p i)) l (𝓝 (finiteEntropy q)) := + continuous_finiteEntropy.continuousAt.tendsto.comp (tendsto_pi_nhds.mpr h) + +theorem finiteEntropy_nonneg {A : Type*} [Fintype A] (p : A → ℝ) + (hp₀ : ∀ a, 0 ≤ p a) (hp₁ : ∀ a, p a ≤ 1) : 0 ≤ finiteEntropy p := by + exact Finset.sum_nonneg fun a _ => entropyTerm_nonneg (hp₀ a) (hp₁ a) + +theorem finiteEntropy_mix_le {A : Type*} [Fintype A] (p q : A → ℝ) + (hp : ∀ i, 0 ≤ p i) (hq : ∀ i, 0 ≤ q i) + {a b : ℝ} (ha : 0 ≤ a) (hb : 0 ≤ b) (hab : a + b = 1) : + a * finiteEntropy p + b * finiteEntropy q ≤ + finiteEntropy (fun i => a * p i + b * q i) := by + calc + a * finiteEntropy p + b * finiteEntropy q = + ∑ i, (a * entropyTerm (p i) + b * entropyTerm (q i)) := by + simp only [finiteEntropy, Finset.sum_add_distrib, ← Finset.mul_sum] + _ ≤ finiteEntropy (fun i => a * p i + b * q i) := by + apply Finset.sum_le_sum + intro i hi + exact concaveOn_entropyTerm.2 (hp i) (hq i) ha hb hab + +theorem finiteEntropy_le_log_card {A : Type*} [Fintype A] (p : A → ℝ) + (hp : ∀ a, 0 ≤ p a) (htotal : ∑ a, p a = 1) : + finiteEntropy p ≤ Real.log (Fintype.card A) := by + classical + have hcard : 0 < Fintype.card A := by + by_contra h + have : IsEmpty A := Fintype.card_eq_zero_iff.mp (Nat.eq_zero_of_not_pos h) + simp at htotal + have hn : (0 : ℝ) < Fintype.card A := Nat.cast_pos.mpr hcard + have hw : ∑ _a : A, (Fintype.card A : ℝ)⁻¹ = 1 := by + simp [Finset.sum_const, nsmul_eq_mul, hn.ne'] + have hJ := concaveOn_entropyTerm.le_map_sum + (t := (Finset.univ : Finset A)) + (w := fun _a : A => (Fintype.card A : ℝ)⁻¹) (p := p) + (fun _a _ha => (inv_pos.mpr hn).le) hw (fun a _ha => hp a) + have hJ' : (Fintype.card A : ℝ)⁻¹ * finiteEntropy p ≤ + entropyTerm (Fintype.card A : ℝ)⁻¹ := by + simpa only [smul_eq_mul, ← Finset.mul_sum, htotal, mul_one, finiteEntropy] using hJ + calc + finiteEntropy p = (Fintype.card A : ℝ) * + ((Fintype.card A : ℝ)⁻¹ * finiteEntropy p) := by + rw [← mul_assoc, mul_inv_cancel₀ hn.ne', one_mul] + _ ≤ (Fintype.card A : ℝ) * entropyTerm (Fintype.card A : ℝ)⁻¹ := + mul_le_mul_of_nonneg_left hJ' hn.le + _ = Real.log (Fintype.card A) := mul_entropyTerm_inv (Fintype.card A) + +namespace FiniteLaw + +variable {A : Type*} [Fintype A] + +def uniform (A : Type*) [Fintype A] [Nonempty A] : FiniteLaw A where + mass _a := (Fintype.card A : ℝ)⁻¹ + nonneg _a := inv_nonneg.mpr (Nat.cast_nonneg _) + total := by + have hn : (Fintype.card A : ℝ) ≠ 0 := + (Nat.cast_pos.mpr (Fintype.card_pos : 0 < Fintype.card A)).ne' + simp [Finset.sum_const, nsmul_eq_mul, hn] + +@[simp] theorem uniform_mass [Nonempty A] (a : A) : + (uniform A).mass a = (Fintype.card A : ℝ)⁻¹ := rfl + +@[simp] theorem uniform_entropy [Nonempty A] : + finiteEntropy (uniform A).mass = Real.log (Fintype.card A) := + finiteEntropy_uniform + +def pure (a : A) : FiniteLaw A := by + classical + exact + { mass := fun b => if b = a then 1 else 0 + nonneg := fun b => by split_ifs <;> norm_num + total := by simp } + +@[simp] theorem pure_entropy (a : A) : finiteEntropy (pure a).mass = 0 := by + classical + exact finiteEntropy_deterministic a + +theorem mass_le_one (p : FiniteLaw A) (a : A) : p.mass a ≤ 1 := by + calc + p.mass a ≤ ∑ b, p.mass b := + Finset.single_le_sum (fun b _hb => p.nonneg b) (Finset.mem_univ a) + _ = 1 := p.total + +theorem entropy_nonneg (p : FiniteLaw A) : 0 ≤ finiteEntropy p.mass := + finiteEntropy_nonneg p.mass p.nonneg p.mass_le_one + +theorem entropy_le_log_card (p : FiniteLaw A) : + finiteEntropy p.mass ≤ Real.log (Fintype.card A) := + finiteEntropy_le_log_card p.mass p.nonneg p.total + +theorem map_entropy_le {B : Type*} [Fintype B] (p : FiniteLaw A) (f : A → B) : + finiteEntropy (p.map f).mass ≤ finiteEntropy p.mass := by + calc + finiteEntropy (p.map f).mass ≤ finiteEntropy (p.map f).mass + + ∑ b, (p.map f).mass b * finiteEntropy (p.conditional f b).mass := + le_add_of_nonneg_right (Finset.sum_nonneg fun b _ => + mul_nonneg ((p.map f).nonneg b) ((p.conditional f b).entropy_nonneg)) + _ = finiteEntropy p.mass := (p.entropy_eq_map_add_conditional f).symm + +theorem entropy_tendsto {I : Type*} {l : Filter I} + {p : I → FiniteLaw A} {q : FiniteLaw A} + (h : ∀ a, Tendsto (fun i => (p i).mass a) l (𝓝 (q.mass a))) : + Tendsto (fun i => finiteEntropy (p i).mass) l (𝓝 (finiteEntropy q.mass)) := + tendsto_finiteEntropy_of_tendsto h + +end FiniteLaw +end MatrixMultiplication.Foundation + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/Entropy/ComplexFiniteEntropy.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/Entropy/ComplexFiniteEntropy.lean new file mode 100644 index 0000000000000000000000000000000000000000..7fc351a78ab290a66c1d2eef89b2ef765c4599bb --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/Entropy/ComplexFiniteEntropy.lean @@ -0,0 +1,175 @@ +import Mathlib.Analysis.SpecialFunctions.Log.Basic +import Mathlib.Algebra.BigOperators.Fin +import Mathlib.Algebra.BigOperators.Field +import Mathlib.Algebra.BigOperators.Group.Finset.Piecewise +import Mathlib.Algebra.Order.BigOperators.Group.Finset +import Mathlib.Tactic.FieldSimp +import Mathlib.Tactic.Ring + +namespace OAI + +/-! Finite entropy, rate estimates and ordered asymptotic limits. -/ + +noncomputable section + +namespace MatrixMultiplication.Foundation + +open scoped BigOperators + +def entropyTerm (p : ℝ) : ℝ := -p * Real.log p + +def finiteEntropy {A : Type*} [Fintype A] (p : A → ℝ) : ℝ := ∑ a, entropyTerm (p a) + +theorem finiteEntropy_equiv {A B : Type*} [Fintype A] [Fintype B] + (e : A ≃ B) (p : B → ℝ) : finiteEntropy (fun a => p (e a)) = finiteEntropy p := + e.sum_comp (fun b => entropyTerm (p b)) + +@[simp] theorem entropyTerm_zero : entropyTerm 0 = 0 := by simp [entropyTerm] + +theorem entropyTerm_mul (p q : ℝ) : + entropyTerm (p * q) = q * entropyTerm p + p * entropyTerm q := by + by_cases hp : p = 0 + · simp [hp] + by_cases hq : q = 0 + · simp [hq] + rw [entropyTerm, Real.log_mul hp hq] + unfold entropyTerm + ring + +theorem finiteEntropy_chain {A B : Type*} [Fintype A] [Fintype B] + (p : A → ℝ) (q : A → B → ℝ) (hq : ∀ a, ∑ b, q a b = 1) : + finiteEntropy (fun ab : A × B => p ab.1 * q ab.1 ab.2) = + finiteEntropy p + ∑ a, p a * finiteEntropy (q a) := by + simp only [finiteEntropy, Fintype.sum_prod_type, entropyTerm_mul, + Finset.sum_add_distrib, ← Finset.sum_mul, ← Finset.mul_sum, hq, one_mul] + +structure FiniteLaw (A : Type*) [Fintype A] where + mass : A → ℝ + nonneg : ∀ a, 0 ≤ mass a + total : ∑ a, mass a = 1 + +namespace FiniteLaw + +variable {A B : Type*} [Fintype A] [Fintype B] + +def map (p : FiniteLaw A) (f : A → B) : FiniteLaw B := by + classical + exact + { mass := fun b => ∑ a, if f a = b then p.mass a else 0 + nonneg := fun b => Finset.sum_nonneg fun a _ => by + split_ifs + · exact p.nonneg a + · exact le_rfl + total := by + rw [Finset.sum_comm] + simpa using p.total } + +@[simp] theorem map_mass [DecidableEq B] (p : FiniteLaw A) (f : A → B) (b : B) : + (p.map f).mass b = ∑ a, if f a = b then p.mass a else 0 := by + classical + dsimp only [map] + apply Finset.sum_congr rfl + intro a _ + by_cases h : f a = b <;> simp only [h, ite_true, ite_false] + +theorem map_mass_apply (p : FiniteLaw A) (f : A → B) + (hf : Function.Injective f) (a : A) : (p.map f).mass (f a) = p.mass a := by + classical + simp [map_mass, hf.eq_iff] + +theorem map_entropy_of_injective (p : FiniteLaw A) (f : A → B) + (hf : Function.Injective f) : finiteEntropy (p.map f).mass = finiteEntropy p.mass := by + classical + have hterm (b : B) : entropyTerm ((p.map f).mass b) = + ∑ a, if f a = b then entropyTerm (p.mass a) else 0 := by + by_cases hb : ∃ a, f a = b + · obtain ⟨a, rfl⟩ := hb + rw [map_mass_apply p f hf] + simp [hf.eq_iff] + · simp [map_mass, not_exists.mp hb] + unfold finiteEntropy + simp_rw [hterm] + rw [Finset.sum_comm] + simp + +def joint (p : FiniteLaw A) (q : A → FiniteLaw B) : FiniteLaw (A × B) where + mass ab := p.mass ab.1 * (q ab.1).mass ab.2 + nonneg ab := mul_nonneg (p.nonneg ab.1) ((q ab.1).nonneg ab.2) + total := by simp [Fintype.sum_prod_type, ← Finset.mul_sum, (q _).total, p.total] + +theorem joint_entropy (p : FiniteLaw A) (q : A → FiniteLaw B) : + finiteEntropy (p.joint q).mass = + finiteEntropy p.mass + ∑ a, p.mass a * finiteEntropy (q a).mass := + finiteEntropy_chain p.mass (fun a => (q a).mass) (fun a => (q a).total) + +theorem mass_le_map_mass (p : FiniteLaw A) (f : A → B) (a : A) : + p.mass a ≤ (p.map f).mass (f a) := by + classical + rw [map_mass] + have h := Finset.single_le_sum + (s := (Finset.univ : Finset A)) + (f := fun a' => if f a' = f a then p.mass a' else 0) + (fun a' _ => by + split_ifs + · exact p.nonneg a' + · exact le_rfl) + (Finset.mem_univ a) + simpa using h + +def conditional (p : FiniteLaw A) (f : A → B) (b : B) : FiniteLaw A := by + classical + exact if hzero : (p.map f).mass b = 0 then p else + { mass := fun a => (if f a = b then p.mass a else 0) / (p.map f).mass b + nonneg := fun a => div_nonneg + (by split_ifs; exact p.nonneg a; exact le_rfl) ((p.map f).nonneg b) + total := by + rw [← Finset.sum_div, ← map_mass p f b, div_self hzero] } + +theorem map_mass_mul_conditional [DecidableEq B] + (p : FiniteLaw A) (f : A → B) (b : B) (a : A) : + (p.map f).mass b * (p.conditional f b).mass a = + if f a = b then p.mass a else 0 := by + classical + by_cases hzero : (p.map f).mass b = 0 + · have ha : f a = b → p.mass a = 0 := by + intro hab + have hle := p.mass_le_map_mass f a + rw [hab, hzero] at hle + exact le_antisymm hle (p.nonneg a) + rw [hzero, zero_mul] + by_cases hab : f a = b + · rw [ite_eq_left hab, ha hab] + · rw [ite_eq_right hab] + · simp only [conditional, hzero, ↓reduceDIte] + by_cases hab : f a = b + · simpa only [hab, ite_true] using (mul_div_cancel₀ (p.mass a) hzero) + · simp only [hab, ite_false, zero_div, mul_zero] + +theorem entropy_eq_map_add_conditional (p : FiniteLaw A) (f : A → B) : + finiteEntropy p.mass = finiteEntropy (p.map f).mass + + ∑ b, (p.map f).mass b * finiteEntropy (p.conditional f b).mass := by + classical + let graph : A → B × A := fun a => (f a, a) + have hinj : Function.Injective graph := fun _ _ h => congrArg Prod.snd h + have hmass : ((p.map f).joint (p.conditional f)).mass = (p.map graph).mass := by + funext ba + rcases ba with ⟨b, a⟩ + change (p.map f).mass b * (p.conditional f b).mass a = (p.map graph).mass (b, a) + rw [map_mass_mul_conditional, map_mass, Finset.sum_eq_single a] + · simp only [graph, Prod.mk.injEq, and_true] + · intro x _ hxa + simp only [graph, Prod.mk.injEq, hxa, and_false, ite_false] + · intro ha + exact (ha (Finset.mem_univ a)).elim + calc + finiteEntropy p.mass = finiteEntropy (p.map graph).mass := + (p.map_entropy_of_injective graph hinj).symm + _ = finiteEntropy ((p.map f).joint (p.conditional f)).mass := by rw [hmass] + _ = _ := (p.map f).joint_entropy (p.conditional f) + +end FiniteLaw +end MatrixMultiplication.Foundation + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/Entropy/ComplexHierarchyEntropy.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/Entropy/ComplexHierarchyEntropy.lean new file mode 100644 index 0000000000000000000000000000000000000000..f42b27c48ab61533b93e4ab145eed22ac2536069 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/Entropy/ComplexHierarchyEntropy.lean @@ -0,0 +1,227 @@ +import OAI.LinearAlgebra.MatrixMultiplication.Entropy.ComplexFiniteEntropy + +namespace OAI + +/-! Finite entropy, rate estimates and ordered asymptotic limits. -/ + +namespace MatrixMultiplication.Foundation + +open scoped BigOperators + +universe u v + +noncomputable section + +namespace FiniteLaw + +theorem map_mass_mul_conditional_map {A B C : Type*} + [Fintype A] [Fintype B] [Fintype C] + (p : FiniteLaw A) (f : A → B) (g : A → C) (b : B) (c : C) : + (p.map f).mass b * ((p.conditional f b).map g).mass c = + (p.map (fun a => (f a, g a))).mass (b, c) := by + classical + rw [map_mass (p.conditional f b) g c, Finset.mul_sum, + map_mass p (fun a => (f a, g a)) (b, c)] + apply Finset.sum_congr rfl + intro a _ + by_cases hgc : g a = c + · rw [ite_eq_left hgc, map_mass_mul_conditional] + simp only [Prod.mk.injEq, hgc, and_true] + · rw [ite_eq_right hgc, mul_zero] + have hpair : (f a, g a) ≠ (b, c) := + fun he => hgc (congrArg Prod.snd he) + rw [ite_eq_right hpair] + +end FiniteLaw + +def LabelRecord (Label : ℕ → Type u) : ℕ → Type u + | 0 => PUnit + | n + 1 => LabelRecord Label n × Label n + +instance labelRecordFintype (Label : ℕ → Type u) [∀ n, Fintype (Label n)] : + (n : ℕ) → Fintype (LabelRecord Label n) + | 0 => by + change Fintype PUnit + infer_instance + | n + 1 => by + letI := labelRecordFintype Label n + change Fintype (LabelRecord Label n × Label n) + infer_instance + +def labelRecordOf {A : Type v} {Label : ℕ → Type u} + (labels : ∀ n, A → Label n) : (n : ℕ) → A → LabelRecord Label n + | 0, _ => PUnit.unit + | n + 1, a => (labelRecordOf labels n a, labels n a) + +structure FiniteLabelHierarchy (Label : ℕ → Type u) [∀ n, Fintype (Label n)] + (depth : ℕ) where + conditional : ∀ n, n < depth → LabelRecord Label n → FiniteLaw (Label n) + +namespace FiniteLabelHierarchy + +variable {Label : ℕ → Type u} [∀ n, Fintype (Label n)] {depth : ℕ} + +def prefixLaw (h : FiniteLabelHierarchy Label depth) : + (n : ℕ) → n ≤ depth → FiniteLaw (LabelRecord Label n) + | 0, _ => + { mass := fun _ => 1 + nonneg := fun _ => zero_le_one + total := by + classical + refine Finset.sum_eq_single_of_mem (PUnit.unit : LabelRecord Label 0) + (Finset.mem_univ _) ?_ + intro r _ hr + cases r + exact (hr rfl).elim } + | n + 1, hn => + (h.prefixLaw n (Nat.le_of_succ_le hn)).joint + (h.conditional n (Nat.lt_of_succ_le hn)) + +@[simp] theorem prefixLaw_zero_mass (h : FiniteLabelHierarchy Label depth) + (hn : 0 ≤ depth) (r : LabelRecord Label 0) : + (h.prefixLaw 0 hn).mass r = 1 := rfl + +@[simp] theorem prefixLaw_succ (h : FiniteLabelHierarchy Label depth) + (n : ℕ) (hn : n + 1 ≤ depth) : + h.prefixLaw (n + 1) hn = + (h.prefixLaw n (Nat.le_of_succ_le hn)).joint + (h.conditional n (Nat.lt_of_succ_le hn)) := rfl + +@[simp] theorem prefixLaw_succ_mass (h : FiniteLabelHierarchy Label depth) + (n : ℕ) (hn : n + 1 ≤ depth) (r : LabelRecord Label n) (s : Label n) : + (h.prefixLaw (n + 1) hn).mass (r, s) = + (h.prefixLaw n (Nat.le_of_succ_le hn)).mass r * + (h.conditional n (Nat.lt_of_succ_le hn) r).mass s := rfl + +def refinementEntropy (h : FiniteLabelHierarchy Label depth) (n : ℕ) : ℝ := + if hn : n < depth then + ∑ r, (h.prefixLaw n (Nat.le_of_lt hn)).mass r * + finiteEntropy (h.conditional n hn r).mass + else 0 + +theorem refinementEntropy_eq (h : FiniteLabelHierarchy Label depth) + (n : ℕ) (hn : n < depth) : + h.refinementEntropy n = + ∑ r, (h.prefixLaw n (Nat.le_of_lt hn)).mass r * + finiteEntropy (h.conditional n hn r).mass := by + simp only [refinementEntropy, dite_eq_left hn] + +@[simp] theorem refinementEntropy_eq_zero_of_le + (h : FiniteLabelHierarchy Label depth) {n : ℕ} (hn : depth ≤ n) : + h.refinementEntropy n = 0 := by + simp only [refinementEntropy, dite_eq_right (Nat.not_lt.mpr hn)] + +theorem zero_prefix_contribution (h : FiniteLabelHierarchy Label depth) + (n : ℕ) (hn : n < depth) (r : LabelRecord Label n) + (hr : (h.prefixLaw n (Nat.le_of_lt hn)).mass r = 0) : + (h.prefixLaw n (Nat.le_of_lt hn)).mass r * + finiteEntropy (h.conditional n hn r).mass = 0 := by + rw [hr, zero_mul] + +theorem prefixLaw_entropy_succ (h : FiniteLabelHierarchy Label depth) + (n : ℕ) (hn : n + 1 ≤ depth) : + finiteEntropy (h.prefixLaw (n + 1) hn).mass = + finiteEntropy (h.prefixLaw n (Nat.le_of_succ_le hn)).mass + + h.refinementEntropy n := by + rw [refinementEntropy_eq h n (Nat.lt_of_succ_le hn)] + exact FiniteLaw.joint_entropy (h.prefixLaw n (Nat.le_of_succ_le hn)) + (h.conditional n (Nat.lt_of_succ_le hn)) + +theorem prefixLaw_entropy (h : FiniteLabelHierarchy Label depth) + (n : ℕ) (hn : n ≤ depth) : + finiteEntropy (h.prefixLaw n hn).mass = + ∑ j ∈ Finset.range n, h.refinementEntropy j := by + induction n with + | zero => + simp [prefixLaw, finiteEntropy, entropyTerm, LabelRecord] + | succ n ih => + rw [prefixLaw_entropy_succ h n hn, + ih (Nat.le_of_succ_le hn), Finset.sum_range_succ] + +def recordLaw (h : FiniteLabelHierarchy Label depth) : + FiniteLaw (LabelRecord Label depth) := h.prefixLaw depth le_rfl + +theorem recordLaw_entropy (h : FiniteLabelHierarchy Label depth) : + finiteEntropy h.recordLaw.mass = + ∑ j ∈ Finset.range depth, h.refinementEntropy j := + h.prefixLaw_entropy depth le_rfl + +theorem refinementEntropy_sum_of_injective_record + {A : Type v} [Fintype A] (h : FiniteLabelHierarchy Label depth) + (p : FiniteLaw A) (record : A → LabelRecord Label depth) + (hinjective : Function.Injective record) + (hmass : h.recordLaw.mass = (p.map record).mass) : + (∑ j ∈ Finset.range depth, h.refinementEntropy j) = finiteEntropy p.mass := by + calc + (∑ j ∈ Finset.range depth, h.refinementEntropy j) = + finiteEntropy h.recordLaw.mass := h.recordLaw_entropy.symm + _ = finiteEntropy (p.map record).mass := congrArg finiteEntropy hmass + _ = finiteEntropy p.mass := p.map_entropy_of_injective record hinjective + +def ofLawLabels {A : Type v} [Fintype A] (p : FiniteLaw A) + (labels : ∀ n, A → Label n) (depth : ℕ) : FiniteLabelHierarchy Label depth where + conditional n _ r := (p.conditional (labelRecordOf labels n) r).map (labels n) + +theorem ofLawLabels_prefixLaw_mass {A : Type v} [Fintype A] + (p : FiniteLaw A) (labels : ∀ n, A → Label n) + (depth n : ℕ) (hn : n ≤ depth) : + ((ofLawLabels p labels depth).prefixLaw n hn).mass = + (p.map (labelRecordOf labels n)).mass := by + classical + induction n with + | zero => + funext r + rw [prefixLaw_zero_mass, FiniteLaw.map_mass] + refine p.total.symm.trans ?_ + apply Finset.sum_congr rfl + intro a _ + rw [ite_eq_left (show labelRecordOf labels 0 a = r by cases r; rfl)] + | succ n ih => + funext rs + rcases rs with ⟨r, s⟩ + rw [prefixLaw_succ_mass] + change ((ofLawLabels p labels depth).prefixLaw n + (Nat.le_of_succ_le hn)).mass r * + ((p.conditional (labelRecordOf labels n) r).map (labels n)).mass s = + (p.map (labelRecordOf labels (n + 1))).mass (r, s) + rw [ih (Nat.le_of_succ_le hn)] + exact p.map_mass_mul_conditional_map + (labelRecordOf labels n) (labels n) r s + +theorem ofLawLabels_refinementEntropy_eq {A : Type v} [Fintype A] + (p : FiniteLaw A) (labels : ∀ n, A → Label n) + (depth n : ℕ) (hn : n < depth) : + (ofLawLabels p labels depth).refinementEntropy n = + ∑ r : LabelRecord Label n, (p.map (labelRecordOf labels n)).mass r * + finiteEntropy ((p.conditional (labelRecordOf labels n) r).map (labels n)).mass := by + rw [refinementEntropy_eq _ n hn, + ofLawLabels_prefixLaw_mass p labels depth n (Nat.le_of_lt hn)] + rfl + +theorem ofLawLabels_refinementEntropy_sum {A : Type v} [Fintype A] + (p : FiniteLaw A) (labels : ∀ n, A → Label n) (depth : ℕ) + (hinjective : Function.Injective (labelRecordOf labels depth)) : + (∑ j ∈ Finset.range depth, + (ofLawLabels p labels depth).refinementEntropy j) = finiteEntropy p.mass := by + apply (ofLawLabels p labels depth).refinementEntropy_sum_of_injective_record + p (labelRecordOf labels depth) hinjective + exact ofLawLabels_prefixLaw_mass p labels depth depth le_rfl + +theorem entropy_eq_sum_conditional_labels {A : Type v} [Fintype A] + (p : FiniteLaw A) (labels : ∀ n, A → Label n) (depth : ℕ) + (hinjective : Function.Injective (labelRecordOf labels depth)) : + finiteEntropy p.mass = + ∑ j ∈ Finset.range depth, ∑ r : LabelRecord Label j, + (p.map (labelRecordOf labels j)).mass r * + finiteEntropy ((p.conditional (labelRecordOf labels j) r).map (labels j)).mass := by + rw [← ofLawLabels_refinementEntropy_sum p labels depth hinjective] + apply Finset.sum_congr rfl + intro j hj + exact ofLawLabels_refinementEntropy_eq p labels depth j (Finset.mem_range.mp hj) + +end FiniteLabelHierarchy + +end +end MatrixMultiplication.Foundation + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/Entropy/ComplexHierarchySeparationRates.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/Entropy/ComplexHierarchySeparationRates.lean new file mode 100644 index 0000000000000000000000000000000000000000..5951efd697b949e60a8ee63b18995347e21c217a --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/Entropy/ComplexHierarchySeparationRates.lean @@ -0,0 +1,329 @@ +import OAI.LinearAlgebra.MatrixMultiplication.Entropy.ComplexTypeEntropy +import OAI.LinearAlgebra.MatrixMultiplication.Separation.ComplexHierarchyTypeCounting +import OAI.LinearAlgebra.MatrixMultiplication.Entropy.ComplexSeparationAsymptotics +import OAI.LinearAlgebra.MatrixMultiplication.Separation.ComplexLabelHierarchySeparation + +namespace OAI + +/-! Finite entropy, rate estimates and ordered asymptotic limits. -/ + +noncomputable section + +namespace MatrixMultiplication.Foundation + +open Filter +open scoped BigOperators Topology + +namespace LabelHierarchySeparation + +theorem poolAuxiliaryCost_pos (k : ℕ) : 0 < poolAuxiliaryCost k := by + unfold poolAuxiliaryCost + split_ifs + · exact Nat.zero_lt_one + · exact Separation.gridGroupOrder_pos k + +theorem population_le_poolAuxiliaryCost (k : ℕ) : k ≤ poolAuxiliaryCost k := by + unfold poolAuxiliaryCost + split_ifs with hk + · simp [hk] + · exact Separation.population_le_gridGroupOrder k + +theorem poolAuxiliaryCost_le_gridGroupOrder (k : ℕ) : + poolAuxiliaryCost k ≤ Separation.gridGroupOrder k := by + unfold poolAuxiliaryCost + split_ifs with hk + · simpa only [hk] using Separation.population_le_gridGroupOrder k + · exact le_rfl + +theorem tendsto_log_poolAuxiliaryCost_div_nat {K : ℕ → ℕ} {H : ℝ} + (hK : ∀ n, 0 < K n) (hH : 0 ≤ H) + (hpop : Tendsto (fun n => Real.log (K n : ℝ) / (n : ℝ)) atTop (𝓝 H)) : + Tendsto (fun n => Real.log (poolAuxiliaryCost (K n) : ℝ) / (n : ℝ)) + atTop (𝓝 H) := by + refine tendsto_of_tendsto_of_tendsto_of_le_of_le hpop + (Separation.tendsto_log_gridGroupOrder_div_nat hK hH hpop) ?_ ?_ + · intro n + apply div_le_div_of_nonneg_right _ (Nat.cast_nonneg n) + exact Real.log_le_log (Nat.cast_pos.mpr (hK n)) + (by exact_mod_cast population_le_poolAuxiliaryCost (K n)) + · intro n + apply div_le_div_of_nonneg_right _ (Nat.cast_nonneg n) + exact Real.log_le_log (Nat.cast_pos.mpr (poolAuxiliaryCost_pos (K n))) + (by exact_mod_cast poolAuxiliaryCost_le_gridGroupOrder (K n)) + +end LabelHierarchySeparation + +namespace HierarchySeparationRates + +universe u v w + +def populationEntropyRate {B : Type*} [Fintype B] (counts : B → ℕ) : ℝ := + (∑ b, counts b : ℕ) * + finiteEntropy (fun b => (counts b : ℝ) / (∑ b, counts b : ℕ)) + +theorem tendsto_log_multinomial_mul_div_repetition {B : Type*} [Fintype B] + (counts : B → ℕ) : + Tendsto + (fun t : ℕ => + Real.log (Nat.multinomial Finset.univ (fun b => t * counts b) : ℝ) / (t : ℝ)) + atTop (𝓝 (populationEntropyRate counts)) := by + by_cases hD : 0 < ∑ b, counts b + · have hD' : ((∑ b, counts b : ℕ) : ℝ) ≠ 0 := + Nat.cast_ne_zero.mpr (Nat.ne_of_gt hD) + have h := (tendsto_log_multinomial_mul counts hD).const_mul + ((∑ b, counts b : ℕ) : ℝ) + apply h.congr + intro t + by_cases ht : t = 0 + · simp [ht] + have ht' : (t : ℝ) ≠ 0 := Nat.cast_ne_zero.mpr ht + change ((∑ b, counts b : ℕ) : ℝ) * + (Real.log (Nat.multinomial Finset.univ (fun b => t * counts b) : ℝ) / + ((t : ℝ) * (∑ b, counts b : ℕ))) = _ + field_simp [hD', ht'] + · have hz : (∑ b, counts b) = 0 := Nat.eq_zero_of_not_pos hD + have hc (b : B) : counts b = 0 := by + apply Nat.eq_zero_of_le_zero + calc + counts b ≤ ∑ c, counts c := + Finset.single_le_sum (fun c _ => Nat.zero_le _) (Finset.mem_univ b) + _ = 0 := hz + simp only [populationEntropyRate, hz, Nat.cast_zero, zero_mul] + simp [Nat.multinomial, hc] + +theorem populationEntropyRate_nonneg {B : Type*} [Fintype B] (counts : B → ℕ) : + 0 ≤ populationEntropyRate counts := by + apply ge_of_tendsto' (tendsto_log_multinomial_mul_div_repetition counts) + intro t + apply div_nonneg _ (Nat.cast_nonneg t) + apply Real.log_nonneg + exact_mod_cast Nat.one_le_iff_ne_zero.mpr + (Nat.ne_of_gt (Nat.multinomial_pos Finset.univ (fun b => t * counts b))) + +section FinitePools + +variable {I : Type u} [Fintype I] {Alphabet : I → Type v} + [∀ i, Fintype (Alphabet i)] + +def poolTypeCount (counts : ∀ i, Alphabet i → ℕ) (i : I) (t : ℕ) : ℕ := + Nat.multinomial Finset.univ (fun b => t * counts i b) + +def poolEntropyTotal (counts : ∀ i, Alphabet i → ℕ) : ℝ := + ∑ i, populationEntropyRate (counts i) + +def pairingProduct (counts : ∀ i, Alphabet i → ℕ) (t : ℕ) : ℕ := + ∏ i, poolTypeCount counts i t + +def gridProduct (counts : ∀ i, Alphabet i → ℕ) (t : ℕ) : ℕ := + ∏ i, Separation.gridGroupOrder (poolTypeCount counts i t) + +def auxiliaryProduct (counts : ∀ i, Alphabet i → ℕ) (t : ℕ) : ℕ := + ∏ i, LabelHierarchySeparation.poolAuxiliaryCost (poolTypeCount counts i t) + +omit [Fintype I] in +theorem poolTypeCount_pos (counts : ∀ i, Alphabet i → ℕ) (i : I) (t : ℕ) : + 0 < poolTypeCount counts i t := Nat.multinomial_pos _ _ + +theorem pairingProduct_le_auxiliaryProduct (counts : ∀ i, Alphabet i → ℕ) (t : ℕ) : + pairingProduct counts t ≤ auxiliaryProduct counts t := by + exact Finset.prod_le_prod (fun i _ => + LabelHierarchySeparation.population_le_poolAuxiliaryCost (poolTypeCount counts i t)) + +theorem auxiliaryProduct_le_gridProduct (counts : ∀ i, Alphabet i → ℕ) (t : ℕ) : + auxiliaryProduct counts t ≤ gridProduct counts t := by + exact Finset.prod_le_prod (fun i _ => + LabelHierarchySeparation.poolAuxiliaryCost_le_gridGroupOrder (poolTypeCount counts i t)) + +omit [Fintype I] in +theorem tendsto_log_poolTypeCount_div (counts : ∀ i, Alphabet i → ℕ) (i : I) : + Tendsto (fun t : ℕ => Real.log (poolTypeCount counts i t : ℝ) / (t : ℝ)) + atTop (𝓝 (populationEntropyRate (counts i))) := + tendsto_log_multinomial_mul_div_repetition (counts i) + +theorem tendsto_log_pairingProduct_div (counts : ∀ i, Alphabet i → ℕ) : + Tendsto (fun t : ℕ => Real.log (pairingProduct counts t : ℝ) / (t : ℝ)) + atTop (𝓝 (poolEntropyTotal counts)) := by + exact Separation.tendsto_log_nat_prod_div_nat Finset.univ + (fun i _ t => poolTypeCount_pos counts i t) + (fun i _ => tendsto_log_poolTypeCount_div counts i) + +theorem tendsto_log_gridProduct_div (counts : ∀ i, Alphabet i → ℕ) : + Tendsto (fun t : ℕ => Real.log (gridProduct counts t : ℝ) / (t : ℝ)) + atTop (𝓝 (poolEntropyTotal counts)) := by + exact Separation.tendsto_log_gridGroupOrder_prod_div_nat Finset.univ + (fun i _ t => poolTypeCount_pos counts i t) + (fun i _ => populationEntropyRate_nonneg (counts i)) + (fun i _ => tendsto_log_poolTypeCount_div counts i) + +theorem tendsto_log_auxiliaryProduct_div (counts : ∀ i, Alphabet i → ℕ) : + Tendsto (fun t : ℕ => Real.log (auxiliaryProduct counts t : ℝ) / (t : ℝ)) + atTop (𝓝 (poolEntropyTotal counts)) := by + exact Separation.tendsto_log_nat_prod_div_nat Finset.univ + (fun i _ t => LabelHierarchySeparation.poolAuxiliaryCost_pos (poolTypeCount counts i t)) + (fun i _ => LabelHierarchySeparation.tendsto_log_poolAuxiliaryCost_div_nat + (poolTypeCount_pos counts i) (populationEntropyRate_nonneg (counts i)) + (tendsto_log_poolTypeCount_div counts i)) + +end FinitePools + +section SourceHierarchy + +variable {A : Type u} [Fintype A] {Label : ℕ → Type v} + [∀ n, Fintype (Label n)] + +theorem pushforwardCounts_mul {B : Type*} (counts : A → ℕ) (label : A → B) + (t : ℕ) (b : B) : + pushforwardCounts (fun a => t * counts a) label b = + t * pushforwardCounts counts label b := by + classical + unfold pushforwardCounts + rw [Finset.mul_sum] + apply Finset.sum_congr rfl + intro a _ + by_cases h : label a = b <;> simp [h] + +omit [∀ n, Fintype (Label n)] in +theorem sourcePrefixCounts_mul (counts : A → ℕ) (labels : ∀ n, A → Label n) + (t n : ℕ) (r : LabelRecord Label n) : + LabelHierarchyCounts.sourcePrefixCounts (fun a => t * counts a) labels n r = + t * LabelHierarchyCounts.sourcePrefixCounts counts labels n r := + pushforwardCounts_mul counts (labelRecordOf labels n) t r + +abbrev PrefixPool (Label : ℕ → Type v) (depth : ℕ) := + Σ n : Fin depth, LabelRecord Label n.val + +def sourcePoolCounts (counts : A → ℕ) (labels : ∀ n, A → Label n) (depth : ℕ) + (j : PrefixPool Label depth) (s : Label j.1.val) : ℕ := + LabelHierarchyCounts.sourcePrefixCounts counts labels (j.1.val + 1) (j.2, s) + +theorem pairingProduct_source_eq (counts : A → ℕ) (labels : ∀ n, A → Label n) + (depth : ℕ) (hinjective : Function.Injective (labelRecordOf labels depth)) (t : ℕ) : + pairingProduct (sourcePoolCounts counts labels depth) t = + Nat.multinomial Finset.univ (fun a => t * counts a) := by + classical + unfold pairingProduct + rw [Fintype.prod_sigma] + have hpool (n : Fin depth) : + (∏ r : LabelRecord Label n.val, + poolTypeCount (sourcePoolCounts counts labels depth) ⟨n, r⟩ t) = + LabelHierarchyCounts.refinementCount + (LabelHierarchyCounts.sourcePrefixCounts (fun a => t * counts a) labels) n.val := by + apply Finset.prod_congr rfl + intro r _ + change Nat.multinomial Finset.univ + (fun s : Label n.val => t * + LabelHierarchyCounts.sourcePrefixCounts counts labels (n.val + 1) (r, s)) = + Nat.multinomial Finset.univ + (fun s : Label n.val => + LabelHierarchyCounts.sourcePrefixCounts (fun a => t * counts a) + labels (n.val + 1) (r, s)) + apply Nat.multinomial_congr + intro s _ + exact (sourcePrefixCounts_mul counts labels t (n.val + 1) (r, s)).symm + simp_rw [hpool] + rw [Fin.prod_univ_eq_prod_range] + exact LabelHierarchyCounts.source_refinementCount_product + (fun a => t * counts a) labels depth hinjective + +theorem pairingProduct_source_eq_exactWords_card [DecidableEq A] + (counts : A → ℕ) (labels : ∀ n, A → Label n) (depth : ℕ) + (hinjective : Function.Injective (labelRecordOf labels depth)) (t : ℕ) : + pairingProduct (sourcePoolCounts counts labels depth) t = + Fintype.card (ExactWords (fun a => t * counts a)) := by + rw [pairingProduct_source_eq counts labels depth hinjective, exactWords_card] + +theorem source_poolEntropyTotal_eq (counts : A → ℕ) (labels : ∀ n, A → Label n) + (depth : ℕ) (hinjective : Function.Injective (labelRecordOf labels depth)) : + poolEntropyTotal (sourcePoolCounts counts labels depth) = populationEntropyRate counts := by + have hsource : Tendsto + (fun t : ℕ => Real.log (pairingProduct (sourcePoolCounts counts labels depth) t : ℝ) / + (t : ℝ)) atTop (𝓝 (populationEntropyRate counts)) := by + simpa only [pairingProduct_source_eq counts labels depth hinjective] using + tendsto_log_multinomial_mul_div_repetition counts + exact tendsto_nhds_unique + (tendsto_log_pairingProduct_div (sourcePoolCounts counts labels depth)) hsource + +private theorem normalized_of_per_repetition (counts : A → ℕ) + (hD : 0 < ∑ a, counts a) (K : ℕ → ℕ) + (h : Tendsto (fun t : ℕ => Real.log (K t : ℝ) / (t : ℝ)) + atTop (𝓝 (populationEntropyRate counts))) : + Tendsto (fun t : ℕ => Real.log (K t : ℝ) / ((t : ℝ) * (∑ a, counts a : ℕ))) + atTop (𝓝 (finiteEntropy (fun a => (counts a : ℝ) / (∑ a, counts a : ℕ)))) := by + have hD' : ((∑ a, counts a : ℕ) : ℝ) ≠ 0 := + Nat.cast_ne_zero.mpr (Nat.ne_of_gt hD) + have hmain : populationEntropyRate counts / (∑ a, counts a : ℕ) = + finiteEntropy (fun a => (counts a : ℝ) / (∑ a, counts a : ℕ)) := by + unfold populationEntropyRate + exact mul_div_cancel_left₀ _ hD' + simpa only [div_div, hmain] using h.div_const ((∑ a, counts a : ℕ) : ℝ) + +theorem tendsto_log_source_pairingProduct (counts : A → ℕ) + (hD : 0 < ∑ a, counts a) (labels : ∀ n, A → Label n) (depth : ℕ) + (hinjective : Function.Injective (labelRecordOf labels depth)) : + Tendsto + (fun t : ℕ => Real.log (pairingProduct (sourcePoolCounts counts labels depth) t : ℝ) / + ((t : ℝ) * (∑ a, counts a : ℕ))) + atTop (𝓝 (finiteEntropy (fun a => (counts a : ℝ) / (∑ a, counts a : ℕ)))) := by + simpa only [pairingProduct_source_eq counts labels depth hinjective] using + tendsto_log_multinomial_mul counts hD + +theorem tendsto_log_source_gridProduct (counts : A → ℕ) + (hD : 0 < ∑ a, counts a) (labels : ∀ n, A → Label n) (depth : ℕ) + (hinjective : Function.Injective (labelRecordOf labels depth)) : + Tendsto + (fun t : ℕ => Real.log (gridProduct (sourcePoolCounts counts labels depth) t : ℝ) / + ((t : ℝ) * (∑ a, counts a : ℕ))) + atTop (𝓝 (finiteEntropy (fun a => (counts a : ℝ) / (∑ a, counts a : ℕ)))) := by + apply normalized_of_per_repetition counts hD + simpa only [source_poolEntropyTotal_eq counts labels depth hinjective] using + tendsto_log_gridProduct_div (sourcePoolCounts counts labels depth) + +theorem tendsto_log_source_auxiliaryProduct (counts : A → ℕ) + (hD : 0 < ∑ a, counts a) (labels : ∀ n, A → Label n) (depth : ℕ) + (hinjective : Function.Injective (labelRecordOf labels depth)) : + Tendsto + (fun t : ℕ => Real.log (auxiliaryProduct (sourcePoolCounts counts labels depth) t : ℝ) / + ((t : ℝ) * (∑ a, counts a : ℕ))) + atTop (𝓝 (finiteEntropy (fun a => (counts a : ℝ) / (∑ a, counts a : ℕ)))) := by + apply normalized_of_per_repetition counts hD + simpa only [source_poolEntropyTotal_eq counts labels depth hinjective] using + tendsto_log_auxiliaryProduct_div (sourcePoolCounts counts labels depth) + +theorem rationalLaw_exists_source_rates [DecidableEq A] (p : RationalLaw A) + (labels : ∀ n, A → Label n) (depth : ℕ) + (hinjective : Function.Injective (labelRecordOf labels depth)) : + ∃ counts : A → ℕ, 0 < ∑ a, counts a ∧ + (∀ a, (counts a : ℝ) / (∑ a, counts a : ℕ) = p.toFiniteLaw.mass a) ∧ + Tendsto + (fun t : ℕ => Real.log (Fintype.card (ExactWords (fun a => t * counts a)) : ℝ) / + ((t : ℝ) * (∑ a, counts a : ℕ))) + atTop (𝓝 (finiteEntropy p.toFiniteLaw.mass)) ∧ + Tendsto + (fun t : ℕ => Real.log (pairingProduct (sourcePoolCounts counts labels depth) t : ℝ) / + ((t : ℝ) * (∑ a, counts a : ℕ))) + atTop (𝓝 (finiteEntropy p.toFiniteLaw.mass)) ∧ + Tendsto + (fun t : ℕ => Real.log (gridProduct (sourcePoolCounts counts labels depth) t : ℝ) / + ((t : ℝ) * (∑ a, counts a : ℕ))) + atTop (𝓝 (finiteEntropy p.toFiniteLaw.mass)) ∧ + Tendsto + (fun t : ℕ => Real.log (auxiliaryProduct (sourcePoolCounts counts labels depth) t : ℝ) / + ((t : ℝ) * (∑ a, counts a : ℕ))) + atTop (𝓝 (finiteEntropy p.toFiniteLaw.mass)) := by + obtain ⟨counts, hD, hmass⟩ := p.exists_type_representation + have hfun : (fun a => (counts a : ℝ) / (∑ a, counts a : ℕ)) = + p.toFiniteLaw.mass := funext hmass + refine ⟨counts, hD, hmass, ?_, ?_, ?_, ?_⟩ + · simpa only [hfun] using tendsto_log_exactWords_card_mul counts hD + · simpa only [hfun] using tendsto_log_source_pairingProduct counts hD labels depth hinjective + · simpa only [hfun] using tendsto_log_source_gridProduct counts hD labels depth hinjective + · simpa only [hfun] using tendsto_log_source_auxiliaryProduct counts hD labels depth hinjective + +end SourceHierarchy + +end HierarchySeparationRates +end MatrixMultiplication.Foundation + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/Entropy/ComplexOrientationRates.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/Entropy/ComplexOrientationRates.lean new file mode 100644 index 0000000000000000000000000000000000000000..10e147a63431b04da5de54c786989c4276f12977 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/Entropy/ComplexOrientationRates.lean @@ -0,0 +1,279 @@ +import Mathlib.Data.Fintype.Perm +import Mathlib.Data.Fintype.BigOperators +import Mathlib.Algebra.BigOperators.Field +import Mathlib.Algebra.BigOperators.Group.Finset.Piecewise +import Mathlib.Analysis.SpecialFunctions.Log.Basic +import Mathlib.Tactic.FieldSimp +import Mathlib.Tactic.NormNum +import Mathlib.Tactic.Ring + +namespace OAI + +/-! Finite entropy, rate estimates and ordered asymptotic limits. -/ + +noncomputable section + +namespace MatrixMultiplication.Foundation +namespace OrientationRates + +open scoped BigOperators + +abbrev Orientation := Equiv.Perm (Fin 3) + +@[simp] theorem orientation_card : Fintype.card Orientation = 6 := by + rw [Fintype.card_perm] + decide + +def relativeOrientation (relative : Orientation) : Orientation ≃ Orientation where + toFun outer := outer * relative + invFun original := original * relative⁻¹ + left_inv outer := by simp [mul_assoc] + right_inv original := by simp [mul_assoc] + +@[simp] theorem relativeOrientation_apply (relative outer : Orientation) : + relativeOrientation relative outer = outer * relative := rfl + +theorem unique_outer_orientation (relative original : Orientation) : + ∃! outer : Orientation, outer * relative = original := + (relativeOrientation relative).bijective.existsUnique original + +theorem sum_relative_orientation {M : Type*} [AddCommMonoid M] + (relative : Orientation) (value : Orientation → M) : + (∑ outer, value (outer * relative)) = ∑ original, value original := + (relativeOrientation relative).sum_comp value + +theorem prod_relative_orientation {M : Type*} [CommMonoid M] + (relative : Orientation) (value : Orientation → M) : + (∏ outer, value (outer * relative)) = ∏ original, value original := + (relativeOrientation relative).prod_comp value + +theorem site_population_in_orientation {M : Type*} [AddCommMonoid M] + (relative original : Orientation) (population : M) : + (∑ outer : Orientation, + if outer * relative = original then population else 0) = population := by + classical + rw [sum_relative_orientation relative + (fun orientation => if orientation = original then population else 0)] + simp + +theorem histogram_in_original_orientation {Site M : Type*} + [Fintype Site] [AddCommMonoid M] + (relative : Site → Orientation) (population : Site → M) + (original : Orientation) : + (∑ site, ∑ outer : Orientation, + if outer * relative site = original then population site else 0) = + ∑ site, population site := by + classical + apply Finset.sum_congr rfl + intro site _ + exact site_population_in_orientation (relative site) original (population site) + +theorem target_multiplicity (targetCount : ℕ) : + (∏ _ : Orientation, targetCount) = targetCount ^ 6 := by + simp + +section FiniteRates + +variable {Node Grade : Type*} [Fintype Node] [Fintype Grade] + +def outputLaw (n : ℕ) (population : Node → ℝ) (law : Node → Grade → ℝ) + (grade : Grade) : ℝ := + (∑ node, population node * law node grade) / n + +def affineScore (offset : ℝ) (coefficient law : Grade → ℝ) : ℝ := + offset + ∑ grade, coefficient grade * law grade + +def totalNodeUtility (population utility : Node → ℝ) : ℝ := + ∑ node, population node * utility node + +def totalCost (population : Node → ℝ) (law : Node → Grade → ℝ) + (offset : ℝ) (coefficient : Grade → ℝ) (utility : Node → ℝ) : ℝ := + ∑ node, population node * (affineScore offset coefficient (law node) - utility node) + +omit [Fintype Grade] in +theorem outputLaw_nonnegative (n : ℕ) (population : Node → ℝ) + (law : Node → Grade → ℝ) + (hp : ∀ node, 0 ≤ population node) (hq : ∀ node grade, 0 ≤ law node grade) + (grade : Grade) : 0 ≤ outputLaw n population law grade := by + apply div_nonneg + · exact Finset.sum_nonneg fun node _ => mul_nonneg (hp node) (hq node grade) + · exact Nat.cast_nonneg n + +theorem outputLaw_total (n : ℕ) (hn : n ≠ 0) (population : Node → ℝ) + (law : Node → Grade → ℝ) + (hp : ∑ node, population node = (n : ℝ)) + (hq : ∀ node, ∑ grade, law node grade = 1) : + ∑ grade, outputLaw n population law grade = 1 := by + have hn' : (n : ℝ) ≠ 0 := Nat.cast_ne_zero.mpr hn + simp only [outputLaw, ← Finset.sum_div] + rw [Finset.sum_comm] + simp only [← Finset.mul_sum, hq, mul_one, hp, div_self hn'] + +theorem weighted_affineScore (population : Node → ℝ) (law : Node → Grade → ℝ) + (offset : ℝ) (coefficient : Grade → ℝ) : + (∑ node, population node * affineScore offset coefficient (law node)) = + (∑ node, population node) * offset + + ∑ grade, coefficient grade * (∑ node, population node * law node grade) := by + simp only [affineScore, mul_add, Finset.sum_add_distrib, ← Finset.sum_mul] + congr 1 + calc + (∑ node, population node * ∑ grade, coefficient grade * law node grade) = + ∑ node, ∑ grade, coefficient grade * (population node * law node grade) := by + apply Finset.sum_congr rfl + intro node _ + rw [Finset.mul_sum] + apply Finset.sum_congr rfl + intro grade _ + ring + _ = ∑ grade, coefficient grade * ∑ node, population node * law node grade := by + rw [Finset.sum_comm] + simp only [Finset.mul_sum] + +theorem weighted_affineScore_eq (n : ℕ) (hn : n ≠ 0) + (population : Node → ℝ) (law : Node → Grade → ℝ) + (hp : ∑ node, population node = (n : ℝ)) + (offset : ℝ) (coefficient : Grade → ℝ) : + (∑ node, population node * affineScore offset coefficient (law node)) = + (n : ℝ) * affineScore offset coefficient (outputLaw n population law) := by + have hn' : (n : ℝ) ≠ 0 := Nat.cast_ne_zero.mpr hn + rw [weighted_affineScore, hp] + simp only [affineScore, outputLaw] + conv_rhs => rw [mul_add, Finset.mul_sum] + congr 1 + apply Finset.sum_congr rfl + intro grade _ + field_simp [hn'] + +theorem totalCost_eq (n : ℕ) (hn : n ≠ 0) + (population : Node → ℝ) (law : Node → Grade → ℝ) + (hp : ∑ node, population node = (n : ℝ)) + (offset : ℝ) (coefficient : Grade → ℝ) (utility : Node → ℝ) : + totalCost population law offset coefficient utility = + (n : ℝ) * affineScore offset coefficient (outputLaw n population law) - + totalNodeUtility population utility := by + simp only [totalCost, mul_sub, Finset.sum_sub_distrib, totalNodeUtility] + rw [weighted_affineScore_eq n hn population law hp] + +theorem utility_rate_identity (n : ℕ) (hn : n ≠ 0) + (population : Node → ℝ) (law : Node → Grade → ℝ) + (hp : ∑ node, population node = (n : ℝ)) + (offset targetRate : ℝ) (coefficient : Grade → ℝ) (utility : Node → ℝ) : + (targetRate + totalNodeUtility population utility) / n = + affineScore offset coefficient (outputLaw n population law) + + (targetRate - totalCost population law offset coefficient utility) / n := by + have hn' : (n : ℝ) ≠ 0 := Nat.cast_ne_zero.mpr hn + rw [totalCost_eq n hn population law hp] + field_simp [hn'] + ring + +theorem finite_utility_bound (n : ℕ) (hn : n ≠ 0) + (population : Node → ℝ) (law : Node → Grade → ℝ) + (hp : ∑ node, population node = (n : ℝ)) + (offset targetRate error actualUtility : ℝ) + (coefficient : Grade → ℝ) (utility : Node → ℝ) + (construction : (targetRate + totalNodeUtility population utility) / n - error ≤ + actualUtility) : + affineScore offset coefficient (outputLaw n population law) + + (targetRate - totalCost population law offset coefficient utility) / n - error ≤ + actualUtility := by + rwa [utility_rate_identity n hn population law hp offset targetRate coefficient utility] + at construction + +end FiniteRates + +section PhysicalNormalization + +variable {Node : Type*} [Fintype Node] + +theorem log_resource_product (copies : Node → ℕ) (resource : Node → ℝ) + (hresource : ∀ node, resource node ≠ 0) : + Real.log (∏ node, resource node ^ copies node) = + ∑ node, (copies node : ℝ) * Real.log (resource node) := by + rw [Real.log_prod (s := Finset.univ) (f := fun node => resource node ^ copies node) + (fun node _ => pow_ne_zero _ (hresource node))] + simp only [Real.log_pow] + +theorem log_direct_multiplicity (targetCount : ℝ) (htarget : targetCount ≠ 0) + (copies : Node → ℕ) (labels : Node → ℝ) (hlabels : ∀ node, labels node ≠ 0) : + Real.log (targetCount ^ 6 * ∏ node, labels node ^ copies node) = + 6 * Real.log targetCount + ∑ node, (copies node : ℝ) * Real.log (labels node) := by + have hprod : (∏ node, labels node ^ copies node) ≠ 0 := + Finset.prod_ne_zero_iff.mpr (fun node _ => pow_ne_zero _ (hlabels node)) + rw [Real.log_mul (pow_ne_zero _ htarget) hprod, Real.log_pow, + log_resource_product copies labels hlabels] + norm_num + +theorem raw_utility_accounting (targetCount : ℝ) (htarget : targetCount ≠ 0) + (copies : Node → ℕ) (labels rank volume : Node → ℝ) + (hlabels : ∀ node, labels node ≠ 0) (hrank : ∀ node, rank node ≠ 0) + (hvolume : ∀ node, volume node ≠ 0) (volumeWeight : ℝ) : + Real.log (targetCount ^ 6 * ∏ node, labels node ^ copies node) - + Real.log (∏ node, rank node ^ copies node) + + volumeWeight * Real.log (∏ node, volume node ^ copies node) = + 6 * Real.log targetCount + + ∑ node, (copies node : ℝ) * + (Real.log (labels node) - Real.log (rank node) + + volumeWeight * Real.log (volume node)) := by + rw [log_direct_multiplicity targetCount htarget copies labels hlabels, + log_resource_product copies rank hrank, log_resource_product copies volume hvolume] + simp only [mul_add, mul_sub, Finset.sum_add_distrib, Finset.sum_sub_distrib] + rw [Finset.mul_sum] + have hvolumeSum : + (∑ node, volumeWeight * ((copies node : ℝ) * Real.log (volume node))) = + ∑ node, (copies node : ℝ) * (volumeWeight * Real.log (volume node)) := by + apply Finset.sum_congr rfl + intro node _ + ring + rw [hvolumeSum] + ring + +theorem physical_rate_normalization (bank horizon : ℕ) + (hbank : bank ≠ 0) (hhorizon : horizon ≠ 0) + (blockSize copies : Node → ℕ) (hsize : ∀ node, blockSize node ≠ 0) + (population rawNodeUtility : Node → ℝ) (targetLog : ℝ) + (tiling : ∀ node, (bank : ℝ) * population node = + (copies node : ℝ) * blockSize node) : + (6 * targetLog + ∑ node, (copies node : ℝ) * rawNodeUtility node) / + (6 * bank * horizon) = + (targetLog / bank + totalNodeUtility population + (fun node => rawNodeUtility node / (6 * blockSize node))) / horizon := by + have hbank' : (bank : ℝ) ≠ 0 := Nat.cast_ne_zero.mpr hbank + have hhorizon' : (horizon : ℝ) ≠ 0 := Nat.cast_ne_zero.mpr hhorizon + have hnode (node : Node) : + population node * (rawNodeUtility node / (6 * blockSize node)) = + (copies node : ℝ) * rawNodeUtility node / (6 * bank) := by + have hsize' : (blockSize node : ℝ) ≠ 0 := Nat.cast_ne_zero.mpr (hsize node) + have hp : population node = (copies node : ℝ) * blockSize node / bank := by + apply (eq_div_iff hbank').mpr + simpa only [mul_comm] using tiling node + rw [hp] + field_simp [hbank', hsize'] + simp only [totalNodeUtility, hnode, ← Finset.sum_div] + field_simp [hbank', hhorizon'] + +theorem physical_cost_rate_identity {Grade : Type*} [Fintype Grade] + (bank horizon : ℕ) (hbank : bank ≠ 0) (hhorizon : horizon ≠ 0) + (blockSize copies : Node → ℕ) (hsize : ∀ node, blockSize node ≠ 0) + (population rawNodeUtility : Node → ℝ) (law : Node → Grade → ℝ) + (targetLog offset : ℝ) (coefficient : Grade → ℝ) + (tiling : ∀ node, (bank : ℝ) * population node = + (copies node : ℝ) * blockSize node) + (total : ∑ node, population node = (horizon : ℝ)) : + (6 * targetLog + ∑ node, (copies node : ℝ) * rawNodeUtility node) / + (6 * bank * horizon) = + affineScore offset coefficient (outputLaw horizon population law) + + (targetLog / bank - totalCost population law offset coefficient + (fun node => rawNodeUtility node / (6 * blockSize node))) / horizon := by + rw [physical_rate_normalization bank horizon hbank hhorizon blockSize copies + hsize population rawNodeUtility targetLog tiling] + exact utility_rate_identity horizon hhorizon population law total offset + (targetLog / bank) coefficient (fun node => rawNodeUtility node / (6 * blockSize node)) + +end PhysicalNormalization + +end OrientationRates +end MatrixMultiplication.Foundation + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/Entropy/ComplexOrientedConditionalHierarchyStage.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/Entropy/ComplexOrientedConditionalHierarchyStage.lean new file mode 100644 index 0000000000000000000000000000000000000000..56af414c48a73c22682abe76600b1c82fb665fda --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/Entropy/ComplexOrientedConditionalHierarchyStage.lean @@ -0,0 +1,201 @@ +import OAI.LinearAlgebra.MatrixMultiplication.Entropy.ComplexConditionalHierarchyStage +import OAI.LinearAlgebra.MatrixMultiplication.Separation.ComplexPrefixSeparationOrientations + +namespace OAI + +/-! Finite entropy, rate estimates and ordered asymptotic limits. -/ + +noncomputable section + +namespace MatrixMultiplication.Foundation.OrientedConditionalHierarchyStage + +open Tensor PolynomialLocalConstruction PolynomialKernelExecution +open PrefixSeparationPolynomialStage PrefixSeparationOrientations LabelHierarchySeparation +open ConditionalHierarchyStage + +variable {Prefix RawLabel X Y Z : Type*} [DecidableEq RawLabel] + +section ExecutionStage + +variable {PX PY PZ AX AY AZ : Type*} +variable [Fintype AX] [Fintype AY] [Fintype AZ] +variable {support : X → Y → Z → Prop} + +theorem exists_rawPoolStage_XZ + (E : Execution X Y Z Prefix PX PY PZ AX AY AZ support) + (pool : Prefix → Finset RawLabel) (k : ℕ) (positive : 0 < k) + (counts : ∀ p, (pool p).card = k) + (readX : Prefix → X → RawLabel) (readZ : Prefix → Z → RawLabel) + (eligible : Prefix → X → Y → Z → Prop) + (previous : ∀ x y z, support x.1 y.1 z.1 → E.value x y z ≠ 0 → + eligible x.2.1 x.1 y.1 z.1) + (agree : ∀ p x y z, eligible p x y z → readX p x = readZ p z) : + ∃ S : Stage E (Fin k) (Fin k) PUnit (Fin k) + (PoolAuxiliaryGroup k) (PoolAuxiliaryGroup k) (PoolAuxiliaryGroup k), + S.auxiliary = auxiliaryXZ k ∧ + S.rankBound = poolAuxiliaryCost k ∧ S.order = 0 ∧ + S.leftDegree = 0 ∧ S.middleDegree = 0 ∧ S.rightDegree = 0 ∧ + S.value = rawPoolLeadingXZ pool k positive counts readX readZ := by + classical + obtain ⟨MX, MY, MZ, hMX, hMY, hMZ, hkernel⟩ := + exists_raw_pool_stage_XZ pool k positive counts readX readZ eligible agree + let S : Stage E (Fin k) (Fin k) PUnit (Fin k) + (PoolAuxiliaryGroup k) (PoolAuxiliaryGroup k) (PoolAuxiliaryGroup k) := { + auxiliary := auxiliaryXZ k + rankBound := poolAuxiliaryCost k + auxiliary_rank := auxiliaryXZ_rankAtMost k + order := 0 + leftDegree := 0 + middleDegree := 0 + rightDegree := 0 + leftMap := MX + middleMap := MY + rightMap := MZ + left_degree := hMX + middle_degree := hMY + right_degree := hMZ + eligible := eligible + previous_eligible := previous + value := rawPoolLeadingXZ pool k positive counts readX readZ + vanishes := by + intro _ _ _ _ _ j hj + exact (Nat.not_lt_zero j hj).elim + leading := by + intro p x y z he + rw [hkernel p x y z he] + exact Polynomial.coeff_C_zero + synchronized := by + intro p x y z he hn + have hread := agree p x.1 y.1 z.1 he + have hcodes : maskedPoolCode pool k positive counts p (readX p x.1) = + maskedPoolCode pool k positive counts p (readZ p z.1) := congrArg _ hread + have hsync := stageLeadingXZ_synchronized k _ _ _ _ _ p x y z hcodes hn + exact ⟨hsync.1, hsync.2.1⟩ + } + exact ⟨S, rfl, rfl, rfl, rfl, rfl, rfl, rfl⟩ + +theorem exists_rawPoolStage_YZ + (E : Execution X Y Z Prefix PX PY PZ AX AY AZ support) + (pool : Prefix → Finset RawLabel) (k : ℕ) (positive : 0 < k) + (counts : ∀ p, (pool p).card = k) + (readY : Prefix → Y → RawLabel) (readZ : Prefix → Z → RawLabel) + (eligible : Prefix → X → Y → Z → Prop) + (previous : ∀ x y z, support x.1 y.1 z.1 → E.value x y z ≠ 0 → + eligible x.2.1 x.1 y.1 z.1) + (agree : ∀ p x y z, eligible p x y z → readY p y = readZ p z) : + ∃ S : Stage E (Fin k) PUnit (Fin k) (Fin k) + (PoolAuxiliaryGroup k) (PoolAuxiliaryGroup k) (PoolAuxiliaryGroup k), + S.auxiliary = auxiliaryYZ k ∧ + S.rankBound = poolAuxiliaryCost k ∧ S.order = 0 ∧ + S.leftDegree = 0 ∧ S.middleDegree = 0 ∧ S.rightDegree = 0 ∧ + S.value = rawPoolLeadingYZ pool k positive counts readY readZ := by + classical + obtain ⟨MX, MY, MZ, hMX, hMY, hMZ, hkernel⟩ := + exists_raw_pool_stage_YZ pool k positive counts readY readZ eligible agree + let S : Stage E (Fin k) PUnit (Fin k) (Fin k) + (PoolAuxiliaryGroup k) (PoolAuxiliaryGroup k) (PoolAuxiliaryGroup k) := { + auxiliary := auxiliaryYZ k + rankBound := poolAuxiliaryCost k + auxiliary_rank := auxiliaryYZ_rankAtMost k + order := 0 + leftDegree := 0 + middleDegree := 0 + rightDegree := 0 + leftMap := MX + middleMap := MY + rightMap := MZ + left_degree := hMX + middle_degree := hMY + right_degree := hMZ + eligible := eligible + previous_eligible := previous + value := rawPoolLeadingYZ pool k positive counts readY readZ + vanishes := by + intro _ _ _ _ _ j hj + exact (Nat.not_lt_zero j hj).elim + leading := by + intro p x y z he + rw [hkernel p x y z he] + exact Polynomial.coeff_C_zero + synchronized := by + intro p x y z he hn + have hread := agree p x.1 y.1 z.1 he + have hcodes : maskedPoolCode pool k positive counts p (readY p y.1) = + maskedPoolCode pool k positive counts p (readZ p z.1) := congrArg _ hread + have hsync := stageLeadingYZ_synchronized k _ _ _ _ _ p x y z hcodes hn + exact ⟨hsync.1, hsync.2.1⟩ + } + exact ⟨S, rfl, rfl, rfl, rfl, rfl, rfl, rfl⟩ + +end ExecutionStage + +section ExactConditionalPools + +open ConditionalPrefixWords StageHierarchyResources LabelHierarchyCounts + +variable {A Position : Type*} [Fintype A] [Fintype Position] +variable {Label : ℕ → Type*} [∀ n, Fintype (Label n)] +variable (counts : A → ℕ) (labels : ∀ n, A → Label n) (n t : ℕ) + +local instance (priority := low) {B : Type*} : DecidableEq B := Classical.decEq B + +theorem exists_actualPoolStage_XZ + {PX PY PZ AX AY AZ : Type*} [Fintype AX] [Fintype AY] [Fintype AZ] + {support : X → Y → Z → Prop} + (E : Execution X Y Z Prefix PX PY PZ AX AY AZ support) + (priorWord : Prefix → ExactPrefix counts labels n t Position) + (readX : Prefix → X → Position → Label n) + (readZ : Prefix → Z → Position → Label n) + (eligible : Prefix → X → Y → Z → Prop) + (previous : ∀ x y z, support x.1 y.1 z.1 → E.value x y z ≠ 0 → + eligible x.2.1 x.1 y.1 z.1) + (agree : ∀ p x y z, eligible p x y z → readX p x = readZ p z) : + ∃ S : Stage E (Fin (stageRefinementCount counts labels n t)) + (Fin (stageRefinementCount counts labels n t)) PUnit + (Fin (stageRefinementCount counts labels n t)) + (PoolAuxiliaryGroup (stageRefinementCount counts labels n t)) + (PoolAuxiliaryGroup (stageRefinementCount counts labels n t)) + (PoolAuxiliaryGroup (stageRefinementCount counts labels n t)), + S.auxiliary = auxiliaryXZ (stageRefinementCount counts labels n t) ∧ + S.rankBound = stageCost counts labels n t ∧ S.order = 0 ∧ + S.leftDegree = 0 ∧ S.middleDegree = 0 ∧ S.rightDegree = 0 ∧ + S.value = rawPoolLeadingXZ (actualPool counts labels n t priorWord) + (stageRefinementCount counts labels n t) (stageRefinementCount_pos counts labels n t) + (actualPool_card counts labels n t priorWord) readX readZ := by + exact exists_rawPoolStage_XZ E (actualPool counts labels n t priorWord) + (stageRefinementCount counts labels n t) (stageRefinementCount_pos counts labels n t) + (actualPool_card counts labels n t priorWord) readX readZ eligible previous agree + +theorem exists_actualPoolStage_YZ + {PX PY PZ AX AY AZ : Type*} [Fintype AX] [Fintype AY] [Fintype AZ] + {support : X → Y → Z → Prop} + (E : Execution X Y Z Prefix PX PY PZ AX AY AZ support) + (priorWord : Prefix → ExactPrefix counts labels n t Position) + (readY : Prefix → Y → Position → Label n) + (readZ : Prefix → Z → Position → Label n) + (eligible : Prefix → X → Y → Z → Prop) + (previous : ∀ x y z, support x.1 y.1 z.1 → E.value x y z ≠ 0 → + eligible x.2.1 x.1 y.1 z.1) + (agree : ∀ p x y z, eligible p x y z → readY p y = readZ p z) : + ∃ S : Stage E (Fin (stageRefinementCount counts labels n t)) PUnit + (Fin (stageRefinementCount counts labels n t)) + (Fin (stageRefinementCount counts labels n t)) + (PoolAuxiliaryGroup (stageRefinementCount counts labels n t)) + (PoolAuxiliaryGroup (stageRefinementCount counts labels n t)) + (PoolAuxiliaryGroup (stageRefinementCount counts labels n t)), + S.auxiliary = auxiliaryYZ (stageRefinementCount counts labels n t) ∧ + S.rankBound = stageCost counts labels n t ∧ S.order = 0 ∧ + S.leftDegree = 0 ∧ S.middleDegree = 0 ∧ S.rightDegree = 0 ∧ + S.value = rawPoolLeadingYZ (actualPool counts labels n t priorWord) + (stageRefinementCount counts labels n t) (stageRefinementCount_pos counts labels n t) + (actualPool_card counts labels n t priorWord) readY readZ := by + exact exists_rawPoolStage_YZ E (actualPool counts labels n t priorWord) + (stageRefinementCount counts labels n t) (stageRefinementCount_pos counts labels n t) + (actualPool_card counts labels n t priorWord) readY readZ eligible previous agree + +end ExactConditionalPools +end MatrixMultiplication.Foundation.OrientedConditionalHierarchyStage + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/Entropy/ComplexSeparationAsymptotics.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/Entropy/ComplexSeparationAsymptotics.lean new file mode 100644 index 0000000000000000000000000000000000000000..03c28f09fc85399547fb1ec9a1a0b276ea1bfec5 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/Entropy/ComplexSeparationAsymptotics.lean @@ -0,0 +1,339 @@ +import OAI.LinearAlgebra.MatrixMultiplication.Separation.ComplexSeparationCounting +import Mathlib.Data.Nat.Find +import Mathlib.Analysis.SpecialFunctions.Log.Basic +import Mathlib.Algebra.BigOperators.Ring.Finset +import Mathlib.Topology.Algebra.Monoid +import Mathlib.Topology.Order.Basic +import Mathlib.Tactic.Linarith +import Mathlib.Tactic.NormNum +import Mathlib.Tactic.Positivity +import Mathlib.Tactic.Ring +import Mathlib.Tactic.GCongr + +namespace OAI + +/-! Finite entropy, rate estimates and ordered asymptotic limits. -/ + +noncomputable section + +namespace MatrixMultiplication.Foundation.Separation + +open Filter + +private theorem scale_exists (K : ℕ) : ∃ n : ℕ, K ≤ 2 ^ (n ^ 2) := by + refine ⟨K + 1, ?_⟩ + have hK : K < 2 ^ K := Nat.lt_pow_self (by decide : 1 < 2) + exact hK.le.trans (Nat.pow_le_pow_right (by decide) (by nlinarith)) + +noncomputable def gridScale (K : ℕ) : ℕ := Nat.find (scale_exists K) + +theorem population_le_scale (K : ℕ) : K ≤ 2 ^ ((gridScale K) ^ 2) := + Nat.find_spec (scale_exists K) + +theorem previous_scale_lt_population {K : ℕ} (hn : 0 < gridScale K) : + 2 ^ ((gridScale K - 1) ^ 2) < K := by + exact lt_of_not_ge (Nat.find_min (scale_exists K) (Nat.sub_lt hn (by decide))) + +theorem scale_pos {K : ℕ} (hK : 1 < K) : 0 < gridScale K := by + have h := population_le_scale K + by_contra hn + have hz : gridScale K = 0 := Nat.eq_zero_of_not_pos hn + simp only [hz, zero_pow (by decide : 2 ≠ 0), pow_zero] at h + exact (not_le_of_gt hK) h + +theorem scale_gt_of_population_gt {K n : ℕ} (hK : 2 ^ (n ^ 2) < K) : + n < gridScale K := by + by_contra hn + have hscale : gridScale K ≤ n := Nat.le_of_not_gt hn + have hp : 2 ^ ((gridScale K) ^ 2) ≤ 2 ^ (n ^ 2) := + Nat.pow_le_pow_right (by decide) (Nat.pow_le_pow_left hscale 2) + exact (not_le_of_gt hK) ((population_le_scale K).trans hp) + +theorem gridScale_monotone : Monotone gridScale := by + intro K L hKL + exact Nat.find_min' (scale_exists K) (hKL.trans (population_le_scale L)) + +def gridDimension (K : ℕ) : ℕ := gridScale K + 4 + +def gridWidth (K : ℕ) : ℕ := 2 ^ (gridScale K + 2) + +def gridGroupOrder (K : ℕ) : ℕ := (4 * gridWidth K) ^ gridDimension K + +theorem gridDimension_pos (K : ℕ) : 0 < gridDimension K := by + simp [gridDimension] + +theorem gridWidth_ge_two (K : ℕ) : 2 ≤ gridWidth K := by + simpa only [gridWidth, pow_one] using + (Nat.pow_le_pow_right (by decide : 0 < 2) (by omega : 1 ≤ gridScale K + 2)) + +private theorem dimension_le_power (n : ℕ) : n + 4 ≤ 2 ^ (n + 2) := by + induction n with + | zero => norm_num + | succ n ih => + have hp : 2 ^ (n + 2 + 1) = 2 ^ (n + 2) * 2 := pow_succ _ _ + have he : n + 1 + 2 = n + 2 + 1 := by omega + rw [he, hp] + omega + +theorem grid_population_bound (K : ℕ) : + (gridDimension K * gridWidth K ^ 2 + 1) * K ≤ + gridWidth K ^ gridDimension K := by + let n := gridScale K + have hd : n + 4 ≤ 2 ^ (n + 2) := dimension_le_power n + have hq : 0 < 2 ^ (n + 2) := by positivity + have hcolorpos : 0 < (n + 4) * (2 ^ (n + 2)) ^ 2 := by positivity + have hcolor : (n + 4) * (2 ^ (n + 2)) ^ 2 + 1 ≤ 2 ^ (3 * n + 7) := by + calc + (n + 4) * (2 ^ (n + 2)) ^ 2 + 1 ≤ + 2 * ((n + 4) * (2 ^ (n + 2)) ^ 2) := by nlinarith + _ ≤ 2 * (2 ^ (n + 2) * (2 ^ (n + 2)) ^ 2) := by gcongr + _ = 2 ^ (3 * n + 7) := by + rw [← pow_mul, ← pow_add, ← pow_succ'] + congr 1 + omega + calc + (gridDimension K * gridWidth K ^ 2 + 1) * K ≤ + 2 ^ (3 * n + 7) * 2 ^ (n ^ 2) := + Nat.mul_le_mul hcolor (population_le_scale K) + _ = 2 ^ (3 * n + 7 + n ^ 2) := (pow_add _ _ _).symm + _ ≤ 2 ^ ((n + 2) * (n + 4)) := + Nat.pow_le_pow_right (by decide) (by nlinarith) + _ = gridWidth K ^ gridDimension K := by + simp only [gridWidth, gridDimension, n, pow_mul] + +theorem gridGroupOrder_eq (K : ℕ) : + gridGroupOrder K = 2 ^ ((gridScale K + 4) ^ 2) := by + unfold gridGroupOrder gridWidth gridDimension + have hb : 4 * 2 ^ (gridScale K + 2) = 2 ^ (gridScale K + 4) := by + calc + 4 * 2 ^ (gridScale K + 2) = 2 ^ 2 * 2 ^ (gridScale K + 2) := by norm_num + _ = 2 ^ (2 + (gridScale K + 2)) := (pow_add _ _ _).symm + _ = 2 ^ (gridScale K + 4) := by congr 1; omega + rw [hb, ← pow_mul, pow_two] + +theorem gridGroupOrder_pos (K : ℕ) : 0 < gridGroupOrder K := by + rw [gridGroupOrder_eq] + positivity + +theorem population_le_gridGroupOrder (K : ℕ) : K ≤ gridGroupOrder K := by + rw [gridGroupOrder_eq] + exact (population_le_scale K).trans + (Nat.pow_le_pow_right (by decide) + (Nat.pow_le_pow_left (Nat.le_add_right (gridScale K) 4) 2)) + +theorem gridGroupOrder_monotone : Monotone gridGroupOrder := by + intro K L hKL + rw [gridGroupOrder_eq, gridGroupOrder_eq] + exact Nat.pow_le_pow_right (by decide) + (Nat.pow_le_pow_left (Nat.add_le_add_right (gridScale_monotone hKL) 4) 2) + +theorem asymptotic_grid_tags_slices (K : ℕ) : + ∃ tags : Finset (Grid (gridDimension K) (gridWidth K)), tags.card = K ∧ + (∃ radius : Fin (gridDimension K * gridWidth K ^ 2 + 1), + ∀ t ∈ tags, normColor t = radius) ∧ + ∀ t ∈ tags, ∃ slice : Finset (Grid (gridDimension K) (gridWidth K)), + slice.card = K ∧ ∃ level : Fin (gridDimension K * gridWidth K ^ 2 + 1), + ∀ u ∈ slice, dotColor t u = level := + grid_tags_slices (grid_population_bound K) (grid_population_bound K) + +theorem log_gridGroupOrder (K : ℕ) : + Real.log (gridGroupOrder K : ℝ) = ((gridScale K : ℝ) + 4) ^ 2 * Real.log 2 := by + rw [gridGroupOrder_eq, Nat.cast_pow, Real.log_pow] + norm_cast + +theorem log_population_le_log_gridGroupOrder {K : ℕ} (hK : 0 < K) : + Real.log (K : ℝ) ≤ Real.log (gridGroupOrder K : ℝ) := by + exact Real.log_le_log (by exact_mod_cast hK) + (by exact_mod_cast population_le_gridGroupOrder K) + +theorem previous_scale_log_lt {K : ℕ} (hK : 1 < K) : + ((gridScale K : ℝ) - 1) ^ 2 * Real.log 2 < Real.log (K : ℝ) := by + have hn : 1 ≤ gridScale K := scale_pos hK + have hp : (0 : ℝ) < (2 : ℝ) ^ ((gridScale K - 1) ^ 2) := by positivity + have hc : (2 : ℝ) ^ ((gridScale K - 1) ^ 2) < (K : ℝ) := by + exact_mod_cast previous_scale_lt_population (scale_pos hK) + have h := Real.log_lt_log hp hc + simpa only [Real.log_pow, Nat.cast_pow, Nat.cast_sub hn, Nat.cast_one] using h + +theorem log_gridGroupOrder_le_of_scale {K : ℕ} {ε : ℝ} + (hK : 1 < K) (hε : 0 ≤ ε) + (hscale : 10 * (gridScale K : ℝ) + 15 ≤ + ε * ((gridScale K : ℝ) - 1) ^ 2) : + Real.log (gridGroupOrder K : ℝ) ≤ (1 + ε) * Real.log (K : ℝ) := by + have hlog2 : 0 < Real.log 2 := Real.log_pos (by norm_num) + have hpoly : ((gridScale K : ℝ) + 4) ^ 2 ≤ + (1 + ε) * ((gridScale K : ℝ) - 1) ^ 2 := by nlinarith + calc + Real.log (gridGroupOrder K : ℝ) = + ((gridScale K : ℝ) + 4) ^ 2 * Real.log 2 := log_gridGroupOrder K + _ ≤ ((1 + ε) * ((gridScale K : ℝ) - 1) ^ 2) * Real.log 2 := + mul_le_mul_of_nonneg_right hpoly hlog2.le + _ = (1 + ε) * (((gridScale K : ℝ) - 1) ^ 2 * Real.log 2) := by ring + _ ≤ (1 + ε) * Real.log (K : ℝ) := + mul_le_mul_of_nonneg_left (previous_scale_log_lt hK).le (by positivity) + +private theorem scale_error_bound {n ε : ℝ} (hn : 2 ≤ n) (hε : 0 ≤ ε) + (hlarge : 72 ≤ ε * n) : 10 * n + 15 ≤ ε * (n - 1) ^ 2 := by + have hsq : n ^ 2 ≤ 4 * (n - 1) ^ 2 := by nlinarith + have hmul := mul_le_mul_of_nonneg_left hsq hε + have hlarge' := mul_le_mul_of_nonneg_right hlarge (by linarith : 0 ≤ n) + nlinarith + +theorem eventually_log_gridGroupOrder_le {ε : ℝ} (hε : 0 < ε) : + ∀ᶠ K : ℕ in atTop, + Real.log (gridGroupOrder K : ℝ) ≤ (1 + ε) * Real.log (K : ℝ) := by + obtain ⟨m : ℕ, hm⟩ := exists_nat_gt (max 2 (72 / ε)) + refine eventually_atTop.2 ⟨2 ^ (m ^ 2) + 1, ?_⟩ + intro K hK + have hKm : 2 ^ (m ^ 2) < K := by omega + have hn := scale_gt_of_population_gt hKm + have hnR : (m : ℝ) < (gridScale K : ℝ) := by exact_mod_cast hn + have hm2 : 2 < (m : ℝ) := (le_max_left _ _).trans_lt hm + have hmε : 72 / ε < (m : ℝ) := (le_max_right _ _).trans_lt hm + have hnε : 72 ≤ ε * (gridScale K : ℝ) := by + have hdiv : 72 / ε < (gridScale K : ℝ) := hmε.trans hnR + have hmul := (div_lt_iff₀ hε).1 hdiv + nlinarith + have hKone : 1 < K := by + have hp : 1 ≤ 2 ^ (m ^ 2) := Nat.one_le_pow _ _ (by decide) + omega + exact log_gridGroupOrder_le_of_scale hKone hε.le + (scale_error_bound (by linarith) hε.le hnε) + +theorem uniform_log_gridGroupOrder_le {ε : ℝ} (hε : 0 < ε) : + ∃ C : ℝ, 0 ≤ C ∧ ∀ K : ℕ, + Real.log (gridGroupOrder K : ℝ) ≤ (1 + ε) * Real.log (K : ℝ) + C := by + obtain ⟨K₀, hK₀⟩ := eventually_atTop.1 (eventually_log_gridGroupOrder_le hε) + refine ⟨Real.log (gridGroupOrder K₀ : ℝ), Real.log_natCast_nonneg _, ?_⟩ + intro K + by_cases hK : K₀ ≤ K + · exact (hK₀ K hK).trans (le_add_of_nonneg_right (Real.log_natCast_nonneg _)) + · have horder : gridGroupOrder K ≤ gridGroupOrder K₀ := + gridGroupOrder_monotone (Nat.le_of_lt (Nat.lt_of_not_ge hK)) + have hpos : (0 : ℝ) < (gridGroupOrder K : ℝ) := by + rw [gridGroupOrder_eq, Nat.cast_pow] + positivity + have hcast : (gridGroupOrder K : ℝ) ≤ (gridGroupOrder K₀ : ℝ) := by + exact_mod_cast horder + have hlog := Real.log_le_log hpos hcast + have hnonneg : 0 ≤ (1 + ε) * Real.log (K : ℝ) := + mul_nonneg (by linarith) (Real.log_natCast_nonneg K) + linarith + +theorem tendsto_log_gridGroupOrder_div_log_population : + Tendsto (fun K : ℕ => Real.log (gridGroupOrder K : ℝ) / Real.log (K : ℝ)) + atTop (nhds 1) := by + refine tendsto_order.2 ⟨?_, ?_⟩ + · intro a ha + refine eventually_atTop.2 ⟨2, ?_⟩ + intro K hK + have hKone : 1 < K := by omega + have hlog : 0 < Real.log (K : ℝ) := + Real.log_pos (by exact_mod_cast hKone) + have hle := log_population_le_log_gridGroupOrder (by omega : 0 < K) + exact ha.trans_le ((le_div_iff₀ hlog).2 (by simpa using hle)) + · intro b hb + have he : 0 < (b - 1) / 2 := by linarith + filter_upwards [eventually_log_gridGroupOrder_le he, + (eventually_atTop.2 ⟨2, fun K (hK : 2 ≤ K) => hK⟩)] with K hcost hK + have hlog : 0 < Real.log (K : ℝ) := + Real.log_pos (by exact_mod_cast (show 1 < K by omega)) + have hratio : Real.log (gridGroupOrder K : ℝ) / Real.log (K : ℝ) ≤ + 1 + (b - 1) / 2 := (div_le_iff₀ hlog).2 hcost + linarith + +theorem tendsto_log_gridGroupOrder_div_nat {K : ℕ → ℕ} {H : ℝ} + (hK : ∀ N, 0 < K N) (hH : 0 ≤ H) + (hpop : Tendsto (fun N => Real.log (K N : ℝ) / (N : ℝ)) atTop (nhds H)) : + Tendsto (fun N => Real.log (gridGroupOrder (K N) : ℝ) / (N : ℝ)) + atTop (nhds H) := by + refine tendsto_order.2 ⟨?_, ?_⟩ + · intro a ha + filter_upwards [(tendsto_order.1 hpop).1 a ha, + (eventually_atTop.2 ⟨1, fun N (hN : 1 ≤ N) => hN⟩)] with N haN hN + have hNpos : (0 : ℝ) < (N : ℝ) := by exact_mod_cast hN + exact haN.trans_le (div_le_div_of_nonneg_right + (log_population_le_log_gridGroupOrder (hK N)) hNpos.le) + · intro b hb + let ε := (b - H) / (2 * (H + 1)) + have hdenom : 0 < 2 * (H + 1) := by linarith + have hε : 0 < ε := div_pos (by linarith) hdenom + obtain ⟨C, hC, hbound⟩ := uniform_log_gridGroupOrder_le hε + have hεeq : ε * (2 * (H + 1)) = b - H := div_mul_cancel₀ _ hdenom.ne' + have hlimitlt : (1 + ε) * H < b := by nlinarith + have hconstant : Tendsto (fun N : ℕ => C / (N : ℝ)) atTop (nhds 0) := + tendsto_const_nhds.div_atTop tendsto_natCast_atTop_atTop + have hupper : Tendsto + (fun N : ℕ => (1 + ε) * (Real.log (K N : ℝ) / (N : ℝ)) + C / (N : ℝ)) + atTop (nhds ((1 + ε) * H)) := by + simpa using (hpop.const_mul (1 + ε)).add hconstant + filter_upwards [(tendsto_order.1 hupper).2 b hlimitlt, + (eventually_atTop.2 ⟨1, fun N (hN : 1 ≤ N) => hN⟩)] with N hbN hN + have hNpos : (0 : ℝ) < (N : ℝ) := by exact_mod_cast hN + have hle := div_le_div_of_nonneg_right (hbound (K N)) hNpos.le + have heq : ((1 + ε) * Real.log (K N : ℝ) + C) / (N : ℝ) = + (1 + ε) * (Real.log (K N : ℝ) / (N : ℝ)) + C / (N : ℝ) := by ring + rw [heq] at hle + exact hle.trans_lt hbN + +theorem log_nat_prod {I : Type*} (s : Finset I) (a : I → ℕ) + (ha : ∀ i ∈ s, 0 < a i) : + Real.log ((∏ i ∈ s, a i : ℕ) : ℝ) = ∑ i ∈ s, Real.log (a i : ℝ) := by + rw [Nat.cast_prod] + exact Real.log_prod (s := s) (f := fun i => (a i : ℝ)) fun i hi => + Nat.cast_ne_zero.mpr (Nat.ne_of_gt (ha i hi)) + +theorem tendsto_log_nat_prod_div_nat {I : Type*} (s : Finset I) + {K : I → ℕ → ℕ} {H : I → ℝ} + (hK : ∀ i ∈ s, ∀ N, 0 < K i N) + (hpop : ∀ i ∈ s, + Tendsto (fun N => Real.log (K i N : ℝ) / (N : ℝ)) atTop (nhds (H i))) : + Tendsto (fun N => Real.log ((∏ i ∈ s, K i N : ℕ) : ℝ) / (N : ℝ)) + atTop (nhds (∑ i ∈ s, H i)) := by + have hsum := tendsto_finsetSum s hpop + apply hsum.congr + intro N + rw [log_nat_prod s (fun i => K i N) (fun i hi => hK i hi N)] + simp only [div_eq_mul_inv, Finset.sum_mul] + +theorem tendsto_log_gridGroupOrder_prod_div_nat {I : Type*} (s : Finset I) + {K : I → ℕ → ℕ} {H : I → ℝ} + (hK : ∀ i ∈ s, ∀ N, 0 < K i N) (hH : ∀ i ∈ s, 0 ≤ H i) + (hpop : ∀ i ∈ s, + Tendsto (fun N => Real.log (K i N : ℝ) / (N : ℝ)) atTop (nhds (H i))) : + Tendsto (fun N => Real.log ((∏ i ∈ s, gridGroupOrder (K i N) : ℕ) : ℝ) / (N : ℝ)) + atTop (nhds (∑ i ∈ s, H i)) := by + exact tendsto_log_nat_prod_div_nat s (fun i hi N => gridGroupOrder_pos (K i N)) + (fun i hi => tendsto_log_gridGroupOrder_div_nat (hK i hi) (hH i hi) (hpop i hi)) + +theorem tendsto_log_nat_weighted_prod_div_nat {I : Type*} (s : Finset I) (w : I → ℕ) + {K : I → ℕ → ℕ} {H : I → ℝ} + (hK : ∀ i ∈ s, ∀ N, 0 < K i N) + (hpop : ∀ i ∈ s, + Tendsto (fun N => Real.log (K i N : ℝ) / (N : ℝ)) atTop (nhds (H i))) : + Tendsto (fun N => Real.log ((∏ i ∈ s, (K i N) ^ w i : ℕ) : ℝ) / (N : ℝ)) + atTop (nhds (∑ i ∈ s, (w i : ℝ) * H i)) := by + apply tendsto_log_nat_prod_div_nat s + · intro i hi N + exact pow_pos (hK i hi N) _ + · intro i hi + simpa only [Nat.cast_pow, Real.log_pow, mul_div_assoc] using + (hpop i hi).const_mul (w i : ℝ) + +theorem tendsto_log_gridGroupOrder_weighted_prod_div_nat {I : Type*} + (s : Finset I) (w : I → ℕ) {K : I → ℕ → ℕ} {H : I → ℝ} + (hK : ∀ i ∈ s, ∀ N, 0 < K i N) (hH : ∀ i ∈ s, 0 ≤ H i) + (hpop : ∀ i ∈ s, + Tendsto (fun N => Real.log (K i N : ℝ) / (N : ℝ)) atTop (nhds (H i))) : + Tendsto + (fun N => Real.log ((∏ i ∈ s, gridGroupOrder (K i N) ^ w i : ℕ) : ℝ) / (N : ℝ)) + atTop (nhds (∑ i ∈ s, (w i : ℝ) * H i)) := by + exact tendsto_log_nat_weighted_prod_div_nat s w + (fun i hi N => gridGroupOrder_pos (K i N)) + (fun i hi => tendsto_log_gridGroupOrder_div_nat (hK i hi) (hH i hi) (hpop i hi)) + +end MatrixMultiplication.Foundation.Separation + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/Entropy/ComplexTypeEntropy.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/Entropy/ComplexTypeEntropy.lean new file mode 100644 index 0000000000000000000000000000000000000000..3b68100928761c6591e309129628513d2c26c999 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/Entropy/ComplexTypeEntropy.lean @@ -0,0 +1,383 @@ +import OAI.LinearAlgebra.MatrixMultiplication.Tensor.ComplexFactorialLogBounds +import OAI.LinearAlgebra.MatrixMultiplication.Entropy.ComplexFiniteEntropy +import OAI.LinearAlgebra.MatrixMultiplication.Entropy.ComplexEntropyContinuity +import OAI.LinearAlgebra.MatrixMultiplication.Separation.ComplexRationalTypes +import OAI.LinearAlgebra.MatrixMultiplication.Separation.ComplexTypeCounting +import Mathlib.Data.Nat.Choose.Multinomial +import Mathlib.Algebra.BigOperators.Field +import Mathlib.Tactic.NormNum +import Mathlib.Tactic.Positivity + +namespace OAI + +/-! Finite entropy, rate estimates and ordered asymptotic limits. -/ + +namespace MatrixMultiplication.Foundation + +open Filter +open scoped BigOperators Topology + +variable {A : Type*} [Fintype A] + +theorem log_multinomial (counts : A → ℕ) : + Real.log (Nat.multinomial Finset.univ counts : ℝ) = + Real.log (Nat.factorial (∑ a, counts a) : ℝ) - + ∑ a, Real.log (Nat.factorial (counts a) : ℝ) := by + have hspec : + (∏ a, (Nat.factorial (counts a) : ℝ)) * + (Nat.multinomial Finset.univ counts : ℝ) = + (Nat.factorial (∑ a, counts a) : ℝ) := by + exact_mod_cast Nat.multinomial_spec Finset.univ counts + have hprod : (∏ a, (Nat.factorial (counts a) : ℝ)) ≠ 0 := by + exact Finset.prod_ne_zero_iff.mpr (fun a _ => by positivity) + have hmulti : (Nat.multinomial Finset.univ counts : ℝ) ≠ 0 := by + exact_mod_cast (Nat.ne_of_gt (Nat.multinomial_pos Finset.univ counts)) + have hlog := congrArg Real.log hspec + rw [Real.log_mul hprod hmulti, + Real.log_prod (s := Finset.univ) (f := fun a => (Nat.factorial (counts a) : ℝ)) + (fun a _ => by positivity)] at hlog + linarith + +private theorem entropyTerm_div_scalar (x y : ℝ) : + entropyTerm (x / y) = entropyTerm x / y + (x / y) * Real.log y := by + by_cases hx : x = 0 + · simp [hx] + by_cases hy : y = 0 + · simp [hy] + rw [entropyTerm, Real.log_div hx hy] + unfold entropyTerm + ring + +theorem finiteEntropy_nat_normalize (counts : A → ℕ) + (hD : 0 < ∑ a, counts a) : + finiteEntropy (fun a => (counts a : ℝ) / (∑ a, counts a : ℕ)) = + Real.log (∑ a, counts a : ℕ) - + (∑ a, (counts a : ℝ) * Real.log (counts a : ℝ)) / + (∑ a, counts a : ℕ) := by + have hD' : ((∑ a, counts a : ℕ) : ℝ) ≠ 0 := by + exact_mod_cast (Nat.ne_of_gt hD) + unfold finiteEntropy + simp only [entropyTerm_div_scalar] + simp only [entropyTerm, neg_mul, + Finset.sum_add_distrib, ← Finset.sum_div, ← Finset.sum_mul, + Finset.sum_neg_distrib] + rw [← Nat.cast_sum, div_self hD'] + ring + +theorem log_multinomial_eq_main_add_remainder (counts : A → ℕ) : + Real.log (Nat.multinomial Finset.univ counts : ℝ) = + (∑ a, counts a : ℕ) * Real.log (∑ a, counts a : ℕ) - + (∑ a, (counts a : ℝ) * Real.log (counts a : ℝ)) + + factorialLogRemainder (∑ a, counts a) - + ∑ a, factorialLogRemainder (counts a) := by + rw [log_multinomial] + unfold factorialLogRemainder + simp only [Finset.sum_sub_distrib, ← Nat.cast_sum] + ring + +theorem log_multinomial_eq_entropy_add_remainder (counts : A → ℕ) + (hD : 0 < ∑ a, counts a) : + Real.log (Nat.multinomial Finset.univ counts : ℝ) = + (∑ a, counts a : ℕ) * + finiteEntropy (fun a => (counts a : ℝ) / (∑ a, counts a : ℕ)) + + factorialLogRemainder (∑ a, counts a) - + ∑ a, factorialLogRemainder (counts a) := by + have hD' : ((∑ a, counts a : ℕ) : ℝ) ≠ 0 := by + exact_mod_cast (Nat.ne_of_gt hD) + rw [log_multinomial_eq_main_add_remainder, finiteEntropy_nat_normalize counts hD, + mul_sub, mul_div_cancel₀ _ hD'] + +theorem log_multinomial_sub_entropy_eq_remainder (counts : A → ℕ) : + Real.log (Nat.multinomial Finset.univ counts : ℝ) - + (∑ a, counts a : ℕ) * + finiteEntropy (fun a => (counts a : ℝ) / (∑ a, counts a : ℕ)) = + factorialLogRemainder (∑ a, counts a) - + ∑ a, factorialLogRemainder (counts a) := by + by_cases hD : 0 < ∑ a, counts a + · rw [log_multinomial_eq_entropy_add_remainder counts hD] + ring + · have hzero : (∑ a, counts a) = 0 := Nat.eq_zero_of_not_pos hD + have hc : ∀ a, counts a = 0 := by + intro a + have hle : counts a ≤ ∑ b, counts b := + Finset.single_le_sum (fun b _ => Nat.zero_le (counts b)) (Finset.mem_univ a) + rw [hzero] at hle + exact Nat.eq_zero_of_le_zero hle + simp [hc, Nat.multinomial] + +theorem abs_log_multinomial_sub_entropy_le (counts : A → ℕ) : + |Real.log (Nat.multinomial Finset.univ counts : ℝ) - + (∑ a, counts a : ℕ) * + finiteEntropy (fun a => (counts a : ℝ) / (∑ a, counts a : ℕ))| ≤ + ((Fintype.card A : ℝ) + 1) * + (1 + Real.log ((∑ a, counts a) + 1 : ℕ)) := by + rw [log_multinomial_sub_entropy_eq_remainder] + have hsum_nonneg : 0 ≤ ∑ a, factorialLogRemainder (counts a) := + Finset.sum_nonneg (fun a _ => factorialLogRemainder_nonneg (counts a)) + have heach (a : A) : factorialLogRemainder (counts a) ≤ + 1 + Real.log ((∑ b, counts b) + 1 : ℕ) := by + refine (factorialLogRemainder_le_one_add_log (counts a)).trans ?_ + apply add_le_add_right + apply Real.log_le_log + · positivity + · have hle : counts a ≤ ∑ b, counts b := + Finset.single_le_sum (fun b _ => Nat.zero_le (counts b)) (Finset.mem_univ a) + exact_mod_cast Nat.add_le_add_right hle 1 + calc + |factorialLogRemainder (∑ a, counts a) - ∑ a, factorialLogRemainder (counts a)| ≤ + |factorialLogRemainder (∑ a, counts a)| + + |∑ a, factorialLogRemainder (counts a)| := by + simpa only [sub_eq_add_neg, abs_neg] using + abs_add_le (factorialLogRemainder (∑ a, counts a)) + (-(∑ a, factorialLogRemainder (counts a))) + _ = factorialLogRemainder (∑ a, counts a) + + ∑ a, factorialLogRemainder (counts a) := by + rw [abs_of_nonneg (factorialLogRemainder_nonneg _), abs_of_nonneg hsum_nonneg] + _ ≤ (1 + Real.log ((∑ a, counts a) + 1 : ℕ)) + + ∑ _a : A, (1 + Real.log ((∑ a, counts a) + 1 : ℕ)) := + add_le_add (factorialLogRemainder_le_one_add_log _) + (Finset.sum_le_sum (fun a _ => heach a)) + _ = ((Fintype.card A : ℝ) + 1) * + (1 + Real.log ((∑ a, counts a) + 1 : ℕ)) := by + simp only [Finset.sum_const, Finset.card_univ, nsmul_eq_mul] + ring + +theorem abs_log_multinomial_div_sub_entropy_le (counts : A → ℕ) + (hD : 0 < ∑ a, counts a) : + |Real.log (Nat.multinomial Finset.univ counts : ℝ) / (∑ a, counts a : ℕ) - + finiteEntropy (fun a => (counts a : ℝ) / (∑ a, counts a : ℕ))| ≤ + ((Fintype.card A : ℝ) + 1) * + ((1 + Real.log ((∑ a, counts a) + 1 : ℕ)) / (∑ a, counts a : ℕ)) := by + have hD' : (0 : ℝ) < (∑ a, counts a : ℕ) := Nat.cast_pos.mpr hD + calc + |Real.log (Nat.multinomial Finset.univ counts : ℝ) / (∑ a, counts a : ℕ) - + finiteEntropy (fun a => (counts a : ℝ) / (∑ a, counts a : ℕ))| = + |(Real.log (Nat.multinomial Finset.univ counts : ℝ) - + (∑ a, counts a : ℕ) * + finiteEntropy (fun a => (counts a : ℝ) / (∑ a, counts a : ℕ))) / + (∑ a, counts a : ℕ)| := by + rw [sub_div, mul_div_cancel_left₀ _ hD'.ne'] + _ = |Real.log (Nat.multinomial Finset.univ counts : ℝ) - + (∑ a, counts a : ℕ) * + finiteEntropy (fun a => (counts a : ℝ) / (∑ a, counts a : ℕ))| / + (∑ a, counts a : ℕ) := by + rw [abs_div, abs_of_pos hD'] + _ ≤ ((Fintype.card A : ℝ) + 1) * + ((1 + Real.log ((∑ a, counts a) + 1 : ℕ)) / (∑ a, counts a : ℕ)) := by + simpa only [mul_div_assoc] using + div_le_div_of_nonneg_right (abs_log_multinomial_sub_entropy_le counts) hD'.le + +private theorem tendsto_one_add_log_succ_div : + Tendsto (fun n : ℕ => (1 + Real.log (n + 1 : ℕ)) / (n : ℝ)) + atTop (𝓝 0) := by + have hnat : Tendsto (fun n : ℕ => (n : ℝ)) atTop atTop := + tendsto_natCast_atTop_atTop + have hconstant : Tendsto (fun n : ℕ => (1 : ℝ) / n) atTop (𝓝 0) := + tendsto_const_nhds.div_atTop hnat + have hlog : Tendsto (fun n : ℕ => Real.log (n : ℝ) / n) atTop (𝓝 0) := by + simpa only [Function.comp_def, id_eq] using + Real.isLittleO_log_id_atTop.tendsto_div_nhds_zero.comp hnat + have hshift := Real.tendsto_log_nat_add_one_sub_log.div_atTop hnat + have hsum : Tendsto + (fun n : ℕ => (1 : ℝ) / n + + ((Real.log ((n : ℝ) + 1) - Real.log n) / n + Real.log n / n)) + atTop (𝓝 0) := by + simpa using hconstant.add (hshift.add hlog) + apply hsum.congr + intro n + push_cast + ring + +theorem tendsto_log_multinomial_div_sub_entropy {I : Type*} {l : Filter I} + (counts : I → A → ℕ) + (htotal : Tendsto (fun i => ∑ a, counts i a) l atTop) : + Tendsto + (fun i => Real.log (Nat.multinomial Finset.univ (counts i) : ℝ) / + (∑ a, counts i a : ℕ) - + finiteEntropy (fun a => (counts i a : ℝ) / (∑ a, counts i a : ℕ))) + l (𝓝 0) := by + have hbound : Tendsto + (fun i => ((Fintype.card A : ℝ) + 1) * + ((1 + Real.log ((∑ a, counts i a) + 1 : ℕ)) / (∑ a, counts i a : ℕ))) + l (𝓝 0) := by + simpa using (tendsto_one_add_log_succ_div.comp htotal).const_mul + ((Fintype.card A : ℝ) + 1) + refine squeeze_zero_norm' ?_ hbound + filter_upwards [htotal.eventually (eventually_gt_atTop (0 : ℕ))] with i hi + simpa only [Real.norm_eq_abs] using + abs_log_multinomial_div_sub_entropy_le (counts i) hi + +theorem tendsto_log_multinomial_of_empirical_tendsto {I : Type*} {l : Filter I} + (counts : I → A → ℕ) (p : A → ℝ) + (htotal : Tendsto (fun i => ∑ a, counts i a) l atTop) + (hmass : ∀ a, Tendsto + (fun i => (counts i a : ℝ) / (∑ b, counts i b : ℕ)) l (𝓝 (p a))) : + Tendsto + (fun i => Real.log (Nat.multinomial Finset.univ (counts i) : ℝ) / + (∑ a, counts i a : ℕ)) + l (𝓝 (finiteEntropy p)) := by + have herror := tendsto_log_multinomial_div_sub_entropy counts htotal + have hentropy := tendsto_finiteEntropy_of_tendsto hmass + simpa only [zero_add, sub_add_cancel] using herror.add hentropy + +private theorem mul_log_mul (x y : ℝ) : + (x * y) * Real.log (x * y) = + (x * Real.log x) * y + x * (y * Real.log y) := by + calc + (x * y) * Real.log (x * y) = -entropyTerm (x * y) := by + simp [entropyTerm] + _ = -(y * entropyTerm x + x * entropyTerm y) := by + rw [entropyTerm_mul] + _ = (x * Real.log x) * y + x * (y * Real.log y) := by + unfold entropyTerm + ring + +theorem log_multinomial_mul_eq (counts : A → ℕ) (t : ℕ) : + Real.log (Nat.multinomial Finset.univ (fun a => t * counts a) : ℝ) = + (t : ℝ) * + ((∑ a, counts a : ℕ) * Real.log (∑ a, counts a : ℕ) - + ∑ a, (counts a : ℝ) * Real.log (counts a : ℝ)) + + factorialLogRemainder (t * ∑ a, counts a) - + ∑ a, factorialLogRemainder (t * counts a) := by + have hsum : (∑ a, t * counts a) = t * ∑ a, counts a := + (Finset.mul_sum Finset.univ counts t).symm + have hlogs : + (∑ a, ((t : ℝ) * counts a) * Real.log ((t : ℝ) * counts a)) = + ((t : ℝ) * Real.log t) * (∑ a, counts a : ℕ) + + (t : ℝ) * ∑ a, (counts a : ℝ) * Real.log (counts a : ℝ) := by + simp only [mul_log_mul, Finset.sum_add_distrib, ← Finset.mul_sum, + ← Nat.cast_sum] + rw [log_multinomial_eq_main_add_remainder, hsum] + simp only [Nat.cast_mul] + rw [mul_log_mul, hlogs] + ring + +theorem tendsto_log_multinomial_mul (counts : A → ℕ) + (hD : 0 < ∑ a, counts a) : + Tendsto + (fun t : ℕ => + Real.log (Nat.multinomial Finset.univ (fun a => t * counts a) : ℝ) / + ((t : ℝ) * (∑ a, counts a : ℕ))) + atTop + (𝓝 (finiteEntropy (fun a => (counts a : ℝ) / (∑ a, counts a : ℕ)))) := by + have hD' : ((∑ a, counts a : ℕ) : ℝ) ≠ 0 := by + exact_mod_cast (Nat.ne_of_gt hD) + have hsum : + Tendsto (fun t : ℕ => ∑ a, factorialLogRemainder (t * counts a) / (t : ℝ)) + atTop (𝓝 0) := by + simpa using tendsto_finsetSum Finset.univ + (fun a _ => tendsto_factorialLogRemainder_mul_div (counts a)) + have herror : Tendsto + (fun t : ℕ => + (factorialLogRemainder (t * ∑ a, counts a) / (t : ℝ) - + ∑ a, factorialLogRemainder (t * counts a) / (t : ℝ)) / + (∑ a, counts a : ℕ)) atTop (𝓝 0) := by + simpa using ((tendsto_factorialLogRemainder_mul_div (∑ a, counts a)).sub + hsum).div_const (∑ a, counts a : ℕ) + have hlimit : Tendsto + (fun t : ℕ => + finiteEntropy (fun a => (counts a : ℝ) / (∑ a, counts a : ℕ)) + + (factorialLogRemainder (t * ∑ a, counts a) / (t : ℝ) - + ∑ a, factorialLogRemainder (t * counts a) / (t : ℝ)) / + (∑ a, counts a : ℕ)) + atTop + (𝓝 (finiteEntropy (fun a => (counts a : ℝ) / (∑ a, counts a : ℕ)))) := by + simpa only [add_zero] using tendsto_const_nhds.add herror + apply hlimit.congr' + filter_upwards [eventually_ne_atTop (0 : ℕ)] with t ht + rw [log_multinomial_mul_eq, finiteEntropy_nat_normalize counts hD, + ← Finset.sum_div] + have ht' : (t : ℝ) ≠ 0 := Nat.cast_ne_zero.mpr ht + field_simp [ht', hD'] + ring + +theorem tendsto_log_multinomial_repetitions {I : Type*} {l : Filter I} + (counts : A → ℕ) (hD : 0 < ∑ a, counts a) + (repetitions : I → ℕ) (hrep : Tendsto repetitions l atTop) : + Tendsto + (fun i => + Real.log (Nat.multinomial Finset.univ + (fun a => repetitions i * counts a) : ℝ) / + ((repetitions i : ℝ) * (∑ a, counts a : ℕ))) + l (𝓝 (finiteEntropy (fun a => (counts a : ℝ) / (∑ a, counts a : ℕ)))) := by + exact (tendsto_log_multinomial_mul counts hD).comp hrep + +theorem tendsto_log_exactWords_card_mul [DecidableEq A] (counts : A → ℕ) + (hD : 0 < ∑ a, counts a) : + Tendsto + (fun t : ℕ => Real.log (Fintype.card (ExactWords (fun a => t * counts a)) : ℝ) / + ((t : ℝ) * (∑ a, counts a : ℕ))) + atTop + (𝓝 (finiteEntropy (fun a => (counts a : ℝ) / (∑ a, counts a : ℕ)))) := by + simpa only [exactWords_card] using tendsto_log_multinomial_mul counts hD + +theorem abs_log_exactWords_card_sub_entropy_le [DecidableEq A] (counts : A → ℕ) : + |Real.log (Fintype.card (ExactWords counts) : ℝ) - + (∑ a, counts a : ℕ) * + finiteEntropy (fun a => (counts a : ℝ) / (∑ a, counts a : ℕ))| ≤ + ((Fintype.card A : ℝ) + 1) * + (1 + Real.log ((∑ a, counts a) + 1 : ℕ)) := by + simpa only [exactWords_card] using abs_log_multinomial_sub_entropy_le counts + +theorem log_card_le_entropy_of_injective_exactWords [DecidableEq A] + {O : Type*} [Fintype O] [Nonempty O] (counts : A → ℕ) + (label : O → ExactWords counts) (hinj : Function.Injective label) : + Real.log (Fintype.card O : ℝ) ≤ + (∑ a, counts a : ℕ) * + finiteEntropy (fun a => (counts a : ℝ) / (∑ a, counts a : ℕ)) + + ((Fintype.card A : ℝ) + 1) * + (1 + Real.log ((∑ a, counts a) + 1 : ℕ)) := by + have hcard := Fintype.card_le_of_injective label hinj + have hlog : Real.log (Fintype.card O : ℝ) ≤ + Real.log (Fintype.card (ExactWords counts) : ℝ) := + Real.log_le_log (Nat.cast_pos.mpr Fintype.card_pos) (by exact_mod_cast hcard) + have herror := (abs_le.mp (abs_log_exactWords_card_sub_entropy_le counts)).2 + linarith + +theorem log_card_div_le_entropy_of_injective_exactWords [DecidableEq A] + {O : Type*} [Fintype O] [Nonempty O] (counts : A → ℕ) + (hD : 0 < ∑ a, counts a) + (label : O → ExactWords counts) (hinj : Function.Injective label) : + Real.log (Fintype.card O : ℝ) / (∑ a, counts a : ℕ) ≤ + finiteEntropy (fun a => (counts a : ℝ) / (∑ a, counts a : ℕ)) + + ((Fintype.card A : ℝ) + 1) * + ((1 + Real.log ((∑ a, counts a) + 1 : ℕ)) / (∑ a, counts a : ℕ)) := by + have hD' : (0 : ℝ) < (∑ a, counts a : ℕ) := Nat.cast_pos.mpr hD + have h := div_le_div_of_nonneg_right + (log_card_le_entropy_of_injective_exactWords counts label hinj) hD'.le + rw [add_div, mul_div_cancel_left₀ _ hD'.ne', mul_div_assoc] at h + exact h + +theorem tendsto_log_exactWords_card_of_empirical_tendsto [DecidableEq A] + {I : Type*} {l : Filter I} (counts : I → A → ℕ) (p : A → ℝ) + (htotal : Tendsto (fun i => ∑ a, counts i a) l atTop) + (hmass : ∀ a, Tendsto + (fun i => (counts i a : ℝ) / (∑ b, counts i b : ℕ)) l (𝓝 (p a))) : + Tendsto + (fun i => Real.log (Fintype.card (ExactWords (counts i)) : ℝ) / + (∑ a, counts i a : ℕ)) + l (𝓝 (finiteEntropy p)) := by + simpa only [exactWords_card] using + tendsto_log_multinomial_of_empirical_tendsto counts p htotal hmass + +namespace RationalLaw + +theorem exists_exactWords_entropy_limit [DecidableEq A] (p : RationalLaw A) : + ∃ counts : A → ℕ, 0 < ∑ a, counts a ∧ + (∀ a, (counts a : ℝ) / (∑ a, counts a : ℕ) = p.toFiniteLaw.mass a) ∧ + Tendsto + (fun t : ℕ => Real.log (Fintype.card (ExactWords (fun a => t * counts a)) : ℝ) / + ((t : ℝ) * (∑ a, counts a : ℕ))) + atTop (𝓝 (finiteEntropy p.toFiniteLaw.mass)) := by + obtain ⟨counts, hD, hmass⟩ := p.exists_type_representation + refine ⟨counts, hD, hmass, ?_⟩ + have hfun : (fun a => (counts a : ℝ) / (∑ a, counts a : ℕ)) = + p.toFiniteLaw.mass := funext hmass + rw [← hfun] + exact tendsto_log_exactWords_card_mul counts hD + +end RationalLaw + +end MatrixMultiplication.Foundation + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/Entropy/ConditionalContinuity.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/Entropy/ConditionalContinuity.lean new file mode 100644 index 0000000000000000000000000000000000000000..35c30367108bb1f184f77a804a2ca338ef3bde2e --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/Entropy/ConditionalContinuity.lean @@ -0,0 +1,109 @@ +import OAI.LinearAlgebra.MatrixMultiplication.Entropy.ConditionalLabels + +namespace OAI + +/-! Finite entropy, rate estimates and ordered asymptotic limits. -/ + +noncomputable section + +namespace MatrixMultiplication.ConditionalLabels + +open MatrixMultiplication.Foundation Filter +open scoped BigOperators Topology Classical + +universe u v w +variable {A : Type u} [Fintype A] {Label : ℕ → Type v} + [∀ n, Fintype (Label n)] + +theorem refinementEntropy_eq_prefix_difference (p : FiniteLaw A) + (labels : ∀ n, A → Label n) (depth n : ℕ) (hn : n < depth) : + (FiniteLabelHierarchy.ofLawLabels p labels depth).refinementEntropy n = + finiteEntropy (p.map (labelRecordOf labels (n + 1))).mass - + finiteEntropy (p.map (labelRecordOf labels n)).mass := by + have h := (FiniteLabelHierarchy.ofLawLabels p labels depth).prefixLaw_entropy_succ + n (Nat.succ_le_of_lt hn) + rw [FiniteLabelHierarchy.ofLawLabels_prefixLaw_mass, + FiniteLabelHierarchy.ofLawLabels_prefixLaw_mass] at h + linarith + +theorem tendsto_map_entropy {J : Type w} {filter : Filter J} + {p : J → FiniteLaw A} {q : FiniteLaw A} + (mass : ∀ a, Tendsto (fun j => (p j).mass a) filter (𝓝 (q.mass a))) + {B : Type*} [Fintype B] (label : A → B) : + Tendsto (fun j => finiteEntropy ((p j).map label).mass) filter + (𝓝 (finiteEntropy (q.map label).mass)) := by + apply FiniteLaw.entropy_tendsto + intro b + simp only [FiniteLaw.map_mass] + apply tendsto_finsetSum + intro a _ + by_cases h : label a = b + · simpa only [h, ite_true] using mass a + · simp only [h, ite_false] + exact tendsto_const_nhds + +theorem tendsto_lawPairingRate {J : Type w} {filter : Filter J} + {p : J → FiniteLaw A} {q : FiniteLaw A} + (mass : ∀ a, Tendsto (fun j => (p j).mass a) filter (𝓝 (q.mass a))) + (labels : ∀ n, A → Label n) (depth : ℕ) + (reader : Fin depth → ReaderPair) (pair : ReaderPair) : + Tendsto (fun j => lawPairingRate (p j) labels depth reader pair) filter + (𝓝 (lawPairingRate q labels depth reader pair)) := by + unfold lawPairingRate pairingRate + apply tendsto_finsetSum + intro n _ + by_cases h : reader n = pair + · simp only [h, ite_true, + refinementEntropy_eq_prefix_difference _ labels depth n.val n.isLt] + exact (tendsto_map_entropy mass (labelRecordOf labels (n.val + 1))).sub + (tendsto_map_entropy mass (labelRecordOf labels n.val)) + · simp only [h, ite_false] + exact tendsto_const_nhds + +theorem exists_rational_law_sequence (p : FiniteLaw A) : + ∃ q : ℕ → RationalLaw A, + ∀ a, Tendsto (fun n => (q n).toFiniteLaw.mass a) atTop (𝓝 (p.mass a)) := by + have hexists (n : ℕ) := p.exists_rational_approximation + (1 / ((n : ℝ) + 1)) (by positivity) + choose q _support close using hexists + refine ⟨q, fun a => ?_⟩ + have hdifference : Tendsto + (fun n => (q n).toFiniteLaw.mass a - p.mass a) atTop (𝓝 0) := by + apply squeeze_zero_norm _ tendsto_one_div_add_atTop_nhds_zero_nat + intro n + simpa only [Real.norm_eq_abs, RationalLaw.toFiniteLaw_mass] using (close n a).le + simpa only [sub_add_cancel, zero_add] using hdifference.add_const (p.mass a) + +theorem exists_rational_with_strict_margins (p : FiniteLaw A) + (labels : ∀ n, A → Label n) (depth : ℕ) (reader : Fin depth → ReaderPair) + {k C target : ℝ} + (positive : 0 < lawPairingRate p labels depth reader .xy + + lawPairingRate p labels depth reader .xz) + (aspect : k * (lawPairingRate p labels depth reader .xy + + lawPairingRate p labels depth reader .xz) < + 2 * lawPairingRate p labels depth reader .yz) + (cost : 2 * C < target * (lawPairingRate p labels depth reader .xy + + lawPairingRate p labels depth reader .xz)) : + ∃ q : RationalLaw A, + 0 < lawPairingRate q.toFiniteLaw labels depth reader .xy + + lawPairingRate q.toFiniteLaw labels depth reader .xz ∧ + k * (lawPairingRate q.toFiniteLaw labels depth reader .xy + + lawPairingRate q.toFiniteLaw labels depth reader .xz) < + 2 * lawPairingRate q.toFiniteLaw labels depth reader .yz ∧ + 2 * C < target * (lawPairingRate q.toFiniteLaw labels depth reader .xy + + lawPairingRate q.toFiniteLaw labels depth reader .xz) := by + obtain ⟨q, hq⟩ := exists_rational_law_sequence p + have hincident := (tendsto_lawPairingRate hq labels depth reader .xy).add + (tendsto_lawPairingRate hq labels depth reader .xz) + have hhidden := tendsto_lawPairingRate hq labels depth reader .yz + have hpos := hincident.eventually_const_lt positive + have haspect := (hincident.const_mul k).eventually_lt (hhidden.const_mul 2) aspect + have hcost := (hincident.const_mul target).eventually_const_lt cost + obtain ⟨n, hnpos, hnaspect, hncost⟩ := (hpos.and (haspect.and hcost)).exists + exact ⟨q n, hnpos, hnaspect, hncost⟩ + +end MatrixMultiplication.ConditionalLabels + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/Entropy/ConditionalLabels.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/Entropy/ConditionalLabels.lean new file mode 100644 index 0000000000000000000000000000000000000000..e495ad280a98c5f0d6dd16b989b6561ad4a3c5a6 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/Entropy/ConditionalLabels.lean @@ -0,0 +1,284 @@ +import OAI.LinearAlgebra.MatrixMultiplication.Separation.AuxiliarySeparation +import OAI.LinearAlgebra.MatrixMultiplication.Entropy.ComplexHierarchyEntropy + +namespace OAI + +/-! Finite entropy, rate estimates and ordered asymptotic limits. -/ + +noncomputable section + +namespace MatrixMultiplication + +open MatrixMultiplication.Foundation Filter +open scoped Topology BigOperators Classical + +inductive ReaderPair where + | xy | xz | yz + deriving DecidableEq + +protected abbrev ReaderPair.enumList : List ReaderPair := [.xy, .xz, .yz] + +protected theorem ReaderPair.enumList_getElem?_ctorIdx_eq (x : ReaderPair) : + ReaderPair.enumList[ReaderPair.ctorIdx x]? = some x := by + cases x <;> rfl + +protected theorem ReaderPair.enumList_nodup : ReaderPair.enumList.Nodup := by + apply List.Nodup.of_map ReaderPair.ctorIdx + have h : List.map ReaderPair.ctorIdx ReaderPair.enumList = List.range 3 := rfl + exact h ▸ List.nodup_range + +instance : Fintype ReaderPair where + elems := Finset.mk ReaderPair.enumList (Multiset.coe_nodup.mpr ReaderPair.enumList_nodup) + complete := by + intro x + rw [Finset.mem_mk, Multiset.mem_coe, List.mem_iff_getElem?] + exact ⟨ReaderPair.ctorIdx x, ReaderPair.enumList_getElem?_ctorIdx_eq x⟩ + +namespace ConditionalLabels + +universe u v + +section PairAccounting + +variable {I : Type u} [Fintype I] + +def pairingSize (population : I → ℕ) (reader : I → ReaderPair) + (pair : ReaderPair) : ℕ := + ∏ i, if reader i = pair then population i else 1 + +def pairingRate (rate : I → ℝ) (reader : I → ReaderPair) + (pair : ReaderPair) : ℝ := + ∑ i, if reader i = pair then rate i else 0 + +theorem pairingSize_pos (population : I → ℕ) (reader : I → ReaderPair) + (pair : ReaderPair) (positive : ∀ i, 0 < population i) : + 0 < pairingSize population reader pair := by + apply Finset.prod_pos + intro i _ + split_ifs + · exact positive i + · exact Nat.zero_lt_one + +theorem pairingRate_nonneg (rate : I → ℝ) (reader : I → ReaderPair) + (pair : ReaderPair) (nonneg : ∀ i, 0 ≤ rate i) : + 0 ≤ pairingRate rate reader pair := by + apply Finset.sum_nonneg + intro i _ + split_ifs + · exact nonneg i + · exact le_rfl + +theorem pairingSize_product (population : I → ℕ) (reader : I → ReaderPair) : + pairingSize population reader .xy * pairingSize population reader .xz * + pairingSize population reader .yz = ∏ i, population i := by + simp only [pairingSize, ← Finset.prod_mul_distrib] + apply Finset.prod_congr rfl + intro i _ + cases reader i <;> simp + +theorem pairingRate_sum (rate : I → ℝ) (reader : I → ReaderPair) : + pairingRate rate reader .xy + pairingRate rate reader .xz + + pairingRate rate reader .yz = ∑ i, rate i := by + simp only [pairingRate, ← Finset.sum_add_distrib] + apply Finset.sum_congr rfl + intro i _ + cases reader i <;> simp + +theorem tendsto_log_pairingSize (population : I → ℕ → ℕ) + (rate : I → ℝ) (reader : I → ReaderPair) (pair : ReaderPair) + (positive : ∀ i n, 0 < population i n) + (growth : ∀ i, Tendsto (fun n => Real.log (population i n : ℝ) / (n : ℝ)) + atTop (𝓝 (rate i))) : + Tendsto (fun n => Real.log (pairingSize (fun i => population i n) reader pair : ℝ) / + (n : ℝ)) atTop (𝓝 (pairingRate rate reader pair)) := by + apply Separation.tendsto_log_nat_prod_div_nat Finset.univ + · intro i _ n + split_ifs + · exact positive i n + · exact Nat.zero_lt_one + · intro i _ + by_cases h : reader i = pair + · simpa only [h, ite_true] using growth i + · simpa only [h, ite_false, Nat.cast_one, Real.log_one, zero_div] using + (tendsto_const_nhds : Tendsto (fun _ : ℕ => (0 : ℝ)) atTop (𝓝 0)) + +end PairAccounting + +section SourceHierarchy + +variable {A : Type u} [Fintype A] {Label : ℕ → Type v} + [∀ n, Fintype (Label n)] + +open StageHierarchyResources HierarchySeparationRates + +def stagePairingSize (counts : A → ℕ) (labels : ∀ n, A → Label n) + (depth : ℕ) (reader : Fin depth → ReaderPair) (pair : ReaderPair) (t : ℕ) : ℕ := + pairingSize (fun n : Fin depth => stageRefinementCount counts labels n.val t) reader pair + +def stagePairingRate (counts : A → ℕ) (labels : ∀ n, A → Label n) + (depth : ℕ) (reader : Fin depth → ReaderPair) (pair : ReaderPair) : ℝ := + pairingRate (fun n : Fin depth => stageEntropyRate counts labels n.val) reader pair + +theorem stagePairingSize_product (counts : A → ℕ) (labels : ∀ n, A → Label n) + (depth : ℕ) (reader : Fin depth → ReaderPair) + (complete : Function.Injective (labelRecordOf labels depth)) (t : ℕ) : + stagePairingSize counts labels depth reader .xy t * + stagePairingSize counts labels depth reader .xz t * + stagePairingSize counts labels depth reader .yz t = + Fintype.card (ExactWords (fun a => t * counts a)) := by + rw [stagePairingSize, stagePairingSize, stagePairingSize, pairingSize_product] + exact stagePairingProduct_eq_exactWords_card counts labels depth complete t + +theorem stagePairingRate_sum (counts : A → ℕ) (labels : ∀ n, A → Label n) + (depth : ℕ) (reader : Fin depth → ReaderPair) + (complete : Function.Injective (labelRecordOf labels depth)) : + stagePairingRate counts labels depth reader .xy + + stagePairingRate counts labels depth reader .xz + + stagePairingRate counts labels depth reader .yz = populationEntropyRate counts := by + rw [stagePairingRate, stagePairingRate, stagePairingRate, pairingRate_sum] + exact sum_stageEntropyRate_eq_source counts labels depth complete + +theorem tendsto_log_stagePairingSize (counts : A → ℕ) (labels : ∀ n, A → Label n) + (depth : ℕ) (reader : Fin depth → ReaderPair) (pair : ReaderPair) : + Tendsto (fun t => Real.log (stagePairingSize counts labels depth reader pair t : ℝ) / + (t : ℝ)) atTop (𝓝 (stagePairingRate counts labels depth reader pair)) := by + exact tendsto_log_pairingSize _ _ reader pair + (fun n => stageRefinementCount_pos counts labels n.val) + (fun n => tendsto_log_stageRefinementCount_div counts labels n.val) + +theorem tendsto_log_stagePairingSize_normalized (counts : A → ℕ) + (labels : ∀ n, A → Label n) (depth : ℕ) + (reader : Fin depth → ReaderPair) (pair : ReaderPair) : + Tendsto (fun t => Real.log (stagePairingSize counts labels depth reader pair t : ℝ) / + ((t : ℝ) * (∑ a, counts a : ℕ))) atTop + (𝓝 (stagePairingRate counts labels depth reader pair / (∑ a, counts a : ℕ))) := by + simpa only [div_div] using + (tendsto_log_stagePairingSize counts labels depth reader pair).div_const + ((∑ a, counts a : ℕ) : ℝ) + +theorem auxiliary_overhead_tendsto_zero (counts : A → ℕ) (hD : 0 < ∑ a, counts a) + (labels : ∀ n, A → Label n) (depth : ℕ) + (complete : Function.Injective (labelRecordOf labels depth)) : + Tendsto (fun t => + (Real.log (stageAuxiliaryBudget counts labels depth t : ℝ) - + Real.log (Fintype.card (ExactWords (fun a => t * counts a)) : ℝ)) / + ((t : ℝ) * (∑ a, counts a : ℕ))) atTop (𝓝 0) := by + have h := (tendsto_log_stageAuxiliaryBudget counts hD labels depth complete).sub + (tendsto_log_exactWords_card_mul counts hD) + simpa only [sub_self, sub_div] using h + +theorem auxiliary_overhead_nonneg (counts : A → ℕ) + (labels : ∀ n, A → Label n) (depth : ℕ) + (complete : Function.Injective (labelRecordOf labels depth)) (t : ℕ) : + 0 ≤ Real.log (stageAuxiliaryBudget counts labels depth t : ℝ) - + Real.log (Fintype.card (ExactWords (fun a => t * counts a)) : ℝ) := by + apply sub_nonneg.mpr + rw [← stagePairingProduct_eq_exactWords_card counts labels depth complete t] + apply Real.log_le_log + · apply Nat.cast_pos.mpr + exact Finset.prod_pos (fun n _ => stageRefinementCount_pos counts labels n.val t) + · exact_mod_cast stagePairingProduct_le_budget counts labels depth t + +theorem charged_cost_tendsto (counts : A → ℕ) (hD : 0 < ∑ a, counts a) + (labels : ∀ n, A → Label n) (depth : ℕ) + (complete : Function.Injective (labelRecordOf labels depth)) (C : ℝ) : + Tendsto (fun t => C + + (Real.log (stageAuxiliaryBudget counts labels depth t : ℝ) - + Real.log (Fintype.card (ExactWords (fun a => t * counts a)) : ℝ)) / + ((t : ℝ) * (∑ a, counts a : ℕ))) atTop (𝓝 C) := by + simpa only [add_zero] using + (auxiliary_overhead_tendsto_zero counts hD labels depth complete).const_add C + +theorem limit_le_source_cost (counts : A → ℕ) (hD : 0 < ∑ a, counts a) + (labels : ∀ n, A → Label n) (depth : ℕ) + (complete : Function.Injective (labelRecordOf labels depth)) + {value : ℕ → ℝ} {rate C : ℝ} + (limit : Tendsto value atTop (𝓝 rate)) + (finite_bound : ∀ᶠ t in atTop, value t ≤ C + + (Real.log (stageAuxiliaryBudget counts labels depth t : ℝ) - + Real.log (Fintype.card (ExactWords (fun a => t * counts a)) : ℝ)) / + ((t : ℝ) * (∑ a, counts a : ℕ))) : rate ≤ C := + le_of_tendsto_of_tendsto limit + (charged_cost_tendsto counts hD labels depth complete C) finite_bound + +def lawPairingRate (p : FiniteLaw A) (labels : ∀ n, A → Label n) + (depth : ℕ) (reader : Fin depth → ReaderPair) (pair : ReaderPair) : ℝ := + pairingRate (fun n : Fin depth => + (FiniteLabelHierarchy.ofLawLabels p labels depth).refinementEntropy n.val) reader pair + +theorem lawPairingRate_sum (p : FiniteLaw A) (labels : ∀ n, A → Label n) + (depth : ℕ) (reader : Fin depth → ReaderPair) + (complete : Function.Injective (labelRecordOf labels depth)) : + lawPairingRate p labels depth reader .xy + + lawPairingRate p labels depth reader .xz + + lawPairingRate p labels depth reader .yz = finiteEntropy p.mass := by + rw [lawPairingRate, lawPairingRate, lawPairingRate, pairingRate_sum, + Fin.sum_univ_eq_sum_range] + exact FiniteLabelHierarchy.ofLawLabels_refinementEntropy_sum p labels depth complete + +theorem incident_rate_eq_prefix_entropy (p : FiniteLaw A) + (labels : ∀ n, A → Label n) (depth cut : ℕ) (hcut : cut ≤ depth) + (reader : Fin depth → ReaderPair) + (incident_prefix : ∀ n : Fin depth, + (reader n = .xy ∨ reader n = .xz) ↔ n.val < cut) : + lawPairingRate p labels depth reader .xy + + lawPairingRate p labels depth reader .xz = + finiteEntropy (p.map (labelRecordOf labels cut)).mass := by + let hierarchy := FiniteLabelHierarchy.ofLawLabels p labels depth + have hterms : ∀ n : Fin depth, + (if reader n = .xy then hierarchy.refinementEntropy n.val else 0) + + (if reader n = .xz then hierarchy.refinementEntropy n.val else 0) = + if n.val < cut then hierarchy.refinementEntropy n.val else 0 := by + intro n + cases hr : reader n with + | xy => + have hn := (incident_prefix n).mp (Or.inl hr) + simp [hn] + | xz => + have hn := (incident_prefix n).mp (Or.inr hr) + simp [hn] + | yz => + have hn : ¬n.val < cut := by + intro h + rcases (incident_prefix n).mpr h with h | h <;> simp [hr] at h + simp [hn] + have hfilter : (Finset.range depth).filter (fun n => n < cut) = Finset.range cut := by + ext n + simp only [Finset.mem_filter, Finset.mem_range] + omega + calc + lawPairingRate p labels depth reader .xy + + lawPairingRate p labels depth reader .xz = + ∑ n : Fin depth, if n.val < cut then hierarchy.refinementEntropy n.val else 0 := by + simp only [lawPairingRate, pairingRate, ← Finset.sum_add_distrib] + exact Finset.sum_congr rfl (fun n _ => hterms n) + _ = ∑ n ∈ Finset.range cut, hierarchy.refinementEntropy n := by + rw [show (∑ n : Fin depth, if n.val < cut then hierarchy.refinementEntropy n.val else 0) = + ∑ n ∈ Finset.range depth, if n < cut then hierarchy.refinementEntropy n else 0 from + Fin.sum_univ_eq_sum_range + (fun n => if n < cut then hierarchy.refinementEntropy n else 0) depth] + rw [← Finset.sum_filter, hfilter] + _ = finiteEntropy (hierarchy.prefixLaw cut hcut).mass := + (hierarchy.prefixLaw_entropy cut hcut).symm + _ = finiteEntropy (p.map (labelRecordOf labels cut)).mass := by + rw [FiniteLabelHierarchy.ofLawLabels_prefixLaw_mass] + +theorem remaining_rate_eq_entropy_sub_prefix (p : FiniteLaw A) + (labels : ∀ n, A → Label n) (depth cut : ℕ) (hcut : cut ≤ depth) + (reader : Fin depth → ReaderPair) + (incident_prefix : ∀ n : Fin depth, + (reader n = .xy ∨ reader n = .xz) ↔ n.val < cut) + (complete : Function.Injective (labelRecordOf labels depth)) : + lawPairingRate p labels depth reader .yz = finiteEntropy p.mass - + finiteEntropy (p.map (labelRecordOf labels cut)).mass := by + have hsum := lawPairingRate_sum p labels depth reader complete + have hprefix := incident_rate_eq_prefix_entropy p labels depth cut hcut reader incident_prefix + linarith + +end SourceHierarchy +end ConditionalLabels +end MatrixMultiplication + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/Entropy/ConditionalRateBridge.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/Entropy/ConditionalRateBridge.lean new file mode 100644 index 0000000000000000000000000000000000000000..50d79c17eb798cb516eb3304daba71bb1e1efaa8 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/Entropy/ConditionalRateBridge.lean @@ -0,0 +1,160 @@ +import OAI.LinearAlgebra.MatrixMultiplication.Entropy.ConditionalLabels + +namespace OAI + +/-! Finite entropy, rate estimates and ordered asymptotic limits. -/ + +noncomputable section + +namespace MatrixMultiplication.ConditionalLabels + +open MatrixMultiplication.Foundation Filter StageHierarchyResources HierarchySeparationRates +open LabelHierarchyCounts +open scoped BigOperators Topology Classical + +universe u v +variable {A : Type u} [Fintype A] {Label : ℕ → Type v} + [∀ n, Fintype (Label n)] + +def normalizedCountLaw (counts : A → ℕ) (hD : 0 < ∑ a, counts a) : FiniteLaw A where + mass a := (counts a : ℝ) / (∑ b, counts b : ℕ) + nonneg a := div_nonneg (Nat.cast_nonneg _) (Nat.cast_nonneg _) + total := by + rw [← Finset.sum_div, ← Nat.cast_sum] + exact div_self (Nat.cast_ne_zero.mpr (Nat.ne_of_gt hD)) + +@[simp] theorem normalizedCountLaw_mass (counts : A → ℕ) + (hD : 0 < ∑ a, counts a) (a : A) : + (normalizedCountLaw counts hD).mass a = + (counts a : ℝ) / (∑ b, counts b : ℕ) := rfl + +theorem normalized_prefix_mass (counts : A → ℕ) (p : FiniteLaw A) + (mass : ∀ a, p.mass a = (counts a : ℝ) / (∑ b, counts b : ℕ)) + (labels : ∀ n, A → Label n) (n : ℕ) (r : LabelRecord Label n) : + (p.map (labelRecordOf labels n)).mass r = + (sourcePrefixCounts counts labels n r : ℝ) / (∑ a, counts a : ℕ) := by + simp only [FiniteLaw.map_mass, mass, sourcePrefixCounts, pushforwardCounts, + Nat.cast_sum, Finset.sum_div] + apply Finset.sum_congr rfl + intro a _ + by_cases h : labelRecordOf labels n a = r <;> simp [h] + +theorem zero_prefix_contribution_of_count_eq_zero (counts : A → ℕ) (p : FiniteLaw A) + (mass : ∀ a, p.mass a = (counts a : ℝ) / (∑ b, counts b : ℕ)) + (labels : ∀ n, A → Label n) (n : ℕ) (r : LabelRecord Label n) + (hzero : sourcePrefixCounts counts labels n r = 0) : + (p.map (labelRecordOf labels n)).mass r * + finiteEntropy ((p.conditional (labelRecordOf labels n) r).map (labels n)).mass = 0 := by + rw [normalized_prefix_mass counts p mass labels n r, hzero, + Nat.cast_zero, zero_div, zero_mul] + +theorem tendsto_log_prefix_multinomial (counts : A → ℕ) + (hD : 0 < ∑ a, counts a) (p : FiniteLaw A) + (mass : ∀ a, p.mass a = (counts a : ℝ) / (∑ b, counts b : ℕ)) + (labels : ∀ n, A → Label n) (n : ℕ) : + Tendsto (fun t : ℕ => Real.log + (Nat.multinomial Finset.univ + (sourcePrefixCounts (fun a => t * counts a) labels n) : ℝ) / + ((t : ℝ) * (∑ a, counts a : ℕ))) atTop + (𝓝 (finiteEntropy (p.map (labelRecordOf labels n)).mass)) := by + have hsum : (∑ r, sourcePrefixCounts counts labels n r) = ∑ a, counts a := + pushforwardCounts_sum counts (labelRecordOf labels n) + have hpositive : 0 < ∑ r, sourcePrefixCounts counts labels n r := by rwa [hsum] + have hmass : (fun r => (sourcePrefixCounts counts labels n r : ℝ) / + (∑ r, sourcePrefixCounts counts labels n r : ℕ)) = + (p.map (labelRecordOf labels n)).mass := by + funext r + rw [hsum] + exact (normalized_prefix_mass counts p mass labels n r).symm + have h := tendsto_log_multinomial_mul (sourcePrefixCounts counts labels n) hpositive + rw [hmass, hsum] at h + have hscale (t : ℕ) : sourcePrefixCounts (fun a => t * counts a) labels n = + (fun r => t * sourcePrefixCounts counts labels n r) := + funext (sourcePrefixCounts_mul counts labels t n) + simpa only [hscale] using h + +theorem stageEntropyRate_div_eq_refinementEntropy (counts : A → ℕ) + (hD : 0 < ∑ a, counts a) (p : FiniteLaw A) + (mass : ∀ a, p.mass a = (counts a : ℝ) / (∑ b, counts b : ℕ)) + (labels : ∀ n, A → Label n) (depth n : ℕ) (hn : n < depth) : + stageEntropyRate counts labels n / (∑ a, counts a : ℕ) = + (FiniteLabelHierarchy.ofLawLabels p labels depth).refinementEntropy n := by + have hstage := (tendsto_log_stageRefinementCount_div counts labels n).div_const + ((∑ a, counts a : ℕ) : ℝ) + simp only [div_div] at hstage + have hcoarse := tendsto_log_prefix_multinomial counts hD p mass labels n + have hfine := tendsto_log_prefix_multinomial counts hD p mass labels (n + 1) + have heq : finiteEntropy (p.map (labelRecordOf labels (n + 1))).mass = + finiteEntropy (p.map (labelRecordOf labels n)).mass + + stageEntropyRate counts labels n / (∑ a, counts a : ℕ) := by + apply tendsto_nhds_unique hfine + apply (hcoarse.add hstage).congr + intro t + rw [multinomial_succ (sourcePrefixCounts (fun a => t * counts a) labels) n + (sourcePrefixCounts_compatible (fun a => t * counts a) labels n)] + have hcoarse_pos : 0 < Nat.multinomial Finset.univ + (sourcePrefixCounts (fun a => t * counts a) labels n) := Nat.multinomial_pos _ _ + have hrefinement_pos : 0 < + refinementCount (sourcePrefixCounts (fun a => t * counts a) labels) n := + stageRefinementCount_pos counts labels n t + rw [Nat.cast_mul, Real.log_mul + (Nat.cast_ne_zero.mpr (Nat.ne_of_gt hcoarse_pos)) + (Nat.cast_ne_zero.mpr (Nat.ne_of_gt hrefinement_pos)), add_div] + rfl + have hchain := (FiniteLabelHierarchy.ofLawLabels p labels depth).prefixLaw_entropy_succ + n (Nat.succ_le_of_lt hn) + rw [FiniteLabelHierarchy.ofLawLabels_prefixLaw_mass, + FiniteLabelHierarchy.ofLawLabels_prefixLaw_mass] at hchain + linarith + +theorem stagePairingRate_div_eq_lawPairingRate (counts : A → ℕ) + (hD : 0 < ∑ a, counts a) (p : FiniteLaw A) + (mass : ∀ a, p.mass a = (counts a : ℝ) / (∑ b, counts b : ℕ)) + (labels : ∀ n, A → Label n) (depth : ℕ) + (reader : Fin depth → ReaderPair) (pair : ReaderPair) : + stagePairingRate counts labels depth reader pair / (∑ a, counts a : ℕ) = + lawPairingRate p labels depth reader pair := by + unfold stagePairingRate lawPairingRate pairingRate + rw [Finset.sum_div] + apply Finset.sum_congr rfl + intro n _ + by_cases h : reader n = pair + · simp only [h, ite_true] + exact stageEntropyRate_div_eq_refinementEntropy counts hD p mass labels depth n.val n.isLt + · simp [h] + +theorem tendsto_log_stagePairingSize_law (counts : A → ℕ) + (hD : 0 < ∑ a, counts a) (p : FiniteLaw A) + (mass : ∀ a, p.mass a = (counts a : ℝ) / (∑ b, counts b : ℕ)) + (labels : ∀ n, A → Label n) (depth : ℕ) + (reader : Fin depth → ReaderPair) (pair : ReaderPair) : + Tendsto (fun t => Real.log (stagePairingSize counts labels depth reader pair t : ℝ) / + ((t : ℝ) * (∑ a, counts a : ℕ))) atTop + (𝓝 (lawPairingRate p labels depth reader pair)) := by + rw [← stagePairingRate_div_eq_lawPairingRate counts hD p mass labels depth reader pair] + exact tendsto_log_stagePairingSize_normalized counts labels depth reader pair + +theorem stageEntropyRate_div_eq_normalizedCountLaw_refinementEntropy + (counts : A → ℕ) (hD : 0 < ∑ a, counts a) + (labels : ∀ n, A → Label n) (depth n : ℕ) (hn : n < depth) : + stageEntropyRate counts labels n / (∑ a, counts a : ℕ) = + (FiniteLabelHierarchy.ofLawLabels (normalizedCountLaw counts hD) + labels depth).refinementEntropy n := + stageEntropyRate_div_eq_refinementEntropy counts hD (normalizedCountLaw counts hD) + (fun _ => rfl) labels depth n hn + +theorem tendsto_log_stagePairingSize_normalizedCountLaw + (counts : A → ℕ) (hD : 0 < ∑ a, counts a) + (labels : ∀ n, A → Label n) (depth : ℕ) + (reader : Fin depth → ReaderPair) (pair : ReaderPair) : + Tendsto (fun t => Real.log (stagePairingSize counts labels depth reader pair t : ℝ) / + ((t : ℝ) * (∑ a, counts a : ℕ))) atTop + (𝓝 (lawPairingRate (normalizedCountLaw counts hD) labels depth reader pair)) := + tendsto_log_stagePairingSize_law counts hD (normalizedCountLaw counts hD) + (fun _ => rfl) labels depth reader pair + +end MatrixMultiplication.ConditionalLabels + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/Entropy/CurveLaws.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/Entropy/CurveLaws.lean new file mode 100644 index 0000000000000000000000000000000000000000..153703f43d8d3e5f36e20996579e52929edfc39e --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/Entropy/CurveLaws.lean @@ -0,0 +1,190 @@ +import OAI.LinearAlgebra.MatrixMultiplication.Tensor.ComplexWitness +import Mathlib.Analysis.SpecialFunctions.Pow.Real + +namespace OAI + +/-! Finite entropy, rate estimates and ordered asymptotic limits. -/ + +noncomputable section + +open scoped BigOperators + +namespace MatrixMultiplication.CurveLaws + +open MatrixMultiplication.Foundation ComplexWitness + +theorem fiberSize_real_pos (u : CurveCoordinate) : (0 : ℝ) < curveFiberSize u := by + exact_mod_cast curveFiberSize_pos u + +def uniformLift (p : FiniteLaw CurveCoordinate) : FiniteLaw CurveLeaf where + mass s := p.mass (CW75LabelHierarchy.x s) / curveFiberSize (CW75LabelHierarchy.x s) + nonneg s := div_nonneg (p.nonneg _) (fiberSize_real_pos _).le + total := by + rw [sum_curveLeaves_by_X (fun u => p.mass u / (curveFiberSize u : ℝ))] + simpa only [mul_div_cancel₀ _ (fiberSize_real_pos _).ne'] using p.total + +theorem uniformLift_marginal (p : FiniteLaw CurveCoordinate) (u : CurveCoordinate) : + ((uniformLift p).map CW75LabelHierarchy.x).mass u = p.mass u := by + classical + rw [FiniteLaw.map_mass] + change (∑ s : CurveLeaf, + if CW75LabelHierarchy.x s = u then + p.mass (CW75LabelHierarchy.x s) / curveFiberSize (CW75LabelHierarchy.x s) + else 0) = p.mass u + rw [sum_curveLeaves_by_X + (fun v => if v = u then p.mass v / (curveFiberSize v : ℝ) else 0)] + simp only [mul_ite, mul_zero, Finset.sum_ite_eq', Finset.mem_univ, ite_true] + exact mul_div_cancel₀ (p.mass u) (fiberSize_real_pos u).ne' + +theorem entropyTerm_div_fiber (p : ℝ) {d : ℝ} (hd : 0 < d) : + d * entropyTerm (p / d) = entropyTerm p + p * Real.log d := by + by_cases hp : p = 0 + · simp [hp] + · rw [entropyTerm, Real.log_div hp hd.ne', entropyTerm] + field_simp [hd.ne'] + ring + +theorem uniformLift_entropy (p : FiniteLaw CurveCoordinate) : + finiteEntropy (uniformLift p).mass = finiteEntropy p.mass + + ∑ u : CurveCoordinate, p.mass u * Real.log (curveFiberSize u) := by + change (∑ s : CurveLeaf, + entropyTerm (p.mass (CW75LabelHierarchy.x s) / + curveFiberSize (CW75LabelHierarchy.x s))) = _ + rw [sum_curveLeaves_by_X + (fun u => entropyTerm (p.mass u / (curveFiberSize u : ℝ)))] + simp_rw [entropyTerm_div_fiber _ (fiberSize_real_pos _)] + simp only [finiteEntropy, Finset.sum_add_distrib] + +def partition (t : ℝ) : ℝ := + ∑ u : CurveCoordinate, (curveFiberSize u : ℝ) ^ t + +theorem partition_pos (t : ℝ) : 0 < partition t := by + apply Finset.sum_pos + · intro u _ + exact Real.rpow_pos_of_pos (fiberSize_real_pos u) t + · exact Finset.univ_nonempty + +theorem partition_closed (t : ℝ) : + partition t = 8 + 12 * (2 : ℝ) ^ t + 6 * (4 : ℝ) ^ t + (19 : ℝ) ^ t := by + rw [partition, sum_curveFiberSizes (fun d => (d : ℝ) ^ t)] + simp + +def marginal (t : ℝ) : FiniteLaw CurveCoordinate where + mass u := (curveFiberSize u : ℝ) ^ t / partition t + nonneg u := div_nonneg (Real.rpow_pos_of_pos (fiberSize_real_pos u) t).le + (partition_pos t).le + total := by + rw [← Finset.sum_div] + exact div_self (partition_pos t).ne' + +theorem marginal_pos (t : ℝ) (u : CurveCoordinate) : 0 < (marginal t).mass u := + div_pos (Real.rpow_pos_of_pos (fiberSize_real_pos u) t) (partition_pos t) + +theorem marginal_lt_one (t : ℝ) (u : CurveCoordinate) : (marginal t).mass u < 1 := by + classical + obtain ⟨v, hv⟩ := exists_ne u + calc + (marginal t).mass u < ∑ w : CurveCoordinate, (marginal t).mass w := + Finset.single_lt_sum hv (Finset.mem_univ u) (Finset.mem_univ v) + (marginal_pos t v) (fun w _ _ => (marginal t).nonneg w) + _ = 1 := (marginal t).total + +def leafLaw (t : ℝ) : FiniteLaw CurveLeaf := uniformLift (marginal t) + +theorem leafLaw_pos (t : ℝ) (s : CurveLeaf) : 0 < (leafLaw t).mass s := + div_pos (marginal_pos t _) (fiberSize_real_pos _) + +theorem marginal_of_leafLaw (t : ℝ) : + ((leafLaw t).map CW75LabelHierarchy.x).mass = (marginal t).mass := by + funext u + exact uniformLift_marginal (marginal t) u + +theorem leafLaw_uniform_in_fibers (t : ℝ) (s r : CurveLeaf) + (h : CW75LabelHierarchy.x s = CW75LabelHierarchy.x r) : + (leafLaw t).mass s = (leafLaw t).mass r := by + change (marginal t).mass _ / _ = (marginal t).mass _ / _ + rw [h] + +def hidden (t : ℝ) : ℝ := + ∑ u : CurveCoordinate, (marginal t).mass u * Real.log (curveFiberSize u) + +def incident (t : ℝ) : ℝ := Real.log (partition t) - t * hidden t + +theorem log_marginal (t : ℝ) (u : CurveCoordinate) : + Real.log ((marginal t).mass u) = + t * Real.log (curveFiberSize u) - Real.log (partition t) := by + change Real.log ((curveFiberSize u : ℝ) ^ t / partition t) = _ + rw [Real.log_div (Real.rpow_pos_of_pos (fiberSize_real_pos u) t).ne' + (partition_pos t).ne', Real.log_rpow (fiberSize_real_pos u)] + +theorem incident_entropy (t : ℝ) : finiteEntropy (marginal t).mass = incident t := by + unfold finiteEntropy + simp_rw [entropyTerm, log_marginal] + calc + (∑ u : CurveCoordinate, + -(marginal t).mass u * + (t * Real.log (curveFiberSize u) - Real.log (partition t))) = + (∑ u : CurveCoordinate, (marginal t).mass u) * Real.log (partition t) - + t * ∑ u : CurveCoordinate, + (marginal t).mass u * Real.log (curveFiberSize u) := by + simp only [Finset.sum_mul, Finset.mul_sum, ← Finset.sum_sub_distrib] + apply Finset.sum_congr rfl + intro u _ + ring + _ = incident t := by rw [(marginal t).total]; simp [incident, hidden] + +theorem incident_pos (t : ℝ) : 0 < incident t := by + rw [← incident_entropy] + apply Finset.sum_pos + · intro u _ + exact mul_pos_of_neg_of_neg (neg_neg_of_pos (marginal_pos t u)) + (Real.log_neg (marginal_pos t u) (marginal_lt_one t u)) + · exact Finset.univ_nonempty + +theorem hidden_nonneg (t : ℝ) : 0 ≤ hidden t := by + apply Finset.sum_nonneg + intro u _ + have hd : (1 : ℝ) ≤ curveFiberSize u := by + exact_mod_cast (curveFiberSize_pos u : 1 ≤ curveFiberSize u) + exact mul_nonneg ((marginal t).nonneg u) (Real.log_nonneg hd) + +theorem leaf_entropy (t : ℝ) : + finiteEntropy (leafLaw t).mass = incident t + hidden t := by + rw [leafLaw, uniformLift_entropy, incident_entropy] + rfl + +theorem conditional_entropy (t : ℝ) : + finiteEntropy (leafLaw t).mass - + finiteEntropy ((leafLaw t).map CW75LabelHierarchy.x).mass = hidden t := by + rw [marginal_of_leafLaw, leaf_entropy, incident_entropy] + ring + +theorem hidden_closed (t : ℝ) : + hidden t = + (12 * (2 : ℝ) ^ t * Real.log 2 + 6 * (4 : ℝ) ^ t * Real.log 4 + + (19 : ℝ) ^ t * Real.log 19) / partition t := by + unfold hidden + change (∑ u : CurveCoordinate, + ((curveFiberSize u : ℝ) ^ t / partition t) * Real.log (curveFiberSize u)) = _ + simp_rw [div_mul_eq_mul_div] + rw [← Finset.sum_div, sum_curveFiberSizes (fun d => (d : ℝ) ^ t * Real.log d)] + simp + ring + +theorem incident_rate (t : ℝ) : + ConditionalLabels.lawPairingRate (leafLaw t) curveLabels 5 curveReaderPair .xy + + ConditionalLabels.lawPairingRate (leafLaw t) curveLabels 5 curveReaderPair .xz = + incident t := by + rw [curveIncidentRate_eq_entropy_X, marginal_of_leafLaw, incident_entropy] + +theorem hidden_rate (t : ℝ) : + ConditionalLabels.lawPairingRate (leafLaw t) curveLabels 5 curveReaderPair .yz = + hidden t := by + rw [curveHiddenRate_eq_entropy_sub_X] + exact conditional_entropy t + +end MatrixMultiplication.CurveLaws + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/Entropy/CurveRationalLaw.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/Entropy/CurveRationalLaw.lean new file mode 100644 index 0000000000000000000000000000000000000000..94574e6f79be0ee436f3b1726659c3bd908a65cb --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/Entropy/CurveRationalLaw.lean @@ -0,0 +1,69 @@ +import OAI.LinearAlgebra.MatrixMultiplication.Numerical.CurveLawsCertificates +import OAI.LinearAlgebra.MatrixMultiplication.Entropy.ConditionalContinuity +import OAI.LinearAlgebra.MatrixMultiplication.Entropy.ConditionalRateBridge + +namespace OAI + +/-! Finite entropy, rate estimates and ordered asymptotic limits. -/ + +noncomputable section + +namespace MatrixMultiplication.CurveLaws + +open MatrixMultiplication.Foundation ComplexWitness ConditionalLabels Filter +open scoped BigOperators Topology + +theorem exists_rational_rate_bounds : + ∃ q : RationalLaw CurveLeaf, + (31519 : ℝ) / 10000 < + lawPairingRate q.toFiniteLaw curveLabels 5 curveReaderPair .xy + + lawPairingRate q.toFiniteLaw curveLabels 5 curveReaderPair .xz ∧ + lawPairingRate q.toFiniteLaw curveLabels 5 curveReaderPair .xy + + lawPairingRate q.toFiniteLaw curveLabels 5 curveReaderPair .xz < + (15761 : ℝ) / 5000 ∧ + (27961 : ℝ) / 25000 < + lawPairingRate q.toFiniteLaw curveLabels 5 curveReaderPair .yz ∧ + lawPairingRate q.toFiniteLaw curveLabels 5 curveReaderPair .yz < + (6991 : ℝ) / 6250 := by + obtain ⟨q, hq⟩ := exists_rational_law_sequence (leafLaw (2 / 3 : ℝ)) + have hi := (tendsto_lawPairingRate hq curveLabels 5 curveReaderPair .xy).add + (tendsto_lawPairingRate hq curveLabels 5 curveReaderPair .xz) + have hh := tendsto_lawPairingRate hq curveLabels 5 curveReaderPair .yz + rw [incident_rate_two_thirds] at hi + rw [hidden_rate_two_thirds] at hh + have hilo := hi.eventually_const_lt ComplexCertificates.curveH_bounds.1 + have hihi := hi.eventually_lt_const ComplexCertificates.curveH_bounds.2 + have hhlo := hh.eventually_const_lt ComplexCertificates.curveG_bounds.1 + have hhhi := hh.eventually_lt_const ComplexCertificates.curveG_bounds.2 + obtain ⟨n, hn⟩ := (hilo.and (hihi.and (hhlo.and hhhi))).exists + exact ⟨q n, hn⟩ + +theorem exists_count_rate_bounds : + ∃ counts : CurveLeaf → ℕ, ∃ hD : 0 < ∑ a, counts a, + (31519 : ℝ) / 10000 < + lawPairingRate (normalizedCountLaw counts hD) curveLabels 5 curveReaderPair .xy + + lawPairingRate (normalizedCountLaw counts hD) curveLabels 5 curveReaderPair .xz ∧ + lawPairingRate (normalizedCountLaw counts hD) curveLabels 5 curveReaderPair .xy + + lawPairingRate (normalizedCountLaw counts hD) curveLabels 5 curveReaderPair .xz < + (15761 : ℝ) / 5000 ∧ + (27961 : ℝ) / 25000 < + lawPairingRate (normalizedCountLaw counts hD) curveLabels 5 curveReaderPair .yz ∧ + lawPairingRate (normalizedCountLaw counts hD) curveLabels 5 curveReaderPair .yz < + (6991 : ℝ) / 6250 := by + obtain ⟨q, hq⟩ := exists_rational_rate_bounds + obtain ⟨counts, hD, hmass⟩ := q.exists_type_representation + have law_eq (p r : FiniteLaw CurveLeaf) (h : p.mass = r.mass) : p = r := by + cases p + cases r + cases h + rfl + have heq : normalizedCountLaw counts hD = q.toFiniteLaw := + law_eq _ _ (funext hmass) + refine ⟨counts, hD, ?_⟩ + simpa only [heq] using hq + +end MatrixMultiplication.CurveLaws + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/Entropy/FiniteAverage.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/Entropy/FiniteAverage.lean new file mode 100644 index 0000000000000000000000000000000000000000..54b60c0408ff8a0c643b849426a1ea195a873798 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/Entropy/FiniteAverage.lean @@ -0,0 +1,235 @@ +import Mathlib.Basic.Real.Basic +import Mathlib.Data.Fintype.BigOperators +import Mathlib.Data.Fintype.Pi +import Mathlib.Logic.Equiv.Prod +import Mathlib.Algebra.BigOperators.Ring.Finset +import Mathlib.Algebra.Order.BigOperators.Group.Finset +import Mathlib.Tactic.Ring +import Mathlib.Tactic.Positivity +import Mathlib.Tactic.Linarith + +namespace OAI + +/-! Finite entropy, rate estimates and ordered asymptotic limits. -/ + +namespace MatrixMultiplication.PermutationMatching + +open scoped BigOperators +open Classical + +noncomputable section + +variable {Ω Γ : Type*} [Fintype Ω] [Fintype Γ] + +def average (f : Ω → ℝ) : ℝ := (∑ ω, f ω) / Fintype.card Ω + +theorem average_congr {f g : Ω → ℝ} (h : ∀ ω, f ω = g ω) : + average f = average g := by + unfold average + congr 1 + exact Finset.sum_congr rfl (fun ω _ => h ω) + +@[simp] theorem average_const [Nonempty Ω] (c : ℝ) : + average (fun _ : Ω => c) = c := by + have hcard : (Fintype.card Ω : ℝ) ≠ 0 := by + exact_mod_cast Fintype.card_ne_zero + simp [average, hcard] + +@[simp] theorem average_zero : average (fun _ : Ω => (0 : ℝ)) = 0 := by + simp [average] + +theorem average_add (f g : Ω → ℝ) : + average (fun ω => f ω + g ω) = average f + average g := by + simp [average, Finset.sum_add_distrib, add_div] + +theorem average_sub (f g : Ω → ℝ) : + average (fun ω => f ω - g ω) = average f - average g := by + simp [average, Finset.sum_sub_distrib, sub_div] + +theorem average_mul_const (f : Ω → ℝ) (c : ℝ) : + average (fun ω => f ω * c) = average f * c := by + simp only [average, ← Finset.sum_mul] + ring + +theorem average_const_mul (c : ℝ) (f : Ω → ℝ) : + average (fun ω => c * f ω) = c * average f := by + simp only [average, ← Finset.mul_sum] + ring + +theorem average_finset_sum {I : Type*} (s : Finset I) (f : I → Ω → ℝ) : + average (fun ω => ∑ i ∈ s, f i ω) = ∑ i ∈ s, average (f i) := by + unfold average + rw [Finset.sum_comm] + simp only [div_eq_mul_inv, Finset.sum_mul] + +theorem average_sum {I : Type*} (s : Finset I) (f : Ω → I → ℝ) : + average (fun ω => ∑ i ∈ s, f ω i) = ∑ i ∈ s, average (fun ω => f ω i) := + average_finset_sum s (fun i ω => f ω i) + +theorem average_nonneg {f : Ω → ℝ} (h : ∀ ω, 0 ≤ f ω) : 0 ≤ average f := by + exact div_nonneg (Finset.sum_nonneg (fun ω _ => h ω)) (Nat.cast_nonneg _) + +theorem average_mono {f g : Ω → ℝ} (h : ∀ ω, f ω ≤ g ω) : + average f ≤ average g := by + exact div_le_div_of_nonneg_right (Finset.sum_le_sum (fun ω _ => h ω)) + (Nat.cast_nonneg _) + +theorem average_indicator_eq (P : Ω → Prop) [DecidablePred P] : + average (fun ω => if P ω then (1 : ℝ) else 0) = + ((Finset.univ.filter P).card : ℝ) / (Fintype.card Ω : ℝ) := by + simp [average] + +theorem average_equiv (e : Ω ≃ Γ) (f : Γ → ℝ) : + average (fun ω => f (e ω)) = average f := by + unfold average + rw [Fintype.card_congr e, e.sum_comp] + +theorem average_prod (f : Ω → ℝ) (g : Γ → ℝ) : + average (fun p : Ω × Γ => f p.1 * g p.2) = average f * average g := by + simp only [average, Fintype.sum_prod_type, Fintype.card_prod, Nat.cast_mul, + ← Finset.mul_sum, ← Finset.sum_mul] + exact mul_div_mul_comm _ _ _ _ + +theorem average_prod_average (f : Ω × Γ → ℝ) : + average f = average (fun ω => average (fun γ => f (ω, γ))) := by + simp only [average, Fintype.sum_prod_type, Fintype.card_prod, Nat.cast_mul, + div_eq_mul_inv, ← Finset.sum_mul, mul_inv_rev] + ring + +@[simp] theorem average_prod_fst [Nonempty Γ] (f : Ω → ℝ) : + average (fun p : Ω × Γ => f p.1) = average f := by + simpa using average_prod f (fun _ : Γ => (1 : ℝ)) + +@[simp] theorem average_prod_snd [Nonempty Ω] (g : Γ → ℝ) : + average (fun p : Ω × Γ => g p.2) = average g := by + simpa using average_prod (fun _ : Ω => (1 : ℝ)) g + +theorem average_centered_sq [Nonempty Ω] (f : Ω → ℝ) : + average (fun ω => (f ω - average f) ^ 2) = + average (fun ω => f ω ^ 2) - (average f) ^ 2 := by + calc + average (fun ω => (f ω - average f) ^ 2) = + average (fun ω => f ω ^ 2 - (2 * average f) * f ω + (average f) ^ 2) := by + apply average_congr + intro ω + ring + _ = _ := by rw [average_add, average_sub, average_const_mul, average_const]; ring + +section Coordinates + +variable {I : Type*} [Fintype I] [DecidableEq I] {X : I → Type*} + [∀ i, Fintype (X i)] [∀ i, Nonempty (X i)] + +theorem average_pi_eval (i : I) (f : X i → ℝ) : + average (fun ω : ∀ i, X i => f (ω i)) = average f := by + classical + change average (fun ω => (fun p : X i × (∀ j : {j // j ≠ i}, X j) => f p.1) + ((Equiv.piSplitAt i X) ω)) = average f + rw [average_equiv (Equiv.piSplitAt i X) + (fun p : X i × (∀ j : {j // j ≠ i}, X j) => f p.1), average_prod_fst] + +theorem average_pi_restrict (D : Finset I) (f : (∀ i : {i // i ∈ D}, X i) → ℝ) : + average (fun ω : ∀ i, X i => f (fun i => ω i)) = average f := by + classical + change average (fun ω => + (fun p : (∀ i : {i // i ∈ D}, X i) × (∀ i : {i // i ∉ D}, X i) => f p.1) + ((Equiv.piEquivPiSubtypeProd (fun i => i ∈ D) X) ω)) = average f + rw [average_equiv (Equiv.piEquivPiSubtypeProd (fun i => i ∈ D) X) + (fun p : (∀ i : {i // i ∈ D}, X i) × (∀ i : {i // i ∉ D}, X i) => f p.1), + average_prod_fst] + +theorem average_prod_pi_restrict (D : Finset I) + (f : ((∀ i : {i // i ∈ D}, X i) × (∀ i : {i // i ∈ D}, X i)) → ℝ) : + average (fun p : (∀ i, X i) × (∀ i, X i) => + f ((fun i => p.1 i), (fun i => p.2 i))) = average f := by + classical + rw [average_prod_average] + calc + _ = average (fun x : ∀ i, X i => + average (fun y : ∀ i : {i // i ∈ D}, X i => f ((fun i => x i), y))) := by + apply average_congr + intro x + exact average_pi_restrict D (fun y => f ((fun i => x i), y)) + _ = average (fun x : ∀ i : {i // i ∈ D}, X i => average (fun y => f (x, y))) := + average_pi_restrict D (fun x => average (fun y => f (x, y))) + _ = average f := (average_prod_average f).symm + +theorem average_pi_eval_mul (i j : I) (hij : i ≠ j) (f : X i → ℝ) (g : X j → ℝ) : + average (fun ω : ∀ i, X i => f (ω i) * g (ω j)) = average f * average g := by + classical + change average (fun ω => + (fun p : X i × (∀ k : {k // k ≠ i}, X k) => + f p.1 * g (p.2 ⟨j, Ne.symm hij⟩)) ((Equiv.piSplitAt i X) ω)) = _ + rw [average_equiv (Equiv.piSplitAt i X) + (fun p : X i × (∀ k : {k // k ≠ i}, X k) => + f p.1 * g (p.2 ⟨j, Ne.symm hij⟩)), + average_prod f (fun k : ∀ k : {k // k ≠ i}, X k => g (k ⟨j, Ne.symm hij⟩))] + exact congrArg (fun t => average f * t) + (average_pi_eval (X := fun k : {k // k ≠ i} => X k) ⟨j, Ne.symm hij⟩ g) + +theorem average_pi_sum_centered_sq (f : ∀ i, X i → ℝ) : + average (fun ω : ∀ i, X i => (∑ i, (f i (ω i) - average (f i))) ^ 2) = + ∑ i, average (fun x => (f i x - average (f i)) ^ 2) := by + classical + let c : ∀ i, X i → ℝ := fun i x => f i x - average (f i) + have hc (i : I) : average (c i) = 0 := by + simp [c, average_sub] + change average (fun ω : ∀ i, X i => (∑ i, c i (ω i)) ^ 2) = + ∑ i, average (fun x => (c i x) ^ 2) + calc + _ = ∑ i, ∑ j, average (fun ω : ∀ i, X i => c i (ω i) * c j (ω j)) := by + simp only [pow_two, Finset.sum_mul, Finset.mul_sum, average_finset_sum] + exact Finset.sum_comm + _ = _ := by + apply Finset.sum_congr rfl + intro i hi + calc + (∑ j, average (fun ω : ∀ i, X i => c i (ω i) * c j (ω j))) = + average (fun ω : ∀ i, X i => c i (ω i) * c i (ω i)) := by + apply Finset.sum_eq_single i + · intro j hj hji + rw [average_pi_eval_mul i j (Ne.symm hji), hc, hc, zero_mul] + · simp + _ = average (fun x => (c i x) ^ 2) := by + simp only [pow_two] + exact average_pi_eval i (fun x => c i x * c i x) + +end Coordinates + +theorem deviation_bound (f : Ω → ℝ) (μ δ : ℝ) (hδ : 0 < δ) : + average (fun ω => if δ ≤ |f ω - μ| then (1 : ℝ) else 0) * δ ^ 2 ≤ + average (fun ω => (f ω - μ) ^ 2) := by + rw [← average_mul_const] + apply average_mono + intro ω + split_ifs with h + · simp only [one_mul] + have hh := (sq_le_sq₀ (le_of_lt hδ) (abs_nonneg (f ω - μ))).2 h + simpa only [sq_abs] using hh + · simp only [zero_mul] + exact sq_nonneg _ + +theorem average_indicator_exists_le_sum {I : Type*} [Fintype I] + (P : I → Ω → Prop) [∀ i ω, Decidable (P i ω)] : + average (fun ω => if ∃ i, P i ω then (1 : ℝ) else 0) ≤ + ∑ i, average (fun ω => if P i ω then (1 : ℝ) else 0) := by + classical + rw [← average_finset_sum] + apply average_mono + intro ω + by_cases h : ∃ i, P i ω + · rw [ite_eq_left h] + obtain ⟨i, hi⟩ := h + calc + (1 : ℝ) = (if P i ω then (1 : ℝ) else 0) := by simp [hi] + _ ≤ ∑ j, if P j ω then (1 : ℝ) else 0 := + Finset.single_le_sum (f := fun j => if P j ω then (1 : ℝ) else 0) + (fun j _ => by split_ifs <;> norm_num) (Finset.mem_univ i) + · rw [ite_eq_right h] + exact Finset.sum_nonneg (fun i _ => by split_ifs <;> norm_num) + +end + +end MatrixMultiplication.PermutationMatching + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/Entropy/FloorExponentialRates.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/Entropy/FloorExponentialRates.lean new file mode 100644 index 0000000000000000000000000000000000000000..77c4cc9c1a7d34a9a2aaed1bb0ccb509b5ec8f1f --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/Entropy/FloorExponentialRates.lean @@ -0,0 +1,89 @@ +import OAI.LinearAlgebra.MatrixMultiplication.Recovery.RecoveryGrowth +import Mathlib.Analysis.SpecialFunctions.Exp +import Mathlib.Data.Fintype.BigOperators + +namespace OAI + +/-! Finite entropy, rate estimates and ordered asymptotic limits. -/ + +noncomputable section + +namespace MatrixMultiplication.FloorExponentialRates + +open Filter +open scoped BigOperators Topology Classical + +def count (rate : ℝ) (m : ℕ) : ℕ := ⌊Real.exp ((m : ℝ) * rate)⌋₊ + +theorem count_pos {rate : ℝ} (hr : 0 ≤ rate) (m : ℕ) : 0 < count rate m := by + have he : (1 : ℝ) ≤ Real.exp ((m : ℝ) * rate) := + Real.one_le_exp (mul_nonneg (Nat.cast_nonneg _) hr) + exact lt_of_lt_of_le Nat.zero_lt_one (Nat.le_floor (by simpa only [Nat.cast_one] using he)) + +theorem log_count_bounds {rate : ℝ} (hr : 0 ≤ rate) (m : ℕ) : + (m : ℝ) * rate - Real.log 2 ≤ Real.log (count rate m : ℝ) ∧ + Real.log (count rate m : ℝ) ≤ (m : ℝ) * rate := by + have hp : (0 : ℝ) < count rate m := Nat.cast_pos.mpr (count_pos hr m) + have hone : (1 : ℝ) ≤ count rate m := by exact_mod_cast count_pos hr m + have hround := Nat.lt_floor_add_one (Real.exp ((m : ℝ) * rate)) + have hhalf : Real.exp ((m : ℝ) * rate) / 2 ≤ (count rate m : ℝ) := by + change Real.exp ((m : ℝ) * rate) < (count rate m : ℝ) + 1 at hround + linarith + constructor + · have h := Real.log_le_log (by positivity : 0 < Real.exp ((m : ℝ) * rate) / 2) hhalf + simpa only [Real.log_div (Real.exp_ne_zero _) (by norm_num : (2 : ℝ) ≠ 0), + Real.log_exp] using h + · have h := Real.log_le_log hp (Nat.floor_le (Real.exp_pos _).le) + simpa only [Real.log_exp] using h + +theorem tendsto_log_count_div_nat {rate : ℝ} (hr : 0 ≤ rate) : + Tendsto (fun m : ℕ => Real.log (count rate m : ℝ) / (m : ℝ)) + atTop (𝓝 rate) := by + have hinv : Tendsto (fun m : ℕ => Real.log 2 / (m : ℝ)) atTop (𝓝 0) := + tendsto_const_nhds.div_atTop tendsto_natCast_atTop_atTop + have hlo : Tendsto (fun m : ℕ => rate - Real.log 2 / (m : ℝ)) atTop (𝓝 rate) := by + simpa only [sub_zero] using tendsto_const_nhds.sub hinv + apply tendsto_of_tendsto_of_tendsto_of_le_of_le' hlo tendsto_const_nhds + · filter_upwards [eventually_gt_atTop (0 : ℕ)] with m hm + have hm' : (0 : ℝ) < m := Nat.cast_pos.mpr hm + have h := div_le_div_of_nonneg_right (log_count_bounds hr m).1 hm'.le + simpa only [sub_div, mul_div_cancel_left₀ rate hm'.ne'] using h + · filter_upwards [eventually_gt_atTop (0 : ℕ)] with m hm + have hm' : (0 : ℝ) < m := Nat.cast_pos.mpr hm + have h := div_le_div_of_nonneg_right (log_count_bounds hr m).2 hm'.le + simpa only [mul_div_cancel_left₀ rate hm'.ne'] using h + +theorem tendsto_log_prod_count_div_nat {I : Type*} [Fintype I] (rate : I → ℝ) + (hr : ∀ i, 0 ≤ rate i) : + Tendsto (fun m : ℕ => Real.log ((∏ i, count (rate i) m : ℕ) : ℝ) / (m : ℝ)) + atTop (𝓝 (∑ i, rate i)) := by + have h := tendsto_finsetSum Finset.univ (fun i _ => tendsto_log_count_div_nat (hr i)) + apply h.congr + intro m + rw [Nat.cast_prod, Real.log_prod (s := Finset.univ) + (f := fun i => (count (rate i) m : ℝ)) + (fun i _ => Nat.cast_ne_zero.mpr (Nat.ne_of_gt (count_pos (hr i) m)))] + simp only [div_eq_mul_inv, Finset.sum_mul] + +abbrev Labels {I : Type*} (rate : I → ℝ) (m : ℕ) := ∀ i, Fin (count (rate i) m) + +theorem card_labels {I : Type*} [Fintype I] (rate : I → ℝ) (m : ℕ) : + Fintype.card (Labels rate m) = ∏ i, count (rate i) m := by + simp only [Labels, Fintype.card_pi, Fintype.card_fin] + +theorem card_labels_pos {I : Type*} [Fintype I] (rate : I → ℝ) + (hr : ∀ i, 0 ≤ rate i) (m : ℕ) : 0 < Fintype.card (Labels rate m) := by + rw [card_labels] + exact Finset.prod_pos fun i _ => count_pos (hr i) m + +theorem tendsto_log_card_labels_div_nat {I : Type*} [Fintype I] (rate : I → ℝ) + (hr : ∀ i, 0 ≤ rate i) : + Tendsto (fun m : ℕ => Real.log (Fintype.card (Labels rate m) : ℝ) / (m : ℝ)) + atTop (𝓝 (∑ i, rate i)) := by + simpa only [card_labels] using tendsto_log_prod_count_div_nat rate hr + +end MatrixMultiplication.FloorExponentialRates + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/Entropy/IndependentConditioning.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/Entropy/IndependentConditioning.lean new file mode 100644 index 0000000000000000000000000000000000000000..ce7e65e8f39a82ee0ca3f6e0069bacbd58b4dbc2 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/Entropy/IndependentConditioning.lean @@ -0,0 +1,83 @@ +import OAI.LinearAlgebra.MatrixMultiplication.Tensor.UniformCoordinate + +namespace OAI + +/-! Finite entropy, rate estimates and ordered asymptotic limits. -/ + +noncomputable section + +namespace MatrixMultiplication.CompletionLaws + +open MatrixMultiplication.Foundation +open scoped BigOperators +attribute [local instance 10000] Classical.propDecidable Classical.decEq + +variable {A B X : Type*} [Fintype A] [Fintype B] [Fintype X] + +theorem condition_map_mass (p : FiniteLaw A) (P : A → Prop) + (h : 0 < eventMass p P) (f : A → X) (x : X) : + ((condition p P h).map (fun a => f a.val)).mass x = + (∑ a : {a // P a}, if f a.val = x then p.mass a.val else 0) / eventMass p P := by + rw [FiniteLaw.map_mass, Finset.sum_div] + apply Finset.sum_congr rfl + intro a _ + rw [condition_mass] + split_ifs <;> simp + +theorem joint_event_sum (p : FiniteLaw A) (f : A → X) (g : A → B) + (Q : B → Prop) (x : X) : + (∑ a : {a // Q (g a)}, if f a.val = x then p.mass a.val else 0) = + ∑ b : {b // Q b}, (p.map (fun a => (f a, g a))).mass (x, b.val) := by + rw [sum_subtype_indicator (fun a => Q (g a)) + (fun a => if f a = x then p.mass a else 0), + sum_subtype_indicator Q + (fun b => (p.map (fun a => (f a, g a))).mass (x, b))] + simp only [FiniteLaw.map_mass, Prod.mk.injEq] + calc + (∑ a, if Q (g a) then (if f a = x then p.mass a else 0) else 0) = + ∑ a, ∑ b, if Q b then (if f a = x ∧ g a = b then p.mass a else 0) else 0 := by + apply Finset.sum_congr rfl + intro a _ + rw [Finset.sum_eq_single (g a)] + · simp + · intro b _ hb + simp [Ne.symm hb] + · simp + _ = ∑ b, ∑ a, if Q b then (if f a = x ∧ g a = b then p.mass a else 0) else 0 := + Finset.sum_comm + _ = ∑ b, if Q b then ∑ a, if f a = x ∧ g a = b then p.mass a else 0 else 0 := by + apply Finset.sum_congr rfl + intro b _ + split_ifs <;> simp + +theorem condition_independent_coordinate_mass (p : FiniteLaw A) + (f : A → X) (g : A → B) (Q : B → Prop) + (independent : ∀ x b, (p.map (fun a => (f a, g a))).mass (x, b) = + (p.map f).mass x * (p.map g).mass b) + (h : 0 < eventMass p (fun a => Q (g a))) (x : X) : + ((condition p (fun a => Q (g a)) h).map (fun a => f a.val)).mass x = + (p.map f).mass x := by + rw [condition_map_mass, joint_event_sum] + simp_rw [independent] + rw [← Finset.mul_sum] + change ((p.map f).mass x * eventMass (p.map g) Q) / + eventMass p (fun a => Q (g a)) = _ + rw [← eventMass_coordinate p g Q, mul_div_cancel_right₀ _ h.ne'] + +theorem uniform_coordinate_independent_condition (p : FiniteLaw A) + (f : A → X) (g : A → B) (P : X → Prop) (Q : B → Prop) + (uniform : UniformCoordinate p f P) + (independent : ∀ x b, (p.map (fun a => (f a, g a))).mass (x, b) = + (p.map f).mass x * (p.map g).mass b) + (h : 0 < eventMass p (fun a => Q (g a))) : + UniformCoordinate (condition p (fun a => Q (g a)) h) + (fun a => f a.val) P := by + intro x + rw [condition_independent_coordinate_mass p f g Q independent h] + exact uniform x + +end MatrixMultiplication.CompletionLaws + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/Entropy/LeafRates.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/Entropy/LeafRates.lean new file mode 100644 index 0000000000000000000000000000000000000000..23d3f1aa9425159665a9e32b3212de99b8c7e62e --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/Entropy/LeafRates.lean @@ -0,0 +1,83 @@ +import OAI.LinearAlgebra.MatrixMultiplication.Tensor.ExactStatisticWords +import OAI.LinearAlgebra.MatrixMultiplication.Entropy.ComplexTypeEntropy + +namespace OAI + +/-! Finite entropy, rate estimates and ordered asymptotic limits. -/ + +noncomputable section + +namespace MatrixMultiplication.LeafRates + +open MatrixMultiplication.Foundation Filter +open scoped BigOperators Topology + +variable {A U : Type*} [Fintype A] [DecidableEq A] [Fintype U] + +theorem log_card_supported (statistic : U → A) (counts b : A → ℕ) + (hb : ∀ a, 0 < counts a → Fintype.card {u : U // statistic u = a} = b a) + (hbpos : ∀ a, 0 < b a) : + Real.log (Fintype.card (ExactStatisticWords.Words statistic counts) : ℝ) = + Real.log (Nat.multinomial Finset.univ counts : ℝ) + + ∑ a, (counts a : ℝ) * Real.log (b a : ℝ) := by + rw [ExactStatisticWords.card_of_supported statistic counts b hb, Nat.cast_mul, Nat.cast_prod] + have hm : (Nat.multinomial Finset.univ counts : ℝ) ≠ 0 := by + exact_mod_cast (Nat.ne_of_gt (Nat.multinomial_pos Finset.univ counts)) + have hp : (∏ a, (b a ^ counts a : ℕ) : ℝ) ≠ 0 := by + apply Finset.prod_ne_zero_iff.mpr + intro a _ + exact_mod_cast (Nat.ne_of_gt (pow_pos (hbpos a) _)) + rw [Real.log_mul hm hp, Real.log_prod (s := Finset.univ) + (f := fun a => ((b a ^ counts a : ℕ) : ℝ)) + (fun a _ => by exact_mod_cast (Nat.ne_of_gt (pow_pos (hbpos a) (counts a))))] + simp only [Nat.cast_pow, Real.log_pow] + +theorem log_card (statistic : U → A) (counts b : A → ℕ) + (hb : ∀ a, Fintype.card {u : U // statistic u = a} = b a) + (hbpos : ∀ a, 0 < b a) : + Real.log (Fintype.card (ExactStatisticWords.Words statistic counts) : ℝ) = + Real.log (Nat.multinomial Finset.univ counts : ℝ) + + ∑ a, (counts a : ℝ) * Real.log (b a : ℝ) := + log_card_supported statistic counts b (fun a _ => hb a) hbpos + +theorem tendsto_log_card_supported (statistic : U → A) (counts b : A → ℕ) + (hb : ∀ a, 0 < counts a → Fintype.card {u : U // statistic u = a} = b a) + (hbpos : ∀ a, 0 < b a) (hD : 0 < ∑ a, counts a) : + Tendsto (fun t : ℕ => + Real.log (Fintype.card (ExactStatisticWords.Words statistic (fun a => t * counts a)) : ℝ) / + ((t : ℝ) * (∑ a, counts a : ℕ))) atTop + (𝓝 (finiteEntropy (fun a => (counts a : ℝ) / (∑ a, counts a : ℕ)) + + ∑ a, ((counts a : ℝ) / (∑ a, counts a : ℕ)) * Real.log (b a : ℝ))) := by + have hl := (tendsto_log_multinomial_mul counts hD).add_const + (∑ a, ((counts a : ℝ) / (∑ a, counts a : ℕ)) * Real.log (b a : ℝ)) + apply hl.congr' + filter_upwards [eventually_ne_atTop (0 : ℕ)] with t ht + have hbt : ∀ a, 0 < t * counts a → Fintype.card {u : U // statistic u = a} = b a := + fun a ha => hb a (by nlinarith) + rw [log_card_supported statistic (fun a => t * counts a) b hbt hbpos, add_div] + congr 1 + rw [Finset.sum_div] + apply Finset.sum_congr rfl + intro a _ + have ht' : (t : ℝ) ≠ 0 := Nat.cast_ne_zero.mpr ht + have hD' : ((∑ a, counts a : ℕ) : ℝ) ≠ 0 := by exact_mod_cast (Nat.ne_of_gt hD) + have hDsum : (∑ a, (counts a : ℝ)) ≠ 0 := by + simpa only [Nat.cast_sum] using hD' + simp only [Nat.cast_mul] + field_simp [ht', hD', hDsum] + +theorem tendsto_log_card (statistic : U → A) (counts b : A → ℕ) + (hb : ∀ a, Fintype.card {u : U // statistic u = a} = b a) + (hbpos : ∀ a, 0 < b a) (hD : 0 < ∑ a, counts a) : + Tendsto (fun t : ℕ => + Real.log (Fintype.card (ExactStatisticWords.Words statistic (fun a => t * counts a)) : ℝ) / + ((t : ℝ) * (∑ a, counts a : ℕ))) atTop + (𝓝 (finiteEntropy (fun a => (counts a : ℝ) / (∑ a, counts a : ℕ)) + + ∑ a, ((counts a : ℝ) / (∑ a, counts a : ℕ)) * Real.log (b a : ℝ))) := + tendsto_log_card_supported statistic counts b (fun a _ => hb a) hbpos hD + +end MatrixMultiplication.LeafRates + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldConstruction/ActiveCapacity.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldConstruction/ActiveCapacity.lean new file mode 100644 index 0000000000000000000000000000000000000000..d2cd173d56668ed05f2bb95eef8a7725c66ce80b --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldConstruction/ActiveCapacity.lean @@ -0,0 +1,124 @@ +import OAI.LinearAlgebra.MatrixMultiplication.FieldConstruction.ScheduledYield +import OAI.LinearAlgebra.MatrixMultiplication.FieldConstruction.NativeLaws + +namespace OAI + +/-! Tensor extraction over arbitrary fields and its asymptotic rate. -/ + +noncomputable section + +namespace MatrixMultiplication.AllFieldActiveCapacity + +open MatrixMultiplication.Foundation AllFieldParameters AllFieldHistory +open AllFieldNativeCapacity AllFieldActiveLaws AllFieldScheduledYield +open scoped BigOperators +attribute [local instance] Classical.propDecidable Classical.decEq + +def canonicalSideMass {K : ℕ} (w : Work K) (s : Fin 3) (k : Fin 17) : ℝ := + ∑ b : w.Branch, if w.splitShape b s = k.val then (branchLaw w).mass b else 0 + +theorem placedLaw_priority_sideMass {K : ℕ} (w : PlacedWork K) + (i : Fin 3) : + JointPopulationRates.sideMass (placedLaw w).mass (w.physicalOrder i) = + canonicalSideMass w.1 (w.1.priority i) := by + funext k + rw [placedLaw_sideMass] + simp only [Fin.ext_iff, branchShape, encodePhysicalShape_side, + PlacedWork.physicalOrder, Equiv.trans_apply, Equiv.symm_apply_apply, + canonicalSideMass, branchLaw_mass] + +theorem canonicalSideMass_stageA {K : ℕ} (h : InitialPositive K) (s : Fin 3) : + canonicalSideMass (.stageA h) s = + (stageAMarginalLaw (initialShape h.val) h.property s).mass := by + funext k + rw [show (stageAMarginalLaw (initialShape h.val) h.property s).mass k = + marginal (below (initialShape h.val)) + (fun u => (stageALaw (initialShape h.val) u : ℝ)) s k from + indexedMarginalLaw_mass _ _ _ _ _ _ k] + change (∑ b : ASplit h, if (below (initialShape h.val))[b.val] s = k.val + then (stageALaw (initialShape h.val) (below (initialShape h.val))[b.val] : ℝ) + else 0) = _ + exact Fin.sum_univ_fun_getElem _ + (fun u : Shape => if u s = k.val then (stageALaw (initialShape h.val) u : ℝ) else 0) + +theorem canonicalSideMass_stageB {K : ℕ} (h : APositive K) (s : Fin 3) : + canonicalSideMass (.stageB h) s = + (stageBMarginalLaw (aShape h.val) h.property s).mass := by + funext k + rw [show (stageBMarginalLaw (aShape h.val) h.property s).mass k = + marginal (below (aShape h.val)) + (fun u => (stageBLaw (aShape h.val) u : ℝ)) s k from + indexedMarginalLaw_mass _ _ _ _ _ _ k] + change (∑ b : BSplit h, if (below (aShape h.val))[b.val] s = k.val + then (stageBLaw (aShape h.val) (below (aShape h.val))[b.val] : ℝ) + else 0) = _ + exact Fin.sum_univ_fun_getElem _ + (fun u : Shape => if u s = k.val then (stageBLaw (aShape h.val) u : ℝ) else 0) + +theorem canonicalSideMass_stageC {K : ℕ} (h : PartC K) (s : Fin 3) : + canonicalSideMass (.stageC h) s = + AllFieldStageCCapacity.stageCMarginal (cParameterParent h) (cShapeParent h) s := rfl + +theorem workCapacity_first {K : ℕ} (w : PlacedWork K) : + workCapacity w.1 0 = finiteEntropy + (JointPopulationRates.sideMass (placedLaw w).mass (w.physicalOrder 0)) := by + rw [placedLaw_priority_sideMass] + rcases w with ⟨w, phi⟩ + cases w with + | stageA h => + rw [canonicalSideMass_stageA] + exact stageACapacity_first_entropy _ h.property + | stageB h => + rw [canonicalSideMass_stageB] + exact stageBCapacity_first_entropy _ h.property + | stageC h => + rw [canonicalSideMass_stageC] + exact workCapacity_stageC h 0 + +theorem workCapacity_stageC_physical {K : ℕ} (h : PartC K) + (phi : Placement) (i : Fin 3) : + workCapacity (.stageC h) i = finiteEntropy + (JointPopulationRates.sideMass (placedLaw (.stageC h, phi)).mass + ((PlacedWork.physicalOrder (.stageC h, phi)) i)) := by + rw [placedLaw_priority_sideMass, canonicalSideMass_stageC] + exact workCapacity_stageC h i + +theorem order_first_capacity {K tick : ℕ} {sigma : Placement} + (h : ActiveOrder K tick sigma) : + workCapacity h.val.val.1 0 = finiteEntropy + (JointPopulationRates.sideMass (orderLaw h).mass (sigma 0)) := by + have hh := workCapacity_first h.val.val + rw [h.property] at hh + exact hh + +def orderEntropyRate {K tick : ℕ} (allocation : Allocation) (sigma : Placement) : ℝ := + ∑ h : ActiveOrder K tick sigma, + ((populationLength (K := K) allocation 1 : ℝ) * orderMass allocation h) * + finiteEntropy (orderLaw h).mass + +def orderNativeDegree {K tick : ℕ} (allocation : Allocation) (sigma : Placement) + (i : Fin 3) : ℝ := + ∑ h : ActiveOrder K tick sigma, + ((populationLength (K := K) allocation 1 : ℝ) * orderMass allocation h) * + (finiteEntropy (orderLaw h).mass - workCapacity h.val.val.1 i) + +theorem order_entropy_sub_native_degree (K tick : ℕ) (allocation : Allocation) + (sigma : Placement) : + orderEntropyRate (K := K) (tick := tick) allocation sigma - + max (orderNativeDegree (K := K) (tick := tick) allocation sigma 0) + (max (orderNativeDegree (K := K) (tick := tick) allocation sigma 1) + (orderNativeDegree (K := K) (tick := tick) allocation sigma 2)) = + (populationLength (K := K) allocation 1 : ℝ) * + ((1 / 6 : ℝ) * Staggering.minCapacity + (FiniteSchedule.tickCapacity K nativeLA nativeLB + (nativeLC (fun i => (allocation.mass i : ℝ))) tick)) := by + unfold orderEntropyRate orderNativeDegree + rw [JointCapacityAlgebra.weighted_joint_capacity] + simp_rw [order_dilation_capacity, ← mul_assoc] + exact PhysicalOrders.minCapacity_mul _ _ (by positivity) + +end MatrixMultiplication.AllFieldActiveCapacity + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldConstruction/ActiveGibbs.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldConstruction/ActiveGibbs.lean new file mode 100644 index 0000000000000000000000000000000000000000..64125732114f6c597894755a54e447c5c236fbeb --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldConstruction/ActiveGibbs.lean @@ -0,0 +1,256 @@ +import OAI.LinearAlgebra.MatrixMultiplication.FieldConstruction.ActiveLaws +import Mathlib.Data.Rat.BigOperators + +namespace OAI + +/-! Tensor extraction over arbitrary fields and its asymptotic rate. -/ + +noncomputable section + +namespace MatrixMultiplication.AllFieldActiveGibbs + +open AllFieldParameters AllFieldHistory AllFieldActiveLaws MatrixMultiplication.Foundation +open scoped BigOperators +attribute [local instance] Classical.propDecidable Classical.decEq + +def splitCoordinateWeight (parents : List Shape) (data : List ℤ) + (s : Shape) (i : Fin 3) (k : ℕ) : ℝ := + (weight (assigned (splitKeys parents) data (s, i, min k (s i - k))) : ℝ) + +def splitPotential (parents : List Shape) (data : List ℤ) + (s : Shape) (i : Fin 3) (k : ℕ) : ℝ := + Real.log (splitCoordinateWeight parents data s i k) + +def splitNormalizer (parents : List Shape) (data : List ℤ) (s : Shape) : ℝ := + (((below s).map (splitWeight parents data s)).sum : ℚ) + +def splitLogNormalizer (parents : List Shape) (data : List ℤ) (s : Shape) : ℝ := + Real.log (splitNormalizer parents data s) + +theorem splitCoordinateWeight_pos (parents : List Shape) (data : List ℤ) + (hd : ∀ n ∈ data, |n| ≤ 160000) (s : Shape) (i : Fin 3) (k : ℕ) : + 0 < splitCoordinateWeight parents data s i k := by + apply Rat.cast_pos.mpr + exact weight_positive_of_argument_bound _ (assigned_argument_bound _ data hd _) + +theorem splitNormalizer_pos (parents : List Shape) (data : List ℤ) + (hd : ∀ n ∈ data, |n| ≤ 160000) (s : Shape) (hne : below s ≠ []) : + 0 < splitNormalizer parents data s := by + apply Rat.cast_pos.mpr + exact list_sum_map_positive _ _ hne (fun u _ => splitWeight_positive parents data hd s u) + +theorem splitWeight_log (parents : List Shape) (data : List ℤ) + (hd : ∀ n ∈ data, |n| ≤ 160000) (s u : Shape) : + Real.log (splitWeight parents data s u : ℝ) = + ∑ i : Fin 3, splitPotential parents data s i (u i) := by + have hweight (i : Fin 3) : (weight (splitSignature parents data s u i) : ℝ) ≠ 0 := + ne_of_gt (splitCoordinateWeight_pos parents data hd s i (u i)) + rw [splitWeight, Rat.cast_prod, Real.log_prod (s := Finset.univ) (fun i _ => hweight i)] + rfl + +theorem splitLaw_log (parents : List Shape) (data : List ℤ) + (hd : ∀ n ∈ data, |n| ≤ 160000) (s u : Shape) (hu : u ∈ below s) : + Real.log (splitLaw parents data s u : ℝ) = + (∑ i : Fin 3, splitPotential parents data s i (u i)) - + splitLogNormalizer parents data s := by + have hweight : (splitWeight parents data s u : ℝ) ≠ 0 := by + exact_mod_cast ne_of_gt (splitWeight_positive parents data hd s u) + have hne : below s ≠ [] := by + intro he + simp only [he, List.not_mem_nil] at hu + have hnormal := ne_of_gt (splitNormalizer_pos parents data hd s hne) + rw [splitLaw, ite_eq_left hu, Rat.cast_div] + change Real.log ((splitWeight parents data s u : ℝ) / splitNormalizer parents data s) = _ + rw [Real.log_div hweight hnormal, splitWeight_log parents data hd] + rfl + +theorem splitLaw_positive_iff (parents : List Shape) (data : List ℤ) + (hd : ∀ n ∈ data, |n| ≤ 160000) (s u : Shape) : + 0 < (splitLaw parents data s u : ℝ) ↔ u ∈ below s := by + constructor + · intro hp + by_contra hu + rw [splitLaw_outside_support parents data s u hu] at hp + norm_num at hp + · intro hu + exact_mod_cast splitLaw_positive parents data hd s u hu + +def physicalPotential (parents : List Shape) (data : List ℤ) (s : Shape) + (phi : Placement) (i : Fin 3) (k : Fin 17) : ℝ := + splitPotential parents data s (phi.symm i) k.val + +theorem splitLaw_log_physical (parents : List Shape) (data : List ℤ) + (hd : ∀ n ∈ data, |n| ≤ 160000) (s u : Shape) (hu : u ∈ below s) + (hb : ShapeBounded u) (phi : Placement) : + Real.log (splitLaw parents data s u : ℝ) = + physicalPotential parents data s phi 0 (JointPopulation.shapeSide 0 (encodePhysicalShape phi u hb)) + + physicalPotential parents data s phi 1 (JointPopulation.shapeSide 1 (encodePhysicalShape phi u hb)) + + physicalPotential parents data s phi 2 (JointPopulation.shapeSide 2 (encodePhysicalShape phi u hb)) - + splitLogNormalizer parents data s := by + rw [splitLaw_log parents data hd s u hu] + have hsum : (∑ i : Fin 3, splitPotential parents data s i (u i)) = + ∑ i : Fin 3, physicalPotential parents data s phi i + (JointPopulation.shapeSide i (encodePhysicalShape phi u hb)) := by + simp only [physicalPotential, encodePhysicalShape_side] + exact (phi.symm.sum_comp (fun i => splitPotential parents data s i (u i))).symm + rw [hsum, Fin.sum_univ_three] + +theorem placedLaw_positive_has_branch {K : ℕ} (w : PlacedWork K) + (u : JointPopulation.Shape) (hu : 0 < (placedLaw w).mass u) : + ∃ b : w.1.Branch, branchShape w b = u := by + by_contra hn + have hz : (placedLaw w).mass u = 0 := by + rw [placedLaw_mass] + apply Finset.sum_eq_zero + intro b _ + exact ite_eq_right (fun hb => hn ⟨b, hb⟩) + rw [hz] at hu + exact lt_irrefl 0 hu + +theorem placedLaw_stageA_branch_log {K : ℕ} (h : InitialPositive K) + (phi : Placement) (b : ASplit h) : + Real.log ((placedLaw (Work.stageA h, phi)).mass (branchShape (Work.stageA h, phi) b)) = + physicalPotential positiveInitial tableP (initialShape h.val) phi 0 + (JointPopulation.shapeSide 0 (branchShape (Work.stageA h, phi) b)) + + physicalPotential positiveInitial tableP (initialShape h.val) phi 1 + (JointPopulation.shapeSide 1 (branchShape (Work.stageA h, phi) b)) + + physicalPotential positiveInitial tableP (initialShape h.val) phi 2 + (JointPopulation.shapeSide 2 (branchShape (Work.stageA h, phi) b)) - + splitLogNormalizer positiveInitial tableP (initialShape h.val) := by + change (Work.stageA h).Branch at b + rw [placedLaw_mass_branch] + exact splitLaw_log_physical positiveInitial tableP stageA_table_arguments_bounded + (initialShape h.val) (aSplit ⟨h, b, false⟩) (aSplit_mem ⟨h, b, false⟩) + ((Work.stageA h).splitShape_spec b).1 phi + +theorem placedLaw_stageB_branch_log {K : ℕ} (h : APositive K) + (phi : Placement) (b : BSplit h) : + Real.log ((placedLaw (Work.stageB h, phi)).mass (branchShape (Work.stageB h, phi) b)) = + physicalPotential positiveSecond tablep (aShape h.val) phi 0 + (JointPopulation.shapeSide 0 (branchShape (Work.stageB h, phi) b)) + + physicalPotential positiveSecond tablep (aShape h.val) phi 1 + (JointPopulation.shapeSide 1 (branchShape (Work.stageB h, phi) b)) + + physicalPotential positiveSecond tablep (aShape h.val) phi 2 + (JointPopulation.shapeSide 2 (branchShape (Work.stageB h, phi) b)) - + splitLogNormalizer positiveSecond tablep (aShape h.val) := by + change (Work.stageB h).Branch at b + rw [placedLaw_mass_branch] + exact splitLaw_log_physical positiveSecond tablep stageB_table_arguments_bounded + (aShape h.val) (bSplit ⟨h, b, false⟩) (bSplit_mem ⟨h, b, false⟩) + ((Work.stageB h).splitShape_spec b).1 phi + +theorem placedLaw_stageA_log {K : ℕ} (h : InitialPositive K) (phi : Placement) + (u : JointPopulation.Shape) (hu : 0 < (placedLaw (Work.stageA h, phi)).mass u) : + Real.log ((placedLaw (Work.stageA h, phi)).mass u) = + physicalPotential positiveInitial tableP (initialShape h.val) phi 0 (JointPopulation.shapeSide 0 u) + + physicalPotential positiveInitial tableP (initialShape h.val) phi 1 (JointPopulation.shapeSide 1 u) + + physicalPotential positiveInitial tableP (initialShape h.val) phi 2 (JointPopulation.shapeSide 2 u) - + splitLogNormalizer positiveInitial tableP (initialShape h.val) := by + obtain ⟨b, rfl⟩ := placedLaw_positive_has_branch (Work.stageA h, phi) u hu + exact placedLaw_stageA_branch_log h phi b + +theorem placedLaw_stageB_log {K : ℕ} (h : APositive K) (phi : Placement) + (u : JointPopulation.Shape) (hu : 0 < (placedLaw (Work.stageB h, phi)).mass u) : + Real.log ((placedLaw (Work.stageB h, phi)).mass u) = + physicalPotential positiveSecond tablep (aShape h.val) phi 0 (JointPopulation.shapeSide 0 u) + + physicalPotential positiveSecond tablep (aShape h.val) phi 1 (JointPopulation.shapeSide 1 u) + + physicalPotential positiveSecond tablep (aShape h.val) phi 2 (JointPopulation.shapeSide 2 u) - + splitLogNormalizer positiveSecond tablep (aShape h.val) := by + obtain ⟨b, rfl⟩ := placedLaw_positive_has_branch (Work.stageB h, phi) u hu + exact placedLaw_stageB_branch_log h phi b + +theorem mem_shapes_of_total (u : Shape) (n : ℕ) + (h : shapeTotal u = n) : u ∈ shapes n := by + dsimp [shapeTotal] at h + simp only [shapes, List.mem_flatMap, List.mem_map, List.mem_range] + refine ⟨u 0, by omega, u 1, by omega, ?_⟩ + funext i + fin_cases i + · rfl + · rfl + · change n - u 0 - u 1 = u 2 + omega + +theorem mem_below_iff (s u : Shape) : + u ∈ below s ↔ shapeTotal u = shapeTotal s / 2 ∧ ∀ i, u i ≤ s i := by + constructor + · intro hu + exact ⟨below_total hu, below_le hu⟩ + · rintro ⟨ht, hle⟩ + apply List.mem_filter.mpr + refine ⟨mem_shapes_of_total u _ ht, ?_⟩ + simpa only [Bool.and_eq_true, decide_eq_true_eq, and_assoc] using + And.intro (hle 0) (And.intro (hle 1) (hle 2)) + +theorem splitShape_exhaustive {K : ℕ} (w : Work K) + (u : Shape) (hu : u ∈ below w.parentShape) : + ∃ b : w.Branch, w.splitShape b = u := by + cases w with + | stageA h => + change u ∈ below (initialShape h.val) at hu + obtain ⟨b, hb⟩ := List.mem_iff_get.mp hu + exact ⟨b, hb⟩ + | stageB h => + change u ∈ below (aShape h.val) at hu + obtain ⟨b, hb⟩ := List.mem_iff_get.mp hu + exact ⟨b, hb⟩ + | stageC h => + exact stageCAtom_exhaustive _ (bShape_size h.1.val) h.1.property u hu + +theorem branchShape_exhaustive {K : ℕ} (w : PlacedWork K) + (u : JointPopulation.Shape) + (ht : u.1.val + u.2.1.val + u.2.2.val = 2 * w.1.halfLength) + (hle : ∀ i, (JointPopulation.shapeSide i u).val ≤ + physicalShape w.2 w.1.parentShape i) : + ∃ b : w.1.Branch, branchShape w b = u := by + let v : Shape := physicalShape w.2.symm (decodeShape u) + have hvt : shapeTotal v = 2 * w.1.halfLength := by + dsimp [v] + rw [physicalShape_total] + exact ht + have hvl : ∀ i, v i ≤ w.1.parentShape i := by + intro i + simpa only [v, physicalShape, decodeShape, Equiv.symm_symm, + Equiv.symm_apply_apply] using hle (w.2 i) + have hv : v ∈ below w.1.parentShape := by + apply (mem_below_iff _ _).2 + refine ⟨?_, hvl⟩ + rw [hvt, (w.1.parentShape_spec).2] + omega + obtain ⟨b, hb⟩ := splitShape_exhaustive w.1 v hv + refine ⟨b, ?_⟩ + have hd : decodeShape (branchShape w b) = decodeShape u := by + rw [branchShape, decode_encodePhysicalShape, hb] + funext i + simp only [v, physicalShape, Equiv.symm_symm, Equiv.apply_symm_apply] + apply Prod.ext + · exact Fin.ext (congrFun hd 0) + · apply Prod.ext + · exact Fin.ext (congrFun hd 1) + · exact Fin.ext (congrFun hd 2) + +theorem placedLaw_stageA_positive {K : ℕ} (h : InitialPositive K) (phi : Placement) + (u : JointPopulation.Shape) (ht : u.1.val + u.2.1.val + u.2.2.val = 8) + (hle : ∀ i, (JointPopulation.shapeSide i u).val ≤ + physicalShape phi (initialShape h.val) i) : + 0 < (placedLaw (Work.stageA h, phi)).mass u := by + obtain ⟨b, rfl⟩ := branchShape_exhaustive (Work.stageA h, phi) u ht hle + rw [placedLaw_mass_branch] + exact_mod_cast stageALaw_positive (initialShape h.val) (aSplit ⟨h, b, false⟩) + (aSplit_mem ⟨h, b, false⟩) + +theorem placedLaw_stageB_positive {K : ℕ} (h : APositive K) (phi : Placement) + (u : JointPopulation.Shape) (ht : u.1.val + u.2.1.val + u.2.2.val = 4) + (hle : ∀ i, (JointPopulation.shapeSide i u).val ≤ + physicalShape phi (aShape h.val) i) : + 0 < (placedLaw (Work.stageB h, phi)).mass u := by + obtain ⟨b, rfl⟩ := branchShape_exhaustive (Work.stageB h, phi) u ht hle + rw [placedLaw_mass_branch] + exact_mod_cast stageBLaw_positive (aShape h.val) (bSplit ⟨h, b, false⟩) + (bSplit_mem ⟨h, b, false⟩) + +end MatrixMultiplication.AllFieldActiveGibbs + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldConstruction/ActiveLaws.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldConstruction/ActiveLaws.lean new file mode 100644 index 0000000000000000000000000000000000000000..1f69e1388f249bcf5e7f9516a085664c5a9484aa --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldConstruction/ActiveLaws.lean @@ -0,0 +1,235 @@ +import OAI.LinearAlgebra.MatrixMultiplication.FieldHistory.Counts +import OAI.LinearAlgebra.MatrixMultiplication.FieldHistory.Priority +import OAI.LinearAlgebra.MatrixMultiplication.FieldHistory.Bounds +import OAI.LinearAlgebra.MatrixMultiplication.JointExtraction.PopulationRates + +namespace OAI + +/-! Tensor extraction over arbitrary fields and its asymptotic rate. -/ + +noncomputable section + +namespace MatrixMultiplication.AllFieldActiveLaws + +open AllFieldParameters AllFieldHistory MatrixMultiplication.Foundation Filter +open scoped BigOperators Topology +attribute [local instance] Classical.propDecidable Classical.decEq + +def branchProbability {K : ℕ} (w : Work K) (b : w.Branch) : ℚ := + match w with + | .stageA h => stageALaw (initialShape h.val) (aSplit ⟨h, b, false⟩) + | .stageB h => stageBLaw (aShape h.val) (bSplit ⟨h, b, false⟩) + | .stageC h => stageCWeight (cParameterParent h) (cShapeParent h) b + +theorem branchProbability_nonneg {K : ℕ} (w : Work K) (b : w.Branch) : + 0 ≤ branchProbability w b := by + cases w with + | stageA h => exact (stageALaw_positive _ _ (aSplit_mem ⟨h, b, false⟩)).le + | stageB h => exact (stageBLaw_positive _ _ (bSplit_mem ⟨h, b, false⟩)).le + | stageC h => exact stageCWeight_nonnegative _ _ b + +theorem branchProbability_total {K : ℕ} (w : Work K) : + ∑ b : w.Branch, branchProbability w b = 1 := by + cases w with + | stageA h => + change (∑ b : ASplit h, + stageALaw (initialShape h.val) (below (initialShape h.val))[b.val]) = 1 + rw [Fin.sum_univ_fun_getElem] + exact stageALaw_normalized _ h.property + | stageB h => + change (∑ b : BSplit h, + stageBLaw (aShape h.val) (below (aShape h.val))[b.val]) = 1 + rw [Fin.sum_univ_fun_getElem] + exact stageBLaw_normalized _ h.property + | stageC h => exact stageCWeight_normalized _ _ + +def branchLaw {K : ℕ} (w : Work K) : FiniteLaw w.Branch where + mass b := (branchProbability w b : ℝ) + nonneg b := by exact_mod_cast branchProbability_nonneg w b + total := by exact_mod_cast branchProbability_total w + +@[simp] theorem branchLaw_mass {K : ℕ} (w : Work K) (b : w.Branch) : + (branchLaw w).mass b = (branchProbability w b : ℝ) := rfl + +def placedLaw {K : ℕ} (w : PlacedWork K) : FiniteLaw JointPopulation.Shape := + (branchLaw w.1).map (branchShape w) + +@[simp] theorem placedLaw_mass {K : ℕ} (w : PlacedWork K) + (u : JointPopulation.Shape) : + (placedLaw w).mass u = + ∑ b : w.1.Branch, if branchShape w b = u then + (branchProbability w.1 b : ℝ) else 0 := by + simp only [placedLaw, FiniteLaw.map_mass, branchLaw_mass] + +theorem placedLaw_mass_branch {K : ℕ} (w : PlacedWork K) (b : w.1.Branch) : + (placedLaw w).mass (branchShape w b) = (branchProbability w.1 b : ℝ) := + FiniteLaw.map_mass_apply _ _ (branchShape_injective w) b + +theorem placedLaw_entropy {K : ℕ} (w : PlacedWork K) : + finiteEntropy (placedLaw w).mass = finiteEntropy (branchLaw w.1).mass := + FiniteLaw.map_entropy_of_injective _ _ (branchShape_injective w) + +theorem placedLaw_sideMass {K : ℕ} (w : PlacedWork K) (s : Fin 3) + (k : Fin 17) : + JointPopulationRates.sideMass (placedLaw w).mass s k = + ∑ b : w.1.Branch, if JointPopulation.shapeSide s (branchShape w b) = k + then (branchProbability w.1 b : ℝ) else 0 := by + unfold JointPopulationRates.sideMass + simp only [placedLaw_mass] + calc + _ = ∑ u : JointPopulation.Shape, ∑ b : w.1.Branch, + if branchShape w b = u then + if JointPopulation.shapeSide s u = k then (branchProbability w.1 b : ℝ) else 0 + else 0 := by + apply Finset.sum_congr rfl + intro u _ + by_cases hu : JointPopulation.shapeSide s u = k <;> simp [hu] + _ = _ := by rw [Finset.sum_comm]; simp + +theorem branchPopulation_cast_rat {K : ℕ} (allocation : Allocation) (dilation : ℕ) + (w : PlacedWork K) (b : w.1.Branch) : + (branchPopulation allocation dilation w b : ℚ) = + (population allocation dilation (w.1.source, w.2) : ℚ) * + branchProbability w.1 b := by + rcases w with ⟨w, phi⟩ + cases w <;> + simp only [branchPopulation, Work.child, Work.source, population_cast, + amount, canonicalAmount, aAmount, bAmount, cAmount, branchProbability] <;> ring + +theorem branchPopulation_cast {K : ℕ} (allocation : Allocation) (dilation : ℕ) + (w : PlacedWork K) (b : w.1.Branch) : + (branchPopulation allocation dilation w b : ℝ) = + (population allocation dilation (w.1.source, w.2) : ℝ) * + (branchLaw w.1).mass b := by + rw [branchLaw_mass] + exact_mod_cast branchPopulation_cast_rat allocation dilation w b + +theorem jointCounts_cast {K : ℕ} (allocation : Allocation) (dilation : ℕ) + (w : PlacedWork K) (u : JointPopulation.Shape) : + (jointCounts allocation dilation w u : ℝ) = + (population allocation dilation (w.1.source, w.2) : ℝ) * + (placedLaw w).mass u := by + simp only [jointCounts, shapeCounts, Nat.cast_sum, placedLaw_mass, Finset.mul_sum] + apply Finset.sum_congr rfl + intro b _ + by_cases hb : branchShape w b = u + · simp only [hb, ite_true, branchPopulation_cast, branchLaw_mass] + · simp [hb] + +theorem jointCounts_ratio {K dilation : ℕ} (allocation : Allocation) + (hd : 0 < dilation) (w : PlacedWork K) (u : JointPopulation.Shape) : + (jointCounts allocation dilation w u : ℝ) / + population allocation dilation (w.1.source, w.2) = (placedLaw w).mass u := by + rw [jointCounts_cast] + have hp : (population allocation dilation (w.1.source, w.2) : ℝ) ≠ 0 := by + exact_mod_cast Nat.ne_of_gt (work_source_population_pos allocation hd w) + exact mul_div_cancel_left₀ _ hp + +theorem jointCounts_normalized {K dilation : ℕ} (allocation : Allocation) + (hd : 0 < dilation) (w : PlacedWork K) : + (∑ u, (jointCounts allocation dilation w u : ℝ) / + population allocation dilation (w.1.source, w.2)) = 1 := by + simp only [jointCounts_ratio allocation hd] + exact (placedLaw w).total + +theorem population_cast_real {K : ℕ} (allocation : Allocation) (dilation : ℕ) + (h : History K) : + (population allocation dilation h : ℝ) = + (populationLength (K := K) allocation dilation : ℝ) * (amount allocation h : ℝ) := by + exact_mod_cast population_cast allocation dilation h + +theorem jointCounts_source_cast {K : ℕ} (allocation : Allocation) (dilation : ℕ) + (w : PlacedWork K) (u : JointPopulation.Shape) : + (jointCounts allocation dilation w u : ℝ) = + (populationLength (K := K) allocation dilation : ℝ) * + ((amount allocation (w.1.source, w.2) : ℝ) * (placedLaw w).mass u) := by + rw [jointCounts_cast, population_cast_real, mul_assoc] + +theorem jointCounts_source_ratio {K dilation : ℕ} (allocation : Allocation) + (hd : 0 < dilation) (w : PlacedWork K) (u : JointPopulation.Shape) : + (jointCounts allocation dilation w u : ℝ) / + populationLength (K := K) allocation dilation = + (amount allocation (w.1.source, w.2) : ℝ) * (placedLaw w).mass u := by + rw [jointCounts_source_cast] + have hp : (populationLength (K := K) allocation dilation : ℝ) ≠ 0 := by + exact_mod_cast Nat.ne_of_gt + (AllFieldPopulationCounts.blockLength_pos (amount (K := K) allocation) hd) + exact mul_div_cancel_left₀ _ hp + +theorem jointCounts_source_rate {K : ℕ} (allocation : Allocation) + (w : PlacedWork K) (u : JointPopulation.Shape) : + Tendsto (fun dilation : ℕ => (jointCounts allocation dilation w u : ℝ) / + populationLength (K := K) allocation dilation) atTop + (𝓝 ((amount allocation (w.1.source, w.2) : ℝ) * (placedLaw w).mass u)) := by + apply tendsto_const_nhds.congr' + filter_upwards [eventually_gt_atTop (0 : ℕ)] with dilation hd + exact (jointCounts_source_ratio allocation hd w u).symm + +theorem populationLength_dilation {K : ℕ} (allocation : Allocation) (dilation : ℕ) : + populationLength (K := K) allocation dilation = + dilation * populationLength (K := K) allocation 1 := by + simp only [populationLength, AllFieldPopulationCounts.blockLength, one_mul] + +theorem jointCounts_dilation_ratio {K dilation : ℕ} (allocation : Allocation) + (hd : 0 < dilation) (w : PlacedWork K) (u : JointPopulation.Shape) : + (jointCounts allocation dilation w u : ℝ) / (dilation : ℝ) = + ((populationLength (K := K) allocation 1 : ℝ) * + (amount allocation (w.1.source, w.2) : ℝ)) * (placedLaw w).mass u := by + rw [jointCounts_source_cast, populationLength_dilation, Nat.cast_mul] + have hd' : (dilation : ℝ) ≠ 0 := Nat.cast_ne_zero.mpr (Nat.ne_of_gt hd) + field_simp [hd'] + +theorem jointCounts_dilation_rate {K : ℕ} (allocation : Allocation) + (w : PlacedWork K) (u : JointPopulation.Shape) : + Tendsto (fun dilation : ℕ => (jointCounts allocation dilation w u : ℝ) / + (dilation : ℝ)) atTop + (𝓝 (((populationLength (K := K) allocation 1 : ℝ) * + (amount allocation (w.1.source, w.2) : ℝ)) * (placedLaw w).mass u)) := by + apply tendsto_const_nhds.congr' + filter_upwards [eventually_gt_atTop (0 : ℕ)] with dilation hd + exact (jointCounts_dilation_ratio allocation hd w u).symm + +def orderLaw {K tick : ℕ} {sigma : Placement} (h : ActiveOrder K tick sigma) : + FiniteLaw JointPopulation.Shape := placedLaw h.val.val + +def orderMass {K tick : ℕ} {sigma : Placement} (allocation : Allocation) + (h : ActiveOrder K tick sigma) : ℝ := + amount allocation (h.val.val.1.source, h.val.val.2) + +def orderCounts {K tick : ℕ} {sigma : Placement} (allocation : Allocation) + (dilation : ℕ) (h : ActiveOrder K tick sigma) : JointPopulation.Shape → ℕ := + activeCounts allocation dilation h.val + +theorem orderMass_nonneg {K tick : ℕ} {sigma : Placement} (allocation : Allocation) + (h : ActiveOrder K tick sigma) : 0 ≤ orderMass allocation h := by + unfold orderMass + exact_mod_cast amount_nonneg allocation (h.val.val.1.source, h.val.val.2) + +theorem orderCounts_source_cast {K tick : ℕ} {sigma : Placement} + (allocation : Allocation) (dilation : ℕ) (h : ActiveOrder K tick sigma) + (u : JointPopulation.Shape) : + (orderCounts allocation dilation h u : ℝ) = + (populationLength (K := K) allocation dilation : ℝ) * + (orderMass allocation h * (orderLaw h).mass u) := + jointCounts_source_cast allocation dilation h.val.val u + +theorem orderCounts_source_rate {K tick : ℕ} {sigma : Placement} + (allocation : Allocation) (h : ActiveOrder K tick sigma) (u : JointPopulation.Shape) : + Tendsto (fun dilation : ℕ => (orderCounts allocation dilation h u : ℝ) / + populationLength (K := K) allocation dilation) atTop + (𝓝 (orderMass allocation h * (orderLaw h).mass u)) := + jointCounts_source_rate allocation h.val.val u + +theorem orderCounts_dilation_rate {K tick : ℕ} {sigma : Placement} + (allocation : Allocation) (h : ActiveOrder K tick sigma) (u : JointPopulation.Shape) : + Tendsto (fun dilation : ℕ => (orderCounts allocation dilation h u : ℝ) / + (dilation : ℝ)) atTop + (𝓝 (((populationLength (K := K) allocation 1 : ℝ) * orderMass allocation h) * + (orderLaw h).mass u)) := + jointCounts_dilation_rate allocation h.val.val u + +end MatrixMultiplication.AllFieldActiveLaws + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldConstruction/ActiveSums.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldConstruction/ActiveSums.lean new file mode 100644 index 0000000000000000000000000000000000000000..3fdcadf15cd1de9ba2915ab4049f7b29e2c06b7e --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldConstruction/ActiveSums.lean @@ -0,0 +1,205 @@ +import OAI.LinearAlgebra.MatrixMultiplication.FieldHistory.Priority +import OAI.LinearAlgebra.MatrixMultiplication.FieldHistory.Sums + +namespace OAI + +/-! Tensor extraction over arbitrary fields and its asymptotic rate. -/ + +noncomputable section + +namespace MatrixMultiplication.AllFieldHistory + +open AllFieldParameters +open scoped BigOperators +attribute [local instance] Classical.propDecidable Classical.decEq + +private def aRelot {K L : ℕ} (lot : Fin L) (h : AfterA K) : AfterA L := + ⟨⟨(lot, h.1.val.2), h.1.property⟩, h.2⟩ + +private def bRelot {K L : ℕ} (lot : Fin L) (h : AfterB K) : AfterB L := + ⟨⟨aRelot lot h.1.val, h.1.property⟩, h.2⟩ + +private def partRelot {K L : ℕ} (lot : Fin L) (h : PartC K) : PartC L := + (⟨bRelot lot h.1.val, h.1.property⟩, h.2) + +def workRelot {K L : ℕ} (lot : Fin L) : Work K → Work L + | .stageA h => .stageA ⟨(lot, h.val.2), h.property⟩ + | .stageB h => .stageB ⟨aRelot lot h.val, h.property⟩ + | .stageC h => .stageC (partRelot lot h) + +@[simp] theorem workRelot_lot {K L : ℕ} (lot : Fin L) (w : Work K) : + (workRelot lot w).lot = lot := by cases w <;> rfl + +@[simp] theorem workRelot_stage {K L : ℕ} (lot : Fin L) (w : Work K) : + (workRelot lot w).stage = w.stage := by cases w <;> rfl + +@[simp] theorem workRelot_self {K : ℕ} (w : Work K) : workRelot w.lot w = w := by + cases w <;> rfl + +@[simp] theorem workRelot_relot {K L M : ℕ} (first : Fin L) (last : Fin M) + (w : Work K) : workRelot last (workRelot first w) = workRelot last w := by + cases w <;> rfl + +@[simp] theorem workAmount_relot {K L : ℕ} (allocation : Allocation) + (lot : Fin L) (w : Work K) : + workAmount allocation (workRelot lot w) = workAmount allocation w := by + cases w <;> rfl + +def workLotEquiv (K : ℕ) : Work K ≃ Fin K × Work 1 where + toFun w := (w.lot, workRelot 0 w) + invFun h := workRelot h.1 h.2 + left_inv w := by simp only [workRelot_relot, workRelot_self] + right_inv h := by + rcases h with ⟨lot, w⟩ + apply Prod.ext + · exact workRelot_lot lot w + · simp only [workRelot_relot] + have hzero : (0 : Fin 1) = w.lot := Subsingleton.elim _ _ + rw [hzero, workRelot_self] + +@[simp] theorem workLotEquiv_symm_apply (K : ℕ) (lot : Fin K) (w : Work 1) : + (workLotEquiv K).symm (lot, w) = workRelot lot w := rfl + +private def workStagesEquiv (K : ℕ) : + Work K ≃ InitialPositive K ⊕ APositive K ⊕ PartC K where + toFun + | .stageA h => .inl h + | .stageB h => .inr (.inl h) + | .stageC h => .inr (.inr h) + invFun + | .inl h => .stageA h + | .inr (.inl h) => .stageB h + | .inr (.inr h) => .stageC h + left_inv w := by cases w <;> rfl + right_inv h := by rcases h with h | h | h <;> rfl + +private theorem work_sum {K : ℕ} (f : Work K → ℝ) : + (∑ w, f w) = (∑ h : InitialPositive K, f (.stageA h)) + + (∑ h : APositive K, f (.stageB h)) + (∑ h : PartC K, f (.stageC h)) := by + calc + _ = ∑ h : InitialPositive K ⊕ APositive K ⊕ PartC K, + f ((workStagesEquiv K).symm h) := + ((workStagesEquiv K).symm.sum_comp f).symm + _ = _ := by + simp only [Fintype.sum_sum_type] + exact (add_assoc _ _ _).symm + +theorem sum_lot_tick (K tick : ℕ) (stage : Fin 3) (value : ℝ) : + (∑ lot : Fin K, if FiniteSchedule.lotTick lot stage = tick then value else 0) = + if FiniteSchedule.stageActive K tick stage then value else 0 := by + by_cases active : FiniteSchedule.stageActive K tick stage + · obtain ⟨lot, hlot, unique⟩ := + (FiniteSchedule.stageActive_iff_unique_lot K tick stage).mp active + have he (j : Fin K) : FiniteSchedule.lotTick j stage = tick ↔ j = lot := + ⟨unique j, fun h => by simpa only [h] using hlot⟩ + simp only [he, ite_eq_left active] + simp + · have hn (lot : Fin K) : FiniteSchedule.lotTick lot stage ≠ tick := by + intro h + exact active (h ▸ FiniteSchedule.lot_active_at_its_tick lot stage) + simp only [hn, ite_eq_right active, ite_false, Finset.sum_const_zero] + +def shapeValue {K : ℕ} (fA fB : Shape → ℝ) + (fC : Shape → Shape → Fin 3 → ℝ) : Work K → ℝ + | .stageA h => fA (initialShape h.val) + | .stageB h => fB (aShape h.val) + | .stageC h => fC (cParameterParent h) (cShapeParent h) h.2 + +@[simp] theorem shapeValue_relot {K L : ℕ} (fA fB : Shape → ℝ) + (fC : Shape → Shape → Fin 3 → ℝ) (lot : Fin L) (w : Work K) : + shapeValue fA fB fC (workRelot lot w) = shapeValue fA fB fC w := by + cases w <;> rfl + +def stageASourceSum (fA : Shape → ℝ) : ℝ := + (positiveInitial.map (fun g => (initialLaw g : ℝ) * fA g)).sum + +def stageBSourceSum (fB : Shape → ℝ) : ℝ := + (positiveSecond.map (fun t => (secondMass t : ℝ) * fB t)).sum + +def stageCSourceSum (allocation : Allocation) (fC : Shape → Shape → Fin 3 → ℝ) : ℝ := + (positiveSecond.map (fun t => (((below t).filter positive).map (fun u => + (littleMass t u : ℝ) * ∑ part : Fin 3, (allocation.mass part : ℝ) * fC t u part)).sum)).sum + +theorem stageA_one_lot_sum (fA : Shape → ℝ) : + (∑ h : InitialPositive 1, (initialAmount h.val : ℝ) * fA (initialShape h.val)) = + stageASourceSum fA := by + simpa only [Nat.cast_one, one_mul, initialAmount, stageASourceSum] using + initial_positive_sum 1 (fun g => (initialLaw g : ℝ) * fA g) + +theorem stageB_one_lot_sum (fB : Shape → ℝ) : + (∑ h : APositive 1, (aAmount h.val : ℝ) * fB (aShape h.val)) = + stageBSourceSum fB := by + simpa only [Nat.cast_one, one_mul, stageBSourceSum] using a_positive_history_sum 1 fB + +theorem stageC_one_lot_sum (allocation : Allocation) (fC : Shape → Shape → Fin 3 → ℝ) : + (∑ h : PartC 1, (partAmount allocation h : ℝ) * + fC (cParameterParent h) (cShapeParent h) h.2) = stageCSourceSum allocation fC := by + simp only [Fintype.sum_prod_type, partAmount, Rat.cast_mul, + cParameterParent, cShapeParent, mul_assoc, ← Finset.mul_sum] + simpa only [Nat.cast_one, one_mul, stageCSourceSum] using + b_positive_history_sum 1 (fun t u => ∑ part : Fin 3, + (allocation.mass part : ℝ) * fC t u part) + +private theorem subtype_sum_indicator {A : Type*} [Fintype A] + (P : A → Prop) [DecidablePred P] [Fintype {a // P a}] (f : A → ℝ) : + (∑ a : {a // P a}, f a.val) = ∑ a, if P a then f a else 0 := by + rw [← Finset.sum_filter] + exact (Finset.sum_subtype _ (by simp) f).symm + +theorem active_shape_sum (K tick : ℕ) (allocation : Allocation) + (fA fB : Shape → ℝ) (fC : Shape → Shape → Fin 3 → ℝ) : + (∑ w : CanonicalActive K tick, + workAmount allocation w.val * shapeValue fA fB fC w.val) = + (if FiniteSchedule.stageActive K tick 0 then stageASourceSum fA else 0) + + (if FiniteSchedule.stageActive K tick 1 then stageBSourceSum fB else 0) + + (if FiniteSchedule.stageActive K tick 2 then stageCSourceSum allocation fC else 0) := by + rw [subtype_sum_indicator + (fun w : Work K => FiniteSchedule.lotTick w.lot w.stage = tick) + (fun w => workAmount allocation w * shapeValue fA fB fC w)] + rw [← (workLotEquiv K).symm.sum_comp + (fun w => if FiniteSchedule.lotTick w.lot w.stage = tick then + workAmount allocation w * shapeValue fA fB fC w else 0)] + simp only [Fintype.sum_prod_type, workLotEquiv_symm_apply, workRelot_lot, + workRelot_stage, workAmount_relot, shapeValue_relot] + rw [Finset.sum_comm] + simp only [sum_lot_tick] + rw [work_sum] + change + (∑ h : InitialPositive 1, if FiniteSchedule.stageActive K tick 0 then + (initialAmount h.val : ℝ) * fA (initialShape h.val) else 0) + + (∑ h : APositive 1, if FiniteSchedule.stageActive K tick 1 then + (aAmount h.val : ℝ) * fB (aShape h.val) else 0) + + (∑ h : PartC 1, if FiniteSchedule.stageActive K tick 2 then + (partAmount allocation h : ℝ) * fC (cParameterParent h) (cShapeParent h) h.2 else 0) = _ + simp only [Finset.sum_ite_irrel, Finset.sum_const_zero] + rw [stageA_one_lot_sum, stageB_one_lot_sum, stageC_one_lot_sum] + +def shapeCapacity {K : ℕ} (fA fB : Shape → Staggering.Capacity) + (fC : Shape → Shape → Fin 3 → Staggering.Capacity) (w : Work K) : Staggering.Capacity := + fun i => shapeValue (fun g => fA g i) (fun t => fB t i) (fun t u part => fC t u part i) w + +def stageASourceCapacity (fA : Shape → Staggering.Capacity) : Staggering.Capacity := + fun i => stageASourceSum (fun g => fA g i) + +def stageBSourceCapacity (fB : Shape → Staggering.Capacity) : Staggering.Capacity := + fun i => stageBSourceSum (fun t => fB t i) + +def stageCSourceCapacity (allocation : Allocation) + (fC : Shape → Shape → Fin 3 → Staggering.Capacity) : Staggering.Capacity := + fun i => stageCSourceSum allocation (fun t u part => fC t u part i) + +theorem activeAggregateCapacity_shapeCapacity (K tick : ℕ) (allocation : Allocation) + (fA fB : Shape → Staggering.Capacity) + (fC : Shape → Shape → Fin 3 → Staggering.Capacity) : + activeAggregateCapacity allocation tick (shapeCapacity (K := K) fA fB fC) = + FiniteSchedule.tickCapacity K (stageASourceCapacity fA) (stageBSourceCapacity fB) + (stageCSourceCapacity allocation fC) tick := by + funext i + exact active_shape_sum K tick allocation (fun g => fA g i) (fun t => fB t i) + (fun t u part => fC t u part i) + +end MatrixMultiplication.AllFieldHistory + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldConstruction/ComplementSums.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldConstruction/ComplementSums.lean new file mode 100644 index 0000000000000000000000000000000000000000..cd6b5998133857930140544e065ce05ee4ae3769 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldConstruction/ComplementSums.lean @@ -0,0 +1,77 @@ +import OAI.LinearAlgebra.MatrixMultiplication.FieldParameters.Traversal +import Mathlib.Data.List.Nodup + +namespace OAI + +/-! Tensor extraction over arbitrary fields and its asymptotic rate. -/ + +noncomputable section + +namespace MatrixMultiplication.AllFieldParameters + +theorem list_map_involution_perm {α : Type*} (xs : List α) (f : α → α) + (hn : xs.Nodup) (hm : ∀ x ∈ xs, f x ∈ xs) + (hi : ∀ x ∈ xs, f (f x) = x) : (xs.map f).Perm xs := by + have hinj : ∀ x ∈ xs, ∀ y ∈ xs, f x = f y → x = y := by + intro x hx y hy hxy + simpa only [hi x hx, hi y hy] using congrArg f hxy + apply (List.perm_ext_iff_of_nodup (List.Nodup.map_on hinj hn) hn).2 + intro y + constructor + · intro hy + obtain ⟨x, hx, rfl⟩ := List.mem_map.mp hy + exact hm x hx + · intro hy + exact List.mem_map.mpr ⟨f y, hm y hy, hi y hy⟩ + +theorem list_weighted_involution_sum {α : Type*} (xs : List α) (f : α → α) + (hn : xs.Nodup) (hm : ∀ x ∈ xs, f x ∈ xs) + (hi : ∀ x ∈ xs, f (f x) = x) (w h : α → ℝ) + (hw : ∀ x ∈ xs, w (f x) = w x) : + (xs.map (fun x => w x * h (f x))).sum = + (xs.map (fun x => w x * h x)).sum := by + calc + _ = ((xs.map f).map (fun x => w x * h x)).sum := by + congr 1 + rw [List.map_map] + apply List.map_congr_left + intro x hx + simp only [Function.comp_apply, hw x hx] + _ = _ := ((list_map_involution_perm xs f hn hm hi).map _).sum_eq + +theorem complement_involution_of_le (s u : Shape) (hu : ∀ i, u i ≤ s i) : + complement s (complement s u) = u := by + funext i + exact Nat.sub_sub_self (hu i) + +theorem stageA_complement_sum (s : Shape) (hs : s ∈ positiveInitial) + (h : Shape → ℝ) : + ((below s).map (fun u => (stageALaw s u : ℝ) * h (complement s u))).sum = + ((below s).map (fun u => (stageALaw s u : ℝ) * h u)).sum := by + apply list_weighted_involution_sum (below s) (complement s) + (stageA_children_nodup s hs) + · intro u hu + exact (stageA_support_complement s hs u hu).1 + · intro u hu + exact complement_involution_of_le s u (stageA_support_complement s hs u hu).2 + · intro u hu + rw [stageALaw_complement s u hs hu] + +theorem stageB_complement_sum (s : Shape) (hs : s ∈ positiveSecond) + (h : Shape → ℝ) : + ((below s).map (fun u => (stageBLaw s u : ℝ) * h (complement s u))).sum = + ((below s).map (fun u => (stageBLaw s u : ℝ) * h u)).sum := by + apply list_weighted_involution_sum (below s) (complement s) + (stageB_children_nodup s hs) + · intro u hu + exact (stageB_support_complement s hs u hu).1 + · intro u hu + exact complement_involution_of_le s u (stageB_support_complement s hs u hu).2 + · intro u hu + rw [stageBLaw_complement s u hs hu] + +end MatrixMultiplication.AllFieldParameters + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldConstruction/Conditional.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldConstruction/Conditional.lean new file mode 100644 index 0000000000000000000000000000000000000000..a9728ba91df4629f1f6352cc2dfc197a0d8d43d1 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldConstruction/Conditional.lean @@ -0,0 +1,45 @@ +import OAI.LinearAlgebra.MatrixMultiplication.FieldConstruction.OrderedLimits + +namespace OAI + +/-! Tensor extraction over arbitrary fields and its asymptotic rate. -/ + +namespace MatrixMultiplication.AllFieldConditional + +open AllFieldNativeCapacity + +structure NumericalConditions : Prop where + + denominator_gap : nativeB < nativeHigh + + stageA_positive : ∀ i : Fin 3, 0 < nativeLA i + + stageB_positive : ∀ i : Fin 3, 0 < nativeLB i + + stageC_positive : ∀ i : Fin 3, + 0 < nativeCstar - (nativeLA i + nativeLB i) + + stageC_feasible : ∀ i : Fin 3, + nativeCstar - (nativeLA i + nativeLB i) < nativeHigh + + volume_positive : 0 < AllFieldTerminalRates.S + + strict_rate_bound : + 3 * (8 * Real.log 7 - + (AllFieldInitialEntropy.nativeH0 + nativeCstar)) / AllFieldTerminalRates.S < + (2371054887 : ℝ) / 10 ^ 9 + +theorem omega_lt_2371054887_div_1000000000_of_numerical_conditions + (F : Type*) [Field F] (h : NumericalConditions) : + Arithmetic.omega F < (2371054887 : ℝ) / 10 ^ 9 := by + have hc (i : Fin 3) : 0 < nativeLC nativeLambda i := by + rw [nativeLC_balanced h.denominator_gap i] + exact h.stageC_positive i + have hbound := AllFieldOrderedLimits.omega_le_native_ratio F + h.denominator_gap h.stageC_feasible + h.stageA_positive h.stageB_positive hc h.volume_positive + exact lt_of_le_of_lt hbound h.strict_rate_bound + +end MatrixMultiplication.AllFieldConditional + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldConstruction/ConstructionData.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldConstruction/ConstructionData.lean new file mode 100644 index 0000000000000000000000000000000000000000..964f5ad43b062060a496d1186ada64336e277a2f --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldConstruction/ConstructionData.lean @@ -0,0 +1,131 @@ +import OAI.LinearAlgebra.MatrixMultiplication.FieldConstruction.InitialChoice +import OAI.LinearAlgebra.MatrixMultiplication.FieldHistory.Iteration +import OAI.LinearAlgebra.MatrixMultiplication.FieldConstruction.FinishedWitness +import OAI.LinearAlgebra.MatrixMultiplication.FieldConstruction.ConstructionRates + +namespace OAI + +/-! Tensor extraction over arbitrary fields and its asymptotic rate. -/ + +noncomputable section + +namespace MatrixMultiplication.AllFieldConstructionData + +open MatrixMultiplication.Foundation AllFieldHistory AllFieldFiniteFamily +open scoped BigOperators Classical +attribute [local instance] Classical.propDecidable Classical.decEq + +variable {K : ℕ} + +structure Data (allocation : Allocation) (dilation : ℕ) (width slack : ℝ) where + initial : AllFieldInitialChoice.Choice (K := K) allocation dilation slack + groups : AllFieldHistoryIteration.ScheduleChoices + (K := K) allocation dilation width slack + threshold : ∀ t : Fin (K + 2), + AllFieldHistoryRecovery.minimumDilation (K := K) (tick := t.val) allocation width ≤ dilation + +variable (allocation : Allocation) (dilation : ℕ) (width slack : ℝ) + +abbrev Tags (data : Data (K := K) allocation dilation width slack) := + AllFieldHistoryIteration.Tags allocation dilation width slack + (AllFieldInitialChoice.Tags allocation dilation slack data.initial) data.groups + +instance tagsFintype (data : Data (K := K) allocation dilation width slack) : + Fintype (Tags allocation dilation width slack data) := inferInstance + +def execution (F : Type*) [Field F] (hwidth : 0 < width) + (data : Data (K := K) allocation dilation width slack) : + Execution (cwSource F K (populationLength (K := K) allocation dilation)) + (Tensor.directSum (fun _ : Tags allocation dilation width slack data => + stateTensor F (K := K) allocation dilation width (K + 2))) := + AllFieldHistoryIteration.execution allocation dilation width slack F hwidth + data.threshold data.groups + (AllFieldInitialChoice.execution allocation dilation slack data.initial F width) + +theorem card_tags (data : Data (K := K) allocation dilation width slack) : + Fintype.card (Tags allocation dilation width slack data) = + Fintype.card (AllFieldConstructionRates.SelectedLabels + (K := K) allocation slack dilation) := by + rw [AllFieldHistoryIteration.card_tags, AllFieldInitialChoice.card_tags, + AllFieldConstructionRates.card_selected] + congr 1 + apply Finset.prod_congr rfl + intro t _ + apply Finset.prod_congr rfl + intro sigma _ + exact (AllFieldConstructionRates.groupCount_eq_native allocation slack dilation t sigma).symm + +theorem execution_copies (F : Type*) [Field F] (hwidth : 0 < width) + (data : Data (K := K) allocation dilation width slack) : + Fintype.card (execution allocation dilation width slack F hwidth data).Copies = + Fintype.card (AllFieldConstructionRates.Copies + (K := K) allocation width dilation) := by + rw [execution, AllFieldHistoryIteration.execution_copies, + AllFieldInitialChoice.execution_copies, one_mul] + simp only [AllFieldConstructionRates.Copies, Fintype.card_pi, + InverseLinearRecovery.MaskRectangles, ExactRecovery.card_mask_rectangles, Fintype.card_fin] + +theorem tags_pos + (hslack : ∀ slot : AllFieldConstructionRates.Slot K, + slack ≤ (AllFieldConstructionRates.denominator (K := K) allocation : ℝ) * + AllFieldConstructionRates.capacity allocation slot) + (data : Data (K := K) allocation dilation width slack) : + 0 < Fintype.card (Tags allocation dilation width slack data) := by + rw [card_tags] + exact AllFieldConstructionRates.selected_pos allocation slack hslack dilation + +variable {F : Type*} [Field F] (m : ℕ) + +def witness (hm : 0 < m) (hwidth : 0 < width) + (hslack : ∀ slot : AllFieldConstructionRates.Slot K, + slack ≤ (AllFieldConstructionRates.denominator (K := K) allocation : ℝ) * + AllFieldConstructionRates.capacity allocation slot) + (data : Data (K := K) allocation + (AllFieldTerminalRates.terminalDilation K m) width slack) : AllFieldWitness F := + AllFieldFinishedWitness.witness allocation m hm hwidth.le + (execution allocation (AllFieldTerminalRates.terminalDilation K m) width slack F hwidth data) + (tags_pos allocation (AllFieldTerminalRates.terminalDilation K m) width slack hslack data) + +@[simp] theorem witness_volume (hm : 0 < m) (hwidth : 0 < width) + (hslack : ∀ slot : AllFieldConstructionRates.Slot K, + slack ≤ (AllFieldConstructionRates.denominator (K := K) allocation : ℝ) * + AllFieldConstructionRates.capacity allocation slot) + (data : Data (K := K) allocation + (AllFieldTerminalRates.terminalDilation K m) width slack) : + (witness (F := F) allocation width slack m hm hwidth hslack data).volume = + AllFieldTerminalRates.terminalVolume (K := K) allocation m := + AllFieldFinishedWitness.witness_volume _ _ _ _ _ _ + +@[simp] theorem witness_multiplicity (hm : 0 < m) (hwidth : 0 < width) + (hslack : ∀ slot : AllFieldConstructionRates.Slot K, + slack ≤ (AllFieldConstructionRates.denominator (K := K) allocation : ℝ) * + AllFieldConstructionRates.capacity allocation slot) + (data : Data (K := K) allocation + (AllFieldTerminalRates.terminalDilation K m) width slack) : + (witness (F := F) allocation width slack m hm hwidth hslack data).multiplicity = + Fintype.card (AllFieldConstructionRates.SelectedLabels + (K := K) allocation slack (AllFieldTerminalRates.terminalDilation K m)) := by + change Fintype.card (Tags _ _ _ _ data) = _ + exact card_tags _ _ _ _ data + +@[simp] theorem witness_rankBound (hm : 0 < m) (hwidth : 0 < width) + (hslack : ∀ slot : AllFieldConstructionRates.Slot K, + slack ≤ (AllFieldConstructionRates.denominator (K := K) allocation : ℝ) * + AllFieldConstructionRates.capacity allocation slot) + (data : Data (K := K) allocation + (AllFieldTerminalRates.terminalDilation K m) width slack) : + (witness (F := F) allocation width slack m hm hwidth hslack data).rankBound = + AllFieldSource.rankBudget + (AllFieldConstructionRates.Copies (K := K) allocation width + (AllFieldTerminalRates.terminalDilation K m)) K + (AllFieldTerminalRates.terminalLength allocation K m) := by + rw [witness] + erw [AllFieldFinishedWitness.witness_rankBound] + unfold AllFieldSource.rankBudget + rw [execution_copies] + +end MatrixMultiplication.AllFieldConstructionData + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldConstruction/ConstructionFamily.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldConstruction/ConstructionFamily.lean new file mode 100644 index 0000000000000000000000000000000000000000..d0a732507f3450ee50c62ab2f39a47fe2ef1183a --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldConstruction/ConstructionFamily.lean @@ -0,0 +1,126 @@ +import OAI.LinearAlgebra.MatrixMultiplication.FieldConstruction.ConstructionData +import OAI.LinearAlgebra.MatrixMultiplication.FieldGroups.Selection +import OAI.LinearAlgebra.MatrixMultiplication.FieldConstruction.RateLimit + +namespace OAI + +/-! Tensor extraction over arbitrary fields and its asymptotic rate. -/ + +noncomputable section + +namespace MatrixMultiplication.AllFieldConstructionFamily + +open MatrixMultiplication.Foundation AllFieldHistory AllFieldConstructionData +open AllFieldConstructionRates Filter +open scoped BigOperators Topology Classical +attribute [local instance] Classical.propDecidable Classical.decEq + +variable {K : ℕ} + +theorem exists_width_eventually_data (allocation : Allocation) + {slack widthMax : ℝ} (hslack : 0 < slack) (hmax : 0 < widthMax) : + ∃ width : ℝ, 0 < width ∧ width ≤ widthMax ∧ + ∀ᶠ m : ℕ in atTop, Nonempty (Data (K := K) allocation m width slack) := by + let Index := Fin (K + 2) × Placement + have hindex : (Finset.univ : Finset Index).Nonempty := + ⟨(⟨0, by omega⟩, Equiv.refl _), Finset.mem_univ _⟩ + have hb (i : Index) := + AllFieldGroupSelection.exists_threshold_eventually_selected + (K := K) (tick := i.1.val) allocation i.2 hslack hmax + choose threshold hpositive hmaximum hselected using hb + let width := Finset.univ.inf' hindex threshold + have hwidth : 0 < width := by + apply (Finset.lt_inf'_iff hindex).mpr + intro i _ + exact hpositive i + have hbound (i : Index) : width ≤ threshold i := + Finset.inf'_le _ (Finset.mem_univ i) + have hwidthMax : width ≤ widthMax := + (hbound hindex.choose).trans (hmaximum hindex.choose) + have hgroups : ∀ᶠ m : ℕ in atTop, ∀ i : Index, + Nonempty (AllFieldGroupSelection.Selected (K := K) (tick := i.1.val) + allocation m width i.2 slack) := + Filter.eventually_all.mpr (fun i => hselected i width hwidth (hbound i)) + have hthresholds : ∀ᶠ m : ℕ in atTop, ∀ t : Fin (K + 2), + AllFieldHistoryRecovery.minimumDilation (K := K) (tick := t.val) allocation width ≤ m := + Filter.eventually_all.mpr (fun _ => eventually_ge_atTop _) + refine ⟨width, hwidth, hwidthMax, ?_⟩ + filter_upwards [AllFieldInitialChoice.eventually_nonempty (K := K) allocation hslack, + hgroups, hthresholds] with m hinitial hgroup hthreshold + exact ⟨{ initial := Classical.choice hinitial + groups := fun t sigma => Classical.choice (hgroup (t, sigma)) + threshold := hthreshold }⟩ + +def yieldRate (allocation : Allocation) (slack : ℝ) : ℝ := + AllFieldInitialEntropy.nativeH0 + AllFieldScheduledYield.physicalYield K allocation / K - + (1 + 6 * (K + 2) : ℕ) * slack / + ((K : ℝ) * denominator (K := K) allocation) + +theorem exists_family (F : Type*) [Field F] (hK : 0 < K) + (allocation : Allocation) {slack : ℝ} (hslack : 0 < slack) + (hslots : ∀ slot : Slot K, slack ≤ (denominator (K := K) allocation : ℝ) * + capacity allocation slot) : + ∃ (W : ℕ → AllFieldWitness F) (scale : ℕ → ℝ), + AllFieldRateLimit.HasRates W scale (yieldRate (K := K) allocation slack) + AllFieldTerminalRates.S (8 * Real.log 7) := by + obtain ⟨width, hwidth, _hmax, hd⟩ := exists_width_eventually_data + (K := K) allocation hslack (show (0 : ℝ) < 1 by norm_num) + have hterminal := (terminalDilation_tendsto K).eventually hd + obtain ⟨M, hM⟩ := Filter.eventually_atTop.mp + (hterminal.and (eventually_gt_atTop (0 : ℕ))) + let data (n : ℕ) : Data (K := K) allocation + (AllFieldTerminalRates.terminalDilation K (n + M)) width slack := + Classical.choice (hM (n + M) (Nat.le_add_left M n)).1 + have hn (n : ℕ) : 0 < n + M := (hM (n + M) (Nat.le_add_left M n)).2 + let W (n : ℕ) := witness (F := F) allocation width slack (n + M) + (hn n) hwidth hslots (data n) + let scale (n : ℕ) : ℝ := (K : ℝ) * + AllFieldTerminalRates.terminalLength allocation K (n + M) + refine ⟨W, scale, ?_⟩ + refine { scale_positive := ?_, yield_limit := ?_, volume_limit := ?_, rank_limit := ?_ } + · apply Eventually.of_forall + intro n + exact mul_pos (Nat.cast_pos.mpr hK) + (Nat.cast_pos.mpr (AllFieldTerminalRates.terminalLength_pos allocation (hn n))) + · have h := (selected_terminal_rate hK allocation slack hslots).comp + (tendsto_add_atTop_nat M) + apply h.congr + intro n + simp only [Function.comp_def, W, scale, witness_multiplicity] + · have h := (AllFieldTerminalRates.tendsto_terminalVolume hK allocation).comp + (tendsto_add_atTop_nat M) + apply h.congr + intro n + simp only [Function.comp_def, W, scale, witness_volume] + · have h := (source_rank_terminal_rate hK allocation width).comp + (tendsto_add_atTop_nat M) + apply h.congr + intro n + simp only [Function.comp_def, W, scale, witness_rankBound] + +theorem fixed_prescription_constraint (F : Type*) [Field F] (hK : 0 < K) + (allocation : Allocation) {slack : ℝ} (hslack : 0 < slack) + (hslots : ∀ slot : Slot K, slack ≤ (denominator (K := K) allocation : ℝ) * + capacity allocation slot) : + yieldRate (K := K) allocation slack + (Arithmetic.omega F / 3) * + AllFieldTerminalRates.S ≤ 8 * Real.log 7 := by + obtain ⟨W, scale, h⟩ := exists_family F hK allocation hslack hslots + exact AllFieldRateLimit.inequality_of_rates h + +theorem fixed_allocation_constraint (F : Type*) [Field F] (hK : 0 < K) + (allocation : Allocation) (hcapacity : ∀ slot : Slot K, 0 < capacity allocation slot) : + AllFieldInitialEntropy.nativeH0 + AllFieldScheduledYield.physicalYield K allocation / K + + (Arithmetic.omega F / 3) * AllFieldTerminalRates.S ≤ 8 * Real.log 7 := by + apply le_of_forall_pos_le_add + intro η hη + obtain ⟨slack, hslack, hslots, hloss⟩ := + exists_slack_for_loss hK allocation hcapacity hη + have h := fixed_prescription_constraint F hK allocation hslack hslots + unfold yieldRate at h + linarith + +end MatrixMultiplication.AllFieldConstructionFamily + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldConstruction/ConstructionLabels.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldConstruction/ConstructionLabels.lean new file mode 100644 index 0000000000000000000000000000000000000000..a6b6569159bc78a982d9701dd26081f873155857 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldConstruction/ConstructionLabels.lean @@ -0,0 +1,276 @@ +import OAI.LinearAlgebra.MatrixMultiplication.FieldConstruction.ScheduledYield +import OAI.LinearAlgebra.MatrixMultiplication.FieldConstruction.ScheduledPositivity +import OAI.LinearAlgebra.MatrixMultiplication.FieldConstruction.TerminalRates +import OAI.LinearAlgebra.MatrixMultiplication.Entropy.FloorExponentialRates + +namespace OAI + +/-! Tensor extraction over arbitrary fields and its asymptotic rate. -/ + +noncomputable section + +namespace MatrixMultiplication.AllFieldConstructionRates + +open MatrixMultiplication.Foundation AllFieldHistory AllFieldScheduledYield +open AllFieldActiveLaws Filter +open scoped BigOperators Topology Classical + +variable {K : ℕ} + +def denominator (allocation : Allocation) : ℕ := populationLength (K := K) allocation 1 + +theorem denominator_pos (allocation : Allocation) : 0 < denominator (K := K) allocation := + AllFieldPopulationCounts.blockLength_pos _ (by decide) + +theorem population_length (allocation : Allocation) (m : ℕ) : + populationLength (K := K) allocation m = m * denominator (K := K) allocation := + populationLength_dilation allocation m + +theorem populationLength_tendsto (allocation : Allocation) : + Tendsto (populationLength (K := K) allocation) atTop atTop := by + apply tendsto_atTop.mpr + intro b + filter_upwards [eventually_ge_atTop b] with m hm + rw [population_length] + exact hm.trans (by simpa using Nat.mul_le_mul_left m (denominator_pos allocation)) + +abbrev Slot (K : ℕ) := Unit ⊕ (Fin (K + 2) × Placement) + +def capacity (allocation : Allocation) : Slot K → ℝ + | .inl _ => (K : ℝ) * AllFieldInitialEntropy.nativeH0 + | .inr p => Staggering.minCapacity + (physicalTickCapacity allocation p.1.val (workCapacity (K := K)) p.2) + +def selectionRate (allocation : Allocation) (δ : ℝ) (slot : Slot K) : ℝ := + (denominator (K := K) allocation : ℝ) * capacity allocation slot - δ + +def initialCount (allocation : Allocation) (δ : ℝ) (m : ℕ) : ℕ := + FloorExponentialRates.count (selectionRate (K := K) allocation δ (.inl ())) m + +def groupCount (allocation : Allocation) (δ : ℝ) (m : ℕ) + (tick : Fin (K + 2)) (σ : Placement) : ℕ := + FloorExponentialRates.count (selectionRate allocation δ (.inr (tick, σ))) m + +theorem initialCount_eq (allocation : Allocation) (δ : ℝ) (m : ℕ) : + initialCount (K := K) allocation δ m = + ⌊Real.exp ((m : ℝ) * ((populationLength (K := K) allocation 1 : ℝ) * + ((K : ℝ) * AllFieldInitialEntropy.nativeH0) - δ))⌋₊ := rfl + +theorem groupCount_eq_native (allocation : Allocation) (δ : ℝ) (m : ℕ) + (tick : Fin (K + 2)) (σ : Placement) : + groupCount allocation δ m tick σ = + ⌊Real.exp ((m : ℝ) * ((populationLength (K := K) allocation 1 : ℝ) * + ((1 / 6 : ℝ) * Staggering.minCapacity (FiniteSchedule.tickCapacity K + AllFieldNativeCapacity.nativeLA AllFieldNativeCapacity.nativeLB + (AllFieldNativeCapacity.nativeLC (fun i => (allocation.mass i : ℝ))) tick.val)) - δ))⌋₊ := by + unfold groupCount FloorExponentialRates.count selectionRate + simp only [capacity, physical_order_native_capacity, + PhysicalOrders.minCapacity_mul _ _ (by norm_num : (0 : ℝ) ≤ 1 / 6)] + rfl + +abbrev SelectedLabels (allocation : Allocation) (δ : ℝ) (m : ℕ) := + Fin (initialCount (K := K) allocation δ m) × + ∀ tick : Fin (K + 2), ∀ σ : Placement, Fin (groupCount allocation δ m tick σ) + +theorem card_selected (allocation : Allocation) (δ : ℝ) (m : ℕ) : + Fintype.card (SelectedLabels (K := K) allocation δ m) = + initialCount (K := K) allocation δ m * + ∏ tick : Fin (K + 2), ∏ σ : Placement, groupCount allocation δ m tick σ := by + simp only [SelectedLabels, Fintype.card_prod, Fintype.card_pi, Fintype.card_fin] + +theorem card_selected_product (allocation : Allocation) (δ : ℝ) (m : ℕ) : + Fintype.card (SelectedLabels (K := K) allocation δ m) = + (∏ slot : Slot K, FloorExponentialRates.count (selectionRate allocation δ slot) m) := by + rw [card_selected] + simp [Slot, initialCount, groupCount, Fintype.prod_sum_type, Fintype.prod_prod_type] + +theorem card_selected_from_factors + (Initial : Type*) [Fintype Initial] + (Groups : Fin (K + 2) → Placement → Type*) [∀ tick σ, Fintype (Groups tick σ)] + (allocation : Allocation) (δ : ℝ) (m : ℕ) + (hI : Fintype.card Initial = initialCount (K := K) allocation δ m) + (hG : ∀ tick σ, Fintype.card (Groups tick σ) = groupCount allocation δ m tick σ) : + Fintype.card (Initial × ∀ tick σ, Groups tick σ) = + Fintype.card (SelectedLabels (K := K) allocation δ m) := by + simp only [Fintype.card_prod, Fintype.card_pi, hI, hG, Fintype.card_fin] + +theorem slot_card : Fintype.card (Slot K) = 1 + 6 * (K + 2) := by + simp [Slot, Placement, Fintype.card_perm, Nat.factorial_succ] + omega + +theorem sum_capacity (allocation : Allocation) : + (∑ slot : Slot K, capacity allocation slot) = + (K : ℝ) * AllFieldInitialEntropy.nativeH0 + physicalYield K allocation := by + simp only [Slot, Fintype.sum_sum_type, capacity, Fintype.sum_unique, + Fintype.sum_prod_type] + congr 1 + exact Fin.sum_univ_eq_sum_range (fun tick : ℕ => + ∑ σ : Placement, Staggering.minCapacity + (physicalTickCapacity allocation tick (workCapacity (K := K)) σ)) (K + 2) + +theorem sum_selectionRate (allocation : Allocation) (δ : ℝ) : + (∑ slot : Slot K, selectionRate allocation δ slot) = + (denominator (K := K) allocation : ℝ) * + ((K : ℝ) * AllFieldInitialEntropy.nativeH0 + physicalYield K allocation) - + (1 + 6 * (K + 2) : ℕ) * δ := by + simp only [selectionRate, Finset.sum_sub_distrib, ← Finset.mul_sum, + Finset.sum_const, Finset.card_univ, nsmul_eq_mul, slot_card, sum_capacity] + +theorem selected_pos (allocation : Allocation) (δ : ℝ) + (hδ : ∀ slot : Slot K, δ ≤ (denominator (K := K) allocation : ℝ) * + capacity allocation slot) (m : ℕ) : + 0 < Fintype.card (SelectedLabels (K := K) allocation δ m) := by + rw [card_selected_product] + exact Finset.prod_pos fun slot _ => + FloorExponentialRates.count_pos (sub_nonneg.mpr (hδ slot)) m + +theorem selected_rate (hK : 0 < K) (allocation : Allocation) (δ : ℝ) + (hδ : ∀ slot : Slot K, δ ≤ (denominator (K := K) allocation : ℝ) * + capacity allocation slot) : + Tendsto (fun m : ℕ => Real.log (Fintype.card + (SelectedLabels (K := K) allocation δ m) : ℝ) / + ((K : ℝ) * populationLength (K := K) allocation m)) atTop + (𝓝 (AllFieldInitialEntropy.nativeH0 + physicalYield K allocation / K - + (1 + 6 * (K + 2) : ℕ) * δ / + ((K : ℝ) * denominator (K := K) allocation))) := by + have h := (FloorExponentialRates.tendsto_log_prod_count_div_nat + (selectionRate (K := K) allocation δ) (fun slot => sub_nonneg.mpr (hδ slot))).div_const + ((K : ℝ) * denominator (K := K) allocation) + rw [sum_selectionRate] at h + have hk : (K : ℝ) ≠ 0 := Nat.cast_ne_zero.mpr hK.ne' + have hd : (denominator (K := K) allocation : ℝ) ≠ 0 := + Nat.cast_ne_zero.mpr (denominator_pos allocation).ne' + have hr : ((denominator (K := K) allocation : ℝ) * + ((K : ℝ) * AllFieldInitialEntropy.nativeH0 + physicalYield K allocation) - + (1 + 6 * (K + 2) : ℕ) * δ) / ((K : ℝ) * denominator (K := K) allocation) = + AllFieldInitialEntropy.nativeH0 + physicalYield K allocation / K - + (1 + 6 * (K + 2) : ℕ) * δ / + ((K : ℝ) * denominator (K := K) allocation) := by + field_simp [hk, hd] + rw [hr] at h + apply h.congr + intro m + rw [card_selected_product, population_length, Nat.cast_mul] + ring + +theorem exists_positive_slack (allocation : Allocation) + (hcap : ∀ slot : Slot K, 0 < capacity allocation slot) : + ∃ η : ℝ, 0 < η ∧ ∀ δ : ℝ, δ ≤ η → ∀ slot : Slot K, + δ ≤ (denominator (K := K) allocation : ℝ) * capacity allocation slot := by + let η := Finset.univ.inf' (show (Finset.univ : Finset (Slot K)).Nonempty from + ⟨.inl (), Finset.mem_univ _⟩) + (fun slot => (denominator (K := K) allocation : ℝ) * capacity allocation slot) + refine ⟨η, ?_, ?_⟩ + · apply (Finset.lt_inf'_iff _).mpr + intro slot _ + exact mul_pos (Nat.cast_pos.mpr (denominator_pos allocation)) (hcap slot) + · intro δ hδ slot + exact hδ.trans (Finset.inf'_le _ (Finset.mem_univ slot)) + +theorem exists_slack_for_loss (hK : 0 < K) (allocation : Allocation) + (hcap : ∀ slot : Slot K, 0 < capacity allocation slot) + {η : ℝ} (hη : 0 < η) : + ∃ δ : ℝ, 0 < δ ∧ + (∀ slot : Slot K, δ ≤ (denominator (K := K) allocation : ℝ) * + capacity allocation slot) ∧ + (1 + 6 * (K + 2) : ℕ) * δ / + ((K : ℝ) * denominator (K := K) allocation) < η := by + obtain ⟨bound, hbound, hslots⟩ := exists_positive_slack allocation hcap + have hk : (0 : ℝ) < K := Nat.cast_pos.mpr hK + have hd : (0 : ℝ) < denominator (K := K) allocation := + Nat.cast_pos.mpr (denominator_pos allocation) + have hc : (0 : ℝ) < (1 + 6 * (K + 2) : ℕ) := by positivity + let target := η * ((K : ℝ) * denominator (K := K) allocation) / + (1 + 6 * (K + 2) : ℕ) + have ht : 0 < target := div_pos (mul_pos hη (mul_pos hk hd)) hc + let δ := min bound target / 2 + have hm : 0 < min bound target := lt_min hbound ht + have hδ : 0 < δ := div_pos hm (by norm_num) + have hδmin : δ < min bound target := by dsimp [δ]; linarith + refine ⟨δ, hδ, hslots δ (hδmin.le.trans (min_le_left _ _)), ?_⟩ + apply (div_lt_iff₀ (mul_pos hk hd)).mpr + have hsmall := (lt_div_iff₀ hc).mp (hδmin.trans_le (min_le_right bound target)) + change δ * ((1 + 6 * (K + 2) : ℕ) : ℝ) < + η * ((K : ℝ) * denominator (K := K) allocation) at hsmall + simpa only [mul_comm δ] using hsmall + +theorem capacity_pos_of_native (hK : 2 ≤ K) (allocation : Allocation) + (ha : ∀ i, 0 < AllFieldNativeCapacity.nativeLA i) + (hb : ∀ i, 0 < AllFieldNativeCapacity.nativeLB i) + (hc : ∀ i, 0 < AllFieldNativeCapacity.nativeLC + (fun j => (allocation.mass j : ℝ)) i) (slot : Slot K) : + 0 < capacity allocation slot := by + cases slot with + | inl u => exact AllFieldScheduledPositivity.initial_capacity_pos K (by omega) + | inr p => + exact AllFieldScheduledPositivity.physical_order_capacity_pos K p.1.val hK + p.1.isLt allocation p.2 ha hb hc + +theorem eventually_capacity_pos (hK : 2 ≤ K) (allocation : ℕ → Allocation) + (h : ∀ i, Tendsto (fun j => ((allocation j).mass i : ℝ)) atTop + (𝓝 (AllFieldNativeCapacity.nativeLambda i))) + (ha : ∀ i, 0 < AllFieldNativeCapacity.nativeLA i) + (hb : ∀ i, 0 < AllFieldNativeCapacity.nativeLB i) + (hc : ∀ i, 0 < AllFieldNativeCapacity.nativeLC AllFieldNativeCapacity.nativeLambda i) : + ∀ᶠ j in atTop, ∀ slot : Slot K, 0 < capacity (allocation j) slot := by + filter_upwards [AllFieldScheduledPositivity.eventually_physical_order_capacity_pos + K hK allocation h ha hb hc] with j hj + intro slot + cases slot with + | inl u => exact AllFieldScheduledPositivity.initial_capacity_pos K (by omega) + | inr p => exact hj p.1.val p.1.isLt p.2 + +theorem terminalDilation_mul_one (K m : ℕ) : + AllFieldTerminalRates.terminalDilation K m = + m * AllFieldTerminalRates.terminalDilation K 1 := by + simp only [AllFieldTerminalRates.terminalDilation, + AllFieldTerminalPopulations.dilation, one_mul] + +theorem terminalDilation_tendsto (K : ℕ) : + Tendsto (AllFieldTerminalRates.terminalDilation K) atTop atTop := by + apply tendsto_atTop.mpr + intro b + filter_upwards [eventually_ge_atTop b] with m hm + rw [terminalDilation_mul_one] + have hD := AllFieldTerminalRates.terminalDilation_pos (K := K) (m := 1) (by decide) + have hmul : m ≤ m * AllFieldTerminalRates.terminalDilation K 1 := by + simpa using Nat.mul_le_mul_left m hD + exact hm.trans hmul + +theorem terminal_denominator (allocation : Allocation) : + AllFieldTerminalRates.terminalLength allocation K 1 = + AllFieldTerminalRates.terminalDilation K 1 * denominator (K := K) allocation := + population_length allocation _ + +theorem selected_terminal_rate (hK : 0 < K) (allocation : Allocation) (δ : ℝ) + (hδ : ∀ slot : Slot K, δ ≤ (denominator (K := K) allocation : ℝ) * + capacity allocation slot) : + Tendsto (fun m : ℕ => Real.log (Fintype.card + (SelectedLabels (K := K) allocation δ (AllFieldTerminalRates.terminalDilation K m)) : ℝ) / + ((K : ℝ) * AllFieldTerminalRates.terminalLength allocation K m)) atTop + (𝓝 (AllFieldInitialEntropy.nativeH0 + physicalYield K allocation / K - + (1 + 6 * (K + 2) : ℕ) * δ / + ((K : ℝ) * denominator (K := K) allocation))) := + (selected_rate hK allocation δ hδ).comp (terminalDilation_tendsto K) + +theorem selected_terminal_rate_of_cardinality + (Labels : ℕ → Type*) [∀ m, Fintype (Labels m)] + (hK : 0 < K) (allocation : Allocation) (δ : ℝ) + (hδ : ∀ slot : Slot K, δ ≤ (denominator (K := K) allocation : ℝ) * + capacity allocation slot) + (cards : ∀ᶠ m : ℕ in atTop, Fintype.card (Labels m) = Fintype.card + (SelectedLabels (K := K) allocation δ (AllFieldTerminalRates.terminalDilation K m))) : + Tendsto (fun m : ℕ => Real.log (Fintype.card (Labels m) : ℝ) / + ((K : ℝ) * AllFieldTerminalRates.terminalLength allocation K m)) atTop + (𝓝 (AllFieldInitialEntropy.nativeH0 + physicalYield K allocation / K - + (1 + 6 * (K + 2) : ℕ) * δ / + ((K : ℝ) * denominator (K := K) allocation))) := by + apply (selected_terminal_rate hK allocation δ hδ).congr' + filter_upwards [cards] with m hm + rw [hm] + +end MatrixMultiplication.AllFieldConstructionRates + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldConstruction/ConstructionRates.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldConstruction/ConstructionRates.lean new file mode 100644 index 0000000000000000000000000000000000000000..23adc03e528d0b69f1d9e720284345deccd1763a --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldConstruction/ConstructionRates.lean @@ -0,0 +1,115 @@ +import OAI.LinearAlgebra.MatrixMultiplication.FieldConstruction.ConstructionLabels +import OAI.LinearAlgebra.MatrixMultiplication.FieldHistory.RecoveryBudget +import OAI.LinearAlgebra.MatrixMultiplication.FieldConstruction.SourceRates + +namespace OAI + +/-! Tensor extraction over arbitrary fields and its asymptotic rate. -/ + +noncomputable section + +namespace MatrixMultiplication.AllFieldConstructionRates + +open MatrixMultiplication.Foundation AllFieldHistory Filter +open scoped BigOperators Topology Classical + +variable {K : ℕ} + +abbrev Copies (allocation : Allocation) (ε : ℝ) (m : ℕ) := + ∀ tick : Fin (K + 2), InverseLinearRecovery.MaskRectangles + (AllFieldHistoryRecovery.shiftCount (K := K) (tick := tick.val) allocation ε m) + +theorem card_copies (allocation : Allocation) (ε : ℝ) (m : ℕ) : + Fintype.card (Copies (K := K) allocation ε m) = + ∏ tick : Fin (K + 2), RecoveryGrowth.replicationCount + (AllFieldHistorySupport.supportRate (K := K) (tick := tick.val) allocation) + (AllFieldHistoryMasks.lossConstant (K := K) (tick := tick.val) allocation ε + 6) m := by + rw [Fintype.card_pi] + apply Finset.prod_congr rfl + intro tick _ + exact InverseLinearRecovery.card_recovery_copies + (AllFieldHistorySupport.supportRate (K := K) (tick := tick.val) allocation) + (AllFieldHistoryMasks.lossConstant (K := K) (tick := tick.val) allocation ε + 6) m + +theorem card_copies_range (allocation : Allocation) (ε : ℝ) (m : ℕ) : + Fintype.card (Copies (K := K) allocation ε m) = + ∏ tick ∈ Finset.range (K + 2), Fintype.card + (InverseLinearRecovery.MaskRectangles + (AllFieldHistoryRecovery.shiftCount (K := K) (tick := tick) allocation ε m)) := by + rw [Fintype.card_pi] + exact Fin.prod_univ_eq_prod_range (fun tick : ℕ => Fintype.card + (InverseLinearRecovery.MaskRectangles + (AllFieldHistoryRecovery.shiftCount (K := K) (tick := tick) allocation ε m))) (K + 2) + +theorem card_copies_pos (allocation : Allocation) (ε : ℝ) (m : ℕ) : + 0 < Fintype.card (Copies (K := K) allocation ε m) := Fintype.card_pos + +theorem copies_subexponential (allocation : Allocation) (ε : ℝ) : + Tendsto (fun m : ℕ => Real.log (Fintype.card (Copies (K := K) allocation ε m) : ℝ) / + (m : ℝ)) atTop (𝓝 0) := by + have h := RecoveryGrowth.tendsto_log_prod_div_nat (Finset.univ : Finset (Fin (K + 2))) + (r := fun tick m => Fintype.card (InverseLinearRecovery.MaskRectangles + (AllFieldHistoryRecovery.shiftCount (K := K) (tick := tick.val) allocation ε m))) + (fun _ _ _ => Fintype.card_pos) + (fun tick _ => AllFieldHistoryRecovery.replication_subexponential + (K := K) (tick := tick.val) allocation ε) + simpa only [Copies, Fintype.card_pi] using h + +theorem copies_rate (hK : 0 < K) (allocation : Allocation) (ε : ℝ) : + Tendsto (fun m : ℕ => Real.log (Fintype.card (Copies (K := K) allocation ε m) : ℝ) / + ((K : ℝ) * populationLength (K := K) allocation m)) atTop (𝓝 0) := by + have hden : (K : ℝ) * denominator (K := K) allocation ≠ 0 := + mul_ne_zero (Nat.cast_ne_zero.mpr hK.ne') + (Nat.cast_ne_zero.mpr (denominator_pos allocation).ne') + have h := (copies_subexponential (K := K) allocation ε).div tendsto_const_nhds hden + simp only [zero_div] at h + apply h.congr + intro m + rw [Pi.div_apply, population_length, Nat.cast_mul] + ring + +theorem source_rank_rate (hK : 0 < K) (allocation : Allocation) (ε : ℝ) : + Tendsto (fun m : ℕ => Real.log + (AllFieldSource.rankBudget (Copies (K := K) allocation ε m) K + (populationLength (K := K) allocation m) : ℝ) / + ((K : ℝ) * populationLength (K := K) allocation m)) + atTop (𝓝 (8 * Real.log 7)) := by + have hp := (AllFieldSourceRates.tendsto_log_polynomial_overhead K hK).comp + (populationLength_tendsto (K := K) allocation) + have he := (AllFieldSourceRates.tendsto_log_exponential_source K hK).comp + (populationLength_tendsto (K := K) allocation) + have h := ((copies_rate hK allocation ε).add hp).add he + simp only [zero_add] at h + apply h.congr + intro m + rw [AllFieldSourceRates.log_rankBudget _ _ _ (card_copies_pos allocation ε m), + add_div, add_div] + rfl + +theorem source_rank_terminal_rate (hK : 0 < K) (allocation : Allocation) (ε : ℝ) : + Tendsto (fun m : ℕ => Real.log + (AllFieldSource.rankBudget + (Copies (K := K) allocation ε (AllFieldTerminalRates.terminalDilation K m)) K + (AllFieldTerminalRates.terminalLength allocation K m) : ℝ) / + ((K : ℝ) * AllFieldTerminalRates.terminalLength allocation K m)) + atTop (𝓝 (8 * Real.log 7)) := + (source_rank_rate hK allocation ε).comp (terminalDilation_tendsto K) + +theorem source_rank_terminal_rate_of_cardinality + (ActualCopies : ℕ → Type*) [∀ m, Fintype (ActualCopies m)] + (hK : 0 < K) (allocation : Allocation) (ε : ℝ) + (cards : ∀ᶠ m : ℕ in atTop, Fintype.card (ActualCopies m) = Fintype.card + (Copies (K := K) allocation ε (AllFieldTerminalRates.terminalDilation K m))) : + Tendsto (fun m : ℕ => Real.log (AllFieldSource.rankBudget (ActualCopies m) K + (AllFieldTerminalRates.terminalLength allocation K m) : ℝ) / + ((K : ℝ) * AllFieldTerminalRates.terminalLength allocation K m)) + atTop (𝓝 (8 * Real.log 7)) := by + apply (source_rank_terminal_rate hK allocation ε).congr' + filter_upwards [cards] with m hm + simp only [AllFieldSource.rankBudget, hm] + +end MatrixMultiplication.AllFieldConstructionRates + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldConstruction/FinalState.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldConstruction/FinalState.lean new file mode 100644 index 0000000000000000000000000000000000000000..758629b6dfba6004603aa1b95bf7fc7af45a56fd --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldConstruction/FinalState.lean @@ -0,0 +1,195 @@ +import OAI.LinearAlgebra.MatrixMultiplication.FieldHistory.Tensors +import OAI.LinearAlgebra.MatrixMultiplication.FieldConstruction.InitialLeafRates +import OAI.LinearAlgebra.MatrixMultiplication.FieldConstruction.TerminalStatisticLaws + +namespace OAI + +/-! Tensor extraction over arbitrary fields and its asymptotic rate. -/ + +noncomputable section + +namespace MatrixMultiplication.AllFieldFinalState + +open MatrixMultiplication.Foundation AllFieldHistory AllFieldFiniteFamily +open AllFieldTerminalStatisticLaws +open scoped BigOperators Classical +attribute [local instance] Classical.propDecidable Classical.decEq + +abbrev InitialIndex (K : ℕ) := AllFieldInitialLeafRates.PopulationHistory K +abbrev CIndex (K : ℕ) := AfterC K × Placement +abbrev Index (K : ℕ) := InitialIndex K ⊕ (TerminalZero K ⊕ CIndex K) + +def history {K : ℕ} : Index K → History K + | .inl h => (.initial h.1.val, h.2) + | .inr (.inl h) => AllFieldTerminalStatisticLaws.history h + | .inr (.inr h) => (.afterC h.1, h.2) + +theorem history_terminal {K : ℕ} (h : Index K) : terminal (history h).1 := by + rcases h with h | h | h + · exact h.1.property + · rcases h with h | h + · exact h.1.property + · exact h.1.property + · trivial + +theorem terminal_resident_final {K : ℕ} (h : CanonicalHistory K) (ht : terminal h) : + resident (K + 2) h := by + have hlot := (initialAncestor h).1.isLt + cases h with + | initial h => exact fun hp => False.elim (ht hp) + | afterA h => + refine ⟨?_, fun hp => False.elim (ht hp)⟩ + change h.1.val.1.val < K at hlot + omega + | afterB h => + refine ⟨?_, ht⟩ + change h.1.val.1.val.1.val < K at hlot + omega + | partC h => exact False.elim ht + | afterC h => + change h.1.1.val.1.val.1.val.1.val < K at hlot + change h.1.1.val.1.val.1.val.1.val + 3 ≤ K + 2 + omega + +def toState {K : ℕ} (h : Index K) : State K (K + 2) := + ⟨history h, terminal_resident_final _ (history_terminal h)⟩ + +def fromState {K : ℕ} (h : State K (K + 2)) : Index K := by + have ht := final_state_terminal h + rcases h with ⟨⟨h, phi⟩, hr⟩ + cases h with + | initial h => exact .inl (⟨h, ht⟩, phi) + | afterA h => exact .inr (.inl (.inl (⟨h, ht⟩, phi))) + | afterB h => exact .inr (.inl (.inr (⟨h, ht⟩, phi))) + | partC h => exact False.elim ht + | afterC h => exact .inr (.inr (h, phi)) + +def indexEquiv (K : ℕ) : Index K ≃ State K (K + 2) where + toFun := toState + invFun := fromState + left_inv h := by + rcases h with h | h | h + · rfl + · cases h <;> rfl + · rfl + right_inv h := by + have ht := final_state_terminal h + rcases h with ⟨⟨h, phi⟩, hr⟩ + cases h with + | initial h => rfl + | afterA h => rfl + | afterB h => rfl + | partC h => exact False.elim ht + | afterC h => rfl + +variable {K : ℕ} (allocation : Allocation) (dilation : ℕ) + +abbrev Words := ∀ h : Index K, HistoryWord allocation dilation (history h) +abbrev InitialWords := ∀ h : InitialIndex K, + HistoryWord allocation dilation (.initial h.1.val, h.2) +abbrev ZeroWords := ∀ h : TerminalZero K, + HistoryWord allocation dilation (AllFieldTerminalStatisticLaws.history h) +abbrev CWords := ∀ h : CIndex K, HistoryWord allocation dilation (.afterC h.1, h.2) +abbrev Parts := InitialWords (K := K) allocation dilation × + (ZeroWords (K := K) allocation dilation × CWords (K := K) allocation dilation) + +instance wordsFintype : Fintype (Words (K := K) allocation dilation) := + Fintype.ofFinite (Words (K := K) allocation dilation) + +def grouped (F : Type*) [Field F] (ε : ℝ) : + Tensor F (Words (K := K) allocation dilation) (Words (K := K) allocation dilation) + (Words (K := K) allocation dilation) := + CommonDimensions.familyProduct (fun h : Index K => + historyTensor F allocation dilation ε (history h)) + +def stateWord (w : Words (K := K) allocation dilation) : + ∀ h : State K (K + 2), HistoryWord allocation dilation h.val := + Equiv.piCongrLeft (fun h : State K (K + 2) => HistoryWord allocation dilation h.val) + (indexEquiv K) w + +theorem grouped_coefficient (F : Type*) [Field F] (ε : ℝ) + (x y z : Words (K := K) allocation dilation) : + stateTensor F allocation dilation ε (K + 2) (stateWord allocation dilation x) + (stateWord allocation dilation y) (stateWord allocation dilation z) = + grouped allocation dilation F ε x y z := by + change (∏ h : State K (K + 2), historyTensor F allocation dilation ε h.val + (stateWord allocation dilation x h) (stateWord allocation dilation y h) + (stateWord allocation dilation z h)) = _ + rw [← (indexEquiv K).prod_comp] + have hword (w : Words (K := K) allocation dilation) (i : Index K) : + stateWord allocation dilation w ((indexEquiv K) i) = w i := + Equiv.piCongrLeft_apply_apply + (fun h : State K (K + 2) => HistoryWord allocation dilation h.val) + (indexEquiv K) w i + simp only [hword] + rfl + +def groupedMap (F : Type*) [Field F] (ε : ℝ) : + LocalMap (stateTensor F (K := K) allocation dilation ε (K + 2)) + (grouped (K := K) allocation dilation F ε) := by + apply LocalMap.ofExists + refine ⟨_, _, _, (Tensor.pullback_eq_restrict + (stateWord (K := K) allocation dilation) (stateWord (K := K) allocation dilation) + (stateWord (K := K) allocation dilation) _).symm.trans ?_⟩ + funext x y z + exact grouped_coefficient allocation dilation F ε x y z + +def initialTensor (F : Type*) [Field F] (ε : ℝ) : + Tensor F (InitialWords (K := K) allocation dilation) (InitialWords (K := K) allocation dilation) + (InitialWords (K := K) allocation dilation) := + CommonDimensions.familyProduct (fun h : InitialIndex K => + historyTensor F allocation dilation ε (.initial h.1.val, h.2)) + +def zeroTensor (F : Type*) [Field F] (ε : ℝ) : + Tensor F (ZeroWords (K := K) allocation dilation) (ZeroWords (K := K) allocation dilation) + (ZeroWords (K := K) allocation dilation) := + CommonDimensions.familyProduct (fun h : TerminalZero K => + historyTensor F allocation dilation ε (AllFieldTerminalStatisticLaws.history h)) + +def cTensor (F : Type*) [Field F] (ε : ℝ) : + Tensor F (CWords (K := K) allocation dilation) (CWords (K := K) allocation dilation) + (CWords (K := K) allocation dilation) := + CommonDimensions.familyProduct (fun h : CIndex K => + historyTensor F allocation dilation ε (.afterC h.1, h.2)) + +def partsTensor (F : Type*) [Field F] (ε : ℝ) : + Tensor F (Parts (K := K) allocation dilation) (Parts (K := K) allocation dilation) + (Parts (K := K) allocation dilation) := + Tensor.product (initialTensor (K := K) allocation dilation F ε) + (Tensor.product (zeroTensor (K := K) allocation dilation F ε) + (cTensor (K := K) allocation dilation F ε)) + +def joinParts (w : Parts (K := K) allocation dilation) : Words (K := K) allocation dilation + | .inl h => w.1 h + | .inr (.inl h) => w.2.1 h + | .inr (.inr h) => w.2.2 h + +theorem parts_coefficient (F : Type*) [Field F] (ε : ℝ) + (x y z : Parts (K := K) allocation dilation) : + grouped allocation dilation F ε (joinParts allocation dilation x) + (joinParts allocation dilation y) (joinParts allocation dilation z) = + partsTensor allocation dilation F ε x y z := by + unfold grouped CommonDimensions.familyProduct + rw [Fintype.prod_sum_type, Fintype.prod_sum_type] + rfl + +def partsMap (F : Type*) [Field F] (ε : ℝ) : + LocalMap (grouped (K := K) allocation dilation F ε) + (partsTensor (K := K) allocation dilation F ε) := by + apply LocalMap.ofExists + refine ⟨_, _, _, (Tensor.pullback_eq_restrict + (joinParts (K := K) allocation dilation) (joinParts (K := K) allocation dilation) + (joinParts (K := K) allocation dilation) _).symm.trans ?_⟩ + funext x y z + exact parts_coefficient allocation dilation F ε x y z + +def map (F : Type*) [Field F] (ε : ℝ) : + LocalMap (stateTensor F (K := K) allocation dilation ε (K + 2)) + (partsTensor (K := K) allocation dilation F ε) := + (groupedMap allocation dilation F ε).comp (partsMap allocation dilation F ε) + +end MatrixMultiplication.AllFieldFinalState + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldConstruction/FinishedWitness.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldConstruction/FinishedWitness.lean new file mode 100644 index 0000000000000000000000000000000000000000..4b82bcbd40edcb531939723b600ec35080d935f5 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldConstruction/FinishedWitness.lean @@ -0,0 +1,272 @@ +import OAI.LinearAlgebra.MatrixMultiplication.Arithmetic.MatrixMapDecidable +import OAI.LinearAlgebra.MatrixMultiplication.FieldConstruction.FinalState +import OAI.LinearAlgebra.MatrixMultiplication.FieldConstruction.InitialZeroFinish +import OAI.LinearAlgebra.MatrixMultiplication.FieldConstruction.ZeroFinish +import OAI.LinearAlgebra.MatrixMultiplication.FieldConstruction.StageCFinish +import OAI.LinearAlgebra.MatrixMultiplication.FieldConstruction.Terminal + +namespace OAI + +/-! Tensor extraction over arbitrary fields and its asymptotic rate. -/ + +noncomputable section + +namespace MatrixMultiplication.AllFieldFinishedWitness + +open MatrixMultiplication.Foundation AllFieldHistory AllFieldFiniteFamily +open AllFieldTerminalStatisticLaws AllFieldTerminalRates +open scoped BigOperators Classical +attribute [local instance] Classical.propDecidable Classical.decEq + +private def localMapWithFintypes {F : Type*} [Field F] + {X Y Z X' Y' Z' : Type} [newX : Fintype X] [newY : Fintype Y] [newZ : Fintype Z] + {oldX : Fintype X} {oldY : Fintype Y} {oldZ : Fintype Z} + {T : Tensor F X Y Z} {Q : Tensor F X' Y' Z'} + (M : @LocalMap F _ X Y Z X' Y' Z' oldX oldY oldZ T Q) : + @LocalMap F _ X Y Z X' Y' Z' newX newY newZ T Q := by + cases Subsingleton.elim oldX newX + cases Subsingleton.elim oldY newY + cases Subsingleton.elim oldZ newZ + exact M + +private def matrixProductMap (F : Type*) [Field F] + (A B C D E G : Type) [Fintype A] [Fintype B] [Fintype C] + [Fintype D] [Fintype E] [Fintype G] : + LocalMap (Tensor.product (Tensor.matrixCoefficients (K := F) A B C) + (Tensor.matrixCoefficients D E G)) + (Tensor.matrixCoefficients (A × D) (B × E) (C × G)) := by + apply LocalMap.ofExists + refine ⟨_, _, _, (Tensor.pullback_eq_restrict + (fun x : (A × D) × (B × E) => ((x.1.1, x.2.1), (x.1.2, x.2.2))) + (fun y : (B × E) × (C × G) => ((y.1.1, y.2.1), (y.1.2, y.2.2))) + (fun z : (C × G) × (A × D) => ((z.1.1, z.2.1), (z.1.2, z.2.2))) _).symm.trans ?_⟩ + funext x y z + exact Tensor.matrixCoefficients_product x y z + +private def combineMatrixMaps {F : Type*} [Field F] + {X Y Z U V W A B C D E G : Type} + [Fintype X] [Fintype Y] [Fintype Z] [Fintype U] [Fintype V] [Fintype W] + [Fintype A] [Fintype B] [Fintype C] [Fintype D] [Fintype E] [Fintype G] + {T : Tensor F X Y Z} {Q : Tensor F U V W} + (first : LocalMap T (Tensor.matrixCoefficients A B C)) + (second : LocalMap Q (Tensor.matrixCoefficients D E G)) : + LocalMap (Tensor.product T Q) + (Tensor.matrixCoefficients (A × D) (B × E) (C × G)) := + (first.product second).comp (matrixProductMap F A B C D E G) + +variable {K : ℕ} (allocation : Allocation) (m : ℕ) + +abbrev ZeroRows := ∀ h : TerminalZero K, AllFieldZeroFinish.Row allocation m h +abbrev ZeroMiddles := ∀ h : TerminalZero K, AllFieldZeroFinish.Middle allocation m h +abbrev ZeroColumns := ∀ h : TerminalZero K, AllFieldZeroFinish.Column allocation m h + +abbrev Rows := AllFieldInitialZeroFinish.Rows (K := K) allocation (terminalDilation K m) × + (ZeroRows (K := K) allocation m × + AllFieldStageCFinish.Rows (K := K) allocation (terminalDilation K m)) +abbrev Middles := AllFieldInitialZeroFinish.Middles (K := K) allocation (terminalDilation K m) × + (ZeroMiddles (K := K) allocation m × + AllFieldStageCFinish.Middles (K := K) allocation (terminalDilation K m)) +abbrev Columns := AllFieldInitialZeroFinish.Columns (K := K) allocation (terminalDilation K m) × + (ZeroColumns (K := K) allocation m × + AllFieldStageCFinish.Columns (K := K) allocation (terminalDilation K m)) + +local instance initialRowsFintype : + Fintype (AllFieldInitialZeroFinish.Rows (K := K) allocation (terminalDilation K m)) := by + letI : DecidableEq (AllFieldInitialZeroFinish.Index K) := Classical.decEq _ + exact inferInstanceAs (Fintype (∀ h : AllFieldInitialZeroFinish.Index K, + AllFieldInitialZeroFinish.RowIndex allocation (terminalDilation K m) h)) + +local instance initialMiddlesFintype : + Fintype (AllFieldInitialZeroFinish.Middles (K := K) allocation (terminalDilation K m)) := by + letI : DecidableEq (AllFieldInitialZeroFinish.Index K) := Classical.decEq _ + exact inferInstanceAs (Fintype (∀ h : AllFieldInitialZeroFinish.Index K, + AllFieldInitialZeroFinish.MiddleIndex allocation (terminalDilation K m) h)) + +local instance initialColumnsFintype : + Fintype (AllFieldInitialZeroFinish.Columns (K := K) allocation (terminalDilation K m)) := by + letI : DecidableEq (AllFieldInitialZeroFinish.Index K) := Classical.decEq _ + exact inferInstanceAs (Fintype (∀ h : AllFieldInitialZeroFinish.Index K, + AllFieldInitialZeroFinish.ColumnIndex allocation (terminalDilation K m) h)) + +local instance stageCRowsFintype : + Fintype (AllFieldStageCFinish.Rows (K := K) allocation (terminalDilation K m)) := by + exact inferInstanceAs (Fintype (∀ h : CWStageCProducts.PopulationHistory K, + CWStageCProducts.RowWords (CWStageCProducts.populationSide h) + (CWStageCProducts.populationAtomCounts allocation (terminalDilation K m) h))) + +local instance stageCMiddlesFintype : + Fintype (AllFieldStageCFinish.Middles (K := K) allocation (terminalDilation K m)) := by + exact inferInstanceAs (Fintype (∀ h : CWStageCProducts.PopulationHistory K, + CWStageCProducts.MiddleWords (CWStageCProducts.populationSide h) + (CWStageCProducts.populationAtomCounts allocation (terminalDilation K m) h))) + +local instance stageCColumnsFintype : + Fintype (AllFieldStageCFinish.Columns (K := K) allocation (terminalDilation K m)) := by + exact inferInstanceAs (Fintype (∀ h : CWStageCProducts.PopulationHistory K, + CWStageCProducts.ColumnWords (CWStageCProducts.populationSide h) + (CWStageCProducts.populationAtomCounts allocation (terminalDilation K m) h))) + +local instance rowsFintype : Fintype (Rows (K := K) allocation m) := + inferInstanceAs (Fintype + (AllFieldInitialZeroFinish.Rows (K := K) allocation (terminalDilation K m) × + (ZeroRows (K := K) allocation m × + AllFieldStageCFinish.Rows (K := K) allocation (terminalDilation K m)))) + +local instance middlesFintype : Fintype (Middles (K := K) allocation m) := + inferInstanceAs (Fintype + (AllFieldInitialZeroFinish.Middles (K := K) allocation (terminalDilation K m) × + (ZeroMiddles (K := K) allocation m × + AllFieldStageCFinish.Middles (K := K) allocation (terminalDilation K m)))) + +local instance columnsFintype : Fintype (Columns (K := K) allocation m) := + inferInstanceAs (Fintype + (AllFieldInitialZeroFinish.Columns (K := K) allocation (terminalDilation K m) × + (ZeroColumns (K := K) allocation m × + AllFieldStageCFinish.Columns (K := K) allocation (terminalDilation K m)))) + +local instance initialRawFintype : + Fintype (AllFieldFinalState.InitialWords (K := K) allocation (terminalDilation K m)) := + inferInstanceAs (Fintype (∀ h : AllFieldFinalState.InitialIndex K, + HistoryWord allocation (terminalDilation K m) (.initial h.1.val, h.2))) + +local instance zeroRawFintype : + Fintype (AllFieldFinalState.ZeroWords (K := K) allocation (terminalDilation K m)) := + inferInstanceAs (Fintype (∀ h : TerminalZero K, + HistoryWord allocation (terminalDilation K m) (AllFieldTerminalStatisticLaws.history h))) + +local instance stageCRawFintype : + Fintype (AllFieldFinalState.CWords (K := K) allocation (terminalDilation K m)) := + inferInstanceAs (Fintype (∀ h : AllFieldFinalState.CIndex K, + HistoryWord allocation (terminalDilation K m) (.afterC h.1, h.2))) + +theorem zero_volume : + Fintype.card (ZeroRows (K := K) allocation m) * + Fintype.card (ZeroMiddles (K := K) allocation m) * + Fintype.card (ZeroColumns (K := K) allocation m) = zeroVolume (K := K) allocation m := by + simp only [ZeroRows, ZeroMiddles, ZeroColumns, Fintype.card_pi, zeroVolume] + rw [← Finset.prod_mul_distrib, ← Finset.prod_mul_distrib] + exact Finset.prod_congr rfl fun h _ => AllFieldZeroFinish.volume allocation m h + +theorem volume_eq : + Fintype.card (Rows (K := K) allocation m) * + Fintype.card (Middles (K := K) allocation m) * + Fintype.card (Columns (K := K) allocation m) = terminalVolume (K := K) allocation m := by + simp only [Rows, Middles, Columns, Fintype.card_prod] + calc + _ = (Fintype.card (AllFieldInitialZeroFinish.Rows (K := K) allocation (terminalDilation K m)) * + Fintype.card (AllFieldInitialZeroFinish.Middles (K := K) allocation (terminalDilation K m)) * + Fintype.card (AllFieldInitialZeroFinish.Columns (K := K) allocation (terminalDilation K m))) * + (Fintype.card (ZeroRows (K := K) allocation m) * + Fintype.card (ZeroMiddles (K := K) allocation m) * + Fintype.card (ZeroColumns (K := K) allocation m)) * + (Fintype.card (AllFieldStageCFinish.Rows (K := K) allocation (terminalDilation K m)) * + Fintype.card (AllFieldStageCFinish.Middles (K := K) allocation (terminalDilation K m)) * + Fintype.card (AllFieldStageCFinish.Columns (K := K) allocation (terminalDilation K m))) := by ring + _ = _ := by rw [AllFieldInitialZeroFinish.volume_eq, zero_volume, + AllFieldStageCFinish.volume_eq_populationVolume]; rfl + +theorem dimensions_pos : + 0 < Fintype.card (Rows (K := K) allocation m) ∧ + 0 < Fintype.card (Middles (K := K) allocation m) ∧ + 0 < Fintype.card (Columns (K := K) allocation m) := by + have hp := terminalVolume_pos (K := K) allocation m + rw [← volume_eq allocation m] at hp + have hab := Nat.pos_of_mul_pos_right hp + exact ⟨Nat.pos_of_mul_pos_right hab, Nat.pos_of_mul_pos_left hab, + Nat.pos_of_mul_pos_left hp⟩ + +def zeroMap (F : Type*) [Field F] {ε : ℝ} (hm : 0 < m) (hε : 0 ≤ ε) : + LocalMap (AllFieldFinalState.zeroTensor (K := K) allocation (terminalDilation K m) F ε) + (Tensor.matrixCoefficients (ZeroRows (K := K) allocation m) + (ZeroMiddles (K := K) allocation m) (ZeroColumns (K := K) allocation m)) := by + let result := AllFieldTerminal.terminalProductMap + (fun h : TerminalZero K => historyTensor F allocation (terminalDilation K m) ε + (AllFieldTerminalStatisticLaws.history h)) + (fun h => AllFieldZeroFinish.Row allocation m h) + (fun h => AllFieldZeroFinish.Middle allocation m h) + (fun h => AllFieldZeroFinish.Column allocation m h) + (fun h => LocalMap.redecideMatrix + (AllFieldZeroFinish.localMap F allocation hm hε h) _ _ _) + let aligned := localMapWithFintypes (F := F) + (X := AllFieldFinalState.ZeroWords (K := K) allocation (terminalDilation K m)) + (Y := AllFieldFinalState.ZeroWords (K := K) allocation (terminalDilation K m)) + (Z := AllFieldFinalState.ZeroWords (K := K) allocation (terminalDilation K m)) + (newX := inferInstance) (newY := inferInstance) (newZ := inferInstance) result + exact LocalMap.redecideMatrix aligned _ _ _ + +def terminalMap (F : Type*) [Field F] {ε : ℝ} (hm : 0 < m) (hε : 0 ≤ ε) : + LocalMap (stateTensor F (K := K) allocation (terminalDilation K m) ε (K + 2)) + (Tensor.matrixCoefficients (Rows (K := K) allocation m) + (Middles (K := K) allocation m) (Columns (K := K) allocation m)) := by + let initialAligned := localMapWithFintypes (F := F) + (X := AllFieldInitialZeroFinish.RawWords (K := K) allocation (terminalDilation K m)) + (Y := AllFieldInitialZeroFinish.RawWords (K := K) allocation (terminalDilation K m)) + (Z := AllFieldInitialZeroFinish.RawWords (K := K) allocation (terminalDilation K m)) + (newX := inferInstance) (newY := inferInstance) (newZ := inferInstance) + (AllFieldInitialZeroFinish.finishMap (K := K) allocation (terminalDilation K m) F ε) + let initial := LocalMap.redecideMatrix initialAligned + (Classical.decEq _) (Classical.decEq _) (Classical.decEq _) + let zeros := LocalMap.redecideMatrix (zeroMap (K := K) allocation m F hm hε) + (Classical.decEq _) (Classical.decEq _) (Classical.decEq _) + let interior := LocalMap.redecideMatrix + (AllFieldStageCFinish.finishMap (K := K) allocation (terminalDilation K m) F ε) + (Classical.decEq _) (Classical.decEq _) (Classical.decEq _) + let second := LocalMap.redecideMatrix + (combineMatrixMaps zeros interior) + (Classical.decEq _) (Classical.decEq _) (Classical.decEq _) + let third := combineMatrixMaps initial second + exact LocalMap.redecideMatrix + ((AllFieldFinalState.map (K := K) allocation (terminalDilation K m) F ε).comp third) _ _ _ + +variable {F : Type*} [Field F] {ε : ℝ} {I : Type} [Fintype I] + +def execution (hm : 0 < m) (hε : 0 ≤ ε) + (E : Execution (cwSource F K (terminalLength allocation K m)) + (Tensor.directSum (fun _ : I => + stateTensor F (K := K) allocation (terminalDilation K m) ε (K + 2)))) : + Execution (cwSource F K (terminalLength allocation K m)) + (AllFieldSource.matrixTarget F (Fintype.card (Rows (K := K) allocation m)) + (Fintype.card (Middles (K := K) allocation m)) + (Fintype.card (Columns (K := K) allocation m)) (Fintype.card I)) := + (E.restrict _ ((terminalMap allocation m F hm hε).parallelCopies I)).restrict _ + (LocalMap.ofExists (TerminalRelabel.directSum_matrix_restrict_fin (K := F) + I (Rows (K := K) allocation m) (Middles (K := K) allocation m) + (Columns (K := K) allocation m))) + +def witness (hm : 0 < m) (hε : 0 ≤ ε) + (E : Execution (cwSource F K (terminalLength allocation K m)) + (Tensor.directSum (fun _ : I => + stateTensor F (K := K) allocation (terminalDilation K m) ε (K + 2)))) + (hI : 0 < Fintype.card I) : AllFieldWitness F := + (execution allocation m hm hε E).toWitness + (dimensions_pos allocation m).1 (dimensions_pos allocation m).2.1 + (dimensions_pos allocation m).2.2 hI + +@[simp] theorem witness_volume (hm : 0 < m) (hε : 0 ≤ ε) + (E : Execution (cwSource F K (terminalLength allocation K m)) + (Tensor.directSum (fun _ : I => + stateTensor F (K := K) allocation (terminalDilation K m) ε (K + 2)))) + (hI : 0 < Fintype.card I) : + (witness allocation m hm hε E hI).volume = terminalVolume (K := K) allocation m := + volume_eq allocation m + +@[simp] theorem witness_multiplicity (hm : 0 < m) (hε : 0 ≤ ε) + (E : Execution (cwSource F K (terminalLength allocation K m)) + (Tensor.directSum (fun _ : I => + stateTensor F (K := K) allocation (terminalDilation K m) ε (K + 2)))) + (hI : 0 < Fintype.card I) : + (witness allocation m hm hε E hI).multiplicity = Fintype.card I := rfl + +@[simp] theorem witness_rankBound (hm : 0 < m) (hε : 0 ≤ ε) + (E : Execution (cwSource F K (terminalLength allocation K m)) + (Tensor.directSum (fun _ : I => + stateTensor F (K := K) allocation (terminalDilation K m) ε (K + 2)))) + (hI : 0 < Fintype.card I) : + (witness allocation m hm hε E hI).rankBound = + AllFieldSource.rankBudget E.Copies K (terminalLength allocation K m) := rfl + +end MatrixMultiplication.AllFieldFinishedWitness + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldConstruction/FiniteFamily.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldConstruction/FiniteFamily.lean new file mode 100644 index 0000000000000000000000000000000000000000..fbef23c394c8c7113d698d5b9b8cacea146a1830 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldConstruction/FiniteFamily.lean @@ -0,0 +1,386 @@ +import OAI.LinearAlgebra.MatrixMultiplication.FieldConstruction.Source +import OAI.LinearAlgebra.MatrixMultiplication.JointExtraction.Extraction +import OAI.LinearAlgebra.MatrixMultiplication.Recovery.InverseLinearRecovery +import OAI.LinearAlgebra.MatrixMultiplication.Tensor.Replication +import OAI.LinearAlgebra.MatrixMultiplication.Tensor.TerminalProducts + +namespace OAI + +/-! Tensor extraction over arbitrary fields and its asymptotic rate. -/ + +noncomputable section + +namespace MatrixMultiplication.AllFieldFiniteFamily + +open MatrixMultiplication.Foundation +open scoped BigOperators Classical + +variable {F : Type*} [Field F] + +structure LocalMap {X Y Z X' Y' Z' : Type} + [Fintype X] [Fintype Y] [Fintype Z] + (source : Tensor F X Y Z) (target : Tensor F X' Y' Z') where + x : X' → X → F + y : Y' → Y → F + z : Z' → Z → F + coefficient : Tensor.restrict x y z source = target + +namespace LocalMap + +variable {X Y Z X' Y' Z' X'' Y'' Z'' : Type} + [Fintype X] [Fintype Y] [Fintype Z] + [Fintype X'] [Fintype Y'] [Fintype Z'] + {source : Tensor F X Y Z} {middle : Tensor F X' Y' Z'} + {target : Tensor F X'' Y'' Z''} + +def identity (source : Tensor F X Y Z) : LocalMap source source where + x := fun x s => if s = x then 1 else 0 + y := fun y s => if s = y then 1 else 0 + z := fun z s => if s = z then 1 else 0 + coefficient := by + rw [← Tensor.pullback_eq_restrict] + rfl + +def delete (source : Tensor F X Y Z) (px : X → Prop) (py : Y → Prop) (pz : Z → Prop) : + LocalMap source (ExactRecovery.delete source px py pz) where + x := fun x s => if s = x ∧ px x then 1 else 0 + y := fun y s => if s = y ∧ py y then 1 else 0 + z := fun z s => if s = z ∧ pz z then 1 else 0 + coefficient := by + funext x y z + by_cases hx : px x <;> by_cases hy : py y <;> by_cases hz : pz z <;> + simp [Tensor.restrict, ExactRecovery.delete, hx, hy, hz, ite_mul, mul_ite] + +def product {U V W U' V' W' : Type} + [Fintype U] [Fintype V] [Fintype W] + {other : Tensor F U V W} {otherTarget : Tensor F U' V' W'} + (first : LocalMap source middle) (second : LocalMap other otherTarget) : + LocalMap (Tensor.product source other) (Tensor.product middle otherTarget) where + x := fun x s => first.x x.1 s.1 * second.x x.2 s.2 + y := fun y s => first.y y.1 s.1 * second.y y.2 s.2 + z := fun z s => first.z z.1 s.1 * second.z z.2 s.2 + coefficient := by + rw [Tensor.restrict_product, first.coefficient, second.coefficient] + +def comp (first : LocalMap source middle) (second : LocalMap middle target) : + LocalMap source target where + x := Tensor.composeRestrictionMatrix second.x first.x + y := Tensor.composeRestrictionMatrix second.y first.y + z := Tensor.composeRestrictionMatrix second.z first.z + coefficient := by + rw [← Tensor.restrict_restrict, first.coefficient, second.coefficient] + +def withSource (map : LocalMap source middle) (newSource : Tensor F X Y Z) + (same : newSource = source) : LocalMap newSource middle where + x := map.x + y := map.y + z := map.z + coefficient := by rw [same]; exact map.coefficient + +def ofExists + (h : ∃ (a : X' → X → F) (b : Y' → Y → F) (c : Z' → Z → F), + Tensor.restrict a b c source = middle) : LocalMap source middle := by + choose a b c habc using h + exact ⟨a, b, c, habc⟩ + +def parallelCopies (map : LocalMap source middle) (R : Type) [Fintype R] : + LocalMap (Tensor.directSum (fun _ : R => source)) + (Tensor.directSum (fun _ : R => middle)) where + x := fun x s => if x.1 = s.1 then map.x x.2 s.2 else 0 + y := fun y s => if y.1 = s.1 then map.y y.2 s.2 else 0 + z := fun z s => if z.1 = s.1 then map.z z.2 s.2 else 0 + coefficient := by + have h := Replication.restrict_directSum (fun _ : R => source) + (fun _ => map.x) (fun _ => map.y) (fun _ => map.z) + simpa only [map.coefficient] using h + +def directSum {I : Type} [Fintype I] + (T : I → Tensor F X Y Z) (Q : I → Tensor F X' Y' Z') + (maps : ∀ i, LocalMap (T i) (Q i)) : + LocalMap (Tensor.directSum T) (Tensor.directSum Q) where + x := fun x s => if x.1 = s.1 then (maps x.1).x x.2 s.2 else 0 + y := fun y s => if y.1 = s.1 then (maps y.1).y y.2 s.2 else 0 + z := fun z s => if z.1 = s.1 then (maps z.1).z z.2 s.2 else 0 + coefficient := by + have h := Replication.restrict_directSum T + (fun i => (maps i).x) (fun i => (maps i).y) (fun i => (maps i).z) + simpa only [fun i => (maps i).coefficient] using h + +def selectBranches {I J : Type} [Fintype I] [Fintype J] + (T : I → Tensor F X Y Z) (select : J → I) (injective : Function.Injective select) : + LocalMap (Tensor.directSum T) (Tensor.directSum (fun j => T (select j))) where + x := fun x s => if s = (select x.1, x.2) then 1 else 0 + y := fun y s => if s = (select y.1, y.2) then 1 else 0 + z := fun z s => if s = (select z.1, z.2) then 1 else 0 + coefficient := by + rw [← Tensor.pullback_eq_restrict] + funext x y z + simp only [Tensor.pullback, Tensor.directSum, injective.eq_iff] + +def unflatten (source : Tensor F X Y Z) (R I : Type) [Fintype R] [Fintype I] : + LocalMap (Tensor.directSum (fun _ : R × I => source)) + (Tensor.directSum (fun _ : R => Tensor.directSum (fun _ : I => source))) where + x := fun x s => if s = ((x.1, x.2.1), x.2.2) then 1 else 0 + y := fun y s => if s = ((y.1, y.2.1), y.2.2) then 1 else 0 + z := fun z s => if s = ((z.1, z.2.1), z.2.2) then 1 else 0 + coefficient := by + rw [← Tensor.pullback_eq_restrict] + funext x y z + simp only [Tensor.pullback, Tensor.directSum, Prod.ext_iff] + split_ifs <;> aesop + +def flatten (source : Tensor F X Y Z) (I J : Type) [Fintype I] [Fintype J] : + LocalMap (Tensor.directSum (fun _ : I => Tensor.directSum (fun _ : J => source))) + (Tensor.directSum (fun _ : I × J => source)) where + x := fun x s => if s = (x.1.1, (x.1.2, x.2)) then 1 else 0 + y := fun y s => if s = (y.1.1, (y.1.2, y.2)) then 1 else 0 + z := fun z s => if s = (z.1.1, (z.1.2, z.2)) then 1 else 0 + coefficient := by + rw [← Tensor.pullback_eq_restrict] + funext x y z + simp only [Tensor.pullback, Tensor.directSum, Prod.ext_iff] + split_ifs <;> aesop + +def replicationProduct {U V W : Type} [Fintype U] [Fintype V] [Fintype W] + (active : Tensor F X Y Z) (finished : Tensor F U V W) + (R : Type) [Fintype R] : + LocalMap (Tensor.directSum (fun _ : R => Tensor.product active finished)) + (Tensor.product (Tensor.directSum (fun _ : R => active)) finished) where + x := fun x s => if s = (x.1.1, (x.1.2, x.2)) then 1 else 0 + y := fun y s => if s = (y.1.1, (y.1.2, y.2)) then 1 else 0 + z := fun z s => if s = (z.1.1, (z.1.2, z.2)) then 1 else 0 + coefficient := by + rw [← Tensor.pullback_eq_restrict] + funext x y z + simp [Tensor.pullback, Tensor.directSum, Tensor.product, ite_mul] + +def extract (T : Tensor F X Y Z) {I : Type} [Fintype I] + (assignment : JointExtraction.Assignment X Y Z I) + (coherent : JointExtraction.Coherent T assignment) : + LocalMap T (Tensor.directSum (JointExtraction.branch T assignment)) where + x := JointExtraction.assignmentMatrix assignment.x + y := JointExtraction.assignmentMatrix assignment.y + z := JointExtraction.assignmentMatrix assignment.z + coefficient := JointExtraction.restrict_assignments_eq_directSum T assignment coherent + +def repairBranches {I : Type} [Fintype I] + (T Q : I → Tensor F X Y Z) (L : ℕ) + (repair : ∀ i, InverseLinearRecovery.RecoveredBy (Q i) (T i) L) : + LocalMap + (Tensor.directSum (fun _ : InverseLinearRecovery.MaskRectangles L => Tensor.directSum T)) + (Tensor.directSum Q) := by + choose a b c h using repair + exact ofExists (Replication.repair_branches T Q a b c h) + +end LocalMap + +structure Execution {SX SY SZ X Y Z : Type} + [Fintype SX] [Fintype SY] [Fintype SZ] + (source : Tensor F SX SY SZ) (target : Tensor F X Y Z) where + Copies : Type + [copies_finite : Fintype Copies] + copies_positive : 0 < Fintype.card Copies + map : LocalMap (Tensor.directSum (fun _ : Copies => source)) target + +attribute [instance] Execution.copies_finite + +namespace Execution + +variable {SX SY SZ X Y Z X' Y' Z' : Type} + [Fintype SX] [Fintype SY] [Fintype SZ] + [Fintype X] [Fintype Y] [Fintype Z] + {source : Tensor F SX SY SZ} {current : Tensor F X Y Z} + +def initial (source : Tensor F SX SY SZ) : Execution source source where + Copies := PUnit + copies_positive := by simp + map := { + x := fun x s => if s = (PUnit.unit, x) then 1 else 0 + y := fun y s => if s = (PUnit.unit, y) then 1 else 0 + z := fun z s => if s = (PUnit.unit, z) then 1 else 0 + coefficient := by + rw [← Tensor.pullback_eq_restrict] + funext x y z + simp [Tensor.pullback, Tensor.directSum] + } + +def restrict (E : Execution source current) (target : Tensor F X' Y' Z') + (map : LocalMap current target) : Execution source target where + Copies := E.Copies + copies_positive := E.copies_positive + map := E.map.comp map + +def replicate (E : Execution source current) (R : Type) [Fintype R] + (positive : 0 < Fintype.card R) : + Execution source (Tensor.directSum (fun _ : R => current)) where + Copies := R × E.Copies + copies_positive := by simpa using Nat.mul_pos positive E.copies_positive + map := ((LocalMap.unflatten source R E.Copies).comp (E.map.parallelCopies R)).withSource _ + (by funext x y z; simp only [Tensor.directSum]) + +def step (E : Execution source current) (R : Type) [Fintype R] + (positive : 0 < Fintype.card R) (target : Tensor F X' Y' Z') + (map : LocalMap (Tensor.directSum (fun _ : R => current)) target) : + Execution source target := + (E.replicate R positive).restrict target map + +def stepOnLeft {U V W : Type} [Fintype U] [Fintype V] [Fintype W] + (active : Tensor F X Y Z) (finished : Tensor F U V W) + (E : Execution source (Tensor.product active finished)) + (R : Type) [Fintype R] (positive : 0 < Fintype.card R) + (target : Tensor F X' Y' Z') + (map : LocalMap (Tensor.directSum (fun _ : R => active)) target) : + Execution source (Tensor.product target finished) := + E.step R positive _ ((LocalMap.replicationProduct active finished R).comp + (map.product (LocalMap.identity finished))) + +def branchOperation {I J R : Type} [Fintype I] [Fintype J] [Fintype R] + (current : Tensor F X Y Z) (next : Tensor F X' Y' Z') + [Fintype X'] [Fintype Y'] [Fintype Z'] + (E : Execution source (Tensor.directSum (fun _ : I => current))) + (positive : 0 < Fintype.card R) + (map : LocalMap (Tensor.directSum (fun _ : R => current)) + (Tensor.directSum (fun _ : J => next))) : + Execution source (Tensor.directSum (fun _ : I × J => next)) := + E.step R positive _ ((LocalMap.ofExists + (Replication.repair_branches (fun _ : I => current) + (fun _ : I => Tensor.directSum (fun _ : J => next)) + (fun _ => map.x) (fun _ => map.y) (fun _ => map.z) + (fun _ => map.coefficient))).comp (LocalMap.flatten next I J)) + +@[simp] theorem branchOperation_copies {I J R : Type} + [Fintype I] [Fintype J] [Fintype R] + (current : Tensor F X Y Z) (next : Tensor F X' Y' Z') + [Fintype X'] [Fintype Y'] [Fintype Z'] + (E : Execution source (Tensor.directSum (fun _ : I => current))) + (positive : 0 < Fintype.card R) + (map : LocalMap (Tensor.directSum (fun _ : R => current)) + (Tensor.directSum (fun _ : J => next))) : + Fintype.card (branchOperation current next E positive map).Copies = + Fintype.card R * Fintype.card E.Copies := by + change Fintype.card (R × E.Copies) = _ + exact Fintype.card_prod R E.Copies + +@[simp] theorem step_copies (E : Execution source current) (R : Type) [Fintype R] + (positive : 0 < Fintype.card R) (target : Tensor F X' Y' Z') + (map : LocalMap (Tensor.directSum (fun _ : R => current)) target) : + Fintype.card (E.step R positive target map).Copies = + Fintype.card R * Fintype.card E.Copies := by + change Fintype.card (R × E.Copies) = _ + exact Fintype.card_prod R E.Copies + +def extractAndRepair (E : Execution source current) {I : Type} [Fintype I] + (assignment : JointExtraction.Assignment X Y Z I) + (coherent : JointExtraction.Coherent current assignment) + (ideal : I → Tensor F X Y Z) (L : ℕ) + (repair : ∀ i, InverseLinearRecovery.RecoveredBy (ideal i) + (JointExtraction.branch current assignment i) L) : + Execution source (Tensor.directSum ideal) := by + let extracted := E.restrict _ (LocalMap.extract current assignment coherent) + exact extracted.step (InverseLinearRecovery.MaskRectangles L) + (by simp [InverseLinearRecovery.MaskRectangles]) _ + ((LocalMap.repairBranches (JointExtraction.branch current assignment) ideal L repair).withSource _ + (by funext x y z; simp only [Tensor.directSum]; split_ifs <;> rfl)) + +@[simp] theorem extractAndRepair_copies (E : Execution source current) + {I : Type} [Fintype I] + (assignment : JointExtraction.Assignment X Y Z I) + (coherent : JointExtraction.Coherent current assignment) + (ideal : I → Tensor F X Y Z) (L : ℕ) + (repair : ∀ i, InverseLinearRecovery.RecoveredBy (ideal i) + (JointExtraction.branch current assignment i) L) : + Fintype.card (E.extractAndRepair assignment coherent ideal L repair).Copies = + 2 ^ (3 * L) * Fintype.card E.Copies := by + change Fintype.card (InverseLinearRecovery.MaskRectangles L × E.Copies) = _ + rw [Fintype.card_prod, ExactRecovery.card_mask_rectangles, Fintype.card_fin] + +def extractSelectedAndRepair (E : Execution source current) + {I J : Type} [Fintype I] [Fintype J] + (assignment : JointExtraction.Assignment X Y Z I) + (coherent : JointExtraction.Coherent current assignment) + (select : J → I) (injective : Function.Injective select) + (ideal : J → Tensor F X Y Z) (L : ℕ) + (repair : ∀ j, InverseLinearRecovery.RecoveredBy (ideal j) + (JointExtraction.branch current assignment (select j)) L) : + Execution source (Tensor.directSum ideal) := by + let extracted := E.restrict _ (LocalMap.extract current assignment coherent) + let selected := extracted.restrict _ + (LocalMap.selectBranches (JointExtraction.branch current assignment) select injective) + exact selected.step (InverseLinearRecovery.MaskRectangles L) + (by simp [InverseLinearRecovery.MaskRectangles]) _ + ((LocalMap.repairBranches (fun j => JointExtraction.branch current assignment (select j)) + ideal L repair).withSource _ + (by funext x y z; simp only [Tensor.directSum]; split_ifs <;> rfl)) + +@[simp] theorem extractSelectedAndRepair_copies (E : Execution source current) + {I J : Type} [Fintype I] [Fintype J] + (assignment : JointExtraction.Assignment X Y Z I) + (coherent : JointExtraction.Coherent current assignment) + (select : J → I) (injective : Function.Injective select) + (ideal : J → Tensor F X Y Z) (L : ℕ) + (repair : ∀ j, InverseLinearRecovery.RecoveredBy (ideal j) + (JointExtraction.branch current assignment (select j)) L) : + Fintype.card + (E.extractSelectedAndRepair assignment coherent select injective ideal L repair).Copies = + 2 ^ (3 * L) * Fintype.card E.Copies := by + change Fintype.card (InverseLinearRecovery.MaskRectangles L × E.Copies) = _ + rw [Fintype.card_prod, ExactRecovery.card_mask_rectangles, Fintype.card_fin] + +end Execution + +section Schedule + +variable {SX SY SZ : Type} [Fintype SX] [Fintype SY] [Fintype SZ] + {X Y Z : ℕ → Type} [∀ n, Fintype (X n)] [∀ n, Fintype (Y n)] [∀ n, Fintype (Z n)] + (source : Tensor F SX SY SZ) (tensor : ∀ n, Tensor F (X n) (Y n) (Z n)) + (start : Execution source (tensor 0)) + (Copies : ℕ → Type) [∀ n, Fintype (Copies n)] + (positive : ∀ n, 0 < Fintype.card (Copies n)) + (maps : ∀ n, LocalMap (Tensor.directSum (fun _ : Copies n => tensor n)) (tensor (n + 1))) + +def run : (n : ℕ) → Execution source (tensor n) + | 0 => start + | n + 1 => (run n).step (Copies n) (positive n) (tensor (n + 1)) (maps n) + +theorem run_copies (n : ℕ) : + Fintype.card (run source tensor start Copies positive maps n).Copies = + Fintype.card start.Copies * ∏ j ∈ Finset.range n, Fintype.card (Copies j) := by + induction n with + | zero => simp [run]; rfl + | succ n ih => + rw [run, Execution.step_copies, ih, Finset.prod_range_succ] + ring + +end Schedule + +section CWSource + +variable {K N a b c L : ℕ} + +abbrev cwSource (F : Type*) [Field F] (K N : ℕ) := + Tensor.power (FieldCW.tensor F 5) (8 * K * N) + +def startCW (F : Type*) [Field F] (K N : ℕ) : + Execution (cwSource F K N) (cwSource F K N) := + Execution.initial _ + +def Execution.toWitness + (E : Execution (cwSource F K N) (AllFieldSource.matrixTarget F a b c L)) + (ha : 0 < a) (hb : 0 < b) (hc : 0 < c) (hL : 0 < L) : AllFieldWitness F := + AllFieldSource.ofRestriction E.map.x E.map.y E.map.z + (fun x y z => congrFun (congrFun (congrFun E.map.coefficient x) y) z) + E.copies_positive ha hb hc hL + +@[simp] theorem Execution.toWitness_rankBound + (E : Execution (cwSource F K N) (AllFieldSource.matrixTarget F a b c L)) + (ha : 0 < a) (hb : 0 < b) (hc : 0 < c) (hL : 0 < L) : + (E.toWitness ha hb hc hL).rankBound = + Fintype.card E.Copies * ((3 * (8 * K * N) + 1) ^ 2 * 7 ^ (8 * K * N)) := rfl + +end CWSource + +end MatrixMultiplication.AllFieldFiniteFamily + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldConstruction/InitialChoice.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldConstruction/InitialChoice.lean new file mode 100644 index 0000000000000000000000000000000000000000..5372b45eca1a2ef1ebcf7364ffd6b49f2a667f41 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldConstruction/InitialChoice.lean @@ -0,0 +1,85 @@ +import OAI.LinearAlgebra.MatrixMultiplication.FieldConstruction.InitialFamily +import OAI.LinearAlgebra.MatrixMultiplication.FieldConstruction.ConstructionLabels + +namespace OAI + +/-! Tensor extraction over arbitrary fields and its asymptotic rate. -/ + +noncomputable section + +namespace MatrixMultiplication.AllFieldInitialChoice + +open MatrixMultiplication.Foundation AllFieldHistory AllFieldFiniteFamily Filter +open scoped BigOperators Topology Classical + +variable {K : ℕ} + +structure Choice (allocation : Allocation) (m : ℕ) (δ : ℝ) where + sample : AllFieldInitialFamily.Sample (K := K) allocation + (δ / (AllFieldInitialFamily.grid (K := K) allocation : ℝ)) m + selected : Finset (JointPopulation.Target (initialJointCounts (K := K) allocation m)) + card_selected : selected.card = AllFieldConstructionRates.initialCount (K := K) allocation δ m + good : ∀ e ∈ selected, AllFieldInitialFamily.Good allocation + (δ / (AllFieldInitialFamily.grid (K := K) allocation : ℝ)) m sample e + +theorem initial_count_eq (allocation : Allocation) (m : ℕ) (δ : ℝ) : + ⌊Real.exp ((populationLength (K := K) allocation m : ℝ) * + ((K : ℝ) * AllFieldInitialEntropy.nativeH0 - + δ / (AllFieldInitialFamily.grid (K := K) allocation : ℝ)))⌋₊ = + AllFieldConstructionRates.initialCount (K := K) allocation δ m := by + rw [AllFieldConstructionRates.initialCount_eq, + AllFieldInitialFamily.populationLength_eq_mul_grid, Nat.cast_mul] + congr 2 + change ((m : ℝ) * (AllFieldInitialFamily.grid (K := K) allocation : ℝ)) * + ((K : ℝ) * AllFieldInitialEntropy.nativeH0 - + δ / (AllFieldInitialFamily.grid (K := K) allocation : ℝ)) = + (m : ℝ) * ((AllFieldInitialFamily.grid (K := K) allocation : ℝ) * + ((K : ℝ) * AllFieldInitialEntropy.nativeH0) - δ) + have hD : (AllFieldInitialFamily.grid (K := K) allocation : ℝ) ≠ 0 := + Nat.cast_ne_zero.mpr (AllFieldInitialFamily.grid_pos allocation).ne' + field_simp [hD] + +theorem eventually_nonempty (allocation : Allocation) {δ : ℝ} (hδ : 0 < δ) : + ∀ᶠ m : ℕ in atTop, Nonempty (Choice (K := K) allocation m δ) := by + have hs : 0 < δ / (AllFieldInitialFamily.grid (K := K) allocation : ℝ) := + div_pos hδ (Nat.cast_pos.mpr (AllFieldInitialFamily.grid_pos allocation)) + have h := AllFieldInitialFamily.eventually_exists_execution_with_width + (K := K) allocation ℚ 0 hs + filter_upwards [h] with m hm + obtain ⟨sample, selected, hcard, hgood, _execution⟩ := hm + exact ⟨{ + sample := sample + selected := selected + card_selected := hcard.trans (initial_count_eq allocation m δ) + good := hgood }⟩ + +abbrev Tags (allocation : Allocation) (m : ℕ) (δ : ℝ) + (choice : Choice (K := K) allocation m δ) := + AllFieldInitialHash.SelectedTargets (initialJointCounts (K := K) allocation m) + choice.selected + +@[simp] theorem card_tags (allocation : Allocation) (m : ℕ) (δ : ℝ) + (choice : Choice (K := K) allocation m δ) : + Fintype.card (Tags allocation m δ choice) = + AllFieldConstructionRates.initialCount (K := K) allocation δ m := by + rw [AllFieldInitialHash.selectedTargets_card] + exact choice.card_selected + +def execution (allocation : Allocation) (m : ℕ) (δ : ℝ) + (choice : Choice (K := K) allocation m δ) (F : Type*) [Field F] (ε : ℝ) : + Execution (cwSource F K (populationLength (K := K) allocation m)) + (Tensor.directSum (fun _ : Tags allocation m δ choice => + stateTensor F (K := K) allocation m ε 0)) := + AllFieldInitialFamily.executionWithWidth allocation F + (δ / (AllFieldInitialFamily.grid (K := K) allocation : ℝ)) ε m + choice.sample choice.selected choice.good + +@[simp] theorem execution_copies (allocation : Allocation) (m : ℕ) (δ : ℝ) + (choice : Choice (K := K) allocation m δ) (F : Type*) [Field F] (ε : ℝ) : + Fintype.card (execution allocation m δ choice F ε).Copies = 1 := rfl + +end MatrixMultiplication.AllFieldInitialChoice + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldConstruction/InitialEntropy.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldConstruction/InitialEntropy.lean new file mode 100644 index 0000000000000000000000000000000000000000..3a3de0f4acc22e26fcf87c11861335fe0ca3de8b --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldConstruction/InitialEntropy.lean @@ -0,0 +1,204 @@ +import OAI.LinearAlgebra.MatrixMultiplication.FieldConstruction.InitialHistories +import OAI.LinearAlgebra.MatrixMultiplication.FieldParameters.Entropy +import OAI.LinearAlgebra.MatrixMultiplication.JointExtraction.OrdinaryPopulationSelection + +namespace OAI + +/-! Tensor extraction over arbitrary fields and its asymptotic rate. -/ + +noncomputable section + +namespace MatrixMultiplication.AllFieldInitialEntropy + +open AllFieldParameters AllFieldHistory MatrixMultiplication.Foundation +open JointPopulationRates JointOrdinaryPopulationSelection +open scoped BigOperators + +abbrev PlacedInitial := Fin sortedInitial.length × Placement + +theorem placement_read_card : ∀ s w : Fin 3, + Fintype.card {phi : Placement // phi.symm s = w} = 2 := by + decide +kernel + +theorem sum_placement_read (s : Fin 3) (f : Fin 3 → ℝ) : + (∑ phi : Placement, f (phi.symm s)) = 2 * ∑ w, f w := by + classical + rw [← Fintype.sum_fiberwise' (fun phi : Placement => phi.symm s) f] + simp only [Finset.sum_const, Finset.card_univ, placement_read_card, + nsmul_eq_mul, Nat.cast_ofNat, ← Finset.mul_sum] + +def initialShapeCode (p : PlacedInitial) : JointPopulation.Shape := + rootShape ((0 : Fin 1), p.1) p.2 + +@[simp] theorem initialShapeCode_side (p : PlacedInitial) (s : Fin 3) : + (JointPopulation.shapeSide s (initialShapeCode p)).val = + sortedInitial.get p.1 (p.2.symm s) := by + simp only [initialShapeCode, rootShape, encodePhysicalShape_side, initialShape] + +@[simp] theorem rootShape_eq_initialShapeCode {K : ℕ} (j : Fin K) + (g : Fin sortedInitial.length) (phi : Placement) : + rootShape (j, g) phi = initialShapeCode (g, phi) := rfl + +def placedInitialLaw : FiniteLaw PlacedInitial where + mass p := (initialLaw (sortedInitial.get p.1) : ℝ) / 6 + nonneg p := div_nonneg (by + exact_mod_cast (initialLaw_positive _ (List.get_mem _ _)).le) (by norm_num) + total := by + have hsum : (∑ g : Fin sortedInitial.length, + (initialLaw (sortedInitial.get g) : ℝ)) = 1 := by + exact_mod_cast initial_amount_sum 1 (0 : Fin 1) + rw [Fintype.sum_prod_type] + simp only [Finset.sum_const, Finset.card_univ, + PhysicalOrders.card_physical_orders, nsmul_eq_mul] + calc + _ = ∑ g : Fin sortedInitial.length, + (initialLaw (sortedInitial.get g) : ℝ) := by + apply Finset.sum_congr rfl + intro g _ + ring + _ = 1 := hsum + +def orderedInitialLaw : FiniteLaw JointPopulation.Shape := + placedInitialLaw.map initialShapeCode + +def nativeInitialMarginal (k : Fin 17) : ℝ := + ∑ g : Fin sortedInitial.length, + (initialLaw (sortedInitial.get g) : ℝ) * + (∑ w : Fin 3, if sortedInitial.get g w = k.val then 1 else 0) / 3 + +def nativeH0 : ℝ := homogeneousEntropy nativeInitialMarginal + +theorem nativeInitialMarginal_eq_list (k : Fin 17) : + nativeInitialMarginal k = + (sortedInitial.map (fun g => (initialLaw g : ℝ) * + (∑ w : Fin 3, if g w = k.val then 1 else 0) / 3)).sum := by + unfold nativeInitialMarginal + simpa only [List.get_eq_getElem] using + (Fin.sum_univ_fun_getElem sortedInitial (fun g => (initialLaw g : ℝ) * + (∑ w : Fin 3, if g w = k.val then 1 else 0) / 3)) + +theorem sideMass_orderedInitialLaw (s : Fin 3) (k : Fin 17) : + sideMass orderedInitialLaw.mass s k = + ∑ p : PlacedInitial, + if JointPopulation.shapeSide s (initialShapeCode p) = k + then placedInitialLaw.mass p else 0 := by + classical + unfold sideMass orderedInitialLaw + simp only [FiniteLaw.map_mass] + calc + _ = ∑ u : JointPopulation.Shape, ∑ p : PlacedInitial, + if initialShapeCode p = u then + if JointPopulation.shapeSide s u = k then placedInitialLaw.mass p else 0 + else 0 := by + apply Finset.sum_congr rfl + intro u _ + by_cases hu : JointPopulation.shapeSide s u = k <;> simp [hu] + _ = _ := by rw [Finset.sum_comm]; simp + +theorem orderedInitialLaw_sideMass (s : Fin 3) : + sideMass orderedInitialLaw.mass s = nativeInitialMarginal := by + classical + funext k + rw [sideMass_orderedInitialLaw, Fintype.sum_prod_type] + unfold nativeInitialMarginal + apply Finset.sum_congr rfl + intro g _ + have hside (phi : Placement) : + JointPopulation.shapeSide s (initialShapeCode (g, phi)) = k ↔ + sortedInitial.get g (phi.symm s) = k.val := by + rw [← Fin.val_inj, initialShapeCode_side] + simp only [hside, placedInitialLaw] + calc + _ = ∑ phi : Placement, ((initialLaw (sortedInitial.get g) : ℝ) / 6) * + (if sortedInitial.get g (phi.symm s) = k.val then 1 else 0) := by + apply Finset.sum_congr rfl + intro phi _ + split_ifs <;> ring + _ = ((initialLaw (sortedInitial.get g) : ℝ) / 6) * + (2 * ∑ w : Fin 3, if sortedInitial.get g w = k.val then 1 else 0) := by + rw [← Finset.mul_sum, + sum_placement_read s (fun w : Fin 3 => + if sortedInitial.get g w = k.val then 1 else 0)] + _ = _ := by ring + +theorem nativeInitialMarginal_total : ∑ k, nativeInitialMarginal k = 1 := by + rw [← orderedInitialLaw_sideMass 0, sideMass_total, orderedInitialLaw.total] + +theorem nativeInitialMarginal_nonneg (k : Fin 17) : 0 ≤ nativeInitialMarginal k := by + rw [← orderedInitialLaw_sideMass 0] + simpa only [FiniteLaw.map_mass, sideMass] using + (orderedInitialLaw.map (JointPopulation.shapeSide 0)).nonneg k + +theorem nativeH0_eq_finiteEntropy : nativeH0 = finiteEntropy nativeInitialMarginal := + homogeneousEntropy_normalized _ nativeInitialMarginal_total + +theorem orderedInitialLaw_side_entropy (s : Fin 3) : + finiteEntropy (sideMass orderedInitialLaw.mass s) = nativeH0 := by + rw [orderedInitialLaw_sideMass, nativeH0_eq_finiteEntropy] + +theorem ordinary_capacity_per_lot : + finiteEntropy orderedInitialLaw.mass - + max (finiteEntropy orderedInitialLaw.mass - + finiteEntropy (sideMass orderedInitialLaw.mass 0)) + (max (finiteEntropy orderedInitialLaw.mass - + finiteEntropy (sideMass orderedInitialLaw.mass 1)) + (finiteEntropy orderedInitialLaw.mass - + finiteEntropy (sideMass orderedInitialLaw.mass 2))) = nativeH0 := by + simp only [orderedInitialLaw_side_entropy, max_self] + ring + +theorem ordinary_capacity_all_lots (K : ℕ) : + entropyRate (fun _ : Fin K => 1) (fun _ => orderedInitialLaw) - + degreeRate (fun _ : Fin K => 1) (fun _ => orderedInitialLaw) = + (K : ℝ) * nativeH0 := by + simp only [entropyRate, degreeRate, sideDegreeRate, one_mul, + orderedInitialLaw_side_entropy, Finset.sum_const, Finset.card_univ, + Fintype.card_fin, nsmul_eq_mul, max_self] + ring + +theorem population_cast_real {K : ℕ} (allocation : Allocation) (dilation : ℕ) + (h : History K) : + (population allocation dilation h : ℝ) = + (populationLength (K := K) allocation dilation : ℝ) * + (amount allocation h : ℝ) := by + exact_mod_cast population_cast allocation dilation h + +theorem initialJointCounts_cast {K : ℕ} (allocation : Allocation) (dilation : ℕ) + (j : Fin K) (u : JointPopulation.Shape) : + (initialJointCounts allocation dilation j u : ℝ) = + (populationLength (K := K) allocation dilation : ℝ) * orderedInitialLaw.mass u := by + classical + unfold initialJointCounts shapeCounts orderedInitialLaw + simp only [FiniteLaw.map_mass, Nat.cast_sum, Finset.mul_sum, + rootShape_eq_initialShapeCode] + apply Finset.sum_congr rfl + intro p _ + by_cases hp : initialShapeCode p = u + · simp only [hp, ite_true, population_cast_real, placedInitialLaw] + congr 1 + simp only [amount, canonicalAmount, initialAmount, initialShape, + Rat.cast_div, Rat.cast_ofNat] + · simp [hp] + +theorem initialJointCounts_ratio {K : ℕ} (allocation : Allocation) {dilation : ℕ} + (hd : 0 < dilation) (j : Fin K) (u : JointPopulation.Shape) : + (initialJointCounts allocation dilation j u : ℝ) / + populationLength (K := K) allocation dilation = orderedInitialLaw.mass u := by + classical + rw [initialJointCounts_cast] + have hp : (populationLength (K := K) allocation dilation : ℝ) ≠ 0 := by + exact_mod_cast (ne_of_gt + (AllFieldPopulationCounts.blockLength_pos (amount (K := K) allocation) hd)) + exact mul_div_cancel_left₀ _ hp + +theorem initialJointCounts_sideMass {K : ℕ} (allocation : Allocation) {dilation : ℕ} + (hd : 0 < dilation) (j : Fin K) (s : Fin 3) : + sideMass (fun u => (initialJointCounts allocation dilation j u : ℝ) / + populationLength (K := K) allocation dilation) s = nativeInitialMarginal := by + simp only [initialJointCounts_ratio allocation hd, orderedInitialLaw_sideMass] + +end MatrixMultiplication.AllFieldInitialEntropy + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldConstruction/InitialExact.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldConstruction/InitialExact.lean new file mode 100644 index 0000000000000000000000000000000000000000..8c1ffb4ad26edbc8c2c43c87dea2d68538239b18 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldConstruction/InitialExact.lean @@ -0,0 +1,172 @@ +import OAI.LinearAlgebra.MatrixMultiplication.FieldConstruction.InitialStep +import OAI.LinearAlgebra.MatrixMultiplication.JointExtraction.AssignmentLoss + +namespace OAI + +/-! Tensor extraction over arbitrary fields and its asymptotic rate. -/ + +noncomputable section + +namespace MatrixMultiplication.AllFieldInitialExact + +open MatrixMultiplication.Foundation AllFieldFiniteFamily AllFieldInitialStep +open JointPopulation JointCoarseAssignment JointExtraction JointAssignmentLoss +open scoped BigOperators Classical + +attribute [local instance] Classical.propDecidable + +private def assignedDeletion {F X Y Z A B C : Type*} [CommSemiring F] + (T : Tensor F X Y Z) (a : Assignment X Y Z (Triple A B C)) (e : Triple A B C) + (px : X → Prop) (py : Y → Prop) (pz : Z → Prop) : Tensor F X Y Z := + ExactRecovery.delete T (fun x => a.x x = some e ∧ px x) + (fun y => a.y y = some e ∧ py y) (fun z => a.z z = some e ∧ pz z) + +private theorem assignedDeletion_eq_self_of_support {F X Y Z A B C : Type*} + [CommSemiring F] (T : Tensor F X Y Z) + (a : Assignment X Y Z (Triple A B C)) (e : Triple A B C) + (px : X → Prop) (py : Y → Prop) (pz : Z → Prop) + (support : ∀ x y z, T x y z ≠ 0 → + (a.x x = some e ∧ px x) ∧ (a.y y = some e ∧ py y) ∧ (a.z z = some e ∧ pz z)) : + assignedDeletion T a e px py pz = T := by + funext x y z + unfold assignedDeletion ExactRecovery.delete + by_cases ht : T x y z = 0 + · simp only [ht, ite_self] + · exact ite_eq_left (support x y z ht) + +variable {K N : ℕ} + (counts : Fin K → Shape → ℕ) + (hx hy hz : CoarseWord counts → Prop) + +def Isolated (e : Target counts) : Prop := + survives hx hy hz (triple counts e) ∧ + ∀ f ∈ ambientSet counts (fun _ => 16), survives hx hy hz f → + JointCoarseHashing.SharesSide (triple counts e) f → f = triple counts e + +section Coefficients + +variable {F : Type*} [CommRing F] + +theorem assignments_on_ideal (e : Target counts) + (ha : triple counts e ∈ ambientSet counts (fun _ => 16)) + (isolated : Isolated counts hx hy hz e) + (x y z : JointCanonicalInitial.RawWords counts) + (nonzero : JointCanonicalInitial.ideal (F := F) counts e x y z ≠ 0) : + (ordinaryAssignments counts hx hy hz).x x = some (triple counts e) ∧ + (ordinaryAssignments counts hx hy hz).y y = some (triple counts e) ∧ + (ordinaryAssignments counts hx hy hz).z z = some (triple counts e) := by + have hc : JointCanonicalInitial.coarseWord counts x = (triple counts e).1 ∧ + JointCanonicalInitial.coarseWord counts y = (triple counts e).2.1 ∧ + JointCanonicalInitial.coarseWord counts z = (triple counts e).2.2 := by + by_contra hn + simp [JointCanonicalInitial.ideal, JointIdealBranches.ideal, ExactRecovery.delete, hn] + at nonzero + have ht : triple counts e ∈ targetSet counts := + Finset.mem_image.mpr ⟨e, Finset.mem_univ _, rfl⟩ + have he : triple counts e ∈ eligible (ambientSet counts (fun _ => 16)) + (targetSet counts) hx hy hz := by + apply (mem_eligible_iff _ _ _ _ _ _).2 + exact ⟨ha, ht, isolated.1, fun f hf hs hfx => isolated.2 f hf hs (Or.inl hfx)⟩ + constructor + · apply assignUseful_of_unique _ _ _ _ _ he hc.1 trivial + intro f hf hfx + have hm := (mem_eligible_iff _ _ _ _ _ _).1 hf + exact isolated.2 f hm.1 hm.2.2.1 (Or.inl (hfx.symm.trans hc.1)) + constructor + · apply assignUseful_of_unique _ _ _ _ _ he ⟨hc.2.1, trivial⟩ trivial + intro f hf hfy + have hm := (mem_eligible_iff _ _ _ _ _ _).1 hf + exact isolated.2 f hm.1 hm.2.2.1 (Or.inr (Or.inl (hfy.1.symm.trans hc.2.1))) + · apply assignUseful_of_unique _ _ _ _ _ he ⟨hc.2.2, trivial⟩ trivial + intro f hf hfz + have hm := (mem_eligible_iff _ _ _ _ _ _).1 hf + exact isolated.2 f hm.1 hm.2.2.1 (Or.inr (Or.inr (hfz.1.symm.trans hc.2.2))) + +private theorem branch_eq_masked_ideal (e : Target counts) : + branch (JointCanonicalInitial.maskedSource (F := F) counts) + (ordinaryAssignments counts hx hy hz) (triple counts e) = + assignedDeletion (JointCanonicalInitial.ideal counts e) + (ordinaryAssignments counts hx hy hz) (triple counts e) + (JointCanonicalInitial.sideMask counts 0) (JointCanonicalInitial.sideMask counts 1) + (JointCanonicalInitial.sideMask counts 2) := + JointIdealBranches.branch_masked_eq_delete_ideal + (JointCanonicalInitial.rawSource (F := F) counts) + (JointCanonicalInitial.sideMask counts 0) (JointCanonicalInitial.sideMask counts 1) + (JointCanonicalInitial.sideMask counts 2) (ambientSet counts (fun _ => 16)) (targetSet counts) + hx hy hz (JointCanonicalInitial.coarseWord counts) (JointCanonicalInitial.coarseWord counts) + (JointCanonicalInitial.coarseWord counts) (fun _ _ => True) (fun _ _ => True) + (fun _ _ => True) (fun _ _ => True) (fun _ _ => True) (triple counts e) + +theorem branch_eq_ideal (e : Target counts) + (ha : triple counts e ∈ ambientSet counts (fun _ => 16)) + (isolated : Isolated counts hx hy hz e) : + branch (JointCanonicalInitial.maskedSource (F := F) counts) + (ordinaryAssignments counts hx hy hz) (triple counts e) = + JointCanonicalInitial.ideal counts e := by + have hdelete : assignedDeletion (JointCanonicalInitial.ideal (F := F) counts e) + (ordinaryAssignments counts hx hy hz) (triple counts e) + (JointCanonicalInitial.sideMask counts 0) (JointCanonicalInitial.sideMask counts 1) + (JointCanonicalInitial.sideMask counts 2) = + JointCanonicalInitial.ideal counts e := by + apply assignedDeletion_eq_self_of_support + intro x y z hh + have hm := JointCanonicalInitial.ideal_support_masks counts e x y z hh + have ha := assignments_on_ideal counts hx hy hz e ha isolated x y z hh + exact ⟨⟨ha.1, hm.1⟩, ⟨ha.2.1, hm.2.1⟩, ⟨ha.2.2, hm.2.2⟩⟩ + exact (branch_eq_masked_ideal counts hx hy hz e).trans hdelete + +end Coefficients + +section Execution + +variable {F : Type*} [Field F] + +def selectedExecution (total : ∀ h, ∑ u, counts h u = N) + {I : Type} [Fintype I] (target : I → Target counts) + (injective : Function.Injective target) + (ambient : ∀ i, triple counts (target i) ∈ ambientSet counts (fun _ => 16)) + (isolated : ∀ i, Isolated counts hx hy hz (target i)) : + Execution (cwSource F K N) + (Tensor.directSum (fun _ : I => JointCanonicalInitial.canonical counts)) := by + let input := maskedInitialExecution (F := F) counts total + let extracted := input.restrict _ + (LocalMap.extract (JointCanonicalInitial.maskedSource counts) + (ordinaryAssignments counts hx hy hz) (ordinaryAssignments_coherent counts hx hy hz)) + let selected := extracted.restrict _ + (LocalMap.selectBranches + (branch (JointCanonicalInitial.maskedSource counts) (ordinaryAssignments counts hx hy hz)) + (fun i => triple counts (target i)) ((triple_injective counts).comp injective)) + have heq : Tensor.directSum (fun i => branch (JointCanonicalInitial.maskedSource (F := F) counts) + (ordinaryAssignments counts hx hy hz) (triple counts (target i))) = + Tensor.directSum (fun i => JointCanonicalInitial.ideal counts (target i)) := by + apply congrArg Tensor.directSum + funext i + exact branch_eq_ideal counts hx hy hz (target i) (ambient i) (isolated i) + let idMap := LocalMap.identity (Tensor.directSum (fun i => + branch (JointCanonicalInitial.maskedSource (F := F) counts) + (ordinaryAssignments counts hx hy hz) (triple counts (target i)))) + let sameCoordinates : LocalMap + (Tensor.directSum (fun i => branch (JointCanonicalInitial.maskedSource (F := F) counts) + (ordinaryAssignments counts hx hy hz) (triple counts (target i)))) + (Tensor.directSum (fun i => JointCanonicalInitial.ideal counts (target i))) := + { x := idMap.x + y := idMap.y + z := idMap.z + coefficient := idMap.coefficient.trans heq } + exact AllFieldInitialStep.canonicalize counts target (selected.restrict _ sameCoordinates) + +@[simp] theorem selectedExecution_copies (total : ∀ h, ∑ u, counts h u = N) + {I : Type} [Fintype I] (target : I → Target counts) + (injective : Function.Injective target) + (ambient : ∀ i, triple counts (target i) ∈ ambientSet counts (fun _ => 16)) + (isolated : ∀ i, Isolated counts hx hy hz (target i)) : + Fintype.card (selectedExecution (F := F) counts hx hy hz total target + injective ambient isolated).Copies = 1 := rfl + +end Execution + +end MatrixMultiplication.AllFieldInitialExact + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldConstruction/InitialFamily.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldConstruction/InitialFamily.lean new file mode 100644 index 0000000000000000000000000000000000000000..90a7f1162ababc1a61d51fc2ab93edc9ff2bf0ee --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldConstruction/InitialFamily.lean @@ -0,0 +1,177 @@ +import OAI.LinearAlgebra.MatrixMultiplication.FieldConstruction.InitialHash +import OAI.LinearAlgebra.MatrixMultiplication.FieldConstruction.InitialState +import OAI.LinearAlgebra.MatrixMultiplication.FieldConstruction.InitialGibbs + +namespace OAI + +/-! Tensor extraction over arbitrary fields and its asymptotic rate. -/ + +noncomputable section + +namespace MatrixMultiplication.AllFieldInitialFamily + +open MatrixMultiplication.Foundation AllFieldParameters AllFieldHistory AllFieldFiniteFamily +open AllFieldInitialEntropy JointOrdinaryPopulationSelection Filter +open scoped BigOperators Topology + +attribute [local instance] Classical.propDecidable + +variable {K : ℕ} (allocation : Allocation) + +def grid : ℕ := populationLength (K := K) allocation 1 + +theorem grid_pos : 0 < grid (K := K) allocation := + AllFieldPopulationCounts.blockLength_pos (amount (K := K) allocation) (by decide) + +theorem populationLength_eq_mul_grid (dilation : ℕ) : + populationLength (K := K) allocation dilation = dilation * grid (K := K) allocation := by + simp only [grid, populationLength, AllFieldPopulationCounts.blockLength, one_mul] + +theorem initialJointCounts_dilation_ratio {dilation : ℕ} (hd : 0 < dilation) + (j : Fin K) (u : JointPopulation.Shape) : + (initialJointCounts allocation dilation j u : ℝ) / (dilation : ℝ) = + (grid (K := K) allocation : ℝ) * orderedInitialLaw.mass u := by + rw [initialJointCounts_cast, populationLength_eq_mul_grid, Nat.cast_mul, mul_assoc] + have hd' : (dilation : ℝ) ≠ 0 := Nat.cast_ne_zero.mpr (Nat.ne_of_gt hd) + exact mul_div_cancel_left₀ _ hd' + +theorem initialJointCounts_dilation_rate (j : Fin K) (u : JointPopulation.Shape) : + Tendsto (fun dilation : ℕ => + (initialJointCounts allocation dilation j u : ℝ) / (dilation : ℝ)) atTop + (𝓝 ((grid (K := K) allocation : ℝ) * orderedInitialLaw.mass u)) := by + apply tendsto_const_nhds.congr' + filter_upwards [eventually_gt_atTop (0 : ℕ)] with dilation hd + exact (initialJointCounts_dilation_ratio allocation hd j u).symm + +theorem native_dilation_capacity : + entropyRate (fun _ : Fin K => (grid (K := K) allocation : ℝ)) + (fun _ => orderedInitialLaw) - + degreeRate (fun _ : Fin K => (grid (K := K) allocation : ℝ)) + (fun _ => orderedInitialLaw) = + (grid (K := K) allocation : ℝ) * ((K : ℝ) * nativeH0) := by + simp only [entropyRate, degreeRate, sideDegreeRate, orderedInitialLaw_side_entropy, + Finset.sum_const, Finset.card_univ, Fintype.card_fin, nsmul_eq_mul, max_self] + ring + +def hashRate (ε : ℝ) : ℝ := + selectionHashRate (fun _ : Fin K => (grid (K := K) allocation : ℝ)) + (fun _ => orderedInitialLaw) ((grid (K := K) allocation : ℝ) * ε) + +theorem selection_exponent (ε : ℝ) (dilation : ℕ) : + (dilation : ℝ) * + (entropyRate (fun _ : Fin K => (grid (K := K) allocation : ℝ)) + (fun _ => orderedInitialLaw) - + degreeRate (fun _ : Fin K => (grid (K := K) allocation : ℝ)) + (fun _ => orderedInitialLaw) - (grid (K := K) allocation : ℝ) * ε) = + (populationLength (K := K) allocation dilation : ℝ) * ((K : ℝ) * nativeH0 - ε) := by + rw [native_dilation_capacity, populationLength_eq_mul_grid, Nat.cast_mul] + ring + +abbrev Sample (ε : ℝ) (dilation : ℕ) := + JointCoarseHashing.Sample (JointPopulation.Position + (initialJointCounts (K := K) allocation dilation)) + (JointOrdinarySelection.hashLevel (hashRate (K := K) allocation ε) dilation) + +def Good (ε : ℝ) (dilation : ℕ) + (s : Sample (K := K) allocation ε dilation) + (e : JointPopulation.Target (initialJointCounts (K := K) allocation dilation)) : Prop := + JointOrdinarySelection.Good + (JointOrdinarySelection.hashLevel (hashRate (K := K) allocation ε) dilation) + (JointOrdinarySelection.hashSet (hashRate (K := K) allocation ε) dilation) + (JointPopulation.ambientSet (initialJointCounts allocation dilation) (fun _ => 16)) + (JointPopulation.triple (initialJointCounts allocation dilation) e) s + +def executionWithWidth (F : Type*) [Field F] (ε residentWidth : ℝ) (dilation : ℕ) + (s : Sample (K := K) allocation ε dilation) + (G : Finset (JointPopulation.Target (initialJointCounts (K := K) allocation dilation))) + (hgood : ∀ e ∈ G, Good allocation ε dilation s e) : + Execution (cwSource F K (populationLength (K := K) allocation dilation)) + (Tensor.directSum (fun _ : AllFieldInitialHash.SelectedTargets + (initialJointCounts (K := K) allocation dilation) G => + stateTensor F (K := K) allocation dilation residentWidth 0)) := + AllFieldInitialState.execution allocation dilation F residentWidth + (AllFieldInitialHash.selectedExecution (F := F) + (initialJointCounts allocation dilation) (initialJointCounts_sum allocation dilation) + (initialJointCounts_support allocation dilation) + (JointOrdinarySelection.hashLevel (hashRate (K := K) allocation ε) dilation) + (JointOrdinarySelection.hashSet (hashRate (K := K) allocation ε) dilation) + (JointOrdinarySelection.hashSet_AP (hashRate (K := K) allocation ε) dilation) + s G hgood) + +@[simp] theorem executionWithWidth_copies (F : Type*) [Field F] + (ε residentWidth : ℝ) (dilation : ℕ) + (s : Sample (K := K) allocation ε dilation) + (G : Finset (JointPopulation.Target (initialJointCounts (K := K) allocation dilation))) + (hgood : ∀ e ∈ G, Good allocation ε dilation s e) : + Fintype.card + (executionWithWidth allocation F ε residentWidth dilation s G hgood).Copies = 1 := rfl + +def execution (F : Type*) [Field F] (ε : ℝ) (dilation : ℕ) + (s : Sample (K := K) allocation ε dilation) + (G : Finset (JointPopulation.Target (initialJointCounts (K := K) allocation dilation))) + (hgood : ∀ e ∈ G, Good allocation ε dilation s e) : + Execution (cwSource F K (populationLength (K := K) allocation dilation)) + (Tensor.directSum (fun _ : AllFieldInitialHash.SelectedTargets + (initialJointCounts (K := K) allocation dilation) G => + stateTensor F (K := K) allocation dilation ε 0)) := + executionWithWidth allocation F ε ε dilation s G hgood + +@[simp] theorem execution_copies (F : Type*) [Field F] (ε : ℝ) (dilation : ℕ) + (s : Sample (K := K) allocation ε dilation) + (G : Finset (JointPopulation.Target (initialJointCounts (K := K) allocation dilation))) + (hgood : ∀ e ∈ G, Good allocation ε dilation s e) : + Fintype.card (execution allocation F ε dilation s G hgood).Copies = 1 := rfl + +theorem eventually_exists_execution_with_width (F : Type*) [Field F] + (residentWidth : ℝ) {ε : ℝ} (hε : 0 < ε) : + ∀ᶠ dilation in atTop, + ∃ (s : Sample (K := K) allocation ε dilation) + (G : Finset (JointPopulation.Target (initialJointCounts (K := K) allocation dilation))), + G.card = ⌊Real.exp ((populationLength (K := K) allocation dilation : ℝ) * + ((K : ℝ) * nativeH0 - ε))⌋₊ ∧ + (∀ e ∈ G, Good allocation ε dilation s e) ∧ + ∃ E : Execution (cwSource F K (populationLength (K := K) allocation dilation)) + (Tensor.directSum (fun _ : AllFieldInitialHash.SelectedTargets + (initialJointCounts (K := K) allocation dilation) G => + stateTensor F (K := K) allocation dilation residentWidth 0)), + Fintype.card E.Copies = 1 := by + have hslack : 0 < (grid (K := K) allocation : ℝ) * ε := + mul_pos (by exact_mod_cast grid_pos (K := K) allocation) hε + have hselection := JointOrdinaryPopulationSelection.eventually_exists_selection + (fun dilation => initialJointCounts (K := K) allocation dilation) (fun _ => 16) + (fun _ : Fin K => (grid (K := K) allocation : ℝ)) (fun _ => orderedInitialLaw) + (fun _ => AllFieldInitialGibbs.initialPotential) + (fun _ => AllFieldInitialGibbs.initialPotential) + (fun _ => AllFieldInitialGibbs.initialPotential) + (fun _ => AllFieldInitialGibbs.initialLogNormalizer) + (fun _ => Nat.cast_nonneg _) + (fun dilation => initialJointCounts_support allocation dilation) + (fun _ => AllFieldInitialGibbs.orderedInitialLaw_positive) + (fun _ => AllFieldInitialGibbs.orderedInitialLaw_log) + (initialJointCounts_dilation_rate allocation) hslack + filter_upwards [hselection] with dilation hd + obtain ⟨s, G, hcard, hgood, _hpairwise⟩ := hd + rw [selection_exponent allocation ε dilation] at hcard + exact ⟨s, G, hcard, hgood, + executionWithWidth allocation F ε residentWidth dilation s G hgood, + executionWithWidth_copies allocation F ε residentWidth dilation s G hgood⟩ + +theorem eventually_exists_execution (F : Type*) [Field F] {ε : ℝ} (hε : 0 < ε) : + ∀ᶠ dilation in atTop, + ∃ (s : Sample (K := K) allocation ε dilation) + (G : Finset (JointPopulation.Target (initialJointCounts (K := K) allocation dilation))), + G.card = ⌊Real.exp ((populationLength (K := K) allocation dilation : ℝ) * + ((K : ℝ) * nativeH0 - ε))⌋₊ ∧ + (∀ e ∈ G, Good allocation ε dilation s e) ∧ + ∃ E : Execution (cwSource F K (populationLength (K := K) allocation dilation)) + (Tensor.directSum (fun _ : AllFieldInitialHash.SelectedTargets + (initialJointCounts (K := K) allocation dilation) G => + stateTensor F (K := K) allocation dilation ε 0)), + Fintype.card E.Copies = 1 := + eventually_exists_execution_with_width allocation F ε hε + +end MatrixMultiplication.AllFieldInitialFamily + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldConstruction/InitialGibbs.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldConstruction/InitialGibbs.lean new file mode 100644 index 0000000000000000000000000000000000000000..c974b4f192749d185ec72113fe7087618ff8a8bc --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldConstruction/InitialGibbs.lean @@ -0,0 +1,145 @@ +import OAI.LinearAlgebra.MatrixMultiplication.FieldConstruction.InitialOrbit +import Mathlib.Data.Rat.BigOperators + +namespace OAI + +/-! Tensor extraction over arbitrary fields and its asymptotic rate. -/ + +noncomputable section + +namespace MatrixMultiplication.AllFieldInitialGibbs + +open AllFieldParameters AllFieldHistory AllFieldInitialEntropy AllFieldInitialOrbit +open MatrixMultiplication.Foundation +open scoped BigOperators + +def coordinateWeight (k : Fin 17) : ℝ := + (weight (initialInteger k.val) : ℝ) + +def orderedWeight (u : JointPopulation.Shape) : ℝ := + ∏ s : Fin 3, coordinateWeight (JointPopulation.shapeSide s u) + +def initialNormalizer : ℝ := ((sortedInitial.map initialWeight).sum : ℚ) + +def initialPotential (k : Fin 17) : ℝ := Real.log (coordinateWeight k) + +def initialLogNormalizer : ℝ := Real.log initialNormalizer + +theorem coordinateWeight_pos (k : Fin 17) : 0 < coordinateWeight k := by + apply Rat.cast_pos.mpr + apply weight_positive_of_argument_bound + exact assigned_argument_bound _ tablea initial_table_arguments_bounded _ + +theorem orderedWeight_pos (u : JointPopulation.Shape) : 0 < orderedWeight u := + Finset.prod_pos (fun _ _ => coordinateWeight_pos _) + +theorem initialNormalizer_pos : 0 < initialNormalizer := by + apply Rat.cast_pos.mpr + exact list_sum_map_positive _ _ (by decide +kernel) + (fun s _ => initialWeight_positive s) + +theorem orderedWeight_source (p : PlacedInitial) : + orderedWeight (initialShapeCode p) = + ∏ s : Fin 3, (weight (initialInteger (sortedInitial.get p.1 s)) : ℝ) := by + simp only [orderedWeight, coordinateWeight, initialShapeCode_side] + exact p.2.symm.prod_comp + (fun s : Fin 3 => (weight (initialInteger (sortedInitial.get p.1 s)) : ℝ)) + +theorem initialWeight_source (p : PlacedInitial) : + (initialWeight (sortedInitial.get p.1) : ℝ) = + (initialMultiplicity (sortedInitial.get p.1) : ℝ) * + orderedWeight (initialShapeCode p) := by + rw [orderedWeight_source] + simp only [initialWeight] + push_cast + rfl + +theorem placedInitialLaw_mass (p : PlacedInitial) : + placedInitialLaw.mass p = + (initialMultiplicity (sortedInitial.get p.1) : ℝ) * + orderedWeight (initialShapeCode p) / initialNormalizer / 6 := by + change (initialLaw (sortedInitial.get p.1) : ℝ) / 6 = _ + rw [initialLaw, ite_eq_left (List.get_mem _ _), Rat.cast_div, initialWeight_source p] + rfl + +theorem orderedInitialLaw_mass (u : JointPopulation.Shape) + (hu : u.1.val + u.2.1.val + u.2.2.val = 16) : + orderedInitialLaw.mass u = orderedWeight u / initialNormalizer := by + classical + have hcount : (∑ p : PlacedInitial, + if initialShapeCode p = u then + (initialMultiplicity (sortedInitial.get p.1) : ℝ) else 0) = 6 := by + exact_mod_cast weighted_fiber_count u hu + simp only [orderedInitialLaw, FiniteLaw.map_mass, placedInitialLaw_mass] + calc + _ = (∑ p : PlacedInitial, if initialShapeCode p = u then + (initialMultiplicity (sortedInitial.get p.1) : ℝ) else 0) * + (orderedWeight u / initialNormalizer / 6) := by + rw [Finset.sum_mul] + apply Finset.sum_congr rfl + intro p _ + by_cases hp : initialShapeCode p = u + · simp only [hp, ite_true] + ring + · simp only [hp, ite_false, zero_mul] + _ = _ := by rw [hcount]; ring + +theorem orderedInitialLaw_zero (u : JointPopulation.Shape) + (hu : u.1.val + u.2.1.val + u.2.2.val ≠ 16) : + orderedInitialLaw.mass u = 0 := by + classical + simp only [orderedInitialLaw, FiniteLaw.map_mass] + apply Finset.sum_eq_zero + intro p _ + apply ite_eq_right + intro hp + have ht := source_total p + rw [hp] at ht + exact hu ht + +theorem orderedInitialLaw_mass_eq (u : JointPopulation.Shape) : + orderedInitialLaw.mass u = + if u.1.val + u.2.1.val + u.2.2.val = 16 + then orderedWeight u / initialNormalizer else 0 := by + split_ifs with hu + · exact orderedInitialLaw_mass u hu + · exact orderedInitialLaw_zero u hu + +theorem orderedInitialLaw_positive (u : JointPopulation.Shape) + (hu : u.1.val + u.2.1.val + u.2.2.val = 16) : + 0 < orderedInitialLaw.mass u := by + rw [orderedInitialLaw_mass u hu] + exact div_pos (orderedWeight_pos u) initialNormalizer_pos + +theorem orderedInitialLaw_support (u : JointPopulation.Shape) + (hu : 0 < orderedInitialLaw.mass u) : + u.1.val + u.2.1.val + u.2.2.val = 16 := by + by_contra hn + rw [orderedInitialLaw_zero u hn] at hu + exact lt_irrefl _ hu + +theorem log_orderedWeight (u : JointPopulation.Shape) : + Real.log (orderedWeight u) = + initialPotential (JointPopulation.shapeSide 0 u) + + initialPotential (JointPopulation.shapeSide 1 u) + + initialPotential (JointPopulation.shapeSide 2 u) := by + rw [orderedWeight, Real.log_prod + (fun s _ => ne_of_gt (coordinateWeight_pos (JointPopulation.shapeSide s u)))] + simp only [Fin.sum_univ_three, initialPotential] + +theorem orderedInitialLaw_log (u : JointPopulation.Shape) + (hu : 0 < orderedInitialLaw.mass u) : + Real.log (orderedInitialLaw.mass u) = + initialPotential (JointPopulation.shapeSide 0 u) + + initialPotential (JointPopulation.shapeSide 1 u) + + initialPotential (JointPopulation.shapeSide 2 u) - initialLogNormalizer := by + rw [orderedInitialLaw_mass u (orderedInitialLaw_support u hu), + Real.log_div (ne_of_gt (orderedWeight_pos u)) (ne_of_gt initialNormalizer_pos), + log_orderedWeight] + rfl + +end MatrixMultiplication.AllFieldInitialGibbs + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldConstruction/InitialHash.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldConstruction/InitialHash.lean new file mode 100644 index 0000000000000000000000000000000000000000..e4650cbfc7f765ac305bbff69b29a587a3d4c705 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldConstruction/InitialHash.lean @@ -0,0 +1,143 @@ +import OAI.LinearAlgebra.MatrixMultiplication.FieldConstruction.InitialExact +import OAI.LinearAlgebra.MatrixMultiplication.JointExtraction.OrdinarySelection + +namespace OAI + +/-! Tensor extraction over arbitrary fields and its asymptotic rate. -/ + +noncomputable section + +namespace MatrixMultiplication.AllFieldInitialHash + +open MatrixMultiplication.Foundation AllFieldFiniteFamily AllFieldInitialStep +open JointPopulation JointCoarseHashing +open scoped BigOperators Classical + +variable {K : ℕ} (counts : Fin K → Shape → ℕ) + +def xKeep (k : ℕ) (U : Finset (ZMod (37 ^ k))) + (s : Sample (Position counts) k) (w : CoarseWord counts) : Prop := + JointHashing.xHash s (castWord k w) ∈ U + +def yKeep (k : ℕ) (U : Finset (ZMod (37 ^ k))) + (s : Sample (Position counts) k) (w : CoarseWord counts) : Prop := + JointHashing.yHash s (castWord k w) ∈ U + +def zKeep (k : ℕ) (U : Finset (ZMod (37 ^ k))) + (s : Sample (Position counts) k) (w : CoarseWord counts) : Prop := + JointHashing.zHash (twoUnit k) s (fun _ => (16 : ZMod (37 ^ k))) (castWord k w) ∈ U + +theorem ambient_support {H : Type*} [Fintype H] [DecidableEq H] + (counts : H → Shape → ℕ) (f : Triple (Position counts)) + (hf : f ∈ ambientSet counts (fun _ => 16)) : + HasSupportSum (fun _ => 16) f := + (Finset.mem_filter.mp hf).2.1 + +theorem target_mem_ambient + (hsupport : ∀ h u, 0 < counts h u → u.1.val + u.2.1.val + u.2.2.val = 16) + (e : Target counts) : triple counts e ∈ ambientSet counts (fun _ => 16) := + targetSet_subset_ambient counts (fun _ => 16) hsupport + (Finset.mem_image.mpr ⟨e, Finset.mem_univ _, rfl⟩) + +theorem side_survival_iff (k : ℕ) (U : Finset (ZMod (37 ^ k))) + (hAP : ∀ x ∈ U, ∀ y ∈ U, ∀ z ∈ U, x + y = 2 * z → x = z ∧ y = z) + (s : Sample (Position counts) k) (e : Triple (Position counts)) + (he : HasSupportSum (fun _ => 16) e) : + JointCoarseAssignment.survives (xKeep counts k U s) (yKeep counts k U s) + (zKeep counts k U s) e ↔ Survives k U e s := + full_survival_iff k U hAP (fun _ => 16) e he s + +theorem isolated_of_good + (hsupport : ∀ h u, 0 < counts h u → u.1.val + u.2.1.val + u.2.2.val = 16) + (k : ℕ) (U : Finset (ZMod (37 ^ k))) + (hAP : ∀ x ∈ U, ∀ y ∈ U, ∀ z ∈ U, x + y = 2 * z → x = z ∧ y = z) + (s : Sample (Position counts) k) (e : Target counts) + (hgood : JointOrdinarySelection.Good k U (ambientSet counts (fun _ => 16)) + (triple counts e) s) : + AllFieldInitialExact.Isolated counts (xKeep counts k U s) (yKeep counts k U s) + (zKeep counts k U s) e := by + constructor + · exact (side_survival_iff counts k U hAP s (triple counts e) + (triple_support counts (fun _ => 16) hsupport e)).mpr hgood.1 + · intro f hf hsurvives hshare + by_contra hne + have hs := (side_survival_iff counts k U hAP s f (ambient_support counts f hf)).mp + hsurvives + exact JointOrdinarySelection.good_excludes_neighbor k U + (ambientSet counts (fun _ => 16)) (triple counts e) f s hgood hf hne hshare hs + +abbrev SelectedTargets (G : Finset (Target counts)) := {e : Target counts // e ∈ G} + +def toTarget (G : Finset (Target counts)) : SelectedTargets counts G → Target counts := + Subtype.val + +theorem toTarget_injective (G : Finset (Target counts)) : + Function.Injective (toTarget counts G) := Subtype.val_injective + +@[simp] theorem selectedTargets_card (G : Finset (Target counts)) : + Fintype.card (SelectedTargets counts G) = G.card := Fintype.card_coe G + +section Execution + +variable {F : Type*} [Field F] {N : ℕ} + +def selectedExecution (total : ∀ h, ∑ u, counts h u = N) + (hsupport : ∀ h u, 0 < counts h u → u.1.val + u.2.1.val + u.2.2.val = 16) + (k : ℕ) (U : Finset (ZMod (37 ^ k))) + (hAP : ∀ x ∈ U, ∀ y ∈ U, ∀ z ∈ U, x + y = 2 * z → x = z ∧ y = z) + (s : Sample (Position counts) k) (G : Finset (Target counts)) + (hgood : ∀ e ∈ G, JointOrdinarySelection.Good k U + (ambientSet counts (fun _ => 16)) (triple counts e) s) : + Execution (cwSource F K N) + (Tensor.directSum (fun _ : SelectedTargets counts G => JointCanonicalInitial.canonical counts)) := + AllFieldInitialExact.selectedExecution counts + (xKeep counts k U s) (yKeep counts k U s) (zKeep counts k U s) + total (toTarget counts G) (toTarget_injective counts G) + (fun e => target_mem_ambient counts hsupport e.val) + (fun e => isolated_of_good counts hsupport k U hAP s e.val (hgood e.val e.property)) + +@[simp] theorem selectedExecution_copies (total : ∀ h, ∑ u, counts h u = N) + (hsupport : ∀ h u, 0 < counts h u → u.1.val + u.2.1.val + u.2.2.val = 16) + (k : ℕ) (U : Finset (ZMod (37 ^ k))) + (hAP : ∀ x ∈ U, ∀ y ∈ U, ∀ z ∈ U, x + y = 2 * z → x = z ∧ y = z) + (s : Sample (Position counts) k) (G : Finset (Target counts)) + (hgood : ∀ e ∈ G, JointOrdinarySelection.Good k U + (ambientSet counts (fun _ => 16)) (triple counts e) s) : + Fintype.card (selectedExecution (F := F) counts total hsupport k U hAP s G hgood).Copies = 1 := + rfl + +theorem exists_selectedExecution (total : ∀ h, ∑ u, counts h u = N) + (hsupport : ∀ h u, 0 < counts h u → u.1.val + u.2.1.val + u.2.2.val = 16) + (k : ℕ) (U : Finset (ZMod (37 ^ k))) + (hAP : ∀ x ∈ U, ∀ y ∈ U, ∀ z ∈ U, x + y = 2 * z → x = z ∧ y = z) + (D : ℕ) + (hdegree : ∀ e : Target counts, + (JointOrdinarySelection.neighbors (ambientSet counts (fun _ => 16)) + (triple counts e)).card ≤ D) + (hsmall : (D : ℝ) / ((37 ^ k : ℕ) : ℝ) ≤ 1 / 2) + (n : ℕ) (hn : (n : ℝ) ≤ (Fintype.card (Target counts) : ℝ) * + ((U.card : ℝ) / ((37 ^ k : ℕ) : ℝ) ^ 2 / 2)) : + ∃ (s : Sample (Position counts) k) (G : Finset (Target counts)), + G.card = n ∧ + (∀ e ∈ G, JointOrdinarySelection.Good k U + (ambientSet counts (fun _ => 16)) (triple counts e) s) ∧ + ∃ E : Execution (cwSource F K N) + (Tensor.directSum (fun _ : SelectedTargets counts G => + JointCanonicalInitial.canonical counts)), + Fintype.card E.Copies = 1 := by + obtain ⟨s, G, hcard, hgood, _hpairwise⟩ := + JointOrdinarySelection.exists_selection_of_degree_bound k U + (ambientSet counts (fun _ => 16)) (fun _ => 16) (triple counts) + (triple_injective counts) (fun f hf => ambient_support counts f hf) + (target_mem_ambient counts hsupport) D hdegree hsmall n hn + exact ⟨s, G, hcard, hgood, + selectedExecution (F := F) counts total hsupport k U hAP s G hgood, + selectedExecution_copies (F := F) counts total hsupport k U hAP s G hgood⟩ + +end Execution + +end MatrixMultiplication.AllFieldInitialHash + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldConstruction/InitialHistories.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldConstruction/InitialHistories.lean new file mode 100644 index 0000000000000000000000000000000000000000..cd1fa737ab85cd84e05294e58d6851b9eb97e259 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldConstruction/InitialHistories.lean @@ -0,0 +1,71 @@ +import OAI.LinearAlgebra.MatrixMultiplication.FieldHistory.Counts + +namespace OAI + +/-! Tensor extraction over arbitrary fields and its asymptotic rate. -/ + +noncomputable section +namespace MatrixMultiplication.AllFieldHistory + +open AllFieldParameters +open scoped BigOperators +attribute [local instance] Classical.propDecidable Classical.decEq + +theorem shapeCounts_fiber {I : Type*} [Fintype I] (code : I → JointPopulation.Shape) + (weight : I → ℕ) (u : JointPopulation.Shape) : + shapeCounts code weight u = ∑ i : {i : I // code i = u}, weight i.val := by + unfold shapeCounts + rw [← Finset.sum_filter] + exact Finset.sum_subtype _ (by intro i; simp) weight + +def shapeCountFiberEquiv {I : Type*} [Fintype I] (code : I → JointPopulation.Shape) + (weight : I → ℕ) (u : JointPopulation.Shape) : + Fin (shapeCounts code weight u) ≃ + (Σ i : {i : I // code i = u}, Fin (weight i.val)) := + Fintype.equivOfCardEq (by + simp only [Fintype.card_fin, Fintype.card_sigma, shapeCounts_fiber]) + +abbrev InitialPlacement (K : ℕ) := Initial K × Placement + +abbrev InitialShapeFiber {K : ℕ} (j : Fin K) (u : JointPopulation.Shape) := + {p : Fin sortedInitial.length × Placement // rootShape (j, p.1) p.2 = u} + +def initialClassPositionEquiv {K : ℕ} (allocation : Allocation) (dilation : ℕ) + (j : Fin K) (u : JointPopulation.Shape) : + Fin (initialJointCounts allocation dilation j u) ≃ + (Σ p : InitialShapeFiber j u, + Fin (population allocation dilation (.initial (j, p.val.1), p.val.2))) := + shapeCountFiberEquiv _ _ u + +theorem initialClassPosition_shape {K : ℕ} (allocation : Allocation) (dilation : ℕ) + (j : Fin K) (u : JointPopulation.Shape) + (i : Fin (initialJointCounts allocation dilation j u)) : + rootShape (j, (initialClassPositionEquiv allocation dilation j u i).1.val.1) + (initialClassPositionEquiv allocation dilation j u i).1.val.2 = u := + (initialClassPositionEquiv allocation dilation j u i).1.property + +def initialStateEquiv (K : ℕ) : State K 0 ≃ InitialPlacement K where + toFun h := by + rcases h with ⟨⟨h, phi⟩, hr⟩ + cases h with + | initial g => exact (g, phi) + | afterA a => have := hr.1; dsimp [resident] at hr; omega + | afterB b => have := hr.1; dsimp [resident] at hr; omega + | partC c => dsimp [resident] at hr; omega + | afterC c => dsimp [resident] at hr; omega + invFun h := ⟨(.initial h.1, h.2), fun _ => Nat.zero_le _⟩ + left_inv h := by + rcases h with ⟨⟨h, phi⟩, hr⟩ + cases h with + | initial g => rfl + | afterA a => have := hr.1; dsimp [resident] at hr; omega + | afterB b => have := hr.1; dsimp [resident] at hr; omega + | partC c => dsimp [resident] at hr; omega + | afterC c => dsimp [resident] at hr; omega + right_inv h := rfl + +end MatrixMultiplication.AllFieldHistory + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldConstruction/InitialLeafRates.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldConstruction/InitialLeafRates.lean new file mode 100644 index 0000000000000000000000000000000000000000..2cb57e265fa37ccb40764eb7fa5a4d351c4a28f6 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldConstruction/InitialLeafRates.lean @@ -0,0 +1,149 @@ +import OAI.LinearAlgebra.MatrixMultiplication.FieldConstruction.TerminalRateFormulas +import OAI.LinearAlgebra.MatrixMultiplication.CoppersmithWinograd.CWWordDimensionParameters +import OAI.LinearAlgebra.MatrixMultiplication.CoppersmithWinograd.CWWindowedLeaves +import OAI.LinearAlgebra.MatrixMultiplication.FieldConstruction.ShapeEncoding + +namespace OAI + +/-! Tensor extraction over arbitrary fields and its asymptotic rate. -/ + +noncomputable section + +namespace MatrixMultiplication.AllFieldInitialLeafRates + +open AllFieldHistory AllFieldParameters AllFieldTerminalRates +open CWWindowedLeaves Filter +open scoped BigOperators Topology +attribute [local instance] Classical.propDecidable Classical.decEq + +abbrev InitialZero (K : ℕ) := + {h : Initial K // initialShape h ∉ positiveInitial} + +abbrev PopulationHistory (K : ℕ) := InitialZero K × Placement + +theorem shapeMax_lt {K : ℕ} (h : InitialZero K) : + shapeMax (initialShape h.val) < 17 := by + have hb := (root_shape_spec _ (initialShape_mem h.val)).1 + exact Nat.lt_succ_of_le (max_le (hb 0) (max_le (hb 1) (hb 2))) + +def shapeIndex {K : ℕ} (h : InitialZero K) : Fin 17 := + ⟨shapeMax (initialShape h.val), shapeMax_lt h⟩ + +theorem card_alphabet {K : ℕ} (h : InitialZero K) : + Fintype.card (Alphabet 8 (shapeMax (initialShape h.val))) = + Contractions.coefficients[shapeMax (initialShape h.val)]?.getD 0 := by + have hc := CWWordDimensionParameters.table_eq_card (shapeIndex h) + rw [Fintype.card_eq_nat_card] at hc ⊢ + exact hc.symm + +theorem card_alphabet_pos {K : ℕ} (h : InitialZero K) : + 0 < Fintype.card (Alphabet 8 (shapeMax (initialShape h.val))) := by + have hc := CWWordDimensionParameters.word_card_positive (shapeIndex h) + rw [Fintype.card_eq_nat_card] at hc ⊢ + exact hc + +abbrev Words {K : ℕ} (allocation : Allocation) (dilation : ℕ) + (h : PopulationHistory K) := + Fin (population allocation dilation (.initial h.1.val, h.2)) → + Alphabet 8 (shapeMax (initialShape h.1.val)) + +theorem card_words {K : ℕ} (allocation : Allocation) (dilation : ℕ) + (h : PopulationHistory K) : + Fintype.card (Words allocation dilation h) = + (Contractions.coefficients[shapeMax (initialShape h.1.val)]?.getD 0) ^ + population allocation dilation (.initial h.1.val, h.2) := by + simp only [Words, Fintype.card_fun, Fintype.card_fin, card_alphabet] + +theorem card_words_pos {K : ℕ} (allocation : Allocation) (dilation : ℕ) + (h : PopulationHistory K) : + 0 < Fintype.card (Words allocation dilation h) := by + simp only [Words, Fintype.card_fun, Fintype.card_fin] + exact pow_pos (card_alphabet_pos h.1) _ + +theorem log_card_words {K : ℕ} (allocation : Allocation) (dilation : ℕ) + (h : PopulationHistory K) : + Real.log (Fintype.card (Words allocation dilation h) : ℝ) = + (population allocation dilation (.initial h.1.val, h.2) : ℝ) * + initialRate (initialShape h.1.val) := by + simp only [card_words, Nat.cast_pow, Real.log_pow, initialRate] + +abbrev ProductWords {K : ℕ} (allocation : Allocation) (dilation : ℕ) := + ∀ h : PopulationHistory K, Words allocation dilation h + +def volume {K : ℕ} (allocation : Allocation) (dilation : ℕ) : ℕ := + Fintype.card (ProductWords (K := K) allocation dilation) + +theorem volume_eq_prod {K : ℕ} (allocation : Allocation) (dilation : ℕ) : + volume (K := K) allocation dilation = + ∏ h : PopulationHistory K, Fintype.card (Words allocation dilation h) := by + rw [volume, Fintype.card_pi] + +theorem volume_pos {K : ℕ} (allocation : Allocation) (dilation : ℕ) : + 0 < volume (K := K) allocation dilation := by + rw [volume_eq_prod] + exact Finset.prod_pos (fun h _ => card_words_pos allocation dilation h) + +theorem log_volume {K : ℕ} (allocation : Allocation) (dilation : ℕ) : + Real.log (volume (K := K) allocation dilation : ℝ) = + (populationLength (K := K) allocation dilation : ℝ) * + ∑ h : PopulationHistory K, + (amount allocation (.initial h.1.val, h.2) : ℝ) * + initialRate (initialShape h.1.val) := by + rw [volume_eq_prod, Nat.cast_prod, Real.log_prod (s := Finset.univ) + (f := fun h : PopulationHistory K => (Fintype.card (Words allocation dilation h) : ℝ)) + (fun h _ => Nat.cast_ne_zero.mpr + (Nat.ne_of_gt (card_words_pos allocation dilation h)))] + simp only [log_card_words] + rw [Finset.mul_sum] + apply Finset.sum_congr rfl + intro h _ + have hc : (population allocation dilation (.initial h.1.val, h.2) : ℝ) = + (populationLength (K := K) allocation dilation : ℝ) * + (amount allocation (.initial h.1.val, h.2) : ℝ) := by + exact_mod_cast population_cast allocation dilation (.initial h.1.val, h.2) + rw [hc, mul_assoc] + +theorem sum_populationHistory_rate {K : ℕ} (allocation : Allocation) : + (∑ h : PopulationHistory K, + (amount allocation (.initial h.1.val, h.2) : ℝ) * + initialRate (initialShape h.1.val)) = + ∑ h : InitialZero K, + (initialAmount h.val : ℝ) * initialRate (initialShape h.val) := by + rw [Fintype.sum_prod_type] + apply Finset.sum_congr rfl + intro h _ + dsimp only + rw [← Finset.sum_mul] + have hm : (∑ phi : Placement, (amount allocation (.initial h.val, phi) : ℝ)) = + (initialAmount h.val : ℝ) := by + exact_mod_cast sum_placement_amount allocation (.initial h.val) + rw [hm] + +theorem log_volume_eq_S0 {K : ℕ} (allocation : Allocation) (dilation : ℕ) : + Real.log (volume (K := K) allocation dilation : ℝ) = + (populationLength (K := K) allocation dilation : ℝ) * ((K : ℝ) * S0) := by + rw [log_volume, sum_populationHistory_rate, initial_zero_history_rate] + +theorem normalized_log_volume_eq_S0 {K : ℕ} (allocation : Allocation) + (dilation : ℕ) (hd : 0 < dilation) : + Real.log (volume (K := K) allocation dilation : ℝ) / + populationLength (K := K) allocation dilation = (K : ℝ) * S0 := by + rw [log_volume_eq_S0] + have hn : (populationLength (K := K) allocation dilation : ℝ) ≠ 0 := + Nat.cast_ne_zero.mpr + (Nat.ne_of_gt (AllFieldPopulationCounts.blockLength_pos _ hd)) + exact mul_div_cancel_left₀ _ hn + +theorem tendsto_normalized_log_volume {K : ℕ} (allocation : Allocation) : + Tendsto (fun dilation : ℕ => + Real.log (volume (K := K) allocation dilation : ℝ) / + populationLength (K := K) allocation dilation) atTop (𝓝 ((K : ℝ) * S0)) := by + apply tendsto_const_nhds.congr' + filter_upwards [eventually_gt_atTop (0 : ℕ)] with dilation hd + exact (normalized_log_volume_eq_S0 allocation dilation hd).symm + +end MatrixMultiplication.AllFieldInitialLeafRates + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldConstruction/InitialOrbit.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldConstruction/InitialOrbit.lean new file mode 100644 index 0000000000000000000000000000000000000000..f9d3f200c78bcfbd97c7aab52660c69f400d7fda --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldConstruction/InitialOrbit.lean @@ -0,0 +1,64 @@ +import OAI.LinearAlgebra.MatrixMultiplication.FieldConstruction.InitialEntropy + +namespace OAI + +/-! Tensor extraction over arbitrary fields and its asymptotic rate. -/ + +namespace MatrixMultiplication.AllFieldInitialOrbit + +open AllFieldParameters AllFieldHistory AllFieldInitialEntropy +open scoped BigOperators + +theorem source_total (p : PlacedInitial) : + (initialShapeCode p).1.val + (initialShapeCode p).2.1.val + + (initialShapeCode p).2.2.val = 16 := by + unfold initialShapeCode rootShape + rw [encodePhysicalShape_total] + exact (root_shape_spec _ (initialShape_mem _)).2 + +theorem decodeShape_injective : Function.Injective decodeShape := by + intro u v h + apply Prod.ext + · exact Fin.ext (congrFun h 0) + · apply Prod.ext + · exact Fin.ext (congrFun h 1) + · exact Fin.ext (congrFun h 2) + +theorem decodeShape_mem_shapes (u : JointPopulation.Shape) + (hu : u.1.val + u.2.1.val + u.2.2.val = 16) : + decodeShape u ∈ shapes 16 := by + simp only [shapes, List.mem_flatMap, List.mem_map, List.mem_range] + refine ⟨u.1.val, by omega, u.2.1.val, by omega, ?_⟩ + funext i + fin_cases i + · rfl + · rfl + · change 16 - u.1.val - u.2.1.val = u.2.2.val + omega + +theorem initialShapeCode_eq_iff (p : PlacedInitial) (u : JointPopulation.Shape) : + initialShapeCode p = u ↔ + physicalShape p.2 (sortedInitial.get p.1) = decodeShape u := by + have hdecode : decodeShape (initialShapeCode p) = + physicalShape p.2 (sortedInitial.get p.1) := by + funext i + exact initialShapeCode_side p i + rw [← hdecode] + exact decodeShape_injective.eq_iff.symm + +theorem weighted_shape_fiber_count : ∀ u ∈ shapes 16, + (∑ p : PlacedInitial, + if physicalShape p.2 (sortedInitial.get p.1) = u + then initialMultiplicity (sortedInitial.get p.1) else 0) = 6 := by + decide +kernel + +theorem weighted_fiber_count (u : JointPopulation.Shape) + (hu : u.1.val + u.2.1.val + u.2.2.val = 16) : + (∑ p : PlacedInitial, if initialShapeCode p = u + then initialMultiplicity (sortedInitial.get p.1) else 0) = 6 := by + simp only [initialShapeCode_eq_iff] + exact weighted_shape_fiber_count _ (decodeShape_mem_shapes u hu) + +end MatrixMultiplication.AllFieldInitialOrbit + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldConstruction/InitialSource.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldConstruction/InitialSource.lean new file mode 100644 index 0000000000000000000000000000000000000000..e08b7e5b2fb2b9cd50096a1cecc5c73bddc645dc --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldConstruction/InitialSource.lean @@ -0,0 +1,58 @@ +import OAI.LinearAlgebra.MatrixMultiplication.FieldConstruction.FiniteFamily + +namespace OAI + +/-! Tensor extraction over arbitrary fields and its asymptotic rate. -/ + +noncomputable section + +namespace MatrixMultiplication.AllFieldInitialSource + +open MatrixMultiplication.Foundation AllFieldFiniteFamily CommonDimensions +open scoped BigOperators Classical + +abbrev Sites (K N : ℕ) := Fin K × (Fin N × Fin 8) +abbrev Words (K N : ℕ) := Fin K → Fin N → Fin 8 → Fin 7 + +def sitesEquiv (K N : ℕ) : Sites K N ≃ Fin (8 * K * N) := + Fintype.equivOfCardEq (by simp only [Sites, Fintype.card_prod, Fintype.card_fin]; ring) + +def flatten (K N : ℕ) (w : Words K N) : AllFieldSource.Word K N := + fun i => let p := (sitesEquiv K N).symm i; w p.1 p.2.1 p.2.2 + +def groupedSource (F : Type*) [Field F] (K N : ℕ) : + Tensor F (Words K N) (Words K N) (Words K N) := + fun x y z => ∏ p : Sites K N, + FieldCW.tensor F 5 (x p.1 p.2.1 p.2.2) (y p.1 p.2.1 p.2.2) (z p.1 p.2.1 p.2.2) + +theorem groupedSource_eq_lots (F : Type*) [Field F] (K N : ℕ) : + groupedSource F K N = + familyProduct (fun _ : Fin K => Tensor.power (Tensor.power (FieldCW.tensor F 5) 8) N) := by + funext x y z + simp only [groupedSource, Sites, familyProduct, Tensor.power, Fintype.prod_prod_type] + +def groupingMap (F : Type*) [Field F] (K N : ℕ) : + LocalMap (cwSource F K N) (groupedSource F K N) where + x := fun x s => if s = flatten K N x then 1 else 0 + y := fun y s => if s = flatten K N y then 1 else 0 + z := fun z s => if s = flatten K N z then 1 else 0 + coefficient := by + rw [← Tensor.pullback_eq_restrict] + funext x y z + simp only [Tensor.pullback, cwSource, Tensor.power, groupedSource, flatten] + apply Fintype.prod_equiv (sitesEquiv K N).symm + intro i + rfl + +def initialExecution (F : Type*) [Field F] (K N : ℕ) : + Execution (cwSource F K N) (groupedSource F K N) := + (startCW F K N).restrict _ (groupingMap F K N) + +@[simp] theorem initialExecution_copies (F : Type*) [Field F] (K N : ℕ) : + Fintype.card (initialExecution F K N).Copies = 1 := rfl + +end MatrixMultiplication.AllFieldInitialSource + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldConstruction/InitialState.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldConstruction/InitialState.lean new file mode 100644 index 0000000000000000000000000000000000000000..4c871ad70c611aaff8d3d86545105ee0cdb9a984 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldConstruction/InitialState.lean @@ -0,0 +1,150 @@ +import OAI.LinearAlgebra.MatrixMultiplication.FieldConstruction.InitialHistories +import OAI.LinearAlgebra.MatrixMultiplication.FieldHistory.Tensors +import OAI.LinearAlgebra.MatrixMultiplication.JointExtraction.CanonicalInitial + +namespace OAI + +/-! Tensor extraction over arbitrary fields and its asymptotic rate. -/ + +noncomputable section + +namespace MatrixMultiplication.AllFieldInitialState + +open MatrixMultiplication.Foundation AllFieldHistory AllFieldParameters AllFieldFiniteFamily +open scoped BigOperators Classical + +variable {K : ℕ} (allocation : Allocation) (dilation : ℕ) + +abbrev CanonicalKey := JointCanonicalization.ClassKey (H := Fin K) + +abbrev PlacementPositions (p : InitialPlacement K) := + Fin (population allocation dilation (.initial p.1, p.2)) + +def classPosition (c : CanonicalKey (K := K)) + (i : Fin (initialJointCounts allocation dilation c.1 c.2)) : + Σ p : InitialPlacement K, PlacementPositions allocation dilation p := + let q := initialClassPositionEquiv allocation dilation c.1 c.2 i + ⟨((c.1, q.1.val.1), q.1.val.2), q.2⟩ + +theorem classPosition_shape (c : CanonicalKey (K := K)) + (i : Fin (initialJointCounts allocation dilation c.1 c.2)) : + JointCanonicalCW.shapeNat c.2 = + physicalShape (classPosition allocation dilation c i).1.2 + (initialShape (classPosition allocation dilation c i).1.1) := by + have h := congrArg decodeShape (initialClassPosition_shape allocation dilation c.1 c.2 i) + simp only [rootShape, decode_encodePhysicalShape] at h + exact h.symm + +theorem prod_classPosition {F : Type*} [CommMonoid F] + (f : ∀ p : InitialPlacement K, PlacementPositions allocation dilation p → F) : + (∏ c : CanonicalKey (K := K), + ∏ i : Fin (initialJointCounts allocation dilation c.1 c.2), + f (classPosition allocation dilation c i).1 + (classPosition allocation dilation c i).2) = + ∏ p : InitialPlacement K, ∏ i : PlacementPositions allocation dilation p, f p i := by + conv_lhs => rw [Fintype.prod_prod_type] + conv_rhs => + rw [Fintype.prod_prod_type] + rw [Fintype.prod_prod_type] + apply Finset.prod_congr rfl + intro j _ + calc + (∏ u : JointPopulation.Shape, ∏ i : Fin (initialJointCounts allocation dilation j u), + f (classPosition allocation dilation (j, u) i).1 + (classPosition allocation dilation (j, u) i).2) = + ∏ u : JointPopulation.Shape, ∏ p : InitialShapeFiber j u, + ∏ i : Fin (population allocation dilation (.initial (j, p.val.1), p.val.2)), + f ((j, p.val.1), p.val.2) i := by + apply Finset.prod_congr rfl + intro u _ + rw [← Fintype.prod_sigma'] + apply Fintype.prod_equiv (initialClassPositionEquiv allocation dilation j u) + intro i + rfl + _ = ∏ p : Fin sortedInitial.length × Placement, + ∏ i : Fin (population allocation dilation (.initial (j, p.1), p.2)), + f ((j, p.1), p.2) i := + Fintype.prod_fiberwise (fun p : Fin sortedInitial.length × Placement => + rootShape (j, p.1) p.2) + (fun p => ∏ i : Fin (population allocation dilation (.initial (j, p.1), p.2)), + f ((j, p.1), p.2) i) + _ = _ := by rw [Fintype.prod_prod_type] + +abbrev StateWords := ∀ h : State K 0, HistoryWord allocation dilation h.val + +def toCanonical (w : StateWords (K := K) allocation dilation) : + JointCanonicalInitial.CanonicalWords (initialJointCounts (K := K) allocation dilation) := + fun c i => + let q := classPosition allocation dilation c i + w ((initialStateEquiv K).symm q.1) q.2 + +theorem coefficient (F : Type*) [Field F] (ε : ℝ) + (x y z : StateWords (K := K) allocation dilation) : + JointCanonicalInitial.canonical (F := F) (initialJointCounts allocation dilation) + (toCanonical allocation dilation x) (toCanonical allocation dilation y) + (toCanonical allocation dilation z) = + stateTensor F allocation dilation ε 0 x y z := by + let f : ∀ p : InitialPlacement K, PlacementPositions allocation dilation p → F := + fun p i => CWStrands.shapeTensor (Fin 8) (physicalShape p.2 (initialShape p.1)) + (x ((initialStateEquiv K).symm p) i) + (y ((initialStateEquiv K).symm p) i) + (z ((initialStateEquiv K).symm p) i) + have hcanonical : + JointCanonicalInitial.canonical (F := F) (initialJointCounts allocation dilation) + (toCanonical allocation dilation x) (toCanonical allocation dilation y) + (toCanonical allocation dilation z) = + ∏ p : InitialPlacement K, ∏ i : PlacementPositions allocation dilation p, f p i := by + rw [← prod_classPosition allocation dilation f] + unfold JointCanonicalInitial.canonical InheritedMasks.classProduct + apply Finset.prod_congr rfl + intro c _ + apply Finset.prod_congr rfl + intro i _ + dsimp only [toCanonical, f] + rw [classPosition_shape allocation dilation c i] + have hstate : stateTensor F allocation dilation ε 0 x y z = + ∏ p : InitialPlacement K, ∏ i : PlacementPositions allocation dilation p, f p i := by + change (∏ h : State K 0, historyTensor F allocation dilation ε h.val (x h) (y h) (z h)) = _ + rw [← (initialStateEquiv K).symm.prod_comp + (fun h : State K 0 => historyTensor F allocation dilation ε h.val (x h) (y h) (z h))] + apply Finset.prod_congr rfl + intro p _ + change historyTensor F allocation dilation ε (.initial p.1, p.2) + (x ((initialStateEquiv K).symm p)) (y ((initialStateEquiv K).symm p)) + (z ((initialStateEquiv K).symm p)) = _ + rw [historyTensor_initial] + rfl + exact hcanonical.trans hstate.symm + +def map (F : Type*) [Field F] (ε : ℝ) : + LocalMap + (JointCanonicalInitial.canonical (F := F) (initialJointCounts (K := K) allocation dilation)) + (stateTensor F (K := K) allocation dilation ε 0) where + x := fun x s => if s = toCanonical allocation dilation x then 1 else 0 + y := fun y s => if s = toCanonical allocation dilation y then 1 else 0 + z := fun z s => if s = toCanonical allocation dilation z then 1 else 0 + coefficient := by + rw [← Tensor.pullback_eq_restrict] + funext x y z + exact coefficient allocation dilation F ε x y z + +def execution (F : Type*) [Field F] (ε : ℝ) {I : Type} [Fintype I] {N : ℕ} + (E : Execution (cwSource F K N) + (Tensor.directSum (fun _ : I => JointCanonicalInitial.canonical + (initialJointCounts (K := K) allocation dilation)))) : + Execution (cwSource F K N) + (Tensor.directSum (fun _ : I => stateTensor F (K := K) allocation dilation ε 0)) := + E.restrict _ ((map (K := K) allocation dilation F ε).parallelCopies I) + +@[simp] theorem execution_copies (F : Type*) [Field F] (ε : ℝ) + {I : Type} [Fintype I] {N : ℕ} + (E : Execution (cwSource F K N) + (Tensor.directSum (fun _ : I => JointCanonicalInitial.canonical + (initialJointCounts (K := K) allocation dilation)))) : + Fintype.card (execution allocation dilation F ε E).Copies = Fintype.card E.Copies := rfl + +end MatrixMultiplication.AllFieldInitialState + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldConstruction/InitialStep.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldConstruction/InitialStep.lean new file mode 100644 index 0000000000000000000000000000000000000000..552d93948ece9d1cafbfec215b64bc1ed841d82b --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldConstruction/InitialStep.lean @@ -0,0 +1,131 @@ +import OAI.LinearAlgebra.MatrixMultiplication.FieldConstruction.InitialSource +import OAI.LinearAlgebra.MatrixMultiplication.JointExtraction.CanonicalInitial + +namespace OAI + +/-! Tensor extraction over arbitrary fields and its asymptotic rate. -/ + +noncomputable section + +namespace MatrixMultiplication.AllFieldInitialStep + +open MatrixMultiplication.Foundation AllFieldFiniteFamily AllFieldInitialSource +open JointPopulation +open scoped BigOperators Classical + +variable {F : Type*} [Field F] {K N : ℕ} + (counts : Fin K → Shape → ℕ) (total : ∀ h, ∑ u, counts h u = N) + +def toLots (w : JointCanonicalInitial.RawWords counts) : Words K N := + fun h i => w h ((finCongr (total h)).symm i) + +def positionMap : + LocalMap (groupedSource F K N) (JointCanonicalInitial.rawSource counts) where + x := fun x s => if s = toLots counts total x then 1 else 0 + y := fun y s => if s = toLots counts total y then 1 else 0 + z := fun z s => if s = toLots counts total z then 1 else 0 + coefficient := by + rw [← Tensor.pullback_eq_restrict, groupedSource_eq_lots] + funext x y z + change (∏ h : Fin K, ∏ i : Fin N, CWStrands.strand (F := F) (Fin 8) + (x h ((finCongr (total h)).symm i)) + (y h ((finCongr (total h)).symm i)) + (z h ((finCongr (total h)).symm i))) = + ∏ h : Fin K, ∏ i : Positions counts h, CWStrands.strand (F := F) (Fin 8) + (x h i) (y h i) (z h i) + apply Finset.prod_congr rfl + intro h _ + apply Fintype.prod_equiv (finCongr (total h)).symm + intro i + rfl + +def initialExecution : + Execution (cwSource F K N) (JointCanonicalInitial.rawSource counts) := + (AllFieldInitialSource.initialExecution F K N).restrict _ (positionMap counts total) + +@[simp] theorem initialExecution_copies : + Fintype.card (initialExecution (F := F) counts total).Copies = 1 := rfl + +def maskedInitialExecution : + Execution (cwSource F K N) (JointCanonicalInitial.maskedSource counts) := + (initialExecution counts total).restrict _ + (LocalMap.delete (JointCanonicalInitial.rawSource counts) + (JointCanonicalInitial.sideMask counts 0) (JointCanonicalInitial.sideMask counts 1) + (JointCanonicalInitial.sideMask counts 2)) + +abbrev CoarseWord := Position counts → Fin 17 + +def ordinaryAssignments (hx hy hz : CoarseWord counts → Prop) : + JointExtraction.Assignment (JointCanonicalInitial.RawWords counts) + (JointCanonicalInitial.RawWords counts) (JointCanonicalInitial.RawWords counts) + (JointCoarseHashing.Triple (Position counts)) := + JointCoarseAssignment.assignments (ambientSet counts (fun _ => 16)) (targetSet counts) + hx hy hz (JointCanonicalInitial.coarseWord counts) (JointCanonicalInitial.coarseWord counts) + (JointCanonicalInitial.coarseWord counts) (fun _ _ => True) (fun _ _ => True) + (fun _ _ => True) (fun _ _ => True) (fun _ _ => True) + +theorem ordinaryAssignments_coherent (hx hy hz : CoarseWord counts → Prop) : + JointExtraction.Coherent (JointCanonicalInitial.maskedSource (F := F) counts) + (ordinaryAssignments counts hx hy hz) := by + apply JointCoarseAssignment.assignments_coherent + · exact JointCanonicalInitial.maskedSource_support counts + · intro _ _ _ _ _ _ _ + trivial + · intro _ _ _ _ _ _ _ _ + trivial + +def initialCanonicalMap (e : Target counts) : + LocalMap (JointCanonicalInitial.ideal (F := F) counts e) + (JointCanonicalInitial.canonical counts) where + x := JointCanonicalInitial.coordinateMatrix counts e + y := JointCanonicalInitial.coordinateMatrix counts e + z := JointCanonicalInitial.coordinateMatrix counts e + coefficient := JointCanonicalInitial.ideal_restrict counts e + +def canonicalize {I : Type} [Fintype I] (target : I → Target counts) + (E : Execution (cwSource F K N) + (Tensor.directSum (fun i => JointCanonicalInitial.ideal counts (target i)))) : + Execution (cwSource F K N) + (Tensor.directSum (fun _ : I => JointCanonicalInitial.canonical counts)) := + E.restrict _ (LocalMap.directSum _ _ (fun i => initialCanonicalMap counts (target i))) + +@[simp] theorem canonicalize_copies {I : Type} [Fintype I] (target : I → Target counts) + (E : Execution (cwSource F K N) + (Tensor.directSum (fun i => JointCanonicalInitial.ideal counts (target i)))) : + Fintype.card (canonicalize counts target E).Copies = Fintype.card E.Copies := rfl + +def repairedInitialExecution {I : Type} [Fintype I] + (hx hy hz : CoarseWord counts → Prop) (target : I → Target counts) + (injective : Function.Injective target) (shifts : ℕ) + (repair : ∀ i, InverseLinearRecovery.RecoveredBy + (JointCanonicalInitial.ideal (F := F) counts (target i)) + (JointExtraction.branch (JointCanonicalInitial.maskedSource counts) + (ordinaryAssignments counts hx hy hz) (triple counts (target i))) shifts) : + Execution (cwSource F K N) + (Tensor.directSum (fun _ : I => JointCanonicalInitial.canonical counts)) := + canonicalize counts target + ((maskedInitialExecution counts total).extractSelectedAndRepair + (ordinaryAssignments counts hx hy hz) (ordinaryAssignments_coherent counts hx hy hz) + (fun i => triple counts (target i)) ((triple_injective counts).comp injective) + (fun i => JointCanonicalInitial.ideal counts (target i)) shifts repair) + +@[simp] theorem repairedInitialExecution_copies {I : Type} [Fintype I] + (hx hy hz : CoarseWord counts → Prop) (target : I → Target counts) + (injective : Function.Injective target) (shifts : ℕ) + (repair : ∀ i, InverseLinearRecovery.RecoveredBy + (JointCanonicalInitial.ideal (F := F) counts (target i)) + (JointExtraction.branch (JointCanonicalInitial.maskedSource counts) + (ordinaryAssignments counts hx hy hz) (triple counts (target i))) shifts) : + Fintype.card + (repairedInitialExecution counts total hx hy hz target injective shifts repair).Copies = + 2 ^ (3 * shifts) := by + change Fintype.card (InverseLinearRecovery.MaskRectangles shifts × PUnit) = _ + rw [Fintype.card_prod, ExactRecovery.card_mask_rectangles, Fintype.card_fin, + Fintype.card_punit] + exact Nat.mul_one _ + +end MatrixMultiplication.AllFieldInitialStep + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldConstruction/InitialZeroFinish.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldConstruction/InitialZeroFinish.lean new file mode 100644 index 0000000000000000000000000000000000000000..94c0b2f4440a315d538617b2ee422a8dcc9577ed --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldConstruction/InitialZeroFinish.lean @@ -0,0 +1,150 @@ +import OAI.LinearAlgebra.MatrixMultiplication.CoppersmithWinograd.CWZeroGeometry +import OAI.LinearAlgebra.MatrixMultiplication.FieldHistory.Tensors +import OAI.LinearAlgebra.MatrixMultiplication.FieldConstruction.InitialLeafRates +import OAI.LinearAlgebra.MatrixMultiplication.FieldConstruction.Terminal + +namespace OAI + +/-! Tensor extraction over arbitrary fields and its asymptotic rate. -/ + +noncomputable section + +namespace MatrixMultiplication.AllFieldInitialZeroFinish + +open MatrixMultiplication.Foundation AllFieldParameters AllFieldHistory AllFieldFiniteFamily +open AllFieldInitialLeafRates CWWindowedLeaves CWStrands CWZeroGeometry +open scoped BigOperators Classical + +variable {K : ℕ} + +abbrev Index (K : ℕ) := PopulationHistory K + +local instance : DecidableEq (Index K) := Classical.decEq _ + +theorem shape_total (h : InitialZero K) : shapeTotal (initialShape h.val) = 16 := + (root_shape_spec _ (initialShape_mem h.val)).2 + +theorem has_zero (h : InitialZero K) : ∃ i, initialShape h.val i = 0 := + terminal_has_zero (.initial h.val) h.property + +theorem canonical_axes_ne (h : InitialZero K) : + zeroAxis (initialShape h.val) ≠ maxAxis (initialShape h.val) := + zero_ne_selected _ _ _ (by rw [shape_total]; norm_num) + (zeroAxis_spec _ (has_zero h)) (maxAxis_spec _) + +def zero (h : Index K) : Fin 3 := h.2 (zeroAxis (initialShape h.1.val)) +def selected (h : Index K) : Fin 3 := h.2 (maxAxis (initialShape h.1.val)) + +theorem axes_ne (h : Index K) : zero h ≠ selected h := + fun he => canonical_axes_ne h.1 (h.2.injective he) + +theorem weights_sum (h : InitialZero K) : + shapeMax (initialShape h.val) + (16 - shapeMax (initialShape h.val)) = 2 * 8 := by + simpa only [shape_total h] using max_add_complement (initialShape h.val) + +theorem physical_shape_eq (h : Index K) : + physicalShape h.2 (initialShape h.1.val) = + CWOrientedZero.placedShape (zero h) (selected h) + (shapeMax (initialShape h.1.val)) (16 - shapeMax (initialShape h.1.val)) := by + simpa only [zero, selected, shape_total h.1] using + physicalShape_eq_placedShape (initialShape h.1.val) h.2 + (zeroAxis (initialShape h.1.val)) (maxAxis (initialShape h.1.val)) + (zeroAxis_spec _ (has_zero h.1)) (maxAxis_spec _) (canonical_axes_ne h.1) + +variable (allocation : Allocation) (dilation : ℕ) + +def embed (h : Index K) (side : Fin 3) (w : Words allocation dilation h) : + HistoryWord allocation dilation (.initial h.1.val, h.2) := + fun i => CWOrientedZero.sideWord (zero h) (selected h) side (w i) + +theorem coefficient (F : Type*) [Field F] (ε : ℝ) (h : Index K) + (x y z : Words allocation dilation h) : + historyTensor F allocation dilation ε (.initial h.1.val, h.2) + (embed allocation dilation h 0 x) (embed allocation dilation h 1 y) + (embed allocation dilation h 2 z) = + if CWOrientedZero.matched (zero h) x y z then 1 else 0 := by + rw [historyTensor_initial, physical_shape_eq] + exact CWOrientedZero.power_coefficient F 8 (shapeMax (initialShape h.1.val)) + (16 - shapeMax (initialShape h.1.val)) + (population allocation dilation (.initial h.1.val, h.2)) + (weights_sum h.1) (zero h) (selected h) (axes_ne h) + (fun w : Words allocation dilation h => w) Function.injective_id x y z + +abbrev RowIndex (h : Index K) := CWOrientedZero.Row (zero h) (Words allocation dilation h) +abbrev MiddleIndex (h : Index K) := CWOrientedZero.Middle (zero h) (Words allocation dilation h) +abbrev ColumnIndex (h : Index K) := CWOrientedZero.Column (zero h) (Words allocation dilation h) + +def factorMap (F : Type*) [Field F] (ε : ℝ) (h : Index K) : + LocalMap (historyTensor F allocation dilation ε (.initial h.1.val, h.2)) + (Tensor.matrixCoefficients (RowIndex allocation dilation h) + (MiddleIndex allocation dilation h) (ColumnIndex allocation dilation h)) := by + letI : Nonempty (Words allocation dilation h) := + Fintype.card_pos_iff.mp (card_words_pos allocation dilation h) + exact CWOrientedZero.ofMatching F _ (zero h) (embed allocation dilation h) + (coefficient allocation dilation F ε h) + +theorem factor_volume (h : Index K) : + Fintype.card (RowIndex allocation dilation h) * + Fintype.card (MiddleIndex allocation dilation h) * + Fintype.card (ColumnIndex allocation dilation h) = + Fintype.card (Words allocation dilation h) := + CWOrientedZero.volume (zero h) (Words allocation dilation h) + +abbrev RawWords := ∀ h : Index K, + HistoryWord allocation dilation (.initial h.1.val, h.2) +abbrev Rows := ∀ h : Index K, RowIndex allocation dilation h +abbrev Middles := ∀ h : Index K, MiddleIndex allocation dilation h +abbrev Columns := ∀ h : Index K, ColumnIndex allocation dilation h + +def source (F : Type*) [Field F] (ε : ℝ) : + Tensor F (RawWords (K := K) allocation dilation) + (RawWords (K := K) allocation dilation) (RawWords (K := K) allocation dilation) := + CommonDimensions.familyProduct (fun h : Index K => + historyTensor F allocation dilation ε (.initial h.1.val, h.2)) + +def finishMap (F : Type*) [Field F] (ε : ℝ) : + LocalMap (source (K := K) allocation dilation F ε) + (Tensor.matrixCoefficients (Rows (K := K) allocation dilation) + (Middles (K := K) allocation dilation) (Columns (K := K) allocation dilation)) := + AllFieldTerminal.terminalProductMap + (H := Index K) + (X := fun h => HistoryWord allocation dilation (.initial h.1.val, h.2)) + (Y := fun h => HistoryWord allocation dilation (.initial h.1.val, h.2)) + (Z := fun h => HistoryWord allocation dilation (.initial h.1.val, h.2)) + (fun h : Index K => historyTensor F allocation dilation ε (.initial h.1.val, h.2)) + (RowIndex allocation dilation) (MiddleIndex allocation dilation) + (ColumnIndex allocation dilation) (factorMap allocation dilation F ε) + +theorem volume_eq : + Fintype.card (Rows (K := K) allocation dilation) * + Fintype.card (Middles (K := K) allocation dilation) * + Fintype.card (Columns (K := K) allocation dilation) = + AllFieldInitialLeafRates.volume (K := K) allocation dilation := by + rw [AllFieldInitialLeafRates.volume_eq_prod] + simp only [Rows, Middles, Columns, Fintype.card_pi, + ← Finset.prod_mul_distrib] + apply Finset.prod_congr rfl + intro h _ + simpa only [Words, Fintype.card_pi] using factor_volume allocation dilation h + +theorem volume_pos : + 0 < Fintype.card (Rows (K := K) allocation dilation) * + Fintype.card (Middles (K := K) allocation dilation) * + Fintype.card (Columns (K := K) allocation dilation) := by + rw [volume_eq] + exact AllFieldInitialLeafRates.volume_pos allocation dilation + +theorem rows_pos : 0 < Fintype.card (Rows (K := K) allocation dilation) := + Nat.pos_of_mul_pos_right (Nat.pos_of_mul_pos_right (volume_pos allocation dilation)) + +theorem middles_pos : 0 < Fintype.card (Middles (K := K) allocation dilation) := + Nat.pos_of_mul_pos_left (Nat.pos_of_mul_pos_right (volume_pos allocation dilation)) + +theorem columns_pos : 0 < Fintype.card (Columns (K := K) allocation dilation) := + Nat.pos_of_mul_pos_left (volume_pos allocation dilation) + +end MatrixMultiplication.AllFieldInitialZeroFinish + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldConstruction/NativeCapacity.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldConstruction/NativeCapacity.lean new file mode 100644 index 0000000000000000000000000000000000000000..a8bb6be7e05ceb42bac3625c3e889d4b6a538615 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldConstruction/NativeCapacity.lean @@ -0,0 +1,160 @@ +import OAI.LinearAlgebra.MatrixMultiplication.FieldParameters.HalfLaws +import OAI.LinearAlgebra.MatrixMultiplication.FieldParameters.Entropy +import OAI.LinearAlgebra.MatrixMultiplication.FieldParameters.LeafRates +import OAI.LinearAlgebra.MatrixMultiplication.FieldHistory.Priority +import OAI.LinearAlgebra.MatrixMultiplication.FieldHistory.Sums +import OAI.LinearAlgebra.MatrixMultiplication.FieldParameters.StageC +import OAI.LinearAlgebra.MatrixMultiplication.JointExtraction.CapacityAlgebra + +namespace OAI + +/-! Tensor extraction over arbitrary fields and its asymptotic rate. -/ + +noncomputable section + +namespace MatrixMultiplication.AllFieldNativeCapacity + +open MatrixMultiplication.Foundation AllFieldParameters AllFieldHistory +open scoped BigOperators +attribute [local instance] Classical.propDecidable Classical.decEq + +variable {A : Type*} [Fintype A] + +def marginal (support : List Shape) (p : Shape → ℝ) (side : Fin 3) + (k : Fin 17) : ℝ := + (support.map fun u => if u side = k.val then p u else 0).sum + +def pairLaw (support : List Shape) (s : Shape) (p : Shape → ℝ) + (q : Shape → A → ℝ) (ij : A × A) : ℝ := + (support.map fun u => p u * q u ij.1 * q (complement s u) ij.2).sum + +def designated (priority : Placement) (position : Fin 3) (u : Shape) : Prop := + if position = 1 then u (priority 2) = 0 + else u (priority 0) = 0 ∨ u (priority 1) = 0 + +def singletonEntropy (support : List Shape) (p : Shape → ℝ) + (priority : Placement) (position : Fin 3) (q : Shape → A → ℝ) : ℝ := + (support.map fun u => if designated priority position u then + p u * homogeneousEntropy (q u) else 0).sum + +def residualLaw (support : List Shape) (p : Shape → ℝ) + (priority : Placement) (position : Fin 3) (q : Shape → A → ℝ) + (k : Fin 17) (a : A) : ℝ := + (support.map fun u => + if ¬ designated priority position u ∧ u (priority position) = k.val + then p u * q u a else 0).sum + +def groupedEntropy (support : List Shape) (p : Shape → ℝ) + (priority : Placement) (position : Fin 3) (q : Shape → A → ℝ) : ℝ := + singletonEntropy support p priority position q + + ∑ k : Fin 17, homogeneousEntropy (residualLaw support p priority position q k) + +def nativeCapacity (support : List Shape) (s : Shape) (p : Shape → ℝ) + (priority : Placement) (q : Shape → Fin 3 → A → ℝ) : Staggering.Capacity := + fun i => if i = 0 then homogeneousEntropy (marginal support p (priority 0)) + else homogeneousEntropy (pairLaw support s p (fun u => q u (priority i))) - + 2 * groupedEntropy support p priority i (fun u => q u (priority i)) + +@[simp] theorem nativeCapacity_first (support : List Shape) (s : Shape) + (p : Shape → ℝ) (priority : Placement) (q : Shape → Fin 3 → A → ℝ) : + nativeCapacity support s p priority q 0 = + homogeneousEntropy (marginal support p (priority 0)) := by + simp [nativeCapacity] + +theorem nativeCapacity_sharing (support : List Shape) (s : Shape) + (p : Shape → ℝ) (priority : Placement) (q : Shape → Fin 3 → A → ℝ) + (i : Fin 3) (hi : i ≠ 0) : + nativeCapacity support s p priority q i = + homogeneousEntropy (pairLaw support s p (fun u => q u (priority i))) - + 2 * groupedEntropy support p priority i (fun u => q u (priority i)) := by + simp only [nativeCapacity, ite_eq_right hi] + +theorem residual_entropy_eq_mass_mul (support : List Shape) (p : Shape → ℝ) + (priority : Placement) (position : Fin 3) (q : Shape → A → ℝ) (k : Fin 17) + (hm : ∑ a, residualLaw support p priority position q k a ≠ 0) : + homogeneousEntropy (residualLaw support p priority position q k) = + (∑ a, residualLaw support p priority position q k a) * + finiteEntropy (fun a => residualLaw support p priority position q k a / + ∑ b, residualLaw support p priority position q k b) := + homogeneousEntropy_eq_mass_mul _ hm + +def stageACapacity (g : Shape) : Staggering.Capacity := + nativeCapacity (below g) g (fun u => (stageALaw g u : ℝ)) + (Equiv.refl (Fin 3)) (fun u w a => (halfLaw u w a : ℝ)) + +def stageBCapacity (t : Shape) : Staggering.Capacity := + nativeCapacity (below t) t (fun u => (stageBLaw t u : ℝ)) + (stageBPriority t) (fun u w a => (littleLaw t u w a : ℝ)) + +def stageCCapacity (t u : Shape) (part : Fin 3) : Staggering.Capacity := + fun i => if i = part then binaryEntropyRate (binaryParameter t u) else Real.log 2 + +def nativeLA : Staggering.Capacity := fun i => + (positiveInitial.map fun g => (initialLaw g : ℝ) * stageACapacity g i).sum + +def nativeLB : Staggering.Capacity := fun i => + (positiveSecond.map fun t => (secondMass t : ℝ) * stageBCapacity t i).sum + +def interiorPairs : List (Shape × Shape) := + positiveSecond.flatMap fun t => + ((below t).filter positive).map fun u => (t, u) + +def interiorMass (tu : Shape × Shape) : ℝ := littleMass tu.1 tu.2 + +def interiorEntropy (tu : Shape × Shape) : ℝ := + binaryEntropyRate (binaryParameter tu.1 tu.2) + +def nativeT : ℝ := (interiorPairs.map interiorMass).sum + +def nativeB : ℝ := + (interiorPairs.map fun tu => interiorMass tu * + (2 * Real.log 2 + interiorEntropy tu)).sum / 3 + +def nativeHigh : ℝ := nativeT * Real.log 2 + +def nativeCstar : ℝ := Staggering.totalCapacity nativeLA nativeLB nativeB + +def nativeLambda : Fin 3 → ℝ := + Staggering.balanceFraction nativeLA nativeLB nativeHigh nativeB + +def nativeLC (allocation : Fin 3 → ℝ) : Staggering.Capacity := fun i => + (interiorPairs.map fun tu => interiorMass tu * + ((1 - allocation i) * Real.log 2 + allocation i * interiorEntropy tu)).sum + +theorem nativeLC_expansion (allocation : Fin 3 → ℝ) (i : Fin 3) : + nativeLC allocation i = nativeHigh - 3 * allocation i * (nativeHigh - nativeB) := by + unfold nativeLC nativeHigh nativeT nativeB + have h : ∀ xs : List (Shape × Shape), + (xs.map fun tu => interiorMass tu * + ((1 - allocation i) * Real.log 2 + allocation i * interiorEntropy tu)).sum = + (xs.map interiorMass).sum * Real.log 2 - 3 * allocation i * + ((xs.map interiorMass).sum * Real.log 2 - + (xs.map fun tu => interiorMass tu * + (2 * Real.log 2 + interiorEntropy tu)).sum / 3) := by + intro xs + induction xs with + | nil => simp + | cons tu xs ih => simp only [List.map_cons, List.sum_cons]; rw [ih]; ring + exact h interiorPairs + +theorem nativeLC_balanced (hgap : nativeB < nativeHigh) (i : Fin 3) : + nativeLC nativeLambda i = nativeCstar - (nativeLA i + nativeLB i) := by + rw [nativeLC_expansion] + exact Staggering.thirdCapacity_eq nativeLA nativeLB nativeHigh nativeB hgap i + +theorem native_balanced (hgap : nativeB < nativeHigh) (i : Fin 3) : + nativeLA i + nativeLB i + nativeLC nativeLambda i = nativeCstar := by + rw [nativeLC_balanced hgap] + ring + +def nativeBeta : ℝ := + Staggering.boundaryDeficit nativeLA nativeLB (nativeLC nativeLambda) nativeCstar + +theorem nativeBeta_nonnegative (hgap : nativeB < nativeHigh) : 0 ≤ nativeBeta := + Staggering.boundaryDeficit_nonneg _ _ _ _ (native_balanced hgap) + +end MatrixMultiplication.AllFieldNativeCapacity + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldConstruction/NativeGroupedRates.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldConstruction/NativeGroupedRates.lean new file mode 100644 index 0000000000000000000000000000000000000000..e1164254adfed8f2fee31763f1fa7afb4a346822 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldConstruction/NativeGroupedRates.lean @@ -0,0 +1,296 @@ +import OAI.LinearAlgebra.MatrixMultiplication.JointExtraction.GroupedEntropyPartition +import OAI.LinearAlgebra.MatrixMultiplication.FieldConstruction.PairConditionalEntropy +import OAI.LinearAlgebra.MatrixMultiplication.FieldConstruction.ComplementSums +import Mathlib.Data.List.NodupEquivFin + +namespace OAI + +/-! Tensor extraction over arbitrary fields and its asymptotic rate. -/ + +noncomputable section + +namespace MatrixMultiplication.AllFieldNativeGroupedRates + +open MatrixMultiplication.Foundation AllFieldParameters AllFieldHistory +open JointNativeGroupedEntropy JointGroupedEntropyPartition +open AllFieldNativeCapacity AllFieldPairConditionalEntropy +open scoped BigOperators +attribute [local instance] Classical.propDecidable Classical.decEq + +section Reindex + +variable {U K A : Type*} [Fintype U] [Fintype K] [Fintype A] + +omit [Fintype U] [Fintype K] in +theorem singletonResidualGroup_transport (e : U ≃ U) (c : K ≃ K) + (d : U → Prop) (weight : U → K) + (hw : ∀ u, c (weight u) = weight (e u)) : + (Equiv.sumCongr e c) ∘ singletonResidualGroup (d ∘ e) weight = + singletonResidualGroup d weight ∘ e := by + funext u + by_cases hu : d (e u) <;> + simp [singletonResidualGroup, Function.comp_apply, hu, hw] + +theorem singletonResidual_groupedEntropy_reindex (e : U ≃ U) (c : K ≃ K) + (p : U → ℝ) (d : U → Prop) (weight : U → K) (q : U → A → ℝ) + (hp : ∀ u, p (e u) = p u) (hw : ∀ u, c (weight u) = weight (e u)) : + JointCompatibilityIncidence.groupedEntropy p + (singletonResidualGroup (d ∘ e) weight) (q ∘ e) = + JointCompatibilityIncidence.groupedEntropy p (singletonResidualGroup d weight) q := by + calc + _ = JointCompatibilityIncidence.groupedEntropy p + ((Equiv.sumCongr e c) ∘ singletonResidualGroup (d ∘ e) weight) (q ∘ e) := + (JointCompatibilityIncidence.groupedEntropy_relabel (Equiv.sumCongr e c) p _ _).symm + _ = JointCompatibilityIncidence.groupedEntropy p + (singletonResidualGroup d weight ∘ e) (q ∘ e) := by + rw [singletonResidualGroup_transport e c d weight hw] + _ = _ := JointCompatibilityIncidence.groupedEntropy_reindex e p _ q hp + +theorem right_conditional_sum_eq (e : U ≃ U) (c : K ≃ K) + (p : FiniteLaw U) (d : U → Prop) (weight : U → K) (q : U → A → ℝ) + (hp : ∀ u, p.mass (e u) = p.mass u) + (hw : ∀ u, c (weight u) = weight (e u)) (hq : ∀ u, ∑ a, q u a = 1) : + (∑ k, (p.map weight).mass k * + JointCompatibilityIncidence.groupedEntropy (p.conditional weight k).mass + (JointCompatibilityIncidence.designatedGroup (d ∘ e)) (q ∘ e)) = + JointCompatibilityIncidence.groupedEntropy p.mass (singletonResidualGroup d weight) q := by + rw [← groupedEntropy_conditional_partition p (d ∘ e) weight (q ∘ e) + (fun u => hq (e u))] + exact singletonResidual_groupedEntropy_reindex e c p.mass d weight q hp hw + +end Reindex + +def supportSubtypeEquiv {α : Type*} (xs : List α) (f : α → α) + (hm : ∀ x ∈ xs, f x ∈ xs) (hi : ∀ x ∈ xs, f (f x) = x) : + Equiv.Perm {x // x ∈ xs} where + toFun x := ⟨f x.val, hm x.val x.property⟩ + invFun x := ⟨f x.val, hm x.val x.property⟩ + left_inv x := Subtype.ext (hi x.val x.property) + right_inv x := Subtype.ext (hi x.val x.property) + +def supportIndexEquiv {α : Type*} [DecidableEq α] (xs : List α) (hn : xs.Nodup) + (f : α → α) (hm : ∀ x ∈ xs, f x ∈ xs) (hi : ∀ x ∈ xs, f (f x) = x) : + Equiv.Perm (Fin xs.length) := + ((hn.getEquiv xs).trans (supportSubtypeEquiv xs f hm hi)).trans (hn.getEquiv xs).symm + +theorem supportIndexEquiv_get {α : Type*} [DecidableEq α] (xs : List α) + (hn : xs.Nodup) (f : α → α) (hm : ∀ x ∈ xs, f x ∈ xs) + (hi : ∀ x ∈ xs, f (f x) = x) (i : Fin xs.length) : + xs.get (supportIndexEquiv xs hn f hm hi i) = f (xs.get i) := by + exact congrArg Subtype.val ((hn.getEquiv xs).apply_symm_apply + ((supportSubtypeEquiv xs f hm hi) ((hn.getEquiv xs) i))) + +def boundedComplement (s : ℕ) (hs : s < 17) (k : Fin 17) : Fin 17 := + ⟨if k.val ≤ s then s - k.val else k.val, by + split_ifs + · exact lt_of_le_of_lt (Nat.sub_le _ _) hs + · exact k.isLt⟩ + +theorem boundedComplement_involutive (s : ℕ) (hs : s < 17) : + Function.Involutive (boundedComplement s hs) := by + intro k + apply Fin.ext + dsimp only [boundedComplement] + split_ifs <;> omega + +def boundedComplementEquiv (s : ℕ) (hs : s < 17) : Equiv.Perm (Fin 17) where + toFun := boundedComplement s hs + invFun := boundedComplement s hs + left_inv := boundedComplement_involutive s hs + right_inv := boundedComplement_involutive s hs + +section NativeSupport + +variable {A : Type*} [Fintype A] + +theorem native_right_conditional_sum_eq (support : List Shape) (s : Shape) + (p : Shape → ℝ) (priority : Placement) (position : Fin 3) (q : Shape → A → ℝ) + (hn : support.Nodup) (hm : ∀ u ∈ support, complement s u ∈ support) + (hsupp : ∀ u ∈ support, ∀ side, u side ≤ s side) + (hs : s (priority position) < 17) + (hbound : ∀ i : SupportIndex support, support[i.val] (priority position) < 17) + (law : FiniteLaw (SupportIndex support)) + (hlaw : ∀ i : SupportIndex support, law.mass i = p support[i.val]) + (hp : ∀ u ∈ support, p (complement s u) = p u) + (hq : ∀ i : SupportIndex support, ∑ a, q support[i.val] a = 1) : + (∑ k : Fin 17, (law.map (ownWeight support priority position hbound)).mass k * + JointCompatibilityIncidence.groupedEntropy + (law.conditional (ownWeight support priority position hbound) k).mass + (JointCompatibilityIncidence.designatedGroup (fun i => + AllFieldNativeCapacity.designated priority position (complement s support[i.val]))) + (fun i => q (complement s support[i.val]))) = + AllFieldNativeCapacity.groupedEntropy support p priority position q := by + let hi : ∀ u ∈ support, complement s (complement s u) = u := + fun u hu => complement_involution_of_le s u (hsupp u hu) + let e := supportIndexEquiv support hn (complement s) hm hi + let c := boundedComplementEquiv (s (priority position)) hs + let weight := ownWeight support priority position hbound + let d : SupportIndex support → Prop := + fun i => AllFieldNativeCapacity.designated priority position support[i.val] + let q₀ : SupportIndex support → A → ℝ := fun i => q support[i.val] + have he (i : SupportIndex support) : + support[(e i).val] = complement s support[i.val] := by + simpa only [List.get_eq_getElem] using + supportIndexEquiv_get support hn (complement s) hm hi i + have hmass (i : SupportIndex support) : law.mass (e i) = law.mass i := by + simp only [hlaw, he] + exact hp _ (List.getElem_mem i.isLt) + have hw (i : SupportIndex support) : c (weight i) = weight (e i) := by + apply Fin.ext + change (if support[i.val] (priority position) ≤ s (priority position) + then s (priority position) - support[i.val] (priority position) + else support[i.val] (priority position)) = support[(e i).val] (priority position) + rw [ite_eq_left (hsupp _ (List.getElem_mem i.isLt) _), he] + rfl + have hright := right_conditional_sum_eq e c law d weight q₀ hmass hw hq + have hd : d ∘ e = fun i => + AllFieldNativeCapacity.designated priority position (complement s support[i.val]) := by + funext i + dsimp only [d, Function.comp_apply] + rw [he] + have hqr : q₀ ∘ e = fun i => q (complement s support[i.val]) := by + funext i + dsimp only [q₀, Function.comp_apply] + rw [he] + rw [hd, hqr] at hright + have hnonneg (i : SupportIndex support) : 0 ≤ p support[i.val] := by + rw [← hlaw i] + exact law.nonneg i + have hmassfun : law.mass = fun i : SupportIndex support => p support[i.val] := funext hlaw + calc + _ = JointCompatibilityIncidence.groupedEntropy law.mass + (nativeGroup support priority position hbound) (fun i => q support[i.val]) := by + simpa only [d, q₀, weight, nativeGroup] using hright + _ = _ := by + rw [hmassfun] + exact groupedEntropy_eq_native support p priority position q hbound hnonneg hq + +theorem native_two_conditional_sums_eq (support : List Shape) (s : Shape) + (p : Shape → ℝ) (priority : Placement) (position : Fin 3) (q : Shape → A → ℝ) + (hn : support.Nodup) (hm : ∀ u ∈ support, complement s u ∈ support) + (hsupp : ∀ u ∈ support, ∀ side, u side ≤ s side) + (hs : s (priority position) < 17) + (hbound : ∀ i : SupportIndex support, support[i.val] (priority position) < 17) + (law : FiniteLaw (SupportIndex support)) + (hlaw : ∀ i : SupportIndex support, law.mass i = p support[i.val]) + (hp : ∀ u ∈ support, p (complement s u) = p u) + (hq : ∀ i : SupportIndex support, ∑ a, q support[i.val] a = 1) : + (∑ k : Fin 17, (law.map (ownWeight support priority position hbound)).mass k * + (JointCompatibilityIncidence.groupedEntropy + (law.conditional (ownWeight support priority position hbound) k).mass + (JointCompatibilityIncidence.designatedGroup (fun i => + AllFieldNativeCapacity.designated priority position support[i.val])) + (fun i => q support[i.val]) + + JointCompatibilityIncidence.groupedEntropy + (law.conditional (ownWeight support priority position hbound) k).mass + (JointCompatibilityIncidence.designatedGroup (fun i => + AllFieldNativeCapacity.designated priority position (complement s support[i.val]))) + (fun i => q (complement s support[i.val])))) = + 2 * AllFieldNativeCapacity.groupedEntropy support p priority position q := by + simp only [mul_add, Finset.sum_add_distrib] + rw [← native_groupedEntropy_eq_sum_conditional support p priority position q hbound law hlaw hq, + native_right_conditional_sum_eq support s p priority position q hn hm hsupp hs + hbound law hlaw hp hq] + ring + +end NativeSupport + +def twoHalfConditionalCost {A : Type*} [Fintype A] + (support : List Shape) (s : Shape) (priority : Placement) (position : Fin 3) + (q : Shape → A → ℝ) (law : FiniteLaw (SupportIndex support)) + (weight : SupportIndex support → Fin 17) : ℝ := + ∑ k : Fin 17, (law.map weight).mass k * + (JointCompatibilityIncidence.groupedEntropy (law.conditional weight k).mass + (JointCompatibilityIncidence.designatedGroup (fun i => + AllFieldNativeCapacity.designated priority position support[i.val])) + (fun i => q support[i.val]) + + JointCompatibilityIncidence.groupedEntropy (law.conditional weight k).mass + (JointCompatibilityIncidence.designatedGroup (fun i => + AllFieldNativeCapacity.designated priority position (complement s support[i.val]))) + (fun i => q (complement s support[i.val]))) + +theorem stageA_twoHalfConditionalCost_eq (g : Shape) (hg : g ∈ positiveInitial) + (priority : Placement) (position : Fin 3) : + twoHalfConditionalCost (below g) g priority position + (fun u a => (halfLaw u (priority position) a : ℝ)) (stageASplitLaw g hg) + (stageASplitWeight g hg (priority position)) = + 2 * AllFieldNativeCapacity.groupedEntropy (below g) + (fun u => (stageALaw g u : ℝ)) priority position + (fun u a => (halfLaw u (priority position) a : ℝ)) := by + have hs : g (priority position) < 17 := + Nat.lt_succ_of_le ((positiveInitial_shape_spec g hg).1 (priority position)) + let hb : ∀ i : SupportIndex (below g), (below g)[i.val] (priority position) < 17 := + fun i => lt_of_le_of_lt (below_le (List.getElem_mem i.isLt) _) hs + have hq (i : SupportIndex (below g)) : + ∑ a, (halfLaw (below g)[i.val] (priority position) a : ℝ) = 1 := + (halfFiniteLaw _ (stageA_children_size g hg _ (List.getElem_mem i.isLt)) + (priority position)).total + have hh := native_two_conditional_sums_eq (below g) g + (fun u => (stageALaw g u : ℝ)) priority position + (fun u a => (halfLaw u (priority position) a : ℝ)) + (stageA_below_nodup g hg) (fun u hu => (stageA_support_complement g hg u hu).1) + (fun _ hu => below_le hu) hs hb (stageASplitLaw g hg) (fun _ => rfl) + (fun u hu => by rw [stageALaw_complement g u hg hu]) hq + have hw : ownWeight (below g) priority position hb = + stageASplitWeight g hg (priority position) := by + funext i + apply Fin.ext + simp only [ownWeight, stageASplitWeight, List.get_eq_getElem] + rw [hw] at hh + simpa only [twoHalfConditionalCost] using hh + +theorem stageB_twoHalfConditionalCost_eq (t : Shape) (ht : t ∈ positiveSecond) + (priority : Placement) (position : Fin 3) : + twoHalfConditionalCost (below t) t priority position + (fun u a => (littleLaw t u (priority position) a : ℝ)) (stageBSplitLaw t ht) + (stageBSplitWeight t ht (priority position)) = + 2 * AllFieldNativeCapacity.groupedEntropy (below t) + (fun u => (stageBLaw t u : ℝ)) priority position + (fun u a => (littleLaw t u (priority position) a : ℝ)) := by + have hs : t (priority position) < 17 := + Nat.lt_succ_of_le ((positiveSecond_shape_spec t ht).1 (priority position)) + let hb : ∀ i : SupportIndex (below t), (below t)[i.val] (priority position) < 17 := + fun i => lt_of_le_of_lt (below_le (List.getElem_mem i.isLt) _) hs + have hq (i : SupportIndex (below t)) : + ∑ a, (littleLaw t (below t)[i.val] (priority position) a : ℝ) = 1 := + (littleFiniteLaw t _ (priority position)).total + have hh := native_two_conditional_sums_eq (below t) t + (fun u => (stageBLaw t u : ℝ)) priority position + (fun u a => (littleLaw t u (priority position) a : ℝ)) + (stageB_below_nodup t ht) (fun u hu => (stageB_support_complement t ht u hu).1) + (fun _ hu => below_le hu) hs hb (stageBSplitLaw t ht) (fun _ => rfl) + (fun u hu => by rw [stageBLaw_complement t u ht hu]) hq + have hw : ownWeight (below t) priority position hb = + stageBSplitWeight t ht (priority position) := by + funext i + apply Fin.ext + simp only [ownWeight, stageBSplitWeight, List.get_eq_getElem] + rw [hw] at hh + simpa only [twoHalfConditionalCost] using hh + +theorem stageA_twoHalfConditionalCost_eq_entropy_sub_capacity + (g : Shape) (hg : g ∈ positiveInitial) (side : Fin 3) (hside : side ≠ 0) : + twoHalfConditionalCost (below g) g (Equiv.refl (Fin 3)) side + (fun u a => (halfLaw u side a : ℝ)) (stageASplitLaw g hg) + (stageASplitWeight g hg side) = + finiteEntropy (stageAPairLaw g hg side).mass - stageACapacity g side := by + rw [stageACapacity_sharing g hg side hside] + have hh := stageA_twoHalfConditionalCost_eq g hg (Equiv.refl (Fin 3)) side + simpa only [Equiv.refl_apply, sub_sub_cancel] using hh + +theorem stageB_twoHalfConditionalCost_eq_entropy_sub_capacity + (t : Shape) (ht : t ∈ positiveSecond) (side : Fin 3) (hside : side ≠ 0) : + twoHalfConditionalCost (below t) t (stageBPriority t) side + (fun u a => (littleLaw t u (stageBPriority t side) a : ℝ)) (stageBSplitLaw t ht) + (stageBSplitWeight t ht (stageBPriority t side)) = + finiteEntropy (stageBPairLaw t ht (stageBPriority t side)).mass - + stageBCapacity t side := by + rw [stageBCapacity_sharing t ht side hside] + have hh := stageB_twoHalfConditionalCost_eq t ht (stageBPriority t) side + simpa only [sub_sub_cancel] using hh + +end MatrixMultiplication.AllFieldNativeGroupedRates + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldConstruction/NativeLaws.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldConstruction/NativeLaws.lean new file mode 100644 index 0000000000000000000000000000000000000000..54199de3a36136e828c90116f4c2518be1e20c84 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldConstruction/NativeLaws.lean @@ -0,0 +1,179 @@ +import OAI.LinearAlgebra.MatrixMultiplication.FieldConstruction.NativeCapacity +import OAI.LinearAlgebra.MatrixMultiplication.FieldConstruction.ShapeEncoding +import OAI.LinearAlgebra.MatrixMultiplication.Separation.ComplexRationalTypes + +namespace OAI + +/-! Tensor extraction over arbitrary fields and its asymptotic rate. -/ + +noncomputable section + +namespace MatrixMultiplication.AllFieldNativeCapacity + +open MatrixMultiplication.Foundation AllFieldParameters AllFieldHistory +open scoped BigOperators + +def indexedRationalLaw (support : List Shape) (p : Shape → ℚ) + (hpos : ∀ u ∈ support, 0 ≤ p u) (htotal : (support.map p).sum = 1) : + RationalLaw (Fin support.length) where + mass j := p (support.get j) + nonneg j := hpos _ (List.get_mem _ _) + total := by + simp only [List.get_eq_getElem] + rw [Fin.sum_univ_fun_getElem] + exact htotal + +def stageASplitLaw (g : Shape) (hg : g ∈ positiveInitial) : + FiniteLaw (Fin (below g).length) := + (indexedRationalLaw (below g) (stageALaw g) + (fun u hu => (stageALaw_positive g u hu).le) (stageALaw_normalized g hg)).toFiniteLaw + +def stageBSplitLaw (t : Shape) (ht : t ∈ positiveSecond) : + FiniteLaw (Fin (below t).length) := + (indexedRationalLaw (below t) (stageBLaw t) + (fun u hu => (stageBLaw_positive t u hu).le) (stageBLaw_normalized t ht)).toFiniteLaw + +def indexedMarginalLaw (support : List Shape) (p : Shape → ℚ) + (hpos : ∀ u ∈ support, 0 ≤ p u) (htotal : (support.map p).sum = 1) + (side : Fin 3) (hbound : ∀ u ∈ support, u side < 17) : FiniteLaw (Fin 17) := + (indexedRationalLaw support p hpos htotal).toFiniteLaw.map + (fun j => ⟨support.get j side, hbound _ (List.get_mem _ _)⟩) + +theorem indexedMarginalLaw_mass (support : List Shape) (p : Shape → ℚ) + (hpos : ∀ u ∈ support, 0 ≤ p u) (htotal : (support.map p).sum = 1) + (side : Fin 3) (hbound : ∀ u ∈ support, u side < 17) (k : Fin 17) : + (indexedMarginalLaw support p hpos htotal side hbound).mass k = + marginal support (fun u => (p u : ℝ)) side k := by + simp only [indexedMarginalLaw, FiniteLaw.map_mass, RationalLaw.toFiniteLaw_mass, + indexedRationalLaw, Fin.ext_iff, marginal, List.get_eq_getElem] + exact Fin.sum_univ_fun_getElem support (fun u : Shape => if u side = k.val then (p u : ℝ) else 0) + +def stageAMarginalLaw (g : Shape) (hg : g ∈ positiveInitial) (side : Fin 3) : + FiniteLaw (Fin 17) := + indexedMarginalLaw (below g) (stageALaw g) + (fun u hu => (stageALaw_positive g u hu).le) (stageALaw_normalized g hg) side + (fun _ hu => Nat.lt_succ_of_le ((below_le hu side).trans + ((positiveInitial_shape_spec g hg).1 side))) + +def stageBMarginalLaw (t : Shape) (ht : t ∈ positiveSecond) (side : Fin 3) : + FiniteLaw (Fin 17) := + indexedMarginalLaw (below t) (stageBLaw t) + (fun u hu => (stageBLaw_positive t u hu).le) (stageBLaw_normalized t ht) side + (fun _ hu => Nat.lt_succ_of_le ((below_le hu side).trans + ((positiveSecond_shape_spec t ht).1 side))) + +theorem stageACapacity_first_entropy (g : Shape) (hg : g ∈ positiveInitial) : + stageACapacity g 0 = finiteEntropy (stageAMarginalLaw g hg 0).mass := by + rw [stageACapacity, nativeCapacity_first] + simp only [Equiv.refl_apply] + have hm : (stageAMarginalLaw g hg 0).mass = + marginal (below g) (fun u => (stageALaw g u : ℝ)) 0 := by + funext k + exact indexedMarginalLaw_mass _ _ _ _ _ _ k + rw [← hm] + exact homogeneousEntropy_normalized _ (stageAMarginalLaw g hg 0).total + +theorem stageBCapacity_first_entropy (t : Shape) (ht : t ∈ positiveSecond) : + stageBCapacity t 0 = + finiteEntropy (stageBMarginalLaw t ht (stageBPriority t 0)).mass := by + rw [stageBCapacity, nativeCapacity_first] + have hm : (stageBMarginalLaw t ht (stageBPriority t 0)).mass = + marginal (below t) (fun u => (stageBLaw t u : ℝ)) (stageBPriority t 0) := by + funext k + exact indexedMarginalLaw_mass _ _ _ _ _ _ k + rw [← hm] + exact homogeneousEntropy_normalized _ (stageBMarginalLaw t ht (stageBPriority t 0)).total + +def halfFiniteLaw (t : Shape) (ht : t ∈ shapes 8) (side : Fin 3) : FiniteLaw PairSlot where + mass a := (halfLaw t side a : ℝ) + nonneg a := by exact_mod_cast halfLaw_nonnegative t side a + total := by exact_mod_cast halfLaw_normalized t ht side + +def littleFiniteLaw (t u : Shape) (side : Fin 3) : FiniteLaw (Fin 6) where + mass a := (littleLaw t u side a : ℝ) + nonneg a := by exact_mod_cast littleLaw_nonnegative t u side a + total := by exact_mod_cast littleLaw_normalized t u side + +private theorem list_rat_cast {I : Type*} (xs : List I) (f : I → ℚ) : + ((xs.map f).sum : ℝ) = (xs.map fun i => (f i : ℝ)).sum := by + induction xs with + | nil => simp + | cons i xs ih => simp [ih] + +theorem pairLaw_total {A : Type*} [Fintype A] (support : List Shape) (s : Shape) + (p : Shape → ℝ) (q : Shape → A → ℝ) + (hleft : ∀ u ∈ support, ∑ a, q u a = 1) + (hright : ∀ u ∈ support, ∑ a, q (complement s u) a = 1) : + (∑ ij : A × A, pairLaw support s p q ij) = (support.map p).sum := by + unfold pairLaw + induction support with + | nil => simp + | cons u us ih => + have hl := hleft u (by simp) + have hr := hright u (by simp) + have hh : (∑ ij : A × A, p u * q u ij.1 * q (complement s u) ij.2) = p u := by + simp [Fintype.sum_prod_type, ← Finset.mul_sum, hl, hr] + have ht := ih (fun v hv => hleft v (by simp [hv])) + (fun v hv => hright v (by simp [hv])) + simpa only [List.map_cons, List.sum_cons, Finset.sum_add_distrib, hh] using + congrArg (fun x => p u + x) ht + +def pairFiniteLaw {A : Type*} [Fintype A] (support : List Shape) (s : Shape) + (p : Shape → ℝ) (q : Shape → A → ℝ) + (hpos : ∀ u ∈ support, 0 ≤ p u) (htotal : (support.map p).sum = 1) + (hqpos : ∀ u a, 0 ≤ q u a) + (hleft : ∀ u ∈ support, ∑ a, q u a = 1) + (hright : ∀ u ∈ support, ∑ a, q (complement s u) a = 1) : FiniteLaw (A × A) where + mass := pairLaw support s p q + nonneg ij := by + apply List.sum_nonneg + intro x hx + obtain ⟨u, hu, rfl⟩ := List.mem_map.mp hx + exact mul_nonneg (mul_nonneg (hpos u hu) (hqpos u ij.1)) + (hqpos (complement s u) ij.2) + total := (pairLaw_total support s p q hleft hright).trans htotal + +def stageAPairLaw (g : Shape) (hg : g ∈ positiveInitial) (side : Fin 3) : + FiniteLaw (PairSlot × PairSlot) := + pairFiniteLaw (below g) g (fun u => (stageALaw g u : ℝ)) + (fun u a => (halfLaw u side a : ℝ)) + (fun u hu => Rat.cast_nonneg.mpr (stageALaw_positive g u hu).le) + (by rw [← list_rat_cast, stageALaw_normalized g hg]; norm_num) + (fun u a => Rat.cast_nonneg.mpr (halfLaw_nonnegative u side a)) + (fun u hu => (halfFiniteLaw u (stageA_children_size g hg u hu) side).total) + (fun u hu => (halfFiniteLaw (complement g u) + (stageA_children_size g hg _ (stageA_support_complement g hg u hu).1) side).total) + +def stageBPairLaw (t : Shape) (ht : t ∈ positiveSecond) (side : Fin 3) : + FiniteLaw (Fin 6 × Fin 6) := + pairFiniteLaw (below t) t (fun u => (stageBLaw t u : ℝ)) + (fun u a => (littleLaw t u side a : ℝ)) + (fun u hu => Rat.cast_nonneg.mpr (stageBLaw_positive t u hu).le) + (by rw [← list_rat_cast, stageBLaw_normalized t ht]; norm_num) + (fun u a => Rat.cast_nonneg.mpr (littleLaw_nonnegative t u side a)) + (fun u _ => (littleFiniteLaw t u side).total) + (fun u _ => (littleFiniteLaw t (complement t u) side).total) + +theorem stageACapacity_sharing (g : Shape) (hg : g ∈ positiveInitial) + (i : Fin 3) (hi : i ≠ 0) : + stageACapacity g i = finiteEntropy (stageAPairLaw g hg i).mass - + 2 * groupedEntropy (below g) (fun u => (stageALaw g u : ℝ)) + (Equiv.refl (Fin 3)) i (fun u a => (halfLaw u i a : ℝ)) := by + rw [stageACapacity, nativeCapacity_sharing _ _ _ _ _ i hi] + congr 1 + exact homogeneousEntropy_normalized _ (stageAPairLaw g hg i).total + +theorem stageBCapacity_sharing (t : Shape) (ht : t ∈ positiveSecond) + (i : Fin 3) (hi : i ≠ 0) : + stageBCapacity t i = finiteEntropy (stageBPairLaw t ht (stageBPriority t i)).mass - + 2 * groupedEntropy (below t) (fun u => (stageBLaw t u : ℝ)) + (stageBPriority t) i (fun u a => (littleLaw t u (stageBPriority t i) a : ℝ)) := by + rw [stageBCapacity, nativeCapacity_sharing _ _ _ _ _ i hi] + congr 1 + exact homogeneousEntropy_normalized _ (stageBPairLaw t ht (stageBPriority t i)).total + +end MatrixMultiplication.AllFieldNativeCapacity + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldConstruction/OrderedLimits.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldConstruction/OrderedLimits.lean new file mode 100644 index 0000000000000000000000000000000000000000..420e0a1af9dd1447f50fbe8377f9906870017e59 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldConstruction/OrderedLimits.lean @@ -0,0 +1,78 @@ +import OAI.LinearAlgebra.MatrixMultiplication.FieldConstruction.ConstructionFamily + +namespace OAI + +/-! Tensor extraction over arbitrary fields and its asymptotic rate. -/ + +noncomputable section + +namespace MatrixMultiplication.AllFieldOrderedLimits + +open AllFieldHistory AllFieldNativeCapacity AllFieldScheduledYield +open AllFieldConstructionRates Filter +open scoped Topology + +variable (F : Type*) [Field F] + +theorem fixed_lot_constraint (K : ℕ) (hK : 2 ≤ K) + (hgap : nativeB < nativeHigh) + (hfeas : ∀ i, nativeCstar - (nativeLA i + nativeLB i) < nativeHigh) + (ha : ∀ i, 0 < nativeLA i) (hb : ∀ i, 0 < nativeLB i) + (hc : ∀ i, 0 < nativeLC nativeLambda i) : + AllFieldInitialEntropy.nativeH0 + nativeCstar - nativeBeta / (K : ℝ) + + (Arithmetic.omega F / 3) * AllFieldTerminalRates.S ≤ 8 * Real.log 7 := by + obtain ⟨allocation, halloc⟩ := exists_balanced_allocation_sequence hgap hfeas + have hcap := eventually_capacity_pos hK allocation halloc ha hb hc + have hy := (physicalYield_tendsto_balanced K hK hgap allocation halloc).div_const (K : ℝ) + have hH0 : Tendsto (fun _ : ℕ => AllFieldInitialEntropy.nativeH0) atTop + (𝓝 AllFieldInitialEntropy.nativeH0) := tendsto_const_nhds + have hlimit := (hH0.add hy).add + (tendsto_const_nhds : Tendsto (fun _ : ℕ => + (Arithmetic.omega F / 3) * AllFieldTerminalRates.S) atTop (𝓝 _)) + have hineq : AllFieldInitialEntropy.nativeH0 + + ((K : ℝ) * nativeCstar - nativeBeta) / (K : ℝ) + + (Arithmetic.omega F / 3) * AllFieldTerminalRates.S ≤ 8 * Real.log 7 := by + apply le_of_tendsto_of_tendsto hlimit tendsto_const_nhds + filter_upwards [hcap] with j hj + exact AllFieldConstructionFamily.fixed_allocation_constraint F (by omega) + (allocation j) hj + have hk : (K : ℝ) ≠ 0 := by exact_mod_cast (show K ≠ 0 by omega) + have heq : ((K : ℝ) * nativeCstar - nativeBeta) / (K : ℝ) = + nativeCstar - nativeBeta / (K : ℝ) := by + rw [sub_div, mul_div_cancel_left₀ _ hk] + rw [heq] at hineq + simpa only [← add_sub_assoc] using hineq + +theorem native_rank_constraint + (hgap : nativeB < nativeHigh) + (hfeas : ∀ i, nativeCstar - (nativeLA i + nativeLB i) < nativeHigh) + (ha : ∀ i, 0 < nativeLA i) (hb : ∀ i, 0 < nativeLB i) + (hc : ∀ i, 0 < nativeLC nativeLambda i) : + AllFieldInitialEntropy.nativeH0 + nativeCstar + + (Arithmetic.omega F / 3) * AllFieldTerminalRates.S ≤ 8 * Real.log 7 := by + have hfixed (K : ℕ) (hK : 2 ≤ K) : + (AllFieldInitialEntropy.nativeH0 + nativeCstar) - nativeBeta / (K : ℝ) + + Arithmetic.omega F * AllFieldTerminalRates.S / 3 ≤ 8 * Real.log 7 := by + have h := fixed_lot_constraint F K hK hgap hfeas ha hb hc + nlinarith + have h := FiniteSchedule.fixed_lot_boundary_limit hfixed + nlinarith + +theorem omega_le_native_ratio + (hgap : nativeB < nativeHigh) + (hfeas : ∀ i, nativeCstar - (nativeLA i + nativeLB i) < nativeHigh) + (ha : ∀ i, 0 < nativeLA i) (hb : ∀ i, 0 < nativeLB i) + (hc : ∀ i, 0 < nativeLC nativeLambda i) + (hS : 0 < AllFieldTerminalRates.S) : + Arithmetic.omega F ≤ + 3 * (8 * Real.log 7 - + (AllFieldInitialEntropy.nativeH0 + nativeCstar)) / AllFieldTerminalRates.S := by + apply (le_div_iff₀ hS).mpr + have h := native_rank_constraint F hgap hfeas ha hb hc + nlinarith + +end MatrixMultiplication.AllFieldOrderedLimits + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldConstruction/PairConditionalEntropy.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldConstruction/PairConditionalEntropy.lean new file mode 100644 index 0000000000000000000000000000000000000000..a42fd6889ee0bb0b3dd3466d19d2c2eec89d5084 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldConstruction/PairConditionalEntropy.lean @@ -0,0 +1,78 @@ +import OAI.LinearAlgebra.MatrixMultiplication.FieldConstruction.PairMarginals + +namespace OAI + +/-! Tensor extraction over arbitrary fields and its asymptotic rate. -/ + +noncomputable section + +namespace MatrixMultiplication.AllFieldPairConditionalEntropy + +open MatrixMultiplication.Foundation AllFieldParameters AllFieldHistory +open AllFieldNativeCapacity AllFieldPairMarginals +open scoped BigOperators + +theorem entropy_sub_eq_conditional_sum + {A B C : Type*} [Fintype A] [Fintype B] [Fintype C] + (p : FiniteLaw A) (q : FiniteLaw B) (m : FiniteLaw C) + (f : A → C) (g : B → C) (hp : p.map f = m) (hq : q.map g = m) : + finiteEntropy p.mass - finiteEntropy q.mass = + ∑ k, m.mass k * (finiteEntropy (p.conditional f k).mass - + finiteEntropy (q.conditional g k).mass) := by + rw [p.entropy_eq_map_add_conditional f, q.entropy_eq_map_add_conditional g, hp, hq] + simp only [mul_sub, Finset.sum_sub_distrib] + ring + +def stageASplitWeight (g : Shape) (hg : g ∈ positiveInitial) (side : Fin 3) : + Fin (below g).length → Fin 17 := + fun j => ⟨(below g).get j side, + Nat.lt_succ_of_le ((below_le (List.get_mem _ _) side).trans + ((positiveInitial_shape_spec g hg).1 side))⟩ + +def stageBSplitWeight (t : Shape) (ht : t ∈ positiveSecond) (side : Fin 3) : + Fin (below t).length → Fin 17 := + fun j => ⟨(below t).get j side, + Nat.lt_succ_of_le ((below_le (List.get_mem _ _) side).trans + ((positiveSecond_shape_spec t ht).1 side))⟩ + +theorem stageASplitLaw_ownWeight_marginal (g : Shape) (hg : g ∈ positiveInitial) + (side : Fin 3) : + (stageASplitLaw g hg).map (stageASplitWeight g hg side) = + stageAMarginalLaw g hg side := rfl + +theorem stageBSplitLaw_ownWeight_marginal (t : Shape) (ht : t ∈ positiveSecond) + (side : Fin 3) : + (stageBSplitLaw t ht).map (stageBSplitWeight t ht side) = + stageBMarginalLaw t ht side := rfl + +theorem stageA_entropy_sub_pair_eq_conditional_sum + (g : Shape) (hg : g ∈ positiveInitial) (side : Fin 3) : + finiteEntropy (stageASplitLaw g hg).mass - + finiteEntropy (stageAPairLaw g hg side).mass = + ∑ k, (stageAMarginalLaw g hg side).mass k * + (finiteEntropy ((stageASplitLaw g hg).conditional + (stageASplitWeight g hg side) k).mass - + finiteEntropy ((stageAPairLaw g hg side).conditional + (fun ij => halfWeightCode ij.1) k).mass) := + entropy_sub_eq_conditional_sum _ _ _ _ _ + (stageASplitLaw_ownWeight_marginal g hg side) + (stageAPairLaw_leftWeight_marginal g hg side) + +theorem stageB_entropy_sub_pair_eq_conditional_sum + (t : Shape) (ht : t ∈ positiveSecond) (side : Fin 3) : + finiteEntropy (stageBSplitLaw t ht).mass - + finiteEntropy (stageBPairLaw t ht side).mass = + ∑ k, (stageBMarginalLaw t ht side).mass k * + (finiteEntropy ((stageBSplitLaw t ht).conditional + (stageBSplitWeight t ht side) k).mass - + finiteEntropy ((stageBPairLaw t ht side).conditional + (fun ij => statisticWeightCode ij.1) k).mass) := + entropy_sub_eq_conditional_sum _ _ _ _ _ + (stageBSplitLaw_ownWeight_marginal t ht side) + (stageBPairLaw_leftWeight_marginal t ht side) + +end MatrixMultiplication.AllFieldPairConditionalEntropy + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldConstruction/PairMarginals.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldConstruction/PairMarginals.lean new file mode 100644 index 0000000000000000000000000000000000000000..1ca91d3ef7eb018375683c185165bab1f19fc77d --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldConstruction/PairMarginals.lean @@ -0,0 +1,165 @@ +import OAI.LinearAlgebra.MatrixMultiplication.FieldConstruction.NativeLaws + +namespace OAI + +/-! Tensor extraction over arbitrary fields and its asymptotic rate. -/ + +noncomputable section + +namespace MatrixMultiplication.AllFieldPairMarginals + +open MatrixMultiplication.Foundation AllFieldParameters AllFieldHistory AllFieldNativeCapacity +open scoped BigOperators +attribute [local instance] Classical.propDecidable Classical.decEq + +theorem statistic_weight_mass {A : Type*} [Fintype A] + (q : A → ℝ) (weight : A → Fin 17) (own : ℕ) + (hq : ∀ a, 0 ≤ q a) (htotal : ∑ a, q a = 1) + (hweight : ∀ a, 0 < q a → (weight a).val = own) (k : Fin 17) : + (∑ a, if weight a = k then q a else 0) = if own = k.val then 1 else 0 := by + have hterm (a : A) : (if weight a = k then q a else 0) = + if own = k.val then q a else 0 := by + by_cases ha : q a = 0 + · simp only [ha, ite_self] + · have hw := hweight a (lt_of_le_of_ne (hq a) (Ne.symm ha)) + have he : weight a = k ↔ own = k.val := by rw [Fin.ext_iff, hw] + simp only [he] + simp_rw [hterm] + split_ifs <;> simp_all + +theorem pairLaw_leftWeight_mass {A : Type*} [Fintype A] + (support : List Shape) (s : Shape) (p : Shape → ℝ) (q : Shape → A → ℝ) + (side : Fin 3) (weight : A → Fin 17) + (hq : ∀ u ∈ support, ∀ a, 0 ≤ q u a) + (hleft : ∀ u ∈ support, ∑ a, q u a = 1) + (hright : ∀ u ∈ support, ∑ a, q (complement s u) a = 1) + (hweight : ∀ u ∈ support, ∀ a, 0 < q u a → (weight a).val = u side) + (k : Fin 17) : + (∑ ij : A × A, if weight ij.1 = k then pairLaw support s p q ij else 0) = + marginal support p side k := by + unfold pairLaw marginal + induction support with + | nil => simp + | cons u us ih => + have hu : u ∈ u :: us := by simp + have hw := statistic_weight_mass (q u) weight (u side) + (hq u hu) (hleft u hu) (hweight u hu) k + have hr := hright u hu + have head : (∑ ij : A × A, if weight ij.1 = k then + p u * q u ij.1 * q (complement s u) ij.2 else 0) = + if u side = k.val then p u else 0 := by + rw [Fintype.sum_prod_type] + calc + _ = ∑ a, if weight a = k then p u * q u a else 0 := by + apply Finset.sum_congr rfl + intro a _ + by_cases ha : weight a = k + · simp only [ha, ite_true, ← Finset.mul_sum, hr, mul_one] + · simp [ha] + _ = p u * (∑ a, if weight a = k then q u a else 0) := by + rw [Finset.mul_sum] + apply Finset.sum_congr rfl + intro a _ + split_ifs <;> simp + _ = _ := by rw [hw]; split_ifs <;> simp + have tail := ih (fun v hv => hq v (by simp [hv])) + (fun v hv => hleft v (by simp [hv])) + (fun v hv => hright v (by simp [hv])) + (fun v hv => hweight v (by simp [hv])) + simpa only [List.map_cons, List.sum_cons, ite_add_zero, Finset.sum_add_distrib, + head] using congrArg (fun r : ℝ => (if u side = k.val then p u else 0) + r) tail + +def statisticWeightCode (a : Fin 6) : Fin 17 := + ⟨statisticWeight a, by have := statisticWeight_le_four a; omega⟩ + +def halfWeightCode (a : PairSlot) : Fin 17 := + ⟨statisticWeight a.1 + statisticWeight a.2, by + have := statisticWeight_le_four a.1 + have := statisticWeight_le_four a.2 + omega⟩ + +@[simp] theorem statisticWeightCode_val (a : Fin 6) : + (statisticWeightCode a).val = statisticWeight a := rfl + +@[simp] theorem halfWeightCode_val (a : PairSlot) : + (halfWeightCode a).val = statisticWeight a.1 + statisticWeight a.2 := rfl + +theorem littleLaw_positive_weight (t : Shape) (ht : t ∈ positiveSecond) + (u : Shape) (hu : u ∈ below t) (side : Fin 3) (a : Fin 6) + (ha : 0 < (littleLaw t u side a : ℝ)) : (statisticWeightCode a).val = u side := by + change statisticWeight a = u side + by_contra hne + have hz := littleLaw_outside_support t u side + (child_statistic_weight_bounded t ht u hu side) a hne + have hz' : (littleLaw t u side a : ℝ) = 0 := by exact_mod_cast hz + linarith + +theorem halfLaw_positive_weight (u : Shape) (hu : u ∈ shapes 8) + (side : Fin 3) (a : PairSlot) (ha : 0 < (halfLaw u side a : ℝ)) : + (halfWeightCode a).val = u side := by + change statisticWeight a.1 + statisticWeight a.2 = u side + by_contra hne + have hz := halfLaw_outside_support u hu side a hne + have hz' : (halfLaw u side a : ℝ) = 0 := by exact_mod_cast hz + linarith + +theorem stageBPairLaw_leftWeight_mass (t : Shape) (ht : t ∈ positiveSecond) + (side : Fin 3) (k : Fin 17) : + ((stageBPairLaw t ht side).map (fun ij => statisticWeightCode ij.1)).mass k = + (stageBMarginalLaw t ht side).mass k := by + rw [FiniteLaw.map_mass] + change (∑ ij : Fin 6 × Fin 6, if statisticWeightCode ij.1 = k then + pairLaw (below t) t (fun u => (stageBLaw t u : ℝ)) + (fun u a => (littleLaw t u side a : ℝ)) ij else 0) = _ + rw [pairLaw_leftWeight_mass (below t) t (fun u => (stageBLaw t u : ℝ)) + (fun u a => (littleLaw t u side a : ℝ)) side statisticWeightCode + (fun u _ a => Rat.cast_nonneg.mpr (littleLaw_nonnegative t u side a)) + (fun u _ => (littleFiniteLaw t u side).total) + (fun u _ => (littleFiniteLaw t (complement t u) side).total) + (fun u hu a => littleLaw_positive_weight t ht u hu side a)] + exact (indexedMarginalLaw_mass _ _ _ _ _ _ k).symm + +theorem stageAPairLaw_leftWeight_mass (g : Shape) (hg : g ∈ positiveInitial) + (side : Fin 3) (k : Fin 17) : + ((stageAPairLaw g hg side).map (fun ij => halfWeightCode ij.1)).mass k = + (stageAMarginalLaw g hg side).mass k := by + rw [FiniteLaw.map_mass] + change (∑ ij : PairSlot × PairSlot, if halfWeightCode ij.1 = k then + pairLaw (below g) g (fun u => (stageALaw g u : ℝ)) + (fun u a => (halfLaw u side a : ℝ)) ij else 0) = _ + rw [pairLaw_leftWeight_mass (below g) g (fun u => (stageALaw g u : ℝ)) + (fun u a => (halfLaw u side a : ℝ)) side halfWeightCode + (fun u _ a => Rat.cast_nonneg.mpr (halfLaw_nonnegative u side a)) + (fun u hu => (halfFiniteLaw u (stageA_children_size g hg u hu) side).total) + (fun u hu => (halfFiniteLaw (complement g u) + (stageA_children_size g hg _ (stageA_support_complement g hg u hu).1) side).total) + (fun u hu a => halfLaw_positive_weight u (stageA_children_size g hg u hu) side a)] + exact (indexedMarginalLaw_mass _ _ _ _ _ _ k).symm + +private theorem law_ext {A : Type*} [Fintype A] (p q : FiniteLaw A) + (h : ∀ a, p.mass a = q.mass a) : p = q := by + cases p with + | mk p hp htotal => + cases q with + | mk q hq hqtotal => + have heq : p = q := funext h + subst q + rfl + +theorem stageBPairLaw_leftWeight_marginal (t : Shape) (ht : t ∈ positiveSecond) + (side : Fin 3) : + (stageBPairLaw t ht side).map (fun ij => statisticWeightCode ij.1) = + stageBMarginalLaw t ht side := + law_ext _ _ (stageBPairLaw_leftWeight_mass t ht side) + +theorem stageAPairLaw_leftWeight_marginal (g : Shape) (hg : g ∈ positiveInitial) + (side : Fin 3) : + (stageAPairLaw g hg side).map (fun ij => halfWeightCode ij.1) = + stageAMarginalLaw g hg side := + law_ext _ _ (stageAPairLaw_leftWeight_mass g hg side) + +end MatrixMultiplication.AllFieldPairMarginals + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldConstruction/PopulationCounts.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldConstruction/PopulationCounts.lean new file mode 100644 index 0000000000000000000000000000000000000000..39aeec6664cb6b49f0ad00c674780f33cfc3a64f --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldConstruction/PopulationCounts.lean @@ -0,0 +1,133 @@ +import OAI.LinearAlgebra.MatrixMultiplication.Separation.ComplexFiniteControl + +namespace OAI + +/-! Tensor extraction over arbitrary fields and its asymptotic rate. -/ + +namespace MatrixMultiplication.AllFieldPopulationCounts + +open scoped BigOperators + +noncomputable section + +variable {I : Type*} [Fintype I] [DecidableEq I] + +def denominator (w : I → ℚ) : ℕ := ∏ i, (w i).den + +def baseCount (w : I → ℚ) (i : I) : ℕ := + (w i).num.toNat * ∏ j ∈ Finset.univ.erase i, (w j).den + +def count (w : I → ℚ) (m : ℕ) (i : I) : ℕ := m * baseCount w i + +def blockLength (w : I → ℚ) (m : ℕ) : ℕ := m * denominator w + +omit [DecidableEq I] in +theorem denominator_pos (w : I → ℚ) : 0 < denominator w := by + exact Finset.prod_pos fun i _ => (w i).den_pos + +theorem denominator_factor (w : I → ℚ) (i : I) : + (w i).den * (∏ j ∈ Finset.univ.erase i, (w j).den) = denominator w := by + exact Finset.mul_prod_erase Finset.univ (fun j => (w j).den) (Finset.mem_univ i) + +theorem baseCount_cast (w : I → ℚ) (hw : ∀ i, 0 ≤ w i) (i : I) : + (baseCount w i : ℚ) = (denominator w : ℚ) * w i := by + have hnum : ((w i).num.toNat : ℚ) = ((w i).num : ℚ) := by + exact_mod_cast Int.toNat_of_nonneg (Rat.num_nonneg.mpr (hw i)) + have hden : ((w i).den : ℚ) ≠ 0 := by exact_mod_cast (w i).den_ne_zero + have hq : ((w i).num : ℚ) = w i * ((w i).den : ℚ) := by + calc + ((w i).num : ℚ) = + (((w i).num : ℚ) / ((w i).den : ℚ)) * ((w i).den : ℚ) := + (div_mul_cancel₀ _ hden).symm + _ = w i * ((w i).den : ℚ) := by rw [(w i).num_div_den] + rw [baseCount, ← denominator_factor w i] + push_cast + rw [hnum, hq] + ring + +theorem count_cast (w : I → ℚ) (hw : ∀ i, 0 ≤ w i) (m : ℕ) (i : I) : + (count w m i : ℚ) = (m : ℚ) * (denominator w : ℚ) * w i := by + simp only [count, Nat.cast_mul, baseCount_cast w hw, mul_assoc] + +theorem count_cast_blockLength (w : I → ℚ) (hw : ∀ i, 0 ≤ w i) + (m : ℕ) (i : I) : + (count w m i : ℚ) = (blockLength w m : ℚ) * w i := by + simpa only [blockLength, Nat.cast_mul] using count_cast w hw m i + +omit [DecidableEq I] in +theorem blockLength_pos (w : I → ℚ) {m : ℕ} (hm : 0 < m) : + 0 < blockLength w m := Nat.mul_pos hm (denominator_pos w) + +theorem count_zero_iff (w : I → ℚ) (hw : ∀ i, 0 ≤ w i) + {m : ℕ} (hm : 0 < m) (i : I) : count w m i = 0 ↔ w i = 0 := by + have hD : (denominator w : ℚ) ≠ 0 := by + exact_mod_cast (ne_of_gt (denominator_pos w)) + have hM : (m : ℚ) ≠ 0 := by exact_mod_cast (ne_of_gt hm) + have h : (count w m i : ℚ) = 0 ↔ w i = 0 := by + rw [count_cast w hw] + simp only [mul_eq_zero, hM, hD, false_or] + simpa only [Nat.cast_eq_zero] using h + +theorem count_pos_iff (w : I → ℚ) (hw : ∀ i, 0 ≤ w i) + {m : ℕ} (hm : 0 < m) (i : I) : 0 < count w m i ↔ 0 < w i := by + rw [Nat.pos_iff_ne_zero, ne_eq, count_zero_iff w hw hm] + constructor + · intro h + exact lt_of_le_of_ne (hw i) (Ne.symm h) + · exact ne_of_gt + +theorem sum_count_cast {J : Type*} (w : I → ℚ) (hw : ∀ i, 0 ≤ w i) + (m : ℕ) (s : Finset J) (f : J → I) : + ((∑ j ∈ s, count w m (f j) : ℕ) : ℚ) = + (blockLength w m : ℚ) * ∑ j ∈ s, w (f j) := by + simp only [Nat.cast_sum, count_cast_blockLength w hw] + rw [Finset.mul_sum] + +theorem transition_sum {J : Type*} (w : I → ℚ) (hw : ∀ i, 0 ≤ w i) + (m : ℕ) (s : Finset J) (f : J → I) (parent : I) + (hs : ∑ j ∈ s, w (f j) = w parent) : + ∑ j ∈ s, count w m (f j) = count w m parent := by + apply Nat.cast_injective (R := ℚ) + rw [sum_count_cast w hw, hs, count_cast_blockLength w hw] + +theorem unit_sum {J : Type*} (w : I → ℚ) (hw : ∀ i, 0 ≤ w i) + (m : ℕ) (s : Finset J) (f : J → I) + (hs : ∑ j ∈ s, w (f j) = 1) : + ∑ j ∈ s, count w m (f j) = blockLength w m := by + apply Nat.cast_injective (R := ℚ) + rw [sum_count_cast w hw, hs, mul_one] + +theorem count_eq_of_mass_eq (w : I → ℚ) (hw : ∀ i, 0 ≤ w i) + (m : ℕ) {i j : I} (h : w i = w j) : count w m i = count w m j := by + apply Nat.cast_injective (R := ℚ) + rw [count_cast w hw, count_cast w hw, h] + +theorem count_ratio (w : I → ℚ) (hw : ∀ i, 0 ≤ w i) + {m : ℕ} (hm : 0 < m) (i : I) : + (count w m i : ℚ) / blockLength w m = w i := by + rw [count_cast_blockLength w hw] + have h : (blockLength w m : ℚ) ≠ 0 := by + exact_mod_cast (ne_of_gt (blockLength_pos w hm)) + exact mul_div_cancel_left₀ _ h + +theorem count_dilate (w : I → ℚ) (m n : ℕ) (i : I) : + count w (m * n) i = m * count w n i := by simp [count, Nat.mul_assoc] + +theorem dilation_le_count (w : I → ℚ) (hw : ∀ i, 0 ≤ w i) + (m : ℕ) (i : I) (hi : 0 < w i) : m ≤ count w m i := by + have hb : 0 < baseCount w i := by + have h := (count_pos_iff w hw (m := 1) (by decide) i).2 hi + simpa only [count, one_mul] using h + calc + m = m * 1 := (Nat.mul_one m).symm + _ ≤ m * baseCount w i := Nat.mul_le_mul_left m hb + +theorem two_le_positive_count (w : I → ℚ) (hw : ∀ i, 0 ≤ w i) + {m : ℕ} (hm : 2 ≤ m) (i : I) (hi : 0 < w i) : 2 ≤ count w m i := + hm.trans (dilation_le_count w hw m i hi) + +end + +end MatrixMultiplication.AllFieldPopulationCounts + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldConstruction/RateLimit.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldConstruction/RateLimit.lean new file mode 100644 index 0000000000000000000000000000000000000000..6e75ea1770f95690302d039eae6fe324c721933c --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldConstruction/RateLimit.lean @@ -0,0 +1,177 @@ +import OAI.LinearAlgebra.MatrixMultiplication.FieldConstruction.Witness +import OAI.LinearAlgebra.MatrixMultiplication.Recovery.FiniteSchedule +import OAI.LinearAlgebra.MatrixMultiplication.Arithmetic.Exponent + +namespace OAI + +/-! Tensor extraction over arbitrary fields and its asymptotic rate. -/ + +noncomputable section + +namespace MatrixMultiplication.AllFieldRateLimit + +open Filter +open scoped Topology + +variable {F : Type*} [Field F] + +structure HasRates (W : ℕ → AllFieldWitness F) (scale : ℕ → ℝ) + (Y S R : ℝ) : Prop where + scale_positive : ∀ᶠ n in atTop, 0 < scale n + yield_limit : Tendsto (fun n => Real.log ((W n).multiplicity : ℝ) / scale n) atTop (𝓝 Y) + volume_limit : Tendsto (fun n => Real.log ((W n).volume : ℝ) / scale n) atTop (𝓝 S) + rank_limit : Tendsto (fun n => Real.log ((W n).rankBound : ℝ) / scale n) atTop (𝓝 R) + +structure HasRateBounds (W : ℕ → AllFieldWitness F) (scale : ℕ → ℝ) + (Y S R : ℝ) : Prop where + scale_positive : ∀ᶠ n in atTop, 0 < scale n + yield_lower : ∀ ε : ℝ, 0 < ε → ∀ᶠ n in atTop, + Y - ε ≤ Real.log ((W n).multiplicity : ℝ) / scale n + volume_lower : ∀ ε : ℝ, 0 < ε → ∀ᶠ n in atTop, + S - ε ≤ Real.log ((W n).volume : ℝ) / scale n + rank_upper : ∀ ε : ℝ, 0 < ε → ∀ᶠ n in atTop, + Real.log ((W n).rankBound : ℝ) / scale n ≤ R + ε + +theorem HasRates.toBounds {W : ℕ → AllFieldWitness F} {scale : ℕ → ℝ} + {Y S R : ℝ} (h : HasRates W scale Y S R) : HasRateBounds W scale Y S R where + scale_positive := h.scale_positive + yield_lower ε hε := (h.yield_limit.eventually_const_lt (by linarith : Y - ε < Y)).mono + (fun _ hn => hn.le) + volume_lower ε hε := (h.volume_limit.eventually_const_lt (by linarith : S - ε < S)).mono + (fun _ hn => hn.le) + rank_upper ε hε := (h.rank_limit.eventually_lt_const (by linarith : R < R + ε)).mono + (fun _ hn => hn.le) + +theorem inequality_of_rates {W : ℕ → AllFieldWitness F} {scale : ℕ → ℝ} + {Y S R : ℝ} (h : HasRates W scale Y S R) : + Y + (Arithmetic.omega F / 3) * S ≤ R := by + apply le_of_tendsto_of_tendsto + (h.yield_limit.add (h.volume_limit.const_mul (Arithmetic.omega F / 3))) h.rank_limit + filter_upwards [h.scale_positive] with n hn + have hb := div_le_div_of_nonneg_right (W n).log_inequality hn.le + simpa only [add_div, mul_div_assoc] using hb + +theorem inequality_of_rateBounds {W : ℕ → AllFieldWitness F} {scale : ℕ → ℝ} + {Y S R : ℝ} (h : HasRateBounds W scale Y S R) : + Y + (Arithmetic.omega F / 3) * S ≤ R := by + apply le_of_forall_pos_le_add + intro ε hε + have hδ : 0 < ε / 3 := by positivity + obtain ⟨n, hnscale, hnyield, hnvolume, hnrank⟩ := + (h.scale_positive.and ((h.yield_lower (ε / 3) hδ).and + ((h.volume_lower (ε / 3) hδ).and (h.rank_upper (ε / 3) hδ)))).exists + have hfinite := div_le_div_of_nonneg_right (W n).log_inequality hnscale.le + simp only [add_div, mul_div_assoc] at hfinite + have hω : 0 ≤ Arithmetic.omega F / 3 := div_nonneg Arithmetic.omega_nonneg (by norm_num) + have hvolume := mul_le_mul_of_nonneg_left hnvolume hω + have hωupper := mul_le_mul_of_nonneg_right + (Arithmetic.omega_le_three (F := F)) hδ.le + nlinarith + +theorem omega_le_of_rates {W : ℕ → AllFieldWitness F} {scale : ℕ → ℝ} + {Y S R : ℝ} (h : HasRates W scale Y S R) (positive : 0 < S) : + Arithmetic.omega F ≤ 3 * (R - Y) / S := by + apply (le_div_iff₀ positive).mpr + have hb := inequality_of_rates h + nlinarith + +theorem omega_le_of_rateBounds {W : ℕ → AllFieldWitness F} {scale : ℕ → ℝ} + {Y S R : ℝ} (h : HasRateBounds W scale Y S R) (positive : 0 < S) : + Arithmetic.omega F ≤ 3 * (R - Y) / S := by + apply (le_div_iff₀ positive).mpr + have hb := inequality_of_rateBounds h + nlinarith + +structure FixedLotFamily (F : Type*) [Field F] where + witness : ℕ → ℕ → AllFieldWitness F + scale : ℕ → ℕ → ℝ + yieldRate : ℕ → ℝ + volumeRate : ℕ → ℝ + rankRate : ℕ → ℝ + bounds : ∀ j, HasRateBounds (witness j) (scale j) + (yieldRate j) (volumeRate j) (rankRate j) + +theorem inequality_of_fixedLotFamily (family : FixedLotFamily F) {Y S R : ℝ} + (yield_limit : Tendsto family.yieldRate atTop (𝓝 Y)) + (volume_limit : Tendsto family.volumeRate atTop (𝓝 S)) + (rank_limit : Tendsto family.rankRate atTop (𝓝 R)) : + Y + (Arithmetic.omega F / 3) * S ≤ R := by + apply le_of_tendsto_of_tendsto' + (yield_limit.add (volume_limit.const_mul (Arithmetic.omega F / 3))) rank_limit + intro j + exact inequality_of_rateBounds (family.bounds j) + +theorem inequality_of_outer_families + (family : ℕ → FixedLotFamily F) {Y S R : ℕ → ℝ} {Yfinal Sfinal Rfinal : ℝ} + (yield_limit : ∀ K, Tendsto (family K).yieldRate atTop (𝓝 (Y K))) + (volume_limit : ∀ K, Tendsto (family K).volumeRate atTop (𝓝 (S K))) + (rank_limit : ∀ K, Tendsto (family K).rankRate atTop (𝓝 (R K))) + (outer_yield : Tendsto Y atTop (𝓝 Yfinal)) + (outer_volume : Tendsto S atTop (𝓝 Sfinal)) + (outer_rank : Tendsto R atTop (𝓝 Rfinal)) : + Yfinal + (Arithmetic.omega F / 3) * Sfinal ≤ Rfinal := by + apply le_of_tendsto_of_tendsto' + (outer_yield.add (outer_volume.const_mul (Arithmetic.omega F / 3))) outer_rank + intro K + exact inequality_of_fixedLotFamily (family K) + (yield_limit K) (volume_limit K) (rank_limit K) + +theorem omega_le_of_outer_families + (family : ℕ → FixedLotFamily F) {Y S R : ℕ → ℝ} {Yfinal Sfinal Rfinal : ℝ} + (yield_limit : ∀ K, Tendsto (family K).yieldRate atTop (𝓝 (Y K))) + (volume_limit : ∀ K, Tendsto (family K).volumeRate atTop (𝓝 (S K))) + (rank_limit : ∀ K, Tendsto (family K).rankRate atTop (𝓝 (R K))) + (outer_yield : Tendsto Y atTop (𝓝 Yfinal)) + (outer_volume : Tendsto S atTop (𝓝 Sfinal)) + (outer_rank : Tendsto R atTop (𝓝 Rfinal)) (positive : 0 < Sfinal) : + Arithmetic.omega F ≤ 3 * (Rfinal - Yfinal) / Sfinal := by + apply (le_div_iff₀ positive).mpr + have hb := inequality_of_outer_families family yield_limit volume_limit rank_limit + outer_yield outer_volume outer_rank + nlinarith + +theorem staggered_rank_constraint + (family : ∀ K : ℕ, 2 ≤ K → FixedLotFamily F) {H0 Cstar Sstar beta : ℝ} + (yield_limit : ∀ K hK, Tendsto (family K hK).yieldRate atTop + (𝓝 (H0 + Cstar - beta / (K : ℝ)))) + (volume_limit : ∀ K hK, Tendsto (family K hK).volumeRate atTop (𝓝 Sstar)) + (rank_limit : ∀ K hK, Tendsto (family K hK).rankRate atTop (𝓝 (8 * Real.log 7))) : + H0 + Cstar + (Arithmetic.omega F / 3) * Sstar ≤ 8 * Real.log 7 := by + have hfixed (K : ℕ) (hK : 2 ≤ K) : + H0 + Cstar - beta / (K : ℝ) + Arithmetic.omega F * Sstar / 3 ≤ + 8 * Real.log 7 := by + have hb := inequality_of_fixedLotFamily (family K hK) + (yield_limit K hK) (volume_limit K hK) (rank_limit K hK) + convert hb using 1; ring + have hb := FiniteSchedule.fixed_lot_boundary_limit hfixed + convert hb using 1; ring + +theorem omega_le_of_staggered_families + (family : ∀ K : ℕ, 2 ≤ K → FixedLotFamily F) {H0 Cstar Sstar beta : ℝ} + (yield_limit : ∀ K hK, Tendsto (family K hK).yieldRate atTop + (𝓝 (H0 + Cstar - beta / (K : ℝ)))) + (volume_limit : ∀ K hK, Tendsto (family K hK).volumeRate atTop (𝓝 Sstar)) + (rank_limit : ∀ K hK, Tendsto (family K hK).rankRate atTop (𝓝 (8 * Real.log 7))) + (positive : 0 < Sstar) : + Arithmetic.omega F ≤ 3 * (8 * Real.log 7 - (H0 + Cstar)) / Sstar := by + apply (le_div_iff₀ positive).mpr + have hb := staggered_rank_constraint family yield_limit volume_limit rank_limit + nlinarith + +theorem omega_lt_of_staggered_families + (family : ∀ K : ℕ, 2 ≤ K → FixedLotFamily F) {H0 Cstar Sstar beta target : ℝ} + (yield_limit : ∀ K hK, Tendsto (family K hK).yieldRate atTop + (𝓝 (H0 + Cstar - beta / (K : ℝ)))) + (volume_limit : ∀ K hK, Tendsto (family K hK).volumeRate atTop (𝓝 Sstar)) + (rank_limit : ∀ K hK, Tendsto (family K hK).rankRate atTop (𝓝 (8 * Real.log 7))) + (positive : 0 < Sstar) + (gap : 3 * (8 * Real.log 7 - (H0 + Cstar)) / Sstar < target) : + Arithmetic.omega F < target := + lt_of_le_of_lt (omega_le_of_staggered_families family yield_limit volume_limit + rank_limit positive) gap + +end MatrixMultiplication.AllFieldRateLimit + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldConstruction/ScheduledPositivity.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldConstruction/ScheduledPositivity.lean new file mode 100644 index 0000000000000000000000000000000000000000..6d963ac62c938d5fd30a41277dd37334fd4b8736 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldConstruction/ScheduledPositivity.lean @@ -0,0 +1,92 @@ +import OAI.LinearAlgebra.MatrixMultiplication.FieldConstruction.ScheduledYield +import OAI.LinearAlgebra.MatrixMultiplication.FieldConstruction.InitialGibbs + +namespace OAI + +/-! Tensor extraction over arbitrary fields and its asymptotic rate. -/ + +noncomputable section + +namespace MatrixMultiplication.AllFieldScheduledPositivity + +open MatrixMultiplication.Foundation AllFieldParameters AllFieldHistory +open AllFieldInitialEntropy AllFieldNativeCapacity AllFieldScheduledYield Filter +open scoped BigOperators Topology +attribute [local instance] Classical.propDecidable Classical.decEq + +theorem nativeH0_pos : 0 < nativeH0 := by + let p := orderedInitialLaw.map (JointPopulation.shapeSide 0) + have hzero : 0 < p.mass 0 := by + have hp := AllFieldInitialGibbs.orderedInitialLaw_positive + ((0 : Fin 17), (0 : Fin 17), (16 : Fin 17)) (by decide) + exact hp.trans_le (orderedInitialLaw.mass_le_map_mass + (JointPopulation.shapeSide 0) ((0 : Fin 17), (0 : Fin 17), (16 : Fin 17))) + have hone : 0 < p.mass 1 := by + have hp := AllFieldInitialGibbs.orderedInitialLaw_positive + ((1 : Fin 17), (0 : Fin 17), (15 : Fin 17)) (by decide) + exact hp.trans_le (orderedInitialLaw.mass_le_map_mass + (JointPopulation.shapeSide 0) ((1 : Fin 17), (0 : Fin 17), (15 : Fin 17))) + have hpair : p.mass 0 + p.mass 1 ≤ 1 := by + have hs : (∑ k ∈ ({0, 1} : Finset (Fin 17)), p.mass k) ≤ + ∑ k : Fin 17, p.mass k := + Finset.sum_le_sum_of_subset_of_nonneg (Finset.subset_univ _) + (fun k _ _ => p.nonneg k) + simpa [p.total] using hs + have hterm : 0 < entropyTerm (p.mass 0) := + mul_pos_of_neg_of_neg (neg_neg_of_pos hzero) (Real.log_neg hzero (by linarith)) + have hentropy : 0 < finiteEntropy p.mass := hterm.trans_le + (Finset.single_le_sum + (fun k _ => entropyTerm_nonneg (p.nonneg k) (p.mass_le_one k)) + (Finset.mem_univ 0)) + rw [← orderedInitialLaw_side_entropy 0] + have hm : p.mass = JointPopulationRates.sideMass orderedInitialLaw.mass 0 := by + funext k + simp only [p, FiniteLaw.map_mass, JointPopulationRates.sideMass] + rw [← hm] + exact hentropy + +theorem initial_capacity_pos (K : ℕ) (hK : 0 < K) : + 0 < (K : ℝ) * nativeH0 := mul_pos (Nat.cast_pos.mpr hK) nativeH0_pos + +theorem tickCapacity_pos (K tick : ℕ) (hK : 2 ≤ K) (htick : tick < K + 2) + (a b c : Staggering.Capacity) + (ha : ∀ i, 0 < a i) (hb : ∀ i, 0 < b i) (hc : ∀ i, 0 < c i) + (i : Fin 3) : 0 < FiniteSchedule.tickCapacity K a b c tick i := by + have hA := ha i + have hB := hb i + have hC := hc i + unfold FiniteSchedule.tickCapacity + split_ifs <;> first + | positivity + | (simp only [FiniteSchedule.stageActive, Fin.val_zero, Fin.val_one] at *; omega) + +theorem physical_order_capacity_pos (K tick : ℕ) (hK : 2 ≤ K) + (htick : tick < K + 2) (allocation : Allocation) (sigma : Placement) + (ha : ∀ i, 0 < nativeLA i) (hb : ∀ i, 0 < nativeLB i) + (hc : ∀ i, 0 < nativeLC (fun j => (allocation.mass j : ℝ)) i) : + 0 < Staggering.minCapacity + (physicalTickCapacity allocation tick (workCapacity (K := K)) sigma) := by + rw [physical_order_native_capacity, PhysicalOrders.minCapacity_mul _ _ (by norm_num)] + exact mul_pos (by norm_num) (Staggering.minCapacity_pos _ + (tickCapacity_pos K tick hK htick _ _ _ ha hb hc)) + +theorem eventually_physical_order_capacity_pos (K : ℕ) (hK : 2 ≤ K) + (allocation : ℕ → Allocation) + (h : ∀ i, Tendsto (fun j => ((allocation j).mass i : ℝ)) atTop (𝓝 (nativeLambda i))) + (ha : ∀ i, 0 < nativeLA i) (hb : ∀ i, 0 < nativeLB i) + (hc : ∀ i, 0 < nativeLC nativeLambda i) : + ∀ᶠ j in atTop, ∀ tick < K + 2, ∀ sigma : Placement, + 0 < Staggering.minCapacity + (physicalTickCapacity (allocation j) tick (workCapacity (K := K)) sigma) := by + have he : ∀ᶠ j in atTop, ∀ i, + 0 < nativeLC (fun k => ((allocation j).mass k : ℝ)) i := + Filter.eventually_all.mpr fun i => (nativeLC_tendsto h i).eventually_const_lt (hc i) + filter_upwards [he] with j hj + exact fun tick htick sigma => + physical_order_capacity_pos K tick hK htick (allocation j) sigma ha hb hj + +end MatrixMultiplication.AllFieldScheduledPositivity + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldConstruction/ScheduledYield.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldConstruction/ScheduledYield.lean new file mode 100644 index 0000000000000000000000000000000000000000..d34e111734b9c376ff8475bf6ab9f074b6e0d831 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldConstruction/ScheduledYield.lean @@ -0,0 +1,240 @@ +import OAI.LinearAlgebra.MatrixMultiplication.FieldConstruction.NativeCapacity +import OAI.LinearAlgebra.MatrixMultiplication.FieldConstruction.ActiveSums +import OAI.LinearAlgebra.MatrixMultiplication.FieldConstruction.ActiveLaws +import OAI.LinearAlgebra.MatrixMultiplication.FieldConstruction.InitialEntropy +import OAI.LinearAlgebra.MatrixMultiplication.FieldConstruction.StageCCapacity +import OAI.LinearAlgebra.MatrixMultiplication.Entropy.ConditionalContinuity +import Mathlib.Topology.Order.OrderClosed + +namespace OAI + +/-! Tensor extraction over arbitrary fields and its asymptotic rate. -/ + +noncomputable section + +namespace MatrixMultiplication.AllFieldScheduledYield + +open MatrixMultiplication.Foundation AllFieldParameters AllFieldHistory AllFieldNativeCapacity +open Filter +open scoped BigOperators Topology + +def workCapacity {K : ℕ} : Work K → Staggering.Capacity := + shapeCapacity stageACapacity stageBCapacity stageCCapacity + +theorem workCapacity_stageC {K : ℕ} (h : PartC K) (i : Fin 3) : + workCapacity (Work.stageC h) i = finiteEntropy + (AllFieldStageCCapacity.stageCMarginal (cParameterParent h) (cShapeParent h) + (cPriority h i)) := by + rw [AllFieldStageCCapacity.stageCMarginal_priority_entropy] + rfl + +private theorem sum_interiorPairs (f : Shape × Shape → ℝ) : + (interiorPairs.map f).sum = + (positiveSecond.map fun t => + (((below t).filter positive).map fun u => f (t,u)).sum).sum := by + unfold interiorPairs + have h : ∀ xs : List Shape, + ((xs.flatMap fun t => ((below t).filter positive).map fun u => (t,u)).map f).sum = + (xs.map fun t => (((below t).filter positive).map fun u => f (t,u)).sum).sum := by + intro xs + induction xs with + | nil => simp + | cons t xs ih => simp [ih, List.map_map, Function.comp_def] + exact h positiveSecond + +theorem stageCSourceCapacity_native (allocation : Allocation) : + stageCSourceCapacity allocation stageCCapacity = + nativeLC (fun i => (allocation.mass i : ℝ)) := by + funext i + unfold stageCSourceCapacity stageCSourceSum nativeLC + rw [sum_interiorPairs] + apply congrArg List.sum + apply List.map_congr_left + intro t ht + apply congrArg List.sum + apply List.map_congr_left + intro u hu + rw [show (∑ part : Fin 3, (allocation.mass part : ℝ) * stageCCapacity t u part i) = + (1 - (allocation.mass i : ℝ)) * Real.log 2 + + (allocation.mass i : ℝ) * binaryEntropyRate (binaryParameter t u) from + AllFieldStageCCapacity.allocation_capacity allocation (binaryParameter t u) i] + rfl + +theorem active_native_capacity (K tick : ℕ) (allocation : Allocation) : + activeAggregateCapacity allocation tick (workCapacity (K := K)) = + FiniteSchedule.tickCapacity K nativeLA nativeLB + (nativeLC (fun i => (allocation.mass i : ℝ))) tick := by + rw [workCapacity, activeAggregateCapacity_shapeCapacity, + stageCSourceCapacity_native] + rfl + +theorem physical_order_native_capacity (K tick : ℕ) (allocation : Allocation) + (sigma : Placement) : + physicalTickCapacity allocation tick (workCapacity (K := K)) sigma = + fun i => (1 / 6 : ℝ) * FiniteSchedule.tickCapacity K nativeLA nativeLB + (nativeLC (fun i => (allocation.mass i : ℝ))) tick i := by + rw [physicalTickCapacity_eq_sixth, active_native_capacity] + +theorem order_capacity_eq_physical (K tick : ℕ) (allocation : Allocation) + (sigma : Placement) (i : Fin 3) : + (∑ h : ActiveOrder K tick sigma, + AllFieldActiveLaws.orderMass allocation h * workCapacity h.val.val.1 i) = + physicalTickCapacity allocation tick (workCapacity (K := K)) sigma i := by + rw [physicalTickCapacity_eq_sixth] + rw [← (canonicalActiveEquivOrder K tick sigma).sum_comp + (fun h : ActiveOrder K tick sigma => + AllFieldActiveLaws.orderMass allocation h * workCapacity h.val.val.1 i)] + simp only [AllFieldActiveLaws.orderMass, canonicalActiveEquivOrder, amount, + Rat.cast_div, Rat.cast_ofNat, activeAggregateCapacity, + PhysicalOrders.aggregateCapacity, workAmount] + rw [Finset.mul_sum] + apply Finset.sum_congr rfl + intro h hh + change ((canonicalAmount allocation h.val.source : ℝ) / 6) * + workCapacity h.val i = (1 / 6 : ℝ) * + ((canonicalAmount allocation h.val.source : ℝ) * workCapacity h.val i) + ring + +theorem order_capacity_eq_native (K tick : ℕ) (allocation : Allocation) + (sigma : Placement) (i : Fin 3) : + (∑ h : ActiveOrder K tick sigma, + AllFieldActiveLaws.orderMass allocation h * workCapacity h.val.val.1 i) = + (1 / 6 : ℝ) * FiniteSchedule.tickCapacity K nativeLA nativeLB + (nativeLC (fun j => (allocation.mass j : ℝ))) tick i := by + rw [order_capacity_eq_physical, physical_order_native_capacity] + +theorem order_dilation_capacity (K tick : ℕ) (allocation : Allocation) + (sigma : Placement) (i : Fin 3) : + (∑ h : ActiveOrder K tick sigma, + ((populationLength (K := K) allocation 1 : ℝ) * + AllFieldActiveLaws.orderMass allocation h) * workCapacity h.val.val.1 i) = + (populationLength (K := K) allocation 1 : ℝ) * + ((1 / 6 : ℝ) * FiniteSchedule.tickCapacity K nativeLA nativeLB + (nativeLC (fun j => (allocation.mass j : ℝ))) tick i) := by + simp_rw [mul_assoc] + rw [← Finset.mul_sum, order_capacity_eq_native] + +def physicalYield (K : ℕ) (allocation : Allocation) : ℝ := + ∑ tick ∈ Finset.range (K + 2), ∑ sigma : Placement, + Staggering.minCapacity (physicalTickCapacity allocation tick + (workCapacity (K := K)) sigma) + +def scheduledYield (K : ℕ) (allocation : Fin 3 → ℝ) : ℝ := + ∑ tick ∈ Finset.range (K + 2), Staggering.minCapacity + (FiniteSchedule.tickCapacity K nativeLA nativeLB (nativeLC allocation) tick) + +theorem physicalYield_eq_scheduled (K : ℕ) (allocation : Allocation) : + physicalYield K allocation = scheduledYield K (fun i => (allocation.mass i : ℝ)) := by + unfold physicalYield scheduledYield + apply Finset.sum_congr rfl + intro tick htick + rw [sum_physicalTick_minima, active_native_capacity] + +theorem balanced_scheduledYield (K : ℕ) (hK : 2 ≤ K) (hgap : nativeB < nativeHigh) : + scheduledYield K nativeLambda = (K : ℝ) * nativeCstar - nativeBeta := + FiniteSchedule.finite_schedule_yield K hK nativeLA nativeLB + (nativeLC nativeLambda) nativeCstar (native_balanced hgap) + +theorem nativeLC_tendsto {J : Type*} {filter : Filter J} + {allocation : J → Fin 3 → ℝ} {limit : Fin 3 → ℝ} + (h : ∀ i, Tendsto (fun j => allocation j i) filter (𝓝 (limit i))) (i : Fin 3) : + Tendsto (fun j => nativeLC (allocation j) i) filter (𝓝 (nativeLC limit i)) := by + simp_rw [nativeLC_expansion] + exact tendsto_const_nhds.sub (((h i).const_mul 3).mul_const (nativeHigh - nativeB)) + +theorem tickCapacity_tendsto (K tick : ℕ) {J : Type*} {filter : Filter J} + {allocation : J → Fin 3 → ℝ} {limit : Fin 3 → ℝ} + (h : ∀ i, Tendsto (fun j => allocation j i) filter (𝓝 (limit i))) (i : Fin 3) : + Tendsto (fun j => FiniteSchedule.tickCapacity K nativeLA nativeLB + (nativeLC (allocation j)) tick i) filter + (𝓝 (FiniteSchedule.tickCapacity K nativeLA nativeLB (nativeLC limit) tick i)) := by + have hc : Tendsto (fun j => if FiniteSchedule.stageActive K tick 2 then + nativeLC (allocation j) i else 0) filter + (𝓝 (if FiniteSchedule.stageActive K tick 2 then nativeLC limit i else 0)) := by + by_cases hh : FiniteSchedule.stageActive K tick 2 + · simpa only [hh, ite_true] using nativeLC_tendsto h i + · simpa only [hh, ite_false] using (tendsto_const_nhds : + Tendsto (fun _ : J => (0 : ℝ)) filter (𝓝 0)) + exact (tendsto_const_nhds.add tendsto_const_nhds).add hc + +theorem scheduledYield_tendsto (K : ℕ) {J : Type*} {filter : Filter J} + {allocation : J → Fin 3 → ℝ} {limit : Fin 3 → ℝ} + (h : ∀ i, Tendsto (fun j => allocation j i) filter (𝓝 (limit i))) : + Tendsto (fun j => scheduledYield K (allocation j)) filter + (𝓝 (scheduledYield K limit)) := by + unfold scheduledYield + apply tendsto_finsetSum + intro tick htick + exact (tickCapacity_tendsto K tick h 0).min + ((tickCapacity_tendsto K tick h 1).min (tickCapacity_tendsto K tick h 2)) + +theorem physicalYield_tendsto_balanced (K : ℕ) (hK : 2 ≤ K) + (hgap : nativeB < nativeHigh) (allocation : ℕ → Allocation) + (h : ∀ i, Tendsto (fun j => ((allocation j).mass i : ℝ)) atTop (𝓝 (nativeLambda i))) : + Tendsto (fun j => physicalYield K (allocation j)) atTop + (𝓝 ((K : ℝ) * nativeCstar - nativeBeta)) := by + simp_rw [physicalYield_eq_scheduled] + rw [← balanced_scheduledYield K hK hgap] + exact scheduledYield_tendsto K h + +theorem exists_balanced_allocation_sequence (hgap : nativeB < nativeHigh) + (hfeas : ∀ i, nativeCstar - (nativeLA i + nativeLB i) < nativeHigh) : + ∃ allocation : ℕ → Allocation, + ∀ i, Tendsto (fun j => ((allocation j).mass i : ℝ)) atTop (𝓝 (nativeLambda i)) := by + have hpos (i : Fin 3) : 0 < nativeLambda i := + Staggering.balanceFraction_pos nativeLA nativeLB nativeHigh nativeB hgap hfeas i + let p : FiniteLaw (Fin 3) := { + mass := nativeLambda + nonneg := fun i => (hpos i).le + total := Staggering.sum_balanceFraction nativeLA nativeLB nativeHigh nativeB hgap } + obtain ⟨q, hq⟩ := ConditionalLabels.exists_rational_law_sequence p + have he : ∀ᶠ j in atTop, ∀ i, 0 < (q j).toFiniteLaw.mass i := + Filter.eventually_all.mpr (fun i => (hq i).eventually_const_lt (hpos i)) + obtain ⟨N, hN⟩ := Filter.eventually_atTop.mp he + let allocation : ℕ → Allocation := fun j => { + mass := (q (j + N)).mass + positive := fun i => by + have hi := hN (j + N) (by omega) i + change (0 : ℝ) < ((q (j + N)).mass i : ℝ) at hi + exact_mod_cast hi + total := (q (j + N)).total } + refine ⟨allocation, fun i => ?_⟩ + exact (hq i).comp (tendsto_add_atTop_nat N) + +theorem exists_physicalYield_limit (K : ℕ) (hK : 2 ≤ K) + (hgap : nativeB < nativeHigh) + (hfeas : ∀ i, nativeCstar - (nativeLA i + nativeLB i) < nativeHigh) : + ∃ allocation : ℕ → Allocation, + Tendsto (fun j => physicalYield K (allocation j)) atTop + (𝓝 ((K : ℝ) * nativeCstar - nativeBeta)) := by + obtain ⟨allocation, ha⟩ := exists_balanced_allocation_sequence hgap hfeas + exact ⟨allocation, physicalYield_tendsto_balanced K hK hgap allocation ha⟩ + +theorem initial_capacity (K : ℕ) : + JointOrdinaryPopulationSelection.entropyRate (fun _ : Fin K => (1 : ℝ)) + (fun _ : Fin K => AllFieldInitialEntropy.orderedInitialLaw) - + JointOrdinaryPopulationSelection.degreeRate (fun _ : Fin K => (1 : ℝ)) + (fun _ : Fin K => AllFieldInitialEntropy.orderedInitialLaw) = + (K : ℝ) * AllFieldInitialEntropy.nativeH0 := + AllFieldInitialEntropy.ordinary_capacity_all_lots K + +theorem initial_dilation_capacity (K : ℕ) (allocation : Allocation) : + JointOrdinaryPopulationSelection.entropyRate + (fun _ : Fin K => (populationLength (K := K) allocation 1 : ℝ)) + (fun _ : Fin K => AllFieldInitialEntropy.orderedInitialLaw) - + JointOrdinaryPopulationSelection.degreeRate + (fun _ : Fin K => (populationLength (K := K) allocation 1 : ℝ)) + (fun _ : Fin K => AllFieldInitialEntropy.orderedInitialLaw) = + (populationLength (K := K) allocation 1 : ℝ) * + ((K : ℝ) * AllFieldInitialEntropy.nativeH0) := by + simp only [JointOrdinaryPopulationSelection.entropyRate, + JointOrdinaryPopulationSelection.degreeRate, JointOrdinaryPopulationSelection.sideDegreeRate, + AllFieldInitialEntropy.orderedInitialLaw_side_entropy, Finset.sum_const, + Finset.card_univ, Fintype.card_fin, nsmul_eq_mul, max_self] + ring + +end MatrixMultiplication.AllFieldScheduledYield + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldConstruction/ShapeEncoding.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldConstruction/ShapeEncoding.lean new file mode 100644 index 0000000000000000000000000000000000000000..d3ab39008565a803de4502306449ec0970ad33fd --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldConstruction/ShapeEncoding.lean @@ -0,0 +1,234 @@ +import OAI.LinearAlgebra.MatrixMultiplication.FieldConstruction.StageCLaw +import OAI.LinearAlgebra.MatrixMultiplication.JointExtraction.Population +import Mathlib.Data.List.Nodup + +namespace OAI + +/-! Tensor extraction over arbitrary fields and its asymptotic rate. -/ + +namespace MatrixMultiplication.AllFieldHistory + +open AllFieldParameters +open scoped BigOperators + +def shapeTotal (u : Shape) : ℕ := u 0 + u 1 + u 2 + +def ShapeBounded (u : Shape) : Prop := ∀ i, u i ≤ 16 + +def encodeShape (u : Shape) (h : ShapeBounded u) : JointPopulation.Shape := + (⟨u 0, Nat.lt_succ_of_le (h 0)⟩, + ⟨u 1, Nat.lt_succ_of_le (h 1)⟩, ⟨u 2, Nat.lt_succ_of_le (h 2)⟩) + +def decodeShape (u : JointPopulation.Shape) : Shape := + fun i => (JointPopulation.shapeSide i u).val + +@[simp] theorem decode_encodeShape (u : Shape) (h : ShapeBounded u) : + decodeShape (encodeShape u h) = u := by + funext i + fin_cases i <;> rfl + +@[simp] theorem encodeShape_side (u : Shape) (h : ShapeBounded u) (i : Fin 3) : + (JointPopulation.shapeSide i (encodeShape u h)).val = u i := + congrFun (decode_encodeShape u h) i + +theorem decodeShape_bounded (u : JointPopulation.Shape) : ShapeBounded (decodeShape u) := by + intro i + have h := (JointPopulation.shapeSide i u).isLt + change (JointPopulation.shapeSide i u).val ≤ 16 + omega + +@[simp] theorem encode_decodeShape (u : JointPopulation.Shape) : + encodeShape (decodeShape u) (decodeShape_bounded u) = u := by + apply Prod.ext + · apply Fin.ext + rfl + · apply Prod.ext <;> apply Fin.ext <;> rfl + +theorem encodeShape_inj {u v : Shape} {hu : ShapeBounded u} {hv : ShapeBounded v} + (h : encodeShape u hu = encodeShape v hv) : u = v := by + simpa only [decode_encodeShape] using congrArg decodeShape h + +theorem encodeShape_injective : + Function.Injective (fun u : {u : Shape // ShapeBounded u} => encodeShape u.val u.property) := by + intro u v h + apply Subtype.ext + exact encodeShape_inj h + +@[simp] theorem encodeShape_total (u : Shape) (h : ShapeBounded u) : + (encodeShape u h).1.val + (encodeShape u h).2.1.val + + (encodeShape u h).2.2.val = shapeTotal u := rfl + +def physicalShape (phi : Equiv.Perm (Fin 3)) (u : Shape) : Shape := + fun i => u (phi.symm i) + +@[simp] theorem physicalShape_source (phi : Equiv.Perm (Fin 3)) (u : Shape) (i : Fin 3) : + physicalShape phi u (phi i) = u i := by + simp only [physicalShape, Equiv.symm_apply_apply] + +theorem physicalShape_bounded (phi : Equiv.Perm (Fin 3)) (u : Shape) + (h : ShapeBounded u) : ShapeBounded (physicalShape phi u) := + fun i => h (phi.symm i) + +theorem physicalShape_le (phi : Equiv.Perm (Fin 3)) {u v : Shape} + (h : ∀ i, v i ≤ u i) : ∀ i, physicalShape phi v i ≤ physicalShape phi u i := + fun i => h (phi.symm i) + +@[simp] theorem physicalShape_complement (phi : Equiv.Perm (Fin 3)) (u v : Shape) : + physicalShape phi (complement u v) = + complement (physicalShape phi u) (physicalShape phi v) := rfl + +theorem physicalShape_total (phi : Equiv.Perm (Fin 3)) (u : Shape) : + shapeTotal (physicalShape phi u) = shapeTotal u := by + simpa [shapeTotal, physicalShape, Fin.sum_univ_succ, Nat.add_assoc] using + (Equiv.sum_comp phi.symm u) + +theorem physicalShape_injective (phi : Equiv.Perm (Fin 3)) : + Function.Injective (physicalShape phi) := by + intro u v h + funext i + simpa only [physicalShape_source] using congrFun h (phi i) + +def encodePhysicalShape (phi : Equiv.Perm (Fin 3)) (u : Shape) (h : ShapeBounded u) : + JointPopulation.Shape := encodeShape (physicalShape phi u) (physicalShape_bounded phi u h) + +@[simp] theorem decode_encodePhysicalShape (phi : Equiv.Perm (Fin 3)) + (u : Shape) (h : ShapeBounded u) : + decodeShape (encodePhysicalShape phi u h) = physicalShape phi u := + decode_encodeShape _ _ + +@[simp] theorem encodePhysicalShape_side (phi : Equiv.Perm (Fin 3)) + (u : Shape) (h : ShapeBounded u) (i : Fin 3) : + (JointPopulation.shapeSide i (encodePhysicalShape phi u h)).val = u (phi.symm i) := + encodeShape_side _ _ i + +theorem encodePhysicalShape_inj (phi : Equiv.Perm (Fin 3)) + {u v : Shape} {hu : ShapeBounded u} {hv : ShapeBounded v} + (h : encodePhysicalShape phi u hu = encodePhysicalShape phi v hv) : u = v := + physicalShape_injective phi (encodeShape_inj h) + +theorem encodePhysicalShape_total (phi : Equiv.Perm (Fin 3)) + (u : Shape) (h : ShapeBounded u) : + (encodePhysicalShape phi u h).1.val + (encodePhysicalShape phi u h).2.1.val + + (encodePhysicalShape phi u h).2.2.val = shapeTotal u := + physicalShape_total phi u + +theorem mem_shapes_total {n : ℕ} {u : Shape} (hu : u ∈ shapes n) : shapeTotal u = n := by + simp only [shapes, List.mem_flatMap, List.mem_map, List.mem_range] at hu + obtain ⟨a, ha, b, hb, rfl⟩ := hu + change a + b + (n - a - b) = n + omega + +theorem coordinate_le_total (u : Shape) (i : Fin 3) : u i ≤ shapeTotal u := by + fin_cases i + · change u 0 ≤ u 0 + u 1 + u 2 + omega + · change u 1 ≤ u 0 + u 1 + u 2 + omega + · change u 2 ≤ u 0 + u 1 + u 2 + omega + +theorem mem_shapes_bound {n : ℕ} {u : Shape} (hu : u ∈ shapes n) (i : Fin 3) : u i ≤ n := by + simpa only [mem_shapes_total hu] using coordinate_le_total u i + +theorem mem_shapes_bounded {n : ℕ} {u : Shape} (hu : u ∈ shapes n) (hn : n ≤ 16) : + ShapeBounded u := fun i => (mem_shapes_bound hu i).trans hn + +theorem below_mem_shapes {u v : Shape} (hv : v ∈ below u) : + v ∈ shapes (shapeTotal u / 2) := (List.mem_filter.mp hv).1 + +theorem below_total {u v : Shape} (hv : v ∈ below u) : + shapeTotal v = shapeTotal u / 2 := mem_shapes_total (below_mem_shapes hv) + +theorem below_le {u v : Shape} (hv : v ∈ below u) : ∀ i, v i ≤ u i := by + have h := (List.mem_filter.mp hv).2 + have hb : v 0 ≤ u 0 ∧ v 1 ≤ u 1 ∧ v 2 ≤ u 2 := by + simpa only [Bool.and_eq_true, decide_eq_true_eq, and_assoc] using h + intro i + fin_cases i + · exact hb.1 + · exact hb.2.1 + · exact hb.2.2 + +theorem below_bounded {u v : Shape} (hu : ShapeBounded u) (hv : v ∈ below u) : + ShapeBounded v := fun i => (below_le hv i).trans (hu i) + +theorem complement_bounded {u v : Shape} (hu : ShapeBounded u) : + ShapeBounded (complement u v) := fun i => (Nat.sub_le (u i) (v i)).trans (hu i) + +theorem complement_total {u v : Shape} (h : ∀ i, v i ≤ u i) : + shapeTotal (complement u v) = shapeTotal u - shapeTotal v := by + have h0 := h 0 + have h1 := h 1 + have h2 := h 2 + simp only [shapeTotal, complement] + omega + +theorem root_shape_spec (s : Shape) (hs : s ∈ sortedInitial) : + ShapeBounded s ∧ shapeTotal s = 16 := by + have hm : s ∈ shapes 16 := (List.mem_filter.mp hs).1 + exact ⟨mem_shapes_bounded hm (by omega), mem_shapes_total hm⟩ + +theorem root_shapes_nodup : sortedInitial.Nodup := by decide +kernel + +theorem stageA_below_nodup : ∀ s ∈ positiveInitial, (below s).Nodup := by + decide +kernel + +theorem stageB_below_nodup : ∀ t ∈ positiveSecond, (below t).Nodup := by + decide +kernel + +theorem stageA_get_injective (s : Shape) (hs : s ∈ positiveInitial) : + Function.Injective (below s).get := + List.nodup_iff_injective_get.mp (stageA_below_nodup s hs) + +theorem stageB_get_injective (t : Shape) (ht : t ∈ positiveSecond) : + Function.Injective (below t).get := + List.nodup_iff_injective_get.mp (stageB_below_nodup t ht) + +theorem positiveInitial_shape_spec (s : Shape) (hs : s ∈ positiveInitial) : + ShapeBounded s ∧ shapeTotal s = 16 := + root_shape_spec s (List.mem_filter.mp hs).1 + +theorem positiveSecond_shape_spec (t : Shape) (ht : t ∈ positiveSecond) : + ShapeBounded t ∧ shapeTotal t = 8 := by + have hm : t ∈ shapes 8 := (List.mem_filter.mp ht).1 + exact ⟨mem_shapes_bounded hm (by omega), mem_shapes_total hm⟩ + +theorem stageA_shape_spec (s t : Shape) (hs : s ∈ positiveInitial) (ht : t ∈ below s) : + ShapeBounded t ∧ shapeTotal t = 8 := by + obtain ⟨hb, hsum⟩ := positiveInitial_shape_spec s hs + exact ⟨below_bounded hb ht, by simpa only [hsum] using below_total ht⟩ + +theorem stageA_complement_spec (s t : Shape) (hs : s ∈ positiveInitial) + (ht : t ∈ below s) : ShapeBounded (complement s t) ∧ shapeTotal (complement s t) = 8 := by + obtain ⟨hb, hsum⟩ := positiveInitial_shape_spec s hs + obtain ⟨_, hchild⟩ := stageA_shape_spec s t hs ht + exact ⟨complement_bounded hb, by rw [complement_total (below_le ht), hsum, hchild]⟩ + +theorem stageB_shape_spec (t u : Shape) (ht : t ∈ positiveSecond) (hu : u ∈ below t) : + ShapeBounded u ∧ shapeTotal u = 4 := by + obtain ⟨hb, hsum⟩ := positiveSecond_shape_spec t ht + exact ⟨below_bounded hb hu, by simpa only [hsum] using below_total hu⟩ + +theorem stageB_complement_spec (t u : Shape) (ht : t ∈ positiveSecond) + (hu : u ∈ below t) : ShapeBounded (complement t u) ∧ shapeTotal (complement t u) = 4 := by + obtain ⟨hb, hsum⟩ := positiveSecond_shape_spec t ht + obtain ⟨_, hchild⟩ := stageB_shape_spec t u ht hu + exact ⟨complement_bounded hb, by rw [complement_total (below_le hu), hsum, hchild]⟩ + +theorem stageC_shape_spec (u : Shape) (hu : u ∈ shapes 4) (hpos : positive u = true) + (i : Fin 4) : ShapeBounded (stageCAtom u i) ∧ shapeTotal (stageCAtom u i) = 2 := by + have hi := stageCAtom_mem u hu hpos i + exact ⟨below_bounded (mem_shapes_bounded hu (by omega)) hi, + by simpa only [mem_shapes_total hu] using below_total hi⟩ + +theorem stageC_complement_spec (u : Shape) (hu : u ∈ shapes 4) (hpos : positive u = true) + (i : Fin 4) : ShapeBounded (complement u (stageCAtom u i)) ∧ + shapeTotal (complement u (stageCAtom u i)) = 2 := by + have hi := stageCAtom_mem u hu hpos i + obtain ⟨_, hchild⟩ := stageC_shape_spec u hu hpos i + exact ⟨complement_bounded (mem_shapes_bounded hu (by omega)), + by rw [complement_total (below_le hi), mem_shapes_total hu, hchild]⟩ + +end MatrixMultiplication.AllFieldHistory + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldConstruction/Source.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldConstruction/Source.lean new file mode 100644 index 0000000000000000000000000000000000000000..931a8788ec3b141c34a5aa088f1c4845e1d40f60 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldConstruction/Source.lean @@ -0,0 +1,118 @@ +import OAI.LinearAlgebra.MatrixMultiplication.CoppersmithWinograd.FieldCW +import OAI.LinearAlgebra.MatrixMultiplication.FieldConstruction.Witness +import OAI.LinearAlgebra.MatrixMultiplication.Polynomial.ComplexPolynomialRestriction +import OAI.LinearAlgebra.MatrixMultiplication.Tensor.ComplexTensorBatching + +namespace OAI + +/-! Tensor extraction over arbitrary fields and its asymptotic rate. -/ + +noncomputable section + +open scoped BigOperators +open MatrixMultiplication.Foundation + +namespace MatrixMultiplication.AllFieldSource + +abbrev Word (K N : ℕ) := Fin (8 * K * N) → Fin 7 + +abbrev Index (Copies : Type*) (K N : ℕ) := Copies × Word K N + +def tensor (F Copies : Type*) [CommRing F] [DecidableEq Copies] (K N : ℕ) : + Tensor F (Index Copies K N) (Index Copies K N) (Index Copies K N) := + Tensor.directSum (fun _ : Copies => Tensor.power (FieldCW.tensor F 5) (8 * K * N)) + +def rankBudget (Copies : Type*) [Fintype Copies] (K N : ℕ) : ℕ := + Fintype.card Copies * ((3 * (8 * K * N) + 1) ^ 2 * 7 ^ (8 * K * N)) + +theorem rank_bound (F Copies : Type*) [Field F] + [Fintype Copies] [DecidableEq Copies] (K N : ℕ) : + Tensor.RankAtMost (tensor F Copies K N) (rankBudget Copies K N) := by + have h := (Tensor.diagonal_rankAtMost (K := F) Copies).product + (FieldCW.rank_power F 5 (8 * K * N)) + convert h using 1 + funext x y z + simp [tensor, Tensor.directSum, Tensor.product, Tensor.diagonal, ite_mul] + rfl + +theorem rankBudget_pos (Copies : Type*) [Fintype Copies] (K N : ℕ) + (hcopies : 0 < Fintype.card Copies) : 0 < rankBudget Copies K N := by + unfold rankBudget + exact Nat.mul_pos hcopies + (Nat.mul_pos (pow_pos (Nat.succ_pos _) _) (pow_pos (by decide) _)) + +theorem rankBudget_prod (Slots Copies : Type*) [Fintype Slots] [Fintype Copies] + (K N : ℕ) : + rankBudget (Slots × Copies) K N = Fintype.card Slots * rankBudget Copies K N := by + simp only [rankBudget, Fintype.card_prod, Nat.mul_assoc] + +def matrixTarget (F : Type*) [CommSemiring F] (a b c L : ℕ) := + Tensor.directSum (fun _ : Fin L => + Tensor.matrixCoefficients (K := F) (Fin a) (Fin b) (Fin c)) + +section Consumer + +variable {F Copies : Type*} [Field F] [Fintype Copies] [DecidableEq Copies] +variable {K N a b c L : ℕ} + +theorem restricted_rank_bound + (A : (Fin L × (Fin a × Fin b)) → Index Copies K N → F) + (B : (Fin L × (Fin b × Fin c)) → Index Copies K N → F) + (C : (Fin L × (Fin c × Fin a)) → Index Copies K N → F) + (hcoeff : ∀ x y z, + Tensor.restrict A B C (tensor F Copies K N) x y z = matrixTarget F a b c L x y z) : + Tensor.RankAtMost (matrixTarget F a b c L) (rankBudget Copies K N) := by + have heq : Tensor.restrict A B C (tensor F Copies K N) = matrixTarget F a b c L := + funext fun x => funext fun y => funext fun z => hcoeff x y z + rw [← heq] + exact (rank_bound F Copies K N).restrict A B C + +def restrictedApproximation + (A : (Fin L × (Fin a × Fin b)) → Index Copies K N → F) + (B : (Fin L × (Fin b × Fin c)) → Index Copies K N → F) + (C : (Fin L × (Fin c × Fin a)) → Index Copies K N → F) + (hcoeff : ∀ x y z, + Tensor.restrict A B C (tensor F Copies K N) x y z = matrixTarget F a b c L x y z) : + Tensor.PolynomialApproximation (matrixTarget F a b c L) (rankBudget Copies K N) 0 0 := + Tensor.PolynomialApproximation.ofRankAtMost _ _ (restricted_rank_bound A B C hcoeff) + +def ofRestriction + (A : (Fin L × (Fin a × Fin b)) → Index Copies K N → F) + (B : (Fin L × (Fin b × Fin c)) → Index Copies K N → F) + (C : (Fin L × (Fin c × Fin a)) → Index Copies K N → F) + (hcoeff : ∀ x y z, + Tensor.restrict A B C (tensor F Copies K N) x y z = matrixTarget F a b c L x y z) + (hcopies : 0 < Fintype.card Copies) (ha : 0 < a) (hb : 0 < b) + (hc : 0 < c) (hL : 0 < L) : AllFieldWitness F where + rows := a + inner := b + columns := c + multiplicity := L + rankBound := rankBudget Copies K N + order := 0 + degree := 0 + rows_pos := ha + inner_pos := hb + columns_pos := hc + multiplicity_pos := hL + rankBound_pos := rankBudget_pos Copies K N hcopies + approximation := restrictedApproximation A B C hcoeff + +theorem ofRestriction_polynomial + (A : (Fin L × (Fin a × Fin b)) → Index Copies K N → F) + (B : (Fin L × (Fin b × Fin c)) → Index Copies K N → F) + (C : (Fin L × (Fin c × Fin a)) → Index Copies K N → F) + (hcoeff : ∀ x y z, + Tensor.restrict A B C (tensor F Copies K N) x y z = matrixTarget F a b c L x y z) + (hcopies : 0 < Fintype.card Copies) (ha : 0 < a) (hb : 0 < b) + (hc : 0 < c) (hL : 0 < L) : + (ofRestriction A B C hcoeff hcopies ha hb hc hL).approximation.polynomial = + fun x y z => Polynomial.C (matrixTarget F a b c L x y z) := rfl + +end Consumer + +end MatrixMultiplication.AllFieldSource + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldConstruction/SourceRates.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldConstruction/SourceRates.lean new file mode 100644 index 0000000000000000000000000000000000000000..e87e0c13592b7435ad5ab2ae4149e5abffedeb76 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldConstruction/SourceRates.lean @@ -0,0 +1,117 @@ +import OAI.LinearAlgebra.MatrixMultiplication.FieldConstruction.Source +import Mathlib.Analysis.SpecialFunctions.Log.Basic +import Mathlib.Tactic.FieldSimp +import Mathlib.Tactic.Positivity +import Mathlib.Tactic.Ring + +namespace OAI + +/-! Tensor extraction over arbitrary fields and its asymptotic rate. -/ + +noncomputable section + +namespace MatrixMultiplication.AllFieldSourceRates + +open AllFieldSource Filter +open scoped Topology + +private theorem tendsto_log_linear_div_nat (a : ℝ) (ha : 0 < a) : + Tendsto (fun N : ℕ => Real.log (a * N + 1) / (N : ℝ)) atTop (𝓝 0) := by + have hnat : Tendsto (fun N : ℕ => (N : ℝ)) atTop atTop := + tendsto_natCast_atTop_atTop + have harg : Tendsto (fun N : ℕ => a * N + 1) atTop atTop := + (hnat.const_mul_atTop ha).atTop_add_nonneg (fun _ => zero_le_one) + have hlog : Tendsto (fun N : ℕ => Real.log (a * N + 1) / (a * N + 1)) + atTop (𝓝 0) := by + simpa only [Function.comp_def, id_eq] using + Real.isLittleO_log_id_atTop.tendsto_div_nhds_zero.comp harg + have hinv : Tendsto (fun N : ℕ => (1 : ℝ) / N) atTop (𝓝 0) := + tendsto_const_nhds.div_atTop hnat + have hratio : Tendsto (fun N : ℕ => (a * N + 1) / (N : ℝ)) atTop (𝓝 a) := by + have hsum : Tendsto (fun N : ℕ => a + 1 / (N : ℝ)) atTop (𝓝 a) := by + simpa only [add_zero] using hinv.const_add a + apply hsum.congr' + filter_upwards [eventually_ne_atTop (0 : ℕ)] with N hN + have hN' : (N : ℝ) ≠ 0 := Nat.cast_ne_zero.mpr hN + field_simp [hN'] + have hprod : Tendsto (fun N : ℕ => + (Real.log (a * N + 1) / (a * N + 1)) * ((a * N + 1) / (N : ℝ))) + atTop (𝓝 0) := by + simpa only [zero_mul] using hlog.mul hratio + apply hprod.congr + intro N + have harg' : a * (N : ℝ) + 1 ≠ 0 := by positivity + exact div_mul_div_cancel₀ harg' + +theorem tendsto_log_polynomial_overhead (K : ℕ) (hK : 0 < K) : + Tendsto (fun N : ℕ => + Real.log (((3 * (8 * K * N) + 1) ^ 2 : ℕ) : ℝ) / ((K : ℝ) * N)) + atTop (𝓝 0) := by + have hK' : (0 : ℝ) < K := Nat.cast_pos.mpr hK + have hbase := tendsto_log_linear_div_nat (3 * (8 * (K : ℝ))) (by positivity) + have hscaled : Tendsto (fun N : ℕ => + (2 * (Real.log (3 * (8 * (K : ℝ)) * N + 1) / (N : ℝ))) / (K : ℝ)) + atTop (𝓝 0) := by + simpa only [mul_zero, zero_div] using (hbase.const_mul 2).div_const (K : ℝ) + apply hscaled.congr + intro N + have harg : ((3 * (8 * K * N) + 1 : ℕ) : ℝ) = + 3 * (8 * (K : ℝ)) * N + 1 := by push_cast; ring + rw [Nat.cast_pow, Real.log_pow, harg] + norm_num only [Nat.cast_ofNat] + ring + +theorem tendsto_log_exponential_source (K : ℕ) (hK : 0 < K) : + Tendsto (fun N : ℕ => + Real.log ((7 ^ (8 * K * N) : ℕ) : ℝ) / ((K : ℝ) * N)) + atTop (𝓝 (8 * Real.log 7)) := by + have hK' : (K : ℝ) ≠ 0 := Nat.cast_ne_zero.mpr (Nat.ne_of_gt hK) + apply tendsto_const_nhds.congr' + filter_upwards [eventually_ne_atTop (0 : ℕ)] with N hN + have hN' : (N : ℝ) ≠ 0 := Nat.cast_ne_zero.mpr hN + rw [Nat.cast_pow, Real.log_pow] + push_cast + field_simp [hK', hN'] + +theorem log_rankBudget (Copies : Type*) [Fintype Copies] (K N : ℕ) + (hcopies : 0 < Fintype.card Copies) : + Real.log (rankBudget Copies K N : ℝ) = + Real.log (Fintype.card Copies : ℝ) + + Real.log (((3 * (8 * K * N) + 1) ^ 2 : ℕ) : ℝ) + + Real.log ((7 ^ (8 * K * N) : ℕ) : ℝ) := by + have hc : (Fintype.card Copies : ℝ) ≠ 0 := + Nat.cast_ne_zero.mpr (Nat.ne_of_gt hcopies) + have hp : (((3 * (8 * K * N) + 1) ^ 2 : ℕ) : ℝ) ≠ 0 := by positivity + have he : ((7 ^ (8 * K * N) : ℕ) : ℝ) ≠ 0 := by positivity + simp only [rankBudget, Nat.cast_mul] + rw [Real.log_mul hc (mul_ne_zero hp he), Real.log_mul hp he, ← add_assoc] + +theorem tendsto_log_rankBudget (Copies : ℕ → Type*) [∀ N, Fintype (Copies N)] + (K : ℕ) (hK : 0 < K) + (hcopies : ∀ N, 0 < Fintype.card (Copies N)) + (hcopyRate : Tendsto (fun N : ℕ => + Real.log (Fintype.card (Copies N) : ℝ) / (N : ℝ)) atTop (𝓝 0)) : + Tendsto (fun N : ℕ => + Real.log (rankBudget (Copies N) K N : ℝ) / ((K : ℝ) * N)) + atTop (𝓝 (8 * Real.log 7)) := by + have hc : Tendsto (fun N : ℕ => + Real.log (Fintype.card (Copies N) : ℝ) / ((K : ℝ) * N)) atTop (𝓝 0) := by + have h : Tendsto (fun N : ℕ => + (Real.log (Fintype.card (Copies N) : ℝ) / (N : ℝ)) / (K : ℝ)) + atTop (𝓝 0) := by + simpa only [zero_div] using hcopyRate.div_const (K : ℝ) + apply h.congr + intro N + ring + have hsum := (hc.add (tendsto_log_polynomial_overhead K hK)).add + (tendsto_log_exponential_source K hK) + simp only [zero_add] at hsum + apply hsum.congr + intro N + rw [log_rankBudget (Copies N) K N (hcopies N), add_div, add_div] + +end MatrixMultiplication.AllFieldSourceRates + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldConstruction/StageCCapacity.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldConstruction/StageCCapacity.lean new file mode 100644 index 0000000000000000000000000000000000000000..aee8c3f852f4f85a32066f96d1f2be1c6937dfff --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldConstruction/StageCCapacity.lean @@ -0,0 +1,172 @@ +import OAI.LinearAlgebra.MatrixMultiplication.FieldHistory.Priority +import OAI.LinearAlgebra.MatrixMultiplication.FieldParameters.LeafRates +import OAI.LinearAlgebra.MatrixMultiplication.FieldParameters.Entropy + +namespace OAI + +/-! Tensor extraction over arbitrary fields and its asymptotic rate. -/ + +noncomputable section + +namespace MatrixMultiplication.AllFieldStageCCapacity + +open AllFieldHistory AllFieldParameters MatrixMultiplication.Foundation +open scoped BigOperators + +def stageCMarginal (t u : Shape) (i : Fin 3) (k : Fin 17) : ℝ := + ∑ b : Fin 4, if stageCAtom u b i = k.val then (stageCWeight t u b : ℝ) else 0 + +theorem stageCMarginal_eq_shapeLaw (t u : Shape) (hu : u ∈ shapes 4) + (hpos : positive u = true) (i : Fin 3) (k : Fin 17) : + stageCMarginal t u i k = + ∑ b : Fin 4, if stageCAtom u b i = k.val then + (stageCLaw t u (stageCAtom u b) : ℝ) else 0 := by + simp only [stageCMarginal, stageCLaw_atom t u hu hpos] + +private def symbolicMarginal (u : Shape) (d : ℝ) (i : Fin 3) (k : Fin 17) : ℝ := + ∑ b : Fin 4, if stageCAtom u b i = k.val then + (if b.val < 2 then d / 2 else (1 - d) / 2) else 0 + +private theorem stageCMarginal_symbolic (t u : Shape) (i : Fin 3) (k : Fin 17) : + stageCMarginal t u i k = symbolicMarginal u (binaryParameter t u) i k := by + unfold stageCMarginal symbolicMarginal + apply Finset.sum_congr rfl + intro b _ + by_cases hb : b.val < 2 <;> simp [stageCWeight, hb] + +private theorem symbolicMarginal_eq (u : Shape) (hu : u ∈ shapes 4) + (hpos : positive u = true) (d : ℝ) (i : Fin 3) (k : Fin 17) : + symbolicMarginal u d i k = + if i = stageCDistinguished u then + (if k = 0 then d / 2 else if k = 1 then 1 - d else if k = 2 then d / 2 else 0) + else (if k = 0 then 1 / 2 else if k = 1 then 1 / 2 else 0) := by + have hfirst : + (if 1 = k.val then d / 2 else 0) + (if 0 = k.val then d / 2 else 0) + + (if 1 = k.val then (1 - d) / 2 else 0) + + (if 0 = k.val then (1 - d) / 2 else 0) = + (if k = 0 then 1 / 2 else if k = 1 then 1 / 2 else 0) := by + fin_cases k <;> norm_num <;> ring + have hsecond : + (if 1 = k.val then d / 2 else 0) + (if 0 = k.val then d / 2 else 0) + + (if 0 = k.val then (1 - d) / 2 else 0) + + (if 1 = k.val then (1 - d) / 2 else 0) = + (if k = 0 then 1 / 2 else if k = 1 then 1 / 2 else 0) := by + fin_cases k <;> norm_num <;> ring + have hdistinguished : + (if 0 = k.val then d / 2 else 0) + (if 2 = k.val then d / 2 else 0) + + (if 1 = k.val then (1 - d) / 2 else 0) + + (if 1 = k.val then (1 - d) / 2 else 0) = + (if k = 0 then d / 2 else if k = 1 then 1 - d else if k = 2 then d / 2 else 0) := by + fin_cases k <;> norm_num [Fin.ext_iff] + simp only [symbolicMarginal, Fin.sum_univ_four] + rcases positive_four_shapes u hu hpos with rfl | rfl | rfl + · fin_cases i + · exact hfirst + · exact hsecond + · exact hdistinguished + · fin_cases i + · exact hfirst + · exact hdistinguished + · exact hsecond + · fin_cases i + · exact hdistinguished + · exact hsecond + · exact hfirst + +theorem stageCMarginal_eq (t u : Shape) (hu : u ∈ shapes 4) + (hpos : positive u = true) (i : Fin 3) (k : Fin 17) : + stageCMarginal t u i k = + if i = stageCDistinguished u then + (if k = 0 then (binaryParameter t u : ℝ) / 2 + else if k = 1 then 1 - (binaryParameter t u : ℝ) + else if k = 2 then (binaryParameter t u : ℝ) / 2 else 0) + else (if k = 0 then 1 / 2 else if k = 1 then 1 / 2 else 0) := by + rw [stageCMarginal_symbolic] + exact symbolicMarginal_eq u hu hpos _ i k + +private theorem entropy_three_points {A : Type*} [Fintype A] [DecidableEq A] + (a b c : A) (hab : a ≠ b) (hac : a ≠ c) (hbc : b ≠ c) (p q r : ℝ) : + finiteEntropy (fun i => if i = a then p else if i = b then q + else if i = c then r else 0) = entropyTerm p + entropyTerm q + entropyTerm r := by + unfold finiteEntropy + calc + _ = ∑ i : A, ((if i = a then entropyTerm p else 0) + + (if i = b then entropyTerm q else 0) + (if i = c then entropyTerm r else 0)) := by + apply Finset.sum_congr rfl + intro i _ + by_cases ha : i = a + · subst i + simp [hab, hac] + · by_cases hb : i = b + · subst i + simp [ha, hbc] + · by_cases hc : i = c <;> simp [ha, hb, hc, Ne.symm hac, Ne.symm hbc] + _ = _ := by simp [Finset.sum_add_distrib] + +private theorem entropy_distinguished (d : ℚ) : + finiteEntropy (fun k : Fin 17 => + if k = 0 then (d : ℝ) / 2 else if k = 1 then 1 - (d : ℝ) + else if k = 2 then (d : ℝ) / 2 else 0) = binaryEntropyRate d := by + rw [entropy_three_points (0 : Fin 17) 1 2 (by decide) (by decide) (by decide)] + simp only [entropyTerm_divide] + unfold binaryEntropyRate + ring + +private theorem entropy_other : + finiteEntropy (fun k : Fin 17 => + if k = 0 then (1 / 2 : ℝ) else if k = 1 then 1 / 2 else 0) = Real.log 2 := by + rw [entropy_two_points (0 : Fin 17) 1 (by decide)] + simp only [entropyTerm_divide] + norm_num [entropyTerm] + ring + +theorem stageCMarginal_entropy (t u : Shape) (hu : u ∈ shapes 4) + (hpos : positive u = true) (i : Fin 3) : + finiteEntropy (stageCMarginal t u i) = + if i = stageCDistinguished u then binaryEntropyRate (binaryParameter t u) + else Real.log 2 := by + change finiteEntropy (fun k => stageCMarginal t u i k) = _ + simp_rw [stageCMarginal_eq t u hu hpos] + by_cases hi : i = stageCDistinguished u + · simp only [hi, ite_true] + exact entropy_distinguished _ + · simp only [hi, ite_false] + exact entropy_other + +theorem stageCMarginal_priority_entropy {K : ℕ} (h : PartC K) (i : Fin 3) : + finiteEntropy (stageCMarginal (cParameterParent h) (cShapeParent h) (cPriority h i)) = + if i = h.2 then binaryEntropyRate (binaryParameter (cParameterParent h) (cShapeParent h)) + else Real.log 2 := by + rw [stageCMarginal_entropy (cParameterParent h) (cShapeParent h) + (bShape_size h.1.val) h.1.property (cPriority h i)] + have hi : cPriority h i = stageCDistinguished (cShapeParent h) ↔ i = h.2 := by + rw [← cPriority_at_part h, Equiv.apply_eq_iff_eq] + simp only [hi] + +theorem allocation_capacity (allocation : Allocation) (d : ℚ) (i : Fin 3) : + (∑ part : Fin 3, (allocation.mass part : ℝ) * + (if i = part then binaryEntropyRate d else Real.log 2)) = + (1 - (allocation.mass i : ℝ)) * Real.log 2 + + (allocation.mass i : ℝ) * binaryEntropyRate d := by + have hsum : (∑ part : Fin 3, (allocation.mass part : ℝ)) = 1 := by + exact_mod_cast allocation.total + calc + _ = ∑ part : Fin 3, ((allocation.mass part : ℝ) * Real.log 2 + + if part = i then (allocation.mass i : ℝ) * (binaryEntropyRate d - Real.log 2) else 0) := by + apply Finset.sum_congr rfl + intro part _ + by_cases hp : part = i + · subst part + simp only [ite_true] + ring + · simp [hp, Ne.symm hp] + _ = _ := by + rw [Finset.sum_add_distrib, ← Finset.sum_mul] + simp only [hsum, one_mul, Finset.sum_ite_eq', Finset.mem_univ, ite_true] + ring + +end MatrixMultiplication.AllFieldStageCCapacity + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldConstruction/StageCFinish.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldConstruction/StageCFinish.lean new file mode 100644 index 0000000000000000000000000000000000000000..8fb770541f6803ca30b425971e8b301adbb21bb6 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldConstruction/StageCFinish.lean @@ -0,0 +1,256 @@ +import OAI.LinearAlgebra.MatrixMultiplication.FieldHistory.Tensors +import OAI.LinearAlgebra.MatrixMultiplication.FieldConstruction.StageCRegroup +import OAI.LinearAlgebra.MatrixMultiplication.FieldConstruction.Terminal +import OAI.LinearAlgebra.MatrixMultiplication.CoppersmithWinograd.CWStageCShapeProducts +import OAI.LinearAlgebra.MatrixMultiplication.CoppersmithWinograd.CWStageCProductRates +import OAI.LinearAlgebra.MatrixMultiplication.Arithmetic.MatrixMapDecidable + +namespace OAI + +/-! Tensor extraction over arbitrary fields and its asymptotic rate. -/ + +noncomputable section + +namespace MatrixMultiplication.AllFieldStageCFinish + +open MatrixMultiplication.Foundation AllFieldHistory AllFieldParameters AllFieldFiniteFamily +open CWStageCProducts +open scoped BigOperators Classical +attribute [local instance] Classical.propDecidable Classical.decEq + +private def localMapWithFintypes {F : Type*} [Field F] + {X Y Z X' Y' Z' : Type} [newX : Fintype X] [newY : Fintype Y] [newZ : Fintype Z] + {oldX : Fintype X} {oldY : Fintype Y} {oldZ : Fintype Z} + {T : Tensor F X Y Z} {Q : Tensor F X' Y' Z'} + (M : @LocalMap F _ X Y Z X' Y' Z' oldX oldY oldZ T Q) : + @LocalMap F _ X Y Z X' Y' Z' newX newY newZ T Q := by + cases Subsingleton.elim oldX newX + cases Subsingleton.elim oldY newY + cases Subsingleton.elim oldZ newZ + exact M + +private def pairLocalMap {F : Type*} {H B W : Type} [Field F] [Fintype H] + [Fintype B] [Fintype W] [DecidableEq H] [DecidableEq B] (count : H → B → Bool → ℕ) + (hc : ∀ h b r, count h b r = count h b false) + (T : H → B → Bool → Tensor F W W W) : + LocalMap (AllFieldStageCRegroup.splitTensor count T) + (AllFieldStageCRegroup.pairedTensor count T) where + x := fun x s => if s = AllFieldStageCRegroup.unpair count hc x then 1 else 0 + y := fun y s => if s = AllFieldStageCRegroup.unpair count hc y then 1 else 0 + z := fun z s => if s = AllFieldStageCRegroup.unpair count hc z then 1 else 0 + coefficient := by + have hp := Tensor.pullback_eq_restrict + (AllFieldStageCRegroup.unpair (W := W) count hc) + (AllFieldStageCRegroup.unpair (W := W) count hc) + (AllFieldStageCRegroup.unpair (W := W) count hc) + (AllFieldStageCRegroup.splitTensor count T) + exact hp.symm.trans (AllFieldStageCRegroup.pullback_unpair count hc T) + +private def shapeFactorMap (F : Type*) [Field F] (side : Fin 3) + (placement : Equiv.Perm (Fin 3)) (count : Fin 4 → ℕ) : + LocalMap (placedShapeChildProducts F side placement count) + (Tensor.matrixCoefficients (RowWords (placement side) count) + (MiddleWords (placement side) count) (ColumnWords (placement side) count)) := + LocalMap.ofExists (placedShapeChildProducts_restriction F side placement count) + +private def shapeHistoryMap {F : Type*} {H : Type} [Field F] [Fintype H] [DecidableEq H] + (side : H → Fin 3) (placement : H → Equiv.Perm (Fin 3)) + (count : H → Fin 4 → ℕ) : + LocalMap (CommonDimensions.familyProduct (fun h => + placedShapeChildProducts F (side h) (placement h) (count h))) + (Tensor.matrixCoefficients + (HistoryRowWords (fun h => placement h (side h)) count) + (HistoryMiddleWords (fun h => placement h (side h)) count) + (HistoryColumnWords (fun h => placement h (side h)) count)) := by + let M := AllFieldTerminal.terminalProductMap + (F := F) (H := H) + (X := fun h => Positions (count h) → ChildWords) + (Y := fun h => Positions (count h) → ChildWords) + (Z := fun h => Positions (count h) → ChildWords) + (fun h => placedShapeChildProducts F (side h) (placement h) (count h)) + (fun h => RowWords (placement h (side h)) (count h)) + (fun h => MiddleWords (placement h (side h)) (count h)) + (fun h => ColumnWords (placement h (side h)) (count h)) + (fun h => LocalMap.redecideMatrix + (shapeFactorMap F (side h) (placement h) (count h)) _ _ _) + let N := localMapWithFintypes (F := F) + (X := ∀ h, Positions (count h) → ChildWords) + (Y := ∀ h, Positions (count h) → ChildWords) + (Z := ∀ h, Positions (count h) → ChildWords) + (newX := inferInstance) (newY := inferInstance) (newZ := inferInstance) M + exact LocalMap.redecideMatrix N _ _ _ + +private theorem row_nonempty (s : Fin 3) (b : Fin 4) : Nonempty (Row s b) := by + fin_cases s <;> fin_cases b <;> + dsimp [Row, SmallRow, SmallInner] <;> infer_instance + +private theorem middle_nonempty (s : Fin 3) (b : Fin 4) : Nonempty (Middle s b) := by + fin_cases s <;> fin_cases b <;> + dsimp [Middle, SmallRow, SmallInner] <;> infer_instance + +private theorem column_nonempty (s : Fin 3) (b : Fin 4) : Nonempty (Column s b) := by + fin_cases s <;> fin_cases b <;> + dsimp [Column, SmallRow, SmallInner] <;> infer_instance + +variable {K : ℕ} (allocation : Allocation) (dilation : ℕ) + +abbrev Index (K : ℕ) := AfterC K × Placement + +abbrev RawWords := ∀ h : Index K, + HistoryWord allocation dilation (.afterC h.1, h.2) + +def source (F : Type*) [Field F] (ε : ℝ) : + Tensor F (RawWords (K := K) allocation dilation) + (RawWords (K := K) allocation dilation) (RawWords (K := K) allocation dilation) := + CommonDimensions.familyProduct (fun h : Index K => + historyTensor F allocation dilation ε (.afterC h.1, h.2)) + +def counts (h : PopulationHistory K) (b : Fin 4) (right : Bool) : ℕ := + population allocation dilation (.afterC (h.1, b, right), h.2) + +theorem counts_half (h : PopulationHistory K) (b : Fin 4) (right : Bool) : + counts allocation dilation h b right = counts allocation dilation h b false := + branchPopulation_half allocation dilation (.stageC h.1, h.2) b right + +@[simp] theorem counts_false (h : PopulationHistory K) (b : Fin 4) : + counts allocation dilation h b false = populationAtomCounts allocation dilation h b := rfl + +abbrev SingleWord := Fin 1 → Fin 7 + +def leaf (F : Type*) [Field F] (h : PopulationHistory K) (b : Fin 4) (right : Bool) : + Tensor F SingleWord SingleWord SingleWord := + CWStrands.shapeTensor (Fin 1) (physicalShape h.2 (cShape (h.1, b, right))) + +abbrev GroupedWords := AllFieldStageCRegroup.SplitWords + (counts (K := K) allocation dilation) SingleWord + +abbrev PairedWords := AllFieldStageCRegroup.PairedWords + (counts (K := K) allocation dilation) SingleWord + +def groupedSource (F : Type*) [Field F] := + AllFieldStageCRegroup.splitTensor (counts (K := K) allocation dilation) (leaf (K := K) F) + +def pairedSource (F : Type*) [Field F] : + Tensor F (PairedWords (K := K) allocation dilation) + (PairedWords (K := K) allocation dilation) (PairedWords (K := K) allocation dilation) := + CommonDimensions.familyProduct (fun h : PopulationHistory K => + placedShapeChildProducts F (stageCDistinguished (cShapeParent h.1)) h.2 + (populationAtomCounts allocation dilation h)) + +def indexEquiv : (PopulationHistory K × Fin 4 × Bool) ≃ Index K where + toFun h := ((h.1.1, h.2.1, h.2.2), h.1.2) + invFun h := ((h.1.1, h.2), h.1.2.1, h.1.2.2) + left_inv h := by rcases h with ⟨⟨h, phi⟩, b, r⟩; rfl + right_inv h := by rcases h with ⟨⟨h, b, r⟩, phi⟩; rfl + +def toRaw (x : GroupedWords (K := K) allocation dilation) : RawWords (K := K) allocation dilation := + fun h => x (h.1.1, h.2) h.1.2.1 h.1.2.2 + +theorem regroup_coefficient (F : Type*) [Field F] (ε : ℝ) + (x y z : GroupedWords (K := K) allocation dilation) : + source allocation dilation F ε (toRaw allocation dilation x) + (toRaw allocation dilation y) (toRaw allocation dilation z) = + groupedSource allocation dilation F x y z := by + change (∏ h : Index K, historyTensor F allocation dilation ε (.afterC h.1, h.2) + (toRaw allocation dilation x h) (toRaw allocation dilation y h) + (toRaw allocation dilation z h)) = _ + rw [← (indexEquiv (K := K)).prod_comp] + simp only [Fintype.prod_prod_type] + simp only [indexEquiv, Equiv.coe_fn_mk, toRaw, historyTensor_afterC, + groupedSource, AllFieldStageCRegroup.splitTensor, CommonDimensions.familyProduct, leaf, counts, + Fintype.prod_prod_type] + +def regroupMap (F : Type*) [Field F] (ε : ℝ) : + LocalMap (source (K := K) allocation dilation F ε) + (groupedSource (K := K) allocation dilation F) where + x := fun x s => if s = toRaw allocation dilation x then 1 else 0 + y := fun y s => if s = toRaw allocation dilation y then 1 else 0 + z := fun z s => if s = toRaw allocation dilation z then 1 else 0 + coefficient := by + rw [← Tensor.pullback_eq_restrict] + funext x y z + exact regroup_coefficient allocation dilation F ε x y z + +theorem leaf_pair (F : Type*) [Field F] (h : PopulationHistory K) (b : Fin 4) : + Tensor.product (leaf F h b false) (leaf F h b true) = + placedShapeChildProduct F (stageCDistinguished (cShapeParent h.1)) h.2 b := by + rw [placedShapeChildProduct_eq_stageC F (cShapeParent h.1) + (bShape_size h.1.1.val) h.1.1.property] + rfl + +theorem pairedSource_eq (F : Type*) [Field F] : + AllFieldStageCRegroup.pairedTensor (counts (K := K) allocation dilation) (leaf (K := K) F) = + pairedSource (K := K) allocation dilation F := by + funext x y z + dsimp only [AllFieldStageCRegroup.pairedTensor, pairedSource, placedShapeChildProducts, + CommonDimensions.familyProduct] + apply Finset.prod_congr rfl + intro h _ + apply Finset.prod_congr rfl + intro p _ + exact congrFun (congrFun (congrFun (leaf_pair F h p.1) (x h p)) (y h p)) (z h p) + +attribute [local irreducible] AllFieldHistory.population + +def pairMap (F : Type*) [Field F] : + LocalMap (groupedSource (K := K) allocation dilation F) + (pairedSource (K := K) allocation dilation F) := by + let M := pairLocalMap (F := F) (H := PopulationHistory K) (B := Fin 4) (W := SingleWord) + (counts (K := K) allocation dilation) + (counts_half (K := K) allocation dilation) (leaf (K := K) F) + let N : LocalMap (groupedSource (K := K) allocation dilation F) + (AllFieldStageCRegroup.pairedTensor (counts (K := K) allocation dilation) (leaf (K := K) F)) := + localMapWithFintypes + (X := GroupedWords (K := K) allocation dilation) + (Y := GroupedWords (K := K) allocation dilation) + (Z := GroupedWords (K := K) allocation dilation) + (X' := PairedWords (K := K) allocation dilation) + (Y' := PairedWords (K := K) allocation dilation) + (Z' := PairedWords (K := K) allocation dilation) M + exact ⟨N.x, N.y, N.z, N.coefficient.trans (pairedSource_eq (K := K) allocation dilation F)⟩ + +abbrev Rows := HistoryRowWords (populationSide (K := K)) (populationAtomCounts allocation dilation) +abbrev Middles := HistoryMiddleWords (populationSide (K := K)) (populationAtomCounts allocation dilation) +abbrev Columns := HistoryColumnWords (populationSide (K := K)) (populationAtomCounts allocation dilation) + +def terminalMap (F : Type*) [Field F] : + LocalMap (pairedSource (K := K) allocation dilation F) + (Tensor.matrixCoefficients (Rows (K := K) allocation dilation) + (Middles (K := K) allocation dilation) (Columns (K := K) allocation dilation)) := by + let M := shapeHistoryMap (F := F) (H := PopulationHistory K) + (fun h : PopulationHistory K => stageCDistinguished (cShapeParent h.1)) + (fun h => h.2) (populationAtomCounts allocation dilation) + exact LocalMap.redecideMatrix (localMapWithFintypes M) _ _ _ + +def finishMap (F : Type*) [Field F] (ε : ℝ) : + LocalMap (source (K := K) allocation dilation F ε) + (Tensor.matrixCoefficients (Rows (K := K) allocation dilation) + (Middles (K := K) allocation dilation) (Columns (K := K) allocation dilation)) := + (regroupMap allocation dilation F ε).comp + ((pairMap allocation dilation F).comp (terminalMap allocation dilation F)) + +theorem volume_eq_populationVolume : + Fintype.card (Rows (K := K) allocation dilation) * + Fintype.card (Middles (K := K) allocation dilation) * + Fintype.card (Columns (K := K) allocation dilation) = + populationVolume (K := K) allocation dilation := by + simp only [Rows, Middles, Columns, populationVolume, historyVolume, + HistoryRowWords, HistoryMiddleWords, HistoryColumnWords, Fintype.card_pi] + +theorem rows_pos : 0 < Fintype.card (Rows (K := K) allocation dilation) := by + apply Fintype.card_pos_iff.mpr + exact ⟨fun h p => Classical.choice (row_nonempty (populationSide h) p.1)⟩ + +theorem middles_pos : 0 < Fintype.card (Middles (K := K) allocation dilation) := by + apply Fintype.card_pos_iff.mpr + exact ⟨fun h p => Classical.choice (middle_nonempty (populationSide h) p.1)⟩ + +theorem columns_pos : 0 < Fintype.card (Columns (K := K) allocation dilation) := by + apply Fintype.card_pos_iff.mpr + exact ⟨fun h p => Classical.choice (column_nonempty (populationSide h) p.1)⟩ + +end MatrixMultiplication.AllFieldStageCFinish + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldConstruction/StageCGibbs.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldConstruction/StageCGibbs.lean new file mode 100644 index 0000000000000000000000000000000000000000..925d4e0c33aba79df33936f7e45869a838ec8048 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldConstruction/StageCGibbs.lean @@ -0,0 +1,131 @@ +import OAI.LinearAlgebra.MatrixMultiplication.FieldConstruction.ActiveGibbs +import OAI.LinearAlgebra.MatrixMultiplication.JointExtraction.MarginalSupport + +namespace OAI + +/-! Tensor extraction over arbitrary fields and its asymptotic rate. -/ + +noncomputable section + +namespace MatrixMultiplication.AllFieldStageCGibbs + +open AllFieldParameters AllFieldHistory AllFieldActiveLaws AllFieldActiveGibbs +open MatrixMultiplication.Foundation JointPopulation JointAmbientDegree +open scoped BigOperators +attribute [local instance] Classical.propDecidable Classical.decEq + +def distinguishedSide {K : ℕ} (h : PartC K) (phi : Placement) : Fin 3 := + phi (stageCDistinguished (cShapeParent h)) + +def coordinateMass {K : ℕ} (h : PartC K) (k : Fin 17) : ℝ := + if k.val = 1 then + (((1 - binaryParameter (cParameterParent h) (cShapeParent h)) / 2 : ℚ) : ℝ) + else ((binaryParameter (cParameterParent h) (cShapeParent h) / 2 : ℚ) : ℝ) + +def physicalPotential {K : ℕ} (h : PartC K) (phi : Placement) + (side : Fin 3) (k : Fin 17) : ℝ := + if side = distinguishedSide h phi then Real.log (coordinateMass h k) else 0 + +theorem distinguishedSide_branch {K : ℕ} (h : PartC K) (phi : Placement) + (b : Fin 4) : + (shapeSide (distinguishedSide h phi) (branchShape (Work.stageC h, phi) b)).val = + stageCAtom (cShapeParent h) b (stageCDistinguished (cShapeParent h)) := by + simp only [distinguishedSide, branchShape, encodePhysicalShape_side, + Equiv.symm_apply_apply, Work.splitShape, cSplit] + +theorem placedLaw_stageC_branch_mass {K : ℕ} (h : PartC K) (phi : Placement) + (b : Fin 4) : + (placedLaw (Work.stageC h, phi)).mass (branchShape (Work.stageC h, phi) b) = + coordinateMass h + (shapeSide (distinguishedSide h phi) (branchShape (Work.stageC h, phi) b)) := by + change (Work.stageC h).Branch at b + rw [placedLaw_mass_branch] + change (stageCWeight (cParameterParent h) (cShapeParent h) b : ℝ) = _ + simp only [coordinateMass, distinguishedSide_branch h phi b] + unfold stageCWeight + have hm := stageCAtom_middle (cShapeParent h) (bShape_size h.1.val) h.1.property b + by_cases hb : b.val < 2 + · have hn : ¬stageCAtom (cShapeParent h) b (stageCDistinguished (cShapeParent h)) = 1 := + fun hmiddle => (hm.mp hmiddle) hb + simp only [hb, ite_true, hn, ite_false] + · have hx := hm.mpr hb + simp only [hb, ite_false, hx, ite_true] + +theorem placedLaw_stageC_mass_of_positive {K : ℕ} (h : PartC K) (phi : Placement) + (u : JointPopulation.Shape) (hu : 0 < (placedLaw (Work.stageC h, phi)).mass u) : + (placedLaw (Work.stageC h, phi)).mass u = + coordinateMass h (shapeSide (distinguishedSide h phi) u) := by + obtain ⟨b, rfl⟩ := placedLaw_positive_has_branch (Work.stageC h, phi) u hu + exact placedLaw_stageC_branch_mass h phi b + +theorem placedLaw_stageC_mass_on_feasible {K : ℕ} (h : PartC K) (phi : Placement) + (u : JointPopulation.Shape) (ht : u.1.val + u.2.1.val + u.2.2.val = 2) + (hle : ∀ s, (shapeSide s u).val ≤ physicalShape phi (cShapeParent h) s) : + (placedLaw (Work.stageC h, phi)).mass u = + coordinateMass h (shapeSide (distinguishedSide h phi) u) := by + obtain ⟨b, rfl⟩ := branchShape_exhaustive (Work.stageC h, phi) u ht hle + exact placedLaw_stageC_branch_mass h phi b + +theorem sum_physicalPotential {K : ℕ} (h : PartC K) (phi : Placement) + (u : JointPopulation.Shape) : + (∑ s : Fin 3, physicalPotential h phi s (shapeSide s u)) = + Real.log (coordinateMass h (shapeSide (distinguishedSide h phi) u)) := by + simp only [physicalPotential, Finset.sum_ite_eq', Finset.mem_univ, ite_true] + +theorem placedLaw_stageC_log {K : ℕ} (h : PartC K) (phi : Placement) + (u : JointPopulation.Shape) (hu : 0 < (placedLaw (Work.stageC h, phi)).mass u) : + Real.log ((placedLaw (Work.stageC h, phi)).mass u) = + physicalPotential h phi 0 (shapeSide 0 u) + + physicalPotential h phi 1 (shapeSide 1 u) + + physicalPotential h phi 2 (shapeSide 2 u) - 0 := by + rw [placedLaw_stageC_mass_of_positive h phi u hu, ← sum_physicalPotential h phi u, + Fin.sum_univ_three, sub_zero] + +theorem placedLaw_positive_parent_bounds {K : ℕ} (w : PlacedWork K) + (u : JointPopulation.Shape) (hu : 0 < (placedLaw w).mass u) : + ∀ s, (shapeSide s u).val ≤ physicalShape w.2 w.1.parentShape s := by + obtain ⟨b, rfl⟩ := placedLaw_positive_has_branch w u hu + intro s + rw [branchShape, encodePhysicalShape_side] + exact w.1.splitShape_le b (w.2.symm s) + +theorem jointCounts_positive_reference {K : ℕ} (allocation : Allocation) (dilation : ℕ) + (w : PlacedWork K) (u : JointPopulation.Shape) + (hu : 0 < jointCounts allocation dilation w u) : 0 < (placedLaw w).mass u := by + have hc : (0 : ℝ) < (jointCounts allocation dilation w u : ℝ) := by exact_mod_cast hu + rw [jointCounts_cast] at hc + rcases mul_pos_iff.mp hc with hpos | hneg + · exact hpos.2 + · exact False.elim (not_lt_of_ge (Nat.cast_nonneg _) hneg.1) + +theorem localAllowed_positive_reference {Hist : Type*} [Fintype Hist] [DecidableEq Hist] + (counts : Hist → JointPopulation.Shape → ℕ) (total : Hist → ℕ) + (hist : Hist) (word : Positions counts hist → JointPopulation.Shape) + (hw : localAllowed counts total hist word) + {K : ℕ} (h : PartC K) (phi : Placement) (htotal : total hist = 2) + (hcounts : ∀ u, 0 < counts hist u → 0 < (placedLaw (Work.stageC h, phi)).mass u) : + ∀ i, 0 < (placedLaw (Work.stageC h, phi)).mass (word i) := by + intro i + have hbounds := JointMarginalSupport.localAllowed_parent_bounds counts total hist word hw + (physicalShape phi (cShapeParent h)) + (fun u hu => placedLaw_positive_parent_bounds (Work.stageC h, phi) u (hcounts u hu)) + obtain ⟨j, hj⟩ := JointMarginalSupport.localAllowed_coordinate_witness + counts total hist word hw (distinguishedSide h phi) i + have hp : 0 < (placedLaw (Work.stageC h, phi)).mass ((canonicalTarget counts hist).val j) := + hcounts _ (symbol_count_pos counts (canonicalTarget counts) hist j) + have ht : (word i).1.val + (word i).2.1.val + (word i).2.2.val = 2 := + (hw.1 i).trans htotal + calc + 0 < (placedLaw (Work.stageC h, phi)).mass ((canonicalTarget counts hist).val j) := hp + _ = coordinateMass h + (shapeSide (distinguishedSide h phi) ((canonicalTarget counts hist).val j)) := + placedLaw_stageC_mass_of_positive h phi _ hp + _ = coordinateMass h (shapeSide (distinguishedSide h phi) (word i)) := congrArg _ hj + _ = (placedLaw (Work.stageC h, phi)).mass (word i) := + (placedLaw_stageC_mass_on_feasible h phi (word i) ht (hbounds i)).symm + +end MatrixMultiplication.AllFieldStageCGibbs + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldConstruction/StageCLaw.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldConstruction/StageCLaw.lean new file mode 100644 index 0000000000000000000000000000000000000000..591e04146dece5ddf802dc4f84fbae26cc2f3e52 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldConstruction/StageCLaw.lean @@ -0,0 +1,164 @@ +import OAI.LinearAlgebra.MatrixMultiplication.FieldParameters.Distributions + +namespace OAI + +/-! Tensor extraction over arbitrary fields and its asymptotic rate. -/ + +namespace MatrixMultiplication.AllFieldHistory + +open AllFieldParameters +open scoped BigOperators + +def stageCDistinguished (u : Shape) : Fin 3 := + if u 0 = 2 then 0 else if u 1 = 2 then 1 else 2 + +def stageCCanonicalAtom : Fin 4 → Shape := + ![shape 1 1 0, shape 0 0 2, shape 1 0 1, shape 0 1 1] + +def stageCAtom (u : Shape) (i : Fin 4) : Shape := + if stageCDistinguished u = 0 then + shape (stageCCanonicalAtom i 2) (stageCCanonicalAtom i 1) (stageCCanonicalAtom i 0) + else if stageCDistinguished u = 1 then + shape (stageCCanonicalAtom i 0) (stageCCanonicalAtom i 2) (stageCCanonicalAtom i 1) + else stageCCanonicalAtom i + +def stageCWeight (t u : Shape) (i : Fin 4) : ℚ := + if i.val < 2 then binaryParameter t u / 2 else (1 - binaryParameter t u) / 2 + +theorem positive_four_shapes : ∀ u ∈ shapes 4, positive u = true → + u = shape 1 1 2 ∨ u = shape 1 2 1 ∨ u = shape 2 1 1 := by + decide +kernel + +theorem stageCDistinguished_spec : ∀ u ∈ shapes 4, positive u = true → + u (stageCDistinguished u) = 2 ∧ + ∀ i, u i = 2 → i = stageCDistinguished u := by + decide +kernel + +theorem stageC_children_length : ∀ u ∈ shapes 4, positive u = true → + (below u).length = 4 := by + decide +kernel + +theorem stageC_children_geometry : ∀ u ∈ shapes 4, positive u = true → + ∀ v ∈ below u, + complement u v ∈ below u ∧ + (∀ i, v i ≤ u i) ∧ + (∃ i, v i = 0) ∧ (∃ i, complement u v i = 0) := by + decide +kernel + +theorem stageC_middle_complement : ∀ u ∈ shapes 4, positive u = true → + ∀ v ∈ below u, + (complement u v (stageCDistinguished u) = 1 ↔ + v (stageCDistinguished u) = 1) := by + decide +kernel + +theorem stageCAtom_injective : ∀ u ∈ shapes 4, positive u = true → + Function.Injective (stageCAtom u) := by + decide +kernel + +theorem stageCAtom_mem : ∀ u ∈ shapes 4, positive u = true → + ∀ i, stageCAtom u i ∈ below u := by + decide +kernel + +theorem stageCAtom_exhaustive : ∀ u ∈ shapes 4, positive u = true → + ∀ v ∈ below u, ∃ i, stageCAtom u i = v := by + decide +kernel + +theorem stageCAtom_middle : ∀ u ∈ shapes 4, positive u = true → + ∀ i, stageCAtom u i (stageCDistinguished u) = 1 ↔ ¬i.val < 2 := by + decide +kernel + +def stageCShapeWeight (d : ℚ) (u v : Shape) : ℚ := + if v ∈ below u then + if v (stageCDistinguished u) = 1 then (1 - d) / 2 else d / 2 + else 0 + +def stageCLaw (t u v : Shape) : ℚ := stageCShapeWeight (binaryParameter t u) u v + +theorem stageCLaw_source (t u v : Shape) : + stageCLaw t u v = + if v ∈ below u then + if v (stageCDistinguished u) = 1 then + (1 - binaryParameter t u) / 2 else binaryParameter t u / 2 + else 0 := rfl + +theorem stageCLaw_nonnegative (t u v : Shape) : 0 ≤ stageCLaw t u v := by + obtain ⟨hlo, hhi⟩ := binaryParameter_bounds t u + unfold stageCLaw stageCShapeWeight + split_ifs <;> linarith + +theorem stageCWeight_nonnegative (t u : Shape) (i : Fin 4) : + 0 ≤ stageCWeight t u i := by + obtain ⟨hlo, hhi⟩ := binaryParameter_bounds t u + unfold stageCWeight + split_ifs <;> linarith + +theorem stageCWeight_normalized (t u : Shape) : ∑ i, stageCWeight t u i = 1 := by + norm_num [stageCWeight, Fin.sum_univ_succ] + ring + +theorem stageCWeight_single (t u : Shape) : + stageCWeight t u 0 + stageCWeight t u 1 = binaryParameter t u := by + change binaryParameter t u / 2 + binaryParameter t u / 2 = binaryParameter t u + ring + +theorem stageCWeight_cross (t u : Shape) : + stageCWeight t u 2 + stageCWeight t u 3 = 1 - binaryParameter t u := by + change (1 - binaryParameter t u) / 2 + (1 - binaryParameter t u) / 2 = + 1 - binaryParameter t u + ring + +theorem stageCLaw_atom (t u : Shape) (hu : u ∈ shapes 4) + (hpos : positive u = true) (i : Fin 4) : + stageCLaw t u (stageCAtom u i) = stageCWeight t u i := by + simp only [stageCLaw, stageCShapeWeight, stageCAtom_mem u hu hpos i, ite_true, + stageCAtom_middle u hu hpos i, ite_not, stageCWeight] + +private theorem stageCShapeWeight_normalized (d : ℚ) (u : Shape) + (hu : u ∈ shapes 4) (hpos : positive u = true) : + ((shapes 2).map (stageCShapeWeight d u)).sum = 1 := by + rcases positive_four_shapes u hu hpos with rfl | rfl | rfl <;> + norm_num [stageCShapeWeight, stageCDistinguished, below, shapes, shape, List.range_succ, + Matrix.cons_val_two, funext_iff, Fin.forall_fin_succ] <;> ring + +private theorem stageCShapeWeight_normalized_below (d : ℚ) (u : Shape) + (hu : u ∈ shapes 4) (hpos : positive u = true) : + ((below u).map (stageCShapeWeight d u)).sum = 1 := by + rcases positive_four_shapes u hu hpos with rfl | rfl | rfl <;> + norm_num [stageCShapeWeight, stageCDistinguished, below, shapes, shape, List.range_succ, + Matrix.cons_val_two, funext_iff, Fin.forall_fin_succ] <;> ring + +theorem stageCLaw_normalized (t u : Shape) + (hu : u ∈ shapes 4) (hpos : positive u = true) : + ((shapes 2).map (stageCLaw t u)).sum = 1 := + stageCShapeWeight_normalized (binaryParameter t u) u hu hpos + +theorem stageCLaw_normalized_below (t u : Shape) + (hu : u ∈ shapes 4) (hpos : positive u = true) : + ((below u).map (stageCLaw t u)).sum = 1 := + stageCShapeWeight_normalized_below (binaryParameter t u) u hu hpos + +theorem stageCLaw_outside_support (t u v : Shape) (hv : v ∉ below u) : + stageCLaw t u v = 0 := by + simp only [stageCLaw, stageCShapeWeight, ite_eq_right hv] + +theorem stageCLaw_support (t u v : Shape) (h : stageCLaw t u v ≠ 0) : + v ∈ below u := by + by_contra hv + exact h (stageCLaw_outside_support t u v hv) + +theorem stageCLaw_children_zero (t u v : Shape) + (hu : u ∈ shapes 4) (hpos : positive u = true) + (h : stageCLaw t u v ≠ 0) : + (∃ i, v i = 0) ∧ (∃ i, complement u v i = 0) := + (stageC_children_geometry u hu hpos v (stageCLaw_support t u v h)).2.2 + +theorem stageCLaw_complement (t u v : Shape) + (hu : u ∈ shapes 4) (hpos : positive u = true) (hv : v ∈ below u) : + stageCLaw t u (complement u v) = stageCLaw t u v := by + have hc := (stageC_children_geometry u hu hpos v hv).1 + have hm := stageC_middle_complement u hu hpos v hv + simp only [stageCLaw, stageCShapeWeight, hv, hc, ite_true, hm] + +end MatrixMultiplication.AllFieldHistory + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldConstruction/StageCRegroup.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldConstruction/StageCRegroup.lean new file mode 100644 index 0000000000000000000000000000000000000000..77b9e728854b83ec4f384cb49d9cbcfd0cd88ba8 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldConstruction/StageCRegroup.lean @@ -0,0 +1,110 @@ +import OAI.LinearAlgebra.MatrixMultiplication.Arithmetic.CommonDimensions +import Mathlib.Data.Fintype.BigOperators + +namespace OAI + +/-! Tensor extraction over arbitrary fields and its asymptotic rate. -/ + +noncomputable section + +open scoped BigOperators +open MatrixMultiplication.Foundation +open MatrixMultiplication.CommonDimensions + +namespace MatrixMultiplication.AllFieldStageCRegroup + +attribute [local instance] Classical.propDecidable Classical.decEq + +variable {H B W F : Type*} + +abbrev Positions (count : H → B → Bool → ℕ) (h : H) := + Σ b : B, Fin (count h b false) + +abbrev PairedWords (count : H → B → Bool → ℕ) (W : Type*) := + ∀ h, Positions count h → W × W + +abbrev SplitWords (count : H → B → Bool → ℕ) (W : Type*) := + ∀ h b r, Fin (count h b r) → W + +def unpair (count : H → B → Bool → ℕ) + (hc : ∀ h b r, count h b r = count h b false) + (x : PairedWords count W) : SplitWords count W := + fun h b r i => + if r then (x h ⟨b, Fin.cast (hc h b r) i⟩).2 + else (x h ⟨b, Fin.cast (hc h b r) i⟩).1 + +def pair (count : H → B → Bool → ℕ) + (hc : ∀ h b r, count h b r = count h b false) + (x : SplitWords count W) : PairedWords count W := + fun h p => (x h p.1 false p.2, x h p.1 true (Fin.cast (hc h p.1 true).symm p.2)) + +theorem pair_unpair (count : H → B → Bool → ℕ) + (hc : ∀ h b r, count h b r = count h b false) + (x : PairedWords count W) : pair count hc (unpair count hc x) = x := by + funext h p + rfl + +theorem unpair_pair (count : H → B → Bool → ℕ) + (hc : ∀ h b r, count h b r = count h b false) + (x : SplitWords count W) : unpair count hc (pair count hc x) = x := by + funext h b r i + cases r <;> rfl + +def unpairEquiv (count : H → B → Bool → ℕ) + (hc : ∀ h b r, count h b r = count h b false) : + PairedWords count W ≃ SplitWords count W where + toFun := unpair count hc + invFun := pair count hc + left_inv := pair_unpair count hc + right_inv := unpair_pair count hc + +variable [Fintype H] [Fintype B] [CommSemiring F] + +def splitTensor (count : H → B → Bool → ℕ) (T : H → B → Bool → Tensor F W W W) : + Tensor F (SplitWords count W) (SplitWords count W) (SplitWords count W) := + familyProduct fun h => familyProduct fun b => familyProduct fun r => + Tensor.power (T h b r) (count h b r) + +def pairedTensor (count : H → B → Bool → ℕ) (T : H → B → Bool → Tensor F W W W) : + Tensor F (PairedWords count W) (PairedWords count W) (PairedWords count W) := + familyProduct fun h => familyProduct fun p : Positions count h => + Tensor.product (T h p.1 false) (T h p.1 true) + +private theorem prod_fin_cast {m n : ℕ} (e : m = n) (f : Fin n → F) : + (∏ i : Fin m, f (Fin.cast e i)) = ∏ i : Fin n, f i := by + subst n + rfl + +theorem pullback_unpair (count : H → B → Bool → ℕ) + (hc : ∀ h b r, count h b r = count h b false) + (T : H → B → Bool → Tensor F W W W) : + Tensor.pullback (unpair count hc) (unpair count hc) (unpair count hc) + (splitTensor count T) = pairedTensor count T := by + funext x y z + simp only [Tensor.pullback, splitTensor, pairedTensor, familyProduct] + apply Finset.prod_congr rfl + intro h _ + rw [Fintype.prod_sigma] + apply Finset.prod_congr rfl + intro b _ + rw [Fintype.prod_bool] + change + (∏ j : Fin (count h b true), T h b true + (x h ⟨b, Fin.cast (hc h b true) j⟩).2 + (y h ⟨b, Fin.cast (hc h b true) j⟩).2 + (z h ⟨b, Fin.cast (hc h b true) j⟩).2) * + (∏ j : Fin (count h b false), T h b false + (x h ⟨b, j⟩).1 (y h ⟨b, j⟩).1 (z h ⟨b, j⟩).1) = + ∏ j : Fin (count h b false), + T h b false (x h ⟨b, j⟩).1 (y h ⟨b, j⟩).1 (z h ⟨b, j⟩).1 * + T h b true (x h ⟨b, j⟩).2 (y h ⟨b, j⟩).2 (z h ⟨b, j⟩).2 + rw [prod_fin_cast (hc h b true) (fun j => + T h b true (x h ⟨b, j⟩).2 (y h ⟨b, j⟩).2 (z h ⟨b, j⟩).2), + Finset.prod_mul_distrib] + exact mul_comm _ _ + +end MatrixMultiplication.AllFieldStageCRegroup + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldConstruction/StageCTerminalRates.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldConstruction/StageCTerminalRates.lean new file mode 100644 index 0000000000000000000000000000000000000000..043e0fadbabc3e5cc58f1e21fa69d307ea5489c9 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldConstruction/StageCTerminalRates.lean @@ -0,0 +1,123 @@ +import OAI.LinearAlgebra.MatrixMultiplication.CoppersmithWinograd.CWStageCProductRates +import OAI.LinearAlgebra.MatrixMultiplication.FieldHistory.Sums + +namespace OAI + +/-! Tensor extraction over arbitrary fields and its asymptotic rate. -/ + +noncomputable section + +namespace MatrixMultiplication.AllFieldStageCTerminalRates + +open AllFieldHistory AllFieldParameters CWStageCProducts +open scoped BigOperators Topology +attribute [local instance] Classical.propDecidable Classical.decEq + +theorem sum_populationHistory_rate {K : ℕ} (allocation : Allocation) : + (∑ h : PopulationHistory K, + (amount allocation (.partC h.1, h.2) : ℝ) * + (2 - (binaryParameter (cParameterParent h.1) (cShapeParent h.1) : ℝ)) * + Real.log 5) = + ∑ h : BPositive K, (bAmount h.val : ℝ) * + (2 - (binaryParameter (aShape h.val.1.val) (bShape h.val) : ℝ)) * + Real.log 5 := by + calc + _ = ∑ h : PartC K, (partAmount allocation h : ℝ) * + (2 - (binaryParameter (cParameterParent h) (cShapeParent h) : ℝ)) * + Real.log 5 := by + rw [Fintype.sum_prod_type] + apply Finset.sum_congr rfl + intro h _ + dsimp only + rw [← Finset.sum_mul, ← Finset.sum_mul] + have hm : (∑ phi : Placement, (amount allocation (.partC h, phi) : ℝ)) = + (partAmount allocation h : ℝ) := by + exact_mod_cast sum_placement_amount allocation (.partC h) + rw [hm] + _ = _ := by + rw [Fintype.sum_prod_type] + apply Finset.sum_congr rfl + intro h _ + simp only [cParameterParent, cShapeParent] + rw [← Finset.sum_mul, ← Finset.sum_mul] + have hm : (∑ i : Fin 3, (partAmount allocation (h, i) : ℝ)) = + (bAmount h.val : ℝ) := by + exact_mod_cast part_transition allocation h + rw [hm] + +theorem log_populationVolume_eq_bPositive {K : ℕ} (allocation : Allocation) + (dilation : ℕ) : + Real.log (populationVolume (K := K) allocation dilation : ℝ) = + (populationLength (K := K) allocation dilation : ℝ) * + ∑ h : BPositive K, (bAmount h.val : ℝ) * + (2 - (binaryParameter (aShape h.val.1.val) (bShape h.val) : ℝ)) * + Real.log 5 := by + rw [log_populationVolume, sum_populationHistory_rate] + +theorem normalized_log_populationVolume_eq_bPositive {K : ℕ} + (allocation : Allocation) (dilation : ℕ) (hd : 0 < dilation) : + Real.log (populationVolume (K := K) allocation dilation : ℝ) / + populationLength (K := K) allocation dilation = + ∑ h : BPositive K, (bAmount h.val : ℝ) * + (2 - (binaryParameter (aShape h.val.1.val) (bShape h.val) : ℝ)) * + Real.log 5 := by + rw [normalized_log_populationVolume allocation dilation hd, + sum_populationHistory_rate] + +theorem normalized_log_populationVolume_allocation_independent {K : ℕ} + (allocation₁ allocation₂ : Allocation) (dilation₁ dilation₂ : ℕ) + (hd₁ : 0 < dilation₁) (hd₂ : 0 < dilation₂) : + Real.log (populationVolume (K := K) allocation₁ dilation₁ : ℝ) / + populationLength (K := K) allocation₁ dilation₁ = + Real.log (populationVolume (K := K) allocation₂ dilation₂ : ℝ) / + populationLength (K := K) allocation₂ dilation₂ := by + rw [normalized_log_populationVolume_eq_bPositive allocation₁ dilation₁ hd₁, + normalized_log_populationVolume_eq_bPositive allocation₂ dilation₂ hd₂] + +theorem tendsto_normalized_log_populationVolume {K : ℕ} (allocation : Allocation) : + Filter.Tendsto (fun dilation : ℕ => + Real.log (populationVolume (K := K) allocation dilation : ℝ) / + populationLength (K := K) allocation dilation) Filter.atTop + (𝓝 (∑ h : BPositive K, (bAmount h.val : ℝ) * + (2 - (binaryParameter (aShape h.val.1.val) (bShape h.val) : ℝ)) * + Real.log 5)) := by + apply tendsto_const_nhds.congr' + filter_upwards [Filter.eventually_gt_atTop (0 : ℕ)] with dilation hd + exact (normalized_log_populationVolume_eq_bPositive allocation dilation hd).symm + +def interiorS2 : ℝ := + (positiveSecond.map (fun t => + (((below t).filter positive).map (fun u => + 2 * (secondMass t : ℝ) * (stageBLaw t u : ℝ) * + (2 - (binaryParameter t u : ℝ)) * Real.log 5)).sum)).sum + +theorem bPositive_rate_eq_interior (K : ℕ) : + (∑ h : BPositive K, (bAmount h.val : ℝ) * + (2 - (binaryParameter (aShape h.val.1.val) (bShape h.val) : ℝ)) * + Real.log 5) = (K : ℝ) * interiorS2 := by + simpa only [interiorS2, littleMass_cast, mul_assoc] using + b_positive_history_sum K + (fun t u => (2 - (binaryParameter t u : ℝ)) * Real.log 5) + +theorem log_populationVolume_eq_interior {K : ℕ} (allocation : Allocation) + (dilation : ℕ) : + Real.log (populationVolume (K := K) allocation dilation : ℝ) = + (K : ℝ) * populationLength (K := K) allocation dilation * interiorS2 := by + rw [log_populationVolume_eq_bPositive, bPositive_rate_eq_interior] + ring + +theorem normalized_log_populationVolume_eq_interior {K : ℕ} (hK : 0 < K) + (allocation : Allocation) (dilation : ℕ) (hd : 0 < dilation) : + Real.log (populationVolume (K := K) allocation dilation : ℝ) / + ((K : ℝ) * populationLength (K := K) allocation dilation) = interiorS2 := by + have hk : (K : ℝ) ≠ 0 := Nat.cast_ne_zero.mpr (Nat.ne_of_gt hK) + have hn : (populationLength (K := K) allocation dilation : ℝ) ≠ 0 := + Nat.cast_ne_zero.mpr (Nat.ne_of_gt (AllFieldPopulationCounts.blockLength_pos _ hd)) + rw [log_populationVolume_eq_interior] + exact mul_div_cancel_left₀ _ (mul_ne_zero hk hn) + +end MatrixMultiplication.AllFieldStageCTerminalRates + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldConstruction/Terminal.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldConstruction/Terminal.lean new file mode 100644 index 0000000000000000000000000000000000000000..2b0b314bbb527e57206efa74cc99bc0b0ec6611c --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldConstruction/Terminal.lean @@ -0,0 +1,75 @@ +import OAI.LinearAlgebra.MatrixMultiplication.FieldConstruction.FiniteFamily +import OAI.LinearAlgebra.MatrixMultiplication.Tensor.TerminalRelabel + +namespace OAI + +/-! Tensor extraction over arbitrary fields and its asymptotic rate. -/ + +noncomputable section + +namespace MatrixMultiplication.AllFieldTerminal + +open MatrixMultiplication.Foundation AllFieldFiniteFamily CommonDimensions +open scoped BigOperators Classical + +variable {F : Type*} {H : Type} [Field F] [Fintype H] + {X Y Z : H → Type} [∀ h, Fintype (X h)] [∀ h, Fintype (Y h)] [∀ h, Fintype (Z h)] + (T : ∀ h, Tensor F (X h) (Y h) (Z h)) (A B C : H → Type) + [∀ h, Fintype (A h)] [∀ h, Fintype (B h)] [∀ h, Fintype (C h)] + (maps : ∀ h, LocalMap (T h) (Tensor.matrixCoefficients (A h) (B h) (C h))) + +def terminalProductMap : + LocalMap (familyProduct T) (Tensor.matrixCoefficients (∀ h, A h) (∀ h, B h) (∀ h, C h)) := + LocalMap.ofExists (TerminalProducts.matrix_restriction_of_history_restrictions + T A B C (fun h => (maps h).x) (fun h => (maps h).y) (fun h => (maps h).z) + (fun h => (maps h).coefficient)) + +variable {I : Type} [Fintype I] {K N : ℕ} + +def terminalExecution + (E : Execution (cwSource F K N) (Tensor.directSum (fun _ : I => familyProduct T))) : + Execution (cwSource F K N) + (AllFieldSource.matrixTarget F (Fintype.card (∀ h, A h)) + (Fintype.card (∀ h, B h)) (Fintype.card (∀ h, C h)) (Fintype.card I)) := + (E.restrict _ ((terminalProductMap T A B C maps).parallelCopies I)).restrict _ + (LocalMap.ofExists (TerminalRelabel.directSum_matrix_restrict_fin (K := F) + I (∀ h, A h) (∀ h, B h) (∀ h, C h))) + +@[simp] theorem terminalExecution_copies + (E : Execution (cwSource F K N) (Tensor.directSum (fun _ : I => familyProduct T))) : + Fintype.card (terminalExecution T A B C maps E).Copies = Fintype.card E.Copies := rfl + +def finish + (E : Execution (cwSource F K N) (Tensor.directSum (fun _ : I => familyProduct T))) + (hA : 0 < Fintype.card (∀ h, A h)) (hB : 0 < Fintype.card (∀ h, B h)) + (hC : 0 < Fintype.card (∀ h, C h)) (hI : 0 < Fintype.card I) : AllFieldWitness F := + (terminalExecution T A B C maps E).toWitness hA hB hC hI + +@[simp] theorem finish_multiplicity + (E : Execution (cwSource F K N) (Tensor.directSum (fun _ : I => familyProduct T))) + (hA : 0 < Fintype.card (∀ h, A h)) (hB : 0 < Fintype.card (∀ h, B h)) + (hC : 0 < Fintype.card (∀ h, C h)) (hI : 0 < Fintype.card I) : + (finish T A B C maps E hA hB hC hI).multiplicity = Fintype.card I := rfl + +theorem finish_volume + (E : Execution (cwSource F K N) (Tensor.directSum (fun _ : I => familyProduct T))) + (hA : 0 < Fintype.card (∀ h, A h)) (hB : 0 < Fintype.card (∀ h, B h)) + (hC : 0 < Fintype.card (∀ h, C h)) (hI : 0 < Fintype.card I) : + (finish T A B C maps E hA hB hC hI).volume = + ∏ h, Fintype.card (A h) * Fintype.card (B h) * Fintype.card (C h) := by + change Fintype.card (∀ h, A h) * Fintype.card (∀ h, B h) * + Fintype.card (∀ h, C h) = _ + simp only [Fintype.card_pi, Finset.prod_mul_distrib] + +@[simp] theorem finish_rankBound + (E : Execution (cwSource F K N) (Tensor.directSum (fun _ : I => familyProduct T))) + (hA : 0 < Fintype.card (∀ h, A h)) (hB : 0 < Fintype.card (∀ h, B h)) + (hC : 0 < Fintype.card (∀ h, C h)) (hI : 0 < Fintype.card I) : + (finish T A B C maps E hA hB hC hI).rankBound = + AllFieldSource.rankBudget E.Copies K N := rfl + +end MatrixMultiplication.AllFieldTerminal + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldConstruction/TerminalPopulations.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldConstruction/TerminalPopulations.lean new file mode 100644 index 0000000000000000000000000000000000000000..ae6af0c7310e6a986cf4754bc2967875725dc98e --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldConstruction/TerminalPopulations.lean @@ -0,0 +1,193 @@ +import OAI.LinearAlgebra.MatrixMultiplication.FieldHistory.Populations +import OAI.LinearAlgebra.MatrixMultiplication.Entropy.ConditionalRateBridge + +namespace OAI + +/-! Tensor extraction over arbitrary fields and its asymptotic rate. -/ + +noncomputable section + +namespace MatrixMultiplication.AllFieldTerminalPopulations + +open AllFieldHistory +open scoped BigOperators +attribute [local instance] Classical.propDecidable Classical.decEq + +variable {K : ℕ} {H : Type*} [Fintype H] + {A : H → Type*} [∀ h, Fintype (A h)] + +def law (ν : ∀ h, A h → ℚ) (x : Sigma A) : ℚ := ν x.1 x.2 + +def denominator (ν : ∀ h, A h → ℚ) : ℕ := + AllFieldPopulationCounts.denominator (law ν) + +def dilation (ν : ∀ h, A h → ℚ) (m : ℕ) : ℕ := m * denominator ν + +def count (allocation : Allocation) (history : H → History K) + (ν : ∀ h, A h → ℚ) (m : ℕ) (h : H) (a : A h) : ℕ := + population allocation m (history h) * + AllFieldPopulationCounts.baseCount (law ν) ⟨h, a⟩ + +theorem denominator_pos (ν : ∀ h, A h → ℚ) : 0 < denominator ν := + AllFieldPopulationCounts.denominator_pos (law ν) + +theorem dilation_pos (ν : ∀ h, A h → ℚ) {m : ℕ} (hm : 0 < m) : + 0 < dilation ν m := Nat.mul_pos hm (denominator_pos ν) + +theorem baseCount_cast (ν : ∀ h, A h → ℚ) (hν : ∀ h a, 0 ≤ ν h a) + (h : H) (a : A h) : + (AllFieldPopulationCounts.baseCount (law ν) ⟨h, a⟩ : ℚ) = + (denominator ν : ℚ) * ν h a := + AllFieldPopulationCounts.baseCount_cast (law ν) (fun x => hν x.1 x.2) ⟨h, a⟩ + +theorem sum_baseCount (ν : ∀ h, A h → ℚ) (hν : ∀ h a, 0 ≤ ν h a) + (htotal : ∀ h, ∑ a, ν h a = 1) (h : H) : + (∑ a, AllFieldPopulationCounts.baseCount (law ν) ⟨h, a⟩) = denominator ν := by + apply Nat.cast_injective (R := ℚ) + simp only [Nat.cast_sum, baseCount_cast ν hν, ← Finset.mul_sum, htotal, mul_one] + +theorem population_dilation (allocation : Allocation) (ν : ∀ h, A h → ℚ) + (m : ℕ) (h : History K) : + population allocation (dilation ν m) h = + population allocation m h * denominator ν := by + simp only [population, AllFieldPopulationCounts.count, dilation] + ac_rfl + +theorem populationLength_dilation (allocation : Allocation) (ν : ∀ h, A h → ℚ) + (m : ℕ) : + populationLength (K := K) allocation (dilation ν m) = + populationLength (K := K) allocation m * denominator ν := by + simp only [populationLength, AllFieldPopulationCounts.blockLength, dilation] + ac_rfl + +theorem sum_count (allocation : Allocation) (history : H → History K) + (ν : ∀ h, A h → ℚ) (hν : ∀ h a, 0 ≤ ν h a) + (htotal : ∀ h, ∑ a, ν h a = 1) (m : ℕ) (h : H) : + (∑ a, count allocation history ν m h a) = + population allocation (dilation ν m) (history h) := by + simp only [count, ← Finset.mul_sum, sum_baseCount ν hν htotal, + population_dilation] + +theorem count_cast (allocation : Allocation) (history : H → History K) + (ν : ∀ h, A h → ℚ) (hν : ∀ h a, 0 ≤ ν h a) + (m : ℕ) (h : H) (a : A h) : + (count allocation history ν m h a : ℚ) = + (populationLength (K := K) allocation (dilation ν m) : ℚ) * + amount allocation (history h) * ν h a := by + rw [count, Nat.cast_mul, population_cast, baseCount_cast ν hν, + populationLength_dilation, Nat.cast_mul] + ring + +theorem count_cast_real (allocation : Allocation) (history : H → History K) + (ν : ∀ h, A h → ℚ) (hν : ∀ h a, 0 ≤ ν h a) + (m : ℕ) (h : H) (a : A h) : + (count allocation history ν m h a : ℝ) = + (populationLength (K := K) allocation (dilation ν m) : ℝ) * + (amount allocation (history h) : ℝ) * (ν h a : ℝ) := by + exact_mod_cast count_cast allocation history ν hν m h a + +theorem count_dilate (allocation : Allocation) (history : H → History K) + (ν : ∀ h, A h → ℚ) (m n : ℕ) (h : H) (a : A h) : + count allocation history ν (m * n) h a = + m * count allocation history ν n h a := by + simp only [count, population, AllFieldPopulationCounts.count] + ac_rfl + +theorem count_mul_one (allocation : Allocation) (history : H → History K) + (ν : ∀ h, A h → ℚ) (m : ℕ) (h : H) (a : A h) : + count allocation history ν m h a = m * count allocation history ν 1 h a := by + simpa only [Nat.mul_one] using count_dilate allocation history ν m 1 h a + +theorem source_population_pos (allocation : Allocation) (ν : ∀ h, A h → ℚ) + {m : ℕ} (hm : 0 < m) (h : History K) (hh : 0 < amount allocation h) : + 0 < population allocation (dilation ν m) h := + (AllFieldPopulationCounts.count_pos_iff (amount allocation) + (amount_nonneg allocation) (dilation_pos ν hm) h).2 hh + +theorem sum_count_pos (allocation : Allocation) (history : H → History K) + (ν : ∀ h, A h → ℚ) (hν : ∀ h a, 0 ≤ ν h a) + (htotal : ∀ h, ∑ a, ν h a = 1) {m : ℕ} (hm : 0 < m) + (h : H) (hh : 0 < amount allocation (history h)) : + 0 < ∑ a, count allocation history ν m h a := by + rw [sum_count allocation history ν hν htotal] + exact source_population_pos allocation ν hm (history h) hh + +theorem count_positive_law_positive (allocation : Allocation) (history : H → History K) + (ν : ∀ h, A h → ℚ) (hν : ∀ h a, 0 ≤ ν h a) + (m : ℕ) (h : H) (a : A h) (ha : 0 < count allocation history ν m h a) : + 0 < ν h a := by + have hb : 0 < AllFieldPopulationCounts.baseCount (law ν) ⟨h, a⟩ := + Nat.pos_of_mul_pos_left ha + have hbq : (0 : ℚ) < AllFieldPopulationCounts.baseCount (law ν) ⟨h, a⟩ := by + exact_mod_cast hb + rw [baseCount_cast ν hν] at hbq + have hD : (0 : ℚ) < denominator ν := by exact_mod_cast denominator_pos ν + exact (mul_pos_iff_of_pos_left hD).mp hbq + +theorem count_pos_iff (allocation : Allocation) (history : H → History K) + (ν : ∀ h, A h → ℚ) (hν : ∀ h a, 0 ≤ ν h a) + {m : ℕ} (hm : 0 < m) (h : H) (hh : 0 < amount allocation (history h)) + (a : A h) : 0 < count allocation history ν m h a ↔ 0 < ν h a := by + constructor + · exact count_positive_law_positive allocation history ν hν m h a + · intro ha + apply Nat.mul_pos + · exact (AllFieldPopulationCounts.count_pos_iff (amount allocation) + (amount_nonneg allocation) hm (history h)).2 hh + · have hb := (AllFieldPopulationCounts.count_pos_iff (law ν) + (fun x => hν x.1 x.2) (m := 1) (by decide) ⟨h, a⟩).2 ha + simpa only [AllFieldPopulationCounts.count, one_mul] using hb + +theorem count_eq_zero_of_law_eq_zero (allocation : Allocation) (history : H → History K) + (ν : ∀ h, A h → ℚ) (hν : ∀ h a, 0 ≤ ν h a) + (m : ℕ) (h : H) (a : A h) (ha : ν h a = 0) : + count allocation history ν m h a = 0 := by + apply Nat.cast_injective (R := ℚ) + simp only [count_cast allocation history ν hν, ha, mul_zero, Nat.cast_zero] + +theorem count_ratio (allocation : Allocation) (history : H → History K) + (ν : ∀ h, A h → ℚ) (hν : ∀ h a, 0 ≤ ν h a) + (htotal : ∀ h, ∑ a, ν h a = 1) {m : ℕ} (hm : 0 < m) + (h : H) (hh : 0 < amount allocation (history h)) (a : A h) : + (count allocation history ν m h a : ℚ) / + (∑ b, count allocation history ν m h b : ℕ) = ν h a := by + rw [sum_count allocation history ν hν htotal, count_cast allocation history ν hν, + population_cast] + have hp : (populationLength (K := K) allocation (dilation ν m) : ℚ) * + amount allocation (history h) ≠ 0 := by + rw [← population_cast] + exact_mod_cast (Nat.ne_of_gt (source_population_pos allocation ν hm (history h) hh)) + exact mul_div_cancel_left₀ _ hp + +theorem count_ratio_real (allocation : Allocation) (history : H → History K) + (ν : ∀ h, A h → ℚ) (hν : ∀ h a, 0 ≤ ν h a) + (htotal : ∀ h, ∑ a, ν h a = 1) {m : ℕ} (hm : 0 < m) + (h : H) (hh : 0 < amount allocation (history h)) (a : A h) : + (count allocation history ν m h a : ℝ) / + (∑ b, count allocation history ν m h b : ℕ) = (ν h a : ℝ) := by + have hq := congrArg (fun q : ℚ => (q : ℝ)) + (count_ratio allocation history ν hν htotal hm h hh a) + simpa only [Rat.cast_div, Rat.cast_natCast] using hq + +theorem normalizedCountLaw_mass (allocation : Allocation) (history : H → History K) + (ν : ∀ h, A h → ℚ) (hν : ∀ h a, 0 ≤ ν h a) + (htotal : ∀ h, ∑ a, ν h a = 1) {m : ℕ} (hm : 0 < m) + (h : H) (hh : 0 < amount allocation (history h)) (a : A h) : + (ConditionalLabels.normalizedCountLaw (count allocation history ν m h) + (sum_count_pos allocation history ν hν htotal hm h hh)).mass a = (ν h a : ℝ) := + count_ratio_real allocation history ν hν htotal hm h hh a + +theorem normalizedCountLaw_mass_eq (allocation : Allocation) (history : H → History K) + (ν : ∀ h, A h → ℚ) (hν : ∀ h a, 0 ≤ ν h a) + (htotal : ∀ h, ∑ a, ν h a = 1) {m : ℕ} (hm : 0 < m) + (h : H) (hh : 0 < amount allocation (history h)) : + (ConditionalLabels.normalizedCountLaw (count allocation history ν m h) + (sum_count_pos allocation history ν hν htotal hm h hh)).mass = + fun a => (ν h a : ℝ) := + funext (normalizedCountLaw_mass allocation history ν hν htotal hm h hh) + +end MatrixMultiplication.AllFieldTerminalPopulations + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldConstruction/TerminalRateFormulas.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldConstruction/TerminalRateFormulas.lean new file mode 100644 index 0000000000000000000000000000000000000000..2b4e543126e3f212445924e79c94645ff8d3b7a6 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldConstruction/TerminalRateFormulas.lean @@ -0,0 +1,132 @@ +import OAI.LinearAlgebra.MatrixMultiplication.FieldHistory.Sums +import OAI.LinearAlgebra.MatrixMultiplication.FieldConstruction.ZeroLeafRateFormula +import OAI.LinearAlgebra.MatrixMultiplication.FieldParameters.Contractions + +namespace OAI + +/-! Tensor extraction over arbitrary fields and its asymptotic rate. -/ + +noncomputable section + +namespace MatrixMultiplication.AllFieldTerminalRates + +open AllFieldParameters AllFieldHistory +open scoped BigOperators +attribute [local instance] Classical.propDecidable Classical.decEq + +def initialRate (g : Shape) : ℝ := + Real.log (Contractions.coefficients[shapeMax g]?.getD 0 : ℝ) + +def S0 : ℝ := + ((sortedInitial.filter (fun g => !positive g)).map + (fun g => (initialLaw g : ℝ) * initialRate g)).sum + +def S1 : ℝ := + (zeroSecond.map (fun t => (secondMass t : ℝ) * AllFieldZeroLeafRates.fourRate t)).sum + +def secondLeafRate (t u : Shape) : ℝ := + if shapeMax u = 4 then 0 + else if shapeMax u = 3 then Real.log 10 + else if !positive u then + binaryEntropyRate (binaryParameter t u) + + 2 * (1 - (binaryParameter t u : ℝ)) * Real.log 5 + else (2 - (binaryParameter t u : ℝ)) * Real.log 5 + +def S2 : ℝ := + (positiveSecond.map (fun t => + ((below t).map (fun u => (littleMass t u : ℝ) * secondLeafRate t u)).sum)).sum + +def S : ℝ := (S0 + S1) + S2 + +private theorem four_shape_max_lt_five : ∀ u ∈ shapes 4, shapeMax u < 5 := by + decide +kernel + +private theorem four_zero_max : ∀ u ∈ shapes 4, positive u = false → + shapeMax u = 2 ∨ shapeMax u = 3 ∨ shapeMax u = 4 := by + decide +kernel + +private theorem four_positive_max : ∀ u ∈ shapes 4, positive u = true → + shapeMax u = 2 := by + decide +kernel + +theorem second_shapeMax_lt_five (t : Shape) (ht : t ∈ positiveSecond) + (u : Shape) (hu : u ∈ below t) : shapeMax u < 5 := + four_shape_max_lt_five u (stageB_children_size t ht u hu) + +theorem secondLeafRate_zero (t : Shape) (ht : t ∈ positiveSecond) + (u : Shape) (hu : u ∈ below t) (hz : positive u = false) : + secondLeafRate t u = statisticRate (binaryParameter t u) + ⟨shapeMax u, second_shapeMax_lt_five t ht u hu⟩ := by + rcases four_zero_max u (stageB_children_size t ht u hu) hz with h2 | h3 | h4 + · have hk : (⟨shapeMax u, second_shapeMax_lt_five t ht u hu⟩ : Fin 5) = 2 := + Fin.ext h2 + rw [hk, statisticRate_two] + simp [secondLeafRate, h2, hz] + · have hk : (⟨shapeMax u, second_shapeMax_lt_five t ht u hu⟩ : Fin 5) = 3 := + Fin.ext h3 + rw [hk, statisticRate_three] + simp [secondLeafRate, h3] + · have hk : (⟨shapeMax u, second_shapeMax_lt_five t ht u hu⟩ : Fin 5) = 4 := + Fin.ext h4 + rw [hk, statisticRate_four] + simp [secondLeafRate, h4] + +theorem secondLeafRate_positive (t : Shape) (ht : t ∈ positiveSecond) + (u : Shape) (hu : u ∈ below t) (hp : positive u = true) : + secondLeafRate t u = (2 - (binaryParameter t u : ℝ)) * Real.log 5 := by + have hm := four_positive_max u (stageB_children_size t ht u hu) hp + simp [secondLeafRate, hm, hp] + +theorem secondLeafRate_builder_expression (t u : Shape) : + secondLeafRate t u = + if shapeMax u = 4 then 0 + else if shapeMax u = 3 then Real.log 10 + else if !positive u then + (MatrixMultiplication.Foundation.entropyTerm (1 - (binaryParameter t u : ℝ)) + + MatrixMultiplication.Foundation.entropyTerm (binaryParameter t u : ℝ) + + (binaryParameter t u : ℝ) * Real.log 2) + + ((1 - (binaryParameter t u : ℝ)) * 2) * Real.log 5 + else (2 - (binaryParameter t u : ℝ)) * Real.log 5 := by + unfold secondLeafRate + split_ifs <;> try rfl + unfold binaryEntropyRate + ring + +private theorem list_filter_sum {A : Type*} (xs : List A) (p : A → Bool) + (f : A → ℝ) : + ((xs.filter p).map f).sum = (xs.map (fun a => if p a then f a else 0)).sum := by + induction xs with + | nil => simp + | cons a xs ih => cases hp : p a <;> simp [hp, ih] + +theorem initial_zero_history_rate (K : ℕ) : + (∑ h : {h : Initial K // initialShape h ∉ positiveInitial}, + (initialAmount h.val : ℝ) * initialRate (initialShape h.val)) = (K : ℝ) * S0 := by + calc + _ = ∑ h : Initial K, if initialShape h ∉ positiveInitial then + (initialAmount h : ℝ) * initialRate (initialShape h) else 0 := by + rw [← Finset.sum_filter] + exact (Finset.sum_subtype + (p := fun h : Initial K => initialShape h ∉ positiveInitial) + (Finset.univ.filter (fun h : Initial K => initialShape h ∉ positiveInitial)) + (by simp) + (fun h : Initial K => (initialAmount h : ℝ) * initialRate (initialShape h))).symm + _ = ∑ h : Initial K, (initialAmount h : ℝ) * + (if initialShape h ∉ positiveInitial then initialRate (initialShape h) else 0) := by + apply Finset.sum_congr rfl + intro h _ + split_ifs <;> simp + _ = _ := by + rw [initial_history_sum K + (fun g => if g ∉ positiveInitial then initialRate g else 0), S0, list_filter_sum] + apply congrArg (fun x : ℝ => (K : ℝ) * x) + apply congrArg List.sum + apply List.map_congr_left + intro g hg + cases hp : positive g <;> simp [positiveInitial, hg, hp] + +end MatrixMultiplication.AllFieldTerminalRates + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldConstruction/TerminalRates.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldConstruction/TerminalRates.lean new file mode 100644 index 0000000000000000000000000000000000000000..5163c705510a669e1d9ca184dec48f5238f9bce2 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldConstruction/TerminalRates.lean @@ -0,0 +1,287 @@ +import OAI.LinearAlgebra.MatrixMultiplication.FieldConstruction.TerminalPopulations +import OAI.LinearAlgebra.MatrixMultiplication.FieldConstruction.TerminalStatisticLaws +import OAI.LinearAlgebra.MatrixMultiplication.FieldConstruction.ZeroLeafRates +import OAI.LinearAlgebra.MatrixMultiplication.FieldConstruction.ZeroHistorySums +import OAI.LinearAlgebra.MatrixMultiplication.FieldConstruction.InitialLeafRates + +namespace OAI + +/-! Tensor extraction over arbitrary fields and its asymptotic rate. -/ + +noncomputable section + +namespace MatrixMultiplication.AllFieldTerminalRates + +open AllFieldHistory AllFieldParameters AllFieldTerminalStatisticLaws +open AllFieldZeroLeafRates AllFieldZeroHistorySums Filter +open scoped BigOperators Topology +attribute [local instance] Classical.propDecidable + +variable {K : ℕ} + +def statisticCounts (allocation : Allocation) (h : TerminalZero K) : Slot h → ℕ := + AllFieldTerminalPopulations.count allocation history law 1 h + +def terminalDilation (K : ℕ) (m : ℕ) : ℕ := + AllFieldTerminalPopulations.dilation (law (K := K)) m + +def terminalLength (allocation : Allocation) (K : ℕ) (m : ℕ) : ℕ := + populationLength (K := K) allocation (terminalDilation K m) + +theorem terminalDilation_pos {m : ℕ} (hm : 0 < m) : + 0 < terminalDilation K m := + AllFieldTerminalPopulations.dilation_pos law hm + +theorem terminalLength_pos (allocation : Allocation) {m : ℕ} (hm : 0 < m) : + 0 < terminalLength allocation K m := + AllFieldPopulationCounts.blockLength_pos _ (terminalDilation_pos hm) + +theorem terminalLength_mul_one (allocation : Allocation) (m : ℕ) : + terminalLength allocation K m = m * terminalLength allocation K 1 := by + simp only [terminalLength, terminalDilation, AllFieldTerminalPopulations.dilation, + populationLength, AllFieldPopulationCounts.blockLength, one_mul, mul_assoc] + +theorem statisticCounts_pos (allocation : Allocation) (h : TerminalZero K) : + 0 < ∑ s, statisticCounts allocation h s := + AllFieldTerminalPopulations.sum_count_pos allocation history law law_nonneg law_total + (by decide) h (history_amount_pos allocation h) + +theorem statisticCounts_ratio (allocation : Allocation) (h : TerminalZero K) (s : Slot h) : + (statisticCounts allocation h s : ℝ) / + (∑ s, statisticCounts allocation h s : ℕ) = (law h s : ℝ) := + AllFieldTerminalPopulations.count_ratio_real allocation history law law_nonneg law_total + (by decide) h (history_amount_pos allocation h) s + +theorem statisticCounts_sum (allocation : Allocation) (h : TerminalZero K) : + (∑ s, statisticCounts allocation h s) = + population allocation (terminalDilation K 1) (history h) := + AllFieldTerminalPopulations.sum_count allocation history law law_nonneg law_total 1 h + +theorem statisticCounts_repeat (allocation : Allocation) (m : ℕ) + (h : TerminalZero K) (s : Slot h) : + m * statisticCounts allocation h s = + AllFieldTerminalPopulations.count allocation history law m h s := + (AllFieldTerminalPopulations.count_mul_one allocation history law m h s).symm + +theorem statisticCounts_repeat_sum (allocation : Allocation) (m : ℕ) + (h : TerminalZero K) : + (∑ s, m * statisticCounts allocation h s) = + population allocation (terminalDilation K m) (history h) := by + simp only [statisticCounts_repeat] + exact AllFieldTerminalPopulations.sum_count allocation history law law_nonneg law_total m h + +theorem statisticCounts_sum_cast (allocation : Allocation) (h : TerminalZero K) : + ((∑ s, statisticCounts allocation h s : ℕ) : ℝ) = + (terminalLength allocation K 1 : ℝ) * (amount allocation (history h) : ℝ) := by + rw [statisticCounts_sum] + exact_mod_cast population_cast allocation (terminalDilation K 1) (history h) + +def ZeroWords (allocation : Allocation) (m : ℕ) : TerminalZero K → Type + | .inl h => fourWords (aShape h.1.val) (statisticCounts allocation (.inl h)) m + | .inr h => twoWords (bWeight h) (statisticCounts allocation (.inr h)) m + +local instance twoWordsFintype_inr (allocation : Allocation) (m : ℕ) (h : BZero K) : + Fintype (twoWords (bWeight h) (statisticCounts allocation (.inr h)) m) := + twoWordsFintype (bWeight h) (statisticCounts allocation (.inr h)) m + +instance zeroWordsFintype (allocation : Allocation) (m : ℕ) (h : TerminalZero K) : + Fintype (ZeroWords allocation m h) := by + cases h <;> dsimp [ZeroWords] <;> infer_instance + +theorem zeroWords_card_inl (allocation : Allocation) (m : ℕ) (h : AZero K) : + Fintype.card (ZeroWords allocation m (.inl h)) = + Fintype.card (fourWords (aShape h.1.val) (statisticCounts allocation (.inl h)) m) := by + apply Fintype.card_congr + exact Equiv.refl _ + +theorem zeroWords_card_inr (allocation : Allocation) (m : ℕ) (h : BZero K) : + Fintype.card (ZeroWords allocation m (.inr h)) = + Fintype.card (twoWords (bWeight h) (statisticCounts allocation (.inr h)) m) := by + apply Fintype.card_congr + exact Equiv.refl _ + +theorem zeroWords_card_pos (allocation : Allocation) (m : ℕ) (h : TerminalZero K) : + 0 < Fintype.card (ZeroWords allocation m h) := by + cases h with + | inl h => + rw [zeroWords_card_inl] + exact four_card_pos (aShape h.1.val) (statisticCounts allocation (.inl h)) + (statisticCounts_pos allocation (.inl h)) + (statisticCounts_ratio allocation (.inl h)) m + | inr h => + rw [zeroWords_card_inr] + have ht := two_card_pos (binaryParameter (bParent h) (bShape h.1.val)) + (bWeight h) (statisticCounts allocation (.inr h)) + (statisticCounts_pos allocation (.inr h)) + (statisticCounts_ratio allocation (.inr h)) m + simpa only [Fintype.card_eq_nat_card] using ht + +theorem tendsto_zeroWords_local (allocation : Allocation) (h : TerminalZero K) : + Tendsto (fun m : ℕ => Real.log (Fintype.card (ZeroWords allocation m h) : ℝ) / + ((m : ℝ) * (∑ s, statisticCounts allocation h s : ℕ))) atTop + (𝓝 (zeroRate h)) := by + cases h with + | inl h => + have ht := four_tendsto_log_card (aShape h.1.val) (statisticCounts allocation (.inl h)) + (statisticCounts_pos allocation (.inl h)) + (statisticCounts_ratio allocation (.inl h)) + simp only [Fintype.card_eq_nat_card] at ht ⊢ + apply ht.congr + intro m + apply congrArg₂ (fun n d : ℕ => Real.log (n : ℝ) / ((m : ℝ) * (d : ℝ))) + · apply Nat.card_congr + exact Equiv.refl _ + · apply Fintype.sum_equiv (Equiv.refl _) + intro s + rfl + | inr h => + have ht := two_tendsto_log_card (binaryParameter (bParent h) (bShape h.1.val)) + (bWeight h) (statisticCounts allocation (.inr h)) + (statisticCounts_pos allocation (.inr h)) + (statisticCounts_ratio allocation (.inr h)) + simp only [Fintype.card_eq_nat_card] at ht ⊢ + apply ht.congr + intro m + apply congrArg₂ (fun n d : ℕ => Real.log (n : ℝ) / ((m : ℝ) * (d : ℝ))) + · apply Nat.card_congr + exact Equiv.refl _ + · apply Fintype.sum_equiv (Equiv.refl _) + intro s + rfl + +theorem tendsto_zeroWords (hK : 0 < K) (allocation : Allocation) (h : TerminalZero K) : + Tendsto (fun m : ℕ => Real.log (Fintype.card (ZeroWords allocation m h) : ℝ) / + ((K : ℝ) * terminalLength allocation K m)) atTop + (𝓝 ((amount allocation (history h) : ℝ) * zeroRate h / K)) := by + have ht := (tendsto_zeroWords_local allocation h).mul_const + ((amount allocation (history h) : ℝ) / K) + have hr : zeroRate h * ((amount allocation (history h) : ℝ) / K) = + (amount allocation (history h) : ℝ) * zeroRate h / K := by ring + rw [hr] at ht + apply ht.congr' + filter_upwards [eventually_gt_atTop (0 : ℕ)] with m hm + have hm' : (m : ℝ) ≠ 0 := by exact_mod_cast Nat.ne_of_gt hm + have hk' : (K : ℝ) ≠ 0 := by exact_mod_cast Nat.ne_of_gt hK + have hn' : (terminalLength allocation K 1 : ℝ) ≠ 0 := by + exact_mod_cast Nat.ne_of_gt (terminalLength_pos allocation (K := K) (m := 1) (by decide)) + have ha' : (amount allocation (history h) : ℝ) ≠ 0 := by + exact_mod_cast ne_of_gt (history_amount_pos allocation h) + rw [terminalLength_mul_one, Nat.cast_mul, statisticCounts_sum_cast] + field_simp [hm', hk', hn', ha'] + +def zeroVolume (allocation : Allocation) (m : ℕ) : ℕ := + Fintype.card (∀ h : TerminalZero K, ZeroWords allocation m h) + +theorem zeroVolume_pos (allocation : Allocation) (m : ℕ) : + 0 < zeroVolume (K := K) allocation m := by + simp only [zeroVolume, Fintype.card_pi] + exact Finset.prod_pos fun h _ => zeroWords_card_pos allocation m h + +theorem log_zeroVolume (allocation : Allocation) (m : ℕ) : + Real.log (zeroVolume (K := K) allocation m : ℝ) = + ∑ h : TerminalZero K, Real.log (Fintype.card (ZeroWords allocation m h) : ℝ) := by + rw [zeroVolume, Fintype.card_pi, Nat.cast_prod] + exact Real.log_prod (s := Finset.univ) + (f := fun h : TerminalZero K => (Fintype.card (ZeroWords allocation m h) : ℝ)) (fun h _ => by + exact_mod_cast Nat.ne_of_gt (zeroWords_card_pos allocation m h)) + +theorem tendsto_zeroVolume (hK : 0 < K) (allocation : Allocation) : + Tendsto (fun m : ℕ => Real.log (zeroVolume (K := K) allocation m : ℝ) / + ((K : ℝ) * terminalLength allocation K m)) atTop + (𝓝 (S1 + S2 - AllFieldStageCTerminalRates.interiorS2)) := by + have ht := tendsto_finsetSum Finset.univ + (fun h _ => tendsto_zeroWords hK allocation h) + have hr : (∑ h : TerminalZero K, (amount allocation (history h) : ℝ) * zeroRate h / K) = + S1 + S2 - AllFieldStageCTerminalRates.interiorS2 := by + rw [← Finset.sum_div, zero_history_sum K allocation] + exact mul_div_cancel_left₀ _ (by exact_mod_cast Nat.ne_of_gt hK) + rw [hr] at ht + convert ht using 1 + ext m + rw [log_zeroVolume, Finset.sum_div] + +def terminalVolume (allocation : Allocation) (m : ℕ) : ℕ := + AllFieldInitialLeafRates.volume (K := K) allocation (terminalDilation K m) * + zeroVolume (K := K) allocation m * + CWStageCProducts.populationVolume (K := K) allocation (terminalDilation K m) + +theorem stageCVolume_pos (allocation : Allocation) (dilation : ℕ) : + 0 < CWStageCProducts.populationVolume (K := K) allocation dilation := by + unfold CWStageCProducts.populationVolume + rw [CWStageCProducts.historyVolume_eq_prod] + exact Finset.prod_pos fun h _ => CWStageCProducts.volume_pos _ _ + +theorem terminalVolume_pos (allocation : Allocation) (m : ℕ) : + 0 < terminalVolume (K := K) allocation m := by + exact Nat.mul_pos + (Nat.mul_pos (AllFieldInitialLeafRates.volume_pos allocation _) + (zeroVolume_pos allocation m)) (stageCVolume_pos allocation _) + +theorem log_terminalVolume (allocation : Allocation) (m : ℕ) : + Real.log (terminalVolume (K := K) allocation m : ℝ) = + Real.log (AllFieldInitialLeafRates.volume (K := K) allocation + (terminalDilation K m) : ℝ) + + Real.log (zeroVolume (K := K) allocation m : ℝ) + + Real.log (CWStageCProducts.populationVolume (K := K) allocation + (terminalDilation K m) : ℝ) := by + have hI : (AllFieldInitialLeafRates.volume (K := K) allocation + (terminalDilation K m) : ℝ) ≠ 0 := by + exact_mod_cast Nat.ne_of_gt (AllFieldInitialLeafRates.volume_pos allocation _) + have hZ : (zeroVolume (K := K) allocation m : ℝ) ≠ 0 := by + exact_mod_cast Nat.ne_of_gt (zeroVolume_pos allocation m) + have hC : (CWStageCProducts.populationVolume (K := K) allocation + (terminalDilation K m) : ℝ) ≠ 0 := by + exact_mod_cast Nat.ne_of_gt (stageCVolume_pos allocation _) + simp only [terminalVolume, Nat.cast_mul, Real.log_mul (mul_ne_zero hI hZ) hC, + Real.log_mul hI hZ] + +theorem normalized_log_initialVolume (hK : 0 < K) (allocation : Allocation) + {m : ℕ} (hm : 0 < m) : + Real.log (AllFieldInitialLeafRates.volume (K := K) allocation + (terminalDilation K m) : ℝ) / ((K : ℝ) * terminalLength allocation K m) = S0 := by + rw [AllFieldInitialLeafRates.log_volume_eq_S0] + change (terminalLength allocation K m : ℝ) * ((K : ℝ) * S0) / + ((K : ℝ) * terminalLength allocation K m) = S0 + have hk : (K : ℝ) ≠ 0 := by exact_mod_cast Nat.ne_of_gt hK + have hn : (terminalLength allocation K m : ℝ) ≠ 0 := by + exact_mod_cast Nat.ne_of_gt (terminalLength_pos allocation hm) + field_simp [hk, hn] + +theorem normalized_log_stageCVolume (hK : 0 < K) (allocation : Allocation) + {m : ℕ} (hm : 0 < m) : + Real.log (CWStageCProducts.populationVolume (K := K) allocation + (terminalDilation K m) : ℝ) / ((K : ℝ) * terminalLength allocation K m) = + AllFieldStageCTerminalRates.interiorS2 := + AllFieldStageCTerminalRates.normalized_log_populationVolume_eq_interior + hK allocation _ (terminalDilation_pos hm) + +theorem tendsto_terminalVolume (hK : 0 < K) (allocation : Allocation) : + Tendsto (fun m : ℕ => Real.log (terminalVolume (K := K) allocation m : ℝ) / + ((K : ℝ) * terminalLength allocation K m)) atTop (𝓝 S) := by + have hI : Tendsto (fun m : ℕ => + Real.log (AllFieldInitialLeafRates.volume (K := K) allocation + (terminalDilation K m) : ℝ) / ((K : ℝ) * terminalLength allocation K m)) + atTop (𝓝 S0) := by + apply tendsto_const_nhds.congr' + filter_upwards [eventually_gt_atTop (0 : ℕ)] with m hm + exact (normalized_log_initialVolume hK allocation hm).symm + have hC : Tendsto (fun m : ℕ => + Real.log (CWStageCProducts.populationVolume (K := K) allocation + (terminalDilation K m) : ℝ) / ((K : ℝ) * terminalLength allocation K m)) + atTop (𝓝 AllFieldStageCTerminalRates.interiorS2) := by + apply tendsto_const_nhds.congr' + filter_upwards [eventually_gt_atTop (0 : ℕ)] with m hm + exact (normalized_log_stageCVolume hK allocation hm).symm + have ht := (hI.add (tendsto_zeroVolume hK allocation)).add hC + have hr : S0 + (S1 + S2 - AllFieldStageCTerminalRates.interiorS2) + + AllFieldStageCTerminalRates.interiorS2 = S := by unfold S; ring + rw [hr] at ht + convert ht using 1 + ext m + rw [log_terminalVolume, add_div, add_div] + +end MatrixMultiplication.AllFieldTerminalRates + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldConstruction/TerminalStatisticLaws.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldConstruction/TerminalStatisticLaws.lean new file mode 100644 index 0000000000000000000000000000000000000000..e15f63802eb049df9f952ff7ecdbe1376d589601 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldConstruction/TerminalStatisticLaws.lean @@ -0,0 +1,120 @@ +import OAI.LinearAlgebra.MatrixMultiplication.FieldHistory.Populations +import OAI.LinearAlgebra.MatrixMultiplication.FieldParameters.HalfLaws + +namespace OAI + +/-! Tensor extraction over arbitrary fields and its asymptotic rate. -/ + +noncomputable section + +namespace MatrixMultiplication.AllFieldTerminalStatisticLaws + +open AllFieldParameters AllFieldHistory +open scoped BigOperators +attribute [local instance] Classical.propDecidable Classical.decEq + +abbrev AZero (K : ℕ) := + {h : AfterA K // aShape h ∉ positiveSecond} × Placement + +abbrev BZero (K : ℕ) := + {h : AfterB K // positive (bShape h) ≠ true} × Placement + +abbrev TerminalZero (K : ℕ) := AZero K ⊕ BZero K + +variable {K : ℕ} + +theorem aShape_mem_shapes (h : AZero K) : aShape h.1.val ∈ shapes 8 := + aShape_size h.1.val + +theorem aShape_not_positive (h : AZero K) : positive (aShape h.1.val) ≠ true := by + intro hp + exact h.1.property (List.mem_filter.mpr ⟨aShape_mem_shapes h, hp⟩) + +theorem aShape_mem_zeroSecond (h : AZero K) : aShape h.1.val ∈ zeroSecond := by + simp [zeroSecond, aShape_mem_shapes h, aShape_not_positive h] + +def bParent (h : BZero K) : Shape := aShape h.1.val.1.val + +theorem bParent_mem_positiveSecond (h : BZero K) : bParent h ∈ positiveSecond := + h.1.val.1.property + +theorem bShape_mem_shapes (h : BZero K) : bShape h.1.val ∈ shapes 4 := + bShape_size h.1.val + +theorem bShape_mem_below (h : BZero K) : bShape h.1.val ∈ below (bParent h) := + bShape_mem h.1.val + +theorem bShape_max_lt_five (h : BZero K) : shapeMax (bShape h.1.val) < 5 := by + have hb := child_statistic_weight_bounded (bParent h) + (bParent_mem_positiveSecond h) (bShape h.1.val) (bShape_mem_below h) + exact max_lt_iff.mpr ⟨hb 0, max_lt_iff.mpr ⟨hb 1, hb 2⟩⟩ + +def bWeight (h : BZero K) : Fin 5 := + ⟨shapeMax (bShape h.1.val), bShape_max_lt_five h⟩ + +@[simp] theorem bWeight_val (h : BZero K) : (bWeight h).val = shapeMax (bShape h.1.val) := + rfl + +def Slot : TerminalZero K → Type + | .inl _ => PairSlot + | .inr _ => Fin 6 + +instance (h : TerminalZero K) : Fintype (Slot h) := by + cases h <;> dsimp [Slot] <;> infer_instance + +def history : TerminalZero K → History K + | .inl h => (.afterA h.1.val, h.2) + | .inr h => (.afterB h.1.val, h.2) + +@[simp] theorem history_inl (h : AZero K) : + history (.inl h) = (.afterA h.1.val, h.2) := rfl + +@[simp] theorem history_inr (h : BZero K) : + history (.inr h) = (.afterB h.1.val, h.2) := rfl + +def law : (h : TerminalZero K) → Slot h → ℚ + | .inl h, s => zeroPairLaw (aShape h.1.val) s.1 s.2 + | .inr h, s => statisticLaw (binaryParameter (bParent h) (bShape h.1.val)) (bWeight h) s + +@[simp] theorem law_inl (h : AZero K) (s : PairSlot) : + law (.inl h) s = zeroPairLaw (aShape h.1.val) s.1 s.2 := rfl + +@[simp] theorem law_inr (h : BZero K) (s : Fin 6) : + law (.inr h) s = + statisticLaw (binaryParameter (bParent h) (bShape h.1.val)) (bWeight h) s := rfl + +theorem statisticLaw_nonnegative (t u : Shape) (k : Fin 5) (s : Fin 6) : + 0 ≤ statisticLaw (binaryParameter t u) k s := by + obtain ⟨hl, hh⟩ := binaryParameter_bounds t u + unfold statisticLaw + split_ifs <;> linarith + +theorem statisticLaw_total (d : ℚ) (k : Fin 5) : + ∑ s : Fin 6, statisticLaw d k s = 1 := by + fin_cases k <;> simp [statisticLaw, Fin.sum_univ_succ, singletonSlot] + +theorem law_nonneg (h : TerminalZero K) (s : Slot h) : 0 ≤ law h s := by + cases h with + | inl h => exact zeroPairLaw_nonnegative (aShape h.1.val) s.1 s.2 + | inr h => exact statisticLaw_nonnegative (bParent h) (bShape h.1.val) (bWeight h) s + +theorem law_total (h : TerminalZero K) : ∑ s : Slot h, law h s = 1 := by + cases h with + | inl h => exact zeroPairLaw_full_normalized (aShape h.1.val) (aShape_mem_zeroSecond h) + | inr h => exact statisticLaw_total _ (bWeight h) + +theorem history_amount_pos (allocation : Allocation) (h : TerminalZero K) : + 0 < amount allocation (history h) := by + cases h with + | inl h => + change 0 < aAmount h.1.val / 6 + exact div_pos (aAmount_pos h.1.val) (by norm_num) + | inr h => + change 0 < bAmount h.1.val / 6 + exact div_pos (bAmount_pos h.1.val) (by norm_num) + +end MatrixMultiplication.AllFieldTerminalStatisticLaws + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldConstruction/Witness.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldConstruction/Witness.lean new file mode 100644 index 0000000000000000000000000000000000000000..4644e9deebdb73765fd8df02dfd00e0649cb6a60 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldConstruction/Witness.lean @@ -0,0 +1,61 @@ +import OAI.LinearAlgebra.MatrixMultiplication.Rectangular.ASI + +namespace OAI + +/-! Tensor extraction over arbitrary fields and its asymptotic rate. -/ + +noncomputable section + +namespace MatrixMultiplication + +open MatrixMultiplication.Foundation + +structure AllFieldWitness (F : Type*) [Field F] where + rows : ℕ + inner : ℕ + columns : ℕ + multiplicity : ℕ + rankBound : ℕ + order : ℕ + degree : ℕ + rows_pos : 0 < rows + inner_pos : 0 < inner + columns_pos : 0 < columns + multiplicity_pos : 0 < multiplicity + rankBound_pos : 0 < rankBound + approximation : Tensor.PolynomialApproximation + (Tensor.directSum (fun _ : Fin multiplicity => + Tensor.matrixCoefficients (K := F) (Fin rows) (Fin inner) (Fin columns))) + rankBound order degree + +namespace AllFieldWitness + +variable {F : Type*} [Field F] + +def volume (W : AllFieldWitness F) : ℕ := W.rows * W.inner * W.columns + +theorem volume_pos (W : AllFieldWitness F) : 0 < W.volume := + Nat.mul_pos (Nat.mul_pos W.rows_pos W.inner_pos) W.columns_pos + +theorem finite_inequality (W : AllFieldWitness F) : + (W.multiplicity : ℝ) * (W.volume : ℝ) ^ (Arithmetic.omega F / 3) ≤ W.rankBound := + Arithmetic.equalVolume_inequality_of_polynomialApproximation + W.rows_pos W.inner_pos W.columns_pos W.approximation + +theorem log_inequality (W : AllFieldWitness F) : + Real.log (W.multiplicity : ℝ) + + (Arithmetic.omega F / 3) * Real.log (W.volume : ℝ) ≤ + Real.log (W.rankBound : ℝ) := by + have hm : (0 : ℝ) < W.multiplicity := Nat.cast_pos.mpr W.multiplicity_pos + have hv : (0 : ℝ) < W.volume := Nat.cast_pos.mpr W.volume_pos + have hp := Real.rpow_pos_of_pos hv (Arithmetic.omega F / 3) + have h := Real.log_le_log (mul_pos hm hp) W.finite_inequality + rw [Real.log_mul hm.ne' hp.ne', Real.log_rpow hv] at h + exact h + +end AllFieldWitness +end MatrixMultiplication + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldConstruction/ZeroFinish.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldConstruction/ZeroFinish.lean new file mode 100644 index 0000000000000000000000000000000000000000..45ef00798daa882a4e4037ed73cd345e484e1e9a --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldConstruction/ZeroFinish.lean @@ -0,0 +1,230 @@ +import OAI.LinearAlgebra.MatrixMultiplication.FieldConstruction.ZeroWords +import OAI.LinearAlgebra.MatrixMultiplication.FieldHistory.Tensors +import OAI.LinearAlgebra.MatrixMultiplication.FieldParameters.HalfComplement +import OAI.LinearAlgebra.MatrixMultiplication.CoppersmithWinograd.CWZeroGeometry + +namespace OAI + +/-! Tensor extraction over arbitrary fields and its asymptotic rate. -/ + +noncomputable section +namespace MatrixMultiplication.AllFieldZeroFinish +open MatrixMultiplication.Foundation AllFieldParameters AllFieldHistory +open AllFieldTerminalStatisticLaws AllFieldTerminalRates AllFieldZeroWords +open CWWindowedLeaves CWCompleteStatistics CWZeroGeometry CWOrientedZero +open AllFieldFiniteFamily InheritedMasks +open scoped BigOperators +attribute [local instance] Classical.propDecidable +variable {K : ℕ} + +def canonicalZero (h : TerminalZero K) : Fin 3 := zeroAxis (shape h) +def canonicalSelected : TerminalZero K → Fin 3 + | .inl h => halfMaxAxis (aShape h.1.val) + | .inr h => maxAxis (bShape h.1.val) +def physicalZero (h : TerminalZero K) : Fin 3 := (history h).2 (canonicalZero h) +def physicalSelected (h : TerminalZero K) : Fin 3 := (history h).2 (canonicalSelected h) + +theorem shape_has_zero (h : TerminalZero K) : ∃ s, shape h s = 0 := by + cases h with + | inl h => exact not_positive_has_zero _ (aShape_not_positive h) + | inr h => exact not_positive_has_zero _ h.1.property + +theorem canonicalZero_spec (h : TerminalZero K) : shape h (canonicalZero h) = 0 := + zeroAxis_spec (shape h) (shape_has_zero h) + +theorem canonicalSelected_spec (h : TerminalZero K) : + shape h (canonicalSelected h) = shapeMax (shape h) := by + cases h with + | inl h => exact halfMaxAxis_spec _ (aShape_mem_shapes h) + | inr h => exact maxAxis_spec _ + +theorem shape_total (h : TerminalZero K) : shapeTotal (shape h) = 2 * length h := + (currentShape_spec (history h).1).2 + +theorem shape_total_pos (h : TerminalZero K) : 0 < shapeTotal (shape h) := by + rw [shape_total] + cases h <;> norm_num [length, history, currentLength] + +theorem axes_distinct (h : TerminalZero K) : canonicalZero h ≠ canonicalSelected h := + zero_ne_selected (shape h) _ _ (shape_total_pos h) + (canonicalZero_spec h) (canonicalSelected_spec h) + +theorem physical_axes_distinct (h : TerminalZero K) : physicalZero h ≠ physicalSelected h := + (history h).2.injective.ne (axes_distinct h) + +theorem physical_shape (h : TerminalZero K) : + currentPhysicalShape (history h) = placedShape (physicalZero h) (physicalSelected h) + (shapeMax (shape h)) (shapeTotal (shape h) - shapeMax (shape h)) := + physicalShape_eq_placedShape (shape h) (history h).2 _ _ + (canonicalZero_spec h) (canonicalSelected_spec h) (axes_distinct h) + +def nativeLaw : (h : TerminalZero K) → Fin 3 → Slot h → ℚ + | .inl h, side => halfLaw (aShape h.1.val) side + | .inr h, side => littleLaw (bParent h) (bShape h.1.val) side + +theorem selected_law (h : TerminalZero K) (s : Slot h) : + nativeLaw h (canonicalSelected h) s = law h s := by + cases h with + | inl h => exact halfLaw_at_maximum _ (aShape_mem_zeroSecond h) s + | inr h => + change Fin 6 at s + change littleLaw (bParent h) (bShape h.1.val) (maxAxis (bShape h.1.val)) s = + statisticLaw (binaryParameter (bParent h) (bShape h.1.val)) (bWeight h) s + rw [littleLaw_eq_statisticLaw _ _ _ (child_statistic_weight_bounded _ + (bParent_mem_positiveSecond h) _ (bShape_mem_below h) _)] + congr 1 + apply Fin.ext + exact maxAxis_spec _ + +theorem zero_law (h : TerminalZero K) (s : Slot h) : + nativeLaw h (canonicalZero h) s = + if statistic h (zeroWord (length h)) = s then 1 else 0 := by + have hz := canonicalZero_spec h + cases h with + | inl h => + change PairSlot at s + change aShape h.1.val (canonicalZero (.inl h)) = 0 at hz + change halfLaw (aShape h.1.val) (canonicalZero (.inl h)) s = + @ite ℚ (((0,0) : PairSlot) = s) (Classical.propDecidable _) 1 0 + rw [halfLaw_weight_zero _ (aShape_mem_shapes h) _ hz s] + by_cases hs : s = (0,0) + · rw [ite_eq_left hs, ite_eq_left hs.symm] + · rw [ite_eq_right hs, ite_eq_right (Ne.symm hs)] + | inr h => + change Fin 6 at s + change bShape h.1.val (canonicalZero (.inr h)) = 0 at hz + change littleLaw (bParent h) (bShape h.1.val) (canonicalZero (.inr h)) s = + @ite ℚ ((0 : Fin 6) = s) (Classical.propDecidable _) 1 0 + simp only [littleLaw, hz, show (0 : ℕ) ≠ 2 from by decide, ite_false, singletonSlot] + by_cases hs : s = 0 + · simp [hs] + · simp [hs, Ne.symm hs] + +theorem remaining_law (h : TerminalZero K) (side : Fin 3) + (hz : side ≠ canonicalZero h) (hs : side ≠ canonicalSelected h) (s : Slot h) : + nativeLaw h side s = law h ((AllFieldZeroWords.complement h).symm s) := by + have hsum := selected_add_remaining (shape h) (canonicalZero h) (canonicalSelected h) side + (canonicalZero_spec h) (canonicalSelected_spec h) (axes_distinct h) hz hs + have he : nativeLaw h (canonicalSelected h) ((AllFieldZeroWords.complement h).symm s) = + nativeLaw h side s := by + cases h with + | inl h => + exact halfLaw_complementary_sides _ (aShape_mem_shapes h) _ _ (Ne.symm hs) + (hsum.trans (shape_total (.inl h))) s + | inr h => + exact littleLaw_complement _ _ _ _ + (child_statistic_weight_bounded _ (bParent_mem_positiveSecond h) _ (bShape_mem_below h) _) + (child_statistic_weight_bounded _ (bParent_mem_positiveSecond h) _ (bShape_mem_below h) _) + (hsum.trans (shape_total (.inr h))) s + rw [selected_law] at he + exact he.symm + +def embed (allocation : Allocation) (m : ℕ) (h : TerminalZero K) + (side : Fin 3) (w : ZeroWords allocation m h) : + HistoryWord allocation (terminalDilation K m) (history h) := + fun i => sideWord (physicalZero h) (physicalSelected h) side (words allocation m h w i) + +theorem embed_window (allocation : Allocation) {m : ℕ} (hm : 0 < m) + (h : TerminalZero K) (side : Fin 3) (η : ℝ) (hη : 0 ≤ η) + (w : ZeroWords allocation m h) : + typeWindow (fun s => (nativeLaw h ((history h).2.symm side) s : ℝ)) η + (fun i => statistic h (embed allocation m h side w i)) := by + by_cases hz : side = physicalZero h + · have hc : (history h).2.symm side = canonicalZero h := by + simp only [hz, physicalZero, Equiv.symm_apply_apply] + simp only [embed, sideWord, ite_eq_left hz, hc] + have hpop : 0 < population allocation (terminalDilation K m) (history h) := by + rw [← statisticCounts_repeat_sum allocation m h, ← Finset.mul_sum] + exact Nat.mul_pos hm (statisticCounts_pos allocation h) + apply zero_window (length h) _ hpop (statistic h) _ η hη + intro s + rw [zero_law] + split_ifs <;> norm_num + · by_cases hs : side = physicalSelected h + · have hc : (history h).2.symm side = canonicalSelected h := by + simp only [hs, physicalSelected, Equiv.symm_apply_apply] + simpa only [embed, sideWord, ite_eq_right hz, ite_eq_left hs, hc, selected_law] using + selected_window allocation hm h η hη w + · have hcz : (history h).2.symm side ≠ canonicalZero h := by + intro hh + apply hz + exact ((history h).2.apply_symm_apply side).symm.trans (congrArg (history h).2 hh) + have hcs : (history h).2.symm side ≠ canonicalSelected h := by + intro hh + apply hs + exact ((history h).2.apply_symm_apply side).symm.trans (congrArg (history h).2 hh) + have hlaw : (fun s => (nativeLaw h ((history h).2.symm side) s : ℝ)) = + (fun s => (law h s : ℝ)) ∘ (AllFieldZeroWords.complement h).symm := by + funext s + exact congrArg (fun q : ℚ => (q : ℝ)) (remaining_law h _ hcz hcs s) + have hword : (fun i => statistic h (embed allocation m h side w i)) = + (fun i => statistic h (complementWord (words allocation m h w i).val)) := by + funext i + simp only [embed, sideWord, ite_eq_right hz, ite_eq_right hs] + rfl + rw [hlaw, hword] + exact complementary_window allocation hm h η hη w + +theorem embed_mask (allocation : Allocation) {m : ℕ} (hm : 0 < m) + {ε : ℝ} (hε : 0 ≤ ε) (h : TerminalZero K) (side : Fin 3) + (w : ZeroWords allocation m h) : + residentMask allocation (terminalDilation K m) ε (history h) side + (embed allocation m h side w) := by + cases h with + | inl h => + intro _ + exact embed_window allocation hm (.inl h) side (ε/8) (by positivity) w + | inr h => + intro _ + exact embed_window allocation hm (.inr h) side (ε/128) (by positivity) w + +variable (F : Type*) [Field F] + +theorem coefficient (allocation : Allocation) {m : ℕ} (hm : 0 < m) + {ε : ℝ} (hε : 0 ≤ ε) (h : TerminalZero K) (x y z : ZeroWords allocation m h) : + historyTensor F allocation (terminalDilation K m) ε (history h) + (embed allocation m h 0 x) (embed allocation m h 1 y) (embed allocation m h 2 z) = + if matched (physicalZero h) x y z then 1 else 0 := by + simp only [historyTensor, ExactRecovery.delete, embed_mask allocation hm hε, + and_self, ite_true] + rw [physical_shape] + exact power_coefficient F (length h) _ _ _ + ((max_add_complement (shape h)).trans (shape_total h)) + (physicalZero h) (physicalSelected h) (physical_axes_distinct h) + (words allocation m h) (words_injective allocation m h) x y z + +abbrev Row (allocation : Allocation) (m : ℕ) (h : TerminalZero K) := + CWOrientedZero.Row (physicalZero h) (ZeroWords allocation m h) +abbrev Middle (allocation : Allocation) (m : ℕ) (h : TerminalZero K) := + CWOrientedZero.Middle (physicalZero h) (ZeroWords allocation m h) +abbrev Column (allocation : Allocation) (m : ℕ) (h : TerminalZero K) := + CWOrientedZero.Column (physicalZero h) (ZeroWords allocation m h) + +def localMap (allocation : Allocation) {m : ℕ} (hm : 0 < m) + {ε : ℝ} (hε : 0 ≤ ε) (h : TerminalZero K) : + LocalMap (historyTensor F allocation (terminalDilation K m) ε (history h)) + (Tensor.matrixCoefficients (Row allocation m h) (Middle allocation m h) (Column allocation m h)) := by + letI : Nonempty (ZeroWords allocation m h) := + Fintype.card_pos_iff.mp (zeroWords_card_pos allocation m h) + exact ofMatching F _ (physicalZero h) (embed allocation m h) + (coefficient F allocation hm hε h) + +theorem volume (allocation : Allocation) (m : ℕ) (h : TerminalZero K) : + Fintype.card (Row allocation m h) * Fintype.card (Middle allocation m h) * + Fintype.card (Column allocation m h) = Fintype.card (ZeroWords allocation m h) := + CWOrientedZero.volume (physicalZero h) (ZeroWords allocation m h) + +theorem dimensions_pos (allocation : Allocation) (m : ℕ) (h : TerminalZero K) : + 0 < Fintype.card (Row allocation m h) ∧ + 0 < Fintype.card (Middle allocation m h) ∧ 0 < Fintype.card (Column allocation m h) := by + have hp := zeroWords_card_pos allocation m h + rw [← volume allocation m h] at hp + have hab := Nat.pos_of_mul_pos_right hp + exact ⟨Nat.pos_of_mul_pos_right hab, Nat.pos_of_mul_pos_left hab, + Nat.pos_of_mul_pos_left hp⟩ + +end MatrixMultiplication.AllFieldZeroFinish + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldConstruction/ZeroHistorySums.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldConstruction/ZeroHistorySums.lean new file mode 100644 index 0000000000000000000000000000000000000000..493effe3367cd5305dd8e9863cb8b18893b69f34 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldConstruction/ZeroHistorySums.lean @@ -0,0 +1,150 @@ +import OAI.LinearAlgebra.MatrixMultiplication.FieldConstruction.TerminalRateFormulas +import OAI.LinearAlgebra.MatrixMultiplication.FieldConstruction.TerminalStatisticLaws +import OAI.LinearAlgebra.MatrixMultiplication.FieldConstruction.StageCTerminalRates + +namespace OAI + +/-! Tensor extraction over arbitrary fields and its asymptotic rate. -/ + +noncomputable section + +namespace MatrixMultiplication.AllFieldZeroHistorySums + +open AllFieldHistory AllFieldParameters AllFieldTerminalStatisticLaws +open AllFieldTerminalRates AllFieldStageCTerminalRates +open scoped BigOperators +attribute [local instance] Classical.propDecidable Classical.decEq + +def zeroRate {K : ℕ} : TerminalZero K → ℝ + | .inl h => AllFieldZeroLeafRates.fourRate (aShape h.1.val) + | .inr h => statisticRate (binaryParameter (bParent h) (bShape h.1.val)) (bWeight h) + +private theorem subtype_sum_indicator {A : Type*} [Fintype A] + (P : A → Prop) [DecidablePred P] [Fintype {a // P a}] (f : A → ℝ) : + (∑ a : {a // P a}, f a.val) = ∑ a, if P a then f a else 0 := by + rw [← Finset.sum_filter] + exact (Finset.sum_subtype _ (by simp) f).symm + +private theorem sum_subtype_complement {A : Type*} [Fintype A] + (P : A → Prop) [DecidablePred P] + [Fintype {a // P a}] [Fintype {a // ¬P a}] (f : A → ℝ) : + (∑ a : {a // ¬P a}, f a.val) + (∑ a : {a // P a}, f a.val) = ∑ a, f a := by + rw [subtype_sum_indicator (fun a => ¬P a) f, subtype_sum_indicator P f, + ← Finset.sum_add_distrib] + apply Finset.sum_congr rfl + intro a _ + by_cases ha : P a <;> simp [ha] + +private theorem list_filter_sum {A : Type*} (xs : List A) (p : A → Bool) + (f : A → ℝ) : + ((xs.filter p).map f).sum = (xs.map (fun a => if p a then f a else 0)).sum := by + induction xs with + | nil => simp + | cons a xs ih => cases hp : p a <;> simp [hp, ih] + +theorem sum_placement_rate {K : ℕ} {H : Type*} [Fintype H] + (allocation : Allocation) (canonical : H → CanonicalHistory K) (f : H → ℝ) : + (∑ h : H × Placement, (amount allocation (canonical h.1, h.2) : ℝ) * f h.1) = + ∑ h : H, (canonicalAmount allocation (canonical h) : ℝ) * f h := by + rw [Fintype.sum_prod_type] + apply Finset.sum_congr rfl + intro h _ + change (∑ phi : Placement, (amount allocation (canonical h, phi) : ℝ) * f h) = + (canonicalAmount allocation (canonical h) : ℝ) * f h + rw [← Finset.sum_mul] + have hm : (∑ phi : Placement, (amount allocation (canonical h, phi) : ℝ)) = + (canonicalAmount allocation (canonical h) : ℝ) := by + exact_mod_cast sum_placement_amount allocation (canonical h) + rw [hm] + +theorem a_zero_canonical_rate (K : ℕ) : + (∑ h : {h : AfterA K // aShape h ∉ positiveSecond}, + (aAmount h.val : ℝ) * AllFieldZeroLeafRates.fourRate (aShape h.val)) = + (K : ℝ) * S1 := by + rw [subtype_sum_indicator (fun h : AfterA K => aShape h ∉ positiveSecond) + (fun h => (aAmount h : ℝ) * AllFieldZeroLeafRates.fourRate (aShape h))] + calc + _ = ∑ h : AfterA K, (aAmount h : ℝ) * + (if aShape h ∉ positiveSecond then AllFieldZeroLeafRates.fourRate (aShape h) + else 0) := by + apply Finset.sum_congr rfl + intro h _ + split_ifs <;> simp + _ = _ := by + rw [a_history_sum K (fun t => + if t ∉ positiveSecond then AllFieldZeroLeafRates.fourRate t else 0), + S1, zeroSecond, list_filter_sum] + apply congrArg (fun r : ℝ => (K : ℝ) * r) + apply congrArg List.sum + apply List.map_congr_left + intro t ht + cases hp : positive t <;> simp [positiveSecond, ht, hp] + +theorem a_zero_history_rate (K : ℕ) (allocation : Allocation) : + (∑ h : AZero K, (amount allocation (history (.inl h)) : ℝ) * + AllFieldZeroLeafRates.fourRate (aShape h.1.val)) = (K : ℝ) * S1 := by + calc + _ = ∑ h : {h : AfterA K // aShape h ∉ positiveSecond}, + (aAmount h.val : ℝ) * AllFieldZeroLeafRates.fourRate (aShape h.val) := by + exact sum_placement_rate (H := {h : AfterA K // aShape h ∉ positiveSecond}) + allocation (fun h => .afterA h.val) + (fun h => AllFieldZeroLeafRates.fourRate (aShape h.val)) + _ = _ := a_zero_canonical_rate K + +theorem b_positive_secondLeafRate (K : ℕ) : + (∑ h : BPositive K, (bAmount h.val : ℝ) * + secondLeafRate (aShape h.val.1.val) (bShape h.val)) = (K : ℝ) * interiorS2 := by + calc + _ = ∑ h : BPositive K, (bAmount h.val : ℝ) * + (2 - (binaryParameter (aShape h.val.1.val) (bShape h.val) : ℝ)) * + Real.log 5 := by + apply Finset.sum_congr rfl + intro h _ + rw [secondLeafRate_positive _ h.val.1.property _ (bShape_mem h.val) h.property] + ring + _ = _ := bPositive_rate_eq_interior K + +theorem b_zero_canonical_rate (K : ℕ) : + (∑ h : {h : AfterB K // positive (bShape h) ≠ true}, + (bAmount h.val : ℝ) * secondLeafRate (aShape h.val.1.val) (bShape h.val)) + + (K : ℝ) * interiorS2 = (K : ℝ) * S2 := by + rw [← b_positive_secondLeafRate K] + rw [sum_subtype_complement (fun h : AfterB K => positive (bShape h) = true) + (fun h => (bAmount h : ℝ) * secondLeafRate (aShape h.1.val) (bShape h))] + exact b_history_sum K secondLeafRate + +theorem b_zero_rate_eq_secondLeafRate {K : ℕ} (h : BZero K) : + statisticRate (binaryParameter (bParent h) (bShape h.1.val)) (bWeight h) = + secondLeafRate (aShape h.1.val.1.val) (bShape h.1.val) := by + have hz : positive (bShape h.1.val) = false := by simpa using h.1.property + exact (secondLeafRate_zero _ h.1.val.1.property _ (bShape_mem h.1.val) hz).symm + +theorem b_zero_history_rate (K : ℕ) (allocation : Allocation) : + (∑ h : BZero K, (amount allocation (history (.inr h)) : ℝ) * + statisticRate (binaryParameter (bParent h) (bShape h.1.val)) (bWeight h)) + + (K : ℝ) * interiorS2 = (K : ℝ) * S2 := by + have he : (∑ h : BZero K, (amount allocation (history (.inr h)) : ℝ) * + statisticRate (binaryParameter (bParent h) (bShape h.1.val)) (bWeight h)) = + ∑ h : {h : AfterB K // positive (bShape h) ≠ true}, + (bAmount h.val : ℝ) * secondLeafRate (aShape h.val.1.val) (bShape h.val) := by + simp_rw [b_zero_rate_eq_secondLeafRate] + exact sum_placement_rate (H := {h : AfterB K // positive (bShape h) ≠ true}) + allocation (fun h => .afterB h.val) + (fun h => secondLeafRate (aShape h.val.1.val) (bShape h.val)) + rw [he] + exact b_zero_canonical_rate K + +theorem zero_history_sum (K : ℕ) (allocation : Allocation) : + (∑ h : TerminalZero K, (amount allocation (history h) : ℝ) * zeroRate h) = + (K : ℝ) * (S1 + S2 - interiorS2) := by + rw [Fintype.sum_sum_type] + simp only [zeroRate] + rw [a_zero_history_rate K allocation] + have hb := b_zero_history_rate K allocation + nlinarith + +end MatrixMultiplication.AllFieldZeroHistorySums + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldConstruction/ZeroLeafRateFormula.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldConstruction/ZeroLeafRateFormula.lean new file mode 100644 index 0000000000000000000000000000000000000000..e3ac5c68c84c293ceebfd5a1016af0c8a7bb8546 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldConstruction/ZeroLeafRateFormula.lean @@ -0,0 +1,23 @@ +import OAI.LinearAlgebra.MatrixMultiplication.FieldParameters.LeafRates + +namespace OAI + +/-! Tensor extraction over arbitrary fields and its asymptotic rate. -/ + +noncomputable section + +namespace MatrixMultiplication.AllFieldZeroLeafRates + +open MatrixMultiplication.Foundation AllFieldParameters +open scoped BigOperators + +def fourRate (t : Shape) : ℝ := + finiteEntropy (fun s : PairSlot => (zeroPairLaw t s.1 s.2 : ℝ)) + + ∑ s : PairSlot, (zeroPairLaw t s.1 s.2 : ℝ) * + Real.log (AllFieldParameters.multiplicity s.1 * AllFieldParameters.multiplicity s.2 : ℕ) + +end MatrixMultiplication.AllFieldZeroLeafRates + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldConstruction/ZeroLeafRates.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldConstruction/ZeroLeafRates.lean new file mode 100644 index 0000000000000000000000000000000000000000..46526a309a16ad09f49152e2953bff262bb14d04 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldConstruction/ZeroLeafRates.lean @@ -0,0 +1,117 @@ +import OAI.LinearAlgebra.MatrixMultiplication.CoppersmithWinograd.CWCompleteStatistics +import OAI.LinearAlgebra.MatrixMultiplication.Entropy.LeafRates +import OAI.LinearAlgebra.MatrixMultiplication.FieldConstruction.ZeroLeafRateFormula +import Mathlib.SetTheory.Cardinal.Finite + +namespace OAI + +/-! Tensor extraction over arbitrary fields and its asymptotic rate. -/ + +noncomputable section + +namespace MatrixMultiplication.AllFieldZeroLeafRates + +open MatrixMultiplication.Foundation Filter AllFieldParameters CWWindowedLeaves CWCompleteStatistics +open scoped BigOperators Topology +attribute [local instance] Classical.propDecidable + +abbrev fourWords (t : Shape) (counts : PairSlot → ℕ) (m : ℕ) := + ExactStatisticWords.Words + (fun w : Alphabet 4 (shapeMax t) => fourStatistic w.val) (fun s => m * counts s) + +def twoWords (k : Fin 5) (counts : Fin 6 → ℕ) (m : ℕ) := + ExactStatisticWords.Words + (fun w : Alphabet 2 k.val => twoStatistic w.val) (fun s => m * counts s) + +instance twoWordsFintype (k : Fin 5) (counts : Fin 6 → ℕ) (m : ℕ) : + Fintype (twoWords k counts m) := by + unfold twoWords + infer_instance + +theorem multiplicity_pos (s : Fin 6) : 0 < AllFieldParameters.multiplicity s := by + fin_cases s <;> decide + +theorem four_supported (t : Shape) (counts : PairSlot → ℕ) + (hD : 0 < ∑ s, counts s) + (hlaw : ∀ s, (counts s : ℝ) / (∑ s, counts s : ℕ) = + (zeroPairLaw t s.1 s.2 : ℝ)) (s : PairSlot) (hs : 0 < counts s) : + Fintype.card {w : Alphabet 4 (shapeMax t) // fourStatistic w.val = s} = + AllFieldParameters.multiplicity s.1 * AllFieldParameters.multiplicity s.2 := by + apply four_fixedWeight_multiplicity + by_contra hweight + have hzero := zeroPairLaw_outside_support t s.1 s.2 hweight + have hpos : (0 : ℝ) < (counts s : ℝ) / (∑ s, counts s : ℕ) := + div_pos (by exact_mod_cast hs) (by exact_mod_cast hD) + rw [hlaw s, hzero, Rat.cast_zero] at hpos + exact (lt_irrefl 0) hpos + +theorem two_supported (d : ℚ) (k : Fin 5) (counts : Fin 6 → ℕ) + (hD : 0 < ∑ s, counts s) + (hlaw : ∀ s, (counts s : ℝ) / (∑ s, counts s : ℕ) = + (statisticLaw d k s : ℝ)) (s : Fin 6) (hs : 0 < counts s) : + Fintype.card {w : Alphabet 2 k.val // twoStatistic w.val = s} = + AllFieldParameters.multiplicity s := by + apply two_fixedWeight_multiplicity + by_contra hweight + have hzero := statisticLaw_outside_support d k s hweight + have hpos : (0 : ℝ) < (counts s : ℝ) / (∑ s, counts s : ℕ) := + div_pos (by exact_mod_cast hs) (by exact_mod_cast hD) + rw [hlaw s, hzero, Rat.cast_zero] at hpos + exact (lt_irrefl 0) hpos + +theorem four_card_pos (t : Shape) (counts : PairSlot → ℕ) + (hD : 0 < ∑ s, counts s) + (hlaw : ∀ s, (counts s : ℝ) / (∑ s, counts s : ℕ) = + (zeroPairLaw t s.1 s.2 : ℝ)) (m : ℕ) : + 0 < Fintype.card (fourWords t counts m) := by + apply ExactStatisticWords.card_pos_of_supported + (fun w : Alphabet 4 (shapeMax t) => fourStatistic w.val) (fun s => m * counts s) + (fun s => AllFieldParameters.multiplicity s.1 * AllFieldParameters.multiplicity s.2) + · intro s hs + exact four_supported t counts hD hlaw s (Nat.pos_of_mul_pos_left hs) + · intro s _ + exact Nat.mul_pos (multiplicity_pos s.1) (multiplicity_pos s.2) + +theorem two_card_pos (d : ℚ) (k : Fin 5) (counts : Fin 6 → ℕ) + (hD : 0 < ∑ s, counts s) + (hlaw : ∀ s, (counts s : ℝ) / (∑ s, counts s : ℕ) = + (statisticLaw d k s : ℝ)) (m : ℕ) : + 0 < Fintype.card (twoWords k counts m) := by + have h := ExactStatisticWords.card_pos_of_supported + (fun w : Alphabet 2 k.val => twoStatistic w.val) (fun s => m * counts s) + AllFieldParameters.multiplicity + (fun s hs => two_supported d k counts hD hlaw s (Nat.pos_of_mul_pos_left hs)) + (fun s _ => multiplicity_pos s) + rw [Fintype.card_eq_nat_card] at h ⊢ + exact h + +theorem four_tendsto_log_card (t : Shape) (counts : PairSlot → ℕ) + (hD : 0 < ∑ s, counts s) + (hlaw : ∀ s, (counts s : ℝ) / (∑ s, counts s : ℕ) = + (zeroPairLaw t s.1 s.2 : ℝ)) : + Tendsto (fun m : ℕ => Real.log (Fintype.card (fourWords t counts m) : ℝ) / + ((m : ℝ) * (∑ s, counts s : ℕ))) atTop (𝓝 (fourRate t)) := by + have h := LeafRates.tendsto_log_card_supported + (fun w : Alphabet 4 (shapeMax t) => fourStatistic w.val) counts + (fun s => AllFieldParameters.multiplicity s.1 * AllFieldParameters.multiplicity s.2) + (four_supported t counts hD hlaw) + (fun s => Nat.mul_pos (multiplicity_pos s.1) (multiplicity_pos s.2)) hD + simpa only [fourWords, hlaw, fourRate] using h + +theorem two_tendsto_log_card (d : ℚ) (k : Fin 5) (counts : Fin 6 → ℕ) + (hD : 0 < ∑ s, counts s) + (hlaw : ∀ s, (counts s : ℝ) / (∑ s, counts s : ℕ) = + (statisticLaw d k s : ℝ)) : + Tendsto (fun m : ℕ => Real.log (Fintype.card (twoWords k counts m) : ℝ) / + ((m : ℝ) * (∑ s, counts s : ℕ))) atTop (𝓝 (statisticRate d k)) := by + have h := LeafRates.tendsto_log_card_supported + (fun w : Alphabet 2 k.val => twoStatistic w.val) counts AllFieldParameters.multiplicity + (two_supported d k counts hD hlaw) multiplicity_pos hD + simp only [Fintype.card_eq_nat_card] at h ⊢ + simpa only [twoWords, hlaw, statisticRate] using h + +end MatrixMultiplication.AllFieldZeroLeafRates + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldConstruction/ZeroWords.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldConstruction/ZeroWords.lean new file mode 100644 index 0000000000000000000000000000000000000000..4aae59252c3af8c4d0d139d975fc6eff071e96d9 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldConstruction/ZeroWords.lean @@ -0,0 +1,131 @@ +import OAI.LinearAlgebra.MatrixMultiplication.FieldConstruction.TerminalRates +import OAI.LinearAlgebra.MatrixMultiplication.FieldHistory.Geometry + +namespace OAI + +/-! Tensor extraction over arbitrary fields and its asymptotic rate. -/ + +noncomputable section +namespace MatrixMultiplication.AllFieldZeroWords +open MatrixMultiplication.Foundation AllFieldParameters AllFieldHistory +open AllFieldTerminalStatisticLaws AllFieldTerminalRates CWWindowedLeaves +open CWCompleteStatistics InheritedMasks +open scoped BigOperators +attribute [local instance] Classical.propDecidable +variable {K : ℕ} + +def length (h : TerminalZero K) : ℕ := currentLength (history h).1 +def shape (h : TerminalZero K) : Shape := currentShape (history h).1 + +def statistic : (h : TerminalZero K) → Raw (length h) → Slot h + | .inl _, w => fourStatistic w + | .inr _, w => twoStatistic w + +def complement : (h : TerminalZero K) → Slot h ≃ Slot h + | .inl _ => orderedComplementStatistic + | .inr _ => complementStatistic + +theorem statistic_complement (h : TerminalZero K) (w : Raw (length h)) : + statistic h (complementWord w) = complement h (statistic h w) := by + cases h with + | inl h => exact four_complement w + | inr h => exact two_complement w + +def words (allocation : Allocation) (m : ℕ) (h : TerminalZero K) + (w : ZeroWords allocation m h) : + Fin (population allocation (terminalDilation K m) (history h)) → + Alphabet (length h) (shapeMax (shape h)) := by + cases h with + | inl h => + exact fun i => w.val ((finCongr (statisticCounts_repeat_sum allocation m (.inl h))).symm i) + | inr h => + exact fun i => w.val ((finCongr (statisticCounts_repeat_sum allocation m (.inr h))).symm i) + +theorem words_injective (allocation : Allocation) (m : ℕ) (h : TerminalZero K) : + Function.Injective (words allocation m h) := by + cases h with + | inl h => + intro x y he + apply Subtype.ext + funext i + have hh := congrFun he ((finCongr (statisticCounts_repeat_sum allocation m (.inl h))) i) + change x.val ((finCongr (statisticCounts_repeat_sum allocation m (.inl h))).symm + ((finCongr (statisticCounts_repeat_sum allocation m (.inl h))) i)) = + y.val ((finCongr (statisticCounts_repeat_sum allocation m (.inl h))).symm + ((finCongr (statisticCounts_repeat_sum allocation m (.inl h))) i)) at hh + exact (congrArg x.val + ((finCongr (statisticCounts_repeat_sum allocation m (.inl h))).symm_apply_apply i)).symm.trans + (hh.trans (congrArg y.val + ((finCongr (statisticCounts_repeat_sum allocation m (.inl h))).symm_apply_apply i))) + | inr h => + intro x y he + apply Subtype.ext + funext i + have hh := congrFun he ((finCongr (statisticCounts_repeat_sum allocation m (.inr h))) i) + change x.val ((finCongr (statisticCounts_repeat_sum allocation m (.inr h))).symm + ((finCongr (statisticCounts_repeat_sum allocation m (.inr h))) i)) = + y.val ((finCongr (statisticCounts_repeat_sum allocation m (.inr h))).symm + ((finCongr (statisticCounts_repeat_sum allocation m (.inr h))) i)) at hh + exact (congrArg x.val + ((finCongr (statisticCounts_repeat_sum allocation m (.inr h))).symm_apply_apply i)).symm.trans + (hh.trans (congrArg y.val + ((finCongr (statisticCounts_repeat_sum allocation m (.inr h))).symm_apply_apply i))) + +theorem repeat_ratio (allocation : Allocation) {m : ℕ} (hm : 0 < m) + (h : TerminalZero K) (s : Slot h) : + ((m * statisticCounts allocation h s : ℕ) : ℝ) / + (∑ s, m * statisticCounts allocation h s : ℕ) = (law h s : ℝ) := by + have hm' : (m : ℝ) ≠ 0 := by exact_mod_cast Nat.ne_of_gt hm + simp only [← Finset.mul_sum, Nat.cast_mul, mul_div_mul_left _ _ hm'] + exact statisticCounts_ratio allocation h s + +theorem selected_window (allocation : Allocation) {m : ℕ} (hm : 0 < m) + (h : TerminalZero K) (η : ℝ) (hη : 0 ≤ η) (w : ZeroWords allocation m h) : + typeWindow (fun s => (law h s : ℝ)) η + (fun i => statistic h (words allocation m h w i).val) := by + intro s + have hp : wordPopulation (fun i => statistic h (words allocation m h w i).val) s = + m * statisticCounts allocation h s := by + cases h with + | inl h => + calc + _ = wordPopulation (fun i => fourStatistic (w.val i).val) s := by + simp only [wordPopulation, Fintype.card_eq_nat_card] + apply Nat.card_congr + exact (Equiv.subtypeEquiv + (finCongr (statisticCounts_repeat_sum allocation m (.inl h))).symm + (fun _ => Iff.rfl)) + _ = _ := w.property s + | inr h => + calc + _ = wordPopulation (fun i => twoStatistic (w.val i).val) s := by + simp only [wordPopulation, Fintype.card_eq_nat_card] + apply Nat.card_congr + exact (Equiv.subtypeEquiv + (finCongr (statisticCounts_repeat_sum allocation m (.inr h))).symm + (fun _ => Iff.rfl)) + _ = _ := w.property s + change |(wordPopulation (fun i => statistic h (words allocation m h w i).val) s : ℝ) / + (Fintype.card (Fin (population allocation (terminalDilation K m) (history h))) : ℝ) - + (law h s : ℝ)| ≤ η + rw [hp, Fintype.card_fin, ← statisticCounts_repeat_sum allocation m h, + repeat_ratio allocation hm h s, sub_self, abs_zero] + exact hη + +theorem complementary_window (allocation : Allocation) {m : ℕ} (hm : 0 < m) + (h : TerminalZero K) (η : ℝ) (hη : 0 ≤ η) (w : ZeroWords allocation m h) : + typeWindow ((fun s => (law h s : ℝ)) ∘ (complement h).symm) η + (fun i => statistic h (complementWord (words allocation m h w i).val)) := by + have hs := selected_window allocation hm h η hη w + have he : (fun i => statistic h (complementWord (words allocation m h w i).val)) = + complement h ∘ (fun i => statistic h (words allocation m h w i).val) := by + funext i + exact statistic_complement h _ + rw [he] + exact (typeWindow_equiv _ η _ (complement h)).mpr hs + +end MatrixMultiplication.AllFieldZeroWords + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldGroups/AdmissibilityCore.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldGroups/AdmissibilityCore.lean new file mode 100644 index 0000000000000000000000000000000000000000..ab2d066c4e8a1466ebc712b24b1eb52120c9b80c --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldGroups/AdmissibilityCore.lean @@ -0,0 +1,102 @@ +import OAI.LinearAlgebra.MatrixMultiplication.FieldGroups.OrbitData +import OAI.LinearAlgebra.MatrixMultiplication.JointExtraction.ScalarOrbitAdmissibility + +namespace OAI + +/-! Group assignments, orbit counts and extraction capacities. -/ + +noncomputable section + +namespace MatrixMultiplication.AllFieldGroupAdmissible + +open AllFieldHistory AllFieldHistorySupport AllFieldHistoryChildLaws +open AllFieldHistoryGroupMasks AllFieldHistoryGroupedRecovery AllFieldGroupOrbitData +open JointPopulation JointCanonicalization PermutationMatching +attribute [local instance] Classical.propDecidable Classical.decEq + +variable {K tick : ℕ} + +abbrev Symmetries (allocation : Allocation) (m : ℕ) (sigma : Placement) := + HalfClassPermutations (ClassPositions (Counts (K := K) (tick := tick) allocation m sigma)) + +@[instance_reducible] def rawAction (allocation : Allocation) (m : ℕ) (sigma : Placement) + (e : Targets (K := K) (tick := tick) allocation m sigma) : + MulAction (Symmetries (K := K) (tick := tick) allocation m sigma) (Raw (K := K) (tick := tick) allocation m sigma) := + EquivOrbitTransport.action (groupCoordinates (K := K) (tick := tick) allocation m sigma e) + +theorem admissible_smul (allocation : Allocation) (m : ℕ) (ε : ℝ) (sigma : Placement) + (side : Fin 3) (e : Targets (K := K) (tick := tick) allocation m sigma) : + letI : MulAction (Symmetries (K := K) (tick := tick) allocation m sigma) (Raw (K := K) (tick := tick) allocation m sigma) := + rawAction (K := K) (tick := tick) allocation m sigma e + ∀ (g : Symmetries (K := K) (tick := tick) allocation m sigma) (w : Raw (K := K) (tick := tick) allocation m sigma), + Admissible (K := K) (tick := tick) allocation m ε sigma side e w → + Admissible (K := K) (tick := tick) allocation m ε sigma side e ((rawAction (K := K) (tick := tick) allocation m sigma e).smul g w) := by + let _ : MulAction (Symmetries (K := K) (tick := tick) allocation m sigma) (Raw (K := K) (tick := tick) allocation m sigma) := + rawAction (K := K) (tick := tick) allocation m sigma e + intro g w hw + have hweights : ∀ h j, + CWStrands.weight (((rawAction (K := K) (tick := tick) allocation m sigma e).smul g w) h j).1 = (shapeSide (sigma side) ((e h).val j)).val ∧ + CWStrands.weight (((rawAction (K := K) (tick := tick) allocation m sigma e).smul g w) h j).2 = activeParentShape h.val (sigma side) - + (shapeSide (sigma side) ((e h).val j)).val := by + exact JointScalarOrbitAdmissibility.classWeights_smul + (Counts (K := K) (tick := tick) allocation m sigma) + (fun h => Fin (activeHalfLength h.val) → Fin 7) + (fun h => Fin (activeHalfLength h.val) → Fin 7) + (fun _ => CWStrands.weight) (fun _ => CWStrands.weight) + (fun _ u => (shapeSide (sigma side) u).val) + (fun h u => activeParentShape h.val (sigma side) - (shapeSide (sigma side) u).val) + e g w hw.2 + refine ⟨⟨?_, ?_⟩, hweights⟩ + · intro h j + apply Fin.ext + exact (hweights h j).1 + · exact (JointScalarOrbitAdmissibility.rawWindows_smul + (SL := fun h : ActiveOrder K tick sigma => Statistic h.val) + (SR := fun h : ActiveOrder K tick sigma => Statistic h.val) + (Counts (K := K) (tick := tick) allocation m sigma) + (fun h => Fin (activeHalfLength h.val) → Fin 7) + (fun h => Fin (activeHalfLength h.val) → Fin 7) + (fun c => statistic c.1.val) (fun c => statistic c.1.val) + (fun c => leftLaw c.1.val c.2 (sigma side)) + (fun c => rightLaw c.1.val c.2 (sigma side)) + (fun c => AllFieldHistoryMasks.childWidth ε c.1.val) + (fun c => AllFieldHistoryMasks.childWidth ε c.1.val) e g w).mpr hw.1.2 + +theorem admissible_of_orbitOf_eq (allocation : Allocation) (m : ℕ) (ε : ℝ) + (sigma : Placement) (side : Fin 3) + (e : Targets (K := K) (tick := tick) allocation m sigma) + (w v : Raw (K := K) (tick := tick) allocation m sigma) (hw : Admissible (K := K) (tick := tick) allocation m ε sigma side e w) + (hv : orbitOf (K := K) (tick := tick) allocation m sigma e v = orbitOf (K := K) (tick := tick) allocation m sigma e w) : + Admissible (K := K) (tick := tick) allocation m ε sigma side e v := by + let _ : MulAction (Symmetries (K := K) (tick := tick) allocation m sigma) (Raw (K := K) (tick := tick) allocation m sigma) := + rawAction (K := K) (tick := tick) allocation m sigma e + have hrel : MulAction.orbitRel + (Symmetries (K := K) (tick := tick) allocation m sigma) + (CanonicalPairs (Counts (K := K) (tick := tick) allocation m sigma) + (fun h => Fin (activeHalfLength h.val) → Fin 7) + (fun h => Fin (activeHalfLength h.val) → Fin 7)) + (groupCoordinates (K := K) (tick := tick) allocation m sigma e v) + (groupCoordinates (K := K) (tick := tick) allocation m sigma e w) := Quotient.exact hv + obtain ⟨g, hg⟩ := hrel + have hgv : ((rawAction (K := K) (tick := tick) allocation m sigma e).smul g w) = v := by + apply (groupCoordinates (K := K) (tick := tick) allocation m sigma e).injective + exact (EquivOrbitTransport.equiv_smul + (groupCoordinates (K := K) (tick := tick) allocation m sigma e) g w).trans hg + rw [← hgv] + exact admissible_smul allocation m ε sigma side e g w hw + +theorem full_admissible (allocation : Allocation) (m : ℕ) (ε : ℝ) (sigma : Placement) + (e : Targets (K := K) (tick := tick) allocation m sigma) + (o : Orbit (K := K) (tick := tick) allocation m sigma) (ho : o ∈ (data (K := K) (tick := tick) allocation m ε sigma).orbits e) + (v : Variable (K := K) (tick := tick) allocation m sigma) (hv : v ∈ (data (K := K) (tick := tick) allocation m ε sigma).full e o) : + Admissible (K := K) (tick := tick) allocation m ε sigma v.1 e v.2 := by + obtain ⟨w, hw, hwo⟩ := (Finset.mem_filter.mp ho).2 + obtain ⟨hside, hvo⟩ := (Finset.mem_filter.mp hv).2 + rw [hside] + exact admissible_of_orbitOf_eq allocation m ε sigma o.1 e w v.2 hw (hvo.trans hwo.symm) + +end MatrixMultiplication.AllFieldGroupAdmissible + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldGroups/Admissible.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldGroups/Admissible.lean new file mode 100644 index 0000000000000000000000000000000000000000..73215fea8779a00ff6f0543d68e39af7d5a1d2a8 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldGroups/Admissible.lean @@ -0,0 +1,66 @@ +import OAI.LinearAlgebra.MatrixMultiplication.FieldGroups.AdmissibilityCore +import OAI.LinearAlgebra.MatrixMultiplication.FieldHistory.GroupedRecovery + +namespace OAI + +/-! Group assignments, orbit counts and extraction capacities. -/ + +noncomputable section + +namespace MatrixMultiplication.AllFieldGroupAdmissible + +open AllFieldHistory AllFieldHistorySupport AllFieldHistoryChildLaws +open AllFieldHistoryGroupMasks AllFieldHistoryGroupedRecovery AllFieldGroupOrbitData +open JointPopulation JointCanonicalization PermutationMatching +attribute [local instance] Classical.propDecidable Classical.decEq + +variable {K tick : ℕ} + +theorem used_project_admissible (F : Type*) [CommRing F] + (allocation : Allocation) (m : ℕ) (ε : ℝ) (sigma : Placement) + (e : AllFieldHistoryRecovery.Targets (K := K) (tick := tick) allocation m) + (side : Fin 3) (w : AllFieldHistoryRecovery.Raw (K := K) (tick := tick) allocation m) + (hw : AllFieldHistoryRecovery.Used F allocation m ε e (sigma side) w) : + Admissible (K := K) (tick := tick) allocation m ε sigma side + (projectTarget (K := K) (tick := tick) allocation m sigma e) (projectRaw (K := K) (tick := tick) allocation m sigma w) := by + obtain ⟨x, y, z, hq, rfl⟩ := hw + have hi : + AllFieldHistoryRecovery.idealSide allocation m ε 0 e x ∧ + AllFieldHistoryRecovery.idealSide allocation m ε 1 e y ∧ + AllFieldHistoryRecovery.idealSide allocation m ε 2 e z := by + by_contra hn + apply hq + rw [AllFieldHistoryRecovery.ideal_eq_delete_source F allocation m ε e] + exact ite_eq_right hn + have ht := AllFieldHistoryRecovery.ideal_support_weights F allocation m ε e x y z hq + have hs (s : Fin 3) : + AllFieldHistoryRecovery.idealSide allocation m ε s e + (AllFieldHistoryRecovery.sideVariable s x y z) ∧ + AllFieldHistoryRecovery.sideWeights allocation m s e + (AllFieldHistoryRecovery.sideVariable s x y z) := by + fin_cases s + · exact ⟨hi.1, ht.1⟩ + · exact ⟨hi.2.1, ht.2.1⟩ + · exact ⟨hi.2.2, ht.2.2⟩ + refine ⟨?_, ?_⟩ + · exact (idealSide_iff_all_groups allocation m ε + (sigma side) e _).mp (hs (sigma side)).1 sigma + · intro h j + exact (hs (sigma side)).2 h.val j + +theorem used_project_covered (F : Type*) [CommRing F] + (allocation : Allocation) (m : ℕ) (ε : ℝ) (sigma : Placement) + (e : AllFieldHistoryRecovery.Targets (K := K) (tick := tick) allocation m) + (side : Fin 3) (w : AllFieldHistoryRecovery.Raw (K := K) (tick := tick) allocation m) + (hw : AllFieldHistoryRecovery.Used F allocation m ε e (sigma side) w) : + ∃ o ∈ (data (K := K) (tick := tick) allocation m ε sigma).orbits (projectTarget (K := K) (tick := tick) allocation m sigma e), + (side, projectRaw (K := K) (tick := tick) allocation m sigma w) ∈ + (data (K := K) (tick := tick) allocation m ε sigma).full (projectTarget (K := K) (tick := tick) allocation m sigma e) o := + admissible_covered allocation m ε sigma side _ _ + (used_project_admissible F allocation m ε sigma e side w hw) + +end MatrixMultiplication.AllFieldGroupAdmissible + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldGroups/AmbientDegree.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldGroups/AmbientDegree.lean new file mode 100644 index 0000000000000000000000000000000000000000..f08bcd88bf18d2905de15072290679849a67376f --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldGroups/AmbientDegree.lean @@ -0,0 +1,173 @@ +import OAI.LinearAlgebra.MatrixMultiplication.FieldConstruction.StageCGibbs +import OAI.LinearAlgebra.MatrixMultiplication.FieldGroups.TargetRate +import OAI.LinearAlgebra.MatrixMultiplication.FieldConstruction.ActiveCapacity +import OAI.LinearAlgebra.MatrixMultiplication.JointExtraction.AmbientEntropy +import OAI.LinearAlgebra.MatrixMultiplication.JointExtraction.AmbientRateLimit + +namespace OAI + +/-! Group assignments, orbit counts and extraction capacities. -/ + +noncomputable section + +namespace MatrixMultiplication.AllFieldGroupAmbientDegree + +open MatrixMultiplication.Foundation AllFieldParameters AllFieldHistory AllFieldActiveLaws +open AllFieldActiveCapacity AllFieldGroupTargetRate JointPopulation JointAmbientDegree +open JointAmbientEntropy JointGibbsApproximation Filter +open scoped BigOperators Topology +attribute [local instance] Classical.propDecidable Classical.decEq + +def potential {K : ℕ} (w : PlacedWork K) (s : Fin 3) (k : Fin 17) : ℝ := + match w.1 with + | .stageA h => AllFieldActiveGibbs.physicalPotential positiveInitial tableP + (initialShape h.val) w.2 s k + | .stageB h => AllFieldActiveGibbs.physicalPotential positiveSecond tablep + (aShape h.val) w.2 s k + | .stageC h => AllFieldStageCGibbs.physicalPotential h w.2 s k + +def logNormalizer {K : ℕ} (w : PlacedWork K) : ℝ := + match w.1 with + | .stageA h => AllFieldActiveGibbs.splitLogNormalizer positiveInitial tableP + (initialShape h.val) + | .stageB h => AllFieldActiveGibbs.splitLogNormalizer positiveSecond tablep + (aShape h.val) + | .stageC _ => 0 + +theorem placedLaw_log {K : ℕ} (w : PlacedWork K) (a : JointPopulation.Shape) + (ha : 0 < (placedLaw w).mass a) : + Real.log ((placedLaw w).mass a) = potential w 0 (shapeSide 0 a) + + potential w 1 (shapeSide 1 a) + potential w 2 (shapeSide 2 a) - + logNormalizer w := by + rcases w with ⟨w, phi⟩ + cases w with + | stageA h => exact AllFieldActiveGibbs.placedLaw_stageA_log h phi a ha + | stageB h => exact AllFieldActiveGibbs.placedLaw_stageB_log h phi a ha + | stageC h => exact AllFieldStageCGibbs.placedLaw_stageC_log h phi a ha + +theorem localAllowed_positive {H : Type*} [Fintype H] [DecidableEq H] + (counts : H → JointPopulation.Shape → ℕ) (total : H → ℕ) (h : H) + (word : Positions counts h → JointPopulation.Shape) + (hw : localAllowed counts total h word) {K : ℕ} (w : PlacedWork K) + (htotal : total h = 2 * w.1.halfLength) + (hcounts : ∀ a, 0 < counts h a → 0 < (placedLaw w).mass a) : + ∀ i, 0 < (placedLaw w).mass (word i) := by + have hb := fun a ha => + AllFieldStageCGibbs.placedLaw_positive_parent_bounds w a (hcounts a ha) + rcases w with ⟨w, phi⟩ + cases w with + | stageA a => + apply JointMarginalSupport.localAllowed_positive_reference counts total h word hw + (physicalShape phi (initialShape a.val)) _ hb + intro u hu hle + exact AllFieldActiveGibbs.placedLaw_stageA_positive a phi u + (hu.trans htotal) hle + | stageB a => + apply JointMarginalSupport.localAllowed_positive_reference counts total h word hw + (physicalShape phi (aShape a.val)) _ hb + intro u hu hle + exact AllFieldActiveGibbs.placedLaw_stageB_positive a phi u + (hu.trans htotal) hle + | stageC a => + exact AllFieldStageCGibbs.localAllowed_positive_reference counts total h word hw + a phi htotal hcounts + +variable {K tick : ℕ} {sigma : Placement} + +def orderTotal (h : ActiveOrder K tick sigma) : ℕ := 2 * h.val.val.1.halfLength + +theorem canonicalLaw_mass_eq (allocation : Allocation) (m : ℕ) + (h : ActiveOrder K tick sigma) + (hpos : 0 < Fintype.card (Positions (orderCounts allocation m) h)) : + (canonicalLaw (orderCounts allocation m) h).mass = (orderLaw h).mass := by + have hcard : Fintype.card (Positions (orderCounts allocation m) h) = + population allocation m (h.val.val.1.source, h.val.val.2) := by + simpa only [Positions, Fintype.card_fin] using orderCounts_sum allocation m h + funext a + rw [canonicalLaw_mass_of_pos _ h hpos, hcard] + change (jointCounts allocation m h.val.val a : ℝ) / + population allocation m (h.val.val.1.source, h.val.val.2) = _ + rw [jointCounts_cast] + exact mul_div_cancel_left₀ _ (by exact_mod_cast (hcard ▸ hpos).ne') + +theorem localAllowed_entropy_le (allocation : Allocation) (m : ℕ) + (h : ActiveOrder K tick sigma) + (word : Positions (orderCounts allocation m) h → JointPopulation.Shape) + (hw : localAllowed (orderCounts allocation m) orderTotal h word) : + finiteEntropy (fun a => (wordPopulation word a : ℝ) / + Fintype.card (Positions (orderCounts allocation m) h)) ≤ + finiteEntropy (orderLaw h).mass := by + by_cases hpos : 0 < Fintype.card (Positions (orderCounts allocation m) h) + · have hs := localAllowed_positive (orderCounts allocation m) orderTotal h word hw + h.val.val rfl (fun a ha => + AllFieldStageCGibbs.jointCounts_positive_reference allocation m h.val.val a ha) + have he := localAllowed_entropy_le_of_word_support (orderCounts allocation m) + orderTotal h word (orderLaw h) (potential h.val.val 0) (potential h.val.val 1) + (potential h.val.val 2) (logNormalizer h.val.val) hs + (placedLaw_log h.val.val) hw + have hc := canonicalLaw_mass_eq allocation m h hpos + simpa only [gibbsCap, marginalError, FiniteLaw.map_mass, hc, sub_self, abs_zero, + zero_mul, Finset.sum_const_zero, add_zero] using he + · have hz := Nat.eq_zero_of_not_pos hpos + simpa only [hz, Nat.cast_zero, div_zero, finiteEntropy, entropyTerm_zero, + Finset.sum_const_zero] using (orderLaw h).entropy_nonneg + +theorem tendsto_firstExponent (allocation : Allocation) (sigma : Placement) : + Tendsto (fun m : ℕ => (∑ h : ActiveOrder K tick sigma, + classExponent (orderCounts allocation m) (sigma 0) + (triple (orderCounts allocation m) (canonicalTarget (orderCounts allocation m))) h + (finiteEntropy (orderLaw h).mass)) / (m : ℝ)) atTop + (𝓝 (orderNativeDegree (K := K) (tick := tick) allocation sigma 0)) := by + have hsize (h : ActiveOrder K tick sigma) := + JointPopulationRates.tendsto_total_div_of_coordinate_rates + (fun m => orderCounts allocation m h) + ((populationLength (K := K) allocation 1 : ℝ) * orderMass allocation h) + (orderLaw h).mass (orderLaw h).total (orderCounts_dilation_rate allocation h) + have hside (h : ActiveOrder K tick sigma) := + JointPopulationRates.tendsto_weighted_target_side_entropy + (fun m => orderCounts allocation m) + (fun m => canonicalTarget (orderCounts allocation m)) + (fun h => (populationLength (K := K) allocation 1 : ℝ) * orderMass allocation h) + (fun h => (orderLaw h).mass) (fun h => (orderLaw h).total) + (orderCounts_dilation_rate allocation) h (sigma 0) + have hr := JointAmbientRateLimit.tendsto_sum_classExponent_div_nat + (fun m => orderCounts allocation m) (sigma 0) + (fun _ h => finiteEntropy (orderLaw h).mass) + (fun h => (populationLength (K := K) allocation 1 : ℝ) * orderMass allocation h) + (fun h => ((populationLength (K := K) allocation 1 : ℝ) * orderMass allocation h) * + finiteEntropy (orderLaw h).mass) + (fun h => ((populationLength (K := K) allocation 1 : ℝ) * orderMass allocation h) * + finiteEntropy (JointPopulationRates.sideMass (orderLaw h).mass (sigma 0))) + hsize (fun h => (hsize h).mul_const (finiteEntropy (orderLaw h).mass)) + (fun h => by simpa only [Positions, Fintype.card_fin] using hside h) + simpa only [orderNativeDegree, order_first_capacity, mul_sub] using hr + +theorem eventually_sharedAmbient_first_card_le (allocation : Allocation) + (sigma : Placement) {ε : ℝ} (hε : 0 < ε) : + ∀ᶠ m in atTop, ∀ e : Target + (orderCounts (K := K) (tick := tick) (sigma := sigma) allocation m), + ((sharedAmbient (orderCounts allocation m) orderTotal (sigma 0) + (triple (orderCounts allocation m) e)).card : ℝ) ≤ + Real.exp ((m : ℝ) * + (orderNativeDegree (K := K) (tick := tick) allocation sigma 0 + ε)) := by + filter_upwards [(tendsto_order.1 + (tendsto_firstExponent (K := K) (tick := tick) allocation sigma)).2 + (orderNativeDegree (K := K) (tick := tick) allocation sigma 0 + ε) + (lt_add_of_pos_right _ hε), eventually_gt_atTop (0 : ℕ)] with m hm hmp + intro e + have hmr : (0 : ℝ) < m := by exact_mod_cast hmp + have hb := sharedAmbient_card_le (orderCounts allocation m) orderTotal (sigma 0) + (triple (orderCounts allocation m) e) (fun h => finiteEntropy (orderLaw h).mass) + (fun h word hw => localAllowed_entropy_le allocation m h word hw) + apply hb.trans + simp_rw [classBound_eq_exp] + rw [← Real.exp_sum] + apply Real.exp_le_exp.mpr + simp_rw [classExponent_target_eq] + simpa only [mul_comm] using (div_le_iff₀ hmr).mp hm.le + +end MatrixMultiplication.AllFieldGroupAmbientDegree + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldGroups/AssignmentCore.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldGroups/AssignmentCore.lean new file mode 100644 index 0000000000000000000000000000000000000000..89c4959b8304d4d421505d2654b9bd0bfe65e645 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldGroups/AssignmentCore.lean @@ -0,0 +1,57 @@ +import OAI.LinearAlgebra.MatrixMultiplication.FieldGroups.OrbitData + +namespace OAI + +/-! Group assignments, orbit counts and extraction capacities. -/ + +noncomputable section + +namespace MatrixMultiplication.AllFieldGroupAssignmentRetention +open AllFieldHistory AllFieldHistoryGroupMasks AllFieldHistoryGroupedRecovery +open AllFieldGroupOrbitData JointCoarseHashing +attribute [local instance] Classical.propDecidable Classical.decEq +variable {K tick : ℕ} + +def assigned (allocation : Allocation) (m : ℕ) (ε : ℝ) (sigma : Placement) + (k : ℕ) (U : Finset (ZMod (37 ^ k))) + (s : Sample (Pos (K := K) (tick := tick) allocation m sigma) k) + (v : Variable (K := K) (tick := tick) allocation m sigma) : Option (Triple (Pos (K := K) (tick := tick) allocation m sigma)) := + (data allocation m ε sigma).actualAssignment k U + (actualCompatible allocation m ε sigma) (actualUseful allocation m ε sigma) + (actualKeep allocation m ε sigma) s v + +def physicalAssignment (allocation : Allocation) (m : ℕ) (ε : ℝ) (sigma : Placement) + (k : ℕ) (U : Finset (ZMod (37 ^ k))) + (s : Sample (Pos (K := K) (tick := tick) allocation m sigma) k) : + JointExtraction.Assignment (Raw (K := K) (tick := tick) allocation m sigma) (Raw (K := K) (tick := tick) allocation m sigma) + (Raw (K := K) (tick := tick) allocation m sigma) (Triple (Pos (K := K) (tick := tick) allocation m sigma)) where + x w := assigned allocation m ε sigma k U s (sigma.symm 0, w) + y w := assigned allocation m ε sigma k U s (sigma.symm 1, w) + z w := assigned allocation m ε sigma k U s (sigma.symm 2, w) + +theorem assigned_spec (allocation : Allocation) (m : ℕ) (ε : ℝ) (sigma : Placement) + (k : ℕ) (U : Finset (ZMod (37 ^ k))) + (s : Sample (Pos (K := K) (tick := tick) allocation m sigma) k) + (v : Variable (K := K) (tick := tick) allocation m sigma) (t : Triple (Pos (K := K) (tick := tick) allocation m sigma)) + (h : assigned allocation m ε sigma k U s v = some t) : + t ∈ (data allocation m ε sigma).actualEligible k U s ∧ + actualCompatible allocation m ε sigma t v ∧ actualUseful allocation m ε sigma t v ∧ + ∀ f, f ∈ (data allocation m ε sigma).actualEligible k U s → + actualCompatible allocation m ε sigma f v → f = t := by + have hh := JointExtraction.retainAssignment_some _ _ v t h + exact JointCoarseAssignment.assignUseful_spec _ _ _ v t hh + +theorem assigned_some_idealSide (allocation : Allocation) (m : ℕ) (ε : ℝ) + (sigma : Placement) (k : ℕ) (U : Finset (ZMod (37 ^ k))) + (s : Sample (Pos (K := K) (tick := tick) allocation m sigma) k) + (e : Targets (K := K) (tick := tick) allocation m sigma) (v : Variable (K := K) (tick := tick) allocation m sigma) + (h : assigned allocation m ε sigma k U s v = some (coarse allocation m sigma e)) : + groupIdealSide allocation m ε (sigma v.1) sigma e v.2 := by + exact (actualUseful_coarse allocation m ε sigma e v).mp + (assigned_spec allocation m ε sigma k U s v _ h).2.2.1 + +end MatrixMultiplication.AllFieldGroupAssignmentRetention + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldGroups/AssignmentLoss.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldGroups/AssignmentLoss.lean new file mode 100644 index 0000000000000000000000000000000000000000..fddc62222b9ff7b74b1dcddd4fa106dacaf417c7 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldGroups/AssignmentLoss.lean @@ -0,0 +1,52 @@ +import OAI.LinearAlgebra.MatrixMultiplication.FieldGroups.AssignmentCore +import OAI.LinearAlgebra.MatrixMultiplication.FieldGroups.AdmissibilityCore +import OAI.LinearAlgebra.MatrixMultiplication.FieldGroups.Compatibility +import OAI.LinearAlgebra.MatrixMultiplication.JointExtraction.MaskedGoodSelection + +namespace OAI + +/-! Group assignments, orbit counts and extraction capacities. -/ + +noncomputable section + +namespace MatrixMultiplication.AllFieldGroupAssignmentRetention +open AllFieldHistory AllFieldHistoryGroupMasks AllFieldHistoryGroupedRecovery +open AllFieldGroupOrbitData JointCoarseHashing +attribute [local instance] Classical.propDecidable Classical.decEq +variable {K tick : ℕ} + +theorem good_failure_fraction_le (allocation : Allocation) (m : ℕ) (ε : ℝ) + (sigma : Placement) (k : ℕ) (U : Finset (ZMod (37 ^ k))) + (hAP : ∀ x ∈ U, ∀ y ∈ U, ∀ z ∈ U, x + y = 2 * z → x = z ∧ y = z) + (N : ℝ) (s : Sample (Pos (K := K) (tick := tick) allocation m sigma) k) + (e : Targets (K := K) (tick := tick) allocation m sigma) + (hg : (data (K := K) (tick := tick) allocation m ε sigma).Good k U N e s) + (o : Orbit (K := K) (tick := tick) allocation m sigma) (ho : o ∈ (data (K := K) (tick := tick) allocation m ε sigma).orbits e) : + ((((data (K := K) (tick := tick) allocation m ε sigma).passing e o).filter + (fun v => assigned (K := K) (tick := tick) allocation m ε sigma k U s v ≠ some (coarse (K := K) (tick := tick) allocation m sigma e))).card : ℝ) / + (((data (K := K) (tick := tick) allocation m ε sigma).full e o).card : ℝ) ≤ 1 / N := by + have ha (v : Variable (K := K) (tick := tick) allocation m sigma) + (hv : v ∈ (data (K := K) (tick := tick) allocation m ε sigma).passing e o) : + Admissible (K := K) (tick := tick) allocation m ε sigma v.1 e v.2 := + AllFieldGroupAdmissible.full_admissible (K := K) (tick := tick) allocation m ε sigma e o ho v + ((mem_passing (K := K) (tick := tick) allocation m ε sigma e o v).mp hv).1 + have hc (v : Variable (K := K) (tick := tick) allocation m sigma) + (hv : v ∈ (data (K := K) (tick := tick) allocation m ε sigma).passing e o) : + Compatible (K := K) (tick := tick) allocation m ε sigma v.1 e v.2 := + AllFieldGroupCompatibility.admissible_compatible (K := K) (tick := tick) allocation m ε sigma v.1 e v.2 (ha v hv) + have hh := (data (K := K) (tick := tick) allocation m ε sigma).good_passing_actual_failure_fraction_le k U hAP N e o ho s hg + (actualCompatible (K := K) (tick := tick) allocation m ε sigma) (actualUseful (K := K) (tick := tick) allocation m ε sigma) + (actualKeep (K := K) (tick := tick) allocation m ε sigma) + (fun v hv => (actualCompatible_coarse (K := K) (tick := tick) allocation m ε sigma e v).mpr (hc v hv)) + (fun v hv => (actualUseful_coarse (K := K) (tick := tick) allocation m ε sigma e v).mpr (ha v hv).1) + (fun v hv => ((mem_passing (K := K) (tick := tick) allocation m ε sigma e o v).mp hv).2) + (fun v hv f _ hn hcomp => competitor_coverage (K := K) (tick := tick) allocation m ε sigma e o v (hc v hv) f hn hcomp) + + rw [Finset.filter_congr_decidable] at hh + exact hh + +end MatrixMultiplication.AllFieldGroupAssignmentRetention + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldGroups/AssignmentRetention.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldGroups/AssignmentRetention.lean new file mode 100644 index 0000000000000000000000000000000000000000..6b5e7e9f22b055539489180df818a1a309315b77 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldGroups/AssignmentRetention.lean @@ -0,0 +1,88 @@ +import OAI.LinearAlgebra.MatrixMultiplication.FieldGroups.OrbitTransport +import OAI.LinearAlgebra.MatrixMultiplication.FieldGroups.Admissible +import OAI.LinearAlgebra.MatrixMultiplication.FieldGroups.AssignmentLoss + +namespace OAI + +/-! Group assignments, orbit counts and extraction capacities. -/ + +noncomputable section + +namespace MatrixMultiplication.AllFieldGroupAssignmentRetention + +open AllFieldHistory AllFieldHistoryGroupMasks AllFieldHistoryGroupedRecovery +open AllFieldGroupOrbitData JointCoarseHashing +attribute [local instance] Classical.propDecidable Classical.decEq + +variable {K tick : ℕ} + +theorem good_local_failure_le (allocation : Allocation) (m : ℕ) (ε : ℝ) + (sigma : Placement) (k : ℕ) (U : Finset (ZMod (37 ^ k))) + (hAP : ∀ x ∈ U, ∀ y ∈ U, ∀ z ∈ U, x + y = 2 * z → x = z ∧ y = z) + (N : ℝ) (s : Sample (Pos (K := K) (tick := tick) allocation m sigma) k) + (e : Targets (K := K) (tick := tick) allocation m sigma) (hg : (data allocation m ε sigma).Good k U N e s) + (side : Fin 3) (w : Raw (K := K) (tick := tick) allocation m sigma) + (hw : Admissible allocation m ε sigma side e w) : + (((localOrbit allocation m sigma e w).filter (fun v => + completeKeep allocation m ε (sigma side) sigma v ∧ + assigned allocation m ε sigma k U s (side, v) ≠ some (coarse allocation m sigma e))).card : ℝ) / + ((localOrbit allocation m sigma e w).card : ℝ) ≤ 1 / N := by + have ho : (side, orbitOf allocation m sigma e w) ∈ (data allocation m ε sigma).orbits e := + Finset.mem_filter.mpr ⟨Finset.mem_univ _, w, hw, rfl⟩ + have hh := good_failure_fraction_le allocation m ε sigma k U hAP N s e hg _ ho + change (((passing allocation m sigma ε e (side, orbitOf allocation m sigma e w)).filter + (fun v => assigned allocation m ε sigma k U s v ≠ some (coarse allocation m sigma e))).card : ℝ) / + ((full allocation m sigma e (side, orbitOf allocation m sigma e w)).card : ℝ) ≤ 1 / N at hh + rw [passing, Finset.filter_filter] at hh + simp only [full_eq_tagged_localOrbit, Finset.filter_map, Finset.card_map] at hh + rw [Finset.filter_congr_decidable] at hh + exact hh + +theorem localAssigned_iff (allocation : Allocation) (m : ℕ) (ε : ℝ) + (sigma : Placement) (k : ℕ) (U : Finset (ZMod (37 ^ k))) + (s : Sample (Pos (K := K) (tick := tick) allocation m sigma) k) + (t : Triple (Pos (K := K) (tick := tick) allocation m sigma)) (side : Fin 3) (w : Raw (K := K) (tick := tick) allocation m sigma) : + localAssigned allocation m sigma (physicalAssignment allocation m ε sigma k U s) t side w ↔ + assigned allocation m ε sigma k U s (sigma.symm side, w) = some t := by + fin_cases side <;> rfl + +theorem good_physical_local_failure_le (allocation : Allocation) (m : ℕ) (ε : ℝ) + (sigma : Placement) (k : ℕ) (U : Finset (ZMod (37 ^ k))) + (hAP : ∀ x ∈ U, ∀ y ∈ U, ∀ z ∈ U, x + y = 2 * z → x = z ∧ y = z) + (N : ℝ) (s : Sample (Pos (K := K) (tick := tick) allocation m sigma) k) + (e : Targets (K := K) (tick := tick) allocation m sigma) (hg : (data allocation m ε sigma).Good k U N e s) + (side : Fin 3) (w : Raw (K := K) (tick := tick) allocation m sigma) + (hw : Admissible allocation m ε sigma (sigma.symm side) e w) : + (((localOrbit allocation m sigma e w).filter (fun v => + completeKeep allocation m ε side sigma v ∧ + ¬localAssigned allocation m sigma (physicalAssignment allocation m ε sigma k U s) + (coarse allocation m sigma e) side v)).card : ℝ) / + ((localOrbit allocation m sigma e w).card : ℝ) ≤ 1 / N := by + simpa only [sigma.apply_symm_apply, localAssigned_iff] using + good_local_failure_le allocation m ε sigma k U hAP N s e hg (sigma.symm side) w hw + +theorem good_projected_failure_le (F : Type*) [CommRing F] + (allocation : Allocation) (m : ℕ) (ε : ℝ) (sigma : Placement) + (k : ℕ) (U : Finset (ZMod (37 ^ k))) + (hAP : ∀ x ∈ U, ∀ y ∈ U, ∀ z ∈ U, x + y = 2 * z → x = z ∧ y = z) + (N : ℝ) (s : Sample (Pos (K := K) (tick := tick) allocation m sigma) k) + (e : AllFieldHistoryRecovery.Targets (K := K) (tick := tick) allocation m) + (hg : (data allocation m ε sigma).Good k U N (projectTarget allocation m sigma e) s) + (side : Fin 3) (w : AllFieldHistoryRecovery.Raw (K := K) (tick := tick) allocation m) + (hw : AllFieldHistoryRecovery.Used F allocation m ε e side w) : + (((localOrbit allocation m sigma (projectTarget allocation m sigma e) + (projectRaw allocation m sigma w)).filter (fun v => + completeKeep allocation m ε side sigma v ∧ + ¬localAssigned allocation m sigma (physicalAssignment allocation m ε sigma k U s) + (coarse allocation m sigma (projectTarget allocation m sigma e)) side v)).card : ℝ) / + ((localOrbit allocation m sigma (projectTarget allocation m sigma e) + (projectRaw allocation m sigma w)).card : ℝ) ≤ 1 / N := by + apply good_physical_local_failure_le allocation m ε sigma k U hAP N s _ hg + exact AllFieldGroupAdmissible.used_project_admissible F allocation m ε sigma e + (sigma.symm side) w (by simpa only [sigma.apply_symm_apply] using hw) + +end MatrixMultiplication.AllFieldGroupAssignmentRetention + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldGroups/Assignments.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldGroups/Assignments.lean new file mode 100644 index 0000000000000000000000000000000000000000..32b34ca57e54c2f43741b19e3ea3f67b62c7abfb --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldGroups/Assignments.lean @@ -0,0 +1,123 @@ +import OAI.LinearAlgebra.MatrixMultiplication.FieldGroups.AssignmentCore +import OAI.LinearAlgebra.MatrixMultiplication.FieldGroups.SourceSupport +import OAI.LinearAlgebra.MatrixMultiplication.FieldGroups.CompatibilityTransfer + +namespace OAI + +/-! Group assignments, orbit counts and extraction capacities. -/ + +noncomputable section + +namespace MatrixMultiplication.AllFieldGroupAssignments + +open AllFieldHistory AllFieldHistoryGroupMasks AllFieldHistoryGroupedRecovery +open AllFieldGroupOrbitData AllFieldGroupAssignmentRetention JointCoarseHashing +attribute [local instance] Classical.propDecidable + +variable {K tick : ℕ} + +theorem actualCompatible_own (allocation : Allocation) (m : ℕ) (ε : ℝ) + (sigma : Placement) (t : Triple (Pos (K := K) (tick := tick) allocation m sigma)) + (v : Variable (K := K) (tick := tick) allocation m sigma) + (hc : actualCompatible allocation m ε sigma t v) : + tripleSide v.1 t = ownWord allocation m sigma v.2 := by + obtain ⟨_, rfl, hcompatibility⟩ := hc + exact hcompatibility.1 + +theorem physicalAssignment_coherent (F : Type*) [Field F] + (allocation : Allocation) (m : ℕ) (ε : ℝ) (sigma : Placement) + (k : ℕ) (U : Finset (ZMod (37 ^ k))) + (sample : Sample (Pos (K := K) (tick := tick) allocation m sigma) k) : + JointExtraction.Coherent (groupPreparedSource F allocation m ε sigma) + (physicalAssignment allocation m ε sigma k U sample) := by + intro x y z tx ty tz hT htx hty htz + let a : Fin 3 → Raw (K := K) (tick := tick) allocation m sigma := ![x, y, z] + let physicalTag : Fin 3 → Triple (Pos (K := K) (tick := tick) allocation m sigma) := + ![tx, ty, tz] + let b : Fin 3 → Raw (K := K) (tick := tick) allocation m sigma := fun r => a (sigma r) + let tag : Fin 3 → Triple (Pos (K := K) (tick := tick) allocation m sigma) := + fun r => physicalTag (sigma r) + have hphysical (r : Fin 3) : + assigned allocation m ε sigma k U sample (sigma.symm r, a r) = + some (physicalTag r) := by + fin_cases r + · exact htx + · exact hty + · exact htz + have hassign (r : Fin 3) : + assigned allocation m ε sigma k U sample (r, b r) = some (tag r) := by + simpa only [b, tag, sigma.symm_apply_apply] using hphysical (sigma r) + have hspec (r : Fin 3) := + assigned_spec allocation m ε sigma k U sample (r, b r) (tag r) (hassign r) + let d := data (K := K) (tick := tick) allocation m ε sigma + let hx := JointMaskedSelection.OrbitData.xFlag k U sample + let hy := JointMaskedSelection.OrbitData.yFlag k U sample + let hz := d.zFlag k U sample + have heligible (r : Fin 3) := + (JointCoarseAssignment.mem_eligible_iff d.ambient d.actualTargets hx hy hz (tag r)).mp + (hspec r).1 + let observed : Triple (Pos (K := K) (tick := tick) allocation m sigma) := + reorder sigma (ownWord allocation m sigma x, + ownWord allocation m sigma y, ownWord allocation m sigma z) + have hword (r : Fin 3) : + ownWord allocation m sigma (a r) = + tripleSide r (ownWord allocation m sigma x, + ownWord allocation m sigma y, ownWord allocation m sigma z) := by + fin_cases r <;> rfl + have hobserved (r : Fin 3) : tripleSide r observed = tripleSide r (tag r) := by + calc + tripleSide r observed = ownWord allocation m sigma (b r) := by + rw [show observed = reorder sigma (ownWord allocation m sigma x, + ownWord allocation m sigma y, ownWord allocation m sigma z) from rfl, + tripleSide_reorder] + exact (hword (sigma r)).symm + _ = tripleSide r (tag r) := + (actualCompatible_own allocation m ε sigma (tag r) (r, b r) (hspec r).2.1).symm + have hobsX : observed.1 = (tag 0).1 := hobserved 0 + have hobsY : observed.2.1 = (tag 1).2.1 := hobserved 1 + have hobsZ : observed.2.2 = (tag 2).2.2 := hobserved 2 + have hsurvives : JointCoarseAssignment.survives hx hy hz observed := by + refine ⟨?_, ?_, ?_⟩ + · rw [hobsX] + exact (heligible 0).2.2.1.1 + · rw [hobsY] + exact (heligible 1).2.2.1.2.1 + · rw [hobsZ] + exact (heligible 2).2.2.1.2.2 + have hsupport : observed ∈ d.ambient := + AllFieldGroupSourceSupport.prepared_source_support F allocation m ε sigma x y z hT + have hobs : observed = tag 0 := + (heligible 0).2.2.2 observed hsupport hsurvives hobsX + obtain ⟨e, he, huseX⟩ := (hspec 0).2.2.1 + have hcoarse : reorder sigma (ownWord allocation m sigma (a 0), + ownWord allocation m sigma (a 1), ownWord allocation m sigma (a 2)) = + coarse allocation m sigma e := hobs.trans he.symm + have hraw : groupRawSource F allocation m sigma (a 0) (a 1) (a 2) ≠ 0 := + AllFieldGroupSourceSupport.raw_nonzero F allocation m ε sigma x y z hT + have hcompY : actualCompatible allocation m ε sigma (tag 0) (1, b 1) := + ⟨e, he, AllFieldGroupCompatibilityTransfer.transferY F allocation m ε sigma e a + hraw hcoarse huseX⟩ + have h01 : tag 0 = tag 1 := (hspec 1).2.2.2 (tag 0) (hspec 0).1 hcompY + have huseY : groupIdealSide allocation m ε (sigma 1) sigma e (b 1) := by + apply (actualUseful_coarse allocation m ε sigma e (1, b 1)).mp + rw [he, h01] + exact (hspec 1).2.2.1 + have hcompZ : actualCompatible allocation m ε sigma (tag 0) (2, b 2) := + ⟨e, he, AllFieldGroupCompatibilityTransfer.transferZ F allocation m ε sigma e a + hraw hcoarse huseX huseY⟩ + have h02 : tag 0 = tag 2 := (hspec 2).2.2.2 (tag 0) (hspec 0).1 hcompZ + have htag (r : Fin 3) : tag r = tag 0 := by + fin_cases r + · rfl + · exact h01.symm + · exact h02.symm + have hphysicalTag (r : Fin 3) : physicalTag r = tag 0 := by + simpa only [tag, sigma.apply_symm_apply] using htag (sigma.symm r) + exact ⟨(hphysicalTag 0).trans (hphysicalTag 1).symm, + (hphysicalTag 0).trans (hphysicalTag 2).symm⟩ + +end MatrixMultiplication.AllFieldGroupAssignments + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldGroups/BranchDesignation.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldGroups/BranchDesignation.lean new file mode 100644 index 0000000000000000000000000000000000000000..adbf1bd423789328976d1e175a6a277dfa4cff34 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldGroups/BranchDesignation.lean @@ -0,0 +1,58 @@ +import OAI.LinearAlgebra.MatrixMultiplication.FieldGroups.NativeLaws + +namespace OAI + +/-! Group assignments, orbit counts and extraction capacities. -/ + +noncomputable section + +namespace MatrixMultiplication.AllFieldGroupBranchDesignation + +open AllFieldHistory AllFieldHistoryChildLaws AllFieldGroupOrbitData +open AllFieldGroupNativeLaws +attribute [local instance] Classical.propDecidable Classical.decEq + +def nativeBranchDesignated {K : ℕ} (w : Work K) (right : Bool) + (side : Fin 3) (b : w.Branch) : Prop := + w.stage ≠ 2 ∧ AllFieldNativeCapacity.designated w.priority side + (halfShape w.parentShape (w.splitShape b) right) + +theorem sharing_iff_stage_ne_two {K tick : ℕ} {sigma : Placement} + (h : ActiveOrder K tick sigma) : + sharing h = true ↔ h.val.val.1.stage ≠ 2 := by + rcases h with ⟨⟨⟨work, _⟩, _⟩, _⟩ + cases work <;> simp [sharing, Work.stage] + +theorem order_branch_childWeight {K tick : ℕ} {sigma : Placement} + (right : Bool) (h : ActiveOrder K tick sigma) (side : Fin 3) + (b : h.val.val.1.Branch) : + childWeight right h.val (branchShape h.val.val b) (sigma side) = + (halfShape h.val.val.1.parentShape (h.val.val.1.splitShape b) right) + (h.val.val.1.priority side) := by + rw [← halfShape_childWeight, canonicalChildShape_branchShape, + placement_symm_order_side] + +theorem designated_branchShape {K tick : ℕ} {sigma : Placement} + (right : Bool) (side : Fin 3) (h : ActiveOrder K tick sigma) + (hside : side ≠ 0) (b : h.val.val.1.Branch) : + AllFieldGroupOrbitData.designated right side sigma h (branchShape h.val.val b) ↔ + nativeBranchDesignated h.val.val.1 right side b := by + change (sharing h = true ∧ + (if side = 1 then childWeight right h.val (branchShape h.val.val b) (sigma 2) = 0 + else if side = 2 then + childWeight right h.val (branchShape h.val.val b) (sigma 0) * + childWeight right h.val (branchShape h.val.val b) (sigma 1) = 0 + else False)) ↔ _ + rw [sharing_iff_stage_ne_two] + simp only [order_branch_childWeight, nativeBranchDesignated, + AllFieldNativeCapacity.designated] + fin_cases side + · exact False.elim (hside rfl) + · simp + · simp + +end MatrixMultiplication.AllFieldGroupBranchDesignation + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldGroups/BranchLaws.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldGroups/BranchLaws.lean new file mode 100644 index 0000000000000000000000000000000000000000..3aebd28703e670927904e167215d07fc4018d03f --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldGroups/BranchLaws.lean @@ -0,0 +1,81 @@ +import OAI.LinearAlgebra.MatrixMultiplication.FieldGroups.NativeLaws + +namespace OAI + +/-! Group assignments, orbit counts and extraction capacities. -/ + +noncomputable section + +namespace MatrixMultiplication.AllFieldGroupBranchLaws + +open MatrixMultiplication.Foundation AllFieldParameters AllFieldHistory +open AllFieldHistoryChildLaws AllFieldGroupOrbitData AllFieldActiveLaws +open AllFieldGroupNativeLaws +attribute [local instance] Classical.propDecidable Classical.decEq + +theorem jointCounts_branch_pos {K dilation : ℕ} (allocation : Allocation) + (hd : 0 < dilation) (w : PlacedWork K) (b : w.1.Branch) + (hb : 0 < (branchLaw w.1).mass b) : + 0 < jointCounts allocation dilation w (branchShape w b) := by + have hp : 0 < (population allocation dilation (w.1.source, w.2) : ℝ) := by + exact_mod_cast work_source_population_pos allocation hd w + have hc : 0 < (jointCounts allocation dilation w (branchShape w b) : ℝ) := by + rw [jointCounts_cast, placedLaw_mass_branch] + exact mul_pos hp hb + exact_mod_cast hc + +theorem branchLaw_stageA_mass_pos {K : ℕ} (h : InitialPositive K) + (b : (Work.stageA h).Branch) : + 0 < (branchLaw (Work.stageA h)).mass b := by + change 0 < (stageALaw (initialShape h.val) (aSplit ⟨h, b, false⟩) : ℝ) + exact_mod_cast stageALaw_positive _ _ (aSplit_mem ⟨h, b, false⟩) + +theorem branchLaw_stageB_mass_pos {K : ℕ} (h : APositive K) + (b : (Work.stageB h).Branch) : + 0 < (branchLaw (Work.stageB h)).mass b := by + change 0 < (stageBLaw (aShape h.val) (bSplit ⟨h, b, false⟩) : ℝ) + exact_mod_cast stageBLaw_positive _ _ (bSplit_mem ⟨h, b, false⟩) + +theorem supportedHalfLaw_branchShape_of_mass_pos {K tick : ℕ} {sigma : Placement} + (allocation : Allocation) (right : Bool) (h : ActiveOrder K tick sigma) + (b : h.val.val.1.Branch) (hb : 0 < (branchLaw h.val.val.1).mass b) + (side : Fin 3) : + supportedHalfLaw allocation right h.val (branchShape h.val.val b) (sigma side) = + fun a => (h.val.val.1.childLaw + (halfShape h.val.val.1.parentShape (h.val.val.1.splitShape b) right) + (h.val.val.1.priority side) a : ℝ) := by + have hc : 0 < activeCounts allocation 1 h.val (branchShape h.val.val b) := + jointCounts_branch_pos allocation (by decide) h.val.val b hb + rw [supportedHalfLaw_eq_of_counts_pos allocation 1 right h.val _ hc] + funext a + rw [halfLawAt_eq, canonicalChildShape_branchShape, placement_symm_order_side] + +theorem supportedHalfLaw_branchShape_of_mass_ne_zero {K tick : ℕ} + {sigma : Placement} (allocation : Allocation) (right : Bool) + (h : ActiveOrder K tick sigma) (b : h.val.val.1.Branch) + (hb : (branchLaw h.val.val.1).mass b ≠ 0) (side : Fin 3) : + supportedHalfLaw allocation right h.val (branchShape h.val.val b) (sigma side) = + fun a => (h.val.val.1.childLaw + (halfShape h.val.val.1.parentShape (h.val.val.1.splitShape b) right) + (h.val.val.1.priority side) a : ℝ) := by + exact supportedHalfLaw_branchShape_of_mass_pos allocation right h b + (lt_of_le_of_ne ((branchLaw h.val.val.1).nonneg b) (Ne.symm hb)) side + +theorem weighted_supportedHalfLaw_branchShape {K tick : ℕ} {sigma : Placement} + (allocation : Allocation) (right : Bool) (h : ActiveOrder K tick sigma) + (b : h.val.val.1.Branch) (side : Fin 3) (a : Statistic h.val) : + (branchLaw h.val.val.1).mass b * + supportedHalfLaw allocation right h.val (branchShape h.val.val b) (sigma side) a = + (branchLaw h.val.val.1).mass b * + (h.val.val.1.childLaw + (halfShape h.val.val.1.parentShape (h.val.val.1.splitShape b) right) + (h.val.val.1.priority side) a : ℝ) := by + by_cases hb : (branchLaw h.val.val.1).mass b = 0 + · simp only [hb, zero_mul] + · rw [supportedHalfLaw_branchShape_of_mass_ne_zero allocation right h b hb side] + +end MatrixMultiplication.AllFieldGroupBranchLaws + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldGroups/Compatibility.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldGroups/Compatibility.lean new file mode 100644 index 0000000000000000000000000000000000000000..5a6f02cfb2d3266498d1aa66622cc5888c311de9 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldGroups/Compatibility.lean @@ -0,0 +1,76 @@ +import OAI.LinearAlgebra.MatrixMultiplication.FieldGroups.NativeLaws + +namespace OAI + +/-! Group assignments, orbit counts and extraction capacities. -/ + +noncomputable section + +namespace MatrixMultiplication.AllFieldGroupCompatibility + +open AllFieldHistory AllFieldHistoryChildLaws AllFieldHistoryGroupMasks +open AllFieldHistoryGroupedRecovery AllFieldGroupOrbitData +open JointPopulation JointCanonicalization + +attribute [local instance] Classical.propDecidable + +variable {K tick : ℕ} + +theorem groupIdealSide_ownWord (allocation : Allocation) (m : ℕ) (ε : ℝ) + (sigma : Placement) (side : Fin 3) + (e : Targets (K := K) (tick := tick) allocation m sigma) + (w : Raw (K := K) (tick := tick) allocation m sigma) + (hw : groupIdealSide allocation m ε (sigma side) sigma e w) : + tripleSide side (AllFieldGroupOrbitData.coarse allocation m sigma e) = + ownWord allocation m sigma w := by + change tripleSide side + (reorder sigma (triple (Counts (K := K) (tick := tick) allocation m sigma) e)) = _ + rw [tripleSide_reorder] + funext p + have hs : tripleSide (sigma side) + (triple (Counts (K := K) (tick := tick) allocation m sigma) e) p = + shapeSide (sigma side) ((e p.1).val p.2) := by + generalize sigma side = s + fin_cases s <;> rfl + rw [hs] + exact (hw.1 p.1 p.2).symm + +theorem groupIdealSide_fineCompatible (allocation : Allocation) (m : ℕ) (ε : ℝ) + (sigma : Placement) (side : Fin 3) + (e : Targets (K := K) (tick := tick) allocation m sigma) + (w : Raw (K := K) (tick := tick) allocation m sigma) + (hw : groupIdealSide allocation m ε (sigma side) sigma e w) : + fineCompatible allocation m ε sigma side e w := by + intro right h u hd + apply JointPopulationCompatibility.shape_count_window_of_typeWindow + (Counts (K := K) (tick := tick) allocation m sigma) e h u + (fun i => statistic h.val (if right then (w h i).2 else (w h i).1)) + (compatibilityLaw right side sigma h u) (AllFieldHistoryMasks.childWidth ε h.val) + intro hu + rw [AllFieldGroupNativeLaws.compatibilityLaw_eq allocation m sigma right side h u hu hd] + cases right + · exact (hw.2 h u hu).1 + · exact (hw.2 h u hu).2 + +theorem groupIdealSide_compatible (allocation : Allocation) (m : ℕ) (ε : ℝ) + (sigma : Placement) (side : Fin 3) + (e : Targets (K := K) (tick := tick) allocation m sigma) + (w : Raw (K := K) (tick := tick) allocation m sigma) + (hw : groupIdealSide allocation m ε (sigma side) sigma e w) : + Compatible allocation m ε sigma side e w := + ⟨groupIdealSide_ownWord allocation m ε sigma side e w hw, + groupIdealSide_fineCompatible allocation m ε sigma side e w hw⟩ + +theorem admissible_compatible (allocation : Allocation) (m : ℕ) (ε : ℝ) + (sigma : Placement) (side : Fin 3) + (e : Targets (K := K) (tick := tick) allocation m sigma) + (w : Raw (K := K) (tick := tick) allocation m sigma) + (hw : Admissible allocation m ε sigma side e w) : + Compatible allocation m ε sigma side e w := + groupIdealSide_compatible allocation m ε sigma side e w hw.1 + +end MatrixMultiplication.AllFieldGroupCompatibility + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldGroups/CompatibilityTransfer.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldGroups/CompatibilityTransfer.lean new file mode 100644 index 0000000000000000000000000000000000000000..dce24cc08ae4f55de897929431d757c1979c3d35 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldGroups/CompatibilityTransfer.lean @@ -0,0 +1,213 @@ +import OAI.LinearAlgebra.MatrixMultiplication.FieldGroups.OrbitData +import OAI.LinearAlgebra.MatrixMultiplication.JointExtraction.PopulationCWNonzero +import OAI.LinearAlgebra.MatrixMultiplication.CoppersmithWinograd.CWShapePhysicalPermutation +import OAI.LinearAlgebra.MatrixMultiplication.FieldGroups.StatisticComplement + +namespace OAI + +/-! Group assignments, orbit counts and extraction capacities. -/ + +noncomputable section + +namespace MatrixMultiplication.AllFieldGroupCompatibilityTransfer + +open MatrixMultiplication.Foundation AllFieldHistory AllFieldHistoryChildLaws +open AllFieldHistoryGroupMasks AllFieldHistoryGroupedRecovery AllFieldGroupOrbitData +open JointPopulation JointCanonicalization JointCanonicalCW CWStrands InheritedMasks +open scoped BigOperators + +attribute [local instance] Classical.propDecidable + +variable {K tick : ℕ} {sigma : Placement} + +theorem physical_coarseMask (allocation : Allocation) (m : ℕ) (sigma : Placement) + (e : Targets (K := K) (tick := tick) allocation m sigma) + (a : Fin 3 → Raw (K := K) (tick := tick) allocation m sigma) + (hcoarse : reorder sigma (ownWord allocation m sigma (a 0), + ownWord allocation m sigma (a 1), ownWord allocation m sigma (a 2)) = + AllFieldGroupOrbitData.coarse allocation m sigma e) + (s : Fin 3) : + coarseMask (Counts allocation m sigma) + (fun h => Fin (activeHalfLength h.val) → Fin 7) + (fun h => Fin (activeHalfLength h.val) → Fin 7) + groupCoarse s e (a s) := by + have ht := reorder_injective sigma hcoarse + intro h i + have he := congrArg (fun t => tripleSide s t ⟨h, i⟩) ht + fin_cases s <;> exact he + +def halfShape (right : Bool) (h : ActiveOrder K tick sigma) + (u : JointPopulation.Shape) : Fin 3 → ℕ := + if right then activeParentShape h.val - shapeNat u else shapeNat u + +def halfLaw (right : Bool) (side : Fin 3) (h : ActiveOrder K tick sigma) + (u : JointPopulation.Shape) : Statistic h.val → ℝ := + if right then rightLaw h.val u side else leftLaw h.val u side + +theorem physical_half_product_nonzero (F : Type*) [Field F] + (allocation : Allocation) (m : ℕ) (sigma : Placement) + (e : Targets (K := K) (tick := tick) allocation m sigma) + (a : Fin 3 → Raw (K := K) (tick := tick) allocation m sigma) + (hraw : groupRawSource F allocation m sigma (a 0) (a 1) (a 2) ≠ 0) + (hcoarse : reorder sigma (ownWord allocation m sigma (a 0), + ownWord allocation m sigma (a 1), ownWord allocation m sigma (a 2)) = + AllFieldGroupOrbitData.coarse allocation m sigma e) + (right : Bool) (h : ActiveOrder K tick sigma) (u : JointPopulation.Shape) + (hu : 0 < Counts allocation m sigma h u) : + (∏ i : Class (Counts allocation m sigma) e h u, + shapeTensor (F := F) (Fin (activeHalfLength h.val)) (halfShape right h u) + (if right then (a 0 h i.val).2 else (a 0 h i.val).1) + (if right then (a 1 h i.val).2 else (a 1 h i.val).1) + (if right then (a 2 h i.val).2 else (a 2 h i.val).1)) ≠ 0 := by + have hsupp : ∀ (h : ActiveOrder K tick sigma) (u : JointPopulation.Shape), + 0 < Counts allocation m sigma h u → + ∀ s, shapeNat u s ≤ activeParentShape h.val s := by + intro h u hu s + exact jointCounts_support_le allocation m h.val.val u hu s + have hsource : sourceTensor (F := F) (Counts (K := K) (tick := tick) allocation m sigma) + (Left (fun h => activeHalfLength h.val)) (Right (fun h => activeHalfLength h.val)) + (parentTensor (F := F) (fun h : ActiveOrder K tick sigma => activeHalfLength h.val) + (fun h : ActiveOrder K tick sigma => activeHalfLength h.val) + (fun h : ActiveOrder K tick sigma => activeParentShape h.val)) + (a 0) (a 1) (a 2) ≠ 0 := by + exact hraw + have hp := JointPopulationCWNonzero.class_half_products_nonzero + (Counts allocation m sigma) (fun h => activeHalfLength h.val) + (fun h => activeHalfLength h.val) (fun h => activeParentShape h.val) + (fun h => AllFieldHistoryRecovery.halfLength_le_eight h.val) hsupp e + (a 0) (a 1) (a 2) hsource + (physical_coarseMask allocation m sigma e a hcoarse 0) + (physical_coarseMask allocation m sigma e a hcoarse 1) + (physical_coarseMask allocation m sigma e a hcoarse 2) h u hu + cases right + · exact hp.1 + · exact hp.2 + +theorem priority_half_product_nonzero (F : Type*) [Field F] + (allocation : Allocation) (m : ℕ) (sigma : Placement) + (e : Targets (K := K) (tick := tick) allocation m sigma) + (a : Fin 3 → Raw (K := K) (tick := tick) allocation m sigma) + (hraw : groupRawSource F allocation m sigma (a 0) (a 1) (a 2) ≠ 0) + (hcoarse : reorder sigma (ownWord allocation m sigma (a 0), + ownWord allocation m sigma (a 1), ownWord allocation m sigma (a 2)) = + AllFieldGroupOrbitData.coarse allocation m sigma e) + (right : Bool) (h : ActiveOrder K tick sigma) (u : JointPopulation.Shape) + (hu : 0 < Counts allocation m sigma h u) : + (∏ i : Class (Counts allocation m sigma) e h u, + shapeTensor (F := F) (Fin (activeHalfLength h.val)) (halfShape right h u ∘ sigma) + (if right then (a (sigma 0) h i.val).2 else (a (sigma 0) h i.val).1) + (if right then (a (sigma 1) h i.val).2 else (a (sigma 1) h i.val).1) + (if right then (a (sigma 2) h i.val).2 else (a (sigma 2) h i.val).1)) ≠ 0 := by + have he := fun i : Class (Counts allocation m sigma) e h u => + CWShapePhysicalPermutation.shapeTensor_permute (F := F) sigma (halfShape right h u) + (fun s => if right then (a s h i.val).2 else (a s h i.val).1) + simp_rw [he] + exact physical_half_product_nonzero F allocation m sigma e a hraw hcoarse right h u hu + +theorem useful_half_window (allocation : Allocation) (m : ℕ) (ε : ℝ) + (sigma : Placement) (s : Fin 3) + (e : Targets (K := K) (tick := tick) allocation m sigma) + (w : Raw (K := K) (tick := tick) allocation m sigma) + (hw : groupIdealSide allocation m ε s sigma e w) + (right : Bool) (h : ActiveOrder K tick sigma) (u : JointPopulation.Shape) + (hu : 0 < Counts allocation m sigma h u) : + typeWindow (halfLaw right s h u) (AllFieldHistoryMasks.childWidth ε h.val) + (fun i : Class (Counts allocation m sigma) e h u => + statistic h.val (if right then (w h i.val).2 else (w h i.val).1)) := by + cases right + · exact (hw.2 h u hu).1 + · exact (hw.2 h u hu).2 + +theorem own_coarse_guard (allocation : Allocation) (m : ℕ) (sigma : Placement) + (e : Targets (K := K) (tick := tick) allocation m sigma) + (a : Fin 3 → Raw (K := K) (tick := tick) allocation m sigma) + (hcoarse : reorder sigma (ownWord allocation m sigma (a 0), + ownWord allocation m sigma (a 1), ownWord allocation m sigma (a 2)) = + AllFieldGroupOrbitData.coarse allocation m sigma e) + (side : Fin 3) : + tripleSide side (AllFieldGroupOrbitData.coarse allocation m sigma e) = + ownWord allocation m sigma (a (sigma side)) := by + rw [← hcoarse, tripleSide_reorder] + generalize sigma side = s + fin_cases s <;> rfl + +theorem transferY (F : Type*) [Field F] (allocation : Allocation) (m : ℕ) (ε : ℝ) + (sigma : Placement) (e : Targets (K := K) (tick := tick) allocation m sigma) + (a : Fin 3 → Raw (K := K) (tick := tick) allocation m sigma) + (hraw : groupRawSource F allocation m sigma (a 0) (a 1) (a 2) ≠ 0) + (hcoarse : reorder sigma (ownWord allocation m sigma (a 0), + ownWord allocation m sigma (a 1), ownWord allocation m sigma (a 2)) = + AllFieldGroupOrbitData.coarse allocation m sigma e) + (huseX : groupIdealSide allocation m ε (sigma 0) sigma e (a (sigma 0))) : + Compatible allocation m ε sigma 1 e (a (sigma 1)) := by + refine ⟨own_coarse_guard allocation m sigma e a hcoarse 1, ?_⟩ + intro right h u hd + apply JointPopulationCompatibility.shape_count_window_of_typeWindow + (Counts allocation m sigma) e h u _ _ _ + intro hu + have hz : halfShape right h u (sigma 2) = 0 := by + cases right <;> simpa [designated, halfShape, shapeNat] using hd.2 + have hw := CWStrandCompatibility.zeroZ_transfer + (fun _ : Class (Counts allocation m sigma) e h u => halfShape right h u ∘ sigma) + (fun i => if right then (a (sigma 0) h i.val).2 else (a (sigma 0) h i.val).1) + (fun i => if right then (a (sigma 1) h i.val).2 else (a (sigma 1) h i.val).1) + (fun i => if right then (a (sigma 2) h i.val).2 else (a (sigma 2) h i.val).1) + (priority_half_product_nonzero F allocation m sigma e a hraw hcoarse right h u hu) + (statistic h.val) (complement h) + (AllFieldGroupStatisticComplement.statistic_wordComplement h) + (halfLaw right (sigma 0) h u) (AllFieldHistoryMasks.childWidth ε h.val) + (fun _ => hz) (useful_half_window allocation m ε sigma (sigma 0) e _ huseX right h u hu) + simpa [compatibilityLaw, halfLaw] using hw + +theorem transferZ (F : Type*) [Field F] (allocation : Allocation) (m : ℕ) (ε : ℝ) + (sigma : Placement) (e : Targets (K := K) (tick := tick) allocation m sigma) + (a : Fin 3 → Raw (K := K) (tick := tick) allocation m sigma) + (hraw : groupRawSource F allocation m sigma (a 0) (a 1) (a 2) ≠ 0) + (hcoarse : reorder sigma (ownWord allocation m sigma (a 0), + ownWord allocation m sigma (a 1), ownWord allocation m sigma (a 2)) = + AllFieldGroupOrbitData.coarse allocation m sigma e) + (huseX : groupIdealSide allocation m ε (sigma 0) sigma e (a (sigma 0))) + (huseY : groupIdealSide allocation m ε (sigma 1) sigma e (a (sigma 1))) : + Compatible allocation m ε sigma 2 e (a (sigma 2)) := by + refine ⟨own_coarse_guard allocation m sigma e a hcoarse 2, ?_⟩ + intro right h u hd + apply JointPopulationCompatibility.shape_count_window_of_typeWindow + (Counts allocation m sigma) e h u _ _ _ + intro hu + have hz : halfShape right h u (sigma 0) * halfShape right h u (sigma 1) = 0 := by + cases right <;> simpa [designated, halfShape, shapeNat] using hd.2 + have hp := priority_half_product_nonzero F allocation m sigma e a hraw hcoarse right h u hu + by_cases hy : halfShape right h u (sigma 1) = 0 + · have hw := CWStrandCompatibility.zeroY_transfer + (fun _ : Class (Counts allocation m sigma) e h u => halfShape right h u ∘ sigma) + (fun i => if right then (a (sigma 0) h i.val).2 else (a (sigma 0) h i.val).1) + (fun i => if right then (a (sigma 1) h i.val).2 else (a (sigma 1) h i.val).1) + (fun i => if right then (a (sigma 2) h i.val).2 else (a (sigma 2) h i.val).1) + hp (statistic h.val) (complement h) + (AllFieldGroupStatisticComplement.statistic_wordComplement h) + (halfLaw right (sigma 0) h u) (AllFieldHistoryMasks.childWidth ε h.val) + (fun _ => hy) (useful_half_window allocation m ε sigma (sigma 0) e _ huseX right h u hu) + have hy' : (if right then activeParentShape h.val (sigma 1) - + (shapeSide (sigma 1) u).val else (shapeSide (sigma 1) u).val) = 0 := by + cases right <;> simpa [halfShape, shapeNat] using hy + simpa [compatibilityLaw, halfLaw, hy'] using hw + · have hx : halfShape right h u (sigma 0) = 0 := (Nat.mul_eq_zero.mp hz).resolve_right hy + have hw := CWStrandCompatibility.zeroX_transfer + (fun _ : Class (Counts allocation m sigma) e h u => halfShape right h u ∘ sigma) + (fun i => if right then (a (sigma 0) h i.val).2 else (a (sigma 0) h i.val).1) + (fun i => if right then (a (sigma 1) h i.val).2 else (a (sigma 1) h i.val).1) + (fun i => if right then (a (sigma 2) h i.val).2 else (a (sigma 2) h i.val).1) + hp (statistic h.val) (complement h) + (AllFieldGroupStatisticComplement.statistic_wordComplement h) + (halfLaw right (sigma 1) h u) (AllFieldHistoryMasks.childWidth ε h.val) + (fun _ => hx) (useful_half_window allocation m ε sigma (sigma 1) e _ huseY right h u hu) + have hy' : (if right then activeParentShape h.val (sigma 1) - + (shapeSide (sigma 1) u).val else (shapeSide (sigma 1) u).val) ≠ 0 := by + cases right <;> simpa [halfShape, shapeNat] using hy + simpa [compatibilityLaw, halfLaw, hy'] using hw + +end MatrixMultiplication.AllFieldGroupCompatibilityTransfer + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldGroups/CountRate.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldGroups/CountRate.lean new file mode 100644 index 0000000000000000000000000000000000000000..d1b0521d18e4a7a69b3ec457316c11268f27606a --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldGroups/CountRate.lean @@ -0,0 +1,167 @@ +import OAI.LinearAlgebra.MatrixMultiplication.FieldGroups.DegreeLaws +import OAI.LinearAlgebra.MatrixMultiplication.FieldGroups.PairWindows +import OAI.LinearAlgebra.MatrixMultiplication.JointExtraction.CompatibilityCountProducer +import OAI.LinearAlgebra.MatrixMultiplication.JointExtraction.PairMixtureControls + +namespace OAI + +/-! Group assignments, orbit counts and extraction capacities. -/ + +noncomputable section + +namespace MatrixMultiplication.AllFieldGroupCountRate + +open AllFieldHistory AllFieldHistorySupport AllFieldHistoryChildLaws +open AllFieldGroupOrbitData AllFieldGroupDegrees AllFieldGroupDegreeLaws +open AllFieldGroupNativeLaws AllFieldGroupPairWindows +open JointCompatibilityControls JointCompatibilityScaling JointCompatibilityRateLimit +open JointPopulationCompatibility JointTypeCounts MatrixMultiplication.Foundation Filter +open scoped BigOperators Topology +attribute [local instance] Classical.propDecidable Classical.decEq + +variable {K tick : ℕ} + +def nativeCompatibilityRate (allocation : Allocation) (sigma : Placement) (side : Fin 3) : ℝ := + compatibilityRate (base (K := K) (tick := tick) allocation sigma side) + (q allocation sigma side) + (classDesignated false side sigma) (classDesignated true side sigma) + (groupCap (base allocation sigma side) (classDesignated false side sigma) + (nativeLaw allocation false side sigma) 0) + (groupCap (base allocation sigma side) (classDesignated true side sigma) + (nativeLaw allocation true side sigma) 0) + +theorem base_positive_counts (allocation : Allocation) (sigma : Placement) (side : Fin 3) + (c : Class (K := K) (tick := tick) sigma) (u : JointPopulation.Shape) + (hu : 0 < base allocation sigma side c u) : + 0 < Counts (K := K) (tick := tick) allocation 1 sigma c.1 u := by + unfold base classCounts at hu + split_ifs at hu with hs + · exact hu + · exact (Nat.lt_irrefl 0 hu).elim + +theorem nativeLaw_normalized (allocation : Allocation) (right : Bool) + (sigma : Placement) (side : Fin 3) + (c : Class (K := K) (tick := tick) sigma) (u : JointPopulation.Shape) + (hu : 0 < base allocation sigma side c u) : + ∑ a, nativeLaw allocation right side sigma c u a = 1 := by + have hp := base_positive_counts allocation sigma side c u hu + simp only [nativeLaw, + supportedHalfLaw_eq_of_counts_pos allocation 1 right c.1.val u hp (sigma side)] + exact halfLawAt_normalized allocation 1 right c.1.val u hp (sigma side) + +theorem classCounts_dilation (allocation : Allocation) (m : ℕ) + (sigma : Placement) (side : Fin 3) : + classCounts (Counts (K := K) (tick := tick) allocation m sigma) (sigma side) = + fun c u => m * base allocation sigma side c u := by + funext c u + change (if JointPopulation.shapeSide (sigma side) u = c.2 then + activeCounts allocation m c.1.val u else 0) = + m * (if JointPopulation.shapeSide (sigma side) u = c.2 then + activeCounts allocation 1 c.1.val u else 0) + rw [activeCounts_dilation] + split_ifs <;> simp + +theorem exists_widths_eventually_nativeCount_le (allocation : Allocation) (sigma : Placement) + (side : Fin 3) {δ χMax ηMax : ℝ} + (hδ : 0 < δ) (hχMax : 0 < χMax) (hηMax : 0 < ηMax) : + ∃ χ η : ℝ, 0 < χ ∧ χ ≤ χMax ∧ 0 < η ∧ η ≤ ηMax ∧ + ∀ᶠ m : ℕ in atTop, + ∀ (e : Targets (K := K) (tick := tick) allocation m sigma) + (w : Raw (K := K) (tick := tick) allocation m sigma), + (∀ h j, JointPopulation.shapeSide (sigma side) ((e h).val j) = + ownWord allocation m sigma w ⟨h, j⟩) → + PairWindow (base allocation sigma side) (q allocation sigma side) + (Positions (K := K) (tick := tick) allocation m sigma w) (pairCounts allocation m sigma w) η → + (nativeCount allocation m χ sigma side w : ℝ) ≤ + Real.exp ((m : ℝ) * + (nativeCompatibilityRate (K := K) (tick := tick) allocation sigma side + δ)) := by + have hparts : ∀ c : Class (K := K) (tick := tick) sigma, + Function.Injective (fun a : Symbol (K := K) (tick := tick) sigma c × Symbol (K := K) (tick := tick) sigma c => (a.1, a.2)) := + fun _ => fun _ _ h => h + have hleft : ∀ (c : Class (K := K) (tick := tick) sigma) (a : Symbol (K := K) (tick := tick) sigma c), + (baseSize (base allocation sigma side) c : ℝ) * + (∑ b : {b : Symbol (K := K) (tick := tick) sigma c × Symbol (K := K) (tick := tick) sigma c // b.1 = a}, q allocation sigma side c b.val) = + totalCenterCount (base allocation sigma side) (nativeLaw allocation false side sigma) c a := by + intro c a + exact JointPairMixtureControls.pairMixture_left_balance + (base allocation sigma side) (nativeLaw allocation false side sigma) + (nativeLaw allocation true side sigma) + (nativeLaw_normalized allocation true sigma side) c a + have hright : ∀ (c : Class (K := K) (tick := tick) sigma) (a : Symbol (K := K) (tick := tick) sigma c), + (baseSize (base allocation sigma side) c : ℝ) * + (∑ b : {b : Symbol (K := K) (tick := tick) sigma c × Symbol (K := K) (tick := tick) sigma c // b.2 = a}, q allocation sigma side c b.val) = + totalCenterCount (base allocation sigma side) (nativeLaw allocation true side sigma) c a := by + intro c a + exact JointPairMixtureControls.pairMixture_right_balance + (base allocation sigma side) (nativeLaw allocation false side sigma) + (nativeLaw allocation true side sigma) + (nativeLaw_normalized allocation false sigma side) c a + obtain ⟨χ, η, hχ, hχMax', hη, hηMax', hbound⟩ := + JointCompatibilityCountProducer.exists_widths_eventually_count_le + (base allocation sigma side) (q allocation sigma side) + (fun _ p => p.1) (fun _ p => p.2) + (classDesignated false side sigma) (classDesignated true side sigma) + (nativeLaw allocation false side sigma) (nativeLaw allocation true side sigma) + hparts + (fun c u a => (nativeLaw_bounds allocation false side sigma c u a).1) + (fun c u a => (nativeLaw_bounds allocation false side sigma c u a).2) + (fun c u a => (nativeLaw_bounds allocation true side sigma c u a).1) + (fun c u a => (nativeLaw_bounds allocation true side sigma c u a).2) + hleft hright hδ hχMax hηMax + refine ⟨χ, η, hχ, hχMax', hη, hηMax', ?_⟩ + filter_upwards [hbound] with m hm + intro e w hown hwindow + rw [← classCounts_dilation allocation m sigma side] at hm + let target : FixedSideTargets (Counts (K := K) (tick := tick) allocation m sigma) (sigma side) + (ownWord allocation m sigma w) := ⟨e, hown⟩ + have hb := (hm (Positions (K := K) (tick := tick) allocation m sigma w) (pairCounts allocation m sigma w) + (candidateEquiv (Counts (K := K) (tick := tick) allocation m sigma) (sigma side) + (ownWord allocation m sigma w) target) + (statisticElement (Counts (K := K) (tick := tick) allocation m sigma) (Letter (K := K) (tick := tick) sigma) (Letter (K := K) (tick := tick) sigma) + (Symbol (K := K) (tick := tick) sigma) (Symbol (K := K) (tick := tick) sigma) (projectedStatistic sigma) (projectedStatistic sigma) + (ownWord allocation m sigma w) w) hwindow).1 + rw [nativeCount, compatibleTargetCount_eq_kernel] + exact hb + +theorem exists_threshold_eventually_competitors_le (allocation : Allocation) + (sigma : Placement) (side : Fin 3) {δ widthMax : ℝ} + (hδ : 0 < δ) (hwidthMax : 0 < widthMax) : + ∃ threshold : ℝ, 0 < threshold ∧ threshold ≤ widthMax ∧ + ∀ width : ℝ, 0 < width → width ≤ threshold → + ∀ᶠ m : ℕ in atTop, + ∀ (e : Targets (K := K) (tick := tick) allocation m sigma) + (o : Orbit (K := K) (tick := tick) allocation m sigma), o ∈ (data allocation m width sigma).orbits e → + ∀ w : Raw (K := K) (tick := tick) allocation m sigma, + (side, w) ∈ (data allocation m width sigma).passing e o → + ((competitors allocation m width sigma e o (side, w)).card : ℝ) ≤ + Real.exp ((m : ℝ) * + (nativeCompatibilityRate (K := K) (tick := tick) allocation sigma side + δ)) := by + obtain ⟨χ, η, hχ, hχMax, hη, _, hbound⟩ := + exists_widths_eventually_nativeCount_le (K := K) (tick := tick) + allocation sigma side (ηMax := 1) hδ hwidthMax zero_lt_one + let threshold := min χ (η / windowFactor (K := K) (tick := tick) allocation sigma) + have hf := windowFactor_pos (K := K) (tick := tick) allocation sigma + have ht : 0 < threshold := lt_min hχ (div_pos hη hf) + refine ⟨threshold, ht, (min_le_left _ _).trans hχMax, ?_⟩ + intro width hw hwt + have hwχ : width ≤ χ := hwt.trans (min_le_left _ _) + have hww : windowFactor (K := K) (tick := tick) allocation sigma * width ≤ η := by + have hh := (le_div_iff₀ hf).mp (hwt.trans (min_le_right _ _)) + simpa only [mul_comm] using hh + filter_upwards [hbound, eventually_gt_atTop (0 : ℕ)] with m hm hmpos + intro e o ho w hpass + have ha := AllFieldGroupAdmissible.full_admissible allocation m width sigma + e o ho (side, w) ((data allocation m width sigma).passing_subset e o ho hpass) + have hp := passing_pairWindow allocation hmpos hw.le sigma e o ho (side, w) hpass + have hpair : PairWindow (base allocation sigma side) (q allocation sigma side) + (Positions (K := K) (tick := tick) allocation m sigma w) (pairCounts allocation m sigma w) η := + fun c hc a => (hp c hc a).trans hww + have hc := hm e w (fun h j => (ha.1.1 h j).symm) hpair + exact (Nat.cast_le.mpr (competitors_card_le_nativeCount allocation m hw.le hwχ sigma + e o (side, w))).trans hc + +end MatrixMultiplication.AllFieldGroupCountRate + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldGroups/DegreeEnvelope.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldGroups/DegreeEnvelope.lean new file mode 100644 index 0000000000000000000000000000000000000000..40dec17e7946fa3a2f4afa9868d798315a2032d8 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldGroups/DegreeEnvelope.lean @@ -0,0 +1,122 @@ +import OAI.LinearAlgebra.MatrixMultiplication.FieldGroups.OrbitData +import OAI.LinearAlgebra.MatrixMultiplication.JointExtraction.MaskedRates + +namespace OAI + +/-! Group assignments, orbit counts and extraction capacities. -/ + +noncomputable section + +namespace MatrixMultiplication.AllFieldGroupDegreeEnvelope + +open AllFieldHistory AllFieldGroupOrbitData Filter +open scoped Topology +attribute [local instance] Classical.propDecidable + +variable {K tick : ℕ} + +def variableDegree (allocation : Allocation) (m : ℕ) (width : ℝ) + (sigma : Placement) (e : Targets (K := K) (tick := tick) allocation m sigma) : ℕ := + ((data (K := K) (tick := tick) allocation m width sigma).orbits e).sup fun o => + ((data (K := K) (tick := tick) allocation m width sigma).passing e o).sup fun v => + ((data (K := K) (tick := tick) allocation m width sigma).competitors e o v).card + +def uniformDegree (allocation : Allocation) (m : ℕ) (width : ℝ) + (sigma : Placement) : ℕ := + Finset.univ.sup fun e : Targets (K := K) (tick := tick) allocation m sigma => + max ((data (K := K) (tick := tick) allocation m width sigma).eligibilityCompetitors e).card + (variableDegree (K := K) (tick := tick) allocation m width sigma e) + +theorem eligibility_card_le (allocation : Allocation) (m : ℕ) (width : ℝ) + (sigma : Placement) (e : Targets (K := K) (tick := tick) allocation m sigma) : + ((data (K := K) (tick := tick) allocation m width sigma).eligibilityCompetitors e).card ≤ + uniformDegree (K := K) (tick := tick) allocation m width sigma := + (le_max_left _ _).trans (Finset.le_sup (f := fun e => + max ((data (K := K) (tick := tick) allocation m width sigma).eligibilityCompetitors e).card + (variableDegree (K := K) (tick := tick) allocation m width sigma e)) (Finset.mem_univ e)) + +theorem competitors_card_le (allocation : Allocation) (m : ℕ) (width : ℝ) + (sigma : Placement) (e : Targets (K := K) (tick := tick) allocation m sigma) + (o : Orbit (K := K) (tick := tick) allocation m sigma) (ho : o ∈ (data (K := K) (tick := tick) allocation m width sigma).orbits e) + (v : Variable (K := K) (tick := tick) allocation m sigma) (hv : v ∈ (data (K := K) (tick := tick) allocation m width sigma).passing e o) : + ((data (K := K) (tick := tick) allocation m width sigma).competitors e o v).card ≤ + uniformDegree (K := K) (tick := tick) allocation m width sigma := by + have hvle := Finset.le_sup (f := fun v => + ((data (K := K) (tick := tick) allocation m width sigma).competitors e o v).card) hv + have hole := Finset.le_sup (f := fun o => + ((data (K := K) (tick := tick) allocation m width sigma).passing e o).sup fun v => + ((data (K := K) (tick := tick) allocation m width sigma).competitors e o v).card) ho + have hel := Finset.le_sup (f := fun e => + max ((data (K := K) (tick := tick) allocation m width sigma).eligibilityCompetitors e).card + (variableDegree (K := K) (tick := tick) allocation m width sigma e)) (Finset.mem_univ e) + exact hvle.trans (hole.trans ((le_max_right _ _).trans hel)) + +private theorem cast_max_le {a b : ℕ} {R : ℝ} + (ha : (a : ℝ) ≤ R) (hb : (b : ℝ) ≤ R) : ((max a b : ℕ) : ℝ) ≤ R := by + rcases le_total a b with hab | hba + · simpa only [max_eq_right hab] using hb + · simpa only [max_eq_left hba] using ha + +private theorem cast_sup_le {I : Type*} (s : Finset I) (f : I → ℕ) + {R : ℝ} (hR : 0 ≤ R) (hs : ∀ i ∈ s, (f i : ℝ) ≤ R) : + ((s.sup f : ℕ) : ℝ) ≤ R := by + classical + revert hs + induction s using Finset.induction_on with + | empty => + intro _ + simpa using hR + | @insert a s _ ih => + intro hs + rw [Finset.sup_insert] + exact cast_max_le (hs a (Finset.mem_insert_self a s)) + (ih (fun i hi => hs i (Finset.mem_insert_of_mem hi))) + +theorem uniformDegree_real_le (allocation : Allocation) (m : ℕ) (width : ℝ) + (sigma : Placement) {R : ℝ} (hR : 0 ≤ R) + (heligibility : ∀ e : Targets (K := K) (tick := tick) allocation m sigma, + (((data (K := K) (tick := tick) allocation m width sigma).eligibilityCompetitors e).card : ℝ) ≤ R) + (hcompetitors : ∀ e : Targets (K := K) (tick := tick) allocation m sigma, + ∀ o ∈ (data (K := K) (tick := tick) allocation m width sigma).orbits e, + ∀ v ∈ (data (K := K) (tick := tick) allocation m width sigma).passing e o, + (((data (K := K) (tick := tick) allocation m width sigma).competitors e o v).card : ℝ) ≤ R) : + (uniformDegree (K := K) (tick := tick) allocation m width sigma : ℝ) ≤ R := by + apply cast_sup_le _ _ hR + intro e _ + apply cast_max_le (heligibility e) + apply cast_sup_le _ _ hR + intro o ho + apply cast_sup_le _ _ hR + exact hcompetitors e o ho + +theorem eventually_log_uniformDegree_le (allocation : Allocation) (width : ℝ) + (sigma : Placement) {D : ℝ} (hD : 0 ≤ D) + (hcounts : ∀ᶠ m : ℕ in atTop, + (∀ e : Targets (K := K) (tick := tick) allocation m sigma, + (((data (K := K) (tick := tick) allocation m width sigma).eligibilityCompetitors e).card : ℝ) ≤ + Real.exp ((m : ℝ) * D)) ∧ + (∀ e : Targets (K := K) (tick := tick) allocation m sigma, + ∀ o ∈ (data (K := K) (tick := tick) allocation m width sigma).orbits e, + ∀ v ∈ (data (K := K) (tick := tick) allocation m width sigma).passing e o, + (((data (K := K) (tick := tick) allocation m width sigma).competitors e o v).card : ℝ) ≤ + Real.exp ((m : ℝ) * D))) : + ∀ᶠ m : ℕ in atTop, + Real.log (uniformDegree (K := K) (tick := tick) allocation m width sigma : ℝ) / + (m : ℝ) ≤ D := by + filter_upwards [hcounts, eventually_gt_atTop (0 : ℕ)] with m hm hmp + by_cases hz : uniformDegree (K := K) (tick := tick) allocation m width sigma = 0 + · simpa only [hz, Nat.cast_zero, Real.log_zero, zero_div] using hD + have hd : (0 : ℝ) < uniformDegree (K := K) (tick := tick) allocation m width sigma := by + exact_mod_cast Nat.pos_of_ne_zero hz + have hb := uniformDegree_real_le (K := K) (tick := tick) allocation m width sigma + (Real.exp_pos _).le hm.1 hm.2 + have hl := Real.log_le_log hd hb + rw [Real.log_exp] at hl + have hmpos : (0 : ℝ) < m := by exact_mod_cast hmp + exact (div_le_iff₀ hmpos).mpr (by simpa only [mul_comm] using hl) + +end MatrixMultiplication.AllFieldGroupDegreeEnvelope + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldGroups/DegreeLaws.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldGroups/DegreeLaws.lean new file mode 100644 index 0000000000000000000000000000000000000000..90c2d96d311ca893eb3641f35200feed9ad74444 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldGroups/DegreeLaws.lean @@ -0,0 +1,156 @@ +import OAI.LinearAlgebra.MatrixMultiplication.FieldGroups.Degrees +import OAI.LinearAlgebra.MatrixMultiplication.FieldGroups.NativeLaws +import OAI.LinearAlgebra.MatrixMultiplication.FieldGroups.AmbientDegree + +namespace OAI + +/-! Group assignments, orbit counts and extraction capacities. -/ + +noncomputable section + +namespace MatrixMultiplication.AllFieldGroupDegreeLaws + +open AllFieldHistory AllFieldHistorySupport AllFieldHistoryChildLaws +open AllFieldGroupOrbitData AllFieldGroupDegrees AllFieldGroupNativeLaws +open JointPopulation JointCanonicalization MatrixMultiplication.Foundation Filter +open scoped BigOperators Topology +attribute [local instance] Classical.propDecidable Classical.decEq + +variable {K tick : ℕ} + +def nativeLaw (allocation : Allocation) (right : Bool) (side : Fin 3) + (sigma : Placement) (c : Class (K := K) (tick := tick) sigma) + (u : JointPopulation.Shape) : Symbol (K := K) (tick := tick) sigma c → ℝ := + supportedHalfLaw allocation right c.1.val u (sigma side) + +theorem nativeLaw_bounds (allocation : Allocation) (right : Bool) (side : Fin 3) + (sigma : Placement) (c : Class (K := K) (tick := tick) sigma) + (u : JointPopulation.Shape) (a : Symbol (K := K) (tick := tick) sigma c) : + 0 ≤ nativeLaw allocation right side sigma c u a ∧ + nativeLaw allocation right side sigma c u a ≤ 1 := + supportedHalfLaw_bounds allocation right c.1.val u (sigma side) a + +theorem weighted_classLaw_eq_native (allocation : Allocation) (m : ℕ) + (right : Bool) (side : Fin 3) (sigma : Placement) + (h : ActiveOrder K tick sigma) (u : JointPopulation.Shape) + (hd : designated right side sigma h u) (a : Statistic h.val) : + (Counts (K := K) (tick := tick) allocation m sigma h u : ℝ) * compatibilityLaw right side sigma h u a = + (Counts (K := K) (tick := tick) allocation m sigma h u : ℝ) * + supportedHalfLaw allocation right h.val u (sigma side) a := by + by_cases hp : 0 < Counts (K := K) (tick := tick) allocation m sigma h u + · rw [compatibilityLaw_eq allocation m sigma right side h u hp hd, + supportedHalfLaw_eq_of_counts_pos allocation m right h.val u hp (sigma side)] + rfl + · have hz : Counts (K := K) (tick := tick) allocation m sigma h u = 0 := Nat.eq_zero_of_not_pos hp + simp only [hz, Nat.cast_zero, zero_mul] + +theorem compatible_iff_native (allocation : Allocation) (m : ℕ) (χ : ℝ) + (sigma : Placement) (side : Fin 3) + (e : Targets (K := K) (tick := tick) allocation m sigma) + (w : Raw (K := K) (tick := tick) allocation m sigma) : + JointPopulationCompatibility.Compatible (Counts (K := K) (tick := tick) allocation m sigma) + (Letter (K := K) (tick := tick) sigma) (Letter (K := K) (tick := tick) sigma) (Symbol (K := K) (tick := tick) sigma) (Symbol (K := K) (tick := tick) sigma) + (projectedStatistic sigma) (projectedStatistic sigma) + (classDesignated false side sigma) (classDesignated true side sigma) + (classLaw false side sigma) (classLaw true side sigma) χ (sigma side) e w ↔ + JointPopulationCompatibility.Compatible (Counts (K := K) (tick := tick) allocation m sigma) + (Letter (K := K) (tick := tick) sigma) (Letter (K := K) (tick := tick) sigma) (Symbol (K := K) (tick := tick) sigma) (Symbol (K := K) (tick := tick) sigma) + (projectedStatistic sigma) (projectedStatistic sigma) + (classDesignated false side sigma) (classDesignated true side sigma) + (nativeLaw allocation false side sigma) (nativeLaw allocation true side sigma) + χ (sigma side) e w := by + constructor <;> rintro ⟨hL, hR⟩ <;> constructor + · intro h u hd a + have hh := hL h u hd a + change |_ - (Counts (K := K) (tick := tick) allocation m sigma h u : ℝ) * + supportedHalfLaw allocation false h.val u (sigma side) a| ≤ _ + rw [← weighted_classLaw_eq_native allocation m false side sigma h u hd a] + exact hh + · intro h u hd a + have hh := hR h u hd a + change |_ - (Counts (K := K) (tick := tick) allocation m sigma h u : ℝ) * + supportedHalfLaw allocation true h.val u (sigma side) a| ≤ _ + rw [← weighted_classLaw_eq_native allocation m true side sigma h u hd a] + exact hh + · intro h u hd a + have hh := hL h u hd a + change |_ - (Counts (K := K) (tick := tick) allocation m sigma h u : ℝ) * + compatibilityLaw false side sigma h u a| ≤ _ + rw [weighted_classLaw_eq_native allocation m false side sigma h u hd a] + exact hh + · intro h u hd a + have hh := hR h u hd a + change |_ - (Counts (K := K) (tick := tick) allocation m sigma h u : ℝ) * + compatibilityLaw true side sigma h u a| ≤ _ + rw [weighted_classLaw_eq_native allocation m true side sigma h u hd a] + exact hh + +def nativeCount (allocation : Allocation) (m : ℕ) (χ : ℝ) + (sigma : Placement) (side : Fin 3) (w : Raw (K := K) (tick := tick) allocation m sigma) : ℕ := + JointPopulationCompatibility.compatibleTargetCount (Counts (K := K) (tick := tick) allocation m sigma) + (Letter (K := K) (tick := tick) sigma) (Letter (K := K) (tick := tick) sigma) (Symbol (K := K) (tick := tick) sigma) (Symbol (K := K) (tick := tick) sigma) + (projectedStatistic sigma) (projectedStatistic sigma) + (classDesignated false side sigma) (classDesignated true side sigma) + (nativeLaw allocation false side sigma) (nativeLaw allocation true side sigma) χ + (sigma side) (ownWord allocation m sigma w) w + +theorem conditionalCount_eq_native (allocation : Allocation) (m : ℕ) (χ : ℝ) + (sigma : Placement) (side : Fin 3) (w : Raw (K := K) (tick := tick) allocation m sigma) : + conditionalCount allocation m χ sigma side w = nativeCount allocation m χ sigma side w := by + unfold conditionalCount nativeCount JointPopulationCompatibility.compatibleTargetCount + exact Fintype.card_congr (Equiv.subtypeEquivRight + (fun e : JointPopulationCompatibility.FixedSideTargets + (Counts (K := K) (tick := tick) allocation m sigma) (sigma side) + (ownWord allocation m sigma w) => + compatible_iff_native allocation m χ sigma side e.val w)) + +theorem competitors_card_le_nativeCount (allocation : Allocation) (m : ℕ) + {ε χ : ℝ} (hε : 0 ≤ ε) (hχ : ε ≤ χ) (sigma : Placement) + (e : Targets (K := K) (tick := tick) allocation m sigma) + (o : Orbit (K := K) (tick := tick) allocation m sigma) (v : Variable (K := K) (tick := tick) allocation m sigma) : + (competitors allocation m ε sigma e o v).card ≤ nativeCount allocation m χ sigma v.1 v.2 := by + rw [← conditionalCount_eq_native] + exact competitors_card_le_conditionalCount allocation m hε hχ sigma e o v + +theorem competitors_subset_eligibility_of_first (allocation : Allocation) (m : ℕ) + (width : ℝ) (sigma : Placement) + (e : Targets (K := K) (tick := tick) allocation m sigma) + (o : Orbit (K := K) (tick := tick) allocation m sigma) (v : Variable (K := K) (tick := tick) allocation m sigma) (hv : v.1 = 0) : + competitors allocation m width sigma e o v ⊆ + (data allocation m width sigma).eligibilityCompetitors e := by + intro t ht + apply ((data allocation m width sigma).mem_eligibilityCompetitors e t).2 + refine ⟨competitor_mem allocation m width sigma e o v t ht, + (Finset.mem_filter.mp ht).2.1, ?_⟩ + have hh := (Finset.mem_filter.mp ht).2.2.1 + simpa only [hv, tripleSide, Matrix.cons_val_zero] using! hh + +theorem eventually_eligibility_card_le (allocation : Allocation) (sigma : Placement) + (width : ℝ) {δ : ℝ} (hδ : 0 < δ) : + ∀ᶠ m : ℕ in atTop, ∀ e : Targets (K := K) (tick := tick) allocation m sigma, + (((data allocation m width sigma).eligibilityCompetitors e).card : ℝ) ≤ + Real.exp ((m : ℝ) * + (AllFieldActiveCapacity.orderNativeDegree (K := K) (tick := tick) allocation sigma 0 + δ)) := by + filter_upwards [AllFieldGroupAmbientDegree.eventually_sharedAmbient_first_card_le + (K := K) (tick := tick) allocation sigma hδ] with m hm + intro e + exact (Nat.cast_le.mpr (eligibility_card_le_sharedAmbient allocation m width sigma e)).trans (hm e) + +theorem eventually_first_competitors_card_le (allocation : Allocation) (sigma : Placement) + (width : ℝ) {δ : ℝ} (hδ : 0 < δ) : + ∀ᶠ m : ℕ in atTop, ∀ (e : Targets (K := K) (tick := tick) allocation m sigma) + (o : Orbit (K := K) (tick := tick) allocation m sigma) (v : Variable (K := K) (tick := tick) allocation m sigma), v.1 = 0 → + ((competitors allocation m width sigma e o v).card : ℝ) ≤ + Real.exp ((m : ℝ) * + (AllFieldActiveCapacity.orderNativeDegree (K := K) (tick := tick) allocation sigma 0 + δ)) := by + filter_upwards [eventually_eligibility_card_le (K := K) (tick := tick) + allocation sigma width hδ] with m hm + intro e o v hv + exact (Nat.cast_le.mpr (Finset.card_le_card + (competitors_subset_eligibility_of_first allocation m width sigma e o v hv))).trans (hm e) + +end MatrixMultiplication.AllFieldGroupDegreeLaws + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldGroups/Degrees.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldGroups/Degrees.lean new file mode 100644 index 0000000000000000000000000000000000000000..8e1465f64de5e7d1e73e976b44f6b641a86c1cb6 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldGroups/Degrees.lean @@ -0,0 +1,188 @@ +import OAI.LinearAlgebra.MatrixMultiplication.FieldGroups.OrbitData +import OAI.LinearAlgebra.MatrixMultiplication.FieldConstruction.ActiveCapacity +import OAI.LinearAlgebra.MatrixMultiplication.FieldGroups.TargetRate +import OAI.LinearAlgebra.MatrixMultiplication.JointExtraction.PopulationCompatibility +import OAI.LinearAlgebra.MatrixMultiplication.JointExtraction.AmbientDegree + +namespace OAI + +/-! Group assignments, orbit counts and extraction capacities. -/ + +noncomputable section + +namespace MatrixMultiplication.AllFieldGroupDegrees + +open AllFieldHistory AllFieldHistorySupport AllFieldHistoryChildLaws +open AllFieldGroupOrbitData JointPopulation JointCanonicalization +open MatrixMultiplication.Foundation +open scoped BigOperators +attribute [local instance] Classical.propDecidable Classical.decEq + +variable {K tick : ℕ} + +abbrev Letter (sigma : Placement) (h : ActiveOrder K tick sigma) := + Fin (activeHalfLength h.val) → Fin 7 + +abbrev Class (sigma : Placement) := ActiveOrder K tick sigma × Fin 17 + +abbrev Symbol (sigma : Placement) (c : Class (K := K) (tick := tick) sigma) := + Statistic c.1.val + +def projectedStatistic (sigma : Placement) + (c : Class (K := K) (tick := tick) sigma) : Letter (K := K) (tick := tick) sigma c.1 → Symbol (K := K) (tick := tick) sigma c := + statistic c.1.val + +def classDesignated (right : Bool) (side : Fin 3) (sigma : Placement) + (c : Class (K := K) (tick := tick) sigma) (u : JointPopulation.Shape) : Prop := + designated right side sigma c.1 u + +def classLaw (right : Bool) (side : Fin 3) (sigma : Placement) + (c : Class (K := K) (tick := tick) sigma) (u : JointPopulation.Shape) : + Symbol (K := K) (tick := tick) sigma c → ℝ := compatibilityLaw right side sigma c.1 u + +theorem tripleSide_eq_sideWord (allocation : Allocation) (m : ℕ) (sigma : Placement) + (s : Fin 3) (t : JointCoarseHashing.Triple (Pos (K := K) (tick := tick) allocation m sigma)) + (h : ActiveOrder K tick sigma) (i : JointPopulation.Positions (Counts (K := K) (tick := tick) allocation m sigma) h) : + tripleSide s t ⟨h, i⟩ = sideWord (Counts (K := K) (tick := tick) allocation m sigma) s t h i := by + fin_cases s <;> rfl + +theorem tripleSide_triple (allocation : Allocation) (m : ℕ) (sigma : Placement) + (s : Fin 3) (e : Targets (K := K) (tick := tick) allocation m sigma) + (h : ActiveOrder K tick sigma) (i : JointPopulation.Positions (Counts (K := K) (tick := tick) allocation m sigma) h) : + tripleSide s (triple (Counts (K := K) (tick := tick) allocation m sigma) e) ⟨h, i⟩ = + shapeSide s ((e h).val i) := by + fin_cases s <;> rfl + +theorem childWidth_le {ε : ℝ} (hε : 0 ≤ ε) (h : Active K tick) : + AllFieldHistoryMasks.childWidth ε h ≤ ε := by + have hp : 0 ≤ AllFieldHistoryMasks.pairWidth ε h := by + unfold AllFieldHistoryMasks.pairWidth + positivity + calc + AllFieldHistoryMasks.childWidth ε h ≤ AllFieldHistoryMasks.pairWidth ε h := + div_le_self hp (by norm_num) + _ ≤ ε := div_le_self hε (one_le_pow₀ (by norm_num)) + +theorem fineCompatible_uniform (allocation : Allocation) (m : ℕ) + {ε χ : ℝ} (hε : 0 ≤ ε) (hχ : ε ≤ χ) (sigma : Placement) (side : Fin 3) + (e : Targets (K := K) (tick := tick) allocation m sigma) + (w : Raw (K := K) (tick := tick) allocation m sigma) + (hw : fineCompatible allocation m ε sigma side e w) : + JointPopulationCompatibility.Compatible (Counts (K := K) (tick := tick) allocation m sigma) + (Letter (K := K) (tick := tick) sigma) (Letter (K := K) (tick := tick) sigma) (Symbol (K := K) (tick := tick) sigma) (Symbol (K := K) (tick := tick) sigma) + (projectedStatistic sigma) (projectedStatistic sigma) + (classDesignated false side sigma) (classDesignated true side sigma) + (classLaw false side sigma) (classLaw true side sigma) χ (sigma side) e w := by + constructor + · intro h u hd a + exact (hw false h u hd a).trans + (mul_le_mul_of_nonneg_left ((childWidth_le hε h.val).trans hχ) (Nat.cast_nonneg _)) + · intro h u hd a + exact (hw true h u hd a).trans + (mul_le_mul_of_nonneg_left ((childWidth_le hε h.val).trans hχ) (Nat.cast_nonneg _)) + +def uniformCompatible (allocation : Allocation) (m : ℕ) (χ : ℝ) + (sigma : Placement) (side : Fin 3) + (e : Targets (K := K) (tick := tick) allocation m sigma) + (w : Raw (K := K) (tick := tick) allocation m sigma) : Prop := + JointPopulationCompatibility.compatibleWithCoarse (Counts (K := K) (tick := tick) allocation m sigma) + (Letter (K := K) (tick := tick) sigma) (Letter (K := K) (tick := tick) sigma) (Symbol (K := K) (tick := tick) sigma) (Symbol (K := K) (tick := tick) sigma) + (projectedStatistic sigma) (projectedStatistic sigma) + (classDesignated false side sigma) (classDesignated true side sigma) + (classLaw false side sigma) (classLaw true side sigma) χ + (ownWord allocation m sigma) (sigma side) (triple (Counts (K := K) (tick := tick) allocation m sigma) e) w + +theorem Compatible_uniform (allocation : Allocation) (m : ℕ) + {ε χ : ℝ} (hε : 0 ≤ ε) (hχ : ε ≤ χ) (sigma : Placement) (side : Fin 3) + (e : Targets (K := K) (tick := tick) allocation m sigma) + (w : Raw (K := K) (tick := tick) allocation m sigma) + (hw : Compatible allocation m ε sigma side e w) : + uniformCompatible allocation m χ sigma side e w := by + apply (JointPopulationCompatibility.compatibleWithCoarse_target + (Counts (K := K) (tick := tick) allocation m sigma) (Letter (K := K) (tick := tick) sigma) (Letter (K := K) (tick := tick) sigma) + (Symbol (K := K) (tick := tick) sigma) (Symbol (K := K) (tick := tick) sigma) (projectedStatistic sigma) (projectedStatistic sigma) + (classDesignated false side sigma) (classDesignated true side sigma) + (classLaw false side sigma) (classLaw true side sigma) χ + (ownWord allocation m sigma) (sigma side) e w).2 + refine ⟨?_, fineCompatible_uniform allocation m hε hχ sigma side e w hw.2⟩ + intro h i + have hh := congrFun hw.1 ⟨h, i⟩ + simpa only [coarse, tripleSide_reorder, tripleSide_triple] using hh + +def conditionalCount (allocation : Allocation) (m : ℕ) (χ : ℝ) + (sigma : Placement) (side : Fin 3) (w : Raw (K := K) (tick := tick) allocation m sigma) : ℕ := + JointPopulationCompatibility.compatibleTargetCount (Counts (K := K) (tick := tick) allocation m sigma) + (Letter (K := K) (tick := tick) sigma) (Letter (K := K) (tick := tick) sigma) (Symbol (K := K) (tick := tick) sigma) (Symbol (K := K) (tick := tick) sigma) + (projectedStatistic sigma) (projectedStatistic sigma) + (classDesignated false side sigma) (classDesignated true side sigma) + (classLaw false side sigma) (classLaw true side sigma) χ + (sigma side) (ownWord allocation m sigma w) w + +theorem uniformCompatible_count (allocation : Allocation) (m : ℕ) (χ : ℝ) + (sigma : Placement) (side : Fin 3) (w : Raw (K := K) (tick := tick) allocation m sigma) : + Fintype.card {e : Targets (K := K) (tick := tick) allocation m sigma // + uniformCompatible allocation m χ sigma side e w} = + conditionalCount allocation m χ sigma side w := + JointPopulationCompatibility.compatibleWithCoarse_target_count + (Counts (K := K) (tick := tick) allocation m sigma) (Letter (K := K) (tick := tick) sigma) (Letter (K := K) (tick := tick) sigma) + (Symbol (K := K) (tick := tick) sigma) (Symbol (K := K) (tick := tick) sigma) (projectedStatistic sigma) (projectedStatistic sigma) + (classDesignated false side sigma) (classDesignated true side sigma) + (classLaw false side sigma) (classLaw true side sigma) χ + (ownWord allocation m sigma) (sigma side) w + +theorem competitors_card_le_conditionalCount (allocation : Allocation) (m : ℕ) + {ε χ : ℝ} (hε : 0 ≤ ε) (hχ : ε ≤ χ) (sigma : Placement) + (e : Targets (K := K) (tick := tick) allocation m sigma) + (o : Orbit (K := K) (tick := tick) allocation m sigma) (v : Variable (K := K) (tick := tick) allocation m sigma) : + (competitors allocation m ε sigma e o v).card ≤ + conditionalCount allocation m χ sigma v.1 v.2 := by + classical + let candidates : Finset (Targets (K := K) (tick := tick) allocation m sigma) := + Finset.univ.filter fun f => uniformCompatible allocation m χ sigma v.1 f v.2 + have hsub : competitors allocation m ε sigma e o v ⊆ + candidates.image (coarse allocation m sigma) := by + intro t ht + obtain ⟨f, hf, hc⟩ := (Finset.mem_filter.mp ht).2.2.2 + exact Finset.mem_image.mpr ⟨f, Finset.mem_filter.mpr + ⟨Finset.mem_univ _, Compatible_uniform allocation m hε hχ sigma v.1 f v.2 hc⟩, hf⟩ + calc + (competitors allocation m ε sigma e o v).card ≤ + (candidates.image (coarse allocation m sigma)).card := Finset.card_le_card hsub + _ ≤ candidates.card := Finset.card_image_le + _ = Fintype.card {f : Targets (K := K) (tick := tick) allocation m sigma // + uniformCompatible allocation m χ sigma v.1 f v.2} := by + simp only [candidates, Fintype.card_subtype] + _ = conditionalCount allocation m χ sigma v.1 v.2 := + uniformCompatible_count allocation m χ sigma v.1 v.2 + +theorem eligibility_card_le_sharedAmbient (allocation : Allocation) (m : ℕ) + (ε : ℝ) (sigma : Placement) + (e : Targets (K := K) (tick := tick) allocation m sigma) : + ((data allocation m ε sigma).eligibilityCompetitors e).card ≤ + (JointAmbientDegree.sharedAmbient (Counts (K := K) (tick := tick) allocation m sigma) + (fun h => 2 * activeHalfLength h.val) (sigma 0) + (triple (Counts (K := K) (tick := tick) allocation m sigma) e)).card := by + let a := JointAmbientDegree.sharedAmbient (Counts (K := K) (tick := tick) allocation m sigma) + (fun h => 2 * activeHalfLength h.val) (sigma 0) + (triple (Counts (K := K) (tick := tick) allocation m sigma) e) + have hs : (data allocation m ε sigma).eligibilityCompetitors e ⊆ + a.image (reorder sigma) := by + intro f hf + obtain ⟨ha, _, hx⟩ := + ((data allocation m ε sigma).mem_eligibilityCompetitors e f).1 hf + obtain ⟨t, ht, rfl⟩ := Finset.mem_image.mp ha + apply Finset.mem_image.mpr + refine ⟨t, Finset.mem_filter.mpr ⟨ht, ?_⟩, rfl⟩ + intro h + funext i + have hh := congrFun hx ⟨h, i⟩ + change tripleSide (sigma 0) t ⟨h, i⟩ = + tripleSide (sigma 0) (triple (Counts (K := K) (tick := tick) allocation m sigma) e) ⟨h, i⟩ at hh + simpa only [tripleSide_eq_sideWord] using hh + exact (Finset.card_le_card hs).trans Finset.card_image_le + +end MatrixMultiplication.AllFieldGroupDegrees + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldGroups/NativeDegreeBound.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldGroups/NativeDegreeBound.lean new file mode 100644 index 0000000000000000000000000000000000000000..3193bd01207ac5127789770362333a1345098961 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldGroups/NativeDegreeBound.lean @@ -0,0 +1,103 @@ +import OAI.LinearAlgebra.MatrixMultiplication.FieldGroups.CountRate +import OAI.LinearAlgebra.MatrixMultiplication.FieldGroups.PairEntropy +import OAI.LinearAlgebra.MatrixMultiplication.FieldGroups.ProjectedEntropy + +namespace OAI + +/-! Group assignments, orbit counts and extraction capacities. -/ + +noncomputable section + +namespace MatrixMultiplication.AllFieldGroupNativeDegreeBound + +open AllFieldHistory AllFieldActiveLaws AllFieldActiveCapacity +open AllFieldGroupOrbitData AllFieldGroupDegrees AllFieldGroupDegreeLaws +open AllFieldGroupCountRate AllFieldGroupPairWindows AllFieldGroupPairEntropy +open AllFieldGroupProjectedEntropy JointCompatibilityRateLimit +open MatrixMultiplication.Foundation Filter +open scoped BigOperators Topology +attribute [local instance] Classical.propDecidable Classical.decEq + +variable {K tick : ℕ} + +def maxNativeDegree (allocation : Allocation) (sigma : Placement) : ℝ := + max (orderNativeDegree (K := K) (tick := tick) allocation sigma 0) + (max (orderNativeDegree (K := K) (tick := tick) allocation sigma 1) + (orderNativeDegree (K := K) (tick := tick) allocation sigma 2)) + +theorem orderNativeDegree_le_max (allocation : Allocation) (sigma : Placement) (side : Fin 3) : + orderNativeDegree (K := K) (tick := tick) allocation sigma side ≤ + maxNativeDegree (K := K) (tick := tick) allocation sigma := by + fin_cases side + · exact le_max_left _ _ + · exact (le_max_left _ _).trans (le_max_right _ _) + · exact (le_max_right _ _).trans (le_max_right _ _) + +theorem nativeCompatibilityRate_eq (allocation : Allocation) (sigma : Placement) + (side : Fin 3) (hside : side ≠ 0) : + nativeCompatibilityRate (K := K) (tick := tick) allocation sigma side = + orderNativeDegree (K := K) (tick := tick) allocation sigma side := by + have hp := projected_native_entropy_eq (K := K) (tick := tick) allocation sigma side hside + have hb := baseEntropy_sub_pairReferenceEntropy (K := K) (tick := tick) allocation sigma side + unfold nativeCompatibilityRate compatibilityRate + rw [show ∀ a b c d : ℝ, a - b + c + d = (a - b) + (c + d) by intros; ring, + hb, hp, ← Finset.sum_add_distrib] + unfold orderNativeDegree + apply Finset.sum_congr rfl + intro h _ + have hs : (parentBase allocation h : ℝ) = + (populationLength (K := K) allocation 1 : ℝ) * orderMass allocation h := + population_cast_real allocation 1 (h.val.val.1.source, h.val.val.2) + rw [hs] + ring + +theorem exists_threshold_eventually_counts_le (allocation : Allocation) (sigma : Placement) + {δ widthMax : ℝ} (hδ : 0 < δ) (hwidthMax : 0 < widthMax) : + ∃ threshold : ℝ, 0 < threshold ∧ threshold ≤ widthMax ∧ + ∀ width : ℝ, 0 < width → width ≤ threshold → + ∀ᶠ m : ℕ in atTop, + (∀ e : Targets (K := K) (tick := tick) allocation m sigma, + (((data allocation m width sigma).eligibilityCompetitors e).card : ℝ) ≤ + Real.exp ((m : ℝ) * (maxNativeDegree (K := K) (tick := tick) allocation sigma + δ))) ∧ + (∀ (e : Targets (K := K) (tick := tick) allocation m sigma) (o : Orbit (K := K) (tick := tick) allocation m sigma), + o ∈ (data allocation m width sigma).orbits e → + ∀ v : Variable (K := K) (tick := tick) allocation m sigma, + v ∈ (data allocation m width sigma).passing e o → + (((data allocation m width sigma).competitors e o v).card : ℝ) ≤ + Real.exp ((m : ℝ) * (maxNativeDegree (K := K) (tick := tick) allocation sigma + δ))) := by + obtain ⟨t₁, ht₁, ht₁Max, h₁⟩ := + exists_threshold_eventually_competitors_le (K := K) (tick := tick) + allocation sigma 1 hδ hwidthMax + obtain ⟨t₂, ht₂, _, h₂⟩ := + exists_threshold_eventually_competitors_le (K := K) (tick := tick) + allocation sigma 2 hδ hwidthMax + refine ⟨min t₁ t₂, lt_min ht₁ ht₂, (min_le_left _ _).trans ht₁Max, ?_⟩ + intro width hw hwt + filter_upwards [eventually_eligibility_card_le (K := K) (tick := tick) + allocation sigma width hδ, + h₁ width hw (hwt.trans (min_le_left _ _)), + h₂ width hw (hwt.trans (min_le_right _ _))] with m hm₀ hm₁ hm₂ + have hm (side : Fin 3) : + Real.exp ((m : ℝ) * (orderNativeDegree (K := K) (tick := tick) allocation sigma side + δ)) ≤ + Real.exp ((m : ℝ) * (maxNativeDegree (K := K) (tick := tick) allocation sigma + δ)) := + Real.exp_le_exp.mpr (mul_le_mul_of_nonneg_left + (add_le_add_left (orderNativeDegree_le_max (K := K) (tick := tick) allocation sigma side) δ) (Nat.cast_nonneg m)) + refine ⟨fun e => (hm₀ e).trans (hm 0), ?_⟩ + intro e o ho v hv + rcases v with ⟨side, w⟩ + fin_cases side + · exact (Nat.cast_le.mpr (Finset.card_le_card + (competitors_subset_eligibility_of_first allocation m width sigma e o (0, w) rfl))).trans + ((hm₀ e).trans (hm 0)) + · have hh := hm₁ e o ho w hv + rw [nativeCompatibilityRate_eq (K := K) (tick := tick) allocation sigma 1 (by decide)] at hh + exact hh.trans (hm 1) + · have hh := hm₂ e o ho w hv + rw [nativeCompatibilityRate_eq (K := K) (tick := tick) allocation sigma 2 (by decide)] at hh + exact hh.trans (hm 2) + +end MatrixMultiplication.AllFieldGroupNativeDegreeBound + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldGroups/NativeLaws.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldGroups/NativeLaws.lean new file mode 100644 index 0000000000000000000000000000000000000000..c4a01e8b0b4905b5e74a59cbac8437cb590e5b0c --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldGroups/NativeLaws.lean @@ -0,0 +1,449 @@ +import OAI.LinearAlgebra.MatrixMultiplication.FieldGroups.OrbitData +import OAI.LinearAlgebra.MatrixMultiplication.FieldConstruction.ActiveLaws +import OAI.LinearAlgebra.MatrixMultiplication.FieldConstruction.PairConditionalEntropy +import OAI.LinearAlgebra.MatrixMultiplication.FieldParameters.HalfComplement +import OAI.LinearAlgebra.MatrixMultiplication.JointExtraction.EntropyMax + +namespace OAI + +/-! Group assignments, orbit counts and extraction capacities. -/ + +noncomputable section + +namespace MatrixMultiplication.AllFieldGroupNativeLaws + +open MatrixMultiplication.Foundation AllFieldParameters AllFieldHistory +open AllFieldHistoryChildLaws AllFieldGroupOrbitData AllFieldActiveLaws +open AllFieldNativeCapacity AllFieldPairMarginals AllFieldPairConditionalEntropy +open scoped BigOperators +attribute [local instance] Classical.propDecidable Classical.decEq + +def statisticComplement {K : ℕ} (w : Work K) : w.Statistic ≃ w.Statistic := + match w with + | .stageA _ => CWCompleteStatistics.orderedComplementStatistic + | .stageB _ => CWCompleteStatistics.complementStatistic + | .stageC _ => Equiv.refl _ + +theorem childLaw_complementary_sides {K : ℕ} (w : Work K) + (u : Shape) (hu : u ∈ shapes (2 * w.halfLength)) + (source target : Fin 3) (hne : source ≠ target) + (hsum : u source + u target = 2 * w.halfLength) (a : w.Statistic) : + w.childLaw u source ((statisticComplement w).symm a) = w.childLaw u target a := by + cases w with + | stageA h => exact halfLaw_complementary_sides u hu source target hne hsum a + | stageB h => + exact littleLaw_complement (aShape h.val) u source target + (lt_of_le_of_lt (mem_shapes_bound hu source) (by norm_num [Work.halfLength])) + (lt_of_le_of_lt (mem_shapes_bound hu target) (by norm_num [Work.halfLength])) + hsum a + | stageC h => rfl + +def halfLawAt {K tick : ℕ} (right : Bool) (h : Active K tick) + (u : JointPopulation.Shape) (side : Fin 3) : Statistic h → ℝ := + if right then rightLaw h u side else leftLaw h u side + +def childWeight {K tick : ℕ} (right : Bool) (h : Active K tick) + (u : JointPopulation.Shape) (side : Fin 3) : ℕ := + if right then activeParentShape h side - (JointPopulation.shapeSide side u).val + else (JointPopulation.shapeSide side u).val + +theorem halfLawAt_eq {K tick : ℕ} (right : Bool) (h : Active K tick) + (u : JointPopulation.Shape) (side : Fin 3) (a : Statistic h) : + halfLawAt right h u side a = + (h.val.1.childLaw + (halfShape h.val.1.parentShape (canonicalChildShape h.val u) right) + (h.val.2.symm side) a : ℝ) := by + cases right <;> rfl + +theorem halfLawAt_nonnegative {K tick : ℕ} (right : Bool) (h : Active K tick) + (u : JointPopulation.Shape) (side : Fin 3) (a : Statistic h) : + 0 ≤ halfLawAt right h u side a := by + cases right + · exact leftLaw_nonnegative h u side a + · exact rightLaw_nonnegative h u side a + +theorem halfLawAt_normalized {K tick : ℕ} (allocation : Allocation) (m : ℕ) + (right : Bool) (h : Active K tick) (u : JointPopulation.Shape) + (hu : 0 < activeCounts allocation m h u) (side : Fin 3) : + ∑ a, halfLawAt right h u side a = 1 := by + cases right + · exact leftLaw_normalized allocation m h u hu side + · exact rightLaw_normalized allocation m h u hu side + +theorem halfLawAt_le_one_of_counts_pos {K tick : ℕ} (allocation : Allocation) (m : ℕ) + (right : Bool) (h : Active K tick) (u : JointPopulation.Shape) + (hu : 0 < activeCounts allocation m h u) (side : Fin 3) (a : Statistic h) : + halfLawAt right h u side a ≤ 1 := by + have hle := Finset.single_le_sum + (fun b (_ : b ∈ Finset.univ) => halfLawAt_nonnegative right h u side b) + (Finset.mem_univ a) + rw [halfLawAt_normalized allocation m right h u hu side] at hle + exact hle + +def supportedHalfLaw {K tick : ℕ} (allocation : Allocation) (right : Bool) + (h : Active K tick) (u : JointPopulation.Shape) (side : Fin 3) : Statistic h → ℝ := + if 0 < activeCounts allocation 1 h u then halfLawAt right h u side else fun _ => 0 + +theorem supportedHalfLaw_bounds {K tick : ℕ} (allocation : Allocation) (right : Bool) + (h : Active K tick) (u : JointPopulation.Shape) (side : Fin 3) (a : Statistic h) : + 0 ≤ supportedHalfLaw allocation right h u side a ∧ + supportedHalfLaw allocation right h u side a ≤ 1 := by + unfold supportedHalfLaw + split_ifs with hu + · exact ⟨halfLawAt_nonnegative right h u side a, + halfLawAt_le_one_of_counts_pos allocation 1 right h u hu side a⟩ + · norm_num + +theorem supportedHalfLaw_eq_of_counts_pos {K tick : ℕ} (allocation : Allocation) + (m : ℕ) (right : Bool) (h : Active K tick) (u : JointPopulation.Shape) + (hu : 0 < activeCounts allocation m h u) (side : Fin 3) : + supportedHalfLaw allocation right h u side = halfLawAt right h u side := by + have hbase : 0 < activeCounts allocation 1 h u := by + rw [AllFieldHistorySupport.activeCounts_dilation] at hu + exact Nat.pos_of_mul_pos_left hu + simp only [supportedHalfLaw, ite_eq_left hbase] + +theorem placedLaw_mass_zero_of_count_zero {K : ℕ} (allocation : Allocation) + (w : PlacedWork K) (u : JointPopulation.Shape) + (hu : jointCounts allocation 1 w u = 0) : (placedLaw w).mass u = 0 := by + have hp : (population allocation 1 (w.1.source, w.2) : ℝ) ≠ 0 := by + exact_mod_cast Nat.ne_of_gt + (AllFieldHistory.work_source_population_pos allocation (by decide : 0 < (1 : ℕ)) w) + have he := jointCounts_cast allocation 1 w u + rw [hu, Nat.cast_zero] at he + exact (mul_eq_zero.mp he.symm).resolve_left hp + +theorem halfShape_childWeight {K tick : ℕ} (right : Bool) (h : Active K tick) + (u : JointPopulation.Shape) (side : Fin 3) : + (halfShape h.val.1.parentShape (canonicalChildShape h.val u) right) + (h.val.2.symm side) = childWeight right h u side := by + cases right <;> + simp [halfShape, canonicalChildShape, childWeight, activeParentShape, + physicalShape, decodeShape, AllFieldParameters.complement] + +theorem halfShape_mem_of_counts_pos {K tick : ℕ} (allocation : Allocation) (m : ℕ) + (right : Bool) (h : Active K tick) (u : JointPopulation.Shape) + (hu : 0 < activeCounts allocation m h u) : + halfShape h.val.1.parentShape (canonicalChildShape h.val u) right ∈ + shapes (2 * h.val.1.halfLength) := by + obtain ⟨b, rfl, _⟩ := shapeCounts_positive _ _ u hu + rw [canonicalChildShape_branchShape] + exact h.val.1.halfShape_mem b right + +theorem childWeight_sum {K tick : ℕ} (allocation : Allocation) (m : ℕ) + (right : Bool) (h : Active K tick) (u : JointPopulation.Shape) + (hu : 0 < activeCounts allocation m h u) (sigma : Placement) : + childWeight right h u (sigma 0) + childWeight right h u (sigma 1) + + childWeight right h u (sigma 2) = 2 * h.val.1.halfLength := by + let v := halfShape h.val.1.parentShape (canonicalChildShape h.val u) right + have ht := mem_shapes_total (halfShape_mem_of_counts_pos allocation m right h u hu) + have hp := Equiv.sum_comp (sigma.trans h.val.2.symm) v + have he : (∑ i : Fin 3, v (h.val.2.symm (sigma i))) = 2 * h.val.1.halfLength := by + calc + _ = ∑ i : Fin 3, v i := hp + _ = _ := by simpa [v, shapeTotal, Fin.sum_univ_succ, Nat.add_assoc] using ht + simpa [v, halfShape_childWeight, Fin.sum_univ_succ, Nat.add_assoc] using he + +theorem designated_source_geometry (weight : Fin 3 → ℕ) (total : ℕ) + (htotal : weight 0 + weight 1 + weight 2 = total) (side : Fin 3) + (hd : if side = 1 then weight 2 = 0 + else if side = 2 then weight 0 * weight 1 = 0 else False) : + let source : Fin 3 := if side = 2 ∧ weight 1 ≠ 0 then 1 else 0 + source ≠ side ∧ weight source + weight side = total := by + fin_cases side + · simp at hd + · simp at hd ⊢ + omega + · by_cases hzero : weight 1 = 0 + · simp [hzero] at hd ⊢ + omega + · have hz : weight 0 = 0 := by simpa [hzero] using hd + simp [hzero] + omega + +theorem compatibilityLaw_eq {K tick : ℕ} (allocation : Allocation) (m : ℕ) + (sigma : Placement) (right : Bool) (side : Fin 3) + (h : ActiveOrder K tick sigma) (u : JointPopulation.Shape) + (hu : 0 < Counts allocation m sigma h u) + (hd : designated right side sigma h u) : + compatibilityLaw right side sigma h u = + if right then rightLaw h.val u (sigma side) else leftLaw h.val u (sigma side) := by + let weight : Fin 3 → ℕ := fun i => childWeight right h.val u (sigma i) + let source : Fin 3 := if side = 2 ∧ weight 1 ≠ 0 then 1 else 0 + have hdesignated : if side = 1 then weight 2 = 0 + else if side = 2 then weight 0 * weight 1 = 0 else False := by + simpa only [AllFieldGroupOrbitData.designated, weight, childWeight] using hd.2 + have hgeom := designated_source_geometry weight (2 * h.val.val.1.halfLength) + (childWeight_sum allocation m right h.val u hu sigma) side hdesignated + have hsource : (if side = 2 ∧ weight 1 ≠ 0 then sigma 1 else sigma 0) = sigma source := by + dsimp only [source] + split_ifs <;> rfl + have hne : h.val.val.2.symm (sigma source) ≠ h.val.val.2.symm (sigma side) := by + intro heq + exact hgeom.1 (sigma.injective (h.val.val.2.symm.injective heq)) + have hsum : + (halfShape h.val.val.1.parentShape (canonicalChildShape h.val.val u) right) + (h.val.val.2.symm (sigma source)) + + (halfShape h.val.val.1.parentShape (canonicalChildShape h.val.val u) right) + (h.val.val.2.symm (sigma side)) = 2 * h.val.val.1.halfLength := by + simpa only [halfShape_childWeight] using hgeom.2 + funext a + have hlaw := childLaw_complementary_sides h.val.val.1 + (halfShape h.val.val.1.parentShape (canonicalChildShape h.val.val u) right) + (halfShape_mem_of_counts_pos allocation m right h.val u hu) + (h.val.val.2.symm (sigma source)) (h.val.val.2.symm (sigma side)) hne hsum a + have hre : halfLawAt right h.val u (sigma source) + ((statisticComplement h.val.val.1).symm a) = + halfLawAt right h.val u (sigma side) a := by + rw [halfLawAt_eq, halfLawAt_eq] + exact_mod_cast hlaw + change ((if right then rightLaw h.val u + (if side = 2 ∧ weight 1 ≠ 0 then sigma 1 else sigma 0) + else leftLaw h.val u + (if side = 2 ∧ weight 1 ≠ 0 then sigma 1 else sigma 0)) + ((statisticComplement h.val.val.1).symm a)) = _ + rw [hsource] + exact hre + +def nativePairLaw {K : ℕ} (w : Work K) (side : Fin 3) : + FiniteLaw (w.Statistic × w.Statistic) := + match w with + | .stageA h => stageAPairLaw (initialShape h.val) h.property side + | .stageB h => stageBPairLaw (aShape h.val) h.property side + | .stageC _ => + { mass := fun _ => 1 + nonneg := fun _ => zero_le_one + total := Fintype.sum_subsingleton (fun _ : PUnit × PUnit => (1 : ℝ)) + (PUnit.unit, PUnit.unit) } + +theorem placedLaw_sum_mul {K : ℕ} (w : PlacedWork K) + (f : JointPopulation.Shape → ℝ) : + (∑ u, (placedLaw w).mass u * f u) = + ∑ b : w.1.Branch, (branchLaw w.1).mass b * f (branchShape w b) := by + exact (JointEntropyMax.sum_mass_mul_coordinate + (branchLaw w.1) (branchShape w) f).symm + +theorem childLaw_branchShape {K : ℕ} (w : PlacedWork K) + (b : w.1.Branch) (side : Fin 3) (a : w.1.Statistic) : + childLaw w (branchShape w b) side a = + (w.1.childLaw (w.1.splitShape b) (w.2.symm side) a : ℝ) := by + change (w.1.childLaw (canonicalChildShape w (branchShape w b)) + (w.2.symm side) a : ℝ) = _ + rw [canonicalChildShape_branchShape] + +theorem rightChildLaw_branchShape {K : ℕ} (w : PlacedWork K) + (b : w.1.Branch) (side : Fin 3) (a : w.1.Statistic) : + rightChildLaw w (branchShape w b) side a = + (w.1.childLaw (AllFieldParameters.complement w.1.parentShape (w.1.splitShape b)) + (w.2.symm side) a : ℝ) := by + change (w.1.childLaw + (AllFieldParameters.complement w.1.parentShape (canonicalChildShape w (branchShape w b))) + (w.2.symm side) a : ℝ) = _ + rw [canonicalChildShape_branchShape] + +theorem branchPairMixture_eq_native {K : ℕ} (w : Work K) (side : Fin 3) + (a : w.Statistic × w.Statistic) : + (∑ b : w.Branch, (branchLaw w).mass b * + (w.childLaw (w.splitShape b) side a.1 : ℝ) * + (w.childLaw (AllFieldParameters.complement w.parentShape (w.splitShape b)) side a.2 : ℝ)) = + (nativePairLaw w side).mass a := by + cases w with + | stageA h => + change (∑ b : Fin (below (initialShape h.val)).length, + (stageALaw (initialShape h.val) (below (initialShape h.val))[b.val] : ℝ) * + (halfLaw (below (initialShape h.val))[b.val] side a.1 : ℝ) * + (halfLaw (AllFieldParameters.complement (initialShape h.val) + (below (initialShape h.val))[b.val]) side a.2 : ℝ)) = _ + exact Fin.sum_univ_fun_getElem _ (fun u : Shape => + (stageALaw (initialShape h.val) u : ℝ) * (halfLaw u side a.1 : ℝ) * + (halfLaw (AllFieldParameters.complement (initialShape h.val) u) side a.2 : ℝ)) + | stageB h => + change (∑ b : Fin (below (aShape h.val)).length, + (stageBLaw (aShape h.val) (below (aShape h.val))[b.val] : ℝ) * + (littleLaw (aShape h.val) (below (aShape h.val))[b.val] side a.1 : ℝ) * + (littleLaw (aShape h.val) (AllFieldParameters.complement (aShape h.val) + (below (aShape h.val))[b.val]) side a.2 : ℝ)) = _ + exact Fin.sum_univ_fun_getElem _ (fun u : Shape => + (stageBLaw (aShape h.val) u : ℝ) * + (littleLaw (aShape h.val) u side a.1 : ℝ) * + (littleLaw (aShape h.val) (AllFieldParameters.complement (aShape h.val) u) side a.2 : ℝ)) + | stageC h => + simpa only [Work.childLaw, Rat.cast_one, mul_one, nativePairLaw] using + (branchLaw (Work.stageC h)).total + +def placedPairMixture {K : ℕ} (w : PlacedWork K) (side : Fin 3) + (a : w.1.Statistic × w.1.Statistic) : ℝ := + ∑ u, (placedLaw w).mass u * childLaw w u side a.1 * rightChildLaw w u side a.2 + +theorem placedPairMixture_eq_native {K : ℕ} (w : PlacedWork K) (side : Fin 3) + (a : w.1.Statistic × w.1.Statistic) : + placedPairMixture w side a = (nativePairLaw w.1 (w.2.symm side)).mass a := by + simp only [placedPairMixture, mul_assoc] + rw [placedLaw_sum_mul] + simpa only [childLaw_branchShape, rightChildLaw_branchShape, mul_assoc] using + branchPairMixture_eq_native w.1 (w.2.symm side) a + +theorem placement_symm_order_side {K tick : ℕ} {sigma : Placement} + (h : ActiveOrder K tick sigma) (side : Fin 3) : + h.val.val.2.symm (sigma side) = h.val.val.1.priority side := by + have hs : h.val.val.2 (h.val.val.1.priority side) = sigma side := + Equiv.congr_fun h.property side + rw [← hs, Equiv.symm_apply_apply] + +def orderPairMixture {K tick : ℕ} {sigma : Placement} + (h : ActiveOrder K tick sigma) (side : Fin 3) + (a : Statistic h.val × Statistic h.val) : ℝ := + ∑ u, (orderLaw h).mass u * leftLaw h.val u (sigma side) a.1 * + rightLaw h.val u (sigma side) a.2 + +theorem orderPairMixture_eq_native {K tick : ℕ} {sigma : Placement} + (h : ActiveOrder K tick sigma) (side : Fin 3) + (a : Statistic h.val × Statistic h.val) : + orderPairMixture h side a = + (nativePairLaw h.val.val.1 (h.val.val.1.priority side)).mass a := by + change placedPairMixture h.val.val (sigma side) a = _ + rw [placedPairMixture_eq_native, placement_symm_order_side] + +theorem orderPairMixture_supported {K tick : ℕ} {sigma : Placement} + (allocation : Allocation) (h : ActiveOrder K tick sigma) (side : Fin 3) + (a : Statistic h.val × Statistic h.val) : + (∑ u, (orderLaw h).mass u * + supportedHalfLaw allocation false h.val u (sigma side) a.1 * + supportedHalfLaw allocation true h.val u (sigma side) a.2) = + (nativePairLaw h.val.val.1 (h.val.val.1.priority side)).mass a := by + rw [← orderPairMixture_eq_native] + unfold orderPairMixture + apply Finset.sum_congr rfl + intro u _ + by_cases hu : 0 < activeCounts allocation 1 h.val u + · simp [supportedHalfLaw, hu, halfLawAt] + · have hz : (orderLaw h).mass u = 0 := + placedLaw_mass_zero_of_count_zero allocation h.val.val u (Nat.eq_zero_of_not_pos hu) + simp only [hz, zero_mul] + +theorem orderPairMixture_nonneg {K tick : ℕ} {sigma : Placement} + (h : ActiveOrder K tick sigma) (side : Fin 3) + (a : Statistic h.val × Statistic h.val) : 0 ≤ orderPairMixture h side a := by + rw [orderPairMixture_eq_native] + exact (nativePairLaw h.val.val.1 (h.val.val.1.priority side)).nonneg a + +theorem orderPairMixture_total {K tick : ℕ} {sigma : Placement} + (h : ActiveOrder K tick sigma) (side : Fin 3) : + ∑ a, orderPairMixture h side a = 1 := by + simp_rw [orderPairMixture_eq_native] + exact (nativePairLaw h.val.val.1 (h.val.val.1.priority side)).total + +theorem orderPairMixture_entropy {K tick : ℕ} {sigma : Placement} + (h : ActiveOrder K tick sigma) (side : Fin 3) : + finiteEntropy (orderPairMixture h side) = + finiteEntropy (nativePairLaw h.val.val.1 (h.val.val.1.priority side)).mass := by + have hm : orderPairMixture h side = + (nativePairLaw h.val.val.1 (h.val.val.1.priority side)).mass := + funext (orderPairMixture_eq_native h side) + rw [hm] + +def nativeStatisticWeightCode {K : ℕ} (w : Work K) : w.Statistic → Fin 17 := + match w with + | .stageA _ => halfWeightCode + | .stageB _ => statisticWeightCode + | .stageC _ => fun _ => 0 + +def nativeSplitWeightCode {K : ℕ} (w : Work K) (side : Fin 3) + (b : w.Branch) : Fin 17 := + ⟨w.splitShape b side, Nat.lt_succ_of_le ((w.splitShape_spec b).1 side)⟩ + +@[simp] theorem nativeSplitWeightCode_val {K : ℕ} (w : Work K) (side : Fin 3) + (b : w.Branch) : (nativeSplitWeightCode w side b).val = w.splitShape b side := rfl + +theorem nativePairLaw_weight_marginal {K : ℕ} (w : Work K) (side : Fin 3) + (hstage : w.stage ≠ 2) : + (nativePairLaw w side).map (fun a => nativeStatisticWeightCode w a.1) = + (branchLaw w).map (nativeSplitWeightCode w side) := by + cases w with + | stageA h => + change (stageAPairLaw (initialShape h.val) h.property side).map + (fun a => halfWeightCode a.1) = + (stageASplitLaw (initialShape h.val) h.property).map + (stageASplitWeight (initialShape h.val) h.property side) + rw [stageAPairLaw_leftWeight_marginal, stageASplitLaw_ownWeight_marginal] + | stageB h => + change (stageBPairLaw (aShape h.val) h.property side).map + (fun a => statisticWeightCode a.1) = + (stageBSplitLaw (aShape h.val) h.property).map + (stageBSplitWeight (aShape h.val) h.property side) + rw [stageBPairLaw_leftWeight_marginal, stageBSplitLaw_ownWeight_marginal] + | stageC h => exact False.elim (hstage rfl) + +private theorem commonWeight_law_ext {A : Type*} [Fintype A] + (p q : FiniteLaw A) (hmass : ∀ a, p.mass a = q.mass a) : p = q := by + cases p with + | mk p hp htotal => + cases q with + | mk q hq hqtotal => + have heq : p = q := funext hmass + subst q + rfl + +theorem order_branch_weight {K tick : ℕ} {sigma : Placement} + (h : ActiveOrder K tick sigma) (side : Fin 3) (b : h.val.val.1.Branch) : + JointPopulation.shapeSide (sigma side) (branchShape h.val.val b) = + nativeSplitWeightCode h.val.val.1 (h.val.val.1.priority side) b := by + apply Fin.ext + rw [branchShape, encodePhysicalShape_side, nativeSplitWeightCode_val, + placement_symm_order_side] + +theorem orderLaw_weight_marginal {K tick : ℕ} {sigma : Placement} + (h : ActiveOrder K tick sigma) (side : Fin 3) : + (orderLaw h).map (JointPopulation.shapeSide (sigma side)) = + (branchLaw h.val.val.1).map + (nativeSplitWeightCode h.val.val.1 (h.val.val.1.priority side)) := by + apply commonWeight_law_ext + intro k + have hm : ((orderLaw h).map (JointPopulation.shapeSide (sigma side))).mass k = + JointPopulationRates.sideMass (placedLaw h.val.val).mass (sigma side) k := by + rw [FiniteLaw.map_mass] + unfold JointPopulationRates.sideMass + apply Finset.sum_congr rfl + intro u _ + by_cases hu : JointPopulation.shapeSide (sigma side) u = k <;> simp [hu, orderLaw] + rw [hm, placedLaw_sideMass, FiniteLaw.map_mass] + apply Finset.sum_congr rfl + intro b _ + simp only [order_branch_weight, branchLaw_mass] + +theorem orderPairLaw_common_weight {K tick : ℕ} {sigma : Placement} + (h : ActiveOrder K tick sigma) (side : Fin 3) (hstage : h.val.val.1.stage ≠ 2) : + (nativePairLaw h.val.val.1 (h.val.val.1.priority side)).map + (fun a => nativeStatisticWeightCode h.val.val.1 a.1) = + (orderLaw h).map (JointPopulation.shapeSide (sigma side)) := by + rw [nativePairLaw_weight_marginal _ _ hstage, orderLaw_weight_marginal] + +theorem order_entropy_sub_pair_eq_conditional_sum + {K tick : ℕ} {sigma : Placement} (h : ActiveOrder K tick sigma) + (side : Fin 3) (hstage : h.val.val.1.stage ≠ 2) : + finiteEntropy (orderLaw h).mass - + finiteEntropy (nativePairLaw h.val.val.1 (h.val.val.1.priority side)).mass = + ∑ k, ((orderLaw h).map (JointPopulation.shapeSide (sigma side))).mass k * + (finiteEntropy ((orderLaw h).conditional + (JointPopulation.shapeSide (sigma side)) k).mass - + finiteEntropy ((nativePairLaw h.val.val.1 (h.val.val.1.priority side)).conditional + (fun a => nativeStatisticWeightCode h.val.val.1 a.1) k).mass) := + entropy_sub_eq_conditional_sum _ _ _ _ _ rfl (orderPairLaw_common_weight h side hstage) + +theorem order_entropy_sub_mixture_eq_conditional_sum + {K tick : ℕ} {sigma : Placement} (h : ActiveOrder K tick sigma) + (side : Fin 3) (hstage : h.val.val.1.stage ≠ 2) : + finiteEntropy (orderLaw h).mass - finiteEntropy (orderPairMixture h side) = + ∑ k, ((orderLaw h).map (JointPopulation.shapeSide (sigma side))).mass k * + (finiteEntropy ((orderLaw h).conditional + (JointPopulation.shapeSide (sigma side)) k).mass - + finiteEntropy ((nativePairLaw h.val.val.1 (h.val.val.1.priority side)).conditional + (fun a => nativeStatisticWeightCode h.val.val.1 a.1) k).mass) := by + rw [orderPairMixture_entropy] + exact order_entropy_sub_pair_eq_conditional_sum h side hstage + +end MatrixMultiplication.AllFieldGroupNativeLaws + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldGroups/OrbitCount.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldGroups/OrbitCount.lean new file mode 100644 index 0000000000000000000000000000000000000000..638ade83c1fb14cd6279323c3842968b59e929bf --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldGroups/OrbitCount.lean @@ -0,0 +1,130 @@ +import OAI.LinearAlgebra.MatrixMultiplication.FieldHistory.OrbitCount +import OAI.LinearAlgebra.MatrixMultiplication.FieldHistory.Priority + +namespace OAI + +/-! Group assignments, orbit counts and extraction capacities. -/ + +noncomputable section + +namespace MatrixMultiplication.AllFieldGroupOrbitCount + +open AllFieldHistory AllFieldHistorySupport PermutationMatching +open scoped BigOperators +attribute [local instance] Classical.propDecidable Classical.decEq + +abbrev GroupClasses (K tick : ℕ) (sigma : Placement) := + ActiveOrder K tick sigma × JointPopulation.Shape + +abbrev GroupPositions {K tick : ℕ} (allocation : Allocation) (m : ℕ) + {sigma : Placement} (c : GroupClasses K tick sigma) := + Fin (activeCounts allocation m c.1.val c.2) + +abbrev GroupLetters {K tick : ℕ} {sigma : Placement} (c : GroupClasses K tick sigma) := + Fin (activeHalfLength c.1.val) → Fin 7 + +abbrev GroupOrbit {K tick : ℕ} (allocation : Allocation) (m : ℕ) (sigma : Placement) := + PairOrbit (GroupPositions (K := K) (tick := tick) (sigma := sigma) allocation m) + (GroupLetters (K := K) (tick := tick) (sigma := sigma)) + (GroupLetters (K := K) (tick := tick) (sigma := sigma)) + +noncomputable instance groupOrbitFintype {K tick : ℕ} + (allocation : Allocation) (m : ℕ) (sigma : Placement) : + Fintype (GroupOrbit (K := K) (tick := tick) allocation m sigma) := by + haveI : Finite (GroupOrbit (K := K) (tick := tick) allocation m sigma) := + Finite.of_injective pairOrbitProfile pairOrbitProfile_injective + exact Fintype.ofFinite _ + +def groupDegree (K tick : ℕ) (sigma : Placement) : ℕ := + 2 * ∑ c : GroupClasses K tick sigma, 7 ^ activeHalfLength c.1.val + +theorem card_groupLetters {K tick : ℕ} {sigma : Placement} + (c : GroupClasses K tick sigma) : + Fintype.card (GroupLetters c) = 7 ^ activeHalfLength c.1.val := by + simp only [GroupLetters, Fintype.card_fun, Fintype.card_fin] + +theorem groupClass_card_le {K tick : ℕ} (allocation : Allocation) (m : ℕ) + {sigma : Placement} (c : GroupClasses K tick sigma) : + Fintype.card (GroupPositions allocation m c) ≤ + AllFieldHistoryOrbitCount.basePopulationBound (K := K) (tick := tick) allocation * m := + AllFieldHistoryOrbitCount.class_card_le allocation m (c.1.val, c.2) + +theorem card_groupOrbit_le {K tick : ℕ} + (allocation : Allocation) (m : ℕ) (sigma : Placement) : + Nat.card (GroupOrbit (K := K) (tick := tick) allocation m sigma) ≤ + (AllFieldHistoryOrbitCount.basePopulationBound (K := K) (tick := tick) allocation * m + 1) ^ + groupDegree K tick sigma := by + simpa only [GroupOrbit, groupDegree, card_groupLetters, two_mul] using + (card_pairOrbits_le_common_bound + (P := GroupPositions (K := K) (tick := tick) (sigma := sigma) allocation m) + (X := GroupLetters (K := K) (tick := tick) (sigma := sigma)) + (Y := GroupLetters (K := K) (tick := tick) (sigma := sigma)) + (AllFieldHistoryOrbitCount.basePopulationBound (K := K) (tick := tick) allocation * m) + (groupClass_card_le allocation m)) + +theorem card_groupOrbit_le_polynomial {K tick : ℕ} + (allocation : Allocation) (m : ℕ) (sigma : Placement) : + Nat.card (GroupOrbit (K := K) (tick := tick) allocation m sigma) ≤ + (AllFieldHistoryOrbitCount.basePopulationBound (K := K) (tick := tick) allocation + 1) ^ + groupDegree K tick sigma * (m + 1) ^ groupDegree K tick sigma := by + refine (card_groupOrbit_le allocation m sigma).trans ?_ + rw [← mul_pow] + apply Nat.pow_le_pow_left + nlinarith [Nat.zero_le + (AllFieldHistoryOrbitCount.basePopulationBound (K := K) (tick := tick) allocation)] + +def groupOrbitPrefactor {K tick : ℕ} (allocation : Allocation) (sigma : Placement) : ℝ := + ((AllFieldHistoryOrbitCount.basePopulationBound (K := K) (tick := tick) allocation + 1 : ℕ) : ℝ) ^ + groupDegree K tick sigma + +theorem groupOrbitPrefactor_pos {K tick : ℕ} (allocation : Allocation) (sigma : Placement) : + 0 < groupOrbitPrefactor (K := K) (tick := tick) allocation sigma := by + unfold groupOrbitPrefactor + positivity + +theorem card_groupOrbit_le_polynomial_real {K tick : ℕ} + (allocation : Allocation) (m : ℕ) (sigma : Placement) : + (Nat.card (GroupOrbit (K := K) (tick := tick) allocation m sigma) : ℝ) ≤ + groupOrbitPrefactor (K := K) (tick := tick) allocation sigma * + ((m : ℝ) + 1) ^ groupDegree K tick sigma := by + unfold groupOrbitPrefactor + exact_mod_cast card_groupOrbit_le_polynomial (K := K) (tick := tick) allocation m sigma + +theorem usedGroupOrbits_card_le_real {K tick : ℕ} (allocation : Allocation) (m : ℕ) + (sigma : Placement) + (s : Finset (GroupOrbit (K := K) (tick := tick) allocation m sigma)) : + (s.card : ℝ) ≤ groupOrbitPrefactor (K := K) (tick := tick) allocation sigma * + ((m : ℝ) + 1) ^ groupDegree K tick sigma := by + have hs : s.card ≤ Nat.card (GroupOrbit (K := K) (tick := tick) allocation m sigma) := by + rw [Nat.card_eq_fintype_card] + exact s.card_le_univ + have hsreal : (s.card : ℝ) ≤ + (Nat.card (GroupOrbit (K := K) (tick := tick) allocation m sigma) : ℝ) := by + exact_mod_cast hs + exact hsreal.trans (card_groupOrbit_le_polynomial_real allocation m sigma) + +theorem taggedUsedGroupOrbits_card_le_real {K tick : ℕ} + (allocation : Allocation) (m : ℕ) (sigma : Placement) + (s : Finset (Fin 3 × GroupOrbit (K := K) (tick := tick) allocation m sigma)) : + (s.card : ℝ) ≤ (3 * groupOrbitPrefactor (K := K) (tick := tick) allocation sigma) * + ((m : ℝ) + 1) ^ groupDegree K tick sigma := by + have hs : s.card ≤ 3 * Nat.card + (GroupOrbit (K := K) (tick := tick) allocation m sigma) := by + simpa only [Fintype.card_prod, Fintype.card_fin, Nat.card_eq_fintype_card] using + s.card_le_univ + have hsreal : (s.card : ℝ) ≤ 3 * (Nat.card + (GroupOrbit (K := K) (tick := tick) allocation m sigma) : ℝ) := by + exact_mod_cast hs + calc + _ ≤ 3 * (Nat.card (GroupOrbit (K := K) (tick := tick) allocation m sigma) : ℝ) := hsreal + _ ≤ 3 * (groupOrbitPrefactor (K := K) (tick := tick) allocation sigma * + ((m : ℝ) + 1) ^ groupDegree K tick sigma) := + mul_le_mul_of_nonneg_left (card_groupOrbit_le_polynomial_real allocation m sigma) + (by norm_num) + _ = _ := (mul_assoc _ _ _).symm + +end MatrixMultiplication.AllFieldGroupOrbitCount + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldGroups/OrbitData.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldGroups/OrbitData.lean new file mode 100644 index 0000000000000000000000000000000000000000..4781b9526e7088f3c51afc4a8ea086cab8e7e9f4 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldGroups/OrbitData.lean @@ -0,0 +1,306 @@ +import OAI.LinearAlgebra.MatrixMultiplication.FieldHistory.GroupCore +import OAI.LinearAlgebra.MatrixMultiplication.FieldGroups.OrbitCount +import OAI.LinearAlgebra.MatrixMultiplication.JointExtraction.MaskedAssignment +import OAI.LinearAlgebra.MatrixMultiplication.JointExtraction.CoarseReorder +import OAI.LinearAlgebra.MatrixMultiplication.JointExtraction.PopulationMixedCompatibility + +namespace OAI + +/-! Group assignments, orbit counts and extraction capacities. -/ + +noncomputable section + +namespace MatrixMultiplication.AllFieldGroupOrbitData + +open AllFieldHistory AllFieldHistorySupport AllFieldHistoryChildLaws +open AllFieldHistoryGroupMasks AllFieldHistoryGroupedRecovery +open AllFieldGroupOrbitCount JointPopulation JointCanonicalization +open JointCoarseHashing PermutationMatching +open scoped BigOperators +attribute [local instance] Classical.propDecidable + +variable {K tick : ℕ} + +abbrev Counts (allocation : Allocation) (m : ℕ) (sigma : Placement) := + groupCounts (K := K) (tick := tick) allocation m sigma +abbrev Targets (allocation : Allocation) (m : ℕ) (sigma : Placement) := + Target (Counts (K := K) (tick := tick) allocation m sigma) +abbrev Pos (allocation : Allocation) (m : ℕ) (sigma : Placement) := + Position (Counts (K := K) (tick := tick) allocation m sigma) +abbrev Raw (allocation : Allocation) (m : ℕ) (sigma : Placement) := + GroupRaw (K := K) (tick := tick) allocation m sigma +abbrev Orbit (allocation : Allocation) (m : ℕ) (sigma : Placement) := + Fin 3 × GroupOrbit (K := K) (tick := tick) allocation m sigma +abbrev Variable (allocation : Allocation) (m : ℕ) (sigma : Placement) := + Fin 3 × Raw (K := K) (tick := tick) allocation m sigma + +def tripleSide {P : Type*} (s : Fin 3) (t : Triple P) : Word P := + ![t.1, t.2.1, t.2.2] s + +def reorder {P : Type*} (sigma : Placement) (t : Triple P) : Triple P := + (tripleSide (sigma 0) t, tripleSide (sigma 1) t, tripleSide (sigma 2) t) + +@[simp] theorem tripleSide_reorder {P : Type*} (sigma : Placement) + (t : Triple P) (s : Fin 3) : + tripleSide s (reorder sigma t) = tripleSide (sigma s) t := + JointCoarseReorder.tripleSide_reorder sigma t s + +theorem reorder_injective {P : Type*} (sigma : Placement) : + Function.Injective (reorder (P := P) sigma) := + JointCoarseReorder.reorder_injective sigma + +theorem reorder_support {P : Type*} (sigma : Placement) (S : P → ℕ) + (t : Triple P) (ht : HasSupportSum S t) : HasSupportSum S (reorder sigma t) := + JointCoarseReorder.reorder_support sigma S t ht + +def coarse (allocation : Allocation) (m : ℕ) (sigma : Placement) + (e : Targets (K := K) (tick := tick) allocation m sigma) : Triple (Pos (K := K) (tick := tick) allocation m sigma) := + reorder sigma (triple (Counts (K := K) (tick := tick) allocation m sigma) e) + +def ambient (allocation : Allocation) (m : ℕ) (sigma : Placement) : + Finset (Triple (Pos (K := K) (tick := tick) allocation m sigma)) := + (ambientSet (Counts (K := K) (tick := tick) allocation m sigma) (fun h => 2 * activeHalfLength h.val)).image + (reorder sigma) + +def support (allocation : Allocation) (m : ℕ) (sigma : Placement) + (p : Pos (K := K) (tick := tick) allocation m sigma) : ℕ := + 2 * activeHalfLength p.1.val + +theorem counts_support (allocation : Allocation) (m : ℕ) (sigma : Placement) + (h : ActiveOrder K tick sigma) (u : JointPopulation.Shape) + (hu : 0 < Counts (K := K) (tick := tick) allocation m sigma h u) : + u.1.val + u.2.1.val + u.2.2.val = 2 * activeHalfLength h.val := + jointCounts_support_sum allocation m h.val.val u hu + +theorem coarse_injective (allocation : Allocation) (m : ℕ) (sigma : Placement) : + Function.Injective (coarse (K := K) (tick := tick) allocation m sigma) := + (reorder_injective sigma).comp (triple_injective (Counts (K := K) (tick := tick) allocation m sigma)) + +theorem ambient_support (allocation : Allocation) (m : ℕ) (sigma : Placement) + (f : Triple (Pos (K := K) (tick := tick) allocation m sigma)) + (hf : f ∈ ambient allocation m sigma) : HasSupportSum (support allocation m sigma) f := by + obtain ⟨t, ht, rfl⟩ := Finset.mem_image.mp hf + exact reorder_support sigma _ t (Finset.mem_filter.mp ht).2.1 + +theorem coarse_mem_ambient (allocation : Allocation) (m : ℕ) (sigma : Placement) + (e : Targets (K := K) (tick := tick) allocation m sigma) : + coarse allocation m sigma e ∈ ambient allocation m sigma := by + apply Finset.mem_image.mpr + refine ⟨triple (Counts (K := K) (tick := tick) allocation m sigma) e, ?_, rfl⟩ + apply targetSet_subset_ambient (Counts (K := K) (tick := tick) allocation m sigma) + (fun h => 2 * activeHalfLength h.val) (counts_support allocation m sigma) + simp only [targetSet, Finset.mem_image, Finset.mem_univ, true_and] + exact ⟨e, rfl⟩ + +def sharing {sigma : Placement} (h : ActiveOrder K tick sigma) : Bool := + match h.val.val.1 with + | .stageA _ => true + | .stageB _ => true + | .stageC _ => false + +def workComplement (w : Work K) : w.Statistic ≃ w.Statistic := + match w with + | .stageA _ => CWCompleteStatistics.orderedComplementStatistic + | .stageB _ => CWCompleteStatistics.complementStatistic + | .stageC _ => Equiv.refl _ + +def complement {sigma : Placement} (h : ActiveOrder K tick sigma) : Statistic h.val ≃ Statistic h.val := + workComplement h.val.val.1 + +def compatibilityLaw (right : Bool) (side : Fin 3) (sigma : Placement) + (h : ActiveOrder K tick sigma) (u : JointPopulation.Shape) : Statistic h.val → ℝ := + let weight : Fin 3 → ℕ := fun i => + if right then activeParentShape h.val (sigma i) - (shapeSide (sigma i) u).val + else (shapeSide (sigma i) u).val + let source : Fin 3 := if side = 2 ∧ weight 1 ≠ 0 then sigma 1 else sigma 0 + (if right then rightLaw h.val u source else leftLaw h.val u source) ∘ + (complement h).symm + +def designated (right : Bool) (side : Fin 3) (sigma : Placement) + (h : ActiveOrder K tick sigma) (u : JointPopulation.Shape) : Prop := + sharing h = true ∧ + let weight : Fin 3 → ℕ := fun i => + if right then activeParentShape h.val (sigma i) - (shapeSide (sigma i) u).val + else (shapeSide (sigma i) u).val + if side = 1 then weight 2 = 0 + else if side = 2 then weight 0 * weight 1 = 0 else False + +def fineCompatible (allocation : Allocation) (m : ℕ) (ε : ℝ) (sigma : Placement) + (side : Fin 3) (e : Targets (K := K) (tick := tick) allocation m sigma) + (w : Raw (K := K) (tick := tick) allocation m sigma) : Prop := + ∀ (right : Bool) h u, designated right side sigma h u → ∀ a : Statistic h.val, + |(JointPopulationCompatibility.shapeStatisticCount (Counts (K := K) (tick := tick) allocation m sigma) e h u + (fun i => statistic h.val (if right then (w h i).2 else (w h i).1)) a : ℝ) - + (Counts (K := K) (tick := tick) allocation m sigma h u : ℝ) * compatibilityLaw right side sigma h u a| ≤ + (Counts (K := K) (tick := tick) allocation m sigma h u : ℝ) * AllFieldHistoryMasks.childWidth ε h.val + +def ownWord (allocation : Allocation) (m : ℕ) (sigma : Placement) + (w : Raw (K := K) (tick := tick) allocation m sigma) : Word (Pos (K := K) (tick := tick) allocation m sigma) := + fun p => groupCoarse 0 p.1 (w p.1 p.2) + +def Compatible (allocation : Allocation) (m : ℕ) (ε : ℝ) (sigma : Placement) + (side : Fin 3) (e : Targets (K := K) (tick := tick) allocation m sigma) + (w : Raw (K := K) (tick := tick) allocation m sigma) : Prop := + tripleSide side (coarse allocation m sigma e) = ownWord allocation m sigma w ∧ + fineCompatible allocation m ε sigma side e w + +def Admissible (allocation : Allocation) (m : ℕ) (ε : ℝ) (sigma : Placement) + (side : Fin 3) (e : Targets (K := K) (tick := tick) allocation m sigma) + (w : Raw (K := K) (tick := tick) allocation m sigma) : Prop := + groupIdealSide allocation m ε (sigma side) sigma e w ∧ + ∀ h j, CWStrands.weight (w h j).1 = (shapeSide (sigma side) ((e h).val j)).val ∧ + CWStrands.weight (w h j).2 = activeParentShape h.val (sigma side) - + (shapeSide (sigma side) ((e h).val j)).val + +def orbitOf (allocation : Allocation) (m : ℕ) (sigma : Placement) + (e : Targets (K := K) (tick := tick) allocation m sigma) + (w : Raw (K := K) (tick := tick) allocation m sigma) : GroupOrbit (K := K) (tick := tick) allocation m sigma := + Quotient.mk'' (groupCoordinates allocation m sigma e w) + +def usedOrbits (allocation : Allocation) (m : ℕ) (ε : ℝ) (sigma : Placement) + (e : Targets (K := K) (tick := tick) allocation m sigma) : Finset (Orbit (K := K) (tick := tick) allocation m sigma) := + Finset.univ.filter fun o => ∃ w, Admissible allocation m ε sigma o.1 e w ∧ + orbitOf allocation m sigma e w = o.2 + +def full (allocation : Allocation) (m : ℕ) (sigma : Placement) + (e : Targets (K := K) (tick := tick) allocation m sigma) (o : Orbit (K := K) (tick := tick) allocation m sigma) : + Finset (Variable (K := K) (tick := tick) allocation m sigma) := + Finset.univ.filter fun v => v.1 = o.1 ∧ orbitOf allocation m sigma e v.2 = o.2 + +def passing (allocation : Allocation) (m : ℕ) (sigma : Placement) (ε : ℝ) + (e : Targets (K := K) (tick := tick) allocation m sigma) (o : Orbit (K := K) (tick := tick) allocation m sigma) : + Finset (Variable (K := K) (tick := tick) allocation m sigma) := + (full allocation m sigma e o).filter fun v => completeKeep allocation m ε (sigma v.1) sigma v.2 + +def competitors (allocation : Allocation) (m : ℕ) (ε : ℝ) (sigma : Placement) + (e : Targets (K := K) (tick := tick) allocation m sigma) + (_o : Orbit (K := K) (tick := tick) allocation m sigma) (v : Variable (K := K) (tick := tick) allocation m sigma) : + Finset (Triple (Pos (K := K) (tick := tick) allocation m sigma)) := + (Finset.univ.image (coarse allocation m sigma)).filter fun t => + t ≠ coarse allocation m sigma e ∧ + tripleSide v.1 t = tripleSide v.1 (coarse allocation m sigma e) ∧ + ∃ f, coarse allocation m sigma f = t ∧ Compatible allocation m ε sigma v.1 f v.2 + +theorem full_pos (allocation : Allocation) (m : ℕ) (ε : ℝ) (sigma : Placement) + (e : Targets (K := K) (tick := tick) allocation m sigma) (o : Orbit (K := K) (tick := tick) allocation m sigma) + (ho : o ∈ usedOrbits allocation m ε sigma e) : 0 < (full allocation m sigma e o).card := by + obtain ⟨w, _, hw⟩ := (Finset.mem_filter.mp ho).2 + apply Finset.card_pos.mpr + exact ⟨(o.1, w), Finset.mem_filter.mpr ⟨Finset.mem_univ _, rfl, hw⟩⟩ + +theorem competitor_mem (allocation : Allocation) (m : ℕ) (ε : ℝ) (sigma : Placement) + (e : Targets (K := K) (tick := tick) allocation m sigma) (o : Orbit (K := K) (tick := tick) allocation m sigma) + (v : Variable (K := K) (tick := tick) allocation m sigma) (t : Triple (Pos (K := K) (tick := tick) allocation m sigma)) + (ht : t ∈ competitors allocation m ε sigma e o v) : t ∈ ambient allocation m sigma := by + obtain ⟨f, hf, _⟩ := (Finset.mem_filter.mp ht).2.2.2 + rw [← hf] + exact coarse_mem_ambient allocation m sigma f + +theorem competitor_shares (allocation : Allocation) (m : ℕ) (ε : ℝ) (sigma : Placement) + (e : Targets (K := K) (tick := tick) allocation m sigma) (o : Orbit (K := K) (tick := tick) allocation m sigma) + (v : Variable (K := K) (tick := tick) allocation m sigma) (t : Triple (Pos (K := K) (tick := tick) allocation m sigma)) + (ht : t ∈ competitors allocation m ε sigma e o v) : SharesSide (coarse allocation m sigma e) t := by + have h := (Finset.mem_filter.mp ht).2.2.1 + rcases v with ⟨side, w⟩ + fin_cases side + · exact Or.inl h + · exact Or.inr (Or.inl h) + · exact Or.inr (Or.inr h) + +def data (allocation : Allocation) (m : ℕ) (ε : ℝ) (sigma : Placement) : + JointMaskedSelection.OrbitData + (Pos (K := K) (tick := tick) allocation m sigma) (Targets (K := K) (tick := tick) allocation m sigma) + (Orbit (K := K) (tick := tick) allocation m sigma) (Variable (K := K) (tick := tick) allocation m sigma) where + ambient := ambient allocation m sigma + support := support allocation m sigma + coarse := coarse allocation m sigma + support_ambient := ambient_support allocation m sigma + target_mem := coarse_mem_ambient allocation m sigma + orbits := usedOrbits allocation m ε sigma + full := full allocation m sigma + passing := passing allocation m sigma ε + full_pos := full_pos allocation m ε sigma + passing_subset := fun _ _ _ => Finset.filter_subset _ _ + competitors := competitors allocation m ε sigma + competitor_mem := fun e o _ v _ t ht => competitor_mem allocation m ε sigma e o v t ht + competitor_ne := fun _ _ _ _ _ _ ht => (Finset.mem_filter.mp ht).2.1 + competitor_shares := fun e o _ v _ t ht => competitor_shares allocation m ε sigma e o v t ht + +theorem admissible_covered (allocation : Allocation) (m : ℕ) (ε : ℝ) (sigma : Placement) + (side : Fin 3) (e : Targets (K := K) (tick := tick) allocation m sigma) + (w : Raw (K := K) (tick := tick) allocation m sigma) (hw : Admissible allocation m ε sigma side e w) : + ∃ o ∈ (data allocation m ε sigma).orbits e, + (side, w) ∈ (data allocation m ε sigma).full e o := by + refine ⟨(side, orbitOf allocation m sigma e w), ?_, ?_⟩ + · exact Finset.mem_filter.mpr ⟨Finset.mem_univ _, w, hw, rfl⟩ + · exact Finset.mem_filter.mpr ⟨Finset.mem_univ _, rfl, rfl⟩ + +theorem orbits_card_le (allocation : Allocation) (m : ℕ) (ε : ℝ) (sigma : Placement) + (e : Targets (K := K) (tick := tick) allocation m sigma) : + (((data allocation m ε sigma).orbits e).card : ℝ) ≤ + (3 * groupOrbitPrefactor (K := K) (tick := tick) allocation sigma) * + ((m : ℝ) + 1) ^ groupDegree K tick sigma := + taggedUsedGroupOrbits_card_le_real allocation m sigma _ + +def actualCompatible (allocation : Allocation) (m : ℕ) (ε : ℝ) (sigma : Placement) + (t : Triple (Pos (K := K) (tick := tick) allocation m sigma)) + (v : Variable (K := K) (tick := tick) allocation m sigma) : Prop := + ∃ f, coarse allocation m sigma f = t ∧ Compatible allocation m ε sigma v.1 f v.2 + +def actualUseful (allocation : Allocation) (m : ℕ) (ε : ℝ) (sigma : Placement) + (t : Triple (Pos (K := K) (tick := tick) allocation m sigma)) + (v : Variable (K := K) (tick := tick) allocation m sigma) : Prop := + ∃ f, coarse allocation m sigma f = t ∧ + groupIdealSide allocation m ε (sigma v.1) sigma f v.2 + +def actualKeep (allocation : Allocation) (m : ℕ) (ε : ℝ) (sigma : Placement) + (v : Variable (K := K) (tick := tick) allocation m sigma) : Prop := + completeKeep allocation m ε (sigma v.1) sigma v.2 + +@[simp] theorem actualCompatible_coarse (allocation : Allocation) (m : ℕ) (ε : ℝ) + (sigma : Placement) (e : Targets (K := K) (tick := tick) allocation m sigma) + (v : Variable (K := K) (tick := tick) allocation m sigma) : + actualCompatible allocation m ε sigma (coarse allocation m sigma e) v ↔ + Compatible allocation m ε sigma v.1 e v.2 := by + constructor + · rintro ⟨f, hf, hv⟩ + exact (coarse_injective allocation m sigma hf) ▸ hv + · exact fun hv => ⟨e, rfl, hv⟩ + +@[simp] theorem actualUseful_coarse (allocation : Allocation) (m : ℕ) (ε : ℝ) + (sigma : Placement) (e : Targets (K := K) (tick := tick) allocation m sigma) + (v : Variable (K := K) (tick := tick) allocation m sigma) : + actualUseful allocation m ε sigma (coarse allocation m sigma e) v ↔ + groupIdealSide allocation m ε (sigma v.1) sigma e v.2 := by + constructor + · rintro ⟨f, hf, hv⟩ + exact (coarse_injective allocation m sigma hf) ▸ hv + · exact fun hv => ⟨e, rfl, hv⟩ + +theorem competitor_coverage (allocation : Allocation) (m : ℕ) (ε : ℝ) + (sigma : Placement) (e : Targets (K := K) (tick := tick) allocation m sigma) + (o : Orbit (K := K) (tick := tick) allocation m sigma) (v : Variable (K := K) (tick := tick) allocation m sigma) + (he : Compatible allocation m ε sigma v.1 e v.2) + (t : Triple (Pos (K := K) (tick := tick) allocation m sigma)) + (hne : t ≠ coarse allocation m sigma e) + (hc : actualCompatible allocation m ε sigma t v) : + t ∈ (data allocation m ε sigma).competitors e o v := by + obtain ⟨f, hf, hcomp⟩ := hc + apply Finset.mem_filter.mpr + refine ⟨?_, hne, ?_, f, hf, hcomp⟩ + · exact Finset.mem_image.mpr ⟨f, Finset.mem_univ _, hf⟩ + · rw [← hf] + exact hcomp.1.trans he.1.symm + +theorem mem_passing (allocation : Allocation) (m : ℕ) (ε : ℝ) + (sigma : Placement) (e : Targets (K := K) (tick := tick) allocation m sigma) + (o : Orbit (K := K) (tick := tick) allocation m sigma) (v : Variable (K := K) (tick := tick) allocation m sigma) : + v ∈ (data allocation m ε sigma).passing e o ↔ + v ∈ (data allocation m ε sigma).full e o ∧ actualKeep allocation m ε sigma v := + Finset.mem_filter + +end MatrixMultiplication.AllFieldGroupOrbitData + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldGroups/OrbitTransport.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldGroups/OrbitTransport.lean new file mode 100644 index 0000000000000000000000000000000000000000..d7f9fc5364e61e811d8b5e5d8721adb1b0c0b5ba --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldGroups/OrbitTransport.lean @@ -0,0 +1,98 @@ +import OAI.LinearAlgebra.MatrixMultiplication.FieldGroups.OrbitData +import OAI.LinearAlgebra.MatrixMultiplication.FieldHistory.GroupedRecovery +import OAI.LinearAlgebra.MatrixMultiplication.JointExtraction.OrbitFibers + +namespace OAI + +/-! Group assignments, orbit counts and extraction capacities. -/ + +noncomputable section + +namespace MatrixMultiplication.AllFieldGroupOrbitData + +open AllFieldHistory AllFieldHistoryGroupMasks AllFieldHistoryGroupedRecovery +open AllFieldGroupOrbitCount JointCoarseHashing PermutationMatching +attribute [local instance] Classical.propDecidable Classical.decEq + +variable {K tick : ℕ} + +local instance canonicalGroupAction (allocation : Allocation) (m : ℕ) (sigma : Placement) : + MulAction + (HalfClassPermutations (GroupPositions (K := K) (tick := tick) (sigma := sigma) allocation m)) + (JointCanonicalization.CanonicalPairs (groupCounts (K := K) (tick := tick) allocation m sigma) + (fun h => Fin (activeHalfLength h.val) → Fin 7) + (fun h => Fin (activeHalfLength h.val) → Fin 7)) := + completeWordPairMulAction + +local instance canonicalGroupFintype (allocation : Allocation) (m : ℕ) (sigma : Placement) : + Fintype + (JointCanonicalization.CanonicalPairs (groupCounts (K := K) (tick := tick) allocation m sigma) + (fun h => Fin (activeHalfLength h.val) → Fin 7) + (fun h => Fin (activeHalfLength h.val) → Fin 7)) := by + letI : ∀ c : GroupClasses K tick sigma, + Fintype (GroupPositions allocation m c) := fun _ => Fin.fintype _ + letI : ∀ c : GroupClasses K tick sigma, + DecidableEq (GroupPositions allocation m c) := fun _ => Classical.decEq _ + letI : ∀ c : GroupClasses K tick sigma, + Fintype (GroupLetters c) := fun _ => Pi.instFintype + exact HistorySymmetry.completeWordPairFintype + +def tag (allocation : Allocation) (m : ℕ) (sigma : Placement) (side : Fin 3) : + Raw (K := K) (tick := tick) allocation m sigma ↪ Variable (K := K) (tick := tick) allocation m sigma where + toFun w := (side, w) + inj' := by intro w v h; exact congrArg Prod.snd h + +theorem full_eq_tagged_fiber (allocation : Allocation) (m : ℕ) (sigma : Placement) + (e : Targets (K := K) (tick := tick) allocation m sigma) (o : Orbit (K := K) (tick := tick) allocation m sigma) : + full allocation m sigma e o = + (JointOrbitFibers.transportedFiber (groupCoordinates allocation m sigma e) o.2).map + (tag allocation m sigma o.1) := by + ext v + constructor + · intro hv + have hh := (Finset.mem_filter.mp hv).2 + apply Finset.mem_map.mpr + refine ⟨v.2, ?_, ?_⟩ + · exact (JointOrbitFibers.mem_transportedFiber (groupCoordinates allocation m sigma e)).mpr hh.2 + · exact Prod.ext hh.1.symm rfl + · intro hv + obtain ⟨w, hw, rfl⟩ := Finset.mem_map.mp hv + exact Finset.mem_filter.mpr ⟨Finset.mem_univ _, rfl, + (JointOrbitFibers.mem_transportedFiber (groupCoordinates allocation m sigma e)).mp hw⟩ + +theorem full_eq_tagged_localOrbit (allocation : Allocation) (m : ℕ) (sigma : Placement) + (e : Targets (K := K) (tick := tick) allocation m sigma) + (side : Fin 3) (w : Raw (K := K) (tick := tick) allocation m sigma) : + full allocation m sigma e (side, orbitOf allocation m sigma e w) = + (localOrbit allocation m sigma e w).map (tag allocation m sigma side) := by + rw [full_eq_tagged_fiber] + dsimp only [orbitOf] + erw [JointOrbitFibers.transportedFiber_mk] + apply congrArg (fun t : Finset (Raw (K := K) (tick := tick) allocation m sigma) => + t.map (tag allocation m sigma side)) + ext v + simp only [localOrbit, GroupOrbitProjection.rawOrbit, GroupOrbitProjection.transportedOrbit, + OrbitCounting.orbitSet, + Finset.mem_image, Finset.mem_univ, true_and] + rfl + +@[simp] theorem full_card_localOrbit (allocation : Allocation) (m : ℕ) (sigma : Placement) + (e : Targets (K := K) (tick := tick) allocation m sigma) + (side : Fin 3) (w : Raw (K := K) (tick := tick) allocation m sigma) : + (full allocation m sigma e (side, orbitOf allocation m sigma e w)).card = + (localOrbit allocation m sigma e w).card := by + rw [full_eq_tagged_localOrbit, Finset.card_map] + +theorem full_filter_card_localOrbit (allocation : Allocation) (m : ℕ) (sigma : Placement) + (e : Targets (K := K) (tick := tick) allocation m sigma) + (side : Fin 3) (w : Raw (K := K) (tick := tick) allocation m sigma) (bad : Variable (K := K) (tick := tick) allocation m sigma → Prop) : + ((full allocation m sigma e (side, orbitOf allocation m sigma e w)).filter bad).card = + ((localOrbit allocation m sigma e w).filter (fun v => bad (side, v))).card := by + rw [full_eq_tagged_localOrbit, Finset.filter_map] + exact Finset.card_map _ + +end MatrixMultiplication.AllFieldGroupOrbitData + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldGroups/PairEntropy.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldGroups/PairEntropy.lean new file mode 100644 index 0000000000000000000000000000000000000000..1b17e07bd50ea533ebcc494041db809e9a896982 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldGroups/PairEntropy.lean @@ -0,0 +1,218 @@ +import OAI.LinearAlgebra.MatrixMultiplication.FieldGroups.PairWindows +import OAI.LinearAlgebra.MatrixMultiplication.JointExtraction.ConditionalCountEntropy + +namespace OAI + +/-! Group assignments, orbit counts and extraction capacities. -/ + +noncomputable section + +namespace MatrixMultiplication.AllFieldGroupPairEntropy + +open MatrixMultiplication.Foundation AllFieldParameters AllFieldHistory AllFieldActiveLaws +open AllFieldActiveCapacity AllFieldHistoryChildLaws AllFieldGroupOrbitData +open AllFieldGroupDegrees AllFieldGroupNativeLaws AllFieldGroupPairWindows +open JointCompatibilityScaling JointCompatibilityRateLimit JointPairClassWindows +open scoped BigOperators +attribute [local instance] Classical.propDecidable Classical.decEq + +theorem sum_conditionalCenter_entropy {A B : Type*} [Fintype A] [Fintype B] + [DecidableEq B] (p : FiniteLaw A) (f : A → B) : + (∑ b, (p.map f).mass b * finiteEntropy + (conditionalCenter f b p.mass ((p.map f).mass b))) = + finiteEntropy p.mass - finiteEntropy (p.map f).mass := by + have ht (b : B) : + (p.map f).mass b * finiteEntropy + (conditionalCenter f b p.mass ((p.map f).mass b)) = + (p.map f).mass b * finiteEntropy (p.conditional f b).mass := by + by_cases hz : (p.map f).mass b = 0 + · simp only [hz, zero_mul] + · congr 1 + congr 1 + funext a + simp only [conditionalCenter, FiniteLaw.conditional, dite_eq_right hz] + split_ifs <;> simp + simp_rw [ht] + have he := p.entropy_eq_map_add_conditional f + linarith + +variable {K tick : ℕ} {sigma : Placement} + +theorem baseSize_eq_parentBase_mul_sideMass (allocation : Allocation) + (sigma : Placement) (side : Fin 3) (h : ActiveOrder K tick sigma) (k : Fin 17) : + (baseSize (base allocation sigma side) (h, k) : ℝ) = + (parentBase allocation h : ℝ) * + JointPopulationRates.sideMass (orderLaw h).mass (sigma side) k := by + simp only [baseSize, base, JointPopulationCompatibility.classCounts, + Nat.cast_sum, Nat.cast_ite, Nat.cast_zero, JointPopulationRates.sideMass, + Finset.mul_sum] + apply Finset.sum_congr rfl + intro u _ + by_cases hu : JointPopulation.shapeSide (sigma side) u = k + · simp only [hu, ite_true] + exact jointCounts_cast allocation 1 h.val.val u + · simp only [hu, ite_false, mul_zero] + +theorem classMass_eq_sideMass (allocation : Allocation) (sigma : Placement) + (side : Fin 3) (c : Class (K := K) (tick := tick) sigma) : + classMass allocation sigma side c = + JointPopulationRates.sideMass (orderLaw c.1).mass (sigma side) c.2 := by + rcases c with ⟨h, k⟩ + unfold classMass + rw [baseSize_eq_parentBase_mul_sideMass] + exact mul_div_cancel_left₀ _ (by exact_mod_cast (parentBase_pos allocation h).ne') + +theorem nativePair_weight_marginal {K : ℕ} (w : Work K) (side : Fin 3) + (hs : w.stage ≠ 2) : + ((nativePairLaw w side).map (fun a => weightCode w a.1)).mass = + canonicalSideMass w side := by + cases w with + | stageA h => + rw [canonicalSideMass_stageA] + exact congrArg FiniteLaw.mass + (AllFieldPairMarginals.stageAPairLaw_leftWeight_marginal _ h.property side) + | stageB h => + rw [canonicalSideMass_stageB] + exact congrArg FiniteLaw.mass + (AllFieldPairMarginals.stageBPairLaw_leftWeight_marginal _ h.property side) + | stageC h => exact False.elim (hs rfl) + +theorem orderPair_weight_marginal (h : ActiveOrder K tick sigma) (side : Fin 3) + (hs : h.val.val.1.stage ≠ 2) : + ((nativePairLaw h.val.val.1 (h.val.val.1.priority side)).map + (fun a => weightCode h.val.val.1 a.1)).mass = + JointPopulationRates.sideMass (orderLaw h).mass (sigma side) := by + rw [nativePair_weight_marginal _ _ hs] + have hm := placedLaw_priority_sideMass h.val.val side + rw [h.property] at hm + exact hm.symm + +theorem q_eq_native_conditionalCenter (allocation : Allocation) (sigma : Placement) + (side : Fin 3) (c : Class (K := K) (tick := tick) sigma) + (hs : c.1.val.val.1.stage ≠ 2) : + q allocation sigma side c = conditionalCenter + (fun a => weightCode c.1.val.val.1 a.1) c.2 + (nativePairLaw c.1.val.val.1 (c.1.val.val.1.priority side)).mass + (((nativePairLaw c.1.val.val.1 (c.1.val.val.1.priority side)).map + (fun a => weightCode c.1.val.val.1 a.1)).mass c.2) := by + rw [q_eq_conditionalCenter allocation sigma side c hs, classMass_eq_sideMass, + orderPair_weight_marginal _ _ hs] + have hp : parentPair allocation sigma side c.1 = + (nativePairLaw c.1.val.val.1 (c.1.val.val.1.priority side)).mass := by + funext a + rw [parentPair_eq_native, orderPairMixture_eq_native] + rw [hp] + +theorem history_pair_entropy_of_sharing (allocation : Allocation) (sigma : Placement) + (side : Fin 3) (h : ActiveOrder K tick sigma) (hs : h.val.val.1.stage ≠ 2) : + (∑ k : Fin 17, (baseSize (base allocation sigma side) (h, k) : ℝ) * + finiteEntropy (q allocation sigma side (h, k))) = + (parentBase allocation h : ℝ) * + (finiteEntropy (nativePairLaw h.val.val.1 (h.val.val.1.priority side)).mass - + finiteEntropy (JointPopulationRates.sideMass (orderLaw h).mass (sigma side))) := by + have hq (k : Fin 17) := q_eq_native_conditionalCenter allocation sigma side (h, k) hs + simp_rw [baseSize_eq_parentBase_mul_sideMass, hq, mul_assoc] + rw [← Finset.mul_sum] + simpa only [orderPair_weight_marginal h side hs] using + congrArg (fun x : ℝ => (parentBase allocation h : ℝ) * x) + (sum_conditionalCenter_entropy + (nativePairLaw h.val.val.1 (h.val.val.1.priority side)) + (fun a => weightCode h.val.val.1 a.1)) + +theorem history_pair_entropy_of_ordinary (allocation : Allocation) (sigma : Placement) + (side : Fin 3) (h : ActiveOrder K tick sigma) (hs : h.val.val.1.stage = 2) : + (∑ k : Fin 17, (baseSize (base allocation sigma side) (h, k) : ℝ) * + finiteEntropy (q allocation sigma side (h, k))) = 0 := by + have : Subsingleton (Statistic h.val) := by + change Subsingleton h.val.val.1.Statistic + cases he : h.val.val.1 with + | stageA a => simp [he, Work.stage] at hs + | stageB a => simp [he, Work.stage] at hs + | stageC a => dsimp [Work.Statistic]; infer_instance + apply Finset.sum_eq_zero + intro k _ + by_cases hz : baseSize (base allocation sigma side) (h, k) = 0 + · simp only [hz, Nat.cast_zero, zero_mul] + · have hq : q allocation sigma side (h, k) = fun _ => 1 := by + funext a + exact q_eq_one_of_subsingleton allocation sigma side (h, k) + (Nat.pos_of_ne_zero hz) a + simp only [hq, finiteEntropy, entropyTerm, Real.log_one, mul_zero, + Finset.sum_const_zero] + +theorem pairReferenceEntropy_eq (allocation : Allocation) (sigma : Placement) + (side : Fin 3) : + pairReferenceEntropy (base (K := K) (tick := tick) allocation sigma side) + (q allocation sigma side) = + ∑ h : ActiveOrder K tick sigma, (parentBase allocation h : ℝ) * + (if h.val.val.1.stage ≠ 2 then + finiteEntropy (nativePairLaw h.val.val.1 (h.val.val.1.priority side)).mass - + finiteEntropy (JointPopulationRates.sideMass (orderLaw h).mass (sigma side)) + else 0) := by + unfold pairReferenceEntropy + rw [Fintype.sum_prod_type] + apply Finset.sum_congr rfl + intro h _ + by_cases hs : h.val.val.1.stage ≠ 2 + · rw [ite_eq_left hs] + exact history_pair_entropy_of_sharing allocation sigma side h hs + · rw [ite_eq_right hs, mul_zero] + exact history_pair_entropy_of_ordinary allocation sigma side h (not_not.mp hs) + +theorem baseEntropy_eq (allocation : Allocation) (sigma : Placement) (side : Fin 3) : + baseEntropy (base (K := K) (tick := tick) allocation sigma side) = + ∑ h : ActiveOrder K tick sigma, (parentBase allocation h : ℝ) * + (finiteEntropy (orderLaw h).mass - + finiteEntropy (JointPopulationRates.sideMass (orderLaw h).mass (sigma side))) := by + unfold baseEntropy + rw [Fintype.sum_prod_type] + apply Finset.sum_congr rfl + intro h _ + have hb (k : Fin 17) : base allocation sigma side (h, k) = + JointConditionalCountEntropy.classCounts (Counts allocation 1 sigma h) + (JointPopulation.shapeSide (sigma side)) k := by + funext u + by_cases hu : JointPopulation.shapeSide (sigma side) u = k + · simp only [base, JointPopulationCompatibility.classCounts, + JointConditionalCountEntropy.classCounts, hu, ite_true] + · simp only [base, JointPopulationCompatibility.classCounts, + JointConditionalCountEntropy.classCounts, hu, ite_false] + have hs (k : Fin 17) : baseSize (base allocation sigma side) (h, k) = + JointConditionalCountEntropy.classSize (Counts allocation 1 sigma h) + (JointPopulation.shapeSide (sigma side)) k := by + simp only [baseSize, JointConditionalCountEntropy.classSize, hb k] + have hm : ((orderLaw h).map (JointPopulation.shapeSide (sigma side))).mass = + JointPopulationRates.sideMass (orderLaw h).mass (sigma side) := by + funext k + rw [FiniteLaw.map_mass] + rfl + have he := JointConditionalCountEntropy.sum_classSize_mul_entropy_of_law + (Counts allocation 1 sigma h) (JointPopulation.shapeSide (sigma side)) + (orderLaw h) (parentBase allocation h : ℝ) + (fun u => jointCounts_cast allocation 1 h.val.val u) + rw [hm] at he + simpa only [hs, hb] using he + +def observedEntropy (h : ActiveOrder K tick sigma) (side : Fin 3) : ℝ := + if h.val.val.1.stage ≠ 2 then + finiteEntropy (nativePairLaw h.val.val.1 (h.val.val.1.priority side)).mass + else finiteEntropy (JointPopulationRates.sideMass (orderLaw h).mass (sigma side)) + +theorem baseEntropy_sub_pairReferenceEntropy (allocation : Allocation) + (sigma : Placement) (side : Fin 3) : + baseEntropy (base (K := K) (tick := tick) allocation sigma side) - + pairReferenceEntropy (base (K := K) (tick := tick) allocation sigma side) + (q allocation sigma side) = + ∑ h : ActiveOrder K tick sigma, (parentBase allocation h : ℝ) * + (finiteEntropy (orderLaw h).mass - observedEntropy h side) := by + rw [baseEntropy_eq, pairReferenceEntropy_eq, ← Finset.sum_sub_distrib] + apply Finset.sum_congr rfl + intro h _ + unfold observedEntropy + split_ifs <;> ring + +end MatrixMultiplication.AllFieldGroupPairEntropy + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldGroups/PairWindows.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldGroups/PairWindows.lean new file mode 100644 index 0000000000000000000000000000000000000000..88979a6ac21d8f484530e87c55dc8b1b04215314 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldGroups/PairWindows.lean @@ -0,0 +1,403 @@ +import OAI.LinearAlgebra.MatrixMultiplication.FieldGroups.AdmissibilityCore +import OAI.LinearAlgebra.MatrixMultiplication.FieldGroups.Degrees +import OAI.LinearAlgebra.MatrixMultiplication.FieldGroups.NativeLaws +import OAI.LinearAlgebra.MatrixMultiplication.FieldHistory.MaskLaws +import OAI.LinearAlgebra.MatrixMultiplication.JointExtraction.PairClassWindows +import OAI.LinearAlgebra.MatrixMultiplication.JointExtraction.PairMixtureControls +import OAI.LinearAlgebra.MatrixMultiplication.JointExtraction.CompatibilityRateLimit + +namespace OAI + +/-! Group assignments, orbit counts and extraction capacities. -/ + +noncomputable section + +namespace MatrixMultiplication.AllFieldGroupPairWindows + +open MatrixMultiplication.Foundation AllFieldHistory AllFieldHistorySupport +open AllFieldHistoryChildLaws AllFieldHistoryMasks AllFieldHistoryMaskLaws +open AllFieldHistoryGroupMasks AllFieldHistoryGroupedRecovery +open AllFieldGroupOrbitData AllFieldGroupDegrees AllFieldGroupNativeLaws +open JointCompatibilityScaling JointCompatibilityRateLimit +open scoped BigOperators +attribute [local instance] Classical.propDecidable + +variable {K tick : ℕ} + +def base (allocation : Allocation) (sigma : Placement) (side : Fin 3) := + JointPopulationCompatibility.classCounts + (Counts (K := K) (tick := tick) allocation 1 sigma) (sigma side) + +def q (allocation : Allocation) (sigma : Placement) (side : Fin 3) + (c : Class (K := K) (tick := tick) sigma) : Symbol (K := K) (tick := tick) sigma c × Symbol (K := K) (tick := tick) sigma c → ℝ := + JointPairMixtureControls.pairMixture (base (K := K) (tick := tick) allocation sigma side) + (fun c u => supportedHalfLaw allocation false c.1.val u (sigma side)) + (fun c u => supportedHalfLaw allocation true c.1.val u (sigma side)) c + +abbrev Positions (allocation : Allocation) (m : ℕ) (sigma : Placement) + (w : Raw (K := K) (tick := tick) allocation m sigma) := + JointPopulationCompatibility.ClassPos (Counts (K := K) (tick := tick) allocation m sigma) + (ownWord (K := K) (tick := tick) allocation m sigma w) + +def pairCounts (allocation : Allocation) (m : ℕ) (sigma : Placement) + (w : Raw (K := K) (tick := tick) allocation m sigma) := + JointPopulationCompatibility.statisticCounts (Counts (K := K) (tick := tick) allocation m sigma) + (Letter (K := K) (tick := tick) sigma) (Letter (K := K) (tick := tick) sigma) (Symbol (K := K) (tick := tick) sigma) (Symbol (K := K) (tick := tick) sigma) + (projectedStatistic (K := K) (tick := tick) sigma) (projectedStatistic (K := K) (tick := tick) sigma) + (ownWord (K := K) (tick := tick) allocation m sigma w) w + +def parentBase {sigma : Placement} (allocation : Allocation) (h : ActiveOrder K tick sigma) : ℕ := + population allocation 1 (h.val.val.1.source, h.val.val.2) + +def parentPair (allocation : Allocation) (sigma : Placement) (side : Fin 3) + (h : ActiveOrder K tick sigma) (a : Statistic h.val × Statistic h.val) : ℝ := + (∑ u, (activeCounts allocation 1 h.val u : ℝ) * + supportedHalfLaw allocation false h.val u (sigma side) a.1 * + supportedHalfLaw allocation true h.val u (sigma side) a.2) / parentBase (K := K) (tick := tick) allocation h + +def classMass (allocation : Allocation) (sigma : Placement) (side : Fin 3) + (c : Class (K := K) (tick := tick) sigma) : ℝ := + (baseSize (base (K := K) (tick := tick) allocation sigma side) c : ℝ) / parentBase (K := K) (tick := tick) allocation c.1 + +def windowFactor (allocation : Allocation) (sigma : Placement) : ℝ := + 1 + ∑ h : ActiveOrder K tick sigma, (parentBase (K := K) (tick := tick) allocation h : ℝ) + +theorem windowFactor_pos (allocation : Allocation) (sigma : Placement) : + 0 < windowFactor (K := K) (tick := tick) allocation sigma := by + unfold windowFactor + positivity + +theorem parentBase_pos {sigma : Placement} (allocation : Allocation) (h : ActiveOrder K tick sigma) : + 0 < parentBase (K := K) (tick := tick) allocation h := + AllFieldHistorySupport.work_source_population_pos allocation (by decide : 0 < (1 : ℕ)) h.val.val + +theorem parent_positions_card (allocation : Allocation) (m : ℕ) (sigma : Placement) + (h : ActiveOrder K tick sigma) : + Fintype.card (JointPopulation.Positions (Counts (K := K) (tick := tick) allocation m sigma) h) = + m * parentBase (K := K) (tick := tick) allocation h := by + change Fintype.card (Fin (∑ u, jointCounts allocation m h.val.val u)) = _ + rw [Fintype.card_fin, jointCounts_sum] + exact population_dilation allocation m _ + +theorem positions_card (allocation : Allocation) (m : ℕ) (ε : ℝ) (sigma : Placement) + (side : Fin 3) (e : Targets (K := K) (tick := tick) allocation m sigma) + (w : Raw (K := K) (tick := tick) allocation m sigma) (hw : Admissible allocation m ε sigma side e w) + (c : Class (K := K) (tick := tick) sigma) : + Fintype.card (Positions (K := K) (tick := tick) allocation m sigma w c) = + m * baseSize (base (K := K) (tick := tick) allocation sigma side) c := by + have he : JointPopulationCompatibility.FixedSideTargets (Counts (K := K) (tick := tick) allocation m sigma) + (sigma side) (ownWord (K := K) (tick := tick) allocation m sigma w) := + ⟨e, fun h j => (hw.1.1 h j).symm⟩ + rw [JointPopulationCompatibility.classCounts_size + (Counts (K := K) (tick := tick) allocation m sigma) (sigma side) (ownWord (K := K) (tick := tick) allocation m sigma w) he c] + simp only [JointPopulationCompatibility.classCounts, Counts, groupCounts, + activeCounts_dilation allocation m, base, baseSize, Finset.mul_sum, mul_ite, mul_zero] + +theorem parentPair_eq_parentCenter (allocation : Allocation) (sigma : Placement) + (side : Fin 3) (h : ActiveOrder K tick sigma) + (a : Statistic h.val × Statistic h.val) : + parentPair (K := K) (tick := tick) allocation sigma side h a = parentCenter allocation (sigma side) h.val a.1 a.2 := by + unfold parentPair parentCenter parentBase + rw [Finset.sum_div] + apply Finset.sum_congr rfl + intro u _ + by_cases hu : 0 < activeCounts allocation 1 h.val u + · simp only [supportedHalfLaw, ite_eq_left hu, halfLawAt, Bool.false_eq_true, + ite_false, ite_true] + ring + · have hz := Nat.eq_zero_of_not_pos hu + simp only [hz, Nat.cast_zero, zero_mul, zero_div] + +theorem parentPair_eq_native (allocation : Allocation) (sigma : Placement) + (side : Fin 3) (h : ActiveOrder K tick sigma) + (a : Statistic h.val × Statistic h.val) : + parentPair (K := K) (tick := tick) allocation sigma side h a = orderPairMixture h side a := by + rw [parentPair_eq_parentCenter] + unfold parentCenter orderPairMixture + apply Finset.sum_congr rfl + intro u _ + rw [show (activeCounts allocation 1 h.val u : ℝ) / + population allocation 1 (h.val.val.1.source, h.val.val.2) = + (AllFieldActiveLaws.orderLaw h).mass u from + AllFieldActiveLaws.jointCounts_ratio allocation (by decide : 0 < (1 : ℕ)) h.val.val u] + ring + +def parentStatistic (allocation : Allocation) (m : ℕ) (sigma : Placement) + (w : Raw (K := K) (tick := tick) allocation m sigma) (h : ActiveOrder K tick sigma) + (j : JointPopulation.Positions (Counts (K := K) (tick := tick) allocation m sigma) h) : + Statistic h.val × Statistic h.val := + (statistic h.val (w h j).1, statistic h.val (w h j).2) + +theorem parent_window (allocation : Allocation) (m : ℕ) (ε : ℝ) (sigma : Placement) + (side : Fin 3) (w : Raw (K := K) (tick := tick) allocation m sigma) + (hw : AllFieldHistoryGroupMasks.rawPass allocation m ε (sigma side) sigma w) + (h : ActiveOrder K tick sigma) (a : Statistic h.val × Statistic h.val) : + |(wordPopulation (parentStatistic (K := K) (tick := tick) allocation m sigma w h) a : ℝ) / + Fintype.card (JointPopulation.Positions (Counts (K := K) (tick := tick) allocation m sigma) h) - + parentPair (K := K) (tick := tick) allocation sigma side h a| ≤ pairWidth ε h.val := by + let defaults : SymbolChoice K tick := fun h => statistic h (fun _ => 0) + let l : SymbolChoice K tick := Function.update defaults h.val a.1 + let r : SymbolChoice K tick := Function.update defaults h.val a.2 + have hp := hw (h.val, l, r) h.property + rw [center_eq_parentCenter] at hp + simp only [l, r, Function.update_self] at hp + rw [parentPair_eq_parentCenter] + have hpop : Fintype.card (JointPopulation.Positions (Counts (K := K) (tick := tick) allocation m sigma) h) = + population allocation m (h.val.val.1.source, h.val.val.2) := by + change Fintype.card (Fin (∑ u, jointCounts allocation m h.val.val u)) = _ + rw [Fintype.card_fin] + exact jointCounts_sum allocation m h.val.val + rw [hpop] + have hcount : (wordPopulation (parentStatistic (K := K) (tick := tick) allocation m sigma w h) a : ℝ) = + ∑ j : JointPopulation.Positions (activeCounts allocation m) h.val, + if statistic h.val (w h j).1 = a.1 ∧ statistic h.val (w h j).2 = a.2 + then (1 : ℝ) else 0 := by + rcases a with ⟨a₁, a₂⟩ + simp only [wordPopulation, Fintype.card_subtype, Finset.card_eq_sum_ones, + Finset.sum_filter, Nat.cast_sum, Nat.cast_ite, Nat.cast_one, Nat.cast_zero, + parentStatistic, Prod.mk.injEq] + apply Finset.sum_congr rfl + intro j _ + split_ifs <;> rfl + rw [hcount] + exact hp + +def weightCode {K : ℕ} (w : Work K) : w.Statistic → Fin 17 := + match w with + | .stageA _ => AllFieldPairMarginals.halfWeightCode + | .stageB _ => AllFieldPairMarginals.statisticWeightCode + | .stageC _ => fun _ => 0 + +@[simp] theorem weightCode_val {K : ℕ} (w : Work K) (a : w.Statistic) : + (weightCode w a).val = w.statisticWeight a := by + cases w <;> rfl + +theorem weightCode_statistic {K : ℕ} (w : Work K) (hs : w.stage ≠ 2) + (x : CWWindowedLeaves.Raw w.halfLength) : + (weightCode w (w.statistic x)).val = CWStrands.weight x := + (weightCode_val w _).trans (w.statistic_weight hs x).symm + +theorem left_supported_zero (allocation : Allocation) (sigma : Placement) (side : Fin 3) + (h : ActiveOrder K tick sigma) (hs : h.val.val.1.stage ≠ 2) + (u : JointPopulation.Shape) (a : Statistic h.val) + (ha : weightCode h.val.val.1 a ≠ JointPopulation.shapeSide (sigma side) u) : + supportedHalfLaw allocation false h.val u (sigma side) a = 0 := by + by_cases hu : 0 < activeCounts allocation 1 h.val u + · rw [supportedHalfLaw_eq_of_counts_pos allocation 1 false h.val u hu, halfLawAt_eq] + apply Rat.cast_eq_zero.mpr + apply h.val.val.1.childLaw_outside_support hs _ + (halfShape_mem_of_counts_pos allocation 1 false h.val u hu) _ a + rw [halfShape_childWeight] + simpa only [childWeight, Bool.false_eq_true, ite_false, ← weightCode_val, + ne_eq, Fin.ext_iff] using ha + · simp only [supportedHalfLaw, ite_eq_right hu] + +theorem filtered_pair_sum (allocation : Allocation) (sigma : Placement) (side : Fin 3) + (c : Class (K := K) (tick := tick) sigma) (hs : c.1.val.val.1.stage ≠ 2) + (a : Symbol (K := K) (tick := tick) sigma c × Symbol (K := K) (tick := tick) sigma c) : + (∑ u, (base (K := K) (tick := tick) allocation sigma side c u : ℝ) * + supportedHalfLaw allocation false c.1.val u (sigma side) a.1 * + supportedHalfLaw allocation true c.1.val u (sigma side) a.2) = + if weightCode c.1.val.val.1 a.1 = c.2 then + ∑ u, (activeCounts allocation 1 c.1.val u : ℝ) * + supportedHalfLaw allocation false c.1.val u (sigma side) a.1 * + supportedHalfLaw allocation true c.1.val u (sigma side) a.2 + else 0 := by + have hterm (u : JointPopulation.Shape) : + (base (K := K) (tick := tick) allocation sigma side c u : ℝ) * + supportedHalfLaw allocation false c.1.val u (sigma side) a.1 * + supportedHalfLaw allocation true c.1.val u (sigma side) a.2 = + if weightCode c.1.val.val.1 a.1 = c.2 then + (activeCounts allocation 1 c.1.val u : ℝ) * + supportedHalfLaw allocation false c.1.val u (sigma side) a.1 * + supportedHalfLaw allocation true c.1.val u (sigma side) a.2 + else 0 := by + by_cases hu : JointPopulation.shapeSide (sigma side) u = c.2 + · simp only [base, JointPopulationCompatibility.classCounts, Counts, groupCounts, + hu, ite_true] + by_cases ha : weightCode c.1.val.val.1 a.1 = c.2 + · rw [ite_eq_left ha] + · have hz := left_supported_zero (K := K) (tick := tick) allocation sigma side c.1 hs u a.1 + (fun he => ha (he.trans hu)) + simp only [ha, ite_false, hz, mul_zero, zero_mul] + · simp only [base, JointPopulationCompatibility.classCounts, Counts, groupCounts, + hu, ite_false, Nat.cast_zero, zero_mul] + by_cases ha : weightCode c.1.val.val.1 a.1 = c.2 + · have hz := left_supported_zero (K := K) (tick := tick) allocation sigma side c.1 hs u a.1 + (fun he => hu (he.symm.trans ha)) + simp only [ha, ite_true, hz, mul_zero, zero_mul] + · rw [ite_eq_right ha] + simp_rw [hterm] + split_ifs <;> simp + +theorem q_eq_conditionalCenter (allocation : Allocation) (sigma : Placement) (side : Fin 3) + (c : Class (K := K) (tick := tick) sigma) (hs : c.1.val.val.1.stage ≠ 2) : + q (K := K) (tick := tick) allocation sigma side c = JointPairClassWindows.conditionalCenter + (fun a : Symbol (K := K) (tick := tick) sigma c × Symbol (K := K) (tick := tick) sigma c => weightCode c.1.val.val.1 a.1) + c.2 (parentPair (K := K) (tick := tick) allocation sigma side c.1) (classMass (K := K) (tick := tick) allocation sigma side c) := by + funext a + rw [q, JointPairMixtureControls.pairMixture, filtered_pair_sum (K := K) (tick := tick) allocation sigma side c hs] + unfold JointPairClassWindows.conditionalCenter parentPair classMass + by_cases ha : weightCode c.1.val.val.1 a.1 = c.2 + · simp only [ha, ite_true] + have hp : (parentBase (K := K) (tick := tick) allocation c.1 : ℝ) ≠ 0 := + Nat.cast_ne_zero.mpr (Nat.ne_of_gt (parentBase_pos (K := K) (tick := tick) allocation c.1)) + rw [div_div_div_cancel_right₀ hp] + · simp only [ha, ite_false, zero_div] + +theorem classMass_pos (allocation : Allocation) (sigma : Placement) (side : Fin 3) + (c : Class (K := K) (tick := tick) sigma) + (hc : 0 < baseSize (base (K := K) (tick := tick) allocation sigma side) c) : + 0 < classMass (K := K) (tick := tick) allocation sigma side c := + div_pos (Nat.cast_pos.mpr hc) (Nat.cast_pos.mpr (parentBase_pos (K := K) (tick := tick) allocation c.1)) + +theorem fiber_mass (allocation : Allocation) (m : ℕ) (ε : ℝ) (sigma : Placement) + (side : Fin 3) (e : Targets (K := K) (tick := tick) allocation m sigma) + (w : Raw (K := K) (tick := tick) allocation m sigma) (hw : Admissible allocation m ε sigma side e w) + (c : Class (K := K) (tick := tick) sigma) : + (Fintype.card (Positions (K := K) (tick := tick) allocation m sigma w c) : ℝ) = + (Fintype.card (JointPopulation.Positions (Counts (K := K) (tick := tick) allocation m sigma) c.1) : ℝ) * + classMass (K := K) (tick := tick) allocation sigma side c := by + rw [positions_card (K := K) (tick := tick) allocation m ε sigma side e w hw, parent_positions_card] + simp only [Nat.cast_mul, classMass] + have hp : (parentBase (K := K) (tick := tick) allocation c.1 : ℝ) ≠ 0 := + Nat.cast_ne_zero.mpr (Nat.ne_of_gt (parentBase_pos (K := K) (tick := tick) allocation c.1)) + rw [mul_assoc, mul_div_cancel₀ _ hp] + +theorem width_le (allocation : Allocation) {ε : ℝ} (hε : 0 ≤ ε) + (sigma : Placement) (side : Fin 3) (c : Class (K := K) (tick := tick) sigma) + (hc : 0 < baseSize (base (K := K) (tick := tick) allocation sigma side) c) : + pairWidth ε c.1.val / classMass (K := K) (tick := tick) allocation sigma side c ≤ + windowFactor (K := K) (tick := tick) allocation sigma * ε := by + have hpw : 0 ≤ pairWidth ε c.1.val := by unfold pairWidth; positivity + have hw : pairWidth ε c.1.val ≤ ε := + div_le_self hε (one_le_pow₀ (by norm_num)) + have hb : (1 : ℝ) ≤ baseSize (base (K := K) (tick := tick) allocation sigma side) c := by exact_mod_cast hc + have hn : (parentBase (K := K) (tick := tick) allocation c.1 : ℝ) ≤ windowFactor (K := K) (tick := tick) allocation sigma := by + unfold windowFactor + exact (Finset.single_le_sum (fun _ _ => Nat.cast_nonneg _) (Finset.mem_univ c.1)).trans + (le_add_of_nonneg_left zero_le_one) + unfold classMass + rw [div_div_eq_mul_div] + calc + pairWidth ε c.1.val * (parentBase (K := K) (tick := tick) allocation c.1 : ℝ) / + (baseSize (base (K := K) (tick := tick) allocation sigma side) c : ℝ) ≤ + pairWidth ε c.1.val * (parentBase (K := K) (tick := tick) allocation c.1 : ℝ) := + div_le_self (mul_nonneg hpw (Nat.cast_nonneg _)) hb + _ ≤ ε * windowFactor (K := K) (tick := tick) allocation sigma := mul_le_mul hw hn (Nat.cast_nonneg _) hε + _ = _ := mul_comm _ _ + +theorem sharing_window (allocation : Allocation) (m : ℕ) {ε : ℝ} (hε : 0 ≤ ε) + (sigma : Placement) (side : Fin 3) + (e : Targets (K := K) (tick := tick) allocation m sigma) + (w : Raw (K := K) (tick := tick) allocation m sigma) (hw : Admissible allocation m ε sigma side e w) + (hp : AllFieldHistoryGroupMasks.rawPass allocation m ε (sigma side) sigma w) + (c : Class (K := K) (tick := tick) sigma) (hs : c.1.val.val.1.stage ≠ 2) + (hc : 0 < baseSize (base (K := K) (tick := tick) allocation sigma side) c) + (a : Symbol (K := K) (tick := tick) sigma c × Symbol (K := K) (tick := tick) sigma c) : + |(pairCounts (K := K) (tick := tick) allocation m sigma w c a : ℝ) / + Fintype.card (Positions (K := K) (tick := tick) allocation m sigma w c) - q (K := K) (tick := tick) allocation sigma side c a| ≤ + windowFactor (K := K) (tick := tick) allocation sigma * ε := by + let z := parentStatistic (K := K) (tick := tick) allocation m sigma w c.1 + let k : JointPopulation.Positions (Counts (K := K) (tick := tick) allocation m sigma) c.1 → Fin 17 := + fun j => ownWord (K := K) (tick := tick) allocation m sigma w ⟨c.1, j⟩ + let f : Symbol (K := K) (tick := tick) sigma c × Symbol (K := K) (tick := tick) sigma c → Fin 17 := + fun a => weightCode c.1.val.val.1 a.1 + have hf (j) : f (z j) = k j := by + apply Fin.ext + exact weightCode_statistic c.1.val.val.1 hs (w c.1 j).1 + have hη : 0 ≤ pairWidth ε c.1.val := by unfold pairWidth; positivity + have hh := JointPairClassWindows.fiber_window z k f hf c.2 + (parentPair (K := K) (tick := tick) allocation sigma side c.1) (classMass (K := K) (tick := tick) allocation sigma side c) + (pairWidth ε c.1.val) (classMass_pos (K := K) (tick := tick) allocation sigma side c hc) hη + (fiber_mass (K := K) (tick := tick) allocation m ε sigma side e w hw c) + (parent_window (K := K) (tick := tick) allocation m ε sigma side w hp c.1) a + rw [← q_eq_conditionalCenter (K := K) (tick := tick) allocation sigma side c hs] at hh + exact hh.trans (width_le (K := K) (tick := tick) allocation hε sigma side c hc) + +theorem q_eq_one_of_subsingleton (allocation : Allocation) (sigma : Placement) (side : Fin 3) + (c : Class (K := K) (tick := tick) sigma) [Subsingleton (Symbol (K := K) (tick := tick) sigma c)] + (hc : 0 < baseSize (base (K := K) (tick := tick) allocation sigma side) c) + (a : Symbol (K := K) (tick := tick) sigma c × Symbol (K := K) (tick := tick) sigma c) : q (K := K) (tick := tick) allocation sigma side c a = 1 := by + have hl (right : Bool) (u : JointPopulation.Shape) + (hu : 0 < base (K := K) (tick := tick) allocation sigma side c u) : + supportedHalfLaw allocation right c.1.val u (sigma side) (if right then a.2 else a.1) = 1 := by + have hu' : 0 < activeCounts allocation 1 c.1.val u := by + unfold base JointPopulationCompatibility.classCounts Counts groupCounts at hu + split_ifs at hu with he + · exact hu + · omega + rw [supportedHalfLaw_eq_of_counts_pos allocation 1 right c.1.val u hu'] + have ht := halfLawAt_normalized allocation 1 right c.1.val u hu' (sigma side) + have he : (∑ b, halfLawAt right c.1.val u (sigma side) b) = + halfLawAt right c.1.val u (sigma side) (if right then a.2 else a.1) := + Fintype.sum_subsingleton _ _ + exact he.symm.trans ht + unfold q JointPairMixtureControls.pairMixture + have hn : (∑ u, (base (K := K) (tick := tick) allocation sigma side c u : ℝ) * + supportedHalfLaw allocation false c.1.val u (sigma side) a.1 * + supportedHalfLaw allocation true c.1.val u (sigma side) a.2) = + (baseSize (base (K := K) (tick := tick) allocation sigma side) c : ℝ) := by + rw [baseSize, Nat.cast_sum] + apply Finset.sum_congr rfl + intro u _ + by_cases hu : 0 < base (K := K) (tick := tick) allocation sigma side c u + · have hleft : supportedHalfLaw allocation false c.1.val u (sigma side) a.1 = 1 := by + simpa only [Bool.false_eq_true, ite_false] using hl false u hu + have hright : supportedHalfLaw allocation true c.1.val u (sigma side) a.2 = 1 := by + simpa only [ite_true] using hl true u hu + rw [hleft, hright, mul_one, mul_one] + · simp only [Nat.eq_zero_of_not_pos hu, Nat.cast_zero, zero_mul] + rw [hn] + exact div_self (Nat.cast_ne_zero.mpr (Nat.ne_of_gt hc)) + +theorem pairWindow_of_completeKeep (allocation : Allocation) {m : ℕ} (hm : 0 < m) + {ε : ℝ} (hε : 0 ≤ ε) (sigma : Placement) (side : Fin 3) + (e : Targets (K := K) (tick := tick) allocation m sigma) + (w : Raw (K := K) (tick := tick) allocation m sigma) (hw : Admissible allocation m ε sigma side e w) + (hp : completeKeep allocation m ε (sigma side) sigma w) : + PairWindow (base (K := K) (tick := tick) allocation sigma side) (q (K := K) (tick := tick) allocation sigma side) + (Positions (K := K) (tick := tick) allocation m sigma w) (pairCounts (K := K) (tick := tick) allocation m sigma w) + (windowFactor (K := K) (tick := tick) allocation sigma * ε) := by + intro c hc a + by_cases hs : c.1.val.val.1.stage ≠ 2 + · exact sharing_window (K := K) (tick := tick) allocation m hε sigma side e w hw hp.2.2 c hs hc a + · have hstage : c.1.val.val.1.stage = 2 := not_ne_iff.mp hs + have : Subsingleton (Symbol (K := K) (tick := tick) sigma c) := by + change Subsingleton c.1.val.val.1.Statistic + cases hh : c.1.val.val.1 with + | stageA h => simp [hh, Work.stage] at hstage + | stageB h => simp [hh, Work.stage] at hstage + | stageC h => dsimp [Work.Statistic]; infer_instance + have hpc : pairCounts (K := K) (tick := tick) allocation m sigma w c a = + Fintype.card (Positions (K := K) (tick := tick) allocation m sigma w c) := by + unfold pairCounts JointPopulationCompatibility.statisticCounts + have hall : ∀ i, JointPopulationCompatibility.statisticWord + (Counts (K := K) (tick := tick) allocation m sigma) (Letter (K := K) (tick := tick) sigma) (Letter (K := K) (tick := tick) sigma) (Symbol (K := K) (tick := tick) sigma) (Symbol (K := K) (tick := tick) sigma) + (projectedStatistic (K := K) (tick := tick) sigma) (projectedStatistic (K := K) (tick := tick) sigma) + (ownWord (K := K) (tick := tick) allocation m sigma w) w c i = a := fun _ => Subsingleton.elim _ _ + simp [wordPopulation, hall] + have hn : (Fintype.card (Positions (K := K) (tick := tick) allocation m sigma w c) : ℝ) ≠ 0 := by + rw [positions_card (K := K) (tick := tick) allocation m ε sigma side e w hw c] + exact Nat.cast_ne_zero.mpr (Nat.ne_of_gt (Nat.mul_pos hm hc)) + rw [hpc, div_self hn, q_eq_one_of_subsingleton (K := K) (tick := tick) allocation sigma side c hc a, + sub_self, abs_zero] + exact mul_nonneg (windowFactor_pos (K := K) (tick := tick) allocation sigma).le hε + +theorem passing_pairWindow (allocation : Allocation) {m : ℕ} (hm : 0 < m) + {ε : ℝ} (hε : 0 ≤ ε) (sigma : Placement) + (e : Targets (K := K) (tick := tick) allocation m sigma) + (o : Orbit (K := K) (tick := tick) allocation m sigma) (ho : o ∈ (data (K := K) (tick := tick) allocation m ε sigma).orbits e) + (v : Variable (K := K) (tick := tick) allocation m sigma) (hv : v ∈ (data (K := K) (tick := tick) allocation m ε sigma).passing e o) : + PairWindow (base (K := K) (tick := tick) allocation sigma v.1) (q (K := K) (tick := tick) allocation sigma v.1) + (Positions (K := K) (tick := tick) allocation m sigma v.2) (pairCounts (K := K) (tick := tick) allocation m sigma v.2) + (windowFactor (K := K) (tick := tick) allocation sigma * ε) := by + have hpass := (mem_passing allocation m ε sigma e o v).mp hv + exact pairWindow_of_completeKeep (K := K) (tick := tick) allocation hm hε sigma v.1 e v.2 + (AllFieldGroupAdmissible.full_admissible allocation m ε sigma e o ho v hpass.1) hpass.2 + +end MatrixMultiplication.AllFieldGroupPairWindows + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldGroups/ProjectedEntropy.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldGroups/ProjectedEntropy.lean new file mode 100644 index 0000000000000000000000000000000000000000..4bebdf7bc89e8745961d66ee9cb3c58bd92c8933 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldGroups/ProjectedEntropy.lean @@ -0,0 +1,326 @@ +import OAI.LinearAlgebra.MatrixMultiplication.FieldGroups.PairEntropy +import OAI.LinearAlgebra.MatrixMultiplication.FieldGroups.DegreeLaws +import OAI.LinearAlgebra.MatrixMultiplication.JointExtraction.GroupedEntropyEmbedding +import OAI.LinearAlgebra.MatrixMultiplication.JointExtraction.ProjectedGroupEntropy +import OAI.LinearAlgebra.MatrixMultiplication.FieldGroups.BranchDesignation +import OAI.LinearAlgebra.MatrixMultiplication.FieldGroups.BranchLaws +import OAI.LinearAlgebra.MatrixMultiplication.FieldConstruction.NativeGroupedRates + +namespace OAI + +/-! Group assignments, orbit counts and extraction capacities. -/ + +noncomputable section + +namespace MatrixMultiplication.AllFieldGroupProjectedEntropy + +open MatrixMultiplication.Foundation AllFieldParameters AllFieldHistory AllFieldActiveLaws +open AllFieldHistoryChildLaws AllFieldGroupOrbitData AllFieldGroupDegrees +open AllFieldGroupNativeLaws AllFieldGroupPairWindows AllFieldGroupDegreeLaws +open JointCompatibilityScaling JointCompatibilityRateLimit JointCompatibilityControls +open JointCompatibilityIncidence JointGroupedEntropyEmbedding JointGroupedEntropyPartition +open AllFieldGroupBranchDesignation AllFieldGroupBranchLaws AllFieldNativeGroupedRates +open AllFieldScheduledYield AllFieldGroupPairEntropy +open scoped BigOperators +attribute [local instance] Classical.propDecidable Classical.decEq + +section Kernel + +variable {U V G A : Type*} [Fintype U] [Fintype V] [Fintype G] [Fintype A] + +theorem groupedEntropy_congr_law_on_support (p : U → ℝ) (group : U → G) + (q q' : U → A → ℝ) (hq : ∀ u, p u ≠ 0 → q u = q' u) : + groupedEntropy p group q = groupedEntropy p group q' := by + have he (g : G) : groupLaw p group q g = groupLaw p group q' g := by + funext a + unfold groupLaw + congr 1 + apply Finset.sum_congr rfl + intro u _ + by_cases hp : p u = 0 + · simp only [hp, zero_mul] + · rw [hq u hp] + simp only [groupedEntropy, he] + +theorem groupedEntropy_designated_pushforward (p : U → ℝ) (f : U → V) + (hf : Function.Injective f) (d : V → Prop) (d' : U → Prop) + (hd : ∀ u, d (f u) ↔ d' u) (q : V → A → ℝ) (q' : U → A → ℝ) + (hq : ∀ u, p u ≠ 0 → q (f u) = q' u) : + groupedEntropy (pushforwardWeight p f) (designatedGroup d) q = + groupedEntropy p (designatedGroup d') q' := by + rw [groupedEntropy_pushforward] + have hg : designatedGroup d ∘ f = Option.map f ∘ designatedGroup d' := by + funext u + by_cases hu : d' u + · simp [designatedGroup, (hd u).mpr hu, hu] + · simp [designatedGroup, mt (hd u).mp hu, hu] + rw [hg, groupedEntropy_label_injective (Option.map f) (Option.map_injective hf)] + exact groupedEntropy_congr_law_on_support p _ _ q' hq + +theorem groupedEntropy_const_one (p : U → ℝ) (group : U → G) : + groupedEntropy p group (fun _ (_ : A) => 1) = 0 := by + unfold groupedEntropy + apply Finset.sum_eq_zero + intro g _ + by_cases hg : groupMass p group g = 0 + · rw [hg, zero_mul] + · have he : groupLaw p group (fun _ (_ : A) => 1) g = fun _ => 1 := by + funext a + simp only [groupLaw, mul_one] + exact div_self hg + rw [he] + simp [finiteEntropy, entropyTerm] + +omit [Fintype V] [Fintype G] in +theorem pushforwardWeight_mask (p : U → ℝ) (f : U → V) + (weight : V → G) (k : G) : + (fun v => if weight v = k then pushforwardWeight p f v else 0) = + pushforwardWeight (fun u => if weight (f u) = k then p u else 0) f := by + funext v + unfold pushforwardWeight + by_cases hv : weight v = k + · simp only [hv, ite_true] + apply Finset.sum_congr rfl + intro u _ + by_cases hu : f u = v <;> simp [hu, hv] + · simp only [hv, ite_false] + symm + apply Finset.sum_eq_zero + intro u _ + by_cases hu : f u = v <;> simp [hu, hv] + +end Kernel + +variable {K tick : ℕ} {sigma : Placement} + +def maskedBranchMass (h : ActiveOrder K tick sigma) (side : Fin 3) (k : Fin 17) + (b : h.val.val.1.Branch) : ℝ := + if nativeSplitWeightCode h.val.val.1 (h.val.val.1.priority side) b = k + then (branchLaw h.val.val.1).mass b else 0 + +theorem classCounts_cast_eq_pushforward (allocation : Allocation) (side : Fin 3) + (h : ActiveOrder K tick sigma) (k : Fin 17) : + (fun u => (base allocation sigma side (h, k) u : ℝ)) = + fun u => (parentBase allocation h : ℝ) * + pushforwardWeight (maskedBranchMass h side k) (branchShape h.val.val) u := by + have hpmap : (placedLaw h.val.val).mass = + pushforwardWeight (branchLaw h.val.val.1).mass (branchShape h.val.val) := by + funext u + simp only [placedLaw, FiniteLaw.map_mass, pushforwardWeight] + apply Finset.sum_congr rfl + intro b _ + by_cases hb : branchShape h.val.val b = u <;> simp only [hb, ite_true, ite_false] + have hm : (fun u => if JointPopulation.shapeSide (sigma side) u = k + then (placedLaw h.val.val).mass u else 0) = + pushforwardWeight (maskedBranchMass h side k) (branchShape h.val.val) := by + rw [hpmap] + funext u + unfold pushforwardWeight maskedBranchMass + by_cases hu : JointPopulation.shapeSide (sigma side) u = k + · simp only [hu, ite_true] + apply Finset.sum_congr rfl + intro b _ + by_cases hb : branchShape h.val.val b = u + · have hk : nativeSplitWeightCode h.val.val.1 (h.val.val.1.priority side) b = k := by + rw [← order_branch_weight h side b, hb] + exact hu + simp only [hb, hk, ite_true] + · simp only [hb, ite_false] + · simp only [hu, ite_false] + symm + apply Finset.sum_eq_zero + intro b _ + by_cases hb : branchShape h.val.val b = u + · have hk : nativeSplitWeightCode h.val.val.1 (h.val.val.1.priority side) b ≠ k := by + rw [← order_branch_weight h side b, hb] + exact hu + simp only [hb, hk, ite_true, ite_false] + · simp only [hb, ite_false] + funext u + change ((if JointPopulation.shapeSide (sigma side) u = k + then Counts allocation 1 sigma h u else 0 : ℕ) : ℝ) = _ + rw [Nat.cast_ite, Nat.cast_zero] + rw [← hm] + by_cases hu : JointPopulation.shapeSide (sigma side) u = k + · simp only [hu, ite_true] + exact jointCounts_cast allocation 1 h.val.val u + · simp only [hu, ite_false, mul_zero] + +def branchHalfLaw (w : Work K) (right : Bool) (side : Fin 3) + (b : w.Branch) (a : w.Statistic) : ℝ := + (w.childLaw (halfShape w.parentShape (w.splitShape b) right) (w.priority side) a : ℝ) + +theorem class_groupedEntropy_eq_masked (allocation : Allocation) (right : Bool) + (side : Fin 3) (hside : side ≠ 0) (h : ActiveOrder K tick sigma) (k : Fin 17) : + groupedEntropy (fun u => (base allocation sigma side (h, k) u : ℝ)) + (designatedGroup (classDesignated right side sigma (h, k))) + (nativeLaw allocation right side sigma (h, k)) = + (parentBase allocation h : ℝ) * + groupedEntropy (maskedBranchMass h side k) + (designatedGroup (nativeBranchDesignated h.val.val.1 right side)) + (branchHalfLaw h.val.val.1 right side) := by + rw [classCounts_cast_eq_pushforward, groupedEntropy_mul] + congr 1 + apply groupedEntropy_designated_pushforward _ _ (branchShape_injective h.val.val) + _ _ (fun b => designated_branchShape right side h hside b) + intro b hb + have hp : (branchLaw h.val.val.1).mass b ≠ 0 := by + intro hp + apply hb + simp only [maskedBranchMass, hp, ite_self] + exact supportedHalfLaw_branchShape_of_mass_ne_zero allocation right h b hp side + +theorem maskedBranchMass_eq_conditional (h : ActiveOrder K tick sigma) + (side : Fin 3) (k : Fin 17) : + maskedBranchMass h side k = fun b => + ((branchLaw h.val.val.1).map + (nativeSplitWeightCode h.val.val.1 (h.val.val.1.priority side))).mass k * + ((branchLaw h.val.val.1).conditional + (nativeSplitWeightCode h.val.val.1 (h.val.val.1.priority side)) k).mass b := by + funext b + exact ((branchLaw h.val.val.1).map_mass_mul_conditional + (nativeSplitWeightCode h.val.val.1 (h.val.val.1.priority side)) k b).symm + +def branchConditionalCost (w : Work K) (side : Fin 3) : ℝ := + ∑ k : Fin 17, + ((branchLaw w).map (nativeSplitWeightCode w (w.priority side))).mass k * + (groupedEntropy ((branchLaw w).conditional + (nativeSplitWeightCode w (w.priority side)) k).mass + (designatedGroup (nativeBranchDesignated w false side)) (branchHalfLaw w false side) + + groupedEntropy ((branchLaw w).conditional + (nativeSplitWeightCode w (w.priority side)) k).mass + (designatedGroup (nativeBranchDesignated w true side)) (branchHalfLaw w true side)) + +theorem history_projected_entropy_eq (allocation : Allocation) + (side : Fin 3) (hside : side ≠ 0) (h : ActiveOrder K tick sigma) : + (∑ k : Fin 17, + (groupedEntropy (fun u => (base allocation sigma side (h, k) u : ℝ)) + (designatedGroup (classDesignated false side sigma (h, k))) + (nativeLaw allocation false side sigma (h, k)) + + groupedEntropy (fun u => (base allocation sigma side (h, k) u : ℝ)) + (designatedGroup (classDesignated true side sigma (h, k))) + (nativeLaw allocation true side sigma (h, k)))) = + (parentBase allocation h : ℝ) * branchConditionalCost h.val.val.1 side := by + simp_rw [class_groupedEntropy_eq_masked allocation _ side hside, + maskedBranchMass_eq_conditional, groupedEntropy_mul] + simp only [branchConditionalCost, Finset.mul_sum, mul_add] + +theorem branchConditionalCost_eq (w : Work K) (side : Fin 3) (hside : side ≠ 0) : + branchConditionalCost w side = + if w.stage ≠ 2 then + finiteEntropy (nativePairLaw w (w.priority side)).mass - workCapacity w side + else 0 := by + cases w with + | stageA h => + have hs : (Work.stageA h).stage ≠ 2 := by change (0 : Fin 3) ≠ 2; decide + have hl : branchLaw (Work.stageA h) = + AllFieldNativeCapacity.stageASplitLaw (initialShape h.val) h.property := rfl + have hw : nativeSplitWeightCode (Work.stageA h) ((Work.stageA h).priority side) = + AllFieldPairConditionalEntropy.stageASplitWeight (initialShape h.val) h.property side := by + funext b + apply Fin.ext + rfl + have hd (right : Bool) : nativeBranchDesignated (Work.stageA h) right side = + fun b => AllFieldNativeCapacity.designated (Equiv.refl (Fin 3)) side + (halfShape (initialShape h.val) (below (initialShape h.val))[b.val] right) := by + funext b + apply propext + change (_ ∧ _) ↔ _ + exact ⟨fun hh => hh.2, fun hh => ⟨hs, hh⟩⟩ + have hq (right : Bool) : branchHalfLaw (Work.stageA h) right side = + fun b a => (halfLaw + (halfShape (initialShape h.val) (below (initialShape h.val))[b.val] right) + side a : ℝ) := rfl + rw [ite_eq_left hs] + rw [branchConditionalCost, hl, hw] + simp_rw [hd, hq] + change _ = finiteEntropy (AllFieldNativeCapacity.stageAPairLaw + (initialShape h.val) h.property side).mass - + AllFieldNativeCapacity.stageACapacity (initialShape h.val) side + dsimp only [Work.Branch, Work.Statistic, instFintypeBranch, instFintypeStatistic] + simpa only [twoHalfConditionalCost, halfShape, Bool.false_eq_true, ite_false, ite_true] using! + stageA_twoHalfConditionalCost_eq_entropy_sub_capacity _ h.property side hside + | stageB h => + have hs : (Work.stageB h).stage ≠ 2 := by change (1 : Fin 3) ≠ 2; decide + have hl : branchLaw (Work.stageB h) = + AllFieldNativeCapacity.stageBSplitLaw (aShape h.val) h.property := rfl + have hw : nativeSplitWeightCode (Work.stageB h) ((Work.stageB h).priority side) = + AllFieldPairConditionalEntropy.stageBSplitWeight (aShape h.val) h.property + (stageBPriority (aShape h.val) side) := by + funext b + apply Fin.ext + rfl + have hd (right : Bool) : nativeBranchDesignated (Work.stageB h) right side = + fun b => AllFieldNativeCapacity.designated (stageBPriority (aShape h.val)) side + (halfShape (aShape h.val) (below (aShape h.val))[b.val] right) := by + funext b + apply propext + change (_ ∧ _) ↔ _ + exact ⟨fun hh => hh.2, fun hh => ⟨hs, hh⟩⟩ + have hq (right : Bool) : branchHalfLaw (Work.stageB h) right side = + fun b a => (littleLaw (aShape h.val) + (halfShape (aShape h.val) (below (aShape h.val))[b.val] right) + (stageBPriority (aShape h.val) side) a : ℝ) := rfl + rw [ite_eq_left hs] + rw [branchConditionalCost, hl, hw] + simp_rw [hd, hq] + change _ = finiteEntropy (AllFieldNativeCapacity.stageBPairLaw + (aShape h.val) h.property (stageBPriority (aShape h.val) side)).mass - + AllFieldNativeCapacity.stageBCapacity (aShape h.val) side + dsimp only [Work.Branch, Work.Statistic, instFintypeBranch, instFintypeStatistic] + simpa only [twoHalfConditionalCost, halfShape, Bool.false_eq_true, ite_false, ite_true] using! + stageB_twoHalfConditionalCost_eq_entropy_sub_capacity _ h.property side hside + | stageC h => + rw [ite_eq_right (show ¬ (Work.stageC h).stage ≠ 2 by simp [Work.stage])] + unfold branchConditionalCost + have hq (right : Bool) : branchHalfLaw (Work.stageC h) right side = + fun _ _ => 1 := by + funext b a + simp only [branchHalfLaw, Work.childLaw, Rat.cast_one] + simp only [hq, groupedEntropy_const_one, zero_add, mul_zero, Finset.sum_const_zero] + +theorem branchConditionalCost_eq_observed (h : ActiveOrder K tick sigma) + (side : Fin 3) (hside : side ≠ 0) : + branchConditionalCost h.val.val.1 side = + observedEntropy h side - workCapacity h.val.val.1 side := by + rw [branchConditionalCost_eq _ side hside] + unfold observedEntropy + by_cases hs : h.val.val.1.stage ≠ 2 + · rw [ite_eq_left hs, ite_eq_left hs] + · rw [ite_eq_right hs, ite_eq_right hs] + have hc : workCapacity h.val.val.1 side = finiteEntropy + (JointPopulationRates.sideMass (orderLaw h).mass (sigma side)) := by + rcases h with ⟨⟨⟨w, phi⟩, ht⟩, ho⟩ + cases w with + | stageA a => exact False.elim (hs (by change (0 : Fin 3) ≠ 2; decide)) + | stageB a => exact False.elim (hs (by change (1 : Fin 3) ≠ 2; decide)) + | stageC a => + have hh := AllFieldActiveCapacity.workCapacity_stageC_physical a phi side + simpa only [ho, orderLaw] using hh + rw [hc, sub_self] + +theorem projected_native_entropy_eq (allocation : Allocation) (sigma : Placement) + (side : Fin 3) (hside : side ≠ 0) : + projectedReferenceEntropy (base (K := K) (tick := tick) allocation sigma side) + (classDesignated false side sigma) + (groupCap (base allocation sigma side) (classDesignated false side sigma) + (nativeLaw allocation false side sigma) 0) + + projectedReferenceEntropy (base (K := K) (tick := tick) allocation sigma side) + (classDesignated true side sigma) + (groupCap (base allocation sigma side) (classDesignated true side sigma) + (nativeLaw allocation true side sigma) 0) = + ∑ h : ActiveOrder K tick sigma, (parentBase allocation h : ℝ) * + (observedEntropy h side - workCapacity h.val.val.1 side) := by + rw [JointProjectedGroupEntropy.projectedReferenceEntropy_eq_sum_counts_groupedEntropy, + JointProjectedGroupEntropy.projectedReferenceEntropy_eq_sum_counts_groupedEntropy, + ← Finset.sum_add_distrib, Fintype.sum_prod_type] + apply Finset.sum_congr rfl + intro h _ + rw [history_projected_entropy_eq allocation side hside, + branchConditionalCost_eq_observed h side hside] + +end MatrixMultiplication.AllFieldGroupProjectedEntropy + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldGroups/Selection.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldGroups/Selection.lean new file mode 100644 index 0000000000000000000000000000000000000000..da99918ade9aa0a795b42d93b82ba3407cdc5da0 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldGroups/Selection.lean @@ -0,0 +1,100 @@ +import OAI.LinearAlgebra.MatrixMultiplication.FieldGroups.SelectionCore +import OAI.LinearAlgebra.MatrixMultiplication.JointExtraction.MaskedGoodSelection +import OAI.LinearAlgebra.MatrixMultiplication.FieldGroups.DegreeEnvelope +import OAI.LinearAlgebra.MatrixMultiplication.FieldGroups.NativeDegreeBound + +namespace OAI + +/-! Group assignments, orbit counts and extraction capacities. -/ + +noncomputable section + +namespace MatrixMultiplication.AllFieldGroupSelection + +open MatrixMultiplication.Foundation AllFieldHistory AllFieldActiveLaws +open AllFieldActiveCapacity AllFieldScheduledYield AllFieldNativeCapacity +open Filter +open scoped BigOperators Topology +attribute [local instance] Classical.propDecidable + +variable {K tick : ℕ} + +private theorem selected_of_native_count_bound + (allocation : Allocation) (sigma : Placement) (width : ℝ) + {slack : ℝ} (hslack : 0 < slack) + (hcounts : ∀ᶠ m : ℕ in atTop, + (∀ e : AllFieldGroupOrbitData.Targets (K := K) (tick := tick) allocation m sigma, + (((AllFieldGroupOrbitData.data (K := K) (tick := tick) allocation m width sigma).eligibilityCompetitors e).card : ℝ) ≤ + Real.exp ((m : ℝ) * + (nativeDegree (K := K) (tick := tick) allocation sigma + slack / 4))) ∧ + (∀ e : AllFieldGroupOrbitData.Targets (K := K) (tick := tick) allocation m sigma, + ∀ o ∈ (AllFieldGroupOrbitData.data (K := K) (tick := tick) allocation m width sigma).orbits e, + ∀ v ∈ (AllFieldGroupOrbitData.data (K := K) (tick := tick) allocation m width sigma).passing e o, + (((AllFieldGroupOrbitData.data (K := K) (tick := tick) allocation m width sigma).competitors e o v).card : ℝ) ≤ + Real.exp ((m : ℝ) * + (nativeDegree (K := K) (tick := tick) allocation sigma + slack / 4)))) : + ∀ᶠ m : ℕ in atTop, + Nonempty (Selected (K := K) (tick := tick) allocation m width sigma slack) := by + have hD : 0 ≤ nativeDegree (K := K) (tick := tick) allocation sigma + slack / 4 := by + linarith [nativeDegree_nonneg (K := K) (tick := tick) allocation sigma] + have hdegree := AllFieldGroupDegreeEnvelope.eventually_log_uniformDegree_le + allocation width sigma hD hcounts + have hrate : ∀ η : ℝ, 0 < η → ∀ᶠ m : ℕ in atTop, + Real.log (AllFieldGroupDegreeEnvelope.uniformDegree + (K := K) (tick := tick) allocation m width sigma : ℝ) / (m : ℝ) ≤ + nativeDegree (K := K) (tick := tick) allocation sigma + slack / 4 + η := by + intro η hη + filter_upwards [hdegree] with m hm + linarith + let : ∀ m : ℕ, Fintype (AllFieldGroupOrbitData.Pos + (K := K) (tick := tick) allocation m sigma) := fun m => inferInstance + let : ∀ m : ℕ, Fintype (AllFieldGroupOrbitData.Targets + (K := K) (tick := tick) allocation m sigma) := fun m => inferInstance + have hselected := JointMaskedGoodSelection.eventually_exists_good_selection + (fun m => AllFieldGroupOrbitData.data (K := K) (tick := tick) allocation m width sigma) + (fun m => data_coarse_injective (K := K) (tick := tick) allocation m width sigma) + (fun m => AllFieldGroupDegreeEnvelope.uniformDegree (K := K) (tick := tick) allocation m width sigma) + (orbitPrefactor (K := K) (tick := tick) allocation sigma) + (AllFieldGroupOrbitCount.groupDegree K tick sigma) + (fun m => AllFieldGroupDegreeEnvelope.eligibility_card_le (K := K) (tick := tick) allocation m width sigma) + (fun m => AllFieldGroupDegreeEnvelope.competitors_card_le (K := K) (tick := tick) allocation m width sigma) + (fun m => data_orbits_card_le (K := K) (tick := tick) allocation m width sigma) + (selectionHashRate_nonneg (K := K) (tick := tick) allocation sigma hslack) + (selectionHashRate_window_gap (K := K) (tick := tick) allocation sigma hslack) hrate + (Eventually.of_forall (AllFieldGroupTargetRate.target_card_pos + (K := K) (tick := tick) (sigma := sigma) allocation)) + (AllFieldGroupTargetRate.tendsto_log_target_card_div + (K := K) (tick := tick) (sigma := sigma) allocation) + (half_pos hslack) + filter_upwards [hselected] with m hm + obtain ⟨s, G, hcard, hgood, hdistinct⟩ := hm + refine ⟨{ + sample := s + targets := G + card_targets := ?_ + good := hgood + distinct_first := hdistinct }⟩ + simpa only [selection_exponent] using hcard + +theorem exists_threshold_eventually_selected + (allocation : Allocation) (sigma : Placement) + {slack widthMax : ℝ} (hslack : 0 < slack) (hwidthMax : 0 < widthMax) : + ∃ threshold : ℝ, 0 < threshold ∧ threshold ≤ widthMax ∧ + ∀ width : ℝ, 0 < width → width ≤ threshold → + ∀ᶠ m : ℕ in atTop, + Nonempty (Selected (K := K) (tick := tick) allocation m width sigma slack) := by + obtain ⟨threshold, hthreshold, hthresholdMax, hcounts⟩ := + AllFieldGroupNativeDegreeBound.exists_threshold_eventually_counts_le + (K := K) (tick := tick) (δ := slack / 4) allocation sigma + (div_pos hslack (by norm_num)) hwidthMax + refine ⟨threshold, hthreshold, hthresholdMax, ?_⟩ + intro width hwidth hsmall + apply selected_of_native_count_bound (K := K) (tick := tick) allocation sigma width hslack + simpa only [nativeDegree, AllFieldGroupNativeDegreeBound.maxNativeDegree] using + hcounts width hwidth hsmall + +end MatrixMultiplication.AllFieldGroupSelection + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldGroups/SelectionCore.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldGroups/SelectionCore.lean new file mode 100644 index 0000000000000000000000000000000000000000..0c74f65e9f1e473e53b63d0c54a2012402eb814c --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldGroups/SelectionCore.lean @@ -0,0 +1,66 @@ +import OAI.LinearAlgebra.MatrixMultiplication.FieldGroups.SelectionParameters +import OAI.LinearAlgebra.MatrixMultiplication.FieldGroups.OrbitData +import OAI.LinearAlgebra.MatrixMultiplication.JointExtraction.OrdinarySelection + +namespace OAI + +/-! Group assignments, orbit counts and extraction capacities. -/ + +noncomputable section + +namespace MatrixMultiplication.AllFieldGroupSelection + +open MatrixMultiplication.Foundation AllFieldHistory AllFieldActiveLaws +open AllFieldActiveCapacity AllFieldScheduledYield AllFieldNativeCapacity +open scoped BigOperators +attribute [local instance] Classical.propDecidable + +variable {K tick : ℕ} + +def orbitPrefactor (allocation : Allocation) (sigma : Placement) : ℕ := + 3 * (AllFieldHistoryOrbitCount.basePopulationBound (K := K) (tick := tick) + allocation + 1) ^ AllFieldGroupOrbitCount.groupDegree K tick sigma + +theorem data_orbits_card_le (allocation : Allocation) (m : ℕ) (ε : ℝ) + (sigma : Placement) + (e : AllFieldGroupOrbitData.Targets (K := K) (tick := tick) allocation m sigma) : + ((AllFieldGroupOrbitData.data (K := K) (tick := tick) allocation m ε sigma).orbits e).card ≤ + orbitPrefactor (K := K) (tick := tick) allocation sigma * + (m + 1) ^ AllFieldGroupOrbitCount.groupDegree K tick sigma := by + have hb := AllFieldGroupOrbitData.orbits_card_le allocation m ε sigma e + unfold orbitPrefactor + unfold AllFieldGroupOrbitCount.groupOrbitPrefactor at hb + exact_mod_cast hb + +theorem data_coarse_injective (allocation : Allocation) (m : ℕ) (ε : ℝ) + (sigma : Placement) : + Function.Injective + (AllFieldGroupOrbitData.data (K := K) (tick := tick) allocation m ε sigma).coarse := + AllFieldGroupOrbitData.coarse_injective allocation m sigma + +structure Selected (allocation : Allocation) (m : ℕ) (width : ℝ) + (sigma : Placement) (slack : ℝ) where + sample : JointCoarseHashing.Sample + (AllFieldGroupOrbitData.Pos (K := K) (tick := tick) allocation m sigma) + (JointOrdinarySelection.hashLevel + (selectionHashRate (K := K) (tick := tick) allocation sigma slack) m) + targets : Finset (AllFieldGroupOrbitData.Targets + (K := K) (tick := tick) allocation m sigma) + card_targets : targets.card = + ⌊Real.exp ((m : ℝ) * (nativeCapacity (K := K) (tick := tick) allocation - slack))⌋₊ + good : ∀ e ∈ targets, + (AllFieldGroupOrbitData.data (K := K) (tick := tick) allocation m width sigma).Good + (JointOrdinarySelection.hashLevel + (selectionHashRate (K := K) (tick := tick) allocation sigma slack) m) + (JointOrdinarySelection.hashSet + (selectionHashRate (K := K) (tick := tick) allocation sigma slack) m) + (m : ℝ) e sample + distinct_first : ∀ e ∈ targets, ∀ f ∈ targets, e ≠ f → + (AllFieldGroupOrbitData.coarse (K := K) (tick := tick) allocation m sigma e).1 ≠ + (AllFieldGroupOrbitData.coarse (K := K) (tick := tick) allocation m sigma f).1 + +end MatrixMultiplication.AllFieldGroupSelection + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldGroups/SelectionParameters.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldGroups/SelectionParameters.lean new file mode 100644 index 0000000000000000000000000000000000000000..51334eb30246816e83cb12e9144d3f15182da3f2 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldGroups/SelectionParameters.lean @@ -0,0 +1,90 @@ +import OAI.LinearAlgebra.MatrixMultiplication.FieldGroups.TargetRate +import OAI.LinearAlgebra.MatrixMultiplication.FieldConstruction.ActiveCapacity + +namespace OAI + +/-! Group assignments, orbit counts and extraction capacities. -/ + +noncomputable section + +namespace MatrixMultiplication.AllFieldGroupSelection + +open MatrixMultiplication.Foundation AllFieldHistory AllFieldActiveLaws +open AllFieldActiveCapacity AllFieldScheduledYield AllFieldNativeCapacity +open scoped BigOperators +attribute [local instance] Classical.propDecidable Classical.decEq + +variable {K tick : ℕ} + +def nativeDegree (allocation : Allocation) (sigma : Placement) : ℝ := + max (orderNativeDegree (K := K) (tick := tick) allocation sigma 0) + (max (orderNativeDegree (K := K) (tick := tick) allocation sigma 1) + (orderNativeDegree (K := K) (tick := tick) allocation sigma 2)) + +theorem targetEntropy_eq (allocation : Allocation) (sigma : Placement) : + AllFieldGroupTargetRate.groupEntropyRate (K := K) (tick := tick) + (sigma := sigma) allocation = + orderEntropyRate (K := K) (tick := tick) allocation sigma := rfl + +theorem firstDegree_nonneg (allocation : Allocation) (sigma : Placement) : + 0 ≤ orderNativeDegree (K := K) (tick := tick) allocation sigma 0 := by + apply Finset.sum_nonneg + intro h _ + apply mul_nonneg + · exact mul_nonneg (Nat.cast_nonneg _) (orderMass_nonneg allocation h) + · rw [order_first_capacity h] + exact sub_nonneg.mpr + (JointOrdinaryPopulationSelection.sideMass_entropy_le (orderLaw h) (sigma 0)) + +theorem nativeDegree_nonneg (allocation : Allocation) (sigma : Placement) : + 0 ≤ nativeDegree (K := K) (tick := tick) allocation sigma := + (firstDegree_nonneg allocation sigma).trans (le_max_left _ _) + +def nativeCapacity (allocation : Allocation) : ℝ := + (populationLength (K := K) allocation 1 : ℝ) * + ((1 / 6 : ℝ) * Staggering.minCapacity + (FiniteSchedule.tickCapacity K nativeLA nativeLB + (nativeLC (fun i => (allocation.mass i : ℝ))) tick)) + +theorem targetEntropy_sub_degree (allocation : Allocation) (sigma : Placement) : + AllFieldGroupTargetRate.groupEntropyRate (K := K) (tick := tick) + (sigma := sigma) allocation - nativeDegree (K := K) (tick := tick) allocation sigma = + nativeCapacity (K := K) (tick := tick) allocation := + order_entropy_sub_native_degree K tick allocation sigma + +def selectionHashRate (allocation : Allocation) (sigma : Placement) (slack : ℝ) : ℝ := + nativeDegree (K := K) (tick := tick) allocation sigma + slack / 2 + +theorem selectionHashRate_nonneg (allocation : Allocation) (sigma : Placement) + {slack : ℝ} (hslack : 0 < slack) : + 0 ≤ selectionHashRate (K := K) (tick := tick) allocation sigma slack := by + unfold selectionHashRate + linarith [nativeDegree_nonneg (K := K) (tick := tick) allocation sigma] + +theorem selectionHashRate_gap (allocation : Allocation) (sigma : Placement) + {slack : ℝ} (hslack : 0 < slack) : + nativeDegree (K := K) (tick := tick) allocation sigma < + selectionHashRate (K := K) (tick := tick) allocation sigma slack := by + unfold selectionHashRate + linarith + +theorem selectionHashRate_window_gap (allocation : Allocation) (sigma : Placement) + {slack : ℝ} (hslack : 0 < slack) : + nativeDegree (K := K) (tick := tick) allocation sigma + slack / 4 < + selectionHashRate (K := K) (tick := tick) allocation sigma slack := by + unfold selectionHashRate + linarith + +theorem selection_exponent (allocation : Allocation) (sigma : Placement) (slack : ℝ) : + AllFieldGroupTargetRate.groupEntropyRate (K := K) (tick := tick) + (sigma := sigma) allocation - + selectionHashRate (K := K) (tick := tick) allocation sigma slack - slack / 2 = + nativeCapacity (K := K) (tick := tick) allocation - slack := by + rw [selectionHashRate] + linarith [targetEntropy_sub_degree (K := K) (tick := tick) allocation sigma] + +end MatrixMultiplication.AllFieldGroupSelection + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldGroups/SourceSupport.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldGroups/SourceSupport.lean new file mode 100644 index 0000000000000000000000000000000000000000..ff090eae33044f111c6bf34a504d226e0008ce90 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldGroups/SourceSupport.lean @@ -0,0 +1,86 @@ +import OAI.LinearAlgebra.MatrixMultiplication.FieldGroups.OrbitData + +namespace OAI + +/-! Group assignments, orbit counts and extraction capacities. -/ + +noncomputable section + +namespace MatrixMultiplication.AllFieldGroupSourceSupport + +open MatrixMultiplication.Foundation AllFieldHistory AllFieldHistorySupport +open AllFieldHistoryChildLaws AllFieldHistoryGroupMasks AllFieldHistoryGroupedRecovery +open AllFieldGroupOrbitData JointPopulation JointCanonicalization JointCanonicalCW +open scoped BigOperators +attribute [local instance] Classical.propDecidable + +variable {K tick : ℕ} + +theorem masks_of_prepared (F : Type*) [CommRing F] (allocation : Allocation) + (m : ℕ) (ε : ℝ) (sigma : Placement) + (x y z : GroupRaw (K := K) (tick := tick) allocation m sigma) + (hT : groupPreparedSource F allocation m ε sigma x y z ≠ 0) : + completeKeep allocation m ε 0 sigma x ∧ + completeKeep allocation m ε 1 sigma y ∧ + completeKeep allocation m ε 2 sigma z := by + by_contra hn + apply hT + exact ite_eq_right hn + +theorem raw_nonzero (F : Type*) [CommRing F] (allocation : Allocation) + (m : ℕ) (ε : ℝ) (sigma : Placement) + (x y z : GroupRaw (K := K) (tick := tick) allocation m sigma) + (hT : groupPreparedSource F allocation m ε sigma x y z ≠ 0) : + groupRawSource F allocation m sigma x y z ≠ 0 := by + have hm := masks_of_prepared F allocation m ε sigma x y z hT + simpa only [groupPreparedSource, ExactRecovery.delete, ite_eq_left hm] using hT + +theorem marginal_sideMask (allocation : Allocation) (m : ℕ) (side : Fin 3) + (sigma : Placement) (w : GroupRaw (K := K) (tick := tick) allocation m sigma) + (hm : marginal allocation m side sigma w) : + JointCanonicalMixed.sideMask (groupCounts allocation m sigma) + (fun h => activeHalfLength h.val) (fun h => activeHalfLength h.val) + (fun h => AllFieldHistoryRecovery.halfLength_le_eight h.val) side w := by + intro h a + exact (hm h a).trans + (marginal_population_eq (groupCounts allocation m sigma) + (projectTarget allocation m sigma (canonicalTarget (activeCounts allocation m))) + (canonicalTarget (groupCounts allocation m sigma)) h side a) + +theorem marginal_source_nonzero (F : Type*) [CommRing F] (allocation : Allocation) + (m : ℕ) (ε : ℝ) (sigma : Placement) + (x y z : GroupRaw (K := K) (tick := tick) allocation m sigma) + (hT : groupPreparedSource F allocation m ε sigma x y z ≠ 0) : + JointCanonicalMixed.maskedSource (F := F) (groupCounts allocation m sigma) + (fun h => activeHalfLength h.val) (fun h => activeHalfLength h.val) + (fun h => activeParentShape h.val) (fun _ => true) + (fun h => AllFieldHistoryRecovery.halfLength_le_eight h.val) x y z ≠ 0 := by + have hm := masks_of_prepared F allocation m ε sigma x y z hT + have hx := marginal_sideMask allocation m 0 sigma x hm.1.1 + have hy := marginal_sideMask allocation m 1 sigma y hm.2.1.1 + have hz := marginal_sideMask allocation m 2 sigma z hm.2.2.1 + rw [JointCanonicalMixed.maskedSource, ExactRecovery.delete, + ite_eq_left (And.intro hx (And.intro hy hz))] + exact raw_nonzero F allocation m ε sigma x y z hT + +theorem prepared_source_support (F : Type*) [CommRing F] (allocation : Allocation) + (m : ℕ) (ε : ℝ) (sigma : Placement) + (x y z : GroupRaw (K := K) (tick := tick) allocation m sigma) + (hT : groupPreparedSource F allocation m ε sigma x y z ≠ 0) : + reorder sigma + (ownWord allocation m sigma x, ownWord allocation m sigma y, + ownWord allocation m sigma z) ∈ ambient allocation m sigma := by + apply Finset.mem_image.mpr + refine ⟨(ownWord allocation m sigma x, ownWord allocation m sigma y, + ownWord allocation m sigma z), ?_, rfl⟩ + exact JointCanonicalMixed.maskedSource_support (groupCounts allocation m sigma) + (fun h => activeHalfLength h.val) (fun h => activeHalfLength h.val) + (fun h => activeParentShape h.val) (fun _ => true) + (fun h => AllFieldHistoryRecovery.halfLength_le_eight h.val) x y z + (marginal_source_nonzero F allocation m ε sigma x y z hT) + +end MatrixMultiplication.AllFieldGroupSourceSupport + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldGroups/StatisticComplement.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldGroups/StatisticComplement.lean new file mode 100644 index 0000000000000000000000000000000000000000..05316eba48f8affd7a949db224b5bdf43b570ab1 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldGroups/StatisticComplement.lean @@ -0,0 +1,28 @@ +import OAI.LinearAlgebra.MatrixMultiplication.FieldGroups.OrbitData +import OAI.LinearAlgebra.MatrixMultiplication.CoppersmithWinograd.CWCompatibilityTransfer + +namespace OAI + +/-! Group assignments, orbit counts and extraction capacities. -/ + +noncomputable section + +namespace MatrixMultiplication.AllFieldGroupStatisticComplement + +open AllFieldHistory AllFieldHistoryChildLaws + +theorem statistic_wordComplement {K tick : ℕ} {sigma : Placement} + (h : ActiveOrder K tick sigma) (w : Fin (activeHalfLength h.val) → Fin 7) : + statistic h.val (CWCompatibilityTransfer.wordComplement w) = + AllFieldGroupOrbitData.complement h (statistic h.val w) := by + rcases h with ⟨⟨⟨work, phi⟩, ht⟩, ho⟩ + cases work with + | stageA a => exact CWCompleteStatistics.four_complement w + | stageB b => exact CWCompleteStatistics.two_complement w + | stageC c => rfl + +end MatrixMultiplication.AllFieldGroupStatisticComplement + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldGroups/TargetRate.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldGroups/TargetRate.lean new file mode 100644 index 0000000000000000000000000000000000000000..cecc697ea93bf5ba23caa86391e2e1263705c466 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldGroups/TargetRate.lean @@ -0,0 +1,137 @@ +import OAI.LinearAlgebra.MatrixMultiplication.FieldConstruction.ActiveLaws +import OAI.LinearAlgebra.MatrixMultiplication.JointExtraction.CompatibilityScaling + +namespace OAI + +/-! Group assignments, orbit counts and extraction capacities. -/ + +noncomputable section + +namespace MatrixMultiplication.AllFieldGroupTargetRate + +open AllFieldHistory AllFieldActiveLaws MatrixMultiplication.Foundation Filter +open scoped BigOperators Topology +attribute [local instance] Classical.propDecidable Classical.decEq + +variable {K tick : ℕ} {sigma : Placement} + +theorem source_unit_pos (allocation : Allocation) : + 0 < populationLength (K := K) allocation 1 := + AllFieldPopulationCounts.blockLength_pos (amount (K := K) allocation) (by decide) + +theorem source_length_dilation (allocation : Allocation) (m : ℕ) : + populationLength (K := K) allocation m = + m * populationLength (K := K) allocation 1 := + populationLength_dilation allocation m + +theorem orderCounts_dilation (allocation : Allocation) (m : ℕ) + (h : ActiveOrder K tick sigma) (u : JointPopulation.Shape) : + orderCounts allocation m h u = m * orderCounts allocation 1 h u := by + apply Nat.cast_injective (R := ℝ) + rw [Nat.cast_mul, orderCounts_source_cast, orderCounts_source_cast, + populationLength_dilation, Nat.cast_mul] + ring + +theorem orderCounts_dilation_fun (allocation : Allocation) (m : ℕ) : + orderCounts (K := K) (tick := tick) (sigma := sigma) allocation m = + fun h u => m * orderCounts allocation 1 h u := by + funext h u + exact orderCounts_dilation allocation m h u + +theorem orderCounts_sum (allocation : Allocation) (m : ℕ) + (h : ActiveOrder K tick sigma) : + (∑ u, orderCounts allocation m h u) = + population allocation m (h.val.val.1.source, h.val.val.2) := + jointCounts_sum allocation m h.val.val + +theorem baseSize_eq_population (allocation : Allocation) (m : ℕ) + (h : ActiveOrder K tick sigma) : + JointCompatibilityScaling.baseSize (orderCounts allocation m) h = + population allocation m (h.val.val.1.source, h.val.val.2) := + orderCounts_sum allocation m h + +theorem baseSize_dilation (allocation : Allocation) (m : ℕ) + (h : ActiveOrder K tick sigma) : + JointCompatibilityScaling.baseSize (orderCounts allocation m) h = + m * JointCompatibilityScaling.baseSize (orderCounts allocation 1) h := by + simp only [JointCompatibilityScaling.baseSize] + simp_rw [orderCounts_dilation allocation m] + exact (Finset.mul_sum Finset.univ _ m).symm + +theorem baseSize_cast_real (allocation : Allocation) + (h : ActiveOrder K tick sigma) : + (JointCompatibilityScaling.baseSize (orderCounts allocation 1) h : ℝ) = + (populationLength (K := K) allocation 1 : ℝ) * orderMass allocation h := by + rw [baseSize_eq_population, population_cast_real] + rfl + +theorem baseSize_pos (allocation : Allocation) + (h : ActiveOrder K tick sigma) : + 0 < JointCompatibilityScaling.baseSize (orderCounts allocation 1) h := by + rw [baseSize_eq_population] + exact work_source_population_pos allocation (by decide) h.val.val + +theorem base_empirical_eq (allocation : Allocation) + (h : ActiveOrder K tick sigma) (u : JointPopulation.Shape) : + (orderCounts allocation 1 h u : ℝ) / + JointCompatibilityScaling.baseSize (orderCounts allocation 1) h = + (orderLaw h).mass u := by + rw [baseSize_eq_population] + exact jointCounts_ratio allocation (by decide) h.val.val u + +def groupEntropyRate (allocation : Allocation) : ℝ := + ∑ h : ActiveOrder K tick sigma, + ((populationLength (K := K) allocation 1 : ℝ) * orderMass allocation h) * + finiteEntropy (orderLaw h).mass + +theorem groupEntropyRate_nonneg (allocation : Allocation) : + 0 ≤ groupEntropyRate (K := K) (tick := tick) (sigma := sigma) allocation := by + apply Finset.sum_nonneg + intro h _ + exact mul_nonneg + (mul_nonneg (Nat.cast_nonneg _) (orderMass_nonneg allocation h)) + (FiniteLaw.entropy_nonneg (orderLaw h)) + +theorem baseEntropy_eq_groupEntropyRate (allocation : Allocation) : + JointCompatibilityScaling.baseEntropy + (orderCounts (K := K) (tick := tick) (sigma := sigma) allocation 1) = + groupEntropyRate (K := K) (tick := tick) (sigma := sigma) allocation := by + simp only [JointCompatibilityScaling.baseEntropy, groupEntropyRate] + simp only [base_empirical_eq] + simp only [baseSize_cast_real] + +theorem target_card_pos (allocation : Allocation) (m : ℕ) : + 0 < Fintype.card (JointPopulation.Target + (orderCounts (K := K) (tick := tick) (sigma := sigma) allocation m)) := + Fintype.card_pos_iff.mpr (JointPopulation.target_nonempty _) + +theorem tendsto_log_target_card_div (allocation : Allocation) : + Tendsto (fun m : ℕ => + Real.log (Fintype.card (JointPopulation.Target + (orderCounts (K := K) (tick := tick) (sigma := sigma) allocation m)) : ℝ) / + (m : ℝ)) atTop + (𝓝 (groupEntropyRate (K := K) (tick := tick) (sigma := sigma) allocation)) := by + apply JointPopulationRates.tendsto_log_target_card_div_of_coordinate_rates + (fun m => orderCounts allocation m) + (fun h => (populationLength (K := K) allocation 1 : ℝ) * orderMass allocation h) + (fun h => (orderLaw h).mass) + · intro h + exact mul_nonneg (Nat.cast_nonneg _) (orderMass_nonneg allocation h) + · intro h + exact (orderLaw h).total + · exact orderCounts_dilation_rate allocation + +theorem tendsto_log_targetSet_card_div (allocation : Allocation) : + Tendsto (fun m : ℕ => + Real.log ((JointPopulation.targetSet + (orderCounts (K := K) (tick := tick) (sigma := sigma) allocation m)).card : ℝ) / + (m : ℝ)) atTop + (𝓝 (groupEntropyRate (K := K) (tick := tick) (sigma := sigma) allocation)) := by + simpa only [JointPopulation.target_card, JointPopulation.targetSet_card] using + tendsto_log_target_card_div (K := K) (tick := tick) (sigma := sigma) allocation + +end MatrixMultiplication.AllFieldGroupTargetRate + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldHistory/Bounds.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldHistory/Bounds.lean new file mode 100644 index 0000000000000000000000000000000000000000..c9791190c5b0bbeac3ea72c05e189ec6bdc7331b --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldHistory/Bounds.lean @@ -0,0 +1,116 @@ +import OAI.LinearAlgebra.MatrixMultiplication.FieldHistory.Counts +import OAI.LinearAlgebra.MatrixMultiplication.Recovery.HistorySupport + +namespace OAI + +/-! Finite extraction histories, inherited masks and recovery bounds. -/ + +noncomputable section +namespace MatrixMultiplication.AllFieldHistory + +open AllFieldParameters +open scoped BigOperators +attribute [local instance] Classical.propDecidable Classical.decEq + +theorem work_source_amount_pos {K : ℕ} (allocation : Allocation) (w : PlacedWork K) : + 0 < amount allocation (w.1.source, w.2) := by + apply div_pos _ (by norm_num) + cases w.1 with + | stageA h => exact initialAmount_pos h.val + | stageB h => exact aAmount_pos h.val + | stageC h => exact partAmount_pos allocation h + +theorem work_source_population_pos {K : ℕ} (allocation : Allocation) {dilation : ℕ} + (hd : 0 < dilation) (w : PlacedWork K) : + 0 < population allocation dilation (w.1.source, w.2) := + (AllFieldPopulationCounts.count_pos_iff _ (amount_nonneg allocation) hd _).mpr + (work_source_amount_pos allocation w) + +abbrev PositiveBranch {K : ℕ} (allocation : Allocation) (w : PlacedWork K) := + {b : w.1.Branch // 0 < amount allocation (w.1.child b false, w.2)} + +theorem branchPopulation_pos_iff {K : ℕ} (allocation : Allocation) {dilation : ℕ} + (hd : 0 < dilation) (w : PlacedWork K) (b : w.1.Branch) : + 0 < branchPopulation allocation dilation w b ↔ + 0 < amount allocation (w.1.child b false, w.2) := + AllFieldPopulationCounts.count_pos_iff _ (amount_nonneg allocation) hd _ + +theorem positive_branch_minimum {K : ℕ} (allocation : Allocation) (dilation : ℕ) + (w : PlacedWork K) (b : PositiveBranch allocation w) : + dilation ≤ branchPopulation allocation dilation w b.val := + AllFieldPopulationCounts.dilation_le_count _ (amount_nonneg allocation) dilation _ b.property + +theorem positive_joint_class_minimum {K : ℕ} (allocation : Allocation) {dilation : ℕ} + (hd : 0 < dilation) (w : PlacedWork K) (u : JointPopulation.Shape) + (hu : 0 < jointCounts allocation dilation w u) : dilation ≤ jointCounts allocation dilation w u := by + obtain ⟨b, rfl, hb⟩ := shapeCounts_positive _ _ u hu + rw [jointCounts_at] + exact positive_branch_minimum allocation dilation w + ⟨b, (branchPopulation_pos_iff allocation hd w b).mp hb⟩ + +def activeLengthRate {K tick : ℕ} (allocation : Allocation) : ℚ := + ∑ h : Active K tick, amount allocation (h.val.1.source, h.val.2) * + (2 * h.val.1.halfLength : ℕ) + +def activePositions {K tick : ℕ} (allocation : Allocation) (dilation : ℕ) + (h : Active K tick) : Type := + Fin (population allocation dilation (h.val.1.source, h.val.2)) + +instance {K tick : ℕ} (allocation : Allocation) (dilation : ℕ) (h : Active K tick) : + Fintype (activePositions allocation dilation h) := inferInstanceAs (Fintype (Fin _)) + +theorem active_totalLength_cast {K tick : ℕ} (allocation : Allocation) (dilation : ℕ) : + (HistorySupport.totalLength (activePositions (K := K) (tick := tick) allocation dilation) + activeHalfLength activeHalfLength : ℚ) = + (populationLength (K := K) allocation dilation : ℚ) * + activeLengthRate (K := K) (tick := tick) allocation := by + simp only [HistorySupport.totalLength, Nat.cast_sum, Nat.cast_mul, + activeHalfLength, activeLengthRate, Finset.mul_sum] + apply Finset.sum_congr rfl + intro h hh + have hcard : Fintype.card (activePositions allocation dilation h) = + population allocation dilation (h.val.1.source, h.val.2) := Fintype.card_fin _ + rw [hcard, population_cast] + push_cast + ring + +def activeLengthBudget {K tick : ℕ} (allocation : Allocation) : ℕ := + Nat.ceil (activeLengthRate (K := K) (tick := tick) allocation) + +theorem active_totalLength_le {K tick : ℕ} (allocation : Allocation) (dilation : ℕ) : + HistorySupport.totalLength (activePositions (K := K) (tick := tick) allocation dilation) + activeHalfLength activeHalfLength ≤ + activeLengthBudget (K := K) (tick := tick) allocation * + populationLength (K := K) allocation dilation := by + have h := active_totalLength_cast (K := K) (tick := tick) allocation dilation + have hc : activeLengthRate (K := K) (tick := tick) allocation ≤ + (activeLengthBudget (K := K) (tick := tick) allocation : ℚ) := Nat.le_ceil _ + have hb := mul_le_mul_of_nonneg_left hc + (Nat.cast_nonneg (populationLength (K := K) allocation dilation) : + (0 : ℚ) ≤ populationLength (K := K) allocation dilation) + rw [← h] at hb + exact_mod_cast hb.trans_eq (mul_comm _ _) + +theorem active_cw5_support_bound {F : Type*} [Zero F] {K tick : ℕ} + (allocation : Allocation) (dilation : ℕ) + (Q : HistorySupport.HistoryWords + (activePositions (K := K) (tick := tick) allocation dilation) + activeHalfLength activeHalfLength 7 → + HistorySupport.HistoryWords + (activePositions (K := K) (tick := tick) allocation dilation) + activeHalfLength activeHalfLength 7 → + HistorySupport.HistoryWords + (activePositions (K := K) (tick := tick) allocation dilation) + activeHalfLength activeHalfLength 7 → F) : + ((RecoverySupport.support Q).card : ℝ) ≤ + Real.exp (RecoverySupport.cw5SupportRate + (activeLengthBudget (K := K) (tick := tick) allocation) * + (populationLength (K := K) allocation dilation : ℝ)) := + HistorySupport.cw5_support_card_le_exp _ _ _ Q _ _ + (active_totalLength_le allocation dilation) + +end MatrixMultiplication.AllFieldHistory + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldHistory/BranchWeights.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldHistory/BranchWeights.lean new file mode 100644 index 0000000000000000000000000000000000000000..b782fe2fae112af995191f7fc959c054da2aebd5 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldHistory/BranchWeights.lean @@ -0,0 +1,69 @@ +import OAI.LinearAlgebra.MatrixMultiplication.FieldHistory.Support + +namespace OAI + +/-! Finite extraction histories, inherited masks and recovery bounds. -/ + +noncomputable section + +namespace MatrixMultiplication.AllFieldHistoryBranchWeights + +open AllFieldHistory AllFieldHistorySupport AllFieldParameters +open scoped BigOperators +attribute [local instance] Classical.propDecidable Classical.decEq + +theorem stageB_branchPopulation_rat {K : ℕ} (allocation : Allocation) (dilation : ℕ) + (h : APositive K) (b : BSplit h) (phi : Placement) : + (branchPopulation allocation dilation (.stageB h, phi) b : ℚ) = + (population allocation dilation (.afterA h.val, phi) : ℚ) * + stageBLaw (aShape h.val) (bSplit ⟨h, b, false⟩) := by + simp only [branchPopulation, Work.child, population_cast, amount, canonicalAmount, bAmount] + ring + +theorem stageB_branchPopulation_real {K : ℕ} (allocation : Allocation) (dilation : ℕ) + (h : APositive K) (b : BSplit h) (phi : Placement) : + (branchPopulation allocation dilation (.stageB h, phi) b : ℝ) = + (population allocation dilation (.afterA h.val, phi) : ℝ) * + (stageBLaw (aShape h.val) (bSplit ⟨h, b, false⟩) : ℝ) := by + exact_mod_cast stageB_branchPopulation_rat allocation dilation h b phi + +theorem stageB_branchWeight_rat {K dilation : ℕ} (allocation : Allocation) + (hd : 0 < dilation) (h : APositive K) (b : BSplit h) (phi : Placement) : + (branchPopulation allocation dilation (.stageB h, phi) b : ℚ) / + (population allocation dilation (.afterA h.val, phi) : ℚ) = + stageBLaw (aShape h.val) (bSplit ⟨h, b, false⟩) := by + have hpos := work_source_population_pos allocation hd (.stageB h, phi) + have hden : (population allocation dilation (.afterA h.val, phi) : ℚ) ≠ 0 := by + exact_mod_cast Nat.ne_of_gt hpos + apply (div_eq_iff hden).2 + rw [stageB_branchPopulation_rat] + exact mul_comm _ _ + +theorem stageB_branchWeight_real {K dilation : ℕ} (allocation : Allocation) + (hd : 0 < dilation) (h : APositive K) (b : BSplit h) (phi : Placement) : + (branchPopulation allocation dilation (.stageB h, phi) b : ℝ) / + (population allocation dilation (.afterA h.val, phi) : ℝ) = + (stageBLaw (aShape h.val) (bSplit ⟨h, b, false⟩) : ℝ) := by + have hpos := work_source_population_pos allocation hd (.stageB h, phi) + have hden : (population allocation dilation (.afterA h.val, phi) : ℝ) ≠ 0 := by + exact_mod_cast Nat.ne_of_gt hpos + apply (div_eq_iff hden).2 + rw [stageB_branchPopulation_real] + exact mul_comm _ _ + +theorem shapeCounts_weighted_sum {I : Type*} [Fintype I] + (code : I → JointPopulation.Shape) (weight : I → ℕ) + (f : JointPopulation.Shape → ℝ) : + (∑ u, (shapeCounts code weight u : ℝ) * f u) = + ∑ b, (weight b : ℝ) * f (code b) := by + simp only [shapeCounts, Nat.cast_sum, Nat.cast_ite, Nat.cast_zero, Finset.sum_mul] + rw [Finset.sum_comm] + apply Finset.sum_congr rfl + intro b _ + simp [ite_mul] + +end MatrixMultiplication.AllFieldHistoryBranchWeights + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldHistory/ChildLaws.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldHistory/ChildLaws.lean new file mode 100644 index 0000000000000000000000000000000000000000..24c174a56a5c319a9cff04b84612b47b9a8ee022 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldHistory/ChildLaws.lean @@ -0,0 +1,243 @@ +import OAI.LinearAlgebra.MatrixMultiplication.FieldHistory.Counts +import OAI.LinearAlgebra.MatrixMultiplication.FieldParameters.HalfLaws +import OAI.LinearAlgebra.MatrixMultiplication.CoppersmithWinograd.CWCompleteStatistics + +namespace OAI + +/-! Finite extraction histories, inherited masks and recovery bounds. -/ + +noncomputable section + +namespace MatrixMultiplication.AllFieldHistory + +open AllFieldParameters CWStrands CWWindowedLeaves +open scoped BigOperators +attribute [local instance] Classical.propDecidable Classical.decEq + +def Work.Statistic {K : ℕ} : Work K → Type + | .stageA _ => PairSlot + | .stageB _ => Fin 6 + | .stageC _ => PUnit + +instance {K : ℕ} (w : Work K) : Fintype w.Statistic := by + cases w <;> dsimp [Work.Statistic] <;> infer_instance + +instance {K : ℕ} (w : Work K) : DecidableEq w.Statistic := Classical.decEq _ + +def Work.statistic {K : ℕ} (w : Work K) : Raw w.halfLength → w.Statistic := + match w with + | .stageA _ => CWCompleteStatistics.fourStatistic + | .stageB _ => CWCompleteStatistics.twoStatistic + | .stageC _ => fun _ => PUnit.unit + +def Work.statisticWeight {K : ℕ} (w : Work K) : w.Statistic → ℕ := + match w with + | .stageA _ => fun a => AllFieldParameters.statisticWeight a.1 + + AllFieldParameters.statisticWeight a.2 + | .stageB _ => AllFieldParameters.statisticWeight + | .stageC _ => fun _ => 0 + +theorem Work.statistic_weight {K : ℕ} (w : Work K) (hsharing : w.stage ≠ 2) + (x : Raw w.halfLength) : CWStrands.weight x = w.statisticWeight (w.statistic x) := by + cases w with + | stageA h => exact CWCompleteStatistics.four_weight x + | stageB h => exact CWCompleteStatistics.two_weight x + | stageC h => exact False.elim (hsharing rfl) + +def Work.childLaw {K : ℕ} (w : Work K) (u : Shape) (side : Fin 3) : + w.Statistic → ℚ := + match w with + | .stageA _ => halfLaw u side + | .stageB h => littleLaw (aShape h.val) u side + | .stageC _ => fun _ => 1 + +theorem Work.childLaw_nonnegative {K : ℕ} (w : Work K) (u : Shape) + (side : Fin 3) (a : w.Statistic) : 0 ≤ w.childLaw u side a := by + cases w with + | stageA h => exact halfLaw_nonnegative u side a + | stageB h => exact littleLaw_nonnegative (aShape h.val) u side a + | stageC h => exact zero_le_one + +theorem Work.childLaw_normalized {K : ℕ} (w : Work K) (u : Shape) + (hu : u ∈ shapes (2 * w.halfLength)) (side : Fin 3) : + ∑ a : w.Statistic, w.childLaw u side a = 1 := by + cases w with + | stageA h => exact halfLaw_normalized u hu side + | stageB h => exact littleLaw_normalized (aShape h.val) u side + | stageC h => exact Fintype.sum_unique (fun _ : PUnit => (1 : ℚ)) + +theorem Work.childLaw_outside_support {K : ℕ} (w : Work K) (hsharing : w.stage ≠ 2) + (u : Shape) (hu : u ∈ shapes (2 * w.halfLength)) (side : Fin 3) + (a : w.Statistic) (ha : w.statisticWeight a ≠ u side) : w.childLaw u side a = 0 := by + cases w with + | stageA h => exact halfLaw_outside_support u hu side a ha + | stageB h => + have hbound : u side < 5 := + lt_of_le_of_lt (mem_shapes_bound hu side) (by norm_num [Work.halfLength]) + exact littleLaw_outside_support (aShape h.val) u side hbound a ha + | stageC h => exact False.elim (hsharing rfl) + +def canonicalChildShape {K : ℕ} (w : PlacedWork K) (u : JointPopulation.Shape) : Shape := + fun i => decodeShape u (w.2 i) + +@[simp] theorem canonicalChildShape_branchShape {K : ℕ} (w : PlacedWork K) + (b : w.1.Branch) : canonicalChildShape w (branchShape w b) = w.1.splitShape b := by + funext i + simp [canonicalChildShape, branchShape, physicalShape] + +theorem Work.halfShape_mem {K : ℕ} (w : Work K) (b : w.Branch) (right : Bool) : + halfShape w.parentShape (w.splitShape b) right ∈ shapes (2 * w.halfLength) := by + cases w with + | stageA h => exact aShape_size ⟨h, b, right⟩ + | stageB h => exact bShape_size ⟨h, b, right⟩ + | stageC h => + have hi := stageCAtom_mem (cShapeParent h) (bShape_size h.1.val) h.1.property b + have hs := stageC_children_geometry (cShapeParent h) + (bShape_size h.1.val) h.1.property (stageCAtom (cShapeParent h) b) + hi + have ht : shapeTotal (cShapeParent h) = 4 := mem_shapes_total (bShape_size h.1.val) + cases right + · change stageCAtom (cShapeParent h) b ∈ shapes 2 + simpa only [ht] using below_mem_shapes hi + · change complement (cShapeParent h) (stageCAtom (cShapeParent h) b) ∈ shapes 2 + simpa only [ht] using below_mem_shapes hs.1 + +def placedChildLawRat {K : ℕ} (w : PlacedWork K) (u : JointPopulation.Shape) + (side : Fin 3) (right : Bool) : w.1.Statistic → ℚ := + w.1.childLaw (halfShape w.1.parentShape (canonicalChildShape w u) right) + (w.2.symm side) + +def childLawRat {K : ℕ} (w : PlacedWork K) (u : JointPopulation.Shape) + (side : Fin 3) : w.1.Statistic → ℚ := placedChildLawRat w u side false + +def rightChildLawRat {K : ℕ} (w : PlacedWork K) (u : JointPopulation.Shape) + (side : Fin 3) : w.1.Statistic → ℚ := placedChildLawRat w u side true + +@[simp] theorem placedChildLawRat_branchShape {K : ℕ} (w : PlacedWork K) + (b : w.1.Branch) (side : Fin 3) (right : Bool) : + placedChildLawRat w (branchShape w b) side right = + w.1.childLaw (halfShape w.1.parentShape (w.1.splitShape b) right) + (w.2.symm side) := by + simp only [placedChildLawRat, canonicalChildShape_branchShape] + +theorem placedChildLawRat_nonnegative {K : ℕ} (w : PlacedWork K) + (u : JointPopulation.Shape) (side : Fin 3) (right : Bool) (a : w.1.Statistic) : + 0 ≤ placedChildLawRat w u side right a := + w.1.childLaw_nonnegative _ _ a + +theorem placedChildLawRat_normalized_of_pos {K : ℕ} (allocation : Allocation) + (dilation : ℕ) (w : PlacedWork K) (u : JointPopulation.Shape) + (hu : 0 < jointCounts allocation dilation w u) (side : Fin 3) (right : Bool) : + ∑ a : w.1.Statistic, placedChildLawRat w u side right a = 1 := by + obtain ⟨b, rfl, _⟩ := shapeCounts_positive _ _ u hu + simp only [placedChildLawRat_branchShape] + exact w.1.childLaw_normalized _ (w.1.halfShape_mem b right) _ + +def childLaw {K : ℕ} (w : PlacedWork K) (u : JointPopulation.Shape) + (side : Fin 3) (a : w.1.Statistic) : ℝ := childLawRat w u side a + +def rightChildLaw {K : ℕ} (w : PlacedWork K) (u : JointPopulation.Shape) + (side : Fin 3) (a : w.1.Statistic) : ℝ := rightChildLawRat w u side a + +abbrev ActiveStatistic {K tick : ℕ} (h : Active K tick) := h.val.1.Statistic + +def activeStatistic {K tick : ℕ} (h : Active K tick) : + Raw (activeHalfLength h) → ActiveStatistic h := h.val.1.statistic + +def leftChildLaw {K tick : ℕ} (side : Fin 3) + (c : Active K tick × JointPopulation.Shape) : ActiveStatistic c.1 → ℝ := + childLaw c.1.val c.2 side + +def rightClassChildLaw {K tick : ℕ} (side : Fin 3) + (c : Active K tick × JointPopulation.Shape) : ActiveStatistic c.1 → ℝ := + rightChildLaw c.1.val c.2 side + +theorem leftChildLaw_nonnegative {K tick : ℕ} (side : Fin 3) + (c : Active K tick × JointPopulation.Shape) (a : ActiveStatistic c.1) : + 0 ≤ leftChildLaw side c a := by + change (0 : ℝ) ≤ (placedChildLawRat c.1.val c.2 side false a : ℝ) + exact_mod_cast placedChildLawRat_nonnegative c.1.val c.2 side false a + +theorem rightClassChildLaw_nonnegative {K tick : ℕ} (side : Fin 3) + (c : Active K tick × JointPopulation.Shape) (a : ActiveStatistic c.1) : + 0 ≤ rightClassChildLaw side c a := by + change (0 : ℝ) ≤ (placedChildLawRat c.1.val c.2 side true a : ℝ) + exact_mod_cast placedChildLawRat_nonnegative c.1.val c.2 side true a + +theorem leftChildLaw_normalized_of_pos {K tick : ℕ} (allocation : Allocation) + (dilation : ℕ) (side : Fin 3) (c : Active K tick × JointPopulation.Shape) + (hc : 0 < activeCounts allocation dilation c.1 c.2) : + ∑ a : ActiveStatistic c.1, leftChildLaw side c a = 1 := by + change (∑ a : c.1.val.1.Statistic, + (placedChildLawRat c.1.val c.2 side false a : ℝ)) = 1 + exact_mod_cast placedChildLawRat_normalized_of_pos allocation dilation + c.1.val c.2 hc side false + +theorem rightClassChildLaw_normalized_of_pos {K tick : ℕ} (allocation : Allocation) + (dilation : ℕ) (side : Fin 3) (c : Active K tick × JointPopulation.Shape) + (hc : 0 < activeCounts allocation dilation c.1 c.2) : + ∑ a : ActiveStatistic c.1, rightClassChildLaw side c a = 1 := by + change (∑ a : c.1.val.1.Statistic, + (placedChildLawRat c.1.val c.2 side true a : ℝ)) = 1 + exact_mod_cast placedChildLawRat_normalized_of_pos allocation dilation + c.1.val c.2 hc side true + +end MatrixMultiplication.AllFieldHistory + +namespace MatrixMultiplication.AllFieldHistoryChildLaws + +open AllFieldHistory +open scoped BigOperators + +abbrev Statistic {K tick : ℕ} (h : Active K tick) := ActiveStatistic h + +abbrev statistic {K tick : ℕ} (h : Active K tick) : + CWWindowedLeaves.Raw (activeHalfLength h) → Statistic h := activeStatistic h + +abbrev leftLaw {K tick : ℕ} (h : Active K tick) (u : JointPopulation.Shape) + (side : Fin 3) : Statistic h → ℝ := childLaw h.val u side + +abbrev rightLaw {K tick : ℕ} (h : Active K tick) (u : JointPopulation.Shape) + (side : Fin 3) : Statistic h → ℝ := rightChildLaw h.val u side + +theorem leftLaw_nonnegative {K tick : ℕ} (h : Active K tick) (u : JointPopulation.Shape) + (side : Fin 3) (a : Statistic h) : 0 ≤ leftLaw h u side a := + leftChildLaw_nonnegative side (h, u) a + +theorem rightLaw_nonnegative {K tick : ℕ} (h : Active K tick) (u : JointPopulation.Shape) + (side : Fin 3) (a : Statistic h) : 0 ≤ rightLaw h u side a := + rightClassChildLaw_nonnegative side (h, u) a + +theorem leftLaw_normalized {K tick : ℕ} (allocation : Allocation) (dilation : ℕ) + (h : Active K tick) (u : JointPopulation.Shape) + (hu : 0 < activeCounts allocation dilation h u) (side : Fin 3) : + ∑ a : Statistic h, leftLaw h u side a = 1 := + leftChildLaw_normalized_of_pos allocation dilation side (h, u) hu + +theorem rightLaw_normalized {K tick : ℕ} (allocation : Allocation) (dilation : ℕ) + (h : Active K tick) (u : JointPopulation.Shape) + (hu : 0 < activeCounts allocation dilation h u) (side : Fin 3) : + ∑ a : Statistic h, rightLaw h u side a = 1 := + rightClassChildLaw_normalized_of_pos allocation dilation side (h, u) hu + +theorem singleton_typeWindow {P : Type*} [Fintype P] [DecidableEq P] [Nonempty P] + (η : ℝ) (hη : 0 ≤ η) (w : P → PUnit) : + InheritedMasks.typeWindow (fun _ : PUnit => 1) η w := by + intro a + have hcount : MatrixMultiplication.Foundation.wordPopulation w a = Fintype.card P := by + apply Fintype.card_congr + exact + { toFun := Subtype.val + invFun := fun i => ⟨i, Subsingleton.elim _ _⟩ + left_inv := fun i => Subtype.ext rfl + right_inv := fun i => rfl } + have hpos : (0 : ℝ) < Fintype.card P := by + exact_mod_cast (Fintype.card_pos : 0 < Fintype.card P) + simpa only [InheritedMasks.empiricalLaw, hcount, div_self (ne_of_gt hpos), + sub_self, abs_zero] using hη + +end MatrixMultiplication.AllFieldHistoryChildLaws + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldHistory/Counts.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldHistory/Counts.lean new file mode 100644 index 0000000000000000000000000000000000000000..69ac0b7e3242abb103599da443940f1c3700d170 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldHistory/Counts.lean @@ -0,0 +1,186 @@ +import OAI.LinearAlgebra.MatrixMultiplication.FieldHistory.Schedule +import OAI.LinearAlgebra.MatrixMultiplication.FieldConstruction.ShapeEncoding + +namespace OAI + +/-! Finite extraction histories, inherited masks and recovery bounds. -/ + +noncomputable section +namespace MatrixMultiplication.AllFieldHistory + +open AllFieldParameters +open scoped BigOperators +attribute [local instance] Classical.propDecidable Classical.decEq + +def shapeCounts {I : Type*} [Fintype I] (code : I → JointPopulation.Shape) + (weight : I → ℕ) (u : JointPopulation.Shape) : ℕ := + ∑ i, if code i = u then weight i else 0 + +theorem shapeCounts_sum {I : Type*} [Fintype I] (code : I → JointPopulation.Shape) + (weight : I → ℕ) : ∑ u, shapeCounts code weight u = ∑ i, weight i := by + unfold shapeCounts + rw [Finset.sum_comm] + simp + +theorem shapeCounts_positive {I : Type*} [Fintype I] (code : I → JointPopulation.Shape) + (weight : I → ℕ) (u : JointPopulation.Shape) (hu : 0 < shapeCounts code weight u) : + ∃ i, code i = u ∧ 0 < weight i := by + by_contra hn + have hz : shapeCounts code weight u = 0 := by + apply Finset.sum_eq_zero + intro i hi + split_ifs with heq + · by_contra hne + exact hn ⟨i, heq, Nat.pos_of_ne_zero hne⟩ + · rfl + omega + +theorem shapeCounts_at {I : Type*} [Fintype I] (code : I → JointPopulation.Shape) + (weight : I → ℕ) (hi : Function.Injective code) (i : I) : + shapeCounts code weight (code i) = weight i := by + unfold shapeCounts + simp only [hi.eq_iff] + simp + +theorem Work.parentShape_spec {K : ℕ} (w : Work K) : + ShapeBounded w.parentShape ∧ shapeTotal w.parentShape = 4 * w.halfLength := by + cases w with + | stageA h => exact positiveInitial_shape_spec _ h.property + | stageB h => exact positiveSecond_shape_spec _ h.property + | stageC h => + exact ⟨mem_shapes_bounded (bShape_size h.1.val) (by omega), + mem_shapes_total (bShape_size h.1.val)⟩ + +theorem Work.splitShape_spec {K : ℕ} (w : Work K) (b : w.Branch) : + ShapeBounded (w.splitShape b) ∧ shapeTotal (w.splitShape b) = 2 * w.halfLength := by + cases w with + | stageA h => exact stageA_shape_spec _ _ h.property (aSplit_mem ⟨h, b, false⟩) + | stageB h => exact stageB_shape_spec _ _ h.property (bSplit_mem ⟨h, b, false⟩) + | stageC h => exact stageC_shape_spec _ (bShape_size h.1.val) h.1.property b + +theorem Work.splitShape_le {K : ℕ} (w : Work K) (b : w.Branch) : + ∀ i, w.splitShape b i ≤ w.parentShape i := by + cases w with + | stageA h => exact below_le (aSplit_mem ⟨h, b, false⟩) + | stageB h => exact below_le (bSplit_mem ⟨h, b, false⟩) + | stageC h => exact below_le (stageCAtom_mem _ (bShape_size h.1.val) h.1.property b) + +theorem Work.splitShape_injective {K : ℕ} (w : Work K) : + Function.Injective w.splitShape := by + cases w with + | stageA h => exact stageA_get_injective _ h.property + | stageB h => exact stageB_get_injective _ h.property + | stageC h => exact stageCAtom_injective _ (bShape_size h.1.val) h.1.property + +def branchShape {K : ℕ} (w : PlacedWork K) (b : w.1.Branch) : JointPopulation.Shape := + encodePhysicalShape w.2 (w.1.splitShape b) (w.1.splitShape_spec b).1 + +theorem branchShape_injective {K : ℕ} (w : PlacedWork K) : + Function.Injective (branchShape w) := by + intro a b hab + exact w.1.splitShape_injective (encodePhysicalShape_inj w.2 hab) + +def jointCounts {K : ℕ} (allocation : Allocation) (dilation : ℕ) + (w : PlacedWork K) : JointPopulation.Shape → ℕ := + shapeCounts (branchShape w) (branchPopulation allocation dilation w) + +def activeCounts {K tick : ℕ} (allocation : Allocation) (dilation : ℕ) + (h : Active K tick) : JointPopulation.Shape → ℕ := jointCounts allocation dilation h.val + +def activeParentShape {K tick : ℕ} (h : Active K tick) : Shape := + physicalShape h.val.2 h.val.1.parentShape + +def activeHalfLength {K tick : ℕ} (h : Active K tick) : ℕ := h.val.1.halfLength + +theorem jointCounts_sum {K : ℕ} (allocation : Allocation) (dilation : ℕ) + (w : PlacedWork K) : ∑ u, jointCounts allocation dilation w u = + population allocation dilation (w.1.source, w.2) := by + rw [jointCounts, shapeCounts_sum, branchPopulation_sum] + +theorem jointCounts_at {K : ℕ} (allocation : Allocation) (dilation : ℕ) + (w : PlacedWork K) (b : w.1.Branch) : + jointCounts allocation dilation w (branchShape w b) = + branchPopulation allocation dilation w b := + shapeCounts_at _ _ (branchShape_injective w) b + +theorem jointCounts_support_sum {K : ℕ} (allocation : Allocation) (dilation : ℕ) + (w : PlacedWork K) (u : JointPopulation.Shape) + (hu : 0 < jointCounts allocation dilation w u) : + u.1.val + u.2.1.val + u.2.2.val = 2 * w.1.halfLength := by + obtain ⟨b, rfl, _⟩ := shapeCounts_positive _ _ u hu + exact (encodePhysicalShape_total _ _ _).trans (w.1.splitShape_spec b).2 + +theorem jointCounts_support_le {K : ℕ} (allocation : Allocation) (dilation : ℕ) + (w : PlacedWork K) (u : JointPopulation.Shape) + (hu : 0 < jointCounts allocation dilation w u) (s : Fin 3) : + (JointPopulation.shapeSide s u).val ≤ physicalShape w.2 w.1.parentShape s := by + obtain ⟨b, rfl, _⟩ := shapeCounts_positive _ _ u hu + rw [branchShape, encodePhysicalShape_side] + exact w.1.splitShape_le b (w.2.symm s) + +def shapePositionMap {K : ℕ} (allocation : Allocation) (dilation : ℕ) + (w : PlacedWork K) : + (Σ b : w.1.Branch, Fin (branchPopulation allocation dilation w b)) → + (Σ u : JointPopulation.Shape, Fin (jointCounts allocation dilation w u)) := + fun p => ⟨branchShape w p.1, + ⟨p.2.val, by rw [jointCounts_at]; exact p.2.isLt⟩⟩ + +theorem shapePositionMap_injective {K : ℕ} (allocation : Allocation) (dilation : ℕ) + (w : PlacedWork K) : Function.Injective (shapePositionMap allocation dilation w) := by + rintro ⟨b, i⟩ ⟨c, j⟩ heq + have hbc : b = c := branchShape_injective w (congrArg Sigma.fst heq) + subst c + have hij : i.val = j.val := congrArg (fun p => p.2.val) heq + have : i = j := Fin.ext hij + subst j + rfl + +theorem shapePositionMap_surjective {K : ℕ} (allocation : Allocation) (dilation : ℕ) + (w : PlacedWork K) : Function.Surjective (shapePositionMap allocation dilation w) := by + rintro ⟨u, i⟩ + obtain ⟨b, heq, hb⟩ := shapeCounts_positive _ _ u (Nat.zero_lt_of_lt i.isLt) + subst u + refine ⟨⟨b, ⟨i.val, ?_⟩⟩, ?_⟩ + · simpa only [jointCounts_at] using i.isLt + · rfl + +def branchPositionEquiv {K : ℕ} (allocation : Allocation) (dilation : ℕ) + (w : PlacedWork K) : + (Σ u : JointPopulation.Shape, Fin (jointCounts allocation dilation w u)) ≃ + (Σ b : w.1.Branch, Fin (branchPopulation allocation dilation w b)) := + (Equiv.ofBijective (shapePositionMap allocation dilation w) + ⟨shapePositionMap_injective allocation dilation w, + shapePositionMap_surjective allocation dilation w⟩).symm + +@[simp] theorem branchPositionEquiv_shape {K : ℕ} (allocation : Allocation) (dilation : ℕ) + (w : PlacedWork K) + (p : Σ u : JointPopulation.Shape, Fin (jointCounts allocation dilation w u)) : + branchShape w (branchPositionEquiv allocation dilation w p).1 = p.1 := by + exact congrArg Sigma.fst ((branchPositionEquiv allocation dilation w).symm_apply_apply p) + +def rootShape {K : ℕ} (h : Initial K) (phi : Placement) : JointPopulation.Shape := + encodePhysicalShape phi (initialShape h) (root_shape_spec _ (initialShape_mem h)).1 + +def initialJointCounts {K : ℕ} (allocation : Allocation) (dilation : ℕ) + (j : Fin K) : JointPopulation.Shape → ℕ := + shapeCounts (fun p : Fin sortedInitial.length × Placement => rootShape (j, p.1) p.2) + (fun p => population allocation dilation (.initial (j, p.1), p.2)) + +theorem initialJointCounts_sum {K : ℕ} (allocation : Allocation) (dilation : ℕ) + (j : Fin K) : ∑ u, initialJointCounts allocation dilation j u = + populationLength (K := K) allocation dilation := by + rw [initialJointCounts, shapeCounts_sum, Fintype.sum_prod_type] + exact initial_population_sum allocation dilation j + +theorem initialJointCounts_support {K : ℕ} (allocation : Allocation) (dilation : ℕ) + (j : Fin K) (u : JointPopulation.Shape) + (hu : 0 < initialJointCounts allocation dilation j u) : + u.1.val + u.2.1.val + u.2.2.val = 16 := by + obtain ⟨p, rfl, _⟩ := shapeCounts_positive _ _ u hu + exact (encodePhysicalShape_total _ _ _).trans (root_shape_spec _ (initialShape_mem _)).2 + +end MatrixMultiplication.AllFieldHistory + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldHistory/Geometry.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldHistory/Geometry.lean new file mode 100644 index 0000000000000000000000000000000000000000..dc280b0249af998e733dbf403e6643af186af231 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldHistory/Geometry.lean @@ -0,0 +1,118 @@ +import OAI.LinearAlgebra.MatrixMultiplication.FieldHistory.Transitions + +namespace OAI + +/-! Finite extraction histories, inherited masks and recovery bounds. -/ + +noncomputable section +namespace MatrixMultiplication.AllFieldHistory + +open AllFieldParameters +attribute [local instance] Classical.propDecidable Classical.decEq + +def currentShape {K : ℕ} : CanonicalHistory K → Shape + | .initial h => initialShape h + | .afterA h => aShape h + | .afterB h => bShape h + | .partC h => cShapeParent h + | .afterC h => cShape h + +def currentLength {K : ℕ} : CanonicalHistory K → ℕ + | .initial _ => 8 + | .afterA _ => 4 + | .afterB _ | .partC _ => 2 + | .afterC _ => 1 + +def currentPhysicalShape {K : ℕ} (h : History K) : Shape := + physicalShape h.2 (currentShape h.1) + +theorem currentShape_spec {K : ℕ} (h : CanonicalHistory K) : + ShapeBounded (currentShape h) ∧ shapeTotal (currentShape h) = 2 * currentLength h := by + cases h with + | initial h => exact root_shape_spec _ (initialShape_mem h) + | afterA h => exact ⟨mem_shapes_bounded (aShape_size h) (by omega), mem_shapes_total (aShape_size h)⟩ + | afterB h => exact ⟨mem_shapes_bounded (bShape_size h) (by omega), mem_shapes_total (bShape_size h)⟩ + | partC h => exact ⟨mem_shapes_bounded (bShape_size h.1.val) (by omega), + mem_shapes_total (bShape_size h.1.val)⟩ + | afterC h => + cases hh : h.2.2 with + | false => + simpa only [currentShape, currentLength, cShape, cSplit, cShapeParent, + halfShape, hh, Bool.false_eq_true, ite_false, mul_one] using + stageC_shape_spec _ (bShape_size h.1.1.val) h.1.1.property h.2.1 + | true => + simpa only [currentShape, currentLength, cShape, cSplit, cShapeParent, + halfShape, hh, ite_true, mul_one] using + stageC_complement_spec _ (bShape_size h.1.1.val) h.1.1.property h.2.1 + +theorem currentPhysicalShape_total {K : ℕ} (h : History K) : + shapeTotal (currentPhysicalShape h) = 2 * currentLength h.1 := + (physicalShape_total h.2 _).trans (currentShape_spec h.1).2 + +theorem positive_iff_no_zero (u : Shape) : positive u = true ↔ ∀ i, u i ≠ 0 := by + simp only [positive, Bool.and_eq_true, decide_eq_true_eq] + constructor + · intro h i + fin_cases i + · change u 0 ≠ 0 + omega + · change u 1 ≠ 0 + omega + · change u 2 ≠ 0 + omega + · intro h + have h0 := h 0 + have h1 := h 1 + have h2 := h 2 + omega + +theorem not_positive_has_zero (u : Shape) (hu : positive u ≠ true) : ∃ i, u i = 0 := by + by_contra hn + apply hu + rw [positive_iff_no_zero] + intro i hi + exact hn ⟨i, hi⟩ + +theorem terminal_has_zero {K : ℕ} (h : CanonicalHistory K) (ht : terminal h) : + ∃ i, currentShape h i = 0 := by + cases h with + | initial h => + apply not_positive_has_zero + intro hp + exact ht (List.mem_filter.mpr ⟨initialShape_mem h, hp⟩) + | afterA h => + apply not_positive_has_zero + intro hp + exact ht (List.mem_filter.mpr ⟨aShape_size h, hp⟩) + | afterB h => exact not_positive_has_zero _ ht + | partC h => exact False.elim ht + | afterC h => exact cShape_zero h + +theorem terminal_physical_zero {K : ℕ} (h : History K) (ht : terminal h.1) : + ∃ s, currentPhysicalShape h s = 0 := by + obtain ⟨i, hi⟩ := terminal_has_zero h.1 ht + exact ⟨h.2 i, by simpa only [currentPhysicalShape, physicalShape_source] using hi⟩ + +theorem final_physical_zero {K : ℕ} (h : State K (K + 2)) : + ∃ s, currentPhysicalShape h.val s = 0 := + terminal_physical_zero h.val (final_state_terminal h) + +theorem source_shape {K : ℕ} (w : Work K) : currentShape w.source = w.parentShape := by + cases w <;> rfl + +theorem source_length {K : ℕ} (w : Work K) : currentLength w.source = 2 * w.halfLength := by + cases w <;> rfl + +theorem child_shape {K : ℕ} (w : Work K) (b : w.Branch) (right : Bool) : + currentShape (w.child b right) = halfShape w.parentShape (w.splitShape b) right := by + cases w <;> rfl + +theorem child_length {K : ℕ} (w : Work K) (b : w.Branch) (right : Bool) : + currentLength (w.child b right) = w.halfLength := by + cases w <;> rfl + +end MatrixMultiplication.AllFieldHistory + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldHistory/GroupAssignment.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldHistory/GroupAssignment.lean new file mode 100644 index 0000000000000000000000000000000000000000..8461eda920b66566956aaae4c3cbece9da38ed77 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldHistory/GroupAssignment.lean @@ -0,0 +1,256 @@ +import OAI.LinearAlgebra.MatrixMultiplication.FieldHistory.Priority +import OAI.LinearAlgebra.MatrixMultiplication.JointExtraction.Extraction +import OAI.LinearAlgebra.MatrixMultiplication.Arithmetic.CommonDimensions + +namespace OAI + +/-! Finite extraction histories, inherited masks and recovery bounds. -/ + +open scoped BigOperators + +noncomputable section + +namespace MatrixMultiplication.AllFieldHistory + +open MatrixMultiplication.Foundation +attribute [local instance] Classical.propDecidable Classical.decEq + +def activeEquivOrders (K tick : ℕ) : + Active K tick ≃ Σ sigma : Placement, ActiveOrder K tick sigma := + (Equiv.sigmaFiberEquiv (fun w : Active K tick => w.val.physicalOrder)).symm + +def activeWordsEquivOrders {K tick : ℕ} (W : Active K tick → Type*) : + (∀ h, W h) ≃ (∀ sigma : Placement, ∀ h : ActiveOrder K tick sigma, W h.val) where + toFun x _ h := x h.val + invFun x h := x h.val.physicalOrder ⟨h, rfl⟩ + left_inv _ := rfl + right_inv x := by + funext sigma h + rcases h with ⟨h, hh⟩ + cases hh + rfl + +theorem prod_active_eq_prod_orders {K tick : ℕ} {M : Type*} [CommMonoid M] + (f : Active K tick → M) : + (∏ h, f h) = ∏ sigma : Placement, ∏ h : ActiveOrder K tick sigma, f h.val := by + calc + _ = ∏ h : (Σ sigma : Placement, ActiveOrder K tick sigma), f h.2.val := + Fintype.prod_equiv (activeEquivOrders K tick) _ _ (fun _ => rfl) + _ = _ := Fintype.prod_sigma _ + +theorem familyProduct_active_eq_orders {K tick : ℕ} {F : Type*} [CommSemiring F] + {X Y Z : Active K tick → Type*} + (T : ∀ h, Tensor F (X h) (Y h) (Z h)) + (x : ∀ h, X h) (y : ∀ h, Y h) (z : ∀ h, Z h) : + CommonDimensions.familyProduct T x y z = + CommonDimensions.familyProduct + (fun sigma : Placement => CommonDimensions.familyProduct + (fun h : ActiveOrder K tick sigma => T h.val)) + (activeWordsEquivOrders X x) (activeWordsEquivOrders Y y) + (activeWordsEquivOrders Z z) := + prod_active_eq_prod_orders (fun h => T h (x h) (y h) (z h)) + +namespace GroupAssignment + +variable {I : Type*} {V E : I → Type*} + +def side {V E : Type*} (a : JointExtraction.Assignment V V V E) (i : Fin 3) : + V → Option E := ![a.x, a.y, a.z] i + +def restorePhysical {V E : Type*} (sigma : Placement) + (a : JointExtraction.Assignment V V V E) : JointExtraction.Assignment V V V E where + x := side a (sigma.symm 0) + y := side a (sigma.symm 1) + z := side a (sigma.symm 2) + +theorem side_restorePhysical {V E : Type*} (sigma : Placement) + (a : JointExtraction.Assignment V V V E) (i : Fin 3) : + side (restorePhysical sigma a) i = side a (sigma.symm i) := by + rcases i with ⟨i, hi⟩ + have h : i = 0 ∨ i = 1 ∨ i = 2 := by omega + rcases h with rfl | rfl | rfl <;> rfl + +def collect (a : ∀ i, V i → Option (E i)) (v : ∀ i, V i) : Option (∀ i, E i) := + if h : ∃ e : ∀ i, E i, ∀ i, a i (v i) = some (e i) then + some (Classical.choose h) else none + +theorem collect_eq_some (a : ∀ i, V i → Option (E i)) (v : ∀ i, V i) (e : ∀ i, E i) : + collect a v = some e ↔ ∀ i, a i (v i) = some (e i) := by + unfold collect + split_ifs with h + · constructor + · intro he i + have heq := Option.some.inj he + simpa only [heq] using Classical.choose_spec h i + · intro he + congr 1 + funext i + exact Option.some.inj ((Classical.choose_spec h i).symm.trans (he i)) + · constructor + · intro he + cases he + · intro he + exact False.elim (h ⟨e, he⟩) + +theorem collect_failure_iff (a : ∀ i, V i → Option (E i)) + (v : ∀ i, V i) (e : ∀ i, E i) : + collect a v ≠ some e ↔ ∃ i, a i (v i) ≠ some (e i) := by + rw [ne_eq, collect_eq_some, not_forall] + +variable {X Y Z : I → Type*} + +def product (a : ∀ i, JointExtraction.Assignment (X i) (Y i) (Z i) (E i)) : + JointExtraction.Assignment (∀ i, X i) (∀ i, Y i) (∀ i, Z i) (∀ i, E i) where + x := collect (fun i => (a i).x) + y := collect (fun i => (a i).y) + z := collect (fun i => (a i).z) + +variable [Fintype I] {F : Type*} [CommSemiring F] + +theorem product_coherent (T : ∀ i, Tensor F (X i) (Y i) (Z i)) + (a : ∀ i, JointExtraction.Assignment (X i) (Y i) (Z i) (E i)) + (ha : ∀ i, JointExtraction.Coherent (T i) (a i)) : + JointExtraction.Coherent (CommonDimensions.familyProduct T) (product a) := by + intro x y z e f g hT hx hy hz + have hx' := (collect_eq_some (fun i => (a i).x) x e).mp hx + have hy' := (collect_eq_some (fun i => (a i).y) y f).mp hy + have hz' := (collect_eq_some (fun i => (a i).z) z g).mp hz + have hfactor (i : I) : T i (x i) (y i) (z i) ≠ 0 := by + intro hi + exact hT (Finset.prod_eq_zero (Finset.mem_univ i) hi) + constructor + · funext i + exact (ha i (x i) (y i) (z i) (e i) (f i) (g i) + (hfactor i) (hx' i) (hy' i) (hz' i)).1 + · funext i + exact (ha i (x i) (y i) (z i) (e i) (f i) (g i) + (hfactor i) (hx' i) (hy' i) (hz' i)).2 + +theorem product_branch (T : ∀ i, Tensor F (X i) (Y i) (Z i)) + (a : ∀ i, JointExtraction.Assignment (X i) (Y i) (Z i) (E i)) + (e : ∀ i, E i) (x : ∀ i, X i) (y : ∀ i, Y i) (z : ∀ i, Z i) : + JointExtraction.branch (CommonDimensions.familyProduct T) (product a) e x y z = + ∏ i, JointExtraction.branch (T i) (a i) (e i) (x i) (y i) (z i) := by + simp only [JointExtraction.branch, product, CommonDimensions.familyProduct, + collect_eq_some] + by_cases h : ∀ i, (a i).x (x i) = some (e i) ∧ + (a i).y (y i) = some (e i) ∧ (a i).z (z i) = some (e i) + · have ho : (∀ i, (a i).x (x i) = some (e i)) ∧ + (∀ i, (a i).y (y i) = some (e i)) ∧ + (∀ i, (a i).z (z i) = some (e i)) := + ⟨fun i => (h i).1, fun i => (h i).2.1, fun i => (h i).2.2⟩ + rw [ite_eq_left ho] + apply Finset.prod_congr rfl + intro i _ + rw [ite_eq_left (h i)] + · have ho : ¬((∀ i, (a i).x (x i) = some (e i)) ∧ + (∀ i, (a i).y (y i) = some (e i)) ∧ + (∀ i, (a i).z (z i) = some (e i))) := by + intro hh + exact h (fun i => ⟨hh.1 i, hh.2.1 i, hh.2.2 i⟩) + rw [ite_eq_right ho] + obtain ⟨i, hi⟩ := not_forall.mp h + exact (Finset.prod_eq_zero (Finset.mem_univ i) (ite_eq_right hi)).symm + +end GroupAssignment + +variable {K tick : ℕ} + +def groupedSideAssignment (W : Active K tick → Type*) (E : Placement → Type*) + (a : ∀ sigma, (∀ h : ActiveOrder K tick sigma, W h.val) → Option (E sigma)) + (x : ∀ h, W h) : Option (∀ sigma, E sigma) := + GroupAssignment.collect a (activeWordsEquivOrders W x) + +theorem groupedSideAssignment_eq_some (W : Active K tick → Type*) (E : Placement → Type*) + (a : ∀ sigma, (∀ h : ActiveOrder K tick sigma, W h.val) → Option (E sigma)) + (x : ∀ h, W h) (e : ∀ sigma, E sigma) : + groupedSideAssignment W E a x = some e ↔ + ∀ sigma, a sigma (fun h => x h.val) = some (e sigma) := + GroupAssignment.collect_eq_some _ _ _ + +def groupedAssignment (X Y Z : Active K tick → Type*) (E : Placement → Type*) + (a : ∀ sigma, JointExtraction.Assignment + (∀ h : ActiveOrder K tick sigma, X h.val) + (∀ h : ActiveOrder K tick sigma, Y h.val) + (∀ h : ActiveOrder K tick sigma, Z h.val) (E sigma)) : + JointExtraction.Assignment (∀ h, X h) (∀ h, Y h) (∀ h, Z h) (∀ sigma, E sigma) where + x := groupedSideAssignment X E (fun sigma => (a sigma).x) + y := groupedSideAssignment Y E (fun sigma => (a sigma).y) + z := groupedSideAssignment Z E (fun sigma => (a sigma).z) + +theorem groupedAssignment_coherent {F : Type*} [CommSemiring F] + (X Y Z : Active K tick → Type*) (E : Placement → Type*) + (T : ∀ h, Tensor F (X h) (Y h) (Z h)) + (a : ∀ sigma, JointExtraction.Assignment + (∀ h : ActiveOrder K tick sigma, X h.val) + (∀ h : ActiveOrder K tick sigma, Y h.val) + (∀ h : ActiveOrder K tick sigma, Z h.val) (E sigma)) + (ha : ∀ sigma, JointExtraction.Coherent + (CommonDimensions.familyProduct (fun h : ActiveOrder K tick sigma => T h.val)) + (a sigma)) : + JointExtraction.Coherent (CommonDimensions.familyProduct T) + (groupedAssignment X Y Z E a) := by + intro x y z e f g hT hx hy hz + rw [familyProduct_active_eq_orders] at hT + exact GroupAssignment.product_coherent _ a ha + (activeWordsEquivOrders X x) (activeWordsEquivOrders Y y) + (activeWordsEquivOrders Z z) e f g hT hx hy hz + +theorem groupedAssignment_branch {F : Type*} [CommSemiring F] + (X Y Z : Active K tick → Type*) (E : Placement → Type*) + (T : ∀ h, Tensor F (X h) (Y h) (Z h)) + (a : ∀ sigma, JointExtraction.Assignment + (∀ h : ActiveOrder K tick sigma, X h.val) + (∀ h : ActiveOrder K tick sigma, Y h.val) + (∀ h : ActiveOrder K tick sigma, Z h.val) (E sigma)) + (e : ∀ sigma, E sigma) (x : ∀ h, X h) (y : ∀ h, Y h) (z : ∀ h, Z h) : + JointExtraction.branch (CommonDimensions.familyProduct T) + (groupedAssignment X Y Z E a) e x y z = + ∏ sigma : Placement, JointExtraction.branch + (CommonDimensions.familyProduct (fun h : ActiveOrder K tick sigma => T h.val)) + (a sigma) (e sigma) (fun h => x h.val) (fun h => y h.val) (fun h => z h.val) := by + calc + _ = JointExtraction.branch + (CommonDimensions.familyProduct (fun sigma : Placement => + CommonDimensions.familyProduct (fun h : ActiveOrder K tick sigma => T h.val))) + (GroupAssignment.product a) e (activeWordsEquivOrders X x) + (activeWordsEquivOrders Y y) (activeWordsEquivOrders Z z) := by + simp only [JointExtraction.branch, groupedAssignment, groupedSideAssignment, + GroupAssignment.product] + apply -synthAssignedInstances @if_congr + · rfl + · exact familyProduct_active_eq_orders T x y z + · rfl + _ = _ := GroupAssignment.product_branch _ a e _ _ _ + +def joinGroupTargets (counts : Active K tick → JointPopulation.Shape → ℕ) + (e : ∀ sigma : Placement, + JointPopulation.Target (fun h : ActiveOrder K tick sigma => counts h.val)) : + JointPopulation.Target counts := + (activeWordsEquivOrders (fun h => MatrixMultiplication.Foundation.ExactWords (counts h))).symm e + +@[simp] theorem joinGroupTargets_apply (counts : Active K tick → JointPopulation.Shape → ℕ) + (e : ∀ sigma : Placement, + JointPopulation.Target (fun h : ActiveOrder K tick sigma => counts h.val)) + (h : Active K tick) : + joinGroupTargets counts e h = e h.val.physicalOrder ⟨h, rfl⟩ := rfl + +@[simp] theorem joinGroupTargets_on_group + (counts : Active K tick → JointPopulation.Shape → ℕ) + (e : ∀ sigma : Placement, + JointPopulation.Target (fun h : ActiveOrder K tick sigma => counts h.val)) + (sigma : Placement) (h : ActiveOrder K tick sigma) : + joinGroupTargets counts e h.val = e sigma h := by + rcases h with ⟨h, hh⟩ + cases hh + rfl + +theorem joinGroupTargets_injective (counts : Active K tick → JointPopulation.Shape → ℕ) : + Function.Injective (joinGroupTargets counts) := + (activeWordsEquivOrders (fun h => MatrixMultiplication.Foundation.ExactWords (counts h))).symm.injective + +end MatrixMultiplication.AllFieldHistory + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldHistory/GroupCore.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldHistory/GroupCore.lean new file mode 100644 index 0000000000000000000000000000000000000000..5be8faa1a3631f8095ea69b8f9b2cac8d0184fe1 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldHistory/GroupCore.lean @@ -0,0 +1,57 @@ +import OAI.LinearAlgebra.MatrixMultiplication.FieldHistory.GroupMasks + +namespace OAI + +/-! Finite extraction histories, inherited masks and recovery bounds. -/ + +noncomputable section + +namespace MatrixMultiplication.AllFieldHistoryGroupedRecovery + +open AllFieldHistory AllFieldHistorySupport AllFieldHistoryChildLaws +open AllFieldHistoryGroupMasks JointPopulation JointCanonicalization JointCanonicalCW +open PermutationMatching +open scoped BigOperators +attribute [local instance] Classical.propDecidable Classical.decEq + +variable {K tick : ℕ} + +abbrev GroupTarget (allocation : Allocation) (m : ℕ) (sigma : Placement) := + Target (groupCounts (K := K) (tick := tick) allocation m sigma) + +def projectTarget (allocation : Allocation) (m : ℕ) (sigma : Placement) + (e : AllFieldHistoryRecovery.Targets (K := K) (tick := tick) allocation m) : + GroupTarget (K := K) (tick := tick) allocation m sigma := fun h => e h.val + +def groupCoordinates (allocation : Allocation) (m : ℕ) (sigma : Placement) + (e : GroupTarget (K := K) (tick := tick) allocation m sigma) := + pairEquiv (groupCounts allocation m sigma) + (fun h => Fin (activeHalfLength h.val) → Fin 7) + (fun h => Fin (activeHalfLength h.val) → Fin 7) e + +def groupCoarse {sigma : Placement} (side : Fin 3) (h : ActiveOrder K tick sigma) + (w : (Fin (activeHalfLength h.val) → Fin 7) × (Fin (activeHalfLength h.val) → Fin 7)) := + coarse activeHalfLength activeHalfLength AllFieldHistoryRecovery.halfLength_le_eight + side h.val w + +def groupIdealSide (allocation : Allocation) (m : ℕ) (ε : ℝ) (side : Fin 3) + (sigma : Placement) (e : GroupTarget (K := K) (tick := tick) allocation m sigma) + (w : GroupRaw (K := K) (tick := tick) allocation m sigma) : Prop := + coarseMask (groupCounts allocation m sigma) + (fun h => Fin (activeHalfLength h.val) → Fin 7) + (fun h => Fin (activeHalfLength h.val) → Fin 7) groupCoarse side e w ∧ + rawWindows (SL := fun h : ActiveOrder K tick sigma => Statistic h.val) + (SR := fun h : ActiveOrder K tick sigma => Statistic h.val) + (groupCounts allocation m sigma) + (fun h => Fin (activeHalfLength h.val) → Fin 7) + (fun h => Fin (activeHalfLength h.val) → Fin 7) + (fun c => statistic c.1.val) (fun c => statistic c.1.val) + (fun c => leftLaw c.1.val c.2 side) (fun c => rightLaw c.1.val c.2 side) + (fun c => AllFieldHistoryMasks.childWidth ε c.1.val) + (fun c => AllFieldHistoryMasks.childWidth ε c.1.val) e w + +end MatrixMultiplication.AllFieldHistoryGroupedRecovery + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldHistory/GroupMasks.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldHistory/GroupMasks.lean new file mode 100644 index 0000000000000000000000000000000000000000..05472111890f0d0643014fca3d3b446f8cce87e3 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldHistory/GroupMasks.lean @@ -0,0 +1,180 @@ +import OAI.LinearAlgebra.MatrixMultiplication.FieldHistory.RecoveryCore +import OAI.LinearAlgebra.MatrixMultiplication.FieldHistory.GroupAssignment + +namespace OAI + +/-! Finite extraction histories, inherited masks and recovery bounds. -/ + +noncomputable section + +namespace MatrixMultiplication.AllFieldHistoryGroupMasks + +open MatrixMultiplication.Foundation AllFieldHistory AllFieldHistorySupport AllFieldHistoryChildLaws +open AllFieldHistoryMasks AllFieldHistoryRawMasks AllFieldHistoryIncomingMasks +open JointPopulation JointCanonicalization JointCanonicalCW InheritedMasks +open scoped BigOperators +attribute [local instance] Classical.propDecidable Classical.decEq + +variable {K tick : ℕ} + +def groupCounts (allocation : Allocation) (m : ℕ) (sigma : Placement) + (h : ActiveOrder K tick sigma) : JointPopulation.Shape → ℕ := + activeCounts allocation m h.val + +abbrev GroupRaw (allocation : Allocation) (m : ℕ) (sigma : Placement) := + RawPairs (groupCounts (K := K) (tick := tick) allocation m sigma) + (fun h => Fin (activeHalfLength h.val) → Fin 7) + (fun h => Fin (activeHalfLength h.val) → Fin 7) + +def projectRaw (allocation : Allocation) (m : ℕ) (sigma : Placement) + (w : AllFieldHistoryRecovery.Raw (K := K) (tick := tick) allocation m) : + GroupRaw (K := K) (tick := tick) allocation m sigma := fun h j => w h.val j + +def marginal (allocation : Allocation) (m : ℕ) (side : Fin 3) (sigma : Placement) + (w : GroupRaw (K := K) (tick := tick) allocation m sigma) : Prop := + ∀ (h : ActiveOrder K tick sigma) a, + wordPopulation (fun j => coarse activeHalfLength activeHalfLength + AllFieldHistoryRecovery.halfLength_le_eight side h.val (w h j)) a = + wordPopulation (sideWord (activeCounts allocation m) side + (triple (activeCounts allocation m) (canonicalTarget (activeCounts allocation m))) h.val) a + +def incoming (allocation : Allocation) (m : ℕ) (sigma : Placement) + (h : ActiveOrder K tick sigma) (w : GroupRaw (K := K) (tick := tick) allocation m sigma) : + HistoryWord allocation m (h.val.val.1.source, h.val.val.2) := + fun p => joinHalves h.val.val.1 + (w h ((sourcePositionsEquiv allocation m h.val).symm p)) + +def received (allocation : Allocation) (m : ℕ) (ε : ℝ) (side : Fin 3) + (sigma : Placement) (w : GroupRaw (K := K) (tick := tick) allocation m sigma) : Prop := + ∀ h : ActiveOrder K tick sigma, + residentMask allocation m ε (h.val.val.1.source, h.val.val.2) side + (incoming allocation m sigma h w) + +def rawPass (allocation : Allocation) (m : ℕ) (ε : ℝ) (side : Fin 3) + (sigma : Placement) (w : GroupRaw (K := K) (tick := tick) allocation m sigma) : Prop := + ∀ (i : MaskIndex K tick) (hi : i.1.val.physicalOrder = sigma), + |(∑ j : JointPopulation.Positions (activeCounts allocation m) i.1, + if statistic i.1 (w ⟨i.1, hi⟩ j).1 = i.2.1 i.1 ∧ + statistic i.1 (w ⟨i.1, hi⟩ j).2 = i.2.2 i.1 then (1 : ℝ) else 0) / + (population allocation m (i.1.val.1.source, i.1.val.2) : ℝ) - + center allocation side i| ≤ pairWidth ε i.1 + +def completeKeep (allocation : Allocation) (m : ℕ) (ε : ℝ) (side : Fin 3) + (sigma : Placement) (w : GroupRaw (K := K) (tick := tick) allocation m sigma) : Prop := + marginal allocation m side sigma w ∧ received allocation m ε side sigma w ∧ + rawPass allocation m ε side sigma w + +theorem marginal_project (allocation : Allocation) (m : ℕ) (side : Fin 3) + (w : AllFieldHistoryRecovery.Raw (K := K) (tick := tick) allocation m) + (hw : JointCanonicalMixed.sideMask (activeCounts allocation m) + activeHalfLength activeHalfLength AllFieldHistoryRecovery.halfLength_le_eight side w) + (sigma : Placement) : marginal allocation m side sigma (projectRaw allocation m sigma w) := by + intro h a + exact hw h.val a + +theorem received_project (allocation : Allocation) (m : ℕ) (ε : ℝ) (side : Fin 3) + (w : AllFieldHistoryRecovery.Raw (K := K) (tick := tick) allocation m) + (hw : AllFieldHistoryIncomingMasks.received allocation m ε side w) + (sigma : Placement) : received allocation m ε side sigma (projectRaw allocation m sigma w) := by + intro h + exact hw h.val + +theorem rawPass_project (allocation : Allocation) (m : ℕ) (ε : ℝ) (side : Fin 3) + (w : AllFieldHistoryRecovery.Raw (K := K) (tick := tick) allocation m) + (hw : AllFieldHistoryRawMasks.rawPass allocation m ε side w) + (sigma : Placement) : rawPass allocation m ε side sigma (projectRaw allocation m sigma w) := by + intro i hi + exact hw i + +theorem completeKeep_project (allocation : Allocation) (m : ℕ) (ε : ℝ) (side : Fin 3) + (w : AllFieldHistoryRecovery.Raw (K := K) (tick := tick) allocation m) + (hw : AllFieldHistoryRecovery.completeKeep allocation m ε side w) + (sigma : Placement) : completeKeep allocation m ε side sigma + (projectRaw allocation m sigma w) := + ⟨marginal_project allocation m side w hw.1 sigma, + received_project allocation m ε side w hw.2.1 sigma, + rawPass_project allocation m ε side w hw.2.2 sigma⟩ + +theorem completeKeep_iff_all_groups (allocation : Allocation) (m : ℕ) (ε : ℝ) + (side : Fin 3) (w : AllFieldHistoryRecovery.Raw (K := K) (tick := tick) allocation m) : + AllFieldHistoryRecovery.completeKeep allocation m ε side w ↔ + ∀ sigma, completeKeep allocation m ε side sigma (projectRaw allocation m sigma w) := by + refine ⟨fun hw sigma => completeKeep_project allocation m ε side w hw sigma, ?_⟩ + intro hw + refine ⟨?_, ?_, ?_⟩ + · intro h a + exact (hw h.val.physicalOrder).1 ⟨h, rfl⟩ a + · intro h + exact (hw h.val.physicalOrder).2.1 ⟨h, rfl⟩ + · intro i + exact (hw i.1.val.physicalOrder).2.2 i rfl + +def groupRawSource (F : Type*) [CommRing F] (allocation : Allocation) (m : ℕ) + (sigma : Placement) : Tensor F + (GroupRaw (K := K) (tick := tick) allocation m sigma) + (GroupRaw (K := K) (tick := tick) allocation m sigma) (GroupRaw (K := K) (tick := tick) allocation m sigma) := + sourceTensor (groupCounts allocation m sigma) + (fun h => Fin (activeHalfLength h.val) → Fin 7) + (fun h => Fin (activeHalfLength h.val) → Fin 7) + (fun h => AllFieldHistoryRecovery.parents F h.val) + +def groupPreparedSource (F : Type*) [CommRing F] (allocation : Allocation) (m : ℕ) + (ε : ℝ) (sigma : Placement) : Tensor F + (GroupRaw (K := K) (tick := tick) allocation m sigma) + (GroupRaw (K := K) (tick := tick) allocation m sigma) (GroupRaw (K := K) (tick := tick) allocation m sigma) := + ExactRecovery.delete (groupRawSource F allocation m sigma) + (completeKeep allocation m ε 0 sigma) (completeKeep allocation m ε 1 sigma) + (completeKeep allocation m ε 2 sigma) + +theorem rawSource_factor (F : Type*) [CommRing F] (allocation : Allocation) (m : ℕ) + (x y z : AllFieldHistoryRecovery.Raw (K := K) (tick := tick) allocation m) : + AllFieldHistoryRecovery.rawSource F allocation m x y z = + ∏ sigma : Placement, groupRawSource F allocation m sigma + (projectRaw allocation m sigma x) (projectRaw allocation m sigma y) + (projectRaw allocation m sigma z) := + prod_active_eq_prod_orders (fun h => ∏ j, + AllFieldHistoryRecovery.parents F h (x h j) (y h j) (z h j)) + +theorem preparedSource_factor (F : Type*) [CommRing F] (allocation : Allocation) + (m : ℕ) (ε : ℝ) + (x y z : AllFieldHistoryRecovery.Raw (K := K) (tick := tick) allocation m) : + ExactRecovery.delete (AllFieldHistoryRecovery.rawSource F allocation m) + (AllFieldHistoryRecovery.completeKeep allocation m ε 0) + (AllFieldHistoryRecovery.completeKeep allocation m ε 1) + (AllFieldHistoryRecovery.completeKeep allocation m ε 2) x y z = + ∏ sigma : Placement, groupPreparedSource F allocation m ε sigma + (projectRaw allocation m sigma x) (projectRaw allocation m sigma y) + (projectRaw allocation m sigma z) := by + have heq : + (AllFieldHistoryRecovery.completeKeep allocation m ε 0 x ∧ + AllFieldHistoryRecovery.completeKeep allocation m ε 1 y ∧ + AllFieldHistoryRecovery.completeKeep allocation m ε 2 z) ↔ + ∀ sigma : Placement, + completeKeep allocation m ε 0 sigma (projectRaw allocation m sigma x) ∧ + completeKeep allocation m ε 1 sigma (projectRaw allocation m sigma y) ∧ + completeKeep allocation m ε 2 sigma (projectRaw allocation m sigma z) := by + rw [completeKeep_iff_all_groups, completeKeep_iff_all_groups, completeKeep_iff_all_groups] + exact ⟨fun h sigma => ⟨h.1 sigma, h.2.1 sigma, h.2.2 sigma⟩, + fun h => ⟨fun sigma => (h sigma).1, fun sigma => (h sigma).2.1, + fun sigma => (h sigma).2.2⟩⟩ + by_cases h : AllFieldHistoryRecovery.completeKeep allocation m ε 0 x ∧ + AllFieldHistoryRecovery.completeKeep allocation m ε 1 y ∧ + AllFieldHistoryRecovery.completeKeep allocation m ε 2 z + · rw [ExactRecovery.delete, ite_eq_left h, rawSource_factor] + apply Finset.prod_congr rfl + intro sigma _ + exact (ite_eq_left (heq.mp h sigma)).symm + · rw [ExactRecovery.delete, ite_eq_right h] + have hn : ¬∀ sigma : Placement, + completeKeep allocation m ε 0 sigma (projectRaw allocation m sigma x) ∧ + completeKeep allocation m ε 1 sigma (projectRaw allocation m sigma y) ∧ + completeKeep allocation m ε 2 sigma (projectRaw allocation m sigma z) := + fun hh => h (heq.mpr hh) + obtain ⟨sigma, hs⟩ := not_forall.mp hn + exact (Finset.prod_eq_zero (Finset.mem_univ sigma) (ite_eq_right hs)).symm + +end MatrixMultiplication.AllFieldHistoryGroupMasks + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldHistory/GroupedRecovery.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldHistory/GroupedRecovery.lean new file mode 100644 index 0000000000000000000000000000000000000000..d3c46b3a181286675d0a75938805c43f98c14435 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldHistory/GroupedRecovery.lean @@ -0,0 +1,277 @@ +import OAI.LinearAlgebra.MatrixMultiplication.FieldHistory.GroupCore +import OAI.LinearAlgebra.MatrixMultiplication.FieldHistory.Recovery +import OAI.LinearAlgebra.MatrixMultiplication.Recovery.GroupOrbitProjection +import OAI.LinearAlgebra.MatrixMultiplication.Recovery.RecoveryOrbitDecisions + +namespace OAI + +/-! Finite extraction histories, inherited masks and recovery bounds. -/ + +noncomputable section + +namespace MatrixMultiplication.AllFieldHistoryGroupedRecovery + +open AllFieldHistory AllFieldHistorySupport AllFieldHistoryChildLaws +open AllFieldHistoryGroupMasks JointPopulation JointCanonicalization JointCanonicalCW +open PermutationMatching +open scoped BigOperators +attribute [local instance] Classical.propDecidable Classical.decEq + +variable {K tick : ℕ} + +theorem coordinates_project (allocation : Allocation) (m : ℕ) (sigma : Placement) + (e : AllFieldHistoryRecovery.Targets (K := K) (tick := tick) allocation m) + (w : AllFieldHistoryRecovery.Raw (K := K) (tick := tick) allocation m) : + GroupOrbitProjection.projectPair + (ClassPositions (activeCounts allocation m)) + AllFieldHistoryMasks.Letters AllFieldHistoryMasks.Letters + (fun h : Active K tick => h.val.physicalOrder = sigma) + (AllFieldHistoryRecovery.coordinates allocation m e w) = + groupCoordinates allocation m sigma (projectTarget allocation m sigma e) + (projectRaw allocation m sigma w) := rfl + +theorem idealSide_iff_all_groups (allocation : Allocation) (m : ℕ) (ε : ℝ) + (side : Fin 3) + (e : AllFieldHistoryRecovery.Targets (K := K) (tick := tick) allocation m) + (w : AllFieldHistoryRecovery.Raw (K := K) (tick := tick) allocation m) : + AllFieldHistoryRecovery.idealSide allocation m ε side e w ↔ + ∀ sigma, groupIdealSide allocation m ε side sigma + (projectTarget allocation m sigma e) (projectRaw allocation m sigma w) := by + constructor + · intro hw sigma + exact ⟨fun h j => hw.1 h.val j, fun h u hu => hw.2 h.val u hu⟩ + · intro hw + exact ⟨fun h j => (hw h.val.physicalOrder).1 ⟨h, rfl⟩ j, + fun h u hu => (hw h.val.physicalOrder).2 ⟨h, rfl⟩ u hu⟩ + +theorem project_joinGroupTargets (allocation : Allocation) (m : ℕ) + (e : ∀ sigma, GroupTarget (K := K) (tick := tick) allocation m sigma) + (sigma : Placement) : + projectTarget allocation m sigma (joinGroupTargets (activeCounts allocation m) e) = + e sigma := by + funext h + rcases h with ⟨h, hh⟩ + cases hh + rfl + +def groupedAssignment (allocation : Allocation) (m : ℕ) (E : Placement → Type*) + (a : ∀ sigma, JointExtraction.Assignment + (GroupRaw (K := K) (tick := tick) allocation m sigma) + (GroupRaw (K := K) (tick := tick) allocation m sigma) (GroupRaw (K := K) (tick := tick) allocation m sigma) (E sigma)) : + JointExtraction.Assignment (AllFieldHistoryRecovery.Raw (K := K) (tick := tick) allocation m) + (AllFieldHistoryRecovery.Raw (K := K) (tick := tick) allocation m) (AllFieldHistoryRecovery.Raw (K := K) (tick := tick) allocation m) + (∀ sigma, E sigma) where + x w := GroupAssignment.collect (fun sigma => (a sigma).x) + (fun sigma => projectRaw allocation m sigma w) + y w := GroupAssignment.collect (fun sigma => (a sigma).y) + (fun sigma => projectRaw allocation m sigma w) + z w := GroupAssignment.collect (fun sigma => (a sigma).z) + (fun sigma => projectRaw allocation m sigma w) + +theorem groupedAssignment_sound (allocation : Allocation) (m : ℕ) (ε : ℝ) + (E : Placement → Type*) + (a : ∀ sigma, JointExtraction.Assignment + (GroupRaw (K := K) (tick := tick) allocation m sigma) + (GroupRaw (K := K) (tick := tick) allocation m sigma) (GroupRaw (K := K) (tick := tick) allocation m sigma) (E sigma)) + (i : ∀ sigma, E sigma) (e : ∀ sigma, GroupTarget (K := K) (tick := tick) allocation m sigma) + (hx : ∀ sigma w, (a sigma).x w = some (i sigma) → + groupIdealSide allocation m ε 0 sigma (e sigma) w) + (hy : ∀ sigma w, (a sigma).y w = some (i sigma) → + groupIdealSide allocation m ε 1 sigma (e sigma) w) + (hz : ∀ sigma w, (a sigma).z w = some (i sigma) → + groupIdealSide allocation m ε 2 sigma (e sigma) w) : + (∀ w, (groupedAssignment allocation m E a).x w = some i → + AllFieldHistoryRecovery.idealSide allocation m ε 0 + (joinGroupTargets (activeCounts allocation m) e) w) ∧ + (∀ w, (groupedAssignment allocation m E a).y w = some i → + AllFieldHistoryRecovery.idealSide allocation m ε 1 + (joinGroupTargets (activeCounts allocation m) e) w) ∧ + (∀ w, (groupedAssignment allocation m E a).z w = some i → + AllFieldHistoryRecovery.idealSide allocation m ε 2 + (joinGroupTargets (activeCounts allocation m) e) w) := by + refine ⟨?_, ?_, ?_⟩ + · intro w hw + apply (idealSide_iff_all_groups allocation m ε 0 _ w).2 + intro sigma + rw [project_joinGroupTargets] + exact hx sigma _ ((GroupAssignment.collect_eq_some _ _ _).mp hw sigma) + · intro w hw + apply (idealSide_iff_all_groups allocation m ε 1 _ w).2 + intro sigma + rw [project_joinGroupTargets] + exact hy sigma _ ((GroupAssignment.collect_eq_some _ _ _).mp hw sigma) + · intro w hw + apply (idealSide_iff_all_groups allocation m ε 2 _ w).2 + intro sigma + rw [project_joinGroupTargets] + exact hz sigma _ ((GroupAssignment.collect_eq_some _ _ _).mp hw sigma) + +def localOrbit (allocation : Allocation) (m : ℕ) (sigma : Placement) + (e : GroupTarget (K := K) (tick := tick) allocation m sigma) + (w : GroupRaw (K := K) (tick := tick) allocation m sigma) : Finset (GroupRaw (K := K) (tick := tick) allocation m sigma) := + GroupOrbitProjection.rawOrbit (groupCounts allocation m sigma) + (fun h => Fin (activeHalfLength h.val) → Fin 7) + (fun h => Fin (activeHalfLength h.val) → Fin 7) e w + +def localAssigned (allocation : Allocation) (m : ℕ) (sigma : Placement) {E : Type*} + (a : JointExtraction.Assignment + (GroupRaw (K := K) (tick := tick) allocation m sigma) + (GroupRaw (K := K) (tick := tick) allocation m sigma) (GroupRaw (K := K) (tick := tick) allocation m sigma) E) + (i : E) (side : Fin 3) (w : GroupRaw (K := K) (tick := tick) allocation m sigma) : Prop := + AllFieldHistoryRecovery.sideVariable side (a.x w = some i) (a.y w = some i) (a.z w = some i) + +theorem grouped_assigned_iff (allocation : Allocation) (m : ℕ) + (E : Placement → Type*) + (a : ∀ sigma, JointExtraction.Assignment + (GroupRaw (K := K) (tick := tick) allocation m sigma) + (GroupRaw (K := K) (tick := tick) allocation m sigma) (GroupRaw (K := K) (tick := tick) allocation m sigma) (E sigma)) + (i : ∀ sigma, E sigma) (side : Fin 3) + (w : AllFieldHistoryRecovery.Raw (K := K) (tick := tick) allocation m) : + AllFieldHistoryRecovery.sideVariable side + ((groupedAssignment allocation m E a).x w = some i) + ((groupedAssignment allocation m E a).y w = some i) + ((groupedAssignment allocation m E a).z w = some i) ↔ + ∀ sigma, localAssigned allocation m sigma (a sigma) (i sigma) side + (projectRaw allocation m sigma w) := by + fin_cases side <;> exact GroupAssignment.collect_eq_some _ _ _ + +theorem filter_eq_rejected {V : Type*} (orbit : Finset V) + (bad : V → Prop) (d : DecidablePred bad) : + @Finset.filter V bad d orbit = rejectedFilter orbit bad := by + ext v + simp only [rejectedFilter, Finset.mem_filter] + +theorem grouped_collision_le (allocation : Allocation) (m : ℕ) (ε : ℝ) + (E : Placement → Type*) + (a : ∀ sigma, JointExtraction.Assignment + (GroupRaw (K := K) (tick := tick) allocation m sigma) + (GroupRaw (K := K) (tick := tick) allocation m sigma) (GroupRaw (K := K) (tick := tick) allocation m sigma) (E sigma)) + (i : ∀ sigma, E sigma) (e : ∀ sigma, GroupTarget (K := K) (tick := tick) allocation m sigma) + (side : Fin 3) (w : AllFieldHistoryRecovery.Raw (K := K) (tick := tick) allocation m) + (hbound : ∀ sigma, + (((localOrbit allocation m sigma (e sigma) (projectRaw allocation m sigma w)).filter + (fun v => AllFieldHistoryGroupMasks.completeKeep allocation m ε side sigma v ∧ + ¬localAssigned allocation m sigma (a sigma) (i sigma) side v)).card : ℝ) / + (localOrbit allocation m sigma (e sigma) (projectRaw allocation m sigma w)).card ≤ 1 / m) : + letI : MulAction (AllFieldHistoryRecovery.Symmetries (K := K) (tick := tick) allocation m) + (AllFieldHistoryRecovery.Raw (K := K) (tick := tick) allocation m) := + AllFieldHistoryRecovery.rawAction allocation m (joinGroupTargets (activeCounts allocation m) e) + (((OrbitCounting.orbitSet (G := AllFieldHistoryRecovery.Symmetries (K := K) (tick := tick) allocation m) w).filter + (fun v => AllFieldHistoryRecovery.completeKeep allocation m ε side v ∧ + ¬AllFieldHistoryRecovery.sideVariable side + ((groupedAssignment allocation m E a).x v = some i) + ((groupedAssignment allocation m E a).y v = some i) + ((groupedAssignment allocation m E a).z v = some i))).card : ℝ) / + (OrbitCounting.orbitSet (G := AllFieldHistoryRecovery.Symmetries (K := K) (tick := tick) allocation m) w).card ≤ 6 / m := by + let target := joinGroupTargets (activeCounts allocation m) e + let : MulAction (AllFieldHistoryRecovery.Symmetries (K := K) (tick := tick) allocation m) + (AllFieldHistoryRecovery.Raw (K := K) (tick := tick) allocation m) := AllFieldHistoryRecovery.rawAction allocation m target + have hb (sigma : Placement) : + ((rejectedFilter (GroupOrbitProjection.rawOrbit + (GroupOrbitProjection.groupCounts (activeCounts allocation m) + (fun h : Active K tick => h.val.physicalOrder = sigma)) + (fun h => Left activeHalfLength h.val) (fun h => Right activeHalfLength h.val) + (GroupOrbitProjection.projectTarget (activeCounts allocation m) + (fun h => h.val.physicalOrder = sigma) target) + (projectRaw allocation m sigma w)) + (fun v => AllFieldHistoryGroupMasks.completeKeep allocation m ε side sigma v ∧ + ¬localAssigned allocation m sigma (a sigma) (i sigma) side v)).card : ℝ) / + (GroupOrbitProjection.rawOrbit + (GroupOrbitProjection.groupCounts (activeCounts allocation m) + (fun h : Active K tick => h.val.physicalOrder = sigma)) + (fun h => Left activeHalfLength h.val) (fun h => Right activeHalfLength h.val) + (GroupOrbitProjection.projectTarget (activeCounts allocation m) + (fun h => h.val.physicalOrder = sigma) target) + (projectRaw allocation m sigma w)).card ≤ 1 / m := by + change ((rejectedFilter + (localOrbit allocation m sigma (projectTarget allocation m sigma target) + (projectRaw allocation m sigma w)) + (fun v => AllFieldHistoryGroupMasks.completeKeep allocation m ε side sigma v ∧ + ¬localAssigned allocation m sigma (a sigma) (i sigma) side v)).card : ℝ) / + (localOrbit allocation m sigma (projectTarget allocation m sigma target) + (projectRaw allocation m sigma w)).card ≤ 1 / m + dsimp only [target] + rw [project_joinGroupTargets] + have hb0 := hbound sigma + rw [filter_eq_rejected] at hb0 + exact hb0 + have hh := GroupOrbitProjection.raw_group_passing_rejection_fraction_le + (activeCounts allocation m) (Left activeHalfLength) (Right activeHalfLength) + (fun h : Active K tick => h.val.physicalOrder) target w + (AllFieldHistoryRecovery.completeKeep allocation m ε side) + (fun sigma => AllFieldHistoryGroupMasks.completeKeep allocation m ε side sigma) + (fun sigma => localAssigned allocation m sigma (a sigma) (i sigma) side) + (fun v hv sigma => completeKeep_project allocation m ε side v hv sigma) + (fun _ => (1 : ℝ) / m) hb + have hcard : Fintype.card Placement = 6 := by + norm_num [Placement, Fintype.card_perm, Nat.factorial] + have horbit : + OrbitCounting.orbitSet + (G := AllFieldHistoryRecovery.Symmetries (K := K) (tick := tick) allocation m) w = + GroupOrbitProjection.rawOrbit (activeCounts allocation m) + (Left activeHalfLength) (Right activeHalfLength) target w := by + exact RecoveryOrbitDecisions.orbitSet_eq_transportedOrbit + (G := AllFieldHistoryRecovery.Symmetries (K := K) (tick := tick) allocation m) + _ _ _ (AllFieldHistoryRecovery.coordinates allocation m target) w + rw [filter_eq_rejected, horbit] + have hfilter := rejectedFilter_congr + (GroupOrbitProjection.rawOrbit (activeCounts allocation m) + (Left activeHalfLength) (Right activeHalfLength) target w) + (fun v => AllFieldHistoryRecovery.completeKeep allocation m ε side v ∧ + ¬AllFieldHistoryRecovery.sideVariable side + ((groupedAssignment allocation m E a).x v = some i) + ((groupedAssignment allocation m E a).y v = some i) + ((groupedAssignment allocation m E a).z v = some i)) + (fun v => AllFieldHistoryRecovery.completeKeep allocation m ε side v ∧ + ¬∀ sigma, localAssigned allocation m sigma (a sigma) (i sigma) side + (GroupOrbitProjection.projectRaw (activeCounts allocation m) + (Left activeHalfLength) (Right activeHalfLength) + (fun h : Active K tick => h.val.physicalOrder = sigma) v)) + (fun v => and_congr Iff.rfl + (not_congr (grouped_assigned_iff allocation m E a i side v))) + rw [hfilter] + simpa only [Finset.sum_const, Finset.card_univ, + hcard, nsmul_eq_mul, Nat.cast_ofNat, mul_one_div] using hh + +theorem repair_grouped (F : Type*) [CommRing F] (allocation : Allocation) + {m : ℕ} {ε : ℝ} (hε : 0 < ε) + (hm : AllFieldHistoryRecovery.minimumDilation (K := K) (tick := tick) allocation ε ≤ m) + (E : Placement → Type*) + (a : ∀ sigma, JointExtraction.Assignment + (GroupRaw (K := K) (tick := tick) allocation m sigma) + (GroupRaw (K := K) (tick := tick) allocation m sigma) (GroupRaw (K := K) (tick := tick) allocation m sigma) (E sigma)) + (i : ∀ sigma, E sigma) (e : ∀ sigma, GroupTarget (K := K) (tick := tick) allocation m sigma) + (hx : ∀ sigma w, (a sigma).x w = some (i sigma) → + groupIdealSide allocation m ε 0 sigma (e sigma) w) + (hy : ∀ sigma w, (a sigma).y w = some (i sigma) → + groupIdealSide allocation m ε 1 sigma (e sigma) w) + (hz : ∀ sigma w, (a sigma).z w = some (i sigma) → + groupIdealSide allocation m ε 2 sigma (e sigma) w) + (hbound : ∀ side w, + AllFieldHistoryRecovery.Used F allocation m ε + (joinGroupTargets (activeCounts allocation m) e) side w → ∀ sigma, + (((localOrbit allocation m sigma (e sigma) (projectRaw allocation m sigma w)).filter + (fun v => AllFieldHistoryGroupMasks.completeKeep allocation m ε side sigma v ∧ + ¬localAssigned allocation m sigma (a sigma) (i sigma) side v)).card : ℝ) / + (localOrbit allocation m sigma (e sigma) (projectRaw allocation m sigma w)).card ≤ 1 / m) : + InverseLinearRecovery.RecoveredBy + (AllFieldHistoryRecovery.ideal F allocation m ε (joinGroupTargets (activeCounts allocation m) e)) + (JointExtraction.branch + (ExactRecovery.delete (AllFieldHistoryRecovery.rawSource F allocation m) + (AllFieldHistoryRecovery.completeKeep allocation m ε 0) + (AllFieldHistoryRecovery.completeKeep allocation m ε 1) + (AllFieldHistoryRecovery.completeKeep allocation m ε 2)) + (groupedAssignment allocation m E a) i) + (AllFieldHistoryRecovery.shiftCount (K := K) (tick := tick) allocation ε m) := by + have hs := groupedAssignment_sound allocation m ε E a i e hx hy hz + apply AllFieldHistoryRecovery.repair_selected_branch F allocation hε hm + (groupedAssignment allocation m E a) i (joinGroupTargets (activeCounts allocation m) e) + hs.1 hs.2.1 hs.2.2 + intro side w hw + exact grouped_collision_le allocation m ε E a i e side w (hbound side w hw) + +end MatrixMultiplication.AllFieldHistoryGroupedRecovery + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldHistory/IncomingCore.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldHistory/IncomingCore.lean new file mode 100644 index 0000000000000000000000000000000000000000..1e5c2d269068acf39c8fbf54b16fbd1cf428e7f2 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldHistory/IncomingCore.lean @@ -0,0 +1,47 @@ +import OAI.LinearAlgebra.MatrixMultiplication.FieldHistory.MaskCore +import OAI.LinearAlgebra.MatrixMultiplication.FieldHistory.Tensors + +namespace OAI + +/-! Finite extraction histories, inherited masks and recovery bounds. -/ + +noncomputable section + +namespace MatrixMultiplication.AllFieldHistoryIncomingMasks + +open MatrixMultiplication.Foundation AllFieldHistory AllFieldParameters +open AllFieldHistoryChildLaws AllFieldHistorySupport AllFieldHistoryMasks +open scoped BigOperators +attribute [local instance] Classical.propDecidable Classical.decEq + +variable {K tick : ℕ} + +def joinHalves (w : Work K) : + ((Fin w.halfLength → Fin 7) × (Fin w.halfLength → Fin 7)) → + (Fin (currentLength w.source) → Fin 7) := + match w with + | .stageA _ => fun x => Fin.append x.1 x.2 + | .stageB _ => fun x => Fin.append x.1 x.2 + | .stageC _ => fun x => Fin.append x.1 x.2 + +def sourcePositionsEquiv (allocation : Allocation) (m : ℕ) (h : Active K tick) : + JointPopulation.Positions (activeCounts allocation m) h ≃ + Fin (population allocation m (h.val.1.source, h.val.2)) := + finCongr (jointCounts_sum allocation m h.val) + +def incomingWord (allocation : Allocation) (m : ℕ) (h : Active K tick) + (w : ActiveRawPairs (K := K) (tick := tick) allocation m) : + HistoryWord allocation m (h.val.1.source, h.val.2) := + fun p => joinHalves h.val.1 (w h ((sourcePositionsEquiv allocation m h).symm p)) + +def received (allocation : Allocation) (m : ℕ) (ε : ℝ) (side : Fin 3) + (w : ActiveRawPairs (K := K) (tick := tick) allocation m) : Prop := + ∀ h : Active K tick, + residentMask allocation m ε (h.val.1.source, h.val.2) side + (incomingWord allocation m h w) + +end MatrixMultiplication.AllFieldHistoryIncomingMasks + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldHistory/IncomingMasks.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldHistory/IncomingMasks.lean new file mode 100644 index 0000000000000000000000000000000000000000..29efc08b8b010823c0060a9a5049723c5422e546 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldHistory/IncomingMasks.lean @@ -0,0 +1,241 @@ +import OAI.LinearAlgebra.MatrixMultiplication.FieldHistory.IncomingCore +import OAI.LinearAlgebra.MatrixMultiplication.FieldHistory.MaskLaws +import OAI.LinearAlgebra.MatrixMultiplication.FieldHistory.RawMasks +import OAI.LinearAlgebra.MatrixMultiplication.FieldHistory.StageCIncoming +import OAI.LinearAlgebra.MatrixMultiplication.FieldHistory.Tensors + +namespace OAI + +/-! Finite extraction histories, inherited masks and recovery bounds. -/ + +noncomputable section + +namespace MatrixMultiplication.AllFieldHistoryIncomingMasks + +open MatrixMultiplication.Foundation AllFieldHistory AllFieldParameters +open AllFieldHistoryChildLaws AllFieldHistorySupport AllFieldHistoryMasks +open AllFieldHistoryMaskLaws AllFieldHistoryRawMasks InheritedMasks +open scoped BigOperators +attribute [local instance] Classical.propDecidable Classical.decEq + +variable {K tick : ℕ} + +theorem empiricalLaw_congr_decidable {P A : Type*} [Fintype P] + (d₁ d₂ : DecidableEq A) (w : P → A) (a : A) : + @empiricalLaw P A _ d₁ w a = @empiricalLaw P A _ d₂ w a := by + cases Subsingleton.elim d₁ d₂ + rfl + +theorem typeWindow_mono_decidable {P A : Type*} [Fintype P] + (d₁ d₂ : DecidableEq A) (ν : A → ℝ) {η δ : ℝ} (hη : η ≤ δ) + (w : P → A) (hw : @typeWindow P A _ d₁ ν η w) : + @typeWindow P A _ d₂ ν δ w := by + cases Subsingleton.elim d₁ d₂ + intro a + exact (hw a).trans hη + +theorem weight_append {m n : ℕ} (l : Fin m → Fin 7) (r : Fin n → Fin 7) : + CWStrands.weight (Fin.append l r) = CWStrands.weight l + CWStrands.weight r := by + simp [CWStrands.weight, Fin.sum_univ_add] + +theorem strand_append {F : Type*} [CommRing F] {m n : ℕ} + (x y z : (Fin m → Fin 7) × (Fin n → Fin 7)) : + CWStrands.strand (F := F) (Fin (m + n)) + (Fin.append x.1 x.2) (Fin.append y.1 y.2) (Fin.append z.1 z.2) = + CWStrands.strand (Fin m) x.1 y.1 z.1 * CWStrands.strand (Fin n) x.2 y.2 z.2 := by + simp [CWStrands.strand, Fin.prod_univ_add] + +theorem shapeTensor_append {F : Type*} [CommRing F] {m n : ℕ} (g : Shape) + (x y z : (Fin m → Fin 7) × (Fin n → Fin 7)) : + CWStrands.shapeTensor (F := F) (Fin (m + n)) g + (Fin.append x.1 x.2) (Fin.append y.1 y.2) (Fin.append z.1 z.2) = + CWStrands.shapeTensor (Fin m ⊕ Fin n) g + (Sum.elim x.1 x.2) (Sum.elim y.1 y.2) (Sum.elim z.1 z.2) := by + simp only [CWStrands.shapeTensor, weight_append, CWStrands.weight_sum_elim, + strand_append, CWStrands.strand_sum_elim, Tensor.product] + +theorem shapeTensor_joinHalves {F : Type*} [CommRing F] (w : Work K) (g : Shape) + (x y z : (Fin w.halfLength → Fin 7) × (Fin w.halfLength → Fin 7)) : + CWStrands.shapeTensor (F := F) (Fin (currentLength w.source)) g + (joinHalves w x) (joinHalves w y) (joinHalves w z) = + CWStrands.shapeTensor (Fin w.halfLength ⊕ Fin w.halfLength) g + (Sum.elim x.1 x.2) (Sum.elim y.1 y.2) (Sum.elim z.1 z.2) := by + cases w <;> exact shapeTensor_append g x y z + +def defaultStatistic : (w : Work K) → w.Statistic + | .stageA _ => (0, 0) + | .stageB _ => (0 : Fin 6) + | .stageC _ => PUnit.unit + +def choiceAt (h : Active K tick) (a : Statistic h) : SymbolChoice K tick := + Function.update (fun g => defaultStatistic g.val.1) h a + +@[simp] theorem choiceAt_self (h : Active K tick) (a : Statistic h) : + choiceAt h a h = a := by simp [choiceAt] + +theorem rawPairCount_eq_wordPopulation (allocation : Allocation) (m : ℕ) + (i : MaskIndex K tick) (w : ActiveRawPairs (K := K) (tick := tick) allocation m) : + rawPairCount allocation m i w = + (wordPopulation (fun j => (statistic i.1 (w i.1 j).1, + statistic i.1 (w i.1 j).2)) (i.2.1 i.1, i.2.2 i.1) : ℝ) := by + simp only [rawPairCount, wordPopulation, Fintype.card_subtype, + Finset.natCast_card_filter, Prod.mk.injEq] + +@[simp] theorem fourStatistic_append (l r : Fin 2 → Fin 7) : + CWCompleteStatistics.fourStatistic (Fin.append l r) = + (CWCompleteStatistics.twoStatistic l, CWCompleteStatistics.twoStatistic r) := rfl + +@[simp] theorem append_singletons (l r : Fin 1 → Fin 7) : + Fin.append l r = ![l 0, r 0] := by + funext i + fin_cases i <;> rfl + +theorem rawPass_stageB_typeWindow (allocation : Allocation) (m : ℕ) (ε : ℝ) + (side : Fin 3) (w : ActiveRawPairs (K := K) (tick := tick) allocation m) + (hw : rawPass allocation m ε side w) (h : APositive K) (phi : Placement) + (ht : FiniteSchedule.lotTick (Work.stageB h).lot (Work.stageB h).stage = tick) : + typeWindow (fun ij : PairSlot => (halfLaw (aShape h.val) (phi.symm side) ij : ℝ)) + (pairWidth ε (stageBActive h phi ht)) + (fun j => CWCompleteStatistics.fourStatistic + (joinHalves (.stageB h) (w (stageBActive h phi ht) j))) := by + intro ij + have hp := hw (stageBActive h phi ht, + choiceAt (stageBActive h phi ht) ij.1, choiceAt (stageBActive h phi ht) ij.2) + rw [center_stageB] at hp + simp only [choiceAt_self (stageBActive h phi ht) ij.1, + choiceAt_self (stageBActive h phi ht) ij.2] at hp + have hcard : Fintype.card (JointPopulation.Positions (activeCounts allocation m) + (stageBActive h phi ht)) = population allocation m + ((stageBActive h phi ht).val.1.source, (stageBActive h phi ht).val.2) := by + exact (Fintype.card_congr + (sourcePositionsEquiv allocation m (stageBActive h phi ht))).trans + (Fintype.card_fin _) + have hcount : (wordPopulation (fun j => + (statistic (stageBActive h phi ht) (w (stageBActive h phi ht) j).1, + statistic (stageBActive h phi ht) (w (stageBActive h phi ht) j).2)) ij : ℝ) = + rawPairCount allocation m (stageBActive h phi ht, + choiceAt (stageBActive h phi ht) ij.1, choiceAt (stageBActive h phi ht) ij.2) w := by + rcases ij with ⟨a, b⟩ + simp only [wordPopulation, Fintype.card_subtype, + Finset.natCast_card_filter, rawPairCount] + apply Finset.sum_congr rfl + intro j _ + apply if_congr + · simp only [choiceAt_self (stageBActive h phi ht) a, + choiceAt_self (stageBActive h phi ht) b] + exact Prod.mk_inj + · rfl + · rfl + have hword : (fun j => CWCompleteStatistics.fourStatistic + (joinHalves (.stageB h) (w (stageBActive h phi ht) j))) = + (fun j => (statistic (stageBActive h phi ht) (w (stageBActive h phi ht) j).1, + statistic (stageBActive h phi ht) (w (stageBActive h phi ht) j).2)) := by + funext j + rfl + have he : empiricalLaw (fun j => CWCompleteStatistics.fourStatistic + (joinHalves (.stageB h) (w (stageBActive h phi ht) j))) ij = + empiricalLaw (fun j => + (statistic (stageBActive h phi ht) (w (stageBActive h phi ht) j).1, + statistic (stageBActive h phi ht) (w (stageBActive h phi ht) j).2)) ij := by + rw [hword] + exact empiricalLaw_congr_decidable _ _ _ _ + rw [he] + unfold empiricalLaw + rw [hcard, hcount] + exact hp + +attribute [local irreducible] activeCounts population + +theorem incoming_stageA (allocation : Allocation) (m : ℕ) (ε : ℝ) + (side : Fin 3) (w : ActiveRawPairs (K := K) (tick := tick) allocation m) + (h : InitialPositive K) (phi : Placement) + (ht : FiniteSchedule.lotTick (Work.stageA h).lot (Work.stageA h).stage = tick) : + residentMask allocation m ε ((Work.stageA h).source, phi) side + (incomingWord allocation m ⟨(.stageA h, phi), ht⟩ w) := by + trivial + +theorem incoming_stageB (allocation : Allocation) (m : ℕ) {ε : ℝ} (hε : 0 ≤ ε) + (side : Fin 3) (w : ActiveRawPairs (K := K) (tick := tick) allocation m) + (hw : rawPass allocation m ε side w) (h : APositive K) (phi : Placement) + (ht : FiniteSchedule.lotTick (Work.stageB h).lot (Work.stageB h).stage = tick) : + residentMask allocation m ε ((Work.stageB h).source, phi) side + (incomingWord allocation m (stageBActive h phi ht) w) := by + intro _ + have hraw := rawPass_stageB_typeWindow allocation m ε side w hw h phi ht + have htransport := (JointCanonicalization.typeWindow_reindex + (fun ij : PairSlot => (halfLaw (aShape h.val) (phi.symm side) ij : ℝ)) + (pairWidth ε (stageBActive h phi ht)) + (fun j => CWCompleteStatistics.fourStatistic + (joinHalves (.stageB h) (w (stageBActive h phi ht) j))) + (sourcePositionsEquiv allocation m (stageBActive h phi ht)).symm).2 hraw + have hwidth : pairWidth ε (stageBActive h phi ht) ≤ ε / 8 := by + change ε / 16 ^ 1 ≤ ε / 8 + norm_num + linarith + dsimp only [Work.source, residentLaw, residentLawRat, residentWidth, residentStatistic] + exact typeWindow_mono_decidable _ _ _ hwidth _ htransport + +theorem incoming_stageC (allocation : Allocation) {m : ℕ} (hm : 0 < m) + {ε : ℝ} (hε : 0 ≤ ε) (side : Fin 3) + (e : JointPopulation.Target (activeCounts (K := K) (tick := tick) allocation m)) + (w : ActiveRawPairs (K := K) (tick := tick) allocation m) + (h : PartC K) (phi : Placement) + (ht : FiniteSchedule.lotTick (Work.stageC h).lot (Work.stageC h).stage = tick) + (hweights : ∀ j, + CWLeafStatistics.weight ((w (AllFieldHistoryStageCIncoming.stageCActive h phi ht) j).1 (0 : Fin 1)) = + (JointPopulation.shapeSide side ((e (AllFieldHistoryStageCIncoming.stageCActive h phi ht)).val j)).val ∧ + CWLeafStatistics.weight ((w (AllFieldHistoryStageCIncoming.stageCActive h phi ht) j).2 (0 : Fin 1)) = + activeParentShape (AllFieldHistoryStageCIncoming.stageCActive h phi ht) side - + (JointPopulation.shapeSide side ((e (AllFieldHistoryStageCIncoming.stageCActive h phi ht)).val j)).val) : + residentMask allocation m ε ((Work.stageC h).source, phi) side + (incomingWord allocation m (AllFieldHistoryStageCIncoming.stageCActive h phi ht) w) := by + intro _ + have hraw := AllFieldHistoryStageCIncoming.typeWindow_of_target_side_weights + allocation hm h phi ht e w side hweights (ε / 256) (div_nonneg hε (by norm_num)) + have hword : + (fun j => CWCompleteStatistics.twoStatistic + (joinHalves (.stageC h) + (w (AllFieldHistoryStageCIncoming.stageCActive h phi ht) j))) = + (fun j => CWCompleteStatistics.twoStatistic + ![(w (AllFieldHistoryStageCIncoming.stageCActive h phi ht) j).1 (0 : Fin 1), + (w (AllFieldHistoryStageCIncoming.stageCActive h phi ht) j).2 (0 : Fin 1)]) := by + funext j + exact congrArg CWCompleteStatistics.twoStatistic (append_singletons _ _) + rw [← hword] at hraw + have htransport := (JointCanonicalization.typeWindow_reindex + (fun a : Fin 6 => (littleLaw (cParameterParent h) (cShapeParent h) (phi.symm side) a : ℝ)) + (ε / 256) + (fun j => CWCompleteStatistics.twoStatistic + (joinHalves (.stageC h) + (w (AllFieldHistoryStageCIncoming.stageCActive h phi ht) j))) + (sourcePositionsEquiv allocation m (AllFieldHistoryStageCIncoming.stageCActive h phi ht)).symm).2 hraw + exact typeWindow_mono_decidable _ _ _ le_rfl _ htransport + +def stageCWeights (allocation : Allocation) (m : ℕ) (side : Fin 3) + (e : JointPopulation.Target (activeCounts (K := K) (tick := tick) allocation m)) + (w : ActiveRawPairs (K := K) (tick := tick) allocation m) : Prop := + ∀ (h : PartC K) (phi : Placement) + (ht : FiniteSchedule.lotTick (Work.stageC h).lot (Work.stageC h).stage = tick) j, + CWLeafStatistics.weight ((w (AllFieldHistoryStageCIncoming.stageCActive h phi ht) j).1 (0 : Fin 1)) = + (JointPopulation.shapeSide side ((e (AllFieldHistoryStageCIncoming.stageCActive h phi ht)).val j)).val ∧ + CWLeafStatistics.weight ((w (AllFieldHistoryStageCIncoming.stageCActive h phi ht) j).2 (0 : Fin 1)) = + activeParentShape (AllFieldHistoryStageCIncoming.stageCActive h phi ht) side - + (JointPopulation.shapeSide side ((e (AllFieldHistoryStageCIncoming.stageCActive h phi ht)).val j)).val + +theorem received_of_rawPass (allocation : Allocation) {m : ℕ} (hm : 0 < m) + {ε : ℝ} (hε : 0 ≤ ε) (side : Fin 3) + (e : JointPopulation.Target (activeCounts (K := K) (tick := tick) allocation m)) + (w : ActiveRawPairs (K := K) (tick := tick) allocation m) + (hw : rawPass allocation m ε side w) (hc : stageCWeights allocation m side e w) : + received allocation m ε side w := by + rintro ⟨⟨work, phi⟩, ht⟩ + cases work with + | stageA h => exact incoming_stageA allocation m ε side w h phi ht + | stageB h => exact incoming_stageB allocation m hε side w hw h phi ht + | stageC h => exact incoming_stageC allocation hm hε side e w h phi ht (hc h phi ht) + +end MatrixMultiplication.AllFieldHistoryIncomingMasks + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldHistory/Iteration.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldHistory/Iteration.lean new file mode 100644 index 0000000000000000000000000000000000000000..b857aa01d90ae3116e1c140cac944b0a5f59dd34 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldHistory/Iteration.lean @@ -0,0 +1,147 @@ +import OAI.LinearAlgebra.MatrixMultiplication.FieldHistory.Tick + +namespace OAI + +/-! Finite extraction histories, inherited masks and recovery bounds. -/ + +noncomputable section + +namespace MatrixMultiplication.AllFieldHistoryIteration + +open MatrixMultiplication.Foundation AllFieldHistory AllFieldFiniteFamily +open scoped BigOperators Classical +attribute [local instance] Classical.propDecidable Classical.decEq + +section Presentation + +variable {F : Type*} [Field F] {SX SY SZ X Y Z : Type} + [Fintype SX] [Fintype SY] [Fintype SZ] + {source : Tensor F SX SY SZ} {target next : Tensor F X Y Z} + +private def retarget (E : Execution source target) (h : target = next) : + Execution source next where + Copies := E.Copies + copies_positive := E.copies_positive + map := { + x := E.map.x + y := E.map.y + z := E.map.z + coefficient := E.map.coefficient.trans h + } + +@[simp] private theorem retarget_copies (E : Execution source target) (h : target = next) : + Fintype.card (retarget E h).Copies = Fintype.card E.Copies := rfl + +end Presentation + +variable {K : ℕ} (allocation : Allocation) (m : ℕ) (ε slack : ℝ) + +abbrev ScheduleChoices := ∀ t : Fin (K + 2), + AllFieldHistoryTick.Choices (K := K) (tick := t.val) allocation m ε slack + +def Labels (InitialTag : Type) + (chosen : ScheduleChoices (K := K) allocation m ε slack) : + (n : ℕ) → n ≤ K + 2 → Type + | 0, _ => InitialTag + | n + 1, hn => + Labels InitialTag chosen n (Nat.le_of_succ_le hn) × + AllFieldHistoryTick.Tags allocation m ε slack (chosen ⟨n, hn⟩) + +instance labelsFintype (InitialTag : Type) [Fintype InitialTag] + (chosen : ScheduleChoices (K := K) allocation m ε slack) : + (n : ℕ) → (hn : n ≤ K + 2) → + Fintype (Labels allocation m ε slack InitialTag chosen n hn) + | 0, _ => inferInstanceAs (Fintype InitialTag) + | n + 1, hn => by + let := labelsFintype InitialTag chosen n (Nat.le_of_succ_le hn) + exact inferInstanceAs (Fintype + (Labels allocation m ε slack InitialTag chosen n (Nat.le_of_succ_le hn) × + AllFieldHistoryTick.Tags allocation m ε slack (chosen ⟨n, hn⟩))) + +theorem card_labels (InitialTag : Type) [Fintype InitialTag] + (chosen : ScheduleChoices (K := K) allocation m ε slack) + (n : ℕ) (hn : n ≤ K + 2) : + Fintype.card (Labels allocation m ε slack InitialTag chosen n hn) = + Fintype.card InitialTag * ∏ t : Fin n, ∏ _sigma : Placement, + ⌊Real.exp ((m : ℝ) * + (AllFieldGroupSelection.nativeCapacity (K := K) (tick := t.val) allocation - slack))⌋₊ := by + induction n with + | zero => + change Fintype.card InitialTag = Fintype.card InitialTag * 1 + exact (Nat.mul_one _).symm + | succ n ih => + change Fintype.card + (Labels allocation m ε slack InitialTag chosen n (Nat.le_of_succ_le hn) × + AllFieldHistoryTick.Tags allocation m ε slack (chosen ⟨n, hn⟩)) = _ + rw [Fintype.card_prod, AllFieldHistoryTick.card_tags, ih, Fin.prod_univ_castSucc] + exact Nat.mul_assoc _ _ _ + +abbrev Tags (InitialTag : Type) + (chosen : ScheduleChoices (K := K) allocation m ε slack) := + Labels allocation m ε slack InitialTag chosen (K + 2) le_rfl + +theorem card_tags (InitialTag : Type) [Fintype InitialTag] + (chosen : ScheduleChoices (K := K) allocation m ε slack) : + Fintype.card (Tags allocation m ε slack InitialTag chosen) = + Fintype.card InitialTag * ∏ t : Fin (K + 2), ∏ _sigma : Placement, + ⌊Real.exp ((m : ℝ) * + (AllFieldGroupSelection.nativeCapacity (K := K) (tick := t.val) allocation - slack))⌋₊ := + card_labels allocation m ε slack InitialTag chosen (K + 2) le_rfl + +variable (F : Type*) [Field F] (hε : 0 < ε) + (hm : ∀ t : Fin (K + 2), + AllFieldHistoryRecovery.minimumDilation (K := K) (tick := t.val) allocation ε ≤ m) + (chosen : ScheduleChoices (K := K) allocation m ε slack) + {InitialTag : Type} [Fintype InitialTag] + (start : Execution (cwSource F K (populationLength (K := K) allocation m)) + (Tensor.directSum (fun _ : InitialTag => stateTensor F (K := K) allocation m ε 0))) + +def run : (n : ℕ) → (hn : n ≤ K + 2) → + Execution (cwSource F K (populationLength (K := K) allocation m)) + (Tensor.directSum (fun _ : Labels allocation m ε slack InitialTag chosen n hn => + stateTensor F (K := K) allocation m ε n)) + | 0, _ => start + | n + 1, hn => + let step := AllFieldHistoryTick.execution allocation m ε slack F hε + (hm ⟨n, hn⟩) (chosen ⟨n, hn⟩) + let operation := Execution.branchOperation + (stateTensor F (K := K) allocation m ε n) + (stateTensor F (K := K) allocation m ε (n + 1)) + (run n (Nat.le_of_succ_le hn)) step.copies_positive step.map + retarget operation (by + funext x y z + simp only [Tensor.directSum] + split_ifs <;> first | rfl | contradiction) + +theorem run_copies (n : ℕ) (hn : n ≤ K + 2) : + Fintype.card (run allocation m ε slack F hε hm chosen start n hn).Copies = + Fintype.card start.Copies * ∏ t : Fin n, + 2 ^ (3 * AllFieldHistoryRecovery.shiftCount (K := K) (tick := t.val) allocation ε m) := by + induction n with + | zero => + change Fintype.card start.Copies = Fintype.card start.Copies * 1 + exact (Nat.mul_one _).symm + | succ n ih => + rw [run] + erw [retarget_copies] + rw [Execution.branchOperation_copies, AllFieldHistoryTick.execution_copies, + ih, Fin.prod_univ_castSucc] + ring + +def execution : + Execution (cwSource F K (populationLength (K := K) allocation m)) + (Tensor.directSum (fun _ : Tags allocation m ε slack InitialTag chosen => + stateTensor F (K := K) allocation m ε (K + 2))) := + run allocation m ε slack F hε hm chosen start (K + 2) le_rfl + +@[simp] theorem execution_copies : + Fintype.card (execution allocation m ε slack F hε hm chosen start).Copies = + Fintype.card start.Copies * ∏ t : Fin (K + 2), + 2 ^ (3 * AllFieldHistoryRecovery.shiftCount (K := K) (tick := t.val) allocation ε m) := + run_copies allocation m ε slack F hε hm chosen start (K + 2) le_rfl + +end MatrixMultiplication.AllFieldHistoryIteration + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldHistory/MaskCore.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldHistory/MaskCore.lean new file mode 100644 index 0000000000000000000000000000000000000000..d47186b8786682db551f064aed3fa687b9ed2dd9 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldHistory/MaskCore.lean @@ -0,0 +1,113 @@ +import OAI.LinearAlgebra.MatrixMultiplication.FieldHistory.ChildLaws +import OAI.LinearAlgebra.MatrixMultiplication.FieldHistory.Support +import OAI.LinearAlgebra.MatrixMultiplication.Recovery.HistorySymmetry +import OAI.LinearAlgebra.MatrixMultiplication.Recovery.InheritedMaskAction + +namespace OAI + +/-! Finite extraction histories, inherited masks and recovery bounds. -/ + +noncomputable section + +namespace MatrixMultiplication.AllFieldHistoryMasks + +open AllFieldHistory AllFieldHistoryChildLaws AllFieldHistorySupport +open JointCanonicalization InheritedMasks PermutationMatching HistorySymmetry +open scoped BigOperators + +attribute [local instance] Classical.propDecidable Classical.decEq + +variable {K tick : ℕ} + +abbrev Classes (K tick : ℕ) := Active K tick × JointPopulation.Shape + +abbrev Positions (allocation : Allocation) (m : ℕ) (c : Classes K tick) := + Fin (activeCounts allocation m c.1 c.2) + +abbrev Letters (c : Classes K tick) := Fin (activeHalfLength c.1) → Fin 7 + +abbrev Words (allocation : Allocation) (m : ℕ) := + CompleteWordPair (Positions (K := K) (tick := tick) allocation m) Letters Letters + +noncomputable instance permutationsFintype (allocation : Allocation) (m : ℕ) : + Fintype (HalfClassPermutations (Positions (K := K) (tick := tick) allocation m)) := by + letI : DecidableEq (Classes K tick) := Classical.decEq _ + letI : ∀ c : Classes K tick, DecidableEq (Positions allocation m c) := + fun _ => Classical.decEq _ + letI : Fintype (Classes K tick) := inferInstance + letI : ∀ c : Classes K tick, Fintype (Equiv.Perm (Positions allocation m c)) := + fun c => Equiv.instFintype + letI : Fintype ((c : Classes K tick) → Equiv.Perm (Positions allocation m c)) := + Pi.instFintype + change Fintype (((c : Classes K tick) → Equiv.Perm (Positions allocation m c)) × + ((c : Classes K tick) → Equiv.Perm (Positions allocation m c))) + infer_instance + +abbrev SymbolChoice (K tick : ℕ) := ∀ h : Active K tick, Statistic h + +abbrev MaskIndex (K tick : ℕ) := Active K tick × SymbolChoice K tick × SymbolChoice K tick + +def testedClasses (allocation : Allocation) (i : MaskIndex K tick) : Finset (Classes K tick) := + positiveClasses allocation i.1 + +def pairWidth (ε : ℝ) (h : Active K tick) : ℝ := ε / 16 ^ h.val.1.stage.val + +def childWidth (ε : ℝ) (h : Active K tick) : ℝ := pairWidth ε h / 8 + +theorem pairWidth_pos {ε : ℝ} (hε : 0 < ε) (h : Active K tick) : + 0 < pairWidth ε h := by + unfold pairWidth + positivity + +theorem childWidth_pos {ε : ℝ} (hε : 0 < ε) (h : Active K tick) : + 0 < childWidth ε h := div_pos (pairWidth_pos hε h) (by norm_num) + +def classStatistic (c : Classes K tick) : Letters c → Statistic c.1 := statistic c.1 + +def leftSymbol (i : MaskIndex K tick) (c : Classes K tick) : Statistic c.1 := i.2.1 c.1 + +def rightSymbol (i : MaskIndex K tick) (c : Classes K tick) : Statistic c.1 := i.2.2 c.1 + +def leftProbability (side : Fin 3) (i : MaskIndex K tick) (c : Classes K tick) : ℝ := + leftLaw c.1 c.2 side (leftSymbol i c) + +def rightProbability (side : Fin 3) (i : MaskIndex K tick) (c : Classes K tick) : ℝ := + rightLaw c.1 c.2 side (rightSymbol i c) + +def center (allocation : Allocation) (side : Fin 3) (i : MaskIndex K tick) : ℝ := + classProductMixture (fun c : testedClasses allocation i => Positions allocation 1 c.val) + (fun c => leftProbability side i c.val) (fun c => rightProbability side i c.val) + +def passes (allocation : Allocation) (m : ℕ) (ε : ℝ) (side : Fin 3) + (w : Words (K := K) (tick := tick) allocation m) : Prop := + ∀ i : MaskIndex K tick, ¬ selectedWordPairMaskBad (testedClasses allocation i) + classStatistic classStatistic (leftSymbol i) (rightSymbol i) + (pairWidth ε i.1) (center allocation side i) w + +def childWindows (allocation : Allocation) (m : ℕ) (ε : ℝ) (side : Fin 3) + (w : Words (K := K) (tick := tick) allocation m) : Prop := + HistorySymmetry.childWindows classStatistic classStatistic + (activeLaw (activeCounts allocation m) (fun c => leftLaw c.1 c.2 side)) + (activeLaw (activeCounts allocation m) (fun c => rightLaw c.1 c.2 side)) + (activeWidth (activeCounts allocation m) (fun c => childWidth ε c.1)) + (activeWidth (activeCounts allocation m) (fun c => childWidth ε c.1)) w + +def lossConstant (allocation : Allocation) (ε : ℝ) : ℝ := + ∑ i : MaskIndex K tick, + 1 / (2 * selectedBasePopulation allocation (testedClasses allocation i) * + (pairWidth ε i.1) ^ 2) + +theorem lossConstant_nonneg (allocation : Allocation) (ε : ℝ) : + 0 ≤ lossConstant (K := K) (tick := tick) allocation ε := by + apply Finset.sum_nonneg + intro i _ + change 0 ≤ 1 / (2 * (selectedBaseCount allocation (testedClasses allocation i) : ℝ) * + (pairWidth ε i.1) ^ 2) + exact div_nonneg zero_le_one + (mul_nonneg (mul_nonneg (by norm_num) (Nat.cast_nonneg _)) (sq_nonneg _)) + +end MatrixMultiplication.AllFieldHistoryMasks + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldHistory/MaskLaws.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldHistory/MaskLaws.lean new file mode 100644 index 0000000000000000000000000000000000000000..c93b010a27f6301c6b022c6ecaeb460ef2e4350b --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldHistory/MaskLaws.lean @@ -0,0 +1,150 @@ +import OAI.LinearAlgebra.MatrixMultiplication.FieldHistory.MaskCore +import OAI.LinearAlgebra.MatrixMultiplication.FieldHistory.BranchWeights + +namespace OAI + +/-! Finite extraction histories, inherited masks and recovery bounds. -/ + +noncomputable section + +namespace MatrixMultiplication.AllFieldHistoryMaskLaws + +open AllFieldHistory AllFieldHistoryChildLaws AllFieldHistorySupport +open AllFieldHistoryMasks AllFieldHistoryBranchWeights AllFieldParameters +open PermutationMatching +open scoped BigOperators +attribute [local instance] Classical.propDecidable Classical.decEq + +variable {K tick : ℕ} + +def parentCenter (allocation : Allocation) (side : Fin 3) (h : Active K tick) + (a b : Statistic h) : ℝ := + ∑ u : JointPopulation.Shape, + (activeCounts allocation 1 h u : ℝ) / + population allocation 1 (h.val.1.source, h.val.2) * + (leftLaw h u side a * rightLaw h u side b) + +theorem center_eq_parentCenter (allocation : Allocation) (side : Fin 3) + (i : MaskIndex K tick) : + center allocation side i = parentCenter allocation side i.1 (i.2.1 i.1) (i.2.2 i.1) := by + have hw (c : testedClasses allocation i) : + classWeight (fun c : testedClasses allocation i => Positions allocation 1 c.val) c = + (activeCounts allocation 1 c.val.1 c.val.2 : ℝ) / + population allocation 1 (i.1.val.1.source, i.1.val.2) := by + rw [selected_classWeight_formula allocation (by decide : 0 < (1 : ℕ))] + simp only [selectedBasePopulation, testedClasses, positiveClasses_baseCount] + unfold center classProductMixture + simp_rw [hw] + let f : Classes K tick → ℝ := fun c => + (activeCounts allocation 1 c.1 c.2 : ℝ) / + population allocation 1 (i.1.val.1.source, i.1.val.2) * + (leftProbability side i c * rightProbability side i c) + change (∑ c : testedClasses allocation i, f c.val) = _ + rw [Finset.sum_coe_sort] + have hzero (c : Classes K tick) : + (if 0 < activeCounts allocation 1 c.1 c.2 then f c else 0) = f c := by + split_ifs with hc + · rfl + · have hz : activeCounts allocation 1 c.1 c.2 = 0 := Nat.eq_zero_of_not_pos hc + simp [f, hz] + simp only [testedClasses, positiveClasses, Finset.sum_filter, ite_and, hzero] + rw [Fintype.sum_prod_type, Fintype.sum_eq_single i.1] + · simp [f, parentCenter, leftProbability, rightProbability, leftSymbol, rightSymbol] + · intro h hh + apply Finset.sum_eq_zero + intro u _ + exact ite_eq_right hh + +def stageBActive (h : APositive K) (phi : Placement) + (ht : FiniteSchedule.lotTick (Work.stageB h).lot (Work.stageB h).stage = tick) : + Active K tick := ⟨(.stageB h, phi), ht⟩ + +theorem stageB_leftLaw_branch (h : APositive K) (phi : Placement) + (ht : FiniteSchedule.lotTick (Work.stageB h).lot (Work.stageB h).stage = tick) + (k : BSplit h) (side : Fin 3) (a : Fin 6) : + leftLaw (stageBActive h phi ht) (branchShape (.stageB h, phi) k) side a = + (littleLaw (aShape h.val) (bSplit ⟨h, k, false⟩) (phi.symm side) a : ℝ) := by + change (placedChildLawRat (.stageB h, phi) (branchShape (.stageB h, phi) k) + side false a : ℝ) = _ + rw [placedChildLawRat_branchShape (.stageB h, phi) k side false] + simp [Work.childLaw, Work.splitShape, halfShape] + +theorem stageB_rightLaw_branch (h : APositive K) (phi : Placement) + (ht : FiniteSchedule.lotTick (Work.stageB h).lot (Work.stageB h).stage = tick) + (k : BSplit h) (side : Fin 3) (b : Fin 6) : + rightLaw (stageBActive h phi ht) (branchShape (.stageB h, phi) k) side b = + (littleLaw (aShape h.val) (complement (aShape h.val) (bSplit ⟨h, k, false⟩)) + (phi.symm side) b : ℝ) := by + change (placedChildLawRat (.stageB h, phi) (branchShape (.stageB h, phi) k) + side true b : ℝ) = _ + rw [placedChildLawRat_branchShape (.stageB h, phi) k side true] + simp [Work.childLaw, Work.parentShape, Work.splitShape, halfShape] + +theorem stageB_sum_laws (h : APositive K) (side : Fin 3) (a b : Fin 6) : + (∑ k : BSplit h, + stageBLaw (aShape h.val) (bSplit ⟨h, k, false⟩) * + littleLaw (aShape h.val) (bSplit ⟨h, k, false⟩) side a * + littleLaw (aShape h.val) (complement (aShape h.val) (bSplit ⟨h, k, false⟩)) side b) = + halfLaw (aShape h.val) side (a, b) := by + rw [halfLaw_positive_parent _ h.property] + unfold positiveHalfLaw + change (∑ k : Fin (below (aShape h.val)).length, + stageBLaw (aShape h.val) (below (aShape h.val))[k.val] * + littleLaw (aShape h.val) (below (aShape h.val))[k.val] side a * + littleLaw (aShape h.val) (complement (aShape h.val) (below (aShape h.val))[k.val]) side b) = _ + exact Fin.sum_univ_fun_getElem (below (aShape h.val)) + (fun u => stageBLaw (aShape h.val) u * littleLaw (aShape h.val) u side a * + littleLaw (aShape h.val) (complement (aShape h.val) u) side b) + +theorem parentCenter_stageB (allocation : Allocation) (h : APositive K) (phi : Placement) + (ht : FiniteSchedule.lotTick (Work.stageB h).lot (Work.stageB h).stage = tick) + (side : Fin 3) (a b : Fin 6) : + parentCenter allocation side (stageBActive h phi ht) a b = + (halfLaw (aShape h.val) (phi.symm side) (a, b) : ℝ) := by + let w : PlacedWork K := (.stageB h, phi) + let f : JointPopulation.Shape → ℝ := fun u => + leftLaw (stageBActive h phi ht) u side a * rightLaw (stageBActive h phi ht) u side b + calc + parentCenter allocation side (stageBActive h phi ht) a b = + (∑ u, (jointCounts allocation 1 w u : ℝ) * f u) / + population allocation 1 (.afterA h.val, phi) := by + unfold parentCenter + rw [Finset.sum_div] + apply Finset.sum_congr rfl + intro u _ + dsimp only [activeCounts, stageBActive, w, f, Work.source] + ring + _ = (∑ k : BSplit h, (branchPopulation allocation 1 w k : ℝ) * f (branchShape w k)) / + population allocation 1 (.afterA h.val, phi) := by + rw [jointCounts, shapeCounts_weighted_sum] + rfl + _ = ∑ k : BSplit h, + (stageBLaw (aShape h.val) (bSplit ⟨h, k, false⟩) : ℝ) * + (littleLaw (aShape h.val) (bSplit ⟨h, k, false⟩) (phi.symm side) a : ℝ) * + (littleLaw (aShape h.val) (complement (aShape h.val) (bSplit ⟨h, k, false⟩)) + (phi.symm side) b : ℝ) := by + rw [Finset.sum_div] + apply Finset.sum_congr rfl + intro k _ + dsimp only [f, w] + rw [stageB_leftLaw_branch, stageB_rightLaw_branch] + rw [mul_div_right_comm, + stageB_branchWeight_real allocation (by decide : 0 < (1 : ℕ)) h k phi] + ring + _ = (halfLaw (aShape h.val) (phi.symm side) (a, b) : ℝ) := by + exact_mod_cast stageB_sum_laws h (phi.symm side) a b + +theorem center_stageB (allocation : Allocation) (h : APositive K) (phi : Placement) + (ht : FiniteSchedule.lotTick (Work.stageB h).lot (Work.stageB h).stage = tick) + (side : Fin 3) (a b : SymbolChoice K tick) : + center allocation side (stageBActive h phi ht, a, b) = + (halfLaw (aShape h.val) (phi.symm side) + (a (stageBActive h phi ht), b (stageBActive h phi ht)) : ℝ) := by + rw [center_eq_parentCenter] + exact parentCenter_stageB allocation h phi ht side _ _ + +end MatrixMultiplication.AllFieldHistoryMaskLaws + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldHistory/Masks.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldHistory/Masks.lean new file mode 100644 index 0000000000000000000000000000000000000000..82ff6a1bf85ac21b6b97fee4f03cefa7aef849ea --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldHistory/Masks.lean @@ -0,0 +1,161 @@ +import OAI.LinearAlgebra.MatrixMultiplication.FieldHistory.MaskCore +import OAI.LinearAlgebra.MatrixMultiplication.FieldHistory.ChildLaws +import OAI.LinearAlgebra.MatrixMultiplication.FieldHistory.Support +import OAI.LinearAlgebra.MatrixMultiplication.Recovery.HistorySymmetry +import OAI.LinearAlgebra.MatrixMultiplication.Recovery.InheritedMaskAction +import OAI.LinearAlgebra.MatrixMultiplication.Recovery.InheritedMaskOrbitFilter + +namespace OAI + +/-! Finite extraction histories, inherited masks and recovery bounds. -/ + +noncomputable section + +namespace MatrixMultiplication.AllFieldHistoryMasks + +open AllFieldHistory AllFieldHistoryChildLaws AllFieldHistorySupport +open JointCanonicalization InheritedMasks PermutationMatching HistorySymmetry +open scoped BigOperators + +attribute [local instance] Classical.propDecidable Classical.decEq + +variable {K tick : ℕ} + +theorem testedClasses_parent (allocation : Allocation) (i : MaskIndex K tick) + (c : Classes K tick) (hc : c ∈ testedClasses allocation i) : c.1 = i.1 := + (Finset.mem_filter.mp hc).2.1 + +theorem rightProbability_le_one (allocation : Allocation) (side : Fin 3) + (i : MaskIndex K tick) (c : Classes K tick) (hc : c ∈ testedClasses allocation i) : + rightProbability side i c ≤ 1 := by + have hsum := rightLaw_normalized allocation 1 c.1 c.2 + (positiveClasses_positive allocation i.1 c hc) side + rw [← hsum] + exact Finset.single_le_sum (fun a _ => rightLaw_nonnegative c.1 c.2 side a) + (Finset.mem_univ _) + +theorem left_density_le (allocation : Allocation) {m : ℕ} (hm : 0 < m) + (ε : ℝ) (side : Fin 3) (w : Words (K := K) (tick := tick) allocation m) + (hw : childWindows allocation m ε side w) (i : MaskIndex K tick) + (c : Classes K tick) (hc : c ∈ testedClasses allocation i) : + |classDensity (wordPairLeftPositions w classStatistic (leftSymbol i)) c - + leftProbability side i c| ≤ childWidth ε i.1 := by + have hp : 0 < activeCounts allocation m c.1 c.2 := + (activeCounts_pos_iff allocation hm c.1 c.2).2 + (positiveClasses_positive allocation i.1 c hc) + have ht := (hw c).1 (leftSymbol i c) + have hh := testedClasses_parent allocation i c hc + have ht' : |empiricalLaw (classStatistic c ∘ w.left c) (leftSymbol i c) - + leftProbability side i c| ≤ childWidth ε c.1 := by + simpa only [activeLaw, activeWidth, ite_eq_left hp, leftProbability] using ht + have hd := classDensity_statisticPositions w.left classStatistic (leftSymbol i) c + change classDensity (wordPairLeftPositions w classStatistic (leftSymbol i)) c = _ at hd + rw [hd] + exact ht'.trans_eq (congrArg (childWidth ε) hh) + +theorem right_density_le (allocation : Allocation) {m : ℕ} (hm : 0 < m) + (ε : ℝ) (side : Fin 3) (w : Words (K := K) (tick := tick) allocation m) + (hw : childWindows allocation m ε side w) (i : MaskIndex K tick) + (c : Classes K tick) (hc : c ∈ testedClasses allocation i) : + |classDensity (wordPairRightPositions w classStatistic (rightSymbol i)) c - + rightProbability side i c| ≤ childWidth ε i.1 := by + have hp : 0 < activeCounts allocation m c.1 c.2 := + (activeCounts_pos_iff allocation hm c.1 c.2).2 + (positiveClasses_positive allocation i.1 c hc) + have ht := (hw c).2 (rightSymbol i c) + have hh := testedClasses_parent allocation i c hc + have ht' : |empiricalLaw (classStatistic c ∘ w.right c) (rightSymbol i c) - + rightProbability side i c| ≤ childWidth ε c.1 := by + simpa only [activeLaw, activeWidth, ite_eq_left hp, rightProbability] using ht + have hd := classDensity_statisticPositions w.right classStatistic (rightSymbol i) c + change classDensity (wordPairRightPositions w classStatistic (rightSymbol i)) c = _ at hd + rw [hd] + exact ht'.trans_eq (congrArg (childWidth ε) hh) + +theorem mixture_error_zero (allocation : Allocation) {m : ℕ} (hm : 0 < m) + (side : Fin 3) (i : MaskIndex K tick) : + |classProductMixture (fun c : testedClasses allocation i => Positions allocation m c.val) + (fun c => leftProbability side i c.val) (fun c => rightProbability side i c.val) - + center allocation side i| ≤ (0 : ℝ) := by + rw [selected_classProductMixture_eq_one allocation hm] + simp only [center, sub_self, abs_zero, le_refl] + +theorem orbitSet_as_filter {G V : Type*} [Group G] [Fintype G] [MulAction G V] + [Fintype V] [DecidableEq V] (v : V) : + OrbitCounting.orbitSet (G := G) v = + Finset.univ.filter (fun w => ∃ g : G, g • v = w) := by + ext w + simp only [OrbitCounting.orbitSet, Finset.mem_image, Finset.mem_univ, + true_and, Finset.mem_filter] + +attribute [local irreducible] activeCounts + +theorem full_filter_loss_le (allocation : Allocation) {m : ℕ} (hm : 2 ≤ m) + {ε : ℝ} (hε : 0 < ε) (side : Fin 3) + (w : Words (K := K) (tick := tick) allocation m) + (hw : childWindows allocation m ε side w) : + ((rejectedFilter + (fullOrbitFilter (HalfClassPermutations (Positions (K := K) (tick := tick) allocation m)) w) + (fun v => ∃ i : MaskIndex K tick, + selectedWordPairMaskBad (testedClasses allocation i) classStatistic classStatistic + (leftSymbol i) (rightSymbol i) (pairWidth ε i.1) (center allocation side i) v)).card : ℝ) / + (fullOrbitFilter + (HalfClassPermutations (Positions (K := K) (tick := tick) allocation m)) w).card ≤ + lossConstant (K := K) (tick := tick) allocation ε / m := by + have hmpos : 0 < m := lt_of_lt_of_le (by decide : 0 < 2) hm + have hsize (i : MaskIndex K tick) : + populationSize (fun c : testedClasses allocation i => Positions allocation m c.val) = + selectedBasePopulation allocation (testedClasses allocation i) * m := + selected_populationSize allocation m (testedClasses allocation i) + have hn (i : MaskIndex K tick) (c : Classes K tick) + (hc : c ∈ testedClasses allocation i) : 2 ≤ Fintype.card (Positions allocation m c) := by + exact selected_two_le allocation hm (testedClasses allocation i) + (positiveClasses_positive allocation i.1) ⟨c, hc⟩ + have hmass (i : MaskIndex K tick) : + 0 < selectedBasePopulation allocation (testedClasses allocation i) := + positiveClasses_basePopulation_pos allocation i.1 + have hright0 (i : MaskIndex K tick) (c : Classes K tick) + (_hc : c ∈ testedClasses allocation i) : 0 ≤ rightProbability side i c := + rightLaw_nonnegative c.1 c.2 side _ + have h := finite_selectedWordPair_full_filter_inverse_linear_of_windows + (C := Classes K tick) (P := Positions (K := K) (tick := tick) allocation m) + (X := Letters) (Y := Letters) (I := MaskIndex K tick) + (SL := fun _ c => Statistic c.1) (SR := fun _ c => Statistic c.1) + (testedClasses allocation) w (fun _ => classStatistic) (fun _ => classStatistic) + leftSymbol rightSymbol hn + (fun i => selectedBasePopulation allocation (testedClasses allocation i)) (m : ℝ) + (by exact_mod_cast hmpos) hmass hsize + (leftProbability side) (rightProbability side) + (fun i => pairWidth ε i.1) (fun i => childWidth ε i.1) (fun _ => 0) + (center allocation side) (fun i => pairWidth_pos hε i.1) + hright0 (rightProbability_le_one allocation side) + (left_density_le allocation hmpos ε side w hw) + (right_density_le allocation hmpos ε side w hw) + (mixture_error_zero allocation hmpos side) (fun _ => le_rfl) + (fun i => (div_pos (pairWidth_pos hε i.1) (by norm_num : (0 : ℝ) < 4)).le) + simpa only [lossConstant] using h + +theorem orbit_loss_le (allocation : Allocation) {m : ℕ} (hm : 2 ≤ m) + {ε : ℝ} (hε : 0 < ε) (side : Fin 3) + (w : Words (K := K) (tick := tick) allocation m) + (hw : childWindows allocation m ε side w) : + (((OrbitCounting.orbitSet + (G := HalfClassPermutations (Positions (K := K) (tick := tick) allocation m)) w).filter + (fun v => ¬passes allocation m ε side v)).card : ℝ) / + (OrbitCounting.orbitSet + (G := HalfClassPermutations (Positions (K := K) (tick := tick) allocation m)) w).card ≤ + lossConstant (K := K) (tick := tick) allocation ε / m := by + have heq := orbit_bad_fraction_eq_fullOrbitFilter_of_iff + (G := HalfClassPermutations (Positions (K := K) (tick := tick) allocation m)) w + (fun v => ¬passes allocation m ε side v) + (fun v => ∃ i : MaskIndex K tick, + selectedWordPairMaskBad (testedClasses allocation i) classStatistic classStatistic + (leftSymbol i) (rightSymbol i) (pairWidth ε i.1) (center allocation side i) v) + (fun v => by simp only [passes, not_forall, not_not]) + exact heq.trans_le (full_filter_loss_le allocation hm hε side w hw) + +end MatrixMultiplication.AllFieldHistoryMasks + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldHistory/OrbitCount.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldHistory/OrbitCount.lean new file mode 100644 index 0000000000000000000000000000000000000000..833796d0c2d43083f3805bb396511d189a108e0e --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldHistory/OrbitCount.lean @@ -0,0 +1,138 @@ +import OAI.LinearAlgebra.MatrixMultiplication.FieldHistory.Support +import OAI.LinearAlgebra.MatrixMultiplication.Recovery.InheritedOrbitProfiles + +namespace OAI + +/-! Finite extraction histories, inherited masks and recovery bounds. -/ + +noncomputable section + +namespace MatrixMultiplication.AllFieldHistoryOrbitCount + +open AllFieldHistory AllFieldHistorySupport PermutationMatching +open scoped BigOperators +attribute [local instance] Classical.propDecidable Classical.decEq + +abbrev Classes (K tick : ℕ) := ActiveClass K tick + +abbrev Positions {K tick : ℕ} (allocation : Allocation) (m : ℕ) + (c : Classes K tick) := + JointCanonicalization.ClassPositions (activeCounts allocation m) c + +abbrev Letters {K tick : ℕ} (c : Classes K tick) := + Fin (activeHalfLength c.1) → Fin 7 + +abbrev ActualOrbit {K tick : ℕ} (allocation : Allocation) (m : ℕ) := + PairOrbit (Positions (K := K) (tick := tick) allocation m) + (Letters (K := K) (tick := tick)) (Letters (K := K) (tick := tick)) + +noncomputable instance actualOrbitFintype {K tick : ℕ} + (allocation : Allocation) (m : ℕ) : + Fintype (ActualOrbit (K := K) (tick := tick) allocation m) := by + haveI : Finite (ActualOrbit (K := K) (tick := tick) allocation m) := + Finite.of_injective pairOrbitProfile pairOrbitProfile_injective + exact Fintype.ofFinite _ + +def basePopulationBound {K tick : ℕ} (allocation : Allocation) : ℕ := + ∑ c : Classes K tick, activeCounts allocation 1 c.1 c.2 + +def orbitDegree (K tick : ℕ) : ℕ := + 2 * ∑ c : Classes K tick, 7 ^ activeHalfLength c.1 + +theorem card_letters {K tick : ℕ} (c : Classes K tick) : + Fintype.card (Letters c) = 7 ^ activeHalfLength c.1 := by + simp only [Letters, Fintype.card_fun, Fintype.card_fin] + +theorem class_card_le {K tick : ℕ} (allocation : Allocation) (m : ℕ) + (c : Classes K tick) : + Fintype.card (Positions allocation m c) ≤ + basePopulationBound (K := K) (tick := tick) allocation * m := by + have hc : activeCounts allocation 1 c.1 c.2 ≤ + basePopulationBound (K := K) (tick := tick) allocation := by + unfold basePopulationBound + exact Finset.single_le_sum + (fun (d : Classes K tick) _ => Nat.zero_le (activeCounts allocation 1 d.1 d.2)) + (Finset.mem_univ c) + simp only [Positions, JointCanonicalization.ClassPositions, Fintype.card_fin, + activeCounts_dilation allocation m] + simpa only [Nat.mul_comm] using Nat.mul_le_mul_left m hc + +theorem card_actualOrbit_le {K tick : ℕ} (allocation : Allocation) (m : ℕ) : + Nat.card (ActualOrbit (K := K) (tick := tick) allocation m) ≤ + (basePopulationBound (K := K) (tick := tick) allocation * m + 1) ^ + orbitDegree K tick := by + simpa only [ActualOrbit, orbitDegree, card_letters, two_mul] using + (card_pairOrbits_le_common_bound + (P := Positions (K := K) (tick := tick) allocation m) + (X := Letters (K := K) (tick := tick)) + (Y := Letters (K := K) (tick := tick)) + (basePopulationBound (K := K) (tick := tick) allocation * m) + (class_card_le allocation m)) + +theorem card_actualOrbit_le_polynomial {K tick : ℕ} + (allocation : Allocation) (m : ℕ) : + Nat.card (ActualOrbit (K := K) (tick := tick) allocation m) ≤ + (basePopulationBound (K := K) (tick := tick) allocation + 1) ^ orbitDegree K tick * + (m + 1) ^ orbitDegree K tick := by + refine (card_actualOrbit_le allocation m).trans ?_ + rw [← mul_pow] + apply Nat.pow_le_pow_left + nlinarith [Nat.zero_le (basePopulationBound (K := K) (tick := tick) allocation)] + +def orbitPrefactor {K tick : ℕ} (allocation : Allocation) : ℝ := + ((basePopulationBound (K := K) (tick := tick) allocation + 1 : ℕ) : ℝ) ^ + orbitDegree K tick + +theorem orbitPrefactor_pos {K tick : ℕ} (allocation : Allocation) : + 0 < orbitPrefactor (K := K) (tick := tick) allocation := by + unfold orbitPrefactor + positivity + +theorem card_actualOrbit_le_polynomial_real {K tick : ℕ} + (allocation : Allocation) (m : ℕ) : + (Nat.card (ActualOrbit (K := K) (tick := tick) allocation m) : ℝ) ≤ + orbitPrefactor (K := K) (tick := tick) allocation * + ((m : ℝ) + 1) ^ orbitDegree K tick := by + unfold orbitPrefactor + exact_mod_cast card_actualOrbit_le_polynomial (K := K) (tick := tick) allocation m + +theorem usedOrbits_card_le {K tick : ℕ} (allocation : Allocation) (m : ℕ) + (s : Finset (ActualOrbit (K := K) (tick := tick) allocation m)) : + s.card ≤ (basePopulationBound (K := K) (tick := tick) allocation + 1) ^ + orbitDegree K tick * (m + 1) ^ orbitDegree K tick := by + have hs : s.card ≤ Nat.card (ActualOrbit (K := K) (tick := tick) allocation m) := by + rw [Nat.card_eq_fintype_card] + exact s.card_le_univ + exact hs.trans (card_actualOrbit_le_polynomial allocation m) + +theorem usedOrbits_card_le_real {K tick : ℕ} (allocation : Allocation) (m : ℕ) + (s : Finset (ActualOrbit (K := K) (tick := tick) allocation m)) : + (s.card : ℝ) ≤ orbitPrefactor (K := K) (tick := tick) allocation * + ((m : ℝ) + 1) ^ orbitDegree K tick := by + unfold orbitPrefactor + exact_mod_cast usedOrbits_card_le allocation m s + +theorem taggedUsedOrbits_card_le_real {K tick : ℕ} (allocation : Allocation) (m : ℕ) + (s : Finset (Fin 3 × ActualOrbit (K := K) (tick := tick) allocation m)) : + (s.card : ℝ) ≤ (3 * orbitPrefactor (K := K) (tick := tick) allocation) * + ((m : ℝ) + 1) ^ orbitDegree K tick := by + have hs : s.card ≤ 3 * Nat.card + (ActualOrbit (K := K) (tick := tick) allocation m) := by + simpa only [Fintype.card_prod, Fintype.card_fin, Nat.card_eq_fintype_card] using + s.card_le_univ + have hsreal : (s.card : ℝ) ≤ 3 * (Nat.card + (ActualOrbit (K := K) (tick := tick) allocation m) : ℝ) := by + exact_mod_cast hs + calc + _ ≤ 3 * (Nat.card (ActualOrbit (K := K) (tick := tick) allocation m) : ℝ) := hsreal + _ ≤ 3 * (orbitPrefactor (K := K) (tick := tick) allocation * + ((m : ℝ) + 1) ^ orbitDegree K tick) := + mul_le_mul_of_nonneg_left (card_actualOrbit_le_polynomial_real allocation m) + (by norm_num) + _ = _ := (mul_assoc _ _ _).symm + +end MatrixMultiplication.AllFieldHistoryOrbitCount + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldHistory/Populations.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldHistory/Populations.lean new file mode 100644 index 0000000000000000000000000000000000000000..8c4e36e80e8fb7de234c042b9d117a4d8207c8d7 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldHistory/Populations.lean @@ -0,0 +1,294 @@ +import OAI.LinearAlgebra.MatrixMultiplication.FieldConstruction.StageCLaw +import OAI.LinearAlgebra.MatrixMultiplication.FieldConstruction.PopulationCounts +import OAI.LinearAlgebra.MatrixMultiplication.JointExtraction.Population +import OAI.LinearAlgebra.MatrixMultiplication.Recovery.FiniteSchedule +import OAI.LinearAlgebra.MatrixMultiplication.Recovery.PhysicalOrders +import Mathlib.Data.Fintype.Sigma +import Mathlib.Data.Fintype.Sum +import Mathlib.Data.Fintype.Sets + +namespace OAI + +/-! Finite extraction histories, inherited masks and recovery bounds. -/ + +noncomputable section + +namespace MatrixMultiplication.AllFieldHistory + +open AllFieldParameters +open scoped BigOperators +attribute [local instance] Classical.propDecidable Classical.decEq + +structure Allocation where + mass : Fin 3 → ℚ + positive : ∀ i, 0 < mass i + total : ∑ i, mass i = 1 + +abbrev Placement := PhysicalOrders.PhysicalOrder +abbrev Initial (K : ℕ) := Fin K × Fin sortedInitial.length + +def initialShape {K : ℕ} (h : Initial K) : Shape := sortedInitial.get h.2 + +theorem initialShape_mem {K : ℕ} (h : Initial K) : initialShape h ∈ sortedInitial := + List.get_mem _ _ + +abbrev InitialPositive (K : ℕ) := {h : Initial K // initialShape h ∈ positiveInitial} + +abbrev ASplit {K : ℕ} (h : InitialPositive K) := Fin (below (initialShape h.val)).length +abbrev AfterA (K : ℕ) := Σ h : InitialPositive K, ASplit h × Bool + +def aSplit {K : ℕ} (h : AfterA K) : Shape := + (below (initialShape h.1.val)).get h.2.1 + +def halfShape (parent left : Shape) (right : Bool) : Shape := + if right then complement parent left else left + +def aShape {K : ℕ} (h : AfterA K) : Shape := + halfShape (initialShape h.1.val) (aSplit h) h.2.2 + +theorem aSplit_mem {K : ℕ} (h : AfterA K) : aSplit h ∈ below (initialShape h.1.val) := + List.get_mem _ _ + +theorem aShape_mem {K : ℕ} (h : AfterA K) : aShape h ∈ below (initialShape h.1.val) := by + have hc := (stageA_support_complement _ h.1.property _ (aSplit_mem h)).1 + cases hh : h.2.2 <;> simp [aShape, halfShape, hh, aSplit_mem h, hc] + +theorem stageA_children_size : ∀ g ∈ positiveInitial, ∀ t ∈ below g, t ∈ shapes 8 := by + decide +kernel + +theorem aShape_size {K : ℕ} (h : AfterA K) : aShape h ∈ shapes 8 := + stageA_children_size _ h.1.property _ (aShape_mem h) + +abbrev APositive (K : ℕ) := {h : AfterA K // aShape h ∈ positiveSecond} +abbrev BSplit {K : ℕ} (h : APositive K) := Fin (below (aShape h.val)).length +abbrev AfterB (K : ℕ) := Σ h : APositive K, BSplit h × Bool + +def bSplit {K : ℕ} (h : AfterB K) : Shape := + (below (aShape h.1.val)).get h.2.1 + +def bShape {K : ℕ} (h : AfterB K) : Shape := + halfShape (aShape h.1.val) (bSplit h) h.2.2 + +theorem bSplit_mem {K : ℕ} (h : AfterB K) : bSplit h ∈ below (aShape h.1.val) := + List.get_mem _ _ + +theorem bShape_mem {K : ℕ} (h : AfterB K) : bShape h ∈ below (aShape h.1.val) := by + have hc := (stageB_support_complement _ h.1.property _ (bSplit_mem h)).1 + cases hh : h.2.2 <;> simp [bShape, halfShape, hh, bSplit_mem h, hc] + +theorem stageB_children_size : ∀ t ∈ positiveSecond, ∀ u ∈ below t, u ∈ shapes 4 := by + decide +kernel + +theorem bShape_size {K : ℕ} (h : AfterB K) : bShape h ∈ shapes 4 := + stageB_children_size _ h.1.property _ (bShape_mem h) + +abbrev BPositive (K : ℕ) := {h : AfterB K // positive (bShape h) = true} +abbrev PartC (K : ℕ) := BPositive K × Fin 3 +abbrev AfterC (K : ℕ) := PartC K × Fin 4 × Bool + +def cParameterParent {K : ℕ} (h : PartC K) : Shape := aShape h.1.val.1.val +def cShapeParent {K : ℕ} (h : PartC K) : Shape := bShape h.1.val + +def cSplit {K : ℕ} (h : AfterC K) : Shape := stageCAtom (cShapeParent h.1) h.2.1 + +def cShape {K : ℕ} (h : AfterC K) : Shape := + halfShape (cShapeParent h.1) (cSplit h) h.2.2 + +theorem cShape_zero {K : ℕ} (h : AfterC K) : ∃ i, cShape h i = 0 := by + have hg := stageC_children_geometry (cShapeParent h.1) + (bShape_size h.1.1.val) h.1.1.property (cSplit h) + (stageCAtom_mem _ (bShape_size h.1.1.val) h.1.1.property h.2.1) + cases hh : h.2.2 with + | false => simpa [cShape, halfShape, hh] using hg.2.2.1 + | true => simpa [cShape, halfShape, hh] using hg.2.2.2 + +instance initialPositiveFintype (K : ℕ) : Fintype (InitialPositive K) := + Fintype.ofFinite _ + +instance aPositiveFintype (K : ℕ) : Fintype (APositive K) := + Fintype.ofFinite _ + +instance bPositiveFintype (K : ℕ) : Fintype (BPositive K) := + Fintype.ofFinite _ + +inductive CanonicalHistory (K : ℕ) where + | initial (h : Initial K) + | afterA (h : AfterA K) + | afterB (h : AfterB K) + | partC (h : PartC K) + | afterC (h : AfterC K) + deriving Fintype + +abbrev History (K : ℕ) := CanonicalHistory K × Placement + +def initialAmount {K : ℕ} (h : Initial K) : ℚ := initialLaw (initialShape h) +def aAmount {K : ℕ} (h : AfterA K) : ℚ := + initialAmount h.1.val * stageALaw (initialShape h.1.val) (aSplit h) +def bAmount {K : ℕ} (h : AfterB K) : ℚ := + aAmount h.1.val * stageBLaw (aShape h.1.val) (bSplit h) +def partAmount {K : ℕ} (allocation : Allocation) (h : PartC K) : ℚ := + bAmount h.1.val * allocation.mass h.2 +def cAmount {K : ℕ} (allocation : Allocation) (h : AfterC K) : ℚ := + partAmount allocation h.1 * stageCWeight (cParameterParent h.1) (cShapeParent h.1) h.2.1 + +def canonicalAmount {K : ℕ} (allocation : Allocation) : CanonicalHistory K → ℚ + | .initial h => initialAmount h + | .afterA h => aAmount h + | .afterB h => bAmount h + | .partC h => partAmount allocation h + | .afterC h => cAmount allocation h + +def amount {K : ℕ} (allocation : Allocation) (h : History K) : ℚ := + canonicalAmount allocation h.1 / 6 + +theorem initialAmount_pos {K : ℕ} (h : Initial K) : 0 < initialAmount h := + initialLaw_positive _ (initialShape_mem h) + +theorem aAmount_pos {K : ℕ} (h : AfterA K) : 0 < aAmount h := + mul_pos (initialAmount_pos _) (stageALaw_positive _ _ (aSplit_mem h)) + +theorem bAmount_pos {K : ℕ} (h : AfterB K) : 0 < bAmount h := + mul_pos (aAmount_pos _) (stageBLaw_positive _ _ (bSplit_mem h)) + +theorem partAmount_pos {K : ℕ} (allocation : Allocation) (h : PartC K) : + 0 < partAmount allocation h := mul_pos (bAmount_pos _) (allocation.positive _) + +theorem cAmount_nonneg {K : ℕ} (allocation : Allocation) (h : AfterC K) : + 0 ≤ cAmount allocation h := + mul_nonneg (partAmount_pos allocation _).le (stageCWeight_nonnegative _ _ _) + +theorem amount_nonneg {K : ℕ} (allocation : Allocation) (h : History K) : + 0 ≤ amount allocation h := by + apply div_nonneg _ (by norm_num) + cases h.1 with + | initial h => exact (initialAmount_pos h).le + | afterA h => exact (aAmount_pos h).le + | afterB h => exact (bAmount_pos h).le + | partC h => exact (partAmount_pos allocation h).le + | afterC h => exact cAmount_nonneg allocation h + +theorem placement_amount_eq {K : ℕ} (allocation : Allocation) + (h : CanonicalHistory K) (phi psi : Placement) : + amount allocation (h, phi) = amount allocation (h, psi) := rfl + +theorem sum_placement_amount {K : ℕ} (allocation : Allocation) (h : CanonicalHistory K) : + ∑ phi : Placement, amount allocation (h, phi) = canonicalAmount allocation h := by + simp only [amount, Finset.sum_const, Finset.card_univ, + PhysicalOrders.card_physical_orders, nsmul_eq_mul] + norm_num + ring + +theorem initial_amount_sum (K : ℕ) (j : Fin K) : + ∑ g : Fin sortedInitial.length, initialAmount (j, g) = 1 := by + change (∑ g : Fin sortedInitial.length, initialLaw sortedInitial[g.val]) = 1 + rw [Fin.sum_univ_fun_getElem] + exact initialLaw_normalized + +theorem root_mass_sum_lot {K : ℕ} (allocation : Allocation) (j : Fin K) : + (∑ g : Fin sortedInitial.length, ∑ phi : Placement, + amount allocation (.initial (j, g), phi)) = 1 := by + simp only [sum_placement_amount, canonicalAmount] + exact initial_amount_sum K j + +theorem a_transition {K : ℕ} (h : InitialPositive K) (right : Bool) : + ∑ k : ASplit h, aAmount ⟨h, k, right⟩ = initialAmount h.val := by + change (∑ k : ASplit h, initialAmount h.val * + stageALaw (initialShape h.val) (below (initialShape h.val))[k.val]) = _ + rw [← Finset.mul_sum, Fin.sum_univ_fun_getElem, + stageALaw_normalized _ h.property, mul_one] + +theorem b_transition {K : ℕ} (h : APositive K) (right : Bool) : + ∑ k : BSplit h, bAmount ⟨h, k, right⟩ = aAmount h.val := by + change (∑ k : BSplit h, aAmount h.val * + stageBLaw (aShape h.val) (below (aShape h.val))[k.val]) = _ + rw [← Finset.mul_sum, Fin.sum_univ_fun_getElem, + stageBLaw_normalized _ h.property, mul_one] + +theorem part_transition {K : ℕ} (allocation : Allocation) (h : BPositive K) : + ∑ i : Fin 3, partAmount allocation (h, i) = bAmount h.val := by + simp only [partAmount, ← Finset.mul_sum, allocation.total, mul_one] + +theorem c_transition {K : ℕ} (allocation : Allocation) (h : PartC K) (right : Bool) : + ∑ k : Fin 4, cAmount allocation (h, k, right) = partAmount allocation h := by + simp only [cAmount, ← Finset.mul_sum, stageCWeight_normalized, mul_one] + +def population {K : ℕ} (allocation : Allocation) (dilation : ℕ) : History K → ℕ := + AllFieldPopulationCounts.count (amount allocation) dilation + +def populationLength {K : ℕ} (allocation : Allocation) (dilation : ℕ) : ℕ := + AllFieldPopulationCounts.blockLength (amount (K := K) allocation) dilation + +theorem population_cast {K : ℕ} (allocation : Allocation) (dilation : ℕ) (h : History K) : + (population allocation dilation h : ℚ) = + (populationLength (K := K) allocation dilation : ℚ) * amount allocation h := + AllFieldPopulationCounts.count_cast_blockLength _ (amount_nonneg allocation) dilation h + +theorem population_zero_iff {K : ℕ} (allocation : Allocation) {dilation : ℕ} + (hd : 0 < dilation) (h : History K) : + population allocation dilation h = 0 ↔ amount allocation h = 0 := + AllFieldPopulationCounts.count_zero_iff _ (amount_nonneg allocation) hd h + +theorem initial_population_sum {K : ℕ} (allocation : Allocation) (dilation : ℕ) + (j : Fin K) : + (∑ g : Fin sortedInitial.length, ∑ phi : Placement, + population allocation dilation (.initial (j, g), phi)) = + populationLength (K := K) allocation dilation := by + apply Nat.cast_injective (R := ℚ) + simp only [Nat.cast_sum, population_cast, ← Finset.mul_sum, + root_mass_sum_lot allocation j, mul_one] + +theorem a_population_transition {K : ℕ} (allocation : Allocation) (dilation : ℕ) + (h : InitialPositive K) (right : Bool) (phi : Placement) : + (∑ k : ASplit h, population allocation dilation (.afterA ⟨h, k, right⟩, phi)) = + population allocation dilation (.initial h.val, phi) := by + apply Nat.cast_injective (R := ℚ) + simp only [Nat.cast_sum, population_cast, amount, canonicalAmount, + ← Finset.mul_sum, ← Finset.sum_div, a_transition] + +theorem b_population_transition {K : ℕ} (allocation : Allocation) (dilation : ℕ) + (h : APositive K) (right : Bool) (phi : Placement) : + (∑ k : BSplit h, population allocation dilation (.afterB ⟨h, k, right⟩, phi)) = + population allocation dilation (.afterA h.val, phi) := by + apply Nat.cast_injective (R := ℚ) + simp only [Nat.cast_sum, population_cast, amount, canonicalAmount, + ← Finset.mul_sum, ← Finset.sum_div, b_transition] + +theorem part_population_transition {K : ℕ} (allocation : Allocation) (dilation : ℕ) + (h : BPositive K) (phi : Placement) : + (∑ i : Fin 3, population allocation dilation (.partC (h, i), phi)) = + population allocation dilation (.afterB h.val, phi) := by + apply Nat.cast_injective (R := ℚ) + simp only [Nat.cast_sum, population_cast, amount, canonicalAmount, + ← Finset.mul_sum, ← Finset.sum_div, part_transition] + +theorem c_population_transition {K : ℕ} (allocation : Allocation) (dilation : ℕ) + (h : PartC K) (right : Bool) (phi : Placement) : + (∑ k : Fin 4, population allocation dilation (.afterC (h, k, right), phi)) = + population allocation dilation (.partC h, phi) := by + apply Nat.cast_injective (R := ℚ) + simp only [Nat.cast_sum, population_cast, amount, canonicalAmount, + ← Finset.mul_sum, ← Finset.sum_div, c_transition] + +theorem a_half_counts_eq {K : ℕ} (allocation : Allocation) (dilation : ℕ) + (h : InitialPositive K) (k : ASplit h) (phi : Placement) : + population allocation dilation (.afterA ⟨h, k, false⟩, phi) = + population allocation dilation (.afterA ⟨h, k, true⟩, phi) := + AllFieldPopulationCounts.count_eq_of_mass_eq _ (amount_nonneg allocation) dilation rfl + +theorem b_half_counts_eq {K : ℕ} (allocation : Allocation) (dilation : ℕ) + (h : APositive K) (k : BSplit h) (phi : Placement) : + population allocation dilation (.afterB ⟨h, k, false⟩, phi) = + population allocation dilation (.afterB ⟨h, k, true⟩, phi) := + AllFieldPopulationCounts.count_eq_of_mass_eq _ (amount_nonneg allocation) dilation rfl + +theorem c_half_counts_eq {K : ℕ} (allocation : Allocation) (dilation : ℕ) + (h : PartC K) (k : Fin 4) (phi : Placement) : + population allocation dilation (.afterC (h, k, false), phi) = + population allocation dilation (.afterC (h, k, true), phi) := + AllFieldPopulationCounts.count_eq_of_mass_eq _ (amount_nonneg allocation) dilation rfl + +end MatrixMultiplication.AllFieldHistory + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldHistory/Positions.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldHistory/Positions.lean new file mode 100644 index 0000000000000000000000000000000000000000..6294f510848a68cdc99d47cfe3f93d6b75c5fab1 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldHistory/Positions.lean @@ -0,0 +1,182 @@ +import OAI.LinearAlgebra.MatrixMultiplication.FieldHistory.Geometry + +namespace OAI + +/-! Finite extraction histories, inherited masks and recovery bounds. -/ + +noncomputable section +namespace MatrixMultiplication.AllFieldHistory + +open AllFieldParameters +attribute [local instance] Classical.propDecidable Classical.decEq + +abbrev ProducedPositions {K tick : ℕ} (allocation : Allocation) (dilation : ℕ) := + Σ h : Produced K tick, Fin (population allocation dilation h.val) + +abbrev SplitPositions {K tick : ℕ} (allocation : Allocation) (dilation : ℕ) := + Σ w : Active K tick, Σ b : w.val.1.Branch, + Bool × Fin (branchPopulation allocation dilation w.val b) + +def halfPosition {K : ℕ} (allocation : Allocation) (dilation : ℕ) + (w : PlacedWork K) (b : w.1.Branch) (right : Bool) + (i : Fin (branchPopulation allocation dilation w b)) : + Fin (population allocation dilation (w.1.child b right, w.2)) := + ⟨i.val, by rw [branchPopulation_half]; exact i.isLt⟩ + +def unhalfPosition {K : ℕ} (allocation : Allocation) (dilation : ℕ) + (w : PlacedWork K) (b : w.1.Branch) (right : Bool) + (i : Fin (population allocation dilation (w.1.child b right, w.2))) : + Fin (branchPopulation allocation dilation w b) := + ⟨i.val, by rw [← branchPopulation_half allocation dilation w b right]; exact i.isLt⟩ + +@[simp] theorem unhalf_halfPosition {K : ℕ} (allocation : Allocation) (dilation : ℕ) + (w : PlacedWork K) (b : w.1.Branch) (right : Bool) + (i : Fin (branchPopulation allocation dilation w b)) : + unhalfPosition allocation dilation w b right (halfPosition allocation dilation w b right i) = i := rfl + +@[simp] theorem half_unhalfPosition {K : ℕ} (allocation : Allocation) (dilation : ℕ) + (w : PlacedWork K) (b : w.1.Branch) (right : Bool) + (i : Fin (population allocation dilation (w.1.child b right, w.2))) : + halfPosition allocation dilation w b right (unhalfPosition allocation dilation w b right i) = i := rfl + +def splitToProduced {K tick : ℕ} (allocation : Allocation) (dilation : ℕ) : + SplitPositions (K := K) (tick := tick) allocation dilation → + ProducedPositions (K := K) (tick := tick) allocation dilation := by + rintro ⟨⟨⟨w, phi⟩, hw⟩, b, right, i⟩ + cases w with + | stageA h => + exact ⟨⟨(.afterA ⟨h, b, right⟩, phi), hw.symm⟩, + halfPosition allocation dilation (.stageA h, phi) b right i⟩ + | stageB h => + let child : AfterB K := ⟨h, b, right⟩ + let j := halfPosition allocation dilation (.stageB h, phi) b right i + by_cases hp : positive (bShape child) = true + · let part := bSubdivisionPositionEquiv allocation dilation ⟨child, hp⟩ phi j + exact ⟨⟨(.partC (⟨child, hp⟩, part.1), phi), hw.symm⟩, part.2⟩ + · exact ⟨⟨(.afterB child, phi), hw.symm, hp⟩, j⟩ + | stageC h => + exact ⟨⟨(.afterC (h, b, right), phi), hw.symm⟩, + halfPosition allocation dilation (.stageC h, phi) b right i⟩ + +def producedToSplit {K tick : ℕ} (allocation : Allocation) (dilation : ℕ) : + ProducedPositions (K := K) (tick := tick) allocation dilation → + SplitPositions (K := K) (tick := tick) allocation dilation := by + rintro ⟨⟨⟨h, phi⟩, hp⟩, i⟩ + cases h with + | initial h => exact False.elim hp + | afterA h => + exact ⟨⟨(.stageA h.1, phi), hp.symm⟩, h.2.1, h.2.2, + unhalfPosition allocation dilation (.stageA h.1, phi) h.2.1 h.2.2 i⟩ + | afterB h => + exact ⟨⟨(.stageB h.1, phi), hp.1.symm⟩, h.2.1, h.2.2, + unhalfPosition allocation dilation (.stageB h.1, phi) h.2.1 h.2.2 i⟩ + | partC h => + let j := (bSubdivisionPositionEquiv allocation dilation h.1 phi).symm ⟨h.2, i⟩ + exact ⟨⟨(.stageB h.1.val.1, phi), hp.symm⟩, h.1.val.2.1, h.1.val.2.2, + unhalfPosition allocation dilation (.stageB h.1.val.1, phi) + h.1.val.2.1 h.1.val.2.2 j⟩ + | afterC h => + exact ⟨⟨(.stageC h.1, phi), hp.symm⟩, h.2.1, h.2.2, + unhalfPosition allocation dilation (.stageC h.1, phi) h.2.1 h.2.2 i⟩ + +theorem producedToSplit_splitToProduced {K tick : ℕ} (allocation : Allocation) (dilation : ℕ) + (p : SplitPositions (K := K) (tick := tick) allocation dilation) : + producedToSplit allocation dilation (splitToProduced allocation dilation p) = p := by + rcases p with ⟨⟨⟨w, phi⟩, hw⟩, b, right, i⟩ + cases w with + | stageA h => rfl + | stageB h => + by_cases hp : positive (bShape (⟨h, b, right⟩ : AfterB K)) = true + · dsimp only [splitToProduced] + rw [dite_eq_left hp] + dsimp only [producedToSplit] + simp only [Sigma.eta] + let lift : Fin (population allocation dilation + (.afterB ⟨h, b, right⟩, phi)) → + SplitPositions (K := K) (tick := tick) allocation dilation := + fun j => ⟨⟨(.stageB h, phi), hw⟩, b, right, + unhalfPosition allocation dilation (.stageB h, phi) b right j⟩ + exact congrArg lift ((bSubdivisionPositionEquiv allocation dilation + ⟨⟨h, b, right⟩, hp⟩ phi).symm_apply_apply + (halfPosition allocation dilation (.stageB h, phi) b right i)) + · dsimp only [splitToProduced] + rw [dite_eq_right hp] + rfl + | stageC h => rfl + +theorem splitToProduced_producedToSplit {K tick : ℕ} (allocation : Allocation) (dilation : ℕ) + (p : ProducedPositions (K := K) (tick := tick) allocation dilation) : + splitToProduced allocation dilation (producedToSplit allocation dilation p) = p := by + rcases p with ⟨⟨⟨h, phi⟩, hp⟩, i⟩ + cases h with + | initial h => exact False.elim hp + | afterA h => rfl + | afterB h => + rcases h with ⟨a, b, right⟩ + dsimp only [producedToSplit, splitToProduced] + rw [dite_eq_right hp.2] + rfl + | partC h => + rcases h with ⟨⟨⟨a, b, right⟩, hb⟩, part⟩ + dsimp only [producedToSplit, splitToProduced] + rw [dite_eq_left hb] + let lift : (Σ j : Fin 3, + Fin (population allocation dilation + (.partC (⟨⟨a, b, right⟩, hb⟩, j), phi))) → + ProducedPositions (K := K) (tick := tick) allocation dilation := + fun q => ⟨⟨(.partC (⟨⟨a, b, right⟩, hb⟩, q.1), phi), hp⟩, q.2⟩ + exact congrArg lift ((bSubdivisionPositionEquiv allocation dilation + ⟨⟨a, b, right⟩, hb⟩ phi).apply_symm_apply ⟨part, i⟩) + | afterC h => rfl + +def producedPositionEquiv {K tick : ℕ} (allocation : Allocation) (dilation : ℕ) : + ProducedPositions (K := K) (tick := tick) allocation dilation ≃ + SplitPositions (K := K) (tick := tick) allocation dilation where + toFun := producedToSplit allocation dilation + invFun := splitToProduced allocation dilation + left_inv := splitToProduced_producedToSplit allocation dilation + right_inv := producedToSplit_splitToProduced allocation dilation + +theorem producedPositionEquiv_parent {K tick : ℕ} (allocation : Allocation) (dilation : ℕ) + (p : ProducedPositions (K := K) (tick := tick) allocation dilation) : + (producedPositionEquiv allocation dilation p).1 = productionParent p.1 := by + rcases p with ⟨⟨⟨h, phi⟩, hp⟩, i⟩ + cases h with + | initial h => exact False.elim hp + | afterA h => rfl + | afterB h => rfl + | partC h => rfl + | afterC h => rfl + +theorem producedPositionEquiv_shape {K tick : ℕ} (allocation : Allocation) (dilation : ℕ) + (p : ProducedPositions (K := K) (tick := tick) allocation dilation) : + currentPhysicalShape p.1.val = + physicalShape (producedPositionEquiv allocation dilation p).1.val.2 + (halfShape (producedPositionEquiv allocation dilation p).1.val.1.parentShape + ((producedPositionEquiv allocation dilation p).1.val.1.splitShape + (producedPositionEquiv allocation dilation p).2.1) + (producedPositionEquiv allocation dilation p).2.2.1) := by + rcases p with ⟨⟨⟨h, phi⟩, hp⟩, i⟩ + cases h with + | initial h => exact False.elim hp + | afterA h => rfl + | afterB h => rfl + | partC h => rfl + | afterC h => rfl + +theorem producedPositionEquiv_length {K tick : ℕ} (allocation : Allocation) (dilation : ℕ) + (p : ProducedPositions (K := K) (tick := tick) allocation dilation) : + currentLength p.1.val.1 = (producedPositionEquiv allocation dilation p).1.val.1.halfLength := by + rcases p with ⟨⟨⟨h, phi⟩, hp⟩, i⟩ + cases h with + | initial h => exact False.elim hp + | afterA h => rfl + | afterB h => rfl + | partC h => rfl + | afterC h => rfl + +end MatrixMultiplication.AllFieldHistory + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldHistory/Priority.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldHistory/Priority.lean new file mode 100644 index 0000000000000000000000000000000000000000..b8055914e6b4b08ec432c903053d9c1bea02aafc --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldHistory/Priority.lean @@ -0,0 +1,193 @@ +import OAI.LinearAlgebra.MatrixMultiplication.FieldHistory.Schedule + +namespace OAI + +/-! Finite extraction histories, inherited masks and recovery bounds. -/ + +open scoped BigOperators + +noncomputable section + +namespace MatrixMultiplication.AllFieldHistory + +open AllFieldParameters + +def priorityPermutation (k : Fin 6) : Placement := + ![Equiv.refl (Fin 3), Equiv.swap 1 2, Equiv.swap 0 1, + (Equiv.swap 0 1).trans (Equiv.swap 0 2), + (Equiv.swap 0 2).trans (Equiv.swap 0 1), Equiv.swap 0 2] k + +def PriorityLexLE (rho sigma : Placement) : Prop := + rho 0 < sigma 0 ∨ rho 0 = sigma 0 ∧ + (rho 1 < sigma 1 ∨ rho 1 = sigma 1 ∧ rho 2 ≤ sigma 2) + +instance (rho sigma : Placement) : Decidable (PriorityLexLE rho sigma) := + inferInstanceAs (Decidable (rho 0 < sigma 0 ∨ rho 0 = sigma 0 ∧ + (rho 1 < sigma 1 ∨ rho 1 = sigma 1 ∧ rho 2 ≤ sigma 2))) + +theorem priorityPermutation_surjective : Function.Surjective priorityPermutation := by + decide +kernel + +theorem priorityPermutation_order : ∀ j k : Fin 6, + PriorityLexLE (priorityPermutation j) (priorityPermutation k) ↔ j ≤ k := by + decide +kernel + +def stageBRepresentatives : List Shape := + [shape 1 1 6, shape 1 2 5, shape 1 3 4, shape 2 2 4, shape 3 2 3] + +def readInPriority (t : Shape) (rho : Placement) : Shape := fun i => t (rho i) + +def stageBPriorityIndex (t : Shape) : Fin 6 := + ((List.finRange 6).find? fun k => + stageBRepresentatives.contains (readInPriority t (priorityPermutation k))).getD 0 + +def stageBPriority (t : Shape) : Placement := priorityPermutation (stageBPriorityIndex t) + +theorem stageBPriority_finite_spec : ∀ t ∈ positiveSecond, + stageBRepresentatives.contains (readInPriority t (stageBPriority t)) = true ∧ + ∀ k : Fin 6, + stageBRepresentatives.contains (readInPriority t (priorityPermutation k)) = true → + PriorityLexLE (stageBPriority t) (priorityPermutation k) := by + decide +kernel + +theorem stageBPriority_reads_representative (t : Shape) (ht : t ∈ positiveSecond) : + readInPriority t (stageBPriority t) ∈ stageBRepresentatives := by + simpa using (stageBPriority_finite_spec t ht).1 + +theorem stageBPriority_lex_first (t : Shape) (ht : t ∈ positiveSecond) + (rho : Placement) (hrho : readInPriority t rho ∈ stageBRepresentatives) : + PriorityLexLE (stageBPriority t) rho := by + obtain ⟨k, rfl⟩ := priorityPermutation_surjective rho + exact (stageBPriority_finite_spec t ht).2 k (by simpa using hrho) + +theorem stageBPriority_233 : + stageBPriority (shape 2 3 3) 0 = 1 ∧ + stageBPriority (shape 2 3 3) 1 = 0 ∧ + stageBPriority (shape 2 3 3) 2 = 2 := by + decide +kernel + +def cPriorityIndex : Fin 3 → Fin 3 → Fin 6 := + ![![0, 2, 3], ![2, 0, 1], ![4, 1, 0]] + +def stageCPriorityLabel (distinguished part : Fin 3) : Placement := + priorityPermutation (cPriorityIndex distinguished part) + +theorem stageCPriorityLabel_at_part : ∀ distinguished part : Fin 3, + stageCPriorityLabel distinguished part part = distinguished := by + decide +kernel + +theorem stageCPriorityLabel_remaining_order : ∀ distinguished part j k : Fin 3, + j ≠ part → k ≠ part → j < k → + stageCPriorityLabel distinguished part j < stageCPriorityLabel distinguished part k := by + decide +kernel + +def cPriority {K : ℕ} (h : PartC K) : Placement := + stageCPriorityLabel (stageCDistinguished (cShapeParent h)) h.2 + +theorem cPriority_at_part {K : ℕ} (h : PartC K) : + cPriority h h.2 = stageCDistinguished (cShapeParent h) := + stageCPriorityLabel_at_part _ _ + +theorem cPriority_at_part_two {K : ℕ} (h : PartC K) : + cShapeParent h (cPriority h h.2) = 2 := by + rw [cPriority_at_part] + exact (stageCDistinguished_spec (cShapeParent h) + (bShape_size h.1.val) h.1.property).1 + +theorem cPriority_remaining_order {K : ℕ} (h : PartC K) + (j k : Fin 3) (hj : j ≠ h.2) (hk : k ≠ h.2) (hjk : j < k) : + cPriority h j < cPriority h k := + stageCPriorityLabel_remaining_order _ _ _ _ hj hk hjk + +def Work.priority {K : ℕ} : Work K → Placement + | .stageA _ => Equiv.refl (Fin 3) + | .stageB h => stageBPriority (aShape h.val) + | .stageC h => cPriority h + +@[simp] theorem Work.priority_stageA {K : ℕ} (h : InitialPositive K) : + (Work.stageA h).priority = Equiv.refl (Fin 3) := rfl + +theorem Work.priority_stageB {K : ℕ} (h : APositive K) : + readInPriority (Work.stageB h).parentShape (Work.stageB h).priority ∈ + stageBRepresentatives := stageBPriority_reads_representative _ h.property + +theorem Work.priority_stageC {K : ℕ} (h : PartC K) : + (Work.stageC h).priority h.2 = stageCDistinguished (cShapeParent h) := + cPriority_at_part h + +def PlacedWork.physicalOrder {K : ℕ} (w : PlacedWork K) : Placement := + w.1.priority.trans w.2 + +theorem work_placement_for_order_unique {K : ℕ} (w : Work K) (sigma : Placement) : + ∃! phi : Placement, PlacedWork.physicalOrder (w, phi) = sigma := + Staggering.physical_order_unique w.priority sigma + +abbrev CanonicalActive (K tick : ℕ) := + {w : Work K // FiniteSchedule.lotTick w.lot w.stage = tick} + +abbrev ActiveOrder (K tick : ℕ) (sigma : Placement) := + {w : Active K tick // w.val.physicalOrder = sigma} + +def canonicalActiveEquivOrder (K tick : ℕ) (sigma : Placement) : + CanonicalActive K tick ≃ ActiveOrder K tick sigma where + toFun w := ⟨⟨(w.val, w.val.priority.symm.trans sigma), w.property⟩, by + change w.val.priority.trans (w.val.priority.symm.trans sigma) = sigma + ext i + simp⟩ + invFun w := ⟨w.val.val.1, w.val.property⟩ + left_inv _ := rfl + right_inv w := by + apply Subtype.ext + apply Subtype.ext + apply Prod.ext + · rfl + · have hw : w.val.val.1.priority.trans w.val.val.2 = sigma := w.property + apply Equiv.ext + intro i + have hh := Equiv.congr_fun hw (w.val.val.1.priority.symm i) + simpa using hh.symm + +def workAmount {K : ℕ} (allocation : Allocation) (w : Work K) : ℝ := + canonicalAmount allocation w.source + +def activeAggregateCapacity {K : ℕ} (allocation : Allocation) (tick : ℕ) + (capacity : Work K → Staggering.Capacity) : Staggering.Capacity := + PhysicalOrders.aggregateCapacity (fun w : CanonicalActive K tick => workAmount allocation w.val) + (fun w => capacity w.val) + +def physicalTickCapacity {K : ℕ} (allocation : Allocation) (tick : ℕ) + (capacity : Work K → Staggering.Capacity) (sigma : Placement) : Staggering.Capacity := + fun i => ∑ w : CanonicalActive K tick, ∑ phi : Placement, + if PlacedWork.physicalOrder (w.val, phi) = sigma then + (amount allocation (w.val.source, phi) : ℝ) * capacity w.val i else 0 + +theorem physicalTickCapacity_eq_partition {K : ℕ} (allocation : Allocation) (tick : ℕ) + (capacity : Work K → Staggering.Capacity) (sigma : Placement) : + physicalTickCapacity allocation tick capacity sigma = + PhysicalOrders.perPhysicalOrderCapacity + (fun w : CanonicalActive K tick => workAmount allocation w.val) + (fun w => capacity w.val) (fun w => w.val.priority) sigma := by + funext i + simp only [physicalTickCapacity, PhysicalOrders.perPhysicalOrderCapacity, + PlacedWork.physicalOrder, amount, workAmount, Rat.cast_div, Rat.cast_ofNat] + +theorem physicalTickCapacity_eq_sixth {K : ℕ} (allocation : Allocation) (tick : ℕ) + (capacity : Work K → Staggering.Capacity) (sigma : Placement) : + physicalTickCapacity allocation tick capacity sigma = + fun i => (1 / 6 : ℝ) * activeAggregateCapacity allocation tick capacity i := by + rw [physicalTickCapacity_eq_partition] + exact PhysicalOrders.perPhysicalOrderCapacity_eq _ _ _ _ + +theorem sum_physicalTick_minima {K : ℕ} (allocation : Allocation) (tick : ℕ) + (capacity : Work K → Staggering.Capacity) : + (∑ sigma : Placement, Staggering.minCapacity + (physicalTickCapacity allocation tick capacity sigma)) = + Staggering.minCapacity (activeAggregateCapacity allocation tick capacity) := by + simp_rw [physicalTickCapacity_eq_partition] + exact PhysicalOrders.sum_physical_order_minima _ _ _ + +end MatrixMultiplication.AllFieldHistory + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldHistory/Produced.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldHistory/Produced.lean new file mode 100644 index 0000000000000000000000000000000000000000..66dd68018f7a0e2feb2ad7878a626d222b482c54 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldHistory/Produced.lean @@ -0,0 +1,108 @@ +import OAI.LinearAlgebra.MatrixMultiplication.FieldHistory.ProducedBase +import OAI.LinearAlgebra.MatrixMultiplication.FieldHistory.ProducedMasks +import OAI.LinearAlgebra.MatrixMultiplication.FieldHistory.RecoveryCore +import OAI.LinearAlgebra.MatrixMultiplication.FieldHistory.Regrouping + +namespace OAI + +/-! Finite extraction histories, inherited masks and recovery bounds. -/ + +noncomputable section + +namespace MatrixMultiplication.AllFieldHistoryProduced + +open MatrixMultiplication.Foundation AllFieldHistory AllFieldFiniteFamily +open AllFieldHistoryProducedMasks +open scoped BigOperators Classical +attribute [local instance] Classical.propDecidable Classical.decEq + +variable {K tick : ℕ} (allocation : Allocation) (m : ℕ) + +def passes (ε : ℝ) (side : Fin 3) + (w : AllFieldHistory.ProducedWords (K := K) (tick := tick) allocation m) : Prop := + ∀ h : Produced K tick, residentMask allocation m ε h.val side (w h) + +theorem producedTensor_eq_delete (F : Type*) [Field F] (ε : ℝ) : + AllFieldHistoryRegrouping.producedTensor (K := K) (tick := tick) allocation m F ε = + ExactRecovery.delete (producedBase (F := F) (K := K) (tick := tick) allocation m) + (passes allocation m ε 0) (passes allocation m ε 1) (passes allocation m ε 2) := by + funext x y z + simp only [AllFieldHistoryRegrouping.producedTensor, CommonDimensions.familyProduct, + historyTensor, ExactRecovery.delete, Fintype.prod_ite_zero, + passes, forall_and, producedBase] + +theorem canonical_eq_delete (F : Type*) [Field F] (ε : ℝ) : + AllFieldHistoryRecovery.canonical F (K := K) (tick := tick) allocation m ε = + ExactRecovery.delete (canonicalChildren (F := F) (K := K) (tick := tick) allocation m) + (AllFieldHistoryMasks.childWindows allocation m ε 0) + (AllFieldHistoryMasks.childWindows allocation m ε 1) + (AllFieldHistoryMasks.childWindows allocation m ε 2) := by + have hb := JointCanonicalCW.canonicalBase_eq_children (F := F) + (activeCounts (K := K) (tick := tick) allocation m) + activeHalfLength activeHalfLength activeParentShape + AllFieldHistoryRecovery.halfLength_le_eight + (fun h u hu => jointCounts_support_le allocation m h.val u hu) + unfold AllFieldHistoryRecovery.canonical JointCanonicalization.canonicalIdeal + change ExactRecovery.delete + (JointCanonicalization.canonicalBase (activeCounts allocation m) + (JointCanonicalCW.Left activeHalfLength) (JointCanonicalCW.Right activeHalfLength) + (JointCanonicalCW.parentTensor activeHalfLength activeHalfLength activeParentShape) + (JointCanonicalCW.coarse activeHalfLength activeHalfLength + AllFieldHistoryRecovery.halfLength_le_eight)) + (AllFieldHistoryMasks.childWindows allocation m ε 0) + (AllFieldHistoryMasks.childWindows allocation m ε 1) + (AllFieldHistoryMasks.childWindows allocation m ε 2) = _ + rw [hb] + rfl + +def pulled (F : Type*) [Field F] (ε : ℝ) : + Tensor F (AllFieldHistory.ProducedWords (K := K) (tick := tick) allocation m) + (AllFieldHistory.ProducedWords (K := K) (tick := tick) allocation m) + (AllFieldHistory.ProducedWords (K := K) (tick := tick) allocation m) := + Tensor.pullback (regroupWords allocation m) (regroupWords allocation m) + (regroupWords allocation m) + (AllFieldHistoryRecovery.canonical F (K := K) (tick := tick) allocation m ε) + +theorem delete_pulled (F : Type*) [Field F] {ε : ℝ} (hε : 0 ≤ ε) : + ExactRecovery.delete (pulled (K := K) (tick := tick) allocation m F ε) + (passes allocation m ε 0) (passes allocation m ε 1) (passes allocation m ε 2) = + AllFieldHistoryRegrouping.producedTensor (K := K) (tick := tick) allocation m F ε := by + rw [producedTensor_eq_delete] + funext x y z + by_cases hp : passes allocation m ε 0 x ∧ passes allocation m ε 1 y ∧ + passes allocation m ε 2 z + · simp only [ExactRecovery.delete, ite_eq_left hp] + unfold pulled Tensor.pullback + rw [canonical_eq_delete] + have hx := childWindows_of_produced_masks allocation m hε 0 x hp.1 + have hy := childWindows_of_produced_masks allocation m hε 1 y hp.2.1 + have hz := childWindows_of_produced_masks allocation m hε 2 z hp.2.2 + unfold ExactRecovery.delete + rw [ite_eq_left ⟨hx, hy, hz⟩] + exact regroup_coefficient allocation m x y z + · simp only [ExactRecovery.delete, ite_eq_right hp] + +def pullbackMap (F : Type*) [Field F] (ε : ℝ) : + LocalMap (AllFieldHistoryRecovery.canonical F (K := K) (tick := tick) allocation m ε) + (pulled (K := K) (tick := tick) allocation m F ε) := by + apply LocalMap.ofExists + exact ⟨_, _, _, (Tensor.pullback_eq_restrict + (regroupWords (K := K) (tick := tick) allocation m) + (regroupWords (K := K) (tick := tick) allocation m) + (regroupWords (K := K) (tick := tick) allocation m) _).symm⟩ + +def map (F : Type*) [Field F] {ε : ℝ} (hε : 0 ≤ ε) : + LocalMap (AllFieldHistoryRecovery.canonical F (K := K) (tick := tick) allocation m ε) + (AllFieldHistoryRegrouping.producedTensor (K := K) (tick := tick) allocation m F ε) := by + let first := pullbackMap (K := K) (tick := tick) allocation m F ε + let last := LocalMap.delete (pulled (K := K) (tick := tick) allocation m F ε) + (passes allocation m ε 0) (passes allocation m ε 1) (passes allocation m ε 2) + let combined := first.comp last + exact ⟨combined.x, combined.y, combined.z, + combined.coefficient.trans (delete_pulled allocation m F hε)⟩ + +end MatrixMultiplication.AllFieldHistoryProduced + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldHistory/ProducedBase.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldHistory/ProducedBase.lean new file mode 100644 index 0000000000000000000000000000000000000000..9ebc00bdcf0be988634ca4c5ab90e8796ccf31cc --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldHistory/ProducedBase.lean @@ -0,0 +1,283 @@ +import OAI.LinearAlgebra.MatrixMultiplication.FieldHistory.Positions +import OAI.LinearAlgebra.MatrixMultiplication.JointExtraction.CanonicalCW +import OAI.LinearAlgebra.MatrixMultiplication.FieldConstruction.FiniteFamily + +namespace OAI + +/-! Finite extraction histories, inherited masks and recovery bounds. -/ + +noncomputable section +namespace MatrixMultiplication.AllFieldHistory + +open MatrixMultiplication.Foundation AllFieldParameters JointPopulation +open CWStrands HistorySymmetry InheritedMasks JointCanonicalization +open scoped BigOperators +attribute [local instance] Classical.propDecidable Classical.decEq + +variable {K tick : ℕ} (allocation : Allocation) (dilation : ℕ) + +abbrev CanonicalWords := CanonicalPairs (activeCounts (K := K) (tick := tick) allocation dilation) + (JointCanonicalCW.Left activeHalfLength) (JointCanonicalCW.Right activeHalfLength) + +abbrev ProducedWords := ∀ h : Produced K tick, + Fin (population allocation dilation h.val) → Fin (currentLength h.val.1) → Fin 7 + +abbrev CanonicalClassPosition := + Σ c : Active K tick × JointPopulation.Shape, Fin (activeCounts allocation dilation c.1 c.2) + +abbrev CanonicalHalfPosition := + CanonicalClassPosition (K := K) (tick := tick) allocation dilation × Bool + +def canonicalClassEquiv : CanonicalClassPosition (K := K) (tick := tick) allocation dilation ≃ + (Σ h : Active K tick, Σ u : JointPopulation.Shape, Fin (activeCounts allocation dilation h u)) where + toFun p := ⟨p.1.1, p.1.2, p.2⟩ + invFun p := ⟨(p.1, p.2.1), p.2.2⟩ + left_inv _ := rfl + right_inv _ := rfl + +def splitArrangeEquiv : + (Σ h : Active K tick, Σ b : h.val.1.Branch, + Fin (branchPopulation allocation dilation h.val b)) × Bool ≃ + SplitPositions (K := K) (tick := tick) allocation dilation where + toFun p := ⟨p.1.1, p.1.2.1, p.2, p.1.2.2⟩ + invFun p := (⟨p.1, p.2.1, p.2.2.2⟩, p.2.2.1) + left_inv _ := rfl + right_inv _ := rfl + +def canonicalSplitEquiv : + CanonicalHalfPosition (K := K) (tick := tick) allocation dilation ≃ + SplitPositions (K := K) (tick := tick) allocation dilation := + (Equiv.prodCongr + ((canonicalClassEquiv allocation dilation).trans + (Equiv.sigmaCongrRight fun h : Active K tick => + branchPositionEquiv allocation dilation h.val)) + (Equiv.refl Bool)).trans (splitArrangeEquiv allocation dilation) + +def canonicalProducedEquiv : + CanonicalHalfPosition (K := K) (tick := tick) allocation dilation ≃ + ProducedPositions (K := K) (tick := tick) allocation dilation := + (canonicalSplitEquiv allocation dilation).trans + (producedPositionEquiv allocation dilation).symm + +theorem splitProduced_length (p : SplitPositions (K := K) (tick := tick) allocation dilation) : + currentLength ((producedPositionEquiv allocation dilation).symm p).1.val.1 = + activeHalfLength p.1 := by + simpa only [Equiv.apply_symm_apply, activeHalfLength] using + producedPositionEquiv_length allocation dilation + ((producedPositionEquiv allocation dilation).symm p) + +def splitWord (x : ProducedWords (K := K) (tick := tick) allocation dilation) + (p : SplitPositions (K := K) (tick := tick) allocation dilation) : + Fin (activeHalfLength p.1) → Fin 7 := + let q := (producedPositionEquiv allocation dilation).symm p + fun i => x q.1 q.2 (Fin.cast (splitProduced_length allocation dilation p).symm i) + +def producedHalfWord (x : ProducedWords (K := K) (tick := tick) allocation dilation) + (h : Active K tick) (b : h.val.1.Branch) (right : Bool) : + Fin (branchPopulation allocation dilation h.val b) → Fin (activeHalfLength h) → Fin 7 := + fun i => splitWord allocation dilation x ⟨h, b, right, i⟩ + +def regroupAt (x : ProducedWords (K := K) (tick := tick) allocation dilation) + (p : CanonicalHalfPosition (K := K) (tick := tick) allocation dilation) : + Fin (activeHalfLength p.1.1.1) → Fin 7 := + splitWord allocation dilation x (canonicalSplitEquiv allocation dilation p) + +def regroupWords (x : ProducedWords (K := K) (tick := tick) allocation dilation) : + CanonicalWords (K := K) (tick := tick) allocation dilation where + left c i := regroupAt allocation dilation x (⟨c, i⟩, false) + right c i := regroupAt allocation dilation x (⟨c, i⟩, true) + +def branchClassEquiv (h : Active K tick) (b : h.val.1.Branch) : + Fin (branchPopulation allocation dilation h.val b) ≃ + Fin (activeCounts allocation dilation h (branchShape h.val b)) := + { toFun := fun i => ⟨i.val, by + change i.val < jointCounts allocation dilation h.val (branchShape h.val b) + rw [jointCounts_at] + exact i.isLt⟩ + invFun := fun i => ⟨i.val, by + simpa only [activeCounts, jointCounts_at] using i.isLt⟩ + left_inv := fun _ => rfl + right_inv := fun _ => rfl } + +def branchClassIndex (h : Active K tick) (b : h.val.1.Branch) + (i : Fin (branchPopulation allocation dilation h.val b)) : + Fin (activeCounts allocation dilation h (branchShape h.val b)) := + branchClassEquiv allocation dilation h b i + +theorem regroupWords_branch (x : ProducedWords (K := K) (tick := tick) allocation dilation) + (h : Active K tick) (b : h.val.1.Branch) (right : Bool) + (i : Fin (branchPopulation allocation dilation h.val b)) : + (if right then (regroupWords allocation dilation x).right + (h, branchShape h.val b) (branchClassIndex allocation dilation h b i) + else (regroupWords allocation dilation x).left + (h, branchShape h.val b) (branchClassIndex allocation dilation h b i)) = + producedHalfWord allocation dilation x h b right i := by + have he := (branchPositionEquiv allocation dilation h.val).apply_symm_apply ⟨b, i⟩ + cases right <;> simp only [Bool.false_eq_true, ↓reduceIte] + · exact congrArg (fun q : Σ b : h.val.1.Branch, + Fin (branchPopulation allocation dilation h.val b) => + producedHalfWord allocation dilation x h q.1 false q.2) he + · exact congrArg (fun q : Σ b : h.val.1.Branch, + Fin (branchPopulation allocation dilation h.val b) => + producedHalfWord allocation dilation x h q.1 true q.2) he + +def canonicalHalfShape + (p : CanonicalHalfPosition (K := K) (tick := tick) allocation dilation) : AllFieldParameters.Shape := + if p.2 then activeParentShape p.1.1.1 - JointCanonicalCW.shapeNat p.1.1.2 + else JointCanonicalCW.shapeNat p.1.1.2 + +theorem canonicalProduced_length + (p : CanonicalHalfPosition (K := K) (tick := tick) allocation dilation) : + currentLength (canonicalProducedEquiv allocation dilation p).1.val.1 = + activeHalfLength p.1.1.1 := + splitProduced_length allocation dilation (canonicalSplitEquiv allocation dilation p) + +theorem canonicalProduced_shape + (p : CanonicalHalfPosition (K := K) (tick := tick) allocation dilation) : + currentPhysicalShape (canonicalProducedEquiv allocation dilation p).1.val = + canonicalHalfShape allocation dilation p := by + let w := p.1.1.1 + let q := branchPositionEquiv allocation dilation w.val ⟨p.1.1.2, p.1.2⟩ + have hu : physicalShape w.val.2 (w.val.1.splitShape q.1) = + JointCanonicalCW.shapeNat p.1.1.2 := by + have hh := congrArg decodeShape + (branchPositionEquiv_shape allocation dilation w.val ⟨p.1.1.2, p.1.2⟩) + simp only [branchShape, decode_encodePhysicalShape] at hh + exact hh + let shapeOfSplit (r : SplitPositions (K := K) (tick := tick) allocation dilation) : + AllFieldParameters.Shape := + physicalShape r.1.val.2 (halfShape r.1.val.1.parentShape + (r.1.val.1.splitShape r.2.1) r.2.2.1) + have hs : currentPhysicalShape + ((producedPositionEquiv allocation dilation).symm + (canonicalSplitEquiv allocation dilation p)).1.val = + shapeOfSplit ((producedPositionEquiv allocation dilation) + ((producedPositionEquiv allocation dilation).symm + (canonicalSplitEquiv allocation dilation p))) := + producedPositionEquiv_shape allocation dilation + ((producedPositionEquiv allocation dilation).symm + (canonicalSplitEquiv allocation dilation p)) + rw [Equiv.apply_symm_apply] at hs + change currentPhysicalShape (canonicalProducedEquiv allocation dilation p).1.val = + physicalShape w.val.2 (halfShape w.val.1.parentShape + (w.val.1.splitShape q.1) p.2) at hs + rw [hs] + cases hr : p.2 <;> + simp [canonicalHalfShape, halfShape, hr, physicalShape_complement, hu, + activeParentShape] + rfl + +variable {F : Type*} [Field F] + +theorem shapeTensor_finCast {m n : ℕ} (h : m = n) (g : AllFieldParameters.Shape) + (x y z : Fin n → Fin 7) : + shapeTensor (F := F) (Fin m) g (x ∘ Fin.cast h) (y ∘ Fin.cast h) (z ∘ Fin.cast h) = + shapeTensor (Fin n) g x y z := by + cases h + rfl + +def canonicalChildren : Tensor F + (CanonicalWords (K := K) (tick := tick) allocation dilation) + (CanonicalWords (K := K) (tick := tick) allocation dilation) + (CanonicalWords (K := K) (tick := tick) allocation dilation) := + pairClassProduct (P := ClassPositions (activeCounts allocation dilation)) + (JointCanonicalCW.leftTensor activeHalfLength) + (JointCanonicalCW.rightTensor activeHalfLength activeParentShape) + +def producedBase : Tensor F + (ProducedWords (K := K) (tick := tick) allocation dilation) + (ProducedWords (K := K) (tick := tick) allocation dilation) + (ProducedWords (K := K) (tick := tick) allocation dilation) := + CommonDimensions.familyProduct (fun h : Produced K tick => + Tensor.power (shapeTensor (Fin (currentLength h.val.1)) (currentPhysicalShape h.val)) + (population allocation dilation h.val)) + +def canonicalHalfWord (x : CanonicalWords (K := K) (tick := tick) allocation dilation) + (p : CanonicalHalfPosition (K := K) (tick := tick) allocation dilation) : + Fin (activeHalfLength p.1.1.1) → Fin 7 := + if p.2 then x.right p.1.1 p.1.2 else x.left p.1.1 p.1.2 + +theorem regroupWords_half (x : ProducedWords (K := K) (tick := tick) allocation dilation) + (p : CanonicalHalfPosition (K := K) (tick := tick) allocation dilation) : + canonicalHalfWord allocation dilation (regroupWords allocation dilation x) p = + regroupAt allocation dilation x p := by + rcases p with ⟨⟨c, i⟩, right⟩ + cases right <;> simp only [canonicalHalfWord, regroupWords, Bool.false_eq_true, ↓reduceIte] + +theorem canonicalChildren_flat + (x y z : CanonicalWords (K := K) (tick := tick) allocation dilation) : + canonicalChildren (F := F) allocation dilation x y z = + ∏ p : CanonicalHalfPosition (K := K) (tick := tick) allocation dilation, + shapeTensor (Fin (activeHalfLength p.1.1.1)) (canonicalHalfShape allocation dilation p) + (canonicalHalfWord allocation dilation x p) + (canonicalHalfWord allocation dilation y p) + (canonicalHalfWord allocation dilation z p) := by + simp only [CanonicalHalfPosition, Fintype.prod_prod_type, CanonicalClassPosition, + Fintype.prod_sigma, Fintype.prod_bool, canonicalHalfShape, canonicalHalfWord, + Bool.false_eq_true, ↓reduceIte, Finset.prod_mul_distrib, + canonicalChildren, pairClassProduct, classProduct, JointCanonicalCW.leftTensor, + JointCanonicalCW.rightTensor] + exact mul_comm _ _ + +theorem producedBase_flat + (x y z : ProducedWords (K := K) (tick := tick) allocation dilation) : + producedBase (F := F) allocation dilation x y z = + ∏ p : ProducedPositions (K := K) (tick := tick) allocation dilation, + shapeTensor (Fin (currentLength p.1.val.1)) (currentPhysicalShape p.1.val) + (x p.1 p.2) (y p.1 p.2) (z p.1 p.2) := by + simp only [producedBase, CommonDimensions.familyProduct, Tensor.power, + ProducedPositions, Fintype.prod_sigma] + +theorem regroup_coefficient_at + (x y z : ProducedWords (K := K) (tick := tick) allocation dilation) + (p : CanonicalHalfPosition (K := K) (tick := tick) allocation dilation) : + shapeTensor (F := F) (Fin (activeHalfLength p.1.1.1)) (canonicalHalfShape allocation dilation p) + (regroupAt allocation dilation x p) (regroupAt allocation dilation y p) + (regroupAt allocation dilation z p) = + shapeTensor (Fin (currentLength (canonicalProducedEquiv allocation dilation p).1.val.1)) + (currentPhysicalShape (canonicalProducedEquiv allocation dilation p).1.val) + (x (canonicalProducedEquiv allocation dilation p).1 (canonicalProducedEquiv allocation dilation p).2) + (y (canonicalProducedEquiv allocation dilation p).1 (canonicalProducedEquiv allocation dilation p).2) + (z (canonicalProducedEquiv allocation dilation p).1 (canonicalProducedEquiv allocation dilation p).2) := by + rw [← canonicalProduced_shape allocation dilation p] + exact shapeTensor_finCast (canonicalProduced_length allocation dilation p).symm _ _ _ _ + +theorem regroup_coefficient + (x y z : ProducedWords (K := K) (tick := tick) allocation dilation) : + canonicalChildren (F := F) allocation dilation + (regroupWords allocation dilation x) (regroupWords allocation dilation y) + (regroupWords allocation dilation z) = producedBase allocation dilation x y z := by + rw [canonicalChildren_flat, producedBase_flat] + simp only [regroupWords_half] + exact Fintype.prod_equiv (canonicalProducedEquiv allocation dilation) _ _ + (regroup_coefficient_at allocation dilation x y z) + +theorem regroup_pullback : + Tensor.pullback (regroupWords allocation dilation) (regroupWords allocation dilation) + (regroupWords allocation dilation) (canonicalChildren (F := F) allocation dilation) = + producedBase (K := K) (tick := tick) allocation dilation := by + funext x y z + exact regroup_coefficient allocation dilation x y z + +def regroupMatrix : + ProducedWords (K := K) (tick := tick) allocation dilation → + CanonicalWords (K := K) (tick := tick) allocation dilation → F := + fun x s => if s = regroupWords allocation dilation x then 1 else 0 + +def producedBaseMap : + AllFieldFiniteFamily.LocalMap + (canonicalChildren (F := F) (K := K) (tick := tick) allocation dilation) + (producedBase (F := F) (K := K) (tick := tick) allocation dilation) where + x := regroupMatrix allocation dilation + y := regroupMatrix allocation dilation + z := regroupMatrix allocation dilation + coefficient := by + unfold regroupMatrix + rw [← Tensor.pullback_eq_restrict] + exact regroup_pullback allocation dilation + +end MatrixMultiplication.AllFieldHistory + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldHistory/ProducedMaskCore.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldHistory/ProducedMaskCore.lean new file mode 100644 index 0000000000000000000000000000000000000000..6541b3da2e77a8ad92b8cac534aa15dab935655f --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldHistory/ProducedMaskCore.lean @@ -0,0 +1,296 @@ +import OAI.LinearAlgebra.MatrixMultiplication.FieldHistory.Tensors +import OAI.LinearAlgebra.MatrixMultiplication.FieldHistory.ProducedBase +import OAI.LinearAlgebra.MatrixMultiplication.Tensor.Subdivision + +namespace OAI + +/-! Finite extraction histories, inherited masks and recovery bounds. -/ + +noncomputable section + +namespace MatrixMultiplication.AllFieldHistoryProducedMasks + +open MatrixMultiplication.Foundation AllFieldParameters AllFieldHistory +open AllFieldHistoryChildLaws InheritedMasks +open JointCanonicalization +open scoped BigOperators +attribute [local instance] Classical.propDecidable Classical.decEq + +variable {K tick : ℕ} + +def nativeChildWidth (ε : ℝ) (h : Active K tick) : ℝ := + (ε / 16 ^ h.val.1.stage.val) / 8 + +def halfPositionEquiv (allocation : Allocation) (dilation : ℕ) + (w : PlacedWork K) (b : w.1.Branch) (right : Bool) : + Fin (branchPopulation allocation dilation w b) ≃ + Fin (population allocation dilation (w.1.child b right, w.2)) where + toFun := halfPosition allocation dilation w b right + invFun := unhalfPosition allocation dilation w b right + left_inv := unhalf_halfPosition allocation dilation w b right + right_inv := half_unhalfPosition allocation dilation w b right + +def childHalfWord (allocation : Allocation) (dilation : ℕ) + (h : Active K tick) (b : h.val.1.Branch) (right : Bool) + (v : HistoryWord allocation dilation (h.val.1.child b right, h.val.2)) : + Fin (branchPopulation allocation dilation h.val b) → + Fin (activeHalfLength h) → Fin 7 := + fun i j => v (halfPosition allocation dilation h.val b right i) + (Fin.cast (child_length h.val.1 b right).symm j) + +theorem subsingleton_typeWindow {P A : Type*} [Fintype P] [Nonempty P] + [Subsingleton A] [DecidableEq A] (η : ℝ) (hη : 0 ≤ η) (w : P → A) : + typeWindow (fun _ : A => 1) η w := by + intro a + have hcount : wordPopulation w a = Fintype.card P := by + apply Fintype.card_congr + exact + { toFun := Subtype.val + invFun := fun i => ⟨i, Subsingleton.elim _ _⟩ + left_inv := fun i => Subtype.ext rfl + right_inv := fun i => rfl } + have hpos : (0 : ℝ) < Fintype.card P := by + exact_mod_cast (Fintype.card_pos : 0 < Fintype.card P) + simpa only [empiricalLaw, hcount, div_self (ne_of_gt hpos), sub_self, abs_zero] using hη + +theorem childHalfWord_window (allocation : Allocation) (dilation : ℕ) + {ε : ℝ} (hε : 0 ≤ ε) (side : Fin 3) + (h : Active K tick) (b : h.val.1.Branch) (right : Bool) + (v : HistoryWord allocation dilation (h.val.1.child b right, h.val.2)) + (hv : residentMask allocation dilation ε (h.val.1.child b right, h.val.2) side v) + (hp : 0 < branchPopulation allocation dilation h.val b) : + typeWindow (fun a => (h.val.1.childLaw + (halfShape h.val.1.parentShape (h.val.1.splitShape b) right) + (h.val.2.symm side) a : ℝ)) (nativeChildWidth ε h) + (h.val.1.statistic ∘ childHalfWord allocation dilation h b right v) := by + rcases h with ⟨⟨work, phi⟩, ht⟩ + cases work with + | stageA parent => + have hp' : 0 < population allocation dilation + ((Work.stageA parent).child b right, phi) := by + rw [branchPopulation_half allocation dilation (.stageA parent, phi) b right] + exact hp + have hw := (Subdivision.typeWindow_reindex + (residentLaw ((Work.stageA parent).child b right, phi) side) + (ε / 8) (fun i => residentStatistic ((Work.stageA parent).child b right) (v i)) + (halfPositionEquiv allocation dilation (.stageA parent, phi) b right)).mpr (hv hp') + have he : nativeChildWidth ε (⟨(.stageA parent, phi), ht⟩ : Active K tick) = ε / 8 := by + norm_num [nativeChildWidth, Work.stage] + rw [he] + exact hw + | stageB parent => + have hp' : 0 < population allocation dilation + ((Work.stageB parent).child b right, phi) := by + rw [branchPopulation_half allocation dilation (.stageB parent, phi) b right] + exact hp + have hw := (Subdivision.typeWindow_reindex + (residentLaw ((Work.stageB parent).child b right, phi) side) + (ε / 128) (fun i => residentStatistic ((Work.stageB parent).child b right) (v i)) + (halfPositionEquiv allocation dilation (.stageB parent, phi) b right)).mpr (hv hp') + have he : nativeChildWidth ε (⟨(.stageB parent, phi), ht⟩ : Active K tick) = ε / 128 := by + norm_num [nativeChildWidth, Work.stage, div_div] + rw [he] + exact hw + | stageC parent => + let : Nonempty (Fin (branchPopulation allocation dilation (.stageC parent, phi) b)) := + ⟨⟨0, hp⟩⟩ + let : Subsingleton (Work.stageC parent).Statistic := by + change Subsingleton PUnit + infer_instance + simp only [Work.childLaw, Rat.cast_one] + apply subsingleton_typeWindow + unfold nativeChildWidth + positivity + +theorem afterB_mask_of_part_masks (allocation : Allocation) (dilation : ℕ) + {ε : ℝ} (hε : 0 ≤ ε) (h : BPositive K) (phi : Placement) (side : Fin 3) + (w : ∀ i : Fin 3, HistoryWord allocation dilation (.partC (h, i), phi)) + (hw : ∀ i, residentMask allocation dilation ε (.partC (h, i), phi) side (w i)) : + residentMask allocation dilation ε (.afterB h.val, phi) side + (fun j => w (bSubdivisionPositionEquiv allocation dilation h phi j).1 + (bSubdivisionPositionEquiv allocation dilation h phi j).2) := by + intro hp + let P : Fin 3 → Type := fun i => + Fin (population allocation dilation (.partC (h, i), phi)) + let e := bSubdivisionPositionEquiv allocation dilation h phi + have hsize : 0 < Fintype.card (Σ i, P i) := by + rw [← Fintype.card_congr e] + simpa only [Fintype.card_fin] using hp + have hwidth : ∀ _ : Fin 3, ε / 256 ≤ ε / 128 := by + intro i + linarith + have hparts : Subdivision.partWindows P + (residentLaw (.afterB h.val, phi) side) (fun _ => ε / 256) + (fun i => CWCompleteStatistics.twoStatistic ∘ w i) := by + intro i hi + have hi' : 0 < population allocation dilation (.partC (h, i), phi) := by + simpa only [P, Fintype.card_fin] using hi + exact hw i hi' + exact Subdivision.statisticWindow_concatenate_at + (A := ResidentStatistic (.afterB h.val)) P e CWCompleteStatistics.twoStatistic + (residentLaw (.afterB h.val, phi) side) (ε / 128) (fun _ => ε / 256) + (div_nonneg hε (by norm_num)) hwidth hsize w hparts + +def producedChildWord (allocation : Allocation) (dilation : ℕ) + (x : ProducedWords (K := K) (tick := tick) allocation dilation) + (h : Active K tick) (b : h.val.1.Branch) (right : Bool) : + HistoryWord allocation dilation (h.val.1.child b right, h.val.2) := by + rcases h with ⟨⟨work, phi⟩, ht⟩ + cases work with + | stageA parent => exact x ⟨(.afterA ⟨parent, b, right⟩, phi), ht.symm⟩ + | stageB parent => + by_cases hp : positive (bShape (⟨parent, b, right⟩ : AfterB K)) = true + · let g : BPositive K := ⟨⟨parent, b, right⟩, hp⟩ + let e := bSubdivisionPositionEquiv allocation dilation g phi + exact fun j => x ⟨(.partC (g, (e j).1), phi), ht.symm⟩ (e j).2 + · exact x ⟨(.afterB ⟨parent, b, right⟩, phi), ht.symm, hp⟩ + | stageC parent => exact x ⟨(.afterC (parent, b, right), phi), ht.symm⟩ + +theorem producedChildWord_mask (allocation : Allocation) (dilation : ℕ) + {ε : ℝ} (hε : 0 ≤ ε) (side : Fin 3) + (x : ProducedWords (K := K) (tick := tick) allocation dilation) + (hx : ∀ h : Produced K tick, residentMask allocation dilation ε h.val side (x h)) + (h : Active K tick) (b : h.val.1.Branch) (right : Bool) : + residentMask allocation dilation ε (h.val.1.child b right, h.val.2) side + (producedChildWord allocation dilation x h b right) := by + rcases h with ⟨⟨work, phi⟩, ht⟩ + cases work with + | stageA parent => exact hx ⟨(.afterA ⟨parent, b, right⟩, phi), ht.symm⟩ + | stageB parent => + by_cases hp : positive (bShape (⟨parent, b, right⟩ : AfterB K)) = true + · dsimp only [producedChildWord] + erw [dite_eq_left hp] + exact afterB_mask_of_part_masks allocation dilation hε + ⟨⟨parent, b, right⟩, hp⟩ phi side + (fun i => x ⟨(.partC (⟨⟨parent, b, right⟩, hp⟩, i), phi), ht.symm⟩) + (fun i => hx ⟨(.partC (⟨⟨parent, b, right⟩, hp⟩, i), phi), ht.symm⟩) + · dsimp only [producedChildWord] + erw [dite_eq_right hp] + exact hx (⟨(.afterB ⟨parent, b, right⟩, phi), ht.symm, hp⟩ : Produced K tick) + | stageC parent => trivial + +private theorem splitWord_eq_of_position (allocation : Allocation) (dilation : ℕ) + (x : ProducedWords (K := K) (tick := tick) allocation dilation) + (p : SplitPositions (K := K) (tick := tick) allocation dilation) + (q : ProducedPositions (K := K) (tick := tick) allocation dilation) + (hq : (producedPositionEquiv allocation dilation).symm p = q) + (hlen : currentLength q.1.val.1 = activeHalfLength p.1) : + splitWord allocation dilation x p = + fun i => x q.1 q.2 (Fin.cast hlen.symm i) := by + subst q + rfl + +theorem producedHalfWord_eq_childHalfWord (allocation : Allocation) (dilation : ℕ) + (x : ProducedWords (K := K) (tick := tick) allocation dilation) + (h : Active K tick) (b : h.val.1.Branch) (right : Bool) : + producedHalfWord allocation dilation x h b right = + childHalfWord allocation dilation h b right + (producedChildWord allocation dilation x h b right) := by + rcases h with ⟨⟨work, phi⟩, ht⟩ + cases work with + | stageA parent => rfl + | stageB parent => + by_cases hp : positive (bShape (⟨parent, b, right⟩ : AfterB K)) = true + · funext i + let g : BPositive K := ⟨⟨parent, b, right⟩, hp⟩ + let part := bSubdivisionPositionEquiv allocation dilation g phi + (halfPosition allocation dilation (.stageB parent, phi) b right i) + let q : ProducedPositions (K := K) (tick := tick) allocation dilation := + ⟨⟨(.partC (g, part.1), phi), ht.symm⟩, part.2⟩ + have hq : (producedPositionEquiv allocation dilation).symm + ⟨⟨(.stageB parent, phi), ht⟩, b, right, i⟩ = q := by + simp only [producedPositionEquiv, Equiv.symm, Equiv.coe_fn_mk, + splitToProduced, dite_eq_left hp] + rfl + dsimp only [producedHalfWord, producedChildWord] + erw [dite_eq_left hp] + exact splitWord_eq_of_position allocation dilation x + ⟨⟨(.stageB parent, phi), ht⟩, b, right, i⟩ q hq rfl + · funext i + let q : ProducedPositions (K := K) (tick := tick) allocation dilation := + ⟨⟨(.afterB ⟨parent, b, right⟩, phi), ht.symm, hp⟩, + halfPosition allocation dilation (.stageB parent, phi) b right i⟩ + have hq : (producedPositionEquiv allocation dilation).symm + ⟨⟨(.stageB parent, phi), ht⟩, b, right, i⟩ = q := by + simp only [producedPositionEquiv, Equiv.symm, Equiv.coe_fn_mk, + splitToProduced, dite_eq_right hp] + rfl + dsimp only [producedHalfWord, producedChildWord] + erw [dite_eq_right hp] + exact splitWord_eq_of_position allocation dilation x + ⟨⟨(.stageB parent, phi), ht⟩, b, right, i⟩ q hq rfl + | stageC parent => rfl + +theorem producedHalfWord_window (allocation : Allocation) (dilation : ℕ) + {ε : ℝ} (hε : 0 ≤ ε) (side : Fin 3) + (x : ProducedWords (K := K) (tick := tick) allocation dilation) + (hx : ∀ h : Produced K tick, residentMask allocation dilation ε h.val side (x h)) + (h : Active K tick) (b : h.val.1.Branch) (right : Bool) + (hp : 0 < branchPopulation allocation dilation h.val b) : + typeWindow (fun a => (h.val.1.childLaw + (halfShape h.val.1.parentShape (h.val.1.splitShape b) right) + (h.val.2.symm side) a : ℝ)) (nativeChildWidth ε h) + (h.val.1.statistic ∘ producedHalfWord allocation dilation x h b right) := by + rw [producedHalfWord_eq_childHalfWord] + exact childHalfWord_window allocation dilation hε side h b right _ + (producedChildWord_mask allocation dilation hε side x hx h b right) hp + +theorem regroupBranch_window (allocation : Allocation) (dilation : ℕ) + {ε : ℝ} (hε : 0 ≤ ε) (side : Fin 3) + (x : ProducedWords (K := K) (tick := tick) allocation dilation) + (hx : ∀ h : Produced K tick, residentMask allocation dilation ε h.val side (x h)) + (h : Active K tick) (b : h.val.1.Branch) (right : Bool) + (hp : 0 < branchPopulation allocation dilation h.val b) : + typeWindow (fun a => (placedChildLawRat h.val (branchShape h.val b) side right a : ℝ)) + (nativeChildWidth ε h) + (statistic h ∘ (if right then (regroupWords allocation dilation x).right + (h, branchShape h.val b) else (regroupWords allocation dilation x).left + (h, branchShape h.val b))) := by + apply (Subdivision.typeWindow_reindex _ _ _ (branchClassEquiv allocation dilation h b)).mp + have he : (statistic h ∘ (if right then (regroupWords allocation dilation x).right + (h, branchShape h.val b) else (regroupWords allocation dilation x).left + (h, branchShape h.val b))) ∘ branchClassEquiv allocation dilation h b = + h.val.1.statistic ∘ producedHalfWord allocation dilation x h b right := by + funext i + have hi := regroupWords_branch allocation dilation x h b right i + cases right <;> exact congrArg h.val.1.statistic hi + rw [he] + simpa only [placedChildLawRat_branchShape] using + producedHalfWord_window allocation dilation hε side x hx h b right hp + +theorem canonicalWindows_of_produced_masks (allocation : Allocation) (dilation : ℕ) + {ε : ℝ} (hε : 0 ≤ ε) (side : Fin 3) + (x : ProducedWords (K := K) (tick := tick) allocation dilation) + (hx : ∀ h : Produced K tick, residentMask allocation dilation ε h.val side (x h)) : + HistorySymmetry.childWindows + (fun c : Active K tick × JointPopulation.Shape => statistic c.1) + (fun c : Active K tick × JointPopulation.Shape => statistic c.1) + (activeLaw (activeCounts allocation dilation) (fun c => leftLaw c.1 c.2 side)) + (activeLaw (activeCounts allocation dilation) (fun c => rightLaw c.1 c.2 side)) + (activeWidth (activeCounts allocation dilation) (fun c => nativeChildWidth ε c.1)) + (activeWidth (activeCounts allocation dilation) (fun c => nativeChildWidth ε c.1)) + (regroupWords allocation dilation x) := by + rintro ⟨h, u⟩ + by_cases hp : 0 < activeCounts allocation dilation h u + · obtain ⟨b, hb, hpos⟩ := shapeCounts_positive (branchShape h.val) + (branchPopulation allocation dilation h.val) u hp + subst u + have hl := regroupBranch_window allocation dilation hε side x hx h b false hpos + have hr := regroupBranch_window allocation dilation hε side x hx h b true hpos + rw [activeLaw_of_pos (activeCounts allocation dilation) + (fun c => leftLaw c.1 c.2 side) (h, branchShape h.val b) hp, + activeLaw_of_pos (activeCounts allocation dilation) + (fun c => rightLaw c.1 c.2 side) (h, branchShape h.val b) hp] + dsimp only [leftLaw, rightLaw, childLaw, rightChildLaw, childLawRat, rightChildLawRat] + simpa only [activeWidth, ite_eq_left hp, Bool.false_eq_true, ite_false, ite_true] + using! And.intro hl hr + · have hz : activeCounts allocation dilation h u = 0 := Nat.eq_zero_of_not_pos hp + simp only [activeLaw, activeWidth, typeWindow, empiricalLaw, + Fintype.card_fin, hz, Nat.cast_zero, div_zero, sub_zero, abs_zero, + le_refl, implies_true, and_self, Nat.lt_irrefl, ite_false] + +end MatrixMultiplication.AllFieldHistoryProducedMasks + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldHistory/ProducedMasks.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldHistory/ProducedMasks.lean new file mode 100644 index 0000000000000000000000000000000000000000..c347b622abe23dd7e03460ed02e2b1be5d128daa --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldHistory/ProducedMasks.lean @@ -0,0 +1,32 @@ +import OAI.LinearAlgebra.MatrixMultiplication.FieldHistory.ProducedMaskCore +import OAI.LinearAlgebra.MatrixMultiplication.FieldHistory.MaskCore + +namespace OAI + +/-! Finite extraction histories, inherited masks and recovery bounds. -/ + +noncomputable section + +namespace MatrixMultiplication.AllFieldHistoryProducedMasks + +open MatrixMultiplication.Foundation AllFieldParameters AllFieldHistory +open AllFieldHistoryChildLaws AllFieldHistoryMasks InheritedMasks +open JointCanonicalization +open scoped BigOperators +attribute [local instance] Classical.propDecidable Classical.decEq + +variable {K tick : ℕ} + +theorem childWindows_of_produced_masks (allocation : Allocation) (dilation : ℕ) + {ε : ℝ} (hε : 0 ≤ ε) (side : Fin 3) + (x : ProducedWords (K := K) (tick := tick) allocation dilation) + (hx : ∀ h : Produced K tick, residentMask allocation dilation ε h.val side (x h)) : + AllFieldHistoryMasks.childWindows allocation dilation ε side + (regroupWords allocation dilation x) := + canonicalWindows_of_produced_masks allocation dilation hε side x hx + +end MatrixMultiplication.AllFieldHistoryProducedMasks + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldHistory/RawMasks.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldHistory/RawMasks.lean new file mode 100644 index 0000000000000000000000000000000000000000..82ca3fb73219059844dd1355cd4eb873cf59d0a6 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldHistory/RawMasks.lean @@ -0,0 +1,128 @@ +import OAI.LinearAlgebra.MatrixMultiplication.FieldHistory.MaskCore + +namespace OAI + +/-! Finite extraction histories, inherited masks and recovery bounds. -/ + +noncomputable section + +namespace MatrixMultiplication.AllFieldHistoryRawMasks + +open AllFieldHistory AllFieldHistoryChildLaws AllFieldHistorySupport AllFieldHistoryMasks +open JointCanonicalization PermutationMatching +open scoped BigOperators +attribute [local instance] Classical.propDecidable Classical.decEq + +variable {K tick : ℕ} + +def rawPairCount (allocation : Allocation) (m : ℕ) (i : MaskIndex K tick) + (w : ActiveRawPairs (K := K) (tick := tick) allocation m) : ℝ := + ∑ j : JointPopulation.Positions (activeCounts allocation m) i.1, + if statistic i.1 (w i.1 j).1 = i.2.1 i.1 ∧ + statistic i.1 (w i.1 j).2 = i.2.2 i.1 then 1 else 0 + +def rawPass (allocation : Allocation) (m : ℕ) (ε : ℝ) (side : Fin 3) + (w : ActiveRawPairs (K := K) (tick := tick) allocation m) : Prop := + ∀ i : MaskIndex K tick, + |rawPairCount allocation m i w / + (population allocation m (i.1.val.1.source, i.1.val.2) : ℝ) - + center allocation side i| ≤ pairWidth ε i.1 + +theorem sum_positiveClasses (allocation : Allocation) (m : ℕ) (h : Active K tick) + (f : ∀ c : Classes K tick, Positions allocation m c → ℝ) : + (∑ c : positiveClasses allocation h, ∑ j, f c.val j) = + ∑ u : JointPopulation.Shape, ∑ j, f (h, u) j := by + have hzero (c : Classes K tick) (hc : ¬0 < activeCounts allocation 1 c.1 c.2) : + (∑ j, f c j) = 0 := by + have hcount : activeCounts allocation m c.1 c.2 = 0 := by + rw [activeCounts_dilation, Nat.eq_zero_of_not_pos hc, mul_zero] + apply Finset.sum_eq_zero + intro j _ + have hj : j.val < 0 := by simpa only [hcount] using j.isLt + exact (Nat.not_lt_zero _ hj).elim + rw [Finset.sum_coe_sort (positiveClasses allocation h) + (fun c : Classes K tick => ∑ j, f c j)] + unfold positiveClasses + rw [Finset.sum_filter] + calc + (∑ c : Classes K tick, + if c.1 = h ∧ 0 < activeCounts allocation 1 c.1 c.2 then ∑ j, f c j else 0) = + ∑ c : Classes K tick, if c.1 = h then ∑ j, f c j else 0 := by + apply Finset.sum_congr rfl + intro c _ + by_cases hc : 0 < activeCounts allocation 1 c.1 c.2 + · simp only [hc, and_true] + · rw [hzero c hc] + simp + _ = ∑ u : JointPopulation.Shape, ∑ j, f (h, u) j := by + rw [Fintype.sum_prod_type, Fintype.sum_eq_single h] + · simp only [ite_true] + · intro h' hh' + apply Finset.sum_eq_zero + intro u _ + exact ite_eq_right hh' + +theorem selectedWordPairCount_pairEquiv (allocation : Allocation) (m : ℕ) + (e : JointPopulation.Target (activeCounts (K := K) (tick := tick) allocation m)) + (i : MaskIndex K tick) (w : ActiveRawPairs (K := K) (tick := tick) allocation m) : + selectedWordPairCount (testedClasses allocation i) + (pairEquiv (activeCounts allocation m) + (JointCanonicalCW.Left activeHalfLength) (JointCanonicalCW.Right activeHalfLength) e w) + classStatistic classStatistic (leftSymbol i) (rightSymbol i) = + rawPairCount allocation m i w := by + let v : Words (K := K) (tick := tick) allocation m := + pairEquiv (activeCounts allocation m) + (JointCanonicalCW.Left activeHalfLength) (JointCanonicalCW.Right activeHalfLength) e w + have hsum := sum_positiveClasses allocation m i.1 (fun c j => + if classStatistic c (v.left c j) = leftSymbol i c ∧ + classStatistic c (v.right c j) = rightSymbol i c then (1 : ℝ) else 0) + unfold selectedWordPairCount + rw [testedClasses, hsum] + unfold rawPairCount + rw [← Fintype.sum_sigma'] + apply Fintype.sum_equiv (positionEquiv (activeCounts allocation m) e i.1).symm + rintro ⟨u, j⟩ + rfl + +theorem testedClasses_populationSize (allocation : Allocation) (m : ℕ) + (i : MaskIndex K tick) : + populationSize (fun c : testedClasses allocation i => Positions allocation m c.val) = + (population allocation m (i.1.val.1.source, i.1.val.2) : ℝ) := by + change populationSize (selectedPositions allocation m (positiveClasses allocation i.1)) = _ + rw [positiveClasses_populationSize, population_dilation allocation m, Nat.cast_mul] + exact mul_comm _ _ + +theorem raw_population_pos (allocation : Allocation) {m : ℕ} (hm : 0 < m) + (h : Active K tick) : + 0 < (population allocation m (h.val.1.source, h.val.2) : ℝ) := by + exact_mod_cast work_source_population_pos allocation hm h.val + +theorem passes_pairEquiv_iff_rawPass (allocation : Allocation) (m : ℕ) (ε : ℝ) + (side : Fin 3) + (e : JointPopulation.Target (activeCounts (K := K) (tick := tick) allocation m)) + (w : ActiveRawPairs (K := K) (tick := tick) allocation m) : + passes allocation m ε side + (pairEquiv (activeCounts allocation m) + (JointCanonicalCW.Left activeHalfLength) (JointCanonicalCW.Right activeHalfLength) e w) ↔ + rawPass allocation m ε side w := by + simp only [passes, selectedWordPairMaskBad, selectedWordPairCount_pairEquiv, + testedClasses_populationSize, rawPass, not_lt] + +theorem passes_pairEquiv_target_independent (allocation : Allocation) (m : ℕ) (ε : ℝ) + (side : Fin 3) + (e f : JointPopulation.Target (activeCounts (K := K) (tick := tick) allocation m)) + (w : ActiveRawPairs (K := K) (tick := tick) allocation m) : + passes allocation m ε side + (pairEquiv (activeCounts allocation m) + (JointCanonicalCW.Left activeHalfLength) (JointCanonicalCW.Right activeHalfLength) e w) ↔ + passes allocation m ε side + (pairEquiv (activeCounts allocation m) + (JointCanonicalCW.Left activeHalfLength) (JointCanonicalCW.Right activeHalfLength) f w) := + (passes_pairEquiv_iff_rawPass allocation m ε side e w).trans + (passes_pairEquiv_iff_rawPass allocation m ε side f w).symm + +end MatrixMultiplication.AllFieldHistoryRawMasks + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldHistory/Recovery.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldHistory/Recovery.lean new file mode 100644 index 0000000000000000000000000000000000000000..1b18df0dc2be4ac0c4177d8006f9563ca80e81e9 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldHistory/Recovery.lean @@ -0,0 +1,452 @@ +import OAI.LinearAlgebra.MatrixMultiplication.FieldHistory.RecoveryCore +import OAI.LinearAlgebra.MatrixMultiplication.FieldHistory.Masks +import OAI.LinearAlgebra.MatrixMultiplication.FieldHistory.RecoveryBudget +import OAI.LinearAlgebra.MatrixMultiplication.FieldHistory.RawMasks +import OAI.LinearAlgebra.MatrixMultiplication.FieldHistory.IncomingMasks +import OAI.LinearAlgebra.MatrixMultiplication.JointExtraction.CanonicalSymmetry +import OAI.LinearAlgebra.MatrixMultiplication.JointExtraction.OrbitRecovery + +namespace OAI + +/-! Finite extraction histories, inherited masks and recovery bounds. -/ + +noncomputable section + +namespace MatrixMultiplication.AllFieldHistoryRecovery + +open MatrixMultiplication.Foundation AllFieldHistory AllFieldHistoryChildLaws +open AllFieldHistorySupport JointPopulation JointCanonicalization JointCanonicalCW +open PermutationMatching +open scoped BigOperators + +attribute [local instance] Classical.propDecidable Classical.decEq + +variable {K tick : ℕ} + +theorem ideal_coordinates (F : Type*) [CommRing F] (allocation : Allocation) + (m : ℕ) (ε : ℝ) (e : Targets (K := K) (tick := tick) allocation m) + (x y z : Raw (K := K) (tick := tick) allocation m) : + ideal F allocation m ε e x y z = canonical F allocation m ε + (coordinates allocation m e x) (coordinates allocation m e y) + (coordinates allocation m e z) := + ideal_eq_canonicalIdeal (activeCounts allocation m) (Left activeHalfLength) + (Right activeHalfLength) (parents F) + (coarse activeHalfLength activeHalfLength halfLength_le_eight) + childStatistic childStatistic leftPrescription rightPrescription + (outputWidth ε) (outputWidth ε) e x y z + +theorem ideal_support_windows (F : Type*) [CommRing F] (allocation : Allocation) + (m : ℕ) (ε : ℝ) (e : Targets (K := K) (tick := tick) allocation m) + (x y z : Raw (K := K) (tick := tick) allocation m) (hq : ideal F allocation m ε e x y z ≠ 0) : + AllFieldHistoryMasks.childWindows allocation m ε 0 (coordinates allocation m e x) ∧ + AllFieldHistoryMasks.childWindows allocation m ε 1 (coordinates allocation m e y) ∧ + AllFieldHistoryMasks.childWindows allocation m ε 2 (coordinates allocation m e z) := by + by_contra hn + apply hq + rw [ideal_coordinates] + change (if AllFieldHistoryMasks.childWindows allocation m ε 0 (coordinates allocation m e x) ∧ + AllFieldHistoryMasks.childWindows allocation m ε 1 (coordinates allocation m e y) ∧ + AllFieldHistoryMasks.childWindows allocation m ε 2 (coordinates allocation m e z) + then _ else 0) = 0 + exact ite_eq_right hn + +theorem raw_pair_loss_le (allocation : Allocation) {m : ℕ} (hm : 2 ≤ m) + {ε : ℝ} (hε : 0 < ε) (side : Fin 3) + (e : Targets (K := K) (tick := tick) allocation m) (w : Raw (K := K) (tick := tick) allocation m) + (hw : AllFieldHistoryMasks.childWindows allocation m ε side + (coordinates allocation m e w)) : + letI : MulAction (Symmetries (K := K) (tick := tick) allocation m) (Raw (K := K) (tick := tick) allocation m) := rawAction allocation m e + (((OrbitCounting.orbitSet (G := Symmetries (K := K) (tick := tick) allocation m) w).filter + (fun v => ¬AllFieldHistoryRawMasks.rawPass allocation m ε side v)).card : ℝ) / + (OrbitCounting.orbitSet (G := Symmetries (K := K) (tick := tick) allocation m) w).card ≤ + AllFieldHistoryMasks.lossConstant (K := K) (tick := tick) allocation ε / m := by + let _ : MulAction (Symmetries (K := K) (tick := tick) allocation m) (Raw (K := K) (tick := tick) allocation m) := rawAction allocation m e + have htransport := EquivOrbitTransport.rejected_fraction + (G := Symmetries (K := K) (tick := tick) allocation m) (coordinates allocation m e) + (fun v => ¬AllFieldHistoryRawMasks.rawPass allocation m ε side v) w + have hcanonical := orbit_bad_fraction_eq_fullOrbitFilter_of_iff + (G := Symmetries (K := K) (tick := tick) allocation m) + (coordinates allocation m e w) + ((fun v => ¬AllFieldHistoryRawMasks.rawPass allocation m ε side v) ∘ + (coordinates allocation m e).symm) + (fun v => ∃ i : AllFieldHistoryMasks.MaskIndex K tick, + selectedWordPairMaskBad (AllFieldHistoryMasks.testedClasses allocation i) + AllFieldHistoryMasks.classStatistic AllFieldHistoryMasks.classStatistic + (AllFieldHistoryMasks.leftSymbol i) (AllFieldHistoryMasks.rightSymbol i) + (AllFieldHistoryMasks.pairWidth ε i.1) (AllFieldHistoryMasks.center allocation side i) v) + (fun v => by + change ¬AllFieldHistoryRawMasks.rawPass allocation m ε side + ((coordinates allocation m e).symm v) ↔ _ + rw [← AllFieldHistoryRawMasks.passes_pairEquiv_iff_rawPass allocation m ε side e] + change ¬AllFieldHistoryMasks.passes allocation m ε side + ((coordinates allocation m e) ((coordinates allocation m e).symm v)) ↔ _ + rw [Equiv.apply_symm_apply] + simp only [AllFieldHistoryMasks.passes, not_forall, not_not]) + exact htransport.trans_le (hcanonical.trans_le + (AllFieldHistoryMasks.full_filter_loss_le allocation hm hε side + (coordinates allocation m e w) hw)) + +theorem ideal_support_marginals (F : Type*) [CommRing F] (allocation : Allocation) + (m : ℕ) (ε : ℝ) (e : Targets (K := K) (tick := tick) allocation m) + (x y z : Raw (K := K) (tick := tick) allocation m) (hq : ideal F allocation m ε e x y z ≠ 0) : + JointCanonicalMixed.sideMask (activeCounts allocation m) + activeHalfLength activeHalfLength halfLength_le_eight 0 x ∧ + JointCanonicalMixed.sideMask (activeCounts allocation m) + activeHalfLength activeHalfLength halfLength_le_eight 1 y ∧ + JointCanonicalMixed.sideMask (activeCounts allocation m) + activeHalfLength activeHalfLength halfLength_le_eight 2 z := by + exact JointCanonicalMixed.ideal_support_masks (activeCounts allocation m) + activeHalfLength activeHalfLength activeParentShape (fun _ => true) + halfLength_le_eight e _ _ _ x y z hq + +def sideWeights (allocation : Allocation) (m : ℕ) (side : Fin 3) + (e : Targets (K := K) (tick := tick) allocation m) (w : Raw (K := K) (tick := tick) allocation m) : Prop := + ∀ h j, + CWStrands.weight (w h j).1 = (shapeSide side ((e h).val j)).val ∧ + CWStrands.weight (w h j).2 = activeParentShape h side - + (shapeSide side ((e h).val j)).val + +theorem ideal_support_weights (F : Type*) [CommRing F] (allocation : Allocation) + (m : ℕ) (ε : ℝ) (e : Targets (K := K) (tick := tick) allocation m) + (x y z : Raw (K := K) (tick := tick) allocation m) (hq : ideal F allocation m ε e x y z ≠ 0) : + sideWeights allocation m 0 e x ∧ sideWeights allocation m 1 e y ∧ + sideWeights allocation m 2 e z := by + have hb : coarseIdeal (activeCounts allocation m) + (Left activeHalfLength) (Right activeHalfLength) (parents F) + (coarse activeHalfLength activeHalfLength halfLength_le_eight) e x y z ≠ 0 := by + intro hz + apply hq + simp only [ideal, JointCanonicalization.ideal, ExactRecovery.delete, hz, ite_self] + have hc : + coarseMask (activeCounts allocation m) (Left activeHalfLength) (Right activeHalfLength) + (coarse activeHalfLength activeHalfLength halfLength_le_eight) 0 e x ∧ + coarseMask (activeCounts allocation m) (Left activeHalfLength) (Right activeHalfLength) + (coarse activeHalfLength activeHalfLength halfLength_le_eight) 1 e y ∧ + coarseMask (activeCounts allocation m) (Left activeHalfLength) (Right activeHalfLength) + (coarse activeHalfLength activeHalfLength halfLength_le_eight) 2 e z := by + by_contra hn + exact hb (by simp only [coarseIdeal, ExactRecovery.delete, ite_eq_right hn]) + have hs : rawSource F allocation m x y z ≠ 0 := by + intro hz + apply hb + change (if _ then rawSource F allocation m x y z else 0) = 0 + simp only [hz, ite_self] + have ht (h : Active K tick) (j : JointPopulation.Positions (activeCounts allocation m) h) : + parents F h (x h j) (y h j) (z h j) ≠ 0 := by + intro hz + apply hs + unfold rawSource sourceTensor InheritedMasks.classProduct + exact Finset.prod_eq_zero (Finset.mem_univ h) + (Finset.prod_eq_zero (Finset.mem_univ j) hz) + have hp (h : Active K tick) (j : JointPopulation.Positions (activeCounts allocation m) h) : + CWStrands.weight (x h j).1 + CWStrands.weight (x h j).2 = activeParentShape h 0 ∧ + CWStrands.weight (y h j).1 + CWStrands.weight (y h j).2 = activeParentShape h 1 ∧ + CWStrands.weight (z h j).1 + CWStrands.weight (z h j).2 = activeParentShape h 2 := by + have hh := ht h j + change CWStrands.shapeTensor + (Fin (activeHalfLength h) ⊕ Fin (activeHalfLength h)) (activeParentShape h) + (Sum.elim (x h j).1 (x h j).2) (Sum.elim (y h j).1 (y h j).2) + (Sum.elim (z h j).1 (z h j).2) ≠ 0 at hh + simpa only [CWStrands.weight_sum_elim] using + CWStrands.shapeTensor_support (activeParentShape h) _ _ _ hh + have hx (h : Active K tick) (j : JointPopulation.Positions (activeCounts allocation m) h) : + CWStrands.weight (x h j).1 = (shapeSide 0 ((e h).val j)).val := + congrArg Fin.val (hc.1 h j) + have hy (h : Active K tick) (j : JointPopulation.Positions (activeCounts allocation m) h) : + CWStrands.weight (y h j).1 = (shapeSide 1 ((e h).val j)).val := + congrArg Fin.val (hc.2.1 h j) + have hz (h : Active K tick) (j : JointPopulation.Positions (activeCounts allocation m) h) : + CWStrands.weight (z h j).1 = (shapeSide 2 ((e h).val j)).val := + congrArg Fin.val (hc.2.2 h j) + refine ⟨?_, ?_, ?_⟩ + · intro h j + refine ⟨hx h j, ?_⟩ + have hh := (hp h j).1 + rw [hx h j] at hh + omega + · intro h j + refine ⟨hy h j, ?_⟩ + have hh := (hp h j).2.1 + rw [hy h j] at hh + omega + · intro h j + refine ⟨hz h j, ?_⟩ + have hh := (hp h j).2.2 + rw [hz h j] at hh + omega + +theorem stageCWeights_of_sideWeights (allocation : Allocation) (m : ℕ) (side : Fin 3) + (e : Targets (K := K) (tick := tick) allocation m) (w : Raw (K := K) (tick := tick) allocation m) + (hw : sideWeights allocation m side e w) : + AllFieldHistoryIncomingMasks.stageCWeights allocation m side e w := by + intro h phi ht j + have hh := hw (AllFieldHistoryStageCIncoming.stageCActive h phi ht) j + have hleft := Fin.sum_univ_one (fun i : Fin 1 => CWLeafStatistics.weight + ((w (AllFieldHistoryStageCIncoming.stageCActive h phi ht) j).1 i)) + have hright := Fin.sum_univ_one (fun i : Fin 1 => CWLeafStatistics.weight + ((w (AllFieldHistoryStageCIncoming.stageCActive h phi ht) j).2 i)) + exact ⟨hleft.symm.trans hh.1, hright.symm.trans hh.2⟩ + +theorem completeKeep_of_supported (allocation : Allocation) {m : ℕ} (hm : 0 < m) + {ε : ℝ} (hε : 0 ≤ ε) (side : Fin 3) + (e : Targets (K := K) (tick := tick) allocation m) (w : Raw (K := K) (tick := tick) allocation m) + (hmarginal : JointCanonicalMixed.sideMask (activeCounts allocation m) + activeHalfLength activeHalfLength halfLength_le_eight side w) + (hweights : sideWeights allocation m side e w) + (hpass : AllFieldHistoryRawMasks.rawPass allocation m ε side w) : + completeKeep allocation m ε side w := + ⟨hmarginal, AllFieldHistoryIncomingMasks.received_of_rawPass allocation hm hε side e w + hpass (stageCWeights_of_sideWeights allocation m side e w hweights), hpass⟩ + +theorem occupied_split_le (allocation : Allocation) (m : ℕ) + (h : Active K tick) (u : JointPopulation.Shape) + (hu : 0 < activeCounts allocation m h u) : + ∀ s, shapeNat u s ≤ activeParentShape h s := + jointCounts_support_le allocation m h.val u hu + +theorem ideal_smul (F : Type*) [CommRing F] (allocation : Allocation) (m : ℕ) (ε : ℝ) + (e : Targets (K := K) (tick := tick) allocation m) : + letI : MulAction (Symmetries (K := K) (tick := tick) allocation m) (Raw (K := K) (tick := tick) allocation m) := rawAction allocation m e + ∀ (g : Symmetries (K := K) (tick := tick) allocation m) x y z, + ideal F allocation m ε e (g • x) (g • y) (g • z) = ideal F allocation m ε e x y z := by + exact JointCanonicalSymmetry.rawIdeal_smul (activeCounts allocation m) + activeHalfLength activeHalfLength activeParentShape (fun _ => true) + halfLength_le_eight childStatistic childStatistic leftPrescription rightPrescription + (outputWidth ε) (outputWidth ε) + (fun h u hu _ => occupied_split_le allocation m h u hu) e + +def Used (F : Type*) [CommRing F] (allocation : Allocation) (m : ℕ) (ε : ℝ) + (e : Targets (K := K) (tick := tick) allocation m) (side : Fin 3) + (w : Raw (K := K) (tick := tick) allocation m) : Prop := + ∃ x y z, ideal F allocation m ε e x y z ≠ 0 ∧ sideVariable side x y z = w + +theorem used_windows (F : Type*) [CommRing F] (allocation : Allocation) + (m : ℕ) (ε : ℝ) (e : Targets (K := K) (tick := tick) allocation m) + (side : Fin 3) (w : Raw (K := K) (tick := tick) allocation m) (hw : Used F allocation m ε e side w) : + AllFieldHistoryMasks.childWindows allocation m ε side (coordinates allocation m e w) := by + obtain ⟨x, y, z, hq, rfl⟩ := hw + have hh := ideal_support_windows F allocation m ε e x y z hq + fin_cases side + · exact hh.1 + · exact hh.2.1 + · exact hh.2.2 + +theorem used_keep_iff_rawPass (F : Type*) [CommRing F] (allocation : Allocation) + {m : ℕ} (hm : 0 < m) {ε : ℝ} (hε : 0 ≤ ε) + (e : Targets (K := K) (tick := tick) allocation m) + (side : Fin 3) (w : Raw (K := K) (tick := tick) allocation m) (hw : Used F allocation m ε e side w) : + completeKeep allocation m ε side w ↔ AllFieldHistoryRawMasks.rawPass allocation m ε side w := by + refine ⟨fun h => h.2.2, ?_⟩ + intro hp + obtain ⟨x, y, z, hq, rfl⟩ := hw + have hmg := ideal_support_marginals F allocation m ε e x y z hq + have hwt := ideal_support_weights F allocation m ε e x y z hq + fin_cases side + · exact completeKeep_of_supported allocation hm hε 0 e x hmg.1 hwt.1 hp + · exact completeKeep_of_supported allocation hm hε 1 e y hmg.2.1 hwt.2.1 hp + · exact completeKeep_of_supported allocation hm hε 2 e z hmg.2.2 hwt.2.2 hp + +theorem used_smul (F : Type*) [CommRing F] (allocation : Allocation) + (m : ℕ) (ε : ℝ) (e : Targets (K := K) (tick := tick) allocation m) + (side : Fin 3) (w : Raw (K := K) (tick := tick) allocation m) : + letI : MulAction (Symmetries (K := K) (tick := tick) allocation m) (Raw (K := K) (tick := tick) allocation m) := rawAction allocation m e + ∀ g : Symmetries (K := K) (tick := tick) allocation m, Used F allocation m ε e side w → + Used F allocation m ε e side (g • w) := by + let _ : MulAction (Symmetries (K := K) (tick := tick) allocation m) (Raw (K := K) (tick := tick) allocation m) := rawAction allocation m e + intro g hw + obtain ⟨x, y, z, hq, rfl⟩ := hw + refine ⟨g • x, g • y, g • z, ?_, ?_⟩ + · rwa [ideal_smul] + · fin_cases side <;> rfl + +theorem deterministic_loss_le (F : Type*) [CommRing F] (allocation : Allocation) + {m : ℕ} (hm : 2 ≤ m) {ε : ℝ} (hε : 0 < ε) + (e : Targets (K := K) (tick := tick) allocation m) + (side : Fin 3) (w : Raw (K := K) (tick := tick) allocation m) (hw : Used F allocation m ε e side w) : + letI : MulAction (Symmetries (K := K) (tick := tick) allocation m) (Raw (K := K) (tick := tick) allocation m) := rawAction allocation m e + (((OrbitCounting.orbitSet (G := Symmetries (K := K) (tick := tick) allocation m) w).filter + (fun v => ¬completeKeep allocation m ε side v)).card : ℝ) / + (OrbitCounting.orbitSet (G := Symmetries (K := K) (tick := tick) allocation m) w).card ≤ + AllFieldHistoryMasks.lossConstant (K := K) (tick := tick) allocation ε / m := by + let _ : MulAction (Symmetries (K := K) (tick := tick) allocation m) (Raw (K := K) (tick := tick) allocation m) := rawAction allocation m e + have hmpos : 0 < m := lt_of_lt_of_le (by decide : 0 < 2) hm + have heq : ((OrbitCounting.orbitSet (G := Symmetries (K := K) (tick := tick) allocation m) w).filter + (fun v => ¬completeKeep allocation m ε side v)) = + ((OrbitCounting.orbitSet (G := Symmetries (K := K) (tick := tick) allocation m) w).filter + (fun v => ¬AllFieldHistoryRawMasks.rawPass allocation m ε side v)) := by + apply Finset.filter_congr + intro v hv + obtain ⟨g, _, rfl⟩ := Finset.mem_image.mp hv + rw [used_keep_iff_rawPass F allocation hmpos hε.le e side (g • w) + (used_smul F allocation m ε e side w g hw)] + rw [heq] + exact raw_pair_loss_le allocation hm hε side e w + (used_windows F allocation m ε e side w hw) + +def holedIdeal (F : Type*) [CommRing F] (allocation : Allocation) (m : ℕ) (ε : ℝ) + (e : Targets (K := K) (tick := tick) allocation m) + (assigned : Fin 3 → Raw (K := K) (tick := tick) allocation m → Prop) : + Tensor F (Raw (K := K) (tick := tick) allocation m) (Raw (K := K) (tick := tick) allocation m) (Raw (K := K) (tick := tick) allocation m) := + ExactRecovery.delete (ideal F allocation m ε e) + (fun w => assigned 0 w ∧ completeKeep allocation m ε 0 w) + (fun w => assigned 1 w ∧ completeKeep allocation m ε 1 w) + (fun w => assigned 2 w ∧ completeKeep allocation m ε 2 w) + +theorem ideal_eq_delete_source (F : Type*) [CommRing F] (allocation : Allocation) + (m : ℕ) (ε : ℝ) (e : Targets (K := K) (tick := tick) allocation m) : + ideal F allocation m ε e = ExactRecovery.delete (rawSource F allocation m) + (idealSide allocation m ε 0 e) (idealSide allocation m ε 1 e) + (idealSide allocation m ε 2 e) := by + have hdelete (cx cy cz wx wy wz : Prop) (q : F) + [dw : Decidable (wx ∧ wy ∧ wz)] [dc : Decidable (cx ∧ cy ∧ cz)] + (dk : Decidable ((cx ∧ wx) ∧ (cy ∧ wy) ∧ (cz ∧ wz))) : + @ite F (wx ∧ wy ∧ wz) dw (@ite F (cx ∧ cy ∧ cz) dc q 0) 0 = + @ite F ((cx ∧ wx) ∧ (cy ∧ wy) ∧ (cz ∧ wz)) dk q 0 := by + let _ : Decidable ((cx ∧ wx) ∧ (cy ∧ wy) ∧ (cz ∧ wz)) := dk + by_cases hw : wx ∧ wy ∧ wz + · by_cases hc : cx ∧ cy ∧ cz + · have hk : (cx ∧ wx) ∧ (cy ∧ wy) ∧ (cz ∧ wz) := + ⟨⟨hc.1, hw.1⟩, ⟨hc.2.1, hw.2.1⟩, ⟨hc.2.2, hw.2.2⟩⟩ + rw [ite_eq_left hw, ite_eq_left hc, ite_eq_left hk] + · have hk : ¬((cx ∧ wx) ∧ (cy ∧ wy) ∧ (cz ∧ wz)) := + fun h => hc ⟨h.1.1, h.2.1.1, h.2.2.1⟩ + rw [ite_eq_left hw, ite_eq_right hc, ite_eq_right hk] + · have hk : ¬((cx ∧ wx) ∧ (cy ∧ wy) ∧ (cz ∧ wz)) := + fun h => hw ⟨h.1.2, h.2.1.2, h.2.2.2⟩ + rw [ite_eq_right hw, ite_eq_right hk] + funext x y z + simp only [ideal, JointCanonicalization.ideal, coarseIdeal, rawSource, + idealSide, ExactRecovery.delete] + exact @hdelete _ _ _ _ _ _ _ _ _ _ + +@[simp] theorem sideVariable_zero {V : Type*} (x y z : V) : + sideVariable 0 x y z = x := rfl + +@[simp] theorem sideVariable_one {V : Type*} (x y z : V) : + sideVariable 1 x y z = y := rfl + +@[simp] theorem sideVariable_two {V : Type*} (x y z : V) : + sideVariable 2 x y z = z := rfl + +theorem branch_eq_holedIdeal {I : Type*} (F : Type*) [CommRing F] + (allocation : Allocation) (m : ℕ) (ε : ℝ) + (a : JointExtraction.Assignment (Raw (K := K) (tick := tick) allocation m) + (Raw (K := K) (tick := tick) allocation m) (Raw (K := K) (tick := tick) allocation m) I) + (i : I) (e : Targets (K := K) (tick := tick) allocation m) + (hx : ∀ w, a.x w = some i → idealSide allocation m ε 0 e w) + (hy : ∀ w, a.y w = some i → idealSide allocation m ε 1 e w) + (hz : ∀ w, a.z w = some i → idealSide allocation m ε 2 e w) : + JointExtraction.branch + (ExactRecovery.delete (rawSource F allocation m) + (completeKeep allocation m ε 0) (completeKeep allocation m ε 1) + (completeKeep allocation m ε 2)) a i = + holedIdeal F allocation m ε e + (fun side w => sideVariable side (a.x w = some i) (a.y w = some i) (a.z w = some i)) := by + funext x y z + simp only [holedIdeal, sideVariable_zero, sideVariable_one, sideVariable_two] + by_cases ha : a.x x = some i ∧ a.y y = some i ∧ a.z z = some i + · have hix := hx x ha.1 + have hiy := hy y ha.2.1 + have hiz := hz z ha.2.2 + rw [JointExtraction.branch, ite_eq_left ha, ideal_eq_delete_source] + simp only [ExactRecovery.delete, hix, hiy, hiz, ha.1, ha.2.1, ha.2.2, + true_and, ite_true] + · have hnot : ¬((a.x x = some i ∧ completeKeep allocation m ε 0 x) ∧ + (a.y y = some i ∧ completeKeep allocation m ε 1 y) ∧ + (a.z z = some i ∧ completeKeep allocation m ε 2 z)) := + fun h => ha ⟨h.1.1, h.2.1.1, h.2.2.1⟩ + rw [JointExtraction.branch, ite_eq_right ha] + simp only [ExactRecovery.delete, ite_eq_right hnot] + +theorem support_filter_eq {F X Y Z : Type*} [Zero F] + [Fintype X] [Fintype Y] [Fintype Z] (Q : Tensor F X Y Z) : + (@Finset.filter (X × Y × Z) (fun p => Q p.1 p.2.1 p.2.2 ≠ 0) + (Classical.decPred _) Finset.univ) = RecoverySupport.support Q := by + ext p + simp only [RecoverySupport.support, Finset.mem_filter] + +theorem repair_selected (F : Type*) [CommRing F] (allocation : Allocation) + {m : ℕ} {ε : ℝ} (hε : 0 < ε) + (hm : minimumDilation (K := K) (tick := tick) allocation ε ≤ m) + (e : Targets (K := K) (tick := tick) allocation m) + (assigned : Fin 3 → Raw (K := K) (tick := tick) allocation m → Prop) + (hcollision : + letI : MulAction (Symmetries (K := K) (tick := tick) allocation m) (Raw (K := K) (tick := tick) allocation m) := rawAction allocation m e + ∀ side w, Used F allocation m ε e side w → + (((OrbitCounting.orbitSet (G := Symmetries (K := K) (tick := tick) allocation m) w).filter + (fun v => completeKeep allocation m ε side v ∧ ¬assigned side v)).card : ℝ) / + (OrbitCounting.orbitSet (G := Symmetries (K := K) (tick := tick) allocation m) w).card ≤ 6 / m) : + InverseLinearRecovery.RecoveredBy (ideal F allocation m ε e) + (holedIdeal F allocation m ε e assigned) (shiftCount (K := K) (tick := tick) allocation ε m) := by + let _ : MulAction (Symmetries (K := K) (tick := tick) allocation m) (Raw (K := K) (tick := tick) allocation m) := rawAction allocation m e + have hm' := minimumDilation_spec allocation ε hm + have hc : 0 < AllFieldHistoryMasks.lossConstant (K := K) (tick := tick) allocation ε + 6 := by + have := AllFieldHistoryMasks.lossConstant_nonneg (K := K) (tick := tick) allocation ε + linarith + have hloss (side : Fin 3) (w : Raw (K := K) (tick := tick) allocation m) + (hw : Used F allocation m ε e side w) : + (((OrbitCounting.orbitSet (G := Symmetries (K := K) (tick := tick) allocation m) w).filter + (fun v => ¬(assigned side v ∧ completeKeep allocation m ε side v))).card : ℝ) / + (OrbitCounting.orbitSet (G := Symmetries (K := K) (tick := tick) allocation m) w).card ≤ + (AllFieldHistoryMasks.lossConstant (K := K) (tick := tick) allocation ε + 6) / m := by + have heq : ((OrbitCounting.orbitSet (G := Symmetries (K := K) (tick := tick) allocation m) w).filter + (fun v => ¬(assigned side v ∧ completeKeep allocation m ε side v))) = + ((OrbitCounting.orbitSet (G := Symmetries (K := K) (tick := tick) allocation m) w).filter + (fun v => ¬(completeKeep allocation m ε side v ∧ assigned side v))) := by + ext v + simp only [Finset.mem_filter] + exact and_congr Iff.rfl (not_congr and_comm) + rw [heq] + rw [OrbitLoss.missing_fraction_partition + (OrbitCounting.orbitSet (G := Symmetries (K := K) (tick := tick) allocation m) w) + (completeKeep allocation m ε side) (assigned side), add_div] + exact add_le_add (deterministic_loss_le F allocation hm'.1 hε e side w hw) + (hcollision side w hw) + unfold holedIdeal shiftCount + apply InverseLinearRecovery.repair_inverse_linear (G := Symmetries (K := K) (tick := tick) allocation m) + (ideal F allocation m ε e) + (fun w => assigned 0 w ∧ completeKeep allocation m ε 0 w) + (fun w => assigned 1 w ∧ completeKeep allocation m ε 1 w) + (fun w => assigned 2 w ∧ completeKeep allocation m ε 2 w) + (ideal_smul F allocation m ε e) (supportRate_pos (K := K) (tick := tick) allocation).le hc hm'.2 + · rw [support_filter_eq] + exact raw_support_card_le_exp allocation m (ideal F allocation m ε e) + · intro x hx + obtain ⟨y, z, hq⟩ := hx + exact hloss 0 x ⟨x, y, z, hq, rfl⟩ + · intro y hy + obtain ⟨x, z, hq⟩ := hy + exact hloss 1 y ⟨x, y, z, hq, rfl⟩ + · intro z hz + obtain ⟨x, y, hq⟩ := hz + exact hloss 2 z ⟨x, y, z, hq, rfl⟩ + +theorem repair_selected_branch {I : Type*} (F : Type*) [CommRing F] + (allocation : Allocation) {m : ℕ} {ε : ℝ} (hε : 0 < ε) + (hm : minimumDilation (K := K) (tick := tick) allocation ε ≤ m) + (a : JointExtraction.Assignment (Raw (K := K) (tick := tick) allocation m) + (Raw (K := K) (tick := tick) allocation m) (Raw (K := K) (tick := tick) allocation m) I) + (i : I) (e : Targets (K := K) (tick := tick) allocation m) + (hx : ∀ w, a.x w = some i → idealSide allocation m ε 0 e w) + (hy : ∀ w, a.y w = some i → idealSide allocation m ε 1 e w) + (hz : ∀ w, a.z w = some i → idealSide allocation m ε 2 e w) + (hcollision : + letI : MulAction (Symmetries (K := K) (tick := tick) allocation m) (Raw (K := K) (tick := tick) allocation m) := rawAction allocation m e + ∀ side w, Used F allocation m ε e side w → + (((OrbitCounting.orbitSet (G := Symmetries (K := K) (tick := tick) allocation m) w).filter + (fun v => completeKeep allocation m ε side v ∧ + ¬sideVariable side (a.x v = some i) (a.y v = some i) (a.z v = some i))).card : ℝ) / + (OrbitCounting.orbitSet (G := Symmetries (K := K) (tick := tick) allocation m) w).card ≤ 6 / m) : + InverseLinearRecovery.RecoveredBy (ideal F allocation m ε e) + (JointExtraction.branch + (ExactRecovery.delete (rawSource F allocation m) + (completeKeep allocation m ε 0) (completeKeep allocation m ε 1) + (completeKeep allocation m ε 2)) a i) (shiftCount (K := K) (tick := tick) allocation ε m) := by + rw [branch_eq_holedIdeal F allocation m ε a i e hx hy hz] + exact repair_selected F allocation hε hm e _ hcollision + +end MatrixMultiplication.AllFieldHistoryRecovery + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldHistory/RecoveryBudget.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldHistory/RecoveryBudget.lean new file mode 100644 index 0000000000000000000000000000000000000000..336994e0aa4ac62470865b8612e82b5305aa9e4f --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldHistory/RecoveryBudget.lean @@ -0,0 +1,52 @@ +import OAI.LinearAlgebra.MatrixMultiplication.FieldHistory.MaskCore +import OAI.LinearAlgebra.MatrixMultiplication.Recovery.InverseLinearRecovery + +namespace OAI + +/-! Finite extraction histories, inherited masks and recovery bounds. -/ + +noncomputable section + +namespace MatrixMultiplication.AllFieldHistoryRecovery + +open AllFieldHistory AllFieldHistorySupport + +attribute [local instance] Classical.propDecidable Classical.decEq + +variable {K tick : ℕ} + +def minimumDilation (allocation : Allocation) (ε : ℝ) : ℕ := + Nat.ceil (3 * (AllFieldHistoryMasks.lossConstant (K := K) (tick := tick) allocation ε + 6)) + 2 + +theorem minimumDilation_spec (allocation : Allocation) (ε : ℝ) {m : ℕ} + (hm : minimumDilation (K := K) (tick := tick) allocation ε ≤ m) : + 2 ≤ m ∧ + 3 * (AllFieldHistoryMasks.lossConstant (K := K) (tick := tick) allocation ε + 6) < + (m : ℝ) := by + constructor + · exact (Nat.le_add_left 2 _).trans hm + · have hc := Nat.le_ceil + (3 * (AllFieldHistoryMasks.lossConstant (K := K) (tick := tick) allocation ε + 6)) + have hm' : (Nat.ceil + (3 * (AllFieldHistoryMasks.lossConstant (K := K) (tick := tick) allocation ε + 6)) : ℝ) + 2 ≤ m := by + exact_mod_cast hm + linarith + +def shiftCount (allocation : Allocation) (ε : ℝ) (m : ℕ) : ℕ := + RecoveryGrowth.shiftCount (supportRate (K := K) (tick := tick) allocation) + (AllFieldHistoryMasks.lossConstant (K := K) (tick := tick) allocation ε + 6) m + +theorem replication_subexponential (allocation : Allocation) (ε : ℝ) : + Filter.Tendsto (fun m : ℕ => + Real.log (Fintype.card (InverseLinearRecovery.MaskRectangles + (shiftCount (K := K) (tick := tick) allocation ε m))) / m) + Filter.atTop (nhds 0) := + InverseLinearRecovery.subexponential_copies (supportRate_pos allocation) + (by have := AllFieldHistoryMasks.lossConstant_nonneg (K := K) (tick := tick) allocation ε + linarith) + +end MatrixMultiplication.AllFieldHistoryRecovery + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldHistory/RecoveryCore.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldHistory/RecoveryCore.lean new file mode 100644 index 0000000000000000000000000000000000000000..af395081e0ad58c8af80411491e5865041da7574 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldHistory/RecoveryCore.lean @@ -0,0 +1,110 @@ +import OAI.LinearAlgebra.MatrixMultiplication.FieldHistory.MaskCore +import OAI.LinearAlgebra.MatrixMultiplication.FieldHistory.RawMasks +import OAI.LinearAlgebra.MatrixMultiplication.FieldHistory.IncomingCore +import OAI.LinearAlgebra.MatrixMultiplication.JointExtraction.CanonicalMixed +import OAI.LinearAlgebra.MatrixMultiplication.Recovery.EquivOrbitTransport + +namespace OAI + +/-! Finite extraction histories, inherited masks and recovery bounds. -/ + +noncomputable section + +namespace MatrixMultiplication.AllFieldHistoryRecovery + +open MatrixMultiplication.Foundation AllFieldHistory AllFieldHistoryChildLaws +open AllFieldHistorySupport JointPopulation JointCanonicalization JointCanonicalCW +open PermutationMatching +open scoped BigOperators + +attribute [local instance] Classical.propDecidable Classical.decEq + +variable {K tick : ℕ} + +theorem halfLength_le_eight (h : Active K tick) : activeHalfLength h ≤ 8 := by + rcases h with ⟨⟨w, phi⟩, hh⟩ + cases w <;> norm_num [activeHalfLength, Work.halfLength] + +abbrev Raw (allocation : Allocation) (m : ℕ) := + ActiveRawPairs (K := K) (tick := tick) allocation m + +abbrev Targets (allocation : Allocation) (m : ℕ) := + Target (activeCounts (K := K) (tick := tick) allocation m) + +abbrev Symmetries (allocation : Allocation) (m : ℕ) := + HalfClassPermutations (ClassPositions + (activeCounts (K := K) (tick := tick) allocation m)) + +def childStatistic (_side : Fin 3) (c : Active K tick × JointPopulation.Shape) := + statistic c.1 + +def leftPrescription (side : Fin 3) (c : Active K tick × JointPopulation.Shape) := + leftLaw c.1 c.2 side + +def rightPrescription (side : Fin 3) (c : Active K tick × JointPopulation.Shape) := + rightLaw c.1 c.2 side + +def outputWidth (ε : ℝ) (_side : Fin 3) (c : Active K tick × JointPopulation.Shape) := + AllFieldHistoryMasks.childWidth ε c.1 + +def parents (F : Type*) [CommRing F] (h : Active K tick) := + JointCanonicalMixed.inputTensor (F := F) activeHalfLength activeHalfLength + activeParentShape (fun _ => true) h + +def rawSource (F : Type*) [CommRing F] (allocation : Allocation) (m : ℕ) : + Tensor F (Raw (K := K) (tick := tick) allocation m) + (Raw (K := K) (tick := tick) allocation m) (Raw (K := K) (tick := tick) allocation m) := + sourceTensor (activeCounts allocation m) (Left activeHalfLength) + (Right activeHalfLength) (parents F) + +def ideal (F : Type*) [CommRing F] (allocation : Allocation) (m : ℕ) (ε : ℝ) + (e : Targets (K := K) (tick := tick) allocation m) : + Tensor F (Raw (K := K) (tick := tick) allocation m) (Raw (K := K) (tick := tick) allocation m) (Raw (K := K) (tick := tick) allocation m) := + JointCanonicalization.ideal (activeCounts allocation m) + (Left activeHalfLength) (Right activeHalfLength) (parents F) + (coarse activeHalfLength activeHalfLength halfLength_le_eight) + childStatistic childStatistic leftPrescription rightPrescription + (outputWidth ε) (outputWidth ε) e + +def coordinates (allocation : Allocation) (m : ℕ) + (e : Targets (K := K) (tick := tick) allocation m) := + pairEquiv (activeCounts allocation m) (Left activeHalfLength) + (Right activeHalfLength) e + +def canonical (F : Type*) [CommRing F] (allocation : Allocation) (m : ℕ) (ε : ℝ) : + Tensor F (AllFieldHistoryMasks.Words (K := K) (tick := tick) allocation m) + (AllFieldHistoryMasks.Words (K := K) (tick := tick) allocation m) (AllFieldHistoryMasks.Words (K := K) (tick := tick) allocation m) := + canonicalIdeal (activeCounts allocation m) (Left activeHalfLength) + (Right activeHalfLength) (parents F) + (coarse activeHalfLength activeHalfLength halfLength_le_eight) + childStatistic childStatistic leftPrescription rightPrescription + (outputWidth ε) (outputWidth ε) + +@[instance_reducible] +def rawAction (allocation : Allocation) (m : ℕ) + (e : Targets (K := K) (tick := tick) allocation m) : + MulAction (Symmetries (K := K) (tick := tick) allocation m) (Raw (K := K) (tick := tick) allocation m) := + EquivOrbitTransport.action (coordinates allocation m e) + +def completeKeep (allocation : Allocation) (m : ℕ) (ε : ℝ) (side : Fin 3) + (w : Raw (K := K) (tick := tick) allocation m) : Prop := + JointCanonicalMixed.sideMask (activeCounts allocation m) + activeHalfLength activeHalfLength halfLength_le_eight side w ∧ + AllFieldHistoryIncomingMasks.received allocation m ε side w ∧ + AllFieldHistoryRawMasks.rawPass allocation m ε side w + +def sideVariable {V : Type*} (side : Fin 3) (x y z : V) : V := ![x, y, z] side + +def idealSide (allocation : Allocation) (m : ℕ) (ε : ℝ) (side : Fin 3) + (e : Targets (K := K) (tick := tick) allocation m) (w : Raw (K := K) (tick := tick) allocation m) : Prop := + coarseMask (activeCounts allocation m) (Left activeHalfLength) (Right activeHalfLength) + (coarse activeHalfLength activeHalfLength halfLength_le_eight) side e w ∧ + rawWindows (activeCounts allocation m) (Left activeHalfLength) (Right activeHalfLength) + (childStatistic side) (childStatistic side) (leftPrescription side) + (rightPrescription side) (outputWidth ε side) (outputWidth ε side) e w + +end MatrixMultiplication.AllFieldHistoryRecovery + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldHistory/Regrouping.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldHistory/Regrouping.lean new file mode 100644 index 0000000000000000000000000000000000000000..44baac666a2ccbdb3a09d9fef3290f86a61a5c49 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldHistory/Regrouping.lean @@ -0,0 +1,166 @@ +import OAI.LinearAlgebra.MatrixMultiplication.FieldHistory.Tensors + +namespace OAI + +/-! Finite extraction histories, inherited masks and recovery bounds. -/ + +noncomputable section + +namespace MatrixMultiplication.AllFieldHistoryRegrouping + +open MatrixMultiplication.Foundation AllFieldHistory AllFieldFiniteFamily +open scoped BigOperators Classical +attribute [local instance] Classical.propDecidable Classical.decEq + +variable {K tick : ℕ} (allocation : Allocation) (m : ℕ) + +abbrev StateWords (tick : ℕ) := ∀ h : State K tick, HistoryWord allocation m h.val +abbrev DueWords := ∀ h : DueState K tick, HistoryWord allocation m h.val.val +abbrev CarriedWords := ∀ h : Carried K tick, HistoryWord allocation m h.val.val +abbrev ActiveWords := ∀ h : Active K tick, + HistoryWord allocation m (activeSourceEquiv h).val.val +abbrev ProducedWords := ∀ h : Produced K tick, HistoryWord allocation m h.val + +instance dueWordsFintype : Fintype (DueWords (K := K) (tick := tick) allocation m) := + inferInstanceAs (Fintype (∀ h : DueState K tick, HistoryWord allocation m h.val.val)) + +instance carriedWordsFintype : Fintype (CarriedWords (K := K) (tick := tick) allocation m) := + inferInstanceAs (Fintype (∀ h : Carried K tick, HistoryWord allocation m h.val.val)) + +instance activeWordsFintype : Fintype (ActiveWords (K := K) (tick := tick) allocation m) := + inferInstanceAs (Fintype (∀ h : Active K tick, + HistoryWord allocation m (activeSourceEquiv h).val.val)) + +instance producedWordsFintype : Fintype (ProducedWords (K := K) (tick := tick) allocation m) := + inferInstanceAs (Fintype (∀ h : Produced K tick, HistoryWord allocation m h.val)) + +def carriedTensor (F : Type*) [Field F] (ε : ℝ) : + Tensor F (CarriedWords (K := K) (tick := tick) allocation m) + (CarriedWords (K := K) (tick := tick) allocation m) (CarriedWords (K := K) (tick := tick) allocation m) := + CommonDimensions.familyProduct (fun h : Carried K tick => + historyTensor F allocation m ε h.val.val) + +def activeTensor (F : Type*) [Field F] (ε : ℝ) : + Tensor F (ActiveWords (K := K) (tick := tick) allocation m) + (ActiveWords (K := K) (tick := tick) allocation m) (ActiveWords (K := K) (tick := tick) allocation m) := + CommonDimensions.familyProduct (fun h : Active K tick => + historyTensor F allocation m ε (activeSourceEquiv h).val.val) + +def producedTensor (F : Type*) [Field F] (ε : ℝ) : + Tensor F (ProducedWords (K := K) (tick := tick) allocation m) + (ProducedWords (K := K) (tick := tick) allocation m) (ProducedWords (K := K) (tick := tick) allocation m) := + CommonDimensions.familyProduct (fun h : Produced K tick => + historyTensor F allocation m ε h.val) + +def toState (x : DueWords (K := K) (tick := tick) allocation m × + CarriedWords (K := K) (tick := tick) allocation m) : StateWords (K := K) allocation m tick := + fun h => if hd : due tick h.val.1 then x.1 ⟨h, hd⟩ else x.2 ⟨h, hd⟩ + +@[simp] theorem toState_due + (x : DueWords (K := K) (tick := tick) allocation m × CarriedWords (K := K) (tick := tick) allocation m) + (h : DueState K tick) : toState (K := K) (tick := tick) allocation m x h.val = x.1 h := by + simp only [toState, dite_eq_left h.property] + +@[simp] theorem toState_carried + (x : DueWords (K := K) (tick := tick) allocation m × CarriedWords (K := K) (tick := tick) allocation m) + (h : Carried K tick) : toState (K := K) (tick := tick) allocation m x h.val = x.2 h := by + simp only [toState, dite_eq_right h.property] + +def dueTensorAt (F : Type*) [Field F] (ε : ℝ) : + Tensor F (DueWords (K := K) (tick := tick) allocation m) + (DueWords (K := K) (tick := tick) allocation m) (DueWords (K := K) (tick := tick) allocation m) := + CommonDimensions.familyProduct (fun h : DueState K tick => + historyTensor F allocation m ε h.val.val) + +theorem split_coefficient (F : Type*) [Field F] (ε : ℝ) + (x y z : DueWords (K := K) (tick := tick) allocation m × CarriedWords (K := K) (tick := tick) allocation m) : + stateTensor F (K := K) allocation m ε tick (toState (K := K) (tick := tick) allocation m x) + (toState (K := K) (tick := tick) allocation m y) (toState (K := K) (tick := tick) allocation m z) = + Tensor.product (dueTensorAt (K := K) (tick := tick) allocation m F ε) (carriedTensor (K := K) (tick := tick) allocation m F ε) x y z := by + change (∏ h : State K tick, historyTensor F allocation m ε h.val + (toState (K := K) (tick := tick) allocation m x h) (toState (K := K) (tick := tick) allocation m y h) (toState (K := K) (tick := tick) allocation m z h)) = _ + rw [← Fintype.prod_subtype_mul_prod_subtype (fun h : State K tick => due tick h.val.1)] + simp only [toState_due, toState_carried] + rfl + +def splitMap (F : Type*) [Field F] (ε : ℝ) : + LocalMap (stateTensor F (K := K) allocation m ε tick) + (Tensor.product (dueTensorAt (K := K) (tick := tick) allocation m F ε) + (carriedTensor (K := K) (tick := tick) allocation m F ε)) where + x := fun x s => if s = toState (K := K) (tick := tick) allocation m x then 1 else 0 + y := fun y s => if s = toState (K := K) (tick := tick) allocation m y then 1 else 0 + z := fun z s => if s = toState (K := K) (tick := tick) allocation m z then 1 else 0 + coefficient := by + rw [← Tensor.pullback_eq_restrict] + funext x y z + exact split_coefficient allocation m F ε x y z + +def toDue (x : ActiveWords (K := K) (tick := tick) allocation m) : + DueWords (K := K) (tick := tick) allocation m := + Equiv.piCongrLeft (fun h : DueState K tick => HistoryWord allocation m h.val.val) + activeSourceEquiv x + +theorem active_coefficient (F : Type*) [Field F] (ε : ℝ) + (x y z : ActiveWords (K := K) (tick := tick) allocation m) : + dueTensorAt (K := K) (tick := tick) allocation m F ε (toDue (K := K) (tick := tick) allocation m x) (toDue (K := K) (tick := tick) allocation m y) + (toDue (K := K) (tick := tick) allocation m z) = activeTensor (K := K) (tick := tick) allocation m F ε x y z := by + change (∏ h : DueState K tick, historyTensor F allocation m ε h.val.val + (toDue (K := K) (tick := tick) allocation m x h) (toDue (K := K) (tick := tick) allocation m y h) (toDue (K := K) (tick := tick) allocation m z h)) = _ + rw [← activeSourceEquiv.prod_comp] + unfold toDue + simp only [Equiv.piCongrLeft_apply_apply] + rfl + +def activeMap (F : Type*) [Field F] (ε : ℝ) : + LocalMap (dueTensorAt (K := K) (tick := tick) allocation m F ε) + (activeTensor (K := K) (tick := tick) allocation m F ε) where + x := fun x s => if s = toDue (K := K) (tick := tick) allocation m x then 1 else 0 + y := fun y s => if s = toDue (K := K) (tick := tick) allocation m y then 1 else 0 + z := fun z s => if s = toDue (K := K) (tick := tick) allocation m z then 1 else 0 + coefficient := by + rw [← Tensor.pullback_eq_restrict] + funext x y z + exact active_coefficient allocation m F ε x y z + +def activeCarriedMap (F : Type*) [Field F] (ε : ℝ) : + LocalMap (stateTensor F (K := K) allocation m ε tick) + (Tensor.product (activeTensor (K := K) (tick := tick) allocation m F ε) + (carriedTensor (K := K) (tick := tick) allocation m F ε)) := + (splitMap (K := K) (tick := tick) allocation m F ε).comp + ((activeMap (K := K) (tick := tick) allocation m F ε).product + (LocalMap.identity (carriedTensor (K := K) (tick := tick) allocation m F ε))) + +def fromNext (x : StateWords (K := K) allocation m (tick + 1)) : + ProducedWords (K := K) (tick := tick) allocation m × CarriedWords (K := K) (tick := tick) allocation m := + (fun h => x (stateTransition.symm (.inr h)), + fun h => x (stateTransition.symm (.inl h))) + +theorem next_coefficient (F : Type*) [Field F] (ε : ℝ) + (x y z : StateWords (K := K) allocation m (tick + 1)) : + Tensor.product (producedTensor (K := K) (tick := tick) allocation m F ε) + (carriedTensor (K := K) (tick := tick) allocation m F ε) (fromNext (K := K) (tick := tick) allocation m x) + (fromNext (K := K) (tick := tick) allocation m y) (fromNext (K := K) (tick := tick) allocation m z) = + stateTensor F (K := K) allocation m ε (tick + 1) x y z := by + change _ = ∏ h : State K (tick + 1), historyTensor F allocation m ε h.val + (x h) (y h) (z h) + rw [← stateTransition.symm.prod_comp] + rw [Fintype.prod_sum_type] + exact mul_comm _ _ + +def nextMap (F : Type*) [Field F] (ε : ℝ) : + LocalMap (Tensor.product (producedTensor (K := K) (tick := tick) allocation m F ε) + (carriedTensor (K := K) (tick := tick) allocation m F ε)) + (stateTensor F (K := K) allocation m ε (tick + 1)) := by + apply LocalMap.ofExists + refine ⟨_, _, _, (Tensor.pullback_eq_restrict + (fromNext (K := K) (tick := tick) allocation m) + (fromNext (K := K) (tick := tick) allocation m) + (fromNext (K := K) (tick := tick) allocation m) _).symm.trans ?_⟩ + funext x y z + exact next_coefficient allocation m F ε x y z + +end MatrixMultiplication.AllFieldHistoryRegrouping + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldHistory/Schedule.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldHistory/Schedule.lean new file mode 100644 index 0000000000000000000000000000000000000000..218f1daab6d4c64a06f4db86ab6a9139803d9288 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldHistory/Schedule.lean @@ -0,0 +1,178 @@ +import OAI.LinearAlgebra.MatrixMultiplication.FieldHistory.Populations + +namespace OAI + +/-! Finite extraction histories, inherited masks and recovery bounds. -/ + +noncomputable section + +namespace MatrixMultiplication.AllFieldHistory + +open AllFieldParameters +open scoped BigOperators +attribute [local instance] Classical.propDecidable Classical.decEq + +def initialAncestor {K : ℕ} : CanonicalHistory K → Initial K + | .initial h => h + | .afterA h => h.1.val + | .afterB h => h.1.val.1.val + | .partC h => h.1.val.1.val.1.val + | .afterC h => h.1.1.val.1.val.1.val + +def ancestrySplits {K : ℕ} : CanonicalHistory K → List (Shape × Bool) + | .initial _ => [] + | .afterA h => [(aSplit h, h.2.2)] + | .afterB h => [(aSplit h.1.val, h.1.val.2.2), (bSplit h, h.2.2)] + | .partC h => [(aSplit h.1.val.1.val, h.1.val.1.val.2.2), + (bSplit h.1.val, h.1.val.2.2)] + | .afterC h => [(aSplit h.1.1.val.1.val, h.1.1.val.1.val.2.2), + (bSplit h.1.1.val, h.1.1.val.2.2), (cSplit h, h.2.2)] + +def ancestrySubdivisions {K : ℕ} : CanonicalHistory K → List ℕ + | .initial _ | .afterA _ | .afterB _ => [] + | .partC h => [h.2.val] + | .afterC h => [h.1.2.val] + +def historyKey {K : ℕ} (h : History K) : JointPopulation.HistoryKey where + lot := (initialAncestor h.1).1.val + initialShape := initialShape (initialAncestor h.1) + physicalPlacement := h.2 + parentSplits := ancestrySplits h.1 + subdivisions := ancestrySubdivisions h.1 + +theorem placement_preserved {K : ℕ} (h : CanonicalHistory K) (phi psi : Placement) + (heq : historyKey (h, phi) = historyKey (h, psi)) : phi = psi := + congrArg JointPopulation.HistoryKey.physicalPlacement heq + +inductive Work (K : ℕ) where + | stageA (h : InitialPositive K) + | stageB (h : APositive K) + | stageC (h : PartC K) + deriving Fintype + +def Work.source {K : ℕ} : Work K → CanonicalHistory K + | .stageA h => .initial h.val + | .stageB h => .afterA h.val + | .stageC h => .partC h + +def Work.stage {K : ℕ} : Work K → Fin 3 + | .stageA _ => 0 + | .stageB _ => 1 + | .stageC _ => 2 + +def Work.lot {K : ℕ} (w : Work K) : Fin K := (initialAncestor w.source).1 + +def Work.halfLength {K : ℕ} : Work K → ℕ + | .stageA _ => 4 + | .stageB _ => 2 + | .stageC _ => 1 + +def Work.parentShape {K : ℕ} : Work K → Shape + | .stageA h => initialShape h.val + | .stageB h => aShape h.val + | .stageC h => cShapeParent h + +def Work.Branch {K : ℕ} : Work K → Type + | .stageA h => ASplit h + | .stageB h => BSplit h + | .stageC _ => Fin 4 + +instance {K : ℕ} (w : Work K) : Fintype w.Branch := by + cases w <;> dsimp [Work.Branch] <;> infer_instance + +def Work.child {K : ℕ} (w : Work K) (b : w.Branch) (right : Bool) : CanonicalHistory K := + match w with + | .stageA h => .afterA ⟨h, b, right⟩ + | .stageB h => .afterB ⟨h, b, right⟩ + | .stageC h => .afterC (h, b, right) + +def Work.splitShape {K : ℕ} (w : Work K) (b : w.Branch) : Shape := + match w with + | .stageA h => aSplit ⟨h, b, false⟩ + | .stageB h => bSplit ⟨h, b, false⟩ + | .stageC h => cSplit (h, b, false) + +abbrev PlacedWork (K : ℕ) := Work K × Placement +abbrev Active (K tick : ℕ) := {w : PlacedWork K // + FiniteSchedule.lotTick w.1.lot w.1.stage = tick} + +theorem active_tick_lt {K tick : ℕ} (h : Active K tick) : tick < K + 2 := by + rw [← h.property] + exact FiniteSchedule.lotTick_lt h.val.1.lot h.val.1.stage + +def branchPopulation {K : ℕ} (allocation : Allocation) (dilation : ℕ) + (w : PlacedWork K) (b : w.1.Branch) : ℕ := + population allocation dilation (w.1.child b false, w.2) + +theorem branchPopulation_half {K : ℕ} (allocation : Allocation) (dilation : ℕ) + (w : PlacedWork K) (b : w.1.Branch) (right : Bool) : + population allocation dilation (w.1.child b right, w.2) = + branchPopulation allocation dilation w b := by + rcases w with ⟨w, phi⟩ + cases right with + | false => rfl + | true => + cases w with + | stageA h => exact (a_half_counts_eq allocation dilation h b phi).symm + | stageB h => exact (b_half_counts_eq allocation dilation h b phi).symm + | stageC h => exact (c_half_counts_eq allocation dilation h b phi).symm + +theorem branchPopulation_sum {K : ℕ} (allocation : Allocation) (dilation : ℕ) + (w : PlacedWork K) : + (∑ b : w.1.Branch, branchPopulation allocation dilation w b) = + population allocation dilation (w.1.source, w.2) := by + rcases w with ⟨w, phi⟩ + cases w with + | stageA h => exact a_population_transition allocation dilation h false phi + | stageB h => exact b_population_transition allocation dilation h false phi + | stageC h => exact c_population_transition allocation dilation h false phi + +def terminal {K : ℕ} : CanonicalHistory K → Prop + | .initial h => initialShape h ∉ positiveInitial + | .afterA h => aShape h ∉ positiveSecond + | .afterB h => positive (bShape h) ≠ true + | .partC _ => False + | .afterC _ => True + +def resident {K : ℕ} (tick : ℕ) : CanonicalHistory K → Prop + | .initial h => initialShape h ∈ positiveInitial → tick ≤ h.1.val + | .afterA h => h.1.val.1.val + 1 ≤ tick ∧ + (aShape h ∈ positiveSecond → tick ≤ h.1.val.1.val + 1) + | .afterB h => h.1.val.1.val.1.val + 2 ≤ tick ∧ positive (bShape h) ≠ true + | .partC h => tick = h.1.val.1.val.1.val.1.val + 2 + | .afterC h => h.1.1.val.1.val.1.val.1.val + 3 ≤ tick + +abbrev State (K tick : ℕ) := {h : History K // resident tick h.1} + +theorem terminal_carries {K tick : ℕ} (h : CanonicalHistory K) + (hr : resident tick h) (ht : terminal h) : resident (tick + 1) h := by + cases h with + | initial h => exact fun hp => False.elim (ht hp) + | afterA h => exact ⟨by have := hr.1; omega, fun hp => False.elim (ht hp)⟩ + | afterB h => exact ⟨by have := hr.1; omega, hr.2⟩ + | partC h => exact False.elim ht + | afterC h => dsimp [resident] at hr ⊢; omega + +theorem work_source_resident {K : ℕ} (w : Work K) : + resident (FiniteSchedule.lotTick w.lot w.stage) w.source := by + cases w with + | stageA h => simp [resident, Work.source, Work.lot, Work.stage, + initialAncestor, FiniteSchedule.lotTick] + | stageB h => simp [resident, Work.source, Work.lot, Work.stage, + initialAncestor, FiniteSchedule.lotTick] + | stageC h => simp [resident, Work.source, Work.lot, Work.stage, + initialAncestor, FiniteSchedule.lotTick] + +theorem a_child_resident {K : ℕ} (h : InitialPositive K) (b : ASplit h) (right : Bool) : + resident (h.val.1.val + 1) (.afterA ⟨h, b, right⟩) := by + simp [resident] + +theorem c_child_resident {K : ℕ} (h : PartC K) (b : Fin 4) (right : Bool) : + resident ((Work.stageC h).lot.val + 3) (.afterC (h, b, right)) := by + simp [resident, Work.lot, Work.source, initialAncestor] + +end MatrixMultiplication.AllFieldHistory + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldHistory/Source.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldHistory/Source.lean new file mode 100644 index 0000000000000000000000000000000000000000..8d1f13e427ebcd5e2f20d12269a913bcb018074d --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldHistory/Source.lean @@ -0,0 +1,186 @@ +import OAI.LinearAlgebra.MatrixMultiplication.FieldHistory.Regrouping +import OAI.LinearAlgebra.MatrixMultiplication.FieldHistory.IncomingMasks +import OAI.LinearAlgebra.MatrixMultiplication.FieldHistory.RecoveryCore +import OAI.LinearAlgebra.MatrixMultiplication.FieldHistory.GroupMasks + +namespace OAI + +/-! Finite extraction histories, inherited masks and recovery bounds. -/ + +noncomputable section + +namespace MatrixMultiplication.AllFieldHistorySource + +open MatrixMultiplication.Foundation AllFieldHistory AllFieldFiniteFamily +open AllFieldHistoryRegrouping AllFieldHistoryIncomingMasks +open scoped BigOperators Classical +attribute [local instance] Classical.propDecidable Classical.decEq + +private def deleteWithPred {F : Type*} [Field F] {X Y Z : Type} + [Fintype X] [Fintype Y] [Fintype Z] + (source : Tensor F X Y Z) (px : X → Prop) (py : Y → Prop) (pz : Z → Prop) + [DecidablePred px] [DecidablePred py] [DecidablePred pz] : + LocalMap source (ExactRecovery.delete source px py pz) := by + let d := LocalMap.delete source px py pz + refine ⟨d.x, d.y, d.z, d.coefficient.trans ?_⟩ + funext x y z + unfold ExactRecovery.delete + split_ifs <;> rfl + +variable {K tick : ℕ} (allocation : Allocation) (m : ℕ) + +abbrev Raw := AllFieldHistoryRecovery.Raw (K := K) (tick := tick) allocation m + +def toActive (w : Raw (K := K) (tick := tick) allocation m) : + ActiveWords (K := K) (tick := tick) allocation m := fun h => incomingWord allocation m h w + +theorem parent_coefficient (F : Type*) [Field F] (h : Active K tick) + (x y z : Raw (K := K) (tick := tick) allocation m) : + Tensor.power + (CWStrands.shapeTensor (Fin (currentLength h.val.1.source)) + (currentPhysicalShape (h.val.1.source, h.val.2))) + (population allocation m (h.val.1.source, h.val.2)) + (incomingWord allocation m h x) (incomingWord allocation m h y) + (incomingWord allocation m h z) = + ∏ i : JointPopulation.Positions (activeCounts allocation m) h, + AllFieldHistoryRecovery.parents F h (x h i) (y h i) (z h i) := by + change (∏ p : Fin (population allocation m (h.val.1.source, h.val.2)), + CWStrands.shapeTensor _ _ (incomingWord allocation m h x p) + (incomingWord allocation m h y p) (incomingWord allocation m h z p)) = _ + refine ((sourcePositionsEquiv allocation m h).prod_comp (fun p => + CWStrands.shapeTensor (Fin (currentLength h.val.1.source)) + (currentPhysicalShape (h.val.1.source, h.val.2)) + (incomingWord allocation m h x p) (incomingWord allocation m h y p) + (incomingWord allocation m h z p))).symm.trans ?_ + apply Finset.prod_congr rfl + intro i _ + simp only [incomingWord, Equiv.symm_apply_apply] + erw [shapeTensor_joinHalves] + unfold AllFieldHistoryRecovery.parents JointCanonicalMixed.inputTensor + rw [ite_eq_left rfl] + unfold JointCanonicalCW.parentTensor currentPhysicalShape + rw [source_shape] + rfl + +def receivedSource (F : Type*) [Field F] (ε : ℝ) : + Tensor F (Raw (K := K) (tick := tick) allocation m) (Raw (K := K) (tick := tick) allocation m) (Raw (K := K) (tick := tick) allocation m) := + ExactRecovery.delete (AllFieldHistoryRecovery.rawSource F (K := K) (tick := tick) allocation m) + (received allocation m ε 0) (received allocation m ε 1) (received allocation m ε 2) + +theorem received_coefficient (F : Type*) [Field F] (ε : ℝ) + (x y z : Raw (K := K) (tick := tick) allocation m) : + activeTensor (K := K) (tick := tick) allocation m F ε (toActive allocation m x) (toActive allocation m y) + (toActive allocation m z) = receivedSource (K := K) (tick := tick) allocation m F ε x y z := by + change (∏ h : Active K tick, historyTensor F allocation m ε + (h.val.1.source, h.val.2) (incomingWord allocation m h x) + (incomingWord allocation m h y) (incomingWord allocation m h z)) = _ + unfold receivedSource ExactRecovery.delete + by_cases hp : received allocation m ε 0 x ∧ received allocation m ε 1 y ∧ + received allocation m ε 2 z + · rw [ite_eq_left hp] + change _ = ∏ h : Active K tick, ∏ i : JointPopulation.Positions (activeCounts allocation m) h, + AllFieldHistoryRecovery.parents F h (x h i) (y h i) (z h i) + apply Finset.prod_congr rfl + intro h _ + unfold historyTensor ExactRecovery.delete + rw [ite_eq_left ⟨hp.1 h, hp.2.1 h, hp.2.2 h⟩] + exact parent_coefficient allocation m F h x y z + · rw [ite_eq_right hp] + have hh : ∃ h : Active K tick, + ¬(residentMask allocation m ε (h.val.1.source, h.val.2) 0 (incomingWord allocation m h x) ∧ + residentMask allocation m ε (h.val.1.source, h.val.2) 1 (incomingWord allocation m h y) ∧ + residentMask allocation m ε (h.val.1.source, h.val.2) 2 (incomingWord allocation m h z)) := by + by_contra hn + apply hp + push Not at hn + exact ⟨fun h => (hn h).1, fun h => (hn h).2.1, fun h => (hn h).2.2⟩ + obtain ⟨h, hh⟩ := hh + apply Finset.prod_eq_zero (Finset.mem_univ h) + exact ite_eq_right hh + +def receivedMap (F : Type*) [Field F] (ε : ℝ) : + LocalMap (activeTensor (K := K) (tick := tick) allocation m F ε) + (receivedSource (K := K) (tick := tick) allocation m F ε) := by + apply LocalMap.ofExists + refine ⟨_, _, _, (Tensor.pullback_eq_restrict + (toActive (K := K) (tick := tick) allocation m) + (toActive (K := K) (tick := tick) allocation m) + (toActive (K := K) (tick := tick) allocation m) _).symm.trans ?_⟩ + funext x y z + exact received_coefficient allocation m F ε x y z + +def marginal (side : Fin 3) (w : Raw (K := K) (tick := tick) allocation m) : Prop := + JointCanonicalMixed.sideMask (activeCounts allocation m) activeHalfLength activeHalfLength + AllFieldHistoryRecovery.halfLength_le_eight side w + +def preparedSource (F : Type*) [Field F] (ε : ℝ) : + Tensor F (Raw (K := K) (tick := tick) allocation m) (Raw (K := K) (tick := tick) allocation m) (Raw (K := K) (tick := tick) allocation m) := + ExactRecovery.delete (receivedSource (K := K) (tick := tick) allocation m F ε) + (fun x => marginal (K := K) (tick := tick) allocation m 0 x ∧ AllFieldHistoryRawMasks.rawPass allocation m ε 0 x) + (fun y => marginal (K := K) (tick := tick) allocation m 1 y ∧ AllFieldHistoryRawMasks.rawPass allocation m ε 1 y) + (fun z => marginal (K := K) (tick := tick) allocation m 2 z ∧ AllFieldHistoryRawMasks.rawPass allocation m ε 2 z) + +theorem preparedSource_eq_delete (F : Type*) [Field F] (ε : ℝ) : + preparedSource (K := K) (tick := tick) allocation m F ε = + ExactRecovery.delete (AllFieldHistoryRecovery.rawSource F (K := K) (tick := tick) allocation m) + (AllFieldHistoryRecovery.completeKeep allocation m ε 0) + (AllFieldHistoryRecovery.completeKeep allocation m ε 1) + (AllFieldHistoryRecovery.completeKeep allocation m ε 2) := by + funext x y z + unfold preparedSource receivedSource marginal AllFieldHistoryRecovery.completeKeep + ExactRecovery.delete + split_ifs <;> simp_all only [and_true, true_and, not_false_eq_true] + all_goals tauto + +def preparedMap (F : Type*) [Field F] (ε : ℝ) : + LocalMap (activeTensor (K := K) (tick := tick) allocation m F ε) + (preparedSource (K := K) (tick := tick) allocation m F ε) := + (receivedMap (K := K) (tick := tick) allocation m F ε).comp (deleteWithPred (receivedSource (K := K) (tick := tick) allocation m F ε) + (fun x => marginal (K := K) (tick := tick) allocation m 0 x ∧ AllFieldHistoryRawMasks.rawPass allocation m ε 0 x) + (fun y => marginal (K := K) (tick := tick) allocation m 1 y ∧ AllFieldHistoryRawMasks.rawPass allocation m ε 1 y) + (fun z => marginal (K := K) (tick := tick) allocation m 2 z ∧ AllFieldHistoryRawMasks.rawPass allocation m ε 2 z)) + +abbrev GroupWords := ∀ sigma : Placement, + AllFieldHistoryGroupMasks.GroupRaw (K := K) (tick := tick) allocation m sigma + +def groupsEquiv : Raw (K := K) (tick := tick) allocation m ≃ + GroupWords (K := K) (tick := tick) allocation m := + activeWordsEquivOrders (fun h : Active K tick => + JointPopulation.Positions (activeCounts allocation m) h → + ((Fin (activeHalfLength h) → Fin 7) × (Fin (activeHalfLength h) → Fin 7))) + +@[simp] theorem project_groups_symm + (x : GroupWords (K := K) (tick := tick) allocation m) (sigma : Placement) : + AllFieldHistoryGroupMasks.projectRaw allocation m sigma + ((groupsEquiv allocation m).symm x) = x sigma := + congrFun ((groupsEquiv allocation m).apply_symm_apply x) sigma + +theorem grouped_coefficient (F : Type*) [Field F] (ε : ℝ) + (x y z : GroupWords (K := K) (tick := tick) allocation m) : + preparedSource (K := K) (tick := tick) allocation m F ε + ((groupsEquiv allocation m).symm x) ((groupsEquiv allocation m).symm y) + ((groupsEquiv allocation m).symm z) = + CommonDimensions.familyProduct + (fun sigma => AllFieldHistoryGroupMasks.groupPreparedSource F allocation m ε sigma) + x y z := by + rw [preparedSource_eq_delete, AllFieldHistoryGroupMasks.preparedSource_factor] + simp only [project_groups_symm, CommonDimensions.familyProduct] + +def groupsMap (F : Type*) [Field F] (ε : ℝ) : + LocalMap (preparedSource (K := K) (tick := tick) allocation m F ε) + (CommonDimensions.familyProduct (fun sigma : Placement => + AllFieldHistoryGroupMasks.groupPreparedSource F (K := K) (tick := tick) + allocation m ε sigma)) := by + apply LocalMap.ofExists + refine ⟨_, _, _, (Tensor.pullback_eq_restrict + (groupsEquiv (K := K) (tick := tick) allocation m).symm + (groupsEquiv (K := K) (tick := tick) allocation m).symm + (groupsEquiv (K := K) (tick := tick) allocation m).symm _).symm.trans ?_⟩ + funext x y z + exact grouped_coefficient allocation m F ε x y z + +end MatrixMultiplication.AllFieldHistorySource + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldHistory/SourceAssignment.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldHistory/SourceAssignment.lean new file mode 100644 index 0000000000000000000000000000000000000000..5cfdc70e5ede1432740f264cd9abb7606ff071e5 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldHistory/SourceAssignment.lean @@ -0,0 +1,43 @@ +import OAI.LinearAlgebra.MatrixMultiplication.FieldHistory.Source +import OAI.LinearAlgebra.MatrixMultiplication.FieldHistory.GroupedRecovery + +namespace OAI + +/-! Finite extraction histories, inherited masks and recovery bounds. -/ + +noncomputable section + +namespace MatrixMultiplication.AllFieldHistorySource + +open MatrixMultiplication.Foundation AllFieldHistory AllFieldFiniteFamily +open scoped BigOperators Classical +attribute [local instance] Classical.propDecidable Classical.decEq + +variable {K tick : ℕ} (allocation : Allocation) (m : ℕ) + +theorem groupedAssignment_coherent (F : Type*) [Field F] (ε : ℝ) + (E : Placement → Type) + (a : ∀ sigma, JointExtraction.Assignment + (AllFieldHistoryGroupMasks.GroupRaw (K := K) (tick := tick) allocation m sigma) + (AllFieldHistoryGroupMasks.GroupRaw (K := K) (tick := tick) allocation m sigma) + (AllFieldHistoryGroupMasks.GroupRaw (K := K) (tick := tick) allocation m sigma) (E sigma)) + (ha : ∀ sigma, JointExtraction.Coherent + (AllFieldHistoryGroupMasks.groupPreparedSource F allocation m ε sigma) (a sigma)) : + JointExtraction.Coherent (preparedSource (K := K) (tick := tick) allocation m F ε) + (AllFieldHistoryGroupedRecovery.groupedAssignment allocation m E a) := by + intro x y z i j k hT hx hy hz + have hprod : CommonDimensions.familyProduct + (fun sigma => AllFieldHistoryGroupMasks.groupPreparedSource F allocation m ε sigma) + (fun sigma => AllFieldHistoryGroupMasks.projectRaw allocation m sigma x) + (fun sigma => AllFieldHistoryGroupMasks.projectRaw allocation m sigma y) + (fun sigma => AllFieldHistoryGroupMasks.projectRaw allocation m sigma z) ≠ 0 := by + rw [preparedSource_eq_delete] at hT + exact fun hzero => hT ((AllFieldHistoryGroupMasks.preparedSource_factor + F allocation m ε x y z).trans hzero) + exact GroupAssignment.product_coherent _ a ha _ _ _ i j k hprod hx hy hz + +end MatrixMultiplication.AllFieldHistorySource + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldHistory/StageCIncoming.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldHistory/StageCIncoming.lean new file mode 100644 index 0000000000000000000000000000000000000000..6fa888cf6b475b6c352ec774fc106ede2b05e18b --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldHistory/StageCIncoming.lean @@ -0,0 +1,113 @@ +import OAI.LinearAlgebra.MatrixMultiplication.FieldHistory.Support +import OAI.LinearAlgebra.MatrixMultiplication.CoppersmithWinograd.CWStageCStatistics +import OAI.LinearAlgebra.MatrixMultiplication.CoppersmithWinograd.CWStageCProductRates + +namespace OAI + +/-! Finite extraction histories, inherited masks and recovery bounds. -/ + +noncomputable section + +namespace MatrixMultiplication.AllFieldHistoryStageCIncoming + +open AllFieldHistory AllFieldHistorySupport AllFieldParameters +open CWStageCProducts InheritedMasks +open scoped BigOperators +attribute [local instance] Classical.propDecidable Classical.decEq + +variable {K tick : ℕ} + +def stageCActive (h : PartC K) (phi : Placement) + (ht : FiniteSchedule.lotTick (Work.stageC h).lot (Work.stageC h).stage = tick) : + Active K tick := ⟨(.stageC h, phi), ht⟩ + +def positionEquiv (allocation : Allocation) (dilation : ℕ) (h : PartC K) + (phi : Placement) + (ht : FiniteSchedule.lotTick (Work.stageC h).lot (Work.stageC h).stage = tick) + (e : JointPopulation.Target (activeCounts (K := K) (tick := tick) allocation dilation)) : + JointPopulation.Positions (activeCounts (K := K) (tick := tick) allocation dilation) (stageCActive h phi ht) ≃ + CWStageCProducts.Positions (populationAtomCounts allocation dilation (h, phi)) := + (JointCanonicalization.positionEquiv (activeCounts (K := K) (tick := tick) allocation dilation) e + (stageCActive h phi ht)).trans + (branchPositionEquiv allocation dilation (.stageC h, phi)) + +theorem positionEquiv_shape (allocation : Allocation) (dilation : ℕ) (h : PartC K) + (phi : Placement) + (ht : FiniteSchedule.lotTick (Work.stageC h).lot (Work.stageC h).stage = tick) + (e : JointPopulation.Target (activeCounts (K := K) (tick := tick) allocation dilation)) + (j : JointPopulation.Positions (activeCounts (K := K) (tick := tick) allocation dilation) (stageCActive h phi ht)) : + branchShape (.stageC h, phi) (positionEquiv allocation dilation h phi ht e j).1 = + (e (stageCActive h phi ht)).val j := by + exact (branchPositionEquiv_shape allocation dilation (.stageC h, phi) + (JointCanonicalization.positionEquiv (activeCounts (K := K) (tick := tick) allocation dilation) e + (stageCActive h phi ht) j)).trans + (JointCanonicalization.positionEquiv_shape (activeCounts (K := K) (tick := tick) allocation dilation) e + (stageCActive h phi ht) j) + +theorem positionEquiv_symm_shape (allocation : Allocation) (dilation : ℕ) (h : PartC K) + (phi : Placement) + (ht : FiniteSchedule.lotTick (Work.stageC h).lot (Work.stageC h).stage = tick) + (e : JointPopulation.Target (activeCounts (K := K) (tick := tick) allocation dilation)) + (p : CWStageCProducts.Positions (populationAtomCounts allocation dilation (h, phi))) : + (e (stageCActive h phi ht)).val ((positionEquiv allocation dilation h phi ht e).symm p) = + branchShape (.stageC h, phi) p.1 := by + have hp := positionEquiv_shape allocation dilation h phi ht e + ((positionEquiv allocation dilation h phi ht e).symm p) + simpa only [Equiv.apply_symm_apply] using hp.symm + +theorem typeWindow_of_target_side_weights (allocation : Allocation) {dilation : ℕ} + (hd : 0 < dilation) (h : PartC K) (phi : Placement) + (ht : FiniteSchedule.lotTick (Work.stageC h).lot (Work.stageC h).stage = tick) + (e : JointPopulation.Target (activeCounts (K := K) (tick := tick) allocation dilation)) + (w : ActiveRawPairs (K := K) (tick := tick) allocation dilation) (side : Fin 3) + (hweights : ∀ j : JointPopulation.Positions (activeCounts (K := K) (tick := tick) allocation dilation) + (stageCActive h phi ht), + CWLeafStatistics.weight ((w (stageCActive h phi ht) j).1 (0 : Fin 1)) = + (JointPopulation.shapeSide side ((e (stageCActive h phi ht)).val j)).val ∧ + CWLeafStatistics.weight ((w (stageCActive h phi ht) j).2 (0 : Fin 1)) = + activeParentShape (stageCActive h phi ht) side - + (JointPopulation.shapeSide side ((e (stageCActive h phi ht)).val j)).val) + (η : ℝ) (hη : 0 ≤ η) : + typeWindow + (fun a : Fin 6 => + (littleLaw (cParameterParent h) (cShapeParent h) (phi.symm side) a : ℝ)) η + (fun j => CWCompleteStatistics.twoStatistic + ![(w (stageCActive h phi ht) j).1 (0 : Fin 1), (w (stageCActive h phi ht) j).2 (0 : Fin 1)]) := by + let p := positionEquiv allocation dilation h phi ht e + let words : CWStageCProducts.Positions (populationAtomCounts allocation dilation (h, phi)) → + CWStageCProducts.Word := fun j => + ![(w (stageCActive h phi ht) (p.symm j)).1 (0 : Fin 1), + (w (stageCActive h phi ht) (p.symm j)).2 (0 : Fin 1)] + have hgeometry (j : CWStageCProducts.Positions + (populationAtomCounts allocation dilation (h, phi))) : + CWLeafStatistics.weight (words j 0) = + branchAtom (stageCDistinguished (cShapeParent h)) j.1 (phi.symm side) ∧ + CWLeafStatistics.weight (words j 1) = + CWStageCProducts.shape (stageCDistinguished (cShapeParent h)) (phi.symm side) - + branchAtom (stageCDistinguished (cShapeParent h)) j.1 (phi.symm side) := by + have hw := hweights (p.symm j) + have hs := positionEquiv_symm_shape allocation dilation h phi ht e j + change (e (stageCActive h phi ht)).val (p.symm j) = _ at hs + rw [hs] at hw + simpa only [words, Matrix.cons_val_zero, Matrix.cons_val_one, + activeParentShape, stageCActive, Work.parentShape, branchShape, + encodePhysicalShape_side, physicalShape, Work.splitShape, cSplit, + branchAtom_eq_stageCAtom, shape_eq_parent (cShapeParent h) (bShape_size h.1.val) + h.1.property] using hw + have hwindow := typeWindow_of_placed_side_weights + (populationAtomCounts allocation dilation (h, phi)) + (cParameterParent h) (cShapeParent h) (bShape_size h.1.val) h.1.property + (population allocation dilation (.partC h, phi)) + (work_source_population_pos allocation hd (.stageC h, phi)) + (populationAtomCounts_parent allocation dilation (h, phi)) + phi side words hgeometry η hη + exact (JointCanonicalization.typeWindow_reindex _ η + (fun j => CWCompleteStatistics.twoStatistic + ![(w (stageCActive h phi ht) j).1 (0 : Fin 1), (w (stageCActive h phi ht) j).2 (0 : Fin 1)]) + p.symm).mp hwindow + +end MatrixMultiplication.AllFieldHistoryStageCIncoming + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldHistory/Sums.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldHistory/Sums.lean new file mode 100644 index 0000000000000000000000000000000000000000..297ab99aabc982af4b3390252aba037dbee6d2e0 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldHistory/Sums.lean @@ -0,0 +1,251 @@ +import OAI.LinearAlgebra.MatrixMultiplication.FieldHistory.Populations +import OAI.LinearAlgebra.MatrixMultiplication.FieldConstruction.ComplementSums +import Mathlib.Algebra.BigOperators.Ring.List + +namespace OAI + +/-! Finite extraction histories, inherited masks and recovery bounds. -/ + +noncomputable section + +namespace MatrixMultiplication.AllFieldHistory + +open AllFieldParameters +open scoped BigOperators +attribute [local instance] Classical.propDecidable Classical.decEq + +def secondMass (t : Shape) : ℚ := + 2 * (positiveInitial.map (fun g => initialLaw g * stageALaw g t)).sum + +def littleMass (t u : Shape) : ℚ := 2 * secondMass t * stageBLaw t u + +private theorem subtype_sum_indicator {A : Type*} [Fintype A] + (P : A → Prop) [DecidablePred P] [Fintype {a // P a}] (f : A → ℝ) : + (∑ a : {a // P a}, f a.val) = ∑ a, if P a then f a else 0 := by + rw [← Finset.sum_filter] + exact (Finset.sum_subtype _ (by simp) f).symm + +private theorem list_filter_sum {A : Type*} (xs : List A) (p : A → Bool) + (f : A → ℝ) : + ((xs.filter p).map f).sum = (xs.map (fun a => if p a then f a else 0)).sum := by + induction xs with + | nil => simp + | cons a xs ih => cases hp : p a <;> simp [hp, ih] + +private theorem list_sum_congr {A : Type*} (xs : List A) (f g : A → ℝ) + (h : ∀ a ∈ xs, f a = g a) : (xs.map f).sum = (xs.map g).sum := + congrArg List.sum (List.map_congr_left h) + +private theorem list_sum_comm {A B : Type*} (xs : List A) (ys : List B) + (f : A → B → ℝ) : + (xs.map (fun a => (ys.map (f a)).sum)).sum = + (ys.map (fun b => (xs.map (fun a => f a b)).sum)).sum := by + induction xs with + | nil => simp + | cons a xs ih => simp [ih, List.sum_map_add] + +private theorem list_rat_cast {A : Type*} (xs : List A) (f : A → ℚ) : + ((xs.map f).sum : ℝ) = (xs.map (fun a => (f a : ℝ))).sum := by + induction xs with + | nil => simp + | cons a xs ih => simp [ih] + + theorem secondMass_cast (t : Shape) : + (secondMass t : ℝ) = + 2 * (positiveInitial.map (fun g => (initialLaw g : ℝ) * (stageALaw g t : ℝ))).sum := by + simp only [secondMass, Rat.cast_mul, Rat.cast_ofNat, list_rat_cast] + + theorem littleMass_cast (t u : Shape) : + (littleMass t u : ℝ) = 2 * (secondMass t : ℝ) * (stageBLaw t u : ℝ) := by + simp only [littleMass, Rat.cast_mul, Rat.cast_ofNat] + + theorem initial_history_sum (K : ℕ) (f : Shape → ℝ) : + (∑ h : Initial K, (initialAmount h : ℝ) * f (initialShape h)) = + (K : ℝ) * (sortedInitial.map (fun g => (initialLaw g : ℝ) * f g)).sum := by + simp only [Fintype.sum_prod_type, initialAmount, initialShape, List.get_eq_getElem] + simp_rw [Fin.sum_univ_fun_getElem sortedInitial (fun g => (initialLaw g : ℝ) * f g)] + simp only [Finset.sum_const, Finset.card_univ, Fintype.card_fin, nsmul_eq_mul] + +theorem initial_positive_sum (K : ℕ) (f : Shape → ℝ) : + (∑ h : InitialPositive K, f (initialShape h.val)) = + (K : ℝ) * (positiveInitial.map f).sum := by + rw [subtype_sum_indicator (fun h : Initial K => initialShape h ∈ positiveInitial) + (fun h => f (initialShape h))] + rw [Fintype.sum_prod_type] + change (∑ _ : Fin K, ∑ i : Fin sortedInitial.length, + if sortedInitial[i.1] ∈ positiveInitial then f sortedInitial[i.1] else 0) = _ + simp_rw [Fin.sum_univ_fun_getElem sortedInitial + (fun g => if g ∈ positiveInitial then f g else 0)] + simp only [Finset.sum_const, Finset.card_univ, Fintype.card_fin, nsmul_eq_mul] + apply congrArg (fun r : ℝ => (K : ℝ) * r) + change _ = ((sortedInitial.filter positive).map f).sum + rw [list_filter_sum] + apply list_sum_congr + intro g hg + simp only [positiveInitial, List.mem_filter, hg, true_and] + +private theorem stageA_parent_sum : ∀ g ∈ positiveInitial, g 0 + g 1 + g 2 = 16 := by + decide +kernel + +private theorem stageA_extend_sum (g : Shape) (hg : g ∈ positiveInitial) + (f : Shape → ℝ) : + ((below g).map (fun t => (stageALaw g t : ℝ) * f t)).sum = + ((shapes 8).map (fun t => (stageALaw g t : ℝ) * f t)).sum := by + have he : below g = (shapes 8).filter + (fun t => t 0 ≤ g 0 && t 1 ≤ g 1 && t 2 ≤ g 2) := by + simp only [below, stageA_parent_sum g hg] + rw [he, list_filter_sum] + apply list_sum_congr + intro t ht + by_cases hb : (t 0 ≤ g 0 && t 1 ≤ g 1 && t 2 ≤ g 2) = true + · simp only [hb, ite_true] + · have hnot : t ∉ below g := by rw [he]; simp [hb] + have hz : stageALaw g t = 0 := splitLaw_outside_support _ _ g t hnot + simp [hb, hz] + + theorem a_parent_history_sum {K : ℕ} (h : InitialPositive K) (f : Shape → ℝ) : + (∑ p : ASplit h × Bool, (aAmount ⟨h, p⟩ : ℝ) * f (aShape ⟨h, p⟩)) = + 2 * (initialAmount h.val : ℝ) * + ((below (initialShape h.val)).map + (fun t => (stageALaw (initialShape h.val) t : ℝ) * f t)).sum := by + simp only [Fintype.sum_prod_type, Fintype.sum_bool, aAmount, aShape, aSplit, + halfShape, Bool.false_eq_true, ite_false, ite_true, Rat.cast_mul, + List.get_eq_getElem] + simp only [mul_assoc, Finset.sum_add_distrib, ← Finset.mul_sum] + rw [Fin.sum_univ_fun_getElem (below (initialShape h.val)) + (fun t => (stageALaw (initialShape h.val) t : ℝ) * + f (complement (initialShape h.val) t)), + Fin.sum_univ_fun_getElem (below (initialShape h.val)) + (fun t => (stageALaw (initialShape h.val) t : ℝ) * f t), + stageA_complement_sum _ h.property] + ring + + theorem a_history_sum_parents (K : ℕ) (f : Shape → ℝ) : + (∑ h : AfterA K, (aAmount h : ℝ) * f (aShape h)) = + (K : ℝ) * (positiveInitial.map (fun g => 2 * (initialLaw g : ℝ) * + ((below g).map (fun t => (stageALaw g t : ℝ) * f t)).sum)).sum := by + rw [Fintype.sum_sigma] + simp only [a_parent_history_sum, initialAmount] + exact initial_positive_sum K (fun g => 2 * (initialLaw g : ℝ) * + ((below g).map (fun t => (stageALaw g t : ℝ) * f t)).sum) + + theorem a_history_sum (K : ℕ) (f : Shape → ℝ) : + (∑ h : AfterA K, (aAmount h : ℝ) * f (aShape h)) = + (K : ℝ) * ((shapes 8).map (fun t => (secondMass t : ℝ) * f t)).sum := by + rw [a_history_sum_parents] + apply congrArg (fun r : ℝ => (K : ℝ) * r) + calc + _ = (positiveInitial.map (fun g => ((shapes 8).map + (fun t => 2 * (initialLaw g : ℝ) * ((stageALaw g t : ℝ) * f t))).sum)).sum := by + apply list_sum_congr + intro g hg + rw [stageA_extend_sum g hg, List.sum_map_mul_left] + _ = ((shapes 8).map (fun t => (positiveInitial.map + (fun g => 2 * (initialLaw g : ℝ) * ((stageALaw g t : ℝ) * f t))).sum)).sum := + list_sum_comm _ _ _ + _ = _ := by + apply list_sum_congr + intro t _ + rw [secondMass_cast] + calc + _ = (positiveInitial.map + (fun g => 2 * ((initialLaw g : ℝ) * (stageALaw g t : ℝ)) * f t)).sum := by + apply list_sum_congr + intro g _ + ring + _ = _ := by rw [List.sum_map_mul_right, List.sum_map_mul_left] + + theorem a_positive_history_sum (K : ℕ) (f : Shape → ℝ) : + (∑ h : APositive K, (aAmount h.val : ℝ) * f (aShape h.val)) = + (K : ℝ) * (positiveSecond.map (fun t => (secondMass t : ℝ) * f t)).sum := by + rw [subtype_sum_indicator (fun h : AfterA K => aShape h ∈ positiveSecond) + (fun h => (aAmount h : ℝ) * f (aShape h))] + trans ∑ h : AfterA K, (aAmount h : ℝ) * + (if aShape h ∈ positiveSecond then f (aShape h) else 0) + · apply Finset.sum_congr rfl + intro h _ + split_ifs <;> simp_all + rw [a_history_sum K (fun t => if t ∈ positiveSecond then f t else 0)] + apply congrArg (fun r : ℝ => (K : ℝ) * r) + change _ = (((shapes 8).filter positive).map + (fun t => (secondMass t : ℝ) * f t)).sum + rw [list_filter_sum] + apply list_sum_congr + intro t ht + simp only [positiveSecond, List.mem_filter, ht, true_and] + split_ifs <;> simp_all + + theorem b_parent_history_sum {K : ℕ} (h : APositive K) (f : Shape → ℝ) : + (∑ p : BSplit h × Bool, (bAmount ⟨h, p⟩ : ℝ) * f (bShape ⟨h, p⟩)) = + 2 * (aAmount h.val : ℝ) * + ((below (aShape h.val)).map + (fun u => (stageBLaw (aShape h.val) u : ℝ) * f u)).sum := by + simp only [Fintype.sum_prod_type, Fintype.sum_bool, bAmount, bShape, bSplit, + halfShape, Bool.false_eq_true, ite_false, ite_true, Rat.cast_mul, + List.get_eq_getElem] + simp only [mul_assoc, Finset.sum_add_distrib, ← Finset.mul_sum] + rw [Fin.sum_univ_fun_getElem (below (aShape h.val)) + (fun u => (stageBLaw (aShape h.val) u : ℝ) * + f (complement (aShape h.val) u)), + Fin.sum_univ_fun_getElem (below (aShape h.val)) + (fun u => (stageBLaw (aShape h.val) u : ℝ) * f u), + stageB_complement_sum _ h.property] + ring + + theorem b_history_sum (K : ℕ) (f : Shape → Shape → ℝ) : + (∑ h : AfterB K, (bAmount h : ℝ) * f (aShape h.1.val) (bShape h)) = + (K : ℝ) * (positiveSecond.map (fun t => + ((below t).map (fun u => (littleMass t u : ℝ) * f t u)).sum)).sum := by + rw [Fintype.sum_sigma] + simp only [b_parent_history_sum] + have he : (∑ h : APositive K, 2 * (aAmount h.val : ℝ) * + ((below (aShape h.val)).map + (fun u => (stageBLaw (aShape h.val) u : ℝ) * f (aShape h.val) u)).sum) = + ∑ h : APositive K, (aAmount h.val : ℝ) * + (2 * ((below (aShape h.val)).map + (fun u => (stageBLaw (aShape h.val) u : ℝ) * f (aShape h.val) u)).sum) := by + apply Finset.sum_congr rfl + intro h _ + ring + rw [he, a_positive_history_sum K (fun t => + 2 * ((below t).map (fun u => (stageBLaw t u : ℝ) * f t u)).sum)] + apply congrArg (fun r : ℝ => (K : ℝ) * r) + apply list_sum_congr + intro t _ + calc + _ = 2 * (secondMass t : ℝ) * + ((below t).map (fun u => (stageBLaw t u : ℝ) * f t u)).sum := by ring + _ = _ := by + rw [← List.sum_map_mul_left] + apply list_sum_congr + intro u _ + rw [littleMass_cast] + ring + + theorem b_positive_history_sum (K : ℕ) (f : Shape → Shape → ℝ) : + (∑ h : BPositive K, (bAmount h.val : ℝ) * + f (aShape h.val.1.val) (bShape h.val)) = + (K : ℝ) * (positiveSecond.map (fun t => + (((below t).filter positive).map + (fun u => (littleMass t u : ℝ) * f t u)).sum)).sum := by + rw [subtype_sum_indicator (fun h : AfterB K => positive (bShape h) = true) + (fun h => (bAmount h : ℝ) * f (aShape h.1.val) (bShape h))] + trans ∑ h : AfterB K, (bAmount h : ℝ) * + (if positive (bShape h) then f (aShape h.1.val) (bShape h) else 0) + · apply Finset.sum_congr rfl + intro h _ + split_ifs <;> simp_all + rw [b_history_sum K (fun t u => if positive u then f t u else 0)] + apply congrArg (fun r : ℝ => (K : ℝ) * r) + apply list_sum_congr + intro t _ + rw [list_filter_sum] + apply list_sum_congr + intro u _ + split_ifs <;> simp_all + +end MatrixMultiplication.AllFieldHistory + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldHistory/Support.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldHistory/Support.lean new file mode 100644 index 0000000000000000000000000000000000000000..ca4483e4d3e4f69d97ae74085a9535c8e66dbcb8 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldHistory/Support.lean @@ -0,0 +1,230 @@ +import OAI.LinearAlgebra.MatrixMultiplication.FieldHistory.Counts +import OAI.LinearAlgebra.MatrixMultiplication.Recovery.HistorySupport +import OAI.LinearAlgebra.MatrixMultiplication.JointExtraction.CanonicalCW +import OAI.LinearAlgebra.MatrixMultiplication.Recovery.InheritedMaskMargins + +namespace OAI + +/-! Finite extraction histories, inherited masks and recovery bounds. -/ + +noncomputable section + +namespace MatrixMultiplication.AllFieldHistorySupport + +open AllFieldHistory +open scoped BigOperators +attribute [local instance] Classical.propDecidable Classical.decEq + +theorem population_dilation {K : ℕ} (allocation : Allocation) (m : ℕ) (h : History K) : + population allocation m h = m * population allocation 1 h := by + simp only [population, AllFieldPopulationCounts.count, one_mul] + +theorem branchPopulation_dilation {K : ℕ} (allocation : Allocation) (m : ℕ) + (w : PlacedWork K) (b : w.1.Branch) : + branchPopulation allocation m w b = m * branchPopulation allocation 1 w b := by + simp only [branchPopulation, population, AllFieldPopulationCounts.count, one_mul] + +theorem jointCounts_dilation {K : ℕ} (allocation : Allocation) (m : ℕ) + (w : PlacedWork K) (u : JointPopulation.Shape) : + jointCounts allocation m w u = m * jointCounts allocation 1 w u := by + simp only [jointCounts, shapeCounts, branchPopulation, population, + AllFieldPopulationCounts.count, one_mul, Finset.mul_sum, mul_ite, mul_zero] + +theorem activeCounts_dilation {K tick : ℕ} (allocation : Allocation) (m : ℕ) + (h : Active K tick) (u : JointPopulation.Shape) : + activeCounts allocation m h u = m * activeCounts allocation 1 h u := + jointCounts_dilation allocation m h.val u + +theorem activeCounts_pos_iff {K tick m : ℕ} (allocation : Allocation) (hm : 0 < m) + (h : Active K tick) (u : JointPopulation.Shape) : + 0 < activeCounts allocation m h u ↔ 0 < activeCounts allocation 1 h u := by + rw [activeCounts_dilation] + exact Nat.mul_pos_iff_of_pos_left hm + +theorem dilation_le_activeCounts {K tick : ℕ} (allocation : Allocation) (m : ℕ) + (h : Active K tick) (u : JointPopulation.Shape) + (hpos : 0 < activeCounts allocation 1 h u) : m ≤ activeCounts allocation m h u := by + rw [activeCounts_dilation] + calc + m = m * 1 := (Nat.mul_one m).symm + _ ≤ m * activeCounts allocation 1 h u := Nat.mul_le_mul_left m hpos + +theorem two_le_activeCounts {K tick m : ℕ} (allocation : Allocation) (hm : 2 ≤ m) + (h : Active K tick) (u : JointPopulation.Shape) + (hpos : 0 < activeCounts allocation 1 h u) : 2 ≤ activeCounts allocation m h u := + hm.trans (dilation_le_activeCounts allocation m h u hpos) + +theorem totalLength_dilation {K tick : ℕ} (allocation : Allocation) (m : ℕ) + (l r : Active K tick → ℕ) : + HistorySupport.totalLength (JointPopulation.Positions (activeCounts allocation m)) l r = + m * HistorySupport.totalLength (JointPopulation.Positions (activeCounts allocation 1)) l r := by + simp only [HistorySupport.totalLength, JointPopulation.Positions, Fintype.card_fin, + activeCounts_dilation allocation m, ← Finset.mul_sum, Nat.mul_assoc] + +def fixedBaseLength {K tick : ℕ} (allocation : Allocation) : ℕ := + HistorySupport.totalLength + (JointPopulation.Positions (activeCounts (K := K) (tick := tick) allocation 1)) + activeHalfLength activeHalfLength + +def supportRate {K tick : ℕ} (allocation : Allocation) : ℝ := + RecoverySupport.cw5SupportRate (fixedBaseLength (K := K) (tick := tick) allocation) + +theorem supportRate_pos {K tick : ℕ} (allocation : Allocation) : + 0 < supportRate (K := K) (tick := tick) allocation := + RecoverySupport.cw5SupportRate_pos _ + +abbrev ActiveRawPairs {K tick : ℕ} (allocation : Allocation) (m : ℕ) := + JointCanonicalization.RawPairs (activeCounts (K := K) (tick := tick) allocation m) + (JointCanonicalCW.Left activeHalfLength) (JointCanonicalCW.Right activeHalfLength) + +theorem raw_support_card_le_exp {K tick : ℕ} {F : Type*} [Zero F] + (allocation : Allocation) (m : ℕ) + (Q : ActiveRawPairs (K := K) (tick := tick) allocation m → + ActiveRawPairs (K := K) (tick := tick) allocation m → + ActiveRawPairs (K := K) (tick := tick) allocation m → F) : + ((RecoverySupport.support Q).card : ℝ) ≤ + Real.exp (supportRate (K := K) (tick := tick) allocation * m) := by + apply HistorySupport.cw5_support_card_le_exp + (JointPopulation.Positions (activeCounts (K := K) (tick := tick) allocation m)) + activeHalfLength activeHalfLength Q (fixedBaseLength (K := K) (tick := tick) allocation) m + rw [totalLength_dilation] + exact le_of_eq (Nat.mul_comm _ _) + +abbrev ActiveClass (K tick : ℕ) := Active K tick × JointPopulation.Shape + +def selectedBaseCount {K tick : ℕ} (allocation : Allocation) + (D : Finset (ActiveClass K tick)) : ℕ := + ∑ c ∈ D, activeCounts allocation 1 c.1 c.2 + +def selectedBasePopulation {K tick : ℕ} (allocation : Allocation) + (D : Finset (ActiveClass K tick)) : ℝ := (selectedBaseCount allocation D : ℝ) + +abbrev selectedPositions {K tick : ℕ} (allocation : Allocation) (m : ℕ) + (D : Finset (ActiveClass K tick)) (c : D) := + JointCanonicalization.ClassPositions (activeCounts allocation m) c.val + +theorem selected_count_dilation {K tick : ℕ} (allocation : Allocation) (m : ℕ) + (D : Finset (ActiveClass K tick)) : + (∑ c ∈ D, activeCounts allocation m c.1 c.2) = m * selectedBaseCount allocation D := by + simp only [selectedBaseCount, activeCounts_dilation allocation m, Finset.mul_sum] + +theorem selectedBaseCount_pos {K tick : ℕ} (allocation : Allocation) + (D : Finset (ActiveClass K tick)) (hD : D.Nonempty) + (hpos : ∀ c ∈ D, 0 < activeCounts allocation 1 c.1 c.2) : + 0 < selectedBaseCount allocation D := + Finset.sum_pos hpos hD + +theorem selectedBasePopulation_pos {K tick : ℕ} (allocation : Allocation) + (D : Finset (ActiveClass K tick)) (hD : D.Nonempty) + (hpos : ∀ c ∈ D, 0 < activeCounts allocation 1 c.1 c.2) : + 0 < selectedBasePopulation allocation D := by + unfold selectedBasePopulation + exact_mod_cast selectedBaseCount_pos allocation D hD hpos + +theorem selected_populationSize {K tick : ℕ} (allocation : Allocation) (m : ℕ) + (D : Finset (ActiveClass K tick)) : + PermutationMatching.populationSize (selectedPositions allocation m D) = + selectedBasePopulation allocation D * (m : ℝ) := by + simp only [PermutationMatching.populationSize, selectedPositions, + JointCanonicalization.ClassPositions, Fintype.card_fin] + rw [Finset.sum_coe_sort D + (fun c : ActiveClass K tick => (activeCounts allocation m c.1 c.2 : ℝ))] + simp only [activeCounts_dilation allocation m, Nat.cast_mul, ← Finset.mul_sum, + selectedBasePopulation, selectedBaseCount, Nat.cast_sum] + exact mul_comm _ _ + +theorem selected_two_le {K tick m : ℕ} (allocation : Allocation) (hm : 2 ≤ m) + (D : Finset (ActiveClass K tick)) + (hpos : ∀ c ∈ D, 0 < activeCounts allocation 1 c.1 c.2) (c : D) : + 2 ≤ Fintype.card (selectedPositions allocation m D c) := by + simpa only [selectedPositions, JointCanonicalization.ClassPositions, Fintype.card_fin] using + two_le_activeCounts allocation hm c.val.1 c.val.2 (hpos c.val c.property) + +theorem selected_classWeight_formula {K tick m : ℕ} (allocation : Allocation) + (hm : 0 < m) (D : Finset (ActiveClass K tick)) (c : D) : + PermutationMatching.classWeight (selectedPositions allocation m D) c = + (activeCounts allocation 1 c.val.1 c.val.2 : ℝ) / selectedBasePopulation allocation D := by + rw [PermutationMatching.classWeight, selected_populationSize] + simp only [selectedPositions, JointCanonicalization.ClassPositions, Fintype.card_fin, + activeCounts_dilation allocation m, Nat.cast_mul] + rw [mul_comm (selectedBasePopulation allocation D) (m : ℝ)] + exact mul_div_mul_left _ _ (Nat.cast_ne_zero.mpr (Nat.ne_of_gt hm)) + +theorem selected_classWeight_eq_one {K tick m : ℕ} (allocation : Allocation) + (hm : 0 < m) (D : Finset (ActiveClass K tick)) (c : D) : + PermutationMatching.classWeight (selectedPositions allocation m D) c = + PermutationMatching.classWeight (selectedPositions allocation 1 D) c := + (selected_classWeight_formula allocation hm D c).trans + (selected_classWeight_formula allocation (by decide : 0 < (1 : ℕ)) D c).symm + +theorem selected_classProductMixture_eq_one {K tick m : ℕ} (allocation : Allocation) + (hm : 0 < m) (D : Finset (ActiveClass K tick)) (left right : D → ℝ) : + PermutationMatching.classProductMixture (selectedPositions allocation m D) left right = + PermutationMatching.classProductMixture (selectedPositions allocation 1 D) left right := by + unfold PermutationMatching.classProductMixture + apply Finset.sum_congr rfl + intro c _ + rw [selected_classWeight_eq_one allocation hm D c] + +theorem work_source_amount_pos {K : ℕ} (allocation : Allocation) (w : PlacedWork K) : + 0 < amount allocation (w.1.source, w.2) := by + rcases w with ⟨w, phi⟩ + unfold amount + apply div_pos _ (by norm_num) + cases w with + | stageA h => exact initialAmount_pos h.val + | stageB h => exact aAmount_pos h.val + | stageC h => exact partAmount_pos allocation h + +theorem work_source_population_pos {K m : ℕ} (allocation : Allocation) (hm : 0 < m) + (w : PlacedWork K) : 0 < population allocation m (w.1.source, w.2) := + (AllFieldPopulationCounts.count_pos_iff (amount allocation) (amount_nonneg allocation) + hm (w.1.source, w.2)).2 (work_source_amount_pos allocation w) + +def positiveClasses {K tick : ℕ} (allocation : Allocation) (h : Active K tick) : + Finset (ActiveClass K tick) := + Finset.univ.filter fun c => c.1 = h ∧ 0 < activeCounts allocation 1 c.1 c.2 + +theorem positiveClasses_positive {K tick : ℕ} (allocation : Allocation) (h : Active K tick) + (c : ActiveClass K tick) (hc : c ∈ positiveClasses allocation h) : + 0 < activeCounts allocation 1 c.1 c.2 := (Finset.mem_filter.mp hc).2.2 + +theorem positiveClasses_baseCount {K tick : ℕ} (allocation : Allocation) (h : Active K tick) : + selectedBaseCount allocation (positiveClasses allocation h) = + population allocation 1 (h.val.1.source, h.val.2) := by + have hkeep (n : ℕ) : (if 0 < n then n else 0) = n := by + split_ifs <;> omega + calc + selectedBaseCount allocation (positiveClasses allocation h) = + ∑ u, activeCounts allocation 1 h u := by + simp [selectedBaseCount, positiveClasses, Finset.sum_filter, ite_and, hkeep, + Fintype.sum_prod_type] + _ = population allocation 1 (h.val.1.source, h.val.2) := + jointCounts_sum allocation 1 h.val + +theorem positiveClasses_basePopulation_pos {K tick : ℕ} (allocation : Allocation) + (h : Active K tick) : 0 < selectedBasePopulation allocation (positiveClasses allocation h) := by + unfold selectedBasePopulation + rw [positiveClasses_baseCount] + exact_mod_cast work_source_population_pos allocation (by decide : 0 < (1 : ℕ)) h.val + +theorem positiveClasses_nonempty {K tick : ℕ} (allocation : Allocation) (h : Active K tick) : + (positiveClasses allocation h).Nonempty := by + by_contra hn + have hempty := Finset.not_nonempty_iff_eq_empty.mp hn + have hp := positiveClasses_basePopulation_pos allocation h + simp [selectedBasePopulation, selectedBaseCount, hempty] at hp + +theorem positiveClasses_populationSize {K tick : ℕ} (allocation : Allocation) (m : ℕ) + (h : Active K tick) : + PermutationMatching.populationSize + (selectedPositions allocation m (positiveClasses allocation h)) = + (population allocation 1 (h.val.1.source, h.val.2) : ℝ) * m := by + rw [selected_populationSize] + simp only [selectedBasePopulation, positiveClasses_baseCount] + +end MatrixMultiplication.AllFieldHistorySupport + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldHistory/Tensors.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldHistory/Tensors.lean new file mode 100644 index 0000000000000000000000000000000000000000..657acc2a3f24ba797c847b7fd63ef2a0f371c16d --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldHistory/Tensors.lean @@ -0,0 +1,164 @@ +import OAI.LinearAlgebra.MatrixMultiplication.FieldHistory.Geometry +import OAI.LinearAlgebra.MatrixMultiplication.FieldHistory.ChildLaws +import OAI.LinearAlgebra.MatrixMultiplication.FieldConstruction.FiniteFamily + +namespace OAI + +/-! Finite extraction histories, inherited masks and recovery bounds. -/ + +noncomputable section + +namespace MatrixMultiplication.AllFieldHistory + +open MatrixMultiplication.Foundation AllFieldParameters CWStrands InheritedMasks +open scoped BigOperators Classical + +def ResidentStatistic {K : ℕ} : CanonicalHistory K → Type + | .initial _ => PUnit + | .afterA _ => PairSlot + | .afterB _ | .partC _ => Fin 6 + | .afterC _ => PUnit + +instance {K : ℕ} (h : CanonicalHistory K) : Fintype (ResidentStatistic h) := by + cases h <;> dsimp [ResidentStatistic] <;> infer_instance + +instance {K : ℕ} (h : CanonicalHistory K) : DecidableEq (ResidentStatistic h) := Classical.decEq _ + +def residentStatistic {K : ℕ} (h : CanonicalHistory K) : + (Fin (currentLength h) → Fin 7) → ResidentStatistic h := + match h with + | .initial _ => fun _ => PUnit.unit + | .afterA _ => CWCompleteStatistics.fourStatistic + | .afterB _ | .partC _ => CWCompleteStatistics.twoStatistic + | .afterC _ => fun _ => PUnit.unit + +def residentLawRat {K : ℕ} (h : CanonicalHistory K) (canonicalSide : Fin 3) : + ResidentStatistic h → ℚ := + match h with + | .initial _ => fun _ => 1 + | .afterA h => halfLaw (aShape h) canonicalSide + | .afterB h => littleLaw (aShape h.1.val) (bShape h) canonicalSide + | .partC h => littleLaw (cParameterParent h) (cShapeParent h) canonicalSide + | .afterC _ => fun _ => 1 + +def residentLaw {K : ℕ} (h : History K) (physicalSide : Fin 3) : + ResidentStatistic h.1 → ℝ := + fun a => residentLawRat h.1 (h.2.symm physicalSide) a + +theorem residentLawRat_nonnegative {K : ℕ} (h : CanonicalHistory K) (side : Fin 3) + (a : ResidentStatistic h) : 0 ≤ residentLawRat h side a := by + cases h with + | initial h => exact zero_le_one + | afterA h => exact halfLaw_nonnegative (aShape h) side a + | afterB h => exact littleLaw_nonnegative (aShape h.1.val) (bShape h) side a + | partC h => exact littleLaw_nonnegative (cParameterParent h) (cShapeParent h) side a + | afterC h => exact zero_le_one + +theorem residentLawRat_normalized {K : ℕ} (h : CanonicalHistory K) (side : Fin 3) : + ∑ a : ResidentStatistic h, residentLawRat h side a = 1 := by + cases h with + | initial h => exact Fintype.sum_unique (fun _ : PUnit => (1 : ℚ)) + | afterA h => exact halfLaw_normalized (aShape h) (aShape_size h) side + | afterB h => exact littleLaw_normalized (aShape h.1.val) (bShape h) side + | partC h => exact littleLaw_normalized (cParameterParent h) (cShapeParent h) side + | afterC h => exact Fintype.sum_unique (fun _ : PUnit => (1 : ℚ)) + +def residentWidth {K : ℕ} (ε : ℝ) : CanonicalHistory K → ℝ + | .initial _ => 0 + | .afterA _ => ε / 8 + | .afterB _ => ε / 128 + | .partC _ => ε / 256 + | .afterC _ => 0 + +abbrev HistoryWord {K : ℕ} (allocation : Allocation) (dilation : ℕ) (h : History K) := + Fin (population allocation dilation h) → Fin (currentLength h.1) → Fin 7 + +def residentMask {K : ℕ} (allocation : Allocation) (dilation : ℕ) (ε : ℝ) + (h : History K) (side : Fin 3) (w : HistoryWord allocation dilation h) : Prop := + match h.1 with + | .initial _ => True + | .afterC _ => True + | .afterA _ | .afterB _ | .partC _ => + 0 < population allocation dilation h → + typeWindow (residentLaw h side) (residentWidth ε h.1) + (fun i => residentStatistic h.1 (w i)) + +theorem residentMask_zero_population {K : ℕ} (allocation : Allocation) (dilation : ℕ) + (ε : ℝ) (h : History K) (hp : population allocation dilation h = 0) + (side : Fin 3) (w : HistoryWord allocation dilation h) : + residentMask allocation dilation ε h side w := by + rcases h with ⟨h, phi⟩ + cases h <;> simp [residentMask, hp] + +theorem residentWidth_mono {K : ℕ} {ε δ : ℝ} (hε : ε ≤ δ) (h : CanonicalHistory K) : + residentWidth ε h ≤ residentWidth δ h := by + cases h <;> simp only [residentWidth] + all_goals first | exact le_rfl | exact div_le_div_of_nonneg_right hε (by norm_num) + +theorem residentMask_mono {K : ℕ} (allocation : Allocation) (dilation : ℕ) + {ε δ : ℝ} (hε : ε ≤ δ) (h : History K) (side : Fin 3) + (w : HistoryWord allocation dilation h) + (hw : residentMask allocation dilation ε h side w) : + residentMask allocation dilation δ h side w := by + rcases h with ⟨h, phi⟩ + cases h <;> simp only [residentMask] at hw ⊢ + all_goals first + | trivial + | intro hp a + exact le_trans (hw hp a) (residentWidth_mono hε _) + +def historyTensor (F : Type*) [Field F] {K : ℕ} + (allocation : Allocation) (dilation : ℕ) (ε : ℝ) (h : History K) : + Tensor F (HistoryWord allocation dilation h) (HistoryWord allocation dilation h) + (HistoryWord allocation dilation h) := + ExactRecovery.delete + (Tensor.power (shapeTensor (Fin (currentLength h.1)) (currentPhysicalShape h)) + (population allocation dilation h)) + (residentMask allocation dilation ε h 0) (residentMask allocation dilation ε h 1) + (residentMask allocation dilation ε h 2) + +def stateTensor (F : Type*) [Field F] {K : ℕ} + (allocation : Allocation) (dilation : ℕ) (ε : ℝ) (tick : ℕ) : + Tensor F (∀ h : State K tick, HistoryWord allocation dilation h.val) + (∀ h : State K tick, HistoryWord allocation dilation h.val) + (∀ h : State K tick, HistoryWord allocation dilation h.val) := + CommonDimensions.familyProduct (fun h : State K tick => + historyTensor F allocation dilation ε h.val) + +theorem historyTensor_support_shape (F : Type*) [Field F] {K : ℕ} + (allocation : Allocation) (dilation : ℕ) (ε : ℝ) (h : History K) + (x y z : HistoryWord allocation dilation h) + (hn : historyTensor F allocation dilation ε h x y z ≠ 0) + (i : Fin (population allocation dilation h)) : + weight (x i) = currentPhysicalShape h 0 ∧ + weight (y i) = currentPhysicalShape h 1 ∧ + weight (z i) = currentPhysicalShape h 2 := by + apply shapeTensor_support (F := F) (currentPhysicalShape h) (x i) (y i) (z i) + intro hz + apply hn + unfold historyTensor ExactRecovery.delete + split_ifs + · exact Finset.prod_eq_zero (Finset.mem_univ i) hz + · rfl + +@[simp] theorem historyTensor_initial (F : Type*) [Field F] {K : ℕ} + (allocation : Allocation) (dilation : ℕ) (ε : ℝ) (h : Initial K) (phi : Placement) : + historyTensor F allocation dilation ε (.initial h, phi) = + Tensor.power (shapeTensor (Fin 8) (physicalShape phi (initialShape h))) + (population allocation dilation (.initial h, phi)) := by + funext x y z + exact ite_eq_left ⟨trivial, trivial, trivial⟩ + +@[simp] theorem historyTensor_afterC (F : Type*) [Field F] {K : ℕ} + (allocation : Allocation) (dilation : ℕ) (ε : ℝ) (h : AfterC K) (phi : Placement) : + historyTensor F allocation dilation ε (.afterC h, phi) = + Tensor.power (shapeTensor (Fin 1) (physicalShape phi (cShape h))) + (population allocation dilation (.afterC h, phi)) := by + funext x y z + exact ite_eq_left ⟨trivial, trivial, trivial⟩ + +end MatrixMultiplication.AllFieldHistory + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldHistory/Tick.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldHistory/Tick.lean new file mode 100644 index 0000000000000000000000000000000000000000..61a55d783a3ec1982ee0a5dbb74ce97aad33fb32 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldHistory/Tick.lean @@ -0,0 +1,204 @@ +import OAI.LinearAlgebra.MatrixMultiplication.FieldHistory.TickCarry +import OAI.LinearAlgebra.MatrixMultiplication.FieldHistory.SourceAssignment +import OAI.LinearAlgebra.MatrixMultiplication.FieldHistory.Produced +import OAI.LinearAlgebra.MatrixMultiplication.FieldGroups.SelectionCore +import OAI.LinearAlgebra.MatrixMultiplication.FieldGroups.AssignmentRetention +import OAI.LinearAlgebra.MatrixMultiplication.FieldGroups.Assignments + +namespace OAI + +/-! Finite extraction histories, inherited masks and recovery bounds. -/ + +noncomputable section + +namespace MatrixMultiplication.AllFieldHistoryTick + +open MatrixMultiplication.Foundation AllFieldHistory AllFieldFiniteFamily +open AllFieldGroupSelection AllFieldHistoryGroupedRecovery +open scoped BigOperators Classical +attribute [local instance] Classical.propDecidable Classical.decEq + +variable {K tick : ℕ} (allocation : Allocation) (m : ℕ) (ε slack : ℝ) + +abbrev Choices := ∀ sigma : Placement, + Selected (K := K) (tick := tick) allocation m ε sigma slack + +abbrev AmbientTag (sigma : Placement) := + JointCoarseHashing.Triple + (AllFieldGroupOrbitData.Pos (K := K) (tick := tick) allocation m sigma) + +abbrev Tags (chosen : Choices (K := K) (tick := tick) allocation m ε slack) := + ∀ sigma : Placement, {e // e ∈ (chosen sigma).targets} + +local instance tagsDecidableEq (chosen : Choices (K := K) (tick := tick) allocation m ε slack) : + DecidableEq (Tags allocation m ε slack chosen) := Classical.decEq _ + +@[instance_reducible] +private def coarseTripleFintype (P : Type) [Fintype P] : + Fintype (JointCoarseHashing.Triple P) := inferInstance + +instance ambientTagFintype (sigma : Placement) : + Fintype (AmbientTag (K := K) (tick := tick) allocation m sigma) := + coarseTripleFintype (AllFieldGroupOrbitData.Pos (K := K) (tick := tick) allocation m sigma) + +instance ambientTagsFintype : + Fintype (∀ sigma, AmbientTag (K := K) (tick := tick) allocation m sigma) := inferInstance + +instance tagsFintype (chosen : Choices (K := K) (tick := tick) allocation m ε slack) : + Fintype (Tags allocation m ε slack chosen) := inferInstance + +def select (chosen : Choices (K := K) (tick := tick) allocation m ε slack) + (j : Tags allocation m ε slack chosen) : + ∀ sigma, AmbientTag (K := K) (tick := tick) allocation m sigma := + fun sigma => AllFieldGroupOrbitData.coarse allocation m sigma (j sigma).val + +theorem select_injective + (chosen : Choices (K := K) (tick := tick) allocation m ε slack) : + Function.Injective (select allocation m ε slack chosen) := by + intro _ _ hequal + funext sigma + apply Subtype.ext + exact AllFieldGroupOrbitData.coarse_injective allocation m sigma (congrFun hequal sigma) + +def targets (chosen : Choices (K := K) (tick := tick) allocation m ε slack) + (j : Tags allocation m ε slack chosen) : + AllFieldHistoryRecovery.Targets (K := K) (tick := tick) allocation m := + joinGroupTargets (activeCounts allocation m) (fun sigma => (j sigma).val) + +def assignments (chosen : Choices (K := K) (tick := tick) allocation m ε slack) + (sigma : Placement) := + AllFieldGroupAssignmentRetention.physicalAssignment allocation m ε sigma + (JointOrdinarySelection.hashLevel + (selectionHashRate (K := K) (tick := tick) allocation sigma slack) m) + (JointOrdinarySelection.hashSet + (selectionHashRate (K := K) (tick := tick) allocation sigma slack) m) + (chosen sigma).sample + +def assignment (chosen : Choices (K := K) (tick := tick) allocation m ε slack) := + groupedAssignment allocation m (AmbientTag (K := K) (tick := tick) allocation m) + (assignments allocation m ε slack chosen) + +theorem coherent (F : Type*) [Field F] + (chosen : Choices (K := K) (tick := tick) allocation m ε slack) : + JointExtraction.Coherent + (AllFieldHistorySource.preparedSource (K := K) (tick := tick) allocation m F ε) + (assignment allocation m ε slack chosen) := by + apply AllFieldHistorySource.groupedAssignment_coherent allocation m F ε + intro sigma + exact AllFieldGroupAssignments.physicalAssignment_coherent F allocation m ε sigma + _ _ (chosen sigma).sample + +theorem repair (F : Type*) [Field F] (hε : 0 < ε) + (hm : AllFieldHistoryRecovery.minimumDilation (K := K) (tick := tick) allocation ε ≤ m) + (chosen : Choices (K := K) (tick := tick) allocation m ε slack) + (j : Tags allocation m ε slack chosen) : + InverseLinearRecovery.RecoveredBy + (AllFieldHistoryRecovery.ideal F allocation m ε (targets allocation m ε slack chosen j)) + (JointExtraction.branch + (AllFieldHistorySource.preparedSource (K := K) (tick := tick) allocation m F ε) + (assignment allocation m ε slack chosen) (select allocation m ε slack chosen j)) + (AllFieldHistoryRecovery.shiftCount (K := K) (tick := tick) allocation ε m) := by + rw [AllFieldHistorySource.preparedSource_eq_delete] + apply repair_grouped F allocation hε hm + (AmbientTag (K := K) (tick := tick) allocation m) + (assignments allocation m ε slack chosen) + (select allocation m ε slack chosen j) (fun sigma => (j sigma).val) + · intro sigma w hw + have hs := AllFieldGroupAssignmentRetention.assigned_some_idealSide + allocation m ε sigma _ _ (chosen sigma).sample (j sigma).val (sigma.symm 0, w) hw + simpa only [Equiv.apply_symm_apply] using hs + · intro sigma w hw + have hs := AllFieldGroupAssignmentRetention.assigned_some_idealSide + allocation m ε sigma _ _ (chosen sigma).sample (j sigma).val (sigma.symm 1, w) hw + simpa only [Equiv.apply_symm_apply] using hs + · intro sigma w hw + have hs := AllFieldGroupAssignmentRetention.assigned_some_idealSide + allocation m ε sigma _ _ (chosen sigma).sample (j sigma).val (sigma.symm 2, w) hw + simpa only [Equiv.apply_symm_apply] using hs + · intro side w hw sigma + have hg := (chosen sigma).good (j sigma).val (j sigma).property + have hh := AllFieldGroupAssignmentRetention.good_projected_failure_le F + allocation m ε sigma _ _ + (JointOrdinarySelection.hashSet_AP (selectionHashRate allocation sigma slack) m) + (m : ℝ) (chosen sigma).sample (targets allocation m ε slack chosen j) + (by simpa only [targets, project_joinGroupTargets] using hg) side w hw + simp only [targets, project_joinGroupTargets] at hh + rw [filter_eq_rejected] at hh ⊢ + dsimp only [assignments, select] + exact hh + +def canonicalMap (F : Type*) [Field F] + (e : AllFieldHistoryRecovery.Targets (K := K) (tick := tick) allocation m) : + LocalMap (AllFieldHistoryRecovery.ideal F allocation m ε e) + (AllFieldHistoryRecovery.canonical (K := K) (tick := tick) F allocation m ε) := by + apply LocalMap.ofExists + refine ⟨_, _, _, (Tensor.pullback_eq_restrict + (AllFieldHistoryRecovery.coordinates allocation m e).symm + (AllFieldHistoryRecovery.coordinates allocation m e).symm + (AllFieldHistoryRecovery.coordinates allocation m e).symm _).symm.trans ?_⟩ + funext x y z + change AllFieldHistoryRecovery.ideal F allocation m ε e _ _ _ = _ + rw [AllFieldHistoryRecovery.ideal_coordinates] + simp only [Equiv.apply_symm_apply] + +def activeExecution (F : Type*) [Field F] (hε : 0 < ε) + (hm : AllFieldHistoryRecovery.minimumDilation (K := K) (tick := tick) allocation ε ≤ m) + (chosen : Choices (K := K) (tick := tick) allocation m ε slack) : + Execution + (AllFieldHistoryRegrouping.activeTensor (K := K) (tick := tick) allocation m F ε) + (Tensor.directSum (fun _ : Tags allocation m ε slack chosen => + AllFieldHistoryRegrouping.producedTensor (K := K) (tick := tick) allocation m F ε)) := by + let prepared := (Execution.initial + (AllFieldHistoryRegrouping.activeTensor (K := K) (tick := tick) allocation m F ε)).restrict _ + (AllFieldHistorySource.preparedMap (K := K) (tick := tick) allocation m F ε) + let repaired := prepared.extractSelectedAndRepair + (assignment allocation m ε slack chosen) (coherent allocation m ε slack F chosen) + (select allocation m ε slack chosen) (select_injective allocation m ε slack chosen) + (fun j => AllFieldHistoryRecovery.ideal F allocation m ε (targets allocation m ε slack chosen j)) + (AllFieldHistoryRecovery.shiftCount (K := K) (tick := tick) allocation ε m) + (repair allocation m ε slack F hε hm chosen) + let canonical := repaired.restrict _ (LocalMap.directSum _ _ + (fun j => canonicalMap allocation m ε F (targets allocation m ε slack chosen j))) + exact canonical.restrict _ + ((AllFieldHistoryProduced.map (K := K) (tick := tick) allocation m F hε.le).parallelCopies _) + +@[simp] theorem activeExecution_copies (F : Type*) [Field F] (hε : 0 < ε) + (hm : AllFieldHistoryRecovery.minimumDilation (K := K) (tick := tick) allocation ε ≤ m) + (chosen : Choices (K := K) (tick := tick) allocation m ε slack) : + Fintype.card (activeExecution allocation m ε slack F hε hm chosen).Copies = + 2 ^ (3 * AllFieldHistoryRecovery.shiftCount (K := K) (tick := tick) allocation ε m) := by + change Fintype.card (InverseLinearRecovery.MaskRectangles + (AllFieldHistoryRecovery.shiftCount (K := K) (tick := tick) allocation ε m) × PUnit) = _ + rw [Fintype.card_prod, ExactRecovery.card_mask_rectangles, Fintype.card_fin, + Fintype.card_punit, mul_one] + +theorem card_tags (chosen : Choices (K := K) (tick := tick) allocation m ε slack) : + Fintype.card (Tags allocation m ε slack chosen) = + ∏ _sigma : Placement, + ⌊Real.exp ((m : ℝ) * (nativeCapacity (K := K) (tick := tick) allocation - slack))⌋₊ := by + rw [Fintype.card_pi] + apply Finset.prod_congr rfl + intro sigma _ + simpa only [Fintype.card_coe] using (chosen sigma).card_targets + +def execution (F : Type*) [Field F] (hε : 0 < ε) + (hm : AllFieldHistoryRecovery.minimumDilation (K := K) (tick := tick) allocation ε ≤ m) + (chosen : Choices (K := K) (tick := tick) allocation m ε slack) : + Execution (stateTensor F (K := K) allocation m ε tick) + (Tensor.directSum (fun _ : Tags allocation m ε slack chosen => + stateTensor F (K := K) allocation m ε (tick + 1))) := + AllFieldHistoryTickCarry.liftExecution (K := K) (tick := tick) allocation m F ε + (activeExecution allocation m ε slack F hε hm chosen) + +@[simp] theorem execution_copies (F : Type*) [Field F] (hε : 0 < ε) + (hm : AllFieldHistoryRecovery.minimumDilation (K := K) (tick := tick) allocation ε ≤ m) + (chosen : Choices (K := K) (tick := tick) allocation m ε slack) : + Fintype.card (execution allocation m ε slack F hε hm chosen).Copies = + 2 ^ (3 * AllFieldHistoryRecovery.shiftCount (K := K) (tick := tick) allocation ε m) := + activeExecution_copies allocation m ε slack F hε hm chosen + +end MatrixMultiplication.AllFieldHistoryTick + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldHistory/TickCarry.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldHistory/TickCarry.lean new file mode 100644 index 0000000000000000000000000000000000000000..36a95cb8e43292fbc01d1ac0559efa85a0b73ac4 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldHistory/TickCarry.lean @@ -0,0 +1,81 @@ +import OAI.LinearAlgebra.MatrixMultiplication.FieldHistory.Regrouping + +namespace OAI + +/-! Finite extraction histories, inherited masks and recovery bounds. -/ + +noncomputable section + +namespace MatrixMultiplication.AllFieldHistoryTickCarry + +open MatrixMultiplication.Foundation AllFieldHistory AllFieldFiniteFamily +open AllFieldHistoryRegrouping +open scoped Classical +attribute [local instance] Classical.propDecidable Classical.decEq + +section Distribution + +variable {F : Type*} [Field F] + +def distributeProduct + {X Y Z U V W : Type} + [Fintype X] [Fintype Y] [Fintype Z] + [Fintype U] [Fintype V] [Fintype W] + (active : Tensor F X Y Z) (carried : Tensor F U V W) + (J : Type) [Fintype J] : + LocalMap (Tensor.product (Tensor.directSum (fun _ : J => active)) carried) + (Tensor.directSum (fun _ : J => Tensor.product active carried)) where + x := fun x s => if s = ((x.1, x.2.1), x.2.2) then 1 else 0 + y := fun y s => if s = ((y.1, y.2.1), y.2.2) then 1 else 0 + z := fun z s => if s = ((z.1, z.2.1), z.2.2) then 1 else 0 + coefficient := by + rw [← Tensor.pullback_eq_restrict] + funext x y z + simp [Tensor.pullback, Tensor.directSum, Tensor.product, ite_mul] + +end Distribution + +variable {K tick : ℕ} (allocation : Allocation) (m : ℕ) + (F : Type*) [Field F] (ε : ℝ) {J : Type} [Fintype J] + +def liftExecution + (E : Execution + (activeTensor (K := K) (tick := tick) allocation m F ε) + (Tensor.directSum (fun _ : J => + producedTensor (K := K) (tick := tick) allocation m F ε))) : + Execution (stateTensor F (K := K) allocation m ε tick) + (Tensor.directSum (fun _ : J => + stateTensor F (K := K) allocation m ε (tick + 1))) where + Copies := E.Copies + copies_positive := E.copies_positive + map := + ((activeCarriedMap (K := K) (tick := tick) allocation m F ε).parallelCopies E.Copies).comp + ((LocalMap.replicationProduct + (activeTensor (K := K) (tick := tick) allocation m F ε) + (carriedTensor (K := K) (tick := tick) allocation m F ε) E.Copies).comp + ((E.map.product + (LocalMap.identity (carriedTensor (K := K) (tick := tick) allocation m F ε))).comp + ((distributeProduct + (producedTensor (K := K) (tick := tick) allocation m F ε) + (carriedTensor (K := K) (tick := tick) allocation m F ε) J).comp + ((nextMap (K := K) (tick := tick) allocation m F ε).parallelCopies J)))) + +@[simp] theorem liftExecution_copies + (E : Execution + (activeTensor (K := K) (tick := tick) allocation m F ε) + (Tensor.directSum (fun _ : J => + producedTensor (K := K) (tick := tick) allocation m F ε))) : + (liftExecution allocation m F ε E).Copies = E.Copies := rfl + +@[simp] theorem liftExecution_card_copies + (E : Execution + (activeTensor (K := K) (tick := tick) allocation m F ε) + (Tensor.directSum (fun _ : J => + producedTensor (K := K) (tick := tick) allocation m F ε))) : + Fintype.card (liftExecution allocation m F ε E).Copies = Fintype.card E.Copies := rfl + +end MatrixMultiplication.AllFieldHistoryTickCarry + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldHistory/Transitions.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldHistory/Transitions.lean new file mode 100644 index 0000000000000000000000000000000000000000..9a9c56406300e471f3d10bc4c75b8a1690bd897d --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldHistory/Transitions.lean @@ -0,0 +1,183 @@ +import OAI.LinearAlgebra.MatrixMultiplication.FieldHistory.Counts + +namespace OAI + +/-! Finite extraction histories, inherited masks and recovery bounds. -/ + +noncomputable section +namespace MatrixMultiplication.AllFieldHistory + +open AllFieldParameters +open scoped BigOperators +attribute [local instance] Classical.propDecidable Classical.decEq + +def due {K : ℕ} (tick : ℕ) : CanonicalHistory K → Prop + | .initial h => initialShape h ∈ positiveInitial ∧ tick = h.1.val + | .afterA h => aShape h ∈ positiveSecond ∧ tick = h.1.val.1.val + 1 + | .afterB _ => False + | .partC h => tick = h.1.val.1.val.1.val.1.val + 2 + | .afterC _ => False + +def produced {K : ℕ} (tick : ℕ) : CanonicalHistory K → Prop + | .initial _ => False + | .afterA h => tick = h.1.val.1.val + | .afterB h => tick = h.1.val.1.val.1.val + 1 ∧ positive (bShape h) ≠ true + | .partC h => tick = h.1.val.1.val.1.val.1.val + 1 + | .afterC h => tick = h.1.1.val.1.val.1.val.1.val + 2 + +abbrev Carried (K tick : ℕ) := {h : State K tick // ¬ due tick h.val.1} +abbrev Produced (K tick : ℕ) := {h : History K // produced tick h.1} + +theorem produced_not_resident {K tick : ℕ} (h : CanonicalHistory K) + (hp : produced tick h) : ¬ resident tick h := by + cases h with + | initial h => exact False.elim hp + | afterA h => simp only [produced] at hp; simp only [resident]; omega + | afterB h => simp only [produced] at hp; simp only [resident]; omega + | partC h => simp only [produced] at hp; simp only [resident]; omega + | afterC h => simp only [produced] at hp; simp only [resident]; omega + +theorem resident_succ_iff {K tick : ℕ} (h : CanonicalHistory K) : + resident (tick + 1) h ↔ (resident tick h ∧ ¬ due tick h) ∨ produced tick h := by + cases h with + | initial h => + by_cases hp : initialShape h ∈ positiveInitial + · simp only [resident, due, produced, hp, true_implies, true_and, or_false] + omega + · simp [resident, due, produced, hp] + | afterA h => + by_cases hp : aShape h ∈ positiveSecond + · simp only [resident, due, produced, hp, true_implies, true_and] + omega + · simp only [resident, due, produced, hp, false_implies, and_true, false_and, + not_false_eq_true] + omega + | afterB h => + by_cases hp : positive (bShape h) = true + · simp [resident, due, produced, hp] + · simp [resident, due, produced, hp, ne_eq] + omega + | partC h => simp only [resident, due, produced]; omega + | afterC h => simp only [resident, due, produced, not_false_eq_true, and_true]; omega + +def stateTransitionForward {K tick : ℕ} (h : State K (tick + 1)) : + Carried K tick ⊕ Produced K tick := by + by_cases hr : resident tick h.val.1 + · refine Sum.inl ⟨⟨h.val, hr⟩, ?_⟩ + rcases (resident_succ_iff h.val.1).mp h.property with hc | hp + · exact hc.2 + · exact False.elim (produced_not_resident _ hp hr) + · refine Sum.inr ⟨h.val, ?_⟩ + rcases (resident_succ_iff h.val.1).mp h.property with hc | hp + · exact False.elim (hr hc.1) + · exact hp + +def stateTransitionBackward {K tick : ℕ} : Carried K tick ⊕ Produced K tick → + State K (tick + 1) + | .inl h => ⟨h.val.val, (resident_succ_iff _).mpr (.inl ⟨h.val.property, h.property⟩)⟩ + | .inr h => ⟨h.val, (resident_succ_iff _).mpr (.inr h.property)⟩ + +def stateTransition {K tick : ℕ} : State K (tick + 1) ≃ Carried K tick ⊕ Produced K tick where + toFun := stateTransitionForward + invFun := stateTransitionBackward + left_inv h := by + unfold stateTransitionForward + split_ifs <;> rfl + right_inv h := by + cases h with + | inl h => simp [stateTransitionForward, stateTransitionBackward, h.val.property] + | inr h => + have hn := produced_not_resident h.val.1 h.property + simp [stateTransitionForward, stateTransitionBackward, hn] + +def productionParent {K tick : ℕ} (p : Produced K tick) : Active K tick := by + rcases p with ⟨⟨h, phi⟩, hp⟩ + cases h with + | initial h => exact False.elim hp + | afterA h => + refine ⟨(.stageA h.1, phi), ?_⟩ + exact hp.symm + | afterB h => + refine ⟨(.stageB h.1, phi), ?_⟩ + exact hp.1.symm + | partC h => + refine ⟨(.stageB h.1.val.1, phi), ?_⟩ + exact hp.symm + | afterC h => + refine ⟨(.stageC h.1, phi), ?_⟩ + exact hp.symm + +abbrev DueState (K tick : ℕ) := {h : State K tick // due tick h.val.1} + +def activeToDue {K tick : ℕ} (w : Active K tick) : DueState K tick := by + refine ⟨⟨(w.val.1.source, w.val.2), ?_⟩, ?_⟩ + · exact Eq.mp (congrArg (fun n => resident n w.val.1.source) w.property) + (work_source_resident w.val.1) + · rcases w with ⟨⟨w, phi⟩, hw⟩ + cases w with + | stageA h => exact ⟨h.property, hw.symm⟩ + | stageB h => exact ⟨h.property, hw.symm⟩ + | stageC h => exact hw.symm + +def dueToActive {K tick : ℕ} (h : DueState K tick) : Active K tick := by + rcases h with ⟨⟨⟨h, phi⟩, hr⟩, hd⟩ + cases h with + | initial h => exact ⟨(.stageA ⟨h, hd.1⟩, phi), hd.2.symm⟩ + | afterA h => exact ⟨(.stageB ⟨h, hd.1⟩, phi), hd.2.symm⟩ + | afterB h => exact False.elim hd + | partC h => exact ⟨(.stageC h, phi), hd.symm⟩ + | afterC h => exact False.elim hd + +def activeSourceEquiv {K tick : ℕ} : Active K tick ≃ DueState K tick where + toFun := activeToDue + invFun := dueToActive + left_inv w := by + rcases w with ⟨⟨w, phi⟩, hw⟩ + cases w <;> rfl + right_inv h := by + rcases h with ⟨⟨⟨h, phi⟩, hr⟩, hd⟩ + cases h with + | initial h => rfl + | afterA h => rfl + | afterB h => exact False.elim hd + | partC h => rfl + | afterC h => exact False.elim hd + +def bSubdivisionPositionEquiv {K : ℕ} (allocation : Allocation) (dilation : ℕ) + (h : BPositive K) (phi : Placement) : + Fin (population allocation dilation (.afterB h.val, phi)) ≃ + (Σ i : Fin 3, Fin (population allocation dilation (.partC (h, i), phi))) := + Fintype.equivOfCardEq (by + simp only [Fintype.card_fin, Fintype.card_sigma] + exact (part_population_transition allocation dilation h phi).symm) + +theorem final_state_terminal {K : ℕ} (h : State K (K + 2)) : terminal h.val.1 := by + have hr := h.property + have hlot := (initialAncestor h.val.1).1.isLt + cases hh : h.val.1 with + | initial g => + simp only [hh, resident] at hr + simp only [hh, initialAncestor] at hlot + intro hp + have := hr hp + omega + | afterA a => + simp only [hh, resident] at hr + simp only [hh, initialAncestor] at hlot + intro hp + have := hr.2 hp + omega + | afterB b => + simp only [hh, resident] at hr + exact hr.2 + | partC c => + simp only [hh, resident] at hr + simp only [hh, initialAncestor] at hlot + omega + | afterC c => trivial + +end MatrixMultiplication.AllFieldHistory + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldParameters/Basic.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldParameters/Basic.lean new file mode 100644 index 0000000000000000000000000000000000000000..fd54b198d04790330877bf98519c72be9791af72 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldParameters/Basic.lean @@ -0,0 +1,232 @@ +import OAI.LinearAlgebra.MatrixMultiplication.Numerical.ComplexRationalLogCertificate + +namespace OAI + +/-! Fixed rational distributions and their entropy and capacity formulas. -/ + +namespace MatrixMultiplication.AllFieldParameters + +open scoped BigOperators + +abbrev Shape := Fin 3 → ℕ + +def shape (a b c : ℕ) : Shape := ![a, b, c] + +def shapes (n : ℕ) : List Shape := + (List.range (n + 1)).flatMap fun a => + (List.range (n + 1 - a)).map fun b => shape a b (n - a - b) + +def positive (s : Shape) : Bool := s 0 > 0 && s 1 > 0 && s 2 > 0 + +def sorted (s : Shape) : Bool := s 0 ≤ s 1 && s 1 ≤ s 2 + +def sortedInitial : List Shape := (shapes 16).filter sorted + +def positiveInitial : List Shape := sortedInitial.filter positive + +def positiveSecond : List Shape := (shapes 8).filter positive + +def zeroSecond : List Shape := (shapes 8).filter (fun s => !positive s) + +def shapeMax (s : Shape) : ℕ := max (s 0) (max (s 1) (s 2)) + +def below (s : Shape) : List Shape := + (shapes ((s 0 + s 1 + s 2) / 2)).filter + (fun u => u 0 ≤ s 0 && u 1 ≤ s 1 && u 2 ≤ s 2) + +def complement (s u : Shape) : Shape := fun i => s i - u i + +def tablea : List ℤ := + [-55839, -36137, -17449, -1780, 11561, 22640, 31188, 36731, 38593, 35898, + 29051, 18387, 3823, -14569, -39776, -38598, -23708] + +def tableP : List ℤ := + [-3070, 295, -20546, -1514, -38211, -9654, -7530, -2765, -55230, -16412, + -14246, -5912, -78106, -32809, -7009, -26324, -13519, -3592, -96458, -47439, + -16217, -46871, -25058, -9643, -95643, -62269, -28725, -8576, -2535, -2550, + -34711, -7207, -3270, -6376, -53221, -15352, -3477, -14828, -4187, -74924, + -32439, -7231, -3578, -24599, -8700, -92989, -46655, -16926, -3517, -42976, + -20283, -5132, -107049, -63201, -31013, -9730, -3705, -67421, -35684, -13735, + -68829, -36752, -13993, -7658, -7586, -76746, -33496, -7329, -7447, -17336, + -4721, -96770, -49297, -17874, -7143, -30044, -10107, -116558, -68325, -33467, + -10424, -7476, -51341, -24711, -5530, -76548, -41988, -15608, -17266, -4357, + -17106, -4343, -120770, -70820, -34294, -10580, -16819, -4315, -32943, -9992, + -83616, -44202, -16154, -17098, -4371, -56609, -25990, -5564, -56356, -25900, + -5561, -33052, -9918, -32951, -9906, -57255, -26128, -5560] + +def tablep : List ℤ := + [-39594, -5561, -55254, -15178, -62331, -19672, -54917, -18539, -16455, -32184, + -5716, -11688, -5527, -53009, -6669, -6669, -64938, -20286, -6616, -26336, + -26429, -6696, -60888, -19760, -6690, -5724, -32216, -15829, -58477, -18987, + -26339, -6619, -26393, -26340, -26359, -6620, -16239, -55176, -18587, -55107, + -18571, -16272, -60868, -19755, -6696, -6692, -55133, -18580, -16247, -32128, + -5727, -32138, -5725, -122] + +def tabled : List ℤ := + [63, 97655, 0, 42132, 92966, 1204, 42148, 95604, 41743, 3057, + 109933, 42092, 3747, 41991, 1, 100622, 42166, 103562, 9039, 42157, + 103577, 42165, 63582, 110082, 4584, 42175, 104091, 38838, 102383, 104793, + 42126, 11814, 63338, 42165, 104864, 3587, 42166, 110086, 2207, 94768, + 42166, 104185, 4735, 38889, 110065, 42166, 102372, 104314, 38956, 4876, + 102395, 42166, 110068, 2953, 42166, 96000, 41863, 95723, 3031, 63321, + 42040, 42174, 104662, 11860, 104902, 42189, 2967, 96042, 42047, 109872, + 3986, 42200, 3834, 110106, 60257] + +def tablez : List ℤ := + [-11037, -36170, -4779, 23107, -12831, 29263, 45052, 22289, -6216, 23895, + -14326, -40670, -9623, -34674, -12708, -36610, -2174, 21564, -5587, 22521, + -9766, 28961, 43809, 22299, -12216, 28778, 44147, 22176, -7811, 21870, + -6053, 23786, -166, 94, -52, 17] + +theorem table_lengths : + [tablea.length, tableP.length, tablep.length, tabled.length, tablez.length] = + [17, 118, 54, 75, 36] := by decide +kernel + +theorem parent_counts : + [sortedInitial.length, positiveInitial.length, positiveSecond.length, + zeroSecond.length] = [30, 21, 21, 24] := by decide +kernel + +def statisticWeight : Fin 6 → ℕ := ![0, 1, 2, 2, 3, 4] + +def multiplicity : Fin 6 → ℕ := ![1, 10, 25, 2, 10, 1] + +def kappa : Fin 6 → Fin 6 := ![5, 4, 2, 3, 1, 0] + +theorem kappa_involution (i : Fin 6) : kappa (kappa i) = i := by + revert i + decide +kernel + +theorem multiplicity_kappa (i : Fin 6) : multiplicity (kappa i) = multiplicity i := by + revert i + decide +kernel + +theorem statisticWeight_kappa (i : Fin 6) : + statisticWeight (kappa i) = 4 - statisticWeight i := by + revert i + decide +kernel + +def weight (n : ℤ) : ℚ := + (∑ j ∈ Finset.range 17, ((n : ℚ) / 640000) ^ j / Nat.factorial j) ^ 64 + +theorem weight_nonnegative (n : ℤ) : 0 ≤ weight n := by + unfold weight + positivity + +abbrev SplitKey := Shape × Fin 3 × ℕ + +def splitKeys (parents : List Shape) : List SplitKey := + parents.flatMap fun s => + ([0, 1, 2] : List (Fin 3)).flatMap fun i => + (List.range (s i / 2)).filterMap fun j => + if s i - (s 0 + s 1 + s 2) / 2 ≤ j then some (s, i, j) else none + +def assigned {α : Type} [BEq α] (keys : List α) (data : List ℤ) (key : α) : ℤ := + (((keys.zip data).find? (fun e => e.1 == key)).map Prod.snd).getD 0 + +def splitSignature (parents : List Shape) (data : List ℤ) (s u : Shape) : Fin 3 → ℤ := + fun i => assigned (splitKeys parents) data (s, i, min (u i) (s i - u i)) + +def stageASignature := splitSignature positiveInitial tableP + +def stageBSignature := splitSignature positiveSecond tablep + +def splitWeight (parents : List Shape) (data : List ℤ) (s u : Shape) : ℚ := + ∏ i : Fin 3, weight (splitSignature parents data s u i) + +def splitLaw (parents : List Shape) (data : List ℤ) (s u : Shape) : ℚ := + if u ∈ below s then + splitWeight parents data s u / ((below s).map (splitWeight parents data s)).sum + else 0 + +def stageALaw := splitLaw positiveInitial tableP + +def stageBLaw := splitLaw positiveSecond tablep + +theorem split_consumption : + [(splitKeys positiveInitial).length, (splitKeys positiveSecond).length] = + [118, 54] := by decide +kernel + +theorem splitSignature_complement (parents : List Shape) (data : List ℤ) + (s u : Shape) (h : ∀ i, u i ≤ s i) : + splitSignature parents data s (complement s u) = splitSignature parents data s u := by + funext i + simp only [splitSignature, complement, Nat.sub_sub_self (h i), min_comm] + +theorem splitWeight_complement (parents : List Shape) (data : List ℤ) + (s u : Shape) (h : ∀ i, u i ≤ s i) : + splitWeight parents data s (complement s u) = splitWeight parents data s u := by + simp only [splitWeight, splitSignature_complement parents data s u h] + +theorem splitLaw_complement (parents : List Shape) (data : List ℤ) + (s u : Shape) (h : ∀ i, u i ≤ s i) + (hu : u ∈ below s) (hc : complement s u ∈ below s) : + splitLaw parents data s (complement s u) = splitLaw parents data s u := by + simp only [splitLaw, hu, hc, ite_true, splitWeight_complement parents data s u h] + +theorem splitLaw_outside_support (parents : List Shape) (data : List ℤ) + (s u : Shape) (hu : u ∉ below s) : splitLaw parents data s u = 0 := by + simp only [splitLaw, hu, ite_false] + +def binaryKeys : List (Shape × Shape) := + positiveSecond.flatMap fun t => + ((below t).filter (fun u => shapeMax u == 2)).map fun u => (t, u) + +def binaryInteger (t u : Shape) : ℤ := assigned binaryKeys tabled (t, u) + +def binaryParameter (t u : Shape) : ℚ := (binaryInteger t u : ℚ) / 1000000 + +theorem binary_consumption : binaryKeys.length = 75 := by decide +kernel + +theorem binary_table_range : tabled.all (fun n => 0 ≤ n && n ≤ 110106) = true := by + decide +kernel + +theorem complementary_binary_parameters_are_distinct : + binaryInteger (shape 1 3 4) (shape 0 2 2) = 92966 ∧ + binaryInteger (shape 1 3 4) (shape 1 1 2) = 1204 := by decide +kernel + +theorem unreachable_parent_retained : shape 6 1 1 ∈ positiveSecond := by decide +kernel + +abbrev PairSlot := Fin 6 × Fin 6 + +def unorderedPairs (t : Shape) : List PairSlot := + (List.finRange 6).flatMap fun i => + (List.finRange 6).filterMap fun j => + if i ≤ j ∧ statisticWeight i + statisticWeight j = shapeMax t + then some (i, j) else none + +def pairKeys : List (Shape × PairSlot) := + zeroSecond.flatMap fun t => + ((unorderedPairs t).dropLast).map fun ij => (t, ij) + +def orderedPairInteger (t : Shape) (i j : Fin 6) : ℤ := + assigned pairKeys tablez (t, min i j, max i j) + +def orderedPairs (t : Shape) : List PairSlot := + (List.finRange 6).flatMap fun i => + (List.finRange 6).filterMap fun j => + if statisticWeight i + statisticWeight j = shapeMax t then some (i, j) else none + +def zeroPairLaw (t : Shape) (i j : Fin 6) : ℚ := + if statisticWeight i + statisticWeight j = shapeMax t then + weight (orderedPairInteger t i j) / + ((orderedPairs t).map (fun ij => weight (orderedPairInteger t ij.1 ij.2))).sum + else 0 + +theorem pair_consumption : pairKeys.length = 36 := by decide +kernel + +theorem orderedPairInteger_swap (t : Shape) (i j : Fin 6) : + orderedPairInteger t i j = orderedPairInteger t j i := by + simp only [orderedPairInteger, min_comm, max_comm] + +theorem zeroPairLaw_swap (t : Shape) (i j : Fin 6) : + zeroPairLaw t i j = zeroPairLaw t j i := by + simp only [zeroPairLaw, orderedPairInteger_swap t i j, add_comm] + +theorem zeroPairLaw_outside_support (t : Shape) (i j : Fin 6) + (h : statisticWeight i + statisticWeight j ≠ shapeMax t) : + zeroPairLaw t i j = 0 := by + simp only [zeroPairLaw, h, ite_false] + +end MatrixMultiplication.AllFieldParameters + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldParameters/Compatibility.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldParameters/Compatibility.lean new file mode 100644 index 0000000000000000000000000000000000000000..80e25831478579d9345b17af172e1de96cf3877f --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldParameters/Compatibility.lean @@ -0,0 +1,52 @@ +import OAI.LinearAlgebra.MatrixMultiplication.FieldParameters.Distributions +import Mathlib.Tactic.FinCases + +namespace OAI + +/-! Fixed rational distributions and their entropy and capacity formulas. -/ + +namespace MatrixMultiplication.AllFieldParameters + +def statisticLaw (d : ℚ) (k : Fin 5) (i : Fin 6) : ℚ := + if k.val = 2 then + if i = 2 then 1 - d else if i = 3 then d else 0 + else if i = singletonSlot k.val then 1 else 0 + +def statisticComplement (k : Fin 5) : Fin 5 := ⟨4 - k.val, by omega⟩ + +theorem statisticLaw_complement (d : ℚ) (k : Fin 5) (i : Fin 6) : + statisticLaw d k (kappa i) = statisticLaw d (statisticComplement k) i := by + fin_cases k <;> fin_cases i <;> rfl + +theorem statisticLaw_outside_support (d : ℚ) (k : Fin 5) (i : Fin 6) + (h : statisticWeight i ≠ k.val) : statisticLaw d k i = 0 := by + fin_cases k <;> fin_cases i + all_goals first | rfl | exact False.elim (h (by decide)) + +theorem littleLaw_eq_statisticLaw (t u : Shape) (w : Fin 3) (hw : u w < 5) (i : Fin 6) : + littleLaw t u w i = statisticLaw (binaryParameter t u) ⟨u w, hw⟩ i := rfl + +theorem littleLaw_outside_support (t u : Shape) (w : Fin 3) (hw : u w < 5) (i : Fin 6) + (h : statisticWeight i ≠ u w) : littleLaw t u w i = 0 := + statisticLaw_outside_support _ ⟨u w, hw⟩ i h + +theorem littleLaw_complement (t u : Shape) (w v : Fin 3) + (hw : u w < 5) (hv : u v < 5) (hsum : u w + u v = 4) (i : Fin 6) : + littleLaw t u w (kappa i) = littleLaw t u v i := by + rw [littleLaw_eq_statisticLaw t u w hw, littleLaw_eq_statisticLaw t u v hv] + have hk : (⟨u v, hv⟩ : Fin 5) = statisticComplement ⟨u w, hw⟩ := by + apply Fin.ext + simp only [statisticComplement] + omega + rw [hk] + exact statisticLaw_complement _ _ _ + +theorem child_statistic_weight_bounded : ∀ t ∈ positiveSecond, ∀ u ∈ below t, + ∀ w : Fin 3, u w < 5 := by decide +kernel + +theorem pair_complement_involution (i j : Fin 6) : + (kappa (kappa i), kappa (kappa j)) = (i, j) := by simp [kappa_involution] + +end MatrixMultiplication.AllFieldParameters + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldParameters/Contractions.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldParameters/Contractions.lean new file mode 100644 index 0000000000000000000000000000000000000000..830baa521db3c132e6b2de41cf92deffc6d141bf --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldParameters/Contractions.lean @@ -0,0 +1,448 @@ +import OAI.LinearAlgebra.MatrixMultiplication.FieldParameters.Basic +import OAI.LinearAlgebra.MatrixMultiplication.Numerical.AllFieldCertificatesReplay +import Std.Data.TreeMap.Basic + +namespace OAI + +/-! Fixed rational distributions and their entropy and capacity formulas. -/ + +namespace MatrixMultiplication.AllFieldParameters.Contractions + +open MatrixMultiplication.AllFieldCertificates.Replay + +abbrev Ref := Nat +abbrev Law (α : Type) := List (α × Ref) + +variable {α : Type} + +structure BuildState where + reversed : List Op := [] + count : Nat := 0 + memo : Std.TreeMap (Nat × Int × Nat) Nat + (cmp := (@lexOrd Nat (Int × Nat) inferInstance lexOrd).compare) := {} + +def BuildState.program (s : BuildState) : Program := s.reversed.reverse.toArray + +def opKey : Op → Nat × Int × Nat + | .constant q => (0,q.num,q.den) + | .add i j => (1,i,j) + | .neg i => (2,i,0) + | .mul i j => (3,i,j) + | .inv i => (4,i,0) + | .log i => (5,i,0) + +abbrev Build := StateM BuildState + +def emit (op : Op) : Build Ref := do + let s ← get + match s.memo[opKey op]? with + | some i => pure i + | none => + let i := s.count + set ({ + reversed := op :: s.reversed + count := i + 1 + memo := s.memo.insert (opKey op) i } : BuildState) + pure i + +def lit (q : ℚ) : Build Ref := emit (.constant q) + +def add (a b : Ref) : Build Ref := + if a = 0 then pure b else if b = 0 then pure a else emit (.add a b) + +def neg (a : Ref) : Build Ref := if a = 0 then pure a else emit (.neg a) + +def sub (a b : Ref) : Build Ref := do add a (← neg b) + +def mul (a b : Ref) : Build Ref := + if a = 0 then pure a else if b = 0 then pure b else + if a = 1 then pure b else if b = 1 then pure a else emit (.mul a b) + +def inv (a : Ref) : Build Ref := if a = 1 then pure a else emit (.inv a) + +def divide (a b : Ref) : Build Ref := do mul a (← inv b) + +def log (a : Ref) : Build Ref := + if a = 0 ∨ a = 1 then pure 0 else emit (.log a) + +def powerAux (a : Ref) : Nat → Nat → Build Ref + | 0, _ => pure 1 + | fuel + 1, n => + if n = 0 then pure 1 else if n = 1 then pure a else do + let h ← powerAux a fuel (n / 2) + let s ← mul h h + if n % 2 = 1 then mul s a else pure s + +def power (a : Ref) (n : Nat) : Build Ref := powerAux a n n + +def sumRefs (xs : List Ref) : Build Ref := xs.foldlM add 0 + +def getLaw [BEq α] (xs : Law α) (key : α) : Ref := + ((xs.find? (fun x => x.1 == key)).map Prod.snd).getD 0 + +def addMass [BEq α] (xs : Law α) (key : α) (mass : Ref) : Build (Law α) := do + match xs with + | [] => pure [(key, mass)] + | (k, v) :: rest => + if k == key then pure ((k, ← add v mass) :: rest) + else pure ((k, v) :: (← addMass rest key mass)) + +def normalize (xs : Law α) : Build (Law α) := do + let total ← sumRefs (xs.map Prod.snd) + xs.mapM fun (key, mass) => do pure (key, ← divide mass total) + +def entropy (xs : List Ref) : Build Ref := do + let xs := xs.filter (· != 0) + let total ← sumRefs xs + sub (← mul total (← log total)) + (← sumRefs (← xs.mapM fun x => do mul x (← log x))) + +def buildWeight (n : ℤ) : Build Ref := do + let y ← divide (← lit n) (← lit 640000) + let terms ← (List.range 17).mapM fun j => do + divide (← power y j) (← lit (Nat.factorial j)) + power (← sumRefs terms) 64 + +def insertInteger (n : ℤ) : List ℤ → List ℤ + | [] => [n] + | m :: ms => if n ≤ m then n :: m :: ms else m :: insertInteger n ms + +def sortIntegers : List ℤ → List ℤ + | [] => [] + | n :: ns => insertInteger n (sortIntegers ns) + +def weightArguments : List ℤ := + (sortIntegers (0 :: (tablea ++ tableP ++ tablep ++ tablez))).eraseDups + +def buildWeights : Build (Law ℤ) := + weightArguments.mapM fun n => do pure (n, ← buildWeight n) + +def initialMultiplicity (g : Shape) : Nat := + if g 0 = g 2 then 1 else if g 0 = g 1 ∨ g 1 = g 2 then 3 else 6 + +def buildInitial (weights : Law ℤ) : Build (Law Shape) := do + let unnormalized ← sortedInitial.mapM fun g => do + let a := getLaw weights (tablea[g 0]?.getD 0) + let b := getLaw weights (tablea[g 1]?.getD 0) + let c := getLaw weights (tablea[g 2]?.getD 0) + let x ← mul a (← lit (initialMultiplicity g)) + pure (g, ← mul (← mul x b) c) + normalize unnormalized + +def buildSplit (weights : Law ℤ) (parents : List Shape) (data : List ℤ) : + Build (List (Shape × Law Shape)) := + parents.mapM fun s => do + let unnormalized ← (below s).mapM fun u => do + let signature := splitSignature parents data s u + let x ← mul (getLaw weights (signature 0)) (getLaw weights (signature 1)) + pure (u, ← mul x (getLaw weights (signature 2))) + pure (s, ← normalize unnormalized) + +def getSplit (laws : List (Shape × Law Shape)) (s : Shape) : Law Shape := + ((laws.find? (fun x => x.1 == s)).map Prod.snd).getD [] + +def buildBinary : Build (Law (Shape × Shape)) := + binaryKeys.mapM fun (t, u) => do + pure ((t, u), ← divide (← lit (binaryInteger t u)) (← lit 1000000)) + +def buildZeroPairs (weights : Law ℤ) : Build (List (Shape × Law PairSlot)) := + zeroSecond.mapM fun t => do + + let slots := ((unorderedPairs t).flatMap fun (i,j) => [(i,j),(j,i)]).eraseDups + let law := slots.map fun (i,j) => ((i,j), getLaw weights (orderedPairInteger t i j)) + pure (t, ← normalize law) + +def getPairs (laws : List (Shape × Law PairSlot)) (s : Shape) : Law PairSlot := + ((laws.find? (fun x => x.1 == s)).map Prod.snd).getD [] + +def littleLaw (binary : Law (Shape × Shape)) (t u : Shape) (w : Fin 3) : + Build (Law (Fin 6)) := do + if u w = 2 then + let d := getLaw binary (t,u) + let c ← sub 1 d + pure ([(2,c),(3,d)].filter (fun e => e.2 != 0)) + else + pure [((([0,1,2,3,4,5] : List (Fin 6)).find? + (fun i => statisticWeight i == u w)).getD 0, 1)] + +def pair [BEq α] (p : Law Shape) (s : Shape) (q : List (Shape × Law α)) : + Build (Law (α × α)) := do + let mut result := [] + for (u, mass) in p do + let left := ((q.find? (fun e => e.1 == u)).map Prod.snd).getD [] + let right := ((q.find? (fun e => e.1 == complement s u)).map Prod.snd).getD [] + for (i, vi) in left do + for (j, vj) in right do + let product ← mul (← mul mass vi) vj + result ← addMass result (i,j) product + pure result + +def maxAxis (s : Shape) : Fin 3 := + (([0,1,2] : List (Fin 3)).find? (fun w => s w == shapeMax s)).getD 0 + +def buildHalfLaws (splits : List (Shape × Law Shape)) + (binary : Law (Shape × Shape)) (pairs : List (Shape × Law PairSlot)) : + Build (List ((Shape × Fin 3) × Law PairSlot)) := do + let mut result := [] + for t in shapes 8 do + for w in ([0,1,2] : List (Fin 3)) do + let law ← if positive t then do + let p := getSplit splits t + let q ← p.mapM fun (u,_) => do pure (u, ← littleLaw binary t u w) + pair p t q + else if t w = 0 then pure [((0,0),1)] + else if w = maxAxis t then pure (getPairs pairs t) + else pure ((getPairs pairs t).map fun ((i,j),mass) => ((kappa i,kappa j),mass)) + result := result ++ [((t,w),law)] + pure result + +def getHalf (laws : List ((Shape × Fin 3) × Law PairSlot)) (t : Shape) (w : Fin 3) : + Law PairSlot := + ((laws.find? (fun e => e.1 == (t,w))).map Prod.snd).getD [] + +def orders : List (Fin 3 × Fin 3 × Fin 3) := + [(0,1,2),(0,2,1),(1,0,2),(1,2,0),(2,0,1),(2,1,0)] + +def priority (t : Shape) : Fin 3 × Fin 3 × Fin 3 := + (orders.find? fun (x,y,z) => + ([shape 1 1 6, shape 1 2 5, shape 1 3 4, shape 2 2 4, shape 3 2 3]).contains + (shape (t x) (t y) (t z))).getD (0,1,2) + +def capacity [BEq α] (s : Shape) (p : Law Shape) + (order : Fin 3 × Fin 3 × Fin 3) (laws : Shape → Fin 3 → Build (Law α)) : + Build (List Ref) := do + let (x,y,z) := order + let mut marginal := [] + for (u,mass) in p do + marginal ← addMass marginal (u x) mass + let first ← entropy (marginal.map Prod.snd) + let mut result := [first] + for w in [y,z] do + let q ← p.mapM fun (u,_) => do pure (u, ← laws u w) + let mut groups : List (Nat × Law α) := [] + let mut singleton := 0 + for (u,mass) in p do + let law := ((q.find? (fun e => e.1 == u)).map Prod.snd).getD [] + let single := if w = y then u z = 0 else u x = 0 ∨ u y = 0 + if single then + singleton ← add singleton (← mul mass (← entropy (law.map Prod.snd))) + else + let key := u w + let mut group := ((groups.find? (fun e => e.1 == key)).map Prod.snd).getD [] + for (i,val) in law do + group ← addMass group i (← mul mass val) + if groups.any (fun e => e.1 == key) then + groups := groups.map fun e => if e.1 == key then (key,group) else e + else groups := groups ++ [(key,group)] + let groupEntropies ← groups.mapM fun e => entropy (e.2.map Prod.snd) + let j ← add singleton (← sumRefs groupEntropies) + let joint ← pair p s q + let cap ← sub (← entropy (joint.map Prod.snd)) (← mul j (← lit 2)) + result := result ++ [cap] + pure result + +def sortShape (t : Shape) : Shape := + let a := min (t 0) (min (t 1) (t 2)) + let c := max (t 0) (max (t 1) (t 2)) + shape a (t 0 + t 1 + t 2 - a - c) c + +def secondTypes : List Shape := + [shape 1 1 6, shape 1 2 5, shape 1 3 4, shape 2 2 4, shape 2 3 3] + +def buildMasses (a : Law Shape) (splits : List (Shape × Law Shape)) : Build (Law Shape) := + (shapes 8).mapM fun t => do + let terms ← positiveInitial.mapM fun g => do + mul (getLaw a g) (getLaw (getSplit splits g) t) + let mass ← sumRefs terms + pure (t, ← mul mass (← lit 2)) + +def buildLittleMasses (m : Law Shape) (splits : List (Shape × Law Shape)) : + Build (Law (Shape × Shape)) := do + let mut result := [] + for t in positiveSecond do + for (u,mass) in getSplit splits t do + let v ← mul (getLaw m t) (← lit 2) + result := result ++ [((t,u), ← mul v mass)] + pure result + +def addRow [BEq α] (rows : List (α × List Ref)) (key : α) (mass : Ref) + (caps : List Ref) : Build (List (α × List Ref)) := do + rows.mapM fun (k,row) => do + if k == key then + pure (k, ← (List.range 3).mapM fun i => do + add (row[i]?.getD 0) (← mul mass (caps[i]?.getD 0))) + else pure (k,row) + +def rowTotals (rows : List (α × List Ref)) : Build (List Ref) := + (List.range 3).mapM fun i => sumRefs (rows.map fun row => row.2[i]?.getD 0) + +def binaryEntropy (d : Ref) : Build Ref := do + add (← entropy [← sub 1 d,d]) (← mul d (← log (← lit 2))) + +def coefficientStep (xs : List Nat) : List Nat := + (List.range (xs.length + 2)).map fun i => + (xs[i]?.getD 0) + (if i > 0 then 5 * xs[i-1]?.getD 0 else 0) + + (if i > 1 then xs[i-2]?.getD 0 else 0) + +def coefficients : List Nat := (List.range 8).foldl (fun xs _ => coefficientStep xs) [1] + +structure Roots where + weights : Law ℤ + initial : Law Shape + stageA : List (Shape × Law Shape) + stageB : List (Shape × Law Shape) + binary : Law (Shape × Shape) + zeroPairs : List (Shape × Law PairSlot) + halfLaws : List ((Shape × Fin 3) × Law PairSlot) + masses : Law Shape + littleMasses : Law (Shape × Shape) + rowsA : List (Nat × List Ref) + rowsB : List (Shape × List Ref) + LA : List Ref + LB : List Ref + LAB : List Ref + LC : List Ref + lambda : List Ref + LCdirect : List Ref + H0 : Ref + B : Ref + T : Ref + C : Ref + S0 : Ref + S1 : Ref + S2 : Ref + S : Ref + rhs : Ref + exponent : Ref + denominatorSlack : Ref + balanceSlacks : List Ref + thresholdGap : Ref + deriving DecidableEq + +def buildAll : Build Roots := do + let _ ← lit 0 + let _ ← lit 1 + let weights ← buildWeights + let a ← buildInitial weights + let pa ← buildSplit weights positiveInitial tableP + let pb ← buildSplit weights positiveSecond tablep + let binary ← buildBinary + let zpairs ← buildZeroPairs weights + let half ← buildHalfLaws pb binary zpairs + let m ← buildMasses a pa + let mu ← buildLittleMasses m pb + let mut rowsA := (List.range 5).map fun i => (i+1,[0,0,0]) + let mut rowsB := secondTypes.map fun t => (t,[0,0,0]) + for t in positiveSecond do + let caps ← capacity t (getSplit pb t) (priority t) (littleLaw binary t) + rowsB ← addRow rowsB (sortShape t) (getLaw m t) caps + for g in positiveInitial do + let caps ← capacity g (getSplit pa g) (0,1,2) (fun t w => pure (getHalf half t w)) + rowsA ← addRow rowsA (g 0) (getLaw a g) caps + let la ← rowTotals rowsA + let lb ← rowTotals rowsB + let lab ← (List.range 3).mapM fun i => add (la[i]?.getD 0) (lb[i]?.getD 0) + let interior := mu.filter fun e => positive e.1.2 + let total ← sumRefs (interior.map Prod.snd) + let bterms ← interior.mapM fun ((t,u),mass) => do + let rate ← add (← mul (← log (← lit 2)) (← lit 2)) + (← binaryEntropy (getLaw binary (t,u))) + divide (← mul mass rate) (← lit 3) + let b ← sumRefs bterms + let c ← add b (← divide (← sumRefs lab) (← lit 3)) + let lc ← lab.mapM (sub c) + let lambda ← (List.range 3).mapM fun i => do + let numerator ← sub (← mul total (← log (← lit 2))) (lc[i]?.getD 0) + let denominator ← sub (← mul total (← log (← lit 2))) b + divide numerator (← mul denominator (← lit 3)) + let direct ← (List.range 3).mapM fun i => do + let terms ← interior.mapM fun ((t,u),mass) => do + let left ← mul (← sub 1 (lambda[i]?.getD 0)) (← log (← lit 2)) + let right ← mul (lambda[i]?.getD 0) (← binaryEntropy (getLaw binary (t,u))) + mul mass (← add left right) + sumRefs terms + let mut marginal := [] + for (g,mass) in a do + for w in ([0,1,2] : List (Fin 3)) do + marginal ← addMass marginal (g w) (← divide mass (← lit 3)) + let h0 ← entropy (marginal.map Prod.snd) + let s0terms ← (a.filter fun e => !positive e.1).mapM fun (g,mass) => do + mul mass (← log (← lit (coefficients[shapeMax g]?.getD 0))) + let s0 ← sumRefs s0terms + let s1terms ← zeroSecond.mapM fun t => do + let law := getPairs zpairs t + let ent ← entropy (law.map Prod.snd) + let terms ← law.mapM fun ((i,j),mass) => do + mul mass (← log (← lit (multiplicity i * multiplicity j))) + mul (getLaw m t) (← add ent (← sumRefs terms)) + let s1 ← sumRefs s1terms + let mut s2 := 0 + for ((t,u),mass) in mu do + let d := getLaw binary (t,u) + let rate ← if shapeMax u = 4 then pure 0 + else if shapeMax u = 3 then log (← lit 10) + else if !positive u then do + let first ← binaryEntropy d + let second ← mul (← mul (← sub 1 d) (← lit 2)) (← log (← lit 5)) + add first second + else mul (← sub (← lit 2) d) (← log (← lit 5)) + s2 ← add s2 (← mul mass rate) + let volume ← add (← add s0 s1) s2 + let rhs ← mul (← log (← lit 7)) (← lit 8) + let exponent ← divide (← mul (← sub (← sub rhs h0) c) (← lit 3)) volume + let denominatorSlack ← sub (← mul total (← log (← lit 2))) b + let balanceSlacks ← lc.mapM fun v => do sub (← mul total (← log (← lit 2))) v + let thresholdGap ← sub (← lit ((2371054887 : ℚ) / 10^9)) exponent + pure { + weights := weights + initial := a + stageA := pa + stageB := pb + binary := binary + zeroPairs := zpairs + halfLaws := half + masses := m + littleMasses := mu + rowsA := rowsA + rowsB := rowsB + LA := la + LB := lb + LAB := lab + LC := lc + lambda := lambda + LCdirect := direct + H0 := h0 + B := b + T := total + C := c + S0 := s0 + S1 := s1 + S2 := s2 + S := volume + rhs := rhs + exponent := exponent + denominatorSlack := denominatorSlack + balanceSlacks := balanceSlacks + thresholdGap := thresholdGap } + +def built := buildAll.run {} + +def program : Program := built.2.program + +def roots : Roots := built.1 + +noncomputable def exponent : ℝ := program.eval[roots.exponent]?.getD 0 + +noncomputable def scalar (root : Ref) : ℝ := program.eval[root]?.getD 0 + +noncomputable def Y : ℝ := scalar roots.H0 + scalar roots.C + +noncomputable def S : ℝ := scalar roots.S + +noncomputable def R : ℝ := 8 * Real.log 7 + +noncomputable def ratio : ℝ := 3 * (R - Y) / S + +end MatrixMultiplication.AllFieldParameters.Contractions + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldParameters/Distributions.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldParameters/Distributions.lean new file mode 100644 index 0000000000000000000000000000000000000000..265e60ec40aa2f722d51af5622f670f13c4d6947 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldParameters/Distributions.lean @@ -0,0 +1,139 @@ +import OAI.LinearAlgebra.MatrixMultiplication.FieldParameters.Laws + +namespace OAI + +/-! Fixed rational distributions and their entropy and capacity formulas. -/ + +namespace MatrixMultiplication.AllFieldParameters + +open scoped BigOperators + +def initialMultiplicity (s : Shape) : ℕ := + if s 0 = s 1 ∧ s 1 = s 2 then 1 else if s 0 = s 1 ∨ s 1 = s 2 ∨ s 0 = s 2 then 3 else 6 + +def initialInteger (i : ℕ) : ℤ := assigned (List.range 17) tablea i + +def initialWeight (s : Shape) : ℚ := + initialMultiplicity s * ∏ i : Fin 3, weight (initialInteger (s i)) + +def initialLaw (s : Shape) : ℚ := + if s ∈ sortedInitial then initialWeight s / (sortedInitial.map initialWeight).sum else 0 + +theorem initial_table_arguments_bounded : ∀ n ∈ tablea, |n| ≤ 160000 := by decide +kernel + +theorem initialWeight_positive (s : Shape) : 0 < initialWeight s := by + apply mul_pos + · unfold initialMultiplicity + split_ifs <;> norm_num + · apply Finset.prod_pos + intro i _ + apply weight_positive_of_argument_bound + exact assigned_argument_bound _ tablea initial_table_arguments_bounded _ + +theorem initialLaw_positive (s : Shape) (hs : s ∈ sortedInitial) : 0 < initialLaw s := by + rw [initialLaw, ite_eq_left hs] + apply div_pos (initialWeight_positive s) + exact list_sum_map_positive _ _ (by decide +kernel) (fun t _ => initialWeight_positive t) + +theorem initialLaw_normalized : (sortedInitial.map initialLaw).sum = 1 := by + have he : sortedInitial.map initialLaw = sortedInitial.map + (fun s => initialWeight s / (sortedInitial.map initialWeight).sum) := by + apply List.map_congr_left + intro s hs + simp only [initialLaw, hs, ite_true] + rw [he, list_sum_map_div, div_self] + exact ne_of_gt (list_sum_map_positive _ _ (by decide +kernel) + (fun s _ => initialWeight_positive s)) + +theorem binary_table_bounds : ∀ n ∈ tabled, 0 ≤ n ∧ n ≤ 110106 := by decide +kernel + +theorem binaryInteger_bounds (t u : Shape) : + 0 ≤ binaryInteger t u ∧ binaryInteger t u ≤ 110106 := by + rcases assigned_mem_or_zero binaryKeys tabled (t, u) with h | h + · change 0 ≤ assigned binaryKeys tabled (t, u) ∧ assigned binaryKeys tabled (t, u) ≤ 110106 + rw [h] + norm_num + · exact binary_table_bounds _ h + +theorem binaryParameter_bounds (t u : Shape) : + 0 ≤ binaryParameter t u ∧ binaryParameter t u ≤ (110106 : ℚ) / 1000000 := by + obtain ⟨hlo, hhi⟩ := binaryInteger_bounds t u + have hl : (0 : ℚ) ≤ binaryInteger t u := by exact_mod_cast hlo + have hh : (binaryInteger t u : ℚ) ≤ 110106 := by exact_mod_cast hhi + unfold binaryParameter + constructor + · exact div_nonneg hl (by norm_num) + · exact div_le_div_of_nonneg_right hh (by norm_num) + +def singletonSlot (k : ℕ) : Fin 6 := + match k with + | 0 => 0 + | 1 => 1 + | 3 => 4 + | 4 => 5 + | _ => 0 + +def littleLaw (t u : Shape) (w : Fin 3) (i : Fin 6) : ℚ := + if u w = 2 then + if i = 2 then 1 - binaryParameter t u else if i = 3 then binaryParameter t u else 0 + else if i = singletonSlot (u w) then 1 else 0 + +theorem littleLaw_nonnegative (t u : Shape) (w : Fin 3) (i : Fin 6) : + 0 ≤ littleLaw t u w i := by + obtain ⟨hl, hh⟩ := binaryParameter_bounds t u + unfold littleLaw + split_ifs <;> linarith + +theorem littleLaw_normalized (t u : Shape) (w : Fin 3) : + ∑ i : Fin 6, littleLaw t u w i = 1 := by + by_cases h : u w = 2 + · simp only [littleLaw, h, ite_true] + calc + _ = ∑ i : Fin 6, ((if i = 2 then 1 - binaryParameter t u else 0) + + (if i = 3 then binaryParameter t u else 0)) := by + apply Finset.sum_congr rfl + intro i _ + by_cases hi : i = 2 + · subst i + simp [show (2 : Fin 6) ≠ 3 by decide] + · simp [hi] + _ = 1 := by simp [Finset.sum_add_distrib] + · simp [littleLaw, h] + +theorem orderedPairWeight_positive (t : Shape) (i j : Fin 6) : + 0 < weight (orderedPairInteger t i j) := by + apply weight_positive_of_argument_bound + exact assigned_argument_bound _ tablez zero_table_arguments_bounded _ + +theorem orderedPairs_nonempty : ∀ t ∈ zeroSecond, orderedPairs t ≠ [] := by decide +kernel + +theorem orderedPairs_support (t : Shape) (ij : PairSlot) (h : ij ∈ orderedPairs t) : + statisticWeight ij.1 + statisticWeight ij.2 = shapeMax t := by + simp only [orderedPairs, List.mem_flatMap, List.mem_filterMap] at h + obtain ⟨i, _, j, _, he⟩ := h + split_ifs at he with hs + · cases Option.some.inj he + exact hs + +theorem zeroPairLaw_positive (t : Shape) (ht : t ∈ zeroSecond) (ij : PairSlot) + (hij : ij ∈ orderedPairs t) : 0 < zeroPairLaw t ij.1 ij.2 := by + rw [zeroPairLaw, ite_eq_left (orderedPairs_support t ij hij)] + exact div_pos (orderedPairWeight_positive _ _ _) + (list_sum_map_positive _ _ (orderedPairs_nonempty t ht) + (fun p _ => orderedPairWeight_positive t p.1 p.2)) + +theorem zeroPairLaw_normalized (t : Shape) (ht : t ∈ zeroSecond) : + ((orderedPairs t).map (fun ij => zeroPairLaw t ij.1 ij.2)).sum = 1 := by + have he : (orderedPairs t).map (fun ij => zeroPairLaw t ij.1 ij.2) = + (orderedPairs t).map (fun ij => weight (orderedPairInteger t ij.1 ij.2) / + ((orderedPairs t).map (fun p => weight (orderedPairInteger t p.1 p.2))).sum) := by + apply List.map_congr_left + intro ij hij + simp only [zeroPairLaw, orderedPairs_support t ij hij, ite_true] + rw [he, list_sum_map_div, div_self] + exact ne_of_gt (list_sum_map_positive _ _ (orderedPairs_nonempty t ht) + (fun p _ => orderedPairWeight_positive t p.1 p.2)) + +end MatrixMultiplication.AllFieldParameters + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldParameters/Entropy.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldParameters/Entropy.lean new file mode 100644 index 0000000000000000000000000000000000000000..6a1069d020cfbe4dca89c7cb80c71f2b93a1b7b2 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldParameters/Entropy.lean @@ -0,0 +1,58 @@ +import OAI.LinearAlgebra.MatrixMultiplication.FieldParameters.Weights +import OAI.LinearAlgebra.MatrixMultiplication.Entropy.ComplexFiniteEntropy + +namespace OAI + +/-! Fixed rational distributions and their entropy and capacity formulas. -/ + +namespace MatrixMultiplication.AllFieldParameters + +open MatrixMultiplication.Foundation +open scoped BigOperators + +noncomputable section + +def homogeneousEntropy {A : Type*} [Fintype A] (p : A → ℝ) : ℝ := + (∑ a, p a) * Real.log (∑ a, p a) + finiteEntropy p + +theorem homogeneousEntropy_normalized {A : Type*} [Fintype A] + (p : A → ℝ) (hp : ∑ a, p a = 1) : + homogeneousEntropy p = finiteEntropy p := by + simp [homogeneousEntropy, hp] + +theorem entropyTerm_divide (x m : ℝ) : + entropyTerm (x / m) = entropyTerm x / m + (x / m) * Real.log m := by + by_cases hx : x = 0 + · simp [hx] + by_cases hm : m = 0 + · simp [hm] + rw [entropyTerm, Real.log_div hx hm] + unfold entropyTerm + ring + +theorem homogeneousEntropy_eq_mass_mul {A : Type*} [Fintype A] + (p : A → ℝ) (hm : ∑ a, p a ≠ 0) : + homogeneousEntropy p = + (∑ a, p a) * finiteEntropy (fun a => p a / ∑ b, p b) := by + simp only [finiteEntropy, entropyTerm_divide, Finset.sum_add_distrib, + ← Finset.sum_div, ← Finset.sum_mul] + unfold homogeneousEntropy finiteEntropy + rw [div_self hm] + field_simp + ring + +theorem homogeneousEntropy_zero {A : Type*} [Fintype A] : + homogeneousEntropy (fun _ : A => 0) = 0 := by + simp [homogeneousEntropy, finiteEntropy] + +theorem homogeneousEntropy_expansion {A : Type*} [Fintype A] (p : A → ℝ) : + homogeneousEntropy p = + (∑ a, p a) * Real.log (∑ a, p a) - ∑ a, p a * Real.log (p a) := by + simp only [homogeneousEntropy, finiteEntropy, entropyTerm, neg_mul, + Finset.sum_neg_distrib, sub_eq_add_neg] + +end + +end MatrixMultiplication.AllFieldParameters + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldParameters/HalfComplement.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldParameters/HalfComplement.lean new file mode 100644 index 0000000000000000000000000000000000000000..3a5d944e6bcf23eb9d56a04aeb45bff180258d95 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldParameters/HalfComplement.lean @@ -0,0 +1,91 @@ +import OAI.LinearAlgebra.MatrixMultiplication.FieldParameters.HalfLaws + +namespace OAI + +/-! Fixed rational distributions and their entropy and capacity formulas. -/ + +namespace MatrixMultiplication.AllFieldParameters + +open scoped BigOperators + +theorem normalized_singleton_law {A : Type*} [Fintype A] [DecidableEq A] + (p : A → ℚ) (a : A) (hp : ∑ i, p i = 1) + (hs : ∀ i, i ≠ a → p i = 0) (i : A) : p i = if i = a then 1 else 0 := by + have ha : p a = 1 := by + have hsum : (∑ i, p i) = p a := by + apply Finset.sum_eq_single a + · intro i _ hi + exact hs i hi + · simp + exact hsum.symm.trans hp + by_cases hi : i = a + · simp [hi, ha] + · simp [hi, hs i hi] + +theorem pairWeight_zero : ∀ ij : PairSlot, + statisticWeight ij.1 + statisticWeight ij.2 = 0 ↔ ij = (0,0) := by decide +kernel + +theorem pairWeight_eight : ∀ ij : PairSlot, + statisticWeight ij.1 + statisticWeight ij.2 = 8 ↔ ij = (5,5) := by decide +kernel + +theorem pairKappa_zero : ∀ ij : PairSlot, + (kappa ij.1, kappa ij.2) = (0,0) ↔ ij = (5,5) := by decide +kernel + +theorem pairKappa_eight : ∀ ij : PairSlot, + (kappa ij.1, kappa ij.2) = (5,5) ↔ ij = (0,0) := by decide +kernel + +theorem halfLaw_weight_zero (t : Shape) (ht : t ∈ shapes 8) (w : Fin 3) + (hw : t w = 0) (ij : PairSlot) : + halfLaw t w ij = if ij = (0,0) then 1 else 0 := by + apply normalized_singleton_law (halfLaw t w) (0,0) (halfLaw_normalized t ht w) + intro pair hpair + apply halfLaw_outside_support t ht w pair + rw [hw] + exact fun h => hpair ((pairWeight_zero pair).mp h) + +theorem halfLaw_weight_eight (t : Shape) (ht : t ∈ shapes 8) (w : Fin 3) + (hw : t w = 8) (ij : PairSlot) : + halfLaw t w ij = if ij = (5,5) then 1 else 0 := by + apply normalized_singleton_law (halfLaw t w) (5,5) (halfLaw_normalized t ht w) + intro pair hpair + apply halfLaw_outside_support t ht w pair + rw [hw] + exact fun h => hpair ((pairWeight_eight pair).mp h) + +theorem complementary_half_sides_zero_parent : ∀ t ∈ shapes 8, ∀ w v : Fin 3, + w ≠ v → t w + t v = 8 → t ∈ zeroSecond := by decide +kernel + +theorem halfLaw_complementary_sides (t : Shape) (ht : t ∈ shapes 8) + (w v : Fin 3) (hwv : w ≠ v) (hsum : t w + t v = 8) (ij : PairSlot) : + halfLaw t w (kappa ij.1, kappa ij.2) = halfLaw t v ij := by + by_cases hw : t w = 0 + · have hv : t v = 8 := by omega + rw [halfLaw_weight_zero t ht w hw, halfLaw_weight_eight t ht v hv] + simp only [pairKappa_zero] + · by_cases hv : t v = 0 + · have hw8 : t w = 8 := by omega + rw [halfLaw_weight_eight t ht w hw8, halfLaw_weight_zero t ht v hv] + simp only [pairKappa_eight] + · exact halfLaw_zero_complement t + (complementary_half_sides_zero_parent t ht w v hwv hsum) w v hw hv hwv ij + +theorem zero_maximum_axis_nonzero : ∀ t ∈ zeroSecond, t (halfMaxAxis t) ≠ 0 := by + decide +kernel + +theorem halfLaw_at_maximum (t : Shape) (ht : t ∈ zeroSecond) (ij : PairSlot) : + halfLaw t (halfMaxAxis t) ij = zeroPairLaw t ij.1 ij.2 := by + have hp : positive t ≠ true := by simpa using (List.mem_filter.mp ht).2 + simp only [halfLaw, hp, Bool.false_eq_true, ite_false, + ite_eq_right (zero_maximum_axis_nonzero t ht), ite_true] + +theorem zeroPairLaw_shapeMax_eight (t : Shape) (ht : t ∈ zeroSecond) + (hmax : shapeMax t = 8) (ij : PairSlot) : + zeroPairLaw t ij.1 ij.2 = if ij = (5,5) then 1 else 0 := by + have hshape : t ∈ shapes 8 := (List.mem_filter.mp ht).1 + rw [← halfLaw_at_maximum t ht ij] + exact halfLaw_weight_eight t hshape (halfMaxAxis t) + ((halfMaxAxis_spec t hshape).trans hmax) ij + +end MatrixMultiplication.AllFieldParameters + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldParameters/HalfLaws.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldParameters/HalfLaws.lean new file mode 100644 index 0000000000000000000000000000000000000000..c68ca6ce6ffeb7db4f11a875da9df065d457f723 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldParameters/HalfLaws.lean @@ -0,0 +1,260 @@ +import OAI.LinearAlgebra.MatrixMultiplication.FieldParameters.Compatibility +import OAI.LinearAlgebra.MatrixMultiplication.FieldParameters.Traversal + +namespace OAI + +/-! Fixed rational distributions and their entropy and capacity formulas. -/ + +namespace MatrixMultiplication.AllFieldParameters + +open scoped BigOperators + +theorem stageBLaw_nonnegative (t u : Shape) : 0 ≤ stageBLaw t u := by + by_cases hu : u ∈ below t + · exact (stageBLaw_positive t u hu).le + · simp [stageBLaw, splitLaw, hu] + +theorem orderedPairs_mem_iff (t : Shape) (i j : Fin 6) : + (i,j) ∈ orderedPairs t ↔ statisticWeight i + statisticWeight j = shapeMax t := by + constructor + · exact orderedPairs_support t (i,j) + · intro h + apply List.mem_flatMap.mpr + refine ⟨i, by simp, ?_⟩ + apply List.mem_filterMap.mpr + exact ⟨j, by simp, by simp [h]⟩ + +theorem zeroPairLaw_nonnegative (t : Shape) (i j : Fin 6) : 0 ≤ zeroPairLaw t i j := by + unfold zeroPairLaw + split_ifs + · exact div_nonneg (orderedPairWeight_positive t i j).le + (list_sum_map_nonnegative _ _ (fun ij _ => (orderedPairWeight_positive t ij.1 ij.2).le)) + · exact le_rfl + +theorem zeroPairLaw_full_normalized (t : Shape) (ht : t ∈ zeroSecond) : + ∑ ij : PairSlot, zeroPairLaw t ij.1 ij.2 = 1 := by + calc + _ = ∑ ij ∈ (orderedPairs t).toFinset, zeroPairLaw t ij.1 ij.2 := by + symm + apply Finset.sum_subset (Finset.subset_univ _) + intro ij _ hij + have hs : statisticWeight ij.1 + statisticWeight ij.2 ≠ shapeMax t := by + intro h + exact hij (List.mem_toFinset.mpr ((orderedPairs_mem_iff t ij.1 ij.2).mpr h)) + simp [zeroPairLaw, hs] + _ = ((orderedPairs t).map (fun ij => zeroPairLaw t ij.1 ij.2)).sum := + List.sum_toFinset _ (ordered_pairs_nodup t ht) + _ = 1 := zeroPairLaw_normalized t ht + +def positiveHalfLaw (t : Shape) (w : Fin 3) (ij : PairSlot) : ℚ := + ((below t).map fun u => stageBLaw t u * littleLaw t u w ij.1 * + littleLaw t (complement t u) w ij.2).sum + +theorem positiveHalfLaw_nonnegative (t : Shape) (w : Fin 3) (ij : PairSlot) : + 0 ≤ positiveHalfLaw t w ij := by + apply list_sum_map_nonnegative + intro u _ + exact mul_nonneg (mul_nonneg (stageBLaw_nonnegative t u) + (littleLaw_nonnegative t u w ij.1)) + (littleLaw_nonnegative t (complement t u) w ij.2) + +theorem sum_pair_mixture {A : Type*} (xs : List A) (mass : A → ℚ) + (left right : A → Fin 6 → ℚ) + (hl : ∀ x ∈ xs, ∑ i, left x i = 1) + (hr : ∀ x ∈ xs, ∑ i, right x i = 1) : + (∑ ij : PairSlot, (xs.map fun x => mass x * left x ij.1 * right x ij.2).sum) = + (xs.map mass).sum := by + induction xs with + | nil => simp + | cons x xs ih => + have hleft := hl x (by simp) + have hright := hr x (by simp) + have hhead : (∑ ij : PairSlot, mass x * left x ij.1 * right x ij.2) = mass x := by + simp [Fintype.sum_prod_type, ← Finset.mul_sum, hleft, hright] + have htail := ih (fun y hy => hl y (by simp [hy])) (fun y hy => hr y (by simp [hy])) + simpa only [List.map_cons, List.sum_cons, Finset.sum_add_distrib, hhead] using + congrArg (fun q : ℚ => mass x + q) htail + +theorem positiveHalfLaw_normalized (t : Shape) (ht : t ∈ positiveSecond) (w : Fin 3) : + ∑ ij : PairSlot, positiveHalfLaw t w ij = 1 := by + unfold positiveHalfLaw + rw [sum_pair_mixture _ _ _ _ (fun u _ => littleLaw_normalized t u w) + (fun u _ => littleLaw_normalized t (complement t u) w)] + exact stageBLaw_normalized t ht + +theorem stageB_complement_permutation : ∀ t ∈ positiveSecond, + ((below t).map (complement t)).Perm (below t) := by decide +kernel + +theorem stageB_complement_involution (t : Shape) (ht : t ∈ positiveSecond) + (u : Shape) (hu : u ∈ below t) : complement t (complement t u) = u := by + funext w + exact Nat.sub_sub_self ((stageB_support_complement t ht u hu).2 w) + +theorem positiveHalfLaw_swap (t : Shape) (ht : t ∈ positiveSecond) + (w : Fin 3) (i j : Fin 6) : positiveHalfLaw t w (i,j) = positiveHalfLaw t w (j,i) := by + let f := fun u => stageBLaw t u * littleLaw t u w i * littleLaw t (complement t u) w j + let g := fun u => stageBLaw t u * littleLaw t u w j * littleLaw t (complement t u) w i + have hp := (stageB_complement_permutation t ht).map f + have hm : ((below t).map (complement t)).map f = (below t).map g := by + rw [List.map_map] + apply List.map_congr_left + intro u hu + dsimp only [Function.comp_def, f, g] + rw [stageBLaw_complement t u ht hu, stageB_complement_involution t ht u hu] + ring + change ((below t).map f).sum = ((below t).map g).sum + rw [← hp.sum_eq, hm] + +def halfMaxAxis (t : Shape) : Fin 3 := + (([0,1,2] : List (Fin 3)).find? (fun w => t w == shapeMax t)).getD 0 + +def halfLaw (t : Shape) (w : Fin 3) (ij : PairSlot) : ℚ := + if positive t then positiveHalfLaw t w ij + else if t w = 0 then if ij = (0,0) then 1 else 0 + else if w = halfMaxAxis t then zeroPairLaw t ij.1 ij.2 + else zeroPairLaw t (kappa ij.1) (kappa ij.2) + +theorem halfLaw_positive_parent (t : Shape) (ht : t ∈ positiveSecond) + (w : Fin 3) (ij : PairSlot) : halfLaw t w ij = positiveHalfLaw t w ij := by + have hp : positive t = true := (List.mem_filter.mp ht).2 + simp [halfLaw, hp] + +theorem halfLaw_swap (t : Shape) (ht : t ∈ shapes 8) (w : Fin 3) (i j : Fin 6) : + halfLaw t w (i,j) = halfLaw t w (j,i) := by + by_cases hp : positive t = true + · simp only [halfLaw, hp, ite_true] + exact positiveHalfLaw_swap t (List.mem_filter.mpr ⟨ht, hp⟩) w i j + · unfold halfLaw + simp only [hp, Bool.false_eq_true, ite_false] + by_cases hw : t w = 0 + · simp [hw, Prod.mk.injEq, and_comm] + · simp only [hw, ite_false] + by_cases hm : w = halfMaxAxis t + · simpa only [hm, ite_true] using zeroPairLaw_swap t i j + · simpa only [hm, ite_false] using zeroPairLaw_swap t (kappa i) (kappa j) + +theorem halfLaw_nonnegative (t : Shape) (w : Fin 3) (ij : PairSlot) : + 0 ≤ halfLaw t w ij := by + unfold halfLaw + split_ifs + · exact positiveHalfLaw_nonnegative t w ij + · norm_num + · exact le_rfl + · exact zeroPairLaw_nonnegative t ij.1 ij.2 + · exact zeroPairLaw_nonnegative t (kappa ij.1) (kappa ij.2) + +def kappaEquiv : Fin 6 ≃ Fin 6 where + toFun := kappa + invFun := kappa + left_inv := kappa_involution + right_inv := kappa_involution + +theorem sum_pair_kappa (f : PairSlot → ℚ) : + (∑ ij : PairSlot, f (kappa ij.1, kappa ij.2)) = ∑ ij, f ij := + (Equiv.prodCongr kappaEquiv kappaEquiv).sum_comp f + +theorem halfLaw_normalized (t : Shape) (ht : t ∈ shapes 8) (w : Fin 3) : + ∑ ij : PairSlot, halfLaw t w ij = 1 := by + by_cases hp : positive t = true + · simp only [halfLaw, hp, ite_true] + exact positiveHalfLaw_normalized t (List.mem_filter.mpr ⟨ht, hp⟩) w + · have hz : t ∈ zeroSecond := by simp [zeroSecond, ht, hp] + simp only [halfLaw, hp, Bool.false_eq_true, ite_false] + by_cases hw : t w = 0 + · simp [hw] + · simp only [hw, ite_false] + by_cases hm : w = halfMaxAxis t + · simpa only [hm, ite_true] using zeroPairLaw_full_normalized t hz + · simp only [hm, ite_false] + rw [sum_pair_kappa (fun ij => zeroPairLaw t ij.1 ij.2)] + exact zeroPairLaw_full_normalized t hz + +theorem positiveHalfLaw_outside_support (t : Shape) (ht : t ∈ positiveSecond) + (w : Fin 3) (ij : PairSlot) + (h : statisticWeight ij.1 + statisticWeight ij.2 ≠ t w) : + positiveHalfLaw t w ij = 0 := by + unfold positiveHalfLaw + have he : (below t).map (fun u => stageBLaw t u * littleLaw t u w ij.1 * + littleLaw t (complement t u) w ij.2) = (below t).map (fun _ => (0 : ℚ)) := by + apply List.map_congr_left + intro u hu + obtain ⟨hc, hb⟩ := stageB_support_complement t ht u hu + by_cases hi : statisticWeight ij.1 = u w + · have hj : statisticWeight ij.2 ≠ complement t u w := by + intro hj + apply h + rw [hi, hj] + change u w + (t w - u w) = t w + have hw := hb w + omega + rw [littleLaw_outside_support t (complement t u) w + (child_statistic_weight_bounded t ht (complement t u) hc w) ij.2 hj, mul_zero] + · rw [littleLaw_outside_support t u w + (child_statistic_weight_bounded t ht u hu w) ij.1 hi, mul_zero, zero_mul] + rw [he] + simp + +theorem halfMaxAxis_spec : ∀ t ∈ shapes 8, t (halfMaxAxis t) = shapeMax t := by + decide +kernel + +theorem zero_other_axis_spec : ∀ t ∈ zeroSecond, ∀ w : Fin 3, + t w ≠ 0 → w ≠ halfMaxAxis t → t w + shapeMax t = 8 := by decide +kernel + +theorem statisticWeight_le_four (i : Fin 6) : statisticWeight i ≤ 4 := by + revert i + decide +kernel + +theorem halfLaw_outside_support (t : Shape) (ht : t ∈ shapes 8) + (w : Fin 3) (ij : PairSlot) + (h : statisticWeight ij.1 + statisticWeight ij.2 ≠ t w) : + halfLaw t w ij = 0 := by + by_cases hp : positive t = true + · simp only [halfLaw, hp, ite_true] + exact positiveHalfLaw_outside_support t (List.mem_filter.mpr ⟨ht, hp⟩) w ij h + · have hz : t ∈ zeroSecond := by simp [zeroSecond, ht, hp] + simp only [halfLaw, hp, Bool.false_eq_true, ite_false] + by_cases hw : t w = 0 + · have hij : ij ≠ (0,0) := by + intro hij + apply h + rw [hij, hw] + rfl + rw [ite_eq_left hw, ite_eq_right hij] + · simp only [hw, ite_false] + by_cases hm : w = halfMaxAxis t + · have hs : statisticWeight ij.1 + statisticWeight ij.2 ≠ shapeMax t := by + simpa only [hm, halfMaxAxis_spec t ht] using h + simp [hm, zeroPairLaw, hs] + · have hs : statisticWeight (kappa ij.1) + statisticWeight (kappa ij.2) ≠ + shapeMax t := by + have htotal := zero_other_axis_spec t hz w hw hm + have hi := statisticWeight_le_four ij.1 + have hj := statisticWeight_le_four ij.2 + simp only [statisticWeight_kappa] + omega + simp [hm, zeroPairLaw, hs] + +theorem zero_nonzero_axes_distinguished : ∀ t ∈ zeroSecond, ∀ w v : Fin 3, + t w ≠ 0 → t v ≠ 0 → w ≠ v → + (w = halfMaxAxis t ↔ v ≠ halfMaxAxis t) := by decide +kernel + +theorem halfLaw_zero_complement (t : Shape) (ht : t ∈ zeroSecond) + (w v : Fin 3) (hw : t w ≠ 0) (hv : t v ≠ 0) (hwv : w ≠ v) (ij : PairSlot) : + halfLaw t w (kappa ij.1, kappa ij.2) = halfLaw t v ij := by + have hp : positive t ≠ true := by + have h := (List.mem_filter.mp ht).2 + simpa using h + have hm := zero_nonzero_axes_distinguished t ht w v hw hv hwv + by_cases ha : w = halfMaxAxis t + · have hb : v ≠ halfMaxAxis t := hm.mp ha + have hmax : t (halfMaxAxis t) ≠ 0 := by simpa only [ha] using hw + simp [halfLaw, hp, hv, ha, hb, hmax] + · have hb : v = halfMaxAxis t := by + by_contra hne + exact ha (hm.mpr hne) + have hmax : t (halfMaxAxis t) ≠ 0 := by simpa only [hb] using hv + simp [halfLaw, hp, hw, ha, hb, hmax, kappa_involution] + +end MatrixMultiplication.AllFieldParameters + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldParameters/Laws.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldParameters/Laws.lean new file mode 100644 index 0000000000000000000000000000000000000000..9d4cbebf59d370ff41ab5ba584eafd15c0a5aa05 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldParameters/Laws.lean @@ -0,0 +1,123 @@ +import OAI.LinearAlgebra.MatrixMultiplication.FieldParameters.Weights + +namespace OAI + +/-! Fixed rational distributions and their entropy and capacity formulas. -/ + +namespace MatrixMultiplication.AllFieldParameters + +open scoped BigOperators + +theorem assigned_mem_or_zero {α : Type} [BEq α] (keys : List α) (data : List ℤ) (key : α) : + assigned keys data key = 0 ∨ assigned keys data key ∈ data := by + unfold assigned + cases h : (keys.zip data).find? (fun e => e.1 == key) with + | none => simp + | some pair => + right + exact (List.of_mem_zip (List.mem_of_find?_eq_some h)).2 + +theorem assigned_argument_bound {α : Type} [BEq α] (keys : List α) (data : List ℤ) + (hd : ∀ n ∈ data, |n| ≤ 160000) (key : α) : |assigned keys data key| ≤ 160000 := by + rcases assigned_mem_or_zero keys data key with h | h + · rw [h]; norm_num + · exact hd _ h + +theorem splitWeight_positive (parents : List Shape) (data : List ℤ) + (hd : ∀ n ∈ data, |n| ≤ 160000) (s u : Shape) : + 0 < splitWeight parents data s u := by + apply Finset.prod_pos + intro i _ + apply weight_positive_of_argument_bound + exact assigned_argument_bound _ data hd _ + +theorem list_sum_map_nonnegative {α : Type} (xs : List α) (f : α → ℚ) + (hf : ∀ x ∈ xs, 0 ≤ f x) : 0 ≤ (xs.map f).sum := by + induction xs with + | nil => simp + | cons x xs ih => + simp only [List.map_cons, List.sum_cons] + exact add_nonneg (hf x (by simp)) (ih (fun y hy => hf y (by simp [hy]))) + +theorem list_sum_map_positive {α : Type} (xs : List α) (f : α → ℚ) + (hne : xs ≠ []) (hf : ∀ x ∈ xs, 0 < f x) : 0 < (xs.map f).sum := by + cases xs with + | nil => contradiction + | cons x xs => + simp only [List.map_cons, List.sum_cons] + exact add_pos_of_pos_of_nonneg (hf x (by simp)) + (list_sum_map_nonnegative xs f (fun y hy => (hf y (by simp [hy])).le)) + +theorem list_sum_map_div {α : Type} (xs : List α) (f : α → ℚ) (d : ℚ) : + (xs.map (fun x => f x / d)).sum = (xs.map f).sum / d := by + induction xs with + | nil => simp + | cons x xs ih => simp [ih, add_div] + +theorem splitLaw_positive (parents : List Shape) (data : List ℤ) + (hd : ∀ n ∈ data, |n| ≤ 160000) (s u : Shape) (hu : u ∈ below s) : + 0 < splitLaw parents data s u := by + rw [splitLaw, ite_eq_left hu] + apply div_pos (splitWeight_positive parents data hd s u) + apply list_sum_map_positive + · intro he + simp only [he, List.not_mem_nil] at hu + · intro v _ + exact splitWeight_positive parents data hd s v + +theorem splitLaw_normalized (parents : List Shape) (data : List ℤ) + (hd : ∀ n ∈ data, |n| ≤ 160000) (s : Shape) (hne : below s ≠ []) : + ((below s).map (splitLaw parents data s)).sum = 1 := by + have he : (below s).map (splitLaw parents data s) = + (below s).map (fun u => splitWeight parents data s u / + ((below s).map (splitWeight parents data s)).sum) := by + apply List.map_congr_left + intro u hu + simp only [splitLaw, hu, ite_true] + rw [he, list_sum_map_div, div_self] + exact ne_of_gt (list_sum_map_positive (below s) _ hne + (fun u _ => splitWeight_positive parents data hd s u)) + +theorem stageA_table_arguments_bounded : ∀ n ∈ tableP, |n| ≤ 160000 := by decide +kernel + +theorem stageB_table_arguments_bounded : ∀ n ∈ tablep, |n| ≤ 160000 := by decide +kernel + +theorem zero_table_arguments_bounded : ∀ n ∈ tablez, |n| ≤ 160000 := by decide +kernel + +theorem stageA_support_nonempty : ∀ s ∈ positiveInitial, below s ≠ [] := by decide +kernel + +theorem stageB_support_nonempty : ∀ s ∈ positiveSecond, below s ≠ [] := by decide +kernel + +theorem stageA_support_complement : ∀ s ∈ positiveInitial, ∀ u ∈ below s, + complement s u ∈ below s ∧ ∀ i, u i ≤ s i := by decide +kernel + +theorem stageB_support_complement : ∀ s ∈ positiveSecond, ∀ u ∈ below s, + complement s u ∈ below s ∧ ∀ i, u i ≤ s i := by decide +kernel + +theorem stageALaw_positive (s u : Shape) (hu : u ∈ below s) : 0 < stageALaw s u := + splitLaw_positive _ _ stageA_table_arguments_bounded s u hu + +theorem stageBLaw_positive (s u : Shape) (hu : u ∈ below s) : 0 < stageBLaw s u := + splitLaw_positive _ _ stageB_table_arguments_bounded s u hu + +theorem stageALaw_normalized (s : Shape) (hs : s ∈ positiveInitial) : + ((below s).map (stageALaw s)).sum = 1 := + splitLaw_normalized _ _ stageA_table_arguments_bounded s (stageA_support_nonempty s hs) + +theorem stageBLaw_normalized (s : Shape) (hs : s ∈ positiveSecond) : + ((below s).map (stageBLaw s)).sum = 1 := + splitLaw_normalized _ _ stageB_table_arguments_bounded s (stageB_support_nonempty s hs) + +theorem stageALaw_complement (s u : Shape) (hs : s ∈ positiveInitial) (hu : u ∈ below s) : + stageALaw s (complement s u) = stageALaw s u := by + obtain ⟨hc, hb⟩ := stageA_support_complement s hs u hu + exact splitLaw_complement _ _ s u hb hu hc + +theorem stageBLaw_complement (s u : Shape) (hs : s ∈ positiveSecond) (hu : u ∈ below s) : + stageBLaw s (complement s u) = stageBLaw s u := by + obtain ⟨hc, hb⟩ := stageB_support_complement s hs u hu + exact splitLaw_complement _ _ s u hb hu hc + +end MatrixMultiplication.AllFieldParameters + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldParameters/LeafRates.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldParameters/LeafRates.lean new file mode 100644 index 0000000000000000000000000000000000000000..d1c62bf032524f89f2430c3f9b95ded5d369efe1 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldParameters/LeafRates.lean @@ -0,0 +1,114 @@ +import OAI.LinearAlgebra.MatrixMultiplication.FieldParameters.Compatibility +import OAI.LinearAlgebra.MatrixMultiplication.Entropy.ComplexFiniteEntropy + +namespace OAI + +/-! Fixed rational distributions and their entropy and capacity formulas. -/ + +namespace MatrixMultiplication.AllFieldParameters + +open MatrixMultiplication.Foundation +open scoped BigOperators + +noncomputable section + +theorem entropy_two_points {A : Type*} [Fintype A] [DecidableEq A] + (a b : A) (hab : a ≠ b) (p q : ℝ) : + finiteEntropy (fun i => if i = a then p else if i = b then q else 0) = + entropyTerm p + entropyTerm q := by + unfold finiteEntropy + calc + _ = ∑ i : A, ((if i = a then entropyTerm p else 0) + + (if i = b then entropyTerm q else 0)) := by + apply Finset.sum_congr rfl + intro i _ + by_cases hi : i = a + · subst i + simp [hab] + · by_cases hj : i = b + · subst i + simp [hab.symm] + · simp [hi, hj] + _ = _ := by simp [Finset.sum_add_distrib] + +theorem weighted_two_points {A : Type*} [Fintype A] [DecidableEq A] + (a b : A) (hab : a ≠ b) (p q : ℝ) (f : A → ℝ) : + (∑ i : A, (if i = a then p else if i = b then q else 0) * f i) = + p * f a + q * f b := by + calc + _ = ∑ i : A, ((if i = a then p * f a else 0) + + (if i = b then q * f b else 0)) := by + apply Finset.sum_congr rfl + intro i _ + by_cases hi : i = a + · subst i + simp [hab] + · by_cases hj : i = b + · subst i + simp [hi] + · simp [hi, hj] + _ = _ := by simp [Finset.sum_add_distrib] + +def statisticRate (d : ℚ) (k : Fin 5) : ℝ := + finiteEntropy (fun i : Fin 6 => (statisticLaw d k i : ℝ)) + + ∑ i : Fin 6, (statisticLaw d k i : ℝ) * Real.log (multiplicity i : ℝ) + +def binaryEntropyRate (d : ℚ) : ℝ := + entropyTerm (1 - (d : ℝ)) + entropyTerm (d : ℝ) + (d : ℝ) * Real.log 2 + +theorem statisticLaw_two_real (d : ℚ) (i : Fin 6) : + (statisticLaw d 2 i : ℝ) = + if i = 2 then 1 - (d : ℝ) else if i = 3 then (d : ℝ) else 0 := by + by_cases hi : i = 2 + · simp [statisticLaw, hi] + · by_cases hj : i = 3 <;> simp [statisticLaw, hi, hj] + +theorem statisticRate_two (d : ℚ) : + statisticRate d 2 = binaryEntropyRate d + 2 * (1 - (d : ℝ)) * Real.log 5 := by + unfold statisticRate + simp_rw [statisticLaw_two_real] + rw [entropy_two_points (2 : Fin 6) 3 (by decide), + weighted_two_points (2 : Fin 6) 3 (by decide)] + have h25 : Real.log (25 : ℝ) = 2 * Real.log 5 := by + have hp : (5 : ℝ) ^ 2 = 25 := by norm_num + rw [← hp, Real.log_pow] + norm_num + change entropyTerm (1 - (d : ℝ)) + entropyTerm (d : ℝ) + + ((1 - (d : ℝ)) * Real.log 25 + (d : ℝ) * Real.log 2) = _ + rw [h25] + unfold binaryEntropyRate + ring + +theorem statisticRate_deterministic (d : ℚ) (k : Fin 5) (hk : k.val ≠ 2) : + statisticRate d k = Real.log (multiplicity (singletonSlot k.val) : ℝ) := by + have hmass (i : Fin 6) : (statisticLaw d k i : ℝ) = + if i = singletonSlot k.val then 1 else 0 := by + by_cases hi : i = singletonSlot k.val <;> simp [statisticLaw, hk, hi] + unfold statisticRate finiteEntropy + simp_rw [hmass] + simp [entropyTerm, apply_ite] + +theorem statisticRate_zero (d : ℚ) : statisticRate d 0 = 0 := by + rw [statisticRate_deterministic d 0 (by decide)] + norm_num [singletonSlot, multiplicity] + +theorem statisticRate_one (d : ℚ) : statisticRate d 1 = Real.log 10 := by + rw [statisticRate_deterministic d 1 (by decide)] + norm_num [singletonSlot, multiplicity] + +theorem statisticRate_three (d : ℚ) : statisticRate d 3 = Real.log 10 := by + rw [statisticRate_deterministic d 3 (by decide)] + change Real.log (10 : ℝ) = Real.log 10 + rfl + +theorem statisticRate_four (d : ℚ) : statisticRate d 4 = 0 := by + rw [statisticRate_deterministic d 4 (by decide)] + have hv : multiplicity (singletonSlot (4 : Fin 5).val) = 1 := by decide +kernel + rw [hv] + norm_num + +end + +end MatrixMultiplication.AllFieldParameters + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldParameters/StageC.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldParameters/StageC.lean new file mode 100644 index 0000000000000000000000000000000000000000..9378b89f2dbcf804411424961be6da768aadade0 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldParameters/StageC.lean @@ -0,0 +1,49 @@ +import OAI.LinearAlgebra.MatrixMultiplication.FieldParameters.Entropy +import OAI.LinearAlgebra.MatrixMultiplication.Recovery.Staggering + +namespace OAI + +/-! Fixed rational distributions and their entropy and capacity formulas. -/ + +namespace MatrixMultiplication.AllFieldParameters + +open scoped BigOperators + +noncomputable section + +theorem stageC_direct_identity {I : Type*} [Fintype I] + (mass entropy : I → ℝ) (allocation logTwo : ℝ) : + (∑ i, mass i * ((1 - allocation) * logTwo + allocation * entropy i)) = + (∑ i, mass i) * logTwo - 3 * allocation * + ((∑ i, mass i) * logTwo - + (∑ i, mass i * (2 * logTwo + entropy i)) / 3) := by + calc + _ = (∑ i, mass i * logTwo) - 3 * allocation * + ((∑ i, mass i * logTwo) - + (∑ i, mass i * (2 * logTwo + entropy i)) / 3) := by + rw [Finset.sum_div, ← Finset.sum_sub_distrib, Finset.mul_sum, + ← Finset.sum_sub_distrib] + apply Finset.sum_congr rfl + intro i _ + ring + _ = _ := by rw [Finset.sum_mul] + +theorem stageC_direct_balanced {I : Type*} [Fintype I] + (mass entropy : I → ℝ) (a b : Staggering.Capacity) (i : Fin 3) + (hgap : + (∑ j, mass j * (2 * Real.log 2 + entropy j)) / 3 < + (∑ j, mass j) * Real.log 2) : + let high := (∑ j, mass j) * Real.log 2 + let base := (∑ j, mass j * (2 * Real.log 2 + entropy j)) / 3 + let allocation := Staggering.balanceFraction a b high base i + (∑ j, mass j * ((1 - allocation) * Real.log 2 + allocation * entropy j)) = + Staggering.totalCapacity a b base - (a i + b i) := by + dsimp only + rw [stageC_direct_identity] + exact Staggering.thirdCapacity_eq a b _ _ hgap i + +end + +end MatrixMultiplication.AllFieldParameters + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldParameters/Traversal.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldParameters/Traversal.lean new file mode 100644 index 0000000000000000000000000000000000000000..f85e2abc7a5dcf6f086c1b009600f0cb8c4ba53d --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldParameters/Traversal.lean @@ -0,0 +1,39 @@ +import OAI.LinearAlgebra.MatrixMultiplication.FieldParameters.Distributions + +namespace OAI + +/-! Fixed rational distributions and their entropy and capacity formulas. -/ + +namespace MatrixMultiplication.AllFieldParameters + +def placements (s : Shape) : List Shape := + [shape (s 0) (s 1) (s 2), shape (s 0) (s 2) (s 1), + shape (s 1) (s 0) (s 2), shape (s 1) (s 2) (s 0), + shape (s 2) (s 0) (s 1), shape (s 2) (s 1) (s 0)] + +theorem initialMultiplicity_counts_placements : ∀ s ∈ sortedInitial, + (placements s).eraseDups.length = initialMultiplicity s := by decide +kernel + +theorem parents_nodup : sortedInitial.Nodup ∧ positiveInitial.Nodup ∧ + positiveSecond.Nodup ∧ zeroSecond.Nodup := by decide +kernel + +theorem split_keys_nodup : (splitKeys positiveInitial).Nodup ∧ + (splitKeys positiveSecond).Nodup := by decide +kernel + +theorem binary_keys_nodup : binaryKeys.Nodup := by decide +kernel + +theorem pair_keys_nodup : pairKeys.Nodup := by decide +kernel + +theorem stageA_children_nodup : ∀ s ∈ positiveInitial, (below s).Nodup := by decide +kernel + +theorem stageB_children_nodup : ∀ s ∈ positiveSecond, (below s).Nodup := by decide +kernel + +theorem ordered_pairs_nodup : ∀ t ∈ zeroSecond, (orderedPairs t).Nodup := by decide +kernel + +theorem initial_placements_partition : + (sortedInitial.flatMap (fun s => (placements s).eraseDups)).Perm (shapes 16) := by + decide +kernel + +end MatrixMultiplication.AllFieldParameters + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldParameters/Weights.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldParameters/Weights.lean new file mode 100644 index 0000000000000000000000000000000000000000..12133355e44aa266eecc3410d9c106714fe9bfe3 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldParameters/Weights.lean @@ -0,0 +1,65 @@ +import OAI.LinearAlgebra.MatrixMultiplication.FieldParameters.Basic + +namespace OAI + +/-! Fixed rational distributions and their entropy and capacity formulas. -/ + +namespace MatrixMultiplication.AllFieldParameters + +open scoped BigOperators + +theorem truncated_polynomial_positive (y : ℚ) (hy : |y| ≤ 1 / 4) : + 0 < ∑ j ∈ Finset.range 17, y ^ j / Nat.factorial j := by + have term_bound (j : ℕ) : + |y ^ (j + 1) / (Nat.factorial (j + 1) : ℚ)| ≤ (1 / 4 : ℚ) ^ (j + 1) := by + have hd : (1 : ℚ) ≤ Nat.factorial (j + 1) := by + exact_mod_cast (Nat.succ_le_iff.mpr (Nat.factorial_pos (j + 1))) + calc + _ = |y| ^ (j + 1) / (Nat.factorial (j + 1) : ℚ) := by + simp only [abs_div, abs_pow, + abs_of_nonneg (Nat.cast_nonneg (Nat.factorial (j + 1)) : + (0 : ℚ) ≤ (Nat.factorial (j + 1) : ℚ))] + _ ≤ (1 / 4 : ℚ) ^ (j + 1) / (Nat.factorial (j + 1) : ℚ) := by gcongr + _ ≤ _ := div_le_self (by positivity) hd + have hb : |∑ j ∈ Finset.range 16, y ^ (j + 1) / (Nat.factorial (j + 1) : ℚ)| < 1 := by + calc + _ ≤ ∑ j ∈ Finset.range 16, |y ^ (j + 1) / (Nat.factorial (j + 1) : ℚ)| := + Finset.abs_sum_le_sum_abs _ _ + _ ≤ ∑ j ∈ Finset.range 16, (1 / 4 : ℚ) ^ (j + 1) := + Finset.sum_le_sum (fun j _ => term_bound j) + _ < 1 := by norm_num [Finset.sum_range_succ] + rw [show 17 = 16 + 1 by decide, Finset.sum_range_succ'] + norm_num only [pow_zero, Nat.factorial_zero, Nat.cast_one, div_one] + linarith [(abs_lt.mp hb).1] + +theorem weight_positive_of_argument_bound (n : ℤ) (hn : |n| ≤ 160000) : + 0 < weight n := by + unfold weight + apply pow_pos + apply truncated_polynomial_positive + have hn' : |(n : ℚ)| ≤ 160000 := by exact_mod_cast hn + rw [abs_div] + rw [abs_of_pos (by norm_num : (0 : ℚ) < 640000)] + exact (div_le_iff₀ (by norm_num)).mpr (by linarith) + +def weightArguments : List ℤ := 0 :: (tablea ++ tableP ++ tablep ++ tablez) + +theorem all_weight_arguments_bounded : ∀ n ∈ weightArguments, |n| ≤ 160000 := by + decide +kernel + +theorem all_weights_positive (n : ℤ) (hn : n ∈ weightArguments) : 0 < weight n := + weight_positive_of_argument_bound n (all_weight_arguments_bounded n hn) + +theorem normalized_sum {ι : Type} [Fintype ι] (w : ι → ℚ) + (h : ∑ i, w i ≠ 0) : ∑ i, w i / (∑ j, w j) = 1 := by + simp only [div_eq_mul_inv] + rw [← Finset.sum_mul, ← div_eq_mul_inv, div_self h] + +theorem normalized_positive {ι : Type} [Fintype ι] (w : ι → ℚ) + (hw : ∀ i, 0 < w i) (i : ι) : 0 < w i / (∑ j, w j) := by + apply div_pos (hw i) + exact Finset.sum_pos (fun j _ => hw j) ⟨i, Finset.mem_univ i⟩ + +end MatrixMultiplication.AllFieldParameters + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/JointExtraction/APFree.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/JointExtraction/APFree.lean new file mode 100644 index 0000000000000000000000000000000000000000..54f2d12c903d28447ed0190af5c657001db59e8d --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/JointExtraction/APFree.lean @@ -0,0 +1,135 @@ +import Mathlib.Combinatorics.Additive.AP.Three.Behrend +import Mathlib.Data.ZMod.Basic +import Mathlib.Tactic.Linarith + +namespace OAI + +/-! Joint tensor extraction, compatibility and entropy estimates. -/ + +noncomputable section + +namespace MatrixMultiplication.JointAPFree + +def natSet (N : ℕ) : Finset ℕ := (rothNumberNat_spec N).choose + +theorem natSet_subset (N : ℕ) : natSet N ⊆ Finset.range N := + (rothNumberNat_spec N).choose_spec.1 + +theorem natSet_card (N : ℕ) : (natSet N).card = rothNumberNat N := + (rothNumberNat_spec N).choose_spec.2.1 + +theorem natSet_threeAPFree (N : ℕ) : ThreeAPFree (natSet N : Set ℕ) := + (rothNumberNat_spec N).choose_spec.2.2 + +theorem mem_natSet_lt {N a : ℕ} (ha : a ∈ natSet N) : a < N := + Finset.mem_range.mp (natSet_subset N ha) + +theorem natCast_injective_below {M a b : ℕ} (ha : a < M) (hb : b < M) + (hab : (a : ZMod M) = (b : ZMod M)) : a = b := by + have h := congrArg ZMod.val hab + simpa only [ZMod.val_natCast_of_lt ha, ZMod.val_natCast_of_lt hb] using h + +theorem add_lt_modulus {M a b : ℕ} (ha : a < M / 2) (hb : b < M / 2) : + a + b < M := by + have h := Nat.div_mul_le_self M 2 + omega + +def modularSet (M : ℕ) : Finset (ZMod M) := + (natSet (M / 2)).image (fun a : ℕ => (a : ZMod M)) + +theorem modularSet_card (M : ℕ) : + (modularSet M).card = rothNumberNat (M / 2) := by + rw [modularSet, Finset.card_image_iff.mpr, natSet_card] + intro a ha b hb hab + exact natCast_injective_below + ((mem_natSet_lt ha).trans_le (Nat.div_le_self M 2)) + ((mem_natSet_lt hb).trans_le (Nat.div_le_self M 2)) hab + +theorem modularSet_threeAPFree (M : ℕ) : + ThreeAPFree (modularSet M : Set (ZMod M)) := by + intro a ha b hb c hc habc + change a ∈ (natSet (M / 2)).image (fun n : ℕ => (n : ZMod M)) at ha + change b ∈ (natSet (M / 2)).image (fun n : ℕ => (n : ZMod M)) at hb + change c ∈ (natSet (M / 2)).image (fun n : ℕ => (n : ZMod M)) at hc + obtain ⟨a', ha', rfl⟩ := Finset.mem_image.mp ha + obtain ⟨b', hb', rfl⟩ := Finset.mem_image.mp hb + obtain ⟨c', hc', rfl⟩ := Finset.mem_image.mp hc + have hac := add_lt_modulus (mem_natSet_lt ha') (mem_natSet_lt hc') + have hbb := add_lt_modulus (mem_natSet_lt hb') (mem_natSet_lt hb') + have hnat : a' + c' = b' + b' := natCast_injective_below hac hbb (by + simpa only [Nat.cast_add] using habc) + exact congrArg (fun n : ℕ => (n : ZMod M)) (natSet_threeAPFree (M / 2) ha' hb' hc' hnat) + +theorem modularSet_hashAP (M : ℕ) : + ∀ x ∈ modularSet M, ∀ y ∈ modularSet M, ∀ z ∈ modularSet M, + x + y = 2 * z → x = z ∧ y = z := by + intro x hx y hy z hz h + have h' : x + y = z + z := by simpa only [two_mul] using h + exact ⟨modularSet_threeAPFree M hx hz hy h', + ((modularSet_threeAPFree M).eq_right hx hz hy h').symm⟩ + +theorem modularSet_card_lower (M : ℕ) : + ((M / 2 : ℕ) : ℝ) * Real.exp (-4 * Real.sqrt (Real.log ((M / 2 : ℕ) : ℝ))) ≤ + ((modularSet M).card : ℝ) := by + rw [modularSet_card] + exact Behrend.roth_lower_bound + +theorem modularSet_card_le_half (M : ℕ) : (modularSet M).card ≤ M / 2 := by + rw [modularSet_card] + exact rothNumberNat_le _ + +theorem modularSet_card_pos {M : ℕ} (hM : 2 ≤ M) : 0 < (modularSet M).card := by + have hhalf : 0 < M / 2 := Nat.div_pos hM (by decide) + have hpos : (0 : ℝ) < ((M / 2 : ℕ) : ℝ) * + Real.exp (-4 * Real.sqrt (Real.log ((M / 2 : ℕ) : ℝ))) := by + exact mul_pos (by exact_mod_cast hhalf) (Real.exp_pos _) + exact_mod_cast hpos.trans_le (modularSet_card_lower M) + +theorem modularSet_nonempty {M : ℕ} (hM : 2 ≤ M) : (modularSet M).Nonempty := + Finset.card_pos.mp (modularSet_card_pos hM) + +theorem modularSet_log_card_lower {M : ℕ} (hM : 2 ≤ M) : + Real.log ((M / 2 : ℕ) : ℝ) - 4 * Real.sqrt (Real.log ((M / 2 : ℕ) : ℝ)) ≤ + Real.log ((modularSet M).card : ℝ) := by + have hhalf : (0 : ℝ) < ((M / 2 : ℕ) : ℝ) := by + exact_mod_cast (Nat.div_pos hM (by decide) : 0 < M / 2) + have h := Real.log_le_log (mul_pos hhalf (Real.exp_pos _)) (modularSet_card_lower M) + rw [Real.log_mul hhalf.ne' (Real.exp_pos _).ne', Real.log_exp] at h + linarith + +theorem modularSet_log_card_le_half {M : ℕ} (hM : 2 ≤ M) : + Real.log ((modularSet M).card : ℝ) ≤ Real.log ((M / 2 : ℕ) : ℝ) := by + apply Real.log_le_log + · exact_mod_cast modularSet_card_pos hM + · exact_mod_cast modularSet_card_le_half M + +theorem modularSet_log_card_lower_modulus {M : ℕ} (hM : 2 ≤ M) : + Real.log (M : ℝ) - Real.log 3 - 4 * Real.sqrt (Real.log (M : ℝ)) ≤ + Real.log ((modularSet M).card : ℝ) := by + have hMr : (0 : ℝ) < M := by exact_mod_cast (by omega : 0 < M) + have hhalf : (0 : ℝ) < ((M / 2 : ℕ) : ℝ) := by + exact_mod_cast (Nat.div_pos hM (by decide) : 0 < M / 2) + have hround : (M : ℝ) / 3 ≤ ((M / 2 : ℕ) : ℝ) := by + have hn : M ≤ 3 * (M / 2) := by omega + have hr : (M : ℝ) ≤ 3 * ((M / 2 : ℕ) : ℝ) := by exact_mod_cast hn + linarith + have hlog := Real.log_le_log (div_pos hMr (by norm_num)) hround + rw [Real.log_div hMr.ne' (by norm_num)] at hlog + have hlogUpper : Real.log ((M / 2 : ℕ) : ℝ) ≤ Real.log (M : ℝ) := by + apply Real.log_le_log hhalf + exact_mod_cast Nat.div_le_self M 2 + have hsqrt := Real.sqrt_le_sqrt hlogUpper + have hcard := modularSet_log_card_lower hM + linarith + +theorem modularSet_log_card_le_modulus {M : ℕ} (hM : 2 ≤ M) : + Real.log ((modularSet M).card : ℝ) ≤ Real.log (M : ℝ) := by + apply Real.log_le_log + · exact_mod_cast modularSet_card_pos hM + · exact_mod_cast (modularSet_card_le_half M).trans (Nat.div_le_self M 2) + +end MatrixMultiplication.JointAPFree + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/JointExtraction/AmbientDegree.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/JointExtraction/AmbientDegree.lean new file mode 100644 index 0000000000000000000000000000000000000000..49a96ef056db8668e7ec38121fcd9381c84ae5c7 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/JointExtraction/AmbientDegree.lean @@ -0,0 +1,224 @@ +import OAI.LinearAlgebra.MatrixMultiplication.JointExtraction.Population +import OAI.LinearAlgebra.MatrixMultiplication.JointExtraction.TypeCounts + +namespace OAI + +/-! Joint tensor extraction, compatibility and entropy estimates. -/ + +noncomputable section + +namespace MatrixMultiplication.JointAmbientDegree + +open MatrixMultiplication.Foundation JointPopulation +open scoped BigOperators + +attribute [local instance] Classical.propDecidable + +variable {H : Type*} [Fintype H] [DecidableEq H] + (counts : H → Shape → ℕ) + +def localWord (t : JointCoarseHashing.Triple (Position counts)) (h : H) : + Positions counts h → Shape := + fun i => (t.1 ⟨h, i⟩, t.2.1 ⟨h, i⟩, t.2.2 ⟨h, i⟩) + +omit [Fintype H] [DecidableEq H] in +theorem localWord_injective : Function.Injective (localWord counts) := by + intro t u he + apply Prod.ext + · funext p + exact congrArg (fun w => (w p.1 p.2).1) he + · apply Prod.ext + · funext p + exact congrArg (fun w => (w p.1 p.2).2.1) he + · funext p + exact congrArg (fun w => (w p.1 p.2).2.2) he + +def localAllowed (sum : H → ℕ) (h : H) (w : Positions counts h → Shape) : Prop := + (∀ i, (w i).1.val + (w i).2.1.val + (w i).2.2.val = sum h) ∧ + ∀ s a, wordPopulation (shapeSide s ∘ w) a = + wordPopulation (sideWord counts s (triple counts (canonicalTarget counts)) h) a + +theorem localAllowed_of_mem_ambient (sum : H → ℕ) + (t : JointCoarseHashing.Triple (Position counts)) + (ht : t ∈ ambientSet counts sum) (h : H) : + localAllowed counts sum h (localWord counts t h) := by + obtain ⟨hs, hm⟩ := (Finset.mem_filter.mp ht).2 + exact ⟨fun i => hs ⟨h, i⟩, fun s a => hm h s a⟩ + +def sameSide (s : Fin 3) (t e : JointCoarseHashing.Triple (Position counts)) : Prop := + ∀ h, sideWord counts s t h = sideWord counts s e h + +def sharedAmbient (sum : H → ℕ) (s : Fin 3) + (e : JointCoarseHashing.Triple (Position counts)) : + Finset (JointCoarseHashing.Triple (Position counts)) := + (ambientSet counts sum).filter (sameSide counts s · e) + +def classBound (s : Fin 3) (e : JointCoarseHashing.Triple (Position counts)) + (h : H) (entropyCap : ℝ) : ℝ := + ((Fintype.card (Positions counts h) : ℝ) + 1) ^ Fintype.card Shape * + Real.exp ((Fintype.card (Positions counts h) : ℝ) * + (entropyCap - finiteEntropy (fun a => + (wordPopulation (sideWord counts s e h) a : ℝ) / + Fintype.card (Positions counts h))) + + ((Fintype.card Shape : ℝ) + (Fintype.card (Fin 17) : ℝ) + 2) * + (1 + Real.log (Fintype.card (Positions counts h) + 1 : ℕ))) + +def classExponent (s : Fin 3) (e : JointCoarseHashing.Triple (Position counts)) + (h : H) (entropyCap : ℝ) : ℝ := + (Fintype.card (Positions counts h) : ℝ) * + (entropyCap - finiteEntropy (fun a => + (wordPopulation (sideWord counts s e h) a : ℝ) / + Fintype.card (Positions counts h))) + + ((Fintype.card Shape : ℝ) + (Fintype.card (Fin 17) : ℝ) + 2) * + (1 + Real.log (Fintype.card (Positions counts h) + 1 : ℕ)) + + (Fintype.card Shape : ℝ) * Real.log (Fintype.card (Positions counts h) + 1 : ℕ) + +omit [Fintype H] [DecidableEq H] in +theorem classBound_eq_exp (s : Fin 3) + (e : JointCoarseHashing.Triple (Position counts)) (h : H) (entropyCap : ℝ) : + classBound counts s e h entropyCap = Real.exp (classExponent counts s e h entropyCap) := by + unfold classBound classExponent + conv_rhs => rw [Real.exp_add, Real.exp_nat_mul, Real.exp_log (by positivity)] + simp only [Nat.cast_add, Nat.cast_one] + exact mul_comm _ _ + +omit [Fintype H] [DecidableEq H] in +theorem classExponent_target_eq (s : Fin 3) (e : Target counts) (h : H) + (entropyCap : ℝ) : + classExponent counts s (triple counts e) h entropyCap = + classExponent counts s (triple counts (canonicalTarget counts)) h entropyCap := by + simp_rw [classExponent, marginal_population_eq counts e (canonicalTarget counts)] + +theorem sharedAmbient_card_le (sum : H → ℕ) (s : Fin 3) + (e : JointCoarseHashing.Triple (Position counts)) (entropyCap : H → ℝ) + (hentropy : ∀ h w, localAllowed counts sum h w → + finiteEntropy (fun a => (wordPopulation w a : ℝ) / + Fintype.card (Positions counts h)) ≤ entropyCap h) : + ((sharedAmbient counts sum s e).card : ℝ) ≤ + ∏ h, classBound counts s e h (entropyCap h) := by + classical + let Allowed := fun h (w : Positions counts h → Shape) => + localAllowed counts sum h w ∧ ∀ i, shapeSide s (w i) = sideWord counts s e h i + let Local := fun h => {w : Positions counts h → Shape // Allowed h w} + let encode : {t // t ∈ sharedAmbient counts sum s e} → ∀ h, Local h := fun t h => + ⟨localWord counts t.val h, localAllowed_of_mem_ambient counts sum t.val + (Finset.mem_filter.mp t.property).1 h, + fun i => congrFun ((Finset.mem_filter.mp t.property).2 h) i⟩ + have hinj : Function.Injective encode := by + intro t u he + apply Subtype.ext + apply localWord_injective counts + funext h + exact congrArg Subtype.val (congrFun he h) + have hcard : (sharedAmbient counts sum s e).card ≤ ∏ h, Fintype.card (Local h) := by + simpa only [Fintype.card_coe, Fintype.card_pi] using + Fintype.card_le_of_injective encode hinj + have hlocal (h : H) : (Fintype.card (Local h) : ℝ) ≤ + classBound counts s e h (entropyCap h) := by + exact JointTypeCounts.card_allowed_over_coarse_le (shapeSide s) + (sideWord counts s e h) (Allowed h) (entropyCap h) + (fun w hw => hw.2) (fun w hw => hentropy h w hw.1) + calc + ((sharedAmbient counts sum s e).card : ℝ) ≤ + ∏ h, (Fintype.card (Local h) : ℝ) := by exact_mod_cast hcard + _ ≤ _ := Finset.prod_le_prod₀ (fun _ _ => Nat.cast_nonneg _) (fun h _ => hlocal h) + +omit [Fintype H] [DecidableEq H] in +theorem sharesSide_iff (t e : JointCoarseHashing.Triple (Position counts)) : + JointCoarseHashing.SharesSide t e ↔ ∃ s : Fin 3, sameSide counts s t e := by + constructor + · rintro (hx | hy | hz) + · refine ⟨0, fun h => ?_⟩ + funext i + change t.1 ⟨h, i⟩ = e.1 ⟨h, i⟩ + exact congrFun hx.symm ⟨h, i⟩ + · refine ⟨1, fun h => ?_⟩ + funext i + change t.2.1 ⟨h, i⟩ = e.2.1 ⟨h, i⟩ + exact congrFun hy.symm ⟨h, i⟩ + · refine ⟨2, fun h => ?_⟩ + funext i + change t.2.2 ⟨h, i⟩ = e.2.2 ⟨h, i⟩ + exact congrFun hz.symm ⟨h, i⟩ + · rintro ⟨s, hs⟩ + fin_cases s + · apply Or.inl + funext p + simpa [sideWord, shapeSide] using (congrFun (hs p.1) p.2).symm + · apply Or.inr ∘ Or.inl + funext p + simpa [sideWord, shapeSide] using (congrFun (hs p.1) p.2).symm + · apply Or.inr ∘ Or.inr + funext p + simpa [sideWord, shapeSide] using (congrFun (hs p.1) p.2).symm + +def neighbors (sum : H → ℕ) (e : JointCoarseHashing.Triple (Position counts)) : + Finset (JointCoarseHashing.Triple (Position counts)) := + (ambientSet counts sum).filter (fun t => t ≠ e ∧ JointCoarseHashing.SharesSide t e) + +theorem neighbors_card_le_sum (sum : H → ℕ) + (e : JointCoarseHashing.Triple (Position counts)) : + (neighbors counts sum e).card ≤ ∑ s : Fin 3, (sharedAmbient counts sum s e).card := by + classical + have hsub : neighbors counts sum e ⊆ + (Finset.univ : Finset (Fin 3)).biUnion (fun s => sharedAmbient counts sum s e) := by + intro t ht + obtain ⟨ha, _, hs⟩ := Finset.mem_filter.mp ht + obtain ⟨s, hs⟩ := (sharesSide_iff counts t e).mp hs + exact Finset.mem_biUnion.mpr + ⟨s, Finset.mem_univ _, Finset.mem_filter.mpr ⟨ha, hs⟩⟩ + exact (Finset.card_le_card hsub).trans Finset.card_biUnion_le + +theorem neighbors_card_le (sum : H → ℕ) + (e : JointCoarseHashing.Triple (Position counts)) (entropyCap : H → ℝ) + (hentropy : ∀ h w, localAllowed counts sum h w → + finiteEntropy (fun a => (wordPopulation w a : ℝ) / + Fintype.card (Positions counts h)) ≤ entropyCap h) : + ((neighbors counts sum e).card : ℝ) ≤ + ∑ s : Fin 3, ∏ h, classBound counts s e h (entropyCap h) := by + calc + ((neighbors counts sum e).card : ℝ) ≤ + ∑ s : Fin 3, ((sharedAmbient counts sum s e).card : ℝ) := by + exact_mod_cast neighbors_card_le_sum counts sum e + _ ≤ _ := Finset.sum_le_sum fun s _ => sharedAmbient_card_le counts sum s e entropyCap hentropy + +theorem neighbors_card_le_three_exp (sum : H → ℕ) + (e : JointCoarseHashing.Triple (Position counts)) (entropyCap : H → ℝ) + (hentropy : ∀ h w, localAllowed counts sum h w → + finiteEntropy (fun a => (wordPopulation w a : ℝ) / + Fintype.card (Positions counts h)) ≤ entropyCap h) + (exponent : ℝ) + (hupper : ∀ s : Fin 3, ∑ h, classExponent counts s e h (entropyCap h) ≤ exponent) : + ((neighbors counts sum e).card : ℝ) ≤ 3 * Real.exp exponent := by + have hprod (s : Fin 3) : (∏ h, classBound counts s e h (entropyCap h)) ≤ + Real.exp exponent := by + simp_rw [classBound_eq_exp] + rw [← Real.exp_sum] + exact Real.exp_le_exp.mpr (hupper s) + calc + ((neighbors counts sum e).card : ℝ) ≤ + ∑ s : Fin 3, ∏ h, classBound counts s e h (entropyCap h) := + neighbors_card_le counts sum e entropyCap hentropy + _ ≤ ∑ _s : Fin 3, Real.exp exponent := Finset.sum_le_sum fun s _ => hprod s + _ = _ := by simp + +theorem log_neighbors_card_le (sum : H → ℕ) + (e : JointCoarseHashing.Triple (Position counts)) (entropyCap : H → ℝ) + (hentropy : ∀ h w, localAllowed counts sum h w → + finiteEntropy (fun a => (wordPopulation w a : ℝ) / + Fintype.card (Positions counts h)) ≤ entropyCap h) + (exponent : ℝ) + (hupper : ∀ s : Fin 3, ∑ h, classExponent counts s e h (entropyCap h) ≤ exponent) + (hne : 0 < (neighbors counts sum e).card) : + Real.log ((neighbors counts sum e).card : ℝ) ≤ Real.log 3 + exponent := by + have hb := Real.log_le_log (by exact_mod_cast hne : + (0 : ℝ) < (neighbors counts sum e).card) + (neighbors_card_le_three_exp counts sum e entropyCap hentropy exponent hupper) + simpa only [Real.log_mul (by norm_num : (3 : ℝ) ≠ 0) (Real.exp_ne_zero _), + Real.log_exp] using hb + +end MatrixMultiplication.JointAmbientDegree + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/JointExtraction/AmbientEntropy.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/JointExtraction/AmbientEntropy.lean new file mode 100644 index 0000000000000000000000000000000000000000..6d7367e901e2992cab5425f365e981474cdc13f0 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/JointExtraction/AmbientEntropy.lean @@ -0,0 +1,303 @@ +import OAI.LinearAlgebra.MatrixMultiplication.JointExtraction.AmbientDegree +import OAI.LinearAlgebra.MatrixMultiplication.JointExtraction.GibbsApproximation +import OAI.LinearAlgebra.MatrixMultiplication.Recovery.InheritedStatisticWindows + +namespace OAI + +/-! Joint tensor extraction, compatibility and entropy estimates. -/ + +noncomputable section + +open scoped BigOperators Topology +open Filter MatrixMultiplication.Foundation +open MatrixMultiplication.JointPopulation MatrixMultiplication.JointAmbientDegree +open MatrixMultiplication.JointGibbsApproximation + +namespace MatrixMultiplication.JointAmbientEntropy + +section Empirical + +variable {I A B : Type*} [Fintype I] [DecidableEq I] + [Fintype A] [DecidableEq A] [Fintype B] [DecidableEq B] + +def empiricalFiniteLaw (w : I → A) (hpos : 0 < Fintype.card I) : FiniteLaw A where + mass a := (wordPopulation w a : ℝ) / Fintype.card I + nonneg a := div_nonneg (Nat.cast_nonneg _) (Nat.cast_nonneg _) + total := by + rw [← Finset.sum_div, ← Nat.cast_sum, wordPopulation_sum] + exact div_self (Nat.cast_ne_zero.mpr (Nat.ne_of_gt hpos)) + +omit [DecidableEq I] in +@[simp] theorem empiricalFiniteLaw_mass (w : I → A) (hpos : 0 < Fintype.card I) (a : A) : + (empiricalFiniteLaw w hpos).mass a = + (wordPopulation w a : ℝ) / Fintype.card I := rfl + +omit [DecidableEq I] in +theorem empiricalFiniteLaw_map_mass (w : I → A) (hpos : 0 < Fintype.card I) + (f : A → B) (b : B) : + ((empiricalFiniteLaw w hpos).map f).mass b = + (wordPopulation (f ∘ w) b : ℝ) / Fintype.card I := by + rw [FiniteLaw.map_mass, InheritedMasks.wordPopulation_statistic, + Nat.cast_sum, Finset.sum_div, Finset.sum_filter] + simp only [empiricalFiniteLaw_mass] + +omit [DecidableEq I] in +theorem empiricalFiniteLaw_supported (w : I → A) (hpos : 0 < Fintype.card I) + (p : FiniteLaw A) (hsupport : ∀ i, 0 < p.mass (w i)) : + ∀ a, p.mass a = 0 → (empiricalFiniteLaw w hpos).mass a = 0 := by + intro a ha + have : IsEmpty {i : I // w i = a} := ⟨fun i => by + have hp := hsupport i.val + rw [i.property, ha] at hp + exact lt_irrefl 0 hp⟩ + simp only [empiricalFiniteLaw_mass, wordPopulation, Fintype.card_of_isEmpty, + Nat.cast_zero, zero_div] + +end Empirical + +variable {H : Type*} [Fintype H] [DecidableEq H] + +def canonicalLaw (counts : H → Shape → ℕ) (h : H) : FiniteLaw Shape := + if hpos : 0 < Fintype.card (Positions counts h) then + empiricalFiniteLaw ((canonicalTarget counts) h).val hpos + else FiniteLaw.pure (0, 0, 0) + +omit [Fintype H] [DecidableEq H] in +theorem canonicalLaw_mass_of_pos (counts : H → Shape → ℕ) (h : H) + (hpos : 0 < Fintype.card (Positions counts h)) (a : Shape) : + (canonicalLaw counts h).mass a = + (counts h a : ℝ) / Fintype.card (Positions counts h) := by + rw [canonicalLaw, dite_eq_left hpos, empiricalFiniteLaw_mass, + ((canonicalTarget counts) h).property] + +omit [Fintype H] [DecidableEq H] in +theorem total_mul_canonicalLaw_mass (counts : H → Shape → ℕ) (h : H) (a : Shape) : + (Fintype.card (Positions counts h) : ℝ) * (canonicalLaw counts h).mass a = + counts h a := by + by_cases hpos : 0 < Fintype.card (Positions counts h) + · rw [canonicalLaw_mass_of_pos counts h hpos] + exact mul_div_cancel₀ _ (Nat.cast_ne_zero.mpr (Nat.ne_of_gt hpos)) + · have hzero : Fintype.card (Positions counts h) = 0 := Nat.eq_zero_of_not_pos hpos + have hsum : ∑ a, counts h a = 0 := by simpa only [Positions, Fintype.card_fin] using hzero + have ha : counts h a = 0 := by + have hle : counts h a ≤ ∑ b, counts h b := + Finset.single_le_sum (fun _ _ => Nat.zero_le _) (Finset.mem_univ a) + rw [hsum] at hle + exact Nat.eq_zero_of_le_zero hle + simp only [hzero, ha, Nat.cast_zero, zero_mul] + +omit [Fintype H] [DecidableEq H] in +theorem localAllowed_marginal_eq (counts : H → Shape → ℕ) (sum : H → ℕ) + (h : H) (w : Positions counts h → Shape) + (hpos : 0 < Fintype.card (Positions counts h)) + (hw : localAllowed counts sum h w) (s : Fin 3) : + ((empiricalFiniteLaw w hpos).map (shapeSide s)).mass = + ((canonicalLaw counts h).map (shapeSide s)).mass := by + rw [canonicalLaw, dite_eq_left hpos] + funext a + rw [empiricalFiniteLaw_map_mass, empiricalFiniteLaw_map_mass] + exact congrArg (fun n : ℕ => (n : ℝ) / Fintype.card (Positions counts h)) (hw.2 s a) + +def gibbsCap (counts : H → Shape → ℕ) (h : H) (p : FiniteLaw Shape) + (u v w : Fin 17 → ℝ) : ℝ := + finiteEntropy p.mass + marginalError p (canonicalLaw counts h) (shapeSide 0) u + + marginalError p (canonicalLaw counts h) (shapeSide 1) v + + marginalError p (canonicalLaw counts h) (shapeSide 2) w + +omit [Fintype H] [DecidableEq H] in +theorem gibbsCap_nonneg (counts : H → Shape → ℕ) (h : H) (p : FiniteLaw Shape) + (u v w : Fin 17 → ℝ) : 0 ≤ gibbsCap counts h p u v w := by + exact add_nonneg + (add_nonneg (add_nonneg p.entropy_nonneg (marginalError_nonneg _ _ _ _)) + (marginalError_nonneg _ _ _ _)) (marginalError_nonneg _ _ _ _) + +omit [Fintype H] [DecidableEq H] in +theorem localAllowed_entropy_le_of_word_support (counts : H → Shape → ℕ) (sum : H → ℕ) + (h : H) (w : Positions counts h → Shape) (p : FiniteLaw Shape) + (u v z : Fin 17 → ℝ) (c : ℝ) + (hsupport : ∀ i, 0 < p.mass (w i)) + (hlog : ∀ a, 0 < p.mass a → Real.log (p.mass a) = + u (shapeSide 0 a) + v (shapeSide 1 a) + z (shapeSide 2 a) - c) + (hw : localAllowed counts sum h w) : + finiteEntropy (fun a => (wordPopulation w a : ℝ) / + Fintype.card (Positions counts h)) ≤ gibbsCap counts h p u v z := by + by_cases hpos : 0 < Fintype.card (Positions counts h) + · have hs := empiricalFiniteLaw_supported w hpos p hsupport + have hg := entropy_le_of_marginal_errors_of_support p (empiricalFiniteLaw w hpos) + (shapeSide 0) (shapeSide 1) (shapeSide 2) u v z c hs hlog + have hx := localAllowed_marginal_eq counts sum h w hpos hw (0 : Fin 3) + have hy := localAllowed_marginal_eq counts sum h w hpos hw (1 : Fin 3) + have hz := localAllowed_marginal_eq counts sum h w hpos hw (2 : Fin 3) + have hmass : (empiricalFiniteLaw w hpos).mass = + (fun a => (wordPopulation w a : ℝ) / Fintype.card (Positions counts h)) := by + funext a + exact empiricalFiniteLaw_mass w hpos a + simpa only [gibbsCap, marginalError, empiricalFiniteLaw_mass, hmass, hx, hy, hz] using hg + · have hzero : Fintype.card (Positions counts h) = 0 := Nat.eq_zero_of_not_pos hpos + simpa only [hzero, Nat.cast_zero, div_zero, finiteEntropy, entropyTerm_zero, + Finset.sum_const_zero] using gibbsCap_nonneg counts h p u v z + +omit [Fintype H] [DecidableEq H] in +theorem localAllowed_entropy_le (counts : H → Shape → ℕ) (sum : H → ℕ) + (h : H) (w : Positions counts h → Shape) (p : FiniteLaw Shape) + (u v z : Fin 17 → ℝ) (c : ℝ) + (hsupport : ∀ a : Shape, a.1.val + a.2.1.val + a.2.2.val = sum h → 0 < p.mass a) + (hlog : ∀ a, 0 < p.mass a → Real.log (p.mass a) = + u (shapeSide 0 a) + v (shapeSide 1 a) + z (shapeSide 2 a) - c) + (hw : localAllowed counts sum h w) : + finiteEntropy (fun a => (wordPopulation w a : ℝ) / + Fintype.card (Positions counts h)) ≤ gibbsCap counts h p u v z := + localAllowed_entropy_le_of_word_support counts sum h w p u v z c + (fun i => hsupport (w i) (hw.1 i)) hlog hw + +theorem sharedAmbient_card_le_of_supported_gibbs (counts : H → Shape → ℕ) (sum : H → ℕ) + (s : Fin 3) (e : JointCoarseHashing.Triple (Position counts)) + (p : H → FiniteLaw Shape) (u v w : H → Fin 17 → ℝ) (c : H → ℝ) + (hsupport : ∀ h word, localAllowed counts sum h word → ∀ i, 0 < (p h).mass (word i)) + (hlog : ∀ h a, 0 < (p h).mass a → Real.log ((p h).mass a) = + u h (shapeSide 0 a) + v h (shapeSide 1 a) + w h (shapeSide 2 a) - c h) : + ((sharedAmbient counts sum s e).card : ℝ) ≤ + ∏ h, classBound counts s e h (gibbsCap counts h (p h) (u h) (v h) (w h)) := + sharedAmbient_card_le counts sum s e _ + (fun h word hw => localAllowed_entropy_le_of_word_support counts sum h word (p h) + (u h) (v h) (w h) (c h) (hsupport h word hw) (hlog h) hw) + +theorem neighbors_card_le_of_supported_gibbs (counts : H → Shape → ℕ) (sum : H → ℕ) + (e : JointCoarseHashing.Triple (Position counts)) + (p : H → FiniteLaw Shape) (u v w : H → Fin 17 → ℝ) (c : H → ℝ) + (hsupport : ∀ h word, localAllowed counts sum h word → ∀ i, 0 < (p h).mass (word i)) + (hlog : ∀ h a, 0 < (p h).mass a → Real.log ((p h).mass a) = + u h (shapeSide 0 a) + v h (shapeSide 1 a) + w h (shapeSide 2 a) - c h) : + ((neighbors counts sum e).card : ℝ) ≤ + ∑ s : Fin 3, ∏ h, classBound counts s e h + (gibbsCap counts h (p h) (u h) (v h) (w h)) := + neighbors_card_le counts sum e _ + (fun h word hw => localAllowed_entropy_le_of_word_support counts sum h word (p h) + (u h) (v h) (w h) (c h) (hsupport h word hw) (hlog h) hw) + +theorem sharedAmbient_card_le_of_gibbs (counts : H → Shape → ℕ) (sum : H → ℕ) + (s : Fin 3) (e : JointCoarseHashing.Triple (Position counts)) + (p : H → FiniteLaw Shape) (u v w : H → Fin 17 → ℝ) (c : H → ℝ) + (hsupport : ∀ h (a : Shape), a.1.val + a.2.1.val + a.2.2.val = sum h → 0 < (p h).mass a) + (hlog : ∀ h a, 0 < (p h).mass a → Real.log ((p h).mass a) = + u h (shapeSide 0 a) + v h (shapeSide 1 a) + w h (shapeSide 2 a) - c h) : + ((sharedAmbient counts sum s e).card : ℝ) ≤ + ∏ h, classBound counts s e h (gibbsCap counts h (p h) (u h) (v h) (w h)) := + sharedAmbient_card_le counts sum s e _ + (fun h word hw => localAllowed_entropy_le counts sum h word (p h) + (u h) (v h) (w h) (c h) (hsupport h) (hlog h) hw) + +theorem neighbors_card_le_of_gibbs (counts : H → Shape → ℕ) (sum : H → ℕ) + (e : JointCoarseHashing.Triple (Position counts)) + (p : H → FiniteLaw Shape) (u v w : H → Fin 17 → ℝ) (c : H → ℝ) + (hsupport : ∀ h (a : Shape), a.1.val + a.2.1.val + a.2.2.val = sum h → 0 < (p h).mass a) + (hlog : ∀ h a, 0 < (p h).mass a → Real.log ((p h).mass a) = + u h (shapeSide 0 a) + v h (shapeSide 1 a) + w h (shapeSide 2 a) - c h) : + ((neighbors counts sum e).card : ℝ) ≤ + ∑ s : Fin 3, ∏ h, classBound counts s e h + (gibbsCap counts h (p h) (u h) (v h) (w h)) := + neighbors_card_le counts sum e _ + (fun h word hw => localAllowed_entropy_le counts sum h word (p h) + (u h) (v h) (w h) (c h) (hsupport h) (hlog h) hw) + +def classScale (counts : H → Shape → ℕ) (h : H) (N : ℕ) : ℝ := + (Fintype.card (Positions counts h) : ℝ) / N + +omit [Fintype H] [DecidableEq H] in +theorem classScale_nonneg (counts : H → Shape → ℕ) (h : H) (N : ℕ) : + 0 ≤ classScale counts h N := div_nonneg (Nat.cast_nonneg _) (Nat.cast_nonneg _) + +omit [Fintype H] [DecidableEq H] in +theorem classScale_mul_canonicalLaw_mass (counts : H → Shape → ℕ) (h : H) + (N : ℕ) (a : Shape) : + classScale counts h N * (canonicalLaw counts h).mass a = (counts h a : ℝ) / N := by + unfold classScale + calc + _ = ((Fintype.card (Positions counts h) : ℝ) * (canonicalLaw counts h).mass a) / N := by ring + _ = _ := by rw [total_mul_canonicalLaw_mass] + +omit [Fintype H] [DecidableEq H] in +theorem classScale_mul_canonicalLaw_map_mass {B : Type*} [Fintype B] [DecidableEq B] + (counts : H → Shape → ℕ) (h : H) (N : ℕ) (f : Shape → B) (b : B) : + classScale counts h N * ((canonicalLaw counts h).map f).mass b = + ∑ a, if f a = b then (counts h a : ℝ) / N else 0 := by + rw [FiniteLaw.map_mass, Finset.mul_sum] + apply Finset.sum_congr rfl + intro a _ + by_cases ha : f a = b + · simp only [ha, ite_true] + exact classScale_mul_canonicalLaw_mass counts h N a + · simp only [ha, ite_false, mul_zero] + +omit [Fintype H] [DecidableEq H] in +theorem classScale_mul_marginalError {B : Type*} [Fintype B] [DecidableEq B] + (counts : H → Shape → ℕ) (h : H) (N : ℕ) (p : FiniteLaw Shape) + (f : Shape → B) (v : B → ℝ) : + classScale counts h N * marginalError p (canonicalLaw counts h) f v = + ∑ b, |(∑ a, if f a = b then (counts h a : ℝ) / N else 0) - + classScale counts h N * (p.map f).mass b| * |v b| := by + unfold marginalError + rw [Finset.mul_sum] + apply Finset.sum_congr rfl + intro b _ + have habs : classScale counts h N * + |((canonicalLaw counts h).map f).mass b - (p.map f).mass b| = + |classScale counts h N * ((canonicalLaw counts h).map f).mass b - + classScale counts h N * (p.map f).mass b| := by + rw [← mul_sub, abs_mul, abs_of_nonneg (classScale_nonneg counts h N)] + rw [← mul_assoc, habs, classScale_mul_canonicalLaw_map_mass] + +omit [Fintype H] [DecidableEq H] in +theorem tendsto_classScale (counts : ℕ → H → Shape → ℕ) (h : H) + (p : FiniteLaw Shape) (mass : ℝ) + (hcounts : ∀ a, Tendsto (fun N => (counts N h a : ℝ) / N) atTop (𝓝 (mass * p.mass a))) : + Tendsto (fun N => classScale (counts N) h N) atTop (𝓝 mass) := by + have hsum := tendsto_finsetSum Finset.univ (fun a _ => hcounts a) + simpa only [classScale, Positions, Fintype.card_fin, Nat.cast_sum, + Finset.sum_div, ← Finset.mul_sum, p.total, mul_one] using hsum + +omit [Fintype H] [DecidableEq H] in +theorem tendsto_classScale_mul_marginalError {B : Type*} [Fintype B] [DecidableEq B] + (counts : ℕ → H → Shape → ℕ) (h : H) (p : FiniteLaw Shape) + (mass : ℝ) (f : Shape → B) (v : B → ℝ) + (hcounts : ∀ a, Tendsto (fun N => (counts N h a : ℝ) / N) atTop (𝓝 (mass * p.mass a))) : + Tendsto (fun N => classScale (counts N) h N * + marginalError p (canonicalLaw (counts N) h) f v) atTop (𝓝 0) := by + have htotal := tendsto_classScale counts h p mass hcounts + have hside (b : B) : + Tendsto (fun N => ∑ a, if f a = b then (counts N h a : ℝ) / N else 0) + atTop (𝓝 (mass * (p.map f).mass b)) := by + have hterm (a : Shape) : + Tendsto (fun N => if f a = b then (counts N h a : ℝ) / N else 0) + atTop (𝓝 (if f a = b then mass * p.mass a else 0)) := by + by_cases ha : f a = b + · simpa only [ha, ite_true] using hcounts a + · simp only [ha, ite_false] + exact tendsto_const_nhds + simpa only [FiniteLaw.map_mass, Finset.mul_sum, mul_ite, mul_zero] using + tendsto_finsetSum Finset.univ (fun a _ => hterm a) + have hterm (b : B) : + Tendsto (fun N => |(∑ a, if f a = b then (counts N h a : ℝ) / N else 0) - + classScale (counts N) h N * (p.map f).mass b| * |v b|) atTop (𝓝 0) := by + simpa only [sub_self, abs_zero, zero_mul] using + ((hside b).sub (htotal.mul_const ((p.map f).mass b))).abs.mul_const |v b| + simpa only [classScale_mul_marginalError, Finset.sum_const_zero] using + tendsto_finsetSum Finset.univ (fun b _ => hterm b) + +omit [Fintype H] [DecidableEq H] in +theorem tendsto_classScale_mul_gibbsCap (counts : ℕ → H → Shape → ℕ) (h : H) + (p : FiniteLaw Shape) (mass : ℝ) (u v w : Fin 17 → ℝ) + (hcounts : ∀ a, Tendsto (fun N => (counts N h a : ℝ) / N) atTop (𝓝 (mass * p.mass a))) : + Tendsto (fun N => classScale (counts N) h N * + gibbsCap (counts N) h p u v w) atTop (𝓝 (mass * finiteEntropy p.mass)) := by + have hm := (tendsto_classScale counts h p mass hcounts).mul_const (finiteEntropy p.mass) + have hx := tendsto_classScale_mul_marginalError counts h p mass (shapeSide 0) u hcounts + have hy := tendsto_classScale_mul_marginalError counts h p mass (shapeSide 1) v hcounts + have hz := tendsto_classScale_mul_marginalError counts h p mass (shapeSide 2) w hcounts + simpa only [gibbsCap, mul_add, add_zero] using ((hm.add hx).add hy).add hz + +end MatrixMultiplication.JointAmbientEntropy + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/JointExtraction/AmbientRateLimit.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/JointExtraction/AmbientRateLimit.lean new file mode 100644 index 0000000000000000000000000000000000000000..fcea4ba494931b92fb2b195803f7375bf6221bcc --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/JointExtraction/AmbientRateLimit.lean @@ -0,0 +1,145 @@ +import OAI.LinearAlgebra.MatrixMultiplication.JointExtraction.AmbientDegree +import OAI.LinearAlgebra.MatrixMultiplication.JointExtraction.ExtractionRates + +namespace OAI + +/-! Joint tensor extraction, compatibility and entropy estimates. -/ + +noncomputable section + +namespace MatrixMultiplication.JointAmbientRateLimit + +open MatrixMultiplication.Foundation JointPopulation JointAmbientDegree Filter +open scoped BigOperators Topology + +attribute [local instance] Classical.propDecidable + +theorem tendsto_log_succ_div_nat_of_ratio {n : ℕ → ℕ} {mass : ℝ} + (hsize : Tendsto (fun N => (n N : ℝ) / (N : ℝ)) atTop (𝓝 mass)) : + Tendsto (fun N => Real.log (n N + 1 : ℕ) / (N : ℝ)) atTop (𝓝 0) := by + let C : ℝ := |mass| + 2 + have hC : 0 < C := by dsimp [C]; positivity + have hmC : mass < C := by dsimp [C]; linarith [le_abs_self mass] + have hlog : Tendsto (fun N : ℕ => Real.log (N : ℝ) / (N : ℝ)) atTop (𝓝 0) := by + simpa only [Function.comp_def, id_eq] using + Real.isLittleO_log_id_atTop.tendsto_div_nhds_zero.comp tendsto_natCast_atTop_atTop + have hc : Tendsto (fun N : ℕ => Real.log (C + 1) / (N : ℝ)) atTop (𝓝 0) := + tendsto_const_nhds.div_atTop tendsto_natCast_atTop_atTop + have hu : Tendsto (fun N : ℕ => + (Real.log (C + 1) + Real.log (N : ℝ)) / (N : ℝ)) atTop (𝓝 0) := by + simpa only [add_div, add_zero] using hc.add hlog + apply tendsto_of_tendsto_of_tendsto_of_le_of_le' tendsto_const_nhds hu + · exact Eventually.of_forall fun N => + div_nonneg (Real.log_nonneg (by exact_mod_cast Nat.succ_le_succ (Nat.zero_le (n N)))) + (Nat.cast_nonneg _) + · filter_upwards [(tendsto_order.1 hsize).2 C hmC, + eventually_ge_atTop (1 : ℕ)] with N hn hN + have hNr : (1 : ℝ) ≤ N := by exact_mod_cast hN + have hNp : (0 : ℝ) < N := lt_of_lt_of_le zero_lt_one hNr + have hsizeN := (div_lt_iff₀ hNp).mp hn + have hbound : (n N + 1 : ℕ) ≤ (C + 1) * (N : ℝ) := by + push_cast + nlinarith + have hl := Real.log_le_log (by positivity : (0 : ℝ) < (n N + 1 : ℕ)) hbound + rw [Real.log_mul (by positivity : C + 1 ≠ 0) hNp.ne'] at hl + exact div_le_div_of_nonneg_right hl hNp.le + +variable {H : Type*} [Fintype H] [DecidableEq H] + +omit [Fintype H] [DecidableEq H] in +theorem tendsto_classExponent_div_nat + (counts : ℕ → H → Shape → ℕ) (s : Fin 3) (h : H) + (cap : ℕ → ℝ) (mass capRate marginalRate : ℝ) + (hsize : Tendsto (fun N => (∑ a, counts N h a : ℕ) / (N : ℝ)) + atTop (𝓝 mass)) + (hcap : Tendsto (fun N => ((∑ a, counts N h a : ℕ) / (N : ℝ)) * cap N) + atTop (𝓝 capRate)) + (hmarginal : Tendsto (fun N => + ((∑ a, counts N h a : ℕ) / (N : ℝ)) * + finiteEntropy (fun a => (wordPopulation + (sideWord (counts N) s (triple (counts N) (canonicalTarget (counts N))) h) a : ℝ) / + Fintype.card (Positions (counts N) h))) atTop (𝓝 marginalRate)) : + Tendsto (fun N => + classExponent (counts N) s (triple (counts N) (canonicalTarget (counts N))) h (cap N) / + (N : ℝ)) atTop (𝓝 (capRate - marginalRate)) := by + let A : ℝ := (Fintype.card Shape : ℝ) + (Fintype.card (Fin 17) : ℝ) + 2 + have hlog := tendsto_log_succ_div_nat_of_ratio hsize + have hinv : Tendsto (fun N : ℕ => (1 : ℝ) / N) atTop (𝓝 0) := + tendsto_const_nhds.div_atTop tendsto_natCast_atTop_atTop + have htotal := (hcap.sub hmarginal).add + (((hinv.add hlog).const_mul A).add (hlog.const_mul (Fintype.card Shape : ℝ))) + simp only [add_zero, mul_zero] at htotal + convert htotal using 1 + ext N + dsimp only [classExponent, A, Positions] + simp only [Fintype.card_fin, div_eq_mul_inv] + ring + +omit [DecidableEq H] in +theorem tendsto_sum_classExponent_div_nat + (counts : ℕ → H → Shape → ℕ) (s : Fin 3) + (cap : ℕ → H → ℝ) (mass capRate marginalRate : H → ℝ) + (hsize : ∀ h, Tendsto (fun N => (∑ a, counts N h a : ℕ) / (N : ℝ)) + atTop (𝓝 (mass h))) + (hcap : ∀ h, Tendsto (fun N => ((∑ a, counts N h a : ℕ) / (N : ℝ)) * cap N h) + atTop (𝓝 (capRate h))) + (hmarginal : ∀ h, Tendsto (fun N => + ((∑ a, counts N h a : ℕ) / (N : ℝ)) * + finiteEntropy (fun a => (wordPopulation + (sideWord (counts N) s (triple (counts N) (canonicalTarget (counts N))) h) a : ℝ) / + Fintype.card (Positions (counts N) h))) atTop (𝓝 (marginalRate h))) : + Tendsto (fun N => (∑ h, + classExponent (counts N) s (triple (counts N) (canonicalTarget (counts N))) h (cap N h)) / + (N : ℝ)) atTop (𝓝 (∑ h, (capRate h - marginalRate h))) := by + have hs := tendsto_finsetSum Finset.univ (fun h _ => + tendsto_classExponent_div_nat counts s h (fun N => cap N h) + (mass h) (capRate h) (marginalRate h) (hsize h) (hcap h) (hmarginal h)) + simpa only [Finset.sum_div] using hs + +theorem eventually_all_target_degree_upper + (counts : ℕ → H → Shape → ℕ) (sum : H → ℕ) + (cap : ℕ → H → ℝ) (sideRate : Fin 3 → ℝ) (D : ℝ) (hD : 0 ≤ D) + (hentropy : ∀ᶠ N in atTop, ∀ h w, localAllowed (counts N) sum h w → + finiteEntropy (fun a => (wordPopulation w a : ℝ) / + Fintype.card (Positions (counts N) h)) ≤ cap N h) + (hrate : ∀ s, Tendsto (fun N => (∑ h, + classExponent (counts N) s (triple (counts N) (canonicalTarget (counts N))) h (cap N h)) / + (N : ℝ)) atTop (𝓝 (sideRate s))) + (hside : ∀ s, sideRate s ≤ D) (η : ℝ) (hη : 0 < η) : + ∀ᶠ N in atTop, ∀ e : Target (counts N), + Real.log ((neighbors (counts N) sum (triple (counts N) e)).card : ℝ) / (N : ℝ) ≤ + D + η := by + have hs : ∀ᶠ N in atTop, ∀ s : Fin 3, + (∑ h, classExponent (counts N) s + (triple (counts N) (canonicalTarget (counts N))) h (cap N h)) / (N : ℝ) ≤ + D + η / 2 := by + rw [Filter.eventually_all] + intro s + filter_upwards [(tendsto_order.1 (hrate s)).2 (sideRate s + η / 2) (by linarith)] + with N hN + linarith [hside s] + have hc : Tendsto (fun N : ℕ => Real.log 3 / (N : ℝ)) atTop (𝓝 0) := + tendsto_const_nhds.div_atTop tendsto_natCast_atTop_atTop + filter_upwards [hentropy, hs, (tendsto_order.1 hc).2 (η / 2) (by linarith), + eventually_ge_atTop (1 : ℕ)] with N he hs hc hN + intro e + by_cases hz : (neighbors (counts N) sum (triple (counts N) e)).card = 0 + · simp only [hz, Nat.cast_zero, Real.log_zero, zero_div] + linarith + have hNp : (0 : ℝ) < N := by exact_mod_cast hN + have hupper (s : Fin 3) : + (∑ h, classExponent (counts N) s (triple (counts N) e) h (cap N h)) ≤ + (N : ℝ) * (D + η / 2) := by + simp_rw [classExponent_target_eq] + simpa only [mul_comm] using (div_le_iff₀ hNp).mp (hs s) + have hb := div_le_div_of_nonneg_right + (log_neighbors_card_le (counts N) sum (triple (counts N) e) (cap N) he + ((N : ℝ) * (D + η / 2)) hupper (Nat.pos_of_ne_zero hz)) hNp.le + rw [add_div, mul_div_cancel_left₀ _ hNp.ne'] at hb + linarith + +end MatrixMultiplication.JointAmbientRateLimit + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/JointExtraction/AssignmentLoss.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/JointExtraction/AssignmentLoss.lean new file mode 100644 index 0000000000000000000000000000000000000000..8bb11be564af3ec5e49830fde37a86768e78cf11 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/JointExtraction/AssignmentLoss.lean @@ -0,0 +1,147 @@ +import OAI.LinearAlgebra.MatrixMultiplication.JointExtraction.CoarseAssignment + +namespace OAI + +/-! Joint tensor extraction, compatibility and entropy estimates. -/ + +noncomputable section + +namespace MatrixMultiplication.JointAssignmentLoss + +open JointExtraction JointCoarseAssignment + +attribute [local instance] Classical.propDecidable + +variable {A B C I V Ω : Type*} + +theorem uniqueAssignment_of_unique (candidates : Finset I) + (compatible : I → V → Prop) (v : V) (i : I) + (hi : i ∈ candidates) (hc : compatible i v) + (hu : ∀ j, j ∈ candidates → compatible j v → j = i) : + uniqueAssignment candidates compatible v = some i := by + classical + have hex : ∃ j, j ∈ candidates ∧ compatible j v ∧ + ∀ k, k ∈ candidates → compatible k v → k = j := ⟨i, hi, hc, hu⟩ + unfold uniqueAssignment + rw [dite_eq_left hex] + exact congrArg some (hu _ (Classical.choose_spec hex).1 (Classical.choose_spec hex).2.1) + +theorem assignUseful_of_unique (candidates : Finset I) + (compatible useful : I → V → Prop) (v : V) (i : I) + (hi : i ∈ candidates) (hc : compatible i v) (huse : useful i v) + (hu : ∀ j, j ∈ candidates → compatible j v → j = i) : + assignUseful candidates compatible useful v = some i := by + have hassign := uniqueAssignment_of_unique candidates compatible v i hi hc hu + have hkeep : ∃ j, uniqueAssignment candidates compatible v = some j ∧ useful j v := + ⟨i, hassign, huse⟩ + simp only [assignUseful, retainAssignment, ite_eq_left hkeep] + exact hassign + +def ambientXCollision (ambient : Finset (Triple A B C)) + (hx : A → Prop) (hy : B → Prop) (hz : C → Prop) (e : Triple A B C) : Prop := + ∃ f ∈ ambient, f ≠ e ∧ survives hx hy hz f ∧ f.1 = e.1 + +def targetCompatibleCollision (targets : Finset (Triple A B C)) + (hx : A → Prop) (hy : B → Prop) (hz : C → Prop) + (compatible : Triple A B C → V → Prop) (e : Triple A B C) (v : V) : Prop := + ∃ f ∈ targets, f ≠ e ∧ survives hx hy hz f ∧ compatible f v + +theorem eligible_of_no_ambientXCollision + (ambient targets : Finset (Triple A B C)) + (hx : A → Prop) (hy : B → Prop) (hz : C → Prop) (e : Triple A B C) + (ha : e ∈ ambient) (ht : e ∈ targets) (hs : survives hx hy hz e) + (hno : ¬ ambientXCollision ambient hx hy hz e) : + e ∈ eligible ambient targets hx hy hz := by + apply (mem_eligible_iff ambient targets hx hy hz e).2 + refine ⟨ha, ht, hs, ?_⟩ + intro f hf hfs hfx + by_contra hne + exact hno ⟨f, hf, hne, hfs, hfx⟩ + +theorem not_eligible_iff_ambientXCollision + (ambient targets : Finset (Triple A B C)) + (hx : A → Prop) (hy : B → Prop) (hz : C → Prop) (e : Triple A B C) + (ha : e ∈ ambient) (ht : e ∈ targets) (hs : survives hx hy hz e) : + e ∉ eligible ambient targets hx hy hz ↔ ambientXCollision ambient hx hy hz e := by + constructor + · intro h + by_contra hno + exact h (eligible_of_no_ambientXCollision ambient targets hx hy hz e ha ht hs hno) + · rintro ⟨f, hf, hne, hfs, hfx⟩ he + exact hne (((mem_eligible_iff ambient targets hx hy hz e).1 he).2.2.2 f hf hfs hfx) + +theorem assignUseful_of_no_targetCollision + (ambient targets : Finset (Triple A B C)) + (hx : A → Prop) (hy : B → Prop) (hz : C → Prop) + (compatible useful : Triple A B C → V → Prop) (e : Triple A B C) (v : V) + (he : e ∈ eligible ambient targets hx hy hz) + (hc : compatible e v) (hu : useful e v) + (hno : ¬ targetCompatibleCollision targets hx hy hz compatible e v) : + assignUseful (eligible ambient targets hx hy hz) compatible useful v = some e := by + apply assignUseful_of_unique _ _ _ _ _ he hc hu + intro f hf hcf + have hfe := (mem_eligible_iff ambient targets hx hy hz f).1 hf + by_contra hne + exact hno ⟨f, hfe.2.1, hne, hfe.2.2.1, hcf⟩ + +theorem assignment_failure_implies_collision + (ambient targets : Finset (Triple A B C)) + (hx : A → Prop) (hy : B → Prop) (hz : C → Prop) + (compatible useful : Triple A B C → V → Prop) (e : Triple A B C) (v : V) + (ha : e ∈ ambient) (ht : e ∈ targets) (hs : survives hx hy hz e) + (hc : compatible e v) (hu : useful e v) + (hfail : assignUseful (eligible ambient targets hx hy hz) compatible useful v ≠ some e) : + ambientXCollision ambient hx hy hz e ∨ + targetCompatibleCollision targets hx hy hz compatible e v := by + by_cases hX : ambientXCollision ambient hx hy hz e + · exact Or.inl hX + apply Or.inr + by_contra hC + have he := eligible_of_no_ambientXCollision ambient targets hx hy hz e ha ht hs hX + exact hfail (assignUseful_of_no_targetCollision ambient targets hx hy hz + compatible useful e v he hc hu hC) + +theorem retained_assignment_of_no_collision + (ambient targets : Finset (Triple A B C)) + (hx : A → Prop) (hy : B → Prop) (hz : C → Prop) + (compatible useful : Triple A B C → V → Prop) (keep : V → Prop) + (e : Triple A B C) (v : V) + (ha : e ∈ ambient) (ht : e ∈ targets) (hs : survives hx hy hz e) + (hc : compatible e v) (hu : useful e v) (hk : keep v) + (hX : ¬ ambientXCollision ambient hx hy hz e) + (hC : ¬ targetCompatibleCollision targets hx hy hz compatible e v) : + retainAssignment (assignUseful (eligible ambient targets hx hy hz) compatible useful) + keep v = some e := by + have he := eligible_of_no_ambientXCollision ambient targets hx hy hz e ha ht hs hX + have hassign := assignUseful_of_no_targetCollision ambient targets hx hy hz + compatible useful e v he hc hu hC + simpa only [retainAssignment, ite_eq_left hk] using hassign + +theorem passing_assignment_failure_subset + (samples : Finset Ω) (ambient targets : Finset (Triple A B C)) + (hx : Ω → A → Prop) (hy : Ω → B → Prop) (hz : Ω → C → Prop) + (compatible useful : Triple A B C → V → Prop) (keep : V → Prop) + (e : Triple A B C) (v : V) (ha : e ∈ ambient) (ht : e ∈ targets) + (hc : compatible e v) (hu : useful e v) (hk : keep v) : + samples.filter (fun ω => survives (hx ω) (hy ω) (hz ω) e ∧ + retainAssignment + (assignUseful (eligible ambient targets (hx ω) (hy ω) (hz ω)) compatible useful) + keep v ≠ some e) ⊆ + samples.filter (fun ω => survives (hx ω) (hy ω) (hz ω) e ∧ + (ambientXCollision ambient (hx ω) (hy ω) (hz ω) e ∨ + targetCompatibleCollision targets (hx ω) (hy ω) (hz ω) compatible e v)) := by + intro ω hω + obtain ⟨hωs, hs, hfail⟩ := Finset.mem_filter.1 hω + apply Finset.mem_filter.2 + refine ⟨hωs, hs, ?_⟩ + have hfail' : assignUseful (eligible ambient targets (hx ω) (hy ω) (hz ω)) + compatible useful v ≠ some e := by + simpa only [retainAssignment, ite_eq_left hk] using hfail + exact assignment_failure_implies_collision ambient targets (hx ω) (hy ω) (hz ω) + compatible useful e v ha ht hs hc hu hfail' + +end MatrixMultiplication.JointAssignmentLoss + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/JointExtraction/CanonicalCW.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/JointExtraction/CanonicalCW.lean new file mode 100644 index 0000000000000000000000000000000000000000..efaada16d11bf4bf726df01feb536f53e99af900 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/JointExtraction/CanonicalCW.lean @@ -0,0 +1,124 @@ +import OAI.LinearAlgebra.MatrixMultiplication.JointExtraction.Canonicalization +import OAI.LinearAlgebra.MatrixMultiplication.CoppersmithWinograd.CWCoarseIndices + +namespace OAI + +/-! Joint tensor extraction, compatibility and entropy estimates. -/ + +noncomputable section + +namespace MatrixMultiplication.JointCanonicalCW + +open MatrixMultiplication.Foundation JointPopulation JointCanonicalization +open CWStrands HistorySymmetry InheritedMasks +open scoped BigOperators + +attribute [local instance] Classical.propDecidable + +variable {H F : Type*} [Fintype H] [DecidableEq H] [CommRing F] + (counts : H → Shape → ℕ) (leftLength rightLength : H → ℕ) + (parentShape : H → Fin 3 → ℕ) + (hleft : ∀ h, leftLength h ≤ 8) + +abbrev Left (h : H) := Fin (leftLength h) → Fin 7 +abbrev Right (h : H) := Fin (rightLength h) → Fin 7 + +def shapeNat (u : Shape) : Fin 3 → ℕ := fun s => (shapeSide s u).val + +def parentTensor (h : H) : Tensor F + (Left leftLength h × Right rightLength h) + (Left leftLength h × Right rightLength h) + (Left leftLength h × Right rightLength h) := + fun x y z => shapeTensor (Fin (leftLength h) ⊕ Fin (rightLength h)) (parentShape h) + (Sum.elim x.1 x.2) (Sum.elim y.1 y.2) (Sum.elim z.1 z.2) + +def coarse (_s : Fin 3) (h : H) (w : Left leftLength h × Right rightLength h) : Fin 17 := + CWCoarseIndices.coarseIndex (by simpa using hleft h) w.1 + +def leftTensor (c : ClassKey (H := H)) : + Tensor F (Left leftLength c.1) (Left leftLength c.1) (Left leftLength c.1) := + shapeTensor (Fin (leftLength c.1)) (shapeNat c.2) + +def rightTensor (c : ClassKey (H := H)) : + Tensor F (Right rightLength c.1) (Right rightLength c.1) (Right rightLength c.1) := + shapeTensor (Fin (rightLength c.1)) (parentShape c.1 - shapeNat c.2) + +omit [Fintype H] [DecidableEq H] in +theorem block_eq_product (h : H) (u : Shape) + (hu : ∀ s, shapeNat u s ≤ parentShape h s) : + block (Left leftLength) (Right rightLength) + (parentTensor leftLength rightLength parentShape) + (coarse leftLength rightLength hleft) (h, u) = + Tensor.product (leftTensor (F := F) leftLength (h, u)) + (rightTensor rightLength parentShape (h, u)) := by + have hadd : shapeNat u + (parentShape h - shapeNat u) = parentShape h := by + funext s + exact Nat.add_sub_of_le (hu s) + funext x y z + have hs := shape_split (F := F) (P := Fin (leftLength h)) + (Q := Fin (rightLength h)) (shapeNat u) (parentShape h - shapeNat u) x y z + rw [hadd] at hs + simpa [block, parentTensor, coarse, CWCoarseIndices.coarseIndex, + Fin.ext_iff, leftTensor, rightTensor, shapeNat, shapeSide, + Fin.isValue, ↓reduceIte] using hs + +omit [DecidableEq H] in +theorem canonicalBase_eq_children + (hsupport : ∀ h u, 0 < counts h u → ∀ s, shapeNat u s ≤ parentShape h s) : + canonicalBase counts (Left leftLength) (Right rightLength) + (parentTensor leftLength rightLength parentShape) + (coarse leftLength rightLength hleft) = + pairClassProduct (leftTensor (F := F) leftLength) + (rightTensor rightLength parentShape) := by + funext x y z + unfold canonicalBase + have hf : (∏ c : ClassKey (H := H), ∏ j : ClassPositions counts c, + block (Left leftLength) (Right rightLength) + (parentTensor leftLength rightLength parentShape) + (coarse leftLength rightLength hleft) c + (x.left c j, x.right c j) (y.left c j, y.right c j) (z.left c j, z.right c j)) = + ∏ c : ClassKey (H := H), ∏ j : ClassPositions counts c, + (leftTensor (F := F) leftLength c (x.left c j) (y.left c j) (z.left c j) * + rightTensor rightLength parentShape c (x.right c j) (y.right c j) (z.right c j)) := by + apply Finset.prod_congr rfl + intro c _ + apply Finset.prod_congr rfl + intro j _ + have hc : 0 < counts c.1 c.2 := lt_of_le_of_lt (Nat.zero_le j.val) j.isLt + rw [block_eq_product leftLength rightLength parentShape hleft c.1 c.2 + (hsupport c.1 c.2 hc)] + rfl + rw [hf] + simp only [pairClassProduct, classProduct, Finset.prod_mul_distrib] + +abbrev RawStrands := ∀ h, Positions counts h → + ((Fin (leftLength h) ⊕ Fin (rightLength h)) → Fin 7) + +def rawParentSource : Tensor F (RawStrands counts leftLength rightLength) + (RawStrands counts leftLength rightLength) (RawStrands counts leftLength rightLength) := + classProduct (fun h => shapeTensor (Fin (leftLength h) ⊕ Fin (rightLength h)) (parentShape h)) + +def joinWords (w : RawPairs counts (Left leftLength) (Right rightLength)) : + RawStrands counts leftLength rightLength := + fun h i => Sum.elim (w h i).1 (w h i).2 + +def joinMatrix : RawPairs counts (Left leftLength) (Right rightLength) → + RawStrands counts leftLength rightLength → F := + fun w v => if v = joinWords counts leftLength rightLength w then 1 else 0 + +theorem parentTensor_restrict : + Tensor.restrict (joinMatrix (F := F) counts leftLength rightLength) + (joinMatrix counts leftLength rightLength) (joinMatrix counts leftLength rightLength) + (rawParentSource counts leftLength rightLength parentShape) = + sourceTensor counts (Left leftLength) (Right rightLength) + (parentTensor leftLength rightLength parentShape) := by + classical + funext x y z + simp [Tensor.restrict, joinMatrix, rawParentSource, sourceTensor, + classProduct, joinWords, parentTensor, ite_mul, mul_ite] + +end MatrixMultiplication.JointCanonicalCW + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/JointExtraction/CanonicalInitial.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/JointExtraction/CanonicalInitial.lean new file mode 100644 index 0000000000000000000000000000000000000000..9de34d47e0952912bfa9e6645554b2bc4add303c --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/JointExtraction/CanonicalInitial.lean @@ -0,0 +1,184 @@ +import OAI.LinearAlgebra.MatrixMultiplication.JointExtraction.CanonicalCW +import Mathlib.Tactic.FinCases + +namespace OAI + +/-! Joint tensor extraction, compatibility and entropy estimates. -/ + +noncomputable section + +namespace MatrixMultiplication.JointCanonicalInitial + +open MatrixMultiplication.Foundation JointPopulation JointCanonicalization JointCanonicalCW +open InheritedMasks CWStrands +open scoped BigOperators + +attribute [local instance] Classical.propDecidable + +variable {H F : Type*} [Fintype H] [DecidableEq H] [CommRing F] + (counts : H → Shape → ℕ) + +abbrev Word := Fin 8 → Fin 7 +abbrev RawWords := ∀ h, Positions counts h → Word +abbrev CanonicalWords := ∀ c : ClassKey (H := H), ClassPositions counts c → Word + +def wholeEquiv (e : Target counts) : RawWords counts ≃ CanonicalWords counts where + toFun w := fun c j => w c.1 ((positionEquiv counts e c.1).symm ⟨c.2, j⟩) + invFun w := fun h i => w (h, (e h).val i) (positionEquiv counts e h i).2 + left_inv w := by + funext h i + change w h ((positionEquiv counts e h).symm (positionEquiv counts e h i)) = w h i + simp + right_inv w := by + funext c j + exact congrArg (fun p : Σ u, Fin (counts c.1 u) => w (c.1, p.1) p.2) + ((positionEquiv counts e c.1).apply_symm_apply ⟨c.2, j⟩) + +def rawSource : Tensor F (RawWords counts) (RawWords counts) (RawWords counts) := + classProduct (fun _ : H => strand (Fin 8)) + +def coarseWord (w : RawWords counts) : Position counts → Fin 17 := + fun i => CWCoarseIndices.coarseIndex (by simp) (w i.1 i.2) + +def ideal (e : Target counts) : Tensor F (RawWords counts) (RawWords counts) + (RawWords counts) := + JointIdealBranches.ideal (rawSource counts) (coarseWord counts) (coarseWord counts) + (coarseWord counts) (fun _ _ => True) (fun _ _ => True) (fun _ _ => True) + (triple counts e) + +def canonical : Tensor F (CanonicalWords counts) (CanonicalWords counts) + (CanonicalWords counts) := + classProduct (fun c : ClassKey (H := H) => shapeTensor (Fin 8) (shapeNat c.2)) + +omit [DecidableEq H] in +theorem canonical_pack (e : Target counts) (x y z : RawWords counts) : + canonical counts (wholeEquiv counts e x) (wholeEquiv counts e y) + (wholeEquiv counts e z) = + ∏ h, ∏ i, shapeTensor (F := F) (Fin 8) (shapeNat ((e h).val i)) + (x h i) (y h i) (z h i) := by + unfold canonical classProduct + rw [Fintype.prod_prod_type] + apply Finset.prod_congr rfl + intro h _ + rw [← Fintype.prod_sigma'] + apply Fintype.prod_equiv (positionEquiv counts e h).symm + intro i + simp only [wholeEquiv, Equiv.coe_fn_mk, positionEquiv_symm_shape] + +omit [DecidableEq H] in +theorem ideal_eq_canonical (e : Target counts) (x y z : RawWords counts) : + ideal (F := F) counts e x y z = canonical counts (wholeEquiv counts e x) + (wholeEquiv counts e y) (wholeEquiv counts e z) := by + rw [canonical_pack] + simp only [ideal, JointIdealBranches.ideal, ExactRecovery.delete, and_true, + rawSource, classProduct, shapeTensor, Fintype.prod_ite_zero, forall_and] + congr 1 + simp [coarseWord, triple, shapeNat, shapeSide, CWCoarseIndices.coarseIndex, + funext_iff, Fin.ext_iff, Sigma.forall] + +def coordinateMatrix (e : Target counts) : CanonicalWords counts → RawWords counts → F := + fun x v => if v = (wholeEquiv counts e).symm x then 1 else 0 + +theorem ideal_restrict (e : Target counts) : + Tensor.restrict (coordinateMatrix (F := F) counts e) (coordinateMatrix counts e) + (coordinateMatrix counts e) (ideal counts e) = canonical counts := by + funext x y z + simp only [Tensor.restrict, coordinateMatrix] + simp only [ite_mul, mul_ite, zero_mul, mul_zero, one_mul, Finset.sum_ite_eq', + Finset.mem_univ, ↓reduceIte] + rw [ideal_eq_canonical] + simp + +omit [DecidableEq H] in +theorem coarse_support (x y z : RawWords counts) + (hT : rawSource (F := F) counts x y z ≠ 0) (i : Position counts) : + (coarseWord counts x i).val + (coarseWord counts y i).val + + (coarseWord counts z i).val = 16 := by + have hh : strand (F := F) (Fin 8) (x i.1 i.2) (y i.1 i.2) (z i.1 i.2) ≠ 0 := by + intro hz + apply hT + unfold rawSource classProduct + apply Finset.prod_eq_zero (Finset.mem_univ i.1) + exact Finset.prod_eq_zero (Finset.mem_univ i.2) hz + simpa [coarseWord] using + CWCoarseIndices.strand_coarse_support (F := F) (by simp) + (x i.1 i.2) (y i.1 i.2) (z i.1 i.2) hh + +def sideMask (s : Fin 3) (w : RawWords counts) : Prop := + ∀ h a, wordPopulation (fun i => coarseWord counts w ⟨h, i⟩) a = + wordPopulation (sideWord counts s (triple counts (canonicalTarget counts)) h) a + +def maskedSource : Tensor F (RawWords counts) (RawWords counts) (RawWords counts) := + ExactRecovery.delete (rawSource counts) (sideMask counts 0) (sideMask counts 1) + (sideMask counts 2) + +omit [Fintype H] [DecidableEq H] in +theorem sideMask_of_target (s : Fin 3) (e : Target counts) (w : RawWords counts) + (he : coarseWord counts w = + fun i => sideWord counts s (triple counts e) i.1 i.2) : + sideMask counts s w := by + intro h a + rw [he] + exact marginal_population_eq counts e (canonicalTarget counts) h s a + +theorem maskedSource_support (x y z : RawWords counts) + (hT : maskedSource (F := F) counts x y z ≠ 0) : + (coarseWord counts x, coarseWord counts y, coarseWord counts z) ∈ + ambientSet counts (fun _ => 16) := by + have hm : sideMask counts 0 x ∧ sideMask counts 1 y ∧ sideMask counts 2 z := by + by_contra hn + simp [maskedSource, ExactRecovery.delete, hn] at hT + have hr : rawSource (F := F) counts x y z ≠ 0 := by + simpa [maskedSource, ExactRecovery.delete, hm] using hT + apply Finset.mem_filter.mpr + refine ⟨Finset.mem_univ _, ?_, ?_⟩ + · intro i + exact coarse_support counts x y z hr i + · intro h s a + fin_cases s + · refine Eq.trans ?_ (hm.1 h a) + apply congrArg (fun v : Positions counts h → Fin 17 => wordPopulation v a) + funext i + simp [sideWord, shapeSide] + · refine Eq.trans ?_ (hm.2.1 h a) + apply congrArg (fun v : Positions counts h → Fin 17 => wordPopulation v a) + funext i + simp [sideWord, shapeSide] + · refine Eq.trans ?_ (hm.2.2 h a) + apply congrArg (fun v : Positions counts h → Fin 17 => wordPopulation v a) + funext i + simp [sideWord, shapeSide] + +omit [DecidableEq H] in +theorem ideal_support_masks (e : Target counts) (x y z : RawWords counts) + (hT : ideal (F := F) counts e x y z ≠ 0) : + sideMask counts 0 x ∧ sideMask counts 1 y ∧ sideMask counts 2 z := by + have hc : coarseWord counts x = (triple counts e).1 ∧ + coarseWord counts y = (triple counts e).2.1 ∧ + coarseWord counts z = (triple counts e).2.2 := by + by_contra hn + simp [ideal, JointIdealBranches.ideal, ExactRecovery.delete, hn] at hT + constructor + · apply sideMask_of_target counts 0 e x + simpa [sideWord, shapeSide] using hc.1 + constructor + · apply sideMask_of_target counts 1 e y + simpa [sideWord, shapeSide] using hc.2.1 + · apply sideMask_of_target counts 2 e z + simpa [sideWord, shapeSide] using hc.2.2 + +omit [DecidableEq H] in +theorem delete_ideal_eq (e : Target counts) : + ExactRecovery.delete (ideal (F := F) counts e) (sideMask counts 0) + (sideMask counts 1) (sideMask counts 2) = ideal counts e := by + funext x y z + by_cases h : ideal (F := F) counts e x y z = 0 + · rw [ExactRecovery.delete, h] + simp + · rw [ExactRecovery.delete, ite_eq_left (ideal_support_masks counts e x y z h)] + +end MatrixMultiplication.JointCanonicalInitial + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/JointExtraction/CanonicalMixed.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/JointExtraction/CanonicalMixed.lean new file mode 100644 index 0000000000000000000000000000000000000000..a8fde9f13a60b76e3bb756c4d27961cd3a07b58c --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/JointExtraction/CanonicalMixed.lean @@ -0,0 +1,281 @@ +import OAI.LinearAlgebra.MatrixMultiplication.JointExtraction.CanonicalCW +import Mathlib.Tactic.FinCases + +namespace OAI + +/-! Joint tensor extraction, compatibility and entropy estimates. -/ + +noncomputable section + +namespace MatrixMultiplication.JointCanonicalMixed + +open MatrixMultiplication.Foundation JointPopulation JointCanonicalization JointCanonicalCW +open CWStrands HistorySymmetry InheritedMasks +open scoped BigOperators + +attribute [local instance] Classical.propDecidable + +variable {H F : Type*} [Fintype H] [DecidableEq H] [CommRing F] + (counts : H → Shape → ℕ) (leftLength rightLength : H → ℕ) + (parentShape : H → Fin 3 → ℕ) (sharing : H → Bool) + (hleft : ∀ h, leftLength h ≤ 8) + +def inputTensor (h : H) : Tensor F + (Left leftLength h × Right rightLength h) + (Left leftLength h × Right rightLength h) + (Left leftLength h × Right rightLength h) := + if sharing h then parentTensor leftLength rightLength parentShape h + else Tensor.product (strand (Fin (leftLength h))) (strand (Fin (rightLength h))) + +def childRight (c : ClassKey (H := H)) : + Tensor F (Right rightLength c.1) (Right rightLength c.1) (Right rightLength c.1) := + if sharing c.1 then rightTensor rightLength parentShape c + else strand (Fin (rightLength c.1)) + +omit [Fintype H] [DecidableEq H] in +theorem block_eq_children (h : H) (u : Shape) + (hu : sharing h = true → ∀ s, shapeNat u s ≤ parentShape h s) : + block (Left leftLength) (Right rightLength) + (inputTensor leftLength rightLength parentShape sharing) + (coarse leftLength rightLength hleft) (h, u) = + Tensor.product (leftTensor (F := F) leftLength (h, u)) + (childRight rightLength parentShape sharing (h, u)) := by + by_cases hs : sharing h = true + · funext x y z + have hh := congrFun (congrFun (congrFun + (block_eq_product (F := F) leftLength rightLength parentShape hleft h u (hu hs)) x) y) z + simpa only [block, inputTensor, childRight, hs, ↓reduceIte] using hh + · funext x y z + simp [block, inputTensor, childRight, hs, leftTensor, shapeTensor, + coarse, CWCoarseIndices.coarseIndex, Fin.ext_iff, shapeNat, shapeSide, + Tensor.product, ite_mul] + +omit [DecidableEq H] in +theorem canonicalBase_eq_children + (hsupport : ∀ h u, 0 < counts h u → sharing h = true → + ∀ s, shapeNat u s ≤ parentShape h s) : + canonicalBase counts (Left leftLength) (Right rightLength) + (inputTensor leftLength rightLength parentShape sharing) + (coarse leftLength rightLength hleft) = + pairClassProduct (leftTensor (F := F) leftLength) + (childRight rightLength parentShape sharing) := by + funext x y z + unfold canonicalBase + have hf : (∏ c : ClassKey (H := H), ∏ j : ClassPositions counts c, + block (Left leftLength) (Right rightLength) + (inputTensor leftLength rightLength parentShape sharing) + (coarse leftLength rightLength hleft) c + (x.left c j, x.right c j) (y.left c j, y.right c j) (z.left c j, z.right c j)) = + ∏ c : ClassKey (H := H), ∏ j : ClassPositions counts c, + (leftTensor (F := F) leftLength c (x.left c j) (y.left c j) (z.left c j) * + childRight rightLength parentShape sharing c + (x.right c j) (y.right c j) (z.right c j)) := by + apply Finset.prod_congr rfl + intro c _ + apply Finset.prod_congr rfl + intro j _ + have hc : 0 < counts c.1 c.2 := lt_of_le_of_lt (Nat.zero_le j.val) j.isLt + rw [block_eq_children leftLength rightLength parentShape sharing hleft c.1 c.2 + (hsupport c.1 c.2 hc)] + rfl + rw [hf] + simp only [pairClassProduct, classProduct, Finset.prod_mul_distrib] + +def rawSource : Tensor F (RawStrands counts leftLength rightLength) + (RawStrands counts leftLength rightLength) (RawStrands counts leftLength rightLength) := + classProduct (fun h => if sharing h then + shapeTensor (Fin (leftLength h) ⊕ Fin (rightLength h)) (parentShape h) + else strand (Fin (leftLength h) ⊕ Fin (rightLength h))) + +theorem inputTensor_restrict : + Tensor.restrict (joinMatrix (F := F) counts leftLength rightLength) + (joinMatrix counts leftLength rightLength) (joinMatrix counts leftLength rightLength) + (rawSource counts leftLength rightLength parentShape sharing) = + sourceTensor counts (Left leftLength) (Right rightLength) + (inputTensor leftLength rightLength parentShape sharing) := by + classical + funext x y z + simp only [Tensor.restrict, joinMatrix] + simp only [ite_mul, mul_ite, zero_mul, mul_zero, one_mul, Finset.sum_ite_eq', + Finset.mem_univ, ↓reduceIte] + unfold rawSource sourceTensor classProduct inputTensor + apply Finset.prod_congr rfl + intro h _ + apply Finset.prod_congr rfl + intro i _ + by_cases hs : sharing h = true + · simp [hs, joinWords, parentTensor] + · simp [hs, joinWords, strand_sum_elim] + +omit [Fintype H] [DecidableEq H] in +theorem coarse_support (h : H) + (x y z : Left leftLength h × Right rightLength h) + (hT : inputTensor (F := F) leftLength rightLength parentShape sharing h x y z ≠ 0) : + (coarse leftLength rightLength hleft 0 h x).val + + (coarse leftLength rightLength hleft 1 h y).val + + (coarse leftLength rightLength hleft 2 h z).val = 2 * leftLength h := by + by_cases hs : sharing h = true + · have hp : parentTensor (F := F) leftLength rightLength parentShape h x y z ≠ 0 := by + simpa [inputTensor, hs] using hT + have hh := CWCoarseIndices.split_coarse_support + (F := F) (by simpa using hleft h) (parentShape h) x y z hp + simpa only [coarse, Fintype.card_fin] using hh.1 + · have ht : strand (F := F) (Fin (leftLength h)) x.1 y.1 z.1 ≠ 0 := by + intro hz + apply hT + simp [inputTensor, hs, Tensor.product, hz] + simpa only [coarse, Fintype.card_fin] using + CWCoarseIndices.strand_coarse_support (F := F) (by simpa using hleft h) x.1 y.1 z.1 ht + +theorem typeWindow_zero_one {P A : Type*} [Fintype P] [DecidableEq P] + [Fintype A] [DecidableEq A] (w : P → A) : typeWindow (fun _ => 0) 1 w := by + intro a + dsimp [empiricalLaw] + have h0 : (0 : ℝ) ≤ (wordPopulation w a : ℝ) / Fintype.card P := by positivity + rw [sub_zero, abs_of_nonneg h0] + by_cases hp : Fintype.card P = 0 + · simp [hp] + · apply (div_le_one (by exact_mod_cast Nat.pos_of_ne_zero hp)).2 + exact_mod_cast (Fintype.card_subtype_le (fun i : P => w i = a)) + +abbrev MixedWords := RawPairs counts (Left leftLength) (Right rightLength) + +def coarseWord (w : MixedWords counts leftLength rightLength) : Position counts → Fin 17 := + JointCanonicalization.coarseWord counts (Left leftLength) (Right rightLength) + (coarse leftLength rightLength hleft) 0 w + +def sideMask (s : Fin 3) (w : MixedWords counts leftLength rightLength) : Prop := + ∀ h a, wordPopulation (fun i => coarseWord counts leftLength rightLength hleft w ⟨h, i⟩) a = + wordPopulation (sideWord counts s (triple counts (canonicalTarget counts)) h) a + +def maskedSource : Tensor F (MixedWords counts leftLength rightLength) + (MixedWords counts leftLength rightLength) (MixedWords counts leftLength rightLength) := + ExactRecovery.delete + (sourceTensor counts (Left leftLength) (Right rightLength) + (inputTensor leftLength rightLength parentShape sharing)) + (sideMask counts leftLength rightLength hleft 0) + (sideMask counts leftLength rightLength hleft 1) + (sideMask counts leftLength rightLength hleft 2) + +omit [Fintype H] [DecidableEq H] in +theorem sideMask_of_target (s : Fin 3) (e : Target counts) + (w : MixedWords counts leftLength rightLength) + (he : coarseWord counts leftLength rightLength hleft w = + fun i => sideWord counts s (triple counts e) i.1 i.2) : + sideMask counts leftLength rightLength hleft s w := by + intro h a + rw [he] + exact marginal_population_eq counts e (canonicalTarget counts) h s a + +theorem maskedSource_support (x y z : MixedWords counts leftLength rightLength) + (hT : maskedSource (F := F) counts leftLength rightLength parentShape sharing hleft x y z ≠ 0) : + (coarseWord counts leftLength rightLength hleft x, + coarseWord counts leftLength rightLength hleft y, + coarseWord counts leftLength rightLength hleft z) ∈ + ambientSet counts (fun h => 2 * leftLength h) := by + have hm : sideMask counts leftLength rightLength hleft 0 x ∧ + sideMask counts leftLength rightLength hleft 1 y ∧ + sideMask counts leftLength rightLength hleft 2 z := by + by_contra hn + simp [maskedSource, ExactRecovery.delete, hn] at hT + have hr : sourceTensor counts (Left leftLength) (Right rightLength) + (inputTensor (F := F) leftLength rightLength parentShape sharing) x y z ≠ 0 := by + simpa [maskedSource, ExactRecovery.delete, hm] using hT + apply Finset.mem_filter.mpr + refine ⟨Finset.mem_univ _, ?_, ?_⟩ + · intro i + have hi : inputTensor (F := F) leftLength rightLength parentShape sharing i.1 + (x i.1 i.2) (y i.1 i.2) (z i.1 i.2) ≠ 0 := by + intro hz + apply hr + unfold sourceTensor classProduct + apply Finset.prod_eq_zero (Finset.mem_univ i.1) + exact Finset.prod_eq_zero (Finset.mem_univ i.2) hz + exact coarse_support leftLength rightLength parentShape sharing hleft i.1 + (x i.1 i.2) (y i.1 i.2) (z i.1 i.2) hi + · intro h s a + fin_cases s + · refine Eq.trans ?_ (hm.1 h a) + apply congrArg (fun v : Positions counts h → Fin 17 => wordPopulation v a) + funext i + simp [sideWord, shapeSide] + · refine Eq.trans ?_ (hm.2.1 h a) + apply congrArg (fun v : Positions counts h → Fin 17 => wordPopulation v a) + funext i + simp [sideWord, shapeSide] + · refine Eq.trans ?_ (hm.2.2 h a) + apply congrArg (fun v : Positions counts h → Fin 17 => wordPopulation v a) + funext i + simp [sideWord, shapeSide] + +omit [DecidableEq H] in +theorem coarseIdeal_support_masks (e : Target counts) + (x y z : MixedWords counts leftLength rightLength) + (hT : coarseIdeal counts (Left leftLength) (Right rightLength) + (inputTensor (F := F) leftLength rightLength parentShape sharing) + (coarse leftLength rightLength hleft) e x y z ≠ 0) : + sideMask counts leftLength rightLength hleft 0 x ∧ + sideMask counts leftLength rightLength hleft 1 y ∧ + sideMask counts leftLength rightLength hleft 2 z := by + have hc : coarseMask counts (Left leftLength) (Right rightLength) + (coarse leftLength rightLength hleft) 0 e x ∧ + coarseMask counts (Left leftLength) (Right rightLength) + (coarse leftLength rightLength hleft) 1 e y ∧ + coarseMask counts (Left leftLength) (Right rightLength) + (coarse leftLength rightLength hleft) 2 e z := by + by_contra hn + simp [coarseIdeal, ExactRecovery.delete, hn] at hT + constructor + · apply sideMask_of_target counts leftLength rightLength hleft 0 e x + funext i + exact hc.1 i.1 i.2 + constructor + · apply sideMask_of_target counts leftLength rightLength hleft 1 e y + funext i + exact hc.2.1 i.1 i.2 + · apply sideMask_of_target counts leftLength rightLength hleft 2 e z + funext i + exact hc.2.2 i.1 i.2 + +omit [DecidableEq H] in +theorem ideal_support_masks (e : Target counts) + (px py pz : MixedWords counts leftLength rightLength → Prop) + (x y z : MixedWords counts leftLength rightLength) + (hT : ExactRecovery.delete + (coarseIdeal counts (Left leftLength) (Right rightLength) + (inputTensor (F := F) leftLength rightLength parentShape sharing) + (coarse leftLength rightLength hleft) e) px py pz x y z ≠ 0) : + sideMask counts leftLength rightLength hleft 0 x ∧ + sideMask counts leftLength rightLength hleft 1 y ∧ + sideMask counts leftLength rightLength hleft 2 z := by + apply coarseIdeal_support_masks (F := F) counts leftLength rightLength parentShape sharing hleft e x y z + intro hz + simp [ExactRecovery.delete, hz] at hT + +omit [DecidableEq H] in +theorem delete_ideal_eq (e : Target counts) + (px py pz : MixedWords counts leftLength rightLength → Prop) : + let Q := ExactRecovery.delete + (coarseIdeal counts (Left leftLength) (Right rightLength) + (inputTensor (F := F) leftLength rightLength parentShape sharing) + (coarse leftLength rightLength hleft) e) px py pz + ExactRecovery.delete Q (sideMask counts leftLength rightLength hleft 0) + (sideMask counts leftLength rightLength hleft 1) + (sideMask counts leftLength rightLength hleft 2) = Q := by + dsimp only + funext x y z + by_cases h : ExactRecovery.delete + (coarseIdeal counts (Left leftLength) (Right rightLength) + (inputTensor (F := F) leftLength rightLength parentShape sharing) + (coarse leftLength rightLength hleft) e) px py pz x y z = 0 + · rw [ExactRecovery.delete, h] + simp + · have hm := ideal_support_masks (F := F) counts leftLength rightLength parentShape sharing hleft + e px py pz x y z h + rw [ExactRecovery.delete, ite_eq_left hm] + +end MatrixMultiplication.JointCanonicalMixed + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/JointExtraction/CanonicalSymmetry.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/JointExtraction/CanonicalSymmetry.lean new file mode 100644 index 0000000000000000000000000000000000000000..c8f8297743fca0be646edcbbd9605ca33b395ecd --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/JointExtraction/CanonicalSymmetry.lean @@ -0,0 +1,83 @@ +import OAI.LinearAlgebra.MatrixMultiplication.JointExtraction.CanonicalMixed +import OAI.LinearAlgebra.MatrixMultiplication.Recovery.EquivOrbitTransport + +namespace OAI + +/-! Joint tensor extraction, compatibility and entropy estimates. -/ + +noncomputable section + +namespace MatrixMultiplication.JointCanonicalSymmetry + +open MatrixMultiplication.Foundation JointPopulation JointCanonicalization JointCanonicalCW +open JointCanonicalMixed HistorySymmetry PermutationMatching + +attribute [local instance] Classical.propDecidable + +variable {H F : Type*} [Fintype H] [DecidableEq H] [CommRing F] + (counts : H → Shape → ℕ) (leftLength rightLength : H → ℕ) + (parentShape : H → Fin 3 → ℕ) (sharing : H → Bool) + (hleft : ∀ h, leftLength h ≤ 8) + {SL SR : H → Type*} + [∀ h, Fintype (SL h)] [∀ h, Fintype (SR h)] + [∀ h, DecidableEq (SL h)] [∀ h, DecidableEq (SR h)] + (sl : Fin 3 → ∀ c : ClassKey (H := H), Left leftLength c.1 → SL c.1) + (sr : Fin 3 → ∀ c : ClassKey (H := H), Right rightLength c.1 → SR c.1) + (νl : Fin 3 → ∀ c : ClassKey (H := H), SL c.1 → ℝ) + (νr : Fin 3 → ∀ c : ClassKey (H := H), SR c.1 → ℝ) + (ηl ηr : Fin 3 → ClassKey (H := H) → ℝ) + (hsupport : ∀ h u, 0 < counts h u → sharing h = true → + ∀ s, shapeNat u s ≤ parentShape h s) + +include hsupport + +omit [DecidableEq H] [∀ h, Fintype (SL h)] [∀ h, Fintype (SR h)] in +theorem canonicalIdeal_smul + (g : HalfClassPermutations (ClassPositions counts)) + (x y z : CanonicalPairs counts (Left leftLength) (Right rightLength)) : + canonicalIdeal counts (Left leftLength) (Right rightLength) + (inputTensor (F := F) leftLength rightLength parentShape sharing) + (coarse leftLength rightLength hleft) sl sr νl νr ηl ηr + (g • x) (g • y) (g • z) = + canonicalIdeal counts (Left leftLength) (Right rightLength) + (inputTensor leftLength rightLength parentShape sharing) + (coarse leftLength rightLength hleft) sl sr νl νr ηl ηr x y z := by + simp only [canonicalIdeal, + JointCanonicalMixed.canonicalBase_eq_children counts leftLength rightLength + parentShape sharing hleft hsupport, + ExactRecovery.delete, childWindows_smul, pairClassProduct_smul] + +omit [DecidableEq H] in +theorem rawIdeal_smul (e : Target counts) : + letI : MulAction (HalfClassPermutations (ClassPositions counts)) + (RawPairs counts (Left leftLength) (Right rightLength)) := + EquivOrbitTransport.action (pairEquiv counts (Left leftLength) (Right rightLength) e) + ∀ (g : HalfClassPermutations (ClassPositions counts)) x y z, + JointCanonicalization.ideal counts (Left leftLength) (Right rightLength) + (inputTensor (F := F) leftLength rightLength parentShape sharing) + (coarse leftLength rightLength hleft) sl sr νl νr ηl ηr e + (g • x) (g • y) (g • z) = + JointCanonicalization.ideal counts (Left leftLength) (Right rightLength) + (inputTensor leftLength rightLength parentShape sharing) + (coarse leftLength rightLength hleft) sl sr νl νr ηl ηr e x y z := by + apply EquivOrbitTransport.coefficients_preserved + (pairEquiv counts (Left leftLength) (Right rightLength) e) + (pairEquiv counts (Left leftLength) (Right rightLength) e) + (pairEquiv counts (Left leftLength) (Right rightLength) e) + (JointCanonicalization.ideal counts (Left leftLength) (Right rightLength) + (inputTensor (F := F) leftLength rightLength parentShape sharing) + (coarse leftLength rightLength hleft) sl sr νl νr ηl ηr e) + (canonicalIdeal counts (Left leftLength) (Right rightLength) + (inputTensor (F := F) leftLength rightLength parentShape sharing) + (coarse leftLength rightLength hleft) sl sr νl νr ηl ηr) + · exact ideal_eq_canonicalIdeal counts (Left leftLength) (Right rightLength) + (inputTensor leftLength rightLength parentShape sharing) + (coarse leftLength rightLength hleft) sl sr νl νr ηl ηr e + · exact canonicalIdeal_smul counts leftLength rightLength parentShape sharing hleft + sl sr νl νr ηl ηr hsupport + +end MatrixMultiplication.JointCanonicalSymmetry + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/JointExtraction/Canonicalization.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/JointExtraction/Canonicalization.lean new file mode 100644 index 0000000000000000000000000000000000000000..f7efb53114f046c2df39feeeaa70d905189a5f91 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/JointExtraction/Canonicalization.lean @@ -0,0 +1,346 @@ +import OAI.LinearAlgebra.MatrixMultiplication.JointExtraction.Population +import OAI.LinearAlgebra.MatrixMultiplication.Recovery.HistorySymmetry +import OAI.LinearAlgebra.MatrixMultiplication.JointExtraction.IdealBranches +import Mathlib.Algebra.BigOperators.GroupWithZero.Finset + +namespace OAI + +/-! Joint tensor extraction, compatibility and entropy estimates. -/ + +noncomputable section + +namespace MatrixMultiplication.JointCanonicalization + +open MatrixMultiplication.Foundation JointPopulation InheritedMasks +open PermutationMatching HistorySymmetry +open scoped BigOperators + +attribute [local instance] Classical.propDecidable + +variable {H : Type*} (counts : H → Shape → ℕ) + +def fiberEquiv (e : Target counts) (h : H) (u : Shape) : + Class counts e h u ≃ Fin (counts h u) := + Fintype.equivOfCardEq (by rw [class_card, Fintype.card_fin]) + +def positionEquiv (e : Target counts) (h : H) : + Positions counts h ≃ (Σ u, Fin (counts h u)) := + (Equiv.sigmaFiberEquiv (e h).val).symm.trans + (Equiv.sigmaCongrRight (fiberEquiv counts e h)) + +@[simp] theorem positionEquiv_shape (e : Target counts) (h : H) (i : Positions counts h) : + (positionEquiv counts e h i).1 = (e h).val i := rfl + +@[simp] theorem positionEquiv_symm_shape (e : Target counts) (h : H) + (i : Σ u, Fin (counts h u)) : + (e h).val ((positionEquiv counts e h).symm i) = i.1 := by + have hh := congrArg Sigma.fst ((positionEquiv counts e h).apply_symm_apply i) + simpa only [positionEquiv_shape] using hh + +abbrev ClassKey := H × Shape +abbrev ClassPositions (c : ClassKey (H := H)) := Fin (counts c.1 c.2) + +variable (L R : H → Type*) + +abbrev RawPairs := ∀ h, Positions counts h → L h × R h +abbrev CanonicalPairs := CompleteWordPair (ClassPositions counts) + (fun c => L c.1) (fun c => R c.1) + +def pairEquiv (e : Target counts) : RawPairs counts L R ≃ CanonicalPairs counts L R where + toFun w := + { left := fun c j => (w c.1 ((positionEquiv counts e c.1).symm ⟨c.2, j⟩)).1 + right := fun c j => (w c.1 ((positionEquiv counts e c.1).symm ⟨c.2, j⟩)).2 } + invFun w := fun h i => + (w.left (h, (e h).val i) (positionEquiv counts e h i).2, + w.right (h, (e h).val i) (positionEquiv counts e h i).2) + left_inv w := by + funext h i + change ((w h ((positionEquiv counts e h).symm + (positionEquiv counts e h i))).1, + (w h ((positionEquiv counts e h).symm (positionEquiv counts e h i))).2) = w h i + simp + right_inv w := by + cases w with + | mk wl wr => + dsimp only + congr 1 <;> funext c j + · exact congrArg (β := L c.1) + (fun p : Σ u, Fin (counts c.1 u) => wl (c.1, p.1) p.2) + ((positionEquiv counts e c.1).apply_symm_apply ⟨c.2, j⟩) + · exact congrArg (β := R c.1) + (fun p : Σ u, Fin (counts c.1 u) => wr (c.1, p.1) p.2) + ((positionEquiv counts e c.1).apply_symm_apply ⟨c.2, j⟩) + +theorem pairEquiv_fiber_left (e : Target counts) (w : RawPairs counts L R) + (h : H) (u : Shape) (j : Fin (counts h u)) : + (pairEquiv counts L R e w).left (h, u) j = + (w h ((fiberEquiv counts e h u).symm j).val).1 := rfl + +theorem pairEquiv_fiber_right (e : Target counts) (w : RawPairs counts L R) + (h : H) (u : Shape) (j : Fin (counts h u)) : + (pairEquiv counts L R e w).right (h, u) j = + (w h ((fiberEquiv counts e h u).symm j).val).2 := rfl + +theorem typeWindow_reindex {P Q A : Type*} + [Fintype P] [Fintype Q] [DecidableEq P] [DecidableEq Q] + [Fintype A] [DecidableEq A] + (ν : A → ℝ) (η : ℝ) (w : P → A) (p : Q ≃ P) : + typeWindow ν η (w ∘ p) ↔ typeWindow ν η w := by + simp only [typeWindow, empiricalLaw, wordPopulation_reindex, Fintype.card_congr p] + +section Windows + +variable {SL SR : H → Type*} + [∀ h, Fintype (SL h)] [∀ h, Fintype (SR h)] + [∀ h, DecidableEq (SL h)] [∀ h, DecidableEq (SR h)] + (sl : ∀ c : ClassKey (H := H), L c.1 → SL c.1) + (sr : ∀ c : ClassKey (H := H), R c.1 → SR c.1) + (νl : ∀ c : ClassKey (H := H), SL c.1 → ℝ) + (νr : ∀ c : ClassKey (H := H), SR c.1 → ℝ) + (ηl ηr : ClassKey (H := H) → ℝ) + +def activeLaw {S : H → Type*} (ν : ∀ c : ClassKey (H := H), S c.1 → ℝ) + (c : ClassKey (H := H)) : S c.1 → ℝ := + fun a => if 0 < counts c.1 c.2 then ν c a else 0 + +def activeWidth (η : ClassKey (H := H) → ℝ) (c : ClassKey (H := H)) : ℝ := + if 0 < counts c.1 c.2 then η c else 0 + +theorem activeLaw_of_pos {S : H → Type*} + (ν : ∀ c : ClassKey (H := H), S c.1 → ℝ) (c : ClassKey (H := H)) + (hc : 0 < counts c.1 c.2) : activeLaw counts ν c = ν c := by + funext a + simp [activeLaw, hc] + +def rawWindows (e : Target counts) (w : RawPairs counts L R) : Prop := + ∀ h u, 0 < counts h u → + typeWindow (νl (h, u)) (ηl (h, u)) + (fun i : Class counts e h u => sl (h, u) (w h i.val).1) ∧ + typeWindow (νr (h, u)) (ηr (h, u)) + (fun i : Class counts e h u => sr (h, u) (w h i.val).2) + +theorem rawWindows_iff_childWindows (e : Target counts) (w : RawPairs counts L R) : + rawWindows counts L R sl sr νl νr ηl ηr e w ↔ + childWindows sl sr (activeLaw counts νl) (activeLaw counts νr) + (activeWidth counts ηl) (activeWidth counts ηr) (pairEquiv counts L R e w) := by + unfold rawWindows childWindows + conv_rhs => rw [Prod.forall] + apply forall_congr' + intro h + apply forall_congr' + intro u + by_cases hp : 0 < counts h u + · simp only [hp, true_implies, activeLaw_of_pos counts _ (h, u) hp, + activeWidth] + change (_ ∧ _) ↔ + (typeWindow (νl (h, u)) (ηl (h, u)) + ((fun i : Class counts e h u => sl (h, u) (w h i.val).1) ∘ + (fiberEquiv counts e h u).symm) ∧ + typeWindow (νr (h, u)) (ηr (h, u)) + ((fun i : Class counts e h u => sr (h, u) (w h i.val).2) ∘ + (fiberEquiv counts e h u).symm)) + rw [typeWindow_reindex, typeWindow_reindex] + · have hn : counts h u = 0 := Nat.eq_zero_of_not_pos hp + have hcard : Fintype.card (ClassPositions counts (h, u)) = 0 := + (Fintype.card_fin _).trans hn + simp only [hp, false_implies, true_iff] + constructor <;> intro a + all_goals + simp only [activeLaw, activeWidth, ite_eq_right hp] + unfold empiricalLaw + rw [hcard] + simp only [Nat.cast_zero, div_zero, sub_zero, abs_zero, le_refl] + +end Windows + +section Coefficients + +variable [Fintype H] [DecidableEq H] {F : Type*} [CommSemiring F] + (T : ∀ h, Tensor F (L h × R h) (L h × R h) (L h × R h)) + (coarse : Fin 3 → ∀ h, L h × R h → Fin 17) + +def coarseMask (s : Fin 3) (e : Target counts) (w : RawPairs counts L R) : Prop := + ∀ h i, coarse s h (w h i) = shapeSide s ((e h).val i) + +def coarseWord (s : Fin 3) (w : RawPairs counts L R) : Position counts → Fin 17 := + fun p => coarse s p.1 (w p.1 p.2) + +def sourceTensor : Tensor F (RawPairs counts L R) (RawPairs counts L R) + (RawPairs counts L R) := classProduct T + +def coarseIdeal (e : Target counts) : Tensor F (RawPairs counts L R) + (RawPairs counts L R) (RawPairs counts L R) := + ExactRecovery.delete (sourceTensor counts L R T) + (coarseMask counts L R coarse 0 e) (coarseMask counts L R coarse 1 e) + (coarseMask counts L R coarse 2 e) + +def block (c : ClassKey (H := H)) : + Tensor F (L c.1 × R c.1) (L c.1 × R c.1) (L c.1 × R c.1) := + fun x y z => if coarse 0 c.1 x = c.2.1 ∧ coarse 1 c.1 y = c.2.2.1 ∧ + coarse 2 c.1 z = c.2.2.2 then T c.1 x y z else 0 + +def canonicalBase : Tensor F (CanonicalPairs counts L R) (CanonicalPairs counts L R) + (CanonicalPairs counts L R) := + fun x y z => ∏ c, ∏ j, block L R T coarse c + (x.left c j, x.right c j) (y.left c j, y.right c j) (z.left c j, z.right c j) + +omit [DecidableEq H] in +theorem product_pack (e : Target counts) + (f : ∀ h, Shape → (L h × R h) → (L h × R h) → (L h × R h) → F) + (x y z : RawPairs counts L R) : + (∏ c : ClassKey (H := H), ∏ j : ClassPositions counts c, + f c.1 c.2 + ((pairEquiv counts L R e x).left c j, (pairEquiv counts L R e x).right c j) + ((pairEquiv counts L R e y).left c j, (pairEquiv counts L R e y).right c j) + ((pairEquiv counts L R e z).left c j, (pairEquiv counts L R e z).right c j)) = + ∏ h, ∏ i, f h ((e h).val i) (x h i) (y h i) (z h i) := by + rw [Fintype.prod_prod_type] + apply Finset.prod_congr rfl + intro h _ + rw [← Fintype.prod_sigma'] + apply Fintype.prod_equiv (positionEquiv counts e h).symm + intro i + simp only [pairEquiv, Equiv.coe_fn_mk, Prod.mk.eta, positionEquiv_symm_shape] + +omit [DecidableEq H] in +theorem coarseIdeal_eq_canonicalBase (e : Target counts) (x y z : RawPairs counts L R) : + coarseIdeal counts L R T coarse e x y z = canonicalBase counts L R T coarse + (pairEquiv counts L R e x) (pairEquiv counts L R e y) (pairEquiv counts L R e z) := by + unfold canonicalBase + rw [product_pack counts L R e (fun h u => block L R T coarse (h, u))] + simp [block, Fintype.prod_ite_zero, coarseIdeal, ExactRecovery.delete, + sourceTensor, classProduct, coarseMask, shapeSide, Fin.isValue, ↓reduceIte, + forall_and] + +def coordinateMatrix (e : Target counts) : + CanonicalPairs counts L R → RawPairs counts L R → F := + fun w v => if v = (pairEquiv counts L R e).symm w then 1 else 0 + +theorem coordinateMatrix_restrict + [∀ h, Fintype (L h)] [∀ h, Fintype (R h)] + (e : Target counts) (Q : Tensor F (RawPairs counts L R) (RawPairs counts L R) + (RawPairs counts L R)) (x y z : CanonicalPairs counts L R) : + Tensor.restrict (coordinateMatrix counts L R e) (coordinateMatrix counts L R e) + (coordinateMatrix counts L R e) Q x y z = + Q ((pairEquiv counts L R e).symm x) ((pairEquiv counts L R e).symm y) + ((pairEquiv counts L R e).symm z) := by + classical + simp [Tensor.restrict, coordinateMatrix, ite_mul, mul_ite] + +theorem coarseIdeal_restrict + [∀ h, Fintype (L h)] [∀ h, Fintype (R h)] (e : Target counts) : + Tensor.restrict (coordinateMatrix counts L R e) (coordinateMatrix counts L R e) + (coordinateMatrix counts L R e) (coarseIdeal counts L R T coarse e) = + canonicalBase counts L R T coarse := by + funext x y z + rw [coordinateMatrix_restrict, coarseIdeal_eq_canonicalBase] + simp + +omit [DecidableEq H] in +theorem canonicalBase_eq_pairClassProduct + (TL : ∀ c : ClassKey (H := H), Tensor F (L c.1) (L c.1) (L c.1)) + (TR : ∀ c : ClassKey (H := H), Tensor F (R c.1) (R c.1) (R c.1)) + (hblock : ∀ c, block L R T coarse c = Tensor.product (TL c) (TR c)) : + canonicalBase counts L R T coarse = pairClassProduct TL TR := by + funext x y z + simp only [canonicalBase, hblock, Tensor.product, pairClassProduct, classProduct, + Finset.prod_mul_distrib] + +section ChildWindows + +variable {SL SR : H → Type*} + [∀ h, Fintype (SL h)] [∀ h, Fintype (SR h)] + [∀ h, DecidableEq (SL h)] [∀ h, DecidableEq (SR h)] + (sl : Fin 3 → ∀ c : ClassKey (H := H), L c.1 → SL c.1) + (sr : Fin 3 → ∀ c : ClassKey (H := H), R c.1 → SR c.1) + (νl : Fin 3 → ∀ c : ClassKey (H := H), SL c.1 → ℝ) + (νr : Fin 3 → ∀ c : ClassKey (H := H), SR c.1 → ℝ) + (ηl ηr : Fin 3 → ClassKey (H := H) → ℝ) + +def ideal (e : Target counts) : Tensor F (RawPairs counts L R) + (RawPairs counts L R) (RawPairs counts L R) := + ExactRecovery.delete (coarseIdeal counts L R T coarse e) + (rawWindows counts L R (sl 0) (sr 0) (νl 0) (νr 0) (ηl 0) (ηr 0) e) + (rawWindows counts L R (sl 1) (sr 1) (νl 1) (νr 1) (ηl 1) (ηr 1) e) + (rawWindows counts L R (sl 2) (sr 2) (νl 2) (νr 2) (ηl 2) (ηr 2) e) + +def canonicalIdeal : Tensor F (CanonicalPairs counts L R) (CanonicalPairs counts L R) + (CanonicalPairs counts L R) := + ExactRecovery.delete (canonicalBase counts L R T coarse) + (childWindows (sl 0) (sr 0) (activeLaw counts (νl 0)) (activeLaw counts (νr 0)) + (activeWidth counts (ηl 0)) (activeWidth counts (ηr 0))) + (childWindows (sl 1) (sr 1) (activeLaw counts (νl 1)) (activeLaw counts (νr 1)) + (activeWidth counts (ηl 1)) (activeWidth counts (ηr 1))) + (childWindows (sl 2) (sr 2) (activeLaw counts (νl 2)) (activeLaw counts (νr 2)) + (activeWidth counts (ηl 2)) (activeWidth counts (ηr 2))) + +def usefulByTriple (s : Fin 3) + (t : JointCoarseHashing.Triple (Position counts)) (w : RawPairs counts L R) : Prop := + ∃ e : Target counts, triple counts e = t ∧ + rawWindows counts L R (sl s) (sr s) (νl s) (νr s) (ηl s) (ηr s) e w + +omit [Fintype H] [DecidableEq H] + [∀ index, Fintype (SL index)] [∀ index, Fintype (SR index)] in +theorem usefulByTriple_target (s : Fin 3) (e : Target counts) (w : RawPairs counts L R) : + usefulByTriple counts L R sl sr νl νr ηl ηr s (triple counts e) w ↔ + rawWindows counts L R (sl s) (sr s) (νl s) (νr s) (ηl s) (ηr s) e w := by + constructor + · rintro ⟨f, hf, hw⟩ + have he : f = e := triple_injective counts hf + subst f + exact hw + · intro hw + exact ⟨e, rfl, hw⟩ + +omit [DecidableEq H] [∀ index, Fintype (SL index)] [∀ index, Fintype (SR index)] in +theorem ideal_eq_jointIdeal (e : Target counts) : + ideal counts L R T coarse sl sr νl νr ηl ηr e = + JointIdealBranches.ideal (sourceTensor counts L R T) + (coarseWord counts L R coarse 0) (coarseWord counts L R coarse 1) + (coarseWord counts L R coarse 2) + (usefulByTriple counts L R sl sr νl νr ηl ηr 0) + (usefulByTriple counts L R sl sr νl νr ηl ηr 1) + (usefulByTriple counts L R sl sr νl νr ηl ηr 2) (triple counts e) := by + funext x y z + have hx : coarseWord counts L R coarse 0 x = (triple counts e).1 ↔ + coarseMask counts L R coarse 0 e x := by + simp [coarseWord, triple, coarseMask, shapeSide, funext_iff, Sigma.forall] + have hy : coarseWord counts L R coarse 1 y = (triple counts e).2.1 ↔ + coarseMask counts L R coarse 1 e y := by + simp [coarseWord, triple, coarseMask, shapeSide, funext_iff, Sigma.forall] + have hz : coarseWord counts L R coarse 2 z = (triple counts e).2.2 ↔ + coarseMask counts L R coarse 2 e z := by + simp [coarseWord, triple, coarseMask, shapeSide, funext_iff, Sigma.forall] + simp only [ideal, coarseIdeal, JointIdealBranches.ideal, ExactRecovery.delete, + usefulByTriple_target, hx, hy, hz] + split_ifs <;> simp_all + +omit [DecidableEq H] in +theorem ideal_eq_canonicalIdeal (e : Target counts) + (x y z : RawPairs counts L R) : + ideal counts L R T coarse sl sr νl νr ηl ηr e x y z = + canonicalIdeal counts L R T coarse sl sr νl νr ηl ηr + (pairEquiv counts L R e x) (pairEquiv counts L R e y) + (pairEquiv counts L R e z) := by + simp only [ideal, canonicalIdeal, ExactRecovery.delete, rawWindows_iff_childWindows, + coarseIdeal_eq_canonicalBase] + +theorem ideal_restrict + [∀ h, Fintype (L h)] [∀ h, Fintype (R h)] (e : Target counts) : + Tensor.restrict (coordinateMatrix counts L R e) (coordinateMatrix counts L R e) + (coordinateMatrix counts L R e) (ideal counts L R T coarse sl sr νl νr ηl ηr e) = + canonicalIdeal counts L R T coarse sl sr νl νr ηl ηr := by + funext x y z + rw [coordinateMatrix_restrict] + simp only [ideal, canonicalIdeal, ExactRecovery.delete, rawWindows_iff_childWindows, + coarseIdeal_eq_canonicalBase, Equiv.apply_symm_apply] + +end ChildWindows + +end Coefficients + +end MatrixMultiplication.JointCanonicalization + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/JointExtraction/CapacityAlgebra.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/JointExtraction/CapacityAlgebra.lean new file mode 100644 index 0000000000000000000000000000000000000000..5b410c696ca61e70bad45088dcc44d2863fa59b5 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/JointExtraction/CapacityAlgebra.lean @@ -0,0 +1,29 @@ +import OAI.LinearAlgebra.MatrixMultiplication.JointExtraction.EntropyMax + +namespace OAI + +/-! Joint tensor extraction, compatibility and entropy estimates. -/ + +namespace MatrixMultiplication.JointCapacityAlgebra + +open scoped BigOperators + +theorem total_sub_max_degrees (A X Y Z : ℝ) : + A - max (A - X) (max (A - Y) (A - Z)) = min X (min Y Z) := by + simp only [max_def, min_def] + split_ifs <;> linarith + +theorem weighted_joint_capacity {H : Type*} [Fintype H] + (mass entropy : H → ℝ) (capacity : H → Fin 3 → ℝ) : + (∑ h, mass h * entropy h) - + max (∑ h, mass h * (entropy h - capacity h 0)) + (max (∑ h, mass h * (entropy h - capacity h 1)) + (∑ h, mass h * (entropy h - capacity h 2))) = + min (∑ h, mass h * capacity h 0) + (min (∑ h, mass h * capacity h 1) (∑ h, mass h * capacity h 2)) := by + simp_rw [mul_sub, Finset.sum_sub_distrib] + exact total_sub_max_degrees _ _ _ _ + +end MatrixMultiplication.JointCapacityAlgebra + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/JointExtraction/CoarseAssignment.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/JointExtraction/CoarseAssignment.lean new file mode 100644 index 0000000000000000000000000000000000000000..bc036295218e2349cb5b059b5b06bfad64092c5a --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/JointExtraction/CoarseAssignment.lean @@ -0,0 +1,113 @@ +import OAI.LinearAlgebra.MatrixMultiplication.JointExtraction.Extraction + +namespace OAI + +/-! Joint tensor extraction, compatibility and entropy estimates. -/ + +noncomputable section + +namespace MatrixMultiplication.JointCoarseAssignment + +open MatrixMultiplication.Foundation JointExtraction + +attribute [local instance] Classical.propDecidable + +variable {F X Y Z A B C I V : Type*} [CommSemiring F] + +abbrev Triple (A B C : Type*) := A × B × C + +def survives (hx : A → Prop) (hy : B → Prop) (hz : C → Prop) + (e : Triple A B C) : Prop := hx e.1 ∧ hy e.2.1 ∧ hz e.2.2 + +def eligible (ambient targets : Finset (Triple A B C)) + (hx : A → Prop) (hy : B → Prop) (hz : C → Prop) : Finset (Triple A B C) := + ambient.filter fun e => e ∈ targets ∧ survives hx hy hz e ∧ + ∀ f ∈ ambient, survives hx hy hz f → f.1 = e.1 → f = e + +theorem mem_eligible_iff (ambient targets : Finset (Triple A B C)) + (hx : A → Prop) (hy : B → Prop) (hz : C → Prop) (e : Triple A B C) : + e ∈ eligible ambient targets hx hy hz ↔ + e ∈ ambient ∧ e ∈ targets ∧ survives hx hy hz e ∧ + ∀ f ∈ ambient, survives hx hy hz f → f.1 = e.1 → f = e := by + simp [eligible] + +def assignUseful (eligible : Finset I) (compatible useful : I → V → Prop) + (v : V) : Option I := + retainAssignment (uniqueAssignment eligible compatible) + (fun v => ∃ i, uniqueAssignment eligible compatible v = some i ∧ useful i v) v + +theorem assignUseful_spec (eligible : Finset I) (compatible useful : I → V → Prop) + (v : V) (i : I) (h : assignUseful eligible compatible useful v = some i) : + i ∈ eligible ∧ compatible i v ∧ useful i v ∧ + ∀ j, j ∈ eligible → compatible j v → j = i := by + classical + have hu : uniqueAssignment eligible compatible v = some i := + retainAssignment_some _ _ v i h + have hh := uniqueAssignment_spec eligible compatible v i hu + have huse : useful i v := by + unfold assignUseful retainAssignment at h + split_ifs at h with hk + obtain ⟨j, hj, hju⟩ := hk + have hji : j = i := Option.some.inj (hj.symm.trans hu) + exact hji ▸ hju + exact ⟨hh.1, hh.2.1, huse, hh.2.2⟩ + +def assignments (ambient targets : Finset (Triple A B C)) + (hx : A → Prop) (hy : B → Prop) (hz : C → Prop) + (cx : X → A) (cy : Y → B) (cz : Z → C) + (compatibleY : Triple A B C → Y → Prop) + (compatibleZ : Triple A B C → Z → Prop) + (usefulX : Triple A B C → X → Prop) + (usefulY : Triple A B C → Y → Prop) + (usefulZ : Triple A B C → Z → Prop) : Assignment X Y Z (Triple A B C) where + x := assignUseful (eligible ambient targets hx hy hz) (fun e x => cx x = e.1) usefulX + y := assignUseful (eligible ambient targets hx hy hz) + (fun e y => cy y = e.2.1 ∧ compatibleY e y) usefulY + z := assignUseful (eligible ambient targets hx hy hz) + (fun e z => cz z = e.2.2 ∧ compatibleZ e z) usefulZ + +theorem assignments_coherent + (T : Tensor F X Y Z) (ambient targets : Finset (Triple A B C)) + (hx : A → Prop) (hy : B → Prop) (hz : C → Prop) + (cx : X → A) (cy : Y → B) (cz : Z → C) + (compatibleY : Triple A B C → Y → Prop) + (compatibleZ : Triple A B C → Z → Prop) + (usefulX : Triple A B C → X → Prop) + (usefulY : Triple A B C → Y → Prop) + (usefulZ : Triple A B C → Z → Prop) + (support : ∀ x y z, T x y z ≠ 0 → (cx x, cy y, cz z) ∈ ambient) + (transferY : ∀ x y z e, T x y z ≠ 0 → (cx x, cy y, cz z) = e → + usefulX e x → compatibleY e y) + (transferZ : ∀ x y z e, T x y z ≠ 0 → (cx x, cy y, cz z) = e → + usefulX e x → usefulY e y → compatibleZ e z) : + Coherent T (assignments ambient targets hx hy hz cx cy cz + compatibleY compatibleZ usefulX usefulY usefulZ) := by + intro x y z i j k hT hxi hyj hzk + have hi := assignUseful_spec (eligible ambient targets hx hy hz) + (fun e x => cx x = e.1) usefulX x i hxi + have hj := assignUseful_spec (eligible ambient targets hx hy hz) + (fun e y => cy y = e.2.1 ∧ compatibleY e y) usefulY y j hyj + have hk := assignUseful_spec (eligible ambient targets hx hy hz) + (fun e z => cz z = e.2.2 ∧ compatibleZ e z) usefulZ z k hzk + have hie := (mem_eligible_iff ambient targets hx hy hz i).mp hi.1 + have hje := (mem_eligible_iff ambient targets hx hy hz j).mp hj.1 + have hke := (mem_eligible_iff ambient targets hx hy hz k).mp hk.1 + have hs : survives hx hy hz (cx x, cy y, cz z) := + ⟨hi.2.1.symm ▸ hie.2.2.1.1, hj.2.1.1.symm ▸ hje.2.2.1.2.1, + hk.2.1.1.symm ▸ hke.2.2.1.2.2⟩ + have he : (cx x, cy y, cz z) = i := + hie.2.2.2 _ (support x y z hT) hs hi.2.1 + have hyi : cy y = i.2.1 := congrArg (fun e : Triple A B C => e.2.1) he + have hzi : cz z = i.2.2 := congrArg (fun e : Triple A B C => e.2.2) he + have hij : i = j := hj.2.2.2 i hi.1 + ⟨hyi, transferY x y z i hT he hi.2.2.1⟩ + have huy : usefulY i y := hij.symm ▸ hj.2.2.1 + have hik : i = k := hk.2.2.2 i hi.1 + ⟨hzi, transferZ x y z i hT he hi.2.2.1 huy⟩ + exact ⟨hij, hik⟩ + +end MatrixMultiplication.JointCoarseAssignment + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/JointExtraction/CoarseHashing.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/JointExtraction/CoarseHashing.lean new file mode 100644 index 0000000000000000000000000000000000000000..86fc760b4d53807a3279e64b9c284a310d23a9c7 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/JointExtraction/CoarseHashing.lean @@ -0,0 +1,232 @@ +import OAI.LinearAlgebra.MatrixMultiplication.JointExtraction.Hashing +import OAI.LinearAlgebra.MatrixMultiplication.JointExtraction.LossCounts + +namespace OAI + +/-! Joint tensor extraction, compatibility and entropy estimates. -/ + +noncomputable section + +namespace MatrixMultiplication.JointCoarseHashing + +attribute [local instance] Classical.propDecidable + +abbrev Word (P : Type*) := P → Fin 17 +abbrev Triple (P : Type*) := Word P × Word P × Word P + +variable {P : Type*} + +def HasSupportSum (S : P → ℕ) (e : Triple P) : Prop := + ∀ p, (e.1 p).val + (e.2.1 p).val + (e.2.2 p).val = S p + +theorem eq_of_shared_xy (S : P → ℕ) (e f : Triple P) + (he : HasSupportSum S e) (hf : HasSupportSum S f) + (hx : e.1 = f.1) (hy : e.2.1 = f.2.1) : e = f := by + have hz : e.2.2 = f.2.2 := by + funext p + apply Fin.ext + have he' := he p + have hf' := hf p + rw [hx, hy] at he' + omega + exact Prod.ext hx (Prod.ext hy hz) + +theorem eq_of_shared_xz (S : P → ℕ) (e f : Triple P) + (he : HasSupportSum S e) (hf : HasSupportSum S f) + (hx : e.1 = f.1) (hz : e.2.2 = f.2.2) : e = f := by + have hy : e.2.1 = f.2.1 := by + funext p + apply Fin.ext + have he' := he p + have hf' := hf p + rw [hx, hz] at he' + omega + exact Prod.ext hx (Prod.ext hy hz) + +theorem eq_of_shared_yz (S : P → ℕ) (e f : Triple P) + (he : HasSupportSum S e) (hf : HasSupportSum S f) + (hy : e.2.1 = f.2.1) (hz : e.2.2 = f.2.2) : e = f := by + have hx : e.1 = f.1 := by + funext p + apply Fin.ext + have he' := he p + have hf' := hf p + rw [hy, hz] at he' + omega + exact Prod.ext hx (Prod.ext hy hz) + +def castWord (k : ℕ) (w : Word P) : P → ZMod (37 ^ k) := + fun p => (w p).val + +def twoUnit (k : ℕ) : (ZMod (37 ^ k))ˣ := + (JointHashing.small_nat_isUnit k 2 (by decide) (by decide)).unit + +theorem twoUnit_coe (k : ℕ) : (twoUnit k : ZMod (37 ^ k)) = 2 := by + exact (JointHashing.small_nat_isUnit k 2 (by decide) (by decide)).unit_spec + +theorem supportSum_cast (k : ℕ) (S : P → ℕ) (e : Triple P) + (he : HasSupportSum S e) : + castWord k e.1 + castWord k e.2.1 + castWord k e.2.2 = + fun p => (S p : ZMod (37 ^ k)) := by + funext p + have h := congrArg (fun n : ℕ => (n : ZMod (37 ^ k))) (he p) + simpa only [Nat.cast_add, Pi.add_apply, castWord] using h + +theorem shared_z_cast_sum (k : ℕ) (S : P → ℕ) (e f : Triple P) + (he : HasSupportSum S e) (hf : HasSupportSum S f) + (hz : f.2.2 = e.2.2) : + castWord k f.1 + castWord k f.2.1 = castWord k e.1 + castWord k e.2.1 := by + have h := (supportSum_cast k S f hf).trans (supportSum_cast k S e he).symm + rw [hz] at h + exact add_right_cancel h + +section FiniteHashing + +variable [Fintype P] + +abbrev Sample (P : Type*) (k : ℕ) := JointHashing.Sample P (ZMod (37 ^ k)) + +def Survives (k : ℕ) (U : Finset (ZMod (37 ^ k))) (e : Triple P) (s : Sample P k) : Prop := + JointHashing.Survives (U : Set (ZMod (37 ^ k))) (castWord k e.1) (castWord k e.2.1) s + +theorem full_survival_iff (k : ℕ) (U : Finset (ZMod (37 ^ k))) + (hAP : ∀ x ∈ U, ∀ y ∈ U, ∀ z ∈ U, x + y = 2 * z → x = z ∧ y = z) + (S : P → ℕ) (e : Triple P) (he : HasSupportSum S e) (s : Sample P k) : + (JointHashing.xHash s (castWord k e.1) ∈ U ∧ + JointHashing.yHash s (castWord k e.2.1) ∈ U ∧ + JointHashing.zHash (twoUnit k) s (fun p => (S p : ZMod (37 ^ k))) + (castWord k e.2.2) ∈ U) ↔ Survives k U e s := by + exact JointHashing.full_survival_iff (twoUnit k) (twoUnit_coe k) + (U : Set (ZMod (37 ^ k))) hAP s (castWord k e.1) (castWord k e.2.1) + (castWord k e.2.2) (fun p => (S p : ZMod (37 ^ k))) (supportSum_cast k S e he) + +theorem survival_card (k : ℕ) (U : Finset (ZMod (37 ^ k))) (e : Triple P) : + Fintype.card {s : Sample P k // Survives k U e s} = + (37 ^ k) ^ Fintype.card P * U.card := by + have h := JointHashing.survival_card U (castWord k e.1) (castWord k e.2.1) + simp only [Survives, ZMod.card] at h ⊢ + refine Eq.trans ?_ h + exact Fintype.card_congr (Equiv.refl _) + +theorem shared_x_card_mul (k : ℕ) (U : Finset (ZMod (37 ^ k))) + (S : P → ℕ) (e f : Triple P) (he : HasSupportSum S e) (hf : HasSupportSum S f) + (hne : f ≠ e) (hx : f.1 = e.1) : + (37 ^ k) * Fintype.card {s : Sample P k // Survives k U e s ∧ Survives k U f s} = + Fintype.card {s : Sample P k // Survives k U e s} := by + classical + have hy : f.2.1 ≠ e.2.1 := fun hy => hne (eq_of_shared_xy S f e hf he hx hy) + obtain ⟨i, hi⟩ := JointHashing.coarse_words_unit_coordinate k f.2.1 e.2.1 hy + have h := JointHashing.shared_x_collision_card_mul U (castWord k e.1) + (castWord k e.2.1) (castWord k f.2.1) i hi.unit hi.unit_spec.symm + simp only [Survives, hx, ZMod.card] at h ⊢ + refine Eq.trans ?_ (Eq.trans h ?_) + · exact congrArg (fun n : ℕ => 37 ^ k * n) (Fintype.card_congr (Equiv.refl _)) + · exact Fintype.card_congr (Equiv.refl _) + +theorem shared_y_card_mul (k : ℕ) (U : Finset (ZMod (37 ^ k))) + (S : P → ℕ) (e f : Triple P) (he : HasSupportSum S e) (hf : HasSupportSum S f) + (hne : f ≠ e) (hy : f.2.1 = e.2.1) : + (37 ^ k) * Fintype.card {s : Sample P k // Survives k U e s ∧ Survives k U f s} = + Fintype.card {s : Sample P k // Survives k U e s} := by + classical + have hx : f.1 ≠ e.1 := fun hx => hne (eq_of_shared_xy S f e hf he hx hy) + obtain ⟨i, hi⟩ := JointHashing.coarse_words_unit_coordinate k f.1 e.1 hx + have h := JointHashing.shared_y_collision_card_mul U (castWord k e.1) + (castWord k f.1) (castWord k e.2.1) i hi.unit hi.unit_spec.symm + simp only [Survives, hy, ZMod.card] at h ⊢ + refine Eq.trans ?_ (Eq.trans h ?_) + · exact congrArg (fun n : ℕ => 37 ^ k * n) (Fintype.card_congr (Equiv.refl _)) + · exact Fintype.card_congr (Equiv.refl _) + +theorem shared_z_card_mul (k : ℕ) (U : Finset (ZMod (37 ^ k))) + (S : P → ℕ) (e f : Triple P) (he : HasSupportSum S e) (hf : HasSupportSum S f) + (hne : f ≠ e) (hz : f.2.2 = e.2.2) : + (37 ^ k) * Fintype.card {s : Sample P k // Survives k U e s ∧ Survives k U f s} = + Fintype.card {s : Sample P k // Survives k U e s} := by + classical + have hx : f.1 ≠ e.1 := fun hx => hne (eq_of_shared_xz S f e hf he hx hz) + obtain ⟨i, hi⟩ := JointHashing.coarse_words_unit_coordinate k f.1 e.1 hx + have h := JointHashing.shared_z_collision_card_mul (twoUnit k) (twoUnit_coe k) + U (castWord k e.1) (castWord k f.1) (castWord k e.2.1) (castWord k f.2.1) + (shared_z_cast_sum k S e f he hf hz) i hi.unit hi.unit_spec.symm + simp only [Survives, ZMod.card] at h ⊢ + refine Eq.trans ?_ (Eq.trans h ?_) + · exact congrArg (fun n : ℕ => 37 ^ k * n) (Fintype.card_congr (Equiv.refl _)) + · exact Fintype.card_congr (Equiv.refl _) + +def SharesSide (e f : Triple P) : Prop := + f.1 = e.1 ∨ f.2.1 = e.2.1 ∨ f.2.2 = e.2.2 + +theorem pair_survival_card_mul (k : ℕ) (U : Finset (ZMod (37 ^ k))) + (S : P → ℕ) (e f : Triple P) (he : HasSupportSum S e) (hf : HasSupportSum S f) + (hne : f ≠ e) (hshare : SharesSide e f) : + (37 ^ k) * Fintype.card {s : Sample P k // Survives k U e s ∧ Survives k U f s} = + Fintype.card {s : Sample P k // Survives k U e s} := by + rcases hshare with hx | hy | hz + · exact shared_x_card_mul k U S e f he hf hne hx + · exact shared_y_card_mul k U S e f he hf hne hy + · exact shared_z_card_mul k U S e f he hf hne hz + +def ownEvent (k : ℕ) (U : Finset (ZMod (37 ^ k))) (e : Triple P) : Finset (Sample P k) := + Finset.univ.filter (Survives k U e) + +theorem ownEvent_card (k : ℕ) (U : Finset (ZMod (37 ^ k))) (e : Triple P) : + (ownEvent k U e).card = (37 ^ k) ^ Fintype.card P * U.card := by + simpa only [ownEvent, Fintype.card_subtype] using survival_card k U e + +theorem pair_event_card_mul (k : ℕ) (U : Finset (ZMod (37 ^ k))) + (S : P → ℕ) (e f : Triple P) (he : HasSupportSum S e) (hf : HasSupportSum S f) + (hne : f ≠ e) (hshare : SharesSide e f) : + (37 ^ k) * ((ownEvent k U e).filter (Survives k U f)).card = (ownEvent k U e).card := by + simpa only [ownEvent, Finset.filter_filter, Fintype.card_subtype] using + pair_survival_card_mul k U S e f he hf hne hshare + +theorem competitor_union_card_mul_le (k : ℕ) (U : Finset (ZMod (37 ^ k))) + (S : P → ℕ) (e : Triple P) (he : HasSupportSum S e) (competitors : Finset (Triple P)) + (hf : ∀ f ∈ competitors, HasSupportSum S f) + (hne : ∀ f ∈ competitors, f ≠ e) + (hshare : ∀ f ∈ competitors, SharesSide e f) : + (37 ^ k) * ((ownEvent k U e).filter + (fun s => ∃ f ∈ competitors, Survives k U f s)).card ≤ + competitors.card * (ownEvent k U e).card := by + apply JointLossCounts.competitor_union_card_mul_le + intro f hf' + exact (pair_event_card_mul k U S e f he (hf f hf') (hne f hf') (hshare f hf')).le + +theorem competitor_union_card_le (k : ℕ) (U : Finset (ZMod (37 ^ k))) + (S : P → ℕ) (e : Triple P) (he : HasSupportSum S e) (competitors : Finset (Triple P)) + (hf : ∀ f ∈ competitors, HasSupportSum S f) + (hne : ∀ f ∈ competitors, f ≠ e) + (hshare : ∀ f ∈ competitors, SharesSide e f) : + (((ownEvent k U e).filter (fun s => ∃ f ∈ competitors, Survives k U f s)).card : ℝ) ≤ + ((competitors.card : ℝ) / ((37 ^ k : ℕ) : ℝ)) * ((ownEvent k U e).card : ℝ) := by + have hM : (0 : ℝ) < ((37 ^ k : ℕ) : ℝ) := by + exact_mod_cast (pow_pos (by decide : 0 < (37 : ℕ)) k) + have h := competitor_union_card_mul_le k U S e he competitors hf hne hshare + have hR : ((37 ^ k : ℕ) : ℝ) * + (((ownEvent k U e).filter (fun s => ∃ f ∈ competitors, Survives k U f s)).card : ℝ) ≤ + (competitors.card : ℝ) * ((ownEvent k U e).card : ℝ) := by exact_mod_cast h + rw [div_mul_eq_mul_div] + exact (le_div_iff₀ hM).2 (by simpa only [mul_comm] using hR) + +theorem pair_survival_fraction (k : ℕ) (U : Finset (ZMod (37 ^ k))) (hU : U.Nonempty) + (S : P → ℕ) (e f : Triple P) (he : HasSupportSum S e) (hf : HasSupportSum S f) + (hne : f ≠ e) (hshare : SharesSide e f) : + (((ownEvent k U e).filter (Survives k U f)).card : ℝ) / ((ownEvent k U e).card : ℝ) = + 1 / ((37 ^ k : ℕ) : ℝ) := by + have hM : (0 : ℕ) < 37 ^ k := pow_pos (by decide) k + have hS : 0 < (ownEvent k U e).card := by + rw [ownEvent_card] + exact Nat.mul_pos (pow_pos hM _) (Finset.card_pos.mpr hU) + apply (div_eq_div_iff (by exact_mod_cast Nat.ne_of_gt hS) + (by exact_mod_cast Nat.ne_of_gt hM)).2 + have h := congrArg (fun n : ℕ => (n : ℝ)) (pair_event_card_mul k U S e f he hf hne hshare) + simpa only [Nat.cast_mul, one_mul, mul_comm] using h + +end FiniteHashing + +end MatrixMultiplication.JointCoarseHashing + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/JointExtraction/CoarseReorder.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/JointExtraction/CoarseReorder.lean new file mode 100644 index 0000000000000000000000000000000000000000..3608cb2bb058086a268498f574445eadcf46aec2 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/JointExtraction/CoarseReorder.lean @@ -0,0 +1,46 @@ +import OAI.LinearAlgebra.MatrixMultiplication.JointExtraction.CoarseHashing +import Mathlib.Tactic.FinCases + +namespace OAI + +/-! Joint tensor extraction, compatibility and entropy estimates. -/ + +noncomputable section +namespace MatrixMultiplication.JointCoarseReorder +open JointCoarseHashing +open scoped BigOperators +attribute [local instance] Classical.propDecidable + +def tripleSide {P : Type*} (s : Fin 3) (t : Triple P) : Word P := + ![t.1, t.2.1, t.2.2] s + +def reorder {P : Type*} (sigma : Equiv.Perm (Fin 3)) (t : Triple P) : Triple P := + (tripleSide (sigma 0) t, tripleSide (sigma 1) t, tripleSide (sigma 2) t) + +@[simp] theorem tripleSide_reorder {P : Type*} (sigma : Equiv.Perm (Fin 3)) + (t : Triple P) (s : Fin 3) : + tripleSide s (reorder sigma t) = tripleSide (sigma s) t := by + fin_cases s <;> rfl + +theorem reorder_injective {P : Type*} (sigma : Equiv.Perm (Fin 3)) : + Function.Injective (reorder (P := P) sigma) := by + intro t u h + have hs (s : Fin 3) : tripleSide s t = tripleSide s u := by + have hh := congrArg (tripleSide (sigma.symm s)) h + simpa only [tripleSide_reorder, sigma.apply_symm_apply] using hh + exact Prod.ext (hs 0) (Prod.ext (hs 1) (hs 2)) + +theorem reorder_support {P : Type*} (sigma : Equiv.Perm (Fin 3)) (S : P → ℕ) + (t : Triple P) (ht : HasSupportSum S t) : HasSupportSum S (reorder sigma t) := by + intro p + have hsum : (∑ i : Fin 3, (tripleSide (sigma i) t p).val) = + ∑ i : Fin 3, (tripleSide i t p).val := + Equiv.sum_comp sigma (fun i : Fin 3 => (tripleSide i t p).val) + simpa [reorder, tripleSide, Fin.sum_univ_succ, Nat.add_assoc] using hsum.trans (by + simpa [tripleSide, Fin.sum_univ_succ, Nat.add_assoc] using ht p) + +end MatrixMultiplication.JointCoarseReorder + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/JointExtraction/CompatibilityControls.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/JointExtraction/CompatibilityControls.lean new file mode 100644 index 0000000000000000000000000000000000000000..28a3aca35ab24411712892248302384819378bed --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/JointExtraction/CompatibilityControls.lean @@ -0,0 +1,293 @@ +import OAI.LinearAlgebra.MatrixMultiplication.JointExtraction.CompatibilityIncidence +import OAI.LinearAlgebra.MatrixMultiplication.Entropy.ComplexEntropyContinuity +import Mathlib.Tactic.Linarith + +namespace OAI + +/-! Joint tensor extraction, compatibility and entropy estimates. -/ + +noncomputable section + +open scoped BigOperators +open MatrixMultiplication.Foundation +open MatrixMultiplication.JointTypeCounts MatrixMultiplication.JointCompatibilityIncidence + +namespace MatrixMultiplication.JointCompatibilityControls + +attribute [local instance] Classical.propDecidable + +private theorem exists_pos_le_family {K : Type*} [Fintype K] + (δ : K → ℝ) (hδ : ∀ k, 0 < δ k) : + ∃ ε : ℝ, 0 < ε ∧ ∀ k, ε ≤ δ k := by + classical + have aux : ∀ s : Finset K, ∃ ε : ℝ, 0 < ε ∧ ∀ k ∈ s, ε ≤ δ k := by + intro s + induction s using Finset.induction_on with + | empty => exact ⟨1, zero_lt_one, by simp⟩ + | @insert k s hk ih => + obtain ⟨ε, hε, hb⟩ := ih + refine ⟨min (δ k) ε, lt_min (hδ k) hε, ?_⟩ + intro j hj + rcases Finset.mem_insert.mp hj with rfl | hj + · exact min_le_left _ _ + · exact (min_le_right _ _).trans (hb j hj) + obtain ⟨ε, hε, hb⟩ := aux Finset.univ + exact ⟨ε, hε, fun k => hb k (Finset.mem_univ k)⟩ + +variable {C : Type*} [Fintype C] [DecidableEq C] + {Shape A : C → Type*} + [∀ c, Fintype (Shape c)] [∀ c, DecidableEq (Shape c)] + [∀ c, Fintype (A c)] [∀ c, DecidableEq (A c)] + +def residualBase (base : ∀ c, Shape c → ℕ) (d : ∀ c, Shape c → Prop) (c : C) : ℕ := + ∑ u : {u : Shape c // ¬d c u}, base c u.val + +def designatedBase (base : ∀ c, Shape c → ℕ) (d : ∀ c, Shape c → Prop) (c : C) : ℕ := + ∑ u : {u : Shape c // d c u}, base c u.val + +def totalCenterCount (base : ∀ c, Shape c → ℕ) + (law : ∀ c, Shape c → A c → ℝ) (c : C) (a : A c) : ℝ := + ∑ u, (base c u : ℝ) * law c u a + +def residualCenter (base : ∀ c, Shape c → ℕ) (d : ∀ c, Shape c → Prop) + (law : ∀ c, Shape c → A c → ℝ) (c : C) (a : A c) : ℝ := + (∑ u : {u : Shape c // ¬d c u}, (base c u.val : ℝ) * law c u.val a) / + residualBase base d c + +omit [Fintype C] [DecidableEq C] [∀ c, DecidableEq (Shape c)] + [∀ c, Fintype (A c)] [∀ c, DecidableEq (A c)] in +theorem residualBase_mul_center (base : ∀ c, Shape c → ℕ) (d : ∀ c, Shape c → Prop) + (law : ∀ c, Shape c → A c → ℝ) (c : C) (a : A c) : + (residualBase base d c : ℝ) * residualCenter base d law c a = + ∑ u : {u : Shape c // ¬d c u}, (base c u.val : ℝ) * law c u.val a := by + by_cases hr : residualBase base d c = 0 + · have hb (u : {u : Shape c // ¬d c u}) : base c u.val = 0 := by + have hle : base c u.val ≤ residualBase base d c := + Finset.single_le_sum + (f := fun v : {u : Shape c // ¬d c u} => base c v.val) + (fun _ _ => Nat.zero_le _) (Finset.mem_univ u) + rw [hr] at hle + exact Nat.eq_zero_of_le_zero hle + simp only [hr, Nat.cast_zero, zero_mul, hb, Finset.sum_const_zero] + · exact mul_div_cancel₀ _ (Nat.cast_ne_zero.mpr hr) + +omit [Fintype C] [DecidableEq C] [∀ c, DecidableEq (Shape c)] + [∀ c, Fintype (A c)] [∀ c, DecidableEq (A c)] in +theorem residualCenter_nonneg (base : ∀ c, Shape c → ℕ) (d : ∀ c, Shape c → Prop) + (law : ∀ c, Shape c → A c → ℝ) (h0 : ∀ c u a, 0 ≤ law c u a) + (c : C) (a : A c) : 0 ≤ residualCenter base d law c a := + div_nonneg (Finset.sum_nonneg fun shape _ => + mul_nonneg (Nat.cast_nonneg _) (h0 c shape.val a)) + (Nat.cast_nonneg _) + +omit [Fintype C] [DecidableEq C] [∀ c, DecidableEq (Shape c)] + [∀ c, Fintype (A c)] [∀ c, DecidableEq (A c)] in +theorem residualCenter_le_one (base : ∀ c, Shape c → ℕ) (d : ∀ c, Shape c → Prop) + (law : ∀ c, Shape c → A c → ℝ) (h1 : ∀ c u a, law c u a ≤ 1) + (c : C) (a : A c) : residualCenter base d law c a ≤ 1 := by + by_cases hr : residualBase base d c = 0 + · simp only [residualCenter, hr, Nat.cast_zero, div_zero, zero_le_one] + · have hp : (0 : ℝ) < residualBase base d c := Nat.cast_pos.mpr (Nat.pos_of_ne_zero hr) + apply (div_le_iff₀ hp).mpr + calc + (∑ u : {u : Shape c // ¬d c u}, (base c u.val : ℝ) * law c u.val a) ≤ + ∑ u : {u : Shape c // ¬d c u}, (base c u.val : ℝ) * 1 := + Finset.sum_le_sum fun u _ => mul_le_mul_of_nonneg_left (h1 _ _ _) (Nat.cast_nonneg _) + _ = 1 * (residualBase base d c : ℝ) := by + simp only [mul_one, one_mul, residualBase, Nat.cast_sum] + +def groupCenter (base : ∀ c, Shape c → ℕ) (d : ∀ c, Shape c → Prop) + (law : ∀ c, Shape c → A c → ℝ) (g : Σ c, Option (Shape c)) : A g.1 → ℝ := + match g.2 with + | some u => law g.1 u + | none => residualCenter base d law g.1 + +def groupCap (base : ∀ c, Shape c → ℕ) (d : ∀ c, Shape c → Prop) + (law : ∀ c, Shape c → A c → ℝ) (ε : ℝ) (g : Σ c, Option (Shape c)) : ℝ := + finiteEntropy (groupCenter base d law g) + ε + +omit [Fintype C] [DecidableEq C] [∀ c, DecidableEq (Shape c)] + [∀ c, DecidableEq (A c)] in +theorem groupCap_nonneg (base : ∀ c, Shape c → ℕ) (d : ∀ c, Shape c → Prop) + (law : ∀ c, Shape c → A c → ℝ) + (h0 : ∀ c u a, 0 ≤ law c u a) (h1 : ∀ c u a, law c u a ≤ 1) + {ε : ℝ} (hε : 0 ≤ ε) (g : Σ c, Option (Shape c)) : + 0 ≤ groupCap base d law ε g := by + apply add_nonneg _ hε + rcases g with ⟨c, k⟩ + cases k with + | some u => + exact finiteEntropy_nonneg (law c u) (h0 c u) (h1 c u) + | none => + exact finiteEntropy_nonneg (residualCenter base d law c) + (residualCenter_nonneg base d law h0 c) (residualCenter_le_one base d law h1 c) + +omit [DecidableEq C] [∀ c, DecidableEq (Shape c)] [∀ c, DecidableEq (A c)] in +private theorem exists_group_entropy_window (base : ∀ c, Shape c → ℕ) + (d : ∀ c, Shape c → Prop) (law : ∀ c, Shape c → A c → ℝ) + {ε : ℝ} (hε : 0 < ε) : + ∃ δ : ℝ, 0 < δ ∧ ∀ (g : Σ c, Option (Shape c)) (q : A g.1 → ℝ), + (∀ a, |q a - groupCenter base d law g a| ≤ δ) → + finiteEntropy q ≤ groupCap base d law ε g := by + have hex : ∀ g : Σ c, Option (Shape c), ∃ δ : ℝ, 0 < δ ∧ + ∀ q : A g.1 → ℝ, (∀ a, |q a - groupCenter base d law g a| ≤ δ) → + |finiteEntropy q - finiteEntropy (groupCenter base d law g)| < ε := + fun g => exists_entropy_window (groupCenter base d law g) hε + choose δ hδ hw using hex + obtain ⟨δ₀, hδ₀, hsmall⟩ := exists_pos_le_family δ hδ + refine ⟨δ₀, hδ₀, ?_⟩ + intro g q hq + have hh := (abs_lt.mp (hw g q (fun a => (hq a).trans (hsmall g)))).2 + change finiteEntropy q ≤ finiteEntropy (groupCenter base d law g) + ε + linarith + +omit [Fintype C] [DecidableEq C] in +theorem residual_card_repeated + {Pos : C → Type*} [∀ c, Fintype (Pos c)] [∀ c, DecidableEq (Pos c)] + (base : ∀ c, Shape c → ℕ) (d : ∀ c, Shape c → Prop) (t : ℕ) + (w : FixedClassWords Pos Shape (fun c u => t * base c u)) (c : C) : + Fintype.card {i : Pos c // ¬d c ((w c).val i)} = t * residualBase base d c := by + have he := (Fintype.card_congr (Equiv.sigmaSubtypeFiberEquivSubtype (w c).val + (p := fun i => ¬d c ((w c).val i)) (q := fun u => ¬d c u) + (fun _ => Iff.rfl))).symm + have hc : Fintype.card {i : Pos c // ¬d c ((w c).val i)} = + ∑ u : {u : Shape c // ¬d c u}, wordPopulation (w c).val u.val := by + simpa only [Fintype.card_sigma, wordPopulation] using he + exact hc.trans (by simp only [(w c).property, residualBase, Finset.mul_sum]) + +omit [Fintype C] [DecidableEq C] [∀ c, Fintype (A c)] [∀ c, DecidableEq (A c)] in +theorem repeated_mixture_balance + {Pos : C → Type*} [∀ c, Fintype (Pos c)] [∀ c, DecidableEq (Pos c)] + (base : ∀ c, Shape c → ℕ) (d : ∀ c, Shape c → Prop) + (law : ∀ c, Shape c → A c → ℝ) (t : ℕ) + (w : FixedClassWords Pos Shape (fun c u => t * base c u)) (c : C) (a : A c) : + (Fintype.card {i : Pos c // ¬d c ((w c).val i)} : ℝ) * residualCenter base d law c a = + (t : ℝ) * totalCenterCount base law c a - + ∑ u : {u : Shape c // d c u}, (t * base c u.val : ℕ) * law c u.val a := by + have hsplit := Fintype.sum_subtype_add_sum_subtype (d c) + (fun u => (base c u : ℝ) * law c u a) + have hb : (∑ u : {u : Shape c // ¬d c u}, (base c u.val : ℝ) * law c u.val a) = + totalCenterCount base law c a - + ∑ u : {u : Shape c // d c u}, (base c u.val : ℝ) * law c u.val a := by + unfold totalCenterCount + linarith + rw [residual_card_repeated, Nat.cast_mul, mul_assoc, residualBase_mul_center, hb] + simp only [Nat.cast_mul, mul_sub, Finset.mul_sum, mul_assoc] + +omit [Fintype C] [DecidableEq C] in +private theorem repeated_residual_width_le + {Pos : C → Type*} [∀ c, Fintype (Pos c)] [∀ c, DecidableEq (Pos c)] + (base : ∀ c, Shape c → ℕ) (d : ∀ c, Shape c → Prop) + (t : ℕ) (w : FixedClassWords Pos Shape (fun c u => t * base c u)) + (χ η δ : ℝ) (hδ : 0 ≤ δ) + (hnum : ∀ c, η + (designatedBase base d c : ℝ) * χ ≤ δ) (c : C) : + ((t : ℝ) * η + (∑ u : {u : Shape c // d c u}, ((t * base c u.val : ℕ) : ℝ)) * χ) / + Fintype.card {i : Pos c // ¬d c ((w c).val i)} ≤ δ := by + have hsum : (∑ u : {u : Shape c // d c u}, ((t * base c u.val : ℕ) : ℝ)) = + (t : ℝ) * designatedBase base d c := by + simp only [Nat.cast_mul, designatedBase, Nat.cast_sum, Finset.mul_sum] + rw [residual_card_repeated, hsum, Nat.cast_mul] + by_cases ht : t = 0 + · simpa only [ht, Nat.cast_zero, zero_mul, add_zero, zero_add, zero_div] using hδ + by_cases hr : residualBase base d c = 0 + · simpa only [hr, Nat.cast_zero, mul_zero, div_zero] using hδ + have htpos : (0 : ℝ) < t := Nat.cast_pos.mpr (Nat.pos_of_ne_zero ht) + have hrpos : (0 : ℝ) < residualBase base d c := Nat.cast_pos.mpr (Nat.pos_of_ne_zero hr) + have hrone : (1 : ℝ) ≤ residualBase base d c := by exact_mod_cast Nat.one_le_iff_ne_zero.mpr hr + have hres : η + (designatedBase base d c : ℝ) * χ ≤ δ * residualBase base d c := + (hnum c).trans (by simpa only [mul_one] using mul_le_mul_of_nonneg_left hrone hδ) + apply (div_le_iff₀ (mul_pos htpos hrpos)).mpr + calc + (t : ℝ) * η + ((t : ℝ) * designatedBase base d c) * χ = + (t : ℝ) * (η + (designatedBase base d c : ℝ) * χ) := by ring + _ ≤ (t : ℝ) * (δ * residualBase base d c) := + mul_le_mul_of_nonneg_left hres htpos.le + _ = δ * ((t : ℝ) * residualBase base d c) := by ring + +omit [DecidableEq C] in +theorem exists_uniform_sideEntropyControl + (Pos : ℕ → C → Type*) [∀ t c, Fintype (Pos t c)] [∀ t c, DecidableEq (Pos t c)] + (Pair : C → Type*) [∀ c, Fintype (Pair c)] [∀ c, DecidableEq (Pair c)] + (base : ∀ c, Shape c → ℕ) (d : ∀ c, Shape c → Prop) + (law : ∀ c, Shape c → A c → ℝ) (part : ∀ c, Pair c → A c) + (h0 : ∀ c u a, 0 ≤ law c u a) (h1 : ∀ c u a, law c u a ≤ 1) + {ε χMax ηMax : ℝ} (hε : 0 < ε) (hχMax : 0 < χMax) (hηMax : 0 < ηMax) : + ∃ χ η : ℝ, 0 < χ ∧ χ ≤ χMax ∧ 0 < η ∧ η ≤ ηMax ∧ + ∀ (t : ℕ) (pairCounts : ∀ c, Pair c → ℕ) + (w : FixedClassWords (Pos t) Shape (fun c u => t * base c u)), + (∀ c a, |((∑ s : {s : Pair c // part c s = a}, pairCounts c s.val : ℕ) : ℝ) - + (t : ℝ) * totalCenterCount base law c a| ≤ (t : ℝ) * η) → + Nonempty (SideEntropyControl (Pos t) Shape Pair A (fun c u => t * base c u) + pairCounts part d law χ (groupCap base d law ε) w) := by + obtain ⟨δ, hδ, hwindow⟩ := exists_group_entropy_window base d law hε + let D : ℕ := ∑ c, designatedBase base d c + have hD : (0 : ℝ) ≤ D := Nat.cast_nonneg _ + have hden : 0 < 2 * ((D : ℝ) + 1) := by positivity + let χ₀ : ℝ := δ / (2 * ((D : ℝ) + 1)) + have hχ₀ : 0 < χ₀ := div_pos hδ hden + have heq : (2 * ((D : ℝ) + 1)) * χ₀ = δ := mul_div_cancel₀ _ hden.ne' + have hχδ : χ₀ ≤ δ := by nlinarith [mul_nonneg hD hχ₀.le] + have hDχ : (D : ℝ) * χ₀ ≤ δ / 2 := by nlinarith + let χ := min χMax χ₀ + let η := min ηMax (δ / 2) + have hχ : 0 < χ := lt_min hχMax hχ₀ + have hη : 0 < η := lt_min hηMax (half_pos hδ) + have hχδ' : χ ≤ δ := (min_le_right _ _).trans hχδ + have hnum (c : C) : η + (designatedBase base d c : ℝ) * χ ≤ δ := by + have hc : (designatedBase base d c : ℝ) ≤ D := by + exact_mod_cast (Finset.single_le_sum (fun _ _ => Nat.zero_le _) + (Finset.mem_univ c) : designatedBase base d c ≤ ∑ c, designatedBase base d c) + have hm : (designatedBase base d c : ℝ) * χ ≤ (D : ℝ) * χ₀ := + mul_le_mul hc (min_le_right _ _) hχ.le hD + have he : η ≤ δ / 2 := min_le_right _ _ + linarith + refine ⟨χ, η, hχ, min_le_left _ _, hη, min_le_left _ _, ?_⟩ + intro t pairCounts w haggr + refine ⟨{ + residualLaw := residualCenter base d law + totalTarget := fun c a => (t : ℝ) * totalCenterCount base law c a + totalError := fun _ => (t : ℝ) * η + aggregate_window := haggr + mixture_balance := repeated_mixture_balance base d law t w + nonneg := groupCap_nonneg base d law h0 h1 hε.le + designated_entropy := ?_ + residual_entropy := ?_ }⟩ + · intro c u _ q hq + exact hwindow ⟨c, some u⟩ q (fun a => (hq a).trans hχδ') + · intro c q hq + exact hwindow ⟨c, none⟩ q (fun a => (hq a).trans + (repeated_residual_width_le base d t w χ η δ hδ.le hnum c)) + +def control_mono_width + {Pos Pair : C → Type*} + [∀ c, Fintype (Pos c)] [∀ c, DecidableEq (Pos c)] + [∀ c, Fintype (Pair c)] [∀ c, DecidableEq (Pair c)] + (shapeCounts : ∀ c, Shape c → ℕ) (pairCounts : ∀ c, Pair c → ℕ) + (part : ∀ c, Pair c → A c) (d : ∀ c, Shape c → Prop) + (law : ∀ c, Shape c → A c → ℝ) {χ χ' : ℝ} + (H : (Σ c, Option (Shape c)) → ℝ) + (w : FixedClassWords Pos Shape shapeCounts) + (control : SideEntropyControl Pos Shape Pair A shapeCounts pairCounts part d law χ H w) + (hχ : χ' ≤ χ) : + SideEntropyControl Pos Shape Pair A shapeCounts pairCounts part d law χ' H w where + residualLaw := control.residualLaw + totalTarget := control.totalTarget + totalError := control.totalError + aggregate_window := control.aggregate_window + mixture_balance := control.mixture_balance + nonneg := control.nonneg + designated_entropy c u hu q hq := + control.designated_entropy c u hu q (fun a => (hq a).trans hχ) + residual_entropy c q hq := by + apply control.residual_entropy c q + intro a + apply (hq a).trans + apply div_le_div_of_nonneg_right _ (Nat.cast_nonneg _) + apply add_le_add_right + exact mul_le_mul_of_nonneg_left hχ (Finset.sum_nonneg fun _ _ => Nat.cast_nonneg _) + +end MatrixMultiplication.JointCompatibilityControls + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/JointExtraction/CompatibilityCountProducer.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/JointExtraction/CompatibilityCountProducer.lean new file mode 100644 index 0000000000000000000000000000000000000000..d078b958bc267960260e47ec22f5c4c02d50abf0 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/JointExtraction/CompatibilityCountProducer.lean @@ -0,0 +1,365 @@ +import OAI.LinearAlgebra.MatrixMultiplication.JointExtraction.CompatibilityRateLimit +import OAI.LinearAlgebra.MatrixMultiplication.JointExtraction.CompatibilityControls + +namespace OAI + +/-! Joint tensor extraction, compatibility and entropy estimates. -/ + +noncomputable section + +namespace MatrixMultiplication.JointCompatibilityCountProducer + +open MatrixMultiplication.Foundation JointTypeCounts JointCompatibilityIncidence +open JointCompatibilityControls JointCompatibilityScaling JointCompatibilityRateLimit Filter +open scoped BigOperators Topology + +attribute [local instance] Classical.propDecidable + +private theorem exists_pos_le_family {K : Type*} [Fintype K] + (δ : K → ℝ) (hδ : ∀ k, 0 < δ k) : + ∃ ε : ℝ, 0 < ε ∧ ∀ k, ε ≤ δ k := by + classical + have aux : ∀ s : Finset K, ∃ ε : ℝ, 0 < ε ∧ ∀ k ∈ s, ε ≤ δ k := by + intro s + induction s using Finset.induction_on with + | empty => exact ⟨1, zero_lt_one, by simp⟩ + | @insert k s hk ih => + obtain ⟨ε, hε, hb⟩ := ih + refine ⟨min (δ k) ε, lt_min (hδ k) hε, ?_⟩ + intro j hj + rcases Finset.mem_insert.mp hj with rfl | hj + · exact min_le_left _ _ + · exact (min_le_right _ _).trans (hb j hj) + obtain ⟨ε, hε, hb⟩ := aux Finset.univ + exact ⟨ε, hε, fun k => hb k (Finset.mem_univ k)⟩ + +variable {C : Type*} [Fintype C] [DecidableEq C] + {Shape A : C → Type*} + [∀ c, Fintype (Shape c)] [∀ c, DecidableEq (Shape c)] + [∀ c, Fintype (A c)] [∀ c, DecidableEq (A c)] + +omit [DecidableEq C] [∀ c, DecidableEq (Shape c)] [∀ c, DecidableEq (A c)] in +private theorem exists_group_entropy_window (base : ∀ c, Shape c → ℕ) + (d : ∀ c, Shape c → Prop) (law : ∀ c, Shape c → A c → ℝ) + {ε : ℝ} (hε : 0 < ε) : + ∃ δ : ℝ, 0 < δ ∧ ∀ (g : Σ c, Option (Shape c)) (q : A g.1 → ℝ), + (∀ a, |q a - groupCenter base d law g a| ≤ δ) → + finiteEntropy q ≤ groupCap base d law ε g := by + have hex : ∀ g : Σ c, Option (Shape c), ∃ δ : ℝ, 0 < δ ∧ + ∀ q : A g.1 → ℝ, (∀ a, |q a - groupCenter base d law g a| ≤ δ) → + |finiteEntropy q - finiteEntropy (groupCenter base d law g)| < ε := + fun g => exists_entropy_window (groupCenter base d law g) hε + choose δ hδ hw using hex + obtain ⟨δ₀, hδ₀, hsmall⟩ := exists_pos_le_family δ hδ + refine ⟨δ₀, hδ₀, ?_⟩ + intro g q hq + have hh := (abs_lt.mp (hw g q (fun a => (hq a).trans (hsmall g)))).2 + change finiteEntropy q ≤ finiteEntropy (groupCenter base d law g) + ε + linarith + +omit [Fintype C] [DecidableEq C] in +private theorem repeated_residual_width_le + {Pos : C → Type*} [∀ c, Fintype (Pos c)] [∀ c, DecidableEq (Pos c)] + (base : ∀ c, Shape c → ℕ) (d : ∀ c, Shape c → Prop) + (t : ℕ) (w : FixedClassWords Pos Shape (fun c u => t * base c u)) + (χ η δ : ℝ) (hδ : 0 ≤ δ) + (hnum : ∀ c, η + (designatedBase base d c : ℝ) * χ ≤ δ) (c : C) : + ((t : ℝ) * η + (∑ u : {u : Shape c // d c u}, ((t * base c u.val : ℕ) : ℝ)) * χ) / + Fintype.card {i : Pos c // ¬d c ((w c).val i)} ≤ δ := by + have hsum : (∑ u : {u : Shape c // d c u}, ((t * base c u.val : ℕ) : ℝ)) = + (t : ℝ) * designatedBase base d c := by + simp only [Nat.cast_mul, designatedBase, Nat.cast_sum, Finset.mul_sum] + rw [residual_card_repeated, hsum, Nat.cast_mul] + by_cases ht : t = 0 + · simpa only [ht, Nat.cast_zero, zero_mul, add_zero, zero_add, zero_div] using hδ + by_cases hr : residualBase base d c = 0 + · simpa only [hr, Nat.cast_zero, mul_zero, div_zero] using hδ + have htpos : (0 : ℝ) < t := Nat.cast_pos.mpr (Nat.pos_of_ne_zero ht) + have hrpos : (0 : ℝ) < residualBase base d c := Nat.cast_pos.mpr (Nat.pos_of_ne_zero hr) + have hrone : (1 : ℝ) ≤ residualBase base d c := by exact_mod_cast Nat.one_le_iff_ne_zero.mpr hr + have hres : η + (designatedBase base d c : ℝ) * χ ≤ δ * residualBase base d c := + (hnum c).trans (by simpa only [mul_one] using mul_le_mul_of_nonneg_left hrone hδ) + apply (div_le_iff₀ (mul_pos htpos hrpos)).mpr + calc + (t : ℝ) * η + ((t : ℝ) * designatedBase base d c) * χ = + (t : ℝ) * (η + (designatedBase base d c : ℝ) * χ) := by ring + _ ≤ (t : ℝ) * (δ * residualBase base d c) := + mul_le_mul_of_nonneg_left hres htpos.le + _ = δ * ((t : ℝ) * residualBase base d c) := by ring + +omit [DecidableEq C] in +theorem exists_uniform_sideEntropyControl_all_positions + (Pair : C → Type*) [∀ c, Fintype (Pair c)] [∀ c, DecidableEq (Pair c)] + (base : ∀ c, Shape c → ℕ) (d : ∀ c, Shape c → Prop) + (law : ∀ c, Shape c → A c → ℝ) (part : ∀ c, Pair c → A c) + (h0 : ∀ c u a, 0 ≤ law c u a) (h1 : ∀ c u a, law c u a ≤ 1) + {ε χMax ηMax : ℝ} (hε : 0 < ε) (hχMax : 0 < χMax) (hηMax : 0 < ηMax) : + ∃ χ η : ℝ, 0 < χ ∧ χ ≤ χMax ∧ 0 < η ∧ η ≤ ηMax ∧ + ∀ (t : ℕ) (Pos : C → Type*) [∀ c, Fintype (Pos c)] [∀ c, DecidableEq (Pos c)] + (pairCounts : ∀ c, Pair c → ℕ) + (w : FixedClassWords Pos Shape (fun c u => t * base c u)), + (∀ c a, |((∑ s : {s : Pair c // part c s = a}, pairCounts c s.val : ℕ) : ℝ) - + (t : ℝ) * totalCenterCount base law c a| ≤ (t : ℝ) * η) → + Nonempty (SideEntropyControl Pos Shape Pair A (fun c u => t * base c u) + pairCounts part d law χ (groupCap base d law ε) w) := by + obtain ⟨δ, hδ, hwindow⟩ := exists_group_entropy_window base d law hε + let D : ℕ := ∑ c, designatedBase base d c + have hD : (0 : ℝ) ≤ D := Nat.cast_nonneg _ + have hden : 0 < 2 * ((D : ℝ) + 1) := by positivity + let χ₀ : ℝ := δ / (2 * ((D : ℝ) + 1)) + have hχ₀ : 0 < χ₀ := div_pos hδ hden + have heq : (2 * ((D : ℝ) + 1)) * χ₀ = δ := mul_div_cancel₀ _ hden.ne' + have hχδ : χ₀ ≤ δ := by nlinarith [mul_nonneg hD hχ₀.le] + have hDχ : (D : ℝ) * χ₀ ≤ δ / 2 := by nlinarith + let χ := min χMax χ₀ + let η := min ηMax (δ / 2) + have hχ : 0 < χ := lt_min hχMax hχ₀ + have hη : 0 < η := lt_min hηMax (half_pos hδ) + have hχδ' : χ ≤ δ := (min_le_right _ _).trans hχδ + have hnum (c : C) : η + (designatedBase base d c : ℝ) * χ ≤ δ := by + have hc : (designatedBase base d c : ℝ) ≤ D := by + exact_mod_cast (Finset.single_le_sum (fun _ _ => Nat.zero_le _) + (Finset.mem_univ c) : designatedBase base d c ≤ ∑ c, designatedBase base d c) + have hm : (designatedBase base d c : ℝ) * χ ≤ (D : ℝ) * χ₀ := + mul_le_mul hc (min_le_right _ _) hχ.le hD + have he : η ≤ δ / 2 := min_le_right _ _ + linarith + refine ⟨χ, η, hχ, min_le_left _ _, hη, min_le_left _ _, ?_⟩ + intro t Pos _ _ pairCounts w haggr + refine ⟨{ + residualLaw := residualCenter base d law + totalTarget := fun c a => (t : ℝ) * totalCenterCount base law c a + totalError := fun _ => (t : ℝ) * η + aggregate_window := haggr + mixture_balance := repeated_mixture_balance base d law t w + nonneg := groupCap_nonneg base d law h0 h1 hε.le + designated_entropy := ?_ + residual_entropy := ?_ }⟩ + · intro c u _ q hq + exact hwindow ⟨c, some u⟩ q (fun a => (hq a).trans hχδ') + · intro c q hq + exact hwindow ⟨c, none⟩ q (fun a => (hq a).trans + (repeated_residual_width_le base d t w χ η δ hδ.le hnum c)) + +section PairMarginals + +variable {Pair : C → Type*} + [∀ c, Fintype (Pair c)] [∀ c, DecidableEq (Pair c)] + +def aggregateCoefficient (base : ∀ c, Shape c → ℕ) + (Pair : C → Type*) [∀ c, Fintype (Pair c)] : ℕ := + ∑ c, baseSize base c * Fintype.card (Pair c) + +omit [DecidableEq C] [∀ c, Fintype (A c)] in +theorem aggregate_error_of_pairWindow + (base : ∀ c, Shape c → ℕ) (q : ∀ c, Pair c → ℝ) + (law : ∀ c, Shape c → A c → ℝ) (part : ∀ c, Pair c → A c) + (hbalance : ∀ c a, (baseSize base c : ℝ) * + (∑ b : {b : Pair c // part c b = a}, q c b.val) = totalCenterCount base law c a) + (t : ℕ) (ht : 0 < t) (Pos : C → Type*) + [∀ c, Fintype (Pos c)] [∀ c, DecidableEq (Pos c)] + (pairCounts : ∀ c, Pair c → ℕ) + (w : FixedClassWords Pos Shape (fun c u => t * base c u)) + (z : FixedClassWords Pos Pair pairCounts) {η : ℝ} (hη : 0 ≤ η) + (hp : PairWindow base q Pos pairCounts η) (c : C) (a : A c) : + |((∑ b : {b : Pair c // part c b = a}, pairCounts c b.val : ℕ) : ℝ) - + (t : ℝ) * totalCenterCount base law c a| ≤ + (t : ℝ) * (aggregateCoefficient base Pair : ℝ) * η := by + by_cases hz : baseSize base c = 0 + · have hsum : (∑ b, pairCounts c b) = 0 := by + rw [← JointCompatibilityEntropyBound.fixedClassWords_size Pos Pair pairCounts z c, + repeated_positions_card Pos base t w c, hz, Nat.mul_zero] + have hcount (b : Pair c) : pairCounts c b = 0 := + Nat.eq_zero_of_le_zero ((Finset.single_le_sum (fun _ _ => Nat.zero_le _) + (Finset.mem_univ b)).trans_eq hsum) + have hcenter : totalCenterCount base law c a = 0 := by + rw [← hbalance c a, hz, Nat.cast_zero, zero_mul] + simpa only [hcount, Finset.sum_const_zero, Nat.cast_zero, hcenter, mul_zero, + sub_self, abs_zero] using + mul_nonneg (mul_nonneg (Nat.cast_nonneg t) + (Nat.cast_nonneg (aggregateCoefficient base Pair))) hη + have hb : 0 < baseSize base c := Nat.pos_of_ne_zero hz + have hn : (0 : ℝ) < Fintype.card (Pos c) := by + rw [repeated_positions_card Pos base t w c, Nat.cast_mul] + exact mul_pos (Nat.cast_pos.mpr ht) (Nat.cast_pos.mpr hb) + have hcoord (b : Pair c) : + |(pairCounts c b : ℝ) - (t : ℝ) * (baseSize base c : ℝ) * q c b| ≤ + (t : ℝ) * (baseSize base c : ℝ) * η := by + have heq : (Fintype.card (Pos c) : ℝ) * + ((pairCounts c b : ℝ) / Fintype.card (Pos c) - q c b) = + (pairCounts c b : ℝ) - (Fintype.card (Pos c) : ℝ) * q c b := by + rw [mul_sub, mul_div_cancel₀ _ hn.ne'] + have h := calc + |(pairCounts c b : ℝ) - (Fintype.card (Pos c) : ℝ) * q c b| = + |(Fintype.card (Pos c) : ℝ) * + ((pairCounts c b : ℝ) / Fintype.card (Pos c) - q c b)| := + congrArg abs heq.symm + _ = (Fintype.card (Pos c) : ℝ) * + |(pairCounts c b : ℝ) / Fintype.card (Pos c) - q c b| := by + rw [abs_mul, abs_of_pos hn] + _ ≤ (Fintype.card (Pos c) : ℝ) * η := + mul_le_mul_of_nonneg_left (hp c hb b) hn.le + simpa only [repeated_positions_card Pos base t w c, Nat.cast_mul] using h + have hm := marginal_coordinate_error + (fun b : {b : Pair c // part c b = a} => (pairCounts c b.val : ℝ)) + (fun b => (t : ℝ) * (baseSize base c : ℝ) * q c b.val) + ((t : ℝ) * (baseSize base c : ℝ) * η) (fun b => hcoord b.val) + have hsum : (∑ b : {b : Pair c // part c b = a}, + (t : ℝ) * (baseSize base c : ℝ) * q c b.val) = + (t : ℝ) * totalCenterCount base law c a := by + rw [← Finset.mul_sum, mul_assoc, hbalance c a] + have hm' : + |((∑ b : {b : Pair c // part c b = a}, pairCounts c b.val : ℕ) : ℝ) - + (t : ℝ) * totalCenterCount base law c a| ≤ + (Fintype.card {b : Pair c // part c b = a} : ℝ) * + ((t : ℝ) * (baseSize base c : ℝ) * η) := by + simpa only [Nat.cast_sum, hsum] using hm + have hKnat : baseSize base c * Fintype.card {b : Pair c // part c b = a} ≤ + aggregateCoefficient base Pair := + (Nat.mul_le_mul_left _ (Fintype.card_subtype_le _)).trans + (Finset.single_le_sum + (f := fun d => baseSize base d * Fintype.card (Pair d)) + (fun _ _ => Nat.zero_le _) (Finset.mem_univ c)) + have hK : (baseSize base c : ℝ) * + (Fintype.card {b : Pair c // part c b = a} : ℝ) ≤ + (aggregateCoefficient base Pair : ℝ) := by exact_mod_cast hKnat + have hmul := mul_le_mul_of_nonneg_left hK (mul_nonneg (Nat.cast_nonneg t) hη) + nlinarith + +end PairMarginals + +section CountProducer + +variable {Pair Left Right : C → Type*} + [∀ c, Fintype (Pair c)] [∀ c, DecidableEq (Pair c)] + [∀ c, Fintype (Left c)] [∀ c, DecidableEq (Left c)] + [∀ c, Fintype (Right c)] [∀ c, DecidableEq (Right c)] + +theorem exists_widths_eventually_count_le + (base : ∀ c, Shape c → ℕ) (q : ∀ c, Pair c → ℝ) + (leftPart : ∀ c, Pair c → Left c) (rightPart : ∀ c, Pair c → Right c) + (designatedLeft designatedRight : ∀ c, Shape c → Prop) + (leftLaw : ∀ c, Shape c → Left c → ℝ) + (rightLaw : ∀ c, Shape c → Right c → ℝ) + (hparts : ∀ c, Function.Injective (fun a : Pair c => (leftPart c a, rightPart c a))) + (hL0 : ∀ c u a, 0 ≤ leftLaw c u a) (hL1 : ∀ c u a, leftLaw c u a ≤ 1) + (hR0 : ∀ c u a, 0 ≤ rightLaw c u a) (hR1 : ∀ c u a, rightLaw c u a ≤ 1) + (hleft : ∀ c a, (baseSize base c : ℝ) * + (∑ b : {b : Pair c // leftPart c b = a}, q c b.val) = + totalCenterCount base leftLaw c a) + (hright : ∀ c a, (baseSize base c : ℝ) * + (∑ b : {b : Pair c // rightPart c b = a}, q c b.val) = + totalCenterCount base rightLaw c a) + {ε χMax ηMax : ℝ} (hε : 0 < ε) (hχMax : 0 < χMax) (hηMax : 0 < ηMax) : + ∃ χ η : ℝ, 0 < χ ∧ χ ≤ χMax ∧ 0 < η ∧ η ≤ ηMax ∧ + ∀ᶠ t : ℕ in atTop, + ∀ (Pos : C → Type*) [∀ c, Fintype (Pos c)] [∀ c, DecidableEq (Pos c)] + (pairCounts : ∀ c, Pair c → ℕ) + (_ : FixedClassWords Pos Shape (fun c u => t * base c u)) + (z : FixedClassWords Pos Pair pairCounts), + PairWindow base q Pos pairCounts η → + (compatibleCandidateCount Pos Shape Pair Left Right (fun c u => t * base c u) + pairCounts leftPart rightPart designatedLeft designatedRight leftLaw rightLaw χ z : ℝ) ≤ + Real.exp ((t : ℝ) * + (compatibilityRate base q designatedLeft designatedRight + (groupCap base designatedLeft leftLaw 0) + (groupCap base designatedRight rightLaw 0) + ε)) ∧ + (0 < compatibleCandidateCount Pos Shape Pair Left Right (fun c u => t * base c u) + pairCounts leftPart rightPart designatedLeft designatedRight leftLaw rightLaw χ z → + Real.log (compatibleCandidateCount Pos Shape Pair Left Right (fun c u => t * base c u) + pairCounts leftPart rightPart designatedLeft designatedRight leftLaw rightLaw χ z : ℝ) / + (t : ℝ) ≤ compatibilityRate base q designatedLeft designatedRight + (groupCap base designatedLeft leftLaw 0) + (groupCap base designatedRight rightLaw 0) + ε) := by + let δ : ℝ := ε / (4 * ((totalBase base : ℝ) + 1)) + have hden : 0 < 4 * ((totalBase base : ℝ) + 1) := by positivity + have hδ : 0 < δ := div_pos hε hden + have hδeq : (4 * ((totalBase base : ℝ) + 1)) * δ = ε := + mul_div_cancel₀ _ hden.ne' + have hδbound : 2 * (totalBase base : ℝ) * δ ≤ ε / 2 := by nlinarith + obtain ⟨χL, ηL, hχL, hχLMax, hηL, _, hCL⟩ := + exists_uniform_sideEntropyControl_all_positions Pair base designatedLeft leftLaw leftPart + hL0 hL1 (ηMax := 1) hδ hχMax zero_lt_one + obtain ⟨χR, ηR, hχR, hχRMax, hηR, _, hCR⟩ := + exists_uniform_sideEntropyControl_all_positions Pair base designatedRight rightLaw rightPart + hR0 hR1 (ηMax := 1) hδ hχMax zero_lt_one + let χ := min χL χR + have hχ : 0 < χ := lt_min hχL hχR + have hχMax' : χ ≤ χMax := (min_le_left _ _).trans hχLMax + let K : ℕ := aggregateCoefficient base Pair + have hKden : (0 : ℝ) < (K : ℝ) + 1 := by positivity + let ηUpper : ℝ := min ηMax (min ηL ηR / ((K : ℝ) + 1)) + have hηUpper : 0 < ηUpper := lt_min hηMax (div_pos (lt_min hηL hηR) hKden) + obtain ⟨η, hη, hηUpper', hbound⟩ := exists_window_eventually_count_le + base q leftPart rightPart designatedLeft designatedRight leftLaw rightLaw hparts + (groupCap base designatedLeft leftLaw δ) (groupCap base designatedRight rightLaw δ) + (half_pos hε) hηUpper + have hηMax' : η ≤ ηMax := hηUpper'.trans (min_le_left _ _) + have hηscale : (K : ℝ) * η ≤ min ηL ηR := by + have hle : η ≤ min ηL ηR / ((K : ℝ) + 1) := + hηUpper'.trans (min_le_right _ _) + have hmul := (le_div_iff₀ hKden).mp hle + nlinarith + have hrate : + compatibilityRate base q designatedLeft designatedRight + (groupCap base designatedLeft leftLaw δ) (groupCap base designatedRight rightLaw δ) + + ε / 2 ≤ + compatibilityRate base q designatedLeft designatedRight + (groupCap base designatedLeft leftLaw 0) (groupCap base designatedRight rightLaw 0) + ε := by + have heq := compatibilityRate_add_caps base q designatedLeft designatedRight + (groupCap base designatedLeft leftLaw 0) (groupCap base designatedRight rightLaw 0) δ + have hcapL : (fun g => groupCap base designatedLeft leftLaw 0 g + δ) = + groupCap base designatedLeft leftLaw δ := by + funext g + simp only [groupCap, add_zero] + have hcapR : (fun g => groupCap base designatedRight rightLaw 0 g + δ) = + groupCap base designatedRight rightLaw δ := by + funext g + simp only [groupCap, add_zero] + rw [hcapL, hcapR] at heq + linarith only [heq, hδbound] + refine ⟨χ, η, hχ, hχMax', hη, hηMax', ?_⟩ + filter_upwards [hbound, eventually_ge_atTop (1 : ℕ)] with t hb ht + intro Pos _ _ pairCounts w z hp + have htpos : 0 < t := lt_of_lt_of_le Nat.zero_lt_one ht + have haggrL : ∀ c a, + |((∑ b : {b : Pair c // leftPart c b = a}, pairCounts c b.val : ℕ) : ℝ) - + (t : ℝ) * totalCenterCount base leftLaw c a| ≤ (t : ℝ) * ηL := by + intro c a + have h := aggregate_error_of_pairWindow base q leftLaw leftPart hleft + t htpos Pos pairCounts w z hη.le hp c a + have hscale := mul_le_mul_of_nonneg_left + (hηscale.trans (min_le_left _ _)) (Nat.cast_nonneg t) + change _ ≤ (t : ℝ) * (K : ℝ) * η at h + nlinarith + have haggrR : ∀ c a, + |((∑ b : {b : Pair c // rightPart c b = a}, pairCounts c b.val : ℕ) : ℝ) - + (t : ℝ) * totalCenterCount base rightLaw c a| ≤ (t : ℝ) * ηR := by + intro c a + have h := aggregate_error_of_pairWindow base q rightLaw rightPart hright + t htpos Pos pairCounts w z hη.le hp c a + have hscale := mul_le_mul_of_nonneg_left + (hηscale.trans (min_le_right _ _)) (Nat.cast_nonneg t) + change _ ≤ (t : ℝ) * (K : ℝ) * η at h + nlinarith + obtain ⟨controlL⟩ := hCL t Pos pairCounts w haggrL + obtain ⟨controlR⟩ := hCR t Pos pairCounts w haggrR + have controlL' := control_mono_width (fun c u => t * base c u) pairCounts + leftPart designatedLeft leftLaw (groupCap base designatedLeft leftLaw δ) w + controlL (show χ ≤ χL from min_le_left _ _) + have controlR' := control_mono_width (fun c u => t * base c u) pairCounts + rightPart designatedRight rightLaw (groupCap base designatedRight rightLaw δ) w + controlR (show χ ≤ χR from min_le_right _ _) + have hcount := hb Pos pairCounts w z χ hp controlL' controlR' + refine ⟨hcount.1.trans (Real.exp_le_exp.mpr + (mul_le_mul_of_nonneg_left hrate (Nat.cast_nonneg t))), ?_⟩ + intro hpos + exact (hcount.2 hpos).trans hrate + +end CountProducer + +end MatrixMultiplication.JointCompatibilityCountProducer + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/JointExtraction/CompatibilityEntropyBound.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/JointExtraction/CompatibilityEntropyBound.lean new file mode 100644 index 0000000000000000000000000000000000000000..996e26fee13266866c7ab068aadb5ebcdd615149 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/JointExtraction/CompatibilityEntropyBound.lean @@ -0,0 +1,221 @@ +import OAI.LinearAlgebra.MatrixMultiplication.JointExtraction.CompatibilityIncidence + +namespace OAI + +/-! Joint tensor extraction, compatibility and entropy estimates. -/ + +noncomputable section + +open MatrixMultiplication.Foundation +open MatrixMultiplication.JointTypeCounts MatrixMultiplication.JointCompatibilityIncidence +open scoped BigOperators + +namespace MatrixMultiplication.JointCompatibilityEntropyBound + +attribute [local instance] Classical.propDecidable + +section ClassCounts + +variable {C : Type*} [Fintype C] [DecidableEq C] +variable (Pos A : C → Type*) + [∀ c, Fintype (Pos c)] [∀ c, DecidableEq (Pos c)] + [∀ c, Fintype (A c)] [∀ c, DecidableEq (A c)] + +def classEntropy (counts : ∀ c, A c → ℕ) : ℝ := + ∑ c, (Fintype.card (Pos c) : ℝ) * + finiteEntropy (fun a => (counts c a : ℝ) / Fintype.card (Pos c)) + +def classTypeError : ℝ := + ∑ c, ((Fintype.card (A c) : ℝ) + 1) * + (1 + Real.log (Fintype.card (Pos c) + 1 : ℕ)) + +omit [Fintype C] [DecidableEq C] [∀ index, DecidableEq (Pos index)] in +theorem fixedClassWords_size (counts : ∀ c, A c → ℕ) + (w : FixedClassWords Pos A counts) (c : C) : + Fintype.card (Pos c) = ∑ a, counts c a := by + calc + Fintype.card (Pos c) = ∑ a, wordPopulation (w c).val a := + (wordPopulation_sum (w c).val).symm + _ = ∑ a, counts c a := Finset.sum_congr rfl fun a _ => (w c).property a + +theorem abs_log_card_sub_classEntropy_le (counts : ∀ c, A c → ℕ) + (w : FixedClassWords Pos A counts) : + |Real.log (Fintype.card (FixedClassWords Pos A counts) : ℝ) - + classEntropy Pos A counts| ≤ classTypeError Pos A := by + have hsize := fixedClassWords_size Pos A counts w + simpa only [classEntropy, classTypeError, ← hsize] using + abs_log_fixedClassWords_card_sub_entropy_le Pos A counts hsize + +theorem fixedClassWords_card_le_exp (counts : ∀ c, A c → ℕ) + (w : FixedClassWords Pos A counts) : + (Fintype.card (FixedClassWords Pos A counts) : ℝ) ≤ + Real.exp (classEntropy Pos A counts + classTypeError Pos A) := by + have hpos : 0 < (Fintype.card (FixedClassWords Pos A counts) : ℝ) := by + exact_mod_cast (Fintype.card_pos_iff.mpr ⟨w⟩) + have h := (abs_le.mp (abs_log_card_sub_classEntropy_le Pos A counts w)).2 + calc + (Fintype.card (FixedClassWords Pos A counts) : ℝ) = + Real.exp (Real.log (Fintype.card (FixedClassWords Pos A counts) : ℝ)) := + (Real.exp_log hpos).symm + _ ≤ Real.exp (classEntropy Pos A counts + classTypeError Pos A) := + Real.exp_le_exp.mpr (by linarith) + +theorem exp_le_fixedClassWords_card (counts : ∀ c, A c → ℕ) + (w : FixedClassWords Pos A counts) : + Real.exp (classEntropy Pos A counts - classTypeError Pos A) ≤ + (Fintype.card (FixedClassWords Pos A counts) : ℝ) := by + have hpos : 0 < (Fintype.card (FixedClassWords Pos A counts) : ℝ) := by + exact_mod_cast (Fintype.card_pos_iff.mpr ⟨w⟩) + have h := (abs_le.mp (abs_log_card_sub_classEntropy_le Pos A counts w)).1 + calc + Real.exp (classEntropy Pos A counts - classTypeError Pos A) ≤ + Real.exp (Real.log (Fintype.card (FixedClassWords Pos A counts) : ℝ)) := + Real.exp_le_exp.mpr (by linarith) + _ = (Fintype.card (FixedClassWords Pos A counts) : ℝ) := Real.exp_log hpos + +end ClassCounts + +section GroupCounts + +def wordTypeError (I A : Type*) [Fintype I] [Fintype A] : ℝ := + ((Fintype.card A : ℝ) + 1) * (1 + Real.log (Fintype.card I + 1 : ℕ)) + + (Fintype.card A : ℝ) * Real.log (Fintype.card I + 1 : ℕ) + +theorem wordEntropyBound_eq_exp (I A : Type*) [Fintype I] [Fintype A] (H : ℝ) : + wordEntropyBound I A H = + Real.exp ((Fintype.card I : ℝ) * H + wordTypeError I A) := by + unfold wordEntropyBound wordTypeError + rw [show (Fintype.card I : ℝ) * H + + (((Fintype.card A : ℝ) + 1) * (1 + Real.log (Fintype.card I + 1 : ℕ)) + + (Fintype.card A : ℝ) * Real.log (Fintype.card I + 1 : ℕ)) = + (Fintype.card A : ℝ) * Real.log (Fintype.card I + 1 : ℕ) + + ((Fintype.card I : ℝ) * H + ((Fintype.card A : ℝ) + 1) * + (1 + Real.log (Fintype.card I + 1 : ℕ))) by ring] + conv_rhs => rw [Real.exp_add, Real.exp_nat_mul, Real.exp_log (by positivity)] + simp only [Nat.cast_add, Nat.cast_one] + +variable {C : Type*} [Fintype C] [DecidableEq C] +variable (Pos Shape A : C → Type*) + [∀ c, Fintype (Pos c)] [∀ c, DecidableEq (Pos c)] + [∀ c, Fintype (Shape c)] [∀ c, DecidableEq (Shape c)] + [∀ c, Fintype (A c)] [∀ c, DecidableEq (A c)] +variable (counts : ∀ c, Shape c → ℕ) + (designated : ∀ c, Shape c → Prop) + (H : (Σ c, Option (Shape c)) → ℝ) + (w : FixedClassWords Pos Shape counts) + +def groupedEntropy : ℝ := + ∑ g : Σ c, Option (Shape c), + (Fintype.card (GroupPos (w g.1).val (designated g.1) g.2) : ℝ) * H g + +def groupedTypeError : ℝ := + ∑ g : Σ c, Option (Shape c), + wordTypeError (GroupPos (w g.1).val (designated g.1) g.2) (A g.1) + +omit [DecidableEq C] [∀ index, DecidableEq (Pos index)] + [∀ index, DecidableEq (A index)] in +theorem prod_wordEntropyBound_eq_exp : + (∏ g : Σ c, Option (Shape c), wordEntropyBound + (GroupPos (w g.1).val (designated g.1) g.2) (A g.1) (H g)) = + Real.exp (groupedEntropy Pos Shape counts designated H w + + groupedTypeError Pos Shape A counts designated w) := by + simp only [wordEntropyBound_eq_exp, groupedEntropy, groupedTypeError, + ← Real.exp_sum, Finset.sum_add_distrib] + +end GroupCounts + +section Compatibility + +variable {C : Type*} [Fintype C] [DecidableEq C] +variable (Pos Shape Pair Left Right : C → Type*) + [∀ c, Fintype (Pos c)] [∀ c, DecidableEq (Pos c)] + [∀ c, Fintype (Shape c)] [∀ c, DecidableEq (Shape c)] + [∀ c, Fintype (Pair c)] [∀ c, DecidableEq (Pair c)] + [∀ c, Fintype (Left c)] [∀ c, DecidableEq (Left c)] + [∀ c, Fintype (Right c)] [∀ c, DecidableEq (Right c)] +variable (shapeCounts : ∀ c, Shape c → ℕ) (pairCounts : ∀ c, Pair c → ℕ) + (leftPart : ∀ c, Pair c → Left c) (rightPart : ∀ c, Pair c → Right c) + (designatedLeft designatedRight : ∀ c, Shape c → Prop) + (leftLaw : ∀ c, Shape c → Left c → ℝ) + (rightLaw : ∀ c, Shape c → Right c → ℝ) (χ : ℝ) + +def compatibilityExponent (HL HR : (Σ c, Option (Shape c)) → ℝ) + (w : FixedClassWords Pos Shape shapeCounts) : ℝ := + classEntropy Pos Shape shapeCounts - classEntropy Pos Pair pairCounts + + groupedEntropy Pos Shape shapeCounts designatedLeft HL w + + groupedEntropy Pos Shape shapeCounts designatedRight HR w + + classTypeError Pos Shape + classTypeError Pos Pair + + groupedTypeError Pos Shape Left shapeCounts designatedLeft w + + groupedTypeError Pos Shape Right shapeCounts designatedRight w + +theorem compatibleCandidateCount_le_exp + (w : FixedClassWords Pos Shape shapeCounts) + (z : FixedClassWords Pos Pair pairCounts) + (hpair : ∀ c, Function.Injective (fun s : Pair c => (leftPart c s, rightPart c s))) + (HL HR : (Σ c, Option (Shape c)) → ℝ) + (controlLeft : SideEntropyControl Pos Shape Pair Left shapeCounts pairCounts + leftPart designatedLeft leftLaw χ HL w) + (controlRight : SideEntropyControl Pos Shape Pair Right shapeCounts pairCounts + rightPart designatedRight rightLaw χ HR w) : + (compatibleCandidateCount Pos Shape Pair Left Right shapeCounts pairCounts + leftPart rightPart designatedLeft designatedRight leftLaw rightLaw χ z : ℝ) ≤ + Real.exp (compatibilityExponent Pos Shape Pair Left Right shapeCounts pairCounts + designatedLeft designatedRight HL HR w) := by + have h := compatibleCandidateCount_le_of_controls Pos Shape Pair Left Right + shapeCounts pairCounts leftPart rightPart designatedLeft designatedRight + leftLaw rightLaw χ w z hpair HL HR controlLeft controlRight + rw [prod_wordEntropyBound_eq_exp, prod_wordEntropyBound_eq_exp] at h + let E := groupedEntropy Pos Shape shapeCounts designatedLeft HL w + + groupedTypeError Pos Shape Left shapeCounts designatedLeft w + + (groupedEntropy Pos Shape shapeCounts designatedRight HR w + + groupedTypeError Pos Shape Right shapeCounts designatedRight w) + rw [← Real.exp_add] at h + have hnum : (Fintype.card (FixedClassWords Pos Shape shapeCounts) : ℝ) * Real.exp E ≤ + Real.exp (classEntropy Pos Shape shapeCounts + classTypeError Pos Shape + E) := by + conv_rhs => rw [Real.exp_add] + exact mul_le_mul_of_nonneg_right + (fixedClassWords_card_le_exp Pos Shape shapeCounts w) (Real.exp_pos E).le + calc + (compatibleCandidateCount Pos Shape Pair Left Right shapeCounts pairCounts + leftPart rightPart designatedLeft designatedRight leftLaw rightLaw χ z : ℝ) ≤ + (Fintype.card (FixedClassWords Pos Shape shapeCounts) : ℝ) * Real.exp E / + Fintype.card (FixedClassWords Pos Pair pairCounts) := h + _ ≤ Real.exp (classEntropy Pos Shape shapeCounts + classTypeError Pos Shape + E) / + Real.exp (classEntropy Pos Pair pairCounts - classTypeError Pos Pair) := + div_le_div₀ (Real.exp_pos _).le hnum (Real.exp_pos _) + (exp_le_fixedClassWords_card Pos Pair pairCounts z) + _ = Real.exp (compatibilityExponent Pos Shape Pair Left Right shapeCounts pairCounts + designatedLeft designatedRight HL HR w) := by + rw [← Real.exp_sub] + congr 1 + dsimp [E, compatibilityExponent] + ring + +theorem log_compatibleCandidateCount_le + (w : FixedClassWords Pos Shape shapeCounts) + (z : FixedClassWords Pos Pair pairCounts) + (hpair : ∀ c, Function.Injective (fun s : Pair c => (leftPart c s, rightPart c s))) + (HL HR : (Σ c, Option (Shape c)) → ℝ) + (controlLeft : SideEntropyControl Pos Shape Pair Left shapeCounts pairCounts + leftPart designatedLeft leftLaw χ HL w) + (controlRight : SideEntropyControl Pos Shape Pair Right shapeCounts pairCounts + rightPart designatedRight rightLaw χ HR w) + (hpos : 0 < compatibleCandidateCount Pos Shape Pair Left Right shapeCounts pairCounts + leftPart rightPart designatedLeft designatedRight leftLaw rightLaw χ z) : + Real.log (compatibleCandidateCount Pos Shape Pair Left Right shapeCounts pairCounts + leftPart rightPart designatedLeft designatedRight leftLaw rightLaw χ z : ℝ) ≤ + compatibilityExponent Pos Shape Pair Left Right shapeCounts pairCounts + designatedLeft designatedRight HL HR w := by + have h := Real.log_le_log (Nat.cast_pos.mpr hpos) + (compatibleCandidateCount_le_exp Pos Shape Pair Left Right shapeCounts pairCounts + leftPart rightPart designatedLeft designatedRight leftLaw rightLaw χ + w z hpair HL HR controlLeft controlRight) + simpa only [Real.log_exp] using h + +end Compatibility + +end MatrixMultiplication.JointCompatibilityEntropyBound + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/JointExtraction/CompatibilityIncidence.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/JointExtraction/CompatibilityIncidence.lean new file mode 100644 index 0000000000000000000000000000000000000000..7bee5946c485b3ffdbb4d5d6fffb7d1dc4c52dcb --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/JointExtraction/CompatibilityIncidence.lean @@ -0,0 +1,696 @@ +import OAI.LinearAlgebra.MatrixMultiplication.JointExtraction.TypeCounts +import Mathlib.Logic.Equiv.Option + +namespace OAI + +/-! Joint tensor extraction, compatibility and entropy estimates. -/ + +noncomputable section + +namespace MatrixMultiplication.JointCompatibilityIncidence + +open MatrixMultiplication.Foundation JointTypeCounts +open scoped BigOperators + +attribute [local instance] Classical.propDecidable + +section Actions + +variable {C : Type*} [Fintype C] [DecidableEq C] +variable (Pos A : C → Type*) + [∀ c, Fintype (Pos c)] [∀ c, DecidableEq (Pos c)] + [∀ c, Fintype (A c)] [∀ c, DecidableEq (A c)] + +abbrev ClassPerm := ∀ c, Equiv.Perm (Pos c) + +def permuteFixedWords (counts : ∀ c, A c → ℕ) + (g : ClassPerm Pos) (w : FixedClassWords Pos A counts) : + FixedClassWords Pos A counts := + fun c => ⟨(w c).val ∘ ((g c)⁻¹ : Equiv.Perm (Pos c)), fun a => + (wordPopulation_reindex (w c).val (g c)⁻¹ a).trans ((w c).property a)⟩ + +@[instance_reducible] +def fixedWordsMulAction (counts : ∀ c, A c → ℕ) : + MulAction (ClassPerm Pos) (FixedClassWords Pos A counts) where + smul := permuteFixedWords Pos A counts + one_smul w := by + funext c + apply Subtype.ext + funext i + rfl + mul_smul g h w := by + funext c + apply Subtype.ext + funext i + change (w c).val (((g * h) c)⁻¹ i) = + (w c).val ((h c)⁻¹ ((g c)⁻¹ i)) + simp only [Pi.mul_apply, mul_inv_rev, Equiv.Perm.mul_apply] + +attribute [local instance] fixedWordsMulAction + +omit [Fintype C] [DecidableEq C] [∀ c, DecidableEq (Pos c)] [∀ c, Fintype (A c)] in +theorem fixedWordsPretransitive (counts : ∀ c, A c → ℕ) : + MulAction.IsPretransitive (ClassPerm Pos) (FixedClassWords Pos A counts) where + exists_smul_eq w v := by + obtain ⟨e, he⟩ := fixedClassWords_transitive Pos A counts w v + refine ⟨fun c => (e c)⁻¹, ?_⟩ + funext c + apply Subtype.ext + change (w c).val ∘ (((e c)⁻¹)⁻¹ : Equiv.Perm (Pos c)) = (v c).val + simpa only [inv_inv] using he c + +attribute [local instance] fixedWordsPretransitive + +end Actions + +attribute [local instance] fixedWordsMulAction fixedWordsPretransitive + +section Counts + +variable {P U Z A : Type*} [Fintype P] [DecidableEq U] [DecidableEq A] + +def jointCount (w : P → U) (z : P → Z) (part : Z → A) (u : U) (a : A) : ℕ := + Fintype.card {i : P // w i = u ∧ part (z i) = a} + +theorem jointCount_reindex (w : P → U) (z : P → Z) (part : Z → A) + (e : Equiv.Perm P) (u : U) (a : A) : + jointCount (w ∘ e) (z ∘ e) part u a = jointCount w z part u a := by + exact Fintype.card_congr (Equiv.subtypeEquiv e fun _ => Iff.rfl) + +variable [DecidableEq P] [Fintype U] [Fintype A] + +omit [DecidableEq P] [Fintype A] in +theorem jointCount_sum_shapes (w : P → U) (z : P → Z) (part : Z → A) (a : A) : + (∑ u, jointCount w z part u a) = wordPopulation (part ∘ z) a := by + calc + (∑ u, jointCount w z part u a) = + ∑ u, wordPopulation (fun i : {i : P // part (z i) = a} => w i.val) u := by + apply Finset.sum_congr rfl + intro u _ + rw [wordPopulation_fiber] + exact Fintype.card_congr (Equiv.subtypeEquivRight fun _ => and_comm) + _ = wordPopulation (part ∘ z) a := wordPopulation_sum _ + +omit [DecidableEq P] [Fintype A] in +theorem projected_restrict_population (w : P → U) (z : P → Z) (part : Z → A) + (d : U → Prop) (a : A) : + wordPopulation (fun i : {i : P // d (w i)} => part (z i.val)) a = + ∑ u : {u : U // d u}, jointCount w z part u.val a := by + let e : {i : {i : P // d (w i)} // part (z i.val) = a} ≃ + Σ u : {u : U // d u}, {i : P // w i = u.val ∧ part (z i) = a} := + { toFun := fun i => ⟨⟨w i.val.val, i.val.property⟩, + ⟨i.val.val, rfl, i.property⟩⟩ + invFun := fun i => ⟨⟨i.2.val, by + rw [i.2.property.1] + exact i.1.property⟩, i.2.property.2⟩ + left_inv := by intro i; rfl + right_inv := by + rintro ⟨⟨u, hu⟩, i, hi, ha⟩ + cases hi + rfl } + simpa only [wordPopulation, Fintype.card_sigma, jointCount] using Fintype.card_congr e + +omit [DecidableEq P] [Fintype A] in +theorem residual_population_add_designated (w : P → U) (z : P → Z) + (part : Z → A) (d : U → Prop) (a : A) : + wordPopulation (fun i : {i : P // ¬d (w i)} => part (z i.val)) a + + ∑ u : {u : U // d u}, jointCount w z part u.val a = + wordPopulation (part ∘ z) a := by + have hres : + wordPopulation (fun i : {i : P // ¬d (w i)} => part (z i.val)) a = + ∑ u : {u : U // ¬d u}, jointCount w z part u.val a := by + convert projected_restrict_population w z part (fun u => ¬d u) a using 1 <;> congr 1 + · exact Subsingleton.elim _ _ + · ext u + simp + rw [hres, add_comm] + exact (Fintype.sum_subtype_add_sum_subtype d + (fun u => jointCount w z part u a)).trans (jointCount_sum_shapes w z part a) + +omit [DecidableEq P] [Fintype A] in +theorem projected_population_fixed [Fintype Z] [DecidableEq Z] + (z : P → Z) (counts : Z → ℕ) (hz : ∀ s, wordPopulation z s = counts s) + (part : Z → A) (a : A) : + wordPopulation (part ∘ z) a = ∑ s : {s : Z // part s = a}, counts s.val := by + have h := (Fintype.card_congr + (Equiv.sigmaSubtypeFiberEquivSubtype z + (p := fun i => part (z i) = a) (q := fun s => part s = a) + (fun _ => Iff.rfl))).symm + simp only [Fintype.card_sigma] at h + change wordPopulation (part ∘ z) a = + ∑ s : {s : Z // part s = a}, wordPopulation z s.val at h + simpa only [hz] using h + +omit [DecidableEq P] [Fintype A] in +theorem residual_projected_window (w : P → U) (z : P → Z) (part : Z → A) + (d : U → Prop) (counts : U → ℕ) (law : U → A → ℝ) + (residualLaw totalTarget : A → ℝ) (χ η : ℝ) (a : A) + (hmass : 0 < Fintype.card {i : P // ¬d (w i)}) + (htotal : |(wordPopulation (part ∘ z) a : ℝ) - totalTarget a| ≤ η) + (hdesignated : ∀ u, d u → + |(jointCount w z part u a : ℝ) - (counts u : ℝ) * law u a| ≤ + (counts u : ℝ) * χ) + (hbalance : (Fintype.card {i : P // ¬d (w i)} : ℝ) * residualLaw a = + totalTarget a - ∑ u : {u : U // d u}, (counts u.val : ℝ) * law u.val a) : + |(wordPopulation (fun i : {i : P // ¬d (w i)} => part (z i.val)) a : ℝ) / + Fintype.card {i : P // ¬d (w i)} - residualLaw a| ≤ + (η + (∑ u : {u : U // d u}, (counts u.val : ℝ)) * χ) / + Fintype.card {i : P // ¬d (w i)} := by + have hm : (0 : ℝ) < Fintype.card {i : P // ¬d (w i)} := Nat.cast_pos.mpr hmass + have hsplit : + (wordPopulation (fun i : {i : P // ¬d (w i)} => part (z i.val)) a : ℝ) = + wordPopulation (part ∘ z) a - + ∑ u : {u : U // d u}, (jointCount w z part u.val a : ℝ) := by + have h := residual_population_add_designated w z part d a + have h' : + (wordPopulation (fun i : {i : P // ¬d (w i)} => part (z i.val)) a : ℝ) + + ∑ u : {u : U // d u}, (jointCount w z part u.val a : ℝ) = + wordPopulation (part ∘ z) a := by exact_mod_cast h + exact eq_sub_of_add_eq h' + have hd : |(∑ u : {u : U // d u}, (jointCount w z part u.val a : ℝ)) - + ∑ u : {u : U // d u}, (counts u.val : ℝ) * law u.val a| ≤ + (∑ u : {u : U // d u}, (counts u.val : ℝ)) * χ := by + rw [← Finset.sum_sub_distrib, Finset.sum_mul] + exact (Finset.abs_sum_le_sum_abs _ _).trans + (Finset.sum_le_sum fun u _ => hdesignated u.val u.property) + exact residual_window_error hm (by rwa [mul_div_cancel₀ _ hm.ne']) + hbalance htotal hd + +end Counts + +section Groups + +variable {P U Z A : Type*} [Fintype P] [DecidableEq P] + [Fintype U] [DecidableEq U] [Fintype A] [DecidableEq A] + +def designatedGroup (d : U → Prop) (u : U) : Option U := + if d u then some u else none + +omit [Fintype U] [DecidableEq U] in +theorem designatedGroup_eq_some (d : U → Prop) (u v : U) : + designatedGroup d v = some u ↔ d u ∧ v = u := by + constructor + · intro h + by_cases hv : d v + · have he : v = u := Option.some.inj (by simpa [designatedGroup, hv] using h) + exact ⟨he ▸ hv, he⟩ + · simp [designatedGroup, hv] at h + · rintro ⟨hu, rfl⟩ + simp [designatedGroup, hu] + +omit [Fintype U] [DecidableEq U] in +theorem designatedGroup_eq_none (d : U → Prop) (v : U) : + designatedGroup d v = none ↔ ¬d v := by + simp [designatedGroup] + +abbrev GroupPos (w : P → U) (d : U → Prop) (k : Option U) := + {i : P // designatedGroup d (w i) = k} + +def groupProjection (w : P → U) (d : U → Prop) (k : Option U) + (z : P → Z) (part : Z → A) : GroupPos w d k → A := + fun i => part (z i.val) + +omit [DecidableEq P] [Fintype U] in +theorem groupPos_card_some (w : P → U) (d : U → Prop) (u : U) (hu : d u) : + Fintype.card (GroupPos w d (some u)) = wordPopulation w u := by + apply Fintype.card_congr + exact Equiv.subtypeEquivRight fun i => by simp [designatedGroup_eq_some, hu] + +omit [DecidableEq P] [Fintype U] [DecidableEq U] in +theorem groupPos_card_none (w : P → U) (d : U → Prop) : + Fintype.card (GroupPos w d none) = Fintype.card {i : P // ¬d (w i)} := by + apply Fintype.card_congr + exact Equiv.subtypeEquivRight fun i => designatedGroup_eq_none d (w i) + +omit [DecidableEq P] in +theorem restrict_card_eq_sum_population (w : P → U) (d : U → Prop) : + Fintype.card {i : P // d (w i)} = + ∑ u : {u : U // d u}, wordPopulation w u.val := by + simpa only [Fintype.card_sigma, wordPopulation] using + (Fintype.card_congr (Equiv.sigmaSubtypeFiberEquivSubtype w + (p := fun i => d (w i)) (q := d) (fun _ => Iff.rfl))).symm + +omit [DecidableEq P] [Fintype A] [Fintype U] in +theorem groupProjection_population_some (w : P → U) (d : U → Prop) + (u : U) (hu : d u) (z : P → Z) (part : Z → A) (a : A) : + wordPopulation (groupProjection w d (some u) z part) a = + jointCount w z part u a := by + apply Fintype.card_congr + refine (Equiv.subtypeSubtypeEquivSubtypeInter + (fun i : P => designatedGroup d (w i) = some u) + (fun i : P => part (z i) = a)).trans ?_ + exact Equiv.subtypeEquivRight fun i => by simp [designatedGroup_eq_some, hu] + +omit [DecidableEq P] [Fintype A] [Fintype U] [DecidableEq U] in +theorem groupProjection_population_none (w : P → U) (d : U → Prop) + (z : P → Z) (part : Z → A) (a : A) : + wordPopulation (groupProjection w d none z part) a = + wordPopulation (fun i : {i : P // ¬d (w i)} => part (z i.val)) a := by + apply Fintype.card_congr + exact (Equiv.subtypeEquiv + (Equiv.subtypeEquivRight fun i => designatedGroup_eq_none d (w i)) fun _ => Iff.rfl) + +theorem normalized_count_window {x n p χ : ℝ} (hn : 0 < n) + (h : |x - n * p| ≤ n * χ) : |x / n - p| ≤ χ := by + apply (mul_le_mul_iff_left₀ hn).mp + calc + |x / n - p| * n = |(x / n - p) * n| := by rw [abs_mul, abs_of_pos hn] + _ = |x - n * p| := by rw [sub_mul, div_mul_cancel₀ _ hn.ne', mul_comm p n] + _ ≤ n * χ := h + _ = χ * n := mul_comm _ _ + +omit [DecidableEq P] in +theorem group_entropy_of_designated_windows + (w : P → U) (z : P → Z) (part : Z → A) (d : U → Prop) + (counts : U → ℕ) (hcounts : ∀ u, wordPopulation w u = counts u) + (law : U → A → ℝ) (residualLaw totalTarget : A → ℝ) + (χ η : ℝ) (H : Option U → ℝ) (hH : ∀ k, 0 ≤ H k) + (htotal : ∀ a, |(wordPopulation (part ∘ z) a : ℝ) - totalTarget a| ≤ η) + (hdesignated : ∀ u, d u → ∀ a, + |(jointCount w z part u a : ℝ) - (counts u : ℝ) * law u a| ≤ + (counts u : ℝ) * χ) + (hbalance : ∀ a, (Fintype.card {i : P // ¬d (w i)} : ℝ) * residualLaw a = + totalTarget a - ∑ u : {u : U // d u}, (counts u.val : ℝ) * law u.val a) + (hcapDesignated : ∀ u, d u → ∀ q : A → ℝ, + (∀ a, |q a - law u a| ≤ χ) → finiteEntropy q ≤ H (some u)) + (hcapResidual : ∀ q : A → ℝ, + (∀ a, |q a - residualLaw a| ≤ + (η + (∑ u : {u : U // d u}, (counts u.val : ℝ)) * χ) / + Fintype.card {i : P // ¬d (w i)}) → finiteEntropy q ≤ H none) + (k : Option U) : + finiteEntropy (fun a => (wordPopulation (groupProjection w d k z part) a : ℝ) / + Fintype.card (GroupPos w d k)) ≤ H k := by + by_cases hzero : Fintype.card (GroupPos w d k) = 0 + · simpa only [hzero, Nat.cast_zero, div_zero, finiteEntropy, entropyTerm_zero, + Finset.sum_const_zero] using hH k + have hpos : 0 < Fintype.card (GroupPos w d k) := Nat.pos_of_ne_zero hzero + cases k with + | some u => + obtain ⟨i⟩ := Fintype.card_pos_iff.mp hpos + have hu : d u := ((designatedGroup_eq_some d u (w i.val)).mp i.property).1 + have hm : 0 < counts u := by + simpa only [groupPos_card_some w d u hu, hcounts u] using hpos + apply hcapDesignated u hu + intro a + simp only [groupProjection_population_some w d u hu, + groupPos_card_some w d u hu, hcounts u] + exact normalized_count_window (Nat.cast_pos.mpr hm) (hdesignated u hu a) + | none => + apply hcapResidual + intro a + simp only [groupProjection_population_none, groupPos_card_none] + exact residual_projected_window w z part d counts law residualLaw totalTarget χ η a + (by simpa only [groupPos_card_none] using hpos) (htotal a) + (fun u hu => hdesignated u hu a) (hbalance a) + +end Groups + +section GroupEntropy + +variable {U K A : Type*} [Fintype U] [Fintype K] [Fintype A] + +def groupMass (p : U → ℝ) (group : U → K) (k : K) : ℝ := + ∑ u, if group u = k then p u else 0 + +def groupLaw (p : U → ℝ) (group : U → K) (law : U → A → ℝ) + (k : K) (a : A) : ℝ := + (∑ u, if group u = k then p u * law u a else 0) / groupMass p group k + +def groupedEntropy (p : U → ℝ) (group : U → K) (law : U → A → ℝ) : ℝ := + ∑ k, groupMass p group k * finiteEntropy (groupLaw p group law k) + +omit [Fintype K] in +theorem groupMass_relabel {L : Type*} (e : K ≃ L) (p : U → ℝ) + (group : U → K) (k : K) : + groupMass p (e ∘ group) (e k) = groupMass p group k := by + simp only [groupMass, Function.comp_apply, e.injective.eq_iff] + +omit [Fintype A] [Fintype K] in +theorem groupLaw_relabel {L : Type*} (e : K ≃ L) (p : U → ℝ) + (group : U → K) (law : U → A → ℝ) (k : K) : + groupLaw p (e ∘ group) law (e k) = groupLaw p group law k := by + funext a + simp only [groupLaw, groupMass_relabel, Function.comp_apply, e.injective.eq_iff] + +theorem groupedEntropy_relabel {L : Type*} [Fintype L] (e : K ≃ L) + (p : U → ℝ) (group : U → K) (law : U → A → ℝ) : + groupedEntropy p (e ∘ group) law = groupedEntropy p group law := by + unfold groupedEntropy + calc + (∑ l, groupMass p (e ∘ group) l * finiteEntropy (groupLaw p (e ∘ group) law l)) = + ∑ k, groupMass p (e ∘ group) (e k) * + finiteEntropy (groupLaw p (e ∘ group) law (e k)) := (e.sum_comp _).symm + _ = ∑ k, groupMass p group k * finiteEntropy (groupLaw p group law k) := by + simp only [groupMass_relabel, groupLaw_relabel] + +omit [Fintype K] in +theorem groupMass_reindex (e : U ≃ U) (p : U → ℝ) (group : U → K) + (hp : ∀ u, p (e u) = p u) (k : K) : + groupMass p (group ∘ e) k = groupMass p group k := by + unfold groupMass + calc + (∑ u, if (group ∘ e) u = k then p u else 0) = + ∑ u, if group (e u) = k then p (e u) else 0 := by + apply Finset.sum_congr rfl + intro u _ + simp only [Function.comp_apply, hp u] + _ = ∑ u, if group u = k then p u else 0 := + e.sum_comp (fun u => if group u = k then p u else 0) + +omit [Fintype A] [Fintype K] in +theorem groupLaw_reindex (e : U ≃ U) (p : U → ℝ) (group : U → K) + (law : U → A → ℝ) (hp : ∀ u, p (e u) = p u) (k : K) : + groupLaw p (group ∘ e) (law ∘ e) k = groupLaw p group law k := by + funext a + unfold groupLaw + rw [groupMass_reindex e p group hp] + congr 1 + calc + (∑ u, if (group ∘ e) u = k then p u * (law ∘ e) u a else 0) = + ∑ u, if group (e u) = k then p (e u) * law (e u) a else 0 := by + apply Finset.sum_congr rfl + intro u _ + simp only [Function.comp_apply, hp u] + _ = ∑ u, if group u = k then p u * law u a else 0 := + e.sum_comp (fun u => if group u = k then p u * law u a else 0) + +theorem groupedEntropy_reindex (e : U ≃ U) (p : U → ℝ) (group : U → K) + (law : U → A → ℝ) (hp : ∀ u, p (e u) = p u) : + groupedEntropy p (group ∘ e) (law ∘ e) = groupedEntropy p group law := by + simp only [groupedEntropy, groupMass_reindex e p group hp, + groupLaw_reindex e p group law hp] + +theorem groupedEntropy_add_reindex (e : U ≃ U) (p : U → ℝ) (group : U → K) + (law : U → A → ℝ) (hp : ∀ u, p (e u) = p u) : + groupedEntropy p group law + groupedEntropy p (group ∘ e) (law ∘ e) = + 2 * groupedEntropy p group law := by + rw [groupedEntropy_reindex e p group law hp] + ring + +omit [Fintype U] in +theorem designatedGroup_transport (e : U ≃ U) (d : U → Prop) : + e.optionCongr ∘ designatedGroup (d ∘ e) = designatedGroup d ∘ e := by + funext u + by_cases h : d (e u) <;> + simp [designatedGroup, Function.comp_apply, Equiv.optionCongr_apply, h] + +theorem designated_groupedEntropy_reindex (e : U ≃ U) (p : U → ℝ) + (d : U → Prop) (law : U → A → ℝ) (hp : ∀ u, p (e u) = p u) : + groupedEntropy p (designatedGroup (d ∘ e)) (law ∘ e) = + groupedEntropy p (designatedGroup d) law := by + calc + groupedEntropy p (designatedGroup (d ∘ e)) (law ∘ e) = + groupedEntropy p (e.optionCongr ∘ designatedGroup (d ∘ e)) (law ∘ e) := + (groupedEntropy_relabel e.optionCongr p (designatedGroup (d ∘ e)) (law ∘ e)).symm + _ = groupedEntropy p (designatedGroup d ∘ e) (law ∘ e) := by + rw [designatedGroup_transport] + _ = groupedEntropy p (designatedGroup d) law := + groupedEntropy_reindex e p (designatedGroup d) law hp + +end GroupEntropy + +section SideControls + +variable {C : Type*} [Fintype C] [DecidableEq C] +variable (Pos Shape Pair A : C → Type*) + [∀ c, Fintype (Pos c)] [∀ c, DecidableEq (Pos c)] + [∀ c, Fintype (Shape c)] [∀ c, DecidableEq (Shape c)] + [∀ c, Fintype (Pair c)] [∀ c, DecidableEq (Pair c)] + [∀ c, Fintype (A c)] [∀ c, DecidableEq (A c)] +variable (shapeCounts : ∀ c, Shape c → ℕ) (pairCounts : ∀ c, Pair c → ℕ) + (part : ∀ c, Pair c → A c) (designated : ∀ c, Shape c → Prop) + (law : ∀ c, Shape c → A c → ℝ) (χ : ℝ) + (H : (Σ c, Option (Shape c)) → ℝ) (w : FixedClassWords Pos Shape shapeCounts) + +structure SideEntropyControl where + residualLaw : ∀ c, A c → ℝ + totalTarget : ∀ c, A c → ℝ + totalError : C → ℝ + aggregate_window : ∀ c a, + |((∑ s : {s : Pair c // part c s = a}, pairCounts c s.val : ℕ) : ℝ) - + totalTarget c a| ≤ totalError c + mixture_balance : ∀ c a, + (Fintype.card {i : Pos c // ¬designated c ((w c).val i)} : ℝ) * residualLaw c a = + totalTarget c a - ∑ u : {u : Shape c // designated c u}, + (shapeCounts c u.val : ℝ) * law c u.val a + nonneg : ∀ g, 0 ≤ H g + designated_entropy : ∀ c u, designated c u → ∀ q : A c → ℝ, + (∀ a, |q a - law c u a| ≤ χ) → finiteEntropy q ≤ H ⟨c, some u⟩ + residual_entropy : ∀ c, ∀ q : A c → ℝ, + (∀ a, |q a - residualLaw c a| ≤ + (totalError c + (∑ u : {u : Shape c // designated c u}, + (shapeCounts c u.val : ℝ)) * χ) / + Fintype.card {i : Pos c // ¬designated c ((w c).val i)}) → + finiteEntropy q ≤ H ⟨c, none⟩ + +omit [Fintype C] [DecidableEq C] [∀ c, DecidableEq (Pos c)] in +theorem SideEntropyControl.group_entropy + (control : SideEntropyControl Pos Shape Pair A shapeCounts pairCounts + part designated law χ H w) + (z : FixedClassWords Pos Pair pairCounts) + (hdesignated : ∀ c u, designated c u → ∀ a, + |(jointCount (w c).val (z c).val (part c) u a : ℝ) - + (shapeCounts c u : ℝ) * law c u a| ≤ (shapeCounts c u : ℝ) * χ) + (g : Σ c, Option (Shape c)) : + finiteEntropy (fun a => + (wordPopulation (groupProjection (w g.1).val (designated g.1) g.2 + (z g.1).val (part g.1)) a : ℝ) / + Fintype.card (GroupPos (w g.1).val (designated g.1) g.2)) ≤ H g := by + apply group_entropy_of_designated_windows (w g.1).val (z g.1).val (part g.1) + (designated g.1) (shapeCounts g.1) (w g.1).property (law g.1) + (control.residualLaw g.1) (control.totalTarget g.1) χ (control.totalError g.1) + (fun k => H ⟨g.1, k⟩) (fun k => control.nonneg ⟨g.1, k⟩) + · intro a + rw [projected_population_fixed (z g.1).val (pairCounts g.1) (z g.1).property] + exact control.aggregate_window g.1 a + · exact hdesignated g.1 + · exact control.mixture_balance g.1 + · exact control.designated_entropy g.1 + · exact control.residual_entropy g.1 + +end SideControls + +section Compatibility + +variable {C : Type*} [Fintype C] [DecidableEq C] +variable (Pos Shape Pair Left Right : C → Type*) + [∀ c, Fintype (Pos c)] [∀ c, DecidableEq (Pos c)] + [∀ c, Fintype (Shape c)] [∀ c, DecidableEq (Shape c)] + [∀ c, Fintype (Pair c)] [∀ c, DecidableEq (Pair c)] + [∀ c, Fintype (Left c)] [∀ c, DecidableEq (Left c)] + [∀ c, Fintype (Right c)] [∀ c, DecidableEq (Right c)] +variable (shapeCounts : ∀ c, Shape c → ℕ) (pairCounts : ∀ c, Pair c → ℕ) + (leftPart : ∀ c, Pair c → Left c) (rightPart : ∀ c, Pair c → Right c) + (designatedLeft designatedRight : ∀ c, Shape c → Prop) + (leftLaw : ∀ c, Shape c → Left c → ℝ) + (rightLaw : ∀ c, Shape c → Right c → ℝ) (χ : ℝ) + +def DesignatedCompatibility (w : FixedClassWords Pos Shape shapeCounts) + (z : FixedClassWords Pos Pair pairCounts) : Prop := + (∀ c u, designatedLeft c u → ∀ a, + |(jointCount (w c).val (z c).val (leftPart c) u a : ℝ) - + (shapeCounts c u : ℝ) * leftLaw c u a| ≤ (shapeCounts c u : ℝ) * χ) ∧ + (∀ c u, designatedRight c u → ∀ a, + |(jointCount (w c).val (z c).val (rightPart c) u a : ℝ) - + (shapeCounts c u : ℝ) * rightLaw c u a| ≤ (shapeCounts c u : ℝ) * χ) + +omit [Fintype C] [DecidableEq C] [∀ c, DecidableEq (Pos c)] + [∀ c, Fintype (Shape c)] [∀ c, Fintype (Pair c)] + [∀ c, Fintype (Left c)] [∀ c, Fintype (Right c)] in +theorem designatedCompatibility_permute (g : ClassPerm Pos) + (w : FixedClassWords Pos Shape shapeCounts) + (z : FixedClassWords Pos Pair pairCounts) : + DesignatedCompatibility Pos Shape Pair Left Right shapeCounts pairCounts + leftPart rightPart designatedLeft designatedRight leftLaw rightLaw χ + (permuteFixedWords Pos Shape shapeCounts g w) + (permuteFixedWords Pos Pair pairCounts g z) ↔ + DesignatedCompatibility Pos Shape Pair Left Right shapeCounts pairCounts + leftPart rightPart designatedLeft designatedRight leftLaw rightLaw χ w z := by + simp only [DesignatedCompatibility, permuteFixedWords, jointCount_reindex] + +def compatibleStatisticCount (w : FixedClassWords Pos Shape shapeCounts) : ℕ := + Fintype.card {z : FixedClassWords Pos Pair pairCounts // + DesignatedCompatibility Pos Shape Pair Left Right shapeCounts pairCounts + leftPart rightPart designatedLeft designatedRight leftLaw rightLaw χ w z} + +def compatibleCandidateCount (z : FixedClassWords Pos Pair pairCounts) : ℕ := + Fintype.card {w : FixedClassWords Pos Shape shapeCounts // + DesignatedCompatibility Pos Shape Pair Left Right shapeCounts pairCounts + leftPart rightPart designatedLeft designatedRight leftLaw rightLaw χ w z} + +omit [∀ c, Fintype (Left c)] [∀ c, Fintype (Right c)] in +theorem designated_incidence_count + (w : FixedClassWords Pos Shape shapeCounts) + (z : FixedClassWords Pos Pair pairCounts) : + Fintype.card (FixedClassWords Pos Shape shapeCounts) * + compatibleStatisticCount Pos Shape Pair Left Right shapeCounts pairCounts + leftPart rightPart designatedLeft designatedRight leftLaw rightLaw χ w = + Fintype.card (FixedClassWords Pos Pair pairCounts) * + compatibleCandidateCount Pos Shape Pair Left Right shapeCounts pairCounts + leftPart rightPart designatedLeft designatedRight leftLaw rightLaw χ z := by + exact invariant_incidence_count (G := ClassPerm Pos) + (DesignatedCompatibility Pos Shape Pair Left Right shapeCounts pairCounts + leftPart rightPart designatedLeft designatedRight leftLaw rightLaw χ) + (designatedCompatibility_permute Pos Shape Pair Left Right shapeCounts pairCounts + leftPart rightPart designatedLeft designatedRight leftLaw rightLaw χ) w z + +omit [∀ c, Fintype (Left c)] [∀ c, Fintype (Right c)] in +theorem designated_incidence_multinomial + (hshape : ∀ c, Fintype.card (Pos c) = ∑ u, shapeCounts c u) + (hpair : ∀ c, Fintype.card (Pos c) = ∑ a, pairCounts c a) + (w : FixedClassWords Pos Shape shapeCounts) + (z : FixedClassWords Pos Pair pairCounts) : + (∏ c, Nat.multinomial Finset.univ (shapeCounts c)) * + compatibleStatisticCount Pos Shape Pair Left Right shapeCounts pairCounts + leftPart rightPart designatedLeft designatedRight leftLaw rightLaw χ w = + (∏ c, Nat.multinomial Finset.univ (pairCounts c)) * + compatibleCandidateCount Pos Shape Pair Left Right shapeCounts pairCounts + leftPart rightPart designatedLeft designatedRight leftLaw rightLaw χ z := by + simpa only [fixedClassWords_card Pos Shape shapeCounts hshape, + fixedClassWords_card Pos Pair pairCounts hpair] using + designated_incidence_count Pos Shape Pair Left Right shapeCounts pairCounts + leftPart rightPart designatedLeft designatedRight leftLaw rightLaw χ w z + +omit [∀ c, Fintype (Left c)] [∀ c, Fintype (Right c)] in +theorem compatibleCandidateCount_eq + (w : FixedClassWords Pos Shape shapeCounts) + (z : FixedClassWords Pos Pair pairCounts) : + (compatibleCandidateCount Pos Shape Pair Left Right shapeCounts pairCounts + leftPart rightPart designatedLeft designatedRight leftLaw rightLaw χ z : ℝ) = + (Fintype.card (FixedClassWords Pos Shape shapeCounts) : ℝ) * + compatibleStatisticCount Pos Shape Pair Left Right shapeCounts pairCounts + leftPart rightPart designatedLeft designatedRight leftLaw rightLaw χ w / + Fintype.card (FixedClassWords Pos Pair pairCounts) := by + exact invariant_incidence_degree_eq (G := ClassPerm Pos) + (DesignatedCompatibility Pos Shape Pair Left Right shapeCounts pairCounts + leftPart rightPart designatedLeft designatedRight leftLaw rightLaw χ) + (designatedCompatibility_permute Pos Shape Pair Left Right shapeCounts pairCounts + leftPart rightPart designatedLeft designatedRight leftLaw rightLaw χ) w z + +def wordEntropyBound (I A : Type*) [Fintype I] [Fintype A] (H : ℝ) : ℝ := + ((Fintype.card I : ℝ) + 1) ^ Fintype.card A * + Real.exp ((Fintype.card I : ℝ) * H + + ((Fintype.card A : ℝ) + 1) * (1 + Real.log (Fintype.card I + 1 : ℕ))) + +theorem compatibleStatisticCount_le_grouped_entropy + (w : FixedClassWords Pos Shape shapeCounts) + (hpair : ∀ c, Function.Injective (fun s : Pair c => (leftPart c s, rightPart c s))) + (HL HR : (Σ c, Option (Shape c)) → ℝ) + (hL : ∀ z : FixedClassWords Pos Pair pairCounts, + DesignatedCompatibility Pos Shape Pair Left Right shapeCounts pairCounts + leftPart rightPart designatedLeft designatedRight leftLaw rightLaw χ w z → + ∀ g : Σ c, Option (Shape c), + finiteEntropy (fun a => + (wordPopulation (groupProjection (w g.1).val (designatedLeft g.1) g.2 + (z g.1).val (leftPart g.1)) a : ℝ) / + Fintype.card (GroupPos (w g.1).val (designatedLeft g.1) g.2)) ≤ HL g) + (hR : ∀ z : FixedClassWords Pos Pair pairCounts, + DesignatedCompatibility Pos Shape Pair Left Right shapeCounts pairCounts + leftPart rightPart designatedLeft designatedRight leftLaw rightLaw χ w z → + ∀ g : Σ c, Option (Shape c), + finiteEntropy (fun a => + (wordPopulation (groupProjection (w g.1).val (designatedRight g.1) g.2 + (z g.1).val (rightPart g.1)) a : ℝ) / + Fintype.card (GroupPos (w g.1).val (designatedRight g.1) g.2)) ≤ HR g) : + (compatibleStatisticCount Pos Shape Pair Left Right shapeCounts pairCounts + leftPart rightPart designatedLeft designatedRight leftLaw rightLaw χ w : ℝ) ≤ + (∏ g : Σ c, Option (Shape c), wordEntropyBound + (GroupPos (w g.1).val (designatedLeft g.1) g.2) (Left g.1) (HL g)) * + (∏ g : Σ c, Option (Shape c), wordEntropyBound + (GroupPos (w g.1).val (designatedRight g.1) g.2) (Right g.1) (HR g)) := by + let J := Σ c, Option (Shape c) + let PL : J → Type _ := fun g => GroupPos (w g.1).val (designatedLeft g.1) g.2 + let PR : J → Type _ := fun g => GroupPos (w g.1).val (designatedRight g.1) g.2 + let EL := ∀ g : J, {v : PL g → Left g.1 // + finiteEntropy (fun a => (wordPopulation v a : ℝ) / Fintype.card (PL g)) ≤ HL g} + let ER := ∀ g : J, {v : PR g → Right g.1 // + finiteEntropy (fun a => (wordPopulation v a : ℝ) / Fintype.card (PR g)) ≤ HR g} + let Row := {z : FixedClassWords Pos Pair pairCounts // + DesignatedCompatibility Pos Shape Pair Left Right shapeCounts pairCounts + leftPart rightPart designatedLeft designatedRight leftLaw rightLaw χ w z} + let encode : Row → EL × ER := fun z => + (fun g => ⟨groupProjection (w g.1).val (designatedLeft g.1) g.2 + (z.val g.1).val (leftPart g.1), hL z.val z.property g⟩, + fun g => ⟨groupProjection (w g.1).val (designatedRight g.1) g.2 + (z.val g.1).val (rightPart g.1), hR z.val z.property g⟩) + have hinj : Function.Injective encode := by + intro x y h + apply Subtype.ext + funext c + apply Subtype.ext + funext i + apply hpair c + apply Prod.ext + · exact congrArg (fun v : EL × ER => + ((v.1 ⟨c, designatedGroup (designatedLeft c) ((w c).val i)⟩).val ⟨i, rfl⟩)) h + · exact congrArg (fun v : EL × ER => + ((v.2 ⟨c, designatedGroup (designatedRight c) ((w c).val i)⟩).val ⟨i, rfl⟩)) h + have hleft : (Fintype.card EL : ℝ) ≤ + ∏ g : J, wordEntropyBound (PL g) (Left g.1) (HL g) := + card_class_entropy_bounded_words_le PL (fun g => Left g.1) HL + have hright : (Fintype.card ER : ℝ) ≤ + ∏ g : J, wordEntropyBound (PR g) (Right g.1) (HR g) := + card_class_entropy_bounded_words_le PR (fun g => Right g.1) HR + have hcard : (Fintype.card Row : ℝ) ≤ (Fintype.card EL : ℝ) * Fintype.card ER := by + simpa only [Fintype.card_prod, Nat.cast_mul] using + (Nat.cast_le.mpr (Fintype.card_le_of_injective encode hinj) : + (Fintype.card Row : ℝ) ≤ Fintype.card (EL × ER)) + exact hcard.trans (mul_le_mul hleft hright (Nat.cast_nonneg _) + ((Nat.cast_nonneg _).trans hleft)) + +theorem compatibleStatisticCount_le_of_controls + (w : FixedClassWords Pos Shape shapeCounts) + (hpair : ∀ c, Function.Injective (fun s : Pair c => (leftPart c s, rightPart c s))) + (HL HR : (Σ c, Option (Shape c)) → ℝ) + (controlLeft : SideEntropyControl Pos Shape Pair Left shapeCounts pairCounts + leftPart designatedLeft leftLaw χ HL w) + (controlRight : SideEntropyControl Pos Shape Pair Right shapeCounts pairCounts + rightPart designatedRight rightLaw χ HR w) : + (compatibleStatisticCount Pos Shape Pair Left Right shapeCounts pairCounts + leftPart rightPart designatedLeft designatedRight leftLaw rightLaw χ w : ℝ) ≤ + (∏ g : Σ c, Option (Shape c), wordEntropyBound + (GroupPos (w g.1).val (designatedLeft g.1) g.2) (Left g.1) (HL g)) * + (∏ g : Σ c, Option (Shape c), wordEntropyBound + (GroupPos (w g.1).val (designatedRight g.1) g.2) (Right g.1) (HR g)) := by + apply compatibleStatisticCount_le_grouped_entropy Pos Shape Pair Left Right + shapeCounts pairCounts leftPart rightPart designatedLeft designatedRight + leftLaw rightLaw χ w hpair HL HR + · intro z hz g + exact SideEntropyControl.group_entropy Pos Shape Pair Left shapeCounts pairCounts + leftPart designatedLeft leftLaw χ HL w controlLeft z hz.1 g + · intro z hz g + exact SideEntropyControl.group_entropy Pos Shape Pair Right shapeCounts pairCounts + rightPart designatedRight rightLaw χ HR w controlRight z hz.2 g + +theorem compatibleCandidateCount_le_of_controls + (w : FixedClassWords Pos Shape shapeCounts) + (z : FixedClassWords Pos Pair pairCounts) + (hpair : ∀ c, Function.Injective (fun s : Pair c => (leftPart c s, rightPart c s))) + (HL HR : (Σ c, Option (Shape c)) → ℝ) + (controlLeft : SideEntropyControl Pos Shape Pair Left shapeCounts pairCounts + leftPart designatedLeft leftLaw χ HL w) + (controlRight : SideEntropyControl Pos Shape Pair Right shapeCounts pairCounts + rightPart designatedRight rightLaw χ HR w) : + (compatibleCandidateCount Pos Shape Pair Left Right shapeCounts pairCounts + leftPart rightPart designatedLeft designatedRight leftLaw rightLaw χ z : ℝ) ≤ + (Fintype.card (FixedClassWords Pos Shape shapeCounts) : ℝ) * + ((∏ g : Σ c, Option (Shape c), wordEntropyBound + (GroupPos (w g.1).val (designatedLeft g.1) g.2) (Left g.1) (HL g)) * + (∏ g : Σ c, Option (Shape c), wordEntropyBound + (GroupPos (w g.1).val (designatedRight g.1) g.2) (Right g.1) (HR g))) / + Fintype.card (FixedClassWords Pos Pair pairCounts) := by + rw [compatibleCandidateCount_eq Pos Shape Pair Left Right shapeCounts pairCounts + leftPart rightPart designatedLeft designatedRight leftLaw rightLaw χ w z] + apply div_le_div_of_nonneg_right _ (Nat.cast_nonneg _) + exact mul_le_mul_of_nonneg_left + (compatibleStatisticCount_le_of_controls Pos Shape Pair Left Right shapeCounts pairCounts + leftPart rightPart designatedLeft designatedRight leftLaw rightLaw χ w hpair HL HR + controlLeft controlRight) (Nat.cast_nonneg _) + +end Compatibility + +end MatrixMultiplication.JointCompatibilityIncidence + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/JointExtraction/CompatibilityRateLimit.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/JointExtraction/CompatibilityRateLimit.lean new file mode 100644 index 0000000000000000000000000000000000000000..d036f64c48366e5cc82bb32070e6a22aab3eadf2 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/JointExtraction/CompatibilityRateLimit.lean @@ -0,0 +1,280 @@ +import OAI.LinearAlgebra.MatrixMultiplication.JointExtraction.CompatibilityScaling +import OAI.LinearAlgebra.MatrixMultiplication.JointExtraction.CompatibilityEntropyBound +import OAI.LinearAlgebra.MatrixMultiplication.JointExtraction.AmbientRateLimit + +namespace OAI + +/-! Joint tensor extraction, compatibility and entropy estimates. -/ + +noncomputable section + +namespace MatrixMultiplication.JointCompatibilityRateLimit + +open MatrixMultiplication.Foundation JointTypeCounts JointCompatibilityIncidence +open JointCompatibilityEntropyBound JointCompatibilityScaling Filter +open scoped BigOperators Topology + +attribute [local instance] Classical.propDecidable + +private theorem exists_pos_le_family {K : Type*} [Fintype K] + (δ : K → ℝ) (hδ : ∀ k, 0 < δ k) : + ∃ ε : ℝ, 0 < ε ∧ ∀ k, ε ≤ δ k := by + classical + have aux : ∀ s : Finset K, ∃ ε : ℝ, 0 < ε ∧ ∀ k ∈ s, ε ≤ δ k := by + intro s + induction s using Finset.induction_on with + | empty => exact ⟨1, zero_lt_one, by simp⟩ + | @insert k s hk ih => + obtain ⟨ε, hε, hb⟩ := ih + refine ⟨min (δ k) ε, lt_min (hδ k) hε, ?_⟩ + intro j hj + rcases Finset.mem_insert.mp hj with rfl | hj + · exact min_le_left _ _ + · exact (min_le_right _ _).trans (hb j hj) + obtain ⟨ε, hε, hb⟩ := aux Finset.univ + exact ⟨ε, hε, fun k => hb k (Finset.mem_univ k)⟩ + +variable {C : Type*} [Fintype C] [DecidableEq C] + {Shape Pair Left Right : C → Type*} + [∀ c, Fintype (Shape c)] [∀ c, DecidableEq (Shape c)] + [∀ c, Fintype (Pair c)] [∀ c, DecidableEq (Pair c)] + [∀ c, Fintype (Left c)] [∀ c, DecidableEq (Left c)] + [∀ c, Fintype (Right c)] [∀ c, DecidableEq (Right c)] + +def totalBase (base : ∀ c, Shape c → ℕ) : ℕ := ∑ c, baseSize base c + +def pairReferenceEntropy (base : ∀ c, Shape c → ℕ) (q : ∀ c, Pair c → ℝ) : ℝ := + ∑ c, (baseSize base c : ℝ) * finiteEntropy (q c) + +def projectedReferenceEntropy (base : ∀ c, Shape c → ℕ) + (d : ∀ c, Shape c → Prop) (H : (Σ c, Option (Shape c)) → ℝ) : ℝ := + ∑ g : Σ c, Option (Shape c), (baseGroupSize base d g : ℝ) * H g + +def compatibilityRate (base : ∀ c, Shape c → ℕ) (q : ∀ c, Pair c → ℝ) + (designatedLeft designatedRight : ∀ c, Shape c → Prop) + (HL HR : (Σ c, Option (Shape c)) → ℝ) : ℝ := + baseEntropy base - pairReferenceEntropy base q + + projectedReferenceEntropy base designatedLeft HL + + projectedReferenceEntropy base designatedRight HR + +omit [DecidableEq C] in +theorem projectedReferenceEntropy_add_const (base : ∀ c, Shape c → ℕ) + (d : ∀ c, Shape c → Prop) (H : (Σ c, Option (Shape c)) → ℝ) (δ : ℝ) : + projectedReferenceEntropy base d (fun g => H g + δ) = + projectedReferenceEntropy base d H + (totalBase base : ℝ) * δ := by + simp only [projectedReferenceEntropy, mul_add, Finset.sum_add_distrib, + ← Finset.sum_mul, ← Nat.cast_sum, sum_baseGroupSize, totalBase, baseTotal] + +omit [DecidableEq C] [∀ c, DecidableEq (Pair c)] in +theorem compatibilityRate_add_caps (base : ∀ c, Shape c → ℕ) + (q : ∀ c, Pair c → ℝ) (designatedLeft designatedRight : ∀ c, Shape c → Prop) + (HL HR : (Σ c, Option (Shape c)) → ℝ) (δ : ℝ) : + compatibilityRate base q designatedLeft designatedRight + (fun g => HL g + δ) (fun g => HR g + δ) = + compatibilityRate base q designatedLeft designatedRight HL HR + + 2 * (totalBase base : ℝ) * δ := by + simp only [compatibilityRate, projectedReferenceEntropy_add_const] + ring + +def PairWindow (base : ∀ c, Shape c → ℕ) (q : ∀ c, Pair c → ℝ) + (Pos : C → Type*) [∀ c, Fintype (Pos c)] + (pairCounts : ∀ c, Pair c → ℕ) (η : ℝ) : Prop := + ∀ c, 0 < baseSize base c → ∀ a, + |(pairCounts c a : ℝ) / Fintype.card (Pos c) - q c a| ≤ η + +omit [DecidableEq C] [∀ c, DecidableEq (Pair c)] in +theorem exists_pair_entropy_window (q : ∀ c, Pair c → ℝ) + {κ ηMax : ℝ} (hκ : 0 < κ) (hηMax : 0 < ηMax) : + ∃ η : ℝ, 0 < η ∧ η ≤ ηMax ∧ ∀ c (r : Pair c → ℝ), + (∀ a, |r a - q c a| ≤ η) → finiteEntropy (q c) - κ ≤ finiteEntropy r := by + have hex : ∀ c, ∃ δ : ℝ, 0 < δ ∧ ∀ r : Pair c → ℝ, + (∀ a, |r a - q c a| ≤ δ) → |finiteEntropy r - finiteEntropy (q c)| < κ := + fun c => exists_entropy_window (q c) hκ + choose δ hδ hw using hex + obtain ⟨η₀, hη₀, hsmall⟩ := exists_pos_le_family δ hδ + refine ⟨min ηMax η₀, lt_min hηMax hη₀, min_le_left _ _, ?_⟩ + intro c r hr + have h := (abs_lt.mp (hw c r (fun a => + (hr a).trans ((min_le_right _ _).trans (hsmall c))))).1 + linarith + +omit [Fintype C] [DecidableEq C] in +theorem repeated_positions_card + (Pos : C → Type*) [∀ c, Fintype (Pos c)] [∀ c, DecidableEq (Pos c)] + (base : ∀ c, Shape c → ℕ) (t : ℕ) + (w : FixedClassWords Pos Shape (fun c u => t * base c u)) (c : C) : + Fintype.card (Pos c) = t * baseSize base c := by + rw [fixedClassWords_size Pos Shape _ w c] + simp only [baseSize, Finset.mul_sum] + +omit [DecidableEq C] in +theorem repeated_positions_card_le + (Pos : C → Type*) [∀ c, Fintype (Pos c)] [∀ c, DecidableEq (Pos c)] + (base : ∀ c, Shape c → ℕ) (t : ℕ) + (w : FixedClassWords Pos Shape (fun c u => t * base c u)) (c : C) : + Fintype.card (Pos c) ≤ t * totalBase base := by + rw [repeated_positions_card Pos base t w c] + exact Nat.mul_le_mul_left _ + (Finset.single_le_sum (fun _ _ => Nat.zero_le _) (Finset.mem_univ c)) + +omit [DecidableEq C] [∀ c, DecidableEq (Pair c)] in +theorem pair_classEntropy_lower + (Pos : C → Type*) [∀ c, Fintype (Pos c)] [∀ c, DecidableEq (Pos c)] + (base : ∀ c, Shape c → ℕ) (q : ∀ c, Pair c → ℝ) (t : ℕ) + (pairCounts : ∀ c, Pair c → ℕ) + (w : FixedClassWords Pos Shape (fun c u => t * base c u)) + {η κ : ℝ} + (hwindow : ∀ c (r : Pair c → ℝ), (∀ a, |r a - q c a| ≤ η) → + finiteEntropy (q c) - κ ≤ finiteEntropy r) + (hpair : PairWindow base q Pos pairCounts η) : + (t : ℝ) * (pairReferenceEntropy base q - (totalBase base : ℝ) * κ) ≤ + classEntropy Pos Pair pairCounts := by + have hc (c : C) : + (t : ℝ) * (baseSize base c : ℝ) * (finiteEntropy (q c) - κ) ≤ + (Fintype.card (Pos c) : ℝ) * + finiteEntropy (fun a => (pairCounts c a : ℝ) / Fintype.card (Pos c)) := by + by_cases hz : baseSize base c = 0 + · simp only [repeated_positions_card Pos base t w c, hz, mul_zero, + Nat.cast_zero, zero_mul, le_refl] + · have he := hwindow c (fun a => (pairCounts c a : ℝ) / Fintype.card (Pos c)) + (hpair c (Nat.pos_of_ne_zero hz)) + have hh := mul_le_mul_of_nonneg_left he + (mul_nonneg (Nat.cast_nonneg t) (Nat.cast_nonneg (baseSize base c))) + simpa only [repeated_positions_card Pos base t w c, Nat.cast_mul] using hh + calc + (t : ℝ) * (pairReferenceEntropy base q - (totalBase base : ℝ) * κ) = + ∑ c, (t : ℝ) * (baseSize base c : ℝ) * (finiteEntropy (q c) - κ) := by + simp only [pairReferenceEntropy, totalBase, Nat.cast_sum, Finset.mul_sum, + Finset.sum_mul, mul_sub, Finset.sum_sub_distrib, mul_assoc] + _ ≤ classEntropy Pos Pair pairCounts := Finset.sum_le_sum fun c _ => hc c + +def errorCoefficient (Shape Pair Left Right : C → Type*) + [∀ c, Fintype (Shape c)] [∀ c, Fintype (Pair c)] + [∀ c, Fintype (Left c)] [∀ c, Fintype (Right c)] : ℝ := + classErrorCoefficient Shape + classErrorCoefficient Pair + + groupErrorCoefficient Shape Left + groupErrorCoefficient Shape Right + +omit [DecidableEq C] in +theorem compatibilityExponent_le_rate_add + (Pos : C → Type*) [∀ c, Fintype (Pos c)] [∀ c, DecidableEq (Pos c)] + (base : ∀ c, Shape c → ℕ) (q : ∀ c, Pair c → ℝ) + (designatedLeft designatedRight : ∀ c, Shape c → Prop) + (HL HR : (Σ c, Option (Shape c)) → ℝ) + (t : ℕ) (ht : 0 < t) (pairCounts : ∀ c, Pair c → ℕ) + (w : FixedClassWords Pos Shape (fun c u => t * base c u)) + {η κ : ℝ} + (hwindow : ∀ c (r : Pair c → ℝ), (∀ a, |r a - q c a| ≤ η) → + finiteEntropy (q c) - κ ≤ finiteEntropy r) + (hpair : PairWindow base q Pos pairCounts η) : + compatibilityExponent Pos Shape Pair Left Right (fun c u => t * base c u) + pairCounts designatedLeft designatedRight HL HR w ≤ + (t : ℝ) * (compatibilityRate base q designatedLeft designatedRight HL HR + + (totalBase base : ℝ) * κ) + + errorCoefficient Shape Pair Left Right * typeErrorFactor (totalBase base) t := by + have hsize := repeated_positions_card Pos base t w + have hsizele := repeated_positions_card_le Pos base t w + have hs := classEntropy_repeated Pos base t ht hsize + have hl := groupedEntropy_repeated Pos base designatedLeft t HL w + have hr := groupedEntropy_repeated Pos base designatedRight t HR w + have hp := pair_classEntropy_lower Pos base q t pairCounts w hwindow hpair + have e₁ := classTypeError_le Pos Shape (totalBase base) t hsizele + have e₂ := classTypeError_le Pos Pair (totalBase base) t hsizele + have e₃ := groupedTypeError_le Pos Left (fun c u => t * base c u) + designatedLeft w (totalBase base) t hsizele + have e₄ := groupedTypeError_le Pos Right (fun c u => t * base c u) + designatedRight w (totalBase base) t hsizele + unfold compatibilityExponent + rw [hs, hl, hr] + dsimp only [compatibilityRate, projectedReferenceEntropy, baseGroupedEntropy, + errorCoefficient] at * + nlinarith + +omit [DecidableEq C] in +theorem exists_window_eventually_exponent_le + (base : ∀ c, Shape c → ℕ) (q : ∀ c, Pair c → ℝ) + (designatedLeft designatedRight : ∀ c, Shape c → Prop) + (HL HR : (Σ c, Option (Shape c)) → ℝ) + {ε ηMax : ℝ} (hε : 0 < ε) (hηMax : 0 < ηMax) : + ∃ η : ℝ, 0 < η ∧ η ≤ ηMax ∧ + ∀ᶠ t : ℕ in atTop, + ∀ (Pos : C → Type*) [∀ c, Fintype (Pos c)] [∀ c, DecidableEq (Pos c)] + (pairCounts : ∀ c, Pair c → ℕ) + (w : FixedClassWords Pos Shape (fun c u => t * base c u)), + PairWindow base q Pos pairCounts η → + compatibilityExponent Pos Shape Pair Left Right (fun c u => t * base c u) + pairCounts designatedLeft designatedRight HL HR w ≤ + (t : ℝ) * (compatibilityRate base q designatedLeft designatedRight HL HR + ε) := by + let κ : ℝ := ε / (2 * ((totalBase base : ℝ) + 1)) + have hden : 0 < 2 * ((totalBase base : ℝ) + 1) := by positivity + have hκ : 0 < κ := div_pos hε hden + have hκeq : (2 * ((totalBase base : ℝ) + 1)) * κ = ε := + mul_div_cancel₀ _ hden.ne' + have hκbound : (totalBase base : ℝ) * κ ≤ ε / 2 := by + nlinarith [(Nat.cast_nonneg (totalBase base) : (0 : ℝ) ≤ totalBase base)] + obtain ⟨η, hη, hηMax', hwindow⟩ := exists_pair_entropy_window q hκ hηMax + refine ⟨η, hη, hηMax', ?_⟩ + have herr := tendsto_mul_typeErrorFactor_div + (errorCoefficient Shape Pair Left Right) (totalBase base) + filter_upwards [(tendsto_order.1 herr).2 (ε / 2) (half_pos hε), + eventually_ge_atTop (1 : ℕ)] with t he ht + intro Pos _ _ pairCounts w hp + have htpos : 0 < t := lt_of_lt_of_le Nat.zero_lt_one ht + have htr : (0 : ℝ) < t := Nat.cast_pos.mpr htpos + have he' := (div_lt_iff₀ htr).mp he + have hκ' := mul_le_mul_of_nonneg_left hκbound htr.le + have hb := compatibilityExponent_le_rate_add (Left := Left) (Right := Right) + Pos base q designatedLeft designatedRight HL HR t htpos pairCounts w hwindow hp + nlinarith + +theorem exists_window_eventually_count_le + (base : ∀ c, Shape c → ℕ) (q : ∀ c, Pair c → ℝ) + (leftPart : ∀ c, Pair c → Left c) (rightPart : ∀ c, Pair c → Right c) + (designatedLeft designatedRight : ∀ c, Shape c → Prop) + (leftLaw : ∀ c, Shape c → Left c → ℝ) + (rightLaw : ∀ c, Shape c → Right c → ℝ) + (hparts : ∀ c, Function.Injective (fun a : Pair c => (leftPart c a, rightPart c a))) + (HL HR : (Σ c, Option (Shape c)) → ℝ) + {ε ηMax : ℝ} (hε : 0 < ε) (hηMax : 0 < ηMax) : + ∃ η : ℝ, 0 < η ∧ η ≤ ηMax ∧ + ∀ᶠ t : ℕ in atTop, + ∀ (Pos : C → Type*) [∀ c, Fintype (Pos c)] [∀ c, DecidableEq (Pos c)] + (pairCounts : ∀ c, Pair c → ℕ) + (w : FixedClassWords Pos Shape (fun c u => t * base c u)) + (z : FixedClassWords Pos Pair pairCounts) (χ : ℝ), + PairWindow base q Pos pairCounts η → + SideEntropyControl Pos Shape Pair Left (fun c u => t * base c u) pairCounts + leftPart designatedLeft leftLaw χ HL w → + SideEntropyControl Pos Shape Pair Right (fun c u => t * base c u) pairCounts + rightPart designatedRight rightLaw χ HR w → + (compatibleCandidateCount Pos Shape Pair Left Right (fun c u => t * base c u) + pairCounts leftPart rightPart designatedLeft designatedRight leftLaw rightLaw χ z : ℝ) ≤ + Real.exp ((t : ℝ) * + (compatibilityRate base q designatedLeft designatedRight HL HR + ε)) ∧ + (0 < compatibleCandidateCount Pos Shape Pair Left Right (fun c u => t * base c u) + pairCounts leftPart rightPart designatedLeft designatedRight leftLaw rightLaw χ z → + Real.log (compatibleCandidateCount Pos Shape Pair Left Right (fun c u => t * base c u) + pairCounts leftPart rightPart designatedLeft designatedRight leftLaw rightLaw χ z : ℝ) / + (t : ℝ) ≤ compatibilityRate base q designatedLeft designatedRight HL HR + ε) := by + obtain ⟨η, hη, hηMax', hbound⟩ := exists_window_eventually_exponent_le + (Left := Left) (Right := Right) base q designatedLeft designatedRight HL HR hε hηMax + refine ⟨η, hη, hηMax', ?_⟩ + filter_upwards [hbound, eventually_ge_atTop (1 : ℕ)] with t hb ht + intro Pos _ _ pairCounts w z χ hp hL hR + have he := hb Pos pairCounts w hp + have hc := compatibleCandidateCount_le_exp Pos Shape Pair Left Right + (fun c u => t * base c u) pairCounts leftPart rightPart + designatedLeft designatedRight leftLaw rightLaw χ w z hparts HL HR hL hR + refine ⟨hc.trans (Real.exp_le_exp.mpr he), ?_⟩ + intro hpos + have hl := log_compatibleCandidateCount_le Pos Shape Pair Left Right + (fun c u => t * base c u) pairCounts leftPart rightPart + designatedLeft designatedRight leftLaw rightLaw χ w z hparts HL HR hL hR hpos + have htr : (0 : ℝ) < t := + Nat.cast_pos.mpr (lt_of_lt_of_le Nat.zero_lt_one ht) + exact (div_le_iff₀ htr).mpr (by simpa only [mul_comm] using hl.trans he) + +end MatrixMultiplication.JointCompatibilityRateLimit + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/JointExtraction/CompatibilityScaling.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/JointExtraction/CompatibilityScaling.lean new file mode 100644 index 0000000000000000000000000000000000000000..5dad68e47ba38f1beeea300d771b4162086cda9e --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/JointExtraction/CompatibilityScaling.lean @@ -0,0 +1,179 @@ +import OAI.LinearAlgebra.MatrixMultiplication.JointExtraction.CompatibilityEntropyBound +import OAI.LinearAlgebra.MatrixMultiplication.JointExtraction.AmbientRateLimit + +namespace OAI + +/-! Joint tensor extraction, compatibility and entropy estimates. -/ + +noncomputable section + +namespace MatrixMultiplication.JointCompatibilityScaling + +open MatrixMultiplication.Foundation JointTypeCounts JointCompatibilityIncidence +open JointCompatibilityEntropyBound Filter +open scoped BigOperators Topology + +attribute [local instance] Classical.propDecidable + +variable {C : Type*} [Fintype C] [DecidableEq C] +variable {Shape : C → Type*} + [∀ c, Fintype (Shape c)] [∀ c, DecidableEq (Shape c)] + +def baseSize (base : ∀ c, Shape c → ℕ) (c : C) : ℕ := ∑ a, base c a + +def baseTotal (base : ∀ c, Shape c → ℕ) : ℕ := ∑ c, baseSize base c + +def baseEntropy (base : ∀ c, Shape c → ℕ) : ℝ := + ∑ c, (baseSize base c : ℝ) * + finiteEntropy (fun a => (base c a : ℝ) / baseSize base c) + +def baseGroupSize (base : ∀ c, Shape c → ℕ) (d : ∀ c, Shape c → Prop) + (g : Σ c, Option (Shape c)) : ℕ := + ∑ a : {a : Shape g.1 // designatedGroup (d g.1) a = g.2}, base g.1 a.val + +def baseGroupedEntropy (base : ∀ c, Shape c → ℕ) (d : ∀ c, Shape c → Prop) + (H : (Σ c, Option (Shape c)) → ℝ) : ℝ := + ∑ g, (baseGroupSize base d g : ℝ) * H g + +omit [DecidableEq C] [∀ c, DecidableEq (Shape c)] in +theorem baseSize_le_baseTotal (base : ∀ c, Shape c → ℕ) (c : C) : + baseSize base c ≤ baseTotal base := + Finset.single_le_sum (fun _ _ => Nat.zero_le _) (Finset.mem_univ c) + +omit [DecidableEq C] in +theorem sum_baseGroupSize (base : ∀ c, Shape c → ℕ) + (d : ∀ c, Shape c → Prop) : + (∑ g, baseGroupSize base d g) = baseTotal base := by + simp only [baseGroupSize, baseTotal, Fintype.sum_sigma] + apply Finset.sum_congr rfl + intro c _ + exact Fintype.sum_fiberwise (designatedGroup (d c)) (base c) + +section Repeated + +variable (Pos : C → Type*) + [∀ c, Fintype (Pos c)] [∀ c, DecidableEq (Pos c)] + +omit [DecidableEq C] [∀ c, DecidableEq (Shape c)] [∀ c, DecidableEq (Pos c)] in +theorem classEntropy_repeated (base : ∀ c, Shape c → ℕ) (t : ℕ) (ht : 0 < t) + (hsize : ∀ c, Fintype.card (Pos c) = t * baseSize base c) : + classEntropy Pos Shape (fun c a => t * base c a) = (t : ℝ) * baseEntropy base := by + simp only [classEntropy, baseEntropy, hsize, Nat.cast_mul, Finset.mul_sum] + apply Finset.sum_congr rfl + intro c _ + rw [show (fun a => (t : ℝ) * base c a / ((t : ℝ) * baseSize base c)) = + (fun a => (base c a : ℝ) / baseSize base c) by + funext a + exact mul_div_mul_left _ _ (Nat.cast_ne_zero.mpr (Nat.ne_of_gt ht))] + ring + +omit [Fintype C] [DecidableEq C] [∀ c, DecidableEq (Pos c)] in +theorem groupPos_card_repeated (base : ∀ c, Shape c → ℕ) + (d : ∀ c, Shape c → Prop) (t : ℕ) + (w : FixedClassWords Pos Shape (fun c a => t * base c a)) + (g : Σ c, Option (Shape c)) : + Fintype.card (GroupPos (w g.1).val (d g.1) g.2) = + t * baseGroupSize base d g := by + calc + Fintype.card (GroupPos (w g.1).val (d g.1) g.2) = + Fintype.card (Σ a : {a : Shape g.1 // designatedGroup (d g.1) a = g.2}, + {i : Pos g.1 // (w g.1).val i = a.val}) := + Fintype.card_congr (Equiv.sigmaSubtypeFiberEquivSubtype (w g.1).val + (p := fun i => designatedGroup (d g.1) ((w g.1).val i) = g.2) + (q := fun a => designatedGroup (d g.1) a = g.2) (fun _ => Iff.rfl)).symm + _ = t * baseGroupSize base d g := by + simp only [Fintype.card_sigma] + change (∑ a : {a : Shape g.1 // designatedGroup (d g.1) a = g.2}, + wordPopulation (w g.1).val a.val) = _ + simp only [(w g.1).property, baseGroupSize, Finset.mul_sum] + +omit [DecidableEq C] [∀ c, DecidableEq (Pos c)] in +theorem groupedEntropy_repeated (base : ∀ c, Shape c → ℕ) + (d : ∀ c, Shape c → Prop) (t : ℕ) + (H : (Σ c, Option (Shape c)) → ℝ) + (w : FixedClassWords Pos Shape (fun c a => t * base c a)) : + groupedEntropy Pos Shape (fun c a => t * base c a) d H w = + (t : ℝ) * baseGroupedEntropy base d H := by + simp only [JointCompatibilityEntropyBound.groupedEntropy, groupPos_card_repeated, Nat.cast_mul, + baseGroupedEntropy, Finset.mul_sum, mul_assoc] + +end Repeated + +def typeErrorFactor (B t : ℕ) : ℝ := 1 + Real.log (t * B + 1 : ℕ) + +theorem typeErrorFactor_nonneg (B t : ℕ) : 0 ≤ typeErrorFactor B t := by + unfold typeErrorFactor + have hlog : 0 ≤ Real.log (t * B + 1 : ℕ) := + Real.log_nonneg (by exact_mod_cast Nat.succ_le_succ (Nat.zero_le (t * B))) + linarith + +def classErrorCoefficient (A : C → Type*) [∀ c, Fintype (A c)] : ℝ := + ∑ c, ((Fintype.card (A c) : ℝ) + 1) + +def groupErrorCoefficient (Shape A : C → Type*) + [∀ c, Fintype (Shape c)] [∀ c, Fintype (A c)] : ℝ := + ∑ g : Σ c, Option (Shape c), (2 * (Fintype.card (A g.1) : ℝ) + 1) + +omit [DecidableEq C] in +theorem classTypeError_le (Pos A : C → Type*) + [∀ c, Fintype (Pos c)] [∀ c, DecidableEq (Pos c)] + [∀ c, Fintype (A c)] [∀ c, DecidableEq (A c)] + (B t : ℕ) (hsize : ∀ c, Fintype.card (Pos c) ≤ t * B) : + classTypeError Pos A ≤ classErrorCoefficient A * typeErrorFactor B t := by + simp only [classTypeError, classErrorCoefficient, Finset.sum_mul] + apply Finset.sum_le_sum + intro c _ + apply mul_le_mul_of_nonneg_left _ (by positivity) + apply add_le_add_right + apply Real.log_le_log (by positivity) + exact_mod_cast Nat.succ_le_succ (hsize c) + +theorem wordTypeError_le (I A : Type*) [Fintype I] [Fintype A] + (B t : ℕ) (hsize : Fintype.card I ≤ t * B) : + wordTypeError I A ≤ (2 * (Fintype.card A : ℝ) + 1) * typeErrorFactor B t := by + have hlog : Real.log (Fintype.card I + 1 : ℕ) ≤ Real.log (t * B + 1 : ℕ) := + Real.log_le_log (by positivity) (by exact_mod_cast Nat.succ_le_succ hsize) + have h₁ := mul_le_mul_of_nonneg_left (add_le_add_left hlog 1) + (by positivity : (0 : ℝ) ≤ (Fintype.card A : ℝ) + 1) + have h₂ := mul_le_mul_of_nonneg_left hlog (Nat.cast_nonneg (Fintype.card A) : + (0 : ℝ) ≤ Fintype.card A) + unfold wordTypeError typeErrorFactor + nlinarith [show (0 : ℝ) ≤ Fintype.card A from Nat.cast_nonneg _] + +omit [DecidableEq C] in +theorem groupedTypeError_le (Pos A : C → Type*) + [∀ c, Fintype (Pos c)] [∀ c, DecidableEq (Pos c)] + [∀ c, Fintype (A c)] [∀ c, DecidableEq (A c)] + (counts : ∀ c, Shape c → ℕ) (d : ∀ c, Shape c → Prop) + (w : FixedClassWords Pos Shape counts) + (B t : ℕ) (hsize : ∀ c, Fintype.card (Pos c) ≤ t * B) : + groupedTypeError Pos Shape A counts d w ≤ + groupErrorCoefficient Shape A * typeErrorFactor B t := by + simp only [groupedTypeError, groupErrorCoefficient, Finset.sum_mul] + apply Finset.sum_le_sum + intro g _ + apply wordTypeError_le + exact (Fintype.card_subtype_le _).trans (hsize g.1) + +theorem tendsto_typeErrorFactor_div (B : ℕ) : + Tendsto (fun t : ℕ => typeErrorFactor B t / (t : ℝ)) atTop (𝓝 0) := by + have hratio : Tendsto (fun t : ℕ => ((t * B : ℕ) : ℝ) / (t : ℝ)) + atTop (𝓝 (B : ℝ)) := by + apply tendsto_const_nhds.congr' + filter_upwards [eventually_ne_atTop (0 : ℕ)] with t ht + simp only [Nat.cast_mul] + exact (mul_div_cancel_left₀ (B : ℝ) (Nat.cast_ne_zero.mpr ht)).symm + have hlog := JointAmbientRateLimit.tendsto_log_succ_div_nat_of_ratio hratio + have hinv : Tendsto (fun t : ℕ => (1 : ℝ) / t) atTop (𝓝 0) := + tendsto_const_nhds.div_atTop tendsto_natCast_atTop_atTop + simpa only [typeErrorFactor, add_div, add_zero] using hinv.add hlog + +theorem tendsto_mul_typeErrorFactor_div (K : ℝ) (B : ℕ) : + Tendsto (fun t : ℕ => K * typeErrorFactor B t / (t : ℝ)) atTop (𝓝 0) := by + simpa only [mul_div_assoc, mul_zero] using (tendsto_typeErrorFactor_div B).const_mul K + +end MatrixMultiplication.JointCompatibilityScaling + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/JointExtraction/ConditionalCountEntropy.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/JointExtraction/ConditionalCountEntropy.lean new file mode 100644 index 0000000000000000000000000000000000000000..6a25a84054bf11ad366770d753caab079b6d2318 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/JointExtraction/ConditionalCountEntropy.lean @@ -0,0 +1,112 @@ +import OAI.LinearAlgebra.MatrixMultiplication.JointExtraction.PopulationRates + +namespace OAI + +/-! Joint tensor extraction, compatibility and entropy estimates. -/ + +noncomputable section + +namespace MatrixMultiplication.JointConditionalCountEntropy + +open MatrixMultiplication.Foundation JointPopulationRates +open scoped BigOperators + +variable {U A : Type*} [Fintype U] [Fintype A] + +attribute [local instance] Classical.propDecidable + +def classCounts (n : U → ℕ) (f : U → A) (a : A) (u : U) : ℕ := + if f u = a then n u else 0 + +def classSize (n : U → ℕ) (f : U → A) (a : A) : ℕ := + ∑ u, classCounts n f a u + +theorem classSize_total (n : U → ℕ) (f : U → A) : + (∑ a, classSize n f a) = ∑ u, n u := by + classical + unfold classSize classCounts + rw [Finset.sum_comm] + simp + +theorem sum_masked_entropy (p : U → ℝ) (f : U → A) : + (∑ a, finiteEntropy (fun u => if f u = a then p u else 0)) = + finiteEntropy p := by + classical + have ht (a : A) (u : U) : + entropyTerm (if f u = a then p u else 0) = + if f u = a then entropyTerm (p u) else 0 := by + by_cases h : f u = a <;> simp [h] + simp only [finiteEntropy, ht] + rw [Finset.sum_comm] + simp + +theorem sum_classCounts_entropy (n : U → ℕ) (f : U → A) (scale : ℝ) : + (∑ a, finiteEntropy (fun u => (classCounts n f a u : ℝ) / scale)) = + finiteEntropy (fun u => (n u : ℝ) / scale) := by + classical + have hm (a : A) : + (fun u => (classCounts n f a u : ℝ) / scale) = + (fun u => if f u = a then (n u : ℝ) / scale else 0) := by + funext u + by_cases h : f u = a <;> simp [classCounts, h] + simp_rw [hm] + exact sum_masked_entropy _ f + +theorem sum_scaled_class_empirical_entropy (n : U → ℕ) (f : U → A) + (scale : ℝ) : + (∑ a, ((classSize n f a : ℝ) / scale) * + finiteEntropy (fun u => + (classCounts n f a u : ℝ) / (classSize n f a : ℝ))) = + finiteEntropy (fun u => (n u : ℝ) / scale) - + finiteEntropy (fun a => (classSize n f a : ℝ) / scale) := by + calc + _ = ∑ a, (finiteEntropy (fun u => (classCounts n f a u : ℝ) / scale) - + entropyTerm ((classSize n f a : ℝ) / scale)) := by + apply Finset.sum_congr rfl + intro a _ + exact weighted_empirical_entropy_eq (classCounts n f a) scale + _ = _ := by + rw [Finset.sum_sub_distrib, sum_classCounts_entropy] + rfl + +theorem sum_classSize_mul_empirical_entropy (n : U → ℕ) (f : U → A) : + (∑ a, (classSize n f a : ℝ) * + finiteEntropy (fun u => + (classCounts n f a u : ℝ) / (classSize n f a : ℝ))) = + (∑ u, n u : ℕ) * + (finiteEntropy (fun u => (n u : ℝ) / (∑ v, n v : ℕ)) - + finiteEntropy (fun a => (classSize n f a : ℝ) / (∑ v, n v : ℕ))) := by + have hclasses := sum_scaled_class_empirical_entropy n f 1 + have hjoint := weighted_empirical_entropy_eq n 1 + have hmarginal := weighted_empirical_entropy_eq (classSize n f) 1 + simp only [div_one] at hclasses hjoint hmarginal + rw [classSize_total] at hmarginal + rw [hclasses, mul_sub, hjoint, hmarginal] + ring + +theorem sum_classSize_mul_entropy_of_law (n : U → ℕ) (f : U → A) + (p : FiniteLaw U) (scale : ℝ) + (hn : ∀ u, (n u : ℝ) = scale * p.mass u) : + (∑ a, (classSize n f a : ℝ) * + finiteEntropy (fun u => + (classCounts n f a u : ℝ) / (classSize n f a : ℝ))) = + scale * (finiteEntropy p.mass - finiteEntropy (p.map f).mass) := by + classical + have hclass (a : A) : (classSize n f a : ℝ) = scale * (p.map f).mass a := by + rw [classSize, Nat.cast_sum, FiniteLaw.map_mass, Finset.mul_sum] + apply Finset.sum_congr rfl + intro u _ + by_cases h : f u = a <;> simp [classCounts, h, hn] + have h := sum_scaled_class_empirical_entropy n f 1 + simp only [div_one] at h + rw [h] + simp_rw [hn, hclass] + rw [finiteEntropy_scalar p.mass scale p.total, + finiteEntropy_scalar (p.map f).mass scale (p.map f).total] + ring + +end MatrixMultiplication.JointConditionalCountEntropy + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/JointExtraction/EntropyMax.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/JointExtraction/EntropyMax.lean new file mode 100644 index 0000000000000000000000000000000000000000..8ff15c6f0f5de4605b40351fdbf97335bac91025 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/JointExtraction/EntropyMax.lean @@ -0,0 +1,160 @@ +import OAI.LinearAlgebra.MatrixMultiplication.Entropy.ComplexEntropyContinuity +import Mathlib.Tactic.Linarith + +namespace OAI + +/-! Joint tensor extraction, compatibility and entropy estimates. -/ + +noncomputable section + +open scoped BigOperators +open MatrixMultiplication.Foundation + +namespace MatrixMultiplication.JointEntropyMax + +theorem entropy_nonneg {A : Type*} [Fintype A] (p : FiniteLaw A) : + 0 ≤ finiteEntropy p.mass := + FiniteLaw.entropy_nonneg p + +theorem map_entropy_le {A B : Type*} [Fintype A] [Fintype B] + (p : FiniteLaw A) (f : A → B) : + finiteEntropy (p.map f).mass ≤ finiteEntropy p.mass := + FiniteLaw.map_entropy_le p f + +theorem entropy_sub_map_nonneg {A B : Type*} [Fintype A] [Fintype B] + (p : FiniteLaw A) (f : A → B) : + 0 ≤ finiteEntropy p.mass - finiteEntropy (p.map f).mass := + sub_nonneg.mpr (map_entropy_le p f) + +theorem entropyTerm_le_crossEntropyTerm {p q : ℝ} (hp : 0 < p) (hq : 0 ≤ q) : + entropyTerm q ≤ -q * Real.log p + p - q := by + by_cases hzero : q = 0 + · simpa [hzero] using hp.le + have hqpos : 0 < q := lt_of_le_of_ne hq (Ne.symm hzero) + have hlog := Real.log_le_sub_one_of_pos (div_pos hp hqpos) + rw [Real.log_div hp.ne' hqpos.ne'] at hlog + have hmul := mul_le_mul_of_nonneg_left hlog hq + have hcancel : q * (p / q - 1) = p - q := by + field_simp + rw [hcancel] at hmul + unfold entropyTerm + linarith + +theorem entropy_le_crossEntropy {A : Type*} [Fintype A] + (p q : FiniteLaw A) (hp : ∀ a, 0 < p.mass a) : + finiteEntropy q.mass ≤ ∑ a, -q.mass a * Real.log (p.mass a) := by + calc + finiteEntropy q.mass ≤ + ∑ a, (-q.mass a * Real.log (p.mass a) + p.mass a - q.mass a) := + Finset.sum_le_sum fun a _ => entropyTerm_le_crossEntropyTerm (hp a) (q.nonneg a) + _ = ∑ a, -q.mass a * Real.log (p.mass a) := by + rw [Finset.sum_sub_distrib, Finset.sum_add_distrib, p.total, q.total] + ring + +theorem sum_mass_mul_coordinate {A B : Type*} [Fintype A] [Fintype B] + (p : FiniteLaw A) (f : A → B) (v : B → ℝ) : + (∑ a, p.mass a * v (f a)) = ∑ b, (p.map f).mass b * v b := by + classical + simp_rw [FiniteLaw.map_mass, Finset.sum_mul, ite_mul, zero_mul] + rw [Finset.sum_comm] + simp + +theorem sum_mass_mul_coordinate_eq {A B : Type*} [Fintype A] [Fintype B] + (p q : FiniteLaw A) (f : A → B) (v : B → ℝ) + (hmarginal : (q.map f).mass = (p.map f).mass) : + (∑ a, q.mass a * v (f a)) = ∑ a, p.mass a * v (f a) := by + rw [sum_mass_mul_coordinate q f v, sum_mass_mul_coordinate p f v, hmarginal] + +theorem entropy_le_of_three_marginals + {A X Y Z : Type*} [Fintype A] [Fintype X] [Fintype Y] [Fintype Z] + (p q : FiniteLaw A) (fX : A → X) (fY : A → Y) (fZ : A → Z) + (u : X → ℝ) (v : Y → ℝ) (w : Z → ℝ) (c : ℝ) + (hp : ∀ a, 0 < p.mass a) + (hlog : ∀ a, Real.log (p.mass a) = u (fX a) + v (fY a) + w (fZ a) - c) + (hX : (q.map fX).mass = (p.map fX).mass) + (hY : (q.map fY).mass = (p.map fY).mass) + (hZ : (q.map fZ).mass = (p.map fZ).mass) : + finiteEntropy q.mass ≤ finiteEntropy p.mass := by + have hx := sum_mass_mul_coordinate_eq p q fX u hX + have hy := sum_mass_mul_coordinate_eq p q fY v hY + have hz := sum_mass_mul_coordinate_eq p q fZ w hZ + have hexpand (r : FiniteLaw A) : + (∑ a, r.mass a * (u (fX a) + v (fY a) + w (fZ a) - c)) = + (∑ a, r.mass a * u (fX a)) + (∑ a, r.mass a * v (fY a)) + + (∑ a, r.mass a * w (fZ a)) - c := by + simp_rw [mul_sub, mul_add] + rw [Finset.sum_sub_distrib, Finset.sum_add_distrib, Finset.sum_add_distrib, + ← Finset.sum_mul, r.total, one_mul] + have hexpect : (∑ a, q.mass a * Real.log (p.mass a)) = + ∑ a, p.mass a * Real.log (p.mass a) := by + simp_rw [hlog] + rw [hexpand q, hexpand p, hx, hy, hz] + calc + finiteEntropy q.mass ≤ ∑ a, -q.mass a * Real.log (p.mass a) := + entropy_le_crossEntropy p q hp + _ = -(∑ a, q.mass a * Real.log (p.mass a)) := by + simp only [neg_mul, Finset.sum_neg_distrib] + _ = -(∑ a, p.mass a * Real.log (p.mass a)) := by rw [hexpect] + _ = finiteEntropy p.mass := by + simp only [finiteEntropy, entropyTerm, neg_mul, Finset.sum_neg_distrib] + +def normalizedPositiveLaw {A : Type*} [Fintype A] [Nonempty A] + (weight : A → ℝ) (hweight : ∀ a, 0 < weight a) : FiniteLaw A where + mass a := weight a / ∑ b, weight b + nonneg a := div_nonneg (hweight a).le + (Finset.sum_nonneg fun b _ => (hweight b).le) + total := by + have htotal : 0 < ∑ b, weight b := + Finset.sum_pos (fun b _ => hweight b) Finset.univ_nonempty + rw [← Finset.sum_div, div_self htotal.ne'] + +theorem normalizedPositiveLaw_mass_pos {A : Type*} [Fintype A] [Nonempty A] + (weight : A → ℝ) (hweight : ∀ a, 0 < weight a) (a : A) : + 0 < (normalizedPositiveLaw weight hweight).mass a := by + exact div_pos (hweight a) + (Finset.sum_pos (fun b _ => hweight b) Finset.univ_nonempty) + +theorem entropy_le_normalized_product + {A X Y Z : Type*} [Fintype A] [Nonempty A] + [Fintype X] [Fintype Y] [Fintype Z] + (fX : A → X) (fY : A → Y) (fZ : A → Z) + (wx : X → ℝ) (wy : Y → ℝ) (wz : Z → ℝ) + (hx : ∀ x, 0 < wx x) (hy : ∀ y, 0 < wy y) (hz : ∀ z, 0 < wz z) + (q : FiniteLaw A) + (hX : (q.map fX).mass = + ((normalizedPositiveLaw (fun a => wx (fX a) * wy (fY a) * wz (fZ a)) + (fun _ => mul_pos (mul_pos (hx _) (hy _)) (hz _))).map fX).mass) + (hY : (q.map fY).mass = + ((normalizedPositiveLaw (fun a => wx (fX a) * wy (fY a) * wz (fZ a)) + (fun _ => mul_pos (mul_pos (hx _) (hy _)) (hz _))).map fY).mass) + (hZ : (q.map fZ).mass = + ((normalizedPositiveLaw (fun a => wx (fX a) * wy (fY a) * wz (fZ a)) + (fun _ => mul_pos (mul_pos (hx _) (hy _)) (hz _))).map fZ).mass) : + finiteEntropy q.mass ≤ + finiteEntropy (normalizedPositiveLaw + (fun a => wx (fX a) * wy (fY a) * wz (fZ a)) + (fun _ => mul_pos (mul_pos (hx _) (hy _)) (hz _))).mass := by + let weight : A → ℝ := fun a => wx (fX a) * wy (fY a) * wz (fZ a) + have hweight : ∀ a, 0 < weight a := fun a => mul_pos (mul_pos (hx _) (hy _)) (hz _) + let p := normalizedPositiveLaw weight hweight + have htotal : 0 < ∑ a, weight a := + Finset.sum_pos (fun a _ => hweight a) Finset.univ_nonempty + apply entropy_le_of_three_marginals p q fX fY fZ + (fun x => Real.log (wx x)) (fun y => Real.log (wy y)) + (fun z => Real.log (wz z)) (Real.log (∑ a, weight a)) + (normalizedPositiveLaw_mass_pos weight hweight) + · intro a + change Real.log (weight a / ∑ b, weight b) = _ + rw [Real.log_div (hweight a).ne' htotal.ne'] + dsimp only [weight] + rw [Real.log_mul (mul_pos (hx _) (hy _)).ne' (hz _).ne', + Real.log_mul (hx _).ne' (hy _).ne'] + · exact hX + · exact hY + · exact hZ + +end MatrixMultiplication.JointEntropyMax + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/JointExtraction/Extraction.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/JointExtraction/Extraction.lean new file mode 100644 index 0000000000000000000000000000000000000000..3aa190dfe54eb01a2f844ea21550ac0fa2f86890 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/JointExtraction/Extraction.lean @@ -0,0 +1,138 @@ +import OAI.LinearAlgebra.MatrixMultiplication.Tensor.ComplexTensor + +namespace OAI + +/-! Joint tensor extraction, compatibility and entropy estimates. -/ + +namespace MatrixMultiplication.JointExtraction + +open MatrixMultiplication.Foundation + +variable {F X Y Z I : Type*} [CommSemiring F] + +structure Assignment (X Y Z I : Type*) where + x : X → Option I + y : Y → Option I + z : Z → Option I + +noncomputable def uniqueAssignment {A : Type*} (eligible : Finset I) + (compatible : I → A → Prop) (v : A) : Option I := by + classical + exact if h : ∃ i, i ∈ eligible ∧ compatible i v ∧ + ∀ j, j ∈ eligible → compatible j v → j = i + then some (Classical.choose h) else none + +theorem uniqueAssignment_spec {A : Type*} (eligible : Finset I) + (compatible : I → A → Prop) (v : A) (i : I) + (h : uniqueAssignment eligible compatible v = some i) : + i ∈ eligible ∧ compatible i v ∧ + ∀ j, j ∈ eligible → compatible j v → j = i := by + classical + unfold uniqueAssignment at h + split_ifs at h with hex + · have hi : Classical.choose hex = i := Option.some.inj h + simpa only [hi] using Classical.choose_spec hex + +theorem uniqueAssignment_unique {A : Type*} (eligible : Finset I) + (compatible : I → A → Prop) (v : A) (i j : I) + (hi : uniqueAssignment eligible compatible v = some i) + (hj : j ∈ eligible) (hc : compatible j v) : i = j := + ((uniqueAssignment_spec eligible compatible v i hi).2.2 j hj hc).symm + +noncomputable def retainAssignment {A : Type*} (f : A → Option I) + (keep : A → Prop) (v : A) : Option I := by + classical + exact if keep v then f v else none + +theorem retainAssignment_some {A : Type*} (f : A → Option I) + (keep : A → Prop) (v : A) (i : I) + (h : retainAssignment f keep v = some i) : f v = some i := by + classical + unfold retainAssignment at h + split_ifs at h + · exact h + +def Coherent (T : Tensor F X Y Z) (a : Assignment X Y Z I) : Prop := + ∀ x y z i j k, T x y z ≠ 0 → + a.x x = some i → a.y y = some j → a.z z = some k → i = j ∧ i = k + +theorem coherent_of_sequential + (T : Tensor F X Y Z) (a : Assignment X Y Z I) + (compatibleY : I → Y → Prop) (compatibleZ : I → Z → Prop) + (transferY : ∀ x y z i, T x y z ≠ 0 → a.x x = some i → compatibleY i y) + (transferZ : ∀ x y z i, T x y z ≠ 0 → + a.x x = some i → a.y y = some i → compatibleZ i z) + (uniqueY : ∀ y j i, a.y y = some j → compatibleY i y → j = i) + (uniqueZ : ∀ z k i, a.z z = some k → compatibleZ i z → k = i) : + Coherent T a := by + intro x y z i j k hT hx hy hz + have hji : j = i := uniqueY y j i hy (transferY x y z i hT hx) + have hki : k = i := uniqueZ z k i hz + (transferZ x y z i hT hx (hji ▸ hy)) + exact ⟨hji.symm, hki.symm⟩ + +noncomputable def branch (T : Tensor F X Y Z) (a : Assignment X Y Z I) + (i : I) : Tensor F X Y Z := by + classical + exact fun x y z => if a.x x = some i ∧ a.y y = some i ∧ a.z z = some i + then T x y z else 0 + +noncomputable def assignmentMatrix {A : Type*} (f : A → Option I) : + (I × A) → A → F := by + classical + exact fun p a => if a = p.2 ∧ f a = some p.1 then 1 else 0 + +theorem restrict_assignments_apply [Fintype X] [Fintype Y] [Fintype Z] [DecidableEq I] + (T : Tensor F X Y Z) (a : Assignment X Y Z I) + (x : I × X) (y : I × Y) (z : I × Z) : + Tensor.restrict (assignmentMatrix a.x) (assignmentMatrix a.y) + (assignmentMatrix a.z) T x y z = + if a.x x.2 = some x.1 ∧ a.y y.2 = some y.1 ∧ a.z z.2 = some z.1 + then T x.2 y.2 z.2 else 0 := by + classical + simp [Tensor.restrict, assignmentMatrix, ite_and, ite_mul, mul_ite] + split_ifs <;> simp_all + +theorem restrict_assignments_eq_directSum + [Fintype X] [Fintype Y] [Fintype Z] [DecidableEq I] + (T : Tensor F X Y Z) (a : Assignment X Y Z I) (h : Coherent T a) : + Tensor.restrict (assignmentMatrix a.x) (assignmentMatrix a.y) + (assignmentMatrix a.z) T = Tensor.directSum (branch T a) := by + classical + funext x y z + rw [restrict_assignments_apply] + by_cases hx : x.1 = y.1 + · by_cases hz : x.1 = z.1 + · simp [Tensor.directSum, branch, ← hx, ← hz] + · by_cases ht : T x.2 y.2 z.2 = 0 + · simp [Tensor.directSum, hz, ht] + · have hn : ¬ (a.x x.2 = some x.1 ∧ a.y y.2 = some y.1 ∧ + a.z z.2 = some z.1) := by + intro ha + exact hz (h _ _ _ _ _ _ ht ha.1 ha.2.1 ha.2.2).2 + simp [Tensor.directSum, hz, hn] + · by_cases ht : T x.2 y.2 z.2 = 0 + · simp [Tensor.directSum, hx, ht] + · have hn : ¬ (a.x x.2 = some x.1 ∧ a.y y.2 = some y.1 ∧ + a.z z.2 = some z.1) := by + intro ha + exact hx (h _ _ _ _ _ _ ht ha.1 ha.2.1 ha.2.2).1 + simp [Tensor.directSum, hx, hn] + +theorem rankAtMost_directSum_branches + [Fintype X] [Fintype Y] [Fintype Z] [DecidableEq I] + (T : Tensor F X Y Z) (a : Assignment X Y Z I) (h : Coherent T a) + {r : ℕ} (hT : Tensor.RankAtMost T r) : + Tensor.RankAtMost (Tensor.directSum (branch T a)) r := by + rw [← restrict_assignments_eq_directSum T a h] + exact hT.restrict _ _ _ + +theorem coherent_of_support_subset (T S : Tensor F X Y Z) + (a : Assignment X Y Z I) (h : Coherent T a) + (hs : ∀ x y z, S x y z ≠ 0 → T x y z ≠ 0) : Coherent S a := by + intro x y z i j k hS hx hy hz + exact h x y z i j k (hs x y z hS) hx hy hz + +end MatrixMultiplication.JointExtraction + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/JointExtraction/ExtractionRates.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/JointExtraction/ExtractionRates.lean new file mode 100644 index 0000000000000000000000000000000000000000..9140b65de5a6f10e48a8bae6c96d46ae3d225f37 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/JointExtraction/ExtractionRates.lean @@ -0,0 +1,398 @@ +import OAI.LinearAlgebra.MatrixMultiplication.Entropy.ComplexSeparationAsymptotics +import OAI.LinearAlgebra.MatrixMultiplication.JointExtraction.APFree +import Mathlib.Algebra.Order.Floor.Semiring +import Mathlib.Analysis.SpecialFunctions.Exp + +namespace OAI + +/-! Joint tensor extraction, compatibility and entropy estimates. -/ + +noncomputable section + +namespace MatrixMultiplication.JointExtractionRates + +open Filter +open scoped BigOperators Topology + +def goodCount {Ω E : Type*} [Fintype E] (good : Ω → E → Prop) (ω : Ω) : ℕ := by + classical + exact (Finset.univ.filter (good ω)).card + +def goodIncidence {Ω E : Type*} [Fintype Ω] (good : Ω → E → Prop) (e : E) : ℕ := by + classical + exact (Finset.univ.filter (fun ω => good ω e)).card + +theorem sum_goodCount_eq_sum_goodIncidence {Ω E : Type*} [Fintype Ω] [Fintype E] + (good : Ω → E → Prop) : + (∑ ω, goodCount good ω) = ∑ e, goodIncidence good e := by + classical + simp only [goodCount, goodIncidence, Finset.card_filter] + exact Finset.sum_comm + +theorem exists_goodCount_ge {Ω E : Type*} [Fintype Ω] [Nonempty Ω] [Fintype E] + (good : Ω → E → Prop) (q : ℝ) + (hinc : ∀ e, q * (Fintype.card Ω : ℝ) ≤ (goodIncidence good e : ℝ)) : + ∃ ω, (Fintype.card E : ℝ) * q ≤ (goodCount good ω : ℝ) := by + have hsum := Finset.sum_le_sum (fun e (_ : e ∈ Finset.univ) => hinc e) + have hdouble : (∑ ω, (goodCount good ω : ℝ)) = + ∑ e, (goodIncidence good e : ℝ) := by + exact_mod_cast sum_goodCount_eq_sum_goodIncidence good + have havg : (∑ _ω : Ω, (Fintype.card E : ℝ) * q) ≤ + ∑ ω, (goodCount good ω : ℝ) := by + rw [hdouble] + simpa only [Finset.sum_const, Finset.card_univ, nsmul_eq_mul, mul_assoc, + mul_comm, mul_left_comm] using hsum + obtain ⟨ω, _, hω⟩ := Finset.exists_le_of_sum_le Finset.univ_nonempty havg + exact ⟨ω, hω⟩ + +theorem exists_good_subfamily {Ω E : Type*} [Fintype E] + (good : Ω → E → Prop) (ω : Ω) (K : ℕ) (hK : K ≤ goodCount good ω) : + ∃ G : Finset E, G.card = K ∧ ∀ e ∈ G, good ω e := by + classical + obtain ⟨G, hG, hcard⟩ := Finset.exists_subset_card_eq + (s := Finset.univ.filter (good ω)) (by simpa only [goodCount] using hK) + exact ⟨G, hcard, fun e he => (Finset.mem_filter.mp (hG he)).2⟩ + +theorem eventually_exists_good_subfamily {Ω E : ℕ → Type*} + [∀ N, Fintype (E N)] + (good : ∀ N, Ω N → E N → Prop) (K : ℕ → ℕ) + (hK : ∀ᶠ N in atTop, ∃ ω : Ω N, K N ≤ goodCount (good N) ω) : + ∀ᶠ N in atTop, ∃ (ω : Ω N) (G : Finset (E N)), + G.card = K N ∧ ∀ e ∈ G, good N ω e := by + filter_upwards [hK] with N hN + obtain ⟨ω, hω⟩ := hN + obtain ⟨G, hcard, hgood⟩ := exists_good_subfamily (good N) ω (K N) hω + exact ⟨ω, G, hcard, hgood⟩ + +theorem incidence_lower_of_survival_and_loss {Ω E : Type*} [Fintype Ω] + (survives bad : Ω → E → Prop) (e : E) (s ε : ℝ) + (hs : s * (Fintype.card Ω : ℝ) ≤ (goodIncidence survives e : ℝ)) + (hb : (goodIncidence (fun ω e => survives ω e ∧ bad ω e) e : ℝ) ≤ + s * ε * (Fintype.card Ω : ℝ)) : + s * (1 - ε) * (Fintype.card Ω : ℝ) ≤ + (goodIncidence (fun ω e => survives ω e ∧ ¬ bad ω e) e : ℝ) := by + classical + have hsplit : goodIncidence (fun ω e => survives ω e ∧ bad ω e) e + + goodIncidence (fun ω e => survives ω e ∧ ¬ bad ω e) e = + goodIncidence survives e := by + simp only [goodIncidence, Finset.card_filter, ← Finset.sum_add_distrib] + apply Finset.sum_congr rfl + intro ω _ + by_cases hs : survives ω e <;> by_cases hb : bad ω e <;> simp [hs, hb] + have hsplitR : + (goodIncidence (fun ω e => survives ω e ∧ bad ω e) e : ℝ) + + (goodIncidence (fun ω e => survives ω e ∧ ¬ bad ω e) e : ℝ) = + (goodIncidence survives e : ℝ) := by + exact_mod_cast hsplit + nlinarith + +theorem exists_goodCount_ge_half_survival {Ω E : Type*} + [Fintype Ω] [Nonempty Ω] [Fintype E] + (survives bad : Ω → E → Prop) (s ε : ℝ) (hs₀ : 0 ≤ s) (hε : ε ≤ 1 / 2) + (hs : ∀ e, s * (Fintype.card Ω : ℝ) ≤ (goodIncidence survives e : ℝ)) + (hb : ∀ e, (goodIncidence (fun ω e => survives ω e ∧ bad ω e) e : ℝ) ≤ + s * ε * (Fintype.card Ω : ℝ)) : + ∃ ω, (Fintype.card E : ℝ) * (s / 2) ≤ + (goodCount (fun ω e => survives ω e ∧ ¬ bad ω e) ω : ℝ) := by + apply exists_goodCount_ge + intro e + have h := incidence_lower_of_survival_and_loss survives bad e s ε (hs e) (hb e) + have hc : (0 : ℝ) ≤ Fintype.card Ω := Nat.cast_nonneg _ + have hm := mul_le_mul_of_nonneg_right (mul_le_mul_of_nonneg_left hε hs₀) hc + nlinarith + +theorem tendsto_polynomial_mul_exp_neg (d : ℕ) {c : ℝ} (hc : 0 < c) : + Tendsto (fun N : ℕ => ((N : ℝ) + 1) ^ d * Real.exp (-c * (N : ℝ))) + atTop (𝓝 0) := by + have hbase := (Real.summable_pow_mul_exp_neg_nat_mul d hc).tendsto_atTop_zero + have hshift := (hbase.comp (tendsto_add_atTop_nat 1)).mul_const (Real.exp c) + simp only [zero_mul, Function.comp_apply, Nat.cast_add, Nat.cast_one] at hshift + convert hshift using 1 + ext N + rw [mul_assoc, ← Real.exp_add] + congr 2 + ring + +theorem eventually_error_le_half {error : ℕ → ℝ} (B : ℝ) (d : ℕ) + {c : ℝ} (hc : 0 < c) + (hbound : ∀ᶠ N in atTop, + error N ≤ B * (((N : ℝ) + 1) ^ d * Real.exp (-c * (N : ℝ)))) : + ∀ᶠ N in atTop, error N ≤ 1 / 2 := by + have hlim := (tendsto_polynomial_mul_exp_neg d hc).const_mul B + have hsmall : ∀ᶠ N : ℕ in atTop, + B * (((N : ℝ) + 1) ^ d * Real.exp (-c * (N : ℝ))) < 1 / 2 := by + simpa only [mul_zero] using (tendsto_order.1 hlim).2 (1 / 2) (by simp) + filter_upwards [hbound, hsmall] with N hb hs + exact hb.trans hs.le + +theorem tendsto_log_one_sub_error_div_nat {error : ℕ → ℝ} + (herror : Tendsto error atTop (𝓝 0)) : + Tendsto (fun N => Real.log (1 - error N) / (N : ℝ)) atTop (𝓝 0) := by + have hone : Tendsto (fun N => 1 - error N) atTop (𝓝 (1 : ℝ)) := by + simpa using (tendsto_const_nhds : + Tendsto (fun _ : ℕ => (1 : ℝ)) atTop (𝓝 1)).sub herror + exact (hone.log one_ne_zero).div_atTop tendsto_natCast_atTop_atTop + +def hashModulus (H : ℝ) (N : ℕ) : ℕ := + 37 ^ (⌊(N : ℝ) * H / Real.log 37⌋₊ + 1) + +theorem hashModulus_ge (H : ℝ) (N : ℕ) : 37 ≤ hashModulus H N := by + simpa only [hashModulus, pow_one] using + (Nat.pow_le_pow_right (by norm_num : 0 < 37) + (show 1 ≤ ⌊(N : ℝ) * H / Real.log 37⌋₊ + 1 by omega)) + +theorem hashModulus_log_bounds {H : ℝ} (hH : 0 ≤ H) (N : ℕ) : + (N : ℝ) * H ≤ Real.log (hashModulus H N : ℝ) ∧ + Real.log (hashModulus H N : ℝ) ≤ (N : ℝ) * H + Real.log 37 := by + have hl : 0 < Real.log (37 : ℝ) := Real.log_pos (by norm_num) + have harg : 0 ≤ (N : ℝ) * H / Real.log 37 := + div_nonneg (mul_nonneg (Nat.cast_nonneg N) hH) hl.le + have hfloor := mul_le_mul_of_nonneg_right (Nat.floor_le harg) hl.le + have hceil := mul_lt_mul_of_pos_right + (Nat.lt_floor_add_one ((N : ℝ) * H / Real.log 37)) hl + have hcancel : (N : ℝ) * H / Real.log 37 * Real.log 37 = (N : ℝ) * H := + div_mul_cancel₀ _ hl.ne' + simp only [hashModulus, Nat.cast_pow, Real.log_pow, Nat.cast_add, Nat.cast_one] + constructor <;> nlinarith + +theorem tendsto_log_hashModulus_div_nat {H : ℝ} (hH : 0 ≤ H) : + Tendsto (fun N => Real.log (hashModulus H N : ℝ) / (N : ℝ)) + atTop (𝓝 H) := by + have hc : Tendsto (fun N : ℕ => Real.log 37 / (N : ℝ)) atTop (𝓝 0) := + tendsto_const_nhds.div_atTop tendsto_natCast_atTop_atTop + have hu : Tendsto (fun N : ℕ => H + Real.log 37 / (N : ℝ)) atTop (𝓝 H) := by + simpa only [add_zero] using hc.const_add H + apply tendsto_of_tendsto_of_tendsto_of_le_of_le' tendsto_const_nhds hu + · filter_upwards [eventually_ge_atTop (1 : ℕ)] with N hN + have hNr : (0 : ℝ) < N := by exact_mod_cast hN + apply (le_div_iff₀ hNr).2 + nlinarith [(hashModulus_log_bounds hH N).1] + · filter_upwards [eventually_ge_atTop (1 : ℕ)] with N hN + have hNr : (0 : ℝ) < N := by exact_mod_cast hN + have hb := div_le_div_of_nonneg_right (hashModulus_log_bounds hH N).2 hNr.le + simpa only [add_div, mul_div_cancel_left₀ H hNr.ne'] using hb + +theorem eventual_log_upper_of_error {degree : ℕ → ℕ} {error : ℕ → ℝ} {D : ℝ} + (herror : Tendsto (fun N => error N / (N : ℝ)) atTop (𝓝 0)) + (hbound : ∀ᶠ N in atTop, + Real.log (degree N : ℝ) ≤ (N : ℝ) * D + error N) + {η : ℝ} (hη : 0 < η) : + ∀ᶠ N in atTop, Real.log (degree N : ℝ) / (N : ℝ) ≤ D + η := by + filter_upwards [hbound, (tendsto_order.1 herror).2 η hη, + eventually_ge_atTop (1 : ℕ)] with N hb he hN + have hNr : (0 : ℝ) < N := by exact_mod_cast hN + have hd := div_le_div_of_nonneg_right hb hNr.le + rw [add_div, mul_div_cancel_left₀ D hNr.ne'] at hd + linarith + +theorem eventually_ratio_le_exp_neg_of_log_bounds {degree M : ℕ → ℕ} {D H c : ℝ} + (hdegree : ∀ η : ℝ, 0 < η → + ∀ᶠ N in atTop, Real.log (degree N : ℝ) / (N : ℝ) ≤ D + η) + (hpos : ∀ᶠ N in atTop, 0 < M N) + (hM : Tendsto (fun N => Real.log (M N : ℝ) / (N : ℝ)) atTop (𝓝 H)) + (hc : c < H - D) : + ∀ᶠ N in atTop, (degree N : ℝ) / (M N : ℝ) ≤ Real.exp (-c * (N : ℝ)) := by + let η : ℝ := (H - D - c) / 3 + have hη : 0 < η := by dsimp [η]; linarith + filter_upwards [hdegree η hη, hpos, + (tendsto_order.1 hM).1 (H - η) (by linarith), + eventually_ge_atTop (1 : ℕ)] with N hd hp hm hN + by_cases hz : degree N = 0 + · simp only [hz, Nat.cast_zero, zero_div] + exact (Real.exp_pos _).le + have hdpos : (0 : ℝ) < degree N := by + exact_mod_cast Nat.pos_of_ne_zero hz + have hmpos : (0 : ℝ) < M N := by exact_mod_cast hp + have hNr : (0 : ℝ) < N := by exact_mod_cast hN + have hdu := (div_le_iff₀ hNr).mp hd + have hml := (lt_div_iff₀ hNr).mp hm + have hcoefficient : D - H + 2 * η ≤ -c := by dsimp [η]; linarith + have hscaled := mul_le_mul_of_nonneg_right hcoefficient hNr.le + have hdiff : Real.log (degree N : ℝ) - Real.log (M N : ℝ) ≤ + -c * (N : ℝ) := by nlinarith + calc + _ = Real.exp (Real.log (degree N : ℝ) - Real.log (M N : ℝ)) := by + rw [Real.exp_sub, Real.exp_log hdpos, Real.exp_log hmpos] + _ ≤ _ := Real.exp_le_exp.mpr hdiff + +theorem eventually_degree_div_hashModulus_le_exp {degree : ℕ → ℕ} {D H c : ℝ} + (hH : 0 ≤ H) + (hdegree : ∀ η : ℝ, 0 < η → + ∀ᶠ N in atTop, Real.log (degree N : ℝ) / (N : ℝ) ≤ D + η) + (hc : c < H - D) : + ∀ᶠ N in atTop, (degree N : ℝ) / (hashModulus H N : ℝ) ≤ + Real.exp (-c * (N : ℝ)) := by + apply eventually_ratio_le_exp_neg_of_log_bounds hdegree _ + (tendsto_log_hashModulus_div_nat hH) hc + exact Eventually.of_forall fun N => + lt_of_lt_of_le (by decide : 0 < 37) (hashModulus_ge H N) + +theorem tendsto_sqrt_div_nat_of_div_nat {a : ℕ → ℝ} {A : ℝ} + (ha : ∀ N, 0 ≤ a N) + (h : Tendsto (fun N => a N / (N : ℝ)) atTop (𝓝 A)) : + Tendsto (fun N => Real.sqrt (a N) / (N : ℝ)) atTop (𝓝 0) := by + have hinv : Tendsto (fun N : ℕ => 1 / (N : ℝ)) atTop (𝓝 0) := + tendsto_const_nhds.div_atTop tendsto_natCast_atTop_atTop + have hp := h.sqrt.mul hinv.sqrt + simp only [Real.sqrt_zero, mul_zero] at hp + convert hp using 1 + ext N + symm + rw [Real.sqrt_div (ha N), Real.sqrt_div (by norm_num : (0 : ℝ) ≤ 1), + Real.sqrt_one, div_mul_div_comm, mul_one, Real.mul_self_sqrt (Nat.cast_nonneg N)] + +theorem tendsto_log_modularSet_card_div_nat {M : ℕ → ℕ} {H : ℝ} + (hM : ∀ᶠ N in atTop, 2 ≤ M N) + (hlog : Tendsto (fun N => Real.log (M N : ℝ) / (N : ℝ)) atTop (𝓝 H)) : + Tendsto (fun N => Real.log ((JointAPFree.modularSet (M N)).card : ℝ) / (N : ℝ)) + atTop (𝓝 H) := by + have hsqrt := tendsto_sqrt_div_nat_of_div_nat + (fun N => Real.log_natCast_nonneg (M N)) hlog + have hconst : Tendsto (fun N : ℕ => Real.log 3 / (N : ℝ)) atTop (𝓝 0) := + tendsto_const_nhds.div_atTop tendsto_natCast_atTop_atTop + have hlower : Tendsto (fun N => + (Real.log (M N : ℝ) - Real.log 3 - + 4 * Real.sqrt (Real.log (M N : ℝ))) / (N : ℝ)) + atTop (𝓝 H) := by + have h := (hlog.sub hconst).sub (hsqrt.const_mul 4) + simp only [mul_zero, sub_zero] at h + apply h.congr + intro N + ring + apply tendsto_of_tendsto_of_tendsto_of_le_of_le' hlower hlog + · filter_upwards [hM] with N hN + exact div_le_div_of_nonneg_right + (JointAPFree.modularSet_log_card_lower_modulus hN) (Nat.cast_nonneg N) + · filter_upwards [hM] with N hN + exact div_le_div_of_nonneg_right + (JointAPFree.modularSet_log_card_le_modulus hN) (Nat.cast_nonneg N) + +theorem tendsto_log_yield_lower {T U M : ℕ → ℕ} {A B C : ℝ} + (hT : Tendsto (fun N => Real.log (T N : ℝ) / (N : ℝ)) atTop (𝓝 A)) + (hU : Tendsto (fun N => Real.log (U N : ℝ) / (N : ℝ)) atTop (𝓝 B)) + (hM : Tendsto (fun N => Real.log (M N : ℝ) / (N : ℝ)) atTop (𝓝 C)) : + Tendsto (fun N => + (Real.log (T N : ℝ) + Real.log (U N : ℝ) - + 2 * Real.log (M N : ℝ) - Real.log 2) / (N : ℝ)) + atTop (𝓝 (A + B - 2 * C)) := by + have hconst : Tendsto (fun N : ℕ => Real.log 2 / (N : ℝ)) atTop (𝓝 0) := + tendsto_const_nhds.div_atTop tendsto_natCast_atTop_atTop + have h := ((hT.add hU).sub (hM.const_mul 2)).sub hconst + simp only [sub_zero] at h + apply h.congr + intro N + ring + +theorem exp_log_yield_lower {T U M : ℕ} (hT : 0 < T) (hU : 0 < U) (hM : 0 < M) : + Real.exp (Real.log (T : ℝ) + Real.log (U : ℝ) - + 2 * Real.log (M : ℝ) - Real.log 2) = + (T : ℝ) * ((U : ℝ) / (M : ℝ) ^ 2 / 2) := by + have hTr : (0 : ℝ) < T := by exact_mod_cast hT + have hUr : (0 : ℝ) < U := by exact_mod_cast hU + have hMr : (0 : ℝ) < M := by exact_mod_cast hM + rw [Real.exp_sub, Real.exp_sub, Real.exp_add, Real.exp_log hTr, + Real.exp_log hUr, Real.exp_log (by norm_num : (0 : ℝ) < 2)] + rw [show 2 * Real.log (M : ℝ) = Real.log ((M : ℝ) ^ 2) by + rw [Real.log_pow]; norm_num, Real.exp_log (pow_pos hMr 2)] + ring + +theorem eventually_floor_exp_le_of_log_lower {Y : ℕ → ℕ} {L : ℕ → ℝ} {R : ℝ} + (hL : Tendsto (fun N => L N / (N : ℝ)) atTop (𝓝 R)) + (hY : ∀ᶠ N in atTop, Real.exp (L N) ≤ (Y N : ℝ)) + {ε : ℝ} (hε : 0 < ε) : + ∀ᶠ N : ℕ in atTop, ⌊Real.exp ((N : ℝ) * (R - ε))⌋₊ ≤ Y N := by + filter_upwards [(tendsto_order.1 hL).1 (R - ε) (by linarith), hY, + (eventually_atTop.2 ⟨1, fun N (hN : 1 ≤ N) => hN⟩)] with N hrate hy hN + have hNr : (0 : ℝ) < N := by exact_mod_cast hN + have hexp : Real.exp ((N : ℝ) * (R - ε)) ≤ (Y N : ℝ) := by + apply le_trans (Real.exp_le_exp.mpr ?_) hy + have hm := (lt_div_iff₀ hNr).mp hrate + nlinarith + simpa only [Nat.floor_natCast] using Nat.floor_le_floor hexp + +theorem eventually_exists_many_good + {Ω E : ℕ → Type*} [∀ N, Fintype (Ω N)] [∀ N, Nonempty (Ω N)] + [∀ N, Fintype (E N)] + (good : ∀ N, Ω N → E N → Prop) (U M : ℕ → ℕ) {A H : ℝ} + (hpos : ∀ᶠ N in atTop, 0 < Fintype.card (E N) ∧ 0 < U N ∧ 0 < M N) + (hinc : ∀ᶠ N in atTop, ∀ e, + ((U N : ℝ) / (M N : ℝ) ^ 2 / 2) * (Fintype.card (Ω N) : ℝ) ≤ + (goodIncidence (good N) e : ℝ)) + (hE : Tendsto (fun N => Real.log (Fintype.card (E N) : ℝ) / (N : ℝ)) + atTop (𝓝 A)) + (hU : Tendsto (fun N => Real.log (U N : ℝ) / (N : ℝ)) atTop (𝓝 H)) + (hM : Tendsto (fun N => Real.log (M N : ℝ) / (N : ℝ)) atTop (𝓝 H)) + {ε : ℝ} (hε : 0 < ε) : + ∀ᶠ N in atTop, ∃ ω : Ω N, + ⌊Real.exp ((N : ℝ) * (A - H - ε))⌋₊ ≤ goodCount (good N) ω := by + let L : ℕ → ℝ := fun N => Real.log (Fintype.card (E N) : ℝ) + + Real.log (U N : ℝ) - 2 * Real.log (M N : ℝ) - Real.log 2 + have hL : Tendsto (fun N => L N / (N : ℝ)) atTop (𝓝 (A - H)) := by + simpa only [L, show A + H - 2 * H = A - H by ring] using + tendsto_log_yield_lower hE hU hM + filter_upwards [hpos, hinc, (tendsto_order.1 hL).1 (A - H - ε) (by linarith), + (eventually_atTop.2 ⟨1, fun N (hN : 1 ≤ N) => hN⟩)] with N hp hi hr hN + obtain ⟨ω, hω⟩ := exists_goodCount_ge (good N) _ hi + refine ⟨ω, ?_⟩ + have heq := exp_log_yield_lower hp.1 hp.2.1 hp.2.2 + have hNr : (0 : ℝ) < N := by exact_mod_cast hN + have he : Real.exp ((N : ℝ) * (A - H - ε)) ≤ + (goodCount (good N) ω : ℝ) := by + calc + _ ≤ Real.exp (L N) := Real.exp_le_exp.mpr (by + have hm := (lt_div_iff₀ hNr).mp hr + nlinarith) + _ = _ := heq + _ ≤ _ := hω + simpa only [Nat.floor_natCast] using Nat.floor_le_floor he + +theorem eventually_exists_many_good_explicit + {Ω E : ℕ → Type*} [∀ N, Fintype (Ω N)] [∀ N, Nonempty (Ω N)] + [∀ N, Fintype (E N)] + (good : ∀ N, Ω N → E N → Prop) {A H : ℝ} (hH : 0 ≤ H) + (hpos : ∀ᶠ N in atTop, 0 < Fintype.card (E N)) + (hinc : ∀ᶠ N in atTop, ∀ e, + (((JointAPFree.modularSet (hashModulus H N)).card : ℝ) / + (hashModulus H N : ℝ) ^ 2 / 2) * (Fintype.card (Ω N) : ℝ) ≤ + (goodIncidence (good N) e : ℝ)) + (hE : Tendsto (fun N => Real.log (Fintype.card (E N) : ℝ) / (N : ℝ)) + atTop (𝓝 A)) + {ε : ℝ} (hε : 0 < ε) : + ∀ᶠ N in atTop, ∃ ω : Ω N, + ⌊Real.exp ((N : ℝ) * (A - H - ε))⌋₊ ≤ goodCount (good N) ω := by + have hM : ∀ N, 2 ≤ hashModulus H N := fun N => + (by norm_num : 2 ≤ 37).trans (hashModulus_ge H N) + have hr := tendsto_log_hashModulus_div_nat hH + apply eventually_exists_many_good good + (fun N => (JointAPFree.modularSet (hashModulus H N)).card) (hashModulus H) + _ hinc hE (tendsto_log_modularSet_card_div_nat (Eventually.of_forall hM) hr) hr hε + filter_upwards [hpos] with N hN + exact ⟨hN, JointAPFree.modularSet_card_pos (hM N), + lt_of_lt_of_le (by decide : 0 < 2) (hM N)⟩ + +theorem fixed_product_subexponential {I : Type*} (s : Finset I) (R : I → ℕ → ℕ) + (hpos : ∀ i ∈ s, ∀ N, 0 < R i N) + (hR : ∀ i ∈ s, + Tendsto (fun N => Real.log (R i N : ℝ) / (N : ℝ)) atTop (𝓝 0)) : + Tendsto (fun N => Real.log ((∏ i ∈ s, R i N : ℕ) : ℝ) / (N : ℝ)) + atTop (𝓝 0) := by + simpa only [Finset.sum_const_zero] using + MatrixMultiplication.Foundation.Separation.tendsto_log_nat_prod_div_nat s hpos hR + +theorem presence_replications_subexponential (L : ℕ → ℕ) + (hL : Tendsto (fun N => (L N : ℝ) / (N : ℝ)) atTop (𝓝 0)) : + Tendsto (fun N => Real.log ((2 ^ (3 * L N) : ℕ) : ℝ) / (N : ℝ)) + atTop (𝓝 0) := by + have h := hL.const_mul (3 * Real.log 2) + simp only [mul_zero] at h + apply h.congr + intro N + rw [Nat.cast_pow, Real.log_pow] + push_cast + ring + +end MatrixMultiplication.JointExtractionRates + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/JointExtraction/GibbsApproximation.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/JointExtraction/GibbsApproximation.lean new file mode 100644 index 0000000000000000000000000000000000000000..622a3c9f611b15826ed23952314acb18b7745449 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/JointExtraction/GibbsApproximation.lean @@ -0,0 +1,194 @@ +import OAI.LinearAlgebra.MatrixMultiplication.JointExtraction.EntropyMax + +namespace OAI + +/-! Joint tensor extraction, compatibility and entropy estimates. -/ + +noncomputable section + +open scoped BigOperators Topology +open Filter MatrixMultiplication.Foundation +open MatrixMultiplication.JointEntropyMax + +namespace MatrixMultiplication.JointGibbsApproximation + +def marginalError {A B : Type*} [Fintype A] [Fintype B] + (p q : FiniteLaw A) (f : A → B) (v : B → ℝ) : ℝ := + ∑ b, |(q.map f).mass b - (p.map f).mass b| * |v b| + +theorem marginalError_nonneg {A B : Type*} [Fintype A] [Fintype B] + (p q : FiniteLaw A) (f : A → B) (v : B → ℝ) : + 0 ≤ marginalError p q f v := + Finset.sum_nonneg fun _ _ => mul_nonneg (abs_nonneg _) (abs_nonneg _) + +theorem entropy_le_crossEntropy_of_support {A : Type*} [Fintype A] + (p q : FiniteLaw A) (hsupport : ∀ a, p.mass a = 0 → q.mass a = 0) : + finiteEntropy q.mass ≤ ∑ a, -q.mass a * Real.log (p.mass a) := by + have hterm (a : A) : + entropyTerm (q.mass a) ≤ -q.mass a * Real.log (p.mass a) + p.mass a - q.mass a := by + by_cases hp : p.mass a = 0 + · simp [hp, hsupport a hp] + · exact entropyTerm_le_crossEntropyTerm + (lt_of_le_of_ne (p.nonneg a) (Ne.symm hp)) (q.nonneg a) + calc + finiteEntropy q.mass ≤ + ∑ a, (-q.mass a * Real.log (p.mass a) + p.mass a - q.mass a) := + Finset.sum_le_sum fun a _ => hterm a + _ = ∑ a, -q.mass a * Real.log (p.mass a) := by + rw [Finset.sum_sub_distrib, Finset.sum_add_distrib, p.total, q.total] + ring + +private theorem potential_difference_le {A B : Type*} [Fintype A] [Fintype B] + (p q : FiniteLaw A) (f : A → B) (v : B → ℝ) : + (∑ a, p.mass a * v (f a)) - (∑ a, q.mass a * v (f a)) ≤ + marginalError p q f v := by + rw [sum_mass_mul_coordinate p f v, sum_mass_mul_coordinate q f v, + ← Finset.sum_sub_distrib] + apply Finset.sum_le_sum + intro b _ + calc + (p.map f).mass b * v b - (q.map f).mass b * v b = + ((p.map f).mass b - (q.map f).mass b) * v b := by ring + _ ≤ |((p.map f).mass b - (q.map f).mass b) * v b| := le_abs_self _ + _ = |(q.map f).mass b - (p.map f).mass b| * |v b| := by + rw [abs_mul, abs_sub_comm] + +theorem entropy_le_of_marginal_errors_of_support + {A X Y Z : Type*} [Fintype A] [Fintype X] [Fintype Y] [Fintype Z] + (p q : FiniteLaw A) (fX : A → X) (fY : A → Y) (fZ : A → Z) + (u : X → ℝ) (v : Y → ℝ) (w : Z → ℝ) (c : ℝ) + (hsupport : ∀ a, p.mass a = 0 → q.mass a = 0) + (hlog : ∀ a, 0 < p.mass a → + Real.log (p.mass a) = u (fX a) + v (fY a) + w (fZ a) - c) : + finiteEntropy q.mass ≤ finiteEntropy p.mass + + marginalError p q fX u + marginalError p q fY v + marginalError p q fZ w := by + have hexpand (r : FiniteLaw A) (hr : ∀ a, p.mass a = 0 → r.mass a = 0) : + (∑ a, r.mass a * Real.log (p.mass a)) = + (∑ a, r.mass a * u (fX a)) + (∑ a, r.mass a * v (fY a)) + + (∑ a, r.mass a * w (fZ a)) - c := by + have hterm (a : A) : r.mass a * Real.log (p.mass a) = + r.mass a * (u (fX a) + v (fY a) + w (fZ a) - c) := by + by_cases hp : p.mass a = 0 + · simp [hr a hp] + · rw [hlog a (lt_of_le_of_ne (p.nonneg a) (Ne.symm hp))] + simp_rw [hterm, mul_sub, mul_add] + rw [Finset.sum_sub_distrib, Finset.sum_add_distrib, Finset.sum_add_distrib, + ← Finset.sum_mul, r.total, one_mul] + have hcross : (∑ a, -q.mass a * Real.log (p.mass a)) = + finiteEntropy p.mass + + ((∑ a, p.mass a * u (fX a)) - (∑ a, q.mass a * u (fX a))) + + ((∑ a, p.mass a * v (fY a)) - (∑ a, q.mass a * v (fY a))) + + ((∑ a, p.mass a * w (fZ a)) - (∑ a, q.mass a * w (fZ a))) := by + have hp : finiteEntropy p.mass = -(∑ a, p.mass a * Real.log (p.mass a)) := by + simp only [finiteEntropy, entropyTerm, neg_mul, Finset.sum_neg_distrib] + simp only [neg_mul, Finset.sum_neg_distrib] + rw [hp, hexpand p (fun _ h => h), hexpand q hsupport] + ring + calc + finiteEntropy q.mass ≤ ∑ a, -q.mass a * Real.log (p.mass a) := + entropy_le_crossEntropy_of_support p q hsupport + _ = _ := hcross + _ ≤ _ := add_le_add + (add_le_add (add_le_add_right (potential_difference_le p q fX u) _) + (potential_difference_le p q fY v)) (potential_difference_le p q fZ w) + +theorem entropy_le_of_marginal_errors + {A X Y Z : Type*} [Fintype A] [Fintype X] [Fintype Y] [Fintype Z] + (p q : FiniteLaw A) (fX : A → X) (fY : A → Y) (fZ : A → Z) + (u : X → ℝ) (v : Y → ℝ) (w : Z → ℝ) (c : ℝ) + (hp : ∀ a, 0 < p.mass a) + (hlog : ∀ a, Real.log (p.mass a) = u (fX a) + v (fY a) + w (fZ a) - c) : + finiteEntropy q.mass ≤ finiteEntropy p.mass + + marginalError p q fX u + marginalError p q fY v + marginalError p q fZ w := + entropy_le_of_marginal_errors_of_support p q fX fY fZ u v w c + (fun a h => ((hp a).ne' h).elim) (fun a _ => hlog a) + +theorem tendsto_map_mass {I A B : Type*} [Fintype A] [Fintype B] + {l : Filter I} {pN : I → FiniteLaw A} {p : FiniteLaw A} + (h : ∀ a, Tendsto (fun n => (pN n).mass a) l (𝓝 (p.mass a))) + (f : A → B) (b : B) : + Tendsto (fun n => ((pN n).map f).mass b) l (𝓝 ((p.map f).mass b)) := by + classical + simp_rw [FiniteLaw.map_mass] + apply tendsto_finsetSum + intro a _ + by_cases hab : f a = b + · simpa only [hab, ite_true] using h a + · simp only [hab, ite_false] + exact tendsto_const_nhds + +theorem tendsto_marginalError {I A B : Type*} [Fintype A] [Fintype B] + {l : Filter I} {pN : I → FiniteLaw A} {p : FiniteLaw A} + (h : ∀ a, Tendsto (fun n => (pN n).mass a) l (𝓝 (p.mass a))) + (f : A → B) (v : B → ℝ) : + Tendsto (fun n => marginalError p (pN n) f v) l (𝓝 0) := by + have hterm (b : B) : + Tendsto (fun n => |((pN n).map f).mass b - (p.map f).mass b| * |v b|) + l (𝓝 0) := by + have hconst : Tendsto (fun _ : I => (p.map f).mass b) l + (𝓝 ((p.map f).mass b)) := tendsto_const_nhds + simpa only [sub_self, abs_zero, zero_mul] using + ((tendsto_map_mass h f b).sub hconst).abs.mul_const |v b| + simpa only [marginalError, Finset.sum_const_zero] using + tendsto_finsetSum Finset.univ (fun b _ => hterm b) + +theorem eventually_entropy_le_of_tendsto_of_support + {I A X Y Z : Type*} [Fintype A] [Fintype X] [Fintype Y] [Fintype Z] + {l : Filter I} (p : FiniteLaw A) (pN : I → FiniteLaw A) + (fX : A → X) (fY : A → Y) (fZ : A → Z) + (u : X → ℝ) (v : Y → ℝ) (w : Z → ℝ) (c : ℝ) + (hlog : ∀ a, 0 < p.mass a → + Real.log (p.mass a) = u (fX a) + v (fY a) + w (fZ a) - c) + (hN : ∀ a, Tendsto (fun n => (pN n).mass a) l (𝓝 (p.mass a))) + {η : ℝ} (hη : 0 < η) : + ∀ᶠ n in l, ∀ q : FiniteLaw A, + (∀ a, p.mass a = 0 → q.mass a = 0) → + (q.map fX).mass = ((pN n).map fX).mass → + (q.map fY).mass = ((pN n).map fY).mass → + (q.map fZ).mass = ((pN n).map fZ).mass → + finiteEntropy q.mass ≤ finiteEntropy p.mass + η := by + have herror : Tendsto (fun n => marginalError p (pN n) fX u + + marginalError p (pN n) fY v + marginalError p (pN n) fZ w) l (𝓝 0) := by + simpa only [add_zero] using + ((tendsto_marginalError hN fX u).add (tendsto_marginalError hN fY v)).add + (tendsto_marginalError hN fZ w) + have hsmall := herror.eventually (gt_mem_nhds hη) + filter_upwards [hsmall] with n hn + intro q hs hX hY hZ + have hbound := entropy_le_of_marginal_errors_of_support p q fX fY fZ u v w c hs hlog + have hx : marginalError p q fX u = marginalError p (pN n) fX u := by + unfold marginalError + rw [hX] + have hy : marginalError p q fY v = marginalError p (pN n) fY v := by + unfold marginalError + rw [hY] + have hz : marginalError p q fZ w = marginalError p (pN n) fZ w := by + unfold marginalError + rw [hZ] + rw [hx, hy, hz] at hbound + linarith + +theorem eventually_entropy_le_of_tendsto + {I A X Y Z : Type*} [Fintype A] [Fintype X] [Fintype Y] [Fintype Z] + {l : Filter I} (p : FiniteLaw A) (pN : I → FiniteLaw A) + (fX : A → X) (fY : A → Y) (fZ : A → Z) + (u : X → ℝ) (v : Y → ℝ) (w : Z → ℝ) (c : ℝ) + (hp : ∀ a, 0 < p.mass a) + (hlog : ∀ a, Real.log (p.mass a) = u (fX a) + v (fY a) + w (fZ a) - c) + (hN : ∀ a, Tendsto (fun n => (pN n).mass a) l (𝓝 (p.mass a))) + {η : ℝ} (hη : 0 < η) : + ∀ᶠ n in l, ∀ q : FiniteLaw A, + (q.map fX).mass = ((pN n).map fX).mass → + (q.map fY).mass = ((pN n).map fY).mass → + (q.map fZ).mass = ((pN n).map fZ).mass → + finiteEntropy q.mass ≤ finiteEntropy p.mass + η := by + filter_upwards [eventually_entropy_le_of_tendsto_of_support p pN fX fY fZ u v w c + (fun a _ => hlog a) hN hη] with n hn + intro q hX hY hZ + exact hn q (fun a h => ((hp a).ne' h).elim) hX hY hZ + +end MatrixMultiplication.JointGibbsApproximation + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/JointExtraction/GroupedEntropyEmbedding.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/JointExtraction/GroupedEntropyEmbedding.lean new file mode 100644 index 0000000000000000000000000000000000000000..18bc80e75f2c72f702430b6738573da76d985b94 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/JointExtraction/GroupedEntropyEmbedding.lean @@ -0,0 +1,172 @@ +import OAI.LinearAlgebra.MatrixMultiplication.JointExtraction.GroupedEntropyPartition + +namespace OAI + +/-! Joint tensor extraction, compatibility and entropy estimates. -/ + +noncomputable section + +namespace MatrixMultiplication.JointGroupedEntropyEmbedding + +open MatrixMultiplication.Foundation JointCompatibilityIncidence JointNativeGroupedEntropy +open scoped BigOperators +attribute [local instance] Classical.propDecidable Classical.decEq + +variable {U V K L A : Type*} + [Fintype U] [Fintype V] [Fintype K] [Fintype L] [Fintype A] + +omit [Fintype K] [Fintype L] in +theorem groupMass_label_injective (j : K → L) (hj : Function.Injective j) + (p : U → ℝ) (group : U → K) (k : K) : + groupMass p (j ∘ group) (j k) = groupMass p group k := by + simp only [groupMass, Function.comp_apply, hj.eq_iff] + +omit [Fintype K] [Fintype L] [Fintype A] in +theorem groupLaw_label_injective (j : K → L) (hj : Function.Injective j) + (p : U → ℝ) (group : U → K) (q : U → A → ℝ) (k : K) : + groupLaw p (j ∘ group) q (j k) = groupLaw p group q k := by + funext a + simp only [groupLaw, groupMass_label_injective j hj, + Function.comp_apply, hj.eq_iff] + +omit [Fintype K] [Fintype L] in +theorem groupMass_label_not_mem_range (j : K → L) (p : U → ℝ) + (group : U → K) (l : L) (hl : l ∉ Set.range j) : + groupMass p (j ∘ group) l = 0 := by + apply Finset.sum_eq_zero + intro u _ + exact ite_eq_right (fun equality => hl ⟨group u, equality⟩) + +theorem groupedEntropy_label_injective (j : K → L) (hj : Function.Injective j) + (p : U → ℝ) (group : U → K) (q : U → A → ℝ) : + groupedEntropy p (j ∘ group) q = groupedEntropy p group q := by + unfold groupedEntropy + symm + apply Fintype.sum_of_injective j hj + · intro l hl + rw [groupMass_label_not_mem_range j p group l hl, zero_mul] + · intro k + rw [groupMass_label_injective j hj, groupLaw_label_injective j hj] + +def pushforwardWeight (p : U → ℝ) (f : U → V) (v : V) : ℝ := + ∑ u, if f u = v then p u else 0 + +theorem sum_pushforwardWeight_mul (p : U → ℝ) (f : U → V) (test : V → ℝ) : + (∑ v, pushforwardWeight p f v * test v) = ∑ u, p u * test (f u) := by + simp only [pushforwardWeight, Finset.sum_mul] + rw [Finset.sum_comm] + apply Finset.sum_congr rfl + intro u _ + simp only [ite_mul, zero_mul] + simp + +omit [Fintype K] in +theorem groupMass_pushforward (p : U → ℝ) (f : U → V) + (group : V → K) (k : K) : + groupMass (pushforwardWeight p f) group k = groupMass p (group ∘ f) k := by + simpa only [groupMass, mul_ite, mul_one, mul_zero, Function.comp_apply] using + (sum_pushforwardWeight_mul p f (fun v => if group v = k then 1 else 0)) + +omit [Fintype K] [Fintype A] in +theorem groupMeasure_pushforward (p : U → ℝ) (f : U → V) + (group : V → K) (q : V → A → ℝ) (k : K) : + groupMeasure (pushforwardWeight p f) group q k = + groupMeasure p (group ∘ f) (q ∘ f) k := by + funext a + simpa only [groupMeasure, mul_ite, mul_zero, Function.comp_apply] using + (sum_pushforwardWeight_mul p f (fun v => if group v = k then q v a else 0)) + +omit [Fintype K] [Fintype A] in +theorem groupLaw_pushforward (p : U → ℝ) (f : U → V) + (group : V → K) (q : V → A → ℝ) (k : K) : + groupLaw (pushforwardWeight p f) group q k = + groupLaw p (group ∘ f) (q ∘ f) k := by + funext a + change groupMeasure (pushforwardWeight p f) group q k a / + groupMass (pushforwardWeight p f) group k = + groupMeasure p (group ∘ f) (q ∘ f) k a / groupMass p (group ∘ f) k + rw [groupMeasure_pushforward, groupMass_pushforward] + +theorem groupedEntropy_pushforward (p : U → ℝ) (f : U → V) + (group : V → K) (q : V → A → ℝ) : + groupedEntropy (pushforwardWeight p f) group q = + groupedEntropy p (group ∘ f) (q ∘ f) := by + simp only [groupedEntropy, groupMass_pushforward, groupLaw_pushforward] + +theorem groupedEntropy_pushforward_of_agree (p : U → ℝ) (f : U → V) + (group : V → K) (qU : U → A → ℝ) (qV : V → A → ℝ) + (hq : ∀ u, qV (f u) = qU u) : + groupedEntropy (pushforwardWeight p f) group qV = + groupedEntropy p (group ∘ f) qU := by + rw [groupedEntropy_pushforward] + have he : qV ∘ f = qU := funext hq + rw [he] + +theorem groupedEntropy_pushforward_embedding (p : U → ℝ) (f : U → V) + (groupU : U → K) (groupV : V → L) (j : K → L) (hj : Function.Injective j) + (hgroup : ∀ u, groupV (f u) = j (groupU u)) + (qU : U → A → ℝ) (qV : V → A → ℝ) (hq : ∀ u, qV (f u) = qU u) : + groupedEntropy (pushforwardWeight p f) groupV qV = groupedEntropy p groupU qU := by + rw [groupedEntropy_pushforward_of_agree p f groupV qU qV hq] + have hg : groupV ∘ f = j ∘ groupU := funext hgroup + rw [hg, groupedEntropy_label_injective j hj] + +theorem sum_map_mass_mul (p : FiniteLaw U) (f : U → V) (test : V → ℝ) : + (∑ v, (p.map f).mass v * test v) = ∑ u, p.mass u * test (f u) := by + simpa only [FiniteLaw.map_mass, pushforwardWeight] using + (sum_pushforwardWeight_mul p.mass f test) + +omit [Fintype K] in +theorem groupMass_map (p : FiniteLaw U) (f : U → V) + (group : V → K) (k : K) : + groupMass (p.map f).mass group k = groupMass p.mass (group ∘ f) k := by + simpa only [groupMass, mul_ite, mul_one, mul_zero, Function.comp_apply] using + (sum_map_mass_mul p f (fun v => if group v = k then 1 else 0)) + +omit [Fintype K] [Fintype A] in +theorem groupMeasure_map (p : FiniteLaw U) (f : U → V) + (group : V → K) (q : V → A → ℝ) (k : K) : + groupMeasure (p.map f).mass group q k = + groupMeasure p.mass (group ∘ f) (q ∘ f) k := by + funext a + simpa only [groupMeasure, mul_ite, mul_zero, Function.comp_apply] using + (sum_map_mass_mul p f (fun v => if group v = k then q v a else 0)) + +omit [Fintype K] [Fintype A] in +theorem groupLaw_map (p : FiniteLaw U) (f : U → V) + (group : V → K) (q : V → A → ℝ) (k : K) : + groupLaw (p.map f).mass group q k = groupLaw p.mass (group ∘ f) (q ∘ f) k := by + funext a + change groupMeasure (p.map f).mass group q k a / groupMass (p.map f).mass group k = + groupMeasure p.mass (group ∘ f) (q ∘ f) k a / groupMass p.mass (group ∘ f) k + rw [groupMeasure_map, groupMass_map] + +theorem groupedEntropy_map (p : FiniteLaw U) (f : U → V) + (group : V → K) (q : V → A → ℝ) : + groupedEntropy (p.map f).mass group q = + groupedEntropy p.mass (group ∘ f) (q ∘ f) := by + simp only [groupedEntropy, groupMass_map, groupLaw_map] + +theorem groupedEntropy_map_of_agree (p : FiniteLaw U) (f : U → V) + (group : V → K) (qU : U → A → ℝ) (qV : V → A → ℝ) + (hq : ∀ u, qV (f u) = qU u) : + groupedEntropy (p.map f).mass group qV = + groupedEntropy p.mass (group ∘ f) qU := by + rw [groupedEntropy_map] + have he : qV ∘ f = qU := funext hq + rw [he] + +theorem groupedEntropy_map_embedding (p : FiniteLaw U) (f : U → V) + (groupU : U → K) (groupV : V → L) (j : K → L) (hj : Function.Injective j) + (hgroup : ∀ u, groupV (f u) = j (groupU u)) + (qU : U → A → ℝ) (qV : V → A → ℝ) (hq : ∀ u, qV (f u) = qU u) : + groupedEntropy (p.map f).mass groupV qV = groupedEntropy p.mass groupU qU := by + rw [groupedEntropy_map_of_agree p f groupV qU qV hq] + have hg : groupV ∘ f = j ∘ groupU := funext hgroup + rw [hg, groupedEntropy_label_injective j hj] + +end MatrixMultiplication.JointGroupedEntropyEmbedding + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/JointExtraction/GroupedEntropyPartition.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/JointExtraction/GroupedEntropyPartition.lean new file mode 100644 index 0000000000000000000000000000000000000000..fa59c82d65b737c1961eedcf80c4c7ed11615648 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/JointExtraction/GroupedEntropyPartition.lean @@ -0,0 +1,200 @@ +import OAI.LinearAlgebra.MatrixMultiplication.JointExtraction.NativeGroupedEntropy + +namespace OAI + +/-! Joint tensor extraction, compatibility and entropy estimates. -/ + +noncomputable section + +namespace MatrixMultiplication.JointGroupedEntropyPartition + +open MatrixMultiplication.Foundation AllFieldParameters AllFieldHistory +open JointNativeGroupedEntropy +open scoped BigOperators +attribute [local instance] Classical.propDecidable Classical.decEq + +section FiniteGroups + +variable {U K A : Type*} [Fintype U] [Fintype K] [Fintype A] + +omit [Fintype K] in +theorem groupMass_mul (s : ℝ) (p : U → ℝ) (group : U → K) (k : K) : + JointCompatibilityIncidence.groupMass (fun u => s * p u) group k = + s * JointCompatibilityIncidence.groupMass p group k := by + unfold JointCompatibilityIncidence.groupMass + rw [Finset.mul_sum] + apply Finset.sum_congr rfl + intro u _ + by_cases hu : group u = k <;> simp [hu] + +omit [Fintype K] [Fintype A] in +theorem groupMeasure_mul (s : ℝ) (p : U → ℝ) (group : U → K) + (q : U → A → ℝ) (k : K) : + groupMeasure (fun u => s * p u) group q k = + fun a => s * groupMeasure p group q k a := by + funext a + unfold groupMeasure + rw [Finset.mul_sum] + apply Finset.sum_congr rfl + intro u _ + by_cases hu : group u = k <;> simp [hu, mul_assoc] + +omit [Fintype K] [Fintype A] in +theorem groupLaw_mul_of_ne_zero (s : ℝ) (hs : s ≠ 0) (p : U → ℝ) + (group : U → K) (q : U → A → ℝ) (k : K) : + JointCompatibilityIncidence.groupLaw (fun u => s * p u) group q k = + JointCompatibilityIncidence.groupLaw p group q k := by + funext a + change groupMeasure (fun u => s * p u) group q k a / + JointCompatibilityIncidence.groupMass (fun u => s * p u) group k = + groupMeasure p group q k a / JointCompatibilityIncidence.groupMass p group k + rw [groupMeasure_mul, groupMass_mul] + exact mul_div_mul_left _ _ hs + +theorem groupedEntropy_mul (s : ℝ) (p : U → ℝ) (group : U → K) + (q : U → A → ℝ) : + JointCompatibilityIncidence.groupedEntropy (fun u => s * p u) group q = + s * JointCompatibilityIncidence.groupedEntropy p group q := by + by_cases hs : s = 0 + · simp [hs, JointCompatibilityIncidence.groupedEntropy, + JointCompatibilityIncidence.groupMass] + · unfold JointCompatibilityIncidence.groupedEntropy + simp only [groupMass_mul, groupLaw_mul_of_ne_zero s hs, mul_assoc, Finset.mul_sum] + +omit [Fintype A] in +theorem groupMeasure_designated_some (p : U → ℝ) (d : U → Prop) + (q : U → A → ℝ) (u : U) : + groupMeasure p (JointCompatibilityIncidence.designatedGroup d) q (some u) = + fun a => if d u then p u * q u a else 0 := by + funext a + simp only [groupMeasure, JointCompatibilityIncidence.designatedGroup_eq_some] + by_cases hu : d u <;> simp [hu] + +omit [Fintype A] in +theorem groupMeasure_designated_none (p : U → ℝ) (d : U → Prop) + (q : U → A → ℝ) : + groupMeasure p (JointCompatibilityIncidence.designatedGroup d) q none = + fun a => ∑ u, if ¬ d u then p u * q u a else 0 := by + funext a + simp only [groupMeasure, JointCompatibilityIncidence.designatedGroup_eq_none] + +theorem groupedEntropy_designated (p : U → ℝ) (d : U → Prop) + (q : U → A → ℝ) (hp : ∀ u, 0 ≤ p u) (hq : ∀ u, ∑ a, q u a = 1) : + JointCompatibilityIncidence.groupedEntropy p + (JointCompatibilityIncidence.designatedGroup d) q = + (∑ u, if d u then p u * homogeneousEntropy (q u) else 0) + + homogeneousEntropy (fun a => ∑ u, if ¬ d u then p u * q u a else 0) := by + rw [groupedEntropy_eq_sum_homogeneous p _ q hp hq, Fintype.sum_option, + groupMeasure_designated_none, add_comm] + congr 1 + apply Finset.sum_congr rfl + intro u _ + rw [groupMeasure_designated_some] + by_cases hu : d u + · simp only [hu, ite_true] + exact homogeneousEntropy_mul_normalized (p u) (q u) (hq u) + · simp only [hu, ite_false, homogeneousEntropy_zero] + +theorem groupedEntropy_partition (p : U → ℝ) (d : U → Prop) (weight : U → K) + (q : U → A → ℝ) (hp : ∀ u, 0 ≤ p u) (hq : ∀ u, ∑ a, q u a = 1) : + JointCompatibilityIncidence.groupedEntropy p (singletonResidualGroup d weight) q = + ∑ k, JointCompatibilityIncidence.groupedEntropy + (fun u => if weight u = k then p u else 0) + (JointCompatibilityIncidence.designatedGroup d) q := by + have hclass (k : K) := groupedEntropy_designated + (fun u => if weight u = k then p u else 0) d q + (fun u => by split_ifs; exact hp u; exact le_rfl) hq + rw [groupedEntropy_singletons_residuals p d weight q hp hq] + simp_rw [hclass] + rw [Finset.sum_add_distrib, Finset.sum_comm] + congr 1 + · apply Finset.sum_congr rfl + intro u _ + by_cases hu : d u <;> simp [hu, ite_mul] + · apply Finset.sum_congr rfl + intro k _ + congr 1 + funext a + apply Finset.sum_congr rfl + intro u _ + by_cases hd : d u <;> by_cases hw : weight u = k <;> simp [hd, hw] + +theorem groupedEntropy_conditional_partition (p : FiniteLaw U) (d : U → Prop) + (weight : U → K) (q : U → A → ℝ) (hq : ∀ u, ∑ a, q u a = 1) : + JointCompatibilityIncidence.groupedEntropy p.mass (singletonResidualGroup d weight) q = + ∑ k, (p.map weight).mass k * + JointCompatibilityIncidence.groupedEntropy (p.conditional weight k).mass + (JointCompatibilityIncidence.designatedGroup d) q := by + rw [groupedEntropy_partition p.mass d weight q p.nonneg hq] + apply Finset.sum_congr rfl + intro k _ + have hm : (fun u => if weight u = k then p.mass u else 0) = + fun u => (p.map weight).mass k * (p.conditional weight k).mass u := by + funext u + exact (p.map_mass_mul_conditional weight k u).symm + rw [hm, groupedEntropy_mul] + +end FiniteGroups + +section NativeSupport + +variable {A : Type*} [Fintype A] + +theorem native_groupedEntropy_eq_sum_masked (support : List Shape) (p : Shape → ℝ) + (priority : Placement) (position : Fin 3) (q : Shape → A → ℝ) + (hbound : ∀ i : SupportIndex support, support[i.val] (priority position) < 17) + (hp : ∀ i : SupportIndex support, 0 ≤ p support[i.val]) + (hq : ∀ i : SupportIndex support, ∑ a, q support[i.val] a = 1) : + AllFieldNativeCapacity.groupedEntropy support p priority position q = + ∑ k : Fin 17, JointCompatibilityIncidence.groupedEntropy + (fun i : SupportIndex support => + if ownWeight support priority position hbound i = k then p support[i.val] else 0) + (JointCompatibilityIncidence.designatedGroup + (fun i => AllFieldNativeCapacity.designated priority position support[i.val])) + (fun i => q support[i.val]) := by + have hpart := groupedEntropy_partition (fun i : SupportIndex support => p support[i.val]) + (fun i => AllFieldNativeCapacity.designated priority position support[i.val]) + (ownWeight support priority position hbound) (fun i => q support[i.val]) hp hq + refine (groupedEntropy_eq_native support p priority position q hbound hp hq).symm.trans + (hpart.trans ?_) + apply Finset.sum_congr rfl + intro k _ + apply congrArg (fun weights : SupportIndex support → ℝ => + JointCompatibilityIncidence.groupedEntropy weights + (JointCompatibilityIncidence.designatedGroup + (fun i => AllFieldNativeCapacity.designated priority position support[i.val])) + (fun i => q support[i.val])) + funext i + by_cases hi : ownWeight support priority position hbound i = k <;> simp only [hi, ite_true, ite_false] + +theorem native_groupedEntropy_eq_sum_conditional (support : List Shape) (p : Shape → ℝ) + (priority : Placement) (position : Fin 3) (q : Shape → A → ℝ) + (hbound : ∀ i : SupportIndex support, support[i.val] (priority position) < 17) + (law : FiniteLaw (SupportIndex support)) + (hlaw : ∀ i : SupportIndex support, law.mass i = p support[i.val]) + (hq : ∀ i : SupportIndex support, ∑ a, q support[i.val] a = 1) : + AllFieldNativeCapacity.groupedEntropy support p priority position q = + ∑ k : Fin 17, (law.map (ownWeight support priority position hbound)).mass k * + JointCompatibilityIncidence.groupedEntropy + (law.conditional (ownWeight support priority position hbound) k).mass + (JointCompatibilityIncidence.designatedGroup + (fun i => AllFieldNativeCapacity.designated priority position support[i.val])) + (fun i => q support[i.val]) := by + have hp (i : SupportIndex support) : 0 ≤ p support[i.val] := by + rw [← hlaw i] + exact law.nonneg i + have hm : law.mass = fun i : SupportIndex support => p support[i.val] := funext hlaw + have hn : JointCompatibilityIncidence.groupedEntropy law.mass + (nativeGroup support priority position hbound) (fun i => q support[i.val]) = + AllFieldNativeCapacity.groupedEntropy support p priority position q := by + rw [hm] + exact groupedEntropy_eq_native support p priority position q hbound hp hq + exact hn.symm.trans (groupedEntropy_conditional_partition law _ _ _ hq) + +end NativeSupport + +end MatrixMultiplication.JointGroupedEntropyPartition + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/JointExtraction/Hashing.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/JointExtraction/Hashing.lean new file mode 100644 index 0000000000000000000000000000000000000000..2857a28722dfa587338793cac3cbf09c03660c81 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/JointExtraction/Hashing.lean @@ -0,0 +1,320 @@ +import OAI.LinearAlgebra.MatrixMultiplication.Separation.ComplexModularSeparation +import Mathlib.Tactic.Ring +import Mathlib.Tactic.Linarith +import Mathlib.Tactic.LinearCombination +import Mathlib.Tactic.Abel +import Mathlib.Data.Fintype.Pi +import Mathlib.Tactic.FieldSimp + +namespace OAI + +/-! Joint tensor extraction, compatibility and entropy estimates. -/ + +namespace MatrixMultiplication.JointHashing + +open scoped BigOperators + +attribute [local instance] Classical.propDecidable + +variable {P R : Type*} [Fintype P] [CommRing R] + +def dot (v w : P → R) : R := ∑ i, v i * w i + +@[simp] theorem dot_add_right (v w u : P → R) : dot v (w + u) = dot v w + dot v u := by + simp [dot, mul_add, Finset.sum_add_distrib] + +@[simp] theorem dot_sub_right (v w u : P → R) : dot v (w - u) = dot v w - dot v u := by + simp [dot, mul_sub, Finset.sum_sub_distrib] + +@[simp] theorem dot_add_left (v w u : P → R) : dot (v + w) u = dot v u + dot w u := by + simp [dot, add_mul, Finset.sum_add_distrib] + +@[simp] theorem dot_sub_left (v w u : P → R) : dot (v - w) u = dot v u - dot w u := by + simp [dot, sub_mul, Finset.sum_sub_distrib] + +abbrev Sample (P R : Type*) := (P → R) × R × R + +def xHash (s : Sample P R) (I : P → R) := s.2.1 + dot s.1 I +def yHash (s : Sample P R) (J : P → R) := s.2.2 + dot s.1 J + +def zHash (two : Rˣ) (s : Sample P R) (S K : P → R) := + (↑(two⁻¹) : R) * (s.2.1 + s.2.2 + dot s.1 (S - K)) + +def Survives (U : Set R) (I J : P → R) (s : Sample P R) : Prop := + xHash s I = yHash s J ∧ xHash s I ∈ U + +def survivalEquiv (U : Set R) (I J : P → R) : + {s : Sample P R // Survives U I J s} ≃ (P → R) × U where + toFun s := (s.val.1, ⟨xHash s.val I, s.property.2⟩) + invFun vt := ⟨(vt.1, vt.2.val - dot vt.1 I, vt.2.val - dot vt.1 J), by + simp [Survives, xHash, yHash, vt.2.property]⟩ + left_inv s := by + apply Subtype.ext + rcases s with ⟨⟨v, a, b⟩, hs⟩ + dsimp [Survives, xHash, yHash] at hs ⊢ + congr 1 + apply Prod.ext + · ring + · linear_combination hs.1 + right_inv vt := by + rcases vt with ⟨v, t, ht⟩ + simp [xHash] + +theorem hash_relation (two : Rˣ) (htwo : (two : R) = 2) + (s : Sample P R) (I J K S : P → R) (hs : I + J + K = S) : + xHash s I + yHash s J = 2 * zHash two s S K := by + have hSK : S - K = I + J := by rw [← hs]; abel + rw [zHash, ← htwo, ← mul_assoc] + rw [Units.mul_inv, one_mul, hSK, dot_add_right] + simp only [xHash, yHash] + ring + +theorem full_survival_iff (two : Rˣ) (htwo : (two : R) = 2) + (U : Set R) + (hAP : ∀ x ∈ U, ∀ y ∈ U, ∀ z ∈ U, x + y = 2 * z → x = z ∧ y = z) + (s : Sample P R) (I J K S : P → R) (hs : I + J + K = S) : + (xHash s I ∈ U ∧ yHash s J ∈ U ∧ zHash two s S K ∈ U) ↔ + Survives U I J s := by + have hr := hash_relation two htwo s I J K S hs + constructor + · rintro ⟨hx, hy, hz⟩ + obtain ⟨h1, h2⟩ := hAP _ hx _ hy _ hz hr + exact ⟨h1.trans h2.symm, hx⟩ + · rintro ⟨hxy, hx⟩ + have hz : zHash two s S K = xHash s I := by + have hh : (two : R) * zHash two s S K = (two : R) * xHash s I := by + rw [htwo, ← hr, hxy]; ring + exact two.isUnit.mul_left_cancel hh + exact ⟨hx, hxy ▸ hx, hz ▸ hx⟩ + +theorem survival_card [Fintype R] (U : Finset R) (I J : P → R) : + Fintype.card {s : Sample P R // Survives (U : Set R) I J s} = + Fintype.card R ^ Fintype.card P * U.card := by + classical + rw [Fintype.card_congr (survivalEquiv (U : Set R) I J)] + simp + +omit [CommRing R] in +@[simp] theorem sample_card [Fintype R] : + Fintype.card (Sample P R) = Fintype.card R ^ Fintype.card P * Fintype.card R ^ 2 := by + simp [Sample, pow_two] + +theorem shared_x_collision_iff (U : Set R) (I J J' : P → R) + (s : Sample P R) (hs : Survives U I J s) : + Survives U I J' s ↔ dot s.1 (J' - J) = 0 := by + rcases hs with ⟨heq, hU⟩ + simp only [Survives, dot_sub_right] + constructor + · intro h + dsimp [xHash, yHash] at heq h + linear_combination heq - h.1 + · intro h + refine ⟨?_, hU⟩ + dsimp [xHash, yHash] at heq ⊢ + linear_combination heq - h + +theorem shared_y_collision_iff (U : Set R) (I I' J : P → R) + (s : Sample P R) (hs : Survives U I J s) : + Survives U I' J s ↔ dot s.1 (I' - I) = 0 := by + rcases hs with ⟨heq, hU⟩ + simp only [Survives, dot_sub_right] + constructor + · intro h + dsimp [xHash, yHash] at heq h + linear_combination h.1 - heq + · intro h + have hx : xHash s I' = xHash s I := by + dsimp [xHash] + linear_combination h + exact ⟨hx.trans heq, hx ▸ hU⟩ + +def pivot [DecidableEq P] (i : P) (u : Rˣ) (t : R) : P → R := + Pi.single i ((↑(u⁻¹) : R) * t) + +@[simp] theorem dot_pivot [DecidableEq P] (d : P → R) (i : P) + (u : Rˣ) (hu : d i = u) (t : R) : dot (pivot i u t) d = t := by + simp [dot, pivot, Pi.single_apply, hu, mul_comm, mul_left_comm] + +def linearSplitEquiv [DecidableEq P] (d : P → R) (i : P) + (u : Rˣ) (hu : d i = u) : + (P → R) ≃ R × {v : P → R // dot v d = 0} where + toFun v := (dot v d, ⟨v - pivot i u (dot v d), by simp [hu]⟩) + invFun t := t.2.val + pivot i u t.1 + left_inv v := by simp + right_inv t := by + rcases t with ⟨t, v, hv⟩ + apply Prod.ext + · simp [hv, hu] + · apply Subtype.ext + simp [hv, hu] + +theorem linear_zero_fiber_card [Fintype R] + (d : P → R) (i : P) (u : Rˣ) (hu : d i = u) : + Fintype.card R * Fintype.card {v : P → R // dot v d = 0} = + Fintype.card R ^ Fintype.card P := by + classical + have h := Fintype.card_congr (linearSplitEquiv d i u hu) + simpa only [Fintype.card_prod, Fintype.card_fun] using h.symm + +def collisionEquiv (U : Set R) (I J d : P → R) : + {s : Sample P R // Survives U I J s ∧ dot s.1 d = 0} ≃ + {v : P → R // dot v d = 0} × U where + toFun s := (⟨s.val.1, s.property.2⟩, ⟨xHash s.val I, s.property.1.2⟩) + invFun vt := ⟨(vt.1.val, vt.2.val - dot vt.1.val I, vt.2.val - dot vt.1.val J), by + exact ⟨by simp [Survives, xHash, yHash, vt.2.property], vt.1.property⟩⟩ + left_inv s := by + apply Subtype.ext + exact congrArg (fun t : {s : Sample P R // Survives U I J s} => t.val) + ((survivalEquiv U I J).left_inv ⟨s.val, s.property.1⟩) + right_inv vt := by + rcases vt with ⟨⟨v, hv⟩, ⟨t, ht⟩⟩ + simp [xHash] + +theorem collision_card_mul [Fintype R] + (U : Finset R) (I J d : P → R) (i : P) (u : Rˣ) (hu : d i = u) : + Fintype.card R * + Fintype.card {s : Sample P R // Survives (U : Set R) I J s ∧ dot s.1 d = 0} = + Fintype.card {s : Sample P R // Survives (U : Set R) I J s} := by + classical + have hcard : Fintype.card {s : Sample P R // + Survives (U : Set R) I J s ∧ dot s.1 d = 0} = + Fintype.card {v : P → R // dot v d = 0} * U.card := by + simpa using Fintype.card_congr (collisionEquiv (U : Set R) I J d) + calc + _ = Fintype.card R * (Fintype.card {v : P → R // dot v d = 0} * U.card) := + congrArg (fun n : ℕ => Fintype.card R * n) hcard + _ = (Fintype.card R * Fintype.card {v : P → R // dot v d = 0}) * U.card := + (mul_assoc _ _ _).symm + _ = (Fintype.card R ^ Fintype.card P) * U.card := + congrArg (fun n : ℕ => n * U.card) (linear_zero_fiber_card d i u hu) + _ = _ := (survival_card U I J).symm + +theorem shared_x_collision_card_mul [Fintype R] + (U : Finset R) (I J J' : P → R) (i : P) (u : Rˣ) + (hu : J' i - J i = u) : + Fintype.card R * Fintype.card {s : Sample P R // + Survives (U : Set R) I J s ∧ Survives (U : Set R) I J' s} = + Fintype.card {s : Sample P R // Survives (U : Set R) I J s} := by + classical + let e : {s : Sample P R // Survives (U : Set R) I J s ∧ + Survives (U : Set R) I J' s} ≃ + {s : Sample P R // Survives (U : Set R) I J s ∧ dot s.1 (J' - J) = 0} := + Equiv.subtypeEquivRight (fun s => and_congr_right (fun hs => + shared_x_collision_iff (U : Set R) I J J' s hs)) + rw [Fintype.card_congr e] + exact collision_card_mul U I J (J' - J) i u hu + +theorem shared_y_collision_card_mul [Fintype R] + (U : Finset R) (I I' J : P → R) (i : P) (u : Rˣ) + (hu : I' i - I i = u) : + Fintype.card R * Fintype.card {s : Sample P R // + Survives (U : Set R) I J s ∧ Survives (U : Set R) I' J s} = + Fintype.card {s : Sample P R // Survives (U : Set R) I J s} := by + classical + let e : {s : Sample P R // Survives (U : Set R) I J s ∧ + Survives (U : Set R) I' J s} ≃ + {s : Sample P R // Survives (U : Set R) I J s ∧ dot s.1 (I' - I) = 0} := + Equiv.subtypeEquivRight (fun s => and_congr_right (fun hs => + shared_y_collision_iff (U : Set R) I I' J s hs)) + rw [Fintype.card_congr e] + exact collision_card_mul U I J (I' - I) i u hu + +theorem survival_fraction [Fintype R] (U : Finset R) (I J : P → R) : + (Fintype.card {s : Sample P R // Survives (U : Set R) I J s} : ℝ) / + Fintype.card (Sample P R) = (U.card : ℝ) / (Fintype.card R : ℝ) ^ 2 := by + have hR : (Fintype.card R : ℝ) ≠ 0 := by + exact_mod_cast Fintype.card_ne_zero + rw [survival_card, sample_card] + push_cast + field_simp + +theorem collision_fraction [Fintype R] + (U : Finset R) (hU : U.Nonempty) (I J d : P → R) + (i : P) (u : Rˣ) (hu : d i = u) : + (Fintype.card {s : Sample P R // Survives (U : Set R) I J s ∧ dot s.1 d = 0} : ℝ) / + Fintype.card {s : Sample P R // Survives (U : Set R) I J s} = + 1 / (Fintype.card R : ℝ) := by + have hR : (Fintype.card R : ℝ) ≠ 0 := by + exact_mod_cast Fintype.card_ne_zero + have hS : (Fintype.card {s : Sample P R // Survives (U : Set R) I J s} : ℝ) ≠ 0 := by + obtain ⟨t, ht⟩ := hU + let : Nonempty {s : Sample P R // Survives (U : Set R) I J s} := + ⟨(survivalEquiv (U : Set R) I J).symm (0, ⟨t, ht⟩)⟩ + exact Nat.cast_ne_zero.mpr Fintype.card_ne_zero + apply (div_eq_div_iff hS hR).mpr + simpa only [Nat.cast_mul, one_mul, mul_one, mul_comm] using + (congrArg (fun n : ℕ => (n : ℝ)) (collision_card_mul U I J d i u hu)) + +theorem small_nat_isUnit (k n : ℕ) (hn : 0 < n) (hn16 : n ≤ 16) : + IsUnit (n : ZMod (37 ^ k)) := by + apply (ZMod.isUnit_iff_coprime _ _).mpr + apply Nat.Coprime.pow_right + apply Nat.Coprime.symm + apply (Nat.Prime.coprime_iff_not_dvd (by decide : Nat.Prime 37)).mpr + intro h + have := Nat.le_of_dvd hn h + omega + +theorem coarse_difference_isUnit (k : ℕ) (a b : Fin 17) (hab : a ≠ b) : + IsUnit ((a.val : ZMod (37 ^ k)) - (b.val : ZMod (37 ^ k))) := by + have hne : a.val ≠ b.val := fun h => hab (Fin.ext h) + rcases lt_or_gt_of_ne hne with h | h + · have hu := small_nat_isUnit k (b.val - a.val) (Nat.sub_pos_of_lt h) (by omega) + rw [Nat.cast_sub h.le] at hu + simpa only [neg_sub] using hu.neg + · have hu := small_nat_isUnit k (a.val - b.val) (Nat.sub_pos_of_lt h) (by omega) + rwa [Nat.cast_sub h.le] at hu + +theorem coarse_words_unit_coordinate (k : ℕ) (I J : P → Fin 17) (hIJ : I ≠ J) : + ∃ i : P, IsUnit (((I i : ℕ) : ZMod (37 ^ k)) - ((J i : ℕ) : ZMod (37 ^ k))) := by + classical + have hi : ∃ i, I i ≠ J i := by + by_contra h + push Not at h + exact hIJ (funext h) + obtain ⟨i, hi⟩ := hi + exact ⟨i, coarse_difference_isUnit k (I i) (J i) hi⟩ + +theorem shared_z_collision_iff (two : Rˣ) (htwo : (two : R) = 2) + (U : Set R) (I I' J J' : P → R) (hIJ : I' + J' = I + J) + (s : Sample P R) (hs : Survives U I J s) : + Survives U I' J' s ↔ dot s.1 (I' - I) = 0 := by + have hsum : dot s.1 I' + dot s.1 J' = dot s.1 I + dot s.1 J := by + simpa using congrArg (dot s.1) hIJ + rcases hs with ⟨heq, hU⟩ + rw [dot_sub_right] + constructor + · rintro ⟨heq', _⟩ + dsimp [xHash, yHash] at heq heq' + have hz : (two : R) * (dot s.1 I' - dot s.1 I) = (two : R) * 0 := by + rw [htwo] + linear_combination heq' - heq + hsum + exact two.isUnit.mul_left_cancel hz + · intro hd + have hx : xHash s I' = xHash s I := by + dsimp [xHash] + linear_combination hd + have hy : yHash s J' = yHash s J := by + dsimp [yHash] + linear_combination hsum - hd + exact ⟨hx.trans (heq.trans hy.symm), hx ▸ hU⟩ + +theorem shared_z_collision_card_mul [Fintype R] + (two : Rˣ) (htwo : (two : R) = 2) + (U : Finset R) (I I' J J' : P → R) (hIJ : I' + J' = I + J) + (i : P) (u : Rˣ) (hu : I' i - I i = u) : + Fintype.card R * Fintype.card {s : Sample P R // + Survives (U : Set R) I J s ∧ Survives (U : Set R) I' J' s} = + Fintype.card {s : Sample P R // Survives (U : Set R) I J s} := by + classical + let e : {s : Sample P R // Survives (U : Set R) I J s ∧ + Survives (U : Set R) I' J' s} ≃ + {s : Sample P R // Survives (U : Set R) I J s ∧ dot s.1 (I' - I) = 0} := + Equiv.subtypeEquivRight (fun s => and_congr_right (fun hs => + shared_z_collision_iff two htwo (U : Set R) I I' J J' hIJ s hs)) + rw [Fintype.card_congr e] + exact collision_card_mul U I J (I' - I) i u hu + +end MatrixMultiplication.JointHashing + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/JointExtraction/IdealBranches.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/JointExtraction/IdealBranches.lean new file mode 100644 index 0000000000000000000000000000000000000000..4da2e9ae65b9875579538eb1541b358f5ea778e7 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/JointExtraction/IdealBranches.lean @@ -0,0 +1,111 @@ +import OAI.LinearAlgebra.MatrixMultiplication.JointExtraction.CoarseAssignment +import OAI.LinearAlgebra.MatrixMultiplication.Recovery.ExactRecovery + +namespace OAI + +/-! Joint tensor extraction, compatibility and entropy estimates. -/ + +noncomputable section + +namespace MatrixMultiplication.JointIdealBranches + +open MatrixMultiplication.Foundation JointExtraction JointCoarseAssignment + +attribute [local instance] Classical.propDecidable + +variable {F X Y Z A B C : Type*} [CommSemiring F] + +def ideal (T : Tensor F X Y Z) + (cx : X → A) (cy : Y → B) (cz : Z → C) + (usefulX : Triple A B C → X → Prop) + (usefulY : Triple A B C → Y → Prop) + (usefulZ : Triple A B C → Z → Prop) (e : Triple A B C) : Tensor F X Y Z := + ExactRecovery.delete T (fun x => cx x = e.1 ∧ usefulX e x) + (fun y => cy y = e.2.1 ∧ usefulY e y) + (fun z => cz z = e.2.2 ∧ usefulZ e z) + +theorem branch_eq_delete_ideal + (T : Tensor F X Y Z) (ambient targets : Finset (Triple A B C)) + (hx : A → Prop) (hy : B → Prop) (hz : C → Prop) + (cx : X → A) (cy : Y → B) (cz : Z → C) + (compatibleY : Triple A B C → Y → Prop) + (compatibleZ : Triple A B C → Z → Prop) + (usefulX : Triple A B C → X → Prop) + (usefulY : Triple A B C → Y → Prop) + (usefulZ : Triple A B C → Z → Prop) (e : Triple A B C) : + let a := assignments ambient targets hx hy hz cx cy cz + compatibleY compatibleZ usefulX usefulY usefulZ + branch T a e = ExactRecovery.delete (ideal T cx cy cz usefulX usefulY usefulZ e) + (fun x => a.x x = some e) (fun y => a.y y = some e) (fun z => a.z z = some e) := by + classical + dsimp only + funext x y z + by_cases h : + (assignments ambient targets hx hy hz cx cy cz compatibleY compatibleZ + usefulX usefulY usefulZ).x x = some e ∧ + (assignments ambient targets hx hy hz cx cy cz compatibleY compatibleZ + usefulX usefulY usefulZ).y y = some e ∧ + (assignments ambient targets hx hy hz cx cy cz compatibleY compatibleZ + usefulX usefulY usefulZ).z z = some e + · have hX := assignUseful_spec (eligible ambient targets hx hy hz) + (fun e x => cx x = e.1) usefulX x e h.1 + have hY := assignUseful_spec (eligible ambient targets hx hy hz) + (fun e y => cy y = e.2.1 ∧ compatibleY e y) usefulY y e h.2.1 + have hZ := assignUseful_spec (eligible ambient targets hx hy hz) + (fun e z => cz z = e.2.2 ∧ compatibleZ e z) usefulZ z e h.2.2 + simp [branch, ExactRecovery.delete, ideal, h, hX.2.1, hX.2.2.1, + hY.2.1.1, hY.2.2.1, hZ.2.1.1, hZ.2.2.1] + · simp [branch, ExactRecovery.delete, h] + +theorem ideal_delete (T : Tensor F X Y Z) + (px : X → Prop) (py : Y → Prop) (pz : Z → Prop) + (cx : X → A) (cy : Y → B) (cz : Z → C) + (usefulX : Triple A B C → X → Prop) + (usefulY : Triple A B C → Y → Prop) + (usefulZ : Triple A B C → Z → Prop) (e : Triple A B C) : + ideal (ExactRecovery.delete T px py pz) cx cy cz usefulX usefulY usefulZ e = + ExactRecovery.delete (ideal T cx cy cz usefulX usefulY usefulZ e) px py pz := by + funext x y z + simp only [ideal, ExactRecovery.delete] + split_ifs <;> simp_all + +theorem branch_masked_eq_delete_ideal + (T : Tensor F X Y Z) (px : X → Prop) (py : Y → Prop) (pz : Z → Prop) + (ambient targets : Finset (Triple A B C)) + (hx : A → Prop) (hy : B → Prop) (hz : C → Prop) + (cx : X → A) (cy : Y → B) (cz : Z → C) + (compatibleY : Triple A B C → Y → Prop) + (compatibleZ : Triple A B C → Z → Prop) + (usefulX : Triple A B C → X → Prop) + (usefulY : Triple A B C → Y → Prop) + (usefulZ : Triple A B C → Z → Prop) (e : Triple A B C) : + let a := assignments ambient targets hx hy hz cx cy cz + compatibleY compatibleZ usefulX usefulY usefulZ + branch (ExactRecovery.delete T px py pz) a e = + ExactRecovery.delete (ideal T cx cy cz usefulX usefulY usefulZ e) + (fun x => a.x x = some e ∧ px x) + (fun y => a.y y = some e ∧ py y) + (fun z => a.z z = some e ∧ pz z) := by + dsimp only + rw [branch_eq_delete_ideal, ideal_delete] + funext x y z + simp only [ExactRecovery.delete] + split_ifs <;> simp_all + +theorem masked_source_restriction [Fintype X] [Fintype Y] [Fintype Z] + [DecidableEq A] [DecidableEq B] [DecidableEq C] + (T : Tensor F X Y Z) (a : Assignment X Y Z (Triple A B C)) + (hcoherent : Coherent T a) (px : X → Prop) (py : Y → Prop) (pz : Z → Prop) : + Tensor.restrict (assignmentMatrix a.x) (assignmentMatrix a.y) (assignmentMatrix a.z) + (ExactRecovery.delete T px py pz) = + Tensor.directSum (branch (ExactRecovery.delete T px py pz) a) := by + apply restrict_assignments_eq_directSum + apply coherent_of_support_subset T _ a hcoherent + intro x y z h ht + exact h (by simp [ExactRecovery.delete, ht]) + +end MatrixMultiplication.JointIdealBranches + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/JointExtraction/LossCounts.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/JointExtraction/LossCounts.lean new file mode 100644 index 0000000000000000000000000000000000000000..4f5d5f8f5200afa648e25f7bda343c57fb3a7e67 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/JointExtraction/LossCounts.lean @@ -0,0 +1,269 @@ +import OAI.LinearAlgebra.MatrixMultiplication.Entropy.ComplexFiniteEntropy +import OAI.LinearAlgebra.MatrixMultiplication.Separation.ComplexSeparationCounting +import Mathlib.Tactic.Linarith + +namespace OAI + +/-! Joint tensor extraction, compatibility and entropy estimates. -/ + +noncomputable section + +namespace MatrixMultiplication.JointLossCounts + +open scoped BigOperators + +attribute [local instance] Classical.propDecidable + +variable {Ω V I : Type*} + +theorem card_filter_exists_le (samples : Finset Ω) (indices : Finset I) + (event : I → Ω → Prop) : + (samples.filter (fun ω => ∃ i ∈ indices, event i ω)).card ≤ + ∑ i ∈ indices, (samples.filter (event i)).card := by + classical + have heq : samples.filter (fun ω => ∃ i ∈ indices, event i ω) = + indices.biUnion (fun i => samples.filter (event i)) := by + ext ω + simp only [Finset.mem_filter, Finset.mem_biUnion] + constructor + · rintro ⟨hω, i, hi, he⟩ + exact ⟨i, hi, hω, he⟩ + · rintro ⟨i, hi, hω, he⟩ + exact ⟨hω, i, hi, he⟩ + rw [heq] + exact Finset.card_biUnion_le + +theorem competitor_union_card_mul_le (ownSurvival : Finset Ω) + (competitors : Finset I) (collision : I → Ω → Prop) (M : ℕ) + (hcollision : ∀ i ∈ competitors, + M * (ownSurvival.filter (collision i)).card ≤ ownSurvival.card) : + M * (ownSurvival.filter (fun ω => ∃ i ∈ competitors, collision i ω)).card ≤ + competitors.card * ownSurvival.card := by + classical + calc + _ ≤ M * ∑ i ∈ competitors, (ownSurvival.filter (collision i)).card := + Nat.mul_le_mul_left M (card_filter_exists_le ownSurvival competitors collision) + _ = ∑ i ∈ competitors, M * (ownSurvival.filter (collision i)).card := + by rw [Finset.mul_sum] + _ ≤ ∑ _i ∈ competitors, ownSurvival.card := + Finset.sum_le_sum hcollision + _ = _ := by simp + +def randomLossCount (passing : Finset V) (bad : V → Ω → Prop) (ω : Ω) : ℕ := by + classical + exact (passing.filter (fun v => bad v ω)).card + +def randomLossFraction (full passing : Finset V) (bad : V → Ω → Prop) (ω : Ω) : ℝ := + (randomLossCount passing bad ω : ℝ) / (full.card : ℝ) + +theorem randomLossFraction_nonneg (full passing : Finset V) + (bad : V → Ω → Prop) (ω : Ω) : 0 ≤ randomLossFraction full passing bad ω := + div_nonneg (Nat.cast_nonneg _) (Nat.cast_nonneg _) + +theorem sum_randomLossCount (ownSurvival : Finset Ω) (passing : Finset V) + (bad : V → Ω → Prop) : + (∑ ω ∈ ownSurvival, randomLossCount passing bad ω) = + ∑ v ∈ passing, (ownSurvival.filter (bad v)).card := by + classical + simp only [randomLossCount, Finset.card_filter] + exact Finset.sum_comm + +theorem sum_randomLossCount_le (ownSurvival : Finset Ω) (full passing : Finset V) + (bad : V → Ω → Prop) (ε : ℝ) (hε : 0 ≤ ε) (hpassing : passing ⊆ full) + (hbad : ∀ v ∈ passing, + ((ownSurvival.filter (bad v)).card : ℝ) ≤ ε * (ownSurvival.card : ℝ)) : + (∑ ω ∈ ownSurvival, (randomLossCount passing bad ω : ℝ)) ≤ + (full.card : ℝ) * (ε * (ownSurvival.card : ℝ)) := by + classical + have hdouble : (∑ ω ∈ ownSurvival, (randomLossCount passing bad ω : ℝ)) = + ∑ v ∈ passing, ((ownSurvival.filter (bad v)).card : ℝ) := by + exact_mod_cast sum_randomLossCount ownSurvival passing bad + rw [hdouble] + calc + _ ≤ ∑ _v ∈ passing, ε * (ownSurvival.card : ℝ) := Finset.sum_le_sum hbad + _ = (passing.card : ℝ) * (ε * (ownSurvival.card : ℝ)) := by simp + _ ≤ _ := mul_le_mul_of_nonneg_right + (by exact_mod_cast Finset.card_le_card hpassing) + (mul_nonneg hε (Nat.cast_nonneg _)) + +theorem sum_randomLossFraction_le (ownSurvival : Finset Ω) (full passing : Finset V) + (bad : V → Ω → Prop) (ε : ℝ) (hε : 0 ≤ ε) (hfull : 0 < full.card) + (hpassing : passing ⊆ full) + (hbad : ∀ v ∈ passing, + ((ownSurvival.filter (bad v)).card : ℝ) ≤ ε * (ownSurvival.card : ℝ)) : + (∑ ω ∈ ownSurvival, randomLossFraction full passing bad ω) ≤ + ε * (ownSurvival.card : ℝ) := by + have hcard : (0 : ℝ) < full.card := by exact_mod_cast hfull + simp only [randomLossFraction, ← Finset.sum_div] + apply (div_le_iff₀ hcard).2 + simpa only [mul_comm] using + sum_randomLossCount_le ownSurvival full passing bad ε hε hpassing hbad + +theorem conditional_mean_randomLossFraction_le + (ownSurvival : Finset Ω) (full passing : Finset V) (bad : V → Ω → Prop) + (ε : ℝ) (hε : 0 ≤ ε) (hs : 0 < ownSurvival.card) (hfull : 0 < full.card) + (hpassing : passing ⊆ full) + (hbad : ∀ v ∈ passing, + ((ownSurvival.filter (bad v)).card : ℝ) ≤ ε * (ownSurvival.card : ℝ)) : + (∑ ω ∈ ownSurvival, randomLossFraction full passing bad ω) / + (ownSurvival.card : ℝ) ≤ ε := by + apply (div_le_iff₀ (by exact_mod_cast hs : (0 : ℝ) < ownSurvival.card)).2 + exact sum_randomLossFraction_le ownSurvival full passing bad ε hε hfull hpassing hbad + +theorem card_filter_mul_le_sum (samples : Finset Ω) (f : Ω → ℝ) (t : ℝ) + (hf : ∀ ω ∈ samples, 0 ≤ f ω) : + ((samples.filter (fun ω => t < f ω)).card : ℝ) * t ≤ + ∑ ω ∈ samples, f ω := by + classical + calc + _ = ∑ _ω ∈ samples.filter (fun ω => t < f ω), t := by simp + _ ≤ ∑ ω ∈ samples.filter (fun ω => t < f ω), f ω := by + apply Finset.sum_le_sum + intro ω hω + exact (Finset.mem_filter.mp hω).2.le + _ ≤ _ := Finset.sum_le_sum_of_subset_of_nonneg (Finset.filter_subset _ _) + (fun ω hω _ => hf ω hω) + +theorem bad_orbit_card_le (ownSurvival : Finset Ω) (full passing : Finset V) + (bad : V → Ω → Prop) (ε N : ℝ) (hε : 0 ≤ ε) (hN : 0 < N) + (hfull : 0 < full.card) (hpassing : passing ⊆ full) + (hbad : ∀ v ∈ passing, + ((ownSurvival.filter (bad v)).card : ℝ) ≤ ε * (ownSurvival.card : ℝ)) : + ((ownSurvival.filter (fun ω => 1 / N < randomLossFraction full passing bad ω)).card : ℝ) + ≤ N * ε * (ownSurvival.card : ℝ) := by + classical + have hm := card_filter_mul_le_sum ownSurvival + (randomLossFraction full passing bad) (1 / N) + (fun ω _ => randomLossFraction_nonneg full passing bad ω) + have he := sum_randomLossFraction_le ownSurvival full passing bad ε hε hfull hpassing hbad + have hdiv : + ((ownSurvival.filter (fun ω => 1 / N < randomLossFraction full passing bad ω)).card : ℝ) / N + ≤ ε * (ownSurvival.card : ℝ) := by + simpa only [one_div, ← div_eq_mul_inv] using hm.trans he + have hmul := (div_le_iff₀ hN).1 hdiv + simpa only [mul_assoc, mul_comm, mul_left_comm] using hmul + +def targetBad (orbits : Finset I) (full passing : I → Finset V) + (bad : I → V → Ω → Prop) (eligible : Ω → Prop) (N : ℝ) (ω : Ω) : Prop := + ¬ eligible ω ∨ ∃ i ∈ orbits, 1 / N < randomLossFraction (full i) (passing i) (bad i) ω + +theorem targetBad_card_le (ownSurvival : Finset Ω) (orbits : Finset I) + (full passing : I → Finset V) (bad : I → V → Ω → Prop) + (eligible : Ω → Prop) (ε eligibilityError N : ℝ) + (hε : 0 ≤ ε) (hN : 0 < N) + (hfull : ∀ i ∈ orbits, 0 < (full i).card) + (hpassing : ∀ i ∈ orbits, passing i ⊆ full i) + (hbad : ∀ i ∈ orbits, ∀ v ∈ passing i, + ((ownSurvival.filter (bad i v)).card : ℝ) ≤ ε * (ownSurvival.card : ℝ)) + (heligible : ((ownSurvival.filter (fun ω => ¬ eligible ω)).card : ℝ) ≤ + eligibilityError * (ownSurvival.card : ℝ)) : + ((ownSurvival.filter (targetBad orbits full passing bad eligible N)).card : ℝ) ≤ + (eligibilityError + (orbits.card : ℝ) * N * ε) * (ownSurvival.card : ℝ) := by + classical + let excess := fun i ω => 1 / N < randomLossFraction (full i) (passing i) (bad i) ω + have hunion : ownSurvival.filter (targetBad orbits full passing bad eligible N) = + (ownSurvival.filter (fun ω => ¬ eligible ω)) ∪ + (ownSurvival.filter (fun ω => ∃ i ∈ orbits, excess i ω)) := by + ext ω + simp only [Finset.mem_filter, Finset.mem_union, targetBad, excess] + constructor + · rintro ⟨hω, he | ho⟩ + · exact Or.inl ⟨hω, he⟩ + · exact Or.inr ⟨hω, ho⟩ + · rintro (⟨hω, he⟩ | ⟨hω, ho⟩) + · exact ⟨hω, Or.inl he⟩ + · exact ⟨hω, Or.inr ho⟩ + have hu : ((ownSurvival.filter (targetBad orbits full passing bad eligible N)).card : ℝ) ≤ + ((ownSurvival.filter (fun ω => ¬ eligible ω)).card : ℝ) + + ((ownSurvival.filter (fun ω => ∃ i ∈ orbits, excess i ω)).card : ℝ) := by + rw [hunion] + exact_mod_cast Finset.card_union_le + (ownSurvival.filter (fun ω => ¬ eligible ω)) + (ownSurvival.filter (fun ω => ∃ i ∈ orbits, excess i ω)) + have horbits : ((ownSurvival.filter (fun ω => ∃ i ∈ orbits, excess i ω)).card : ℝ) ≤ + ∑ i ∈ orbits, ((ownSurvival.filter (excess i)).card : ℝ) := by + exact_mod_cast card_filter_exists_le ownSurvival orbits excess + have hsum : (∑ i ∈ orbits, ((ownSurvival.filter (excess i)).card : ℝ)) ≤ + (orbits.card : ℝ) * (N * ε * (ownSurvival.card : ℝ)) := by + calc + _ ≤ ∑ _i ∈ orbits, N * ε * (ownSurvival.card : ℝ) := by + apply Finset.sum_le_sum + intro i hi + exact bad_orbit_card_le ownSurvival (full i) (passing i) (bad i) + ε N hε hN (hfull i hi) (hpassing i hi) (hbad i hi) + _ = _ := by simp + calc + _ ≤ eligibilityError * (ownSurvival.card : ℝ) + + (orbits.card : ℝ) * (N * ε * (ownSurvival.card : ℝ)) := + hu.trans (add_le_add heligible (horbits.trans hsum)) + _ = _ := by ring + +theorem good_card_lower (ownSurvival : Finset Ω) (failure : Ω → Prop) (error : ℝ) + (hbad : ((ownSurvival.filter failure).card : ℝ) ≤ error * (ownSurvival.card : ℝ)) : + (1 - error) * (ownSurvival.card : ℝ) ≤ + ((ownSurvival.filter (fun ω => ¬ failure ω)).card : ℝ) := by + classical + have hsplit := Finset.card_filter_add_card_filter_not + (s := ownSurvival) failure + have hsplitR : ((ownSurvival.filter failure).card : ℝ) + + ((ownSurvival.filter (fun ω => ¬ failure ω)).card : ℝ) = + (ownSurvival.card : ℝ) := by exact_mod_cast hsplit + nlinarith + +section MissingVariables + +variable [DecidableEq V] + +def retained (passing : Finset V) (bad : V → Ω → Prop) (ω : Ω) : Finset V := + passing.filter (fun v => ¬ bad v ω) + +def deterministicLossFraction (full passing : Finset V) : ℝ := + ((full \ passing).card : ℝ) / (full.card : ℝ) + +def missingFraction (full passing : Finset V) (bad : V → Ω → Prop) (ω : Ω) : ℝ := + ((full \ retained passing bad ω).card : ℝ) / (full.card : ℝ) + +theorem missing_card_eq (full passing : Finset V) (bad : V → Ω → Prop) (ω : Ω) + (hpassing : passing ⊆ full) : + (full \ retained passing bad ω).card = + (full \ passing).card + randomLossCount passing bad ω := by + classical + have hkeep : retained passing bad ω ⊆ full := + (Finset.filter_subset _ _).trans hpassing + have h₁ := Finset.card_sdiff_add_card_eq_card hpassing + have h₂ := Finset.card_sdiff_add_card_eq_card hkeep + have h₃ := Finset.card_filter_add_card_filter_not + (s := passing) (fun v => bad v ω) + simp only [retained, randomLossCount] at * + omega + +theorem missingFraction_eq (full passing : Finset V) (bad : V → Ω → Prop) (ω : Ω) + (hpassing : passing ⊆ full) : + missingFraction full passing bad ω = deterministicLossFraction full passing + + randomLossFraction full passing bad ω := by + unfold missingFraction deterministicLossFraction randomLossFraction + rw [missing_card_eq full passing bad ω hpassing, Nat.cast_add, add_div] + +theorem good_missingFraction_le (orbits : Finset I) (full passing : I → Finset V) + (bad : I → V → Ω → Prop) (eligible : Ω → Prop) (C₀ N : ℝ) (ω : Ω) + (hgood : ¬ targetBad orbits full passing bad eligible N ω) + (hpassing : ∀ i ∈ orbits, passing i ⊆ full i) + (hdet : ∀ i ∈ orbits, deterministicLossFraction (full i) (passing i) ≤ C₀ / N) + (i : I) (hi : i ∈ orbits) : + missingFraction (full i) (passing i) (bad i) ω ≤ (C₀ + 1) / N := by + have hr : randomLossFraction (full i) (passing i) (bad i) ω ≤ 1 / N := by + apply le_of_not_gt + intro h + exact hgood (Or.inr ⟨i, hi, h⟩) + rw [missingFraction_eq (full i) (passing i) (bad i) ω (hpassing i hi)] + calc + _ ≤ C₀ / N + 1 / N := add_le_add (hdet i hi) hr + _ = _ := (add_div C₀ 1 N).symm + +end MissingVariables + +end MatrixMultiplication.JointLossCounts + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/JointExtraction/MarginalSupport.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/JointExtraction/MarginalSupport.lean new file mode 100644 index 0000000000000000000000000000000000000000..3233054cd06f813699f3a72e61051a875c4a32ab --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/JointExtraction/MarginalSupport.lean @@ -0,0 +1,64 @@ +import OAI.LinearAlgebra.MatrixMultiplication.JointExtraction.AmbientDegree + +namespace OAI + +/-! Joint tensor extraction, compatibility and entropy estimates. -/ + +noncomputable section + +namespace MatrixMultiplication.JointMarginalSupport + +open MatrixMultiplication.Foundation JointPopulation JointAmbientDegree +open scoped BigOperators + +attribute [local instance] Classical.propDecidable + +variable {H : Type*} [Fintype H] [DecidableEq H] + (counts : H → Shape → ℕ) (sum : H → ℕ) + +omit [Fintype H] [DecidableEq H] in +theorem localAllowed_coordinate_witness (h : H) (w : Positions counts h → Shape) + (hw : localAllowed counts sum h w) (s : Fin 3) (i : Positions counts h) : + ∃ j : Positions counts h, + shapeSide s ((canonicalTarget counts h).val j) = shapeSide s (w i) := by + have hp : 0 < wordPopulation (shapeSide s ∘ w) (shapeSide s (w i)) := by + unfold wordPopulation + exact Fintype.card_pos_iff.mpr ⟨⟨i, rfl⟩⟩ + rw [hw.2 s (shapeSide s (w i))] at hp + obtain ⟨⟨j, hj⟩⟩ := Fintype.card_pos_iff.mp hp + exact ⟨j, hj⟩ + +omit [Fintype H] [DecidableEq H] in +theorem localAllowed_coordinate_support (h : H) (w : Positions counts h → Shape) + (hw : localAllowed counts sum h w) (allowed : Fin 3 → Fin 17 → Prop) + (hallowed : ∀ u, 0 < counts h u → ∀ s, allowed s (shapeSide s u)) : + ∀ i s, allowed s (shapeSide s (w i)) := by + intro i s + obtain ⟨j, hj⟩ := localAllowed_coordinate_witness counts sum h w hw s i + rw [← hj] + exact hallowed ((canonicalTarget counts h).val j) + (symbol_count_pos counts (canonicalTarget counts) h j) s + +omit [Fintype H] [DecidableEq H] in +theorem localAllowed_parent_bounds (h : H) (w : Positions counts h → Shape) + (hw : localAllowed counts sum h w) (parent : Fin 3 → ℕ) + (hparent : ∀ u, 0 < counts h u → ∀ s, (shapeSide s u).val ≤ parent s) : + ∀ i s, (shapeSide s (w i)).val ≤ parent s := + localAllowed_coordinate_support counts sum h w hw + (fun s a => a.val ≤ parent s) hparent + +omit [Fintype H] [DecidableEq H] in +theorem localAllowed_positive_reference (h : H) (w : Positions counts h → Shape) + (hw : localAllowed counts sum h w) (parent : Fin 3 → ℕ) (p : Shape → ℝ) + (hparent : ∀ u, 0 < counts h u → ∀ s, (shapeSide s u).val ≤ parent s) + (hp : ∀ u : Shape, u.1.val + u.2.1.val + u.2.2.val = sum h → + (∀ s, (shapeSide s u).val ≤ parent s) → 0 < p u) : + ∀ i, 0 < p (w i) := by + intro i + exact hp (w i) (hw.1 i) (localAllowed_parent_bounds counts sum h w hw parent hparent i) + +end MatrixMultiplication.JointMarginalSupport + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/JointExtraction/MaskedAssignment.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/JointExtraction/MaskedAssignment.lean new file mode 100644 index 0000000000000000000000000000000000000000..e048bdf928acd77bcb74ace414f8096acec09ff5 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/JointExtraction/MaskedAssignment.lean @@ -0,0 +1,141 @@ +import OAI.LinearAlgebra.MatrixMultiplication.JointExtraction.MaskedSelection + +namespace OAI + +/-! Joint tensor extraction, compatibility and entropy estimates. -/ + +noncomputable section + +namespace MatrixMultiplication.JointMaskedSelection.OrbitData + +open JointCoarseHashing + +attribute [local instance] Classical.propDecidable + +variable {P E O V : Type*} [Fintype P] [Fintype E] + +def actualTargets (d : OrbitData P E O V) : Finset (Triple P) := + Finset.univ.image d.coarse + +theorem coarse_mem_actualTargets (d : OrbitData P E O V) (e : E) : + d.coarse e ∈ d.actualTargets := + Finset.mem_image.mpr ⟨e, Finset.mem_univ e, rfl⟩ + +def xFlag (k : ℕ) (U : Finset (ZMod (37 ^ k))) (s : Sample P k) (I : Word P) : Prop := + JointHashing.xHash s (castWord k I) ∈ U + +def yFlag (k : ℕ) (U : Finset (ZMod (37 ^ k))) (s : Sample P k) (J : Word P) : Prop := + JointHashing.yHash s (castWord k J) ∈ U + +def zFlag (d : OrbitData P E O V) (k : ℕ) (U : Finset (ZMod (37 ^ k))) + (s : Sample P k) (K : Word P) : Prop := + JointHashing.zHash (twoUnit k) s (fun p => (d.support p : ZMod (37 ^ k))) (castWord k K) ∈ U + +omit [Fintype E] in +theorem actual_survival_iff (d : OrbitData P E O V) (k : ℕ) + (U : Finset (ZMod (37 ^ k))) + (hAP : ∀ x ∈ U, ∀ y ∈ U, ∀ z ∈ U, x + y = 2 * z → x = z ∧ y = z) + (s : Sample P k) (f : Triple P) (hf : f ∈ d.ambient) : + JointCoarseAssignment.survives (xFlag k U s) (yFlag k U s) (d.zFlag k U s) f ↔ + Survives k U f s := + full_survival_iff k U hAP d.support f (d.support_ambient f hf) s + +def actualEligible (d : OrbitData P E O V) (k : ℕ) (U : Finset (ZMod (37 ^ k))) + (s : Sample P k) : Finset (Triple P) := + JointCoarseAssignment.eligible d.ambient d.actualTargets + (xFlag k U s) (yFlag k U s) (d.zFlag k U s) + +theorem good_mem_actualEligible (d : OrbitData P E O V) (k : ℕ) + (U : Finset (ZMod (37 ^ k))) + (hAP : ∀ x ∈ U, ∀ y ∈ U, ∀ z ∈ U, x + y = 2 * z → x = z ∧ y = z) + (N : ℝ) (e : E) (s : Sample P k) (hg : d.Good k U N e s) : + d.coarse e ∈ d.actualEligible k U s := by + apply JointAssignmentLoss.eligible_of_no_ambientXCollision d.ambient d.actualTargets + (xFlag k U s) (yFlag k U s) (d.zFlag k U s) (d.coarse e) + (d.target_mem e) (d.coarse_mem_actualTargets e) + ((d.actual_survival_iff k U hAP s _ (d.target_mem e)).2 hg.1) + rintro ⟨f, hf, hne, hs, hx⟩ + exact d.good_eligibility k U N e s hg + ⟨f, (d.mem_eligibilityCompetitors e f).2 ⟨hf, hne, hx⟩, + (d.actual_survival_iff k U hAP s f hf).1 hs⟩ + +def actualAssignment (d : OrbitData P E O V) (k : ℕ) (U : Finset (ZMod (37 ^ k))) + (compatible useful : Triple P → V → Prop) (keep : V → Prop) + (s : Sample P k) (v : V) : Option (Triple P) := + JointExtraction.retainAssignment + (JointCoarseAssignment.assignUseful (d.actualEligible k U s) compatible useful) keep v + +theorem model_retained_assigned (d : OrbitData P E O V) (k : ℕ) + (U : Finset (ZMod (37 ^ k))) + (hAP : ∀ x ∈ U, ∀ y ∈ U, ∀ z ∈ U, x + y = 2 * z → x = z ∧ y = z) + (N : ℝ) (e : E) (o : O) (ho : o ∈ d.orbits e) (s : Sample P k) + (hg : d.Good k U N e s) + (compatible useful : Triple P → V → Prop) (keep : V → Prop) + (v : V) (hv : v ∈ JointLossCounts.retained (d.passing e o) (d.variableBad k U e o) s) + (hc : compatible (d.coarse e) v) (hu : useful (d.coarse e) v) (hk : keep v) + (hcover : ∀ f ∈ d.actualTargets, f ≠ d.coarse e → compatible f v → + f ∈ d.competitors e o v) : + d.actualAssignment k U compatible useful keep s v = some (d.coarse e) := by + obtain ⟨hpass, hnotbad⟩ := Finset.mem_filter.1 hv + have hassign := JointAssignmentLoss.assignUseful_of_no_targetCollision + d.ambient d.actualTargets (xFlag k U s) (yFlag k U s) (d.zFlag k U s) + compatible useful (d.coarse e) v (d.good_mem_actualEligible k U hAP N e s hg) hc hu + (by + rintro ⟨f, hf, hne, hsurv, hcomp⟩ + have hfc := hcover f hf hne hcomp + have hfa := d.competitor_mem e o ho v hpass f hfc + exact hnotbad ⟨f, hfc, (d.actual_survival_iff k U hAP s f hfa).1 hsurv⟩) + simpa only [actualAssignment, actualEligible, JointExtraction.retainAssignment, ite_eq_left hk] using hassign + +theorem actual_failure_subset_model_missing (d : OrbitData P E O V) (k : ℕ) + (U : Finset (ZMod (37 ^ k))) + (hAP : ∀ x ∈ U, ∀ y ∈ U, ∀ z ∈ U, x + y = 2 * z → x = z ∧ y = z) + (N : ℝ) (e : E) (o : O) (ho : o ∈ d.orbits e) (s : Sample P k) + (hg : d.Good k U N e s) + (compatible useful : Triple P → V → Prop) (keep : V → Prop) + (hc : ∀ v ∈ d.passing e o, compatible (d.coarse e) v) + (hu : ∀ v ∈ d.passing e o, useful (d.coarse e) v) + (hk : ∀ v ∈ d.passing e o, keep v) + (hcover : ∀ v ∈ d.passing e o, ∀ f ∈ d.actualTargets, + f ≠ d.coarse e → compatible f v → f ∈ d.competitors e o v) : + (d.full e o).filter (fun v => d.actualAssignment k U compatible useful keep s v ≠ + some (d.coarse e)) ⊆ + d.full e o \ JointLossCounts.retained (d.passing e o) (d.variableBad k U e o) s := by + intro v hv + obtain ⟨hvfull, hvfail⟩ := Finset.mem_filter.1 hv + apply Finset.mem_sdiff.2 + refine ⟨hvfull, ?_⟩ + intro hvmodel + have hpass := (Finset.mem_filter.1 hvmodel).1 + exact hvfail (d.model_retained_assigned k U hAP N e o ho s hg compatible useful keep v + hvmodel (hc v hpass) (hu v hpass) (hk v hpass) (hcover v hpass)) + +theorem good_actual_missingFraction_le (d : OrbitData P E O V) (k : ℕ) + (U : Finset (ZMod (37 ^ k))) + (hAP : ∀ x ∈ U, ∀ y ∈ U, ∀ z ∈ U, x + y = 2 * z → x = z ∧ y = z) + (C₀ N : ℝ) (e : E) (o : O) (ho : o ∈ d.orbits e) (s : Sample P k) + (hg : d.Good k U N e s) + (compatible useful : Triple P → V → Prop) (keep : V → Prop) + (hc : ∀ v ∈ d.passing e o, compatible (d.coarse e) v) + (hu : ∀ v ∈ d.passing e o, useful (d.coarse e) v) + (hk : ∀ v ∈ d.passing e o, keep v) + (hcover : ∀ v ∈ d.passing e o, ∀ f ∈ d.actualTargets, + f ≠ d.coarse e → compatible f v → f ∈ d.competitors e o v) + (hdet : ∀ o ∈ d.orbits e, + JointLossCounts.deterministicLossFraction (d.full e o) (d.passing e o) ≤ C₀ / N) : + (((d.full e o).filter (fun v => d.actualAssignment k U compatible useful keep s v ≠ + some (d.coarse e))).card : ℝ) / ((d.full e o).card : ℝ) ≤ (C₀ + 1) / N := by + have hcard := Finset.card_le_card + (d.actual_failure_subset_model_missing k U hAP N e o ho s hg compatible useful keep hc hu hk hcover) + have hR : (((d.full e o).filter (fun v => d.actualAssignment k U compatible useful keep s v ≠ + some (d.coarse e))).card : ℝ) ≤ + ((d.full e o \ JointLossCounts.retained (d.passing e o) (d.variableBad k U e o) s).card : ℝ) := by + exact_mod_cast hcard + exact (div_le_div_of_nonneg_right hR (Nat.cast_nonneg _)).trans + (d.good_missingFraction_le k U C₀ N e s hg hdet o ho) + +end MatrixMultiplication.JointMaskedSelection.OrbitData + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/JointExtraction/MaskedGoodSelection.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/JointExtraction/MaskedGoodSelection.lean new file mode 100644 index 0000000000000000000000000000000000000000..318bd2a8abf7a698d7b266430008eb2e0bcc5903 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/JointExtraction/MaskedGoodSelection.lean @@ -0,0 +1,138 @@ +import OAI.LinearAlgebra.MatrixMultiplication.JointExtraction.MaskedRates + +namespace OAI + +/-! Joint tensor extraction, compatibility and entropy estimates. -/ + +noncomputable section + +namespace MatrixMultiplication.JointMaskedGoodSelection + +open Filter JointCoarseHashing JointExtractionRates JointMaskedSelection +open JointOrdinarySelection (hashLevel hashSet) +open JointMaskedRates +open scoped Topology + +attribute [local instance] Classical.propDecidable + +theorem eventually_exists_good_selection + {P E O V : ℕ → Type*} [∀ N, Fintype (P N)] [∀ N, Fintype (E N)] + (d : ∀ N, OrbitData (P N) (E N) (O N) (V N)) + (hinj : ∀ N, Function.Injective (d N).coarse) + (degree : ℕ → ℕ) (B p : ℕ) + (heligibility : ∀ N e, ((d N).eligibilityCompetitors e).card ≤ degree N) + (hdegree : ∀ N e, ∀ o ∈ (d N).orbits e, ∀ v ∈ (d N).passing e o, + ((d N).competitors e o v).card ≤ degree N) + (horbits : ∀ N e, ((d N).orbits e).card ≤ B * (N + 1) ^ p) + {A D H : ℝ} (hH : 0 ≤ H) (hgap : D < H) + (hdegreeRate : ∀ η : ℝ, 0 < η → + ∀ᶠ N in atTop, Real.log (degree N : ℝ) / (N : ℝ) ≤ D + η) + (hpos : ∀ᶠ N in atTop, 0 < Fintype.card (E N)) + (hE : Tendsto (fun N => Real.log (Fintype.card (E N) : ℝ) / (N : ℝ)) atTop (𝓝 A)) + {ε : ℝ} (hε : 0 < ε) : + ∀ᶠ N in atTop, ∃ (s : Sample (P N) (hashLevel H N)) (G : Finset (E N)), + G.card = ⌊Real.exp ((N : ℝ) * (A - H - ε))⌋₊ ∧ + (∀ e ∈ G, (d N).Good (hashLevel H N) (hashSet H N) (N : ℝ) e s) ∧ + (∀ e ∈ G, ∀ f ∈ G, e ≠ f → ((d N).coarse e).1 ≠ ((d N).coarse f).1) := by + classical + have huniform := eventually_errorBound_le_half degree B p hH hgap hdegreeRate + have hsmall : ∀ᶠ N in atTop, ∀ e, + (((d N).eligibilityCompetitors e).card : ℝ) / (hashModulus H N : ℝ) + + (((d N).orbits e).card : ℝ) * (N : ℝ) * + ((degree N : ℝ) / (hashModulus H N : ℝ)) ≤ 1 / 2 := by + filter_upwards [huniform] with N hN e + exact (count_error_le_envelope (d N) e (degree N) B p N (hashModulus H N) + (heligibility N e) (horbits N e)).trans hN + have hpositive : ∀ᶠ N : ℕ in atTop, (0 : ℝ) < N := by + filter_upwards [eventually_gt_atTop (0 : ℕ)] with N hN + exact_mod_cast hN + let good := fun N (s : Sample (P N) (hashLevel H N)) (e : E N) => + (d N).Good (hashLevel H N) (hashSet H N) (N : ℝ) e s + have hinc : ∀ᶠ N in atTop, ∀ e, + (((JointAPFree.modularSet (hashModulus H N)).card : ℝ) / + (hashModulus H N : ℝ) ^ 2 / 2) * + (Fintype.card (Sample (P N) (hashLevel H N)) : ℝ) ≤ + (goodIncidence (good N) e : ℝ) := by + filter_upwards [hsmall, hpositive] with N hN hNpos e + rw [show goodIncidence (good N) e = + ((d N).goodEvent (hashLevel H N) (hashSet H N) (N : ℝ) e).card from + (d N).goodIncidence_eq _ _ _ _] + exact (d N).goodEvent_card_lower (hashLevel H N) (hashSet H N) (N : ℝ) hNpos e + (degree N) (hdegree N e) (hN e) + have hyield := eventually_exists_many_good_explicit good hH hpos hinc hE hε + have hselection := eventually_exists_good_subfamily good + (fun N => ⌊Real.exp ((N : ℝ) * (A - H - ε))⌋₊) hyield + filter_upwards [hselection] with N hN + obtain ⟨s, G, hcard, hgood⟩ := hN + refine ⟨s, G, hcard, hgood, ?_⟩ + intro e he f hf hne + exact (d N).good_no_shared_x (hashLevel H N) (hashSet H N) (N : ℝ) f e s + (hgood f hf) (hgood e he) (fun h => hne ((hinj N) h)) + +end MatrixMultiplication.JointMaskedGoodSelection + +namespace MatrixMultiplication.JointMaskedSelection.OrbitData + +open JointCoarseHashing +attribute [local instance] Classical.propDecidable + +variable {P E O V : Type*} [Fintype P] [Fintype E] + +omit [Fintype E] in +theorem good_randomLossFraction_le (d : OrbitData P E O V) (k : ℕ) + (U : Finset (ZMod (37 ^ k))) (N : ℝ) (e : E) (s : Sample P k) + (hg : d.Good k U N e s) (o : O) (ho : o ∈ d.orbits e) : + JointLossCounts.randomLossFraction (d.full e o) (d.passing e o) + (d.variableBad k U e o) s ≤ 1 / N := by + exact le_of_not_gt (fun h => hg.2 (Or.inr ⟨o, ho, h⟩)) + +theorem passing_actual_failure_subset_bad (d : OrbitData P E O V) (k : ℕ) + (U : Finset (ZMod (37 ^ k))) + (hAP : ∀ x ∈ U, ∀ y ∈ U, ∀ z ∈ U, x + y = 2 * z → x = z ∧ y = z) + (N : ℝ) (e : E) (o : O) (ho : o ∈ d.orbits e) (s : Sample P k) + (hg : d.Good k U N e s) + (compatible useful : Triple P → V → Prop) (keep : V → Prop) + (hc : ∀ v ∈ d.passing e o, compatible (d.coarse e) v) + (hu : ∀ v ∈ d.passing e o, useful (d.coarse e) v) + (hk : ∀ v ∈ d.passing e o, keep v) + (hcover : ∀ v ∈ d.passing e o, ∀ f ∈ d.actualTargets, + f ≠ d.coarse e → compatible f v → f ∈ d.competitors e o v) : + (d.passing e o).filter (fun v => d.actualAssignment k U compatible useful keep s v ≠ + some (d.coarse e)) ⊆ (d.passing e o).filter (fun v => d.variableBad k U e o v s) := by + intro v hv + obtain ⟨hpass, hfail⟩ := Finset.mem_filter.mp hv + refine Finset.mem_filter.mpr ⟨hpass, ?_⟩ + by_contra hnotbad + have hret : v ∈ JointLossCounts.retained (d.passing e o) (d.variableBad k U e o) s := + Finset.mem_filter.mpr ⟨hpass, hnotbad⟩ + exact hfail (d.model_retained_assigned k U hAP N e o ho s hg + compatible useful keep v hret (hc v hpass) (hu v hpass) (hk v hpass) (hcover v hpass)) + +theorem good_passing_actual_failure_fraction_le (d : OrbitData P E O V) (k : ℕ) + (U : Finset (ZMod (37 ^ k))) + (hAP : ∀ x ∈ U, ∀ y ∈ U, ∀ z ∈ U, x + y = 2 * z → x = z ∧ y = z) + (N : ℝ) (e : E) (o : O) (ho : o ∈ d.orbits e) (s : Sample P k) + (hg : d.Good k U N e s) + (compatible useful : Triple P → V → Prop) (keep : V → Prop) + (hc : ∀ v ∈ d.passing e o, compatible (d.coarse e) v) + (hu : ∀ v ∈ d.passing e o, useful (d.coarse e) v) + (hk : ∀ v ∈ d.passing e o, keep v) + (hcover : ∀ v ∈ d.passing e o, ∀ f ∈ d.actualTargets, + f ≠ d.coarse e → compatible f v → f ∈ d.competitors e o v) : + (((d.passing e o).filter (fun v => d.actualAssignment k U compatible useful keep s v ≠ + some (d.coarse e))).card : ℝ) / ((d.full e o).card : ℝ) ≤ 1 / N := by + have hcard := Finset.card_le_card + (d.passing_actual_failure_subset_bad k U hAP N e o ho s hg + compatible useful keep hc hu hk hcover) + have hR : (((d.passing e o).filter (fun v => + d.actualAssignment k U compatible useful keep s v ≠ some (d.coarse e))).card : ℝ) ≤ + (((d.passing e o).filter (fun v => d.variableBad k U e o v s)).card : ℝ) := by + exact_mod_cast hcard + exact (div_le_div_of_nonneg_right hR (Nat.cast_nonneg _)).trans + (d.good_randomLossFraction_le k U N e s hg o ho) + +end MatrixMultiplication.JointMaskedSelection.OrbitData + +end + +end OAI diff --git a/lean/OAI/LinearAlgebra/MatrixMultiplication/JointExtraction/MaskedRates.lean b/lean/OAI/LinearAlgebra/MatrixMultiplication/JointExtraction/MaskedRates.lean new file mode 100644 index 0000000000000000000000000000000000000000..0fb7e2754b16eee0f8ad2ab41be5dc6a50f0ade0 --- /dev/null +++ b/lean/OAI/LinearAlgebra/MatrixMultiplication/JointExtraction/MaskedRates.lean @@ -0,0 +1,149 @@ +import OAI.LinearAlgebra.MatrixMultiplication.JointExtraction.MaskedAssignment +import OAI.LinearAlgebra.MatrixMultiplication.JointExtraction.OrdinarySelection + +namespace OAI + +/-! Joint tensor extraction, compatibility and entropy estimates. -/ + +noncomputable section + +namespace MatrixMultiplication.JointMaskedRates + +open Filter JointCoarseHashing JointExtractionRates JointMaskedSelection +open JointOrdinarySelection (hashLevel hashSet) +open scoped Topology + +attribute [local instance] Classical.propDecidable + +def errorBound (degree : ℕ → ℕ) (B p : ℕ) (H : ℝ) (N : ℕ) : ℝ := + (degree N : ℝ) / (hashModulus H N : ℝ) * + (1 + (B : ℝ) * ((N : ℝ) + 1) ^ p * (N : ℝ)) + +theorem polynomialFactor_le (B p N : ℕ) : + 1 + (B : ℝ) * ((N : ℝ) + 1) ^ p * (N : ℝ) ≤ + ((B : ℝ) + 1) * ((N : ℝ) + 1) ^ (p + 1) := by + have hN : (0 : ℝ) ≤ N := Nat.cast_nonneg _ + have hx : (0 : ℝ) ≤ (N : ℝ) + 1 := by linarith + have hpower : (1 : ℝ) ≤ ((N : ℝ) + 1) ^ (p + 1) := + one_le_pow₀ (by linarith : (1 : ℝ) ≤ (N : ℝ) + 1) + calc + _ ≤ 1 + (B : ℝ) * ((N : ℝ) + 1) ^ p * ((N : ℝ) + 1) := + add_le_add le_rfl (mul_le_mul_of_nonneg_left (by linarith) + (mul_nonneg (Nat.cast_nonneg _) (pow_nonneg hx _))) + _ = 1 + (B : ℝ) * ((N : ℝ) + 1) ^ (p + 1) := by rw [pow_succ]; ring + _ ≤ ((N : ℝ) + 1) ^ (p + 1) + (B : ℝ) * ((N : ℝ) + 1) ^ (p + 1) := + add_le_add hpower le_rfl + _ = _ := by ring + +theorem eventually_errorBound_le_half (degree : ℕ → ℕ) (B p : ℕ) + {D H : ℝ} (hH : 0 ≤ H) (hgap : D < H) + (hdegreeRate : ∀ η : ℝ, 0 < η → + ∀ᶠ N in atTop, Real.log (degree N : ℝ) / (N : ℝ) ≤ D + η) : + ∀ᶠ N in atTop, errorBound degree B p H N ≤ 1 / 2 := by + let c : ℝ := (H - D) / 2 + have hc : 0 < c := by dsimp [c]; linarith + have hclt : c < H - D := by dsimp [c]; linarith + have hratio := eventually_degree_div_hashModulus_le_exp hH hdegreeRate hclt + apply eventually_error_le_half ((B : ℝ) + 1) (p + 1) hc + filter_upwards [hratio] with N hN + have hx : (0 : ℝ) ≤ (N : ℝ) + 1 := add_nonneg (Nat.cast_nonneg N) zero_le_one + have hfactor : 0 ≤ 1 + (B : ℝ) * ((N : ℝ) + 1) ^ p * (N : ℝ) := + add_nonneg zero_le_one + (mul_nonneg (mul_nonneg (Nat.cast_nonneg _) (pow_nonneg hx _)) (Nat.cast_nonneg _)) + calc + errorBound degree B p H N ≤ Real.exp (-c * (N : ℝ)) * + (1 + (B : ℝ) * ((N : ℝ) + 1) ^ p * (N : ℝ)) := + mul_le_mul_of_nonneg_right hN hfactor + _ ≤ Real.exp (-c * (N : ℝ)) * (((B : ℝ) + 1) * ((N : ℝ) + 1) ^ (p + 1)) := + mul_le_mul_of_nonneg_left (polynomialFactor_le B p N) (Real.exp_pos _).le + _ = ((B : ℝ) + 1) * (((N : ℝ) + 1) ^ (p + 1) * Real.exp (-c * (N : ℝ))) := by ring + +theorem count_error_le_envelope {P E O V : Type*} (d : OrbitData P E O V) + (e : E) (degree B p N M : ℕ) + (heligibility : (d.eligibilityCompetitors e).card ≤ degree) + (horbits : (d.orbits e).card ≤ B * (N + 1) ^ p) : + ((d.eligibilityCompetitors e).card : ℝ) / (M : ℝ) + + ((d.orbits e).card : ℝ) * (N : ℝ) * ((degree : ℝ) / (M : ℝ)) ≤ + (degree : ℝ) / (M : ℝ) * (1 + (B : ℝ) * ((N : ℝ) + 1) ^ p * (N : ℝ)) := by + have hdegreeR : ((d.eligibilityCompetitors e).card : ℝ) ≤ (degree : ℝ) := by + exact_mod_cast heligibility + have horbitsR : ((d.orbits e).card : ℝ) ≤ (B : ℝ) * ((N : ℝ) + 1) ^ p := by + exact_mod_cast horbits + have hratio : (0 : ℝ) ≤ (degree : ℝ) / (M : ℝ) := + div_nonneg (Nat.cast_nonneg _) (Nat.cast_nonneg _) + calc + _ ≤ (degree : ℝ) / (M : ℝ) + + ((B : ℝ) * ((N : ℝ) + 1) ^ p) * (N : ℝ) * ((degree : ℝ) / (M : ℝ)) := + add_le_add (div_le_div_of_nonneg_right hdegreeR (Nat.cast_nonneg _)) + (mul_le_mul_of_nonneg_right + (mul_le_mul_of_nonneg_right horbitsR (Nat.cast_nonneg _)) hratio) + _ = _ := by ring + +theorem eventually_exists_selection + {P E O V : ℕ → Type*} [∀ N, Fintype (P N)] [∀ N, Fintype (E N)] + (d : ∀ N, OrbitData (P N) (E N) (O N) (V N)) + (hinj : ∀ N, Function.Injective (d N).coarse) + (degree : ℕ → ℕ) (B p : ℕ) + (heligibility : ∀ N e, ((d N).eligibilityCompetitors e).card ≤ degree N) + (hdegree : ∀ N e, ∀ o ∈ (d N).orbits e, ∀ v ∈ (d N).passing e o, + ((d N).competitors e o v).card ≤ degree N) + (horbits : ∀ N e, ((d N).orbits e).card ≤ B * (N + 1) ^ p) + {A D H C₀ : ℝ} (hH : 0 ≤ H) (hgap : D < H) + (hdegreeRate : ∀ η : ℝ, 0 < η → + ∀ᶠ N in atTop, Real.log (degree N : ℝ) / (N : ℝ) ≤ D + η) + (hdet : ∀ᶠ N in atTop, ∀ e, ∀ o ∈ (d N).orbits e, + JointLossCounts.deterministicLossFraction ((d N).full e o) ((d N).passing e o) ≤ + C₀ / (N : ℝ)) + (hpos : ∀ᶠ N in atTop, 0 < Fintype.card (E N)) + (hE : Tendsto (fun N => Real.log (Fintype.card (E N) : ℝ) / (N : ℝ)) atTop (𝓝 A)) + {ε : ℝ} (hε : 0 < ε) : + ∀ᶠ N in atTop, ∃ (s : Sample (P N) (hashLevel H N)) (G : Finset (E N)), + G.card = ⌊Real.exp ((N : ℝ) * (A - H - ε))⌋₊ ∧ + (∀ e ∈ G, (d N).Good (hashLevel H N) (hashSet H N) (N : ℝ) e s) ∧ + (∀ e ∈ G, ∀ f ∈ G, e ≠ f → ((d N).coarse e).1 ≠ ((d N).coarse f).1) ∧ + ∀ e ∈ G, ∀ o ∈ (d N).orbits e, + JointLossCounts.missingFraction ((d N).full e o) ((d N).passing e o) + ((d N).variableBad (hashLevel H N) (hashSet H N) e o) s ≤ (C₀ + 1) / (N : ℝ) := by + classical + have huniform := eventually_errorBound_le_half degree B p hH hgap hdegreeRate + have hsmall : ∀ᶠ N in atTop, ∀ e, + (((d N).eligibilityCompetitors e).card : ℝ) / (hashModulus H N : ℝ) + + (((d N).orbits e).card : ℝ) * (N : ℝ) * + ((degree N : ℝ) / (hashModulus H N : ℝ)) ≤ 1 / 2 := by + filter_upwards [huniform] with N hN e + exact (count_error_le_envelope (d N) e (degree N) B p N (hashModulus H N) + (heligibility N e) (horbits N e)).trans hN + have hpositive : ∀ᶠ N : ℕ in atTop, (0 : ℝ) < N := by + filter_upwards [eventually_gt_atTop (0 : ℕ)] with N hN + exact_mod_cast hN + let good := fun N (s : Sample (P N) (hashLevel H N)) (e : E N) => + (d N).Good (hashLevel H N) (hashSet H N) (N : ℝ) e s + have hinc : ∀ᶠ N in atTop, ∀ e, + (((JointAPFree.modularSet (hashModulus H N)).card : ℝ) / + (hashModulus H N : ℝ) ^ 2 / 2) * + (Fintype.card (Sample (P N) (hashLevel H N)) : ℝ) ≤ + (goodIncidence (good N) e : ℝ) := by + filter_upwards [hsmall, hpositive] with N hN hNpos e + rw [show goodIncidence (good N) e = + ((d N).goodEvent (hashLevel H N) (hashSet H N) (N : ℝ) e).card from + (d N).goodIncidence_eq _ _ _ _] + exact (d N).goodEvent_card_lower (hashLevel H N) (hashSet H N) (N : ℝ) hNpos e + (degree N) (hdegree N e) (hN e) + have hyield := eventually_exists_many_good_explicit good hH hpos hinc hE hε + have hselection := eventually_exists_good_subfamily good + (fun N => ⌊Real.exp ((N : ℝ) * (A - H - ε))⌋₊) hyield + filter_upwards [hselection, hdet] with N hN hdetN + obtain ⟨s, G, hcard, hgood⟩ := hN + refine ⟨s, G, hcard, hgood, ?_, ?_⟩ + · intro e he f hf hne + exact (d N).good_no_shared_x (hashLevel H N) (hashSet H N) (N : ℝ) f e s + (hgood f hf) (hgood e he) (fun h => hne ((hinj N) h)) + · intro e he o ho + exact (d N).good_missingFraction_le (hashLevel H N) (hashSet H N) C₀ (N : ℝ) e s + (hgood e he) (hdetN e) o ho + +end MatrixMultiplication.JointMaskedRates + +end + +end OAI